summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixFCmd.c
blob: ec50bf7454a58fc93373d6f292385bef9fc57476 (plain)
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
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
/*
 * 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 © 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.
 *
 * Portions of this code were derived from NetBSD source code which has the
 * following copyright notice:
 *
 * Copyright © 1988, 1993, 1994
 *      The Regents of the University of California. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the University nor the names of its contributors may
 *    be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 */

#include "tclInt.h"
#ifndef HAVE_STRUCT_STAT_ST_BLKSIZE
#ifndef NO_FSTATFS
#include <sys/statfs.h>
#endif
#endif /* !HAVE_STRUCT_STAT_ST_BLKSIZE */
#ifdef HAVE_FTS
#include <fts.h>
#endif

/*
 * The following constants specify the type of callback when
 * TraverseUnixTree() calls the traverseProc()
 */

#define DOTREE_PRED	1	/* pre-order directory */
#define DOTREE_POSTD	2	/* post-order directory */
#define DOTREE_F	3	/* regular file */

/*
 * Fallback temporary file location the temporary file generation code. Can be
 * overridden at compile time for when it is known that temp files can't be
 * written to /tmp (hello, iOS!).
 */

#ifndef TCL_TEMPORARY_FILE_DIRECTORY
#define TCL_TEMPORARY_FILE_DIRECTORY	"/tmp"
#endif

/*
 * Callbacks for file attributes code.
 */

static int		GetGroupAttribute(Tcl_Interp *interp, int objIndex,
			    Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr);
static int		GetOwnerAttribute(Tcl_Interp *interp, int objIndex,
			    Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr);
static int		GetPermissionsAttribute(Tcl_Interp *interp,
			    int objIndex, Tcl_Obj *fileName,
			    Tcl_Obj **attributePtrPtr);
static int		SetGroupAttribute(Tcl_Interp *interp, int objIndex,
			    Tcl_Obj *fileName, Tcl_Obj *attributePtr);
static int		SetOwnerAttribute(Tcl_Interp *interp, int objIndex,
			    Tcl_Obj *fileName, Tcl_Obj *attributePtr);
static int		SetPermissionsAttribute(Tcl_Interp *interp,
			    int objIndex, Tcl_Obj *fileName,
			    Tcl_Obj *attributePtr);
static int		GetModeFromPermString(Tcl_Interp *interp,
			    const char *modeStringPtr, mode_t *modePtr);
#if defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE) || defined(__CYGWIN__)
static int		GetUnixFileAttributes(Tcl_Interp *interp, int objIndex,
			    Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr);
static int		SetUnixFileAttributes(Tcl_Interp *interp, int objIndex,
			    Tcl_Obj *fileName, Tcl_Obj *attributePtr);
#endif

/*
 * Prototype for the TraverseUnixTree callback function.
 */

typedef int (TraversalProc)(Tcl_DString *srcPtr, Tcl_DString *dstPtr,
	const Tcl_StatBuf *statBufPtr, int type, Tcl_DString *errorPtr);

/*
 * Constants and variables necessary for file attributes subcommand.
 *
 * IMPORTANT: The permissions attribute is assumed to be the third item (i.e.
 * to be indexed with '2' in arrays) in code in tclIOUtil.c and possibly
 * elsewhere in Tcl's core.
 */

#ifndef DJGPP

enum {
#if defined(__CYGWIN__)
    UNIX_ARCHIVE_ATTRIBUTE,
#endif
    UNIX_GROUP_ATTRIBUTE,
#if defined(__CYGWIN__)
    UNIX_HIDDEN_ATTRIBUTE,
#endif
    UNIX_OWNER_ATTRIBUTE, UNIX_PERMISSIONS_ATTRIBUTE,
#if defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE) || defined(__CYGWIN__)
    UNIX_READONLY_ATTRIBUTE,
#endif
#if defined(__CYGWIN__)
    UNIX_SYSTEM_ATTRIBUTE,
#endif
#ifdef MAC_OSX_TCL
    MACOSX_CREATOR_ATTRIBUTE, MACOSX_TYPE_ATTRIBUTE, MACOSX_HIDDEN_ATTRIBUTE,
    MACOSX_RSRCLENGTH_ATTRIBUTE,
#endif
    UNIX_INVALID_ATTRIBUTE
};

const char *const tclpFileAttrStrings[] = {
#if defined(__CYGWIN__)
    "-archive",
#endif
    "-group",
#if defined(__CYGWIN__)
    "-hidden",
#endif
    "-owner", "-permissions",
#if defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE) || defined(__CYGWIN__)
    "-readonly",
#endif
#if defined(__CYGWIN__)
    "-system",
#endif
#ifdef MAC_OSX_TCL
    "-creator", "-type", "-hidden", "-rsrclength",
#endif
    NULL
};

const TclFileAttrProcs tclpFileAttrProcs[] = {
#if defined(__CYGWIN__)
    {GetUnixFileAttributes, SetUnixFileAttributes},
#endif
    {GetGroupAttribute, SetGroupAttribute},
#if defined(__CYGWIN__)
    {GetUnixFileAttributes, SetUnixFileAttributes},
#endif
    {GetOwnerAttribute, SetOwnerAttribute},
    {GetPermissionsAttribute, SetPermissionsAttribute},
#if defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE) || defined(__CYGWIN__)
    {GetUnixFileAttributes, SetUnixFileAttributes},
#endif
#if defined(__CYGWIN__)
    {GetUnixFileAttributes, SetUnixFileAttributes},
#endif
#ifdef MAC_OSX_TCL
    {TclMacOSXGetFileAttribute,	TclMacOSXSetFileAttribute},
    {TclMacOSXGetFileAttribute,	TclMacOSXSetFileAttribute},
    {TclMacOSXGetFileAttribute,	TclMacOSXSetFileAttribute},
    {TclMacOSXGetFileAttribute,	TclMacOSXSetFileAttribute},
#endif
};
#endif /* DJGPP */

/*
 * This is the maximum number of consecutive readdir/unlink calls that can be
 * made (with no intervening rewinddir or closedir/opendir) before triggering
 * a bug that makes readdir return NULL even though some directory entries
 * have not been processed. The bug afflicts SunOS's readdir when applied to
 * ufs file systems and Darwin 6.5's (and OSX v.10.3.8's) HFS+. JH found the
 * Darwin readdir to reset at 147, so 130 is chosen to be conservative. We
 * can't do a general rewind on failure as NFS can create special files that
 * recreate themselves when you try and delete them. 8.4.8 added a solution
 * that was affected by a single such NFS file, this solution should not be
 * affected by less than THRESHOLD such files. [Bug 1034337]
 */

#define MAX_READDIR_UNLINK_THRESHOLD 130

/*
 * Declarations for local procedures defined in this file:
 */

static int		CopyFileAtts(const char *src,
			    const char *dst, const Tcl_StatBuf *statBufPtr);
static const char *	DefaultTempDir(void);
static int		DoCopyFile(const char *srcPtr, const char *dstPtr,
			    const Tcl_StatBuf *statBufPtr);
static int		DoCreateDirectory(const char *pathPtr);
static int		DoRemoveDirectory(Tcl_DString *pathPtr,
			    int recursive, Tcl_DString *errorPtr);
static int		DoRenameFile(const char *src, const char *dst);
static int		TraversalCopy(Tcl_DString *srcPtr,
			    Tcl_DString *dstPtr,
			    const Tcl_StatBuf *statBufPtr, int type,
			    Tcl_DString *errorPtr);
static int		TraversalDelete(Tcl_DString *srcPtr,
			    Tcl_DString *dstPtr,
			    const Tcl_StatBuf *statBufPtr, int type,
			    Tcl_DString *errorPtr);
static int		TraverseUnixTree(TraversalProc *traversalProc,
			    Tcl_DString *sourcePtr, Tcl_DString *destPtr,
			    Tcl_DString *errorPtr, int doRewind);

#ifdef PURIFY
/*
 * realpath and purify don't mix happily. It has been noted that realpath
 * should not be used with purify because of bogus warnings, but just
 * memset'ing the resolved path will squelch those. This assumes we are
 * passing the standard MAXPATHLEN size resolved arg.
 */

static char *		Realpath(const char *path, char *resolved);

char *
Realpath(
    const char *path,
    char *resolved)
{
    memset(resolved, 0, MAXPATHLEN);
    return realpath(path, resolved);
}
#else
#   define Realpath	realpath
#endif /* PURIFY */

#ifndef NO_REALPATH
#if defined(__APPLE__) && TCL_THREADS && \
	defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
	MAC_OS_X_VERSION_MIN_REQUIRED < 1030
/*
 * Prior to Darwin 7, realpath is not thread-safe, c.f. Bug 711232; if we
 * might potentially be running on pre-10.3 OSX, check Darwin release at
 * runtime before using realpath.
 */

MODULE_SCOPE long tclMacOSXDarwinRelease;
#   define haveRealpath	(tclMacOSXDarwinRelease >= 7)
#else
#   define haveRealpath	1
#endif
#else /* NO_REALPATH */
/*
 * At least TclpObjNormalizedPath now requires REALPATH
*/
#error NO_REALPATH is not supported
#endif /* NO_REALPATH */

#ifdef HAVE_FTS
#if defined(HAVE_STRUCT_STAT64) && !defined(__APPLE__)
/* fts doesn't do stat64 */
#   define noFtsStat	1
#elif defined(__APPLE__) && defined(__LP64__) && \
	defined(MAC_OS_X_VERSION_MIN_REQUIRED) && \
	MAC_OS_X_VERSION_MIN_REQUIRED < 1050
/*
 * Prior to Darwin 9, 64bit fts_open() without FTS_NOSTAT may crash (due to a
 * 64bit-unsafe ALIGN macro); if we could be running on pre-10.5 OSX, check
 * Darwin release at runtime and do a separate stat() if necessary.
 */

MODULE_SCOPE long tclMacOSXDarwinRelease;
#   define noFtsStat	(tclMacOSXDarwinRelease < 9)
#else
#   define noFtsStat	0
#endif
#endif /* HAVE_FTS */

/*
 *---------------------------------------------------------------------------
 *
 * TclpObjRenameFile, DoRenameFile --
 *
 *	Changes the name of an existing file or directory, from src to dst. If
 *	src and dst refer to the same file or directory, does nothing and
 *	returns success. Otherwise if dst already exists, it will be deleted
 *	and replaced by src subject to the following conditions:
 *	    If src is a directory, dst may be an empty directory.
 *	    If src is a file, dst may be a file.
 *	In any other situation where dst already exists, the rename will fail.
 *
 * Results:
 *	If the directory was successfully created, returns TCL_OK. Otherwise
 *	the return value is TCL_ERROR and errno is set to indicate the error.
 *	Some possible values for errno are:
 *
 *	EACCES:	    src or dst parent directory can't be read and/or written.
 *	EEXIST:	    dst is a non-empty directory.
 *	EINVAL:	    src is a root directory or dst is a subdirectory of src.
 *	EISDIR:	    dst is a directory, but src is not.
 *	ENOENT:	    src doesn't exist, or src or dst is "".
 *	ENOTDIR:    src is a directory, but dst is not.
 *	EXDEV:	    src and dst are on different filesystems.
 *
 * Side effects:
 *	The implementation of rename may allow cross-filesystem renames, but
 *	the caller should be prepared to emulate it with copy and delete if
 *	errno is EXDEV.
 *
 *---------------------------------------------------------------------------
 */

int
TclpObjRenameFile(
    Tcl_Obj *srcPathPtr,
    Tcl_Obj *destPathPtr)
{
    return DoRenameFile((const char *)Tcl_FSGetNativePath(srcPathPtr),
	    (const char *)Tcl_FSGetNativePath(destPathPtr));
}

static int
DoRenameFile(
    const char *src,		/* Pathname of file or dir to be renamed
				 * (native). */
    const char *dst)		/* New pathname of file or directory
				 * (native). */
{
    if (rename(src, dst) == 0) {			/* INTL: Native. */
	return TCL_OK;
    }
    if (errno == ENOTEMPTY) {
	errno = EEXIST;
    }

    /*
     * IRIX returns EIO when you attempt to move a directory into itself. We
     * just map EIO to EINVAL get the right message on SGI. Most platforms
     * don't return EIO except in really strange cases.
     */

    if (errno == EIO) {
	errno = EINVAL;
    }

#ifndef NO_REALPATH
    /*
     * SunOS 4.1.4 reports overwriting a non-empty directory with a directory
     * as EINVAL instead of EEXIST (first rule out the correct EINVAL result
     * code for moving a directory into itself). Must be conditionally
     * compiled because realpath() not defined on all systems.
     */

    if (errno == EINVAL && haveRealpath) {
	char srcPath[MAXPATHLEN], dstPath[MAXPATHLEN];
	TclDIR *dirPtr;
	Tcl_DirEntry *dirEntPtr;

	if ((Realpath((char *) src, srcPath) != NULL)	/* INTL: Native. */
		&& (Realpath((char *) dst, dstPath) != NULL) /* INTL: Native */
		&& (strncmp(srcPath, dstPath, strlen(srcPath)) != 0)) {
	    dirPtr = TclOSopendir(dst);			/* INTL: Native. */
	    if (dirPtr != NULL) {
		while (1) {
		    dirEntPtr = TclOSreaddir(dirPtr);	/* INTL: Native. */
		    if (dirEntPtr == NULL) {
			break;
		    }
		    if ((strcmp(dirEntPtr->d_name, ".") != 0) &&
			    (strcmp(dirEntPtr->d_name, "..") != 0)) {
			errno = EEXIST;
			TclOSclosedir(dirPtr);
			return TCL_ERROR;
		    }
		}
		TclOSclosedir(dirPtr);
	    }
	}
	errno = EINVAL;
    }
#endif	/* !NO_REALPATH */

    if (strcmp(src, "/") == 0) {
	/*
	 * Alpha reports renaming / as EBUSY and Linux reports it as EACCES,
	 * instead of EINVAL.
	 */

	errno = EINVAL;
    }

    /*
     * DEC Alpha OSF1 V3.0 returns EACCES when attempting to move a file
     * across filesystems and the parent directory of that file is not
     * writable. Most other systems return EXDEV. Does nothing to correct this
     * behavior.
     */

    return TCL_ERROR;
}

/*
 *---------------------------------------------------------------------------
 *
 * TclpObjCopyFile, DoCopyFile --
 *
 *	Copy a single file (not a directory). If dst already exists and is not
 *	a directory, it is removed.
 *
 * Results:
 *	If the file was successfully copied, returns TCL_OK. Otherwise the
 *	return value is TCL_ERROR and errno is set to indicate the error. Some
 *	possible values for errno are:
 *
 *	EACCES:	    src or dst parent directory can't be read and/or written.
 *	EISDIR:	    src or dst is a directory.
 *	ENOENT:	    src doesn't exist. src or dst is "".
 *
 * Side effects:
 *	This procedure will also copy symbolic links, block, and character
 *	devices, and fifos. For symbolic links, the links themselves will be
 *	copied and not what they point to. For the other special file types,
 *	the directory entry will be copied and not the contents of the device
 *	that it refers to.
 *
 *---------------------------------------------------------------------------
 */

int
TclpObjCopyFile(
    Tcl_Obj *srcPathPtr,
    Tcl_Obj *destPathPtr)
{
    const char *src = (const char *)Tcl_FSGetNativePath(srcPathPtr);
    Tcl_StatBuf srcStatBuf;

    if (TclOSlstat(src, &srcStatBuf) != 0) {		/* INTL: Native. */
	return TCL_ERROR;
    }

    return DoCopyFile(src, (const char *)Tcl_FSGetNativePath(destPathPtr), &srcStatBuf);
}

static int
DoCopyFile(
    const char *src,		/* Pathname of file to be copied (native). */
    const char *dst,		/* Pathname of file to copy to (native). */
    const Tcl_StatBuf *statBufPtr)
				/* Used to determine filetype. */
{
    Tcl_StatBuf dstStatBuf;

    if (S_ISDIR(statBufPtr->st_mode)) {
	errno = EISDIR;
	return TCL_ERROR;
    }

    /*
     * Symlink, and some of the other calls will fail if the target exists, so
     * we remove it first.
     */

    if (TclOSlstat(dst, &dstStatBuf) == 0) {		/* INTL: Native. */
	if (S_ISDIR(dstStatBuf.st_mode)) {
	    errno = EISDIR;
	    return TCL_ERROR;
	}
    }
    if (unlink(dst) != 0) {				/* INTL: Native. */
	if (errno != ENOENT) {
	    return TCL_ERROR;
	}
    }

    switch ((int) (statBufPtr->st_mode & S_IFMT)) {
#ifndef DJGPP
    case S_IFLNK: {
	char linkBuf[MAXPATHLEN+1];
	int length;

	length = readlink(src, linkBuf, MAXPATHLEN);
							/* INTL: Native. */
	if (length == -1) {
	    return TCL_ERROR;
	}
	linkBuf[length] = '\0';
	if (symlink(linkBuf, dst) < 0) {		/* INTL: Native. */
	    return TCL_ERROR;
	}
#ifdef MAC_OSX_TCL
	TclMacOSXCopyFileAttributes(src, dst, statBufPtr);
#endif
	break;
    }
#endif /* !DJGPP */
    case S_IFBLK:
    case S_IFCHR:
	if (mknod(dst, statBufPtr->st_mode,		/* INTL: Native. */
		statBufPtr->st_rdev) < 0) {
	    return TCL_ERROR;
	}
	return CopyFileAtts(src, dst, statBufPtr);
    case S_IFIFO:
	if (mkfifo(dst, statBufPtr->st_mode) < 0) {	/* INTL: Native. */
	    return TCL_ERROR;
	}
	return CopyFileAtts(src, dst, statBufPtr);
    default:
	return TclUnixCopyFile(src, dst, statBufPtr, 0);
    }
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * TclUnixCopyFile -
 *
 *	Helper function for TclpCopyFile. Copies one regular file, using
 *	read() and write().
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	A file is copied. Dst will be overwritten if it exists.
 *
 *----------------------------------------------------------------------
 */

int
TclUnixCopyFile(
    const char *src,		/* Pathname of file to copy (native). */
    const char *dst,		/* Pathname of file to create/overwrite
				 * (native). */
    const Tcl_StatBuf *statBufPtr,
				/* Used to determine mode and blocksize. */
    int dontCopyAtts)		/* If flag set, don't copy attributes. */
{
    int srcFd, dstFd;
    size_t blockSize;		/* Optimal I/O blocksize for filesystem */
    char *buffer;		/* Data buffer for copy */
    ssize_t nread;

#ifdef DJGPP
#define BINMODE |O_BINARY
#else
#define BINMODE
#endif /* DJGPP */

#define DEFAULT_COPY_BLOCK_SIZE 4096

    if ((srcFd = TclOSopen(src, O_RDONLY BINMODE, 0)) < 0) { /* INTL: Native */
	return TCL_ERROR;
    }

    dstFd = TclOSopen(dst, O_CREAT|O_TRUNC|O_WRONLY BINMODE, /* INTL: Native */
	    statBufPtr->st_mode);
    if (dstFd < 0) {
	close(srcFd);
	return TCL_ERROR;
    }

    /*
     * Try to work out the best size of buffer to use for copying. If we
     * can't, it's no big deal as we can just use a (32-bit) page, since
     * that's likely to be fairly efficient anyway.
     */

#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
    blockSize = statBufPtr->st_blksize;
#elif !defined(NO_FSTATFS)
    {
	struct statfs fs;

	if (fstatfs(srcFd, &fs) == 0) {
	    blockSize = fs.f_bsize;
	} else {
	    blockSize = DEFAULT_COPY_BLOCK_SIZE;
	}
    }
#else
    blockSize = DEFAULT_COPY_BLOCK_SIZE;
#endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */

    /*
     * [SF Tcl Bug 1586470] Even if we HAVE_STRUCT_STAT_ST_BLKSIZE, there are
     * filesystems which report a bogus value for the blocksize. An example
     * is the Andrew Filesystem (afs), reporting a blocksize of 0. When
     * detecting such a situation we now simply fall back to a hardwired
     * default size.
     */

    if (blockSize <= 0) {
	blockSize = DEFAULT_COPY_BLOCK_SIZE;
    }
    buffer = (char *)Tcl_Alloc(blockSize);
    while (1) {
	nread = read(srcFd, buffer, blockSize);
	if ((nread == -1) || (nread == 0)) {
	    break;
	}
	if (write(dstFd, buffer, nread) != nread) {
	    nread = -1;
	    break;
	}
    }

    Tcl_Free(buffer);
    close(srcFd);
    if ((close(dstFd) != 0) || (nread == -1)) {
	unlink(dst);					/* INTL: Native. */
	return TCL_ERROR;
    }
    if (!dontCopyAtts && CopyFileAtts(src, dst, statBufPtr) == TCL_ERROR) {
	/*
	 * The copy succeeded, but setting the permissions failed, so be in a
	 * consistent state, we remove the file that was created by the copy.
	 */

	unlink(dst);					/* INTL: Native. */
	return TCL_ERROR;
    }
    return TCL_OK;
}

/*
 *---------------------------------------------------------------------------
 *
 * TclpObjDeleteFile, TclpDeleteFile --
 *
 *	Removes a single file (not a directory).
 *
 * Results:
 *	If the file was successfully deleted, returns TCL_OK. Otherwise the
 *	return value is TCL_ERROR and errno is set to indicate the error. Some
 *	possible values for errno are:
 *
 *	EACCES:	    a parent directory can't be read and/or written.
 *	EISDIR:	    path is a directory.
 *	ENOENT:	    path doesn't exist or is "".
 *
 * Side effects:
 *	The file is deleted, even if it is read-only.
 *
 *---------------------------------------------------------------------------
 */

int
TclpObjDeleteFile(
    Tcl_Obj *pathPtr)
{
    return TclpDeleteFile(Tcl_FSGetNativePath(pathPtr));
}

int
TclpDeleteFile(
    const void *path)		/* Pathname of file to be removed (native). */
{
    if (unlink((const char *)path) != 0) {
	return TCL_ERROR;
    }
    return TCL_OK;
}

/*
 *---------------------------------------------------------------------------
 *
 * TclpCreateDirectory, DoCreateDirectory --
 *
 *	Creates the specified directory. All parent directories of the
 *	specified directory must already exist. The directory is automatically
 *	created with permissions so that user can access the new directory and
 *	create new files or subdirectories in it.
 *
 * Results:
 *	If the directory was successfully created, returns TCL_OK. Otherwise
 *	the return value is TCL_ERROR and errno is set to indicate the error.
 *	Some possible values for errno are:
 *
 *	EACCES:	    a parent directory can't be read and/or written.
 *	EEXIST:	    path already exists.
 *	ENOENT:	    a parent directory doesn't exist.
 *
 * Side effects:
 *	A directory is created with the current umask, except that permission
 *	for u+rwx will always be added.
 *
 *---------------------------------------------------------------------------
 */

int
TclpObjCreateDirectory(
    Tcl_Obj *pathPtr)
{
    return DoCreateDirectory((const char *)Tcl_FSGetNativePath(pathPtr));
}

static int
DoCreateDirectory(
    const char *path)		/* Pathname of directory to create (native). */
{
    mode_t mode;

    mode = umask(0);
    umask(mode);

    /*
     * umask return value is actually the inverse of the permissions.
     */

    mode = (0777 & ~mode) | S_IRUSR | S_IWUSR | S_IXUSR;

    if (mkdir(path, mode) != 0) {			/* INTL: Native. */
	return TCL_ERROR;
    }
    return TCL_OK;
}

/*
 *---------------------------------------------------------------------------
 *
 * TclpObjCopyDirectory --
 *
 *	Recursively copies a directory. The target directory dst must not
 *	already exist. Note that this function does not merge two directory
 *	hierarchies, even if the target directory is an empty directory.
 *
 * Results:
 *	If the directory was successfully copied, returns TCL_OK. Otherwise
 *	the return value is TCL_ERROR, errno is set to indicate the error, and
 *	the pathname of the file that caused the error is stored in errorPtr.
 *	See TclpObjCreateDirectory and TclpObjCopyFile for a description of
 *	possible values for errno.
 *
 * Side effects:
 *	An exact copy of the directory hierarchy src will be created with the
 *	name dst. If an error occurs, the error will be returned immediately,
 *	and remaining files will not be processed.
 *
 *---------------------------------------------------------------------------
 */

int
TclpObjCopyDirectory(
    Tcl_Obj *srcPathPtr,
    Tcl_Obj *destPathPtr,
    Tcl_Obj **errorPtr)
{
    Tcl_DString ds;
    Tcl_DString srcString, dstString;
    int ret;
    Tcl_Obj *transPtr;

    transPtr = Tcl_FSGetTranslatedPath(NULL,srcPathPtr);
    ret = Tcl_UtfToExternalDStringEx(NULL, NULL,
	    (transPtr != NULL ? TclGetString(transPtr) : NULL),
	    -1, 0, &srcString, NULL);
    if (transPtr != NULL) {
	Tcl_DecrRefCount(transPtr);
    }
    if (ret != TCL_OK) {
	*errorPtr = srcPathPtr;
    } else {
	transPtr = Tcl_FSGetTranslatedPath(NULL,destPathPtr);
	ret = Tcl_UtfToExternalDStringEx(NULL, NULL,
	    (transPtr != NULL ? TclGetString(transPtr) : NULL),
	    -1, TCL_ENCODING_PROFILE_TCL8, &dstString, NULL);
	if (transPtr != NULL) {
	    Tcl_DecrRefCount(transPtr);
	}
	if (ret != TCL_OK) {
	    *errorPtr = destPathPtr;
	} else {
	    ret = TraverseUnixTree(TraversalCopy, &srcString, &dstString, &ds, 0);
	    /* Note above call only sets ds on error */
	    if (ret != TCL_OK) {
		*errorPtr = Tcl_DStringToObj(&ds);
	    }
	    Tcl_DStringFree(&dstString);
	}
	Tcl_DStringFree(&srcString);
    }
    if (ret != TCL_OK) {
	Tcl_IncrRefCount(*errorPtr);
    }
    return ret;
}

/*
 *---------------------------------------------------------------------------
 *
 * TclpRemoveDirectory, DoRemoveDirectory --
 *
 *	Removes directory (and its contents, if the recursive flag is set).
 *
 * Results:
 *	If the directory was successfully removed, returns TCL_OK. Otherwise
 *	the return value is TCL_ERROR, errno is set to indicate the error, and
 *	the pathname of the file that caused the error is stored in errorPtr.
 *	Some possible values for errno are:
 *
 *	EACCES:	    path directory can't be read and/or written.
 *	EEXIST:	    path is a non-empty directory.
 *	EINVAL:	    path is a root directory.
 *	ENOENT:	    path doesn't exist or is "".
 * 	ENOTDIR:    path is not a directory.
 *
 * Side effects:
 *	Directory removed. If an error occurs, the error will be returned
 *	immediately, and remaining files will not be deleted.
 *
 *---------------------------------------------------------------------------
 */

int
TclpObjRemoveDirectory(
    Tcl_Obj *pathPtr,
    int recursive,
    Tcl_Obj **errorPtr)
{
    Tcl_DString ds;
    Tcl_DString pathString;
    int ret;
    Tcl_Obj *transPtr = Tcl_FSGetTranslatedPath(NULL, pathPtr);

    ret = Tcl_UtfToExternalDStringEx(NULL, NULL,
	    (transPtr != NULL ? TclGetString(transPtr) : NULL),
	    -1, TCL_ENCODING_PROFILE_TCL8, &pathString, NULL);
    if (transPtr != NULL) {
	Tcl_DecrRefCount(transPtr);
    }
    if (ret != TCL_OK) {
	*errorPtr = pathPtr;
    } else {
	ret = DoRemoveDirectory(&pathString, recursive, &ds);
	Tcl_DStringFree(&pathString);
	/* Note above call only sets ds on error */
	if (ret != TCL_OK) {
	    *errorPtr = Tcl_DStringToObj(&ds);
	}
    }

    if (ret != TCL_OK) {
	Tcl_IncrRefCount(*errorPtr);
    }
    return ret;
}

static int
DoRemoveDirectory(
    Tcl_DString *pathPtr,	/* Pathname of directory to be removed
				 * (native). */
    int recursive,		/* If non-zero, removes directories that are
				 * nonempty. Otherwise, will only remove empty
				 * directories. */
    Tcl_DString *errorPtr)	/* If non-NULL, uninitialized or free DString
				 * filled with UTF-8 name of file causing
				 * error. */
{
    const char *path;
    mode_t oldPerm = 0;
    int result;

    path = Tcl_DStringValue(pathPtr);

    if (recursive != 0) {
	/*
	 * We should try to change permissions so this can be deleted.
	 */

	Tcl_StatBuf statBuf;
	int newPerm;

	if (TclOSstat(path, &statBuf) == 0) {
	    oldPerm = (mode_t) (statBuf.st_mode & 0x00007FFF);
	}

	newPerm = oldPerm | (64+128+256);
	chmod(path, (mode_t) newPerm);
    }

    if (rmdir(path) == 0) {				/* INTL: Native. */
	return TCL_OK;
    }
    if (errno == ENOTEMPTY) {
	errno = EEXIST;
    }

    result = TCL_OK;
    if ((errno != EEXIST) || (recursive == 0)) {
	if (errorPtr != NULL) {
	    Tcl_ExternalToUtfDStringEx(NULL, NULL, path, TCL_INDEX_NONE, 0, errorPtr, NULL);
	}
	result = TCL_ERROR;
    }

    /*
     * The directory is nonempty, but the recursive flag has been specified,
     * so we recursively remove all the files in the directory.
     */

    if (result == TCL_OK) {
	result = TraverseUnixTree(TraversalDelete, pathPtr, NULL, errorPtr, 1);
    }

    if ((result != TCL_OK) && (recursive != 0)) {
	/*
	 * Try to restore permissions.
	 */

	chmod(path, oldPerm);
    }
    return result;
}

/*
 *---------------------------------------------------------------------------
 *
 * TraverseUnixTree --
 *
 *	Traverse directory tree specified by sourcePtr, calling the function
 *	traverseProc for each file and directory encountered. If destPtr is
 *	non-null, each of name in the sourcePtr directory is appended to the
 *	directory specified by destPtr and passed as the second argument to
 *	traverseProc().
 *
 * Results:
 *	Standard Tcl result.
 *
 * Side effects:
 *	None caused by TraverseUnixTree, however the user specified
 *	traverseProc() may change state. If an error occurs, the error will be
 *	returned immediately, and remaining files will not be processed.
 *
 *---------------------------------------------------------------------------
 */

static int
TraverseUnixTree(
    TraversalProc *traverseProc,/* Function to call for every file and
				 * directory in source hierarchy. */
    Tcl_DString *sourcePtr,	/* Pathname of source directory to be
				 * traversed (native). */
    Tcl_DString *targetPtr,	/* Pathname of directory to traverse in
				 * parallel with source directory (native). */
    Tcl_DString *errorPtr,	/* If non-NULL, uninitialized or free DString
				 * filled with UTF-8 name of file causing
				 * error. */
    int doRewind)		/* Flag indicating that to ensure complete
    				 * traversal of source hierarchy, the readdir
    				 * loop should be rewound whenever
    				 * traverseProc has returned TCL_OK; this is
    				 * required when traverseProc modifies the
    				 * source hierarchy, e.g. by deleting
    				 * files. */
{
    Tcl_StatBuf statBuf;
    const char *source, *errfile;
    int result;
    size_t targetLen, sourceLen;
#ifndef HAVE_FTS
    int numProcessed = 0;
    Tcl_DirEntry *dirEntPtr;
    TclDIR *dirPtr;
#else
    const char *paths[2] = {NULL, NULL};
    FTS *fts = NULL;
    FTSENT *ent;
#endif

    errfile = NULL;
    result = TCL_OK;
    targetLen = 0;

    source = Tcl_DStringValue(sourcePtr);
    if (TclOSlstat(source, &statBuf) != 0) {		/* INTL: Native. */
	errfile = source;
	goto end;
    }
    if (!S_ISDIR(statBuf.st_mode)) {
	/*
	 * Process the regular file
	 */

	return traverseProc(sourcePtr, targetPtr, &statBuf, DOTREE_F,
		errorPtr);
    }
#ifndef HAVE_FTS
    dirPtr = TclOSopendir(source);			/* INTL: Native. */
    if (dirPtr == NULL) {
	/*
	 * Can't read directory
	 */

	errfile = source;
	goto end;
    }
    result = traverseProc(sourcePtr, targetPtr, &statBuf, DOTREE_PRED,
	    errorPtr);
    if (result != TCL_OK) {
	TclOSclosedir(dirPtr);
	return result;
    }

    TclDStringAppendLiteral(sourcePtr, "/");
    sourceLen = Tcl_DStringLength(sourcePtr);

    if (targetPtr != NULL) {
	TclDStringAppendLiteral(targetPtr, "/");
	targetLen = Tcl_DStringLength(targetPtr);
    }

    while ((dirEntPtr = TclOSreaddir(dirPtr)) != NULL) { /* INTL: Native. */
	if ((dirEntPtr->d_name[0] == '.')
		&& ((dirEntPtr->d_name[1] == '\0')
			|| (strcmp(dirEntPtr->d_name, "..") == 0))) {
	    continue;
	}

	/*
	 * Append name after slash, and recurse on the file.
	 */

	Tcl_DStringAppend(sourcePtr, dirEntPtr->d_name, TCL_INDEX_NONE);
	if (targetPtr != NULL) {
	    Tcl_DStringAppend(targetPtr, dirEntPtr->d_name, TCL_INDEX_NONE);
	}
	result = TraverseUnixTree(traverseProc, sourcePtr, targetPtr,
		errorPtr, doRewind);
	if (result != TCL_OK) {
	    break;
	} else {
	    numProcessed++;
	}

	/*
	 * Remove name after slash.
	 */

	Tcl_DStringSetLength(sourcePtr, sourceLen);
	if (targetPtr != NULL) {
	    Tcl_DStringSetLength(targetPtr, targetLen);
	}
	if (doRewind && (numProcessed > MAX_READDIR_UNLINK_THRESHOLD)) {
	    /*
	     * Call rewinddir if we've called unlink or rmdir so many times
	     * (since the opendir or the previous rewinddir), to avoid a
	     * NULL-return that may a symptom of a buggy readdir.
	     */

	    TclOSrewinddir(dirPtr);
	    numProcessed = 0;
	}
    }
    TclOSclosedir(dirPtr);

    /*
     * Strip off the trailing slash we added
     */

    Tcl_DStringSetLength(sourcePtr, sourceLen - 1);
    if (targetPtr != NULL) {
	Tcl_DStringSetLength(targetPtr, targetLen - 1);
    }

    if (result == TCL_OK) {
	/*
	 * Call traverseProc() on a directory after visiting all the files in
	 * that directory.
	 */

	result = traverseProc(sourcePtr, targetPtr, &statBuf, DOTREE_POSTD,
		errorPtr);
    }
#else /* HAVE_FTS */
    paths[0] = source;
    fts = fts_open((char **) paths, FTS_PHYSICAL | FTS_NOCHDIR |
	    (noFtsStat || doRewind ? FTS_NOSTAT : 0), NULL);
    if (fts == NULL) {
	errfile = source;
	goto end;
    }

    sourceLen = Tcl_DStringLength(sourcePtr);
    if (targetPtr != NULL) {
	targetLen = Tcl_DStringLength(targetPtr);
    }

    while ((ent = fts_read(fts)) != NULL) {
	unsigned short info = ent->fts_info;
	char *path = ent->fts_path + sourceLen;
	unsigned short pathlen = ent->fts_pathlen - sourceLen;
	int type;
	Tcl_StatBuf *statBufPtr = NULL;

	if (info == FTS_DNR || info == FTS_ERR || info == FTS_NS) {
	    errfile = ent->fts_path;
	    break;
	}
	Tcl_DStringAppend(sourcePtr, path, pathlen);
	if (targetPtr != NULL) {
	    Tcl_DStringAppend(targetPtr, path, pathlen);
	}
	switch (info) {
	case FTS_D:
	    type = DOTREE_PRED;
	    break;
	case FTS_DP:
	    type = DOTREE_POSTD;
	    break;
	default:
	    type = DOTREE_F;
	    break;
	}
	if (!doRewind) { /* no need to stat for delete */
	    if (noFtsStat) {
		statBufPtr = &statBuf;
		if (TclOSlstat(ent->fts_path, statBufPtr) != 0) {
		    errfile = ent->fts_path;
		    break;
		}
	    } else {
		statBufPtr = (Tcl_StatBuf *) ent->fts_statp;
	    }
	}
	result = traverseProc(sourcePtr, targetPtr, statBufPtr, type,
		errorPtr);
	if (result != TCL_OK) {
	    break;
	}
	Tcl_DStringSetLength(sourcePtr, sourceLen);
	if (targetPtr != NULL) {
	    Tcl_DStringSetLength(targetPtr, targetLen);
	}
    }
#endif /* !HAVE_FTS */

  end:
    if (errfile != NULL) {
	if (errorPtr != NULL) {
	    Tcl_ExternalToUtfDStringEx(NULL, NULL, errfile, TCL_INDEX_NONE, 0, errorPtr, NULL);
	}
	result = TCL_ERROR;
    }
#ifdef HAVE_FTS
    if (fts != NULL) {
	fts_close(fts);
    }
#endif

    return result;
}

/*
 *----------------------------------------------------------------------
 *
 * TraversalCopy
 *
 *	Called from TraverseUnixTree in order to execute a recursive copy of a
 *	directory.
 *
 * Results:
 *	Standard Tcl result.
 *
 * Side effects:
 *	The file or directory src may be copied to dst, depending on the value
 *	of type.
 *
 *----------------------------------------------------------------------
 */

static int
TraversalCopy(
    Tcl_DString *srcPtr,	/* Source pathname to copy (native). */
    Tcl_DString *dstPtr,	/* Destination pathname of copy (native). */
    const Tcl_StatBuf *statBufPtr,
				/* Stat info for file specified by srcPtr. */
    int type,			/* Reason for call - see TraverseUnixTree(). */
    Tcl_DString *errorPtr)	/* If non-NULL, uninitialized or free DString
				 * filled with UTF-8 name of file causing
				 * error. */
{
    switch (type) {
    case DOTREE_F:
	if (DoCopyFile(Tcl_DStringValue(srcPtr), Tcl_DStringValue(dstPtr),
		statBufPtr) == TCL_OK) {
	    return TCL_OK;
	}
	break;

    case DOTREE_PRED:
	if (DoCreateDirectory(Tcl_DStringValue(dstPtr)) == TCL_OK) {
	    return TCL_OK;
	}
	break;

    case DOTREE_POSTD:
	if (CopyFileAtts(Tcl_DStringValue(srcPtr),
		Tcl_DStringValue(dstPtr), statBufPtr) == TCL_OK) {
	    return TCL_OK;
	}
	break;
    }

    /*
     * There shouldn't be a problem with src, because we already checked it to
     * get here.
     */

    if (errorPtr != NULL) {
	Tcl_ExternalToUtfDStringEx(NULL, NULL, Tcl_DStringValue(dstPtr),
		Tcl_DStringLength(dstPtr), 0, errorPtr, NULL);
    }
    return TCL_ERROR;
}

/*
 *---------------------------------------------------------------------------
 *
 * TraversalDelete --
 *
 *	Called by procedure TraverseUnixTree for every file and directory that
 *	it encounters in a directory hierarchy. This procedure unlinks files,
 *	and removes directories after all the containing files have been
 *	processed.
 *
 * Results:
 *	Standard Tcl result.
 *
 * Side effects:
 *	Files or directory specified by src will be deleted.
 *
 *----------------------------------------------------------------------
 */

static int
TraversalDelete(
    Tcl_DString *srcPtr,	/* Source pathname (native). */
    TCL_UNUSED(Tcl_DString *),
    TCL_UNUSED(const Tcl_StatBuf *),
    int type,			/* Reason for call - see TraverseUnixTree(). */
    Tcl_DString *errorPtr)	/* If non-NULL, uninitialized or free DString
				 * filled with UTF-8 name of file causing
				 * error. */
{

    switch (type) {
    case DOTREE_F:
	if (TclpDeleteFile(Tcl_DStringValue(srcPtr)) == 0) {
	    return TCL_OK;
	}
	break;
    case DOTREE_PRED:
	return TCL_OK;
    case DOTREE_POSTD:
	if (DoRemoveDirectory(srcPtr, 0, NULL) == 0) {
	    return TCL_OK;
	}
	break;
    }
    if (errorPtr != NULL) {
	Tcl_ExternalToUtfDStringEx(NULL, NULL, Tcl_DStringValue(srcPtr),
		Tcl_DStringLength(srcPtr), 0, errorPtr, NULL);
    }
    return TCL_ERROR;
}

/*
 *---------------------------------------------------------------------------
 *
 * CopyFileAtts --
 *
 *	Copy the file attributes such as owner, group, permissions, and
 *	modification date from one file to another.
 *
 * Results:
 *	Standard Tcl result.
 *
 * Side effects:
 *	User id, group id, permission bits, last modification time, and last
 *	access time are updated in the new file to reflect the old file.
 *
 *---------------------------------------------------------------------------
 */

static int
CopyFileAtts(
#ifdef MAC_OSX_TCL
    const char *src,	/* Path name of source file (native). */
#else
    TCL_UNUSED(const char *) /*src*/,
#endif
    const char *dst,		/* Path name of target file (native). */
    const Tcl_StatBuf *statBufPtr)
				/* Stat info for source file */
{
    struct utimbuf tval;
    mode_t newMode;

    newMode = statBufPtr->st_mode
	    & (S_ISUID | S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO);

    /*
     * Note that if you copy a setuid file that is owned by someone else, and
     * you are not root, then the copy will be setuid to you. The most correct
     * implementation would probably be to have the copy not setuid to anyone
     * if the original file was owned by someone else, but this corner case
     * isn't currently handled. It would require another lstat(), or getuid().
     */

    if (chmod(dst, newMode)) {				/* INTL: Native. */
	newMode &= ~(S_ISUID | S_ISGID);
	if (chmod(dst, newMode)) {			/* INTL: Native. */
	    return TCL_ERROR;
	}
    }

    tval.actime = Tcl_GetAccessTimeFromStat(statBufPtr);
    tval.modtime = Tcl_GetModificationTimeFromStat(statBufPtr);

    if (utime(dst, &tval)) {				/* INTL: Native. */
	return TCL_ERROR;
    }
#ifdef MAC_OSX_TCL
    TclMacOSXCopyFileAttributes(src, dst, statBufPtr);
#endif
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * GetGroupAttribute
 *
 *	Gets the group attribute of a file.
 *
 * Results:
 *	Standard TCL result. Returns a new Tcl_Obj in attributePtrPtr if there
 *	is no error.
 *
 * Side effects:
 *	A new object is allocated.
 *
 *----------------------------------------------------------------------
 */

static int
GetGroupAttribute(
    Tcl_Interp *interp,		/* The interp we are using for errors. */
    TCL_UNUSED(int) /*objIndex*/,
    Tcl_Obj *fileName,		/* The name of the file (UTF-8). */
    Tcl_Obj **attributePtrPtr)	/* A pointer to return the object with. */
{
    Tcl_StatBuf statBuf;
    struct group *groupPtr;
    int result;

    result = TclpObjStat(fileName, &statBuf);

    if (result != 0) {
	if (interp != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "could not read \"%s\": %s",
		    TclGetString(fileName), Tcl_PosixError(interp)));
	}
	return TCL_ERROR;
    }

    groupPtr = TclpGetGrGid(statBuf.st_gid);

    if (groupPtr == NULL) {
	TclNewIntObj(*attributePtrPtr, statBuf.st_gid);
    } else {
	Tcl_DString ds;
	const char *utf;

	utf = Tcl_ExternalToUtfDString(NULL, groupPtr->gr_name, TCL_INDEX_NONE, &ds);
	*attributePtrPtr = Tcl_NewStringObj(utf, TCL_INDEX_NONE);
	Tcl_DStringFree(&ds);
    }
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * GetOwnerAttribute
 *
 *	Gets the owner attribute of a file.
 *
 * Results:
 *	Standard TCL result. Returns a new Tcl_Obj in attributePtrPtr if there
 *	is no error.
 *
 * Side effects:
 *	A new object is allocated.
 *
 *----------------------------------------------------------------------
 */

static int
GetOwnerAttribute(
    Tcl_Interp *interp,		/* The interp we are using for errors. */
    TCL_UNUSED(int) /*objIndex*/,
    Tcl_Obj *fileName,		/* The name of the file (UTF-8). */
    Tcl_Obj **attributePtrPtr)	/* A pointer to return the object with. */
{
    Tcl_StatBuf statBuf;
    struct passwd *pwPtr;
    int result;

    result = TclpObjStat(fileName, &statBuf);

    if (result != 0) {
	if (interp != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "could not read \"%s\": %s",
		    TclGetString(fileName), Tcl_PosixError(interp)));
	}
	return TCL_ERROR;
    }

    pwPtr = TclpGetPwUid(statBuf.st_uid);

    if (pwPtr == NULL) {
	TclNewIntObj(*attributePtrPtr, statBuf.st_uid);
    } else {
	Tcl_DString ds;

	(void)Tcl_ExternalToUtfDString(NULL, pwPtr->pw_name, TCL_INDEX_NONE, &ds);
	*attributePtrPtr = Tcl_DStringToObj(&ds);
    }
    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * GetPermissionsAttribute
 *
 *	Gets the group attribute of a file.
 *
 * Results:
 *	Standard TCL result. Returns a new Tcl_Obj in attributePtrPtr if there
 *	is no error. The object will have ref count 0.
 *
 * Side effects:
 *	A new object is allocated.
 *
 *----------------------------------------------------------------------
 */

static int
GetPermissionsAttribute(
    Tcl_Interp *interp,		    /* The interp we are using for errors. */
    TCL_UNUSED(int) /*objIndex*/,
    Tcl_Obj *fileName,		    /* The name of the file (UTF-8). */
    Tcl_Obj **attributePtrPtr)	    /* A pointer to return the object with. */
{
    Tcl_StatBuf statBuf;
    int result;

    result = TclpObjStat(fileName, &statBuf);

    if (result != 0) {
	if (interp != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "could not read \"%s\": %s",
		    TclGetString(fileName), Tcl_PosixError(interp)));
	}
	return TCL_ERROR;
    }

    *attributePtrPtr = Tcl_ObjPrintf(
	    "%0#5o", ((int)statBuf.st_mode & 0x7FFF));
    return TCL_OK;
}

/*
 *---------------------------------------------------------------------------
 *
 * SetGroupAttribute --
 *
 *	Sets the group of the file to the specified group.
 *
 * Results:
 *	Standard TCL result.
 *
 * Side effects:
 *	As above.
 *
 *---------------------------------------------------------------------------
 */

static int
SetGroupAttribute(
    Tcl_Interp *interp,		/* The interp for error reporting. */
    TCL_UNUSED(int) /*objIndex*/,
    Tcl_Obj *fileName,		/* The name of the file (UTF-8). */
    Tcl_Obj *attributePtr)	/* New group for file. */
{
    Tcl_WideInt gid;
    int result;
    const char *native;

    if (Tcl_GetWideIntFromObj(NULL, attributePtr, &gid) != TCL_OK) {
	Tcl_DString ds;
	struct group *groupPtr = NULL;
	const char *string;
	Tcl_Size length;

	string = Tcl_GetStringFromObj(attributePtr, &length);

	if (Tcl_UtfToExternalDStringEx(interp, NULL, string, length, 0, &ds, NULL) != TCL_OK) {
	    Tcl_DStringFree(&ds);
	    return TCL_ERROR;
	}
	native = Tcl_DStringValue(&ds);
	groupPtr = TclpGetGrNam(native); /* INTL: Native. */
	Tcl_DStringFree(&ds);

	if (groupPtr == NULL) {
	    if (interp != NULL) {
		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
			"could not set group for file \"%s\":"
			" group \"%s\" does not exist",
			TclGetString(fileName), string));
		Tcl_SetErrorCode(interp, "TCL", "OPERATION", "SETGRP",
			"NO_GROUP", NULL);
	    }
	    return TCL_ERROR;
	}
	gid = groupPtr->gr_gid;
    }

    native = (const char *)Tcl_FSGetNativePath(fileName);
    result = chown(native, (uid_t) -1, (gid_t) gid);	/* INTL: Native. */

    if (result != 0) {
	if (interp != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "could not set group for file \"%s\": %s",
		    TclGetString(fileName), Tcl_PosixError(interp)));
	}
	return TCL_ERROR;
    }
    return TCL_OK;
}

/*
 *---------------------------------------------------------------------------
 *
 * SetOwnerAttribute --
 *
 *	Sets the owner of the file to the specified owner.
 *
 * Results:
 *	Standard TCL result.
 *
 * Side effects:
 *	As above.
 *
 *---------------------------------------------------------------------------
 */

static int
SetOwnerAttribute(
    Tcl_Interp *interp,		/* The interp for error reporting. */
    TCL_UNUSED(int) /*objIndex*/,
    Tcl_Obj *fileName,		/* The name of the file (UTF-8). */
    Tcl_Obj *attributePtr)	/* New owner for file. */
{
    Tcl_WideInt uid;
    int result;
    const char *native;

    if (Tcl_GetWideIntFromObj(NULL, attributePtr, &uid) != TCL_OK) {
	Tcl_DString ds;
	struct passwd *pwPtr = NULL;
	const char *string;
	Tcl_Size length;

	string = Tcl_GetStringFromObj(attributePtr, &length);

	if (Tcl_UtfToExternalDStringEx(interp, NULL, string, length, 0, &ds, NULL) != TCL_OK) {
	    Tcl_DStringFree(&ds);
	    return TCL_ERROR;
	}
	native = Tcl_DStringValue(&ds);
	pwPtr = TclpGetPwNam(native);			/* INTL: Native. */
	Tcl_DStringFree(&ds);

	if (pwPtr == NULL) {
	    if (interp != NULL) {
		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
			"could not set owner for file \"%s\":"
			" user \"%s\" does not exist",
			TclGetString(fileName), string));
		Tcl_SetErrorCode(interp, "TCL", "OPERATION", "SETOWN",
			"NO_USER", NULL);
	    }
	    return TCL_ERROR;
	}
	uid = pwPtr->pw_uid;
    }

    native = (const char *)Tcl_FSGetNativePath(fileName);
    result = chown(native, (uid_t) uid, (gid_t) -1);	/* INTL: Native. */

    if (result != 0) {
	if (interp != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "could not set owner for file \"%s\": %s",
		    TclGetString(fileName), Tcl_PosixError(interp)));
	}
	return TCL_ERROR;
    }
    return TCL_OK;
}

/*
 *---------------------------------------------------------------------------
 *
 * SetPermissionsAttribute
 *
 *	Sets the file to the given permission.
 *
 * Results:
 *	Standard TCL result.
 *
 * Side effects:
 *	The permission of the file is changed.
 *
 *---------------------------------------------------------------------------
 */

static int
SetPermissionsAttribute(
    Tcl_Interp *interp,		/* The interp we are using for errors. */
    TCL_UNUSED(int) /*objIndex*/,
    Tcl_Obj *fileName,		/* The name of the file (UTF-8). */
    Tcl_Obj *attributePtr)	/* The attribute to set. */
{
    Tcl_WideInt mode;
    mode_t newMode;
    int result = TCL_ERROR;
    const char *native;
    const char *modeStringPtr = TclGetString(attributePtr);
    int scanned = TclParseAllWhiteSpace(modeStringPtr, -1);

    /*
     * First supply support for octal number format
     */

    if ((modeStringPtr[scanned] == '0')
	    && (modeStringPtr[scanned+1] >= '0')
	    && (modeStringPtr[scanned+1] <= '7')) {
	/* Leading zero - attempt octal interpretation */
	Tcl_Obj *modeObj;

	TclNewLiteralStringObj(modeObj, "0o");
	Tcl_AppendToObj(modeObj, modeStringPtr+scanned+1, TCL_INDEX_NONE);
	result = Tcl_GetWideIntFromObj(NULL, modeObj, &mode);
	Tcl_DecrRefCount(modeObj);
    }
    if (result == TCL_OK
	    || Tcl_GetWideIntFromObj(NULL, attributePtr, &mode) == TCL_OK) {
	newMode = (mode_t) (mode & 0x00007FFF);
    } else {
	Tcl_StatBuf buf;

	/*
	 * Try the forms "rwxrwxrwx" and "ugo=rwx"
	 *
	 * We get the current mode of the file, in order to allow for ug+-=rwx
	 * style chmod strings.
	 */

	result = TclpObjStat(fileName, &buf);
	if (result != 0) {
	    if (interp != NULL) {
		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
			"could not read \"%s\": %s",
			TclGetString(fileName), Tcl_PosixError(interp)));
	    }
	    return TCL_ERROR;
	}
	newMode = (mode_t) (buf.st_mode & 0x00007FFF);

	if (GetModeFromPermString(NULL, modeStringPtr, &newMode) != TCL_OK) {
	    if (interp != NULL) {
		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
			"unknown permission string format \"%s\"",
			modeStringPtr));
		Tcl_SetErrorCode(interp, "TCL", "VALUE", "PERMISSION", NULL);
	    }
	    return TCL_ERROR;
	}
    }

    native = (const char *)Tcl_FSGetNativePath(fileName);
    result = chmod(native, newMode);		/* INTL: Native. */
    if (result != 0) {
	if (interp != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "could not set permissions for file \"%s\": %s",
		    TclGetString(fileName), Tcl_PosixError(interp)));
	}
	return TCL_ERROR;
    }
    return TCL_OK;
}

#ifndef DJGPP
/*
 *---------------------------------------------------------------------------
 *
 * TclpObjListVolumes --
 *
 *	Lists the currently mounted volumes, which on UNIX is just /.
 *
 * Results:
 *	The list of volumes.
 *
 * Side effects:
 *	None.
 *
 *---------------------------------------------------------------------------
 */

Tcl_Obj *
TclpObjListVolumes(void)
{
    Tcl_Obj *resultPtr;
    TclNewLiteralStringObj(resultPtr, "/");

    Tcl_IncrRefCount(resultPtr);
    return resultPtr;
}
#endif

/*
 *----------------------------------------------------------------------
 *
 * GetModeFromPermString --
 *
 *	This procedure is invoked to process the "file permissions" Tcl
 *	command, to check for a "rwxrwxrwx" or "ugoa+-=rwxst" string. See the
 *	user documentation for details on what it does.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	See the user documentation.
 *
 *----------------------------------------------------------------------
 */

static int
GetModeFromPermString(
    TCL_UNUSED(Tcl_Interp *),
    const char *modeStringPtr, /* Permissions string */
    mode_t *modePtr)		/* pointer to the mode value */
{
    mode_t newMode;
    mode_t oldMode;		/* Storage for the value of the old mode (that
				 * is passed in), to allow for the chmod style
				 * manipulation. */
    int i,n, who, op, what, op_found, who_found;

    /*
     * We start off checking for an "rwxrwxrwx" style permissions string
     */

    if (strlen(modeStringPtr) != 9) {
	goto chmodStyleCheck;
    }

    newMode = 0;
    for (i = 0; i < 9; i++) {
	switch (*(modeStringPtr+i)) {
	case 'r':
	    if ((i%3) != 0) {
		goto chmodStyleCheck;
	    }
	    newMode |= (1<<(8-i));
	    break;
	case 'w':
	    if ((i%3) != 1) {
		goto chmodStyleCheck;
	    }
	    newMode |= (1<<(8-i));
	    break;
	case 'x':
	    if ((i%3) != 2) {
		goto chmodStyleCheck;
	    }
	    newMode |= (1<<(8-i));
	    break;
	case 's':
	    if (((i%3) != 2) || (i > 5)) {
		goto chmodStyleCheck;
	    }
	    newMode |= (1<<(8-i));
	    newMode |= (1<<(11-(i/3)));
	    break;
	case 'S':
	    if (((i%3) != 2) || (i > 5)) {
		goto chmodStyleCheck;
	    }
	    newMode |= (1<<(11-(i/3)));
	    break;
	case 't':
	    if (i != 8) {
		goto chmodStyleCheck;
	    }
	    newMode |= (1<<(8-i));
	    newMode |= (1<<9);
	    break;
	case 'T':
	    if (i != 8) {
		goto chmodStyleCheck;
	    }
	    newMode |= (1<<9);
	    break;
	case '-':
	    break;
	default:
	    /*
	     * Oops, not what we thought it was, so go on
	     */
	    goto chmodStyleCheck;
	}
    }
    *modePtr = newMode;
    return TCL_OK;

  chmodStyleCheck:
    /*
     * We now check for an "ugoa+-=rwxst" style permissions string
     */

    for (n = 0 ; *(modeStringPtr+n) != '\0' ; n = n + i) {
	oldMode = *modePtr;
	who = op = what = op_found = who_found = 0;
	for (i = 0 ; *(modeStringPtr+n+i) != '\0' ; i++ ) {
	    if (!who_found) {
		/* who */
		switch (*(modeStringPtr+n+i)) {
		case 'u':
		    who |= 0x9C0;
		    continue;
		case 'g':
		    who |= 0x438;
		    continue;
		case 'o':
		    who |= 0x207;
		    continue;
		case 'a':
		    who |= 0xFFF;
		    continue;
		}
	    }
	    who_found = 1;
	    if (who == 0) {
		who = 0xFFF;
	    }
	    if (!op_found) {
		/* op */
		switch (*(modeStringPtr+n+i)) {
		case '+':
		    op = 1;
		    op_found = 1;
		    continue;
		case '-':
		    op = 2;
		    op_found = 1;
		    continue;
		case '=':
		    op = 3;
		    op_found = 1;
		    continue;
		default:
		    return TCL_ERROR;
		}
	    }
	    /* what */
	    switch (*(modeStringPtr+n+i)) {
	    case 'r':
		what |= 0x124;
		continue;
	    case 'w':
		what |= 0x92;
		continue;
	    case 'x':
		what |= 0x49;
		continue;
	    case 's':
		what |= 0xC00;
		continue;
	    case 't':
		what |= 0x200;
		continue;
	    case ',':
		break;
	    default:
		return TCL_ERROR;
	    }
	    if (*(modeStringPtr+n+i) == ',') {
		i++;
		break;
	    }
	}
	switch (op) {
	case 1:
	    *modePtr = oldMode | (who & what);
	    continue;
	case 2:
	    *modePtr = oldMode & ~(who & what);
	    continue;
	case 3:
	    *modePtr = (oldMode & ~who) | (who & what);
	    continue;
	}
    }
    return TCL_OK;
}

/*
 *---------------------------------------------------------------------------
 *
 * TclpObjNormalizePath --
 *
 *	Replaces each component except that last one in a pathname that is a
 *	symbolic link with the fully resolved target of that link.
 *
 * Results:
 *	Stores the resulting path in pathPtr and returns the offset of the last
 *	byte processed to obtain the resulting path.
 *
 * Side effects:
 *
 *---------------------------------------------------------------------------
 */

int
TclpObjNormalizePath(
    Tcl_Interp *interp,
    Tcl_Obj *pathPtr,		/* An unshared object containing the path to
				 * normalize. */
    int nextCheckpoint)		/* offset to start at in pathPtr.  Must either
				 * be 0 or the offset of a directory separator
				 * at the end of a path part that is already
				 * normalized.  I.e. this is not the index of
				 * the byte just after the separator.  */

{
    const char *currentPathEndPosition;
    char cur;
    Tcl_Size pathLen;
    const char *path = Tcl_GetStringFromObj(pathPtr, &pathLen);
    Tcl_DString ds;
    const char *nativePath;
#ifndef NO_REALPATH
    char normPath[MAXPATHLEN];
#endif

    currentPathEndPosition = path + nextCheckpoint;
    if (*currentPathEndPosition == '/') {
	currentPathEndPosition++;
    }

#ifndef NO_REALPATH
    if (nextCheckpoint == 0 && haveRealpath) {
	/*
	 * Try to get the entire path in one go
	 */

	const char *lastDir = strrchr(currentPathEndPosition, '/');

	if (lastDir != NULL) {
	    if (Tcl_UtfToExternalDStringEx(interp, NULL, path,
		    lastDir-path, 0, &ds, NULL) != TCL_OK) {
		Tcl_DStringFree(&ds);
		return -1;
	    }
	    nativePath = Tcl_DStringValue(&ds);
	    if (Realpath(nativePath, normPath) != NULL) {
		if (*nativePath != '/' && *normPath == '/') {
		    /*
		     * realpath transformed a relative path into an
		     * absolute path.  Fall back to the long way.
		     */

		    /*
		     * To do: This logic seems to be out of date.  This whole
		     * routine should be reviewed and cleaed up.
		     */
		} else {
		    nextCheckpoint = lastDir - path;
		    goto wholeStringOk;
		}
	    }
	    Tcl_DStringFree(&ds);
	}
    }

    /*
     * Else do it the slow way.
     */
#endif

    while (1) {
	cur = *currentPathEndPosition;
	if ((cur == '/') && (path != currentPathEndPosition)) {
	    /*
	     * Reached directory separator.
	     */

	    int accessOk;

	    if (Tcl_UtfToExternalDStringEx(interp, NULL, path,
		    currentPathEndPosition - path, 0, &ds, NULL) != TCL_OK) {
		Tcl_DStringFree(&ds);
		return -1;
	    }
	    nativePath = Tcl_DStringValue(&ds);
	    accessOk = access(nativePath, F_OK);
	    Tcl_DStringFree(&ds);

	    if (accessOk != 0) {
		/*
		 * File doesn't exist.
		 */

		break;
	    }

	    /*
	     * Assign the end of the current component to nextCheckpoint
	     */

	    nextCheckpoint = currentPathEndPosition - path;
	} else if (cur == 0) {
	    /*
	     * The end of the string.
	     */

	    break;
	}
	currentPathEndPosition++;
    }

    /*
     * Call 'realpath' to obtain a canonical path.
     */

#ifndef NO_REALPATH
    if (haveRealpath) {
	if (nextCheckpoint == 0) {
	    /*
	     * The path contains at most one component, e.g. '/foo' or '/', so
	     * so there is nothing to resolve. Also, on some platforms
	     * 'Realpath' transforms an empty string into the normalized pwd,
	     * which is the wrong answer.
	     */

	    return 0;
	}

	if (Tcl_UtfToExternalDStringEx(interp, NULL, path,nextCheckpoint, 0, &ds, NULL)) {
	    Tcl_DStringFree(&ds);
	    return -1;
	}
	nativePath = Tcl_DStringValue(&ds);
	if (Realpath(nativePath, normPath) != NULL) {
	    Tcl_Size newNormLen;

	wholeStringOk:
	    newNormLen = strlen(normPath);
	    if ((newNormLen == Tcl_DStringLength(&ds))
		    && (strcmp(normPath, nativePath) == 0)) {
		/*
		 * The original path is unchanged.
		 */

		Tcl_DStringFree(&ds);

		/*
		 * Uncommenting this would mean that this native filesystem
		 * routine claims the path is normalized if the file exists,
		 * which would permit the caller to avoid iterating through
		 * other filesystems filesystems. Saving lots of calls is
		 * probably worth the extra access() time, but in the common
		 * case that no other filesystems are registered this is an
		 * unnecessary expense.
		 *
		if (0 == access(normPath, F_OK)) {
		    return pathLen;
		}
		 */

		return nextCheckpoint;
	    }

	    /*
	     * Free the original path and replace it with the normalized path.
	     */

	    Tcl_DStringFree(&ds);
	    Tcl_ExternalToUtfDStringEx(NULL, NULL, normPath, newNormLen, 0, &ds, NULL);

	    if (path[nextCheckpoint] != '\0') {
		/*
		 * Append the remaining path components.
		 */

		int normLen = Tcl_DStringLength(&ds);

		Tcl_DStringAppend(&ds, path + nextCheckpoint,
			pathLen - nextCheckpoint);

		/*
		 * characters up to and including the directory separator have
		 * been processed
		 */

		nextCheckpoint = normLen + 1;
	    } else {
		/*
		 * We recognise the whole string.
		 */

		nextCheckpoint = Tcl_DStringLength(&ds);
	    }

	    Tcl_SetStringObj(pathPtr, Tcl_DStringValue(&ds),
		    Tcl_DStringLength(&ds));
	}
	Tcl_DStringFree(&ds);
    }
#endif	/* !NO_REALPATH */

    return nextCheckpoint;
}

/*
 *----------------------------------------------------------------------
 *
 * TclpOpenTemporaryFile, TclUnixOpenTemporaryFile --
 *
 *	Creates a temporary file, possibly based on the supplied bits and
 *	pieces of template supplied in the first three arguments. If the
 *	fourth argument is non-NULL, it contains a Tcl_Obj to store the name
 *	of the temporary file in (and it is caller's responsibility to clean
 *	up). If the fourth argument is NULL, try to arrange for the temporary
 *	file to go away once it is no longer needed.
 *
 * Results:
 *	A read-write Tcl Channel open on the file for TclpOpenTemporaryFile,
 *	or a file descriptor (or -1 on failure) for TclUnixOpenTemporaryFile.
 *
 * Side effects:
 *	Accesses the filesystem. Will set the contents of the Tcl_Obj fourth
 *	argument (if that is non-NULL).
 *
 *----------------------------------------------------------------------
 */

Tcl_Channel
TclpOpenTemporaryFile(
    Tcl_Obj *dirObj,
    Tcl_Obj *basenameObj,
    Tcl_Obj *extensionObj,
    Tcl_Obj *resultingNameObj)
{
    int fd = TclUnixOpenTemporaryFile(dirObj, basenameObj, extensionObj,
	    resultingNameObj);

    if (fd == -1) {
	return NULL;
    }
    return Tcl_MakeFileChannel(INT2PTR(fd), TCL_READABLE|TCL_WRITABLE);
}

int
TclUnixOpenTemporaryFile(
    Tcl_Obj *dirObj,
    Tcl_Obj *basenameObj,
    Tcl_Obj *extensionObj,
    Tcl_Obj *resultingNameObj)
{
    Tcl_DString templ, tmp;
    const char *string;
    int fd;
    Tcl_Size length;

    /*
     * We should also check against making more than TMP_MAX of these.
     */

    if (dirObj) {
	string = Tcl_GetStringFromObj(dirObj, &length);
	if (Tcl_UtfToExternalDStringEx(NULL, NULL, string, length, 0, &templ, NULL) != TCL_OK) {
	    return -1;
	}
    } else {
	Tcl_DStringInit(&templ);
	Tcl_DStringAppend(&templ, DefaultTempDir(), TCL_INDEX_NONE); /* INTL: native */
    }

    TclDStringAppendLiteral(&templ, "/");

    if (basenameObj) {
	string = Tcl_GetStringFromObj(basenameObj, &length);
	if (Tcl_UtfToExternalDStringEx(NULL, NULL, string, length, 0, &tmp, NULL) != TCL_OK) {
	    Tcl_DStringFree(&tmp);
	    return -1;
	}
	TclDStringAppendDString(&templ, &tmp);
	Tcl_DStringFree(&tmp);
    } else {
	TclDStringAppendLiteral(&templ, "tcl");
    }

    TclDStringAppendLiteral(&templ, "_XXXXXX");

#ifdef HAVE_MKSTEMPS
    if (extensionObj) {
	string = Tcl_GetStringFromObj(extensionObj, &length);
	if (Tcl_UtfToExternalDStringEx(NULL, NULL, string, length, 0, &tmp, NULL) != TCL_OK) {
	    Tcl_DStringFree(&templ);
	    return -1;
	}
	TclDStringAppendDString(&templ, &tmp);
	fd = mkstemps(Tcl_DStringValue(&templ), Tcl_DStringLength(&tmp));
	Tcl_DStringFree(&tmp);
    } else
#endif
    {
	fd = mkstemp(Tcl_DStringValue(&templ));
    }

    if (fd == -1) {
	Tcl_DStringFree(&templ);
	return -1;
    }

    if (resultingNameObj) {
	if (Tcl_ExternalToUtfDStringEx(NULL, NULL, Tcl_DStringValue(&templ),
		Tcl_DStringLength(&templ), 0, &tmp, NULL) != TCL_OK) {
	    Tcl_DStringFree(&templ);
	    return -1;
	}
	Tcl_SetStringObj(resultingNameObj, Tcl_DStringValue(&tmp),
		Tcl_DStringLength(&tmp));
	Tcl_DStringFree(&tmp);
    } else {
	/*
	 * Try to delete the file immediately since we're not reporting the
	 * name to anyone. Note that we're *not* handling any errors from
	 * this!
	 */

	unlink(Tcl_DStringValue(&templ));
	errno = 0;
    }
    Tcl_DStringFree(&templ);

    return fd;
}

/*
 * Helper that does *part* of what tempnam() does.
 */

static const char *
DefaultTempDir(void)
{
    const char *dir;
    Tcl_StatBuf buf;

    dir = getenv("TMPDIR");
    if (dir && dir[0] && TclOSstat(dir, &buf) == 0 && S_ISDIR(buf.st_mode)
	    && access(dir, W_OK) == 0) {
	return dir;
    }

#ifdef P_tmpdir
    dir = P_tmpdir;
    if (TclOSstat(dir, &buf)==0 && S_ISDIR(buf.st_mode) && access(dir, W_OK)==0) {
	return dir;
    }
#endif

    /*
     * Assume that the default location ("/tmp" if not overridden) is always
     * an existing writable directory; we've no recovery mechanism if it
     * isn't.
     */

    return TCL_TEMPORARY_FILE_DIRECTORY;
}

/*
 *----------------------------------------------------------------------
 *
 * TclpCreateTemporaryDirectory --
 *
 *	Creates a temporary directory, possibly based on the supplied bits and
 *	pieces of template supplied in the arguments.
 *
 * Results:
 *	An object (refcount 0) containing the name of the newly-created
 *	directory, or NULL on failure.
 *
 * Side effects:
 *	Accesses the native filesystem. Makes a directory.
 *
 *----------------------------------------------------------------------
 */

Tcl_Obj *
TclpCreateTemporaryDirectory(
    Tcl_Obj *dirObj,
    Tcl_Obj *basenameObj)
{
    Tcl_DString templ, tmp;
    const char *string;

#define DEFAULT_TEMP_DIR_PREFIX	"tcl"

    /*
     * Build the template in writable memory from the user-supplied pieces and
     * some defaults.
     */

    if (dirObj) {
	string = TclGetString(dirObj);
	if (Tcl_UtfToExternalDStringEx(NULL, NULL, string, dirObj->length, 0, &templ, NULL) != TCL_OK) {
	    return NULL;
	}
    } else {
	Tcl_DStringInit(&templ);
	Tcl_DStringAppend(&templ, DefaultTempDir(), TCL_INDEX_NONE); /* INTL: native */
    }

    if (Tcl_DStringValue(&templ)[Tcl_DStringLength(&templ) - 1] != '/') {
	TclDStringAppendLiteral(&templ, "/");
    }

    if (basenameObj) {
	string = TclGetString(basenameObj);
	if (basenameObj->length) {
	    if (Tcl_UtfToExternalDStringEx(NULL, NULL, string, basenameObj->length, 0, &tmp, NULL) != TCL_OK) {
		Tcl_DStringFree(&templ);
		return NULL;
	    }
	    TclDStringAppendDString(&templ, &tmp);
	    Tcl_DStringFree(&tmp);
	} else {
	    TclDStringAppendLiteral(&templ, DEFAULT_TEMP_DIR_PREFIX);
	}
    } else {
	TclDStringAppendLiteral(&templ, DEFAULT_TEMP_DIR_PREFIX);
    }

    TclDStringAppendLiteral(&templ, "_XXXXXX");

    /*
     * Make the temporary directory.
     */

    if (mkdtemp(Tcl_DStringValue(&templ)) == NULL) {
	Tcl_DStringFree(&templ);
	return NULL;
    }

    /*
     * The template has been updated. Tell the caller what it was.
     */

    if (Tcl_ExternalToUtfDStringEx(NULL, NULL, Tcl_DStringValue(&templ),
	    Tcl_DStringLength(&templ), 0, &tmp, NULL) != TCL_OK) {
	Tcl_DStringFree(&templ);
	return NULL;
    }
    Tcl_DStringFree(&templ);
    return Tcl_DStringToObj(&tmp);
}

#if defined(__CYGWIN__)

static void
StatError(
    Tcl_Interp *interp,		/* The interp that has the error */
    Tcl_Obj *fileName)		/* The name of the file which caused the
				 * error. */
{
    Tcl_WinConvertError(GetLastError());
    Tcl_SetObjResult(interp, Tcl_ObjPrintf("could not read \"%s\": %s",
	    TclGetString(fileName), Tcl_PosixError(interp)));
}

static WCHAR *
winPathFromObj(
    Tcl_Obj *fileName)
{
    size_t size;
    const char *native =  (const char *)Tcl_FSGetNativePath(fileName);
    WCHAR *winPath;

    size = cygwin_conv_path(1, native, NULL, 0);
    winPath = (WCHAR *)Tcl_Alloc(size);
    cygwin_conv_path(1, native, winPath, size);

    return winPath;
}

static const int attributeArray[] = {
    0x20, 0, 2, 0, 0, 1, 4
};

/*
 *----------------------------------------------------------------------
 *
 * GetUnixFileAttributes
 *
 *	Gets an attribute of a file.
 *
 * Results:
 *	A standard Tcl result.
 *
 * Side effects:
 *	If there is no error assigns to *attributePtrPtr the address of a new
 *	Tcl_Obj having a refCount of zero and containing the value of the
 *	specified attribute.
 *
 *
 *----------------------------------------------------------------------
 */

static int
GetUnixFileAttributes(
    Tcl_Interp *interp,		/* The interp to report errors to. */
    int objIndex,		/* The index of the attribute. */
    Tcl_Obj *fileName,		/* The pathname of the file (UTF-8). */
    Tcl_Obj **attributePtrPtr)	/* Where to store the result. */
{
    int fileAttributes;
    WCHAR *winPath = winPathFromObj(fileName);

    fileAttributes = GetFileAttributesW(winPath);
    Tcl_Free(winPath);

    if (fileAttributes == -1) {
	StatError(interp, fileName);
	return TCL_ERROR;
    }

    TclNewIntObj(*attributePtrPtr,
	    (fileAttributes & attributeArray[objIndex]) != 0);
    return TCL_OK;
}

/*
 *---------------------------------------------------------------------------
 *
 * SetUnixFileAttributes
 *
 *	Sets the readonly attribute of a file.
 *
 * Results:
 *	Standard TCL result.
 *
 * Side effects:
 *	The readonly attribute of the file is changed.
 *
 *---------------------------------------------------------------------------
 */

static int
SetUnixFileAttributes(
    Tcl_Interp *interp,	    /* The interp we are using for errors. */
    int objIndex,           /* The index of the attribute. */
    Tcl_Obj *fileName,      /* The name of the file (UTF-8). */
    Tcl_Obj *attributePtr)  /* The attribute to set. */
{
    int yesNo, fileAttributes, old;
    WCHAR *winPath;

    if (Tcl_GetBooleanFromObj(interp, attributePtr, &yesNo) != TCL_OK) {
	return TCL_ERROR;
    }

    winPath = winPathFromObj(fileName);

    fileAttributes = old = GetFileAttributesW(winPath);

    if (fileAttributes == -1) {
	Tcl_Free(winPath);
	StatError(interp, fileName);
	return TCL_ERROR;
    }

    if (yesNo) {
	fileAttributes |= attributeArray[objIndex];
    } else {
	fileAttributes &= ~attributeArray[objIndex];
    }

    if ((fileAttributes != old)
	    && !SetFileAttributesW(winPath, fileAttributes)) {
	Tcl_Free(winPath);
	StatError(interp, fileName);
	return TCL_ERROR;
    }

    Tcl_Free(winPath);
    return TCL_OK;
}
#elif defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE)
/*
 *----------------------------------------------------------------------
 *
 * GetUnixFileAttributes
 *
 *	Gets the readonly attribute (user immutable flag) of a file.
 *
 * Results:
 *	Standard TCL result. Returns a new Tcl_Obj in attributePtrPtr if there
 *	is no error. The object will have ref count 0.
 *
 * Side effects:
 *	A new object is allocated.
 *
 *----------------------------------------------------------------------
 */

static int
GetUnixFileAttributes(
    Tcl_Interp *interp,		/* The interp we are using for errors. */
    TCL_UNUSED(int) /*objIndex*/,
    Tcl_Obj *fileName,		/* The name of the file (UTF-8). */
    Tcl_Obj **attributePtrPtr)	/* A pointer to return the object with. */
{
    Tcl_StatBuf statBuf;
    int result;

    result = TclpObjStat(fileName, &statBuf);

    if (result != 0) {
	if (interp != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "could not read \"%s\": %s",
		    TclGetString(fileName), Tcl_PosixError(interp)));
	}
	return TCL_ERROR;
    }

    TclNewIntObj(*attributePtrPtr, (statBuf.st_flags & UF_IMMUTABLE) != 0);
    return TCL_OK;
}

/*
 *---------------------------------------------------------------------------
 *
 * SetUnixFileAttributes
 *
 *	Sets the readonly attribute (user immutable flag) of a file.
 *
 * Results:
 *	Standard TCL result.
 *
 * Side effects:
 *	The readonly attribute of the file is changed.
 *
 *---------------------------------------------------------------------------
 */

static int
SetUnixFileAttributes(
    Tcl_Interp *interp,		/* The interp we are using for errors. */
    TCL_UNUSED(int) /*objIndex*/,
    Tcl_Obj *fileName,		/* The name of the file (UTF-8). */
    Tcl_Obj *attributePtr)	/* The attribute to set. */
{
    Tcl_StatBuf statBuf;
    int result, readonly;
    const char *native;

    if (Tcl_GetBooleanFromObj(interp, attributePtr, &readonly) != TCL_OK) {
	return TCL_ERROR;
    }

    result = TclpObjStat(fileName, &statBuf);

    if (result != 0) {
	if (interp != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "could not read \"%s\": %s",
		    TclGetString(fileName), Tcl_PosixError(interp)));
	}
	return TCL_ERROR;
    }

    if (readonly) {
	statBuf.st_flags |= UF_IMMUTABLE;
    } else {
	statBuf.st_flags &= ~UF_IMMUTABLE;
    }

    native = (const char *)Tcl_FSGetNativePath(fileName);
    result = chflags(native, statBuf.st_flags);		/* INTL: Native. */
    if (result != 0) {
	if (interp != NULL) {
	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "could not set flags for file \"%s\": %s",
		    TclGetString(fileName), Tcl_PosixError(interp)));
	}
	return TCL_ERROR;
    }
    return TCL_OK;
}
#endif /* defined(HAVE_CHFLAGS) && defined(UF_IMMUTABLE) */

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
p ){ - for(pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); - pEntry; - pEntry = Tcl_NextHashEntry(&sSearch) - ){ - ZvfsFile *pFile = Tcl_GetHashValue(pEntry); - char *z = pFile->zName; - if( Tcl_RegExpExec(interp, pRegexp, z, z) ){ - Tcl_ListObjAppendElement(interp, pResult, Tcl_NewStringObj(z, -1)); - } - } - }else{ - for(pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); - pEntry; - pEntry = Tcl_NextHashEntry(&sSearch) - ){ - ZvfsFile *pFile = Tcl_GetHashValue(pEntry); - char *z = pFile->zName; - Tcl_ListObjAppendElement(interp, pResult, Tcl_NewStringObj(z, -1)); - } - } - return TCL_OK; + return TCL_OK; } /* -** Whenever a ZVFS file is opened, an instance of this structure is -** attached to the open channel where it will be available to the -** ZVFS I/O routines below. All state information about an open -** ZVFS file is held in this structure. -*/ + * Whenever a ZVFS file is opened, an instance of this structure is attached + * to the open channel where it will be available to the ZVFS I/O routines + * below. All state information about an open ZVFS file is held in this + * structure. + */ typedef struct ZvfsChannelInfo { - unsigned int nByte; /* number of bytes of read uncompressed data */ - unsigned int nByteCompr; /* number of bytes of unread compressed data */ - unsigned int nData; /* total number of bytes of compressed data */ - int readSoFar; /* Number of bytes read so far */ - long startOfData; /* File position of start of data in ZIP archive */ - int isCompressed; /* True data is compressed */ - Tcl_Channel chan; /* Open to the archive file */ - unsigned char *zBuf; /* buffer used by the decompressor */ - z_stream stream; /* state of the decompressor */ + unsigned int nByte; /* number of bytes of read uncompressed + * data */ + unsigned int nByteCompr; /* number of bytes of unread compressed + * data */ + unsigned int nData; /* total number of bytes of compressed data */ + int readSoFar; /* Number of bytes read so far */ + long startOfData; /* File position of start of data in ZIP + * archive */ + int isCompressed; /* True data is compressed */ + Tcl_Channel chan; /* Open to the archive file */ + unsigned char *zBuf; /* buffer used by the decompressor */ + z_stream stream; /* state of the decompressor */ } ZvfsChannelInfo; - /* -** This routine is called as an exit handler. If we do not set -** ZvfsChannelInfo.chan to NULL, then Tcl_Close() will be called on -** that channel twice when Tcl_Exit runs. This will lead to a -** core dump. -*/ -static void vfsExit(void *pArg){ - ZvfsChannelInfo *pInfo = (ZvfsChannelInfo*)pArg; - pInfo->chan = 0; + * This routine is called as an exit handler. If we do not set + * ZvfsChannelInfo.chan to NULL, then Tcl_Close() will be called on that + * channel twice when Tcl_Exit runs. This will lead to a core dump. + */ +static void +vfsExit( + void *pArg) +{ + ZvfsChannelInfo *pInfo = pArg; + + pInfo->chan = 0; } /* -** This routine is called when the ZVFS channel is closed -*/ -static int vfsClose( - ClientData instanceData, /* A ZvfsChannelInfo structure */ - Tcl_Interp *interp /* The TCL interpreter */ -){ - ZvfsChannelInfo* pInfo = (ZvfsChannelInfo*)instanceData; - - if( pInfo->zBuf ){ - Tcl_Free(pInfo->zBuf); - inflateEnd(&pInfo->stream); - } - if( pInfo->chan ){ - Tcl_Close(interp, pInfo->chan); - Tcl_DeleteExitHandler(vfsExit, pInfo); - } - Tcl_Free((char*)pInfo); - return TCL_OK; + * This routine is called when the ZVFS channel is closed + */ +static int +vfsClose( + ClientData instanceData, /* A ZvfsChannelInfo structure */ + Tcl_Interp *interp) /* The TCL interpreter */ +{ + ZvfsChannelInfo* pInfo = instanceData; + + if( pInfo->zBuf ){ + Tcl_Free(pInfo->zBuf); + inflateEnd(&pInfo->stream); + } + if( pInfo->chan ){ + Tcl_Close(interp, pInfo->chan); + Tcl_DeleteExitHandler(vfsExit, pInfo); + } + Tcl_Free((char*)pInfo); + return TCL_OK; } /* -** The TCL I/O system calls this function to actually read information -** from a ZVFS file. -*/ -static int vfsInput ( - ClientData instanceData, /* The channel to read from */ - char *buf, /* Buffer to fill */ - int toRead, /* Requested number of bytes */ - int *pErrorCode /* Location of error flag */ -){ - ZvfsChannelInfo* pInfo = (ZvfsChannelInfo*) instanceData; - - if( toRead > pInfo->nByte ){ - toRead = pInfo->nByte; - } - if( toRead == 0 ){ - return 0; - } - if( pInfo->isCompressed ){ - int err = Z_OK; - z_stream *stream = &pInfo->stream; - stream->next_out = buf; - stream->avail_out = toRead; - while (stream->avail_out) { - if (!stream->avail_in) { - int len = pInfo->nByteCompr; - if (len > COMPR_BUF_SIZE) { - len = COMPR_BUF_SIZE; - } - len = Tcl_Read(pInfo->chan, pInfo->zBuf, len); - pInfo->nByteCompr -= len; - stream->next_in = pInfo->zBuf; - stream->avail_in = len; - } - err = inflate(stream, Z_NO_FLUSH); - if (err) break; - } - if (err == Z_STREAM_END) { - if ((stream->avail_out != 0)) { - *pErrorCode = err; /* premature end */ - return -1; - } - }else if( err ){ - *pErrorCode = err; /* some other zlib error */ - return -1; - } - }else{ - toRead = Tcl_Read(pInfo->chan, buf, toRead); - } - pInfo->nByte -= toRead; - pInfo->readSoFar += toRead; - *pErrorCode = 0; - return toRead; + * The TCL I/O system calls this function to actually read information from a + * ZVFS file. + */ +static int +vfsInput( + ClientData instanceData, /* The channel to read from */ + char *buf, /* Buffer to fill */ + int toRead, /* Requested number of bytes */ + int *pErrorCode) /* Location of error flag */ +{ + ZvfsChannelInfo* pInfo = instanceData; + + if( toRead > pInfo->nByte ){ + toRead = pInfo->nByte; + } + if( toRead == 0 ){ + return 0; + } + if( pInfo->isCompressed ){ + int err = Z_OK; + z_stream *stream = &pInfo->stream; + + stream->next_out = buf; + stream->avail_out = toRead; + while (stream->avail_out) { + if (!stream->avail_in) { + int len = pInfo->nByteCompr; + + if (len > COMPR_BUF_SIZE) { + len = COMPR_BUF_SIZE; + } + len = Tcl_Read(pInfo->chan, pInfo->zBuf, len); + pInfo->nByteCompr -= len; + stream->next_in = pInfo->zBuf; + stream->avail_in = len; + } + err = inflate(stream, Z_NO_FLUSH); + if (err) { + break; + } + } + if (err == Z_STREAM_END) { + if ((stream->avail_out != 0)) { + *pErrorCode = err; /* premature end */ + return -1; + } + }else if( err ){ + *pErrorCode = err; /* some other zlib error */ + return -1; + } + }else{ + toRead = Tcl_Read(pInfo->chan, buf, toRead); + } + pInfo->nByte -= toRead; + pInfo->readSoFar += toRead; + *pErrorCode = 0; + return toRead; } /* -** Write to a ZVFS file. ZVFS files are always read-only, so this routine -** always returns an error. -*/ -static int vfsOutput( - ClientData instanceData, /* The channel to write to */ - CONST char *buf, /* Data to be stored. */ - int toWrite, /* Number of bytes to write. */ - int *pErrorCode /* Location of error flag. */ -){ - *pErrorCode = EINVAL; - return -1; + * Write to a ZVFS file. ZVFS files are always read-only, so this routine + * always returns an error. + */ +static int +vfsOutput( + ClientData instanceData, /* The channel to write to */ + const char *buf, /* Data to be stored. */ + int toWrite, /* Number of bytes to write. */ + int *pErrorCode) /* Location of error flag. */ +{ + *pErrorCode = EINVAL; + return -1; } /* -** Move the file pointer so that the next byte read will be "offset". -*/ -static int vfsSeek( - ClientData instanceData, /* The file structure */ - long offset, /* Offset to seek to */ - int mode, /* One of SEEK_CUR, SEEK_SET or SEEK_END */ - int *pErrorCode /* Write the error code here */ -){ - ZvfsChannelInfo* pInfo = (ZvfsChannelInfo*) instanceData; - - switch( mode ){ - case SEEK_CUR: { - offset += pInfo->readSoFar; - break; - } - case SEEK_END: { - offset += pInfo->readSoFar + pInfo->nByte; - break; - } - default: { - /* Do nothing */ - break; - } - } - if (offset < 0) offset = 0; - if( !pInfo->isCompressed ){ - Tcl_Seek(pInfo->chan, offset + pInfo->startOfData, SEEK_SET); - pInfo->nByte = pInfo->nData; - pInfo->readSoFar = offset; - }else{ - if( offsetreadSoFar ){ - z_stream *stream = &pInfo->stream; - inflateEnd(stream); - stream->zalloc = (alloc_func)0; - stream->zfree = (free_func)0; - stream->opaque = (voidpf)0; - stream->avail_in = 2; - stream->next_in = pInfo->zBuf; - pInfo->zBuf[0] = 0x78; - pInfo->zBuf[1] = 0x01; - inflateInit(&pInfo->stream); - Tcl_Seek(pInfo->chan, pInfo->startOfData, SEEK_SET); - pInfo->nByte += pInfo->readSoFar; - pInfo->nByteCompr = pInfo->nData; - pInfo->readSoFar = 0; - } - while( pInfo->readSoFar < offset ){ - int toRead, errCode; - char zDiscard[100]; - toRead = offset - pInfo->readSoFar; - if( toRead>sizeof(zDiscard) ) toRead = sizeof(zDiscard); - vfsInput(instanceData, zDiscard, toRead, &errCode); - } - } - return pInfo->readSoFar; + * Move the file pointer so that the next byte read will be "offset". + */ +static int +vfsSeek( + ClientData instanceData, /* The file structure */ + long offset, /* Offset to seek to */ + int mode, /* One of SEEK_CUR, SEEK_SET or SEEK_END */ + int *pErrorCode) /* Write the error code here */ +{ + ZvfsChannelInfo* pInfo = instanceData; + + switch( mode ){ + case SEEK_CUR: + offset += pInfo->readSoFar; + break; + case SEEK_END: + offset += pInfo->readSoFar + pInfo->nByte; + break; + default: + /* Do nothing */ + break; + } + if (offset < 0) { + offset = 0; + } + if( !pInfo->isCompressed ){ + Tcl_Seek(pInfo->chan, offset + pInfo->startOfData, SEEK_SET); + pInfo->nByte = pInfo->nData; + pInfo->readSoFar = offset; + }else{ + if( offsetreadSoFar ){ + z_stream *stream = &pInfo->stream; + + inflateEnd(stream); + stream->zalloc = (alloc_func)0; + stream->zfree = (free_func)0; + stream->opaque = (voidpf)0; + stream->avail_in = 2; + stream->next_in = pInfo->zBuf; + pInfo->zBuf[0] = 0x78; + pInfo->zBuf[1] = 0x01; + inflateInit(&pInfo->stream); + Tcl_Seek(pInfo->chan, pInfo->startOfData, SEEK_SET); + pInfo->nByte += pInfo->readSoFar; + pInfo->nByteCompr = pInfo->nData; + pInfo->readSoFar = 0; + } + while( pInfo->readSoFar < offset ){ + int toRead, errCode; + char zDiscard[100]; + + toRead = offset - pInfo->readSoFar; + if( toRead>sizeof(zDiscard) ) { + toRead = sizeof(zDiscard); + } + vfsInput(instanceData, zDiscard, toRead, &errCode); + } + } + return pInfo->readSoFar; } /* -** Handle events on the channel. ZVFS files do not generate events, -** so this is a no-op. -*/ -static void vfsWatchChannel( - ClientData instanceData, /* Channel to watch */ - int mask /* Events of interest */ -){ - return; + * Handle events on the channel. ZVFS files do not generate events, so this + * is a no-op. + */ +static void +vfsWatchChannel( + ClientData instanceData, /* Channel to watch */ + int mask) /* Events of interest */ +{ + return; } /* -** Called to retrieve the underlying file handle for this ZVFS file. -** As the ZVFS file has no underlying file handle, this is a no-op. -*/ -static int vfsGetFile( - ClientData instanceData, /* Channel to query */ - int direction, /* Direction of interest */ - ClientData* handlePtr /* Space to the handle into */ -){ - return TCL_ERROR; + * Called to retrieve the underlying file handle for this ZVFS file. As the + * ZVFS file has no underlying file handle, this is a no-op. + */ +static int +vfsGetFile( + ClientData instanceData, /* Channel to query */ + int direction, /* Direction of interest */ + ClientData* handlePtr) /* Space to the handle into */ +{ + return TCL_ERROR; } /* -** This structure describes the channel type structure for -** access to the ZVFS. -*/ + * This structure describes the channel type structure for access to the ZVFS. + */ static Tcl_ChannelType vfsChannelType = { - "vfs", /* Type name. */ - NULL, /* Set blocking/nonblocking behaviour. NULL'able */ - vfsClose, /* Close channel, clean instance data */ - vfsInput, /* Handle read request */ - vfsOutput, /* Handle write request */ - vfsSeek, /* Move location of access point. NULL'able */ - NULL, /* Set options. NULL'able */ - NULL, /* Get options. NULL'able */ - vfsWatchChannel, /* Initialize notifier */ - vfsGetFile /* Get OS handle from the channel. */ + "vfs", /* Type name. */ + NULL, /* Set blocking/nonblocking behaviour. + * NULL'able */ + vfsClose, /* Close channel, clean instance data */ + vfsInput, /* Handle read request */ + vfsOutput, /* Handle write request */ + vfsSeek, /* Move location of access point. NULL'able */ + NULL, /* Set options. NULL'able */ + NULL, /* Get options. NULL'able */ + vfsWatchChannel, /* Initialize notifier */ + vfsGetFile /* Get OS handle from the channel. */ }; /* -** This routine attempts to do an open of a file. Check to see -** if the file is located in the ZVFS. If so, then open a channel -** for reading the file. If not, return NULL. -*/ -static Tcl_Channel ZvfsFileOpen( - Tcl_Interp *interp, /* The TCL interpreter doing the open */ - char *zFilename, /* Name of the file to open */ - char *modeString, /* Mode string for the open (ignored) */ - int permissions /* Permissions for a newly created file (ignored) */ -){ - ZvfsFile *pFile; - ZvfsChannelInfo *pInfo; - Tcl_Channel chan; - static int count = 1; - char zName[50]; - unsigned char zBuf[50]; - - pFile = ZvfsLookup(zFilename); - if( pFile==0 ) return NULL; - openarch=1; - chan = Tcl_OpenFileChannel(interp, pFile->pArchive->zName, "r", 0); - openarch=0; - if( chan==0 ){ - return 0; - } - if( Tcl_SetChannelOption(interp, chan, "-translation", "binary") - || Tcl_SetChannelOption(interp, chan, "-encoding", "binary") - ){ - /* this should never happen */ - Tcl_Close(0, chan); - return 0; - } - Tcl_Seek(chan, pFile->iOffset, SEEK_SET); - Tcl_Read(chan, zBuf, 30); - if( memcmp(zBuf, "\120\113\03\04", 4) ){ - if( interp ){ - Tcl_AppendResult(interp, "local header mismatch: ", NULL); + * This routine attempts to do an open of a file. Check to see if the file is + * located in the ZVFS. If so, then open a channel for reading the file. If + * not, return NULL. + */ +static Tcl_Channel +ZvfsFileOpen( + Tcl_Interp *interp, /* The TCL interpreter doing the open */ + char *zFilename, /* Name of the file to open */ + char *modeString, /* Mode string for the open (ignored) */ + int permissions) /* Permissions for a newly created file + * (ignored). */ +{ + ZvfsFile *pFile; + ZvfsChannelInfo *pInfo; + Tcl_Channel chan; + static int count = 1; + char zName[50]; + unsigned char zBuf[50]; + + pFile = ZvfsLookup(zFilename); + if( pFile==0 ) { + return NULL; } - Tcl_Close(interp, chan); - return 0; - } - pInfo = (ZvfsChannelInfo*)Tcl_Alloc( sizeof(*pInfo) ); - pInfo->chan = chan; - Tcl_CreateExitHandler(vfsExit, pInfo); - pInfo->isCompressed = INT16(zBuf, 8); - if( pInfo->isCompressed ){ - z_stream *stream = &pInfo->stream; - pInfo->zBuf = Tcl_Alloc(COMPR_BUF_SIZE); - stream->zalloc = (alloc_func)0; - stream->zfree = (free_func)0; - stream->opaque = (voidpf)0; - stream->avail_in = 2; - stream->next_in = pInfo->zBuf; - pInfo->zBuf[0] = 0x78; - pInfo->zBuf[1] = 0x01; - inflateInit(&pInfo->stream); - }else{ - pInfo->zBuf = 0; - } - pInfo->nByte = INT32(zBuf,22); - pInfo->nByteCompr = pInfo->nData = INT32(zBuf,18); - pInfo->readSoFar = 0; - Tcl_Seek(chan, INT16(zBuf,26)+INT16(zBuf,28), SEEK_CUR); - pInfo->startOfData = Tcl_Tell(chan); - sprintf(zName,"vfs_%x_%x",((int)pFile)>>12,count++); - chan = Tcl_CreateChannel(&vfsChannelType, zName, - (ClientData)pInfo, TCL_READABLE); - return chan; + openarch=1; + chan = Tcl_OpenFileChannel(interp, pFile->pArchive->zName, "r", 0); + openarch=0; + if( chan==0 ){ + return 0; + } + if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") + || Tcl_SetChannelOption(interp, chan, "-encoding", "binary")){ + /* this should never happen */ + Tcl_Close(0, chan); + return 0; + } + Tcl_Seek(chan, pFile->iOffset, SEEK_SET); + Tcl_Read(chan, zBuf, 30); + if( memcmp(zBuf, "\120\113\03\04", 4) ){ + if( interp ){ + Tcl_AppendResult(interp, "local header mismatch: ", NULL); + } + Tcl_Close(interp, chan); + return 0; + } + pInfo = Tcl_Alloc( sizeof(*pInfo) ); + pInfo->chan = chan; + Tcl_CreateExitHandler(vfsExit, pInfo); + pInfo->isCompressed = INT16(zBuf, 8); + if( pInfo->isCompressed ){ + z_stream *stream = &pInfo->stream; + + pInfo->zBuf = Tcl_Alloc(COMPR_BUF_SIZE); + stream->zalloc = (alloc_func)0; + stream->zfree = (free_func)0; + stream->opaque = (voidpf)0; + stream->avail_in = 2; + stream->next_in = pInfo->zBuf; + pInfo->zBuf[0] = 0x78; + pInfo->zBuf[1] = 0x01; + inflateInit(&pInfo->stream); + }else{ + pInfo->zBuf = 0; + } + pInfo->nByte = INT32(zBuf,22); + pInfo->nByteCompr = pInfo->nData = INT32(zBuf,18); + pInfo->readSoFar = 0; + Tcl_Seek(chan, INT16(zBuf,26)+INT16(zBuf,28), SEEK_CUR); + pInfo->startOfData = Tcl_Tell(chan); + sprintf(zName,"vfs_%x_%x",((int)pFile)>>12,count++); + chan = Tcl_CreateChannel(&vfsChannelType, zName, + (ClientData)pInfo, TCL_READABLE); + return chan; } /* -** This routine does a stat() system call for a ZVFS file. -*/ -static int ZvfsFileStat(char *path, struct stat *buf){ - ZvfsFile *pFile; + * This routine does a stat() system call for a ZVFS file. + */ +static int +ZvfsFileStat( + char *path, + struct stat *buf) +{ + ZvfsFile *pFile; - pFile = ZvfsLookup(path); - if( pFile==0 ){ - return -1; - } - memset(buf, 0, sizeof(*buf)); - if (pFile->isdir) - buf->st_mode = 040555; - else - buf->st_mode = (0100000|pFile->permissions); - buf->st_ino = 0; - buf->st_size = pFile->nByte; - buf->st_mtime = pFile->timestamp; - buf->st_ctime = pFile->timestamp; - buf->st_atime = pFile->timestamp; - return 0; + pFile = ZvfsLookup(path); + if( pFile==0 ){ + return -1; + } + memset(buf, 0, sizeof(*buf)); + if (pFile->isdir) { + buf->st_mode = 040555; + } else { + buf->st_mode = (0100000|pFile->permissions); + } + buf->st_ino = 0; + buf->st_size = pFile->nByte; + buf->st_mtime = pFile->timestamp; + buf->st_ctime = pFile->timestamp; + buf->st_atime = pFile->timestamp; + return 0; } /* -** This routine does an access() system call for a ZVFS file. -*/ -static int ZvfsFileAccess(char *path, int mode){ - ZvfsFile *pFile; + * This routine does an access() system call for a ZVFS file. + */ +static int +ZvfsFileAccess( + char *path, + int mode) +{ + ZvfsFile *pFile; - if( mode & 3 ){ - return -1; - } - pFile = ZvfsLookup(path); - if( pFile==0 ){ - return -1; - } - return 0; + if( mode & 3 ){ + return -1; + } + pFile = ZvfsLookup(path); + if( pFile==0 ){ + return -1; + } + return 0; } #ifndef USE_TCL_VFS /* -** This TCL procedure can be used to copy a file. The built-in -** "file copy" command of TCL bypasses the I/O system and does not -** work with zvfs. You have to use a procedure like the following -** instead. -*/ + * This TCL procedure can be used to copy a file. The built-in "file copy" + * command of TCL bypasses the I/O system and does not work with zvfs. You + * have to use a procedure like the following instead. + */ static char zFileCopy[] = "proc zvfs::filecopy {from to {outtype binary}} {\n" " set f [open $from r]\n" @@ -1249,149 +1440,187 @@ static char zFileCopy[] = #else -Tcl_Channel Tobe_FSOpenFileChannelProc - _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr, - int mode, int permissions)) { - static int inopen=0; - Tcl_Channel chan; - if (inopen) { - puts("recursive zvfs open"); - return NULL; - } - inopen = 1; - /* if (mode != O_RDONLY) return NULL; */ - chan = ZvfsFileOpen(interp, Tcl_GetString(pathPtr), 0, - permissions); - inopen = 0; - return chan; +Tcl_Channel +Tobe_FSOpenFileChannelProc( + Tcl_Interp *interp, + Tcl_Obj *pathPtr, + int mode, + int permissions) +{ + static int inopen=0; + Tcl_Channel chan; + if (inopen) { + puts("recursive zvfs open"); + return NULL; + } + inopen = 1; + /* if (mode != O_RDONLY) return NULL; */ + chan = ZvfsFileOpen(interp, Tcl_GetString(pathPtr), 0, permissions); + inopen = 0; + return chan; +} + +/* + * This routine does a stat() system call for a ZVFS file. + */ +int +Tobe_FSStatProc( + Tcl_Obj *pathPtr, + struct stat *buf) +{ + return ZvfsFileStat(Tcl_GetString(pathPtr), buf); +} + +/* + * This routine does an access() system call for a ZVFS file. + */ +int +Tobe_FSAccessProc( + Tcl_Obj *pathPtr, + int mode) +{ + return ZvfsFileAccess(Tcl_GetString(pathPtr), mode); } +/* Tcl_Obj* Tobe_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr) { + return Tcl_NewStringObj("/",-1);; +} */ + /* -** This routine does a stat() system call for a ZVFS file. -*/ -int Tobe_FSStatProc _ANSI_ARGS_((Tcl_Obj *pathPtr, struct stat *buf)) { - - return ZvfsFileStat(Tcl_GetString(pathPtr), buf); + * Function to process a 'Tobe_FSMatchInDirectory()'. If not implemented, + * then glob and recursive copy functionality will be lacking in the + * filesystem. + */ +int +Tobe_FSMatchInDirectoryProc( + Tcl_Interp* interp, + Tcl_Obj *result, + Tcl_Obj *pathPtr, + const char *pattern, + Tcl_GlobTypeData * types) +{ + Tcl_HashEntry *pEntry; + Tcl_HashSearch sSearch; + int scnt, len, l, dirglob, dirmnt; + char *zPattern = NULL, *zp=Tcl_GetStringFromObj(pathPtr,&len); + + if (!zp) { + return TCL_ERROR; + } + if (pattern != NULL) { + l=strlen(pattern); + if (!zp) { + zPattern=strdup(pattern); + } else { + zPattern=(char*)malloc(len+l+3); + sprintf(zPattern,"%s%s%s", zp, zp[len-1]=='/'?"":"/",pattern); + } + scnt=strchrcnt(zPattern,'/'); + } + dirglob = (types && types->type && (types->type&TCL_GLOB_TYPE_DIR)); + dirmnt = (types && types->type && (types->type&TCL_GLOB_TYPE_MOUNT)); + if (strcmp(zp, "/") == 0 && strcmp(zPattern, ".*") == 0) { + /*TODO: What goes here?*/ + } + for(pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); + pEntry; pEntry = Tcl_NextHashEntry(&sSearch)){ + ZvfsFile *pFile = Tcl_GetHashValue(pEntry); + char *z = pFile->zName; + + if (zPattern != NULL) { + if( Tcl_StringCaseMatch(z, zPattern, 0) == 0 || + (scnt!=pFile->depth /* && !dirglob */ )) { // TODO: ??? + continue; + } + } else { + if (strcmp(zp, z)) { + continue; + } + } + if (dirmnt) { + if (pFile->isdir != 1) { + continue; + } + } else if (dirglob) { + if (!pFile->isdir) { + continue; + } + } else if (types && !(types->type&TCL_GLOB_TYPE_DIR)) { + if (pFile->isdir) { + continue; + } + } + Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(z, -1)); + } + if (zPattern) { + free(zPattern); + } + return TCL_OK; } /* -** This routine does an access() system call for a ZVFS file. -*/ -int Tobe_FSAccessProc _ANSI_ARGS_((Tcl_Obj *pathPtr, int mode)) { - return ZvfsFileAccess(Tcl_GetString(pathPtr), mode); -} - - -/* Tcl_Obj* Tobe_FSFilesystemSeparatorProc - _ANSI_ARGS_((Tcl_Obj *pathPtr)) { - return Tcl_NewStringObj("/",-1);; -} */ -/* Function to process a -* 'Tobe_FSMatchInDirectory()'. If not -* implemented, then glob and recursive -* copy functionality will be lacking in -* the filesystem. */ -int Tobe_FSMatchInDirectoryProc _ANSI_ARGS_((Tcl_Interp* interp, - Tcl_Obj *result, Tcl_Obj *pathPtr, CONST char *pattern, - Tcl_GlobTypeData * types)) { - Tcl_HashEntry *pEntry; - Tcl_HashSearch sSearch; - int scnt, len, l, dirglob, dirmnt; - char *zPattern = NULL, *zp=Tcl_GetStringFromObj(pathPtr,&len);; - if (!zp) return TCL_ERROR; - if (pattern != NULL) { - l=strlen(pattern); - if (!zp) - zPattern=strdup(pattern); - else { - zPattern=(char*)malloc(len+l+3); - sprintf(zPattern,"%s%s%s", zp, zp[len-1]=='/'?"":"/",pattern); - } - scnt=strchrcnt(zPattern,'/'); - } - dirglob = (types && types->type && (types->type&TCL_GLOB_TYPE_DIR)); - dirmnt = (types && types->type && (types->type&TCL_GLOB_TYPE_MOUNT)); - if (strcmp(zp, "/") == 0 && strcmp(zPattern, ".*") == 0) { - } - for(pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); - pEntry; - pEntry = Tcl_NextHashEntry(&sSearch) - ){ - ZvfsFile *pFile = Tcl_GetHashValue(pEntry); - char *z = pFile->zName; - if (zPattern != NULL) { - if( Tcl_StringCaseMatch(z, zPattern, 0) == 0 || - (scnt!=pFile->depth /* && !dirglob */ )) { // TODO: ??? - continue; - } - } else { - if (strcmp(zp, z)) - continue; - } - if (dirmnt) { - if (pFile->isdir != 1) - continue; - } else if (dirglob) { - if (!pFile->isdir) - continue; - } else if (types && !(types->type&TCL_GLOB_TYPE_DIR)) { - if (pFile->isdir) - continue; - } - Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(z, -1)); - } - if (zPattern) - free(zPattern); - return TCL_OK; -} + * Function to check whether a path is in this filesystem. This is the most + * important filesystem procedure. + */ +int +Tobe_FSPathInFilesystemProc( + Tcl_Obj *pathPtr, + ClientData *clientDataPtr) +{ + ZvfsFile *zFile; + char *path=Tcl_GetString(pathPtr); -/* Function to check whether a path is in -* this filesystem. This is the most -* important filesystem procedure. */ -int Tobe_FSPathInFilesystemProc _ANSI_ARGS_((Tcl_Obj *pathPtr, - ClientData *clientDataPtr)) { - ZvfsFile *zFile; - char *path=Tcl_GetString(pathPtr); // if (ZvfsLookupMount(path)!=0) // return TCL_OK; - // TODO: also check this is the archive. - if (openarch) - return -1; - zFile = ZvfsLookup(path); - if (zFile!=NULL && strcmp(path,zFile->pArchive->zName)) - return TCL_OK; - return -1; +// // TODO: also check this is the archive. + if (openarch) { + return -1; + } + zFile = ZvfsLookup(path); + if (zFile!=NULL && strcmp(path,zFile->pArchive->zName)) { + return TCL_OK; + } + return -1; } -Tcl_Obj *Tobe_FSListVolumesProc _ANSI_ARGS_((void)) { - Tcl_HashEntry *pEntry; /* Hash table entry */ - Tcl_HashSearch zSearch; /* Search all mount points */ - ZvfsArchive *pArchive; /* The ZIP archive being mounted */ - Tcl_Obj *pVols=NULL, *pVol; - pEntry=Tcl_FirstHashEntry(&local.archiveHash,&zSearch); - while (pEntry) { - if (pArchive = Tcl_GetHashValue(pEntry)) { - if (!pVols) { - pVols=Tcl_NewListObj(0,0); - Tcl_IncrRefCount(pVols); - } - pVol=Tcl_NewStringObj(pArchive->zMountPoint,-1); - Tcl_IncrRefCount(pVol); - Tcl_ListObjAppendElement(NULL, pVols,pVol); - Tcl_DecrRefCount(pVol); - } - pEntry=Tcl_NextHashEntry(&zSearch); - } - return pVols; +Tcl_Obj * +Tobe_FSListVolumesProc(void) +{ + Tcl_HashEntry *pEntry; /* Hash table entry */ + Tcl_HashSearch zSearch; /* Search all mount points */ + ZvfsArchive *pArchive; /* The ZIP archive being mounted */ + Tcl_Obj *pVols=NULL, *pVol; + + pEntry=Tcl_FirstHashEntry(&local.archiveHash,&zSearch); + while (pEntry) { + if (pArchive = Tcl_GetHashValue(pEntry)) { + if (!pVols) { + pVols=Tcl_NewListObj(0,0); + Tcl_IncrRefCount(pVols); + } + pVol=Tcl_NewStringObj(pArchive->zMountPoint,-1); + Tcl_IncrRefCount(pVol); + Tcl_ListObjAppendElement(NULL, pVols,pVol); + Tcl_DecrRefCount(pVol); + } + pEntry=Tcl_NextHashEntry(&zSearch); + } + return pVols; } -int Tobe_FSChdirProc _ANSI_ARGS_((Tcl_Obj *pathPtr)) { - /* Someday, we should actually check if this is a valid path. */ - return TCL_OK; +int +Tobe_FSChdirProc( + Tcl_Obj *pathPtr) +{ + /* Someday, we should actually check if this is a valid path. */ + return TCL_OK; } -CONST char** Tobe_FSFileAttrStringsProc _ANSI_ARGS_((Tcl_Obj *pathPtr, - Tcl_Obj** objPtrRef)) { +const char ** +Tobe_FSFileAttrStringsProc( + Tcl_Obj *pathPtr, + Tcl_Obj** objPtrRef) +{ Tcl_Obj *listPtr; Tcl_Interp *interp = NULL; char *path=Tcl_GetString(pathPtr); @@ -1400,45 +1629,49 @@ CONST char** Tobe_FSFileAttrStringsProc _ANSI_ARGS_((Tcl_Obj *pathPtr, #else static CONST char *attrs[] = { "-group", "-owner", "-permissions", 0 }; #endif - if (ZvfsLookup(path)==0) - return NULL; + if (ZvfsLookup(path)==0) { + return NULL; + } return attrs; } -int Tobe_FSFileAttrsGetProc _ANSI_ARGS_((Tcl_Interp *interp, - int index, Tcl_Obj *pathPtr, - Tcl_Obj **objPtrRef)) { - +int +Tobe_FSFileAttrsGetProc( + Tcl_Interp *interp, + int index, + Tcl_Obj *pathPtr, + Tcl_Obj **objPtrRef) +{ char *path=Tcl_GetString(pathPtr); char buf[50]; ZvfsFile *zFile; + if ((zFile = ZvfsLookup(path))==0) - return TCL_ERROR; + return TCL_ERROR; switch (index) { #ifdef __WIN32__ - - case 0: /* -archive */ - *objPtrRef = Tcl_NewStringObj("0", -1); break; - case 1: /* -hidden */ - *objPtrRef = Tcl_NewStringObj("0", -1); break; - case 2: /* -readonly */ - *objPtrRef = Tcl_NewStringObj("", -1); break; - case 3: /* -system */ - *objPtrRef = Tcl_NewStringObj("", -1); break; - case 4: /* -shortname */ - *objPtrRef = Tcl_NewStringObj("", -1); + case 0: /* -archive */ + *objPtrRef = Tcl_NewStringObj("0", -1); break; + case 1: /* -hidden */ + *objPtrRef = Tcl_NewStringObj("0", -1); break; + case 2: /* -readonly */ + *objPtrRef = Tcl_NewStringObj("", -1); break; + case 3: /* -system */ + *objPtrRef = Tcl_NewStringObj("", -1); break; + case 4: /* -shortname */ + *objPtrRef = Tcl_NewStringObj("", -1); #else - case 0: /* -group */ - *objPtrRef = Tcl_NewStringObj("", -1); break; - case 1: /* -owner */ - *objPtrRef = Tcl_NewStringObj("", -1); break; - case 2: /* -permissions */ - sprintf(buf, "%03o", zFile->permissions); - *objPtrRef = Tcl_NewStringObj(buf, -1); break; + case 0: /* -group */ + *objPtrRef = Tcl_NewStringObj("", -1); break; + case 1: /* -owner */ + *objPtrRef = Tcl_NewStringObj("", -1); break; + case 2: /* -permissions */ + sprintf(buf, "%03o", zFile->permissions); + *objPtrRef = Tcl_NewStringObj(buf, -1); break; #endif } - + return TCL_OK; } @@ -1466,234 +1699,185 @@ int Tobe_FSFileAttrsGetProc _ANSI_ARGS_((Tcl_Interp *interp, #define Tobe_FSDupInternalRepProc 0 #define Tobe_FSFreeInternalRepProc 0 #define Tobe_FSFilesystemPathTypeProc 0 -#define Tobe_FSLinkProc 0 +#define Tobe_FSLinkProc 0 #else -/* Function to process a -* 'Tobe_FSLoadFile()' call. If not -* implemented, Tcl will fall back on -* a copy to native-temp followed by a -* Tobe_FSLoadFile on that temporary copy. */ -int Tobe_FSLoadFileProc _ANSI_ARGS_((Tcl_Interp * interp, - Tcl_Obj *pathPtr, char * sym1, char * sym2, - Tcl_PackageInitProc ** proc1Ptr, - Tcl_PackageInitProc ** proc2Ptr, - ClientData * clientDataPtr)) { return 0; } - - -/* Function to unload a previously -* successfully loaded file. If load was -* implemented, then this should also be -* implemented, if there is any cleanup -* action required. */ -void Tobe_FSUnloadFileProc _ANSI_ARGS_((ClientData clientData)) { - return; +/* + * Function to process a 'Tobe_FSLoadFile()' call. If not implemented, Tcl + * will fall back on a copy to native-temp followed by a Tobe_FSLoadFile on + * that temporary copy. + */ +int +Tobe_FSLoadFileProc( + Tcl_Interp * interp, + Tcl_Obj *pathPtr, + char * sym1, + char * sym2, + Tcl_PackageInitProc ** proc1Ptr, + Tcl_PackageInitProc ** proc2Ptr, + ClientData * clientDataPtr) +{ + return 0; } -Tcl_Obj* Tobe_FSGetCwdProc _ANSI_ARGS_((Tcl_Interp *interp)) { return 0; } -int Tobe_FSCreateDirectoryProc _ANSI_ARGS_((Tcl_Obj *pathPtr)) { return 0; } -int Tobe_FSDeleteFileProc _ANSI_ARGS_((Tcl_Obj *pathPtr)) { return 0; } -int Tobe_FSCopyDirectoryProc _ANSI_ARGS_((Tcl_Obj *srcPathPtr, - Tcl_Obj *destPathPtr, Tcl_Obj **errorPtr)) { return 0; } -int Tobe_FSCopyFileProc _ANSI_ARGS_((Tcl_Obj *srcPathPtr, - Tcl_Obj *destPathPtr)) { return 0; } -int Tobe_FSRemoveDirectoryProc _ANSI_ARGS_((Tcl_Obj *pathPtr, - int recursive, Tcl_Obj **errorPtr)) { return 0; } -int Tobe_FSRenameFileProc _ANSI_ARGS_((Tcl_Obj *srcPathPtr, - Tcl_Obj *destPathPtr)) { return 0; } +/* + * Function to unload a previously successfully loaded file. If load was + * implemented, then this should also be implemented, if there is any cleanup + * action required. + */ +void Tobe_FSUnloadFileProc(ClientData clientData) { return; } +Tcl_Obj* Tobe_FSGetCwdProc(Tcl_Interp *interp) { return 0; } +int Tobe_FSCreateDirectoryProc(Tcl_Obj *pathPtr) { return 0; } +int Tobe_FSDeleteFileProc(Tcl_Obj *pathPtr) { return 0; } +int Tobe_FSCopyDirectoryProc(Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr, + Tcl_Obj **errorPtr) { return 0; } +int Tobe_FSCopyFileProc(Tcl_Obj *srcPathPtr, + Tcl_Obj *destPathPtr) { return 0; } +int Tobe_FSRemoveDirectoryProc(Tcl_Obj *pathPtr, int recursive, + Tcl_Obj **errorPtr) { return 0; } +int Tobe_FSRenameFileProc(Tcl_Obj *srcPathPtr, + Tcl_Obj *destPathPtr) { return 0; } /* We have to declare the utime structure here. */ -int Tobe_FSUtimeProc _ANSI_ARGS_((Tcl_Obj *pathPtr, - struct utimbuf *tval)) { return 0; } -int Tobe_FSNormalizePathProc _ANSI_ARGS_((Tcl_Interp *interp, - Tcl_Obj *pathPtr, int nextCheckpoint)) { return 0; } -int Tobe_FSFileAttrsSetProc _ANSI_ARGS_((Tcl_Interp *interp, - int index, Tcl_Obj *pathPtr, - Tcl_Obj *objPtr)) { return 0; } -Tcl_Obj* Tobe_FSLinkProc _ANSI_ARGS_((Tcl_Obj *pathPtr)) { return 0; } -Tcl_Obj* Tobe_FSFilesystemPathTypeProc - _ANSI_ARGS_((Tcl_Obj *pathPtr)) { return 0; } -void Tobe_FSFreeInternalRepProc _ANSI_ARGS_((ClientData clientData)) { return; } -ClientData Tobe_FSDupInternalRepProc - _ANSI_ARGS_((ClientData clientData)) { return 0; } -Tcl_Obj* Tobe_FSInternalToNormalizedProc - _ANSI_ARGS_((ClientData clientData)) { return 0; } -ClientData Tobe_FSCreateInternalRepProc _ANSI_ARGS_((Tcl_Obj *pathPtr)) { - return 0; -} - +int Tobe_FSUtimeProc(Tcl_Obj *pathPtr, struct utimbuf *tval) { return 0; } +int Tobe_FSNormalizePathProc(Tcl_Interp *interp, Tcl_Obj *pathPtr, + int nextCheckpoint) { return 0; } +int Tobe_FSFileAttrsSetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, + Tcl_Obj *objPtr) { return 0; } +Tcl_Obj* Tobe_FSLinkProc(Tcl_Obj *pathPtr) { return 0; } +Tcl_Obj* Tobe_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr) { return 0; } +void Tobe_FSFreeInternalRepProc(ClientData clientData) { return; } +ClientData Tobe_FSDupInternalRepProc(ClientData clientData) { return 0; } +Tcl_Obj* Tobe_FSInternalToNormalizedProc(ClientData clientData) { return 0; } +ClientData Tobe_FSCreateInternalRepProc(Tcl_Obj *pathPtr) { return 0; } #endif - static Tcl_Filesystem Tobe_Filesystem = { - "tobe", /* The name of the filesystem. */ - sizeof(Tcl_Filesystem), /* Length of this structure, so future - * binary compatibility can be assured. */ - TCL_FILESYSTEM_VERSION_1, - /* Version of the filesystem type. */ - Tobe_FSPathInFilesystemProc, - /* Function to check whether a path is in - * this filesystem. This is the most - * important filesystem procedure. */ - Tobe_FSDupInternalRepProc, - /* Function to duplicate internal fs rep. May - * be NULL (but then fs is less efficient). */ - Tobe_FSFreeInternalRepProc, - /* Function to free internal fs rep. Must - * be implemented, if internal representations - * need freeing, otherwise it can be NULL. */ + "tobe", /* The name of the filesystem. */ + sizeof(Tcl_Filesystem), /* Length of this structure, so future binary + * compatibility can be assured. */ + TCL_FILESYSTEM_VERSION_1, /* Version of the filesystem type. */ + Tobe_FSPathInFilesystemProc,/* Function to check whether a path is in this + * filesystem. This is the most important + * filesystem procedure. */ + Tobe_FSDupInternalRepProc, /* Function to duplicate internal fs rep. May + * be NULL (but then fs is less efficient). */ + Tobe_FSFreeInternalRepProc, /* Function to free internal fs rep. Must be + * implemented, if internal representations + * need freeing, otherwise it can be NULL. */ Tobe_FSInternalToNormalizedProc, - /* Function to convert internal representation - * to a normalized path. Only required if - * the fs creates pure path objects with no - * string/path representation. */ + /* Function to convert internal representation + * to a normalized path. Only required if the + * fs creates pure path objects with no + * string/path representation. */ Tobe_FSCreateInternalRepProc, - /* Function to create a filesystem-specific - * internal representation. May be NULL - * if paths have no internal representation, - * or if the Tobe_FSPathInFilesystemProc - * for this filesystem always immediately - * creates an internal representation for - * paths it accepts. */ - Tobe_FSNormalizePathProc, - /* Function to normalize a path. Should - * be implemented for all filesystems - * which can have multiple string - * representations for the same path - * object. */ + /* Function to create a filesystem-specific + * internal representation. May be NULL if + * paths have no internal representation, or + * if the Tobe_FSPathInFilesystemProc for this + * filesystem always immediately creates an + * internal representation for paths it + * accepts. */ + Tobe_FSNormalizePathProc, /* Function to normalize a path. Should be + * implemented for all filesystems which can + * have multiple string representations for + * the same path object. */ Tobe_FSFilesystemPathTypeProc, - /* Function to determine the type of a - * path in this filesystem. May be NULL. */ + /* Function to determine the type of a path in + * this filesystem. May be NULL. */ Tobe_FSFilesystemSeparatorProc, - /* Function to return the separator - * character(s) for this filesystem. Must - * be implemented. */ - Tobe_FSStatProc, - /* - * Function to process a 'Tobe_FSStat()' - * call. Must be implemented for any - * reasonable filesystem. - */ - Tobe_FSAccessProc, - /* - * Function to process a 'Tobe_FSAccess()' - * call. Must be implemented for any - * reasonable filesystem. - */ - Tobe_FSOpenFileChannelProc, - /* - * Function to process a - * 'Tobe_FSOpenFileChannel()' call. Must be - * implemented for any reasonable - * filesystem. - */ - Tobe_FSMatchInDirectoryProc, - /* Function to process a - * 'Tobe_FSMatchInDirectory()'. If not - * implemented, then glob and recursive - * copy functionality will be lacking in - * the filesystem. */ - Tobe_FSUtimeProc, - /* Function to process a - * 'Tobe_FSUtime()' call. Required to - * allow setting (not reading) of times - * with 'file mtime', 'file atime' and - * the open-r/open-w/fcopy implementation - * of 'file copy'. */ - Tobe_FSLinkProc, - /* Function to process a - * 'Tobe_FSLink()' call. Should be - * implemented only if the filesystem supports - * links. */ - Tobe_FSListVolumesProc, - /* Function to list any filesystem volumes - * added by this filesystem. Should be - * implemented only if the filesystem adds - * volumes at the head of the filesystem. */ - Tobe_FSFileAttrStringsProc, - /* Function to list all attributes strings - * which are valid for this filesystem. - * If not implemented the filesystem will - * not support the 'file attributes' command. - * This allows arbitrary additional information - * to be attached to files in the filesystem. */ - Tobe_FSFileAttrsGetProc, - /* Function to process a - * 'Tobe_FSFileAttrsGet()' call, used by - * 'file attributes'. */ - Tobe_FSFileAttrsSetProc, - /* Function to process a - * 'Tobe_FSFileAttrsSet()' call, used by - * 'file attributes'. */ - Tobe_FSCreateDirectoryProc, - /* Function to process a - * 'Tobe_FSCreateDirectory()' call. Should - * be implemented unless the FS is - * read-only. */ - Tobe_FSRemoveDirectoryProc, - /* Function to process a - * 'Tobe_FSRemoveDirectory()' call. Should - * be implemented unless the FS is - * read-only. */ - Tobe_FSDeleteFileProc, - /* Function to process a - * 'Tobe_FSDeleteFile()' call. Should - * be implemented unless the FS is - * read-only. */ - Tobe_FSCopyFileProc, - /* Function to process a - * 'Tobe_FSCopyFile()' call. If not - * implemented Tcl will fall back - * on open-r, open-w and fcopy as - * a copying mechanism. */ - Tobe_FSRenameFileProc, - /* Function to process a - * 'Tobe_FSRenameFile()' call. If not - * implemented, Tcl will fall back on - * a copy and delete mechanism. */ - Tobe_FSCopyDirectoryProc, - /* Function to process a - * 'Tobe_FSCopyDirectory()' call. If - * not implemented, Tcl will fall back - * on a recursive create-dir, file copy - * mechanism. */ - Tobe_FSLoadFileProc, - /* Function to process a - * 'Tobe_FSLoadFile()' call. If not - * implemented, Tcl will fall back on - * a copy to native-temp followed by a - * Tobe_FSLoadFile on that temporary copy. */ - Tobe_FSUnloadFileProc, - /* Function to unload a previously - * successfully loaded file. If load was - * implemented, then this should also be - * implemented, if there is any cleanup - * action required. */ - Tobe_FSGetCwdProc, - /* - * Function to process a 'Tobe_FSGetCwd()' - * call. Most filesystems need not - * implement this. It will usually only be - * called once, if 'getcwd' is called - * before 'chdir'. May be NULL. - */ - Tobe_FSChdirProc, - /* - * Function to process a 'Tobe_FSChdir()' - * call. If filesystems do not implement - * this, it will be emulated by a series of - * directory access checks. Otherwise, - * virtual filesystems which do implement - * it need only respond with a positive - * return result if the dirName is a valid - * directory in their filesystem. They - * need not remember the result, since that - * will be automatically remembered for use - * by GetCwd. Real filesystems should - * carry out the correct action (i.e. call - * the correct system 'chdir' api). If not - * implemented, then 'cd' and 'pwd' will - * fail inside the filesystem. - */ + /* Function to return the separator + * character(s) for this filesystem. Must be + * implemented. */ + Tobe_FSStatProc, /* Function to process a 'Tobe_FSStat()' call. + * Must be implemented for any reasonable + * filesystem. */ + Tobe_FSAccessProc, /* Function to process a 'Tobe_FSAccess()' + * call. Must be implemented for any + * reasonable filesystem. */ + Tobe_FSOpenFileChannelProc, /* Function to process a + * 'Tobe_FSOpenFileChannel()' call. Must be + * implemented for any reasonable + * filesystem. */ + Tobe_FSMatchInDirectoryProc,/* Function to process a + * 'Tobe_FSMatchInDirectory()'. If not + * implemented, then glob and recursive copy + * functionality will be lacking in the + * filesystem. */ + Tobe_FSUtimeProc, /* Function to process a 'Tobe_FSUtime()' + * call. Required to allow setting (not + * reading) of times with 'file mtime', 'file + * atime' and the open-r/open-w/fcopy + * implementation of 'file copy'. */ + Tobe_FSLinkProc, /* Function to process a 'Tobe_FSLink()' call. + * Should be implemented only if the + * filesystem supports links. */ + Tobe_FSListVolumesProc, /* Function to list any filesystem volumes + * added by this filesystem. Should be + * implemented only if the filesystem adds + * volumes at the head of the filesystem. */ + Tobe_FSFileAttrStringsProc, /* Function to list all attributes strings + * which are valid for this filesystem. If + * not implemented the filesystem will not + * support the 'file attributes' command. + * This allows arbitrary additional + * information to be attached to files in the + * filesystem. */ + Tobe_FSFileAttrsGetProc, /* Function to process a + * 'Tobe_FSFileAttrsGet()' call, used by 'file + * attributes'. */ + Tobe_FSFileAttrsSetProc, /* Function to process a + * 'Tobe_FSFileAttrsSet()' call, used by 'file + * attributes'. */ + Tobe_FSCreateDirectoryProc, /* Function to process a + * 'Tobe_FSCreateDirectory()' call. Should be + * implemented unless the FS is read-only. */ + Tobe_FSRemoveDirectoryProc, /* Function to process a + * 'Tobe_FSRemoveDirectory()' call. Should be + * implemented unless the FS is read-only. */ + Tobe_FSDeleteFileProc, /* Function to process a 'Tobe_FSDeleteFile()' + * call. Should be implemented unless the FS + * is read-only. */ + Tobe_FSCopyFileProc, /* Function to process a 'Tobe_FSCopyFile()' + * call. If not implemented Tcl will fall + * back on open-r, open-w and fcopy as a + * copying mechanism. */ + Tobe_FSRenameFileProc, /* Function to process a 'Tobe_FSRenameFile()' + * call. If not implemented, Tcl will fall + * back on a copy and delete mechanism. */ + Tobe_FSCopyDirectoryProc, /* Function to process a + * 'Tobe_FSCopyDirectory()' call. If not + * implemented, Tcl will fall back on a + * recursive create-dir, file copy + * mechanism. */ + Tobe_FSLoadFileProc, /* Function to process a 'Tobe_FSLoadFile()' + * call. If not implemented, Tcl will fall + * back on a copy to native-temp followed by a + * Tobe_FSLoadFile on that temporary copy. */ + Tobe_FSUnloadFileProc, /* Function to unload a previously + * successfully loaded file. If load was + * implemented, then this should also be + * implemented, if there is any cleanup action + * required. */ + Tobe_FSGetCwdProc, /* Function to process a 'Tobe_FSGetCwd()' + * call. Most filesystems need not implement + * this. It will usually only be called once, + * if 'getcwd' is called before 'chdir'. May + * be NULL. */ + Tobe_FSChdirProc, /* Function to process a 'Tobe_FSChdir()' + * call. If filesystems do not implement this, + * it will be emulated by a series of + * directory access checks. Otherwise, virtual + * filesystems which do implement it need only + * respond with a positive return result if + * the dirName is a valid directory in their + * filesystem. They need not remember the + * result, since that will be automatically + * remembered for use by GetCwd. Real + * filesystems should carry out the correct + * action (i.e. call the correct system + * 'chdir' api). If not implemented, then 'cd' + * and 'pwd' will fail inside the + * filesystem. */ }; #endif @@ -1707,490 +1891,562 @@ static int ZvfsDumpObjCmd( void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj static int ZvfsStartObjCmd( void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); /* -** Initialize the ZVFS system. -*/ -int Zvfs_doInit(Tcl_Interp *interp, int safe){ - int n; + * Initialize the ZVFS system. + */ +int +Zvfs_doInit( + Tcl_Interp *interp, + int safe) +{ + int n; #ifdef USE_TCL_STUBS - if( Tcl_InitStubs(interp,"8.0",0)==0 ){ - return TCL_ERROR; - } + if( Tcl_InitStubs(interp,"8.0",0)==0 ){ + return TCL_ERROR; + } #endif - Tcl_StaticPackage(interp, "zvfs", Tcl_Zvfs_Init, Tcl_Zvfs_SafeInit); - if (!safe) { - Tcl_CreateCommand(interp, "zvfs::mount", ZvfsMountCmd, 0, 0); - Tcl_CreateCommand(interp, "zvfs::unmount", ZvfsUnmountCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::append", ZvfsAppendObjCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::add", ZvfsAddObjCmd, 0, 0); - } - Tcl_CreateObjCommand(interp, "zvfs::exists", ZvfsExistsObjCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::info", ZvfsInfoObjCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::list", ZvfsListObjCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::dump", ZvfsDumpObjCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::start", ZvfsStartObjCmd, 0, 0); - Tcl_SetVar(interp, "::zvfs::auto_ext", ".tcl .tk .itcl .htcl .txt .c .h .tht", TCL_GLOBAL_ONLY); -/* Tcl_CreateObjCommand(interp, "zip::open", ZipOpenObjCmd, 0, 0); */ + Tcl_StaticPackage(interp, "zvfs", Tcl_Zvfs_Init, Tcl_Zvfs_SafeInit); + if (!safe) { + Tcl_CreateCommand(interp, "zvfs::mount", ZvfsMountCmd, 0, 0); + Tcl_CreateCommand(interp, "zvfs::unmount", ZvfsUnmountCmd, 0, 0); + Tcl_CreateObjCommand(interp, "zvfs::append", ZvfsAppendObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "zvfs::add", ZvfsAddObjCmd, 0, 0); + } + Tcl_CreateObjCommand(interp, "zvfs::exists", ZvfsExistsObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "zvfs::info", ZvfsInfoObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "zvfs::list", ZvfsListObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "zvfs::dump", ZvfsDumpObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "zvfs::start", ZvfsStartObjCmd, 0, 0); + Tcl_SetVar(interp, "::zvfs::auto_ext", ".tcl .tk .itcl .htcl .txt .c .h .tht", TCL_GLOBAL_ONLY); + /* Tcl_CreateObjCommand(interp, "zip::open", ZipOpenObjCmd, 0, 0); */ #ifndef USE_TCL_VFS - Tcl_GlobalEval(interp, zFileCopy); + Tcl_GlobalEval(interp, zFileCopy); #endif - if( !local.isInit ){ - /* One-time initialization of the ZVFS */ + if( !local.isInit ){ + /* One-time initialization of the ZVFS */ #ifdef USE_TCL_VFS - n = Tcl_FSRegister(0, &Tobe_Filesystem); + n = Tcl_FSRegister(0, &Tobe_Filesystem); #else - extern void TclAccessInsertProc(); - extern void TclStatInsertProc(); - extern void TclOpenFileChannelInsertProc(); - TclAccessInsertProc(ZvfsFileAccess); - TclStatInsertProc(ZvfsFileStat); - TclOpenFileChannelInsertProc(ZvfsFileOpen); + extern void TclAccessInsertProc(); + extern void TclStatInsertProc(); + extern void TclOpenFileChannelInsertProc(); + + TclAccessInsertProc(ZvfsFileAccess); + TclStatInsertProc(ZvfsFileStat); + TclOpenFileChannelInsertProc(ZvfsFileOpen); #endif - Tcl_InitHashTable(&local.fileHash, TCL_STRING_KEYS); - Tcl_InitHashTable(&local.archiveHash, TCL_STRING_KEYS); - local.isInit = 1; - } - if (Zvfs_PostInit) Zvfs_PostInit(interp); - return TCL_OK; + Tcl_InitHashTable(&local.fileHash, TCL_STRING_KEYS); + Tcl_InitHashTable(&local.archiveHash, TCL_STRING_KEYS); + local.isInit = 1; + } + if (Zvfs_PostInit) { + Zvfs_PostInit(interp); + } + return TCL_OK; } -int Tcl_Zvfs_Init(Tcl_Interp *interp){ - return Zvfs_doInit(interp,0); +int +Tcl_Zvfs_Init( + Tcl_Interp *interp) +{ + return Zvfs_doInit(interp,0); } -int Tcl_Zvfs_SafeInit(Tcl_Interp *interp){ - return Zvfs_doInit(interp,1); +int +Tcl_Zvfs_SafeInit( + Tcl_Interp *interp) +{ + return Zvfs_doInit(interp,1); } - /************************************************************************/ /************************************************************************/ /************************************************************************/ /* -** Implement the zvfs::dump command -** -** zvfs::dump ARCHIVE -** -** Each entry in the list returned is of the following form: -** -** {FILENAME DATE-TIME SPECIAL-FLAG OFFSET SIZE COMPRESSED-SIZE} -** -*/ -static int ZvfsDumpObjCmd( - void *NotUsed, /* Client data for this command */ - Tcl_Interp *interp, /* The interpreter used to report errors */ - int objc, /* Number of arguments */ - Tcl_Obj *const* objv /* Values of all arguments */ -){ - char *zFilename; - Tcl_Channel chan; - ZFile *pList; - int rc; - Tcl_Obj *pResult; - - if( objc!=2 ){ - Tcl_WrongNumArgs(interp, 1, objv, "FILENAME"); - return TCL_ERROR; - } - zFilename = Tcl_GetString(objv[1]); - chan = Tcl_OpenFileChannel(interp, zFilename, "r", 0); - if( chan==0 ) return TCL_ERROR; - rc = ZvfsReadTOC(interp, chan, &pList); - if( rc==TCL_ERROR ){ - deleteZFileList(pList); - return rc; - } - Tcl_Close(interp, chan); - pResult = Tcl_GetObjResult(interp); - while( pList ){ - Tcl_Obj *pEntry = Tcl_NewObj(); - ZFile *pNext; - char zDateTime[100]; - Tcl_ListObjAppendElement(interp, pEntry, Tcl_NewStringObj(pList->zName,-1)); - translateDosTimeDate(zDateTime, pList->dosDate, pList->dosTime); - Tcl_ListObjAppendElement(interp, pEntry, Tcl_NewStringObj(zDateTime, -1)); - Tcl_ListObjAppendElement(interp, pEntry, Tcl_NewIntObj(pList->isSpecial)); - Tcl_ListObjAppendElement(interp, pEntry, Tcl_NewIntObj(pList->iOffset)); - Tcl_ListObjAppendElement(interp, pEntry, Tcl_NewIntObj(pList->nByte)); - Tcl_ListObjAppendElement(interp, pEntry, Tcl_NewIntObj(pList->nByteCompr)); - Tcl_ListObjAppendElement(interp, pResult, pEntry); - pNext = pList->pNext; - Tcl_Free((char*)pList); - pList = pList->pNext; - } - return TCL_OK; + * Implement the zvfs::dump command + * + * zvfs::dump ARCHIVE + * + * Each entry in the list returned is of the following form: + * + * {FILENAME DATE-TIME SPECIAL-FLAG OFFSET SIZE COMPRESSED-SIZE} + */ +static int +ZvfsDumpObjCmd( + void *NotUsed, /* Client data for this command */ + Tcl_Interp *interp, /* The interpreter used to report errors */ + int objc, /* Number of arguments */ + Tcl_Obj *const* objv) /* Values of all arguments */ +{ + char *zFilename; + Tcl_Channel chan; + ZFile *pList; + int rc; + Tcl_Obj *pResult; + + if( objc!=2 ){ + Tcl_WrongNumArgs(interp, 1, objv, "FILENAME"); + return TCL_ERROR; + } + zFilename = Tcl_GetString(objv[1]); + chan = Tcl_OpenFileChannel(interp, zFilename, "r", 0); + if( chan==0 ) { + return TCL_ERROR; + } + rc = ZvfsReadTOC(interp, chan, &pList); + if( rc==TCL_ERROR ){ + deleteZFileList(pList); + return rc; + } + Tcl_Close(interp, chan); + pResult = Tcl_GetObjResult(interp); + while( pList ){ + Tcl_Obj *pEntry = Tcl_NewObj(); + ZFile *pNext; + char zDateTime[100]; + + Tcl_ListObjAppendElement(interp, pEntry, + Tcl_NewStringObj(pList->zName,-1)); + translateDosTimeDate(zDateTime, pList->dosDate, pList->dosTime); + Tcl_ListObjAppendElement(interp, pEntry, + Tcl_NewStringObj(zDateTime, -1)); + Tcl_ListObjAppendElement(interp, pEntry, + Tcl_NewIntObj(pList->isSpecial)); + Tcl_ListObjAppendElement(interp, pEntry, + Tcl_NewIntObj(pList->iOffset)); + Tcl_ListObjAppendElement(interp, pEntry, Tcl_NewIntObj(pList->nByte)); + Tcl_ListObjAppendElement(interp, pEntry, + Tcl_NewIntObj(pList->nByteCompr)); + Tcl_ListObjAppendElement(interp, pResult, pEntry); + pNext = pList->pNext; + Tcl_Free((char*)pList); + pList = pList->pNext; + } + return TCL_OK; } /* -** Write a file record into a ZIP archive at the current position of -** the write cursor for channel "chan". Add a ZFile record for the file -** to *ppList. If an error occurs, leave an error message on interp -** and return TCL_ERROR. Otherwise return TCL_OK. -*/ -static int writeFile( - Tcl_Interp *interp, /* Leave an error message here */ - Tcl_Channel out, /* Write the file here */ - Tcl_Channel in, /* Read data from this file */ - char *zSrc, /* Name the new ZIP file entry this */ - char *zDest, /* Name the new ZIP file entry this */ - ZFile **ppList /* Put a ZFile struct for the new file here */ -){ - z_stream stream; - ZFile *p; - int iEndOfData; - int nameLen; - int skip; - int toOut; - char zHdr[30]; - char zInBuf[100000]; - char zOutBuf[100000]; - struct tm *tm; - time_t now; - struct stat stat; - - /* Create a new ZFile structure for this file. - * TODO: fill in date/time etc. - */ - nameLen = strlen(zDest); - p = newZFile(nameLen, ppList); - strcpy(p->zName, zDest); - p->isSpecial = 0; - Tcl_Stat(zSrc, &stat); - now=stat.st_mtime; - tm = localtime(&now); - UnixTimeDate(tm, &p->dosDate, &p->dosTime); - p->iOffset = Tcl_Tell(out); - p->nByte = 0; - p->nByteCompr = 0; - p->nExtra = 0; - p->iCRC = 0; - p->permissions = stat.st_mode; - - /* Fill in as much of the header as we know. - */ - put32(&zHdr[0], 0x04034b50); - put16(&zHdr[4], 0x0014); - put16(&zHdr[6], 0); - put16(&zHdr[8], 8); - put16(&zHdr[10], p->dosTime); - put16(&zHdr[12], p->dosDate); - put16(&zHdr[26], nameLen); - put16(&zHdr[28], 0); - - /* Write the header and filename. - */ - Tcl_Write(out, zHdr, 30); - Tcl_Write(out, zDest, nameLen); - - /* The first two bytes that come out of the deflate compressor are - ** some kind of header that ZIP does not use. So skip the first two - ** output bytes. - */ - skip = 2; - - /* Write the compressed file. Compute the CRC as we progress. - */ - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - stream.opaque = 0; - stream.avail_in = 0; - stream.next_in = zInBuf; - stream.avail_out = sizeof(zOutBuf); - stream.next_out = zOutBuf; + * Write a file record into a ZIP archive at the current position of the write + * cursor for channel "chan". Add a ZFile record for the file to *ppList. If + * an error occurs, leave an error message on interp and return TCL_ERROR. + * Otherwise return TCL_OK. + */ +static int +writeFile( + Tcl_Interp *interp, /* Leave an error message here */ + Tcl_Channel out, /* Write the file here */ + Tcl_Channel in, /* Read data from this file */ + char *zSrc, /* Name the new ZIP file entry this */ + char *zDest, /* Name the new ZIP file entry this */ + ZFile **ppList) /* Put a ZFile struct for the new file here */ +{ + z_stream stream; + ZFile *p; + int iEndOfData; + int nameLen; + int skip; + int toOut; + char zHdr[30]; + char zInBuf[100000]; + char zOutBuf[100000]; + struct tm *tm; + time_t now; + struct stat stat; + + /* + * Create a new ZFile structure for this file. + * TODO: fill in date/time etc. + */ + nameLen = strlen(zDest); + p = newZFile(nameLen, ppList); + strcpy(p->zName, zDest); + p->isSpecial = 0; + Tcl_Stat(zSrc, &stat); + now=stat.st_mtime; + tm = localtime(&now); + UnixTimeDate(tm, &p->dosDate, &p->dosTime); + p->iOffset = Tcl_Tell(out); + p->nByte = 0; + p->nByteCompr = 0; + p->nExtra = 0; + p->iCRC = 0; + p->permissions = stat.st_mode; + + /* + * Fill in as much of the header as we know. + */ + + put32(&zHdr[0], 0x04034b50); + put16(&zHdr[4], 0x0014); + put16(&zHdr[6], 0); + put16(&zHdr[8], 8); + put16(&zHdr[10], p->dosTime); + put16(&zHdr[12], p->dosDate); + put16(&zHdr[26], nameLen); + put16(&zHdr[28], 0); + + /* + * Write the header and filename. + */ + + Tcl_Write(out, zHdr, 30); + Tcl_Write(out, zDest, nameLen); + + /* + * The first two bytes that come out of the deflate compressor are some + * kind of header that ZIP does not use. So skip the first two output + * bytes. + */ + + skip = 2; + + /* + * Write the compressed file. Compute the CRC as we progress. + */ + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + stream.opaque = 0; + stream.avail_in = 0; + stream.next_in = zInBuf; + stream.avail_out = sizeof(zOutBuf); + stream.next_out = zOutBuf; #if 1 - deflateInit(&stream, 9); + deflateInit(&stream, 9); #else - { - int i, err, WSIZE = 0x8000, windowBits, level=6; - for (i = ((unsigned)WSIZE), windowBits = 0; i != 1; i >>= 1, ++windowBits); - err = deflateInit2(&stream, level, Z_DEFLATED, -windowBits, 8, 0); + { + int i, err, WSIZE = 0x8000, windowBits, level=6; - } + for (i = ((unsigned)WSIZE), windowBits = 0; i != 1; i >>= 1, ++windowBits); + err = deflateInit2(&stream, level, Z_DEFLATED, -windowBits, 8, 0); + } #endif - p->iCRC = crc32(0, 0, 0); - while( !Tcl_Eof(in) ){ - if( stream.avail_in==0 ){ - int amt = Tcl_Read(in, zInBuf, sizeof(zInBuf)); - if( amt<=0 ) break; - p->iCRC = crc32(p->iCRC, zInBuf, amt); - stream.avail_in = amt; - stream.next_in = zInBuf; - } - deflate(&stream, 0); - toOut = sizeof(zOutBuf) - stream.avail_out; - if( toOut>skip ){ - Tcl_Write(out, &zOutBuf[skip], toOut - skip); - skip = 0; - }else{ - skip -= toOut; + + p->iCRC = crc32(0, 0, 0); + while( !Tcl_Eof(in) ){ + if( stream.avail_in==0 ){ + int amt = Tcl_Read(in, zInBuf, sizeof(zInBuf)); + + if( amt<=0 ) { + break; + } + p->iCRC = crc32(p->iCRC, zInBuf, amt); + stream.avail_in = amt; + stream.next_in = zInBuf; + } + deflate(&stream, 0); + toOut = sizeof(zOutBuf) - stream.avail_out; + if( toOut>skip ){ + Tcl_Write(out, &zOutBuf[skip], toOut - skip); + skip = 0; + }else{ + skip -= toOut; + } + stream.avail_out = sizeof(zOutBuf); + stream.next_out = zOutBuf; } - stream.avail_out = sizeof(zOutBuf); - stream.next_out = zOutBuf; - } - do{ - stream.avail_out = sizeof(zOutBuf); - stream.next_out = zOutBuf; - deflate(&stream, Z_FINISH); - toOut = sizeof(zOutBuf) - stream.avail_out; - if( toOut>skip ){ - Tcl_Write(out, &zOutBuf[skip], toOut - skip); - skip = 0; - }else{ - skip -= toOut; - } - }while( stream.avail_out==0 ); - p->nByte = stream.total_in; - p->nByteCompr = stream.total_out - 2; - deflateEnd(&stream); - Tcl_Flush(out); - - /* Remember were we are in the file. Then go back and write the - ** header, now that we know the compressed file size. - */ - iEndOfData = Tcl_Tell(out); - Tcl_Seek(out, p->iOffset, SEEK_SET); - put32(&zHdr[14], p->iCRC); - put32(&zHdr[18], p->nByteCompr); - put32(&zHdr[22], p->nByte); - Tcl_Write(out, zHdr, 30); - Tcl_Seek(out, iEndOfData, SEEK_SET); - - /* Close the input file. - */ - Tcl_Close(interp, in); - - /* Finished! - */ - return TCL_OK; + do{ + stream.avail_out = sizeof(zOutBuf); + stream.next_out = zOutBuf; + deflate(&stream, Z_FINISH); + toOut = sizeof(zOutBuf) - stream.avail_out; + if( toOut>skip ){ + Tcl_Write(out, &zOutBuf[skip], toOut - skip); + skip = 0; + }else{ + skip -= toOut; + } + }while( stream.avail_out==0 ); + p->nByte = stream.total_in; + p->nByteCompr = stream.total_out - 2; + deflateEnd(&stream); + Tcl_Flush(out); + + /* + * Remember were we are in the file. Then go back and write the header, + * now that we know the compressed file size. + */ + + iEndOfData = Tcl_Tell(out); + Tcl_Seek(out, p->iOffset, SEEK_SET); + put32(&zHdr[14], p->iCRC); + put32(&zHdr[18], p->nByteCompr); + put32(&zHdr[22], p->nByte); + Tcl_Write(out, zHdr, 30); + Tcl_Seek(out, iEndOfData, SEEK_SET); + + /* + * Close the input file. + */ + + Tcl_Close(interp, in); + return TCL_OK; } /* -** The arguments are two lists of ZFile structures sorted by iOffset. -** Either or both list may be empty. This routine merges the two -** lists together into a single sorted list and returns a pointer -** to the head of the unified list. -** -** This is part of the merge-sort algorithm. -*/ -static ZFile *mergeZFiles(ZFile *pLeft, ZFile *pRight){ - ZFile fakeHead; - ZFile *pTail; - - pTail = &fakeHead; - while( pLeft && pRight ){ - ZFile *p; - if( pLeft->iOffset <= pRight->iOffset ){ - p = pLeft; - pLeft = p->pNext; + * The arguments are two lists of ZFile structures sorted by iOffset. Either + * or both list may be empty. This routine merges the two lists together into + * a single sorted list and returns a pointer to the head of the unified list. + * + * This is part of the merge-sort algorithm. + */ +static ZFile * +mergeZFiles( + ZFile *pLeft, + ZFile *pRight) +{ + ZFile fakeHead; + ZFile *pTail; + + pTail = &fakeHead; + while( pLeft && pRight ){ + ZFile *p; + + if( pLeft->iOffset <= pRight->iOffset ){ + p = pLeft; + pLeft = p->pNext; + }else{ + p = pRight; + pRight = p->pNext; + } + pTail->pNext = p; + pTail = p; + } + if( pLeft ){ + pTail->pNext = pLeft; + }else if( pRight ){ + pTail->pNext = pRight; }else{ - p = pRight; - pRight = p->pNext; - } - pTail->pNext = p; - pTail = p; - } - if( pLeft ){ - pTail->pNext = pLeft; - }else if( pRight ){ - pTail->pNext = pRight; - }else{ - pTail->pNext = 0; - } - return fakeHead.pNext; + pTail->pNext = 0; + } + return fakeHead.pNext; } /* -** Sort a ZFile list so in accending order by iOffset. -*/ -static ZFile *sortZFiles(ZFile *pList){ -# define NBIN 30 - int i; - ZFile *p; - ZFile *aBin[NBIN+1]; - - for(i=0; i<=NBIN; i++) aBin[i] = 0; - while( pList ){ - p = pList; - pList = p->pNext; - p->pNext = 0; - for(i=0; ipNext; + p->pNext = 0; + for(i=0; ipNext){ - if( pList->isSpecial ) continue; - put32(&zBuf[0], 0x02014b50); - put16(&zBuf[4], 0x0317); - put16(&zBuf[6], 0x0014); - put16(&zBuf[8], 0); - put16(&zBuf[10], pList->nByte>pList->nByteCompr ? 0x0008 : 0x0000); - put16(&zBuf[12], pList->dosTime); - put16(&zBuf[14], pList->dosDate); - put32(&zBuf[16], pList->iCRC); - put32(&zBuf[20], pList->nByteCompr); - put32(&zBuf[24], pList->nByte); - put16(&zBuf[28], strlen(pList->zName)); - put16(&zBuf[30], 0); - put16(&zBuf[32], pList->nExtra); - put16(&zBuf[34], 1); - put16(&zBuf[36], 0); - put32(&zBuf[38], pList->permissions<<16); - put32(&zBuf[42], pList->iOffset); - Tcl_Write(chan, zBuf, 46); - Tcl_Write(chan, pList->zName, strlen(pList->zName)); - for(i=pList->nExtra; i>0; i-=40){ - int toWrite = i<40 ? i : 40; - Tcl_Write(chan," ",toWrite); - } - nEntry++; - } - iTocEnd = Tcl_Tell(chan); - put32(&zBuf[0], 0x06054b50); - put16(&zBuf[4], 0); - put16(&zBuf[6], 0); - put16(&zBuf[8], nEntry); - put16(&zBuf[10], nEntry); - put32(&zBuf[12], iTocEnd - iTocStart); - put32(&zBuf[16], iTocStart); - put16(&zBuf[20], 0); - Tcl_Write(chan, zBuf, 22); - Tcl_Flush(chan); + * Write a ZIP archive table of contents to the given channel. + */ +static void +writeTOC( + Tcl_Channel chan, + ZFile *pList) +{ + int iTocStart, iTocEnd; + int nEntry = 0; + int i; + char zBuf[100]; + + iTocStart = Tcl_Tell(chan); + for(; pList; pList=pList->pNext){ + if( pList->isSpecial ) { + continue; + } + put32(&zBuf[0], 0x02014b50); + put16(&zBuf[4], 0x0317); + put16(&zBuf[6], 0x0014); + put16(&zBuf[8], 0); + put16(&zBuf[10], pList->nByte>pList->nByteCompr ? 0x0008 : 0x0000); + put16(&zBuf[12], pList->dosTime); + put16(&zBuf[14], pList->dosDate); + put32(&zBuf[16], pList->iCRC); + put32(&zBuf[20], pList->nByteCompr); + put32(&zBuf[24], pList->nByte); + put16(&zBuf[28], strlen(pList->zName)); + put16(&zBuf[30], 0); + put16(&zBuf[32], pList->nExtra); + put16(&zBuf[34], 1); + put16(&zBuf[36], 0); + put32(&zBuf[38], pList->permissions<<16); + put32(&zBuf[42], pList->iOffset); + Tcl_Write(chan, zBuf, 46); + Tcl_Write(chan, pList->zName, strlen(pList->zName)); + for(i=pList->nExtra; i>0; i-=40){ + int toWrite = i<40 ? i : 40; + + /* CAREFUL! String below is intentionally 40 spaces! */ + Tcl_Write(chan," ", + toWrite); + } + nEntry++; + } + iTocEnd = Tcl_Tell(chan); + put32(&zBuf[0], 0x06054b50); + put16(&zBuf[4], 0); + put16(&zBuf[6], 0); + put16(&zBuf[8], nEntry); + put16(&zBuf[10], nEntry); + put32(&zBuf[12], iTocEnd - iTocStart); + put32(&zBuf[16], iTocStart); + put16(&zBuf[20], 0); + Tcl_Write(chan, zBuf, 22); + Tcl_Flush(chan); } - /* -** Implementation of the zvfs::append command. -** -** zvfs::append ARCHIVE (SOURCE DESTINATION)* -** -** This command reads SOURCE files and appends them (using the name -** DESTINATION) to the zip archive named ARCHIVE. A new zip archive -** is created if it does not already exist. If ARCHIVE refers to a -** file which exists but is not a zip archive, then this command -** turns ARCHIVE into a zip archive by appending the necessary -** records and the table of contents. Treat all files as binary. -** -** Note: No dup checking is done, so multiple occurances of the -** same file is allowed. -*/ -static int ZvfsAppendObjCmd( - void *NotUsed, /* Client data for this command */ - Tcl_Interp *interp, /* The interpreter used to report errors */ - int objc, /* Number of arguments */ - Tcl_Obj *const* objv /* Values of all arguments */ -){ - char *zArchive; - Tcl_Channel chan; - ZFile *pList = NULL, *pToc; - int rc = TCL_OK, i; - - /* Open the archive and read the table of contents - */ - if( objc<2 || (objc&1)!=0 ){ - Tcl_WrongNumArgs(interp, 1, objv, "ARCHIVE (SRC DEST)+"); - return TCL_ERROR; - } - - zArchive = Tcl_GetString(objv[1]); - chan = Tcl_OpenFileChannel(interp, zArchive, "r+", 0644); - if( chan==0 ) { - chan = Tcl_OpenFileChannel(interp, zArchive, "w+", 0644); - } - if( chan==0 ) return TCL_ERROR; - if( Tcl_SetChannelOption(interp, chan, "-translation", "binary") - || Tcl_SetChannelOption(interp, chan, "-encoding", "binary") - ){ - /* this should never happen */ - Tcl_Close(0, chan); - return TCL_ERROR; - } - - if (Tcl_Seek(chan, 0, SEEK_END) == 0) { - /* Null file is ok, we're creating new one. */ - } else { - Tcl_Seek(chan, 0, SEEK_SET); - rc = ZvfsReadTOC(interp, chan, &pList); - if( rc==TCL_ERROR ){ - deleteZFileList(pList); - Tcl_Close(interp, chan); - return rc; - } else rc=TCL_OK; - } - - /* Move the file pointer to the start of - ** the table of contents. - */ - for(pToc=pList; pToc; pToc=pToc->pNext){ - if( pToc->isSpecial && strcmp(pToc->zName,"*TOC*")==0 ) break; - } - if( pToc ){ - Tcl_Seek(chan, pToc->iOffset, SEEK_SET); - }else{ - Tcl_Seek(chan, 0, SEEK_END); - } - - /* Add new files to the end of the archive. - */ - for(i=2; rc==TCL_OK && ipNext){ + if( pToc->isSpecial && strcmp(pToc->zName,"*TOC*")==0 ) { + break; + } + } + if( pToc ){ + Tcl_Seek(chan, pToc->iOffset, SEEK_SET); + }else{ + Tcl_Seek(chan, 0, SEEK_END); + } + + /* + * Add new files to the end of the archive. + */ + + for(i=2; rc==TCL_OK && i p)) { p = NULL; @@ -2209,175 +2466,192 @@ GetExtension( CONST char *name) } /* -** Implementation of the zvfs::add command. -** -** zvfs::add ?-fconfigure optpairs? ARCHIVE FILE1 FILE2 ... -** -** This command is similar to append in that it adds files to the zip -** archive named ARCHIVE, however file names are relative the current directory. -** In addition, fconfigure is used to apply option pairs to set upon opening -** of each file. Otherwise, default translation is allowed -** for those file extensions listed in the ::zvfs::auto_ext var. -** Binary translation will be used for unknown extensions. -** -** NOTE Use '-fconfigure {}' to use auto translation for all. -*/ -static int ZvfsAddObjCmd( - void *NotUsed, /* Client data for this command */ - Tcl_Interp *interp, /* The interpreter used to report errors */ - int objc, /* Number of arguments */ - Tcl_Obj *CONST* objv /* Values of all arguments */ -){ - char *zArchive; - Tcl_Channel chan; - ZFile *pList = NULL, *pToc; - int rc = TCL_OK, i, j, oLen; - char *zOpts = NULL; - Tcl_Obj *confOpts = NULL; - int tobjc; - Tcl_Obj **tobjv; - Tcl_Obj *varObj = NULL; - - /* Open the archive and read the table of contents - */ - if (objc>3) { - zOpts = Tcl_GetStringFromObj(objv[1], &oLen); - if (!strncmp("-fconfigure", zOpts, oLen)) { - confOpts = objv[2]; - if (TCL_OK != Tcl_ListObjGetElements(interp, confOpts, &tobjc, &tobjv) || (tobjc%2)) { - return TCL_ERROR; - } - objc -= 2; - objv += 2; - } - } - if( objc==2) { - return TCL_OK; - } - - if( objc<3) { - Tcl_WrongNumArgs(interp, 1, objv, "?-fconfigure OPTPAIRS? ARCHIVE FILE1 FILE2 .."); - return TCL_ERROR; - } - zArchive = Tcl_GetString(objv[1]); - chan = Tcl_OpenFileChannel(interp, zArchive, "r+", 0644); - if( chan==0 ) { - chan = Tcl_OpenFileChannel(interp, zArchive, "w+", 0644); - } - if( chan==0 ) return TCL_ERROR; - if( Tcl_SetChannelOption(interp, chan, "-translation", "binary") - || Tcl_SetChannelOption(interp, chan, "-encoding", "binary") - ){ - /* this should never happen */ - Tcl_Close(0, chan); - return TCL_ERROR; - } - - if (Tcl_Seek(chan, 0, SEEK_END) == 0) { - /* Null file is ok, we're creating new one. */ - } else { - Tcl_Seek(chan, 0, SEEK_SET); - rc = ZvfsReadTOC(interp, chan, &pList); - if( rc==TCL_ERROR ){ - deleteZFileList(pList); - Tcl_Close(interp, chan); - return rc; - } else rc=TCL_OK; - } - - /* Move the file pointer to the start of - ** the table of contents. - */ - for(pToc=pList; pToc; pToc=pToc->pNext){ - if( pToc->isSpecial && strcmp(pToc->zName,"*TOC*")==0 ) break; - } - if( pToc ){ - Tcl_Seek(chan, pToc->iOffset, SEEK_SET); - }else{ - Tcl_Seek(chan, 0, SEEK_END); - } - - /* Add new files to the end of the archive. - */ - for(i=2; rc==TCL_OK && i=tobjc) { - ext = NULL; - } + if (objc>3) { + zOpts = Tcl_GetStringFromObj(objv[1], &oLen); + if (!strncmp("-fconfigure", zOpts, oLen)) { + confOpts = objv[2]; + if (TCL_OK != Tcl_ListObjGetElements(interp, confOpts, + &tobjc, &tobjv) || (tobjc%2)) { + return TCL_ERROR; } + objc -= 2; + objv += 2; } - if (ext == NULL) { - if (( Tcl_SetChannelOption(interp, in, "-translation", "binary") - || Tcl_SetChannelOption(interp, in, "-encoding", "binary")) - ) { - /* this should never happen */ - Tcl_Close(0, in); - rc = TCL_ERROR; + } + if( objc==2) { + return TCL_OK; + } + + if( objc<3) { + Tcl_WrongNumArgs(interp, 1, objv, + "?-fconfigure OPTPAIRS? ARCHIVE FILE1 FILE2 .."); + return TCL_ERROR; + } + zArchive = Tcl_GetString(objv[1]); + chan = Tcl_OpenFileChannel(interp, zArchive, "r+", 0644); + if( chan==0 ) { + chan = Tcl_OpenFileChannel(interp, zArchive, "w+", 0644); + } + if( chan==0 ) return TCL_ERROR; + if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") + || Tcl_SetChannelOption(interp, chan, "-encoding", "binary")){ + /* this should never happen */ + Tcl_Close(0, chan); + return TCL_ERROR; + } + + if (Tcl_Seek(chan, 0, SEEK_END) == 0) { + /* Null file is ok, we're creating new one. */ + } else { + Tcl_Seek(chan, 0, SEEK_SET); + rc = ZvfsReadTOC(interp, chan, &pList); + if( rc==TCL_ERROR ){ + deleteZFileList(pList); + Tcl_Close(interp, chan); + return rc; + } + rc=TCL_OK; + } + + /* + * Move the file pointer to the start of the table of contents. + */ + + for(pToc=pList; pToc; pToc=pToc->pNext){ + if( pToc->isSpecial && strcmp(pToc->zName, "*TOC*")==0 ) { break; - } } - } else { - for (j=0; jiOffset, SEEK_SET); + }else{ + Tcl_Seek(chan, 0, SEEK_END); + } + + /* + * Add new files to the end of the archive. + */ + + for(i=2; rc==TCL_OK && i=tobjc) { + ext = NULL; + } + } + } + if (ext == NULL) { + if (Tcl_SetChannelOption(interp, in, "-translation", "binary") + || Tcl_SetChannelOption(interp, in, "-encoding", + "binary")) { + /* this should never happen */ + Tcl_Close(0, in); + rc = TCL_ERROR; + break; + } + } + } else { + for (j=0; j Date: Mon, 1 Sep 2014 13:51:59 +0000 Subject: Squelch most warnings. --- generic/tclZipVfs.c | 555 ++++++++++++++++++++++++++-------------------------- 1 file changed, 277 insertions(+), 278 deletions(-) diff --git a/generic/tclZipVfs.c b/generic/tclZipVfs.c index a774648..8b1fc3b 100755 --- a/generic/tclZipVfs.c +++ b/generic/tclZipVfs.c @@ -21,6 +21,7 @@ * This version has been modified to run under Tcl 8.6 */ #include "tcl.h" +#include #include #include #include @@ -36,8 +37,8 @@ * Size of the decompression input buffer */ #define COMPR_BUF_SIZE 8192 -static int maptolower=0; -static int openarch=0; /* Set to 1 when opening archive. */ +/*TODO: use thread-local as appropriate*/ +static int openarch = 0; /* Set to 1 when opening archive. */ /* * All static variables are collected into a structure named "local". That @@ -150,7 +151,7 @@ newZFile( int nName, ZFile **ppList) { - ZFile *pNew = Tcl_Alloc( sizeof(*pNew) + nName + 1 ); + ZFile *pNew = (void *) Tcl_Alloc(sizeof(*pNew) + nName + 1); memset(pNew, 0, sizeof(*pNew)); pNew->zName = (char*)&pNew[1]; @@ -263,51 +264,50 @@ CanonicalPath( int i, j, c; #ifdef __WIN32__ - if( isalpha(zTail[0]) && zTail[1]==':' ){ + if (isalpha(zTail[0]) && zTail[1] == ':') { zTail += 2; } - if( zTail[0]=='\\' ){ + if (zTail[0] == '\\') { zRoot = ""; zTail++; } #endif - if( zTail[0]=='/' ){ + if (zTail[0] == '/') { zRoot = ""; zTail++; } - zPath = Tcl_Alloc( strlen(zRoot) + strlen(zTail) + 2 ); - if( zPath==0 ) { - return 0; - } + zPath = Tcl_Alloc(strlen(zRoot) + strlen(zTail) + 2); if (zTail[0]) { sprintf(zPath, "%s/%s", zRoot, zTail); } else { strcpy(zPath, zRoot); } - for(i=j=0; (c = zPath[i])!=0; i++){ + for (i=j=0 ; (c = zPath[i]) != 0 ; i++) { #ifdef __WIN32__ - if( isupper(c) ) { + if (isupper(c)) { if (maptolower) { c = tolower(c); } - } else if( c=='\\' ) { + } else if (c == '\\') { c = '/'; } #endif - if( c=='/' ){ + if (c == '/') { int c2 = zPath[i+1]; - if( c2=='/' ) { + + if (c2 == '/') { continue; } - if( c2=='.' ){ + if (c2 == '.') { int c3 = zPath[i+2]; - if( c3=='/' || c3==0 ){ + + if (c3 == '/' || c3 == 0) { i++; continue; } - if( c3=='.' && (zPath[i+3]=='.' || zPath[i+3]==0) ){ + if (c3 == '.' && (zPath[i+3] == '.' || zPath[i+3] == 0)) { i += 2; - while( j>0 && zPath[j-1]!='/' ){ + while (j > 0 && zPath[j-1] != '/') { j--; } continue; @@ -316,7 +316,7 @@ CanonicalPath( } zPath[j++] = c; } - if( j==0 ){ + if (j == 0) { zPath[j++] = '/'; } /* if (j>1 && zPath[j-1] == '/') j--; */ @@ -340,19 +340,19 @@ AbsolutePath( if (zRelative[0] == '~' && zRelative[1] == '/') { /* TODO: do this for all paths??? */ if (Tcl_TranslateFileName(0, zRelative, &pwd) != NULL) { - zResult = CanonicalPath( "", Tcl_DStringValue(&pwd)); + zResult = CanonicalPath("", Tcl_DStringValue(&pwd)); goto done; } - } else if( zRelative[0] != '/'){ + } else if (zRelative[0] != '/') { #ifdef __WIN32__ - if(!(zRelative[0]=='\\' || (zRelative[0] && zRelative[1] == ':'))) { + if (!(zRelative[0]=='\\' || (zRelative[0] && zRelative[1] == ':'))) { /*Tcl_GetCwd(0, &pwd); */ } #else Tcl_GetCwd(0, &pwd); #endif } - zResult = CanonicalPath( Tcl_DStringValue(&pwd), zRelative); + zResult = CanonicalPath(Tcl_DStringValue(&pwd), zRelative); done: Tcl_DStringFree(&pwd); len = strlen(zResult); @@ -369,16 +369,10 @@ ZvfsReadTOCStart( ZFile **pList, int *iStart) { - char *zArchiveName = 0; /* A copy of zArchive */ int nFile; /* Number of files in the archive */ int iPos; /* Current position in the archive file */ - ZvfsArchive *pArchive; /* The ZIP archive being mounted */ - Tcl_HashEntry *pEntry; /* Hash table entry */ - int isNew; /* Flag to tell use when a hash entry is - * new */ unsigned char zBuf[100]; /* Space into which to read from the ZIP * archive */ - Tcl_HashSearch zSearch; /* Search all mount points */ ZFile *p; int zipStart; @@ -399,7 +393,7 @@ ZvfsReadTOCStart( */ iPos = Tcl_Seek(chan, -22, SEEK_END); - Tcl_Read(chan, zBuf, 22); + Tcl_Read(chan, (char *) zBuf, 22); if (memcmp(zBuf, "\120\113\05\06", 4)) { /* Tcl_AppendResult(interp, "not a ZIP archive", NULL); */ return TCL_BREAK; @@ -415,18 +409,12 @@ ZvfsReadTOCStart( iPos -= INT32(zBuf,12); Tcl_Seek(chan, iPos, SEEK_SET); - while(1) { + while (1) { int lenName; /* Length of the next filename */ int lenExtra; /* Length of "extra" data for next file */ int iData; /* Offset to start of file data */ - int dosTime; - int dosDate; - int isdir; - ZvfsFile *pZvfs; /* A new virtual file */ - char *zFullPath; /* Full pathname of the virtual file */ - char zName[1024]; /* Space to hold the filename */ - if (nFile-- <= 0 ){ + if (nFile-- <= 0) { break; } @@ -436,7 +424,7 @@ ZvfsReadTOCStart( * archive file of the file data. */ - Tcl_Read(chan, zBuf, 46); + Tcl_Read(chan, (char *) zBuf, 46); if (memcmp(zBuf, "\120\113\01\02", 4)) { Tcl_AppendResult(interp, "ill-formed central directory entry", NULL); @@ -445,7 +433,7 @@ ZvfsReadTOCStart( lenName = INT16(zBuf,28); lenExtra = INT16(zBuf,30) + INT16(zBuf,32); iData = INT32(zBuf,42); - if (iDatazName, lenName); p->zName[lenName] = 0; - if (lenName>0 && p->zName[lenName-1] == '/') { + if (lenName > 0 && p->zName[lenName-1] == '/') { p->isSpecial = 1; } p->dosDate = INT16(zBuf, 14); @@ -489,7 +477,7 @@ ZvfsReadTOC( { int iStart; - return ZvfsReadTOCStart( interp, chan, pList, &iStart); + return ZvfsReadTOCStart(interp, chan, pList, &iStart); } /* @@ -517,7 +505,7 @@ Tcl_Zvfs_Mount( Tcl_HashSearch zSearch; /* Search all mount points */ unsigned int startZip; - if( !local.isInit ) { + if (!local.isInit) { return TCL_ERROR; } @@ -529,13 +517,14 @@ Tcl_Zvfs_Mount( Tcl_DString dStr; Tcl_DStringInit(&dStr); - pEntry=Tcl_FirstHashEntry(&local.archiveHash,&zSearch); + pEntry = Tcl_FirstHashEntry(&local.archiveHash,&zSearch); while (pEntry) { - if (pArchive = Tcl_GetHashValue(pEntry)) { + pArchive = Tcl_GetHashValue(pEntry); + if (pArchive) { Tcl_DStringAppendElement(&dStr, pArchive->zName); Tcl_DStringAppendElement(&dStr, pArchive->zMountPoint); } - pEntry=Tcl_NextHashEntry(&zSearch); + pEntry = Tcl_NextHashEntry(&zSearch); } Tcl_DStringResult(interp, &dStr); return TCL_OK; @@ -547,10 +536,11 @@ Tcl_Zvfs_Mount( /*TODO: cleanup allocations of Absolute() path.*/ if (!zMountPoint) { - zTrueName=AbsolutePath(zArchive); - pEntry = Tcl_FindHashEntry(&local.archiveHash,zTrueName); + zTrueName = AbsolutePath(zArchive); + pEntry = Tcl_FindHashEntry(&local.archiveHash, zTrueName); if (pEntry) { - if (pArchive = Tcl_GetHashValue(pEntry)) { + pArchive = Tcl_GetHashValue(pEntry); + if (pArchive) { Tcl_AppendResult(interp, pArchive->zMountPoint, 0); } } @@ -574,7 +564,7 @@ Tcl_Zvfs_Mount( */ iPos = Tcl_Seek(chan, -22, SEEK_END); - Tcl_Read(chan, zBuf, 22); + Tcl_Read(chan, (char *) zBuf, 22); if (memcmp(zBuf, "\120\113\05\06", 4)) { Tcl_AppendResult(interp, "not a ZIP archive", NULL); return TCL_ERROR; @@ -586,7 +576,7 @@ Tcl_Zvfs_Mount( zArchiveName = AbsolutePath(zArchive); pEntry = Tcl_CreateHashEntry(&local.archiveHash, zArchiveName, &isNew); - if( !isNew ){ + if (!isNew) { pArchive = Tcl_GetHashValue(pEntry); Tcl_AppendResult(interp, "already mounted at ", pArchive->zMountPoint, 0); @@ -603,9 +593,9 @@ Tcl_Zvfs_Mount( zMountPoint = zTrueName = AbsolutePath(zArchive); } - pArchive = Tcl_Alloc(sizeof(*pArchive) + strlen(zMountPoint)+1); + pArchive = (void *) Tcl_Alloc(sizeof(*pArchive) + strlen(zMountPoint)+1); pArchive->zName = zArchiveName; - pArchive->zMountPoint = (char*)&pArchive[1]; + pArchive->zMountPoint = (char *) &pArchive[1]; strcpy(pArchive->zMountPoint, zMountPoint); pArchive->pFiles = 0; Tcl_SetHashValue(pEntry, pArchive); @@ -615,12 +605,12 @@ Tcl_Zvfs_Mount( * iPos then seek to that location. */ - nFile = INT16(zBuf,8); - iPos -= INT32(zBuf,12); + nFile = INT16(zBuf, 8); + iPos -= INT32(zBuf, 12); Tcl_Seek(chan, iPos, SEEK_SET); startZip = iPos; - while(1) { + while (1) { int lenName; /* Length of the next filename */ int lenExtra; /* Length of "extra" data for next file */ int iData; /* Offset to start of file data */ @@ -631,7 +621,7 @@ Tcl_Zvfs_Mount( char *zFullPath; /* Full pathname of the virtual file */ char zName[1024]; /* Space to hold the filename */ - if (nFile-- <= 0 ){ + if (nFile-- <= 0) { isdir = 1; zFullPath = CanonicalPath(zMountPoint, ""); iData = startZip; @@ -644,7 +634,7 @@ Tcl_Zvfs_Mount( * archive file of the file data. */ - Tcl_Read(chan, zBuf, 46); + Tcl_Read(chan, (char *) zBuf, 46); if (memcmp(zBuf, "\120\113\01\02", 4)) { Tcl_AppendResult(interp, "ill-formed central directory entry", NULL); @@ -653,16 +643,16 @@ Tcl_Zvfs_Mount( } return TCL_ERROR; } - lenName = INT16(zBuf,28); - lenExtra = INT16(zBuf,30) + INT16(zBuf,32); - iData = INT32(zBuf,42); + lenName = INT16(zBuf, 28); + lenExtra = INT16(zBuf, 30) + INT16(zBuf, 32); + iData = INT32(zBuf, 42); /* * If the virtual filename is too big to fit in zName[], then skip * this file */ - if( lenName >= sizeof(zName) ){ + if (lenName >= sizeof(zName)) { Tcl_Seek(chan, lenName + lenExtra, SEEK_CUR); continue; } @@ -672,21 +662,21 @@ Tcl_Zvfs_Mount( */ Tcl_Read(chan, zName, lenName); - isdir=0; - if (lenName>0 && zName[lenName-1] == '/') { + isdir = 0; + if (lenName > 0 && zName[lenName-1] == '/') { lenName--; - isdir=2; + isdir = 2; } zName[lenName] = 0; zFullPath = CanonicalPath(zMountPoint, zName); addentry: - pZvfs = (ZvfsFile*)Tcl_Alloc( sizeof(*pZvfs) ); + pZvfs = (void *) Tcl_Alloc(sizeof(*pZvfs)); pZvfs->zName = zFullPath; pZvfs->pArchive = pArchive; pZvfs->isdir = isdir; - pZvfs->depth=strchrcnt(zFullPath,'/'); + pZvfs->depth = strchrcnt(zFullPath, '/'); pZvfs->iOffset = iData; - if (iDatanByte = INT32(zBuf, 24); pZvfs->nByteCompr = INT32(zBuf, 20); pZvfs->pNext = pArchive->pFiles; - pZvfs->permissions = (0xffff&(INT32(zBuf, 38) >> 16)); + pZvfs->permissions = 0xffff & (INT32(zBuf, 38) >> 16); pArchive->pFiles = pZvfs; pEntry = Tcl_CreateHashEntry(&local.fileHash, zFullPath, &isNew); - if( isNew ){ + if (isNew) { pZvfs->pNextName = 0; } else { ZvfsFile *pOld = Tcl_GetHashValue(pEntry); @@ -721,7 +711,7 @@ Tcl_Zvfs_Mount( Tcl_Seek(chan, lenExtra, SEEK_CUR); } Tcl_Close(interp, chan); - done: + if (zTrueName) { Tcl_Free(zTrueName); } @@ -740,7 +730,7 @@ ZvfsLookup( Tcl_HashEntry *pEntry; ZvfsFile *pFile; - if( local.isInit==0 ) { + if (local.isInit == 0) { return 0; } zTrueName = AbsolutePath(zFilename); @@ -760,19 +750,20 @@ ZvfsLookupMount( ZvfsArchive *pArchive; /* The ZIP archive being mounted */ int match=0; - if( local.isInit==0 ) { + if (local.isInit == 0) { return 0; } zTrueName = AbsolutePath(zFilename); - pEntry=Tcl_FirstHashEntry(&local.archiveHash,&zSearch); + pEntry = Tcl_FirstHashEntry(&local.archiveHash, &zSearch); while (pEntry) { - if (pArchive = Tcl_GetHashValue(pEntry)) { - if (!strcmp(pArchive->zMountPoint,zTrueName)) { - match=1; + pArchive = Tcl_GetHashValue(pEntry); + if (pArchive) { + if (!strcmp(pArchive->zMountPoint, zTrueName)) { + match = 1; break; } } - pEntry=Tcl_NextHashEntry(&zSearch); + pEntry = Tcl_NextHashEntry(&zSearch); } Tcl_Free(zTrueName); return match; @@ -793,31 +784,31 @@ Tcl_Zvfs_Umount( zArchiveName = AbsolutePath(zArchive); pEntry = Tcl_FindHashEntry(&local.archiveHash, zArchiveName); Tcl_Free(zArchiveName); - if( pEntry==0 ) { + if (pEntry == 0) { return 0; } pArchive = Tcl_GetHashValue(pEntry); Tcl_DeleteHashEntry(pEntry); Tcl_Free(pArchive->zName); - for(pFile=pArchive->pFiles; pFile; pFile=pNextFile){ + for(pFile=pArchive->pFiles ; pFile; pFile=pNextFile) { pNextFile = pFile->pNext; - if( pFile->pNextName ){ + if (pFile->pNextName) { pFile->pNextName->pPrevName = pFile->pPrevName; } - if( pFile->pPrevName ){ + if (pFile->pPrevName) { pFile->pPrevName->pNextName = pFile->pNextName; - }else{ + } else { pEntry = Tcl_FindHashEntry(&local.fileHash, pFile->zName); - if( pEntry==0 ){ + if (pEntry == 0) { Tcl_Panic("This should never happen"); - }else if( pFile->pNextName ){ + } else if (pFile->pNextName) { Tcl_SetHashValue(pEntry, pFile->pNextName); - }else{ + } else { Tcl_DeleteHashEntry(pEntry); } } Tcl_Free(pFile->zName); - Tcl_Free((char*)pFile); + Tcl_Free((void *) pFile); } return 1; } @@ -848,12 +839,12 @@ ZvfsMountCmd( const char *argv[]) /* Values of all arguments */ { /*TODO: Convert to Tcl_Obj API!*/ - if( argc>3 ){ + if (argc > 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " ? ZIP-FILE ? MOUNT-POINT ? ?\"", 0); return TCL_ERROR; } - return Tcl_Zvfs_Mount(interp, argc>1?argv[1]:0, argc>2?argv[2]:0); + return Tcl_Zvfs_Mount(interp, argc>1?argv[1]:NULL, argc>2?argv[2]:NULL); } /* @@ -872,7 +863,7 @@ ZvfsUnmountCmd( Tcl_HashEntry *pEntry; /* Hash table entry */ Tcl_HashSearch zSearch; /* Search all mount points */ - if( argc!=2 ){ + if (argc != 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " ZIP-FILE\"", 0); return TCL_ERROR; @@ -881,23 +872,24 @@ ZvfsUnmountCmd( return TCL_OK; } - if( !local.isInit ) { + if (!local.isInit) { return TCL_ERROR; } - pEntry=Tcl_FirstHashEntry(&local.archiveHash,&zSearch); + pEntry = Tcl_FirstHashEntry(&local.archiveHash,&zSearch); while (pEntry) { - if (((pArchive = Tcl_GetHashValue(pEntry))) - && pArchive->zMountPoint[0] + pArchive = Tcl_GetHashValue(pEntry); + if (pArchive && pArchive->zMountPoint[0] && (strcmp(pArchive->zMountPoint, argv[1]) == 0)) { if (Tcl_Zvfs_Umount(pArchive->zName)) { return TCL_OK; } break; } - pEntry=Tcl_NextHashEntry(&zSearch); + pEntry = Tcl_NextHashEntry(&zSearch); } - Tcl_AppendResult(interp, "unknown zvfs mount point or file: ", argv[1], 0); + Tcl_AppendResult(interp, "unknown zvfs mount point or file: ", argv[1], + NULL); return TCL_ERROR; } @@ -916,12 +908,12 @@ ZvfsExistsObjCmd( { char *zFilename; - if( objc!=2 ){ + if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "FILENAME"); return TCL_ERROR; } zFilename = Tcl_GetString(objv[1]); - Tcl_SetBooleanObj( Tcl_GetObjResult(interp), ZvfsLookup(zFilename)!=0); + Tcl_SetBooleanObj(Tcl_GetObjResult(interp), ZvfsLookup(zFilename)!=0); return TCL_OK; } @@ -946,13 +938,13 @@ ZvfsInfoObjCmd( char *zFilename; ZvfsFile *pFile; - if( objc!=2 ){ + if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "FILENAME"); return TCL_ERROR; } zFilename = Tcl_GetString(objv[1]); pFile = ZvfsLookup(zFilename); - if( pFile ){ + if (pFile) { Tcl_Obj *pResult = Tcl_GetObjResult(interp); Tcl_ListObjAppendElement(interp, pResult, @@ -986,55 +978,60 @@ ZvfsListObjCmd( Tcl_HashSearch sSearch; Tcl_Obj *pResult = Tcl_GetObjResult(interp); - if( objc>3 ){ + if (objc > 3) { Tcl_WrongNumArgs(interp, 1, objv, "?(-glob|-regexp)? ?PATTERN?"); return TCL_ERROR; } - if( local.isInit==0 ) { + if (local.isInit == 0) { return TCL_OK; } - if( objc==3 ){ + if (objc == 3) { int n; char *zSwitch = Tcl_GetStringFromObj(objv[1], &n); - if( n>=2 && strncmp(zSwitch,"-glob",n)==0 ){ + if (n >= 2 && strncmp(zSwitch,"-glob",n) == 0) { zPattern = Tcl_GetString(objv[2]); - }else if( n>=2 && strncmp(zSwitch,"-regexp",n)==0 ){ + } else if (n >= 2 && strncmp(zSwitch,"-regexp",n) == 0) { pRegexp = Tcl_RegExpCompile(interp, Tcl_GetString(objv[2])); - if( pRegexp==0 ) { + if (pRegexp == 0) { return TCL_ERROR; } - }else{ + } else { Tcl_AppendResult(interp, "unknown option: ", zSwitch, 0); return TCL_ERROR; } - } else if( objc==2 ){ + } else if (objc == 2) { zPattern = Tcl_GetString(objv[1]); } - if( zPattern ){ - for(pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); + + /* + * Do the listing. + */ + + if (zPattern) { + for (pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); pEntry; pEntry = Tcl_NextHashEntry(&sSearch)){ ZvfsFile *pFile = Tcl_GetHashValue(pEntry); char *z = pFile->zName; - if( Tcl_StringCaseMatch(z, zPattern,1) ){ + if (Tcl_StringCaseMatch(z, zPattern, 1)) { Tcl_ListObjAppendElement(interp, pResult, Tcl_NewStringObj(z, -1)); } } - }else if( pRegexp ){ + } else if (pRegexp) { for(pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); pEntry; pEntry = Tcl_NextHashEntry(&sSearch)){ ZvfsFile *pFile = Tcl_GetHashValue(pEntry); char *z = pFile->zName; - if( Tcl_RegExpExec(interp, pRegexp, z, z) ){ + if (Tcl_RegExpExec(interp, pRegexp, z, z)) { Tcl_ListObjAppendElement(interp, pResult, Tcl_NewStringObj(z, -1)); } } - }else{ - for(pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); + } else { + for (pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); pEntry; pEntry = Tcl_NextHashEntry(&sSearch)){ ZvfsFile *pFile = Tcl_GetHashValue(pEntry); char *z = pFile->zName; @@ -1091,15 +1088,15 @@ vfsClose( { ZvfsChannelInfo* pInfo = instanceData; - if( pInfo->zBuf ){ - Tcl_Free(pInfo->zBuf); + if (pInfo->zBuf) { + Tcl_Free((void *) pInfo->zBuf); inflateEnd(&pInfo->stream); } - if( pInfo->chan ){ + if (pInfo->chan) { Tcl_Close(interp, pInfo->chan); Tcl_DeleteExitHandler(vfsExit, pInfo); } - Tcl_Free((char*)pInfo); + Tcl_Free((void *) pInfo); return TCL_OK; } @@ -1116,17 +1113,17 @@ vfsInput( { ZvfsChannelInfo* pInfo = instanceData; - if( toRead > pInfo->nByte ){ + if (toRead > pInfo->nByte) { toRead = pInfo->nByte; } - if( toRead == 0 ){ + if (toRead == 0) { return 0; } - if( pInfo->isCompressed ){ + if (pInfo->isCompressed) { int err = Z_OK; z_stream *stream = &pInfo->stream; - stream->next_out = buf; + stream->next_out = (unsigned char *) buf; stream->avail_out = toRead; while (stream->avail_out) { if (!stream->avail_in) { @@ -1135,7 +1132,7 @@ vfsInput( if (len > COMPR_BUF_SIZE) { len = COMPR_BUF_SIZE; } - len = Tcl_Read(pInfo->chan, pInfo->zBuf, len); + len = Tcl_Read(pInfo->chan, (char *) pInfo->zBuf, len); pInfo->nByteCompr -= len; stream->next_in = pInfo->zBuf; stream->avail_in = len; @@ -1146,15 +1143,15 @@ vfsInput( } } if (err == Z_STREAM_END) { - if ((stream->avail_out != 0)) { + if (stream->avail_out != 0) { *pErrorCode = err; /* premature end */ return -1; } - }else if( err ){ + }else if (err) { *pErrorCode = err; /* some other zlib error */ return -1; } - }else{ + } else { toRead = Tcl_Read(pInfo->chan, buf, toRead); } pInfo->nByte -= toRead; @@ -1190,7 +1187,7 @@ vfsSeek( { ZvfsChannelInfo* pInfo = instanceData; - switch( mode ){ + switch (mode) { case SEEK_CUR: offset += pInfo->readSoFar; break; @@ -1204,12 +1201,12 @@ vfsSeek( if (offset < 0) { offset = 0; } - if( !pInfo->isCompressed ){ + if (!pInfo->isCompressed) { Tcl_Seek(pInfo->chan, offset + pInfo->startOfData, SEEK_SET); pInfo->nByte = pInfo->nData; pInfo->readSoFar = offset; - }else{ - if( offsetreadSoFar ){ + } else { + if (offset < pInfo->readSoFar) { z_stream *stream = &pInfo->stream; inflateEnd(stream); @@ -1226,12 +1223,12 @@ vfsSeek( pInfo->nByteCompr = pInfo->nData; pInfo->readSoFar = 0; } - while( pInfo->readSoFar < offset ){ + while (pInfo->readSoFar < offset) { int toRead, errCode; char zDiscard[100]; toRead = offset - pInfo->readSoFar; - if( toRead>sizeof(zDiscard) ) { + if (toRead > sizeof(zDiscard)) { toRead = sizeof(zDiscard); } vfsInput(instanceData, zDiscard, toRead, &errCode); @@ -1303,13 +1300,13 @@ ZvfsFileOpen( unsigned char zBuf[50]; pFile = ZvfsLookup(zFilename); - if( pFile==0 ) { + if (pFile == 0) { return NULL; } - openarch=1; + openarch = 1; chan = Tcl_OpenFileChannel(interp, pFile->pArchive->zName, "r", 0); - openarch=0; - if( chan==0 ){ + openarch = 0; + if (chan == 0) { return 0; } if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") @@ -1319,41 +1316,40 @@ ZvfsFileOpen( return 0; } Tcl_Seek(chan, pFile->iOffset, SEEK_SET); - Tcl_Read(chan, zBuf, 30); - if( memcmp(zBuf, "\120\113\03\04", 4) ){ - if( interp ){ + Tcl_Read(chan, (char *) zBuf, 30); + if (memcmp(zBuf, "\120\113\03\04", 4)) { + if (interp) { Tcl_AppendResult(interp, "local header mismatch: ", NULL); } Tcl_Close(interp, chan); return 0; } - pInfo = Tcl_Alloc( sizeof(*pInfo) ); + pInfo = (void *) Tcl_Alloc(sizeof(*pInfo)); pInfo->chan = chan; Tcl_CreateExitHandler(vfsExit, pInfo); pInfo->isCompressed = INT16(zBuf, 8); - if( pInfo->isCompressed ){ + if (pInfo->isCompressed) { z_stream *stream = &pInfo->stream; - pInfo->zBuf = Tcl_Alloc(COMPR_BUF_SIZE); - stream->zalloc = (alloc_func)0; - stream->zfree = (free_func)0; - stream->opaque = (voidpf)0; + pInfo->zBuf = (void *) Tcl_Alloc(COMPR_BUF_SIZE); + stream->zalloc = NULL; + stream->zfree = NULL; + stream->opaque = NULL; stream->avail_in = 2; stream->next_in = pInfo->zBuf; pInfo->zBuf[0] = 0x78; pInfo->zBuf[1] = 0x01; inflateInit(&pInfo->stream); - }else{ + } else { pInfo->zBuf = 0; } - pInfo->nByte = INT32(zBuf,22); - pInfo->nByteCompr = pInfo->nData = INT32(zBuf,18); + pInfo->nByte = INT32(zBuf, 22); + pInfo->nByteCompr = pInfo->nData = INT32(zBuf, 18); pInfo->readSoFar = 0; - Tcl_Seek(chan, INT16(zBuf,26)+INT16(zBuf,28), SEEK_CUR); + Tcl_Seek(chan, INT16(zBuf, 26) + INT16(zBuf, 28), SEEK_CUR); pInfo->startOfData = Tcl_Tell(chan); - sprintf(zName,"vfs_%x_%x",((int)pFile)>>12,count++); - chan = Tcl_CreateChannel(&vfsChannelType, zName, - (ClientData)pInfo, TCL_READABLE); + sprintf(zName, "vfs_%lx_%x", ((ptrdiff_t)pFile)>>12, count++); + chan = Tcl_CreateChannel(&vfsChannelType, zName, pInfo, TCL_READABLE); return chan; } @@ -1368,7 +1364,7 @@ ZvfsFileStat( ZvfsFile *pFile; pFile = ZvfsLookup(path); - if( pFile==0 ){ + if (pFile == 0) { return -1; } memset(buf, 0, sizeof(*buf)); @@ -1395,11 +1391,11 @@ ZvfsFileAccess( { ZvfsFile *pFile; - if( mode & 3 ){ + if (mode & 3) { return -1; } pFile = ZvfsLookup(path); - if( pFile==0 ){ + if (pFile == 0) { return -1; } return 0; @@ -1449,6 +1445,7 @@ Tobe_FSOpenFileChannelProc( { static int inopen=0; Tcl_Channel chan; + if (inopen) { puts("recursive zvfs open"); return NULL; @@ -1508,28 +1505,29 @@ Tobe_FSMatchInDirectoryProc( return TCL_ERROR; } if (pattern != NULL) { - l=strlen(pattern); + l = strlen(pattern); if (!zp) { - zPattern=strdup(pattern); + zPattern = Tcl_Alloc(len + 1); + memcpy(zPattern, pattern, len + 1); } else { - zPattern=(char*)malloc(len+l+3); - sprintf(zPattern,"%s%s%s", zp, zp[len-1]=='/'?"":"/",pattern); + zPattern = Tcl_Alloc(len + l + 3); + sprintf(zPattern, "%s%s%s", zp, zp[len-1]=='/'?"":"/", pattern); } - scnt=strchrcnt(zPattern,'/'); + scnt = strchrcnt(zPattern, '/'); } dirglob = (types && types->type && (types->type&TCL_GLOB_TYPE_DIR)); dirmnt = (types && types->type && (types->type&TCL_GLOB_TYPE_MOUNT)); if (strcmp(zp, "/") == 0 && strcmp(zPattern, ".*") == 0) { /*TODO: What goes here?*/ } - for(pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); + for (pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); pEntry; pEntry = Tcl_NextHashEntry(&sSearch)){ ZvfsFile *pFile = Tcl_GetHashValue(pEntry); char *z = pFile->zName; if (zPattern != NULL) { - if( Tcl_StringCaseMatch(z, zPattern, 0) == 0 || - (scnt!=pFile->depth /* && !dirglob */ )) { // TODO: ??? + if (Tcl_StringCaseMatch(z, zPattern, 0) == 0 || + (scnt != pFile->depth /* && !dirglob */)) { // TODO: ??? continue; } } else { @@ -1545,7 +1543,7 @@ Tobe_FSMatchInDirectoryProc( if (!pFile->isdir) { continue; } - } else if (types && !(types->type&TCL_GLOB_TYPE_DIR)) { + } else if (types && !(types->type & TCL_GLOB_TYPE_DIR)) { if (pFile->isdir) { continue; } @@ -1553,7 +1551,7 @@ Tobe_FSMatchInDirectoryProc( Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(z, -1)); } if (zPattern) { - free(zPattern); + Tcl_Free(zPattern); } return TCL_OK; } @@ -1568,7 +1566,7 @@ Tobe_FSPathInFilesystemProc( ClientData *clientDataPtr) { ZvfsFile *zFile; - char *path=Tcl_GetString(pathPtr); + char *path = Tcl_GetString(pathPtr); // if (ZvfsLookupMount(path)!=0) // return TCL_OK; @@ -1577,7 +1575,7 @@ Tobe_FSPathInFilesystemProc( return -1; } zFile = ZvfsLookup(path); - if (zFile!=NULL && strcmp(path,zFile->pArchive->zName)) { + if (zFile != NULL && strcmp(path, zFile->pArchive->zName)) { return TCL_OK; } return -1; @@ -1589,21 +1587,20 @@ Tobe_FSListVolumesProc(void) Tcl_HashEntry *pEntry; /* Hash table entry */ Tcl_HashSearch zSearch; /* Search all mount points */ ZvfsArchive *pArchive; /* The ZIP archive being mounted */ - Tcl_Obj *pVols=NULL, *pVol; + Tcl_Obj *pVols = NULL, *pVol; - pEntry=Tcl_FirstHashEntry(&local.archiveHash,&zSearch); + pEntry = Tcl_FirstHashEntry(&local.archiveHash,&zSearch); while (pEntry) { - if (pArchive = Tcl_GetHashValue(pEntry)) { + pArchive = Tcl_GetHashValue(pEntry); + if (pArchive) { if (!pVols) { - pVols=Tcl_NewListObj(0,0); + pVols = Tcl_NewListObj(0, 0); Tcl_IncrRefCount(pVols); } - pVol=Tcl_NewStringObj(pArchive->zMountPoint,-1); - Tcl_IncrRefCount(pVol); - Tcl_ListObjAppendElement(NULL, pVols,pVol); - Tcl_DecrRefCount(pVol); + pVol = Tcl_NewStringObj(pArchive->zMountPoint, -1); + Tcl_ListObjAppendElement(NULL, pVols, pVol); } - pEntry=Tcl_NextHashEntry(&zSearch); + pEntry = Tcl_NextHashEntry(&zSearch); } return pVols; } @@ -1616,20 +1613,22 @@ Tobe_FSChdirProc( return TCL_OK; } -const char ** +const char * const* Tobe_FSFileAttrStringsProc( Tcl_Obj *pathPtr, Tcl_Obj** objPtrRef) { - Tcl_Obj *listPtr; - Tcl_Interp *interp = NULL; - char *path=Tcl_GetString(pathPtr); + char *path = Tcl_GetString(pathPtr); #ifdef __WIN32__ - static CONST char *attrs[] = { "-archive", "-hidden", "-readonly", "-system", "-shortname", 0 }; + static const char *attrs[] = { + "-archive", "-hidden", "-readonly", "-system", "-shortname", 0 + }; #else - static CONST char *attrs[] = { "-group", "-owner", "-permissions", 0 }; + static const char *attrs[] = { + "-group", "-owner", "-permissions", 0 + }; #endif - if (ZvfsLookup(path)==0) { + if (ZvfsLookup(path) == 0) { return NULL; } return attrs; @@ -1642,12 +1641,13 @@ Tobe_FSFileAttrsGetProc( Tcl_Obj *pathPtr, Tcl_Obj **objPtrRef) { - char *path=Tcl_GetString(pathPtr); + char *path = Tcl_GetString(pathPtr); char buf[50]; - ZvfsFile *zFile; + ZvfsFile *zFile = ZvfsLookup(path); - if ((zFile = ZvfsLookup(path))==0) + if (zFile == 0) { return TCL_ERROR; + } switch (index) { #ifdef __WIN32__ @@ -1884,11 +1884,11 @@ static Tcl_Filesystem Tobe_Filesystem = { ////////////////////////////////////////////////////////////// -void (*Zvfs_PostInit)(Tcl_Interp *)=0; -static int ZvfsAppendObjCmd( void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); -static int ZvfsAddObjCmd( void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); -static int ZvfsDumpObjCmd( void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); -static int ZvfsStartObjCmd( void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); +void (*Zvfs_PostInit)(Tcl_Interp *) = 0; +static int ZvfsAppendObjCmd(void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); +static int ZvfsAddObjCmd(void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); +static int ZvfsDumpObjCmd(void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); +static int ZvfsStartObjCmd(void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); /* * Initialize the ZVFS system. @@ -1900,7 +1900,7 @@ Zvfs_doInit( { int n; #ifdef USE_TCL_STUBS - if( Tcl_InitStubs(interp,"8.0",0)==0 ){ + if (Tcl_InitStubs(interp, "8.0", 0) == 0) { return TCL_ERROR; } #endif @@ -1916,12 +1916,13 @@ Zvfs_doInit( Tcl_CreateObjCommand(interp, "zvfs::list", ZvfsListObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "zvfs::dump", ZvfsDumpObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "zvfs::start", ZvfsStartObjCmd, 0, 0); - Tcl_SetVar(interp, "::zvfs::auto_ext", ".tcl .tk .itcl .htcl .txt .c .h .tht", TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "::zvfs::auto_ext", + ".tcl .tk .itcl .htcl .txt .c .h .tht", TCL_GLOBAL_ONLY); /* Tcl_CreateObjCommand(interp, "zip::open", ZipOpenObjCmd, 0, 0); */ #ifndef USE_TCL_VFS Tcl_GlobalEval(interp, zFileCopy); #endif - if( !local.isInit ){ + if (!local.isInit) { /* One-time initialization of the ZVFS */ #ifdef USE_TCL_VFS n = Tcl_FSRegister(0, &Tobe_Filesystem); @@ -1948,14 +1949,14 @@ int Tcl_Zvfs_Init( Tcl_Interp *interp) { - return Zvfs_doInit(interp,0); + return Zvfs_doInit(interp, 0); } int Tcl_Zvfs_SafeInit( Tcl_Interp *interp) { - return Zvfs_doInit(interp,1); + return Zvfs_doInit(interp, 1); } /************************************************************************/ @@ -1984,23 +1985,23 @@ ZvfsDumpObjCmd( int rc; Tcl_Obj *pResult; - if( objc!=2 ){ + if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "FILENAME"); return TCL_ERROR; } zFilename = Tcl_GetString(objv[1]); chan = Tcl_OpenFileChannel(interp, zFilename, "r", 0); - if( chan==0 ) { + if (chan == 0) { return TCL_ERROR; } rc = ZvfsReadTOC(interp, chan, &pList); - if( rc==TCL_ERROR ){ + if (rc == TCL_ERROR) { deleteZFileList(pList); return rc; } Tcl_Close(interp, chan); pResult = Tcl_GetObjResult(interp); - while( pList ){ + while (pList) { Tcl_Obj *pEntry = Tcl_NewObj(); ZFile *pNext; char zDateTime[100]; @@ -2019,7 +2020,7 @@ ZvfsDumpObjCmd( Tcl_NewIntObj(pList->nByteCompr)); Tcl_ListObjAppendElement(interp, pResult, pEntry); pNext = pList->pNext; - Tcl_Free((char*)pList); + Tcl_Free((void *) pList); pList = pList->pNext; } return TCL_OK; @@ -2062,7 +2063,7 @@ writeFile( strcpy(p->zName, zDest); p->isSpecial = 0; Tcl_Stat(zSrc, &stat); - now=stat.st_mtime; + now = stat.st_mtime; tm = localtime(&now); UnixTimeDate(tm, &p->dosDate, &p->dosTime); p->iOffset = Tcl_Tell(out); @@ -2104,13 +2105,13 @@ writeFile( * Write the compressed file. Compute the CRC as we progress. */ - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; + stream.zalloc = NULL; + stream.zfree = NULL; stream.opaque = 0; stream.avail_in = 0; - stream.next_in = zInBuf; + stream.next_in = (unsigned char *) zInBuf; stream.avail_out = sizeof(zOutBuf); - stream.next_out = zOutBuf; + stream.next_out = (unsigned char *) zOutBuf; #if 1 deflateInit(&stream, 9); #else @@ -2123,40 +2124,42 @@ writeFile( #endif p->iCRC = crc32(0, 0, 0); - while( !Tcl_Eof(in) ){ - if( stream.avail_in==0 ){ + while (!Tcl_Eof(in)) { + if (stream.avail_in == 0) { int amt = Tcl_Read(in, zInBuf, sizeof(zInBuf)); - if( amt<=0 ) { + if (amt <= 0) { break; } - p->iCRC = crc32(p->iCRC, zInBuf, amt); + p->iCRC = crc32(p->iCRC, (unsigned char *) zInBuf, amt); stream.avail_in = amt; - stream.next_in = zInBuf; + stream.next_in = (unsigned char *) zInBuf; } deflate(&stream, 0); toOut = sizeof(zOutBuf) - stream.avail_out; - if( toOut>skip ){ + if (toOut > skip) { Tcl_Write(out, &zOutBuf[skip], toOut - skip); skip = 0; - }else{ + } else { skip -= toOut; } stream.avail_out = sizeof(zOutBuf); - stream.next_out = zOutBuf; + stream.next_out = (unsigned char *) zOutBuf; } + do{ stream.avail_out = sizeof(zOutBuf); - stream.next_out = zOutBuf; + stream.next_out = (unsigned char *) zOutBuf; deflate(&stream, Z_FINISH); toOut = sizeof(zOutBuf) - stream.avail_out; - if( toOut>skip ){ + if (toOut > skip) { Tcl_Write(out, &zOutBuf[skip], toOut - skip); skip = 0; - }else{ + } else { skip -= toOut; } - }while( stream.avail_out==0 ); + } while (stream.avail_out == 0); + p->nByte = stream.total_in; p->nByteCompr = stream.total_out - 2; deflateEnd(&stream); @@ -2199,24 +2202,24 @@ mergeZFiles( ZFile *pTail; pTail = &fakeHead; - while( pLeft && pRight ){ + while (pLeft && pRight) { ZFile *p; - if( pLeft->iOffset <= pRight->iOffset ){ + if (pLeft->iOffset <= pRight->iOffset) { p = pLeft; pLeft = p->pNext; - }else{ + } else { p = pRight; pRight = p->pNext; } pTail->pNext = p; pTail = p; } - if( pLeft ){ + if (pLeft) { pTail->pNext = pLeft; - }else if( pRight ){ + } else if (pRight) { pTail->pNext = pRight; - }else{ + } else { pTail->pNext = 0; } return fakeHead.pNext; @@ -2234,22 +2237,22 @@ sortZFiles( ZFile *p; ZFile *aBin[NBIN+1]; - for(i=0; i<=NBIN; i++) { + for (i=0; i<=NBIN; i++) { aBin[i] = 0; } - while( pList ){ + while (pList) { p = pList; pList = p->pNext; p->pNext = 0; - for(i=0; ipNext){ - if( pList->isSpecial ) { + for (; pList; pList=pList->pNext) { + if (pList->isSpecial) { continue; } put32(&zBuf[0], 0x02014b50); @@ -2294,7 +2297,7 @@ writeTOC( put32(&zBuf[42], pList->iOffset); Tcl_Write(chan, zBuf, 46); Tcl_Write(chan, pList->zName, strlen(pList->zName)); - for(i=pList->nExtra; i>0; i-=40){ + for (i=pList->nExtra; i>0; i-=40) { int toWrite = i<40 ? i : 40; /* CAREFUL! String below is intentionally 40 spaces! */ @@ -2347,20 +2350,20 @@ ZvfsAppendObjCmd( * Open the archive and read the table of contents */ - if( objc<2 || (objc&1)!=0 ){ + if (objc<2 || (objc&1)!=0) { Tcl_WrongNumArgs(interp, 1, objv, "ARCHIVE (SRC DEST)+"); return TCL_ERROR; } zArchive = Tcl_GetString(objv[1]); chan = Tcl_OpenFileChannel(interp, zArchive, "r+", 0644); - if( chan==0 ) { + if (chan == 0) { chan = Tcl_OpenFileChannel(interp, zArchive, "w+", 0644); - if( chan==0 ) { + if (chan == 0) { return TCL_ERROR; } } - if(Tcl_SetChannelOption(interp, chan, "-translation", "binary") + if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") || Tcl_SetChannelOption(interp, chan, "-encoding", "binary")){ /* this should never happen */ Tcl_Close(0, chan); @@ -2371,27 +2374,25 @@ ZvfsAppendObjCmd( /* Null file is ok, we're creating new one. */ } else { Tcl_Seek(chan, 0, SEEK_SET); - rc = ZvfsReadTOC(interp, chan, &pList); - if( rc==TCL_ERROR ){ + if (ZvfsReadTOC(interp, chan, &pList) == TCL_ERROR) { deleteZFileList(pList); Tcl_Close(interp, chan); - return rc; - } else { - rc=TCL_OK; + return TCL_ERROR; } + rc = TCL_OK; } /* * Move the file pointer to the start of the table of contents. */ - for(pToc=pList; pToc; pToc=pToc->pNext){ - if( pToc->isSpecial && strcmp(pToc->zName,"*TOC*")==0 ) { + for (pToc=pList; pToc; pToc=pToc->pNext) { + if (pToc->isSpecial && strcmp(pToc->zName, "*TOC*") == 0) { break; } } - if( pToc ){ + if (pToc) { Tcl_Seek(chan, pToc->iOffset, SEEK_SET); - }else{ + } else { Tcl_Seek(chan, 0, SEEK_END); } @@ -2399,7 +2400,7 @@ ZvfsAppendObjCmd( * Add new files to the end of the archive. */ - for(i=2; rc==TCL_OK && i3) { + if (objc > 3) { zOpts = Tcl_GetStringFromObj(objv[1], &oLen); if (!strncmp("-fconfigure", zOpts, oLen)) { confOpts = objv[2]; @@ -2512,21 +2513,24 @@ ZvfsAddObjCmd( objv += 2; } } - if( objc==2) { + if (objc == 2) { return TCL_OK; } - if( objc<3) { + if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "?-fconfigure OPTPAIRS? ARCHIVE FILE1 FILE2 .."); return TCL_ERROR; } + zArchive = Tcl_GetString(objv[1]); chan = Tcl_OpenFileChannel(interp, zArchive, "r+", 0644); - if( chan==0 ) { + if (chan == 0) { chan = Tcl_OpenFileChannel(interp, zArchive, "w+", 0644); + if (chan == 0) { + return TCL_ERROR; + } } - if( chan==0 ) return TCL_ERROR; if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") || Tcl_SetChannelOption(interp, chan, "-encoding", "binary")){ /* this should never happen */ @@ -2538,27 +2542,26 @@ ZvfsAddObjCmd( /* Null file is ok, we're creating new one. */ } else { Tcl_Seek(chan, 0, SEEK_SET); - rc = ZvfsReadTOC(interp, chan, &pList); - if( rc==TCL_ERROR ){ + if (ZvfsReadTOC(interp, chan, &pList) == TCL_ERROR) { deleteZFileList(pList); Tcl_Close(interp, chan); - return rc; + return TCL_ERROR; } - rc=TCL_OK; + rc = TCL_OK; } /* * Move the file pointer to the start of the table of contents. */ - for(pToc=pList; pToc; pToc=pToc->pNext){ - if( pToc->isSpecial && strcmp(pToc->zName, "*TOC*")==0 ) { + for (pToc=pList; pToc; pToc=pToc->pNext) { + if (pToc->isSpecial && strcmp(pToc->zName, "*TOC*") == 0) { break; } } - if( pToc ){ + if (pToc) { Tcl_Seek(chan, pToc->iOffset, SEEK_SET); - }else{ + } else { Tcl_Seek(chan, 0, SEEK_END); } @@ -2566,22 +2569,25 @@ ZvfsAddObjCmd( * Add new files to the end of the archive. */ - for(i=2; rc==TCL_OK && i=tobjc) { + if (j >= tobjc) { ext = NULL; } } @@ -2654,26 +2660,20 @@ ZvfsStartObjCmd( { char *zArchive; Tcl_Channel chan; - ZFile *pList = NULL, *pToc; - int rc = TCL_OK, i, j, oLen; - char *zOpts = NULL; - Tcl_Obj *confOpts = NULL; - int tobjc; - Tcl_Obj **tobjv; - Tcl_Obj *varObj = NULL; + ZFile *pList = NULL; int zipStart; /* * Open the archive and read the table of contents */ - if( objc != 2) { + if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "ARCHIVE"); return TCL_ERROR; } zArchive = Tcl_GetString(objv[1]); chan = Tcl_OpenFileChannel(interp, zArchive, "r", 0644); - if( chan==0 ) { + if (chan == 0) { return TCL_ERROR; } if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") @@ -2689,8 +2689,7 @@ ZvfsStartObjCmd( } Tcl_Seek(chan, 0, SEEK_SET); - rc = ZvfsReadTOCStart(interp, chan, &pList, &zipStart); - if( rc!=TCL_OK ){ + if (ZvfsReadTOCStart(interp, chan, &pList, &zipStart) != TCL_OK) { deleteZFileList(pList); Tcl_Close(interp, chan); Tcl_AppendResult(interp, "not an archive", 0); -- cgit v0.12 From 1d9824ec60bc37945dfde4597fe763ed78bba999 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 1 Sep 2014 23:23:37 +0000 Subject: Tweaking the Makefile instructions for Tclkits under unix --- unix/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index d41e0d9..a228497 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -654,7 +654,7 @@ ${TCLKIT_EXE}: ${TCLSH_OBJS} ${TCL_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} PWD=`pwd` - cd $(SCRIPT_INSTALL_DIR) ; zip -rAq ${PWD}/tclkit.zip tcl8 tcl8.6 + cd ${prefix}/lib ; zip -rAq ${PWD}/tclkit.zip tcl8 tcl8.6 cat tclkit.zip >> ${TCLKIT_EXE} # Must be empty so it doesn't conflict with rule for ${TCL_EXE} above -- cgit v0.12 From 811d367c49b7c02192b14be4301f9066dd7fe95e Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 2 Sep 2014 11:04:53 +0000 Subject: Rather than make a special executable, tclkits are now a copy of tclsh with an attached zip file --- unix/Makefile.in | 7 +++---- win/Makefile.in | 8 +++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index a228497..bb6af0c 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -649,12 +649,11 @@ ${TCL_EXE}: ${TCLSH_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCL_EXE} -${TCLKIT_EXE}: ${TCLSH_OBJS} ${TCL_LIB_FILE} - ${CC} ${CFLAGS} ${LDFLAGS} ${OBJS} ${TCLSH_OBJS} \ - ${LIBS} @EXTRA_TCLSH_LIBS@ \ - ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} +${TCLKIT_EXE}: ${TCL_EXE} + rm -f tclkit.zip PWD=`pwd` cd ${prefix}/lib ; zip -rAq ${PWD}/tclkit.zip tcl8 tcl8.6 + cp -f ${TCL_EXE} ${TCLKIT_EXE} cat tclkit.zip >> ${TCLKIT_EXE} # Must be empty so it doesn't conflict with rule for ${TCL_EXE} above diff --git a/win/Makefile.in b/win/Makefile.in index 07c8db1..f302ed6 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -426,13 +426,11 @@ $(TCLSH): $(TCLSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) tclkit: $(TCLKIT) -$(TCLKIT): $(TCLSH_OBJS) @LIBRARIES@ ${TCL_OBJS} $(CAT32) tclsh.$(RES) - $(CC) $(CFLAGS) ${TCL_OBJS} $(TCLSH_OBJS) $(LIBS) \ - tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) - PWD=`pwd` +$(TCLKIT): $(TCLSH) rm -f tclkit.zip - cp $(TCLSH) $(TCLKIT) + PWD=`pwd` cd ${prefix}/lib ; zip -rq ${PWD}/tclkit.zip tcl8 tcl8.6 + cp -f $(TCLSH) $(TCLKIT) cat tclkit.zip >> $(TCLKIT) cat32.$(OBJEXT): cat.c -- cgit v0.12 From 8c90b3ae99f9acb04b46875ed09def2dcf9641f3 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 2 Sep 2014 15:21:23 +0000 Subject: Patch to make the default behavior for Tcl under Windows to embed the Zlib sources rather than add a dependency to a dynamic zlib.dll --- win/configure | 6546 ++++++++++++++++++++++++++++-------------------------- win/configure.in | 24 +- 2 files changed, 3361 insertions(+), 3209 deletions(-) diff --git a/win/configure b/win/configure index cf2b201..d8ee198 100755 --- a/win/configure +++ b/win/configure @@ -1,81 +1,423 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59. +# Generated by GNU Autoconf 2.68. +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# # -# 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. ## -## --------------------- ## +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +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 + # Pre-4.2 versions of Zsh do 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 + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac 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 + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done 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 +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - $as_unset $as_var + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." fi -done + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` -# PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -83,146 +425,107 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop - s,-$,, - s,^['$as_cr_digits']*\n,, + s/-\n.*// ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" # Exit status is that of the last command. exit } - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file else - as_expr=false + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln else as_ln_s='cp -p' fi -rm -f conf$$ conf$$.exe conf$$.file +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # 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'" @@ -231,38 +534,25 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" 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" - -# CDPATH. -$as_unset CDPATH - +test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` -exec 6>&1 - # # Initializations. # ac_default_prefix=/usr/local +ac_clean_files= ac_config_libobj_dir=. +LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= @@ -270,51 +560,214 @@ PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= +PACKAGE_URL= ac_unique_file="../generic/tcl.h" # Factoring default headers for most tests. ac_includes_default="\ #include -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include #endif -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H # include #endif -#if STDC_HEADERS +#ifdef STDC_HEADERS # include # include #else -# if HAVE_STDLIB_H +# ifdef HAVE_STDLIB_H # include # endif #endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif -#if HAVE_STRINGS_H +#ifdef HAVE_STRINGS_H # include #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H # include -#else -# if HAVE_STDINT_H -# include -# endif #endif -#if HAVE_UNISTD_H +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H # include #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 CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AR ac_ct_AR RANLIB ac_ct_RANLIB RC ac_ct_RC SET_MAKE TCL_THREADS CYGPATH CELIB_DIR DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING ZLIB_DLL_FILE ZLIB_LIBS ZLIB_OBJS CFLAGS_DEFAULT LDFLAGS_DEFAULT VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE TCL_WIN_VERSION MACHINE TCL_VERSION TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL PKG_CFG_ARGS TCL_EXE TCL_LIB_FILE TCL_LIB_FLAG TCL_STATIC_LIB_FILE TCL_STATIC_LIB_FLAG TCL_IMPORT_LIB_FILE TCL_IMPORT_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_DLL_FILE TCL_SRC_DIR TCL_BIN_DIR TCL_DBGX CFG_TCL_SHARED_LIB_SUFFIX CFG_TCL_UNSHARED_LIB_SUFFIX CFG_TCL_EXPORT_FILE_SUFFIX EXTRA_CFLAGS DEPARG CC_OBJNAME CC_EXENAME LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LDFLAGS_CONSOLE LDFLAGS_WINDOW STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX TCL_SHARED_BUILD LIBS_GUI DLLSUFFIX LIBPREFIX LIBSUFFIX EXESUFFIX LIBRARIES MAKE_LIB MAKE_STUB_LIB POST_MAKE_LIB MAKE_DLL MAKE_EXE TCL_BUILD_LIB_SPEC TCL_LD_SEARCH_FLAGS TCL_NEEDS_EXP_FILE TCL_BUILD_EXP_FILE TCL_EXP_FILE TCL_LIB_VERSIONS_OK TCL_PACKAGE_PATH TCL_DDE_VERSION TCL_DDE_MAJOR_VERSION TCL_DDE_MINOR_VERSION TCL_REG_VERSION TCL_REG_MAJOR_VERSION TCL_REG_MINOR_VERSION RC_OUT RC_TYPE RC_INCLUDE RC_DEFINE RC_DEFINES RES LIBOBJS LTLIBOBJS' +ac_subst_vars='LTLIBOBJS +LIBOBJS +RES +RC_DEFINES +RC_DEFINE +RC_INCLUDE +RC_TYPE +RC_OUT +TCL_REG_MINOR_VERSION +TCL_REG_MAJOR_VERSION +TCL_REG_VERSION +TCL_DDE_MINOR_VERSION +TCL_DDE_MAJOR_VERSION +TCL_DDE_VERSION +TCL_PACKAGE_PATH +TCL_LIB_VERSIONS_OK +TCL_EXP_FILE +TCL_BUILD_EXP_FILE +TCL_NEEDS_EXP_FILE +TCL_LD_SEARCH_FLAGS +TCL_BUILD_LIB_SPEC +MAKE_EXE +MAKE_DLL +POST_MAKE_LIB +MAKE_STUB_LIB +MAKE_LIB +LIBRARIES +EXESUFFIX +LIBSUFFIX +LIBPREFIX +DLLSUFFIX +LIBS_GUI +TCL_SHARED_BUILD +SHLIB_SUFFIX +SHLIB_CFLAGS +SHLIB_LD_LIBS +SHLIB_LD +STLIB_LD +LDFLAGS_WINDOW +LDFLAGS_CONSOLE +LDFLAGS_OPTIMIZE +LDFLAGS_DEBUG +CC_EXENAME +CC_OBJNAME +DEPARG +EXTRA_CFLAGS +CFG_TCL_EXPORT_FILE_SUFFIX +CFG_TCL_UNSHARED_LIB_SUFFIX +CFG_TCL_SHARED_LIB_SUFFIX +TCL_DBGX +TCL_BIN_DIR +TCL_SRC_DIR +TCL_DLL_FILE +TCL_BUILD_STUB_LIB_PATH +TCL_BUILD_STUB_LIB_SPEC +TCL_INCLUDE_SPEC +TCL_STUB_LIB_PATH +TCL_STUB_LIB_SPEC +TCL_STUB_LIB_FLAG +TCL_STUB_LIB_FILE +TCL_LIB_SPEC +TCL_IMPORT_LIB_FLAG +TCL_IMPORT_LIB_FILE +TCL_STATIC_LIB_FLAG +TCL_STATIC_LIB_FILE +TCL_LIB_FLAG +TCL_LIB_FILE +TCL_EXE +PKG_CFG_ARGS +TCL_PATCH_LEVEL +TCL_MINOR_VERSION +TCL_MAJOR_VERSION +TCL_VERSION +MACHINE +TCL_WIN_VERSION +VC_MANIFEST_EMBED_EXE +VC_MANIFEST_EMBED_DLL +LDFLAGS_DEFAULT +CFLAGS_DEFAULT +ZLIB_LIBS +ZLIB_OBJS +CFLAGS_WARNING +CFLAGS_OPTIMIZE +CFLAGS_DEBUG +DL_LIBS +CELIB_DIR +CYGPATH +TCL_THREADS +SET_MAKE +RC +RANLIB +AR +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_threads +with_encoding +enable_shared +enable_64bit +enable_wince +with_celib +with_zlib +enable_symbols +enable_embedded_manifest +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + # Initialize some variables set by options. ac_init_help= ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null @@ -337,34 +790,49 @@ x_libraries=NONE # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' +datarootdir='${prefix}/share' +datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' +docdir='${datarootdir}/doc/${PACKAGE}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' ac_prev= +ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" + eval $ac_prev=\$ac_option ac_prev= continue fi - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_option in + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; @@ -386,33 +854,59 @@ do --config-cache | -C) cache_file=config.cache ;; - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) + -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; esac - eval "enable_$ac_feature='$ac_optarg'" ;; + eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -439,6 +933,12 @@ do -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; @@ -463,13 +963,16 @@ do | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) + | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) @@ -534,6 +1037,16 @@ do | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; @@ -584,26 +1097,36 @@ do ac_init_version=: ;; -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; esac - eval "with_$ac_package='$ac_optarg'" ;; + eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. @@ -623,27 +1146,26 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -651,31 +1173,36 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "missing argument to $ac_option" fi -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac -done +fi -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir do - eval ac_val=$`echo $ac_var` + eval ac_val=\$$ac_var + # Remove trailing slashes. case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -689,8 +1216,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -702,74 +1229,72 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + # 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'` + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then + if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done # # Report the --help message. @@ -792,20 +1317,17 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --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] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -815,18 +1337,25 @@ for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -838,6 +1367,7 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-threads build with threads (default: on) @@ -853,168 +1383,393 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-encoding encoding for configuration values --with-celib=DIR use Windows/CE support library from DIR + --with-zlib use Native Zlib library Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. +Report bugs to the package provider. _ACEOF +ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. - ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue 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 "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # 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_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. 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;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; 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 +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested 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 else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } done fi -test -n "$ac_init_help" && exit 0 +test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF +configure +generated by GNU Autoconf 2.68 -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2010 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 + exit 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 $@ +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## -_ACEOF +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () { -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` +} # ac_fn_c_try_compile -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -_ASUNAME + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done +} # ac_fn_c_try_cpp -} >&5 +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -cat >&5 <<_ACEOF + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type +cat >config.log <<_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.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF ## ----------- ## @@ -1032,7 +1787,6 @@ _ACEOF ac_configure_args= ac_configure_args0= ac_configure_args1= -ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do @@ -1043,13 +1797,13 @@ do -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" + as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else @@ -1065,104 +1819,115 @@ do -* ) 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=" " + as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, -{ +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; + "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" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} + esac | + sort +) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" echo for ac_var in $ac_subst_files do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo - sed "/^$/d" confdefs.h | sort + cat confdefs.h echo fi test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status - ' 0 +' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. @@ -1170,112 +1935,137 @@ cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + # Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5 ; } fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; esac fi else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} >$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 +for ac_var in $ac_precious_vars; 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" + 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;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_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;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_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=: + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} 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"` ;; + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -1286,23 +2076,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - # 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. @@ -1362,10 +2135,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1375,35 +2148,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1413,39 +2188,50 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1455,77 +2241,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi + fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1536,18 +2282,19 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. @@ -1565,24 +2312,25 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then - for ac_prog in cl + for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1592,39 +2340,41 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC - for ac_prog in cl + for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1634,66 +2384,78 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$ac_ct_CC" && break done - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi fi fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -1705,112 +2467,108 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&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 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' 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. + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [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 + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. break;; * ) break;; esac done +test "$ac_cv_exeext" = no && ac_cv_exeext= + else - echo "$as_me: failed program was:" >&5 + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5 ; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (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 - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -rm -f a.out a.exe conftest$ac_cv_exeext b.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -1818,88 +2576,141 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 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_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.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 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5 ; } fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext 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 +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +#include int main () { +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -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 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5 ; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -1913,55 +2724,34 @@ 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 +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no + ac_compiler_gnu=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core 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` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -1972,39 +2762,49 @@ 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 +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ -ac_cv_prog_cc_g=no + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$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 @@ -2020,18 +2820,14 @@ else CFLAGS= fi fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_prog_cc_stdc=no + ac_cv_prog_cc_c89=no ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -2059,12 +2855,17 @@ static char *f (char * (*g) (char **, int), char **p, ...) /* 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 + as 'x'. The following induces an error, until -std 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. */ + that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -2079,205 +2880,37 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; return 0; } _ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# 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__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -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 - + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg fi -rm -f conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break done -rm -f conftest.$ac_ext conftest.$ac_objext +rm -f conftest.$ac_ext CC=$ac_save_CC fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac +if test "x$ac_cv_prog_cc_c89" != xno; then : -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -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 -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' @@ -2285,18 +2918,14 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking for inline" >&5 -echo $ECHO_N "checking for inline... $ECHO_C" >&6 -if test "${ac_cv_c_inline+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; @@ -2305,41 +2934,16 @@ $ac_kw foo_t foo () {return 0; } #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 - ac_cv_c_inline=$ac_kw; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break done fi -echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 -echo "${ECHO_T}$ac_cv_c_inline" >&6 - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; @@ -2361,15 +2965,15 @@ 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 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" @@ -2383,11 +2987,7 @@ do # 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -2396,78 +2996,34 @@ cat >>conftest.$ac_ext <<_ACEOF #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 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether non-existent headers + # OK, works on sane cases. Now check whether nonexistent 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _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 +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : break fi @@ -2479,8 +3035,8 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do @@ -2490,11 +3046,7 @@ do # 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -2503,85 +3055,40 @@ cat >>conftest.$ac_ext <<_ACEOF #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 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether non-existent headers + # OK, works on sane cases. Now check whether nonexistent 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _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 +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c @@ -2591,31 +3098,142 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" -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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -2630,51 +3248,23 @@ 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 +if ac_fn_c_try_compile "$LINENO"; 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 + ac_cv_header_stdc=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : + $EGREP "memchr" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -2684,18 +3274,14 @@ 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : + $EGREP "free" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -2705,16 +3291,13 @@ fi 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 + 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include +#include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) @@ -2734,41 +3317,26 @@ main () for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); + return 2; + 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 - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_run "$LINENO"; then : -( exit $ac_status ) -ac_cv_header_stdc=no +else + ac_cv_header_stdc=no fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF +$as_echo "#define STDC_HEADERS 1" >>confdefs.h fi @@ -2776,10 +3344,10 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. @@ -2789,35 +3357,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="${ac_tool_prefix}ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then - echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. @@ -2827,27 +3397,38 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then - echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -echo "${ECHO_T}$ac_ct_AR" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - AR=$ac_ct_AR + if test "x$ac_ct_AR" = x; then + AR="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi else AR="$ac_cv_prog_AR" fi @@ -2855,10 +3436,10 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. @@ -2868,35 +3449,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. @@ -2906,27 +3489,38 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - RANLIB=$ac_ct_RANLIB + if test "x$ac_ct_RANLIB" = x; then + RANLIB="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi else RANLIB="$ac_cv_prog_RANLIB" fi @@ -2934,10 +3528,10 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$RC"; then ac_cv_prog_RC="$RC" # Let the user override the test. @@ -2947,35 +3541,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RC="${ac_tool_prefix}windres" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi RC=$ac_cv_prog_RC if test -n "$RC"; then - echo "$as_me:$LINENO: result: $RC" >&5 -echo "${ECHO_T}$RC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RC" >&5 +$as_echo "$RC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$ac_cv_prog_RC"; then ac_ct_RC=$RC # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_RC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RC"; then ac_cv_prog_ac_ct_RC="$ac_ct_RC" # Let the user override the test. @@ -2985,27 +3581,38 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RC="windres" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi ac_ct_RC=$ac_cv_prog_ac_ct_RC if test -n "$ac_ct_RC"; then - echo "$as_me:$LINENO: result: $ac_ct_RC" >&5 -echo "${ECHO_T}$ac_ct_RC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RC" >&5 +$as_echo "$ac_ct_RC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - RC=$ac_ct_RC + if test "x$ac_ct_RC" = x; then + RC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RC=$ac_ct_RC + fi else RC="$ac_cv_prog_RC" fi @@ -3015,32 +3622,34 @@ fi # Checks to see if the make program 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF +SHELL = /bin/sh all: - @echo 'ac_maketemp="$(MAKE)"' + @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac rm -f conftest.make fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } SET_MAKE= else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -3057,34 +3666,30 @@ fi #-------------------------------------------------------------------- - echo "$as_me:$LINENO: checking for building with threads" >&5 -echo $ECHO_N "checking for building with threads... $ECHO_C" >&6 - # Check whether --enable-threads or --disable-threads was given. -if test "${enable_threads+set}" = set; then - enableval="$enable_threads" - tcl_ok=$enableval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for building with threads" >&5 +$as_echo_n "checking for building with threads... " >&6; } + # Check whether --enable-threads was given. +if test "${enable_threads+set}" = set; then : + enableval=$enable_threads; tcl_ok=$enableval else tcl_ok=yes -fi; +fi + if test "$tcl_ok" = "yes"; then - echo "$as_me:$LINENO: result: yes (default)" >&5 -echo "${ECHO_T}yes (default)" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (default)" >&5 +$as_echo "yes (default)" >&6; } TCL_THREADS=1 - cat >>confdefs.h <<\_ACEOF -#define TCL_THREADS 1 -_ACEOF + $as_echo "#define TCL_THREADS 1" >>confdefs.h # USE_THREAD_ALLOC tells us to try the special thread-based # allocator that significantly reduces lock contention - cat >>confdefs.h <<\_ACEOF -#define USE_THREAD_ALLOC 1 -_ACEOF + $as_echo "#define USE_THREAD_ALLOC 1" >>confdefs.h else TCL_THREADS=0 - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -3095,11 +3700,11 @@ echo "${ECHO_T}no" >&6 -# Check whether --with-encoding or --without-encoding was given. -if test "${with_encoding+set}" = set; then - withval="$with_encoding" - with_tcencoding=${withval} -fi; +# Check whether --with-encoding was given. +if test "${with_encoding+set}" = set; then : + withval=$with_encoding; with_tcencoding=${withval} +fi + if test x"${with_tcencoding}" != x ; then cat >>confdefs.h <<_ACEOF @@ -3108,9 +3713,7 @@ _ACEOF else # Default encoding on windows is not "iso8859-1" - cat >>confdefs.h <<\_ACEOF -#define TCL_CFGVAL_ENCODING "cp1252" -_ACEOF + $as_echo "#define TCL_CFGVAL_ENCODING \"cp1252\"" >>confdefs.h fi @@ -3121,15 +3724,15 @@ _ACEOF #-------------------------------------------------------------------- - echo "$as_me:$LINENO: checking how to build libraries" >&5 -echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6 - # Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - tcl_ok=$enableval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5 +$as_echo_n "checking how to build libraries... " >&6; } + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; tcl_ok=$enableval else tcl_ok=yes -fi; +fi + if test "${enable_shared+set}" = set; then enableval="$enable_shared" @@ -3139,17 +3742,15 @@ fi; fi if test "$tcl_ok" = "yes" ; then - echo "$as_me:$LINENO: result: shared" >&5 -echo "${ECHO_T}shared" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: shared" >&5 +$as_echo "shared" >&6; } SHARED_BUILD=1 else - echo "$as_me:$LINENO: result: static" >&5 -echo "${ECHO_T}static" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5 +$as_echo "static" >&6; } SHARED_BUILD=0 -cat >>confdefs.h <<\_ACEOF -#define STATIC_BUILD 1 -_ACEOF +$as_echo "#define STATIC_BUILD 1" >>confdefs.h fi @@ -3161,70 +3762,15 @@ _ACEOF #-------------------------------------------------------------------- # On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - 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 +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -3236,59 +3782,57 @@ done # Step 0: Enable 64 bit support? - echo "$as_me:$LINENO: checking if 64bit support is requested" >&5 -echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6 - # Check whether --enable-64bit or --disable-64bit was given. -if test "${enable_64bit+set}" = set; then - enableval="$enable_64bit" - do64bit=$enableval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if 64bit support is requested" >&5 +$as_echo_n "checking if 64bit support is requested... " >&6; } + # Check whether --enable-64bit was given. +if test "${enable_64bit+set}" = set; then : + enableval=$enable_64bit; do64bit=$enableval else do64bit=no -fi; - echo "$as_me:$LINENO: result: $do64bit" >&5 -echo "${ECHO_T}$do64bit" >&6 +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $do64bit" >&5 +$as_echo "$do64bit" >&6; } # Cross-compiling options for Windows/CE builds - echo "$as_me:$LINENO: checking if Windows/CE build is requested" >&5 -echo $ECHO_N "checking if Windows/CE build is requested... $ECHO_C" >&6 - # Check whether --enable-wince or --disable-wince was given. -if test "${enable_wince+set}" = set; then - enableval="$enable_wince" - doWince=$enableval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Windows/CE build is requested" >&5 +$as_echo_n "checking if Windows/CE build is requested... " >&6; } + # Check whether --enable-wince was given. +if test "${enable_wince+set}" = set; then : + enableval=$enable_wince; doWince=$enableval else doWince=no -fi; - echo "$as_me:$LINENO: result: $doWince" >&5 -echo "${ECHO_T}$doWince" >&6 +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doWince" >&5 +$as_echo "$doWince" >&6; } - echo "$as_me:$LINENO: checking for Windows/CE celib directory" >&5 -echo $ECHO_N "checking for Windows/CE celib directory... $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Windows/CE celib directory" >&5 +$as_echo_n "checking for Windows/CE celib directory... " >&6; } -# Check whether --with-celib or --without-celib was given. -if test "${with_celib+set}" = set; then - withval="$with_celib" - CELIB_DIR=$withval +# Check whether --with-celib was given. +if test "${with_celib+set}" = set; then : + withval=$with_celib; CELIB_DIR=$withval else CELIB_DIR=NO_CELIB -fi; - echo "$as_me:$LINENO: result: $CELIB_DIR" >&5 -echo "${ECHO_T}$CELIB_DIR" >&6 +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CELIB_DIR" >&5 +$as_echo "$CELIB_DIR" >&6; } # Set some defaults (may get changed below) EXTRA_CFLAGS="" -cat >>confdefs.h <<\_ACEOF -#define MODULE_SCOPE extern -_ACEOF +$as_echo "#define MODULE_SCOPE extern" >>confdefs.h # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CYGPATH+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CYGPATH+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CYGPATH"; then ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. @@ -3298,28 +3842,30 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CYGPATH="cygpath -w" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" fi fi CYGPATH=$ac_cv_prog_CYGPATH if test -n "$CYGPATH"; then - echo "$as_me:$LINENO: result: $CYGPATH" >&5 -echo "${ECHO_T}$CYGPATH" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5 +$as_echo "$CYGPATH" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + SHLIB_SUFFIX=".dll" # MACHINE is IX86 for LINK, but this is used by the manifest, @@ -3328,16 +3874,12 @@ fi if test "$GCC" = "yes"; then - echo "$as_me:$LINENO: checking for cross-compile version of gcc" >&5 -echo $ECHO_N "checking for cross-compile version of gcc... $ECHO_C" >&6 -if test "${ac_cv_cross+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cross-compile version of gcc" >&5 +$as_echo_n "checking for cross-compile version of gcc... " >&6; } +if ${ac_cv_cross+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _WIN32 @@ -3352,40 +3894,16 @@ 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 +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_cross=no else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_cross=yes + ac_cv_cross=yes fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_cross" >&5 -echo "${ECHO_T}$ac_cv_cross" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cross" >&5 +$as_echo "$ac_cv_cross" >&6; } if test "$ac_cv_cross" = "yes"; then case "$do64bit" in @@ -3420,20 +3938,20 @@ echo "${ECHO_T}$ac_cv_cross" >&6 echo "101 \"name\"" >> $conftest echo "END" >> $conftest - echo "$as_me:$LINENO: checking for Windows native path bug in windres" >&5 -echo $ECHO_N "checking for Windows native path bug in windres... $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Windows native path bug in windres" >&5 +$as_echo_n "checking for Windows native path bug in windres... " >&6; } cyg_conftest=`$CYGPATH $conftest` if { ac_try='$RC -o conftest.res.o $cyg_conftest' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } ; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } CYGPATH=echo fi conftest= @@ -3451,16 +3969,12 @@ echo "${ECHO_T}yes" >&6 if test "${GCC}" = "yes" ; then extra_cflags="-pipe" extra_ldflags="-pipe -static-libgcc" - echo "$as_me:$LINENO: checking for mingw32 version of gcc" >&5 -echo $ECHO_N "checking for mingw32 version of gcc... $ECHO_C" >&6 -if test "${ac_cv_win32+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mingw32 version of gcc" >&5 +$as_echo_n "checking for mingw32 version of gcc... " >&6; } +if ${ac_cv_win32+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _WIN32 @@ -3475,57 +3989,73 @@ 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 +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_win32=no else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_win32=yes + ac_cv_win32=yes fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_win32" >&5 -echo "${ECHO_T}$ac_cv_win32" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_win32" >&5 +$as_echo "$ac_cv_win32" >&6; } if test "$ac_cv_win32" != "yes"; then - { { echo "$as_me:$LINENO: error: ${CC} cannot produce win32 executables." >&5 -echo "$as_me: error: ${CC} cannot produce win32 executables." >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "${CC} cannot produce win32 executables." "$LINENO" 5 fi hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -mwindows -municode -Dmain=xxmain" - echo "$as_me:$LINENO: checking for working -municode linker flag" >&5 -echo $ECHO_N "checking for working -municode linker flag... $ECHO_C" >&6 -if test "${ac_cv_municode+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working -municode linker flag" >&5 +$as_echo_n "checking for working -municode linker flag... " >&6; } +if ${ac_cv_municode+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -3539,41 +4069,17 @@ main () 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 +if ac_fn_c_try_link "$LINENO"; then : ac_cv_municode=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_municode=no + ac_cv_municode=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_municode" >&5 -echo "${ECHO_T}$ac_cv_municode" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_municode" >&5 +$as_echo "$ac_cv_municode" >&6; } CFLAGS=$hold_cflags if test "$ac_cv_municode" = "yes" ; then extra_ldflags="$extra_ldflags -municode" @@ -3582,8 +4088,8 @@ echo "${ECHO_T}$ac_cv_municode" >&6 fi fi - echo "$as_me:$LINENO: checking compiler flags" >&5 -echo $ECHO_N "checking compiler flags... $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler flags" >&5 +$as_echo_n "checking compiler flags... " >&6; } if test "${GCC}" = "yes" ; then SHLIB_LD="" SHLIB_LD_LIBS='${LIBS}' @@ -3604,23 +4110,20 @@ echo $ECHO_N "checking compiler flags... $ECHO_C" >&6 if test "${SHARED_BUILD}" = "0" ; then # static - echo "$as_me:$LINENO: result: using static flags" >&5 -echo "${ECHO_T}using static flags" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using static flags" >&5 +$as_echo "using static flags" >&6; } runtime= LIBRARIES="\${STATIC_LIBRARIES}" EXESUFFIX="s\${DBGX}.exe" else # dynamic - echo "$as_me:$LINENO: result: using shared flags" >&5 -echo "${ECHO_T}using shared flags" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using shared flags" >&5 +$as_echo "using shared flags" >&6; } # ad-hoc check to see if CC supports -shared. if "${CC}" -shared 2>&1 | egrep ': -shared not supported' >/dev/null; then - { { echo "$as_me:$LINENO: error: ${CC} does not support the -shared option. - You will need to upgrade to a newer version of the toolchain." >&5 -echo "$as_me: error: ${CC} does not support the -shared option. - You will need to upgrade to a newer version of the toolchain." >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "${CC} does not support the -shared option. + You will need to upgrade to a newer version of the toolchain." "$LINENO" 5 fi runtime= @@ -3674,20 +4177,16 @@ echo "$as_me: error: ${CC} does not support the -shared option. case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build - echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 -echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 +$as_echo " Using 64-bit $MACHINE mode" >&6; } ;; ia64) MACHINE="IA64" - echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 -echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 +$as_echo " Using 64-bit $MACHINE mode" >&6; } ;; *) - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _WIN64 @@ -3702,57 +4201,33 @@ 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_win_64bit=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_win_64bit=no + tcl_win_64bit=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "$tcl_win_64bit" = "yes" ; then do64bit=amd64 MACHINE="AMD64" - echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 -echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 +$as_echo " Using 64-bit $MACHINE mode" >&6; } fi ;; esac else if test "${SHARED_BUILD}" = "0" ; then # static - echo "$as_me:$LINENO: result: using static flags" >&5 -echo "${ECHO_T}using static flags" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using static flags" >&5 +$as_echo "using static flags" >&6; } runtime=-MT LIBRARIES="\${STATIC_LIBRARIES}" EXESUFFIX="s\${DBGX}.exe" else # dynamic - echo "$as_me:$LINENO: result: using shared flags" >&5 -echo "${ECHO_T}using shared flags" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using shared flags" >&5 +$as_echo "using shared flags" >&6; } runtime=-MD # Add SHLIB_LD_LIBS to the Make rule, not here. LIBRARIES="\${SHARED_LIBRARIES}" @@ -3785,14 +4260,14 @@ echo "${ECHO_T}using shared flags" >&6 ;; esac if test ! -d "${PATH64}" ; then - { echo "$as_me:$LINENO: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&5 -echo "$as_me: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&2;} - { echo "$as_me:$LINENO: WARNING: Ensure latest Platform SDK is installed" >&5 -echo "$as_me: WARNING: Ensure latest Platform SDK is installed" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&5 +$as_echo "$as_me: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ensure latest Platform SDK is installed" >&5 +$as_echo "$as_me: WARNING: Ensure latest Platform SDK is installed" >&2;} do64bit="no" else - echo "$as_me:$LINENO: result: Using 64-bit $MACHINE mode" >&5 -echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 +$as_echo " Using 64-bit $MACHINE mode" >&6; } fi fi @@ -3803,64 +4278,9 @@ echo "${ECHO_T} Using 64-bit $MACHINE mode" >&6 # TEA_PATH_NOSPACE to avoid this issue. # Check if _WIN64 is already recognized, and if so we don't # need to modify CC. - echo "$as_me:$LINENO: checking whether _WIN64 is declared" >&5 -echo $ECHO_N "checking whether _WIN64 is declared... $ECHO_C" >&6 -if test "${ac_cv_have_decl__WIN64+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 () -{ -#ifndef _WIN64 - char *p = (char *) _WIN64; -#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_cv_have_decl__WIN64=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_fn_c_check_decl "$LINENO" "_WIN64" "ac_cv_have_decl__WIN64" "$ac_includes_default" +if test "x$ac_cv_have_decl__WIN64" = xyes; then : -ac_cv_have_decl__WIN64=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl__WIN64" >&5 -echo "${ECHO_T}$ac_cv_have_decl__WIN64" >&6 -if test $ac_cv_have_decl__WIN64 = yes; then - : else CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \ -I\"${MSSDK}/Include/crt\" \ @@ -3928,15 +4348,11 @@ fi SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'` CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'` if test ! -d "${CELIB_DIR}/inc"; then - { { echo "$as_me:$LINENO: error: Invalid celib directory \"${CELIB_DIR}\"" >&5 -echo "$as_me: error: Invalid celib directory \"${CELIB_DIR}\"" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "Invalid celib directory \"${CELIB_DIR}\"" "$LINENO" 5 fi if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"\ -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then - { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5 -echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" "$LINENO" 5 else CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include" if test -d "${CEINCLUDE}/${TARGETCPU}" ; then @@ -4032,26 +4448,20 @@ _ACEOF fi if test "$do64bit" != "no" ; then - cat >>confdefs.h <<\_ACEOF -#define TCL_CFG_DO64BIT 1 -_ACEOF + $as_echo "#define TCL_CFG_DO64BIT 1" >>confdefs.h fi if test "${GCC}" = "yes" ; then - echo "$as_me:$LINENO: checking for SEH support in compiler" >&5 -echo $ECHO_N "checking for SEH support in compiler... $ECHO_C" >&6 -if test "${tcl_cv_seh+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SEH support in compiler" >&5 +$as_echo_n "checking for SEH support in compiler... " >&6; } +if ${tcl_cv_seh+:} false; then : + $as_echo_n "(cached) " >&6 else - if test "$cross_compiling" = yes; then + 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define WIN32_LEAN_AND_MEAN @@ -4070,37 +4480,22 @@ cat >>conftest.$ac_ext <<_ACEOF } _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 +if ac_fn_c_try_run "$LINENO"; then : tcl_cv_seh=yes 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 ) -tcl_cv_seh=no + tcl_cv_seh=no fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi -echo "$as_me:$LINENO: result: $tcl_cv_seh" >&5 -echo "${ECHO_T}$tcl_cv_seh" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_seh" >&5 +$as_echo "$tcl_cv_seh" >&6; } if test "$tcl_cv_seh" = "no" ; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_NO_SEH 1 -_ACEOF +$as_echo "#define HAVE_NO_SEH 1" >>confdefs.h fi @@ -4110,16 +4505,12 @@ _ACEOF # with Cygwin's version as of 2002-04-10, define it to be int, # sufficient for getting the current code to work. # - 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EXCEPTION_DISPOSITION support in include files" >&5 +$as_echo_n "checking for EXCEPTION_DISPOSITION support in include files... " >&6; } +if ${tcl_cv_eh_disposition+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define WIN32_LEAN_AND_MEAN @@ -4136,45 +4527,19 @@ 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 +if ac_fn_c_try_compile "$LINENO"; 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 + tcl_cv_eh_disposition=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_eh_disposition" >&5 +$as_echo "$tcl_cv_eh_disposition" >&6; } if test "$tcl_cv_eh_disposition" = "no" ; then -cat >>confdefs.h <<\_ACEOF -#define EXCEPTION_DISPOSITION int -_ACEOF +$as_echo "#define EXCEPTION_DISPOSITION int" >>confdefs.h fi @@ -4182,16 +4547,12 @@ _ACEOF # even if VOID has already been #defined. The win32api # used by mingw and cygwin is known to do this. - 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winnt.h that ignores VOID define" >&5 +$as_echo_n "checking for winnt.h that ignores VOID define... " >&6; } +if ${tcl_cv_winnt_ignore_void+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define VOID void @@ -4211,45 +4572,19 @@ 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 +if ac_fn_c_try_compile "$LINENO"; 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 + tcl_cv_winnt_ignore_void=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_winnt_ignore_void" >&5 +$as_echo "$tcl_cv_winnt_ignore_void" >&6; } if test "$tcl_cv_winnt_ignore_void" = "yes" ; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_WINNT_IGNORE_VOID 1 -_ACEOF +$as_echo "#define HAVE_WINNT_IGNORE_VOID 1" >>confdefs.h fi @@ -4257,16 +4592,12 @@ _ACEOF # This is used to stop gcc from printing a compiler # warning when initializing a union member. - 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5 +$as_echo_n "checking for cast to union support... " >&6; } +if ${tcl_cv_cast_to_union+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -4280,45 +4611,19 @@ 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 +if ac_fn_c_try_compile "$LINENO"; 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 + tcl_cv_cast_to_union=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5 +$as_echo "$tcl_cv_cast_to_union" >&6; } if test "$tcl_cv_cast_to_union" = "yes"; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_CAST_TO_UNION 1 -_ACEOF +$as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h fi fi @@ -4345,7 +4650,7 @@ esac # as we just assume that the platform hasn't got a usable z.lib #------------------------------------------------------------------------ -if test "${enable_shared+set}" = "set"; then +if test "${enable_shared+set}" = "set"; then : enableval="$enable_shared" tcl_ok=$enableval @@ -4356,311 +4661,130 @@ else fi -if test "$tcl_ok" = "yes"; then +# Check whether --with-zlib was given. +if test "${with_zlib+set}" = set; then : + withval=$with_zlib; with_zlib=$withval +else + with_zlib=NO_ZLIB - ZLIB_DLL_FILE=\${ZLIB_DLL_FILE} +fi - if test "$do64bit" = "yes"; then +if test "with_zlib" = "NO_ZLIB"; then : + ZLIB_OBJS=\${ZLIB_OBJS} - if test "$GCC" == "yes"; then +elif test "$tcl_ok" != "yes"; then : + ZLIB_OBJS=\${ZLIB_OBJS} - ZLIB_LIBS=\${ZLIB_DIR}/win64/libz.dll.a +elif test "$do64bit" = "yes"; then : + ZLIB_OBJS=\${ZLIB_OBJS} +elif test "$with_zlib" = "yes" ; then : + ZLIB_LIBS=\${ZLIB_DIR}/win32/zdll.lib else - - ZLIB_LIBS=\${ZLIB_DIR}/win64/zdll.lib + ZLIB_LIBS=$with_zlib fi +$as_echo "#define HAVE_ZLIB 1" >>confdefs.h -else - - ZLIB_LIBS=\${ZLIB_DIR}/win32/zdll.lib +ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default" +if test "x$ac_cv_type_intptr_t" = xyes; then : -fi +$as_echo "#define HAVE_INTPTR_T 1" >>confdefs.h else - ZLIB_OBJS=\${ZLIB_OBJS} - - -fi - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ZLIB 1 -_ACEOF - - -echo "$as_me:$LINENO: checking for intptr_t" >&5 -echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6 -if test "${ac_cv_type_intptr_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pointer-size signed integer type" >&5 +$as_echo_n "checking for pointer-size signed integer type... " >&6; } +if ${tcl_cv_intptr_t+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + + for tcl_cv_intptr_t in "int" "long" "long long" none; do + if test "$tcl_cv_intptr_t" != none; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { -if ((intptr_t *) 0) - return 0; -if (sizeof (intptr_t)) - return 0; +static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))]; +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_cv_type_intptr_t=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_ok=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_intptr_t=no + tcl_ok=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$tcl_ok" = yes && break; fi + done fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_intptr_t" >&5 +$as_echo "$tcl_cv_intptr_t" >&6; } + if test "$tcl_cv_intptr_t" != none; then + +cat >>confdefs.h <<_ACEOF +#define intptr_t $tcl_cv_intptr_t +_ACEOF + + fi + fi -echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5 -echo "${ECHO_T}$ac_cv_type_intptr_t" >&6 -if test $ac_cv_type_intptr_t = yes; then +ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default" +if test "x$ac_cv_type_uintptr_t" = xyes; then : -cat >>confdefs.h <<\_ACEOF -#define HAVE_INTPTR_T 1 -_ACEOF + +$as_echo "#define HAVE_UINTPTR_T 1" >>confdefs.h else - echo "$as_me:$LINENO: checking for pointer-size signed integer type" >&5 -echo $ECHO_N "checking for pointer-size signed integer type... $ECHO_C" >&6 -if test "${tcl_cv_intptr_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pointer-size unsigned integer type" >&5 +$as_echo_n "checking for pointer-size unsigned integer type... " >&6; } +if ${tcl_cv_uintptr_t+:} false; then : + $as_echo_n "(cached) " >&6 else - for tcl_cv_intptr_t in "int" "long" "long long" none; do - if test "$tcl_cv_intptr_t" != none; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \ + none; do + if test "$tcl_cv_uintptr_t" != none; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { -static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))]; +static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))]; 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_ok=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_ok=no + tcl_ok=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$tcl_ok" = yes && break; fi done fi -echo "$as_me:$LINENO: result: $tcl_cv_intptr_t" >&5 -echo "${ECHO_T}$tcl_cv_intptr_t" >&6 - if test "$tcl_cv_intptr_t" != none; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_uintptr_t" >&5 +$as_echo "$tcl_cv_uintptr_t" >&6; } + if test "$tcl_cv_uintptr_t" != none; then cat >>confdefs.h <<_ACEOF -#define intptr_t $tcl_cv_intptr_t -_ACEOF - - fi - -fi - -echo "$as_me:$LINENO: checking for uintptr_t" >&5 -echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 -if test "${ac_cv_type_uintptr_t+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 ((uintptr_t *) 0) - return 0; -if (sizeof (uintptr_t)) - 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_uintptr_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_uintptr_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 -echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6 -if test $ac_cv_type_uintptr_t = yes; then - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_UINTPTR_T 1 -_ACEOF - -else - - echo "$as_me:$LINENO: checking for pointer-size unsigned integer type" >&5 -echo $ECHO_N "checking for pointer-size unsigned integer type... $ECHO_C" >&6 -if test "${tcl_cv_uintptr_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \ - none; do - if test "$tcl_cv_uintptr_t" != none; then - 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 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))]; -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 - tcl_ok=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_ok=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test "$tcl_ok" = yes && break; fi - done -fi -echo "$as_me:$LINENO: result: $tcl_cv_uintptr_t" >&5 -echo "${ECHO_T}$tcl_cv_uintptr_t" >&6 - if test "$tcl_cv_uintptr_t" != none; then - -cat >>confdefs.h <<_ACEOF -#define uintptr_t $tcl_cv_uintptr_t +#define uintptr_t $tcl_cv_uintptr_t _ACEOF fi @@ -4676,16 +4800,12 @@ fi # missing from winbase.h. This is known to be # a problem with VC++ 5.2. -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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FINDEX_INFO_LEVELS in winbase.h" >&5 +$as_echo_n "checking for FINDEX_INFO_LEVELS in winbase.h... " >&6; } +if ${tcl_cv_findex_enums+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define WIN32_LEAN_AND_MEAN @@ -4703,60 +4823,30 @@ 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 +if ac_fn_c_try_compile "$LINENO"; 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 + tcl_cv_findex_enums=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_findex_enums" >&5 +$as_echo "$tcl_cv_findex_enums" >&6; } if test "$tcl_cv_findex_enums" = "no"; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_NO_FINDEX_ENUMS 1 -_ACEOF +$as_echo "#define HAVE_NO_FINDEX_ENUMS 1" >>confdefs.h fi # See if the compiler supports intrinsics. -echo "$as_me:$LINENO: checking for intrinsics support in compiler" >&5 -echo $ECHO_N "checking for intrinsics support in compiler... $ECHO_C" >&6 -if test "${tcl_cv_intrinsics+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for intrinsics support in compiler" >&5 +$as_echo_n "checking for intrinsics support in compiler... " >&6; } +if ${tcl_cv_intrinsics+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define WIN32_LEAN_AND_MEAN @@ -4774,61 +4864,31 @@ main () 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 +if ac_fn_c_try_link "$LINENO"; then : tcl_cv_intrinsics=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_intrinsics=no + tcl_cv_intrinsics=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_intrinsics" >&5 -echo "${ECHO_T}$tcl_cv_intrinsics" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_intrinsics" >&5 +$as_echo "$tcl_cv_intrinsics" >&6; } if test "$tcl_cv_intrinsics" = "yes"; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_INTRIN_H 1 -_ACEOF +$as_echo "#define HAVE_INTRIN_H 1" >>confdefs.h fi # See if the header file is present -echo "$as_me:$LINENO: checking for wspiapi.h" >&5 -echo $ECHO_N "checking for wspiapi.h... $ECHO_C" >&6 -if test "${tcl_cv_wspiapi_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wspiapi.h" >&5 +$as_echo_n "checking for wspiapi.h... " >&6; } +if ${tcl_cv_wspiapi_h+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -4841,45 +4901,19 @@ 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_wspiapi_h=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_wspiapi_h=no + tcl_cv_wspiapi_h=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_wspiapi_h" >&5 -echo "${ECHO_T}$tcl_cv_wspiapi_h" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_wspiapi_h" >&5 +$as_echo "$tcl_cv_wspiapi_h" >&6; } if test "$tcl_cv_wspiapi_h" = "yes"; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_WSPIAPI_H 1 -_ACEOF +$as_echo "#define HAVE_WSPIAPI_H 1" >>confdefs.h fi @@ -4887,16 +4921,12 @@ fi # missing from winbase.h. This is known to be # a problem with VC++ 5.2. -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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FINDEX_INFO_LEVELS in winbase.h" >&5 +$as_echo_n "checking for FINDEX_INFO_LEVELS in winbase.h... " >&6; } +if ${tcl_cv_findex_enums+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define WIN32_LEAN_AND_MEAN @@ -4914,45 +4944,19 @@ 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 +if ac_fn_c_try_compile "$LINENO"; 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 + tcl_cv_findex_enums=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_findex_enums" >&5 +$as_echo "$tcl_cv_findex_enums" >&6; } if test "$tcl_cv_findex_enums" = "no"; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_NO_FINDEX_ENUMS 1 -_ACEOF +$as_echo "#define HAVE_NO_FINDEX_ENUMS 1" >>confdefs.h fi @@ -4963,39 +4967,35 @@ fi #-------------------------------------------------------------------- - echo "$as_me:$LINENO: checking for build with symbols" >&5 -echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6 - # Check whether --enable-symbols or --disable-symbols was given. -if test "${enable_symbols+set}" = set; then - enableval="$enable_symbols" - tcl_ok=$enableval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build with symbols" >&5 +$as_echo_n "checking for build with symbols... " >&6; } + # Check whether --enable-symbols was given. +if test "${enable_symbols+set}" = set; then : + enableval=$enable_symbols; tcl_ok=$enableval else tcl_ok=no -fi; +fi + # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT. if test "$tcl_ok" = "no"; then CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)' LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)' DBGX="" -cat >>confdefs.h <<\_ACEOF -#define NDEBUG 1 -_ACEOF +$as_echo "#define NDEBUG 1" >>confdefs.h - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } - cat >>confdefs.h <<\_ACEOF -#define TCL_CFG_OPTIMIZED 1 -_ACEOF + $as_echo "#define TCL_CFG_OPTIMIZED 1" >>confdefs.h else CFLAGS_DEFAULT='$(CFLAGS_DEBUG)' LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)' DBGX=g if test "$tcl_ok" = "yes"; then - echo "$as_me:$LINENO: result: yes (standard debugging)" >&5 -echo "${ECHO_T}yes (standard debugging)" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (standard debugging)" >&5 +$as_echo "yes (standard debugging)" >&6; } fi fi @@ -5003,32 +5003,26 @@ echo "${ECHO_T}yes (standard debugging)" >&6 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then -cat >>confdefs.h <<\_ACEOF -#define TCL_MEM_DEBUG 1 -_ACEOF +$as_echo "#define TCL_MEM_DEBUG 1" >>confdefs.h fi if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then -cat >>confdefs.h <<\_ACEOF -#define TCL_COMPILE_DEBUG 1 -_ACEOF +$as_echo "#define TCL_COMPILE_DEBUG 1" >>confdefs.h -cat >>confdefs.h <<\_ACEOF -#define TCL_COMPILE_STATS 1 -_ACEOF +$as_echo "#define TCL_COMPILE_STATS 1" >>confdefs.h fi if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then if test "$tcl_ok" = "all"; then - echo "$as_me:$LINENO: result: enabled symbols mem compile debugging" >&5 -echo "${ECHO_T}enabled symbols mem compile debugging" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled symbols mem compile debugging" >&5 +$as_echo "enabled symbols mem compile debugging" >&6; } else - echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5 -echo "${ECHO_T}enabled $tcl_ok debugging" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled $tcl_ok debugging" >&5 +$as_echo "enabled $tcl_ok debugging" >&6; } fi fi @@ -5040,15 +5034,15 @@ TCL_DBGX=${DBGX} #-------------------------------------------------------------------- - echo "$as_me:$LINENO: checking whether to embed manifest" >&5 -echo $ECHO_N "checking whether to embed manifest... $ECHO_C" >&6 - # Check whether --enable-embedded-manifest or --disable-embedded-manifest was given. -if test "${enable_embedded_manifest+set}" = set; then - enableval="$enable_embedded_manifest" - embed_ok=$enableval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to embed manifest" >&5 +$as_echo_n "checking whether to embed manifest... " >&6; } + # Check whether --enable-embedded-manifest was given. +if test "${enable_embedded_manifest+set}" = set; then : + enableval=$enable_embedded_manifest; embed_ok=$enableval else embed_ok=yes -fi; +fi + VC_MANIFEST_EMBED_DLL= VC_MANIFEST_EMBED_EXE= @@ -5056,11 +5050,7 @@ fi; if test "$embed_ok" = "yes" -a "${SHARED_BUILD}" = "1" \ -a "$GCC" != "yes" ; then # Add the magic to embed the manifest into the dll/exe - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined(_MSC_VER) && _MSC_VER >= 1400 @@ -5069,7 +5059,7 @@ print("manifest needed") _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "manifest needed" >/dev/null 2>&1; then + $EGREP "manifest needed" >/dev/null 2>&1; then : # Could do a CHECK_PROG for mt, but should always be with MSVC8+ # Could add 'if test -f' check, but manifest should be created @@ -5088,8 +5078,8 @@ fi rm -f conftest* fi - echo "$as_me:$LINENO: result: $result" >&5 -echo "${ECHO_T}$result" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5 +$as_echo "$result" >&6; } @@ -5275,7 +5265,8 @@ TCL_WIN_VERSION="$TCL_VERSION.$TCL_RELEASE_LEVEL.`echo $TCL_PATCH_LEVEL | tr -d - ac_config_files="$ac_config_files Makefile tclConfig.sh tcl.hpj tclsh.exe.manifest" +ac_config_files="$ac_config_files Makefile tclConfig.sh tcl.hpj tclsh.exe.manifest" + 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 @@ -5294,39 +5285,70 @@ _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. +# So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -{ +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (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 \). + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}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" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} | + esac | + sort +) | sed ' + /^ac_cv_env_/b end t clear - : clear + :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else - echo "not updating unwritable cache $cache_file" + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -5335,63 +5357,55 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. 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, +# take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +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 -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= +U= 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' + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -5399,12 +5413,14 @@ LTLIBOBJS=$ac_ltlibobjs -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -5414,81 +5430,253 @@ cat >$CONFIG_STATUS <<_ACEOF debug=false ac_cs_recheck=false ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +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 + # Pre-4.2 versions of Zsh do 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 + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac 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 + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' fi +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done 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 +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi -done + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` - -# PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -5496,148 +5684,123 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file else - as_expr=false + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln else as_ln_s='cp -p' fi -rm -f conf$$ conf$$.exe conf$$.file +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # 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'" @@ -5646,31 +5809,20 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" 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" - -# CDPATH. -$as_unset CDPATH - exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - +# values after options handling. +ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.59. Invocation command line was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5678,124 +5830,116 @@ generated by GNU Autoconf 2.59. Invocation command line was CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + _ACEOF -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" -cat >>$CONFIG_STATUS <<\_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. -Usage: $0 [OPTIONS] [FILE]... +Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + 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 + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE Configuration files: $config_files -Report bugs to ." -_ACEOF +Report bugs to the package provider." -cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2010 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 + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; - -*) + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; esac case $ac_option in # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; - *) ac_config_targets="$ac_config_targets $1" ;; + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; esac shift @@ -5809,33 +5953,47 @@ if $ac_cs_silent; then fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 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 + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" fi _ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - - -cat >>$CONFIG_STATUS <<\_ACEOF +# Handling of arguments. for ac_config_target in $ac_config_targets do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "tclConfig.sh" ) CONFIG_FILES="$CONFIG_FILES tclConfig.sh" ;; - "tcl.hpj" ) CONFIG_FILES="$CONFIG_FILES tcl.hpj" ;; - "tclsh.exe.manifest" ) CONFIG_FILES="$CONFIG_FILES tclsh.exe.manifest" ;; - *) { { 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; }; };; + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "tclConfig.sh") CONFIG_FILES="$CONFIG_FILES tclConfig.sh" ;; + "tcl.hpj") CONFIG_FILES="$CONFIG_FILES tcl.hpj" ;; + "tclsh.exe.manifest") CONFIG_FILES="$CONFIG_FILES tclsh.exe.manifest" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; 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 @@ -5845,420 +6003,414 @@ if $ac_need_defaults; then 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, +# simply because there is no reason against having 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. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. $debug || { - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 } - # Create a (secure) tmp directory for tmp files. { - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" } || { - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} { - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi -# -# CONFIG_FILES section. -# +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@AR@,$AR,;t t -s,@ac_ct_AR@,$ac_ct_AR,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@RC@,$RC,;t t -s,@ac_ct_RC@,$ac_ct_RC,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@TCL_THREADS@,$TCL_THREADS,;t t -s,@CYGPATH@,$CYGPATH,;t t -s,@CELIB_DIR@,$CELIB_DIR,;t t -s,@DL_LIBS@,$DL_LIBS,;t t -s,@CFLAGS_DEBUG@,$CFLAGS_DEBUG,;t t -s,@CFLAGS_OPTIMIZE@,$CFLAGS_OPTIMIZE,;t t -s,@CFLAGS_WARNING@,$CFLAGS_WARNING,;t t -s,@ZLIB_DLL_FILE@,$ZLIB_DLL_FILE,;t t -s,@ZLIB_LIBS@,$ZLIB_LIBS,;t t -s,@ZLIB_OBJS@,$ZLIB_OBJS,;t t -s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t -s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t -s,@VC_MANIFEST_EMBED_DLL@,$VC_MANIFEST_EMBED_DLL,;t t -s,@VC_MANIFEST_EMBED_EXE@,$VC_MANIFEST_EMBED_EXE,;t t -s,@TCL_WIN_VERSION@,$TCL_WIN_VERSION,;t t -s,@MACHINE@,$MACHINE,;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,@PKG_CFG_ARGS@,$PKG_CFG_ARGS,;t t -s,@TCL_EXE@,$TCL_EXE,;t t -s,@TCL_LIB_FILE@,$TCL_LIB_FILE,;t t -s,@TCL_LIB_FLAG@,$TCL_LIB_FLAG,;t t -s,@TCL_STATIC_LIB_FILE@,$TCL_STATIC_LIB_FILE,;t t -s,@TCL_STATIC_LIB_FLAG@,$TCL_STATIC_LIB_FLAG,;t t -s,@TCL_IMPORT_LIB_FILE@,$TCL_IMPORT_LIB_FILE,;t t -s,@TCL_IMPORT_LIB_FLAG@,$TCL_IMPORT_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 -s,@TCL_INCLUDE_SPEC@,$TCL_INCLUDE_SPEC,;t t -s,@TCL_BUILD_STUB_LIB_SPEC@,$TCL_BUILD_STUB_LIB_SPEC,;t t -s,@TCL_BUILD_STUB_LIB_PATH@,$TCL_BUILD_STUB_LIB_PATH,;t t -s,@TCL_DLL_FILE@,$TCL_DLL_FILE,;t t -s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t -s,@TCL_BIN_DIR@,$TCL_BIN_DIR,;t t -s,@TCL_DBGX@,$TCL_DBGX,;t t -s,@CFG_TCL_SHARED_LIB_SUFFIX@,$CFG_TCL_SHARED_LIB_SUFFIX,;t t -s,@CFG_TCL_UNSHARED_LIB_SUFFIX@,$CFG_TCL_UNSHARED_LIB_SUFFIX,;t t -s,@CFG_TCL_EXPORT_FILE_SUFFIX@,$CFG_TCL_EXPORT_FILE_SUFFIX,;t t -s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t -s,@DEPARG@,$DEPARG,;t t -s,@CC_OBJNAME@,$CC_OBJNAME,;t t -s,@CC_EXENAME@,$CC_EXENAME,;t t -s,@LDFLAGS_DEBUG@,$LDFLAGS_DEBUG,;t t -s,@LDFLAGS_OPTIMIZE@,$LDFLAGS_OPTIMIZE,;t t -s,@LDFLAGS_CONSOLE@,$LDFLAGS_CONSOLE,;t t -s,@LDFLAGS_WINDOW@,$LDFLAGS_WINDOW,;t t -s,@STLIB_LD@,$STLIB_LD,;t t -s,@SHLIB_LD@,$SHLIB_LD,;t t -s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t -s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t -s,@SHLIB_SUFFIX@,$SHLIB_SUFFIX,;t t -s,@TCL_SHARED_BUILD@,$TCL_SHARED_BUILD,;t t -s,@LIBS_GUI@,$LIBS_GUI,;t t -s,@DLLSUFFIX@,$DLLSUFFIX,;t t -s,@LIBPREFIX@,$LIBPREFIX,;t t -s,@LIBSUFFIX@,$LIBSUFFIX,;t t -s,@EXESUFFIX@,$EXESUFFIX,;t t -s,@LIBRARIES@,$LIBRARIES,;t t -s,@MAKE_LIB@,$MAKE_LIB,;t t -s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t -s,@POST_MAKE_LIB@,$POST_MAKE_LIB,;t t -s,@MAKE_DLL@,$MAKE_DLL,;t t -s,@MAKE_EXE@,$MAKE_EXE,;t t -s,@TCL_BUILD_LIB_SPEC@,$TCL_BUILD_LIB_SPEC,;t t -s,@TCL_LD_SEARCH_FLAGS@,$TCL_LD_SEARCH_FLAGS,;t t -s,@TCL_NEEDS_EXP_FILE@,$TCL_NEEDS_EXP_FILE,;t t -s,@TCL_BUILD_EXP_FILE@,$TCL_BUILD_EXP_FILE,;t t -s,@TCL_EXP_FILE@,$TCL_EXP_FILE,;t t -s,@TCL_LIB_VERSIONS_OK@,$TCL_LIB_VERSIONS_OK,;t t -s,@TCL_PACKAGE_PATH@,$TCL_PACKAGE_PATH,;t t -s,@TCL_DDE_VERSION@,$TCL_DDE_VERSION,;t t -s,@TCL_DDE_MAJOR_VERSION@,$TCL_DDE_MAJOR_VERSION,;t t -s,@TCL_DDE_MINOR_VERSION@,$TCL_DDE_MINOR_VERSION,;t t -s,@TCL_REG_VERSION@,$TCL_REG_VERSION,;t t -s,@TCL_REG_MAJOR_VERSION@,$TCL_REG_MAJOR_VERSION,;t t -s,@TCL_REG_MINOR_VERSION@,$TCL_REG_MINOR_VERSION,;t t -s,@RC_OUT@,$RC_OUT,;t t -s,@RC_TYPE@,$RC_TYPE,;t t -s,@RC_INCLUDE@,$RC_INCLUDE,;t t -s,@RC_DEFINE@,$RC_DEFINE,;t t -s,@RC_DEFINES@,$RC_DEFINES,;t t -s,@RES@,$RES,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF -_ACEOF +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift - 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. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # 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` + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # 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. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac -_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 ;; + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; esac - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || + ac_dir=`$as_dirname -- "$ac_file" || $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 - 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; }; }; } - + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p 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 "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # 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_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. 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 ;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix -# 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 + case $ac_mode in + :F) + # + # CONFIG_FILE + # +_ACEOF - 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; } +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub $extrasub _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -{ (exit 0); exit 0; } + esac + +done # for ac_tag + + +as_fn_exit 0 _ACEOF -chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -6278,7 +6430,11 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi diff --git a/win/configure.in b/win/configure.in index aa47505..01366f5 100644 --- a/win/configure.in +++ b/win/configure.in @@ -126,20 +126,16 @@ AS_IF([test "${enable_shared+set}" = "set"], [ ], [ tcl_ok=yes ]) -AS_IF([test "$tcl_ok" = "yes"], [ - AC_SUBST(ZLIB_DLL_FILE,[\${ZLIB_DLL_FILE}]) - AS_IF([test "$do64bit" = "yes"], [ - AS_IF([test "$GCC" == "yes"],[ - AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win64/libz.dll.a]) - ], [ - AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win64/zdll.lib]) - ]) - ], [ - AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win32/zdll.lib]) - ]) -], [ - AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}]) -]) +AC_ARG_WITH(zlib, [ --with-zlib use Native Zlib library], + with_zlib=$withval, with_zlib=NO_ZLIB +) +AS_IF( + [test "with_zlib" = "NO_ZLIB"], [AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}])], + [test "$tcl_ok" != "yes"], [AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}])], + [test "$do64bit" = "yes"], [AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}])], + [test "$with_zlib" = "yes"] , [AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win32/zdll.lib])], + [AC_SUBST(ZLIB_LIBS,[$with_zlib])] +) AC_DEFINE(HAVE_ZLIB, 1, [Is there an installed zlib?]) AC_CHECK_TYPE([intptr_t], [ -- cgit v0.12 From cd9922f497673e31b6fffa759cff4c869927b7fb Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 2 Sep 2014 18:30:23 +0000 Subject: Pared down tclZipVfs to eliminate #ifdef branches that we don't have to worry about with a modern Tcl. Replaced dummy calls to VFS with NULL Where practical, replaced string-based Tcl IO calls with their new obj-based successors. (Tcl_FSOpenChannel, Tcl_FSStat, etc) Eliminated compiler warnings under Windows --- generic/tclZipVfs.c | 360 +++++++++++++--------------------------------------- 1 file changed, 86 insertions(+), 274 deletions(-) diff --git a/generic/tclZipVfs.c b/generic/tclZipVfs.c index 8b1fc3b..9b377c0 100755 --- a/generic/tclZipVfs.c +++ b/generic/tclZipVfs.c @@ -29,10 +29,6 @@ #include #include -#ifdef TCL_FILESYSTEM_VERSION_1 -#define USE_TCL_VFS 1 -#endif - /* * Size of the decompression input buffer */ @@ -285,9 +281,7 @@ CanonicalPath( for (i=j=0 ; (c = zPath[i]) != 0 ; i++) { #ifdef __WIN32__ if (isupper(c)) { - if (maptolower) { - c = tolower(c); - } + c = tolower(c); } else if (c == '\\') { c = '/'; } @@ -411,7 +405,7 @@ ZvfsReadTOCStart( while (1) { int lenName; /* Length of the next filename */ - int lenExtra; /* Length of "extra" data for next file */ + int lenExtra=0; /* Length of "extra" data for next file */ int iData; /* Offset to start of file data */ if (nFile-- <= 0) { @@ -612,7 +606,7 @@ Tcl_Zvfs_Mount( while (1) { int lenName; /* Length of the next filename */ - int lenExtra; /* Length of "extra" data for next file */ + int lenExtra=0; /* Length of "extra" data for next file */ int iData; /* Offset to start of file data */ int dosTime; int dosDate; @@ -740,35 +734,6 @@ ZvfsLookup( return pFile; } -static int -ZvfsLookupMount( - char *zFilename) -{ - char *zTrueName; - Tcl_HashEntry *pEntry; /* Hash table entry */ - Tcl_HashSearch zSearch; /* Search all mount points */ - ZvfsArchive *pArchive; /* The ZIP archive being mounted */ - int match=0; - - if (local.isInit == 0) { - return 0; - } - zTrueName = AbsolutePath(zFilename); - pEntry = Tcl_FirstHashEntry(&local.archiveHash, &zSearch); - while (pEntry) { - pArchive = Tcl_GetHashValue(pEntry); - if (pArchive) { - if (!strcmp(pArchive->zMountPoint, zTrueName)) { - match = 1; - break; - } - } - pEntry = Tcl_NextHashEntry(&zSearch); - } - Tcl_Free(zTrueName); - return match; -} - /* * Unmount all the files in the given ZIP archive. */ @@ -813,13 +778,6 @@ Tcl_Zvfs_Umount( return 1; } -static void -Zvfs_Unmount( - const char *zArchive) -{ - Tcl_Zvfs_Umount(zArchive); -} - /* * zvfs::mount Zip-archive-name mount-point * @@ -832,19 +790,19 @@ Zvfs_Unmount( * string, mount on file path. */ static int -ZvfsMountCmd( +ZvfsMountObjCmd( ClientData clientData, /* Client data for this command */ Tcl_Interp *interp, /* The interpreter used to report errors */ - int argc, /* Number of arguments */ - const char *argv[]) /* Values of all arguments */ + int objc, /* Number of arguments */ + Tcl_Obj *const* objv) /* Values of all arguments */ { /*TODO: Convert to Tcl_Obj API!*/ - if (argc > 3) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + if (objc > 3) { + Tcl_AppendResult(interp, "wrong # args: should be \"", Tcl_GetString(objv[0]), " ? ZIP-FILE ? MOUNT-POINT ? ?\"", 0); return TCL_ERROR; } - return Tcl_Zvfs_Mount(interp, argc>1?argv[1]:NULL, argc>2?argv[2]:NULL); + return Tcl_Zvfs_Mount(interp, objc>1?Tcl_GetString(objv[1]):NULL, objc>2?Tcl_GetString(objv[2]):NULL); } /* @@ -853,33 +811,33 @@ ZvfsMountCmd( * Undo the effects of zvfs::mount. */ static int -ZvfsUnmountCmd( +ZvfsUnmountObjCmd( ClientData clientData, /* Client data for this command */ Tcl_Interp *interp, /* The interpreter used to report errors */ - int argc, /* Number of arguments */ - const char *argv[]) /* Values of all arguments */ + int objc, /* Number of arguments */ + Tcl_Obj *const* objv) /* Values of all arguments */ { ZvfsArchive *pArchive; /* The ZIP archive being mounted */ Tcl_HashEntry *pEntry; /* Hash table entry */ Tcl_HashSearch zSearch; /* Search all mount points */ - - if (argc != 2) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + char *zFilename; + if (objc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", Tcl_GetString(objv[0]), " ZIP-FILE\"", 0); return TCL_ERROR; } - if (Tcl_Zvfs_Umount(argv[1])) { - return TCL_OK; - } - if (!local.isInit) { return TCL_ERROR; } + zFilename=Tcl_GetString(objv[1]); + if (Tcl_Zvfs_Umount(zFilename)) { + return TCL_OK; + } pEntry = Tcl_FirstHashEntry(&local.archiveHash,&zSearch); while (pEntry) { pArchive = Tcl_GetHashValue(pEntry); if (pArchive && pArchive->zMountPoint[0] - && (strcmp(pArchive->zMountPoint, argv[1]) == 0)) { + && (strcmp(pArchive->zMountPoint, zFilename) == 0)) { if (Tcl_Zvfs_Umount(pArchive->zName)) { return TCL_OK; } @@ -888,7 +846,7 @@ ZvfsUnmountCmd( pEntry = Tcl_NextHashEntry(&zSearch); } - Tcl_AppendResult(interp, "unknown zvfs mount point or file: ", argv[1], + Tcl_AppendResult(interp, "unknown zvfs mount point or file: ", zFilename, NULL); return TCL_ERROR; } @@ -1348,7 +1306,7 @@ ZvfsFileOpen( pInfo->readSoFar = 0; Tcl_Seek(chan, INT16(zBuf, 26) + INT16(zBuf, 28), SEEK_CUR); pInfo->startOfData = Tcl_Tell(chan); - sprintf(zName, "vfs_%lx_%x", ((ptrdiff_t)pFile)>>12, count++); + sprintf(zName, "zvfs_%x",count++); chan = Tcl_CreateChannel(&vfsChannelType, zName, pInfo, TCL_READABLE); return chan; } @@ -1357,10 +1315,11 @@ ZvfsFileOpen( * This routine does a stat() system call for a ZVFS file. */ static int -ZvfsFileStat( - char *path, - struct stat *buf) +Tobe_FSStatProc( + Tcl_Obj *pathObj, + Tcl_StatBuf *buf) { + char *path=Tcl_GetString(pathObj); ZvfsFile *pFile; pFile = ZvfsLookup(path); @@ -1385,10 +1344,11 @@ ZvfsFileStat( * This routine does an access() system call for a ZVFS file. */ static int -ZvfsFileAccess( - char *path, +Tobe_FSAccessProc( + Tcl_Obj *pathPtr, int mode) { + char *path=Tcl_GetString(pathPtr); ZvfsFile *pFile; if (mode & 3) { @@ -1401,41 +1361,6 @@ ZvfsFileAccess( return 0; } -#ifndef USE_TCL_VFS - -/* - * This TCL procedure can be used to copy a file. The built-in "file copy" - * command of TCL bypasses the I/O system and does not work with zvfs. You - * have to use a procedure like the following instead. - */ -static char zFileCopy[] = -"proc zvfs::filecopy {from to {outtype binary}} {\n" -" set f [open $from r]\n" -" if {[catch {\n" -" fconfigure $f -translation binary\n" -" set t [open $to w]\n" -" } msg]} {\n" -" close $f\n" -" error $msg\n" -" }\n" -" if {[catch {\n" -" fconfigure $t -translation $outtype\n" -" set size [file size $from]\n" -" for {set i 0} {$i<$size} {incr i 40960} {\n" -" puts -nonewline $t [read $f 40960]\n" -" }\n" -" } msg]} {\n" -" close $f\n" -" close $t\n" -" error $msg\n" -" }\n" -" close $f\n" -" close $t\n" -"}\n" -; - -#else - Tcl_Channel Tobe_FSOpenFileChannelProc( Tcl_Interp *interp, @@ -1457,31 +1382,9 @@ Tobe_FSOpenFileChannelProc( return chan; } -/* - * This routine does a stat() system call for a ZVFS file. - */ -int -Tobe_FSStatProc( - Tcl_Obj *pathPtr, - struct stat *buf) -{ - return ZvfsFileStat(Tcl_GetString(pathPtr), buf); -} - -/* - * This routine does an access() system call for a ZVFS file. - */ -int -Tobe_FSAccessProc( - Tcl_Obj *pathPtr, - int mode) -{ - return ZvfsFileAccess(Tcl_GetString(pathPtr), mode); -} - -/* Tcl_Obj* Tobe_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr) { +Tcl_Obj* Tobe_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr) { return Tcl_NewStringObj("/",-1);; -} */ +} /* * Function to process a 'Tobe_FSMatchInDirectory()'. If not implemented, @@ -1567,10 +1470,7 @@ Tobe_FSPathInFilesystemProc( { ZvfsFile *zFile; char *path = Tcl_GetString(pathPtr); - -// if (ZvfsLookupMount(path)!=0) -// return TCL_OK; -// // TODO: also check this is the archive. + if (openarch) { return -1; } @@ -1605,14 +1505,6 @@ Tobe_FSListVolumesProc(void) return pVols; } -int -Tobe_FSChdirProc( - Tcl_Obj *pathPtr) -{ - /* Someday, we should actually check if this is a valid path. */ - return TCL_OK; -} - const char * const* Tobe_FSFileAttrStringsProc( Tcl_Obj *pathPtr, @@ -1642,7 +1534,9 @@ Tobe_FSFileAttrsGetProc( Tcl_Obj **objPtrRef) { char *path = Tcl_GetString(pathPtr); +#ifndef __WIN32__ char buf[50]; +#endif ZvfsFile *zFile = ZvfsLookup(path); if (zFile == 0) { @@ -1677,79 +1571,15 @@ Tobe_FSFileAttrsGetProc( /****************************************************/ -// At some point, some of the following might get implemented? - -#if 1 -#define Tobe_FSFilesystemSeparatorProc 0 -#define Tobe_FSLoadFileProc 0 -#define Tobe_FSUnloadFileProc 0 -#define Tobe_FSGetCwdProc 0 -#define Tobe_FSGetCwdProc 0 -#define Tobe_FSCreateDirectoryProc 0 -#define Tobe_FSDeleteFileProc 0 -#define Tobe_FSCopyDirectoryProc 0 -#define Tobe_FSCopyFileProc 0 -#define Tobe_FSRemoveDirectoryProc 0 -#define Tobe_FSFileAttrsSetProc 0 -#define Tobe_FSNormalizePathProc 0 -#define Tobe_FSUtimeProc 0 -#define Tobe_FSRenameFileProc 0 -#define Tobe_FSCreateInternalRepProc 0 -#define Tobe_FSInternalToNormalizedProc 0 -#define Tobe_FSDupInternalRepProc 0 -#define Tobe_FSFreeInternalRepProc 0 -#define Tobe_FSFilesystemPathTypeProc 0 -#define Tobe_FSLinkProc 0 -#else - -/* - * Function to process a 'Tobe_FSLoadFile()' call. If not implemented, Tcl - * will fall back on a copy to native-temp followed by a Tobe_FSLoadFile on - * that temporary copy. - */ -int -Tobe_FSLoadFileProc( - Tcl_Interp * interp, - Tcl_Obj *pathPtr, - char * sym1, - char * sym2, - Tcl_PackageInitProc ** proc1Ptr, - Tcl_PackageInitProc ** proc2Ptr, - ClientData * clientDataPtr) -{ - return 0; -} - /* * Function to unload a previously successfully loaded file. If load was * implemented, then this should also be implemented, if there is any cleanup * action required. */ -void Tobe_FSUnloadFileProc(ClientData clientData) { return; } -Tcl_Obj* Tobe_FSGetCwdProc(Tcl_Interp *interp) { return 0; } -int Tobe_FSCreateDirectoryProc(Tcl_Obj *pathPtr) { return 0; } -int Tobe_FSDeleteFileProc(Tcl_Obj *pathPtr) { return 0; } -int Tobe_FSCopyDirectoryProc(Tcl_Obj *srcPathPtr, Tcl_Obj *destPathPtr, - Tcl_Obj **errorPtr) { return 0; } -int Tobe_FSCopyFileProc(Tcl_Obj *srcPathPtr, - Tcl_Obj *destPathPtr) { return 0; } -int Tobe_FSRemoveDirectoryProc(Tcl_Obj *pathPtr, int recursive, - Tcl_Obj **errorPtr) { return 0; } -int Tobe_FSRenameFileProc(Tcl_Obj *srcPathPtr, - Tcl_Obj *destPathPtr) { return 0; } /* We have to declare the utime structure here. */ int Tobe_FSUtimeProc(Tcl_Obj *pathPtr, struct utimbuf *tval) { return 0; } -int Tobe_FSNormalizePathProc(Tcl_Interp *interp, Tcl_Obj *pathPtr, - int nextCheckpoint) { return 0; } int Tobe_FSFileAttrsSetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, Tcl_Obj *objPtr) { return 0; } -Tcl_Obj* Tobe_FSLinkProc(Tcl_Obj *pathPtr) { return 0; } -Tcl_Obj* Tobe_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr) { return 0; } -void Tobe_FSFreeInternalRepProc(ClientData clientData) { return; } -ClientData Tobe_FSDupInternalRepProc(ClientData clientData) { return 0; } -Tcl_Obj* Tobe_FSInternalToNormalizedProc(ClientData clientData) { return 0; } -ClientData Tobe_FSCreateInternalRepProc(Tcl_Obj *pathPtr) { return 0; } -#endif static Tcl_Filesystem Tobe_Filesystem = { "tobe", /* The name of the filesystem. */ @@ -1759,17 +1589,17 @@ static Tcl_Filesystem Tobe_Filesystem = { Tobe_FSPathInFilesystemProc,/* Function to check whether a path is in this * filesystem. This is the most important * filesystem procedure. */ - Tobe_FSDupInternalRepProc, /* Function to duplicate internal fs rep. May + NULL, /* Function to duplicate internal fs rep. May * be NULL (but then fs is less efficient). */ - Tobe_FSFreeInternalRepProc, /* Function to free internal fs rep. Must be + NULL, /* Function to free internal fs rep. Must be * implemented, if internal representations * need freeing, otherwise it can be NULL. */ - Tobe_FSInternalToNormalizedProc, + NULL, /* Function to convert internal representation * to a normalized path. Only required if the * fs creates pure path objects with no * string/path representation. */ - Tobe_FSCreateInternalRepProc, + NULL, /* Function to create a filesystem-specific * internal representation. May be NULL if * paths have no internal representation, or @@ -1777,11 +1607,11 @@ static Tcl_Filesystem Tobe_Filesystem = { * filesystem always immediately creates an * internal representation for paths it * accepts. */ - Tobe_FSNormalizePathProc, /* Function to normalize a path. Should be + NULL, /* Function to normalize a path. Should be * implemented for all filesystems which can * have multiple string representations for * the same path object. */ - Tobe_FSFilesystemPathTypeProc, + NULL, /* Function to determine the type of a path in * this filesystem. May be NULL. */ Tobe_FSFilesystemSeparatorProc, @@ -1808,7 +1638,7 @@ static Tcl_Filesystem Tobe_Filesystem = { * reading) of times with 'file mtime', 'file * atime' and the open-r/open-w/fcopy * implementation of 'file copy'. */ - Tobe_FSLinkProc, /* Function to process a 'Tobe_FSLink()' call. + NULL, /* Function to process a 'Tobe_FSLink()' call. * Should be implemented only if the * filesystem supports links. */ Tobe_FSListVolumesProc, /* Function to list any filesystem volumes @@ -1828,42 +1658,42 @@ static Tcl_Filesystem Tobe_Filesystem = { Tobe_FSFileAttrsSetProc, /* Function to process a * 'Tobe_FSFileAttrsSet()' call, used by 'file * attributes'. */ - Tobe_FSCreateDirectoryProc, /* Function to process a + NULL, /* Function to process a * 'Tobe_FSCreateDirectory()' call. Should be * implemented unless the FS is read-only. */ - Tobe_FSRemoveDirectoryProc, /* Function to process a + NULL, /* Function to process a * 'Tobe_FSRemoveDirectory()' call. Should be * implemented unless the FS is read-only. */ - Tobe_FSDeleteFileProc, /* Function to process a 'Tobe_FSDeleteFile()' + NULL, /* Function to process a 'Tobe_FSDeleteFile()' * call. Should be implemented unless the FS * is read-only. */ - Tobe_FSCopyFileProc, /* Function to process a 'Tobe_FSCopyFile()' + NULL, /* Function to process a 'Tobe_FSCopyFile()' * call. If not implemented Tcl will fall * back on open-r, open-w and fcopy as a * copying mechanism. */ - Tobe_FSRenameFileProc, /* Function to process a 'Tobe_FSRenameFile()' + NULL, /* Function to process a 'Tobe_FSRenameFile()' * call. If not implemented, Tcl will fall * back on a copy and delete mechanism. */ - Tobe_FSCopyDirectoryProc, /* Function to process a + NULL, /* Function to process a * 'Tobe_FSCopyDirectory()' call. If not * implemented, Tcl will fall back on a * recursive create-dir, file copy * mechanism. */ - Tobe_FSLoadFileProc, /* Function to process a 'Tobe_FSLoadFile()' + NULL, /* Function to process a 'Tobe_FSLoadFile()' * call. If not implemented, Tcl will fall * back on a copy to native-temp followed by a * Tobe_FSLoadFile on that temporary copy. */ - Tobe_FSUnloadFileProc, /* Function to unload a previously + NULL, /* Function to unload a previously * successfully loaded file. If load was * implemented, then this should also be * implemented, if there is any cleanup action * required. */ - Tobe_FSGetCwdProc, /* Function to process a 'Tobe_FSGetCwd()' + NULL, /* Function to process a 'Tobe_FSGetCwd()' * call. Most filesystems need not implement * this. It will usually only be called once, * if 'getcwd' is called before 'chdir'. May * be NULL. */ - Tobe_FSChdirProc, /* Function to process a 'Tobe_FSChdir()' + NULL, /* Function to process a 'Tobe_FSChdir()' * call. If filesystems do not implement this, * it will be emulated by a series of * directory access checks. Otherwise, virtual @@ -1880,8 +1710,6 @@ static Tcl_Filesystem Tobe_Filesystem = { * filesystem. */ }; -#endif - ////////////////////////////////////////////////////////////// void (*Zvfs_PostInit)(Tcl_Interp *) = 0; @@ -1898,7 +1726,6 @@ Zvfs_doInit( Tcl_Interp *interp, int safe) { - int n; #ifdef USE_TCL_STUBS if (Tcl_InitStubs(interp, "8.0", 0) == 0) { return TCL_ERROR; @@ -1906,8 +1733,8 @@ Zvfs_doInit( #endif Tcl_StaticPackage(interp, "zvfs", Tcl_Zvfs_Init, Tcl_Zvfs_SafeInit); if (!safe) { - Tcl_CreateCommand(interp, "zvfs::mount", ZvfsMountCmd, 0, 0); - Tcl_CreateCommand(interp, "zvfs::unmount", ZvfsUnmountCmd, 0, 0); + Tcl_CreateObjCommand(interp, "zvfs::mount", ZvfsMountObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "zvfs::unmount", ZvfsUnmountObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "zvfs::append", ZvfsAppendObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "zvfs::add", ZvfsAddObjCmd, 0, 0); } @@ -1919,22 +1746,12 @@ Zvfs_doInit( Tcl_SetVar(interp, "::zvfs::auto_ext", ".tcl .tk .itcl .htcl .txt .c .h .tht", TCL_GLOBAL_ONLY); /* Tcl_CreateObjCommand(interp, "zip::open", ZipOpenObjCmd, 0, 0); */ -#ifndef USE_TCL_VFS - Tcl_GlobalEval(interp, zFileCopy); -#endif + if (!local.isInit) { /* One-time initialization of the ZVFS */ -#ifdef USE_TCL_VFS - n = Tcl_FSRegister(0, &Tobe_Filesystem); -#else - extern void TclAccessInsertProc(); - extern void TclStatInsertProc(); - extern void TclOpenFileChannelInsertProc(); - - TclAccessInsertProc(ZvfsFileAccess); - TclStatInsertProc(ZvfsFileStat); - TclOpenFileChannelInsertProc(ZvfsFileOpen); -#endif + if(Tcl_FSRegister(NULL, &Tobe_Filesystem)) { + return TCL_ERROR; + } Tcl_InitHashTable(&local.fileHash, TCL_STRING_KEYS); Tcl_InitHashTable(&local.archiveHash, TCL_STRING_KEYS); local.isInit = 1; @@ -1979,7 +1796,7 @@ ZvfsDumpObjCmd( int objc, /* Number of arguments */ Tcl_Obj *const* objv) /* Values of all arguments */ { - char *zFilename; + Tcl_Obj *zFilenameObj; Tcl_Channel chan; ZFile *pList; int rc; @@ -1989,8 +1806,8 @@ ZvfsDumpObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "FILENAME"); return TCL_ERROR; } - zFilename = Tcl_GetString(objv[1]); - chan = Tcl_OpenFileChannel(interp, zFilename, "r", 0); + zFilenameObj=objv[1]; + chan = Tcl_FSOpenFileChannel(interp, zFilenameObj, "r", 0); if (chan == 0) { return TCL_ERROR; } @@ -2021,7 +1838,7 @@ ZvfsDumpObjCmd( Tcl_ListObjAppendElement(interp, pResult, pEntry); pNext = pList->pNext; Tcl_Free((void *) pList); - pList = pList->pNext; + pList = pNext; } return TCL_OK; } @@ -2037,10 +1854,12 @@ writeFile( Tcl_Interp *interp, /* Leave an error message here */ Tcl_Channel out, /* Write the file here */ Tcl_Channel in, /* Read data from this file */ - char *zSrc, /* Name the new ZIP file entry this */ - char *zDest, /* Name the new ZIP file entry this */ + Tcl_Obj *zSrcPtr, /* Name the new ZIP file entry this */ + Tcl_Obj *zDestPtr, /* Name the new ZIP file entry this */ ZFile **ppList) /* Put a ZFile struct for the new file here */ { + char *zDest=Tcl_GetString(zDestPtr); + z_stream stream; ZFile *p; int iEndOfData; @@ -2052,7 +1871,7 @@ writeFile( char zOutBuf[100000]; struct tm *tm; time_t now; - struct stat stat; + Tcl_StatBuf stat; /* * Create a new ZFile structure for this file. @@ -2062,7 +1881,7 @@ writeFile( p = newZFile(nameLen, ppList); strcpy(p->zName, zDest); p->isSpecial = 0; - Tcl_Stat(zSrc, &stat); + Tcl_FSStat(zSrcPtr, &stat); now = stat.st_mtime; tm = localtime(&now); UnixTimeDate(tm, &p->dosDate, &p->dosTime); @@ -2112,16 +1931,8 @@ writeFile( stream.next_in = (unsigned char *) zInBuf; stream.avail_out = sizeof(zOutBuf); stream.next_out = (unsigned char *) zOutBuf; -#if 1 deflateInit(&stream, 9); -#else - { - int i, err, WSIZE = 0x8000, windowBits, level=6; - for (i = ((unsigned)WSIZE), windowBits = 0; i != 1; i >>= 1, ++windowBits); - err = deflateInit2(&stream, level, Z_DEFLATED, -windowBits, 8, 0); - } -#endif p->iCRC = crc32(0, 0, 0); while (!Tcl_Eof(in)) { @@ -2341,7 +2152,7 @@ ZvfsAppendObjCmd( int objc, /* Number of arguments */ Tcl_Obj *const* objv) /* Values of all arguments */ { - char *zArchive; + Tcl_Obj *zArchiveObj; Tcl_Channel chan; ZFile *pList = NULL, *pToc; int rc = TCL_OK, i; @@ -2355,10 +2166,10 @@ ZvfsAppendObjCmd( return TCL_ERROR; } - zArchive = Tcl_GetString(objv[1]); - chan = Tcl_OpenFileChannel(interp, zArchive, "r+", 0644); + zArchiveObj=objv[1]; + chan = Tcl_FSOpenFileChannel(interp, zArchiveObj, "r+", 0644); if (chan == 0) { - chan = Tcl_OpenFileChannel(interp, zArchive, "w+", 0644); + chan = Tcl_FSOpenFileChannel(interp, zArchiveObj, "w+", 0644); if (chan == 0) { return TCL_ERROR; } @@ -2401,15 +2212,15 @@ ZvfsAppendObjCmd( */ for (i=2; rc==TCL_OK && i Date: Tue, 2 Sep 2014 20:16:54 +0000 Subject: Added a hac^H^H^Hpatch from ferrieux to mask around the exit hang on windows until the issues are fixed at the core level. --- generic/tclEvent.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 941d566..3bb6c62 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1299,18 +1299,19 @@ Tcl_FinalizeThread(void) TclFinalizeAsync(); TclFinalizeThreadObjects(); } - - /* - * Blow away all thread local storage blocks. - * - * Note that Tcl API allows creation of threads which do not use any Tcl - * interp or other Tcl subsytems. Those threads might, however, use thread - * local storage, so we must unconditionally finalize it. - * - * Fix [Bug #571002] - */ - - TclFinalizeThreadData(); + if (!TclInExit()) { + /* + * Blow away all thread local storage blocks. + * + * Note that Tcl API allows creation of threads which do not use any Tcl + * interp or other Tcl subsytems. Those threads might, however, use thread + * local storage, so we must unconditionally finalize it. + * + * Fix [Bug #571002] + */ + + TclFinalizeThreadData(); + } } /* -- cgit v0.12 From 8ca1a78b1a5befabf5e8d8e27bd5d80fb6ab9582 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 2 Sep 2014 20:26:50 +0000 Subject: Revised patch (per ferrieux) --- generic/tclEvent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 3bb6c62..a7cd467 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1299,7 +1299,7 @@ Tcl_FinalizeThread(void) TclFinalizeAsync(); TclFinalizeThreadObjects(); } - if (!TclInExit()) { + if (TclFullFinalizationRequested()) { /* * Blow away all thread local storage blocks. * -- cgit v0.12 From 06547a29be3e6ccdecc327ce843d939bea668600 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 2 Sep 2014 21:16:20 +0000 Subject: Fix for the cases where a dynamic build is used --- win/configure | 41 ++++++++++++++++++++++++++++++++--------- win/configure.in | 24 +++++++++++++++++++----- 2 files changed, 51 insertions(+), 14 deletions(-) diff --git a/win/configure b/win/configure index d8ee198..4414f2d 100755 --- a/win/configure +++ b/win/configure @@ -678,8 +678,9 @@ VC_MANIFEST_EMBED_EXE VC_MANIFEST_EMBED_DLL LDFLAGS_DEFAULT CFLAGS_DEFAULT -ZLIB_LIBS ZLIB_OBJS +ZLIB_LIBS +ZLIB_DLL_FILE CFLAGS_WARNING CFLAGS_OPTIMIZE CFLAGS_DEBUG @@ -4669,20 +4670,42 @@ else fi -if test "with_zlib" = "NO_ZLIB"; then : - ZLIB_OBJS=\${ZLIB_OBJS} +if test "$tcl_ok" = "yes"; then : -elif test "$tcl_ok" != "yes"; then : - ZLIB_OBJS=\${ZLIB_OBJS} + ZLIB_DLL_FILE=\${ZLIB_DLL_FILE} -elif test "$do64bit" = "yes"; then : - ZLIB_OBJS=\${ZLIB_OBJS} +fi +tcl_no_zlib_dll=no +if test "$with_zlib" = "NO_ZLIB"; then : + tcl_no_zlib_dll=yes +elif test "$tcl_ok" != "yes"; then : + tcl_no_zlib_dll=yes +elif test "$do64bit" = "yes"; then : + tcl_no_zlib_dll=yes elif test "$with_zlib" = "yes" ; then : - ZLIB_LIBS=\${ZLIB_DIR}/win32/zdll.lib + + ZLIB_DLL_FILE=\${ZLIB_DLL_FILE} + + ZLIB_LIBS=\${ZLIB_DIR}/win32/zdll.lib + else - ZLIB_LIBS=$with_zlib + + ZLIB_DLL_FILE=${with_zlib} + + ZLIB_LIBS=$with_zlib + + + +fi +if test "$tcl_no_zlib_dll" = "yes"; then : + + ZLIB_OBJS=\${ZLIB_OBJS} + + ZLIB_DLL_FILE="" + + ZLIB_LIBS="" fi diff --git a/win/configure.in b/win/configure.in index 01366f5..dec470a 100644 --- a/win/configure.in +++ b/win/configure.in @@ -129,13 +129,27 @@ AS_IF([test "${enable_shared+set}" = "set"], [ AC_ARG_WITH(zlib, [ --with-zlib use Native Zlib library], with_zlib=$withval, with_zlib=NO_ZLIB ) +AS_IF([test "$tcl_ok" = "yes"], [ + AC_SUBST(ZLIB_DLL_FILE,[\${ZLIB_DLL_FILE}]) +]) +tcl_no_zlib_dll=no AS_IF( - [test "with_zlib" = "NO_ZLIB"], [AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}])], - [test "$tcl_ok" != "yes"], [AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}])], - [test "$do64bit" = "yes"], [AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}])], - [test "$with_zlib" = "yes"] , [AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win32/zdll.lib])], - [AC_SUBST(ZLIB_LIBS,[$with_zlib])] + [test "$with_zlib" = "NO_ZLIB"], [tcl_no_zlib_dll=yes], + [test "$tcl_ok" != "yes"], [tcl_no_zlib_dll=yes], + [test "$do64bit" = "yes"], [tcl_no_zlib_dll=yes], + [test "$with_zlib" = "yes"] , [ + AC_SUBST(ZLIB_DLL_FILE,[\${ZLIB_DLL_FILE}]) + AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win32/zdll.lib]) + ], [ + AC_SUBST(ZLIB_DLL_FILE,[${with_zlib}]) + AC_SUBST(ZLIB_LIBS,[$with_zlib]) + ] ) +AS_IF([test "$tcl_no_zlib_dll" = "yes"], [ + AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}]) + AC_SUBST(ZLIB_DLL_FILE,[""]) + AC_SUBST(ZLIB_LIBS,[""]) +]) AC_DEFINE(HAVE_ZLIB, 1, [Is there an installed zlib?]) AC_CHECK_TYPE([intptr_t], [ -- cgit v0.12 From 6c2512bc35c2c94e80f3bac2dc723147db4d6461 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 3 Sep 2014 10:24:53 +0000 Subject: Clean up of docs, import basic text from comments in code, format. --- doc/zvfs.n | 153 +++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 114 insertions(+), 39 deletions(-) diff --git a/doc/zvfs.n b/doc/zvfs.n index ba33fb6..f2ad9aa 100644 --- a/doc/zvfs.n +++ b/doc/zvfs.n @@ -1,39 +1,114 @@ -'\" -'\" Copyright (c) 2014 Sean Woods -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH zvfs n 0.1 Zvfs "Zvfs Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -http \- Client-side implementation of the HTTP/1.1 protocol -.SH SYNOPSIS -\fBpackage require zvfs ?0.1?\fR -.sp -\fB::zvfs::mount \fIZIPFILE \fIMOUNTPOINT\fR ...? -.sp -\fB::zvfs::unmount \fIZIPFILE\fR ...? -.sp -\fB::zvfs::append ?\fI\-option value\fR ...? -.sp -\fB::zvfs::add ?\fI\-option value\fR ...? -.sp -\fB::zvfs::exists ?\fI\-option value\fR ...? -.sp -\fB::zvfs::info ?\fI\-option value\fR ...? -.sp -\fB::zvfs::list ?\fI\-option value\fR ...? -.sp -\fB::zvfs::dump ?\fI\-option value\fR ...? -.sp -\fB::zvfs::start ?\fI\-option value\fR ...? -.BE -.SH DESCRIPTION -.PP -The \fBzvfs\fR package provides tcl with the ability to manipulate -the contents of a zip file archive as a virtual file system. -.PP -The \fB::zvfs::mount\fR procedure mounts a zipfile as a VFS. \ No newline at end of file +'\" +'\" Copyright (c) 2014 Sean Woods +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +.TH zvfs n 0.1 Zvfs "Zvfs Commands" +.so man.macros +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +zvfs \- Mount and work with ZIP files within Tcl +.SH SYNOPSIS +.nf +\fBpackage require zvfs \fR?\fB0.1\fR? +.sp +\fB::zvfs::add\fR ?\fB\-fconfigure \fIoptpairs...\fR? \fIarchive file1\fR ?\fIfile2 ...\fR? +\fB::zvfs::append\fR \fIarchive\fR ?\fIsource destination\fR? ?\fIsource destination...\fR? +\fB::zvfs::dump\fR \fIzipfile\fR +\fB::zvfs::exists\fR \fIfilename\fR +\fB::zvfs::info\fR \fIfile\fR +\fB::zvfs::list\fR ?\fB\-glob\fR|\fB\-regexp\fR? ?\fIpattern\fR? +\fB::zvfs::mount ?\fIarchive\fR? ?\fImountpoint\fR? +\fB::zvfs::start\fR \fIzipfile\fR +\fB::zvfs::unmount \fIarchive\fR +.fi +.BE +.SH DESCRIPTION +.PP +The \fBzvfs\fR package provides tcl with the ability to manipulate +the contents of a zip file archive as a virtual file system. +.TP +\fB::zvfs::mount ?\fIarchive\fR? ?\fImountpoint\fR? +. +The \fB::zvfs::mount\fR procedure mounts a zipfile as a VFS. +After this command +executes, files contained in the ZIP archive, \fIarchive\fR, will appear to Tcl to be +regular files at the mount point. +.RS +.PP +With no \fImountpoint\fR, returns the mount point for \fIarchive\fR. With no \fIarchive\fR, +return all archive/mount pairs. If \fImountpoint\fR is specified as an empty +string, mount on file path. +.RE +.TP +\fB::zvfs::unmount \fIarchive\fR +. +Unmounts a previously mounted zip, \fIarchive\fR. +.TP +\fB::zvfs::append\fR \fIarchive\fR ?\fIsource destination\fR? ?\fIsource destination...\fR? +. +This command reads \fIsource\fR files and appends them (using the name +\fIdestination\fR) to the zip archive named \fIarchive\fR. A new zip archive is created +if it does not already exist. If \fIarchive\fR refers to a file which exists but +is not a zip archive, then this command turns \fIarchive\fR into a zip archive by +appending the necessary records and the table of contents. Treat all files +as binary. +.RS +.PP +Note: No duplicate checking is done, so multiple occurances of the same file is +allowed. +.RE +.TP +\fB::zvfs::add\fR ?\fB\-fconfigure \fIoptpairs...\fR? \fIarchive file1\fR ?\fIfile2 ...\fR? +. +This command is similar to \fBzvfs::append\fR in that it adds files to the zip archive +named \fIarchive\fR, however file names are relative the current directory. In +addition, \fBfconfigure\fR is used to apply option pairs to set upon opening of +each file. Otherwise, default translation is allowed for those file +extensions listed in the \fB::zvfs::auto_ext\fR variable. Binary translation will be +used for unknown extensions. +.RS +.PP +NOTE: Use +.QW "\fB\-fconfigure {}\fR" +to use auto translation for all. +.RE +.TP +\fB::zvfs::exists\fR \fIfilename\fR +. +Return TRUE if the given filename exists in the mounted ZVFS and FALSE if it does +not. +.TP +\fB::zvfs::info\fR \fIfile\fR +. +Return information about the given file in the mounted ZVFS. The information +consists of (1) the name of the ZIP archive that contains the file, (2) the +size of the file after decompressions, (3) the compressed size of the file, +and (4) the offset of the compressed data in the archive. +.RS +.PP +Note: querying the mount point gives the start of zip data offset in (4), +which can be used to truncate the zip info off an executable. +.RE +.TP +\fB::zvfs::list\fR ?\fB\-glob\fR|\fB\-regexp\fR? ?\fIpattern\fR? +. +Return a list of all files in the mounted ZVFS. The order of the names in the list +is arbitrary. +.TP +\fB::zvfs::dump\fR \fIzipfile\fR +. +Describe the contents of a zip. +.TP +\fB::zvfs::start\fR \fIzipfile\fR +. +This command strips returns the offset of zip data. +.SH "SEE ALSO" +tclsh(1), file(n), zlib(n) +.SH "KEYWORDS" +compress, filesystem, zip +'\" Local Variables: +'\" mode: nroff +'\" End: -- cgit v0.12 From 8d1d673760dab89fb53dc4ef0f4366c432e80bd5 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Wed, 3 Sep 2014 10:50:06 +0000 Subject: Backported dkf's documentation effort to the main core_zip_vfs branch --- doc/tclsh.1 | 9 +++++ doc/zvfs.n | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 doc/zvfs.n diff --git a/doc/tclsh.1 b/doc/tclsh.1 index 6ed5eb6..25d97c5 100644 --- a/doc/tclsh.1 +++ b/doc/tclsh.1 @@ -143,6 +143,15 @@ incomplete commands. .SH "STANDARD CHANNELS" .PP See \fBTcl_StandardChannels\fR for more explanations. +.SH ZIPVFS +.PP +When a zipfile is concatenated to the end of a \fBtclsh\fR, on +startup the contents of the zip archive will be mounted as the +virtual file system /zvfs. If a top level directory tcl8.6 is +present in the zip archive, it will become the directory loaded +as env(TCL_LIBRARY). If a file named \fBmain.tcl\fR is present +in the top level directory of the zip archive, it will be sourced +instead of the shell's normal command line handing. .SH "SEE ALSO" auto_path(n), encoding(n), env(n), fconfigure(n) .SH KEYWORDS diff --git a/doc/zvfs.n b/doc/zvfs.n new file mode 100644 index 0000000..f2ad9aa --- /dev/null +++ b/doc/zvfs.n @@ -0,0 +1,114 @@ +'\" +'\" Copyright (c) 2014 Sean Woods +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +.TH zvfs n 0.1 Zvfs "Zvfs Commands" +.so man.macros +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +zvfs \- Mount and work with ZIP files within Tcl +.SH SYNOPSIS +.nf +\fBpackage require zvfs \fR?\fB0.1\fR? +.sp +\fB::zvfs::add\fR ?\fB\-fconfigure \fIoptpairs...\fR? \fIarchive file1\fR ?\fIfile2 ...\fR? +\fB::zvfs::append\fR \fIarchive\fR ?\fIsource destination\fR? ?\fIsource destination...\fR? +\fB::zvfs::dump\fR \fIzipfile\fR +\fB::zvfs::exists\fR \fIfilename\fR +\fB::zvfs::info\fR \fIfile\fR +\fB::zvfs::list\fR ?\fB\-glob\fR|\fB\-regexp\fR? ?\fIpattern\fR? +\fB::zvfs::mount ?\fIarchive\fR? ?\fImountpoint\fR? +\fB::zvfs::start\fR \fIzipfile\fR +\fB::zvfs::unmount \fIarchive\fR +.fi +.BE +.SH DESCRIPTION +.PP +The \fBzvfs\fR package provides tcl with the ability to manipulate +the contents of a zip file archive as a virtual file system. +.TP +\fB::zvfs::mount ?\fIarchive\fR? ?\fImountpoint\fR? +. +The \fB::zvfs::mount\fR procedure mounts a zipfile as a VFS. +After this command +executes, files contained in the ZIP archive, \fIarchive\fR, will appear to Tcl to be +regular files at the mount point. +.RS +.PP +With no \fImountpoint\fR, returns the mount point for \fIarchive\fR. With no \fIarchive\fR, +return all archive/mount pairs. If \fImountpoint\fR is specified as an empty +string, mount on file path. +.RE +.TP +\fB::zvfs::unmount \fIarchive\fR +. +Unmounts a previously mounted zip, \fIarchive\fR. +.TP +\fB::zvfs::append\fR \fIarchive\fR ?\fIsource destination\fR? ?\fIsource destination...\fR? +. +This command reads \fIsource\fR files and appends them (using the name +\fIdestination\fR) to the zip archive named \fIarchive\fR. A new zip archive is created +if it does not already exist. If \fIarchive\fR refers to a file which exists but +is not a zip archive, then this command turns \fIarchive\fR into a zip archive by +appending the necessary records and the table of contents. Treat all files +as binary. +.RS +.PP +Note: No duplicate checking is done, so multiple occurances of the same file is +allowed. +.RE +.TP +\fB::zvfs::add\fR ?\fB\-fconfigure \fIoptpairs...\fR? \fIarchive file1\fR ?\fIfile2 ...\fR? +. +This command is similar to \fBzvfs::append\fR in that it adds files to the zip archive +named \fIarchive\fR, however file names are relative the current directory. In +addition, \fBfconfigure\fR is used to apply option pairs to set upon opening of +each file. Otherwise, default translation is allowed for those file +extensions listed in the \fB::zvfs::auto_ext\fR variable. Binary translation will be +used for unknown extensions. +.RS +.PP +NOTE: Use +.QW "\fB\-fconfigure {}\fR" +to use auto translation for all. +.RE +.TP +\fB::zvfs::exists\fR \fIfilename\fR +. +Return TRUE if the given filename exists in the mounted ZVFS and FALSE if it does +not. +.TP +\fB::zvfs::info\fR \fIfile\fR +. +Return information about the given file in the mounted ZVFS. The information +consists of (1) the name of the ZIP archive that contains the file, (2) the +size of the file after decompressions, (3) the compressed size of the file, +and (4) the offset of the compressed data in the archive. +.RS +.PP +Note: querying the mount point gives the start of zip data offset in (4), +which can be used to truncate the zip info off an executable. +.RE +.TP +\fB::zvfs::list\fR ?\fB\-glob\fR|\fB\-regexp\fR? ?\fIpattern\fR? +. +Return a list of all files in the mounted ZVFS. The order of the names in the list +is arbitrary. +.TP +\fB::zvfs::dump\fR \fIzipfile\fR +. +Describe the contents of a zip. +.TP +\fB::zvfs::start\fR \fIzipfile\fR +. +This command strips returns the offset of zip data. +.SH "SEE ALSO" +tclsh(1), file(n), zlib(n) +.SH "KEYWORDS" +compress, filesystem, zip +'\" Local Variables: +'\" mode: nroff +'\" End: -- cgit v0.12 From b6f9bc7ca80044ec0d8f106974a7adb0544a339f Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Wed, 3 Sep 2014 20:41:12 +0000 Subject: More tweaks to makefiles --- unix/Makefile.in | 1 - win/Makefile.in | 13 ++++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 8f260d0..f9d713d 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -654,7 +654,6 @@ null.zip: zip null.zip .empty ${TCLKIT_EXE}: ${TCL_EXE} null.zip - rm -f tclkit.zip PWD=`pwd` cp -f ${TCL_EXE} ${TCLKIT_EXE} cat null.zip >> ${TCLKIT_EXE} diff --git a/win/Makefile.in b/win/Makefile.in index f302ed6..d99e204 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -426,12 +426,15 @@ $(TCLSH): $(TCLSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) tclkit: $(TCLKIT) -$(TCLKIT): $(TCLSH) - rm -f tclkit.zip +null.zip: + touch .empty + zip null.zip .empty + +$(TCLKIT): $(TCLSH) null.zip PWD=`pwd` - cd ${prefix}/lib ; zip -rq ${PWD}/tclkit.zip tcl8 tcl8.6 - cp -f $(TCLSH) $(TCLKIT) - cat tclkit.zip >> $(TCLKIT) + cp -f $(WISH) $(TCLKIT) + cat null.zip >> $(TCLKIT) + cd ${prefix}/lib ; zip -rAq ${PWD}/$(TCLKIT) tcl8 tcl8.6 cat32.$(OBJEXT): cat.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) -- cgit v0.12 From 4691bea988bc3a8d8eb072348163aa2e17c69b85 Mon Sep 17 00:00:00 2001 From: tne Date: Wed, 3 Sep 2014 22:03:08 +0000 Subject: Typo Fix --- win/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/Makefile.in b/win/Makefile.in index d99e204..0874147 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -432,7 +432,7 @@ null.zip: $(TCLKIT): $(TCLSH) null.zip PWD=`pwd` - cp -f $(WISH) $(TCLKIT) + cp -f $(TCLSH) $(TCLKIT) cat null.zip >> $(TCLKIT) cd ${prefix}/lib ; zip -rAq ${PWD}/$(TCLKIT) tcl8 tcl8.6 -- cgit v0.12 From b992e62207d7ecfeeacc81983c34cad57423930d Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Thu, 4 Sep 2014 00:30:04 +0000 Subject: Re-engineered the windows kitbuilding process to produce a standalone executable (in a similar process as tcltest is made). The kit specific functions of tclAppInit have been wrapped around define macros, and are only active if TCL_KIT is defined. (Which is only done when building the tclkit executable) --- generic/tclZipVfs.c | 3 +++ win/Makefile.in | 14 +++++++++++--- win/tclAppInit.c | 10 +++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/generic/tclZipVfs.c b/generic/tclZipVfs.c index 7baf469..ed2ddcc 100755 --- a/generic/tclZipVfs.c +++ b/generic/tclZipVfs.c @@ -1785,7 +1785,10 @@ int Tcl_Zvfs_Boot(Tcl_Interp *interp) { Tcl_IncrRefCount(vfstklib); if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { + /* Startup script should be set before calling Tcl_AppInit */ Tcl_SetStartupScript(vfsinitscript,NULL); + } else { + Tcl_SetStartupScript(NULL,NULL); } if(Tcl_FSAccess(vfstcllib,F_OK)==0) { Tcl_SetVar2(interp, "env", "TCL_LIBRARY", Tcl_GetString(vfstcllib), TCL_GLOBAL_ONLY); diff --git a/win/Makefile.in b/win/Makefile.in index 0874147..3e44cff 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -392,6 +392,9 @@ STUB_OBJS = \ TCLSH_OBJS = tclAppInit.$(OBJEXT) +TCLKIT_OBJS = tclKitInit.$(OBJEXT) + + ZLIB_OBJS = \ adler32.$(OBJEXT) \ compress.$(OBJEXT) \ @@ -428,11 +431,13 @@ tclkit: $(TCLKIT) null.zip: touch .empty - zip null.zip .empty + zip -q null.zip .empty -$(TCLKIT): $(TCLSH) null.zip +$(TCLKIT): $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip + $(CC) $(CFLAGS) $(TCLKIT_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ + tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) + @VC_MANIFEST_EMBED_EXE@ PWD=`pwd` - cp -f $(TCLSH) $(TCLKIT) cat null.zip >> $(TCLKIT) cd ${prefix}/lib ; zip -rAq ${PWD}/$(TCLKIT) tcl8 tcl8.6 @@ -499,6 +504,9 @@ testMain.${OBJEXT}: tclAppInit.c tclMain2.${OBJEXT}: tclMain.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_ASCII_MAIN @DEPARG@ $(CC_OBJNAME) +tclKitInit.$(OBJEXT): tclAppInit.c + $(CC) -c $(CC_SWITCHES) -DTCL_KIT @DEPARG@ $(CC_OBJNAME) + # TIP #59, embedding of configuration information into the binary library. # # Part of Tcl's configuration information are the paths where it was installed diff --git a/win/tclAppInit.c b/win/tclAppInit.c index a8eac66..c6b3b44 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -15,7 +15,6 @@ */ #include "tcl.h" -#include "tclInt.h" #define WIN32_LEAN_AND_MEAN #include #undef WIN32_LEAN_AND_MEAN @@ -124,7 +123,11 @@ _tmain( #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif - +#if defined TCL_KIT + /* This voodoo ensures that Tcl_Main does not eat the first argument */ + Tcl_FindExecutable(argv[0]); + Tcl_SetStartupScript(Tcl_NewStringObj("/zvfs/main.tcl",-1),NULL); +#endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } @@ -152,8 +155,9 @@ int Tcl_AppInit( Tcl_Interp *interp) /* Interpreter for application. */ { +#if defined TCL_KIT Tcl_Zvfs_Boot(interp); - +#endif if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } -- cgit v0.12 From 703177e26a844971a0376dd6feb70d586a8bae97 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Thu, 4 Sep 2014 01:22:20 +0000 Subject: Adapted the Unix startup process to ifdef out the KIT specific behaviors. tclkit is now build as a standalone exectuble. --- unix/Makefile.in | 18 +++++++++++++----- unix/tclAppInit.c | 11 +++++++++-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index f9d713d..8f77687 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -285,6 +285,9 @@ ${AC_FLAGS} ${PROTO_FLAGS} ${EXTRA_CFLAGS} @EXTRA_CC_SWITCHES@ TCLSH_OBJS = tclAppInit.o +TCLKIT_OBJS = tclKitInit.o + + TCLTEST_OBJS = tclTestInit.o tclTest.o tclTestObj.o tclTestProcBodyObj.o \ tclThreadTest.o tclUnixTest.o @@ -648,19 +651,24 @@ ${TCL_EXE}: ${TCLSH_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} ${CC} ${CFLAGS} ${LDFLAGS} ${TCLSH_OBJS} \ @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCL_EXE} + +# Must be empty so it doesn't conflict with rule for ${TCL_EXE} above +${NATIVE_TCLSH}: null.zip: touch .empty zip null.zip .empty -${TCLKIT_EXE}: ${TCL_EXE} null.zip +${TCLKIT_EXE}: ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} null.zip + $(CC) -c $(APP_CC_SWITCHES) \ + -DTCL_KIT $(UNIX_DIR)/tclAppInit.c -o tclKitInit.o + ${CC} ${CFLAGS} ${LDFLAGS} tclKitInit.o \ + @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ + ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} PWD=`pwd` cp -f ${TCL_EXE} ${TCLKIT_EXE} cat null.zip >> ${TCLKIT_EXE} cd ${prefix}/lib ; zip -rAq ${PWD}/${TCLKIT_EXE} tcl8 tcl8.6 - -# Must be empty so it doesn't conflict with rule for ${TCL_EXE} above -${NATIVE_TCLSH}: Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in $(SHELL) config.status @@ -1035,7 +1043,7 @@ xtTestInit.o: $(UNIX_DIR)/tclAppInit.c ${TCL_EXE} @if test -f tclAppInit.sav ; then \ mv tclAppInit.sav tclAppInit.o; \ fi; - + # Object files used on all Unix systems: REGHDRS=$(GENERIC_DIR)/regex.h $(GENERIC_DIR)/regguts.h \ diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index 95dc38e..acd6aa1 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -80,7 +80,12 @@ main( #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif - +#ifdef TCL_KIT + printf("Running Kit Mode\n"); + /* This voodoo ensures that Tcl_Main does not eat the first argument */ + Tcl_FindExecutable(argv[0]); + Tcl_SetStartupScript(Tcl_NewStringObj("/zvfs/main.tcl",-1),NULL); +#endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } @@ -108,8 +113,10 @@ int Tcl_AppInit( Tcl_Interp *interp) /* Interpreter for application. */ { +#ifdef TCL_KIT Tcl_Zvfs_Boot(interp); - +#endif + if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } -- cgit v0.12 From 295272b73c55a78fda55d5fa34edaa20fcc7f14c Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Thu, 4 Sep 2014 01:23:45 +0000 Subject: Removed some debugging code of mine... --- unix/tclAppInit.c | 1 - 1 file changed, 1 deletion(-) diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index acd6aa1..55e0452 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -81,7 +81,6 @@ main( TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif #ifdef TCL_KIT - printf("Running Kit Mode\n"); /* This voodoo ensures that Tcl_Main does not eat the first argument */ Tcl_FindExecutable(argv[0]); Tcl_SetStartupScript(Tcl_NewStringObj("/zvfs/main.tcl",-1),NULL); -- cgit v0.12 From a813938befa49293741ca51da80f5bb0eb24ae36 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Thu, 4 Sep 2014 01:27:55 +0000 Subject: Removed a typo --- unix/Makefile.in | 1 - 1 file changed, 1 deletion(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 8f77687..9310753 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -666,7 +666,6 @@ ${TCLKIT_EXE}: ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} null.zip @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} PWD=`pwd` - cp -f ${TCL_EXE} ${TCLKIT_EXE} cat null.zip >> ${TCLKIT_EXE} cd ${prefix}/lib ; zip -rAq ${PWD}/${TCLKIT_EXE} tcl8 tcl8.6 -- cgit v0.12 From 3bd1370dbc61266dbec306b5333d22c4c11d81e0 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sat, 6 Sep 2014 00:58:23 +0000 Subject: New build process for Tcl kits in Unix (Windows port to follow...) Rather than force a "make install" to build the vfs, the tclkit now performs it's own "install" to a subdirectory (using destdir) to collect the files it needs for its vfs. tclkits no longer link to the tcl library. Instead, all of the obj files that are used to assemble the lib are instead packed into the executable. Thus, "make tclkit" produces the tclkit. That's it. No dlls. No tclsh. Makes no other mark on the file system save the bare essentials it needs. It uses the same variables in the makefile as the tcl libraries, so as they are updated so too is tclkit. Zlib files are *always* build for tclkits. Tclkits can never rely on the presence of zlib on the systems in which they will be installed. --- generic/tcl.decls | 2 +- generic/tclDecls.h | 6 ++-- generic/tclZipVfs.c | 37 ++++++++++++++++++----- unix/Makefile.in | 33 +++++++++++++------- unix/tclKitInit.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 143 insertions(+), 21 deletions(-) create mode 100644 unix/tclKitInit.c diff --git a/generic/tcl.decls b/generic/tcl.decls index 5b0220e..c24898e 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2328,7 +2328,7 @@ declare 630 { # ZipVfs declare 631 { - int Tcl_Zvfs_Boot(Tcl_Interp *interp) +int Tcl_Zvfs_Boot(Tcl_Interp *interp,const char *vfsmountpoint,const char *initscript) } ############################################################################## diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 06b46f0..65d940d 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1816,7 +1816,9 @@ EXTERN void Tcl_ZlibStreamSetCompressionDictionary( Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 631 */ -EXTERN int Tcl_Zvfs_Boot(Tcl_Interp *interp); +EXTERN int Tcl_Zvfs_Boot(Tcl_Interp *interp, + const char *vfsmountpoint, + const char *initscript); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2483,7 +2485,7 @@ typedef struct TclStubs { void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */ int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */ void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */ - int (*tcl_Zvfs_Boot) (Tcl_Interp *interp); /* 631 */ + int (*tcl_Zvfs_Boot) (Tcl_Interp *interp, const char *vfsmountpoint, const char *initscript); /* 631 */ } TclStubs; extern const TclStubs *tclStubsPtr; diff --git a/generic/tclZipVfs.c b/generic/tclZipVfs.c index ed2ddcc..dc96313 100755 --- a/generic/tclZipVfs.c +++ b/generic/tclZipVfs.c @@ -1765,9 +1765,10 @@ Zvfs_doInit( /* ** Boot a shell, mount the executable's VFS, detect main.tcl */ -int Tcl_Zvfs_Boot(Tcl_Interp *interp) { - +int Tcl_Zvfs_Boot(Tcl_Interp *interp,const char *vfsmountpoint,const char *initscript) { CONST char *cp=Tcl_GetNameOfExecutable(); + char filepath[256]; + /* We have to initialize the virtual filesystem before calling ** Tcl_Init(). Otherwise, Tcl_Init() will not be able to find ** its startup script files. @@ -1775,11 +1776,23 @@ int Tcl_Zvfs_Boot(Tcl_Interp *interp) { if(Zvfs_doInit(interp, 0)) { return TCL_ERROR; } - if(!Tcl_Zvfs_Mount(interp, cp, "/zvfs")) { - Tcl_Obj *vfsinitscript=Tcl_NewStringObj("/zvfs/main.tcl",-1); - Tcl_Obj *vfstcllib=Tcl_NewStringObj("/zvfs/tcl8.6",-1); - Tcl_Obj *vfstklib=Tcl_NewStringObj("/zvfs/tk8.6",-1); - + if(!Tcl_Zvfs_Mount(interp, cp, vfsmountpoint)) { + Tcl_Obj *vfsinitscript; + Tcl_Obj *vfstcllib; + Tcl_Obj *vfstklib; + + + strcpy(filepath,vfsmountpoint); + strcat(filepath,"/"); + strcat(filepath,initscript); + vfsinitscript=Tcl_NewStringObj(filepath,-1); + strcpy(filepath,vfsmountpoint); + strcat(filepath,"/tcl8.6"); + vfstcllib=Tcl_NewStringObj(filepath,-1); + strcpy(filepath,vfsmountpoint); + strcat(filepath,"/tk8.6"); + vfstklib=Tcl_NewStringObj(filepath,-1); + Tcl_IncrRefCount(vfsinitscript); Tcl_IncrRefCount(vfstcllib); Tcl_IncrRefCount(vfstklib); @@ -1790,17 +1803,27 @@ int Tcl_Zvfs_Boot(Tcl_Interp *interp) { } else { Tcl_SetStartupScript(NULL,NULL); } + + if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { + /* Startup script should be set before calling Tcl_AppInit */ + Tcl_SetStartupScript(vfsinitscript,NULL); + } else { + Tcl_SetStartupScript(NULL,NULL); + } if(Tcl_FSAccess(vfstcllib,F_OK)==0) { Tcl_SetVar2(interp, "env", "TCL_LIBRARY", Tcl_GetString(vfstcllib), TCL_GLOBAL_ONLY); } if(Tcl_FSAccess(vfstklib,F_OK)==0) { Tcl_SetVar2(interp, "env", "TK_LIBRARY", Tcl_GetString(vfstklib), TCL_GLOBAL_ONLY); } + Tcl_DecrRefCount(vfsinitscript); Tcl_DecrRefCount(vfstcllib); + Tcl_DecrRefCount(vfstklib); } return TCL_OK; } + int Tcl_Zvfs_Init( diff --git a/unix/Makefile.in b/unix/Makefile.in index 9310753..30e7109 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -285,9 +285,6 @@ ${AC_FLAGS} ${PROTO_FLAGS} ${EXTRA_CFLAGS} @EXTRA_CC_SWITCHES@ TCLSH_OBJS = tclAppInit.o -TCLKIT_OBJS = tclKitInit.o - - TCLTEST_OBJS = tclTestInit.o tclTest.o tclTestObj.o tclTestProcBodyObj.o \ tclThreadTest.o tclUnixTest.o @@ -363,6 +360,8 @@ ZLIB_OBJS = Zadler32.o Zcompress.o Zcrc32.o Zdeflate.o Zinfback.o \ TCL_OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${NOTIFY_OBJS} ${COMPAT_OBJS} \ ${OO_OBJS} @DL_OBJS@ @PLAT_OBJS@ +TCLKIT_OBJS = tclKitInit.o + OBJS = ${TCL_OBJS} ${TOMMATH_OBJS} @DTRACE_OBJ@ @ZLIB_OBJS@ TCL_DECLS = \ @@ -555,6 +554,7 @@ UNIX_HDRS = \ UNIX_SRCS = \ $(UNIX_DIR)/tclAppInit.c \ + $(UNIX_DIR)/tclKitInit.c \ $(UNIX_DIR)/tclUnixChan.c \ $(UNIX_DIR)/tclUnixEvent.c \ $(UNIX_DIR)/tclUnixFCmd.c \ @@ -612,6 +612,9 @@ ZLIB_SRCS = \ SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \ $(OO_SRCS) $(STUB_SRCS) @PLAT_SRCS@ @ZLIB_SRCS@ +PWD=`pwd` +VFS_INSTALL_DIR=${PWD}/tclkit.vfs/tcl8.6 + #-------------------------------------------------------------------------- # Start of rules #-------------------------------------------------------------------------- @@ -659,15 +662,21 @@ null.zip: touch .empty zip null.zip .empty -${TCLKIT_EXE}: ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} null.zip - $(CC) -c $(APP_CC_SWITCHES) \ - -DTCL_KIT $(UNIX_DIR)/tclAppInit.c -o tclKitInit.o - ${CC} ${CFLAGS} ${LDFLAGS} tclKitInit.o \ - @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ +# Rather than force an install, pack the files we need into a +# file system under our control +tclkit.vfs: + make install-libraries DESTDIR=tclkit.vfs + make install-tzdata DESTDIR=tclkit.vfs + make install-packages DESTDIR=tclkit.vfs + +# Assemble all of the tcl sources into a single executable +${TCLKIT_EXE}: ${TCLKIT_OBJS} ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} null.zip tclkit.vfs + ${CC} ${CFLAGS} ${LDFLAGS} \ + ${TCLKIT_OBJS} ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} \ + ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} - PWD=`pwd` cat null.zip >> ${TCLKIT_EXE} - cd ${prefix}/lib ; zip -rAq ${PWD}/${TCLKIT_EXE} tcl8 tcl8.6 + cd tclkit.vfs${prefix}/lib ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in $(SHELL) config.status @@ -676,7 +685,9 @@ Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in clean: clean-packages rm -f *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \ - errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ + errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ \ + ${TCLKIT_EXE} + rm -rf tclkit.vfs null.zip cd dltest ; $(MAKE) clean distclean: distclean-packages clean diff --git a/unix/tclKitInit.c b/unix/tclKitInit.c new file mode 100644 index 0000000..96861de --- /dev/null +++ b/unix/tclKitInit.c @@ -0,0 +1,86 @@ +/* +** This file implements the main routine for a standalone Tcl/Tk shell. +*/ +#include +#include "tclInt.h" +#define TCLKIT_INIT "main.tcl" +#define TCLKIT_VFSMOUNT "/zvfs" + +#define TCL_LOCAL_APPINIT Tclkit_AppInit +MODULE_SCOPE int TCL_LOCAL_APPINIT(Tcl_Interp *); +MODULE_SCOPE int main(int, char **); + +/* +** This routine runs first. +*/ +int main(int argc, char **argv){ + Tcl_FindExecutable(argv[0]); + Tcl_SetStartupScript(Tcl_NewStringObj("noop",-1),NULL); + Tcl_Main(argc,argv,&Tclkit_AppInit); + return TCL_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * Tclkit_AppInit -- + * + * This procedure performs application-specific initialization. Most + * applications, especially those that incorporate additional packages, + * will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error message in + * the interp's result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int +Tclkit_AppInit( + Tcl_Interp *interp) /* Interpreter for application. */ +{ + Tcl_Zvfs_Boot(interp,TCLKIT_VFSMOUNT,TCLKIT_INIT); + + if ((Tcl_Init)(interp) == TCL_ERROR) { + return TCL_ERROR; + } + + /* + * Call the init procedures for included packages. Each call should look + * like this: + * + * if (Mod_Init(interp) == TCL_ERROR) { + * return TCL_ERROR; + * } + * + * where "Mod" is the name of the module. (Dynamically-loadable packages + * should have the same entry-point name.) + */ + + /* + * Call Tcl_CreateCommand for application-specific commands, if they + * weren't already created by the init procedures called above. + */ + + /* + * Specify a user-specific startup file to invoke if the application is + * run interactively. Typically the startup file is "~/.apprc" where "app" + * is the name of the application. If this line is deleted then no + * user-specific startup file will be run under any conditions. + */ + +#ifdef DJGPP + (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, + Tcl_NewStringObj("~/tclsh.rc", -1), TCL_GLOBAL_ONLY); +#else + (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, + Tcl_NewStringObj("~/.tclshrc", -1), TCL_GLOBAL_ONLY); +#endif + + return TCL_OK; +} \ No newline at end of file -- cgit v0.12 From 0008ed9ea4c5bf8c010649489a28c86839ebdf0c Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sat, 6 Sep 2014 01:21:54 +0000 Subject: Preliminary checkin for Windows tclkit builds --- unix/tclAppInit.c | 14 +-- win/Makefile.in | 16 ++- win/tclAppInit.c | 9 +- win/tclKitInit.c | 324 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 339 insertions(+), 24 deletions(-) create mode 100644 win/tclKitInit.c diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index 55e0452..9bbc88b 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -15,7 +15,7 @@ #undef BUILD_tcl #undef STATIC_BUILD #include "tcl.h" -#include "tclInt.h" + #ifdef TCL_TEST extern Tcl_PackageInitProc Tcltest_Init; extern Tcl_PackageInitProc Tcltest_SafeInit; @@ -80,11 +80,7 @@ main( #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif -#ifdef TCL_KIT - /* This voodoo ensures that Tcl_Main does not eat the first argument */ - Tcl_FindExecutable(argv[0]); - Tcl_SetStartupScript(Tcl_NewStringObj("/zvfs/main.tcl",-1),NULL); -#endif + Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } @@ -112,10 +108,6 @@ int Tcl_AppInit( Tcl_Interp *interp) /* Interpreter for application. */ { -#ifdef TCL_KIT - Tcl_Zvfs_Boot(interp); -#endif - if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } @@ -132,7 +124,7 @@ Tcl_AppInit( } Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, Tcltest_SafeInit); #endif /* TCL_TEST */ - + /* * Call the init procedures for included packages. Each call should look * like this: diff --git a/win/Makefile.in b/win/Makefile.in index 3e44cff..e85cc16 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -433,13 +433,19 @@ null.zip: touch .empty zip -q null.zip .empty -$(TCLKIT): $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip - $(CC) $(CFLAGS) $(TCLKIT_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ - tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) +# Rather than force an install, pack the files we need into a +# file system under our control +tclkit.vfs: + make install-libraries DESTDIR=tclkit.vfs + make install-tzdata DESTDIR=tclkit.vfs + make install-packages DESTDIR=tclkit.vfs + +$(TCLKIT): $(TCLKIT_OBJS) $(TCL_OBJS) $(TOMMATH_OBJS) $(ZLIB_OBJS) tclsh.$(RES) null.zip tclkit.vfs + $(CC) $(CFLAGS) $(TCLKIT_OBJS) $(TCL_OBJS) $(TOMMATH_OBJS) $(ZLIB_OBJS) \ + $(LIBS) tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) @VC_MANIFEST_EMBED_EXE@ - PWD=`pwd` cat null.zip >> $(TCLKIT) - cd ${prefix}/lib ; zip -rAq ${PWD}/$(TCLKIT) tcl8 tcl8.6 + cd tclkit.vfs${prefix}/lib ; zip -rAq $(WIN_DIR)/$(TCLKIT) tcl8 tcl8.6 cat32.$(OBJEXT): cat.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) diff --git a/win/tclAppInit.c b/win/tclAppInit.c index c6b3b44..a6c1a67 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -123,11 +123,7 @@ _tmain( #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif -#if defined TCL_KIT - /* This voodoo ensures that Tcl_Main does not eat the first argument */ - Tcl_FindExecutable(argv[0]); - Tcl_SetStartupScript(Tcl_NewStringObj("/zvfs/main.tcl",-1),NULL); -#endif + Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } @@ -155,9 +151,6 @@ int Tcl_AppInit( Tcl_Interp *interp) /* Interpreter for application. */ { -#if defined TCL_KIT - Tcl_Zvfs_Boot(interp); -#endif if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } diff --git a/win/tclKitInit.c b/win/tclKitInit.c new file mode 100644 index 0000000..69a298c --- /dev/null +++ b/win/tclKitInit.c @@ -0,0 +1,324 @@ +/* + * tclAppInit.c -- + * + * Provides a default version of the main program and TclKit_AppInit + * procedure for tclsh and other Tcl-based applications (without Tk). + * Note that this program must be built in Win32 console mode to work + * properly. + * + * Copyright (c) 1993 The Regents of the University of California. + * Copyright (c) 1994-1997 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. + */ + +#include "tcl.h" +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#include +#include +#include + +extern Tcl_PackageInitProc Registry_Init; +extern Tcl_PackageInitProc Dde_Init; +extern Tcl_PackageInitProc Dde_SafeInit; + +#ifdef TCL_BROKEN_MAINARGS +int _CRT_glob = 0; +static void setargv(int *argcPtr, TCHAR ***argvPtr); +#endif /* TCL_BROKEN_MAINARGS */ + +/* + * The following #if block allows you to change the AppInit function by using + * a #define of TCL_LOCAL_APPINIT instead of rewriting this entire file. The + * #if checks for that #define and uses TclKit_AppInit if it does not exist. + */ +#define TCLKIT_INIT "main.tcl" +#define TCLKIT_VFSMOUNT "/zvfs" +#ifndef TCL_LOCAL_APPINIT +#define TCL_LOCAL_APPINIT TclKit_AppInit +#endif +#ifndef MODULE_SCOPE +# define MODULE_SCOPE extern +#endif +MODULE_SCOPE int TCL_LOCAL_APPINIT(Tcl_Interp *); + +/* + * The following #if block allows you to change how Tcl finds the startup + * script, prime the library or encoding paths, fiddle with the argv, etc., + * without needing to rewrite Tcl_Main() + */ + +#ifdef TCL_LOCAL_MAIN_HOOK +MODULE_SCOPE int TCL_LOCAL_MAIN_HOOK(int *argc, TCHAR ***argv); +#endif + +/* + *---------------------------------------------------------------------- + * + * main -- + * + * This is the main program for the application. + * + * Results: + * None: Tcl_Main never returns here, so this procedure never returns + * either. + * + * Side effects: + * Just about anything, since from here we call arbitrary Tcl code. + * + *---------------------------------------------------------------------- + */ + +#ifdef TCL_BROKEN_MAINARGS +int +main( + int argc, /* Number of command-line arguments. */ + char *dummy[]) /* Not used. */ +{ + TCHAR **argv; +#else +int +_tmain( + int argc, /* Number of command-line arguments. */ + TCHAR *argv[]) /* Values of command-line arguments. */ +{ +#endif + TCHAR *p; + + /* + * Set up the default locale to be standard "C" locale so parsing is + * performed correctly. + */ + + setlocale(LC_ALL, "C"); + +#ifdef TCL_BROKEN_MAINARGS + /* + * Get our args from the c-runtime. Ignore command line. + */ + + setargv(&argc, &argv); +#endif + + /* + * Forward slashes substituted for backslashes. + */ + + for (p = argv[0]; *p != '\0'; p++) { + if (*p == '\\') { + *p = '/'; + } + } + +#ifdef TCL_LOCAL_MAIN_HOOK + TCL_LOCAL_MAIN_HOOK(&argc, &argv); +#endif + /* This voodoo ensures that Tcl_Main does not eat the first argument */ + Tcl_FindExecutable(argv[0]); + Tcl_SetStartupScript(Tcl_NewStringObj("noop",-1),NULL); + Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); + return 0; /* Needed only to prevent compiler warning. */ +} + +/* + *---------------------------------------------------------------------- + * + * TclKit_AppInit -- + * + * This procedure performs application-specific initialization. Most + * applications, especially those that incorporate additional packages, + * will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error message in + * the interp's result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int +TclKit_AppInit( + Tcl_Interp *interp) /* Interpreter for application. */ +{ + Tcl_Zvfs_Boot(interp,TCLKIT_VFSMOUNT,TCLKIT_INIT); + if ((Tcl_Init)(interp) == TCL_ERROR) { + return TCL_ERROR; + } + + if (Registry_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "registry", Registry_Init, NULL); + + if (Dde_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "dde", Dde_Init, Dde_SafeInit); + + /* + * Call the init procedures for included packages. Each call should look + * like this: + * + * if (Mod_Init(interp) == TCL_ERROR) { + * return TCL_ERROR; + * } + * + * where "Mod" is the name of the module. (Dynamically-loadable packages + * should have the same entry-point name.) + */ + + /* + * Call Tcl_CreateCommand for application-specific commands, if they + * weren't already created by the init procedures called above. + */ + + /* + * Specify a user-specific startup file to invoke if the application is + * run interactively. Typically the startup file is "~/.apprc" where "app" + * is the name of the application. If this line is deleted then no + * user-specific startup file will be run under any conditions. + */ + + (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, + Tcl_NewStringObj("~/tclshrc.tcl", -1), TCL_GLOBAL_ONLY); + return TCL_OK; +} + +/* + *------------------------------------------------------------------------- + * + * setargv -- + * + * Parse the Windows command line string into argc/argv. Done here + * because we don't trust the builtin argument parser in crt0. Windows + * applications are responsible for breaking their command line into + * arguments. + * + * 2N backslashes + quote -> N backslashes + begin quoted string + * 2N + 1 backslashes + quote -> literal + * N backslashes + non-quote -> literal + * quote + quote in a quoted string -> single quote + * quote + quote not in quoted string -> empty string + * quote -> begin quoted string + * + * Results: + * Fills argcPtr with the number of arguments and argvPtr with the array + * of arguments. + * + * Side effects: + * Memory allocated. + * + *-------------------------------------------------------------------------- + */ + +#ifdef TCL_BROKEN_MAINARGS +static void +setargv( + int *argcPtr, /* Filled with number of argument strings. */ + TCHAR ***argvPtr) /* Filled with argument strings (malloc'd). */ +{ + TCHAR *cmdLine, *p, *arg, *argSpace; + TCHAR **argv; + int argc, size, inquote, copy, slashes; + + cmdLine = GetCommandLine(); + + /* + * Precompute an overly pessimistic guess at the number of arguments in + * the command line by counting non-space spans. + */ + + size = 2; + for (p = cmdLine; *p != '\0'; p++) { + if ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ + size++; + while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ + p++; + } + if (*p == '\0') { + break; + } + } + } + + /* Make sure we don't call ckalloc through the (not yet initialized) stub table */ + #undef Tcl_Alloc + #undef Tcl_DbCkalloc + + argSpace = ckalloc(size * sizeof(char *) + + (_tcslen(cmdLine) * sizeof(TCHAR)) + sizeof(TCHAR)); + argv = (TCHAR **) argSpace; + argSpace += size * (sizeof(char *)/sizeof(TCHAR)); + size--; + + p = cmdLine; + for (argc = 0; argc < size; argc++) { + argv[argc] = arg = argSpace; + while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ + p++; + } + if (*p == '\0') { + break; + } + + inquote = 0; + slashes = 0; + while (1) { + copy = 1; + while (*p == '\\') { + slashes++; + p++; + } + if (*p == '"') { + if ((slashes & 1) == 0) { + copy = 0; + if ((inquote) && (p[1] == '"')) { + p++; + copy = 1; + } else { + inquote = !inquote; + } + } + slashes >>= 1; + } + + while (slashes) { + *arg = '\\'; + arg++; + slashes--; + } + + if ((*p == '\0') || (!inquote && + ((*p == ' ') || (*p == '\t')))) { /* INTL: ISO space. */ + break; + } + if (copy != 0) { + *arg = *p; + arg++; + } + p++; + } + *arg = '\0'; + argSpace = arg + 1; + } + argv[argc] = NULL; + + *argcPtr = argc; + *argvPtr = argv; +} +#endif /* TCL_BROKEN_MAINARGS */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ -- cgit v0.12 From 71e02d5298ef4a81b4aa0494ee1ba7d8f433391d Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sat, 6 Sep 2014 11:41:26 +0000 Subject: Created a designated bootloader for Tclkits under windows On windows, tclkits build a private VFS instead of relying on make install Added a tool to build the tcl kit's VFS, as well as index the bundled packages --- library/http/http.tcl | 2 +- tools/mkVfs.tcl | 109 +++++++++ win/Makefile.in | 35 +-- win/tclKitInit.c | 649 +++++++++++++++++++++++++------------------------- 4 files changed, 454 insertions(+), 341 deletions(-) create mode 100644 tools/mkVfs.tcl diff --git a/library/http/http.tcl b/library/http/http.tcl index a6b2bfd..afa9458 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -12,7 +12,7 @@ package require Tcl 8.6 # Keep this in sync with pkgIndex.tcl and with the install directories in # Makefiles package provide http 2.8.8 - +puts [list LOADED [info script]] namespace eval http { # Allow resourcing to not clobber existing data diff --git a/tools/mkVfs.tcl b/tools/mkVfs.tcl new file mode 100644 index 0000000..c7bf17b --- /dev/null +++ b/tools/mkVfs.tcl @@ -0,0 +1,109 @@ +proc cat fname { + set fname [open $fname r] + set data [read $fname] + close $fname + return $data +} + +proc pkgIndexDir {root fout d1} { + + puts [format {%*sIndexing %s} [expr {4 * [info level]}] {} \ + [file tail $d1]] + set idx [string length $root] + foreach ftail [glob -directory $d1 -nocomplain -tails *] { + set f [file join $d1 $ftail] + if {[file isdirectory $f] && [string compare CVS $ftail]} { + pkgIndexDir $root $fout $f + } elseif {[file tail $f] eq "pkgIndex.tcl"} { + puts $fout "set dir \$HERE[string range $d1 $idx end]" + puts $fout [cat $f] + } + } +} + +### +# Script to build the VFS file system +### +proc copyDir {d1 d2} { + + puts [format {%*sCreating %s} [expr {4 * [info level]}] {} \ + [file tail $d2]] + + file delete -force -- $d2 + file mkdir $d2 + + foreach ftail [glob -directory $d1 -nocomplain -tails *] { + set f [file join $d1 $ftail] + if {[file isdirectory $f] && [string compare CVS $ftail]} { + copyDir $f [file join $d2 $ftail] + } elseif {[file isfile $f]} { + file copy -force $f [file join $d2 $ftail] + if {$::tcl_platform(platform) eq {unix}} { + file attributes [file join $d2 $ftail] -permissions 0644 + } else { + file attributes [file join $d2 $ftail] -readonly 1 + } + } + } + + if {$::tcl_platform(platform) eq {unix}} { + file attributes $d2 -permissions 0755 + } else { + file attributes $d2 -readonly 1 + } +} + +if {[llength $argv] < 3} { + puts "Usage: VFS_ROOT TCLSRC_ROOT PLATFORM" + exit 1 +} +set TCL_SCRIPT_DIR [lindex $argv 0] +set TCLSRC_ROOT [lindex $argv 1] +set PLATFORM [lindex $argv 2] + +puts "Building [file tail $TCL_SCRIPT_DIR] for $PLATFORM" +copyDir ${TCLSRC_ROOT}/library ${TCL_SCRIPT_DIR} + +if {$PLATFORM == "windows"} { + set ddedll [glob -nocomplain ${TCLSRC_ROOT}/win/tcldde*.dll] + puts "DDE DLL $ddedll" + if {$ddedll != {}} { + file copy $ddedll ${TCL_SCRIPT_DIR}/dde + } + set regdll [glob -nocomplain ${TCLSRC_ROOT}/win/tclreg*.dll] + puts "REG DLL $ddedll" + if {$regdll != {}} { + file copy $regdll ${TCL_SCRIPT_DIR}/reg + } +} else { + # Remove the dde and reg package paths + file delete -force ${TCL_SCRIPT_DIR}/dde + file delete -force ${TCL_SCRIPT_DIR}/reg +} + +# For the following packages, cat their pkgIndex files to tclIndex +file attributes ${TCL_SCRIPT_DIR}/tclIndex -readonly 0 +set fout [open ${TCL_SCRIPT_DIR}/tclIndex a] +puts $fout {# +# MANIFEST OF INCLUDED PACKAGES +# +set HERE $dir +} +pkgIndexDir ${TCL_SCRIPT_DIR} $fout ${TCL_SCRIPT_DIR} +close $fout +exit 0 +puts $fout { +# Save Tcl the trouble of hunting for these packages +} +set ddedll [glob -nocomplain ${TCLSRC_ROOT}/win/tcldde*.dll] +puts "DDE DLL $ddedll" +if {$ddedll != {}} { + puts $fout [cat ${TCL_SCRIPT_DIR}/dde/pkgIndex.tcl] +} +set regdll [glob -nocomplain ${TCLSRC_ROOT}/win/tclreg*.dll] +puts "REG DLL $ddedll" +if {$regdll != {}} { + puts $fout [cat ${TCL_SCRIPT_DIR}/reg/pkgIndex.tcl] +} +close $fout +file attributes ${TCL_SCRIPT_DIR}/tclIndex -readonly 1 diff --git a/win/Makefile.in b/win/Makefile.in index e85cc16..ec824cc 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -103,6 +103,10 @@ COMPAT_DIR = $(TOP_DIR)/compat PKGS_DIR = $(TOP_DIR)/pkgs ZLIB_DIR = $(COMPAT_DIR)/zlib +VFS_SCRIPT_INSTALL_DIR = $(WIN_DIR)/tclvfs.zip/tcl$(VERSION) +VFS_PKG_INSTALL_DIR = $(WIN_DIR)/tclvfs.zip/lib + + # Converts a POSIX path to a Windows native path. CYGPATH = @CYGPATH@ @@ -392,9 +396,6 @@ STUB_OBJS = \ TCLSH_OBJS = tclAppInit.$(OBJEXT) -TCLKIT_OBJS = tclKitInit.$(OBJEXT) - - ZLIB_OBJS = \ adler32.$(OBJEXT) \ compress.$(OBJEXT) \ @@ -410,6 +411,10 @@ ZLIB_OBJS = \ TCL_OBJS = ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} @ZLIB_OBJS@ +TCLKIT_OBJS = tclKitInit.$(OBJEXT) \ + ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLIB_OBJS} + + TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n] all: binaries libraries doc packages @@ -435,17 +440,17 @@ null.zip: # Rather than force an install, pack the files we need into a # file system under our control -tclkit.vfs: - make install-libraries DESTDIR=tclkit.vfs - make install-tzdata DESTDIR=tclkit.vfs - make install-packages DESTDIR=tclkit.vfs - -$(TCLKIT): $(TCLKIT_OBJS) $(TCL_OBJS) $(TOMMATH_OBJS) $(ZLIB_OBJS) tclsh.$(RES) null.zip tclkit.vfs - $(CC) $(CFLAGS) $(TCLKIT_OBJS) $(TCL_OBJS) $(TOMMATH_OBJS) $(ZLIB_OBJS) \ - $(LIBS) tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) +tclkit.vfs: $(TCLSH) $(DDE_DLL_FILE) $(REG_DLL_FILE) + @echo "Building VFS File system in tclkit.vfs" + @$(TCL_EXE) "$(ROOT_DIR)/tools/mkVfs.tcl" \ + "$(WIN_DIR)/tclkit.vfs/tcl$(VERSION)" "$(ROOT_DIR)" windows + +$(TCLKIT): $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs + $(CC) $(CFLAGS) -DSTATIC_BUILD -UUSE_STUBS $(TCLKIT_OBJS) $(LIBS) \ + tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) @VC_MANIFEST_EMBED_EXE@ cat null.zip >> $(TCLKIT) - cd tclkit.vfs${prefix}/lib ; zip -rAq $(WIN_DIR)/$(TCLKIT) tcl8 tcl8.6 + cd tclkit.vfs ; zip -rAq $(WIN_DIR)/$(TCLKIT) . cat32.$(OBJEXT): cat.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) @@ -510,9 +515,6 @@ testMain.${OBJEXT}: tclAppInit.c tclMain2.${OBJEXT}: tclMain.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_ASCII_MAIN @DEPARG@ $(CC_OBJNAME) -tclKitInit.$(OBJEXT): tclAppInit.c - $(CC) -c $(CC_SWITCHES) -DTCL_KIT @DEPARG@ $(CC_OBJNAME) - # TIP #59, embedding of configuration information into the binary library. # # Part of Tcl's configuration information are the paths where it was installed @@ -762,8 +764,9 @@ cleanhelp: clean: cleanhelp clean-packages $(RM) *.lib *.a *.exp *.dll *.$(RES) *.${OBJEXT} *~ \#* TAGS a.out - $(RM) $(TCLSH) $(CAT32) + $(RM) $(TCLSH) $(CAT32) $(TCLKIT) null.zip $(RM) *.pch *.ilk *.pdb + $(RMDIR) tclkit.vfs distclean: distclean-packages clean $(RM) Makefile config.status config.cache config.log tclConfig.sh \ diff --git a/win/tclKitInit.c b/win/tclKitInit.c index 69a298c..9531ab5 100644 --- a/win/tclKitInit.c +++ b/win/tclKitInit.c @@ -1,324 +1,325 @@ -/* - * tclAppInit.c -- - * - * Provides a default version of the main program and TclKit_AppInit - * procedure for tclsh and other Tcl-based applications (without Tk). - * Note that this program must be built in Win32 console mode to work - * properly. - * - * Copyright (c) 1993 The Regents of the University of California. - * Copyright (c) 1994-1997 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. - */ - -#include "tcl.h" -#define WIN32_LEAN_AND_MEAN -#include -#undef WIN32_LEAN_AND_MEAN -#include -#include -#include - -extern Tcl_PackageInitProc Registry_Init; -extern Tcl_PackageInitProc Dde_Init; -extern Tcl_PackageInitProc Dde_SafeInit; - -#ifdef TCL_BROKEN_MAINARGS -int _CRT_glob = 0; -static void setargv(int *argcPtr, TCHAR ***argvPtr); -#endif /* TCL_BROKEN_MAINARGS */ - -/* - * The following #if block allows you to change the AppInit function by using - * a #define of TCL_LOCAL_APPINIT instead of rewriting this entire file. The - * #if checks for that #define and uses TclKit_AppInit if it does not exist. - */ -#define TCLKIT_INIT "main.tcl" -#define TCLKIT_VFSMOUNT "/zvfs" -#ifndef TCL_LOCAL_APPINIT -#define TCL_LOCAL_APPINIT TclKit_AppInit -#endif -#ifndef MODULE_SCOPE -# define MODULE_SCOPE extern -#endif -MODULE_SCOPE int TCL_LOCAL_APPINIT(Tcl_Interp *); - -/* - * The following #if block allows you to change how Tcl finds the startup - * script, prime the library or encoding paths, fiddle with the argv, etc., - * without needing to rewrite Tcl_Main() - */ - -#ifdef TCL_LOCAL_MAIN_HOOK -MODULE_SCOPE int TCL_LOCAL_MAIN_HOOK(int *argc, TCHAR ***argv); -#endif - -/* - *---------------------------------------------------------------------- - * - * main -- - * - * This is the main program for the application. - * - * Results: - * None: Tcl_Main never returns here, so this procedure never returns - * either. - * - * Side effects: - * Just about anything, since from here we call arbitrary Tcl code. - * - *---------------------------------------------------------------------- - */ - -#ifdef TCL_BROKEN_MAINARGS -int -main( - int argc, /* Number of command-line arguments. */ - char *dummy[]) /* Not used. */ -{ - TCHAR **argv; -#else -int -_tmain( - int argc, /* Number of command-line arguments. */ - TCHAR *argv[]) /* Values of command-line arguments. */ -{ -#endif - TCHAR *p; - - /* - * Set up the default locale to be standard "C" locale so parsing is - * performed correctly. - */ - - setlocale(LC_ALL, "C"); - -#ifdef TCL_BROKEN_MAINARGS - /* - * Get our args from the c-runtime. Ignore command line. - */ - - setargv(&argc, &argv); -#endif - - /* - * Forward slashes substituted for backslashes. - */ - - for (p = argv[0]; *p != '\0'; p++) { - if (*p == '\\') { - *p = '/'; - } - } - -#ifdef TCL_LOCAL_MAIN_HOOK - TCL_LOCAL_MAIN_HOOK(&argc, &argv); -#endif - /* This voodoo ensures that Tcl_Main does not eat the first argument */ - Tcl_FindExecutable(argv[0]); - Tcl_SetStartupScript(Tcl_NewStringObj("noop",-1),NULL); - Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); - return 0; /* Needed only to prevent compiler warning. */ -} - -/* - *---------------------------------------------------------------------- - * - * TclKit_AppInit -- - * - * This procedure performs application-specific initialization. Most - * applications, especially those that incorporate additional packages, - * will have their own version of this procedure. - * - * Results: - * Returns a standard Tcl completion code, and leaves an error message in - * the interp's result if an error occurs. - * - * Side effects: - * Depends on the startup script. - * - *---------------------------------------------------------------------- - */ - -int -TclKit_AppInit( - Tcl_Interp *interp) /* Interpreter for application. */ -{ - Tcl_Zvfs_Boot(interp,TCLKIT_VFSMOUNT,TCLKIT_INIT); - if ((Tcl_Init)(interp) == TCL_ERROR) { - return TCL_ERROR; - } - - if (Registry_Init(interp) == TCL_ERROR) { - return TCL_ERROR; - } - Tcl_StaticPackage(interp, "registry", Registry_Init, NULL); - - if (Dde_Init(interp) == TCL_ERROR) { - return TCL_ERROR; - } - Tcl_StaticPackage(interp, "dde", Dde_Init, Dde_SafeInit); - - /* - * Call the init procedures for included packages. Each call should look - * like this: - * - * if (Mod_Init(interp) == TCL_ERROR) { - * return TCL_ERROR; - * } - * - * where "Mod" is the name of the module. (Dynamically-loadable packages - * should have the same entry-point name.) - */ - - /* - * Call Tcl_CreateCommand for application-specific commands, if they - * weren't already created by the init procedures called above. - */ - - /* - * Specify a user-specific startup file to invoke if the application is - * run interactively. Typically the startup file is "~/.apprc" where "app" - * is the name of the application. If this line is deleted then no - * user-specific startup file will be run under any conditions. - */ - - (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, - Tcl_NewStringObj("~/tclshrc.tcl", -1), TCL_GLOBAL_ONLY); - return TCL_OK; -} - -/* - *------------------------------------------------------------------------- - * - * setargv -- - * - * Parse the Windows command line string into argc/argv. Done here - * because we don't trust the builtin argument parser in crt0. Windows - * applications are responsible for breaking their command line into - * arguments. - * - * 2N backslashes + quote -> N backslashes + begin quoted string - * 2N + 1 backslashes + quote -> literal - * N backslashes + non-quote -> literal - * quote + quote in a quoted string -> single quote - * quote + quote not in quoted string -> empty string - * quote -> begin quoted string - * - * Results: - * Fills argcPtr with the number of arguments and argvPtr with the array - * of arguments. - * - * Side effects: - * Memory allocated. - * - *-------------------------------------------------------------------------- - */ - -#ifdef TCL_BROKEN_MAINARGS -static void -setargv( - int *argcPtr, /* Filled with number of argument strings. */ - TCHAR ***argvPtr) /* Filled with argument strings (malloc'd). */ -{ - TCHAR *cmdLine, *p, *arg, *argSpace; - TCHAR **argv; - int argc, size, inquote, copy, slashes; - - cmdLine = GetCommandLine(); - - /* - * Precompute an overly pessimistic guess at the number of arguments in - * the command line by counting non-space spans. - */ - - size = 2; - for (p = cmdLine; *p != '\0'; p++) { - if ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ - size++; - while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ - p++; - } - if (*p == '\0') { - break; - } - } - } - - /* Make sure we don't call ckalloc through the (not yet initialized) stub table */ - #undef Tcl_Alloc - #undef Tcl_DbCkalloc - - argSpace = ckalloc(size * sizeof(char *) - + (_tcslen(cmdLine) * sizeof(TCHAR)) + sizeof(TCHAR)); - argv = (TCHAR **) argSpace; - argSpace += size * (sizeof(char *)/sizeof(TCHAR)); - size--; - - p = cmdLine; - for (argc = 0; argc < size; argc++) { - argv[argc] = arg = argSpace; - while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ - p++; - } - if (*p == '\0') { - break; - } - - inquote = 0; - slashes = 0; - while (1) { - copy = 1; - while (*p == '\\') { - slashes++; - p++; - } - if (*p == '"') { - if ((slashes & 1) == 0) { - copy = 0; - if ((inquote) && (p[1] == '"')) { - p++; - copy = 1; - } else { - inquote = !inquote; - } - } - slashes >>= 1; - } - - while (slashes) { - *arg = '\\'; - arg++; - slashes--; - } - - if ((*p == '\0') || (!inquote && - ((*p == ' ') || (*p == '\t')))) { /* INTL: ISO space. */ - break; - } - if (copy != 0) { - *arg = *p; - arg++; - } - p++; - } - *arg = '\0'; - argSpace = arg + 1; - } - argv[argc] = NULL; - - *argcPtr = argc; - *argvPtr = argv; -} -#endif /* TCL_BROKEN_MAINARGS */ - -/* - * Local Variables: - * mode: c - * c-basic-offset: 4 - * fill-column: 78 - * End: - */ +/* + * tclAppInit.c -- + * + * Provides a default version of the main program and TclKit_AppInit + * procedure for tclsh and other Tcl-based applications (without Tk). + * Note that this program must be built in Win32 console mode to work + * properly. + * + * Copyright (c) 1993 The Regents of the University of California. + * Copyright (c) 1994-1997 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. + */ + +#include "tclWinInt.h" + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#include +#include +#include + +extern Tcl_PackageInitProc Registry_Init; +extern Tcl_PackageInitProc Dde_Init; +extern Tcl_PackageInitProc Dde_SafeInit; + +#ifdef TCL_BROKEN_MAINARGS +int _CRT_glob = 0; +static void setargv(int *argcPtr, TCHAR ***argvPtr); +#endif /* TCL_BROKEN_MAINARGS */ + +/* + * The following #if block allows you to change the AppInit function by using + * a #define of TCL_LOCAL_APPINIT instead of rewriting this entire file. The + * #if checks for that #define and uses TclKit_AppInit if it does not exist. + */ +#define TCLKIT_INIT "main.tcl" +#define TCLKIT_VFSMOUNT "/zvfs" +#ifndef TCL_LOCAL_APPINIT +#define TCL_LOCAL_APPINIT TclKit_AppInit +#endif +#ifndef MODULE_SCOPE +# define MODULE_SCOPE extern +#endif +MODULE_SCOPE int TCL_LOCAL_APPINIT(Tcl_Interp *); + +/* + * The following #if block allows you to change how Tcl finds the startup + * script, prime the library or encoding paths, fiddle with the argv, etc., + * without needing to rewrite Tcl_Main() + */ + +#ifdef TCL_LOCAL_MAIN_HOOK +MODULE_SCOPE int TCL_LOCAL_MAIN_HOOK(int *argc, TCHAR ***argv); +#endif + +/* + *---------------------------------------------------------------------- + * + * main -- + * + * This is the main program for the application. + * + * Results: + * None: Tcl_Main never returns here, so this procedure never returns + * either. + * + * Side effects: + * Just about anything, since from here we call arbitrary Tcl code. + * + *---------------------------------------------------------------------- + */ + +#ifdef TCL_BROKEN_MAINARGS +int +main( + int argc, /* Number of command-line arguments. */ + char *dummy[]) /* Not used. */ +{ + TCHAR **argv; +#else +int +_tmain( + int argc, /* Number of command-line arguments. */ + TCHAR *argv[]) /* Values of command-line arguments. */ +{ +#endif + TCHAR *p; + + /* + * Set up the default locale to be standard "C" locale so parsing is + * performed correctly. + */ + + setlocale(LC_ALL, "C"); + +#ifdef TCL_BROKEN_MAINARGS + /* + * Get our args from the c-runtime. Ignore command line. + */ + + setargv(&argc, &argv); +#endif + + /* + * Forward slashes substituted for backslashes. + */ + + for (p = argv[0]; *p != '\0'; p++) { + if (*p == '\\') { + *p = '/'; + } + } + +#ifdef TCL_LOCAL_MAIN_HOOK + TCL_LOCAL_MAIN_HOOK(&argc, &argv); +#endif + /* This voodoo ensures that Tcl_Main does not eat the first argument */ + Tcl_FindExecutable(argv[0]); + Tcl_SetStartupScript(Tcl_NewStringObj("noop",-1),NULL); + Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); + return 0; /* Needed only to prevent compiler warning. */ +} + +/* + *---------------------------------------------------------------------- + * + * TclKit_AppInit -- + * + * This procedure performs application-specific initialization. Most + * applications, especially those that incorporate additional packages, + * will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error message in + * the interp's result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int +TclKit_AppInit( + Tcl_Interp *interp) /* Interpreter for application. */ +{ + Tcl_Zvfs_Boot(interp,TCLKIT_VFSMOUNT,TCLKIT_INIT); + if ((Tcl_Init)(interp) == TCL_ERROR) { + return TCL_ERROR; + } + +// if (Registry_Init(interp) == TCL_ERROR) { +// return TCL_ERROR; +// } +// Tcl_StaticPackage(interp, "registry", Registry_Init, NULL); +// +// if (Dde_Init(interp) == TCL_ERROR) { +// return TCL_ERROR; +// } +// Tcl_StaticPackage(interp, "dde", Dde_Init, Dde_SafeInit); + + /* + * Call the init procedures for included packages. Each call should look + * like this: + * + * if (Mod_Init(interp) == TCL_ERROR) { + * return TCL_ERROR; + * } + * + * where "Mod" is the name of the module. (Dynamically-loadable packages + * should have the same entry-point name.) + */ + + /* + * Call Tcl_CreateCommand for application-specific commands, if they + * weren't already created by the init procedures called above. + */ + + /* + * Specify a user-specific startup file to invoke if the application is + * run interactively. Typically the startup file is "~/.apprc" where "app" + * is the name of the application. If this line is deleted then no + * user-specific startup file will be run under any conditions. + */ + + (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, + Tcl_NewStringObj("~/tclshrc.tcl", -1), TCL_GLOBAL_ONLY); + return TCL_OK; +} + +/* + *------------------------------------------------------------------------- + * + * setargv -- + * + * Parse the Windows command line string into argc/argv. Done here + * because we don't trust the builtin argument parser in crt0. Windows + * applications are responsible for breaking their command line into + * arguments. + * + * 2N backslashes + quote -> N backslashes + begin quoted string + * 2N + 1 backslashes + quote -> literal + * N backslashes + non-quote -> literal + * quote + quote in a quoted string -> single quote + * quote + quote not in quoted string -> empty string + * quote -> begin quoted string + * + * Results: + * Fills argcPtr with the number of arguments and argvPtr with the array + * of arguments. + * + * Side effects: + * Memory allocated. + * + *-------------------------------------------------------------------------- + */ + +#ifdef TCL_BROKEN_MAINARGS +static void +setargv( + int *argcPtr, /* Filled with number of argument strings. */ + TCHAR ***argvPtr) /* Filled with argument strings (malloc'd). */ +{ + TCHAR *cmdLine, *p, *arg, *argSpace; + TCHAR **argv; + int argc, size, inquote, copy, slashes; + + cmdLine = GetCommandLine(); + + /* + * Precompute an overly pessimistic guess at the number of arguments in + * the command line by counting non-space spans. + */ + + size = 2; + for (p = cmdLine; *p != '\0'; p++) { + if ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ + size++; + while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ + p++; + } + if (*p == '\0') { + break; + } + } + } + + /* Make sure we don't call ckalloc through the (not yet initialized) stub table */ + #undef Tcl_Alloc + #undef Tcl_DbCkalloc + + argSpace = ckalloc(size * sizeof(char *) + + (_tcslen(cmdLine) * sizeof(TCHAR)) + sizeof(TCHAR)); + argv = (TCHAR **) argSpace; + argSpace += size * (sizeof(char *)/sizeof(TCHAR)); + size--; + + p = cmdLine; + for (argc = 0; argc < size; argc++) { + argv[argc] = arg = argSpace; + while ((*p == ' ') || (*p == '\t')) { /* INTL: ISO space. */ + p++; + } + if (*p == '\0') { + break; + } + + inquote = 0; + slashes = 0; + while (1) { + copy = 1; + while (*p == '\\') { + slashes++; + p++; + } + if (*p == '"') { + if ((slashes & 1) == 0) { + copy = 0; + if ((inquote) && (p[1] == '"')) { + p++; + copy = 1; + } else { + inquote = !inquote; + } + } + slashes >>= 1; + } + + while (slashes) { + *arg = '\\'; + arg++; + slashes--; + } + + if ((*p == '\0') || (!inquote && + ((*p == ' ') || (*p == '\t')))) { /* INTL: ISO space. */ + break; + } + if (copy != 0) { + *arg = *p; + arg++; + } + p++; + } + *arg = '\0'; + argSpace = arg + 1; + } + argv[argc] = NULL; + + *argcPtr = argc; + *argvPtr = argv; +} +#endif /* TCL_BROKEN_MAINARGS */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ -- cgit v0.12 From 4e331e27f8b8efdb66a423a5a35d7f522508777f Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 9 Sep 2014 06:54:36 +0000 Subject: Added the tclkit binaries to install --- unix/Makefile.in | 4 +++- win/Makefile.in | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 30e7109..95a9bff 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -621,7 +621,7 @@ VFS_INSTALL_DIR=${PWD}/tclkit.vfs/tcl8.6 all: binaries libraries doc packages -binaries: ${LIB_FILE} ${TCL_EXE} +binaries: ${LIB_FILE} ${TCL_EXE} ${TCLKIT_EXE} libraries: @@ -831,6 +831,8 @@ install-binaries: binaries @chmod 555 "$(DLL_INSTALL_DIR)/$(LIB_FILE)" @echo "Installing ${TCL_EXE} as $(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" @$(INSTALL_PROGRAM) ${TCL_EXE} "$(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" + @echo "Installing ${TCLKIT_EXE} as $(BIN_INSTALL_DIR)/tclkit$(VERSION)${EXE_SUFFIX}" + @$(INSTALL_PROGRAM) ${TCLKIT_EXE} "$(BIN_INSTALL_DIR)/tclkit$(VERSION)${EXE_SUFFIX}" @echo "Installing tclConfig.sh to $(CONFIG_INSTALL_DIR)/" @$(INSTALL_DATA) tclConfig.sh "$(CONFIG_INSTALL_DIR)/tclConfig.sh" @echo "Installing tclooConfig.sh to $(CONFIG_INSTALL_DIR)/" diff --git a/win/Makefile.in b/win/Makefile.in index ec824cc..6fdbacf 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -421,7 +421,7 @@ all: binaries libraries doc packages tcltest: $(TCLSH) $(TEST_DLL_FILE) -binaries: $(TCL_STUB_LIB_FILE) @LIBRARIES@ $(DDE_DLL_FILE) $(REG_DLL_FILE) $(TCLSH) +binaries: $(TCL_STUB_LIB_FILE) @LIBRARIES@ $(DDE_DLL_FILE) $(REG_DLL_FILE) $(TCLSH) $(TCLKIT) libraries: @@ -599,7 +599,7 @@ install-binaries: binaries else true; \ fi; \ done; - @for i in $(TCL_DLL_FILE) $(ZLIB_DLL_FILE) $(TCLSH); \ + @for i in $(TCL_DLL_FILE) $(ZLIB_DLL_FILE) $(TCLSH) $(TCLKIT); \ do \ if [ -f $$i ]; then \ echo "Installing $$i to $(BIN_INSTALL_DIR)/"; \ -- cgit v0.12 From 9f12483ed2ebaafdba526e66348417fc76ab4692 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 9 Sep 2014 07:55:45 +0000 Subject: Instead of statically compiling the Tclkit executable straight from .o files, generate a static library (libtclkit.a), and compile against that. --- unix/Makefile.in | 26 +- unix/configure | 20821 +++++++++++++++------------------------------------- unix/configure.in | 5 + unix/tcl.m4 | 10 + 4 files changed, 6086 insertions(+), 14776 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 95a9bff..7d9b82d 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -168,6 +168,7 @@ INSTALL_DATA_DIR = ${INSTALL} -d -m 755 EXE_SUFFIX = @EXEEXT@ TCL_EXE = tclsh${EXE_SUFFIX} TCLKIT_EXE = tclkit${EXE_SUFFIX} +TCLKIT_LIB = tclkit${EXE_SUFFIX} TCLTEST_EXE = tcltest${EXE_SUFFIX} NATIVE_TCLSH = @TCLSH_PROG@ @@ -203,6 +204,9 @@ BUILD_DLTEST = @BUILD_DLTEST@ TCL_LIB_FILE = @TCL_LIB_FILE@ #TCL_LIB_FILE = libtcl.a +TCL_KIT_LIB_FILE = @TCL_KIT_LIB_FILE@ +#TCL_KIT_LIB_FILE = libtclkit.a + # Generic lib name used in rules that apply to tcl and tk LIB_FILE = ${TCL_LIB_FILE} @@ -640,6 +644,17 @@ ${STUB_LIB_FILE}: ${STUB_LIB_OBJS} rm -f $@ @MAKE_STUB_LIB@ + +${TCL_KIT_LIB_FILE}: ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} + rm -f $@ + @MAKE_KIT_LIB@ + + #${SHLIB_LD} $@ ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} ; ${RANLIB} $@ + #${CC} ${CFLAGS} ${LDFLAGS} \ + # ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} \ + # ${CC_SEARCH_FLAGS} -o ${TCL_KIT_LIB_FILE} + + # Make target which outputs the list of the .o contained in the Tcl lib useful # to build a single big shared library containing Tcl and other extensions. # Used for the Tcl Plugin. -- dl @@ -668,11 +683,12 @@ tclkit.vfs: make install-libraries DESTDIR=tclkit.vfs make install-tzdata DESTDIR=tclkit.vfs make install-packages DESTDIR=tclkit.vfs - + # Assemble all of the tcl sources into a single executable -${TCLKIT_EXE}: ${TCLKIT_OBJS} ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} null.zip tclkit.vfs +${TCLKIT_EXE}: ${TCLKIT_OBJS} ${TCL_KIT_LIB_FILE} null.zip tclkit.vfs ${CC} ${CFLAGS} ${LDFLAGS} \ - ${TCLKIT_OBJS} ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} \ + ${TCLKIT_OBJS} \ + @TCL_BUILD_LIB_SPEC@ ${TCL_KIT_LIB_FILE} \ ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} cat null.zip >> ${TCLKIT_EXE} @@ -842,6 +858,10 @@ install-binaries: binaries echo "Installing $(STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \ @INSTALL_STUB_LIB@ ; \ fi + @if test "$(TCL_KIT_LIB_FILE)" != "" ; then \ + echo "Installing $(TCL_KIT_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \ + @INSTALL_KIT_LIB@ ; \ + fi @EXTRA_INSTALL_BINARIES@ @echo "Installing pkg-config file to $(LIB_INSTALL_DIR)/pkgconfig/" @$(INSTALL_DATA_DIR) $(LIB_INSTALL_DIR)/pkgconfig diff --git a/unix/configure b/unix/configure index a82c692..2740498 100755 --- a/unix/configure +++ b/unix/configure @@ -1,81 +1,459 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for tcl 8.6. +# Generated by GNU Autoconf 2.69 for tcl 8.6. +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# # -# 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. ## -## --------------------- ## +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +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 + # Pre-4.2 versions of Zsh do 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 + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac 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 + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' fi +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done 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 +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - $as_unset $as_var + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." fi -done + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` -# PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -83,146 +461,91 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop - s,-$,, - s,^['$as_cr_digits']*\n,, + s/-\n.*// ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" # Exit status is that of the last command. exit } - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file else - as_expr=false + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi -rm -f conf$$ conf$$.exe conf$$.file +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_executable_p="test -f" +as_test_x='test -x' +as_executable_p=as_fn_executable_p # 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'" @@ -231,38 +554,25 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" 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" - -# CDPATH. -$as_unset CDPATH - +test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` -exec 6>&1 - # # Initializations. # ac_default_prefix=/usr/local +ac_clean_files= ac_config_libobj_dir=. +LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='tcl' @@ -270,50 +580,215 @@ PACKAGE_TARNAME='tcl' PACKAGE_VERSION='8.6' PACKAGE_STRING='tcl 8.6' PACKAGE_BUGREPORT='' +PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include #endif -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H # include #endif -#if STDC_HEADERS +#ifdef STDC_HEADERS # include # include #else -# if HAVE_STDLIB_H +# ifdef HAVE_STDLIB_H # include # endif #endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif -#if HAVE_STRINGS_H +#ifdef HAVE_STRINGS_H # include #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H # include -#else -# if HAVE_STDINT_H -# include -# endif #endif -#if HAVE_UNISTD_H +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H # include #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 TCLSH_PROG ZLIB_OBJS ZLIB_SRCS ZLIB_INCLUDE RANLIB ac_ct_RANLIB AR ac_ct_AR LIBOBJS TCL_LIBS DL_LIBS DL_OBJS PLAT_OBJS PLAT_SRCS LDAIX_SRC 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 DLL_INSTALL_DIR INSTALL_STUB_LIB CFLAGS_DEFAULT LDFLAGS_DEFAULT DTRACE TCL_VERSION TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL TCL_YEAR PKG_CFG_ARGS 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 TCL_SHARED_BUILD LD_LIBRARY_PATH_VAR TCL_BUILD_LIB_SPEC TCL_LIB_VERSIONS_OK TCL_SHARED_LIB_SUFFIX TCL_UNSHARED_LIB_SUFFIX TCL_HAS_LONGLONG INSTALL_TZDATA DTRACE_SRC DTRACE_HDR DTRACE_OBJ MAKEFILE_SHELL BUILD_DLTEST TCL_PACKAGE_PATH TCL_MODULE_PATH TCL_LIBRARY PRIVATE_INCLUDE_DIR HTML_DIR PACKAGE_DIR EXTRA_CC_SWITCHES EXTRA_APP_CC_SWITCHES EXTRA_INSTALL EXTRA_INSTALL_BINARIES EXTRA_BUILD_HTML EXTRA_TCLSH_LIBS DLTEST_LD DLTEST_SUFFIX' +ac_subst_vars='DLTEST_SUFFIX +DLTEST_LD +EXTRA_TCLSH_LIBS +EXTRA_BUILD_HTML +EXTRA_INSTALL_BINARIES +EXTRA_INSTALL +EXTRA_APP_CC_SWITCHES +EXTRA_CC_SWITCHES +PACKAGE_DIR +HTML_DIR +PRIVATE_INCLUDE_DIR +TCL_LIBRARY +TCL_MODULE_PATH +TCL_PACKAGE_PATH +BUILD_DLTEST +MAKEFILE_SHELL +DTRACE_OBJ +DTRACE_HDR +DTRACE_SRC +INSTALL_TZDATA +TCL_HAS_LONGLONG +TCL_UNSHARED_LIB_SUFFIX +TCL_SHARED_LIB_SUFFIX +TCL_LIB_VERSIONS_OK +TCL_BUILD_LIB_SPEC +LD_LIBRARY_PATH_VAR +TCL_SHARED_BUILD +CFG_TCL_UNSHARED_LIB_SUFFIX +CFG_TCL_SHARED_LIB_SUFFIX +TCL_SRC_DIR +TCL_BUILD_STUB_LIB_PATH +TCL_BUILD_STUB_LIB_SPEC +TCL_INCLUDE_SPEC +TCL_KIT_LIB_FILE +TCL_STUB_LIB_PATH +TCL_STUB_LIB_SPEC +TCL_STUB_LIB_FLAG +TCL_STUB_LIB_FILE +TCL_LIB_SPEC +TCL_LIB_FLAG +TCL_LIB_FILE +PKG_CFG_ARGS +TCL_YEAR +TCL_PATCH_LEVEL +TCL_MINOR_VERSION +TCL_MAJOR_VERSION +TCL_VERSION +DTRACE +LDFLAGS_DEFAULT +CFLAGS_DEFAULT +INSTALL_KIT_LIB +INSTALL_STUB_LIB +DLL_INSTALL_DIR +INSTALL_LIB +MAKE_STUB_LIB +MAKE_KIT_LIB +MAKE_LIB +SHLIB_SUFFIX +SHLIB_CFLAGS +SHLIB_LD_LIBS +TK_SHLIB_LD_EXTRAS +TCL_SHLIB_LD_EXTRAS +SHLIB_LD +STLIB_LD +LD_SEARCH_FLAGS +CC_SEARCH_FLAGS +LDFLAGS_OPTIMIZE +LDFLAGS_DEBUG +CFLAGS_WARNING +CFLAGS_OPTIMIZE +CFLAGS_DEBUG +LDAIX_SRC +PLAT_SRCS +PLAT_OBJS +DL_OBJS +DL_LIBS +TCL_LIBS +LIBOBJS +AR +RANLIB +ZLIB_INCLUDE +ZLIB_SRCS +ZLIB_OBJS +TCLSH_PROG +TCL_THREADS +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +MAN_FLAGS +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_man_symlinks +enable_man_compression +enable_man_suffix +enable_threads +with_encoding +enable_shared +enable_64bit +enable_64bit_vis +enable_rpath +enable_corefoundation +enable_load +enable_symbols +enable_langinfo +enable_dll_unloading +with_tzdata +enable_dtrace +enable_framework +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + # Initialize some variables set by options. ac_init_help= ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null @@ -336,34 +811,49 @@ x_libraries=NONE # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' +datarootdir='${prefix}/share' +datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' ac_prev= +ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" + eval $ac_prev=\$ac_option ac_prev= continue fi - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_option in + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; @@ -385,33 +875,59 @@ do --config-cache | -C) cache_file=config.cache ;; - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) + -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; esac - eval "enable_$ac_feature='$ac_optarg'" ;; + eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -438,6 +954,12 @@ do -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; @@ -462,13 +984,16 @@ do | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) + | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) @@ -533,6 +1058,16 @@ do | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; @@ -583,26 +1118,36 @@ do ac_init_version=: ;; -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; esac - eval "with_$ac_package='$ac_optarg'" ;; + eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. @@ -622,27 +1167,26 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -650,31 +1194,36 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "missing argument to $ac_option" fi -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac -done +fi -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir do - eval ac_val=$`echo $ac_var` + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -688,8 +1237,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -701,74 +1248,72 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + # 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'` + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then + if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done # # Report the --help message. @@ -791,20 +1336,17 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --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] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -814,18 +1356,25 @@ for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/tcl] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -839,6 +1388,7 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options --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) @@ -876,162 +1426,595 @@ Some influential environment variables: CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. +Report bugs to the package provider. _ACEOF +ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. - ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue 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 "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # 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_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. 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;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; 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 +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested 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 else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } done fi -test -n "$ac_init_help" && exit 0 +test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF tcl configure 8.6 -generated by GNU Autoconf 2.59 +generated by GNU Autoconf 2.69 -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2012 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 + exit 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 tcl $as_me 8.6, which was -generated by GNU Autoconf 2.59. Invocation command line was - $ $0 $@ +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## -_ACEOF +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () { -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` +} # ac_fn_c_try_compile -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -_ASUNAME + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done +} # ac_fn_c_try_cpp -} >&5 +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$4 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by tcl $as_me 8.6, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 cat >&5 <<_ACEOF @@ -1051,7 +2034,6 @@ _ACEOF ac_configure_args= ac_configure_args0= ac_configure_args1= -ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do @@ -1062,13 +2044,13 @@ do -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" + as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else @@ -1084,104 +2066,115 @@ do -* ) 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=" " + as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, -{ +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; + "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" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} + esac | + sort +) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" echo for ac_var in $ac_subst_files do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo - sed "/^$/d" confdefs.h | sort + cat confdefs.h echo fi test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" } >&5 - rm -f core *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status - ' 0 +' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. @@ -1189,112 +2182,137 @@ cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + # Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; esac fi else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} >$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 +for ac_var in $ac_precious_vars; 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" + 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;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_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;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_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=: + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} 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"` ;; + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -1307,31 +2325,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - - - - - - TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 @@ -1382,62 +2375,60 @@ TCL_SRC_DIR="`cd "$srcdir"/..; pwd`" #------------------------------------------------------------------------ - 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" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use symlinks for manpages" >&5 +$as_echo_n "checking whether to use symlinks for manpages... " >&6; } + # Check whether --enable-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; }; };; +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 +$as_echo "$enableval" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to compress the manpages" >&5 +$as_echo_n "checking whether to compress the manpages... " >&6; } + # Check whether --enable-man-compression was given. +if test "${enable_man_compression+set}" = set; then : + enableval=$enable_man_compression; case $enableval in + yes) as_fn_error $? "missing argument to --enable-man-compression" "$LINENO" 5;; no) ;; *) MAN_FLAGS="$MAN_FLAGS --compress $enableval";; esac else enableval="no" -fi; - echo "$as_me:$LINENO: result: $enableval" >&5 -echo "${ECHO_T}$enableval" >&6 +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 +$as_echo "$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compressed file suffix" >&5 +$as_echo_n "checking for compressed file suffix... " >&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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $Z" >&5 +$as_echo "$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to add a package name suffix for the manpages" >&5 +$as_echo_n "checking whether to add a package name suffix for the manpages... " >&6; } + # Check whether --enable-man-suffix was given. +if test "${enable_man_suffix+set}" = set; then : + enableval=$enable_man_suffix; case $enableval in yes) enableval="tcl" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; no) ;; *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; esac else enableval="no" -fi; - echo "$as_me:$LINENO: result: $enableval" >&5 -echo "${ECHO_T}$enableval" >&6 +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 +$as_echo "$enableval" >&6; } @@ -1460,10 +2451,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1473,35 +2464,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1511,39 +2504,50 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1553,77 +2557,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + + fi fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC +if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1634,18 +2598,19 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. @@ -1663,24 +2628,25 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then - for ac_prog in cl + for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1690,39 +2656,41 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC - for ac_prog in cl + for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1732,66 +2700,78 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test -n "$ac_ct_CC" && break done - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi fi fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -1803,112 +2783,108 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' 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. + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [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 + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. break;; * ) break;; esac done +test "$ac_cv_exeext" = no && ac_cv_exeext= + else - echo "$as_me: failed program was:" >&5 + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (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 - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -rm -f a.out a.exe conftest$ac_cv_exeext b.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -1916,38 +2892,90 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 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_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.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 -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext 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. */ +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -1959,45 +2987,46 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi - rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2011,55 +3040,34 @@ 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 +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no + ac_compiler_gnu=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core 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` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2070,39 +3078,49 @@ 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 +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ -ac_cv_prog_cc_g=no + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$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 @@ -2118,23 +3136,18 @@ else CFLAGS= fi fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_prog_cc_stdc=no + ac_cv_prog_cc_c89=no ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -2157,12 +3170,17 @@ static char *f (char * (*g) (char **, int), char **p, ...) /* 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 + as 'x'. The following induces an error, until -std 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. */ + that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -2177,205 +3195,37 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; return 0; } _ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# 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__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -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 - + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg fi -rm -f conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break done -rm -f conftest.$ac_ext conftest.$ac_objext +rm -f conftest.$ac_ext CC=$ac_save_CC fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -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 -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 +if test "x$ac_cv_prog_cc_c89" != xno; then : 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' @@ -2383,18 +3233,14 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking for inline" >&5 -echo $ECHO_N "checking for inline... $ECHO_C" >&6 -if test "${ac_cv_c_inline+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; @@ -2403,41 +3249,16 @@ $ac_kw foo_t foo () {return 0; } #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 - ac_cv_c_inline=$ac_kw; break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break done fi -echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 -echo "${ECHO_T}$ac_cv_c_inline" >&6 - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; @@ -2469,15 +3290,15 @@ 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 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" @@ -2491,11 +3312,7 @@ do # 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -2504,78 +3321,34 @@ cat >>conftest.$ac_ext <<_ACEOF #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 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether non-existent headers + # OK, works on sane cases. Now check whether nonexistent 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _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 +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : break fi @@ -2587,8 +3360,8 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do @@ -2598,11 +3371,7 @@ do # 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -2611,85 +3380,40 @@ cat >>conftest.$ac_ext <<_ACEOF #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 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether non-existent headers + # OK, works on sane cases. Now check whether nonexistent 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _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 +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -2699,31 +3423,142 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" -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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -2738,51 +3573,23 @@ 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 +if ac_fn_c_try_compile "$LINENO"; 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 + ac_cv_header_stdc=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : + $EGREP "memchr" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -2792,18 +3599,14 @@ 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : + $EGREP "free" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -2813,16 +3616,13 @@ fi 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 + 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include +#include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) @@ -2842,109 +3642,39 @@ main () for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); + return 2; + 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 - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_run "$LINENO"; then : -( exit $ac_status ) -ac_cv_header_stdc=no +else + ac_cv_header_stdc=no fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF +$as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - 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 +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -2953,17 +3683,13 @@ 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dirent.h" >&5 +$as_echo_n "checking dirent.h... " >&6; } +if ${tcl_cv_dirent_h+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -2993,1817 +3719,489 @@ closedir(d); 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 +if ac_fn_c_try_link "$LINENO"; 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 + tcl_cv_dirent_h=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_dirent_h" >&5 -echo "${ECHO_T}$tcl_cv_dirent_h" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_dirent_h" >&5 +$as_echo "$tcl_cv_dirent_h" >&6; } if test $tcl_cv_dirent_h = no; then -cat >>confdefs.h <<\_ACEOF -#define NO_DIRENT_H 1 -_ACEOF +$as_echo "#define NO_DIRENT_H 1" >>confdefs.h fi - if test "${ac_cv_header_float_h+set}" = set; then - echo "$as_me:$LINENO: checking for float.h" >&5 -echo $ECHO_N "checking for float.h... $ECHO_C" >&6 -if test "${ac_cv_header_float_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 -echo "${ECHO_T}$ac_cv_header_float_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking float.h usability" >&5 -echo $ECHO_N "checking float.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 -_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 + ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" +if test "x$ac_cv_header_float_h" = xyes; then : + 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 +$as_echo "#define NO_FLOAT_H 1" >>confdefs.h -# Is the header present? -echo "$as_me:$LINENO: checking float.h presence" >&5 -echo $ECHO_N "checking float.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 -_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: float.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: float.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: float.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: float.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: float.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: float.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: float.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: float.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: float.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: float.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: float.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: float.h: 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 float.h" >&5 -echo $ECHO_N "checking for float.h... $ECHO_C" >&6 -if test "${ac_cv_header_float_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_float_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 -echo "${ECHO_T}$ac_cv_header_float_h" >&6 + ac_fn_c_check_header_mongrel "$LINENO" "values.h" "ac_cv_header_values_h" "$ac_includes_default" +if test "x$ac_cv_header_values_h" = xyes; then : -fi -if test $ac_cv_header_float_h = yes; then - : else -cat >>confdefs.h <<\_ACEOF -#define NO_FLOAT_H 1 -_ACEOF +$as_echo "#define NO_VALUES_H 1" >>confdefs.h fi - if test "${ac_cv_header_values_h+set}" = set; then - echo "$as_me:$LINENO: checking for values.h" >&5 -echo $ECHO_N "checking for values.h... $ECHO_C" >&6 -if test "${ac_cv_header_values_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 -echo "${ECHO_T}$ac_cv_header_values_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking values.h usability" >&5 -echo $ECHO_N "checking values.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 -_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_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" +if test "x$ac_cv_header_limits_h" = xyes; then : -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 +$as_echo "#define HAVE_LIMITS_H 1" >>confdefs.h -# Is the header present? -echo "$as_me:$LINENO: checking values.h presence" >&5 -echo $ECHO_N "checking values.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 -_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 +$as_echo "#define NO_LIMITS_H 1" >>confdefs.h + 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: values.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: values.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: values.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: values.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: values.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: values.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: values.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: values.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: values.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: values.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: values.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: values.h: 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 values.h" >&5 -echo $ECHO_N "checking for values.h... $ECHO_C" >&6 -if test "${ac_cv_header_values_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + + ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes; then : + tcl_ok=1 else - ac_cv_header_values_h=$ac_header_preproc + tcl_ok=0 fi -echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 -echo "${ECHO_T}$ac_cv_header_values_h" >&6 -fi -if test $ac_cv_header_values_h = yes; then - : -else -cat >>confdefs.h <<\_ACEOF -#define NO_VALUES_H 1 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + _ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtol" >/dev/null 2>&1; then : +else + tcl_ok=0 fi +rm -f conftest* - - if test "${ac_cv_header_limits_h+set}" = set; then - echo "$as_me:$LINENO: checking for limits.h" >&5 -echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 -if test "${ac_cv_header_limits_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 -echo "${ECHO_T}$ac_cv_header_limits_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking limits.h usability" >&5 -echo $ECHO_N "checking limits.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default -#include +#include + _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 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtoul" >/dev/null 2>&1; then : -ac_header_compiler=no +else + tcl_ok=0 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 +rm -f conftest* -# Is the header present? -echo "$as_me:$LINENO: checking limits.h presence" >&5 -echo $ECHO_N "checking limits.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include + _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 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtod" >/dev/null 2>&1; then : + else - ac_cpp_err=yes + tcl_ok=0 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 +rm -f conftest* - 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 + if test $tcl_ok = 0; then -# 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: limits.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: limits.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: limits.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: limits.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: limits.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: limits.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: limits.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: limits.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: limits.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: limits.h: 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 limits.h" >&5 -echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 -if test "${ac_cv_header_limits_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +$as_echo "#define NO_STDLIB_H 1" >>confdefs.h + + fi + ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" +if test "x$ac_cv_header_string_h" = xyes; then : + tcl_ok=1 else - ac_cv_header_limits_h=$ac_header_preproc + tcl_ok=0 fi -echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 -echo "${ECHO_T}$ac_cv_header_limits_h" >&6 -fi -if test $ac_cv_header_limits_h = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_LIMITS_H 1 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + _ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strstr" >/dev/null 2>&1; then : else + tcl_ok=0 +fi +rm -f conftest* + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include -cat >>confdefs.h <<\_ACEOF -#define NO_LIMITS_H 1 _ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strerror" >/dev/null 2>&1; then : +else + tcl_ok=0 fi +rm -f conftest* - if test "${ac_cv_header_stdlib_h+set}" = set; then - echo "$as_me:$LINENO: checking for stdlib.h" >&5 -echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 -if test "${ac_cv_header_stdlib_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 -echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking stdlib.h usability" >&5 -echo $ECHO_N "checking stdlib.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 -_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 + # See also memmove check below for a place where NO_STRING_H can be + # set and why. -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 + if test $tcl_ok = 0; then -# Is the header present? -echo "$as_me:$LINENO: checking stdlib.h presence" >&5 -echo $ECHO_N "checking stdlib.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 -_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 +$as_echo "#define NO_STRING_H 1" >>confdefs.h - 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 + fi -# 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: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: stdlib.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: stdlib.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: stdlib.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: stdlib.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: stdlib.h: 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 stdlib.h" >&5 -echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 -if test "${ac_cv_header_stdlib_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_stdlib_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 -echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 + ac_fn_c_check_header_mongrel "$LINENO" "sys/wait.h" "ac_cv_header_sys_wait_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_wait_h" = xyes; then : -fi -if test $ac_cv_header_stdlib_h = yes; then - tcl_ok=1 else - tcl_ok=0 + +$as_echo "#define NO_SYS_WAIT_H 1" >>confdefs.h + fi - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include + ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strtol" >/dev/null 2>&1; then - : else - tcl_ok=0 -fi -rm -f conftest* - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include +$as_echo "#define NO_DLFCN_H 1" >>confdefs.h -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strtoul" >/dev/null 2>&1; then - : -else - tcl_ok=0 fi -rm -f conftest* - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include + + # OS/390 lacks sys/param.h (and doesn't need it, by chance). + for ac_header in sys/param.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_param_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_PARAM_H 1 _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strtod" >/dev/null 2>&1; then - : -else - tcl_ok=0 + fi -rm -f conftest* - if test $tcl_ok = 0; then +done -cat >>confdefs.h <<\_ACEOF -#define NO_STDLIB_H 1 -_ACEOF - fi - if test "${ac_cv_header_string_h+set}" = set; then - echo "$as_me:$LINENO: checking for string.h" >&5 -echo $ECHO_N "checking for string.h... $ECHO_C" >&6 -if test "${ac_cv_header_string_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 -echo "${ECHO_T}$ac_cv_header_string_h" >&6 + +#-------------------------------------------------------------------- +# Determines the correct executable file extension (.exe) +#-------------------------------------------------------------------- + + + +#------------------------------------------------------------------------ +# If we're using GCC, see if the compiler understands -pipe. If so, use it. +# It makes compiling go faster. (This is only a performance feature.) +#------------------------------------------------------------------------ + +if test -z "$no_pipe" && test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -pipe" >&5 +$as_echo_n "checking if the compiler understands -pipe... " >&6; } +if ${tcl_cv_cc_pipe+:} false; then : + $as_echo_n "(cached) " >&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking string.h usability" >&5 -echo $ECHO_N "checking string.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default -#include -_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 +int +main () +{ -# Is the header present? -echo "$as_me:$LINENO: checking string.h presence" >&5 -echo $ECHO_N "checking string.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 + ; + return 0; +} _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 +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_cc_pipe=yes else - ac_cpp_err=yes + tcl_cv_cc_pipe=no 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 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$hold_cflags 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: string.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: string.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: string.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: string.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: string.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: string.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: string.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: string.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: string.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: string.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: string.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: string.h: 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 string.h" >&5 -echo $ECHO_N "checking for string.h... $ECHO_C" >&6 -if test "${ac_cv_header_string_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_string_h=$ac_header_preproc +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_pipe" >&5 +$as_echo "$tcl_cv_cc_pipe" >&6; } + if test $tcl_cv_cc_pipe = yes; then + CFLAGS="$CFLAGS -pipe" + fi fi -echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 -echo "${ECHO_T}$ac_cv_header_string_h" >&6 -fi -if test $ac_cv_header_string_h = yes; then - tcl_ok=1 +#------------------------------------------------------------------------ +# Threads support +#------------------------------------------------------------------------ + + + # Check whether --enable-threads was given. +if test "${enable_threads+set}" = set; then : + enableval=$enable_threads; tcl_ok=$enableval else - tcl_ok=0 + tcl_ok=yes fi - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include + if test "${TCL_THREADS}" = 1; then + tcl_threaded_core=1; + fi -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strstr" >/dev/null 2>&1; then - : -else - tcl_ok=0 -fi -rm -f conftest* + if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then + TCL_THREADS=1 + # USE_THREAD_ALLOC tells us to try the special thread-based + # allocator that significantly reduces lock contention - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include +$as_echo "#define USE_THREAD_ALLOC 1" >>confdefs.h -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strerror" >/dev/null 2>&1; then - : -else - tcl_ok=0 -fi -rm -f conftest* +$as_echo "#define _REENTRANT 1" >>confdefs.h - # See also memmove check below for a place where NO_STRING_H can be - # set and why. + if test "`uname -s`" = "SunOS" ; then - if test $tcl_ok = 0; then +$as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h -cat >>confdefs.h <<\_ACEOF -#define NO_STRING_H 1 -_ACEOF + fi - fi +$as_echo "#define _THREAD_SAFE 1" >>confdefs.h - if test "${ac_cv_header_sys_wait_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/wait.h" >&5 -echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_wait_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthread" >&5 +$as_echo_n "checking for pthread_mutex_init in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_mutex_init+:} false; then : + $as_echo_n "(cached) " >&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking sys/wait.h usability" >&5 -echo $ECHO_N "checking sys/wait.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default -#include -_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 sys/wait.h presence" >&5 -echo $ECHO_N "checking sys/wait.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 +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_mutex_init (); +int +main () +{ +return pthread_mutex_init (); + ; + return 0; +} _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 +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_mutex_init=yes else - ac_cpp_err=yes + ac_cv_lib_pthread_pthread_mutex_init=no 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 +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS 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: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: sys/wait.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: sys/wait.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: sys/wait.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/wait.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: sys/wait.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/wait.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: sys/wait.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/wait.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: sys/wait.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/wait.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: sys/wait.h: 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 sys/wait.h" >&5 -echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_wait_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_mutex_init" >&6; } +if test "x$ac_cv_lib_pthread_pthread_mutex_init" = xyes; then : + tcl_ok=yes else - ac_cv_header_sys_wait_h=$ac_header_preproc + tcl_ok=no fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 -fi -if test $ac_cv_header_sys_wait_h = yes; then - : + if test "$tcl_ok" = "no"; then + # Check a little harder for __pthread_mutex_init in the same + # library, as some systems hide it there until pthread.h is + # defined. We could alternatively do an AC_TRY_COMPILE with + # pthread.h, but that will work with libpthread really doesn't + # exist, like AIX 4.2. [Bug: 4359] + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_mutex_init in -lpthread" >&5 +$as_echo_n "checking for __pthread_mutex_init in -lpthread... " >&6; } +if ${ac_cv_lib_pthread___pthread_mutex_init+:} false; then : + $as_echo_n "(cached) " >&6 else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -cat >>confdefs.h <<\_ACEOF -#define NO_SYS_WAIT_H 1 +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char __pthread_mutex_init (); +int +main () +{ +return __pthread_mutex_init (); + ; + return 0; +} _ACEOF - -fi - - - if test "${ac_cv_header_dlfcn_h+set}" = set; then - echo "$as_me:$LINENO: checking for dlfcn.h" >&5 -echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 -if test "${ac_cv_header_dlfcn_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 -echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 -echo $ECHO_N "checking dlfcn.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 -_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 dlfcn.h presence" >&5 -echo $ECHO_N "checking dlfcn.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 -_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: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: dlfcn.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: dlfcn.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: dlfcn.h: 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 dlfcn.h" >&5 -echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 -if test "${ac_cv_header_dlfcn_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_dlfcn_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 -echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 - -fi -if test $ac_cv_header_dlfcn_h = yes; then - : -else - -cat >>confdefs.h <<\_ACEOF -#define NO_DLFCN_H 1 -_ACEOF - -fi - - - - # OS/390 lacks sys/param.h (and doesn't need it, by chance). - -for ac_header in sys/param.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 +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread___pthread_mutex_init=yes 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 - + ac_cv_lib_pthread___pthread_mutex_init=no fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi - -done - - - -#-------------------------------------------------------------------- -# Determines the correct executable file extension (.exe) -#-------------------------------------------------------------------- - - - -#------------------------------------------------------------------------ -# If we're using GCC, see if the compiler understands -pipe. If so, use it. -# It makes compiling go faster. (This is only a performance feature.) -#------------------------------------------------------------------------ - -if test -z "$no_pipe" && test -n "$GCC"; then - echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5 -echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6 -if test "${tcl_cv_cc_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" - 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 - tcl_cv_cc_pipe=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5 +$as_echo "$ac_cv_lib_pthread___pthread_mutex_init" >&6; } +if test "x$ac_cv_lib_pthread___pthread_mutex_init" = xyes; then : + tcl_ok=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_cc_pipe=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$hold_cflags -fi -echo "$as_me:$LINENO: result: $tcl_cv_cc_pipe" >&5 -echo "${ECHO_T}$tcl_cv_cc_pipe" >&6 - if test $tcl_cv_cc_pipe = yes; then - CFLAGS="$CFLAGS -pipe" - fi + tcl_ok=no fi -#------------------------------------------------------------------------ -# Threads support -#------------------------------------------------------------------------ - - - # Check whether --enable-threads or --disable-threads was given. -if test "${enable_threads+set}" = set; then - enableval="$enable_threads" - tcl_ok=$enableval -else - tcl_ok=yes -fi; - - if test "${TCL_THREADS}" = 1; then - tcl_threaded_core=1; - fi - - if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then - TCL_THREADS=1 - # USE_THREAD_ALLOC tells us to try the special thread-based - # allocator that significantly reduces lock contention - -cat >>confdefs.h <<\_ACEOF -#define USE_THREAD_ALLOC 1 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define _REENTRANT 1 -_ACEOF - - if test "`uname -s`" = "SunOS" ; then - -cat >>confdefs.h <<\_ACEOF -#define _POSIX_PTHREAD_SEMANTICS 1 -_ACEOF - fi -cat >>confdefs.h <<\_ACEOF -#define _THREAD_SAFE 1 -_ACEOF - - echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5 -echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6 -if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthread" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthreads" >&5 +$as_echo_n "checking for pthread_mutex_init in -lpthreads... " >&6; } +if ${ac_cv_lib_pthreads_pthread_mutex_init+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +LIBS="-lpthreads $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 pthread_mutex_init (); int main () { -pthread_mutex_init (); +return pthread_mutex_init (); ; 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_lib_pthread_pthread_mutex_init=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthreads_pthread_mutex_init=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_pthread_pthread_mutex_init=no + ac_cv_lib_pthreads_pthread_mutex_init=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5 -echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6 -if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5 +$as_echo "$ac_cv_lib_pthreads_pthread_mutex_init" >&6; } +if test "x$ac_cv_lib_pthreads_pthread_mutex_init" = xyes; then : tcl_ok=yes else tcl_ok=no fi - if test "$tcl_ok" = "no"; then - # Check a little harder for __pthread_mutex_init in the same - # library, as some systems hide it there until pthread.h is - # defined. We could alternatively do an AC_TRY_COMPILE with - # pthread.h, but that will work with libpthread really doesn't - # exist, like AIX 4.2. [Bug: 4359] - echo "$as_me:$LINENO: checking for __pthread_mutex_init in -lpthread" >&5 -echo $ECHO_N "checking for __pthread_mutex_init in -lpthread... $ECHO_C" >&6 -if test "${ac_cv_lib_pthread___pthread_mutex_init+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -lpthreads" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lc" >&5 +$as_echo_n "checking for pthread_mutex_init in -lc... " >&6; } +if ${ac_cv_lib_c_pthread_mutex_init+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +LIBS="-lc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 __pthread_mutex_init (); +char pthread_mutex_init (); int main () { -__pthread_mutex_init (); +return pthread_mutex_init (); ; 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_lib_pthread___pthread_mutex_init=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_pthread_mutex_init=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_pthread___pthread_mutex_init=no + ac_cv_lib_c_pthread_mutex_init=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5 -echo "${ECHO_T}$ac_cv_lib_pthread___pthread_mutex_init" >&6 -if test $ac_cv_lib_pthread___pthread_mutex_init = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_pthread_mutex_init" >&5 +$as_echo "$ac_cv_lib_c_pthread_mutex_init" >&6; } +if test "x$ac_cv_lib_c_pthread_mutex_init" = xyes; then : tcl_ok=yes else tcl_ok=no fi - fi - - if test "$tcl_ok" = "yes"; then - # The space is needed - THREADS_LIBS=" -lpthread" - else - echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthreads" >&5 -echo $ECHO_N "checking for pthread_mutex_init in -lpthreads... $ECHO_C" >&6 -if test "${ac_cv_lib_pthreads_pthread_mutex_init+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if test "$tcl_ok" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lc_r" >&5 +$as_echo_n "checking for pthread_mutex_init in -lc_r... " >&6; } +if ${ac_cv_lib_c_r_pthread_mutex_init+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthreads $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +LIBS="-lc_r $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 pthread_mutex_init (); int main () { -pthread_mutex_init (); +return pthread_mutex_init (); ; 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_lib_pthreads_pthread_mutex_init=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_r_pthread_mutex_init=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_pthreads_pthread_mutex_init=no + ac_cv_lib_c_r_pthread_mutex_init=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5 -echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_mutex_init" >&6 -if test $ac_cv_lib_pthreads_pthread_mutex_init = yes; then - tcl_ok=yes -else - tcl_ok=no -fi - - if test "$tcl_ok" = "yes"; then - # The space is needed - THREADS_LIBS=" -lpthreads" - else - echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc" >&5 -echo $ECHO_N "checking for pthread_mutex_init in -lc... $ECHO_C" >&6 -if test "${ac_cv_lib_c_pthread_mutex_init+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* 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 pthread_mutex_init (); -int -main () -{ -pthread_mutex_init (); - ; - 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_lib_c_pthread_mutex_init=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_c_pthread_mutex_init=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_c_pthread_mutex_init" >&5 -echo "${ECHO_T}$ac_cv_lib_c_pthread_mutex_init" >&6 -if test $ac_cv_lib_c_pthread_mutex_init = yes; then - tcl_ok=yes -else - tcl_ok=no -fi - - if test "$tcl_ok" = "no"; then - echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc_r" >&5 -echo $ECHO_N "checking for pthread_mutex_init in -lc_r... $ECHO_C" >&6 -if test "${ac_cv_lib_c_r_pthread_mutex_init+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc_r $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* 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 pthread_mutex_init (); -int -main () -{ -pthread_mutex_init (); - ; - 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_lib_c_r_pthread_mutex_init=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_c_r_pthread_mutex_init=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5 -echo "${ECHO_T}$ac_cv_lib_c_r_pthread_mutex_init" >&6 -if test $ac_cv_lib_c_r_pthread_mutex_init = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5 +$as_echo "$ac_cv_lib_c_r_pthread_mutex_init" >&6; } +if test "x$ac_cv_lib_c_r_pthread_mutex_init" = xyes; then : tcl_ok=yes else tcl_ok=no @@ -4814,8 +4212,8 @@ fi THREADS_LIBS=" -pthread" else TCL_THREADS=0 - { echo "$as_me:$LINENO: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&5 -echo "$as_me: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&5 +$as_echo "$as_me: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&2;} fi fi fi @@ -4826,104 +4224,13 @@ echo "$as_me: WARNING: Don't know how to find pthread lib on your system - you m ac_saved_libs=$LIBS LIBS="$LIBS $THREADS_LIBS" - - -for ac_func in pthread_attr_setstacksize pthread_atfork -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 declares $ac_func. - For example, HP-UX 11i 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 to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#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 + for ac_func in pthread_attr_setstacksize pthread_atfork +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -4934,24 +4241,22 @@ done TCL_THREADS=0 fi # Do checking message here to not mess up interleaved configure output - echo "$as_me:$LINENO: checking for building with threads" >&5 -echo $ECHO_N "checking for building with threads... $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for building with threads" >&5 +$as_echo_n "checking for building with threads... " >&6; } if test "${TCL_THREADS}" = 1; then -cat >>confdefs.h <<\_ACEOF -#define TCL_THREADS 1 -_ACEOF +$as_echo "#define TCL_THREADS 1" >>confdefs.h if test "${tcl_threaded_core}" = 1; then - echo "$as_me:$LINENO: result: yes (threaded core)" >&5 -echo "${ECHO_T}yes (threaded core)" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (threaded core)" >&5 +$as_echo "yes (threaded core)" >&6; } else - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -4963,11 +4268,11 @@ echo "${ECHO_T}no" >&6 -# Check whether --with-encoding or --without-encoding was given. -if test "${with_encoding+set}" = set; then - withval="$with_encoding" - with_tcencoding=${withval} -fi; +# Check whether --with-encoding was given. +if test "${with_encoding+set}" = set; then : + withval=$with_encoding; with_tcencoding=${withval} +fi + if test x"${with_tcencoding}" != x ; then @@ -4977,9 +4282,7 @@ _ACEOF else -cat >>confdefs.h <<\_ACEOF -#define TCL_CFGVAL_ENCODING "iso8859-1" -_ACEOF +$as_echo "#define TCL_CFGVAL_ENCODING \"iso8859-1\"" >>confdefs.h fi @@ -4996,161 +4299,44 @@ _ACEOF # right (and it must appear before "-lm"). #-------------------------------------------------------------------- - echo "$as_me:$LINENO: checking for sin" >&5 -echo $ECHO_N "checking for sin... $ECHO_C" >&6 -if test "${ac_cv_func_sin+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 sin to an innocuous variant, in case declares sin. - For example, HP-UX 11i declares gettimeofday. */ -#define sin innocuous_sin - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char sin (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef sin - -/* 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 sin (); -/* 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_sin) || defined (__stub___sin) -choke me -#else -char (*f) () = sin; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != sin; - ; - 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_sin=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_sin=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_sin" >&5 -echo "${ECHO_T}$ac_cv_func_sin" >&6 -if test $ac_cv_func_sin = yes; then + ac_fn_c_check_func "$LINENO" "sin" "ac_cv_func_sin" +if test "x$ac_cv_func_sin" = xyes; then : MATH_LIBS="" else MATH_LIBS="-lm" fi - echo "$as_me:$LINENO: checking for main in -lieee" >&5 -echo $ECHO_N "checking for main in -lieee... $ECHO_C" >&6 -if test "${ac_cv_lib_ieee_main+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lieee" >&5 +$as_echo_n "checking for main in -lieee... " >&6; } +if ${ac_cv_lib_ieee_main+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lieee $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { -main (); +return main (); ; 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 +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ieee_main=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_ieee_main=no + ac_cv_lib_ieee_main=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_ieee_main" >&5 -echo "${ECHO_T}$ac_cv_lib_ieee_main" >&6 -if test $ac_cv_lib_ieee_main = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ieee_main" >&5 +$as_echo "$ac_cv_lib_ieee_main" >&6; } +if test "x$ac_cv_lib_ieee_main" = xyes; then : MATH_LIBS="-lieee $MATH_LIBS" fi @@ -5160,211 +4346,45 @@ fi # needs net/errno.h to define the socket-related error codes. #-------------------------------------------------------------------- - echo "$as_me:$LINENO: checking for main in -linet" >&5 -echo $ECHO_N "checking for main in -linet... $ECHO_C" >&6 -if test "${ac_cv_lib_inet_main+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -linet" >&5 +$as_echo_n "checking for main in -linet... " >&6; } +if ${ac_cv_lib_inet_main+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-linet $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { -main (); +return main (); ; 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 +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_inet_main=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_inet_main=no + ac_cv_lib_inet_main=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_inet_main" >&5 -echo "${ECHO_T}$ac_cv_lib_inet_main" >&6 -if test $ac_cv_lib_inet_main = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_main" >&5 +$as_echo "$ac_cv_lib_inet_main" >&6; } +if test "x$ac_cv_lib_inet_main" = xyes; then : LIBS="$LIBS -linet" fi - if test "${ac_cv_header_net_errno_h+set}" = set; then - echo "$as_me:$LINENO: checking for net/errno.h" >&5 -echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 -if test "${ac_cv_header_net_errno_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 -echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking net/errno.h usability" >&5 -echo $ECHO_N "checking net/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 -_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 net/errno.h presence" >&5 -echo $ECHO_N "checking net/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 -_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: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: net/errno.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: net/errno.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: net/errno.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: net/errno.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: net/errno.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: net/errno.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: net/errno.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: net/errno.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: net/errno.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: net/errno.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: net/errno.h: 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 net/errno.h" >&5 -echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 -if test "${ac_cv_header_net_errno_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_net_errno_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 -echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 - -fi -if test $ac_cv_header_net_errno_h = yes; then + ac_fn_c_check_header_mongrel "$LINENO" "net/errno.h" "ac_cv_header_net_errno_h" "$ac_includes_default" +if test "x$ac_cv_header_net_errno_h" = xyes; then : -cat >>confdefs.h <<\_ACEOF -#define HAVE_NET_ERRNO_H 1 -_ACEOF +$as_echo "#define HAVE_NET_ERRNO_H 1" >>confdefs.h fi @@ -5389,264 +4409,58 @@ fi #-------------------------------------------------------------------- tcl_checkBoth=0 - echo "$as_me:$LINENO: checking for connect" >&5 -echo $ECHO_N "checking for connect... $ECHO_C" >&6 -if test "${ac_cv_func_connect+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" +if test "x$ac_cv_func_connect" = xyes; then : + tcl_checkSocket=0 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define connect to an innocuous variant, in case declares connect. - For example, HP-UX 11i declares gettimeofday. */ -#define connect innocuous_connect - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char connect (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ + tcl_checkSocket=1 +fi -#ifdef __STDC__ -# include -#else -# include -#endif + if test "$tcl_checkSocket" = 1; then + ac_fn_c_check_func "$LINENO" "setsockopt" "ac_cv_func_setsockopt" +if test "x$ac_cv_func_setsockopt" = xyes; then : -#undef connect +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setsockopt in -lsocket" >&5 +$as_echo_n "checking for setsockopt in -lsocket... " >&6; } +if ${ac_cv_lib_socket_setsockopt+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -/* 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 +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -char connect (); -/* 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_connect) || defined (__stub___connect) -choke me -#else -char (*f) () = connect; -#endif #ifdef __cplusplus -} +extern "C" #endif - +char setsockopt (); int main () { -return f != connect; +return setsockopt (); ; 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_connect=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_socket_setsockopt=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_connect=no + ac_cv_lib_socket_setsockopt=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 -echo "${ECHO_T}$ac_cv_func_connect" >&6 -if test $ac_cv_func_connect = yes; then - tcl_checkSocket=0 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_setsockopt" >&5 +$as_echo "$ac_cv_lib_socket_setsockopt" >&6; } +if test "x$ac_cv_lib_socket_setsockopt" = xyes; then : + LIBS="$LIBS -lsocket" else - tcl_checkSocket=1 -fi - - if test "$tcl_checkSocket" = 1; then - echo "$as_me:$LINENO: checking for setsockopt" >&5 -echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6 -if test "${ac_cv_func_setsockopt+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 setsockopt to an innocuous variant, in case declares setsockopt. - For example, HP-UX 11i declares gettimeofday. */ -#define setsockopt innocuous_setsockopt - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char setsockopt (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef setsockopt - -/* 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 setsockopt (); -/* 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_setsockopt) || defined (__stub___setsockopt) -choke me -#else -char (*f) () = setsockopt; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != setsockopt; - ; - 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_setsockopt=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_setsockopt=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_setsockopt" >&5 -echo "${ECHO_T}$ac_cv_func_setsockopt" >&6 -if test $ac_cv_func_setsockopt = yes; then - : -else - echo "$as_me:$LINENO: checking for setsockopt in -lsocket" >&5 -echo $ECHO_N "checking for setsockopt in -lsocket... $ECHO_C" >&6 -if test "${ac_cv_lib_socket_setsockopt+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* 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 setsockopt (); -int -main () -{ -setsockopt (); - ; - 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_lib_socket_setsockopt=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_socket_setsockopt=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_socket_setsockopt" >&5 -echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6 -if test $ac_cv_lib_socket_setsockopt = yes; then - LIBS="$LIBS -lsocket" -else - tcl_checkBoth=1 + tcl_checkBoth=1 fi fi @@ -5655,261 +4469,55 @@ fi if test "$tcl_checkBoth" = 1; then tk_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" - echo "$as_me:$LINENO: checking for accept" >&5 -echo $ECHO_N "checking for accept... $ECHO_C" >&6 -if test "${ac_cv_func_accept+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 accept to an innocuous variant, in case declares accept. - For example, HP-UX 11i declares gettimeofday. */ -#define accept innocuous_accept - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char accept (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef accept - -/* 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 accept (); -/* 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_accept) || defined (__stub___accept) -choke me -#else -char (*f) () = accept; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != accept; - ; - 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_accept=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_accept=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_accept" >&5 -echo "${ECHO_T}$ac_cv_func_accept" >&6 -if test $ac_cv_func_accept = yes; then + ac_fn_c_check_func "$LINENO" "accept" "ac_cv_func_accept" +if test "x$ac_cv_func_accept" = xyes; then : tcl_checkNsl=0 else LIBS=$tk_oldLibs fi fi - echo "$as_me:$LINENO: checking for gethostbyname" >&5 -echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 -if test "${ac_cv_func_gethostbyname+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 gethostbyname to an innocuous variant, in case declares gethostbyname. - For example, HP-UX 11i declares gettimeofday. */ -#define gethostbyname innocuous_gethostbyname - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gethostbyname (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef gethostbyname - -/* 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 gethostbyname (); -/* 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_gethostbyname) || defined (__stub___gethostbyname) -choke me -#else -char (*f) () = gethostbyname; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != gethostbyname; - ; - 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_gethostbyname=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" +if test "x$ac_cv_func_gethostbyname" = xyes; then : -ac_cv_func_gethostbyname=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 -echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 -if test $ac_cv_func_gethostbyname = yes; then - : else - echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 -echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 -if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 +$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } +if ${ac_cv_lib_nsl_gethostbyname+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 gethostbyname (); int main () { -gethostbyname (); +return gethostbyname (); ; 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 +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_nsl_gethostbyname=no + ac_cv_lib_nsl_gethostbyname=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 -echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 -if test $ac_cv_lib_nsl_gethostbyname = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 +$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } +if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : LIBS="$LIBS -lnsl" fi @@ -5921,15 +4529,15 @@ fi LIBS="$LIBS$THREADS_LIBS" - echo "$as_me:$LINENO: checking how to build libraries" >&5 -echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6 - # Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - tcl_ok=$enableval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5 +$as_echo_n "checking how to build libraries... " >&6; } + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; tcl_ok=$enableval else tcl_ok=yes -fi; +fi + if test "${enable_shared+set}" = set; then enableval="$enable_shared" @@ -5939,17 +4547,15 @@ fi; fi if test "$tcl_ok" = "yes" ; then - echo "$as_me:$LINENO: result: shared" >&5 -echo "${ECHO_T}shared" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: shared" >&5 +$as_echo "shared" >&6; } SHARED_BUILD=1 else - echo "$as_me:$LINENO: result: static" >&5 -echo "${ECHO_T}static" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5 +$as_echo "static" >&6; } SHARED_BUILD=0 -cat >>confdefs.h <<\_ACEOF -#define STATIC_BUILD 1 -_ACEOF +$as_echo "#define STATIC_BUILD 1" >>confdefs.h fi @@ -5961,10 +4567,10 @@ _ACEOF #-------------------------------------------------------------------- - echo "$as_me:$LINENO: checking for tclsh" >&5 -echo $ECHO_N "checking for tclsh... $ECHO_C" >&6 - if test "${ac_cv_path_tclsh+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5 +$as_echo_n "checking for tclsh... " >&6; } + if ${ac_cv_path_tclsh+:} false; then : + $as_echo_n "(cached) " >&6 else search_path=`echo ${PATH} | sed -e 's/:/ /g'` @@ -5985,13 +4591,13 @@ fi if test -f "$ac_cv_path_tclsh" ; then TCLSH_PROG="$ac_cv_path_tclsh" - echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5 -echo "${ECHO_T}$TCLSH_PROG" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH_PROG" >&5 +$as_echo "$TCLSH_PROG" >&6; } else # It is not an error if an installed version of Tcl can't be located. TCLSH_PROG="" - echo "$as_me:$LINENO: result: No tclsh found on PATH" >&5 -echo "${ECHO_T}No tclsh found on PATH" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: No tclsh found on PATH" >&5 +$as_echo "No tclsh found on PATH" >&6; } fi @@ -6004,351 +4610,89 @@ fi #------------------------------------------------------------------------ zlib_ok=yes -if test "${ac_cv_header_zlib_h+set}" = set; then - echo "$as_me:$LINENO: checking for zlib.h" >&5 -echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6 -if test "${ac_cv_header_zlib_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 -echo "${ECHO_T}$ac_cv_header_zlib_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking zlib.h usability" >&5 -echo $ECHO_N "checking zlib.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 -_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_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" +if test "x$ac_cv_header_zlib_h" = xyes; then : -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 + ac_fn_c_check_type "$LINENO" "gz_header" "ac_cv_type_gz_header" "#include +" +if test "x$ac_cv_type_gz_header" = xyes; then : -# Is the header present? -echo "$as_me:$LINENO: checking zlib.h presence" >&5 -echo $ECHO_N "checking zlib.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 -_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 + zlib_ok=no 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 + zlib_ok=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: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: zlib.h: 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 zlib.h" >&5 -echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6 -if test "${ac_cv_header_zlib_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_zlib_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 -echo "${ECHO_T}$ac_cv_header_zlib_h" >&6 -fi -if test $ac_cv_header_zlib_h = yes; then +if test $zlib_ok = yes; then : - echo "$as_me:$LINENO: checking for gz_header" >&5 -echo $ECHO_N "checking for gz_header... $ECHO_C" >&6 -if test "${ac_cv_type_gz_header+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing deflateSetHeader" >&5 +$as_echo_n "checking for library containing deflateSetHeader... " >&6; } +if ${ac_cv_search_deflateSetHeader+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char deflateSetHeader (); int main () { -if ((gz_header *) 0) - return 0; -if (sizeof (gz_header)) - return 0; +return deflateSetHeader (); ; 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_gz_header=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_gz_header=no +for ac_lib in '' z; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_deflateSetHeader=$ac_res fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_deflateSetHeader+:} false; then : + break fi -echo "$as_me:$LINENO: result: $ac_cv_type_gz_header" >&5 -echo "${ECHO_T}$ac_cv_type_gz_header" >&6 -if test $ac_cv_type_gz_header = yes; then - : +done +if ${ac_cv_search_deflateSetHeader+:} false; then : + else - zlib_ok=no + ac_cv_search_deflateSetHeader=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_deflateSetHeader" >&5 +$as_echo "$ac_cv_search_deflateSetHeader" >&6; } +ac_res=$ac_cv_search_deflateSetHeader +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else - zlib_ok=no + zlib_ok=no + fi +fi +if test $zlib_ok = no; then : -if test $zlib_ok = yes; then - - echo "$as_me:$LINENO: checking for library containing deflateSetHeader" >&5 -echo $ECHO_N "checking for library containing deflateSetHeader... $ECHO_C" >&6 -if test "${ac_cv_search_deflateSetHeader+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_deflateSetHeader=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* 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 deflateSetHeader (); -int -main () -{ -deflateSetHeader (); - ; - 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_search_deflateSetHeader="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_deflateSetHeader" = no; then - for ac_lib in z; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* 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 deflateSetHeader (); -int -main () -{ -deflateSetHeader (); - ; - 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_search_deflateSetHeader="-l$ac_lib" -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_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_deflateSetHeader" >&5 -echo "${ECHO_T}$ac_cv_search_deflateSetHeader" >&6 -if test "$ac_cv_search_deflateSetHeader" != no; then - test "$ac_cv_search_deflateSetHeader" = "none required" || LIBS="$ac_cv_search_deflateSetHeader $LIBS" - -else - - zlib_ok=no - -fi - -fi - -if test $zlib_ok = no; then - - ZLIB_OBJS=\${ZLIB_OBJS} + ZLIB_OBJS=\${ZLIB_OBJS} ZLIB_SRCS=\${ZLIB_SRCS} @@ -6357,10 +4701,7 @@ if test $zlib_ok = no; then fi - -cat >>confdefs.h <<\_ACEOF -#define HAVE_ZLIB 1 -_ACEOF +$as_echo "#define HAVE_ZLIB 1" >>confdefs.h #-------------------------------------------------------------------- @@ -6372,10 +4713,10 @@ _ACEOF if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. @@ -6385,35 +4726,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$as_me:$LINENO: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. @@ -6423,28 +4766,38 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS - test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - RANLIB=$ac_ct_RANLIB + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi else RANLIB="$ac_cv_prog_RANLIB" fi @@ -6453,52 +4806,47 @@ fi # Step 0.a: Enable 64 bit support? - echo "$as_me:$LINENO: checking if 64bit support is requested" >&5 -echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6 - # Check whether --enable-64bit or --disable-64bit was given. -if test "${enable_64bit+set}" = set; then - enableval="$enable_64bit" - do64bit=$enableval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if 64bit support is requested" >&5 +$as_echo_n "checking if 64bit support is requested... " >&6; } + # Check whether --enable-64bit was given. +if test "${enable_64bit+set}" = set; then : + enableval=$enable_64bit; do64bit=$enableval else do64bit=no -fi; - echo "$as_me:$LINENO: result: $do64bit" >&5 -echo "${ECHO_T}$do64bit" >&6 +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $do64bit" >&5 +$as_echo "$do64bit" >&6; } # Step 0.b: Enable Solaris 64 bit VIS support? - echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5 -echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6 - # Check whether --enable-64bit-vis or --disable-64bit-vis was given. -if test "${enable_64bit_vis+set}" = set; then - enableval="$enable_64bit_vis" - do64bitVIS=$enableval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if 64bit Sparc VIS support is requested" >&5 +$as_echo_n "checking if 64bit Sparc VIS support is requested... " >&6; } + # Check whether --enable-64bit-vis was given. +if test "${enable_64bit_vis+set}" = set; then : + enableval=$enable_64bit_vis; do64bitVIS=$enableval else do64bitVIS=no -fi; - echo "$as_me:$LINENO: result: $do64bitVIS" >&5 -echo "${ECHO_T}$do64bitVIS" >&6 +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $do64bitVIS" >&5 +$as_echo "$do64bitVIS" >&6; } # Force 64bit on with VIS - if test "$do64bitVIS" = "yes"; then + if test "$do64bitVIS" = "yes"; then : do64bit=yes fi - # Step 0.c: Check if visibility support is available. Do this here so # that platform specific alternatives can be used below if this fails. - echo "$as_me:$LINENO: checking if compiler supports visibility \"hidden\"" >&5 -echo $ECHO_N "checking if compiler supports visibility \"hidden\"... $ECHO_C" >&6 -if test "${tcl_cv_cc_visibility_hidden+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports visibility \"hidden\"" >&5 +$as_echo_n "checking if compiler supports visibility \"hidden\"... " >&6; } +if ${tcl_cv_cc_visibility_hidden+:} false; then : + $as_echo_n "(cached) " >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ extern __attribute__((__visibility__("hidden"))) void f(void); @@ -6511,79 +4859,50 @@ f(); 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 +if ac_fn_c_try_link "$LINENO"; then : tcl_cv_cc_visibility_hidden=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_cc_visibility_hidden=no + tcl_cv_cc_visibility_hidden=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi -echo "$as_me:$LINENO: result: $tcl_cv_cc_visibility_hidden" >&5 -echo "${ECHO_T}$tcl_cv_cc_visibility_hidden" >&6 - if test $tcl_cv_cc_visibility_hidden = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_visibility_hidden" >&5 +$as_echo "$tcl_cv_cc_visibility_hidden" >&6; } + if test $tcl_cv_cc_visibility_hidden = yes; then : -cat >>confdefs.h <<\_ACEOF -#define MODULE_SCOPE extern __attribute__((__visibility__("hidden"))) -_ACEOF +$as_echo "#define MODULE_SCOPE extern __attribute__((__visibility__(\"hidden\")))" >>confdefs.h -cat >>confdefs.h <<\_ACEOF -#define HAVE_HIDDEN 1 -_ACEOF +$as_echo "#define HAVE_HIDDEN 1" >>confdefs.h fi - # Step 0.d: Disable -rpath support? - echo "$as_me:$LINENO: checking if rpath support is requested" >&5 -echo $ECHO_N "checking if rpath support is requested... $ECHO_C" >&6 - # Check whether --enable-rpath or --disable-rpath was given. -if test "${enable_rpath+set}" = set; then - enableval="$enable_rpath" - doRpath=$enableval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if rpath support is requested" >&5 +$as_echo_n "checking if rpath support is requested... " >&6; } + # Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then : + enableval=$enable_rpath; doRpath=$enableval else doRpath=yes -fi; - echo "$as_me:$LINENO: result: $doRpath" >&5 -echo "${ECHO_T}$doRpath" >&6 +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doRpath" >&5 +$as_echo "$doRpath" >&6; } # Step 1: set the variable "system" to hold the name and version number # for the system. - echo "$as_me:$LINENO: checking system version" >&5 -echo $ECHO_N "checking system version... $ECHO_C" >&6 -if test "${tcl_cv_sys_version+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking system version" >&5 +$as_echo_n "checking system version... " >&6; } +if ${tcl_cv_sys_version+:} false; then : + $as_echo_n "(cached) " >&6 else if test -f /usr/lib/NextStep/software_version; then @@ -6591,8 +4910,8 @@ else else tcl_cv_sys_version=`uname -s`-`uname -r` if test "$?" -ne 0 ; then - { echo "$as_me:$LINENO: WARNING: can't find uname command" >&5 -echo "$as_me: WARNING: can't find uname command" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: can't find uname command" >&5 +$as_echo "$as_me: WARNING: can't find uname command" >&2;} tcl_cv_sys_version=unknown else # Special check for weird MP-RAS system (uname returns weird @@ -6608,79 +4927,51 @@ echo "$as_me: WARNING: can't find uname command" >&2;} fi fi -echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5 -echo "${ECHO_T}$tcl_cv_sys_version" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_sys_version" >&5 +$as_echo "$tcl_cv_sys_version" >&6; } system=$tcl_cv_sys_version # Step 2: check for existence of -ldl library. This is needed because # Linux can use either -ldl or -ldld for dynamic loading. - echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 dlopen (); int main () { -dlopen (); +return dlopen (); ; 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 +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dl_dlopen=no + ac_cv_lib_dl_dlopen=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : have_dl=yes else have_dl=no @@ -6706,7 +4997,7 @@ fi ECHO_VERSION='`echo ${VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g - if test "$GCC" = yes; then + if test "$GCC" = yes; then : CFLAGS_OPTIMIZE=-O2 CFLAGS_WARNING="-Wall" @@ -6717,14 +5008,13 @@ else CFLAGS_WARNING="" fi - if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. @@ -6734,35 +5024,37 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then - echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. @@ -6772,27 +5064,38 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then - echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 -echo "${ECHO_T}$ac_ct_AR" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi - AR=$ac_ct_AR + if test "x$ac_ct_AR" = x; then + AR="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi else AR="$ac_cv_prog_AR" fi @@ -6802,13 +5105,12 @@ fi PLAT_OBJS="" PLAT_SRCS="" LDAIX_SRC="" - if test x"${SHLIB_VERSION}" = x; then + if test x"${SHLIB_VERSION}" = x; then : SHLIB_VERSION="1.0" fi - case $system in AIX-*) - if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"; then + if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"; then : # AIX requires the _r compiler when gcc isn't being used case "${CC}" in @@ -6820,11 +5122,10 @@ fi CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'` ;; esac - echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5 -echo "${ECHO_T}Using $CC for compiling with threads" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using $CC for compiling with threads" >&5 +$as_echo "Using $CC for compiling with threads" >&6; } fi - LIBS="$LIBS -lc" SHLIB_CFLAGS="" SHLIB_SUFFIX=".so" @@ -6837,12 +5138,12 @@ fi LDAIX_SRC='$(UNIX_DIR)/ldAix' # Check to enable 64-bit flags for compiler/linker - if test "$do64bit" = yes; then + if test "$do64bit" = yes; then : - if test "$GCC" = yes; 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;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5 +$as_echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} else @@ -6855,17 +5156,15 @@ else fi - fi - - if test "`uname -m`" = ia64; then + if test "`uname -m`" = ia64; then : # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC SHLIB_LD="/usr/ccs/bin/ld -G -z text" # AIX-5 has dl* in libc.so DL_LIBS="" - if test "$GCC" = yes; then + if test "$GCC" = yes; then : CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' @@ -6874,12 +5173,11 @@ else CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' fi - LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' else - if test "$GCC" = yes; then + if test "$GCC" = yes; then : SHLIB_LD='${CC} -shared -Wl,-bexpall' @@ -6889,14 +5187,12 @@ else LDFLAGS="$LDFLAGS -brtl" fi - SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi - ;; BeOS*) SHLIB_CFLAGS="-fPIC" @@ -6910,71 +5206,43 @@ fi # -lsocket, even if the network functions are in -lnet which # is always linked to, for compatibility. #----------------------------------------------------------- - echo "$as_me:$LINENO: checking for inet_ntoa in -lbind" >&5 -echo $ECHO_N "checking for inet_ntoa in -lbind... $ECHO_C" >&6 -if test "${ac_cv_lib_bind_inet_ntoa+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lbind" >&5 +$as_echo_n "checking for inet_ntoa in -lbind... " >&6; } +if ${ac_cv_lib_bind_inet_ntoa+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbind $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 inet_ntoa (); int main () { -inet_ntoa (); +return inet_ntoa (); ; 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 +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bind_inet_ntoa=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_bind_inet_ntoa=no + ac_cv_lib_bind_inet_ntoa=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_bind_inet_ntoa" >&5 -echo "${ECHO_T}$ac_cv_lib_bind_inet_ntoa" >&6 -if test $ac_cv_lib_bind_inet_ntoa = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bind_inet_ntoa" >&5 +$as_echo "$ac_cv_lib_bind_inet_ntoa" >&6; } +if test "x$ac_cv_lib_bind_inet_ntoa" = xyes; then : LIBS="$LIBS -lbind -lsocket" fi @@ -7011,16 +5279,12 @@ fi TCL_NEEDS_EXP_FILE=1 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.dll.a' SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$@.a" - 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Cygwin version of gcc" >&5 +$as_echo_n "checking for Cygwin version of gcc... " >&6; } +if ${ac_cv_cygwin+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __CYGWIN__ @@ -7035,49 +5299,21 @@ 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 +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_cygwin=no else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_cygwin=yes + ac_cv_cygwin=yes fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cygwin" >&5 +$as_echo "$ac_cv_cygwin" >&6; } if test "$ac_cv_cygwin" = "no"; then - { { echo "$as_me:$LINENO: error: ${CC} is not a cygwin compiler." >&5 -echo "$as_me: error: ${CC} is not a cygwin compiler." >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "${CC} is not a cygwin compiler." "$LINENO" 5 fi if test "x${TCL_THREADS}" = "x0"; then - { { echo "$as_me:$LINENO: error: CYGWIN compile is only supported with --enable-threads" >&5 -echo "$as_me: error: CYGWIN compile is only supported with --enable-threads" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "CYGWIN compile is only supported with --enable-threads" "$LINENO" 5 fi do64bit_ok=yes if test "x${SHARED_BUILD}" = "x1"; then @@ -7107,71 +5343,43 @@ echo "$as_me: error: CYGWIN compile is only supported with --enable-threads" >&2 SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}' DL_OBJS="tclLoadDl.o" DL_LIBS="-lroot" - echo "$as_me:$LINENO: checking for inet_ntoa in -lnetwork" >&5 -echo $ECHO_N "checking for inet_ntoa in -lnetwork... $ECHO_C" >&6 -if test "${ac_cv_lib_network_inet_ntoa+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lnetwork" >&5 +$as_echo_n "checking for inet_ntoa in -lnetwork... " >&6; } +if ${ac_cv_lib_network_inet_ntoa+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnetwork $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 inet_ntoa (); int main () { -inet_ntoa (); +return inet_ntoa (); ; 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 +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_network_inet_ntoa=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_network_inet_ntoa=no + ac_cv_lib_network_inet_ntoa=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_network_inet_ntoa" >&5 -echo "${ECHO_T}$ac_cv_lib_network_inet_ntoa" >&6 -if test $ac_cv_lib_network_inet_ntoa = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_network_inet_ntoa" >&5 +$as_echo "$ac_cv_lib_network_inet_ntoa" >&6; } +if test "x$ac_cv_lib_network_inet_ntoa" = xyes; then : LIBS="$LIBS -lnetwork" fi @@ -7179,18 +5387,14 @@ fi HP-UX-*.11.*) # Use updated header definitions where possible -cat >>confdefs.h <<\_ACEOF -#define _XOPEN_SOURCE_EXTENDED 1 -_ACEOF +$as_echo "#define _XOPEN_SOURCE_EXTENDED 1" >>confdefs.h -cat >>confdefs.h <<\_ACEOF -#define _XOPEN_SOURCE 1 -_ACEOF +$as_echo "#define _XOPEN_SOURCE 1" >>confdefs.h LIBS="$LIBS -lxnet" # Use the XOPEN network library - if test "`uname -m`" = ia64; then + if test "`uname -m`" = ia64; then : SHLIB_SUFFIX=".so" @@ -7199,78 +5403,49 @@ else SHLIB_SUFFIX=".sl" fi - - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 shl_load (); int main () { -shl_load (); +return shl_load (); ; 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 +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no + ac_cv_lib_dld_shl_load=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : tcl_ok=yes else tcl_ok=no fi - if test "$tcl_ok" = yes; then + if test "$tcl_ok" = yes; then : SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" @@ -7282,8 +5457,7 @@ fi LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi - - if test "$GCC" = yes; then + if test "$GCC" = yes; then : SHLIB_LD='${CC} -shared' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} @@ -7294,30 +5468,28 @@ else fi - # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc #CFLAGS="$CFLAGS +DAportable" # Check to enable 64-bit flags for compiler/linker - if test "$do64bit" = "yes"; then + if test "$do64bit" = "yes"; then : - if test "$GCC" = yes; then + if test "$GCC" = yes; then : case `${CC} -dumpmachine` in hppa64*) # 64-bit gcc in use. Fix flags for GNU ld. do64bit_ok=yes SHLIB_LD='${CC} -shared' - if test $doRpath = yes; then + if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi - LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; *) - { 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;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5 +$as_echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} ;; esac @@ -7329,82 +5501,52 @@ else fi - -fi - ;; +fi ;; HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) SHLIB_SUFFIX=".sl" - echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 shl_load (); int main () { -shl_load (); +return shl_load (); ; 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 +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_dld_shl_load=no + ac_cv_lib_dld_shl_load=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : tcl_ok=yes else tcl_ok=no fi - if test "$tcl_ok" = yes; then + if test "$tcl_ok" = yes; then : SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" @@ -7416,28 +5558,24 @@ fi LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" -fi - ;; +fi ;; IRIX-5.*) SHLIB_CFLAGS="" SHLIB_LD="ld -shared -rdata_shared" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - case $LIBOBJS in - "mkstemp.$ac_objext" | \ - *" mkstemp.$ac_objext" | \ - "mkstemp.$ac_objext "* | \ + case " $LIBOBJS " in *" mkstemp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;; + *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" + ;; esac - if test $doRpath = yes; then + if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi - ;; IRIX-6.*) SHLIB_CFLAGS="" @@ -7445,21 +5583,18 @@ fi SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - case $LIBOBJS in - "mkstemp.$ac_objext" | \ - *" mkstemp.$ac_objext" | \ - "mkstemp.$ac_objext "* | \ + case " $LIBOBJS " in *" mkstemp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;; + *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" + ;; esac - if test $doRpath = yes; then + if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi - - if test "$GCC" = yes; then + if test "$GCC" = yes; then : CFLAGS="$CFLAGS -mabi=n32" LDFLAGS="$LDFLAGS -mabi=n32" @@ -7478,7 +5613,6 @@ else LDFLAGS="$LDFLAGS -n32" fi - ;; IRIX64-6.*) SHLIB_CFLAGS="" @@ -7486,29 +5620,26 @@ fi SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - case $LIBOBJS in - "mkstemp.$ac_objext" | \ - *" mkstemp.$ac_objext" | \ - "mkstemp.$ac_objext "* | \ + case " $LIBOBJS " in *" mkstemp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;; + *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" + ;; esac - if test $doRpath = yes; then + if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi - # Check to enable 64-bit flags for compiler/linker - if test "$do64bit" = yes; then + if test "$do64bit" = yes; then : - if test "$GCC" = yes; then + if test "$GCC" = yes; then : - { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5 -echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported by gcc" >&5 +$as_echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} else @@ -7519,9 +5650,7 @@ else fi - fi - ;; Linux*|GNU*|NetBSD-Debian) SHLIB_CFLAGS="-fPIC" @@ -7537,31 +5666,25 @@ fi DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" - if test $doRpath = yes; then + if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi - LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - if test "`uname -m`" = "alpha"; then + if test "`uname -m`" = "alpha"; then : CFLAGS="$CFLAGS -mieee" fi + if test $do64bit = yes; then : - if test $do64bit = yes; then - - echo "$as_me:$LINENO: checking if compiler accepts -m64 flag" >&5 -echo $ECHO_N "checking if compiler accepts -m64 flag... $ECHO_C" >&6 -if test "${tcl_cv_cc_m64+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -m64 flag" >&5 +$as_echo_n "checking if compiler accepts -m64 flag... " >&6; } +if ${tcl_cv_cc_m64+:} false; then : + $as_echo_n "(cached) " >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -m64" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -7572,62 +5695,35 @@ main () 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 +if ac_fn_c_try_link "$LINENO"; then : tcl_cv_cc_m64=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_cc_m64=no + tcl_cv_cc_m64=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi -echo "$as_me:$LINENO: result: $tcl_cv_cc_m64" >&5 -echo "${ECHO_T}$tcl_cv_cc_m64" >&6 - if test $tcl_cv_cc_m64 = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_m64" >&5 +$as_echo "$tcl_cv_cc_m64" >&6; } + if test $tcl_cv_cc_m64 = yes; then : CFLAGS="$CFLAGS -m64" do64bit_ok=yes fi - fi - # The combo of gcc + glibc has a bug related to inlining of # functions like strtod(). The -fno-builtin flag should address # this problem but it does not work. The -fno-inline flag is kind # of overkill but it works. Disable inlining only when one of the # files in compat/*.c is being linked in. - if test x"${USE_COMPAT}" != x; then + if test x"${USE_COMPAT}" != x; then : CFLAGS="$CFLAGS -fno-inline" fi - ;; Lynx*) SHLIB_CFLAGS="-fPIC" @@ -7637,12 +5733,11 @@ fi DL_OBJS="tclLoadDl.o" DL_LIBS="-mshared -ldl" LD_FLAGS="-Wl,--export-dynamic" - if test $doRpath = yes; then + if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi - ;; MP-RAS-02*) SHLIB_CFLAGS="-K PIC" @@ -7681,11 +5776,10 @@ fi SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - if test $doRpath = yes; then + if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi - LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" @@ -7702,7 +5796,7 @@ fi CFLAGS_OPTIMIZE="-O2" ;; esac - if test "${TCL_THREADS}" = "1"; then + if test "${TCL_THREADS}" = "1"; then : # On OpenBSD: Compile with -pthread # Don't link with -lpthread @@ -7710,7 +5804,6 @@ fi CFLAGS="$CFLAGS -pthread" fi - # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots @@ -7723,13 +5816,12 @@ fi DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" - if test $doRpath = yes; then + if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi - LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - if test "${TCL_THREADS}" = "1"; then + if test "${TCL_THREADS}" = "1"; then : # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` @@ -7737,7 +5829,6 @@ fi LDFLAGS="$LDFLAGS -pthread" fi - ;; FreeBSD-*) # This configuration from FreeBSD Ports. @@ -7748,20 +5839,18 @@ fi DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="" - if test $doRpath = yes; then + if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi - - if test "${TCL_THREADS}" = "1"; then + if test "${TCL_THREADS}" = "1"; then : # The -pthread needs to go in the LDFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LDFLAGS="$LDFLAGS $PTHREAD_LIBS" fi - case $system in FreeBSD-3.*) # Version numbers are dot-stripped by system policy. @@ -7784,23 +5873,19 @@ fi CFLAGS="`echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if (!($i~/^(isysroot|mmacosx-version-min)/)) print "-"$i}'`" - if test $do64bit = yes; then + if test $do64bit = yes; then : case `arch` in ppc) - echo "$as_me:$LINENO: checking if compiler accepts -arch ppc64 flag" >&5 -echo $ECHO_N "checking if compiler accepts -arch ppc64 flag... $ECHO_C" >&6 -if test "${tcl_cv_cc_arch_ppc64+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch ppc64 flag" >&5 +$as_echo_n "checking if compiler accepts -arch ppc64 flag... " >&6; } +if ${tcl_cv_cc_arch_ppc64+:} false; then : + $as_echo_n "(cached) " >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -7811,62 +5896,33 @@ main () 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 +if ac_fn_c_try_link "$LINENO"; then : tcl_cv_cc_arch_ppc64=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_cc_arch_ppc64=no + tcl_cv_cc_arch_ppc64=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi -echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_ppc64" >&5 -echo "${ECHO_T}$tcl_cv_cc_arch_ppc64" >&6 - if test $tcl_cv_cc_arch_ppc64 = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_ppc64" >&5 +$as_echo "$tcl_cv_cc_arch_ppc64" >&6; } + if test $tcl_cv_cc_arch_ppc64 = yes; then : CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" do64bit_ok=yes -fi -;; +fi;; i386) - echo "$as_me:$LINENO: checking if compiler accepts -arch x86_64 flag" >&5 -echo $ECHO_N "checking if compiler accepts -arch x86_64 flag... $ECHO_C" >&6 -if test "${tcl_cv_cc_arch_x86_64+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch x86_64 flag" >&5 +$as_echo_n "checking if compiler accepts -arch x86_64 flag... " >&6; } +if ${tcl_cv_cc_arch_x86_64+:} false; then : + $as_echo_n "(cached) " >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch x86_64" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -7877,79 +5933,48 @@ main () 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 +if ac_fn_c_try_link "$LINENO"; then : tcl_cv_cc_arch_x86_64=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_cc_arch_x86_64=no + tcl_cv_cc_arch_x86_64=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi -echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_x86_64" >&5 -echo "${ECHO_T}$tcl_cv_cc_arch_x86_64" >&6 - if test $tcl_cv_cc_arch_x86_64 = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_x86_64" >&5 +$as_echo "$tcl_cv_cc_arch_x86_64" >&6; } + if test $tcl_cv_cc_arch_x86_64 = yes; then : CFLAGS="$CFLAGS -arch x86_64" do64bit_ok=yes -fi -;; +fi;; *) - { echo "$as_me:$LINENO: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5 -echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};; + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5 +$as_echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};; esac else # Check for combined 32-bit and 64-bit fat build if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \ - && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '; then + && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '; then : fat_32_64=yes fi - fi - SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ld accepts -single_module flag" >&5 +$as_echo_n "checking if ld accepts -single_module flag... " >&6; } +if ${tcl_cv_ld_single_module+:} false; then : + $as_echo_n "(cached) " >&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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -7960,71 +5985,41 @@ 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 +if ac_fn_c_try_link "$LINENO"; 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 + tcl_cv_ld_single_module=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_single_module" >&5 +$as_echo "$tcl_cv_ld_single_module" >&6; } + if test $tcl_cv_ld_single_module = yes; then : SHLIB_LD="${SHLIB_LD} -Wl,-single_module" fi - SHLIB_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" DL_LIBS="" # Don't use -prebind when building for Mac OS X 10.4 or later only: if test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \ - "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4; then + "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4; then : LDFLAGS="$LDFLAGS -prebind" fi - LDFLAGS="$LDFLAGS -headerpad_max_install_names" - 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ld accepts -search_paths_first flag" >&5 +$as_echo_n "checking if ld accepts -search_paths_first flag... " >&6; } +if ${tcl_cv_ld_search_paths_first+:} false; then : + $as_echo_n "(cached) " >&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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -8035,88 +6030,58 @@ 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 +if ac_fn_c_try_link "$LINENO"; 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 + tcl_cv_ld_search_paths_first=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_search_paths_first" >&5 +$as_echo "$tcl_cv_ld_search_paths_first" >&6; } + if test $tcl_cv_ld_search_paths_first = yes; then : LDFLAGS="$LDFLAGS -Wl,-search_paths_first" fi + if test "$tcl_cv_cc_visibility_hidden" != yes; then : - if test "$tcl_cv_cc_visibility_hidden" != yes; then - -cat >>confdefs.h <<\_ACEOF -#define MODULE_SCOPE __private_extern__ -_ACEOF +$as_echo "#define MODULE_SCOPE __private_extern__" >>confdefs.h fi - CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" -cat >>confdefs.h <<\_ACEOF -#define MAC_OSX_TCL 1 -_ACEOF +$as_echo "#define MAC_OSX_TCL 1" >>confdefs.h 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use CoreFoundation" >&5 +$as_echo_n "checking whether to use CoreFoundation... " >&6; } + # Check whether --enable-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 +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_corefoundation" >&5 +$as_echo "$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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CoreFoundation.framework" >&5 +$as_echo_n "checking for CoreFoundation.framework... " >&6; } +if ${tcl_cv_lib_corefoundation+:} false; then : + $as_echo_n "(cached) " >&6 else hold_libs=$LIBS - if test "$fat_32_64" = yes; then + if test "$fat_32_64" = yes; then : for v in CFLAGS CPPFLAGS LDFLAGS; do # On Tiger there is no 64-bit CF, so remove 64-bit @@ -8126,13 +6091,8 @@ else eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' done fi - LIBS="$LIBS -framework CoreFoundation" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -8143,77 +6103,45 @@ 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 +if ac_fn_c_try_link "$LINENO"; 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 + tcl_cv_lib_corefoundation=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$fat_32_64" = yes; then +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$fat_32_64" = yes; then : for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done fi - 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_corefoundation" >&5 +$as_echo "$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 +$as_echo "#define HAVE_COREFOUNDATION 1" >>confdefs.h else tcl_corefoundation=no fi + if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then : - if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then - - echo "$as_me:$LINENO: checking for 64-bit CoreFoundation" >&5 -echo $ECHO_N "checking for 64-bit CoreFoundation... $ECHO_C" >&6 -if test "${tcl_cv_lib_corefoundation_64+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit CoreFoundation" >&5 +$as_echo_n "checking for 64-bit CoreFoundation... " >&6; } +if ${tcl_cv_lib_corefoundation_64+:} false; then : + $as_echo_n "(cached) " >&6 else for v in CFLAGS CPPFLAGS LDFLAGS; do eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -8224,60 +6152,31 @@ 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 +if ac_fn_c_try_link "$LINENO"; then : tcl_cv_lib_corefoundation_64=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_lib_corefoundation_64=no + tcl_cv_lib_corefoundation_64=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done fi -echo "$as_me:$LINENO: result: $tcl_cv_lib_corefoundation_64" >&5 -echo "${ECHO_T}$tcl_cv_lib_corefoundation_64" >&6 - if test $tcl_cv_lib_corefoundation_64 = no; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_corefoundation_64" >&5 +$as_echo "$tcl_cv_lib_corefoundation_64" >&6; } + if test $tcl_cv_lib_corefoundation_64 = no; then : -cat >>confdefs.h <<\_ACEOF -#define NO_COREFOUNDATION_64 1 -_ACEOF +$as_echo "#define NO_COREFOUNDATION_64 1" >>confdefs.h LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings" fi - fi - fi - ;; NEXTSTEP-*) SHLIB_CFLAGS="" @@ -8293,9 +6192,7 @@ fi SHLIB_LD_LIBS="" CFLAGS_OPTIMIZE="" # Optimizer is buggy -cat >>confdefs.h <<\_ACEOF -#define _OE_SOCKETS 1 -_ACEOF +$as_echo "#define _OE_SOCKETS 1" >>confdefs.h ;; OSF1-1.0|OSF1-1.1|OSF1-1.2) @@ -8313,14 +6210,13 @@ _ACEOF OSF1-1.*) # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 SHLIB_CFLAGS="-fPIC" - if test "$SHARED_BUILD" = 1; then + if test "$SHARED_BUILD" = 1; then : SHLIB_LD="ld -shared" else SHLIB_LD="ld -non_shared" fi - SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" @@ -8331,7 +6227,7 @@ fi OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" - if test "$SHARED_BUILD" = 1; then + if test "$SHARED_BUILD" = 1; then : SHLIB_LD='ld -shared -expect_unresolved "*"' @@ -8340,30 +6236,27 @@ else SHLIB_LD='ld -non_shared -expect_unresolved "*"' fi - SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - if test $doRpath = yes; then + if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi - - if test "$GCC" = yes; then + if test "$GCC" = yes; then : CFLAGS="$CFLAGS -mieee" else CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" fi - # see pthread_intro(3) for pthread support on osf1, k.furukawa - if test "${TCL_THREADS}" = 1; then + if test "${TCL_THREADS}" = 1; then : CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" LIBS=`echo $LIBS | sed s/-lpthreads//` - if test "$GCC" = yes; then + if test "$GCC" = yes; then : LIBS="$LIBS -lpthread -lmach -lexc" @@ -8374,9 +6267,7 @@ else fi - fi - ;; QNX-6*) # QNX RTP @@ -8395,7 +6286,7 @@ fi # Note, dlopen is available only on SCO 3.2.5 and greater. However, # this test works, since "uname -s" was non-standard in 3.2.4 and # below. - if test "$GCC" = yes; then + if test "$GCC" = yes; then : SHLIB_CFLAGS="-fPIC -melf" LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" @@ -8406,7 +6297,6 @@ else LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" fi - SHLIB_LD="ld -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" @@ -8451,21 +6341,17 @@ fi # won't define thread-safe library routines. -cat >>confdefs.h <<\_ACEOF -#define _REENTRANT 1 -_ACEOF +$as_echo "#define _REENTRANT 1" >>confdefs.h -cat >>confdefs.h <<\_ACEOF -#define _POSIX_PTHREAD_SEMANTICS 1 -_ACEOF +$as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h SHLIB_CFLAGS="-KPIC" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - if test "$GCC" = yes; then + if test "$GCC" = yes; then : SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' @@ -8478,37 +6364,32 @@ else 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 +$as_echo "#define _REENTRANT 1" >>confdefs.h -cat >>confdefs.h <<\_ACEOF -#define _POSIX_PTHREAD_SEMANTICS 1 -_ACEOF +$as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h SHLIB_CFLAGS="-KPIC" # Check to enable 64-bit flags for compiler/linker - if test "$do64bit" = yes; then + if test "$do64bit" = yes; then : arch=`isainfo` - if test "$arch" = "sparcv9 sparc"; then + if test "$arch" = "sparcv9 sparc"; then : - if test "$GCC" = yes; then + if test "$GCC" = yes; then : - if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3; then + if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3; then : - { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5 -echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5 +$as_echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;} else @@ -8519,11 +6400,10 @@ else fi - else do64bit_ok=yes - if test "$do64bitVIS" = yes; then + if test "$do64bitVIS" = yes; then : CFLAGS="$CFLAGS -xarch=v9a" LDFLAGS_ARCH="-xarch=v9a" @@ -8534,17 +6414,15 @@ else LDFLAGS_ARCH="-xarch=v9" fi - # Solaris 64 uses this as well #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64" fi - else - if test "$arch" = "amd64 i386"; then + if test "$arch" = "amd64 i386"; then : - if test "$GCC" = yes; then + if test "$GCC" = yes; then : case $system in SunOS-5.1[1-9]*|SunOS-5.[2-9][0-9]*) @@ -8552,8 +6430,8 @@ else CFLAGS="$CFLAGS -m64" LDFLAGS="$LDFLAGS -m64";; *) - { 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;};; + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5 +$as_echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;};; esac else @@ -8570,169 +6448,32 @@ else 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;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported for $arch" >&5 +$as_echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;} fi - fi - fi - #-------------------------------------------------------------------- # On Solaris 5.x i386 with the sunpro compiler we need to link # with sunmath to get floating point rounding control #-------------------------------------------------------------------- - if test "$GCC" = yes; then + if test "$GCC" = yes; then : use_sunmath=no else arch=`isainfo` - echo "$as_me:$LINENO: checking whether to use -lsunmath for fp rounding control" >&5 -echo $ECHO_N "checking whether to use -lsunmath for fp rounding control... $ECHO_C" >&6 - if test "$arch" = "amd64 i386" -o "$arch" = "i386"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use -lsunmath for fp rounding control" >&5 +$as_echo_n "checking whether to use -lsunmath for fp rounding control... " >&6; } + if test "$arch" = "amd64 i386" -o "$arch" = "i386"; then : - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } MATH_LIBS="-lsunmath $MATH_LIBS" - if test "${ac_cv_header_sunmath_h+set}" = set; then - echo "$as_me:$LINENO: checking for sunmath.h" >&5 -echo $ECHO_N "checking for sunmath.h... $ECHO_C" >&6 -if test "${ac_cv_header_sunmath_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sunmath_h" >&5 -echo "${ECHO_T}$ac_cv_header_sunmath_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking sunmath.h usability" >&5 -echo $ECHO_N "checking sunmath.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 -_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 sunmath.h presence" >&5 -echo $ECHO_N "checking sunmath.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 -_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: sunmath.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: sunmath.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: sunmath.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: sunmath.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: sunmath.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: sunmath.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: sunmath.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: sunmath.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: sunmath.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: sunmath.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: sunmath.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: sunmath.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: sunmath.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: sunmath.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: sunmath.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: sunmath.h: 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 sunmath.h" >&5 -echo $ECHO_N "checking for sunmath.h... $ECHO_C" >&6 -if test "${ac_cv_header_sunmath_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_sunmath_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sunmath_h" >&5 -echo "${ECHO_T}$ac_cv_header_sunmath_h" >&6 + ac_fn_c_check_header_mongrel "$LINENO" "sunmath.h" "ac_cv_header_sunmath_h" "$ac_includes_default" +if test "x$ac_cv_header_sunmath_h" = xyes; then : fi @@ -8741,26 +6482,24 @@ fi else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } use_sunmath=no fi - fi - SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - if test "$GCC" = yes; then + if test "$GCC" = yes; then : SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - if test "$do64bit_ok" = yes; then + if test "$do64bit_ok" = yes; then : - if test "$arch" = "sparcv9 sparc"; then + if test "$arch" = "sparcv9 sparc"; then : # We need to specify -static-libgcc or we need to # add the path to the sparv9 libgcc. @@ -8771,26 +6510,22 @@ fi #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir" else - if test "$arch" = "amd64 i386"; then + if test "$arch" = "amd64 i386"; then : SHLIB_LD="$SHLIB_LD -m64 -static-libgcc" fi - fi - fi - else - if test "$use_sunmath" = yes; then + if test "$use_sunmath" = yes; then : textmode=textoff else textmode=text fi - case $system in SunOS-5.[1-9][0-9]*|SunOS-5.[7-9]) SHLIB_LD="\${CC} -G -z $textmode \${LDFLAGS}";; @@ -8801,7 +6536,6 @@ fi LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' fi - ;; UNIX_SV* | UnixWare-5*) SHLIB_CFLAGS="-KPIC" @@ -8812,19 +6546,15 @@ fi DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. - echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5 -echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6 -if test "${tcl_cv_ld_Bexport+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld accepts -Bexport flag" >&5 +$as_echo_n "checking for ld accepts -Bexport flag... " >&6; } +if ${tcl_cv_ld_Bexport+:} false; then : + $as_echo_n "(cached) " >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-Bexport" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -8835,93 +6565,63 @@ 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 +if ac_fn_c_try_link "$LINENO"; then : tcl_cv_ld_Bexport=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_ld_Bexport=no + tcl_cv_ld_Bexport=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi -echo "$as_me:$LINENO: result: $tcl_cv_ld_Bexport" >&5 -echo "${ECHO_T}$tcl_cv_ld_Bexport" >&6 - if test $tcl_cv_ld_Bexport = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_Bexport" >&5 +$as_echo "$tcl_cv_ld_Bexport" >&6; } + if test $tcl_cv_ld_Bexport = yes; then : LDFLAGS="$LDFLAGS -Wl,-Bexport" fi - CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; esac - if test "$do64bit" = yes -a "$do64bit_ok" = no; then + if test "$do64bit" = yes -a "$do64bit_ok" = no; then : - { echo "$as_me:$LINENO: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5 -echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5 +$as_echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;} fi + if test "$do64bit" = yes -a "$do64bit_ok" = yes; then : - if test "$do64bit" = yes -a "$do64bit_ok" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define TCL_CFG_DO64BIT 1 -_ACEOF +$as_echo "#define TCL_CFG_DO64BIT 1" >>confdefs.h fi - # Step 4: disable dynamic loading if requested via a command-line switch. - # Check whether --enable-load or --disable-load was given. -if test "${enable_load+set}" = set; then - enableval="$enable_load" - tcl_ok=$enableval + # Check whether --enable-load was given. +if test "${enable_load+set}" = set; then : + enableval=$enable_load; tcl_ok=$enableval else tcl_ok=yes -fi; - if test "$tcl_ok" = no; then - DL_OBJS="" fi + if test "$tcl_ok" = no; then : + DL_OBJS="" +fi - if test "x$DL_OBJS" != x; then + if test "x$DL_OBJS" != x; then : BUILD_DLTEST="\$(DLTEST_TARGETS)" else - { echo "$as_me:$LINENO: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&5 -echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&5 +$as_echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&2;} SHLIB_CFLAGS="" SHLIB_LD="" SHLIB_SUFFIX="" @@ -8933,14 +6633,13 @@ echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libr BUILD_DLTEST="" fi - LDFLAGS="$LDFLAGS $LDFLAGS_ARCH" # If we're running gcc, then change the C flags for compiling shared # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. - if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes; then + if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes; then : case $system in AIX-*) ;; @@ -8954,35 +6653,29 @@ fi esac fi - - if test "$tcl_cv_cc_visibility_hidden" != yes; then + if test "$tcl_cv_cc_visibility_hidden" != yes; then : -cat >>confdefs.h <<\_ACEOF -#define MODULE_SCOPE extern -_ACEOF +$as_echo "#define MODULE_SCOPE extern" >>confdefs.h fi - - if test "$SHARED_LIB_SUFFIX" = ""; then + if test "$SHARED_LIB_SUFFIX" = ""; then : SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}' fi - - if test "$UNSHARED_LIB_SUFFIX" = ""; then + if test "$UNSHARED_LIB_SUFFIX" = ""; then : UNSHARED_LIB_SUFFIX='${VERSION}.a' fi - DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)" - if test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""; then + if test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""; then : LIB_SUFFIX=${SHARED_LIB_SUFFIX} MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' - if test "${SHLIB_SUFFIX}" = ".dll"; then + if test "${SHLIB_SUFFIX}" = ".dll"; then : INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"' DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)" @@ -8993,12 +6686,11 @@ else fi - else LIB_SUFFIX=${UNSHARED_LIB_SUFFIX} - if test "$RANLIB" = ""; then + if test "$RANLIB" = ""; then : MAKE_LIB='$(STLIB_LD) $@ ${OBJS}' INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"' @@ -9010,12 +6702,22 @@ else fi - fi + if test "$RANLIB" = ""; then : + + MAKE_KIT_LIB='$(STLIB_LD) $@ ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS}' + INSTALL_KIT_LIB='$(INSTALL_LIBRARY) $(TCL_KIT_LIB_FILE) "$(LIB_INSTALL_DIR)/$(TCL_KIT_LIB_FILE)"' + +else + + MAKE_KIT_LIB='${STLIB_LD} $@ ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} ; ${RANLIB} $@' + INSTALL_KIT_LIB='$(INSTALL_LIBRARY) $(TCL_KIT_LIB_FILE) "$(LIB_INSTALL_DIR)/$(TCL_KIT_LIB_FILE)" ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(TCL_KIT_LIB_FILE))' + +fi # Stub lib does not depend on shared/static configuration - if test "$RANLIB" = ""; then + if test "$RANLIB" = ""; then : MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS}' INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"' @@ -9027,31 +6729,25 @@ else fi - # Define TCL_LIBS now that we know what DL_LIBS is. # The trick here is that we don't want to change the value of TCL_LIBS if # it is already set when tclConfig.sh had been loaded by Tk. - if test "x${TCL_LIBS}" = x; then + if test "x${TCL_LIBS}" = x; then : TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}" fi - # See if the compiler supports casting to a union type. # This is used to stop gcc from printing a compiler # warning when initializing a union member. - 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5 +$as_echo_n "checking for cast to union support... " >&6; } +if ${tcl_cv_cast_to_union+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -9065,45 +6761,19 @@ 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 +if ac_fn_c_try_compile "$LINENO"; 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 + tcl_cv_cast_to_union=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5 +$as_echo "$tcl_cv_cast_to_union" >&6; } if test "$tcl_cv_cast_to_union" = "yes"; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_CAST_TO_UNION 1 -_ACEOF +$as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h fi @@ -9149,38 +6819,36 @@ _ACEOF - echo "$as_me:$LINENO: checking for build with symbols" >&5 -echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6 - # Check whether --enable-symbols or --disable-symbols was given. -if test "${enable_symbols+set}" = set; then - enableval="$enable_symbols" - tcl_ok=$enableval + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build with symbols" >&5 +$as_echo_n "checking for build with symbols... " >&6; } + # Check whether --enable-symbols was given. +if test "${enable_symbols+set}" = set; then : + enableval=$enable_symbols; tcl_ok=$enableval else tcl_ok=no -fi; +fi + # 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)' -cat >>confdefs.h <<\_ACEOF -#define NDEBUG 1 -_ACEOF +$as_echo "#define NDEBUG 1" >>confdefs.h - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } -cat >>confdefs.h <<\_ACEOF -#define TCL_CFG_OPTIMIZED 1 -_ACEOF +$as_echo "#define TCL_CFG_OPTIMIZED 1" >>confdefs.h else CFLAGS_DEFAULT='$(CFLAGS_DEBUG)' LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)' if test "$tcl_ok" = "yes"; then - echo "$as_me:$LINENO: result: yes (standard debugging)" >&5 -echo "${ECHO_T}yes (standard debugging)" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (standard debugging)" >&5 +$as_echo "yes (standard debugging)" >&6; } fi fi @@ -9188,45 +6856,35 @@ echo "${ECHO_T}yes (standard debugging)" >&6 if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then -cat >>confdefs.h <<\_ACEOF -#define TCL_MEM_DEBUG 1 -_ACEOF +$as_echo "#define TCL_MEM_DEBUG 1" >>confdefs.h fi if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then -cat >>confdefs.h <<\_ACEOF -#define TCL_COMPILE_DEBUG 1 -_ACEOF +$as_echo "#define TCL_COMPILE_DEBUG 1" >>confdefs.h -cat >>confdefs.h <<\_ACEOF -#define TCL_COMPILE_STATS 1 -_ACEOF +$as_echo "#define TCL_COMPILE_STATS 1" >>confdefs.h fi if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then if test "$tcl_ok" = "all"; then - echo "$as_me:$LINENO: result: enabled symbols mem compile debugging" >&5 -echo "${ECHO_T}enabled symbols mem compile debugging" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled symbols mem compile debugging" >&5 +$as_echo "enabled symbols mem compile debugging" >&6; } else - echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5 -echo "${ECHO_T}enabled $tcl_ok debugging" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled $tcl_ok debugging" >&5 +$as_echo "enabled $tcl_ok debugging" >&6; } fi fi -cat >>confdefs.h <<\_ACEOF -#define TCL_TOMMATH 1 -_ACEOF +$as_echo "#define TCL_TOMMATH 1" >>confdefs.h -cat >>confdefs.h <<\_ACEOF -#define MP_PREC 4 -_ACEOF +$as_echo "#define MP_PREC 4" >>confdefs.h #-------------------------------------------------------------------- @@ -9234,18 +6892,14 @@ _ACEOF #-------------------------------------------------------------------- - echo "$as_me:$LINENO: checking for required early compiler flags" >&5 -echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for required early compiler flags" >&5 +$as_echo_n "checking for required early compiler flags... " >&6; } tcl_flags="" - if test "${tcl_cv_flag__isoc99_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if ${tcl_cv_flag__isoc99_source+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -9256,38 +6910,10 @@ char *p = (char *)strtoll; char *q = (char *)strtoull; 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_flag__isoc99_source=no 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _ISOC99_SOURCE 1 #include @@ -9299,58 +6925,28 @@ char *p = (char *)strtoll; char *q = (char *)strtoull; 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_flag__isoc99_source=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_flag__isoc99_source=no + tcl_cv_flag__isoc99_source=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then -cat >>confdefs.h <<\_ACEOF -#define _ISOC99_SOURCE 1 -_ACEOF +$as_echo "#define _ISOC99_SOURCE 1" >>confdefs.h tcl_flags="$tcl_flags _ISOC99_SOURCE" fi - if test "${tcl_cv_flag__largefile64_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if ${tcl_cv_flag__largefile64_source+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -9361,38 +6957,10 @@ struct stat64 buf; int i = stat64("/", &buf); 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_flag__largefile64_source=no 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGEFILE64_SOURCE 1 #include @@ -9404,58 +6972,28 @@ struct stat64 buf; int i = stat64("/", &buf); 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_flag__largefile64_source=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_flag__largefile64_source=no + tcl_cv_flag__largefile64_source=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then -cat >>confdefs.h <<\_ACEOF -#define _LARGEFILE64_SOURCE 1 -_ACEOF +$as_echo "#define _LARGEFILE64_SOURCE 1" >>confdefs.h tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" fi - if test "${tcl_cv_flag__largefile_source64+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if ${tcl_cv_flag__largefile_source64+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -9466,38 +7004,10 @@ char *p = (char *)open64; 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_flag__largefile_source64=no 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGEFILE_SOURCE64 1 #include @@ -9509,72 +7019,42 @@ char *p = (char *)open64; 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_flag__largefile_source64=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_flag__largefile_source64=no + tcl_cv_flag__largefile_source64=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then -cat >>confdefs.h <<\_ACEOF -#define _LARGEFILE_SOURCE64 1 -_ACEOF +$as_echo "#define _LARGEFILE_SOURCE64 1" >>confdefs.h tcl_flags="$tcl_flags _LARGEFILE_SOURCE64" fi if test "x${tcl_flags}" = "x" ; then - echo "$as_me:$LINENO: result: none" >&5 -echo "${ECHO_T}none" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } else - echo "$as_me:$LINENO: result: ${tcl_flags}" >&5 -echo "${ECHO_T}${tcl_flags}" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${tcl_flags}" >&5 +$as_echo "${tcl_flags}" >&6; } fi - echo "$as_me:$LINENO: checking for 64-bit integer type" >&5 -echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6 - if test "${tcl_cv_type_64bit+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit integer type" >&5 +$as_echo_n "checking for 64-bit integer type... " >&6; } + if ${tcl_cv_type_64bit+:} false; then : + $as_echo_n "(cached) " >&6 else tcl_cv_type_64bit=none # See if the compiler knows natively about __int64 - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -9585,44 +7065,16 @@ __int64 value = (__int64) 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_type_64bit=__int64 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_type_64bit="long long" + tcl_type_64bit="long long" fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # See if we should use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -9635,66 +7087,35 @@ switch (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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_type_64bit=${tcl_type_64bit} -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 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "${tcl_cv_type_64bit}" = none ; then -cat >>confdefs.h <<\_ACEOF -#define TCL_WIDE_INT_IS_LONG 1 -_ACEOF +$as_echo "#define TCL_WIDE_INT_IS_LONG 1" >>confdefs.h - echo "$as_me:$LINENO: result: using long" >&5 -echo "${ECHO_T}using long" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using long" >&5 +$as_echo "using long" >&6; } else cat >>confdefs.h <<_ACEOF #define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit} _ACEOF - echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5 -echo "${ECHO_T}${tcl_cv_type_64bit}" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${tcl_cv_type_64bit}" >&5 +$as_echo "${tcl_cv_type_64bit}" >&6; } # Now check for auxiliary declarations - echo "$as_me:$LINENO: checking for struct dirent64" >&5 -echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6 -if test "${tcl_cv_struct_dirent64+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct dirent64" >&5 +$as_echo_n "checking for struct dirent64... " >&6; } +if ${tcl_cv_struct_dirent64+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -9706,58 +7127,28 @@ struct dirent64 p; 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_struct_dirent64=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_struct_dirent64=no + tcl_cv_struct_dirent64=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_struct_dirent64" >&5 -echo "${ECHO_T}$tcl_cv_struct_dirent64" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_struct_dirent64" >&5 +$as_echo "$tcl_cv_struct_dirent64" >&6; } if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_STRUCT_DIRENT64 1 -_ACEOF +$as_echo "#define HAVE_STRUCT_DIRENT64 1" >>confdefs.h fi - echo "$as_me:$LINENO: checking for struct stat64" >&5 -echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6 -if test "${tcl_cv_struct_stat64+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat64" >&5 +$as_echo_n "checking for struct stat64... " >&6; } +if ${tcl_cv_struct_stat64+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -9769,161 +7160,40 @@ struct stat64 p; 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_struct_stat64=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_struct_stat64=no + tcl_cv_struct_stat64=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_struct_stat64" >&5 -echo "${ECHO_T}$tcl_cv_struct_stat64" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_struct_stat64" >&5 +$as_echo "$tcl_cv_struct_stat64" >&6; } if test "x${tcl_cv_struct_stat64}" = "xyes" ; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_STRUCT_STAT64 1 -_ACEOF +$as_echo "#define HAVE_STRUCT_STAT64 1" >>confdefs.h fi - - -for ac_func in open64 lseek64 -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 declares $ac_func. - For example, HP-UX 11i 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 to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#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 + for ac_func in open64 lseek64 +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done - echo "$as_me:$LINENO: checking for off64_t" >&5 -echo $ECHO_N "checking for off64_t... $ECHO_C" >&6 - if test "${tcl_cv_type_off64_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for off64_t" >&5 +$as_echo_n "checking for off64_t... " >&6; } + if ${tcl_cv_type_off64_t+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -9935,51 +7205,25 @@ off64_t offset; 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_type_off64_t=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_type_off64_t=no + tcl_cv_type_off64_t=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_type_off64_t}" = "xyes" && \ test "x${ac_cv_func_lseek64}" = "xyes" && \ test "x${ac_cv_func_open64}" = "xyes" ; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_TYPE_OFF64_T 1 -_ACEOF +$as_echo "#define HAVE_TYPE_OFF64_T 1" >>confdefs.h - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi fi @@ -9989,235 +7233,229 @@ echo "${ECHO_T}no" >&6 # Tcl_UniChar strings to memcmp on big-endian systems. #-------------------------------------------------------------------- -echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 -echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 -if test "${ac_cv_c_bigendian+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : + $as_echo_n "(cached) " >&6 else - # See if sys/param.h defines the BYTE_ORDER macro. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include -#include + #include int main () { -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN - bogus endian macros -#endif +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #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 +if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include -#include + #include int main () { #if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif + not big endian + #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 +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_c_bigendian=no + ac_cv_c_bigendian=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -# It does not; compile a test program. -if test "$cross_compiling" = yes; then - # try to guess the endianness by grepping values into an object file - ac_cv_c_bigendian=unknown - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; -void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; -void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +#include + int main () { - _ascii (); _ebcdic (); +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #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 - if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no fi -if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +$ac_includes_default int main () { - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long l; - char c[sizeof (long)]; - } u; - u.l = 1; - exit (u.c[sizeof (long) - 1] == 1); + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + 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 +if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no 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 ) -ac_cv_c_bigendian=yes -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + ac_cv_c_bigendian=yes fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + + fi fi -echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 -echo "${ECHO_T}$ac_cv_c_bigendian" >&6 -case $ac_cv_c_bigendian in - yes) +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) -cat >>confdefs.h <<\_ACEOF -#define WORDS_BIGENDIAN 1 -_ACEOF - ;; - no) - ;; - *) - { { echo "$as_me:$LINENO: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&5 -echo "$as_me: error: unknown endianness -presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} - { (exit 1); exit 1; }; } ;; -esac +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac #-------------------------------------------------------------------- @@ -10226,110 +7464,17 @@ esac #-------------------------------------------------------------------- # Check if Posix compliant getcwd exists, if not we'll use getwd. - for ac_func in getcwd -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 declares $ac_func. - For example, HP-UX 11i 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 to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#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 +do : + ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" +if test "x$ac_cv_func_getcwd" = xyes; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define HAVE_GETCWD 1 _ACEOF else -cat >>confdefs.h <<\_ACEOF -#define USEGETWD 1 -_ACEOF +$as_echo "#define USEGETWD 1" >>confdefs.h fi done @@ -10337,7726 +7482,2343 @@ done # Nb: if getcwd uses popen and pwd(1) (like SunOS 4) we should really # define USEGETWD even if the posix getcwd exists. Add a test ? +ac_fn_c_check_func "$LINENO" "mkstemp" "ac_cv_func_mkstemp" +if test "x$ac_cv_func_mkstemp" = xyes; then : + $as_echo "#define HAVE_MKSTEMP 1" >>confdefs.h +else + case " $LIBOBJS " in + *" mkstemp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" + ;; +esac +fi +ac_fn_c_check_func "$LINENO" "opendir" "ac_cv_func_opendir" +if test "x$ac_cv_func_opendir" = xyes; then : + $as_echo "#define HAVE_OPENDIR 1" >>confdefs.h -for ac_func in mkstemp opendir strtol waitpid -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 declares $ac_func. - For example, HP-UX 11i 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 to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif +else + case " $LIBOBJS " in + *" opendir.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS opendir.$ac_objext" + ;; +esac -#undef $ac_func +fi -/* 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 +ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol" +if test "x$ac_cv_func_strtol" = xyes; then : + $as_echo "#define HAVE_STRTOL 1" >>confdefs.h -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 + case " $LIBOBJS " in + *" strtol.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strtol.$ac_objext" + ;; +esac -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 + +ac_fn_c_check_func "$LINENO" "waitpid" "ac_cv_func_waitpid" +if test "x$ac_cv_func_waitpid" = xyes; then : + $as_echo "#define HAVE_WAITPID 1" >>confdefs.h else - case $LIBOBJS in - "$ac_func.$ac_objext" | \ - *" $ac_func.$ac_objext" | \ - "$ac_func.$ac_objext "* | \ - *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; + case " $LIBOBJS " in + *" waitpid.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS waitpid.$ac_objext" + ;; esac fi -done -echo "$as_me:$LINENO: checking for strerror" >&5 -echo $ECHO_N "checking for strerror... $ECHO_C" >&6 -if test "${ac_cv_func_strerror+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 strerror to an innocuous variant, in case declares strerror. - For example, HP-UX 11i declares gettimeofday. */ -#define strerror innocuous_strerror +ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" +if test "x$ac_cv_func_strerror" = xyes; then : -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char strerror (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ +else -#ifdef __STDC__ -# include -#else -# include -#endif +$as_echo "#define NO_STRERROR 1" >>confdefs.h -#undef strerror +fi -/* 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 strerror (); -/* 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_strerror) || defined (__stub___strerror) -choke me -#else -char (*f) () = strerror; -#endif -#ifdef __cplusplus -} -#endif +ac_fn_c_check_func "$LINENO" "getwd" "ac_cv_func_getwd" +if test "x$ac_cv_func_getwd" = xyes; then : -int -main () -{ -return f != strerror; - ; - 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_strerror=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_strerror=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +$as_echo "#define NO_GETWD 1" >>confdefs.h + fi -echo "$as_me:$LINENO: result: $ac_cv_func_strerror" >&5 -echo "${ECHO_T}$ac_cv_func_strerror" >&6 -if test $ac_cv_func_strerror = yes; then - : + +ac_fn_c_check_func "$LINENO" "wait3" "ac_cv_func_wait3" +if test "x$ac_cv_func_wait3" = xyes; then : + else -cat >>confdefs.h <<\_ACEOF -#define NO_STRERROR 1 -_ACEOF +$as_echo "#define NO_WAIT3 1" >>confdefs.h fi -echo "$as_me:$LINENO: checking for getwd" >&5 -echo $ECHO_N "checking for getwd... $ECHO_C" >&6 -if test "${ac_cv_func_getwd+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +ac_fn_c_check_func "$LINENO" "uname" "ac_cv_func_uname" +if test "x$ac_cv_func_uname" = xyes; then : + else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define getwd to an innocuous variant, in case declares getwd. - For example, HP-UX 11i declares gettimeofday. */ -#define getwd innocuous_getwd -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char getwd (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ +$as_echo "#define NO_UNAME 1" >>confdefs.h -#ifdef __STDC__ -# include -#else -# include -#endif +fi -#undef getwd -/* 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 getwd (); -/* 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_getwd) || defined (__stub___getwd) -choke me -#else -char (*f) () = getwd; -#endif -#ifdef __cplusplus -} -#endif +if test "`uname -s`" = "Darwin" && test "${TCL_THREADS}" = 1 && \ + test "`uname -r | awk -F. '{print $1}'`" -lt 7; then + # prior to Darwin 7, realpath is not threadsafe, so don't + # use it when threads are enabled, c.f. bug # 711232 + ac_cv_func_realpath=no +fi +ac_fn_c_check_func "$LINENO" "realpath" "ac_cv_func_realpath" +if test "x$ac_cv_func_realpath" = xyes; then : -int -main () -{ -return f != getwd; - ; - 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_getwd=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_getwd=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +$as_echo "#define NO_REALPATH 1" >>confdefs.h + fi -echo "$as_me:$LINENO: result: $ac_cv_func_getwd" >&5 -echo "${ECHO_T}$ac_cv_func_getwd" >&6 -if test $ac_cv_func_getwd = yes; then - : -else -cat >>confdefs.h <<\_ACEOF -#define NO_GETWD 1 + + + NEED_FAKE_RFC2553=0 + for ac_func in getnameinfo getaddrinfo freeaddrinfo gai_strerror +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF +else + NEED_FAKE_RFC2553=1 fi +done + + ac_fn_c_check_type "$LINENO" "struct addrinfo" "ac_cv_type_struct_addrinfo" " +#include +#include +#include +#include + +" +if test "x$ac_cv_type_struct_addrinfo" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_ADDRINFO 1 +_ACEOF + -echo "$as_me:$LINENO: checking for wait3" >&5 -echo $ECHO_N "checking for wait3... $ECHO_C" >&6 -if test "${ac_cv_func_wait3+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + NEED_FAKE_RFC2553=1 +fi +ac_fn_c_check_type "$LINENO" "struct in6_addr" "ac_cv_type_struct_in6_addr" " +#include +#include +#include +#include + +" +if test "x$ac_cv_type_struct_in6_addr" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_IN6_ADDR 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define wait3 to an innocuous variant, in case declares wait3. - For example, HP-UX 11i declares gettimeofday. */ -#define wait3 innocuous_wait3 -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char wait3 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ -#ifdef __STDC__ -# include -#else -# include -#endif +else + NEED_FAKE_RFC2553=1 +fi +ac_fn_c_check_type "$LINENO" "struct sockaddr_in6" "ac_cv_type_struct_sockaddr_in6" " +#include +#include +#include +#include -#undef wait3 +" +if test "x$ac_cv_type_struct_sockaddr_in6" = xyes; then : -/* 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 wait3 (); -/* 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_wait3) || defined (__stub___wait3) -choke me -#else -char (*f) () = wait3; -#endif -#ifdef __cplusplus -} -#endif +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_SOCKADDR_IN6 1 +_ACEOF -int -main () -{ -return f != wait3; - ; - return 0; -} + +else + NEED_FAKE_RFC2553=1 +fi +ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" " +#include +#include +#include +#include + +" +if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 _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_wait3=yes + + else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + NEED_FAKE_RFC2553=1 +fi + +if test "x$NEED_FAKE_RFC2553" = "x1"; then + +$as_echo "#define NEED_FAKE_RFC2553 1" >>confdefs.h + + case " $LIBOBJS " in + *" fake-rfc2553.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fake-rfc2553.$ac_objext" + ;; +esac + + ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" +if test "x$ac_cv_func_strlcpy" = xyes; then : -ac_cv_func_wait3=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + fi -echo "$as_me:$LINENO: result: $ac_cv_func_wait3" >&5 -echo "${ECHO_T}$ac_cv_func_wait3" >&6 -if test $ac_cv_func_wait3 = yes; then - : -else -cat >>confdefs.h <<\_ACEOF -#define NO_WAIT3 1 -_ACEOF -fi +#-------------------------------------------------------------------- +# Look for thread-safe variants of some library functions. +#-------------------------------------------------------------------- -echo "$as_me:$LINENO: checking for uname" >&5 -echo $ECHO_N "checking for uname... $ECHO_C" >&6 -if test "${ac_cv_func_uname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +if test "${TCL_THREADS}" = 1; then + ac_fn_c_check_func "$LINENO" "getpwuid_r" "ac_cv_func_getpwuid_r" +if test "x$ac_cv_func_getpwuid_r" = xyes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpwuid_r with 5 args" >&5 +$as_echo_n "checking for getpwuid_r with 5 args... " >&6; } +if ${tcl_cv_api_getpwuid_r_5+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Define uname to an innocuous variant, in case declares uname. - For example, HP-UX 11i declares gettimeofday. */ -#define uname innocuous_uname -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char uname (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ + #include + #include -#ifdef __STDC__ -# include -#else -# include -#endif +int +main () +{ -#undef uname + uid_t uid; + struct passwd pw, *pwp; + char buf[512]; + int buflen = 512; -/* 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 uname (); -/* 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_uname) || defined (__stub___uname) -choke me -#else -char (*f) () = uname; -#endif -#ifdef __cplusplus + (void) getpwuid_r(uid, &pw, buf, buflen, &pwp); + + ; + return 0; } -#endif +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_getpwuid_r_5=yes +else + tcl_cv_api_getpwuid_r_5=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getpwuid_r_5" >&5 +$as_echo "$tcl_cv_api_getpwuid_r_5" >&6; } + tcl_ok=$tcl_cv_api_getpwuid_r_5 + if test "$tcl_ok" = yes; then + +$as_echo "#define HAVE_GETPWUID_R_5 1" >>confdefs.h + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpwuid_r with 4 args" >&5 +$as_echo_n "checking for getpwuid_r with 4 args... " >&6; } +if ${tcl_cv_api_getpwuid_r_4+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include int main () { -return f != uname; + + uid_t uid; + struct passwd pw; + char buf[512]; + int buflen = 512; + + (void)getpwnam_r(uid, &pw, buf, buflen); + ; 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_uname=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_getpwuid_r_4=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_uname=no + tcl_cv_api_getpwuid_r_4=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_uname" >&5 -echo "${ECHO_T}$ac_cv_func_uname" >&6 -if test $ac_cv_func_uname = yes; then - : -else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getpwuid_r_4" >&5 +$as_echo "$tcl_cv_api_getpwuid_r_4" >&6; } + tcl_ok=$tcl_cv_api_getpwuid_r_4 + if test "$tcl_ok" = yes; then -cat >>confdefs.h <<\_ACEOF -#define NO_UNAME 1 -_ACEOF +$as_echo "#define HAVE_GETPWUID_R_4 1" >>confdefs.h -fi + fi + fi + if test "$tcl_ok" = yes; then +$as_echo "#define HAVE_GETPWUID_R 1" >>confdefs.h + + fi -if test "`uname -s`" = "Darwin" && test "${TCL_THREADS}" = 1 && \ - test "`uname -r | awk -F. '{print $1}'`" -lt 7; then - # prior to Darwin 7, realpath is not threadsafe, so don't - # use it when threads are enabled, c.f. bug # 711232 - ac_cv_func_realpath=no fi -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 declares realpath. - For example, HP-UX 11i declares gettimeofday. */ -#define realpath innocuous_realpath -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char realpath (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ + ac_fn_c_check_func "$LINENO" "getpwnam_r" "ac_cv_func_getpwnam_r" +if test "x$ac_cv_func_getpwnam_r" = xyes; then : -#ifdef __STDC__ -# include -#else -# include -#endif + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpwnam_r with 5 args" >&5 +$as_echo_n "checking for getpwnam_r with 5 args... " >&6; } +if ${tcl_cv_api_getpwnam_r_5+:} false; then : + $as_echo_n "(cached) " >&6 +else -#undef realpath + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -/* 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 + #include + #include int main () { -return f != realpath; + + char *name; + struct passwd pw, *pwp; + char buf[512]; + int buflen = 512; + + (void) getpwnam_r(name, &pw, buf, buflen, &pwp); + ; 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 +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_getpwnam_r_5=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_realpath=no + tcl_cv_api_getpwnam_r_5=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext 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; then - : -else - -cat >>confdefs.h <<\_ACEOF -#define NO_REALPATH 1 -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getpwnam_r_5" >&5 +$as_echo "$tcl_cv_api_getpwnam_r_5" >&6; } + tcl_ok=$tcl_cv_api_getpwnam_r_5 + if test "$tcl_ok" = yes; then -fi +$as_echo "#define HAVE_GETPWNAM_R_5 1" >>confdefs.h + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpwnam_r with 4 args" >&5 +$as_echo_n "checking for getpwnam_r with 4 args... " >&6; } +if ${tcl_cv_api_getpwnam_r_4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - NEED_FAKE_RFC2553=0 + #include + #include +int +main () +{ + char *name; + struct passwd pw; + char buf[512]; + int buflen = 512; + (void)getpwnam_r(name, &pw, buf, buflen); -for ac_func in getnameinfo getaddrinfo freeaddrinfo gai_strerror -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 declares $ac_func. - For example, HP-UX 11i 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 to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#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" +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_getpwnam_r_4=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" + tcl_cv_api_getpwnam_r_4=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getpwnam_r_4" >&5 +$as_echo "$tcl_cv_api_getpwnam_r_4" >&6; } + tcl_ok=$tcl_cv_api_getpwnam_r_4 + if test "$tcl_ok" = yes; then + +$as_echo "#define HAVE_GETPWNAM_R_4 1" >>confdefs.h + + fi + fi + if test "$tcl_ok" = yes; then + +$as_echo "#define HAVE_GETPWNAM_R 1" >>confdefs.h + + fi -else - NEED_FAKE_RFC2553=1 fi -done - echo "$as_me:$LINENO: checking for struct addrinfo" >&5 -echo $ECHO_N "checking for struct addrinfo... $ECHO_C" >&6 -if test "${ac_cv_type_struct_addrinfo+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + ac_fn_c_check_func "$LINENO" "getgrgid_r" "ac_cv_func_getgrgid_r" +if test "x$ac_cv_func_getgrgid_r" = xyes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getgrgid_r with 5 args" >&5 +$as_echo_n "checking for getgrgid_r with 5 args... " >&6; } +if ${tcl_cv_api_getgrgid_r_5+:} false; then : + $as_echo_n "(cached) " >&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 -#include -#include -#include + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include + #include int main () { -if ((struct addrinfo *) 0) - return 0; -if (sizeof (struct addrinfo)) - return 0; + + gid_t gid; + struct group gr, *grp; + char buf[512]; + int buflen = 512; + + (void) getgrgid_r(gid, &gr, buf, buflen, &grp); + ; 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_struct_addrinfo=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_getgrgid_r_5=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_struct_addrinfo=no + tcl_cv_api_getgrgid_r_5=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_struct_addrinfo" >&5 -echo "${ECHO_T}$ac_cv_type_struct_addrinfo" >&6 -if test $ac_cv_type_struct_addrinfo = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_ADDRINFO 1 -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getgrgid_r_5" >&5 +$as_echo "$tcl_cv_api_getgrgid_r_5" >&6; } + tcl_ok=$tcl_cv_api_getgrgid_r_5 + if test "$tcl_ok" = yes; then +$as_echo "#define HAVE_GETGRGID_R_5 1" >>confdefs.h + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getgrgid_r with 4 args" >&5 +$as_echo_n "checking for getgrgid_r with 4 args... " >&6; } +if ${tcl_cv_api_getgrgid_r_4+:} false; then : + $as_echo_n "(cached) " >&6 else - NEED_FAKE_RFC2553=1 -fi -echo "$as_me:$LINENO: checking for struct in6_addr" >&5 -echo $ECHO_N "checking for struct in6_addr... $ECHO_C" >&6 -if test "${ac_cv_type_struct_in6_addr+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 -#include -#include -#include + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include + #include int main () { -if ((struct in6_addr *) 0) - return 0; -if (sizeof (struct in6_addr)) - return 0; + + gid_t gid; + struct group gr; + char buf[512]; + int buflen = 512; + + (void)getgrgid_r(gid, &gr, buf, buflen); + ; 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_struct_in6_addr=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_getgrgid_r_4=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_struct_in6_addr=no + tcl_cv_api_getgrgid_r_4=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_struct_in6_addr" >&5 -echo "${ECHO_T}$ac_cv_type_struct_in6_addr" >&6 -if test $ac_cv_type_struct_in6_addr = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getgrgid_r_4" >&5 +$as_echo "$tcl_cv_api_getgrgid_r_4" >&6; } + tcl_ok=$tcl_cv_api_getgrgid_r_4 + if test "$tcl_ok" = yes; then -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_IN6_ADDR 1 -_ACEOF +$as_echo "#define HAVE_GETGRGID_R_4 1" >>confdefs.h + + fi + fi + if test "$tcl_ok" = yes; then +$as_echo "#define HAVE_GETGRGID_R 1" >>confdefs.h + + fi -else - NEED_FAKE_RFC2553=1 fi -echo "$as_me:$LINENO: checking for struct sockaddr_in6" >&5 -echo $ECHO_N "checking for struct sockaddr_in6... $ECHO_C" >&6 -if test "${ac_cv_type_struct_sockaddr_in6+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + + ac_fn_c_check_func "$LINENO" "getgrnam_r" "ac_cv_func_getgrnam_r" +if test "x$ac_cv_func_getgrnam_r" = xyes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getgrnam_r with 5 args" >&5 +$as_echo_n "checking for getgrnam_r with 5 args... " >&6; } +if ${tcl_cv_api_getgrnam_r_5+:} false; then : + $as_echo_n "(cached) " >&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 -#include -#include -#include + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include + #include int main () { -if ((struct sockaddr_in6 *) 0) - return 0; -if (sizeof (struct sockaddr_in6)) - return 0; + + char *name; + struct group gr, *grp; + char buf[512]; + int buflen = 512; + + (void) getgrnam_r(name, &gr, buf, buflen, &grp); + ; 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_struct_sockaddr_in6=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_getgrnam_r_5=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_struct_sockaddr_in6=no + tcl_cv_api_getgrnam_r_5=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_struct_sockaddr_in6" >&5 -echo "${ECHO_T}$ac_cv_type_struct_sockaddr_in6" >&6 -if test $ac_cv_type_struct_sockaddr_in6 = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SOCKADDR_IN6 1 -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getgrnam_r_5" >&5 +$as_echo "$tcl_cv_api_getgrnam_r_5" >&6; } + tcl_ok=$tcl_cv_api_getgrnam_r_5 + if test "$tcl_ok" = yes; then +$as_echo "#define HAVE_GETGRNAM_R_5 1" >>confdefs.h + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getgrnam_r with 4 args" >&5 +$as_echo_n "checking for getgrnam_r with 4 args... " >&6; } +if ${tcl_cv_api_getgrnam_r_4+:} false; then : + $as_echo_n "(cached) " >&6 else - NEED_FAKE_RFC2553=1 -fi -echo "$as_me:$LINENO: checking for struct sockaddr_storage" >&5 -echo $ECHO_N "checking for struct sockaddr_storage... $ECHO_C" >&6 -if test "${ac_cv_type_struct_sockaddr_storage+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 -#include -#include -#include + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include + #include int main () { -if ((struct sockaddr_storage *) 0) - return 0; -if (sizeof (struct sockaddr_storage)) - return 0; + + char *name; + struct group gr; + char buf[512]; + int buflen = 512; + + (void)getgrnam_r(name, &gr, buf, buflen); + ; 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_struct_sockaddr_storage=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_getgrnam_r_4=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_struct_sockaddr_storage=no + tcl_cv_api_getgrnam_r_4=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_struct_sockaddr_storage" >&5 -echo "${ECHO_T}$ac_cv_type_struct_sockaddr_storage" >&6 -if test $ac_cv_type_struct_sockaddr_storage = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getgrnam_r_4" >&5 +$as_echo "$tcl_cv_api_getgrnam_r_4" >&6; } + tcl_ok=$tcl_cv_api_getgrnam_r_4 + if test "$tcl_ok" = yes; then -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SOCKADDR_STORAGE 1 -_ACEOF +$as_echo "#define HAVE_GETGRNAM_R_4 1" >>confdefs.h + + fi + fi + if test "$tcl_ok" = yes; then +$as_echo "#define HAVE_GETGRNAM_R 1" >>confdefs.h + + fi -else - NEED_FAKE_RFC2553=1 fi -if test "x$NEED_FAKE_RFC2553" = "x1"; then + if test "`uname -s`" = "Darwin" && \ + test "`uname -r | awk -F. '{print $1}'`" -gt 5; then + # Starting with Darwin 6 (Mac OSX 10.2), gethostbyX + # are actually MT-safe as they always return pointers + # from TSD instead of static storage. -cat >>confdefs.h <<\_ACEOF -#define NEED_FAKE_RFC2553 1 -_ACEOF +$as_echo "#define HAVE_MTSAFE_GETHOSTBYNAME 1" >>confdefs.h - case $LIBOBJS in - "fake-rfc2553.$ac_objext" | \ - *" fake-rfc2553.$ac_objext" | \ - "fake-rfc2553.$ac_objext "* | \ - *" fake-rfc2553.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS fake-rfc2553.$ac_objext" ;; -esac - echo "$as_me:$LINENO: checking for strlcpy" >&5 -echo $ECHO_N "checking for strlcpy... $ECHO_C" >&6 -if test "${ac_cv_func_strlcpy+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 strlcpy to an innocuous variant, in case declares strlcpy. - For example, HP-UX 11i declares gettimeofday. */ -#define strlcpy innocuous_strlcpy +$as_echo "#define HAVE_MTSAFE_GETHOSTBYADDR 1" >>confdefs.h -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char strlcpy (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ -#ifdef __STDC__ -# include -#else -# include -#endif + elif test "`uname -s`" = "HP-UX" && \ + test "`uname -r|sed -e 's|B\.||' -e 's|\..*$||'`" -gt 10; then + # Starting with HPUX 11.00 (we believe), gethostbyX + # are actually MT-safe as they always return pointers + # from TSD instead of static storage. -#undef strlcpy +$as_echo "#define HAVE_MTSAFE_GETHOSTBYNAME 1" >>confdefs.h -/* 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 strlcpy (); -/* 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_strlcpy) || defined (__stub___strlcpy) -choke me -#else -char (*f) () = strlcpy; -#endif -#ifdef __cplusplus -} -#endif + +$as_echo "#define HAVE_MTSAFE_GETHOSTBYADDR 1" >>confdefs.h + + + else + ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r" +if test "x$ac_cv_func_gethostbyname_r" = xyes; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname_r with 6 args" >&5 +$as_echo_n "checking for gethostbyname_r with 6 args... " >&6; } +if ${tcl_cv_api_gethostbyname_r_6+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include int main () { -return f != strlcpy; - ; - 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_strlcpy=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_strlcpy=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_strlcpy" >&5 -echo "${ECHO_T}$ac_cv_func_strlcpy" >&6 - -fi - - -#-------------------------------------------------------------------- -# Look for thread-safe variants of some library functions. -#-------------------------------------------------------------------- - -if test "${TCL_THREADS}" = 1; then - echo "$as_me:$LINENO: checking for getpwuid_r" >&5 -echo $ECHO_N "checking for getpwuid_r... $ECHO_C" >&6 -if test "${ac_cv_func_getpwuid_r+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 getpwuid_r to an innocuous variant, in case declares getpwuid_r. - For example, HP-UX 11i declares gettimeofday. */ -#define getpwuid_r innocuous_getpwuid_r - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char getpwuid_r (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif -#undef getpwuid_r + char *name; + struct hostent *he, *res; + char buffer[2048]; + int buflen = 2048; + int h_errnop; -/* 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 getpwuid_r (); -/* 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_getpwuid_r) || defined (__stub___getpwuid_r) -choke me -#else -char (*f) () = getpwuid_r; -#endif -#ifdef __cplusplus -} -#endif + (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop); -int -main () -{ -return f != getpwuid_r; ; 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_getpwuid_r=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_gethostbyname_r_6=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_getpwuid_r=no + tcl_cv_api_gethostbyname_r_6=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_getpwuid_r" >&5 -echo "${ECHO_T}$ac_cv_func_getpwuid_r" >&6 -if test $ac_cv_func_getpwuid_r = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_gethostbyname_r_6" >&5 +$as_echo "$tcl_cv_api_gethostbyname_r_6" >&6; } + tcl_ok=$tcl_cv_api_gethostbyname_r_6 + if test "$tcl_ok" = yes; then - echo "$as_me:$LINENO: checking for getpwuid_r with 5 args" >&5 -echo $ECHO_N "checking for getpwuid_r with 5 args... $ECHO_C" >&6 -if test "${tcl_cv_api_getpwuid_r_5+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +$as_echo "#define HAVE_GETHOSTBYNAME_R_6 1" >>confdefs.h + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname_r with 5 args" >&5 +$as_echo_n "checking for gethostbyname_r with 5 args... " >&6; } +if ${tcl_cv_api_gethostbyname_r_5+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include + #include int main () { - uid_t uid; - struct passwd pw, *pwp; - char buf[512]; - int buflen = 512; + char *name; + struct hostent *he; + char buffer[2048]; + int buflen = 2048; + int h_errnop; - (void) getpwuid_r(uid, &pw, buf, buflen, &pwp); + (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop); ; 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_api_getpwuid_r_5=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_gethostbyname_r_5=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_api_getpwuid_r_5=no + tcl_cv_api_gethostbyname_r_5=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_api_getpwuid_r_5" >&5 -echo "${ECHO_T}$tcl_cv_api_getpwuid_r_5" >&6 - tcl_ok=$tcl_cv_api_getpwuid_r_5 - if test "$tcl_ok" = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_gethostbyname_r_5" >&5 +$as_echo "$tcl_cv_api_gethostbyname_r_5" >&6; } + tcl_ok=$tcl_cv_api_gethostbyname_r_5 + if test "$tcl_ok" = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETPWUID_R_5 1 -_ACEOF +$as_echo "#define HAVE_GETHOSTBYNAME_R_5 1" >>confdefs.h - else - echo "$as_me:$LINENO: checking for getpwuid_r with 4 args" >&5 -echo $ECHO_N "checking for getpwuid_r with 4 args... $ECHO_C" >&6 -if test "${tcl_cv_api_getpwuid_r_4+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname_r with 3 args" >&5 +$as_echo_n "checking for gethostbyname_r with 3 args... " >&6; } +if ${tcl_cv_api_gethostbyname_r_3+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include + #include int main () { - uid_t uid; - struct passwd pw; - char buf[512]; - int buflen = 512; + char *name; + struct hostent *he; + struct hostent_data data; - (void)getpwnam_r(uid, &pw, buf, buflen); + (void) gethostbyname_r(name, he, &data); ; 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_api_getpwuid_r_4=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_gethostbyname_r_3=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_api_getpwuid_r_4=no + tcl_cv_api_gethostbyname_r_3=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_api_getpwuid_r_4" >&5 -echo "${ECHO_T}$tcl_cv_api_getpwuid_r_4" >&6 - tcl_ok=$tcl_cv_api_getpwuid_r_4 - if test "$tcl_ok" = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_gethostbyname_r_3" >&5 +$as_echo "$tcl_cv_api_gethostbyname_r_3" >&6; } + tcl_ok=$tcl_cv_api_gethostbyname_r_3 + if test "$tcl_ok" = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETPWUID_R_4 1 -_ACEOF +$as_echo "#define HAVE_GETHOSTBYNAME_R_3 1" >>confdefs.h + fi fi fi if test "$tcl_ok" = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETPWUID_R 1 -_ACEOF +$as_echo "#define HAVE_GETHOSTBYNAME_R 1" >>confdefs.h fi fi - echo "$as_me:$LINENO: checking for getpwnam_r" >&5 -echo $ECHO_N "checking for getpwnam_r... $ECHO_C" >&6 -if test "${ac_cv_func_getpwnam_r+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 getpwnam_r to an innocuous variant, in case declares getpwnam_r. - For example, HP-UX 11i declares gettimeofday. */ -#define getpwnam_r innocuous_getpwnam_r - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char getpwnam_r (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef getpwnam_r - -/* 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 getpwnam_r (); -/* 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_getpwnam_r) || defined (__stub___getpwnam_r) -choke me -#else -char (*f) () = getpwnam_r; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != getpwnam_r; - ; - 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_getpwnam_r=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_getpwnam_r=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_getpwnam_r" >&5 -echo "${ECHO_T}$ac_cv_func_getpwnam_r" >&6 -if test $ac_cv_func_getpwnam_r = yes; then + ac_fn_c_check_func "$LINENO" "gethostbyaddr_r" "ac_cv_func_gethostbyaddr_r" +if test "x$ac_cv_func_gethostbyaddr_r" = xyes; then : - echo "$as_me:$LINENO: checking for getpwnam_r with 5 args" >&5 -echo $ECHO_N "checking for getpwnam_r with 5 args... $ECHO_C" >&6 -if test "${tcl_cv_api_getpwnam_r_5+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyaddr_r with 7 args" >&5 +$as_echo_n "checking for gethostbyaddr_r with 7 args... " >&6; } +if ${tcl_cv_api_gethostbyaddr_r_7+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include + #include int main () { - char *name; - struct passwd pw, *pwp; - char buf[512]; - int buflen = 512; + char *addr; + int length; + int type; + struct hostent *result; + char buffer[2048]; + int buflen = 2048; + int h_errnop; - (void) getpwnam_r(name, &pw, buf, buflen, &pwp); + (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, + &h_errnop); ; 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_api_getpwnam_r_5=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_gethostbyaddr_r_7=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_api_getpwnam_r_5=no + tcl_cv_api_gethostbyaddr_r_7=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_api_getpwnam_r_5" >&5 -echo "${ECHO_T}$tcl_cv_api_getpwnam_r_5" >&6 - tcl_ok=$tcl_cv_api_getpwnam_r_5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_gethostbyaddr_r_7" >&5 +$as_echo "$tcl_cv_api_gethostbyaddr_r_7" >&6; } + tcl_ok=$tcl_cv_api_gethostbyaddr_r_7 if test "$tcl_ok" = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETPWNAM_R_5 1 -_ACEOF +$as_echo "#define HAVE_GETHOSTBYADDR_R_7 1" >>confdefs.h else - echo "$as_me:$LINENO: checking for getpwnam_r with 4 args" >&5 -echo $ECHO_N "checking for getpwnam_r with 4 args... $ECHO_C" >&6 -if test "${tcl_cv_api_getpwnam_r_4+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyaddr_r with 8 args" >&5 +$as_echo_n "checking for gethostbyaddr_r with 8 args... " >&6; } +if ${tcl_cv_api_gethostbyaddr_r_8+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #include + #include int main () { - char *name; - struct passwd pw; - char buf[512]; - int buflen = 512; + char *addr; + int length; + int type; + struct hostent *result, *resultp; + char buffer[2048]; + int buflen = 2048; + int h_errnop; - (void)getpwnam_r(name, &pw, buf, buflen); + (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, + &resultp, &h_errnop); ; 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_api_getpwnam_r_4=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_api_gethostbyaddr_r_8=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_api_getpwnam_r_4=no + tcl_cv_api_gethostbyaddr_r_8=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_api_getpwnam_r_4" >&5 -echo "${ECHO_T}$tcl_cv_api_getpwnam_r_4" >&6 - tcl_ok=$tcl_cv_api_getpwnam_r_4 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_gethostbyaddr_r_8" >&5 +$as_echo "$tcl_cv_api_gethostbyaddr_r_8" >&6; } + tcl_ok=$tcl_cv_api_gethostbyaddr_r_8 if test "$tcl_ok" = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETPWNAM_R_4 1 -_ACEOF +$as_echo "#define HAVE_GETHOSTBYADDR_R_8 1" >>confdefs.h fi fi if test "$tcl_ok" = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETPWNAM_R 1 -_ACEOF +$as_echo "#define HAVE_GETHOSTBYADDR_R 1" >>confdefs.h fi fi - echo "$as_me:$LINENO: checking for getgrgid_r" >&5 -echo $ECHO_N "checking for getgrgid_r... $ECHO_C" >&6 -if test "${ac_cv_func_getgrgid_r+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + fi +fi + +#--------------------------------------------------------------------------- +# Check for serial port interface. +# +# termios.h is present on all POSIX systems. +# sys/ioctl.h is almost always present, though what it contains +# is system-specific. +# sys/modem.h is needed on HP-UX. +#--------------------------------------------------------------------------- + +for ac_header in termios.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "termios.h" "ac_cv_header_termios_h" "$ac_includes_default" +if test "x$ac_cv_header_termios_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TERMIOS_H 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define getgrgid_r to an innocuous variant, in case declares getgrgid_r. - For example, HP-UX 11i declares gettimeofday. */ -#define getgrgid_r innocuous_getgrgid_r -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char getgrgid_r (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ +fi -#ifdef __STDC__ -# include -#else -# include -#endif +done -#undef getgrgid_r +for ac_header in sys/ioctl.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_ioctl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_IOCTL_H 1 +_ACEOF -/* 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 getgrgid_r (); -/* 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_getgrgid_r) || defined (__stub___getgrgid_r) -choke me -#else -char (*f) () = getgrgid_r; -#endif -#ifdef __cplusplus -} -#endif +fi + +done + +for ac_header in sys/modem.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/modem.h" "ac_cv_header_sys_modem_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_modem_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_MODEM_H 1 +_ACEOF + +fi + +done + + +#-------------------------------------------------------------------- +# Include sys/select.h if it exists and if it supplies things +# that appear to be useful and aren't already in sys/types.h. +# This appears to be true only on the RS/6000 under AIX. Some +# systems like OSF/1 have a sys/select.h that's of no use, and +# other systems like SCO UNIX have a sys/select.h that's +# pernicious. If "fd_set" isn't defined anywhere then set a +# special flag. +#-------------------------------------------------------------------- + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fd_set in sys/types" >&5 +$as_echo_n "checking for fd_set in sys/types... " >&6; } +if ${tcl_cv_type_fd_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include int main () { -return f != getgrgid_r; +fd_set readMask, writeMask; ; 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_getgrgid_r=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_type_fd_set=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_getgrgid_r=no + tcl_cv_type_fd_set=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_getgrgid_r" >&5 -echo "${ECHO_T}$ac_cv_func_getgrgid_r" >&6 -if test $ac_cv_func_getgrgid_r = yes; then - - echo "$as_me:$LINENO: checking for getgrgid_r with 5 args" >&5 -echo $ECHO_N "checking for getgrgid_r with 5 args... $ECHO_C" >&6 -if test "${tcl_cv_api_getgrgid_r_5+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_type_fd_set" >&5 +$as_echo "$tcl_cv_type_fd_set" >&6; } +tcl_ok=$tcl_cv_type_fd_set +if test $tcl_ok = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fd_mask in sys/select" >&5 +$as_echo_n "checking for fd_mask in sys/select... " >&6; } +if ${tcl_cv_grep_fd_mask+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include - #include - #include +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "fd_mask" >/dev/null 2>&1; then : + tcl_cv_grep_fd_mask=present +else + tcl_cv_grep_fd_mask=missing +fi +rm -f conftest* -int -main () -{ +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_grep_fd_mask" >&5 +$as_echo "$tcl_cv_grep_fd_mask" >&6; } + if test $tcl_cv_grep_fd_mask = present; then - gid_t gid; - struct group gr, *grp; - char buf[512]; - int buflen = 512; +$as_echo "#define HAVE_SYS_SELECT_H 1" >>confdefs.h - (void) getgrgid_r(gid, &gr, buf, buflen, &grp); + tcl_ok=yes + fi +fi +if test $tcl_ok = no; then - ; - 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_api_getgrgid_r_5=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +$as_echo "#define NO_FD_SET 1" >>confdefs.h -tcl_cv_api_getgrgid_r_5=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $tcl_cv_api_getgrgid_r_5" >&5 -echo "${ECHO_T}$tcl_cv_api_getgrgid_r_5" >&6 - tcl_ok=$tcl_cv_api_getgrgid_r_5 - if test "$tcl_ok" = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETGRGID_R_5 1 -_ACEOF +#------------------------------------------------------------------------------ +# Find out all about time handling differences. +#------------------------------------------------------------------------------ - else - echo "$as_me:$LINENO: checking for getgrgid_r with 4 args" >&5 -echo $ECHO_N "checking for getgrgid_r with 4 args... $ECHO_C" >&6 -if test "${tcl_cv_api_getgrgid_r_4+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ + for ac_header in sys/time.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_time_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_TIME_H 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - #include - #include +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if ${ac_cv_header_time+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include int main () { - - gid_t gid; - struct group gr; - char buf[512]; - int buflen = 512; - - (void)getgrgid_r(gid, &gr, buf, buflen); - +if ((struct tm *) 0) +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 - tcl_cv_api_getgrgid_r_4=yes +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_api_getgrgid_r_4=no + ac_cv_header_time=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_api_getgrgid_r_4" >&5 -echo "${ECHO_T}$tcl_cv_api_getgrgid_r_4" >&6 - tcl_ok=$tcl_cv_api_getgrgid_r_4 - if test "$tcl_ok" = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETGRGID_R_4 1 -_ACEOF +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h - fi - fi - if test "$tcl_ok" = yes; then +fi -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETGRGID_R 1 -_ACEOF - fi + for ac_func in gmtime_r localtime_r mktime +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF fi +done - echo "$as_me:$LINENO: checking for getgrnam_r" >&5 -echo $ECHO_N "checking for getgrnam_r... $ECHO_C" >&6 -if test "${ac_cv_func_getgrnam_r+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking tm_tzadj in struct tm" >&5 +$as_echo_n "checking tm_tzadj in struct tm... " >&6; } +if ${tcl_cv_member_tm_tzadj+:} false; then : + $as_echo_n "(cached) " >&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 getgrnam_r to an innocuous variant, in case declares getgrnam_r. - For example, HP-UX 11i declares gettimeofday. */ -#define getgrnam_r innocuous_getgrnam_r -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char getgrnam_r (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +struct tm tm; tm.tm_tzadj; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_member_tm_tzadj=yes +else + tcl_cv_member_tm_tzadj=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_member_tm_tzadj" >&5 +$as_echo "$tcl_cv_member_tm_tzadj" >&6; } + if test $tcl_cv_member_tm_tzadj = yes ; then -#ifdef __STDC__ -# include -#else -# include -#endif +$as_echo "#define HAVE_TM_TZADJ 1" >>confdefs.h -#undef getgrnam_r + fi -/* 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 getgrnam_r (); -/* 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_getgrnam_r) || defined (__stub___getgrnam_r) -choke me -#else -char (*f) () = getgrnam_r; -#endif -#ifdef __cplusplus -} -#endif + { $as_echo "$as_me:${as_lineno-$LINENO}: checking tm_gmtoff in struct tm" >&5 +$as_echo_n "checking tm_gmtoff in struct tm... " >&6; } +if ${tcl_cv_member_tm_gmtoff+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include int main () { -return f != getgrnam_r; +struct tm tm; tm.tm_gmtoff; ; 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_getgrnam_r=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_member_tm_gmtoff=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_getgrnam_r=no + tcl_cv_member_tm_gmtoff=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_getgrnam_r" >&5 -echo "${ECHO_T}$ac_cv_func_getgrnam_r" >&6 -if test $ac_cv_func_getgrnam_r = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_member_tm_gmtoff" >&5 +$as_echo "$tcl_cv_member_tm_gmtoff" >&6; } + if test $tcl_cv_member_tm_gmtoff = yes ; then - echo "$as_me:$LINENO: checking for getgrnam_r with 5 args" >&5 -echo $ECHO_N "checking for getgrnam_r with 5 args... $ECHO_C" >&6 -if test "${tcl_cv_api_getgrnam_r_5+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else +$as_echo "#define HAVE_TM_GMTOFF 1" >>confdefs.h - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + fi - #include - #include + # + # Its important to include time.h in this check, as some systems + # (like convex) have timezone functions, etc. + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking long timezone variable" >&5 +$as_echo_n "checking long timezone variable... " >&6; } +if ${tcl_cv_timezone_long+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include int main () { - - char *name; - struct group gr, *grp; - char buf[512]; - int buflen = 512; - - (void) getgrnam_r(name, &gr, buf, buflen, &grp); - +extern long timezone; + timezone += 1; + exit (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_api_getgrnam_r_5=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_timezone_long=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_api_getgrnam_r_5=no + tcl_cv_timezone_long=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_api_getgrnam_r_5" >&5 -echo "${ECHO_T}$tcl_cv_api_getgrnam_r_5" >&6 - tcl_ok=$tcl_cv_api_getgrnam_r_5 - if test "$tcl_ok" = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_timezone_long" >&5 +$as_echo "$tcl_cv_timezone_long" >&6; } + if test $tcl_cv_timezone_long = yes ; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETGRNAM_R_5 1 -_ACEOF +$as_echo "#define HAVE_TIMEZONE_VAR 1" >>confdefs.h else - echo "$as_me:$LINENO: checking for getgrnam_r with 4 args" >&5 -echo $ECHO_N "checking for getgrnam_r with 4 args... $ECHO_C" >&6 -if test "${tcl_cv_api_getgrnam_r_4+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + # + # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking time_t timezone variable" >&5 +$as_echo_n "checking time_t timezone variable... " >&6; } +if ${tcl_cv_timezone_time+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - #include - #include - +#include int main () { - - char *name; - struct group gr; - char buf[512]; - int buflen = 512; - - (void)getgrnam_r(name, &gr, buf, buflen); - +extern time_t timezone; + timezone += 1; + exit (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_api_getgrnam_r_4=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_timezone_time=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_api_getgrnam_r_4=no + tcl_cv_timezone_time=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_api_getgrnam_r_4" >&5 -echo "${ECHO_T}$tcl_cv_api_getgrnam_r_4" >&6 - tcl_ok=$tcl_cv_api_getgrnam_r_4 - if test "$tcl_ok" = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_timezone_time" >&5 +$as_echo "$tcl_cv_timezone_time" >&6; } + if test $tcl_cv_timezone_time = yes ; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETGRNAM_R_4 1 -_ACEOF +$as_echo "#define HAVE_TIMEZONE_VAR 1" >>confdefs.h fi fi - if test "$tcl_ok" = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETGRNAM_R 1 -_ACEOF - fi - -fi +#-------------------------------------------------------------------- +# Some systems (e.g., IRIX 4.0.5) lack some fields in struct stat. But +# we might be able to use fstatfs instead. Some systems (OpenBSD?) also +# lack blkcnt_t. +#-------------------------------------------------------------------- - if test "`uname -s`" = "Darwin" && \ - test "`uname -r | awk -F. '{print $1}'`" -gt 5; then - # Starting with Darwin 6 (Mac OSX 10.2), gethostbyX - # are actually MT-safe as they always return pointers - # from TSD instead of static storage. +if test "$ac_cv_cygwin" != "yes"; then + ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : -cat >>confdefs.h <<\_ACEOF -#define HAVE_MTSAFE_GETHOSTBYNAME 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 _ACEOF -cat >>confdefs.h <<\_ACEOF -#define HAVE_MTSAFE_GETHOSTBYADDR 1 +fi +ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" +if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 _ACEOF - elif test "`uname -s`" = "HP-UX" && \ - test "`uname -r|sed -e 's|B\.||' -e 's|\..*$||'`" -gt 10; then - # Starting with HPUX 11.00 (we believe), gethostbyX - # are actually MT-safe as they always return pointers - # from TSD instead of static storage. +fi + +fi +ac_fn_c_check_type "$LINENO" "blkcnt_t" "ac_cv_type_blkcnt_t" "$ac_includes_default" +if test "x$ac_cv_type_blkcnt_t" = xyes; then : -cat >>confdefs.h <<\_ACEOF -#define HAVE_MTSAFE_GETHOSTBYNAME 1 +cat >>confdefs.h <<_ACEOF +#define HAVE_BLKCNT_T 1 _ACEOF -cat >>confdefs.h <<\_ACEOF -#define HAVE_MTSAFE_GETHOSTBYADDR 1 -_ACEOF +fi +ac_fn_c_check_func "$LINENO" "fstatfs" "ac_cv_func_fstatfs" +if test "x$ac_cv_func_fstatfs" = xyes; then : - else - echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 -echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6 -if test "${ac_cv_func_gethostbyname_r+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 gethostbyname_r to an innocuous variant, in case declares gethostbyname_r. - For example, HP-UX 11i declares gettimeofday. */ -#define gethostbyname_r innocuous_gethostbyname_r -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gethostbyname_r (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ +$as_echo "#define NO_FSTATFS 1" >>confdefs.h -#ifdef __STDC__ -# include -#else -# include -#endif +fi -#undef gethostbyname_r -/* 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 gethostbyname_r (); -/* 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_gethostbyname_r) || defined (__stub___gethostbyname_r) -choke me -#else -char (*f) () = gethostbyname_r; -#endif -#ifdef __cplusplus -} -#endif +#-------------------------------------------------------------------- +# Some system have no memcmp or it does not work with 8 bit data, this +# checks it and add memcmp.o to LIBOBJS if needed +#-------------------------------------------------------------------- +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 +$as_echo_n "checking for working memcmp... " >&6; } +if ${ac_cv_func_memcmp_working+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_memcmp_working=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default int main () { -return f != gethostbyname_r; + + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = '\100', c1 = '\200', c2 = '\201'; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + return 1; + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + return 1; + } + return 0; + } + ; 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_gethostbyname_r=yes +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_memcmp_working=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_gethostbyname_r=no + ac_cv_func_memcmp_working=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname_r" >&5 -echo "${ECHO_T}$ac_cv_func_gethostbyname_r" >&6 -if test $ac_cv_func_gethostbyname_r = yes; then - - echo "$as_me:$LINENO: checking for gethostbyname_r with 6 args" >&5 -echo $ECHO_N "checking for gethostbyname_r with 6 args... $ECHO_C" >&6 -if test "${tcl_cv_api_gethostbyname_r_6+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. */ +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 +$as_echo "$ac_cv_func_memcmp_working" >&6; } +test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in + *" memcmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" + ;; +esac - #include -int -main () -{ - char *name; - struct hostent *he, *res; - char buffer[2048]; - int buflen = 2048; - int h_errnop; +#-------------------------------------------------------------------- +# Some system like SunOS 4 and other BSD like systems have no memmove +# (we assume they have bcopy instead). {The replacement define is in +# compat/string.h} +#-------------------------------------------------------------------- - (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop); +ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" +if test "x$ac_cv_func_memmove" = xyes; then : - ; - 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_api_gethostbyname_r_6=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -tcl_cv_api_gethostbyname_r_6=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $tcl_cv_api_gethostbyname_r_6" >&5 -echo "${ECHO_T}$tcl_cv_api_gethostbyname_r_6" >&6 - tcl_ok=$tcl_cv_api_gethostbyname_r_6 - if test "$tcl_ok" = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETHOSTBYNAME_R_6 1 -_ACEOF +$as_echo "#define NO_MEMMOVE 1" >>confdefs.h - else - echo "$as_me:$LINENO: checking for gethostbyname_r with 5 args" >&5 -echo $ECHO_N "checking for gethostbyname_r with 5 args... $ECHO_C" >&6 -if test "${tcl_cv_api_gethostbyname_r_5+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. */ +$as_echo "#define NO_STRING_H 1" >>confdefs.h - #include +fi -int -main () -{ - char *name; - struct hostent *he; - char buffer[2048]; - int buflen = 2048; - int h_errnop; +#-------------------------------------------------------------------- +# On some systems strstr is broken: it returns a pointer even even if +# the original string is empty. +#-------------------------------------------------------------------- - (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop); - ; - return 0; + ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" +if test "x$ac_cv_func_strstr" = xyes; then : + tcl_ok=1 +else + tcl_ok=0 +fi + + if test "$tcl_ok" = 1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking proper strstr implementation" >&5 +$as_echo_n "checking proper strstr implementation... " >&6; } +if ${tcl_cv_strstr_unbroken+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + tcl_cv_strstr_unbroken=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main() { + extern int strstr(); + exit(strstr("\0test", "test") ? 1 : 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_api_gethostbyname_r_5=yes +if ac_fn_c_try_run "$LINENO"; then : + tcl_cv_strstr_unbroken=ok else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_api_gethostbyname_r_5=no + tcl_cv_strstr_unbroken=broken fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_api_gethostbyname_r_5" >&5 -echo "${ECHO_T}$tcl_cv_api_gethostbyname_r_5" >&6 - tcl_ok=$tcl_cv_api_gethostbyname_r_5 - if test "$tcl_ok" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETHOSTBYNAME_R_5 1 -_ACEOF +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strstr_unbroken" >&5 +$as_echo "$tcl_cv_strstr_unbroken" >&6; } + if test "$tcl_cv_strstr_unbroken" = "ok"; then + tcl_ok=1 else - echo "$as_me:$LINENO: checking for gethostbyname_r with 3 args" >&5 -echo $ECHO_N "checking for gethostbyname_r with 3 args... $ECHO_C" >&6 -if test "${tcl_cv_api_gethostbyname_r_3+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + tcl_ok=0 + fi + fi + if test "$tcl_ok" = 0; then + case " $LIBOBJS " in + *" strstr.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strstr.$ac_objext" + ;; +esac - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ + USE_COMPAT=1 + fi - #include -int -main () -{ +#-------------------------------------------------------------------- +# Check for strtoul function. This is tricky because under some +# versions of AIX strtoul returns an incorrect terminator +# pointer for the string "0". +#-------------------------------------------------------------------- - char *name; - struct hostent *he; - struct hostent_data data; - (void) gethostbyname_r(name, he, &data); + ac_fn_c_check_func "$LINENO" "strtoul" "ac_cv_func_strtoul" +if test "x$ac_cv_func_strtoul" = xyes; then : + tcl_ok=1 +else + tcl_ok=0 +fi - ; - return 0; + if test "$tcl_ok" = 1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking proper strtoul implementation" >&5 +$as_echo_n "checking proper strtoul implementation... " >&6; } +if ${tcl_cv_strtoul_unbroken+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + tcl_cv_strtoul_unbroken=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main() { + extern int strtoul(); + char *term, *string = "0"; + exit(strtoul(string,&term,0) != 0 || term != string+1); } _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_api_gethostbyname_r_3=yes +if ac_fn_c_try_run "$LINENO"; then : + tcl_cv_strtoul_unbroken=ok else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_api_gethostbyname_r_3=no + tcl_cv_strtoul_unbroken=broken fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_api_gethostbyname_r_3" >&5 -echo "${ECHO_T}$tcl_cv_api_gethostbyname_r_3" >&6 - tcl_ok=$tcl_cv_api_gethostbyname_r_3 - if test "$tcl_ok" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETHOSTBYNAME_R_3 1 -_ACEOF - fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strtoul_unbroken" >&5 +$as_echo "$tcl_cv_strtoul_unbroken" >&6; } + if test "$tcl_cv_strtoul_unbroken" = "ok"; then + tcl_ok=1 + else + tcl_ok=0 fi fi - if test "$tcl_ok" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETHOSTBYNAME_R 1 -_ACEOF + if test "$tcl_ok" = 0; then + case " $LIBOBJS " in + *" strtoul.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strtoul.$ac_objext" + ;; +esac + USE_COMPAT=1 fi + +#-------------------------------------------------------------------- +# Check for the strtod function. This is tricky because in some +# versions of Linux strtod mis-parses strings starting with "+". +#-------------------------------------------------------------------- + + + ac_fn_c_check_func "$LINENO" "strtod" "ac_cv_func_strtod" +if test "x$ac_cv_func_strtod" = xyes; then : + tcl_ok=1 +else + tcl_ok=0 fi - echo "$as_me:$LINENO: checking for gethostbyaddr_r" >&5 -echo $ECHO_N "checking for gethostbyaddr_r... $ECHO_C" >&6 -if test "${ac_cv_func_gethostbyaddr_r+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if test "$tcl_ok" = 1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking proper strtod implementation" >&5 +$as_echo_n "checking proper strtod implementation... " >&6; } +if ${tcl_cv_strtod_unbroken+:} false; then : + $as_echo_n "(cached) " >&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 gethostbyaddr_r to an innocuous variant, in case declares gethostbyaddr_r. - For example, HP-UX 11i declares gettimeofday. */ -#define gethostbyaddr_r innocuous_gethostbyaddr_r - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gethostbyaddr_r (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef gethostbyaddr_r - -/* 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 gethostbyaddr_r (); -/* 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_gethostbyaddr_r) || defined (__stub___gethostbyaddr_r) -choke me -#else -char (*f) () = gethostbyaddr_r; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != gethostbyaddr_r; - ; - 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_gethostbyaddr_r=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_gethostbyaddr_r=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyaddr_r" >&5 -echo "${ECHO_T}$ac_cv_func_gethostbyaddr_r" >&6 -if test $ac_cv_func_gethostbyaddr_r = yes; then - - echo "$as_me:$LINENO: checking for gethostbyaddr_r with 7 args" >&5 -echo $ECHO_N "checking for gethostbyaddr_r with 7 args... $ECHO_C" >&6 -if test "${tcl_cv_api_gethostbyaddr_r_7+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if test "$cross_compiling" = yes; then : + tcl_cv_strtod_unbroken=unknown else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - - #include - -int -main () -{ - - char *addr; - int length; - int type; - struct hostent *result; - char buffer[2048]; - int buflen = 2048; - int h_errnop; - - (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, - &h_errnop); - - ; - return 0; +int main() { + extern double strtod(); + char *term, *string = " +69"; + exit(strtod(string,&term) != 69 || term != string+4); } _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_api_gethostbyaddr_r_7=yes +if ac_fn_c_try_run "$LINENO"; then : + tcl_cv_strtod_unbroken=ok else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_api_gethostbyaddr_r_7=no + tcl_cv_strtod_unbroken=broken fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_api_gethostbyaddr_r_7" >&5 -echo "${ECHO_T}$tcl_cv_api_gethostbyaddr_r_7" >&6 - tcl_ok=$tcl_cv_api_gethostbyaddr_r_7 - if test "$tcl_ok" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETHOSTBYADDR_R_7 1 -_ACEOF - - else - echo "$as_me:$LINENO: checking for gethostbyaddr_r with 8 args" >&5 -echo $ECHO_N "checking for gethostbyaddr_r with 8 args... $ECHO_C" >&6 -if test "${tcl_cv_api_gethostbyaddr_r_8+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 - -int -main () -{ - char *addr; - int length; - int type; - struct hostent *result, *resultp; - char buffer[2048]; - int buflen = 2048; - int h_errnop; - - (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, - &resultp, &h_errnop); - - ; - 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_api_gethostbyaddr_r_8=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_api_gethostbyaddr_r_8=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $tcl_cv_api_gethostbyaddr_r_8" >&5 -echo "${ECHO_T}$tcl_cv_api_gethostbyaddr_r_8" >&6 - tcl_ok=$tcl_cv_api_gethostbyaddr_r_8 - if test "$tcl_ok" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETHOSTBYADDR_R_8 1 -_ACEOF - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strtod_unbroken" >&5 +$as_echo "$tcl_cv_strtod_unbroken" >&6; } + if test "$tcl_cv_strtod_unbroken" = "ok"; then + tcl_ok=1 + else + tcl_ok=0 fi fi - if test "$tcl_ok" = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GETHOSTBYADDR_R 1 -_ACEOF - - fi - -fi + if test "$tcl_ok" = 0; then + case " $LIBOBJS " in + *" strtod.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strtod.$ac_objext" + ;; +esac + USE_COMPAT=1 fi -fi - -#--------------------------------------------------------------------------- -# Check for serial port interface. -# -# termios.h is present on all POSIX systems. -# sys/ioctl.h is almost always present, though what it contains -# is system-specific. -# sys/modem.h is needed on HP-UX. -#--------------------------------------------------------------------------- -for ac_header in termios.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 +#-------------------------------------------------------------------- +# Under Solaris 2.4, strtod returns the wrong value for the +# terminating character under some conditions. Check for this +# and if the problem exists use a substitute procedure +# "fixstrtod" that corrects the error. +#-------------------------------------------------------------------- -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 + ac_fn_c_check_func "$LINENO" "strtod" "ac_cv_func_strtod" +if test "x$ac_cv_func_strtod" = xyes; then : + tcl_strtod=1 else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no + tcl_strtod=0 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 + if test "$tcl_strtod" = 1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Solaris2.4/Tru64 strtod bugs" >&5 +$as_echo_n "checking for Solaris2.4/Tru64 strtod bugs... " >&6; } +if ${tcl_cv_strtod_buggy+:} false; then : + $as_echo_n "(cached) " >&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_header in sys/ioctl.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 + if test "$cross_compiling" = yes; then : + tcl_cv_strtod_buggy=buggy 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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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_header in sys/modem.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 - - -#-------------------------------------------------------------------- -# Include sys/select.h if it exists and if it supplies things -# that appear to be useful and aren't already in sys/types.h. -# This appears to be true only on the RS/6000 under AIX. Some -# systems like OSF/1 have a sys/select.h that's of no use, and -# other systems like SCO UNIX have a sys/select.h that's -# pernicious. If "fd_set" isn't defined anywhere then set a -# special flag. -#-------------------------------------------------------------------- - -echo "$as_me:$LINENO: checking for fd_set in sys/types" >&5 -echo $ECHO_N "checking for fd_set in sys/types... $ECHO_C" >&6 -if test "${tcl_cv_type_fd_set+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 -int -main () -{ -fd_set readMask, writeMask; - ; - 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_type_fd_set=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_type_fd_set=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $tcl_cv_type_fd_set" >&5 -echo "${ECHO_T}$tcl_cv_type_fd_set" >&6 -tcl_ok=$tcl_cv_type_fd_set -if test $tcl_ok = no; then - echo "$as_me:$LINENO: checking for fd_mask in sys/select" >&5 -echo $ECHO_N "checking for fd_mask in sys/select... $ECHO_C" >&6 -if test "${tcl_cv_grep_fd_mask+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 - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "fd_mask" >/dev/null 2>&1; then - tcl_cv_grep_fd_mask=present -else - tcl_cv_grep_fd_mask=missing -fi -rm -f conftest* - -fi -echo "$as_me:$LINENO: result: $tcl_cv_grep_fd_mask" >&5 -echo "${ECHO_T}$tcl_cv_grep_fd_mask" >&6 - if test $tcl_cv_grep_fd_mask = present; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_SYS_SELECT_H 1 -_ACEOF - - tcl_ok=yes - fi -fi -if test $tcl_ok = no; then - -cat >>confdefs.h <<\_ACEOF -#define NO_FD_SET 1 -_ACEOF - -fi - -#------------------------------------------------------------------------------ -# Find out all about time handling differences. -#------------------------------------------------------------------------------ - - - -for ac_header in sys/time.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 - - echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 -echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 -if test "${ac_cv_header_time+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 -#include -#include - -int -main () -{ -if ((struct tm *) 0) -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_header_time=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_time=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 -echo "${ECHO_T}$ac_cv_header_time" >&6 -if test $ac_cv_header_time = yes; then - -cat >>confdefs.h <<\_ACEOF -#define TIME_WITH_SYS_TIME 1 -_ACEOF - -fi - - - - - -for ac_func in gmtime_r localtime_r mktime -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 declares $ac_func. - For example, HP-UX 11i 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 to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#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 - - - echo "$as_me:$LINENO: checking tm_tzadj in struct tm" >&5 -echo $ECHO_N "checking tm_tzadj in struct tm... $ECHO_C" >&6 -if test "${tcl_cv_member_tm_tzadj+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 -int -main () -{ -struct tm tm; tm.tm_tzadj; - ; - 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_member_tm_tzadj=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_member_tm_tzadj=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $tcl_cv_member_tm_tzadj" >&5 -echo "${ECHO_T}$tcl_cv_member_tm_tzadj" >&6 - if test $tcl_cv_member_tm_tzadj = yes ; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_TM_TZADJ 1 -_ACEOF - - fi - - echo "$as_me:$LINENO: checking tm_gmtoff in struct tm" >&5 -echo $ECHO_N "checking tm_gmtoff in struct tm... $ECHO_C" >&6 -if test "${tcl_cv_member_tm_gmtoff+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 -int -main () -{ -struct tm tm; tm.tm_gmtoff; - ; - 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_member_tm_gmtoff=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_member_tm_gmtoff=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $tcl_cv_member_tm_gmtoff" >&5 -echo "${ECHO_T}$tcl_cv_member_tm_gmtoff" >&6 - if test $tcl_cv_member_tm_gmtoff = yes ; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_TM_GMTOFF 1 -_ACEOF - - fi - - # - # Its important to include time.h in this check, as some systems - # (like convex) have timezone functions, etc. - # - echo "$as_me:$LINENO: checking long timezone variable" >&5 -echo $ECHO_N "checking long timezone variable... $ECHO_C" >&6 -if test "${tcl_cv_timezone_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. */ -#include -int -main () -{ -extern long timezone; - timezone += 1; - exit (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_timezone_long=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_timezone_long=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $tcl_cv_timezone_long" >&5 -echo "${ECHO_T}$tcl_cv_timezone_long" >&6 - if test $tcl_cv_timezone_long = yes ; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_TIMEZONE_VAR 1 -_ACEOF - - else - # - # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. - # - echo "$as_me:$LINENO: checking time_t timezone variable" >&5 -echo $ECHO_N "checking time_t timezone variable... $ECHO_C" >&6 -if test "${tcl_cv_timezone_time+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 -int -main () -{ -extern time_t timezone; - timezone += 1; - exit (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_timezone_time=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_timezone_time=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $tcl_cv_timezone_time" >&5 -echo "${ECHO_T}$tcl_cv_timezone_time" >&6 - if test $tcl_cv_timezone_time = yes ; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_TIMEZONE_VAR 1 -_ACEOF - - fi - fi - - -#-------------------------------------------------------------------- -# Some systems (e.g., IRIX 4.0.5) lack some fields in struct stat. But -# we might be able to use fstatfs instead. Some systems (OpenBSD?) also -# lack blkcnt_t. -#-------------------------------------------------------------------- - -if test "$ac_cv_cygwin" != "yes"; then - echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5 -echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6 -if test "${ac_cv_member_struct_stat_st_blocks+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 () -{ -static struct stat ac_aggr; -if (ac_aggr.st_blocks) -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_member_struct_stat_st_blocks=yes -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 struct stat ac_aggr; -if (sizeof ac_aggr.st_blocks) -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_member_struct_stat_st_blocks=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_member_struct_stat_st_blocks=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5 -echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6 -if test $ac_cv_member_struct_stat_st_blocks = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BLOCKS 1 -_ACEOF - - -fi -echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5 -echo $ECHO_N "checking for struct stat.st_blksize... $ECHO_C" >&6 -if test "${ac_cv_member_struct_stat_st_blksize+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 () -{ -static struct stat ac_aggr; -if (ac_aggr.st_blksize) -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_member_struct_stat_st_blksize=yes -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 struct stat ac_aggr; -if (sizeof ac_aggr.st_blksize) -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_member_struct_stat_st_blksize=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_member_struct_stat_st_blksize=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5 -echo "${ECHO_T}$ac_cv_member_struct_stat_st_blksize" >&6 -if test $ac_cv_member_struct_stat_st_blksize = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 -_ACEOF - - -fi - -fi -echo "$as_me:$LINENO: checking for blkcnt_t" >&5 -echo $ECHO_N "checking for blkcnt_t... $ECHO_C" >&6 -if test "${ac_cv_type_blkcnt_t+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 ((blkcnt_t *) 0) - return 0; -if (sizeof (blkcnt_t)) - 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_blkcnt_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_blkcnt_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_blkcnt_t" >&5 -echo "${ECHO_T}$ac_cv_type_blkcnt_t" >&6 -if test $ac_cv_type_blkcnt_t = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_BLKCNT_T 1 -_ACEOF - - -fi - -echo "$as_me:$LINENO: checking for fstatfs" >&5 -echo $ECHO_N "checking for fstatfs... $ECHO_C" >&6 -if test "${ac_cv_func_fstatfs+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 fstatfs to an innocuous variant, in case declares fstatfs. - For example, HP-UX 11i declares gettimeofday. */ -#define fstatfs innocuous_fstatfs - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char fstatfs (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef fstatfs - -/* 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 fstatfs (); -/* 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_fstatfs) || defined (__stub___fstatfs) -choke me -#else -char (*f) () = fstatfs; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != fstatfs; - ; - 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_fstatfs=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_fstatfs=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_fstatfs" >&5 -echo "${ECHO_T}$ac_cv_func_fstatfs" >&6 -if test $ac_cv_func_fstatfs = yes; then - : -else - -cat >>confdefs.h <<\_ACEOF -#define NO_FSTATFS 1 -_ACEOF - -fi - - -#-------------------------------------------------------------------- -# Some system have no memcmp or it does not work with 8 bit data, this -# checks it and add memcmp.o to LIBOBJS if needed -#-------------------------------------------------------------------- - -echo "$as_me:$LINENO: checking for working memcmp" >&5 -echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 -if test "${ac_cv_func_memcmp_working+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_memcmp_working=no -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 () -{ - - /* Some versions of memcmp are not 8-bit clean. */ - char c0 = 0x40, c1 = 0x80, c2 = 0x81; - if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) - exit (1); - - /* The Next x86 OpenStep bug shows up only when comparing 16 bytes - or more and with at least one buffer not starting on a 4-byte boundary. - William Lewis provided this test program. */ - { - char foo[21]; - char bar[21]; - int i; - for (i = 0; i < 4; i++) - { - char *a = foo + i; - char *b = bar + i; - strcpy (a, "--------01111111"); - strcpy (b, "--------10000000"); - if (memcmp (a, b, 16) >= 0) - exit (1); - } - exit (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_func_memcmp_working=yes -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 ) -ac_cv_func_memcmp_working=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: $ac_cv_func_memcmp_working" >&5 -echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 -test $ac_cv_func_memcmp_working = no && case $LIBOBJS in - "memcmp.$ac_objext" | \ - *" memcmp.$ac_objext" | \ - "memcmp.$ac_objext "* | \ - *" memcmp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; -esac - - - -#-------------------------------------------------------------------- -# Some system like SunOS 4 and other BSD like systems have no memmove -# (we assume they have bcopy instead). {The replacement define is in -# compat/string.h} -#-------------------------------------------------------------------- - -echo "$as_me:$LINENO: checking for memmove" >&5 -echo $ECHO_N "checking for memmove... $ECHO_C" >&6 -if test "${ac_cv_func_memmove+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 memmove to an innocuous variant, in case declares memmove. - For example, HP-UX 11i declares gettimeofday. */ -#define memmove innocuous_memmove - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char memmove (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef memmove - -/* 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 memmove (); -/* 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_memmove) || defined (__stub___memmove) -choke me -#else -char (*f) () = memmove; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != memmove; - ; - 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_memmove=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_memmove=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_memmove" >&5 -echo "${ECHO_T}$ac_cv_func_memmove" >&6 -if test $ac_cv_func_memmove = yes; then - : -else - - -cat >>confdefs.h <<\_ACEOF -#define NO_MEMMOVE 1 -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define NO_STRING_H 1 -_ACEOF - -fi - - -#-------------------------------------------------------------------- -# On some systems strstr is broken: it returns a pointer even even if -# the original string is empty. -#-------------------------------------------------------------------- - - - echo "$as_me:$LINENO: checking for strstr" >&5 -echo $ECHO_N "checking for strstr... $ECHO_C" >&6 -if test "${ac_cv_func_strstr+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 strstr to an innocuous variant, in case declares strstr. - For example, HP-UX 11i declares gettimeofday. */ -#define strstr innocuous_strstr - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char strstr (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef strstr - -/* 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 strstr (); -/* 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_strstr) || defined (__stub___strstr) -choke me -#else -char (*f) () = strstr; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != strstr; - ; - 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_strstr=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_strstr=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_strstr" >&5 -echo "${ECHO_T}$ac_cv_func_strstr" >&6 -if test $ac_cv_func_strstr = yes; then - tcl_ok=1 -else - tcl_ok=0 -fi - - if test "$tcl_ok" = 1; then - echo "$as_me:$LINENO: checking proper strstr implementation" >&5 -echo $ECHO_N "checking proper strstr implementation... $ECHO_C" >&6 -if test "${tcl_cv_strstr_unbroken+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - tcl_cv_strstr_unbroken=unknown -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() { - extern int strstr(); - exit(strstr("\0test", "test") ? 1 : 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 - tcl_cv_strstr_unbroken=ok -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 ) -tcl_cv_strstr_unbroken=broken -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_strstr_unbroken" >&5 -echo "${ECHO_T}$tcl_cv_strstr_unbroken" >&6 - if test "$tcl_cv_strstr_unbroken" = "ok"; then - tcl_ok=1 - else - tcl_ok=0 - fi - fi - if test "$tcl_ok" = 0; then - case $LIBOBJS in - "strstr.$ac_objext" | \ - *" strstr.$ac_objext" | \ - "strstr.$ac_objext "* | \ - *" strstr.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strstr.$ac_objext" ;; -esac - - USE_COMPAT=1 - fi - - -#-------------------------------------------------------------------- -# Check for strtoul function. This is tricky because under some -# versions of AIX strtoul returns an incorrect terminator -# pointer for the string "0". -#-------------------------------------------------------------------- - - - echo "$as_me:$LINENO: checking for strtoul" >&5 -echo $ECHO_N "checking for strtoul... $ECHO_C" >&6 -if test "${ac_cv_func_strtoul+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 strtoul to an innocuous variant, in case declares strtoul. - For example, HP-UX 11i declares gettimeofday. */ -#define strtoul innocuous_strtoul - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char strtoul (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef strtoul - -/* 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 strtoul (); -/* 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_strtoul) || defined (__stub___strtoul) -choke me -#else -char (*f) () = strtoul; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != strtoul; - ; - 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_strtoul=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_strtoul=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_strtoul" >&5 -echo "${ECHO_T}$ac_cv_func_strtoul" >&6 -if test $ac_cv_func_strtoul = yes; then - tcl_ok=1 -else - tcl_ok=0 -fi - - if test "$tcl_ok" = 1; then - echo "$as_me:$LINENO: checking proper strtoul implementation" >&5 -echo $ECHO_N "checking proper strtoul implementation... $ECHO_C" >&6 -if test "${tcl_cv_strtoul_unbroken+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - tcl_cv_strtoul_unbroken=unknown -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() { - extern int strtoul(); - char *term, *string = "0"; - exit(strtoul(string,&term,0) != 0 || term != string+1); -} -_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 - tcl_cv_strtoul_unbroken=ok -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 ) -tcl_cv_strtoul_unbroken=broken -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_strtoul_unbroken" >&5 -echo "${ECHO_T}$tcl_cv_strtoul_unbroken" >&6 - if test "$tcl_cv_strtoul_unbroken" = "ok"; then - tcl_ok=1 - else - tcl_ok=0 - fi - fi - if test "$tcl_ok" = 0; then - case $LIBOBJS in - "strtoul.$ac_objext" | \ - *" strtoul.$ac_objext" | \ - "strtoul.$ac_objext "* | \ - *" strtoul.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strtoul.$ac_objext" ;; -esac - - USE_COMPAT=1 - fi - - -#-------------------------------------------------------------------- -# Check for the strtod function. This is tricky because in some -# versions of Linux strtod mis-parses strings starting with "+". -#-------------------------------------------------------------------- - - - echo "$as_me:$LINENO: checking for strtod" >&5 -echo $ECHO_N "checking for strtod... $ECHO_C" >&6 -if test "${ac_cv_func_strtod+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 strtod to an innocuous variant, in case declares strtod. - For example, HP-UX 11i declares gettimeofday. */ -#define strtod innocuous_strtod - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char strtod (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef strtod - -/* 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 strtod (); -/* 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_strtod) || defined (__stub___strtod) -choke me -#else -char (*f) () = strtod; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != strtod; - ; - 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_strtod=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_strtod=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_strtod" >&5 -echo "${ECHO_T}$ac_cv_func_strtod" >&6 -if test $ac_cv_func_strtod = yes; then - tcl_ok=1 -else - tcl_ok=0 -fi - - if test "$tcl_ok" = 1; then - echo "$as_me:$LINENO: checking proper strtod implementation" >&5 -echo $ECHO_N "checking proper strtod implementation... $ECHO_C" >&6 -if test "${tcl_cv_strtod_unbroken+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then - tcl_cv_strtod_unbroken=unknown -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() { - extern double strtod(); - char *term, *string = " +69"; - exit(strtod(string,&term) != 69 || term != string+4); -} -_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 - tcl_cv_strtod_unbroken=ok -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 ) -tcl_cv_strtod_unbroken=broken -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_strtod_unbroken" >&5 -echo "${ECHO_T}$tcl_cv_strtod_unbroken" >&6 - if test "$tcl_cv_strtod_unbroken" = "ok"; then - tcl_ok=1 - else - tcl_ok=0 - fi - fi - if test "$tcl_ok" = 0; then - case $LIBOBJS in - "strtod.$ac_objext" | \ - *" strtod.$ac_objext" | \ - "strtod.$ac_objext "* | \ - *" strtod.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strtod.$ac_objext" ;; -esac - - USE_COMPAT=1 - fi - - -#-------------------------------------------------------------------- -# Under Solaris 2.4, strtod returns the wrong value for the -# terminating character under some conditions. Check for this -# and if the problem exists use a substitute procedure -# "fixstrtod" that corrects the error. -#-------------------------------------------------------------------- - - - echo "$as_me:$LINENO: checking for strtod" >&5 -echo $ECHO_N "checking for strtod... $ECHO_C" >&6 -if test "${ac_cv_func_strtod+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 strtod to an innocuous variant, in case declares strtod. - For example, HP-UX 11i declares gettimeofday. */ -#define strtod innocuous_strtod - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char strtod (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef strtod - -/* 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 strtod (); -/* 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_strtod) || defined (__stub___strtod) -choke me -#else -char (*f) () = strtod; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != strtod; - ; - 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_strtod=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_strtod=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_strtod" >&5 -echo "${ECHO_T}$ac_cv_func_strtod" >&6 -if test $ac_cv_func_strtod = yes; then - tcl_strtod=1 -else - tcl_strtod=0 -fi - - if test "$tcl_strtod" = 1; then - echo "$as_me:$LINENO: checking for Solaris2.4/Tru64 strtod bugs" >&5 -echo $ECHO_N "checking for Solaris2.4/Tru64 strtod bugs... $ECHO_C" >&6 -if test "${tcl_cv_strtod_buggy+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - if test "$cross_compiling" = yes; then - tcl_cv_strtod_buggy=buggy -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - - extern double strtod(); - int main() { - char *infString="Inf", *nanString="NaN", *spaceString=" "; - char *term; - double value; - value = strtod(infString, &term); - if ((term != infString) && (term[-1] == 0)) { - exit(1); - } - value = strtod(nanString, &term); - if ((term != nanString) && (term[-1] == 0)) { - exit(1); - } - value = strtod(spaceString, &term); - if (term == (spaceString+1)) { - exit(1); - } - exit(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 - tcl_cv_strtod_buggy=ok -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 ) -tcl_cv_strtod_buggy=buggy -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_strtod_buggy" >&5 -echo "${ECHO_T}$tcl_cv_strtod_buggy" >&6 - if test "$tcl_cv_strtod_buggy" = buggy; then - case $LIBOBJS in - "fixstrtod.$ac_objext" | \ - *" fixstrtod.$ac_objext" | \ - "fixstrtod.$ac_objext "* | \ - *" fixstrtod.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS fixstrtod.$ac_objext" ;; -esac - - USE_COMPAT=1 - -cat >>confdefs.h <<\_ACEOF -#define strtod fixstrtod -_ACEOF - - fi - fi - - -#-------------------------------------------------------------------- -# Check for various typedefs and provide substitutes if -# they don't exist. -#-------------------------------------------------------------------- - -echo "$as_me:$LINENO: checking for mode_t" >&5 -echo $ECHO_N "checking for mode_t... $ECHO_C" >&6 -if test "${ac_cv_type_mode_t+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 ((mode_t *) 0) - return 0; -if (sizeof (mode_t)) - 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_mode_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_mode_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5 -echo "${ECHO_T}$ac_cv_type_mode_t" >&6 -if test $ac_cv_type_mode_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define mode_t int -_ACEOF - -fi - -echo "$as_me:$LINENO: checking for pid_t" >&5 -echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 -if test "${ac_cv_type_pid_t+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 ((pid_t *) 0) - return 0; -if (sizeof (pid_t)) - 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_pid_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_pid_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 -echo "${ECHO_T}$ac_cv_type_pid_t" >&6 -if test $ac_cv_type_pid_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define pid_t int -_ACEOF - -fi - -echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6 -if test "${ac_cv_type_size_t+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 ((size_t *) 0) - return 0; -if (sizeof (size_t)) - 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_size_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_size_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6 -if test $ac_cv_type_size_t = yes; then - : -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned -_ACEOF - -fi - -echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 -echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 -if test "${ac_cv_type_uid_t+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 - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "uid_t" >/dev/null 2>&1; then - ac_cv_type_uid_t=yes -else - ac_cv_type_uid_t=no -fi -rm -f conftest* - -fi -echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 -echo "${ECHO_T}$ac_cv_type_uid_t" >&6 -if test $ac_cv_type_uid_t = no; then - -cat >>confdefs.h <<\_ACEOF -#define uid_t int -_ACEOF - - -cat >>confdefs.h <<\_ACEOF -#define gid_t int -_ACEOF - -fi - - -echo "$as_me:$LINENO: checking for socklen_t" >&5 -echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 -if test "${tcl_cv_type_socklen_t+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 - #include - -int -main () -{ - - socklen_t foo; - - ; - 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_type_socklen_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_type_socklen_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $tcl_cv_type_socklen_t" >&5 -echo "${ECHO_T}$tcl_cv_type_socklen_t" >&6 -if test $tcl_cv_type_socklen_t = no; then - -cat >>confdefs.h <<\_ACEOF -#define socklen_t int -_ACEOF - -fi - -echo "$as_me:$LINENO: checking for intptr_t" >&5 -echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6 -if test "${ac_cv_type_intptr_t+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 ((intptr_t *) 0) - return 0; -if (sizeof (intptr_t)) - 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_intptr_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_intptr_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5 -echo "${ECHO_T}$ac_cv_type_intptr_t" >&6 -if test $ac_cv_type_intptr_t = yes; then - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_INTPTR_T 1 -_ACEOF - -else - - echo "$as_me:$LINENO: checking for pointer-size signed integer type" >&5 -echo $ECHO_N "checking for pointer-size signed integer type... $ECHO_C" >&6 -if test "${tcl_cv_intptr_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - for tcl_cv_intptr_t in "int" "long" "long long" none; do - if test "$tcl_cv_intptr_t" != none; then - 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 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))]; -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 - tcl_ok=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_ok=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test "$tcl_ok" = yes && break; fi - done -fi -echo "$as_me:$LINENO: result: $tcl_cv_intptr_t" >&5 -echo "${ECHO_T}$tcl_cv_intptr_t" >&6 - if test "$tcl_cv_intptr_t" != none; then - -cat >>confdefs.h <<_ACEOF -#define intptr_t $tcl_cv_intptr_t -_ACEOF - - fi - -fi - -echo "$as_me:$LINENO: checking for uintptr_t" >&5 -echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 -if test "${ac_cv_type_uintptr_t+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 ((uintptr_t *) 0) - return 0; -if (sizeof (uintptr_t)) - 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_uintptr_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_type_uintptr_t=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 -echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6 -if test $ac_cv_type_uintptr_t = yes; then - - -cat >>confdefs.h <<\_ACEOF -#define HAVE_UINTPTR_T 1 -_ACEOF - -else - - echo "$as_me:$LINENO: checking for pointer-size unsigned integer type" >&5 -echo $ECHO_N "checking for pointer-size unsigned integer type... $ECHO_C" >&6 -if test "${tcl_cv_uintptr_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \ - none; do - if test "$tcl_cv_uintptr_t" != none; then - 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 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))]; -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 - tcl_ok=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_ok=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - test "$tcl_ok" = yes && break; fi - done -fi -echo "$as_me:$LINENO: result: $tcl_cv_uintptr_t" >&5 -echo "${ECHO_T}$tcl_cv_uintptr_t" >&6 - if test "$tcl_cv_uintptr_t" != none; then - -cat >>confdefs.h <<_ACEOF -#define uintptr_t $tcl_cv_uintptr_t -_ACEOF - - fi - -fi - - -#-------------------------------------------------------------------- -# If a system doesn't have an opendir function (man, that's old!) -# then we have to supply a different version of dirent.h which -# is compatible with the substitute version of opendir that's -# provided. This version only works with V7-style directories. -#-------------------------------------------------------------------- - -echo "$as_me:$LINENO: checking for opendir" >&5 -echo $ECHO_N "checking for opendir... $ECHO_C" >&6 -if test "${ac_cv_func_opendir+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 opendir to an innocuous variant, in case declares opendir. - For example, HP-UX 11i declares gettimeofday. */ -#define opendir innocuous_opendir - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char opendir (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef opendir - -/* 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 opendir (); -/* 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_opendir) || defined (__stub___opendir) -choke me -#else -char (*f) () = opendir; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != opendir; - ; - 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_opendir=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_opendir=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_opendir" >&5 -echo "${ECHO_T}$ac_cv_func_opendir" >&6 -if test $ac_cv_func_opendir = yes; then - : -else - -cat >>confdefs.h <<\_ACEOF -#define USE_DIRENT2_H 1 -_ACEOF - -fi - - -#-------------------------------------------------------------------- -# The check below checks whether defines the type -# "union wait" correctly. It's needed because of weirdness in -# HP-UX where "union wait" is defined in both the BSD and SYS-V -# environments. Checking the usability of WIFEXITED seems to do -# the trick. -#-------------------------------------------------------------------- - -echo "$as_me:$LINENO: checking union wait" >&5 -echo $ECHO_N "checking union wait... $ECHO_C" >&6 -if test "${tcl_cv_union_wait+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 -#include -int -main () -{ - -union wait x; -WIFEXITED(x); /* Generates compiler error if WIFEXITED - * uses an int. */ - - ; - 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_union_wait=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_union_wait=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $tcl_cv_union_wait" >&5 -echo "${ECHO_T}$tcl_cv_union_wait" >&6 -if test $tcl_cv_union_wait = no; then - -cat >>confdefs.h <<\_ACEOF -#define NO_UNION_WAIT 1 -_ACEOF - -fi - -#-------------------------------------------------------------------- -# Check whether there is an strncasecmp function on this system. -# This is a bit tricky because under SCO it's in -lsocket and -# under Sequent Dynix it's in -linet. -#-------------------------------------------------------------------- - -echo "$as_me:$LINENO: checking for strncasecmp" >&5 -echo $ECHO_N "checking for strncasecmp... $ECHO_C" >&6 -if test "${ac_cv_func_strncasecmp+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 strncasecmp to an innocuous variant, in case declares strncasecmp. - For example, HP-UX 11i declares gettimeofday. */ -#define strncasecmp innocuous_strncasecmp - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char strncasecmp (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef strncasecmp - -/* 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 strncasecmp (); -/* 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_strncasecmp) || defined (__stub___strncasecmp) -choke me -#else -char (*f) () = strncasecmp; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != strncasecmp; - ; - 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_strncasecmp=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_func_strncasecmp=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_strncasecmp" >&5 -echo "${ECHO_T}$ac_cv_func_strncasecmp" >&6 -if test $ac_cv_func_strncasecmp = yes; then - tcl_ok=1 -else - tcl_ok=0 -fi - -if test "$tcl_ok" = 0; then - echo "$as_me:$LINENO: checking for strncasecmp in -lsocket" >&5 -echo $ECHO_N "checking for strncasecmp in -lsocket... $ECHO_C" >&6 -if test "${ac_cv_lib_socket_strncasecmp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* 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 strncasecmp (); -int -main () -{ -strncasecmp (); - ; - 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_lib_socket_strncasecmp=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_socket_strncasecmp=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_socket_strncasecmp" >&5 -echo "${ECHO_T}$ac_cv_lib_socket_strncasecmp" >&6 -if test $ac_cv_lib_socket_strncasecmp = yes; then - tcl_ok=1 -else - tcl_ok=0 -fi - -fi -if test "$tcl_ok" = 0; then - echo "$as_me:$LINENO: checking for strncasecmp in -linet" >&5 -echo $ECHO_N "checking for strncasecmp in -linet... $ECHO_C" >&6 -if test "${ac_cv_lib_inet_strncasecmp+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-linet $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* 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 strncasecmp (); -int -main () -{ -strncasecmp (); - ; - return 0; -} + extern double strtod(); + int main() { + char *infString="Inf", *nanString="NaN", *spaceString=" "; + char *term; + double value; + value = strtod(infString, &term); + if ((term != infString) && (term[-1] == 0)) { + exit(1); + } + value = strtod(nanString, &term); + if ((term != nanString) && (term[-1] == 0)) { + exit(1); + } + value = strtod(spaceString, &term); + if (term == (spaceString+1)) { + exit(1); + } + exit(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_lib_inet_strncasecmp=yes +if ac_fn_c_try_run "$LINENO"; then : + tcl_cv_strtod_buggy=ok else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_inet_strncasecmp=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + tcl_cv_strtod_buggy=buggy fi -echo "$as_me:$LINENO: result: $ac_cv_lib_inet_strncasecmp" >&5 -echo "${ECHO_T}$ac_cv_lib_inet_strncasecmp" >&6 -if test $ac_cv_lib_inet_strncasecmp = yes; then - tcl_ok=1 -else - tcl_ok=0 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi -if test "$tcl_ok" = 0; then - case $LIBOBJS in - "strncasecmp.$ac_objext" | \ - *" strncasecmp.$ac_objext" | \ - "strncasecmp.$ac_objext "* | \ - *" strncasecmp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strncasecmp.$ac_objext" ;; +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strtod_buggy" >&5 +$as_echo "$tcl_cv_strtod_buggy" >&6; } + if test "$tcl_cv_strtod_buggy" = buggy; then + case " $LIBOBJS " in + *" fixstrtod.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fixstrtod.$ac_objext" + ;; esac - USE_COMPAT=1 -fi + USE_COMPAT=1 + +$as_echo "#define strtod fixstrtod" >>confdefs.h + + fi + fi + #-------------------------------------------------------------------- -# The code below deals with several issues related to gettimeofday: -# 1. Some systems don't provide a gettimeofday function at all -# (set NO_GETTOD if this is the case). -# 2. See if gettimeofday is declared in the header file. -# if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can -# declare it. +# Check for various typedefs and provide substitutes if +# they don't exist. #-------------------------------------------------------------------- -echo "$as_me:$LINENO: checking for gettimeofday" >&5 -echo $ECHO_N "checking for gettimeofday... $ECHO_C" >&6 -if test "${ac_cv_func_gettimeofday+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" +if test "x$ac_cv_type_mode_t" = xyes; then : + else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define gettimeofday to an innocuous variant, in case declares gettimeofday. - For example, HP-UX 11i declares gettimeofday. */ -#define gettimeofday innocuous_gettimeofday -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char gettimeofday (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ +cat >>confdefs.h <<_ACEOF +#define mode_t int +_ACEOF -#ifdef __STDC__ -# include -#else -# include -#endif +fi -#undef gettimeofday +ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" +if test "x$ac_cv_type_pid_t" = xyes; then : -/* 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 gettimeofday (); -/* 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_gettimeofday) || defined (__stub___gettimeofday) -choke me -#else -char (*f) () = gettimeofday; -#endif -#ifdef __cplusplus -} -#endif +else -int -main () -{ -return f != gettimeofday; - ; - return 0; -} +cat >>confdefs.h <<_ACEOF +#define pid_t int _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_gettimeofday=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_func_gettimeofday=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_func_gettimeofday" >&5 -echo "${ECHO_T}$ac_cv_func_gettimeofday" >&6 -if test $ac_cv_func_gettimeofday = yes; then - : -else +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : -cat >>confdefs.h <<\_ACEOF -#define NO_GETTOD 1 -_ACEOF +else +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF fi -echo "$as_me:$LINENO: checking for gettimeofday declaration" >&5 -echo $ECHO_N "checking for gettimeofday declaration... $ECHO_C" >&6 -if test "${tcl_cv_grep_gettimeofday+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 +$as_echo_n "checking for uid_t in sys/types.h... " >&6; } +if ${ac_cv_type_uid_t+:} false; then : + $as_echo_n "(cached) " >&6 else - - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gettimeofday" >/dev/null 2>&1; then - tcl_cv_grep_gettimeofday=present + $EGREP "uid_t" >/dev/null 2>&1; then : + ac_cv_type_uid_t=yes else - tcl_cv_grep_gettimeofday=missing + ac_cv_type_uid_t=no fi rm -f conftest* fi -echo "$as_me:$LINENO: result: $tcl_cv_grep_gettimeofday" >&5 -echo "${ECHO_T}$tcl_cv_grep_gettimeofday" >&6 -if test $tcl_cv_grep_gettimeofday = missing ; then - -cat >>confdefs.h <<\_ACEOF -#define GETTOD_NOT_DECLARED 1 -_ACEOF - -fi - -#-------------------------------------------------------------------- -# The following code checks to see whether it is possible to get -# signed chars on this platform. This is needed in order to -# properly generate sign-extended ints from character values. -#-------------------------------------------------------------------- +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 +$as_echo "$ac_cv_type_uid_t" >&6; } +if test $ac_cv_type_uid_t = no; then +$as_echo "#define uid_t int" >>confdefs.h -echo "$as_me:$LINENO: checking whether char is unsigned" >&5 -echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6 -if test "${ac_cv_c_char_unsigned+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 () -{ -static int test_array [1 - 2 * !(((char) -1) < 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_cv_c_char_unsigned=no -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +$as_echo "#define gid_t int" >>confdefs.h -ac_cv_c_char_unsigned=yes -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5 -echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6 -if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then - cat >>confdefs.h <<\_ACEOF -#define __CHAR_UNSIGNED__ 1 -_ACEOF -fi -echo "$as_me:$LINENO: checking signed char declarations" >&5 -echo $ECHO_N "checking signed char declarations... $ECHO_C" >&6 -if test "${tcl_cv_char_signed+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t" >&5 +$as_echo_n "checking for socklen_t... " >&6; } +if ${tcl_cv_type_socklen_t+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + #include + #include + int main () { - signed char *p; - p = 0; + socklen_t foo; ; 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_char_signed=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_type_socklen_t=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_char_signed=no + tcl_cv_type_socklen_t=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_char_signed" >&5 -echo "${ECHO_T}$tcl_cv_char_signed" >&6 -if test $tcl_cv_char_signed = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_type_socklen_t" >&5 +$as_echo "$tcl_cv_type_socklen_t" >&6; } +if test $tcl_cv_type_socklen_t = no; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_SIGNED_CHAR 1 -_ACEOF +$as_echo "#define socklen_t int" >>confdefs.h fi -#-------------------------------------------------------------------- -# Does putenv() copy or not? We need to know to avoid memory leaks. -#-------------------------------------------------------------------- +ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default" +if test "x$ac_cv_type_intptr_t" = xyes; then : + + +$as_echo "#define HAVE_INTPTR_T 1" >>confdefs.h -echo "$as_me:$LINENO: checking for a putenv() that copies the buffer" >&5 -echo $ECHO_N "checking for a putenv() that copies the buffer... $ECHO_C" >&6 -if test "${tcl_cv_putenv_copy+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then - tcl_cv_putenv_copy=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pointer-size signed integer type" >&5 +$as_echo_n "checking for pointer-size signed integer type... " >&6; } +if ${tcl_cv_intptr_t+:} false; then : + $as_echo_n "(cached) " >&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 - #define OURVAR "havecopy=yes" - int main (int argc, char *argv[]) - { - char *foo, *bar; - foo = (char *)strdup(OURVAR); - putenv(foo); - strcpy((char *)(strchr(foo, '=') + 1), "no"); - bar = getenv("havecopy"); - if (!strcmp(bar, "no")) { - /* doesnt copy */ - return 0; - } else { - /* does copy */ - return 1; - } - } + for tcl_cv_intptr_t in "int" "long" "long long" none; do + if test "$tcl_cv_intptr_t" != none; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))]; +test_array [0] = 0; +return test_array [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 - tcl_cv_putenv_copy=no +if ac_fn_c_try_compile "$LINENO"; then : + tcl_ok=yes 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 ) -tcl_cv_putenv_copy=yes -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + tcl_ok=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$tcl_ok" = yes && break; fi + done fi -echo "$as_me:$LINENO: result: $tcl_cv_putenv_copy" >&5 -echo "${ECHO_T}$tcl_cv_putenv_copy" >&6 -if test $tcl_cv_putenv_copy = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_intptr_t" >&5 +$as_echo "$tcl_cv_intptr_t" >&6; } + if test "$tcl_cv_intptr_t" != none; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_PUTENV_THAT_COPIES 1 +cat >>confdefs.h <<_ACEOF +#define intptr_t $tcl_cv_intptr_t _ACEOF -fi - -#-------------------------------------------------------------------- -# Check for support of nl_langinfo function -#-------------------------------------------------------------------- - - - # Check whether --enable-langinfo or --disable-langinfo was given. -if test "${enable_langinfo+set}" = set; then - enableval="$enable_langinfo" - langinfo_ok=$enableval -else - langinfo_ok=yes -fi; - - HAVE_LANGINFO=0 - if test "$langinfo_ok" = "yes"; then - if test "${ac_cv_header_langinfo_h+set}" = set; then - echo "$as_me:$LINENO: checking for langinfo.h" >&5 -echo $ECHO_N "checking for langinfo.h... $ECHO_C" >&6 -if test "${ac_cv_header_langinfo_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_langinfo_h" >&5 -echo "${ECHO_T}$ac_cv_header_langinfo_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking langinfo.h usability" >&5 -echo $ECHO_N "checking langinfo.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 -_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 + fi -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 langinfo.h presence" >&5 -echo $ECHO_N "checking langinfo.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 -_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_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default" +if test "x$ac_cv_type_uintptr_t" = xyes; then : - 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: langinfo.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: langinfo.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: langinfo.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: langinfo.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: langinfo.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: langinfo.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: langinfo.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: langinfo.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: langinfo.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: langinfo.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: langinfo.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: langinfo.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: langinfo.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: langinfo.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: langinfo.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: langinfo.h: 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 langinfo.h" >&5 -echo $ECHO_N "checking for langinfo.h... $ECHO_C" >&6 -if test "${ac_cv_header_langinfo_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_langinfo_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_langinfo_h" >&5 -echo "${ECHO_T}$ac_cv_header_langinfo_h" >&6 +$as_echo "#define HAVE_UINTPTR_T 1" >>confdefs.h -fi -if test $ac_cv_header_langinfo_h = yes; then - langinfo_ok=yes else - langinfo_ok=no -fi - - fi - echo "$as_me:$LINENO: checking whether to use nl_langinfo" >&5 -echo $ECHO_N "checking whether to use nl_langinfo... $ECHO_C" >&6 - if test "$langinfo_ok" = "yes"; then - if test "${tcl_cv_langinfo_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pointer-size unsigned integer type" >&5 +$as_echo_n "checking for pointer-size unsigned integer type... " >&6; } +if ${tcl_cv_uintptr_t+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \ + none; do + if test "$tcl_cv_uintptr_t" != none; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +$ac_includes_default int main () { -nl_langinfo(CODESET); +static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))]; +test_array [0] = 0; +return test_array [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_langinfo_h=yes +if ac_fn_c_try_compile "$LINENO"; then : + tcl_ok=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_langinfo_h=no + tcl_ok=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$tcl_ok" = yes && break; fi + done fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_uintptr_t" >&5 +$as_echo "$tcl_cv_uintptr_t" >&6; } + if test "$tcl_cv_uintptr_t" != none; then - echo "$as_me:$LINENO: result: $tcl_cv_langinfo_h" >&5 -echo "${ECHO_T}$tcl_cv_langinfo_h" >&6 - if test $tcl_cv_langinfo_h = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_LANGINFO 1 +cat >>confdefs.h <<_ACEOF +#define uintptr_t $tcl_cv_uintptr_t _ACEOF - fi - else - echo "$as_me:$LINENO: result: $langinfo_ok" >&5 -echo "${ECHO_T}$langinfo_ok" >&6 fi +fi + #-------------------------------------------------------------------- -# Check for support of chflags and mkstemps functions +# If a system doesn't have an opendir function (man, that's old!) +# then we have to supply a different version of dirent.h which +# is compatible with the substitute version of opendir that's +# provided. This version only works with V7-style directories. #-------------------------------------------------------------------- +ac_fn_c_check_func "$LINENO" "opendir" "ac_cv_func_opendir" +if test "x$ac_cv_func_opendir" = xyes; then : +else -for ac_func in chflags mkstemps -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 declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func +$as_echo "#define USE_DIRENT2_H 1" >>confdefs.h -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ +fi -#ifdef __STDC__ -# include -#else -# include -#endif -#undef $ac_func +#-------------------------------------------------------------------- +# The check below checks whether defines the type +# "union wait" correctly. It's needed because of weirdness in +# HP-UX where "union wait" is defined in both the BSD and SYS-V +# environments. Checking the usability of WIFEXITED seems to do +# the trick. +#-------------------------------------------------------------------- -/* 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking union wait" >&5 +$as_echo_n "checking union wait... " >&6; } +if ${tcl_cv_union_wait+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include int main () { -return f != $ac_func; + +union wait x; +WIFEXITED(x); /* Generates compiler error if WIFEXITED + * uses an int. */ + ; 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" +if ac_fn_c_try_link "$LINENO"; then : + tcl_cv_union_wait=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" + tcl_cv_union_wait=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_union_wait" >&5 +$as_echo "$tcl_cv_union_wait" >&6; } +if test $tcl_cv_union_wait = no; then -fi -done +$as_echo "#define NO_UNION_WAIT 1" >>confdefs.h +fi #-------------------------------------------------------------------- -# Check for support of isnan() function or macro +# Check whether there is an strncasecmp function on this system. +# This is a bit tricky because under SCO it's in -lsocket and +# under Sequent Dynix it's in -linet. #-------------------------------------------------------------------- -echo "$as_me:$LINENO: checking isnan" >&5 -echo $ECHO_N "checking isnan... $ECHO_C" >&6 -if test "${tcl_cv_isnan+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +ac_fn_c_check_func "$LINENO" "strncasecmp" "ac_cv_func_strncasecmp" +if test "x$ac_cv_func_strncasecmp" = xyes; then : + tcl_ok=1 else + tcl_ok=0 +fi - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +if test "$tcl_ok" = 0; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strncasecmp in -lsocket" >&5 +$as_echo_n "checking for strncasecmp in -lsocket... " >&6; } +if ${ac_cv_lib_socket_strncasecmp+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char strncasecmp (); int main () { - -isnan(0.0); /* Generates an error if isnan is missing */ - +return strncasecmp (); ; 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_isnan=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_socket_strncasecmp=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_isnan=no + ac_cv_lib_socket_strncasecmp=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $tcl_cv_isnan" >&5 -echo "${ECHO_T}$tcl_cv_isnan" >&6 -if test $tcl_cv_isnan = no; then - -cat >>confdefs.h <<\_ACEOF -#define NO_ISNAN 1 -_ACEOF - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_strncasecmp" >&5 +$as_echo "$ac_cv_lib_socket_strncasecmp" >&6; } +if test "x$ac_cv_lib_socket_strncasecmp" = xyes; then : + tcl_ok=1 +else + tcl_ok=0 fi -#-------------------------------------------------------------------- -# Darwin specific API checks and defines -#-------------------------------------------------------------------- - -if test "`uname -s`" = "Darwin" ; then - -for ac_func in getattrlist -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 +fi +if test "$tcl_ok" = 0; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strncasecmp in -linet" >&5 +$as_echo_n "checking for strncasecmp in -linet... " >&6; } +if ${ac_cv_lib_inet_strncasecmp+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-linet $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i 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 to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#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 +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC 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 -} +extern "C" #endif - +char strncasecmp (); int main () { -return f != $ac_func; +return strncasecmp (); ; 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" +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_inet_strncasecmp=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" + ac_cv_lib_inet_strncasecmp=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS 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 - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_strncasecmp" >&5 +$as_echo "$ac_cv_lib_inet_strncasecmp" >&6; } +if test "x$ac_cv_lib_inet_strncasecmp" = xyes; then : + tcl_ok=1 +else + tcl_ok=0 fi -done +fi +if test "$tcl_ok" = 0; then + case " $LIBOBJS " in + *" strncasecmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strncasecmp.$ac_objext" + ;; +esac -for ac_header in copyfile.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 + USE_COMPAT=1 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 + +#-------------------------------------------------------------------- +# The code below deals with several issues related to gettimeofday: +# 1. Some systems don't provide a gettimeofday function at all +# (set NO_GETTOD if this is the case). +# 2. See if gettimeofday is declared in the header file. +# if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can +# declare it. +#-------------------------------------------------------------------- + +ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" +if test "x$ac_cv_func_gettimeofday" = xyes; then : + else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + +$as_echo "#define NO_GETTOD 1" >>confdefs.h + + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettimeofday declaration" >&5 +$as_echo_n "checking for gettimeofday declaration... " >&6; } +if ${tcl_cv_grep_gettimeofday+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include <$ac_header> +#include + _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 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gettimeofday" >/dev/null 2>&1; then : + tcl_cv_grep_gettimeofday=present else - ac_cpp_err=yes + tcl_cv_grep_gettimeofday=missing 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 +rm -f conftest* - 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_grep_gettimeofday" >&5 +$as_echo "$tcl_cv_grep_gettimeofday" >&6; } +if test $tcl_cv_grep_gettimeofday = missing ; then -# 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 +$as_echo "#define GETTOD_NOT_DECLARED 1" >>confdefs.h + +fi + +#-------------------------------------------------------------------- +# The following code checks to see whether it is possible to get +# signed chars on this platform. This is needed in order to +# properly generate sign-extended ints from character values. +#-------------------------------------------------------------------- + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5 +$as_echo_n "checking whether char is unsigned... " >&6; } +if ${ac_cv_c_char_unsigned+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((char) -1) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_char_unsigned=no else - eval "$as_ac_Header=\$ac_header_preproc" + ac_cv_c_char_unsigned=yes fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5 +$as_echo "$ac_cv_c_char_unsigned" >&6; } +if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then + $as_echo "#define __CHAR_UNSIGNED__ 1" >>confdefs.h fi -done - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking signed char declarations" >&5 +$as_echo_n "checking signed char declarations... " >&6; } +if ${tcl_cv_char_signed+:} false; then : + $as_echo_n "(cached) " >&6 +else -for ac_func in copyfile -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 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i 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 to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#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; + + signed char *p; + p = 0; + ; 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" +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_char_signed=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" + tcl_cv_char_signed=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_char_signed" >&5 +$as_echo "$tcl_cv_char_signed" >&6; } +if test $tcl_cv_char_signed = yes; then + +$as_echo "#define HAVE_SIGNED_CHAR 1" >>confdefs.h fi -done - if test $tcl_corefoundation = yes; then +#-------------------------------------------------------------------- +# Does putenv() copy or not? We need to know to avoid memory leaks. +#-------------------------------------------------------------------- -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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a putenv() that copies the buffer" >&5 +$as_echo_n "checking for a putenv() that copies the buffer... " >&6; } +if ${tcl_cv_putenv_copy+:} false; then : + $as_echo_n "(cached) " >&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 + + if test "$cross_compiling" = yes; then : + tcl_cv_putenv_copy=no else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -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 + #include + #define OURVAR "havecopy=yes" + int main (int argc, char *argv[]) + { + char *foo, *bar; + foo = (char *)strdup(OURVAR); + putenv(foo); + strcpy((char *)(strchr(foo, '=') + 1), "no"); + bar = getenv("havecopy"); + if (!strcmp(bar, "no")) { + /* doesnt copy */ + return 0; + } else { + /* does copy */ + return 1; + } + } -# 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 +if ac_fn_c_try_run "$LINENO"; then : + tcl_cv_putenv_copy=no else - ac_cpp_err=yes + tcl_cv_putenv_copy=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 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_putenv_copy" >&5 +$as_echo "$tcl_cv_putenv_copy" >&6; } +if test $tcl_cv_putenv_copy = yes; then -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF +$as_echo "#define HAVE_PUTENV_THAT_COPIES 1" >>confdefs.h fi -done +#-------------------------------------------------------------------- +# Check for support of nl_langinfo function +#-------------------------------------------------------------------- -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 declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func + # Check whether --enable-langinfo was given. +if test "${enable_langinfo+set}" = set; then : + enableval=$enable_langinfo; langinfo_ok=$enableval +else + langinfo_ok=yes +fi -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ -#ifdef __STDC__ -# include -#else -# include -#endif + HAVE_LANGINFO=0 + if test "$langinfo_ok" = "yes"; then + ac_fn_c_check_header_mongrel "$LINENO" "langinfo.h" "ac_cv_header_langinfo_h" "$ac_includes_default" +if test "x$ac_cv_header_langinfo_h" = xyes; then : + langinfo_ok=yes +else + langinfo_ok=no +fi -#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 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use nl_langinfo" >&5 +$as_echo_n "checking whether to use nl_langinfo... " >&6; } + if test "$langinfo_ok" = "yes"; then + if ${tcl_cv_langinfo_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include int main () { -return f != $ac_func; +nl_langinfo(CODESET); ; 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" +if ac_fn_c_try_compile "$LINENO"; then : + tcl_cv_langinfo_h=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" + tcl_cv_langinfo_h=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext 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 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_langinfo_h" >&5 +$as_echo "$tcl_cv_langinfo_h" >&6; } + if test $tcl_cv_langinfo_h = yes; then + +$as_echo "#define HAVE_LANGINFO 1" >>confdefs.h + + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $langinfo_ok" >&5 +$as_echo "$langinfo_ok" >&6; } + fi + + +#-------------------------------------------------------------------- +# Check for support of chflags and mkstemps functions +#-------------------------------------------------------------------- + +for ac_func in chflags mkstemps +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done - fi -cat >>confdefs.h <<\_ACEOF -#define USE_VFORK 1 -_ACEOF +#-------------------------------------------------------------------- +# Check for support of isnan() function or macro +#-------------------------------------------------------------------- +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking isnan" >&5 +$as_echo_n "checking isnan... " >&6; } +if ${tcl_cv_isnan+:} false; then : + $as_echo_n "(cached) " >&6 +else -cat >>confdefs.h <<\_ACEOF -#define TCL_DEFAULT_ENCODING "utf-8" -_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +isnan(0.0); /* Generates an error if isnan is missing */ -cat >>confdefs.h <<\_ACEOF -#define TCL_LOAD_FROM_MEMORY 1 + ; + return 0; +} _ACEOF +if ac_fn_c_try_link "$LINENO"; then : + tcl_cv_isnan=yes +else + tcl_cv_isnan=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_isnan" >&5 +$as_echo "$tcl_cv_isnan" >&6; } +if test $tcl_cv_isnan = no; then +$as_echo "#define NO_ISNAN 1" >>confdefs.h -cat >>confdefs.h <<\_ACEOF -#define TCL_WIDE_CLICKS 1 -_ACEOF +fi +#-------------------------------------------------------------------- +# Darwin specific API checks and defines +#-------------------------------------------------------------------- + +if test "`uname -s`" = "Darwin" ; then + for ac_func in getattrlist +do : + ac_fn_c_check_func "$LINENO" "getattrlist" "ac_cv_func_getattrlist" +if test "x$ac_cv_func_getattrlist" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GETATTRLIST 1 +_ACEOF -for ac_header in AvailabilityMacros.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. */ +done + + for ac_header in copyfile.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "copyfile.h" "ac_cv_header_copyfile_h" "$ac_includes_default" +if test "x$ac_cv_header_copyfile_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_COPYFILE_H 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> + +fi + +done + + for ac_func in copyfile +do : + ac_fn_c_check_func "$LINENO" "copyfile" "ac_cv_func_copyfile" +if test "x$ac_cv_func_copyfile" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_COPYFILE 1 _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 +done -# 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. */ + if test $tcl_corefoundation = yes; then + for ac_header in libkern/OSAtomic.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libkern/OSAtomic.h" "ac_cv_header_libkern_OSAtomic_h" "$ac_includes_default" +if test "x$ac_cv_header_libkern_OSAtomic_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBKERN_OSATOMIC_H 1 _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> + +fi + +done + + for ac_func in OSSpinLockLock +do : + ac_fn_c_check_func "$LINENO" "OSSpinLockLock" "ac_cv_func_OSSpinLockLock" +if test "x$ac_cv_func_OSSpinLockLock" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OSSPINLOCKLOCK 1 _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 +done + + fi + +$as_echo "#define USE_VFORK 1" >>confdefs.h + + +$as_echo "#define TCL_DEFAULT_ENCODING \"utf-8\"" >>confdefs.h + - 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 +$as_echo "#define TCL_LOAD_FROM_MEMORY 1" >>confdefs.h -# 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 +$as_echo "#define TCL_WIDE_CLICKS 1" >>confdefs.h + + for ac_header in AvailabilityMacros.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "AvailabilityMacros.h" "ac_cv_header_AvailabilityMacros_h" "$ac_includes_default" +if test "x$ac_cv_header_AvailabilityMacros_h" = xyes; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_AVAILABILITYMACROS_H 1 _ACEOF fi @@ -18064,18 +9826,14 @@ fi done if test "$ac_cv_header_AvailabilityMacros_h" = yes; then - echo "$as_me:$LINENO: checking if weak import is available" >&5 -echo $ECHO_N "checking if weak import is available... $ECHO_C" >&6 -if test "${tcl_cv_cc_weak_import+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if weak import is available" >&5 +$as_echo_n "checking if weak import is available... " >&6; } +if ${tcl_cv_cc_weak_import+:} false; then : + $as_echo_n "(cached) " >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ @@ -18095,60 +9853,30 @@ rand(); 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 +if ac_fn_c_try_link "$LINENO"; then : tcl_cv_cc_weak_import=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_cc_weak_import=no + tcl_cv_cc_weak_import=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi -echo "$as_me:$LINENO: result: $tcl_cv_cc_weak_import" >&5 -echo "${ECHO_T}$tcl_cv_cc_weak_import" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_weak_import" >&5 +$as_echo "$tcl_cv_cc_weak_import" >&6; } if test $tcl_cv_cc_weak_import = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_WEAK_IMPORT 1 -_ACEOF +$as_echo "#define HAVE_WEAK_IMPORT 1" >>confdefs.h fi - echo "$as_me:$LINENO: checking if Darwin SUSv3 extensions are available" >&5 -echo $ECHO_N "checking if Darwin SUSv3 extensions are available... $ECHO_C" >&6 -if test "${tcl_cv_cc_darwin_c_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Darwin SUSv3 extensions are available" >&5 +$as_echo_n "checking if Darwin SUSv3 extensions are available... " >&6; } +if ${tcl_cv_cc_darwin_c_source+:} false; then : + $as_echo_n "(cached) " >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ @@ -18169,45 +9897,19 @@ 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 +if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_cc_darwin_c_source=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_cc_darwin_c_source=no + tcl_cv_cc_darwin_c_source=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$hold_cflags fi -echo "$as_me:$LINENO: result: $tcl_cv_cc_darwin_c_source" >&5 -echo "${ECHO_T}$tcl_cv_cc_darwin_c_source" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_darwin_c_source" >&5 +$as_echo "$tcl_cv_cc_darwin_c_source" >&6; } if test $tcl_cv_cc_darwin_c_source = yes; then -cat >>confdefs.h <<\_ACEOF -#define _DARWIN_C_SOURCE 1 -_ACEOF +$as_echo "#define _DARWIN_C_SOURCE 1" >>confdefs.h fi fi @@ -18223,17 +9925,13 @@ fi # Check for support of fts functions (readdir replacement) #-------------------------------------------------------------------- -echo "$as_me:$LINENO: checking for fts" >&5 -echo $ECHO_N "checking for fts... $ECHO_C" >&6 -if test "${tcl_cv_api_fts+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fts" >&5 +$as_echo_n "checking for fts... " >&6; } +if ${tcl_cv_api_fts+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -18252,45 +9950,19 @@ main () 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 +if ac_fn_c_try_link "$LINENO"; then : tcl_cv_api_fts=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_api_fts=no + tcl_cv_api_fts=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_api_fts" >&5 -echo "${ECHO_T}$tcl_cv_api_fts" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_fts" >&5 +$as_echo "$tcl_cv_api_fts" >&6; } if test $tcl_cv_api_fts = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_FTS 1 -_ACEOF +$as_echo "#define HAVE_FTS 1" >>confdefs.h fi @@ -18301,300 +9973,24 @@ fi #-------------------------------------------------------------------- - -for ac_header in sys/ioctl.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 + for ac_header in sys/ioctl.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_ioctl_h" = xyes; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_SYS_IOCTL_H 1 _ACEOF fi done - -for ac_header in sys/filio.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 + for ac_header in sys/filio.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/filio.h" "ac_cv_header_sys_filio_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_filio_h" = xyes; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_SYS_FILIO_H 1 _ACEOF fi @@ -18602,10 +9998,10 @@ fi done - echo "$as_me:$LINENO: checking system version" >&5 -echo $ECHO_N "checking system version... $ECHO_C" >&6 -if test "${tcl_cv_sys_version+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking system version" >&5 +$as_echo_n "checking system version... " >&6; } +if ${tcl_cv_sys_version+:} false; then : + $as_echo_n "(cached) " >&6 else if test -f /usr/lib/NextStep/software_version; then @@ -18613,8 +10009,8 @@ else else tcl_cv_sys_version=`uname -s`-`uname -r` if test "$?" -ne 0 ; then - { echo "$as_me:$LINENO: WARNING: can't find uname command" >&5 -echo "$as_me: WARNING: can't find uname command" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: can't find uname command" >&5 +$as_echo "$as_me: WARNING: can't find uname command" >&2;} tcl_cv_sys_version=unknown else # Special check for weird MP-RAS system (uname returns weird @@ -18630,58 +10026,52 @@ echo "$as_me: WARNING: can't find uname command" >&2;} fi fi -echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5 -echo "${ECHO_T}$tcl_cv_sys_version" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_sys_version" >&5 +$as_echo "$tcl_cv_sys_version" >&6; } system=$tcl_cv_sys_version - echo "$as_me:$LINENO: checking FIONBIO vs. O_NONBLOCK for nonblocking I/O" >&5 -echo $ECHO_N "checking FIONBIO vs. O_NONBLOCK for nonblocking I/O... $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking FIONBIO vs. O_NONBLOCK for nonblocking I/O" >&5 +$as_echo_n "checking FIONBIO vs. O_NONBLOCK for nonblocking I/O... " >&6; } case $system in OSF*) -cat >>confdefs.h <<\_ACEOF -#define USE_FIONBIO 1 -_ACEOF +$as_echo "#define USE_FIONBIO 1" >>confdefs.h - echo "$as_me:$LINENO: result: FIONBIO" >&5 -echo "${ECHO_T}FIONBIO" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: FIONBIO" >&5 +$as_echo "FIONBIO" >&6; } ;; SunOS-4*) -cat >>confdefs.h <<\_ACEOF -#define USE_FIONBIO 1 -_ACEOF +$as_echo "#define USE_FIONBIO 1" >>confdefs.h - echo "$as_me:$LINENO: result: FIONBIO" >&5 -echo "${ECHO_T}FIONBIO" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: FIONBIO" >&5 +$as_echo "FIONBIO" >&6; } ;; *) - echo "$as_me:$LINENO: result: O_NONBLOCK" >&5 -echo "${ECHO_T}O_NONBLOCK" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: O_NONBLOCK" >&5 +$as_echo "O_NONBLOCK" >&6; } ;; esac #------------------------------------------------------------------------ -echo "$as_me:$LINENO: checking whether to use dll unloading" >&5 -echo $ECHO_N "checking whether to use dll unloading... $ECHO_C" >&6 -# 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use dll unloading" >&5 +$as_echo_n "checking whether to use dll unloading... " >&6; } +# Check whether --enable-dll-unloading was given. +if test "${enable_dll_unloading+set}" = set; then : + enableval=$enable_dll_unloading; tcl_ok=$enableval else tcl_ok=yes -fi; +fi + if test $tcl_ok = yes; then -cat >>confdefs.h <<\_ACEOF -#define TCL_UNLOAD_DLLS 1 -_ACEOF +$as_echo "#define TCL_UNLOAD_DLLS 1" >>confdefs.h fi -echo "$as_me:$LINENO: result: $tcl_ok" >&5 -echo "${ECHO_T}$tcl_ok" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_ok" >&5 +$as_echo "$tcl_ok" >&6; } #------------------------------------------------------------------------ # Check whether the timezone data is supplied by the OS or has @@ -18689,31 +10079,31 @@ echo "${ECHO_T}$tcl_ok" >&6 # be overriden on the configure command line either way. #------------------------------------------------------------------------ -echo "$as_me:$LINENO: checking for timezone data" >&5 -echo $ECHO_N "checking for timezone data... $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for timezone data" >&5 +$as_echo_n "checking for timezone data... " >&6; } -# Check whether --with-tzdata or --without-tzdata was given. -if test "${with_tzdata+set}" = set; then - withval="$with_tzdata" - tcl_ok=$withval +# Check whether --with-tzdata was given. +if test "${with_tzdata+set}" = set; then : + withval=$with_tzdata; tcl_ok=$withval else tcl_ok=auto -fi; +fi + # # Any directories that get added here must also be added to the # search path in ::tcl::clock::Initialize (library/clock.tcl). # case $tcl_ok in no) - echo "$as_me:$LINENO: result: supplied by OS vendor" >&5 -echo "${ECHO_T}supplied by OS vendor" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: supplied by OS vendor" >&5 +$as_echo "supplied by OS vendor" >&6; } ;; yes) # nothing to do here ;; auto*) - if test "${tcl_cv_dir_zoneinfo+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if ${tcl_cv_dir_zoneinfo+:} false; then : + $as_echo_n "(cached) " >&6 else for dir in /usr/share/zoneinfo \ @@ -18730,22 +10120,20 @@ fi if test -n "$tcl_cv_dir_zoneinfo"; then tcl_ok=no - echo "$as_me:$LINENO: result: $dir" >&5 -echo "${ECHO_T}$dir" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dir" >&5 +$as_echo "$dir" >&6; } else tcl_ok=yes fi ;; *) - { { echo "$as_me:$LINENO: error: invalid argument: $tcl_ok" >&5 -echo "$as_me: error: invalid argument: $tcl_ok" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "invalid argument: $tcl_ok" "$LINENO" 5 ;; esac if test $tcl_ok = yes then - echo "$as_me:$LINENO: result: supplied by Tcl" >&5 -echo "${ECHO_T}supplied by Tcl" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: supplied by Tcl" >&5 +$as_echo "supplied by Tcl" >&6; } INSTALL_TZDATA=install-tzdata fi @@ -18753,152 +10141,16 @@ fi # DTrace support #-------------------------------------------------------------------- -# Check whether --enable-dtrace or --disable-dtrace was given. -if test "${enable_dtrace+set}" = set; then - enableval="$enable_dtrace" - tcl_ok=$enableval +# Check whether --enable-dtrace was given. +if test "${enable_dtrace+set}" = set; then : + enableval=$enable_dtrace; tcl_ok=$enableval else tcl_ok=no -fi; -if test $tcl_ok = yes; then - if test "${ac_cv_header_sys_sdt_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/sdt.h" >&5 -echo $ECHO_N "checking for sys/sdt.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_sdt_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_sdt_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_sdt_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking sys/sdt.h usability" >&5 -echo $ECHO_N "checking sys/sdt.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 -_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 sys/sdt.h presence" >&5 -echo $ECHO_N "checking sys/sdt.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 -_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: sys/sdt.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: sys/sdt.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/sdt.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: sys/sdt.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: sys/sdt.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: sys/sdt.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/sdt.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: sys/sdt.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/sdt.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: sys/sdt.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/sdt.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: sys/sdt.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/sdt.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: sys/sdt.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: sys/sdt.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: sys/sdt.h: 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 sys/sdt.h" >&5 -echo $ECHO_N "checking for sys/sdt.h... $ECHO_C" >&6 -if test "${ac_cv_header_sys_sdt_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_sys_sdt_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_sdt_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_sdt_h" >&6 -fi -if test $ac_cv_header_sys_sdt_h = yes; then +if test $tcl_ok = yes; then + ac_fn_c_check_header_mongrel "$LINENO" "sys/sdt.h" "ac_cv_header_sys_sdt_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_sdt_h" = xyes; then : tcl_ok=yes else tcl_ok=no @@ -18909,10 +10161,10 @@ fi if test $tcl_ok = yes; then # Extract the first word of "dtrace", so it can be a program name with args. set dummy dtrace; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_DTRACE+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DTRACE+:} false; then : + $as_echo_n "(cached) " >&6 else case $DTRACE in [\\/]* | ?:[\\/]*) @@ -18925,38 +10177,37 @@ for as_dir in $as_dummy do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DTRACE="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done +IFS=$as_save_IFS ;; esac fi DTRACE=$ac_cv_path_DTRACE - if test -n "$DTRACE"; then - echo "$as_me:$LINENO: result: $DTRACE" >&5 -echo "${ECHO_T}$DTRACE" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DTRACE" >&5 +$as_echo "$DTRACE" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + test -z "$ac_cv_path_DTRACE" && tcl_ok=no fi -echo "$as_me:$LINENO: checking whether to enable DTrace support" >&5 -echo $ECHO_N "checking whether to enable DTrace support... $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable DTrace support" >&5 +$as_echo_n "checking whether to enable DTrace support... " >&6; } MAKEFILE_SHELL='/bin/sh' if test $tcl_ok = yes; then -cat >>confdefs.h <<\_ACEOF -#define USE_DTRACE 1 -_ACEOF +$as_echo "#define USE_DTRACE 1" >>confdefs.h DTRACE_SRC="\${DTRACE_SRC}" DTRACE_HDR="\${DTRACE_HDR}" @@ -18974,24 +10225,20 @@ _ACEOF fi fi fi -echo "$as_me:$LINENO: result: $tcl_ok" >&5 -echo "${ECHO_T}$tcl_ok" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_ok" >&5 +$as_echo "$tcl_ok" >&6; } #-------------------------------------------------------------------- # The check below checks whether the cpuid instruction is usable. #-------------------------------------------------------------------- -echo "$as_me:$LINENO: checking whether the cpuid instruction is usable" >&5 -echo $ECHO_N "checking whether the cpuid instruction is usable... $ECHO_C" >&6 -if test "${tcl_cv_cpuid+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cpuid instruction is usable" >&5 +$as_echo_n "checking whether the cpuid instruction is usable... " >&6; } +if ${tcl_cv_cpuid+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -19010,45 +10257,19 @@ main () 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 +if ac_fn_c_try_link "$LINENO"; then : tcl_cv_cpuid=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -tcl_cv_cpuid=no + tcl_cv_cpuid=no fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $tcl_cv_cpuid" >&5 -echo "${ECHO_T}$tcl_cv_cpuid" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cpuid" >&5 +$as_echo "$tcl_cv_cpuid" >&6; } if test $tcl_cv_cpuid = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_CPUID 1 -_ACEOF +$as_echo "#define HAVE_CPUID 1" >>confdefs.h fi @@ -19067,6 +10288,10 @@ eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}" eval "TCL_LIB_FILE=${TCL_LIB_FILE}" +eval "TCL_KIT_LIB_FILE=libtclkit${UNSHARED_LIB_SUFFIX}" +eval "TCL_KIT_LIB_FILE=${TCL_KIT_LIB_FILE}" + + TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)' PRIVATE_INCLUDE_DIR='$(includedir)' HTML_DIR='$(DISTDIR)/html' @@ -19079,38 +10304,38 @@ HTML_DIR='$(DISTDIR)/html' if test "`uname -s`" = "Darwin" ; then 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" - enable_framework=$enableval + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to package libraries" >&5 +$as_echo_n "checking how to package libraries... " >&6; } + # Check whether --enable-framework was given. +if test "${enable_framework+set}" = set; then : + enableval=$enable_framework; enable_framework=$enableval else enable_framework=no -fi; +fi + if test $enable_framework = yes; then 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;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Frameworks can only be built if --enable-shared is yes" >&5 +$as_echo "$as_me: WARNING: Frameworks can only be built if --enable-shared is yes" >&2;} enable_framework=no 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;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Frameworks can only be used when CoreFoundation is available" >&5 +$as_echo "$as_me: WARNING: Frameworks can only be used when CoreFoundation is available" >&2;} enable_framework=no fi fi if test $enable_framework = yes; then - echo "$as_me:$LINENO: result: framework" >&5 -echo "${ECHO_T}framework" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: framework" >&5 +$as_echo "framework" >&6; } FRAMEWORK_BUILD=1 else if test $SHARED_BUILD = 1; then - echo "$as_me:$LINENO: result: shared library" >&5 -echo "${ECHO_T}shared library" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: shared library" >&5 +$as_echo "shared library" >&6; } else - echo "$as_me:$LINENO: result: static library" >&5 -echo "${ECHO_T}static library" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: static library" >&5 +$as_echo "static library" >&6; } fi FRAMEWORK_BUILD=0 fi @@ -19122,20 +10347,18 @@ echo "${ECHO_T}static library" >&6 TCL_SHLIB_LD_EXTRAS="${TCL_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tcl-Info.plist' EXTRA_TCLSH_LIBS='-sectcreate __TEXT __info_plist Tclsh-Info.plist' EXTRA_APP_CC_SWITCHES='-mdynamic-no-pic' - ac_config_files="$ac_config_files Tcl-Info.plist:../macosx/Tcl-Info.plist.in Tclsh-Info.plist:../macosx/Tclsh-Info.plist.in" + ac_config_files="$ac_config_files Tcl-Info.plist:../macosx/Tcl-Info.plist.in Tclsh-Info.plist:../macosx/Tclsh-Info.plist.in" TCL_YEAR="`date +%Y`" fi if test "$FRAMEWORK_BUILD" = "1" ; then -cat >>confdefs.h <<\_ACEOF -#define TCL_FRAMEWORK 1 -_ACEOF +$as_echo "#define TCL_FRAMEWORK 1" >>confdefs.h # 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" + ac_config_commands="$ac_config_commands Tcl.framework" LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH" # default install directory for bundled packages @@ -19295,7 +10518,8 @@ TCL_SHARED_BUILD=${SHARED_BUILD} - ac_config_files="$ac_config_files Makefile:../unix/Makefile.in dltest/Makefile:../unix/dltest/Makefile.in tclConfig.sh:../unix/tclConfig.sh.in tcl.pc:../unix/tcl.pc.in" + +ac_config_files="$ac_config_files Makefile:../unix/Makefile.in dltest/Makefile:../unix/dltest/Makefile.in tclConfig.sh:../unix/tclConfig.sh.in tcl.pc:../unix/tcl.pc.in" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -19315,39 +10539,70 @@ _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. +# So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -{ +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (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 \). + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}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" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} | + esac | + sort +) | sed ' + /^ac_cv_env_/b end t clear - : clear + :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else - echo "not updating unwritable cache $cache_file" + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -19356,63 +10611,56 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. 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, +# take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +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 -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS="" -: ${CONFIG_STATUS=./config.status} + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -19422,81 +10670,253 @@ cat >$CONFIG_STATUS <<_ACEOF debug=false ac_cs_recheck=false ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +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 + # Pre-4.2 versions of Zsh do 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 + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac 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 + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done 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 +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi -done + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` - -# PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -19504,148 +10924,111 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file else - as_expr=false + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi -rm -f conf$$ conf$$.exe conf$$.file +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + +} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_executable_p="test -f" + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # 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'" @@ -19654,31 +11037,20 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" 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" - -# CDPATH. -$as_unset CDPATH - exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - +# values after options handling. +ac_log=" This file was extended by tcl $as_me 8.6, which was -generated by GNU Autoconf 2.59. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -19686,43 +11058,41 @@ generated by GNU Autoconf 2.59. Invocation command line was CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + _ACEOF -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_commands="$ac_config_commands" -cat >>$CONFIG_STATUS <<\_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. -Usage: $0 [OPTIONS] [FILE]... +Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + 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 + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE Configuration files: $config_files @@ -19730,83 +11100,78 @@ $config_files Configuration commands: $config_commands -Report bugs to ." -_ACEOF +Report bugs to the package provider." -cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ tcl config.status 8.6 -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2012 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 + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= ac_shift=: ;; - -*) + *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; esac case $ac_option in # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; - *) ac_config_targets="$ac_config_targets $1" ;; + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; esac shift @@ -19820,43 +11185,55 @@ if $ac_cs_silent; then fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 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 + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" fi _ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 -cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # -# INIT-COMMANDS section. +# INIT-COMMANDS # - VERSION=${TCL_VERSION} _ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF +# Handling of arguments. 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" ;; - "Tclsh-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Tclsh-Info.plist:../macosx/Tclsh-Info.plist.in" ;; - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile:../unix/Makefile.in" ;; - "dltest/Makefile" ) CONFIG_FILES="$CONFIG_FILES dltest/Makefile:../unix/dltest/Makefile.in" ;; - "tclConfig.sh" ) CONFIG_FILES="$CONFIG_FILES tclConfig.sh:../unix/tclConfig.sh.in" ;; - "tcl.pc" ) CONFIG_FILES="$CONFIG_FILES tcl.pc:../unix/tcl.pc.in" ;; - "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; }; };; + case $ac_config_target in + "Tcl-Info.plist") CONFIG_FILES="$CONFIG_FILES Tcl-Info.plist:../macosx/Tcl-Info.plist.in" ;; + "Tclsh-Info.plist") CONFIG_FILES="$CONFIG_FILES Tclsh-Info.plist:../macosx/Tclsh-Info.plist.in" ;; + "Tcl.framework") CONFIG_COMMANDS="$CONFIG_COMMANDS Tcl.framework" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:../unix/Makefile.in" ;; + "dltest/Makefile") CONFIG_FILES="$CONFIG_FILES dltest/Makefile:../unix/dltest/Makefile.in" ;; + "tclConfig.sh") CONFIG_FILES="$CONFIG_FILES tclConfig.sh:../unix/tclConfig.sh.in" ;; + "tcl.pc") CONFIG_FILES="$CONFIG_FILES tcl.pc:../unix/tcl.pc.in" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; 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 @@ -19867,533 +11244,427 @@ if $ac_need_defaults; then 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, +# simply because there is no reason against having 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. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. $debug || { - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 } - # Create a (secure) tmp directory for tmp files. { - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" } || { - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + { - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi -# -# CONFIG_FILES section. -# +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@MAN_FLAGS@,$MAN_FLAGS,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@TCL_THREADS@,$TCL_THREADS,;t t -s,@TCLSH_PROG@,$TCLSH_PROG,;t t -s,@ZLIB_OBJS@,$ZLIB_OBJS,;t t -s,@ZLIB_SRCS@,$ZLIB_SRCS,;t t -s,@ZLIB_INCLUDE@,$ZLIB_INCLUDE,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@AR@,$AR,;t t -s,@ac_ct_AR@,$ac_ct_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,@LDAIX_SRC@,$LDAIX_SRC,;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 -s,@STLIB_LD@,$STLIB_LD,;t t -s,@SHLIB_LD@,$SHLIB_LD,;t t -s,@TCL_SHLIB_LD_EXTRAS@,$TCL_SHLIB_LD_EXTRAS,;t t -s,@TK_SHLIB_LD_EXTRAS@,$TK_SHLIB_LD_EXTRAS,;t t -s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t -s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t -s,@SHLIB_SUFFIX@,$SHLIB_SUFFIX,;t t -s,@MAKE_LIB@,$MAKE_LIB,;t t -s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t -s,@INSTALL_LIB@,$INSTALL_LIB,;t t -s,@DLL_INSTALL_DIR@,$DLL_INSTALL_DIR,;t t -s,@INSTALL_STUB_LIB@,$INSTALL_STUB_LIB,;t t -s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t -s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t -s,@DTRACE@,$DTRACE,;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,@PKG_CFG_ARGS@,$PKG_CFG_ARGS,;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 -s,@TCL_INCLUDE_SPEC@,$TCL_INCLUDE_SPEC,;t t -s,@TCL_BUILD_STUB_LIB_SPEC@,$TCL_BUILD_STUB_LIB_SPEC,;t t -s,@TCL_BUILD_STUB_LIB_PATH@,$TCL_BUILD_STUB_LIB_PATH,;t t -s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t -s,@CFG_TCL_SHARED_LIB_SUFFIX@,$CFG_TCL_SHARED_LIB_SUFFIX,;t t -s,@CFG_TCL_UNSHARED_LIB_SUFFIX@,$CFG_TCL_UNSHARED_LIB_SUFFIX,;t t -s,@TCL_SHARED_BUILD@,$TCL_SHARED_BUILD,;t t -s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t -s,@TCL_BUILD_LIB_SPEC@,$TCL_BUILD_LIB_SPEC,;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,@INSTALL_TZDATA@,$INSTALL_TZDATA,;t t -s,@DTRACE_SRC@,$DTRACE_SRC,;t t -s,@DTRACE_HDR@,$DTRACE_HDR,;t t -s,@DTRACE_OBJ@,$DTRACE_OBJ,;t t -s,@MAKEFILE_SHELL@,$MAKEFILE_SHELL,;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,@PACKAGE_DIR@,$PACKAGE_DIR,;t t -s,@EXTRA_CC_SWITCHES@,$EXTRA_CC_SWITCHES,;t t -s,@EXTRA_APP_CC_SWITCHES@,$EXTRA_APP_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 -s,@EXTRA_TCLSH_LIBS@,$EXTRA_TCLSH_LIBS,;t t -s,@DLTEST_LD@,$DLTEST_LD,;t t -s,@DLTEST_SUFFIX@,$DLTEST_SUFFIX,;t t -CEOF -_ACEOF +eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift - 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. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # 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` + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # 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. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac -_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 ;; + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; esac - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || + ac_dir=`$as_dirname -- "$ac_file" || $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 - 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; }; }; } - + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p 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 "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # 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_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. 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;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; 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;; +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; 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 + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub $extrasub _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - 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 +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; -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 + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + 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 && + case $ac_file$ac_mode in + "Tcl.framework":C) 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 +done # for ac_tag -cat >>$CONFIG_STATUS <<\_ACEOF -{ (exit 0); exit 0; } +as_fn_exit 0 _ACEOF -chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -20413,7 +11684,11 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi diff --git a/unix/configure.in b/unix/configure.in index 85bd7ee..7a15fb7 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -793,6 +793,10 @@ eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}" eval "TCL_LIB_FILE=${TCL_LIB_FILE}" +eval "TCL_KIT_LIB_FILE=libtclkit${UNSHARED_LIB_SUFFIX}" +eval "TCL_KIT_LIB_FILE=${TCL_KIT_LIB_FILE}" + + TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)' PRIVATE_INCLUDE_DIR='$(includedir)' HTML_DIR='$(DISTDIR)/html' @@ -937,6 +941,7 @@ AC_SUBST(TCL_STUB_LIB_FILE) AC_SUBST(TCL_STUB_LIB_FLAG) AC_SUBST(TCL_STUB_LIB_SPEC) AC_SUBST(TCL_STUB_LIB_PATH) +AC_SUBST(TCL_KIT_LIB_FILE) AC_SUBST(TCL_INCLUDE_SPEC) AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) AC_SUBST(TCL_BUILD_STUB_LIB_PATH) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 3ca65d8..88f2b81 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2060,6 +2060,14 @@ dnl # preprocessing tests use only CPPFLAGS. ]) ]) + AS_IF([test "$RANLIB" = ""], [ + MAKE_KIT_LIB='$(STLIB_LD) [$]@ ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS}' + INSTALL_KIT_LIB='$(INSTALL_LIBRARY) $(TCL_KIT_LIB_FILE) "$(LIB_INSTALL_DIR)/$(TCL_KIT_LIB_FILE)"' + ], [ + MAKE_KIT_LIB='${STLIB_LD} [$]@ ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} ; ${RANLIB} [$]@' + INSTALL_KIT_LIB='$(INSTALL_LIBRARY) $(TCL_KIT_LIB_FILE) "$(LIB_INSTALL_DIR)/$(TCL_KIT_LIB_FILE)" ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(TCL_KIT_LIB_FILE))' + ]) + # Stub lib does not depend on shared/static configuration AS_IF([test "$RANLIB" = ""], [ MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}' @@ -2126,10 +2134,12 @@ dnl # preprocessing tests use only CPPFLAGS. [What is the default extension for shared libraries?]) AC_SUBST(MAKE_LIB) + AC_SUBST(MAKE_KIT_LIB) AC_SUBST(MAKE_STUB_LIB) AC_SUBST(INSTALL_LIB) AC_SUBST(DLL_INSTALL_DIR) AC_SUBST(INSTALL_STUB_LIB) + AC_SUBST(INSTALL_KIT_LIB) AC_SUBST(RANLIB) ]) -- cgit v0.12 From ab35383fda8fe297152230b0f3778eb992d015d7 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 9 Sep 2014 13:59:09 +0000 Subject: Add Static library link instructions to tclConfig.sh --- unix/Makefile.in | 6 ------ unix/configure | 46 +++++++++++++++++++++++++++++++++++++++------- unix/configure.in | 41 ++++++++++++++++++++++++++++++++++------- unix/tclConfig.sh.in | 28 ++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 20 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 7d9b82d..c66cc0a 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -649,12 +649,6 @@ ${TCL_KIT_LIB_FILE}: ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} rm -f $@ @MAKE_KIT_LIB@ - #${SHLIB_LD} $@ ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} ; ${RANLIB} $@ - #${CC} ${CFLAGS} ${LDFLAGS} \ - # ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} \ - # ${CC_SEARCH_FLAGS} -o ${TCL_KIT_LIB_FILE} - - # Make target which outputs the list of the .o contained in the Tcl lib useful # to build a single big shared library containing Tcl and other extensions. # Used for the Tcl Plugin. -- dl diff --git a/unix/configure b/unix/configure index 2740498..a5f318e 100755 --- a/unix/configure +++ b/unix/configure @@ -642,20 +642,25 @@ TCL_HAS_LONGLONG TCL_UNSHARED_LIB_SUFFIX TCL_SHARED_LIB_SUFFIX TCL_LIB_VERSIONS_OK -TCL_BUILD_LIB_SPEC LD_LIBRARY_PATH_VAR TCL_SHARED_BUILD CFG_TCL_UNSHARED_LIB_SUFFIX CFG_TCL_SHARED_LIB_SUFFIX TCL_SRC_DIR -TCL_BUILD_STUB_LIB_PATH -TCL_BUILD_STUB_LIB_SPEC TCL_INCLUDE_SPEC +TCL_BUILD_KIT_LIB_PATH +TCL_BUILD_KIT_LIB_SPEC +TCL_KIT_LIB_PATH +TCL_KIT_LIB_SPEC +TCL_KIT_LIB_FLAG TCL_KIT_LIB_FILE +TCL_BUILD_STUB_LIB_PATH +TCL_BUILD_STUB_LIB_SPEC TCL_STUB_LIB_PATH TCL_STUB_LIB_SPEC TCL_STUB_LIB_FLAG TCL_STUB_LIB_FILE +TCL_BUILD_LIB_SPEC TCL_LIB_SPEC TCL_LIB_FLAG TCL_LIB_FILE @@ -10288,10 +10293,6 @@ eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}" eval "TCL_LIB_FILE=${TCL_LIB_FILE}" -eval "TCL_KIT_LIB_FILE=libtclkit${UNSHARED_LIB_SUFFIX}" -eval "TCL_KIT_LIB_FILE=${TCL_KIT_LIB_FILE}" - - TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)' PRIVATE_INCLUDE_DIR='$(includedir)' HTML_DIR='$(DISTDIR)/html' @@ -10428,6 +10429,29 @@ fi #-------------------------------------------------------------------- # The statements below define various symbols relating to Tcl +# core vfs and kit support. +#-------------------------------------------------------------------- + +eval "TCL_KIT_LIB_FILE=libtclkit${UNSHARED_LIB_SUFFIX}" +eval "TCL_KIT_LIB_FILE=${TCL_KIT_LIB_FILE}" + +eval "TCL_KIT_LIB_FILE=libtclkit${TCL_UNSHARED_LIB_SUFFIX}" +eval "TCL_KIT_LIB_FILE=\"${TCL_KIT_LIB_FILE}\"" +eval "TCL_KIT_LIB_DIR=${libdir}" + +if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then + TCL_KIT_LIB_FLAG="-ltclkit${TCL_VERSION}" +else + TCL_KIT_LIB_FLAG="-ltclkit`echo ${TCL_VERSION} | tr -d .`" +fi + +TCL_BUILD_KIT_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TCL_KIT_LIB_FLAG}" +TCL_KIT_LIB_SPEC="-L${TCL_KIT_LIB_DIR} ${TCL_KIT_LIB_FLAG}" +TCL_BUILD_KIT_LIB_PATH="`pwd`/${TCL_KIT_LIB_FILE}" +TCL_KIT_LIB_PATH="${TCL_KIT_LIB_DIR}/${TCL_KIT_LIB_FILE}" + +#-------------------------------------------------------------------- +# The statements below define various symbols relating to Tcl # stub support. #-------------------------------------------------------------------- @@ -10519,6 +10543,14 @@ TCL_SHARED_BUILD=${SHARED_BUILD} + + + + + + + + ac_config_files="$ac_config_files Makefile:../unix/Makefile.in dltest/Makefile:../unix/dltest/Makefile.in tclConfig.sh:../unix/tclConfig.sh.in tcl.pc:../unix/tcl.pc.in" cat >confcache <<\_ACEOF diff --git a/unix/configure.in b/unix/configure.in index 7a15fb7..bc7bdef 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -793,10 +793,6 @@ eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}" eval "TCL_LIB_FILE=${TCL_LIB_FILE}" -eval "TCL_KIT_LIB_FILE=libtclkit${UNSHARED_LIB_SUFFIX}" -eval "TCL_KIT_LIB_FILE=${TCL_KIT_LIB_FILE}" - - TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)' PRIVATE_INCLUDE_DIR='$(includedir)' HTML_DIR='$(DISTDIR)/html' @@ -897,6 +893,29 @@ fi #-------------------------------------------------------------------- # The statements below define various symbols relating to Tcl +# core vfs and kit support. +#-------------------------------------------------------------------- + +eval "TCL_KIT_LIB_FILE=libtclkit${UNSHARED_LIB_SUFFIX}" +eval "TCL_KIT_LIB_FILE=${TCL_KIT_LIB_FILE}" + +eval "TCL_KIT_LIB_FILE=libtclkit${TCL_UNSHARED_LIB_SUFFIX}" +eval "TCL_KIT_LIB_FILE=\"${TCL_KIT_LIB_FILE}\"" +eval "TCL_KIT_LIB_DIR=${libdir}" + +if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then + TCL_KIT_LIB_FLAG="-ltclkit${TCL_VERSION}" +else + TCL_KIT_LIB_FLAG="-ltclkit`echo ${TCL_VERSION} | tr -d .`" +fi + +TCL_BUILD_KIT_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TCL_KIT_LIB_FLAG}" +TCL_KIT_LIB_SPEC="-L${TCL_KIT_LIB_DIR} ${TCL_KIT_LIB_FLAG}" +TCL_BUILD_KIT_LIB_PATH="`pwd`/${TCL_KIT_LIB_FILE}" +TCL_KIT_LIB_PATH="${TCL_KIT_LIB_DIR}/${TCL_KIT_LIB_FILE}" + +#-------------------------------------------------------------------- +# The statements below define various symbols relating to Tcl # stub support. #-------------------------------------------------------------------- @@ -937,15 +956,24 @@ AC_SUBST(PKG_CFG_ARGS) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_LIB_SPEC) +AC_SUBST(TCL_BUILD_LIB_SPEC) + AC_SUBST(TCL_STUB_LIB_FILE) AC_SUBST(TCL_STUB_LIB_FLAG) AC_SUBST(TCL_STUB_LIB_SPEC) AC_SUBST(TCL_STUB_LIB_PATH) -AC_SUBST(TCL_KIT_LIB_FILE) -AC_SUBST(TCL_INCLUDE_SPEC) AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) AC_SUBST(TCL_BUILD_STUB_LIB_PATH) +AC_SUBST(TCL_KIT_LIB_FILE) +AC_SUBST(TCL_KIT_LIB_FLAG) +AC_SUBST(TCL_KIT_LIB_SPEC) +AC_SUBST(TCL_KIT_LIB_PATH) +AC_SUBST(TCL_BUILD_KIT_LIB_SPEC) +AC_SUBST(TCL_BUILD_KIT_LIB_PATH) + +AC_SUBST(TCL_INCLUDE_SPEC) + AC_SUBST(TCL_SRC_DIR) AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX) AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX) @@ -953,7 +981,6 @@ AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX) AC_SUBST(TCL_SHARED_BUILD) AC_SUBST(LD_LIBRARY_PATH_VAR) -AC_SUBST(TCL_BUILD_LIB_SPEC) AC_SUBST(TCL_LIB_VERSIONS_OK) AC_SUBST(TCL_SHARED_LIB_SUFFIX) diff --git a/unix/tclConfig.sh.in b/unix/tclConfig.sh.in index b58e9fd..976bd7f 100644 --- a/unix/tclConfig.sh.in +++ b/unix/tclConfig.sh.in @@ -39,6 +39,9 @@ TCL_SHARED_BUILD=@TCL_SHARED_BUILD@ # The name of the Tcl library (may be either a .a file or a shared library): TCL_LIB_FILE='@TCL_LIB_FILE@' +# The name of the static Tcl library (intended for kits): +TCL_KIT_LIB_FILE='@TCL_KIT_LIB_FILE@' + # Additional libraries to use when linking Tcl. TCL_LIBS='@TCL_LIBS@' @@ -142,6 +145,31 @@ TCL_SRC_DIR='@TCL_SRC_DIR@' # the "exec_prefix" directory, if it is different. TCL_PACKAGE_PATH='@TCL_PACKAGE_PATH@' +# Core VFS Kit Support +TCL_SUPPORT_KITS=1 + +# The name of the Tcl kit library (.a): +TCL_KIT_LIB_FILE='@TCL_KIT_LIB_FILE@' + +# -l flag to pass to the linker to pick up the Tcl kit library +TCL_KIT_LIB_FLAG='@TCL_KIT_LIB_FLAG@' + +# String to pass to linker to pick up the Tcl kit library from its +# build directory. +TCL_BUILD_KIT_LIB_SPEC='@TCL_BUILD_KIT_LIB_SPEC@' + +# String to pass to linker to pick up the Tcl kit library from its +# installed directory. +TCL_KIT_LIB_SPEC='@TCL_KIT_LIB_SPEC@' + +# Path to the Tcl kit library in the build directory. +TCL_BUILD_KIT_LIB_PATH='@TCL_BUILD_KIT_LIB_PATH@' + +# Path to the Tcl kit library in the install directory. +TCL_KIT_LIB_PATH='@TCL_KIT_LIB_PATH@' + +# END VFS SUPPORT + # Tcl supports stub. TCL_SUPPORTS_STUBS=1 -- cgit v0.12 From 627a5bfa7394225c69b765ba58c42fc7850a8157 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 9 Sep 2014 14:47:12 +0000 Subject: Instead of statically link the tclkit executable, pack the tcl dll in the VFS --- tools/mkVfs.tcl | 16 +++++++++++----- unix/Makefile.in | 21 +++++++++++++-------- win/Makefile.in | 2 +- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/tools/mkVfs.tcl b/tools/mkVfs.tcl index c7bf17b..c796f8a 100644 --- a/tools/mkVfs.tcl +++ b/tools/mkVfs.tcl @@ -53,14 +53,20 @@ proc copyDir {d1 d2} { } } -if {[llength $argv] < 3} { - puts "Usage: VFS_ROOT TCLSRC_ROOT PLATFORM" +if {[llength $argv] < 4} { + puts "Usage: VFS_ROOT TCLSRC_ROOT PLATFORM TCLDLL" exit 1 } -set TCL_SCRIPT_DIR [lindex $argv 0] -set TCLSRC_ROOT [lindex $argv 1] -set PLATFORM [lindex $argv 2] +set VFSROOT [lindex $argv 0] +set VERSION [lindex $argv 1] +set TCLSRC_ROOT [lindex $argv 2] +set PLATFORM [lindex $argv 3] +set TCLDLL [lindex $argv 4] +file mkdir [file join $VFSROOT bin] +file copy -force $TCLDLL [file join $VFSROOT bin $TCLDLL] + +set TCL_SCRIPT_DIR [file join $VFSROOT tcl$VERSION] puts "Building [file tail $TCL_SCRIPT_DIR] for $PLATFORM" copyDir ${TCLSRC_ROOT}/library ${TCL_SCRIPT_DIR} diff --git a/unix/Makefile.in b/unix/Makefile.in index 30e7109..bce12bd 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -588,6 +588,8 @@ MAC_OSX_SRCS = \ CYGWIN_SRCS = \ $(TOP_DIR)/win/tclWinError.c +TCLKIT_SRCS = $(UNIX_DIR)/tclKitInit.c + DTRACE_HDR = tclDTrace.h DTRACE_SRC = $(GENERIC_DIR)/tclDTrace.d @@ -610,7 +612,7 @@ ZLIB_SRCS = \ # things like "make depend". SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \ - $(OO_SRCS) $(STUB_SRCS) @PLAT_SRCS@ @ZLIB_SRCS@ + $(OO_SRCS) $(STUB_SRCS) @PLAT_SRCS@ @ZLIB_SRCS@ $TCLKIT_SRCS PWD=`pwd` VFS_INSTALL_DIR=${PWD}/tclkit.vfs/tcl8.6 @@ -665,18 +667,18 @@ null.zip: # Rather than force an install, pack the files we need into a # file system under our control tclkit.vfs: - make install-libraries DESTDIR=tclkit.vfs - make install-tzdata DESTDIR=tclkit.vfs - make install-packages DESTDIR=tclkit.vfs + @echo "Building VFS File system in tclkit.vfs" + @$(TCL_EXE) "$(TOP_DIR)/tools/mkVfs.tcl" \ + "$(UNIX_DIR)/tclkit.vfs" "$(VERSION)" "$(TOP_DIR)" unix ${TCL_LIB_FILE} # Assemble all of the tcl sources into a single executable -${TCLKIT_EXE}: ${TCLKIT_OBJS} ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} null.zip tclkit.vfs +${TCLKIT_EXE}: ${TCL_EXE} $(TCLKIT_OBJS) ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} ${ZLIB_OBJS} null.zip tclkit.vfs ${CC} ${CFLAGS} ${LDFLAGS} \ - ${TCLKIT_OBJS} ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} \ - ${LIBS} @EXTRA_TCLSH_LIBS@ \ + $(TCLKIT_OBJS) ${ZLIB_OBJS} \ + @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} cat null.zip >> ${TCLKIT_EXE} - cd tclkit.vfs${prefix}/lib ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . + cd tclkit.vfs ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in $(SHELL) config.status @@ -1195,6 +1197,9 @@ tclIORChan.o: $(GENERIC_DIR)/tclIORChan.c $(IOHDR) tclIORTrans.o: $(GENERIC_DIR)/tclIORTrans.c $(IOHDR) $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclIORTrans.c +tclKitInit.o: $(UNIX_DIR)/tclKitInit.c + $(CC) -c $(APP_CC_SWITCHES) $(UNIX_DIR)/tclKitInit.c + tclLink.o: $(GENERIC_DIR)/tclLink.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclLink.c diff --git a/win/Makefile.in b/win/Makefile.in index ec824cc..bf3e303 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -443,7 +443,7 @@ null.zip: tclkit.vfs: $(TCLSH) $(DDE_DLL_FILE) $(REG_DLL_FILE) @echo "Building VFS File system in tclkit.vfs" @$(TCL_EXE) "$(ROOT_DIR)/tools/mkVfs.tcl" \ - "$(WIN_DIR)/tclkit.vfs/tcl$(VERSION)" "$(ROOT_DIR)" windows + "$(WIN_DIR)/tclkit.vfs" "$(VERSION)" "$(ROOT_DIR)" windows $(TCL_LIB_FILE) $(TCLKIT): $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs $(CC) $(CFLAGS) -DSTATIC_BUILD -UUSE_STUBS $(TCLKIT_OBJS) $(LIBS) \ -- cgit v0.12 From 39145d45d1ef517387a8247804f7ccb8fa811174 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 9 Sep 2014 15:02:11 +0000 Subject: Add tclkit to "make all" and install --- unix/Makefile.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index bce12bd..c5c3fa6 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -623,7 +623,7 @@ VFS_INSTALL_DIR=${PWD}/tclkit.vfs/tcl8.6 all: binaries libraries doc packages -binaries: ${LIB_FILE} ${TCL_EXE} +binaries: ${LIB_FILE} ${TCL_EXE} ${TCLKIT_EXE} libraries: @@ -677,6 +677,7 @@ ${TCLKIT_EXE}: ${TCL_EXE} $(TCLKIT_OBJS) ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} $ $(TCLKIT_OBJS) ${ZLIB_OBJS} \ @TCL_BUILD_LIB_SPEC@ ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} + cp -f ${TCLKIT_EXE} ${TCLKIT_EXE}.raw cat null.zip >> ${TCLKIT_EXE} cd tclkit.vfs ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . @@ -833,6 +834,8 @@ install-binaries: binaries @chmod 555 "$(DLL_INSTALL_DIR)/$(LIB_FILE)" @echo "Installing ${TCL_EXE} as $(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" @$(INSTALL_PROGRAM) ${TCL_EXE} "$(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" + @echo "Installing ${TCLKIT_EXE} as $(BIN_INSTALL_DIR)/tclkit$(VERSION)${EXE_SUFFIX}" + @$(INSTALL_PROGRAM) ${TCLKIT_EXE} "$(BIN_INSTALL_DIR)/tclkit$(VERSION)${EXE_SUFFIX}" @echo "Installing tclConfig.sh to $(CONFIG_INSTALL_DIR)/" @$(INSTALL_DATA) tclConfig.sh "$(CONFIG_INSTALL_DIR)/tclConfig.sh" @echo "Installing tclooConfig.sh to $(CONFIG_INSTALL_DIR)/" -- cgit v0.12 From 99d72ae8921b1f93943f485fedc93d03e285509b Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 9 Sep 2014 15:09:23 +0000 Subject: Added the "run tcl dll from vfs" magic to windows --- win/Makefile.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/win/Makefile.in b/win/Makefile.in index bf3e303..6d74cdb 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -411,8 +411,7 @@ ZLIB_OBJS = \ TCL_OBJS = ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} @ZLIB_OBJS@ -TCLKIT_OBJS = tclKitInit.$(OBJEXT) \ - ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLIB_OBJS} +TCLKIT_OBJS = tclKitInit.$(OBJEXT) ${ZLIB_OBJS} TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n] @@ -446,7 +445,7 @@ tclkit.vfs: $(TCLSH) $(DDE_DLL_FILE) $(REG_DLL_FILE) "$(WIN_DIR)/tclkit.vfs" "$(VERSION)" "$(ROOT_DIR)" windows $(TCL_LIB_FILE) $(TCLKIT): $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs - $(CC) $(CFLAGS) -DSTATIC_BUILD -UUSE_STUBS $(TCLKIT_OBJS) $(LIBS) \ + $(CC) $(CFLAGS) $(TCLKIT_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) @VC_MANIFEST_EMBED_EXE@ cat null.zip >> $(TCLKIT) -- cgit v0.12 From ee30b1c0abf416e9e6b409e713c1309f2de7eb1b Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Fri, 12 Sep 2014 16:03:20 +0000 Subject: Developed an improved bootloader built around TclSetPreInitScript. The new bootloader now mounts the VFS before the interpreter is initialized, and gives it enough hints to point to the VFS for init.tcl and main.tcl (If present) Also, Tcl_ZVfs_Boot now takes and additional argument: the name of the file to mount. As the difference between a normal shell and a zvfs enabled shell is one again, several lines of code, the example shells is folded back into tclAppInit.c and controlled with macros. The ZVFS commands are now loaded in as a static package. Removed the Stubs entry for Tcl_Boot_ZVFS, it's now intended that shells build their own copy of tclZipVfs.o --- generic/tcl.decls | 5 -- generic/tclDecls.h | 7 --- generic/tclInt.h | 1 + generic/tclStubInit.c | 1 - generic/tclZipVfs.c | 123 +++++++++++++++++++++++++++++++------------------- tools/mkVfs.tcl | 6 +-- unix/Makefile.in | 44 ++++++++++++++---- unix/tclAppInit.c | 20 ++++++-- win/Makefile.in | 41 +++++++++++++---- win/tclAppInit.c | 20 +++++++- 10 files changed, 182 insertions(+), 86 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index c24898e..1829249 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2326,11 +2326,6 @@ declare 630 { # ----- BASELINE -- FOR -- 8.6.0 ----- # -# ZipVfs -declare 631 { -int Tcl_Zvfs_Boot(Tcl_Interp *interp,const char *vfsmountpoint,const char *initscript) -} - ############################################################################## # Define the platform specific public Tcl interface. These functions are only diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 65d940d..91c0add 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1815,10 +1815,6 @@ EXTERN int Tcl_FSUnloadFile(Tcl_Interp *interp, EXTERN void Tcl_ZlibStreamSetCompressionDictionary( Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); -/* 631 */ -EXTERN int Tcl_Zvfs_Boot(Tcl_Interp *interp, - const char *vfsmountpoint, - const char *initscript); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2485,7 +2481,6 @@ typedef struct TclStubs { void * (*tcl_FindSymbol) (Tcl_Interp *interp, Tcl_LoadHandle handle, const char *symbol); /* 628 */ int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */ void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */ - int (*tcl_Zvfs_Boot) (Tcl_Interp *interp, const char *vfsmountpoint, const char *initscript); /* 631 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -3778,8 +3773,6 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_FSUnloadFile) /* 629 */ #define Tcl_ZlibStreamSetCompressionDictionary \ (tclStubsPtr->tcl_ZlibStreamSetCompressionDictionary) /* 630 */ -#define Tcl_Zvfs_Boot \ - (tclStubsPtr->tcl_Zvfs_Boot) /* 631 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 6bf1ef9..6a4e354 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3153,6 +3153,7 @@ MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks); #endif MODULE_SCOPE Tcl_Obj * TclDisassembleByteCodeObj(Tcl_Obj *objPtr); MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp); +MODULE_SCOPE int TclZvfsInit(Tcl_Interp *interp); MODULE_SCOPE void * TclpThreadCreateKey(void); MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr); MODULE_SCOPE void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr); diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index ace1766..7a84cba 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -1412,7 +1412,6 @@ const TclStubs tclStubs = { Tcl_FindSymbol, /* 628 */ Tcl_FSUnloadFile, /* 629 */ Tcl_ZlibStreamSetCompressionDictionary, /* 630 */ - Tcl_Zvfs_Boot, /* 631 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tclZipVfs.c b/generic/tclZipVfs.c index dc96313..15f38bd 100755 --- a/generic/tclZipVfs.c +++ b/generic/tclZipVfs.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2000 D. Richard Hipp * Copyright (c) 2007 PDQ Interfaces Inc. - * Copyright (c) 2013 Sean Woods + * Copyright (c) 2013-2014 Sean Woods * * This file is now released under the BSD style license outlined in the * included file license.terms. @@ -105,7 +105,7 @@ struct ZFile { EXTERN int Tcl_Zvfs_Mount(Tcl_Interp *interp,const char *zArchive,const char *zMountPoint); EXTERN int Tcl_Zvfs_Umount(const char *zArchive); -EXTERN int Tcl_Zvfs_Init(Tcl_Interp *interp); +EXTERN int TclZvfsInit(Tcl_Interp *interp); EXTERN int Tcl_Zvfs_SafeInit(Tcl_Interp *interp); /* @@ -534,7 +534,7 @@ Tcl_Zvfs_Mount( pEntry = Tcl_FindHashEntry(&local.archiveHash, zTrueName); if (pEntry) { pArchive = Tcl_GetHashValue(pEntry); - if (pArchive) { + if (pArchive && interp) { Tcl_AppendResult(interp, pArchive->zMountPoint, 0); } } @@ -560,7 +560,7 @@ Tcl_Zvfs_Mount( iPos = Tcl_Seek(chan, -22, SEEK_END); Tcl_Read(chan, (char *) zBuf, 22); if (memcmp(zBuf, "\120\113\05\06", 4)) { - Tcl_AppendResult(interp, "not a ZIP archive", NULL); + if(interp) Tcl_AppendResult(interp, "not a ZIP archive", NULL); return TCL_ERROR; } @@ -572,8 +572,9 @@ Tcl_Zvfs_Mount( pEntry = Tcl_CreateHashEntry(&local.archiveHash, zArchiveName, &isNew); if (!isNew) { pArchive = Tcl_GetHashValue(pEntry); - Tcl_AppendResult(interp, "already mounted at ", pArchive->zMountPoint, - 0); + if (interp) { + Tcl_AppendResult(interp, "already mounted at ", pArchive->zMountPoint,0); + } Tcl_Free(zArchiveName); Tcl_Close(interp, chan); return TCL_ERROR; @@ -630,12 +631,13 @@ Tcl_Zvfs_Mount( Tcl_Read(chan, (char *) zBuf, 46); if (memcmp(zBuf, "\120\113\01\02", 4)) { - Tcl_AppendResult(interp, "ill-formed central directory entry", - NULL); - if (zTrueName) { - Tcl_Free(zTrueName); - } - return TCL_ERROR; + if(interp) { + Tcl_AppendResult(interp, "ill-formed central directory entry",NULL); + } + if (zTrueName) { + Tcl_Free(zTrueName); + } + return TCL_ERROR; } lenName = INT16(zBuf, 28); lenExtra = INT16(zBuf, 30) + INT16(zBuf, 32); @@ -1718,6 +1720,18 @@ static int ZvfsAddObjCmd(void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *c static int ZvfsDumpObjCmd(void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); static int ZvfsStartObjCmd(void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); +static int Zvfs_Common_Init(Tcl_Interp *interp) { + if (local.isInit) return TCL_OK; + /* One-time initialization of the ZVFS */ + if(Tcl_FSRegister(interp, &Tobe_Filesystem)) { + return TCL_ERROR; + } + Tcl_InitHashTable(&local.fileHash, TCL_STRING_KEYS); + Tcl_InitHashTable(&local.archiveHash, TCL_STRING_KEYS); + local.isInit = 1; + return TCL_OK; +} + /* * Initialize the ZVFS system. */ @@ -1731,7 +1745,7 @@ Zvfs_doInit( return TCL_ERROR; } #endif - Tcl_StaticPackage(interp, "zvfs", Tcl_Zvfs_Init, Tcl_Zvfs_SafeInit); + Tcl_StaticPackage(interp, "zvfs", TclZvfsInit, Tcl_Zvfs_SafeInit); if (!safe) { Tcl_CreateObjCommand(interp, "zvfs::mount", ZvfsMountObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "zvfs::unmount", ZvfsUnmountObjCmd, 0, 0); @@ -1746,16 +1760,10 @@ Zvfs_doInit( Tcl_SetVar(interp, "::zvfs::auto_ext", ".tcl .tk .itcl .htcl .txt .c .h .tht", TCL_GLOBAL_ONLY); /* Tcl_CreateObjCommand(interp, "zip::open", ZipOpenObjCmd, 0, 0); */ - - if (!local.isInit) { - /* One-time initialization of the ZVFS */ - if(Tcl_FSRegister(NULL, &Tobe_Filesystem)) { - return TCL_ERROR; - } - Tcl_InitHashTable(&local.fileHash, TCL_STRING_KEYS); - Tcl_InitHashTable(&local.archiveHash, TCL_STRING_KEYS); - local.isInit = 1; + if(Zvfs_Common_Init(interp)) { + return TCL_ERROR; } + if (Zvfs_PostInit) { Zvfs_PostInit(interp); } @@ -1765,43 +1773,58 @@ Zvfs_doInit( /* ** Boot a shell, mount the executable's VFS, detect main.tcl */ -int Tcl_Zvfs_Boot(Tcl_Interp *interp,const char *vfsmountpoint,const char *initscript) { - CONST char *cp=Tcl_GetNameOfExecutable(); - char filepath[256]; - +int Tcl_Zvfs_Boot(const char *archive,const char *vfsmountpoint,const char *initscript) { + FILE *fout; + Zvfs_Common_Init(NULL); + if(!vfsmountpoint) { + vfsmountpoint="/zvfs"; + } + if(!initscript) { + initscript="main.tcl"; + } /* We have to initialize the virtual filesystem before calling ** Tcl_Init(). Otherwise, Tcl_Init() will not be able to find ** its startup script files. */ - if(Zvfs_doInit(interp, 0)) { - return TCL_ERROR; - } - if(!Tcl_Zvfs_Mount(interp, cp, vfsmountpoint)) { + if(!Tcl_Zvfs_Mount(NULL, archive, vfsmountpoint)) { + Tcl_DString filepath; + Tcl_DString preinit; + Tcl_Obj *vfsinitscript; Tcl_Obj *vfstcllib; Tcl_Obj *vfstklib; + Tcl_Obj *vfspreinit; + Tcl_DStringInit(&filepath); + Tcl_DStringInit(&preinit); + + Tcl_DStringInit(&filepath); + Tcl_DStringAppend(&filepath,vfsmountpoint,-1); + Tcl_DStringAppend(&filepath,"/",-1); + Tcl_DStringAppend(&filepath,initscript,-1); + vfsinitscript=Tcl_NewStringObj(Tcl_DStringValue(&filepath),-1); + Tcl_DStringFree(&filepath); - strcpy(filepath,vfsmountpoint); - strcat(filepath,"/"); - strcat(filepath,initscript); - vfsinitscript=Tcl_NewStringObj(filepath,-1); - strcpy(filepath,vfsmountpoint); - strcat(filepath,"/tcl8.6"); - vfstcllib=Tcl_NewStringObj(filepath,-1); - strcpy(filepath,vfsmountpoint); - strcat(filepath,"/tk8.6"); - vfstklib=Tcl_NewStringObj(filepath,-1); - + Tcl_DStringInit(&filepath); + Tcl_DStringAppend(&filepath,vfsmountpoint,-1); + Tcl_DStringAppend(&filepath,"/tcl8.6",-1); + vfstcllib=Tcl_NewStringObj(Tcl_DStringValue(&filepath),-1); + Tcl_DStringFree(&filepath); + + Tcl_DStringInit(&filepath); + Tcl_DStringAppend(&filepath,vfsmountpoint,-1); + Tcl_DStringAppend(&filepath,"/tk8.6",-1); + vfstklib=Tcl_NewStringObj(Tcl_DStringValue(&filepath),-1); + Tcl_DStringFree(&filepath); + Tcl_IncrRefCount(vfsinitscript); Tcl_IncrRefCount(vfstcllib); Tcl_IncrRefCount(vfstklib); if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { /* Startup script should be set before calling Tcl_AppInit */ + fprintf(fout,"%s\n",Tcl_GetString(vfsinitscript)); Tcl_SetStartupScript(vfsinitscript,NULL); - } else { - Tcl_SetStartupScript(NULL,NULL); } if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { @@ -1811,12 +1834,18 @@ int Tcl_Zvfs_Boot(Tcl_Interp *interp,const char *vfsmountpoint,const char *inits Tcl_SetStartupScript(NULL,NULL); } if(Tcl_FSAccess(vfstcllib,F_OK)==0) { - Tcl_SetVar2(interp, "env", "TCL_LIBRARY", Tcl_GetString(vfstcllib), TCL_GLOBAL_ONLY); + Tcl_DStringAppend(&preinit,"\nset tcl_library ",-1); + Tcl_DStringAppendElement(&preinit,Tcl_GetString(vfstcllib)); } if(Tcl_FSAccess(vfstklib,F_OK)==0) { - Tcl_SetVar2(interp, "env", "TK_LIBRARY", Tcl_GetString(vfstklib), TCL_GLOBAL_ONLY); + Tcl_DStringAppend(&preinit,"\nset tk_library ",-1); + Tcl_DStringAppendElement(&preinit,Tcl_GetString(vfstklib)); } - + vfspreinit=Tcl_NewStringObj(Tcl_DStringValue(&preinit),-1); + /* NOTE: We never decr this refcount, lest the contents of the script be deallocated */ + Tcl_IncrRefCount(vfspreinit); + TclSetPreInitScript(Tcl_GetString(vfspreinit)); + Tcl_DecrRefCount(vfsinitscript); Tcl_DecrRefCount(vfstcllib); Tcl_DecrRefCount(vfstklib); @@ -1826,7 +1855,7 @@ int Tcl_Zvfs_Boot(Tcl_Interp *interp,const char *vfsmountpoint,const char *inits int -Tcl_Zvfs_Init( +TclZvfsInit( Tcl_Interp *interp) { return Zvfs_doInit(interp, 0); diff --git a/tools/mkVfs.tcl b/tools/mkVfs.tcl index c7bf17b..83eb9e6 100644 --- a/tools/mkVfs.tcl +++ b/tools/mkVfs.tcl @@ -15,7 +15,7 @@ proc pkgIndexDir {root fout d1} { if {[file isdirectory $f] && [string compare CVS $ftail]} { pkgIndexDir $root $fout $f } elseif {[file tail $f] eq "pkgIndex.tcl"} { - puts $fout "set dir \$HERE[string range $d1 $idx end]" + puts $fout "set dir \${VFSROOT}[string range $d1 $idx end]" puts $fout [cat $f] } } @@ -87,7 +87,7 @@ set fout [open ${TCL_SCRIPT_DIR}/tclIndex a] puts $fout {# # MANIFEST OF INCLUDED PACKAGES # -set HERE $dir +set VFSROOT $dir } pkgIndexDir ${TCL_SCRIPT_DIR} $fout ${TCL_SCRIPT_DIR} close $fout @@ -96,12 +96,10 @@ puts $fout { # Save Tcl the trouble of hunting for these packages } set ddedll [glob -nocomplain ${TCLSRC_ROOT}/win/tcldde*.dll] -puts "DDE DLL $ddedll" if {$ddedll != {}} { puts $fout [cat ${TCL_SCRIPT_DIR}/dde/pkgIndex.tcl] } set regdll [glob -nocomplain ${TCLSRC_ROOT}/win/tclreg*.dll] -puts "REG DLL $ddedll" if {$regdll != {}} { puts $fout [cat ${TCL_SCRIPT_DIR}/reg/pkgIndex.tcl] } diff --git a/unix/Makefile.in b/unix/Makefile.in index c66cc0a..c98f6ce 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -312,7 +312,7 @@ GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \ tclResolve.o tclResult.o tclScan.o tclStringObj.o \ tclStrToD.o tclThread.o \ tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o \ - tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o tclZipVfs.o \ + tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o \ tclTomMathInterface.o OO_OBJS = tclOO.o tclOOBasic.o tclOOCall.o tclOODefineCmds.o tclOOInfo.o \ @@ -364,7 +364,7 @@ ZLIB_OBJS = Zadler32.o Zcompress.o Zcrc32.o Zdeflate.o Zinfback.o \ TCL_OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${NOTIFY_OBJS} ${COMPAT_OBJS} \ ${OO_OBJS} @DL_OBJS@ @PLAT_OBJS@ -TCLKIT_OBJS = tclKitInit.o +TCLKIT_OBJS = tclKitInit.o tclZipVfs.o OBJS = ${TCL_OBJS} ${TOMMATH_OBJS} @DTRACE_OBJ@ @ZLIB_OBJS@ @@ -558,7 +558,6 @@ UNIX_HDRS = \ UNIX_SRCS = \ $(UNIX_DIR)/tclAppInit.c \ - $(UNIX_DIR)/tclKitInit.c \ $(UNIX_DIR)/tclUnixChan.c \ $(UNIX_DIR)/tclUnixEvent.c \ $(UNIX_DIR)/tclUnixFCmd.c \ @@ -674,19 +673,41 @@ null.zip: # Rather than force an install, pack the files we need into a # file system under our control tclkit.vfs: - make install-libraries DESTDIR=tclkit.vfs - make install-tzdata DESTDIR=tclkit.vfs - make install-packages DESTDIR=tclkit.vfs + @echo "Building VFS File system in tclkit.vfs" + @$(TCL_EXE) "$(TOP_DIR)/tools/mkVfs.tcl" \ + "$(UNIX_DIR)/tclkit.vfs/tcl$(VERSION)" "$(TOP_DIR)" unix # Assemble all of the tcl sources into a single executable -${TCLKIT_EXE}: ${TCLKIT_OBJS} ${TCL_KIT_LIB_FILE} null.zip tclkit.vfs +${TCLKIT_EXE}: + +# Builds an executable directly from the Tcl sources +tclkit-direct: ${TCLKIT_OBJS} ${OBJS} ${ZLIB_OBJS} null.zip tclkit.vfs + ${CC} ${CFLAGS} ${LDFLAGS} \ + ${TCLKIT_OBJS} ${OBJS} ${ZLIB_OBJS} \ + ${LIBS} @EXTRA_TCLSH_LIBS@ \ + ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} + cat null.zip >> ${TCLKIT_EXE} + cd tclkit.vfs ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . + +# Builds an executable linked to the Tcl dynamic library +tclkit-dynamic: ${TCLKIT_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} null.zip tclkit.vfs + ${CC} ${CFLAGS} ${LDFLAGS} \ + ${TCLKIT_OBJS} \ + @TCL_BUILD_LIB_SPEC@ \ + ${LIBS} @EXTRA_TCLSH_LIBS@ \ + ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} + cat null.zip >> ${TCLKIT_EXE} + cd tclkit.vfs ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . + +# Builds a tcl static library, as well as an executable linked to the Tcl static library +tclkit-kitlib: ${TCLKIT_OBJS} ${TCL_KIT_LIB_FILE} null.zip tclkit.vfs ${CC} ${CFLAGS} ${LDFLAGS} \ ${TCLKIT_OBJS} \ - @TCL_BUILD_LIB_SPEC@ ${TCL_KIT_LIB_FILE} \ + @TCL_BUILD_KIT_LIB_SPEC@ \ ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} cat null.zip >> ${TCLKIT_EXE} - cd tclkit.vfs${prefix}/lib ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . + cd tclkit.vfs ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in $(SHELL) config.status @@ -1070,6 +1091,10 @@ xtTestInit.o: $(UNIX_DIR)/tclAppInit.c ${TCL_EXE} mv tclAppInit.sav tclAppInit.o; \ fi; +tclKitInit.o: $(UNIX_DIR)/tclAppInit.c ${TCL_EXE} + $(CC) -c $(APP_CC_SWITCHES) \ + -DTCL_ZIPVFS $(UNIX_DIR)/tclAppInit.c -o tclKitInit.o + # Object files used on all Unix systems: REGHDRS=$(GENERIC_DIR)/regex.h $(GENERIC_DIR)/regguts.h \ @@ -2171,6 +2196,7 @@ BUILD_HTML = \ .PHONY: install-tzdata install-msgs .PHONY: packages configure-packages test-packages clean-packages .PHONY: dist-packages distclean-packages install-packages +.PHONY: tclkit-direct tclkit-dynamic tclkit-kitlib #-------------------------------------------------------------------------- # DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index 9bbc88b..4df6387 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -40,7 +40,10 @@ extern Tcl_PackageInitProc Tclxttest_Init; #endif MODULE_SCOPE int TCL_LOCAL_APPINIT(Tcl_Interp *); MODULE_SCOPE int main(int, char **); - +#ifdef TCL_ZIPVFS + MODULE_SCOPE int Tcl_Zvfs_Boot(const char *,const char *,const char *); + MODULE_SCOPE int TclZvfsInit(Tcl_Interp *); +#endif /* TCL_ZIPVFS */ /* * The following #if block allows you to change how Tcl finds the startup * script, prime the library or encoding paths, fiddle with the argv, etc., @@ -80,7 +83,13 @@ main( #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif - +#ifdef TCL_ZIPVFS + #define TCLKIT_INIT "main.tcl" + #define TCLKIT_VFSMOUNT "/zvfs" + Tcl_FindExecutable(argv[0]); + CONST char *cp=Tcl_GetNameOfExecutable(); + Tcl_Zvfs_Boot(cp,TCLKIT_VFSMOUNT,TCLKIT_INIT); +#endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } @@ -111,7 +120,12 @@ Tcl_AppInit( if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } - +#ifdef TCL_ZIPVFS + /* Load the ZipVfs package */ + if (TclZvfsInit(interp) == TCL_ERROR) { + return TCL_ERROR; + } +#endif #ifdef TCL_XT_TEST if (Tclxttest_Init(interp) == TCL_ERROR) { return TCL_ERROR; diff --git a/win/Makefile.in b/win/Makefile.in index 6fdbacf..0b52640 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -299,9 +299,8 @@ GENERIC_OBJS = \ tclUtf.$(OBJEXT) \ tclUtil.$(OBJEXT) \ tclVar.$(OBJEXT) \ - tclZlib.$(OBJEXT) \ - tclZipVfs.$(OBJEXT) - + tclZlib.$(OBJEXT) + TOMMATH_OBJS = \ bncore.${OBJEXT} \ bn_reverse.${OBJEXT} \ @@ -411,9 +410,7 @@ ZLIB_OBJS = \ TCL_OBJS = ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} @ZLIB_OBJS@ -TCLKIT_OBJS = tclKitInit.$(OBJEXT) \ - ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLIB_OBJS} - +TCLKIT_OBJS = tclKitInit.$(OBJEXT) tclZipVfs.$(OBJEXT) TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n] @@ -445,8 +442,31 @@ tclkit.vfs: $(TCLSH) $(DDE_DLL_FILE) $(REG_DLL_FILE) @$(TCL_EXE) "$(ROOT_DIR)/tools/mkVfs.tcl" \ "$(WIN_DIR)/tclkit.vfs/tcl$(VERSION)" "$(ROOT_DIR)" windows -$(TCLKIT): $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs - $(CC) $(CFLAGS) -DSTATIC_BUILD -UUSE_STUBS $(TCLKIT_OBJS) $(LIBS) \ +$(TCLKIT): tclkit-direct + +# Builds an executable directly from the Tcl sources +tclkit-direct: $(TCLKIT_OBJS) ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLIB_OBJS} @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs + rm *.$(OBJEXT) + $(CC) $(CFLAGS) -DSTATIC_BUILD -UUSE_STUBS $(TCLKIT_OBJS) \ + ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLIB_OBJS} \ + $(LIBS) \ + tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) + @VC_MANIFEST_EMBED_EXE@ + rm *.$(OBJEXT) + cat null.zip >> $(TCLKIT) + cd tclkit.vfs ; zip -rAq $(WIN_DIR)/$(TCLKIT) . + + +# Builds an executable linked to the Tcl dynamic library +tclkit-dynamic: $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs + $(CC) $(CFLAGS) $(TCLKIT_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ + tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) + @VC_MANIFEST_EMBED_EXE@ + cat null.zip >> $(TCLKIT) + cd tclkit.vfs ; zip -rAq $(WIN_DIR)/$(TCLKIT) . + +tclkit-kitlib: $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs + $(CC) $(CFLAGS) $(TCLKIT_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) @VC_MANIFEST_EMBED_EXE@ cat null.zip >> $(TCLKIT) @@ -515,6 +535,9 @@ testMain.${OBJEXT}: tclAppInit.c tclMain2.${OBJEXT}: tclMain.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_ASCII_MAIN @DEPARG@ $(CC_OBJNAME) +tclKitInit.${OBJEXT}: tclAppInit.c + $(CC) -c $(CC_SWITCHES) -DTCL_ZIPVFS @DEPARG@ $(CC_OBJNAME) + # TIP #59, embedding of configuration information into the binary library. # # Part of Tcl's configuration information are the paths where it was installed @@ -899,5 +922,7 @@ html-tk: $(TCLSH) .PHONY: gdb depend cleanhelp clean distclean packages install-packages .PHONY: test-packages clean-packages distclean-packages genstubs html .PHONY: html-tcl html-tk tclkit +.PHONY: tclkit-direct tclkit-dynamic tclkit-kitlib + # DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/win/tclAppInit.c b/win/tclAppInit.c index a6c1a67..6f49afa 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -27,6 +27,11 @@ extern Tcl_PackageInitProc Tcltest_Init; extern Tcl_PackageInitProc Tcltest_SafeInit; #endif /* TCL_TEST */ +#ifdef TCL_ZIPVFS + MODULE_SCOPE int Tcl_Zvfs_Boot(const char *,const char *,const char *); + MODULE_SCOPE int TclZvfsInit(Tcl_Interp *); +#endif /* TCL_ZIPVFS */ + #if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES extern Tcl_PackageInitProc Registry_Init; extern Tcl_PackageInitProc Dde_Init; @@ -123,7 +128,13 @@ _tmain( #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif - +#ifdef TCL_ZIPVFS + #define TCLKIT_INIT "main.tcl" + #define TCLKIT_VFSMOUNT "/zvfs" + Tcl_FindExecutable(argv[0]); + CONST char *cp=Tcl_GetNameOfExecutable(); + Tcl_Zvfs_Boot(cp,TCLKIT_VFSMOUNT,TCLKIT_INIT); +#endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } @@ -154,7 +165,12 @@ Tcl_AppInit( if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } - +#ifdef TCL_ZIPVFS + /* Load the ZipVfs package */ + if (TclZvfsInit(interp) == TCL_ERROR) { + return TCL_ERROR; + } +#endif #if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES if (Registry_Init(interp) == TCL_ERROR) { return TCL_ERROR; -- cgit v0.12 From c003b95ed4a2c757d79b8161e72d50f32ea6e9d5 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Fri, 12 Sep 2014 16:13:00 +0000 Subject: Backing out code that inserted a debug statement into the http package --- library/http/http.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/http/http.tcl b/library/http/http.tcl index afa9458..a6b2bfd 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -12,7 +12,7 @@ package require Tcl 8.6 # Keep this in sync with pkgIndex.tcl and with the install directories in # Makefiles package provide http 2.8.8 -puts [list LOADED [info script]] + namespace eval http { # Allow resourcing to not clobber existing data -- cgit v0.12 From b25f4f5272e7987bb9a914c4dd414c095b1769ed Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 15 Sep 2014 09:44:39 +0000 Subject: The unix build has been pared down to the minimum hooks required to build a VFS enabled Tclsh with a simple compile flag. Modified the BC and Visual Studio makefiles for Windows, but these are untested. The default for Tcl is now to build a static or dynamic shell in the same way it would build a static or dynamic shell for Tclsh. Controlled by the --enable-shared flag. Note however that ZLib is compiled in to every VFS enabled shell. (Rather than rely on a dylib.) The "direct" build is maintained in the Makefile, mostly as a h(istor|yster)ical reference. The technique is not portable to Windows, and may not work outside of OSX. --- unix/Makefile.in | 40 +- unix/configure | 20975 +++++++++++++++++++++++++++++++++++++--------------- unix/configure.in | 36 +- unix/tcl.m4 | 10 - win/makefile.bc | 15 +- win/makefile.vc | 22 +- 6 files changed, 14876 insertions(+), 6222 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index c98f6ce..7523fca 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -168,7 +168,6 @@ INSTALL_DATA_DIR = ${INSTALL} -d -m 755 EXE_SUFFIX = @EXEEXT@ TCL_EXE = tclsh${EXE_SUFFIX} TCLKIT_EXE = tclkit${EXE_SUFFIX} -TCLKIT_LIB = tclkit${EXE_SUFFIX} TCLTEST_EXE = tcltest${EXE_SUFFIX} NATIVE_TCLSH = @TCLSH_PROG@ @@ -204,9 +203,6 @@ BUILD_DLTEST = @BUILD_DLTEST@ TCL_LIB_FILE = @TCL_LIB_FILE@ #TCL_LIB_FILE = libtcl.a -TCL_KIT_LIB_FILE = @TCL_KIT_LIB_FILE@ -#TCL_KIT_LIB_FILE = libtclkit.a - # Generic lib name used in rules that apply to tcl and tk LIB_FILE = ${TCL_LIB_FILE} @@ -469,7 +465,6 @@ GENERIC_SRCS = \ $(GENERIC_DIR)/tclUtil.c \ $(GENERIC_DIR)/tclVar.c \ $(GENERIC_DIR)/tclAssembly.c \ - $(GENERIC_DIR)/tclZipVfs.obj \ $(GENERIC_DIR)/tclZlib.c OO_SRCS = \ @@ -615,9 +610,6 @@ ZLIB_SRCS = \ SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \ $(OO_SRCS) $(STUB_SRCS) @PLAT_SRCS@ @ZLIB_SRCS@ -PWD=`pwd` -VFS_INSTALL_DIR=${PWD}/tclkit.vfs/tcl8.6 - #-------------------------------------------------------------------------- # Start of rules #-------------------------------------------------------------------------- @@ -642,11 +634,6 @@ ${STUB_LIB_FILE}: ${STUB_LIB_OBJS} fi rm -f $@ @MAKE_STUB_LIB@ - - -${TCL_KIT_LIB_FILE}: ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} - rm -f $@ - @MAKE_KIT_LIB@ # Make target which outputs the list of the .o contained in the Tcl lib useful # to build a single big shared library containing Tcl and other extensions. @@ -677,20 +664,8 @@ tclkit.vfs: @$(TCL_EXE) "$(TOP_DIR)/tools/mkVfs.tcl" \ "$(UNIX_DIR)/tclkit.vfs/tcl$(VERSION)" "$(TOP_DIR)" unix -# Assemble all of the tcl sources into a single executable -${TCLKIT_EXE}: - -# Builds an executable directly from the Tcl sources -tclkit-direct: ${TCLKIT_OBJS} ${OBJS} ${ZLIB_OBJS} null.zip tclkit.vfs - ${CC} ${CFLAGS} ${LDFLAGS} \ - ${TCLKIT_OBJS} ${OBJS} ${ZLIB_OBJS} \ - ${LIBS} @EXTRA_TCLSH_LIBS@ \ - ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} - cat null.zip >> ${TCLKIT_EXE} - cd tclkit.vfs ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . - # Builds an executable linked to the Tcl dynamic library -tclkit-dynamic: ${TCLKIT_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} null.zip tclkit.vfs +${TCLKIT_EXE}: ${TCLKIT_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} null.zip tclkit.vfs ${CC} ${CFLAGS} ${LDFLAGS} \ ${TCLKIT_OBJS} \ @TCL_BUILD_LIB_SPEC@ \ @@ -699,11 +674,10 @@ tclkit-dynamic: ${TCLKIT_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} null.zip tcl cat null.zip >> ${TCLKIT_EXE} cd tclkit.vfs ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . -# Builds a tcl static library, as well as an executable linked to the Tcl static library -tclkit-kitlib: ${TCLKIT_OBJS} ${TCL_KIT_LIB_FILE} null.zip tclkit.vfs +# Builds an executable directly from the Tcl sources +tclkit-direct: ${TCLKIT_OBJS} ${OBJS} ${ZLIB_OBJS} null.zip tclkit.vfs ${CC} ${CFLAGS} ${LDFLAGS} \ - ${TCLKIT_OBJS} \ - @TCL_BUILD_KIT_LIB_SPEC@ \ + ${TCLKIT_OBJS} ${OBJS} ${ZLIB_OBJS} \ ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} cat null.zip >> ${TCLKIT_EXE} @@ -873,10 +847,6 @@ install-binaries: binaries echo "Installing $(STUB_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \ @INSTALL_STUB_LIB@ ; \ fi - @if test "$(TCL_KIT_LIB_FILE)" != "" ; then \ - echo "Installing $(TCL_KIT_LIB_FILE) to $(LIB_INSTALL_DIR)/"; \ - @INSTALL_KIT_LIB@ ; \ - fi @EXTRA_INSTALL_BINARIES@ @echo "Installing pkg-config file to $(LIB_INSTALL_DIR)/pkgconfig/" @$(INSTALL_DATA_DIR) $(LIB_INSTALL_DIR)/pkgconfig @@ -2196,7 +2166,7 @@ BUILD_HTML = \ .PHONY: install-tzdata install-msgs .PHONY: packages configure-packages test-packages clean-packages .PHONY: dist-packages distclean-packages install-packages -.PHONY: tclkit-direct tclkit-dynamic tclkit-kitlib +.PHONY: tclkit-direct #-------------------------------------------------------------------------- # DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/unix/configure b/unix/configure index a5f318e..a82c692 100755 --- a/unix/configure +++ b/unix/configure @@ -1,459 +1,81 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for tcl 8.6. -# -# -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -# +# Generated by GNU Autoconf 2.59 for tcl 8.6. # +# 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. ## -## -------------------- ## +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' +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 -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +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 - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + $as_unset $as_var fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error +done -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi -as_me=`$as_basename -- "$0" || +# Name of the executable. +as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + +# PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -461,91 +83,146 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop - s/-\n.*// + s,-$,, + s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno # Exit status is that of the last command. exit } -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null + as_expr=false fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' else - as_ln_s='cp -pR' + as_ln_s='ln -s' fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null +rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' + as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_test_x='test -x' -as_executable_p=as_fn_executable_p +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'" @@ -554,25 +231,38 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -test -n "$DJDIR" || exec 7<&0 &1 +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + # Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` +exec 6>&1 + # # Initializations. # ac_default_prefix=/usr/local -ac_clean_files= ac_config_libobj_dir=. -LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='tcl' @@ -580,220 +270,50 @@ PACKAGE_TARNAME='tcl' PACKAGE_VERSION='8.6' PACKAGE_STRING='tcl 8.6' PACKAGE_BUGREPORT='' -PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ #include -#ifdef HAVE_SYS_TYPES_H +#if HAVE_SYS_TYPES_H # include #endif -#ifdef HAVE_SYS_STAT_H +#if HAVE_SYS_STAT_H # include #endif -#ifdef STDC_HEADERS +#if STDC_HEADERS # include # include #else -# ifdef HAVE_STDLIB_H +# if HAVE_STDLIB_H # include # endif #endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif -#ifdef HAVE_STRINGS_H +#if HAVE_STRINGS_H # include #endif -#ifdef HAVE_INTTYPES_H +#if HAVE_INTTYPES_H # include +#else +# if HAVE_STDINT_H +# include +# endif #endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H +#if HAVE_UNISTD_H # include #endif" -ac_subst_vars='DLTEST_SUFFIX -DLTEST_LD -EXTRA_TCLSH_LIBS -EXTRA_BUILD_HTML -EXTRA_INSTALL_BINARIES -EXTRA_INSTALL -EXTRA_APP_CC_SWITCHES -EXTRA_CC_SWITCHES -PACKAGE_DIR -HTML_DIR -PRIVATE_INCLUDE_DIR -TCL_LIBRARY -TCL_MODULE_PATH -TCL_PACKAGE_PATH -BUILD_DLTEST -MAKEFILE_SHELL -DTRACE_OBJ -DTRACE_HDR -DTRACE_SRC -INSTALL_TZDATA -TCL_HAS_LONGLONG -TCL_UNSHARED_LIB_SUFFIX -TCL_SHARED_LIB_SUFFIX -TCL_LIB_VERSIONS_OK -LD_LIBRARY_PATH_VAR -TCL_SHARED_BUILD -CFG_TCL_UNSHARED_LIB_SUFFIX -CFG_TCL_SHARED_LIB_SUFFIX -TCL_SRC_DIR -TCL_INCLUDE_SPEC -TCL_BUILD_KIT_LIB_PATH -TCL_BUILD_KIT_LIB_SPEC -TCL_KIT_LIB_PATH -TCL_KIT_LIB_SPEC -TCL_KIT_LIB_FLAG -TCL_KIT_LIB_FILE -TCL_BUILD_STUB_LIB_PATH -TCL_BUILD_STUB_LIB_SPEC -TCL_STUB_LIB_PATH -TCL_STUB_LIB_SPEC -TCL_STUB_LIB_FLAG -TCL_STUB_LIB_FILE -TCL_BUILD_LIB_SPEC -TCL_LIB_SPEC -TCL_LIB_FLAG -TCL_LIB_FILE -PKG_CFG_ARGS -TCL_YEAR -TCL_PATCH_LEVEL -TCL_MINOR_VERSION -TCL_MAJOR_VERSION -TCL_VERSION -DTRACE -LDFLAGS_DEFAULT -CFLAGS_DEFAULT -INSTALL_KIT_LIB -INSTALL_STUB_LIB -DLL_INSTALL_DIR -INSTALL_LIB -MAKE_STUB_LIB -MAKE_KIT_LIB -MAKE_LIB -SHLIB_SUFFIX -SHLIB_CFLAGS -SHLIB_LD_LIBS -TK_SHLIB_LD_EXTRAS -TCL_SHLIB_LD_EXTRAS -SHLIB_LD -STLIB_LD -LD_SEARCH_FLAGS -CC_SEARCH_FLAGS -LDFLAGS_OPTIMIZE -LDFLAGS_DEBUG -CFLAGS_WARNING -CFLAGS_OPTIMIZE -CFLAGS_DEBUG -LDAIX_SRC -PLAT_SRCS -PLAT_OBJS -DL_OBJS -DL_LIBS -TCL_LIBS -LIBOBJS -AR -RANLIB -ZLIB_INCLUDE -ZLIB_SRCS -ZLIB_OBJS -TCLSH_PROG -TCL_THREADS -EGREP -GREP -CPP -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -MAN_FLAGS -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' +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 TCLSH_PROG ZLIB_OBJS ZLIB_SRCS ZLIB_INCLUDE RANLIB ac_ct_RANLIB AR ac_ct_AR LIBOBJS TCL_LIBS DL_LIBS DL_OBJS PLAT_OBJS PLAT_SRCS LDAIX_SRC 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 DLL_INSTALL_DIR INSTALL_STUB_LIB CFLAGS_DEFAULT LDFLAGS_DEFAULT DTRACE TCL_VERSION TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL TCL_YEAR PKG_CFG_ARGS 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 TCL_SHARED_BUILD LD_LIBRARY_PATH_VAR TCL_BUILD_LIB_SPEC TCL_LIB_VERSIONS_OK TCL_SHARED_LIB_SUFFIX TCL_UNSHARED_LIB_SUFFIX TCL_HAS_LONGLONG INSTALL_TZDATA DTRACE_SRC DTRACE_HDR DTRACE_OBJ MAKEFILE_SHELL BUILD_DLTEST TCL_PACKAGE_PATH TCL_MODULE_PATH TCL_LIBRARY PRIVATE_INCLUDE_DIR HTML_DIR PACKAGE_DIR EXTRA_CC_SWITCHES EXTRA_APP_CC_SWITCHES EXTRA_INSTALL EXTRA_INSTALL_BINARIES EXTRA_BUILD_HTML EXTRA_TCLSH_LIBS DLTEST_LD DLTEST_SUFFIX' ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_man_symlinks -enable_man_compression -enable_man_suffix -enable_threads -with_encoding -enable_shared -enable_64bit -enable_64bit_vis -enable_rpath -enable_corefoundation -enable_load -enable_symbols -enable_langinfo -enable_dll_unloading -with_tzdata -enable_dtrace -enable_framework -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - # Initialize some variables set by options. ac_init_help= ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null @@ -816,49 +336,34 @@ x_libraries=NONE # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' +datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' +infodir='${prefix}/info' +mandir='${prefix}/man' ac_prev= -ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option + eval "$ac_prev=\$ac_option" ac_prev= continue fi - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; @@ -880,59 +385,33 @@ do --config-cache | -C) cache_file=config.cache ;; - -datadir | --datadir | --datadi | --datad) + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) datadir=$ac_optarg ;; - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; esac - eval enable_$ac_useropt=\$ac_optarg ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -959,12 +438,6 @@ do -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; @@ -989,16 +462,13 @@ do | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) @@ -1063,16 +533,6 @@ do | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; @@ -1123,36 +583,26 @@ do ac_init_version=: ;; -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; esac - eval with_$ac_useropt=\$ac_optarg ;; + eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. @@ -1172,26 +622,27 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac @@ -1199,36 +650,31 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix do - eval ac_val=\$$ac_var - # Remove trailing slashes. + eval ac_val=$`echo $ac_var` case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; esac - # Be sure to have absolute directory names. +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 - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1242,6 +688,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1253,72 +701,74 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - # 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 the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` + # 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 - if test ! -r "$srcdir/$ac_unique_file"; then + if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP # # Report the --help message. @@ -1341,17 +791,20 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages + -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --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] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -1361,25 +814,18 @@ for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/tcl] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF @@ -1393,7 +839,6 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options --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) @@ -1431,593 +876,160 @@ Some influential environment variables: CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to the package provider. _ACEOF -ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. + ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue + test -d $ac_dir || continue ac_builddir=. -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix +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 - .) # We are building in place. + .) # No --srcdir option. We are building in place. ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. + 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 - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; + 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 -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested 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 +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 - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir done fi -test -n "$ac_init_help" && exit $ac_status +test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF tcl configure 8.6 -generated by GNU Autoconf 2.69 +generated by GNU Autoconf 2.59 -Copyright (C) 2012 Free Software Foundation, Inc. +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 + 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 tcl $as_me 8.6, which was +generated by GNU Autoconf 2.59. Invocation command line was -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## + $ $0 $@ -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () +_ACEOF { - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` -} # ac_fn_c_try_compile +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval +_ASUNAME -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* 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_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type - -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_member -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by tcl $as_me 8.6, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done } >&5 @@ -2039,6 +1051,7 @@ _ACEOF ac_configure_args= ac_configure_args0= ac_configure_args1= +ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do @@ -2049,13 +1062,13 @@ do -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) - as_fn_append ac_configure_args1 " '$ac_arg'" + 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 @@ -2071,115 +1084,104 @@ do -* ) ac_must_keep_next=true ;; esac fi - as_fn_append ac_configure_args " '$ac_arg'" + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " ;; esac done done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + cat <<\_ASBOX +## ---------------- ## ## Cache variables. ## -## ---------------- ##" +## ---------------- ## +_ASBOX echo # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done +{ (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) + 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" - ;; #( + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; - esac | - sort -) + esac; +} echo - $as_echo "## ----------------- ## + cat <<\_ASBOX +## ----------------- ## ## Output variables. ## -## ----------------- ##" +## ----------------- ## +_ASBOX echo for ac_var in $ac_subst_vars do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX echo for ac_var in $ac_subst_files do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + cat <<\_ASBOX +## ----------- ## ## confdefs.h. ## -## ----------- ##" +## ----------- ## +_ASBOX echo - cat confdefs.h + sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status -' 0 + ' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h # Predefined preprocessor variables. @@ -2187,137 +1189,112 @@ cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF + cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF + cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF + cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } + . "$ac_site_file" fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} >$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 $ac_precious_vars; do +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 + 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,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { 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) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { 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 - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + { 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=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -2330,6 +1307,31 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + + + + + TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 @@ -2380,60 +1382,62 @@ TCL_SRC_DIR="`cd "$srcdir"/..; pwd`" #------------------------------------------------------------------------ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use symlinks for manpages" >&5 -$as_echo_n "checking whether to use symlinks for manpages... " >&6; } - # Check whether --enable-man-symlinks was given. -if test "${enable_man_symlinks+set}" = set; then : - enableval=$enable_man_symlinks; test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks" + 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 - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 -$as_echo "$enableval" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to compress the manpages" >&5 -$as_echo_n "checking whether to compress the manpages... " >&6; } - # Check whether --enable-man-compression was given. -if test "${enable_man_compression+set}" = set; then : - enableval=$enable_man_compression; case $enableval in - yes) as_fn_error $? "missing argument to --enable-man-compression" "$LINENO" 5;; +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 - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 -$as_echo "$enableval" >&6; } +fi; + echo "$as_me:$LINENO: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 if test "$enableval" != "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compressed file suffix" >&5 -$as_echo_n "checking for compressed file suffix... " >&6; } + 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" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $Z" >&5 -$as_echo "$Z" >&6; } + echo "$as_me:$LINENO: result: $Z" >&5 +echo "${ECHO_T}$Z" >&6 fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to add a package name suffix for the manpages" >&5 -$as_echo_n "checking whether to add a package name suffix for the manpages... " >&6; } - # Check whether --enable-man-suffix was given. -if test "${enable_man_suffix+set}" = set; then : - enableval=$enable_man_suffix; case $enableval in + 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" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; no) ;; *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";; esac else enableval="no" -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5 -$as_echo "$enableval" >&6; } +fi; + echo "$as_me:$LINENO: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 @@ -2456,10 +1460,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2469,37 +1473,35 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done -IFS=$as_save_IFS +done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -2509,50 +1511,39 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done -IFS=$as_save_IFS +done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi + CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2562,40 +1553,80 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done -IFS=$as_save_IFS +done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - - fi fi -if test -z "$CC"; then +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2603,19 +1634,18 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done -IFS=$as_save_IFS +done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. @@ -2633,25 +1663,24 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe + for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2661,41 +1690,39 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done -IFS=$as_save_IFS +done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC - for ac_prog in cl.exe + for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -2705,78 +1732,66 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done -IFS=$as_save_IFS +done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - test -n "$ac_ct_CC" && break done - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi + CC=$ac_ct_CC fi fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } -cat confdefs.h - <<_ACEOF >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. */ int @@ -2788,108 +1803,112 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +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. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' +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 | *.map | *.inf | *.dSYM | *.o | *.obj ) + *.$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;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. + 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 -test "$ac_cv_exeext" = no && ac_cv_exeext= - else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } + ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (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 + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -2897,90 +1916,38 @@ $as_echo "$ac_try_echo"; } >&5 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 | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.$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 - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } + { { 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 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 +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 confdefs.h - <<_ACEOF >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. */ int @@ -2992,46 +1959,45 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi + rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 +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 confdefs.h - <<_ACEOF >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. */ int @@ -3045,49 +2011,55 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 - ac_compiler_gnu=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} +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 -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3098,34 +2070,39 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - +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 - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes +ac_cv_prog_cc_g=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } +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 @@ -3141,18 +2118,23 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +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_c89=no + ac_cv_prog_cc_stdc=no ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >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. */ #include #include -struct stat; +#include +#include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3175,17 +2157,12 @@ static char *f (char * (*g) (char **, int), char **p, ...) /* 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 -std is added to get + 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 -std. */ + that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -3200,37 +2177,205 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; return 0; } _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# 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" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$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 core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break +rm -f conftest.err conftest.$ac_objext done -rm -f conftest.$ac_ext +rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +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 +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' @@ -3238,14 +2383,18 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do - cat confdefs.h - <<_ACEOF >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. */ #ifndef __cplusplus typedef int foo_t; @@ -3254,16 +2403,41 @@ $ac_kw foo_t foo () {return 0; } #endif _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw +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_c_inline=$ac_kw; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } +echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 + case $ac_cv_c_inline in inline | yes) ;; @@ -3295,15 +2469,15 @@ 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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" @@ -3317,7 +2491,11 @@ do # 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 confdefs.h - <<_ACEOF >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. */ #ifdef __STDC__ # include @@ -3326,34 +2504,78 @@ do #endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - +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.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers + # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. - cat confdefs.h - <<_ACEOF >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. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +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 # Broken: success on invalid input. continue else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then break fi @@ -3365,8 +2587,8 @@ fi else ac_cv_prog_CPP=$CPP fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do @@ -3376,7 +2598,11 @@ do # 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 confdefs.h - <<_ACEOF >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. */ #ifdef __STDC__ # include @@ -3385,40 +2611,85 @@ do #endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - +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.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers + # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. - cat confdefs.h - <<_ACEOF >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. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else +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 + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } fi ac_ext=c @@ -3428,142 +2699,31 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 +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 confdefs.h - <<_ACEOF >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. */ #include #include @@ -3578,23 +2738,51 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 - ac_cv_header_stdc=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +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 confdefs.h - <<_ACEOF >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. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - + $EGREP "memchr" >/dev/null 2>&1; then + : else ac_cv_header_stdc=no fi @@ -3604,14 +2792,18 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >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. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - + $EGREP "free" >/dev/null 2>&1; then + : else ac_cv_header_stdc=no fi @@ -3621,13 +2813,16 @@ fi 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 : + if test "$cross_compiling" = yes; then : else - cat confdefs.h - <<_ACEOF >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. */ #include -#include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) @@ -3647,39 +2842,109 @@ main () for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) - return 2; - return 0; + exit(2); + exit (0); } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - +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 + : else - ac_cv_header_stdc=no + 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 core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } +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 -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + 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=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : +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 `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -3688,13 +2953,17 @@ done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dirent.h" >&5 -$as_echo_n "checking dirent.h... " >&6; } -if ${tcl_cv_dirent_h+:} false; then : - $as_echo_n "(cached) " >&6 + 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 confdefs.h - <<_ACEOF >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. */ #include #include @@ -3724,352 +2993,1596 @@ closedir(d); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_dirent_h=yes else - tcl_cv_dirent_h=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_dirent_h=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_dirent_h" >&5 -$as_echo "$tcl_cv_dirent_h" >&6; } +echo "$as_me:$LINENO: result: $tcl_cv_dirent_h" >&5 +echo "${ECHO_T}$tcl_cv_dirent_h" >&6 if test $tcl_cv_dirent_h = no; then -$as_echo "#define NO_DIRENT_H 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define NO_DIRENT_H 1 +_ACEOF fi - ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" -if test "x$ac_cv_header_float_h" = xyes; then : - + if test "${ac_cv_header_float_h+set}" = set; then + echo "$as_me:$LINENO: checking for float.h" >&5 +echo $ECHO_N "checking for float.h... $ECHO_C" >&6 +if test "${ac_cv_header_float_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 +echo "${ECHO_T}$ac_cv_header_float_h" >&6 else + # Is the header compilable? +echo "$as_me:$LINENO: checking float.h usability" >&5 +echo $ECHO_N "checking float.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 +_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 -$as_echo "#define NO_FLOAT_H 1" >>confdefs.h - +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 float.h presence" >&5 +echo $ECHO_N "checking float.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 +_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_fn_c_check_header_mongrel "$LINENO" "values.h" "ac_cv_header_values_h" "$ac_includes_default" -if test "x$ac_cv_header_values_h" = xyes; then : + 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: float.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: float.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: float.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: float.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: float.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: float.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: float.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: float.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: float.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: float.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: float.h: 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 float.h" >&5 +echo $ECHO_N "checking for float.h... $ECHO_C" >&6 +if test "${ac_cv_header_float_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - -$as_echo "#define NO_VALUES_H 1" >>confdefs.h + ac_cv_header_float_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5 +echo "${ECHO_T}$ac_cv_header_float_h" >&6 fi +if test $ac_cv_header_float_h = yes; then + : +else +cat >>confdefs.h <<\_ACEOF +#define NO_FLOAT_H 1 +_ACEOF - ac_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" -if test "x$ac_cv_header_limits_h" = xyes; then : +fi -$as_echo "#define HAVE_LIMITS_H 1" >>confdefs.h + if test "${ac_cv_header_values_h+set}" = set; then + echo "$as_me:$LINENO: checking for values.h" >&5 +echo $ECHO_N "checking for values.h... $ECHO_C" >&6 +if test "${ac_cv_header_values_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 +echo "${ECHO_T}$ac_cv_header_values_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking values.h usability" >&5 +echo $ECHO_N "checking values.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 +_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 -$as_echo "#define NO_LIMITS_H 1" >>confdefs.h +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 values.h presence" >&5 +echo $ECHO_N "checking values.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 +_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 - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - tcl_ok=1 +# 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: values.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: values.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: values.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: values.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: values.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: values.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: values.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: values.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: values.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: values.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: values.h: 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 values.h" >&5 +echo $ECHO_N "checking for values.h... $ECHO_C" >&6 +if test "${ac_cv_header_values_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - tcl_ok=0 + ac_cv_header_values_h=$ac_header_preproc fi +echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5 +echo "${ECHO_T}$ac_cv_header_values_h" >&6 +fi +if test $ac_cv_header_values_h = yes; then + : +else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - +cat >>confdefs.h <<\_ACEOF +#define NO_VALUES_H 1 _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strtol" >/dev/null 2>&1; then : -else - tcl_ok=0 fi -rm -f conftest* - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include + if test "${ac_cv_header_limits_h+set}" = set; then + echo "$as_me:$LINENO: checking for limits.h" >&5 +echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 +if test "${ac_cv_header_limits_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 +echo "${ECHO_T}$ac_cv_header_limits_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking limits.h usability" >&5 +echo $ECHO_N "checking limits.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strtoul" >/dev/null 2>&1; then : - +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_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 - tcl_ok=0 + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no fi -rm -f conftest* +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 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +# Is the header present? +echo "$as_me:$LINENO: checking limits.h presence" >&5 +echo $ECHO_N "checking limits.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 - +#include _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strtod" >/dev/null 2>&1; then : - +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 - tcl_ok=0 + ac_cpp_err=yes fi -rm -f conftest* - - if test $tcl_ok = 0; then +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 -$as_echo "#define NO_STDLIB_H 1" >>confdefs.h + 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 - fi - ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" -if test "x$ac_cv_header_string_h" = xyes; then : - tcl_ok=1 +# 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: limits.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: limits.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: limits.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: limits.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: limits.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: limits.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: limits.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: limits.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: limits.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: limits.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: limits.h: 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 limits.h" >&5 +echo $ECHO_N "checking for limits.h... $ECHO_C" >&6 +if test "${ac_cv_header_limits_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - tcl_ok=0 + ac_cv_header_limits_h=$ac_header_preproc fi +echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5 +echo "${ECHO_T}$ac_cv_header_limits_h" >&6 +fi +if test $ac_cv_header_limits_h = yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIMITS_H 1 _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strstr" >/dev/null 2>&1; then : else - tcl_ok=0 -fi -rm -f conftest* - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include +cat >>confdefs.h <<\_ACEOF +#define NO_LIMITS_H 1 _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "strerror" >/dev/null 2>&1; then : -else - tcl_ok=0 fi -rm -f conftest* - - - # See also memmove check below for a place where NO_STRING_H can be - # set and why. - - if test $tcl_ok = 0; then - -$as_echo "#define NO_STRING_H 1" >>confdefs.h - - fi - ac_fn_c_check_header_mongrel "$LINENO" "sys/wait.h" "ac_cv_header_sys_wait_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_wait_h" = xyes; then : + if test "${ac_cv_header_stdlib_h+set}" = set; then + echo "$as_me:$LINENO: checking for stdlib.h" >&5 +echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_stdlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 else + # Is the header compilable? +echo "$as_me:$LINENO: checking stdlib.h usability" >&5 +echo $ECHO_N "checking stdlib.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 +_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 -$as_echo "#define NO_SYS_WAIT_H 1" >>confdefs.h - +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 - - ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - +# Is the header present? +echo "$as_me:$LINENO: checking stdlib.h presence" >&5 +echo $ECHO_N "checking stdlib.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 +_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 -$as_echo "#define NO_DLFCN_H 1" >>confdefs.h + 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: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: stdlib.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: stdlib.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: stdlib.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: stdlib.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: stdlib.h: 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 stdlib.h" >&5 +echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_stdlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_stdlib_h=$ac_header_preproc fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6 +fi +if test $ac_cv_header_stdlib_h = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi - # OS/390 lacks sys/param.h (and doesn't need it, by chance). - for ac_header in sys/param.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_param_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_PARAM_H 1 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtol" >/dev/null 2>&1; then + : +else + tcl_ok=0 fi +rm -f conftest* -done - + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtoul" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* -#-------------------------------------------------------------------- -# Determines the correct executable file extension (.exe) -#-------------------------------------------------------------------- + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strtod" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* + if test $tcl_ok = 0; then -#------------------------------------------------------------------------ -# If we're using GCC, see if the compiler understands -pipe. If so, use it. -# It makes compiling go faster. (This is only a performance feature.) -#------------------------------------------------------------------------ +cat >>confdefs.h <<\_ACEOF +#define NO_STDLIB_H 1 +_ACEOF -if test -z "$no_pipe" && test -n "$GCC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the compiler understands -pipe" >&5 -$as_echo_n "checking if the compiler understands -pipe... " >&6; } -if ${tcl_cv_cc_pipe+:} false; then : - $as_echo_n "(cached) " >&6 + fi + if test "${ac_cv_header_string_h+set}" = set; then + echo "$as_me:$LINENO: checking for string.h" >&5 +echo $ECHO_N "checking for string.h... $ECHO_C" >&6 +if test "${ac_cv_header_string_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 +echo "${ECHO_T}$ac_cv_header_string_h" >&6 else - - hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Is the header compilable? +echo "$as_me:$LINENO: checking string.h usability" >&5 +echo $ECHO_N "checking string.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 +_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 -int -main () -{ +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 - ; - return 0; -} +# Is the header present? +echo "$as_me:$LINENO: checking string.h presence" >&5 +echo $ECHO_N "checking string.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_cc_pipe=yes +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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 - tcl_cv_cc_pipe=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$hold_cflags -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_pipe" >&5 -$as_echo "$tcl_cv_cc_pipe" >&6; } - if test $tcl_cv_cc_pipe = yes; then - CFLAGS="$CFLAGS -pipe" - fi + 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 -#------------------------------------------------------------------------ -# Threads support -#------------------------------------------------------------------------ + 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: string.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: string.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: string.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: string.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: string.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: string.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: string.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: string.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: string.h: 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 string.h" >&5 +echo $ECHO_N "checking for string.h... $ECHO_C" >&6 +if test "${ac_cv_header_string_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_string_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5 +echo "${ECHO_T}$ac_cv_header_string_h" >&6 - # Check whether --enable-threads was given. -if test "${enable_threads+set}" = set; then : - enableval=$enable_threads; tcl_ok=$enableval +fi +if test $ac_cv_header_string_h = yes; then + tcl_ok=1 else - tcl_ok=yes + tcl_ok=0 fi - if test "${TCL_THREADS}" = 1; then - tcl_threaded_core=1; - fi + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include - if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then - TCL_THREADS=1 - # USE_THREAD_ALLOC tells us to try the special thread-based - # allocator that significantly reduces lock contention +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strstr" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* -$as_echo "#define USE_THREAD_ALLOC 1" >>confdefs.h + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "strerror" >/dev/null 2>&1; then + : +else + tcl_ok=0 +fi +rm -f conftest* -$as_echo "#define _REENTRANT 1" >>confdefs.h - if test "`uname -s`" = "SunOS" ; then + # See also memmove check below for a place where NO_STRING_H can be + # set and why. -$as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + if test $tcl_ok = 0; then - fi +cat >>confdefs.h <<\_ACEOF +#define NO_STRING_H 1 +_ACEOF -$as_echo "#define _THREAD_SAFE 1" >>confdefs.h + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthread" >&5 -$as_echo_n "checking for pthread_mutex_init in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_mutex_init+:} false; then : - $as_echo_n "(cached) " >&6 + if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/wait.h" >&5 +echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/wait.h usability" >&5 +echo $ECHO_N "checking sys/wait.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 +_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 -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_mutex_init (); -int -main () -{ -return pthread_mutex_init (); - ; - return 0; -} +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 sys/wait.h presence" >&5 +echo $ECHO_N "checking sys/wait.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_mutex_init=yes +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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_cv_lib_pthread_pthread_mutex_init=no + ac_cpp_err=yes fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_mutex_init" >&6; } -if test "x$ac_cv_lib_pthread_pthread_mutex_init" = xyes; then : - tcl_ok=yes +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: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/wait.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/wait.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sys/wait.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/wait.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/wait.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/wait.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/wait.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/wait.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/wait.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/wait.h: 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 sys/wait.h" >&5 +echo $ECHO_N "checking for sys/wait.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - tcl_ok=no + ac_cv_header_sys_wait_h=$ac_header_preproc fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 - if test "$tcl_ok" = "no"; then - # Check a little harder for __pthread_mutex_init in the same - # library, as some systems hide it there until pthread.h is - # defined. We could alternatively do an AC_TRY_COMPILE with - # pthread.h, but that will work with libpthread really doesn't - # exist, like AIX 4.2. [Bug: 4359] - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __pthread_mutex_init in -lpthread" >&5 -$as_echo_n "checking for __pthread_mutex_init in -lpthread... " >&6; } -if ${ac_cv_lib_pthread___pthread_mutex_init+:} false; then : - $as_echo_n "(cached) " >&6 +fi +if test $ac_cv_header_sys_wait_h = yes; then + : else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" +cat >>confdefs.h <<\_ACEOF +#define NO_SYS_WAIT_H 1 +_ACEOF + +fi + + + if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo "$as_me:$LINENO: checking for dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking dlfcn.h usability" >&5 +echo $ECHO_N "checking dlfcn.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 +_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 dlfcn.h presence" >&5 +echo $ECHO_N "checking dlfcn.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 +_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: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: dlfcn.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: dlfcn.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: dlfcn.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: dlfcn.h: 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 dlfcn.h" >&5 +echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6 +if test "${ac_cv_header_dlfcn_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_dlfcn_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5 +echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6 + +fi +if test $ac_cv_header_dlfcn_h = yes; then + : +else + +cat >>confdefs.h <<\_ACEOF +#define NO_DLFCN_H 1 +_ACEOF + +fi + + + + # OS/390 lacks sys/param.h (and doesn't need it, by chance). + +for ac_header in sys/param.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 + + + +#-------------------------------------------------------------------- +# Determines the correct executable file extension (.exe) +#-------------------------------------------------------------------- + + + +#------------------------------------------------------------------------ +# If we're using GCC, see if the compiler understands -pipe. If so, use it. +# It makes compiling go faster. (This is only a performance feature.) +#------------------------------------------------------------------------ + +if test -z "$no_pipe" && test -n "$GCC"; then + echo "$as_me:$LINENO: checking if the compiler understands -pipe" >&5 +echo $ECHO_N "checking if the compiler understands -pipe... $ECHO_C" >&6 +if test "${tcl_cv_cc_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" + 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 + tcl_cv_cc_pipe=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_cc_pipe=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$hold_cflags +fi +echo "$as_me:$LINENO: result: $tcl_cv_cc_pipe" >&5 +echo "${ECHO_T}$tcl_cv_cc_pipe" >&6 + if test $tcl_cv_cc_pipe = yes; then + CFLAGS="$CFLAGS -pipe" + fi +fi + +#------------------------------------------------------------------------ +# Threads support +#------------------------------------------------------------------------ + + + # Check whether --enable-threads or --disable-threads was given. +if test "${enable_threads+set}" = set; then + enableval="$enable_threads" + tcl_ok=$enableval +else + tcl_ok=yes +fi; + + if test "${TCL_THREADS}" = 1; then + tcl_threaded_core=1; + fi + + if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then + TCL_THREADS=1 + # USE_THREAD_ALLOC tells us to try the special thread-based + # allocator that significantly reduces lock contention + +cat >>confdefs.h <<\_ACEOF +#define USE_THREAD_ALLOC 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF + + if test "`uname -s`" = "SunOS" ; then + +cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF + + fi + +cat >>confdefs.h <<\_ACEOF +#define _THREAD_SAFE 1 +_ACEOF + + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* 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 pthread_mutex_init (); +int +main () +{ +pthread_mutex_init (); + ; + 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_lib_pthread_pthread_mutex_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread_pthread_mutex_init=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_mutex_init" >&6 +if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then + tcl_ok=yes +else + tcl_ok=no +fi + + if test "$tcl_ok" = "no"; then + # Check a little harder for __pthread_mutex_init in the same + # library, as some systems hide it there until pthread.h is + # defined. We could alternatively do an AC_TRY_COMPILE with + # pthread.h, but that will work with libpthread really doesn't + # exist, like AIX 4.2. [Bug: 4359] + echo "$as_me:$LINENO: checking for __pthread_mutex_init in -lpthread" >&5 +echo $ECHO_N "checking for __pthread_mutex_init in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread___pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* 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 __pthread_mutex_init (); int main () { -return __pthread_mutex_init (); +__pthread_mutex_init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_lib_pthread___pthread_mutex_init=yes else - ac_cv_lib_pthread___pthread_mutex_init=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread___pthread_mutex_init=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5 -$as_echo "$ac_cv_lib_pthread___pthread_mutex_init" >&6; } -if test "x$ac_cv_lib_pthread___pthread_mutex_init" = xyes; then : +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread___pthread_mutex_init" >&6 +if test $ac_cv_lib_pthread___pthread_mutex_init = yes; then tcl_ok=yes else tcl_ok=no @@ -4081,43 +4594,71 @@ fi # The space is needed THREADS_LIBS=" -lpthread" else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lpthreads" >&5 -$as_echo_n "checking for pthread_mutex_init in -lpthreads... " >&6; } -if ${ac_cv_lib_pthreads_pthread_mutex_init+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthreads" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lpthreads... $ECHO_C" >&6 +if test "${ac_cv_lib_pthreads_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthreads $LIBS" -cat confdefs.h - <<_ACEOF >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. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ +/* 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 pthread_mutex_init (); int main () { -return pthread_mutex_init (); +pthread_mutex_init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_lib_pthreads_pthread_mutex_init=yes else - ac_cv_lib_pthreads_pthread_mutex_init=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthreads_pthread_mutex_init=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5 -$as_echo "$ac_cv_lib_pthreads_pthread_mutex_init" >&6; } -if test "x$ac_cv_lib_pthreads_pthread_mutex_init" = xyes; then : +echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_mutex_init" >&6 +if test $ac_cv_lib_pthreads_pthread_mutex_init = yes; then tcl_ok=yes else tcl_ok=no @@ -4127,86 +4668,142 @@ fi # The space is needed THREADS_LIBS=" -lpthreads" else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lc" >&5 -$as_echo_n "checking for pthread_mutex_init in -lc... " >&6; } -if ${ac_cv_lib_c_pthread_mutex_init+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lc... $ECHO_C" >&6 +if test "${ac_cv_lib_c_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" -cat confdefs.h - <<_ACEOF >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. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ +/* 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 pthread_mutex_init (); int main () { -return pthread_mutex_init (); +pthread_mutex_init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_lib_c_pthread_mutex_init=yes else - ac_cv_lib_c_pthread_mutex_init=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_pthread_mutex_init=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_pthread_mutex_init" >&5 -$as_echo "$ac_cv_lib_c_pthread_mutex_init" >&6; } -if test "x$ac_cv_lib_c_pthread_mutex_init" = xyes; then : +echo "$as_me:$LINENO: result: $ac_cv_lib_c_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_c_pthread_mutex_init" >&6 +if test $ac_cv_lib_c_pthread_mutex_init = yes; then tcl_ok=yes else tcl_ok=no fi if test "$tcl_ok" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_mutex_init in -lc_r" >&5 -$as_echo_n "checking for pthread_mutex_init in -lc_r... " >&6; } -if ${ac_cv_lib_c_r_pthread_mutex_init+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for pthread_mutex_init in -lc_r" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -lc_r... $ECHO_C" >&6 +if test "${ac_cv_lib_c_r_pthread_mutex_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" -cat confdefs.h - <<_ACEOF >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. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ +/* 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 pthread_mutex_init (); int main () { -return pthread_mutex_init (); +pthread_mutex_init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_lib_c_r_pthread_mutex_init=yes else - ac_cv_lib_c_r_pthread_mutex_init=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_r_pthread_mutex_init=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5 -$as_echo "$ac_cv_lib_c_r_pthread_mutex_init" >&6; } -if test "x$ac_cv_lib_c_r_pthread_mutex_init" = xyes; then : +echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_mutex_init" >&5 +echo "${ECHO_T}$ac_cv_lib_c_r_pthread_mutex_init" >&6 +if test $ac_cv_lib_c_r_pthread_mutex_init = yes; then tcl_ok=yes else tcl_ok=no @@ -4217,8 +4814,8 @@ fi THREADS_LIBS=" -pthread" else TCL_THREADS=0 - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&5 -$as_echo "$as_me: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&2;} + { echo "$as_me:$LINENO: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&5 +echo "$as_me: WARNING: Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile..." >&2;} fi fi fi @@ -4229,13 +4826,104 @@ $as_echo "$as_me: WARNING: Don't know how to find pthread lib on your system - y ac_saved_libs=$LIBS LIBS="$LIBS $THREADS_LIBS" - for ac_func in pthread_attr_setstacksize pthread_atfork -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + + +for ac_func in pthread_attr_setstacksize pthread_atfork +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 declares $ac_func. + For example, HP-UX 11i 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 to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#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 `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -4246,22 +4934,24 @@ done TCL_THREADS=0 fi # Do checking message here to not mess up interleaved configure output - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for building with threads" >&5 -$as_echo_n "checking for building with threads... " >&6; } + echo "$as_me:$LINENO: checking for building with threads" >&5 +echo $ECHO_N "checking for building with threads... $ECHO_C" >&6 if test "${TCL_THREADS}" = 1; then -$as_echo "#define TCL_THREADS 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define TCL_THREADS 1 +_ACEOF if test "${tcl_threaded_core}" = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (threaded core)" >&5 -$as_echo "yes (threaded core)" >&6; } + echo "$as_me:$LINENO: result: yes (threaded core)" >&5 +echo "${ECHO_T}yes (threaded core)" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi @@ -4273,11 +4963,11 @@ $as_echo "no" >&6; } -# Check whether --with-encoding was given. -if test "${with_encoding+set}" = set; then : - withval=$with_encoding; with_tcencoding=${withval} -fi - +# Check whether --with-encoding or --without-encoding was given. +if test "${with_encoding+set}" = set; then + withval="$with_encoding" + with_tcencoding=${withval} +fi; if test x"${with_tcencoding}" != x ; then @@ -4287,7 +4977,9 @@ _ACEOF else -$as_echo "#define TCL_CFGVAL_ENCODING \"iso8859-1\"" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define TCL_CFGVAL_ENCODING "iso8859-1" +_ACEOF fi @@ -4304,44 +4996,161 @@ $as_echo "#define TCL_CFGVAL_ENCODING \"iso8859-1\"" >>confdefs.h # right (and it must appear before "-lm"). #-------------------------------------------------------------------- - ac_fn_c_check_func "$LINENO" "sin" "ac_cv_func_sin" -if test "x$ac_cv_func_sin" = xyes; then : + echo "$as_me:$LINENO: checking for sin" >&5 +echo $ECHO_N "checking for sin... $ECHO_C" >&6 +if test "${ac_cv_func_sin+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 sin to an innocuous variant, in case declares sin. + For example, HP-UX 11i declares gettimeofday. */ +#define sin innocuous_sin + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char sin (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef sin + +/* 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 sin (); +/* 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_sin) || defined (__stub___sin) +choke me +#else +char (*f) () = sin; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != sin; + ; + 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_sin=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_sin=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_sin" >&5 +echo "${ECHO_T}$ac_cv_func_sin" >&6 +if test $ac_cv_func_sin = yes; then MATH_LIBS="" else MATH_LIBS="-lm" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lieee" >&5 -$as_echo_n "checking for main in -lieee... " >&6; } -if ${ac_cv_lib_ieee_main+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for main in -lieee" >&5 +echo $ECHO_N "checking for main in -lieee... $ECHO_C" >&6 +if test "${ac_cv_lib_ieee_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lieee $LIBS" -cat confdefs.h - <<_ACEOF >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. */ int main () { -return main (); +main (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_lib_ieee_main=yes else - ac_cv_lib_ieee_main=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_ieee_main=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ieee_main" >&5 -$as_echo "$ac_cv_lib_ieee_main" >&6; } -if test "x$ac_cv_lib_ieee_main" = xyes; then : +echo "$as_me:$LINENO: result: $ac_cv_lib_ieee_main" >&5 +echo "${ECHO_T}$ac_cv_lib_ieee_main" >&6 +if test $ac_cv_lib_ieee_main = yes; then MATH_LIBS="-lieee $MATH_LIBS" fi @@ -4351,45 +5160,211 @@ fi # needs net/errno.h to define the socket-related error codes. #-------------------------------------------------------------------- - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -linet" >&5 -$as_echo_n "checking for main in -linet... " >&6; } -if ${ac_cv_lib_inet_main+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for main in -linet" >&5 +echo $ECHO_N "checking for main in -linet... $ECHO_C" >&6 +if test "${ac_cv_lib_inet_main+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-linet $LIBS" -cat confdefs.h - <<_ACEOF >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. */ int main () { -return main (); +main (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_lib_inet_main=yes else - ac_cv_lib_inet_main=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_inet_main=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_main" >&5 -$as_echo "$ac_cv_lib_inet_main" >&6; } -if test "x$ac_cv_lib_inet_main" = xyes; then : +echo "$as_me:$LINENO: result: $ac_cv_lib_inet_main" >&5 +echo "${ECHO_T}$ac_cv_lib_inet_main" >&6 +if test $ac_cv_lib_inet_main = yes; then LIBS="$LIBS -linet" fi - ac_fn_c_check_header_mongrel "$LINENO" "net/errno.h" "ac_cv_header_net_errno_h" "$ac_includes_default" -if test "x$ac_cv_header_net_errno_h" = xyes; then : + if test "${ac_cv_header_net_errno_h+set}" = set; then + echo "$as_me:$LINENO: checking for net/errno.h" >&5 +echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_net_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking net/errno.h usability" >&5 +echo $ECHO_N "checking net/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 +_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 net/errno.h presence" >&5 +echo $ECHO_N "checking net/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 +_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: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: net/errno.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: net/errno.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: net/errno.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: net/errno.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: net/errno.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: net/errno.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: net/errno.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: net/errno.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: net/errno.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: net/errno.h: 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 net/errno.h" >&5 +echo $ECHO_N "checking for net/errno.h... $ECHO_C" >&6 +if test "${ac_cv_header_net_errno_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_net_errno_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5 +echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6 + +fi +if test $ac_cv_header_net_errno_h = yes; then -$as_echo "#define HAVE_NET_ERRNO_H 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_NET_ERRNO_H 1 +_ACEOF fi @@ -4414,115 +5389,527 @@ fi #-------------------------------------------------------------------- tcl_checkBoth=0 - ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" -if test "x$ac_cv_func_connect" = xyes; then : - tcl_checkSocket=0 + echo "$as_me:$LINENO: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - tcl_checkSocket=1 -fi + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define connect to an innocuous variant, in case declares connect. + For example, HP-UX 11i declares gettimeofday. */ +#define connect innocuous_connect - if test "$tcl_checkSocket" = 1; then - ac_fn_c_check_func "$LINENO" "setsockopt" "ac_cv_func_setsockopt" -if test "x$ac_cv_func_setsockopt" = xyes; then : +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setsockopt in -lsocket" >&5 -$as_echo_n "checking for setsockopt in -lsocket... " >&6; } -if ${ac_cv_lib_socket_setsockopt+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ +#undef connect + +/* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" +{ #endif -char setsockopt (); +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +/* 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_connect) || defined (__stub___connect) +choke me +#else +char (*f) () = connect; +#endif +#ifdef __cplusplus +} +#endif + int main () { -return setsockopt (); +return f != connect; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_socket_setsockopt=yes +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_connect=yes else - ac_cv_lib_socket_setsockopt=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_connect=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_setsockopt" >&5 -$as_echo "$ac_cv_lib_socket_setsockopt" >&6; } -if test "x$ac_cv_lib_socket_setsockopt" = xyes; then : - LIBS="$LIBS -lsocket" +echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 +if test $ac_cv_func_connect = yes; then + tcl_checkSocket=0 else - tcl_checkBoth=1 -fi - + tcl_checkSocket=1 fi - fi - if test "$tcl_checkBoth" = 1; then - tk_oldLibs=$LIBS - LIBS="$LIBS -lsocket -lnsl" - ac_fn_c_check_func "$LINENO" "accept" "ac_cv_func_accept" -if test "x$ac_cv_func_accept" = xyes; then : - tcl_checkNsl=0 + if test "$tcl_checkSocket" = 1; then + echo "$as_me:$LINENO: checking for setsockopt" >&5 +echo $ECHO_N "checking for setsockopt... $ECHO_C" >&6 +if test "${ac_cv_func_setsockopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - LIBS=$tk_oldLibs -fi + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define setsockopt to an innocuous variant, in case declares setsockopt. + For example, HP-UX 11i declares gettimeofday. */ +#define setsockopt innocuous_setsockopt - fi - ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = xyes; then : +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char setsockopt (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 -$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } -if ${ac_cv_lib_nsl_gethostbyname+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ +#undef setsockopt + +/* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" +{ #endif -char gethostbyname (); +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char setsockopt (); +/* 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_setsockopt) || defined (__stub___setsockopt) +choke me +#else +char (*f) () = setsockopt; +#endif +#ifdef __cplusplus +} +#endif + int main () { -return gethostbyname (); +return f != setsockopt; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_nsl_gethostbyname=yes +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_setsockopt=yes else - ac_cv_lib_nsl_gethostbyname=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_setsockopt=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_func_setsockopt" >&6 +if test $ac_cv_func_setsockopt = yes; then + : +else + echo "$as_me:$LINENO: checking for setsockopt in -lsocket" >&5 +echo $ECHO_N "checking for setsockopt in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_setsockopt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* 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 setsockopt (); +int +main () +{ +setsockopt (); + ; + 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_lib_socket_setsockopt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_setsockopt=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_setsockopt" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_setsockopt" >&6 +if test $ac_cv_lib_socket_setsockopt = yes; then + LIBS="$LIBS -lsocket" +else + tcl_checkBoth=1 +fi + +fi + + fi + if test "$tcl_checkBoth" = 1; then + tk_oldLibs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + echo "$as_me:$LINENO: checking for accept" >&5 +echo $ECHO_N "checking for accept... $ECHO_C" >&6 +if test "${ac_cv_func_accept+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 accept to an innocuous variant, in case declares accept. + For example, HP-UX 11i declares gettimeofday. */ +#define accept innocuous_accept + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char accept (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef accept + +/* 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 accept (); +/* 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_accept) || defined (__stub___accept) +choke me +#else +char (*f) () = accept; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != accept; + ; + 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_accept=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_accept=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_accept" >&5 +echo "${ECHO_T}$ac_cv_func_accept" >&6 +if test $ac_cv_func_accept = yes; then + tcl_checkNsl=0 +else + LIBS=$tk_oldLibs +fi + + fi + echo "$as_me:$LINENO: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+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 gethostbyname to an innocuous variant, in case declares gethostbyname. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyname innocuous_gethostbyname + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyname + +/* 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 gethostbyname (); +/* 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_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +char (*f) () = gethostbyname; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gethostbyname; + ; + 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_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gethostbyname=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 +if test $ac_cv_func_gethostbyname = yes; then + : +else + echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* 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 gethostbyname (); +int +main () +{ +gethostbyname (); + ; + 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_lib_nsl_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_nsl_gethostbyname=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 -$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } -if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then LIBS="$LIBS -lnsl" fi @@ -4534,15 +5921,15 @@ fi LIBS="$LIBS$THREADS_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5 -$as_echo_n "checking how to build libraries... " >&6; } - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; tcl_ok=$enableval + echo "$as_me:$LINENO: checking how to build libraries" >&5 +echo $ECHO_N "checking how to build libraries... $ECHO_C" >&6 + # Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + tcl_ok=$enableval else tcl_ok=yes -fi - +fi; if test "${enable_shared+set}" = set; then enableval="$enable_shared" @@ -4552,15 +5939,17 @@ fi fi if test "$tcl_ok" = "yes" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: shared" >&5 -$as_echo "shared" >&6; } + echo "$as_me:$LINENO: result: shared" >&5 +echo "${ECHO_T}shared" >&6 SHARED_BUILD=1 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5 -$as_echo "static" >&6; } + echo "$as_me:$LINENO: result: static" >&5 +echo "${ECHO_T}static" >&6 SHARED_BUILD=0 -$as_echo "#define STATIC_BUILD 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define STATIC_BUILD 1 +_ACEOF fi @@ -4572,10 +5961,10 @@ $as_echo "#define STATIC_BUILD 1" >>confdefs.h #-------------------------------------------------------------------- - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5 -$as_echo_n "checking for tclsh... " >&6; } - if ${ac_cv_path_tclsh+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for tclsh" >&5 +echo $ECHO_N "checking for tclsh... $ECHO_C" >&6 + if test "${ac_cv_path_tclsh+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else search_path=`echo ${PATH} | sed -e 's/:/ /g'` @@ -4596,13 +5985,13 @@ fi if test -f "$ac_cv_path_tclsh" ; then TCLSH_PROG="$ac_cv_path_tclsh" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH_PROG" >&5 -$as_echo "$TCLSH_PROG" >&6; } + echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5 +echo "${ECHO_T}$TCLSH_PROG" >&6 else # It is not an error if an installed version of Tcl can't be located. TCLSH_PROG="" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: No tclsh found on PATH" >&5 -$as_echo "No tclsh found on PATH" >&6; } + echo "$as_me:$LINENO: result: No tclsh found on PATH" >&5 +echo "${ECHO_T}No tclsh found on PATH" >&6 fi @@ -4615,113 +6004,378 @@ fi #------------------------------------------------------------------------ zlib_ok=yes -ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = xyes; then : +if test "${ac_cv_header_zlib_h+set}" = set; then + echo "$as_me:$LINENO: checking for zlib.h" >&5 +echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_zlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_zlib_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking zlib.h usability" >&5 +echo $ECHO_N "checking zlib.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 +_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_fn_c_check_type "$LINENO" "gz_header" "ac_cv_type_gz_header" "#include -" -if test "x$ac_cv_type_gz_header" = xyes; then : +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 zlib.h presence" >&5 +echo $ECHO_N "checking zlib.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 +_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 - zlib_ok=no + 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 - zlib_ok=no + 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: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: zlib.h: 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 zlib.h" >&5 +echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6 +if test "${ac_cv_header_zlib_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_zlib_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 +echo "${ECHO_T}$ac_cv_header_zlib_h" >&6 -if test $zlib_ok = yes; then : +fi +if test $ac_cv_header_zlib_h = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing deflateSetHeader" >&5 -$as_echo_n "checking for library containing deflateSetHeader... " >&6; } -if ${ac_cv_search_deflateSetHeader+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for gz_header" >&5 +echo $ECHO_N "checking for gz_header... $ECHO_C" >&6 +if test "${ac_cv_type_gz_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >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. */ +#include -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char deflateSetHeader (); int main () { -return deflateSetHeader (); +if ((gz_header *) 0) + return 0; +if (sizeof (gz_header)) + return 0; ; return 0; } _ACEOF -for ac_lib in '' z; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_deflateSetHeader=$ac_res +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_gz_header=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_gz_header=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_deflateSetHeader+:} false; then : - break +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -done -if ${ac_cv_search_deflateSetHeader+:} false; then : - +echo "$as_me:$LINENO: result: $ac_cv_type_gz_header" >&5 +echo "${ECHO_T}$ac_cv_type_gz_header" >&6 +if test $ac_cv_type_gz_header = yes; then + : else - ac_cv_search_deflateSetHeader=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS + zlib_ok=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_deflateSetHeader" >&5 -$as_echo "$ac_cv_search_deflateSetHeader" >&6; } -ac_res=$ac_cv_search_deflateSetHeader -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else - zlib_ok=no - -fi - + zlib_ok=no fi -if test $zlib_ok = no; then : - ZLIB_OBJS=\${ZLIB_OBJS} - - ZLIB_SRCS=\${ZLIB_SRCS} - - ZLIB_INCLUDE=-I\${ZLIB_DIR} - - -fi -$as_echo "#define HAVE_ZLIB 1" >>confdefs.h +if test $zlib_ok = yes; then + echo "$as_me:$LINENO: checking for library containing deflateSetHeader" >&5 +echo $ECHO_N "checking for library containing deflateSetHeader... $ECHO_C" >&6 +if test "${ac_cv_search_deflateSetHeader+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_deflateSetHeader=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -#-------------------------------------------------------------------- -# The statements below define a collection of compile flags. This -# macro depends on the value of SHARED_BUILD, and should be called -# after SC_ENABLE_SHARED checks the configure switches. +/* 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 deflateSetHeader (); +int +main () +{ +deflateSetHeader (); + ; + 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_search_deflateSetHeader="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_deflateSetHeader" = no; then + for ac_lib in z; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* 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 deflateSetHeader (); +int +main () +{ +deflateSetHeader (); + ; + 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_search_deflateSetHeader="-l$ac_lib" +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_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_deflateSetHeader" >&5 +echo "${ECHO_T}$ac_cv_search_deflateSetHeader" >&6 +if test "$ac_cv_search_deflateSetHeader" != no; then + test "$ac_cv_search_deflateSetHeader" = "none required" || LIBS="$ac_cv_search_deflateSetHeader $LIBS" + +else + + zlib_ok=no + +fi + +fi + +if test $zlib_ok = no; then + + ZLIB_OBJS=\${ZLIB_OBJS} + + ZLIB_SRCS=\${ZLIB_SRCS} + + ZLIB_INCLUDE=-I\${ZLIB_DIR} + + +fi + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ZLIB 1 +_ACEOF + + +#-------------------------------------------------------------------- +# The statements below define a collection of compile flags. This +# macro depends on the value of SHARED_BUILD, and should be called +# after SC_ENABLE_SHARED checks the configure switches. #-------------------------------------------------------------------- if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. @@ -4731,37 +6385,35 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done -IFS=$as_save_IFS +done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. @@ -4771,38 +6423,28 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done -IFS=$as_save_IFS +done + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi + RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi @@ -4811,47 +6453,52 @@ fi # Step 0.a: Enable 64 bit support? - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if 64bit support is requested" >&5 -$as_echo_n "checking if 64bit support is requested... " >&6; } - # Check whether --enable-64bit was given. -if test "${enable_64bit+set}" = set; then : - enableval=$enable_64bit; do64bit=$enableval + echo "$as_me:$LINENO: checking if 64bit support is requested" >&5 +echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6 + # Check whether --enable-64bit or --disable-64bit was given. +if test "${enable_64bit+set}" = set; then + enableval="$enable_64bit" + do64bit=$enableval else do64bit=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $do64bit" >&5 -$as_echo "$do64bit" >&6; } +fi; + echo "$as_me:$LINENO: result: $do64bit" >&5 +echo "${ECHO_T}$do64bit" >&6 # Step 0.b: Enable Solaris 64 bit VIS support? - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if 64bit Sparc VIS support is requested" >&5 -$as_echo_n "checking if 64bit Sparc VIS support is requested... " >&6; } - # Check whether --enable-64bit-vis was given. -if test "${enable_64bit_vis+set}" = set; then : - enableval=$enable_64bit_vis; do64bitVIS=$enableval + echo "$as_me:$LINENO: checking if 64bit Sparc VIS support is requested" >&5 +echo $ECHO_N "checking if 64bit Sparc VIS support is requested... $ECHO_C" >&6 + # Check whether --enable-64bit-vis or --disable-64bit-vis was given. +if test "${enable_64bit_vis+set}" = set; then + enableval="$enable_64bit_vis" + do64bitVIS=$enableval else do64bitVIS=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $do64bitVIS" >&5 -$as_echo "$do64bitVIS" >&6; } +fi; + echo "$as_me:$LINENO: result: $do64bitVIS" >&5 +echo "${ECHO_T}$do64bitVIS" >&6 # Force 64bit on with VIS - if test "$do64bitVIS" = "yes"; then : + if test "$do64bitVIS" = "yes"; then do64bit=yes fi + # Step 0.c: Check if visibility support is available. Do this here so # that platform specific alternatives can be used below if this fails. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports visibility \"hidden\"" >&5 -$as_echo_n "checking if compiler supports visibility \"hidden\"... " >&6; } -if ${tcl_cv_cc_visibility_hidden+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking if compiler supports visibility \"hidden\"" >&5 +echo $ECHO_N "checking if compiler supports visibility \"hidden\"... $ECHO_C" >&6 +if test "${tcl_cv_cc_visibility_hidden+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" - cat confdefs.h - <<_ACEOF >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. */ extern __attribute__((__visibility__("hidden"))) void f(void); @@ -4864,50 +6511,79 @@ f(); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_cc_visibility_hidden=yes else - tcl_cv_cc_visibility_hidden=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_cc_visibility_hidden=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_visibility_hidden" >&5 -$as_echo "$tcl_cv_cc_visibility_hidden" >&6; } - if test $tcl_cv_cc_visibility_hidden = yes; then : +echo "$as_me:$LINENO: result: $tcl_cv_cc_visibility_hidden" >&5 +echo "${ECHO_T}$tcl_cv_cc_visibility_hidden" >&6 + if test $tcl_cv_cc_visibility_hidden = yes; then -$as_echo "#define MODULE_SCOPE extern __attribute__((__visibility__(\"hidden\")))" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define MODULE_SCOPE extern __attribute__((__visibility__("hidden"))) +_ACEOF -$as_echo "#define HAVE_HIDDEN 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_HIDDEN 1 +_ACEOF fi + # Step 0.d: Disable -rpath support? - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if rpath support is requested" >&5 -$as_echo_n "checking if rpath support is requested... " >&6; } - # Check whether --enable-rpath was given. -if test "${enable_rpath+set}" = set; then : - enableval=$enable_rpath; doRpath=$enableval + echo "$as_me:$LINENO: checking if rpath support is requested" >&5 +echo $ECHO_N "checking if rpath support is requested... $ECHO_C" >&6 + # Check whether --enable-rpath or --disable-rpath was given. +if test "${enable_rpath+set}" = set; then + enableval="$enable_rpath" + doRpath=$enableval else doRpath=yes -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doRpath" >&5 -$as_echo "$doRpath" >&6; } +fi; + echo "$as_me:$LINENO: result: $doRpath" >&5 +echo "${ECHO_T}$doRpath" >&6 # Step 1: set the variable "system" to hold the name and version number # for the system. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking system version" >&5 -$as_echo_n "checking system version... " >&6; } -if ${tcl_cv_sys_version+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking system version" >&5 +echo $ECHO_N "checking system version... $ECHO_C" >&6 +if test "${tcl_cv_sys_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -f /usr/lib/NextStep/software_version; then @@ -4915,8 +6591,8 @@ else else tcl_cv_sys_version=`uname -s`-`uname -r` if test "$?" -ne 0 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: can't find uname command" >&5 -$as_echo "$as_me: WARNING: can't find uname command" >&2;} + { echo "$as_me:$LINENO: WARNING: can't find uname command" >&5 +echo "$as_me: WARNING: can't find uname command" >&2;} tcl_cv_sys_version=unknown else # Special check for weird MP-RAS system (uname returns weird @@ -4932,51 +6608,79 @@ $as_echo "$as_me: WARNING: can't find uname command" >&2;} fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_sys_version" >&5 -$as_echo "$tcl_cv_sys_version" >&6; } +echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5 +echo "${ECHO_T}$tcl_cv_sys_version" >&6 system=$tcl_cv_sys_version # Step 2: check for existence of -ldl library. This is needed because # Linux can use either -ldl or -ldld for dynamic loading. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >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. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ +/* 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 dlopen (); int main () { -return dlopen (); +dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_lib_dl_dlopen=yes else - ac_cv_lib_dl_dlopen=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then have_dl=yes else have_dl=no @@ -5002,7 +6706,7 @@ fi ECHO_VERSION='`echo ${VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g - if test "$GCC" = yes; then : + if test "$GCC" = yes; then CFLAGS_OPTIMIZE=-O2 CFLAGS_WARNING="-Wall" @@ -5013,13 +6717,14 @@ else CFLAGS_WARNING="" fi + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. @@ -5029,37 +6734,35 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done -IFS=$as_save_IFS +done fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. @@ -5069,38 +6772,27 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done -IFS=$as_save_IFS +done fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } + echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test "x$ac_ct_AR" = x; then - AR="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi + AR=$ac_ct_AR else AR="$ac_cv_prog_AR" fi @@ -5110,12 +6802,13 @@ fi PLAT_OBJS="" PLAT_SRCS="" LDAIX_SRC="" - if test x"${SHLIB_VERSION}" = x; then : + if test x"${SHLIB_VERSION}" = x; then SHLIB_VERSION="1.0" fi + case $system in AIX-*) - if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"; then : + if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"; then # AIX requires the _r compiler when gcc isn't being used case "${CC}" in @@ -5127,10 +6820,11 @@ fi CC=`echo "$CC" | sed -e 's/^\([^ ]*\)/\1_r/'` ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using $CC for compiling with threads" >&5 -$as_echo "Using $CC for compiling with threads" >&6; } + echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5 +echo "${ECHO_T}Using $CC for compiling with threads" >&6 fi + LIBS="$LIBS -lc" SHLIB_CFLAGS="" SHLIB_SUFFIX=".so" @@ -5143,12 +6837,12 @@ fi LDAIX_SRC='$(UNIX_DIR)/ldAix' # Check to enable 64-bit flags for compiler/linker - if test "$do64bit" = yes; then : + if test "$do64bit" = yes; then - if test "$GCC" = yes; then : + if test "$GCC" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5 -$as_echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} + { 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 @@ -5161,15 +6855,17 @@ else fi + fi - if test "`uname -m`" = ia64; then : + + if test "`uname -m`" = ia64; then # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC SHLIB_LD="/usr/ccs/bin/ld -G -z text" # AIX-5 has dl* in libc.so DL_LIBS="" - if test "$GCC" = yes; then : + if test "$GCC" = yes; then CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' @@ -5178,11 +6874,12 @@ else CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' fi + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' else - if test "$GCC" = yes; then : + if test "$GCC" = yes; then SHLIB_LD='${CC} -shared -Wl,-bexpall' @@ -5192,12 +6889,14 @@ else LDFLAGS="$LDFLAGS -brtl" fi + SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}" DL_LIBS="-ldl" CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi + ;; BeOS*) SHLIB_CFLAGS="-fPIC" @@ -5211,43 +6910,71 @@ fi # -lsocket, even if the network functions are in -lnet which # is always linked to, for compatibility. #----------------------------------------------------------- - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lbind" >&5 -$as_echo_n "checking for inet_ntoa in -lbind... " >&6; } -if ${ac_cv_lib_bind_inet_ntoa+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for inet_ntoa in -lbind" >&5 +echo $ECHO_N "checking for inet_ntoa in -lbind... $ECHO_C" >&6 +if test "${ac_cv_lib_bind_inet_ntoa+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbind $LIBS" -cat confdefs.h - <<_ACEOF >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. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ +/* 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 inet_ntoa (); int main () { -return inet_ntoa (); +inet_ntoa (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_lib_bind_inet_ntoa=yes else - ac_cv_lib_bind_inet_ntoa=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_bind_inet_ntoa=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bind_inet_ntoa" >&5 -$as_echo "$ac_cv_lib_bind_inet_ntoa" >&6; } -if test "x$ac_cv_lib_bind_inet_ntoa" = xyes; then : +echo "$as_me:$LINENO: result: $ac_cv_lib_bind_inet_ntoa" >&5 +echo "${ECHO_T}$ac_cv_lib_bind_inet_ntoa" >&6 +if test $ac_cv_lib_bind_inet_ntoa = yes; then LIBS="$LIBS -lbind -lsocket" fi @@ -5284,12 +7011,16 @@ fi TCL_NEEDS_EXP_FILE=1 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.dll.a' SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$@.a" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Cygwin version of gcc" >&5 -$as_echo_n "checking for Cygwin version of gcc... " >&6; } -if ${ac_cv_cygwin+:} false; then : - $as_echo_n "(cached) " >&6 + 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 confdefs.h - <<_ACEOF >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. */ #ifdef __CYGWIN__ @@ -5304,21 +7035,49 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 - ac_cv_cygwin=yes + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_cygwin=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cygwin" >&5 -$as_echo "$ac_cv_cygwin" >&6; } +echo "$as_me:$LINENO: result: $ac_cv_cygwin" >&5 +echo "${ECHO_T}$ac_cv_cygwin" >&6 if test "$ac_cv_cygwin" = "no"; then - as_fn_error $? "${CC} is not a cygwin compiler." "$LINENO" 5 + { { echo "$as_me:$LINENO: error: ${CC} is not a cygwin compiler." >&5 +echo "$as_me: error: ${CC} is not a cygwin compiler." >&2;} + { (exit 1); exit 1; }; } fi if test "x${TCL_THREADS}" = "x0"; then - as_fn_error $? "CYGWIN compile is only supported with --enable-threads" "$LINENO" 5 + { { echo "$as_me:$LINENO: error: CYGWIN compile is only supported with --enable-threads" >&5 +echo "$as_me: error: CYGWIN compile is only supported with --enable-threads" >&2;} + { (exit 1); exit 1; }; } fi do64bit_ok=yes if test "x${SHARED_BUILD}" = "x1"; then @@ -5348,43 +7107,71 @@ $as_echo "$ac_cv_cygwin" >&6; } SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}' DL_OBJS="tclLoadDl.o" DL_LIBS="-lroot" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntoa in -lnetwork" >&5 -$as_echo_n "checking for inet_ntoa in -lnetwork... " >&6; } -if ${ac_cv_lib_network_inet_ntoa+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for inet_ntoa in -lnetwork" >&5 +echo $ECHO_N "checking for inet_ntoa in -lnetwork... $ECHO_C" >&6 +if test "${ac_cv_lib_network_inet_ntoa+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnetwork $LIBS" -cat confdefs.h - <<_ACEOF >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. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ +/* 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 inet_ntoa (); int main () { -return inet_ntoa (); +inet_ntoa (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_lib_network_inet_ntoa=yes else - ac_cv_lib_network_inet_ntoa=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_network_inet_ntoa=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_network_inet_ntoa" >&5 -$as_echo "$ac_cv_lib_network_inet_ntoa" >&6; } -if test "x$ac_cv_lib_network_inet_ntoa" = xyes; then : +echo "$as_me:$LINENO: result: $ac_cv_lib_network_inet_ntoa" >&5 +echo "${ECHO_T}$ac_cv_lib_network_inet_ntoa" >&6 +if test $ac_cv_lib_network_inet_ntoa = yes; then LIBS="$LIBS -lnetwork" fi @@ -5392,14 +7179,18 @@ fi HP-UX-*.11.*) # Use updated header definitions where possible -$as_echo "#define _XOPEN_SOURCE_EXTENDED 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _XOPEN_SOURCE_EXTENDED 1 +_ACEOF -$as_echo "#define _XOPEN_SOURCE 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _XOPEN_SOURCE 1 +_ACEOF LIBS="$LIBS -lxnet" # Use the XOPEN network library - if test "`uname -m`" = ia64; then : + if test "`uname -m`" = ia64; then SHLIB_SUFFIX=".so" @@ -5408,49 +7199,78 @@ else SHLIB_SUFFIX=".sl" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 + + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >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. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ +/* 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 shl_load (); int main () { -return shl_load (); +shl_load (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_lib_dld_shl_load=yes else - ac_cv_lib_dld_shl_load=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then tcl_ok=yes else tcl_ok=no fi - if test "$tcl_ok" = yes; then : + if test "$tcl_ok" = yes; then SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" @@ -5462,7 +7282,8 @@ fi LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi - if test "$GCC" = yes; then : + + if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} @@ -5473,28 +7294,30 @@ else fi + # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc #CFLAGS="$CFLAGS +DAportable" # Check to enable 64-bit flags for compiler/linker - if test "$do64bit" = "yes"; then : + if test "$do64bit" = "yes"; then - if test "$GCC" = yes; then : + if test "$GCC" = yes; then case `${CC} -dumpmachine` in hppa64*) # 64-bit gcc in use. Fix flags for GNU ld. do64bit_ok=yes SHLIB_LD='${CC} -shared' - if test $doRpath = yes; then : + if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5 -$as_echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;} + { 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;} ;; esac @@ -5506,52 +7329,82 @@ else fi -fi ;; + +fi + ;; HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) SHLIB_SUFFIX=".sl" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >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. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ +/* 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 shl_load (); int main () { -return shl_load (); +shl_load (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_lib_dld_shl_load=yes else - ac_cv_lib_dld_shl_load=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then tcl_ok=yes else tcl_ok=no fi - if test "$tcl_ok" = yes; then : + if test "$tcl_ok" = yes; then SHLIB_CFLAGS="+z" SHLIB_LD="ld -b" @@ -5563,24 +7416,28 @@ fi LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' LD_LIBRARY_PATH_VAR="SHLIB_PATH" -fi ;; +fi + ;; IRIX-5.*) SHLIB_CFLAGS="" SHLIB_LD="ld -shared -rdata_shared" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - case " $LIBOBJS " in + case $LIBOBJS in + "mkstemp.$ac_objext" | \ + *" mkstemp.$ac_objext" | \ + "mkstemp.$ac_objext "* | \ *" mkstemp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" - ;; + *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;; esac - if test $doRpath = yes; then : + if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi + ;; IRIX-6.*) SHLIB_CFLAGS="" @@ -5588,18 +7445,21 @@ fi SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - case " $LIBOBJS " in + case $LIBOBJS in + "mkstemp.$ac_objext" | \ + *" mkstemp.$ac_objext" | \ + "mkstemp.$ac_objext "* | \ *" mkstemp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" - ;; + *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;; esac - if test $doRpath = yes; then : + if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi - if test "$GCC" = yes; then : + + if test "$GCC" = yes; then CFLAGS="$CFLAGS -mabi=n32" LDFLAGS="$LDFLAGS -mabi=n32" @@ -5618,6 +7478,7 @@ else LDFLAGS="$LDFLAGS -n32" fi + ;; IRIX64-6.*) SHLIB_CFLAGS="" @@ -5625,26 +7486,29 @@ fi SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - case " $LIBOBJS " in + case $LIBOBJS in + "mkstemp.$ac_objext" | \ + *" mkstemp.$ac_objext" | \ + "mkstemp.$ac_objext "* | \ *" mkstemp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" - ;; + *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" ;; esac - if test $doRpath = yes; then : + if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi + # Check to enable 64-bit flags for compiler/linker - if test "$do64bit" = yes; then : + if test "$do64bit" = yes; then - if test "$GCC" = yes; then : + if test "$GCC" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported by gcc" >&5 -$as_echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} + { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5 +echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;} else @@ -5655,7 +7519,9 @@ else fi + fi + ;; Linux*|GNU*|NetBSD-Debian) SHLIB_CFLAGS="-fPIC" @@ -5671,25 +7537,31 @@ fi DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" - if test $doRpath = yes; then : + if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - if test "`uname -m`" = "alpha"; then : + if test "`uname -m`" = "alpha"; then CFLAGS="$CFLAGS -mieee" fi - if test $do64bit = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -m64 flag" >&5 -$as_echo_n "checking if compiler accepts -m64 flag... " >&6; } -if ${tcl_cv_cc_m64+:} false; then : - $as_echo_n "(cached) " >&6 + if test $do64bit = yes; then + + echo "$as_me:$LINENO: checking if compiler accepts -m64 flag" >&5 +echo $ECHO_N "checking if compiler accepts -m64 flag... $ECHO_C" >&6 +if test "${tcl_cv_cc_m64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -m64" - cat confdefs.h - <<_ACEOF >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. */ int @@ -5700,35 +7572,62 @@ main () return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_cc_m64=yes else - tcl_cv_cc_m64=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_cc_m64=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_m64" >&5 -$as_echo "$tcl_cv_cc_m64" >&6; } - if test $tcl_cv_cc_m64 = yes; then : +echo "$as_me:$LINENO: result: $tcl_cv_cc_m64" >&5 +echo "${ECHO_T}$tcl_cv_cc_m64" >&6 + if test $tcl_cv_cc_m64 = yes; then CFLAGS="$CFLAGS -m64" do64bit_ok=yes fi + fi + # The combo of gcc + glibc has a bug related to inlining of # functions like strtod(). The -fno-builtin flag should address # this problem but it does not work. The -fno-inline flag is kind # of overkill but it works. Disable inlining only when one of the # files in compat/*.c is being linked in. - if test x"${USE_COMPAT}" != x; then : + if test x"${USE_COMPAT}" != x; then CFLAGS="$CFLAGS -fno-inline" fi + ;; Lynx*) SHLIB_CFLAGS="-fPIC" @@ -5738,11 +7637,12 @@ fi DL_OBJS="tclLoadDl.o" DL_LIBS="-mshared -ldl" LD_FLAGS="-Wl,--export-dynamic" - if test $doRpath = yes; then : + if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi + ;; MP-RAS-02*) SHLIB_CFLAGS="-K PIC" @@ -5781,10 +7681,11 @@ fi SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - if test $doRpath = yes; then : + if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" @@ -5801,7 +7702,7 @@ fi CFLAGS_OPTIMIZE="-O2" ;; esac - if test "${TCL_THREADS}" = "1"; then : + if test "${TCL_THREADS}" = "1"; then # On OpenBSD: Compile with -pthread # Don't link with -lpthread @@ -5809,6 +7710,7 @@ fi CFLAGS="$CFLAGS -pthread" fi + # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots @@ -5821,12 +7723,13 @@ fi DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" - if test $doRpath = yes; then : + if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - if test "${TCL_THREADS}" = "1"; then : + if test "${TCL_THREADS}" = "1"; then # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` @@ -5834,6 +7737,7 @@ fi LDFLAGS="$LDFLAGS -pthread" fi + ;; FreeBSD-*) # This configuration from FreeBSD Ports. @@ -5844,18 +7748,20 @@ fi DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="" - if test $doRpath = yes; then : + if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi - if test "${TCL_THREADS}" = "1"; then : + + if test "${TCL_THREADS}" = "1"; then # The -pthread needs to go in the LDFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LDFLAGS="$LDFLAGS $PTHREAD_LIBS" fi + case $system in FreeBSD-3.*) # Version numbers are dot-stripped by system policy. @@ -5878,19 +7784,23 @@ fi CFLAGS="`echo " ${CFLAGS}" | \ awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \ if (!($i~/^(isysroot|mmacosx-version-min)/)) print "-"$i}'`" - if test $do64bit = yes; then : + if test $do64bit = yes; then case `arch` in ppc) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch ppc64 flag" >&5 -$as_echo_n "checking if compiler accepts -arch ppc64 flag... " >&6; } -if ${tcl_cv_cc_arch_ppc64+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking if compiler accepts -arch ppc64 flag" >&5 +echo $ECHO_N "checking if compiler accepts -arch ppc64 flag... $ECHO_C" >&6 +if test "${tcl_cv_cc_arch_ppc64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" - cat confdefs.h - <<_ACEOF >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. */ int @@ -5901,33 +7811,62 @@ main () return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_cc_arch_ppc64=yes else - tcl_cv_cc_arch_ppc64=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_cc_arch_ppc64=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_ppc64" >&5 -$as_echo "$tcl_cv_cc_arch_ppc64" >&6; } - if test $tcl_cv_cc_arch_ppc64 = yes; then : +echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_ppc64" >&5 +echo "${ECHO_T}$tcl_cv_cc_arch_ppc64" >&6 + if test $tcl_cv_cc_arch_ppc64 = yes; then CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5" do64bit_ok=yes -fi;; +fi +;; i386) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler accepts -arch x86_64 flag" >&5 -$as_echo_n "checking if compiler accepts -arch x86_64 flag... " >&6; } -if ${tcl_cv_cc_arch_x86_64+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking if compiler accepts -arch x86_64 flag" >&5 +echo $ECHO_N "checking if compiler accepts -arch x86_64 flag... $ECHO_C" >&6 +if test "${tcl_cv_cc_arch_x86_64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS CFLAGS="$CFLAGS -arch x86_64" - cat confdefs.h - <<_ACEOF >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. */ int @@ -5938,48 +7877,79 @@ main () return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_cc_arch_x86_64=yes else - tcl_cv_cc_arch_x86_64=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_cc_arch_x86_64=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_arch_x86_64" >&5 -$as_echo "$tcl_cv_cc_arch_x86_64" >&6; } - if test $tcl_cv_cc_arch_x86_64 = yes; then : +echo "$as_me:$LINENO: result: $tcl_cv_cc_arch_x86_64" >&5 +echo "${ECHO_T}$tcl_cv_cc_arch_x86_64" >&6 + if test $tcl_cv_cc_arch_x86_64 = yes; then CFLAGS="$CFLAGS -arch x86_64" do64bit_ok=yes -fi;; +fi +;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5 -$as_echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};; + { echo "$as_me:$LINENO: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&5 +echo "$as_me: WARNING: Don't know how enable 64-bit on architecture \`arch\`" >&2;};; esac else # Check for combined 32-bit and 64-bit fat build if echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \ - && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '; then : + && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '; then fat_32_64=yes fi + fi + SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}' - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ld accepts -single_module flag" >&5 -$as_echo_n "checking if ld accepts -single_module flag... " >&6; } -if ${tcl_cv_ld_single_module+:} false; then : - $as_echo_n "(cached) " >&6 + 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 confdefs.h - <<_ACEOF >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. */ int @@ -5990,41 +7960,71 @@ int i; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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 - tcl_cv_ld_single_module=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_ld_single_module=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_single_module" >&5 -$as_echo "$tcl_cv_ld_single_module" >&6; } - if test $tcl_cv_ld_single_module = yes; then : +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_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" DL_LIBS="" # Don't use -prebind when building for Mac OS X 10.4 or later only: if test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int($2)}'`" -lt 4 -a \ - "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4; then : + "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int($2)}'`" -lt 4; then LDFLAGS="$LDFLAGS -prebind" fi + LDFLAGS="$LDFLAGS -headerpad_max_install_names" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if ld accepts -search_paths_first flag" >&5 -$as_echo_n "checking if ld accepts -search_paths_first flag... " >&6; } -if ${tcl_cv_ld_search_paths_first+:} false; then : - $as_echo_n "(cached) " >&6 + 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 confdefs.h - <<_ACEOF >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. */ int @@ -6035,58 +8035,88 @@ int i; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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 - tcl_cv_ld_search_paths_first=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_ld_search_paths_first=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_search_paths_first" >&5 -$as_echo "$tcl_cv_ld_search_paths_first" >&6; } - if test $tcl_cv_ld_search_paths_first = yes; then : +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 - if test "$tcl_cv_cc_visibility_hidden" != yes; then : + if test "$tcl_cv_cc_visibility_hidden" != yes; then -$as_echo "#define MODULE_SCOPE __private_extern__" >>confdefs.h + +cat >>confdefs.h <<\_ACEOF +#define MODULE_SCOPE __private_extern__ +_ACEOF fi + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" -$as_echo "#define MAC_OSX_TCL 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define MAC_OSX_TCL 1 +_ACEOF PLAT_OBJS='${MAC_OSX_OBJS}' PLAT_SRCS='${MAC_OSX_SRCS}' - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use CoreFoundation" >&5 -$as_echo_n "checking whether to use CoreFoundation... " >&6; } - # Check whether --enable-corefoundation was given. -if test "${enable_corefoundation+set}" = set; then : - enableval=$enable_corefoundation; tcl_corefoundation=$enableval + 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 - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_corefoundation" >&5 -$as_echo "$tcl_corefoundation" >&6; } - if test $tcl_corefoundation = yes; then : +fi; + echo "$as_me:$LINENO: result: $tcl_corefoundation" >&5 +echo "${ECHO_T}$tcl_corefoundation" >&6 + if test $tcl_corefoundation = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CoreFoundation.framework" >&5 -$as_echo_n "checking for CoreFoundation.framework... " >&6; } -if ${tcl_cv_lib_corefoundation+:} false; then : - $as_echo_n "(cached) " >&6 + 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 - if test "$fat_32_64" = yes; then : + if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do # On Tiger there is no 64-bit CF, so remove 64-bit @@ -6096,8 +8126,13 @@ else eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' done fi + LIBS="$LIBS -framework CoreFoundation" - cat confdefs.h - <<_ACEOF >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. */ #include int @@ -6108,45 +8143,77 @@ CFBundleRef b = CFBundleGetMainBundle(); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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 - tcl_cv_lib_corefoundation=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_lib_corefoundation=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test "$fat_32_64" = yes; then : +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$fat_32_64" = yes; then for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done fi + LIBS=$hold_libs fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_corefoundation" >&5 -$as_echo "$tcl_cv_lib_corefoundation" >&6; } - if test $tcl_cv_lib_corefoundation = yes; then : +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" -$as_echo "#define HAVE_COREFOUNDATION 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_COREFOUNDATION 1 +_ACEOF else tcl_corefoundation=no fi - if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit CoreFoundation" >&5 -$as_echo_n "checking for 64-bit CoreFoundation... " >&6; } -if ${tcl_cv_lib_corefoundation_64+:} false; then : - $as_echo_n "(cached) " >&6 + if test "$fat_32_64" = yes -a $tcl_corefoundation = yes; then + + echo "$as_me:$LINENO: checking for 64-bit CoreFoundation" >&5 +echo $ECHO_N "checking for 64-bit CoreFoundation... $ECHO_C" >&6 +if test "${tcl_cv_lib_corefoundation_64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else for v in CFLAGS CPPFLAGS LDFLAGS; do eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done - cat confdefs.h - <<_ACEOF >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. */ #include int @@ -6157,31 +8224,60 @@ CFBundleRef b = CFBundleGetMainBundle(); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_64=yes else - tcl_cv_lib_corefoundation_64=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_lib_corefoundation_64=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_lib_corefoundation_64" >&5 -$as_echo "$tcl_cv_lib_corefoundation_64" >&6; } - if test $tcl_cv_lib_corefoundation_64 = no; then : +echo "$as_me:$LINENO: result: $tcl_cv_lib_corefoundation_64" >&5 +echo "${ECHO_T}$tcl_cv_lib_corefoundation_64" >&6 + if test $tcl_cv_lib_corefoundation_64 = no; then -$as_echo "#define NO_COREFOUNDATION_64 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define NO_COREFOUNDATION_64 1 +_ACEOF LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings" fi + fi + fi + ;; NEXTSTEP-*) SHLIB_CFLAGS="" @@ -6197,7 +8293,9 @@ fi SHLIB_LD_LIBS="" CFLAGS_OPTIMIZE="" # Optimizer is buggy -$as_echo "#define _OE_SOCKETS 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _OE_SOCKETS 1 +_ACEOF ;; OSF1-1.0|OSF1-1.1|OSF1-1.2) @@ -6215,13 +8313,14 @@ $as_echo "#define _OE_SOCKETS 1" >>confdefs.h OSF1-1.*) # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 SHLIB_CFLAGS="-fPIC" - if test "$SHARED_BUILD" = 1; then : + if test "$SHARED_BUILD" = 1; then SHLIB_LD="ld -shared" else SHLIB_LD="ld -non_shared" fi + SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" @@ -6232,7 +8331,7 @@ fi OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" - if test "$SHARED_BUILD" = 1; then : + if test "$SHARED_BUILD" = 1; then SHLIB_LD='ld -shared -expect_unresolved "*"' @@ -6241,27 +8340,30 @@ else SHLIB_LD='ld -non_shared -expect_unresolved "*"' fi + SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - if test $doRpath = yes; then : + if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' fi - if test "$GCC" = yes; then : + + if test "$GCC" = yes; then CFLAGS="$CFLAGS -mieee" else CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" fi + # see pthread_intro(3) for pthread support on osf1, k.furukawa - if test "${TCL_THREADS}" = 1; then : + if test "${TCL_THREADS}" = 1; then CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" LIBS=`echo $LIBS | sed s/-lpthreads//` - if test "$GCC" = yes; then : + if test "$GCC" = yes; then LIBS="$LIBS -lpthread -lmach -lexc" @@ -6272,7 +8374,9 @@ else fi + fi + ;; QNX-6*) # QNX RTP @@ -6291,7 +8395,7 @@ fi # Note, dlopen is available only on SCO 3.2.5 and greater. However, # this test works, since "uname -s" was non-standard in 3.2.4 and # below. - if test "$GCC" = yes; then : + if test "$GCC" = yes; then SHLIB_CFLAGS="-fPIC -melf" LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" @@ -6302,6 +8406,7 @@ else LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" fi + SHLIB_LD="ld -G" SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" @@ -6346,17 +8451,21 @@ fi # won't define thread-safe library routines. -$as_echo "#define _REENTRANT 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF -$as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF SHLIB_CFLAGS="-KPIC" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - if test "$GCC" = yes; then : + if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' @@ -6369,32 +8478,37 @@ else LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} fi + ;; SunOS-5*) # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. -$as_echo "#define _REENTRANT 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _REENTRANT 1 +_ACEOF -$as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _POSIX_PTHREAD_SEMANTICS 1 +_ACEOF SHLIB_CFLAGS="-KPIC" # Check to enable 64-bit flags for compiler/linker - if test "$do64bit" = yes; then : + if test "$do64bit" = yes; then arch=`isainfo` - if test "$arch" = "sparcv9 sparc"; then : + if test "$arch" = "sparcv9 sparc"; then - if test "$GCC" = yes; then : + if test "$GCC" = yes; then - if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3; then : + if test "`${CC} -dumpversion | awk -F. '{print $1}'`" -lt 3; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5 -$as_echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;} + { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5 +echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;} else @@ -6405,10 +8519,11 @@ else fi + else do64bit_ok=yes - if test "$do64bitVIS" = yes; then : + if test "$do64bitVIS" = yes; then CFLAGS="$CFLAGS -xarch=v9a" LDFLAGS_ARCH="-xarch=v9a" @@ -6419,15 +8534,17 @@ else LDFLAGS_ARCH="-xarch=v9" fi + # Solaris 64 uses this as well #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64" fi + else - if test "$arch" = "amd64 i386"; then : + if test "$arch" = "amd64 i386"; then - if test "$GCC" = yes; then : + if test "$GCC" = yes; then case $system in SunOS-5.1[1-9]*|SunOS-5.[2-9][0-9]*) @@ -6435,8 +8552,8 @@ else CFLAGS="$CFLAGS -m64" LDFLAGS="$LDFLAGS -m64";; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported with GCC on $system" >&5 -$as_echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;};; + { 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;};; esac else @@ -6453,32 +8570,169 @@ else fi + else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit mode not supported for $arch" >&5 -$as_echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;} + { 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 + fi + #-------------------------------------------------------------------- # On Solaris 5.x i386 with the sunpro compiler we need to link # with sunmath to get floating point rounding control #-------------------------------------------------------------------- - if test "$GCC" = yes; then : + if test "$GCC" = yes; then use_sunmath=no else arch=`isainfo` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use -lsunmath for fp rounding control" >&5 -$as_echo_n "checking whether to use -lsunmath for fp rounding control... " >&6; } - if test "$arch" = "amd64 i386" -o "$arch" = "i386"; then : + echo "$as_me:$LINENO: checking whether to use -lsunmath for fp rounding control" >&5 +echo $ECHO_N "checking whether to use -lsunmath for fp rounding control... $ECHO_C" >&6 + if test "$arch" = "amd64 i386" -o "$arch" = "i386"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 MATH_LIBS="-lsunmath $MATH_LIBS" - ac_fn_c_check_header_mongrel "$LINENO" "sunmath.h" "ac_cv_header_sunmath_h" "$ac_includes_default" -if test "x$ac_cv_header_sunmath_h" = xyes; then : + if test "${ac_cv_header_sunmath_h+set}" = set; then + echo "$as_me:$LINENO: checking for sunmath.h" >&5 +echo $ECHO_N "checking for sunmath.h... $ECHO_C" >&6 +if test "${ac_cv_header_sunmath_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sunmath_h" >&5 +echo "${ECHO_T}$ac_cv_header_sunmath_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking sunmath.h usability" >&5 +echo $ECHO_N "checking sunmath.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 +_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 sunmath.h presence" >&5 +echo $ECHO_N "checking sunmath.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 +_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: sunmath.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sunmath.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sunmath.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sunmath.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sunmath.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sunmath.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sunmath.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sunmath.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sunmath.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sunmath.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sunmath.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sunmath.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sunmath.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sunmath.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sunmath.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sunmath.h: 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 sunmath.h" >&5 +echo $ECHO_N "checking for sunmath.h... $ECHO_C" >&6 +if test "${ac_cv_header_sunmath_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sunmath_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sunmath_h" >&5 +echo "${ECHO_T}$ac_cv_header_sunmath_h" >&6 fi @@ -6487,24 +8741,26 @@ fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 use_sunmath=no fi + fi + SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - if test "$GCC" = yes; then : + if test "$GCC" = yes; then SHLIB_LD='${CC} -shared' CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - if test "$do64bit_ok" = yes; then : + if test "$do64bit_ok" = yes; then - if test "$arch" = "sparcv9 sparc"; then : + if test "$arch" = "sparcv9 sparc"; then # We need to specify -static-libgcc or we need to # add the path to the sparv9 libgcc. @@ -6515,22 +8771,26 @@ fi #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir" else - if test "$arch" = "amd64 i386"; then : + if test "$arch" = "amd64 i386"; then SHLIB_LD="$SHLIB_LD -m64 -static-libgcc" fi + fi + fi + else - if test "$use_sunmath" = yes; then : + if test "$use_sunmath" = yes; then textmode=textoff else textmode=text fi + case $system in SunOS-5.[1-9][0-9]*|SunOS-5.[7-9]) SHLIB_LD="\${CC} -G -z $textmode \${LDFLAGS}";; @@ -6541,6 +8801,7 @@ fi LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' fi + ;; UNIX_SV* | UnixWare-5*) SHLIB_CFLAGS="-KPIC" @@ -6551,15 +8812,19 @@ fi DL_LIBS="-ldl" # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld accepts -Bexport flag" >&5 -$as_echo_n "checking for ld accepts -Bexport flag... " >&6; } -if ${tcl_cv_ld_Bexport+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5 +echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6 +if test "${tcl_cv_ld_Bexport+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-Bexport" - cat confdefs.h - <<_ACEOF >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. */ int @@ -6570,63 +8835,93 @@ int i; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_Bexport=yes else - tcl_cv_ld_Bexport=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_ld_Bexport=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LDFLAGS=$hold_ldflags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_ld_Bexport" >&5 -$as_echo "$tcl_cv_ld_Bexport" >&6; } - if test $tcl_cv_ld_Bexport = yes; then : +echo "$as_me:$LINENO: result: $tcl_cv_ld_Bexport" >&5 +echo "${ECHO_T}$tcl_cv_ld_Bexport" >&6 + if test $tcl_cv_ld_Bexport = yes; then LDFLAGS="$LDFLAGS -Wl,-Bexport" fi + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; esac - if test "$do64bit" = yes -a "$do64bit_ok" = no; then : + if test "$do64bit" = yes -a "$do64bit_ok" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5 -$as_echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;} + { echo "$as_me:$LINENO: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5 +echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;} fi - if test "$do64bit" = yes -a "$do64bit_ok" = yes; then : + if test "$do64bit" = yes -a "$do64bit_ok" = yes; then -$as_echo "#define TCL_CFG_DO64BIT 1" >>confdefs.h + +cat >>confdefs.h <<\_ACEOF +#define TCL_CFG_DO64BIT 1 +_ACEOF fi + # Step 4: disable dynamic loading if requested via a command-line switch. - # Check whether --enable-load was given. -if test "${enable_load+set}" = set; then : - enableval=$enable_load; tcl_ok=$enableval + # Check whether --enable-load or --disable-load was given. +if test "${enable_load+set}" = set; then + enableval="$enable_load" + tcl_ok=$enableval else tcl_ok=yes -fi - - if test "$tcl_ok" = no; then : +fi; + if test "$tcl_ok" = no; then DL_OBJS="" fi - if test "x$DL_OBJS" != x; then : + + if test "x$DL_OBJS" != x; then BUILD_DLTEST="\$(DLTEST_TARGETS)" else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&5 -$as_echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&2;} + { echo "$as_me:$LINENO: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&5 +echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared libraries on this system." >&2;} SHLIB_CFLAGS="" SHLIB_LD="" SHLIB_SUFFIX="" @@ -6638,13 +8933,14 @@ $as_echo "$as_me: WARNING: Can't figure out how to do dynamic loading or shared BUILD_DLTEST="" fi + LDFLAGS="$LDFLAGS $LDFLAGS_ARCH" # If we're running gcc, then change the C flags for compiling shared # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. - if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes; then : + if test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes; then case $system in AIX-*) ;; @@ -6658,29 +8954,35 @@ fi esac fi - if test "$tcl_cv_cc_visibility_hidden" != yes; then : + + if test "$tcl_cv_cc_visibility_hidden" != yes; then -$as_echo "#define MODULE_SCOPE extern" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define MODULE_SCOPE extern +_ACEOF fi - if test "$SHARED_LIB_SUFFIX" = ""; then : + + if test "$SHARED_LIB_SUFFIX" = ""; then SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}' fi - if test "$UNSHARED_LIB_SUFFIX" = ""; then : + + if test "$UNSHARED_LIB_SUFFIX" = ""; then UNSHARED_LIB_SUFFIX='${VERSION}.a' fi + DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)" - if test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""; then : + if test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""; then LIB_SUFFIX=${SHARED_LIB_SUFFIX} MAKE_LIB='${SHLIB_LD} -o $@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' - if test "${SHLIB_SUFFIX}" = ".dll"; then : + if test "${SHLIB_SUFFIX}" = ".dll"; then INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)"' DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)" @@ -6691,11 +8993,12 @@ else fi + else LIB_SUFFIX=${UNSHARED_LIB_SUFFIX} - if test "$RANLIB" = ""; then : + if test "$RANLIB" = ""; then MAKE_LIB='$(STLIB_LD) $@ ${OBJS}' INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"' @@ -6707,22 +9010,12 @@ else fi -fi - - if test "$RANLIB" = ""; then : - - MAKE_KIT_LIB='$(STLIB_LD) $@ ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS}' - INSTALL_KIT_LIB='$(INSTALL_LIBRARY) $(TCL_KIT_LIB_FILE) "$(LIB_INSTALL_DIR)/$(TCL_KIT_LIB_FILE)"' - -else - - MAKE_KIT_LIB='${STLIB_LD} $@ ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} ; ${RANLIB} $@' - INSTALL_KIT_LIB='$(INSTALL_LIBRARY) $(TCL_KIT_LIB_FILE) "$(LIB_INSTALL_DIR)/$(TCL_KIT_LIB_FILE)" ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(TCL_KIT_LIB_FILE))' fi + # Stub lib does not depend on shared/static configuration - if test "$RANLIB" = ""; then : + if test "$RANLIB" = ""; then MAKE_STUB_LIB='${STLIB_LD} $@ ${STUB_LIB_OBJS}' INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"' @@ -6734,25 +9027,31 @@ else fi + # Define TCL_LIBS now that we know what DL_LIBS is. # The trick here is that we don't want to change the value of TCL_LIBS if # it is already set when tclConfig.sh had been loaded by Tk. - if test "x${TCL_LIBS}" = x; then : + if test "x${TCL_LIBS}" = x; then TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}" fi + # See if the compiler supports casting to a union type. # This is used to stop gcc from printing a compiler # warning when initializing a union member. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5 -$as_echo_n "checking for cast to union support... " >&6; } -if ${tcl_cv_cast_to_union+:} false; then : - $as_echo_n "(cached) " >&6 + 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 confdefs.h - <<_ACEOF >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. */ int @@ -6766,19 +9065,45 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 - tcl_cv_cast_to_union=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_cast_to_union=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5 -$as_echo "$tcl_cv_cast_to_union" >&6; } +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 -$as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_CAST_TO_UNION 1 +_ACEOF fi @@ -6824,36 +9149,38 @@ _ACEOF - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build with symbols" >&5 -$as_echo_n "checking for build with symbols... " >&6; } - # Check whether --enable-symbols was given. -if test "${enable_symbols+set}" = set; then : - enableval=$enable_symbols; tcl_ok=$enableval + echo "$as_me:$LINENO: checking for build with symbols" >&5 +echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6 + # Check whether --enable-symbols or --disable-symbols was given. +if test "${enable_symbols+set}" = set; then + enableval="$enable_symbols" + tcl_ok=$enableval else tcl_ok=no -fi - +fi; # 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)' -$as_echo "#define NDEBUG 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define NDEBUG 1 +_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 -$as_echo "#define TCL_CFG_OPTIMIZED 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define TCL_CFG_OPTIMIZED 1 +_ACEOF else CFLAGS_DEFAULT='$(CFLAGS_DEBUG)' LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)' if test "$tcl_ok" = "yes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (standard debugging)" >&5 -$as_echo "yes (standard debugging)" >&6; } + echo "$as_me:$LINENO: result: yes (standard debugging)" >&5 +echo "${ECHO_T}yes (standard debugging)" >&6 fi fi @@ -6861,35 +9188,45 @@ $as_echo "yes (standard debugging)" >&6; } if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then -$as_echo "#define TCL_MEM_DEBUG 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define TCL_MEM_DEBUG 1 +_ACEOF fi if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then -$as_echo "#define TCL_COMPILE_DEBUG 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define TCL_COMPILE_DEBUG 1 +_ACEOF -$as_echo "#define TCL_COMPILE_STATS 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define TCL_COMPILE_STATS 1 +_ACEOF fi if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then if test "$tcl_ok" = "all"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled symbols mem compile debugging" >&5 -$as_echo "enabled symbols mem compile debugging" >&6; } + echo "$as_me:$LINENO: result: enabled symbols mem compile debugging" >&5 +echo "${ECHO_T}enabled symbols mem compile debugging" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled $tcl_ok debugging" >&5 -$as_echo "enabled $tcl_ok debugging" >&6; } + echo "$as_me:$LINENO: result: enabled $tcl_ok debugging" >&5 +echo "${ECHO_T}enabled $tcl_ok debugging" >&6 fi fi -$as_echo "#define TCL_TOMMATH 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define TCL_TOMMATH 1 +_ACEOF -$as_echo "#define MP_PREC 4" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define MP_PREC 4 +_ACEOF #-------------------------------------------------------------------- @@ -6897,14 +9234,18 @@ $as_echo "#define MP_PREC 4" >>confdefs.h #-------------------------------------------------------------------- - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for required early compiler flags" >&5 -$as_echo_n "checking for required early compiler flags... " >&6; } + echo "$as_me:$LINENO: checking for required early compiler flags" >&5 +echo $ECHO_N "checking for required early compiler flags... $ECHO_C" >&6 tcl_flags="" - if ${tcl_cv_flag__isoc99_source+:} false; then : - $as_echo_n "(cached) " >&6 + if test "${tcl_cv_flag__isoc99_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ #include int @@ -6915,10 +9256,38 @@ char *p = (char *)strtoll; char *q = (char *)strtoull; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_flag__isoc99_source=no else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + 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. */ #define _ISOC99_SOURCE 1 #include @@ -6930,28 +9299,58 @@ char *p = (char *)strtoll; char *q = (char *)strtoull; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_flag__isoc99_source=yes else - tcl_cv_flag__isoc99_source=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_flag__isoc99_source=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then -$as_echo "#define _ISOC99_SOURCE 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _ISOC99_SOURCE 1 +_ACEOF tcl_flags="$tcl_flags _ISOC99_SOURCE" fi - if ${tcl_cv_flag__largefile64_source+:} false; then : - $as_echo_n "(cached) " >&6 + if test "${tcl_cv_flag__largefile64_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ #include int @@ -6962,10 +9361,38 @@ struct stat64 buf; int i = stat64("/", &buf); return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_flag__largefile64_source=no else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + 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. */ #define _LARGEFILE64_SOURCE 1 #include @@ -6977,28 +9404,58 @@ struct stat64 buf; int i = stat64("/", &buf); return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_flag__largefile64_source=yes else - tcl_cv_flag__largefile64_source=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_flag__largefile64_source=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then -$as_echo "#define _LARGEFILE64_SOURCE 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _LARGEFILE64_SOURCE 1 +_ACEOF tcl_flags="$tcl_flags _LARGEFILE64_SOURCE" fi - if ${tcl_cv_flag__largefile_source64+:} false; then : - $as_echo_n "(cached) " >&6 + if test "${tcl_cv_flag__largefile_source64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ #include int @@ -7009,10 +9466,38 @@ char *p = (char *)open64; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_flag__largefile_source64=no else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + 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. */ #define _LARGEFILE_SOURCE64 1 #include @@ -7024,42 +9509,72 @@ char *p = (char *)open64; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_flag__largefile_source64=yes else - tcl_cv_flag__largefile_source64=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_flag__largefile_source64=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then -$as_echo "#define _LARGEFILE_SOURCE64 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _LARGEFILE_SOURCE64 1 +_ACEOF tcl_flags="$tcl_flags _LARGEFILE_SOURCE64" fi if test "x${tcl_flags}" = "x" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${tcl_flags}" >&5 -$as_echo "${tcl_flags}" >&6; } + echo "$as_me:$LINENO: result: ${tcl_flags}" >&5 +echo "${ECHO_T}${tcl_flags}" >&6 fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit integer type" >&5 -$as_echo_n "checking for 64-bit integer type... " >&6; } - if ${tcl_cv_type_64bit+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for 64-bit integer type" >&5 +echo $ECHO_N "checking for 64-bit integer type... $ECHO_C" >&6 + if test "${tcl_cv_type_64bit+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else tcl_cv_type_64bit=none # See if the compiler knows natively about __int64 - cat confdefs.h - <<_ACEOF >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. */ int @@ -7070,16 +9585,44 @@ __int64 value = (__int64) 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_type_64bit=__int64 else - tcl_type_64bit="long long" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_type_64bit="long long" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext # See if we should use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... - cat confdefs.h - <<_ACEOF >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. */ int @@ -7092,35 +9635,66 @@ switch (0) { return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_type_64bit=${tcl_type_64bit} +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "${tcl_cv_type_64bit}" = none ; then -$as_echo "#define TCL_WIDE_INT_IS_LONG 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define TCL_WIDE_INT_IS_LONG 1 +_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using long" >&5 -$as_echo "using long" >&6; } + echo "$as_me:$LINENO: result: using long" >&5 +echo "${ECHO_T}using long" >&6 else cat >>confdefs.h <<_ACEOF #define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit} _ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${tcl_cv_type_64bit}" >&5 -$as_echo "${tcl_cv_type_64bit}" >&6; } + echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5 +echo "${ECHO_T}${tcl_cv_type_64bit}" >&6 # Now check for auxiliary declarations - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct dirent64" >&5 -$as_echo_n "checking for struct dirent64... " >&6; } -if ${tcl_cv_struct_dirent64+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for struct dirent64" >&5 +echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6 +if test "${tcl_cv_struct_dirent64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ #include #include @@ -7132,28 +9706,58 @@ struct dirent64 p; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_struct_dirent64=yes else - tcl_cv_struct_dirent64=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_struct_dirent64=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_struct_dirent64" >&5 -$as_echo "$tcl_cv_struct_dirent64" >&6; } +echo "$as_me:$LINENO: result: $tcl_cv_struct_dirent64" >&5 +echo "${ECHO_T}$tcl_cv_struct_dirent64" >&6 if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then -$as_echo "#define HAVE_STRUCT_DIRENT64 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_DIRENT64 1 +_ACEOF fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat64" >&5 -$as_echo_n "checking for struct stat64... " >&6; } -if ${tcl_cv_struct_stat64+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for struct stat64" >&5 +echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6 +if test "${tcl_cv_struct_stat64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ #include int @@ -7165,40 +9769,161 @@ struct stat64 p; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_struct_stat64=yes else - tcl_cv_struct_stat64=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_struct_stat64=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_struct_stat64" >&5 -$as_echo "$tcl_cv_struct_stat64" >&6; } +echo "$as_me:$LINENO: result: $tcl_cv_struct_stat64" >&5 +echo "${ECHO_T}$tcl_cv_struct_stat64" >&6 if test "x${tcl_cv_struct_stat64}" = "xyes" ; then -$as_echo "#define HAVE_STRUCT_STAT64 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_STRUCT_STAT64 1 +_ACEOF fi - for ac_func in open64 lseek64 -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + + +for ac_func in open64 lseek64 +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 declares $ac_func. + For example, HP-UX 11i 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 to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#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 `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for off64_t" >&5 -$as_echo_n "checking for off64_t... " >&6; } - if ${tcl_cv_type_off64_t+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for off64_t" >&5 +echo $ECHO_N "checking for off64_t... $ECHO_C" >&6 + if test "${tcl_cv_type_off64_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ #include int @@ -7210,25 +9935,51 @@ off64_t offset; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_type_off64_t=yes else - tcl_cv_type_off64_t=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_type_off64_t=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test "x${tcl_cv_type_off64_t}" = "xyes" && \ test "x${ac_cv_func_lseek64}" = "xyes" && \ test "x${ac_cv_func_open64}" = "xyes" ; then -$as_echo "#define HAVE_TYPE_OFF64_T 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_TYPE_OFF64_T 1 +_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi fi @@ -7238,229 +9989,235 @@ $as_echo "no" >&6; } # Tcl_UniChar strings to memcmp on big-endian systems. #-------------------------------------------------------------------- - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - # Check for potential -arch flags. It is not universal unless - # there are at least two -arch flags with different values. - ac_arch= - ac_prev= - for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do - if test -n "$ac_prev"; then - case $ac_word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then - ac_arch=$ac_word - else - ac_cv_c_bigendian=universal - break - fi - ;; - esac - ac_prev= - elif test "x$ac_word" = "x-arch"; then - ac_prev=arch - fi - done -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include - #include +#include int main () { -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 # It does; now see whether it defined to BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >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. */ #include - #include +#include int main () { #if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif + not big endian +#endif ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes +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_c_bigendian=yes else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -int -main () -{ -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif +ac_cv_c_bigendian=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - ; - return 0; -} +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include - +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { -#ifndef _BIG_ENDIAN - not big endian - #endif - + _ascii (); _ebcdic (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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 + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then : - # Try to guess by grepping values from an object file. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -int -main () -{ -return use_ascii (foo) == use_ebcdic (foo); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext else - cat confdefs.h - <<_ACEOF >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_includes_default int main () { - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - - ; - return 0; + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +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_c_bigendian=no else - ac_cv_c_bigendian=yes + 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_c_bigendian=yes fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - - fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } - case $ac_cv_c_bigendian in #( - yes) - $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h -;; #( - no) - ;; #( - universal) - -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) - ;; #( - *) - as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; - esac +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac #-------------------------------------------------------------------- @@ -7469,2361 +10226,7837 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h #-------------------------------------------------------------------- # Check if Posix compliant getcwd exists, if not we'll use getwd. + for ac_func in getcwd -do : - ac_fn_c_check_func "$LINENO" "getcwd" "ac_cv_func_getcwd" -if test "x$ac_cv_func_getcwd" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETCWD 1 +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 declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func -else - -$as_echo "#define USEGETWD 1" >>confdefs.h +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -fi -done +#ifdef __STDC__ +# include +#else +# include +#endif -# Nb: if getcwd uses popen and pwd(1) (like SunOS 4) we should really -# define USEGETWD even if the posix getcwd exists. Add a test ? +#undef $ac_func -ac_fn_c_check_func "$LINENO" "mkstemp" "ac_cv_func_mkstemp" -if test "x$ac_cv_func_mkstemp" = xyes; then : - $as_echo "#define HAVE_MKSTEMP 1" >>confdefs.h +/* 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 - case " $LIBOBJS " in - *" mkstemp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS mkstemp.$ac_objext" - ;; -esac + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +eval "$as_ac_var=no" fi - -ac_fn_c_check_func "$LINENO" "opendir" "ac_cv_func_opendir" -if test "x$ac_cv_func_opendir" = xyes; then : - $as_echo "#define HAVE_OPENDIR 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" opendir.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS opendir.$ac_objext" - ;; -esac - +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi - -ac_fn_c_check_func "$LINENO" "strtol" "ac_cv_func_strtol" -if test "x$ac_cv_func_strtol" = xyes; then : - $as_echo "#define HAVE_STRTOL 1" >>confdefs.h +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 else - case " $LIBOBJS " in - *" strtol.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strtol.$ac_objext" - ;; -esac + +cat >>confdefs.h <<\_ACEOF +#define USEGETWD 1 +_ACEOF fi +done -ac_fn_c_check_func "$LINENO" "waitpid" "ac_cv_func_waitpid" -if test "x$ac_cv_func_waitpid" = xyes; then : - $as_echo "#define HAVE_WAITPID 1" >>confdefs.h +# Nb: if getcwd uses popen and pwd(1) (like SunOS 4) we should really +# define USEGETWD even if the posix getcwd exists. Add a test ? -else - case " $LIBOBJS " in - *" waitpid.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS waitpid.$ac_objext" - ;; -esac -fi -ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" -if test "x$ac_cv_func_strerror" = xyes; then : -else +for ac_func in mkstemp opendir strtol waitpid +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 declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func -$as_echo "#define NO_STRERROR 1" >>confdefs.h +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -fi +#ifdef __STDC__ +# include +#else +# include +#endif -ac_fn_c_check_func "$LINENO" "getwd" "ac_cv_func_getwd" -if test "x$ac_cv_func_getwd" = xyes; then : +#undef $ac_func -else +/* 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 -$as_echo "#define NO_GETWD 1" >>confdefs.h +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 - -ac_fn_c_check_func "$LINENO" "wait3" "ac_cv_func_wait3" -if test "x$ac_cv_func_wait3" = xyes; then : +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 else - -$as_echo "#define NO_WAIT3 1" >>confdefs.h + case $LIBOBJS in + "$ac_func.$ac_objext" | \ + *" $ac_func.$ac_objext" | \ + "$ac_func.$ac_objext "* | \ + *" $ac_func.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; +esac fi +done -ac_fn_c_check_func "$LINENO" "uname" "ac_cv_func_uname" -if test "x$ac_cv_func_uname" = xyes; then : +echo "$as_me:$LINENO: checking for strerror" >&5 +echo $ECHO_N "checking for strerror... $ECHO_C" >&6 +if test "${ac_cv_func_strerror+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 strerror to an innocuous variant, in case declares strerror. + For example, HP-UX 11i declares gettimeofday. */ +#define strerror innocuous_strerror -$as_echo "#define NO_UNAME 1" >>confdefs.h +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char strerror (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -fi +#ifdef __STDC__ +# include +#else +# include +#endif +#undef strerror -if test "`uname -s`" = "Darwin" && test "${TCL_THREADS}" = 1 && \ - test "`uname -r | awk -F. '{print $1}'`" -lt 7; then - # prior to Darwin 7, realpath is not threadsafe, so don't - # use it when threads are enabled, c.f. bug # 711232 - ac_cv_func_realpath=no -fi -ac_fn_c_check_func "$LINENO" "realpath" "ac_cv_func_realpath" -if test "x$ac_cv_func_realpath" = xyes; then : +/* 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 strerror (); +/* 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_strerror) || defined (__stub___strerror) +choke me +#else +char (*f) () = strerror; +#endif +#ifdef __cplusplus +} +#endif +int +main () +{ +return f != strerror; + ; + 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_strerror=yes else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -$as_echo "#define NO_REALPATH 1" >>confdefs.h - +ac_cv_func_strerror=no fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_strerror" >&5 +echo "${ECHO_T}$ac_cv_func_strerror" >&6 +if test $ac_cv_func_strerror = yes; then + : +else - - - NEED_FAKE_RFC2553=0 - for ac_func in getnameinfo getaddrinfo freeaddrinfo gai_strerror -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +cat >>confdefs.h <<\_ACEOF +#define NO_STRERROR 1 _ACEOF -else - NEED_FAKE_RFC2553=1 fi -done - ac_fn_c_check_type "$LINENO" "struct addrinfo" "ac_cv_type_struct_addrinfo" " -#include -#include -#include -#include +echo "$as_me:$LINENO: checking for getwd" >&5 +echo $ECHO_N "checking for getwd... $ECHO_C" >&6 +if test "${ac_cv_func_getwd+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 getwd to an innocuous variant, in case declares getwd. + For example, HP-UX 11i declares gettimeofday. */ +#define getwd innocuous_getwd -" -if test "x$ac_cv_type_struct_addrinfo" = xyes; then : +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char getwd (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_ADDRINFO 1 -_ACEOF +#ifdef __STDC__ +# include +#else +# include +#endif +#undef getwd -else - NEED_FAKE_RFC2553=1 -fi -ac_fn_c_check_type "$LINENO" "struct in6_addr" "ac_cv_type_struct_in6_addr" " -#include -#include -#include -#include - -" -if test "x$ac_cv_type_struct_in6_addr" = xyes; then : +/* 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 getwd (); +/* 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_getwd) || defined (__stub___getwd) +choke me +#else +char (*f) () = getwd; +#endif +#ifdef __cplusplus +} +#endif -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_IN6_ADDR 1 +int +main () +{ +return f != getwd; + ; + 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_getwd=yes else - NEED_FAKE_RFC2553=1 -fi -ac_fn_c_check_type "$LINENO" "struct sockaddr_in6" "ac_cv_type_struct_sockaddr_in6" " -#include -#include -#include -#include - -" -if test "x$ac_cv_type_struct_sockaddr_in6" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SOCKADDR_IN6 1 -_ACEOF - + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -else - NEED_FAKE_RFC2553=1 +ac_cv_func_getwd=no fi -ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" " -#include -#include -#include -#include - -" -if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_SOCKADDR_STORAGE 1 -_ACEOF - - -else - NEED_FAKE_RFC2553=1 +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_func_getwd" >&5 +echo "${ECHO_T}$ac_cv_func_getwd" >&6 +if test $ac_cv_func_getwd = yes; then + : +else -if test "x$NEED_FAKE_RFC2553" = "x1"; then - -$as_echo "#define NEED_FAKE_RFC2553 1" >>confdefs.h - - case " $LIBOBJS " in - *" fake-rfc2553.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS fake-rfc2553.$ac_objext" - ;; -esac - - ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" -if test "x$ac_cv_func_strlcpy" = xyes; then : - -fi +cat >>confdefs.h <<\_ACEOF +#define NO_GETWD 1 +_ACEOF fi +echo "$as_me:$LINENO: checking for wait3" >&5 +echo $ECHO_N "checking for wait3... $ECHO_C" >&6 +if test "${ac_cv_func_wait3+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 wait3 to an innocuous variant, in case declares wait3. + For example, HP-UX 11i declares gettimeofday. */ +#define wait3 innocuous_wait3 -#-------------------------------------------------------------------- -# Look for thread-safe variants of some library functions. -#-------------------------------------------------------------------- - -if test "${TCL_THREADS}" = 1; then - ac_fn_c_check_func "$LINENO" "getpwuid_r" "ac_cv_func_getpwuid_r" -if test "x$ac_cv_func_getpwuid_r" = xyes; then : +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char wait3 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpwuid_r with 5 args" >&5 -$as_echo_n "checking for getpwuid_r with 5 args... " >&6; } -if ${tcl_cv_api_getpwuid_r_5+:} false; then : - $as_echo_n "(cached) " >&6 -else +#ifdef __STDC__ +# include +#else +# include +#endif - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +#undef wait3 - #include - #include +/* 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 wait3 (); +/* 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_wait3) || defined (__stub___wait3) +choke me +#else +char (*f) () = wait3; +#endif +#ifdef __cplusplus +} +#endif int main () { - - uid_t uid; - struct passwd pw, *pwp; - char buf[512]; - int buflen = 512; - - (void) getpwuid_r(uid, &pw, buf, buflen, &pwp); - +return f != wait3; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_getpwuid_r_5=yes +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_wait3=yes else - tcl_cv_api_getpwuid_r_5=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_wait3=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getpwuid_r_5" >&5 -$as_echo "$tcl_cv_api_getpwuid_r_5" >&6; } - tcl_ok=$tcl_cv_api_getpwuid_r_5 - if test "$tcl_ok" = yes; then +echo "$as_me:$LINENO: result: $ac_cv_func_wait3" >&5 +echo "${ECHO_T}$ac_cv_func_wait3" >&6 +if test $ac_cv_func_wait3 = yes; then + : +else + +cat >>confdefs.h <<\_ACEOF +#define NO_WAIT3 1 +_ACEOF -$as_echo "#define HAVE_GETPWUID_R_5 1" >>confdefs.h +fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpwuid_r with 4 args" >&5 -$as_echo_n "checking for getpwuid_r with 4 args... " >&6; } -if ${tcl_cv_api_getpwuid_r_4+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for uname" >&5 +echo $ECHO_N "checking for uname... $ECHO_C" >&6 +if test "${ac_cv_func_uname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat confdefs.h - <<_ACEOF >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. */ +/* Define uname to an innocuous variant, in case declares uname. + For example, HP-UX 11i declares gettimeofday. */ +#define uname innocuous_uname - #include - #include +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char uname (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -int -main () -{ +#ifdef __STDC__ +# include +#else +# include +#endif - uid_t uid; - struct passwd pw; - char buf[512]; - int buflen = 512; +#undef uname - (void)getpwnam_r(uid, &pw, buf, buflen); +/* 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 uname (); +/* 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_uname) || defined (__stub___uname) +choke me +#else +char (*f) () = uname; +#endif +#ifdef __cplusplus +} +#endif +int +main () +{ +return f != uname; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_getpwuid_r_4=yes +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_uname=yes else - tcl_cv_api_getpwuid_r_4=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_uname=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getpwuid_r_4" >&5 -$as_echo "$tcl_cv_api_getpwuid_r_4" >&6; } - tcl_ok=$tcl_cv_api_getpwuid_r_4 - if test "$tcl_ok" = yes; then - -$as_echo "#define HAVE_GETPWUID_R_4 1" >>confdefs.h +echo "$as_me:$LINENO: result: $ac_cv_func_uname" >&5 +echo "${ECHO_T}$ac_cv_func_uname" >&6 +if test $ac_cv_func_uname = yes; then + : +else - fi - fi - if test "$tcl_ok" = yes; then +cat >>confdefs.h <<\_ACEOF +#define NO_UNAME 1 +_ACEOF -$as_echo "#define HAVE_GETPWUID_R 1" >>confdefs.h +fi - fi +if test "`uname -s`" = "Darwin" && test "${TCL_THREADS}" = 1 && \ + test "`uname -r | awk -F. '{print $1}'`" -lt 7; then + # prior to Darwin 7, realpath is not threadsafe, so don't + # use it when threads are enabled, c.f. bug # 711232 + ac_cv_func_realpath=no fi +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 declares realpath. + For example, HP-UX 11i declares gettimeofday. */ +#define realpath innocuous_realpath - ac_fn_c_check_func "$LINENO" "getpwnam_r" "ac_cv_func_getpwnam_r" -if test "x$ac_cv_func_getpwnam_r" = xyes; then : +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char realpath (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpwnam_r with 5 args" >&5 -$as_echo_n "checking for getpwnam_r with 5 args... " >&6; } -if ${tcl_cv_api_getpwnam_r_5+:} false; then : - $as_echo_n "(cached) " >&6 -else +#ifdef __STDC__ +# include +#else +# include +#endif - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +#undef realpath - #include - #include +/* 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 () { - - char *name; - struct passwd pw, *pwp; - char buf[512]; - int buflen = 512; - - (void) getpwnam_r(name, &pw, buf, buflen, &pwp); - +return f != realpath; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_getpwnam_r_5=yes +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 - tcl_cv_api_getpwnam_r_5=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_realpath=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getpwnam_r_5" >&5 -$as_echo "$tcl_cv_api_getpwnam_r_5" >&6; } - tcl_ok=$tcl_cv_api_getpwnam_r_5 - if test "$tcl_ok" = yes; then +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; then + : +else -$as_echo "#define HAVE_GETPWNAM_R_5 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define NO_REALPATH 1 +_ACEOF - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getpwnam_r with 4 args" >&5 -$as_echo_n "checking for getpwnam_r with 4 args... " >&6; } -if ${tcl_cv_api_getpwnam_r_4+:} false; then : - $as_echo_n "(cached) " >&6 -else +fi - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #include - #include -int -main () -{ + NEED_FAKE_RFC2553=0 - char *name; - struct passwd pw; - char buf[512]; - int buflen = 512; - (void)getpwnam_r(name, &pw, buf, buflen); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_getpwnam_r_4=yes -else - tcl_cv_api_getpwnam_r_4=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getpwnam_r_4" >&5 -$as_echo "$tcl_cv_api_getpwnam_r_4" >&6; } - tcl_ok=$tcl_cv_api_getpwnam_r_4 - if test "$tcl_ok" = yes; then - -$as_echo "#define HAVE_GETPWNAM_R_4 1" >>confdefs.h - - fi - fi - if test "$tcl_ok" = yes; then - -$as_echo "#define HAVE_GETPWNAM_R 1" >>confdefs.h - - fi -fi +for ac_func in getnameinfo getaddrinfo freeaddrinfo gai_strerror +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 declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func - ac_fn_c_check_func "$LINENO" "getgrgid_r" "ac_cv_func_getgrgid_r" -if test "x$ac_cv_func_getgrgid_r" = xyes; then : +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getgrgid_r with 5 args" >&5 -$as_echo_n "checking for getgrgid_r with 5 args... " >&6; } -if ${tcl_cv_api_getgrgid_r_5+:} false; then : - $as_echo_n "(cached) " >&6 -else +#ifdef __STDC__ +# include +#else +# include +#endif - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +#undef $ac_func - #include - #include +/* 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 () { - - gid_t gid; - struct group gr, *grp; - char buf[512]; - int buflen = 512; - - (void) getgrgid_r(gid, &gr, buf, buflen, &grp); - +return f != $ac_func; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_getgrgid_r_5=yes +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 - tcl_cv_api_getgrgid_r_5=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getgrgid_r_5" >&5 -$as_echo "$tcl_cv_api_getgrgid_r_5" >&6; } - tcl_ok=$tcl_cv_api_getgrgid_r_5 - if test "$tcl_ok" = yes; then - -$as_echo "#define HAVE_GETGRGID_R_5 1" >>confdefs.h +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 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getgrgid_r with 4 args" >&5 -$as_echo_n "checking for getgrgid_r with 4 args... " >&6; } -if ${tcl_cv_api_getgrgid_r_4+:} false; then : - $as_echo_n "(cached) " >&6 else + NEED_FAKE_RFC2553=1 +fi +done - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + echo "$as_me:$LINENO: checking for struct addrinfo" >&5 +echo $ECHO_N "checking for struct addrinfo... $ECHO_C" >&6 +if test "${ac_cv_type_struct_addrinfo+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 - #include +#include +#include +#include +#include + int main () { - - gid_t gid; - struct group gr; - char buf[512]; - int buflen = 512; - - (void)getgrgid_r(gid, &gr, buf, buflen); - +if ((struct addrinfo *) 0) + return 0; +if (sizeof (struct addrinfo)) + return 0; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_getgrgid_r_4=yes +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_struct_addrinfo=yes else - tcl_cv_api_getgrgid_r_4=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_addrinfo=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getgrgid_r_4" >&5 -$as_echo "$tcl_cv_api_getgrgid_r_4" >&6; } - tcl_ok=$tcl_cv_api_getgrgid_r_4 - if test "$tcl_ok" = yes; then - -$as_echo "#define HAVE_GETGRGID_R_4 1" >>confdefs.h - - fi - fi - if test "$tcl_ok" = yes; then +echo "$as_me:$LINENO: result: $ac_cv_type_struct_addrinfo" >&5 +echo "${ECHO_T}$ac_cv_type_struct_addrinfo" >&6 +if test $ac_cv_type_struct_addrinfo = yes; then -$as_echo "#define HAVE_GETGRGID_R 1" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_ADDRINFO 1 +_ACEOF - fi +else + NEED_FAKE_RFC2553=1 fi - - ac_fn_c_check_func "$LINENO" "getgrnam_r" "ac_cv_func_getgrnam_r" -if test "x$ac_cv_func_getgrnam_r" = xyes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getgrnam_r with 5 args" >&5 -$as_echo_n "checking for getgrnam_r with 5 args... " >&6; } -if ${tcl_cv_api_getgrnam_r_5+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for struct in6_addr" >&5 +echo $ECHO_N "checking for struct in6_addr... $ECHO_C" >&6 +if test "${ac_cv_type_struct_in6_addr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat confdefs.h - <<_ACEOF >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. */ - #include - #include +#include +#include +#include +#include + int main () { - - char *name; - struct group gr, *grp; - char buf[512]; - int buflen = 512; - - (void) getgrnam_r(name, &gr, buf, buflen, &grp); - +if ((struct in6_addr *) 0) + return 0; +if (sizeof (struct in6_addr)) + return 0; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_getgrnam_r_5=yes +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_struct_in6_addr=yes else - tcl_cv_api_getgrnam_r_5=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_in6_addr=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getgrnam_r_5" >&5 -$as_echo "$tcl_cv_api_getgrnam_r_5" >&6; } - tcl_ok=$tcl_cv_api_getgrnam_r_5 - if test "$tcl_ok" = yes; then +echo "$as_me:$LINENO: result: $ac_cv_type_struct_in6_addr" >&5 +echo "${ECHO_T}$ac_cv_type_struct_in6_addr" >&6 +if test $ac_cv_type_struct_in6_addr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_IN6_ADDR 1 +_ACEOF -$as_echo "#define HAVE_GETGRNAM_R_5 1" >>confdefs.h - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getgrnam_r with 4 args" >&5 -$as_echo_n "checking for getgrnam_r with 4 args... " >&6; } -if ${tcl_cv_api_getgrnam_r_4+:} false; then : - $as_echo_n "(cached) " >&6 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + NEED_FAKE_RFC2553=1 +fi +echo "$as_me:$LINENO: checking for struct sockaddr_in6" >&5 +echo $ECHO_N "checking for struct sockaddr_in6... $ECHO_C" >&6 +if test "${ac_cv_type_struct_sockaddr_in6+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 - #include +#include +#include +#include +#include + int main () { - - char *name; - struct group gr; - char buf[512]; - int buflen = 512; - - (void)getgrnam_r(name, &gr, buf, buflen); - +if ((struct sockaddr_in6 *) 0) + return 0; +if (sizeof (struct sockaddr_in6)) + return 0; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_getgrnam_r_4=yes +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_struct_sockaddr_in6=yes else - tcl_cv_api_getgrnam_r_4=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_sockaddr_in6=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_getgrnam_r_4" >&5 -$as_echo "$tcl_cv_api_getgrnam_r_4" >&6; } - tcl_ok=$tcl_cv_api_getgrnam_r_4 - if test "$tcl_ok" = yes; then - -$as_echo "#define HAVE_GETGRNAM_R_4 1" >>confdefs.h - - fi - fi - if test "$tcl_ok" = yes; then +echo "$as_me:$LINENO: result: $ac_cv_type_struct_sockaddr_in6" >&5 +echo "${ECHO_T}$ac_cv_type_struct_sockaddr_in6" >&6 +if test $ac_cv_type_struct_sockaddr_in6 = yes; then -$as_echo "#define HAVE_GETGRNAM_R 1" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_SOCKADDR_IN6 1 +_ACEOF - fi +else + NEED_FAKE_RFC2553=1 fi - - if test "`uname -s`" = "Darwin" && \ - test "`uname -r | awk -F. '{print $1}'`" -gt 5; then - # Starting with Darwin 6 (Mac OSX 10.2), gethostbyX - # are actually MT-safe as they always return pointers - # from TSD instead of static storage. - -$as_echo "#define HAVE_MTSAFE_GETHOSTBYNAME 1" >>confdefs.h - - -$as_echo "#define HAVE_MTSAFE_GETHOSTBYADDR 1" >>confdefs.h - - - elif test "`uname -s`" = "HP-UX" && \ - test "`uname -r|sed -e 's|B\.||' -e 's|\..*$||'`" -gt 10; then - # Starting with HPUX 11.00 (we believe), gethostbyX - # are actually MT-safe as they always return pointers - # from TSD instead of static storage. - -$as_echo "#define HAVE_MTSAFE_GETHOSTBYNAME 1" >>confdefs.h - - -$as_echo "#define HAVE_MTSAFE_GETHOSTBYADDR 1" >>confdefs.h - - - else - ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r" -if test "x$ac_cv_func_gethostbyname_r" = xyes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname_r with 6 args" >&5 -$as_echo_n "checking for gethostbyname_r with 6 args... " >&6; } -if ${tcl_cv_api_gethostbyname_r_6+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for struct sockaddr_storage" >&5 +echo $ECHO_N "checking for struct sockaddr_storage... $ECHO_C" >&6 +if test "${ac_cv_type_struct_sockaddr_storage+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat confdefs.h - <<_ACEOF >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. */ - #include +#include +#include +#include +#include + int main () { - - char *name; - struct hostent *he, *res; - char buffer[2048]; - int buflen = 2048; - int h_errnop; - - (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop); - +if ((struct sockaddr_storage *) 0) + return 0; +if (sizeof (struct sockaddr_storage)) + return 0; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_gethostbyname_r_6=yes +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_struct_sockaddr_storage=yes else - tcl_cv_api_gethostbyname_r_6=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_struct_sockaddr_storage=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_gethostbyname_r_6" >&5 -$as_echo "$tcl_cv_api_gethostbyname_r_6" >&6; } - tcl_ok=$tcl_cv_api_gethostbyname_r_6 - if test "$tcl_ok" = yes; then +echo "$as_me:$LINENO: result: $ac_cv_type_struct_sockaddr_storage" >&5 +echo "${ECHO_T}$ac_cv_type_struct_sockaddr_storage" >&6 +if test $ac_cv_type_struct_sockaddr_storage = yes; then -$as_echo "#define HAVE_GETHOSTBYNAME_R_6 1" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 +_ACEOF - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname_r with 5 args" >&5 -$as_echo_n "checking for gethostbyname_r with 5 args... " >&6; } -if ${tcl_cv_api_gethostbyname_r_5+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +else + NEED_FAKE_RFC2553=1 +fi - #include +if test "x$NEED_FAKE_RFC2553" = "x1"; then -int -main () -{ +cat >>confdefs.h <<\_ACEOF +#define NEED_FAKE_RFC2553 1 +_ACEOF - char *name; - struct hostent *he; - char buffer[2048]; - int buflen = 2048; - int h_errnop; + case $LIBOBJS in + "fake-rfc2553.$ac_objext" | \ + *" fake-rfc2553.$ac_objext" | \ + "fake-rfc2553.$ac_objext "* | \ + *" fake-rfc2553.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fake-rfc2553.$ac_objext" ;; +esac - (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop); + echo "$as_me:$LINENO: checking for strlcpy" >&5 +echo $ECHO_N "checking for strlcpy... $ECHO_C" >&6 +if test "${ac_cv_func_strlcpy+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 strlcpy to an innocuous variant, in case declares strlcpy. + For example, HP-UX 11i declares gettimeofday. */ +#define strlcpy innocuous_strlcpy + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char strlcpy (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef strlcpy +/* 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 strlcpy (); +/* 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_strlcpy) || defined (__stub___strlcpy) +choke me +#else +char (*f) () = strlcpy; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != strlcpy; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_gethostbyname_r_5=yes +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_strlcpy=yes else - tcl_cv_api_gethostbyname_r_5=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_strlcpy=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_gethostbyname_r_5" >&5 -$as_echo "$tcl_cv_api_gethostbyname_r_5" >&6; } - tcl_ok=$tcl_cv_api_gethostbyname_r_5 - if test "$tcl_ok" = yes; then +echo "$as_me:$LINENO: result: $ac_cv_func_strlcpy" >&5 +echo "${ECHO_T}$ac_cv_func_strlcpy" >&6 -$as_echo "#define HAVE_GETHOSTBYNAME_R_5 1" >>confdefs.h +fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname_r with 3 args" >&5 -$as_echo_n "checking for gethostbyname_r with 3 args... " >&6; } -if ${tcl_cv_api_gethostbyname_r_3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +#-------------------------------------------------------------------- +# Look for thread-safe variants of some library functions. +#-------------------------------------------------------------------- + +if test "${TCL_THREADS}" = 1; then + echo "$as_me:$LINENO: checking for getpwuid_r" >&5 +echo $ECHO_N "checking for getpwuid_r... $ECHO_C" >&6 +if test "${ac_cv_func_getpwuid_r+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 getpwuid_r to an innocuous variant, in case declares getpwuid_r. + For example, HP-UX 11i declares gettimeofday. */ +#define getpwuid_r innocuous_getpwuid_r - #include +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char getpwuid_r (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -int -main () -{ +#ifdef __STDC__ +# include +#else +# include +#endif - char *name; - struct hostent *he; - struct hostent_data data; +#undef getpwuid_r - (void) gethostbyname_r(name, he, &data); +/* 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 getpwuid_r (); +/* 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_getpwuid_r) || defined (__stub___getpwuid_r) +choke me +#else +char (*f) () = getpwuid_r; +#endif +#ifdef __cplusplus +} +#endif +int +main () +{ +return f != getpwuid_r; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_gethostbyname_r_3=yes +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_getpwuid_r=yes else - tcl_cv_api_gethostbyname_r_3=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_gethostbyname_r_3" >&5 -$as_echo "$tcl_cv_api_gethostbyname_r_3" >&6; } - tcl_ok=$tcl_cv_api_gethostbyname_r_3 - if test "$tcl_ok" = yes; then - -$as_echo "#define HAVE_GETHOSTBYNAME_R_3 1" >>confdefs.h - - fi - fi - fi - if test "$tcl_ok" = yes; then - -$as_echo "#define HAVE_GETHOSTBYNAME_R 1" >>confdefs.h - - fi + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_func_getpwuid_r=no fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_getpwuid_r" >&5 +echo "${ECHO_T}$ac_cv_func_getpwuid_r" >&6 +if test $ac_cv_func_getpwuid_r = yes; then - ac_fn_c_check_func "$LINENO" "gethostbyaddr_r" "ac_cv_func_gethostbyaddr_r" -if test "x$ac_cv_func_gethostbyaddr_r" = xyes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyaddr_r with 7 args" >&5 -$as_echo_n "checking for gethostbyaddr_r with 7 args... " >&6; } -if ${tcl_cv_api_gethostbyaddr_r_7+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for getpwuid_r with 5 args" >&5 +echo $ECHO_N "checking for getpwuid_r with 5 args... $ECHO_C" >&6 +if test "${tcl_cv_api_getpwuid_r_5+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ - #include + #include + #include int main () { - char *addr; - int length; - int type; - struct hostent *result; - char buffer[2048]; - int buflen = 2048; - int h_errnop; + uid_t uid; + struct passwd pw, *pwp; + char buf[512]; + int buflen = 512; - (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, - &h_errnop); + (void) getpwuid_r(uid, &pw, buf, buflen, &pwp); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_gethostbyaddr_r_7=yes +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_api_getpwuid_r_5=yes else - tcl_cv_api_gethostbyaddr_r_7=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_getpwuid_r_5=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_gethostbyaddr_r_7" >&5 -$as_echo "$tcl_cv_api_gethostbyaddr_r_7" >&6; } - tcl_ok=$tcl_cv_api_gethostbyaddr_r_7 +echo "$as_me:$LINENO: result: $tcl_cv_api_getpwuid_r_5" >&5 +echo "${ECHO_T}$tcl_cv_api_getpwuid_r_5" >&6 + tcl_ok=$tcl_cv_api_getpwuid_r_5 if test "$tcl_ok" = yes; then -$as_echo "#define HAVE_GETHOSTBYADDR_R_7 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETPWUID_R_5 1 +_ACEOF else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyaddr_r with 8 args" >&5 -$as_echo_n "checking for gethostbyaddr_r with 8 args... " >&6; } -if ${tcl_cv_api_gethostbyaddr_r_8+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for getpwuid_r with 4 args" >&5 +echo $ECHO_N "checking for getpwuid_r with 4 args... $ECHO_C" >&6 +if test "${tcl_cv_api_getpwuid_r_4+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ - #include + #include + #include int main () { - char *addr; - int length; - int type; - struct hostent *result, *resultp; - char buffer[2048]; - int buflen = 2048; - int h_errnop; + uid_t uid; + struct passwd pw; + char buf[512]; + int buflen = 512; - (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, - &resultp, &h_errnop); + (void)getpwnam_r(uid, &pw, buf, buflen); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_api_gethostbyaddr_r_8=yes +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_api_getpwuid_r_4=yes else - tcl_cv_api_gethostbyaddr_r_8=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_getpwuid_r_4=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_gethostbyaddr_r_8" >&5 -$as_echo "$tcl_cv_api_gethostbyaddr_r_8" >&6; } - tcl_ok=$tcl_cv_api_gethostbyaddr_r_8 +echo "$as_me:$LINENO: result: $tcl_cv_api_getpwuid_r_4" >&5 +echo "${ECHO_T}$tcl_cv_api_getpwuid_r_4" >&6 + tcl_ok=$tcl_cv_api_getpwuid_r_4 if test "$tcl_ok" = yes; then -$as_echo "#define HAVE_GETHOSTBYADDR_R_8 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETPWUID_R_4 1 +_ACEOF fi fi if test "$tcl_ok" = yes; then -$as_echo "#define HAVE_GETHOSTBYADDR_R 1" >>confdefs.h - - fi - -fi - - fi -fi - -#--------------------------------------------------------------------------- -# Check for serial port interface. -# -# termios.h is present on all POSIX systems. -# sys/ioctl.h is almost always present, though what it contains -# is system-specific. -# sys/modem.h is needed on HP-UX. -#--------------------------------------------------------------------------- - -for ac_header in termios.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "termios.h" "ac_cv_header_termios_h" "$ac_includes_default" -if test "x$ac_cv_header_termios_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_TERMIOS_H 1 +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETPWUID_R 1 _ACEOF -fi - -done - -for ac_header in sys/ioctl.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_ioctl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_IOCTL_H 1 -_ACEOF + fi fi -done - -for ac_header in sys/modem.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/modem.h" "ac_cv_header_sys_modem_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_modem_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_MODEM_H 1 + echo "$as_me:$LINENO: checking for getpwnam_r" >&5 +echo $ECHO_N "checking for getpwnam_r... $ECHO_C" >&6 +if test "${ac_cv_func_getpwnam_r+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 getpwnam_r to an innocuous variant, in case declares getpwnam_r. + For example, HP-UX 11i declares gettimeofday. */ +#define getpwnam_r innocuous_getpwnam_r -fi - -done +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char getpwnam_r (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#endif -#-------------------------------------------------------------------- -# Include sys/select.h if it exists and if it supplies things -# that appear to be useful and aren't already in sys/types.h. -# This appears to be true only on the RS/6000 under AIX. Some -# systems like OSF/1 have a sys/select.h that's of no use, and -# other systems like SCO UNIX have a sys/select.h that's -# pernicious. If "fd_set" isn't defined anywhere then set a -# special flag. -#-------------------------------------------------------------------- +#undef getpwnam_r -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fd_set in sys/types" >&5 -$as_echo_n "checking for fd_set in sys/types... " >&6; } -if ${tcl_cv_type_fd_set+:} false; then : - $as_echo_n "(cached) " >&6 -else +/* 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 getpwnam_r (); +/* 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_getpwnam_r) || defined (__stub___getpwnam_r) +choke me +#else +char (*f) () = getpwnam_r; +#endif +#ifdef __cplusplus +} +#endif - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include int main () { -fd_set readMask, writeMask; +return f != getpwnam_r; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_type_fd_set=yes +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_getpwnam_r=yes else - tcl_cv_type_fd_set=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_getpwnam_r=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_type_fd_set" >&5 -$as_echo "$tcl_cv_type_fd_set" >&6; } -tcl_ok=$tcl_cv_type_fd_set -if test $tcl_ok = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fd_mask in sys/select" >&5 -$as_echo_n "checking for fd_mask in sys/select... " >&6; } -if ${tcl_cv_grep_fd_mask+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: result: $ac_cv_func_getpwnam_r" >&5 +echo "${ECHO_T}$ac_cv_func_getpwnam_r" >&6 +if test $ac_cv_func_getpwnam_r = yes; then + + echo "$as_me:$LINENO: checking for getpwnam_r with 5 args" >&5 +echo $ECHO_N "checking for getpwnam_r with 5 args... $ECHO_C" >&6 +if test "${tcl_cv_api_getpwnam_r_5+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ -#include -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "fd_mask" >/dev/null 2>&1; then : - tcl_cv_grep_fd_mask=present -else - tcl_cv_grep_fd_mask=missing -fi -rm -f conftest* + #include + #include -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_grep_fd_mask" >&5 -$as_echo "$tcl_cv_grep_fd_mask" >&6; } - if test $tcl_cv_grep_fd_mask = present; then - -$as_echo "#define HAVE_SYS_SELECT_H 1" >>confdefs.h - - tcl_ok=yes - fi -fi -if test $tcl_ok = no; then - -$as_echo "#define NO_FD_SET 1" >>confdefs.h - -fi +int +main () +{ -#------------------------------------------------------------------------------ -# Find out all about time handling differences. -#------------------------------------------------------------------------------ + char *name; + struct passwd pw, *pwp; + char buf[512]; + int buflen = 512; + (void) getpwnam_r(name, &pw, buf, buflen, &pwp); - for ac_header in sys/time.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_time_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_TIME_H 1 + ; + 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_api_getpwnam_r_5=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +tcl_cv_api_getpwnam_r_5=no fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_api_getpwnam_r_5" >&5 +echo "${ECHO_T}$tcl_cv_api_getpwnam_r_5" >&6 + tcl_ok=$tcl_cv_api_getpwnam_r_5 + if test "$tcl_ok" = yes; then -done +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETPWNAM_R_5 1 +_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } -if ${ac_cv_header_time+:} false; then : - $as_echo_n "(cached) " >&6 + else + echo "$as_me:$LINENO: checking for getpwnam_r with 4 args" >&5 +echo $ECHO_N "checking for getpwnam_r with 4 args... $ECHO_C" >&6 +if test "${tcl_cv_api_getpwnam_r_4+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ -#include -#include -#include + + #include + #include int main () { -if ((struct tm *) 0) -return 0; + + char *name; + struct passwd pw; + char buf[512]; + int buflen = 512; + + (void)getpwnam_r(name, &pw, buf, buflen); + ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_time=yes +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_api_getpwnam_r_4=yes else - ac_cv_header_time=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_getpwnam_r_4=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h +echo "$as_me:$LINENO: result: $tcl_cv_api_getpwnam_r_4" >&5 +echo "${ECHO_T}$tcl_cv_api_getpwnam_r_4" >&6 + tcl_ok=$tcl_cv_api_getpwnam_r_4 + if test "$tcl_ok" = yes; then -fi +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETPWNAM_R_4 1 +_ACEOF + fi + fi + if test "$tcl_ok" = yes; then - for ac_func in gmtime_r localtime_r mktime -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETPWNAM_R 1 _ACEOF -fi -done + fi +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking tm_tzadj in struct tm" >&5 -$as_echo_n "checking tm_tzadj in struct tm... " >&6; } -if ${tcl_cv_member_tm_tzadj+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for getgrgid_r" >&5 +echo $ECHO_N "checking for getgrgid_r... $ECHO_C" >&6 +if test "${ac_cv_func_getgrgid_r+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -struct tm tm; tm.tm_tzadj; - ; - return 0; -} + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_member_tm_tzadj=yes -else - tcl_cv_member_tm_tzadj=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_member_tm_tzadj" >&5 -$as_echo "$tcl_cv_member_tm_tzadj" >&6; } - if test $tcl_cv_member_tm_tzadj = yes ; then +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define getgrgid_r to an innocuous variant, in case declares getgrgid_r. + For example, HP-UX 11i declares gettimeofday. */ +#define getgrgid_r innocuous_getgrgid_r -$as_echo "#define HAVE_TM_TZADJ 1" >>confdefs.h +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char getgrgid_r (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ - fi +#ifdef __STDC__ +# include +#else +# include +#endif - { $as_echo "$as_me:${as_lineno-$LINENO}: checking tm_gmtoff in struct tm" >&5 -$as_echo_n "checking tm_gmtoff in struct tm... " >&6; } -if ${tcl_cv_member_tm_gmtoff+:} false; then : - $as_echo_n "(cached) " >&6 -else +#undef getgrgid_r + +/* 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 getgrgid_r (); +/* 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_getgrgid_r) || defined (__stub___getgrgid_r) +choke me +#else +char (*f) () = getgrgid_r; +#endif +#ifdef __cplusplus +} +#endif - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include int main () { -struct tm tm; tm.tm_gmtoff; +return f != getgrgid_r; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_member_tm_gmtoff=yes +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_getgrgid_r=yes else - tcl_cv_member_tm_gmtoff=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_getgrgid_r=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_member_tm_gmtoff" >&5 -$as_echo "$tcl_cv_member_tm_gmtoff" >&6; } - if test $tcl_cv_member_tm_gmtoff = yes ; then - -$as_echo "#define HAVE_TM_GMTOFF 1" >>confdefs.h +echo "$as_me:$LINENO: result: $ac_cv_func_getgrgid_r" >&5 +echo "${ECHO_T}$ac_cv_func_getgrgid_r" >&6 +if test $ac_cv_func_getgrgid_r = yes; then - fi - - # - # Its important to include time.h in this check, as some systems - # (like convex) have timezone functions, etc. - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking long timezone variable" >&5 -$as_echo_n "checking long timezone variable... " >&6; } -if ${tcl_cv_timezone_long+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for getgrgid_r with 5 args" >&5 +echo $ECHO_N "checking for getgrgid_r with 5 args... $ECHO_C" >&6 +if test "${tcl_cv_api_getgrgid_r_5+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ -#include + + #include + #include + int main () { -extern long timezone; - timezone += 1; - exit (0); + + gid_t gid; + struct group gr, *grp; + char buf[512]; + int buflen = 512; + + (void) getgrgid_r(gid, &gr, buf, buflen, &grp); + ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_timezone_long=yes +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_api_getgrgid_r_5=yes else - tcl_cv_timezone_long=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_getgrgid_r_5=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_timezone_long" >&5 -$as_echo "$tcl_cv_timezone_long" >&6; } - if test $tcl_cv_timezone_long = yes ; then +echo "$as_me:$LINENO: result: $tcl_cv_api_getgrgid_r_5" >&5 +echo "${ECHO_T}$tcl_cv_api_getgrgid_r_5" >&6 + tcl_ok=$tcl_cv_api_getgrgid_r_5 + if test "$tcl_ok" = yes; then -$as_echo "#define HAVE_TIMEZONE_VAR 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETGRGID_R_5 1 +_ACEOF else - # - # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking time_t timezone variable" >&5 -$as_echo_n "checking time_t timezone variable... " >&6; } -if ${tcl_cv_timezone_time+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking for getgrgid_r with 4 args" >&5 +echo $ECHO_N "checking for getgrgid_r with 4 args... $ECHO_C" >&6 +if test "${tcl_cv_api_getgrgid_r_4+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ -#include + + #include + #include + int main () { -extern time_t timezone; - timezone += 1; - exit (0); + + gid_t gid; + struct group gr; + char buf[512]; + int buflen = 512; + + (void)getgrgid_r(gid, &gr, buf, buflen); + ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_timezone_time=yes +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_api_getgrgid_r_4=yes else - tcl_cv_timezone_time=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_getgrgid_r_4=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_timezone_time" >&5 -$as_echo "$tcl_cv_timezone_time" >&6; } - if test $tcl_cv_timezone_time = yes ; then +echo "$as_me:$LINENO: result: $tcl_cv_api_getgrgid_r_4" >&5 +echo "${ECHO_T}$tcl_cv_api_getgrgid_r_4" >&6 + tcl_ok=$tcl_cv_api_getgrgid_r_4 + if test "$tcl_ok" = yes; then -$as_echo "#define HAVE_TIMEZONE_VAR 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETGRGID_R_4 1 +_ACEOF fi fi + if test "$tcl_ok" = yes; then - -#-------------------------------------------------------------------- -# Some systems (e.g., IRIX 4.0.5) lack some fields in struct stat. But -# we might be able to use fstatfs instead. Some systems (OpenBSD?) also -# lack blkcnt_t. -#-------------------------------------------------------------------- - -if test "$ac_cv_cygwin" != "yes"; then - ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BLOCKS 1 +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETGRGID_R 1 _ACEOF + fi fi -ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" -if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 + echo "$as_me:$LINENO: checking for getgrnam_r" >&5 +echo $ECHO_N "checking for getgrnam_r... $ECHO_C" >&6 +if test "${ac_cv_func_getgrnam_r+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 getgrnam_r to an innocuous variant, in case declares getgrnam_r. + For example, HP-UX 11i declares gettimeofday. */ +#define getgrnam_r innocuous_getgrnam_r +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char getgrnam_r (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -fi +#ifdef __STDC__ +# include +#else +# include +#endif -fi -ac_fn_c_check_type "$LINENO" "blkcnt_t" "ac_cv_type_blkcnt_t" "$ac_includes_default" -if test "x$ac_cv_type_blkcnt_t" = xyes; then : +#undef getgrnam_r -cat >>confdefs.h <<_ACEOF -#define HAVE_BLKCNT_T 1 -_ACEOF +/* 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 getgrnam_r (); +/* 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_getgrnam_r) || defined (__stub___getgrnam_r) +choke me +#else +char (*f) () = getgrnam_r; +#endif +#ifdef __cplusplus +} +#endif +int +main () +{ +return f != getgrnam_r; + ; + 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_getgrnam_r=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_func_getgrnam_r=no fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_getgrnam_r" >&5 +echo "${ECHO_T}$ac_cv_func_getgrnam_r" >&6 +if test $ac_cv_func_getgrnam_r = yes; then -ac_fn_c_check_func "$LINENO" "fstatfs" "ac_cv_func_fstatfs" -if test "x$ac_cv_func_fstatfs" = xyes; then : - + echo "$as_me:$LINENO: checking for getgrnam_r with 5 args" >&5 +echo $ECHO_N "checking for getgrnam_r with 5 args... $ECHO_C" >&6 +if test "${tcl_cv_api_getgrnam_r_5+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else -$as_echo "#define NO_FSTATFS 1" >>confdefs.h - -fi + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + #include + #include -#-------------------------------------------------------------------- -# Some system have no memcmp or it does not work with 8 bit data, this -# checks it and add memcmp.o to LIBOBJS if needed -#-------------------------------------------------------------------- +int +main () +{ + + char *name; + struct group gr, *grp; + char buf[512]; + int buflen = 512; + + (void) getgrnam_r(name, &gr, buf, buflen, &grp); -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 -$as_echo_n "checking for working memcmp... " >&6; } -if ${ac_cv_func_memcmp_working+:} false; then : - $as_echo_n "(cached) " >&6 + ; + 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_api_getgrnam_r_5=yes else - if test "$cross_compiling" = yes; then : - ac_cv_func_memcmp_working=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_getgrnam_r_5=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_api_getgrnam_r_5" >&5 +echo "${ECHO_T}$tcl_cv_api_getgrnam_r_5" >&6 + tcl_ok=$tcl_cv_api_getgrnam_r_5 + if test "$tcl_ok" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETGRNAM_R_5 1 +_ACEOF + + else + echo "$as_me:$LINENO: checking for getgrnam_r with 4 args" >&5 +echo $ECHO_N "checking for getgrnam_r with 4 args... $ECHO_C" >&6 +if test "${tcl_cv_api_getgrnam_r_4+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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_includes_default + + #include + #include + int main () { - /* Some versions of memcmp are not 8-bit clean. */ - char c0 = '\100', c1 = '\200', c2 = '\201'; - if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) - return 1; + char *name; + struct group gr; + char buf[512]; + int buflen = 512; - /* The Next x86 OpenStep bug shows up only when comparing 16 bytes - or more and with at least one buffer not starting on a 4-byte boundary. - William Lewis provided this test program. */ - { - char foo[21]; - char bar[21]; - int i; - for (i = 0; i < 4; i++) - { - char *a = foo + i; - char *b = bar + i; - strcpy (a, "--------01111111"); - strcpy (b, "--------10000000"); - if (memcmp (a, b, 16) >= 0) - return 1; - } - return 0; - } + (void)getgrnam_r(name, &gr, buf, buflen); ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_memcmp_working=yes +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_api_getgrnam_r_4=yes else - ac_cv_func_memcmp_working=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_getgrnam_r_4=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $tcl_cv_api_getgrnam_r_4" >&5 +echo "${ECHO_T}$tcl_cv_api_getgrnam_r_4" >&6 + tcl_ok=$tcl_cv_api_getgrnam_r_4 + if test "$tcl_ok" = yes; then -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 -$as_echo "$ac_cv_func_memcmp_working" >&6; } -test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in - *" memcmp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" - ;; -esac +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETGRNAM_R_4 1 +_ACEOF + fi + fi + if test "$tcl_ok" = yes; then +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETGRNAM_R 1 +_ACEOF -#-------------------------------------------------------------------- -# Some system like SunOS 4 and other BSD like systems have no memmove -# (we assume they have bcopy instead). {The replacement define is in -# compat/string.h} -#-------------------------------------------------------------------- + fi -ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" -if test "x$ac_cv_func_memmove" = xyes; then : +fi -else + if test "`uname -s`" = "Darwin" && \ + test "`uname -r | awk -F. '{print $1}'`" -gt 5; then + # Starting with Darwin 6 (Mac OSX 10.2), gethostbyX + # are actually MT-safe as they always return pointers + # from TSD instead of static storage. +cat >>confdefs.h <<\_ACEOF +#define HAVE_MTSAFE_GETHOSTBYNAME 1 +_ACEOF -$as_echo "#define NO_MEMMOVE 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_MTSAFE_GETHOSTBYADDR 1 +_ACEOF -$as_echo "#define NO_STRING_H 1" >>confdefs.h -fi + elif test "`uname -s`" = "HP-UX" && \ + test "`uname -r|sed -e 's|B\.||' -e 's|\..*$||'`" -gt 10; then + # Starting with HPUX 11.00 (we believe), gethostbyX + # are actually MT-safe as they always return pointers + # from TSD instead of static storage. +cat >>confdefs.h <<\_ACEOF +#define HAVE_MTSAFE_GETHOSTBYNAME 1 +_ACEOF -#-------------------------------------------------------------------- -# On some systems strstr is broken: it returns a pointer even even if -# the original string is empty. -#-------------------------------------------------------------------- +cat >>confdefs.h <<\_ACEOF +#define HAVE_MTSAFE_GETHOSTBYADDR 1 +_ACEOF - ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" -if test "x$ac_cv_func_strstr" = xyes; then : - tcl_ok=1 -else - tcl_ok=0 -fi - if test "$tcl_ok" = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking proper strstr implementation" >&5 -$as_echo_n "checking proper strstr implementation... " >&6; } -if ${tcl_cv_strstr_unbroken+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - tcl_cv_strstr_unbroken=unknown + else + echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 +echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname_r+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ -int main() { - extern int strstr(); - exit(strstr("\0test", "test") ? 1 : 0); +/* Define gethostbyname_r to an innocuous variant, in case declares gethostbyname_r. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyname_r innocuous_gethostbyname_r + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname_r (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyname_r + +/* 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 gethostbyname_r (); +/* 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_gethostbyname_r) || defined (__stub___gethostbyname_r) +choke me +#else +char (*f) () = gethostbyname_r; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gethostbyname_r; + ; + return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - tcl_cv_strstr_unbroken=ok +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_gethostbyname_r=yes else - tcl_cv_strstr_unbroken=broken + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gethostbyname_r=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname_r" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname_r" >&6 +if test $ac_cv_func_gethostbyname_r = yes; then -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strstr_unbroken" >&5 -$as_echo "$tcl_cv_strstr_unbroken" >&6; } - if test "$tcl_cv_strstr_unbroken" = "ok"; then - tcl_ok=1 - else - tcl_ok=0 - fi - fi - if test "$tcl_ok" = 0; then - case " $LIBOBJS " in - *" strstr.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strstr.$ac_objext" - ;; -esac + echo "$as_me:$LINENO: checking for gethostbyname_r with 6 args" >&5 +echo $ECHO_N "checking for gethostbyname_r with 6 args... $ECHO_C" >&6 +if test "${tcl_cv_api_gethostbyname_r_6+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else - USE_COMPAT=1 - fi + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + #include -#-------------------------------------------------------------------- -# Check for strtoul function. This is tricky because under some -# versions of AIX strtoul returns an incorrect terminator -# pointer for the string "0". -#-------------------------------------------------------------------- +int +main () +{ + char *name; + struct hostent *he, *res; + char buffer[2048]; + int buflen = 2048; + int h_errnop; - ac_fn_c_check_func "$LINENO" "strtoul" "ac_cv_func_strtoul" -if test "x$ac_cv_func_strtoul" = xyes; then : - tcl_ok=1 -else - tcl_ok=0 -fi + (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop); - if test "$tcl_ok" = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking proper strtoul implementation" >&5 -$as_echo_n "checking proper strtoul implementation... " >&6; } -if ${tcl_cv_strtoul_unbroken+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - tcl_cv_strtoul_unbroken=unknown -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int main() { - extern int strtoul(); - char *term, *string = "0"; - exit(strtoul(string,&term,0) != 0 || term != string+1); + ; + return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - tcl_cv_strtoul_unbroken=ok +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_api_gethostbyname_r_6=yes else - tcl_cv_strtoul_unbroken=broken + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_gethostbyname_r_6=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $tcl_cv_api_gethostbyname_r_6" >&5 +echo "${ECHO_T}$tcl_cv_api_gethostbyname_r_6" >&6 + tcl_ok=$tcl_cv_api_gethostbyname_r_6 + if test "$tcl_ok" = yes; then -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strtoul_unbroken" >&5 -$as_echo "$tcl_cv_strtoul_unbroken" >&6; } - if test "$tcl_cv_strtoul_unbroken" = "ok"; then - tcl_ok=1 - else - tcl_ok=0 - fi - fi - if test "$tcl_ok" = 0; then - case " $LIBOBJS " in - *" strtoul.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strtoul.$ac_objext" - ;; -esac +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETHOSTBYNAME_R_6 1 +_ACEOF - USE_COMPAT=1 - fi + else + echo "$as_me:$LINENO: checking for gethostbyname_r with 5 args" >&5 +echo $ECHO_N "checking for gethostbyname_r with 5 args... $ECHO_C" >&6 +if test "${tcl_cv_api_gethostbyname_r_5+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. */ -#-------------------------------------------------------------------- -# Check for the strtod function. This is tricky because in some -# versions of Linux strtod mis-parses strings starting with "+". -#-------------------------------------------------------------------- + #include +int +main () +{ - ac_fn_c_check_func "$LINENO" "strtod" "ac_cv_func_strtod" -if test "x$ac_cv_func_strtod" = xyes; then : - tcl_ok=1 -else - tcl_ok=0 -fi + char *name; + struct hostent *he; + char buffer[2048]; + int buflen = 2048; + int h_errnop; - if test "$tcl_ok" = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking proper strtod implementation" >&5 -$as_echo_n "checking proper strtod implementation... " >&6; } -if ${tcl_cv_strtod_unbroken+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - tcl_cv_strtod_unbroken=unknown -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop); + + ; + 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_api_gethostbyname_r_5=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_gethostbyname_r_5=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_api_gethostbyname_r_5" >&5 +echo "${ECHO_T}$tcl_cv_api_gethostbyname_r_5" >&6 + tcl_ok=$tcl_cv_api_gethostbyname_r_5 + if test "$tcl_ok" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETHOSTBYNAME_R_5 1 +_ACEOF + + else + echo "$as_me:$LINENO: checking for gethostbyname_r with 3 args" >&5 +echo $ECHO_N "checking for gethostbyname_r with 3 args... $ECHO_C" >&6 +if test "${tcl_cv_api_gethostbyname_r_3+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() { - extern double strtod(); - char *term, *string = " +69"; - exit(strtod(string,&term) != 69 || term != string+4); + + #include + +int +main () +{ + + char *name; + struct hostent *he; + struct hostent_data data; + + (void) gethostbyname_r(name, he, &data); + + ; + return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - tcl_cv_strtod_unbroken=ok +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_api_gethostbyname_r_3=yes else - tcl_cv_strtod_unbroken=broken + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_gethostbyname_r_3=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $tcl_cv_api_gethostbyname_r_3" >&5 +echo "${ECHO_T}$tcl_cv_api_gethostbyname_r_3" >&6 + tcl_ok=$tcl_cv_api_gethostbyname_r_3 + if test "$tcl_ok" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETHOSTBYNAME_R_3 1 +_ACEOF + + fi + fi + fi + if test "$tcl_ok" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETHOSTBYNAME_R 1 +_ACEOF + + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strtod_unbroken" >&5 -$as_echo "$tcl_cv_strtod_unbroken" >&6; } - if test "$tcl_cv_strtod_unbroken" = "ok"; then - tcl_ok=1 - else - tcl_ok=0 + + echo "$as_me:$LINENO: checking for gethostbyaddr_r" >&5 +echo $ECHO_N "checking for gethostbyaddr_r... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyaddr_r+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 gethostbyaddr_r to an innocuous variant, in case declares gethostbyaddr_r. + For example, HP-UX 11i declares gettimeofday. */ +#define gethostbyaddr_r innocuous_gethostbyaddr_r + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyaddr_r (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gethostbyaddr_r + +/* 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 gethostbyaddr_r (); +/* 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_gethostbyaddr_r) || defined (__stub___gethostbyaddr_r) +choke me +#else +char (*f) () = gethostbyaddr_r; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gethostbyaddr_r; + ; + 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_gethostbyaddr_r=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gethostbyaddr_r=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyaddr_r" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyaddr_r" >&6 +if test $ac_cv_func_gethostbyaddr_r = yes; then + + echo "$as_me:$LINENO: checking for gethostbyaddr_r with 7 args" >&5 +echo $ECHO_N "checking for gethostbyaddr_r with 7 args... $ECHO_C" >&6 +if test "${tcl_cv_api_gethostbyaddr_r_7+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 + +int +main () +{ + + char *addr; + int length; + int type; + struct hostent *result; + char buffer[2048]; + int buflen = 2048; + int h_errnop; + + (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, + &h_errnop); + + ; + 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_api_gethostbyaddr_r_7=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_gethostbyaddr_r_7=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_api_gethostbyaddr_r_7" >&5 +echo "${ECHO_T}$tcl_cv_api_gethostbyaddr_r_7" >&6 + tcl_ok=$tcl_cv_api_gethostbyaddr_r_7 + if test "$tcl_ok" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETHOSTBYADDR_R_7 1 +_ACEOF + + else + echo "$as_me:$LINENO: checking for gethostbyaddr_r with 8 args" >&5 +echo $ECHO_N "checking for gethostbyaddr_r with 8 args... $ECHO_C" >&6 +if test "${tcl_cv_api_gethostbyaddr_r_8+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 + +int +main () +{ + + char *addr; + int length; + int type; + struct hostent *result, *resultp; + char buffer[2048]; + int buflen = 2048; + int h_errnop; + + (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen, + &resultp, &h_errnop); + + ; + 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_api_gethostbyaddr_r_8=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_gethostbyaddr_r_8=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_api_gethostbyaddr_r_8" >&5 +echo "${ECHO_T}$tcl_cv_api_gethostbyaddr_r_8" >&6 + tcl_ok=$tcl_cv_api_gethostbyaddr_r_8 + if test "$tcl_ok" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETHOSTBYADDR_R_8 1 +_ACEOF + fi fi - if test "$tcl_ok" = 0; then - case " $LIBOBJS " in - *" strtod.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strtod.$ac_objext" - ;; -esac + if test "$tcl_ok" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GETHOSTBYADDR_R 1 +_ACEOF - USE_COMPAT=1 fi +fi -#-------------------------------------------------------------------- -# Under Solaris 2.4, strtod returns the wrong value for the -# terminating character under some conditions. Check for this -# and if the problem exists use a substitute procedure -# "fixstrtod" that corrects the error. -#-------------------------------------------------------------------- + fi +fi + +#--------------------------------------------------------------------------- +# Check for serial port interface. +# +# termios.h is present on all POSIX systems. +# sys/ioctl.h is almost always present, though what it contains +# is system-specific. +# sys/modem.h is needed on HP-UX. +#--------------------------------------------------------------------------- - ac_fn_c_check_func "$LINENO" "strtod" "ac_cv_func_strtod" -if test "x$ac_cv_func_strtod" = xyes; then : - tcl_strtod=1 +for ac_header in termios.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 - tcl_strtod=0 + # 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_header in sys/ioctl.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_header in sys/modem.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 + + +#-------------------------------------------------------------------- +# Include sys/select.h if it exists and if it supplies things +# that appear to be useful and aren't already in sys/types.h. +# This appears to be true only on the RS/6000 under AIX. Some +# systems like OSF/1 have a sys/select.h that's of no use, and +# other systems like SCO UNIX have a sys/select.h that's +# pernicious. If "fd_set" isn't defined anywhere then set a +# special flag. +#-------------------------------------------------------------------- + +echo "$as_me:$LINENO: checking for fd_set in sys/types" >&5 +echo $ECHO_N "checking for fd_set in sys/types... $ECHO_C" >&6 +if test "${tcl_cv_type_fd_set+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 +int +main () +{ +fd_set readMask, writeMask; + ; + 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_type_fd_set=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_type_fd_set=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_type_fd_set" >&5 +echo "${ECHO_T}$tcl_cv_type_fd_set" >&6 +tcl_ok=$tcl_cv_type_fd_set +if test $tcl_ok = no; then + echo "$as_me:$LINENO: checking for fd_mask in sys/select" >&5 +echo $ECHO_N "checking for fd_mask in sys/select... $ECHO_C" >&6 +if test "${tcl_cv_grep_fd_mask+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 + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "fd_mask" >/dev/null 2>&1; then + tcl_cv_grep_fd_mask=present +else + tcl_cv_grep_fd_mask=missing +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $tcl_cv_grep_fd_mask" >&5 +echo "${ECHO_T}$tcl_cv_grep_fd_mask" >&6 + if test $tcl_cv_grep_fd_mask = present; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SYS_SELECT_H 1 +_ACEOF + + tcl_ok=yes + fi +fi +if test $tcl_ok = no; then + +cat >>confdefs.h <<\_ACEOF +#define NO_FD_SET 1 +_ACEOF + +fi + +#------------------------------------------------------------------------------ +# Find out all about time handling differences. +#------------------------------------------------------------------------------ + + + +for ac_header in sys/time.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 + + echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+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 +#include +#include + +int +main () +{ +if ((struct tm *) 0) +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_header_time=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_time=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 +if test $ac_cv_header_time = yes; then + +cat >>confdefs.h <<\_ACEOF +#define TIME_WITH_SYS_TIME 1 +_ACEOF + +fi + + + + + +for ac_func in gmtime_r localtime_r mktime +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 declares $ac_func. + For example, HP-UX 11i 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 to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#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 + + + echo "$as_me:$LINENO: checking tm_tzadj in struct tm" >&5 +echo $ECHO_N "checking tm_tzadj in struct tm... $ECHO_C" >&6 +if test "${tcl_cv_member_tm_tzadj+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 +int +main () +{ +struct tm tm; tm.tm_tzadj; + ; + 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_member_tm_tzadj=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_member_tm_tzadj=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_member_tm_tzadj" >&5 +echo "${ECHO_T}$tcl_cv_member_tm_tzadj" >&6 + if test $tcl_cv_member_tm_tzadj = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TM_TZADJ 1 +_ACEOF + + fi + + echo "$as_me:$LINENO: checking tm_gmtoff in struct tm" >&5 +echo $ECHO_N "checking tm_gmtoff in struct tm... $ECHO_C" >&6 +if test "${tcl_cv_member_tm_gmtoff+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 +int +main () +{ +struct tm tm; tm.tm_gmtoff; + ; + 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_member_tm_gmtoff=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_member_tm_gmtoff=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_member_tm_gmtoff" >&5 +echo "${ECHO_T}$tcl_cv_member_tm_gmtoff" >&6 + if test $tcl_cv_member_tm_gmtoff = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TM_GMTOFF 1 +_ACEOF + + fi + + # + # Its important to include time.h in this check, as some systems + # (like convex) have timezone functions, etc. + # + echo "$as_me:$LINENO: checking long timezone variable" >&5 +echo $ECHO_N "checking long timezone variable... $ECHO_C" >&6 +if test "${tcl_cv_timezone_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. */ +#include +int +main () +{ +extern long timezone; + timezone += 1; + exit (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_timezone_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_timezone_long=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_timezone_long" >&5 +echo "${ECHO_T}$tcl_cv_timezone_long" >&6 + if test $tcl_cv_timezone_long = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TIMEZONE_VAR 1 +_ACEOF + + else + # + # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. + # + echo "$as_me:$LINENO: checking time_t timezone variable" >&5 +echo $ECHO_N "checking time_t timezone variable... $ECHO_C" >&6 +if test "${tcl_cv_timezone_time+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 +int +main () +{ +extern time_t timezone; + timezone += 1; + exit (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_timezone_time=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_timezone_time=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_timezone_time" >&5 +echo "${ECHO_T}$tcl_cv_timezone_time" >&6 + if test $tcl_cv_timezone_time = yes ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TIMEZONE_VAR 1 +_ACEOF + + fi + fi + + +#-------------------------------------------------------------------- +# Some systems (e.g., IRIX 4.0.5) lack some fields in struct stat. But +# we might be able to use fstatfs instead. Some systems (OpenBSD?) also +# lack blkcnt_t. +#-------------------------------------------------------------------- + +if test "$ac_cv_cygwin" != "yes"; then + echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5 +echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6 +if test "${ac_cv_member_struct_stat_st_blocks+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 () +{ +static struct stat ac_aggr; +if (ac_aggr.st_blocks) +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_member_struct_stat_st_blocks=yes +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 struct stat ac_aggr; +if (sizeof ac_aggr.st_blocks) +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_member_struct_stat_st_blocks=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_member_struct_stat_st_blocks=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6 +if test $ac_cv_member_struct_stat_st_blocks = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLOCKS 1 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5 +echo $ECHO_N "checking for struct stat.st_blksize... $ECHO_C" >&6 +if test "${ac_cv_member_struct_stat_st_blksize+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 () +{ +static struct stat ac_aggr; +if (ac_aggr.st_blksize) +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_member_struct_stat_st_blksize=yes +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 struct stat ac_aggr; +if (sizeof ac_aggr.st_blksize) +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_member_struct_stat_st_blksize=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_member_struct_stat_st_blksize=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_blksize" >&6 +if test $ac_cv_member_struct_stat_st_blksize = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 +_ACEOF + + +fi + +fi +echo "$as_me:$LINENO: checking for blkcnt_t" >&5 +echo $ECHO_N "checking for blkcnt_t... $ECHO_C" >&6 +if test "${ac_cv_type_blkcnt_t+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 ((blkcnt_t *) 0) + return 0; +if (sizeof (blkcnt_t)) + 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_blkcnt_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_blkcnt_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_blkcnt_t" >&5 +echo "${ECHO_T}$ac_cv_type_blkcnt_t" >&6 +if test $ac_cv_type_blkcnt_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_BLKCNT_T 1 +_ACEOF + + +fi + +echo "$as_me:$LINENO: checking for fstatfs" >&5 +echo $ECHO_N "checking for fstatfs... $ECHO_C" >&6 +if test "${ac_cv_func_fstatfs+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 fstatfs to an innocuous variant, in case declares fstatfs. + For example, HP-UX 11i declares gettimeofday. */ +#define fstatfs innocuous_fstatfs + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char fstatfs (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef fstatfs + +/* 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 fstatfs (); +/* 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_fstatfs) || defined (__stub___fstatfs) +choke me +#else +char (*f) () = fstatfs; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != fstatfs; + ; + 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_fstatfs=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_fstatfs=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_fstatfs" >&5 +echo "${ECHO_T}$ac_cv_func_fstatfs" >&6 +if test $ac_cv_func_fstatfs = yes; then + : +else + +cat >>confdefs.h <<\_ACEOF +#define NO_FSTATFS 1 +_ACEOF + +fi + + +#-------------------------------------------------------------------- +# Some system have no memcmp or it does not work with 8 bit data, this +# checks it and add memcmp.o to LIBOBJS if needed +#-------------------------------------------------------------------- + +echo "$as_me:$LINENO: checking for working memcmp" >&5 +echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 +if test "${ac_cv_func_memcmp_working+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_memcmp_working=no +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 () +{ + + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = 0x40, c1 = 0x80, c2 = 0x81; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + exit (1); + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + exit (1); + } + exit (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_func_memcmp_working=yes +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 ) +ac_cv_func_memcmp_working=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: $ac_cv_func_memcmp_working" >&5 +echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 +test $ac_cv_func_memcmp_working = no && case $LIBOBJS in + "memcmp.$ac_objext" | \ + *" memcmp.$ac_objext" | \ + "memcmp.$ac_objext "* | \ + *" memcmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; +esac + + + +#-------------------------------------------------------------------- +# Some system like SunOS 4 and other BSD like systems have no memmove +# (we assume they have bcopy instead). {The replacement define is in +# compat/string.h} +#-------------------------------------------------------------------- + +echo "$as_me:$LINENO: checking for memmove" >&5 +echo $ECHO_N "checking for memmove... $ECHO_C" >&6 +if test "${ac_cv_func_memmove+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 memmove to an innocuous variant, in case declares memmove. + For example, HP-UX 11i declares gettimeofday. */ +#define memmove innocuous_memmove + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char memmove (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef memmove + +/* 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 memmove (); +/* 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_memmove) || defined (__stub___memmove) +choke me +#else +char (*f) () = memmove; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != memmove; + ; + 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_memmove=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_memmove=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_memmove" >&5 +echo "${ECHO_T}$ac_cv_func_memmove" >&6 +if test $ac_cv_func_memmove = yes; then + : +else + + +cat >>confdefs.h <<\_ACEOF +#define NO_MEMMOVE 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define NO_STRING_H 1 +_ACEOF + +fi + + +#-------------------------------------------------------------------- +# On some systems strstr is broken: it returns a pointer even even if +# the original string is empty. +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for strstr" >&5 +echo $ECHO_N "checking for strstr... $ECHO_C" >&6 +if test "${ac_cv_func_strstr+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 strstr to an innocuous variant, in case declares strstr. + For example, HP-UX 11i declares gettimeofday. */ +#define strstr innocuous_strstr + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char strstr (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef strstr + +/* 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 strstr (); +/* 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_strstr) || defined (__stub___strstr) +choke me +#else +char (*f) () = strstr; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != strstr; + ; + 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_strstr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_strstr=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_strstr" >&5 +echo "${ECHO_T}$ac_cv_func_strstr" >&6 +if test $ac_cv_func_strstr = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + + if test "$tcl_ok" = 1; then + echo "$as_me:$LINENO: checking proper strstr implementation" >&5 +echo $ECHO_N "checking proper strstr implementation... $ECHO_C" >&6 +if test "${tcl_cv_strstr_unbroken+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + tcl_cv_strstr_unbroken=unknown +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() { + extern int strstr(); + exit(strstr("\0test", "test") ? 1 : 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 + tcl_cv_strstr_unbroken=ok +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 ) +tcl_cv_strstr_unbroken=broken +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_strstr_unbroken" >&5 +echo "${ECHO_T}$tcl_cv_strstr_unbroken" >&6 + if test "$tcl_cv_strstr_unbroken" = "ok"; then + tcl_ok=1 + else + tcl_ok=0 + fi + fi + if test "$tcl_ok" = 0; then + case $LIBOBJS in + "strstr.$ac_objext" | \ + *" strstr.$ac_objext" | \ + "strstr.$ac_objext "* | \ + *" strstr.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strstr.$ac_objext" ;; +esac + + USE_COMPAT=1 + fi + + +#-------------------------------------------------------------------- +# Check for strtoul function. This is tricky because under some +# versions of AIX strtoul returns an incorrect terminator +# pointer for the string "0". +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for strtoul" >&5 +echo $ECHO_N "checking for strtoul... $ECHO_C" >&6 +if test "${ac_cv_func_strtoul+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 strtoul to an innocuous variant, in case declares strtoul. + For example, HP-UX 11i declares gettimeofday. */ +#define strtoul innocuous_strtoul + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char strtoul (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef strtoul + +/* 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 strtoul (); +/* 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_strtoul) || defined (__stub___strtoul) +choke me +#else +char (*f) () = strtoul; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != strtoul; + ; + 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_strtoul=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_strtoul=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_strtoul" >&5 +echo "${ECHO_T}$ac_cv_func_strtoul" >&6 +if test $ac_cv_func_strtoul = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + + if test "$tcl_ok" = 1; then + echo "$as_me:$LINENO: checking proper strtoul implementation" >&5 +echo $ECHO_N "checking proper strtoul implementation... $ECHO_C" >&6 +if test "${tcl_cv_strtoul_unbroken+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + tcl_cv_strtoul_unbroken=unknown +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() { + extern int strtoul(); + char *term, *string = "0"; + exit(strtoul(string,&term,0) != 0 || term != string+1); +} +_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 + tcl_cv_strtoul_unbroken=ok +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 ) +tcl_cv_strtoul_unbroken=broken +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_strtoul_unbroken" >&5 +echo "${ECHO_T}$tcl_cv_strtoul_unbroken" >&6 + if test "$tcl_cv_strtoul_unbroken" = "ok"; then + tcl_ok=1 + else + tcl_ok=0 + fi + fi + if test "$tcl_ok" = 0; then + case $LIBOBJS in + "strtoul.$ac_objext" | \ + *" strtoul.$ac_objext" | \ + "strtoul.$ac_objext "* | \ + *" strtoul.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strtoul.$ac_objext" ;; +esac + + USE_COMPAT=1 + fi + + +#-------------------------------------------------------------------- +# Check for the strtod function. This is tricky because in some +# versions of Linux strtod mis-parses strings starting with "+". +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for strtod" >&5 +echo $ECHO_N "checking for strtod... $ECHO_C" >&6 +if test "${ac_cv_func_strtod+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 strtod to an innocuous variant, in case declares strtod. + For example, HP-UX 11i declares gettimeofday. */ +#define strtod innocuous_strtod + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char strtod (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef strtod + +/* 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 strtod (); +/* 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_strtod) || defined (__stub___strtod) +choke me +#else +char (*f) () = strtod; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != strtod; + ; + 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_strtod=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_strtod=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_strtod" >&5 +echo "${ECHO_T}$ac_cv_func_strtod" >&6 +if test $ac_cv_func_strtod = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + + if test "$tcl_ok" = 1; then + echo "$as_me:$LINENO: checking proper strtod implementation" >&5 +echo $ECHO_N "checking proper strtod implementation... $ECHO_C" >&6 +if test "${tcl_cv_strtod_unbroken+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + tcl_cv_strtod_unbroken=unknown +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() { + extern double strtod(); + char *term, *string = " +69"; + exit(strtod(string,&term) != 69 || term != string+4); +} +_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 + tcl_cv_strtod_unbroken=ok +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 ) +tcl_cv_strtod_unbroken=broken +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_strtod_unbroken" >&5 +echo "${ECHO_T}$tcl_cv_strtod_unbroken" >&6 + if test "$tcl_cv_strtod_unbroken" = "ok"; then + tcl_ok=1 + else + tcl_ok=0 + fi + fi + if test "$tcl_ok" = 0; then + case $LIBOBJS in + "strtod.$ac_objext" | \ + *" strtod.$ac_objext" | \ + "strtod.$ac_objext "* | \ + *" strtod.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strtod.$ac_objext" ;; +esac + + USE_COMPAT=1 + fi + + +#-------------------------------------------------------------------- +# Under Solaris 2.4, strtod returns the wrong value for the +# terminating character under some conditions. Check for this +# and if the problem exists use a substitute procedure +# "fixstrtod" that corrects the error. +#-------------------------------------------------------------------- + + + echo "$as_me:$LINENO: checking for strtod" >&5 +echo $ECHO_N "checking for strtod... $ECHO_C" >&6 +if test "${ac_cv_func_strtod+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 strtod to an innocuous variant, in case declares strtod. + For example, HP-UX 11i declares gettimeofday. */ +#define strtod innocuous_strtod + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char strtod (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef strtod + +/* 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 strtod (); +/* 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_strtod) || defined (__stub___strtod) +choke me +#else +char (*f) () = strtod; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != strtod; + ; + 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_strtod=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_strtod=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_strtod" >&5 +echo "${ECHO_T}$ac_cv_func_strtod" >&6 +if test $ac_cv_func_strtod = yes; then + tcl_strtod=1 +else + tcl_strtod=0 +fi + + if test "$tcl_strtod" = 1; then + echo "$as_me:$LINENO: checking for Solaris2.4/Tru64 strtod bugs" >&5 +echo $ECHO_N "checking for Solaris2.4/Tru64 strtod bugs... $ECHO_C" >&6 +if test "${tcl_cv_strtod_buggy+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + tcl_cv_strtod_buggy=buggy +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + extern double strtod(); + int main() { + char *infString="Inf", *nanString="NaN", *spaceString=" "; + char *term; + double value; + value = strtod(infString, &term); + if ((term != infString) && (term[-1] == 0)) { + exit(1); + } + value = strtod(nanString, &term); + if ((term != nanString) && (term[-1] == 0)) { + exit(1); + } + value = strtod(spaceString, &term); + if (term == (spaceString+1)) { + exit(1); + } + exit(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 + tcl_cv_strtod_buggy=ok +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 ) +tcl_cv_strtod_buggy=buggy +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_strtod_buggy" >&5 +echo "${ECHO_T}$tcl_cv_strtod_buggy" >&6 + if test "$tcl_cv_strtod_buggy" = buggy; then + case $LIBOBJS in + "fixstrtod.$ac_objext" | \ + *" fixstrtod.$ac_objext" | \ + "fixstrtod.$ac_objext "* | \ + *" fixstrtod.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fixstrtod.$ac_objext" ;; +esac + + USE_COMPAT=1 + +cat >>confdefs.h <<\_ACEOF +#define strtod fixstrtod +_ACEOF + + fi + fi + + +#-------------------------------------------------------------------- +# Check for various typedefs and provide substitutes if +# they don't exist. +#-------------------------------------------------------------------- + +echo "$as_me:$LINENO: checking for mode_t" >&5 +echo $ECHO_N "checking for mode_t... $ECHO_C" >&6 +if test "${ac_cv_type_mode_t+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 ((mode_t *) 0) + return 0; +if (sizeof (mode_t)) + 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_mode_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_mode_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5 +echo "${ECHO_T}$ac_cv_type_mode_t" >&6 +if test $ac_cv_type_mode_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define mode_t int +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+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 ((pid_t *) 0) + return 0; +if (sizeof (pid_t)) + 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_pid_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_pid_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+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 ((size_t *) 0) + return 0; +if (sizeof (size_t)) + 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_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_size_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 +echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 +if test "${ac_cv_type_uid_t+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 + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "uid_t" >/dev/null 2>&1; then + ac_cv_type_uid_t=yes +else + ac_cv_type_uid_t=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 +echo "${ECHO_T}$ac_cv_type_uid_t" >&6 +if test $ac_cv_type_uid_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define uid_t int +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define gid_t int +_ACEOF + +fi + + +echo "$as_me:$LINENO: checking for socklen_t" >&5 +echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 +if test "${tcl_cv_type_socklen_t+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 + #include + +int +main () +{ + + socklen_t foo; + + ; + 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_type_socklen_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_type_socklen_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_type_socklen_t" >&5 +echo "${ECHO_T}$tcl_cv_type_socklen_t" >&6 +if test $tcl_cv_type_socklen_t = no; then + +cat >>confdefs.h <<\_ACEOF +#define socklen_t int +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for intptr_t" >&5 +echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6 +if test "${ac_cv_type_intptr_t+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 ((intptr_t *) 0) + return 0; +if (sizeof (intptr_t)) + 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_intptr_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_intptr_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_intptr_t" >&6 +if test $ac_cv_type_intptr_t = yes; then + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_INTPTR_T 1 +_ACEOF + +else + + echo "$as_me:$LINENO: checking for pointer-size signed integer type" >&5 +echo $ECHO_N "checking for pointer-size signed integer type... $ECHO_C" >&6 +if test "${tcl_cv_intptr_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + for tcl_cv_intptr_t in "int" "long" "long long" none; do + if test "$tcl_cv_intptr_t" != none; then + 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 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))]; +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 + tcl_ok=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + test "$tcl_ok" = yes && break; fi + done +fi +echo "$as_me:$LINENO: result: $tcl_cv_intptr_t" >&5 +echo "${ECHO_T}$tcl_cv_intptr_t" >&6 + if test "$tcl_cv_intptr_t" != none; then + +cat >>confdefs.h <<_ACEOF +#define intptr_t $tcl_cv_intptr_t +_ACEOF + + fi + +fi + +echo "$as_me:$LINENO: checking for uintptr_t" >&5 +echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6 +if test "${ac_cv_type_uintptr_t+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 ((uintptr_t *) 0) + return 0; +if (sizeof (uintptr_t)) + 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_uintptr_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_uintptr_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6 +if test $ac_cv_type_uintptr_t = yes; then + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_UINTPTR_T 1 +_ACEOF + +else + + echo "$as_me:$LINENO: checking for pointer-size unsigned integer type" >&5 +echo $ECHO_N "checking for pointer-size unsigned integer type... $ECHO_C" >&6 +if test "${tcl_cv_uintptr_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \ + none; do + if test "$tcl_cv_uintptr_t" != none; then + 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 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))]; +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 + tcl_ok=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_ok=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + test "$tcl_ok" = yes && break; fi + done +fi +echo "$as_me:$LINENO: result: $tcl_cv_uintptr_t" >&5 +echo "${ECHO_T}$tcl_cv_uintptr_t" >&6 + if test "$tcl_cv_uintptr_t" != none; then + +cat >>confdefs.h <<_ACEOF +#define uintptr_t $tcl_cv_uintptr_t +_ACEOF + + fi + +fi + + +#-------------------------------------------------------------------- +# If a system doesn't have an opendir function (man, that's old!) +# then we have to supply a different version of dirent.h which +# is compatible with the substitute version of opendir that's +# provided. This version only works with V7-style directories. +#-------------------------------------------------------------------- + +echo "$as_me:$LINENO: checking for opendir" >&5 +echo $ECHO_N "checking for opendir... $ECHO_C" >&6 +if test "${ac_cv_func_opendir+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 opendir to an innocuous variant, in case declares opendir. + For example, HP-UX 11i declares gettimeofday. */ +#define opendir innocuous_opendir + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char opendir (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef opendir + +/* 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 opendir (); +/* 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_opendir) || defined (__stub___opendir) +choke me +#else +char (*f) () = opendir; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != opendir; + ; + 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_opendir=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_opendir=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_opendir" >&5 +echo "${ECHO_T}$ac_cv_func_opendir" >&6 +if test $ac_cv_func_opendir = yes; then + : +else + +cat >>confdefs.h <<\_ACEOF +#define USE_DIRENT2_H 1 +_ACEOF + +fi + + +#-------------------------------------------------------------------- +# The check below checks whether defines the type +# "union wait" correctly. It's needed because of weirdness in +# HP-UX where "union wait" is defined in both the BSD and SYS-V +# environments. Checking the usability of WIFEXITED seems to do +# the trick. +#-------------------------------------------------------------------- + +echo "$as_me:$LINENO: checking union wait" >&5 +echo $ECHO_N "checking union wait... $ECHO_C" >&6 +if test "${tcl_cv_union_wait+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 +#include +int +main () +{ + +union wait x; +WIFEXITED(x); /* Generates compiler error if WIFEXITED + * uses an int. */ + + ; + 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_union_wait=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_union_wait=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_union_wait" >&5 +echo "${ECHO_T}$tcl_cv_union_wait" >&6 +if test $tcl_cv_union_wait = no; then + +cat >>confdefs.h <<\_ACEOF +#define NO_UNION_WAIT 1 +_ACEOF + +fi + +#-------------------------------------------------------------------- +# Check whether there is an strncasecmp function on this system. +# This is a bit tricky because under SCO it's in -lsocket and +# under Sequent Dynix it's in -linet. +#-------------------------------------------------------------------- + +echo "$as_me:$LINENO: checking for strncasecmp" >&5 +echo $ECHO_N "checking for strncasecmp... $ECHO_C" >&6 +if test "${ac_cv_func_strncasecmp+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 strncasecmp to an innocuous variant, in case declares strncasecmp. + For example, HP-UX 11i declares gettimeofday. */ +#define strncasecmp innocuous_strncasecmp + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char strncasecmp (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef strncasecmp + +/* 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 strncasecmp (); +/* 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_strncasecmp) || defined (__stub___strncasecmp) +choke me +#else +char (*f) () = strncasecmp; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != strncasecmp; + ; + 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_strncasecmp=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_strncasecmp=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_strncasecmp" >&5 +echo "${ECHO_T}$ac_cv_func_strncasecmp" >&6 +if test $ac_cv_func_strncasecmp = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + +if test "$tcl_ok" = 0; then + echo "$as_me:$LINENO: checking for strncasecmp in -lsocket" >&5 +echo $ECHO_N "checking for strncasecmp in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_strncasecmp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* 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 strncasecmp (); +int +main () +{ +strncasecmp (); + ; + 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_lib_socket_strncasecmp=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_strncasecmp=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_strncasecmp" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_strncasecmp" >&6 +if test $ac_cv_lib_socket_strncasecmp = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + +fi +if test "$tcl_ok" = 0; then + echo "$as_me:$LINENO: checking for strncasecmp in -linet" >&5 +echo $ECHO_N "checking for strncasecmp in -linet... $ECHO_C" >&6 +if test "${ac_cv_lib_inet_strncasecmp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-linet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* 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 strncasecmp (); +int +main () +{ +strncasecmp (); + ; + 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_lib_inet_strncasecmp=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_inet_strncasecmp=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_inet_strncasecmp" >&5 +echo "${ECHO_T}$ac_cv_lib_inet_strncasecmp" >&6 +if test $ac_cv_lib_inet_strncasecmp = yes; then + tcl_ok=1 +else + tcl_ok=0 +fi + +fi +if test "$tcl_ok" = 0; then + case $LIBOBJS in + "strncasecmp.$ac_objext" | \ + *" strncasecmp.$ac_objext" | \ + "strncasecmp.$ac_objext "* | \ + *" strncasecmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strncasecmp.$ac_objext" ;; +esac + + USE_COMPAT=1 +fi + +#-------------------------------------------------------------------- +# The code below deals with several issues related to gettimeofday: +# 1. Some systems don't provide a gettimeofday function at all +# (set NO_GETTOD if this is the case). +# 2. See if gettimeofday is declared in the header file. +# if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can +# declare it. +#-------------------------------------------------------------------- + +echo "$as_me:$LINENO: checking for gettimeofday" >&5 +echo $ECHO_N "checking for gettimeofday... $ECHO_C" >&6 +if test "${ac_cv_func_gettimeofday+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 gettimeofday to an innocuous variant, in case declares gettimeofday. + For example, HP-UX 11i declares gettimeofday. */ +#define gettimeofday innocuous_gettimeofday + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gettimeofday (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef gettimeofday + +/* 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 gettimeofday (); +/* 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_gettimeofday) || defined (__stub___gettimeofday) +choke me +#else +char (*f) () = gettimeofday; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != gettimeofday; + ; + 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_gettimeofday=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_gettimeofday=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_gettimeofday" >&5 +echo "${ECHO_T}$ac_cv_func_gettimeofday" >&6 +if test $ac_cv_func_gettimeofday = yes; then + : +else + + +cat >>confdefs.h <<\_ACEOF +#define NO_GETTOD 1 +_ACEOF + + fi - if test "$tcl_strtod" = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Solaris2.4/Tru64 strtod bugs" >&5 -$as_echo_n "checking for Solaris2.4/Tru64 strtod bugs... " >&6; } -if ${tcl_cv_strtod_buggy+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for gettimeofday declaration" >&5 +echo $ECHO_N "checking for gettimeofday declaration... $ECHO_C" >&6 +if test "${tcl_cv_grep_gettimeofday+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test "$cross_compiling" = yes; then : - tcl_cv_strtod_buggy=buggy -else - cat confdefs.h - <<_ACEOF >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. */ +#include - extern double strtod(); - int main() { - char *infString="Inf", *nanString="NaN", *spaceString=" "; - char *term; - double value; - value = strtod(infString, &term); - if ((term != infString) && (term[-1] == 0)) { - exit(1); - } - value = strtod(nanString, &term); - if ((term != nanString) && (term[-1] == 0)) { - exit(1); - } - value = strtod(spaceString, &term); - if (term == (spaceString+1)) { - exit(1); - } - exit(0); - } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - tcl_cv_strtod_buggy=ok +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "gettimeofday" >/dev/null 2>&1; then + tcl_cv_grep_gettimeofday=present else - tcl_cv_strtod_buggy=buggy -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + tcl_cv_grep_gettimeofday=missing fi +rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strtod_buggy" >&5 -$as_echo "$tcl_cv_strtod_buggy" >&6; } - if test "$tcl_cv_strtod_buggy" = buggy; then - case " $LIBOBJS " in - *" fixstrtod.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS fixstrtod.$ac_objext" - ;; -esac - - USE_COMPAT=1 - -$as_echo "#define strtod fixstrtod" >>confdefs.h +echo "$as_me:$LINENO: result: $tcl_cv_grep_gettimeofday" >&5 +echo "${ECHO_T}$tcl_cv_grep_gettimeofday" >&6 +if test $tcl_cv_grep_gettimeofday = missing ; then - fi - fi +cat >>confdefs.h <<\_ACEOF +#define GETTOD_NOT_DECLARED 1 +_ACEOF +fi #-------------------------------------------------------------------- -# Check for various typedefs and provide substitutes if -# they don't exist. +# The following code checks to see whether it is possible to get +# signed chars on this platform. This is needed in order to +# properly generate sign-extended ints from character values. #-------------------------------------------------------------------- -ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" -if test "x$ac_cv_type_mode_t" = xyes; then : +echo "$as_me:$LINENO: checking whether char is unsigned" >&5 +echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6 +if test "${ac_cv_c_char_unsigned+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 () +{ +static int test_array [1 - 2 * !(((char) -1) < 0)]; +test_array [0] = 0 -cat >>confdefs.h <<_ACEOF -#define mode_t int + ; + 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_c_char_unsigned=no +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_c_char_unsigned=yes +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5 +echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6 +if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then + cat >>confdefs.h <<\_ACEOF +#define __CHAR_UNSIGNED__ 1 +_ACEOF -ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : +fi +echo "$as_me:$LINENO: checking signed char declarations" >&5 +echo $ECHO_N "checking signed char declarations... $ECHO_C" >&6 +if test "${tcl_cv_char_signed+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else -cat >>confdefs.h <<_ACEOF -#define pid_t int + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -fi +int +main () +{ -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : + signed char *p; + p = 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_char_signed=yes else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int +tcl_cv_char_signed=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $tcl_cv_char_signed" >&5 +echo "${ECHO_T}$tcl_cv_char_signed" >&6 +if test $tcl_cv_char_signed = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SIGNED_CHAR 1 _ACEOF fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 -$as_echo_n "checking for uid_t in sys/types.h... " >&6; } -if ${ac_cv_type_uid_t+:} false; then : - $as_echo_n "(cached) " >&6 +#-------------------------------------------------------------------- +# Does putenv() copy or not? We need to know to avoid memory leaks. +#-------------------------------------------------------------------- + +echo "$as_me:$LINENO: checking for a putenv() that copies the buffer" >&5 +echo $ECHO_N "checking for a putenv() that copies the buffer... $ECHO_C" >&6 +if test "${tcl_cv_putenv_copy+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test "$cross_compiling" = yes; then + tcl_cv_putenv_copy=no else - cat confdefs.h - <<_ACEOF >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. */ -#include + + #include + #define OURVAR "havecopy=yes" + int main (int argc, char *argv[]) + { + char *foo, *bar; + foo = (char *)strdup(OURVAR); + putenv(foo); + strcpy((char *)(strchr(foo, '=') + 1), "no"); + bar = getenv("havecopy"); + if (!strcmp(bar, "no")) { + /* doesnt copy */ + return 0; + } else { + /* does copy */ + return 1; + } + } _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "uid_t" >/dev/null 2>&1; then : - ac_cv_type_uid_t=yes +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 + tcl_cv_putenv_copy=no else - ac_cv_type_uid_t=no -fi -rm -f conftest* + 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_putenv_copy=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 -$as_echo "$ac_cv_type_uid_t" >&6; } -if test $ac_cv_type_uid_t = no; then - -$as_echo "#define uid_t int" >>confdefs.h - +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_putenv_copy" >&5 +echo "${ECHO_T}$tcl_cv_putenv_copy" >&6 +if test $tcl_cv_putenv_copy = yes; then -$as_echo "#define gid_t int" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_PUTENV_THAT_COPIES 1 +_ACEOF fi +#-------------------------------------------------------------------- +# Check for support of nl_langinfo function +#-------------------------------------------------------------------- + -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t" >&5 -$as_echo_n "checking for socklen_t... " >&6; } -if ${tcl_cv_type_socklen_t+:} false; then : - $as_echo_n "(cached) " >&6 + # Check whether --enable-langinfo or --disable-langinfo was given. +if test "${enable_langinfo+set}" = set; then + enableval="$enable_langinfo" + langinfo_ok=$enableval else + langinfo_ok=yes +fi; - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + HAVE_LANGINFO=0 + if test "$langinfo_ok" = "yes"; then + if test "${ac_cv_header_langinfo_h+set}" = set; then + echo "$as_me:$LINENO: checking for langinfo.h" >&5 +echo $ECHO_N "checking for langinfo.h... $ECHO_C" >&6 +if test "${ac_cv_header_langinfo_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_langinfo_h" >&5 +echo "${ECHO_T}$ac_cv_header_langinfo_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking langinfo.h usability" >&5 +echo $ECHO_N "checking langinfo.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 +_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 - #include - #include - -int -main () -{ - - socklen_t foo; +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 - ; - return 0; -} +# Is the header present? +echo "$as_me:$LINENO: checking langinfo.h presence" >&5 +echo $ECHO_N "checking langinfo.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_type_socklen_t=yes +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_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 - tcl_cv_type_socklen_t=no + ac_cpp_err=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_type_socklen_t" >&5 -$as_echo "$tcl_cv_type_socklen_t" >&6; } -if test $tcl_cv_type_socklen_t = no; then - -$as_echo "#define socklen_t int" >>confdefs.h +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 -ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default" -if test "x$ac_cv_type_intptr_t" = xyes; then : - - -$as_echo "#define HAVE_INTPTR_T 1" >>confdefs.h +# 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: langinfo.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: langinfo.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: langinfo.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: langinfo.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: langinfo.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: langinfo.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: langinfo.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: langinfo.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: langinfo.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: langinfo.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: langinfo.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: langinfo.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: langinfo.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: langinfo.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: langinfo.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: langinfo.h: 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 langinfo.h" >&5 +echo $ECHO_N "checking for langinfo.h... $ECHO_C" >&6 +if test "${ac_cv_header_langinfo_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_langinfo_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_langinfo_h" >&5 +echo "${ECHO_T}$ac_cv_header_langinfo_h" >&6 +fi +if test $ac_cv_header_langinfo_h = yes; then + langinfo_ok=yes else + langinfo_ok=no +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pointer-size signed integer type" >&5 -$as_echo_n "checking for pointer-size signed integer type... " >&6; } -if ${tcl_cv_intptr_t+:} false; then : - $as_echo_n "(cached) " >&6 + + fi + echo "$as_me:$LINENO: checking whether to use nl_langinfo" >&5 +echo $ECHO_N "checking whether to use nl_langinfo... $ECHO_C" >&6 + if test "$langinfo_ok" = "yes"; then + if test "${tcl_cv_langinfo_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - for tcl_cv_intptr_t in "int" "long" "long long" none; do - if test "$tcl_cv_intptr_t" != none; then - cat confdefs.h - <<_ACEOF >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_includes_default +#include int main () { -static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_intptr_t))]; -test_array [0] = 0; -return test_array [0]; - +nl_langinfo(CODESET); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_ok=yes +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_langinfo_h=yes else - tcl_ok=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_langinfo_h=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$tcl_ok" = yes && break; fi - done +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_intptr_t" >&5 -$as_echo "$tcl_cv_intptr_t" >&6; } - if test "$tcl_cv_intptr_t" != none; then -cat >>confdefs.h <<_ACEOF -#define intptr_t $tcl_cv_intptr_t + echo "$as_me:$LINENO: result: $tcl_cv_langinfo_h" >&5 +echo "${ECHO_T}$tcl_cv_langinfo_h" >&6 + if test $tcl_cv_langinfo_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LANGINFO 1 _ACEOF + fi + else + echo "$as_me:$LINENO: result: $langinfo_ok" >&5 +echo "${ECHO_T}$langinfo_ok" >&6 fi -fi -ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default" -if test "x$ac_cv_type_uintptr_t" = xyes; then : +#-------------------------------------------------------------------- +# Check for support of chflags and mkstemps functions +#-------------------------------------------------------------------- -$as_echo "#define HAVE_UINTPTR_T 1" >>confdefs.h -else +for ac_func in chflags mkstemps +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 declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pointer-size unsigned integer type" >&5 -$as_echo_n "checking for pointer-size unsigned integer type... " >&6; } -if ${tcl_cv_uintptr_t+:} false; then : - $as_echo_n "(cached) " >&6 -else +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#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 - for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \ - none; do - if test "$tcl_cv_uintptr_t" != none; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default int main () { -static int test_array [1 - 2 * !(sizeof (void *) <= sizeof ($tcl_cv_uintptr_t))]; -test_array [0] = 0; -return test_array [0]; - +return f != $ac_func; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_ok=yes +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 - tcl_ok=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$tcl_ok" = yes && break; fi - done +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_uintptr_t" >&5 -$as_echo "$tcl_cv_uintptr_t" >&6; } - if test "$tcl_cv_uintptr_t" != none; then - -cat >>confdefs.h <<_ACEOF -#define uintptr_t $tcl_cv_uintptr_t +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 - -fi - - -#-------------------------------------------------------------------- -# If a system doesn't have an opendir function (man, that's old!) -# then we have to supply a different version of dirent.h which -# is compatible with the substitute version of opendir that's -# provided. This version only works with V7-style directories. -#-------------------------------------------------------------------- - -ac_fn_c_check_func "$LINENO" "opendir" "ac_cv_func_opendir" -if test "x$ac_cv_func_opendir" = xyes; then : - -else - -$as_echo "#define USE_DIRENT2_H 1" >>confdefs.h - fi +done #-------------------------------------------------------------------- -# The check below checks whether defines the type -# "union wait" correctly. It's needed because of weirdness in -# HP-UX where "union wait" is defined in both the BSD and SYS-V -# environments. Checking the usability of WIFEXITED seems to do -# the trick. +# Check for support of isnan() function or macro #-------------------------------------------------------------------- -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking union wait" >&5 -$as_echo_n "checking union wait... " >&6; } -if ${tcl_cv_union_wait+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking isnan" >&5 +echo $ECHO_N "checking isnan... $ECHO_C" >&6 +if test "${tcl_cv_isnan+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ -#include -#include +#include int main () { -union wait x; -WIFEXITED(x); /* Generates compiler error if WIFEXITED - * uses an int. */ +isnan(0.0); /* Generates an error if isnan is missing */ ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - tcl_cv_union_wait=yes +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_isnan=yes else - tcl_cv_union_wait=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_isnan=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_union_wait" >&5 -$as_echo "$tcl_cv_union_wait" >&6; } -if test $tcl_cv_union_wait = no; then +echo "$as_me:$LINENO: result: $tcl_cv_isnan" >&5 +echo "${ECHO_T}$tcl_cv_isnan" >&6 +if test $tcl_cv_isnan = no; then -$as_echo "#define NO_UNION_WAIT 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define NO_ISNAN 1 +_ACEOF fi #-------------------------------------------------------------------- -# Check whether there is an strncasecmp function on this system. -# This is a bit tricky because under SCO it's in -lsocket and -# under Sequent Dynix it's in -linet. +# Darwin specific API checks and defines #-------------------------------------------------------------------- -ac_fn_c_check_func "$LINENO" "strncasecmp" "ac_cv_func_strncasecmp" -if test "x$ac_cv_func_strncasecmp" = xyes; then : - tcl_ok=1 -else - tcl_ok=0 -fi +if test "`uname -s`" = "Darwin" ; then -if test "$tcl_ok" = 0; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strncasecmp in -lsocket" >&5 -$as_echo_n "checking for strncasecmp in -lsocket... " >&6; } -if ${ac_cv_lib_socket_strncasecmp+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +for ac_func in getattrlist +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 declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" +{ #endif -char strncasecmp (); +/* 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 strncasecmp (); +return f != $ac_func; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_socket_strncasecmp=yes +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 - ac_cv_lib_socket_strncasecmp=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_strncasecmp" >&5 -$as_echo "$ac_cv_lib_socket_strncasecmp" >&6; } -if test "x$ac_cv_lib_socket_strncasecmp" = xyes; then : - tcl_ok=1 -else - tcl_ok=0 +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 + +for ac_header in copyfile.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 -if test "$tcl_ok" = 0; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strncasecmp in -linet" >&5 -$as_echo_n "checking for strncasecmp in -linet... " >&6; } -if ${ac_cv_lib_inet_strncasecmp+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-linet $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # 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. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char strncasecmp (); -int -main () -{ -return strncasecmp (); - ; - return 0; -} +$ac_includes_default +#include <$ac_header> _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_inet_strncasecmp=yes -else - ac_cv_lib_inet_strncasecmp=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet_strncasecmp" >&5 -$as_echo "$ac_cv_lib_inet_strncasecmp" >&6; } -if test "x$ac_cv_lib_inet_strncasecmp" = xyes; then : - tcl_ok=1 +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 - tcl_ok=0 -fi - -fi -if test "$tcl_ok" = 0; then - case " $LIBOBJS " in - *" strncasecmp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strncasecmp.$ac_objext" - ;; -esac + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 - USE_COMPAT=1 +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 -#-------------------------------------------------------------------- -# The code below deals with several issues related to gettimeofday: -# 1. Some systems don't provide a gettimeofday function at all -# (set NO_GETTOD if this is the case). -# 2. See if gettimeofday is declared in the header file. -# if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can -# declare it. -#-------------------------------------------------------------------- - -ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = xyes; then : - +# 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 - - -$as_echo "#define NO_GETTOD 1" >>confdefs.h - - + ac_cpp_err=yes fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettimeofday declaration" >&5 -$as_echo_n "checking for gettimeofday declaration... " >&6; } -if ${tcl_cv_grep_gettimeofday+:} false; then : - $as_echo_n "(cached) " >&6 +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 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include + 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 -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "gettimeofday" >/dev/null 2>&1; then : - tcl_cv_grep_gettimeofday=present +# 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 - tcl_cv_grep_gettimeofday=missing + eval "$as_ac_Header=\$ac_header_preproc" fi -rm -f conftest* +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_grep_gettimeofday" >&5 -$as_echo "$tcl_cv_grep_gettimeofday" >&6; } -if test $tcl_cv_grep_gettimeofday = missing ; then - -$as_echo "#define GETTOD_NOT_DECLARED 1" >>confdefs.h +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF fi -#-------------------------------------------------------------------- -# The following code checks to see whether it is possible to get -# signed chars on this platform. This is needed in order to -# properly generate sign-extended ints from character values. -#-------------------------------------------------------------------- +done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether char is unsigned" >&5 -$as_echo_n "checking whether char is unsigned... " >&6; } -if ${ac_cv_c_char_unsigned+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -static int test_array [1 - 2 * !(((char) -1) < 0)]; -test_array [0] = 0; -return test_array [0]; - ; - return 0; -} +for ac_func in copyfile +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 -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_char_unsigned=no -else - ac_cv_c_char_unsigned=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_char_unsigned" >&5 -$as_echo "$ac_cv_c_char_unsigned" >&6; } -if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then - $as_echo "#define __CHAR_UNSIGNED__ 1" >>confdefs.h +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func -fi +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking signed char declarations" >&5 -$as_echo_n "checking signed char declarations... " >&6; } -if ${tcl_cv_char_signed+:} false; then : - $as_echo_n "(cached) " >&6 -else +#ifdef __STDC__ +# include +#else +# include +#endif - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +#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 () { - - signed char *p; - p = 0; - +return f != $ac_func; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_char_signed=yes +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 - tcl_cv_char_signed=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_char_signed" >&5 -$as_echo "$tcl_cv_char_signed" >&6; } -if test $tcl_cv_char_signed = yes; then - -$as_echo "#define HAVE_SIGNED_CHAR 1" >>confdefs.h +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 -#-------------------------------------------------------------------- -# Does putenv() copy or not? We need to know to avoid memory leaks. -#-------------------------------------------------------------------- - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a putenv() that copies the buffer" >&5 -$as_echo_n "checking for a putenv() that copies the buffer... " >&6; } -if ${tcl_cv_putenv_copy+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test $tcl_corefoundation = yes; then - if test "$cross_compiling" = yes; then : - tcl_cv_putenv_copy=no +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 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # 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 - #include - #define OURVAR "havecopy=yes" - int main (int argc, char *argv[]) - { - char *foo, *bar; - foo = (char *)strdup(OURVAR); - putenv(foo); - strcpy((char *)(strchr(foo, '=') + 1), "no"); - bar = getenv("havecopy"); - if (!strcmp(bar, "no")) { - /* doesnt copy */ - return 0; - } else { - /* does copy */ - return 1; - } - } +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 -if ac_fn_c_try_run "$LINENO"; then : - tcl_cv_putenv_copy=no +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 - tcl_cv_putenv_copy=yes + ac_cpp_err=yes fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_putenv_copy" >&5 -$as_echo "$tcl_cv_putenv_copy" >&6; } -if test $tcl_cv_putenv_copy = yes; then +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -$as_echo "#define HAVE_PUTENV_THAT_COPIES 1" >>confdefs.h +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 -#-------------------------------------------------------------------- -# Check for support of nl_langinfo function -#-------------------------------------------------------------------- +done - # Check whether --enable-langinfo was given. -if test "${enable_langinfo+set}" = set; then : - enableval=$enable_langinfo; langinfo_ok=$enableval -else - langinfo_ok=yes -fi +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 declares $ac_func. + For example, HP-UX 11i 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 to if __STDC__ is defined, since + exists even on freestanding compilers. */ - HAVE_LANGINFO=0 - if test "$langinfo_ok" = "yes"; then - ac_fn_c_check_header_mongrel "$LINENO" "langinfo.h" "ac_cv_header_langinfo_h" "$ac_includes_default" -if test "x$ac_cv_header_langinfo_h" = xyes; then : - langinfo_ok=yes -else - langinfo_ok=no -fi +#ifdef __STDC__ +# include +#else +# include +#endif +#undef $ac_func - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use nl_langinfo" >&5 -$as_echo_n "checking whether to use nl_langinfo... " >&6; } - if test "$langinfo_ok" = "yes"; then - if ${tcl_cv_langinfo_h+:} false; then : - $as_echo_n "(cached) " >&6 -else +/* 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 - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include int main () { -nl_langinfo(CODESET); +return f != $ac_func; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - tcl_cv_langinfo_h=yes +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 - tcl_cv_langinfo_h=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_langinfo_h" >&5 -$as_echo "$tcl_cv_langinfo_h" >&6; } - if test $tcl_cv_langinfo_h = yes; then - -$as_echo "#define HAVE_LANGINFO 1" >>confdefs.h - - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $langinfo_ok" >&5 -$as_echo "$langinfo_ok" >&6; } - fi - - -#-------------------------------------------------------------------- -# Check for support of chflags and mkstemps functions -#-------------------------------------------------------------------- - -for ac_func in chflags mkstemps -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +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 `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done + fi -#-------------------------------------------------------------------- -# Check for support of isnan() function or macro -#-------------------------------------------------------------------- - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking isnan" >&5 -$as_echo_n "checking isnan... " >&6; } -if ${tcl_cv_isnan+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ - -isnan(0.0); /* Generates an error if isnan is missing */ - - ; - return 0; -} +cat >>confdefs.h <<\_ACEOF +#define USE_VFORK 1 _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - tcl_cv_isnan=yes -else - tcl_cv_isnan=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_isnan" >&5 -$as_echo "$tcl_cv_isnan" >&6; } -if test $tcl_cv_isnan = no; then - -$as_echo "#define NO_ISNAN 1" >>confdefs.h - -fi -#-------------------------------------------------------------------- -# Darwin specific API checks and defines -#-------------------------------------------------------------------- -if test "`uname -s`" = "Darwin" ; then - for ac_func in getattrlist -do : - ac_fn_c_check_func "$LINENO" "getattrlist" "ac_cv_func_getattrlist" -if test "x$ac_cv_func_getattrlist" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETATTRLIST 1 +cat >>confdefs.h <<\_ACEOF +#define TCL_DEFAULT_ENCODING "utf-8" _ACEOF -fi -done - for ac_header in copyfile.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "copyfile.h" "ac_cv_header_copyfile_h" "$ac_includes_default" -if test "x$ac_cv_header_copyfile_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_COPYFILE_H 1 +cat >>confdefs.h <<\_ACEOF +#define TCL_LOAD_FROM_MEMORY 1 _ACEOF -fi - -done - for ac_func in copyfile -do : - ac_fn_c_check_func "$LINENO" "copyfile" "ac_cv_func_copyfile" -if test "x$ac_cv_func_copyfile" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_COPYFILE 1 +cat >>confdefs.h <<\_ACEOF +#define TCL_WIDE_CLICKS 1 _ACEOF -fi -done - if test $tcl_corefoundation = yes; then - for ac_header in libkern/OSAtomic.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "libkern/OSAtomic.h" "ac_cv_header_libkern_OSAtomic_h" "$ac_includes_default" -if test "x$ac_cv_header_libkern_OSAtomic_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBKERN_OSATOMIC_H 1 +for ac_header in AvailabilityMacros.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 -done - - for ac_func in OSSpinLockLock -do : - ac_fn_c_check_func "$LINENO" "OSSpinLockLock" "ac_cv_func_OSSpinLockLock" -if test "x$ac_cv_func_OSSpinLockLock" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OSSPINLOCKLOCK 1 +# 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 -done - - fi - -$as_echo "#define USE_VFORK 1" >>confdefs.h - - -$as_echo "#define TCL_DEFAULT_ENCODING \"utf-8\"" >>confdefs.h - - -$as_echo "#define TCL_LOAD_FROM_MEMORY 1" >>confdefs.h +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 -$as_echo "#define TCL_WIDE_CLICKS 1" >>confdefs.h +# 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 - for ac_header in AvailabilityMacros.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "AvailabilityMacros.h" "ac_cv_header_AvailabilityMacros_h" "$ac_includes_default" -if test "x$ac_cv_header_AvailabilityMacros_h" = xyes; then : +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_AVAILABILITYMACROS_H 1 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -9831,14 +18064,18 @@ fi done if test "$ac_cv_header_AvailabilityMacros_h" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if weak import is available" >&5 -$as_echo_n "checking if weak import is available... " >&6; } -if ${tcl_cv_cc_weak_import+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking if weak import is available" >&5 +echo $ECHO_N "checking if weak import is available... $ECHO_C" >&6 +if test "${tcl_cv_cc_weak_import+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" - cat confdefs.h - <<_ACEOF >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. */ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ @@ -9858,30 +18095,60 @@ rand(); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_cc_weak_import=yes else - tcl_cv_cc_weak_import=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_cc_weak_import=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext CFLAGS=$hold_cflags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_weak_import" >&5 -$as_echo "$tcl_cv_cc_weak_import" >&6; } +echo "$as_me:$LINENO: result: $tcl_cv_cc_weak_import" >&5 +echo "${ECHO_T}$tcl_cv_cc_weak_import" >&6 if test $tcl_cv_cc_weak_import = yes; then -$as_echo "#define HAVE_WEAK_IMPORT 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_WEAK_IMPORT 1 +_ACEOF fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Darwin SUSv3 extensions are available" >&5 -$as_echo_n "checking if Darwin SUSv3 extensions are available... " >&6; } -if ${tcl_cv_cc_darwin_c_source+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking if Darwin SUSv3 extensions are available" >&5 +echo $ECHO_N "checking if Darwin SUSv3 extensions are available... $ECHO_C" >&6 +if test "${tcl_cv_cc_darwin_c_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" - cat confdefs.h - <<_ACEOF >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. */ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ @@ -9902,19 +18169,45 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +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_cc_darwin_c_source=yes else - tcl_cv_cc_darwin_c_source=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_cc_darwin_c_source=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$hold_cflags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cc_darwin_c_source" >&5 -$as_echo "$tcl_cv_cc_darwin_c_source" >&6; } +echo "$as_me:$LINENO: result: $tcl_cv_cc_darwin_c_source" >&5 +echo "${ECHO_T}$tcl_cv_cc_darwin_c_source" >&6 if test $tcl_cv_cc_darwin_c_source = yes; then -$as_echo "#define _DARWIN_C_SOURCE 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define _DARWIN_C_SOURCE 1 +_ACEOF fi fi @@ -9930,13 +18223,17 @@ fi # Check for support of fts functions (readdir replacement) #-------------------------------------------------------------------- -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fts" >&5 -$as_echo_n "checking for fts... " >&6; } -if ${tcl_cv_api_fts+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for fts" >&5 +echo $ECHO_N "checking for fts... $ECHO_C" >&6 +if test "${tcl_cv_api_fts+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ #include @@ -9955,19 +18252,45 @@ main () return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_api_fts=yes else - tcl_cv_api_fts=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_api_fts=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_api_fts" >&5 -$as_echo "$tcl_cv_api_fts" >&6; } +echo "$as_me:$LINENO: result: $tcl_cv_api_fts" >&5 +echo "${ECHO_T}$tcl_cv_api_fts" >&6 if test $tcl_cv_api_fts = yes; then -$as_echo "#define HAVE_FTS 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_FTS 1 +_ACEOF fi @@ -9978,24 +18301,300 @@ fi #-------------------------------------------------------------------- - for ac_header in sys/ioctl.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/ioctl.h" "ac_cv_header_sys_ioctl_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_ioctl_h" = xyes; then : + +for ac_header in sys/ioctl.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 HAVE_SYS_IOCTL_H 1 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done - for ac_header in sys/filio.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/filio.h" "ac_cv_header_sys_filio_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_filio_h" = xyes; then : + +for ac_header in sys/filio.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 HAVE_SYS_FILIO_H 1 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -10003,10 +18602,10 @@ fi done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking system version" >&5 -$as_echo_n "checking system version... " >&6; } -if ${tcl_cv_sys_version+:} false; then : - $as_echo_n "(cached) " >&6 + echo "$as_me:$LINENO: checking system version" >&5 +echo $ECHO_N "checking system version... $ECHO_C" >&6 +if test "${tcl_cv_sys_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -f /usr/lib/NextStep/software_version; then @@ -10014,8 +18613,8 @@ else else tcl_cv_sys_version=`uname -s`-`uname -r` if test "$?" -ne 0 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: can't find uname command" >&5 -$as_echo "$as_me: WARNING: can't find uname command" >&2;} + { echo "$as_me:$LINENO: WARNING: can't find uname command" >&5 +echo "$as_me: WARNING: can't find uname command" >&2;} tcl_cv_sys_version=unknown else # Special check for weird MP-RAS system (uname returns weird @@ -10031,52 +18630,58 @@ $as_echo "$as_me: WARNING: can't find uname command" >&2;} fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_sys_version" >&5 -$as_echo "$tcl_cv_sys_version" >&6; } +echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5 +echo "${ECHO_T}$tcl_cv_sys_version" >&6 system=$tcl_cv_sys_version - { $as_echo "$as_me:${as_lineno-$LINENO}: checking FIONBIO vs. O_NONBLOCK for nonblocking I/O" >&5 -$as_echo_n "checking FIONBIO vs. O_NONBLOCK for nonblocking I/O... " >&6; } + echo "$as_me:$LINENO: checking FIONBIO vs. O_NONBLOCK for nonblocking I/O" >&5 +echo $ECHO_N "checking FIONBIO vs. O_NONBLOCK for nonblocking I/O... $ECHO_C" >&6 case $system in OSF*) -$as_echo "#define USE_FIONBIO 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define USE_FIONBIO 1 +_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: result: FIONBIO" >&5 -$as_echo "FIONBIO" >&6; } + echo "$as_me:$LINENO: result: FIONBIO" >&5 +echo "${ECHO_T}FIONBIO" >&6 ;; SunOS-4*) -$as_echo "#define USE_FIONBIO 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define USE_FIONBIO 1 +_ACEOF - { $as_echo "$as_me:${as_lineno-$LINENO}: result: FIONBIO" >&5 -$as_echo "FIONBIO" >&6; } + echo "$as_me:$LINENO: result: FIONBIO" >&5 +echo "${ECHO_T}FIONBIO" >&6 ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: O_NONBLOCK" >&5 -$as_echo "O_NONBLOCK" >&6; } + echo "$as_me:$LINENO: result: O_NONBLOCK" >&5 +echo "${ECHO_T}O_NONBLOCK" >&6 ;; esac #------------------------------------------------------------------------ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use dll unloading" >&5 -$as_echo_n "checking whether to use dll unloading... " >&6; } -# Check whether --enable-dll-unloading was given. -if test "${enable_dll_unloading+set}" = set; then : - enableval=$enable_dll_unloading; tcl_ok=$enableval +echo "$as_me:$LINENO: checking whether to use dll unloading" >&5 +echo $ECHO_N "checking whether to use dll unloading... $ECHO_C" >&6 +# 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 - +fi; if test $tcl_ok = yes; then -$as_echo "#define TCL_UNLOAD_DLLS 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define TCL_UNLOAD_DLLS 1 +_ACEOF fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_ok" >&5 -$as_echo "$tcl_ok" >&6; } +echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 #------------------------------------------------------------------------ # Check whether the timezone data is supplied by the OS or has @@ -10084,31 +18689,31 @@ $as_echo "$tcl_ok" >&6; } # be overriden on the configure command line either way. #------------------------------------------------------------------------ -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for timezone data" >&5 -$as_echo_n "checking for timezone data... " >&6; } +echo "$as_me:$LINENO: checking for timezone data" >&5 +echo $ECHO_N "checking for timezone data... $ECHO_C" >&6 -# Check whether --with-tzdata was given. -if test "${with_tzdata+set}" = set; then : - withval=$with_tzdata; tcl_ok=$withval +# Check whether --with-tzdata or --without-tzdata was given. +if test "${with_tzdata+set}" = set; then + withval="$with_tzdata" + tcl_ok=$withval else tcl_ok=auto -fi - +fi; # # Any directories that get added here must also be added to the # search path in ::tcl::clock::Initialize (library/clock.tcl). # case $tcl_ok in no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: supplied by OS vendor" >&5 -$as_echo "supplied by OS vendor" >&6; } + echo "$as_me:$LINENO: result: supplied by OS vendor" >&5 +echo "${ECHO_T}supplied by OS vendor" >&6 ;; yes) # nothing to do here ;; auto*) - if ${tcl_cv_dir_zoneinfo+:} false; then : - $as_echo_n "(cached) " >&6 + if test "${tcl_cv_dir_zoneinfo+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else for dir in /usr/share/zoneinfo \ @@ -10125,20 +18730,22 @@ fi if test -n "$tcl_cv_dir_zoneinfo"; then tcl_ok=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dir" >&5 -$as_echo "$dir" >&6; } + echo "$as_me:$LINENO: result: $dir" >&5 +echo "${ECHO_T}$dir" >&6 else tcl_ok=yes fi ;; *) - as_fn_error $? "invalid argument: $tcl_ok" "$LINENO" 5 + { { echo "$as_me:$LINENO: error: invalid argument: $tcl_ok" >&5 +echo "$as_me: error: invalid argument: $tcl_ok" >&2;} + { (exit 1); exit 1; }; } ;; esac if test $tcl_ok = yes then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: supplied by Tcl" >&5 -$as_echo "supplied by Tcl" >&6; } + echo "$as_me:$LINENO: result: supplied by Tcl" >&5 +echo "${ECHO_T}supplied by Tcl" >&6 INSTALL_TZDATA=install-tzdata fi @@ -10146,16 +18753,152 @@ fi # DTrace support #-------------------------------------------------------------------- -# Check whether --enable-dtrace was given. -if test "${enable_dtrace+set}" = set; then : - enableval=$enable_dtrace; tcl_ok=$enableval +# Check whether --enable-dtrace or --disable-dtrace was given. +if test "${enable_dtrace+set}" = set; then + enableval="$enable_dtrace" + tcl_ok=$enableval else tcl_ok=no +fi; +if test $tcl_ok = yes; then + if test "${ac_cv_header_sys_sdt_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/sdt.h" >&5 +echo $ECHO_N "checking for sys/sdt.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_sdt_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_sdt_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_sdt_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/sdt.h usability" >&5 +echo $ECHO_N "checking sys/sdt.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 +_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 -if test $tcl_ok = yes; then - ac_fn_c_check_header_mongrel "$LINENO" "sys/sdt.h" "ac_cv_header_sys_sdt_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_sdt_h" = xyes; then : +# Is the header present? +echo "$as_me:$LINENO: checking sys/sdt.h presence" >&5 +echo $ECHO_N "checking sys/sdt.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 +_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: sys/sdt.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/sdt.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sdt.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/sdt.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sys/sdt.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/sdt.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sdt.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/sdt.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sdt.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/sdt.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sdt.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/sdt.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sdt.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/sdt.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sdt.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/sdt.h: 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 sys/sdt.h" >&5 +echo $ECHO_N "checking for sys/sdt.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_sdt_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sys_sdt_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_sdt_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_sdt_h" >&6 + +fi +if test $ac_cv_header_sys_sdt_h = yes; then tcl_ok=yes else tcl_ok=no @@ -10166,10 +18909,10 @@ fi if test $tcl_ok = yes; then # Extract the first word of "dtrace", so it can be a program name with args. set dummy dtrace; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_DTRACE+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_DTRACE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else case $DTRACE in [\\/]* | ?:[\\/]*) @@ -10182,37 +18925,38 @@ for as_dir in $as_dummy do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_DTRACE="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done -IFS=$as_save_IFS +done ;; esac fi DTRACE=$ac_cv_path_DTRACE + if test -n "$DTRACE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DTRACE" >&5 -$as_echo "$DTRACE" >&6; } + echo "$as_me:$LINENO: result: $DTRACE" >&5 +echo "${ECHO_T}$DTRACE" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - test -z "$ac_cv_path_DTRACE" && tcl_ok=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable DTrace support" >&5 -$as_echo_n "checking whether to enable DTrace support... " >&6; } +echo "$as_me:$LINENO: checking whether to enable DTrace support" >&5 +echo $ECHO_N "checking whether to enable DTrace support... $ECHO_C" >&6 MAKEFILE_SHELL='/bin/sh' if test $tcl_ok = yes; then -$as_echo "#define USE_DTRACE 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define USE_DTRACE 1 +_ACEOF DTRACE_SRC="\${DTRACE_SRC}" DTRACE_HDR="\${DTRACE_HDR}" @@ -10230,20 +18974,24 @@ $as_echo "#define USE_DTRACE 1" >>confdefs.h fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_ok" >&5 -$as_echo "$tcl_ok" >&6; } +echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 #-------------------------------------------------------------------- # The check below checks whether the cpuid instruction is usable. #-------------------------------------------------------------------- -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the cpuid instruction is usable" >&5 -$as_echo_n "checking whether the cpuid instruction is usable... " >&6; } -if ${tcl_cv_cpuid+:} false; then : - $as_echo_n "(cached) " >&6 +echo "$as_me:$LINENO: checking whether the cpuid instruction is usable" >&5 +echo $ECHO_N "checking whether the cpuid instruction is usable... $ECHO_C" >&6 +if test "${tcl_cv_cpuid+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat confdefs.h - <<_ACEOF >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. */ int @@ -10262,19 +19010,45 @@ main () return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +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_cpuid=yes else - tcl_cv_cpuid=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +tcl_cv_cpuid=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cpuid" >&5 -$as_echo "$tcl_cv_cpuid" >&6; } +echo "$as_me:$LINENO: result: $tcl_cv_cpuid" >&5 +echo "${ECHO_T}$tcl_cv_cpuid" >&6 if test $tcl_cv_cpuid = yes; then -$as_echo "#define HAVE_CPUID 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define HAVE_CPUID 1 +_ACEOF fi @@ -10305,38 +19079,38 @@ HTML_DIR='$(DISTDIR)/html' if test "`uname -s`" = "Darwin" ; then if test "`uname -s`" = "Darwin" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to package libraries" >&5 -$as_echo_n "checking how to package libraries... " >&6; } - # Check whether --enable-framework was given. -if test "${enable_framework+set}" = set; then : - enableval=$enable_framework; enable_framework=$enableval + 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" + enable_framework=$enableval else enable_framework=no -fi - +fi; if test $enable_framework = yes; then if test $SHARED_BUILD = 0; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Frameworks can only be built if --enable-shared is yes" >&5 -$as_echo "$as_me: WARNING: Frameworks can only be built if --enable-shared is yes" >&2;} + { 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;} enable_framework=no fi if test $tcl_corefoundation = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Frameworks can only be used when CoreFoundation is available" >&5 -$as_echo "$as_me: WARNING: Frameworks can only be used when CoreFoundation is available" >&2;} + { 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;} enable_framework=no fi fi if test $enable_framework = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: framework" >&5 -$as_echo "framework" >&6; } + echo "$as_me:$LINENO: result: framework" >&5 +echo "${ECHO_T}framework" >&6 FRAMEWORK_BUILD=1 else if test $SHARED_BUILD = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: shared library" >&5 -$as_echo "shared library" >&6; } + echo "$as_me:$LINENO: result: shared library" >&5 +echo "${ECHO_T}shared library" >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: static library" >&5 -$as_echo "static library" >&6; } + echo "$as_me:$LINENO: result: static library" >&5 +echo "${ECHO_T}static library" >&6 fi FRAMEWORK_BUILD=0 fi @@ -10348,18 +19122,20 @@ $as_echo "static library" >&6; } TCL_SHLIB_LD_EXTRAS="${TCL_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tcl-Info.plist' EXTRA_TCLSH_LIBS='-sectcreate __TEXT __info_plist Tclsh-Info.plist' EXTRA_APP_CC_SWITCHES='-mdynamic-no-pic' - ac_config_files="$ac_config_files Tcl-Info.plist:../macosx/Tcl-Info.plist.in Tclsh-Info.plist:../macosx/Tclsh-Info.plist.in" + ac_config_files="$ac_config_files Tcl-Info.plist:../macosx/Tcl-Info.plist.in Tclsh-Info.plist:../macosx/Tclsh-Info.plist.in" TCL_YEAR="`date +%Y`" fi if test "$FRAMEWORK_BUILD" = "1" ; then -$as_echo "#define TCL_FRAMEWORK 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define TCL_FRAMEWORK 1 +_ACEOF # 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" + ac_config_commands="$ac_config_commands Tcl.framework" LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH" # default install directory for bundled packages @@ -10429,29 +19205,6 @@ fi #-------------------------------------------------------------------- # The statements below define various symbols relating to Tcl -# core vfs and kit support. -#-------------------------------------------------------------------- - -eval "TCL_KIT_LIB_FILE=libtclkit${UNSHARED_LIB_SUFFIX}" -eval "TCL_KIT_LIB_FILE=${TCL_KIT_LIB_FILE}" - -eval "TCL_KIT_LIB_FILE=libtclkit${TCL_UNSHARED_LIB_SUFFIX}" -eval "TCL_KIT_LIB_FILE=\"${TCL_KIT_LIB_FILE}\"" -eval "TCL_KIT_LIB_DIR=${libdir}" - -if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then - TCL_KIT_LIB_FLAG="-ltclkit${TCL_VERSION}" -else - TCL_KIT_LIB_FLAG="-ltclkit`echo ${TCL_VERSION} | tr -d .`" -fi - -TCL_BUILD_KIT_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TCL_KIT_LIB_FLAG}" -TCL_KIT_LIB_SPEC="-L${TCL_KIT_LIB_DIR} ${TCL_KIT_LIB_FLAG}" -TCL_BUILD_KIT_LIB_PATH="`pwd`/${TCL_KIT_LIB_FILE}" -TCL_KIT_LIB_PATH="${TCL_KIT_LIB_DIR}/${TCL_KIT_LIB_FILE}" - -#-------------------------------------------------------------------- -# The statements below define various symbols relating to Tcl # stub support. #-------------------------------------------------------------------- @@ -10542,16 +19295,7 @@ TCL_SHARED_BUILD=${SHARED_BUILD} - - - - - - - - - -ac_config_files="$ac_config_files Makefile:../unix/Makefile.in dltest/Makefile:../unix/dltest/Makefile.in tclConfig.sh:../unix/tclConfig.sh.in tcl.pc:../unix/tcl.pc.in" + ac_config_files="$ac_config_files Makefile:../unix/Makefile.in dltest/Makefile:../unix/dltest/Makefile.in tclConfig.sh:../unix/tclConfig.sh.in tcl.pc:../unix/tcl.pc.in" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -10571,70 +19315,39 @@ _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. +# So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - +{ (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. + 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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; - esac | - sort -) | + esac; +} | sed ' - /^ac_cv_env_/b end t clear - :clear + : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + echo "not updating unwritable cache $cache_file" fi fi rm -f confcache @@ -10643,56 +19356,63 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. 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 branch to the quote section. Otherwise, +# take arguments), then we branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} +cat >confdef2opt.sed <<\_ACEOF t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g t quote -b any -:quote -s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\[/\\&/g -s/\]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` +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 +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS="" - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 +: ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -10702,253 +19422,81 @@ cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 debug=false ac_cs_recheck=false ac_cs_silent=false - SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } +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='+ ' -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - +# 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 -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi -as_me=`$as_basename -- "$0" || +# Name of the executable. +as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + +# PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -10956,111 +19504,148 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' else - as_ln_s='cp -pR' + PATH_SEPARATOR=: fi -else - as_ln_s='cp -pR' + rm -f conf$$.sh fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done - case $as_dir in #( - -*) as_dir=./$as_dir;; + ;; esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file -} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' + as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p +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'" @@ -11069,20 +19654,31 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" 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" + +# CDPATH. +$as_unset CDPATH + exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to + +# Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + This file was extended by tcl $as_me 8.6, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -11090,41 +19686,43 @@ generated by GNU Autoconf 2.69. Invocation command line was CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 _ACEOF -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_commands="$ac_config_commands" +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi -_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. +\`$as_me' instantiates files from templates according to the +current configuration. -Usage: $0 [OPTION]... [TAG]... +Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages + -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 + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE Configuration files: $config_files @@ -11132,78 +19730,83 @@ $config_files Configuration commands: $config_commands -Report bugs to the package provider." - +Report bugs to ." _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" + +cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ tcl config.status 8.6 -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" -Copyright (C) 2012 Free Software Foundation, Inc. +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." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -test -n "\$AWK" || AWK=awk +srcdir=$srcdir _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; - *) + -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; esac case $ac_option in # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; + *) ac_config_targets="$ac_config_targets $1" ;; esac shift @@ -11217,55 +19820,43 @@ if $ac_cs_silent; then fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" + 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 || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<_ACEOF # -# INIT-COMMANDS +# INIT-COMMANDS section. # + VERSION=${TCL_VERSION} _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Handling of arguments. + +cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do - case $ac_config_target in - "Tcl-Info.plist") CONFIG_FILES="$CONFIG_FILES Tcl-Info.plist:../macosx/Tcl-Info.plist.in" ;; - "Tclsh-Info.plist") CONFIG_FILES="$CONFIG_FILES Tclsh-Info.plist:../macosx/Tclsh-Info.plist.in" ;; - "Tcl.framework") CONFIG_COMMANDS="$CONFIG_COMMANDS Tcl.framework" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:../unix/Makefile.in" ;; - "dltest/Makefile") CONFIG_FILES="$CONFIG_FILES dltest/Makefile:../unix/dltest/Makefile.in" ;; - "tclConfig.sh") CONFIG_FILES="$CONFIG_FILES tclConfig.sh:../unix/tclConfig.sh.in" ;; - "tcl.pc") CONFIG_FILES="$CONFIG_FILES tcl.pc:../unix/tcl.pc.in" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + case "$ac_config_target" in + # Handling of arguments. + "Tcl-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Tcl-Info.plist:../macosx/Tcl-Info.plist.in" ;; + "Tclsh-Info.plist" ) CONFIG_FILES="$CONFIG_FILES Tclsh-Info.plist:../macosx/Tclsh-Info.plist.in" ;; + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile:../unix/Makefile.in" ;; + "dltest/Makefile" ) CONFIG_FILES="$CONFIG_FILES dltest/Makefile:../unix/dltest/Makefile.in" ;; + "tclConfig.sh" ) CONFIG_FILES="$CONFIG_FILES tclConfig.sh:../unix/tclConfig.sh.in" ;; + "tcl.pc" ) CONFIG_FILES="$CONFIG_FILES tcl.pc:../unix/tcl.pc.in" ;; + "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 @@ -11276,427 +19867,533 @@ if $ac_need_defaults; then fi # Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, +# simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. +# Create a temporary directory, and hook for its removal unless debugging. $debug || { - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 } + # Create a (secure) tmp directory for tmp files. { - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" } || { - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || { - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" +cat >>$CONFIG_STATUS <<_ACEOF +# +# CONFIG_FILES section. +# -eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@MAN_FLAGS@,$MAN_FLAGS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@TCL_THREADS@,$TCL_THREADS,;t t +s,@TCLSH_PROG@,$TCLSH_PROG,;t t +s,@ZLIB_OBJS@,$ZLIB_OBJS,;t t +s,@ZLIB_SRCS@,$ZLIB_SRCS,;t t +s,@ZLIB_INCLUDE@,$ZLIB_INCLUDE,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_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,@LDAIX_SRC@,$LDAIX_SRC,;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 +s,@STLIB_LD@,$STLIB_LD,;t t +s,@SHLIB_LD@,$SHLIB_LD,;t t +s,@TCL_SHLIB_LD_EXTRAS@,$TCL_SHLIB_LD_EXTRAS,;t t +s,@TK_SHLIB_LD_EXTRAS@,$TK_SHLIB_LD_EXTRAS,;t t +s,@SHLIB_LD_LIBS@,$SHLIB_LD_LIBS,;t t +s,@SHLIB_CFLAGS@,$SHLIB_CFLAGS,;t t +s,@SHLIB_SUFFIX@,$SHLIB_SUFFIX,;t t +s,@MAKE_LIB@,$MAKE_LIB,;t t +s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t +s,@INSTALL_LIB@,$INSTALL_LIB,;t t +s,@DLL_INSTALL_DIR@,$DLL_INSTALL_DIR,;t t +s,@INSTALL_STUB_LIB@,$INSTALL_STUB_LIB,;t t +s,@CFLAGS_DEFAULT@,$CFLAGS_DEFAULT,;t t +s,@LDFLAGS_DEFAULT@,$LDFLAGS_DEFAULT,;t t +s,@DTRACE@,$DTRACE,;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,@PKG_CFG_ARGS@,$PKG_CFG_ARGS,;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 +s,@TCL_INCLUDE_SPEC@,$TCL_INCLUDE_SPEC,;t t +s,@TCL_BUILD_STUB_LIB_SPEC@,$TCL_BUILD_STUB_LIB_SPEC,;t t +s,@TCL_BUILD_STUB_LIB_PATH@,$TCL_BUILD_STUB_LIB_PATH,;t t +s,@TCL_SRC_DIR@,$TCL_SRC_DIR,;t t +s,@CFG_TCL_SHARED_LIB_SUFFIX@,$CFG_TCL_SHARED_LIB_SUFFIX,;t t +s,@CFG_TCL_UNSHARED_LIB_SUFFIX@,$CFG_TCL_UNSHARED_LIB_SUFFIX,;t t +s,@TCL_SHARED_BUILD@,$TCL_SHARED_BUILD,;t t +s,@LD_LIBRARY_PATH_VAR@,$LD_LIBRARY_PATH_VAR,;t t +s,@TCL_BUILD_LIB_SPEC@,$TCL_BUILD_LIB_SPEC,;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,@INSTALL_TZDATA@,$INSTALL_TZDATA,;t t +s,@DTRACE_SRC@,$DTRACE_SRC,;t t +s,@DTRACE_HDR@,$DTRACE_HDR,;t t +s,@DTRACE_OBJ@,$DTRACE_OBJ,;t t +s,@MAKEFILE_SHELL@,$MAKEFILE_SHELL,;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,@PACKAGE_DIR@,$PACKAGE_DIR,;t t +s,@EXTRA_CC_SWITCHES@,$EXTRA_CC_SWITCHES,;t t +s,@EXTRA_APP_CC_SWITCHES@,$EXTRA_APP_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 +s,@EXTRA_TCLSH_LIBS@,$EXTRA_TCLSH_LIBS,;t t +s,@DLTEST_LD@,$DLTEST_LD,;t t +s,@DLTEST_SUFFIX@,$DLTEST_SUFFIX,;t t +CEOF - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done +_ACEOF - # 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. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + 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. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # 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" - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; +_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 - ac_dir=`$as_dirname -- "$ac_file" || + # 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 || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p + 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 + 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=. -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix +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 - .) # We are building in place. + .) # No --srcdir option. We are building in place. ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. + 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 - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; + 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 -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; +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 -_ACEOF -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub + + + 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 -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + 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 - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac +# +# 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 - case $ac_file$ac_mode in - "Tcl.framework":C) n=Tcl && + { 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 # for ac_tag +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF -as_fn_exit 0 +{ (exit 0); exit 0; } _ACEOF +chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -11716,11 +20413,7 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + $ac_cs_success || { (exit 1); exit 1; } fi diff --git a/unix/configure.in b/unix/configure.in index bc7bdef..85bd7ee 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -893,29 +893,6 @@ fi #-------------------------------------------------------------------- # The statements below define various symbols relating to Tcl -# core vfs and kit support. -#-------------------------------------------------------------------- - -eval "TCL_KIT_LIB_FILE=libtclkit${UNSHARED_LIB_SUFFIX}" -eval "TCL_KIT_LIB_FILE=${TCL_KIT_LIB_FILE}" - -eval "TCL_KIT_LIB_FILE=libtclkit${TCL_UNSHARED_LIB_SUFFIX}" -eval "TCL_KIT_LIB_FILE=\"${TCL_KIT_LIB_FILE}\"" -eval "TCL_KIT_LIB_DIR=${libdir}" - -if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then - TCL_KIT_LIB_FLAG="-ltclkit${TCL_VERSION}" -else - TCL_KIT_LIB_FLAG="-ltclkit`echo ${TCL_VERSION} | tr -d .`" -fi - -TCL_BUILD_KIT_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TCL_KIT_LIB_FLAG}" -TCL_KIT_LIB_SPEC="-L${TCL_KIT_LIB_DIR} ${TCL_KIT_LIB_FLAG}" -TCL_BUILD_KIT_LIB_PATH="`pwd`/${TCL_KIT_LIB_FILE}" -TCL_KIT_LIB_PATH="${TCL_KIT_LIB_DIR}/${TCL_KIT_LIB_FILE}" - -#-------------------------------------------------------------------- -# The statements below define various symbols relating to Tcl # stub support. #-------------------------------------------------------------------- @@ -956,24 +933,14 @@ AC_SUBST(PKG_CFG_ARGS) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_LIB_SPEC) -AC_SUBST(TCL_BUILD_LIB_SPEC) - AC_SUBST(TCL_STUB_LIB_FILE) AC_SUBST(TCL_STUB_LIB_FLAG) AC_SUBST(TCL_STUB_LIB_SPEC) AC_SUBST(TCL_STUB_LIB_PATH) +AC_SUBST(TCL_INCLUDE_SPEC) AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) AC_SUBST(TCL_BUILD_STUB_LIB_PATH) -AC_SUBST(TCL_KIT_LIB_FILE) -AC_SUBST(TCL_KIT_LIB_FLAG) -AC_SUBST(TCL_KIT_LIB_SPEC) -AC_SUBST(TCL_KIT_LIB_PATH) -AC_SUBST(TCL_BUILD_KIT_LIB_SPEC) -AC_SUBST(TCL_BUILD_KIT_LIB_PATH) - -AC_SUBST(TCL_INCLUDE_SPEC) - AC_SUBST(TCL_SRC_DIR) AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX) AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX) @@ -981,6 +948,7 @@ AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX) AC_SUBST(TCL_SHARED_BUILD) AC_SUBST(LD_LIBRARY_PATH_VAR) +AC_SUBST(TCL_BUILD_LIB_SPEC) AC_SUBST(TCL_LIB_VERSIONS_OK) AC_SUBST(TCL_SHARED_LIB_SUFFIX) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 88f2b81..3ca65d8 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2060,14 +2060,6 @@ dnl # preprocessing tests use only CPPFLAGS. ]) ]) - AS_IF([test "$RANLIB" = ""], [ - MAKE_KIT_LIB='$(STLIB_LD) [$]@ ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS}' - INSTALL_KIT_LIB='$(INSTALL_LIBRARY) $(TCL_KIT_LIB_FILE) "$(LIB_INSTALL_DIR)/$(TCL_KIT_LIB_FILE)"' - ], [ - MAKE_KIT_LIB='${STLIB_LD} [$]@ ${TCL_OBJS} ${TOMMATH_OBJS} ${ZLIB_OBJS} ; ${RANLIB} [$]@' - INSTALL_KIT_LIB='$(INSTALL_LIBRARY) $(TCL_KIT_LIB_FILE) "$(LIB_INSTALL_DIR)/$(TCL_KIT_LIB_FILE)" ; (cd "$(LIB_INSTALL_DIR)" ; $(RANLIB) $(TCL_KIT_LIB_FILE))' - ]) - # Stub lib does not depend on shared/static configuration AS_IF([test "$RANLIB" = ""], [ MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}' @@ -2134,12 +2126,10 @@ dnl # preprocessing tests use only CPPFLAGS. [What is the default extension for shared libraries?]) AC_SUBST(MAKE_LIB) - AC_SUBST(MAKE_KIT_LIB) AC_SUBST(MAKE_STUB_LIB) AC_SUBST(INSTALL_LIB) AC_SUBST(DLL_INSTALL_DIR) AC_SUBST(INSTALL_STUB_LIB) - AC_SUBST(INSTALL_KIT_LIB) AC_SUBST(RANLIB) ]) diff --git a/win/makefile.bc b/win/makefile.bc index e005979..57bfda0 100644 --- a/win/makefile.bc +++ b/win/makefile.bc @@ -159,6 +159,7 @@ TCLPLUGINDLLNAME = $(NAMEPREFIX)$(VERSION)p$(DBGX).dll TCLPLUGINDLL = $(OUTDIR)\$(TCLPLUGINDLLNAME) TCLSH = $(OUTDIR)\$(NAMEPREFIX)sh$(VERSION)$(DBGX).exe TCLSHP = $(OUTDIR)\$(NAMEPREFIX)shp$(VERSION)$(DBGX).exe +TCLKIT = $(OUTDIR)\$(NAMEPREFIX)kit$(VERSION)$(DBGX).exe TCLREGDLLNAME = $(NAMEPREFIX)reg$(REGVERSION)$(DBGX).dll TCLREGDLL = $(OUTDIR)\$(TCLREGDLLNAME) TCLDDEDLLNAME = $(NAMEPREFIX)dde$(DDEVERSION)$(DBGX).dll @@ -177,6 +178,10 @@ INCLUDE_INSTALL_DIR = $(INSTALLDIR)\include TCLSHOBJS = \ $(TMPDIR)\tclAppInit.obj +TCLKITOBJS = \ + $(TMP_DIR)\tclZipVfs.obj \ + $(TMPDIR)\tclKitInit.obj + TCLTESTOBJS = \ $(TMPDIR)\tclTest.obj \ $(TMPDIR)\tclTestObj.obj \ @@ -275,7 +280,6 @@ TCLOBJS = \ $(TMPDIR)\tclWinSock.obj \ $(TMPDIR)\tclWinThrd.obj \ $(TMPDIR)\tclWinTime.obj \ - $(TMP_DIR)\tclZipVfs.obj \ $(TMPDIR)\tclZlib.obj TCLSTUBOBJS = \ @@ -392,6 +396,11 @@ $(TCLTEST): $(TCLTESTOBJS) $(TCLLIB) $(TMPDIR)\$(NAMEPREFIX)sh.res $(TCLTESTOBJS), $@, -x, $(LNLIBS) $(TCLLIB),, $(TMPDIR)\$(NAMEPREFIX)sh.res ! +$(TCLKIT): $(TCLKITOBJS) $(TCLLIB) $(TMPDIR)\$(NAMEPREFIX)sh.res + $(link32) $(ldebug) -S:2400000 $(LNFLAGS) $(LNFLAGS_CONS) $(TOOLS32)\lib\c0x32 @&&! + $(TCLSHOBJS), $@, -x, $(LNLIBS) $(TCLLIB),, $(TMPDIR)\$(NAMEPREFIX)sh.res +! + $(TCLDDEDLL): $(TMPDIR)\tclWinDde.obj $(TCLSTUBLIB) $(link32) $(ldebug) $(LNFLAGS) $(LNFLAGS_DLL) $(TOOLS32)\lib\c0d32 \ $(TMPDIR)\tclWinDde.obj, $@, -x, $(LNLIBS) $(TCLSTUBLIB),, \ @@ -512,6 +521,10 @@ $(TMP_DIR)\tclPkgConfig.obj: $(GENERICDIR)\tclPkgConfig.c $(TMPDIR)\tclAppInit.obj : $(WINDIR)\tclAppInit.c $(cc32) $(TCL_CFLAGS) -o$(TMPDIR)\$@ $? +$(TMPDIR)\tclKitInit.obj : $(WINDIR)\tclAppInit.c + $(cc32) $(TCL_CFLAGS) -DDTCL_ZIPVFS -o$(TMPDIR)\$@ $? + + # The following objects should be built using the stub interfaces # tclWinReg: Produces errors in ANSI mode diff --git a/win/makefile.vc b/win/makefile.vc index 43644cc..832f6bd 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -209,6 +209,9 @@ TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME) TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe TCLSH = $(OUT_DIR)\$(TCLSHNAME) +TCLKITNAME = $(PROJECT)kit$(VERSION)$(SUFX).exe +TCLKIT = $(OUT_DIR)\$(TCLSHNAME) + TCLREGLIBNAME = $(PROJECT)reg$(REGVERSION)$(SUFX:t=).$(EXT) TCLREGLIB = $(OUT_DIR)\$(TCLREGLIBNAME) @@ -244,6 +247,18 @@ TCLSHOBJS = \ !endif $(TMP_DIR)\tclsh.res +TCLKITOBJS = \ + $(TMP_DIR)\tclKitInit.obj \ + $(TMP_DIR)\tclZipVfs.obj \ +!if !$(STATIC_BUILD) +!if $(TCL_USE_STATIC_PACKAGES) + $(TMP_DIR)\tclWinReg.obj \ + $(TMP_DIR)\tclWinDde.obj \ +!endif +!endif + $(TMP_DIR)\tclsh.res + + TCLTESTOBJS = \ $(TMP_DIR)\tclTest.obj \ $(TMP_DIR)\tclTestObj.obj \ @@ -343,7 +358,6 @@ COREOBJS = \ $(TMP_DIR)\tclUtf.obj \ $(TMP_DIR)\tclUtil.obj \ $(TMP_DIR)\tclVar.obj \ - $(TMP_DIR)\tclZipVfs.obj \ $(TMP_DIR)\tclZlib.obj ZLIBOBJS = \ @@ -957,6 +971,12 @@ $(TMP_DIR)\tclAppInit.obj: $(WINDIR)\tclAppInit.c -DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \ -Fo$@ $? +$(TMP_DIR)\tclKitInit.obj: $(WINDIR)\tclAppInit.c + $(cc32) $(TCL_CFLAGS) \ + -DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \ + -DTCL_ZIPVFS \ + -Fo$@ $? + ### The following objects should be built using the stub interfaces ### *ALL* extensions need to built with -DTCL_THREADS=1 -- cgit v0.12 From a684c1a281bc1a3c98249e6aa961fa57498dd9a7 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 15 Sep 2014 10:04:50 +0000 Subject: Modified the makefile to produce a distinct name for a kit depending on whether it was compiled statically or dynamically. This allows builders to run and install successive builds of Tcl both statically and dynamically. --- unix/Makefile.in | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 7523fca..ba81ecc 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -109,6 +109,7 @@ CFLAGS = @CFLAGS_DEFAULT@ @CFLAGS@ LDFLAGS_DEBUG = @LDFLAGS_DEBUG@ LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ LDFLAGS = @LDFLAGS_DEFAULT@ @LDFLAGS@ +SHARED_BUILD = @TCL_SHARED_BUILD@ # To disable ANSI-C procedure prototypes reverse the comment characters on the # following lines: @@ -167,7 +168,13 @@ INSTALL_DATA_DIR = ${INSTALL} -d -m 755 # Do not use SHELL_ENV for NATIVE_TCLSH unless it is the tclsh being built. EXE_SUFFIX = @EXEEXT@ TCL_EXE = tclsh${EXE_SUFFIX} -TCLKIT_EXE = tclkit${EXE_SUFFIX} +ifeq ($(SHARED_BUILD),0) +TCLKIT_BASE = tclkits +else +TCLKIT_BASE = tclkitd +endif +TCLKIT_EXE = ${TCLKIT_BASE}${EXE_SUFFIX} + TCLTEST_EXE = tcltest${EXE_SUFFIX} NATIVE_TCLSH = @TCLSH_PROG@ @@ -675,7 +682,7 @@ ${TCLKIT_EXE}: ${TCLKIT_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} null.zip tclk cd tclkit.vfs ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . # Builds an executable directly from the Tcl sources -tclkit-direct: ${TCLKIT_OBJS} ${OBJS} ${ZLIB_OBJS} null.zip tclkit.vfs +tclkit-static: ${TCLKIT_OBJS} ${OBJS} ${ZLIB_OBJS} null.zip tclkit.vfs ${CC} ${CFLAGS} ${LDFLAGS} \ ${TCLKIT_OBJS} ${OBJS} ${ZLIB_OBJS} \ ${LIBS} @EXTRA_TCLSH_LIBS@ \ @@ -836,8 +843,8 @@ install-binaries: binaries @chmod 555 "$(DLL_INSTALL_DIR)/$(LIB_FILE)" @echo "Installing ${TCL_EXE} as $(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" @$(INSTALL_PROGRAM) ${TCL_EXE} "$(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" - @echo "Installing ${TCLKIT_EXE} as $(BIN_INSTALL_DIR)/tclkit$(VERSION)${EXE_SUFFIX}" - @$(INSTALL_PROGRAM) ${TCLKIT_EXE} "$(BIN_INSTALL_DIR)/tclkit$(VERSION)${EXE_SUFFIX}" + @echo "Installing ${TCLKIT_EXE} as $(BIN_INSTALL_DIR)/${TCLKIT_BASE}$(VERSION)${EXE_SUFFIX}" + @$(INSTALL_PROGRAM) ${TCLKIT_EXE} "$(BIN_INSTALL_DIR)/${TCLKIT_BASE}$(VERSION)${EXE_SUFFIX}" @echo "Installing tclConfig.sh to $(CONFIG_INSTALL_DIR)/" @$(INSTALL_DATA) tclConfig.sh "$(CONFIG_INSTALL_DIR)/tclConfig.sh" @echo "Installing tclooConfig.sh to $(CONFIG_INSTALL_DIR)/" @@ -2166,7 +2173,7 @@ BUILD_HTML = \ .PHONY: install-tzdata install-msgs .PHONY: packages configure-packages test-packages clean-packages .PHONY: dist-packages distclean-packages install-packages -.PHONY: tclkit-direct +.PHONY: tclkit-static #-------------------------------------------------------------------------- # DO NOT DELETE THIS LINE -- make depend depends on it. -- cgit v0.12 From 4b8398a6ed8396348a2cbcd0da5a47bf42756fab Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 15 Sep 2014 14:59:20 +0000 Subject: Removed non-working code from the end of the mkVfs.tcl script --- tools/mkVfs.tcl | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tools/mkVfs.tcl b/tools/mkVfs.tcl index 83eb9e6..bc6f3aa 100644 --- a/tools/mkVfs.tcl +++ b/tools/mkVfs.tcl @@ -91,17 +91,3 @@ set VFSROOT $dir } pkgIndexDir ${TCL_SCRIPT_DIR} $fout ${TCL_SCRIPT_DIR} close $fout -exit 0 -puts $fout { -# Save Tcl the trouble of hunting for these packages -} -set ddedll [glob -nocomplain ${TCLSRC_ROOT}/win/tcldde*.dll] -if {$ddedll != {}} { - puts $fout [cat ${TCL_SCRIPT_DIR}/dde/pkgIndex.tcl] -} -set regdll [glob -nocomplain ${TCLSRC_ROOT}/win/tclreg*.dll] -if {$regdll != {}} { - puts $fout [cat ${TCL_SCRIPT_DIR}/reg/pkgIndex.tcl] -} -close $fout -file attributes ${TCL_SCRIPT_DIR}/tclIndex -readonly 1 -- cgit v0.12 From ff7a13136dd5b09e8e2dee557447b05336329fc5 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 16 Sep 2014 23:07:44 +0000 Subject: Added a "make tclkit" to makefile Removed debugging fprintf --- generic/tclZipVfs.c | 2 -- unix/Makefile.in | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tclZipVfs.c b/generic/tclZipVfs.c index 15f38bd..7839648 100755 --- a/generic/tclZipVfs.c +++ b/generic/tclZipVfs.c @@ -1774,7 +1774,6 @@ Zvfs_doInit( ** Boot a shell, mount the executable's VFS, detect main.tcl */ int Tcl_Zvfs_Boot(const char *archive,const char *vfsmountpoint,const char *initscript) { - FILE *fout; Zvfs_Common_Init(NULL); if(!vfsmountpoint) { vfsmountpoint="/zvfs"; @@ -1823,7 +1822,6 @@ int Tcl_Zvfs_Boot(const char *archive,const char *vfsmountpoint,const char *init if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { /* Startup script should be set before calling Tcl_AppInit */ - fprintf(fout,"%s\n",Tcl_GetString(vfsinitscript)); Tcl_SetStartupScript(vfsinitscript,NULL); } diff --git a/unix/Makefile.in b/unix/Makefile.in index ba81ecc..757f313 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -670,7 +670,9 @@ tclkit.vfs: @echo "Building VFS File system in tclkit.vfs" @$(TCL_EXE) "$(TOP_DIR)/tools/mkVfs.tcl" \ "$(UNIX_DIR)/tclkit.vfs/tcl$(VERSION)" "$(TOP_DIR)" unix - + +tclkit: ${TCLKIT_EXE} + # Builds an executable linked to the Tcl dynamic library ${TCLKIT_EXE}: ${TCLKIT_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} null.zip tclkit.vfs ${CC} ${CFLAGS} ${LDFLAGS} \ @@ -2173,7 +2175,7 @@ BUILD_HTML = \ .PHONY: install-tzdata install-msgs .PHONY: packages configure-packages test-packages clean-packages .PHONY: dist-packages distclean-packages install-packages -.PHONY: tclkit-static +.PHONY: tclkit-static tclkit #-------------------------------------------------------------------------- # DO NOT DELETE THIS LINE -- make depend depends on it. -- cgit v0.12 From 2e0b2484a98701ffab53bda837e16ee86829fc6b Mon Sep 17 00:00:00 2001 From: tne Date: Wed, 17 Sep 2014 08:31:21 +0000 Subject: Removed non-working tclkit-direct makefile technique --- win/Makefile.in | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/win/Makefile.in b/win/Makefile.in index 0b52640..113f87a 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -442,7 +442,12 @@ tclkit.vfs: $(TCLSH) $(DDE_DLL_FILE) $(REG_DLL_FILE) @$(TCL_EXE) "$(ROOT_DIR)/tools/mkVfs.tcl" \ "$(WIN_DIR)/tclkit.vfs/tcl$(VERSION)" "$(ROOT_DIR)" windows -$(TCLKIT): tclkit-direct +$(TCLKIT): $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs + $(CC) $(CFLAGS) $(TCLKIT_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ + tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) + @VC_MANIFEST_EMBED_EXE@ + cat null.zip >> $(TCLKIT) + cd tclkit.vfs ; zip -rAq $(WIN_DIR)/$(TCLKIT) . # Builds an executable directly from the Tcl sources tclkit-direct: $(TCLKIT_OBJS) ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLIB_OBJS} @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs @@ -456,22 +461,6 @@ tclkit-direct: $(TCLKIT_OBJS) ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLI cat null.zip >> $(TCLKIT) cd tclkit.vfs ; zip -rAq $(WIN_DIR)/$(TCLKIT) . - -# Builds an executable linked to the Tcl dynamic library -tclkit-dynamic: $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs - $(CC) $(CFLAGS) $(TCLKIT_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ - tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) - @VC_MANIFEST_EMBED_EXE@ - cat null.zip >> $(TCLKIT) - cd tclkit.vfs ; zip -rAq $(WIN_DIR)/$(TCLKIT) . - -tclkit-kitlib: $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs - $(CC) $(CFLAGS) $(TCLKIT_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ - tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) - @VC_MANIFEST_EMBED_EXE@ - cat null.zip >> $(TCLKIT) - cd tclkit.vfs ; zip -rAq $(WIN_DIR)/$(TCLKIT) . - cat32.$(OBJEXT): cat.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) -- cgit v0.12 From ebebb29be9f0d9bf86391ccc015e0f1a97d3b39b Mon Sep 17 00:00:00 2001 From: tne Date: Wed, 17 Sep 2014 08:33:16 +0000 Subject: Walked back modifications to tclConfig.sh.in (Builds don't require them anymore) --- unix/tclConfig.sh.in | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/unix/tclConfig.sh.in b/unix/tclConfig.sh.in index 976bd7f..b58e9fd 100644 --- a/unix/tclConfig.sh.in +++ b/unix/tclConfig.sh.in @@ -39,9 +39,6 @@ TCL_SHARED_BUILD=@TCL_SHARED_BUILD@ # The name of the Tcl library (may be either a .a file or a shared library): TCL_LIB_FILE='@TCL_LIB_FILE@' -# The name of the static Tcl library (intended for kits): -TCL_KIT_LIB_FILE='@TCL_KIT_LIB_FILE@' - # Additional libraries to use when linking Tcl. TCL_LIBS='@TCL_LIBS@' @@ -145,31 +142,6 @@ TCL_SRC_DIR='@TCL_SRC_DIR@' # the "exec_prefix" directory, if it is different. TCL_PACKAGE_PATH='@TCL_PACKAGE_PATH@' -# Core VFS Kit Support -TCL_SUPPORT_KITS=1 - -# The name of the Tcl kit library (.a): -TCL_KIT_LIB_FILE='@TCL_KIT_LIB_FILE@' - -# -l flag to pass to the linker to pick up the Tcl kit library -TCL_KIT_LIB_FLAG='@TCL_KIT_LIB_FLAG@' - -# String to pass to linker to pick up the Tcl kit library from its -# build directory. -TCL_BUILD_KIT_LIB_SPEC='@TCL_BUILD_KIT_LIB_SPEC@' - -# String to pass to linker to pick up the Tcl kit library from its -# installed directory. -TCL_KIT_LIB_SPEC='@TCL_KIT_LIB_SPEC@' - -# Path to the Tcl kit library in the build directory. -TCL_BUILD_KIT_LIB_PATH='@TCL_BUILD_KIT_LIB_PATH@' - -# Path to the Tcl kit library in the install directory. -TCL_KIT_LIB_PATH='@TCL_KIT_LIB_PATH@' - -# END VFS SUPPORT - # Tcl supports stub. TCL_SUPPORTS_STUBS=1 -- cgit v0.12 From cfd9edb0fe18c9cc71f548a037e8d308494269c4 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sun, 19 Oct 2014 20:03:00 +0000 Subject: Update the zipvfs implementation with additional code from both Odie and Dennis LaBelle's FreeWrap. Split the boot loader code out of tclZipVfs.c and into its own File. Altered the structure of tclZipVfs.c to better mirror that which is distributed in Odie and FreeWrap to make popping and swapping improvements easier. --- generic/tclBootVfs.h | 24 + generic/tclZipVfs.c | 2837 +++++++++++++++++------------------------------ generic/tclZipVfsBoot.c | 86 ++ unix/Makefile.in | 7 +- unix/tclAppInit.c | 7 +- win/Makefile.in | 2 +- win/tclAppInit.c | 8 +- 7 files changed, 1154 insertions(+), 1817 deletions(-) create mode 100644 generic/tclBootVfs.h create mode 100644 generic/tclZipVfsBoot.c diff --git a/generic/tclBootVfs.h b/generic/tclBootVfs.h new file mode 100644 index 0000000..1cb7c23 --- /dev/null +++ b/generic/tclBootVfs.h @@ -0,0 +1,24 @@ +#include +#include "tclInt.h" +#include "tclFileSystem.h" + +#ifndef MODULE_SCOPE +# define MODULE_SCOPE extern +#endif + +#define TCLVFSBOOT_INIT "main.tcl" +#define TCLVFSBOOT_MOUNT "/zvfs" + +/* Make sure the stubbed variants of those are never used. */ +#undef Tcl_ObjSetVar2 +#undef Tcl_NewStringObj +#undef Tk_Init +#undef Tk_MainEx +#undef Tk_SafeInit + +MODULE_SCOPE int Tcl_Zvfs_Boot(const char *,const char *,const char *); +MODULE_SCOPE int Zvfs_Init(Tcl_Interp *); +MODULE_SCOPE int Zvfs_SafeInit(Tcl_Interp *); +MODULE_SCOPE int Tclkit_Packages_Init(Tcl_Interp *); + + diff --git a/generic/tclZipVfs.c b/generic/tclZipVfs.c index 7839648..c9160ba 100755 --- a/generic/tclZipVfs.c +++ b/generic/tclZipVfs.c @@ -1,256 +1,309 @@ /* - * Copyright (c) 2000 D. Richard Hipp - * Copyright (c) 2007 PDQ Interfaces Inc. - * Copyright (c) 2013-2014 Sean Woods - * - * This file is now released under the BSD style license outlined in the - * included file license.terms. - * - ************************************************************************ - * A ZIP archive virtual filesystem for Tcl. - * - * This package of routines enables Tcl to use a Zip file as a virtual file - * system. Each of the content files of the Zip archive appears as a real - * file to Tcl. - * - * Well, almost... Actually, the virtual file system is limited in a number - * of ways. The only things you can do are "stat" and "read" file content - * files. You cannot use "cd". But it turns out that "stat" and "read" are - * sufficient for most purposes. - * - * This version has been modified to run under Tcl 8.6 - */ -#include "tcl.h" -#include +** Copyright (c) 2000 D. Richard Hipp +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public +** License as published by the Free Software Foundation; either +** version 2 of the License, or (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public +** License along with this library; if not, write to the +** Free Software Foundation, Inc., 59 Temple Place - Suite 330, +** Boston, MA 02111-1307, USA. +** +** Author contact information: +** drh@hwaci.com +** http://www.hwaci.com/drh/ +** +************************************************************************* +** A ZIP archive virtual filesystem for Tcl. +** +** This package of routines enables Tcl to use a Zip file as +** a virtual file system. Each of the content files of the Zip +** archive appears as a real file to Tcl. +** +** Modified to use Tcl VFS hooks by Peter MacDonald +** peter@pdqi.com +** http://pdqi.com +** +** @(#) $Id: zvfs.c,v 1.1.1.1 2002/01/27 17:44:02 cvs Exp $ +** +** Revison Date Author Description +** ------- ------------- ----------------- ---------------------------------------------- +** Jan 8, 2006 Dennis R. LaBelle Modified to support encrypted files +** +** Dec 16, 2009 Dennis R. LaBelle Corrected Tobe_FSMatchInDirectoryProc() for +** proper operation of glob command on ZVFS files +** under TCL 8.5. +** Oct 19, 2014 Sean D. Woods Corrected Tobe_FSMatchInDirectoryProc() to work around +** issues resolving global file paths under Windows. +** Wrapped FreeWrap specific calls inside of macros. +** Wrapped calls that implement encryption inside of macros. (The supporting +** library for this is part of Zip, and not distributed with Tcl.) +** Reconciled this edition of Zvfs with parallel work on the Odie project. +*/ + #include #include #include #include #include #include +#include +#include "tcl.h" + +#undef ZIPVFSCRYPT +#ifdef ZIPVFSCRYPT +/* Some modifications to support encrypted files */ +#define update_keys zp_update_keys +#define init_keys zp_init_keys +#define decrypt_byte zp_decrypt_byte + +/* some prototype definitions */ +extern void init_keys(char *pwd); +extern int update_keys(int c); +extern unsigned char decrypt_byte(); +extern char *getPwdKey(char *keybuf); +extern const unsigned long *crc_32_tab; +#endif + +/* End of modifications to support encrypted files. */ /* - * Size of the decompression input buffer - */ -#define COMPR_BUF_SIZE 8192 -/*TODO: use thread-local as appropriate*/ +** Size of the decompression input buffer +*/ +#define COMPR_BUF_SIZE 32768 static int openarch = 0; /* Set to 1 when opening archive. */ +static int maptolower=0; /* - * All static variables are collected into a structure named "local". That - * way, it is clear in the code when we are using a static variable because - * its name begins with "local.". - */ +** All static variables are collected into a structure named "local". +** That way, it is clear in the code when we are using a static +** variable because its name begins with "local.". +*/ static struct { - Tcl_HashTable fileHash; /* One entry for each file in the ZVFS. The - * key is the virtual filename. The data is an - * instance of the ZvfsFile structure. */ - Tcl_HashTable archiveHash; /* One entry for each archive. Key is the - * name. The data is the ZvfsArchive - * structure. */ - int isInit; /* True after initialization */ + Tcl_HashTable fileHash; /* One entry for each file in the ZVFS. The + ** The key is the virtual filename. The data + ** an an instance of the ZvfsFile structure. */ + Tcl_HashTable archiveHash; /* One entry for each archive. Key is the name. + ** data is the ZvfsArchive structure */ + int isInit; /* True after initialization */ + char *firstMount; /* The path to to the first mounted file. */ } local; /* - * Each ZIP archive file that is mounted is recorded as an instance of this - * structure - */ +** Each ZIP archive file that is mounted is recorded as an instance +** of this structure +*/ typedef struct ZvfsArchive { - char *zName; /* Name of the archive */ - char *zMountPoint; /* Where this archive is mounted */ - struct ZvfsFile *pFiles; /* List of files in that archive */ + char *zName; /* Name of the archive */ + char *zMountPoint; /* Where this archive is mounted */ + struct ZvfsFile *pFiles; /* List of files in that archive */ } ZvfsArchive; /* - * Particulars about each virtual file are recorded in an instance of the - * following structure. - */ +** Particulars about each virtual file are recorded in an instance +** of the following structure. +*/ typedef struct ZvfsFile { - char *zName; /* The full pathname of the virtual file */ - ZvfsArchive *pArchive; /* The ZIP archive holding this file data */ - int iOffset; /* Offset into the ZIP archive of the data */ - int nByte; /* Uncompressed size of the virtual file */ - int nByteCompr; /* Compressed size of the virtual file */ - time_t timestamp; /* Modification time */ - int isdir; /* Set to 2 if directory, or 1 if mount */ - int depth; /* Number of slashes in path. */ - int permissions; /* File permissions. */ - struct ZvfsFile *pNext; /* Next file in the same archive */ - struct ZvfsFile *pNextName; /* A doubly-linked list of files with the - * _same_ name. Only the first is in - * local.fileHash */ - struct ZvfsFile *pPrevName; + char *zName; /* The full pathname of the virtual file */ + ZvfsArchive *pArchive; /* The ZIP archive holding this file data */ + int iOffset; /* Offset into the ZIP archive of the data */ + int nByte; /* Uncompressed size of the virtual file */ + int nByteCompr; /* Compressed size of the virtual file */ + int isdir; /* Set to 1 if directory */ + int depth; /* Number of slashes in path. */ + int timestamp; /* Modification time */ + int permissions; /* File permissions. */ + struct ZvfsFile *pNext; /* Next file in the same archive */ + struct ZvfsFile *pNextName; /* A doubly-linked list of files with the same */ + struct ZvfsFile *pPrevName; /* name. Only the first is in local.fileHash */ + /* The following would be used for writable zips. */ + int nExtra; /* Extra space in the TOC header */ + int isSpecial; /* Not really a file in the ZIP archive */ + int dosTime; /* Modification time (DOS format) */ + int dosDate; /* Modification date (DOS format) */ + int iCRC; /* Cyclic Redundancy Check of the data */ } ZvfsFile; /* - * Information about each file within a ZIP archive is stored in an instance - * of the following structure. A list of these structures forms a table of - * contents for the archive. - */ -typedef struct ZFile ZFile; -struct ZFile { - char *zName; /* Name of the file */ - int isSpecial; /* Not really a file in the ZIP archive */ - int dosTime; /* Modification time (DOS format) */ - int dosDate; /* Modification date (DOS format) */ - int iOffset; /* Offset into the ZIP archive of the data */ - int nByte; /* Uncompressed size of the virtual file */ - int nByteCompr; /* Compressed size of the virtual file */ - int nExtra; /* Extra space in the TOC header */ - int iCRC; /* Cyclic Redundancy Check of the data */ - int permissions; /* File permissions. */ - int flags; /* Deletion = bit 0. */ - ZFile *pNext; /* Next file in the same archive */ -}; - -EXTERN int Tcl_Zvfs_Mount(Tcl_Interp *interp,const char *zArchive,const char *zMountPoint); -EXTERN int Tcl_Zvfs_Umount(const char *zArchive); -EXTERN int TclZvfsInit(Tcl_Interp *interp); -EXTERN int Tcl_Zvfs_SafeInit(Tcl_Interp *interp); - -/* - * Macros to read 16-bit and 32-bit big-endian integers into the native format - * of this local processor. B is an array of characters and the integer - * begins at the N-th character of the array. - */ +** Macros to read 16-bit and 32-bit big-endian integers into the +** native format of this local processor. B is an array of +** characters and the integer begins at the N-th character of +** the array. +*/ #define INT16(B, N) (B[N] + (B[N+1]<<8)) #define INT32(B, N) (INT16(B,N) + (B[N+2]<<16) + (B[N+3]<<24)) /* - * Write a 16- or 32-bit integer as little-endian into the given buffer. - */ -static void -put16( - char *z, - int v) -{ - z[0] = v & 0xff; - z[1] = (v>>8) & 0xff; +** Write a 16- or 32-bit integer as little-endian into the given buffer. +*/ +static void put16(char *z, int v){ + z[0] = v & 0xff; + z[1] = (v>>8) & 0xff; } -static void -put32( - char *z, - int v) -{ - z[0] = v & 0xff; - z[1] = (v>>8) & 0xff; - z[2] = (v>>16) & 0xff; - z[3] = (v>>24) & 0xff; +static void put32(char *z, int v){ + z[0] = v & 0xff; + z[1] = (v>>8) & 0xff; + z[2] = (v>>16) & 0xff; + z[3] = (v>>24) & 0xff; } -/* - * Make a new ZFile structure with space to hold a name of the number of - * characters given. Return a pointer to the new structure. - */ -static ZFile * -newZFile( - int nName, - ZFile **ppList) -{ - ZFile *pNew = (void *) Tcl_Alloc(sizeof(*pNew) + nName + 1); - - memset(pNew, 0, sizeof(*pNew)); - pNew->zName = (char*)&pNew[1]; - pNew->pNext = *ppList; - *ppList = pNew; - return pNew; -} - -/* - * Delete an entire list of ZFile structures - */ -static void -deleteZFileList( - ZFile *pList) -{ - ZFile *pNext; - - while( pList ){ - pNext = pList->pNext; - Tcl_Free((char*)pList); - pList = pNext; - } -} - -/* Convert DOS time to unix time. */ -static void -UnixTimeDate( - struct tm *tm, - int *dosDate, - int *dosTime) -{ - *dosDate = ((((tm->tm_year-80)<<9)&0xfe00) | (((tm->tm_mon+1)<<5)&0x1e0) - | (tm->tm_mday&0x1f)); - *dosTime = (((tm->tm_hour<<11)&0xf800) | ((tm->tm_min<<5)&0x7e0) - | (tm->tm_sec&0x1f)); -} - /* Convert DOS time to unix time. */ -static time_t -DosTimeDate( - int dosDate, - int dosTime) -{ - time_t now; - struct tm *tm; - - now = time(NULL); - tm = localtime(&now); - tm->tm_year = (((dosDate&0xfe00)>>9) + 80); - tm->tm_mon = ((dosDate&0x1e0)>>5); - tm->tm_mday = (dosDate & 0x1f); - tm->tm_hour = (dosTime&0xf800)>>11; - tm->tm_min = (dosTime&0x7e0)>>5; - tm->tm_sec = (dosTime&0x1f); - return mktime(tm); +static time_t DosTimeDate(int dosDate, int dosTime){ + time_t now; + struct tm *tm; + now=time(NULL); + tm = localtime(&now); + tm->tm_year=(((dosDate&0xfe00)>>9) + 80); + tm->tm_mon=((dosDate&0x1e0)>>5)-1; + tm->tm_mday=(dosDate & 0x1f); + tm->tm_hour=(dosTime&0xf800)>>11; + tm->tm_min=(dosTime&0x7e)>>5; + tm->tm_sec=(dosTime&0x1f); + return mktime(tm); } /* - * Translate a DOS time and date stamp into a human-readable string. - */ -static void -translateDosTimeDate( - char *zStr, - int dosDate, - int dosTime){ - static char *zMonth[] = { "nil", - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", - }; +** Translate a DOS time and date stamp into a human-readable string. +*/ +static void translateDosTimeDate(char *zStr, int dosDate, int dosTime){ + static char *zMonth[] = { "nil", + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", + }; - sprintf(zStr, "%02d-%s-%d %02d:%02d:%02d", - dosDate & 0x1f, - zMonth[ ((dosDate&0x1e0)>>5) ], - ((dosDate&0xfe00)>>9) + 1980, - (dosTime&0xf800)>>11, - (dosTime&0x7e)>>5, - dosTime&0x1f); + sprintf(zStr, "%02d-%s-%d %02d:%02d:%02d", + dosDate & 0x1f, + zMonth[ ((dosDate&0x1e0)>>5) ], + ((dosDate&0xfe00)>>9) + 1980, + (dosTime&0xf800)>>11, + (dosTime&0x7e)>>5, + dosTime&0x1f + ); } /* Return count of char ch in str */ -int -strchrcnt( - char *str, - char ch) -{ - int cnt = 0; - char *cp = str; +int strchrcnt(char *str, char ch) { + int cnt=0; + char *cp=str; + while ((cp=strchr(cp,ch))) { cp++; cnt++; } + return cnt; +} + +#ifdef FREEWRAP +/* +** Concatenate zTail onto zRoot to form a pathname. zRoot will begin +** with "/". After concatenation, simplify the pathname be removing +** unnecessary ".." and "." directories. Under windows, make all +** characters lower case. +** +** Resulting pathname is returned. Space to hold the returned path is +** obtained from Tcl_Alloc() and should be freed by the calling function. +*/ +static char *CanonicalPath(const char *zRoot, const char *zTail){ + char *zPath; + int i, j, c; - while ((cp = strchr(cp,ch)) != NULL) { - cp++; - cnt++; +#ifdef __WIN32__ + if( isalpha(zTail[0]) && zTail[1]==':' ){ zTail += 2; } + if( zTail[0]=='\\' ){ zRoot = ""; zTail++; } + if( zTail[0]=='\\' ){ zRoot = "/"; zTail++; } // account for UNC style path +#endif + if( zTail[0]=='/' ){ zRoot = ""; zTail++; } + if( zTail[0]=='/' ){ zRoot = "/"; zTail++; } // account for UNC style path + zPath = (void *)Tcl_Alloc( strlen(zRoot) + strlen(zTail) + 2 ); + if( zPath==0 ) return 0; + sprintf(zPath, "%s/%s", zRoot, zTail); + for(i=j=0; (c = zPath[i])!=0; i++){ +#ifdef __WIN32__ + if( isupper(c) ) { if (maptolower) c = tolower(c); } + else if( c=='\\' ) c = '/'; +#endif + if( c=='/' ){ + int c2 = zPath[i+1]; + if( c2=='/' ) continue; + if( c2=='.' ){ + int c3 = zPath[i+2]; + if( c3=='/' || c3==0 ){ + i++; + continue; + } + if( c3=='.' && (zPath[i+3]=='.' || zPath[i+3]==0) ){ + i += 2; + while( j>0 && zPath[j-1]!='/' ){ j--; } + continue; + } + } + } + zPath[j++] = c; + } + if( j==0 ){ zPath[j++] = '/'; } + zPath[j] = 0; + return zPath; +} +/* +** Construct an absolute pathname in memory obtained from Tcl_Alloc +** that means the same file as the pathname given. +** +** Under windows, all backslash (\) charaters are converted to foward +** slash (/) and all upper case letters are converted to lower case. +** The drive letter (if present) is preserved. +*/ +static char *AbsolutePath(const char *z){ + Tcl_DString pwd; + char *zResult; + Tcl_DStringInit(&pwd); + if( *z!='/' +#ifdef __WIN32__ + && *z!='\\' && (!isalpha(*z) || z[1]!=':') +#endif + ){ + /* Case 1: "z" is a relative path. So prepend the current working + ** directory in order to generate an absolute path. Note that the + ** CanonicalPath() function takes care of converting upper to lower + ** case and (\) to (/) under windows. + */ + Tcl_GetCwd(0, &pwd); + zResult = CanonicalPath( Tcl_DStringValue(&pwd), z); + Tcl_DStringFree(&pwd); + } else { + /* Case 2: "z" is an absolute path already. We just need to make + ** a copy of it. Under windows, we need to convert upper to lower + ** case and (\) into (/) on the copy. + */ + zResult = (void *)Tcl_Alloc( strlen(z) + 1 ); + if( zResult==0 ) return 0; + strcpy(zResult, z); +#ifdef __WIN32__ + { + int i, c; + for(i=0; (c=zResult[i])!=0; i++){ + if( isupper(c) ) { + // zResult[i] = tolower(c); + } + else if( c=='\\' ) zResult[i] = '/'; + } } - return cnt; +#endif + } + return zResult; } - +#else /* - * Concatenate zTail onto zRoot to form a pathname. zRoot will begin with - * "/". After concatenation, simplify the pathname be removing unnecessary - * ".." and "." directories. Under windows, make all characters lower case. - * - * Resulting pathname is returned. Space to hold the returned path is - * obtained form Tcl_Alloc() and should be freed by the calling function. - */ +** Concatenate zTail onto zRoot to form a pathname. zRoot will begin +** with "/". After concatenation, simplify the pathname be removing +** unnecessary ".." and "." directories. Under windows, make all +** characters lower case. +** +** Resulting pathname is returned. Space to hold the returned path is +** obtained from Tcl_Alloc() and should be freed by the calling function. +*/ static char * CanonicalPath( const char *zRoot, @@ -317,7 +370,6 @@ CanonicalPath( zPath[j] = 0; return zPath; } - /* * Construct an absolute pathname where memory is obtained from Tcl_Alloc that * means the same file as the pathname given. @@ -346,6 +398,7 @@ AbsolutePath( Tcl_GetCwd(0, &pwd); #endif } + zResult = CanonicalPath(Tcl_DStringValue(&pwd), zRelative); done: Tcl_DStringFree(&pwd); @@ -355,136 +408,18 @@ AbsolutePath( } return zResult; } - -int -ZvfsReadTOCStart( - Tcl_Interp *interp, /* Leave error messages in this interpreter */ - Tcl_Channel chan, - ZFile **pList, - int *iStart) -{ - int nFile; /* Number of files in the archive */ - int iPos; /* Current position in the archive file */ - unsigned char zBuf[100]; /* Space into which to read from the ZIP - * archive */ - ZFile *p; - int zipStart; - - if (!chan) { - return TCL_ERROR; - } - if (Tcl_SetChannelOption(interp, chan, "-translation", - "binary") != TCL_OK){ - return TCL_ERROR; - } - if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary") != TCL_OK) { - return TCL_ERROR; - } - - /* - * Read the "End Of Central Directory" record from the end of the ZIP - * archive. - */ - - iPos = Tcl_Seek(chan, -22, SEEK_END); - Tcl_Read(chan, (char *) zBuf, 22); - if (memcmp(zBuf, "\120\113\05\06", 4)) { - /* Tcl_AppendResult(interp, "not a ZIP archive", NULL); */ - return TCL_BREAK; - } - - /* - * Compute the starting location of the directory for the ZIP archive in - * iPos then seek to that location. - */ - - zipStart = iPos; - nFile = INT16(zBuf,8); - iPos -= INT32(zBuf,12); - Tcl_Seek(chan, iPos, SEEK_SET); - - while (1) { - int lenName; /* Length of the next filename */ - int lenExtra=0; /* Length of "extra" data for next file */ - int iData; /* Offset to start of file data */ - - if (nFile-- <= 0) { - break; - } - - /* - * Read the next directory entry. Extract the size of the filename, - * the size of the "extra" information, and the offset into the - * archive file of the file data. - */ - - Tcl_Read(chan, (char *) zBuf, 46); - if (memcmp(zBuf, "\120\113\01\02", 4)) { - Tcl_AppendResult(interp, "ill-formed central directory entry", - NULL); - return TCL_ERROR; - } - lenName = INT16(zBuf,28); - lenExtra = INT16(zBuf,30) + INT16(zBuf,32); - iData = INT32(zBuf,42); - if (iData < zipStart) { - zipStart = iData; - } - - p = newZFile(lenName, pList); - if (!p) { - break; - } - - Tcl_Read(chan, p->zName, lenName); - p->zName[lenName] = 0; - if (lenName > 0 && p->zName[lenName-1] == '/') { - p->isSpecial = 1; - } - p->dosDate = INT16(zBuf, 14); - p->dosTime = INT16(zBuf, 12); - p->nByteCompr = INT32(zBuf, 20); - p->nByte = INT32(zBuf, 24); - p->nExtra = INT32(zBuf, 28); - p->iCRC = INT32(zBuf, 32); - - if (nFile < 0) { - break; - } - - /* - * Skip over the extra information so that the next read will be from - * the beginning of the next directory entry. - */ - - Tcl_Seek(chan, lenExtra, SEEK_CUR); - } - *iStart = zipStart; - return TCL_OK; -} - -int -ZvfsReadTOC( - Tcl_Interp *interp, /* Leave error messages in this interpreter */ - Tcl_Channel chan, - ZFile **pList) -{ - int iStart; - - return ZvfsReadTOCStart(interp, chan, pList, &iStart); -} +#endif /* - * Read a ZIP archive and make entries in the virutal file hash table for all - * content files of that ZIP archive. Also initialize the ZVFS if this - * routine has not been previously called. - */ -int -Tcl_Zvfs_Mount( - Tcl_Interp *interp, /* Leave error messages in this interpreter */ - const char *zArchive, /* The ZIP archive file */ - const char *zMountPoint) /* Mount contents at this directory */ -{ +** Read a ZIP archive and make entries in the virutal file hash table for all +** content files of that ZIP archive. Also initialize the ZVFS if this +** routine has not been previously called. +*/ +int Zvfs_Mount( + Tcl_Interp *interp, /* Leave error messages in this interpreter */ + const char *zArchive, /* The ZIP archive file */ + const char *zMountPoint /* Mount contents at this directory */ +) { Tcl_Channel chan; /* Used for reading the ZIP archive file */ char *zArchiveName = 0; /* A copy of zArchive */ char *zTrueName = 0; /* A copy of zMountPoint */ @@ -538,7 +473,7 @@ Tcl_Zvfs_Mount( Tcl_AppendResult(interp, pArchive->zMountPoint, 0); } } - Tcl_Free(zTrueName); + Tcl_Free((char *)zTrueName); return TCL_OK; } chan = Tcl_OpenFileChannel(interp, zArchive, "r", 0); @@ -688,7 +623,6 @@ Tcl_Zvfs_Mount( pZvfs->pNextName = 0; } else { ZvfsFile *pOld = Tcl_GetHashValue(pEntry); - pOld->pPrevName = pZvfs; pZvfs->pNextName = pOld; } @@ -715,34 +649,28 @@ Tcl_Zvfs_Mount( } /* - * Locate the ZvfsFile structure that corresponds to the file named. Return - * NULL if there is no such ZvfsFile. - */ -static ZvfsFile * -ZvfsLookup( - char *zFilename) -{ - char *zTrueName; - Tcl_HashEntry *pEntry; - ZvfsFile *pFile; - - if (local.isInit == 0) { - return 0; - } - zTrueName = AbsolutePath(zFilename); - pEntry = Tcl_FindHashEntry(&local.fileHash, zTrueName); - pFile = pEntry ? Tcl_GetHashValue(pEntry) : 0; - Tcl_Free(zTrueName); - return pFile; +** Locate the ZvfsFile structure that corresponds to the file named. +** Return NULL if there is no such ZvfsFile. +*/ +static ZvfsFile *ZvfsLookup(char *zFilename){ + char *zTrueName; + Tcl_HashEntry *pEntry; + ZvfsFile *pFile; + + if( local.isInit==0 ) return 0; + zTrueName = AbsolutePath(zFilename); + pEntry = Tcl_FindHashEntry(&local.fileHash, zTrueName); + pFile = pEntry ? Tcl_GetHashValue(pEntry) : 0; + Tcl_Free(zTrueName); + return pFile; } /* - * Unmount all the files in the given ZIP archive. - */ -int -Tcl_Zvfs_Umount( - const char *zArchive) -{ +** Unmount all the files in the given ZIP archive. +*/ +static int Zvfs_Unmount( + const char *zArchive +) { char *zArchiveName; ZvfsArchive *pArchive; ZvfsFile *pFile, *pNextFile; @@ -804,7 +732,7 @@ ZvfsMountObjCmd( " ? ZIP-FILE ? MOUNT-POINT ? ?\"", 0); return TCL_ERROR; } - return Tcl_Zvfs_Mount(interp, objc>1?Tcl_GetString(objv[1]):NULL, objc>2?Tcl_GetString(objv[2]):NULL); + return Zvfs_Mount(interp, objc>1?Tcl_GetString(objv[1]):NULL, objc>2?Tcl_GetString(objv[2]):NULL); } /* @@ -832,7 +760,7 @@ ZvfsUnmountObjCmd( return TCL_ERROR; } zFilename=Tcl_GetString(objv[1]); - if (Tcl_Zvfs_Umount(zFilename)) { + if (Zvfs_Unmount(zFilename)) { return TCL_OK; } pEntry = Tcl_FirstHashEntry(&local.archiveHash,&zSearch); @@ -840,7 +768,7 @@ ZvfsUnmountObjCmd( pArchive = Tcl_GetHashValue(pEntry); if (pArchive && pArchive->zMountPoint[0] && (strcmp(pArchive->zMountPoint, zFilename) == 0)) { - if (Tcl_Zvfs_Umount(pArchive->zName)) { + if (Zvfs_Unmount(pArchive->zName)) { return TCL_OK; } break; @@ -1004,324 +932,392 @@ ZvfsListObjCmd( } /* - * Whenever a ZVFS file is opened, an instance of this structure is attached - * to the open channel where it will be available to the ZVFS I/O routines - * below. All state information about an open ZVFS file is held in this - * structure. - */ +** Whenever a ZVFS file is opened, an instance of this structure is +** attached to the open channel where it will be available to the +** ZVFS I/O routines below. All state information about an open +** ZVFS file is held in this structure. +*/ typedef struct ZvfsChannelInfo { - unsigned int nByte; /* number of bytes of read uncompressed - * data */ - unsigned int nByteCompr; /* number of bytes of unread compressed - * data */ - unsigned int nData; /* total number of bytes of compressed data */ - int readSoFar; /* Number of bytes read so far */ - long startOfData; /* File position of start of data in ZIP - * archive */ - int isCompressed; /* True data is compressed */ - Tcl_Channel chan; /* Open to the archive file */ - unsigned char *zBuf; /* buffer used by the decompressor */ - z_stream stream; /* state of the decompressor */ + unsigned long nByte; /* number of bytes of uncompressed data */ + unsigned long nByteCompr; /* number of bytes of unread compressed data */ + unsigned long nData; /* total number of bytes of compressed data */ + unsigned long readSoFar; /* position of next byte to be read from the channel */ + long startOfData; /* File position of start of data in ZIP archive */ + Tcl_Channel chan; /* Open file handle to the archive file */ + unsigned char *zBuf; /* buffer used by the decompressor */ + unsigned char *uBuf; /* pointer to the uncompressed, unencrypted data */ + z_stream stream; /* state of the decompressor */ + int isEncrypted; /* file is encrypted */ + int isCompressed; /* True data is compressed */ } ZvfsChannelInfo; /* - * This routine is called as an exit handler. If we do not set - * ZvfsChannelInfo.chan to NULL, then Tcl_Close() will be called on that - * channel twice when Tcl_Exit runs. This will lead to a core dump. - */ -static void -vfsExit( - void *pArg) -{ - ZvfsChannelInfo *pInfo = pArg; - - pInfo->chan = 0; +** This routine is called as an exit handler. If we do not set +** ZvfsChannelInfo.chan to NULL, then Tcl_Close() will be called on +** that channel a second time when Tcl_Exit runs. This will lead to a +** core dump. +*/ +static void vfsExit(void *pArg){ + ZvfsChannelInfo *pInfo = (ZvfsChannelInfo*)pArg; + pInfo->chan = 0; } /* - * This routine is called when the ZVFS channel is closed - */ -static int -vfsClose( - ClientData instanceData, /* A ZvfsChannelInfo structure */ - Tcl_Interp *interp) /* The TCL interpreter */ -{ - ZvfsChannelInfo* pInfo = instanceData; +** This routine is called when the ZVFS channel is closed +*/ +static int vfsClose( + ClientData instanceData, /* A ZvfsChannelInfo structure */ + Tcl_Interp *interp /* The TCL interpreter */ +){ + ZvfsChannelInfo* pInfo = (ZvfsChannelInfo*)instanceData; + + if( pInfo->zBuf ){ + Tcl_Free((char *)pInfo->zBuf); + Tcl_Free((char *)pInfo->uBuf); + inflateEnd(&pInfo->stream); + } + if( pInfo->chan ){ + Tcl_Close(interp, pInfo->chan); + Tcl_DeleteExitHandler(vfsExit, pInfo); + } + Tcl_Free((char*)pInfo); + return TCL_OK; +} - if (pInfo->zBuf) { - Tcl_Free((void *) pInfo->zBuf); - inflateEnd(&pInfo->stream); - } - if (pInfo->chan) { - Tcl_Close(interp, pInfo->chan); - Tcl_DeleteExitHandler(vfsExit, pInfo); - } - Tcl_Free((void *) pInfo); - return TCL_OK; +static int vfsInput ( + ClientData instanceData, /* The channel to read from */ + char *buf, /* Buffer to fill */ + int toRead, /* Requested number of bytes */ + int *pErrorCode /* Location of error flag */ +){ /* The TCL I/O system calls this function to actually read information + * from a ZVFS file. + */ + ZvfsChannelInfo* pInfo = (ZvfsChannelInfo*) instanceData; + unsigned long nextpos; + + nextpos = pInfo->readSoFar + toRead; + if (nextpos > pInfo->nByte) { + toRead = pInfo->nByte - pInfo->readSoFar; + nextpos = pInfo->nByte; + } + if( toRead == 0 ) + return 0; + + memcpy(buf, pInfo->uBuf + pInfo->readSoFar, toRead); + + pInfo->readSoFar = nextpos; + *pErrorCode = 0; + + return toRead; } -/* - * The TCL I/O system calls this function to actually read information from a - * ZVFS file. - */ -static int -vfsInput( - ClientData instanceData, /* The channel to read from */ - char *buf, /* Buffer to fill */ - int toRead, /* Requested number of bytes */ - int *pErrorCode) /* Location of error flag */ -{ - ZvfsChannelInfo* pInfo = instanceData; - if (toRead > pInfo->nByte) { - toRead = pInfo->nByte; - } - if (toRead == 0) { - return 0; +static int vfsRead ( + ClientData instanceData, /* The channel to read from */ + char *buf, /* Buffer to fill */ + int toRead, /* Requested number of bytes */ + int *pErrorCode /* Location of error flag */ + ){ /* Read and decompress all data for the associated file into the specified buffer */ + ZvfsChannelInfo* pInfo = (ZvfsChannelInfo*) instanceData; + unsigned char encryptHdr[12]; + int C; + int temp; + int i; + int len; + char pwdbuf[20]; + + if( (unsigned long)toRead > pInfo->nByte ){ + toRead = pInfo->nByte; + } + if( toRead == 0 ){ + return 0; + } + if (pInfo->isEncrypted) { +#ifdef ZIPVFSCRYPT + + /* Make preparations to decrypt the data. */ + + /* Read and decrypt the encryption header. */ + crc_32_tab = get_crc_table(); + init_keys(getPwdKey(pwdbuf)); + len = Tcl_Read(pInfo->chan, encryptHdr, sizeof(encryptHdr)); + if (len == sizeof(encryptHdr)) { + for (i = 0; i < sizeof(encryptHdr); ++i) { + C = encryptHdr[i] ^ decrypt_byte(); + update_keys(C); + } + + } +#endif + + } + if( pInfo->isCompressed ){ + int err = Z_OK; + z_stream *stream = &pInfo->stream; + stream->next_out = buf; + stream->avail_out = toRead; + while (stream->avail_out) { + if (!stream->avail_in) { + len = pInfo->nByteCompr; + if (len > COMPR_BUF_SIZE) { + len = COMPR_BUF_SIZE; + } + len = Tcl_Read(pInfo->chan, pInfo->zBuf, len); +#ifdef ZIPVFSCRYPT + + if (pInfo->isEncrypted) { + /* Decrypt the bytes we have just read. */ + for (i = 0; i < len; ++i) { + C = pInfo->zBuf[i]; + temp = C ^ decrypt_byte(); + update_keys(temp); + pInfo->zBuf[i] = temp; + } + } +#endif + pInfo->nByteCompr -= len; + stream->next_in = pInfo->zBuf; + stream->avail_in = len; + } + err = inflate(stream, Z_NO_FLUSH); + if (err) break; } - if (pInfo->isCompressed) { - int err = Z_OK; - z_stream *stream = &pInfo->stream; - - stream->next_out = (unsigned char *) buf; - stream->avail_out = toRead; - while (stream->avail_out) { - if (!stream->avail_in) { - int len = pInfo->nByteCompr; - - if (len > COMPR_BUF_SIZE) { - len = COMPR_BUF_SIZE; + if (err == Z_STREAM_END) { + if ((stream->avail_out != 0)) { + *pErrorCode = err; /* premature end */ + return -1; + } + }else if( err ){ + *pErrorCode = err; /* some other zlib error */ + return -1; + } + }else{ + toRead = Tcl_Read(pInfo->chan, buf, toRead); +#ifdef ZIPVFSCRYPT + if (pInfo->isEncrypted) { + /* Decrypt the bytes we have just read. */ + for (i = 0; i < toRead; ++i) { + C = buf[i]; + temp = C ^ decrypt_byte(); + update_keys(temp); + buf[i] = temp; } - len = Tcl_Read(pInfo->chan, (char *) pInfo->zBuf, len); - pInfo->nByteCompr -= len; - stream->next_in = pInfo->zBuf; - stream->avail_in = len; - } - err = inflate(stream, Z_NO_FLUSH); - if (err) { - break; - } - } - if (err == Z_STREAM_END) { - if (stream->avail_out != 0) { - *pErrorCode = err; /* premature end */ - return -1; - } - }else if (err) { - *pErrorCode = err; /* some other zlib error */ - return -1; } - } else { - toRead = Tcl_Read(pInfo->chan, buf, toRead); - } - pInfo->nByte -= toRead; - pInfo->readSoFar += toRead; - *pErrorCode = 0; - return toRead; +#endif + } + pInfo->nByte = toRead; + pInfo->readSoFar = 0; + *pErrorCode = 0; + return toRead; } /* - * Write to a ZVFS file. ZVFS files are always read-only, so this routine - * always returns an error. - */ -static int -vfsOutput( - ClientData instanceData, /* The channel to write to */ - const char *buf, /* Data to be stored. */ - int toWrite, /* Number of bytes to write. */ - int *pErrorCode) /* Location of error flag. */ -{ - *pErrorCode = EINVAL; - return -1; +** Write to a ZVFS file. ZVFS files are always read-only, so this routine +** always returns an error. +*/ +static int vfsOutput( + ClientData instanceData, /* The channel to write to */ + CONST char *buf, /* Data to be stored. */ + int toWrite, /* Number of bytes to write. */ + int *pErrorCode /* Location of error flag. */ +){ + *pErrorCode = EINVAL; + return -1; } -/* - * Move the file pointer so that the next byte read will be "offset". - */ -static int -vfsSeek( - ClientData instanceData, /* The file structure */ - long offset, /* Offset to seek to */ - int mode, /* One of SEEK_CUR, SEEK_SET or SEEK_END */ - int *pErrorCode) /* Write the error code here */ -{ - ZvfsChannelInfo* pInfo = instanceData; - - switch (mode) { - case SEEK_CUR: - offset += pInfo->readSoFar; - break; - case SEEK_END: - offset += pInfo->readSoFar + pInfo->nByte; - break; - default: - /* Do nothing */ - break; +static int vfsSeek( + ClientData instanceData, /* The file structure */ + long offset, /* Offset to seek to */ + int mode, /* One of SEEK_CUR, SEEK_SET or SEEK_END */ + int *pErrorCode /* Write the error code here */ +){ /* Move the file pointer so that the next byte read will be "offset". */ + + ZvfsChannelInfo* pInfo = (ZvfsChannelInfo*) instanceData; + + switch( mode ){ + case SEEK_CUR: { + offset += pInfo->readSoFar; + break; } - if (offset < 0) { - offset = 0; + case SEEK_END: { + offset += pInfo->nByte - 1; + break; } - if (!pInfo->isCompressed) { - Tcl_Seek(pInfo->chan, offset + pInfo->startOfData, SEEK_SET); - pInfo->nByte = pInfo->nData; - pInfo->readSoFar = offset; - } else { - if (offset < pInfo->readSoFar) { - z_stream *stream = &pInfo->stream; - - inflateEnd(stream); - stream->zalloc = (alloc_func)0; - stream->zfree = (free_func)0; - stream->opaque = (voidpf)0; - stream->avail_in = 2; - stream->next_in = pInfo->zBuf; - pInfo->zBuf[0] = 0x78; - pInfo->zBuf[1] = 0x01; - inflateInit(&pInfo->stream); - Tcl_Seek(pInfo->chan, pInfo->startOfData, SEEK_SET); - pInfo->nByte += pInfo->readSoFar; - pInfo->nByteCompr = pInfo->nData; - pInfo->readSoFar = 0; - } - while (pInfo->readSoFar < offset) { - int toRead, errCode; - char zDiscard[100]; - - toRead = offset - pInfo->readSoFar; - if (toRead > sizeof(zDiscard)) { - toRead = sizeof(zDiscard); - } - vfsInput(instanceData, zDiscard, toRead, &errCode); - } + default: { + /* Do nothing */ + break; } - return pInfo->readSoFar; + } +/* Don't seek past end of data */ +if (pInfo->nByte < (unsigned long)offset) + return -1; + +/* Don't seek before the start of data */ +if (offset < 0) + return -1; + +pInfo->readSoFar = (unsigned long)offset; +return pInfo->readSoFar; } /* - * Handle events on the channel. ZVFS files do not generate events, so this - * is a no-op. - */ -static void -vfsWatchChannel( - ClientData instanceData, /* Channel to watch */ - int mask) /* Events of interest */ -{ - return; +** Handle events on the channel. ZVFS files do not generate events, +** so this is a no-op. +*/ +static void vfsWatchChannel( + ClientData instanceData, /* Channel to watch */ + int mask /* Events of interest */ +){ + return; } /* - * Called to retrieve the underlying file handle for this ZVFS file. As the - * ZVFS file has no underlying file handle, this is a no-op. - */ -static int -vfsGetFile( - ClientData instanceData, /* Channel to query */ - int direction, /* Direction of interest */ - ClientData* handlePtr) /* Space to the handle into */ -{ - return TCL_ERROR; +** Called to retrieve the underlying file handle for this ZVFS file. +** As the ZVFS file has no underlying file handle, this is a no-op. +*/ +static int vfsGetFile( + ClientData instanceData, /* Channel to query */ + int direction, /* Direction of interest */ + ClientData* handlePtr /* Space to the handle into */ +){ + return TCL_ERROR; } /* - * This structure describes the channel type structure for access to the ZVFS. - */ +** This structure describes the channel type structure for +** access to the ZVFS. +*/ static Tcl_ChannelType vfsChannelType = { - "vfs", /* Type name. */ - NULL, /* Set blocking/nonblocking behaviour. - * NULL'able */ - vfsClose, /* Close channel, clean instance data */ - vfsInput, /* Handle read request */ - vfsOutput, /* Handle write request */ - vfsSeek, /* Move location of access point. NULL'able */ - NULL, /* Set options. NULL'able */ - NULL, /* Get options. NULL'able */ - vfsWatchChannel, /* Initialize notifier */ - vfsGetFile /* Get OS handle from the channel. */ + "vfs", /* Type name. */ + NULL, /* Set blocking/nonblocking behaviour. NULL'able */ + vfsClose, /* Close channel, clean instance data */ + vfsInput, /* Handle read request */ + vfsOutput, /* Handle write request */ + vfsSeek, /* Move location of access point. NULL'able */ + NULL, /* Set options. NULL'able */ + NULL, /* Get options. NULL'able */ + vfsWatchChannel, /* Initialize notifier */ + vfsGetFile /* Get OS handle from the channel. */ }; /* - * This routine attempts to do an open of a file. Check to see if the file is - * located in the ZVFS. If so, then open a channel for reading the file. If - * not, return NULL. - */ -static Tcl_Channel -ZvfsFileOpen( - Tcl_Interp *interp, /* The TCL interpreter doing the open */ - char *zFilename, /* Name of the file to open */ - char *modeString, /* Mode string for the open (ignored) */ - int permissions) /* Permissions for a newly created file - * (ignored). */ -{ - ZvfsFile *pFile; - ZvfsChannelInfo *pInfo; - Tcl_Channel chan; - static int count = 1; - char zName[50]; - unsigned char zBuf[50]; - - pFile = ZvfsLookup(zFilename); - if (pFile == 0) { - return NULL; - } - openarch = 1; - chan = Tcl_OpenFileChannel(interp, pFile->pArchive->zName, "r", 0); - openarch = 0; - if (chan == 0) { - return 0; - } - if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") - || Tcl_SetChannelOption(interp, chan, "-encoding", "binary")){ - /* this should never happen */ - Tcl_Close(0, chan); - return 0; - } - Tcl_Seek(chan, pFile->iOffset, SEEK_SET); - Tcl_Read(chan, (char *) zBuf, 30); - if (memcmp(zBuf, "\120\113\03\04", 4)) { - if (interp) { - Tcl_AppendResult(interp, "local header mismatch: ", NULL); - } - Tcl_Close(interp, chan); - return 0; - } - pInfo = (void *) Tcl_Alloc(sizeof(*pInfo)); - pInfo->chan = chan; - Tcl_CreateExitHandler(vfsExit, pInfo); - pInfo->isCompressed = INT16(zBuf, 8); - if (pInfo->isCompressed) { - z_stream *stream = &pInfo->stream; - - pInfo->zBuf = (void *) Tcl_Alloc(COMPR_BUF_SIZE); - stream->zalloc = NULL; - stream->zfree = NULL; - stream->opaque = NULL; - stream->avail_in = 2; - stream->next_in = pInfo->zBuf; - pInfo->zBuf[0] = 0x78; - pInfo->zBuf[1] = 0x01; - inflateInit(&pInfo->stream); - } else { - pInfo->zBuf = 0; +** This routine attempts to do an open of a file. Check to see +** if the file is located in the ZVFS. If so, then open a channel +** for reading the file. If not, return NULL. +*/ +static Tcl_Channel ZvfsFileOpen( + Tcl_Interp *interp, /* The TCL interpreter doing the open */ + char *zFilename, /* Name of the file to open */ + char *modeString, /* Mode string for the open (ignored) */ + int permissions /* Permissions for a newly created file (ignored) */ +){ + ZvfsFile *pFile; + ZvfsChannelInfo *pInfo; + Tcl_Channel chan; + static int count = 1; + char zName[50]; + unsigned char zBuf[50]; + int errCode; + + pFile = ZvfsLookup(zFilename); + if( pFile==0 ) { + return NULL; + } + openarch = 1; + chan = Tcl_OpenFileChannel(interp, pFile->pArchive->zName, "r", 0); + openarch = 0; + + if (local.firstMount == NULL) { + local.firstMount = pFile->pArchive->zName; + } + if( chan==0 ){ + return 0; + } + if( Tcl_SetChannelOption(interp, chan, "-translation", "binary") + || Tcl_SetChannelOption(interp, chan, "-encoding", "binary") + ){ + /* this should never happen */ + Tcl_Close(0, chan); + return 0; + } + Tcl_Seek(chan, pFile->iOffset, SEEK_SET); + Tcl_Read(chan, zBuf, 30); + if( memcmp(zBuf, "\120\113\03\04", 4) ){ + if( interp ){ + Tcl_AppendResult(interp, "local header mismatch: ", NULL); } - pInfo->nByte = INT32(zBuf, 22); - pInfo->nByteCompr = pInfo->nData = INT32(zBuf, 18); + Tcl_Close(interp, chan); + return 0; + } + pInfo = (ZvfsChannelInfo*)Tcl_Alloc( sizeof(*pInfo) ); + pInfo->chan = chan; + Tcl_CreateExitHandler(vfsExit, pInfo); +#ifdef ZIPVFSCRYPT + pInfo->isEncrypted = zBuf[6] & 1; + if (pFile->pArchive->zName == local.firstMount) { + /* FreeWrap specific. + We are opening a file from the executable. + All such files must be encrypted. + */ + if (!pInfo->isEncrypted) { + /* The file is not encrypted. + Someone must have tampered with the application. + Let's exit the program. + */ + printf("This application has an unauthorized modification. Exiting immediately\n"); + exit(-10); + } + } +#endif + pInfo->isCompressed = INT16(zBuf, 8); + if (pInfo->isCompressed ){ + z_stream *stream = &pInfo->stream; + pInfo->zBuf = (void *)Tcl_Alloc(COMPR_BUF_SIZE); + stream->zalloc = (alloc_func)0; + stream->zfree = (free_func)0; + stream->opaque = (voidpf)0; + stream->avail_in = 2; + stream->next_in = pInfo->zBuf; + pInfo->zBuf[0] = 0x78; + pInfo->zBuf[1] = 0x01; + inflateInit(&pInfo->stream); + } else { + pInfo->zBuf = 0; + } + pInfo->nByte = INT32(zBuf,22); + pInfo->nByteCompr = pInfo->nData = INT32(zBuf,18); + pInfo->readSoFar = 0; + Tcl_Seek(chan, INT16(zBuf,26)+INT16(zBuf,28), SEEK_CUR); + pInfo->startOfData = Tcl_Tell(chan); + sprintf(zName,"vfs_%x_%x",((int)pFile)>>12,count++); + chan = Tcl_CreateChannel(&vfsChannelType, zName, + (ClientData)pInfo, TCL_READABLE); + + pInfo->uBuf = (void *)Tcl_Alloc(pInfo->nByte); + /* Read and decompress the file contents */ + if (pInfo->uBuf) { + pInfo->uBuf[0] = 0; + vfsRead(pInfo, pInfo->uBuf, pInfo->nByte, &errCode); pInfo->readSoFar = 0; - Tcl_Seek(chan, INT16(zBuf, 26) + INT16(zBuf, 28), SEEK_CUR); - pInfo->startOfData = Tcl_Tell(chan); - sprintf(zName, "zvfs_%x",count++); - chan = Tcl_CreateChannel(&vfsChannelType, zName, pInfo, TCL_READABLE); - return chan; + } + + return chan; +} + +Tcl_Channel Tobe_FSOpenFileChannelProc + _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr, + int mode, int permissions)) { + int len; + /* if (mode != O_RDONLY) return NULL; */ + return ZvfsFileOpen(interp, Tcl_GetStringFromObj(pathPtr,&len), 0, + permissions); } /* - * This routine does a stat() system call for a ZVFS file. - */ -static int -Tobe_FSStatProc( - Tcl_Obj *pathObj, - Tcl_StatBuf *buf) -{ - char *path=Tcl_GetString(pathObj); +** This routine does a stat() system call for a ZVFS file. +*/ +int Tobe_FSStatProc _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *buf)) { + char *path=Tcl_GetString(pathPtr); ZvfsFile *pFile; pFile = ZvfsLookup(path); @@ -1343,13 +1339,10 @@ Tobe_FSStatProc( } /* - * This routine does an access() system call for a ZVFS file. - */ -static int -Tobe_FSAccessProc( - Tcl_Obj *pathPtr, - int mode) -{ +** This routine does an access() system call for a ZVFS file. +*/ +int Tobe_FSAccessProc _ANSI_ARGS_((Tcl_Obj *pathPtr, int mode)) { + int len; char *path=Tcl_GetString(pathPtr); ZvfsFile *pFile; @@ -1360,116 +1353,139 @@ Tobe_FSAccessProc( if (pFile == 0) { return -1; } - return 0; -} - -Tcl_Channel -Tobe_FSOpenFileChannelProc( - Tcl_Interp *interp, - Tcl_Obj *pathPtr, - int mode, - int permissions) -{ - static int inopen=0; - Tcl_Channel chan; - - if (inopen) { - puts("recursive zvfs open"); - return NULL; - } - inopen = 1; - /* if (mode != O_RDONLY) return NULL; */ - chan = ZvfsFileOpen(interp, Tcl_GetString(pathPtr), 0, permissions); - inopen = 0; - return chan; + return 0; } Tcl_Obj* Tobe_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr) { return Tcl_NewStringObj("/",-1);; } -/* - * Function to process a 'Tobe_FSMatchInDirectory()'. If not implemented, - * then glob and recursive copy functionality will be lacking in the - * filesystem. - */ -int -Tobe_FSMatchInDirectoryProc( +/* Function to process a +* 'Tobe_FSMatchInDirectory()'. If not +* implemented, then glob and recursive +* copy functionality will be lacking in +* the filesystem. */ +int Tobe_FSMatchInDirectoryProc ( Tcl_Interp* interp, Tcl_Obj *result, Tcl_Obj *pathPtr, const char *pattern, - Tcl_GlobTypeData * types) -{ + Tcl_GlobTypeData * types +) { Tcl_HashEntry *pEntry; Tcl_HashSearch sSearch; - int scnt, len, l, dirglob, dirmnt; - char *zPattern = NULL, *zp=Tcl_GetStringFromObj(pathPtr,&len); - - if (!zp) { - return TCL_ERROR; + int scnt=0, pathlen=0, patternlen=0, dirglob=0, fileglob=0, mntglob=0; + int nullpattern=(pattern == NULL || (*pattern=='\0')); + char *zPattern = NULL; + char *zp=NULL; + + if(types && types->type) { + dirglob = (types->type&TCL_GLOB_TYPE_DIR); + fileglob = (types->type & TCL_GLOB_TYPE_FILE); + mntglob = (types->type&TCL_GLOB_TYPE_MOUNT); } - if (pattern != NULL) { - l = strlen(pattern); - if (!zp) { - zPattern = Tcl_Alloc(len + 1); - memcpy(zPattern, pattern, len + 1); - } else { - zPattern = Tcl_Alloc(len + l + 3); - sprintf(zPattern, "%s%s%s", zp, zp[len-1]=='/'?"":"/", pattern); - } - scnt = strchrcnt(zPattern, '/'); + if(!nullpattern) { + patternlen=strlen(pattern); } - dirglob = (types && types->type && (types->type&TCL_GLOB_TYPE_DIR)); - dirmnt = (types && types->type && (types->type&TCL_GLOB_TYPE_MOUNT)); - if (strcmp(zp, "/") == 0 && strcmp(zPattern, ".*") == 0) { - /*TODO: What goes here?*/ + if(pathPtr) { + zp=Tcl_GetStringFromObj(pathPtr,&pathlen); +#ifdef __WIN32__ + if (isalpha(zp[0]) && zp[1]==':') { + zp+=2; + } +#endif } - for (pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); - pEntry; pEntry = Tcl_NextHashEntry(&sSearch)){ - ZvfsFile *pFile = Tcl_GetHashValue(pEntry); - char *z = pFile->zName; - - if (zPattern != NULL) { - if (Tcl_StringCaseMatch(z, zPattern, 0) == 0 || - (scnt != pFile->depth /* && !dirglob */)) { // TODO: ??? - continue; - } - } else { - if (strcmp(zp, z)) { - continue; - } - } - if (dirmnt) { - if (pFile->isdir != 1) { - continue; - } - } else if (dirglob) { - if (!pFile->isdir) { - continue; - } - } else if (types && !(types->type & TCL_GLOB_TYPE_DIR)) { - if (pFile->isdir) { - continue; - } - } - Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(z, -1)); + if(mntglob) { return TCL_OK; } + if (mntglob) { + /* Look for a directory mount */ + Tcl_HashEntry *pEntry; /* Hash table entry */ + Tcl_HashSearch zSearch; /* Search all mount points */ + ZvfsArchive *pArchive; /* The ZIP archive being mounted */ + Tcl_Obj *pVols=0, *pVol; + char mountpt[200]; + int i=1; + mountpt[0]='/'; + if(pathPtr) { + for(i=1;izMountPoint; + Tcl_Obj *pTail=NULL; + int match=0; + match=(strcmp(mountpt, z)==0); + if(!match) continue; + pTail=Tcl_NewStringObj(z, -1); + Tcl_ListObjAppendElement(interp, result, pTail); + //Tcl_DecrRefCount(pTail); + } + } + } else { + int idx=0; + if(!zp && nullpattern) { + zPattern=NULL; + } else { + Tcl_DString dTempPath; + Tcl_DStringInit(&dTempPath); + zPattern=(char*)Tcl_Alloc(pathlen+patternlen+3); + memset(zPattern,0,pathlen+patternlen+3); + if(zp) { + Tcl_DStringAppend(&dTempPath,zp,-1); + } + if (zp && !nullpattern) { + if (pathlen > 1 || zPattern[0] != '/') { + Tcl_DStringAppend(&dTempPath,"/",-1); + idx++; + } + } + if (!nullpattern) { + Tcl_DStringAppend(&dTempPath,pattern,patternlen); + } + zPattern=strdup(Tcl_DStringValue(&dTempPath)); + Tcl_DStringFree(&dTempPath); + scnt = strchrcnt(zPattern, '/'); + } + for ( + pEntry = Tcl_FirstHashEntry(&local.fileHash, &sSearch); + pEntry; + pEntry = Tcl_NextHashEntry(&sSearch) + ){ + ZvfsFile *pFile = Tcl_GetHashValue(pEntry); + if(pFile) { + char *z = pFile->zName; + Tcl_Obj *pTail=NULL; + int match=0; + if (dirglob && !pFile->isdir) continue; + if (fileglob && pFile->isdir) continue; + if(scnt != pFile->depth) continue; + match=Tcl_StringCaseMatch(z, zPattern, 0); + if(!match) continue; + pTail=Tcl_NewStringObj(z, -1); + Tcl_ListObjAppendElement(interp, result, pTail); + } + } } +done: if (zPattern) { - Tcl_Free(zPattern); + free(zPattern); } return TCL_OK; } -/* - * Function to check whether a path is in this filesystem. This is the most - * important filesystem procedure. - */ -int -Tobe_FSPathInFilesystemProc( - Tcl_Obj *pathPtr, - ClientData *clientDataPtr) -{ +/* Function to check whether a path is in +* this filesystem. This is the most +* important filesystem procedure. */ +int Tobe_FSPathInFilesystemProc _ANSI_ARGS_((Tcl_Obj *pathPtr, + ClientData *clientDataPtr)) { ZvfsFile *zFile; char *path = Tcl_GetString(pathPtr); @@ -1483,30 +1499,37 @@ Tobe_FSPathInFilesystemProc( return -1; } -Tcl_Obj * -Tobe_FSListVolumesProc(void) -{ - Tcl_HashEntry *pEntry; /* Hash table entry */ - Tcl_HashSearch zSearch; /* Search all mount points */ - ZvfsArchive *pArchive; /* The ZIP archive being mounted */ - Tcl_Obj *pVols = NULL, *pVol; - - pEntry = Tcl_FirstHashEntry(&local.archiveHash,&zSearch); +Tcl_Obj *Tobe_FSListVolumesProc _ANSI_ARGS_((void)) { + Tcl_HashEntry *pEntry; /* Hash table entry */ + Tcl_HashSearch zSearch; /* Search all mount points */ + ZvfsArchive *pArchive; /* The ZIP archive being mounted */ + Tcl_Obj *pVols=0, *pVol; + char mountpt[200]; + + pEntry=Tcl_FirstHashEntry(&local.archiveHash,&zSearch); while (pEntry) { pArchive = Tcl_GetHashValue(pEntry); if (pArchive) { if (!pVols) { - pVols = Tcl_NewListObj(0, 0); + pVols=Tcl_NewListObj(0,0); Tcl_IncrRefCount(pVols); } - pVol = Tcl_NewStringObj(pArchive->zMountPoint, -1); - Tcl_ListObjAppendElement(NULL, pVols, pVol); + sprintf(mountpt, "zvfs:%s", pArchive->zMountPoint); + pVol=Tcl_NewStringObj(mountpt,-1); + Tcl_IncrRefCount(pVol); + Tcl_ListObjAppendElement(NULL, pVols,pVol); + /* Tcl_AppendResult(interp,pArchive->zMountPoint," ",pArchive->zName," ",0);*/ } - pEntry = Tcl_NextHashEntry(&zSearch); + pEntry=Tcl_NextHashEntry(&zSearch); } return pVols; } +int Tobe_FSChdirProc _ANSI_ARGS_((Tcl_Obj *pathPtr)) { + /* Someday, we should actually check if this is a valid path. */ + return TCL_OK; +} + const char * const* Tobe_FSFileAttrStringsProc( Tcl_Obj *pathPtr, @@ -1515,11 +1538,11 @@ Tobe_FSFileAttrStringsProc( char *path = Tcl_GetString(pathPtr); #ifdef __WIN32__ static const char *attrs[] = { - "-archive", "-hidden", "-readonly", "-system", "-shortname", 0 + "uncompsize", "compsize", "offset", "mount", "archive","-archive", "-hidden", "-readonly", "-system", "-shortname", 0 }; #else static const char *attrs[] = { - "-group", "-owner", "-permissions", 0 + "uncompsize", "compsize", "offset", "mount", "archive","-group", "-owner", "-permissions", 0 }; #endif if (ZvfsLookup(path) == 0) { @@ -1528,1090 +1551,286 @@ Tobe_FSFileAttrStringsProc( return attrs; } -int -Tobe_FSFileAttrsGetProc( - Tcl_Interp *interp, - int index, - Tcl_Obj *pathPtr, - Tcl_Obj **objPtrRef) -{ - char *path = Tcl_GetString(pathPtr); -#ifndef __WIN32__ - char buf[50]; -#endif - ZvfsFile *zFile = ZvfsLookup(path); - - if (zFile == 0) { +int Tobe_FSFileAttrsGetProc _ANSI_ARGS_((Tcl_Interp *interp, + int index, Tcl_Obj *pathPtr, + Tcl_Obj **objPtrRef)) { + char *zFilename; + ZvfsFile *pFile; + zFilename = Tcl_GetString(pathPtr); + pFile = ZvfsLookup(zFilename); + if(!pFile) return TCL_ERROR; - } - - switch (index) { + switch (index) { + case 0: + *objPtrRef=Tcl_NewIntObj(pFile->nByteCompr); + return TCL_OK; + case 1: + *objPtrRef= Tcl_NewIntObj(pFile->nByte); + return TCL_OK; + case 2: + *objPtrRef= Tcl_NewIntObj(pFile->nByte); + return TCL_OK; + case 3: + *objPtrRef= Tcl_NewStringObj(pFile->pArchive->zMountPoint,-1); + return TCL_OK; + case 4: + *objPtrRef= Tcl_NewStringObj(pFile->pArchive->zName,-1); + return TCL_OK; #ifdef __WIN32__ - case 0: /* -archive */ + case 5: /* -archive */ *objPtrRef = Tcl_NewStringObj("0", -1); break; - case 1: /* -hidden */ + case 6: /* -hidden */ *objPtrRef = Tcl_NewStringObj("0", -1); break; - case 2: /* -readonly */ + case 7: /* -readonly */ *objPtrRef = Tcl_NewStringObj("", -1); break; - case 3: /* -system */ + case 8: /* -system */ *objPtrRef = Tcl_NewStringObj("", -1); break; - case 4: /* -shortname */ + case 9: /* -shortname */ *objPtrRef = Tcl_NewStringObj("", -1); #else - case 0: /* -group */ + case 5: /* -group */ *objPtrRef = Tcl_NewStringObj("", -1); break; - case 1: /* -owner */ + case 6: /* -owner */ *objPtrRef = Tcl_NewStringObj("", -1); break; - case 2: /* -permissions */ - sprintf(buf, "%03o", zFile->permissions); - *objPtrRef = Tcl_NewStringObj(buf, -1); break; -#endif + case 7: /* -permissions */ { + char buf[32]; + sprintf(buf, "%03o", pFile->permissions); + *objPtrRef = Tcl_NewStringObj(buf, -1); break; } +#endif + default: + return TCL_ERROR; + } + return TCL_OK; +} +int Tobe_FSFileAttrsSetProc _ANSI_ARGS_((Tcl_Interp *interp, + int index, Tcl_Obj *pathPtr, + Tcl_Obj *objPtr)) { return TCL_ERROR; } - return TCL_OK; +Tcl_Obj* Tobe_FSFilesystemPathTypeProc + _ANSI_ARGS_((Tcl_Obj *pathPtr)) { + return Tcl_NewStringObj("zip",-1); } /****************************************************/ -/* - * Function to unload a previously successfully loaded file. If load was - * implemented, then this should also be implemented, if there is any cleanup - * action required. - */ -/* We have to declare the utime structure here. */ -int Tobe_FSUtimeProc(Tcl_Obj *pathPtr, struct utimbuf *tval) { return 0; } -int Tobe_FSFileAttrsSetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, - Tcl_Obj *objPtr) { return 0; } - static Tcl_Filesystem Tobe_Filesystem = { - "tobe", /* The name of the filesystem. */ - sizeof(Tcl_Filesystem), /* Length of this structure, so future binary - * compatibility can be assured. */ - TCL_FILESYSTEM_VERSION_1, /* Version of the filesystem type. */ - Tobe_FSPathInFilesystemProc,/* Function to check whether a path is in this - * filesystem. This is the most important - * filesystem procedure. */ - NULL, /* Function to duplicate internal fs rep. May - * be NULL (but then fs is less efficient). */ - NULL, /* Function to free internal fs rep. Must be - * implemented, if internal representations - * need freeing, otherwise it can be NULL. */ + "zvfs", /* The name of the filesystem. */ + sizeof(Tcl_Filesystem), /* Length of this structure, so future + * binary compatibility can be assured. */ + TCL_FILESYSTEM_VERSION_1, + /* Version of the filesystem type. */ + Tobe_FSPathInFilesystemProc, + /* Function to check whether a path is in + * this filesystem. This is the most + * important filesystem procedure. */ + NULL, + /* Function to duplicate internal fs rep. May + * be NULL (but then fs is less efficient). */ + NULL, + /* Function to free internal fs rep. Must + * be implemented, if internal representations + * need freeing, otherwise it can be NULL. */ NULL, - /* Function to convert internal representation - * to a normalized path. Only required if the - * fs creates pure path objects with no - * string/path representation. */ + /* Function to convert internal representation + * to a normalized path. Only required if + * the fs creates pure path objects with no + * string/path representation. */ NULL, - /* Function to create a filesystem-specific - * internal representation. May be NULL if - * paths have no internal representation, or - * if the Tobe_FSPathInFilesystemProc for this - * filesystem always immediately creates an - * internal representation for paths it - * accepts. */ - NULL, /* Function to normalize a path. Should be - * implemented for all filesystems which can - * have multiple string representations for - * the same path object. */ + /* Function to create a filesystem-specific + * internal representation. May be NULL + * if paths have no internal representation, + * or if the Tobe_FSPathInFilesystemProc + * for this filesystem always immediately + * creates an internal representation for + * paths it accepts. */ NULL, - /* Function to determine the type of a path in - * this filesystem. May be NULL. */ + /* Tobe_FSNormalizePathProc (Not needed) + * Function to normalize a path. Should + * be implemented for all filesystems + * which can have multiple string + * representations for the same path + * object. */ + Tobe_FSFilesystemPathTypeProc, + /* Function to determine the type of a + * path in this filesystem. May be NULL. */ Tobe_FSFilesystemSeparatorProc, - /* Function to return the separator - * character(s) for this filesystem. Must be - * implemented. */ - Tobe_FSStatProc, /* Function to process a 'Tobe_FSStat()' call. - * Must be implemented for any reasonable - * filesystem. */ - Tobe_FSAccessProc, /* Function to process a 'Tobe_FSAccess()' - * call. Must be implemented for any - * reasonable filesystem. */ - Tobe_FSOpenFileChannelProc, /* Function to process a - * 'Tobe_FSOpenFileChannel()' call. Must be - * implemented for any reasonable - * filesystem. */ - Tobe_FSMatchInDirectoryProc,/* Function to process a - * 'Tobe_FSMatchInDirectory()'. If not - * implemented, then glob and recursive copy - * functionality will be lacking in the - * filesystem. */ - Tobe_FSUtimeProc, /* Function to process a 'Tobe_FSUtime()' - * call. Required to allow setting (not - * reading) of times with 'file mtime', 'file - * atime' and the open-r/open-w/fcopy - * implementation of 'file copy'. */ - NULL, /* Function to process a 'Tobe_FSLink()' call. - * Should be implemented only if the - * filesystem supports links. */ - Tobe_FSListVolumesProc, /* Function to list any filesystem volumes - * added by this filesystem. Should be - * implemented only if the filesystem adds - * volumes at the head of the filesystem. */ - Tobe_FSFileAttrStringsProc, /* Function to list all attributes strings - * which are valid for this filesystem. If - * not implemented the filesystem will not - * support the 'file attributes' command. - * This allows arbitrary additional - * information to be attached to files in the - * filesystem. */ - Tobe_FSFileAttrsGetProc, /* Function to process a - * 'Tobe_FSFileAttrsGet()' call, used by 'file - * attributes'. */ - Tobe_FSFileAttrsSetProc, /* Function to process a - * 'Tobe_FSFileAttrsSet()' call, used by 'file - * attributes'. */ - NULL, /* Function to process a - * 'Tobe_FSCreateDirectory()' call. Should be - * implemented unless the FS is read-only. */ - NULL, /* Function to process a - * 'Tobe_FSRemoveDirectory()' call. Should be - * implemented unless the FS is read-only. */ - NULL, /* Function to process a 'Tobe_FSDeleteFile()' - * call. Should be implemented unless the FS - * is read-only. */ - NULL, /* Function to process a 'Tobe_FSCopyFile()' - * call. If not implemented Tcl will fall - * back on open-r, open-w and fcopy as a - * copying mechanism. */ - NULL, /* Function to process a 'Tobe_FSRenameFile()' - * call. If not implemented, Tcl will fall - * back on a copy and delete mechanism. */ - NULL, /* Function to process a - * 'Tobe_FSCopyDirectory()' call. If not - * implemented, Tcl will fall back on a - * recursive create-dir, file copy - * mechanism. */ - NULL, /* Function to process a 'Tobe_FSLoadFile()' - * call. If not implemented, Tcl will fall - * back on a copy to native-temp followed by a - * Tobe_FSLoadFile on that temporary copy. */ - NULL, /* Function to unload a previously - * successfully loaded file. If load was - * implemented, then this should also be - * implemented, if there is any cleanup action - * required. */ - NULL, /* Function to process a 'Tobe_FSGetCwd()' - * call. Most filesystems need not implement - * this. It will usually only be called once, - * if 'getcwd' is called before 'chdir'. May - * be NULL. */ - NULL, /* Function to process a 'Tobe_FSChdir()' - * call. If filesystems do not implement this, - * it will be emulated by a series of - * directory access checks. Otherwise, virtual - * filesystems which do implement it need only - * respond with a positive return result if - * the dirName is a valid directory in their - * filesystem. They need not remember the - * result, since that will be automatically - * remembered for use by GetCwd. Real - * filesystems should carry out the correct - * action (i.e. call the correct system - * 'chdir' api). If not implemented, then 'cd' - * and 'pwd' will fail inside the - * filesystem. */ + /* Function to return the separator + * character(s) for this filesystem. Must + * be implemented. */ + Tobe_FSStatProc, + /* + * Function to process a 'Tobe_FSStat()' + * call. Must be implemented for any + * reasonable filesystem. + */ + Tobe_FSAccessProc, + /* + * Function to process a 'Tobe_FSAccess()' + * call. Must be implemented for any + * reasonable filesystem. + */ + Tobe_FSOpenFileChannelProc, + /* + * Function to process a + * 'Tobe_FSOpenFileChannel()' call. Must be + * implemented for any reasonable + * filesystem. + */ + Tobe_FSMatchInDirectoryProc, + /* Function to process a + * 'Tobe_FSMatchInDirectory()'. If not + * implemented, then glob and recursive + * copy functionality will be lacking in + * the filesystem. */ + NULL, + /* Function to process a + * 'Tobe_FSUtime()' call. Required to + * allow setting (not reading) of times + * with 'file mtime', 'file atime' and + * the open-r/open-w/fcopy implementation + * of 'file copy'. */ + NULL, + /* Function to process a + * 'Tobe_FSLink()' call. Should be + * implemented only if the filesystem supports + * links. */ + Tobe_FSListVolumesProc, + /* Function to list any filesystem volumes + * added by this filesystem. Should be + * implemented only if the filesystem adds + * volumes at the head of the filesystem. */ + Tobe_FSFileAttrStringsProc, + /* Function to list all attributes strings + * which are valid for this filesystem. + * If not implemented the filesystem will + * not support the 'file attributes' command. + * This allows arbitrary additional information + * to be attached to files in the filesystem. */ + Tobe_FSFileAttrsGetProc, + /* Function to process a + * 'Tobe_FSFileAttrsGet()' call, used by + * 'file attributes'. */ + Tobe_FSFileAttrsSetProc, + /* Function to process a + * 'Tobe_FSFileAttrsSet()' call, used by + * 'file attributes'. */ + NULL, + /* Function to process a + * 'Tobe_FSCreateDirectory()' call. Should + * be implemented unless the FS is + * read-only. */ + NULL, + /* Function to process a + * 'Tobe_FSRemoveDirectory()' call. Should + * be implemented unless the FS is + * read-only. */ + NULL, + /* Function to process a + * 'Tobe_FSDeleteFile()' call. Should + * be implemented unless the FS is + * read-only. */ + NULL, + /* Function to process a + * 'Tobe_FSCopyFile()' call. If not + * implemented Tcl will fall back + * on open-r, open-w and fcopy as + * a copying mechanism. */ + NULL, + /* Function to process a + * 'Tobe_FSRenameFile()' call. If not + * implemented, Tcl will fall back on + * a copy and delete mechanism. */ + NULL, + /* Function to process a + * 'Tobe_FSCopyDirectory()' call. If + * not implemented, Tcl will fall back + * on a recursive create-dir, file copy + * mechanism. */ + NULL, + /* Function to process a + * 'Tobe_FSLoadFile()' call. If not + * implemented, Tcl will fall back on + * a copy to native-temp followed by a + * Tobe_FSLoadFile on that temporary copy. */ + NULL, + /* Function to unload a previously + * successfully loaded file. If load was + * implemented, then this should also be + * implemented, if there is any cleanup + * action required. */ + NULL, + /* + * Function to process a 'Tobe_FSGetCwd()' + * call. Most filesystems need not + * implement this. It will usually only be + * called once, if 'getcwd' is called + * before 'chdir'. May be NULL. + */ + NULL, + /* + * Function to process a 'Tobe_FSChdir()' + * call. If filesystems do not implement + * this, it will be emulated by a series of + * directory access checks. Otherwise, + * virtual filesystems which do implement + * it need only respond with a positive + * return result if the dirName is a valid + * directory in their filesystem. They + * need not remember the result, since that + * will be automatically remembered for use + * by GetCwd. Real filesystems should + * carry out the correct action (i.e. call + * the correct system 'chdir' api). If not + * implemented, then 'cd' and 'pwd' will + * fail inside the filesystem. + */ }; -////////////////////////////////////////////////////////////// - -void (*Zvfs_PostInit)(Tcl_Interp *) = 0; -static int ZvfsAppendObjCmd(void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); -static int ZvfsAddObjCmd(void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); -static int ZvfsDumpObjCmd(void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); -static int ZvfsStartObjCmd(void *NotUsed, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv); +void (*Zvfs_PostInit)(Tcl_Interp *)=0; -static int Zvfs_Common_Init(Tcl_Interp *interp) { - if (local.isInit) return TCL_OK; - /* One-time initialization of the ZVFS */ - if(Tcl_FSRegister(interp, &Tobe_Filesystem)) { - return TCL_ERROR; +int Zvfs_Common_Init(Tcl_Interp *interp) { + if( !local.isInit ){ + /* One-time initialization of the ZVFS */ + Tcl_FSRegister(0, &Tobe_Filesystem); + Tcl_InitHashTable(&local.fileHash, TCL_STRING_KEYS); + Tcl_InitHashTable(&local.archiveHash, TCL_STRING_KEYS); + local.isInit = 1; } - Tcl_InitHashTable(&local.fileHash, TCL_STRING_KEYS); - Tcl_InitHashTable(&local.archiveHash, TCL_STRING_KEYS); - local.isInit = 1; return TCL_OK; } -/* - * Initialize the ZVFS system. - */ -int -Zvfs_doInit( - Tcl_Interp *interp, - int safe) -{ +int Zvfs_Init(Tcl_Interp *interp){ + int n; #ifdef USE_TCL_STUBS - if (Tcl_InitStubs(interp, "8.0", 0) == 0) { - return TCL_ERROR; - } -#endif - Tcl_StaticPackage(interp, "zvfs", TclZvfsInit, Tcl_Zvfs_SafeInit); - if (!safe) { - Tcl_CreateObjCommand(interp, "zvfs::mount", ZvfsMountObjCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::unmount", ZvfsUnmountObjCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::append", ZvfsAppendObjCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::add", ZvfsAddObjCmd, 0, 0); - } - Tcl_CreateObjCommand(interp, "zvfs::exists", ZvfsExistsObjCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::info", ZvfsInfoObjCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::list", ZvfsListObjCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::dump", ZvfsDumpObjCmd, 0, 0); - Tcl_CreateObjCommand(interp, "zvfs::start", ZvfsStartObjCmd, 0, 0); - Tcl_SetVar(interp, "::zvfs::auto_ext", - ".tcl .tk .itcl .htcl .txt .c .h .tht", TCL_GLOBAL_ONLY); - /* Tcl_CreateObjCommand(interp, "zip::open", ZipOpenObjCmd, 0, 0); */ - if(Zvfs_Common_Init(interp)) { - return TCL_ERROR; - } - - if (Zvfs_PostInit) { - Zvfs_PostInit(interp); - } - return TCL_OK; -} - -/* -** Boot a shell, mount the executable's VFS, detect main.tcl -*/ -int Tcl_Zvfs_Boot(const char *archive,const char *vfsmountpoint,const char *initscript) { - Zvfs_Common_Init(NULL); - if(!vfsmountpoint) { - vfsmountpoint="/zvfs"; - } - if(!initscript) { - initscript="main.tcl"; - } - /* We have to initialize the virtual filesystem before calling - ** Tcl_Init(). Otherwise, Tcl_Init() will not be able to find - ** its startup script files. - */ - if(!Tcl_Zvfs_Mount(NULL, archive, vfsmountpoint)) { - Tcl_DString filepath; - Tcl_DString preinit; - - Tcl_Obj *vfsinitscript; - Tcl_Obj *vfstcllib; - Tcl_Obj *vfstklib; - Tcl_Obj *vfspreinit; - - Tcl_DStringInit(&filepath); - Tcl_DStringInit(&preinit); - - Tcl_DStringInit(&filepath); - Tcl_DStringAppend(&filepath,vfsmountpoint,-1); - Tcl_DStringAppend(&filepath,"/",-1); - Tcl_DStringAppend(&filepath,initscript,-1); - vfsinitscript=Tcl_NewStringObj(Tcl_DStringValue(&filepath),-1); - Tcl_DStringFree(&filepath); - - Tcl_DStringInit(&filepath); - Tcl_DStringAppend(&filepath,vfsmountpoint,-1); - Tcl_DStringAppend(&filepath,"/tcl8.6",-1); - vfstcllib=Tcl_NewStringObj(Tcl_DStringValue(&filepath),-1); - Tcl_DStringFree(&filepath); - - Tcl_DStringInit(&filepath); - Tcl_DStringAppend(&filepath,vfsmountpoint,-1); - Tcl_DStringAppend(&filepath,"/tk8.6",-1); - vfstklib=Tcl_NewStringObj(Tcl_DStringValue(&filepath),-1); - Tcl_DStringFree(&filepath); - - Tcl_IncrRefCount(vfsinitscript); - Tcl_IncrRefCount(vfstcllib); - Tcl_IncrRefCount(vfstklib); - - if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { - /* Startup script should be set before calling Tcl_AppInit */ - Tcl_SetStartupScript(vfsinitscript,NULL); - } - - if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { - /* Startup script should be set before calling Tcl_AppInit */ - Tcl_SetStartupScript(vfsinitscript,NULL); - } else { - Tcl_SetStartupScript(NULL,NULL); - } - if(Tcl_FSAccess(vfstcllib,F_OK)==0) { - Tcl_DStringAppend(&preinit,"\nset tcl_library ",-1); - Tcl_DStringAppendElement(&preinit,Tcl_GetString(vfstcllib)); - } - if(Tcl_FSAccess(vfstklib,F_OK)==0) { - Tcl_DStringAppend(&preinit,"\nset tk_library ",-1); - Tcl_DStringAppendElement(&preinit,Tcl_GetString(vfstklib)); - } - vfspreinit=Tcl_NewStringObj(Tcl_DStringValue(&preinit),-1); - /* NOTE: We never decr this refcount, lest the contents of the script be deallocated */ - Tcl_IncrRefCount(vfspreinit); - TclSetPreInitScript(Tcl_GetString(vfspreinit)); - - Tcl_DecrRefCount(vfsinitscript); - Tcl_DecrRefCount(vfstcllib); - Tcl_DecrRefCount(vfstklib); + if( Tcl_InitStubs(interp,"8.0",0)==0 ){ + return TCL_ERROR; } +#endif + Tcl_PkgProvide(interp, "zvfs", "1.0"); + Zvfs_Common_Init(interp); + Tcl_CreateObjCommand(interp, "zvfs::mount", ZvfsMountObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "zvfs::unmount", ZvfsUnmountObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "zvfs::exists", ZvfsExistsObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "zvfs::info", ZvfsInfoObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "zvfs::list", ZvfsListObjCmd, 0, 0); + if (Zvfs_PostInit) Zvfs_PostInit(interp); return TCL_OK; } - - -int -TclZvfsInit( - Tcl_Interp *interp) -{ - return Zvfs_doInit(interp, 0); -} - -int -Tcl_Zvfs_SafeInit( - Tcl_Interp *interp) -{ - return Zvfs_doInit(interp, 1); -} - -/************************************************************************/ -/************************************************************************/ -/************************************************************************/ - -/* - * Implement the zvfs::dump command - * - * zvfs::dump ARCHIVE - * - * Each entry in the list returned is of the following form: - * - * {FILENAME DATE-TIME SPECIAL-FLAG OFFSET SIZE COMPRESSED-SIZE} - */ -static int -ZvfsDumpObjCmd( - void *NotUsed, /* Client data for this command */ - Tcl_Interp *interp, /* The interpreter used to report errors */ - int objc, /* Number of arguments */ - Tcl_Obj *const* objv) /* Values of all arguments */ -{ - Tcl_Obj *zFilenameObj; - Tcl_Channel chan; - ZFile *pList; - int rc; - Tcl_Obj *pResult; - - if (objc != 2) { - Tcl_WrongNumArgs(interp, 1, objv, "FILENAME"); - return TCL_ERROR; - } - zFilenameObj=objv[1]; - chan = Tcl_FSOpenFileChannel(interp, zFilenameObj, "r", 0); - if (chan == 0) { - return TCL_ERROR; - } - rc = ZvfsReadTOC(interp, chan, &pList); - if (rc == TCL_ERROR) { - deleteZFileList(pList); - return rc; - } - Tcl_Close(interp, chan); - pResult = Tcl_GetObjResult(interp); - while (pList) { - Tcl_Obj *pEntry = Tcl_NewObj(); - ZFile *pNext; - char zDateTime[100]; - - Tcl_ListObjAppendElement(interp, pEntry, - Tcl_NewStringObj(pList->zName,-1)); - translateDosTimeDate(zDateTime, pList->dosDate, pList->dosTime); - Tcl_ListObjAppendElement(interp, pEntry, - Tcl_NewStringObj(zDateTime, -1)); - Tcl_ListObjAppendElement(interp, pEntry, - Tcl_NewIntObj(pList->isSpecial)); - Tcl_ListObjAppendElement(interp, pEntry, - Tcl_NewIntObj(pList->iOffset)); - Tcl_ListObjAppendElement(interp, pEntry, Tcl_NewIntObj(pList->nByte)); - Tcl_ListObjAppendElement(interp, pEntry, - Tcl_NewIntObj(pList->nByteCompr)); - Tcl_ListObjAppendElement(interp, pResult, pEntry); - pNext = pList->pNext; - Tcl_Free((void *) pList); - pList = pNext; - } - return TCL_OK; -} - -/* - * Write a file record into a ZIP archive at the current position of the write - * cursor for channel "chan". Add a ZFile record for the file to *ppList. If - * an error occurs, leave an error message on interp and return TCL_ERROR. - * Otherwise return TCL_OK. - */ -static int -writeFile( - Tcl_Interp *interp, /* Leave an error message here */ - Tcl_Channel out, /* Write the file here */ - Tcl_Channel in, /* Read data from this file */ - Tcl_Obj *zSrcPtr, /* Name the new ZIP file entry this */ - Tcl_Obj *zDestPtr, /* Name the new ZIP file entry this */ - ZFile **ppList) /* Put a ZFile struct for the new file here */ -{ - char *zDest=Tcl_GetString(zDestPtr); - - z_stream stream; - ZFile *p; - int iEndOfData; - int nameLen; - int skip; - int toOut; - char zHdr[30]; - char zInBuf[100000]; - char zOutBuf[100000]; - struct tm *tm; - time_t now; - Tcl_StatBuf stat; - - /* - * Create a new ZFile structure for this file. - * TODO: fill in date/time etc. - */ - nameLen = strlen(zDest); - p = newZFile(nameLen, ppList); - strcpy(p->zName, zDest); - p->isSpecial = 0; - Tcl_FSStat(zSrcPtr, &stat); - now = stat.st_mtime; - tm = localtime(&now); - UnixTimeDate(tm, &p->dosDate, &p->dosTime); - p->iOffset = Tcl_Tell(out); - p->nByte = 0; - p->nByteCompr = 0; - p->nExtra = 0; - p->iCRC = 0; - p->permissions = stat.st_mode; - - /* - * Fill in as much of the header as we know. - */ - - put32(&zHdr[0], 0x04034b50); - put16(&zHdr[4], 0x0014); - put16(&zHdr[6], 0); - put16(&zHdr[8], 8); - put16(&zHdr[10], p->dosTime); - put16(&zHdr[12], p->dosDate); - put16(&zHdr[26], nameLen); - put16(&zHdr[28], 0); - - /* - * Write the header and filename. - */ - - Tcl_Write(out, zHdr, 30); - Tcl_Write(out, zDest, nameLen); - - /* - * The first two bytes that come out of the deflate compressor are some - * kind of header that ZIP does not use. So skip the first two output - * bytes. - */ - - skip = 2; - - /* - * Write the compressed file. Compute the CRC as we progress. - */ - - stream.zalloc = NULL; - stream.zfree = NULL; - stream.opaque = 0; - stream.avail_in = 0; - stream.next_in = (unsigned char *) zInBuf; - stream.avail_out = sizeof(zOutBuf); - stream.next_out = (unsigned char *) zOutBuf; - deflateInit(&stream, 9); - - - p->iCRC = crc32(0, 0, 0); - while (!Tcl_Eof(in)) { - if (stream.avail_in == 0) { - int amt = Tcl_Read(in, zInBuf, sizeof(zInBuf)); - - if (amt <= 0) { - break; - } - p->iCRC = crc32(p->iCRC, (unsigned char *) zInBuf, amt); - stream.avail_in = amt; - stream.next_in = (unsigned char *) zInBuf; - } - deflate(&stream, 0); - toOut = sizeof(zOutBuf) - stream.avail_out; - if (toOut > skip) { - Tcl_Write(out, &zOutBuf[skip], toOut - skip); - skip = 0; - } else { - skip -= toOut; - } - stream.avail_out = sizeof(zOutBuf); - stream.next_out = (unsigned char *) zOutBuf; - } - - do{ - stream.avail_out = sizeof(zOutBuf); - stream.next_out = (unsigned char *) zOutBuf; - deflate(&stream, Z_FINISH); - toOut = sizeof(zOutBuf) - stream.avail_out; - if (toOut > skip) { - Tcl_Write(out, &zOutBuf[skip], toOut - skip); - skip = 0; - } else { - skip -= toOut; - } - } while (stream.avail_out == 0); - - p->nByte = stream.total_in; - p->nByteCompr = stream.total_out - 2; - deflateEnd(&stream); - Tcl_Flush(out); - - /* - * Remember were we are in the file. Then go back and write the header, - * now that we know the compressed file size. - */ - - iEndOfData = Tcl_Tell(out); - Tcl_Seek(out, p->iOffset, SEEK_SET); - put32(&zHdr[14], p->iCRC); - put32(&zHdr[18], p->nByteCompr); - put32(&zHdr[22], p->nByte); - Tcl_Write(out, zHdr, 30); - Tcl_Seek(out, iEndOfData, SEEK_SET); - - /* - * Close the input file. - */ - - Tcl_Close(interp, in); - return TCL_OK; -} - -/* - * The arguments are two lists of ZFile structures sorted by iOffset. Either - * or both list may be empty. This routine merges the two lists together into - * a single sorted list and returns a pointer to the head of the unified list. - * - * This is part of the merge-sort algorithm. - */ -static ZFile * -mergeZFiles( - ZFile *pLeft, - ZFile *pRight) -{ - ZFile fakeHead; - ZFile *pTail; - - pTail = &fakeHead; - while (pLeft && pRight) { - ZFile *p; - - if (pLeft->iOffset <= pRight->iOffset) { - p = pLeft; - pLeft = p->pNext; - } else { - p = pRight; - pRight = p->pNext; - } - pTail->pNext = p; - pTail = p; - } - if (pLeft) { - pTail->pNext = pLeft; - } else if (pRight) { - pTail->pNext = pRight; - } else { - pTail->pNext = 0; - } - return fakeHead.pNext; -} - -/* - * Sort a ZFile list so in accending order by iOffset. - */ -static ZFile * -sortZFiles( - ZFile *pList) -{ -#define NBIN 30 - int i; - ZFile *p; - ZFile *aBin[NBIN+1]; - - for (i=0; i<=NBIN; i++) { - aBin[i] = 0; - } - while (pList) { - p = pList; - pList = p->pNext; - p->pNext = 0; - for (i=0; ipNext) { - if (pList->isSpecial) { - continue; - } - put32(&zBuf[0], 0x02014b50); - put16(&zBuf[4], 0x0317); - put16(&zBuf[6], 0x0014); - put16(&zBuf[8], 0); - put16(&zBuf[10], pList->nByte>pList->nByteCompr ? 0x0008 : 0x0000); - put16(&zBuf[12], pList->dosTime); - put16(&zBuf[14], pList->dosDate); - put32(&zBuf[16], pList->iCRC); - put32(&zBuf[20], pList->nByteCompr); - put32(&zBuf[24], pList->nByte); - put16(&zBuf[28], strlen(pList->zName)); - put16(&zBuf[30], 0); - put16(&zBuf[32], pList->nExtra); - put16(&zBuf[34], 1); - put16(&zBuf[36], 0); - put32(&zBuf[38], pList->permissions<<16); - put32(&zBuf[42], pList->iOffset); - Tcl_Write(chan, zBuf, 46); - Tcl_Write(chan, pList->zName, strlen(pList->zName)); - for (i=pList->nExtra; i>0; i-=40) { - int toWrite = i<40 ? i : 40; - - /* CAREFUL! String below is intentionally 40 spaces! */ - Tcl_Write(chan," ", - toWrite); - } - nEntry++; - } - iTocEnd = Tcl_Tell(chan); - put32(&zBuf[0], 0x06054b50); - put16(&zBuf[4], 0); - put16(&zBuf[6], 0); - put16(&zBuf[8], nEntry); - put16(&zBuf[10], nEntry); - put32(&zBuf[12], iTocEnd - iTocStart); - put32(&zBuf[16], iTocStart); - put16(&zBuf[20], 0); - Tcl_Write(chan, zBuf, 22); - Tcl_Flush(chan); -} - -/* - * Implementation of the zvfs::append command. - * - * zvfs::append ARCHIVE (SOURCE DESTINATION)* - * - * This command reads SOURCE files and appends them (using the name - * DESTINATION) to the zip archive named ARCHIVE. A new zip archive is created - * if it does not already exist. If ARCHIVE refers to a file which exists but - * is not a zip archive, then this command turns ARCHIVE into a zip archive by - * appending the necessary records and the table of contents. Treat all files - * as binary. - * - * Note: No dup checking is done, so multiple occurances of the same file is - * allowed. - */ -static int -ZvfsAppendObjCmd( - void *NotUsed, /* Client data for this command */ - Tcl_Interp *interp, /* The interpreter used to report errors */ - int objc, /* Number of arguments */ - Tcl_Obj *const* objv) /* Values of all arguments */ -{ - Tcl_Obj *zArchiveObj; - Tcl_Channel chan; - ZFile *pList = NULL, *pToc; - int rc = TCL_OK, i; - - /* - * Open the archive and read the table of contents - */ - - if (objc<2 || (objc&1)!=0) { - Tcl_WrongNumArgs(interp, 1, objv, "ARCHIVE (SRC DEST)+"); - return TCL_ERROR; - } - - zArchiveObj=objv[1]; - chan = Tcl_FSOpenFileChannel(interp, zArchiveObj, "r+", 0644); - if (chan == 0) { - chan = Tcl_FSOpenFileChannel(interp, zArchiveObj, "w+", 0644); - if (chan == 0) { - return TCL_ERROR; - } - } - if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") - || Tcl_SetChannelOption(interp, chan, "-encoding", "binary")){ - /* this should never happen */ - Tcl_Close(0, chan); - return TCL_ERROR; - } - - if (Tcl_Seek(chan, 0, SEEK_END) == 0) { - /* Null file is ok, we're creating new one. */ - } else { - Tcl_Seek(chan, 0, SEEK_SET); - if (ZvfsReadTOC(interp, chan, &pList) == TCL_ERROR) { - deleteZFileList(pList); - Tcl_Close(interp, chan); - return TCL_ERROR; - } - rc = TCL_OK; - } - - /* - * Move the file pointer to the start of the table of contents. - */ - for (pToc=pList; pToc; pToc=pToc->pNext) { - if (pToc->isSpecial && strcmp(pToc->zName, "*TOC*") == 0) { - break; - } - } - if (pToc) { - Tcl_Seek(chan, pToc->iOffset, SEEK_SET); - } else { - Tcl_Seek(chan, 0, SEEK_END); - } - - /* - * Add new files to the end of the archive. - */ - - for (i=2; rc==TCL_OK && i p)) { - p = NULL; - } - return p; -} - -/* - * Implementation of the zvfs::add command. - * - * zvfs::add ?-fconfigure optpairs? ARCHIVE FILE1 FILE2 ... - * - * This command is similar to append in that it adds files to the zip archive - * named ARCHIVE, however file names are relative the current directory. In - * addition, fconfigure is used to apply option pairs to set upon opening of - * each file. Otherwise, default translation is allowed for those file - * extensions listed in the ::zvfs::auto_ext var. Binary translation will be - * used for unknown extensions. - * - * NOTE Use '-fconfigure {}' to use auto translation for all. - */ -static int -ZvfsAddObjCmd( - void *NotUsed, /* Client data for this command */ - Tcl_Interp *interp, /* The interpreter used to report errors */ - int objc, /* Number of arguments */ - Tcl_Obj *const* objv) /* Values of all arguments */ -{ - Tcl_Obj *zArchiveObj; - Tcl_Channel chan; - ZFile *pList = NULL, *pToc; - int rc = TCL_OK, i, j, oLen; - char *zOpts = NULL; - Tcl_Obj *confOpts = NULL; - int tobjc; - Tcl_Obj **tobjv; - Tcl_Obj *varObj = NULL; - - /* - * Open the archive and read the table of contents - */ - - if (objc > 3) { - zOpts = Tcl_GetStringFromObj(objv[1], &oLen); - if (!strncmp("-fconfigure", zOpts, oLen)) { - confOpts = objv[2]; - if (TCL_OK != Tcl_ListObjGetElements(interp, confOpts, - &tobjc, &tobjv) || (tobjc%2)) { - return TCL_ERROR; - } - objc -= 2; - objv += 2; - } - } - if (objc == 2) { - return TCL_OK; - } - - if (objc < 3) { - Tcl_WrongNumArgs(interp, 1, objv, - "?-fconfigure OPTPAIRS? ARCHIVE FILE1 FILE2 .."); - return TCL_ERROR; - } - - zArchiveObj = objv[1]; - chan = Tcl_FSOpenFileChannel(interp, zArchiveObj, "r+", 0644); - if (chan == 0) { - chan = Tcl_FSOpenFileChannel(interp, zArchiveObj, "w+", 0644); - if (chan == 0) { - return TCL_ERROR; - } - } - if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") - || Tcl_SetChannelOption(interp, chan, "-encoding", "binary")){ - /* this should never happen */ - Tcl_Close(0, chan); - return TCL_ERROR; - } - - if (Tcl_Seek(chan, 0, SEEK_END) == 0) { - /* Null file is ok, we're creating new one. */ - } else { - Tcl_Seek(chan, 0, SEEK_SET); - if (ZvfsReadTOC(interp, chan, &pList) == TCL_ERROR) { - deleteZFileList(pList); - Tcl_Close(interp, chan); - return TCL_ERROR; - } - rc = TCL_OK; - } - - /* - * Move the file pointer to the start of the table of contents. - */ - - for (pToc=pList; pToc; pToc=pToc->pNext) { - if (pToc->isSpecial && strcmp(pToc->zName, "*TOC*") == 0) { - break; - } - } - if (pToc) { - Tcl_Seek(chan, pToc->iOffset, SEEK_SET); - } else { - Tcl_Seek(chan, 0, SEEK_END); - } - - /* - * Add new files to the end of the archive. - */ - - for (i=2; rc==TCL_OK && i= tobjc) { - ext = NULL; - } - } - } - if (ext == NULL) { - if (Tcl_SetChannelOption(interp, in, "-translation", "binary") - || Tcl_SetChannelOption(interp, in, "-encoding", - "binary")) { - /* this should never happen */ - Tcl_Close(0, in); - rc = TCL_ERROR; - break; - } - } - } else { - for (j=0; j +#include "tclInt.h" +#include "tclFileSystem.h" + +int Zvfs_Common_Init(Tcl_Interp *); +int Zvfs_Mount(Tcl_Interp *,CONST char *,CONST char *); + + +/* +** Boot a shell, mount the executable's VFS, detect main.tcl +*/ +int Tcl_Zvfs_Boot(const char *archive,const char *vfsmountpoint,const char *initscript) { + Zvfs_Common_Init(NULL); + if(!vfsmountpoint) { + vfsmountpoint="/zvfs"; + } + if(!initscript) { + initscript="main.tcl"; + } + /* We have to initialize the virtual filesystem before calling + ** Tcl_Init(). Otherwise, Tcl_Init() will not be able to find + ** its startup script files. + */ + if(!Zvfs_Mount(NULL, archive, vfsmountpoint)) { + Tcl_DString filepath; + Tcl_DString preinit; + + Tcl_Obj *vfsinitscript; + Tcl_Obj *vfstcllib; + Tcl_Obj *vfstklib; + Tcl_Obj *vfspreinit; + Tcl_DStringInit(&filepath); + Tcl_DStringInit(&preinit); + + Tcl_DStringInit(&filepath); + Tcl_DStringAppend(&filepath,vfsmountpoint,-1); + Tcl_DStringAppend(&filepath,"/",-1); + Tcl_DStringAppend(&filepath,initscript,-1); + vfsinitscript=Tcl_NewStringObj(Tcl_DStringValue(&filepath),-1); + Tcl_DStringFree(&filepath); + + Tcl_DStringInit(&filepath); + Tcl_DStringAppend(&filepath,vfsmountpoint,-1); + Tcl_DStringAppend(&filepath,"/boot/tcl",-1); + vfstcllib=Tcl_NewStringObj(Tcl_DStringValue(&filepath),-1); + Tcl_DStringFree(&filepath); + + Tcl_DStringInit(&filepath); + Tcl_DStringAppend(&filepath,vfsmountpoint,-1); + Tcl_DStringAppend(&filepath,"/boot/tk",-1); + vfstklib=Tcl_NewStringObj(Tcl_DStringValue(&filepath),-1); + Tcl_DStringFree(&filepath); + + Tcl_IncrRefCount(vfsinitscript); + Tcl_IncrRefCount(vfstcllib); + Tcl_IncrRefCount(vfstklib); + + if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { + /* Startup script should be set before calling Tcl_AppInit */ + Tcl_SetStartupScript(vfsinitscript,NULL); + } + /* Record the mountpoint for scripts to refer back to */ + Tcl_DStringAppend(&preinit,"\nset ::tcl_boot_vfs ",-1); + Tcl_DStringAppendElement(&preinit,vfsmountpoint); + Tcl_DStringAppend(&preinit,"\nset ::SRCDIR ",-1); + Tcl_DStringAppendElement(&preinit,vfsmountpoint); + + if(Tcl_FSAccess(vfstcllib,F_OK)==0) { + Tcl_DStringAppend(&preinit,"\nset tcl_library ",-1); + Tcl_DStringAppendElement(&preinit,Tcl_GetString(vfstcllib)); + } + if(Tcl_FSAccess(vfstklib,F_OK)==0) { + Tcl_DStringAppend(&preinit,"\nset tk_library ",-1); + Tcl_DStringAppendElement(&preinit,Tcl_GetString(vfstklib)); + } + vfspreinit=Tcl_NewStringObj(Tcl_DStringValue(&preinit),-1); + /* NOTE: We never decr this refcount, lest the contents of the script be deallocated */ + Tcl_IncrRefCount(vfspreinit); + TclSetPreInitScript(Tcl_GetString(vfspreinit)); + + Tcl_DecrRefCount(vfsinitscript); + Tcl_DecrRefCount(vfstcllib); + Tcl_DecrRefCount(vfstklib); + } + return TCL_OK; +} diff --git a/unix/Makefile.in b/unix/Makefile.in index bbe0ae5..a9c74b1 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -367,7 +367,7 @@ ZLIB_OBJS = Zadler32.o Zcompress.o Zcrc32.o Zdeflate.o Zinfback.o \ TCL_OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${NOTIFY_OBJS} ${COMPAT_OBJS} \ ${OO_OBJS} @DL_OBJS@ @PLAT_OBJS@ -TCLKIT_OBJS = tclKitInit.o tclZipVfs.o +TCLKIT_OBJS = tclKitInit.o tclZipVfs.o tclZipVfsBoot.o OBJS = ${TCL_OBJS} ${TOMMATH_OBJS} @DTRACE_OBJ@ @ZLIB_OBJS@ @@ -670,7 +670,7 @@ null.zip: tclkit.vfs: @echo "Building VFS File system in tclkit.vfs" @$(TCL_EXE) "$(TOP_DIR)/tools/mkVfs.tcl" \ - "$(UNIX_DIR)/tclkit.vfs/tcl$(VERSION)" "$(TOP_DIR)" unix + "$(UNIX_DIR)/tclkit.vfs/boot/tcl" "$(TOP_DIR)" unix tclkit: ${TCLKIT_EXE} @@ -1376,6 +1376,9 @@ tclVar.o: $(GENERIC_DIR)/tclVar.c tclZipVfs.o: $(GENERIC_DIR)/tclZipVfs.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclZipVfs.c +tclZipVfsBoot.o: $(GENERIC_DIR)/tclZipVfsBoot.c + $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclZipVfsBoot.c + tclZlib.o: $(GENERIC_DIR)/tclZlib.c $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/tclZlib.c diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index 4df6387..1be1ce3 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -42,7 +42,9 @@ MODULE_SCOPE int TCL_LOCAL_APPINIT(Tcl_Interp *); MODULE_SCOPE int main(int, char **); #ifdef TCL_ZIPVFS MODULE_SCOPE int Tcl_Zvfs_Boot(const char *,const char *,const char *); - MODULE_SCOPE int TclZvfsInit(Tcl_Interp *); + MODULE_SCOPE int Zvfs_Init(Tcl_Interp *); + MODULE_SCOPE int Zvfs_SafeInit(Tcl_Interp *); + #endif /* TCL_ZIPVFS */ /* * The following #if block allows you to change how Tcl finds the startup @@ -122,7 +124,8 @@ Tcl_AppInit( } #ifdef TCL_ZIPVFS /* Load the ZipVfs package */ - if (TclZvfsInit(interp) == TCL_ERROR) { + Tcl_StaticPackage(interp, "zvfs", Zvfs_Init, Zvfs_SafeInit); + if(Zvfs_Init(interp) == TCL_ERROR) { return TCL_ERROR; } #endif diff --git a/win/Makefile.in b/win/Makefile.in index d667c51..745fa58 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -411,7 +411,7 @@ ZLIB_OBJS = \ TCL_OBJS = ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} @ZLIB_OBJS@ -TCLKIT_OBJS = tclKitInit.$(OBJEXT) tclZipVfs.$(OBJEXT) +TCLKIT_OBJS = tclKitInit.$(OBJEXT) tclZipVfs.$(OBJEXT) tclZipVfsBoot.$(OBJEXT) TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n] diff --git a/win/tclAppInit.c b/win/tclAppInit.c index 6f49afa..7fd4c32 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -29,7 +29,8 @@ extern Tcl_PackageInitProc Tcltest_SafeInit; #ifdef TCL_ZIPVFS MODULE_SCOPE int Tcl_Zvfs_Boot(const char *,const char *,const char *); - MODULE_SCOPE int TclZvfsInit(Tcl_Interp *); + MODULE_SCOPE int Zvfs_Init(Tcl_Interp *); + MODULE_SCOPE int Zvfs_SafeInit(Tcl_Interp *); #endif /* TCL_ZIPVFS */ #if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES @@ -167,8 +168,9 @@ Tcl_AppInit( } #ifdef TCL_ZIPVFS /* Load the ZipVfs package */ - if (TclZvfsInit(interp) == TCL_ERROR) { - return TCL_ERROR; + Tcl_StaticPackage(interp, "zvfs", Zvfs_Init, Zvfs_SafeInit); + if(Zvfs_Init(interp) == TCL_ERROR) { + return TCL_ERROR; } #endif #if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES -- cgit v0.12 From 2b022e697945f65efc1e421e0149ec206434e353 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sun, 19 Oct 2014 20:20:09 +0000 Subject: Added a "_bare" stage to capture the kit executable before the VFS is wrapped to it. --- unix/Makefile.in | 17 +++++++++++------ win/Makefile.in | 12 ++++++++---- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index a9c74b1..16721a9 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -674,15 +674,20 @@ tclkit.vfs: tclkit: ${TCLKIT_EXE} -# Builds an executable linked to the Tcl dynamic library -${TCLKIT_EXE}: ${TCLKIT_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} null.zip tclkit.vfs +${TCLKIT_BASE}_bare: ${TCLKIT_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} ${CC} ${CFLAGS} ${LDFLAGS} \ ${TCLKIT_OBJS} \ @TCL_BUILD_LIB_SPEC@ \ ${LIBS} @EXTRA_TCLSH_LIBS@ \ - ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} - cat null.zip >> ${TCLKIT_EXE} - cd tclkit.vfs ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . + ${CC_SEARCH_FLAGS} -o ${TCLKIT_BASE}_bare + + +# Builds an executable linked to the Tcl dynamic library +${TCLKIT_EXE}: ${TCLKIT_BASE}_bare null.zip tclkit.vfs + cp -f ${TCLKIT_BASE}_bare ${TCLKIT_BASE}.zip + cat null.zip >> ${TCLKIT_BASE}.zip + cd tclkit.vfs ; zip -rAq ${UNIX_DIR}/${TCLKIT_BASE}.zip . + mv ${TCLKIT_BASE}.zip ${TCLKIT_EXE} # Builds an executable directly from the Tcl sources tclkit-static: ${TCLKIT_OBJS} ${OBJS} ${ZLIB_OBJS} null.zip tclkit.vfs @@ -701,7 +706,7 @@ Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in clean: clean-packages rm -f *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \ errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ \ - ${TCLKIT_EXE} + ${TCLKIT_EXE} tclkit* rm -rf tclkit.vfs null.zip cd dltest ; $(MAKE) clean diff --git a/win/Makefile.in b/win/Makefile.in index 745fa58..0fba203 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -443,12 +443,16 @@ tclkit.vfs: $(TCLSH) $(DDE_DLL_FILE) $(REG_DLL_FILE) @$(TCL_EXE) "$(ROOT_DIR)/tools/mkVfs.tcl" \ "$(WIN_DIR)/tclkit.vfs/tcl$(VERSION)" "$(ROOT_DIR)" windows -$(TCLKIT): $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs +tclkit_bare: $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) $(CC) $(CFLAGS) $(TCLKIT_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) @VC_MANIFEST_EMBED_EXE@ - cat null.zip >> $(TCLKIT) - cd tclkit.vfs ; zip -rAq $(WIN_DIR)/$(TCLKIT) . + +$(TCLKIT): tclkit_bare null.zip tclkit.vfs + cp tclkit_bare tclkit.zip + cat null.zip >> tclkit.zip + cd tclkit.vfs ; zip -rAq $(WIN_DIR)/tclkit.zip . + mv tclkit.zip $(TCLKIT) # Builds an executable directly from the Tcl sources tclkit-direct: $(TCLKIT_OBJS) ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLIB_OBJS} @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs @@ -778,7 +782,7 @@ cleanhelp: clean: cleanhelp clean-packages $(RM) *.lib *.a *.exp *.dll *.$(RES) *.${OBJEXT} *~ \#* TAGS a.out $(RM) $(TCLSH) $(CAT32) $(TCLKIT) null.zip - $(RM) *.pch *.ilk *.pdb + $(RM) *.pch *.ilk *.pdb tclkit* $(RMDIR) tclkit.vfs distclean: distclean-packages clean -- cgit v0.12 From 963de5ae2a73c26d2f1faabe43cbc6eb2c066b97 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 20 Oct 2014 01:20:54 +0000 Subject: Added thread mutex/release calls around the potentially contested regions of the code: Mounting a file system Unmounting a file system Reading data from an archive file The mutexes, as implemented, allow only one thread at a time access to the innards of ZipVfs. It does not try to handle the cases where two archives may be open by two different threads. (One will still have to wait until the other has finished.) Removed all of the compiler warnings under Unix (Still have to test the code under Windows.) --- generic/tclZipVfs.c | 94 ++++++++++++++++++++++------------------------------- 1 file changed, 39 insertions(+), 55 deletions(-) diff --git a/generic/tclZipVfs.c b/generic/tclZipVfs.c index c9160ba..d4f8f68 100755 --- a/generic/tclZipVfs.c +++ b/generic/tclZipVfs.c @@ -57,6 +57,8 @@ #include #include "tcl.h" +TCL_DECLARE_MUTEX(ArchiveFileAccess) + #undef ZIPVFSCRYPT #ifdef ZIPVFSCRYPT /* Some modifications to support encrypted files */ @@ -79,8 +81,9 @@ extern const unsigned long *crc_32_tab; */ #define COMPR_BUF_SIZE 32768 static int openarch = 0; /* Set to 1 when opening archive. */ +#ifdef __WIN32__ static int maptolower=0; - +#endif /* ** All static variables are collected into a structure named "local". ** That way, it is clear in the code when we are using a static @@ -140,19 +143,6 @@ typedef struct ZvfsFile { #define INT16(B, N) (B[N] + (B[N+1]<<8)) #define INT32(B, N) (INT16(B,N) + (B[N+2]<<16) + (B[N+3]<<24)) -/* -** Write a 16- or 32-bit integer as little-endian into the given buffer. -*/ -static void put16(char *z, int v){ - z[0] = v & 0xff; - z[1] = (v>>8) & 0xff; -} -static void put32(char *z, int v){ - z[0] = v & 0xff; - z[1] = (v>>8) & 0xff; - z[2] = (v>>16) & 0xff; - z[3] = (v>>24) & 0xff; -} /* Convert DOS time to unix time. */ static time_t DosTimeDate(int dosDate, int dosTime){ @@ -169,25 +159,6 @@ static time_t DosTimeDate(int dosDate, int dosTime){ return mktime(tm); } -/* -** Translate a DOS time and date stamp into a human-readable string. -*/ -static void translateDosTimeDate(char *zStr, int dosDate, int dosTime){ - static char *zMonth[] = { "nil", - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", - }; - - sprintf(zStr, "%02d-%s-%d %02d:%02d:%02d", - dosDate & 0x1f, - zMonth[ ((dosDate&0x1e0)>>5) ], - ((dosDate&0xfe00)>>9) + 1980, - (dosTime&0xf800)>>11, - (dosTime&0x7e)>>5, - dosTime&0x1f - ); -} - /* Return count of char ch in str */ int strchrcnt(char *str, char ch) { int cnt=0; @@ -476,15 +447,17 @@ int Zvfs_Mount( Tcl_Free((char *)zTrueName); return TCL_OK; } + Tcl_MutexLock(&ArchiveFileAccess); chan = Tcl_OpenFileChannel(interp, zArchive, "r", 0); if (!chan) { - return TCL_ERROR; + Tcl_MutexUnlock(&ArchiveFileAccess); + return TCL_ERROR; } if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") != TCL_OK){ - return TCL_ERROR; + goto closeReleaseDie; } if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary") != TCL_OK) { - return TCL_ERROR; + goto closeReleaseDie; } /* @@ -496,7 +469,7 @@ int Zvfs_Mount( Tcl_Read(chan, (char *) zBuf, 22); if (memcmp(zBuf, "\120\113\05\06", 4)) { if(interp) Tcl_AppendResult(interp, "not a ZIP archive", NULL); - return TCL_ERROR; + goto closeReleaseDie; } /* @@ -510,9 +483,7 @@ int Zvfs_Mount( if (interp) { Tcl_AppendResult(interp, "already mounted at ", pArchive->zMountPoint,0); } - Tcl_Free(zArchiveName); - Tcl_Close(interp, chan); - return TCL_ERROR; + goto closeReleaseDie; } /* @@ -641,11 +612,16 @@ int Zvfs_Mount( Tcl_Seek(chan, lenExtra, SEEK_CUR); } Tcl_Close(interp, chan); - if (zTrueName) { Tcl_Free(zTrueName); } + Tcl_MutexUnlock(&ArchiveFileAccess); return TCL_OK; + +closeReleaseDie: + Tcl_Close(interp, chan); + Tcl_MutexUnlock(&ArchiveFileAccess); + return TCL_ERROR; } /* @@ -682,6 +658,7 @@ static int Zvfs_Unmount( if (pEntry == 0) { return 0; } + Tcl_MutexLock(&ArchiveFileAccess); pArchive = Tcl_GetHashValue(pEntry); Tcl_DeleteHashEntry(pEntry); Tcl_Free(pArchive->zName); @@ -705,6 +682,7 @@ static int Zvfs_Unmount( Tcl_Free(pFile->zName); Tcl_Free((void *) pFile); } + Tcl_MutexUnlock(&ArchiveFileAccess); return 1; } @@ -980,6 +958,7 @@ static int vfsClose( Tcl_Close(interp, pInfo->chan); Tcl_DeleteExitHandler(vfsExit, pInfo); } + Tcl_MutexUnlock(&ArchiveFileAccess); Tcl_Free((char*)pInfo); return TCL_OK; } @@ -1019,12 +998,14 @@ static int vfsRead ( int *pErrorCode /* Location of error flag */ ){ /* Read and decompress all data for the associated file into the specified buffer */ ZvfsChannelInfo* pInfo = (ZvfsChannelInfo*) instanceData; + int len; +#ifdef ZIPVFSCRYPT unsigned char encryptHdr[12]; int C; int temp; int i; - int len; char pwdbuf[20]; +#endif if( (unsigned long)toRead > pInfo->nByte ){ toRead = pInfo->nByte; @@ -1054,7 +1035,7 @@ static int vfsRead ( if( pInfo->isCompressed ){ int err = Z_OK; z_stream *stream = &pInfo->stream; - stream->next_out = buf; + stream->next_out = (unsigned char *)buf; stream->avail_out = toRead; while (stream->avail_out) { if (!stream->avail_in) { @@ -1062,7 +1043,7 @@ static int vfsRead ( if (len > COMPR_BUF_SIZE) { len = COMPR_BUF_SIZE; } - len = Tcl_Read(pInfo->chan, pInfo->zBuf, len); + len = Tcl_Read(pInfo->chan, (char *)pInfo->zBuf, len); #ifdef ZIPVFSCRYPT if (pInfo->isEncrypted) { @@ -1224,6 +1205,8 @@ static Tcl_Channel ZvfsFileOpen( return NULL; } openarch = 1; + + Tcl_MutexLock(&ArchiveFileAccess); chan = Tcl_OpenFileChannel(interp, pFile->pArchive->zName, "r", 0); openarch = 0; @@ -1231,23 +1214,22 @@ static Tcl_Channel ZvfsFileOpen( local.firstMount = pFile->pArchive->zName; } if( chan==0 ){ + Tcl_MutexUnlock(&ArchiveFileAccess); return 0; } if( Tcl_SetChannelOption(interp, chan, "-translation", "binary") || Tcl_SetChannelOption(interp, chan, "-encoding", "binary") ){ /* this should never happen */ - Tcl_Close(0, chan); - return 0; + goto closeReleaseDie; } Tcl_Seek(chan, pFile->iOffset, SEEK_SET); - Tcl_Read(chan, zBuf, 30); + Tcl_Read(chan, (char *)zBuf, 30); if( memcmp(zBuf, "\120\113\03\04", 4) ){ if( interp ){ Tcl_AppendResult(interp, "local header mismatch: ", NULL); } - Tcl_Close(interp, chan); - return 0; + goto closeReleaseDie; } pInfo = (ZvfsChannelInfo*)Tcl_Alloc( sizeof(*pInfo) ); pInfo->chan = chan; @@ -1297,11 +1279,17 @@ static Tcl_Channel ZvfsFileOpen( /* Read and decompress the file contents */ if (pInfo->uBuf) { pInfo->uBuf[0] = 0; - vfsRead(pInfo, pInfo->uBuf, pInfo->nByte, &errCode); + vfsRead(pInfo, (char *)pInfo->uBuf, pInfo->nByte, &errCode); pInfo->readSoFar = 0; } return chan; + +closeReleaseDie: + Tcl_Close(interp, chan); + Tcl_MutexUnlock(&ArchiveFileAccess); + return NULL; + } Tcl_Channel Tobe_FSOpenFileChannelProc @@ -1342,7 +1330,6 @@ int Tobe_FSStatProc _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *buf)) { ** This routine does an access() system call for a ZVFS file. */ int Tobe_FSAccessProc _ANSI_ARGS_((Tcl_Obj *pathPtr, int mode)) { - int len; char *path=Tcl_GetString(pathPtr); ZvfsFile *pFile; @@ -1401,7 +1388,6 @@ int Tobe_FSMatchInDirectoryProc ( Tcl_HashEntry *pEntry; /* Hash table entry */ Tcl_HashSearch zSearch; /* Search all mount points */ ZvfsArchive *pArchive; /* The ZIP archive being mounted */ - Tcl_Obj *pVols=0, *pVol; char mountpt[200]; int i=1; mountpt[0]='/'; @@ -1474,7 +1460,7 @@ int Tobe_FSMatchInDirectoryProc ( } } } -done: + if (zPattern) { free(zPattern); } @@ -1801,7 +1787,6 @@ int Zvfs_Common_Init(Tcl_Interp *interp) { } int Zvfs_Init(Tcl_Interp *interp){ - int n; #ifdef USE_TCL_STUBS if( Tcl_InitStubs(interp,"8.0",0)==0 ){ return TCL_ERROR; @@ -1819,7 +1804,6 @@ int Zvfs_Init(Tcl_Interp *interp){ } int Zvfs_SafeInit(Tcl_Interp *interp){ - int n; #ifdef USE_TCL_STUBS if( Tcl_InitStubs(interp,"8.0",0)==0 ){ return TCL_ERROR; -- cgit v0.12 From 307bb5f72d17a66308509ba1001fc8ca502100c8 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 20 Oct 2014 01:23:11 +0000 Subject: Removed the dual ported canonical path mapping scheme to allow Odie and FreeWrap to coexist. The results of both functions were functionally identical. --- generic/tclZipVfs.c | 100 ---------------------------------------------------- 1 file changed, 100 deletions(-) diff --git a/generic/tclZipVfs.c b/generic/tclZipVfs.c index d4f8f68..80230c3 100755 --- a/generic/tclZipVfs.c +++ b/generic/tclZipVfs.c @@ -167,105 +167,6 @@ int strchrcnt(char *str, char ch) { return cnt; } -#ifdef FREEWRAP -/* -** Concatenate zTail onto zRoot to form a pathname. zRoot will begin -** with "/". After concatenation, simplify the pathname be removing -** unnecessary ".." and "." directories. Under windows, make all -** characters lower case. -** -** Resulting pathname is returned. Space to hold the returned path is -** obtained from Tcl_Alloc() and should be freed by the calling function. -*/ -static char *CanonicalPath(const char *zRoot, const char *zTail){ - char *zPath; - int i, j, c; - -#ifdef __WIN32__ - if( isalpha(zTail[0]) && zTail[1]==':' ){ zTail += 2; } - if( zTail[0]=='\\' ){ zRoot = ""; zTail++; } - if( zTail[0]=='\\' ){ zRoot = "/"; zTail++; } // account for UNC style path -#endif - if( zTail[0]=='/' ){ zRoot = ""; zTail++; } - if( zTail[0]=='/' ){ zRoot = "/"; zTail++; } // account for UNC style path - zPath = (void *)Tcl_Alloc( strlen(zRoot) + strlen(zTail) + 2 ); - if( zPath==0 ) return 0; - sprintf(zPath, "%s/%s", zRoot, zTail); - for(i=j=0; (c = zPath[i])!=0; i++){ -#ifdef __WIN32__ - if( isupper(c) ) { if (maptolower) c = tolower(c); } - else if( c=='\\' ) c = '/'; -#endif - if( c=='/' ){ - int c2 = zPath[i+1]; - if( c2=='/' ) continue; - if( c2=='.' ){ - int c3 = zPath[i+2]; - if( c3=='/' || c3==0 ){ - i++; - continue; - } - if( c3=='.' && (zPath[i+3]=='.' || zPath[i+3]==0) ){ - i += 2; - while( j>0 && zPath[j-1]!='/' ){ j--; } - continue; - } - } - } - zPath[j++] = c; - } - if( j==0 ){ zPath[j++] = '/'; } - zPath[j] = 0; - return zPath; -} -/* -** Construct an absolute pathname in memory obtained from Tcl_Alloc -** that means the same file as the pathname given. -** -** Under windows, all backslash (\) charaters are converted to foward -** slash (/) and all upper case letters are converted to lower case. -** The drive letter (if present) is preserved. -*/ -static char *AbsolutePath(const char *z){ - Tcl_DString pwd; - char *zResult; - Tcl_DStringInit(&pwd); - if( *z!='/' -#ifdef __WIN32__ - && *z!='\\' && (!isalpha(*z) || z[1]!=':') -#endif - ){ - /* Case 1: "z" is a relative path. So prepend the current working - ** directory in order to generate an absolute path. Note that the - ** CanonicalPath() function takes care of converting upper to lower - ** case and (\) to (/) under windows. - */ - Tcl_GetCwd(0, &pwd); - zResult = CanonicalPath( Tcl_DStringValue(&pwd), z); - Tcl_DStringFree(&pwd); - } else { - /* Case 2: "z" is an absolute path already. We just need to make - ** a copy of it. Under windows, we need to convert upper to lower - ** case and (\) into (/) on the copy. - */ - zResult = (void *)Tcl_Alloc( strlen(z) + 1 ); - if( zResult==0 ) return 0; - strcpy(zResult, z); -#ifdef __WIN32__ - { - int i, c; - for(i=0; (c=zResult[i])!=0; i++){ - if( isupper(c) ) { - // zResult[i] = tolower(c); - } - else if( c=='\\' ) zResult[i] = '/'; - } - } -#endif - } - return zResult; -} -#else /* ** Concatenate zTail onto zRoot to form a pathname. zRoot will begin ** with "/". After concatenation, simplify the pathname be removing @@ -379,7 +280,6 @@ AbsolutePath( } return zResult; } -#endif /* ** Read a ZIP archive and make entries in the virutal file hash table for all -- cgit v0.12 From b2164040ac3124d35041c71e5ba733563db32443 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 20 Oct 2014 19:59:19 +0000 Subject: Renamed "tclkit" to "tclzsh" Removed tclzsh from "make binaries". (It the user wants it, they have to ask for it. It requires a working Tclsh and an exernal Zip) --- unix/Makefile.in | 58 ++++++++++++++++++++++++++++---------------------------- win/Makefile.in | 50 ++++++++++++++++++++++++------------------------ 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 16721a9..918e9fc 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -169,11 +169,11 @@ INSTALL_DATA_DIR = ${INSTALL} -d -m 755 EXE_SUFFIX = @EXEEXT@ TCL_EXE = tclsh${EXE_SUFFIX} ifeq ($(SHARED_BUILD),0) -TCLKIT_BASE = tclkits +TCLZSH_BASE = tclzshs else -TCLKIT_BASE = tclkitd +TCLZSH_BASE = tclzshd endif -TCLKIT_EXE = ${TCLKIT_BASE}${EXE_SUFFIX} +TCLZSH_EXE = ${TCLZSH_BASE}${EXE_SUFFIX} TCLTEST_EXE = tcltest${EXE_SUFFIX} NATIVE_TCLSH = @TCLSH_PROG@ @@ -367,7 +367,7 @@ ZLIB_OBJS = Zadler32.o Zcompress.o Zcrc32.o Zdeflate.o Zinfback.o \ TCL_OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${NOTIFY_OBJS} ${COMPAT_OBJS} \ ${OO_OBJS} @DL_OBJS@ @PLAT_OBJS@ -TCLKIT_OBJS = tclKitInit.o tclZipVfs.o tclZipVfsBoot.o +TCLZSH_OBJS = tclZipShInit.o tclZipVfs.o tclZipVfsBoot.o OBJS = ${TCL_OBJS} ${TOMMATH_OBJS} @DTRACE_OBJ@ @ZLIB_OBJS@ @@ -624,7 +624,7 @@ SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \ all: binaries libraries doc packages -binaries: ${LIB_FILE} ${TCL_EXE} ${TCLKIT_EXE} +binaries: ${LIB_FILE} ${TCL_EXE} libraries: @@ -667,36 +667,36 @@ null.zip: # Rather than force an install, pack the files we need into a # file system under our control -tclkit.vfs: - @echo "Building VFS File system in tclkit.vfs" +tclzsh.vfs: + @echo "Building VFS File system in tclzsh.vfs" @$(TCL_EXE) "$(TOP_DIR)/tools/mkVfs.tcl" \ - "$(UNIX_DIR)/tclkit.vfs/boot/tcl" "$(TOP_DIR)" unix + "$(UNIX_DIR)/tclzsh.vfs/boot/tcl" "$(TOP_DIR)" unix -tclkit: ${TCLKIT_EXE} +tclzsh: ${TCLZSH_EXE} -${TCLKIT_BASE}_bare: ${TCLKIT_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} +${TCLZSH_BASE}_bare: ${TCLZSH_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} ${CC} ${CFLAGS} ${LDFLAGS} \ - ${TCLKIT_OBJS} \ + ${TCLZSH_OBJS} \ @TCL_BUILD_LIB_SPEC@ \ ${LIBS} @EXTRA_TCLSH_LIBS@ \ - ${CC_SEARCH_FLAGS} -o ${TCLKIT_BASE}_bare + ${CC_SEARCH_FLAGS} -o ${TCLZSH_BASE}_bare # Builds an executable linked to the Tcl dynamic library -${TCLKIT_EXE}: ${TCLKIT_BASE}_bare null.zip tclkit.vfs - cp -f ${TCLKIT_BASE}_bare ${TCLKIT_BASE}.zip - cat null.zip >> ${TCLKIT_BASE}.zip - cd tclkit.vfs ; zip -rAq ${UNIX_DIR}/${TCLKIT_BASE}.zip . - mv ${TCLKIT_BASE}.zip ${TCLKIT_EXE} +${TCLZSH_EXE}: ${TCLZSH_BASE}_bare null.zip tclzsh.vfs + cp -f ${TCLZSH_BASE}_bare ${TCLZSH_BASE}.zip + cat null.zip >> ${TCLZSH_BASE}.zip + cd tclzsh.vfs ; zip -rAq ${UNIX_DIR}/${TCLZSH_BASE}.zip . + mv ${TCLZSH_BASE}.zip ${TCLZSH_EXE} # Builds an executable directly from the Tcl sources -tclkit-static: ${TCLKIT_OBJS} ${OBJS} ${ZLIB_OBJS} null.zip tclkit.vfs +tclzsh-static: ${TCLZSH_OBJS} ${OBJS} ${ZLIB_OBJS} null.zip tclzsh.vfs ${CC} ${CFLAGS} ${LDFLAGS} \ - ${TCLKIT_OBJS} ${OBJS} ${ZLIB_OBJS} \ + ${TCLZSH_OBJS} ${OBJS} ${ZLIB_OBJS} \ ${LIBS} @EXTRA_TCLSH_LIBS@ \ - ${CC_SEARCH_FLAGS} -o ${TCLKIT_EXE} - cat null.zip >> ${TCLKIT_EXE} - cd tclkit.vfs ; zip -rAq ${UNIX_DIR}/${TCLKIT_EXE} . + ${CC_SEARCH_FLAGS} -o ${TCLZSH_EXE} + cat null.zip >> ${TCLZSH_EXE} + cd tclzsh.vfs ; zip -rAq ${UNIX_DIR}/${TCLZSH_EXE} . Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in $(SHELL) config.status @@ -706,8 +706,8 @@ Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in clean: clean-packages rm -f *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \ errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ \ - ${TCLKIT_EXE} tclkit* - rm -rf tclkit.vfs null.zip + ${TCLZSH_EXE} tclzsh* + rm -rf tclzsh.vfs null.zip cd dltest ; $(MAKE) clean distclean: distclean-packages clean @@ -851,8 +851,8 @@ install-binaries: binaries @chmod 555 "$(DLL_INSTALL_DIR)/$(LIB_FILE)" @echo "Installing ${TCL_EXE} as $(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" @$(INSTALL_PROGRAM) ${TCL_EXE} "$(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" - @echo "Installing ${TCLKIT_EXE} as $(BIN_INSTALL_DIR)/${TCLKIT_BASE}$(VERSION)${EXE_SUFFIX}" - @$(INSTALL_PROGRAM) ${TCLKIT_EXE} "$(BIN_INSTALL_DIR)/${TCLKIT_BASE}$(VERSION)${EXE_SUFFIX}" + @echo "Installing ${TCLZSH_EXE} as $(BIN_INSTALL_DIR)/${TCLZSH_BASE}$(VERSION)${EXE_SUFFIX}" + @$(INSTALL_PROGRAM) ${TCLZSH_EXE} "$(BIN_INSTALL_DIR)/${TCLZSH_BASE}$(VERSION)${EXE_SUFFIX}" @echo "Installing tclConfig.sh to $(CONFIG_INSTALL_DIR)/" @$(INSTALL_DATA) tclConfig.sh "$(CONFIG_INSTALL_DIR)/tclConfig.sh" @echo "Installing tclooConfig.sh to $(CONFIG_INSTALL_DIR)/" @@ -1076,9 +1076,9 @@ xtTestInit.o: $(UNIX_DIR)/tclAppInit.c ${TCL_EXE} mv tclAppInit.sav tclAppInit.o; \ fi; -tclKitInit.o: $(UNIX_DIR)/tclAppInit.c ${TCL_EXE} +tclZipShInit.o: $(UNIX_DIR)/tclAppInit.c ${TCL_EXE} $(CC) -c $(APP_CC_SWITCHES) \ - -DTCL_ZIPVFS $(UNIX_DIR)/tclAppInit.c -o tclKitInit.o + -DTCL_ZIPVFS $(UNIX_DIR)/tclAppInit.c -o tclZipShInit.o # Object files used on all Unix systems: @@ -2186,7 +2186,7 @@ BUILD_HTML = \ .PHONY: install-tzdata install-msgs .PHONY: packages configure-packages test-packages clean-packages .PHONY: dist-packages distclean-packages install-packages -.PHONY: tclkit-static tclkit +.PHONY: tclzsh-static tclzsh #-------------------------------------------------------------------------- # DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/win/Makefile.in b/win/Makefile.in index 0fba203..6877938 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -149,7 +149,7 @@ SHARED_LIBRARIES = $(TCL_DLL_FILE) @ZLIB_DLL_FILE@ STATIC_LIBRARIES = $(TCL_LIB_FILE) TCLSH = tclsh$(VER)${EXESUFFIX} -TCLKIT = tclkit$(VER)${EXESUFFIX} +TCLZSH = tclzsh$(VER)${EXESUFFIX} CAT32 = cat32$(EXEEXT) MAN2TCL = man2tcl$(EXEEXT) @@ -411,7 +411,7 @@ ZLIB_OBJS = \ TCL_OBJS = ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} @ZLIB_OBJS@ -TCLKIT_OBJS = tclKitInit.$(OBJEXT) tclZipVfs.$(OBJEXT) tclZipVfsBoot.$(OBJEXT) +TCLZSH_OBJS = tclZipShInit.$(OBJEXT) tclZipVfs.$(OBJEXT) tclZipVfsBoot.$(OBJEXT) TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n] @@ -419,7 +419,7 @@ all: binaries libraries doc packages tcltest: $(TCLSH) $(TEST_DLL_FILE) -binaries: $(TCL_STUB_LIB_FILE) @LIBRARIES@ $(DDE_DLL_FILE) $(REG_DLL_FILE) $(TCLSH) $(TCLKIT) +binaries: $(TCL_STUB_LIB_FILE) @LIBRARIES@ $(DDE_DLL_FILE) $(REG_DLL_FILE) $(TCLSH) libraries: @@ -430,7 +430,7 @@ $(TCLSH): $(TCLSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) @VC_MANIFEST_EMBED_EXE@ -tclkit: $(TCLKIT) +tclzsh: $(TCLZSH) null.zip: touch .empty @@ -438,33 +438,33 @@ null.zip: # Rather than force an install, pack the files we need into a # file system under our control -tclkit.vfs: $(TCLSH) $(DDE_DLL_FILE) $(REG_DLL_FILE) - @echo "Building VFS File system in tclkit.vfs" +tclzsh.vfs: $(TCLSH) $(DDE_DLL_FILE) $(REG_DLL_FILE) + @echo "Building VFS File system in tclzsh.vfs" @$(TCL_EXE) "$(ROOT_DIR)/tools/mkVfs.tcl" \ - "$(WIN_DIR)/tclkit.vfs/tcl$(VERSION)" "$(ROOT_DIR)" windows + "$(WIN_DIR)/tclzsh.vfs/tcl$(VERSION)" "$(ROOT_DIR)" windows -tclkit_bare: $(TCLKIT_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) - $(CC) $(CFLAGS) $(TCLKIT_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ +tclzsh_bare: $(TCLZSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) + $(CC) $(CFLAGS) $(TCLZSH_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) @VC_MANIFEST_EMBED_EXE@ -$(TCLKIT): tclkit_bare null.zip tclkit.vfs - cp tclkit_bare tclkit.zip - cat null.zip >> tclkit.zip - cd tclkit.vfs ; zip -rAq $(WIN_DIR)/tclkit.zip . - mv tclkit.zip $(TCLKIT) +$(TCLZSH): tclzsh_bare null.zip tclzsh.vfs + cp tclzsh_bare tclzsh.zip + cat null.zip >> tclzsh.zip + cd tclzsh.vfs ; zip -rAq $(WIN_DIR)/tclzsh.zip . + mv tclzsh.zip $(TCLZSH) # Builds an executable directly from the Tcl sources -tclkit-direct: $(TCLKIT_OBJS) ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLIB_OBJS} @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclkit.vfs +tclzsh-direct: $(TCLZSH_OBJS) ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLIB_OBJS} @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclzsh.vfs rm *.$(OBJEXT) - $(CC) $(CFLAGS) -DSTATIC_BUILD -UUSE_STUBS $(TCLKIT_OBJS) \ + $(CC) $(CFLAGS) -DSTATIC_BUILD -UUSE_STUBS $(TCLZSH_OBJS) \ ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLIB_OBJS} \ $(LIBS) \ tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) @VC_MANIFEST_EMBED_EXE@ rm *.$(OBJEXT) - cat null.zip >> $(TCLKIT) - cd tclkit.vfs ; zip -rAq $(WIN_DIR)/$(TCLKIT) . + cat null.zip >> $(TCLZSH) + cd tclzsh.vfs ; zip -rAq $(WIN_DIR)/$(TCLZSH) . cat32.$(OBJEXT): cat.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) @@ -529,7 +529,7 @@ testMain.${OBJEXT}: tclAppInit.c tclMain2.${OBJEXT}: tclMain.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_ASCII_MAIN @DEPARG@ $(CC_OBJNAME) -tclKitInit.${OBJEXT}: tclAppInit.c +tclZipShInit.${OBJEXT}: tclAppInit.c $(CC) -c $(CC_SWITCHES) -DTCL_ZIPVFS @DEPARG@ $(CC_OBJNAME) # TIP #59, embedding of configuration information into the binary library. @@ -616,7 +616,7 @@ install-binaries: binaries else true; \ fi; \ done; - @for i in $(TCL_DLL_FILE) $(ZLIB_DLL_FILE) $(TCLSH) $(TCLKIT); \ + @for i in $(TCL_DLL_FILE) $(ZLIB_DLL_FILE) $(TCLSH) $(TCLZSH); \ do \ if [ -f $$i ]; then \ echo "Installing $$i to $(BIN_INSTALL_DIR)/"; \ @@ -781,9 +781,9 @@ cleanhelp: clean: cleanhelp clean-packages $(RM) *.lib *.a *.exp *.dll *.$(RES) *.${OBJEXT} *~ \#* TAGS a.out - $(RM) $(TCLSH) $(CAT32) $(TCLKIT) null.zip - $(RM) *.pch *.ilk *.pdb tclkit* - $(RMDIR) tclkit.vfs + $(RM) $(TCLSH) $(CAT32) $(TCLZSH) null.zip + $(RM) *.pch *.ilk *.pdb tclzsh* + $(RMDIR) tclzsh.vfs distclean: distclean-packages clean $(RM) Makefile config.status config.cache config.log tclConfig.sh \ @@ -915,8 +915,8 @@ html-tk: $(TCLSH) .PHONY: install-doc install-private-headers test test-tcl runtest shell .PHONY: gdb depend cleanhelp clean distclean packages install-packages .PHONY: test-packages clean-packages distclean-packages genstubs html -.PHONY: html-tcl html-tk tclkit -.PHONY: tclkit-direct tclkit-dynamic tclkit-kitlib +.PHONY: html-tcl html-tk tclzsh +.PHONY: tclzsh-direct tclzsh-dynamic tclzsh-kitlib # DO NOT DELETE THIS LINE -- make depend depends on it. -- cgit v0.12 From 6826dbab466f01f5d52b4ff477e810297aa96991 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 20 Oct 2014 20:54:05 +0000 Subject: Added the zipfile::encode routine from Tcllib, and a rudimentary zipfile decode as a package "zvfstools" --- library/zvfstools/pkgIndex.tcl | 2 + library/zvfstools/zvfstools.tcl | 309 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 311 insertions(+) create mode 100644 library/zvfstools/pkgIndex.tcl create mode 100644 library/zvfstools/zvfstools.tcl diff --git a/library/zvfstools/pkgIndex.tcl b/library/zvfstools/pkgIndex.tcl new file mode 100644 index 0000000..23a8040 --- /dev/null +++ b/library/zvfstools/pkgIndex.tcl @@ -0,0 +1,2 @@ +if {![package vsatisfies [package provide zvfs] 1.0]} {return} +package ifneeded zvfstools 0.1 [list source [file join $dir zvfstools.tcl]] diff --git a/library/zvfstools/zvfstools.tcl b/library/zvfstools/zvfstools.tcl new file mode 100644 index 0000000..05119c6 --- /dev/null +++ b/library/zvfstools/zvfstools.tcl @@ -0,0 +1,309 @@ +# -*- tcl -*- +# ### ### ### ######### ######### ######### +## Copyright (c) 2008-2009 ActiveState Software Inc. +## Andreas Kupries +## Copyright (C) 2009 Pat Thoyts +## Copyright (C) 2014 Sean Woods +## +## BSD License +## +# Package providing commands for: +# * the generation of a zip archive, +# * building a zip archive from a file system +# * building a file system from a zip archive + +package require Tcl 8.6 +package require zvfs 1.0 +# Cop +# +# Create ZIP archives in Tcl. +# +# Create a zipkit using mkzip filename.zkit -zipkit -directory xyz.vfs +# or a zipfile using mkzip filename.zip -directory dirname -exclude "*~" +# + +proc ::zvfs::setbinary chan { + fconfigure $chan \ + -encoding binary \ + -translation binary \ + -eofchar {} + +} + +# zip::timet_to_dos +# +# Convert a unix timestamp into a DOS timestamp for ZIP times. +# +# DOS timestamps are 32 bits split into bit regions as follows: +# 24 16 8 0 +# +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +# |Y|Y|Y|Y|Y|Y|Y|m| |m|m|m|d|d|d|d|d| |h|h|h|h|h|m|m|m| |m|m|m|s|s|s|s|s| +# +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +# +proc ::zvfs::timet_to_dos {time_t} { + set s [clock format $time_t -format {%Y %m %e %k %M %S}] + scan $s {%d %d %d %d %d %d} year month day hour min sec + expr {(($year-1980) << 25) | ($month << 21) | ($day << 16) + | ($hour << 11) | ($min << 5) | ($sec >> 1)} +} + +# zip::pop -- +# +# Pop an element from a list +# +proc ::zvfs::pop {varname {nth 0}} { + upvar $varname args + set r [lindex $args $nth] + set args [lreplace $args $nth $nth] + return $r +} + +# zip::walk -- +# +# Walk a directory tree rooted at 'path'. The excludes list can be +# a set of glob expressions to match against files and to avoid. +# The match arg is internal. +# eg: walk library {CVS/* *~ .#*} to exclude CVS and emacs cruft. +# +proc ::zvfs::walk {base {excludes ""} {match *} {path {}}} { + set result {} + set imatch [file join $path $match] + set files [glob -nocomplain -tails -types f -directory $base $imatch] + foreach file $files { + set excluded 0 + foreach glob $excludes { + if {[string match $glob $file]} { + set excluded 1 + break + } + } + if {!$excluded} {lappend result $file} + } + foreach dir [glob -nocomplain -tails -types d -directory $base $imatch] { + set subdir [walk $base $excludes $match $dir] + if {[llength $subdir]>0} { + set result [concat $result [list $dir] $subdir] + } + } + return $result +} + +# zvfs::add_file_to_archive -- +# +# Add a single file to a zip archive. The zipchan channel should +# already be open and binary. You may provide a comment for the +# file The return value is the central directory record that +# will need to be used when finalizing the zip archive. +# +# FIX ME: should handle the current offset for non-seekable channels +# +proc ::zvfs::add_file_to_archive {zipchan base path {comment ""}} { + set fullpath [file join $base $path] + set mtime [timet_to_dos [file mtime $fullpath]] + if {[file isdirectory $fullpath]} { + append path / + } + set utfpath [encoding convertto utf-8 $path] + set utfcomment [encoding convertto utf-8 $comment] + set flags [expr {(1<<11)}] ;# utf-8 comment and path + set method 0 ;# store 0, deflate 8 + set attr 0 ;# text or binary (default binary) + set version 20 ;# minumum version req'd to extract + set extra "" + set crc 0 + set size 0 + set csize 0 + set data "" + set seekable [expr {[tell $zipchan] != -1}] + if {[file isdirectory $fullpath]} { + set attrex 0x41ff0010 ;# 0o040777 (drwxrwxrwx) + } elseif {[file executable $fullpath]} { + set attrex 0x81ff0080 ;# 0o100777 (-rwxrwxrwx) + } else { + set attrex 0x81b60020 ;# 0o100666 (-rw-rw-rw-) + if {[file extension $fullpath] in {".tcl" ".txt" ".c"}} { + set attr 1 ;# text + } + } + + if {[file isfile $fullpath]} { + set size [file size $fullpath] + if {!$seekable} {set flags [expr {$flags | (1 << 3)}]} + } + + set offset [tell $zipchan] + set local [binary format a4sssiiiiss PK\03\04 \ + $version $flags $method $mtime $crc $csize $size \ + [string length $utfpath] [string length $extra]] + append local $utfpath $extra + puts -nonewline $zipchan $local + + if {[file isfile $fullpath]} { + # If the file is under 2MB then zip in one chunk, otherwize we use + # streaming to avoid requiring excess memory. This helps to prevent + # storing re-compressed data that may be larger than the source when + # handling PNG or JPEG or nested ZIP files. + if {$size < 0x00200000} { + set fin [::open $fullpath rb] + setbinary $fin + set data [::read $fin] + set crc [::zlib crc32 $data] + set cdata [::zlib deflate $data] + if {[string length $cdata] < $size} { + set method 8 + set data $cdata + } + close $fin + set csize [string length $data] + puts -nonewline $zipchan $data + } else { + set method 8 + set fin [::open $fullpath rb] + setbinary $fin + set zlib [::zlib stream deflate] + while {![eof $fin]} { + set data [read $fin 4096] + set crc [zlib crc32 $data $crc] + $zlib put $data + if {[string length [set zdata [$zlib get]]]} { + incr csize [string length $zdata] + puts -nonewline $zipchan $zdata + } + } + close $fin + $zlib finalize + set zdata [$zlib get] + incr csize [string length $zdata] + puts -nonewline $zipchan $zdata + $zlib close + } + + if {$seekable} { + # update the header if the output is seekable + set local [binary format a4sssiiii PK\03\04 \ + $version $flags $method $mtime $crc $csize $size] + set current [tell $zipchan] + seek $zipchan $offset + puts -nonewline $zipchan $local + seek $zipchan $current + } else { + # Write a data descriptor record + set ddesc [binary format a4iii PK\7\8 $crc $csize $size] + puts -nonewline $zipchan $ddesc + } + } + + set hdr [binary format a4ssssiiiisssssii PK\01\02 0x0317 \ + $version $flags $method $mtime $crc $csize $size \ + [string length $utfpath] [string length $extra]\ + [string length $utfcomment] 0 $attr $attrex $offset] + append hdr $utfpath $extra $utfcomment + return $hdr +} + +# zvfs::mkzip -- +# +# Create a zip archive in 'filename'. If a file already exists it will be +# overwritten by a new file. If '-directory' is used, the new zip archive +# will be rooted in the provided directory. +# -runtime can be used to specify a prefix file. For instance, +# zip myzip -runtime unzipsfx.exe -directory subdir +# will create a self-extracting zip archive from the subdir/ folder. +# The -comment parameter specifies an optional comment for the archive. +# +# eg: zip my.zip -directory Subdir -runtime unzipsfx.exe *.txt +# +proc ::zvfs::mkzip {filename args} { + array set opts { + -zipkit 0 -runtime "" -comment "" -directory "" + -exclude {CVS/* */CVS/* *~ ".#*" "*/.#*"} + } + + while {[string match -* [set option [lindex $args 0]]]} { + switch -exact -- $option { + -zipkit { set opts(-zipkit) 1 } + -comment { set opts(-comment) [encoding convertto utf-8 [pop args 1]] } + -runtime { set opts(-runtime) [pop args 1] } + -directory {set opts(-directory) [file normalize [pop args 1]] } + -exclude {set opts(-exclude) [pop args 1] } + -- { pop args ; break } + default { + break + } + } + pop args + } + + set zf [::open $filename wb] + setbinary $zf + if {$opts(-runtime) ne ""} { + set rt [::open $opts(-runtime) rb] + setbinary $rt + fcopy $rt $zf + close $rt + } elseif {$opts(-zipkit)} { + set zkd "#!/usr/bin/env tclkit\n\# This is a zip-based Tcl Module\n" + append zkd "package require vfs::zip\n" + append zkd "vfs::zip::Mount \[info script\] \[info script\]\n" + append zkd "if {\[file exists \[file join \[info script\] main.tcl\]\]} \{\n" + append zkd " source \[file join \[info script\] main.tcl\]\n" + append zkd "\}\n" + append zkd \x1A + puts -nonewline $zf $zkd + } + + set count 0 + set cd "" + + if {$opts(-directory) ne ""} { + set paths [walk $opts(-directory) $opts(-exclude)] + } else { + set paths [glob -nocomplain {*}$args] + } + foreach path $paths { + puts $path + append cd [add_file_to_archive $zf $opts(-directory) $path] + incr count + } + set cdoffset [tell $zf] + set endrec [binary format a4ssssiis PK\05\06 0 0 \ + $count $count [string length $cd] $cdoffset\ + [string length $opts(-comment)]] + append endrec $opts(-comment) + puts -nonewline $zf $cd + puts -nonewline $zf $endrec + close $zf + + return +} + +### +# Decode routines +### +proc ::zvfs::copy_file {zipbase destbase file} { + set l [string length $zipbase] + set relname [string trimleft [string range $file $l end] /] + if {[file isdirectory $file]} { + foreach sfile [glob -nocomplain $file/*] { + file mkdir [file join $destbase $relname] + copy_file $zipbase $destbase $sfile + } + return + } + file copy -force $file [file join $destbase $relname] +} + +# ### ### ### ######### ######### ######### +## Convenience command, decode and copy to dir +proc ::zvfs::unzip {in out} { + set root /ziptmp#[incr ::zvfs::count] + zvfs::mount $in $root + set out [file normalize $out] + foreach file [glob $root/*] { + copy_file $root $out $file + } + zvfs::unmount $in + return +} + +package provide zvfstools 0.1 -- cgit v0.12 From 9171dde34641416c1530c7a8ba9aa49ca267a55c Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 21 Oct 2014 01:04:07 +0000 Subject: Replaced calls to zip with calls to the new pure-tcl zipfile encoder embedded in zvfstools. Fixed a bug in the encoder for zvfstools. It was exporting files, but not directories. This lack of directories was causing the bootloader to miss that /zvfs/boot/tcl/init.tcl existed, because it was checking for the existance of /zvfs/boot/tcl. I compared the archives created by zvfstools::mkzip to the archives created by zip, and the difference came down to the fact that zip did create TOC entries for directories and zvfstools::mkzip was failing to do so. (So I'm pretty sure the new behavior is "standard.") --- library/zvfstools/zvfstools.tcl | 28 ++++++++++++++++++++-------- tools/mkzip.tcl | 6 ++++++ unix/Makefile.in | 15 +++++---------- win/Makefile.in | 12 ++++++------ 4 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 tools/mkzip.tcl diff --git a/library/zvfstools/zvfstools.tcl b/library/zvfstools/zvfstools.tcl index 05119c6..f755283 100644 --- a/library/zvfstools/zvfstools.tcl +++ b/library/zvfstools/zvfstools.tcl @@ -80,6 +80,7 @@ proc ::zvfs::walk {base {excludes ""} {match *} {path {}}} { if {!$excluded} {lappend result $file} } foreach dir [glob -nocomplain -tails -types d -directory $base $imatch] { + lappend result $dir set subdir [walk $base $excludes $match $dir] if {[llength $subdir]>0} { set result [concat $result [list $dir] $subdir] @@ -137,7 +138,7 @@ proc ::zvfs::add_file_to_archive {zipchan base path {comment ""}} { [string length $utfpath] [string length $extra]] append local $utfpath $extra puts -nonewline $zipchan $local - + if {[file isfile $fullpath]} { # If the file is under 2MB then zip in one chunk, otherwize we use # streaming to avoid requiring excess memory. This helps to prevent @@ -242,12 +243,24 @@ proc ::zvfs::mkzip {filename args} { fcopy $rt $zf close $rt } elseif {$opts(-zipkit)} { - set zkd "#!/usr/bin/env tclkit\n\# This is a zip-based Tcl Module\n" - append zkd "package require vfs::zip\n" - append zkd "vfs::zip::Mount \[info script\] \[info script\]\n" - append zkd "if {\[file exists \[file join \[info script\] main.tcl\]\]} \{\n" - append zkd " source \[file join \[info script\] main.tcl\]\n" - append zkd "\}\n" + set zkd {#!/usr/bin/env tclsh +# This is a zip-based Tcl Module +if {![package vsatisfies [package provide zvfs] 1.0]} { + package require vfs::zip + vfs::zip::Mount [info script] [info script] +} else { + zvfs::mount [info script] [info script] +} +# Load any CLIP file present +if {[file exists [file join [info script] pkgIndex.tcl]] } { + set dir [info script] + source [file join [info script] pkgIndex.tcl] +} +# Run any main.tcl present +if {[file exists [file join [info script] main.tcl]] } { + source [file join [info script] main.tcl] +} + } append zkd \x1A puts -nonewline $zf $zkd } @@ -261,7 +274,6 @@ proc ::zvfs::mkzip {filename args} { set paths [glob -nocomplain {*}$args] } foreach path $paths { - puts $path append cd [add_file_to_archive $zf $opts(-directory) $path] incr count } diff --git a/tools/mkzip.tcl b/tools/mkzip.tcl new file mode 100644 index 0000000..e53bae3 --- /dev/null +++ b/tools/mkzip.tcl @@ -0,0 +1,6 @@ +### +# Wrapper to allow access to Tcl's zvfs::mkzip command from Makefiles +### +package require zvfs +source [file join [file dirname [file normalize [info script]]] .. library zvfstools zvfstools.tcl] +zvfs::mkzip {*}$argv diff --git a/unix/Makefile.in b/unix/Makefile.in index 918e9fc..b635c0a 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -661,10 +661,6 @@ ${TCL_EXE}: ${TCLSH_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} # Must be empty so it doesn't conflict with rule for ${TCL_EXE} above ${NATIVE_TCLSH}: -null.zip: - touch .empty - zip null.zip .empty - # Rather than force an install, pack the files we need into a # file system under our control tclzsh.vfs: @@ -681,13 +677,12 @@ ${TCLZSH_BASE}_bare: ${TCLZSH_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} ${LIBS} @EXTRA_TCLSH_LIBS@ \ ${CC_SEARCH_FLAGS} -o ${TCLZSH_BASE}_bare - # Builds an executable linked to the Tcl dynamic library -${TCLZSH_EXE}: ${TCLZSH_BASE}_bare null.zip tclzsh.vfs - cp -f ${TCLZSH_BASE}_bare ${TCLZSH_BASE}.zip - cat null.zip >> ${TCLZSH_BASE}.zip - cd tclzsh.vfs ; zip -rAq ${UNIX_DIR}/${TCLZSH_BASE}.zip . - mv ${TCLZSH_BASE}.zip ${TCLZSH_EXE} +${TCLZSH_EXE}: ${TCLZSH_BASE}_bare tclzsh.vfs + ./${TCLZSH_BASE}_bare ../tools/mkzip.tcl ${TCLZSH_EXE} \ + -runtime ${TCLZSH_BASE}_bare \ + -directory tclzsh.vfs + chmod a+x ${TCLZSH_EXE} # Builds an executable directly from the Tcl sources tclzsh-static: ${TCLZSH_OBJS} ${OBJS} ${ZLIB_OBJS} null.zip tclzsh.vfs diff --git a/win/Makefile.in b/win/Makefile.in index 6877938..0b34570 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -441,18 +441,18 @@ null.zip: tclzsh.vfs: $(TCLSH) $(DDE_DLL_FILE) $(REG_DLL_FILE) @echo "Building VFS File system in tclzsh.vfs" @$(TCL_EXE) "$(ROOT_DIR)/tools/mkVfs.tcl" \ - "$(WIN_DIR)/tclzsh.vfs/tcl$(VERSION)" "$(ROOT_DIR)" windows + "$(WIN_DIR)/tclzsh.vfs/boot/tcl" "$(ROOT_DIR)" windows tclzsh_bare: $(TCLZSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) $(CC) $(CFLAGS) $(TCLZSH_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) @VC_MANIFEST_EMBED_EXE@ -$(TCLZSH): tclzsh_bare null.zip tclzsh.vfs - cp tclzsh_bare tclzsh.zip - cat null.zip >> tclzsh.zip - cd tclzsh.vfs ; zip -rAq $(WIN_DIR)/tclzsh.zip . - mv tclzsh.zip $(TCLZSH) +$(TCLZSH): tclzsh_bare tclzsh.vfs + ./${TCLZSH_BASE}_bare ../tools/mkzip.tcl ${TCLZSH_EXE} \ + -runtime ${TCLZSH_BASE}_bare \ + -directory tclzsh.vfs + chmod a+x ${TCLZSH_EXE} # Builds an executable directly from the Tcl sources tclzsh-direct: $(TCLZSH_OBJS) ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLIB_OBJS} @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) null.zip tclzsh.vfs -- cgit v0.12 From bdc43f824155a8ac53c6e6d3c332f4776dd81c9e Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 21 Oct 2014 01:11:22 +0000 Subject: Tweaked zvfstools to always allows the zvfs::mkzip command, and defer the check for the rest of the zvfs tools until the first call to zvfs::unzip --- library/zvfstools/pkgIndex.tcl | 1 - library/zvfstools/zvfstools.tcl | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/library/zvfstools/pkgIndex.tcl b/library/zvfstools/pkgIndex.tcl index 23a8040..824d5b3 100644 --- a/library/zvfstools/pkgIndex.tcl +++ b/library/zvfstools/pkgIndex.tcl @@ -1,2 +1 @@ -if {![package vsatisfies [package provide zvfs] 1.0]} {return} package ifneeded zvfstools 0.1 [list source [file join $dir zvfstools.tcl]] diff --git a/library/zvfstools/zvfstools.tcl b/library/zvfstools/zvfstools.tcl index f755283..26f17c4 100644 --- a/library/zvfstools/zvfstools.tcl +++ b/library/zvfstools/zvfstools.tcl @@ -13,7 +13,6 @@ # * building a file system from a zip archive package require Tcl 8.6 -package require zvfs 1.0 # Cop # # Create ZIP archives in Tcl. @@ -307,7 +306,11 @@ proc ::zvfs::copy_file {zipbase destbase file} { # ### ### ### ######### ######### ######### ## Convenience command, decode and copy to dir +## This routine relies on zvfs::mount, so we only load +## it when the zvfs package is present +## proc ::zvfs::unzip {in out} { + package require zvfs 1.0 set root /ziptmp#[incr ::zvfs::count] zvfs::mount $in $root set out [file normalize $out] @@ -317,5 +320,4 @@ proc ::zvfs::unzip {in out} { zvfs::unmount $in return } - package provide zvfstools 0.1 -- cgit v0.12 From 6b423f0d9ebf71415e7d74789128eb873a77ef3a Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 21 Oct 2014 01:20:10 +0000 Subject: Fixes to allow a standard tclsh build to do the zip file encoding, instead of having to do it all through the zip enabled shell. --- library/zvfstools/zvfstools.tcl | 2 ++ tools/mkzip.tcl | 1 - unix/Makefile.in | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/library/zvfstools/zvfstools.tcl b/library/zvfstools/zvfstools.tcl index 26f17c4..274d5a1 100644 --- a/library/zvfstools/zvfstools.tcl +++ b/library/zvfstools/zvfstools.tcl @@ -21,6 +21,8 @@ package require Tcl 8.6 # or a zipfile using mkzip filename.zip -directory dirname -exclude "*~" # +namespace eval ::zvfs {} + proc ::zvfs::setbinary chan { fconfigure $chan \ -encoding binary \ diff --git a/tools/mkzip.tcl b/tools/mkzip.tcl index e53bae3..ba10908 100644 --- a/tools/mkzip.tcl +++ b/tools/mkzip.tcl @@ -1,6 +1,5 @@ ### # Wrapper to allow access to Tcl's zvfs::mkzip command from Makefiles ### -package require zvfs source [file join [file dirname [file normalize [info script]]] .. library zvfstools zvfstools.tcl] zvfs::mkzip {*}$argv diff --git a/unix/Makefile.in b/unix/Makefile.in index b635c0a..0819197 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -624,7 +624,7 @@ SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \ all: binaries libraries doc packages -binaries: ${LIB_FILE} ${TCL_EXE} +binaries: ${LIB_FILE} ${TCL_EXE} ${TCLZSH_EXE} libraries: @@ -679,7 +679,7 @@ ${TCLZSH_BASE}_bare: ${TCLZSH_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} # Builds an executable linked to the Tcl dynamic library ${TCLZSH_EXE}: ${TCLZSH_BASE}_bare tclzsh.vfs - ./${TCLZSH_BASE}_bare ../tools/mkzip.tcl ${TCLZSH_EXE} \ + @$(TCL_EXE) ../tools/mkzip.tcl ${TCLZSH_EXE} \ -runtime ${TCLZSH_BASE}_bare \ -directory tclzsh.vfs chmod a+x ${TCLZSH_EXE} -- cgit v0.12 From 85442c797ca8332eedf0a57984b72eb987eacb06 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Thu, 13 Nov 2014 14:30:26 +0000 Subject: Tweak to delete the tclzsh.vfs directory before the rm -rf tclvfs* statement in "make clean" --- unix/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 0819197..119bf9a 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -699,10 +699,10 @@ Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in # $(SHELL) config.status clean: clean-packages + rm -rf tclzsh.vfs null.zip rm -f *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \ errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ \ ${TCLZSH_EXE} tclzsh* - rm -rf tclzsh.vfs null.zip cd dltest ; $(MAKE) clean distclean: distclean-packages clean -- cgit v0.12 From 3b50f8bcd682651d5ea2b8c0d5ba72b800a1b268 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Thu, 13 Nov 2014 14:58:01 +0000 Subject: Removed _ANSI_ARGS_ macros. They were not compiling in Tk for some reason today... --- generic/tclZipVfs.c | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/generic/tclZipVfs.c b/generic/tclZipVfs.c index 80230c3..e1dea4f 100755 --- a/generic/tclZipVfs.c +++ b/generic/tclZipVfs.c @@ -1192,9 +1192,12 @@ closeReleaseDie: } -Tcl_Channel Tobe_FSOpenFileChannelProc - _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *pathPtr, - int mode, int permissions)) { +Tcl_Channel Tobe_FSOpenFileChannelProc ( + Tcl_Interp *interp, + Tcl_Obj *pathPtr, + int mode, + int permissions +) { int len; /* if (mode != O_RDONLY) return NULL; */ return ZvfsFileOpen(interp, Tcl_GetStringFromObj(pathPtr,&len), 0, @@ -1204,7 +1207,10 @@ Tcl_Channel Tobe_FSOpenFileChannelProc /* ** This routine does a stat() system call for a ZVFS file. */ -int Tobe_FSStatProc _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *buf)) { +int Tobe_FSStatProc ( + Tcl_Obj *pathPtr, + Tcl_StatBuf *buf +) { char *path=Tcl_GetString(pathPtr); ZvfsFile *pFile; @@ -1229,7 +1235,7 @@ int Tobe_FSStatProc _ANSI_ARGS_((Tcl_Obj *pathPtr, Tcl_StatBuf *buf)) { /* ** This routine does an access() system call for a ZVFS file. */ -int Tobe_FSAccessProc _ANSI_ARGS_((Tcl_Obj *pathPtr, int mode)) { +int Tobe_FSAccessProc (Tcl_Obj *pathPtr, int mode) { char *path=Tcl_GetString(pathPtr); ZvfsFile *pFile; @@ -1370,8 +1376,10 @@ int Tobe_FSMatchInDirectoryProc ( /* Function to check whether a path is in * this filesystem. This is the most * important filesystem procedure. */ -int Tobe_FSPathInFilesystemProc _ANSI_ARGS_((Tcl_Obj *pathPtr, - ClientData *clientDataPtr)) { +int Tobe_FSPathInFilesystemProc ( + Tcl_Obj *pathPtr, + ClientData *clientDataPtr +) { ZvfsFile *zFile; char *path = Tcl_GetString(pathPtr); @@ -1385,7 +1393,7 @@ int Tobe_FSPathInFilesystemProc _ANSI_ARGS_((Tcl_Obj *pathPtr, return -1; } -Tcl_Obj *Tobe_FSListVolumesProc _ANSI_ARGS_((void)) { +Tcl_Obj *Tobe_FSListVolumesProc (void) { Tcl_HashEntry *pEntry; /* Hash table entry */ Tcl_HashSearch zSearch; /* Search all mount points */ ZvfsArchive *pArchive; /* The ZIP archive being mounted */ @@ -1411,7 +1419,7 @@ Tcl_Obj *Tobe_FSListVolumesProc _ANSI_ARGS_((void)) { return pVols; } -int Tobe_FSChdirProc _ANSI_ARGS_((Tcl_Obj *pathPtr)) { +int Tobe_FSChdirProc (Tcl_Obj *pathPtr) { /* Someday, we should actually check if this is a valid path. */ return TCL_OK; } @@ -1437,9 +1445,12 @@ Tobe_FSFileAttrStringsProc( return attrs; } -int Tobe_FSFileAttrsGetProc _ANSI_ARGS_((Tcl_Interp *interp, - int index, Tcl_Obj *pathPtr, - Tcl_Obj **objPtrRef)) { +int Tobe_FSFileAttrsGetProc ( + Tcl_Interp *interp, + int index, + Tcl_Obj *pathPtr, + Tcl_Obj **objPtrRef +) { char *zFilename; ZvfsFile *pFile; zFilename = Tcl_GetString(pathPtr); @@ -1489,12 +1500,13 @@ int Tobe_FSFileAttrsGetProc _ANSI_ARGS_((Tcl_Interp *interp, } return TCL_OK; } -int Tobe_FSFileAttrsSetProc _ANSI_ARGS_((Tcl_Interp *interp, - int index, Tcl_Obj *pathPtr, - Tcl_Obj *objPtr)) { return TCL_ERROR; } +int Tobe_FSFileAttrsSetProc ( + Tcl_Interp *interp, + int index, + Tcl_Obj *pathPtr, + Tcl_Obj *objPtr) { return TCL_ERROR; } -Tcl_Obj* Tobe_FSFilesystemPathTypeProc - _ANSI_ARGS_((Tcl_Obj *pathPtr)) { +Tcl_Obj* Tobe_FSFilesystemPathTypeProc (Tcl_Obj *pathPtr) { return Tcl_NewStringObj("zip",-1); } -- cgit v0.12 From 9cbfbd034eadccd7a7b0e8dbca255772563e12a1 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Thu, 13 Nov 2014 15:50:08 +0000 Subject: Add a mode for injecting the TkDll into the VFS --- tools/mkVfs.tcl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/mkVfs.tcl b/tools/mkVfs.tcl index bc6f3aa..e670775 100644 --- a/tools/mkVfs.tcl +++ b/tools/mkVfs.tcl @@ -60,6 +60,8 @@ if {[llength $argv] < 3} { set TCL_SCRIPT_DIR [lindex $argv 0] set TCLSRC_ROOT [lindex $argv 1] set PLATFORM [lindex $argv 2] +set TKDLL [lindex $argv 3] +set TKVER [lindex $argv 4] puts "Building [file tail $TCL_SCRIPT_DIR] for $PLATFORM" copyDir ${TCLSRC_ROOT}/library ${TCL_SCRIPT_DIR} @@ -89,5 +91,9 @@ puts $fout {# # set VFSROOT $dir } +if {$TKDLL ne {} && [file exists $TKDLL]} { + file copy $TKDLL ${TCL_SCRIPT_DIR} + puts $fout [list package ifneeded Tk $TKVER "load \$dir $TKDLL"] +} pkgIndexDir ${TCL_SCRIPT_DIR} $fout ${TCL_SCRIPT_DIR} close $fout -- cgit v0.12 From 59490956934d2a83726ccbf16c5ce01fe269156a Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sat, 15 Nov 2014 00:12:00 +0000 Subject: For the feature branch we now enable Zip file functions for all shells in Unix, and explicitly name a new executable "basekit", which is a statically linked tclsh with an attached library VFS --- unix/Makefile.in | 58 +++++++++++++++++++------------------------------------ unix/tclAppInit.c | 12 +++--------- 2 files changed, 23 insertions(+), 47 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 119bf9a..291f73b 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -168,12 +168,7 @@ INSTALL_DATA_DIR = ${INSTALL} -d -m 755 # Do not use SHELL_ENV for NATIVE_TCLSH unless it is the tclsh being built. EXE_SUFFIX = @EXEEXT@ TCL_EXE = tclsh${EXE_SUFFIX} -ifeq ($(SHARED_BUILD),0) -TCLZSH_BASE = tclzshs -else -TCLZSH_BASE = tclzshd -endif -TCLZSH_EXE = ${TCLZSH_BASE}${EXE_SUFFIX} +BASEKIT_EXE = basekit${EXE_SUFFIX} TCLTEST_EXE = tcltest${EXE_SUFFIX} NATIVE_TCLSH = @TCLSH_PROG@ @@ -290,7 +285,7 @@ LIBS = @TCL_LIBS@ DEPEND_SWITCHES = ${CFLAGS} -I${UNIX_DIR} -I${GENERIC_DIR} \ ${AC_FLAGS} ${PROTO_FLAGS} ${EXTRA_CFLAGS} @EXTRA_CC_SWITCHES@ -TCLSH_OBJS = tclAppInit.o +TCLSH_OBJS = tclAppInit.o tclZipVfs.o tclZipVfsBoot.o TCLTEST_OBJS = tclTestInit.o tclTest.o tclTestObj.o tclTestProcBodyObj.o \ tclThreadTest.o tclUnixTest.o @@ -367,8 +362,6 @@ ZLIB_OBJS = Zadler32.o Zcompress.o Zcrc32.o Zdeflate.o Zinfback.o \ TCL_OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${NOTIFY_OBJS} ${COMPAT_OBJS} \ ${OO_OBJS} @DL_OBJS@ @PLAT_OBJS@ -TCLZSH_OBJS = tclZipShInit.o tclZipVfs.o tclZipVfsBoot.o - OBJS = ${TCL_OBJS} ${TOMMATH_OBJS} @DTRACE_OBJ@ @ZLIB_OBJS@ TCL_DECLS = \ @@ -624,7 +617,7 @@ SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \ all: binaries libraries doc packages -binaries: ${LIB_FILE} ${TCL_EXE} ${TCLZSH_EXE} +binaries: ${LIB_FILE} ${TCL_EXE} ${BASEKIT_EXE} libraries: @@ -663,35 +656,24 @@ ${NATIVE_TCLSH}: # Rather than force an install, pack the files we need into a # file system under our control -tclzsh.vfs: - @echo "Building VFS File system in tclzsh.vfs" +basekit.vfs: + @echo "Building VFS File system in basekit.vfs" @$(TCL_EXE) "$(TOP_DIR)/tools/mkVfs.tcl" \ - "$(UNIX_DIR)/tclzsh.vfs/boot/tcl" "$(TOP_DIR)" unix + "$(UNIX_DIR)/basekit.vfs/boot/tcl" "$(TOP_DIR)" unix -tclzsh: ${TCLZSH_EXE} +# Builds an executable directly from the Tcl sources +${BASEKIT_EXE}: ${TCLSH_OBJS} ${OBJS} ${ZLIB_OBJS} basekit.vfs -${TCLZSH_BASE}_bare: ${TCLZSH_OBJS} ${TCL_LIB_FILE} ${TCL_STUB_LIB_FILE} ${CC} ${CFLAGS} ${LDFLAGS} \ - ${TCLZSH_OBJS} \ - @TCL_BUILD_LIB_SPEC@ \ + ${TCLSH_OBJS} ${OBJS} ${ZLIB_OBJS} \ ${LIBS} @EXTRA_TCLSH_LIBS@ \ - ${CC_SEARCH_FLAGS} -o ${TCLZSH_BASE}_bare + ${CC_SEARCH_FLAGS} -o ${BASEKIT_EXE}_bare + @echo zipping... + @$(TCL_EXE) ../tools/mkzip.tcl ${BASEKIT_EXE} \ + -runtime ${BASEKIT_EXE}_bare \ + -directory basekit.vfs + chmod a+x ${BASEKIT_EXE} -# Builds an executable linked to the Tcl dynamic library -${TCLZSH_EXE}: ${TCLZSH_BASE}_bare tclzsh.vfs - @$(TCL_EXE) ../tools/mkzip.tcl ${TCLZSH_EXE} \ - -runtime ${TCLZSH_BASE}_bare \ - -directory tclzsh.vfs - chmod a+x ${TCLZSH_EXE} - -# Builds an executable directly from the Tcl sources -tclzsh-static: ${TCLZSH_OBJS} ${OBJS} ${ZLIB_OBJS} null.zip tclzsh.vfs - ${CC} ${CFLAGS} ${LDFLAGS} \ - ${TCLZSH_OBJS} ${OBJS} ${ZLIB_OBJS} \ - ${LIBS} @EXTRA_TCLSH_LIBS@ \ - ${CC_SEARCH_FLAGS} -o ${TCLZSH_EXE} - cat null.zip >> ${TCLZSH_EXE} - cd tclzsh.vfs ; zip -rAq ${UNIX_DIR}/${TCLZSH_EXE} . Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in $(SHELL) config.status @@ -699,10 +681,10 @@ Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in # $(SHELL) config.status clean: clean-packages - rm -rf tclzsh.vfs null.zip + rm -rf basekit.vfs null.zip rm -f *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \ errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ \ - ${TCLZSH_EXE} tclzsh* + ${BASEKIT_EXE} basekit* cd dltest ; $(MAKE) clean distclean: distclean-packages clean @@ -846,8 +828,9 @@ install-binaries: binaries @chmod 555 "$(DLL_INSTALL_DIR)/$(LIB_FILE)" @echo "Installing ${TCL_EXE} as $(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" @$(INSTALL_PROGRAM) ${TCL_EXE} "$(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" - @echo "Installing ${TCLZSH_EXE} as $(BIN_INSTALL_DIR)/${TCLZSH_BASE}$(VERSION)${EXE_SUFFIX}" - @$(INSTALL_PROGRAM) ${TCLZSH_EXE} "$(BIN_INSTALL_DIR)/${TCLZSH_BASE}$(VERSION)${EXE_SUFFIX}" + @echo "Installing ${BASEKIT_EXE} as $(BIN_INSTALL_DIR)/${BASEKIT_EXE}$(VERSION)${EXE_SUFFIX}" + @$(INSTALL_PROGRAM) ${BASEKIT_EXE} "$(BIN_INSTALL_DIR)/${BASEKIT_EXE}$(VERSION)${EXE_SUFFIX}" + @echo "Installing tclConfig.sh to $(CONFIG_INSTALL_DIR)/" @$(INSTALL_DATA) tclConfig.sh "$(CONFIG_INSTALL_DIR)/tclConfig.sh" @echo "Installing tclooConfig.sh to $(CONFIG_INSTALL_DIR)/" @@ -2181,7 +2164,6 @@ BUILD_HTML = \ .PHONY: install-tzdata install-msgs .PHONY: packages configure-packages test-packages clean-packages .PHONY: dist-packages distclean-packages install-packages -.PHONY: tclzsh-static tclzsh #-------------------------------------------------------------------------- # DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index 1be1ce3..4b5d1f6 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -40,12 +40,10 @@ extern Tcl_PackageInitProc Tclxttest_Init; #endif MODULE_SCOPE int TCL_LOCAL_APPINIT(Tcl_Interp *); MODULE_SCOPE int main(int, char **); -#ifdef TCL_ZIPVFS - MODULE_SCOPE int Tcl_Zvfs_Boot(const char *,const char *,const char *); - MODULE_SCOPE int Zvfs_Init(Tcl_Interp *); - MODULE_SCOPE int Zvfs_SafeInit(Tcl_Interp *); +MODULE_SCOPE int Tcl_Zvfs_Boot(const char *,const char *,const char *); +MODULE_SCOPE int Zvfs_Init(Tcl_Interp *); +MODULE_SCOPE int Zvfs_SafeInit(Tcl_Interp *); -#endif /* TCL_ZIPVFS */ /* * The following #if block allows you to change how Tcl finds the startup * script, prime the library or encoding paths, fiddle with the argv, etc., @@ -85,13 +83,11 @@ main( #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif -#ifdef TCL_ZIPVFS #define TCLKIT_INIT "main.tcl" #define TCLKIT_VFSMOUNT "/zvfs" Tcl_FindExecutable(argv[0]); CONST char *cp=Tcl_GetNameOfExecutable(); Tcl_Zvfs_Boot(cp,TCLKIT_VFSMOUNT,TCLKIT_INIT); -#endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } @@ -122,13 +118,11 @@ Tcl_AppInit( if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } -#ifdef TCL_ZIPVFS /* Load the ZipVfs package */ Tcl_StaticPackage(interp, "zvfs", Zvfs_Init, Zvfs_SafeInit); if(Zvfs_Init(interp) == TCL_ERROR) { return TCL_ERROR; } -#endif #ifdef TCL_XT_TEST if (Tclxttest_Init(interp) == TCL_ERROR) { return TCL_ERROR; -- cgit v0.12 From ded95f89d34b0a06df4a2faed54558431643170f Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 17 Nov 2014 15:04:05 +0000 Subject: Added the zvfstools file to the installer --- unix/Makefile.in | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 291f73b..be769a4 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -617,7 +617,7 @@ SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \ all: binaries libraries doc packages -binaries: ${LIB_FILE} ${TCL_EXE} ${BASEKIT_EXE} +binaries: ${LIB_FILE} ${TCL_EXE} ${BASEKIT_EXE}_bare basekit.zip libraries: @@ -661,6 +661,10 @@ basekit.vfs: @$(TCL_EXE) "$(TOP_DIR)/tools/mkVfs.tcl" \ "$(UNIX_DIR)/basekit.vfs/boot/tcl" "$(TOP_DIR)" unix +basekit.zip: basekit.vfs + @$(TCL_EXE) ../tools/mkzip.tcl basekit.zip \ + -directory basekit.vfs + # Builds an executable directly from the Tcl sources ${BASEKIT_EXE}: ${TCLSH_OBJS} ${OBJS} ${ZLIB_OBJS} basekit.vfs @@ -828,8 +832,12 @@ install-binaries: binaries @chmod 555 "$(DLL_INSTALL_DIR)/$(LIB_FILE)" @echo "Installing ${TCL_EXE} as $(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" @$(INSTALL_PROGRAM) ${TCL_EXE} "$(BIN_INSTALL_DIR)/tclsh$(VERSION)${EXE_SUFFIX}" - @echo "Installing ${BASEKIT_EXE} as $(BIN_INSTALL_DIR)/${BASEKIT_EXE}$(VERSION)${EXE_SUFFIX}" - @$(INSTALL_PROGRAM) ${BASEKIT_EXE} "$(BIN_INSTALL_DIR)/${BASEKIT_EXE}$(VERSION)${EXE_SUFFIX}" + @echo "Installing ${BASEKIT_EXE}_bare as $(BIN_INSTALL_DIR)/${BASEKIT_EXE}$(VERSION)${EXE_SUFFIX}" + @$(INSTALL_PROGRAM) ${BASEKIT_EXE}_bare "$(BIN_INSTALL_DIR)/${BASEKIT_EXE}$(VERSION)${EXE_SUFFIX}" + + @echo "Installing basekit.zip as $(BIN_INSTALL_DIR)/basekit$(VERSION).zip" + @$(INSTALL_PROGRAM) basekit.zip "$(BIN_INSTALL_DIR)/basekit$(VERSION).zip" + @echo "Installing tclConfig.sh to $(CONFIG_INSTALL_DIR)/" @$(INSTALL_DATA) tclConfig.sh "$(CONFIG_INSTALL_DIR)/tclConfig.sh" @@ -890,6 +898,9 @@ install-libraries: libraries @echo "Installing package platform::shell 1.1.4 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/platform/shell.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform/shell-1.1.4.tm; + @echo "Installing package zvfstools 0.1 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/zvfstools/zvfstools.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.6/zvfstools-0.1.tm; + @echo "Installing encoding files to $(SCRIPT_INSTALL_DIR)/encoding/"; @for i in $(TOP_DIR)/library/encoding/*.enc ; do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/encoding; \ -- cgit v0.12 From dd60d528143a4f125200655aee2defc814066401 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 17 Jan 2015 18:40:19 +0000 Subject: apply contributed patch which fixes a segfault --- generic/tclCmdMZ.c | 4 ++++ generic/tclStringObj.c | 31 ++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 4ed353e..58196a3 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1085,6 +1085,10 @@ Tcl_SplitObjCmd( for ( ; stringPtr < end; stringPtr += len) { len = TclUtfToUniChar(stringPtr, &ch); + + if (!len) { + continue; + } /* * Assume Tcl_UniChar is an integral type... diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 2df6dd8..0ae5a7c 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -672,6 +672,7 @@ Tcl_GetRange( { Tcl_Obj *newObjPtr; /* The Tcl object to find the range of. */ String *stringPtr; + int i, firstoffset = 0, lastoffset = 0; /* * Optimize the case where we're really dealing with a bytearray object @@ -716,7 +717,17 @@ Tcl_GetRange( stringPtr = GET_STRING(objPtr); } - return Tcl_NewUnicodeObj(stringPtr->unicode + first, last-first+1); + for (i = 0; i <= last + lastoffset + firstoffset; i++) { + if ((stringPtr->unicode[i] & 0xfc00) == 0xd800) { + if (i < first + firstoffset) { + firstoffset++; + } else { + lastoffset++; + } + } + } + + return Tcl_NewUnicodeObj(stringPtr->unicode + first + firstoffset, last-first+1 + lastoffset + firstoffset); } /* @@ -2866,8 +2877,8 @@ ExtendUnicodeRepWithString( int numAppendChars) { String *stringPtr = GET_STRING(objPtr); - int needed, numOrigChars = 0; - Tcl_UniChar *dst; + int incr, needed, numOrigChars = 0; + Tcl_UniChar *dst, unichar = 0; if (stringPtr->hasUnicode) { numOrigChars = stringPtr->numChars; @@ -2890,7 +2901,12 @@ ExtendUnicodeRepWithString( numAppendChars = 0; } for (dst=stringPtr->unicode + numOrigChars; numAppendChars-- > 0; dst++) { - bytes += TclUtfToUniChar(bytes, dst); + bytes += (incr = TclUtfToUniChar(bytes, &unichar)); + *dst = unichar; + if (!incr) { + bytes += TclUtfToUniChar(bytes, &unichar); + *++dst = unichar; + } } *dst = 0; } @@ -3095,7 +3111,7 @@ ExtendStringRepWithUnicode( * Pre-condition: this is the "string" Tcl_ObjType. */ - int i, origLength, size = 0; + int incr, i, origLength, size = 0, offset = 0; char *dst, buf[TCL_UTF_MAX]; String *stringPtr = GET_STRING(objPtr); @@ -3121,8 +3137,9 @@ ExtendStringRepWithUnicode( goto copyBytes; } - for (i = 0; i < numChars && size >= 0; i++) { - size += Tcl_UniCharToUtf((int) unicode[i], buf); + for (i = 0; i < numChars + offset && size >= 0; i++) { + size += (incr = Tcl_UniCharToUtf((int) unicode[i], buf)); + if (!incr) offset++; } if (size < 0) { Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX); -- cgit v0.12 From adceea62b6fc04fb2a4d41dd0a31adb3011c3147 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 21 Jun 2015 22:29:11 +0000 Subject: Branch for androwish, as help to keep track on which android-specific changes could be included into the core without harm. --- Android.mk | 202 ++++ debian/changelog | 23 + debian/compat | 1 + debian/control | 37 + debian/copyright | 141 +++ debian/rules | 131 ++ debian/sdltcl8.6-dev.dirs | 2 + debian/sdltcl8.6-dev.files | 2 + debian/sdltcl8.6-doc.files | 2 + debian/sdltcl8.6.files | 18 + debian/shlibs.local | 1 + generic/tclEncoding.c | 10 + generic/tclIOUtil.c | 74 +- generic/tclInt.decls | 12 + generic/tclIntDecls.h | 19 + generic/tclMain.c | 146 ++- generic/tclPkgConfig.c | 20 + generic/tclStubInit.c | 9 + generic/zcrypt.h | 131 ++ generic/zipfs.c | 2867 ++++++++++++++++++++++++++++++++++++++++++++ generic/zipfs.h | 43 + pkgs/Android.mk | 1 + tcl-config.mk | 60 + unix/Makefile.in | 11 +- unix/tclLoadDl.c | 40 +- unix/tclUnixFCmd.c | 21 + unix/tclUnixInit.c | 5 + unix/tclUnixPort.h | 2 + unix/tclUnixTime.c | 5 +- win/Makefile.in | 5 +- 30 files changed, 4027 insertions(+), 14 deletions(-) create mode 100644 Android.mk create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 debian/sdltcl8.6-dev.dirs create mode 100644 debian/sdltcl8.6-dev.files create mode 100644 debian/sdltcl8.6-doc.files create mode 100644 debian/sdltcl8.6.files create mode 100644 debian/shlibs.local create mode 100644 generic/zcrypt.h create mode 100644 generic/zipfs.c create mode 100644 generic/zipfs.h create mode 100644 pkgs/Android.mk create mode 100644 tcl-config.mk diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..9d8ce27 --- /dev/null +++ b/Android.mk @@ -0,0 +1,202 @@ +LOCAL_PATH := $(call my-dir) + +########################### +# +# Tcl shared library +# +########################### + +include $(CLEAR_VARS) + +tcl_path := $(LOCAL_PATH) + +include $(tcl_path)/tcl-config.mk + +LOCAL_MODULE := tcl + +LOCAL_ARM_MODE := arm + +LOCAL_C_INCLUDES := $(tcl_includes) $(LOCAL_PATH)/libtommath + +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) + +LOCAL_SRC_FILES := \ + libtommath/bncore.c \ + libtommath/bn_reverse.c \ + libtommath/bn_fast_s_mp_mul_digs.c \ + libtommath/bn_fast_s_mp_sqr.c \ + libtommath/bn_mp_add.c \ + libtommath/bn_mp_add_d.c \ + libtommath/bn_mp_and.c \ + libtommath/bn_mp_clamp.c \ + libtommath/bn_mp_clear.c \ + libtommath/bn_mp_clear_multi.c \ + libtommath/bn_mp_cmp.c \ + libtommath/bn_mp_cmp_d.c \ + libtommath/bn_mp_cmp_mag.c \ + libtommath/bn_mp_copy.c \ + libtommath/bn_mp_cnt_lsb.c \ + libtommath/bn_mp_count_bits.c \ + libtommath/bn_mp_div.c \ + libtommath/bn_mp_div_d.c \ + libtommath/bn_mp_div_2.c \ + libtommath/bn_mp_div_2d.c \ + libtommath/bn_mp_div_3.c \ + libtommath/bn_mp_exch.c \ + libtommath/bn_mp_expt_d.c \ + libtommath/bn_mp_grow.c \ + libtommath/bn_mp_init.c \ + libtommath/bn_mp_init_copy.c \ + libtommath/bn_mp_init_multi.c \ + libtommath/bn_mp_init_set.c \ + libtommath/bn_mp_init_set_int.c \ + libtommath/bn_mp_init_size.c \ + libtommath/bn_mp_karatsuba_mul.c \ + libtommath/bn_mp_karatsuba_sqr.c \ + libtommath/bn_mp_lshd.c \ + libtommath/bn_mp_mod.c \ + libtommath/bn_mp_mod_2d.c \ + libtommath/bn_mp_mul.c \ + libtommath/bn_mp_mul_2.c \ + libtommath/bn_mp_mul_2d.c \ + libtommath/bn_mp_mul_d.c \ + libtommath/bn_mp_neg.c \ + libtommath/bn_mp_or.c \ + libtommath/bn_mp_radix_size.c \ + libtommath/bn_mp_radix_smap.c \ + libtommath/bn_mp_read_radix.c \ + libtommath/bn_mp_rshd.c \ + libtommath/bn_mp_set.c \ + libtommath/bn_mp_set_int.c \ + libtommath/bn_mp_shrink.c \ + libtommath/bn_mp_sqr.c \ + libtommath/bn_mp_sqrt.c \ + libtommath/bn_mp_sub.c \ + libtommath/bn_mp_sub_d.c \ + libtommath/bn_mp_to_unsigned_bin.c \ + libtommath/bn_mp_to_unsigned_bin_n.c \ + libtommath/bn_mp_toom_mul.c \ + libtommath/bn_mp_toom_sqr.c \ + libtommath/bn_mp_toradix_n.c \ + libtommath/bn_mp_unsigned_bin_size.c \ + libtommath/bn_mp_xor.c \ + libtommath/bn_mp_zero.c \ + libtommath/bn_s_mp_add.c \ + libtommath/bn_s_mp_mul_digs.c \ + libtommath/bn_s_mp_sqr.c \ + libtommath/bn_s_mp_sub.c \ + generic/regcomp.c \ + generic/regexec.c \ + generic/regfree.c \ + generic/regerror.c \ + generic/tclAlloc.c \ + generic/tclAssembly.c \ + generic/tclAsync.c \ + generic/tclBasic.c \ + generic/tclBinary.c \ + generic/tclCkalloc.c \ + generic/tclClock.c \ + generic/tclCmdAH.c \ + generic/tclCmdIL.c \ + generic/tclCmdMZ.c \ + generic/tclCompCmds.c \ + generic/tclCompCmdsGR.c \ + generic/tclCompCmdsSZ.c \ + generic/tclCompExpr.c \ + generic/tclCompile.c \ + generic/tclConfig.c \ + generic/tclDate.c \ + generic/tclDictObj.c \ + generic/tclDisassemble.c \ + generic/tclEncoding.c \ + generic/tclEnsemble.c \ + generic/tclEnv.c \ + generic/tclEvent.c \ + generic/tclExecute.c \ + generic/tclFCmd.c \ + generic/tclFileName.c \ + generic/tclGet.c \ + generic/tclHash.c \ + generic/tclHistory.c \ + generic/tclIndexObj.c \ + generic/tclInterp.c \ + generic/tclIO.c \ + generic/tclIOCmd.c \ + generic/tclIOGT.c \ + generic/tclIOSock.c \ + generic/tclIOUtil.c \ + generic/tclIORChan.c \ + generic/tclIORTrans.c \ + generic/tclLink.c \ + generic/tclListObj.c \ + generic/tclLiteral.c \ + generic/tclLoad.c \ + generic/tclMain.c \ + generic/tclNamesp.c \ + generic/tclNotify.c \ + generic/tclObj.c \ + generic/tclOptimize.c \ + generic/tclPanic.c \ + generic/tclParse.c \ + generic/tclPathObj.c \ + generic/tclPipe.c \ + generic/tclPkg.c \ + generic/tclPkgConfig.c \ + generic/tclPosixStr.c \ + generic/tclPreserve.c \ + generic/tclProc.c \ + generic/tclRegexp.c \ + generic/tclResolve.c \ + generic/tclResult.c \ + generic/tclScan.c \ + generic/tclStubInit.c \ + generic/tclStringObj.c \ + generic/tclStrToD.c \ + generic/tclThread.c \ + generic/tclThreadAlloc.c \ + generic/tclThreadJoin.c \ + generic/tclThreadStorage.c \ + generic/tclTimer.c \ + generic/tclTomMathInterface.c \ + generic/tclTrace.c \ + generic/tclUtil.c \ + generic/tclUtf.c \ + generic/tclVar.c \ + generic/tclZlib.c \ + generic/tclOO.c \ + generic/tclOOBasic.c \ + generic/tclOOCall.c \ + generic/tclOODefineCmds.c \ + generic/tclOOInfo.c \ + generic/tclOOMethod.c \ + generic/tclOOStubInit.c \ + generic/tclStubLib.c \ + generic/tclTomMathStubLib.c \ + generic/tclOOStubLib.c \ + generic/zipfs.c \ + unix/tclAppInit.c \ + unix/tclLoadDl.c \ + unix/tclUnixChan.c \ + unix/tclUnixCompat.c \ + unix/tclUnixEvent.c \ + unix/tclUnixFCmd.c \ + unix/tclUnixFile.c \ + unix/tclUnixInit.c \ + unix/tclUnixNotfy.c \ + unix/tclUnixPipe.c \ + unix/tclUnixSock.c \ + unix/tclUnixTest.c \ + unix/tclUnixThrd.c \ + unix/tclUnixTime.c + +LOCAL_CFLAGS := $(tcl_cflags) \ + -DPACKAGE_NAME="\"tcl\"" \ + -DPACKAGE_VERSION="\"8.6\"" \ + -DBUILD_tcl=1 \ + -Dmain=tclsh \ + -O2 + +LOCAL_LDLIBS := -ldl -lz -llog + +include $(BUILD_SHARED_LIBRARY) + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..caad3ba --- /dev/null +++ b/debian/changelog @@ -0,0 +1,23 @@ +sdltcl8.6 (8.6.4-1) unstable; urgency=low + + * Update to 8.6.4 + + -- Christian Werner Thu, 12 Mar 2015 22:00:00 +0100 + +sdltcl8.6 (8.6.3-1) unstable; urgency=low + + * Update to 8.6.3 + + -- Christian Werner Wed, 12 Nov 2014 20:00:00 +0100 + +sdltcl8.6 (8.6.2-1) unstable; urgency=low + + * Update to 8.6.2 + + -- Christian Werner Thu, 28 Aug 2014 07:10:10 +0200 + +sdltcl8.6 (8.6.1-1) unstable; urgency=low + + * Initial packaging + + -- Christian Werner Sat, 05 Apr 2014 14:44:48 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..3434297 --- /dev/null +++ b/debian/control @@ -0,0 +1,37 @@ +Source: sdltcl8.6 +Section: libs +Priority: optional +Maintainer: +Build-Depends: debhelper (>= 5.0.0), quilt +Standards-Version: 3.8.3 +Homepage: http://www.tcl.tk/ + +Package: sdltcl8.6 +Section: interpreters +Priority: optional +Architecture: any +Depends: ${shlibs:Depends} +Description: Tcl (the Tool Command Language) v8.6 - run-time files + Tcl is a powerful, easy to use, embeddable, cross-platform interpreted + scripting language. This package contains everything you need to run + Tcl scripts and Tcl-enabled apps. This version includes thread support. + +Package: sdltcl8.6-doc +Section: doc +Priority: optional +Architecture: all +Suggests: sdltcl8.6 +Description: Tcl (the Tool Command Language) v8.6 - manual pages + Tcl is a powerful, easy-to-use, embeddable, cross-platform interpreted + scripting language. This package contains the man pages for Tcl commands. + +Package: sdltcl8.6-dev +Section: devel +Priority: optional +Architecture: any +Depends: sdltcl8.6 (= ${binary:Version}) +Suggests: sdltcl8.6-doc +Description: Tcl (the Tool Command Language) v8.6 - development files + Tcl is a powerful, easy-to-use, embeddable, cross-platform interpreted + scripting language. This package contains the headers and libraries + needed to embed or extend Tcl. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..075c312 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,141 @@ +This package was originally debianized by David Engel +from sources obtained at http://prdownloads.sourceforge.net/tcl + +List of copyright holders mentioned in individual files: + +Copyright 1983, 1988-1994 The Regents of the University of California +Copyright 1991-1999 Karl Lehenbauer and Mark Diekhans +Copyright 1992-1996 Free Software Foundation, Inc. +Copyright 1993-1994 Lockheed Missle & Space Company, AI Center +Copyright 1993-1997 Bell Labs Innovations for Lucent Technologies +Copyright 1993-1997 Lucent Technologies +Copyright 1994-1998 Sun Microsystems, Inc. +Copyright 1995 General Electric Company +Copyright 1995 Dave Nebinger +Copyright 1995-1997 Roger E. Critchlow Jr +Copyright 1996 Lucent Technologies and Jim Ingham +Copyright 1997-2000 Ajuba Solutions +Copyright 1998-2000 Scriptics Corporation +Copyright 1998-1999 Henry Spencer +Copyright 1998 Paul Duffin +Copyright 1998 Mark Harrison +Copyright 1999 America Online, Inc. +Copyright 1999-2000 Andreas Kupries +Copyright 2000-2001 ActiveState Corporation, et al +Copyright 2001 ActiveState Tool Corp. +Copyright 2001-2002 Apple Computer, Inc. +Copyright 2001-2002 ActiveState Corporation +Copyright 2001-2002 Vincent Darley +Copyright 2001-2002 Donal K. Fellows +Copyright 2001-2003 Kevin B. Kenny +Copyright 2001-2002 David Gravereaux +Contributions from Don Porter, NIST, 2002-2003. (not subject to US copyright) +Copyright 2005 Tcl Core Team +Copyright 2005 Daniel A. Steffen + +Copyright: + +This software is copyrighted by the Regents of the University of +California, Sun Microsystems, Inc., Scriptics Corporation, +and other parties. The following terms apply to all files associated +with the software unless explicitly disclaimed in individual files. + +The authors hereby grant permission to use, copy, modify, distribute, +and license this software and its documentation for any purpose, provided +that existing copyright notices are retained in all copies and that this +notice is included verbatim in any distributions. No written agreement, +license, or royalty fee is required for any of the authorized uses. +Modifications to this software may be copyrighted by their authors +and need not follow the licensing terms described here, provided that +the new terms are clearly indicated on the first page of each file where +they apply. + +IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY +FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY +DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE +IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE +NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR +MODIFICATIONS. + +GOVERNMENT USE: If you are acquiring this software on behalf of the +U.S. government, the Government shall have only "Restricted Rights" +in the software and related documentation as defined in the Federal +Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you +are acquiring the software on behalf of the Department of Defense, the +software shall be classified as "Commercial Computer Software" and the +Government shall have only "Restricted Rights" as defined in 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. + +Several files are distributed under other conditions: + +compat/strftime.c: +/* + * strftime.c -- + * + * This file contains a modified version of the BSD 4.4 strftime + * function. + * + * This file is a modified version of the strftime.c file from the BSD 4.4 + * source. See the copyright notice below for details on redistribution + * restrictions. The "license.terms" file does not apply to this file. + * + * Changes 2002 Copyright (c) 2002 ActiveState Corporation. + * + * RCS: @(#) $Id: strftime.c,v 1.10.2.3 2005/11/04 18:18:04 kennykb Exp $ + */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +compat/dlfcn.h and unix/tclLoadAix.c: + * This file is subject to the following copyright notice, which is + * different from the notice used elsewhere in Tcl but rougly + * equivalent in meaning. + * + * Copyright (c) 1992,1993,1995,1996, Jens-Uwe Mager, Helios Software GmbH + * Not derived from licensed software. + * + * Permission is granted to freely use, copy, modify, and redistribute + * this software, provided that the author is not construed to be liable + * for any results of using the software, alterations are clearly marked + * as such, and this notice is not modified. + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..7a0214c --- /dev/null +++ b/debian/rules @@ -0,0 +1,131 @@ +#!/usr/bin/make -f +# debian/rules that uses debhelper. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +export QUILT_PATCHES := debian/patches + +v = 8.6 + +ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) +CFLAGS=-g -O0 +else +# See bug #446335 +CFLAGS=-g -O2 -fno-unit-at-a-time +endif + +CFLAGS+=-DZIPFS_IN_TCL=1 + +unpatch: + dh_testdir + quilt pop -a || test $$? = 2 + rm -rf patch-stamp .pc + +patch: patch-stamp +patch-stamp: + dh_testdir + quilt push -a || test $$? = 2 + touch patch-stamp + +build: build-stamp +build-stamp: patch-stamp + dh_testdir +# So so ugly but it works... + touch generic/tclStubInit.c + cd unix && \ + CFLAGS="$(CFLAGS)" \ + ac_cv_func_strtod=yes \ + tcl_cv_strtod_buggy=1 \ + ./configure --host=$(DEB_HOST_GNU_TYPE) \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --prefix=/opt/sdltk86 \ + --includedir=/opt/sdltk86/include \ + --enable-shared \ + --mandir=/opt/sdltk86/man \ + --enable-man-symlinks \ + --enable-man-compression=gzip \ + --enable-threads \ + --without-tzdata && \ + touch ../generic/tclStubInit.c && \ + $(MAKE) +# Build the static library. + cd unix && \ + ar cr libtcl$(v).a *.o && \ + ar d libtcl$(v).a tclAppInit.o && \ + ranlib libtcl$(v).a + touch build-stamp + +clean: clean-patched unpatch + dh_testdir + dh_testroot + dh_clean + +clean-patched: + dh_testdir + dh_testroot + rm -f build-stamp install-stamp + cd unix && [ ! -f Makefile ] || $(MAKE) distclean +# Remove forgotten files + rm -f tests/pkg/pkga.so unix/config.log unix/Tcltest.so + +install: install-stamp +install-stamp: build-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + cd unix && \ + GZIP=-9 \ + $(MAKE) INSTALL_ROOT=`pwd`/../debian/tmp \ + MAN_INSTALL_DIR=`pwd`/../debian/tmp/opt/sdltk86/man \ + install install-private-headers install-packages +# Fix up the libraries. + cp unix/libtcl$(v).a debian/tmp/opt/sdltk86/lib + touch install-stamp + +# Build architecture-independent files here. +binary-indep: build install + dh_testdir -i + dh_testroot -i + dh_movefiles -i + dh_installdocs -i + dh_installchangelogs -i ChangeLog + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir -a + dh_testroot -a + dh_movefiles -a +# now, fix up file locations for .sh + mv debian/sdltcl$(v)/opt/sdltk86/lib/tclConfig.sh \ + debian/sdltcl$(v)-dev/opt/sdltk86/lib + dh_installdocs -a + dh_installmenu -a + dh_installchangelogs -a ChangeLog + dh_fixperms -a + dh_strip -a + dh_compress -a + dh_makeshlibs -a -V 'sdltcl$(v) (>= 8.6.2)' -XTcltest + dh_installdeb -a + dh_shlibdeps -a -ldebian/sdltcl$(v)/opt/sdltk86/lib + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a + +source diff: + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false + +binary: binary-indep binary-arch + +.PHONY: patch unpatch clean-patched build clean binary-indep binary-arch binary install + diff --git a/debian/sdltcl8.6-dev.dirs b/debian/sdltcl8.6-dev.dirs new file mode 100644 index 0000000..4de4819 --- /dev/null +++ b/debian/sdltcl8.6-dev.dirs @@ -0,0 +1,2 @@ +opt/sdltk86/lib +opt/sdltk86/include diff --git a/debian/sdltcl8.6-dev.files b/debian/sdltcl8.6-dev.files new file mode 100644 index 0000000..5cd0878 --- /dev/null +++ b/debian/sdltcl8.6-dev.files @@ -0,0 +1,2 @@ +opt/sdltk86/include +opt/sdltk86/lib/*.a diff --git a/debian/sdltcl8.6-doc.files b/debian/sdltcl8.6-doc.files new file mode 100644 index 0000000..56ca7e7 --- /dev/null +++ b/debian/sdltcl8.6-doc.files @@ -0,0 +1,2 @@ +opt/sdltk86/man/man3 +opt/sdltk86/man/mann diff --git a/debian/sdltcl8.6.files b/debian/sdltcl8.6.files new file mode 100644 index 0000000..501d10a --- /dev/null +++ b/debian/sdltcl8.6.files @@ -0,0 +1,18 @@ +opt/sdltk86/bin +opt/sdltk86/lib/tcl8 +opt/sdltk86/lib/tcl8/* +opt/sdltk86/lib/tcl8.6 +opt/sdltk86/lib/tcl8.6/* +opt/sdltk86/lib/*.so +opt/sdltk86/lib/*.sh +opt/sdltk86/lib/itcl* +opt/sdltk86/lib/itcl*/* +opt/sdltk86/lib/pkgconfig +opt/sdltk86/lib/pkgconfig/* +opt/sdltk86/lib/sqlite* +opt/sdltk86/lib/sqlite*/* +opt/sdltk86/lib/tdbc* +opt/sdltk86/lib/tdbc*/* +opt/sdltk86/lib/thread* +opt/sdltk86/lib/thread*/* +opt/sdltk86/man/man1 diff --git a/debian/shlibs.local b/debian/shlibs.local new file mode 100644 index 0000000..7da5dd4 --- /dev/null +++ b/debian/shlibs.local @@ -0,0 +1 @@ +libtcl8.6 1 diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index a7ef199..35caf11 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -496,7 +496,11 @@ FillEncodingFileMap(void) Tcl_Obj *directory, *matchFileList = Tcl_NewObj(); Tcl_Obj **filev; Tcl_GlobTypeData readableFiles = { +#ifdef ZIPFS_IN_TCL + TCL_GLOB_TYPE_FILE | TCL_GLOB_TYPE_DIR, TCL_GLOB_PERM_R, NULL, NULL +#else TCL_GLOB_TYPE_FILE, TCL_GLOB_PERM_R, NULL, NULL +#endif }; Tcl_ListObjIndex(NULL, searchPath, i, &directory); @@ -508,7 +512,13 @@ FillEncodingFileMap(void) Tcl_ListObjGetElements(NULL, matchFileList, &numFiles, &filev); for (j=0; jnextPtr) { +#ifdef ZIPFS_IN_TCL + if (fsRecPtr->fsPtr == &zipfsFilesystem) { + ClientData clientData = NULL; + /* + * Allow mounted zipfs filesystem to overtake entire normalisation. + * This is needed on unix for mounts on symlinks right below root. + */ + + if (fsRecPtr->fsPtr->pathInFilesystemProc != NULL) { + if (fsRecPtr->fsPtr->pathInFilesystemProc(pathPtr, + &clientData)!=-1) { + TclFSSetPathDetails(pathPtr, fsRecPtr->fsPtr, clientData); + break; + } + } + continue; + } +#endif if (fsRecPtr->fsPtr != &tclNativeFilesystem) { continue; } @@ -1423,6 +1455,11 @@ TclFSNormalizeToUniquePath( if (fsRecPtr->fsPtr == &tclNativeFilesystem) { continue; } +#ifdef ZIPFS_IN_TCL + if (fsRecPtr->fsPtr == &zipfsFilesystem) { + continue; + } +#endif if (fsRecPtr->fsPtr->normalizePathProc != NULL) { startAt = fsRecPtr->fsPtr->normalizePathProc(interp, pathPtr, @@ -2890,15 +2927,32 @@ int Tcl_FSChdir( Tcl_Obj *pathPtr) { - const Tcl_Filesystem *fsPtr; + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&fsDataKey); + const Tcl_Filesystem *fsPtr, *oldFsPtr = NULL; int retVal = -1; + if (tsdPtr->cwdPathPtr != NULL) { + oldFsPtr = Tcl_FSGetFileSystemForPath(tsdPtr->cwdPathPtr); + } if (Tcl_FSGetNormalizedPath(NULL, pathPtr) == NULL) { Tcl_SetErrno(ENOENT); return retVal; } fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); + + if ((fsPtr != NULL) && (fsPtr != &tclNativeFilesystem)) { + /* + * Watch out for tilde substitution. + * Only valid in native filesystem. + */ + char *name = Tcl_GetString(pathPtr); + + if ((name != NULL) && (*name == '~')) { + fsPtr = &tclNativeFilesystem; + } + } + if (fsPtr != NULL) { if (fsPtr->chdirProc != NULL) { /* @@ -3009,6 +3063,14 @@ Tcl_FSChdir( } else { FsUpdateCwd(normDirName, NULL); } + + /* + * If the filesystem changed between old and new cwd + * force filesystem refresh on path objects. + */ + if (oldFsPtr != NULL && fsPtr != oldFsPtr) { + Tcl_FSMountsChanged(NULL); + } } return retVal; diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 9f7b106..6298708 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -1012,6 +1012,18 @@ declare 251 { int TclRegisterLiteral(void *envPtr, char *bytes, int length, int flags) } + +declare 252 { + int Tclzipfs_Init(Tcl_Interp *interp) +} +declare 253 { + int Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, + const char *mntpt, const char *passwd) +} +declare 254 { + int Tclzipfs_Unmount(Tcl_Interp *interp, const char *zipname) +} + ############################################################################## diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index f95f999..3e74bbb 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -617,6 +617,16 @@ EXTERN void TclSetSlaveCancelFlags(Tcl_Interp *interp, int flags, /* 251 */ EXTERN int TclRegisterLiteral(void *envPtr, char *bytes, int length, int flags); +/* 252 */ +EXTERN int Tclzipfs_Init(Tcl_Interp *interp); +/* 253 */ +EXTERN int Tclzipfs_Mount(Tcl_Interp *interp, + const char *zipname, const char *mntpt, + const char *passwd); +/* 254 */ +EXTERN int Tclzipfs_Unmount(Tcl_Interp *interp, + const char *zipname); + typedef struct TclIntStubs { int magic; @@ -874,6 +884,9 @@ typedef struct TclIntStubs { char * (*tclDoubleDigits) (double dv, int ndigits, int flags, int *decpt, int *signum, char **endPtr); /* 249 */ void (*tclSetSlaveCancelFlags) (Tcl_Interp *interp, int flags, int force); /* 250 */ int (*tclRegisterLiteral) (void *envPtr, char *bytes, int length, int flags); /* 251 */ + int (*tclzipfs_Init) (Tcl_Interp *interp); /* 252 */ + int (*tclzipfs_Mount) (Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd); /* 253 */ + int (*tclzipfs_Unmount) (Tcl_Interp *interp, const char *zipname); /* 254 */ } TclIntStubs; extern const TclIntStubs *tclIntStubsPtr; @@ -1305,6 +1318,12 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclSetSlaveCancelFlags) /* 250 */ #define TclRegisterLiteral \ (tclIntStubsPtr->tclRegisterLiteral) /* 251 */ +#define Tclzipfs_Init \ + (tclIntStubsPtr->tclzipfs_Init) /* 252 */ +#define Tclzipfs_Mount \ + (tclIntStubsPtr->tclzipfs_Mount) /* 253 */ +#define Tclzipfs_Unmount \ + (tclIntStubsPtr->tclzipfs_Unmount) /* 254 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclMain.c b/generic/tclMain.c index 360f5e9..2c40c3f 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -34,6 +34,10 @@ #include "tclInt.h" +#ifdef ZIPFS_IN_TCL +#include "zipfs.h" +#endif + /* * The default prompt used when the user has not overridden it. */ @@ -51,6 +55,7 @@ # define TCHAR char # define TEXT(arg) arg # define _tcscmp strcmp +# define _tcsncmp strncmp #endif /* @@ -308,10 +313,16 @@ Tcl_MainEx( { Tcl_Obj *path, *resultPtr, *argvPtr, *appName; const char *encodingName = NULL; - int code, exitCode = 0; + int code, length, exitCode = 0; Tcl_MainLoopProc *mainLoopProc; Tcl_Channel chan; InteractiveState is; + const char *zipFile = NULL; + Tcl_Obj *zipval = NULL; + int autoRun = 1; +#ifdef ZIPFS_IN_TCL + int zipOk = TCL_ERROR; +#endif TclpSetInitialEncodings(); TclpFindExecutable((const char *)argv[0]); @@ -344,6 +355,24 @@ Tcl_MainEx( Tcl_DecrRefCount(value); argc -= 3; argv += 3; + } else if (argc > 2) { + length = strlen((char *) argv[1]); + if ((length >= 2) && + (0 == _tcsncmp(TEXT("-zip"), argv[1], length))) { + argc--; + argv++; + if ((argc > 1) && (argv[1][0] != (TCHAR) '-')) { + zipval = NewNativeObj(argv[1], -1); + zipFile = Tcl_GetString(zipval); + autoRun = 0; + argc--; + argv++; + } + } else if ('-' != argv[1][0]) { + Tcl_SetStartupScript(NewNativeObj(argv[1], -1), NULL); + argc--; + argv++; + } } else if ((argc > 1) && ('-' != argv[1][0])) { Tcl_SetStartupScript(NewNativeObj(argv[1], -1), NULL); argc--; @@ -377,6 +406,51 @@ Tcl_MainEx( Tcl_SetVar2Ex(interp, "tcl_interactive", NULL, Tcl_NewIntObj(!path && is.tty), TCL_GLOBAL_ONLY); +#ifdef ZIPFS_IN_TCL + zipOk = Tclzipfs_Init(interp); + if (zipOk == TCL_OK) { + int relax = 0; + + if (zipFile == NULL) { + relax = 1; +#ifdef ANDROID + zipFile = getenv("PACKAGE_CODE_PATH"); + if (zipFile == NULL) { + zipFile = Tcl_GetNameOfExecutable(); + } +#else + zipFile = Tcl_GetNameOfExecutable(); +#endif + } + if (zipFile != NULL) { + zipOk = Tclzipfs_Mount(interp, zipFile, "", NULL); + if (!relax && (zipOk != TCL_OK)) { + exitCode = 1; + goto done; + } + } else { + zipOk = TCL_ERROR; + } + Tcl_ResetResult(interp); + } + if (zipOk == TCL_OK) { + char *tcl_lib = "/assets/tcl" TCL_VERSION; + char *tcl_pkg = "/assets"; + + Tcl_SetVar2(interp, "env", "TCL_LIBRARY", tcl_lib, TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "tcl_libPath", tcl_lib, TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "tcl_library", tcl_lib, TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "tcl_pkgPath", tcl_pkg, TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "auto_path", tcl_lib, + TCL_GLOBAL_ONLY | TCL_LIST_ELEMENT); + + } +#endif + if (zipval != NULL) { + Tcl_DecrRefCount(zipval); + zipval = NULL; + } + /* * Invoke application-specific initialization. */ @@ -406,6 +480,76 @@ Tcl_MainEx( Tcl_CreateExitHandler(FreeMainInterp, interp); } +#ifdef ZIPFS_IN_TCL + /* + * Setup auto loading info to point to mounted ZIP file. + */ + + if (zipOk == TCL_OK) { + char *tcl_lib = "/assets/tcl" TCL_VERSION; + char *tcl_pkg = "/assets"; + + Tcl_SetVar(interp, "tcl_libPath", tcl_lib, TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "tcl_library", tcl_lib, TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "tcl_pkgPath", tcl_pkg, TCL_GLOBAL_ONLY); + + /* + * We need to re-init encoding (after initializing Tcl), + * otherwise "encoding system" will return "identity" + */ + + TclpSetInitialEncodings(); + } + + /* + * Set embedded application startup file, if any. + */ + + if ((zipOk == TCL_OK) && autoRun) { + char *filename; + Tcl_Channel chan; + + filename = "/assets/app/main.tcl"; + chan = Tcl_OpenFileChannel(NULL, filename, "r", 0); + if (chan != (Tcl_Channel) NULL) { + Tcl_Obj *arg; + + Tcl_Close(NULL, chan); + + /* + * Push back script file to argv, if any. + */ + if ((arg = Tcl_GetStartupScript(NULL)) != NULL) { + Tcl_Obj *v, *no; + + no = Tcl_NewStringObj("argv", 4); + v = Tcl_ObjGetVar2(interp, no, NULL, TCL_GLOBAL_ONLY); + if (v != NULL) { + Tcl_Obj **objv, *nv; + int objc, i; + + objc = 0; + Tcl_ListObjGetElements(NULL, v, &objc, &objv); + nv = Tcl_NewListObj(1, &arg); + for (i = 0; i < objc; i++) { + Tcl_ListObjAppendElement(NULL, nv, objv[i]); + } + Tcl_IncrRefCount(nv); + if (Tcl_ObjSetVar2(interp, no, NULL, nv, TCL_GLOBAL_ONLY) + != NULL) { + Tcl_GlobalEval(interp, "incr argc"); + } + Tcl_DecrRefCount(nv); + } + Tcl_DecrRefCount(no); + } + Tcl_SetStartupScript(Tcl_NewStringObj(filename, -1), NULL); + Tcl_SetVar(interp, "argv0", filename, TCL_GLOBAL_ONLY); + Tcl_SetVar(interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY); + } + } +#endif + /* * Invoke the script specified on the command line, if any. Must fetch it * again, as the appInitProc might have reset it. diff --git a/generic/tclPkgConfig.c b/generic/tclPkgConfig.c index 466d535..3f8178e 100644 --- a/generic/tclPkgConfig.c +++ b/generic/tclPkgConfig.c @@ -100,19 +100,35 @@ static Tcl_Config const cfg[] = { /* Runtime paths to various stuff */ +#ifdef ANDROID + {"libdir,runtime", ""}, + {"bindir,runtime", ""}, + {"scriptdir,runtime", ""}, + {"includedir,runtime", ""}, + {"docdir,runtime", ""}, +#else {"libdir,runtime", CFG_RUNTIME_LIBDIR}, {"bindir,runtime", CFG_RUNTIME_BINDIR}, {"scriptdir,runtime", CFG_RUNTIME_SCRDIR}, {"includedir,runtime", CFG_RUNTIME_INCDIR}, {"docdir,runtime", CFG_RUNTIME_DOCDIR}, +#endif /* Installation paths to various stuff */ +#ifdef ANDROID + {"libdir,install", ""}, + {"bindir,install", ""}, + {"scriptdir,install", ""}, + {"includedir,install", ""}, + {"docdir,install", ""}, +#else {"libdir,install", CFG_INSTALL_LIBDIR}, {"bindir,install", CFG_INSTALL_BINDIR}, {"scriptdir,install", CFG_INSTALL_SCRDIR}, {"includedir,install", CFG_INSTALL_INCDIR}, {"docdir,install", CFG_INSTALL_DOCDIR}, +#endif /* Last entry, closes the array */ {NULL, NULL} @@ -123,6 +139,10 @@ TclInitEmbeddedConfigurationInformation( Tcl_Interp *interp) /* Interpreter the configuration command is * registered in. */ { +#if defined(ANDROID) && !defined(TCL_CFGVAL_ENCODING) +#define TCL_CFGVAL_ENCODING "utf-8" +#endif + Tcl_RegisterConfig(interp, "tcl", cfg, TCL_CFGVAL_ENCODING); } diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 7a84cba..d3e0afa 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -560,6 +560,15 @@ static const TclIntStubs tclIntStubs = { TclDoubleDigits, /* 249 */ TclSetSlaveCancelFlags, /* 250 */ TclRegisterLiteral, /* 251 */ +#ifdef ZIPFS_IN_TCL + Tclzipfs_Init, /* 252 */ + Tclzipfs_Mount, /* 253 */ + Tclzipfs_Unmount, /* 254 */ +#else + 0, /* 252 */ + 0, /* 253 */ + 0, /* 254 */ +#endif }; static const TclIntPlatStubs tclIntPlatStubs = { diff --git a/generic/zcrypt.h b/generic/zcrypt.h new file mode 100644 index 0000000..eb9865b --- /dev/null +++ b/generic/zcrypt.h @@ -0,0 +1,131 @@ +/* crypt.h -- base code for crypt/uncrypt ZIPfile + + + Version 1.01e, February 12th, 2005 + + Copyright (C) 1998-2005 Gilles Vollant + + This code is a modified version of crypting code in Infozip distribution + + The encryption/decryption parts of this source code (as opposed to the + non-echoing password parts) were originally written in Europe. The + whole source package can be freely distributed, including from the USA. + (Prior to January 2000, re-export from the US was a violation of US law.) + + This encryption code is a direct transcription of the algorithm from + Roger Schlafly, described by Phil Katz in the file appnote.txt. This + file (appnote.txt) is distributed with the PKZIP program (even in the + version without encryption capabilities). + + If you don't need crypting in your application, just define symbols + NOCRYPT and NOUNCRYPT. + + This code support the "Traditional PKWARE Encryption". + + The new AES encryption added on Zip format by Winzip (see the page + http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong + Encryption is not supported. +*/ + +#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) + +/*********************************************************************** + * Return the next byte in the pseudo-random sequence + */ +static int decrypt_byte(unsigned long* pkeys, const unsigned int* pcrc_32_tab) +{ + unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an + * unpredictable manner on 16-bit systems; not a problem + * with any known compiler so far, though */ + + temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; + return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); +} + +/*********************************************************************** + * Update the encryption keys with the next byte of plain text + */ +static int update_keys(unsigned long* pkeys,const unsigned int* pcrc_32_tab,int c) +{ + (*(pkeys+0)) = CRC32((*(pkeys+0)), c); + (*(pkeys+1)) += (*(pkeys+0)) & 0xff; + (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; + { + register int keyshift = (int)((*(pkeys+1)) >> 24); + (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); + } + return c; +} + + +/*********************************************************************** + * Initialize the encryption keys and the random header according to + * the given password. + */ +static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned int* pcrc_32_tab) +{ + *(pkeys+0) = 305419896L; + *(pkeys+1) = 591751049L; + *(pkeys+2) = 878082192L; + while (*passwd != '\0') { + update_keys(pkeys,pcrc_32_tab,(int)*passwd); + passwd++; + } +} + +#define zdecode(pkeys,pcrc_32_tab,c) \ + (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) + +#define zencode(pkeys,pcrc_32_tab,c,t) \ + (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) + +#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED + +#define RAND_HEAD_LEN 12 + /* "last resort" source for second part of crypt seed pattern */ +# ifndef ZCR_SEED2 +# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ +# endif + +static int crypthead(const char* passwd, /* password string */ + unsigned char* buf, /* where to write header */ + int bufSize, + unsigned long* pkeys, + const unsigned int* pcrc_32_tab, + unsigned long crcForCrypting) +{ + int n; /* index in random header */ + int t; /* temporary */ + int c; /* random byte */ + unsigned char header[RAND_HEAD_LEN-2]; /* random header */ + static unsigned calls = 0; /* ensure different random header each time */ + + if (bufSize> 7) & 0xff; + header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); + } + /* Encrypt random header (last two bytes is high word of crc) */ + init_keys(passwd, pkeys, pcrc_32_tab); + for (n = 0; n < RAND_HEAD_LEN-2; n++) + { + buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); + } + buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); + buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); + return n; +} + +#endif diff --git a/generic/zipfs.c b/generic/zipfs.c new file mode 100644 index 0000000..ec58d9f --- /dev/null +++ b/generic/zipfs.c @@ -0,0 +1,2867 @@ +#if !defined(_WIN32) && !defined(_WIN64) +#include +#endif +#include +#include +#include +#include +#include +#include +#ifdef HAVE_ZLIB +#include "zlib.h" +#include "zcrypt.h" +#endif +#include "tclInt.h" +#include "tclFileSystem.h" +#include "zipfs.h" + +#ifdef HAVE_ZLIB + +#define ZIP_SIG_LEN 4 + +#define ZIP_LOCAL_HEADER_SIG 0x04034b50 +#define ZIP_LOCAL_HEADER_LEN 30 +#define ZIP_LOCAL_SIG_OFFS 0 +#define ZIP_LOCAL_VERSION_OFFS 4 +#define ZIP_LOCAL_FLAGS_OFFS 6 +#define ZIP_LOCAL_COMPMETH_OFFS 8 +#define ZIP_LOCAL_MTIME_OFFS 10 +#define ZIP_LOCAL_MDATE_OFFS 12 +#define ZIP_LOCAL_CRC32_OFFS 14 +#define ZIP_LOCAL_COMPLEN_OFFS 18 +#define ZIP_LOCAL_UNCOMPLEN_OFFS 22 +#define ZIP_LOCAL_PATHLEN_OFFS 26 +#define ZIP_LOCAL_EXTRALEN_OFFS 28 + +#define ZIP_CENTRAL_HEADER_SIG 0x02014b50 +#define ZIP_CENTRAL_HEADER_LEN 46 +#define ZIP_CENTRAL_SIG_OFFS 0 +#define ZIP_CENTRAL_VERSIONMADE_OFFS 4 +#define ZIP_CENTRAL_VERSION_OFFS 6 +#define ZIP_CENTRAL_FLAGS_OFFS 8 +#define ZIP_CENTRAL_COMPMETH_OFFS 10 +#define ZIP_CENTRAL_MTIME_OFFS 12 +#define ZIP_CENTRAL_MDATE_OFFS 14 +#define ZIP_CENTRAL_CRC32_OFFS 16 +#define ZIP_CENTRAL_COMPLEN_OFFS 20 +#define ZIP_CENTRAL_UNCOMPLEN_OFFS 24 +#define ZIP_CENTRAL_PATHLEN_OFFS 28 +#define ZIP_CENTRAL_EXTRALEN_OFFS 30 +#define ZIP_CENTRAL_FCOMMENTLEN_OFFS 32 +#define ZIP_CENTRAL_DISKFILE_OFFS 34 +#define ZIP_CENTRAL_IATTR_OFFS 36 +#define ZIP_CENTRAL_EATTR_OFFS 38 +#define ZIP_CENTRAL_LOCALHDR_OFFS 42 + +#define ZIP_CENTRAL_END_SIG 0x06054b50 +#define ZIP_CENTRAL_END_LEN 22 +#define ZIP_CENTRAL_END_SIG_OFFS 0 +#define ZIP_CENTRAL_DISKNO_OFFS 4 +#define ZIP_CENTRAL_DISKDIR_OFFS 6 +#define ZIP_CENTRAL_ENTS_OFFS 8 +#define ZIP_CENTRAL_TOTALENTS_OFFS 10 +#define ZIP_CENTRAL_DIRSIZE_OFFS 12 +#define ZIP_CENTRAL_DIRSTART_OFFS 16 +#define ZIP_CENTRAL_COMMENTLEN_OFFS 20 + +#define ZIP_MIN_VERSION 20 +#define ZIP_COMPMETH_STORED 0 +#define ZIP_COMPMETH_DEFLATED 8 + +#define ZIP_PASSWORD_END_SIG 0x5a5a4b50 + +#define zip_read_int(p) \ + ((p)[0] | ((p)[1] << 8) | ((p)[2] << 16) | ((p)[3] << 24)) +#define zip_read_short(p) \ + ((p)[0] | ((p)[1] << 8)) + +#define zip_write_int(p, v) \ + (p)[0] = (v) & 0xff; (p)[1] = ((v) >> 8) & 0xff; \ + (p)[2] = ((v) >> 16) & 0xff; (p)[3] = ((v) >> 24) & 0xff; +#define zip_write_short(p, v) \ + (p)[0] = (v) & 0xff; (p)[1] = ((v) >> 8) & 0xff; + +#if defined(_WIN32) || defined(_WIN64) +static CONST char alpha[] = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; +#endif + +#if !defined(_WIN32) && !defined(_WIN64) +#ifndef HAVE_LOCALTIME_R +TCL_DECLARE_MUTEX(localtimeMutex) +#endif +#endif + +typedef struct ZipFile { + char *name; /* Archive name */ + Tcl_Channel chan; /* Channel handle or NULL */ + unsigned char *data; /* Memory mapped or malloc'ed file */ + long length; /* Length of memory mapped file */ + unsigned char *tofree; /* Non-NULL if malloc'ed file */ + int nfiles; /* Number of files in archive */ + int baseoffs; /* Archive start */ + int baseoffsp; /* Password start */ + int centoffs; /* Archive directory start */ + char pwbuf[264]; /* Password buffer */ +#if defined(_WIN32) || defined(_WIN64) + HANDLE mh; +#endif + int nopen; /* Number of open files on archive */ + struct ZipEntry *entries; /* List of files in archive */ + struct ZipEntry *topents; /* List of top-level dirs in archive */ + int mntptlen; /* Length of mount point */ + char mntpt[1]; /* Mount point */ +} ZipFile; + +typedef struct ZipEntry { + char *name; /* The full pathname of the virtual file */ + ZipFile *zipfile; /* The ZIP file holding this virtual file */ + long offset; /* Data offset into memory mapped ZIP file */ + int nbyte; /* Uncompressed size of the virtual file */ + int nbytecompr; /* Compressed size of the virtual file */ + int cmeth; /* Compress method */ + int isdir; /* Set to 1 if directory */ + int depth; /* Number of slashes in path. */ + int crc32; /* CRC-32 */ + int timestamp; /* Modification time */ + int isenc; /* True if data is encrypted */ + unsigned char *data; /* File data if written */ + struct ZipEntry *next; /* Next file in the same archive */ + struct ZipEntry *tnext; /* Next top-level dir in archive */ +} ZipEntry; + +typedef struct ZipChannel { + ZipFile *zipfile; /* The ZIP file holding this channel */ + ZipEntry *zipentry; /* Pointer back to virtual file */ + unsigned long nmax; /* Max. size for write */ + unsigned long nbyte; /* Number of bytes of uncompressed data */ + unsigned long nread; /* Pos of next byte to be read from the channel */ + unsigned char *ubuf; /* Pointer to the uncompressed data */ + int iscompr; /* True if data is compressed */ + int isdir; /* Set to 1 if directory */ + int isenc; /* True if data is encrypted */ + int iswr; /* True if open for writing */ + unsigned long keys[3]; /* Key for decryption */ +} ZipChannel; + +static struct { + int initialized; /* True when initialized */ + int lock; /* RW lock, see below */ + int waiters; /* RW lock, see below */ + int wrmax; /* Maximum write size of a file */ + Tcl_HashTable fileHash; /* File name to ZipEntry mapping */ + Tcl_HashTable zipHash; /* Mount to ZipFile mapping */ +} ZipFS = { + 0, 0, 0, 0, +}; + +/* POSIX like rwlock (multiple reader, single writer) */ + +TCL_DECLARE_MUTEX(ZipFSMutex) +static Tcl_Condition ZipFSCond; + +static void +ReadLock(void) +{ + Tcl_MutexLock(&ZipFSMutex); + while (ZipFS.lock < 0) { + ZipFS.waiters++; + Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, NULL); + ZipFS.waiters--; + } + ZipFS.lock++; + Tcl_MutexUnlock(&ZipFSMutex); +} + +static void +WriteLock(void) +{ + Tcl_MutexLock(&ZipFSMutex); + while (ZipFS.lock != 0) { + ZipFS.waiters++; + Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, NULL); + ZipFS.waiters--; + } + ZipFS.lock = -1; + Tcl_MutexUnlock(&ZipFSMutex); +} + +static void +Unlock(void) +{ + Tcl_MutexLock(&ZipFSMutex); + if (ZipFS.lock > 0) { + --ZipFS.lock; + } else if (ZipFS.lock < 0) { + ZipFS.lock = 0; + } + if ((ZipFS.lock == 0) && (ZipFS.waiters > 0)) { + Tcl_ConditionNotify(&ZipFSCond); + } + Tcl_MutexUnlock(&ZipFSMutex); +} + +static CONST char pwrot[16] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0 +}; + +static CONST unsigned int crc32tab[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d, +}; + +static time_t +DosTimeDate(int dosDate, int dosTime) +{ + time_t now; + struct tm *tmp, tm; + + now = time(NULL); +#if defined(_WIN32) || defined(_WIN64) + tmp = localtime(&now); + tm = *tmp; +#else +#ifdef HAVE_LOCALTIME_R + tmp = &tm; + localtime_r(&now, tmp); +#else + Tcl_MutexLock(&localtimeMutex); + tmp = localtime(&now); + tm = *tmp; + Tcl_MutexUnlock(&localtimeMutex); +#endif +#endif + tm.tm_year = (((dosDate & 0xfe00) >> 9) + 80); + tm.tm_mon = ((dosDate & 0x1e0) >> 5) - 1; + tm.tm_mday = dosDate & 0x1f; + tm.tm_hour = (dosTime & 0xf800) >> 11; + tm.tm_min = (dosTime & 0x7e) >> 5; + tm.tm_sec = (dosTime & 0x1f) << 1; + return mktime(&tm); +} + +static int +ToDosTime(time_t when) +{ + struct tm *tmp, tm; + +#if defined(_WIN32) || defined(_WIN64) + tmp = localtime(&when); + tm = *tmp; +#else +#ifdef HAVE_LOCALTIME_R + tmp = &tm; + localtime_r(&when, tmp); +#else + Tcl_MutexLock(&localtimeMutex); + tmp = localtime(&when); + tm = *tmp; + Tcl_MutexUnlock(&localtimeMutex); +#endif +#endif + return (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1); +} + +static int +ToDosDate(time_t when) +{ + struct tm *tmp, tm; + +#if defined(_WIN32) || defined(_WIN64) + tmp = localtime(&when); + tm = *tmp; +#else +#ifdef HAVE_LOCALTIME_R + tmp = &tm; + localtime_r(&when, tmp); +#else + Tcl_MutexLock(&localtimeMutex); + tmp = localtime(&when); + tm = *tmp; + Tcl_MutexUnlock(&localtimeMutex); +#endif +#endif + return ((tm.tm_year - 80) << 9) | ((tm.tm_mon + 1) << 5) | tm.tm_mday; +} + +static int +CountSlashes(CONST char *string) +{ + int count = 0; + CONST char *p = string; + + while (*p != '\0') { + if (*p == '/') { + count++; + } + p++; + } + return count; +} + +static char * +CanonicalPath(CONST char *root, CONST char *tail, Tcl_DString *dsPtr) +{ + char *path; + int i, j, c, isunc = 0; + +#if defined(_WIN32) || defined(_WIN64) + if ((tail[0] != '\0') && (strchr(alpha, tail[0]) != NULL) && + (tail[1] == ':')) { + tail += 2; + } + /* UNC style path */ + if (tail[0] == '\\') { + root = ""; + ++tail; + } + if (tail[0] == '\\') { + root = "/"; + ++tail; + } +#endif + /* UNC style path */ + if ((root[0] == '/') && (root[1] == '/')) { + isunc = 1; + } + if (tail[0] == '/') { + root = ""; + ++tail; + isunc = 0; + } + if (tail[0] == '/') { + root = "/"; + ++tail; + isunc = 1; + } + i = strlen(root); + j = strlen(tail); + Tcl_DStringSetLength(dsPtr, i + j + 1); + path = Tcl_DStringValue(dsPtr); + memcpy(path, root, i); + path[i++] = '/'; + memcpy(path + i, tail, j); +#if defined(_WIN32) || defined(_WIN64) + for (i = 0; path[i] != '\0'; i++) { + if (path[i] == '\\') { + path[i] = '/'; + } + } +#endif + for (i = j = 0; (c = path[i]) != '\0'; i++) { + if (c == '/') { + int c2 = path[i + 1]; + + if (c2 == '/') { + continue; + } + if (c2 == '.') { + int c3 = path[i + 2]; + + if ((c3 == '/') || (c3 == '\0')) { + i++; + continue; + } + if ((c3 == '.') && + ((path[i + 3] == '/') || (path [i + 3] == '\0'))) { + i += 2; + while ((j > 0) && (path[j - 1] != '/')) { + j--; + } + if (j > isunc) { + --j; + while ((j > 1 + isunc) && (path[j - 2] == '/')) { + j--; + } + } + continue; + } + } + } + path[j++] = c; + } + if (j == 0) { + path[j++] = '/'; + } + path[j] = 0; + Tcl_DStringSetLength(dsPtr, j); + return Tcl_DStringValue(dsPtr); +} + +static char * +AbsolutePath(CONST char *path, Tcl_DString *dsPtr) +{ + char *result; + + if (*path == '~') { + Tcl_DStringAppend(dsPtr, path, -1); + return Tcl_DStringValue(dsPtr); + } + if ((*path != '/') +#if defined(_WIN32) || defined(_WIN64) + && (*path != '\\') && + (((*path != '\0') && (strchr(alpha, *path) == NULL)) || + (path[1] != ':')) +#endif + ) { + Tcl_DString pwd; + + /* relative path */ + Tcl_DStringInit(&pwd); + Tcl_GetCwd(NULL, &pwd); + result = Tcl_DStringValue(&pwd); +#if defined(_WIN32) || defined(_WIN64) + if ((result[0] != '\0') && (strchr(alpha, result[0]) != NULL) && + (result[1] == ':')) { + result += 2; + } +#endif + result = CanonicalPath(result, path, dsPtr); + Tcl_DStringFree(&pwd); + } else { + /* absolute path */ + result = CanonicalPath("", path, dsPtr); + } + return result; +} + +static ZipEntry * +ZipFSLookup(char *filename) +{ + char *realname; + Tcl_HashEntry *hPtr; + ZipEntry *z; + Tcl_DString ds; + + Tcl_DStringInit(&ds); + realname = AbsolutePath(filename, &ds); + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, realname); + z = hPtr ? (ZipEntry *) Tcl_GetHashValue(hPtr) : NULL; + Tcl_DStringFree(&ds); + return z; +} + +#ifdef NEVER_USED +static int +ZipFSLookupMount(char *filename) +{ + char *realname; + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + ZipFile *zf; + Tcl_DString ds; + int match = 0; + + Tcl_DStringInit(&ds); + realname = AbsolutePath(filename, &ds); + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { + if (strcmp(zf->mntpt, realname) == 0) { + match = 1; + break; + } + } + hPtr = Tcl_NextHashEntry(&search); + } + Tcl_DStringFree(&ds); + return match; +} +#endif + +static void +ZipFSCloseArchive(Tcl_Interp *interp, ZipFile *zf) +{ +#if defined(_WIN32) || defined(_WIN64) + if ((zf->data != NULL) && (zf->tofree == NULL)) { + UnmapViewOfFile(zf->data); + zf->data = NULL; + } + if (zf->mh != INVALID_HANDLE_VALUE) { + CloseHandle(zf->mh); + } +#else + if ((zf->data != MAP_FAILED) && (zf->tofree == NULL)) { + munmap(zf->data, zf->length); + zf->data = MAP_FAILED; + } +#endif + if (zf->tofree != NULL) { + Tcl_Free((char *) zf->tofree); + zf->tofree = NULL; + } + Tcl_Close(interp, zf->chan); + zf->chan = NULL; +} + +static int +ZipFSOpenArchive(Tcl_Interp *interp, CONST char *zipname, int needZip, + ZipFile *zf) +{ + int i; + ClientData handle; + unsigned char *p, *q; + +#if defined(_WIN32) || defined(_WIN64) + zf->data = NULL; + zf->mh = INVALID_HANDLE_VALUE; +#else + zf->data = MAP_FAILED; +#endif + zf->length = 0; + zf->nfiles = 0; + zf->baseoffs = zf->baseoffsp = 0; + zf->tofree = NULL; + zf->pwbuf[0] = 0; + zf->chan = Tcl_OpenFileChannel(interp, zipname, "r", 0); + if (zf->chan == NULL) { + return TCL_ERROR; + } + if (Tcl_GetChannelHandle(zf->chan, TCL_READABLE, &handle) != TCL_OK) { + if (Tcl_SetChannelOption(interp, zf->chan, "-translation", "binary") + != TCL_OK) { + goto error; + } + if (Tcl_SetChannelOption(interp, zf->chan, "-encoding", "binary") + != TCL_OK) { + goto error; + } + zf->length = Tcl_Seek(zf->chan, 0, SEEK_END); + if ((zf->length <= 0) || (zf->length > 64 * 1024 * 1024)) { + if (interp) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal file size", -1)); + } + goto error; + } + Tcl_Seek(zf->chan, 0, SEEK_SET); + zf->tofree = zf->data = (unsigned char *) Tcl_Alloc(zf->length); + i = Tcl_Read(zf->chan, (char *) zf->data, zf->length); + if (i != zf->length) { + if (interp) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("file read error", -1)); + } + goto error; + } + Tcl_Close(interp, zf->chan); + zf->chan = NULL; + } else { +#if defined(_WIN32) || defined(_WIN64) + zf->length = GetFileSize((HANDLE) handle, 0); + if ((zf->length == INVALID_FILE_SIZE) || + (zf->length < ZIP_CENTRAL_END_LEN)) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("invalid file size", -1)); + } + goto error; + } + zf->mh = CreateFileMapping((HANDLE) handle, 0, PAGE_READONLY, 0, + zf->length, 0); + if (zf->mh == INVALID_HANDLE_VALUE) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("file mapping failed", -1)); + } + goto error; + } + zf->data = MapViewOfFile(zf->mh, FILE_MAP_READ, 0, 0, zf->length); + if (zf->data == NULL) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("file mapping failed", -1)); + } + goto error; + } +#else + zf->length = lseek((int) (long) handle, 0, SEEK_END); + if ((zf->length == -1) || (zf->length < ZIP_CENTRAL_END_LEN)) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("invalid file size", -1)); + } + goto error; + } + lseek((int) (long) handle, 0, SEEK_SET); + zf->data = (unsigned char *) mmap(0, zf->length, PROT_READ, + MAP_FILE | MAP_PRIVATE, + (int) (long) handle, 0); + if (zf->data == MAP_FAILED) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("file mapping failed", -1)); + } + goto error; + } +#endif + } + p = zf->data + zf->length - ZIP_CENTRAL_END_LEN; + while (p >= zf->data) { + if (*p == (ZIP_CENTRAL_END_SIG & 0xFF)) { + if (zip_read_int(p) == ZIP_CENTRAL_END_SIG) { + break; + } + p -= ZIP_SIG_LEN; + } else { + --p; + } + } + if (p < zf->data) { + if (!needZip) { + zf->baseoffs = zf->baseoffsp = zf->length; + return TCL_OK; + } + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("wrong end signature", -1)); + } + goto error; + } + zf->nfiles = zip_read_short(p + ZIP_CENTRAL_ENTS_OFFS); + if (zf->nfiles == 0) { + if (!needZip) { + zf->baseoffs = zf->baseoffsp = zf->length; + return TCL_OK; + } + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("empty archive", -1)); + } + goto error; + } + q = zf->data + zip_read_int(p + ZIP_CENTRAL_DIRSTART_OFFS); + p -= zip_read_int(p + ZIP_CENTRAL_DIRSIZE_OFFS); + if ((p < zf->data) || (p > (zf->data + zf->length)) || + (q < zf->data) || (q > (zf->data + zf->length))) { + if (!needZip) { + zf->baseoffs = zf->baseoffsp = zf->length; + return TCL_OK; + } + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("archive directory not found", -1)); + } + goto error; + } + zf->baseoffs = zf->baseoffsp = p - q; + zf->centoffs = p - zf->data; + q = p; + for (i = 0; i < zf->nfiles; i++) { + int pathlen, comlen, extra; + + if ((q + ZIP_CENTRAL_HEADER_LEN) > (zf->data + zf->length)) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("wrong header length", -1)); + } + goto error; + } + if (zip_read_int(q) != ZIP_CENTRAL_HEADER_SIG) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("wrong header signature", -1)); + } + goto error; + } + pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); + comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); + extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); + q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; + } + q = zf->data + zf->baseoffs; + if ((zf->baseoffs >= 6) && + (zip_read_int(q - 4) == ZIP_PASSWORD_END_SIG)) { + i = q[-5]; + if (q - 5 - i > zf->data) { + zf->pwbuf[0] = i; + memcpy(zf->pwbuf + 1, q - 5 - i, i); + zf->baseoffsp -= i ? (5 + i) : 0; + } + } + return TCL_OK; + +error: + ZipFSCloseArchive(interp, zf); + return TCL_ERROR; +} + +int +Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, CONST char *mntpt, + CONST char *passwd) +{ + char *realname; + int i, pwlen, isNew; + ZipFile *zf, zf0; + ZipEntry *z; + Tcl_HashEntry *hPtr; + Tcl_DString ds, fpBuf; + unsigned char *q; + + ReadLock(); + if (!ZipFS.initialized) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("not initialized", -1)); + } + Unlock(); + return TCL_ERROR; + } + if (zipname == NULL) { + Tcl_HashSearch search; + int ret = TCL_OK; + + i = 0; + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { + if (interp != NULL) { + Tcl_AppendElement(interp, zf->mntpt); + Tcl_AppendElement(interp, zf->name); + } + ++i; + } + hPtr = Tcl_NextHashEntry(&search); + } + if (interp == NULL) { + ret = (i > 0) ? TCL_OK : TCL_BREAK; + } + Unlock(); + return ret; + } + if (mntpt == NULL) { + if (interp == NULL) { + Unlock(); + return TCL_OK; + } + Tcl_DStringInit(&ds); + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, AbsolutePath(zipname, &ds)); + if (hPtr != NULL) { + if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj(zf->mntpt, -1)); + } + } + Unlock(); + Tcl_DStringFree(&ds); + return TCL_OK; + } + Unlock(); + pwlen = 0; + if (passwd != NULL) { + pwlen = strlen(passwd); + if ((pwlen > 255) || (strchr(passwd, 0xff) != NULL)) { + if (interp) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal password", -1)); + } + return TCL_ERROR; + } + } + if (ZipFSOpenArchive(interp, zipname, 1, &zf0) != TCL_OK) { + return TCL_ERROR; + } + Tcl_DStringInit(&ds); + realname = AbsolutePath(zipname, &ds); + WriteLock(); + hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, realname, &isNew); + Tcl_DStringSetLength(&ds, 0); + if (!isNew) { + zf = (ZipFile *) Tcl_GetHashValue(hPtr); + if (interp != NULL) { + Tcl_AppendResult(interp, "already mounted at ", zf->mntpt, + (char *) NULL); + } + goto error; + } + if (strcmp(mntpt, "/") == 0) { + mntpt = ""; + } + zf = (ZipFile *) Tcl_Alloc(sizeof (*zf) + strlen(mntpt) + 1); + *zf = zf0; + zf->name = Tcl_GetHashKey(&ZipFS.zipHash, hPtr); + strcpy(zf->mntpt, mntpt); + zf->mntptlen = strlen(zf->mntpt); + zf->entries = NULL; + zf->topents = NULL; + zf->nopen = 0; + Tcl_SetHashValue(hPtr, (ClientData) zf); + if ((zf->pwbuf[0] == 0) && pwlen) { + int k = 0; + + i = pwlen; + zf->pwbuf[k++] = i; + while (i > 0) { + zf->pwbuf[k] = (passwd[i - 1] & 0x0f) | + pwrot[(passwd[i - 1] >> 4) & 0x0f]; + k++; + i--; + } + zf->pwbuf[k] = '\0'; + } + if (mntpt[0] != '\0') { + z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); + z->name = NULL; + z->tnext = NULL; + z->depth = CountSlashes(mntpt); + z->zipfile = zf; + z->isdir = 1; + z->isenc = 0; + z->offset = zf->baseoffs; + z->crc32 = 0; + z->timestamp = 0; + z->nbyte = z->nbytecompr = 0; + z->cmeth = ZIP_COMPMETH_STORED; + z->data = NULL; + hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, mntpt, &isNew); + if (!isNew) { + /* skip it */ + Tcl_Free((char *) z); + } else { + Tcl_SetHashValue(hPtr, (ClientData) z); + z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); + z->next = zf->entries; + zf->entries = z; + } + } + q = zf->data + zf->centoffs; + Tcl_DStringInit(&fpBuf); + for (i = 0; i < zf->nfiles; i++) { + int pathlen, comlen, extra, isdir = 0, dosTime, dosDate, nbcompr, offs; + unsigned char *lq, *gq = NULL; + char *fullpath, *path; + + pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); + comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); + extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); + Tcl_DStringSetLength(&ds, 0); + Tcl_DStringAppend(&ds, (char *) q + ZIP_CENTRAL_HEADER_LEN, pathlen); + path = Tcl_DStringValue(&ds); + if ((pathlen > 0) && (path[pathlen - 1] == '/')) { + Tcl_DStringSetLength(&ds, pathlen - 1); + path = Tcl_DStringValue(&ds); + isdir = 1; + } + if ((strcmp(path, ".") == 0) || (strcmp(path, "..") == 0)) { + goto nextent; + } + lq = zf->data + zf->baseoffs + + zip_read_int(q + ZIP_CENTRAL_LOCALHDR_OFFS); + if ((lq < zf->data) || (lq > (zf->data + zf->length))) { + goto nextent; + } + nbcompr = zip_read_int(lq + ZIP_LOCAL_COMPLEN_OFFS); + if (!isdir && (nbcompr == 0) && + (zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS) == 0) && + (zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS) == 0)) { + gq = q; + nbcompr = zip_read_int(gq + ZIP_CENTRAL_COMPLEN_OFFS); + } + offs = (lq - zf->data) + + ZIP_LOCAL_HEADER_LEN + + zip_read_short(lq + ZIP_LOCAL_PATHLEN_OFFS) + + zip_read_short(lq + ZIP_LOCAL_EXTRALEN_OFFS); + if ((offs + nbcompr) > zf->length) { + goto nextent; + } + if (!isdir && (mntpt[0] == '\0') && !CountSlashes(path)) { + goto nextent; + } + Tcl_DStringSetLength(&fpBuf, 0); + fullpath = CanonicalPath(mntpt, path, &fpBuf); + z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); + z->name = NULL; + z->tnext = NULL; + z->depth = CountSlashes(fullpath); + z->zipfile = zf; + z->isdir = isdir; + z->isenc = (zip_read_short(lq + ZIP_LOCAL_FLAGS_OFFS) & 1) + && (nbcompr > 12); + z->offset = offs; + if (gq != NULL) { + z->crc32 = zip_read_int(gq + ZIP_CENTRAL_CRC32_OFFS); + dosDate = zip_read_short(gq + ZIP_CENTRAL_MDATE_OFFS); + dosTime = zip_read_short(gq + ZIP_CENTRAL_MTIME_OFFS); + z->timestamp = DosTimeDate(dosDate, dosTime); + z->nbyte = zip_read_int(gq + ZIP_CENTRAL_UNCOMPLEN_OFFS); + z->cmeth = zip_read_short(gq + ZIP_CENTRAL_COMPMETH_OFFS); + } else { + z->crc32 = zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS); + dosDate = zip_read_short(lq + ZIP_LOCAL_MDATE_OFFS); + dosTime = zip_read_short(lq + ZIP_LOCAL_MTIME_OFFS); + z->timestamp = DosTimeDate(dosDate, dosTime); + z->nbyte = zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS); + z->cmeth = zip_read_short(lq + ZIP_LOCAL_COMPMETH_OFFS); + } + z->nbytecompr = nbcompr; + z->data = NULL; + hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, fullpath, &isNew); + if (!isNew) { + /* skip it */ + Tcl_Free((char *) z); + } else { + Tcl_SetHashValue(hPtr, (ClientData) z); + z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); + z->next = zf->entries; + zf->entries = z; + if (isdir && (mntpt[0] == '\0') && (z->depth == 1)) { + z->tnext = zf->topents; + zf->topents = z; + } + if (!z->isdir && (z->depth > 1)) { + char *dir, *end; + ZipEntry *zd; + + Tcl_DStringSetLength(&ds, strlen(z->name) + 8); + Tcl_DStringSetLength(&ds, 0); + Tcl_DStringAppend(&ds, z->name, -1); + dir = Tcl_DStringValue(&ds); + end = strrchr(dir, '/'); + while ((end != NULL) && (end != dir)) { + Tcl_DStringSetLength(&ds, end - dir); + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, dir); + if (hPtr != NULL) { + break; + } + zd = (ZipEntry *) Tcl_Alloc(sizeof (*zd)); + zd->name = NULL; + zd->tnext = NULL; + zd->depth = CountSlashes(dir); + zd->zipfile = zf; + zd->isdir = 1; + zd->isenc = 0; + zd->offset = z->offset; + zd->crc32 = 0; + zd->timestamp = z->timestamp; + zd->nbyte = zd->nbytecompr = 0; + zd->cmeth = ZIP_COMPMETH_STORED; + zd->data = NULL; + hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, dir, &isNew); + if (!isNew) { + /* should never happen but skip it */ + Tcl_Free((char *) zd); + } else { + Tcl_SetHashValue(hPtr, (ClientData) zd); + zd->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); + zd->next = zf->entries; + zf->entries = zd; + if ((mntpt[0] == '\0') && (zd->depth == 1)) { + zd->tnext = zf->topents; + zf->topents = zd; + } + } + end = strrchr(dir, '/'); + } + } + } +nextent: + q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; + } + Tcl_DStringFree(&fpBuf); + Tcl_DStringFree(&ds); + Unlock(); + Tcl_FSMountsChanged(NULL); + return TCL_OK; + +error: + Tcl_DStringFree(&ds); + Unlock(); + ZipFSCloseArchive(interp, zf); + Tcl_Free((char *) zf); + return TCL_ERROR; +} + +int +Zipfs_Unmount(Tcl_Interp *interp, CONST char *zipname) +{ + char *realname; + ZipFile *zf; + ZipEntry *z, *znext; + Tcl_HashEntry *hPtr; + Tcl_DString ds; + int ret = TCL_OK, unmounted = 0; + + Tcl_DStringInit(&ds); + realname = AbsolutePath(zipname, &ds); + WriteLock(); + if (!ZipFS.initialized) { + goto done; + } + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, realname); + if (hPtr == NULL) { + /* does not report error */ + goto done; + } + zf = (ZipFile *) Tcl_GetHashValue(hPtr); + if (zf->nopen > 0) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("filesystem is busy", -1)); + } + ret = TCL_ERROR; + goto done; + } + Tcl_DeleteHashEntry(hPtr); + for (z = zf->entries; z; z = znext) { + znext = z->next; + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, z->name); + if (hPtr) { + Tcl_DeleteHashEntry(hPtr); + } + if (z->data != NULL) { + Tcl_Free((char *) z->data); + } + Tcl_Free((char *) z); + } + ZipFSCloseArchive(interp, zf); + Tcl_Free((char *) zf); + unmounted = 1; +done: + Unlock(); + Tcl_DStringFree(&ds); + if (unmounted) { + Tcl_FSMountsChanged(NULL); + } + return ret; +} + +static int +ZipFSMountCmd(ClientData clientData, Tcl_Interp *interp, + int argc, CONST char **argv) +{ + if (argc > 4) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " ?zipfile ?mountpoint? ?password???\"", 0); + return TCL_ERROR; + } + return Zipfs_Mount(interp, (argc > 1) ? argv[1] : NULL, + (argc > 2) ? argv[2] : NULL, + (argc > 3) ? argv[3] : NULL); +} + +static int +ZipFSUnmountCmd(ClientData clientData, Tcl_Interp *interp, + int argc, CONST char **argv) +{ + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " zipfile\"", (char *) NULL); + return TCL_ERROR; + } + return Zipfs_Unmount(interp, argv[1]); +} + +static int +ZipFSMkKeyCmd(ClientData clientData, Tcl_Interp *interp, + int argc, CONST char **argv) +{ + int len, i = 0; + char pwbuf[264]; + + if (argc != 2) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " password\"", (char *) NULL); + return TCL_ERROR; + } + len = strlen(argv[1]); + if (len == 0) { + return TCL_OK; + } + if ((len > 255) || (strchr(argv[1], 0xff) != NULL)) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal password", -1)); + return TCL_ERROR; + } + while (len > 0) { + int ch = argv[1][len - 1]; + + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + i++; + len--; + } + pwbuf[i] = i; + ++i; + pwbuf[i++] = (char) ZIP_PASSWORD_END_SIG; + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 8); + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 16); + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 24); + pwbuf[i] = '\0'; + Tcl_AppendResult(interp, pwbuf, (char *) NULL); + return TCL_OK; +} + +static int +ZipAddFile(Tcl_Interp *interp, CONST char *path, Tcl_Channel out, + CONST char *passwd, char *buf, int bufsize, Tcl_HashTable *fileHash) +{ + Tcl_Channel in; + Tcl_HashEntry *hPtr; + ZipEntry *z; + z_stream stream; + CONST char *zpath; + int nbyte, nbytecompr, len, crc, flush, pos[3], zpathlen, olen; + int mtime = 0, isNew, align = 0, cmeth; + unsigned long keys[3], keys0[3]; + char obuf[4096]; + + zpath = path; + while (zpath != NULL && zpath[0] == '/') { + zpath++; + } + if ((zpath == NULL) || (zpath[0] == '\0')) { + return TCL_OK; + } + zpathlen = strlen(zpath); + if (zpathlen + ZIP_CENTRAL_HEADER_LEN > bufsize) { + Tcl_AppendResult(interp, "path too long for \"", path, "\"", + (char *) NULL); + return TCL_ERROR; + } + in = Tcl_OpenFileChannel(interp, path, "r", 0); + if ((in == NULL) || + (Tcl_SetChannelOption(interp, in, "-translation", "binary") + != TCL_OK) || + (Tcl_SetChannelOption(interp, in, "-encoding", "binary") + != TCL_OK)) { +#if defined(_WIN32) || defined(_WIN64) + /* hopefully a directory */ + if (strcmp("permission denied", Tcl_PosixError(interp)) == 0) { + Tcl_Close(interp, in); + return TCL_OK; + } +#endif + Tcl_Close(interp, in); + return TCL_ERROR; + } else { + Tcl_Obj *pathObj = Tcl_NewStringObj(path, -1); + Tcl_StatBuf statBuf; + + Tcl_IncrRefCount(pathObj); + if (Tcl_FSStat(pathObj, &statBuf) != -1) { + mtime = statBuf.st_mtime; + } + Tcl_DecrRefCount(pathObj); + } + Tcl_ResetResult(interp); + crc = 0; + nbyte = nbytecompr = 0; + while ((len = Tcl_Read(in, buf, bufsize)) > 0) { + crc = crc32(crc, (unsigned char *) buf, len); + nbyte += len; + } + if (len == -1) { + if (nbyte == 0) { + if (strcmp("illegal operation on a directory", + Tcl_PosixError(interp)) == 0) { + Tcl_Close(interp, in); + return TCL_OK; + } + } + Tcl_AppendResult(interp, "read error on \"", path, "\"", + (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + if (Tcl_Seek(in, 0, SEEK_SET) == -1) { + Tcl_AppendResult(interp, "seek error on \"", path, "\"", + (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + pos[0] = Tcl_Tell(out); + memset(buf, '\0', ZIP_LOCAL_HEADER_LEN); + memcpy(buf + ZIP_LOCAL_HEADER_LEN, zpath, zpathlen); + len = zpathlen + ZIP_LOCAL_HEADER_LEN; + if (Tcl_Write(out, buf, len) != len) { +wrerr: + Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + if ((len + pos[0]) & 3) { + char abuf[8]; + + /* + * Align payload to next 4-byte boundary using a dummy extra + * entry similar to the zipalign tool from Android's SDK. + */ + align = 4 + ((len + pos[0]) & 3); + zip_write_short(abuf, 0xffff); + zip_write_short(abuf + 2, align - 4); + zip_write_int(abuf + 4, 0x03020100); + if (Tcl_Write(out, abuf, align) != align) { + goto wrerr; + } + } + if (passwd != NULL) { + int i, ch, tmp; + unsigned char kvbuf[24]; + Tcl_Obj *ret; + + init_keys(passwd, keys, crc32tab); + for (i = 0; i < 12 - 2; i++) { + if (Tcl_Eval(interp, "expr int(rand() * 256) % 256") != TCL_OK) { + Tcl_AppendResult(interp, "PRNG error", (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + ret = Tcl_GetObjResult(interp); + if (Tcl_GetIntFromObj(interp, ret, &ch) != TCL_OK) { + Tcl_Close(interp, in); + return TCL_ERROR; + } + kvbuf[i + 12] = (unsigned char) zencode(keys, crc32tab, ch, tmp); + } + Tcl_ResetResult(interp); + init_keys(passwd, keys, crc32tab); + for (i = 0; i < 12 - 2; i++) { + kvbuf[i] = (unsigned char) zencode(keys, crc32tab, + kvbuf[i + 12], tmp); + } + kvbuf[i++] = (unsigned char) zencode(keys, crc32tab, crc >> 16, tmp); + kvbuf[i++] = (unsigned char) zencode(keys, crc32tab, crc >> 24, tmp); + len = Tcl_Write(out, (char *) kvbuf, 12); + memset(kvbuf, 0, 24); + if (len != 12) { + Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + memcpy(keys0, keys, sizeof (keys0)); + nbytecompr += 12; + } + Tcl_Flush(out); + pos[2] = Tcl_Tell(out); + cmeth = ZIP_COMPMETH_DEFLATED; + memset(&stream, 0, sizeof (stream)); + stream.zalloc = Z_NULL; + stream.zfree = Z_NULL; + stream.opaque = Z_NULL; + if (deflateInit2(&stream, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) + != Z_OK) { + Tcl_AppendResult(interp, "compression init error on \"", path, "\"", + (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + do { + len = Tcl_Read(in, buf, bufsize); + if (len == -1) { + Tcl_AppendResult(interp, "read error on \"", path, "\"", + (char *) NULL); + deflateEnd(&stream); + Tcl_Close(interp, in); + return TCL_ERROR; + } + stream.avail_in = len; + stream.next_in = (unsigned char *) buf; + flush = Tcl_Eof(in) ? Z_FINISH : Z_NO_FLUSH; + do { + stream.avail_out = sizeof (obuf); + stream.next_out = (unsigned char *) obuf; + len = deflate(&stream, flush); + if (len == Z_STREAM_ERROR) { + Tcl_AppendResult(interp, "deflate error on \"", path, "\"", + (char *) NULL); + deflateEnd(&stream); + Tcl_Close(interp, in); + return TCL_ERROR; + } + olen = sizeof (obuf) - stream.avail_out; + if (passwd != NULL) { + int i, tmp; + + for (i = 0; i < olen; i++) { + obuf[i] = (char) zencode(keys, crc32tab, obuf[i], tmp); + } + } + if (olen && (Tcl_Write(out, obuf, olen) != olen)) { + Tcl_AppendResult(interp, "write error", (char *) NULL); + deflateEnd(&stream); + Tcl_Close(interp, in); + return TCL_ERROR; + } + nbytecompr += olen; + } while (stream.avail_out == 0); + } while (flush != Z_FINISH); + deflateEnd(&stream); + Tcl_Flush(out); + pos[1] = Tcl_Tell(out); + if (nbyte - nbytecompr <= 0) { + /* + * Compressed file larger than input, + * write it again uncompressed. + */ + if ((int) Tcl_Seek(in, 0, SEEK_SET) != 0) { + goto seekErr; + } + if ((int) Tcl_Seek(out, pos[2], SEEK_SET) != pos[2]) { +seekErr: + Tcl_Close(interp, in); + Tcl_AppendResult(interp, "seek error", (char *) NULL); + return TCL_ERROR; + } + nbytecompr = (passwd != NULL) ? 12 : 0; + while (1) { + len = Tcl_Read(in, buf, bufsize); + if (len == -1) { + Tcl_AppendResult(interp, "read error on \"", path, "\"", + (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } else if (len == 0) { + break; + } + if (passwd != NULL) { + int i, tmp; + + for (i = 0; i < len; i++) { + buf[i] = (char) zencode(keys0, crc32tab, buf[i], tmp); + } + } + if (Tcl_Write(out, buf, len) != len) { + Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + nbytecompr += len; + } + cmeth = ZIP_COMPMETH_STORED; + Tcl_Flush(out); + pos[1] = Tcl_Tell(out); + Tcl_TruncateChannel(out, pos[1]); + } + Tcl_Close(interp, in); + + z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); + z->name = NULL; + z->tnext = NULL; + z->depth = 0; + z->zipfile = NULL; + z->isdir = 0; + z->isenc = (passwd != NULL) ? 1 : 0; + z->offset = pos[0]; + z->crc32 = crc; + z->timestamp = mtime; + z->nbyte = nbyte; + z->nbytecompr = nbytecompr; + z->cmeth = cmeth; + z->data = NULL; + hPtr = Tcl_CreateHashEntry(fileHash, zpath, &isNew); + if (!isNew) { + Tcl_AppendResult(interp, "not unique path name \"", path, "\"", + (char *) NULL); + Tcl_Free((char *) z); + return TCL_ERROR; + } else { + Tcl_SetHashValue(hPtr, (ClientData) z); + z->name = Tcl_GetHashKey(fileHash, hPtr); + z->next = NULL; + } + + /* + * Write final local header information. + */ + zip_write_int(buf + ZIP_LOCAL_SIG_OFFS, ZIP_LOCAL_HEADER_SIG); + zip_write_short(buf + ZIP_LOCAL_VERSION_OFFS, ZIP_MIN_VERSION); + zip_write_short(buf + ZIP_LOCAL_FLAGS_OFFS, z->isenc); + zip_write_short(buf + ZIP_LOCAL_COMPMETH_OFFS, z->cmeth); + zip_write_short(buf + ZIP_LOCAL_MTIME_OFFS, ToDosTime(z->timestamp)); + zip_write_short(buf + ZIP_LOCAL_MDATE_OFFS, ToDosDate(z->timestamp)); + zip_write_int(buf + ZIP_LOCAL_CRC32_OFFS, z->crc32); + zip_write_int(buf + ZIP_LOCAL_COMPLEN_OFFS, z->nbytecompr); + zip_write_int(buf + ZIP_LOCAL_UNCOMPLEN_OFFS, z->nbyte); + zip_write_short(buf + ZIP_LOCAL_PATHLEN_OFFS, zpathlen); + zip_write_short(buf + ZIP_LOCAL_EXTRALEN_OFFS, align); + if ((int) Tcl_Seek(out, pos[0], SEEK_SET) != pos[0]) { + Tcl_DeleteHashEntry(hPtr); + Tcl_Free((char *) z); + Tcl_AppendResult(interp, "seek error", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_Write(out, buf, ZIP_LOCAL_HEADER_LEN) != ZIP_LOCAL_HEADER_LEN) { + Tcl_DeleteHashEntry(hPtr); + Tcl_Free((char *) z); + Tcl_AppendResult(interp, "write error", (char *) NULL); + return TCL_ERROR; + } + Tcl_Flush(out); + if ((int) Tcl_Seek(out, pos[1], SEEK_SET) != pos[1]) { + Tcl_DeleteHashEntry(hPtr); + Tcl_Free((char *) z); + Tcl_AppendResult(interp, "seek error", (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} + +static int +ZipFSMkZipOrImgCmd(ClientData clientData, Tcl_Interp *interp, + int isImg, int argc, CONST char **argv) +{ + Tcl_Channel out; + int len = 0, pwlen = 0, i, ret = TCL_ERROR, largc, pos[3]; + CONST char **largv; + Tcl_DString ds; + ZipEntry *z; + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + Tcl_HashTable fileHash; + char pwbuf[264], buf[4096]; + + if ((argc < 3) || (argc > (isImg ? 5 : 4))) { + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " outfile indir ?password?", + isImg ? " ?infile?\"" : "\"", (char *) NULL); + return TCL_ERROR; + } + pwbuf[0] = 0; + if (argc > 3) { + pwlen = strlen(argv[3]); + if ((pwlen > 255) || (strchr(argv[1], 0xff) != NULL)) { + Tcl_AppendResult(interp, "illegal password", (char *) NULL); + return TCL_ERROR; + } + } + Tcl_DStringInit(&ds); + Tcl_DStringAppendElement(&ds, "::zipfs::find"); + Tcl_DStringAppendElement(&ds, argv[2]); + if (Tcl_Eval(interp, Tcl_DStringValue(&ds)) != TCL_OK) { + Tcl_DStringFree(&ds); + return TCL_ERROR; + } + Tcl_DStringFree(&ds); + if (Tcl_SplitList(interp, Tcl_GetStringResult(interp), &largc, &largv) + != TCL_OK) { + return TCL_ERROR; + } + Tcl_ResetResult(interp); + if (largc == 0) { + Tcl_Free((char *) largv); + Tcl_AppendResult(interp, "empty archive", (char *) NULL); + return TCL_ERROR; + } + out = Tcl_OpenFileChannel(interp, argv[1], "w", 0755); + if ((out == NULL) || + (Tcl_SetChannelOption(interp, out, "-translation", "binary") + != TCL_OK) || + (Tcl_SetChannelOption(interp, out, "-encoding", "binary") + != TCL_OK)) { + Tcl_Close(interp, out); + Tcl_Free((char *) largv); + return TCL_ERROR; + } + if (isImg) { + ZipFile zf0; + + if (ZipFSOpenArchive(interp, (argc > 4) ? argv[4] : + Tcl_GetNameOfExecutable(), 0, &zf0) != TCL_OK) { + Tcl_Close(interp, out); + Tcl_Free((char *) largv); + return TCL_ERROR; + } + if (pwlen && (argc > 3)) { + i = 0; + len = pwlen; + while (len > 0) { + int ch = argv[3][len - 1]; + + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + i++; + len--; + } + pwbuf[i] = i; + ++i; + pwbuf[i++] = (char) ZIP_PASSWORD_END_SIG; + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 8); + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 16); + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 24); + pwbuf[i] = '\0'; + } + i = Tcl_Write(out, (char *) zf0.data, zf0.baseoffsp); + if (i != zf0.baseoffsp) { + Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_Close(interp, out); + Tcl_Free((char *) largv); + ZipFSCloseArchive(interp, &zf0); + return TCL_ERROR; + } + ZipFSCloseArchive(interp, &zf0); + len = strlen(pwbuf); + if (len > 0) { + i = Tcl_Write(out, pwbuf, len); + if (i != len) { + Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_Close(interp, out); + Tcl_Free((char *) largv); + return TCL_ERROR; + } + } + memset(pwbuf, 0, sizeof (pwbuf)); + Tcl_Flush(out); + } + Tcl_InitHashTable(&fileHash, TCL_STRING_KEYS); + pos[0] = Tcl_Tell(out); + for (i = 0; i < largc; i++) { + if (ZipAddFile(interp, largv[i], out, (pwlen > 0) ? argv[3] : NULL, + buf, sizeof (buf), &fileHash) + != TCL_OK) { + goto done; + } + } + pos[1] = Tcl_Tell(out); + hPtr = Tcl_FirstHashEntry(&fileHash, &search); + i = 0; + while (hPtr != NULL) { + z = (ZipEntry *) Tcl_GetHashValue(hPtr); + len = strlen(z->name); + zip_write_int(buf + ZIP_CENTRAL_SIG_OFFS, ZIP_CENTRAL_HEADER_SIG); + zip_write_short(buf + ZIP_CENTRAL_VERSIONMADE_OFFS, ZIP_MIN_VERSION); + zip_write_short(buf + ZIP_CENTRAL_VERSION_OFFS, ZIP_MIN_VERSION); + zip_write_short(buf + ZIP_CENTRAL_FLAGS_OFFS, z->isenc ? 1 : 0); + zip_write_short(buf + ZIP_CENTRAL_COMPMETH_OFFS, z->cmeth); + zip_write_short(buf + ZIP_CENTRAL_MTIME_OFFS, ToDosTime(z->timestamp)); + zip_write_short(buf + ZIP_CENTRAL_MDATE_OFFS, ToDosDate(z->timestamp)); + zip_write_int(buf + ZIP_CENTRAL_CRC32_OFFS, z->crc32); + zip_write_int(buf + ZIP_CENTRAL_COMPLEN_OFFS, z->nbytecompr); + zip_write_int(buf + ZIP_CENTRAL_UNCOMPLEN_OFFS, z->nbyte); + zip_write_short(buf + ZIP_CENTRAL_PATHLEN_OFFS, len); + zip_write_short(buf + ZIP_CENTRAL_EXTRALEN_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_FCOMMENTLEN_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_DISKFILE_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_IATTR_OFFS, 0); + zip_write_int(buf + ZIP_CENTRAL_EATTR_OFFS, 0); + zip_write_int(buf + ZIP_CENTRAL_LOCALHDR_OFFS, z->offset - pos[0]); + memcpy(buf + ZIP_CENTRAL_HEADER_LEN, z->name, len); + len += ZIP_CENTRAL_HEADER_LEN; + if (Tcl_Write(out, buf, len) != len) { + Tcl_AppendResult(interp, "write error", (char *) NULL); + goto done; + } + hPtr = Tcl_NextHashEntry(&search); + ++i; + } + Tcl_Flush(out); + pos[2] = Tcl_Tell(out); + zip_write_int(buf + ZIP_CENTRAL_END_SIG_OFFS, ZIP_CENTRAL_END_SIG); + zip_write_short(buf + ZIP_CENTRAL_DISKNO_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_DISKDIR_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_ENTS_OFFS, i); + zip_write_short(buf + ZIP_CENTRAL_TOTALENTS_OFFS, i); + zip_write_int(buf + ZIP_CENTRAL_DIRSIZE_OFFS, pos[2] - pos[1]); + zip_write_int(buf + ZIP_CENTRAL_DIRSTART_OFFS, pos[1] - pos[0]); + zip_write_short(buf + ZIP_CENTRAL_COMMENTLEN_OFFS, 0); + if (Tcl_Write(out, buf, ZIP_CENTRAL_END_LEN) != ZIP_CENTRAL_END_LEN) { + Tcl_AppendResult(interp, "write error", (char *) NULL); + goto done; + } + Tcl_Flush(out); + ret = TCL_OK; +done: + Tcl_Free((char *) largv); + Tcl_Close(interp, out); + hPtr = Tcl_FirstHashEntry(&fileHash, &search); + while (hPtr != NULL) { + z = (ZipEntry *) Tcl_GetHashValue(hPtr); + Tcl_Free((char *) z); + Tcl_DeleteHashEntry(hPtr); + hPtr = Tcl_FirstHashEntry(&fileHash, &search); + } + Tcl_DeleteHashTable(&fileHash); + return ret; +} + +static int +ZipFSMkZipCmd(ClientData clientData, Tcl_Interp *interp, + int argc, CONST char **argv) +{ + return ZipFSMkZipOrImgCmd(clientData, interp, 0, argc, argv); +} + +static int +ZipFSMkImgCmd(ClientData clientData, Tcl_Interp *interp, + int argc, CONST char **argv) +{ + return ZipFSMkZipOrImgCmd(clientData, interp, 1, argc, argv); +} + +static int +ZipFSExistsObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + char *filename; + int exists; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "filename"); + return TCL_ERROR; + } + filename = Tcl_GetStringFromObj(objv[1], 0); + ReadLock(); + exists = ZipFSLookup(filename) != NULL; + Unlock(); + Tcl_SetBooleanObj(Tcl_GetObjResult(interp), exists); + return TCL_OK; +} + +static int +ZipFSInfoObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + char *filename; + ZipEntry *z; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "filename"); + return TCL_ERROR; + } + filename = Tcl_GetStringFromObj(objv[1], 0); + ReadLock(); + z = ZipFSLookup(filename); + if (z != NULL) { + Tcl_Obj *result = Tcl_GetObjResult(interp); + + Tcl_ListObjAppendElement(interp, result, + Tcl_NewStringObj(z->zipfile->name, -1)); + Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->nbyte)); + Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->nbytecompr)); + Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->offset)); + } + Unlock(); + return TCL_OK; +} + +static int +ZipFSListObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + char *pattern = NULL; + Tcl_RegExp regexp = NULL; + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + Tcl_Obj *result = Tcl_GetObjResult(interp); + + if (objc > 3) { + Tcl_WrongNumArgs(interp, 1, objv, "?(-glob|-regexp)? ?pattern?"); + return TCL_ERROR; + } + if (objc == 3) { + int n; + char *what = Tcl_GetStringFromObj(objv[1], &n); + + if ((n >= 2) && (strncmp(what, "-glob", n) == 0)) { + pattern = Tcl_GetString(objv[2]); + } else if ((n >= 2) && (strncmp(what, "-regexp", n) == 0)) { + regexp = Tcl_RegExpCompile(interp, Tcl_GetString(objv[2])); + if (regexp == NULL) { + return TCL_ERROR; + } + } else { + Tcl_AppendResult(interp, "unknown option: ", what, (char *) NULL); + return TCL_ERROR; + } + } else if (objc == 2) { + pattern = Tcl_GetStringFromObj(objv[1], 0); + } + ReadLock(); + if (pattern != NULL) { + for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + + if (Tcl_StringMatch(z->name, pattern)) { + Tcl_ListObjAppendElement(interp, result, + Tcl_NewStringObj(z->name, -1)); + } + } + } else if (regexp != NULL) { + for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + + if (Tcl_RegExpExec(interp, regexp, z->name, z->name)) { + Tcl_ListObjAppendElement(interp, result, + Tcl_NewStringObj(z->name, -1)); + } + } + } else { + for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + + Tcl_ListObjAppendElement(interp, result, + Tcl_NewStringObj(z->name, -1)); + } + } + Unlock(); + return TCL_OK; +} + +static int +ZipChannelClose(ClientData instanceData, Tcl_Interp *interp) +{ + ZipChannel *info = (ZipChannel *) instanceData; + + if (info->iscompr && (info->ubuf != NULL)) { + Tcl_Free((char *) info->ubuf); + info->ubuf = NULL; + } + if (info->isenc) { + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); + } + if (info->iswr) { + ZipEntry *z = info->zipentry; + unsigned char *newdata; + + newdata = + (unsigned char *) Tcl_Realloc((char *) info->ubuf, info->nread); + if (newdata != NULL) { + if (z->data != NULL) { + Tcl_Free((char *) z->data); + } + z->data = newdata; + z->nbyte = z->nbytecompr = info->nbyte; + z->cmeth = ZIP_COMPMETH_STORED; + z->timestamp = time(NULL); + z->isdir = 0; + z->isenc = 0; + z->offset = 0; + z->crc32 = 0; + } else { + Tcl_Free((char *) info->ubuf); + } + } + WriteLock(); + info->zipfile->nopen--; + Unlock(); + Tcl_Free((char *) info); + return TCL_OK; +} + +static int +ZipChannelRead(ClientData instanceData, char *buf, int toRead, int *errloc) +{ + ZipChannel *info = (ZipChannel *) instanceData; + unsigned long nextpos; + + if (info->isdir) { + *errloc = EISDIR; + return -1; + } + nextpos = info->nread + toRead; + if (nextpos > info->nbyte) { + toRead = info->nbyte - info->nread; + nextpos = info->nbyte; + } + if (toRead == 0) { + return 0; + } + if (info->isenc) { + int i, ch; + + for (i = 0; i < toRead; i++) { + ch = info->ubuf[i + info->nread]; + buf[i] = zdecode(info->keys, crc32tab, ch); + } + } else { + memcpy(buf, info->ubuf + info->nread, toRead); + } + info->nread = nextpos; + *errloc = 0; + return toRead; +} + +static int +ZipChannelWrite(ClientData instanceData, CONST char *buf, + int toWrite, int *errloc) +{ + ZipChannel *info = (ZipChannel *) instanceData; + unsigned long nextpos; + + if (!info->iswr) { + *errloc = EINVAL; + return -1; + } + nextpos = info->nread + toWrite; + if (nextpos > info->nmax) { + toWrite = info->nmax - info->nread; + nextpos = info->nmax; + } + if (toWrite == 0) { + return 0; + } + memcpy(info->ubuf + info->nread, buf, toWrite); + info->nread = nextpos; + if (info->nread > info->nbyte) { + info->nbyte = info->nread; + } + *errloc = 0; + return toWrite; +} + +static int +ZipChannelSeek(ClientData instanceData, long offset, int mode, int *errloc) +{ + ZipChannel *info = (ZipChannel *) instanceData; + + if (info->isdir) { + *errloc = EINVAL; + return -1; + } + switch (mode) { + case SEEK_CUR: + offset += info->nread; + break; + case SEEK_END: + offset += info->nbyte; + break; + case SEEK_SET: + break; + default: + *errloc = EINVAL; + return -1; + } + if (info->iswr) { + if (offset > info->nmax) { + *errloc = EINVAL; + return -1; + } + if (offset > info->nbyte) { + info->nbyte = offset; + } + } else if (offset > info->nbyte) { + *errloc = EINVAL; + return -1; + } + if (offset < 0) { + *errloc = EINVAL; + return -1; + } + info->nread = (unsigned long) offset; + return info->nread; +} + +static void +ZipChannelWatchChannel(ClientData instanceData, int mask) +{ + return; +} +static int +ZipChannelGetFile(ClientData instanceData, int direction, + ClientData *handlePtr) +{ + return TCL_ERROR; +} + +static Tcl_ChannelType ZipChannelType = { + "zip", /* Type name. */ +#ifdef TCL_CHANNEL_VERSION_4 + TCL_CHANNEL_VERSION_4, + ZipChannelClose, /* Close channel, clean instance data */ + ZipChannelRead, /* Handle read request */ + ZipChannelWrite, /* Handle write request */ + ZipChannelSeek, /* Move location of access point, NULL'able */ + NULL, /* Set options, NULL'able */ + NULL, /* Get options, NULL'able */ + ZipChannelWatchChannel, /* Initialize notifier */ + ZipChannelGetFile, /* Get OS handle from the channel */ + NULL, /* 2nd version of close channel, NULL'able */ + NULL, /* Set blocking mode for raw channel, NULL'able */ + NULL, /* Function to flush channel, NULL'able */ + NULL, /* Function to handle event, NULL'able */ + NULL, /* Wide seek function, NULL'able */ + NULL, /* Thread action function, NULL'able */ +#else + NULL, /* Set blocking/nonblocking behaviour, NULL'able */ + ZipChannelClose, /* Close channel, clean instance data */ + ZipChannelRead, /* Handle read request */ + ZipChannelWrite, /* Handle write request */ + ZipChannelSeek, /* Move location of access point, NULL'able */ + NULL, /* Set options, NULL'able */ + NULL, /* Get options, NULL'able */ + ZipChannelWatchChannel, /* Initialize notifier */ + ZipChannelGetFile, /* Get OS handle from the channel */ +#endif +}; + +static Tcl_Channel +ZipChannelOpen(Tcl_Interp *interp, char *filename, int mode, int permissions) +{ + ZipEntry *z; + ZipChannel *info; + static int count = 1; + int i, ch, trunc, wr, flags = 0; + char cname[128]; + + if ((mode & O_APPEND) || + ((ZipFS.wrmax <= 0) && (mode & (O_WRONLY | O_RDWR)))) { + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported open mode", -1)); + } + return NULL; + } + WriteLock(); + z = ZipFSLookup(filename); + if (z == NULL) { + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("file not found", -1)); + } + goto error; + } + trunc = (mode & O_TRUNC) != 0; + wr = (mode & (O_WRONLY | O_RDWR)) != 0; + if ((z->cmeth != ZIP_COMPMETH_STORED) && + (z->cmeth != ZIP_COMPMETH_DEFLATED)) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("unsupported compression method", -1)); + } + goto error; + } + if (wr && z->isdir) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("unsupported file type", -1)); + } + goto error; + } + if (!trunc) { + flags |= TCL_READABLE; + if (z->isenc && (z->zipfile->pwbuf[0] == 0)) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("decryption failed", -1)); + } + goto error; + } else if (wr && (z->data == NULL) && (z->nbyte > ZipFS.wrmax)) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("file too large", -1)); + } + goto error; + } + } else { + flags = TCL_WRITABLE; + } + info = (ZipChannel *) Tcl_Alloc (sizeof (*info)); + info->zipfile = z->zipfile; + info->zipentry = z; + info->nread = 0; + if (wr) { + flags |= TCL_WRITABLE; + info->iswr = 1; + info->isdir = 0; + info->nmax = ZipFS.wrmax; + info->iscompr = 0; + info->isenc = 0; + info->ubuf = (unsigned char *) Tcl_Alloc(info->nmax); + memset(info->ubuf, 0, info->nmax); + if (trunc) { + info->nbyte = 0; + } else { + if (z->data != NULL) { + i = z->nbyte; + if (i > info->nmax) { + i = info->nmax; + } + memcpy(info->ubuf, z->data, i); + info->nbyte = i; + } else { + unsigned char *zbuf = z->zipfile->data + z->offset; + + if (z->isenc) { + int len = z->zipfile->pwbuf[0]; + char pwbuf[260]; + + for (i = 0; i < len; i++) { + ch = z->zipfile->pwbuf[len - i]; + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + } + pwbuf[i] = '\0'; + init_keys(pwbuf, info->keys, crc32tab); + memset(pwbuf, 0, sizeof (pwbuf)); + for (i = 0; i < 12; i++) { + ch = info->ubuf[i]; + zdecode(info->keys, crc32tab, ch); + } + zbuf += i; + } + if (z->cmeth == ZIP_COMPMETH_DEFLATED) { + z_stream stream; + int err; + unsigned char *cbuf = NULL; + + memset(&stream, 0, sizeof (stream)); + stream.zalloc = Z_NULL; + stream.zfree = Z_NULL; + stream.opaque = Z_NULL; + stream.avail_in = z->nbytecompr; + if (z->isenc) { + stream.avail_in -= 12; + cbuf = (unsigned char *) Tcl_Alloc(stream.avail_in); + for (i = 0; i < stream.avail_in; i++) { + ch = info->ubuf[i]; + cbuf[i] = zdecode(info->keys, crc32tab, ch); + } + stream.next_in = cbuf; + } else { + stream.next_in = zbuf; + } + stream.next_out = info->ubuf; + stream.avail_out = info->nmax; + if (inflateInit2(&stream, -15) != Z_OK) { + goto cerror0; + } + err = inflate(&stream, Z_SYNC_FLUSH); + inflateEnd(&stream); + if ((err == Z_STREAM_END) || + ((err == Z_OK) && (stream.avail_in == 0))) { + if (cbuf != NULL) { + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) cbuf); + } + goto wrapchan; + } +cerror0: + if (cbuf != NULL) { + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) cbuf); + } + if (info->ubuf != NULL) { + Tcl_Free((char *) info->ubuf); + } + Tcl_Free((char *) info); + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("decompression error", -1)); + } + goto error; + } else if (z->isenc) { + for (i = 0; i < z->nbyte - 12; i++) { + ch = zbuf[i]; + info->ubuf[i] = zdecode(info->keys, crc32tab, ch); + } + } else { + memcpy(info->ubuf, zbuf, z->nbyte); + } + memset(info->keys, 0, sizeof (info->keys)); + goto wrapchan; + } + } + } else if (z->data != NULL) { + flags |= TCL_READABLE; + info->iswr = 0; + info->iscompr = 0; + info->isdir = 0; + info->isenc = 0; + info->nbyte = z->nbyte; + info->nmax = 0; + info->ubuf = z->data; + } else { + flags |= TCL_READABLE; + info->iswr = 0; + info->iscompr = z->cmeth == ZIP_COMPMETH_DEFLATED; + info->ubuf = z->zipfile->data + z->offset; + info->isdir = z->isdir; + info->isenc = z->isenc; + info->nbyte = z->nbyte; + info->nmax = 0; + if (info->isenc) { + int len = z->zipfile->pwbuf[0]; + char pwbuf[260]; + + for (i = 0; i < len; i++) { + ch = z->zipfile->pwbuf[len - i]; + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + } + pwbuf[i] = '\0'; + init_keys(pwbuf, info->keys, crc32tab); + memset(pwbuf, 0, sizeof (pwbuf)); + for (i = 0; i < 12; i++) { + ch = info->ubuf[i]; + zdecode(info->keys, crc32tab, ch); + } + info->ubuf += i; + } + if (info->iscompr) { + z_stream stream; + int err; + unsigned char *ubuf = NULL; + + memset(&stream, 0, sizeof (stream)); + stream.zalloc = Z_NULL; + stream.zfree = Z_NULL; + stream.opaque = Z_NULL; + stream.avail_in = z->nbytecompr; + if (info->isenc) { + stream.avail_in -= 12; + ubuf = (unsigned char *) Tcl_Alloc(stream.avail_in); + for (i = 0; i < stream.avail_in; i++) { + ch = info->ubuf[i]; + ubuf[i] = zdecode(info->keys, crc32tab, ch); + } + stream.next_in = ubuf; + } else { + stream.next_in = info->ubuf; + } + stream.next_out = info->ubuf = + (unsigned char *) Tcl_Alloc(info->nbyte); + stream.avail_out = info->nbyte; + if (inflateInit2(&stream, -15) != Z_OK) { + goto cerror; + } + err = inflate(&stream, Z_SYNC_FLUSH); + inflateEnd(&stream); + if ((err == Z_STREAM_END) || + ((err == Z_OK) && (stream.avail_in == 0))) { + if (ubuf != NULL) { + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) ubuf); + } + goto wrapchan; + } +cerror: + if (ubuf != NULL) { + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) ubuf); + } + if (info->ubuf != NULL) { + Tcl_Free((char *) info->ubuf); + } + Tcl_Free((char *) info); + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("decompression error", -1)); + } + goto error; + } + } +wrapchan: + sprintf(cname, "zipfs_%lx_%d", (unsigned long) z->offset, count++); + z->zipfile->nopen++; + Unlock(); + return Tcl_CreateChannel(&ZipChannelType, cname, (ClientData) info, flags); + +error: + Unlock(); + return NULL; +} + +static int +ZipEntryStat(char *path, Tcl_StatBuf *buf) +{ + ZipEntry *z; + int ret = -1; + + ReadLock(); + z = ZipFSLookup(path); + if (z == NULL) { + goto done; + } + memset(buf, 0, sizeof (Tcl_StatBuf)); + if (z->isdir) { + buf->st_mode = S_IFDIR | 0555; + } else { + buf->st_mode = S_IFREG | 0555; + } + buf->st_size = z->nbyte; + buf->st_mtime = z->timestamp; + buf->st_ctime = z->timestamp; + buf->st_atime = z->timestamp; + ret = 0; +done: + Unlock(); + return ret; +} + +static int +ZipEntryAccess(char *path, int mode) +{ + ZipEntry *z; + + if (mode & 3) { + return -1; + } + ReadLock(); + z = ZipFSLookup(path); + Unlock(); + return (z != NULL) ? 0 : -1; +} + +static Tcl_Channel +Zip_FSOpenFileChannelProc(Tcl_Interp *interp, Tcl_Obj *pathPtr, + int mode, int permissions) +{ + int len; + + return ZipChannelOpen(interp, Tcl_GetStringFromObj(pathPtr, &len), + mode, permissions); +} + +static int +Zip_FSStatProc(Tcl_Obj *pathPtr, Tcl_StatBuf *buf) +{ + int len; + + return ZipEntryStat(Tcl_GetStringFromObj(pathPtr, &len), buf); +} + +static int +Zip_FSAccessProc(Tcl_Obj *pathPtr, int mode) +{ + int len; + + return ZipEntryAccess(Tcl_GetStringFromObj(pathPtr, &len), mode); +} + +static Tcl_Obj * +Zip_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr) +{ + return Tcl_NewStringObj("/", -1); +} + +static int +Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, + Tcl_Obj *pathPtr, CONST char *pattern, + Tcl_GlobTypeData *types) +{ + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + int scnt, len, l, dirOnly = -1, prefixLen, strip = 0; + char *pat, *prefix, *path; +#if defined(_WIN32) || defined(_WIN64) + char drivePrefix[3]; +#endif + Tcl_DString ds, dsPref; + +#if defined(_WIN32) || defined(_WIN64) + if ((pattern != NULL) && (pattern[0] != '\0') && + (strchr(alpha, pattern[0]) != NULL) && (pattern[1] == ':')) { + pattern += 2; + } +#endif + if (types != NULL) { + dirOnly = (types->type & TCL_GLOB_TYPE_DIR) == TCL_GLOB_TYPE_DIR; + } + Tcl_DStringInit(&ds); + Tcl_DStringInit(&dsPref); + prefix = Tcl_GetStringFromObj(pathPtr, &prefixLen); + Tcl_DStringAppend(&dsPref, prefix, prefixLen); + prefix = Tcl_DStringValue(&dsPref); + path = AbsolutePath(prefix, &ds); + len = Tcl_DStringLength(&ds); + if (strcmp(prefix, path) == 0) { + prefix = NULL; + } else { +#if defined(_WIN32) || defined(_WIN64) + if ((strchr(alpha, prefix[0]) != NULL) && (prefix[1] == ':')) { + if (strcmp(prefix + 2, path) == 0) { + strncpy(drivePrefix, prefix, 3); + drivePrefix[2] = '\0'; + prefix = drivePrefix; + } + } else { + strip = len + 1; + } +#else + strip = len + 1; +#endif + } + if (prefix != NULL) { +#if defined(_WIN32) || defined(_WIN64) + if (prefix == drivePrefix) { + Tcl_DStringSetLength(&dsPref, 0); + Tcl_DStringAppend(&dsPref, drivePrefix, -1); + prefixLen = Tcl_DStringLength(&dsPref); + } else { + Tcl_DStringAppend(&dsPref, "/", 1); + prefixLen++; + } + prefix = Tcl_DStringValue(&dsPref); +#else + Tcl_DStringAppend(&dsPref, "/", 1); + prefixLen++; + prefix = Tcl_DStringValue(&dsPref); +#endif + } + ReadLock(); + if ((types != NULL) && (types->type == TCL_GLOB_TYPE_MOUNT)) { + l = CountSlashes(path); + if (path[len - 1] == '/') { + len--; + } else { + l++; + } + if ((pattern == NULL) || (pattern[0] == '\0')) { + pattern = "*"; + } + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + ZipFile *zf = (ZipFile *) Tcl_GetHashValue(hPtr); + + if (zf->mntptlen == 0) { + ZipEntry *z = zf->topents; + + while (z != NULL) { + int lenz = strlen(z->name); + + if ((lenz > len + 1) && + (strncmp(z->name, path, len) == 0) && + (z->name[len] == '/') && + (CountSlashes(z->name) == l) && + Tcl_StringCaseMatch(z->name + len + 1, pattern, 0)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, z->name, lenz); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(z->name, lenz)); + } + } + z = z->tnext; + } + } else if ((zf->mntptlen > len + 1) && + (strncmp(zf->mntpt, path, len) == 0) && + (zf->mntpt[len] == '/') && + (CountSlashes(zf->mntpt) == l) && + Tcl_StringCaseMatch(zf->mntpt + len + 1, pattern, 0)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, zf->mntpt, zf->mntptlen); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); + } + } + hPtr = Tcl_NextHashEntry(&search); + } + goto end; + } + if ((pattern == NULL) || (pattern[0] == '\0')) { + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path); + if (hPtr != NULL) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + + if ((dirOnly < 0) || + (!dirOnly && !z->isdir) || + (dirOnly && z->isdir)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, z->name, -1); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(z->name, -1)); + } + } + } + goto end; + } + l = strlen(pattern); + pat = Tcl_Alloc(len + l + 2); + memcpy(pat, path, len); + while ((len > 1) && (pat[len - 1] == '/')) { + --len; + } + if ((len > 1) || (pat[0] != '/')) { + pat[len] = '/'; + ++len; + } + memcpy(pat + len, pattern, l + 1); + scnt = CountSlashes(pat); + for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + + if ((dirOnly >= 0) && + ((dirOnly && !z->isdir) || (!dirOnly && z->isdir))) { + continue; + } + if ((z->depth == scnt) && Tcl_StringCaseMatch(z->name, pat, 0)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, z->name + strip, -1); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(z->name + strip, -1)); + } + } + } + Tcl_Free(pat); +end: + Unlock(); + Tcl_DStringFree(&dsPref); + Tcl_DStringFree(&ds); + return TCL_OK; +} + +static int +Zip_FSNormalizePathProc(Tcl_Interp *interp, Tcl_Obj *pathPtr, + int nextCheckpoint) +{ + char *path; + Tcl_DString ds; + int len; + + path = Tcl_GetStringFromObj(pathPtr, &len); + Tcl_DStringInit(&ds); + path = AbsolutePath(path, &ds); + nextCheckpoint = Tcl_DStringLength(&ds); + Tcl_SetStringObj(pathPtr, Tcl_DStringValue(&ds), + Tcl_DStringLength(&ds)); + Tcl_DStringFree(&ds); + return nextCheckpoint; +} + +static int +Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr) +{ + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + ZipFile *zf; + int ret = -1, len; + char *path; + Tcl_DString ds; + + path = Tcl_GetStringFromObj(pathPtr, &len); + Tcl_DStringInit(&ds); + path = AbsolutePath(path, &ds); + len = Tcl_DStringLength(&ds); +#if defined(_WIN32) || defined(_WIN64) + if (len && (strchr(alpha, path[0]) != NULL) && (path[1] == ':')) { + path += 2; + len -= 2; + } +#endif + ReadLock(); + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path); + if (hPtr != NULL) { + ret = TCL_OK; + goto endloop; + } + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + zf = (ZipFile *) Tcl_GetHashValue(hPtr); + if (zf->mntptlen == 0) { + ZipEntry *z = zf->topents; + + while (z != NULL) { + int lenz = strlen(z->name); + + if ((len >= lenz) && + (strncmp(path, z->name, lenz) == 0)) { + ret = TCL_OK; + goto endloop; + } + z = z->tnext; + } + } else if ((len >= zf->mntptlen) && + (strncmp(path, zf->mntpt, zf->mntptlen) == 0)) { + ret = TCL_OK; + goto endloop; + } + hPtr = Tcl_NextHashEntry(&search); + } +endloop: + Unlock(); + Tcl_DStringFree(&ds); + return ret; +} + +static Tcl_Obj * +Zip_FSListVolumesProc(void) +{ + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + ZipFile *zf; + Tcl_Obj *vols = Tcl_NewObj(), *vol; + + ReadLock(); + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + zf = (ZipFile *) Tcl_GetHashValue(hPtr); + vol = Tcl_NewStringObj(zf->mntpt, zf->mntptlen); + Tcl_ListObjAppendList(NULL, vols, vol); + Tcl_DecrRefCount(vol); + hPtr = Tcl_NextHashEntry(&search); + } + Unlock(); + return vols; +} + +static int +Zip_FSChdirProc(Tcl_Obj *pathPtr) +{ + int len; + char *path; + Tcl_DString ds; + ZipEntry *z; + int ret = TCL_OK; + + path = Tcl_GetStringFromObj(pathPtr, &len); + Tcl_DStringInit(&ds); + path = AbsolutePath(path, &ds); + ReadLock(); + z = ZipFSLookup(path); + if ((z == NULL) || !z->isdir) { + Tcl_SetErrno(ENOENT); + ret = -1; + } + Unlock(); + Tcl_DStringFree(&ds); + return ret; +} + +static CONST char *CONST86 * +Zip_FSFileAttrStringsProc(Tcl_Obj *pathPtr, Tcl_Obj** objPtrRef) +{ + static CONST char *attrs[] = { + "-uncompsize", + "-compsize", + "-offset", + "-mount", + "-archive", + "-permissions", + NULL, + }; + + return attrs; +} + +static int +Zip_FSFileAttrsGetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, + Tcl_Obj **objPtrRef) +{ + int len, ret = TCL_OK; + char *path; + ZipEntry *z; + + path = Tcl_GetStringFromObj(pathPtr, &len); + ReadLock(); + z = ZipFSLookup(path); + if (z == NULL) { + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("file not found", -1)); + } + ret = TCL_ERROR; + goto done; + } + switch (index) { + case 0: + *objPtrRef = Tcl_NewIntObj(z->nbyte); + goto done; + case 1: + *objPtrRef= Tcl_NewIntObj(z->nbytecompr); + goto done; + case 2: + *objPtrRef= Tcl_NewLongObj(z->offset); + goto done; + case 3: + *objPtrRef= Tcl_NewStringObj(z->zipfile->mntpt, -1); + goto done; + case 4: + *objPtrRef= Tcl_NewStringObj(z->zipfile->name, -1); + goto done; + case 5: + *objPtrRef= Tcl_NewStringObj("0555", -1); + goto done; + } + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown attribute", -1)); + } + ret = TCL_ERROR; +done: + Unlock(); + return ret; +} + +static int +Zip_FSFileAttrsSetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, + Tcl_Obj *objPtr) +{ + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported operation", -1)); + } + return TCL_ERROR; +} + + +static Tcl_Obj * +Zip_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr) +{ + return Tcl_NewStringObj("zip", -1); +} + +#ifndef ANDROID +static int +Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, + Tcl_FSUnloadFileProc **unloadProcPtr, int flags) +{ + Tcl_FSLoadFileProc2 *loadFileProc; + Tcl_Obj *altPath = NULL; + int ret = -1; + + if (Tcl_FSAccess(path, R_OK) == 0) { + /* + * EXDEV should trigger loading by copying to temp store. + */ + Tcl_SetErrno(EXDEV); + return ret; + } else { + Tcl_Obj *objs[2] = { NULL, NULL }; + + objs[1] = TclPathPart(interp, path, TCL_PATH_DIRNAME); + if ((objs[1] != NULL) && (Zip_FSAccessProc(objs[1], R_OK) == 0)) { + /* + * Shared object is not in ZIP but its path prefix is, + * thus try to load from directory where the executable + * came from. + */ + TclDecrRefCount(objs[1]); + objs[1] = TclPathPart(interp, path, TCL_PATH_TAIL); + objs[0] = TclPathPart(interp, TclGetObjNameOfExecutable(), + TCL_PATH_DIRNAME); + if (objs[0] != NULL) { + altPath = TclJoinPath(2, objs); + if (altPath != NULL) { + Tcl_IncrRefCount(altPath); + if (Tcl_FSAccess(altPath, R_OK) == 0) { + path = altPath; + } + } + } + } + if (objs[0] != NULL) { + Tcl_DecrRefCount(objs[0]); + } + if (objs[1] != NULL) { + Tcl_DecrRefCount(objs[1]); + } + } + loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; + if (loadFileProc != NULL) { + ret = loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); + } else { + Tcl_SetErrno(ENOENT); + } + if (altPath != NULL) { + Tcl_DecrRefCount(altPath); + } + return ret; +} +#endif + +Tcl_Filesystem zipfsFilesystem = { + "zipfs", + sizeof (Tcl_Filesystem), + TCL_FILESYSTEM_VERSION_2, + Zip_FSPathInFilesystemProc, + NULL, /* dupInternalRepProc */ + NULL, /* freeInternalRepProc */ + NULL, /* internalToNormalizedProc */ + NULL, /* createInternalRepProc */ + Zip_FSNormalizePathProc, + Zip_FSFilesystemPathTypeProc, + Zip_FSFilesystemSeparatorProc, + Zip_FSStatProc, + Zip_FSAccessProc, + Zip_FSOpenFileChannelProc, + Zip_FSMatchInDirectoryProc, + NULL, /* utimeProc */ + NULL, /* linkProc */ + Zip_FSListVolumesProc, + Zip_FSFileAttrStringsProc, + Zip_FSFileAttrsGetProc, + Zip_FSFileAttrsSetProc, + NULL, /* createDirectoryProc */ + NULL, /* removeDirectoryProc */ + NULL, /* deleteFileProc */ + NULL, /* copyFileProc */ + NULL, /* renameFileProc */ + NULL, /* copyDirectoryProc */ + NULL, /* lstatProc */ +#ifdef ANDROID + NULL, /* loadFileProc */ +#else + (Tcl_FSLoadFileProc *) Zip_FSLoadFile, +#endif + NULL, /* getCwdProc */ + Zip_FSChdirProc, +}; + +#endif /* HAVE_ZLIB */ + +static int +Zipfs_doInit(Tcl_Interp *interp, int safe) +{ +#ifdef HAVE_ZLIB + static CONST char findproc[] = + "proc ::zipfs::find d {\n" + " set ret {}\n" + " foreach f [glob -directory $d -tails -nocomplain * .*] {\n" + " if {$f eq \".\" || $f eq \"..\"} {\n" + " continue\n" + " }\n" + " set f [file join $d $f]\n" + " lappend ret $f\n" + " foreach f [::zipfs::find $f] {\n" + " lappend ret $f\n" + " }\n" + " }\n" + " return [lsort $ret]\n" + "}\n"; + +#ifdef USE_TCL_STUBS + if (Tcl_InitStubs(interp, "8.0", 0) == NULL) { + return TCL_ERROR; + } +#endif + /* one-time initialization */ + WriteLock(); + if (!ZipFS.initialized) { + static const Tcl_Time t = { 0, 0 }; + + /* inflate condition */ + Tcl_MutexLock(&ZipFSMutex); + Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, &t); + Tcl_MutexUnlock(&ZipFSMutex); +#ifdef ANDROID + /* force loadFileProc to native one */ + zipfsFilesystem.loadFileProc = tclNativeFilesystem.loadFileProc; +#endif + Tcl_FSRegister(NULL, &zipfsFilesystem); + Tcl_InitHashTable(&ZipFS.fileHash, TCL_STRING_KEYS); + Tcl_InitHashTable(&ZipFS.zipHash, TCL_STRING_KEYS); + ZipFS.initialized = 1; +#if defined(ZIPFS_IN_TCL) || defined(ZIPFS_IN_TK) + Tcl_StaticPackage(interp, "zipfs", Zipfs_Init, Zipfs_SafeInit); +#endif + } + Unlock(); +#if !defined(ZIPFS_IN_TCL) && !defined(ZIPFS_IN_TK) + Tcl_PkgProvide(interp, "zipfs", "1.0"); +#endif + if (!safe) { + Tcl_CreateCommand(interp, "::zipfs::mount", ZipFSMountCmd, 0, 0); + Tcl_CreateCommand(interp, "::zipfs::unmount", ZipFSUnmountCmd, 0, 0); + Tcl_CreateCommand(interp, "::zipfs::mkkey", ZipFSMkKeyCmd, 0, 0); + Tcl_CreateCommand(interp, "::zipfs::mkimg", ZipFSMkImgCmd, 0, 0); + Tcl_CreateCommand(interp, "::zipfs::mkzip", ZipFSMkZipCmd, 0, 0); + Tcl_GlobalEval(interp, findproc); + } + Tcl_CreateObjCommand(interp, "::zipfs::exists", ZipFSExistsObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::zipfs::info", ZipFSInfoObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::zipfs::list", ZipFSListObjCmd, 0, 0); + if (!safe) { + Tcl_LinkVar(interp, "::zipfs::wrmax", (char *) &ZipFS.wrmax, + TCL_LINK_INT); + } + return TCL_OK; +#else + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("no zlib available", -1)); + } + return TCL_ERROR; +#endif +} + +int +Zipfs_Init(Tcl_Interp *interp) +{ + return Zipfs_doInit(interp, 0); +} + +int +Zipfs_SafeInit(Tcl_Interp *interp) +{ + return Zipfs_doInit(interp, 1); +} + +#ifndef HAVE_ZLIB + +int +Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, CONST char *mntpt, + CONST char *passwd) +{ + return Zipfs_doInit(interp, 1); +} + +int +Zipfs_Unmount(Tcl_Interp *interp, CONST char *zipname) +{ + return Zipfs_doInit(interp, 1); +} + +#endif + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/generic/zipfs.h b/generic/zipfs.h new file mode 100644 index 0000000..587fed8 --- /dev/null +++ b/generic/zipfs.h @@ -0,0 +1,43 @@ +#ifndef _ZIPFS_H +#define _ZIPFS_H + +#ifdef ZIPFS_IN_TK +#include "tkInt.h" +#define Zipfs_Mount Tkzipfs_Mount +#define Zipfs_Unmount Tkzipfs_Unmount +#define Zipfs_Init Tkzipfs_Init +#define Zipfs_SafeInit Tkzipfs_SafeInit +#endif + +#ifdef ZIPFS_IN_TCL +#include "tclPort.h" +#define Zipfs_Mount Tclzipfs_Mount +#define Zipfs_Unmount Tclzipfs_Unmount +#define Zipfs_Init Tclzipfs_Init +#define Zipfs_SafeInit Tclzipfs_SafeInit +#endif + +#ifndef EXTERN +#define EXTERN extern +#endif + +#ifdef BUILD_tcl +#undef EXTERN +#define EXTERN +#endif + +EXTERN int Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, + CONST char *mntpt, CONST char *passwd); +EXTERN int Zipfs_Unmount(Tcl_Interp *interp, CONST char *mountname); +EXTERN int Zipfs_Init(Tcl_Interp *interp); +EXTERN int Zipfs_SafeInit(Tcl_Interp *interp); + +#endif + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/pkgs/Android.mk b/pkgs/Android.mk new file mode 100644 index 0000000..5053e7d --- /dev/null +++ b/pkgs/Android.mk @@ -0,0 +1 @@ +include $(call all-subdir-makefiles) diff --git a/tcl-config.mk b/tcl-config.mk new file mode 100644 index 0000000..ae14b6b --- /dev/null +++ b/tcl-config.mk @@ -0,0 +1,60 @@ +tcl_includes := $(tcl_path)/generic $(tcl_path)/unix + +tcl_cflags := \ + -DHAVE_SYS_SELECT_H=1 \ + -DHAVE_LIMITS_H=1 \ + -DHAVE_UNISTD_H=1 \ + -DHAVE_SYS_PARAM_H=1 \ + -D_LARGEFILE64_SOURCE=1 \ + -DTCL_WIDE_INT_TYPE="long long" \ + -DTCL_SHLIB_EXT="\".so\"" \ + -DHAVE_CAST_TO_UNION=1 \ + -DHAVE_GETCWD=1 \ + -DHAVE_OPENDIR=1 \ + -DHAVE_MKSTEMP=1 \ + -DHAVE_MKSTEMPS=1 \ + -DHAVE_STRSTR=1 \ + -DHAVE_STRTOL=1 \ + -DHAVE_STRTOLL=1 \ + -DHAVE_STRTOULL=1 \ + -DHAVE_TMPNAM=1 \ + -DHAVE_WAITPID=1 \ + -DHAVE_STRUCT_ADDRINFO=1 \ + -DHAVE_STRUCT_IN6_ADDR=1 \ + -DHAVE_STRUCT_SOCKADDR_IN6=1 \ + -DHAVE_STRUCT_SOCKADDR_STORAGE=1 \ + -DUSE_TERMIOS=1 \ + -DHAVE_MKTIME=1 \ + -DUSE_INTERP_ERRORLINE=1 \ + -DHAVE_SYS_TIME_H=1 \ + -DTIME_WITH_SYS_TIME=1 \ + -DHAVE_TM_ZONE=1 \ + -DHAVE_GMTIME_R=1 \ + -DHAVE_LOCALTIME_R=1 \ + -DHAVE_TM_GMTOFF=1 \ + -DHAVE_TIMEZONE_VAR=1 \ + -DHAVE_ST_BLKSIZE=1 \ + -DSTDC_HEADERS=1 \ + -DHAVE_INTPTR_T=1 \ + -DHAVE_UINTPTR_T=1 \ + -DHAVE_SIGNED_CHAR=1 \ + -DHAVE_SYS_IOCTL_H=1 \ + -DHAVE_MEMCPY=1 \ + -DHAVE_MEMMOVE=1 \ + -DVOID=void \ + -DNO_UNION_WAIT=1 \ + -DHAVE_ZLIB=1 \ + -DMP_PREC=4 \ + -DTCL_TOMMATH=1 \ + -D_REENTRANT=1 \ + -D_THREADSAFE=1 \ + -DTCL_THREADS=1 \ + -DTCL_PTHREAD_ATFORK=1 \ + -DUSE_THREAD_ALLOC=1 \ + -DTCL_CFGVAL_ENCODING="\"utf-8\"" \ + -DTCL_UNLOAD_DLLS=1 \ + -DTCL_CFG_OPTIMIZED=1 \ + -DZIPFS_IN_TCL=1 \ + -DTCL_PACKAGE_PATH="\"/assets\"" \ + -DTCL_LIBRARY="\"/assets/tcl8.6\"" + diff --git a/unix/Makefile.in b/unix/Makefile.in index 18c90fa..eb1ba3c 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -308,7 +308,7 @@ GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \ tclStrToD.o tclThread.o \ tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o \ tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o \ - tclTomMathInterface.o + tclTomMathInterface.o zipfs.o OO_OBJS = tclOO.o tclOOBasic.o tclOOCall.o tclOODefineCmds.o tclOOInfo.o \ tclOOMethod.o tclOOStubInit.o @@ -382,7 +382,8 @@ GENERIC_HDRS = \ $(GENERIC_DIR)/tclPatch.h \ $(GENERIC_DIR)/tclPlatDecls.h \ $(GENERIC_DIR)/tclPort.h \ - $(GENERIC_DIR)/tclRegexp.h + $(GENERIC_DIR)/tclRegexp.h \ + $(GENERIC_DIR)/zipfs.h GENERIC_SRCS = \ $(GENERIC_DIR)/regcomp.c \ @@ -463,7 +464,8 @@ GENERIC_SRCS = \ $(GENERIC_DIR)/tclUtil.c \ $(GENERIC_DIR)/tclVar.c \ $(GENERIC_DIR)/tclAssembly.c \ - $(GENERIC_DIR)/tclZlib.c + $(GENERIC_DIR)/tclZlib.c \ + $(GENERIC_DIR)/zipfs.c OO_SRCS = \ $(GENERIC_DIR)/tclOO.c \ @@ -1321,6 +1323,9 @@ tclVar.o: $(GENERIC_DIR)/tclVar.c tclZlib.o: $(GENERIC_DIR)/tclZlib.c $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/tclZlib.c +zipfs.o: $(GENERIC_DIR)/zipfs.c + $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/zipfs.c + tclTest.o: $(GENERIC_DIR)/tclTest.c $(IOHDR) $(TCLREHDRS) $(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tclTest.c diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index dc711f8..3376d94 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -97,7 +97,11 @@ TclpDlopen( } else { dlopenflags |= RTLD_NOW; } - handle = dlopen(native, dlopenflags); + if (native == NULL) { + handle = NULL; + } else { + handle = dlopen(native, dlopenflags); + } if (handle == NULL) { /* * Let the OS loader examine the binary search path for whatever @@ -115,7 +119,41 @@ TclpDlopen( handle = dlopen(native, dlopenflags); Tcl_DStringFree(&ds); } +#ifdef ANDROID + /* + * If not an absolute or relative path, try to load + * from $INTERNAL_STORAGE/../lib (the place where the + * system has installed bundled .so files from the .APK) + */ + if (handle == NULL) { + native = Tcl_GetString(pathPtr); + if ((native != NULL) && (strchr(native, '/') == NULL)) { + char *storage = getenv("INTERNAL_STORAGE"); + Tcl_DString ds2; + if ((storage != NULL) && (storage[0] != '\0')) { + Tcl_DStringInit(&ds2); + Tcl_DStringAppend(&ds2, storage, -1); + Tcl_DStringAppend(&ds2, "/../lib/", -1); + Tcl_DStringAppend(&ds2, native, -1); + handle = dlopen(Tcl_DStringValue(&ds2), RTLD_NOW | RTLD_GLOBAL); + Tcl_DStringFree(&ds2); + } + if (handle == NULL) { + storage = getenv("TK_TCL_WISH_LD_LIBS"); + if ((storage != NULL) && (storage[0] != '\0')) { + Tcl_DStringInit(&ds2); + Tcl_DStringAppend(&ds2, storage, -1); + Tcl_DStringAppend(&ds2, "/", -1); + Tcl_DStringAppend(&ds2, native, -1); + handle = + dlopen(Tcl_DStringValue(&ds2), RTLD_NOW | RTLD_GLOBAL); + Tcl_DStringFree(&ds2); + } + } + } + } + #endif if (handle == NULL) { /* * Write the string to a variable first to work around a compiler bug diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 3b1b6ca..0193dae 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -465,6 +465,9 @@ DoCopyFile( /* Used to determine filetype. */ { Tcl_StatBuf dstStatBuf; +#ifdef ANDROID + int ret; +#endif if (S_ISDIR(statBufPtr->st_mode)) { errno = EISDIR; @@ -520,7 +523,15 @@ DoCopyFile( if (mkfifo(dst, statBufPtr->st_mode) < 0) { /* INTL: Native. */ return TCL_ERROR; } +#ifdef ANDROID + ret = CopyFileAtts(src, dst, statBufPtr); + if (ret != TCL_OK && errno == EPERM) { + ret = TCL_OK; + } + return ret; +#else return CopyFileAtts(src, dst, statBufPtr); +#endif default: return TclUnixCopyFile(src, dst, statBufPtr, 0); } @@ -629,6 +640,11 @@ TclUnixCopyFile( return TCL_ERROR; } if (!dontCopyAtts && CopyFileAtts(src, dst, statBufPtr) == TCL_ERROR) { +#ifdef ANDROID + if (errno == EPERM) { + return TCL_OK; + } +#endif /* * The copy succeeded, but setting the permissions failed, so be in a * consistent state, we remove the file that was created by the copy. @@ -1203,6 +1219,11 @@ TraversalCopy( Tcl_DStringValue(dstPtr), statBufPtr) == TCL_OK) { return TCL_OK; } +#ifdef ANDROID + if (errno == EPERM) { + return TCL_OK; + } +#endif break; } diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 520c8e5..927b1a6 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -541,6 +541,11 @@ TclpInitLibraryPath( */ str = defaultLibraryDir; +#ifdef ZIPFS_IN_TCL + if (Tclzipfs_Mount(NULL, NULL, NULL, NULL) == TCL_OK) { + str = ""; + } +#endif } if (str[0] != '\0') { objPtr = Tcl_NewStringObj(str, -1); diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 123abec..6558332 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -447,9 +447,11 @@ extern int gettimeofday(struct timeval *tp, *--------------------------------------------------------------------------- */ +#ifndef ANDROID #ifndef L_tmpnam # define L_tmpnam 100 #endif +#endif /* *--------------------------------------------------------------------------- diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 315bcf9..19cafe6 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -529,7 +529,10 @@ static void CleanupMemory( ClientData ignored) { - ckfree(lastTZ); + if (lastTZ != NULL) { + ckfree(lastTZ); + lastTZ = NULL; + } } /* diff --git a/win/Makefile.in b/win/Makefile.in index 168da2e..13a3e0c 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -296,7 +296,8 @@ GENERIC_OBJS = \ tclUtf.$(OBJEXT) \ tclUtil.$(OBJEXT) \ tclVar.$(OBJEXT) \ - tclZlib.$(OBJEXT) + tclZlib.$(OBJEXT) \ + zipfs.$(OBJEXT) TOMMATH_OBJS = \ bncore.${OBJEXT} \ @@ -741,7 +742,7 @@ clean: cleanhelp clean-packages distclean: distclean-packages clean $(RM) Makefile config.status config.cache config.log tclConfig.sh \ - tcl.hpj config.status.lineno + tcl.hpj config.status.lineno tclsh.exe.manifest # # Bundled package targets -- cgit v0.12 From d68207f7ca77f987f9c8d2c8400c089b2c976604 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 15 Jul 2015 09:31:11 +0000 Subject: Remove unused local variables. Now unix/tclUnixTime.c is idential in "androwish" compared to "novem". (Yes, those functions are planned to be removed in Tcl 9.0!) --- unix/tclUnixTime.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 240bc91..470b122 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -17,25 +17,6 @@ #endif /* - * TclpGetDate is coded to return a pointer to a 'struct tm'. For thread - * safety, this structure must be in thread-specific data. The 'tmKey' - * variable is the key to this buffer. - */ - -static Tcl_ThreadDataKey tmKey; -typedef struct ThreadSpecificData { - struct tm gmtime_buf; - struct tm localtime_buf; -} ThreadSpecificData; - -/* - * If we fall back on the thread-unsafe versions of gmtime and localtime, use - * this mutex to try to protect them. - */ - -TCL_DECLARE_MUTEX(tmMutex) - -/* * Static functions declared in this file. */ -- cgit v0.12 From 6e0d4b67612beec4f87f531f87878314a26db669 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 24 Aug 2015 07:58:42 +0000 Subject: Remove unused internal stub entries as well. --- generic/tclInt.decls | 18 ++-- generic/tclIntPlatDecls.h | 32 +++---- win/tclWinTime.c | 222 ---------------------------------------------- 3 files changed, 23 insertions(+), 249 deletions(-) diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 27245f1..9f990f7 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -534,7 +534,7 @@ declare 132 { int TclpHasSockets(Tcl_Interp *interp) } # Removed in androwish -#declare 133 { +# declare 133 { # struct tm *TclpGetDate(const time_t *time, int useGMT) #} # Removed in 8.5 @@ -750,6 +750,8 @@ declare 179 { # const char *file, int line) #} +# TclpGmtime and TclpLocaltime promoted to the generic interface from unix + # Removed in androwish #declare 182 { # struct tm *TclpLocaltime(const time_t *clock) @@ -1218,12 +1220,14 @@ declare 10 unix { } # Slots 11 and 12 are forwarders for functions that were promoted to # generic Stubs -declare 11 unix { - struct tm *TclpLocaltime_unix(const time_t *clock) -} -declare 12 unix { - struct tm *TclpGmtime_unix(const time_t *clock) -} +# Removed in androwish +#declare 11 unix { +# struct tm *TclpLocaltime_unix(const time_t *clock) +#} +# Removed in androwish +#declare 12 unix { +# struct tm *TclpGmtime_unix(const time_t *clock) +#} declare 13 unix { char *TclpInetNtoa(struct in_addr addr) } diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index ac06787..b7a44d8 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -73,10 +73,8 @@ EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); EXTERN TclFile TclpCreateTempFile(const char *contents); /* 10 */ EXTERN Tcl_DirEntry * TclpReaddir(DIR *dir); -/* 11 */ -EXTERN struct tm * TclpLocaltime_unix(const time_t *clock); -/* 12 */ -EXTERN struct tm * TclpGmtime_unix(const time_t *clock); +/* Slot 11 is reserved */ +/* Slot 12 is reserved */ /* 13 */ EXTERN char * TclpInetNtoa(struct in_addr addr); /* 14 */ @@ -207,10 +205,8 @@ EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); EXTERN TclFile TclpCreateTempFile(const char *contents); /* 10 */ EXTERN Tcl_DirEntry * TclpReaddir(DIR *dir); -/* 11 */ -EXTERN struct tm * TclpLocaltime_unix(const time_t *clock); -/* 12 */ -EXTERN struct tm * TclpGmtime_unix(const time_t *clock); +/* Slot 11 is reserved */ +/* Slot 12 is reserved */ /* 13 */ EXTERN char * TclpInetNtoa(struct in_addr addr); /* 14 */ @@ -270,8 +266,8 @@ typedef struct TclIntPlatStubs { int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */ TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */ Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */ - struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */ - struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */ + void (*reserved11)(void); + void (*reserved12)(void); char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */ int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */ void (*reserved15)(void); @@ -336,8 +332,8 @@ typedef struct TclIntPlatStubs { int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */ TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */ Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */ - struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */ - struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */ + void (*reserved11)(void); + void (*reserved12)(void); char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */ int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */ int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */ @@ -393,10 +389,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */ #define TclpReaddir \ (tclIntPlatStubsPtr->tclpReaddir) /* 10 */ -#define TclpLocaltime_unix \ - (tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */ -#define TclpGmtime_unix \ - (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */ +/* Slot 11 is reserved */ +/* Slot 12 is reserved */ #define TclpInetNtoa \ (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */ #define TclUnixCopyFile \ @@ -504,10 +498,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */ #define TclpReaddir \ (tclIntPlatStubsPtr->tclpReaddir) /* 10 */ -#define TclpLocaltime_unix \ - (tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */ -#define TclpGmtime_unix \ - (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */ +/* Slot 11 is reserved */ +/* Slot 12 is reserved */ #define TclpInetNtoa \ (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */ #define TclUnixCopyFile \ diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 7045c72..97e1f41 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -113,7 +113,6 @@ static TimeInfo timeInfo = { * Declarations for functions defined later in this file. */ -static struct tm * ComputeGMT(const time_t *tp); static void StopCalibration(ClientData clientData); static DWORD WINAPI CalibrationThread(LPVOID arg); static void UpdateTimeEachSecond(void); @@ -489,227 +488,6 @@ StopCalibration( /* *---------------------------------------------------------------------- * - * TclpGetDate -- - * - * This function converts between seconds and struct tm. If useGMT is - * true, then the returned date will be in Greenwich Mean Time (GMT). - * Otherwise, it will be in the local time zone. - * - * Results: - * Returns a static tm structure. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -struct tm * -TclpGetDate( - const time_t *t, - int useGMT) -{ - struct tm *tmPtr; - time_t time; - - if (!useGMT) { - tzset(); - - /* - * If we are in the valid range, let the C run-time library handle it. - * Otherwise we need to fake it. Note that this algorithm ignores - * daylight savings time before the epoch. - */ - - /* - * Hm, Borland's localtime manages to return NULL under certain - * circumstances (e.g. wintime.test, test 1.2). Nobody tests for this, - * since 'localtime' isn't supposed to do this, possibly leading to - * crashes. - * - * Patch: We only call this function if we are at least one day into - * the epoch, else we handle it ourselves (like we do for times < 0). - * H. Giese, June 2003 - */ - -#ifdef __BORLANDC__ -#define LOCALTIME_VALIDITY_BOUNDARY SECSPERDAY -#else -#define LOCALTIME_VALIDITY_BOUNDARY 0 -#endif - - if (*t >= LOCALTIME_VALIDITY_BOUNDARY) { - return TclpLocaltime(t); - } - - time = *t - timezone; - - /* - * If we aren't near to overflowing the long, just add the bias and - * use the normal calculation. Otherwise we will need to adjust the - * result at the end. - */ - - if (*t < (LONG_MAX - 2*SECSPERDAY) && *t > (LONG_MIN + 2*SECSPERDAY)) { - tmPtr = ComputeGMT(&time); - } else { - tmPtr = ComputeGMT(t); - - tzset(); - - /* - * Add the bias directly to the tm structure to avoid overflow. - * Propagate seconds overflow into minutes, hours and days. - */ - - time = tmPtr->tm_sec - timezone; - tmPtr->tm_sec = (int)(time % 60); - if (tmPtr->tm_sec < 0) { - tmPtr->tm_sec += 60; - time -= 60; - } - - time = tmPtr->tm_min + time/60; - tmPtr->tm_min = (int)(time % 60); - if (tmPtr->tm_min < 0) { - tmPtr->tm_min += 60; - time -= 60; - } - - time = tmPtr->tm_hour + time/60; - tmPtr->tm_hour = (int)(time % 24); - if (tmPtr->tm_hour < 0) { - tmPtr->tm_hour += 24; - time -= 24; - } - - time /= 24; - tmPtr->tm_mday += (int)time; - tmPtr->tm_yday += (int)time; - tmPtr->tm_wday = (tmPtr->tm_wday + (int)time) % 7; - } - } else { - tmPtr = ComputeGMT(t); - } - return tmPtr; -} - -/* - *---------------------------------------------------------------------- - * - * ComputeGMT -- - * - * This function computes GMT given the number of seconds since the epoch - * (midnight Jan 1 1970). - * - * Results: - * Returns a (per thread) statically allocated struct tm. - * - * Side effects: - * Updates the values of the static struct tm. - * - *---------------------------------------------------------------------- - */ - -static struct tm * -ComputeGMT( - const time_t *tp) -{ - struct tm *tmPtr; - long tmp, rem; - int isLeap; - const int *days; - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - - tmPtr = &tsdPtr->tm; - - /* - * Compute the 4 year span containing the specified time. - */ - - tmp = (long)(*tp / SECSPER4YEAR); - rem = (long)(*tp % SECSPER4YEAR); - - /* - * Correct for weird mod semantics so the remainder is always positive. - */ - - if (rem < 0) { - tmp--; - rem += SECSPER4YEAR; - } - - /* - * Compute the year after 1900 by taking the 4 year span and adjusting for - * the remainder. This works because 2000 is a leap year, and 1900/2100 - * are out of the range. - */ - - tmp = (tmp * 4) + 70; - isLeap = 0; - if (rem >= SECSPERYEAR) { /* 1971, etc. */ - tmp++; - rem -= SECSPERYEAR; - if (rem >= SECSPERYEAR) { /* 1972, etc. */ - tmp++; - rem -= SECSPERYEAR; - if (rem >= SECSPERYEAR + SECSPERDAY) { /* 1973, etc. */ - tmp++; - rem -= SECSPERYEAR + SECSPERDAY; - } else { - isLeap = 1; - } - } - } - tmPtr->tm_year = tmp; - - /* - * Compute the day of year and leave the seconds in the current day in the - * remainder. - */ - - tmPtr->tm_yday = rem / SECSPERDAY; - rem %= SECSPERDAY; - - /* - * Compute the time of day. - */ - - tmPtr->tm_hour = rem / 3600; - rem %= 3600; - tmPtr->tm_min = rem / 60; - tmPtr->tm_sec = rem % 60; - - /* - * Compute the month and day of month. - */ - - days = (isLeap) ? leapDays : normalDays; - for (tmp = 1; days[tmp] < tmPtr->tm_yday; tmp++) { - /* empty body */ - } - tmPtr->tm_mon = --tmp; - tmPtr->tm_mday = tmPtr->tm_yday - days[tmp]; - - /* - * Compute day of week. Epoch started on a Thursday. - */ - - tmPtr->tm_wday = (long)(*tp / SECSPERDAY) + 4; - if ((*tp % SECSPERDAY) < 0) { - tmPtr->tm_wday--; - } - tmPtr->tm_wday %= 7; - if (tmPtr->tm_wday < 0) { - tmPtr->tm_wday += 7; - } - - return tmPtr; -} - -/* - *---------------------------------------------------------------------- - * * CalibrationThread -- * * Thread that manages calibration of the hi-resolution time derived from -- cgit v0.12 From ecc90e3787b23274b9f03670ba869c8f7da8213a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 24 Aug 2015 08:01:23 +0000 Subject: one more.... --- generic/tclStubInit.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index edeb42a..8359fa6 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -294,10 +294,6 @@ static int formatInt(char *buffer, int n){ #define TclFormatInt (int(*)(char *, long))formatInt #endif - -#else /* UNIX and MAC */ -# define TclpLocaltime_unix TclpLocaltime -# define TclpGmtime_unix TclpGmtime #endif /* @@ -586,8 +582,8 @@ static const TclIntPlatStubs tclIntPlatStubs = { TclUnixWaitForFile, /* 8 */ TclpCreateTempFile, /* 9 */ TclpReaddir, /* 10 */ - TclpLocaltime_unix, /* 11 */ - TclpGmtime_unix, /* 12 */ + 0, /* 11 */ + 0, /* 12 */ TclpInetNtoa, /* 13 */ TclUnixCopyFile, /* 14 */ 0, /* 15 */ @@ -652,8 +648,8 @@ static const TclIntPlatStubs tclIntPlatStubs = { TclUnixWaitForFile, /* 8 */ TclpCreateTempFile, /* 9 */ TclpReaddir, /* 10 */ - TclpLocaltime_unix, /* 11 */ - TclpGmtime_unix, /* 12 */ + 0, /* 11 */ + 0, /* 12 */ TclpInetNtoa, /* 13 */ TclUnixCopyFile, /* 14 */ TclMacOSXGetFileAttribute, /* 15 */ -- cgit v0.12 From dbe627594edb4a5b12aa260f2c02d9c2b2b48c3f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 31 Aug 2015 17:30:01 +0000 Subject: Dependancies from androwish upstream --- Android.mk | 2 ++ tcl-config.mk | 72 +++++++++++++++++++++++++++++---------------------------- win/Makefile.in | 5 ++-- 3 files changed, 42 insertions(+), 37 deletions(-) diff --git a/Android.mk b/Android.mk index 9d8ce27..13e55d9 100644 --- a/Android.mk +++ b/Android.mk @@ -12,6 +12,8 @@ tcl_path := $(LOCAL_PATH) include $(tcl_path)/tcl-config.mk +LOCAL_ADDITIONAL_DEPENDENCIES += $(tcl_path)/tcl-config.mk + LOCAL_MODULE := tcl LOCAL_ARM_MODE := arm diff --git a/tcl-config.mk b/tcl-config.mk index ae14b6b..e072516 100644 --- a/tcl-config.mk +++ b/tcl-config.mk @@ -1,60 +1,62 @@ tcl_includes := $(tcl_path)/generic $(tcl_path)/unix tcl_cflags := \ - -DHAVE_SYS_SELECT_H=1 \ - -DHAVE_LIMITS_H=1 \ - -DHAVE_UNISTD_H=1 \ - -DHAVE_SYS_PARAM_H=1 \ - -D_LARGEFILE64_SOURCE=1 \ - -DTCL_WIDE_INT_TYPE="long long" \ - -DTCL_SHLIB_EXT="\".so\"" \ - -DHAVE_CAST_TO_UNION=1 \ - -DHAVE_GETCWD=1 \ - -DHAVE_OPENDIR=1 \ + -DHAVE_SYS_SELECT_H=1 \ + -DHAVE_LIMITS_H=1 \ + -DHAVE_UNISTD_H=1 \ + -DHAVE_SYS_PARAM_H=1 \ + -D_LARGEFILE64_SOURCE=1 \ + -DTCL_WIDE_INT_TYPE="long long" \ + -DTCL_SHLIB_EXT="\".so\"" \ + -DHAVE_CAST_TO_UNION=1 \ + -DHAVE_GETCWD=1 \ + -DHAVE_OPENDIR=1 \ -DHAVE_MKSTEMP=1 \ -DHAVE_MKSTEMPS=1 \ - -DHAVE_STRSTR=1 \ - -DHAVE_STRTOL=1 \ - -DHAVE_STRTOLL=1 \ - -DHAVE_STRTOULL=1 \ - -DHAVE_TMPNAM=1 \ - -DHAVE_WAITPID=1 \ + -DHAVE_STRSTR=1 \ + -DHAVE_STRTOL=1 \ + -DHAVE_STRTOLL=1 \ + -DHAVE_STRTOULL=1 \ + -DHAVE_TMPNAM=1 \ + -DHAVE_WAITPID=1 \ -DHAVE_STRUCT_ADDRINFO=1 \ -DHAVE_STRUCT_IN6_ADDR=1 \ -DHAVE_STRUCT_SOCKADDR_IN6=1 \ -DHAVE_STRUCT_SOCKADDR_STORAGE=1 \ - -DUSE_TERMIOS=1 \ - -DHAVE_MKTIME=1 \ - -DUSE_INTERP_ERRORLINE=1 \ - -DHAVE_SYS_TIME_H=1 \ - -DTIME_WITH_SYS_TIME=1 \ - -DHAVE_TM_ZONE=1 \ - -DHAVE_GMTIME_R=1 \ - -DHAVE_LOCALTIME_R=1 \ - -DHAVE_TM_GMTOFF=1 \ - -DHAVE_TIMEZONE_VAR=1 \ - -DHAVE_ST_BLKSIZE=1 \ - -DSTDC_HEADERS=1 \ + -DHAVE_GETHOSTBYNAME_R=1 \ + -DUSE_TERMIOS=1 \ + -DHAVE_MKTIME=1 \ + -DUSE_INTERP_ERRORLINE=1 \ + -DHAVE_SYS_TIME_H=1 \ + -DTIME_WITH_SYS_TIME=1 \ + -DHAVE_TM_ZONE=1 \ + -DHAVE_GMTIME_R=1 \ + -DHAVE_LOCALTIME_R=1 \ + -DHAVE_TM_GMTOFF=1 \ + -DHAVE_TIMEZONE_VAR=1 \ + -DHAVE_ST_BLKSIZE=1 \ + -DSTDC_HEADERS=1 \ -DHAVE_INTPTR_T=1 \ -DHAVE_UINTPTR_T=1 \ -DHAVE_SIGNED_CHAR=1 \ - -DHAVE_SYS_IOCTL_H=1 \ - -DHAVE_MEMCPY=1 \ - -DHAVE_MEMMOVE=1 \ - -DVOID=void \ - -DNO_UNION_WAIT=1 \ - -DHAVE_ZLIB=1 \ + -DHAVE_SYS_IOCTL_H=1 \ + -DHAVE_MEMCPY=1 \ + -DHAVE_MEMMOVE=1 \ + -DVOID=void \ + -DNO_UNION_WAIT=1 \ + -DHAVE_ZLIB=1 \ -DMP_PREC=4 \ -DTCL_TOMMATH=1 \ -D_REENTRANT=1 \ -D_THREADSAFE=1 \ + -DTCL_UTF_MAX=6 \ -DTCL_THREADS=1 \ -DTCL_PTHREAD_ATFORK=1 \ -DUSE_THREAD_ALLOC=1 \ -DTCL_CFGVAL_ENCODING="\"utf-8\"" \ -DTCL_UNLOAD_DLLS=1 \ -DTCL_CFG_OPTIMIZED=1 \ - -DZIPFS_IN_TCL=1 \ + -DZIPFS_IN_TCL=1 \ -DTCL_PACKAGE_PATH="\"/assets\"" \ -DTCL_LIBRARY="\"/assets/tcl8.6\"" diff --git a/win/Makefile.in b/win/Makefile.in index b92a062..b8a130c 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -296,7 +296,8 @@ GENERIC_OBJS = \ tclUtf.$(OBJEXT) \ tclUtil.$(OBJEXT) \ tclVar.$(OBJEXT) \ - tclZlib.$(OBJEXT) + tclZlib.$(OBJEXT) \ + zipfs.$(OBJEXT) TOMMATH_OBJS = \ bncore.${OBJEXT} \ @@ -741,7 +742,7 @@ clean: cleanhelp clean-packages distclean: distclean-packages clean $(RM) Makefile config.status config.cache config.log tclConfig.sh \ - tcl.hpj config.status.lineno + tcl.hpj config.status.lineno tclsh.exe.manifest # # Bundled package targets -- cgit v0.12 From 842b15b839b378f34b23291dda5ba279cffe1607 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 17 Sep 2015 11:47:04 +0000 Subject: fixed bug in zipfs error handling (backported from androwish) --- generic/zipfs.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/generic/zipfs.c b/generic/zipfs.c index ec58d9f..c150da0 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -819,10 +819,13 @@ Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, CONST char *mntpt, if (!isNew) { zf = (ZipFile *) Tcl_GetHashValue(hPtr); if (interp != NULL) { - Tcl_AppendResult(interp, "already mounted at ", zf->mntpt, - (char *) NULL); + Tcl_AppendResult(interp, "already mounted on \"", zf->mntptlen ? + zf->mntpt : "/", "\"", (char *) NULL); } - goto error; + Unlock(); + Tcl_DStringFree(&ds); + ZipFSCloseArchive(interp, &zf0); + return TCL_ERROR; } if (strcmp(mntpt, "/") == 0) { mntpt = ""; @@ -915,6 +918,7 @@ Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, CONST char *mntpt, goto nextent; } if (!isdir && (mntpt[0] == '\0') && !CountSlashes(path)) { + /* regular files skipped when mounting on root */ goto nextent; } Tcl_DStringSetLength(&fpBuf, 0); @@ -947,7 +951,7 @@ Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, CONST char *mntpt, z->data = NULL; hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, fullpath, &isNew); if (!isNew) { - /* skip it */ + /* should not happen but skip it anyway */ Tcl_Free((char *) z); } else { Tcl_SetHashValue(hPtr, (ClientData) z); @@ -988,7 +992,7 @@ Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, CONST char *mntpt, zd->data = NULL; hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, dir, &isNew); if (!isNew) { - /* should never happen but skip it */ + /* should not happen but skip it anyway */ Tcl_Free((char *) zd); } else { Tcl_SetHashValue(hPtr, (ClientData) zd); @@ -1012,13 +1016,6 @@ nextent: Unlock(); Tcl_FSMountsChanged(NULL); return TCL_OK; - -error: - Tcl_DStringFree(&ds); - Unlock(); - ZipFSCloseArchive(interp, zf); - Tcl_Free((char *) zf); - return TCL_ERROR; } int @@ -1039,7 +1036,7 @@ Zipfs_Unmount(Tcl_Interp *interp, CONST char *zipname) } hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, realname); if (hPtr == NULL) { - /* does not report error */ + /* don't report error */ goto done; } zf = (ZipFile *) Tcl_GetHashValue(hPtr); @@ -1707,7 +1704,8 @@ ZipFSListObjCmd(ClientData clientData, Tcl_Interp *interp, return TCL_ERROR; } } else { - Tcl_AppendResult(interp, "unknown option: ", what, (char *) NULL); + Tcl_AppendResult(interp, "unknown option \"", what, + "\"", (char *) NULL); return TCL_ERROR; } } else if (objc == 2) { -- cgit v0.12 From 9dd94f739633837da43ddf3f0af5f99a36c2e803 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 28 Sep 2015 10:58:30 +0000 Subject: Don't use mutex retry mechanism on Android. (problems ???) --- unix/tclUnixThrd.c | 51 +++++---------------------------------------------- win/tclWinThrd.c | 37 +++++-------------------------------- 2 files changed, 10 insertions(+), 78 deletions(-) diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index ae81c5f..0e8070d 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -22,19 +22,6 @@ typedef struct ThreadSpecificData { static Tcl_ThreadDataKey dataKey; /* - * This is the number of milliseconds to wait between internal retries in - * the Tcl_MutexLock function. This value must be greater than zero and - * should be a suitable value for the given platform. - * - * TODO: This may need to be dynamically determined, based on the relative - * performance of the running process. - */ - -#ifndef TCL_MUTEX_LOCK_SLEEP_TIME -# define TCL_MUTEX_LOCK_SLEEP_TIME (25) -#endif - -/* * masterLock is used to serialize creation of mutexes, condition variables, * and thread local storage. This is the only place that can count on the * ability to statically initialize the mutex. @@ -58,13 +45,6 @@ static pthread_mutex_t allocLock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t *allocLockPtr = &allocLock; /* - * The mutexLock serializes Tcl_MutexLock. This is necessary to prevent - * races when finalizing a mutex that some other thread may want to lock. - */ - -static pthread_mutex_t mutexLock = PTHREAD_MUTEX_INITIALIZER; - -/* * These are for the critical sections inside this file. */ @@ -380,7 +360,6 @@ TclpMasterUnlock(void) pthread_mutex_unlock(&masterLock); #endif } - /* *---------------------------------------------------------------------- @@ -457,32 +436,12 @@ retry: } MASTER_UNLOCK; } - while (1) { - pthread_mutex_lock(&mutexLock); - pmutexPtr = *((pthread_mutex_t **)mutexPtr); - if (pmutexPtr == NULL) { - pthread_mutex_unlock(&mutexLock); - goto retry; - } - if (pthread_mutex_trylock(pmutexPtr) == 0) { - pthread_mutex_unlock(&mutexLock); - return; - } - pthread_mutex_unlock(&mutexLock); - /* - * BUGBUG: All core and Thread package tests pass when usleep() - * is used; however, the Thread package tests hang at - * various places when Tcl_Sleep() is used, typically - * while running test "thread-17.8", "thread-17.9", or - * "thread-17.11a". Really, what we want here is just - * to yield to other threads for a while. - */ -#ifdef HAVE_USLEEP - usleep(TCL_MUTEX_LOCK_SLEEP_TIME * 1000); -#else - Tcl_Sleep(TCL_MUTEX_LOCK_SLEEP_TIME); -#endif + + pmutexPtr = *((pthread_mutex_t **)mutexPtr); + if (pmutexPtr == NULL) { + goto retry; } + pthread_mutex_lock(pmutexPtr); } /* diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index ae7ce80..927e115 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -24,16 +24,6 @@ _CRTIMP unsigned int __cdecl _controlfp (unsigned int unNew, unsigned int unMask #endif /* - * This is the number of milliseconds to wait between internal retries in - * the Tcl_MutexLock function. This value must be greater than or equal - * to zero and should be a suitable value for the given platform. - */ - -#ifndef TCL_MUTEX_LOCK_SLEEP_TIME -# define TCL_MUTEX_LOCK_SLEEP_TIME (0) -#endif - -/* * This is the master lock used to serialize access to other serialization * data structures. */ @@ -67,13 +57,6 @@ static int allocOnce = 0; #endif /* TCL_THREADS */ /* - * The mutexLock serializes Tcl_MutexLock. This is necessary to prevent - * races when finalizing a mutex that some other thread may want to lock. - */ - -static CRITICAL_SECTION mutexLock; - -/* * The joinLock serializes Create- and ExitThread. This is necessary to * prevent a race where a new joinable thread exits before the creating thread * had the time to create the necessary data structures in the emulation @@ -386,7 +369,6 @@ TclpInitLock(void) */ init = 1; - InitializeCriticalSection(&mutexLock); InitializeCriticalSection(&joinLock); InitializeCriticalSection(&initLock); InitializeCriticalSection(&masterLock); @@ -534,7 +516,6 @@ void TclFinalizeLock(void) { MASTER_LOCK; - DeleteCriticalSection(&mutexLock); DeleteCriticalSection(&joinLock); /* @@ -605,20 +586,12 @@ retry: } MASTER_UNLOCK; } - while (1) { - EnterCriticalSection(&mutexLock); - csPtr = *((CRITICAL_SECTION **)mutexPtr); - if (csPtr == NULL) { - LeaveCriticalSection(&mutexLock); - goto retry; - } - if (TryEnterCriticalSection(csPtr)) { - LeaveCriticalSection(&mutexLock); - return; - } - LeaveCriticalSection(&mutexLock); - Tcl_Sleep(TCL_MUTEX_LOCK_SLEEP_TIME); + + csPtr = *((CRITICAL_SECTION **)mutexPtr); + if (csPtr == NULL) { + goto retry; } + EnterCriticalSection(csPtr); } /* -- cgit v0.12 From 38d734ddcfc00e2885ad397ee93ac12e062be4ef Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 3 Nov 2015 13:13:14 +0000 Subject: better handle out-of-memory conditions in ZIP filesystem hard-wire initial encoding on Android to UTF-8 --- generic/zipfs.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++------- unix/tclUnixInit.c | 4 +++ 2 files changed, 69 insertions(+), 9 deletions(-) diff --git a/generic/zipfs.c b/generic/zipfs.c index 1722688..e3bb7db 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -830,7 +830,14 @@ ZipFSOpenArchive(Tcl_Interp *interp, CONST char *zipname, int needZip, goto error; } Tcl_Seek(zf->chan, 0, SEEK_SET); - zf->tofree = zf->data = (unsigned char *) Tcl_Alloc(zf->length); + zf->tofree = zf->data = (unsigned char *) Tcl_AttemptAlloc(zf->length); + if (zf->tofree == NULL) { + if (interp) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("out of memory", -1)); + } + goto error; + } i = Tcl_Read(zf->chan, (char *) zf->data, zf->length); if (i != zf->length) { if (interp) { @@ -1092,7 +1099,16 @@ Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, CONST char *mntpt, if (strcmp(mntpt, "/") == 0) { mntpt = ""; } - zf = (ZipFile *) Tcl_Alloc(sizeof (*zf) + strlen(mntpt) + 1); + zf = (ZipFile *) Tcl_AttemptAlloc(sizeof (*zf) + strlen(mntpt) + 1); + if (zf == NULL) { + if (interp != NULL) { + Tcl_AppendResult(interp, "out of memory", (char *) NULL); + } + Unlock(); + Tcl_DStringFree(&ds); + ZipFSCloseArchive(interp, &zf0); + return TCL_ERROR; + } *zf = zf0; zf->name = Tcl_GetHashKey(&ZipFS.zipHash, hPtr); strcpy(zf->mntpt, mntpt); @@ -2263,8 +2279,8 @@ ZipChannelClose(ClientData instanceData, Tcl_Interp *interp) ZipEntry *z = info->zipentry; unsigned char *newdata; - newdata = - (unsigned char *) Tcl_Realloc((char *) info->ubuf, info->nread); + newdata = (unsigned char *) + Tcl_AttemptRealloc((char *) info->ubuf, info->nread); if (newdata != NULL) { if (z->data != NULL) { Tcl_Free((char *) z->data); @@ -2595,7 +2611,13 @@ ZipChannelOpen(Tcl_Interp *interp, char *filename, int mode, int permissions) } else { flags = TCL_WRITABLE; } - info = (ZipChannel *) Tcl_Alloc (sizeof (*info)); + info = (ZipChannel *) Tcl_AttemptAlloc(sizeof (*info)); + if (info == NULL) { + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("out of memory", -1)); + } + goto error; + } info->zipfile = z->zipfile; info->zipentry = z; info->nread = 0; @@ -2606,7 +2628,19 @@ ZipChannelOpen(Tcl_Interp *interp, char *filename, int mode, int permissions) info->nmax = ZipFS.wrmax; info->iscompr = 0; info->isenc = 0; - info->ubuf = (unsigned char *) Tcl_Alloc(info->nmax); + info->ubuf = (unsigned char *) Tcl_AttemptAlloc(info->nmax); + if (info->ubuf == NULL) { +merror0: + if (info->ubuf != NULL) { + Tcl_Free((char *) info->ubuf); + } + Tcl_Free((char *) info); + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("out of memory", -1)); + } + goto error; + } memset(info->ubuf, 0, info->nmax); if (trunc) { info->nbyte = 0; @@ -2650,7 +2684,11 @@ ZipChannelOpen(Tcl_Interp *interp, char *filename, int mode, int permissions) stream.avail_in = z->nbytecompr; if (z->isenc) { stream.avail_in -= 12; - cbuf = (unsigned char *) Tcl_Alloc(stream.avail_in); + cbuf = (unsigned char *) + Tcl_AttemptAlloc(stream.avail_in); + if (cbuf == NULL) { + goto merror0; + } for (i = 0; i < stream.avail_in; i++) { ch = info->ubuf[i]; cbuf[i] = zdecode(info->keys, crc32tab, ch); @@ -2747,7 +2785,11 @@ cerror0: stream.avail_in = z->nbytecompr; if (info->isenc) { stream.avail_in -= 12; - ubuf = (unsigned char *) Tcl_Alloc(stream.avail_in); + ubuf = (unsigned char *) Tcl_AttemptAlloc(stream.avail_in); + if (ubuf == NULL) { + info->ubuf = NULL; + goto merror; + } for (i = 0; i < stream.avail_in; i++) { ch = info->ubuf[i]; ubuf[i] = zdecode(info->keys, crc32tab, ch); @@ -2757,7 +2799,21 @@ cerror0: stream.next_in = info->ubuf; } stream.next_out = info->ubuf = - (unsigned char *) Tcl_Alloc(info->nbyte); + (unsigned char *) Tcl_AttemptAlloc(info->nbyte); + if (info->ubuf == NULL) { +merror: + if (ubuf != NULL) { + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) ubuf); + } + Tcl_Free((char *) info); + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("out of memory", -1)); + } + goto error; + } stream.avail_out = info->nbyte; if (inflateInit2(&stream, -15) != Z_OK) { goto cerror; diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index c0fa94d..cb1f70e 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -588,10 +588,14 @@ TclpInitLibraryPath( void TclpSetInitialEncodings(void) { +#ifdef ANDROID + Tcl_SetSystemEncoding(NULL, "utf-8"); +#else Tcl_DString encodingName; Tcl_SetSystemEncoding(NULL, Tcl_GetEncodingNameFromEnvironment(&encodingName)); Tcl_DStringFree(&encodingName); +#endif } void -- cgit v0.12 From 19627fed479882d04fb4d3e738e4f959ff60b34d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 16 Dec 2015 13:26:54 +0000 Subject: Remove zipfs symbols from stub table. Those symbols should be exported as-is, without using the stub mechanism. --- generic/tclInt.decls | 12 ------------ generic/tclIntDecls.h | 18 ------------------ generic/tclStubInit.c | 3 --- generic/zipfs.h | 19 +++++-------------- 4 files changed, 5 insertions(+), 47 deletions(-) diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 5aadbf2..53d5ad0 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -1014,18 +1014,6 @@ declare 251 { int TclRegisterLiteral(void *envPtr, char *bytes, int length, int flags) } - -declare 252 { - int Tclzipfs_Init(Tcl_Interp *interp) -} -declare 253 { - int Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, - const char *mntpt, const char *passwd) -} -declare 254 { - int Tclzipfs_Unmount(Tcl_Interp *interp, const char *zipname) -} - ############################################################################## diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 5962b60..bbd1aae 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -614,15 +614,6 @@ EXTERN void TclSetSlaveCancelFlags(Tcl_Interp *interp, int flags, /* 251 */ EXTERN int TclRegisterLiteral(void *envPtr, char *bytes, int length, int flags); -/* 252 */ -EXTERN int Tclzipfs_Init(Tcl_Interp *interp); -/* 253 */ -EXTERN int Tclzipfs_Mount(Tcl_Interp *interp, - const char *zipname, const char *mntpt, - const char *passwd); -/* 254 */ -EXTERN int Tclzipfs_Unmount(Tcl_Interp *interp, - const char *zipname); typedef struct TclIntStubs { int magic; @@ -880,9 +871,6 @@ typedef struct TclIntStubs { char * (*tclDoubleDigits) (double dv, int ndigits, int flags, int *decpt, int *signum, char **endPtr); /* 249 */ void (*tclSetSlaveCancelFlags) (Tcl_Interp *interp, int flags, int force); /* 250 */ int (*tclRegisterLiteral) (void *envPtr, char *bytes, int length, int flags); /* 251 */ - int (*tclzipfs_Init) (Tcl_Interp *interp); /* 252 */ - int (*tclzipfs_Mount) (Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd); /* 253 */ - int (*tclzipfs_Unmount) (Tcl_Interp *interp, const char *zipname); /* 254 */ } TclIntStubs; extern const TclIntStubs *tclIntStubsPtr; @@ -1311,12 +1299,6 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclSetSlaveCancelFlags) /* 250 */ #define TclRegisterLiteral \ (tclIntStubsPtr->tclRegisterLiteral) /* 251 */ -#define Tclzipfs_Init \ - (tclIntStubsPtr->tclzipfs_Init) /* 252 */ -#define Tclzipfs_Mount \ - (tclIntStubsPtr->tclzipfs_Mount) /* 253 */ -#define Tclzipfs_Unmount \ - (tclIntStubsPtr->tclzipfs_Unmount) /* 254 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 214b0c4..95e46ca 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -562,9 +562,6 @@ static const TclIntStubs tclIntStubs = { TclDoubleDigits, /* 249 */ TclSetSlaveCancelFlags, /* 250 */ TclRegisterLiteral, /* 251 */ - Tclzipfs_Init, /* 252 */ - Tclzipfs_Mount, /* 253 */ - Tclzipfs_Unmount, /* 254 */ }; static const TclIntPlatStubs tclIntPlatStubs = { diff --git a/generic/zipfs.h b/generic/zipfs.h index a6bd45c..acc709b 100644 --- a/generic/zipfs.h +++ b/generic/zipfs.h @@ -33,20 +33,11 @@ extern "C" { #define Zipfs_SafeInit Tclzipfs_SafeInit #endif -#ifndef EXTERN -#define EXTERN extern -#endif - -#ifdef BUILD_tcl -#undef EXTERN -#define EXTERN -#endif - -EXTERN int Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, - CONST char *mntpt, CONST char *passwd); -EXTERN int Zipfs_Unmount(Tcl_Interp *interp, CONST char *zipname); -EXTERN int Zipfs_Init(Tcl_Interp *interp); -EXTERN int Zipfs_SafeInit(Tcl_Interp *interp); +DLLEXPORT int Zipfs_Mount(Tcl_Interp *interp, const char *zipname, + const char *mntpt, const char *passwd); +DLLEXPORT int Zipfs_Unmount(Tcl_Interp *interp, const char *zipname); +DLLEXPORT int Zipfs_Init(Tcl_Interp *interp); +DLLEXPORT int Zipfs_SafeInit(Tcl_Interp *interp); #ifdef __cplusplus } -- cgit v0.12 From 8f6089f225a01b69fadeb69105db95887d3ba9a5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 16 Dec 2015 13:37:20 +0000 Subject: No need for more than tcl.h in zipfs.h --- generic/zipfs.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/generic/zipfs.h b/generic/zipfs.h index acc709b..a19e214 100644 --- a/generic/zipfs.h +++ b/generic/zipfs.h @@ -13,12 +13,13 @@ #ifndef _ZIPFS_H #define _ZIPFS_H +#include "tcl.h" + #ifdef __cplusplus extern "C" { #endif #ifdef ZIPFS_IN_TK -#include "tkInt.h" #define Zipfs_Mount Tkzipfs_Mount #define Zipfs_Unmount Tkzipfs_Unmount #define Zipfs_Init Tkzipfs_Init @@ -26,16 +27,15 @@ extern "C" { #endif #ifdef ZIPFS_IN_TCL -#include "tclPort.h" #define Zipfs_Mount Tclzipfs_Mount #define Zipfs_Unmount Tclzipfs_Unmount #define Zipfs_Init Tclzipfs_Init #define Zipfs_SafeInit Tclzipfs_SafeInit #endif -DLLEXPORT int Zipfs_Mount(Tcl_Interp *interp, const char *zipname, - const char *mntpt, const char *passwd); -DLLEXPORT int Zipfs_Unmount(Tcl_Interp *interp, const char *zipname); +DLLEXPORT int Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, + CONST char *mntpt, CONST char *passwd); +DLLEXPORT int Zipfs_Unmount(Tcl_Interp *interp, CONST char *zipname); DLLEXPORT int Zipfs_Init(Tcl_Interp *interp); DLLEXPORT int Zipfs_SafeInit(Tcl_Interp *interp); -- cgit v0.12 From 58ace2b1dc62afca0a94b701a8c7857f2b620313 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 16 Dec 2015 15:18:59 +0000 Subject: remove unnecessary Tclzipfs defines in tclStubInit.c --- generic/tclStubInit.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 95e46ca..9131c45 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -48,12 +48,6 @@ #undef TclWinGetSockOpt #undef TclWinSetSockOpt -#ifndef ZIPFS_IN_TCL -# define Tclzipfs_Init 0 -# define Tclzipfs_Mount 0 -# define Tclzipfs_Unmount 0 -#endif - /* See bug 510001: TclSockMinimumBuffers needs plat imp */ #ifdef _WIN64 # define TclSockMinimumBuffersOld 0 -- cgit v0.12 From d6fdfa46244d1d14d8c2dce5378e3a23ab51aac2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 17 Dec 2015 12:04:22 +0000 Subject: minor tweaks for MSVC --- generic/zipfs.h | 20 ++++++++++++++++---- unix/tclUnixInit.c | 3 +++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/generic/zipfs.h b/generic/zipfs.h index a19e214..15ca37c 100644 --- a/generic/zipfs.h +++ b/generic/zipfs.h @@ -19,11 +19,19 @@ extern "C" { #endif +#ifndef ZIPFSAPI +# define ZIPFSAPI extern +#endif + #ifdef ZIPFS_IN_TK #define Zipfs_Mount Tkzipfs_Mount #define Zipfs_Unmount Tkzipfs_Unmount #define Zipfs_Init Tkzipfs_Init #define Zipfs_SafeInit Tkzipfs_SafeInit +#ifdef BUILD_tk +# undef ZIPFSAPI +# define ZIPFSAPI DLLEXPORT +#endif #endif #ifdef ZIPFS_IN_TCL @@ -31,13 +39,17 @@ extern "C" { #define Zipfs_Unmount Tclzipfs_Unmount #define Zipfs_Init Tclzipfs_Init #define Zipfs_SafeInit Tclzipfs_SafeInit +#ifdef BUILD_tcl +# undef ZIPFSAPI +# define ZIPFSAPI DLLEXPORT +#endif #endif -DLLEXPORT int Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, +ZIPFSAPI int Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, CONST char *mntpt, CONST char *passwd); -DLLEXPORT int Zipfs_Unmount(Tcl_Interp *interp, CONST char *zipname); -DLLEXPORT int Zipfs_Init(Tcl_Interp *interp); -DLLEXPORT int Zipfs_SafeInit(Tcl_Interp *interp); +ZIPFSAPI int Zipfs_Unmount(Tcl_Interp *interp, CONST char *zipname); +ZIPFSAPI int Zipfs_Init(Tcl_Interp *interp); +ZIPFSAPI int Zipfs_SafeInit(Tcl_Interp *interp); #ifdef __cplusplus } diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index cb1f70e..e8ccc76 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -9,6 +9,9 @@ */ #include "tclInt.h" +#ifdef ZIPFS_IN_TCL +#include "zipfs.h" +#endif #include #include #ifdef HAVE_LANGINFO -- cgit v0.12 From ecd9567624afb68333af5c0439bf195145312858 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 17 Dec 2015 15:23:27 +0000 Subject: Minor tweaks on ZIPFS_IN_TCL --- generic/tclMain.c | 12 +++++++----- unix/configure | 18 ++++++++++++++++++ unix/configure.in | 8 ++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/generic/tclMain.c b/generic/tclMain.c index a52d62d..6acd15d 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -321,14 +321,14 @@ Tcl_MainEx( { Tcl_Obj *path, *resultPtr, *argvPtr, *appName; const char *encodingName = NULL; - int code, length, exitCode = 0; + int code, exitCode = 0; Tcl_MainLoopProc *mainLoopProc; Tcl_Channel chan; InteractiveState is; +#ifdef ZIPFS_IN_TCL const char *zipFile = NULL; Tcl_Obj *zipval = NULL; int autoRun = 1; -#ifdef ZIPFS_IN_TCL int zipOk = TCL_ERROR; #ifndef ANDROID const char *exeName; @@ -337,7 +337,7 @@ Tcl_MainEx( TclpSetInitialEncodings(); TclpFindExecutable((const char *)argv[0]); -#ifndef ANDROID +#if defined(ZIPFS_IN_TCL) && !defined(ANDROID) exeName = Tcl_GetNameOfExecutable(); #endif @@ -369,8 +369,9 @@ Tcl_MainEx( Tcl_DecrRefCount(value); argc -= 3; argv += 3; +#ifdef ZIPFS_IN_TCL } else if (argc > 2) { - length = strlen((char *) argv[1]); + int length = strlen((char *) argv[1]); if ((length >= 2) && (0 == _tcsncmp(TEXT("-zip"), argv[1], length))) { argc--; @@ -387,6 +388,7 @@ Tcl_MainEx( argc--; argv++; } +#endif } else if ((argc > 1) && ('-' != argv[1][0])) { Tcl_SetStartupScript(NewNativeObj(argv[1], -1), NULL); argc--; @@ -475,11 +477,11 @@ Tcl_MainEx( Tcl_DStringFree(&dsLib); #endif } -#endif if (zipval != NULL) { Tcl_DecrRefCount(zipval); zipval = NULL; } +#endif /* * Invoke application-specific initialization. diff --git a/unix/configure b/unix/configure index c19a77a..3e72a0d 100755 --- a/unix/configure +++ b/unix/configure @@ -869,6 +869,7 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-encoding encoding for configuration values (default: iso8859-1) + --with-zipfs include ZIP filesystem --with-tzdata install timezone data (default: autodetect) Some influential environment variables: @@ -6211,6 +6212,23 @@ cat >>confdefs.h <<\_ACEOF _ACEOF +# Check whether --with-zipfs or --without-zipfs was given. +if test "${with_zipfs+set}" = set; then + withval="$with_zipfs" + tcl_ok=$withval +else + tcl_ok=no +fi; +echo "$as_me:$LINENO: result: $tcl_ok" >&5 +echo "${ECHO_T}$tcl_ok" >&6 +if test $tcl_ok = yes; then + +cat >>confdefs.h <<\_ACEOF +#define ZIPFS_IN_TCL 1 +_ACEOF + +fi + #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This # macro depends on the value of SHARED_BUILD, and should be called diff --git a/unix/configure.in b/unix/configure.in index c7b0edc..7eeff3b 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -171,6 +171,14 @@ AS_IF([test $zlib_ok = no], [ AC_SUBST(ZLIB_INCLUDE,[-I\${ZLIB_DIR}]) ]) AC_DEFINE(HAVE_ZLIB, 1, [Is there an installed zlib?]) +AC_ARG_WITH(zipfs, + AC_HELP_STRING([--with-zipfs], + [include ZIP filesystem]), + [tcl_ok=$withval], [tcl_ok=no]) +AC_MSG_RESULT([$tcl_ok]) +if test $tcl_ok = yes; then + AC_DEFINE(ZIPFS_IN_TCL, 1, [Include ZIP filesystem?]) +fi #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This -- cgit v0.12 From c795f44ea527a23d9d9cba2f4c811053ac7af6ff Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 18 Dec 2015 12:39:24 +0000 Subject: upstream androwish change --- debian/rules | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index 7a0214c..a4b3bd4 100755 --- a/debian/rules +++ b/debian/rules @@ -18,8 +18,6 @@ else CFLAGS=-g -O2 -fno-unit-at-a-time endif -CFLAGS+=-DZIPFS_IN_TCL=1 - unpatch: dh_testdir quilt pop -a || test $$? = 2 @@ -49,7 +47,8 @@ build-stamp: patch-stamp --enable-man-symlinks \ --enable-man-compression=gzip \ --enable-threads \ - --without-tzdata && \ + --without-tzdata \ + --with-zipfs && \ touch ../generic/tclStubInit.c && \ $(MAKE) # Build the static library. -- cgit v0.12 From 4d946107e7d14769b306d8bf05ff4f661b7883ff Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 21 Dec 2015 09:16:38 +0000 Subject: Put back the stub entries for TclpGetDate/TclpLocaltime/TclpGmtime. Although those functions are dead (they will be removed in Tcl 9, already done in the "novem" branch), removing those functions is a good idea, this cannot be done in any 8.x release. It hinders the acceptance of a "zipfs" TIP, therefore this change should not be part of the "androwish" change-set. --- generic/tclInt.decls | 35 +++--- generic/tclIntDecls.h | 24 ++-- generic/tclIntPlatDecls.h | 32 +++-- generic/tclStubInit.c | 18 +-- unix/tclUnixTime.c | 197 +++++++++++++++++++++++++++++ win/tclWinTime.c | 308 +++++++++++++++++++++++++++++++++++++++++++++- 6 files changed, 565 insertions(+), 49 deletions(-) diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 53d5ad0..4e7e422 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -532,10 +532,9 @@ declare 131 { declare 132 { int TclpHasSockets(Tcl_Interp *interp) } -# Removed in androwish -# declare 133 { -# struct tm *TclpGetDate(const time_t *time, int useGMT) -#} +declare 133 { + struct tm *TclpGetDate(const time_t *time, int useGMT) +} # Removed in 8.5 #declare 134 { # size_t TclpStrftime(char *s, size_t maxsize, const char *format, @@ -751,14 +750,12 @@ declare 179 { # TclpGmtime and TclpLocaltime promoted to the generic interface from unix -# Removed in androwish -#declare 182 { -# struct tm *TclpLocaltime(const time_t *clock) -#} -# Removed in androwish -#declare 183 { -# struct tm *TclpGmtime(const time_t *clock) -#} +declare 182 { + struct tm *TclpLocaltime(const time_t *clock) +} +declare 183 { + struct tm *TclpGmtime(const time_t *clock) +} # For the new "Thread Storage" subsystem. @@ -1207,14 +1204,12 @@ declare 10 unix { } # Slots 11 and 12 are forwarders for functions that were promoted to # generic Stubs -# Removed in androwish -#declare 11 unix { -# struct tm *TclpLocaltime_unix(const time_t *clock) -#} -# Removed in androwish -#declare 12 unix { -# struct tm *TclpGmtime_unix(const time_t *clock) -#} +declare 11 unix { + struct tm *TclpLocaltime_unix(const time_t *clock) +} +declare 12 unix { + struct tm *TclpGmtime_unix(const time_t *clock) +} declare 13 unix { char *TclpInetNtoa(struct in_addr addr) } diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index bbd1aae..f95f999 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -349,7 +349,8 @@ EXTERN void Tcl_SetNamespaceResolvers( Tcl_ResolveCompiledVarProc *compiledVarProc); /* 132 */ EXTERN int TclpHasSockets(Tcl_Interp *interp); -/* Slot 133 is reserved */ +/* 133 */ +EXTERN struct tm * TclpGetDate(const time_t *time, int useGMT); /* Slot 134 is reserved */ /* Slot 135 is reserved */ /* Slot 136 is reserved */ @@ -462,8 +463,10 @@ EXTERN void Tcl_SetStartupScript(Tcl_Obj *pathPtr, EXTERN Tcl_Obj * Tcl_GetStartupScript(const char **encodingNamePtr); /* Slot 180 is reserved */ /* Slot 181 is reserved */ -/* Slot 182 is reserved */ -/* Slot 183 is reserved */ +/* 182 */ +EXTERN struct tm * TclpLocaltime(const time_t *clock); +/* 183 */ +EXTERN struct tm * TclpGmtime(const time_t *clock); /* Slot 184 is reserved */ /* Slot 185 is reserved */ /* Slot 186 is reserved */ @@ -752,7 +755,7 @@ typedef struct TclIntStubs { int (*tcl_RemoveInterpResolvers) (Tcl_Interp *interp, const char *name); /* 130 */ void (*tcl_SetNamespaceResolvers) (Tcl_Namespace *namespacePtr, Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc, Tcl_ResolveCompiledVarProc *compiledVarProc); /* 131 */ int (*tclpHasSockets) (Tcl_Interp *interp); /* 132 */ - void (*reserved133)(void); + struct tm * (*tclpGetDate) (const time_t *time, int useGMT); /* 133 */ void (*reserved134)(void); void (*reserved135)(void); void (*reserved136)(void); @@ -801,8 +804,8 @@ typedef struct TclIntStubs { Tcl_Obj * (*tcl_GetStartupScript) (const char **encodingNamePtr); /* 179 */ void (*reserved180)(void); void (*reserved181)(void); - void (*reserved182)(void); - void (*reserved183)(void); + struct tm * (*tclpLocaltime) (const time_t *clock); /* 182 */ + struct tm * (*tclpGmtime) (const time_t *clock); /* 183 */ void (*reserved184)(void); void (*reserved185)(void); void (*reserved186)(void); @@ -1100,7 +1103,8 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tcl_SetNamespaceResolvers) /* 131 */ #define TclpHasSockets \ (tclIntStubsPtr->tclpHasSockets) /* 132 */ -/* Slot 133 is reserved */ +#define TclpGetDate \ + (tclIntStubsPtr->tclpGetDate) /* 133 */ /* Slot 134 is reserved */ /* Slot 135 is reserved */ /* Slot 136 is reserved */ @@ -1185,8 +1189,10 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tcl_GetStartupScript) /* 179 */ /* Slot 180 is reserved */ /* Slot 181 is reserved */ -/* Slot 182 is reserved */ -/* Slot 183 is reserved */ +#define TclpLocaltime \ + (tclIntStubsPtr->tclpLocaltime) /* 182 */ +#define TclpGmtime \ + (tclIntStubsPtr->tclpGmtime) /* 183 */ /* Slot 184 is reserved */ /* Slot 185 is reserved */ /* Slot 186 is reserved */ diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index b7a44d8..ac06787 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -73,8 +73,10 @@ EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); EXTERN TclFile TclpCreateTempFile(const char *contents); /* 10 */ EXTERN Tcl_DirEntry * TclpReaddir(DIR *dir); -/* Slot 11 is reserved */ -/* Slot 12 is reserved */ +/* 11 */ +EXTERN struct tm * TclpLocaltime_unix(const time_t *clock); +/* 12 */ +EXTERN struct tm * TclpGmtime_unix(const time_t *clock); /* 13 */ EXTERN char * TclpInetNtoa(struct in_addr addr); /* 14 */ @@ -205,8 +207,10 @@ EXTERN int TclUnixWaitForFile(int fd, int mask, int timeout); EXTERN TclFile TclpCreateTempFile(const char *contents); /* 10 */ EXTERN Tcl_DirEntry * TclpReaddir(DIR *dir); -/* Slot 11 is reserved */ -/* Slot 12 is reserved */ +/* 11 */ +EXTERN struct tm * TclpLocaltime_unix(const time_t *clock); +/* 12 */ +EXTERN struct tm * TclpGmtime_unix(const time_t *clock); /* 13 */ EXTERN char * TclpInetNtoa(struct in_addr addr); /* 14 */ @@ -266,8 +270,8 @@ typedef struct TclIntPlatStubs { int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */ TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */ Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */ - void (*reserved11)(void); - void (*reserved12)(void); + struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */ + struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */ char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */ int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */ void (*reserved15)(void); @@ -332,8 +336,8 @@ typedef struct TclIntPlatStubs { int (*tclUnixWaitForFile) (int fd, int mask, int timeout); /* 8 */ TclFile (*tclpCreateTempFile) (const char *contents); /* 9 */ Tcl_DirEntry * (*tclpReaddir) (DIR *dir); /* 10 */ - void (*reserved11)(void); - void (*reserved12)(void); + struct tm * (*tclpLocaltime_unix) (const time_t *clock); /* 11 */ + struct tm * (*tclpGmtime_unix) (const time_t *clock); /* 12 */ char * (*tclpInetNtoa) (struct in_addr addr); /* 13 */ int (*tclUnixCopyFile) (const char *src, const char *dst, const Tcl_StatBuf *statBufPtr, int dontCopyAtts); /* 14 */ int (*tclMacOSXGetFileAttribute) (Tcl_Interp *interp, int objIndex, Tcl_Obj *fileName, Tcl_Obj **attributePtrPtr); /* 15 */ @@ -389,8 +393,10 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */ #define TclpReaddir \ (tclIntPlatStubsPtr->tclpReaddir) /* 10 */ -/* Slot 11 is reserved */ -/* Slot 12 is reserved */ +#define TclpLocaltime_unix \ + (tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */ +#define TclpGmtime_unix \ + (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */ #define TclpInetNtoa \ (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */ #define TclUnixCopyFile \ @@ -498,8 +504,10 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; (tclIntPlatStubsPtr->tclpCreateTempFile) /* 9 */ #define TclpReaddir \ (tclIntPlatStubsPtr->tclpReaddir) /* 10 */ -/* Slot 11 is reserved */ -/* Slot 12 is reserved */ +#define TclpLocaltime_unix \ + (tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */ +#define TclpGmtime_unix \ + (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */ #define TclpInetNtoa \ (tclIntPlatStubsPtr->tclpInetNtoa) /* 13 */ #define TclUnixCopyFile \ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 9131c45..5b7a1cd 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -288,6 +288,10 @@ static int formatInt(char *buffer, int n){ #define TclFormatInt (int(*)(char *, long))formatInt #endif + +#else /* UNIX and MAC */ +# define TclpLocaltime_unix TclpLocaltime +# define TclpGmtime_unix TclpGmtime #endif /* @@ -437,7 +441,7 @@ static const TclIntStubs tclIntStubs = { Tcl_RemoveInterpResolvers, /* 130 */ Tcl_SetNamespaceResolvers, /* 131 */ TclpHasSockets, /* 132 */ - 0, /* 133 */ + TclpGetDate, /* 133 */ 0, /* 134 */ 0, /* 135 */ 0, /* 136 */ @@ -486,8 +490,8 @@ static const TclIntStubs tclIntStubs = { Tcl_GetStartupScript, /* 179 */ 0, /* 180 */ 0, /* 181 */ - 0, /* 182 */ - 0, /* 183 */ + TclpLocaltime, /* 182 */ + TclpGmtime, /* 183 */ 0, /* 184 */ 0, /* 185 */ 0, /* 186 */ @@ -573,8 +577,8 @@ static const TclIntPlatStubs tclIntPlatStubs = { TclUnixWaitForFile, /* 8 */ TclpCreateTempFile, /* 9 */ TclpReaddir, /* 10 */ - 0, /* 11 */ - 0, /* 12 */ + TclpLocaltime_unix, /* 11 */ + TclpGmtime_unix, /* 12 */ TclpInetNtoa, /* 13 */ TclUnixCopyFile, /* 14 */ 0, /* 15 */ @@ -639,8 +643,8 @@ static const TclIntPlatStubs tclIntPlatStubs = { TclUnixWaitForFile, /* 8 */ TclpCreateTempFile, /* 9 */ TclpReaddir, /* 10 */ - 0, /* 11 */ - 0, /* 12 */ + TclpLocaltime_unix, /* 11 */ + TclpGmtime_unix, /* 12 */ TclpInetNtoa, /* 13 */ TclUnixCopyFile, /* 14 */ TclMacOSXGetFileAttribute, /* 15 */ diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 470b122..315bcf9 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -17,9 +17,34 @@ #endif /* + * TclpGetDate is coded to return a pointer to a 'struct tm'. For thread + * safety, this structure must be in thread-specific data. The 'tmKey' + * variable is the key to this buffer. + */ + +static Tcl_ThreadDataKey tmKey; +typedef struct ThreadSpecificData { + struct tm gmtime_buf; + struct tm localtime_buf; +} ThreadSpecificData; + +/* + * If we fall back on the thread-unsafe versions of gmtime and localtime, use + * this mutex to try to protect them. + */ + +TCL_DECLARE_MUTEX(tmMutex) + +static char *lastTZ = NULL; /* Holds the last setting of the TZ + * environment variable, or an empty string if + * the variable was not set. */ + +/* * Static functions declared in this file. */ +static void SetTZIfNecessary(void); +static void CleanupMemory(ClientData clientData); static void NativeScaleTime(Tcl_Time *timebuf, ClientData clientData); static void NativeGetTime(Tcl_Time *timebuf, @@ -223,6 +248,114 @@ Tcl_GetTime( /* *---------------------------------------------------------------------- * + * TclpGetDate -- + * + * This function converts between seconds and struct tm. If useGMT is + * true, then the returned date will be in Greenwich Mean Time (GMT). + * Otherwise, it will be in the local time zone. + * + * Results: + * Returns a static tm structure. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +struct tm * +TclpGetDate( + const time_t *time, + int useGMT) +{ + if (useGMT) { + return TclpGmtime(time); + } else { + return TclpLocaltime(time); + } +} + +/* + *---------------------------------------------------------------------- + * + * TclpGmtime -- + * + * Wrapper around the 'gmtime' library function to make it thread safe. + * + * Results: + * Returns a pointer to a 'struct tm' in thread-specific data. + * + * Side effects: + * Invokes gmtime or gmtime_r as appropriate. + * + *---------------------------------------------------------------------- + */ + +struct tm * +TclpGmtime( + const time_t *timePtr) /* Pointer to the number of seconds since the + * local system's epoch */ +{ + /* + * Get a thread-local buffer to hold the returned time. + */ + + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tmKey); + +#ifdef HAVE_GMTIME_R + gmtime_r(timePtr, &tsdPtr->gmtime_buf); +#else + Tcl_MutexLock(&tmMutex); + memcpy(&tsdPtr->gmtime_buf, gmtime(timePtr), sizeof(struct tm)); + Tcl_MutexUnlock(&tmMutex); +#endif + + return &tsdPtr->gmtime_buf; +} + +/* + *---------------------------------------------------------------------- + * + * TclpLocaltime -- + * + * Wrapper around the 'localtime' library function to make it thread + * safe. + * + * Results: + * Returns a pointer to a 'struct tm' in thread-specific data. + * + * Side effects: + * Invokes localtime or localtime_r as appropriate. + * + *---------------------------------------------------------------------- + */ + +struct tm * +TclpLocaltime( + const time_t *timePtr) /* Pointer to the number of seconds since the + * local system's epoch */ +{ + /* + * Get a thread-local buffer to hold the returned time. + */ + + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tmKey); + + SetTZIfNecessary(); +#ifdef HAVE_LOCALTIME_R + localtime_r(timePtr, &tsdPtr->localtime_buf); +#else + Tcl_MutexLock(&tmMutex); + memcpy(&tsdPtr->localtime_buf, localtime(timePtr), sizeof(struct tm)); + Tcl_MutexUnlock(&tmMutex); +#endif + + return &tsdPtr->localtime_buf; +} + +/* + *---------------------------------------------------------------------- + * * Tcl_SetTimeProc -- * * TIP #233 (Virtualized Time): Registers two handlers for the @@ -334,6 +467,70 @@ NativeGetTime( timePtr->sec = tv.tv_sec; timePtr->usec = tv.tv_usec; } +/* + *---------------------------------------------------------------------- + * + * SetTZIfNecessary -- + * + * Determines whether a call to 'tzset' is needed prior to the next call + * to 'localtime' or examination of the 'timezone' variable. + * + * Results: + * None. + * + * Side effects: + * If 'tzset' has never been called in the current process, or if the + * value of the environment variable TZ has changed since the last call + * to 'tzset', then 'tzset' is called again. + * + *---------------------------------------------------------------------- + */ + +static void +SetTZIfNecessary(void) +{ + const char *newTZ = getenv("TZ"); + + Tcl_MutexLock(&tmMutex); + if (newTZ == NULL) { + newTZ = ""; + } + if (lastTZ == NULL || strcmp(lastTZ, newTZ)) { + tzset(); + if (lastTZ == NULL) { + Tcl_CreateExitHandler(CleanupMemory, NULL); + } else { + ckfree(lastTZ); + } + lastTZ = ckalloc(strlen(newTZ) + 1); + strcpy(lastTZ, newTZ); + } + Tcl_MutexUnlock(&tmMutex); +} + +/* + *---------------------------------------------------------------------- + * + * CleanupMemory -- + * + * Releases the private copy of the TZ environment variable upon exit + * from Tcl. + * + * Results: + * None. + * + * Side effects: + * Frees allocated memory. + * + *---------------------------------------------------------------------- + */ + +static void +CleanupMemory( + ClientData ignored) +{ + ckfree(lastTZ); +} /* * Local Variables: diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 0762362..7045c72 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -12,6 +12,10 @@ #include "tclInt.h" +#define SECSPERDAY (60L * 60L * 24L) +#define SECSPERYEAR (SECSPERDAY * 365L) +#define SECSPER4YEAR (SECSPERYEAR * 4L + SECSPERDAY) + /* * Number of samples over which to estimate the performance counter. */ @@ -19,10 +23,29 @@ #define SAMPLES 64 /* + * The following arrays contain the day of year for the last day of each + * month, where index 1 is January. + */ + +static const int normalDays[] = { + -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364 +}; + +static const int leapDays[] = { + -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 +}; + +typedef struct ThreadSpecificData { + char tzName[64]; /* Time zone name */ + struct tm tm; /* time information */ +} ThreadSpecificData; +static Tcl_ThreadDataKey dataKey; + +/* * Data for managing high-resolution timers. */ -typedef struct { +typedef struct TimeInfo { CRITICAL_SECTION cs; /* Mutex guarding this structure. */ int initialized; /* Flag == 1 if this structure is * initialized. */ @@ -90,6 +113,7 @@ static TimeInfo timeInfo = { * Declarations for functions defined later in this file. */ +static struct tm * ComputeGMT(const time_t *tp); static void StopCalibration(ClientData clientData); static DWORD WINAPI CalibrationThread(LPVOID arg); static void UpdateTimeEachSecond(void); @@ -465,6 +489,227 @@ StopCalibration( /* *---------------------------------------------------------------------- * + * TclpGetDate -- + * + * This function converts between seconds and struct tm. If useGMT is + * true, then the returned date will be in Greenwich Mean Time (GMT). + * Otherwise, it will be in the local time zone. + * + * Results: + * Returns a static tm structure. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +struct tm * +TclpGetDate( + const time_t *t, + int useGMT) +{ + struct tm *tmPtr; + time_t time; + + if (!useGMT) { + tzset(); + + /* + * If we are in the valid range, let the C run-time library handle it. + * Otherwise we need to fake it. Note that this algorithm ignores + * daylight savings time before the epoch. + */ + + /* + * Hm, Borland's localtime manages to return NULL under certain + * circumstances (e.g. wintime.test, test 1.2). Nobody tests for this, + * since 'localtime' isn't supposed to do this, possibly leading to + * crashes. + * + * Patch: We only call this function if we are at least one day into + * the epoch, else we handle it ourselves (like we do for times < 0). + * H. Giese, June 2003 + */ + +#ifdef __BORLANDC__ +#define LOCALTIME_VALIDITY_BOUNDARY SECSPERDAY +#else +#define LOCALTIME_VALIDITY_BOUNDARY 0 +#endif + + if (*t >= LOCALTIME_VALIDITY_BOUNDARY) { + return TclpLocaltime(t); + } + + time = *t - timezone; + + /* + * If we aren't near to overflowing the long, just add the bias and + * use the normal calculation. Otherwise we will need to adjust the + * result at the end. + */ + + if (*t < (LONG_MAX - 2*SECSPERDAY) && *t > (LONG_MIN + 2*SECSPERDAY)) { + tmPtr = ComputeGMT(&time); + } else { + tmPtr = ComputeGMT(t); + + tzset(); + + /* + * Add the bias directly to the tm structure to avoid overflow. + * Propagate seconds overflow into minutes, hours and days. + */ + + time = tmPtr->tm_sec - timezone; + tmPtr->tm_sec = (int)(time % 60); + if (tmPtr->tm_sec < 0) { + tmPtr->tm_sec += 60; + time -= 60; + } + + time = tmPtr->tm_min + time/60; + tmPtr->tm_min = (int)(time % 60); + if (tmPtr->tm_min < 0) { + tmPtr->tm_min += 60; + time -= 60; + } + + time = tmPtr->tm_hour + time/60; + tmPtr->tm_hour = (int)(time % 24); + if (tmPtr->tm_hour < 0) { + tmPtr->tm_hour += 24; + time -= 24; + } + + time /= 24; + tmPtr->tm_mday += (int)time; + tmPtr->tm_yday += (int)time; + tmPtr->tm_wday = (tmPtr->tm_wday + (int)time) % 7; + } + } else { + tmPtr = ComputeGMT(t); + } + return tmPtr; +} + +/* + *---------------------------------------------------------------------- + * + * ComputeGMT -- + * + * This function computes GMT given the number of seconds since the epoch + * (midnight Jan 1 1970). + * + * Results: + * Returns a (per thread) statically allocated struct tm. + * + * Side effects: + * Updates the values of the static struct tm. + * + *---------------------------------------------------------------------- + */ + +static struct tm * +ComputeGMT( + const time_t *tp) +{ + struct tm *tmPtr; + long tmp, rem; + int isLeap; + const int *days; + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + + tmPtr = &tsdPtr->tm; + + /* + * Compute the 4 year span containing the specified time. + */ + + tmp = (long)(*tp / SECSPER4YEAR); + rem = (long)(*tp % SECSPER4YEAR); + + /* + * Correct for weird mod semantics so the remainder is always positive. + */ + + if (rem < 0) { + tmp--; + rem += SECSPER4YEAR; + } + + /* + * Compute the year after 1900 by taking the 4 year span and adjusting for + * the remainder. This works because 2000 is a leap year, and 1900/2100 + * are out of the range. + */ + + tmp = (tmp * 4) + 70; + isLeap = 0; + if (rem >= SECSPERYEAR) { /* 1971, etc. */ + tmp++; + rem -= SECSPERYEAR; + if (rem >= SECSPERYEAR) { /* 1972, etc. */ + tmp++; + rem -= SECSPERYEAR; + if (rem >= SECSPERYEAR + SECSPERDAY) { /* 1973, etc. */ + tmp++; + rem -= SECSPERYEAR + SECSPERDAY; + } else { + isLeap = 1; + } + } + } + tmPtr->tm_year = tmp; + + /* + * Compute the day of year and leave the seconds in the current day in the + * remainder. + */ + + tmPtr->tm_yday = rem / SECSPERDAY; + rem %= SECSPERDAY; + + /* + * Compute the time of day. + */ + + tmPtr->tm_hour = rem / 3600; + rem %= 3600; + tmPtr->tm_min = rem / 60; + tmPtr->tm_sec = rem % 60; + + /* + * Compute the month and day of month. + */ + + days = (isLeap) ? leapDays : normalDays; + for (tmp = 1; days[tmp] < tmPtr->tm_yday; tmp++) { + /* empty body */ + } + tmPtr->tm_mon = --tmp; + tmPtr->tm_mday = tmPtr->tm_yday - days[tmp]; + + /* + * Compute day of week. Epoch started on a Thursday. + */ + + tmPtr->tm_wday = (long)(*tp / SECSPERDAY) + 4; + if ((*tp % SECSPERDAY) < 0) { + tmPtr->tm_wday--; + } + tmPtr->tm_wday %= 7; + if (tmPtr->tm_wday < 0) { + tmPtr->tm_wday += 7; + } + + return tmPtr; +} + +/* + *---------------------------------------------------------------------- + * * CalibrationThread -- * * Thread that manages calibration of the hi-resolution time derived from @@ -792,6 +1037,67 @@ AccumulateSample( /* *---------------------------------------------------------------------- * + * TclpGmtime -- + * + * Wrapper around the 'gmtime' library function to make it thread safe. + * + * Results: + * Returns a pointer to a 'struct tm' in thread-specific data. + * + * Side effects: + * Invokes gmtime or gmtime_r as appropriate. + * + *---------------------------------------------------------------------- + */ + +struct tm * +TclpGmtime( + const time_t *timePtr) /* Pointer to the number of seconds since the + * local system's epoch */ +{ + /* + * The MS implementation of gmtime is thread safe because it returns the + * time in a block of thread-local storage, and Windows does not provide a + * Posix gmtime_r function. + */ + + return gmtime(timePtr); +} + +/* + *---------------------------------------------------------------------- + * + * TclpLocaltime -- + * + * Wrapper around the 'localtime' library function to make it thread + * safe. + * + * Results: + * Returns a pointer to a 'struct tm' in thread-specific data. + * + * Side effects: + * Invokes localtime or localtime_r as appropriate. + * + *---------------------------------------------------------------------- + */ + +struct tm * +TclpLocaltime( + const time_t *timePtr) /* Pointer to the number of seconds since the + * local system's epoch */ +{ + /* + * The MS implementation of localtime is thread safe because it returns + * the time in a block of thread-local storage, and Windows does not + * provide a Posix localtime_r function. + */ + + return localtime(timePtr); +} + +/* + *---------------------------------------------------------------------- + * * Tcl_SetTimeProc -- * * TIP #233 (Virtualized Time): Registers two handlers for the -- cgit v0.12 From cb73551e8dda297b93eecea5b526196ef7589c86 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 21 Dec 2015 09:31:36 +0000 Subject: Start of "zipfs" branch, meant for keeping track of the proposed changes for a new TIP. Remove some android-specific build/configure files. --- Android.mk | 204 --------------------------------------------- debian/changelog | 23 ----- debian/compat | 1 - debian/control | 37 -------- debian/copyright | 141 ------------------------------- debian/rules | 130 ----------------------------- debian/sdltcl8.6-dev.dirs | 2 - debian/sdltcl8.6-dev.files | 2 - debian/sdltcl8.6-doc.files | 2 - debian/sdltcl8.6.files | 18 ---- debian/shlibs.local | 1 - pkgs/Android.mk | 1 - tcl-config.mk | 62 -------------- 13 files changed, 624 deletions(-) delete mode 100644 Android.mk delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100755 debian/rules delete mode 100644 debian/sdltcl8.6-dev.dirs delete mode 100644 debian/sdltcl8.6-dev.files delete mode 100644 debian/sdltcl8.6-doc.files delete mode 100644 debian/sdltcl8.6.files delete mode 100644 debian/shlibs.local delete mode 100644 pkgs/Android.mk delete mode 100644 tcl-config.mk diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 13e55d9..0000000 --- a/Android.mk +++ /dev/null @@ -1,204 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -########################### -# -# Tcl shared library -# -########################### - -include $(CLEAR_VARS) - -tcl_path := $(LOCAL_PATH) - -include $(tcl_path)/tcl-config.mk - -LOCAL_ADDITIONAL_DEPENDENCIES += $(tcl_path)/tcl-config.mk - -LOCAL_MODULE := tcl - -LOCAL_ARM_MODE := arm - -LOCAL_C_INCLUDES := $(tcl_includes) $(LOCAL_PATH)/libtommath - -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) - -LOCAL_SRC_FILES := \ - libtommath/bncore.c \ - libtommath/bn_reverse.c \ - libtommath/bn_fast_s_mp_mul_digs.c \ - libtommath/bn_fast_s_mp_sqr.c \ - libtommath/bn_mp_add.c \ - libtommath/bn_mp_add_d.c \ - libtommath/bn_mp_and.c \ - libtommath/bn_mp_clamp.c \ - libtommath/bn_mp_clear.c \ - libtommath/bn_mp_clear_multi.c \ - libtommath/bn_mp_cmp.c \ - libtommath/bn_mp_cmp_d.c \ - libtommath/bn_mp_cmp_mag.c \ - libtommath/bn_mp_copy.c \ - libtommath/bn_mp_cnt_lsb.c \ - libtommath/bn_mp_count_bits.c \ - libtommath/bn_mp_div.c \ - libtommath/bn_mp_div_d.c \ - libtommath/bn_mp_div_2.c \ - libtommath/bn_mp_div_2d.c \ - libtommath/bn_mp_div_3.c \ - libtommath/bn_mp_exch.c \ - libtommath/bn_mp_expt_d.c \ - libtommath/bn_mp_grow.c \ - libtommath/bn_mp_init.c \ - libtommath/bn_mp_init_copy.c \ - libtommath/bn_mp_init_multi.c \ - libtommath/bn_mp_init_set.c \ - libtommath/bn_mp_init_set_int.c \ - libtommath/bn_mp_init_size.c \ - libtommath/bn_mp_karatsuba_mul.c \ - libtommath/bn_mp_karatsuba_sqr.c \ - libtommath/bn_mp_lshd.c \ - libtommath/bn_mp_mod.c \ - libtommath/bn_mp_mod_2d.c \ - libtommath/bn_mp_mul.c \ - libtommath/bn_mp_mul_2.c \ - libtommath/bn_mp_mul_2d.c \ - libtommath/bn_mp_mul_d.c \ - libtommath/bn_mp_neg.c \ - libtommath/bn_mp_or.c \ - libtommath/bn_mp_radix_size.c \ - libtommath/bn_mp_radix_smap.c \ - libtommath/bn_mp_read_radix.c \ - libtommath/bn_mp_rshd.c \ - libtommath/bn_mp_set.c \ - libtommath/bn_mp_set_int.c \ - libtommath/bn_mp_shrink.c \ - libtommath/bn_mp_sqr.c \ - libtommath/bn_mp_sqrt.c \ - libtommath/bn_mp_sub.c \ - libtommath/bn_mp_sub_d.c \ - libtommath/bn_mp_to_unsigned_bin.c \ - libtommath/bn_mp_to_unsigned_bin_n.c \ - libtommath/bn_mp_toom_mul.c \ - libtommath/bn_mp_toom_sqr.c \ - libtommath/bn_mp_toradix_n.c \ - libtommath/bn_mp_unsigned_bin_size.c \ - libtommath/bn_mp_xor.c \ - libtommath/bn_mp_zero.c \ - libtommath/bn_s_mp_add.c \ - libtommath/bn_s_mp_mul_digs.c \ - libtommath/bn_s_mp_sqr.c \ - libtommath/bn_s_mp_sub.c \ - generic/regcomp.c \ - generic/regexec.c \ - generic/regfree.c \ - generic/regerror.c \ - generic/tclAlloc.c \ - generic/tclAssembly.c \ - generic/tclAsync.c \ - generic/tclBasic.c \ - generic/tclBinary.c \ - generic/tclCkalloc.c \ - generic/tclClock.c \ - generic/tclCmdAH.c \ - generic/tclCmdIL.c \ - generic/tclCmdMZ.c \ - generic/tclCompCmds.c \ - generic/tclCompCmdsGR.c \ - generic/tclCompCmdsSZ.c \ - generic/tclCompExpr.c \ - generic/tclCompile.c \ - generic/tclConfig.c \ - generic/tclDate.c \ - generic/tclDictObj.c \ - generic/tclDisassemble.c \ - generic/tclEncoding.c \ - generic/tclEnsemble.c \ - generic/tclEnv.c \ - generic/tclEvent.c \ - generic/tclExecute.c \ - generic/tclFCmd.c \ - generic/tclFileName.c \ - generic/tclGet.c \ - generic/tclHash.c \ - generic/tclHistory.c \ - generic/tclIndexObj.c \ - generic/tclInterp.c \ - generic/tclIO.c \ - generic/tclIOCmd.c \ - generic/tclIOGT.c \ - generic/tclIOSock.c \ - generic/tclIOUtil.c \ - generic/tclIORChan.c \ - generic/tclIORTrans.c \ - generic/tclLink.c \ - generic/tclListObj.c \ - generic/tclLiteral.c \ - generic/tclLoad.c \ - generic/tclMain.c \ - generic/tclNamesp.c \ - generic/tclNotify.c \ - generic/tclObj.c \ - generic/tclOptimize.c \ - generic/tclPanic.c \ - generic/tclParse.c \ - generic/tclPathObj.c \ - generic/tclPipe.c \ - generic/tclPkg.c \ - generic/tclPkgConfig.c \ - generic/tclPosixStr.c \ - generic/tclPreserve.c \ - generic/tclProc.c \ - generic/tclRegexp.c \ - generic/tclResolve.c \ - generic/tclResult.c \ - generic/tclScan.c \ - generic/tclStubInit.c \ - generic/tclStringObj.c \ - generic/tclStrToD.c \ - generic/tclThread.c \ - generic/tclThreadAlloc.c \ - generic/tclThreadJoin.c \ - generic/tclThreadStorage.c \ - generic/tclTimer.c \ - generic/tclTomMathInterface.c \ - generic/tclTrace.c \ - generic/tclUtil.c \ - generic/tclUtf.c \ - generic/tclVar.c \ - generic/tclZlib.c \ - generic/tclOO.c \ - generic/tclOOBasic.c \ - generic/tclOOCall.c \ - generic/tclOODefineCmds.c \ - generic/tclOOInfo.c \ - generic/tclOOMethod.c \ - generic/tclOOStubInit.c \ - generic/tclStubLib.c \ - generic/tclTomMathStubLib.c \ - generic/tclOOStubLib.c \ - generic/zipfs.c \ - unix/tclAppInit.c \ - unix/tclLoadDl.c \ - unix/tclUnixChan.c \ - unix/tclUnixCompat.c \ - unix/tclUnixEvent.c \ - unix/tclUnixFCmd.c \ - unix/tclUnixFile.c \ - unix/tclUnixInit.c \ - unix/tclUnixNotfy.c \ - unix/tclUnixPipe.c \ - unix/tclUnixSock.c \ - unix/tclUnixTest.c \ - unix/tclUnixThrd.c \ - unix/tclUnixTime.c - -LOCAL_CFLAGS := $(tcl_cflags) \ - -DPACKAGE_NAME="\"tcl\"" \ - -DPACKAGE_VERSION="\"8.6\"" \ - -DBUILD_tcl=1 \ - -Dmain=tclsh \ - -O2 - -LOCAL_LDLIBS := -ldl -lz -llog - -include $(BUILD_SHARED_LIBRARY) - diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index caad3ba..0000000 --- a/debian/changelog +++ /dev/null @@ -1,23 +0,0 @@ -sdltcl8.6 (8.6.4-1) unstable; urgency=low - - * Update to 8.6.4 - - -- Christian Werner Thu, 12 Mar 2015 22:00:00 +0100 - -sdltcl8.6 (8.6.3-1) unstable; urgency=low - - * Update to 8.6.3 - - -- Christian Werner Wed, 12 Nov 2014 20:00:00 +0100 - -sdltcl8.6 (8.6.2-1) unstable; urgency=low - - * Update to 8.6.2 - - -- Christian Werner Thu, 28 Aug 2014 07:10:10 +0200 - -sdltcl8.6 (8.6.1-1) unstable; urgency=low - - * Initial packaging - - -- Christian Werner Sat, 05 Apr 2014 14:44:48 +0200 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7ed6ff8..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/debian/control b/debian/control deleted file mode 100644 index 3434297..0000000 --- a/debian/control +++ /dev/null @@ -1,37 +0,0 @@ -Source: sdltcl8.6 -Section: libs -Priority: optional -Maintainer: -Build-Depends: debhelper (>= 5.0.0), quilt -Standards-Version: 3.8.3 -Homepage: http://www.tcl.tk/ - -Package: sdltcl8.6 -Section: interpreters -Priority: optional -Architecture: any -Depends: ${shlibs:Depends} -Description: Tcl (the Tool Command Language) v8.6 - run-time files - Tcl is a powerful, easy to use, embeddable, cross-platform interpreted - scripting language. This package contains everything you need to run - Tcl scripts and Tcl-enabled apps. This version includes thread support. - -Package: sdltcl8.6-doc -Section: doc -Priority: optional -Architecture: all -Suggests: sdltcl8.6 -Description: Tcl (the Tool Command Language) v8.6 - manual pages - Tcl is a powerful, easy-to-use, embeddable, cross-platform interpreted - scripting language. This package contains the man pages for Tcl commands. - -Package: sdltcl8.6-dev -Section: devel -Priority: optional -Architecture: any -Depends: sdltcl8.6 (= ${binary:Version}) -Suggests: sdltcl8.6-doc -Description: Tcl (the Tool Command Language) v8.6 - development files - Tcl is a powerful, easy-to-use, embeddable, cross-platform interpreted - scripting language. This package contains the headers and libraries - needed to embed or extend Tcl. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 075c312..0000000 --- a/debian/copyright +++ /dev/null @@ -1,141 +0,0 @@ -This package was originally debianized by David Engel -from sources obtained at http://prdownloads.sourceforge.net/tcl - -List of copyright holders mentioned in individual files: - -Copyright 1983, 1988-1994 The Regents of the University of California -Copyright 1991-1999 Karl Lehenbauer and Mark Diekhans -Copyright 1992-1996 Free Software Foundation, Inc. -Copyright 1993-1994 Lockheed Missle & Space Company, AI Center -Copyright 1993-1997 Bell Labs Innovations for Lucent Technologies -Copyright 1993-1997 Lucent Technologies -Copyright 1994-1998 Sun Microsystems, Inc. -Copyright 1995 General Electric Company -Copyright 1995 Dave Nebinger -Copyright 1995-1997 Roger E. Critchlow Jr -Copyright 1996 Lucent Technologies and Jim Ingham -Copyright 1997-2000 Ajuba Solutions -Copyright 1998-2000 Scriptics Corporation -Copyright 1998-1999 Henry Spencer -Copyright 1998 Paul Duffin -Copyright 1998 Mark Harrison -Copyright 1999 America Online, Inc. -Copyright 1999-2000 Andreas Kupries -Copyright 2000-2001 ActiveState Corporation, et al -Copyright 2001 ActiveState Tool Corp. -Copyright 2001-2002 Apple Computer, Inc. -Copyright 2001-2002 ActiveState Corporation -Copyright 2001-2002 Vincent Darley -Copyright 2001-2002 Donal K. Fellows -Copyright 2001-2003 Kevin B. Kenny -Copyright 2001-2002 David Gravereaux -Contributions from Don Porter, NIST, 2002-2003. (not subject to US copyright) -Copyright 2005 Tcl Core Team -Copyright 2005 Daniel A. Steffen - -Copyright: - -This software is copyrighted by the Regents of the University of -California, Sun Microsystems, Inc., Scriptics Corporation, -and other parties. The following terms apply to all files associated -with the software unless explicitly disclaimed in individual files. - -The authors hereby grant permission to use, copy, modify, distribute, -and license this software and its documentation for any purpose, provided -that existing copyright notices are retained in all copies and that this -notice is included verbatim in any distributions. No written agreement, -license, or royalty fee is required for any of the authorized uses. -Modifications to this software may be copyrighted by their authors -and need not follow the licensing terms described here, provided that -the new terms are clearly indicated on the first page of each file where -they apply. - -IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY -FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES -ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY -DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE -IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE -NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR -MODIFICATIONS. - -GOVERNMENT USE: If you are acquiring this software on behalf of the -U.S. government, the Government shall have only "Restricted Rights" -in the software and related documentation as defined in the Federal -Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you -are acquiring the software on behalf of the Department of Defense, the -software shall be classified as "Commercial Computer Software" and the -Government shall have only "Restricted Rights" as defined in 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. - -Several files are distributed under other conditions: - -compat/strftime.c: -/* - * strftime.c -- - * - * This file contains a modified version of the BSD 4.4 strftime - * function. - * - * This file is a modified version of the strftime.c file from the BSD 4.4 - * source. See the copyright notice below for details on redistribution - * restrictions. The "license.terms" file does not apply to this file. - * - * Changes 2002 Copyright (c) 2002 ActiveState Corporation. - * - * RCS: @(#) $Id: strftime.c,v 1.10.2.3 2005/11/04 18:18:04 kennykb Exp $ - */ - -/* - * Copyright (c) 1989 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -compat/dlfcn.h and unix/tclLoadAix.c: - * This file is subject to the following copyright notice, which is - * different from the notice used elsewhere in Tcl but rougly - * equivalent in meaning. - * - * Copyright (c) 1992,1993,1995,1996, Jens-Uwe Mager, Helios Software GmbH - * Not derived from licensed software. - * - * Permission is granted to freely use, copy, modify, and redistribute - * this software, provided that the author is not construed to be liable - * for any results of using the software, alterations are clearly marked - * as such, and this notice is not modified. - diff --git a/debian/rules b/debian/rules deleted file mode 100755 index a4b3bd4..0000000 --- a/debian/rules +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/make -f -# debian/rules that uses debhelper. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) -DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) - -export QUILT_PATCHES := debian/patches - -v = 8.6 - -ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) -CFLAGS=-g -O0 -else -# See bug #446335 -CFLAGS=-g -O2 -fno-unit-at-a-time -endif - -unpatch: - dh_testdir - quilt pop -a || test $$? = 2 - rm -rf patch-stamp .pc - -patch: patch-stamp -patch-stamp: - dh_testdir - quilt push -a || test $$? = 2 - touch patch-stamp - -build: build-stamp -build-stamp: patch-stamp - dh_testdir -# So so ugly but it works... - touch generic/tclStubInit.c - cd unix && \ - CFLAGS="$(CFLAGS)" \ - ac_cv_func_strtod=yes \ - tcl_cv_strtod_buggy=1 \ - ./configure --host=$(DEB_HOST_GNU_TYPE) \ - --build=$(DEB_BUILD_GNU_TYPE) \ - --prefix=/opt/sdltk86 \ - --includedir=/opt/sdltk86/include \ - --enable-shared \ - --mandir=/opt/sdltk86/man \ - --enable-man-symlinks \ - --enable-man-compression=gzip \ - --enable-threads \ - --without-tzdata \ - --with-zipfs && \ - touch ../generic/tclStubInit.c && \ - $(MAKE) -# Build the static library. - cd unix && \ - ar cr libtcl$(v).a *.o && \ - ar d libtcl$(v).a tclAppInit.o && \ - ranlib libtcl$(v).a - touch build-stamp - -clean: clean-patched unpatch - dh_testdir - dh_testroot - dh_clean - -clean-patched: - dh_testdir - dh_testroot - rm -f build-stamp install-stamp - cd unix && [ ! -f Makefile ] || $(MAKE) distclean -# Remove forgotten files - rm -f tests/pkg/pkga.so unix/config.log unix/Tcltest.so - -install: install-stamp -install-stamp: build-stamp - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - cd unix && \ - GZIP=-9 \ - $(MAKE) INSTALL_ROOT=`pwd`/../debian/tmp \ - MAN_INSTALL_DIR=`pwd`/../debian/tmp/opt/sdltk86/man \ - install install-private-headers install-packages -# Fix up the libraries. - cp unix/libtcl$(v).a debian/tmp/opt/sdltk86/lib - touch install-stamp - -# Build architecture-independent files here. -binary-indep: build install - dh_testdir -i - dh_testroot -i - dh_movefiles -i - dh_installdocs -i - dh_installchangelogs -i ChangeLog - dh_compress -i - dh_fixperms -i - dh_installdeb -i - dh_gencontrol -i - dh_md5sums -i - dh_builddeb -i - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir -a - dh_testroot -a - dh_movefiles -a -# now, fix up file locations for .sh - mv debian/sdltcl$(v)/opt/sdltk86/lib/tclConfig.sh \ - debian/sdltcl$(v)-dev/opt/sdltk86/lib - dh_installdocs -a - dh_installmenu -a - dh_installchangelogs -a ChangeLog - dh_fixperms -a - dh_strip -a - dh_compress -a - dh_makeshlibs -a -V 'sdltcl$(v) (>= 8.6.2)' -XTcltest - dh_installdeb -a - dh_shlibdeps -a -ldebian/sdltcl$(v)/opt/sdltk86/lib - dh_gencontrol -a - dh_md5sums -a - dh_builddeb -a - -source diff: - @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false - -binary: binary-indep binary-arch - -.PHONY: patch unpatch clean-patched build clean binary-indep binary-arch binary install - diff --git a/debian/sdltcl8.6-dev.dirs b/debian/sdltcl8.6-dev.dirs deleted file mode 100644 index 4de4819..0000000 --- a/debian/sdltcl8.6-dev.dirs +++ /dev/null @@ -1,2 +0,0 @@ -opt/sdltk86/lib -opt/sdltk86/include diff --git a/debian/sdltcl8.6-dev.files b/debian/sdltcl8.6-dev.files deleted file mode 100644 index 5cd0878..0000000 --- a/debian/sdltcl8.6-dev.files +++ /dev/null @@ -1,2 +0,0 @@ -opt/sdltk86/include -opt/sdltk86/lib/*.a diff --git a/debian/sdltcl8.6-doc.files b/debian/sdltcl8.6-doc.files deleted file mode 100644 index 56ca7e7..0000000 --- a/debian/sdltcl8.6-doc.files +++ /dev/null @@ -1,2 +0,0 @@ -opt/sdltk86/man/man3 -opt/sdltk86/man/mann diff --git a/debian/sdltcl8.6.files b/debian/sdltcl8.6.files deleted file mode 100644 index 501d10a..0000000 --- a/debian/sdltcl8.6.files +++ /dev/null @@ -1,18 +0,0 @@ -opt/sdltk86/bin -opt/sdltk86/lib/tcl8 -opt/sdltk86/lib/tcl8/* -opt/sdltk86/lib/tcl8.6 -opt/sdltk86/lib/tcl8.6/* -opt/sdltk86/lib/*.so -opt/sdltk86/lib/*.sh -opt/sdltk86/lib/itcl* -opt/sdltk86/lib/itcl*/* -opt/sdltk86/lib/pkgconfig -opt/sdltk86/lib/pkgconfig/* -opt/sdltk86/lib/sqlite* -opt/sdltk86/lib/sqlite*/* -opt/sdltk86/lib/tdbc* -opt/sdltk86/lib/tdbc*/* -opt/sdltk86/lib/thread* -opt/sdltk86/lib/thread*/* -opt/sdltk86/man/man1 diff --git a/debian/shlibs.local b/debian/shlibs.local deleted file mode 100644 index 7da5dd4..0000000 --- a/debian/shlibs.local +++ /dev/null @@ -1 +0,0 @@ -libtcl8.6 1 diff --git a/pkgs/Android.mk b/pkgs/Android.mk deleted file mode 100644 index 5053e7d..0000000 --- a/pkgs/Android.mk +++ /dev/null @@ -1 +0,0 @@ -include $(call all-subdir-makefiles) diff --git a/tcl-config.mk b/tcl-config.mk deleted file mode 100644 index e072516..0000000 --- a/tcl-config.mk +++ /dev/null @@ -1,62 +0,0 @@ -tcl_includes := $(tcl_path)/generic $(tcl_path)/unix - -tcl_cflags := \ - -DHAVE_SYS_SELECT_H=1 \ - -DHAVE_LIMITS_H=1 \ - -DHAVE_UNISTD_H=1 \ - -DHAVE_SYS_PARAM_H=1 \ - -D_LARGEFILE64_SOURCE=1 \ - -DTCL_WIDE_INT_TYPE="long long" \ - -DTCL_SHLIB_EXT="\".so\"" \ - -DHAVE_CAST_TO_UNION=1 \ - -DHAVE_GETCWD=1 \ - -DHAVE_OPENDIR=1 \ - -DHAVE_MKSTEMP=1 \ - -DHAVE_MKSTEMPS=1 \ - -DHAVE_STRSTR=1 \ - -DHAVE_STRTOL=1 \ - -DHAVE_STRTOLL=1 \ - -DHAVE_STRTOULL=1 \ - -DHAVE_TMPNAM=1 \ - -DHAVE_WAITPID=1 \ - -DHAVE_STRUCT_ADDRINFO=1 \ - -DHAVE_STRUCT_IN6_ADDR=1 \ - -DHAVE_STRUCT_SOCKADDR_IN6=1 \ - -DHAVE_STRUCT_SOCKADDR_STORAGE=1 \ - -DHAVE_GETHOSTBYNAME_R=1 \ - -DUSE_TERMIOS=1 \ - -DHAVE_MKTIME=1 \ - -DUSE_INTERP_ERRORLINE=1 \ - -DHAVE_SYS_TIME_H=1 \ - -DTIME_WITH_SYS_TIME=1 \ - -DHAVE_TM_ZONE=1 \ - -DHAVE_GMTIME_R=1 \ - -DHAVE_LOCALTIME_R=1 \ - -DHAVE_TM_GMTOFF=1 \ - -DHAVE_TIMEZONE_VAR=1 \ - -DHAVE_ST_BLKSIZE=1 \ - -DSTDC_HEADERS=1 \ - -DHAVE_INTPTR_T=1 \ - -DHAVE_UINTPTR_T=1 \ - -DHAVE_SIGNED_CHAR=1 \ - -DHAVE_SYS_IOCTL_H=1 \ - -DHAVE_MEMCPY=1 \ - -DHAVE_MEMMOVE=1 \ - -DVOID=void \ - -DNO_UNION_WAIT=1 \ - -DHAVE_ZLIB=1 \ - -DMP_PREC=4 \ - -DTCL_TOMMATH=1 \ - -D_REENTRANT=1 \ - -D_THREADSAFE=1 \ - -DTCL_UTF_MAX=6 \ - -DTCL_THREADS=1 \ - -DTCL_PTHREAD_ATFORK=1 \ - -DUSE_THREAD_ALLOC=1 \ - -DTCL_CFGVAL_ENCODING="\"utf-8\"" \ - -DTCL_UNLOAD_DLLS=1 \ - -DTCL_CFG_OPTIMIZED=1 \ - -DZIPFS_IN_TCL=1 \ - -DTCL_PACKAGE_PATH="\"/assets\"" \ - -DTCL_LIBRARY="\"/assets/tcl8.6\"" - -- cgit v0.12 From b0a98f480d3a16432d023ddb8cb4ba8e22edd973 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 21 Dec 2015 10:03:06 +0000 Subject: Undo more Android-specific changes, which don't form part of Zipfs, as further preparation for Zipfs TIP. Rename zipfs.h to tclZipfs.h, so it can be installed together with tcl.h --- generic/tclIOUtil.c | 2 +- generic/tclMain.c | 197 ---------------------------------------------------- generic/tclZipfs.h | 65 +++++++++++++++++ generic/zipfs.c | 6 +- generic/zipfs.h | 66 ------------------ unix/Makefile.in | 4 +- unix/configure | 18 ----- unix/configure.in | 8 --- unix/tclUnixInit.c | 8 --- win/Makefile.in | 1 + win/configure | 19 ----- win/configure.in | 8 --- win/makefile.vc | 1 + 13 files changed, 75 insertions(+), 328 deletions(-) create mode 100644 generic/tclZipfs.h delete mode 100644 generic/zipfs.h diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 9bc868b..0ef6d3b 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -192,7 +192,7 @@ const Tcl_Filesystem tclNativeFilesystem = { }; #ifdef ZIPFS_IN_TCL -extern Tcl_Filesystem zipfsFilesystem; +MODULE_SCOPE Tcl_Filesystem zipfsFilesystem; #endif /* diff --git a/generic/tclMain.c b/generic/tclMain.c index 6acd15d..927de7e 100644 --- a/generic/tclMain.c +++ b/generic/tclMain.c @@ -34,15 +34,6 @@ #include "tclInt.h" -#ifdef ZIPFS_IN_TCL -#include "zipfs.h" -#endif - -#ifdef ANDROID -#undef ZIPFS_BOOTDIR -#define ZIPFS_BOOTDIR "/assets" -#endif - /* * The default prompt used when the user has not overridden it. */ @@ -60,7 +51,6 @@ # define TCHAR char # define TEXT(arg) arg # define _tcscmp strcmp -# define _tcsncmp strncmp #endif /* @@ -325,21 +315,9 @@ Tcl_MainEx( Tcl_MainLoopProc *mainLoopProc; Tcl_Channel chan; InteractiveState is; -#ifdef ZIPFS_IN_TCL - const char *zipFile = NULL; - Tcl_Obj *zipval = NULL; - int autoRun = 1; - int zipOk = TCL_ERROR; -#ifndef ANDROID - const char *exeName; -#endif -#endif TclpSetInitialEncodings(); TclpFindExecutable((const char *)argv[0]); -#if defined(ZIPFS_IN_TCL) && !defined(ANDROID) - exeName = Tcl_GetNameOfExecutable(); -#endif Tcl_InitMemory(interp); @@ -369,26 +347,6 @@ Tcl_MainEx( Tcl_DecrRefCount(value); argc -= 3; argv += 3; -#ifdef ZIPFS_IN_TCL - } else if (argc > 2) { - int length = strlen((char *) argv[1]); - if ((length >= 2) && - (0 == _tcsncmp(TEXT("-zip"), argv[1], length))) { - argc--; - argv++; - if ((argc > 1) && (argv[1][0] != (TCHAR) '-')) { - zipval = NewNativeObj(argv[1], -1); - zipFile = Tcl_GetString(zipval); - autoRun = 0; - argc--; - argv++; - } - } else if ('-' != argv[1][0]) { - Tcl_SetStartupScript(NewNativeObj(argv[1], -1), NULL); - argc--; - argv++; - } -#endif } else if ((argc > 1) && ('-' != argv[1][0])) { Tcl_SetStartupScript(NewNativeObj(argv[1], -1), NULL); argc--; @@ -422,67 +380,6 @@ Tcl_MainEx( Tcl_SetVar2Ex(interp, "tcl_interactive", NULL, Tcl_NewIntObj(!path && is.tty), TCL_GLOBAL_ONLY); -#ifdef ZIPFS_IN_TCL - zipOk = Tclzipfs_Init(interp); - if (zipOk == TCL_OK) { - int relax = 0; - - if (zipFile == NULL) { - relax = 1; -#ifdef ANDROID - zipFile = getenv("PACKAGE_CODE_PATH"); - if (zipFile == NULL) { - zipFile = Tcl_GetNameOfExecutable(); - } -#else - zipFile = exeName; -#endif - } - if (zipFile != NULL) { -#ifdef ANDROID - zipOk = Tclzipfs_Mount(interp, zipFile, "", NULL); -#else - zipOk = Tclzipfs_Mount(interp, zipFile, exeName, NULL); -#endif - if (!relax && (zipOk != TCL_OK)) { - exitCode = 1; - goto done; - } - } else { - zipOk = TCL_ERROR; - } - Tcl_ResetResult(interp); - } - if (zipOk == TCL_OK) { -#ifdef ZIPFS_BOOTDIR - char *tcl_lib = ZIPFS_BOOTDIR "/tcl" TCL_VERSION; - char *tcl_pkg = ZIPFS_BOOTDIR; -#else - char *tcl_lib; - char *tcl_pkg = (char *) exeName; - Tcl_DString dsLib; - - Tcl_DStringInit(&dsLib); - Tcl_DStringAppend(&dsLib, exeName, -1); - Tcl_DStringAppend(&dsLib, "/tcl" TCL_VERSION, -1); - tcl_lib = Tcl_DStringValue(&dsLib); -#endif - Tcl_SetVar2(interp, "env", "TCL_LIBRARY", tcl_lib, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "tcl_libPath", tcl_lib, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "tcl_library", tcl_lib, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "tcl_pkgPath", tcl_pkg, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "auto_path", tcl_lib, - TCL_GLOBAL_ONLY | TCL_LIST_ELEMENT); -#ifndef ZIPFS_BOOTDIR - Tcl_DStringFree(&dsLib); -#endif - } - if (zipval != NULL) { - Tcl_DecrRefCount(zipval); - zipval = NULL; - } -#endif - /* * Invoke application-specific initialization. */ @@ -512,100 +409,6 @@ Tcl_MainEx( Tcl_CreateExitHandler(FreeMainInterp, interp); } -#ifdef ZIPFS_IN_TCL - /* - * Setup auto loading info to point to mounted ZIP file. - */ - - if (zipOk == TCL_OK) { -#ifdef ZIPFS_BOOTDIR - char *tcl_lib = ZIPFS_BOOTDIR "/tcl" TCL_VERSION; - char *tcl_pkg = ZIPFS_BOOTDIR; -#else - char *tcl_lib; - char *tcl_pkg = (char *) exeName; - Tcl_DString dsLib; - - Tcl_DStringInit(&dsLib); - Tcl_DStringAppend(&dsLib, exeName, -1); - Tcl_DStringAppend(&dsLib, "/tcl" TCL_VERSION, -1); - tcl_lib = Tcl_DStringValue(&dsLib); -#endif - Tcl_SetVar(interp, "tcl_libPath", tcl_lib, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "tcl_library", tcl_lib, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "tcl_pkgPath", tcl_pkg, TCL_GLOBAL_ONLY); -#ifndef ZIPFS_BOOTDIR - Tcl_DStringFree(&dsLib); -#endif - - /* - * We need to re-init encoding (after initializing Tcl), - * otherwise "encoding system" will return "identity" - */ - - TclpSetInitialEncodings(); - } - - /* - * Set embedded application startup file, if any. - */ - - if ((zipOk == TCL_OK) && autoRun) { - char *filename; - Tcl_Channel chan; -#ifdef ZIPFS_BOOTDIR - filename = ZIPFS_BOOTDIR "/app/main.tcl"; -#else - Tcl_DString dsFile; - - Tcl_DStringInit(&dsFile); - Tcl_DStringAppend(&dsFile, exeName, -1); - Tcl_DStringAppend(&dsFile, "/app/main.tcl", -1); - filename = Tcl_DStringValue(&dsFile); -#endif - chan = Tcl_OpenFileChannel(NULL, filename, "r", 0); - if (chan != (Tcl_Channel) NULL) { - Tcl_Obj *arg; - - Tcl_Close(NULL, chan); - - /* - * Push back script file to argv, if any. - */ - if ((arg = Tcl_GetStartupScript(NULL)) != NULL) { - Tcl_Obj *v, *no; - - no = Tcl_NewStringObj("argv", 4); - v = Tcl_ObjGetVar2(interp, no, NULL, TCL_GLOBAL_ONLY); - if (v != NULL) { - Tcl_Obj **objv, *nv; - int objc, i; - - objc = 0; - Tcl_ListObjGetElements(NULL, v, &objc, &objv); - nv = Tcl_NewListObj(1, &arg); - for (i = 0; i < objc; i++) { - Tcl_ListObjAppendElement(NULL, nv, objv[i]); - } - Tcl_IncrRefCount(nv); - if (Tcl_ObjSetVar2(interp, no, NULL, nv, TCL_GLOBAL_ONLY) - != NULL) { - Tcl_GlobalEval(interp, "incr argc"); - } - Tcl_DecrRefCount(nv); - } - Tcl_DecrRefCount(no); - } - Tcl_SetStartupScript(Tcl_NewStringObj(filename, -1), NULL); - Tcl_SetVar(interp, "argv0", filename, TCL_GLOBAL_ONLY); - Tcl_SetVar(interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY); - } -#ifndef ANDROID - Tcl_DStringFree(&dsFile); -#endif - } -#endif - /* * Invoke the script specified on the command line, if any. Must fetch it * again, as the appInitProc might have reset it. diff --git a/generic/tclZipfs.h b/generic/tclZipfs.h new file mode 100644 index 0000000..bf3a3cb --- /dev/null +++ b/generic/tclZipfs.h @@ -0,0 +1,65 @@ +/* + * tclZipfs.h -- + * + * This header file describes the interface of the ZIPFS filesystem + * + * Copyright (c) 2013-2015 Christian Werner + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _ZIPFS_H +#define _ZIPFS_H + +#include "tcl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef ZIPFSAPI +# define ZIPFSAPI extern +#endif + +#ifdef ZIPFS_IN_TK +#define Zipfs_Mount Tkzipfs_Mount +#define Zipfs_Unmount Tkzipfs_Unmount +#define Zipfs_Init Tkzipfs_Init +#define Zipfs_SafeInit Tkzipfs_SafeInit +#ifdef BUILD_tk +# undef ZIPFSAPI +# define ZIPFSAPI DLLEXPORT +#endif +#endif + +#ifdef ZIPFS_IN_TCL +#define Zipfs_Mount Tclzipfs_Mount +#define Zipfs_Unmount Tclzipfs_Unmount +#define Zipfs_Init Tclzipfs_Init +#define Zipfs_SafeInit Tclzipfs_SafeInit +#ifdef BUILD_tcl +# undef ZIPFSAPI +# define ZIPFSAPI DLLEXPORT +#endif +#endif + +ZIPFSAPI int Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, + CONST char *mntpt, CONST char *passwd); +ZIPFSAPI int Zipfs_Unmount(Tcl_Interp *interp, CONST char *zipname); +ZIPFSAPI int Zipfs_Init(Tcl_Interp *interp); +ZIPFSAPI int Zipfs_SafeInit(Tcl_Interp *interp); + +#ifdef __cplusplus +} +#endif + +#endif /* _ZIPFS_H */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/generic/zipfs.c b/generic/zipfs.c index 0683c32..6d49f4f 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -24,7 +24,7 @@ #endif #include "tclInt.h" #include "tclFileSystem.h" -#include "zipfs.h" +#include "tclZipfs.h" #ifdef HAVE_ZLIB @@ -3821,7 +3821,9 @@ Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, * Define the ZIP filesystem dispatch table. */ -Tcl_Filesystem zipfsFilesystem = { +MODULE_SCOPE const Tcl_Filesystem zipfsFilesystem; + +const Tcl_Filesystem zipfsFilesystem = { "zipfs", sizeof (Tcl_Filesystem), TCL_FILESYSTEM_VERSION_2, diff --git a/generic/zipfs.h b/generic/zipfs.h deleted file mode 100644 index 15ca37c..0000000 --- a/generic/zipfs.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * zipfs.h -- - * - * This header file describes the interface of the ZIPFS filesystem - * used in AndroWish. - * - * Copyright (c) 2013-2015 Christian Werner - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ - -#ifndef _ZIPFS_H -#define _ZIPFS_H - -#include "tcl.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef ZIPFSAPI -# define ZIPFSAPI extern -#endif - -#ifdef ZIPFS_IN_TK -#define Zipfs_Mount Tkzipfs_Mount -#define Zipfs_Unmount Tkzipfs_Unmount -#define Zipfs_Init Tkzipfs_Init -#define Zipfs_SafeInit Tkzipfs_SafeInit -#ifdef BUILD_tk -# undef ZIPFSAPI -# define ZIPFSAPI DLLEXPORT -#endif -#endif - -#ifdef ZIPFS_IN_TCL -#define Zipfs_Mount Tclzipfs_Mount -#define Zipfs_Unmount Tclzipfs_Unmount -#define Zipfs_Init Tclzipfs_Init -#define Zipfs_SafeInit Tclzipfs_SafeInit -#ifdef BUILD_tcl -# undef ZIPFSAPI -# define ZIPFSAPI DLLEXPORT -#endif -#endif - -ZIPFSAPI int Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, - CONST char *mntpt, CONST char *passwd); -ZIPFSAPI int Zipfs_Unmount(Tcl_Interp *interp, CONST char *zipname); -ZIPFSAPI int Zipfs_Init(Tcl_Interp *interp); -ZIPFSAPI int Zipfs_SafeInit(Tcl_Interp *interp); - -#ifdef __cplusplus -} -#endif - -#endif /* _ZIPFS_H */ - -/* - * Local Variables: - * mode: c - * c-basic-offset: 4 - * fill-column: 78 - * End: - */ diff --git a/unix/Makefile.in b/unix/Makefile.in index ebbd61c..c09fb35 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -373,6 +373,7 @@ GENERIC_HDRS = \ $(GENERIC_DIR)/tclInt.h \ $(GENERIC_DIR)/tclIntDecls.h \ $(GENERIC_DIR)/tclIntPlatDecls.h \ + $(GENERIC_DIR)/tclZipfs.h \ $(GENERIC_DIR)/tclTomMath.h \ $(GENERIC_DIR)/tclTomMathDecls.h \ $(GENERIC_DIR)/tclOO.h \ @@ -383,7 +384,7 @@ GENERIC_HDRS = \ $(GENERIC_DIR)/tclPlatDecls.h \ $(GENERIC_DIR)/tclPort.h \ $(GENERIC_DIR)/tclRegexp.h \ - $(GENERIC_DIR)/zipfs.h + $(GENERIC_DIR)/tclZipfs.h GENERIC_SRCS = \ $(GENERIC_DIR)/regcomp.c \ @@ -954,6 +955,7 @@ install-headers: @for i in $(GENERIC_DIR)/tcl.h $(GENERIC_DIR)/tclDecls.h \ $(GENERIC_DIR)/tclOO.h $(GENERIC_DIR)/tclOODecls.h \ $(GENERIC_DIR)/tclPlatDecls.h \ + $(GENERIC_DIR)/tclZipfs.h \ $(GENERIC_DIR)/tclTomMath.h \ $(GENERIC_DIR)/tclTomMathDecls.h ; \ do \ diff --git a/unix/configure b/unix/configure index 3e72a0d..c19a77a 100755 --- a/unix/configure +++ b/unix/configure @@ -869,7 +869,6 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-encoding encoding for configuration values (default: iso8859-1) - --with-zipfs include ZIP filesystem --with-tzdata install timezone data (default: autodetect) Some influential environment variables: @@ -6212,23 +6211,6 @@ cat >>confdefs.h <<\_ACEOF _ACEOF -# Check whether --with-zipfs or --without-zipfs was given. -if test "${with_zipfs+set}" = set; then - withval="$with_zipfs" - tcl_ok=$withval -else - tcl_ok=no -fi; -echo "$as_me:$LINENO: result: $tcl_ok" >&5 -echo "${ECHO_T}$tcl_ok" >&6 -if test $tcl_ok = yes; then - -cat >>confdefs.h <<\_ACEOF -#define ZIPFS_IN_TCL 1 -_ACEOF - -fi - #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This # macro depends on the value of SHARED_BUILD, and should be called diff --git a/unix/configure.in b/unix/configure.in index 7eeff3b..c7b0edc 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -171,14 +171,6 @@ AS_IF([test $zlib_ok = no], [ AC_SUBST(ZLIB_INCLUDE,[-I\${ZLIB_DIR}]) ]) AC_DEFINE(HAVE_ZLIB, 1, [Is there an installed zlib?]) -AC_ARG_WITH(zipfs, - AC_HELP_STRING([--with-zipfs], - [include ZIP filesystem]), - [tcl_ok=$withval], [tcl_ok=no]) -AC_MSG_RESULT([$tcl_ok]) -if test $tcl_ok = yes; then - AC_DEFINE(ZIPFS_IN_TCL, 1, [Include ZIP filesystem?]) -fi #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index e8ccc76..5e4ef0a 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -9,9 +9,6 @@ */ #include "tclInt.h" -#ifdef ZIPFS_IN_TCL -#include "zipfs.h" -#endif #include #include #ifdef HAVE_LANGINFO @@ -544,11 +541,6 @@ TclpInitLibraryPath( */ str = defaultLibraryDir; -#ifdef ZIPFS_IN_TCL - if (Tclzipfs_Mount(NULL, NULL, NULL, NULL) == TCL_OK) { - str = ""; - } -#endif } if (str[0] != '\0') { objPtr = Tcl_NewStringObj(str, -1); diff --git a/win/Makefile.in b/win/Makefile.in index 00f5c99..f6d006b 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -636,6 +636,7 @@ install-libraries: libraries install-tzdata install-msgs @echo "Installing header files"; @for i in "$(GENERIC_DIR)/tcl.h" "$(GENERIC_DIR)/tclDecls.h" \ "$(GENERIC_DIR)/tclOO.h" "$(GENERIC_DIR)/tclOODecls.h" \ + "$(GENERIC_DIR)/tclZipfs.h" \ "$(GENERIC_DIR)/tclPlatDecls.h" \ "$(GENERIC_DIR)/tclTomMath.h" \ "$(GENERIC_DIR)/tclTomMathDecls.h"; \ diff --git a/win/configure b/win/configure index 27f2c10..3ebc697 100755 --- a/win/configure +++ b/win/configure @@ -853,7 +853,6 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-encoding encoding for configuration values --with-celib=DIR use Windows/CE support library from DIR - --with-zipfs include ZIP filesystem Some influential environment variables: CC C compiler command @@ -4409,24 +4408,6 @@ cat >>confdefs.h <<\_ACEOF _ACEOF -# Check whether --with-zipfs or --without-zipfs was given. -if test "${with_zipfs+set}" = set; then - withval="$with_zipfs" - tcl_ok=$withval -else - tcl_ok=no -fi; -echo "$as_me:$LINENO: result: $tcl_ok" >&5 -echo "${ECHO_T}$tcl_ok" >&6 -if test $tcl_ok = yes; then - -cat >>confdefs.h <<\_ACEOF -#define ZIPFS_IN_TCL 1 -_ACEOF - -fi - - echo "$as_me:$LINENO: checking for intptr_t" >&5 echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6 if test "${ac_cv_type_intptr_t+set}" = set; then diff --git a/win/configure.in b/win/configure.in index c8ab2e3..9e9df90 100644 --- a/win/configure.in +++ b/win/configure.in @@ -141,14 +141,6 @@ AS_IF([test "$tcl_ok" = "yes"], [ AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}]) ]) AC_DEFINE(HAVE_ZLIB, 1, [Is there an installed zlib?]) -AC_ARG_WITH(zipfs, - AC_HELP_STRING([--with-zipfs], - [include ZIP filesystem]), - [tcl_ok=$withval], [tcl_ok=no]) -AC_MSG_RESULT([$tcl_ok]) -if test $tcl_ok = yes; then - AC_DEFINE(ZIPFS_IN_TCL, 1, [Include ZIP filesystem?]) -fi AC_CHECK_TYPE([intptr_t], [ AC_DEFINE([HAVE_INTPTR_T], 1, [Do we have the intptr_t type?])], [ diff --git a/win/makefile.vc b/win/makefile.vc index ecfcecf..82dd655 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -1115,6 +1115,7 @@ install-libraries: tclConfig install-msgs install-tzdata @$(CPY) "$(GENERICDIR)\tclDecls.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclOO.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclOODecls.h" "$(INCLUDE_INSTALL_DIR)\" + @$(CPY) "$(GENERICDIR)\tclZipfs.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclPlatDecls.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclTomMath.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclTomMathDecls.h" "$(INCLUDE_INSTALL_DIR)\" -- cgit v0.12 From 4d007159025e0fc8ea75aae346bc7e6588e391c2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 21 Dec 2015 10:49:36 +0000 Subject: CONST -> const --- generic/tclZipfs.h | 6 ++--- generic/zipfs.c | 68 +++++++++++++++++++++++++++--------------------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/generic/tclZipfs.h b/generic/tclZipfs.h index bf3a3cb..75dcb13 100644 --- a/generic/tclZipfs.h +++ b/generic/tclZipfs.h @@ -44,9 +44,9 @@ extern "C" { #endif #endif -ZIPFSAPI int Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, - CONST char *mntpt, CONST char *passwd); -ZIPFSAPI int Zipfs_Unmount(Tcl_Interp *interp, CONST char *zipname); +ZIPFSAPI int Zipfs_Mount(Tcl_Interp *interp, const char *zipname, + const char *mntpt, const char *passwd); +ZIPFSAPI int Zipfs_Unmount(Tcl_Interp *interp, const char *zipname); ZIPFSAPI int Zipfs_Init(Tcl_Interp *interp); ZIPFSAPI int Zipfs_SafeInit(Tcl_Interp *interp); diff --git a/generic/zipfs.c b/generic/zipfs.c index 6d49f4f..a9f0a39 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -109,7 +109,7 @@ #if defined(_WIN32) || defined(_WIN64) #define HAS_DRIVES 1 -static CONST char drvletters[] = +static const char drvletters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; #else #define HAS_DRIVES 0 @@ -223,7 +223,7 @@ static struct { * For password rotation. */ -static CONST char pwrot[16] = { +static const char pwrot[16] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0 }; @@ -232,7 +232,7 @@ static CONST char pwrot[16] = { * Table to compute CRC32. */ -static CONST unsigned int crc32tab[256] = { +static const unsigned int crc32tab[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, @@ -458,10 +458,10 @@ ToDosDate(time_t when) */ static int -CountSlashes(CONST char *string) +CountSlashes(const char *string) { int count = 0; - CONST char *p = string; + const char *p = string; while (*p != '\0') { if (*p == '/') { @@ -491,7 +491,7 @@ CountSlashes(CONST char *string) */ static char * -CanonicalPath(CONST char *root, CONST char *tail, Tcl_DString *dsPtr) +CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr) { char *path; int i, j, c, isunc = 0; @@ -598,7 +598,7 @@ CanonicalPath(CONST char *root, CONST char *tail, Tcl_DString *dsPtr) */ static char * -AbsolutePath(CONST char *path, +AbsolutePath(const char *path, #if HAS_DRIVES int *drvPtr, #endif @@ -832,7 +832,7 @@ ZipFSCloseArchive(Tcl_Interp *interp, ZipFile *zf) */ static int -ZipFSOpenArchive(Tcl_Interp *interp, CONST char *zipname, int needZip, +ZipFSOpenArchive(Tcl_Interp *interp, const char *zipname, int needZip, ZipFile *zf) { int i; @@ -1049,8 +1049,8 @@ error: */ int -Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, CONST char *mntpt, - CONST char *passwd) +Zipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, + const char *passwd) { char *realname, *p; int i, pwlen, isNew; @@ -1420,7 +1420,7 @@ nextent: */ int -Zipfs_Unmount(Tcl_Interp *interp, CONST char *zipname) +Zipfs_Unmount(Tcl_Interp *interp, const char *zipname) { char *realname; ZipFile *zf; @@ -1504,7 +1504,7 @@ done: static int ZipFSMountCmd(ClientData clientData, Tcl_Interp *interp, - int argc, CONST char **argv) + int argc, const char **argv) { if (argc > 4) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -1534,7 +1534,7 @@ ZipFSMountCmd(ClientData clientData, Tcl_Interp *interp, static int ZipFSUnmountCmd(ClientData clientData, Tcl_Interp *interp, - int argc, CONST char **argv) + int argc, const char **argv) { if (argc != 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], @@ -1563,7 +1563,7 @@ ZipFSUnmountCmd(ClientData clientData, Tcl_Interp *interp, static int ZipFSMkKeyCmd(ClientData clientData, Tcl_Interp *interp, - int argc, CONST char **argv) + int argc, const char **argv) { int len, i = 0; char pwbuf[264]; @@ -1621,15 +1621,15 @@ ZipFSMkKeyCmd(ClientData clientData, Tcl_Interp *interp, */ static int -ZipAddFile(Tcl_Interp *interp, CONST char *path, CONST char *name, - Tcl_Channel out, CONST char *passwd, +ZipAddFile(Tcl_Interp *interp, const char *path, const char *name, + Tcl_Channel out, const char *passwd, char *buf, int bufsize, Tcl_HashTable *fileHash) { Tcl_Channel in; Tcl_HashEntry *hPtr; ZipEntry *z; z_stream stream; - CONST char *zpath; + const char *zpath; int nbyte, nbytecompr, len, crc, flush, pos[3], zpathlen, olen; int mtime = 0, isNew, align = 0, cmeth; unsigned long keys[3], keys0[3]; @@ -1947,11 +1947,11 @@ seekErr: static int ZipFSMkZipOrImgCmd(ClientData clientData, Tcl_Interp *interp, - int isImg, int argc, CONST char **argv) + int isImg, int argc, const char **argv) { Tcl_Channel out; int len = 0, pwlen = 0, slen = 0, i, count, ret = TCL_ERROR, largc, pos[3]; - CONST char **largv; + const char **largv; Tcl_DString ds; ZipEntry *z; Tcl_HashEntry *hPtr; @@ -2056,7 +2056,7 @@ ZipFSMkZipOrImgCmd(ClientData clientData, Tcl_Interp *interp, slen = strlen(argv[3]); } for (i = 0; i < largc; i++) { - CONST char *name = largv[i]; + const char *name = largv[i]; if (slen > 0) { len = strlen(name); @@ -2080,7 +2080,7 @@ ZipFSMkZipOrImgCmd(ClientData clientData, Tcl_Interp *interp, pos[1] = Tcl_Tell(out); count = 0; for (i = 0; i < largc; i++) { - CONST char *name = largv[i]; + const char *name = largv[i]; if (slen > 0) { len = strlen(name); @@ -2175,7 +2175,7 @@ done: static int ZipFSMkZipCmd(ClientData clientData, Tcl_Interp *interp, - int argc, CONST char **argv) + int argc, const char **argv) { return ZipFSMkZipOrImgCmd(clientData, interp, 0, argc, argv); } @@ -2199,7 +2199,7 @@ ZipFSMkZipCmd(ClientData clientData, Tcl_Interp *interp, static int ZipFSMkImgCmd(ClientData clientData, Tcl_Interp *interp, - int argc, CONST char **argv) + int argc, const char **argv) { return ZipFSMkZipOrImgCmd(clientData, interp, 1, argc, argv); } @@ -2224,7 +2224,7 @@ ZipFSMkImgCmd(ClientData clientData, Tcl_Interp *interp, static int ZipFSExistsObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]) + int objc, Tcl_Obj *const objv[]) { char *filename; int exists; @@ -2262,7 +2262,7 @@ ZipFSExistsObjCmd(ClientData clientData, Tcl_Interp *interp, static int ZipFSInfoObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]) + int objc, Tcl_Obj *const objv[]) { char *filename; ZipEntry *z; @@ -2307,7 +2307,7 @@ ZipFSInfoObjCmd(ClientData clientData, Tcl_Interp *interp, static int ZipFSListObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]) + int objc, Tcl_Obj *const objv[]) { char *pattern = NULL; Tcl_RegExp regexp = NULL; @@ -2496,7 +2496,7 @@ ZipChannelRead(ClientData instanceData, char *buf, int toRead, int *errloc) */ static int -ZipChannelWrite(ClientData instanceData, CONST char *buf, +ZipChannelWrite(ClientData instanceData, const char *buf, int toWrite, int *errloc) { ZipChannel *info = (ZipChannel *) instanceData; @@ -3176,7 +3176,7 @@ Zip_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr) static int Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, - Tcl_Obj *pathPtr, CONST char *pattern, + Tcl_Obj *pathPtr, const char *pattern, Tcl_GlobTypeData *types) { Tcl_HashEntry *hPtr; @@ -3606,10 +3606,10 @@ Zip_FSChdirProc(Tcl_Obj *pathPtr) *------------------------------------------------------------------------- */ -static CONST char *CONST86 * +static const char *const * Zip_FSFileAttrStringsProc(Tcl_Obj *pathPtr, Tcl_Obj** objPtrRef) { - static CONST char *attrs[] = { + static const char *const attrs[] = { "-uncompsize", "-compsize", "-offset", @@ -3885,7 +3885,7 @@ static int Zipfs_doInit(Tcl_Interp *interp, int safe) { #ifdef HAVE_ZLIB - static CONST char findproc[] = + static const char findproc[] = "proc ::zipfs::find dir {\n" " set result {}\n" " if {[catch {glob -directory $dir -tails -nocomplain * .*} list]} {\n" @@ -4009,14 +4009,14 @@ Zipfs_SafeInit(Tcl_Interp *interp) */ int -Zipfs_Mount(Tcl_Interp *interp, CONST char *zipname, CONST char *mntpt, - CONST char *passwd) +Zipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, + const char *passwd) { return Zipfs_doInit(interp, 1); } int -Zipfs_Unmount(Tcl_Interp *interp, CONST char *zipname) +Zipfs_Unmount(Tcl_Interp *interp, const char *zipname) { return Zipfs_doInit(interp, 1); } -- cgit v0.12 From 8ecd6aeb5b622ad2cc8c4690880e066c60abec54 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 21 Dec 2015 11:29:38 +0000 Subject: Make it compile warning-free with MSVC compiler (VS2013, at least). Other tweaks. --- generic/tclPkgConfig.c | 20 -------------------- generic/zipfs.c | 31 ++++++++++++++++--------------- unix/Makefile.in | 3 +-- unix/tclLoadDl.c | 40 +--------------------------------------- unix/tclUnixFCmd.c | 21 --------------------- unix/tclUnixInit.c | 4 ---- win/makefile.vc | 6 +++++- 7 files changed, 23 insertions(+), 102 deletions(-) diff --git a/generic/tclPkgConfig.c b/generic/tclPkgConfig.c index 3f8178e..466d535 100644 --- a/generic/tclPkgConfig.c +++ b/generic/tclPkgConfig.c @@ -100,35 +100,19 @@ static Tcl_Config const cfg[] = { /* Runtime paths to various stuff */ -#ifdef ANDROID - {"libdir,runtime", ""}, - {"bindir,runtime", ""}, - {"scriptdir,runtime", ""}, - {"includedir,runtime", ""}, - {"docdir,runtime", ""}, -#else {"libdir,runtime", CFG_RUNTIME_LIBDIR}, {"bindir,runtime", CFG_RUNTIME_BINDIR}, {"scriptdir,runtime", CFG_RUNTIME_SCRDIR}, {"includedir,runtime", CFG_RUNTIME_INCDIR}, {"docdir,runtime", CFG_RUNTIME_DOCDIR}, -#endif /* Installation paths to various stuff */ -#ifdef ANDROID - {"libdir,install", ""}, - {"bindir,install", ""}, - {"scriptdir,install", ""}, - {"includedir,install", ""}, - {"docdir,install", ""}, -#else {"libdir,install", CFG_INSTALL_LIBDIR}, {"bindir,install", CFG_INSTALL_BINDIR}, {"scriptdir,install", CFG_INSTALL_SCRDIR}, {"includedir,install", CFG_INSTALL_INCDIR}, {"docdir,install", CFG_INSTALL_DOCDIR}, -#endif /* Last entry, closes the array */ {NULL, NULL} @@ -139,10 +123,6 @@ TclInitEmbeddedConfigurationInformation( Tcl_Interp *interp) /* Interpreter the configuration command is * registered in. */ { -#if defined(ANDROID) && !defined(TCL_CFGVAL_ENCODING) -#define TCL_CFGVAL_ENCODING "utf-8" -#endif - Tcl_RegisterConfig(interp, "tcl", cfg, TCL_CFGVAL_ENCODING); } diff --git a/generic/zipfs.c b/generic/zipfs.c index a9f0a39..67390a6 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -2561,19 +2561,19 @@ ZipChannelSeek(ClientData instanceData, long offset, int mode, int *errloc) *errloc = EINVAL; return -1; } + if (offset < 0) { + *errloc = EINVAL; + return -1; + } if (info->iswr) { - if (offset > info->nmax) { + if ((unsigned long) offset > info->nmax) { *errloc = EINVAL; return -1; } - if (offset > info->nbyte) { + if ((unsigned long) offset > info->nbyte) { info->nbyte = offset; } - } else if (offset > info->nbyte) { - *errloc = EINVAL; - return -1; - } - if (offset < 0) { + } else if ((unsigned long) offset > info->nbyte) { *errloc = EINVAL; return -1; } @@ -2772,12 +2772,12 @@ merror0: info->nbyte = 0; } else { if (z->data != NULL) { - i = z->nbyte; - if (i > info->nmax) { - i = info->nmax; + unsigned int j = z->nbyte; + if (j > info->nmax) { + j = info->nmax; } - memcpy(info->ubuf, z->data, i); - info->nbyte = i; + memcpy(info->ubuf, z->data, j); + info->nbyte = j; } else { unsigned char *zbuf = z->zipfile->data + z->offset; @@ -2809,15 +2809,16 @@ merror0: stream.opaque = Z_NULL; stream.avail_in = z->nbytecompr; if (z->isenc) { + unsigned int j; stream.avail_in -= 12; cbuf = (unsigned char *) Tcl_AttemptAlloc(stream.avail_in); if (cbuf == NULL) { goto merror0; } - for (i = 0; i < stream.avail_in; i++) { - ch = info->ubuf[i]; - cbuf[i] = zdecode(info->keys, crc32tab, ch); + for (j = 0; j < stream.avail_in; j++) { + ch = info->ubuf[j]; + cbuf[j] = zdecode(info->keys, crc32tab, ch); } stream.next_in = cbuf; } else { diff --git a/unix/Makefile.in b/unix/Makefile.in index 3e4cfc7..d65dceb 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -383,8 +383,7 @@ GENERIC_HDRS = \ $(GENERIC_DIR)/tclPatch.h \ $(GENERIC_DIR)/tclPlatDecls.h \ $(GENERIC_DIR)/tclPort.h \ - $(GENERIC_DIR)/tclRegexp.h \ - $(GENERIC_DIR)/tclZipfs.h + $(GENERIC_DIR)/tclRegexp.h GENERIC_SRCS = \ $(GENERIC_DIR)/regcomp.c \ diff --git a/unix/tclLoadDl.c b/unix/tclLoadDl.c index bb2361c..aec071c 100644 --- a/unix/tclLoadDl.c +++ b/unix/tclLoadDl.c @@ -97,11 +97,7 @@ TclpDlopen( } else { dlopenflags |= RTLD_NOW; } - if (native == NULL) { - handle = NULL; - } else { - handle = dlopen(native, dlopenflags); - } + handle = dlopen(native, dlopenflags); if (handle == NULL) { /* * Let the OS loader examine the binary search path for whatever @@ -119,41 +115,7 @@ TclpDlopen( handle = dlopen(native, dlopenflags); Tcl_DStringFree(&ds); } -#ifdef ANDROID - /* - * If not an absolute or relative path, try to load - * from $INTERNAL_STORAGE/../lib (the place where the - * system has installed bundled .so files from the .APK) - */ - if (handle == NULL) { - native = Tcl_GetString(pathPtr); - if ((native != NULL) && (strchr(native, '/') == NULL)) { - char *storage = getenv("INTERNAL_STORAGE"); - Tcl_DString ds2; - if ((storage != NULL) && (storage[0] != '\0')) { - Tcl_DStringInit(&ds2); - Tcl_DStringAppend(&ds2, storage, -1); - Tcl_DStringAppend(&ds2, "/../lib/", -1); - Tcl_DStringAppend(&ds2, native, -1); - handle = dlopen(Tcl_DStringValue(&ds2), RTLD_NOW | RTLD_GLOBAL); - Tcl_DStringFree(&ds2); - } - if (handle == NULL) { - storage = getenv("TK_TCL_WISH_LD_LIBS"); - if ((storage != NULL) && (storage[0] != '\0')) { - Tcl_DStringInit(&ds2); - Tcl_DStringAppend(&ds2, storage, -1); - Tcl_DStringAppend(&ds2, "/", -1); - Tcl_DStringAppend(&ds2, native, -1); - handle = - dlopen(Tcl_DStringValue(&ds2), RTLD_NOW | RTLD_GLOBAL); - Tcl_DStringFree(&ds2); - } - } - } - } - #endif if (handle == NULL) { /* * Write the string to a variable first to work around a compiler bug diff --git a/unix/tclUnixFCmd.c b/unix/tclUnixFCmd.c index 0193dae..3b1b6ca 100644 --- a/unix/tclUnixFCmd.c +++ b/unix/tclUnixFCmd.c @@ -465,9 +465,6 @@ DoCopyFile( /* Used to determine filetype. */ { Tcl_StatBuf dstStatBuf; -#ifdef ANDROID - int ret; -#endif if (S_ISDIR(statBufPtr->st_mode)) { errno = EISDIR; @@ -523,15 +520,7 @@ DoCopyFile( if (mkfifo(dst, statBufPtr->st_mode) < 0) { /* INTL: Native. */ return TCL_ERROR; } -#ifdef ANDROID - ret = CopyFileAtts(src, dst, statBufPtr); - if (ret != TCL_OK && errno == EPERM) { - ret = TCL_OK; - } - return ret; -#else return CopyFileAtts(src, dst, statBufPtr); -#endif default: return TclUnixCopyFile(src, dst, statBufPtr, 0); } @@ -640,11 +629,6 @@ TclUnixCopyFile( return TCL_ERROR; } if (!dontCopyAtts && CopyFileAtts(src, dst, statBufPtr) == TCL_ERROR) { -#ifdef ANDROID - if (errno == EPERM) { - return TCL_OK; - } -#endif /* * The copy succeeded, but setting the permissions failed, so be in a * consistent state, we remove the file that was created by the copy. @@ -1219,11 +1203,6 @@ TraversalCopy( Tcl_DStringValue(dstPtr), statBufPtr) == TCL_OK) { return TCL_OK; } -#ifdef ANDROID - if (errno == EPERM) { - return TCL_OK; - } -#endif break; } diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index 5e4ef0a..5fc0035 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -583,14 +583,10 @@ TclpInitLibraryPath( void TclpSetInitialEncodings(void) { -#ifdef ANDROID - Tcl_SetSystemEncoding(NULL, "utf-8"); -#else Tcl_DString encodingName; Tcl_SetSystemEncoding(NULL, Tcl_GetEncodingNameFromEnvironment(&encodingName)); Tcl_DStringFree(&encodingName); -#endif } void diff --git a/win/makefile.vc b/win/makefile.vc index 82dd655..2e04f15 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -344,7 +344,8 @@ COREOBJS = \ $(TMP_DIR)\tclUtf.obj \ $(TMP_DIR)\tclUtil.obj \ $(TMP_DIR)\tclVar.obj \ - $(TMP_DIR)\tclZlib.obj + $(TMP_DIR)\tclZlib.obj \ + $(TMP_DIR)\zipfs.obj ZLIBOBJS = \ $(TMP_DIR)\adler32.obj \ @@ -942,6 +943,9 @@ $(TMP_DIR)\tclWinTest.obj: $(WINDIR)\tclWinTest.c $(TMP_DIR)\tclZlib.obj: $(GENERICDIR)\tclZlib.c $(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -DBUILD_tcl -Fo$@ $? +$(TMP_DIR)\zipfs.obj: $(GENERICDIR)\zipfs.c + $(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -DBUILD_tcl -Fo$@ $? + $(TMP_DIR)\tclPkgConfig.obj: $(GENERICDIR)\tclPkgConfig.c $(cc32) -DBUILD_tcl $(TCL_CFLAGS) \ -DCFG_INSTALL_LIBDIR="\"$(LIB_INSTALL_DIR:\=\\)\"" \ -- cgit v0.12 From 1c3288f038d8b2f9883e3b9f63f37f42e6811969 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 21 Dec 2015 11:59:08 +0000 Subject: Finally, make it compile warning-free using Visual Studio, if ZIPFS_IN_TCL is defined --- generic/zipfs.c | 17 ++++++++--------- win/makefile.vc | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/generic/zipfs.c b/generic/zipfs.c index 67390a6..6179542 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -9,6 +9,9 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ +#include "tclInt.h" +#include "tclFileSystem.h" +#include "tclZipfs.h" #if !defined(_WIN32) && !defined(_WIN64) #include #endif @@ -18,15 +21,10 @@ #include #include #include + #ifdef HAVE_ZLIB #include "zlib.h" #include "zcrypt.h" -#endif -#include "tclInt.h" -#include "tclFileSystem.h" -#include "tclZipfs.h" - -#ifdef HAVE_ZLIB /* * Various constants and offsets found in ZIP archive files. @@ -2904,6 +2902,7 @@ cerror0: z_stream stream; int err; unsigned char *ubuf = NULL; + unsigned int j; memset(&stream, 0, sizeof (stream)); stream.zalloc = Z_NULL; @@ -2917,9 +2916,9 @@ cerror0: info->ubuf = NULL; goto merror; } - for (i = 0; i < stream.avail_in; i++) { - ch = info->ubuf[i]; - ubuf[i] = zdecode(info->keys, crc32tab, ch); + for (j = 0; j < stream.avail_in; j++) { + ch = info->ubuf[j]; + ubuf[j] = zdecode(info->keys, crc32tab, ch); } stream.next_in = ubuf; } else { diff --git a/win/makefile.vc b/win/makefile.vc index 2e04f15..80682b9 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -504,7 +504,7 @@ crt = -MT !endif TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TOMMATHDIR)" -TCL_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 +TCL_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 -DZIPFS_IN_TCL BASE_CFLAGS = $(cflags) $(cdebug) $(crt) $(TCL_INCLUDES) $(TCL_DEFINES) CON_CFLAGS = $(cflags) $(cdebug) $(crt) -DCONSOLE TCL_CFLAGS = $(BASE_CFLAGS) $(OPTDEFINES) -- cgit v0.12 From 63b07461da87c89858482b065e62b2d31d765c40 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 21 Dec 2015 12:43:54 +0000 Subject: Fix android compilation (zipfsFilesystem.loadFileProc is a constant, so it cannot be written) --- generic/zipfs.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/generic/zipfs.c b/generic/zipfs.c index 6179542..b54d5a2 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -2807,7 +2807,7 @@ merror0: stream.opaque = Z_NULL; stream.avail_in = z->nbytecompr; if (z->isenc) { - unsigned int j; + unsigned int j; stream.avail_in -= 12; cbuf = (unsigned char *) Tcl_AttemptAlloc(stream.avail_in); @@ -3734,7 +3734,6 @@ Zip_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr) return Tcl_NewStringObj("zip", -1); } -#ifndef ANDROID /* *------------------------------------------------------------------------- @@ -3762,6 +3761,14 @@ static int Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, Tcl_FSUnloadFileProc **unloadProcPtr, int flags) { +#ifdef ANDROID + /* + * Force loadFileProc to native implementation since the + * package manger already extracted the shared libraries + * from the APK at install time. + */ + return tclNativeFilesystem.loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); +#else Tcl_FSLoadFileProc2 *loadFileProc; Tcl_Obj *altPath = NULL; int ret = -1; @@ -3813,8 +3820,8 @@ Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, Tcl_DecrRefCount(altPath); } return ret; -} #endif +} /* @@ -3852,11 +3859,7 @@ const Tcl_Filesystem zipfsFilesystem = { NULL, /* renameFileProc */ NULL, /* copyDirectoryProc */ NULL, /* lstatProc */ -#ifdef ANDROID - NULL, /* loadFileProc */ -#else (Tcl_FSLoadFileProc *) Zip_FSLoadFile, -#endif NULL, /* getCwdProc */ Zip_FSChdirProc, }; @@ -3922,14 +3925,6 @@ Zipfs_doInit(Tcl_Interp *interp, int safe) Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, &t); Tcl_MutexUnlock(&ZipFSMutex); #endif -#ifdef ANDROID - /* - * Force loadFileProc to native implementation since the - * package manger already extracted the shared libraries - * from the APK at install time. - */ - zipfsFilesystem.loadFileProc = tclNativeFilesystem.loadFileProc; -#endif Tcl_FSRegister(NULL, &zipfsFilesystem); Tcl_InitHashTable(&ZipFS.fileHash, TCL_STRING_KEYS); Tcl_InitHashTable(&ZipFS.zipHash, TCL_STRING_KEYS); -- cgit v0.12 From 56c5833c4ab4b228c29eb2ade13ba727e1e45da5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 21 Dec 2015 14:01:57 +0000 Subject: Eliminate all use of ZIPFS_IN_TCL --- generic/tclIOUtil.c | 6 ------ generic/tclZipfs.h | 25 ++++--------------------- generic/zipfs.c | 42 +++++++++++++++++++----------------------- win/makefile.vc | 2 +- 4 files changed, 24 insertions(+), 51 deletions(-) diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 0ef6d3b..79ec894 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -191,9 +191,7 @@ const Tcl_Filesystem tclNativeFilesystem = { TclpObjChdir }; -#ifdef ZIPFS_IN_TCL MODULE_SCOPE Tcl_Filesystem zipfsFilesystem; -#endif /* * Define the tail of the linked list. Note that for unconventional uses of @@ -1415,7 +1413,6 @@ TclFSNormalizeToUniquePath( Claim(); for (fsRecPtr=firstFsRecPtr; fsRecPtr!=NULL; fsRecPtr=fsRecPtr->nextPtr) { -#ifdef ZIPFS_IN_TCL if (fsRecPtr->fsPtr == &zipfsFilesystem) { ClientData clientData = NULL; /* @@ -1432,7 +1429,6 @@ TclFSNormalizeToUniquePath( } continue; } -#endif if (fsRecPtr->fsPtr != &tclNativeFilesystem) { continue; } @@ -1457,11 +1453,9 @@ TclFSNormalizeToUniquePath( if (fsRecPtr->fsPtr == &tclNativeFilesystem) { continue; } -#ifdef ZIPFS_IN_TCL if (fsRecPtr->fsPtr == &zipfsFilesystem) { continue; } -#endif if (fsRecPtr->fsPtr->normalizePathProc != NULL) { startAt = fsRecPtr->fsPtr->normalizePathProc(interp, pathPtr, diff --git a/generic/tclZipfs.h b/generic/tclZipfs.h index 75dcb13..bcf6cef 100644 --- a/generic/tclZipfs.h +++ b/generic/tclZipfs.h @@ -22,33 +22,16 @@ extern "C" { # define ZIPFSAPI extern #endif -#ifdef ZIPFS_IN_TK -#define Zipfs_Mount Tkzipfs_Mount -#define Zipfs_Unmount Tkzipfs_Unmount -#define Zipfs_Init Tkzipfs_Init -#define Zipfs_SafeInit Tkzipfs_SafeInit -#ifdef BUILD_tk -# undef ZIPFSAPI -# define ZIPFSAPI DLLEXPORT -#endif -#endif - -#ifdef ZIPFS_IN_TCL -#define Zipfs_Mount Tclzipfs_Mount -#define Zipfs_Unmount Tclzipfs_Unmount -#define Zipfs_Init Tclzipfs_Init -#define Zipfs_SafeInit Tclzipfs_SafeInit #ifdef BUILD_tcl # undef ZIPFSAPI # define ZIPFSAPI DLLEXPORT #endif -#endif -ZIPFSAPI int Zipfs_Mount(Tcl_Interp *interp, const char *zipname, +ZIPFSAPI int Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd); -ZIPFSAPI int Zipfs_Unmount(Tcl_Interp *interp, const char *zipname); -ZIPFSAPI int Zipfs_Init(Tcl_Interp *interp); -ZIPFSAPI int Zipfs_SafeInit(Tcl_Interp *interp); +ZIPFSAPI int Tclzipfs_Unmount(Tcl_Interp *interp, const char *zipname); +ZIPFSAPI int Tclzipfs_Init(Tcl_Interp *interp); +ZIPFSAPI int Tclzipfs_SafeInit(Tcl_Interp *interp); #ifdef __cplusplus } diff --git a/generic/zipfs.c b/generic/zipfs.c index b54d5a2..144be30 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -1031,7 +1031,7 @@ error: /* *------------------------------------------------------------------------- * - * Zipfs_Mount -- + * Tclzipfs_Mount -- * * This procedure is invoked to mount a given ZIP archive file on * a given mountpoint with optional ZIP password. @@ -1047,7 +1047,7 @@ error: */ int -Zipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, +Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd) { char *realname, *p; @@ -1404,7 +1404,7 @@ nextent: /* *------------------------------------------------------------------------- * - * Zipfs_Unmount -- + * Tclzipfs_Unmount -- * * This procedure is invoked to unmount a given ZIP archive. * @@ -1418,7 +1418,7 @@ nextent: */ int -Zipfs_Unmount(Tcl_Interp *interp, const char *zipname) +Tclzipfs_Unmount(Tcl_Interp *interp, const char *zipname) { char *realname; ZipFile *zf; @@ -1509,7 +1509,7 @@ ZipFSMountCmd(ClientData clientData, Tcl_Interp *interp, " ?zipfile ?mountpoint? ?password???\"", 0); return TCL_ERROR; } - return Zipfs_Mount(interp, (argc > 1) ? argv[1] : NULL, + return Tclzipfs_Mount(interp, (argc > 1) ? argv[1] : NULL, (argc > 2) ? argv[2] : NULL, (argc > 3) ? argv[3] : NULL); } @@ -1539,7 +1539,7 @@ ZipFSUnmountCmd(ClientData clientData, Tcl_Interp *interp, " zipfile\"", (char *) NULL); return TCL_ERROR; } - return Zipfs_Unmount(interp, argv[1]); + return Tclzipfs_Unmount(interp, argv[1]); } /* @@ -3870,7 +3870,7 @@ const Tcl_Filesystem zipfsFilesystem = { /* *------------------------------------------------------------------------- * - * Zipfs_doInit -- + * doInit -- * * Perform per interpreter initialization of this module. * @@ -3885,7 +3885,7 @@ const Tcl_Filesystem zipfsFilesystem = { */ static int -Zipfs_doInit(Tcl_Interp *interp, int safe) +doInit(Tcl_Interp *interp, int safe) { #ifdef HAVE_ZLIB static const char findproc[] = @@ -3929,14 +3929,10 @@ Zipfs_doInit(Tcl_Interp *interp, int safe) Tcl_InitHashTable(&ZipFS.fileHash, TCL_STRING_KEYS); Tcl_InitHashTable(&ZipFS.zipHash, TCL_STRING_KEYS); ZipFS.initialized = ZipFS.idCount = 1; -#if defined(ZIPFS_IN_TCL) || defined(ZIPFS_IN_TK) - Tcl_StaticPackage(interp, "zipfs", Zipfs_Init, Zipfs_SafeInit); -#endif + Tcl_StaticPackage(interp, "zipfs", Tclzipfs_Init, Tclzipfs_SafeInit); } Unlock(); -#if !defined(ZIPFS_IN_TCL) && !defined(ZIPFS_IN_TK) Tcl_PkgProvide(interp, "zipfs", "1.0"); -#endif if (!safe) { Tcl_CreateCommand(interp, "::zipfs::mount", ZipFSMountCmd, 0, 0); Tcl_CreateCommand(interp, "::zipfs::unmount", ZipFSUnmountCmd, 0, 0); @@ -3964,7 +3960,7 @@ Zipfs_doInit(Tcl_Interp *interp, int safe) /* *------------------------------------------------------------------------- * - * Zipfs_Init, Zipfs_SafeInit -- + * Tclzipfs_Init, Tclzipfs_SafeInit -- * * These functions are invoked to perform per interpreter initialization * of this module. @@ -3980,15 +3976,15 @@ Zipfs_doInit(Tcl_Interp *interp, int safe) */ int -Zipfs_Init(Tcl_Interp *interp) +Tclzipfs_Init(Tcl_Interp *interp) { - return Zipfs_doInit(interp, 0); + return doInit(interp, 0); } int -Zipfs_SafeInit(Tcl_Interp *interp) +Tclzipfs_SafeInit(Tcl_Interp *interp) { - return Zipfs_doInit(interp, 1); + return doInit(interp, 1); } #ifndef HAVE_ZLIB @@ -3996,7 +3992,7 @@ Zipfs_SafeInit(Tcl_Interp *interp) /* *------------------------------------------------------------------------- * - * Zipfs_Mount, Zipfs_Unmount -- + * Tclzipfs_Mount, Tclzipfs_Unmount -- * * Dummy version when no ZLIB support available. * @@ -4004,16 +4000,16 @@ Zipfs_SafeInit(Tcl_Interp *interp) */ int -Zipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, +Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd) { - return Zipfs_doInit(interp, 1); + return doInit(interp, 1); } int -Zipfs_Unmount(Tcl_Interp *interp, const char *zipname) +Tclzipfs_Unmount(Tcl_Interp *interp, const char *zipname) { - return Zipfs_doInit(interp, 1); + return doInit(interp, 1); } #endif diff --git a/win/makefile.vc b/win/makefile.vc index 80682b9..2e04f15 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -504,7 +504,7 @@ crt = -MT !endif TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TOMMATHDIR)" -TCL_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 -DZIPFS_IN_TCL +TCL_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 BASE_CFLAGS = $(cflags) $(cdebug) $(crt) $(TCL_INCLUDES) $(TCL_DEFINES) CON_CFLAGS = $(cflags) $(cdebug) $(crt) -DCONSOLE TCL_CFLAGS = $(BASE_CFLAGS) $(OPTDEFINES) -- cgit v0.12 From 3c03a492f903c82b544cd54fb5b8f2e2e374a150 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 21 Dec 2015 15:21:21 +0000 Subject: Start with a few simple basic test-cases --- generic/zipfs.c | 13 +++-------- tests/zipfs.test | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ unix/tclAppInit.c | 5 +++++ win/tclAppInit.c | 5 +++++ 4 files changed, 80 insertions(+), 10 deletions(-) create mode 100644 tests/zipfs.test diff --git a/generic/zipfs.c b/generic/zipfs.c index 144be30..3c330b2 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -3761,15 +3761,15 @@ static int Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, Tcl_FSUnloadFileProc **unloadProcPtr, int flags) { + Tcl_FSLoadFileProc2 *loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; #ifdef ANDROID /* * Force loadFileProc to native implementation since the * package manger already extracted the shared libraries * from the APK at install time. */ - return tclNativeFilesystem.loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); + return loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); #else - Tcl_FSLoadFileProc2 *loadFileProc; Tcl_Obj *altPath = NULL; int ret = -1; @@ -3810,7 +3810,6 @@ Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, Tcl_DecrRefCount(objs[1]); } } - loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; if (loadFileProc != NULL) { ret = loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); } else { @@ -3885,8 +3884,7 @@ const Tcl_Filesystem zipfsFilesystem = { */ static int -doInit(Tcl_Interp *interp, int safe) -{ +doInit(Tcl_Interp *interp, int safe) { #ifdef HAVE_ZLIB static const char findproc[] = "proc ::zipfs::find dir {\n" @@ -3907,11 +3905,6 @@ doInit(Tcl_Interp *interp, int safe) " return [lsort $result]\n" "}\n"; -#ifdef USE_TCL_STUBS - if (Tcl_InitStubs(interp, "8.0", 0) == NULL) { - return TCL_ERROR; - } -#endif /* one-time initialization */ WriteLock(); if (!ZipFS.initialized) { diff --git a/tests/zipfs.test b/tests/zipfs.test new file mode 100644 index 0000000..e8112f5 --- /dev/null +++ b/tests/zipfs.test @@ -0,0 +1,67 @@ +# The file tests the tclZlib.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-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. + +if {"::tcltest" ni [namespace children]} { + package require tcltest 2.1 + namespace import -force ::tcltest::* +} + +testConstraint zlib [llength [info commands zlib]] + +test zipfs-1.1 {zipfs basics} -constraints zlib -body { + load {} zipfs + package require zipfs +} -result {1.0} + +test zipfs-1.2 {zipfs basics} -constraints zlib -returnCodes error -body { + ::zipfs::mount a b c d e f +} -result {wrong # args: should be "::zipfs::mount ?zipfile ?mountpoint? ?password???"} + +test zipfs-1.3 {zipfs basics} -constraints zlib -returnCodes error -body { + ::zipfs::unmount a b c d e f +} -result {wrong # args: should be "::zipfs::unmount zipfile"} + +test zipfs-1.4 {zipfs basics} -constraints zlib -returnCodes error -body { + ::zipfs::mkkey a b c d e f +} -result {wrong # args: should be "::zipfs::mkkey password"} + +test zipfs-1.5 {zipfs basics} -constraints zlib -returnCodes error -body { + ::zipfs::mkimg a b c d e f +} -result {wrong # args: should be "::zipfs::mkimg outfile indir ?strip? ?password? ?infile?"} + +test zipfs-1.6 {zipfs basics} -constraints zlib -returnCodes error -body { + ::zipfs::mkzip a b c d e f +} -result {wrong # args: should be "::zipfs::mkzip outfile indir ?strip? ?password?"} + +test zipfs-1.7 {zipfs basics} -constraints zlib -returnCodes error -body { + ::zipfs::exists a b c d e f +} -result {wrong # args: should be "::zipfs::exists filename"} + +test zipfs-1.8 {zipfs basics} -constraints zlib -returnCodes error -body { + ::zipfs::info a b c d e f +} -result {wrong # args: should be "::zipfs::info filename"} + +test zipfs-1.9 {zipfs basics} -constraints zlib -returnCodes error -body { + ::zipfs::list a b c d e f +} -result {wrong # args: should be "::zipfs::list ?(-glob|-regexp)? ?pattern?"} + + + + + + +::tcltest::cleanupTests +return + +# Local Variables: +# mode: tcl +# End: diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index 9bbc88b..40b10f3 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -17,6 +17,7 @@ #include "tcl.h" #ifdef TCL_TEST +#include "tclZipfs.h" extern Tcl_PackageInitProc Tcltest_Init; extern Tcl_PackageInitProc Tcltest_SafeInit; #endif /* TCL_TEST */ @@ -123,6 +124,10 @@ Tcl_AppInit( return TCL_ERROR; } Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, Tcltest_SafeInit); + if (Tclzipfs_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "zipfs", Tclzipfs_Init, Tclzipfs_SafeInit); #endif /* TCL_TEST */ /* diff --git a/win/tclAppInit.c b/win/tclAppInit.c index e06eaf5..b821ca7 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -25,6 +25,7 @@ #include #ifdef TCL_TEST +#include "tclZipfs.h" extern Tcl_PackageInitProc Tcltest_Init; extern Tcl_PackageInitProc Tcltest_SafeInit; #endif /* TCL_TEST */ @@ -174,6 +175,10 @@ Tcl_AppInit( return TCL_ERROR; } Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, Tcltest_SafeInit); + if (Tclzipfs_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "zipfs", Tclzipfs_Init, Tclzipfs_SafeInit); #endif /* TCL_TEST */ /* -- cgit v0.12 From a03e74efc1bbec20a5c2488448a8de28d9fb28fb Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 21 Dec 2015 21:25:40 +0000 Subject: USE_TCL_STUBS is not defined anyway --- generic/zipfs.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/generic/zipfs.c b/generic/zipfs.c index 3c330b2..1f126ce 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -12,6 +12,7 @@ #include "tclInt.h" #include "tclFileSystem.h" #include "tclZipfs.h" + #if !defined(_WIN32) && !defined(_WIN64) #include #endif @@ -2771,6 +2772,7 @@ merror0: } else { if (z->data != NULL) { unsigned int j = z->nbyte; + if (j > info->nmax) { j = info->nmax; } @@ -2808,6 +2810,7 @@ merror0: stream.avail_in = z->nbytecompr; if (z->isenc) { unsigned int j; + stream.avail_in -= 12; cbuf = (unsigned char *) Tcl_AttemptAlloc(stream.avail_in); @@ -3761,14 +3764,20 @@ static int Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, Tcl_FSUnloadFileProc **unloadProcPtr, int flags) { - Tcl_FSLoadFileProc2 *loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; + Tcl_FSLoadFileProc2 *loadFileProc; #ifdef ANDROID - /* - * Force loadFileProc to native implementation since the - * package manger already extracted the shared libraries - * from the APK at install time. - */ - return loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); + /* + * Force loadFileProc to native implementation since the + * package manger already extracted the shared libraries + * from the APK at install time. + */ + + loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; + if (loadFileProc != NULL) { + return loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); + } + Tcl_SetErrno(ENOENT); + return -1; #else Tcl_Obj *altPath = NULL; int ret = -1; @@ -3810,6 +3819,7 @@ Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, Tcl_DecrRefCount(objs[1]); } } + loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; if (loadFileProc != NULL) { ret = loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); } else { @@ -3869,7 +3879,7 @@ const Tcl_Filesystem zipfsFilesystem = { /* *------------------------------------------------------------------------- * - * doInit -- + * Zipfs_doInit -- * * Perform per interpreter initialization of this module. * @@ -3884,7 +3894,8 @@ const Tcl_Filesystem zipfsFilesystem = { */ static int -doInit(Tcl_Interp *interp, int safe) { +Zipfs_doInit(Tcl_Interp *interp, int safe) +{ #ifdef HAVE_ZLIB static const char findproc[] = "proc ::zipfs::find dir {\n" @@ -3971,13 +3982,13 @@ doInit(Tcl_Interp *interp, int safe) { int Tclzipfs_Init(Tcl_Interp *interp) { - return doInit(interp, 0); + return Zipfs_doInit(interp, 0); } int Tclzipfs_SafeInit(Tcl_Interp *interp) { - return doInit(interp, 1); + return Zipfs_doInit(interp, 1); } #ifndef HAVE_ZLIB @@ -3996,13 +4007,13 @@ int Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd) { - return doInit(interp, 1); + return Zipfs_doInit(interp, 1); } int Tclzipfs_Unmount(Tcl_Interp *interp, const char *zipname) { - return doInit(interp, 1); + return Zipfs_doInit(interp, 1); } #endif -- cgit v0.12 From 299924e512e6809f22f5fa3e4410fcc706ceec82 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 22 Dec 2015 09:11:57 +0000 Subject: Remove TIP #414 fragment, not strictly needed for the zipfs TIP. Add more zipfs test-cases --- generic/tcl.h | 7 ----- generic/tclEncoding.c | 23 +++------------- tests/zipfs.test | 73 ++++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 64 insertions(+), 39 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index fed6b78..a08edde 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2424,13 +2424,6 @@ const char * TclTomMathInitializeStubs(Tcl_Interp *interp, * TODO - tommath stubs export goes here! */ -/* Tcl_InitSubsystems, see TIP #414 */ - -#ifndef USE_TCL_STUBS -EXTERN const char * Tcl_InitSubsystems(TCL_NORETURN1 - Tcl_PanicProc *panicProc); -#endif - /* * Public functions that are not accessible via the stubs table. * Tcl_GetMemoryInfo is needed for AOLserver. [Bug 1868171] diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 4020445..4edebcf 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1440,10 +1440,10 @@ Tcl_UtfToExternal( /* *--------------------------------------------------------------------------- * - * Tcl_InitSubsystems/Tcl_FindExecutable -- + * Tcl_FindExecutable -- * - * This function initializes everything needed for the Tcl library - * to be able to operate. + * This function computes the absolute path name of the current + * application, given its argv[0] value. * * Results: * None. @@ -1454,23 +1454,6 @@ Tcl_UtfToExternal( * *--------------------------------------------------------------------------- */ -MODULE_SCOPE const TclStubs tclStubs; - -static const struct { - const TclStubs *stubs; - const char version[16]; -} stubInfo = { - &tclStubs, TCL_PATCH_LEVEL -}; - -const char * -Tcl_InitSubsystems(TCL_NORETURN1 Tcl_PanicProc *panicProc) -{ - Tcl_SetPanicProc(panicProc); - TclInitSubsystems(); - return stubInfo.version; -} - #undef Tcl_FindExecutable void Tcl_FindExecutable( diff --git a/tests/zipfs.test b/tests/zipfs.test index e8112f5..3f53cf8 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -15,49 +15,98 @@ if {"::tcltest" ni [namespace children]} { namespace import -force ::tcltest::* } -testConstraint zlib [llength [info commands zlib]] +testConstraint zipfs [expr {[llength [info commands zlib]] && [regexp tcltest [info nameofexecutable]]}] -test zipfs-1.1 {zipfs basics} -constraints zlib -body { +test zipfs-1.1 {zipfs basics} -constraints zipfs -body { load {} zipfs +} -result {} + +test zipfs-1.2 {zipfs basics} -constraints zipfs -body { package require zipfs } -result {1.0} -test zipfs-1.2 {zipfs basics} -constraints zlib -returnCodes error -body { +test zipfs-1.3 {zipfs basics} -constraints zipfs -returnCodes error -body { ::zipfs::mount a b c d e f } -result {wrong # args: should be "::zipfs::mount ?zipfile ?mountpoint? ?password???"} -test zipfs-1.3 {zipfs basics} -constraints zlib -returnCodes error -body { +test zipfs-1.4 {zipfs basics} -constraints zipfs -returnCodes error -body { ::zipfs::unmount a b c d e f } -result {wrong # args: should be "::zipfs::unmount zipfile"} -test zipfs-1.4 {zipfs basics} -constraints zlib -returnCodes error -body { +test zipfs-1.5 {zipfs basics} -constraints zipfs -returnCodes error -body { ::zipfs::mkkey a b c d e f } -result {wrong # args: should be "::zipfs::mkkey password"} -test zipfs-1.5 {zipfs basics} -constraints zlib -returnCodes error -body { +test zipfs-1.6 {zipfs basics} -constraints zipfs -returnCodes error -body { ::zipfs::mkimg a b c d e f } -result {wrong # args: should be "::zipfs::mkimg outfile indir ?strip? ?password? ?infile?"} -test zipfs-1.6 {zipfs basics} -constraints zlib -returnCodes error -body { +test zipfs-1.7 {zipfs basics} -constraints zipfs -returnCodes error -body { ::zipfs::mkzip a b c d e f } -result {wrong # args: should be "::zipfs::mkzip outfile indir ?strip? ?password?"} -test zipfs-1.7 {zipfs basics} -constraints zlib -returnCodes error -body { +test zipfs-1.8 {zipfs basics} -constraints zipfs -returnCodes error -body { ::zipfs::exists a b c d e f } -result {wrong # args: should be "::zipfs::exists filename"} -test zipfs-1.8 {zipfs basics} -constraints zlib -returnCodes error -body { +test zipfs-1.9 {zipfs basics} -constraints zipfs -returnCodes error -body { ::zipfs::info a b c d e f } -result {wrong # args: should be "::zipfs::info filename"} -test zipfs-1.9 {zipfs basics} -constraints zlib -returnCodes error -body { +test zipfs-1.10 {zipfs basics} -constraints zipfs -returnCodes error -body { ::zipfs::list a b c d e f } -result {wrong # args: should be "::zipfs::list ?(-glob|-regexp)? ?pattern?"} +test zipfs-2.1 {zipfs mkzip empty archive} -constraints zipfs -returnCodes error -body { + ::zipfs::mkzip abc.zip $tcl_library/xxxx +} -result {empty archive} + +test zipfs-2.2 {zipfs mkzip} -constraints zipfs -body { + set pwd [pwd] + cd $tcl_library/encoding + ::zipfs::mkzip abc.zip . + ::zipfs::mount abc.zip /abc + ::zipfs::list -glob /abc/cp850.* +} -cleanup { + cd $pwd +} -result {/abc/cp850.enc} + +test zipfs-2.3 {zipfs unmount} -constraints zipfs -body { + ::zipfs::info /abc/cp850.enc +} -result [list $tcl_library/encoding/abc.zip 1090 527 39434] + +test zipfs-2.4 {zipfs unmount} -constraints zipfs -body { + set f [open /abc/cp850.enc] + read $f +} -result {# Encoding file: cp850, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C700FC00E900E200E400E000E500E700EA00EB00E800EF00EE00EC00C400C5 +00C900E600C600F400F600F200FB00F900FF00D600DC00F800A300D800D70192 +00E100ED00F300FA00F100D100AA00BA00BF00AE00AC00BD00BC00A100AB00BB +2591259225932502252400C100C200C000A9256325512557255D00A200A52510 +25142534252C251C2500253C00E300C3255A25542569256625602550256C00A4 +00F000D000CA00CB00C8013100CD00CE00CF2518250C2588258400A600CC2580 +00D300DF00D400D200F500D500B500FE00DE00DA00DB00D900FD00DD00AF00B4 +00AD00B1201700BE00B600A700F700B800B000A800B700B900B300B225A000A0 +} - - +test zipfs-2.5 {zipfs exists} -constraints zipfs -body { + ::zipfs::unmount abc.zip + ::zipfs::exists /abc/cp850.enc +} -cleanup { + file delete abc.zip +} -result 1 ::tcltest::cleanupTests return -- cgit v0.12 From e9795fb40711ccc9e08e1a60232a31797bf8356a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 22 Dec 2015 11:39:28 +0000 Subject: first shot at documentation --- doc/zipfs.3 | 45 +++++++++++++++++++++++++++++++ doc/zipfs.n | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 doc/zipfs.3 create mode 100644 doc/zipfs.n diff --git a/doc/zipfs.3 b/doc/zipfs.3 new file mode 100644 index 0000000..9e031bc --- /dev/null +++ b/doc/zipfs.3 @@ -0,0 +1,45 @@ +'\" +'\" Copyright (c) 2015 Jan Nijtmans +'\" Copyright (c) 2015 Christian Werner +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +.TH Tclzipfs 3 8.7 Tcl "Tcl Library Procedures" +.so man.macros +.BS +.SH NAME +Tclzipfs_Init, Tclzipfs_SafeInit, Tclzipfs_Mount, Tclzipfs_Unmount \- handle ZIP files as VFS +.SH SYNOPSIS +.nf +\fB#include \fR +.sp +int +\fBTclzipfs_Init\fR(\fIinterp\fR) +.sp +int +\fBTclzipfs_SafeInit\fR(\fIinterp\fR) +.sp +int +\fBTclzipfs_Mount\fR(\fIinterp, zipname, mntpt, passwd\fR) +.sp +int +\fBTclzipfs_Unmount\fR(\fIinterp, zipname\fR) +.SH ARGUMENTS +.AS Tcl_Interp **termPtr +.AP Tcl_Interp *interp in +Interpreter in which the zip file system is mounted. The interpreter's result is +modified to hold the result or error message from the script. +.AP "const char" *zipname in +Name of a zipfile. +.AP "const char" *mntpt in +Name of a mount point. +.AP "const char" *passwd in +An (optional) password. +.BE +.SH DESCRIPTION +.PP +TODO +.PP +.SH KEYWORDS +compress, filesystem, zip diff --git a/doc/zipfs.n b/doc/zipfs.n new file mode 100644 index 0000000..16b25e5 --- /dev/null +++ b/doc/zipfs.n @@ -0,0 +1,88 @@ +'\" +'\" Copyright (c) 2015 Jan Nijtmans +'\" Copyright (c) 2015 Christian Werner +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +.TH zipfs n 1.0 Zipfs "zipfs Commands" +.so man.macros +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +zipfs \- Mount and work with ZIP files within Tcl +.SH SYNOPSIS +.nf +\fBpackage require zipfs \fR?\fB1.0\fR? +.sp +\fB::zipfs::exists\fR \fIfilename\fR +\fB::zipfs::find\fR \fIdir\fR +\fB::zipfs::info\fR \fIfilename\fR +\fB::zipfs::list\fR \fB?(-glob|-regexp)?\fR \fI?pattern?\fR +\fB::zipfs::mkimg\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR \fI?infile?\fR +\fB::zipfs::mkkey\fR \fIpassword\fR +\fB::zipfs::mkzip\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR +\fB::zipfs::mount\fR \fI?zipfile\fR \fI?mountpoint?\fR \fI?password?\fR +\fB::zipfs::unmount\fR \fIzipfile\fR +.fi +.BE +.SH DESCRIPTION +.PP +The \fBzipfs\fR package provides tcl with the ability to mount +the contents of a zip file as a virtual file system. +.TP +\fB::zipfs::mount ?\fIzipfile\fR? ?\fImountpoint\fR? +. +The \fB::zipfs::mount\fR procedure mounts a zipfile as a VFS. +After this command executes, files contained in \fIzipfile\fR +will appear to Tcl to be regular files at the mount point. +.RS +.PP +With no \fImountpoint\fR, returns the mount point for \fIzipfile\fR. With no \fIzipfile\fR, +return all zipfile/mount pairs. If \fImountpoint\fR is specified as an empty +string, mount on file path. +.RE +.TP +\fB::zipfs::unmount \fIzipfile\fR +. +Unmounts a previously mounted zip, \fIzipfile\fR. +.TP +\fB::zipfs::exists\fR \fIfilename\fR +. +Return 1 if the given filename exists in the mounted zipfs and 0 if it does not. +.TP +\fB::zipfs::info\fR \fIfile\fR +. +Return information about the given file in the mounted zipfs. The information +consists of (1) the name of the ZIP zipfile that contains the file, (2) the +size of the file after decompressions, (3) the compressed size of the file, +and (4) the offset of the compressed data in the zipfile. +.RS +.PP +Note: querying the mount point gives the start of zip data offset in (4), +which can be used to truncate the zip info off an executable. +.RE +.TP +\fB::zipfs::list\fR \fB?(-glob|-regexp)?\fR \fI?pattern?\fR +. +Return a list of all files in the mounted zipfs. The order of the names +in the list is arbitrary. +.TP +\fB::zipfs::mkimg\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR \fI?infile?\fR +. +TODO +.TP +\fB::zipfs::mkkey\fR \fIpassword\fR +. +TODO +.TP +\fB::zipfs::mkzip\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR +. +TODO +.SH "SEE ALSO" +tclsh(1), file(n), zlib(n) +.SH "KEYWORDS" +compress, filesystem, zip +'\" Local Variables: +'\" mode: nroff +'\" End: -- cgit v0.12 From a1740d976679e2a4928898a1eddd1dad22f4fd16 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 1 Jan 2016 16:50:52 +0000 Subject: Make al zipfs command Tcl_Obj-based --- generic/tclZipfs.h | 2 +- generic/zipfs.c | 284 +++++++++++++++++++++++++++++++++-------------------- 2 files changed, 176 insertions(+), 110 deletions(-) diff --git a/generic/tclZipfs.h b/generic/tclZipfs.h index bcf6cef..01c9e96 100644 --- a/generic/tclZipfs.h +++ b/generic/tclZipfs.h @@ -28,7 +28,7 @@ extern "C" { #endif ZIPFSAPI int Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, - const char *mntpt, const char *passwd); + const char *mntpt, const char *passwd); ZIPFSAPI int Tclzipfs_Unmount(Tcl_Interp *interp, const char *zipname); ZIPFSAPI int Tclzipfs_Init(Tcl_Interp *interp); ZIPFSAPI int Tclzipfs_SafeInit(Tcl_Interp *interp); diff --git a/generic/zipfs.c b/generic/zipfs.c index 1f126ce..55c6d2c 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -91,15 +91,15 @@ * Macros to read and write 16 and 32 bit integers from/to ZIP archives. */ -#define zip_read_int(p) \ +#define zip_read_int(p) \ ((p)[0] | ((p)[1] << 8) | ((p)[2] << 16) | ((p)[3] << 24)) -#define zip_read_short(p) \ +#define zip_read_short(p) \ ((p)[0] | ((p)[1] << 8)) -#define zip_write_int(p, v) \ - (p)[0] = (v) & 0xff; (p)[1] = ((v) >> 8) & 0xff; \ +#define zip_write_int(p, v) \ + (p)[0] = (v) & 0xff; (p)[1] = ((v) >> 8) & 0xff; \ (p)[2] = ((v) >> 16) & 0xff; (p)[3] = ((v) >> 24) & 0xff; -#define zip_write_short(p, v) \ +#define zip_write_short(p, v) \ (p)[0] = (v) & 0xff; (p)[1] = ((v) >> 8) & 0xff; /* @@ -1488,7 +1488,7 @@ done: /* *------------------------------------------------------------------------- * - * ZipFSMountCmd -- + * ZipFSMountObjCmd -- * * This procedure is invoked to process the "zipfs::mount" command. * @@ -1502,23 +1502,23 @@ done: */ static int -ZipFSMountCmd(ClientData clientData, Tcl_Interp *interp, - int argc, const char **argv) +ZipFSMountObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) { - if (argc > 4) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " ?zipfile ?mountpoint? ?password???\"", 0); + if (objc > 4) { + Tcl_WrongNumArgs(interp, 1, objv, + "?zipfile mountpoint password?"); return TCL_ERROR; } - return Tclzipfs_Mount(interp, (argc > 1) ? argv[1] : NULL, - (argc > 2) ? argv[2] : NULL, - (argc > 3) ? argv[3] : NULL); + return Tclzipfs_Mount(interp, (objc > 1) ? Tcl_GetString(objv[1]) : NULL, + (objc > 2) ? Tcl_GetString(objv[2]) : NULL, + (objc > 3) ? Tcl_GetString(objv[3]) : NULL); } /* *------------------------------------------------------------------------- * - * ZipFSUnmountCmd -- + * ZipFSUnmountObjCmd -- * * This procedure is invoked to process the "zipfs::unmount" command. * @@ -1532,21 +1532,20 @@ ZipFSMountCmd(ClientData clientData, Tcl_Interp *interp, */ static int -ZipFSUnmountCmd(ClientData clientData, Tcl_Interp *interp, - int argc, const char **argv) +ZipFSUnmountObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) { - if (argc != 2) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " zipfile\"", (char *) NULL); + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "zipfile"); return TCL_ERROR; } - return Tclzipfs_Unmount(interp, argv[1]); + return Tclzipfs_Unmount(interp, Tcl_GetString(objv[1])); } /* *------------------------------------------------------------------------- * - * ZipFSMountCmd -- + * ZipFSMkKeyObjCmd -- * * This procedure is invoked to process the "zipfs::mkkey" command. * It produces a rotated password to be embedded into an image file. @@ -1561,28 +1560,28 @@ ZipFSUnmountCmd(ClientData clientData, Tcl_Interp *interp, */ static int -ZipFSMkKeyCmd(ClientData clientData, Tcl_Interp *interp, - int argc, const char **argv) +ZipFSMkKeyObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) { int len, i = 0; - char pwbuf[264]; + char *pw, pwbuf[264]; - if (argc != 2) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " password\"", (char *) NULL); + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "password"); return TCL_ERROR; } - len = strlen(argv[1]); + pw = Tcl_GetString(objv[1]); + len = strlen(pw); if (len == 0) { return TCL_OK; } - if ((len > 255) || (strchr(argv[1], 0xff) != NULL)) { + if ((len > 255) || (strchr(pw, 0xff) != NULL)) { Tcl_SetObjResult(interp, Tcl_NewStringObj("illegal password", -1)); return TCL_ERROR; } while (len > 0) { - int ch = argv[1][len - 1]; + int ch = pw[len - 1]; pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; i++; @@ -1928,7 +1927,7 @@ seekErr: /* *------------------------------------------------------------------------- * - * ZipFSMkZipOrImgCmd -- + * ZipFSMkZipOrImgObjCmd -- * * This procedure is creates a new ZIP archive file or image file * given output filename, input directory of files to be archived, @@ -1945,75 +1944,107 @@ seekErr: */ static int -ZipFSMkZipOrImgCmd(ClientData clientData, Tcl_Interp *interp, - int isImg, int argc, const char **argv) +ZipFSMkZipOrImgObjCmd(ClientData clientData, Tcl_Interp *interp, + int isImg, int isList, int objc, Tcl_Obj *const objv[]) { Tcl_Channel out; - int len = 0, pwlen = 0, slen = 0, i, count, ret = TCL_ERROR, largc, pos[3]; - const char **largv; - Tcl_DString ds; + int len = 0, pwlen = 0, slen = 0, i, count, ret = TCL_ERROR, lobjc, pos[3]; + Tcl_Obj **lobjv, *list = NULL; ZipEntry *z; Tcl_HashEntry *hPtr; Tcl_HashSearch search; Tcl_HashTable fileHash; - char pwbuf[264], buf[4096]; + char *strip = NULL, *pw = NULL, pwbuf[264], buf[4096]; - if ((argc < 3) || (argc > (isImg ? 6 : 5))) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " outfile indir ?strip? ?password?", - isImg ? " ?infile?\"" : "\"", (char *) NULL); - return TCL_ERROR; + if (isList) { + if ((objc < 3) || (objc > (isImg ? 5 : 4))) { + Tcl_WrongNumArgs(interp, 1, objv, isImg ? + "outfile inlist ?password infile?" : + "outfile inlist ?password?"); + return TCL_ERROR; + } + } else { + if ((objc < 3) || (objc > (isImg ? 6 : 5))) { + Tcl_WrongNumArgs(interp, 1, objv, isImg ? + "outfile indir ?strip password infile?" : + "outfile indir ?strip password?"); + return TCL_ERROR; + } } pwbuf[0] = 0; - if (argc > 4) { - pwlen = strlen(argv[4]); - if ((pwlen > 255) || (strchr(argv[4], 0xff) != NULL)) { - Tcl_AppendResult(interp, "illegal password", (char *) NULL); + if (objc > (isList ? 3 : 4)) { + pw = Tcl_GetString(objv[isList ? 3 : 4]); + pwlen = strlen(pw); + if ((pwlen > 255) || (strchr(pw, 0xff) != NULL)) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal password", -1)); return TCL_ERROR; } } - Tcl_DStringInit(&ds); - Tcl_DStringAppendElement(&ds, "::zipfs::find"); - Tcl_DStringAppendElement(&ds, argv[2]); - if (Tcl_Eval(interp, Tcl_DStringValue(&ds)) != TCL_OK) { - Tcl_DStringFree(&ds); + if (isList) { + list = objv[2]; + Tcl_IncrRefCount(list); + } else { + Tcl_Obj *cmd[3]; + + cmd[1] = Tcl_NewStringObj("::zipfs::find", -1); + cmd[2] = objv[2]; + cmd[0] = Tcl_NewListObj(2, cmd + 1); + Tcl_IncrRefCount(cmd[0]); + if (Tcl_EvalObjEx(interp, cmd[0], TCL_EVAL_DIRECT) != TCL_OK) { + Tcl_DecrRefCount(cmd[0]); + return TCL_ERROR; + } + Tcl_DecrRefCount(cmd[0]); + list = Tcl_GetObjResult(interp); + Tcl_IncrRefCount(list); + } + if (Tcl_ListObjGetElements(interp, list, &lobjc, &lobjv) != TCL_OK) { + Tcl_DecrRefCount(list); return TCL_ERROR; } - Tcl_DStringFree(&ds); - if (Tcl_SplitList(interp, Tcl_GetStringResult(interp), &largc, &largv) - != TCL_OK) { + if (isList && (lobjc % 2)) { + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, + Tcl_NewStringObj("need even number of elements", -1)); return TCL_ERROR; } - Tcl_ResetResult(interp); - if (largc == 0) { - Tcl_Free((char *) largv); - Tcl_AppendResult(interp, "empty archive", (char *) NULL); + if (lobjc == 0) { + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, Tcl_NewStringObj("empty archive", -1)); return TCL_ERROR; } - out = Tcl_OpenFileChannel(interp, argv[1], "w", 0755); + out = Tcl_OpenFileChannel(interp, Tcl_GetString(objv[1]), "w", 0755); if ((out == NULL) || (Tcl_SetChannelOption(interp, out, "-translation", "binary") != TCL_OK) || (Tcl_SetChannelOption(interp, out, "-encoding", "binary") != TCL_OK)) { + Tcl_DecrRefCount(list); Tcl_Close(interp, out); - Tcl_Free((char *) largv); return TCL_ERROR; } if (isImg) { ZipFile zf0; + const char *imgName; - if (ZipFSOpenArchive(interp, (argc > 5) ? argv[5] : - Tcl_GetNameOfExecutable(), 0, &zf0) != TCL_OK) { + if (isList) { + imgName = (objc > 4) ? Tcl_GetString(objv[4]) : + Tcl_GetNameOfExecutable(); + } else { + imgName = (objc > 5) ? Tcl_GetString(objv[5]) : + Tcl_GetNameOfExecutable(); + } + if (ZipFSOpenArchive(interp, imgName, 0, &zf0) != TCL_OK) { + Tcl_DecrRefCount(list); Tcl_Close(interp, out); - Tcl_Free((char *) largv); return TCL_ERROR; } - if (pwlen && (argc > 4)) { + if ((pw != NULL) && pwlen) { i = 0; len = pwlen; while (len > 0) { - int ch = argv[4][len - 1]; + int ch = pw[len - 1]; pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; i++; @@ -2029,9 +2060,9 @@ ZipFSMkZipOrImgCmd(ClientData clientData, Tcl_Interp *interp, } i = Tcl_Write(out, (char *) zf0.data, zf0.baseoffsp); if (i != zf0.baseoffsp) { - Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); Tcl_Close(interp, out); - Tcl_Free((char *) largv); ZipFSCloseArchive(interp, &zf0); return TCL_ERROR; } @@ -2040,9 +2071,9 @@ ZipFSMkZipOrImgCmd(ClientData clientData, Tcl_Interp *interp, if (len > 0) { i = Tcl_Write(out, pwbuf, len); if (i != len) { - Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); Tcl_Close(interp, out); - Tcl_Free((char *) largv); return TCL_ERROR; } } @@ -2051,18 +2082,25 @@ ZipFSMkZipOrImgCmd(ClientData clientData, Tcl_Interp *interp, } Tcl_InitHashTable(&fileHash, TCL_STRING_KEYS); pos[0] = Tcl_Tell(out); - if (argc > 3) { - slen = strlen(argv[3]); + if (!isList && (objc > 3)) { + strip = Tcl_GetString(objv[3]); + slen = strlen(strip); } - for (i = 0; i < largc; i++) { - const char *name = largv[i]; + for (i = 0; i < lobjc; i += (isList ? 2 : 1)) { + const char *path, *name; - if (slen > 0) { - len = strlen(name); - if ((len <= slen) || (strncmp(argv[3], name, slen) != 0)) { - continue; + path = Tcl_GetString(lobjv[i]); + if (isList) { + name = Tcl_GetString(lobjv[i + 1]); + } else { + name = path; + if (slen > 0) { + len = strlen(name); + if ((len <= slen) || (strncmp(strip, name, slen) != 0)) { + continue; + } + name += slen; } - name += slen; } while (name[0] == '/') { ++name; @@ -2070,23 +2108,28 @@ ZipFSMkZipOrImgCmd(ClientData clientData, Tcl_Interp *interp, if (name[0] == '\0') { continue; } - if (ZipAddFile(interp, largv[i], name, out, - (pwlen > 0) ? argv[4] : NULL, buf, sizeof (buf), &fileHash) - != TCL_OK) { + if (ZipAddFile(interp, path, name, out, pw, buf, sizeof (buf), + &fileHash) != TCL_OK) { goto done; } } pos[1] = Tcl_Tell(out); count = 0; - for (i = 0; i < largc; i++) { - const char *name = largv[i]; + for (i = 0; i < lobjc; i += (isList ? 2 : 1)) { + const char *path, *name; - if (slen > 0) { - len = strlen(name); - if ((len <= slen) || (strncmp(argv[3], name, slen) != 0)) { - continue; + path = Tcl_GetString(lobjv[i]); + if (isList) { + name = Tcl_GetString(lobjv[i + 1]); + } else { + name = path; + if (slen > 0) { + len = strlen(name); + if ((len <= slen) || (strncmp(strip, name, slen) != 0)) { + continue; + } + name += slen; } - name += slen; } while (name[0] == '/') { ++name; @@ -2117,10 +2160,10 @@ ZipFSMkZipOrImgCmd(ClientData clientData, Tcl_Interp *interp, zip_write_short(buf + ZIP_CENTRAL_IATTR_OFFS, 0); zip_write_int(buf + ZIP_CENTRAL_EATTR_OFFS, 0); zip_write_int(buf + ZIP_CENTRAL_LOCALHDR_OFFS, z->offset - pos[0]); - memcpy(buf + ZIP_CENTRAL_HEADER_LEN, z->name, len); - len += ZIP_CENTRAL_HEADER_LEN; - if (Tcl_Write(out, buf, len) != len) { - Tcl_AppendResult(interp, "write error", (char *) NULL); + if ((Tcl_Write(out, buf, ZIP_CENTRAL_HEADER_LEN) != + ZIP_CENTRAL_HEADER_LEN) || + (Tcl_Write(out, z->name, len) != len)) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); goto done; } count++; @@ -2136,14 +2179,18 @@ ZipFSMkZipOrImgCmd(ClientData clientData, Tcl_Interp *interp, zip_write_int(buf + ZIP_CENTRAL_DIRSTART_OFFS, pos[1] - pos[0]); zip_write_short(buf + ZIP_CENTRAL_COMMENTLEN_OFFS, 0); if (Tcl_Write(out, buf, ZIP_CENTRAL_END_LEN) != ZIP_CENTRAL_END_LEN) { - Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); goto done; } Tcl_Flush(out); ret = TCL_OK; done: - Tcl_Free((char *) largv); - Tcl_Close(interp, out); + if (ret == TCL_OK) { + ret = Tcl_Close(interp, out); + } else { + Tcl_Close(interp, out); + } + Tcl_DecrRefCount(list); hPtr = Tcl_FirstHashEntry(&fileHash, &search); while (hPtr != NULL) { z = (ZipEntry *) Tcl_GetHashValue(hPtr); @@ -2158,7 +2205,7 @@ done: /* *------------------------------------------------------------------------- * - * ZipFSMkZipCmd -- + * ZipFSMkZipObjCmd -- * * This procedure is invoked to process the "zipfs::mkzip" command. * See description of ZipFSMkZipOrImgCmd(). @@ -2173,16 +2220,23 @@ done: */ static int -ZipFSMkZipCmd(ClientData clientData, Tcl_Interp *interp, - int argc, const char **argv) +ZipFSMkZipObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + return ZipFSMkZipOrImgObjCmd(clientData, interp, 0, 0, objc, objv); +} + +static int +ZipFSLMkZipObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) { - return ZipFSMkZipOrImgCmd(clientData, interp, 0, argc, argv); + return ZipFSMkZipOrImgObjCmd(clientData, interp, 0, 1, objc, objv); } /* *------------------------------------------------------------------------- * - * ZipFSMkImgCmd -- + * ZipFSMkImgObjCmd -- * * This procedure is invoked to process the "zipfs::mkimg" command. * See description of ZipFSMkZipOrImgCmd(). @@ -2197,10 +2251,17 @@ ZipFSMkZipCmd(ClientData clientData, Tcl_Interp *interp, */ static int -ZipFSMkImgCmd(ClientData clientData, Tcl_Interp *interp, - int argc, const char **argv) +ZipFSMkImgObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + return ZipFSMkZipOrImgObjCmd(clientData, interp, 1, 0, objc, objv); +} + +static int +ZipFSLMkImgObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) { - return ZipFSMkZipOrImgCmd(clientData, interp, 1, argc, argv); + return ZipFSMkZipOrImgObjCmd(clientData, interp, 1, 1, objc, objv); } /* @@ -3938,11 +3999,16 @@ Zipfs_doInit(Tcl_Interp *interp, int safe) Unlock(); Tcl_PkgProvide(interp, "zipfs", "1.0"); if (!safe) { - Tcl_CreateCommand(interp, "::zipfs::mount", ZipFSMountCmd, 0, 0); - Tcl_CreateCommand(interp, "::zipfs::unmount", ZipFSUnmountCmd, 0, 0); - Tcl_CreateCommand(interp, "::zipfs::mkkey", ZipFSMkKeyCmd, 0, 0); - Tcl_CreateCommand(interp, "::zipfs::mkimg", ZipFSMkImgCmd, 0, 0); - Tcl_CreateCommand(interp, "::zipfs::mkzip", ZipFSMkZipCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::zipfs::mount", ZipFSMountObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::zipfs::unmount", + ZipFSUnmountObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::zipfs::mkkey", ZipFSMkKeyObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::zipfs::mkimg", ZipFSMkImgObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::zipfs::mkzip", ZipFSMkZipObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::zipfs::lmkimg", + ZipFSLMkImgObjCmd, 0, 0); + Tcl_CreateObjCommand(interp, "::zipfs::lmkzip", + ZipFSLMkZipObjCmd, 0, 0); Tcl_GlobalEval(interp, findproc); } Tcl_CreateObjCommand(interp, "::zipfs::exists", ZipFSExistsObjCmd, 0, 0); -- cgit v0.12 From f6bb864fc7610c6c893acee7b4a7604a287e6018 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Jan 2016 09:28:55 +0000 Subject: Minor tweaks in documentation/testcases. Don't use deprecated Tcl methods any more --- doc/zipfs.n | 4 ++-- generic/zipfs.c | 10 +++++----- tests/zipfs.test | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/zipfs.n b/doc/zipfs.n index b21ad57..d16c047 100644 --- a/doc/zipfs.n +++ b/doc/zipfs.n @@ -22,7 +22,7 @@ zipfs \- Mount and work with ZIP files within Tcl \fB::zipfs::mkimg\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR \fI?infile?\fR \fB::zipfs::mkkey\fR \fIpassword\fR \fB::zipfs::mkzip\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR -\fB::zipfs::mount\fR \fI?zipfile\fR \fI?mountpoint?\fR \fI?password?\fR +\fB::zipfs::mount\fR \fI?zipfile?\fR \fI?mountpoint?\fR \fI?password?\fR \fB::zipfs::unmount\fR \fIzipfile\fR .fi .BE @@ -94,7 +94,7 @@ Caution: the choice of the \fIindir\fR parameter archive's content. .RE .TP -\fB::zipfs::mount ?\fIzipfile\fR? ?\fImountpoint\fR? +\fB::zipfs::mount ?\fIzipfile\fR? ?\fImountpoint\fR? ?\fIpassword\fR? . The \fB::zipfs::mount\fR command mounts a ZIP archive file as a VFS. After this command executes, files contained in \fIzipfile\fR diff --git a/generic/zipfs.c b/generic/zipfs.c index 55c6d2c..e789e14 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -1507,7 +1507,7 @@ ZipFSMountObjCmd(ClientData clientData, Tcl_Interp *interp, { if (objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, - "?zipfile mountpoint password?"); + "?zipfile? ?mountpoint? ?password?"); return TCL_ERROR; } return Tclzipfs_Mount(interp, (objc > 1) ? Tcl_GetString(objv[1]) : NULL, @@ -1729,7 +1729,7 @@ wrerr: init_keys(passwd, keys, crc32tab); for (i = 0; i < 12 - 2; i++) { - if (Tcl_Eval(interp, "expr int(rand() * 256) % 256") != TCL_OK) { + if (Tcl_EvalEx(interp, "expr int(rand() * 256) % 256", -1, 0) != TCL_OK) { Tcl_AppendResult(interp, "PRNG error", (char *) NULL); Tcl_Close(interp, in); return TCL_ERROR; @@ -1966,8 +1966,8 @@ ZipFSMkZipOrImgObjCmd(ClientData clientData, Tcl_Interp *interp, } else { if ((objc < 3) || (objc > (isImg ? 6 : 5))) { Tcl_WrongNumArgs(interp, 1, objv, isImg ? - "outfile indir ?strip password infile?" : - "outfile indir ?strip password?"); + "outfile indir ?strip? ?password? ?infile?" : + "outfile indir ?strip? ?password?"); return TCL_ERROR; } } @@ -4009,7 +4009,7 @@ Zipfs_doInit(Tcl_Interp *interp, int safe) ZipFSLMkImgObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "::zipfs::lmkzip", ZipFSLMkZipObjCmd, 0, 0); - Tcl_GlobalEval(interp, findproc); + Tcl_EvalEx(interp, findproc, -1, TCL_EVAL_GLOBAL); } Tcl_CreateObjCommand(interp, "::zipfs::exists", ZipFSExistsObjCmd, 0, 0); Tcl_CreateObjCommand(interp, "::zipfs::info", ZipFSInfoObjCmd, 0, 0); diff --git a/tests/zipfs.test b/tests/zipfs.test index 3f53cf8..189461a 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -27,7 +27,7 @@ test zipfs-1.2 {zipfs basics} -constraints zipfs -body { test zipfs-1.3 {zipfs basics} -constraints zipfs -returnCodes error -body { ::zipfs::mount a b c d e f -} -result {wrong # args: should be "::zipfs::mount ?zipfile ?mountpoint? ?password???"} +} -result {wrong # args: should be "::zipfs::mount ?zipfile? ?mountpoint? ?password?"} test zipfs-1.4 {zipfs basics} -constraints zipfs -returnCodes error -body { ::zipfs::unmount a b c d e f -- cgit v0.12 From 22f5c55560bbc2db11df037944b62c294e250928 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 29 Jan 2016 09:17:55 +0000 Subject: Upstream zipfs change and unbreak zipfs test-case --- generic/zipfs.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/generic/zipfs.c b/generic/zipfs.c index c5cb65b..1c96f7b 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -3854,6 +3854,8 @@ Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, objs[1] = TclPathPart(interp, path, TCL_PATH_DIRNAME); if ((objs[1] != NULL) && (Zip_FSAccessProc(objs[1], R_OK) == 0)) { + const char *execName = Tcl_GetNameOfExecutable(); + /* * Shared object is not in ZIP but its path prefix is, * thus try to load from directory where the executable @@ -3861,8 +3863,23 @@ Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, */ TclDecrRefCount(objs[1]); objs[1] = TclPathPart(interp, path, TCL_PATH_TAIL); - objs[0] = TclPathPart(interp, TclGetObjNameOfExecutable(), - TCL_PATH_DIRNAME); + /* + * Get directory name of executable manually to deal + * with cases where [file dirname [info nameofexecutable]] + * is equal to [info nameofexecutable] due to VFS effects. + */ + if (execName != NULL) { + const char *p = strrchr(execName, '/'); + + if (p > execName + 1) { + --p; + objs[0] = Tcl_NewStringObj(execName, p - execName); + } + } + if (objs[0] == NULL) { + objs[0] = TclPathPart(interp, TclGetObjNameOfExecutable(), + TCL_PATH_DIRNAME); + } if (objs[0] != NULL) { altPath = TclJoinPath(2, objs); if (altPath != NULL) { @@ -3980,6 +3997,7 @@ Zipfs_doInit(Tcl_Interp *interp, int safe) }; static const char findproc[] = + "namespace eval zipfs {}\n" "proc ::zipfs::find dir {\n" " set result {}\n" " if {[catch {glob -directory $dir -tails -nocomplain * .*} list]} {\n" @@ -4018,13 +4036,15 @@ Zipfs_doInit(Tcl_Interp *interp, int safe) Tcl_StaticPackage(interp, "zipfs", Tclzipfs_Init, Tclzipfs_SafeInit); } Unlock(); - Tcl_PkgProvide(interp, "zipfs", "1.0"); if (!safe) { Tcl_EvalEx(interp, findproc, -1, TCL_EVAL_GLOBAL); Tcl_LinkVar(interp, "::zipfs::wrmax", (char *) &ZipFS.wrmax, TCL_LINK_INT); } TclMakeEnsemble(interp, "zipfs", safe ? initSafeMap : initMap); + + Tcl_PkgProvide(interp, "zipfs", "1.0"); + return TCL_OK; #else if (interp != NULL) { -- cgit v0.12 From 763f9dff55f828aff79b6899498782220d0678bf Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 2 Mar 2016 15:39:32 +0000 Subject: minor upstream changes --- generic/zipfs.c | 56 +++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/generic/zipfs.c b/generic/zipfs.c index 1c96f7b..c2effac 100644 --- a/generic/zipfs.c +++ b/generic/zipfs.c @@ -294,6 +294,10 @@ static const unsigned int crc32tab[256] = { * POSIX like rwlock functions to support multiple readers * and single writer on internal structs. * + * Limitations: + * - a read lock cannot be promoted to a write lock + * - a write lock may not be nested + * *------------------------------------------------------------------------- */ @@ -1056,7 +1060,7 @@ Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, ZipFile *zf, zf0; ZipEntry *z; Tcl_HashEntry *hPtr; - Tcl_DString ds, fpBuf; + Tcl_DString ds, dsm, fpBuf; unsigned char *q; #if HAS_DRIVES int drive = 0; @@ -1108,11 +1112,21 @@ Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, if (hPtr != NULL) { if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { #if HAS_DRIVES - if (drive == zf->mntdrv) -#endif - { - Tcl_SetObjResult(interp, Tcl_NewStringObj(zf->mntpt, -1)); + if (drive == zf->mntdrv) { + Tcl_Obj *string; + char drvbuf[3]; + + drvbuf[0] = zf->mntdrv; + drvbuf[1] = ':'; + drvbuf[2] = '\0'; + string = Tcl_NewStringObj(drvbuf, 2); + Tcl_AppendToObj(string, zf->mntpt, zf->mntptlen); + Tcl_SetObjResult(interp, string); } +#else + Tcl_SetObjResult(interp, + Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); +#endif } } Unlock(); @@ -1140,6 +1154,17 @@ Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, #else realname = AbsolutePath(zipname, &ds); #endif + /* + * Mount point can come from Tcl_GetNameOfExecutable() + * which sometimes is a relative or otherwise denormalized path. + * But an absolute name is needed as mount point here. + */ + Tcl_DStringInit(&dsm); +#if HAS_DRIVES + mntpt = AbsolutePath(mntpt, &drive, &dsm); +#else + mntpt = AbsolutePath(mntpt, &dsm); +#endif WriteLock(); hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, realname, &isNew); Tcl_DStringSetLength(&ds, 0); @@ -1151,19 +1176,10 @@ Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, } Unlock(); Tcl_DStringFree(&ds); + Tcl_DStringFree(&dsm); ZipFSCloseArchive(interp, &zf0); return TCL_ERROR; } -#if HAS_DRIVES - if ((mntpt[0] != '\0') && (mntpt[1] == ':') && - (strchr(drvletters, mntpt[0]) != NULL)) { - drive = mntpt[0]; - if ((drive >= 'a') && (drive <= 'z')) { - drive -= 'a' - 'A'; - } - mntpt += 2; - } -#endif if (strcmp(mntpt, "/") == 0) { mntpt = ""; } @@ -1174,6 +1190,7 @@ Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, } Unlock(); Tcl_DStringFree(&ds); + Tcl_DStringFree(&dsm); ZipFSCloseArchive(interp, &zf0); return TCL_ERROR; } @@ -1395,9 +1412,10 @@ Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, nextent: q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; } + Unlock(); Tcl_DStringFree(&fpBuf); Tcl_DStringFree(&ds); - Unlock(); + Tcl_DStringFree(&dsm); Tcl_FSMountsChanged(NULL); return TCL_OK; } @@ -1818,9 +1836,9 @@ wrerr: pos[1] = Tcl_Tell(out); if (nbyte - nbytecompr <= 0) { /* - * Compressed file larger than input, - * write it again uncompressed. - */ + * Compressed file larger than input, + * write it again uncompressed. + */ if ((int) Tcl_Seek(in, 0, SEEK_SET) != 0) { goto seekErr; } -- cgit v0.12 From 395d0889b0a2eb0f0626b193ee4dccab8d9882ee Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 30 Mar 2016 07:52:15 +0000 Subject: merge core-8-6-branch --- generic/tclCompCmdsGR.c | 14 +++- library/tzdata/America/Santiago | 169 +++++++++++++++++++++++++++++++++++++- library/tzdata/Antarctica/Palmer | 169 +++++++++++++++++++++++++++++++++++++- library/tzdata/Asia/Baku | 168 ------------------------------------- library/tzdata/Asia/Barnaul | 6 +- library/tzdata/Europe/Kaliningrad | 10 +-- library/tzdata/Europe/Vilnius | 11 +-- library/tzdata/Europe/Volgograd | 6 +- library/tzdata/Pacific/Easter | 169 +++++++++++++++++++++++++++++++++++++- tests/lreplace.test | 11 +++ 10 files changed, 545 insertions(+), 188 deletions(-) diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c index 87ed745..9f430ea 100644 --- a/generic/tclCompCmdsGR.c +++ b/generic/tclCompCmdsGR.c @@ -1488,8 +1488,18 @@ TclCompileLreplaceCmd( return TCL_ERROR; } - if(idx2 != INDEX_END && idx2 >= 0 && idx2 < idx1) { - idx2 = idx1-1; + /* + * Compilation fails when one index is end-based but the other isn't. + * Fixing this will require more bytecodes, but this is a workaround for + * now. [Bug 47ac84309b] + */ + + if ((idx1 <= INDEX_END) != (idx2 <= INDEX_END)) { + return TCL_ERROR; + } + + if (idx2 != INDEX_END && idx2 >= 0 && idx2 < idx1) { + idx2 = idx1 - 1; } /* diff --git a/library/tzdata/America/Santiago b/library/tzdata/America/Santiago index b6d9b38..3a5c0fd 100644 --- a/library/tzdata/America/Santiago +++ b/library/tzdata/America/Santiago @@ -118,5 +118,172 @@ set TZData(:America/Santiago) { {1378612800 -10800 1 CLST} {1398567600 -14400 0 CLT} {1410062400 -10800 1 CLST} - {1430017200 -10800 0 CLT} + {1463281200 -14400 0 CLT} + {1471147200 -10800 1 CLST} + {1494730800 -14400 0 CLT} + {1502596800 -10800 1 CLST} + {1526180400 -14400 0 CLT} + {1534046400 -10800 1 CLST} + {1557630000 -14400 0 CLT} + {1565496000 -10800 1 CLST} + {1589079600 -14400 0 CLT} + {1596945600 -10800 1 CLST} + {1620529200 -14400 0 CLT} + {1629000000 -10800 1 CLST} + {1652583600 -14400 0 CLT} + {1660449600 -10800 1 CLST} + {1684033200 -14400 0 CLT} + {1691899200 -10800 1 CLST} + {1715482800 -14400 0 CLT} + {1723348800 -10800 1 CLST} + {1746932400 -14400 0 CLT} + {1754798400 -10800 1 CLST} + {1778382000 -14400 0 CLT} + {1786248000 -10800 1 CLST} + {1809831600 -14400 0 CLT} + {1818302400 -10800 1 CLST} + {1841886000 -14400 0 CLT} + {1849752000 -10800 1 CLST} + {1873335600 -14400 0 CLT} + {1881201600 -10800 1 CLST} + {1904785200 -14400 0 CLT} + {1912651200 -10800 1 CLST} + {1936234800 -14400 0 CLT} + {1944100800 -10800 1 CLST} + {1967684400 -14400 0 CLT} + {1976155200 -10800 1 CLST} + {1999738800 -14400 0 CLT} + {2007604800 -10800 1 CLST} + {2031188400 -14400 0 CLT} + {2039054400 -10800 1 CLST} + {2062638000 -14400 0 CLT} + {2070504000 -10800 1 CLST} + {2094087600 -14400 0 CLT} + {2101953600 -10800 1 CLST} + {2125537200 -14400 0 CLT} + {2133403200 -10800 1 CLST} + {2156986800 -14400 0 CLT} + {2165457600 -10800 1 CLST} + {2189041200 -14400 0 CLT} + {2196907200 -10800 1 CLST} + {2220490800 -14400 0 CLT} + {2228356800 -10800 1 CLST} + {2251940400 -14400 0 CLT} + {2259806400 -10800 1 CLST} + {2283390000 -14400 0 CLT} + {2291256000 -10800 1 CLST} + {2314839600 -14400 0 CLT} + {2322705600 -10800 1 CLST} + {2346894000 -14400 0 CLT} + {2354760000 -10800 1 CLST} + {2378343600 -14400 0 CLT} + {2386209600 -10800 1 CLST} + {2409793200 -14400 0 CLT} + {2417659200 -10800 1 CLST} + {2441242800 -14400 0 CLT} + {2449108800 -10800 1 CLST} + {2472692400 -14400 0 CLT} + {2480558400 -10800 1 CLST} + {2504142000 -14400 0 CLT} + {2512612800 -10800 1 CLST} + {2536196400 -14400 0 CLT} + {2544062400 -10800 1 CLST} + {2567646000 -14400 0 CLT} + {2575512000 -10800 1 CLST} + {2599095600 -14400 0 CLT} + {2606961600 -10800 1 CLST} + {2630545200 -14400 0 CLT} + {2638411200 -10800 1 CLST} + {2661994800 -14400 0 CLT} + {2669860800 -10800 1 CLST} + {2693444400 -14400 0 CLT} + {2701915200 -10800 1 CLST} + {2725498800 -14400 0 CLT} + {2733364800 -10800 1 CLST} + {2756948400 -14400 0 CLT} + {2764814400 -10800 1 CLST} + {2788398000 -14400 0 CLT} + {2796264000 -10800 1 CLST} + {2819847600 -14400 0 CLT} + {2827713600 -10800 1 CLST} + {2851297200 -14400 0 CLT} + {2859768000 -10800 1 CLST} + {2883351600 -14400 0 CLT} + {2891217600 -10800 1 CLST} + {2914801200 -14400 0 CLT} + {2922667200 -10800 1 CLST} + {2946250800 -14400 0 CLT} + {2954116800 -10800 1 CLST} + {2977700400 -14400 0 CLT} + {2985566400 -10800 1 CLST} + {3009150000 -14400 0 CLT} + {3017016000 -10800 1 CLST} + {3040599600 -14400 0 CLT} + {3049070400 -10800 1 CLST} + {3072654000 -14400 0 CLT} + {3080520000 -10800 1 CLST} + {3104103600 -14400 0 CLT} + {3111969600 -10800 1 CLST} + {3135553200 -14400 0 CLT} + {3143419200 -10800 1 CLST} + {3167002800 -14400 0 CLT} + {3174868800 -10800 1 CLST} + {3198452400 -14400 0 CLT} + {3206318400 -10800 1 CLST} + {3230506800 -14400 0 CLT} + {3238372800 -10800 1 CLST} + {3261956400 -14400 0 CLT} + {3269822400 -10800 1 CLST} + {3293406000 -14400 0 CLT} + {3301272000 -10800 1 CLST} + {3324855600 -14400 0 CLT} + {3332721600 -10800 1 CLST} + {3356305200 -14400 0 CLT} + {3364171200 -10800 1 CLST} + {3387754800 -14400 0 CLT} + {3396225600 -10800 1 CLST} + {3419809200 -14400 0 CLT} + {3427675200 -10800 1 CLST} + {3451258800 -14400 0 CLT} + {3459124800 -10800 1 CLST} + {3482708400 -14400 0 CLT} + {3490574400 -10800 1 CLST} + {3514158000 -14400 0 CLT} + {3522024000 -10800 1 CLST} + {3545607600 -14400 0 CLT} + {3553473600 -10800 1 CLST} + {3577057200 -14400 0 CLT} + {3585528000 -10800 1 CLST} + {3609111600 -14400 0 CLT} + {3616977600 -10800 1 CLST} + {3640561200 -14400 0 CLT} + {3648427200 -10800 1 CLST} + {3672010800 -14400 0 CLT} + {3679876800 -10800 1 CLST} + {3703460400 -14400 0 CLT} + {3711326400 -10800 1 CLST} + {3734910000 -14400 0 CLT} + {3743380800 -10800 1 CLST} + {3766964400 -14400 0 CLT} + {3774830400 -10800 1 CLST} + {3798414000 -14400 0 CLT} + {3806280000 -10800 1 CLST} + {3829863600 -14400 0 CLT} + {3837729600 -10800 1 CLST} + {3861313200 -14400 0 CLT} + {3869179200 -10800 1 CLST} + {3892762800 -14400 0 CLT} + {3900628800 -10800 1 CLST} + {3924212400 -14400 0 CLT} + {3932683200 -10800 1 CLST} + {3956266800 -14400 0 CLT} + {3964132800 -10800 1 CLST} + {3987716400 -14400 0 CLT} + {3995582400 -10800 1 CLST} + {4019166000 -14400 0 CLT} + {4027032000 -10800 1 CLST} + {4050615600 -14400 0 CLT} + {4058481600 -10800 1 CLST} + {4082065200 -14400 0 CLT} + {4089931200 -10800 1 CLST} } diff --git a/library/tzdata/Antarctica/Palmer b/library/tzdata/Antarctica/Palmer index 2c43861..5767985 100644 --- a/library/tzdata/Antarctica/Palmer +++ b/library/tzdata/Antarctica/Palmer @@ -81,5 +81,172 @@ set TZData(:Antarctica/Palmer) { {1378612800 -10800 1 CLST} {1398567600 -14400 0 CLT} {1410062400 -10800 1 CLST} - {1430017200 -10800 0 CLT} + {1463281200 -14400 0 CLT} + {1471147200 -10800 1 CLST} + {1494730800 -14400 0 CLT} + {1502596800 -10800 1 CLST} + {1526180400 -14400 0 CLT} + {1534046400 -10800 1 CLST} + {1557630000 -14400 0 CLT} + {1565496000 -10800 1 CLST} + {1589079600 -14400 0 CLT} + {1596945600 -10800 1 CLST} + {1620529200 -14400 0 CLT} + {1629000000 -10800 1 CLST} + {1652583600 -14400 0 CLT} + {1660449600 -10800 1 CLST} + {1684033200 -14400 0 CLT} + {1691899200 -10800 1 CLST} + {1715482800 -14400 0 CLT} + {1723348800 -10800 1 CLST} + {1746932400 -14400 0 CLT} + {1754798400 -10800 1 CLST} + {1778382000 -14400 0 CLT} + {1786248000 -10800 1 CLST} + {1809831600 -14400 0 CLT} + {1818302400 -10800 1 CLST} + {1841886000 -14400 0 CLT} + {1849752000 -10800 1 CLST} + {1873335600 -14400 0 CLT} + {1881201600 -10800 1 CLST} + {1904785200 -14400 0 CLT} + {1912651200 -10800 1 CLST} + {1936234800 -14400 0 CLT} + {1944100800 -10800 1 CLST} + {1967684400 -14400 0 CLT} + {1976155200 -10800 1 CLST} + {1999738800 -14400 0 CLT} + {2007604800 -10800 1 CLST} + {2031188400 -14400 0 CLT} + {2039054400 -10800 1 CLST} + {2062638000 -14400 0 CLT} + {2070504000 -10800 1 CLST} + {2094087600 -14400 0 CLT} + {2101953600 -10800 1 CLST} + {2125537200 -14400 0 CLT} + {2133403200 -10800 1 CLST} + {2156986800 -14400 0 CLT} + {2165457600 -10800 1 CLST} + {2189041200 -14400 0 CLT} + {2196907200 -10800 1 CLST} + {2220490800 -14400 0 CLT} + {2228356800 -10800 1 CLST} + {2251940400 -14400 0 CLT} + {2259806400 -10800 1 CLST} + {2283390000 -14400 0 CLT} + {2291256000 -10800 1 CLST} + {2314839600 -14400 0 CLT} + {2322705600 -10800 1 CLST} + {2346894000 -14400 0 CLT} + {2354760000 -10800 1 CLST} + {2378343600 -14400 0 CLT} + {2386209600 -10800 1 CLST} + {2409793200 -14400 0 CLT} + {2417659200 -10800 1 CLST} + {2441242800 -14400 0 CLT} + {2449108800 -10800 1 CLST} + {2472692400 -14400 0 CLT} + {2480558400 -10800 1 CLST} + {2504142000 -14400 0 CLT} + {2512612800 -10800 1 CLST} + {2536196400 -14400 0 CLT} + {2544062400 -10800 1 CLST} + {2567646000 -14400 0 CLT} + {2575512000 -10800 1 CLST} + {2599095600 -14400 0 CLT} + {2606961600 -10800 1 CLST} + {2630545200 -14400 0 CLT} + {2638411200 -10800 1 CLST} + {2661994800 -14400 0 CLT} + {2669860800 -10800 1 CLST} + {2693444400 -14400 0 CLT} + {2701915200 -10800 1 CLST} + {2725498800 -14400 0 CLT} + {2733364800 -10800 1 CLST} + {2756948400 -14400 0 CLT} + {2764814400 -10800 1 CLST} + {2788398000 -14400 0 CLT} + {2796264000 -10800 1 CLST} + {2819847600 -14400 0 CLT} + {2827713600 -10800 1 CLST} + {2851297200 -14400 0 CLT} + {2859768000 -10800 1 CLST} + {2883351600 -14400 0 CLT} + {2891217600 -10800 1 CLST} + {2914801200 -14400 0 CLT} + {2922667200 -10800 1 CLST} + {2946250800 -14400 0 CLT} + {2954116800 -10800 1 CLST} + {2977700400 -14400 0 CLT} + {2985566400 -10800 1 CLST} + {3009150000 -14400 0 CLT} + {3017016000 -10800 1 CLST} + {3040599600 -14400 0 CLT} + {3049070400 -10800 1 CLST} + {3072654000 -14400 0 CLT} + {3080520000 -10800 1 CLST} + {3104103600 -14400 0 CLT} + {3111969600 -10800 1 CLST} + {3135553200 -14400 0 CLT} + {3143419200 -10800 1 CLST} + {3167002800 -14400 0 CLT} + {3174868800 -10800 1 CLST} + {3198452400 -14400 0 CLT} + {3206318400 -10800 1 CLST} + {3230506800 -14400 0 CLT} + {3238372800 -10800 1 CLST} + {3261956400 -14400 0 CLT} + {3269822400 -10800 1 CLST} + {3293406000 -14400 0 CLT} + {3301272000 -10800 1 CLST} + {3324855600 -14400 0 CLT} + {3332721600 -10800 1 CLST} + {3356305200 -14400 0 CLT} + {3364171200 -10800 1 CLST} + {3387754800 -14400 0 CLT} + {3396225600 -10800 1 CLST} + {3419809200 -14400 0 CLT} + {3427675200 -10800 1 CLST} + {3451258800 -14400 0 CLT} + {3459124800 -10800 1 CLST} + {3482708400 -14400 0 CLT} + {3490574400 -10800 1 CLST} + {3514158000 -14400 0 CLT} + {3522024000 -10800 1 CLST} + {3545607600 -14400 0 CLT} + {3553473600 -10800 1 CLST} + {3577057200 -14400 0 CLT} + {3585528000 -10800 1 CLST} + {3609111600 -14400 0 CLT} + {3616977600 -10800 1 CLST} + {3640561200 -14400 0 CLT} + {3648427200 -10800 1 CLST} + {3672010800 -14400 0 CLT} + {3679876800 -10800 1 CLST} + {3703460400 -14400 0 CLT} + {3711326400 -10800 1 CLST} + {3734910000 -14400 0 CLT} + {3743380800 -10800 1 CLST} + {3766964400 -14400 0 CLT} + {3774830400 -10800 1 CLST} + {3798414000 -14400 0 CLT} + {3806280000 -10800 1 CLST} + {3829863600 -14400 0 CLT} + {3837729600 -10800 1 CLST} + {3861313200 -14400 0 CLT} + {3869179200 -10800 1 CLST} + {3892762800 -14400 0 CLT} + {3900628800 -10800 1 CLST} + {3924212400 -14400 0 CLT} + {3932683200 -10800 1 CLST} + {3956266800 -14400 0 CLT} + {3964132800 -10800 1 CLST} + {3987716400 -14400 0 CLT} + {3995582400 -10800 1 CLST} + {4019166000 -14400 0 CLT} + {4027032000 -10800 1 CLST} + {4050615600 -14400 0 CLT} + {4058481600 -10800 1 CLST} + {4082065200 -14400 0 CLT} + {4089931200 -10800 1 CLST} } diff --git a/library/tzdata/Asia/Baku b/library/tzdata/Asia/Baku index e50071b..c26a2f5 100644 --- a/library/tzdata/Asia/Baku +++ b/library/tzdata/Asia/Baku @@ -71,172 +71,4 @@ set TZData(:Asia/Baku) { {1414281600 14400 0 AZT} {1427587200 18000 1 AZST} {1445731200 14400 0 AZT} - {1459036800 18000 1 AZST} - {1477785600 14400 0 AZT} - {1490486400 18000 1 AZST} - {1509235200 14400 0 AZT} - {1521936000 18000 1 AZST} - {1540684800 14400 0 AZT} - {1553990400 18000 1 AZST} - {1572134400 14400 0 AZT} - {1585440000 18000 1 AZST} - {1603584000 14400 0 AZT} - {1616889600 18000 1 AZST} - {1635638400 14400 0 AZT} - {1648339200 18000 1 AZST} - {1667088000 14400 0 AZT} - {1679788800 18000 1 AZST} - {1698537600 14400 0 AZT} - {1711843200 18000 1 AZST} - {1729987200 14400 0 AZT} - {1743292800 18000 1 AZST} - {1761436800 14400 0 AZT} - {1774742400 18000 1 AZST} - {1792886400 14400 0 AZT} - {1806192000 18000 1 AZST} - {1824940800 14400 0 AZT} - {1837641600 18000 1 AZST} - {1856390400 14400 0 AZT} - {1869091200 18000 1 AZST} - {1887840000 14400 0 AZT} - {1901145600 18000 1 AZST} - {1919289600 14400 0 AZT} - {1932595200 18000 1 AZST} - {1950739200 14400 0 AZT} - {1964044800 18000 1 AZST} - {1982793600 14400 0 AZT} - {1995494400 18000 1 AZST} - {2014243200 14400 0 AZT} - {2026944000 18000 1 AZST} - {2045692800 14400 0 AZT} - {2058393600 18000 1 AZST} - {2077142400 14400 0 AZT} - {2090448000 18000 1 AZST} - {2108592000 14400 0 AZT} - {2121897600 18000 1 AZST} - {2140041600 14400 0 AZT} - {2153347200 18000 1 AZST} - {2172096000 14400 0 AZT} - {2184796800 18000 1 AZST} - {2203545600 14400 0 AZT} - {2216246400 18000 1 AZST} - {2234995200 14400 0 AZT} - {2248300800 18000 1 AZST} - {2266444800 14400 0 AZT} - {2279750400 18000 1 AZST} - {2297894400 14400 0 AZT} - {2311200000 18000 1 AZST} - {2329344000 14400 0 AZT} - {2342649600 18000 1 AZST} - {2361398400 14400 0 AZT} - {2374099200 18000 1 AZST} - {2392848000 14400 0 AZT} - {2405548800 18000 1 AZST} - {2424297600 14400 0 AZT} - {2437603200 18000 1 AZST} - {2455747200 14400 0 AZT} - {2469052800 18000 1 AZST} - {2487196800 14400 0 AZT} - {2500502400 18000 1 AZST} - {2519251200 14400 0 AZT} - {2531952000 18000 1 AZST} - {2550700800 14400 0 AZT} - {2563401600 18000 1 AZST} - {2582150400 14400 0 AZT} - {2595456000 18000 1 AZST} - {2613600000 14400 0 AZT} - {2626905600 18000 1 AZST} - {2645049600 14400 0 AZT} - {2658355200 18000 1 AZST} - {2676499200 14400 0 AZT} - {2689804800 18000 1 AZST} - {2708553600 14400 0 AZT} - {2721254400 18000 1 AZST} - {2740003200 14400 0 AZT} - {2752704000 18000 1 AZST} - {2771452800 14400 0 AZT} - {2784758400 18000 1 AZST} - {2802902400 14400 0 AZT} - {2816208000 18000 1 AZST} - {2834352000 14400 0 AZT} - {2847657600 18000 1 AZST} - {2866406400 14400 0 AZT} - {2879107200 18000 1 AZST} - {2897856000 14400 0 AZT} - {2910556800 18000 1 AZST} - {2929305600 14400 0 AZT} - {2942006400 18000 1 AZST} - {2960755200 14400 0 AZT} - {2974060800 18000 1 AZST} - {2992204800 14400 0 AZT} - {3005510400 18000 1 AZST} - {3023654400 14400 0 AZT} - {3036960000 18000 1 AZST} - {3055708800 14400 0 AZT} - {3068409600 18000 1 AZST} - {3087158400 14400 0 AZT} - {3099859200 18000 1 AZST} - {3118608000 14400 0 AZT} - {3131913600 18000 1 AZST} - {3150057600 14400 0 AZT} - {3163363200 18000 1 AZST} - {3181507200 14400 0 AZT} - {3194812800 18000 1 AZST} - {3212956800 14400 0 AZT} - {3226262400 18000 1 AZST} - {3245011200 14400 0 AZT} - {3257712000 18000 1 AZST} - {3276460800 14400 0 AZT} - {3289161600 18000 1 AZST} - {3307910400 14400 0 AZT} - {3321216000 18000 1 AZST} - {3339360000 14400 0 AZT} - {3352665600 18000 1 AZST} - {3370809600 14400 0 AZT} - {3384115200 18000 1 AZST} - {3402864000 14400 0 AZT} - {3415564800 18000 1 AZST} - {3434313600 14400 0 AZT} - {3447014400 18000 1 AZST} - {3465763200 14400 0 AZT} - {3479068800 18000 1 AZST} - {3497212800 14400 0 AZT} - {3510518400 18000 1 AZST} - {3528662400 14400 0 AZT} - {3541968000 18000 1 AZST} - {3560112000 14400 0 AZT} - {3573417600 18000 1 AZST} - {3592166400 14400 0 AZT} - {3604867200 18000 1 AZST} - {3623616000 14400 0 AZT} - {3636316800 18000 1 AZST} - {3655065600 14400 0 AZT} - {3668371200 18000 1 AZST} - {3686515200 14400 0 AZT} - {3699820800 18000 1 AZST} - {3717964800 14400 0 AZT} - {3731270400 18000 1 AZST} - {3750019200 14400 0 AZT} - {3762720000 18000 1 AZST} - {3781468800 14400 0 AZT} - {3794169600 18000 1 AZST} - {3812918400 14400 0 AZT} - {3825619200 18000 1 AZST} - {3844368000 14400 0 AZT} - {3857673600 18000 1 AZST} - {3875817600 14400 0 AZT} - {3889123200 18000 1 AZST} - {3907267200 14400 0 AZT} - {3920572800 18000 1 AZST} - {3939321600 14400 0 AZT} - {3952022400 18000 1 AZST} - {3970771200 14400 0 AZT} - {3983472000 18000 1 AZST} - {4002220800 14400 0 AZT} - {4015526400 18000 1 AZST} - {4033670400 14400 0 AZT} - {4046976000 18000 1 AZST} - {4065120000 14400 0 AZT} - {4078425600 18000 1 AZST} - {4096569600 14400 0 AZT} } diff --git a/library/tzdata/Asia/Barnaul b/library/tzdata/Asia/Barnaul index 8072e34..f6a45da 100644 --- a/library/tzdata/Asia/Barnaul +++ b/library/tzdata/Asia/Barnaul @@ -24,8 +24,10 @@ set TZData(:Asia/Barnaul) { {622580400 25200 0 +07} {638305200 28800 1 +08} {654634800 25200 0 +07} - {670359600 28800 1 +08} - {686084400 25200 0 +07} + {670359600 21600 0 +07} + {670363200 25200 1 +07} + {686088000 21600 0 +06} + {695764800 25200 0 +08} {701798400 28800 1 +08} {717519600 25200 0 +07} {733258800 28800 1 +08} diff --git a/library/tzdata/Europe/Kaliningrad b/library/tzdata/Europe/Kaliningrad index d03f7d0..32d7aaa 100644 --- a/library/tzdata/Europe/Kaliningrad +++ b/library/tzdata/Europe/Kaliningrad @@ -35,11 +35,11 @@ set TZData(:Europe/Kaliningrad) { {559695600 10800 0 MSK} {575420400 14400 1 MSD} {591145200 10800 0 MSK} - {606870000 14400 1 MSD} - {622594800 10800 0 MSK} - {638319600 14400 1 MSD} - {654649200 10800 0 MSK} - {670374000 7200 0 EEMMTT} + {606870000 7200 0 EEMMTT} + {606873600 10800 1 EEST} + {622598400 7200 0 EET} + {638323200 10800 1 EEST} + {654652800 7200 0 EET} {670377600 10800 1 EEST} {686102400 7200 0 EET} {701816400 10800 1 EEST} diff --git a/library/tzdata/Europe/Vilnius b/library/tzdata/Europe/Vilnius index 62d5d87..5e73150 100644 --- a/library/tzdata/Europe/Vilnius +++ b/library/tzdata/Europe/Vilnius @@ -30,11 +30,12 @@ set TZData(:Europe/Vilnius) { {559695600 10800 0 MSK} {575420400 14400 1 MSD} {591145200 10800 0 MSK} - {606870000 14400 1 MSD} - {622594800 10800 0 MSK} - {638319600 14400 1 MSD} - {654649200 10800 0 MSK} - {670374000 10800 1 EEST} + {606870000 7200 0 EEMMTT} + {606873600 10800 1 EEST} + {622598400 7200 0 EET} + {638323200 10800 1 EEST} + {654652800 7200 0 EET} + {670377600 10800 1 EEST} {686102400 7200 0 EET} {701827200 10800 1 EEST} {717552000 7200 0 EET} diff --git a/library/tzdata/Europe/Volgograd b/library/tzdata/Europe/Volgograd index d71fb0b..ef33d4b 100644 --- a/library/tzdata/Europe/Volgograd +++ b/library/tzdata/Europe/Volgograd @@ -20,9 +20,9 @@ set TZData(:Europe/Volgograd) { {528242400 14400 0 VOLT} {543967200 18000 1 VOLST} {559692000 14400 0 VOLT} - {575416800 18000 1 VOLST} - {591141600 14400 0 VOLT} - {606866400 10800 0 VOLMMTT} + {575416800 10800 0 VOLMMTT} + {575420400 14400 1 VOLST} + {591145200 10800 0 VOLT} {606870000 14400 1 VOLST} {622594800 10800 0 VOLT} {638319600 14400 1 VOLST} diff --git a/library/tzdata/Pacific/Easter b/library/tzdata/Pacific/Easter index 4b45ba2..ef0f2d5 100644 --- a/library/tzdata/Pacific/Easter +++ b/library/tzdata/Pacific/Easter @@ -97,5 +97,172 @@ set TZData(:Pacific/Easter) { {1378612800 -18000 1 EASST} {1398567600 -21600 0 EAST} {1410062400 -18000 1 EASST} - {1430017200 -18000 0 EAST} + {1463281200 -21600 0 EAST} + {1471147200 -18000 1 EASST} + {1494730800 -21600 0 EAST} + {1502596800 -18000 1 EASST} + {1526180400 -21600 0 EAST} + {1534046400 -18000 1 EASST} + {1557630000 -21600 0 EAST} + {1565496000 -18000 1 EASST} + {1589079600 -21600 0 EAST} + {1596945600 -18000 1 EASST} + {1620529200 -21600 0 EAST} + {1629000000 -18000 1 EASST} + {1652583600 -21600 0 EAST} + {1660449600 -18000 1 EASST} + {1684033200 -21600 0 EAST} + {1691899200 -18000 1 EASST} + {1715482800 -21600 0 EAST} + {1723348800 -18000 1 EASST} + {1746932400 -21600 0 EAST} + {1754798400 -18000 1 EASST} + {1778382000 -21600 0 EAST} + {1786248000 -18000 1 EASST} + {1809831600 -21600 0 EAST} + {1818302400 -18000 1 EASST} + {1841886000 -21600 0 EAST} + {1849752000 -18000 1 EASST} + {1873335600 -21600 0 EAST} + {1881201600 -18000 1 EASST} + {1904785200 -21600 0 EAST} + {1912651200 -18000 1 EASST} + {1936234800 -21600 0 EAST} + {1944100800 -18000 1 EASST} + {1967684400 -21600 0 EAST} + {1976155200 -18000 1 EASST} + {1999738800 -21600 0 EAST} + {2007604800 -18000 1 EASST} + {2031188400 -21600 0 EAST} + {2039054400 -18000 1 EASST} + {2062638000 -21600 0 EAST} + {2070504000 -18000 1 EASST} + {2094087600 -21600 0 EAST} + {2101953600 -18000 1 EASST} + {2125537200 -21600 0 EAST} + {2133403200 -18000 1 EASST} + {2156986800 -21600 0 EAST} + {2165457600 -18000 1 EASST} + {2189041200 -21600 0 EAST} + {2196907200 -18000 1 EASST} + {2220490800 -21600 0 EAST} + {2228356800 -18000 1 EASST} + {2251940400 -21600 0 EAST} + {2259806400 -18000 1 EASST} + {2283390000 -21600 0 EAST} + {2291256000 -18000 1 EASST} + {2314839600 -21600 0 EAST} + {2322705600 -18000 1 EASST} + {2346894000 -21600 0 EAST} + {2354760000 -18000 1 EASST} + {2378343600 -21600 0 EAST} + {2386209600 -18000 1 EASST} + {2409793200 -21600 0 EAST} + {2417659200 -18000 1 EASST} + {2441242800 -21600 0 EAST} + {2449108800 -18000 1 EASST} + {2472692400 -21600 0 EAST} + {2480558400 -18000 1 EASST} + {2504142000 -21600 0 EAST} + {2512612800 -18000 1 EASST} + {2536196400 -21600 0 EAST} + {2544062400 -18000 1 EASST} + {2567646000 -21600 0 EAST} + {2575512000 -18000 1 EASST} + {2599095600 -21600 0 EAST} + {2606961600 -18000 1 EASST} + {2630545200 -21600 0 EAST} + {2638411200 -18000 1 EASST} + {2661994800 -21600 0 EAST} + {2669860800 -18000 1 EASST} + {2693444400 -21600 0 EAST} + {2701915200 -18000 1 EASST} + {2725498800 -21600 0 EAST} + {2733364800 -18000 1 EASST} + {2756948400 -21600 0 EAST} + {2764814400 -18000 1 EASST} + {2788398000 -21600 0 EAST} + {2796264000 -18000 1 EASST} + {2819847600 -21600 0 EAST} + {2827713600 -18000 1 EASST} + {2851297200 -21600 0 EAST} + {2859768000 -18000 1 EASST} + {2883351600 -21600 0 EAST} + {2891217600 -18000 1 EASST} + {2914801200 -21600 0 EAST} + {2922667200 -18000 1 EASST} + {2946250800 -21600 0 EAST} + {2954116800 -18000 1 EASST} + {2977700400 -21600 0 EAST} + {2985566400 -18000 1 EASST} + {3009150000 -21600 0 EAST} + {3017016000 -18000 1 EASST} + {3040599600 -21600 0 EAST} + {3049070400 -18000 1 EASST} + {3072654000 -21600 0 EAST} + {3080520000 -18000 1 EASST} + {3104103600 -21600 0 EAST} + {3111969600 -18000 1 EASST} + {3135553200 -21600 0 EAST} + {3143419200 -18000 1 EASST} + {3167002800 -21600 0 EAST} + {3174868800 -18000 1 EASST} + {3198452400 -21600 0 EAST} + {3206318400 -18000 1 EASST} + {3230506800 -21600 0 EAST} + {3238372800 -18000 1 EASST} + {3261956400 -21600 0 EAST} + {3269822400 -18000 1 EASST} + {3293406000 -21600 0 EAST} + {3301272000 -18000 1 EASST} + {3324855600 -21600 0 EAST} + {3332721600 -18000 1 EASST} + {3356305200 -21600 0 EAST} + {3364171200 -18000 1 EASST} + {3387754800 -21600 0 EAST} + {3396225600 -18000 1 EASST} + {3419809200 -21600 0 EAST} + {3427675200 -18000 1 EASST} + {3451258800 -21600 0 EAST} + {3459124800 -18000 1 EASST} + {3482708400 -21600 0 EAST} + {3490574400 -18000 1 EASST} + {3514158000 -21600 0 EAST} + {3522024000 -18000 1 EASST} + {3545607600 -21600 0 EAST} + {3553473600 -18000 1 EASST} + {3577057200 -21600 0 EAST} + {3585528000 -18000 1 EASST} + {3609111600 -21600 0 EAST} + {3616977600 -18000 1 EASST} + {3640561200 -21600 0 EAST} + {3648427200 -18000 1 EASST} + {3672010800 -21600 0 EAST} + {3679876800 -18000 1 EASST} + {3703460400 -21600 0 EAST} + {3711326400 -18000 1 EASST} + {3734910000 -21600 0 EAST} + {3743380800 -18000 1 EASST} + {3766964400 -21600 0 EAST} + {3774830400 -18000 1 EASST} + {3798414000 -21600 0 EAST} + {3806280000 -18000 1 EASST} + {3829863600 -21600 0 EAST} + {3837729600 -18000 1 EASST} + {3861313200 -21600 0 EAST} + {3869179200 -18000 1 EASST} + {3892762800 -21600 0 EAST} + {3900628800 -18000 1 EASST} + {3924212400 -21600 0 EAST} + {3932683200 -18000 1 EASST} + {3956266800 -21600 0 EAST} + {3964132800 -18000 1 EASST} + {3987716400 -21600 0 EAST} + {3995582400 -18000 1 EASST} + {4019166000 -21600 0 EAST} + {4027032000 -18000 1 EASST} + {4050615600 -21600 0 EAST} + {4058481600 -18000 1 EASST} + {4082065200 -21600 0 EAST} + {4089931200 -18000 1 EASST} } diff --git a/tests/lreplace.test b/tests/lreplace.test index e66a331..55a36a8 100644 --- a/tests/lreplace.test +++ b/tests/lreplace.test @@ -181,6 +181,17 @@ test lreplace-4.11 {lreplace end index first} { test lreplace-4.12 {lreplace end index first} { lreplace {0 1 2 3 4} end-2 2 a b c } {0 1 a b c 3 4} + +test lreplace-5.1 {compiled lreplace: Bug 47ac84309b} { + apply {x { + lreplace $x end 0 + }} {a b c} +} {a b c} +test lreplace-5.2 {compiled lreplace: Bug 47ac84309b} { + apply {x { + lreplace $x end 0 A + }} {a b c} +} {a b A c} # cleanup catch {unset foo} -- cgit v0.12 From 824b71f9590840c9ff84285235c46b111cee31a5 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Wed, 14 Sep 2016 13:33:32 +0000 Subject: Beginning work in earnest on Tip#430 and Tip#453 Renamed zipfs.c to tclZipfs.c. Eliminated tclZipfs.h. Removed the bootstrap introduced by Odie/Androwish. With zipfs in the core one only needs to specify the TclPreInitScript The project at least builds on OSX. Working on Windows under MSYS/MinGW next Added a local snapshot of practcl. --- generic/tclBasic.c | 3 + generic/tclIOUtil.c | 34 - generic/tclInt.h | 4 + generic/tclZipfs.c | 3915 ++++++++++++++++++++++++++++++++++++++ generic/tclZipfs.h | 48 - generic/zipfs.c | 4229 ------------------------------------------ library/practcl/pkgIndex.tcl | 11 + library/practcl/practcl.tcl | 4000 +++++++++++++++++++++++++++++++++++++++ unix/Makefile.in | 8 +- unix/tclAppInit.c | 18 +- win/Makefile.in | 15 +- win/makefile.vc | 2 +- win/tclAppInit.c | 17 +- 13 files changed, 7954 insertions(+), 4350 deletions(-) create mode 100644 generic/tclZipfs.c delete mode 100644 generic/tclZipfs.h delete mode 100644 generic/zipfs.c create mode 100644 library/practcl/pkgIndex.tcl create mode 100644 library/practcl/practcl.tcl diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 53023d8..3550d93 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -982,6 +982,9 @@ Tcl_CreateInterp(void) if (TclZlibInit(interp) != TCL_OK) { Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp))); } + if (TclZipfsInit(interp) != TCL_OK) { + Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp))); + } #endif TOP_CB(iPtr) = NULL; diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index e8fce01..397c3b1 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -190,8 +190,6 @@ const Tcl_Filesystem tclNativeFilesystem = { TclpObjChdir }; -MODULE_SCOPE Tcl_Filesystem zipfsFilesystem; - /* * Define the tail of the linked list. Note that for unconventional uses of * Tcl without a native filesystem, we may in the future wish to modify the @@ -1412,22 +1410,6 @@ TclFSNormalizeToUniquePath( Claim(); for (fsRecPtr=firstFsRecPtr; fsRecPtr!=NULL; fsRecPtr=fsRecPtr->nextPtr) { - if (fsRecPtr->fsPtr == &zipfsFilesystem) { - ClientData clientData = NULL; - /* - * Allow mounted zipfs filesystem to overtake entire normalisation. - * This is needed on unix for mounts on symlinks right below root. - */ - - if (fsRecPtr->fsPtr->pathInFilesystemProc != NULL) { - if (fsRecPtr->fsPtr->pathInFilesystemProc(pathPtr, - &clientData)!=-1) { - TclFSSetPathDetails(pathPtr, fsRecPtr->fsPtr, clientData); - break; - } - } - continue; - } if (fsRecPtr->fsPtr != &tclNativeFilesystem) { continue; } @@ -1452,9 +1434,6 @@ TclFSNormalizeToUniquePath( if (fsRecPtr->fsPtr == &tclNativeFilesystem) { continue; } - if (fsRecPtr->fsPtr == &zipfsFilesystem) { - continue; - } if (fsRecPtr->fsPtr->normalizePathProc != NULL) { startAt = fsRecPtr->fsPtr->normalizePathProc(interp, pathPtr, @@ -2935,19 +2914,6 @@ Tcl_FSChdir( } fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); - - if ((fsPtr != NULL) && (fsPtr != &tclNativeFilesystem)) { - /* - * Watch out for tilde substitution. - * Only valid in native filesystem. - */ - char *name = Tcl_GetString(pathPtr); - - if ((name != NULL) && (*name == '~')) { - fsPtr = &tclNativeFilesystem; - } - } - if (fsPtr != NULL) { if (fsPtr->chdirProc != NULL) { /* diff --git a/generic/tclInt.h b/generic/tclInt.h index da1b5c5..aaffd34 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3177,6 +3177,10 @@ MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks); #endif MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp); +MODULE_SCOPE int TclZipfsInit(Tcl_Interp *interp); +MODULE_SCOPE int TclZipfsMount(Tcl_Interp *interp, const char *zipname, + const char *mntpt, const char *passwd); +MODULE_SCOPE int TclZipfsUnmount(Tcl_Interp *interp, const char *zipname); MODULE_SCOPE void * TclpThreadCreateKey(void); MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr); MODULE_SCOPE void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr); diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c new file mode 100644 index 0000000..01d46c6 --- /dev/null +++ b/generic/tclZipfs.c @@ -0,0 +1,3915 @@ +/* + * tclZipfs.c -- + * + * Implementation of the ZIP filesystem used in TIP 430 + * Adapted from the implentation for AndroWish. + * + * Coptright (c) 2016 Sean Woods + * Copyright (c) 2013-2015 Christian Werner + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#include "tclInt.h" +#include "tclFileSystem.h" + +#if !defined(_WIN32) && !defined(_WIN64) +#include +#endif +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_ZLIB +#include "zlib.h" +#include "zcrypt.h" + +#define ZIPFS_VOLUME "zipfs:/" +#define ZIPFS_VOLUME_LEN 7 + +/* + * Various constants and offsets found in ZIP archive files + */ + +#define ZIP_SIG_LEN 4 + +/* Local header of ZIP archive member (at very beginning of each member). */ +#define ZIP_LOCAL_HEADER_SIG 0x04034b50 +#define ZIP_LOCAL_HEADER_LEN 30 +#define ZIP_LOCAL_SIG_OFFS 0 +#define ZIP_LOCAL_VERSION_OFFS 4 +#define ZIP_LOCAL_FLAGS_OFFS 6 +#define ZIP_LOCAL_COMPMETH_OFFS 8 +#define ZIP_LOCAL_MTIME_OFFS 10 +#define ZIP_LOCAL_MDATE_OFFS 12 +#define ZIP_LOCAL_CRC32_OFFS 14 +#define ZIP_LOCAL_COMPLEN_OFFS 18 +#define ZIP_LOCAL_UNCOMPLEN_OFFS 22 +#define ZIP_LOCAL_PATHLEN_OFFS 26 +#define ZIP_LOCAL_EXTRALEN_OFFS 28 + +/* Central header of ZIP archive member at end of ZIP file. */ +#define ZIP_CENTRAL_HEADER_SIG 0x02014b50 +#define ZIP_CENTRAL_HEADER_LEN 46 +#define ZIP_CENTRAL_SIG_OFFS 0 +#define ZIP_CENTRAL_VERSIONMADE_OFFS 4 +#define ZIP_CENTRAL_VERSION_OFFS 6 +#define ZIP_CENTRAL_FLAGS_OFFS 8 +#define ZIP_CENTRAL_COMPMETH_OFFS 10 +#define ZIP_CENTRAL_MTIME_OFFS 12 +#define ZIP_CENTRAL_MDATE_OFFS 14 +#define ZIP_CENTRAL_CRC32_OFFS 16 +#define ZIP_CENTRAL_COMPLEN_OFFS 20 +#define ZIP_CENTRAL_UNCOMPLEN_OFFS 24 +#define ZIP_CENTRAL_PATHLEN_OFFS 28 +#define ZIP_CENTRAL_EXTRALEN_OFFS 30 +#define ZIP_CENTRAL_FCOMMENTLEN_OFFS 32 +#define ZIP_CENTRAL_DISKFILE_OFFS 34 +#define ZIP_CENTRAL_IATTR_OFFS 36 +#define ZIP_CENTRAL_EATTR_OFFS 38 +#define ZIP_CENTRAL_LOCALHDR_OFFS 42 + +/* Central end signature at very end of ZIP file. */ +#define ZIP_CENTRAL_END_SIG 0x06054b50 +#define ZIP_CENTRAL_END_LEN 22 +#define ZIP_CENTRAL_END_SIG_OFFS 0 +#define ZIP_CENTRAL_DISKNO_OFFS 4 +#define ZIP_CENTRAL_DISKDIR_OFFS 6 +#define ZIP_CENTRAL_ENTS_OFFS 8 +#define ZIP_CENTRAL_TOTALENTS_OFFS 10 +#define ZIP_CENTRAL_DIRSIZE_OFFS 12 +#define ZIP_CENTRAL_DIRSTART_OFFS 16 +#define ZIP_CENTRAL_COMMENTLEN_OFFS 20 + +#define ZIP_MIN_VERSION 20 +#define ZIP_COMPMETH_STORED 0 +#define ZIP_COMPMETH_DEFLATED 8 + +#define ZIP_PASSWORD_END_SIG 0x5a5a4b50 + +/* + * Macros to read and write 16 and 32 bit integers from/to ZIP archives. + */ + +#define zip_read_int(p) \ + ((p)[0] | ((p)[1] << 8) | ((p)[2] << 16) | ((p)[3] << 24)) +#define zip_read_short(p) \ + ((p)[0] | ((p)[1] << 8)) + +#define zip_write_int(p, v) \ + (p)[0] = (v) & 0xff; (p)[1] = ((v) >> 8) & 0xff; \ + (p)[2] = ((v) >> 16) & 0xff; (p)[3] = ((v) >> 24) & 0xff; +#define zip_write_short(p, v) \ + (p)[0] = (v) & 0xff; (p)[1] = ((v) >> 8) & 0xff; + +/* + * Windows drive letters. + */ + +#if defined(_WIN32) || defined(_WIN64) +#define HAS_DRIVES 1 +static const char drvletters[] = + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; +#else +#define HAS_DRIVES 0 +#endif + +/* + * Mutex to protect localtime(3) when no reentrant version available. + */ + +#if !defined(_WIN32) && !defined(_WIN64) +#ifndef HAVE_LOCALTIME_R +#ifdef TCL_THREADS +TCL_DECLARE_MUTEX(localtimeMutex) +#endif +#endif +#endif + +/* + * In-core description of mounted ZIP archive file. + */ + +typedef struct ZipFile { + char *name; /* Archive name */ + Tcl_Channel chan; /* Channel handle or NULL */ + unsigned char *data; /* Memory mapped or malloc'ed file */ + long length; /* Length of memory mapped file */ + unsigned char *tofree; /* Non-NULL if malloc'ed file */ + int nfiles; /* Number of files in archive */ + int baseoffs; /* Archive start */ + int baseoffsp; /* Password start */ + int centoffs; /* Archive directory start */ + char pwbuf[264]; /* Password buffer */ +#if defined(_WIN32) || defined(_WIN64) + HANDLE mh; +#endif + int nopen; /* Number of open files on archive */ + struct ZipEntry *entries; /* List of files in archive */ + struct ZipEntry *topents; /* List of top-level dirs in archive */ +#if HAS_DRIVES + int mntdrv; /* Drive letter of mount point */ +#endif + int mntptlen; /* Length of mount point */ + char mntpt[1]; /* Mount point */ +} ZipFile; + +/* + * In-core description of file contained in mounted ZIP archive. + */ + +typedef struct ZipEntry { + char *name; /* The full pathname of the virtual file */ + ZipFile *zipfile; /* The ZIP file holding this virtual file */ + long offset; /* Data offset into memory mapped ZIP file */ + int nbyte; /* Uncompressed size of the virtual file */ + int nbytecompr; /* Compressed size of the virtual file */ + int cmeth; /* Compress method */ + int isdir; /* Set to 1 if directory */ + int depth; /* Number of slashes in path. */ + int crc32; /* CRC-32 */ + int timestamp; /* Modification time */ + int isenc; /* True if data is encrypted */ + unsigned char *data; /* File data if written */ + struct ZipEntry *next; /* Next file in the same archive */ + struct ZipEntry *tnext; /* Next top-level dir in archive */ +} ZipEntry; + +/* + * File channel for file contained in mounted ZIP archive. + */ + +typedef struct ZipChannel { + ZipFile *zipfile; /* The ZIP file holding this channel */ + ZipEntry *zipentry; /* Pointer back to virtual file */ + unsigned long nmax; /* Max. size for write */ + unsigned long nbyte; /* Number of bytes of uncompressed data */ + unsigned long nread; /* Pos of next byte to be read from the channel */ + unsigned char *ubuf; /* Pointer to the uncompressed data */ + int iscompr; /* True if data is compressed */ + int isdir; /* Set to 1 if directory */ + int isenc; /* True if data is encrypted */ + int iswr; /* True if open for writing */ + unsigned long keys[3]; /* Key for decryption */ +} ZipChannel; + +/* + * Global variables. + * + * Most are kept in single ZipFS struct. When build with threading + * support this struct is protected by the ZipFSMutex (see below). + * + * The "fileHash" component is the process wide global table of all known + * ZIP archive members in all mounted ZIP archives. + * + * The "zipHash" components is the process wide global table of all mounted + * ZIP archive files. + */ + +static struct { + int initialized; /* True when initialized */ + int lock; /* RW lock, see below */ + int waiters; /* RW lock, see below */ + int wrmax; /* Maximum write size of a file */ + int idCount; /* Counter for channel names */ + Tcl_HashTable fileHash; /* File name to ZipEntry mapping */ + Tcl_HashTable zipHash; /* Mount to ZipFile mapping */ +} ZipFS = { + 0, 0, 0, 0, 0, +}; + +/* + * For password rotation. + */ + +static const char pwrot[16] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0 +}; + +/* + * Table to compute CRC32. + */ + +static const unsigned int crc32tab[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, + 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, + 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, + 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, + 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, + 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, + 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, + 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, + 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, + 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, + 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, + 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, + 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, + 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, + 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, + 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, + 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, + 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, + 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, + 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, + 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, + 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, + 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, + 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, + 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, + 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, + 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, + 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, + 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, + 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, + 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, + 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, + 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, + 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, + 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, + 0x2d02ef8d, +}; + +/* + *------------------------------------------------------------------------- + * + * ReadLock, WriteLock, Unlock -- + * + * POSIX like rwlock functions to support multiple readers + * and single writer on internal structs. + * + * Limitations: + * - a read lock cannot be promoted to a write lock + * - a write lock may not be nested + * + *------------------------------------------------------------------------- + */ + +TCL_DECLARE_MUTEX(ZipFSMutex) + +#ifdef TCL_THREADS + +static Tcl_Condition ZipFSCond; + +static void +ReadLock(void) +{ + Tcl_MutexLock(&ZipFSMutex); + while (ZipFS.lock < 0) { + ZipFS.waiters++; + Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, NULL); + ZipFS.waiters--; + } + ZipFS.lock++; + Tcl_MutexUnlock(&ZipFSMutex); +} + +static void +WriteLock(void) +{ + Tcl_MutexLock(&ZipFSMutex); + while (ZipFS.lock != 0) { + ZipFS.waiters++; + Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, NULL); + ZipFS.waiters--; + } + ZipFS.lock = -1; + Tcl_MutexUnlock(&ZipFSMutex); +} + +static void +Unlock(void) +{ + Tcl_MutexLock(&ZipFSMutex); + if (ZipFS.lock > 0) { + --ZipFS.lock; + } else if (ZipFS.lock < 0) { + ZipFS.lock = 0; + } + if ((ZipFS.lock == 0) && (ZipFS.waiters > 0)) { + Tcl_ConditionNotify(&ZipFSCond); + } + Tcl_MutexUnlock(&ZipFSMutex); +} + +#else + +#define ReadLock() do {} while (0) +#define WriteLock() do {} while (0) +#define Unlock() do {} while (0) + +#endif + +/* + *------------------------------------------------------------------------- + * + * DosTimeDate, ToDosTime, ToDosDate -- + * + * Functions to perform conversions between DOS time stamps + * and POSIX time_t. + * + *------------------------------------------------------------------------- + */ + +static time_t +DosTimeDate(int dosDate, int dosTime) +{ + struct tm tm; + time_t ret; + + memset(&tm, 0, sizeof (tm)); + tm.tm_year = (((dosDate & 0xfe00) >> 9) + 80); + tm.tm_mon = ((dosDate & 0x1e0) >> 5) - 1; + tm.tm_mday = dosDate & 0x1f; + tm.tm_hour = (dosTime & 0xf800) >> 11; + tm.tm_min = (dosTime & 0x7e) >> 5; + tm.tm_sec = (dosTime & 0x1f) << 1; + ret = mktime(&tm); + if (ret == (time_t) -1) { + /* fallback to 1980-01-01T00:00:00+00:00 (DOS epoch) */ + ret = (time_t) 315532800; + } + return ret; +} + +static int +ToDosTime(time_t when) +{ + struct tm *tmp, tm; + +#ifdef TCL_THREADS +#if defined(_WIN32) || defined(_WIN64) + /* Win32 uses thread local storage */ + tmp = localtime(&when); + tm = *tmp; +#else +#ifdef HAVE_LOCALTIME_R + tmp = &tm; + localtime_r(&when, tmp); +#else + Tcl_MutexLock(&localtimeMutex); + tmp = localtime(&when); + tm = *tmp; + Tcl_MutexUnlock(&localtimeMutex); +#endif +#endif +#else + tmp = localtime(&when); + tm = *tmp; +#endif + return (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1); +} + +static int +ToDosDate(time_t when) +{ + struct tm *tmp, tm; + +#ifdef TCL_THREADS +#if defined(_WIN32) || defined(_WIN64) + /* Win32 uses thread local storage */ + tmp = localtime(&when); + tm = *tmp; +#else +#ifdef HAVE_LOCALTIME_R + tmp = &tm; + localtime_r(&when, tmp); +#else + Tcl_MutexLock(&localtimeMutex); + tmp = localtime(&when); + tm = *tmp; + Tcl_MutexUnlock(&localtimeMutex); +#endif +#endif +#else + tmp = localtime(&when); + tm = *tmp; +#endif + return ((tm.tm_year - 80) << 9) | ((tm.tm_mon + 1) << 5) | tm.tm_mday; +} + +/* + *------------------------------------------------------------------------- + * + * CountSlashes -- + * + * This function counts the number of slashes in a pathname string. + * + * Results: + * Number of slashes found in string. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +CountSlashes(const char *string) +{ + int count = 0; + const char *p = string; + + while (*p != '\0') { + if (*p == '/') { + count++; + } + p++; + } + return count; +} + +/* + *------------------------------------------------------------------------- + * + * CanonicalPath -- + * + * This function computes the canonical path from a directory + * and file name components into the specified Tcl_DString. + * + * Results: + * Returns the pointer to the canonical path contained in the + * specified Tcl_DString. + * + * Side effects: + * Modifies the specified Tcl_DString. + * + *------------------------------------------------------------------------- + */ + +static char * +CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr,int ZIPFSPATH) +{ + char *path; + char *result; + int i, j, c, isunc = 0, isvfs=0, n=0; +#if HAS_DRIVES + int zipfspath=1; + if ((tail[0] != '\0') && (strchr(drvletters, tail[0]) != NULL) && + (tail[1] == ':')) { + tail += 2; + zipfspath=0; + } + /* UNC style path */ + if (tail[0] == '\\') { + root = ""; + ++tail; + zipfspath=0; + } + if (tail[0] == '\\') { + root = "/"; + ++tail; + zipfspath=0; + } + if(zipfspath) { +#endif + /* UNC style path */ + if(root && strncmp(root,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN)==0) { + isvfs=1; + } else if (tail && strncmp(tail,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN) == 0) { + isvfs=2; + } + if(isvfs!=1) { + if ((root[0] == '/') && (root[1] == '/')) { + isunc = 1; + } + } +#if HAS_DRIVES + } +#endif + if(isvfs!=2) { + if (tail[0] == '/') { + if(isvfs!=1) { + root = ""; + } + ++tail; + isunc = 0; + } + if (tail[0] == '/') { + if(isvfs!=1) { + root = "/"; + } + ++tail; + isunc = 1; + } + } + i = strlen(root); + j = strlen(tail); + if(isvfs==1) { + if(i>ZIPFS_VOLUME_LEN) { + Tcl_DStringSetLength(dsPtr, i + j + 1); + path = Tcl_DStringValue(dsPtr); + memcpy(path, root, i); + path[i++] = '/'; + memcpy(path + i, tail, j); + } else { + Tcl_DStringSetLength(dsPtr, i + j); + path = Tcl_DStringValue(dsPtr); + memcpy(path, root, i); + memcpy(path + i, tail, j); + } + } else if(isvfs==2) { + Tcl_DStringSetLength(dsPtr, j); + path = Tcl_DStringValue(dsPtr); + memcpy(path, tail, j); + } else { + if (ZIPFSPATH) { + Tcl_DStringSetLength(dsPtr, i + j + ZIPFS_VOLUME_LEN); + path = Tcl_DStringValue(dsPtr); + memcpy(path, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN); + memcpy(path + ZIPFS_VOLUME_LEN + i , tail, j); + } else { + Tcl_DStringSetLength(dsPtr, i + j + 1); + path = Tcl_DStringValue(dsPtr); + memcpy(path, root, i); + path[i++] = '/'; + memcpy(path + i, tail, j); + } + } +#if HAS_DRIVES + for (i = 0; path[i] != '\0'; i++) { + if (path[i] == '\\') { + path[i] = '/'; + } + } +#endif + if(ZIPFSPATH) { + n=ZIPFS_VOLUME_LEN; + } else { + n=0; + } + for (i = j = n; (c = path[i]) != '\0'; i++) { + if (c == '/') { + int c2 = path[i + 1]; + if (c2 == '/') { + continue; + } + if (c2 == '.') { + int c3 = path[i + 2]; + if ((c3 == '/') || (c3 == '\0')) { + i++; + continue; + } + if ((c3 == '.') && + ((path[i + 3] == '/') || (path [i + 3] == '\0'))) { + i += 2; + while ((j > 0) && (path[j - 1] != '/')) { + j--; + } + if (j > isunc) { + --j; + while ((j > 1 + isunc) && (path[j - 2] == '/')) { + j--; + } + } + continue; + } + } + } + path[j++] = c; + } + if (j == 0) { + path[j++] = '/'; + } + path[j] = 0; + Tcl_DStringSetLength(dsPtr, j); + result=Tcl_DStringValue(dsPtr); + return result; +} + + + +/* + *------------------------------------------------------------------------- + * + * AbsolutePath -- + * + * This function computes the absolute path from a given + * (relative) path name into the specified Tcl_DString. + * + * Results: + * Returns the pointer to the absolute path contained in the + * specified Tcl_DString. + * + * Side effects: + * Modifies the specified Tcl_DString. + * + *------------------------------------------------------------------------- + */ + +static char * +AbsolutePath(const char *path, + Tcl_DString *dsPtr, + int ZIPFSPATH) +{ + char *result; + if (*path == '~') { + Tcl_DStringAppend(dsPtr, path, -1); + return Tcl_DStringValue(dsPtr); + } + if (*path != '/') { + Tcl_DString pwd; + + /* relative path */ + Tcl_DStringInit(&pwd); + Tcl_GetCwd(NULL, &pwd); + result = Tcl_DStringValue(&pwd); + result = CanonicalPath(result, path, dsPtr,ZIPFSPATH); + Tcl_DStringFree(&pwd); + } else { + /* absolute path */ + result = CanonicalPath("", path, dsPtr,ZIPFSPATH); + } + return result; +} + +/* + *------------------------------------------------------------------------- + * + * ZipFSLookup -- + * + * This function returns the ZIP entry struct corresponding to + * the ZIP archive member of the given file name. + * + * Results: + * Returns the pointer to ZIP entry struct or NULL if the + * the given file name could not be found in the global list + * of ZIP archive members. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static ZipEntry * +ZipFSLookup(char *filename) +{ + char *realname; + + Tcl_HashEntry *hPtr; + ZipEntry *z; + Tcl_DString ds; + Tcl_DStringInit(&ds); + realname = AbsolutePath(filename, &ds, 1); + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, realname); + z = hPtr ? (ZipEntry *) Tcl_GetHashValue(hPtr) : NULL; + Tcl_DStringFree(&ds); + return z; +} + +#ifdef NEVER_USED + +/* + *------------------------------------------------------------------------- + * + * ZipFSLookupMount -- + * + * This function returns an indication if the given file name + * corresponds to a mounted ZIP archive file. + * + * Results: + * Returns true, if the given file name is a mounted ZIP archive file. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSLookupMount(char *filename) +{ + char *realname; + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + ZipFile *zf; + Tcl_DString ds; + int match = 0; + Tcl_DStringInit(&ds); + realname = AbsolutePath(filename, &ds, 1); + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { + if (strcmp(zf->mntpt, realname) == 0) { + match = 1; + break; + } + } + hPtr = Tcl_NextHashEntry(&search); + } + Tcl_DStringFree(&ds); + return match; +} +#endif + +/* + *------------------------------------------------------------------------- + * + * ZipFSCloseArchive -- + * + * This function closes a mounted ZIP archive file. + * + * Results: + * None. + * + * Side effects: + * A memory mapped ZIP archive is unmapped, allocated memory is + * released. + * + *------------------------------------------------------------------------- + */ + +static void +ZipFSCloseArchive(Tcl_Interp *interp, ZipFile *zf) +{ +#if defined(_WIN32) || defined(_WIN64) + if ((zf->data != NULL) && (zf->tofree == NULL)) { + UnmapViewOfFile(zf->data); + zf->data = NULL; + } + if (zf->mh != INVALID_HANDLE_VALUE) { + CloseHandle(zf->mh); + } +#else + if ((zf->data != MAP_FAILED) && (zf->tofree == NULL)) { + munmap(zf->data, zf->length); + zf->data = MAP_FAILED; + } +#endif + if (zf->tofree != NULL) { + Tcl_Free((char *) zf->tofree); + zf->tofree = NULL; + } + Tcl_Close(interp, zf->chan); + zf->chan = NULL; +} + +/* + *------------------------------------------------------------------------- + * + * ZipFSOpenArchive -- + * + * This function opens a ZIP archive file for reading. An attempt + * is made to memory map that file. Otherwise it is read into + * an allocated memory buffer. The ZIP archive header is verified + * and must be valid for the function to succeed. When "needZip" + * is zero an embedded ZIP archive in an executable file is accepted. + * + * Results: + * TCL_OK on success, TCL_ERROR otherwise with an error message + * placed into the given "interp" if it is not NULL. + * + * Side effects: + * ZIP archive is memory mapped or read into allocated memory, + * the given ZipFile struct is filled with information about + * the ZIP archive file. + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSOpenArchive(Tcl_Interp *interp, const char *zipname, int needZip, + ZipFile *zf) +{ + int i; + ClientData handle; + unsigned char *p, *q; + +#if defined(_WIN32) || defined(_WIN64) + zf->data = NULL; + zf->mh = INVALID_HANDLE_VALUE; +#else + zf->data = MAP_FAILED; +#endif + zf->length = 0; + zf->nfiles = 0; + zf->baseoffs = zf->baseoffsp = 0; + zf->tofree = NULL; + zf->pwbuf[0] = 0; + zf->chan = Tcl_OpenFileChannel(interp, zipname, "r", 0); + if (zf->chan == NULL) { + return TCL_ERROR; + } + if (Tcl_GetChannelHandle(zf->chan, TCL_READABLE, &handle) != TCL_OK) { + if (Tcl_SetChannelOption(interp, zf->chan, "-translation", "binary") + != TCL_OK) { + goto error; + } + if (Tcl_SetChannelOption(interp, zf->chan, "-encoding", "binary") + != TCL_OK) { + goto error; + } + zf->length = Tcl_Seek(zf->chan, 0, SEEK_END); + if ((zf->length <= 0) || (zf->length > 64 * 1024 * 1024)) { + if (interp) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal file size", -1)); + } + goto error; + } + Tcl_Seek(zf->chan, 0, SEEK_SET); + zf->tofree = zf->data = (unsigned char *) Tcl_AttemptAlloc(zf->length); + if (zf->tofree == NULL) { + if (interp) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("out of memory", -1)); + } + goto error; + } + i = Tcl_Read(zf->chan, (char *) zf->data, zf->length); + if (i != zf->length) { + if (interp) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("file read error", -1)); + } + goto error; + } + Tcl_Close(interp, zf->chan); + zf->chan = NULL; + } else { +#if defined(_WIN32) || defined(_WIN64) + zf->length = GetFileSize((HANDLE) handle, 0); + if ((zf->length == INVALID_FILE_SIZE) || + (zf->length < ZIP_CENTRAL_END_LEN)) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("invalid file size", -1)); + } + goto error; + } + zf->mh = CreateFileMapping((HANDLE) handle, 0, PAGE_READONLY, 0, + zf->length, 0); + if (zf->mh == INVALID_HANDLE_VALUE) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("file mapping failed", -1)); + } + goto error; + } + zf->data = MapViewOfFile(zf->mh, FILE_MAP_READ, 0, 0, zf->length); + if (zf->data == NULL) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("file mapping failed", -1)); + } + goto error; + } +#else + zf->length = lseek((int) (long) handle, 0, SEEK_END); + if ((zf->length == -1) || (zf->length < ZIP_CENTRAL_END_LEN)) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("invalid file size", -1)); + } + goto error; + } + lseek((int) (long) handle, 0, SEEK_SET); + zf->data = (unsigned char *) mmap(0, zf->length, PROT_READ, + MAP_FILE | MAP_PRIVATE, + (int) (long) handle, 0); + if (zf->data == MAP_FAILED) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("file mapping failed", -1)); + } + goto error; + } +#endif + } + p = zf->data + zf->length - ZIP_CENTRAL_END_LEN; + while (p >= zf->data) { + if (*p == (ZIP_CENTRAL_END_SIG & 0xFF)) { + if (zip_read_int(p) == ZIP_CENTRAL_END_SIG) { + break; + } + p -= ZIP_SIG_LEN; + } else { + --p; + } + } + if (p < zf->data) { + if (!needZip) { + zf->baseoffs = zf->baseoffsp = zf->length; + return TCL_OK; + } + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("wrong end signature", -1)); + } + goto error; + } + zf->nfiles = zip_read_short(p + ZIP_CENTRAL_ENTS_OFFS); + if (zf->nfiles == 0) { + if (!needZip) { + zf->baseoffs = zf->baseoffsp = zf->length; + return TCL_OK; + } + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("empty archive", -1)); + } + goto error; + } + q = zf->data + zip_read_int(p + ZIP_CENTRAL_DIRSTART_OFFS); + p -= zip_read_int(p + ZIP_CENTRAL_DIRSIZE_OFFS); + if ((p < zf->data) || (p > (zf->data + zf->length)) || + (q < zf->data) || (q > (zf->data + zf->length))) { + if (!needZip) { + zf->baseoffs = zf->baseoffsp = zf->length; + return TCL_OK; + } + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("archive directory not found", -1)); + } + goto error; + } + zf->baseoffs = zf->baseoffsp = p - q; + zf->centoffs = p - zf->data; + q = p; + for (i = 0; i < zf->nfiles; i++) { + int pathlen, comlen, extra; + + if ((q + ZIP_CENTRAL_HEADER_LEN) > (zf->data + zf->length)) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("wrong header length", -1)); + } + goto error; + } + if (zip_read_int(q) != ZIP_CENTRAL_HEADER_SIG) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("wrong header signature", -1)); + } + goto error; + } + pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); + comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); + extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); + q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; + } + q = zf->data + zf->baseoffs; + if ((zf->baseoffs >= 6) && + (zip_read_int(q - 4) == ZIP_PASSWORD_END_SIG)) { + i = q[-5]; + if (q - 5 - i > zf->data) { + zf->pwbuf[0] = i; + memcpy(zf->pwbuf + 1, q - 5 - i, i); + zf->baseoffsp -= i ? (5 + i) : 0; + } + } + return TCL_OK; + +error: + ZipFSCloseArchive(interp, zf); + return TCL_ERROR; +} + +/* + *------------------------------------------------------------------------- + * + * TclZipfsMount -- + * + * This procedure is invoked to mount a given ZIP archive file on + * a given mountpoint with optional ZIP password. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * A ZIP archive file is read, analyzed and mounted, resources are + * allocated. + * + *------------------------------------------------------------------------- + */ + +int +TclZipfsMount(Tcl_Interp *interp, const char *zipname, const char *mntpt, + const char *passwd) +{ + char *realname, *p; + int i, pwlen, isNew; + ZipFile *zf, zf0; + ZipEntry *z; + Tcl_HashEntry *hPtr; + Tcl_DString ds, dsm, fpBuf; + unsigned char *q; + + ReadLock(); + if (!ZipFS.initialized) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("not initialized", -1)); + } + Unlock(); + return TCL_ERROR; + } + if (zipname == NULL) { + Tcl_HashSearch search; + int ret = TCL_OK; + + i = 0; + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { + if (interp != NULL) { + Tcl_AppendElement(interp, zf->mntpt); + Tcl_AppendElement(interp, zf->name); + } + ++i; + } + hPtr = Tcl_NextHashEntry(&search); + } + if (interp == NULL) { + ret = (i > 0) ? TCL_OK : TCL_BREAK; + } + Unlock(); + return ret; + } + if (mntpt == NULL) { + if (interp == NULL) { + Unlock(); + return TCL_OK; + } + Tcl_DStringInit(&ds); + p = AbsolutePath(zipname, &ds, 0); + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, p); + if (hPtr != NULL) { + if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); + } + } + Unlock(); + Tcl_DStringFree(&ds); + return TCL_OK; + } + Unlock(); + pwlen = 0; + if (passwd != NULL) { + pwlen = strlen(passwd); + if ((pwlen > 255) || (strchr(passwd, 0xff) != NULL)) { + if (interp) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal password", -1)); + } + return TCL_ERROR; + } + } + if (ZipFSOpenArchive(interp, zipname, 1, &zf0) != TCL_OK) { + return TCL_ERROR; + } + Tcl_DStringInit(&ds); + realname = AbsolutePath(zipname, &ds, 0); + /* + * Mount point can come from Tcl_GetNameOfExecutable() + * which sometimes is a relative or otherwise denormalized path. + * But an absolute name is needed as mount point here. + */ + Tcl_DStringInit(&dsm); + mntpt = CanonicalPath("", mntpt, &dsm, 1); + WriteLock(); + hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, realname, &isNew); + Tcl_DStringSetLength(&ds, 0); + if (!isNew) { + zf = (ZipFile *) Tcl_GetHashValue(hPtr); + if (interp != NULL) { + Tcl_AppendResult(interp, "already mounted on \"", zf->mntptlen ? + zf->mntpt : "/", "\"", (char *) NULL); + } + Unlock(); + Tcl_DStringFree(&ds); + Tcl_DStringFree(&dsm); + ZipFSCloseArchive(interp, &zf0); + return TCL_ERROR; + } + if (strcmp(mntpt, "/") == 0) { + mntpt = ""; + } + zf = (ZipFile *) Tcl_AttemptAlloc(sizeof (*zf) + strlen(mntpt) + 1); + if (zf == NULL) { + if (interp != NULL) { + Tcl_AppendResult(interp, "out of memory", (char *) NULL); + } + Unlock(); + Tcl_DStringFree(&ds); + Tcl_DStringFree(&dsm); + ZipFSCloseArchive(interp, &zf0); + return TCL_ERROR; + } + *zf = zf0; + zf->name = Tcl_GetHashKey(&ZipFS.zipHash, hPtr); + strcpy(zf->mntpt, mntpt); + zf->mntptlen = strlen(zf->mntpt); + zf->entries = NULL; + zf->topents = NULL; + zf->nopen = 0; + Tcl_SetHashValue(hPtr, (ClientData) zf); + if ((zf->pwbuf[0] == 0) && pwlen) { + int k = 0; + i = pwlen; + zf->pwbuf[k++] = i; + while (i > 0) { + zf->pwbuf[k] = (passwd[i - 1] & 0x0f) | + pwrot[(passwd[i - 1] >> 4) & 0x0f]; + k++; + i--; + } + zf->pwbuf[k] = '\0'; + } + if (mntpt[0] != '\0') { + z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); + z->name = NULL; + z->tnext = NULL; + z->depth = CountSlashes(mntpt); + z->zipfile = zf; + z->isdir = 1; + z->isenc = 0; + z->offset = zf->baseoffs; + z->crc32 = 0; + z->timestamp = 0; + z->nbyte = z->nbytecompr = 0; + z->cmeth = ZIP_COMPMETH_STORED; + z->data = NULL; + hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, mntpt, &isNew); + if (!isNew) { + /* skip it */ + Tcl_Free((char *) z); + } else { + Tcl_SetHashValue(hPtr, (ClientData) z); + z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); + z->next = zf->entries; + zf->entries = z; + } + } + q = zf->data + zf->centoffs; + Tcl_DStringInit(&fpBuf); + for (i = 0; i < zf->nfiles; i++) { + int pathlen, comlen, extra, isdir = 0, dosTime, dosDate, nbcompr, offs; + unsigned char *lq, *gq = NULL; + char *fullpath, *path; + + pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); + comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); + extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); + Tcl_DStringSetLength(&ds, 0); + Tcl_DStringAppend(&ds, (char *) q + ZIP_CENTRAL_HEADER_LEN, pathlen); + path = Tcl_DStringValue(&ds); + if ((pathlen > 0) && (path[pathlen - 1] == '/')) { + Tcl_DStringSetLength(&ds, pathlen - 1); + path = Tcl_DStringValue(&ds); + isdir = 1; + } + if ((strcmp(path, ".") == 0) || (strcmp(path, "..") == 0)) { + goto nextent; + } + lq = zf->data + zf->baseoffs + + zip_read_int(q + ZIP_CENTRAL_LOCALHDR_OFFS); + if ((lq < zf->data) || (lq > (zf->data + zf->length))) { + goto nextent; + } + nbcompr = zip_read_int(lq + ZIP_LOCAL_COMPLEN_OFFS); + if (!isdir && (nbcompr == 0) && + (zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS) == 0) && + (zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS) == 0)) { + gq = q; + nbcompr = zip_read_int(gq + ZIP_CENTRAL_COMPLEN_OFFS); + } + offs = (lq - zf->data) + + ZIP_LOCAL_HEADER_LEN + + zip_read_short(lq + ZIP_LOCAL_PATHLEN_OFFS) + + zip_read_short(lq + ZIP_LOCAL_EXTRALEN_OFFS); + if ((offs + nbcompr) > zf->length) { + goto nextent; + } + if (!isdir && (mntpt[0] == '\0') && !CountSlashes(path)) { +#ifdef ANDROID + /* + * When mounting the ZIP archive on the root directory try + * to remap top level regular files of the archive to + * /assets/.root/... since this directory should not be + * in a valid APK due to the leading dot in the file name + * component. This trick should make the files + * AndroidManifest.xml, resources.arsc, and classes.dex + * visible to Tcl. + */ + Tcl_DString ds2; + + Tcl_DStringInit(&ds2); + Tcl_DStringAppend(&ds2, "assets/.root/", -1); + Tcl_DStringAppend(&ds2, path, -1); + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, Tcl_DStringValue(&ds2)); + if (hPtr != NULL) { + /* should not happen but skip it anyway */ + Tcl_DStringFree(&ds2); + goto nextent; + } + Tcl_DStringSetLength(&ds, 0); + Tcl_DStringAppend(&ds, Tcl_DStringValue(&ds2), + Tcl_DStringLength(&ds2)); + path = Tcl_DStringValue(&ds); + Tcl_DStringFree(&ds2); +#else + /* + * Regular files skipped when mounting on root. + */ + goto nextent; +#endif + } + Tcl_DStringSetLength(&fpBuf, 0); + fullpath = CanonicalPath(mntpt, path, &fpBuf, 1); + z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); + z->name = NULL; + z->tnext = NULL; + z->depth = CountSlashes(fullpath); + z->zipfile = zf; + z->isdir = isdir; + z->isenc = (zip_read_short(lq + ZIP_LOCAL_FLAGS_OFFS) & 1) + && (nbcompr > 12); + z->offset = offs; + if (gq != NULL) { + z->crc32 = zip_read_int(gq + ZIP_CENTRAL_CRC32_OFFS); + dosDate = zip_read_short(gq + ZIP_CENTRAL_MDATE_OFFS); + dosTime = zip_read_short(gq + ZIP_CENTRAL_MTIME_OFFS); + z->timestamp = DosTimeDate(dosDate, dosTime); + z->nbyte = zip_read_int(gq + ZIP_CENTRAL_UNCOMPLEN_OFFS); + z->cmeth = zip_read_short(gq + ZIP_CENTRAL_COMPMETH_OFFS); + } else { + z->crc32 = zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS); + dosDate = zip_read_short(lq + ZIP_LOCAL_MDATE_OFFS); + dosTime = zip_read_short(lq + ZIP_LOCAL_MTIME_OFFS); + z->timestamp = DosTimeDate(dosDate, dosTime); + z->nbyte = zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS); + z->cmeth = zip_read_short(lq + ZIP_LOCAL_COMPMETH_OFFS); + } + z->nbytecompr = nbcompr; + z->data = NULL; + hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, fullpath, &isNew); + if (!isNew) { + /* should not happen but skip it anyway */ + Tcl_Free((char *) z); + } else { + Tcl_SetHashValue(hPtr, (ClientData) z); + z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); + z->next = zf->entries; + zf->entries = z; + if (isdir && (mntpt[0] == '\0') && (z->depth == 1)) { + z->tnext = zf->topents; + zf->topents = z; + } + if (!z->isdir && (z->depth > 1)) { + char *dir, *end; + ZipEntry *zd; + + Tcl_DStringSetLength(&ds, strlen(z->name) + 8); + Tcl_DStringSetLength(&ds, 0); + Tcl_DStringAppend(&ds, z->name, -1); + dir = Tcl_DStringValue(&ds); + end = strrchr(dir, '/'); + while ((end != NULL) && (end != dir)) { + Tcl_DStringSetLength(&ds, end - dir); + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, dir); + if (hPtr != NULL) { + break; + } + zd = (ZipEntry *) Tcl_Alloc(sizeof (*zd)); + zd->name = NULL; + zd->tnext = NULL; + zd->depth = CountSlashes(dir); + zd->zipfile = zf; + zd->isdir = 1; + zd->isenc = 0; + zd->offset = z->offset; + zd->crc32 = 0; + zd->timestamp = z->timestamp; + zd->nbyte = zd->nbytecompr = 0; + zd->cmeth = ZIP_COMPMETH_STORED; + zd->data = NULL; + hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, dir, &isNew); + if (!isNew) { + /* should not happen but skip it anyway */ + Tcl_Free((char *) zd); + } else { + Tcl_SetHashValue(hPtr, (ClientData) zd); + zd->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); + zd->next = zf->entries; + zf->entries = zd; + if ((mntpt[0] == '\0') && (zd->depth == 1)) { + zd->tnext = zf->topents; + zf->topents = zd; + } + } + end = strrchr(dir, '/'); + } + } + } +nextent: + q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; + } + Unlock(); + Tcl_DStringFree(&fpBuf); + Tcl_DStringFree(&ds); + Tcl_DStringFree(&dsm); + Tcl_FSMountsChanged(NULL); + return TCL_OK; +} + +/* + *------------------------------------------------------------------------- + * + * TclZipfsUnmount -- + * + * This procedure is invoked to unmount a given ZIP archive. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * A mounted ZIP archive file is unmounted, resources are free'd. + * + *------------------------------------------------------------------------- + */ + +int +TclZipfsUnmount(Tcl_Interp *interp, const char *zipname) +{ + char *realname; + ZipFile *zf; + ZipEntry *z, *znext; + Tcl_HashEntry *hPtr; + Tcl_DString ds; + int ret = TCL_OK, unmounted = 0; + + Tcl_DStringInit(&ds); + realname = AbsolutePath(zipname, &ds, 0); + WriteLock(); + if (!ZipFS.initialized) { + goto done; + } + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, realname); + if (hPtr == NULL) { + /* don't report error */ + goto done; + } + zf = (ZipFile *) Tcl_GetHashValue(hPtr); + if (zf->nopen > 0) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("filesystem is busy", -1)); + } + ret = TCL_ERROR; + goto done; + } + Tcl_DeleteHashEntry(hPtr); + for (z = zf->entries; z; z = znext) { + znext = z->next; + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, z->name); + if (hPtr) { + Tcl_DeleteHashEntry(hPtr); + } + if (z->data != NULL) { + Tcl_Free((char *) z->data); + } + Tcl_Free((char *) z); + } + ZipFSCloseArchive(interp, zf); + Tcl_Free((char *) zf); + unmounted = 1; +done: + Unlock(); + Tcl_DStringFree(&ds); + if (unmounted) { + Tcl_FSMountsChanged(NULL); + } + return ret; +} + +/* + *------------------------------------------------------------------------- + * + * ZipFSMountObjCmd -- + * + * This procedure is invoked to process the "zipfs::mount" command. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * A ZIP archive file is mounted, resources are allocated. + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSMountObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + if (objc > 4) { + Tcl_WrongNumArgs(interp, 1, objv, + "?zipfile? ?mountpoint? ?password?"); + return TCL_ERROR; + } + return TclZipfsMount(interp, (objc > 1) ? Tcl_GetString(objv[1]) : NULL, + (objc > 2) ? Tcl_GetString(objv[2]) : NULL, + (objc > 3) ? Tcl_GetString(objv[3]) : NULL); +} + +/* + *------------------------------------------------------------------------- + * + * ZipFSUnmountObjCmd -- + * + * This procedure is invoked to process the "zipfs::unmount" command. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * A mounted ZIP archive file is unmounted, resources are free'd. + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSUnmountObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "zipfile"); + return TCL_ERROR; + } + return TclZipfsUnmount(interp, Tcl_GetString(objv[1])); +} + +/* + *------------------------------------------------------------------------- + * + * ZipFSMkKeyObjCmd -- + * + * This procedure is invoked to process the "zipfs::mkkey" command. + * It produces a rotated password to be embedded into an image file. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSMkKeyObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + int len, i = 0; + char *pw, pwbuf[264]; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "password"); + return TCL_ERROR; + } + pw = Tcl_GetString(objv[1]); + len = strlen(pw); + if (len == 0) { + return TCL_OK; + } + if ((len > 255) || (strchr(pw, 0xff) != NULL)) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal password", -1)); + return TCL_ERROR; + } + while (len > 0) { + int ch = pw[len - 1]; + + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + i++; + len--; + } + pwbuf[i] = i; + ++i; + pwbuf[i++] = (char) ZIP_PASSWORD_END_SIG; + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 8); + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 16); + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 24); + pwbuf[i] = '\0'; + Tcl_AppendResult(interp, pwbuf, (char *) NULL); + return TCL_OK; +} + +/* + *------------------------------------------------------------------------- + * + * ZipAddFile -- + * + * This procedure is used by ZipFSMkZipOrImgCmd() to add a single + * file to the output ZIP archive file being written. A ZipEntry + * struct about the input file is added to the given fileHash table + * for later creation of the central ZIP directory. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * Input file is read and (compressed and) written to the output + * ZIP archive file. + * + *------------------------------------------------------------------------- + */ + +static int +ZipAddFile(Tcl_Interp *interp, const char *path, const char *name, + Tcl_Channel out, const char *passwd, + char *buf, int bufsize, Tcl_HashTable *fileHash) +{ + Tcl_Channel in; + Tcl_HashEntry *hPtr; + ZipEntry *z; + z_stream stream; + const char *zpath; + int nbyte, nbytecompr, len, crc, flush, pos[3], zpathlen, olen; + int mtime = 0, isNew, align = 0, cmeth; + unsigned long keys[3], keys0[3]; + char obuf[4096]; + + zpath = name; + while (zpath != NULL && zpath[0] == '/') { + zpath++; + } + if ((zpath == NULL) || (zpath[0] == '\0')) { + return TCL_OK; + } + zpathlen = strlen(zpath); + if (zpathlen + ZIP_CENTRAL_HEADER_LEN > bufsize) { + Tcl_AppendResult(interp, "path too long for \"", path, "\"", + (char *) NULL); + return TCL_ERROR; + } + in = Tcl_OpenFileChannel(interp, path, "r", 0); + if ((in == NULL) || + (Tcl_SetChannelOption(interp, in, "-translation", "binary") + != TCL_OK) || + (Tcl_SetChannelOption(interp, in, "-encoding", "binary") + != TCL_OK)) { +#if defined(_WIN32) || defined(_WIN64) + /* hopefully a directory */ + if (strcmp("permission denied", Tcl_PosixError(interp)) == 0) { + Tcl_Close(interp, in); + return TCL_OK; + } +#endif + Tcl_Close(interp, in); + return TCL_ERROR; + } else { + Tcl_Obj *pathObj = Tcl_NewStringObj(path, -1); + Tcl_StatBuf statBuf; + + Tcl_IncrRefCount(pathObj); + if (Tcl_FSStat(pathObj, &statBuf) != -1) { + mtime = statBuf.st_mtime; + } + Tcl_DecrRefCount(pathObj); + } + Tcl_ResetResult(interp); + crc = 0; + nbyte = nbytecompr = 0; + while ((len = Tcl_Read(in, buf, bufsize)) > 0) { + crc = crc32(crc, (unsigned char *) buf, len); + nbyte += len; + } + if (len == -1) { + if (nbyte == 0) { + if (strcmp("illegal operation on a directory", + Tcl_PosixError(interp)) == 0) { + Tcl_Close(interp, in); + return TCL_OK; + } + } + Tcl_AppendResult(interp, "read error on \"", path, "\"", + (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + if (Tcl_Seek(in, 0, SEEK_SET) == -1) { + Tcl_AppendResult(interp, "seek error on \"", path, "\"", + (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + pos[0] = Tcl_Tell(out); + memset(buf, '\0', ZIP_LOCAL_HEADER_LEN); + memcpy(buf + ZIP_LOCAL_HEADER_LEN, zpath, zpathlen); + len = zpathlen + ZIP_LOCAL_HEADER_LEN; + if (Tcl_Write(out, buf, len) != len) { +wrerr: + Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + if ((len + pos[0]) & 3) { + char abuf[8]; + + /* + * Align payload to next 4-byte boundary using a dummy extra + * entry similar to the zipalign tool from Android's SDK. + */ + align = 4 + ((len + pos[0]) & 3); + zip_write_short(abuf, 0xffff); + zip_write_short(abuf + 2, align - 4); + zip_write_int(abuf + 4, 0x03020100); + if (Tcl_Write(out, abuf, align) != align) { + goto wrerr; + } + } + if (passwd != NULL) { + int i, ch, tmp; + unsigned char kvbuf[24]; + Tcl_Obj *ret; + + init_keys(passwd, keys, crc32tab); + for (i = 0; i < 12 - 2; i++) { + if (Tcl_EvalEx(interp, "expr int(rand() * 256) % 256", -1, 0) != TCL_OK) { + Tcl_AppendResult(interp, "PRNG error", (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + ret = Tcl_GetObjResult(interp); + if (Tcl_GetIntFromObj(interp, ret, &ch) != TCL_OK) { + Tcl_Close(interp, in); + return TCL_ERROR; + } + kvbuf[i + 12] = (unsigned char) zencode(keys, crc32tab, ch, tmp); + } + Tcl_ResetResult(interp); + init_keys(passwd, keys, crc32tab); + for (i = 0; i < 12 - 2; i++) { + kvbuf[i] = (unsigned char) zencode(keys, crc32tab, + kvbuf[i + 12], tmp); + } + kvbuf[i++] = (unsigned char) zencode(keys, crc32tab, crc >> 16, tmp); + kvbuf[i++] = (unsigned char) zencode(keys, crc32tab, crc >> 24, tmp); + len = Tcl_Write(out, (char *) kvbuf, 12); + memset(kvbuf, 0, 24); + if (len != 12) { + Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + memcpy(keys0, keys, sizeof (keys0)); + nbytecompr += 12; + } + Tcl_Flush(out); + pos[2] = Tcl_Tell(out); + cmeth = ZIP_COMPMETH_DEFLATED; + memset(&stream, 0, sizeof (stream)); + stream.zalloc = Z_NULL; + stream.zfree = Z_NULL; + stream.opaque = Z_NULL; + if (deflateInit2(&stream, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) + != Z_OK) { + Tcl_AppendResult(interp, "compression init error on \"", path, "\"", + (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + do { + len = Tcl_Read(in, buf, bufsize); + if (len == -1) { + Tcl_AppendResult(interp, "read error on \"", path, "\"", + (char *) NULL); + deflateEnd(&stream); + Tcl_Close(interp, in); + return TCL_ERROR; + } + stream.avail_in = len; + stream.next_in = (unsigned char *) buf; + flush = Tcl_Eof(in) ? Z_FINISH : Z_NO_FLUSH; + do { + stream.avail_out = sizeof (obuf); + stream.next_out = (unsigned char *) obuf; + len = deflate(&stream, flush); + if (len == Z_STREAM_ERROR) { + Tcl_AppendResult(interp, "deflate error on \"", path, "\"", + (char *) NULL); + deflateEnd(&stream); + Tcl_Close(interp, in); + return TCL_ERROR; + } + olen = sizeof (obuf) - stream.avail_out; + if (passwd != NULL) { + int i, tmp; + + for (i = 0; i < olen; i++) { + obuf[i] = (char) zencode(keys, crc32tab, obuf[i], tmp); + } + } + if (olen && (Tcl_Write(out, obuf, olen) != olen)) { + Tcl_AppendResult(interp, "write error", (char *) NULL); + deflateEnd(&stream); + Tcl_Close(interp, in); + return TCL_ERROR; + } + nbytecompr += olen; + } while (stream.avail_out == 0); + } while (flush != Z_FINISH); + deflateEnd(&stream); + Tcl_Flush(out); + pos[1] = Tcl_Tell(out); + if (nbyte - nbytecompr <= 0) { + /* + * Compressed file larger than input, + * write it again uncompressed. + */ + if ((int) Tcl_Seek(in, 0, SEEK_SET) != 0) { + goto seekErr; + } + if ((int) Tcl_Seek(out, pos[2], SEEK_SET) != pos[2]) { +seekErr: + Tcl_Close(interp, in); + Tcl_AppendResult(interp, "seek error", (char *) NULL); + return TCL_ERROR; + } + nbytecompr = (passwd != NULL) ? 12 : 0; + while (1) { + len = Tcl_Read(in, buf, bufsize); + if (len == -1) { + Tcl_AppendResult(interp, "read error on \"", path, "\"", + (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } else if (len == 0) { + break; + } + if (passwd != NULL) { + int i, tmp; + + for (i = 0; i < len; i++) { + buf[i] = (char) zencode(keys0, crc32tab, buf[i], tmp); + } + } + if (Tcl_Write(out, buf, len) != len) { + Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + nbytecompr += len; + } + cmeth = ZIP_COMPMETH_STORED; + Tcl_Flush(out); + pos[1] = Tcl_Tell(out); + Tcl_TruncateChannel(out, pos[1]); + } + Tcl_Close(interp, in); + + z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); + z->name = NULL; + z->tnext = NULL; + z->depth = 0; + z->zipfile = NULL; + z->isdir = 0; + z->isenc = (passwd != NULL) ? 1 : 0; + z->offset = pos[0]; + z->crc32 = crc; + z->timestamp = mtime; + z->nbyte = nbyte; + z->nbytecompr = nbytecompr; + z->cmeth = cmeth; + z->data = NULL; + hPtr = Tcl_CreateHashEntry(fileHash, zpath, &isNew); + if (!isNew) { + Tcl_AppendResult(interp, "non-unique path name \"", path, "\"", + (char *) NULL); + Tcl_Free((char *) z); + return TCL_ERROR; + } else { + Tcl_SetHashValue(hPtr, (ClientData) z); + z->name = Tcl_GetHashKey(fileHash, hPtr); + z->next = NULL; + } + + /* + * Write final local header information. + */ + zip_write_int(buf + ZIP_LOCAL_SIG_OFFS, ZIP_LOCAL_HEADER_SIG); + zip_write_short(buf + ZIP_LOCAL_VERSION_OFFS, ZIP_MIN_VERSION); + zip_write_short(buf + ZIP_LOCAL_FLAGS_OFFS, z->isenc); + zip_write_short(buf + ZIP_LOCAL_COMPMETH_OFFS, z->cmeth); + zip_write_short(buf + ZIP_LOCAL_MTIME_OFFS, ToDosTime(z->timestamp)); + zip_write_short(buf + ZIP_LOCAL_MDATE_OFFS, ToDosDate(z->timestamp)); + zip_write_int(buf + ZIP_LOCAL_CRC32_OFFS, z->crc32); + zip_write_int(buf + ZIP_LOCAL_COMPLEN_OFFS, z->nbytecompr); + zip_write_int(buf + ZIP_LOCAL_UNCOMPLEN_OFFS, z->nbyte); + zip_write_short(buf + ZIP_LOCAL_PATHLEN_OFFS, zpathlen); + zip_write_short(buf + ZIP_LOCAL_EXTRALEN_OFFS, align); + if ((int) Tcl_Seek(out, pos[0], SEEK_SET) != pos[0]) { + Tcl_DeleteHashEntry(hPtr); + Tcl_Free((char *) z); + Tcl_AppendResult(interp, "seek error", (char *) NULL); + return TCL_ERROR; + } + if (Tcl_Write(out, buf, ZIP_LOCAL_HEADER_LEN) != ZIP_LOCAL_HEADER_LEN) { + Tcl_DeleteHashEntry(hPtr); + Tcl_Free((char *) z); + Tcl_AppendResult(interp, "write error", (char *) NULL); + return TCL_ERROR; + } + Tcl_Flush(out); + if ((int) Tcl_Seek(out, pos[1], SEEK_SET) != pos[1]) { + Tcl_DeleteHashEntry(hPtr); + Tcl_Free((char *) z); + Tcl_AppendResult(interp, "seek error", (char *) NULL); + return TCL_ERROR; + } + return TCL_OK; +} + +/* + *------------------------------------------------------------------------- + * + * ZipFSMkZipOrImgObjCmd -- + * + * This procedure is creates a new ZIP archive file or image file + * given output filename, input directory of files to be archived, + * optional password, and optional image to be prepended to the + * output ZIP archive file. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * A new ZIP archive file or image file is written. + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSMkZipOrImgObjCmd(ClientData clientData, Tcl_Interp *interp, + int isImg, int isList, int objc, Tcl_Obj *const objv[]) +{ + Tcl_Channel out; + int len = 0, pwlen = 0, slen = 0, i, count, ret = TCL_ERROR, lobjc, pos[3]; + Tcl_Obj **lobjv, *list = NULL; + ZipEntry *z; + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + Tcl_HashTable fileHash; + char *strip = NULL, *pw = NULL, pwbuf[264], buf[4096]; + + if (isList) { + if ((objc < 3) || (objc > (isImg ? 5 : 4))) { + Tcl_WrongNumArgs(interp, 1, objv, isImg ? + "outfile inlist ?password infile?" : + "outfile inlist ?password?"); + return TCL_ERROR; + } + } else { + if ((objc < 3) || (objc > (isImg ? 6 : 5))) { + Tcl_WrongNumArgs(interp, 1, objv, isImg ? + "outfile indir ?strip? ?password? ?infile?" : + "outfile indir ?strip? ?password?"); + return TCL_ERROR; + } + } + pwbuf[0] = 0; + if (objc > (isList ? 3 : 4)) { + pw = Tcl_GetString(objv[isList ? 3 : 4]); + pwlen = strlen(pw); + if ((pwlen > 255) || (strchr(pw, 0xff) != NULL)) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal password", -1)); + return TCL_ERROR; + } + } + if (isList) { + list = objv[2]; + Tcl_IncrRefCount(list); + } else { + Tcl_Obj *cmd[3]; + + cmd[1] = Tcl_NewStringObj("::zipfs::find", -1); + cmd[2] = objv[2]; + cmd[0] = Tcl_NewListObj(2, cmd + 1); + Tcl_IncrRefCount(cmd[0]); + if (Tcl_EvalObjEx(interp, cmd[0], TCL_EVAL_DIRECT) != TCL_OK) { + Tcl_DecrRefCount(cmd[0]); + return TCL_ERROR; + } + Tcl_DecrRefCount(cmd[0]); + list = Tcl_GetObjResult(interp); + Tcl_IncrRefCount(list); + } + if (Tcl_ListObjGetElements(interp, list, &lobjc, &lobjv) != TCL_OK) { + Tcl_DecrRefCount(list); + return TCL_ERROR; + } + if (isList && (lobjc % 2)) { + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, + Tcl_NewStringObj("need even number of elements", -1)); + return TCL_ERROR; + } + if (lobjc == 0) { + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, Tcl_NewStringObj("empty archive", -1)); + return TCL_ERROR; + } + out = Tcl_OpenFileChannel(interp, Tcl_GetString(objv[1]), "w", 0755); + if ((out == NULL) || + (Tcl_SetChannelOption(interp, out, "-translation", "binary") + != TCL_OK) || + (Tcl_SetChannelOption(interp, out, "-encoding", "binary") + != TCL_OK)) { + Tcl_DecrRefCount(list); + Tcl_Close(interp, out); + return TCL_ERROR; + } + if (isImg) { + ZipFile zf0; + const char *imgName; + + if (isList) { + imgName = (objc > 4) ? Tcl_GetString(objv[4]) : + Tcl_GetNameOfExecutable(); + } else { + imgName = (objc > 5) ? Tcl_GetString(objv[5]) : + Tcl_GetNameOfExecutable(); + } + if (ZipFSOpenArchive(interp, imgName, 0, &zf0) != TCL_OK) { + Tcl_DecrRefCount(list); + Tcl_Close(interp, out); + return TCL_ERROR; + } + if ((pw != NULL) && pwlen) { + i = 0; + len = pwlen; + while (len > 0) { + int ch = pw[len - 1]; + + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + i++; + len--; + } + pwbuf[i] = i; + ++i; + pwbuf[i++] = (char) ZIP_PASSWORD_END_SIG; + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 8); + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 16); + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 24); + pwbuf[i] = '\0'; + } + i = Tcl_Write(out, (char *) zf0.data, zf0.baseoffsp); + if (i != zf0.baseoffsp) { + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); + Tcl_Close(interp, out); + ZipFSCloseArchive(interp, &zf0); + return TCL_ERROR; + } + ZipFSCloseArchive(interp, &zf0); + len = strlen(pwbuf); + if (len > 0) { + i = Tcl_Write(out, pwbuf, len); + if (i != len) { + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); + Tcl_Close(interp, out); + return TCL_ERROR; + } + } + memset(pwbuf, 0, sizeof (pwbuf)); + Tcl_Flush(out); + } + Tcl_InitHashTable(&fileHash, TCL_STRING_KEYS); + pos[0] = Tcl_Tell(out); + if (!isList && (objc > 3)) { + strip = Tcl_GetString(objv[3]); + slen = strlen(strip); + } + for (i = 0; i < lobjc; i += (isList ? 2 : 1)) { + const char *path, *name; + + path = Tcl_GetString(lobjv[i]); + if (isList) { + name = Tcl_GetString(lobjv[i + 1]); + } else { + name = path; + if (slen > 0) { + len = strlen(name); + if ((len <= slen) || (strncmp(strip, name, slen) != 0)) { + continue; + } + name += slen; + } + } + while (name[0] == '/') { + ++name; + } + if (name[0] == '\0') { + continue; + } + if (ZipAddFile(interp, path, name, out, pw, buf, sizeof (buf), + &fileHash) != TCL_OK) { + goto done; + } + } + pos[1] = Tcl_Tell(out); + count = 0; + for (i = 0; i < lobjc; i += (isList ? 2 : 1)) { + const char *path, *name; + + path = Tcl_GetString(lobjv[i]); + if (isList) { + name = Tcl_GetString(lobjv[i + 1]); + } else { + name = path; + if (slen > 0) { + len = strlen(name); + if ((len <= slen) || (strncmp(strip, name, slen) != 0)) { + continue; + } + name += slen; + } + } + while (name[0] == '/') { + ++name; + } + if (name[0] == '\0') { + continue; + } + hPtr = Tcl_FindHashEntry(&fileHash, name); + if (hPtr == NULL) { + continue; + } + z = (ZipEntry *) Tcl_GetHashValue(hPtr); + len = strlen(z->name); + zip_write_int(buf + ZIP_CENTRAL_SIG_OFFS, ZIP_CENTRAL_HEADER_SIG); + zip_write_short(buf + ZIP_CENTRAL_VERSIONMADE_OFFS, ZIP_MIN_VERSION); + zip_write_short(buf + ZIP_CENTRAL_VERSION_OFFS, ZIP_MIN_VERSION); + zip_write_short(buf + ZIP_CENTRAL_FLAGS_OFFS, z->isenc ? 1 : 0); + zip_write_short(buf + ZIP_CENTRAL_COMPMETH_OFFS, z->cmeth); + zip_write_short(buf + ZIP_CENTRAL_MTIME_OFFS, ToDosTime(z->timestamp)); + zip_write_short(buf + ZIP_CENTRAL_MDATE_OFFS, ToDosDate(z->timestamp)); + zip_write_int(buf + ZIP_CENTRAL_CRC32_OFFS, z->crc32); + zip_write_int(buf + ZIP_CENTRAL_COMPLEN_OFFS, z->nbytecompr); + zip_write_int(buf + ZIP_CENTRAL_UNCOMPLEN_OFFS, z->nbyte); + zip_write_short(buf + ZIP_CENTRAL_PATHLEN_OFFS, len); + zip_write_short(buf + ZIP_CENTRAL_EXTRALEN_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_FCOMMENTLEN_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_DISKFILE_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_IATTR_OFFS, 0); + zip_write_int(buf + ZIP_CENTRAL_EATTR_OFFS, 0); + zip_write_int(buf + ZIP_CENTRAL_LOCALHDR_OFFS, z->offset - pos[0]); + if ((Tcl_Write(out, buf, ZIP_CENTRAL_HEADER_LEN) != + ZIP_CENTRAL_HEADER_LEN) || + (Tcl_Write(out, z->name, len) != len)) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); + goto done; + } + count++; + } + Tcl_Flush(out); + pos[2] = Tcl_Tell(out); + zip_write_int(buf + ZIP_CENTRAL_END_SIG_OFFS, ZIP_CENTRAL_END_SIG); + zip_write_short(buf + ZIP_CENTRAL_DISKNO_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_DISKDIR_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_ENTS_OFFS, count); + zip_write_short(buf + ZIP_CENTRAL_TOTALENTS_OFFS, count); + zip_write_int(buf + ZIP_CENTRAL_DIRSIZE_OFFS, pos[2] - pos[1]); + zip_write_int(buf + ZIP_CENTRAL_DIRSTART_OFFS, pos[1] - pos[0]); + zip_write_short(buf + ZIP_CENTRAL_COMMENTLEN_OFFS, 0); + if (Tcl_Write(out, buf, ZIP_CENTRAL_END_LEN) != ZIP_CENTRAL_END_LEN) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); + goto done; + } + Tcl_Flush(out); + ret = TCL_OK; +done: + if (ret == TCL_OK) { + ret = Tcl_Close(interp, out); + } else { + Tcl_Close(interp, out); + } + Tcl_DecrRefCount(list); + hPtr = Tcl_FirstHashEntry(&fileHash, &search); + while (hPtr != NULL) { + z = (ZipEntry *) Tcl_GetHashValue(hPtr); + Tcl_Free((char *) z); + Tcl_DeleteHashEntry(hPtr); + hPtr = Tcl_FirstHashEntry(&fileHash, &search); + } + Tcl_DeleteHashTable(&fileHash); + return ret; +} + +/* + *------------------------------------------------------------------------- + * + * ZipFSMkZipObjCmd -- + * + * This procedure is invoked to process the "zipfs::mkzip" command. + * See description of ZipFSMkZipOrImgCmd(). + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See description of ZipFSMkZipOrImgCmd(). + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSMkZipObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + return ZipFSMkZipOrImgObjCmd(clientData, interp, 0, 0, objc, objv); +} + +static int +ZipFSLMkZipObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + return ZipFSMkZipOrImgObjCmd(clientData, interp, 0, 1, objc, objv); +} + +/* + *------------------------------------------------------------------------- + * + * ZipFSMkImgObjCmd -- + * + * This procedure is invoked to process the "zipfs::mkimg" command. + * See description of ZipFSMkZipOrImgCmd(). + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See description of ZipFSMkZipOrImgCmd(). + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSMkImgObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + return ZipFSMkZipOrImgObjCmd(clientData, interp, 1, 0, objc, objv); +} + +static int +ZipFSLMkImgObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + return ZipFSMkZipOrImgObjCmd(clientData, interp, 1, 1, objc, objv); +} + +/* + *------------------------------------------------------------------------- + * + * ZipFSExistsObjCmd -- + * + * This procedure is invoked to process the "zipfs::exists" command. + * It tests for the existence of a file in the ZIP filesystem and + * places a boolean into the interp's result. + * + * Results: + * Always TCL_OK. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSCanonicalObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + char *mntpoint=NULL; + char *filename=NULL; + char *result; + Tcl_DString dPath; + + if (objc != 2 && objc != 3 && objc!=4) { + Tcl_WrongNumArgs(interp, 1, objv, "?mntpnt? filename ?ZIPFS?"); + return TCL_ERROR; + } + Tcl_DStringInit(&dPath); + if(objc==2) { + filename = Tcl_GetString(objv[1]); + result=CanonicalPath("",filename,&dPath,1); + } else if (objc==3) { + mntpoint = Tcl_GetString(objv[1]); + filename = Tcl_GetString(objv[2]); + result=CanonicalPath(mntpoint,filename,&dPath,1); + } else { + int zipfs=0; + if(Tcl_GetBooleanFromObj(interp,objv[3],&zipfs)) { + return TCL_ERROR; + } + mntpoint = Tcl_GetString(objv[1]); + filename = Tcl_GetString(objv[2]); + result=CanonicalPath(mntpoint,filename,&dPath,zipfs); + } + Tcl_SetObjResult(interp,Tcl_NewStringObj(result,-1)); + return TCL_OK; +} + +/* + *------------------------------------------------------------------------- + * + * ZipFSExistsObjCmd -- + * + * This procedure is invoked to process the "zipfs::exists" command. + * It tests for the existence of a file in the ZIP filesystem and + * places a boolean into the interp's result. + * + * Results: + * Always TCL_OK. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSExistsObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + char *filename; + int exists; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "filename"); + return TCL_ERROR; + } + filename = Tcl_GetStringFromObj(objv[1], 0); + ReadLock(); + exists = ZipFSLookup(filename) != NULL; + Unlock(); + Tcl_SetObjResult(interp,Tcl_NewBooleanObj(exists)); + return TCL_OK; +} + +/* + *------------------------------------------------------------------------- + * + * ZipFSInfoObjCmd -- + * + * This procedure is invoked to process the "zipfs::info" command. + * On success, it returns a Tcl list made up of name of ZIP archive + * file, size uncompressed, size compressed, and archive offset of + * a file in the ZIP filesystem. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSInfoObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + char *filename; + ZipEntry *z; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "filename"); + return TCL_ERROR; + } + filename = Tcl_GetStringFromObj(objv[1], 0); + ReadLock(); + z = ZipFSLookup(filename); + if (z != NULL) { + Tcl_Obj *result = Tcl_GetObjResult(interp); + + Tcl_ListObjAppendElement(interp, result, + Tcl_NewStringObj(z->zipfile->name, -1)); + Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->nbyte)); + Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->nbytecompr)); + Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->offset)); + } + Unlock(); + return TCL_OK; +} + +/* + *------------------------------------------------------------------------- + * + * ZipFSListObjCmd -- + * + * This procedure is invoked to process the "zipfs::list" command. + * On success, it returns a Tcl list of files of the ZIP filesystem + * which match a search pattern (glob or regexp). + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSListObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + char *pattern = NULL; + Tcl_RegExp regexp = NULL; + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + Tcl_Obj *result = Tcl_GetObjResult(interp); + + if (objc > 3) { + Tcl_WrongNumArgs(interp, 1, objv, "?(-glob|-regexp)? ?pattern?"); + return TCL_ERROR; + } + if (objc == 3) { + int n; + char *what = Tcl_GetStringFromObj(objv[1], &n); + + if ((n >= 2) && (strncmp(what, "-glob", n) == 0)) { + pattern = Tcl_GetString(objv[2]); + } else if ((n >= 2) && (strncmp(what, "-regexp", n) == 0)) { + regexp = Tcl_RegExpCompile(interp, Tcl_GetString(objv[2])); + if (regexp == NULL) { + return TCL_ERROR; + } + } else { + Tcl_AppendResult(interp, "unknown option \"", what, + "\"", (char *) NULL); + return TCL_ERROR; + } + } else if (objc == 2) { + pattern = Tcl_GetStringFromObj(objv[1], 0); + } + ReadLock(); + if (pattern != NULL) { + for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + + if (Tcl_StringMatch(z->name, pattern)) { + Tcl_ListObjAppendElement(interp, result, + Tcl_NewStringObj(z->name, -1)); + } + } + } else if (regexp != NULL) { + for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + + if (Tcl_RegExpExec(interp, regexp, z->name, z->name)) { + Tcl_ListObjAppendElement(interp, result, + Tcl_NewStringObj(z->name, -1)); + } + } + } else { + for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + + Tcl_ListObjAppendElement(interp, result, + Tcl_NewStringObj(z->name, -1)); + } + } + Unlock(); + return TCL_OK; +} + +/* + *------------------------------------------------------------------------- + * + * ZipChannelClose -- + * + * This function is called to close a channel. + * + * Results: + * Always TCL_OK. + * + * Side effects: + * Resources are free'd. + * + *------------------------------------------------------------------------- + */ + +static int +ZipChannelClose(ClientData instanceData, Tcl_Interp *interp) +{ + ZipChannel *info = (ZipChannel *) instanceData; + + if (info->iscompr && (info->ubuf != NULL)) { + Tcl_Free((char *) info->ubuf); + info->ubuf = NULL; + } + if (info->isenc) { + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); + } + if (info->iswr) { + ZipEntry *z = info->zipentry; + unsigned char *newdata; + + newdata = (unsigned char *) + Tcl_AttemptRealloc((char *) info->ubuf, info->nread); + if (newdata != NULL) { + if (z->data != NULL) { + Tcl_Free((char *) z->data); + } + z->data = newdata; + z->nbyte = z->nbytecompr = info->nbyte; + z->cmeth = ZIP_COMPMETH_STORED; + z->timestamp = time(NULL); + z->isdir = 0; + z->isenc = 0; + z->offset = 0; + z->crc32 = 0; + } else { + Tcl_Free((char *) info->ubuf); + } + } + WriteLock(); + info->zipfile->nopen--; + Unlock(); + Tcl_Free((char *) info); + return TCL_OK; +} + +/* + *------------------------------------------------------------------------- + * + * ZipChannelRead -- + * + * This function is called to read data from channel. + * + * Results: + * Number of bytes read or -1 on error with error number set. + * + * Side effects: + * Data is read and file pointer is advanced. + * + *------------------------------------------------------------------------- + */ + +static int +ZipChannelRead(ClientData instanceData, char *buf, int toRead, int *errloc) +{ + ZipChannel *info = (ZipChannel *) instanceData; + unsigned long nextpos; + + if (info->isdir) { + *errloc = EISDIR; + return -1; + } + nextpos = info->nread + toRead; + if (nextpos > info->nbyte) { + toRead = info->nbyte - info->nread; + nextpos = info->nbyte; + } + if (toRead == 0) { + return 0; + } + if (info->isenc) { + int i, ch; + + for (i = 0; i < toRead; i++) { + ch = info->ubuf[i + info->nread]; + buf[i] = zdecode(info->keys, crc32tab, ch); + } + } else { + memcpy(buf, info->ubuf + info->nread, toRead); + } + info->nread = nextpos; + *errloc = 0; + return toRead; +} + +/* + *------------------------------------------------------------------------- + * + * ZipChannelWrite -- + * + * This function is called to write data into channel. + * + * Results: + * Number of bytes written or -1 on error with error number set. + * + * Side effects: + * Data is written and file pointer is advanced. + * + *------------------------------------------------------------------------- + */ + +static int +ZipChannelWrite(ClientData instanceData, const char *buf, + int toWrite, int *errloc) +{ + ZipChannel *info = (ZipChannel *) instanceData; + unsigned long nextpos; + + if (!info->iswr) { + *errloc = EINVAL; + return -1; + } + nextpos = info->nread + toWrite; + if (nextpos > info->nmax) { + toWrite = info->nmax - info->nread; + nextpos = info->nmax; + } + if (toWrite == 0) { + return 0; + } + memcpy(info->ubuf + info->nread, buf, toWrite); + info->nread = nextpos; + if (info->nread > info->nbyte) { + info->nbyte = info->nread; + } + *errloc = 0; + return toWrite; +} + +/* + *------------------------------------------------------------------------- + * + * ZipChannelSeek -- + * + * This function is called to position file pointer of channel. + * + * Results: + * New file position or -1 on error with error number set. + * + * Side effects: + * File pointer is repositioned according to offset and mode. + * + *------------------------------------------------------------------------- + */ + +static int +ZipChannelSeek(ClientData instanceData, long offset, int mode, int *errloc) +{ + ZipChannel *info = (ZipChannel *) instanceData; + + if (info->isdir) { + *errloc = EINVAL; + return -1; + } + switch (mode) { + case SEEK_CUR: + offset += info->nread; + break; + case SEEK_END: + offset += info->nbyte; + break; + case SEEK_SET: + break; + default: + *errloc = EINVAL; + return -1; + } + if (offset < 0) { + *errloc = EINVAL; + return -1; + } + if (info->iswr) { + if ((unsigned long) offset > info->nmax) { + *errloc = EINVAL; + return -1; + } + if ((unsigned long) offset > info->nbyte) { + info->nbyte = offset; + } + } else if ((unsigned long) offset > info->nbyte) { + *errloc = EINVAL; + return -1; + } + info->nread = (unsigned long) offset; + return info->nread; +} + +/* + *------------------------------------------------------------------------- + * + * ZipChannelWatchChannel -- + * + * This function is called for event notifications on channel. + * + * Results: + * None. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static void +ZipChannelWatchChannel(ClientData instanceData, int mask) +{ + return; +} + +/* + *------------------------------------------------------------------------- + * + * ZipChannelGetFile -- + * + * This function is called to retrieve OS handle for channel. + * + * Results: + * Always TCL_ERROR since there's never an OS handle for a + * file within a ZIP archive. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +ZipChannelGetFile(ClientData instanceData, int direction, + ClientData *handlePtr) +{ + return TCL_ERROR; +} + +/* + * The channel type/driver definition used for ZIP archive members. + */ + +static Tcl_ChannelType ZipChannelType = { + "zip", /* Type name. */ +#ifdef TCL_CHANNEL_VERSION_4 + TCL_CHANNEL_VERSION_4, + ZipChannelClose, /* Close channel, clean instance data */ + ZipChannelRead, /* Handle read request */ + ZipChannelWrite, /* Handle write request */ + ZipChannelSeek, /* Move location of access point, NULL'able */ + NULL, /* Set options, NULL'able */ + NULL, /* Get options, NULL'able */ + ZipChannelWatchChannel, /* Initialize notifier */ + ZipChannelGetFile, /* Get OS handle from the channel */ + NULL, /* 2nd version of close channel, NULL'able */ + NULL, /* Set blocking mode for raw channel, NULL'able */ + NULL, /* Function to flush channel, NULL'able */ + NULL, /* Function to handle event, NULL'able */ + NULL, /* Wide seek function, NULL'able */ + NULL, /* Thread action function, NULL'able */ +#else + NULL, /* Set blocking/nonblocking behaviour, NULL'able */ + ZipChannelClose, /* Close channel, clean instance data */ + ZipChannelRead, /* Handle read request */ + ZipChannelWrite, /* Handle write request */ + ZipChannelSeek, /* Move location of access point, NULL'able */ + NULL, /* Set options, NULL'able */ + NULL, /* Get options, NULL'able */ + ZipChannelWatchChannel, /* Initialize notifier */ + ZipChannelGetFile, /* Get OS handle from the channel */ +#endif +}; + +/* + *------------------------------------------------------------------------- + * + * ZipChannelOpen -- + * + * This function opens a Tcl_Channel on a file from a mounted ZIP + * archive according to given open mode. + * + * Results: + * Tcl_Channel on success, or NULL on error. + * + * Side effects: + * Memory is allocated, the file from the ZIP archive is uncompressed. + * + *------------------------------------------------------------------------- + */ + +static Tcl_Channel +ZipChannelOpen(Tcl_Interp *interp, char *filename, int mode, int permissions) +{ + ZipEntry *z; + ZipChannel *info; + int i, ch, trunc, wr, flags = 0; + char cname[128]; + + if ((mode & O_APPEND) || + ((ZipFS.wrmax <= 0) && (mode & (O_WRONLY | O_RDWR)))) { + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported open mode", -1)); + } + return NULL; + } + WriteLock(); + z = ZipFSLookup(filename); + if (z == NULL) { + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("file not found", -1)); + } + goto error; + } + trunc = (mode & O_TRUNC) != 0; + wr = (mode & (O_WRONLY | O_RDWR)) != 0; + if ((z->cmeth != ZIP_COMPMETH_STORED) && + (z->cmeth != ZIP_COMPMETH_DEFLATED)) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("unsupported compression method", -1)); + } + goto error; + } + if (wr && z->isdir) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("unsupported file type", -1)); + } + goto error; + } + if (!trunc) { + flags |= TCL_READABLE; + if (z->isenc && (z->zipfile->pwbuf[0] == 0)) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("decryption failed", -1)); + } + goto error; + } else if (wr && (z->data == NULL) && (z->nbyte > ZipFS.wrmax)) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("file too large", -1)); + } + goto error; + } + } else { + flags = TCL_WRITABLE; + } + info = (ZipChannel *) Tcl_AttemptAlloc(sizeof (*info)); + if (info == NULL) { + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("out of memory", -1)); + } + goto error; + } + info->zipfile = z->zipfile; + info->zipentry = z; + info->nread = 0; + if (wr) { + flags |= TCL_WRITABLE; + info->iswr = 1; + info->isdir = 0; + info->nmax = ZipFS.wrmax; + info->iscompr = 0; + info->isenc = 0; + info->ubuf = (unsigned char *) Tcl_AttemptAlloc(info->nmax); + if (info->ubuf == NULL) { +merror0: + if (info->ubuf != NULL) { + Tcl_Free((char *) info->ubuf); + } + Tcl_Free((char *) info); + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("out of memory", -1)); + } + goto error; + } + memset(info->ubuf, 0, info->nmax); + if (trunc) { + info->nbyte = 0; + } else { + if (z->data != NULL) { + unsigned int j = z->nbyte; + + if (j > info->nmax) { + j = info->nmax; + } + memcpy(info->ubuf, z->data, j); + info->nbyte = j; + } else { + unsigned char *zbuf = z->zipfile->data + z->offset; + + if (z->isenc) { + int len = z->zipfile->pwbuf[0]; + char pwbuf[260]; + + for (i = 0; i < len; i++) { + ch = z->zipfile->pwbuf[len - i]; + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + } + pwbuf[i] = '\0'; + init_keys(pwbuf, info->keys, crc32tab); + memset(pwbuf, 0, sizeof (pwbuf)); + for (i = 0; i < 12; i++) { + ch = info->ubuf[i]; + zdecode(info->keys, crc32tab, ch); + } + zbuf += i; + } + if (z->cmeth == ZIP_COMPMETH_DEFLATED) { + z_stream stream; + int err; + unsigned char *cbuf = NULL; + + memset(&stream, 0, sizeof (stream)); + stream.zalloc = Z_NULL; + stream.zfree = Z_NULL; + stream.opaque = Z_NULL; + stream.avail_in = z->nbytecompr; + if (z->isenc) { + unsigned int j; + + stream.avail_in -= 12; + cbuf = (unsigned char *) + Tcl_AttemptAlloc(stream.avail_in); + if (cbuf == NULL) { + goto merror0; + } + for (j = 0; j < stream.avail_in; j++) { + ch = info->ubuf[j]; + cbuf[j] = zdecode(info->keys, crc32tab, ch); + } + stream.next_in = cbuf; + } else { + stream.next_in = zbuf; + } + stream.next_out = info->ubuf; + stream.avail_out = info->nmax; + if (inflateInit2(&stream, -15) != Z_OK) { + goto cerror0; + } + err = inflate(&stream, Z_SYNC_FLUSH); + inflateEnd(&stream); + if ((err == Z_STREAM_END) || + ((err == Z_OK) && (stream.avail_in == 0))) { + if (cbuf != NULL) { + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) cbuf); + } + goto wrapchan; + } +cerror0: + if (cbuf != NULL) { + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) cbuf); + } + if (info->ubuf != NULL) { + Tcl_Free((char *) info->ubuf); + } + Tcl_Free((char *) info); + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("decompression error", -1)); + } + goto error; + } else if (z->isenc) { + for (i = 0; i < z->nbyte - 12; i++) { + ch = zbuf[i]; + info->ubuf[i] = zdecode(info->keys, crc32tab, ch); + } + } else { + memcpy(info->ubuf, zbuf, z->nbyte); + } + memset(info->keys, 0, sizeof (info->keys)); + goto wrapchan; + } + } + } else if (z->data != NULL) { + flags |= TCL_READABLE; + info->iswr = 0; + info->iscompr = 0; + info->isdir = 0; + info->isenc = 0; + info->nbyte = z->nbyte; + info->nmax = 0; + info->ubuf = z->data; + } else { + flags |= TCL_READABLE; + info->iswr = 0; + info->iscompr = z->cmeth == ZIP_COMPMETH_DEFLATED; + info->ubuf = z->zipfile->data + z->offset; + info->isdir = z->isdir; + info->isenc = z->isenc; + info->nbyte = z->nbyte; + info->nmax = 0; + if (info->isenc) { + int len = z->zipfile->pwbuf[0]; + char pwbuf[260]; + + for (i = 0; i < len; i++) { + ch = z->zipfile->pwbuf[len - i]; + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + } + pwbuf[i] = '\0'; + init_keys(pwbuf, info->keys, crc32tab); + memset(pwbuf, 0, sizeof (pwbuf)); + for (i = 0; i < 12; i++) { + ch = info->ubuf[i]; + zdecode(info->keys, crc32tab, ch); + } + info->ubuf += i; + } + if (info->iscompr) { + z_stream stream; + int err; + unsigned char *ubuf = NULL; + unsigned int j; + + memset(&stream, 0, sizeof (stream)); + stream.zalloc = Z_NULL; + stream.zfree = Z_NULL; + stream.opaque = Z_NULL; + stream.avail_in = z->nbytecompr; + if (info->isenc) { + stream.avail_in -= 12; + ubuf = (unsigned char *) Tcl_AttemptAlloc(stream.avail_in); + if (ubuf == NULL) { + info->ubuf = NULL; + goto merror; + } + for (j = 0; j < stream.avail_in; j++) { + ch = info->ubuf[j]; + ubuf[j] = zdecode(info->keys, crc32tab, ch); + } + stream.next_in = ubuf; + } else { + stream.next_in = info->ubuf; + } + stream.next_out = info->ubuf = + (unsigned char *) Tcl_AttemptAlloc(info->nbyte); + if (info->ubuf == NULL) { +merror: + if (ubuf != NULL) { + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) ubuf); + } + Tcl_Free((char *) info); + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("out of memory", -1)); + } + goto error; + } + stream.avail_out = info->nbyte; + if (inflateInit2(&stream, -15) != Z_OK) { + goto cerror; + } + err = inflate(&stream, Z_SYNC_FLUSH); + inflateEnd(&stream); + if ((err == Z_STREAM_END) || + ((err == Z_OK) && (stream.avail_in == 0))) { + if (ubuf != NULL) { + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) ubuf); + } + goto wrapchan; + } +cerror: + if (ubuf != NULL) { + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) ubuf); + } + if (info->ubuf != NULL) { + Tcl_Free((char *) info->ubuf); + } + Tcl_Free((char *) info); + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("decompression error", -1)); + } + goto error; + } + } +wrapchan: + sprintf(cname, "zipfs_%lx_%d", (unsigned long) z->offset, ZipFS.idCount++); + z->zipfile->nopen++; + Unlock(); + return Tcl_CreateChannel(&ZipChannelType, cname, (ClientData) info, flags); + +error: + Unlock(); + return NULL; +} + +/* + *------------------------------------------------------------------------- + * + * ZipEntryStat -- + * + * This function implements the ZIP filesystem specific version + * of the library version of stat. + * + * Results: + * See stat documentation. + * + * Side effects: + * See stat documentation. + * + *------------------------------------------------------------------------- + */ + +static int +ZipEntryStat(char *path, Tcl_StatBuf *buf) +{ + ZipEntry *z; + int ret = -1; + + ReadLock(); + z = ZipFSLookup(path); + if (z == NULL) { + goto done; + } + memset(buf, 0, sizeof (Tcl_StatBuf)); + if (z->isdir) { + buf->st_mode = S_IFDIR | 0555; + } else { + buf->st_mode = S_IFREG | 0555; + } + buf->st_size = z->nbyte; + buf->st_mtime = z->timestamp; + buf->st_ctime = z->timestamp; + buf->st_atime = z->timestamp; + ret = 0; +done: + Unlock(); + return ret; +} + +/* + *------------------------------------------------------------------------- + * + * ZipEntryAccess -- + * + * This function implements the ZIP filesystem specific version + * of the library version of access. + * + * Results: + * See access documentation. + * + * Side effects: + * See access documentation. + * + *------------------------------------------------------------------------- + */ + +static int +ZipEntryAccess(char *path, int mode) +{ + ZipEntry *z; + + if (mode & 3) { + return -1; + } + ReadLock(); + z = ZipFSLookup(path); + Unlock(); + return (z != NULL) ? 0 : -1; +} + +/* + *------------------------------------------------------------------------- + * + * Zip_FSOpenFileChannelProc -- + * + * Results: + * + * Side effects: + * + *------------------------------------------------------------------------- + */ + +static Tcl_Channel +Zip_FSOpenFileChannelProc(Tcl_Interp *interp, Tcl_Obj *pathPtr, + int mode, int permissions) +{ + int len; + + return ZipChannelOpen(interp, Tcl_GetStringFromObj(pathPtr, &len), + mode, permissions); +} + +/* + *------------------------------------------------------------------------- + * + * Zip_FSStatProc -- + * + * This function implements the ZIP filesystem specific version + * of the library version of stat. + * + * Results: + * See stat documentation. + * + * Side effects: + * See stat documentation. + * + *------------------------------------------------------------------------- + */ + +static int +Zip_FSStatProc(Tcl_Obj *pathPtr, Tcl_StatBuf *buf) +{ + int len; + + return ZipEntryStat(Tcl_GetStringFromObj(pathPtr, &len), buf); +} + +/* + *------------------------------------------------------------------------- + * + * Zip_FSAccessProc -- + * + * This function implements the ZIP filesystem specific version + * of the library version of access. + * + * Results: + * See access documentation. + * + * Side effects: + * See access documentation. + * + *------------------------------------------------------------------------- + */ + +static int +Zip_FSAccessProc(Tcl_Obj *pathPtr, int mode) +{ + int len; + + return ZipEntryAccess(Tcl_GetStringFromObj(pathPtr, &len), mode); +} + +/* + *------------------------------------------------------------------------- + * + * Zip_FSFilesystemSeparatorProc -- + * + * This function returns the separator to be used for a given path. The + * object returned should have a refCount of zero + * + * Results: + * A Tcl object, with a refCount of zero. If the caller needs to retain a + * reference to the object, it should call Tcl_IncrRefCount, and should + * otherwise free the object. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static Tcl_Obj * +Zip_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr) +{ + return Tcl_NewStringObj("/", -1); +} + +/* + *------------------------------------------------------------------------- + * + * Zip_FSMatchInDirectoryProc -- + * + * This routine is used by the globbing code to search a directory for + * all files which match a given pattern. + * + * Results: + * The return value is a standard Tcl result indicating whether an + * error occurred in globbing. Errors are left in interp, good + * results are lappend'ed to resultPtr (which must be a valid object). + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ +static int +Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, + Tcl_Obj *pathPtr, const char *pattern, + Tcl_GlobTypeData *types) +{ + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + int scnt, len, l, dirOnly = -1, prefixLen, strip = 0; + char *pat, *prefix, *path; + Tcl_DString ds, dsPref; + if (types != NULL) { + dirOnly = (types->type & TCL_GLOB_TYPE_DIR) == TCL_GLOB_TYPE_DIR; + } + Tcl_DStringInit(&ds); + Tcl_DStringInit(&dsPref); + prefix = Tcl_GetStringFromObj(pathPtr, &prefixLen); + Tcl_DStringAppend(&dsPref, prefix, prefixLen); + prefix = Tcl_DStringValue(&dsPref); + path = AbsolutePath(prefix, &ds, 1); + len = Tcl_DStringLength(&ds); + if (strcmp(prefix, path) == 0) { + prefix = NULL; + } else { + strip = len + 1; + } + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, "/", 1); + prefixLen++; + prefix = Tcl_DStringValue(&dsPref); + } + ReadLock(); + if ((types != NULL) && (types->type == TCL_GLOB_TYPE_MOUNT)) { + l = CountSlashes(path); + if (path[len - 1] == '/') { + len--; + } else { + l++; + } + if ((pattern == NULL) || (pattern[0] == '\0')) { + pattern = "*"; + } + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + ZipFile *zf = (ZipFile *) Tcl_GetHashValue(hPtr); + + if (zf->mntptlen == 0) { + ZipEntry *z = zf->topents; + while (z != NULL) { + int lenz = strlen(z->name); + if ((lenz > len + 1) && + (strncmp(z->name, path, len) == 0) && + (z->name[len] == '/') && + (CountSlashes(z->name) == l) && + Tcl_StringCaseMatch(z->name + len + 1, pattern, 0)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, z->name, lenz); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(z->name, lenz)); + } + } + z = z->tnext; + } + } else if ((zf->mntptlen > len + 1) && + (strncmp(zf->mntpt, path, len) == 0) && + (zf->mntpt[len] == '/') && + (CountSlashes(zf->mntpt) == l) && + Tcl_StringCaseMatch(zf->mntpt + len + 1, pattern, 0)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, zf->mntpt, zf->mntptlen); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); + } + } + hPtr = Tcl_NextHashEntry(&search); + } + goto end; + } + if ((pattern == NULL) || (pattern[0] == '\0')) { + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path); + if (hPtr != NULL) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + + if ((dirOnly < 0) || + (!dirOnly && !z->isdir) || + (dirOnly && z->isdir)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, z->name, -1); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(z->name, -1)); + } + } + } + goto end; + } + l = strlen(pattern); + pat = Tcl_Alloc(len + l + 2); + memcpy(pat, path, len); + while ((len > 1) && (pat[len - 1] == '/')) { + --len; + } + if ((len > 1) || (pat[0] != '/')) { + pat[len] = '/'; + ++len; + } + memcpy(pat + len, pattern, l + 1); + scnt = CountSlashes(pat); + for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + if ((dirOnly >= 0) && + ((dirOnly && !z->isdir) || (!dirOnly && z->isdir))) { + continue; + } + if ((z->depth == scnt) && Tcl_StringCaseMatch(z->name, pat, 0)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, z->name + strip, -1); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(z->name + strip, -1)); + } + } + } + Tcl_Free(pat); +end: + Unlock(); + Tcl_DStringFree(&dsPref); + Tcl_DStringFree(&ds); + return TCL_OK; +} + +/* + *------------------------------------------------------------------------- + * + * Zip_FSPathInFilesystemProc -- + * + * This function determines if the given path object is in the + * ZIP filesystem. + * + * Results: + * TCL_OK when the path object is in the ZIP filesystem, -1 otherwise. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr) +{ + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + ZipFile *zf; + int ret = -1, len; + char *path; + Tcl_DString ds; + + path = Tcl_GetStringFromObj(pathPtr, &len); + if(strncmp(path,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN)!=0) { + return -1; + } + + Tcl_DStringInit(&ds); + path = CanonicalPath("",path, &ds, 1); + len = Tcl_DStringLength(&ds); + ReadLock(); + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path); + if (hPtr != NULL) { + ret = TCL_OK; + goto endloop; + } + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + zf = (ZipFile *) Tcl_GetHashValue(hPtr); + if (zf->mntptlen == 0) { + ZipEntry *z = zf->topents; + while (z != NULL) { + int lenz = strlen(z->name); + + if ((len >= lenz) && + (strncmp(path, z->name, lenz) == 0)) { + ret = TCL_OK; + goto endloop; + } + z = z->tnext; + } + } else if ((len >= zf->mntptlen) && + (strncmp(path, zf->mntpt, zf->mntptlen) == 0)) { + ret = TCL_OK; + goto endloop; + } + hPtr = Tcl_NextHashEntry(&search); + } +endloop: + Unlock(); + Tcl_DStringFree(&ds); + return ret; +} + +/* + *------------------------------------------------------------------------- + * + * Zip_FSListVolumesProc -- + * + * Lists the currently mounted ZIP filesystem volumes. + * + * Results: + * The list of volumes. + * + * Side effects: + * None + * + *------------------------------------------------------------------------- + */ +static Tcl_Obj * +Zip_FSListVolumesProc(void) { + return Tcl_NewStringObj(ZIPFS_VOLUME, -1); +} + +/* + *------------------------------------------------------------------------- + * + * Zip_FSFileAttrStringsProc -- + * + * This function implements the ZIP filesystem dependent 'file attributes' + * subcommand, for listing the set of possible attribute strings. + * + * Results: + * An array of strings + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static const char *const * +Zip_FSFileAttrStringsProc(Tcl_Obj *pathPtr, Tcl_Obj** objPtrRef) +{ + static const char *const attrs[] = { + "-uncompsize", + "-compsize", + "-offset", + "-mount", + "-archive", + "-permissions", + NULL, + }; + + return attrs; +} + +/* + *------------------------------------------------------------------------- + * + * Zip_FSFileAttrsGetProc -- + * + * This function implements the ZIP filesystem specific + * 'file attributes' subcommand, for 'get' operations. + * + * Results: + * Standard Tcl return code. The object placed in objPtrRef (if TCL_OK + * was returned) is likely to have a refCount of zero. Either way we must + * either store it somewhere (e.g. the Tcl result), or Incr/Decr its + * refCount to ensure it is properly freed. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +Zip_FSFileAttrsGetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, + Tcl_Obj **objPtrRef) +{ + int len, ret = TCL_OK; + char *path; + ZipEntry *z; + + path = Tcl_GetStringFromObj(pathPtr, &len); + ReadLock(); + z = ZipFSLookup(path); + if (z == NULL) { + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("file not found", -1)); + } + ret = TCL_ERROR; + goto done; + } + switch (index) { + case 0: + *objPtrRef = Tcl_NewIntObj(z->nbyte); + goto done; + case 1: + *objPtrRef= Tcl_NewIntObj(z->nbytecompr); + goto done; + case 2: + *objPtrRef= Tcl_NewLongObj(z->offset); + goto done; + case 3: + *objPtrRef= Tcl_NewStringObj(z->zipfile->mntpt, -1); + goto done; + case 4: + *objPtrRef= Tcl_NewStringObj(z->zipfile->name, -1); + goto done; + case 5: + *objPtrRef= Tcl_NewStringObj("0555", -1); + goto done; + } + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown attribute", -1)); + } + ret = TCL_ERROR; +done: + Unlock(); + return ret; +} + +/* + *------------------------------------------------------------------------- + * + * Zip_FSFileAttrsSetProc -- + * + * This function implements the ZIP filesystem specific + * 'file attributes' subcommand, for 'set' operations. + * + * Results: + * Standard Tcl return code. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +Zip_FSFileAttrsSetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, + Tcl_Obj *objPtr) +{ + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported operation", -1)); + } + return TCL_ERROR; +} + +/* + *------------------------------------------------------------------------- + * + * Zip_FSFilesystemPathTypeProc -- + * + * Results: + * + * Side effects: + * + *------------------------------------------------------------------------- + */ + +static Tcl_Obj * +Zip_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr) +{ + return Tcl_NewStringObj("zip", -1); +} + + +/* + *------------------------------------------------------------------------- + * + * Zip_FSLoadFile -- + * + * This functions deals with loading native object code. If + * the given path object refers to a file within the ZIP + * filesystem, an approriate error code is returned to delegate + * loading to the caller (by copying the file to temp store + * and loading from there). As fallback when the file refers + * to the ZIP file system but is not present, it is looked up + * relative to the executable and loaded from there when available. + * + * Results: + * TCL_OK on success, -1 otherwise with error number set. + * + * Side effects: + * Loads native code into the process address space. + * + *------------------------------------------------------------------------- + */ + +static int +Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, + Tcl_FSUnloadFileProc **unloadProcPtr, int flags) +{ + Tcl_FSLoadFileProc2 *loadFileProc; +#ifdef ANDROID + /* + * Force loadFileProc to native implementation since the + * package manger already extracted the shared libraries + * from the APK at install time. + */ + + loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; + if (loadFileProc != NULL) { + return loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); + } + Tcl_SetErrno(ENOENT); + return -1; +#else + Tcl_Obj *altPath = NULL; + int ret = -1; + + if (Tcl_FSAccess(path, R_OK) == 0) { + /* + * EXDEV should trigger loading by copying to temp store. + */ + Tcl_SetErrno(EXDEV); + return ret; + } else { + Tcl_Obj *objs[2] = { NULL, NULL }; + + objs[1] = TclPathPart(interp, path, TCL_PATH_DIRNAME); + if ((objs[1] != NULL) && (Zip_FSAccessProc(objs[1], R_OK) == 0)) { + const char *execName = Tcl_GetNameOfExecutable(); + + /* + * Shared object is not in ZIP but its path prefix is, + * thus try to load from directory where the executable + * came from. + */ + TclDecrRefCount(objs[1]); + objs[1] = TclPathPart(interp, path, TCL_PATH_TAIL); + /* + * Get directory name of executable manually to deal + * with cases where [file dirname [info nameofexecutable]] + * is equal to [info nameofexecutable] due to VFS effects. + */ + if (execName != NULL) { + const char *p = strrchr(execName, '/'); + + if (p > execName + 1) { + --p; + objs[0] = Tcl_NewStringObj(execName, p - execName); + } + } + if (objs[0] == NULL) { + objs[0] = TclPathPart(interp, TclGetObjNameOfExecutable(), + TCL_PATH_DIRNAME); + } + if (objs[0] != NULL) { + altPath = TclJoinPath(2, objs); + if (altPath != NULL) { + Tcl_IncrRefCount(altPath); + if (Tcl_FSAccess(altPath, R_OK) == 0) { + path = altPath; + } + } + } + } + if (objs[0] != NULL) { + Tcl_DecrRefCount(objs[0]); + } + if (objs[1] != NULL) { + Tcl_DecrRefCount(objs[1]); + } + } + loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; + if (loadFileProc != NULL) { + ret = loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); + } else { + Tcl_SetErrno(ENOENT); + } + if (altPath != NULL) { + Tcl_DecrRefCount(altPath); + } + return ret; +#endif +} + + +/* + * Define the ZIP filesystem dispatch table. + */ + +MODULE_SCOPE const Tcl_Filesystem zipfsFilesystem; + +const Tcl_Filesystem zipfsFilesystem = { + "zipfs", + sizeof (Tcl_Filesystem), + TCL_FILESYSTEM_VERSION_2, + Zip_FSPathInFilesystemProc, + NULL, /* dupInternalRepProc */ + NULL, /* freeInternalRepProc */ + NULL, /* internalToNormalizedProc */ + NULL, /* createInternalRepProc */ + NULL, /* normalizePathProc */ + Zip_FSFilesystemPathTypeProc, + Zip_FSFilesystemSeparatorProc, + Zip_FSStatProc, + Zip_FSAccessProc, + Zip_FSOpenFileChannelProc, + Zip_FSMatchInDirectoryProc, + NULL, /* utimeProc */ + NULL, /* linkProc */ + Zip_FSListVolumesProc, + Zip_FSFileAttrStringsProc, + Zip_FSFileAttrsGetProc, + Zip_FSFileAttrsSetProc, + NULL, /* createDirectoryProc */ + NULL, /* removeDirectoryProc */ + NULL, /* deleteFileProc */ + NULL, /* copyFileProc */ + NULL, /* renameFileProc */ + NULL, /* copyDirectoryProc */ + NULL, /* lstatProc */ + (Tcl_FSLoadFileProc *) Zip_FSLoadFile, + NULL, /* getCwdProc */ + NULL, /* chdirProc*/ +}; + +#endif /* HAVE_ZLIB */ + + + +/* + *------------------------------------------------------------------------- + * + * TclZipfsInit -- + * + * Perform per interpreter initialization of this module. + * + * Results: + * The return value is a standard Tcl result. + * + * Side effects: + * Initializes this module if not already initialized, and adds + * module related commands to the given interpreter. + * + *------------------------------------------------------------------------- + */ + +int +TclZipfsInit(Tcl_Interp *interp) +{ +#ifdef HAVE_ZLIB + /* one-time initialization */ + WriteLock(); + if (!ZipFS.initialized) { +#ifdef TCL_THREADS + static const Tcl_Time t = { 0, 0 }; + /* + * Inflate condition variable. + */ + Tcl_MutexLock(&ZipFSMutex); + Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, &t); + Tcl_MutexUnlock(&ZipFSMutex); +#endif + Tcl_FSRegister(NULL, &zipfsFilesystem); + Tcl_InitHashTable(&ZipFS.fileHash, TCL_STRING_KEYS); + Tcl_InitHashTable(&ZipFS.zipHash, TCL_STRING_KEYS); + ZipFS.initialized = ZipFS.idCount = 1; + } + Unlock(); + if(interp != NULL) { + static const EnsembleImplMap initMap[] = { + {"mount", ZipFSMountObjCmd, NULL, NULL, NULL, 0}, + {"unmount", ZipFSUnmountObjCmd, NULL, NULL, NULL, 0}, + {"mkkey", ZipFSMkKeyObjCmd, NULL, NULL, NULL, 0}, + {"mkimg", ZipFSMkImgObjCmd, NULL, NULL, NULL, 0}, + {"mkzip", ZipFSMkZipObjCmd, NULL, NULL, NULL, 0}, + {"lmkimg", ZipFSLMkImgObjCmd, NULL, NULL, NULL, 0}, + {"lmkzip", ZipFSLMkZipObjCmd, NULL, NULL, NULL, 0}, + {"exists", ZipFSExistsObjCmd, NULL, NULL, NULL, 1}, + {"info", ZipFSInfoObjCmd, NULL, NULL, NULL, 1}, + {"list", ZipFSListObjCmd, NULL, NULL, NULL, 1}, + {"canonical", ZipFSCanonicalObjCmd, NULL, NULL, NULL, 1}, + {NULL, NULL, NULL, NULL, NULL, 0} + }; + static const char findproc[] = + "namespace eval zipfs {}\n" + "proc ::zipfs::find dir {\n" + " set result {}\n" + " if {[catch {glob -directory $dir -tails -nocomplain * .*} list]} {\n" + " return $result\n" + " }\n" + " foreach file $list {\n" + " if {$file eq \".\" || $file eq \"..\"} {\n" + " continue\n" + " }\n" + " set file [file join $dir $file]\n" + " lappend result $file\n" + " foreach file [::zipfs::find $file] {\n" + " lappend result $file\n" + " }\n" + " }\n" + " return [lsort $result]\n" + "}\n"; + Tcl_EvalEx(interp, findproc, -1, TCL_EVAL_GLOBAL); + Tcl_LinkVar(interp, "::zipfs::wrmax", (char *) &ZipFS.wrmax, + TCL_LINK_INT); + TclMakeEnsemble(interp, "zipfs", initMap); + Tcl_PkgProvide(interp, "zipfs", "1.0"); + } + return TCL_OK; +#else + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("no zlib available", -1)); + } + return TCL_ERROR; +#endif +} + + +#ifndef HAVE_ZLIB + +/* + *------------------------------------------------------------------------- + * + * TclZipfsMount, TclZipfsUnmount -- + * + * Dummy version when no ZLIB support available. + * + *------------------------------------------------------------------------- + */ + +int +TclZipfsMount(Tcl_Interp *interp, const char *zipname, const char *mntpt, + const char *passwd) +{ + return TclZipFsInit(interp, 1); +} + +int +TclZipfsUnmount(Tcl_Interp *interp, const char *zipname) +{ + return TclZipFsInit(interp, 1); +} + +#endif + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/generic/tclZipfs.h b/generic/tclZipfs.h deleted file mode 100644 index 01c9e96..0000000 --- a/generic/tclZipfs.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * tclZipfs.h -- - * - * This header file describes the interface of the ZIPFS filesystem - * - * Copyright (c) 2013-2015 Christian Werner - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ - -#ifndef _ZIPFS_H -#define _ZIPFS_H - -#include "tcl.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef ZIPFSAPI -# define ZIPFSAPI extern -#endif - -#ifdef BUILD_tcl -# undef ZIPFSAPI -# define ZIPFSAPI DLLEXPORT -#endif - -ZIPFSAPI int Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, - const char *mntpt, const char *passwd); -ZIPFSAPI int Tclzipfs_Unmount(Tcl_Interp *interp, const char *zipname); -ZIPFSAPI int Tclzipfs_Init(Tcl_Interp *interp); -ZIPFSAPI int Tclzipfs_SafeInit(Tcl_Interp *interp); - -#ifdef __cplusplus -} -#endif - -#endif /* _ZIPFS_H */ - -/* - * Local Variables: - * mode: c - * c-basic-offset: 4 - * fill-column: 78 - * End: - */ diff --git a/generic/zipfs.c b/generic/zipfs.c deleted file mode 100644 index 70a8d6e..0000000 --- a/generic/zipfs.c +++ /dev/null @@ -1,4229 +0,0 @@ -/* - * zipfs.c -- - * - * Implementation of the ZIP filesystem used in AndroWish. - * - * Copyright (c) 2013-2015 Christian Werner - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ - -#include "tclInt.h" -#include "tclFileSystem.h" -#include "tclZipfs.h" - -#if !defined(_WIN32) && !defined(_WIN64) -#include -#endif -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_ZLIB -#include "zlib.h" -#include "zcrypt.h" - -/* - * Various constants and offsets found in ZIP archive files. - */ - -#define ZIP_SIG_LEN 4 - -/* Local header of ZIP archive member (at very beginning of each member). */ -#define ZIP_LOCAL_HEADER_SIG 0x04034b50 -#define ZIP_LOCAL_HEADER_LEN 30 -#define ZIP_LOCAL_SIG_OFFS 0 -#define ZIP_LOCAL_VERSION_OFFS 4 -#define ZIP_LOCAL_FLAGS_OFFS 6 -#define ZIP_LOCAL_COMPMETH_OFFS 8 -#define ZIP_LOCAL_MTIME_OFFS 10 -#define ZIP_LOCAL_MDATE_OFFS 12 -#define ZIP_LOCAL_CRC32_OFFS 14 -#define ZIP_LOCAL_COMPLEN_OFFS 18 -#define ZIP_LOCAL_UNCOMPLEN_OFFS 22 -#define ZIP_LOCAL_PATHLEN_OFFS 26 -#define ZIP_LOCAL_EXTRALEN_OFFS 28 - -/* Central header of ZIP archive member at end of ZIP file. */ -#define ZIP_CENTRAL_HEADER_SIG 0x02014b50 -#define ZIP_CENTRAL_HEADER_LEN 46 -#define ZIP_CENTRAL_SIG_OFFS 0 -#define ZIP_CENTRAL_VERSIONMADE_OFFS 4 -#define ZIP_CENTRAL_VERSION_OFFS 6 -#define ZIP_CENTRAL_FLAGS_OFFS 8 -#define ZIP_CENTRAL_COMPMETH_OFFS 10 -#define ZIP_CENTRAL_MTIME_OFFS 12 -#define ZIP_CENTRAL_MDATE_OFFS 14 -#define ZIP_CENTRAL_CRC32_OFFS 16 -#define ZIP_CENTRAL_COMPLEN_OFFS 20 -#define ZIP_CENTRAL_UNCOMPLEN_OFFS 24 -#define ZIP_CENTRAL_PATHLEN_OFFS 28 -#define ZIP_CENTRAL_EXTRALEN_OFFS 30 -#define ZIP_CENTRAL_FCOMMENTLEN_OFFS 32 -#define ZIP_CENTRAL_DISKFILE_OFFS 34 -#define ZIP_CENTRAL_IATTR_OFFS 36 -#define ZIP_CENTRAL_EATTR_OFFS 38 -#define ZIP_CENTRAL_LOCALHDR_OFFS 42 - -/* Central end signature at very end of ZIP file. */ -#define ZIP_CENTRAL_END_SIG 0x06054b50 -#define ZIP_CENTRAL_END_LEN 22 -#define ZIP_CENTRAL_END_SIG_OFFS 0 -#define ZIP_CENTRAL_DISKNO_OFFS 4 -#define ZIP_CENTRAL_DISKDIR_OFFS 6 -#define ZIP_CENTRAL_ENTS_OFFS 8 -#define ZIP_CENTRAL_TOTALENTS_OFFS 10 -#define ZIP_CENTRAL_DIRSIZE_OFFS 12 -#define ZIP_CENTRAL_DIRSTART_OFFS 16 -#define ZIP_CENTRAL_COMMENTLEN_OFFS 20 - -#define ZIP_MIN_VERSION 20 -#define ZIP_COMPMETH_STORED 0 -#define ZIP_COMPMETH_DEFLATED 8 - -#define ZIP_PASSWORD_END_SIG 0x5a5a4b50 - -/* - * Macros to read and write 16 and 32 bit integers from/to ZIP archives. - */ - -#define zip_read_int(p) \ - ((p)[0] | ((p)[1] << 8) | ((p)[2] << 16) | ((p)[3] << 24)) -#define zip_read_short(p) \ - ((p)[0] | ((p)[1] << 8)) - -#define zip_write_int(p, v) \ - (p)[0] = (v) & 0xff; (p)[1] = ((v) >> 8) & 0xff; \ - (p)[2] = ((v) >> 16) & 0xff; (p)[3] = ((v) >> 24) & 0xff; -#define zip_write_short(p, v) \ - (p)[0] = (v) & 0xff; (p)[1] = ((v) >> 8) & 0xff; - -/* - * Windows drive letters. - */ - -#if defined(_WIN32) || defined(_WIN64) -#define HAS_DRIVES 1 -static const char drvletters[] = - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; -#else -#define HAS_DRIVES 0 -#endif - -/* - * Mutex to protect localtime(3) when no reentrant version available. - */ - -#if !defined(_WIN32) && !defined(_WIN64) -#ifndef HAVE_LOCALTIME_R -#ifdef TCL_THREADS -TCL_DECLARE_MUTEX(localtimeMutex) -#endif -#endif -#endif - -/* - * In-core description of mounted ZIP archive file. - */ - -typedef struct ZipFile { - char *name; /* Archive name */ - Tcl_Channel chan; /* Channel handle or NULL */ - unsigned char *data; /* Memory mapped or malloc'ed file */ - long length; /* Length of memory mapped file */ - unsigned char *tofree; /* Non-NULL if malloc'ed file */ - int nfiles; /* Number of files in archive */ - int baseoffs; /* Archive start */ - int baseoffsp; /* Password start */ - int centoffs; /* Archive directory start */ - char pwbuf[264]; /* Password buffer */ -#if defined(_WIN32) || defined(_WIN64) - HANDLE mh; -#endif - int nopen; /* Number of open files on archive */ - struct ZipEntry *entries; /* List of files in archive */ - struct ZipEntry *topents; /* List of top-level dirs in archive */ -#if HAS_DRIVES - int mntdrv; /* Drive letter of mount point */ -#endif - int mntptlen; /* Length of mount point */ - char mntpt[1]; /* Mount point */ -} ZipFile; - -/* - * In-core description of file contained in mounted ZIP archive. - */ - -typedef struct ZipEntry { - char *name; /* The full pathname of the virtual file */ - ZipFile *zipfile; /* The ZIP file holding this virtual file */ - long offset; /* Data offset into memory mapped ZIP file */ - int nbyte; /* Uncompressed size of the virtual file */ - int nbytecompr; /* Compressed size of the virtual file */ - int cmeth; /* Compress method */ - int isdir; /* Set to 1 if directory */ - int depth; /* Number of slashes in path. */ - int crc32; /* CRC-32 */ - int timestamp; /* Modification time */ - int isenc; /* True if data is encrypted */ - unsigned char *data; /* File data if written */ - struct ZipEntry *next; /* Next file in the same archive */ - struct ZipEntry *tnext; /* Next top-level dir in archive */ -} ZipEntry; - -/* - * File channel for file contained in mounted ZIP archive. - */ - -typedef struct ZipChannel { - ZipFile *zipfile; /* The ZIP file holding this channel */ - ZipEntry *zipentry; /* Pointer back to virtual file */ - unsigned long nmax; /* Max. size for write */ - unsigned long nbyte; /* Number of bytes of uncompressed data */ - unsigned long nread; /* Pos of next byte to be read from the channel */ - unsigned char *ubuf; /* Pointer to the uncompressed data */ - int iscompr; /* True if data is compressed */ - int isdir; /* Set to 1 if directory */ - int isenc; /* True if data is encrypted */ - int iswr; /* True if open for writing */ - unsigned long keys[3]; /* Key for decryption */ -} ZipChannel; - -/* - * Global variables. - * - * Most are kept in single ZipFS struct. When build with threading - * support this struct is protected by the ZipFSMutex (see below). - * - * The "fileHash" component is the process wide global table of all known - * ZIP archive members in all mounted ZIP archives. - * - * The "zipHash" components is the process wide global table of all mounted - * ZIP archive files. - */ - -static struct { - int initialized; /* True when initialized */ - int lock; /* RW lock, see below */ - int waiters; /* RW lock, see below */ - int wrmax; /* Maximum write size of a file */ - int idCount; /* Counter for channel names */ - Tcl_HashTable fileHash; /* File name to ZipEntry mapping */ - Tcl_HashTable zipHash; /* Mount to ZipFile mapping */ -} ZipFS = { - 0, 0, 0, 0, 0, -}; - -/* - * For password rotation. - */ - -static const char pwrot[16] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0 -}; - -/* - * Table to compute CRC32. - */ - -static const unsigned int crc32tab[256] = { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, - 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, - 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, - 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, - 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, - 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, - 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, - 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, - 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, - 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, - 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, - 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, - 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, - 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, - 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, - 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, - 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, - 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, - 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, - 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, - 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, - 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, - 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, - 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, - 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, - 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, - 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, - 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, - 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, - 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, - 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, - 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, - 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, - 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, - 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, - 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, - 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, - 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, - 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, - 0x2d02ef8d, -}; - -/* - *------------------------------------------------------------------------- - * - * ReadLock, WriteLock, Unlock -- - * - * POSIX like rwlock functions to support multiple readers - * and single writer on internal structs. - * - * Limitations: - * - a read lock cannot be promoted to a write lock - * - a write lock may not be nested - * - *------------------------------------------------------------------------- - */ - -TCL_DECLARE_MUTEX(ZipFSMutex) - -#ifdef TCL_THREADS - -static Tcl_Condition ZipFSCond; - -static void -ReadLock(void) -{ - Tcl_MutexLock(&ZipFSMutex); - while (ZipFS.lock < 0) { - ZipFS.waiters++; - Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, NULL); - ZipFS.waiters--; - } - ZipFS.lock++; - Tcl_MutexUnlock(&ZipFSMutex); -} - -static void -WriteLock(void) -{ - Tcl_MutexLock(&ZipFSMutex); - while (ZipFS.lock != 0) { - ZipFS.waiters++; - Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, NULL); - ZipFS.waiters--; - } - ZipFS.lock = -1; - Tcl_MutexUnlock(&ZipFSMutex); -} - -static void -Unlock(void) -{ - Tcl_MutexLock(&ZipFSMutex); - if (ZipFS.lock > 0) { - --ZipFS.lock; - } else if (ZipFS.lock < 0) { - ZipFS.lock = 0; - } - if ((ZipFS.lock == 0) && (ZipFS.waiters > 0)) { - Tcl_ConditionNotify(&ZipFSCond); - } - Tcl_MutexUnlock(&ZipFSMutex); -} - -#else - -#define ReadLock() do {} while (0) -#define WriteLock() do {} while (0) -#define Unlock() do {} while (0) - -#endif - -/* - *------------------------------------------------------------------------- - * - * DosTimeDate, ToDosTime, ToDosDate -- - * - * Functions to perform conversions between DOS time stamps - * and POSIX time_t. - * - *------------------------------------------------------------------------- - */ - -static time_t -DosTimeDate(int dosDate, int dosTime) -{ - struct tm tm; - time_t ret; - - memset(&tm, 0, sizeof (tm)); - tm.tm_year = (((dosDate & 0xfe00) >> 9) + 80); - tm.tm_mon = ((dosDate & 0x1e0) >> 5) - 1; - tm.tm_mday = dosDate & 0x1f; - tm.tm_hour = (dosTime & 0xf800) >> 11; - tm.tm_min = (dosTime & 0x7e) >> 5; - tm.tm_sec = (dosTime & 0x1f) << 1; - ret = mktime(&tm); - if (ret == (time_t) -1) { - /* fallback to 1980-01-01T00:00:00+00:00 (DOS epoch) */ - ret = (time_t) 315532800; - } - return ret; -} - -static int -ToDosTime(time_t when) -{ - struct tm *tmp, tm; - -#ifdef TCL_THREADS -#if defined(_WIN32) || defined(_WIN64) - /* Win32 uses thread local storage */ - tmp = localtime(&when); - tm = *tmp; -#else -#ifdef HAVE_LOCALTIME_R - tmp = &tm; - localtime_r(&when, tmp); -#else - Tcl_MutexLock(&localtimeMutex); - tmp = localtime(&when); - tm = *tmp; - Tcl_MutexUnlock(&localtimeMutex); -#endif -#endif -#else - tmp = localtime(&when); - tm = *tmp; -#endif - return (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1); -} - -static int -ToDosDate(time_t when) -{ - struct tm *tmp, tm; - -#ifdef TCL_THREADS -#if defined(_WIN32) || defined(_WIN64) - /* Win32 uses thread local storage */ - tmp = localtime(&when); - tm = *tmp; -#else -#ifdef HAVE_LOCALTIME_R - tmp = &tm; - localtime_r(&when, tmp); -#else - Tcl_MutexLock(&localtimeMutex); - tmp = localtime(&when); - tm = *tmp; - Tcl_MutexUnlock(&localtimeMutex); -#endif -#endif -#else - tmp = localtime(&when); - tm = *tmp; -#endif - return ((tm.tm_year - 80) << 9) | ((tm.tm_mon + 1) << 5) | tm.tm_mday; -} - -/* - *------------------------------------------------------------------------- - * - * CountSlashes -- - * - * This function counts the number of slashes in a pathname string. - * - * Results: - * Number of slashes found in string. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -CountSlashes(const char *string) -{ - int count = 0; - const char *p = string; - - while (*p != '\0') { - if (*p == '/') { - count++; - } - p++; - } - return count; -} - -/* - *------------------------------------------------------------------------- - * - * CanonicalPath -- - * - * This function computes the canonical path from a directory - * and file name components into the specified Tcl_DString. - * - * Results: - * Returns the pointer to the canonical path contained in the - * specified Tcl_DString. - * - * Side effects: - * Modifies the specified Tcl_DString. - * - *------------------------------------------------------------------------- - */ - -static char * -CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr) -{ - char *path; - int i, j, c, isunc = 0; - -#if HAS_DRIVES - if ((tail[0] != '\0') && (strchr(drvletters, tail[0]) != NULL) && - (tail[1] == ':')) { - tail += 2; - } - /* UNC style path */ - if (tail[0] == '\\') { - root = ""; - ++tail; - } - if (tail[0] == '\\') { - root = "/"; - ++tail; - } -#endif - /* UNC style path */ - if ((root[0] == '/') && (root[1] == '/')) { - isunc = 1; - } - if (tail[0] == '/') { - root = ""; - ++tail; - isunc = 0; - } - if (tail[0] == '/') { - root = "/"; - ++tail; - isunc = 1; - } - i = strlen(root); - j = strlen(tail); - Tcl_DStringSetLength(dsPtr, i + j + 1); - path = Tcl_DStringValue(dsPtr); - memcpy(path, root, i); - path[i++] = '/'; - memcpy(path + i, tail, j); -#if HAS_DRIVES - for (i = 0; path[i] != '\0'; i++) { - if (path[i] == '\\') { - path[i] = '/'; - } - } -#endif - for (i = j = 0; (c = path[i]) != '\0'; i++) { - if (c == '/') { - int c2 = path[i + 1]; - - if (c2 == '/') { - continue; - } - if (c2 == '.') { - int c3 = path[i + 2]; - - if ((c3 == '/') || (c3 == '\0')) { - i++; - continue; - } - if ((c3 == '.') && - ((path[i + 3] == '/') || (path [i + 3] == '\0'))) { - i += 2; - while ((j > 0) && (path[j - 1] != '/')) { - j--; - } - if (j > isunc) { - --j; - while ((j > 1 + isunc) && (path[j - 2] == '/')) { - j--; - } - } - continue; - } - } - } - path[j++] = c; - } - if (j == 0) { - path[j++] = '/'; - } - path[j] = 0; - Tcl_DStringSetLength(dsPtr, j); - return Tcl_DStringValue(dsPtr); -} - -/* - *------------------------------------------------------------------------- - * - * AbsolutePath -- - * - * This function computes the absolute path from a given - * (relative) path name into the specified Tcl_DString. - * - * Results: - * Returns the pointer to the absolute path contained in the - * specified Tcl_DString. - * - * Side effects: - * Modifies the specified Tcl_DString. - * - *------------------------------------------------------------------------- - */ - -static char * -AbsolutePath(const char *path, -#if HAS_DRIVES - int *drvPtr, -#endif - Tcl_DString *dsPtr) -{ - char *result; - -#if HAS_DRIVES - if (drvPtr != NULL) { - *drvPtr = 0; - } -#endif - if (*path == '~') { - Tcl_DStringAppend(dsPtr, path, -1); - return Tcl_DStringValue(dsPtr); - } - if ((*path != '/') -#if HAS_DRIVES - && (*path != '\\') && - (((*path != '\0') && (strchr(drvletters, *path) == NULL)) || - (path[1] != ':')) -#endif - ) { - Tcl_DString pwd; - - /* relative path */ - Tcl_DStringInit(&pwd); - Tcl_GetCwd(NULL, &pwd); - result = Tcl_DStringValue(&pwd); -#if HAS_DRIVES - if ((result[0] != '\0') && (strchr(drvletters, result[0]) != NULL) && - (result[1] == ':')) { - if (drvPtr != NULL) { - drvPtr[0] = result[0]; - if ((drvPtr[0] >= 'a') && (drvPtr[0] <= 'z')) { - drvPtr[0] -= 'a' - 'A'; - } - } - result += 2; - } -#endif - result = CanonicalPath(result, path, dsPtr); - Tcl_DStringFree(&pwd); - } else { - /* absolute path */ -#if HAS_DRIVES - if ((path[0] != '\0') && (strchr(drvletters, path[0]) != NULL) && - (path[1] == ':')) { - if (drvPtr != NULL) { - drvPtr[0] = path[0]; - if ((drvPtr[0] >= 'a') && (drvPtr[0] <= 'z')) { - drvPtr[0] -= 'a' - 'A'; - } - } - } -#endif - result = CanonicalPath("", path, dsPtr); - } - return result; -} - -/* - *------------------------------------------------------------------------- - * - * ZipFSLookup -- - * - * This function returns the ZIP entry struct corresponding to - * the ZIP archive member of the given file name. - * - * Results: - * Returns the pointer to ZIP entry struct or NULL if the - * the given file name could not be found in the global list - * of ZIP archive members. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static ZipEntry * -ZipFSLookup(char *filename) -{ - char *realname; - Tcl_HashEntry *hPtr; - ZipEntry *z; - Tcl_DString ds; -#if HAS_DRIVES - int drive = 0; -#endif - - Tcl_DStringInit(&ds); -#if HAS_DRIVES - realname = AbsolutePath(filename, &drive, &ds); -#else - realname = AbsolutePath(filename, &ds); -#endif - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, realname); - z = hPtr ? (ZipEntry *) Tcl_GetHashValue(hPtr) : NULL; - Tcl_DStringFree(&ds); -#if HAS_DRIVES - if ((z != NULL) && drive && (drive != z->zipfile->mntdrv)) { - z = NULL; - } -#endif - return z; -} - -#ifdef NEVER_USED - -/* - *------------------------------------------------------------------------- - * - * ZipFSLookupMount -- - * - * This function returns an indication if the given file name - * corresponds to a mounted ZIP archive file. - * - * Results: - * Returns true, if the given file name is a mounted ZIP archive file. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -ZipFSLookupMount(char *filename) -{ - char *realname; - Tcl_HashEntry *hPtr; - Tcl_HashSearch search; - ZipFile *zf; - Tcl_DString ds; - int match = 0; -#if HAS_DRIVES - int drive = 0; -#endif - - Tcl_DStringInit(&ds); -#if HAS_DRIVES - realname = AbsolutePath(filename, &drive, &ds); -#else - realname = AbsolutePath(filename, &ds); -#endif - hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); - while (hPtr != NULL) { - if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { -#if HAS_DRIVES - if (drive && (drive != zf->mntdrv)) { - hPtr = Tcl_NextHashEntry(&search); - continue; - } -#endif - if (strcmp(zf->mntpt, realname) == 0) { - match = 1; - break; - } - } - hPtr = Tcl_NextHashEntry(&search); - } - Tcl_DStringFree(&ds); - return match; -} -#endif - -/* - *------------------------------------------------------------------------- - * - * ZipFSCloseArchive -- - * - * This function closes a mounted ZIP archive file. - * - * Results: - * None. - * - * Side effects: - * A memory mapped ZIP archive is unmapped, allocated memory is - * released. - * - *------------------------------------------------------------------------- - */ - -static void -ZipFSCloseArchive(Tcl_Interp *interp, ZipFile *zf) -{ -#if defined(_WIN32) || defined(_WIN64) - if ((zf->data != NULL) && (zf->tofree == NULL)) { - UnmapViewOfFile(zf->data); - zf->data = NULL; - } - if (zf->mh != INVALID_HANDLE_VALUE) { - CloseHandle(zf->mh); - } -#else - if ((zf->data != MAP_FAILED) && (zf->tofree == NULL)) { - munmap(zf->data, zf->length); - zf->data = MAP_FAILED; - } -#endif - if (zf->tofree != NULL) { - Tcl_Free((char *) zf->tofree); - zf->tofree = NULL; - } - Tcl_Close(interp, zf->chan); - zf->chan = NULL; -} - -/* - *------------------------------------------------------------------------- - * - * ZipFSOpenArchive -- - * - * This function opens a ZIP archive file for reading. An attempt - * is made to memory map that file. Otherwise it is read into - * an allocated memory buffer. The ZIP archive header is verified - * and must be valid for the function to succeed. When "needZip" - * is zero an embedded ZIP archive in an executable file is accepted. - * - * Results: - * TCL_OK on success, TCL_ERROR otherwise with an error message - * placed into the given "interp" if it is not NULL. - * - * Side effects: - * ZIP archive is memory mapped or read into allocated memory, - * the given ZipFile struct is filled with information about - * the ZIP archive file. - * - *------------------------------------------------------------------------- - */ - -static int -ZipFSOpenArchive(Tcl_Interp *interp, const char *zipname, int needZip, - ZipFile *zf) -{ - int i; - ClientData handle; - unsigned char *p, *q; - -#if defined(_WIN32) || defined(_WIN64) - zf->data = NULL; - zf->mh = INVALID_HANDLE_VALUE; -#else - zf->data = MAP_FAILED; -#endif - zf->length = 0; - zf->nfiles = 0; - zf->baseoffs = zf->baseoffsp = 0; - zf->tofree = NULL; - zf->pwbuf[0] = 0; - zf->chan = Tcl_OpenFileChannel(interp, zipname, "r", 0); - if (zf->chan == NULL) { - return TCL_ERROR; - } - if (Tcl_GetChannelHandle(zf->chan, TCL_READABLE, &handle) != TCL_OK) { - if (Tcl_SetChannelOption(interp, zf->chan, "-translation", "binary") - != TCL_OK) { - goto error; - } - if (Tcl_SetChannelOption(interp, zf->chan, "-encoding", "binary") - != TCL_OK) { - goto error; - } - zf->length = Tcl_Seek(zf->chan, 0, SEEK_END); - if ((zf->length <= 0) || (zf->length > 64 * 1024 * 1024)) { - if (interp) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("illegal file size", -1)); - } - goto error; - } - Tcl_Seek(zf->chan, 0, SEEK_SET); - zf->tofree = zf->data = (unsigned char *) Tcl_AttemptAlloc(zf->length); - if (zf->tofree == NULL) { - if (interp) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("out of memory", -1)); - } - goto error; - } - i = Tcl_Read(zf->chan, (char *) zf->data, zf->length); - if (i != zf->length) { - if (interp) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("file read error", -1)); - } - goto error; - } - Tcl_Close(interp, zf->chan); - zf->chan = NULL; - } else { -#if defined(_WIN32) || defined(_WIN64) - zf->length = GetFileSize((HANDLE) handle, 0); - if ((zf->length == INVALID_FILE_SIZE) || - (zf->length < ZIP_CENTRAL_END_LEN)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("invalid file size", -1)); - } - goto error; - } - zf->mh = CreateFileMapping((HANDLE) handle, 0, PAGE_READONLY, 0, - zf->length, 0); - if (zf->mh == INVALID_HANDLE_VALUE) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("file mapping failed", -1)); - } - goto error; - } - zf->data = MapViewOfFile(zf->mh, FILE_MAP_READ, 0, 0, zf->length); - if (zf->data == NULL) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("file mapping failed", -1)); - } - goto error; - } -#else - zf->length = lseek((int) (long) handle, 0, SEEK_END); - if ((zf->length == -1) || (zf->length < ZIP_CENTRAL_END_LEN)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("invalid file size", -1)); - } - goto error; - } - lseek((int) (long) handle, 0, SEEK_SET); - zf->data = (unsigned char *) mmap(0, zf->length, PROT_READ, - MAP_FILE | MAP_PRIVATE, - (int) (long) handle, 0); - if (zf->data == MAP_FAILED) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("file mapping failed", -1)); - } - goto error; - } -#endif - } - p = zf->data + zf->length - ZIP_CENTRAL_END_LEN; - while (p >= zf->data) { - if (*p == (ZIP_CENTRAL_END_SIG & 0xFF)) { - if (zip_read_int(p) == ZIP_CENTRAL_END_SIG) { - break; - } - p -= ZIP_SIG_LEN; - } else { - --p; - } - } - if (p < zf->data) { - if (!needZip) { - zf->baseoffs = zf->baseoffsp = zf->length; - return TCL_OK; - } - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("wrong end signature", -1)); - } - goto error; - } - zf->nfiles = zip_read_short(p + ZIP_CENTRAL_ENTS_OFFS); - if (zf->nfiles == 0) { - if (!needZip) { - zf->baseoffs = zf->baseoffsp = zf->length; - return TCL_OK; - } - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("empty archive", -1)); - } - goto error; - } - q = zf->data + zip_read_int(p + ZIP_CENTRAL_DIRSTART_OFFS); - p -= zip_read_int(p + ZIP_CENTRAL_DIRSIZE_OFFS); - if ((p < zf->data) || (p > (zf->data + zf->length)) || - (q < zf->data) || (q > (zf->data + zf->length))) { - if (!needZip) { - zf->baseoffs = zf->baseoffsp = zf->length; - return TCL_OK; - } - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("archive directory not found", -1)); - } - goto error; - } - zf->baseoffs = zf->baseoffsp = p - q; - zf->centoffs = p - zf->data; - q = p; - for (i = 0; i < zf->nfiles; i++) { - int pathlen, comlen, extra; - - if ((q + ZIP_CENTRAL_HEADER_LEN) > (zf->data + zf->length)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("wrong header length", -1)); - } - goto error; - } - if (zip_read_int(q) != ZIP_CENTRAL_HEADER_SIG) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("wrong header signature", -1)); - } - goto error; - } - pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); - comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); - extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); - q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; - } - q = zf->data + zf->baseoffs; - if ((zf->baseoffs >= 6) && - (zip_read_int(q - 4) == ZIP_PASSWORD_END_SIG)) { - i = q[-5]; - if (q - 5 - i > zf->data) { - zf->pwbuf[0] = i; - memcpy(zf->pwbuf + 1, q - 5 - i, i); - zf->baseoffsp -= i ? (5 + i) : 0; - } - } - return TCL_OK; - -error: - ZipFSCloseArchive(interp, zf); - return TCL_ERROR; -} - -/* - *------------------------------------------------------------------------- - * - * Tclzipfs_Mount -- - * - * This procedure is invoked to mount a given ZIP archive file on - * a given mountpoint with optional ZIP password. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * A ZIP archive file is read, analyzed and mounted, resources are - * allocated. - * - *------------------------------------------------------------------------- - */ - -int -Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, - const char *passwd) -{ - char *realname, *p; - int i, pwlen, isNew; - ZipFile *zf, zf0; - ZipEntry *z; - Tcl_HashEntry *hPtr; - Tcl_DString ds, dsm, fpBuf; - unsigned char *q; -#if HAS_DRIVES - int drive = 0; -#endif - - ReadLock(); - if (!ZipFS.initialized) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("not initialized", -1)); - } - Unlock(); - return TCL_ERROR; - } - if (zipname == NULL) { - Tcl_HashSearch search; - int ret = TCL_OK; - - i = 0; - hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); - while (hPtr != NULL) { - if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { - if (interp != NULL) { - Tcl_AppendElement(interp, zf->mntpt); - Tcl_AppendElement(interp, zf->name); - } - ++i; - } - hPtr = Tcl_NextHashEntry(&search); - } - if (interp == NULL) { - ret = (i > 0) ? TCL_OK : TCL_BREAK; - } - Unlock(); - return ret; - } - if (mntpt == NULL) { - if (interp == NULL) { - Unlock(); - return TCL_OK; - } - Tcl_DStringInit(&ds); -#if HAS_DRIVES - p = AbsolutePath(zipname, &drive, &ds); -#else - p = AbsolutePath(zipname, &ds); -#endif - hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, p); - if (hPtr != NULL) { - if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { -#if HAS_DRIVES - if (drive == zf->mntdrv) { - Tcl_Obj *string; - char drvbuf[3]; - - drvbuf[0] = zf->mntdrv; - drvbuf[1] = ':'; - drvbuf[2] = '\0'; - string = Tcl_NewStringObj(drvbuf, 2); - Tcl_AppendToObj(string, zf->mntpt, zf->mntptlen); - Tcl_SetObjResult(interp, string); - } -#else - Tcl_SetObjResult(interp, - Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); -#endif - } - } - Unlock(); - Tcl_DStringFree(&ds); - return TCL_OK; - } - Unlock(); - pwlen = 0; - if (passwd != NULL) { - pwlen = strlen(passwd); - if ((pwlen > 255) || (strchr(passwd, 0xff) != NULL)) { - if (interp) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("illegal password", -1)); - } - return TCL_ERROR; - } - } - if (ZipFSOpenArchive(interp, zipname, 1, &zf0) != TCL_OK) { - return TCL_ERROR; - } - Tcl_DStringInit(&ds); -#if HAS_DRIVES - realname = AbsolutePath(zipname, NULL, &ds); -#else - realname = AbsolutePath(zipname, &ds); -#endif - /* - * Mount point can come from Tcl_GetNameOfExecutable() - * which sometimes is a relative or otherwise denormalized path. - * But an absolute name is needed as mount point here. - */ - Tcl_DStringInit(&dsm); -#if HAS_DRIVES - mntpt = AbsolutePath(mntpt, &drive, &dsm); -#else - mntpt = AbsolutePath(mntpt, &dsm); -#endif - WriteLock(); - hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, realname, &isNew); - Tcl_DStringSetLength(&ds, 0); - if (!isNew) { - zf = (ZipFile *) Tcl_GetHashValue(hPtr); - if (interp != NULL) { - Tcl_AppendResult(interp, "already mounted on \"", zf->mntptlen ? - zf->mntpt : "/", "\"", (char *) NULL); - } - Unlock(); - Tcl_DStringFree(&ds); - Tcl_DStringFree(&dsm); - ZipFSCloseArchive(interp, &zf0); - return TCL_ERROR; - } - if (strcmp(mntpt, "/") == 0) { - mntpt = ""; - } - zf = (ZipFile *) Tcl_AttemptAlloc(sizeof (*zf) + strlen(mntpt) + 1); - if (zf == NULL) { - if (interp != NULL) { - Tcl_AppendResult(interp, "out of memory", (char *) NULL); - } - Unlock(); - Tcl_DStringFree(&ds); - Tcl_DStringFree(&dsm); - ZipFSCloseArchive(interp, &zf0); - return TCL_ERROR; - } - *zf = zf0; - zf->name = Tcl_GetHashKey(&ZipFS.zipHash, hPtr); - strcpy(zf->mntpt, mntpt); - zf->mntptlen = strlen(zf->mntpt); -#if HAS_DRIVES - for (p = zf->mntpt; *p != '\0'; p++) { - if (*p == '\\') { - *p = '/'; - } - } - zf->mntdrv = drive; -#endif - zf->entries = NULL; - zf->topents = NULL; - zf->nopen = 0; - Tcl_SetHashValue(hPtr, (ClientData) zf); - if ((zf->pwbuf[0] == 0) && pwlen) { - int k = 0; - - i = pwlen; - zf->pwbuf[k++] = i; - while (i > 0) { - zf->pwbuf[k] = (passwd[i - 1] & 0x0f) | - pwrot[(passwd[i - 1] >> 4) & 0x0f]; - k++; - i--; - } - zf->pwbuf[k] = '\0'; - } - if (mntpt[0] != '\0') { - z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); - z->name = NULL; - z->tnext = NULL; - z->depth = CountSlashes(mntpt); - z->zipfile = zf; - z->isdir = 1; - z->isenc = 0; - z->offset = zf->baseoffs; - z->crc32 = 0; - z->timestamp = 0; - z->nbyte = z->nbytecompr = 0; - z->cmeth = ZIP_COMPMETH_STORED; - z->data = NULL; - hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, mntpt, &isNew); - if (!isNew) { - /* skip it */ - Tcl_Free((char *) z); - } else { - Tcl_SetHashValue(hPtr, (ClientData) z); - z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); - z->next = zf->entries; - zf->entries = z; - } - } - q = zf->data + zf->centoffs; - Tcl_DStringInit(&fpBuf); - for (i = 0; i < zf->nfiles; i++) { - int pathlen, comlen, extra, isdir = 0, dosTime, dosDate, nbcompr, offs; - unsigned char *lq, *gq = NULL; - char *fullpath, *path; - - pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); - comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); - extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); - Tcl_DStringSetLength(&ds, 0); - Tcl_DStringAppend(&ds, (char *) q + ZIP_CENTRAL_HEADER_LEN, pathlen); - path = Tcl_DStringValue(&ds); - if ((pathlen > 0) && (path[pathlen - 1] == '/')) { - Tcl_DStringSetLength(&ds, pathlen - 1); - path = Tcl_DStringValue(&ds); - isdir = 1; - } - if ((strcmp(path, ".") == 0) || (strcmp(path, "..") == 0)) { - goto nextent; - } - lq = zf->data + zf->baseoffs + - zip_read_int(q + ZIP_CENTRAL_LOCALHDR_OFFS); - if ((lq < zf->data) || (lq > (zf->data + zf->length))) { - goto nextent; - } - nbcompr = zip_read_int(lq + ZIP_LOCAL_COMPLEN_OFFS); - if (!isdir && (nbcompr == 0) && - (zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS) == 0) && - (zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS) == 0)) { - gq = q; - nbcompr = zip_read_int(gq + ZIP_CENTRAL_COMPLEN_OFFS); - } - offs = (lq - zf->data) - + ZIP_LOCAL_HEADER_LEN - + zip_read_short(lq + ZIP_LOCAL_PATHLEN_OFFS) - + zip_read_short(lq + ZIP_LOCAL_EXTRALEN_OFFS); - if ((offs + nbcompr) > zf->length) { - goto nextent; - } - if (!isdir && (mntpt[0] == '\0') && !CountSlashes(path)) { -#ifdef ANDROID - /* - * When mounting the ZIP archive on the root directory try - * to remap top level regular files of the archive to - * /assets/.root/... since this directory should not be - * in a valid APK due to the leading dot in the file name - * component. This trick should make the files - * AndroidManifest.xml, resources.arsc, and classes.dex - * visible to Tcl. - */ - Tcl_DString ds2; - - Tcl_DStringInit(&ds2); - Tcl_DStringAppend(&ds2, "assets/.root/", -1); - Tcl_DStringAppend(&ds2, path, -1); - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, Tcl_DStringValue(&ds2)); - if (hPtr != NULL) { - /* should not happen but skip it anyway */ - Tcl_DStringFree(&ds2); - goto nextent; - } - Tcl_DStringSetLength(&ds, 0); - Tcl_DStringAppend(&ds, Tcl_DStringValue(&ds2), - Tcl_DStringLength(&ds2)); - path = Tcl_DStringValue(&ds); - Tcl_DStringFree(&ds2); -#else - /* - * Regular files skipped when mounting on root. - */ - goto nextent; -#endif - } - Tcl_DStringSetLength(&fpBuf, 0); - fullpath = CanonicalPath(mntpt, path, &fpBuf); - z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); - z->name = NULL; - z->tnext = NULL; - z->depth = CountSlashes(fullpath); - z->zipfile = zf; - z->isdir = isdir; - z->isenc = (zip_read_short(lq + ZIP_LOCAL_FLAGS_OFFS) & 1) - && (nbcompr > 12); - z->offset = offs; - if (gq != NULL) { - z->crc32 = zip_read_int(gq + ZIP_CENTRAL_CRC32_OFFS); - dosDate = zip_read_short(gq + ZIP_CENTRAL_MDATE_OFFS); - dosTime = zip_read_short(gq + ZIP_CENTRAL_MTIME_OFFS); - z->timestamp = DosTimeDate(dosDate, dosTime); - z->nbyte = zip_read_int(gq + ZIP_CENTRAL_UNCOMPLEN_OFFS); - z->cmeth = zip_read_short(gq + ZIP_CENTRAL_COMPMETH_OFFS); - } else { - z->crc32 = zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS); - dosDate = zip_read_short(lq + ZIP_LOCAL_MDATE_OFFS); - dosTime = zip_read_short(lq + ZIP_LOCAL_MTIME_OFFS); - z->timestamp = DosTimeDate(dosDate, dosTime); - z->nbyte = zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS); - z->cmeth = zip_read_short(lq + ZIP_LOCAL_COMPMETH_OFFS); - } - z->nbytecompr = nbcompr; - z->data = NULL; - hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, fullpath, &isNew); - if (!isNew) { - /* should not happen but skip it anyway */ - Tcl_Free((char *) z); - } else { - Tcl_SetHashValue(hPtr, (ClientData) z); - z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); - z->next = zf->entries; - zf->entries = z; - if (isdir && (mntpt[0] == '\0') && (z->depth == 1)) { - z->tnext = zf->topents; - zf->topents = z; - } - if (!z->isdir && (z->depth > 1)) { - char *dir, *end; - ZipEntry *zd; - - Tcl_DStringSetLength(&ds, strlen(z->name) + 8); - Tcl_DStringSetLength(&ds, 0); - Tcl_DStringAppend(&ds, z->name, -1); - dir = Tcl_DStringValue(&ds); - end = strrchr(dir, '/'); - while ((end != NULL) && (end != dir)) { - Tcl_DStringSetLength(&ds, end - dir); - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, dir); - if (hPtr != NULL) { - break; - } - zd = (ZipEntry *) Tcl_Alloc(sizeof (*zd)); - zd->name = NULL; - zd->tnext = NULL; - zd->depth = CountSlashes(dir); - zd->zipfile = zf; - zd->isdir = 1; - zd->isenc = 0; - zd->offset = z->offset; - zd->crc32 = 0; - zd->timestamp = z->timestamp; - zd->nbyte = zd->nbytecompr = 0; - zd->cmeth = ZIP_COMPMETH_STORED; - zd->data = NULL; - hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, dir, &isNew); - if (!isNew) { - /* should not happen but skip it anyway */ - Tcl_Free((char *) zd); - } else { - Tcl_SetHashValue(hPtr, (ClientData) zd); - zd->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); - zd->next = zf->entries; - zf->entries = zd; - if ((mntpt[0] == '\0') && (zd->depth == 1)) { - zd->tnext = zf->topents; - zf->topents = zd; - } - } - end = strrchr(dir, '/'); - } - } - } -nextent: - q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; - } - Unlock(); - Tcl_DStringFree(&fpBuf); - Tcl_DStringFree(&ds); - Tcl_DStringFree(&dsm); - Tcl_FSMountsChanged(NULL); - return TCL_OK; -} - -/* - *------------------------------------------------------------------------- - * - * Tclzipfs_Unmount -- - * - * This procedure is invoked to unmount a given ZIP archive. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * A mounted ZIP archive file is unmounted, resources are free'd. - * - *------------------------------------------------------------------------- - */ - -int -Tclzipfs_Unmount(Tcl_Interp *interp, const char *zipname) -{ - char *realname; - ZipFile *zf; - ZipEntry *z, *znext; - Tcl_HashEntry *hPtr; - Tcl_DString ds; - int ret = TCL_OK, unmounted = 0; -#if HAS_DRIVES - int drive = 0; -#endif - - Tcl_DStringInit(&ds); -#if HAS_DRIVES - realname = AbsolutePath(zipname, &drive, &ds); -#else - realname = AbsolutePath(zipname, &ds); -#endif - WriteLock(); - if (!ZipFS.initialized) { - goto done; - } - hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, realname); - if (hPtr == NULL) { - /* don't report error */ - goto done; - } - zf = (ZipFile *) Tcl_GetHashValue(hPtr); -#if HAS_DRIVES - if (drive != zf->mntdrv) { - /* don't report error */ - goto done; - } -#endif - if (zf->nopen > 0) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("filesystem is busy", -1)); - } - ret = TCL_ERROR; - goto done; - } - Tcl_DeleteHashEntry(hPtr); - for (z = zf->entries; z; z = znext) { - znext = z->next; - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, z->name); - if (hPtr) { - Tcl_DeleteHashEntry(hPtr); - } - if (z->data != NULL) { - Tcl_Free((char *) z->data); - } - Tcl_Free((char *) z); - } - ZipFSCloseArchive(interp, zf); - Tcl_Free((char *) zf); - unmounted = 1; -done: - Unlock(); - Tcl_DStringFree(&ds); - if (unmounted) { - Tcl_FSMountsChanged(NULL); - } - return ret; -} - -/* - *------------------------------------------------------------------------- - * - * ZipFSMountObjCmd -- - * - * This procedure is invoked to process the "zipfs::mount" command. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * A ZIP archive file is mounted, resources are allocated. - * - *------------------------------------------------------------------------- - */ - -static int -ZipFSMountObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ - if (objc > 4) { - Tcl_WrongNumArgs(interp, 1, objv, - "?zipfile? ?mountpoint? ?password?"); - return TCL_ERROR; - } - return Tclzipfs_Mount(interp, (objc > 1) ? Tcl_GetString(objv[1]) : NULL, - (objc > 2) ? Tcl_GetString(objv[2]) : NULL, - (objc > 3) ? Tcl_GetString(objv[3]) : NULL); -} - -/* - *------------------------------------------------------------------------- - * - * ZipFSUnmountObjCmd -- - * - * This procedure is invoked to process the "zipfs::unmount" command. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * A mounted ZIP archive file is unmounted, resources are free'd. - * - *------------------------------------------------------------------------- - */ - -static int -ZipFSUnmountObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ - if (objc != 2) { - Tcl_WrongNumArgs(interp, 1, objv, "zipfile"); - return TCL_ERROR; - } - return Tclzipfs_Unmount(interp, Tcl_GetString(objv[1])); -} - -/* - *------------------------------------------------------------------------- - * - * ZipFSMkKeyObjCmd -- - * - * This procedure is invoked to process the "zipfs::mkkey" command. - * It produces a rotated password to be embedded into an image file. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -ZipFSMkKeyObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ - int len, i = 0; - char *pw, pwbuf[264]; - - if (objc != 2) { - Tcl_WrongNumArgs(interp, 1, objv, "password"); - return TCL_ERROR; - } - pw = Tcl_GetString(objv[1]); - len = strlen(pw); - if (len == 0) { - return TCL_OK; - } - if ((len > 255) || (strchr(pw, 0xff) != NULL)) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("illegal password", -1)); - return TCL_ERROR; - } - while (len > 0) { - int ch = pw[len - 1]; - - pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; - i++; - len--; - } - pwbuf[i] = i; - ++i; - pwbuf[i++] = (char) ZIP_PASSWORD_END_SIG; - pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 8); - pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 16); - pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 24); - pwbuf[i] = '\0'; - Tcl_AppendResult(interp, pwbuf, (char *) NULL); - return TCL_OK; -} - -/* - *------------------------------------------------------------------------- - * - * ZipAddFile -- - * - * This procedure is used by ZipFSMkZipOrImgCmd() to add a single - * file to the output ZIP archive file being written. A ZipEntry - * struct about the input file is added to the given fileHash table - * for later creation of the central ZIP directory. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * Input file is read and (compressed and) written to the output - * ZIP archive file. - * - *------------------------------------------------------------------------- - */ - -static int -ZipAddFile(Tcl_Interp *interp, const char *path, const char *name, - Tcl_Channel out, const char *passwd, - char *buf, int bufsize, Tcl_HashTable *fileHash) -{ - Tcl_Channel in; - Tcl_HashEntry *hPtr; - ZipEntry *z; - z_stream stream; - const char *zpath; - int nbyte, nbytecompr, len, crc, flush, pos[3], zpathlen, olen; - int mtime = 0, isNew, align = 0, cmeth; - unsigned long keys[3], keys0[3]; - char obuf[4096]; - - zpath = name; - while (zpath != NULL && zpath[0] == '/') { - zpath++; - } - if ((zpath == NULL) || (zpath[0] == '\0')) { - return TCL_OK; - } - zpathlen = strlen(zpath); - if (zpathlen + ZIP_CENTRAL_HEADER_LEN > bufsize) { - Tcl_AppendResult(interp, "path too long for \"", path, "\"", - (char *) NULL); - return TCL_ERROR; - } - in = Tcl_OpenFileChannel(interp, path, "r", 0); - if ((in == NULL) || - (Tcl_SetChannelOption(interp, in, "-translation", "binary") - != TCL_OK) || - (Tcl_SetChannelOption(interp, in, "-encoding", "binary") - != TCL_OK)) { -#if defined(_WIN32) || defined(_WIN64) - /* hopefully a directory */ - if (strcmp("permission denied", Tcl_PosixError(interp)) == 0) { - Tcl_Close(interp, in); - return TCL_OK; - } -#endif - Tcl_Close(interp, in); - return TCL_ERROR; - } else { - Tcl_Obj *pathObj = Tcl_NewStringObj(path, -1); - Tcl_StatBuf statBuf; - - Tcl_IncrRefCount(pathObj); - if (Tcl_FSStat(pathObj, &statBuf) != -1) { - mtime = statBuf.st_mtime; - } - Tcl_DecrRefCount(pathObj); - } - Tcl_ResetResult(interp); - crc = 0; - nbyte = nbytecompr = 0; - while ((len = Tcl_Read(in, buf, bufsize)) > 0) { - crc = crc32(crc, (unsigned char *) buf, len); - nbyte += len; - } - if (len == -1) { - if (nbyte == 0) { - if (strcmp("illegal operation on a directory", - Tcl_PosixError(interp)) == 0) { - Tcl_Close(interp, in); - return TCL_OK; - } - } - Tcl_AppendResult(interp, "read error on \"", path, "\"", - (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; - } - if (Tcl_Seek(in, 0, SEEK_SET) == -1) { - Tcl_AppendResult(interp, "seek error on \"", path, "\"", - (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; - } - pos[0] = Tcl_Tell(out); - memset(buf, '\0', ZIP_LOCAL_HEADER_LEN); - memcpy(buf + ZIP_LOCAL_HEADER_LEN, zpath, zpathlen); - len = zpathlen + ZIP_LOCAL_HEADER_LEN; - if (Tcl_Write(out, buf, len) != len) { -wrerr: - Tcl_AppendResult(interp, "write error", (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; - } - if ((len + pos[0]) & 3) { - char abuf[8]; - - /* - * Align payload to next 4-byte boundary using a dummy extra - * entry similar to the zipalign tool from Android's SDK. - */ - align = 4 + ((len + pos[0]) & 3); - zip_write_short(abuf, 0xffff); - zip_write_short(abuf + 2, align - 4); - zip_write_int(abuf + 4, 0x03020100); - if (Tcl_Write(out, abuf, align) != align) { - goto wrerr; - } - } - if (passwd != NULL) { - int i, ch, tmp; - unsigned char kvbuf[24]; - Tcl_Obj *ret; - - init_keys(passwd, keys, crc32tab); - for (i = 0; i < 12 - 2; i++) { - if (Tcl_EvalEx(interp, "expr int(rand() * 256) % 256", -1, 0) != TCL_OK) { - Tcl_AppendResult(interp, "PRNG error", (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; - } - ret = Tcl_GetObjResult(interp); - if (Tcl_GetIntFromObj(interp, ret, &ch) != TCL_OK) { - Tcl_Close(interp, in); - return TCL_ERROR; - } - kvbuf[i + 12] = (unsigned char) zencode(keys, crc32tab, ch, tmp); - } - Tcl_ResetResult(interp); - init_keys(passwd, keys, crc32tab); - for (i = 0; i < 12 - 2; i++) { - kvbuf[i] = (unsigned char) zencode(keys, crc32tab, - kvbuf[i + 12], tmp); - } - kvbuf[i++] = (unsigned char) zencode(keys, crc32tab, crc >> 16, tmp); - kvbuf[i++] = (unsigned char) zencode(keys, crc32tab, crc >> 24, tmp); - len = Tcl_Write(out, (char *) kvbuf, 12); - memset(kvbuf, 0, 24); - if (len != 12) { - Tcl_AppendResult(interp, "write error", (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; - } - memcpy(keys0, keys, sizeof (keys0)); - nbytecompr += 12; - } - Tcl_Flush(out); - pos[2] = Tcl_Tell(out); - cmeth = ZIP_COMPMETH_DEFLATED; - memset(&stream, 0, sizeof (stream)); - stream.zalloc = Z_NULL; - stream.zfree = Z_NULL; - stream.opaque = Z_NULL; - if (deflateInit2(&stream, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) - != Z_OK) { - Tcl_AppendResult(interp, "compression init error on \"", path, "\"", - (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; - } - do { - len = Tcl_Read(in, buf, bufsize); - if (len == -1) { - Tcl_AppendResult(interp, "read error on \"", path, "\"", - (char *) NULL); - deflateEnd(&stream); - Tcl_Close(interp, in); - return TCL_ERROR; - } - stream.avail_in = len; - stream.next_in = (unsigned char *) buf; - flush = Tcl_Eof(in) ? Z_FINISH : Z_NO_FLUSH; - do { - stream.avail_out = sizeof (obuf); - stream.next_out = (unsigned char *) obuf; - len = deflate(&stream, flush); - if (len == Z_STREAM_ERROR) { - Tcl_AppendResult(interp, "deflate error on \"", path, "\"", - (char *) NULL); - deflateEnd(&stream); - Tcl_Close(interp, in); - return TCL_ERROR; - } - olen = sizeof (obuf) - stream.avail_out; - if (passwd != NULL) { - int i, tmp; - - for (i = 0; i < olen; i++) { - obuf[i] = (char) zencode(keys, crc32tab, obuf[i], tmp); - } - } - if (olen && (Tcl_Write(out, obuf, olen) != olen)) { - Tcl_AppendResult(interp, "write error", (char *) NULL); - deflateEnd(&stream); - Tcl_Close(interp, in); - return TCL_ERROR; - } - nbytecompr += olen; - } while (stream.avail_out == 0); - } while (flush != Z_FINISH); - deflateEnd(&stream); - Tcl_Flush(out); - pos[1] = Tcl_Tell(out); - if (nbyte - nbytecompr <= 0) { - /* - * Compressed file larger than input, - * write it again uncompressed. - */ - if ((int) Tcl_Seek(in, 0, SEEK_SET) != 0) { - goto seekErr; - } - if ((int) Tcl_Seek(out, pos[2], SEEK_SET) != pos[2]) { -seekErr: - Tcl_Close(interp, in); - Tcl_AppendResult(interp, "seek error", (char *) NULL); - return TCL_ERROR; - } - nbytecompr = (passwd != NULL) ? 12 : 0; - while (1) { - len = Tcl_Read(in, buf, bufsize); - if (len == -1) { - Tcl_AppendResult(interp, "read error on \"", path, "\"", - (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; - } else if (len == 0) { - break; - } - if (passwd != NULL) { - int i, tmp; - - for (i = 0; i < len; i++) { - buf[i] = (char) zencode(keys0, crc32tab, buf[i], tmp); - } - } - if (Tcl_Write(out, buf, len) != len) { - Tcl_AppendResult(interp, "write error", (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; - } - nbytecompr += len; - } - cmeth = ZIP_COMPMETH_STORED; - Tcl_Flush(out); - pos[1] = Tcl_Tell(out); - Tcl_TruncateChannel(out, pos[1]); - } - Tcl_Close(interp, in); - - z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); - z->name = NULL; - z->tnext = NULL; - z->depth = 0; - z->zipfile = NULL; - z->isdir = 0; - z->isenc = (passwd != NULL) ? 1 : 0; - z->offset = pos[0]; - z->crc32 = crc; - z->timestamp = mtime; - z->nbyte = nbyte; - z->nbytecompr = nbytecompr; - z->cmeth = cmeth; - z->data = NULL; - hPtr = Tcl_CreateHashEntry(fileHash, zpath, &isNew); - if (!isNew) { - Tcl_AppendResult(interp, "non-unique path name \"", path, "\"", - (char *) NULL); - Tcl_Free((char *) z); - return TCL_ERROR; - } else { - Tcl_SetHashValue(hPtr, (ClientData) z); - z->name = Tcl_GetHashKey(fileHash, hPtr); - z->next = NULL; - } - - /* - * Write final local header information. - */ - zip_write_int(buf + ZIP_LOCAL_SIG_OFFS, ZIP_LOCAL_HEADER_SIG); - zip_write_short(buf + ZIP_LOCAL_VERSION_OFFS, ZIP_MIN_VERSION); - zip_write_short(buf + ZIP_LOCAL_FLAGS_OFFS, z->isenc); - zip_write_short(buf + ZIP_LOCAL_COMPMETH_OFFS, z->cmeth); - zip_write_short(buf + ZIP_LOCAL_MTIME_OFFS, ToDosTime(z->timestamp)); - zip_write_short(buf + ZIP_LOCAL_MDATE_OFFS, ToDosDate(z->timestamp)); - zip_write_int(buf + ZIP_LOCAL_CRC32_OFFS, z->crc32); - zip_write_int(buf + ZIP_LOCAL_COMPLEN_OFFS, z->nbytecompr); - zip_write_int(buf + ZIP_LOCAL_UNCOMPLEN_OFFS, z->nbyte); - zip_write_short(buf + ZIP_LOCAL_PATHLEN_OFFS, zpathlen); - zip_write_short(buf + ZIP_LOCAL_EXTRALEN_OFFS, align); - if ((int) Tcl_Seek(out, pos[0], SEEK_SET) != pos[0]) { - Tcl_DeleteHashEntry(hPtr); - Tcl_Free((char *) z); - Tcl_AppendResult(interp, "seek error", (char *) NULL); - return TCL_ERROR; - } - if (Tcl_Write(out, buf, ZIP_LOCAL_HEADER_LEN) != ZIP_LOCAL_HEADER_LEN) { - Tcl_DeleteHashEntry(hPtr); - Tcl_Free((char *) z); - Tcl_AppendResult(interp, "write error", (char *) NULL); - return TCL_ERROR; - } - Tcl_Flush(out); - if ((int) Tcl_Seek(out, pos[1], SEEK_SET) != pos[1]) { - Tcl_DeleteHashEntry(hPtr); - Tcl_Free((char *) z); - Tcl_AppendResult(interp, "seek error", (char *) NULL); - return TCL_ERROR; - } - return TCL_OK; -} - -/* - *------------------------------------------------------------------------- - * - * ZipFSMkZipOrImgObjCmd -- - * - * This procedure is creates a new ZIP archive file or image file - * given output filename, input directory of files to be archived, - * optional password, and optional image to be prepended to the - * output ZIP archive file. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * A new ZIP archive file or image file is written. - * - *------------------------------------------------------------------------- - */ - -static int -ZipFSMkZipOrImgObjCmd(ClientData clientData, Tcl_Interp *interp, - int isImg, int isList, int objc, Tcl_Obj *const objv[]) -{ - Tcl_Channel out; - int len = 0, pwlen = 0, slen = 0, i, count, ret = TCL_ERROR, lobjc, pos[3]; - Tcl_Obj **lobjv, *list = NULL; - ZipEntry *z; - Tcl_HashEntry *hPtr; - Tcl_HashSearch search; - Tcl_HashTable fileHash; - char *strip = NULL, *pw = NULL, pwbuf[264], buf[4096]; - - if (isList) { - if ((objc < 3) || (objc > (isImg ? 5 : 4))) { - Tcl_WrongNumArgs(interp, 1, objv, isImg ? - "outfile inlist ?password infile?" : - "outfile inlist ?password?"); - return TCL_ERROR; - } - } else { - if ((objc < 3) || (objc > (isImg ? 6 : 5))) { - Tcl_WrongNumArgs(interp, 1, objv, isImg ? - "outfile indir ?strip? ?password? ?infile?" : - "outfile indir ?strip? ?password?"); - return TCL_ERROR; - } - } - pwbuf[0] = 0; - if (objc > (isList ? 3 : 4)) { - pw = Tcl_GetString(objv[isList ? 3 : 4]); - pwlen = strlen(pw); - if ((pwlen > 255) || (strchr(pw, 0xff) != NULL)) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("illegal password", -1)); - return TCL_ERROR; - } - } - if (isList) { - list = objv[2]; - Tcl_IncrRefCount(list); - } else { - Tcl_Obj *cmd[3]; - - cmd[1] = Tcl_NewStringObj("::zipfs::find", -1); - cmd[2] = objv[2]; - cmd[0] = Tcl_NewListObj(2, cmd + 1); - Tcl_IncrRefCount(cmd[0]); - if (Tcl_EvalObjEx(interp, cmd[0], TCL_EVAL_DIRECT) != TCL_OK) { - Tcl_DecrRefCount(cmd[0]); - return TCL_ERROR; - } - Tcl_DecrRefCount(cmd[0]); - list = Tcl_GetObjResult(interp); - Tcl_IncrRefCount(list); - } - if (Tcl_ListObjGetElements(interp, list, &lobjc, &lobjv) != TCL_OK) { - Tcl_DecrRefCount(list); - return TCL_ERROR; - } - if (isList && (lobjc % 2)) { - Tcl_DecrRefCount(list); - Tcl_SetObjResult(interp, - Tcl_NewStringObj("need even number of elements", -1)); - return TCL_ERROR; - } - if (lobjc == 0) { - Tcl_DecrRefCount(list); - Tcl_SetObjResult(interp, Tcl_NewStringObj("empty archive", -1)); - return TCL_ERROR; - } - out = Tcl_OpenFileChannel(interp, Tcl_GetString(objv[1]), "w", 0755); - if ((out == NULL) || - (Tcl_SetChannelOption(interp, out, "-translation", "binary") - != TCL_OK) || - (Tcl_SetChannelOption(interp, out, "-encoding", "binary") - != TCL_OK)) { - Tcl_DecrRefCount(list); - Tcl_Close(interp, out); - return TCL_ERROR; - } - if (isImg) { - ZipFile zf0; - const char *imgName; - - if (isList) { - imgName = (objc > 4) ? Tcl_GetString(objv[4]) : - Tcl_GetNameOfExecutable(); - } else { - imgName = (objc > 5) ? Tcl_GetString(objv[5]) : - Tcl_GetNameOfExecutable(); - } - if (ZipFSOpenArchive(interp, imgName, 0, &zf0) != TCL_OK) { - Tcl_DecrRefCount(list); - Tcl_Close(interp, out); - return TCL_ERROR; - } - if ((pw != NULL) && pwlen) { - i = 0; - len = pwlen; - while (len > 0) { - int ch = pw[len - 1]; - - pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; - i++; - len--; - } - pwbuf[i] = i; - ++i; - pwbuf[i++] = (char) ZIP_PASSWORD_END_SIG; - pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 8); - pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 16); - pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 24); - pwbuf[i] = '\0'; - } - i = Tcl_Write(out, (char *) zf0.data, zf0.baseoffsp); - if (i != zf0.baseoffsp) { - Tcl_DecrRefCount(list); - Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); - Tcl_Close(interp, out); - ZipFSCloseArchive(interp, &zf0); - return TCL_ERROR; - } - ZipFSCloseArchive(interp, &zf0); - len = strlen(pwbuf); - if (len > 0) { - i = Tcl_Write(out, pwbuf, len); - if (i != len) { - Tcl_DecrRefCount(list); - Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); - Tcl_Close(interp, out); - return TCL_ERROR; - } - } - memset(pwbuf, 0, sizeof (pwbuf)); - Tcl_Flush(out); - } - Tcl_InitHashTable(&fileHash, TCL_STRING_KEYS); - pos[0] = Tcl_Tell(out); - if (!isList && (objc > 3)) { - strip = Tcl_GetString(objv[3]); - slen = strlen(strip); - } - for (i = 0; i < lobjc; i += (isList ? 2 : 1)) { - const char *path, *name; - - path = Tcl_GetString(lobjv[i]); - if (isList) { - name = Tcl_GetString(lobjv[i + 1]); - } else { - name = path; - if (slen > 0) { - len = strlen(name); - if ((len <= slen) || (strncmp(strip, name, slen) != 0)) { - continue; - } - name += slen; - } - } - while (name[0] == '/') { - ++name; - } - if (name[0] == '\0') { - continue; - } - if (ZipAddFile(interp, path, name, out, pw, buf, sizeof (buf), - &fileHash) != TCL_OK) { - goto done; - } - } - pos[1] = Tcl_Tell(out); - count = 0; - for (i = 0; i < lobjc; i += (isList ? 2 : 1)) { - const char *path, *name; - - path = Tcl_GetString(lobjv[i]); - if (isList) { - name = Tcl_GetString(lobjv[i + 1]); - } else { - name = path; - if (slen > 0) { - len = strlen(name); - if ((len <= slen) || (strncmp(strip, name, slen) != 0)) { - continue; - } - name += slen; - } - } - while (name[0] == '/') { - ++name; - } - if (name[0] == '\0') { - continue; - } - hPtr = Tcl_FindHashEntry(&fileHash, name); - if (hPtr == NULL) { - continue; - } - z = (ZipEntry *) Tcl_GetHashValue(hPtr); - len = strlen(z->name); - zip_write_int(buf + ZIP_CENTRAL_SIG_OFFS, ZIP_CENTRAL_HEADER_SIG); - zip_write_short(buf + ZIP_CENTRAL_VERSIONMADE_OFFS, ZIP_MIN_VERSION); - zip_write_short(buf + ZIP_CENTRAL_VERSION_OFFS, ZIP_MIN_VERSION); - zip_write_short(buf + ZIP_CENTRAL_FLAGS_OFFS, z->isenc ? 1 : 0); - zip_write_short(buf + ZIP_CENTRAL_COMPMETH_OFFS, z->cmeth); - zip_write_short(buf + ZIP_CENTRAL_MTIME_OFFS, ToDosTime(z->timestamp)); - zip_write_short(buf + ZIP_CENTRAL_MDATE_OFFS, ToDosDate(z->timestamp)); - zip_write_int(buf + ZIP_CENTRAL_CRC32_OFFS, z->crc32); - zip_write_int(buf + ZIP_CENTRAL_COMPLEN_OFFS, z->nbytecompr); - zip_write_int(buf + ZIP_CENTRAL_UNCOMPLEN_OFFS, z->nbyte); - zip_write_short(buf + ZIP_CENTRAL_PATHLEN_OFFS, len); - zip_write_short(buf + ZIP_CENTRAL_EXTRALEN_OFFS, 0); - zip_write_short(buf + ZIP_CENTRAL_FCOMMENTLEN_OFFS, 0); - zip_write_short(buf + ZIP_CENTRAL_DISKFILE_OFFS, 0); - zip_write_short(buf + ZIP_CENTRAL_IATTR_OFFS, 0); - zip_write_int(buf + ZIP_CENTRAL_EATTR_OFFS, 0); - zip_write_int(buf + ZIP_CENTRAL_LOCALHDR_OFFS, z->offset - pos[0]); - if ((Tcl_Write(out, buf, ZIP_CENTRAL_HEADER_LEN) != - ZIP_CENTRAL_HEADER_LEN) || - (Tcl_Write(out, z->name, len) != len)) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); - goto done; - } - count++; - } - Tcl_Flush(out); - pos[2] = Tcl_Tell(out); - zip_write_int(buf + ZIP_CENTRAL_END_SIG_OFFS, ZIP_CENTRAL_END_SIG); - zip_write_short(buf + ZIP_CENTRAL_DISKNO_OFFS, 0); - zip_write_short(buf + ZIP_CENTRAL_DISKDIR_OFFS, 0); - zip_write_short(buf + ZIP_CENTRAL_ENTS_OFFS, count); - zip_write_short(buf + ZIP_CENTRAL_TOTALENTS_OFFS, count); - zip_write_int(buf + ZIP_CENTRAL_DIRSIZE_OFFS, pos[2] - pos[1]); - zip_write_int(buf + ZIP_CENTRAL_DIRSTART_OFFS, pos[1] - pos[0]); - zip_write_short(buf + ZIP_CENTRAL_COMMENTLEN_OFFS, 0); - if (Tcl_Write(out, buf, ZIP_CENTRAL_END_LEN) != ZIP_CENTRAL_END_LEN) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); - goto done; - } - Tcl_Flush(out); - ret = TCL_OK; -done: - if (ret == TCL_OK) { - ret = Tcl_Close(interp, out); - } else { - Tcl_Close(interp, out); - } - Tcl_DecrRefCount(list); - hPtr = Tcl_FirstHashEntry(&fileHash, &search); - while (hPtr != NULL) { - z = (ZipEntry *) Tcl_GetHashValue(hPtr); - Tcl_Free((char *) z); - Tcl_DeleteHashEntry(hPtr); - hPtr = Tcl_FirstHashEntry(&fileHash, &search); - } - Tcl_DeleteHashTable(&fileHash); - return ret; -} - -/* - *------------------------------------------------------------------------- - * - * ZipFSMkZipObjCmd -- - * - * This procedure is invoked to process the "zipfs::mkzip" command. - * See description of ZipFSMkZipOrImgCmd(). - * - * Results: - * A standard Tcl result. - * - * Side effects: - * See description of ZipFSMkZipOrImgCmd(). - * - *------------------------------------------------------------------------- - */ - -static int -ZipFSMkZipObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ - return ZipFSMkZipOrImgObjCmd(clientData, interp, 0, 0, objc, objv); -} - -static int -ZipFSLMkZipObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ - return ZipFSMkZipOrImgObjCmd(clientData, interp, 0, 1, objc, objv); -} - -/* - *------------------------------------------------------------------------- - * - * ZipFSMkImgObjCmd -- - * - * This procedure is invoked to process the "zipfs::mkimg" command. - * See description of ZipFSMkZipOrImgCmd(). - * - * Results: - * A standard Tcl result. - * - * Side effects: - * See description of ZipFSMkZipOrImgCmd(). - * - *------------------------------------------------------------------------- - */ - -static int -ZipFSMkImgObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ - return ZipFSMkZipOrImgObjCmd(clientData, interp, 1, 0, objc, objv); -} - -static int -ZipFSLMkImgObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ - return ZipFSMkZipOrImgObjCmd(clientData, interp, 1, 1, objc, objv); -} - -/* - *------------------------------------------------------------------------- - * - * ZipFSExistsObjCmd -- - * - * This procedure is invoked to process the "zipfs::exists" command. - * It tests for the existence of a file in the ZIP filesystem and - * places a boolean into the interp's result. - * - * Results: - * Always TCL_OK. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -ZipFSExistsObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ - char *filename; - int exists; - - if (objc != 2) { - Tcl_WrongNumArgs(interp, 1, objv, "filename"); - return TCL_ERROR; - } - filename = Tcl_GetStringFromObj(objv[1], 0); - ReadLock(); - exists = ZipFSLookup(filename) != NULL; - Unlock(); - Tcl_SetBooleanObj(Tcl_GetObjResult(interp), exists); - return TCL_OK; -} - -/* - *------------------------------------------------------------------------- - * - * ZipFSInfoObjCmd -- - * - * This procedure is invoked to process the "zipfs::info" command. - * On success, it returns a Tcl list made up of name of ZIP archive - * file, size uncompressed, size compressed, and archive offset of - * a file in the ZIP filesystem. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -ZipFSInfoObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ - char *filename; - ZipEntry *z; - - if (objc != 2) { - Tcl_WrongNumArgs(interp, 1, objv, "filename"); - return TCL_ERROR; - } - filename = Tcl_GetStringFromObj(objv[1], 0); - ReadLock(); - z = ZipFSLookup(filename); - if (z != NULL) { - Tcl_Obj *result = Tcl_GetObjResult(interp); - - Tcl_ListObjAppendElement(interp, result, - Tcl_NewStringObj(z->zipfile->name, -1)); - Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->nbyte)); - Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->nbytecompr)); - Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->offset)); - } - Unlock(); - return TCL_OK; -} - -/* - *------------------------------------------------------------------------- - * - * ZipFSListObjCmd -- - * - * This procedure is invoked to process the "zipfs::list" command. - * On success, it returns a Tcl list of files of the ZIP filesystem - * which match a search pattern (glob or regexp). - * - * Results: - * A standard Tcl result. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -ZipFSListObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ - char *pattern = NULL; - Tcl_RegExp regexp = NULL; - Tcl_HashEntry *hPtr; - Tcl_HashSearch search; - Tcl_Obj *result = Tcl_GetObjResult(interp); - - if (objc > 3) { - Tcl_WrongNumArgs(interp, 1, objv, "?(-glob|-regexp)? ?pattern?"); - return TCL_ERROR; - } - if (objc == 3) { - int n; - char *what = Tcl_GetStringFromObj(objv[1], &n); - - if ((n >= 2) && (strncmp(what, "-glob", n) == 0)) { - pattern = Tcl_GetString(objv[2]); - } else if ((n >= 2) && (strncmp(what, "-regexp", n) == 0)) { - regexp = Tcl_RegExpCompile(interp, Tcl_GetString(objv[2])); - if (regexp == NULL) { - return TCL_ERROR; - } - } else { - Tcl_AppendResult(interp, "unknown option \"", what, - "\"", (char *) NULL); - return TCL_ERROR; - } - } else if (objc == 2) { - pattern = Tcl_GetStringFromObj(objv[1], 0); - } - ReadLock(); - if (pattern != NULL) { - for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); - hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); - - if (Tcl_StringMatch(z->name, pattern)) { - Tcl_ListObjAppendElement(interp, result, - Tcl_NewStringObj(z->name, -1)); - } - } - } else if (regexp != NULL) { - for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); - hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); - - if (Tcl_RegExpExec(interp, regexp, z->name, z->name)) { - Tcl_ListObjAppendElement(interp, result, - Tcl_NewStringObj(z->name, -1)); - } - } - } else { - for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); - hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); - - Tcl_ListObjAppendElement(interp, result, - Tcl_NewStringObj(z->name, -1)); - } - } - Unlock(); - return TCL_OK; -} - -/* - *------------------------------------------------------------------------- - * - * ZipChannelClose -- - * - * This function is called to close a channel. - * - * Results: - * Always TCL_OK. - * - * Side effects: - * Resources are free'd. - * - *------------------------------------------------------------------------- - */ - -static int -ZipChannelClose(ClientData instanceData, Tcl_Interp *interp) -{ - ZipChannel *info = (ZipChannel *) instanceData; - - if (info->iscompr && (info->ubuf != NULL)) { - Tcl_Free((char *) info->ubuf); - info->ubuf = NULL; - } - if (info->isenc) { - info->isenc = 0; - memset(info->keys, 0, sizeof (info->keys)); - } - if (info->iswr) { - ZipEntry *z = info->zipentry; - unsigned char *newdata; - - newdata = (unsigned char *) - Tcl_AttemptRealloc((char *) info->ubuf, info->nread); - if (newdata != NULL) { - if (z->data != NULL) { - Tcl_Free((char *) z->data); - } - z->data = newdata; - z->nbyte = z->nbytecompr = info->nbyte; - z->cmeth = ZIP_COMPMETH_STORED; - z->timestamp = time(NULL); - z->isdir = 0; - z->isenc = 0; - z->offset = 0; - z->crc32 = 0; - } else { - Tcl_Free((char *) info->ubuf); - } - } - WriteLock(); - info->zipfile->nopen--; - Unlock(); - Tcl_Free((char *) info); - return TCL_OK; -} - -/* - *------------------------------------------------------------------------- - * - * ZipChannelRead -- - * - * This function is called to read data from channel. - * - * Results: - * Number of bytes read or -1 on error with error number set. - * - * Side effects: - * Data is read and file pointer is advanced. - * - *------------------------------------------------------------------------- - */ - -static int -ZipChannelRead(ClientData instanceData, char *buf, int toRead, int *errloc) -{ - ZipChannel *info = (ZipChannel *) instanceData; - unsigned long nextpos; - - if (info->isdir) { - *errloc = EISDIR; - return -1; - } - nextpos = info->nread + toRead; - if (nextpos > info->nbyte) { - toRead = info->nbyte - info->nread; - nextpos = info->nbyte; - } - if (toRead == 0) { - return 0; - } - if (info->isenc) { - int i, ch; - - for (i = 0; i < toRead; i++) { - ch = info->ubuf[i + info->nread]; - buf[i] = zdecode(info->keys, crc32tab, ch); - } - } else { - memcpy(buf, info->ubuf + info->nread, toRead); - } - info->nread = nextpos; - *errloc = 0; - return toRead; -} - -/* - *------------------------------------------------------------------------- - * - * ZipChannelWrite -- - * - * This function is called to write data into channel. - * - * Results: - * Number of bytes written or -1 on error with error number set. - * - * Side effects: - * Data is written and file pointer is advanced. - * - *------------------------------------------------------------------------- - */ - -static int -ZipChannelWrite(ClientData instanceData, const char *buf, - int toWrite, int *errloc) -{ - ZipChannel *info = (ZipChannel *) instanceData; - unsigned long nextpos; - - if (!info->iswr) { - *errloc = EINVAL; - return -1; - } - nextpos = info->nread + toWrite; - if (nextpos > info->nmax) { - toWrite = info->nmax - info->nread; - nextpos = info->nmax; - } - if (toWrite == 0) { - return 0; - } - memcpy(info->ubuf + info->nread, buf, toWrite); - info->nread = nextpos; - if (info->nread > info->nbyte) { - info->nbyte = info->nread; - } - *errloc = 0; - return toWrite; -} - -/* - *------------------------------------------------------------------------- - * - * ZipChannelSeek -- - * - * This function is called to position file pointer of channel. - * - * Results: - * New file position or -1 on error with error number set. - * - * Side effects: - * File pointer is repositioned according to offset and mode. - * - *------------------------------------------------------------------------- - */ - -static int -ZipChannelSeek(ClientData instanceData, long offset, int mode, int *errloc) -{ - ZipChannel *info = (ZipChannel *) instanceData; - - if (info->isdir) { - *errloc = EINVAL; - return -1; - } - switch (mode) { - case SEEK_CUR: - offset += info->nread; - break; - case SEEK_END: - offset += info->nbyte; - break; - case SEEK_SET: - break; - default: - *errloc = EINVAL; - return -1; - } - if (offset < 0) { - *errloc = EINVAL; - return -1; - } - if (info->iswr) { - if ((unsigned long) offset > info->nmax) { - *errloc = EINVAL; - return -1; - } - if ((unsigned long) offset > info->nbyte) { - info->nbyte = offset; - } - } else if ((unsigned long) offset > info->nbyte) { - *errloc = EINVAL; - return -1; - } - info->nread = (unsigned long) offset; - return info->nread; -} - -/* - *------------------------------------------------------------------------- - * - * ZipChannelWatchChannel -- - * - * This function is called for event notifications on channel. - * - * Results: - * None. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static void -ZipChannelWatchChannel(ClientData instanceData, int mask) -{ - return; -} - -/* - *------------------------------------------------------------------------- - * - * ZipChannelGetFile -- - * - * This function is called to retrieve OS handle for channel. - * - * Results: - * Always TCL_ERROR since there's never an OS handle for a - * file within a ZIP archive. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -ZipChannelGetFile(ClientData instanceData, int direction, - ClientData *handlePtr) -{ - return TCL_ERROR; -} - -/* - * The channel type/driver definition used for ZIP archive members. - */ - -static Tcl_ChannelType ZipChannelType = { - "zip", /* Type name. */ -#ifdef TCL_CHANNEL_VERSION_4 - TCL_CHANNEL_VERSION_4, - ZipChannelClose, /* Close channel, clean instance data */ - ZipChannelRead, /* Handle read request */ - ZipChannelWrite, /* Handle write request */ - ZipChannelSeek, /* Move location of access point, NULL'able */ - NULL, /* Set options, NULL'able */ - NULL, /* Get options, NULL'able */ - ZipChannelWatchChannel, /* Initialize notifier */ - ZipChannelGetFile, /* Get OS handle from the channel */ - NULL, /* 2nd version of close channel, NULL'able */ - NULL, /* Set blocking mode for raw channel, NULL'able */ - NULL, /* Function to flush channel, NULL'able */ - NULL, /* Function to handle event, NULL'able */ - NULL, /* Wide seek function, NULL'able */ - NULL, /* Thread action function, NULL'able */ -#else - NULL, /* Set blocking/nonblocking behaviour, NULL'able */ - ZipChannelClose, /* Close channel, clean instance data */ - ZipChannelRead, /* Handle read request */ - ZipChannelWrite, /* Handle write request */ - ZipChannelSeek, /* Move location of access point, NULL'able */ - NULL, /* Set options, NULL'able */ - NULL, /* Get options, NULL'able */ - ZipChannelWatchChannel, /* Initialize notifier */ - ZipChannelGetFile, /* Get OS handle from the channel */ -#endif -}; - -/* - *------------------------------------------------------------------------- - * - * ZipChannelOpen -- - * - * This function opens a Tcl_Channel on a file from a mounted ZIP - * archive according to given open mode. - * - * Results: - * Tcl_Channel on success, or NULL on error. - * - * Side effects: - * Memory is allocated, the file from the ZIP archive is uncompressed. - * - *------------------------------------------------------------------------- - */ - -static Tcl_Channel -ZipChannelOpen(Tcl_Interp *interp, char *filename, int mode, int permissions) -{ - ZipEntry *z; - ZipChannel *info; - int i, ch, trunc, wr, flags = 0; - char cname[128]; - - if ((mode & O_APPEND) || - ((ZipFS.wrmax <= 0) && (mode & (O_WRONLY | O_RDWR)))) { - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported open mode", -1)); - } - return NULL; - } - WriteLock(); - z = ZipFSLookup(filename); - if (z == NULL) { - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("file not found", -1)); - } - goto error; - } - trunc = (mode & O_TRUNC) != 0; - wr = (mode & (O_WRONLY | O_RDWR)) != 0; - if ((z->cmeth != ZIP_COMPMETH_STORED) && - (z->cmeth != ZIP_COMPMETH_DEFLATED)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("unsupported compression method", -1)); - } - goto error; - } - if (wr && z->isdir) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("unsupported file type", -1)); - } - goto error; - } - if (!trunc) { - flags |= TCL_READABLE; - if (z->isenc && (z->zipfile->pwbuf[0] == 0)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("decryption failed", -1)); - } - goto error; - } else if (wr && (z->data == NULL) && (z->nbyte > ZipFS.wrmax)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("file too large", -1)); - } - goto error; - } - } else { - flags = TCL_WRITABLE; - } - info = (ZipChannel *) Tcl_AttemptAlloc(sizeof (*info)); - if (info == NULL) { - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("out of memory", -1)); - } - goto error; - } - info->zipfile = z->zipfile; - info->zipentry = z; - info->nread = 0; - if (wr) { - flags |= TCL_WRITABLE; - info->iswr = 1; - info->isdir = 0; - info->nmax = ZipFS.wrmax; - info->iscompr = 0; - info->isenc = 0; - info->ubuf = (unsigned char *) Tcl_AttemptAlloc(info->nmax); - if (info->ubuf == NULL) { -merror0: - if (info->ubuf != NULL) { - Tcl_Free((char *) info->ubuf); - } - Tcl_Free((char *) info); - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("out of memory", -1)); - } - goto error; - } - memset(info->ubuf, 0, info->nmax); - if (trunc) { - info->nbyte = 0; - } else { - if (z->data != NULL) { - unsigned int j = z->nbyte; - - if (j > info->nmax) { - j = info->nmax; - } - memcpy(info->ubuf, z->data, j); - info->nbyte = j; - } else { - unsigned char *zbuf = z->zipfile->data + z->offset; - - if (z->isenc) { - int len = z->zipfile->pwbuf[0]; - char pwbuf[260]; - - for (i = 0; i < len; i++) { - ch = z->zipfile->pwbuf[len - i]; - pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; - } - pwbuf[i] = '\0'; - init_keys(pwbuf, info->keys, crc32tab); - memset(pwbuf, 0, sizeof (pwbuf)); - for (i = 0; i < 12; i++) { - ch = info->ubuf[i]; - zdecode(info->keys, crc32tab, ch); - } - zbuf += i; - } - if (z->cmeth == ZIP_COMPMETH_DEFLATED) { - z_stream stream; - int err; - unsigned char *cbuf = NULL; - - memset(&stream, 0, sizeof (stream)); - stream.zalloc = Z_NULL; - stream.zfree = Z_NULL; - stream.opaque = Z_NULL; - stream.avail_in = z->nbytecompr; - if (z->isenc) { - unsigned int j; - - stream.avail_in -= 12; - cbuf = (unsigned char *) - Tcl_AttemptAlloc(stream.avail_in); - if (cbuf == NULL) { - goto merror0; - } - for (j = 0; j < stream.avail_in; j++) { - ch = info->ubuf[j]; - cbuf[j] = zdecode(info->keys, crc32tab, ch); - } - stream.next_in = cbuf; - } else { - stream.next_in = zbuf; - } - stream.next_out = info->ubuf; - stream.avail_out = info->nmax; - if (inflateInit2(&stream, -15) != Z_OK) { - goto cerror0; - } - err = inflate(&stream, Z_SYNC_FLUSH); - inflateEnd(&stream); - if ((err == Z_STREAM_END) || - ((err == Z_OK) && (stream.avail_in == 0))) { - if (cbuf != NULL) { - memset(info->keys, 0, sizeof (info->keys)); - Tcl_Free((char *) cbuf); - } - goto wrapchan; - } -cerror0: - if (cbuf != NULL) { - memset(info->keys, 0, sizeof (info->keys)); - Tcl_Free((char *) cbuf); - } - if (info->ubuf != NULL) { - Tcl_Free((char *) info->ubuf); - } - Tcl_Free((char *) info); - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("decompression error", -1)); - } - goto error; - } else if (z->isenc) { - for (i = 0; i < z->nbyte - 12; i++) { - ch = zbuf[i]; - info->ubuf[i] = zdecode(info->keys, crc32tab, ch); - } - } else { - memcpy(info->ubuf, zbuf, z->nbyte); - } - memset(info->keys, 0, sizeof (info->keys)); - goto wrapchan; - } - } - } else if (z->data != NULL) { - flags |= TCL_READABLE; - info->iswr = 0; - info->iscompr = 0; - info->isdir = 0; - info->isenc = 0; - info->nbyte = z->nbyte; - info->nmax = 0; - info->ubuf = z->data; - } else { - flags |= TCL_READABLE; - info->iswr = 0; - info->iscompr = z->cmeth == ZIP_COMPMETH_DEFLATED; - info->ubuf = z->zipfile->data + z->offset; - info->isdir = z->isdir; - info->isenc = z->isenc; - info->nbyte = z->nbyte; - info->nmax = 0; - if (info->isenc) { - int len = z->zipfile->pwbuf[0]; - char pwbuf[260]; - - for (i = 0; i < len; i++) { - ch = z->zipfile->pwbuf[len - i]; - pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; - } - pwbuf[i] = '\0'; - init_keys(pwbuf, info->keys, crc32tab); - memset(pwbuf, 0, sizeof (pwbuf)); - for (i = 0; i < 12; i++) { - ch = info->ubuf[i]; - zdecode(info->keys, crc32tab, ch); - } - info->ubuf += i; - } - if (info->iscompr) { - z_stream stream; - int err; - unsigned char *ubuf = NULL; - unsigned int j; - - memset(&stream, 0, sizeof (stream)); - stream.zalloc = Z_NULL; - stream.zfree = Z_NULL; - stream.opaque = Z_NULL; - stream.avail_in = z->nbytecompr; - if (info->isenc) { - stream.avail_in -= 12; - ubuf = (unsigned char *) Tcl_AttemptAlloc(stream.avail_in); - if (ubuf == NULL) { - info->ubuf = NULL; - goto merror; - } - for (j = 0; j < stream.avail_in; j++) { - ch = info->ubuf[j]; - ubuf[j] = zdecode(info->keys, crc32tab, ch); - } - stream.next_in = ubuf; - } else { - stream.next_in = info->ubuf; - } - stream.next_out = info->ubuf = - (unsigned char *) Tcl_AttemptAlloc(info->nbyte); - if (info->ubuf == NULL) { -merror: - if (ubuf != NULL) { - info->isenc = 0; - memset(info->keys, 0, sizeof (info->keys)); - Tcl_Free((char *) ubuf); - } - Tcl_Free((char *) info); - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("out of memory", -1)); - } - goto error; - } - stream.avail_out = info->nbyte; - if (inflateInit2(&stream, -15) != Z_OK) { - goto cerror; - } - err = inflate(&stream, Z_SYNC_FLUSH); - inflateEnd(&stream); - if ((err == Z_STREAM_END) || - ((err == Z_OK) && (stream.avail_in == 0))) { - if (ubuf != NULL) { - info->isenc = 0; - memset(info->keys, 0, sizeof (info->keys)); - Tcl_Free((char *) ubuf); - } - goto wrapchan; - } -cerror: - if (ubuf != NULL) { - info->isenc = 0; - memset(info->keys, 0, sizeof (info->keys)); - Tcl_Free((char *) ubuf); - } - if (info->ubuf != NULL) { - Tcl_Free((char *) info->ubuf); - } - Tcl_Free((char *) info); - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("decompression error", -1)); - } - goto error; - } - } -wrapchan: - sprintf(cname, "zipfs_%lx_%d", (unsigned long) z->offset, ZipFS.idCount++); - z->zipfile->nopen++; - Unlock(); - return Tcl_CreateChannel(&ZipChannelType, cname, (ClientData) info, flags); - -error: - Unlock(); - return NULL; -} - -/* - *------------------------------------------------------------------------- - * - * ZipEntryStat -- - * - * This function implements the ZIP filesystem specific version - * of the library version of stat. - * - * Results: - * See stat documentation. - * - * Side effects: - * See stat documentation. - * - *------------------------------------------------------------------------- - */ - -static int -ZipEntryStat(char *path, Tcl_StatBuf *buf) -{ - ZipEntry *z; - int ret = -1; - - ReadLock(); - z = ZipFSLookup(path); - if (z == NULL) { - goto done; - } - memset(buf, 0, sizeof (Tcl_StatBuf)); - if (z->isdir) { - buf->st_mode = S_IFDIR | 0555; - } else { - buf->st_mode = S_IFREG | 0555; - } - buf->st_size = z->nbyte; - buf->st_mtime = z->timestamp; - buf->st_ctime = z->timestamp; - buf->st_atime = z->timestamp; - ret = 0; -done: - Unlock(); - return ret; -} - -/* - *------------------------------------------------------------------------- - * - * ZipEntryAccess -- - * - * This function implements the ZIP filesystem specific version - * of the library version of access. - * - * Results: - * See access documentation. - * - * Side effects: - * See access documentation. - * - *------------------------------------------------------------------------- - */ - -static int -ZipEntryAccess(char *path, int mode) -{ - ZipEntry *z; - - if (mode & 3) { - return -1; - } - ReadLock(); - z = ZipFSLookup(path); - Unlock(); - return (z != NULL) ? 0 : -1; -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSOpenFileChannelProc -- - * - * Results: - * - * Side effects: - * - *------------------------------------------------------------------------- - */ - -static Tcl_Channel -Zip_FSOpenFileChannelProc(Tcl_Interp *interp, Tcl_Obj *pathPtr, - int mode, int permissions) -{ - int len; - - return ZipChannelOpen(interp, Tcl_GetStringFromObj(pathPtr, &len), - mode, permissions); -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSStatProc -- - * - * This function implements the ZIP filesystem specific version - * of the library version of stat. - * - * Results: - * See stat documentation. - * - * Side effects: - * See stat documentation. - * - *------------------------------------------------------------------------- - */ - -static int -Zip_FSStatProc(Tcl_Obj *pathPtr, Tcl_StatBuf *buf) -{ - int len; - - return ZipEntryStat(Tcl_GetStringFromObj(pathPtr, &len), buf); -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSAccessProc -- - * - * This function implements the ZIP filesystem specific version - * of the library version of access. - * - * Results: - * See access documentation. - * - * Side effects: - * See access documentation. - * - *------------------------------------------------------------------------- - */ - -static int -Zip_FSAccessProc(Tcl_Obj *pathPtr, int mode) -{ - int len; - - return ZipEntryAccess(Tcl_GetStringFromObj(pathPtr, &len), mode); -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSFilesystemSeparatorProc -- - * - * This function returns the separator to be used for a given path. The - * object returned should have a refCount of zero - * - * Results: - * A Tcl object, with a refCount of zero. If the caller needs to retain a - * reference to the object, it should call Tcl_IncrRefCount, and should - * otherwise free the object. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static Tcl_Obj * -Zip_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr) -{ - return Tcl_NewStringObj("/", -1); -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSMatchInDirectoryProc -- - * - * This routine is used by the globbing code to search a directory for - * all files which match a given pattern. - * - * Results: - * The return value is a standard Tcl result indicating whether an - * error occurred in globbing. Errors are left in interp, good - * results are lappend'ed to resultPtr (which must be a valid object). - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, - Tcl_Obj *pathPtr, const char *pattern, - Tcl_GlobTypeData *types) -{ - Tcl_HashEntry *hPtr; - Tcl_HashSearch search; - int scnt, len, l, dirOnly = -1, prefixLen, strip = 0; - char *pat, *prefix, *path; -#if HAS_DRIVES - char drivePrefix[3]; -#endif - Tcl_DString ds, dsPref; - -#if HAS_DRIVES - if ((pattern != NULL) && (pattern[0] != '\0') && - (strchr(drvletters, pattern[0]) != NULL) && (pattern[1] == ':')) { - pattern += 2; - } -#endif - if (types != NULL) { - dirOnly = (types->type & TCL_GLOB_TYPE_DIR) == TCL_GLOB_TYPE_DIR; - } - Tcl_DStringInit(&ds); - Tcl_DStringInit(&dsPref); - prefix = Tcl_GetStringFromObj(pathPtr, &prefixLen); - Tcl_DStringAppend(&dsPref, prefix, prefixLen); - prefix = Tcl_DStringValue(&dsPref); -#if HAS_DRIVES - path = AbsolutePath(prefix, NULL, &ds); -#else - path = AbsolutePath(prefix, &ds); -#endif - len = Tcl_DStringLength(&ds); - if (strcmp(prefix, path) == 0) { - prefix = NULL; - } else { -#if HAS_DRIVES - if ((strchr(drvletters, prefix[0]) != NULL) && (prefix[1] == ':')) { - if (strcmp(prefix + 2, path) == 0) { - strncpy(drivePrefix, prefix, 3); - drivePrefix[2] = '\0'; - prefix = drivePrefix; - } - } else { - strip = len + 1; - } -#else - strip = len + 1; -#endif - } - if (prefix != NULL) { -#if HAS_DRIVES - if (prefix == drivePrefix) { - Tcl_DStringSetLength(&dsPref, 0); - Tcl_DStringAppend(&dsPref, drivePrefix, -1); - prefixLen = Tcl_DStringLength(&dsPref); - } else { - Tcl_DStringAppend(&dsPref, "/", 1); - prefixLen++; - } - prefix = Tcl_DStringValue(&dsPref); -#else - Tcl_DStringAppend(&dsPref, "/", 1); - prefixLen++; - prefix = Tcl_DStringValue(&dsPref); -#endif - } - ReadLock(); - if ((types != NULL) && (types->type == TCL_GLOB_TYPE_MOUNT)) { - l = CountSlashes(path); - if (path[len - 1] == '/') { - len--; - } else { - l++; - } - if ((pattern == NULL) || (pattern[0] == '\0')) { - pattern = "*"; - } - hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); - while (hPtr != NULL) { - ZipFile *zf = (ZipFile *) Tcl_GetHashValue(hPtr); - - if (zf->mntptlen == 0) { - ZipEntry *z = zf->topents; - - while (z != NULL) { - int lenz = strlen(z->name); - - if ((lenz > len + 1) && - (strncmp(z->name, path, len) == 0) && - (z->name[len] == '/') && - (CountSlashes(z->name) == l) && - Tcl_StringCaseMatch(z->name + len + 1, pattern, 0)) { - if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, z->name, lenz); - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(Tcl_DStringValue(&dsPref), - Tcl_DStringLength(&dsPref))); - Tcl_DStringSetLength(&dsPref, prefixLen); - } else { - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(z->name, lenz)); - } - } - z = z->tnext; - } - } else if ((zf->mntptlen > len + 1) && - (strncmp(zf->mntpt, path, len) == 0) && - (zf->mntpt[len] == '/') && - (CountSlashes(zf->mntpt) == l) && - Tcl_StringCaseMatch(zf->mntpt + len + 1, pattern, 0)) { - if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, zf->mntpt, zf->mntptlen); - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(Tcl_DStringValue(&dsPref), - Tcl_DStringLength(&dsPref))); - Tcl_DStringSetLength(&dsPref, prefixLen); - } else { - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); - } - } - hPtr = Tcl_NextHashEntry(&search); - } - goto end; - } - if ((pattern == NULL) || (pattern[0] == '\0')) { - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path); - if (hPtr != NULL) { - ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); - - if ((dirOnly < 0) || - (!dirOnly && !z->isdir) || - (dirOnly && z->isdir)) { - if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, z->name, -1); - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(Tcl_DStringValue(&dsPref), - Tcl_DStringLength(&dsPref))); - Tcl_DStringSetLength(&dsPref, prefixLen); - } else { - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(z->name, -1)); - } - } - } - goto end; - } - l = strlen(pattern); - pat = Tcl_Alloc(len + l + 2); - memcpy(pat, path, len); - while ((len > 1) && (pat[len - 1] == '/')) { - --len; - } - if ((len > 1) || (pat[0] != '/')) { - pat[len] = '/'; - ++len; - } - memcpy(pat + len, pattern, l + 1); - scnt = CountSlashes(pat); - for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); - hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); - - if ((dirOnly >= 0) && - ((dirOnly && !z->isdir) || (!dirOnly && z->isdir))) { - continue; - } - if ((z->depth == scnt) && Tcl_StringCaseMatch(z->name, pat, 0)) { - if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, z->name + strip, -1); - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(Tcl_DStringValue(&dsPref), - Tcl_DStringLength(&dsPref))); - Tcl_DStringSetLength(&dsPref, prefixLen); - } else { - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(z->name + strip, -1)); - } - } - } - Tcl_Free(pat); -end: - Unlock(); - Tcl_DStringFree(&dsPref); - Tcl_DStringFree(&ds); - return TCL_OK; -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSNormalizePathProc -- - * - * Function to normalize given path object. - * - * Results: - * Length of final absolute path name. - * - * Side effects: - * Path object gets converted to an absolute path. - * - *------------------------------------------------------------------------- - */ - -static int -Zip_FSNormalizePathProc(Tcl_Interp *interp, Tcl_Obj *pathPtr, - int nextCheckpoint) -{ - char *path; - Tcl_DString ds; - int len; - - path = Tcl_GetStringFromObj(pathPtr, &len); - Tcl_DStringInit(&ds); -#if HAS_DRIVES - path = AbsolutePath(path, NULL, &ds); -#else - path = AbsolutePath(path, &ds); -#endif - nextCheckpoint = Tcl_DStringLength(&ds); - Tcl_SetStringObj(pathPtr, Tcl_DStringValue(&ds), - Tcl_DStringLength(&ds)); - Tcl_DStringFree(&ds); - return nextCheckpoint; -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSPathInFilesystemProc -- - * - * This function determines if the given path object is in the - * ZIP filesystem. - * - * Results: - * TCL_OK when the path object is in the ZIP filesystem, -1 otherwise. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr) -{ - Tcl_HashEntry *hPtr; - Tcl_HashSearch search; - ZipFile *zf; - int ret = -1, len; - char *path; - Tcl_DString ds; -#if HAS_DRIVES - int drive = 0; -#endif - - path = Tcl_GetStringFromObj(pathPtr, &len); - Tcl_DStringInit(&ds); -#if HAS_DRIVES - path = AbsolutePath(path, &drive, &ds); -#else - path = AbsolutePath(path, &ds); -#endif - len = Tcl_DStringLength(&ds); -#if HAS_DRIVES - if (len && (strchr(drvletters, path[0]) != NULL) && (path[1] == ':')) { - path += 2; - len -= 2; - } -#endif - ReadLock(); - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path); - if (hPtr != NULL) { -#if HAS_DRIVES - ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); - if (drive == z->zipfile->mntdrv) { - ret = TCL_OK; - goto endloop; - } -#else - ret = TCL_OK; - goto endloop; -#endif - } - hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); - while (hPtr != NULL) { - zf = (ZipFile *) Tcl_GetHashValue(hPtr); -#if HAS_DRIVES - if (drive != zf->mntdrv) { - hPtr = Tcl_NextHashEntry(&search); - continue; - } -#endif - if (zf->mntptlen == 0) { - ZipEntry *z = zf->topents; - - while (z != NULL) { - int lenz = strlen(z->name); - - if ((len >= lenz) && - (strncmp(path, z->name, lenz) == 0)) { - ret = TCL_OK; - goto endloop; - } - z = z->tnext; - } - } else if ((len >= zf->mntptlen) && - (strncmp(path, zf->mntpt, zf->mntptlen) == 0)) { - ret = TCL_OK; - goto endloop; - } - hPtr = Tcl_NextHashEntry(&search); - } -endloop: - Unlock(); - Tcl_DStringFree(&ds); - return ret; -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSListVolumesProc -- - * - * Lists the currently mounted ZIP filesystem volumes. - * - * Results: - * The list of volumes. - * - * Side effects: - * None - * - *------------------------------------------------------------------------- - */ - -static Tcl_Obj * -Zip_FSListVolumesProc(void) -{ - Tcl_HashEntry *hPtr; - Tcl_HashSearch search; - ZipFile *zf; - Tcl_Obj *vols = Tcl_NewObj(), *vol; - - ReadLock(); - hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); - while (hPtr != NULL) { - zf = (ZipFile *) Tcl_GetHashValue(hPtr); -#if HAS_DRIVES - vol = Tcl_ObjPrintf("%c:%s", zf->mntdrv, - zf->mntpt[0] ? zf->mntpt : "/"); -#else - if (zf->mntpt[0]) { - vol = Tcl_NewStringObj(zf->mntpt, zf->mntptlen); - } else { - vol = Tcl_NewStringObj("/", 1); - } -#endif - Tcl_ListObjAppendElement(NULL, vols, vol); - hPtr = Tcl_NextHashEntry(&search); - } - Unlock(); - Tcl_IncrRefCount(vols); - return vols; -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSChdirProc -- - * - * If the path object refers to a directory within the ZIP - * filesystem the current directory is set to this directory. - * - * Results: - * TCL_OK on success, -1 on error with error number set. - * - * Side effects: - * The global cwdPathPtr may change value. - * - *------------------------------------------------------------------------- - */ - -static int -Zip_FSChdirProc(Tcl_Obj *pathPtr) -{ - int len; - char *path; - Tcl_DString ds; - ZipEntry *z; - int ret = TCL_OK; -#if HAS_DRIVES - int drive = 0; -#endif - - path = Tcl_GetStringFromObj(pathPtr, &len); - Tcl_DStringInit(&ds); -#if HAS_DRIVES - path = AbsolutePath(path, &drive, &ds); -#else - path = AbsolutePath(path, &ds); -#endif - ReadLock(); - z = ZipFSLookup(path); - if ((z == NULL) || !z->isdir) { - Tcl_SetErrno(ENOENT); - ret = -1; - } -#if HAS_DRIVES - if ((z != NULL) && (drive != z->zipfile->mntdrv)) { - Tcl_SetErrno(ENOENT); - ret = -1; - } -#endif - Unlock(); - Tcl_DStringFree(&ds); - return ret; -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSFileAttrStringsProc -- - * - * This function implements the ZIP filesystem dependent 'file attributes' - * subcommand, for listing the set of possible attribute strings. - * - * Results: - * An array of strings - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static const char *const * -Zip_FSFileAttrStringsProc(Tcl_Obj *pathPtr, Tcl_Obj** objPtrRef) -{ - static const char *const attrs[] = { - "-uncompsize", - "-compsize", - "-offset", - "-mount", - "-archive", - "-permissions", - NULL, - }; - - return attrs; -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSFileAttrsGetProc -- - * - * This function implements the ZIP filesystem specific - * 'file attributes' subcommand, for 'get' operations. - * - * Results: - * Standard Tcl return code. The object placed in objPtrRef (if TCL_OK - * was returned) is likely to have a refCount of zero. Either way we must - * either store it somewhere (e.g. the Tcl result), or Incr/Decr its - * refCount to ensure it is properly freed. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -Zip_FSFileAttrsGetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, - Tcl_Obj **objPtrRef) -{ - int len, ret = TCL_OK; - char *path; - ZipEntry *z; - - path = Tcl_GetStringFromObj(pathPtr, &len); - ReadLock(); - z = ZipFSLookup(path); - if (z == NULL) { - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("file not found", -1)); - } - ret = TCL_ERROR; - goto done; - } - switch (index) { - case 0: - *objPtrRef = Tcl_NewIntObj(z->nbyte); - goto done; - case 1: - *objPtrRef= Tcl_NewIntObj(z->nbytecompr); - goto done; - case 2: - *objPtrRef= Tcl_NewLongObj(z->offset); - goto done; - case 3: - *objPtrRef= Tcl_NewStringObj(z->zipfile->mntpt, -1); - goto done; - case 4: - *objPtrRef= Tcl_NewStringObj(z->zipfile->name, -1); - goto done; - case 5: - *objPtrRef= Tcl_NewStringObj("0555", -1); - goto done; - } - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown attribute", -1)); - } - ret = TCL_ERROR; -done: - Unlock(); - return ret; -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSFileAttrsSetProc -- - * - * This function implements the ZIP filesystem specific - * 'file attributes' subcommand, for 'set' operations. - * - * Results: - * Standard Tcl return code. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -Zip_FSFileAttrsSetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, - Tcl_Obj *objPtr) -{ - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported operation", -1)); - } - return TCL_ERROR; -} - -/* - *------------------------------------------------------------------------- - * - * Zip_FSFilesystemPathTypeProc -- - * - * Results: - * - * Side effects: - * - *------------------------------------------------------------------------- - */ - -static Tcl_Obj * -Zip_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr) -{ - return Tcl_NewStringObj("zip", -1); -} - - -/* - *------------------------------------------------------------------------- - * - * Zip_FSLoadFile -- - * - * This functions deals with loading native object code. If - * the given path object refers to a file within the ZIP - * filesystem, an approriate error code is returned to delegate - * loading to the caller (by copying the file to temp store - * and loading from there). As fallback when the file refers - * to the ZIP file system but is not present, it is looked up - * relative to the executable and loaded from there when available. - * - * Results: - * TCL_OK on success, -1 otherwise with error number set. - * - * Side effects: - * Loads native code into the process address space. - * - *------------------------------------------------------------------------- - */ - -static int -Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, - Tcl_FSUnloadFileProc **unloadProcPtr, int flags) -{ - Tcl_FSLoadFileProc2 *loadFileProc; -#ifdef ANDROID - /* - * Force loadFileProc to native implementation since the - * package manger already extracted the shared libraries - * from the APK at install time. - */ - - loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; - if (loadFileProc != NULL) { - return loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); - } - Tcl_SetErrno(ENOENT); - return -1; -#else - Tcl_Obj *altPath = NULL; - int ret = -1; - - if (Tcl_FSAccess(path, R_OK) == 0) { - /* - * EXDEV should trigger loading by copying to temp store. - */ - Tcl_SetErrno(EXDEV); - return ret; - } else { - Tcl_Obj *objs[2] = { NULL, NULL }; - - objs[1] = TclPathPart(interp, path, TCL_PATH_DIRNAME); - if ((objs[1] != NULL) && (Zip_FSAccessProc(objs[1], R_OK) == 0)) { - const char *execName = Tcl_GetNameOfExecutable(); - - /* - * Shared object is not in ZIP but its path prefix is, - * thus try to load from directory where the executable - * came from. - */ - TclDecrRefCount(objs[1]); - objs[1] = TclPathPart(interp, path, TCL_PATH_TAIL); - /* - * Get directory name of executable manually to deal - * with cases where [file dirname [info nameofexecutable]] - * is equal to [info nameofexecutable] due to VFS effects. - */ - if (execName != NULL) { - const char *p = strrchr(execName, '/'); - - if (p > execName + 1) { - --p; - objs[0] = Tcl_NewStringObj(execName, p - execName); - } - } - if (objs[0] == NULL) { - objs[0] = TclPathPart(interp, TclGetObjNameOfExecutable(), - TCL_PATH_DIRNAME); - } - if (objs[0] != NULL) { - altPath = TclJoinPath(2, objs); - if (altPath != NULL) { - Tcl_IncrRefCount(altPath); - if (Tcl_FSAccess(altPath, R_OK) == 0) { - path = altPath; - } - } - } - } - if (objs[0] != NULL) { - Tcl_DecrRefCount(objs[0]); - } - if (objs[1] != NULL) { - Tcl_DecrRefCount(objs[1]); - } - } - loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; - if (loadFileProc != NULL) { - ret = loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); - } else { - Tcl_SetErrno(ENOENT); - } - if (altPath != NULL) { - Tcl_DecrRefCount(altPath); - } - return ret; -#endif -} - - -/* - * Define the ZIP filesystem dispatch table. - */ - -MODULE_SCOPE const Tcl_Filesystem zipfsFilesystem; - -const Tcl_Filesystem zipfsFilesystem = { - "zipfs", - sizeof (Tcl_Filesystem), - TCL_FILESYSTEM_VERSION_2, - Zip_FSPathInFilesystemProc, - NULL, /* dupInternalRepProc */ - NULL, /* freeInternalRepProc */ - NULL, /* internalToNormalizedProc */ - NULL, /* createInternalRepProc */ - Zip_FSNormalizePathProc, - Zip_FSFilesystemPathTypeProc, - Zip_FSFilesystemSeparatorProc, - Zip_FSStatProc, - Zip_FSAccessProc, - Zip_FSOpenFileChannelProc, - Zip_FSMatchInDirectoryProc, - NULL, /* utimeProc */ - NULL, /* linkProc */ - Zip_FSListVolumesProc, - Zip_FSFileAttrStringsProc, - Zip_FSFileAttrsGetProc, - Zip_FSFileAttrsSetProc, - NULL, /* createDirectoryProc */ - NULL, /* removeDirectoryProc */ - NULL, /* deleteFileProc */ - NULL, /* copyFileProc */ - NULL, /* renameFileProc */ - NULL, /* copyDirectoryProc */ - NULL, /* lstatProc */ - (Tcl_FSLoadFileProc *) Zip_FSLoadFile, - NULL, /* getCwdProc */ - Zip_FSChdirProc, -}; - -#endif /* HAVE_ZLIB */ - - - -Zipfs_one_time_init(Tcl_Interp *interp) { - /* one-time initialization */ - WriteLock(); - if (!ZipFS.initialized) { -#ifdef TCL_THREADS - static const Tcl_Time t = { 0, 0 }; - - /* - * Inflate condition variable. - */ - Tcl_MutexLock(&ZipFSMutex); - Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, &t); - Tcl_MutexUnlock(&ZipFSMutex); -#endif - Tcl_FSRegister(NULL, &zipfsFilesystem); - Tcl_InitHashTable(&ZipFS.fileHash, TCL_STRING_KEYS); - Tcl_InitHashTable(&ZipFS.zipHash, TCL_STRING_KEYS); - ZipFS.initialized = ZipFS.idCount = 1; - if(interp) { - Tcl_StaticPackage(interp, "zipfs", Tclzipfs_Init, Tclzipfs_SafeInit); - } - } - Unlock(); -} -/* - *------------------------------------------------------------------------- - * - * Zipfs_doInit -- - * - * Perform per interpreter initialization of this module. - * - * Results: - * The return value is a standard Tcl result. - * - * Side effects: - * Initializes this module if not already initialized, and adds - * module related commands to the given interpreter. - * - *------------------------------------------------------------------------- - */ - -static int -Zipfs_doInit(Tcl_Interp *interp, int safe) -{ -#ifdef HAVE_ZLIB - static const EnsembleImplMap initMap[] = { - {"mount", ZipFSMountObjCmd, NULL, NULL, NULL, 0}, - {"unmount", ZipFSUnmountObjCmd, NULL, NULL, NULL, 0}, - {"mkkey", ZipFSMkKeyObjCmd, NULL, NULL, NULL, 0}, - {"mkimg", ZipFSMkImgObjCmd, NULL, NULL, NULL, 0}, - {"mkzip", ZipFSMkZipObjCmd, NULL, NULL, NULL, 0}, - {"lmkimg", ZipFSLMkImgObjCmd, NULL, NULL, NULL, 0}, - {"lmkzip", ZipFSLMkZipObjCmd, NULL, NULL, NULL, 0}, - {"exists", ZipFSExistsObjCmd, NULL, NULL, NULL, 0}, - {"info", ZipFSInfoObjCmd, NULL, NULL, NULL, 0}, - {"list", ZipFSListObjCmd, NULL, NULL, NULL, 0}, - {NULL, NULL, NULL, NULL, NULL, 0} - }; - - static const EnsembleImplMap initSafeMap[] = { - {"exists", ZipFSExistsObjCmd, NULL, NULL, NULL, 0}, - {"info", ZipFSInfoObjCmd, NULL, NULL, NULL, 0}, - {"list", ZipFSListObjCmd, NULL, NULL, NULL, 0}, - {NULL, NULL, NULL, NULL, NULL, 0} - }; - - static const char findproc[] = - "namespace eval zipfs {}\n" - "proc ::zipfs::find dir {\n" - " set result {}\n" - " if {[catch {glob -directory $dir -tails -nocomplain * .*} list]} {\n" - " return $result\n" - " }\n" - " foreach file $list {\n" - " if {$file eq \".\" || $file eq \"..\"} {\n" - " continue\n" - " }\n" - " set file [file join $dir $file]\n" - " lappend result $file\n" - " foreach file [::zipfs::find $file] {\n" - " lappend result $file\n" - " }\n" - " }\n" - " return [lsort $result]\n" - "}\n"; - Zipfs_one_time_init(interp); - if (!safe) { - Tcl_EvalEx(interp, findproc, -1, TCL_EVAL_GLOBAL); - Tcl_LinkVar(interp, "::zipfs::wrmax", (char *) &ZipFS.wrmax, - TCL_LINK_INT); - } - TclMakeEnsemble(interp, "zipfs", safe ? initSafeMap : initMap); - - Tcl_PkgProvide(interp, "zipfs", "1.0"); - - return TCL_OK; -#else - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("no zlib available", -1)); - } - return TCL_ERROR; -#endif -} - -/* - *------------------------------------------------------------------------- - * - * Tclzipfs_Init, Tclzipfs_SafeInit -- - * - * These functions are invoked to perform per interpreter initialization - * of this module. - * - * Results: - * The return value is a standard Tcl result. - * - * Side effects: - * Initializes this module if not already initialized, and adds - * module related commands to the given interpreter. - * - *------------------------------------------------------------------------- - */ - -int -Tclzipfs_Init(Tcl_Interp *interp) -{ - return Zipfs_doInit(interp, 0); -} - -int -Tclzipfs_SafeInit(Tcl_Interp *interp) -{ - return Zipfs_doInit(interp, 1); -} - -#ifndef HAVE_ZLIB - -/* - *------------------------------------------------------------------------- - * - * Tclzipfs_Mount, Tclzipfs_Unmount -- - * - * Dummy version when no ZLIB support available. - * - *------------------------------------------------------------------------- - */ - -int -Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, - const char *passwd) -{ - return Zipfs_doInit(interp, 1); -} - -int -Tclzipfs_Unmount(Tcl_Interp *interp, const char *zipname) -{ - return Zipfs_doInit(interp, 1); -} - -#endif - -/* -** Boot a shell, mount the executable's VFS, detect main.tcl -*/ -int Tcl_Zvfs_Boot(const char *archive,const char *vfsmountpoint,const char *initscript,const char *passwd) { - #ifdef HAVE_ZLIB - Zipfs_one_time_init(NULL); - if(!vfsmountpoint) { - vfsmountpoint="/zvfs"; - } - if(!initscript) { - initscript="main.tcl"; - } - /* We have to initialize the virtual filesystem before calling - ** Tcl_Init(). Otherwise, Tcl_Init() will not be able to find - ** its startup script files. - */ - if(!Tclzipfs_Mount(NULL, archive, vfsmountpoint,passwd)) { - Tcl_DString filepath; - Tcl_DString preinit; - - Tcl_Obj *vfsinitscript; - Tcl_Obj *vfstcllib; - Tcl_Obj *vfstklib; - Tcl_Obj *vfspreinit; - Tcl_DStringInit(&filepath); - Tcl_DStringInit(&preinit); - - Tcl_DStringInit(&filepath); - Tcl_DStringAppend(&filepath,vfsmountpoint,-1); - Tcl_DStringAppend(&filepath,"/",-1); - Tcl_DStringAppend(&filepath,initscript,-1); - vfsinitscript=Tcl_NewStringObj(Tcl_DStringValue(&filepath),-1); - Tcl_DStringFree(&filepath); - - Tcl_DStringInit(&filepath); - Tcl_DStringAppend(&filepath,vfsmountpoint,-1); - Tcl_DStringAppend(&filepath,"/boot/tcl",-1); - vfstcllib=Tcl_NewStringObj(Tcl_DStringValue(&filepath),-1); - Tcl_DStringFree(&filepath); - - Tcl_DStringInit(&filepath); - Tcl_DStringAppend(&filepath,vfsmountpoint,-1); - Tcl_DStringAppend(&filepath,"/boot/tk",-1); - vfstklib=Tcl_NewStringObj(Tcl_DStringValue(&filepath),-1); - Tcl_DStringFree(&filepath); - - Tcl_IncrRefCount(vfsinitscript); - Tcl_IncrRefCount(vfstcllib); - Tcl_IncrRefCount(vfstklib); - - if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { - /* Startup script should be set before calling Tcl_AppInit */ - Tcl_SetStartupScript(vfsinitscript,NULL); - } - /* Record the mountpoint for scripts to refer back to */ - Tcl_DStringAppend(&preinit,"\nset ::tcl_boot_vfs ",-1); - Tcl_DStringAppendElement(&preinit,vfsmountpoint); - Tcl_DStringAppend(&preinit,"\nset ::SRCDIR ",-1); - Tcl_DStringAppendElement(&preinit,vfsmountpoint); - - if(Tcl_FSAccess(vfstcllib,F_OK)==0) { - Tcl_DStringAppend(&preinit,"\nset tcl_library ",-1); - Tcl_DStringAppendElement(&preinit,Tcl_GetString(vfstcllib)); - } - if(Tcl_FSAccess(vfstklib,F_OK)==0) { - Tcl_DStringAppend(&preinit,"\nset tk_library ",-1); - Tcl_DStringAppendElement(&preinit,Tcl_GetString(vfstklib)); - } - vfspreinit=Tcl_NewStringObj(Tcl_DStringValue(&preinit),-1); - /* NOTE: We never decr this refcount, lest the contents of the script be deallocated */ - Tcl_IncrRefCount(vfspreinit); - TclSetPreInitScript(Tcl_GetString(vfspreinit)); - - Tcl_DecrRefCount(vfsinitscript); - Tcl_DecrRefCount(vfstcllib); - Tcl_DecrRefCount(vfstklib); - } - #endif - return TCL_OK; -} - -/* - * Local Variables: - * mode: c - * c-basic-offset: 4 - * fill-column: 78 - * End: - */ diff --git a/library/practcl/pkgIndex.tcl b/library/practcl/pkgIndex.tcl new file mode 100644 index 0000000..1e378e8 --- /dev/null +++ b/library/practcl/pkgIndex.tcl @@ -0,0 +1,11 @@ +# Tcl package index file, version 1.1 +# This file is generated by the "pkg_mkIndex" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded practcl 0.5 [list source [file join $dir practcl.tcl]] diff --git a/library/practcl/practcl.tcl b/library/practcl/practcl.tcl new file mode 100644 index 0000000..3b4b04e --- /dev/null +++ b/library/practcl/practcl.tcl @@ -0,0 +1,4000 @@ +### +# Practcl +# An object oriented templating system for stamping out Tcl API calls to C +### +puts [list LOADED practcl.tcl from [info script]] +package require TclOO +proc ::debug args { + #puts $args + ::practcl::cputs ::DEBUG_INFO $args +} + +### +# Drop in a static copy of Tcl +### +proc ::doexec args { + puts [list {*}$args] + exec {*}$args >&@ stdout +} + +proc ::dotclexec args { + puts [list [info nameofexecutable] {*}$args] + exec [info nameofexecutable] {*}$args >&@ stdout +} + +proc ::domake {path args} { + set PWD [pwd] + cd $path + puts [list *** $path ***] + puts [list make {*}$args] + exec make {*}$args >&@ stdout + cd $PWD +} + +proc ::domake.tcl {path args} { + set PWD [pwd] + cd $path + puts [list *** $path ***] + puts [list make.tcl {*}$args] + exec [info nameofexecutable] make.tcl {*}$args >&@ stdout + cd $PWD +} + +proc ::fossil {path args} { + set PWD [pwd] + cd $path + puts [list {*}$args] + exec fossil {*}$args >&@ stdout + cd $PWD +} + + +proc ::fossil_status {dir} { + if {[info exists ::fosdat($dir)]} { + return $::fosdat($dir) + } + set result { +tags experimental +version {} + } + set pwd [pwd] + cd $dir + set info [exec fossil status] + cd $pwd + foreach line [split $info \n] { + if {[lindex $line 0] eq "checkout:"} { + set hash [lindex $line end-3] + set maxdate [lrange $line end-2 end-1] + dict set result hash $hash + dict set result maxdate $maxdate + regsub -all {[^0-9]} $maxdate {} isodate + dict set result isodate $isodate + } + if {[lindex $line 0] eq "tags:"} { + set tags [lrange $line 1 end] + dict set result tags $tags + break + } + } + set ::fosdat($dir) $result + return $result +} +### +# Seek out Tcllib if it's available +### +set tcllib_path {} +foreach path {.. ../.. ../../..} { + foreach path [glob -nocomplain [file join [file normalize $path] tcllib* modules]] { + set tclib_path $path + lappend ::auto_path $path + break + } + if {$tcllib_path ne {}} break +} + + +### +# Build utility functions +### +namespace eval ::practcl {} + +proc ::practcl::os {} { + if {[info exists ::project(TEACUP_OS)] && $::project(TEACUP_OS) ni {"@TEACUP_OS@" {}}} { + return $::project(TEACUP_OS) + } + set info [::practcl::config.tcl $::project(builddir)] + if {[dict exists $info TEACUP_OS]} { + return [dict get $info TEACUP_OS] + } + return unknown +} + +### +# Detect local platform +### +proc ::practcl::config.tcl {path} { + dict set result buildpath $path + set result {} + if {[file exists [file join $path config.tcl]]} { + set fin [open [file join $path config.tcl] r] + set bufline {} + set rawcount 0 + set linecount 0 + while {[gets $fin thisline]>=0} { + incr rawcount + append bufline \n $thisline + if {![info complete $bufline]} continue + set line [string trimleft $bufline] + set bufline {} + if {[string index [string trimleft $line] 0] eq "#"} continue + incr linecount + set key [lindex $line 0] + set value [lindex $line 1] + dict set result $key $value + } + dict set result sandbox [file dirname [dict get $result srcdir]] + dict set result download [file join [dict get $result sandbox] download] + dict set result teapot [file join [dict get $result sandbox] teapot] + set result [::practcl::de_shell $result] + } + # If data is available from autoconf, defer to that + if {[dict exists $result TEACUP_OS] && [dict get $result TEACUP_OS] ni {"@TEACUP_OS@" {}}} { + return $result + } + # If autoconf hasn't run yet, assume we are not cross compiling + # and defer to local checks + dict set result TEACUP_PROFILE unknown + dict set result TEACUP_OS unknown + dict set result EXEEXT {} + if {$::tcl_platform(platform) eq "windows"} { + set system "windows" + set arch ix86 + dict set result TEACUP_PROFILE win32-ix86 + dict set result TEACUP_OS windows + dict set result EXEEXT .exe + } else { + set system [exec uname -s]-[exec uname -r] + set arch unknown + dict set result TEACUP_OS generic + } + dict set result TEA_PLATFORM $system + dict set result TEA_SYSTEM $system + switch -glob $system { + Linux* { + dict set result TEACUP_OS linux + set arch [exec uname -m] + dict set result TEACUP_PROFILE "linux-glibc2.3-$arch" + } + GNU* { + set arch [exec uname -m] + dict set result TEACUP_OS "gnu" + } + NetBSD-Debian { + set arch [exec uname -m] + dict set result TEACUP_OS "netbsd-debian" + } + OpenBSD-* { + set arch [exec arch -s] + dict set result TEACUP_OS "openbsd" + } + Darwin* { + set arch [exec uname -m] + dict set result TEACUP_OS "macosx" + if {$arch eq "x86_64"} { + dict set result TEACUP_PROFILE "macosx10.5-i386-x86_84" + } else { + dict set result TEACUP_PROFILE "macosx-universal" + } + } + OpenBSD* { + set arch [exec arch -s] + dict set result TEACUP_OS "openbsd" + } + } + if {$arch eq "unknown"} { + catch {set arch [exec uname -m]} + } + switch -glob $arch { + i*86 { + set arch "ix86" + } + amd64 { + set arch "x86_64" + } + } + dict set result TEACUP_ARCH $arch + if {[dict get $result TEACUP_PROFILE] eq "unknown"} { + dict set result TEACUP_PROFILE [dict get $result TEACUP_OS]-$arch + } + return $result +} + + +### +# Convert an MSYS path to a windows native path +### +if {$::tcl_platform(platform) eq "windows"} { +proc ::practcl::msys_to_tclpath msyspath { + return [exec sh -c "cd $msyspath ; pwd -W"] +} +} else { +proc ::practcl::msys_to_tclpath msyspath { + return [file normalize $msyspath] +} +} + +### +# Bits stolen from fileutil +### +proc ::practcl::cat fname { + set fname [open $fname r] + set data [read $fname] + close $fname + return $data +} + +proc ::practcl::file_lexnormalize {sp} { + set spx [file split $sp] + + # Resolution of embedded relative modifiers (., and ..). + + if { + ([lsearch -exact $spx . ] < 0) && + ([lsearch -exact $spx ..] < 0) + } { + # Quick path out if there are no relative modifiers + return $sp + } + + set absolute [expr {![string equal [file pathtype $sp] relative]}] + # A volumerelative path counts as absolute for our purposes. + + set sp $spx + set np {} + set noskip 1 + + while {[llength $sp]} { + set ele [lindex $sp 0] + set sp [lrange $sp 1 end] + set islast [expr {[llength $sp] == 0}] + + if {[string equal $ele ".."]} { + if { + ($absolute && ([llength $np] > 1)) || + (!$absolute && ([llength $np] >= 1)) + } { + # .. : Remove the previous element added to the + # new path, if there actually is enough to remove. + set np [lrange $np 0 end-1] + } + } elseif {[string equal $ele "."]} { + # Ignore .'s, they stay at the current location + continue + } else { + # A regular element. + lappend np $ele + } + } + if {[llength $np] > 0} { + return [eval [linsert $np 0 file join]] + # 8.5: return [file join {*}$np] + } + return {} +} + +proc ::practcl::file_relative {base dst} { + # Ensure that the link to directory 'dst' is properly done relative to + # the directory 'base'. + + if {![string equal [file pathtype $base] [file pathtype $dst]]} { + return -code error "Unable to compute relation for paths of different pathtypes: [file pathtype $base] vs. [file pathtype $dst], ($base vs. $dst)" + } + + set base [file_lexnormalize [file join [pwd] $base]] + set dst [file_lexnormalize [file join [pwd] $dst]] + + set save $dst + set base [file split $base] + set dst [file split $dst] + + while {[string equal [lindex $dst 0] [lindex $base 0]]} { + set dst [lrange $dst 1 end] + set base [lrange $base 1 end] + if {![llength $dst]} {break} + } + + set dstlen [llength $dst] + set baselen [llength $base] + + if {($dstlen == 0) && ($baselen == 0)} { + # Cases: + # (a) base == dst + + set dst . + } else { + # Cases: + # (b) base is: base/sub = sub + # dst is: base = {} + + # (c) base is: base = {} + # dst is: base/sub = sub + + while {$baselen > 0} { + set dst [linsert $dst 0 ..] + incr baselen -1 + } + # 8.5: set dst [file join {*}$dst] + set dst [eval [linsert $dst 0 file join]] + } + + return $dst +} + +### +# Unpack the source of a fossil project into a designated location +### +proc ::practcl::fossil_sandbox {pkg args} { + if {[llength $args]==1} { + set info [lindex $args 0] + } else { + set info $args + } + set result $info + if {[dict exists $info srcroot]} { + set srcroot [dict get $info srcroot] + } elseif {[dict exists $info sandbox]} { + set srcroot [file join [dict get $info sandbox] $pkg] + } else { + set srcroot [file join $::CWD .. $pkg] + } + dict set result srcroot $srcroot + puts [list fossil_sandbox $pkg $srcroot] + if {[dict exists $info download]} { + ### + # Source is actually a zip archive + ### + set download [dict get $info download] + if {[file exists [file join $download $pkg.zip]]} { + if {![info exists $srcroot]} { + package require zipfile::decode + ::zipfile::decode::unzipfile [file join $download $pkg.zip] $srcroot + } + return + } + } + variable fossil_dbs + if {![::info exists fossil_dbs]} { + # Get a list of local fossil databases + set fossil_dbs [exec fossil all list] + } + set CWD [pwd] + if {![dict exists $info tag]} { + set tag trunk + } else { + set tag [dict get $info tag] + } + dict set result tag $tag + + try { + if {[file exists [file join $srcroot .fslckout]]} { + if {[dict exists $info update] && [dict get $info update]==1} { + catch { + puts "FOSSIL UPDATE" + cd $srcroot + doexec fossil update $tag + } + } + } elseif {[file exists [file join $srcroot _FOSSIL_]]} { + if {[dict exists $info update] && [dict get $info update]==1} { + catch { + puts "FOSSIL UPDATE" + cd $srcroot + doexec fossil update $tag + } + } + } else { + puts "OPEN AND UNPACK" + set fosdb {} + foreach line [split $fossil_dbs \n] { + set line [string trim $line] + if {[file rootname [file tail $line]] eq $pkg} { + set fosdb $line + break + } + } + if {$fosdb eq {}} { + file mkdir [file join $download fossil] + set fosdb [file join $download fossil $pkg.fos] + set cloned 0 + if {[dict exists $info localmirror]} { + set localmirror [dict get $info localmirror] + catch { + doexec fossil clone $localmirror/$pkg $fosdb + set cloned 1 + } + } + if {!$cloned && [dict exists $info fossil_url]} { + set localmirror [dict get $info fossil_url] + catch { + doexec fossil clone $localmirror/$pkg $fosdb + set cloned 1 + } + } + if {!$cloned} { + doexec fossil clone http://fossil.etoyoc.com/fossil/$pkg $fosdb + } + } + file mkdir $srcroot + cd $srcroot + puts "FOSSIL OPEN [pwd]" + doexec fossil open $fosdb $tag + } + } on error {result opts} { + puts [list ERR [dict get $opts -errorinfo]] + return {*}$opts + } finally { + cd $CWD + } + return $result +} + +### +# topic: e71f3f61c348d56292011eec83e95f0aacc1c618 +# description: Converts a XXX.sh file into a series of Tcl variables +### +proc ::practcl::read_sh_subst {line info} { + regsub -all {\x28} $line \x7B line + regsub -all {\x29} $line \x7D line + + #set line [string map $key [string trim $line]] + foreach {field value} $info { + catch {set $field $value} + } + if [catch {subst $line} result] { + return {} + } + set result [string trim $result] + return [string trim $result '] +} + +### +# topic: 03567140cca33c814664c7439570f669b9ab88e6 +### +proc ::practcl::read_sh_file {filename {localdat {}}} { + set fin [open $filename r] + set result {} + if {$localdat eq {}} { + set top 1 + set local [array get ::env] + dict set local EXE {} + } else { + set top 0 + set local $localdat + } + while {[gets $fin line] >= 0} { + set line [string trim $line] + if {[string index $line 0] eq "#"} continue + if {$line eq {}} continue + catch { + if {[string range $line 0 6] eq "export "} { + set eq [string first "=" $line] + set field [string trim [string range $line 6 [expr {$eq - 1}]]] + set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local] + dict set result $field [read_sh_subst $value $local] + dict set local $field $value + } elseif {[string range $line 0 7] eq "include "} { + set subfile [read_sh_subst [string range $line 7 end] $local] + foreach {field value} [read_sh_file $subfile $local] { + dict set result $field $value + } + } else { + set eq [string first "=" $line] + if {$eq > 0} { + set field [read_sh_subst [string range $line 0 [expr {$eq - 1}]] $local] + set value [string trim [string range $line [expr {$eq+1}] end] '] + #set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local] + dict set local $field $value + dict set result $field $value + } + } + } err opts + if {[dict get $opts -code] != 0} { + #puts $opts + puts "Error reading line:\n$line\nerr: $err\n***" + return $err {*}$opts + } + } + return $result +} + +### +# A simpler form of read_sh_file tailored +# to pulling data from (tcl|tk)Config.sh +### +proc ::practcl::read_Config.sh filename { + set fin [open $filename r] + set result {} + set linecount 0 + while {[gets $fin line] >= 0} { + set line [string trim $line] + if {[string index $line 0] eq "#"} continue + if {$line eq {}} continue + catch { + set eq [string first "=" $line] + if {$eq > 0} { + set field [string range $line 0 [expr {$eq - 1}]] + set value [string trim [string range $line [expr {$eq+1}] end] '] + #set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local] + dict set result $field $value + incr $linecount + } + } err opts + if {[dict get $opts -code] != 0} { + #puts $opts + puts "Error reading line:\n$line\nerr: $err\n***" + return $err {*}$opts + } + } + return $result +} + +### +# A simpler form of read_sh_file tailored +# to pulling data from a Makefile +### +proc ::practcl::read_Makefile filename { + set fin [open $filename r] + set result {} + while {[gets $fin line] >= 0} { + set line [string trim $line] + if {[string index $line 0] eq "#"} continue + if {$line eq {}} continue + catch { + set eq [string first "=" $line] + if {$eq > 0} { + set field [string trim [string range $line 0 [expr {$eq - 1}]]] + set value [string trim [string trim [string range $line [expr {$eq+1}] end] ']] + switch $field { + PKG_LIB_FILE { + dict set result libfile $value + } + srcdir { + if {$value eq "."} { + dict set result srcdir [file dirname $filename] + } else { + dict set result srcdir $value + } + } + PACKAGE_NAME { + dict set result name $value + } + PACKAGE_VERSION { + dict set result version $value + } + LIBS { + dict set result PRACTCL_LIBS $value + } + PKG_LIB_FILE { + dict set result libfile $value + } + } + } + } err opts + if {[dict get $opts -code] != 0} { + #puts $opts + puts "Error reading line:\n$line\nerr: $err\n***" + return $err {*}$opts + } + # the Compile field is about where most TEA files start getting silly + if {$field eq "compile"} { + break + } + } + return $result +} + +## Append arguments to a buffer +# The command works like puts in that each call will also insert +# a line feed. Unlike puts, blank links in the interstitial are +# suppressed +proc ::practcl::cputs {varname args} { + upvar 1 $varname buffer + if {[llength $args]==1 && [string length [string trim [lindex $args 0]]] == 0} { + + } + if {[info exist buffer]} { + if {[string index $buffer end] ne "\n"} { + append buffer \n + } + } else { + set buffer \n + } + # Trim leading \n's + append buffer [string trimleft [lindex $args 0] \n] {*}[lrange $args 1 end] +} + + +proc ::practcl::tcl_to_c {body} { + set result {} + foreach rawline [split $body \n] { + set line [string map [list \" \\\" \\ \\\\] $rawline] + cputs result "\n \"$line\\n\" \\" + } + return [string trimright $result \\] +} + + +proc ::practcl::_tagblock {text {style tcl} {note {}}} { + if {[string length [string trim $text]]==0} { + return {} + } + set output {} + switch $style { + tcl { + ::practcl::cputs output "# BEGIN $note" + } + c { + ::practcl::cputs output "/* BEGIN $note */" + } + default { + ::practcl::cputs output "# BEGIN $note" + } + } + ::practcl::cputs output $text + switch $style { + tcl { + ::practcl::cputs output "# END $note" + } + c { + ::practcl::cputs output "/* END $note */" + } + default { + ::practcl::cputs output "# END $note" + } + } + return $output +} + +proc ::practcl::_isdirectory name { + return [file isdirectory $name] +} + +### +# Return true if the pkgindex file contains +# any statement other than "package ifneeded" +# and/or if any package ifneeded loads a DLL +### +proc ::practcl::_pkgindex_directory {path} { + set buffer {} + set pkgidxfile [file join $path pkgIndex.tcl] + if {![file exists $pkgidxfile]} { + # No pkgIndex file, read the source + foreach file [glob -nocomplain $path/*.tm] { + set file [file normalize $file] + set fname [file rootname [file tail $file]] + ### + # We used to be able to ... Assume the package is correct in the filename + # No hunt for a "package provides" + ### + set package [lindex [split $fname -] 0] + set version [lindex [split $fname -] 1] + ### + # Read the file, and override assumptions as needed + ### + set fin [open $file r] + set dat [read $fin] + close $fin + # Look for a teapot style Package statement + foreach line [split $dat \n] { + set line [string trim $line] + if { [string range $line 0 9] != "# Package " } continue + set package [lindex $line 2] + set version [lindex $line 3] + break + } + # Look for a package provide statement + foreach line [split $dat \n] { + set line [string trim $line] + if { [string range $line 0 14] != "package provide" } continue + set package [lindex $line 2] + set version [lindex $line 3] + break + } + append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n + } + foreach file [glob -nocomplain $path/*.tcl] { + if { [file tail $file] == "version_info.tcl" } continue + set fin [open $file r] + set dat [read $fin] + close $fin + if {![regexp "package provide" $dat]} continue + set fname [file rootname [file tail $file]] + # Look for a package provide statement + foreach line [split $dat \n] { + set line [string trim $line] + if { [string range $line 0 14] != "package provide" } continue + set package [lindex $line 2] + set version [lindex $line 3] + if {[string index $package 0] in "\$ \["} continue + if {[string index $version 0] in "\$ \["} continue + append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n + break + } + } + return $buffer + } + set fin [open $pkgidxfile r] + set dat [read $fin] + close $fin + set thisline {} + foreach line [split $dat \n] { + append thisline $line \n + if {![info complete $thisline]} continue + set line [string trim $line] + if {[string length $line]==0} { + set thisline {} ; continue + } + if {[string index $line 0] eq "#"} { + set thisline {} ; continue + } + try { + # Ignore contditionals + if {[regexp "if.*catch.*package.*Tcl.*return" $thisline]} continue + if {[regexp "if.*package.*vsatisfies.*package.*provide.*return" $thisline]} continue + if {![regexp "package.*ifneeded" $thisline]} { + # This package index contains arbitrary code + # source instead of trying to add it to the master + # package index + return {source [file join $dir pkgIndex.tcl]} + } + append buffer $thisline \n + } on error {err opts} { + puts *** + puts "GOOF: $pkgidxfile" + puts $line + puts $err + puts [dict get $opts -errorinfo] + puts *** + } finally { + set thisline {} + } + } + return $buffer +} + + +proc ::practcl::_pkgindex_path_subdir {path} { + set result {} + foreach subpath [glob -nocomplain [file join $path *]] { + if {[file isdirectory $subpath]} { + lappend result $subpath {*}[_pkgindex_path_subdir $subpath] + } + } + return $result +} +### +# Index all paths given as though they will end up in the same +# virtual file system +### +proc ::practcl::pkgindex_path args { + set stack {} + set buffer { +lappend ::PATHSTACK $dir + } + foreach base $args { + set base [file normalize $base] + set paths [::practcl::_pkgindex_path_subdir $base] + set i [string length $base] + # Build a list of all of the paths + foreach path $paths { + if {$path eq $base} continue + set path_indexed($path) 0 + } + set path_indexed($base) 1 + set path_indexed([file join $base boot tcl]) 1 + #set path_index([file join $base boot tk]) 1 + + foreach path $paths { + if {$path_indexed($path)} continue + set thisdir [file_relative $base $path] + #set thisdir [string range $path $i+1 end] + set idxbuf [::practcl::_pkgindex_directory $path] + if {[string length $idxbuf]} { + incr path_indexed($path) + append buffer "set dir \[set PKGDIR \[file join \[lindex \$::PATHSTACK end\] $thisdir\]\]" \n + append buffer [string map {$dir $PKGDIR} [string trimright $idxbuf]] \n + } + } + } + append buffer { +set dir [lindex $::PATHSTACK end] +set ::PATHSTACK [lrange $::PATHSTACK 0 end-1] +} + return $buffer +} + +### +# topic: 64319f4600fb63c82b2258d908f9d066 +# description: Script to build the VFS file system +### +proc ::practcl::installDir {d1 d2} { + + puts [format {%*sCreating %s} [expr {4 * [info level]}] {} [file tail $d2]] + file delete -force -- $d2 + file mkdir $d2 + + foreach ftail [glob -directory $d1 -nocomplain -tails *] { + set f [file join $d1 $ftail] + if {[file isdirectory $f] && [string compare CVS $ftail]} { + installDir $f [file join $d2 $ftail] + } elseif {[file isfile $f]} { + file copy -force $f [file join $d2 $ftail] + if {$::tcl_platform(platform) eq {unix}} { + file attributes [file join $d2 $ftail] -permissions 0644 + } else { + file attributes [file join $d2 $ftail] -readonly 1 + } + } + } + + if {$::tcl_platform(platform) eq {unix}} { + file attributes $d2 -permissions 0755 + } else { + file attributes $d2 -readonly 1 + } +} + +proc ::practcl::copyDir {d1 d2} { + #puts [list $d1 -> $d2] + #file delete -force -- $d2 + file mkdir $d2 + + foreach ftail [glob -directory $d1 -nocomplain -tails *] { + set f [file join $d1 $ftail] + if {[file isdirectory $f] && [string compare CVS $ftail]} { + copyDir $f [file join $d2 $ftail] + } elseif {[file isfile $f]} { + file copy -force $f [file join $d2 $ftail] + } + } +} + +::oo::class create ::practcl::metaclass { + superclass ::oo::object + + method script script { + eval $script + } + + method source filename { + source $filename + } + + method initialize {} {} + + method define {submethod args} { + my variable define + switch $submethod { + dump { + return [array get define] + } + add { + set field [lindex $args 0] + if {![info exists define($field)]} { + set define($field) {} + } + foreach arg [lrange $args 1 end] { + if {$arg ni $define($field)} { + lappend define($field) $arg + } + } + return $define($field) + } + remove { + set field [lindex $args 0] + if {![info exists define($field)]} { + return + } + set rlist [lrange $args 1 end] + set olist $define($field) + set nlist {} + foreach arg $olist { + if {$arg in $rlist} continue + lappend nlist $arg + } + set define($field) $nlist + return $nlist + } + exists { + set field [lindex $args 0] + return [info exists define($field)] + } + getnull - + get - + cget { + set field [lindex $args 0] + if {[info exists define($field)]} { + return $define($field) + } + return [lindex $args 1] + } + set { + if {[llength $args]==1} { + set arglist [lindex $args 0] + } else { + set arglist $args + } + array set define $arglist + if {[dict exists $arglist class]} { + my select + } + } + default { + array $submethod define {*}$args + } + } + } + + method graft args { + my variable organs + if {[llength $args] == 1} { + error "Need two arguments" + } + set object {} + foreach {stub object} $args { + dict set organs $stub $object + oo::objdefine [self] forward <${stub}> $object + oo::objdefine [self] export <${stub}> + } + return $object + } + + method organ {{stub all}} { + my variable organs + if {![info exists organs]} { + return {} + } + if { $stub eq "all" } { + return $organs + } + if {[dict exists $organs $stub]} { + return [dict get $organs $stub] + } + } + + method link {command args} { + my variable links + switch $command { + object { + foreach obj $args { + foreach linktype [$obj linktype] { + my link add $linktype $obj + } + } + } + add { + ### + # Add a link to an object that was externally created + ### + if {[llength $args] ne 2} { error "Usage: link add LINKTYPE OBJECT"} + lassign $args linktype object + if {[info exists links($linktype)] && $object in $links($linktype)} { + return + } + lappend links($linktype) $object + } + remove { + set object [lindex $args 0] + if {[llength $args]==1} { + set ltype * + } else { + set ltype [lindex $args 1] + } + foreach {linktype elements} [array get links $ltype] { + if {$object in $elements} { + set nlist {} + foreach e $elements { + if { $object ne $e } { lappend nlist $e } + } + set links($linktype) $nlist + } + } + } + list { + if {[llength $args]==0} { + return [array get links] + } + if {[llength $args] != 1} { error "Usage: link list LINKTYPE"} + set linktype [lindex $args 0] + if {![info exists links($linktype)]} { + return {} + } + return $links($linktype) + } + dump { + return [array get links] + } + } + } + + method select {} { + my variable define + set class {} + if {[info exists define(class)]} { + if {[info command $define(class)] ne {}} { + set class $define(class) + } elseif {[info command ::practcl::$define(class)] ne {}} { + set class ::practcl::$define(class) + } else { + switch $define(class) { + default { + set class ::practcl::object + } + } + } + } + if {$class ne {}} { + ::oo::objdefine [self] class $class + } + if {[::info exists define(oodefine)]} { + ::oo::objdefine [self] $define(oodefine) + unset define(oodefine) + } + } +} + +proc ::practcl::trigger {args} { + foreach name $args { + if {[dict exists $::make_objects $name]} { + [dict get $::make_objects $name] triggers + } + } +} + +proc ::practcl::depends {args} { + foreach name $args { + if {[dict exists $::make_objects $name]} { + [dict get $::make_objects $name] check + } + } +} + +proc ::practcl::target {name info} { + set obj [::practcl::target_obj new $name $info] + dict set ::make_objects $name $obj + if {[dict exists $info aliases]} { + foreach item [dict get $info aliases] { + if {![dict exists $::make_objects $item]} { + dict set ::make_objects $item $obj + } + } + } + set ::make($name) 0 + set ::trigger($name) 0 + set filename [$obj define get filename] + if {$filename ne {}} { + set ::target($name) $filename + } +} + +### Batch Tasks + +namespace eval ::practcl::build {} + +## method DEFS +# This method populates 4 variables: +# name - The name of the package +# version - The version of the package +# defs - C flags passed to the compiler +# includedir - A list of paths to feed to the compiler for finding headers +# +proc ::practcl::build::DEFS {PROJECT DEFS namevar versionvar defsvar} { + upvar 1 $namevar name $versionvar version NAME NAME $defsvar defs + set name [string tolower [${PROJECT} define get name [${PROJECT} define get pkg_name]]] + set NAME [string toupper $name] + set version [${PROJECT} define get version [${PROJECT} define get pkg_vers]] + if {$version eq {}} { + set version 0.1a + } + set defs {} + append defs " -DPACKAGE_NAME=\"${name}\" -DPACKAGE_VERSION=\"${version}\"" + append defs " -DPACKAGE_TARNAME=\"${name}\" -DPACKAGE_STRING=\"${name}\x5c\x20${version}\"" + set NAME [string toupper $name] + set idx 0 + set count 0 + while {$idx>=0} { + set ndx [string first " -D" $DEFS $idx+1] + set item [string range $DEFS $idx $ndx] + set item [string trim $item] + set item [string trimleft $item -D] + if {[string range $item 0 7] eq "PACKAGE_"} { + set idx $ndx + continue + } + set eqidx [string first = $item ] + if {$eqidx < 0} { + append defs { } $item + set idx $ndx + continue + } + + set field [string range $item 0 [expr {$eqidx-1}]] + set value [string range $item [expr {$eqidx+1}] end] + set emap {} + lappend emap \x5c \x5c\x5c \x20 \x5c\x20 \x22 \x5c\x22 \x28 \x5c\x28 \x29 \x5c\x29 + if {[string is integer -strict $value]} { + append defs " -D${field}=$value" + } else { + append defs " -D${field}=[string map $emap $value]" + } + set idx $ndx + } + return $defs +} + +proc ::practcl::build::tclkit_main {PROJECT PKG_OBJS} { + ### + # Build static package list + ### + set statpkglist {} + dict set statpkglist Tk {autoload 0} + puts [list TCLKIT MAIN $PROJECT] + + foreach {ofile info} [${PROJECT} compile-products] { + puts [list * PROD $ofile $info] + if {![dict exists $info object]} continue + set cobj [dict get $info object] + foreach {pkg info} [$cobj static-packages] { + dict set statpkglist $pkg $info + } + } + foreach cobj [list {*}${PKG_OBJS} $PROJECT] { + puts [list * PROG $cobj] + foreach {pkg info} [$cobj static-packages] { + puts [list * PKG $pkg $info] + dict set statpkglist $pkg $info + } + } + + set result {} + $PROJECT include {} + $PROJECT include {"tclInt.h"} + $PROJECT include {"tclFileSystem.h"} + $PROJECT include {} + $PROJECT include {} + $PROJECT include {} + $PROJECT include {} + $PROJECT include {} + + $PROJECT code header { +#ifndef MODULE_SCOPE +# define MODULE_SCOPE extern +#endif + +/* +** Provide a dummy Tcl_InitStubs if we are using this as a static +** library. +*/ +#ifndef USE_TCL_STUBS +# undef Tcl_InitStubs +# define Tcl_InitStubs(a,b,c) TCL_VERSION +#endif +#define STATIC_BUILD 1 +#undef USE_TCL_STUBS + +/* Make sure the stubbed variants of those are never used. */ +#undef Tcl_ObjSetVar2 +#undef Tcl_NewStringObj +#undef Tk_Init +#undef Tk_MainEx +#undef Tk_SafeInit +} + + # Build an area of the file for #define directives and + # function declarations + set define {} + set mainhook [$PROJECT define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] + set mainfunc [$PROJECT define get TCL_LOCAL_APPINIT Tclkit_AppInit] + set mainscript [$PROJECT define get main.tcl main.tcl] + set vfsroot [$PROJECT define get vfsroot zipfs:/app] + set vfs_main "${vfsroot}/${mainscript}" + set vfs_tcl_library "${vfsroot}/boot/tcl" + set vfs_tk_library "${vfsroot}/boot/tk" + + set map {} + foreach var { + vfsroot mainhook mainfunc vfs_main vfs_tcl_library vfs_tk_library + } { + dict set map %${var}% [set $var] + } + set preinitscript { +set ::odie(boot_vfs) {%vfsroot%} +set ::SRCDIR {%vfsroot%} +if {[file exists {%vfs_tcl_library%}]} { + set ::tcl_library {%vfs_tcl_library%} + set ::auto_path {} +} +if {[file exists {%vfs_tk_library%}]} { + set ::tk_library {%vfs_tk_library%} +} +} ; # Preinitscript + + set zvfsboot { +/* + * %mainhook% -- + * Performs the argument munging for the shell + */ + } + ::practcl::cputs zvfsboot { + CONST char *archive; + Tcl_FindExecutable(*argv[0]); + archive=Tcl_GetNameOfExecutable(); + + Tclzipfs_Init(NULL); + } + # We have to initialize the virtual filesystem before calling + # Tcl_Init(). Otherwise, Tcl_Init() will not be able to find + # its startup script files. + $PROJECT include {"tclZipfs.h"} + + ::practcl::cputs zvfsboot " if(!TclZipfsMount(NULL, archive, \"%vfsroot%\", NULL)) \x7B " + ::practcl::cputs zvfsboot { + Tcl_Obj *vfsinitscript; + vfsinitscript=Tcl_NewStringObj("%vfs_main%",-1); + Tcl_IncrRefCount(vfsinitscript); + if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { + /* Startup script should be set before calling Tcl_AppInit */ + Tcl_SetStartupScript(vfsinitscript,NULL); + } + } + ::practcl::cputs zvfsboot " TclSetPreInitScript([::practcl::tcl_to_c $preinitscript])\;" + ::practcl::cputs zvfsboot " \x7D else \x7B" + ::practcl::cputs zvfsboot " TclSetPreInitScript([::practcl::tcl_to_c { +foreach path { + ../tcl +} { + set p [file join $path library init.tcl] + if {[file exists [file join $path library init.tcl]]} { + set ::tcl_library [file normalize [file join $path library]] + break + } +} +foreach path { + ../tk +} { + if {[file exists [file join $path library tk.tcl]]} { + set ::tk_library [file normalize [file join $path library]] + break + } +} +}])\;" + + ::practcl::cputs zvfsboot " \x7D" + + ::practcl::cputs zvfsboot " return TCL_OK;" + + if {[$PROJECT define get os] eq "windows"} { + set header {int %mainhook%(int *argc, TCHAR ***argv)} + } else { + set header {int %mainhook%(int *argc, char ***argv)} + } + $PROJECT c_function [string map $map $header] [string map $map $zvfsboot] + + practcl::cputs appinit "int %mainfunc%(Tcl_Interp *interp) \x7B" + + # Build AppInit() + set appinit {} + practcl::cputs appinit { + if ((Tcl_Init)(interp) == TCL_ERROR) { + return TCL_ERROR; + } +} + set main_init_script {} + + foreach {statpkg info} $statpkglist { + set initfunc {} + if {[dict exists $info initfunc]} { + set initfunc [dict get $info initfunc] + } + if {$initfunc eq {}} { + set initfunc [string totitle ${statpkg}]_Init + } + # We employ a NULL to prevent the package system from thinking the + # package is actually loaded into the interpreter + $PROJECT code header "extern Tcl_PackageInitProc $initfunc\;\n" + set script [list package ifneeded $statpkg [dict get $info version] [list ::load {} $statpkg]] + append main_init_script \n [list set ::kitpkg(${statpkg}) $script] + if {[dict get $info autoload]} { + ::practcl::cputs appinit " if(${initfunc}(interp)) return TCL_ERROR\;" + ::practcl::cputs appinit " Tcl_StaticPackage(interp,\"$statpkg\",$initfunc,NULL)\;" + } else { + ::practcl::cputs appinit "\n Tcl_StaticPackage(NULL,\"$statpkg\",$initfunc,NULL)\;" + append main_init_script \n $script + } + } + append main_init_script \n { +if {[file exists [file join $::SRCDIR packages.tcl]]} { + #In a wrapped exe, we don't go out to the environment + set dir $::SRCDIR + source [file join $::SRCDIR packages.tcl] +} +# Specify a user-specific startup file to invoke if the application +# is run interactively. Typically the startup file is "~/.apprc" +# where "app" is the name of the application. If this line is deleted +# then no user-specific startup file will be run under any conditions. + } + append main_init_script \n [list set tcl_rcFileName [$PROJECT define get tcl_rcFileName ~/.tclshrc]] + practcl::cputs appinit " Tcl_Eval(interp,[::practcl::tcl_to_c $main_init_script]);" + practcl::cputs appinit { return TCL_OK;} + $PROJECT c_function [string map $map "int %mainfunc%(Tcl_Interp *interp)"] [string map $map $appinit] +} + +proc ::practcl::build::compile-sources {PROJECT COMPILE {CPPCOMPILE {}}} { + set EXTERN_OBJS {} + set OBJECTS {} + set result {} + set builddir [$PROJECT define get builddir] + file mkdir [file join $builddir objs] + set debug [$PROJECT define get debug 0] + if {$CPPCOMPILE eq {}} { + set CPPCOMPILE $COMPILE + } + set task [${PROJECT} compile-products] + ### + # Compile the C sources + ### + foreach {ofile info} $task { + dict set task $ofile done 0 + if {[dict exists $info external] && [dict get $info external]==1} { + dict set task $ofile external 1 + } else { + dict set task $ofile external 0 + } + if {[dict exists $info library]} { + dict set task $ofile done 1 + continue + } + # Products with no cfile aren't compiled + if {![dict exists $info cfile] || [set cfile [dict get $info cfile]] eq {}} { + dict set task $ofile done 1 + continue + } + set cfile [dict get $info cfile] + set ofilename [file join $builddir objs [file tail $ofile]] + if {$debug} { + set ofilename [file join $builddir objs [file rootname [file tail $ofile]].debug.o] + } + dict set task $ofile filename $ofilename + if {[file exists $ofilename] && [file mtime $ofilename]>[file mtime $cfile]} { + lappend result $ofilename + dict set task $ofile done 1 + continue + } + if {![dict exist $info command]} { + if {[file extension $cfile] in {.c++ .cpp}} { + set cmd $CPPCOMPILE + } else { + set cmd $COMPILE + } + if {[dict exists $info extra]} { + append cmd " [dict get $info extra]" + } + append cmd " -c $cfile" + append cmd " -o $ofilename" + dict set task $ofile command $cmd + } + } + set completed 0 + while {$completed==0} { + set completed 1 + foreach {ofile info} $task { + set waiting {} + if {[dict exists $info done] && [dict get $info done]} continue + if {[dict exists $info depend]} { + foreach file [dict get $info depend] { + if {[dict exists $task $file command] && [dict exists $task $file done] && [dict get $task $file done] != 1} { + set waiting $file + break + } + } + } + if {$waiting ne {}} { + set completed 0 + puts "$ofile waiting for $waiting" + continue + } + if {[dict exists $info command]} { + set cmd [dict get $info command] + puts "$cmd" + exec {*}$cmd >&@ stdout + } + lappend result [dict get $info filename] + dict set task $ofile done 1 + } + } + return $result +} + +proc ::practcl::de_shell {data} { + set values {} + foreach flag {DEFS TCL_DEFS TK_DEFS} { + if {[dict exists $data $flag]} { + set value {} + foreach item [dict get $data $flag] { + append value " " [string map {{ } {\ }} $item] + } + dict set values $flag $value + } + } + set map {} + lappend map {${PKG_OBJECTS}} %LIBRARY_OBJECTS% + lappend map {$(PKG_OBJECTS)} %LIBRARY_OBJECTS% + lappend map {${PKG_STUB_OBJECTS}} %LIBRARY_STUB_OBJECTS% + lappend map {$(PKG_STUB_OBJECTS)} %LIBRARY_STUB_OBJECTS% + + lappend map %LIBRARY_NAME% [dict get $data name] + lappend map %LIBRARY_VERSION% [dict get $data version] + lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} [dict get $data version]] + if {[dict exists $data libprefix]} { + lappend map %LIBRARY_PREFIX% [dict get $data libprefix] + } else { + lappend map %LIBRARY_PREFIX% [dict get $data prefix] + } + foreach flag [dict keys $data] { + if {$flag in {TCL_DEFS TK_DEFS DEFS}} continue + + dict set map "%${flag}%" [dict get $data $flag] + dict set map "\$\{${flag}\}" [dict get $data $flag] + dict set map "\$\(${flag}\)" [dict get $data $flag] + dict set values $flag [dict get $data $flag] + #dict set map "\$\{${flag}\}" $proj($flag) + } + set changed 1 + while {$changed} { + set changed 0 + foreach {field value} $values { + if {$field in {TCL_DEFS TK_DEFS DEFS}} continue + dict with values {} + set newval [string map $map $value] + if {$newval eq $value} continue + set changed 1 + dict set values $field $newval + } + } + return $values +} + +proc ::practcl::build::Makefile {path PROJECT} { + array set proj [$PROJECT define dump] + set path $proj(builddir) + cd $path + set includedir . + #lappend includedir [::practcl::file_relative $path $proj(TCL_INCLUDES)] + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TCL_SRC_DIR) generic]]] + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(srcdir) generic]]] + foreach include [$PROJECT generate-include-directory] { + set cpath [::practcl::file_relative $path [file normalize $include]] + if {$cpath ni $includedir} { + lappend includedir $cpath + } + } + set INCLUDES "-I[join $includedir " -I"]" + set NAME [string toupper $proj(name)] + set result {} + set products {} + set libraries {} + set thisline {} + ::practcl::cputs result "${NAME}_DEFS = $proj(DEFS)\n" + ::practcl::cputs result "${NAME}_INCLUDES = -I\"[join $includedir "\" -I\""]\"\n" + ::practcl::cputs result "${NAME}_COMPILE = \$(CC) \$(CFLAGS) \$(PKG_CFLAGS) \$(${NAME}_DEFS) \$(${NAME}_INCLUDES) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS) \$(AM_CFLAGS)" + ::practcl::cputs result "${NAME}_CPPCOMPILE = \$(CXX) \$(CFLAGS) \$(PKG_CFLAGS) \$(${NAME}_DEFS) \$(${NAME}_INCLUDES) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS) \$(AM_CFLAGS)" + + foreach {ofile info} [$PROJECT compile-products] { + dict set products $ofile $info + if {[dict exists $info library]} { +lappend libraries $ofile +continue + } + if {[dict exists $info depend]} { + ::practcl::cputs result "\n${ofile}: [dict get $info depend]" + } else { + ::practcl::cputs result "\n${ofile}:" + } + set cfile [dict get $info cfile] + if {[file extension $cfile] in {.c++ .cpp}} { + set cmd "\t\$\(${NAME}_CPPCOMPILE\)" + } else { + set cmd "\t\$\(${NAME}_COMPILE\)" + } + if {[dict exists $info extra]} { + append cmd " [dict get $info extra]" + } + append cmd " -c [dict get $info cfile] -o \$@\n\t" + ::practcl::cputs result $cmd + } + + set map {} + lappend map %LIBRARY_NAME% $proj(name) + lappend map %LIBRARY_VERSION% $proj(version) + lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} $proj(version)] + lappend map %LIBRARY_PREFIX% [$PROJECT define getnull libprefix] + + if {[string is true [$PROJECT define get SHARED_BUILD]]} { + set outfile [$PROJECT define get libfile] + } else { + set outfile [$PROJECT shared_library] + } + $PROJECT define set shared_library $outfile + ::practcl::cputs result " +${NAME}_SHLIB = $outfile +${NAME}_OBJS = [dict keys $products] +" + + #lappend map %OUTFILE% {\[$]@} + lappend map %OUTFILE% $outfile + lappend map %LIBRARY_OBJECTS% "\$(${NAME}_OBJS)" + ::practcl::cputs result "$outfile: \$(${NAME}_OBJS)" + ::practcl::cputs result "\t[string map $map [$PROJECT define get PRACTCL_SHARED_LIB]]" + if {[$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL] ni {: {}}} { + ::practcl::cputs result "\t[string map $map [$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL]]" + } + ::practcl::cputs result {} + if {[string is true [$PROJECT define get SHARED_BUILD]]} { + #set outfile [$PROJECT static_library] + set outfile $proj(name).a + } else { + set outfile [$PROJECT define get libfile] + } + $PROJECT define set static_library $outfile + dict set map %OUTFILE% $outfile + ::practcl::cputs result "$outfile: \$(${NAME}_OBJS)" + ::practcl::cputs result "\t[string map $map [$PROJECT define get PRACTCL_STATIC_LIB]]" + ::practcl::cputs result {} + return $result +} + +### +# Produce a dynamic library +### +proc ::practcl::build::library {outfile PROJECT} { + array set proj [$PROJECT define dump] + set path $proj(builddir) + cd $path + set includedir . + #lappend includedir [::practcl::file_relative $path $proj(TCL_INCLUDES)] + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TCL_SRC_DIR) generic]]] + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(srcdir) generic]]] + if {[$PROJECT define get tk 0]} { + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TK_SRC_DIR) generic]]] + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TK_SRC_DIR) ttk]]] + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TK_SRC_DIR) xlib]]] + lappend includedir [::practcl::file_relative $path [file normalize $proj(TK_BIN_DIR)]] + } + foreach include [$PROJECT generate-include-directory] { + set cpath [::practcl::file_relative $path [file normalize $include]] + if {$cpath ni $includedir} { + lappend includedir $cpath + } + } + ::practcl::build::DEFS $PROJECT $proj(DEFS) name version defs + set NAME [string toupper $name] + set debug [$PROJECT define get debug 0] + set os [$PROJECT define get os] + + set INCLUDES "-I[join $includedir " -I"]" + if {$debug} { + set COMPILE "$proj(CC) $proj(CFLAGS_DEBUG) -ggdb \ +$proj(CFLAGS_WARNING) $INCLUDES $defs" + + if {[info exists proc(CXX)]} { + set COMPILECPP "$proj(CXX) $defs $INCLUDES $proj(CFLAGS_DEBUG) -ggdb \ + $proj(DEFS) $proj(CFLAGS_WARNING)" + } else { + set COMPILECPP $COMPILE + } + } else { + set COMPILE "$proj(CC) $proj(CFLAGS) $defs $INCLUDES " + + if {[info exists proc(CXX)]} { + set COMPILECPP "$proj(CXX) $defs $INCLUDES $proj(CFLAGS) $proj(DEFS)" + } else { + set COMPILECPP $COMPILE + } + } + + set products [compile-sources $PROJECT $COMPILE $COMPILECPP] + + set map {} + lappend map %LIBRARY_NAME% $proj(name) + lappend map %LIBRARY_VERSION% $proj(version) + lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} $proj(version)] + lappend map %OUTFILE% $outfile + lappend map %LIBRARY_OBJECTS% $products + lappend map {${CFLAGS}} "$proj(CFLAGS_DEFAULT) $proj(CFLAGS_WARNING)" + + if {[string is true [$PROJECT define get SHARED_BUILD 1]]} { + set cmd [$PROJECT define get PRACTCL_SHARED_LIB] + append cmd " [$PROJECT define get PRACTCL_LIBS]" + set cmd [string map $map $cmd] + puts $cmd + exec {*}$cmd >&@ stdout + if {[$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL] ni {: {}}} { + set cmd [string map $map [$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL]] + puts $cmd + exec {*}$cmd >&@ stdout + } + } else { + set cmd [string map $map [$PROJECT define get PRACTCL_STATIC_LIB]] + puts $cmd + exec {*}$cmd >&@ stdout + } +} + +### +# Produce a static executable +### +proc ::practcl::build::static-tclsh {outfile PROJECT} { + puts " BUILDING STATIC TCLSH " + set TCLOBJ [$PROJECT project TCLCORE] + set TKOBJ [$PROJECT project TKCORE] + set ODIEOBJ [$PROJECT project odie] + + set PKG_OBJS {} + foreach item [$PROJECT link list package] { + if {[string is true [$item define get static]]} { + lappend PKG_OBJS $item + } + } + array set TCL [$TCLOBJ config.sh] + array set TK [$TKOBJ config.sh] + set path [file dirname $outfile] + cd $path + ### + # For a static Tcl shell, we need to build all local sources + # with the same DEFS flags as the tcl core was compiled with. + # The DEFS produced by a TEA extension aren't intended to operate + # with the internals of a staticly linked Tcl + ### + ::practcl::build::DEFS $PROJECT $TCL(defs) name version defs + set debug [$PROJECT define get debug 0] + set NAME [string toupper $name] + set result {} + set libraries {} + set thisline {} + set OBJECTS {} + set EXTERN_OBJS {} + foreach obj $PKG_OBJS { + $obj compile + set config($obj) [$obj config.sh] + } + set os [$PROJECT define get os] + set TCLSRCDIR [$TCLOBJ define get srcroot] + set TKSRCDIR [$TKOBJ define get srcroot] + + set includedir . + foreach include [$TCLOBJ generate-include-directory] { + set cpath [::practcl::file_relative $path [file normalize $include]] + if {$cpath ni $includedir} { + lappend includedir $cpath + } + } + lappend includedir [::practcl::file_relative $path [file normalize ../tcl/compat/zlib]] + foreach include [$PROJECT generate-include-directory] { + set cpath [::practcl::file_relative $path [file normalize $include]] + if {$cpath ni $includedir} { + lappend includedir $cpath + } + } + + set INCLUDES "-I[join $includedir " -I"]" + if {$debug} { + set COMPILE "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_debug) -ggdb \ +$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" + } else { + set COMPILE "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_optimize) \ +$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" + } + append COMPILE " " $defs + lappend OBJECTS {*}[compile-sources $PROJECT $COMPILE $COMPILE] + + if {[${PROJECT} define get platform] eq "windows"} { + set RSOBJ [file join $path build tclkit.res.o] + set RCSRC [${PROJECT} define get kit_resource_file] + if {$RCSRC eq {} || ![file exists $RCSRC]} { + set RCSRC [file join $TKSRCDIR win rc wish.rc] + } + set cmd [list windres -o $RSOBJ -DSTATIC_BUILD] + set TCLSRC [file normalize $TCLSRCDIR] + set TKSRC [file normalize $TKSRCDIR] + + lappend cmd --include [::practcl::file_relative $path [file join $TCLSRC generic]] \ + --include [::practcl::file_relative $path [file join $TKSRC generic]] \ + --include [::practcl::file_relative $path [file join $TKSRC win]] \ + --include [::practcl::file_relative $path [file join $TKSRC win rc]] + foreach item [${PROJECT} define get resource_include] { + lappend cmd --include [::practcl::file_relative $path [file normalize $item]] + } + lappend cmd $RCSRC + doexec {*}$cmd + + lappend OBJECTS $RSOBJ + set LDFLAGS_CONSOLE {-mconsole -pipe -static-libgcc} + set LDFLAGS_WINDOW {-mwindows -pipe -static-libgcc} + } else { + set LDFLAGS_CONSOLE {} + set LDFLAGS_WINDOW {} + } + puts "***" + if {$debug} { + set cmd "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_debug) \ +$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" + } else { + set cmd "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_optimize) \ +$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" + } + append cmd " $OBJECTS" + append cmd " $EXTERN_OBJS " + # On OSX it is impossibly to generate a completely static + # executable + if {[$PROJECT define get TEACUP_OS] ne "macosx"} { + append cmd " -static " + } + parray TCL + if {$debug} { + if {$os eq "windows"} { + append cmd " -L${TCL(src_dir)}/win -ltcl86g" + append cmd " -L${TK(src_dir)}/win -ltk86g" + } else { + append cmd " -L${TCL(src_dir)}/unix -ltcl86g" + append cmd " -L${TK(src_dir)}/unix -ltk86g" + } + } else { + append cmd " $TCL(build_lib_spec) $TK(build_lib_spec)" + } + foreach obj $PKG_OBJS { + append cmd " [$obj linker-products $config($obj)]" + } + append cmd " $TCL(libs) $TK(libs)" + foreach obj $PKG_OBJS { + append cmd " [$obj linker-external $config($obj)]" + } + if {$debug} { + if {$os eq "windows"} { + append cmd " -L${TCL(src_dir)}/win ${TCL(stub_lib_flag)}" + append cmd " -L${TK(src_dir)}/win ${TK(stub_lib_flag)}" + } else { + append cmd " -L${TCL(src_dir)}/unix ${TCL(stub_lib_flag)}" + append cmd " -L${TK(src_dir)}/unix ${TK(stub_lib_flag)}" + } + } else { + append cmd " $TCL(build_stub_lib_spec)" + append cmd " $TK(build_stub_lib_spec)" + } + append cmd " -o $outfile $LDFLAGS_CONSOLE" + puts "LINK: $cmd" + exec {*}$cmd >&@ stdout +} + +::oo::class create ::practcl::target_obj { + superclass ::practcl::metaclass + + constructor {name info} { + my variable define triggered domake + set triggered 0 + set domake 0 + set define(name) $name + set data [uplevel 2 [list subst $info]] + array set define $data + my select + my initialize + } + + method do {} { + my variable domake + return $domake + } + + method check {} { + my variable needs_make domake + if {$domake} { + return 1 + } + if {[info exists needs_make]} { + return $needs_make + } + set needs_make 0 + foreach item [my define get depends] { + if {![dict exists $::make_objects $item]} continue + set depobj [dict get $::make_objects $item] + if {$depobj eq [self]} { + puts "WARNING [self] depends on itself" + continue + } + if {[$depobj check]} { + set needs_make 1 + } + } + if {!$needs_make} { + set filename [my define get filename] + if {$filename ne {} && ![file exists $filename]} { + set needs_make 1 + } + } + return $needs_make + } + + method triggers {} { + my variable triggered domake define + if {$triggered} { + return $domake + } + set triggered 1 + foreach item [my define get depends] { + puts [list $item [dict exists $::make_objects $item]] + if {![dict exists $::make_objects $item]} continue + set depobj [dict get $::make_objects $item] + if {$depobj eq [self]} { + puts "WARNING [self] triggers itself" + continue + } else { + set r [$depobj check] + puts [list $depobj check $r] + if {$r} { + puts [list $depobj TRIGGER] + $depobj triggers + } + } + } + if {[info exists ::make($define(name))] && $::make($define(name))} { + return + } + set ::make($define(name)) 1 + ::practcl::trigger {*}[my define get triggers] + } +} + + +### +# Define the metaclass +### +::oo::class create ::practcl::object { + superclass ::practcl::metaclass + + constructor {parent args} { + my variable links define + set organs [$parent child organs] + my graft {*}$organs + array set define $organs + array set define [$parent child define] + array set links {} + if {[llength $args]==1 && [file exists [lindex $args 0]]} { + my InitializeSourceFile [lindex $args 0] + } elseif {[llength $args] == 1} { + set data [uplevel 1 [list subst [lindex $args 0]]] + array set define $data + my select + my initialize + } else { + array set define [uplevel 1 [list subst $args]] + my select + my initialize + } + } + + + method include_dir args { + my define add include_dir {*}$args + } + + method include_directory args { + my define add include_dir {*}$args + } + + method Collate_Source CWD {} + + + method child {method} { + return {} + } + + method InitializeSourceFile filename { + my define set filename $filename + set class {} + switch [file extension $filename] { + .tcl { + set class ::practcl::dynamic + } + .h { + set class ::practcl::cheader + } + .c { + set class ::practcl::csource + } + .ini { + switch [file tail $filename] { + module.ini { + set class ::practcl::module + } + library.ini { + set class ::practcl::subproject + } + } + } + .so - + .dll - + .dylib - + .a { + set class ::practcl::clibrary + } + } + if {$class ne {}} { + oo::objdefine [self] class $class + my initialize + } + } + + method add args { + my variable links + set object [::practcl::object new [self] {*}$args] + foreach linktype [$object linktype] { + lappend links($linktype) $object + } + return $object + } + + method go {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable links + foreach {linktype objs} [array get links] { + foreach obj $objs { + $obj go + } + } + debug [list /[self] [self method] [self class]] + } + + method code {section body} { + my variable code + ::practcl::cputs code($section) $body + } + + method Ofile filename { + set lpath [my define get localpath] + if {$lpath eq {}} { + set lpath [my define get name] + } + return ${lpath}_[file rootname [file tail $filename]].o + } + + method compile-products {} { + set filename [my define get filename] + set result {} + if {$filename ne {}} { + if {[my define exists ofile]} { + set ofile [my define get ofile] + } else { + set ofile [my Ofile $filename] + my define set ofile $ofile + } + lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]] object [self]] + } + foreach item [my link list subordinate] { + lappend result {*}[$item compile-products] + } + return $result + } + + method generate-include-directory {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result [my define get include_dir] + foreach obj [my link list product] { + foreach path [$obj generate-include-directory] { + lappend result $path + } + } + return $result + } + + method generate-debug {{spaces {}}} { + set result {} + ::practcl::cputs result "$spaces[list [self] [list class [info object class [self]] filename [my define get filename]] links [my link list]]" + foreach item [my link list subordinate] { + practcl::cputs result [$item generate-debug "$spaces "] + } + return $result + } + + # Empty template methods + method generate-cheader {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cfunct cstruct methods tcltype tclprocs + set result {} + if {[info exists code(header)]} { + ::practcl::cputs result $code(header) + } + foreach obj [my link list product] { + # Exclude products that will generate their own C files + if {[$obj define get output_c] ne {}} continue + ::practcl::cputs result "/* BEGIN [$obj define get filename] generate-cheader */" + ::practcl::cputs result [$obj generate-cheader] + ::practcl::cputs result "/* END [$obj define get filename] generate-cheader */" + } + debug [list cfunct [info exists cfunct]] + if {[info exists cfunct]} { + foreach {funcname info} $cfunct { + if {[dict get $info public]} continue + ::practcl::cputs result "[dict get $info header]\;" + } + } + debug [list tclprocs [info exists tclprocs]] + if {[info exists tclprocs]} { + foreach {name info} $tclprocs { + if {[dict exists $info header]} { + ::practcl::cputs result "[dict get $info header]\;" + } + } + } + debug [list methods [info exists methods] [my define get cclass]] + + if {[info exists methods]} { + set thisclass [my define get cclass] + foreach {name info} $methods { + if {[dict exists $info header]} { + ::practcl::cputs result "[dict get $info header]\;" + } + } + # Add the initializer wrapper for the class + ::practcl::cputs result "static int ${thisclass}_OO_Init(Tcl_Interp *interp)\;" + } + return $result + } + + method generate-public-define {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code + set result {} + if {[info exists code(public-define)]} { + ::practcl::cputs result $code(public-define) + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-public-define] + } + return $result + } + + method generate-public-macro {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code + set result {} + if {[info exists code(public-macro)]} { + ::practcl::cputs result $code(public-macro) + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-public-macro] + } + return $result + } + + method generate-public-typedef {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cstruct + set result {} + if {[info exists code(public-typedef)]} { + ::practcl::cputs result $code(public-typedef) + } + if {[info exists cstruct]} { + # Add defintion for native c data structures + foreach {name info} $cstruct { + ::practcl::cputs result "typedef struct $name ${name}\;" + if {[dict exists $info aliases]} { + foreach n [dict get $info aliases] { + ::practcl::cputs result "typedef struct $name ${n}\;" + } + } + } + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-public-typedef] + } + return $result + } + + method generate-public-structure {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cstruct + set result {} + if {[info exists code(public-structure)]} { + ::practcl::cputs result $code(public-structure) + } + if {[info exists cstruct]} { + foreach {name info} $cstruct { + if {[dict exists $info comment]} { + ::practcl::cputs result [dict get $info comment] + } + ::practcl::cputs result "struct $name \{[dict get $info body]\}\;" + } + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-public-structure] + } + return $result + } + method generate-public-headers {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code tcltype + set result {} + if {[info exists code(public-header)]} { + ::practcl::cputs result $code(public-header) + } + if {[info exists tcltype]} { + foreach {type info} $tcltype { + if {![dict exists $info cname]} { + set cname [string tolower ${type}]_tclobjtype + dict set tcltype $type cname $cname + } else { + set cname [dict get $info cname] + } + ::practcl::cputs result "extern const Tcl_ObjType $cname\;" + } + } + if {[info exists code(public)]} { + ::practcl::cputs result $code(public) + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-public-headers] + } + return $result + } + + method generate-stub-function {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cfunct tcltype + set result {} + foreach mod [my link list product] { + foreach {funct def} [$mod generate-stub-function] { + dict set result $funct $def + } + } + if {[info exists cfunct]} { + foreach {funcname info} $cfunct { + if {![dict get $info export]} continue + dict set result $funcname [dict get $info header] + } + } + return $result + } + + method generate-public-function {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cfunct tcltype + set result {} + + if {[my define get initfunc] ne {}} { + ::practcl::cputs result "int [my define get initfunc](Tcl_Interp *interp);" + } + if {[info exists cfunct]} { + foreach {funcname info} $cfunct { + if {![dict get $info public]} continue + ::practcl::cputs result "[dict get $info header]\;" + } + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-public-function] + } + return $result + } + + method generate-public-includes {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set includes {} + foreach item [my define get public-include] { + if {$item ni $includes} { + lappend includes $item + } + } + foreach mod [my link list product] { + foreach item [$mod generate-public-includes] { + if {$item ni $includes} { + lappend includes $item + } + } + } + return $includes + } + method generate-public-verbatim {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set includes {} + foreach item [my define get public-verbatim] { + if {$item ni $includes} { + lappend includes $item + } + } + foreach mod [my link list subordinate] { + foreach item [$mod generate-public-verbatim] { + if {$item ni $includes} { + lappend includes $item + } + } + } + return $includes + } + ### + # This methods generates the contents of an amalgamated .h file + # which describes the public API of this module + ### + method generate-h {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result {} + set includes [my generate-public-includes] + foreach inc $includes { + if {[string index $inc 0] ni {< \"}} { + ::practcl::cputs result "#include \"$inc\"" + } else { + ::practcl::cputs result "#include $inc" + } + } + foreach file [my generate-public-verbatim] { + ::practcl::cputs result "/* BEGIN $file */" + ::practcl::cputs result [::practcl::cat $file] + ::practcl::cputs result "/* END $file */" + } + foreach method { + generate-public-define + generate-public-macro + generate-public-typedef + generate-public-structure + generate-public-headers + generate-public-function + } { + ::practcl::cputs result "/* BEGIN SECTION $method */" + ::practcl::cputs result [my $method] + ::practcl::cputs result "/* END SECTION $method */" + } + return $result + } + + ### + # This methods generates the contents of an amalgamated .c file + # which implements the loader for a batch of tools + ### + method generate-c {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result { +/* This file was generated by practcl */ + } + set includes {} + lappend headers + if {[my define get tk 0]} { + lappend headers + } + lappend headers {*}[my define get include] + if {[my define get output_h] ne {}} { + lappend headers "\"[my define get output_h]\"" + } + foreach mod [my link list product] { + # Signal modules to formulate final implementation + $mod go + } + foreach mod [my link list dynamic] { + foreach inc [$mod define get include] { + if {$inc ni $headers} { + lappend headers $inc + } + } + } + foreach inc $headers { + if {[string index $inc 0] ni {< \"}} { + ::practcl::cputs result "#include \"$inc\"" + } else { + ::practcl::cputs result "#include $inc" + } + } + foreach {method} { + generate-cheader + generate-cstruct + generate-constant + generate-cfunct + generate-cmethod + } { + ::practcl::cputs result "/* BEGIN $method [my define get filename] */" + ::practcl::cputs result [my $method] + ::practcl::cputs result "/* END $method [my define get filename] */" + } + debug [list /[self] [self method] [self class] -- [my define get filename] [info object class [self]]] + return $result + } + + + method generate-loader {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result {} + if {[my define get initfunc] eq {}} return + ::practcl::cputs result " +extern int DLLEXPORT [my define get initfunc]( Tcl_Interp *interp ) \{" + ::practcl::cputs result { + /* Initialise the stubs tables. */ + #ifdef USE_TCL_STUBS + if (Tcl_InitStubs(interp, "8.6", 0)==NULL) return TCL_ERROR; + if (TclOOInitializeStubs(interp, "1.0") == NULL) return TCL_ERROR; +} + if {[my define get tk 0]} { + ::practcl::cputs result { if (Tk_InitStubs(interp, "8.6", 0)==NULL) return TCL_ERROR;} + } + ::practcl::cputs result { #endif} + set TCLINIT [my generate-tcl] + ::practcl::cputs result " if(Tcl_Eval(interp,[::practcl::tcl_to_c $TCLINIT])) return TCL_ERROR ;" + foreach item [my link list product] { + if {[$item define get output_c] ne {}} { + ::practcl::cputs result [$item generate-cinit-external] + } else { + ::practcl::cputs result [$item generate-cinit] + } + } + if {[my define exists pkg_name]} { + ::practcl::cputs result " if (Tcl_PkgProvide(interp, \"[my define get pkg_name [my define get name]]\" , \"[my define get pkg_vers [my define get version]]\" )) return TCL_ERROR\;" + } + ::practcl::cputs result " return TCL_OK\;\n\}\n" + return $result + } + + ### + # This methods generates any Tcl script file + # which is required to pre-initialize the C library + ### + method generate-tcl {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result {} + my variable code + if {[info exists code(tcl)]} { + ::practcl::cputs result $code(tcl) + } + set result [::practcl::_tagblock $result tcl [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-tcl] + } + return $result + } + + method static-packages {} { + set result [my define get static_packages] + set statpkg [my define get static_pkg] + set initfunc [my define get initfunc] + if {$initfunc ne {}} { + set pkg_name [my define get pkg_name] + if {$pkg_name ne {}} { + dict set result $pkg_name initfunc $initfunc + dict set result $pkg_name version [my define get version [my define get pkg_vers]] + dict set result $pkg_name autoload [my define get autoload 0] + } + } + foreach item [my link list subordinate] { + foreach {pkg info} [$item static-packages] { + dict set result $pkg $info + } + } + return $result + } + + method target {method args} { + switch $method { + is_unix { return [expr {$::tcl_platform(platform) eq "unix"}] } + } + } + +} + +::oo::class create ::practcl::product { + superclass ::practcl::object + + method linktype {} { + return {subordinate product} + } + + method include header { + my define add include $header + } + + method cstructure {name definition {argdat {}}} { + my variable cstruct + dict set cstruct $name body $definition + foreach {f v} $argdat { + dict set cstruct $name $f $v + } + } + + method generate-cinit {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code + set result {} + if {[info exists code(cinit)]} { + ::practcl::cputs result $code(cinit) + } + if {[my define get initfunc] ne {}} { + ::practcl::cputs result " if([my define get initfunc](interp)!=TCL_OK) return TCL_ERROR\;" + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach obj [my link list product] { + ::practcl::cputs result [$obj generate-cinit] + } + return $result + } +} + +### +# Dynamic blocks do not generate their own .c files, +# instead the contribute to the amalgamation +# of the main library file +### +::oo::class create ::practcl::dynamic { + superclass ::practcl::product + + # Retrieve any additional source files required + + method compile-products {} { + set filename [my define get output_c] + set result {} + if {$filename ne {}} { + if {[my define exists ofile]} { + set ofile [my define get ofile] + } else { + set ofile [my Ofile $filename] + my define set ofile $ofile + } + lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]]] + } else { + set filename [my define get cfile] + if {$filename ne {}} { + if {[my define exists ofile]} { + set ofile [my define get ofile] + } else { + set ofile [my Ofile $filename] + my define set ofile $ofile + } + lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]]] + } + } + foreach item [my link list subordinate] { + lappend result {*}[$item compile-products] + } + return $result + } + + method implement path { + my go + my Collate_Source $path + if {[my define get output_c] eq {}} return + set filename [file join $path [my define get output_c]] + my define set cfile $filename + set fout [open $filename w] + puts $fout [my generate-c] + puts $fout "extern int DLLEXPORT [my define get initfunc]( Tcl_Interp *interp ) \x7B" + puts $fout [my generate-cinit] + if {[my define get pkg_name] ne {}} { + puts $fout " Tcl_PkgProvide(interp, \"[my define get pkg_name]\", \"[my define get pkg_vers]\");" + } + puts $fout " return TCL_OK\;" + puts $fout "\x7D" + close $fout + } + + method initialize {} { + set filename [my define get filename] + if {$filename eq {}} { + return + } + if {[my define get name] eq {}} { + my define set name [file tail [file rootname $filename]] + } + if {[my define get localpath] eq {}} { + my define set localpath [my define get localpath]_[my define get name] + } + ::source $filename + } + + method linktype {} { + return {subordinate product dynamic} + } + + ### + # Populate const static data structures + ### + method generate-cstruct {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cstruct methods tcltype + set result {} + if {[info exists code(struct)]} { + ::practcl::cputs result $code(struct) + } + foreach obj [my link list dynamic] { + # Exclude products that will generate their own C files + if {[$obj define get output_c] ne {}} continue + ::practcl::cputs result [$obj generate-cstruct] + } + return $result + } + + method generate-constant {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result {} + my variable code cstruct methods tcltype + if {[info exists code(constant)]} { + ::practcl::cputs result "/* [my define get filename] CONSTANT */" + ::practcl::cputs result $code(constant) + } + if {[info exists cstruct]} { + foreach {name info} $cstruct { + set map {} + lappend map @NAME@ $name + lappend map @MACRO@ GET[string toupper $name] + + if {[dict exists $info deleteproc]} { + lappend map @DELETEPROC@ [dict get $info deleteproc] + } else { + lappend map @DELETEPROC@ NULL + } + if {[dict exists $info cloneproc]} { + lappend map @CLONEPROC@ [dict get $info cloneproc] + } else { + lappend map @CLONEPROC@ NULL + } + ::practcl::cputs result [string map $map { +const static Tcl_ObjectMetadataType @NAME@DataType = { + TCL_OO_METADATA_VERSION_CURRENT, + "@NAME@", + @DELETEPROC@, + @CLONEPROC@ +}; +#define @MACRO@(OBJCONTEXT) (@NAME@ *) Tcl_ObjectGetMetadata(OBJCONTEXT,&@NAME@DataType) +}] + } + } + if {[info exists tcltype]} { + foreach {type info} $tcltype { + dict with info {} + ::practcl::cputs result "const Tcl_ObjType $cname = \{\n .freeIntRepProc = &${freeproc},\n .dupIntRepProc = &${dupproc},\n .updateStringProc = &${updatestringproc},\n .setFromAnyProc = &${setfromanyproc}\n\}\;" + } + } + + if {[info exists methods]} { + set mtypes {} + foreach {name info} $methods { + set callproc [dict get $info callproc] + set methodtype [dict get $info methodtype] + if {$methodtype in $mtypes} continue + lappend mtypes $methodtype + ### + # Build the data struct for this method + ### + ::practcl::cputs result "const static Tcl_MethodType $methodtype = \{" + ::practcl::cputs result " .version = TCL_OO_METADATA_VERSION_CURRENT,\n .name = \"$name\",\n .callProc = $callproc," + if {[dict exists $info deleteproc]} { + set deleteproc [dict get $info deleteproc] + } else { + set deleteproc NULL + } + if {$deleteproc ni { {} NULL }} { + ::practcl::cputs result " .deleteProc = $deleteproc," + } else { + ::practcl::cputs result " .deleteProc = NULL," + } + if {[dict exists $info cloneproc]} { + set cloneproc [dict get $info cloneproc] + } else { + set cloneproc NULL + } + if {$cloneproc ni { {} NULL }} { + ::practcl::cputs result " .cloneProc = $cloneproc\n\}\;" + } else { + ::practcl::cputs result " .cloneProc = NULL\n\}\;" + } + dict set methods $name methodtype $methodtype + } + } + foreach obj [my link list dynamic] { + # Exclude products that will generate their own C files + if {[$obj define get output_c] ne {}} continue + ::practcl::cputs result [$obj generate-constant] + } + return $result + } + + ### + # Generate code that provides subroutines called by + # Tcl API methods + ### + method generate-cfunct {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cfunct + set result {} + if {[info exists code(funct)]} { + ::practcl::cputs result $code(funct) + } + if {[info exists cfunct]} { + foreach {funcname info} $cfunct { + ::practcl::cputs result "[dict get $info header]\{[dict get $info body]\}\;" + } + } + foreach obj [my link list dynamic] { + # Exclude products that will generate their own C files + if {[$obj define get output_c] ne {}} { + continue + } + ::practcl::cputs result [$obj generate-cfunct] + } + return $result + } + + ### + # Generate code that provides implements Tcl API + # calls + ### + method generate-cmethod {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code methods tclprocs + set result {} + if {[info exists code(method)]} { + ::practcl::cputs result $code(method) + } + + if {[info exists tclprocs]} { + foreach {name info} $tclprocs { + if {![dict exists $info body]} continue + set callproc [dict get $info callproc] + set header [dict get $info header] + set body [dict get $info body] + ::practcl::cputs result "${header} \{${body}\}" + } + } + + + if {[info exists methods]} { + set thisclass [my define get cclass] + foreach {name info} $methods { + if {![dict exists $info body]} continue + set callproc [dict get $info callproc] + set header [dict get $info header] + set body [dict get $info body] + ::practcl::cputs result "${header} \{${body}\}" + } + # Build the OO_Init function + ::practcl::cputs result "static int ${thisclass}_OO_Init(Tcl_Interp *interp) \{" + ::practcl::cputs result [string map [list @CCLASS@ $thisclass @TCLCLASS@ [my define get class]] { + /* + ** Build the "@TCLCLASS@" class + */ + Tcl_Obj* nameObj; /* Name of a class or method being looked up */ + Tcl_Object curClassObject; /* Tcl_Object representing the current class */ + Tcl_Class curClass; /* Tcl_Class representing the current class */ + + /* + * Find the "@TCLCLASS@" class, and attach an 'init' method to it. + */ + + nameObj = Tcl_NewStringObj("@TCLCLASS@", -1); + Tcl_IncrRefCount(nameObj); + if ((curClassObject = Tcl_GetObjectFromObj(interp, nameObj)) == NULL) { + Tcl_DecrRefCount(nameObj); + return TCL_ERROR; + } + Tcl_DecrRefCount(nameObj); + curClass = Tcl_GetObjectAsClass(curClassObject); +}] + if {[dict exists $methods constructor]} { + set mtype [dict get $methods constructor methodtype] + ::practcl::cputs result [string map [list @MTYPE@ $mtype] { + /* Attach the constructor to the class */ + Tcl_ClassSetConstructor(interp, curClass, Tcl_NewMethod(interp, curClass, NULL, 1, &@MTYPE@, NULL)); + }] + } + foreach {name info} $methods { + dict with info {} + if {$name in {constructor destructor}} continue + ::practcl::cputs result [string map [list @NAME@ $name @MTYPE@ $methodtype] { + nameObj=Tcl_NewStringObj("@NAME@",-1); + Tcl_NewMethod(interp, curClass, nameObj, 1, &@MTYPE@, (ClientData) NULL); + Tcl_DecrRefCount(nameObj); +}] + if {[dict exists $info aliases]} { + foreach alias [dict get $info aliases] { + if {[dict exists $methods $alias]} continue + ::practcl::cputs result [string map [list @NAME@ $alias @MTYPE@ $methodtype] { + nameObj=Tcl_NewStringObj("@NAME@",-1); + Tcl_NewMethod(interp, curClass, nameObj, 1, &@MTYPE@, (ClientData) NULL); + Tcl_DecrRefCount(nameObj); +}] + } + } + } + ::practcl::cputs result " return TCL_OK\;\n\}\n" + } + foreach obj [my link list dynamic] { + # Exclude products that will generate their own C files + if {[$obj define get output_c] ne {}} continue + ::practcl::cputs result [$obj generate-cmethod] + } + return $result + } + + method generate-cinit-external {} { + if {[my define get initfunc] eq {}} { + return "/* [my define get filename] declared not initfunc */" + } + return " if([my define get initfunc](interp)) return TCL_ERROR\;" + } + + ### + # Generate code that runs when the package/module is + # initialized into the interpreter + ### + method generate-cinit {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result {} + my variable code methods tclprocs + if {[info exists code(nspace)]} { + ::practcl::cputs result " \{\n Tcl_Namespace *modPtr;" + foreach nspace $code(nspace) { + ::practcl::cputs result [string map [list @NSPACE@ $nspace] { + modPtr=Tcl_FindNamespace(interp,"@NSPACE@",NULL,TCL_NAMESPACE_ONLY); + if(!modPtr) { + modPtr = Tcl_CreateNamespace(interp, "@NSPACE@", NULL, NULL); + } +}] + } + ::practcl::cputs result " \}" + } + if {[info exists code(tclinit)]} { + ::practcl::cputs result $code(tclinit) + } + if {[info exists code(cinit)]} { + ::practcl::cputs result $code(cinit) + } + if {[info exists code(initfuncts)]} { + foreach func $code(initfuncts) { + ::practcl::cputs result " if (${func}(interp) != TCL_OK) return TCL_ERROR\;" + } + } + if {[info exists tclprocs]} { + foreach {name info} $tclprocs { + set map [list @NAME@ $name @CALLPROC@ [dict get $info callproc]] + ::practcl::cputs result [string map $map { Tcl_CreateObjCommand(interp,"@NAME@",(Tcl_ObjCmdProc *)@CALLPROC@,NULL,NULL);}] + if {[dict exists $info aliases]} { + foreach alias [dict get $info aliases] { + set map [list @NAME@ $alias @CALLPROC@ [dict get $info callproc]] + ::practcl::cputs result [string map $map { Tcl_CreateObjCommand(interp,"@NAME@",(Tcl_ObjCmdProc *)@CALLPROC@,NULL,NULL);}] + } + } + } + } + + if {[info exists code(nspace)]} { + ::practcl::cputs result " \{\n Tcl_Namespace *modPtr;" + foreach nspace $code(nspace) { + ::practcl::cputs result [string map [list @NSPACE@ $nspace] { + modPtr=Tcl_FindNamespace(interp,"@NSPACE@",NULL,TCL_NAMESPACE_ONLY); + Tcl_CreateEnsemble(interp, modPtr->fullName, modPtr, TCL_ENSEMBLE_PREFIX); + Tcl_Export(interp, modPtr, "[a-z]*", 1); +}] + } + ::practcl::cputs result " \}" + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach obj [my link list product] { + # Exclude products that will generate their own C files + if {[$obj define get output_c] ne {}} { + ::practcl::cputs result [$obj generate-cinit-external] + } else { + ::practcl::cputs result [$obj generate-cinit] + } + } + return $result + } + + method c_header body { + my variable code + ::practcl::cputs code(header) $body + } + + method c_code body { + my variable code + ::practcl::cputs code(funct) $body + } + method c_function {header body} { + my variable code cfunct + foreach regexp { + {(.*) ([a-zA-Z_][a-zA-Z0-9_]*) *\((.*)\)} + {(.*) (\x2a[a-zA-Z_][a-zA-Z0-9_]*) *\((.*)\)} + } { + if {[regexp $regexp $header all keywords funcname arglist]} { + dict set cfunct $funcname header $header + dict set cfunct $funcname body $body + dict set cfunct $funcname keywords $keywords + dict set cfunct $funcname arglist $arglist + dict set cfunct $funcname public [expr {"static" ni $keywords}] + dict set cfunct $funcname export [expr {"STUB_EXPORT" in $keywords}] + + return + } + } + ::practcl::cputs code(header) "$header\;" + # Could not parse that block as a function + # append it verbatim to our c_implementation + ::practcl::cputs code(funct) "$header [list $body]" + } + + + method cmethod {name body {arginfo {}}} { + my variable methods code + foreach {f v} $arginfo { + dict set methods $name $f $v + } + dict set methods $name body "Tcl_Object thisObject = Tcl_ObjectContextObject(objectContext); /* The current connection object */ +$body" + } + + method c_tclproc_nspace nspace { + my variable code + if {![info exists code(nspace)]} { + set code(nspace) {} + } + if {$nspace ni $code(nspace)} { + lappend code(nspace) $nspace + } + } + + method c_tclproc_raw {name body {arginfo {}}} { + my variable tclprocs code + + foreach {f v} $arginfo { + dict set tclprocs $name $f $v + } + dict set tclprocs $name body $body + } + + method go {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + next + my variable methods code cstruct tclprocs + if {[info exists methods]} { + debug [self] methods [my define get cclass] + set thisclass [my define get cclass] + foreach {name info} $methods { + # Provide a callproc + if {![dict exists $info callproc]} { + set callproc [string map {____ _ ___ _ __ _} [string map {{ } _ : _} OOMethod_${thisclass}_${name}]] + dict set methods $name callproc $callproc + } else { + set callproc [dict get $info callproc] + } + if {[dict exists $info body] && ![dict exists $info header]} { + dict set methods $name header "static int ${callproc}(ClientData clientData, Tcl_Interp *interp, Tcl_ObjectContext objectContext ,int objc ,Tcl_Obj *const *objv)" + } + if {![dict exists $info methodtype]} { + set methodtype [string map {{ } _ : _} MethodType_${thisclass}_${name}] + dict set methods $name methodtype $methodtype + } + } + if {![info exists code(initfuncts)] || "${thisclass}_OO_Init" ni $code(initfuncts)} { + lappend code(initfuncts) "${thisclass}_OO_Init" + } + } + set thisnspace [my define get nspace] + + if {[info exists tclprocs]} { + debug [self] tclprocs [dict keys $tclprocs] + foreach {name info} $tclprocs { + if {![dict exists $info callproc]} { + set callproc [string map {____ _ ___ _ __ _} [string map {{ } _ : _} Tclcmd_${thisnspace}_${name}]] + dict set tclprocs $name callproc $callproc + } else { + set callproc [dict get $info callproc] + } + if {[dict exists $info body] && ![dict exists $info header]} { + dict set tclprocs $name header "static int ${callproc}(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv\[\])" + } + } + } + debug [list /[self] [self method] [self class]] + } + + # Once an object marks itself as some + # flavor of dynamic, stop trying to morph + # it into something else + method select {} {} + + + method tcltype {name argdat} { + my variable tcltype + foreach {f v} $argdat { + dict set tcltype $name $f $v + } + if {![dict exists tcltype $name cname]} { + dict set tcltype $name cname [string tolower $name]_tclobjtype + } + lappend map @NAME@ $name + set info [dict get $tcltype $name] + foreach {f v} $info { + lappend map @[string toupper $f]@ $v + } + foreach {func fpat template} { + freeproc {@Name@Obj_freeIntRepProc} {void @FNAME@(Tcl_Obj *objPtr)} + dupproc {@Name@Obj_dupIntRepProc} {void @FNAME@(Tcl_Obj *srcPtr,Tcl_Obj *dupPtr)} + updatestringproc {@Name@Obj_updateStringRepProc} {void @FNAME@(Tcl_Obj *objPtr)} + setfromanyproc {@Name@Obj_setFromAnyProc} {int @FNAME@(Tcl_Interp *interp,Tcl_Obj *objPtr)} + } { + if {![dict exists $info $func]} { + error "$name does not define $func" + } + set body [dict get $info $func] + # We were given a function name to call + if {[llength $body] eq 1} continue + set fname [string map [list @Name@ [string totitle $name]] $fpat] + my c_function [string map [list @FNAME@ $fname] $template] [string map $map $body] + dict set tcltype $name $func $fname + } + } +} + +::oo::class create ::practcl::cheader { + superclass ::practcl::product + + method compile-products {} {} + method generate-cinit {} {} +} + +::oo::class create ::practcl::csource { + superclass ::practcl::product +} + +::oo::class create ::practcl::clibrary { + superclass ::practcl::product + + method linker-products {configdict} { + return [my define get filename] + } + +} + +### +# In the end, all C code must be loaded into a module +# This will either be a dynamically loaded library implementing +# a tcl extension, or a compiled in segment of a custom shell/app +### +::oo::class create ::practcl::module { + superclass ::practcl::dynamic + + method child which { + switch $which { + organs { + return [list project [my define get project] module [self]] + } + } + } + + method initialize {} { + set filename [my define get filename] + if {$filename eq {}} { + return + } + if {[my define get name] eq {}} { + my define set name [file tail [file dirname $filename]] + } + if {[my define get localpath] eq {}} { + my define set localpath [my define get name]_[my define get name] + } + debug [self] SOURCE $filename + my source $filename + } + + method implement path { + my go + my Collate_Source $path + foreach item [my link list dynamic] { + if {[catch {$item implement $path} err]} { + puts "Skipped $item: $err" + } + } + foreach item [my link list module] { + if {[catch {$item implement $path} err]} { + puts "Skipped $item: $err" + } + } + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set filename [my define get output_c] + if {$filename eq {}} { + debug [list /[self] [self method] [self class]] + return + } + set cout [open [file join $path [file rootname $filename].c] w] + puts $cout [subst {/* +** This file is generated by the [info script] script +** any changes will be overwritten the next time it is run +*/}] + puts $cout [my generate-c] + puts $cout [my generate-loader] + close $cout + debug [list /[self] [self method] [self class]] + } + + method linktype {} { + return {subordinate product dynamic module} + } +} + +::oo::class create ::practcl::autoconf { + + ### + # find or fake a key/value list describing this project + ### + method config.sh {} { + my variable conf_result + if {[info exists conf_result]} { + return $conf_result + } + set result {} + set name [my define get name] + set PWD $::CWD + set builddir [my define get builddir] + my unpack + set srcroot [my define get srcroot] + if {![file exists $builddir]} { + my Configure + } + set filename [file join $builddir config.tcl] + # Project uses the practcl template. Use the leavings from autoconf + if {[file exists $filename]} { + set dat [::practcl::config.tcl $builddir] + foreach {item value} [lsort -stride 2 -dictionary $dat] { + dict set result $item $value + } + set conf_result $result + return $result + } + set filename [file join $builddir ${name}Config.sh] + if {[file exists $filename]} { + set l [expr {[string length $name]+1}] + foreach {field dat} [::practcl::read_Config.sh $filename] { + set field [string tolower $field] + if {[string match ${name}_* $field]} { + set field [string range $field $l end] + } + dict set result $field $dat + } + set conf_result $result + return $result + } + ### + # Oh man... we have to guess + ### + set filename [file join $builddir Makefile] + if {![file exists $filename]} { + error "Could not locate any configuration data in $srcroot" + } + foreach {field dat} [::practcl::read_Makefile $filename] { + dict set result $field $dat + } + set conf_result $result + cd $PWD + return $result + } +} + + +::oo::class create ::practcl::project { + superclass ::practcl::module ::practcl::autoconf + + constructor args { + my variable define + if {[llength $args] == 1} { + if {[catch {uplevel 1 [list subst [lindex $args 0]]} contents]} { + set contents [lindex $args 0] + } + } else { + if {[catch {uplevel 1 [list subst $args]} contents]} { + set contents $args + } + } + array set define $contents + my select + my initialize + } + + + method add_project {pkg info {oodefine {}}} { + set os [my define get os] + if {$os eq {}} { + set os [::practcl::os] + my define set os $os + } + set fossilinfo [list download [my define get download] tag trunk sandbox [my define get sandbox]] + if {[dict exists $info os] && ($os ni [dict get $info os])} return + # Select which tag to use here. + # For production builds: tag-release + if {[::info exists ::env(FOSSIL_MIRROR)]} { + dict set info localmirror $::env(FOSSIL_MIRROR) + } + set profile [my define get profile release]: + if {[dict exists $info profile $profile]} { + dict set info tag [dict get $info profile $profile] + } + set obj [namespace current]::PROJECT.$pkg + if {[info command $obj] eq {}} { + set obj [::practcl::subproject create $obj [self] [dict merge $fossilinfo [list name $pkg pkg_name $pkg static 0] $info]] + } + my link object $obj + oo::objdefine $obj $oodefine + $obj define set masterpath $::CWD + $obj go + return $obj + } + + method child which { + switch $which { + organs { + # A library can be a project, it can be a module. Any + # subordinate modules will indicate their existance + return [list project [self] module [self]] + } + } + } + + method linktype {} { + return project + } + + # Exercise the methods of a sub-object + method project {pkg args} { + set obj [namespace current]::PROJECT.$pkg + if {[llength $args]==0} { + return $obj + } + tailcall ${obj} {*}$args + } +} + +::oo::class create ::practcl::library { + superclass ::practcl::project + + method compile-products {} { + set result {} + foreach item [my link list subordinate] { + lappend result {*}[$item compile-products] + } + set filename [my define get output_c] + if {$filename ne {}} { + set ofile [file rootname [file tail $filename]]_main.o + lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]]] + } + return $result + } + + method generate-tcl-loader {} { + set result {} + set PKGINIT [my define get pkginit] + set PKG_NAME [my define get name [my define get pkg_name]] + set PKG_VERSION [my define get pkg_vers [my define get version]] + if {[string is true [my define get SHARED_BUILD 0]]} { + set LIBFILE [my define get libfile] + ::practcl::cputs result [string map \ + [list @LIBFILE@ $LIBFILE @PKGINIT@ $PKGINIT @PKG_NAME@ $PKG_NAME @PKG_VERSION@ $PKG_VERSION] { +# Shared Library Style +load [file join [file dirname [file join [pwd] [info script]]] @LIBFILE@] @PKGINIT@ +package provide @PKG_NAME@ @PKG_VERSION@ +}] + } else { + ::practcl::cputs result [string map \ + [list @PKGINIT@ $PKGINIT @PKG_NAME@ $PKG_NAME @PKG_VERSION@ $PKG_VERSION] { +# Tclkit Style +load {} @PKGINIT@ +package provide @PKG_NAME@ @PKG_VERSION@ +}] + } + return $result + } + + method go {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set name [my define getnull name] + if {$name eq {}} { + set name generic + my define name generic + } + if {[my define get tk] eq {@TEA_TK_EXTENSION@}} { + my define set tk 0 + } + set output_c [my define getnull output_c] + if {$output_c eq {}} { + set output_c [file rootname $name].c + my define set output_c $output_c + } + set output_h [my define getnull output_h] + if {$output_h eq {}} { + set output_h [file rootname $output_c].h + my define set output_h $output_h + } + set output_tcl [my define getnull output_tcl] + #if {$output_tcl eq {}} { + # set output_tcl [file rootname $output_c].tcl + # my define set output_tcl $output_tcl + #} + #set output_mk [my define getnull output_mk] + #if {$output_mk eq {}} { + # set output_mk [file rootname $output_c].mk + # my define set output_mk $output_mk + #} + set initfunc [my define getnull initfunc] + if {$initfunc eq {}} { + set initfunc [string totitle $name]_Init + my define set initfunc $initfunc + } + set output_decls [my define getnull output_decls] + if {$output_decls eq {}} { + set output_decls [file rootname $output_c].decls + my define set output_decls $output_decls + } + my variable links + foreach {linktype objs} [array get links] { + foreach obj $objs { + $obj go + } + } + debug [list /[self] [self method] [self class] -- [my define get filename] [info object class [self]]] + } + + method implement path { + my go + my Collate_Source $path + foreach item [my link list dynamic] { + if {[catch {$item implement $path} err]} { + puts "Skipped $item: $err" + } + } + foreach item [my link list module] { + if {[catch {$item implement $path} err]} { + puts "Skipped $item: $err" + } + } + set cout [open [file join $path [my define get output_c]] w] + puts $cout [subst {/* +** This file is generated by the [info script] script +** any changes will be overwritten the next time it is run +*/}] + puts $cout [my generate-c] + puts $cout [my generate-loader] + close $cout + + set macro HAVE_[string toupper [file rootname [my define get output_h]]]_H + set hout [open [file join $path [my define get output_h]] w] + puts $hout [subst {/* +** This file is generated by the [info script] script +** any changes will be overwritten the next time it is run +*/}] + puts $hout "#ifndef ${macro}" + puts $hout "#define ${macro}" + puts $hout [my generate-h] + puts $hout "#endif" + close $hout + + set output_tcl [my define get output_tcl] + if {$output_tcl ne {}} { + set tclout [open [file join $path [my define get output_tcl]] w] + puts $tclout "### +# This file is generated by the [info script] script +# any changes will be overwritten the next time it is run +###" + puts $tclout [my generate-tcl] + puts $tclout [my generate-tcl-loader] + close $tclout + } + } + + method generate-decls {pkgname path} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set outfile [file join $path/$pkgname.decls] + + ### + # Build the decls file + ### + set fout [open $outfile w] + puts $fout [subst {### + # $outfile + # + # This file was generated by [info script] + ### + + library $pkgname + interface $pkgname + }] + + ### + # Generate list of functions + ### + set stubfuncts [my generate-stub-function] + set thisline {} + set functcount 0 + foreach {func header} $stubfuncts { + puts $fout [list declare [incr functcount] $header] + } + puts $fout [list export "int [my define get initfunc](Tcl_Inter *interp)"] + puts $fout [list export "char *[string totitle [my define get name]]_InitStubs(Tcl_Inter *interp, char *version, int exact)"] + + close $fout + + ### + # Build [package]Decls.h + ### + set hout [open [file join $path ${pkgname}Decls.h] w] + + close $hout + + set cout [open [file join $path ${pkgname}StubInit.c] w] +puts $cout [string map [list %pkgname% $pkgname %PkgName% [string totitle $pkgname]] { +#ifndef USE_TCL_STUBS +#define USE_TCL_STUBS +#endif +#undef USE_TCL_STUB_PROCS + +#include "tcl.h" +#include "%pkgname%.h" + + /* + ** Ensure that Tdom_InitStubs is built as an exported symbol. The other stub + ** functions should be built as non-exported symbols. + */ + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLEXPORT + +%PkgName%Stubs *%pkgname%StubsPtr; + + /* + **---------------------------------------------------------------------- + ** + ** %PkgName%_InitStubs -- + ** + ** Checks that the correct version of %PkgName% is loaded and that it + ** supports stubs. It then initialises the stub table pointers. + ** + ** Results: + ** The actual version of %PkgName% that satisfies the request, or + ** NULL to indicate that an error occurred. + ** + ** Side effects: + ** Sets the stub table pointers. + ** + **---------------------------------------------------------------------- + */ + +char * +%PkgName%_InitStubs (Tcl_Interp *interp, char *version, int exact) +{ + char *actualVersion; + actualVersion = Tcl_PkgRequireEx(interp, "%pkgname%", version, exact,(ClientData *) &%pkgname%StubsPtr); + if (!actualVersion) { + return NULL; + } + if (!%pkgname%StubsPtr) { + Tcl_SetResult(interp,"This implementation of %PkgName% does not support stubs",TCL_STATIC); + return NULL; + } + return actualVersion; +} +}] + close $cout + } + + # Backward compadible call + method generate-make path { + ::practcl::build::Makefile $path [self] + } + + method install-headers {} { + set result {} + return $result + } + + method linktype {} { + return library + } + + # Create a "package ifneeded" + # Args are a list of aliases for which this package will answer to + method package-ifneeded {args} { + set result {} + set name [my define get pkg_name [my define get name]] + set version [my define get pkg_vers [my define get version]] + if {$version eq {}} { + set version 0.1a + } + set output_tcl [my define get output_tcl] + if {$output_tcl ne {}} { + set script "\[list source \[file join \$dir $output_tcl\]\]" + } elseif {[string is true -strict [my define get SHARED_BUILD]]} { + set script "\[list load \[file join \$dir [my define get libfile]\] $name\]" + } else { + # Provide a null passthrough + set script [list package provide $name $version] + } + set result "package ifneeded [list $name] [list $version] $script" + foreach alias $args { + set script "package require $name $version \; package provide $alias $version" + append result \n\n [list package ifneeded $alias $version $script] + } + return $result + } + + + method shared_library {} { + set name [string tolower [my define get name [my define get pkg_name]]] + set NAME [string toupper $name] + set version [my define get version [my define get pkg_vers]] + set map {} + lappend map %LIBRARY_NAME% $name + lappend map %LIBRARY_VERSION% $version + lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} $version] + lappend map %LIBRARY_PREFIX% [my define getnull libprefix] + set outfile [string map $map [my define get PRACTCL_NAME_LIBRARY]][my define get SHLIB_SUFFIX] + return $outfile + } +} + +::oo::class create ::practcl::tclkit { + superclass ::practcl::library + + method Collate_Source CWD { + my define set SHARED_BUILD 0 + set name [my define get name] + + if {![my define exists TCL_LOCAL_APPINIT]} { + my define set TCL_LOCAL_APPINIT Tclkit_AppInit + } + if {![my define exists TCL_LOCAL_MAIN_HOOK]} { + my define set TCL_LOCAL_MAIN_HOOK Tclkit_MainHook + } + + set PROJECT [self] + set os [$PROJECT define get os] + set TCLOBJ [$PROJECT project TCLCORE] + set TKOBJ [$PROJECT project TKCORE] + set ODIEOBJ [$PROJECT project odie] + + set TCLSRCDIR [$TCLOBJ define get srcroot] + set TKSRCDIR [$TKOBJ define get srcroot] + set PKG_OBJS {} + foreach item [$PROJECT link list package] { + if {[string is true [$item define get static]]} { + lappend PKG_OBJS $item + } + } + # Arrange to build an main.c that utilizes TCL_LOCAL_APPINIT and TCL_LOCAL_MAIN_HOOK + if {$os eq "windows"} { + set PLATFORM_SRC_DIR win + my add class csource filename [file join $TCLSRCDIR win tclWinReg.c] initfunc Registry_Init pkg_name registry pkg_vers 1.3.1 autoload 1 + my add class csource filename [file join $TCLSRCDIR win tclWinDde.c] initfunc Dde_Init pkg_name dde pkg_vers 1.4.0 autoload 1 + my add class csource ofile [my define get name]_appinit.o filename [file join $TCLSRCDIR win tclAppInit.c] extra [list -DTCL_LOCAL_MAIN_HOOK=[my define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] -DTCL_LOCAL_APPINIT=[my define get TCL_LOCAL_APPINIT Tclkit_AppInit]] + } else { + set PLATFORM_SRC_DIR unix + my add class csource ofile [my define get name]_appinit.o filename [file join $TCLSRCDIR unix tclAppInit.c] extra [list -DTCL_LOCAL_MAIN_HOOK=[my define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] -DTCL_LOCAL_APPINIT=[my define get TCL_LOCAL_APPINIT Tclkit_AppInit]] + } + ### + # Add local static Zlib implementation + ### + set cdir [file join $TCLSRCDIR compat zlib] + foreach file { + adler32.c compress.c crc32.c + deflate.c infback.c inffast.c + inflate.c inftrees.c trees.c + uncompr.c zutil.c + } { + my add [file join $cdir $file] + } + + ### + # Pre 8.7, Tcl doesn't include a Zipfs implementation + # in the core. Grab the one from odielib + ### + set zipfs [file join $TCLSRCDIR generic zvfs.c] + if {![file exists $zipfs]} { + # The Odie project maintains a mirror of the version + # released with the Tcl core + my add_project odie { + tag trunk + class subproject + vfsinstall 0 + } + my project odie unpack + set ODIESRCROOT [my project odie define get srcroot] + set cdir [file join $ODIESRCROOT compat zipfs] + my define add include_dir $cdir + set zipfs [file join $cdir zvfs.c] + } + + my add class csource filename $zipfs initfunc Tclzipfs_Init pkg_name zipfs pkg_vers 1.0 autoload 1 + + my define add include_dir [file join $TKSRCDIR generic] + my define add include_dir [file join $TKSRCDIR $PLATFORM_SRC_DIR] + my define add include_dir [file join $TKSRCDIR bitmaps] + my define add include_dir [file join $TKSRCDIR xlib] + my define add include_dir [file join $TCLSRCDIR generic] + my define add include_dir [file join $TCLSRCDIR $PLATFORM_SRC_DIR] + my define add include_dir [file join $TCLSRCDIR compat zlib] + # This file will implement TCL_LOCAL_APPINIT and TCL_LOCAL_MAIN_HOOK + ::practcl::build::tclkit_main $PROJECT $PKG_OBJS + } + + ## Wrap an executable + # + method wrap {PWD exename vfspath args} { + cd $PWD + if {![file exists $vfspath]} { + file mkdir $vfspath + } + foreach item [my link list core.library] { + set name [$item define get name] + set libsrcroot [$item define get srcroot] + if {[file exists [file join $libsrcroot library]]} { + ::practcl::copyDir [file join $libsrcroot library] [file join $vfspath boot $name] + } + } + if {[my define get installdir] ne {}} { + ::practcl::copyDir [file join [my define get installdir] [string trimleft [my define get prefix] /] lib] [file join $vfspath lib] + } + foreach arg $args { + ::practcl::copyDir $arg $vfspath + } + + set fout [open [file join $vfspath packages.tcl] w] + puts $fout { + set ::PKGIDXFILE [info script] + set dir [file dirname $::PKGIDXFILE] + } + #set BASEVFS [my define get BASEVFS] + set EXEEXT [my define get EXEEXT] + + set tclkit_bare [my define get tclkit_bare] + + set buffer [::practcl::pkgindex_path $vfspath] + puts $fout $buffer + puts $fout { + # Advertise statically linked packages + foreach {pkg script} [array get ::kitpkg] { + eval $script + } + } + close $fout + package require zipfile::mkzip + ::zipfile::mkzip::mkzip ${exename}${EXEEXT} -runtime $tclkit_bare -directory $vfspath + if { [my define get platform] ne "windows" } { + file attributes ${exename}${EXEEXT} -permissions a+x + } + } +} + +### +# Meta repository +# The default is an inert source code block +### +oo::class create ::practcl::subproject { + superclass ::practcl::object + + method compile {} {} + + method go {} { + set platform [my define get platform] + my define get USEMSVC [my define get USEMSVC] + set name [my define get name] + if {![my define exists srcroot]} { + my define set srcroot [file join [my define get sandbox] $name] + } + set srcroot [my define get srcroot] + my define set localsrcdir $srcroot + my define add include_dir [file join $srcroot generic] + my sources + } + + # Install project into the local build system + method install-local {} { + my unpack + } + + # Install project into the virtual file system + method install-vfs {} {} + + method linktype {} { + return {subordinate package} + } + + method linker-products {configdict} {} + + method linker-external {configdict} { + if {[dict exists $configdict PRACTCL_LIBS]} { + return [dict get $configdict PRACTCL_LIBS] + } + } + + method sources {} {} + + method unpack {} { + set name [my define get name] + puts [list $name [self] UNPACK] + my define set [::practcl::fossil_sandbox $name [my define dump]] + } + + method update {} { + set name [my define get name] + my define set [::practcl::fossil_sandbox $name [dict merge [my define dump] {update 1}]] + } +} + +### +# A project which the kit compiles and integrates +# the source for itself +### +oo::class create ::practcl::subproject.source { + superclass ::practcl::subproject ::practcl::library + + method linktype {} { + return {subordinate package source} + } + +} + +# a copy from the teapot +oo::class create ::practcl::subproject.teapot { + superclass ::practcl::subproject + + method install-local {} { + my install-vfs + } + + method install-vfs {} { + set pkg [my define get pkg_name [my define get name]] + set download [my define get download] + my unpack + set DEST [my define get installdir] + set prefix [string trimleft [my define get prefix] /] + # Get tcllib from our destination + set dir [file join $DEST $prefix lib tcllib] + source [file join $DEST $prefix lib tcllib pkgIndex.tcl] + package require zipfile::decode + ::zipfile::decode::unzipfile [file join $download $pkg.zip] [file join $DEST $prefix lib $pkg] + } +} + +oo::class create ::practcl::subproject.sak { + superclass ::practcl::subproject + + method install-local {} { + my install-vfs + } + + method install-vfs {} { + ### + # Handle teapot installs + ### + set pkg [my define get pkg_name [my define get name]] + my unpack + set DEST [my define get installdir] + set prefix [string trimleft [my define get prefix] /] + set srcroot [my define get srcroot] + ::dotclexec [file join $srcroot installer.tcl] \ + -pkg-path [file join $DEST $prefix lib $pkg] \ + -no-examples -no-html -no-nroff \ + -no-wait -no-gui -no-apps + } +} + +### +# A binary package +### +oo::class create ::practcl::subproject.binary { + superclass ::practcl::subproject ::practcl::autoconf + + + method compile-products {} {} + + method ConfigureOpts {} { + set opts {} + set builddir [my define get builddir] + if {[my define get broken_destroot 0]} { + set PREFIX [my define get prefix_broken_destdir] + } else { + set PREFIX [my define get prefix] + } + if {[my define get HOST] != [my define get TARGET]} { + lappend opts --host=[my define get TARGET] + } + if {[my define exists tclsrcdir]} { + set TCLSRCDIR [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tclsrcdir]]]] + set TCLGENERIC [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tclsrcdir] .. generic]]] + lappend opts --with-tcl=$TCLSRCDIR --with-tclinclude=$TCLGENERIC + } + if {[my define exists tksrcdir]} { + set TKSRCDIR [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tksrcdir]]]] + set TKGENERIC [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tksrcdir] .. generic]]] + lappend opts --with-tk=$TKSRCDIR --with-tkinclude=$TKGENERIC + } + lappend opts {*}[my define get config_opts] + lappend opts --prefix=$PREFIX + #--exec_prefix=$PREFIX + #if {$::tcl_platform(platform) eq "windows"} { + # lappend opts --disable-64bit + #} + if {[my define get static 1]} { + lappend opts --disable-shared --disable-stubs + # + } else { + lappend opts --enable-shared + } + return $opts + } + + method go {} { + next + my define set builddir [my BuildDir [my define get masterpath]] + } + + method linker-products {configdict} { + if {![my define get static 0]} { + return {} + } + set srcdir [my define get builddir] + if {[dict exists $configdict libfile]} { + return " [file join $srcdir [dict get $configdict libfile]]" + } + } + + method static-packages {} { + if {![my define get static 0]} { + return {} + } + set result [my define get static_packages] + set statpkg [my define get static_pkg] + set initfunc [my define get initfunc] + if {$initfunc ne {}} { + set pkg_name [my define get pkg_name] + if {$pkg_name ne {}} { + dict set result $pkg_name initfunc $initfunc + set version [my define get version] + if {$version eq {}} { + set info [my config.sh] + set version [dict get $info version] + set pl {} + if {[dict exists $info patch_level]} { + set pl [dict get $info patch_level] + append version $pl + } + my define set version $version + } + dict set result $pkg_name version $version + dict set result $pkg_name autoload [my define get autoload 0] + } + } + foreach item [my link list subordinate] { + foreach {pkg info} [$item static-packages] { + dict set result $pkg $info + } + } + return $result + } + + method BuildDir {PWD} { + set name [my define get name] + return [my define get builddir [file join $PWD pkg.$name]] + } + + method compile {} { + set name [my define get name] + set PWD $::CWD + cd $PWD + my go + set srcroot [file normalize [my define get srcroot]] + my Collate_Source $PWD + + ### + # Build a starter VFS for both Tcl and wish + ### + set srcroot [my define get srcroot] + if {[my define get static 1]} { + puts "BUILDING Static $name $srcroot" + } else { + puts "BUILDING Dynamic $name $srcroot" + } + if {[my define get USEMSVC 0]} { + cd $srcroot + doexec nmake -f makefile.vc INSTALLDIR=[my define get installdir] release + } else { + cd $::CWD + set builddir [file normalize [my define get builddir]] + file mkdir $builddir + if {![file exists [file join $builddir Makefile]]} { + my Configure + } + if {[file exists [file join $builddir make.tcl]]} { + domake.tcl $builddir library + } else { + domake $builddir all + } + } + cd $PWD + } + + + method Configure {} { + cd $::CWD + my unpack + my TeaConfig + set builddir [file normalize [my define get builddir]] + file mkdir $builddir + set srcroot [file normalize [my define get srcroot]] + if {[my define get USEMSVC 0]} { + return + } + set opts [my ConfigureOpts] + puts [list [self] CONFIGURE] + puts [list PWD [pwd]] + puts [list LOCALSRC $srcroot] + puts [list BUILDDIR $builddir] + puts [list CONFIGURE {*}$opts] + cd $builddir + exec sh [file join $srcroot configure] {*}$opts >& [file join $builddir practcl.log] + cd $::CWD + } + + method install-vfs {} { + set PWD [pwd] + set PKGROOT [my define get installdir] + set PREFIX [my define get prefix] + + ### + # Handle teapot installs + ### + set pkg [my define get pkg_name [my define get name]] + if {[my define get teapot] ne {}} { + set TEAPOT [my define get teapot] + set found 0 + foreach ver [my define get pkg_vers [my define get version]] { + set teapath [file join $TEAPOT $pkg$ver] + if {[file exists $teapath]} { + set dest [file join $PKGROOT [string trimleft $PREFIX /] lib [file tail $teapath]] + ::practcl::copyDir $teapath $dest + return + } + } + } + my compile + if {[my define get USEMSVC 0]} { + set srcroot [my define get srcroot] + cd $srcroot + puts "[self] VFS INSTALL $PKGROOT" + doexec nmake -f makefile.vc INSTALLDIR=$PKGROOT install + } else { + set builddir [my define get builddir] + if {[file exists [file join $builddir make.tcl]]} { + # Practcl builds can inject right to where we need them + puts "[self] VFS INSTALL $PKGROOT (Practcl)" + domake.tcl $builddir install-package $PKGROOT + } elseif {[my define get broken_destroot 0] == 0} { + # Most modern TEA projects understand DESTROOT in the makefile + puts "[self] VFS INSTALL $PKGROOT (TEA)" + domake $builddir install DESTDIR=$PKGROOT + } else { + # But some require us to do an install into a fictitious filesystem + # and then extract the gooey parts within. + # (*cough*) TkImg + set PREFIX [my define get prefix] + set BROKENROOT [::practcl::msys_to_tclpath [my define get prefix_broken_destdir]] + file delete -force $BROKENROOT + file mkdir $BROKENROOT + domake $builddir $install + ::practcl::copyDir $BROKENROOT [file join $PKGROOT [string trimleft $PREFIX /]] + file delete -force $BROKENROOT + } + } + cd $PWD + } + + method TeaConfig {} { + set srcroot [file normalize [my define get srcroot]] + set copytea 0 + if {![file exists [file join $srcroot tclconfig]]} { + set copytea 1 + } else { + if {![file exists [file join $srcroot tclconfig practcl.tcl]] || ![file exists [file join $srcroot tclconfig config.tcl.in]]} { + set copytea 1 + } + } + # ensure we have tclconfig with all of the trimming + if {$copytea} { + set tclconfiginfo [::practcl::fossil_sandbox tclconfig [list sandbox [my define get sandbox]]] + ::practcl::copyDir [dict get $tclconfiginfo srcroot] [file join $srcroot tclconfig] + if {$::tcl_platform(platform) ne "windows"} { + set pwd [pwd] + cd $srcroot + # On windows there's no practical way to execute + # autoconf. We'll have to trust that configure + # us up to date + foreach template {configure.ac configure.in} { + set input [file join $srcroot $template] + if {[file exists $input]} { + puts "autoconf -f $input > [file join $srcroot configure]" + exec autoconf -f $input > [file join $srcroot configure] + } + } + cd $pwd + } + } + } +} + +oo::class create ::practcl::subproject.core { + superclass ::practcl::subproject.binary + + # On the windows platform MinGW must build + # from the platform directory in the source repo + method BuildDir {PWD} { + return [my define get localsrcdir] + } + + method Configure {} { + if {[my define get USEMSVC 0]} { + return + } + set opts [my ConfigureOpts] + puts [list PWD [pwd]] + puts [list [self] CONFIGURE] + set builddir [file normalize [my define get builddir]] + set localsrcdir [file normalize [my define get localsrcdir]] + puts [list LOCALSRC $localsrcdir] + puts [list BUILDDIR $builddir] + puts [list CONFIGURE {*}$opts] + cd $localsrcdir + exec sh [file join $localsrcdir configure] {*}$opts >& [file join $builddir practcl.log] + } + + method ConfigureOpts {} { + set opts {} + set builddir [file normalize [my define get builddir]] + set PREFIX [my define get prefix] + if {[my define get HOST] != [my define get TARGET]} { + lappend opts --host=[my define get TARGET] + } + lappend opts {*}[my define get config_opts] + lappend opts --prefix=$PREFIX + #--exec_prefix=$PREFIX + lappend opts --disable-shared + return $opts + } + + method go {} { + set name [my define get name] + set platform [my define get platform] + if {![my define exists srcroot]} { + my define set srcroot [file join [my define get sandbox] $name] + } + set srcroot [my define get srcroot] + my define add include_dir [file join $srcroot generic] + switch $platform { + windows { + my define set localsrcdir [file join $srcroot win] + my define add include_dir [file join $srcroot win] + } + default { + my define set localsrcdir [file join $srcroot unix] + my define add include_dir [file join $srcroot $name unix] + } + } + my define set builddir [my BuildDir [my define get masterpath]] + } + + method linktype {} { + return {subordinate core.library} + } +} + +package provide practcl 0.5 diff --git a/unix/Makefile.in b/unix/Makefile.in index 1afc883..ca15312 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -308,7 +308,7 @@ GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \ tclStrToD.o tclThread.o \ tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o \ tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o \ - tclTomMathInterface.o zipfs.o + tclTomMathInterface.o tclZipfs.o OO_OBJS = tclOO.o tclOOBasic.o tclOOCall.o tclOODefineCmds.o tclOOInfo.o \ tclOOMethod.o tclOOStubInit.o @@ -373,7 +373,6 @@ GENERIC_HDRS = \ $(GENERIC_DIR)/tclInt.h \ $(GENERIC_DIR)/tclIntDecls.h \ $(GENERIC_DIR)/tclIntPlatDecls.h \ - $(GENERIC_DIR)/tclZipfs.h \ $(GENERIC_DIR)/tclTomMath.h \ $(GENERIC_DIR)/tclTomMathDecls.h \ $(GENERIC_DIR)/tclOO.h \ @@ -954,7 +953,6 @@ install-headers: @for i in $(GENERIC_DIR)/tcl.h $(GENERIC_DIR)/tclDecls.h \ $(GENERIC_DIR)/tclOO.h $(GENERIC_DIR)/tclOODecls.h \ $(GENERIC_DIR)/tclPlatDecls.h \ - $(GENERIC_DIR)/tclZipfs.h \ $(GENERIC_DIR)/tclTomMath.h \ $(GENERIC_DIR)/tclTomMathDecls.h ; \ do \ @@ -1324,8 +1322,8 @@ tclVar.o: $(GENERIC_DIR)/tclVar.c tclZlib.o: $(GENERIC_DIR)/tclZlib.c $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/tclZlib.c -zipfs.o: $(GENERIC_DIR)/zipfs.c - $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/zipfs.c +tclZipfs.o: $(GENERIC_DIR)/tclZipfs.c + $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/tclZipfs.c tclTest.o: $(GENERIC_DIR)/tclTest.c $(IOHDR) $(TCLREHDRS) $(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tclTest.c diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index 2dcd192..9bbc88b 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -15,9 +15,7 @@ #undef BUILD_tcl #undef STATIC_BUILD #include "tcl.h" -#ifdef HAVE_ZLIB -#include "tclZipfs.h" -#endif + #ifdef TCL_TEST extern Tcl_PackageInitProc Tcltest_Init; extern Tcl_PackageInitProc Tcltest_SafeInit; @@ -42,7 +40,6 @@ extern Tcl_PackageInitProc Tclxttest_Init; #endif MODULE_SCOPE int TCL_LOCAL_APPINIT(Tcl_Interp *); MODULE_SCOPE int main(int, char **); -MODULE_SCOPE int Tcl_Zvfs_Boot(const char *,const char *,const char *,const char *); /* * The following #if block allows you to change how Tcl finds the startup @@ -83,12 +80,7 @@ main( #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif - #define TCLKIT_INIT "main.tcl" - #define TCLKIT_VFSMOUNT "/zvfs" - #define TCLKIT_PASSWD NULL - Tcl_FindExecutable(argv[0]); - CONST char *cp=Tcl_GetNameOfExecutable(); - Tcl_Zvfs_Boot(cp,TCLKIT_VFSMOUNT,TCLKIT_INIT,TCLKIT_PASSWD); + Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } @@ -119,11 +111,7 @@ Tcl_AppInit( if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } - /* Load the zipfs package */ - if (Tclzipfs_Init(interp) == TCL_ERROR) { - return TCL_ERROR; - } - Tcl_StaticPackage(interp, "zipfs", Tclzipfs_Init, Tclzipfs_SafeInit); + #ifdef TCL_XT_TEST if (Tclxttest_Init(interp) == TCL_ERROR) { return TCL_ERROR; diff --git a/win/Makefile.in b/win/Makefile.in index e4ca501..118ccb1 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -152,6 +152,7 @@ SHARED_LIBRARIES = $(TCL_DLL_FILE) @ZLIB_DLL_FILE@ STATIC_LIBRARIES = $(TCL_LIB_FILE) TCLSH = tclsh$(VER)${EXESUFFIX} +TCLKIT = tclkit$(VER)${EXESUFFIX} CAT32 = cat32$(EXEEXT) MAN2TCL = man2tcl$(EXEEXT) @@ -303,7 +304,7 @@ GENERIC_OBJS = \ tclUtil.$(OBJEXT) \ tclVar.$(OBJEXT) \ tclZlib.$(OBJEXT) \ - zipfs.$(OBJEXT) + tclZipfs.$(OBJEXT) TOMMATH_OBJS = \ bncore.${OBJEXT} \ @@ -399,6 +400,8 @@ STUB_OBJS = \ TCLSH_OBJS = tclAppInit.$(OBJEXT) +TCLKIT_OBJS = tclkitMain.${OBJEXT} tclkit.${OBJEXT} + ZLIB_OBJS = \ adler32.$(OBJEXT) \ compress.$(OBJEXT) \ @@ -420,7 +423,7 @@ all: binaries libraries doc packages tcltest: $(TCLSH) $(TEST_DLL_FILE) -binaries: $(TCL_STUB_LIB_FILE) @LIBRARIES@ winextensions $(TCLSH) +binaries: $(TCL_STUB_LIB_FILE) @LIBRARIES@ winextensions $(TCLSH) $(TCLKIT) winextensions: ${DDE_DLL_FILE} ${REG_DLL_FILE} @@ -433,6 +436,11 @@ $(TCLSH): $(TCLSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) @VC_MANIFEST_EMBED_EXE@ +$(TCLKIT): $(TCLKIT_OBJ) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) + $(CC) $(CFLAGS) $(TCLKIT_OBJ) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ + tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) + @VC_MANIFEST_EMBED_EXE@ + cat32.$(OBJEXT): cat.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) @@ -496,6 +504,9 @@ testMain.${OBJEXT}: tclAppInit.c tclMain2.${OBJEXT}: tclMain.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_ASCII_MAIN @DEPARG@ $(CC_OBJNAME) +tclkitMain.${OBJEXT}: tclAppInit.c + $(CC) -c $(CC_SWITCHES) -DTCL_LOCAL_MAIN_HOOK="Tclkit_MainHook" -DTCL_LOCAL_APPINIT="Tclkit_AppInit" @DEPARG@ $(CC_OBJNAME) + # TIP #59, embedding of configuration information into the binary library. # # Part of Tcl's configuration information are the paths where it was installed diff --git a/win/makefile.vc b/win/makefile.vc index ec7afac..cf7d422 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -345,7 +345,7 @@ COREOBJS = \ $(TMP_DIR)\tclUtil.obj \ $(TMP_DIR)\tclVar.obj \ $(TMP_DIR)\tclZlib.obj \ - $(TMP_DIR)\zipfs.obj + $(TMP_DIR)\tclZipfs.obj ZLIBOBJS = \ $(TMP_DIR)\adler32.obj \ diff --git a/win/tclAppInit.c b/win/tclAppInit.c index 1c3ef9b..e06eaf5 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -25,13 +25,10 @@ #include #ifdef TCL_TEST -#include "tclZipfs.h" extern Tcl_PackageInitProc Tcltest_Init; extern Tcl_PackageInitProc Tcltest_SafeInit; #endif /* TCL_TEST */ -MODULE_SCOPE int Tcl_Zvfs_Boot(const char *,const char *,const char *); - #if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES extern Tcl_PackageInitProc Registry_Init; extern Tcl_PackageInitProc Dde_Init; @@ -128,13 +125,7 @@ _tmain( #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); #endif -#ifdef TCL_ZIPVFS - #define TCLKIT_INIT "main.tcl" - #define TCLKIT_VFSMOUNT "/zvfs" - Tcl_FindExecutable(argv[0]); - CONST char *cp=Tcl_GetNameOfExecutable(); - Tcl_Zvfs_Boot(cp,TCLKIT_VFSMOUNT,TCLKIT_INIT); -#endif + Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } @@ -165,9 +156,6 @@ Tcl_AppInit( if ((Tcl_Init)(interp) == TCL_ERROR) { return TCL_ERROR; } - if(Tcl_StaticPackage(interp, "zipfs", Tclzipfs_Init, Tclzipfs_SafeInit) == TCL_ERROR ) { - return TCL_ERROR; - } #if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES if (Registry_Init(interp) == TCL_ERROR) { @@ -186,9 +174,6 @@ Tcl_AppInit( return TCL_ERROR; } Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, Tcltest_SafeInit); - if (Tclzipfs_Init(interp) == TCL_ERROR) { - return TCL_ERROR; - } #endif /* TCL_TEST */ /* -- cgit v0.12 From 58ab27bf86284012b5dba6df12a30f10ecee6491 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Wed, 14 Sep 2016 13:36:27 +0000 Subject: Fixed the line endings on practcl.tcl --- library/practcl/practcl.tcl | 7998 +++++++++++++++++++++---------------------- 1 file changed, 3999 insertions(+), 3999 deletions(-) diff --git a/library/practcl/practcl.tcl b/library/practcl/practcl.tcl index 3b4b04e..f285116 100644 --- a/library/practcl/practcl.tcl +++ b/library/practcl/practcl.tcl @@ -1,4000 +1,4000 @@ -### -# Practcl -# An object oriented templating system for stamping out Tcl API calls to C -### -puts [list LOADED practcl.tcl from [info script]] -package require TclOO -proc ::debug args { - #puts $args - ::practcl::cputs ::DEBUG_INFO $args -} - -### -# Drop in a static copy of Tcl -### -proc ::doexec args { - puts [list {*}$args] - exec {*}$args >&@ stdout -} - -proc ::dotclexec args { - puts [list [info nameofexecutable] {*}$args] - exec [info nameofexecutable] {*}$args >&@ stdout -} - -proc ::domake {path args} { - set PWD [pwd] - cd $path - puts [list *** $path ***] - puts [list make {*}$args] - exec make {*}$args >&@ stdout - cd $PWD -} - -proc ::domake.tcl {path args} { - set PWD [pwd] - cd $path - puts [list *** $path ***] - puts [list make.tcl {*}$args] - exec [info nameofexecutable] make.tcl {*}$args >&@ stdout - cd $PWD -} - -proc ::fossil {path args} { - set PWD [pwd] - cd $path - puts [list {*}$args] - exec fossil {*}$args >&@ stdout - cd $PWD -} - - -proc ::fossil_status {dir} { - if {[info exists ::fosdat($dir)]} { - return $::fosdat($dir) - } - set result { -tags experimental -version {} - } - set pwd [pwd] - cd $dir - set info [exec fossil status] - cd $pwd - foreach line [split $info \n] { - if {[lindex $line 0] eq "checkout:"} { - set hash [lindex $line end-3] - set maxdate [lrange $line end-2 end-1] - dict set result hash $hash - dict set result maxdate $maxdate - regsub -all {[^0-9]} $maxdate {} isodate - dict set result isodate $isodate - } - if {[lindex $line 0] eq "tags:"} { - set tags [lrange $line 1 end] - dict set result tags $tags - break - } - } - set ::fosdat($dir) $result - return $result -} -### -# Seek out Tcllib if it's available -### -set tcllib_path {} -foreach path {.. ../.. ../../..} { - foreach path [glob -nocomplain [file join [file normalize $path] tcllib* modules]] { - set tclib_path $path - lappend ::auto_path $path - break - } - if {$tcllib_path ne {}} break -} - - -### -# Build utility functions -### -namespace eval ::practcl {} - -proc ::practcl::os {} { - if {[info exists ::project(TEACUP_OS)] && $::project(TEACUP_OS) ni {"@TEACUP_OS@" {}}} { - return $::project(TEACUP_OS) - } - set info [::practcl::config.tcl $::project(builddir)] - if {[dict exists $info TEACUP_OS]} { - return [dict get $info TEACUP_OS] - } - return unknown -} - -### -# Detect local platform -### -proc ::practcl::config.tcl {path} { - dict set result buildpath $path - set result {} - if {[file exists [file join $path config.tcl]]} { - set fin [open [file join $path config.tcl] r] - set bufline {} - set rawcount 0 - set linecount 0 - while {[gets $fin thisline]>=0} { - incr rawcount - append bufline \n $thisline - if {![info complete $bufline]} continue - set line [string trimleft $bufline] - set bufline {} - if {[string index [string trimleft $line] 0] eq "#"} continue - incr linecount - set key [lindex $line 0] - set value [lindex $line 1] - dict set result $key $value - } - dict set result sandbox [file dirname [dict get $result srcdir]] - dict set result download [file join [dict get $result sandbox] download] - dict set result teapot [file join [dict get $result sandbox] teapot] - set result [::practcl::de_shell $result] - } - # If data is available from autoconf, defer to that - if {[dict exists $result TEACUP_OS] && [dict get $result TEACUP_OS] ni {"@TEACUP_OS@" {}}} { - return $result - } - # If autoconf hasn't run yet, assume we are not cross compiling - # and defer to local checks - dict set result TEACUP_PROFILE unknown - dict set result TEACUP_OS unknown - dict set result EXEEXT {} - if {$::tcl_platform(platform) eq "windows"} { - set system "windows" - set arch ix86 - dict set result TEACUP_PROFILE win32-ix86 - dict set result TEACUP_OS windows - dict set result EXEEXT .exe - } else { - set system [exec uname -s]-[exec uname -r] - set arch unknown - dict set result TEACUP_OS generic - } - dict set result TEA_PLATFORM $system - dict set result TEA_SYSTEM $system - switch -glob $system { - Linux* { - dict set result TEACUP_OS linux - set arch [exec uname -m] - dict set result TEACUP_PROFILE "linux-glibc2.3-$arch" - } - GNU* { - set arch [exec uname -m] - dict set result TEACUP_OS "gnu" - } - NetBSD-Debian { - set arch [exec uname -m] - dict set result TEACUP_OS "netbsd-debian" - } - OpenBSD-* { - set arch [exec arch -s] - dict set result TEACUP_OS "openbsd" - } - Darwin* { - set arch [exec uname -m] - dict set result TEACUP_OS "macosx" - if {$arch eq "x86_64"} { - dict set result TEACUP_PROFILE "macosx10.5-i386-x86_84" - } else { - dict set result TEACUP_PROFILE "macosx-universal" - } - } - OpenBSD* { - set arch [exec arch -s] - dict set result TEACUP_OS "openbsd" - } - } - if {$arch eq "unknown"} { - catch {set arch [exec uname -m]} - } - switch -glob $arch { - i*86 { - set arch "ix86" - } - amd64 { - set arch "x86_64" - } - } - dict set result TEACUP_ARCH $arch - if {[dict get $result TEACUP_PROFILE] eq "unknown"} { - dict set result TEACUP_PROFILE [dict get $result TEACUP_OS]-$arch - } - return $result -} - - -### -# Convert an MSYS path to a windows native path -### -if {$::tcl_platform(platform) eq "windows"} { -proc ::practcl::msys_to_tclpath msyspath { - return [exec sh -c "cd $msyspath ; pwd -W"] -} -} else { -proc ::practcl::msys_to_tclpath msyspath { - return [file normalize $msyspath] -} -} - -### -# Bits stolen from fileutil -### -proc ::practcl::cat fname { - set fname [open $fname r] - set data [read $fname] - close $fname - return $data -} - -proc ::practcl::file_lexnormalize {sp} { - set spx [file split $sp] - - # Resolution of embedded relative modifiers (., and ..). - - if { - ([lsearch -exact $spx . ] < 0) && - ([lsearch -exact $spx ..] < 0) - } { - # Quick path out if there are no relative modifiers - return $sp - } - - set absolute [expr {![string equal [file pathtype $sp] relative]}] - # A volumerelative path counts as absolute for our purposes. - - set sp $spx - set np {} - set noskip 1 - - while {[llength $sp]} { - set ele [lindex $sp 0] - set sp [lrange $sp 1 end] - set islast [expr {[llength $sp] == 0}] - - if {[string equal $ele ".."]} { - if { - ($absolute && ([llength $np] > 1)) || - (!$absolute && ([llength $np] >= 1)) - } { - # .. : Remove the previous element added to the - # new path, if there actually is enough to remove. - set np [lrange $np 0 end-1] - } - } elseif {[string equal $ele "."]} { - # Ignore .'s, they stay at the current location - continue - } else { - # A regular element. - lappend np $ele - } - } - if {[llength $np] > 0} { - return [eval [linsert $np 0 file join]] - # 8.5: return [file join {*}$np] - } - return {} -} - -proc ::practcl::file_relative {base dst} { - # Ensure that the link to directory 'dst' is properly done relative to - # the directory 'base'. - - if {![string equal [file pathtype $base] [file pathtype $dst]]} { - return -code error "Unable to compute relation for paths of different pathtypes: [file pathtype $base] vs. [file pathtype $dst], ($base vs. $dst)" - } - - set base [file_lexnormalize [file join [pwd] $base]] - set dst [file_lexnormalize [file join [pwd] $dst]] - - set save $dst - set base [file split $base] - set dst [file split $dst] - - while {[string equal [lindex $dst 0] [lindex $base 0]]} { - set dst [lrange $dst 1 end] - set base [lrange $base 1 end] - if {![llength $dst]} {break} - } - - set dstlen [llength $dst] - set baselen [llength $base] - - if {($dstlen == 0) && ($baselen == 0)} { - # Cases: - # (a) base == dst - - set dst . - } else { - # Cases: - # (b) base is: base/sub = sub - # dst is: base = {} - - # (c) base is: base = {} - # dst is: base/sub = sub - - while {$baselen > 0} { - set dst [linsert $dst 0 ..] - incr baselen -1 - } - # 8.5: set dst [file join {*}$dst] - set dst [eval [linsert $dst 0 file join]] - } - - return $dst -} - -### -# Unpack the source of a fossil project into a designated location -### -proc ::practcl::fossil_sandbox {pkg args} { - if {[llength $args]==1} { - set info [lindex $args 0] - } else { - set info $args - } - set result $info - if {[dict exists $info srcroot]} { - set srcroot [dict get $info srcroot] - } elseif {[dict exists $info sandbox]} { - set srcroot [file join [dict get $info sandbox] $pkg] - } else { - set srcroot [file join $::CWD .. $pkg] - } - dict set result srcroot $srcroot - puts [list fossil_sandbox $pkg $srcroot] - if {[dict exists $info download]} { - ### - # Source is actually a zip archive - ### - set download [dict get $info download] - if {[file exists [file join $download $pkg.zip]]} { - if {![info exists $srcroot]} { - package require zipfile::decode - ::zipfile::decode::unzipfile [file join $download $pkg.zip] $srcroot - } - return - } - } - variable fossil_dbs - if {![::info exists fossil_dbs]} { - # Get a list of local fossil databases - set fossil_dbs [exec fossil all list] - } - set CWD [pwd] - if {![dict exists $info tag]} { - set tag trunk - } else { - set tag [dict get $info tag] - } - dict set result tag $tag - - try { - if {[file exists [file join $srcroot .fslckout]]} { - if {[dict exists $info update] && [dict get $info update]==1} { - catch { - puts "FOSSIL UPDATE" - cd $srcroot - doexec fossil update $tag - } - } - } elseif {[file exists [file join $srcroot _FOSSIL_]]} { - if {[dict exists $info update] && [dict get $info update]==1} { - catch { - puts "FOSSIL UPDATE" - cd $srcroot - doexec fossil update $tag - } - } - } else { - puts "OPEN AND UNPACK" - set fosdb {} - foreach line [split $fossil_dbs \n] { - set line [string trim $line] - if {[file rootname [file tail $line]] eq $pkg} { - set fosdb $line - break - } - } - if {$fosdb eq {}} { - file mkdir [file join $download fossil] - set fosdb [file join $download fossil $pkg.fos] - set cloned 0 - if {[dict exists $info localmirror]} { - set localmirror [dict get $info localmirror] - catch { - doexec fossil clone $localmirror/$pkg $fosdb - set cloned 1 - } - } - if {!$cloned && [dict exists $info fossil_url]} { - set localmirror [dict get $info fossil_url] - catch { - doexec fossil clone $localmirror/$pkg $fosdb - set cloned 1 - } - } - if {!$cloned} { - doexec fossil clone http://fossil.etoyoc.com/fossil/$pkg $fosdb - } - } - file mkdir $srcroot - cd $srcroot - puts "FOSSIL OPEN [pwd]" - doexec fossil open $fosdb $tag - } - } on error {result opts} { - puts [list ERR [dict get $opts -errorinfo]] - return {*}$opts - } finally { - cd $CWD - } - return $result -} - -### -# topic: e71f3f61c348d56292011eec83e95f0aacc1c618 -# description: Converts a XXX.sh file into a series of Tcl variables -### -proc ::practcl::read_sh_subst {line info} { - regsub -all {\x28} $line \x7B line - regsub -all {\x29} $line \x7D line - - #set line [string map $key [string trim $line]] - foreach {field value} $info { - catch {set $field $value} - } - if [catch {subst $line} result] { - return {} - } - set result [string trim $result] - return [string trim $result '] -} - -### -# topic: 03567140cca33c814664c7439570f669b9ab88e6 -### -proc ::practcl::read_sh_file {filename {localdat {}}} { - set fin [open $filename r] - set result {} - if {$localdat eq {}} { - set top 1 - set local [array get ::env] - dict set local EXE {} - } else { - set top 0 - set local $localdat - } - while {[gets $fin line] >= 0} { - set line [string trim $line] - if {[string index $line 0] eq "#"} continue - if {$line eq {}} continue - catch { - if {[string range $line 0 6] eq "export "} { - set eq [string first "=" $line] - set field [string trim [string range $line 6 [expr {$eq - 1}]]] - set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local] - dict set result $field [read_sh_subst $value $local] - dict set local $field $value - } elseif {[string range $line 0 7] eq "include "} { - set subfile [read_sh_subst [string range $line 7 end] $local] - foreach {field value} [read_sh_file $subfile $local] { - dict set result $field $value - } - } else { - set eq [string first "=" $line] - if {$eq > 0} { - set field [read_sh_subst [string range $line 0 [expr {$eq - 1}]] $local] - set value [string trim [string range $line [expr {$eq+1}] end] '] - #set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local] - dict set local $field $value - dict set result $field $value - } - } - } err opts - if {[dict get $opts -code] != 0} { - #puts $opts - puts "Error reading line:\n$line\nerr: $err\n***" - return $err {*}$opts - } - } - return $result -} - -### -# A simpler form of read_sh_file tailored -# to pulling data from (tcl|tk)Config.sh -### -proc ::practcl::read_Config.sh filename { - set fin [open $filename r] - set result {} - set linecount 0 - while {[gets $fin line] >= 0} { - set line [string trim $line] - if {[string index $line 0] eq "#"} continue - if {$line eq {}} continue - catch { - set eq [string first "=" $line] - if {$eq > 0} { - set field [string range $line 0 [expr {$eq - 1}]] - set value [string trim [string range $line [expr {$eq+1}] end] '] - #set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local] - dict set result $field $value - incr $linecount - } - } err opts - if {[dict get $opts -code] != 0} { - #puts $opts - puts "Error reading line:\n$line\nerr: $err\n***" - return $err {*}$opts - } - } - return $result -} - -### -# A simpler form of read_sh_file tailored -# to pulling data from a Makefile -### -proc ::practcl::read_Makefile filename { - set fin [open $filename r] - set result {} - while {[gets $fin line] >= 0} { - set line [string trim $line] - if {[string index $line 0] eq "#"} continue - if {$line eq {}} continue - catch { - set eq [string first "=" $line] - if {$eq > 0} { - set field [string trim [string range $line 0 [expr {$eq - 1}]]] - set value [string trim [string trim [string range $line [expr {$eq+1}] end] ']] - switch $field { - PKG_LIB_FILE { - dict set result libfile $value - } - srcdir { - if {$value eq "."} { - dict set result srcdir [file dirname $filename] - } else { - dict set result srcdir $value - } - } - PACKAGE_NAME { - dict set result name $value - } - PACKAGE_VERSION { - dict set result version $value - } - LIBS { - dict set result PRACTCL_LIBS $value - } - PKG_LIB_FILE { - dict set result libfile $value - } - } - } - } err opts - if {[dict get $opts -code] != 0} { - #puts $opts - puts "Error reading line:\n$line\nerr: $err\n***" - return $err {*}$opts - } - # the Compile field is about where most TEA files start getting silly - if {$field eq "compile"} { - break - } - } - return $result -} - -## Append arguments to a buffer -# The command works like puts in that each call will also insert -# a line feed. Unlike puts, blank links in the interstitial are -# suppressed -proc ::practcl::cputs {varname args} { - upvar 1 $varname buffer - if {[llength $args]==1 && [string length [string trim [lindex $args 0]]] == 0} { - - } - if {[info exist buffer]} { - if {[string index $buffer end] ne "\n"} { - append buffer \n - } - } else { - set buffer \n - } - # Trim leading \n's - append buffer [string trimleft [lindex $args 0] \n] {*}[lrange $args 1 end] -} - - -proc ::practcl::tcl_to_c {body} { - set result {} - foreach rawline [split $body \n] { - set line [string map [list \" \\\" \\ \\\\] $rawline] - cputs result "\n \"$line\\n\" \\" - } - return [string trimright $result \\] -} - - -proc ::practcl::_tagblock {text {style tcl} {note {}}} { - if {[string length [string trim $text]]==0} { - return {} - } - set output {} - switch $style { - tcl { - ::practcl::cputs output "# BEGIN $note" - } - c { - ::practcl::cputs output "/* BEGIN $note */" - } - default { - ::practcl::cputs output "# BEGIN $note" - } - } - ::practcl::cputs output $text - switch $style { - tcl { - ::practcl::cputs output "# END $note" - } - c { - ::practcl::cputs output "/* END $note */" - } - default { - ::practcl::cputs output "# END $note" - } - } - return $output -} - -proc ::practcl::_isdirectory name { - return [file isdirectory $name] -} - -### -# Return true if the pkgindex file contains -# any statement other than "package ifneeded" -# and/or if any package ifneeded loads a DLL -### -proc ::practcl::_pkgindex_directory {path} { - set buffer {} - set pkgidxfile [file join $path pkgIndex.tcl] - if {![file exists $pkgidxfile]} { - # No pkgIndex file, read the source - foreach file [glob -nocomplain $path/*.tm] { - set file [file normalize $file] - set fname [file rootname [file tail $file]] - ### - # We used to be able to ... Assume the package is correct in the filename - # No hunt for a "package provides" - ### - set package [lindex [split $fname -] 0] - set version [lindex [split $fname -] 1] - ### - # Read the file, and override assumptions as needed - ### - set fin [open $file r] - set dat [read $fin] - close $fin - # Look for a teapot style Package statement - foreach line [split $dat \n] { - set line [string trim $line] - if { [string range $line 0 9] != "# Package " } continue - set package [lindex $line 2] - set version [lindex $line 3] - break - } - # Look for a package provide statement - foreach line [split $dat \n] { - set line [string trim $line] - if { [string range $line 0 14] != "package provide" } continue - set package [lindex $line 2] - set version [lindex $line 3] - break - } - append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n - } - foreach file [glob -nocomplain $path/*.tcl] { - if { [file tail $file] == "version_info.tcl" } continue - set fin [open $file r] - set dat [read $fin] - close $fin - if {![regexp "package provide" $dat]} continue - set fname [file rootname [file tail $file]] - # Look for a package provide statement - foreach line [split $dat \n] { - set line [string trim $line] - if { [string range $line 0 14] != "package provide" } continue - set package [lindex $line 2] - set version [lindex $line 3] - if {[string index $package 0] in "\$ \["} continue - if {[string index $version 0] in "\$ \["} continue - append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n - break - } - } - return $buffer - } - set fin [open $pkgidxfile r] - set dat [read $fin] - close $fin - set thisline {} - foreach line [split $dat \n] { - append thisline $line \n - if {![info complete $thisline]} continue - set line [string trim $line] - if {[string length $line]==0} { - set thisline {} ; continue - } - if {[string index $line 0] eq "#"} { - set thisline {} ; continue - } - try { - # Ignore contditionals - if {[regexp "if.*catch.*package.*Tcl.*return" $thisline]} continue - if {[regexp "if.*package.*vsatisfies.*package.*provide.*return" $thisline]} continue - if {![regexp "package.*ifneeded" $thisline]} { - # This package index contains arbitrary code - # source instead of trying to add it to the master - # package index - return {source [file join $dir pkgIndex.tcl]} - } - append buffer $thisline \n - } on error {err opts} { - puts *** - puts "GOOF: $pkgidxfile" - puts $line - puts $err - puts [dict get $opts -errorinfo] - puts *** - } finally { - set thisline {} - } - } - return $buffer -} - - -proc ::practcl::_pkgindex_path_subdir {path} { - set result {} - foreach subpath [glob -nocomplain [file join $path *]] { - if {[file isdirectory $subpath]} { - lappend result $subpath {*}[_pkgindex_path_subdir $subpath] - } - } - return $result -} -### -# Index all paths given as though they will end up in the same -# virtual file system -### -proc ::practcl::pkgindex_path args { - set stack {} - set buffer { -lappend ::PATHSTACK $dir - } - foreach base $args { - set base [file normalize $base] - set paths [::practcl::_pkgindex_path_subdir $base] - set i [string length $base] - # Build a list of all of the paths - foreach path $paths { - if {$path eq $base} continue - set path_indexed($path) 0 - } - set path_indexed($base) 1 - set path_indexed([file join $base boot tcl]) 1 - #set path_index([file join $base boot tk]) 1 - - foreach path $paths { - if {$path_indexed($path)} continue - set thisdir [file_relative $base $path] - #set thisdir [string range $path $i+1 end] - set idxbuf [::practcl::_pkgindex_directory $path] - if {[string length $idxbuf]} { - incr path_indexed($path) - append buffer "set dir \[set PKGDIR \[file join \[lindex \$::PATHSTACK end\] $thisdir\]\]" \n - append buffer [string map {$dir $PKGDIR} [string trimright $idxbuf]] \n - } - } - } - append buffer { -set dir [lindex $::PATHSTACK end] -set ::PATHSTACK [lrange $::PATHSTACK 0 end-1] -} - return $buffer -} - -### -# topic: 64319f4600fb63c82b2258d908f9d066 -# description: Script to build the VFS file system -### -proc ::practcl::installDir {d1 d2} { - - puts [format {%*sCreating %s} [expr {4 * [info level]}] {} [file tail $d2]] - file delete -force -- $d2 - file mkdir $d2 - - foreach ftail [glob -directory $d1 -nocomplain -tails *] { - set f [file join $d1 $ftail] - if {[file isdirectory $f] && [string compare CVS $ftail]} { - installDir $f [file join $d2 $ftail] - } elseif {[file isfile $f]} { - file copy -force $f [file join $d2 $ftail] - if {$::tcl_platform(platform) eq {unix}} { - file attributes [file join $d2 $ftail] -permissions 0644 - } else { - file attributes [file join $d2 $ftail] -readonly 1 - } - } - } - - if {$::tcl_platform(platform) eq {unix}} { - file attributes $d2 -permissions 0755 - } else { - file attributes $d2 -readonly 1 - } -} - -proc ::practcl::copyDir {d1 d2} { - #puts [list $d1 -> $d2] - #file delete -force -- $d2 - file mkdir $d2 - - foreach ftail [glob -directory $d1 -nocomplain -tails *] { - set f [file join $d1 $ftail] - if {[file isdirectory $f] && [string compare CVS $ftail]} { - copyDir $f [file join $d2 $ftail] - } elseif {[file isfile $f]} { - file copy -force $f [file join $d2 $ftail] - } - } -} - -::oo::class create ::practcl::metaclass { - superclass ::oo::object - - method script script { - eval $script - } - - method source filename { - source $filename - } - - method initialize {} {} - - method define {submethod args} { - my variable define - switch $submethod { - dump { - return [array get define] - } - add { - set field [lindex $args 0] - if {![info exists define($field)]} { - set define($field) {} - } - foreach arg [lrange $args 1 end] { - if {$arg ni $define($field)} { - lappend define($field) $arg - } - } - return $define($field) - } - remove { - set field [lindex $args 0] - if {![info exists define($field)]} { - return - } - set rlist [lrange $args 1 end] - set olist $define($field) - set nlist {} - foreach arg $olist { - if {$arg in $rlist} continue - lappend nlist $arg - } - set define($field) $nlist - return $nlist - } - exists { - set field [lindex $args 0] - return [info exists define($field)] - } - getnull - - get - - cget { - set field [lindex $args 0] - if {[info exists define($field)]} { - return $define($field) - } - return [lindex $args 1] - } - set { - if {[llength $args]==1} { - set arglist [lindex $args 0] - } else { - set arglist $args - } - array set define $arglist - if {[dict exists $arglist class]} { - my select - } - } - default { - array $submethod define {*}$args - } - } - } - - method graft args { - my variable organs - if {[llength $args] == 1} { - error "Need two arguments" - } - set object {} - foreach {stub object} $args { - dict set organs $stub $object - oo::objdefine [self] forward <${stub}> $object - oo::objdefine [self] export <${stub}> - } - return $object - } - - method organ {{stub all}} { - my variable organs - if {![info exists organs]} { - return {} - } - if { $stub eq "all" } { - return $organs - } - if {[dict exists $organs $stub]} { - return [dict get $organs $stub] - } - } - - method link {command args} { - my variable links - switch $command { - object { - foreach obj $args { - foreach linktype [$obj linktype] { - my link add $linktype $obj - } - } - } - add { - ### - # Add a link to an object that was externally created - ### - if {[llength $args] ne 2} { error "Usage: link add LINKTYPE OBJECT"} - lassign $args linktype object - if {[info exists links($linktype)] && $object in $links($linktype)} { - return - } - lappend links($linktype) $object - } - remove { - set object [lindex $args 0] - if {[llength $args]==1} { - set ltype * - } else { - set ltype [lindex $args 1] - } - foreach {linktype elements} [array get links $ltype] { - if {$object in $elements} { - set nlist {} - foreach e $elements { - if { $object ne $e } { lappend nlist $e } - } - set links($linktype) $nlist - } - } - } - list { - if {[llength $args]==0} { - return [array get links] - } - if {[llength $args] != 1} { error "Usage: link list LINKTYPE"} - set linktype [lindex $args 0] - if {![info exists links($linktype)]} { - return {} - } - return $links($linktype) - } - dump { - return [array get links] - } - } - } - - method select {} { - my variable define - set class {} - if {[info exists define(class)]} { - if {[info command $define(class)] ne {}} { - set class $define(class) - } elseif {[info command ::practcl::$define(class)] ne {}} { - set class ::practcl::$define(class) - } else { - switch $define(class) { - default { - set class ::practcl::object - } - } - } - } - if {$class ne {}} { - ::oo::objdefine [self] class $class - } - if {[::info exists define(oodefine)]} { - ::oo::objdefine [self] $define(oodefine) - unset define(oodefine) - } - } -} - -proc ::practcl::trigger {args} { - foreach name $args { - if {[dict exists $::make_objects $name]} { - [dict get $::make_objects $name] triggers - } - } -} - -proc ::practcl::depends {args} { - foreach name $args { - if {[dict exists $::make_objects $name]} { - [dict get $::make_objects $name] check - } - } -} - -proc ::practcl::target {name info} { - set obj [::practcl::target_obj new $name $info] - dict set ::make_objects $name $obj - if {[dict exists $info aliases]} { - foreach item [dict get $info aliases] { - if {![dict exists $::make_objects $item]} { - dict set ::make_objects $item $obj - } - } - } - set ::make($name) 0 - set ::trigger($name) 0 - set filename [$obj define get filename] - if {$filename ne {}} { - set ::target($name) $filename - } -} - -### Batch Tasks - -namespace eval ::practcl::build {} - -## method DEFS -# This method populates 4 variables: -# name - The name of the package -# version - The version of the package -# defs - C flags passed to the compiler -# includedir - A list of paths to feed to the compiler for finding headers -# -proc ::practcl::build::DEFS {PROJECT DEFS namevar versionvar defsvar} { - upvar 1 $namevar name $versionvar version NAME NAME $defsvar defs - set name [string tolower [${PROJECT} define get name [${PROJECT} define get pkg_name]]] - set NAME [string toupper $name] - set version [${PROJECT} define get version [${PROJECT} define get pkg_vers]] - if {$version eq {}} { - set version 0.1a - } - set defs {} - append defs " -DPACKAGE_NAME=\"${name}\" -DPACKAGE_VERSION=\"${version}\"" - append defs " -DPACKAGE_TARNAME=\"${name}\" -DPACKAGE_STRING=\"${name}\x5c\x20${version}\"" - set NAME [string toupper $name] - set idx 0 - set count 0 - while {$idx>=0} { - set ndx [string first " -D" $DEFS $idx+1] - set item [string range $DEFS $idx $ndx] - set item [string trim $item] - set item [string trimleft $item -D] - if {[string range $item 0 7] eq "PACKAGE_"} { - set idx $ndx - continue - } - set eqidx [string first = $item ] - if {$eqidx < 0} { - append defs { } $item - set idx $ndx - continue - } - - set field [string range $item 0 [expr {$eqidx-1}]] - set value [string range $item [expr {$eqidx+1}] end] - set emap {} - lappend emap \x5c \x5c\x5c \x20 \x5c\x20 \x22 \x5c\x22 \x28 \x5c\x28 \x29 \x5c\x29 - if {[string is integer -strict $value]} { - append defs " -D${field}=$value" - } else { - append defs " -D${field}=[string map $emap $value]" - } - set idx $ndx - } - return $defs -} - -proc ::practcl::build::tclkit_main {PROJECT PKG_OBJS} { - ### - # Build static package list - ### - set statpkglist {} - dict set statpkglist Tk {autoload 0} - puts [list TCLKIT MAIN $PROJECT] - - foreach {ofile info} [${PROJECT} compile-products] { - puts [list * PROD $ofile $info] - if {![dict exists $info object]} continue - set cobj [dict get $info object] - foreach {pkg info} [$cobj static-packages] { - dict set statpkglist $pkg $info - } - } - foreach cobj [list {*}${PKG_OBJS} $PROJECT] { - puts [list * PROG $cobj] - foreach {pkg info} [$cobj static-packages] { - puts [list * PKG $pkg $info] - dict set statpkglist $pkg $info - } - } - - set result {} - $PROJECT include {} - $PROJECT include {"tclInt.h"} - $PROJECT include {"tclFileSystem.h"} - $PROJECT include {} - $PROJECT include {} - $PROJECT include {} - $PROJECT include {} - $PROJECT include {} - - $PROJECT code header { -#ifndef MODULE_SCOPE -# define MODULE_SCOPE extern -#endif - -/* -** Provide a dummy Tcl_InitStubs if we are using this as a static -** library. -*/ -#ifndef USE_TCL_STUBS -# undef Tcl_InitStubs -# define Tcl_InitStubs(a,b,c) TCL_VERSION -#endif -#define STATIC_BUILD 1 -#undef USE_TCL_STUBS - -/* Make sure the stubbed variants of those are never used. */ -#undef Tcl_ObjSetVar2 -#undef Tcl_NewStringObj -#undef Tk_Init -#undef Tk_MainEx -#undef Tk_SafeInit -} - - # Build an area of the file for #define directives and - # function declarations - set define {} - set mainhook [$PROJECT define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] - set mainfunc [$PROJECT define get TCL_LOCAL_APPINIT Tclkit_AppInit] - set mainscript [$PROJECT define get main.tcl main.tcl] - set vfsroot [$PROJECT define get vfsroot zipfs:/app] - set vfs_main "${vfsroot}/${mainscript}" - set vfs_tcl_library "${vfsroot}/boot/tcl" - set vfs_tk_library "${vfsroot}/boot/tk" - - set map {} - foreach var { - vfsroot mainhook mainfunc vfs_main vfs_tcl_library vfs_tk_library - } { - dict set map %${var}% [set $var] - } - set preinitscript { -set ::odie(boot_vfs) {%vfsroot%} -set ::SRCDIR {%vfsroot%} -if {[file exists {%vfs_tcl_library%}]} { - set ::tcl_library {%vfs_tcl_library%} - set ::auto_path {} -} -if {[file exists {%vfs_tk_library%}]} { - set ::tk_library {%vfs_tk_library%} -} -} ; # Preinitscript - - set zvfsboot { -/* - * %mainhook% -- - * Performs the argument munging for the shell - */ - } - ::practcl::cputs zvfsboot { - CONST char *archive; - Tcl_FindExecutable(*argv[0]); - archive=Tcl_GetNameOfExecutable(); - - Tclzipfs_Init(NULL); - } - # We have to initialize the virtual filesystem before calling - # Tcl_Init(). Otherwise, Tcl_Init() will not be able to find - # its startup script files. - $PROJECT include {"tclZipfs.h"} - - ::practcl::cputs zvfsboot " if(!TclZipfsMount(NULL, archive, \"%vfsroot%\", NULL)) \x7B " - ::practcl::cputs zvfsboot { - Tcl_Obj *vfsinitscript; - vfsinitscript=Tcl_NewStringObj("%vfs_main%",-1); - Tcl_IncrRefCount(vfsinitscript); - if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { - /* Startup script should be set before calling Tcl_AppInit */ - Tcl_SetStartupScript(vfsinitscript,NULL); - } - } - ::practcl::cputs zvfsboot " TclSetPreInitScript([::practcl::tcl_to_c $preinitscript])\;" - ::practcl::cputs zvfsboot " \x7D else \x7B" - ::practcl::cputs zvfsboot " TclSetPreInitScript([::practcl::tcl_to_c { -foreach path { - ../tcl -} { - set p [file join $path library init.tcl] - if {[file exists [file join $path library init.tcl]]} { - set ::tcl_library [file normalize [file join $path library]] - break - } -} -foreach path { - ../tk -} { - if {[file exists [file join $path library tk.tcl]]} { - set ::tk_library [file normalize [file join $path library]] - break - } -} -}])\;" - - ::practcl::cputs zvfsboot " \x7D" - - ::practcl::cputs zvfsboot " return TCL_OK;" - - if {[$PROJECT define get os] eq "windows"} { - set header {int %mainhook%(int *argc, TCHAR ***argv)} - } else { - set header {int %mainhook%(int *argc, char ***argv)} - } - $PROJECT c_function [string map $map $header] [string map $map $zvfsboot] - - practcl::cputs appinit "int %mainfunc%(Tcl_Interp *interp) \x7B" - - # Build AppInit() - set appinit {} - practcl::cputs appinit { - if ((Tcl_Init)(interp) == TCL_ERROR) { - return TCL_ERROR; - } -} - set main_init_script {} - - foreach {statpkg info} $statpkglist { - set initfunc {} - if {[dict exists $info initfunc]} { - set initfunc [dict get $info initfunc] - } - if {$initfunc eq {}} { - set initfunc [string totitle ${statpkg}]_Init - } - # We employ a NULL to prevent the package system from thinking the - # package is actually loaded into the interpreter - $PROJECT code header "extern Tcl_PackageInitProc $initfunc\;\n" - set script [list package ifneeded $statpkg [dict get $info version] [list ::load {} $statpkg]] - append main_init_script \n [list set ::kitpkg(${statpkg}) $script] +### +# Practcl +# An object oriented templating system for stamping out Tcl API calls to C +### +puts [list LOADED practcl.tcl from [info script]] +package require TclOO +proc ::debug args { + #puts $args + ::practcl::cputs ::DEBUG_INFO $args +} + +### +# Drop in a static copy of Tcl +### +proc ::doexec args { + puts [list {*}$args] + exec {*}$args >&@ stdout +} + +proc ::dotclexec args { + puts [list [info nameofexecutable] {*}$args] + exec [info nameofexecutable] {*}$args >&@ stdout +} + +proc ::domake {path args} { + set PWD [pwd] + cd $path + puts [list *** $path ***] + puts [list make {*}$args] + exec make {*}$args >&@ stdout + cd $PWD +} + +proc ::domake.tcl {path args} { + set PWD [pwd] + cd $path + puts [list *** $path ***] + puts [list make.tcl {*}$args] + exec [info nameofexecutable] make.tcl {*}$args >&@ stdout + cd $PWD +} + +proc ::fossil {path args} { + set PWD [pwd] + cd $path + puts [list {*}$args] + exec fossil {*}$args >&@ stdout + cd $PWD +} + + +proc ::fossil_status {dir} { + if {[info exists ::fosdat($dir)]} { + return $::fosdat($dir) + } + set result { +tags experimental +version {} + } + set pwd [pwd] + cd $dir + set info [exec fossil status] + cd $pwd + foreach line [split $info \n] { + if {[lindex $line 0] eq "checkout:"} { + set hash [lindex $line end-3] + set maxdate [lrange $line end-2 end-1] + dict set result hash $hash + dict set result maxdate $maxdate + regsub -all {[^0-9]} $maxdate {} isodate + dict set result isodate $isodate + } + if {[lindex $line 0] eq "tags:"} { + set tags [lrange $line 1 end] + dict set result tags $tags + break + } + } + set ::fosdat($dir) $result + return $result +} +### +# Seek out Tcllib if it's available +### +set tcllib_path {} +foreach path {.. ../.. ../../..} { + foreach path [glob -nocomplain [file join [file normalize $path] tcllib* modules]] { + set tclib_path $path + lappend ::auto_path $path + break + } + if {$tcllib_path ne {}} break +} + + +### +# Build utility functions +### +namespace eval ::practcl {} + +proc ::practcl::os {} { + if {[info exists ::project(TEACUP_OS)] && $::project(TEACUP_OS) ni {"@TEACUP_OS@" {}}} { + return $::project(TEACUP_OS) + } + set info [::practcl::config.tcl $::project(builddir)] + if {[dict exists $info TEACUP_OS]} { + return [dict get $info TEACUP_OS] + } + return unknown +} + +### +# Detect local platform +### +proc ::practcl::config.tcl {path} { + dict set result buildpath $path + set result {} + if {[file exists [file join $path config.tcl]]} { + set fin [open [file join $path config.tcl] r] + set bufline {} + set rawcount 0 + set linecount 0 + while {[gets $fin thisline]>=0} { + incr rawcount + append bufline \n $thisline + if {![info complete $bufline]} continue + set line [string trimleft $bufline] + set bufline {} + if {[string index [string trimleft $line] 0] eq "#"} continue + incr linecount + set key [lindex $line 0] + set value [lindex $line 1] + dict set result $key $value + } + dict set result sandbox [file dirname [dict get $result srcdir]] + dict set result download [file join [dict get $result sandbox] download] + dict set result teapot [file join [dict get $result sandbox] teapot] + set result [::practcl::de_shell $result] + } + # If data is available from autoconf, defer to that + if {[dict exists $result TEACUP_OS] && [dict get $result TEACUP_OS] ni {"@TEACUP_OS@" {}}} { + return $result + } + # If autoconf hasn't run yet, assume we are not cross compiling + # and defer to local checks + dict set result TEACUP_PROFILE unknown + dict set result TEACUP_OS unknown + dict set result EXEEXT {} + if {$::tcl_platform(platform) eq "windows"} { + set system "windows" + set arch ix86 + dict set result TEACUP_PROFILE win32-ix86 + dict set result TEACUP_OS windows + dict set result EXEEXT .exe + } else { + set system [exec uname -s]-[exec uname -r] + set arch unknown + dict set result TEACUP_OS generic + } + dict set result TEA_PLATFORM $system + dict set result TEA_SYSTEM $system + switch -glob $system { + Linux* { + dict set result TEACUP_OS linux + set arch [exec uname -m] + dict set result TEACUP_PROFILE "linux-glibc2.3-$arch" + } + GNU* { + set arch [exec uname -m] + dict set result TEACUP_OS "gnu" + } + NetBSD-Debian { + set arch [exec uname -m] + dict set result TEACUP_OS "netbsd-debian" + } + OpenBSD-* { + set arch [exec arch -s] + dict set result TEACUP_OS "openbsd" + } + Darwin* { + set arch [exec uname -m] + dict set result TEACUP_OS "macosx" + if {$arch eq "x86_64"} { + dict set result TEACUP_PROFILE "macosx10.5-i386-x86_84" + } else { + dict set result TEACUP_PROFILE "macosx-universal" + } + } + OpenBSD* { + set arch [exec arch -s] + dict set result TEACUP_OS "openbsd" + } + } + if {$arch eq "unknown"} { + catch {set arch [exec uname -m]} + } + switch -glob $arch { + i*86 { + set arch "ix86" + } + amd64 { + set arch "x86_64" + } + } + dict set result TEACUP_ARCH $arch + if {[dict get $result TEACUP_PROFILE] eq "unknown"} { + dict set result TEACUP_PROFILE [dict get $result TEACUP_OS]-$arch + } + return $result +} + + +### +# Convert an MSYS path to a windows native path +### +if {$::tcl_platform(platform) eq "windows"} { +proc ::practcl::msys_to_tclpath msyspath { + return [exec sh -c "cd $msyspath ; pwd -W"] +} +} else { +proc ::practcl::msys_to_tclpath msyspath { + return [file normalize $msyspath] +} +} + +### +# Bits stolen from fileutil +### +proc ::practcl::cat fname { + set fname [open $fname r] + set data [read $fname] + close $fname + return $data +} + +proc ::practcl::file_lexnormalize {sp} { + set spx [file split $sp] + + # Resolution of embedded relative modifiers (., and ..). + + if { + ([lsearch -exact $spx . ] < 0) && + ([lsearch -exact $spx ..] < 0) + } { + # Quick path out if there are no relative modifiers + return $sp + } + + set absolute [expr {![string equal [file pathtype $sp] relative]}] + # A volumerelative path counts as absolute for our purposes. + + set sp $spx + set np {} + set noskip 1 + + while {[llength $sp]} { + set ele [lindex $sp 0] + set sp [lrange $sp 1 end] + set islast [expr {[llength $sp] == 0}] + + if {[string equal $ele ".."]} { + if { + ($absolute && ([llength $np] > 1)) || + (!$absolute && ([llength $np] >= 1)) + } { + # .. : Remove the previous element added to the + # new path, if there actually is enough to remove. + set np [lrange $np 0 end-1] + } + } elseif {[string equal $ele "."]} { + # Ignore .'s, they stay at the current location + continue + } else { + # A regular element. + lappend np $ele + } + } + if {[llength $np] > 0} { + return [eval [linsert $np 0 file join]] + # 8.5: return [file join {*}$np] + } + return {} +} + +proc ::practcl::file_relative {base dst} { + # Ensure that the link to directory 'dst' is properly done relative to + # the directory 'base'. + + if {![string equal [file pathtype $base] [file pathtype $dst]]} { + return -code error "Unable to compute relation for paths of different pathtypes: [file pathtype $base] vs. [file pathtype $dst], ($base vs. $dst)" + } + + set base [file_lexnormalize [file join [pwd] $base]] + set dst [file_lexnormalize [file join [pwd] $dst]] + + set save $dst + set base [file split $base] + set dst [file split $dst] + + while {[string equal [lindex $dst 0] [lindex $base 0]]} { + set dst [lrange $dst 1 end] + set base [lrange $base 1 end] + if {![llength $dst]} {break} + } + + set dstlen [llength $dst] + set baselen [llength $base] + + if {($dstlen == 0) && ($baselen == 0)} { + # Cases: + # (a) base == dst + + set dst . + } else { + # Cases: + # (b) base is: base/sub = sub + # dst is: base = {} + + # (c) base is: base = {} + # dst is: base/sub = sub + + while {$baselen > 0} { + set dst [linsert $dst 0 ..] + incr baselen -1 + } + # 8.5: set dst [file join {*}$dst] + set dst [eval [linsert $dst 0 file join]] + } + + return $dst +} + +### +# Unpack the source of a fossil project into a designated location +### +proc ::practcl::fossil_sandbox {pkg args} { + if {[llength $args]==1} { + set info [lindex $args 0] + } else { + set info $args + } + set result $info + if {[dict exists $info srcroot]} { + set srcroot [dict get $info srcroot] + } elseif {[dict exists $info sandbox]} { + set srcroot [file join [dict get $info sandbox] $pkg] + } else { + set srcroot [file join $::CWD .. $pkg] + } + dict set result srcroot $srcroot + puts [list fossil_sandbox $pkg $srcroot] + if {[dict exists $info download]} { + ### + # Source is actually a zip archive + ### + set download [dict get $info download] + if {[file exists [file join $download $pkg.zip]]} { + if {![info exists $srcroot]} { + package require zipfile::decode + ::zipfile::decode::unzipfile [file join $download $pkg.zip] $srcroot + } + return + } + } + variable fossil_dbs + if {![::info exists fossil_dbs]} { + # Get a list of local fossil databases + set fossil_dbs [exec fossil all list] + } + set CWD [pwd] + if {![dict exists $info tag]} { + set tag trunk + } else { + set tag [dict get $info tag] + } + dict set result tag $tag + + try { + if {[file exists [file join $srcroot .fslckout]]} { + if {[dict exists $info update] && [dict get $info update]==1} { + catch { + puts "FOSSIL UPDATE" + cd $srcroot + doexec fossil update $tag + } + } + } elseif {[file exists [file join $srcroot _FOSSIL_]]} { + if {[dict exists $info update] && [dict get $info update]==1} { + catch { + puts "FOSSIL UPDATE" + cd $srcroot + doexec fossil update $tag + } + } + } else { + puts "OPEN AND UNPACK" + set fosdb {} + foreach line [split $fossil_dbs \n] { + set line [string trim $line] + if {[file rootname [file tail $line]] eq $pkg} { + set fosdb $line + break + } + } + if {$fosdb eq {}} { + file mkdir [file join $download fossil] + set fosdb [file join $download fossil $pkg.fos] + set cloned 0 + if {[dict exists $info localmirror]} { + set localmirror [dict get $info localmirror] + catch { + doexec fossil clone $localmirror/$pkg $fosdb + set cloned 1 + } + } + if {!$cloned && [dict exists $info fossil_url]} { + set localmirror [dict get $info fossil_url] + catch { + doexec fossil clone $localmirror/$pkg $fosdb + set cloned 1 + } + } + if {!$cloned} { + doexec fossil clone http://fossil.etoyoc.com/fossil/$pkg $fosdb + } + } + file mkdir $srcroot + cd $srcroot + puts "FOSSIL OPEN [pwd]" + doexec fossil open $fosdb $tag + } + } on error {result opts} { + puts [list ERR [dict get $opts -errorinfo]] + return {*}$opts + } finally { + cd $CWD + } + return $result +} + +### +# topic: e71f3f61c348d56292011eec83e95f0aacc1c618 +# description: Converts a XXX.sh file into a series of Tcl variables +### +proc ::practcl::read_sh_subst {line info} { + regsub -all {\x28} $line \x7B line + regsub -all {\x29} $line \x7D line + + #set line [string map $key [string trim $line]] + foreach {field value} $info { + catch {set $field $value} + } + if [catch {subst $line} result] { + return {} + } + set result [string trim $result] + return [string trim $result '] +} + +### +# topic: 03567140cca33c814664c7439570f669b9ab88e6 +### +proc ::practcl::read_sh_file {filename {localdat {}}} { + set fin [open $filename r] + set result {} + if {$localdat eq {}} { + set top 1 + set local [array get ::env] + dict set local EXE {} + } else { + set top 0 + set local $localdat + } + while {[gets $fin line] >= 0} { + set line [string trim $line] + if {[string index $line 0] eq "#"} continue + if {$line eq {}} continue + catch { + if {[string range $line 0 6] eq "export "} { + set eq [string first "=" $line] + set field [string trim [string range $line 6 [expr {$eq - 1}]]] + set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local] + dict set result $field [read_sh_subst $value $local] + dict set local $field $value + } elseif {[string range $line 0 7] eq "include "} { + set subfile [read_sh_subst [string range $line 7 end] $local] + foreach {field value} [read_sh_file $subfile $local] { + dict set result $field $value + } + } else { + set eq [string first "=" $line] + if {$eq > 0} { + set field [read_sh_subst [string range $line 0 [expr {$eq - 1}]] $local] + set value [string trim [string range $line [expr {$eq+1}] end] '] + #set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local] + dict set local $field $value + dict set result $field $value + } + } + } err opts + if {[dict get $opts -code] != 0} { + #puts $opts + puts "Error reading line:\n$line\nerr: $err\n***" + return $err {*}$opts + } + } + return $result +} + +### +# A simpler form of read_sh_file tailored +# to pulling data from (tcl|tk)Config.sh +### +proc ::practcl::read_Config.sh filename { + set fin [open $filename r] + set result {} + set linecount 0 + while {[gets $fin line] >= 0} { + set line [string trim $line] + if {[string index $line 0] eq "#"} continue + if {$line eq {}} continue + catch { + set eq [string first "=" $line] + if {$eq > 0} { + set field [string range $line 0 [expr {$eq - 1}]] + set value [string trim [string range $line [expr {$eq+1}] end] '] + #set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local] + dict set result $field $value + incr $linecount + } + } err opts + if {[dict get $opts -code] != 0} { + #puts $opts + puts "Error reading line:\n$line\nerr: $err\n***" + return $err {*}$opts + } + } + return $result +} + +### +# A simpler form of read_sh_file tailored +# to pulling data from a Makefile +### +proc ::practcl::read_Makefile filename { + set fin [open $filename r] + set result {} + while {[gets $fin line] >= 0} { + set line [string trim $line] + if {[string index $line 0] eq "#"} continue + if {$line eq {}} continue + catch { + set eq [string first "=" $line] + if {$eq > 0} { + set field [string trim [string range $line 0 [expr {$eq - 1}]]] + set value [string trim [string trim [string range $line [expr {$eq+1}] end] ']] + switch $field { + PKG_LIB_FILE { + dict set result libfile $value + } + srcdir { + if {$value eq "."} { + dict set result srcdir [file dirname $filename] + } else { + dict set result srcdir $value + } + } + PACKAGE_NAME { + dict set result name $value + } + PACKAGE_VERSION { + dict set result version $value + } + LIBS { + dict set result PRACTCL_LIBS $value + } + PKG_LIB_FILE { + dict set result libfile $value + } + } + } + } err opts + if {[dict get $opts -code] != 0} { + #puts $opts + puts "Error reading line:\n$line\nerr: $err\n***" + return $err {*}$opts + } + # the Compile field is about where most TEA files start getting silly + if {$field eq "compile"} { + break + } + } + return $result +} + +## Append arguments to a buffer +# The command works like puts in that each call will also insert +# a line feed. Unlike puts, blank links in the interstitial are +# suppressed +proc ::practcl::cputs {varname args} { + upvar 1 $varname buffer + if {[llength $args]==1 && [string length [string trim [lindex $args 0]]] == 0} { + + } + if {[info exist buffer]} { + if {[string index $buffer end] ne "\n"} { + append buffer \n + } + } else { + set buffer \n + } + # Trim leading \n's + append buffer [string trimleft [lindex $args 0] \n] {*}[lrange $args 1 end] +} + + +proc ::practcl::tcl_to_c {body} { + set result {} + foreach rawline [split $body \n] { + set line [string map [list \" \\\" \\ \\\\] $rawline] + cputs result "\n \"$line\\n\" \\" + } + return [string trimright $result \\] +} + + +proc ::practcl::_tagblock {text {style tcl} {note {}}} { + if {[string length [string trim $text]]==0} { + return {} + } + set output {} + switch $style { + tcl { + ::practcl::cputs output "# BEGIN $note" + } + c { + ::practcl::cputs output "/* BEGIN $note */" + } + default { + ::practcl::cputs output "# BEGIN $note" + } + } + ::practcl::cputs output $text + switch $style { + tcl { + ::practcl::cputs output "# END $note" + } + c { + ::practcl::cputs output "/* END $note */" + } + default { + ::practcl::cputs output "# END $note" + } + } + return $output +} + +proc ::practcl::_isdirectory name { + return [file isdirectory $name] +} + +### +# Return true if the pkgindex file contains +# any statement other than "package ifneeded" +# and/or if any package ifneeded loads a DLL +### +proc ::practcl::_pkgindex_directory {path} { + set buffer {} + set pkgidxfile [file join $path pkgIndex.tcl] + if {![file exists $pkgidxfile]} { + # No pkgIndex file, read the source + foreach file [glob -nocomplain $path/*.tm] { + set file [file normalize $file] + set fname [file rootname [file tail $file]] + ### + # We used to be able to ... Assume the package is correct in the filename + # No hunt for a "package provides" + ### + set package [lindex [split $fname -] 0] + set version [lindex [split $fname -] 1] + ### + # Read the file, and override assumptions as needed + ### + set fin [open $file r] + set dat [read $fin] + close $fin + # Look for a teapot style Package statement + foreach line [split $dat \n] { + set line [string trim $line] + if { [string range $line 0 9] != "# Package " } continue + set package [lindex $line 2] + set version [lindex $line 3] + break + } + # Look for a package provide statement + foreach line [split $dat \n] { + set line [string trim $line] + if { [string range $line 0 14] != "package provide" } continue + set package [lindex $line 2] + set version [lindex $line 3] + break + } + append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n + } + foreach file [glob -nocomplain $path/*.tcl] { + if { [file tail $file] == "version_info.tcl" } continue + set fin [open $file r] + set dat [read $fin] + close $fin + if {![regexp "package provide" $dat]} continue + set fname [file rootname [file tail $file]] + # Look for a package provide statement + foreach line [split $dat \n] { + set line [string trim $line] + if { [string range $line 0 14] != "package provide" } continue + set package [lindex $line 2] + set version [lindex $line 3] + if {[string index $package 0] in "\$ \["} continue + if {[string index $version 0] in "\$ \["} continue + append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n + break + } + } + return $buffer + } + set fin [open $pkgidxfile r] + set dat [read $fin] + close $fin + set thisline {} + foreach line [split $dat \n] { + append thisline $line \n + if {![info complete $thisline]} continue + set line [string trim $line] + if {[string length $line]==0} { + set thisline {} ; continue + } + if {[string index $line 0] eq "#"} { + set thisline {} ; continue + } + try { + # Ignore contditionals + if {[regexp "if.*catch.*package.*Tcl.*return" $thisline]} continue + if {[regexp "if.*package.*vsatisfies.*package.*provide.*return" $thisline]} continue + if {![regexp "package.*ifneeded" $thisline]} { + # This package index contains arbitrary code + # source instead of trying to add it to the master + # package index + return {source [file join $dir pkgIndex.tcl]} + } + append buffer $thisline \n + } on error {err opts} { + puts *** + puts "GOOF: $pkgidxfile" + puts $line + puts $err + puts [dict get $opts -errorinfo] + puts *** + } finally { + set thisline {} + } + } + return $buffer +} + + +proc ::practcl::_pkgindex_path_subdir {path} { + set result {} + foreach subpath [glob -nocomplain [file join $path *]] { + if {[file isdirectory $subpath]} { + lappend result $subpath {*}[_pkgindex_path_subdir $subpath] + } + } + return $result +} +### +# Index all paths given as though they will end up in the same +# virtual file system +### +proc ::practcl::pkgindex_path args { + set stack {} + set buffer { +lappend ::PATHSTACK $dir + } + foreach base $args { + set base [file normalize $base] + set paths [::practcl::_pkgindex_path_subdir $base] + set i [string length $base] + # Build a list of all of the paths + foreach path $paths { + if {$path eq $base} continue + set path_indexed($path) 0 + } + set path_indexed($base) 1 + set path_indexed([file join $base boot tcl]) 1 + #set path_index([file join $base boot tk]) 1 + + foreach path $paths { + if {$path_indexed($path)} continue + set thisdir [file_relative $base $path] + #set thisdir [string range $path $i+1 end] + set idxbuf [::practcl::_pkgindex_directory $path] + if {[string length $idxbuf]} { + incr path_indexed($path) + append buffer "set dir \[set PKGDIR \[file join \[lindex \$::PATHSTACK end\] $thisdir\]\]" \n + append buffer [string map {$dir $PKGDIR} [string trimright $idxbuf]] \n + } + } + } + append buffer { +set dir [lindex $::PATHSTACK end] +set ::PATHSTACK [lrange $::PATHSTACK 0 end-1] +} + return $buffer +} + +### +# topic: 64319f4600fb63c82b2258d908f9d066 +# description: Script to build the VFS file system +### +proc ::practcl::installDir {d1 d2} { + + puts [format {%*sCreating %s} [expr {4 * [info level]}] {} [file tail $d2]] + file delete -force -- $d2 + file mkdir $d2 + + foreach ftail [glob -directory $d1 -nocomplain -tails *] { + set f [file join $d1 $ftail] + if {[file isdirectory $f] && [string compare CVS $ftail]} { + installDir $f [file join $d2 $ftail] + } elseif {[file isfile $f]} { + file copy -force $f [file join $d2 $ftail] + if {$::tcl_platform(platform) eq {unix}} { + file attributes [file join $d2 $ftail] -permissions 0644 + } else { + file attributes [file join $d2 $ftail] -readonly 1 + } + } + } + + if {$::tcl_platform(platform) eq {unix}} { + file attributes $d2 -permissions 0755 + } else { + file attributes $d2 -readonly 1 + } +} + +proc ::practcl::copyDir {d1 d2} { + #puts [list $d1 -> $d2] + #file delete -force -- $d2 + file mkdir $d2 + + foreach ftail [glob -directory $d1 -nocomplain -tails *] { + set f [file join $d1 $ftail] + if {[file isdirectory $f] && [string compare CVS $ftail]} { + copyDir $f [file join $d2 $ftail] + } elseif {[file isfile $f]} { + file copy -force $f [file join $d2 $ftail] + } + } +} + +::oo::class create ::practcl::metaclass { + superclass ::oo::object + + method script script { + eval $script + } + + method source filename { + source $filename + } + + method initialize {} {} + + method define {submethod args} { + my variable define + switch $submethod { + dump { + return [array get define] + } + add { + set field [lindex $args 0] + if {![info exists define($field)]} { + set define($field) {} + } + foreach arg [lrange $args 1 end] { + if {$arg ni $define($field)} { + lappend define($field) $arg + } + } + return $define($field) + } + remove { + set field [lindex $args 0] + if {![info exists define($field)]} { + return + } + set rlist [lrange $args 1 end] + set olist $define($field) + set nlist {} + foreach arg $olist { + if {$arg in $rlist} continue + lappend nlist $arg + } + set define($field) $nlist + return $nlist + } + exists { + set field [lindex $args 0] + return [info exists define($field)] + } + getnull - + get - + cget { + set field [lindex $args 0] + if {[info exists define($field)]} { + return $define($field) + } + return [lindex $args 1] + } + set { + if {[llength $args]==1} { + set arglist [lindex $args 0] + } else { + set arglist $args + } + array set define $arglist + if {[dict exists $arglist class]} { + my select + } + } + default { + array $submethod define {*}$args + } + } + } + + method graft args { + my variable organs + if {[llength $args] == 1} { + error "Need two arguments" + } + set object {} + foreach {stub object} $args { + dict set organs $stub $object + oo::objdefine [self] forward <${stub}> $object + oo::objdefine [self] export <${stub}> + } + return $object + } + + method organ {{stub all}} { + my variable organs + if {![info exists organs]} { + return {} + } + if { $stub eq "all" } { + return $organs + } + if {[dict exists $organs $stub]} { + return [dict get $organs $stub] + } + } + + method link {command args} { + my variable links + switch $command { + object { + foreach obj $args { + foreach linktype [$obj linktype] { + my link add $linktype $obj + } + } + } + add { + ### + # Add a link to an object that was externally created + ### + if {[llength $args] ne 2} { error "Usage: link add LINKTYPE OBJECT"} + lassign $args linktype object + if {[info exists links($linktype)] && $object in $links($linktype)} { + return + } + lappend links($linktype) $object + } + remove { + set object [lindex $args 0] + if {[llength $args]==1} { + set ltype * + } else { + set ltype [lindex $args 1] + } + foreach {linktype elements} [array get links $ltype] { + if {$object in $elements} { + set nlist {} + foreach e $elements { + if { $object ne $e } { lappend nlist $e } + } + set links($linktype) $nlist + } + } + } + list { + if {[llength $args]==0} { + return [array get links] + } + if {[llength $args] != 1} { error "Usage: link list LINKTYPE"} + set linktype [lindex $args 0] + if {![info exists links($linktype)]} { + return {} + } + return $links($linktype) + } + dump { + return [array get links] + } + } + } + + method select {} { + my variable define + set class {} + if {[info exists define(class)]} { + if {[info command $define(class)] ne {}} { + set class $define(class) + } elseif {[info command ::practcl::$define(class)] ne {}} { + set class ::practcl::$define(class) + } else { + switch $define(class) { + default { + set class ::practcl::object + } + } + } + } + if {$class ne {}} { + ::oo::objdefine [self] class $class + } + if {[::info exists define(oodefine)]} { + ::oo::objdefine [self] $define(oodefine) + unset define(oodefine) + } + } +} + +proc ::practcl::trigger {args} { + foreach name $args { + if {[dict exists $::make_objects $name]} { + [dict get $::make_objects $name] triggers + } + } +} + +proc ::practcl::depends {args} { + foreach name $args { + if {[dict exists $::make_objects $name]} { + [dict get $::make_objects $name] check + } + } +} + +proc ::practcl::target {name info} { + set obj [::practcl::target_obj new $name $info] + dict set ::make_objects $name $obj + if {[dict exists $info aliases]} { + foreach item [dict get $info aliases] { + if {![dict exists $::make_objects $item]} { + dict set ::make_objects $item $obj + } + } + } + set ::make($name) 0 + set ::trigger($name) 0 + set filename [$obj define get filename] + if {$filename ne {}} { + set ::target($name) $filename + } +} + +### Batch Tasks + +namespace eval ::practcl::build {} + +## method DEFS +# This method populates 4 variables: +# name - The name of the package +# version - The version of the package +# defs - C flags passed to the compiler +# includedir - A list of paths to feed to the compiler for finding headers +# +proc ::practcl::build::DEFS {PROJECT DEFS namevar versionvar defsvar} { + upvar 1 $namevar name $versionvar version NAME NAME $defsvar defs + set name [string tolower [${PROJECT} define get name [${PROJECT} define get pkg_name]]] + set NAME [string toupper $name] + set version [${PROJECT} define get version [${PROJECT} define get pkg_vers]] + if {$version eq {}} { + set version 0.1a + } + set defs {} + append defs " -DPACKAGE_NAME=\"${name}\" -DPACKAGE_VERSION=\"${version}\"" + append defs " -DPACKAGE_TARNAME=\"${name}\" -DPACKAGE_STRING=\"${name}\x5c\x20${version}\"" + set NAME [string toupper $name] + set idx 0 + set count 0 + while {$idx>=0} { + set ndx [string first " -D" $DEFS $idx+1] + set item [string range $DEFS $idx $ndx] + set item [string trim $item] + set item [string trimleft $item -D] + if {[string range $item 0 7] eq "PACKAGE_"} { + set idx $ndx + continue + } + set eqidx [string first = $item ] + if {$eqidx < 0} { + append defs { } $item + set idx $ndx + continue + } + + set field [string range $item 0 [expr {$eqidx-1}]] + set value [string range $item [expr {$eqidx+1}] end] + set emap {} + lappend emap \x5c \x5c\x5c \x20 \x5c\x20 \x22 \x5c\x22 \x28 \x5c\x28 \x29 \x5c\x29 + if {[string is integer -strict $value]} { + append defs " -D${field}=$value" + } else { + append defs " -D${field}=[string map $emap $value]" + } + set idx $ndx + } + return $defs +} + +proc ::practcl::build::tclkit_main {PROJECT PKG_OBJS} { + ### + # Build static package list + ### + set statpkglist {} + dict set statpkglist Tk {autoload 0} + puts [list TCLKIT MAIN $PROJECT] + + foreach {ofile info} [${PROJECT} compile-products] { + puts [list * PROD $ofile $info] + if {![dict exists $info object]} continue + set cobj [dict get $info object] + foreach {pkg info} [$cobj static-packages] { + dict set statpkglist $pkg $info + } + } + foreach cobj [list {*}${PKG_OBJS} $PROJECT] { + puts [list * PROG $cobj] + foreach {pkg info} [$cobj static-packages] { + puts [list * PKG $pkg $info] + dict set statpkglist $pkg $info + } + } + + set result {} + $PROJECT include {} + $PROJECT include {"tclInt.h"} + $PROJECT include {"tclFileSystem.h"} + $PROJECT include {} + $PROJECT include {} + $PROJECT include {} + $PROJECT include {} + $PROJECT include {} + + $PROJECT code header { +#ifndef MODULE_SCOPE +# define MODULE_SCOPE extern +#endif + +/* +** Provide a dummy Tcl_InitStubs if we are using this as a static +** library. +*/ +#ifndef USE_TCL_STUBS +# undef Tcl_InitStubs +# define Tcl_InitStubs(a,b,c) TCL_VERSION +#endif +#define STATIC_BUILD 1 +#undef USE_TCL_STUBS + +/* Make sure the stubbed variants of those are never used. */ +#undef Tcl_ObjSetVar2 +#undef Tcl_NewStringObj +#undef Tk_Init +#undef Tk_MainEx +#undef Tk_SafeInit +} + + # Build an area of the file for #define directives and + # function declarations + set define {} + set mainhook [$PROJECT define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] + set mainfunc [$PROJECT define get TCL_LOCAL_APPINIT Tclkit_AppInit] + set mainscript [$PROJECT define get main.tcl main.tcl] + set vfsroot [$PROJECT define get vfsroot zipfs:/app] + set vfs_main "${vfsroot}/${mainscript}" + set vfs_tcl_library "${vfsroot}/boot/tcl" + set vfs_tk_library "${vfsroot}/boot/tk" + + set map {} + foreach var { + vfsroot mainhook mainfunc vfs_main vfs_tcl_library vfs_tk_library + } { + dict set map %${var}% [set $var] + } + set preinitscript { +set ::odie(boot_vfs) {%vfsroot%} +set ::SRCDIR {%vfsroot%} +if {[file exists {%vfs_tcl_library%}]} { + set ::tcl_library {%vfs_tcl_library%} + set ::auto_path {} +} +if {[file exists {%vfs_tk_library%}]} { + set ::tk_library {%vfs_tk_library%} +} +} ; # Preinitscript + + set zvfsboot { +/* + * %mainhook% -- + * Performs the argument munging for the shell + */ + } + ::practcl::cputs zvfsboot { + CONST char *archive; + Tcl_FindExecutable(*argv[0]); + archive=Tcl_GetNameOfExecutable(); + + Tclzipfs_Init(NULL); + } + # We have to initialize the virtual filesystem before calling + # Tcl_Init(). Otherwise, Tcl_Init() will not be able to find + # its startup script files. + $PROJECT include {"tclZipfs.h"} + + ::practcl::cputs zvfsboot " if(!TclZipfsMount(NULL, archive, \"%vfsroot%\", NULL)) \x7B " + ::practcl::cputs zvfsboot { + Tcl_Obj *vfsinitscript; + vfsinitscript=Tcl_NewStringObj("%vfs_main%",-1); + Tcl_IncrRefCount(vfsinitscript); + if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { + /* Startup script should be set before calling Tcl_AppInit */ + Tcl_SetStartupScript(vfsinitscript,NULL); + } + } + ::practcl::cputs zvfsboot " TclSetPreInitScript([::practcl::tcl_to_c $preinitscript])\;" + ::practcl::cputs zvfsboot " \x7D else \x7B" + ::practcl::cputs zvfsboot " TclSetPreInitScript([::practcl::tcl_to_c { +foreach path { + ../tcl +} { + set p [file join $path library init.tcl] + if {[file exists [file join $path library init.tcl]]} { + set ::tcl_library [file normalize [file join $path library]] + break + } +} +foreach path { + ../tk +} { + if {[file exists [file join $path library tk.tcl]]} { + set ::tk_library [file normalize [file join $path library]] + break + } +} +}])\;" + + ::practcl::cputs zvfsboot " \x7D" + + ::practcl::cputs zvfsboot " return TCL_OK;" + + if {[$PROJECT define get os] eq "windows"} { + set header {int %mainhook%(int *argc, TCHAR ***argv)} + } else { + set header {int %mainhook%(int *argc, char ***argv)} + } + $PROJECT c_function [string map $map $header] [string map $map $zvfsboot] + + practcl::cputs appinit "int %mainfunc%(Tcl_Interp *interp) \x7B" + + # Build AppInit() + set appinit {} + practcl::cputs appinit { + if ((Tcl_Init)(interp) == TCL_ERROR) { + return TCL_ERROR; + } +} + set main_init_script {} + + foreach {statpkg info} $statpkglist { + set initfunc {} + if {[dict exists $info initfunc]} { + set initfunc [dict get $info initfunc] + } + if {$initfunc eq {}} { + set initfunc [string totitle ${statpkg}]_Init + } + # We employ a NULL to prevent the package system from thinking the + # package is actually loaded into the interpreter + $PROJECT code header "extern Tcl_PackageInitProc $initfunc\;\n" + set script [list package ifneeded $statpkg [dict get $info version] [list ::load {} $statpkg]] + append main_init_script \n [list set ::kitpkg(${statpkg}) $script] if {[dict get $info autoload]} { - ::practcl::cputs appinit " if(${initfunc}(interp)) return TCL_ERROR\;" - ::practcl::cputs appinit " Tcl_StaticPackage(interp,\"$statpkg\",$initfunc,NULL)\;" - } else { - ::practcl::cputs appinit "\n Tcl_StaticPackage(NULL,\"$statpkg\",$initfunc,NULL)\;" - append main_init_script \n $script - } - } - append main_init_script \n { -if {[file exists [file join $::SRCDIR packages.tcl]]} { - #In a wrapped exe, we don't go out to the environment - set dir $::SRCDIR - source [file join $::SRCDIR packages.tcl] -} -# Specify a user-specific startup file to invoke if the application -# is run interactively. Typically the startup file is "~/.apprc" -# where "app" is the name of the application. If this line is deleted -# then no user-specific startup file will be run under any conditions. - } - append main_init_script \n [list set tcl_rcFileName [$PROJECT define get tcl_rcFileName ~/.tclshrc]] - practcl::cputs appinit " Tcl_Eval(interp,[::practcl::tcl_to_c $main_init_script]);" - practcl::cputs appinit { return TCL_OK;} - $PROJECT c_function [string map $map "int %mainfunc%(Tcl_Interp *interp)"] [string map $map $appinit] -} - -proc ::practcl::build::compile-sources {PROJECT COMPILE {CPPCOMPILE {}}} { - set EXTERN_OBJS {} - set OBJECTS {} - set result {} - set builddir [$PROJECT define get builddir] - file mkdir [file join $builddir objs] - set debug [$PROJECT define get debug 0] - if {$CPPCOMPILE eq {}} { - set CPPCOMPILE $COMPILE - } - set task [${PROJECT} compile-products] - ### - # Compile the C sources - ### - foreach {ofile info} $task { - dict set task $ofile done 0 - if {[dict exists $info external] && [dict get $info external]==1} { - dict set task $ofile external 1 - } else { - dict set task $ofile external 0 - } - if {[dict exists $info library]} { - dict set task $ofile done 1 - continue - } - # Products with no cfile aren't compiled - if {![dict exists $info cfile] || [set cfile [dict get $info cfile]] eq {}} { - dict set task $ofile done 1 - continue - } - set cfile [dict get $info cfile] - set ofilename [file join $builddir objs [file tail $ofile]] - if {$debug} { - set ofilename [file join $builddir objs [file rootname [file tail $ofile]].debug.o] - } - dict set task $ofile filename $ofilename - if {[file exists $ofilename] && [file mtime $ofilename]>[file mtime $cfile]} { - lappend result $ofilename - dict set task $ofile done 1 - continue - } - if {![dict exist $info command]} { - if {[file extension $cfile] in {.c++ .cpp}} { - set cmd $CPPCOMPILE - } else { - set cmd $COMPILE - } - if {[dict exists $info extra]} { - append cmd " [dict get $info extra]" - } - append cmd " -c $cfile" - append cmd " -o $ofilename" - dict set task $ofile command $cmd - } - } - set completed 0 - while {$completed==0} { - set completed 1 - foreach {ofile info} $task { - set waiting {} - if {[dict exists $info done] && [dict get $info done]} continue - if {[dict exists $info depend]} { - foreach file [dict get $info depend] { - if {[dict exists $task $file command] && [dict exists $task $file done] && [dict get $task $file done] != 1} { - set waiting $file - break - } - } - } - if {$waiting ne {}} { - set completed 0 - puts "$ofile waiting for $waiting" - continue - } - if {[dict exists $info command]} { - set cmd [dict get $info command] - puts "$cmd" - exec {*}$cmd >&@ stdout - } - lappend result [dict get $info filename] - dict set task $ofile done 1 - } - } - return $result -} - -proc ::practcl::de_shell {data} { - set values {} - foreach flag {DEFS TCL_DEFS TK_DEFS} { - if {[dict exists $data $flag]} { - set value {} - foreach item [dict get $data $flag] { - append value " " [string map {{ } {\ }} $item] - } - dict set values $flag $value - } - } - set map {} - lappend map {${PKG_OBJECTS}} %LIBRARY_OBJECTS% - lappend map {$(PKG_OBJECTS)} %LIBRARY_OBJECTS% - lappend map {${PKG_STUB_OBJECTS}} %LIBRARY_STUB_OBJECTS% - lappend map {$(PKG_STUB_OBJECTS)} %LIBRARY_STUB_OBJECTS% - - lappend map %LIBRARY_NAME% [dict get $data name] - lappend map %LIBRARY_VERSION% [dict get $data version] - lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} [dict get $data version]] - if {[dict exists $data libprefix]} { - lappend map %LIBRARY_PREFIX% [dict get $data libprefix] - } else { - lappend map %LIBRARY_PREFIX% [dict get $data prefix] - } - foreach flag [dict keys $data] { - if {$flag in {TCL_DEFS TK_DEFS DEFS}} continue - - dict set map "%${flag}%" [dict get $data $flag] - dict set map "\$\{${flag}\}" [dict get $data $flag] - dict set map "\$\(${flag}\)" [dict get $data $flag] - dict set values $flag [dict get $data $flag] - #dict set map "\$\{${flag}\}" $proj($flag) - } - set changed 1 - while {$changed} { - set changed 0 - foreach {field value} $values { - if {$field in {TCL_DEFS TK_DEFS DEFS}} continue - dict with values {} - set newval [string map $map $value] - if {$newval eq $value} continue - set changed 1 - dict set values $field $newval - } - } - return $values -} - -proc ::practcl::build::Makefile {path PROJECT} { - array set proj [$PROJECT define dump] - set path $proj(builddir) - cd $path - set includedir . - #lappend includedir [::practcl::file_relative $path $proj(TCL_INCLUDES)] - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TCL_SRC_DIR) generic]]] - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(srcdir) generic]]] - foreach include [$PROJECT generate-include-directory] { - set cpath [::practcl::file_relative $path [file normalize $include]] - if {$cpath ni $includedir} { - lappend includedir $cpath - } - } - set INCLUDES "-I[join $includedir " -I"]" - set NAME [string toupper $proj(name)] - set result {} - set products {} - set libraries {} - set thisline {} - ::practcl::cputs result "${NAME}_DEFS = $proj(DEFS)\n" - ::practcl::cputs result "${NAME}_INCLUDES = -I\"[join $includedir "\" -I\""]\"\n" - ::practcl::cputs result "${NAME}_COMPILE = \$(CC) \$(CFLAGS) \$(PKG_CFLAGS) \$(${NAME}_DEFS) \$(${NAME}_INCLUDES) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS) \$(AM_CFLAGS)" - ::practcl::cputs result "${NAME}_CPPCOMPILE = \$(CXX) \$(CFLAGS) \$(PKG_CFLAGS) \$(${NAME}_DEFS) \$(${NAME}_INCLUDES) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS) \$(AM_CFLAGS)" - - foreach {ofile info} [$PROJECT compile-products] { - dict set products $ofile $info - if {[dict exists $info library]} { -lappend libraries $ofile -continue - } - if {[dict exists $info depend]} { - ::practcl::cputs result "\n${ofile}: [dict get $info depend]" - } else { - ::practcl::cputs result "\n${ofile}:" - } - set cfile [dict get $info cfile] - if {[file extension $cfile] in {.c++ .cpp}} { - set cmd "\t\$\(${NAME}_CPPCOMPILE\)" - } else { - set cmd "\t\$\(${NAME}_COMPILE\)" - } - if {[dict exists $info extra]} { - append cmd " [dict get $info extra]" - } - append cmd " -c [dict get $info cfile] -o \$@\n\t" - ::practcl::cputs result $cmd - } - - set map {} - lappend map %LIBRARY_NAME% $proj(name) - lappend map %LIBRARY_VERSION% $proj(version) - lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} $proj(version)] - lappend map %LIBRARY_PREFIX% [$PROJECT define getnull libprefix] - - if {[string is true [$PROJECT define get SHARED_BUILD]]} { - set outfile [$PROJECT define get libfile] - } else { - set outfile [$PROJECT shared_library] - } - $PROJECT define set shared_library $outfile - ::practcl::cputs result " -${NAME}_SHLIB = $outfile -${NAME}_OBJS = [dict keys $products] -" - - #lappend map %OUTFILE% {\[$]@} - lappend map %OUTFILE% $outfile - lappend map %LIBRARY_OBJECTS% "\$(${NAME}_OBJS)" - ::practcl::cputs result "$outfile: \$(${NAME}_OBJS)" - ::practcl::cputs result "\t[string map $map [$PROJECT define get PRACTCL_SHARED_LIB]]" - if {[$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL] ni {: {}}} { - ::practcl::cputs result "\t[string map $map [$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL]]" - } - ::practcl::cputs result {} - if {[string is true [$PROJECT define get SHARED_BUILD]]} { - #set outfile [$PROJECT static_library] - set outfile $proj(name).a - } else { - set outfile [$PROJECT define get libfile] - } - $PROJECT define set static_library $outfile - dict set map %OUTFILE% $outfile - ::practcl::cputs result "$outfile: \$(${NAME}_OBJS)" - ::practcl::cputs result "\t[string map $map [$PROJECT define get PRACTCL_STATIC_LIB]]" - ::practcl::cputs result {} - return $result -} - -### -# Produce a dynamic library -### -proc ::practcl::build::library {outfile PROJECT} { - array set proj [$PROJECT define dump] - set path $proj(builddir) - cd $path - set includedir . - #lappend includedir [::practcl::file_relative $path $proj(TCL_INCLUDES)] - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TCL_SRC_DIR) generic]]] - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(srcdir) generic]]] - if {[$PROJECT define get tk 0]} { - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TK_SRC_DIR) generic]]] - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TK_SRC_DIR) ttk]]] - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TK_SRC_DIR) xlib]]] - lappend includedir [::practcl::file_relative $path [file normalize $proj(TK_BIN_DIR)]] - } - foreach include [$PROJECT generate-include-directory] { - set cpath [::practcl::file_relative $path [file normalize $include]] - if {$cpath ni $includedir} { - lappend includedir $cpath - } - } - ::practcl::build::DEFS $PROJECT $proj(DEFS) name version defs - set NAME [string toupper $name] - set debug [$PROJECT define get debug 0] - set os [$PROJECT define get os] - - set INCLUDES "-I[join $includedir " -I"]" - if {$debug} { - set COMPILE "$proj(CC) $proj(CFLAGS_DEBUG) -ggdb \ -$proj(CFLAGS_WARNING) $INCLUDES $defs" - - if {[info exists proc(CXX)]} { - set COMPILECPP "$proj(CXX) $defs $INCLUDES $proj(CFLAGS_DEBUG) -ggdb \ - $proj(DEFS) $proj(CFLAGS_WARNING)" - } else { - set COMPILECPP $COMPILE - } - } else { - set COMPILE "$proj(CC) $proj(CFLAGS) $defs $INCLUDES " - - if {[info exists proc(CXX)]} { - set COMPILECPP "$proj(CXX) $defs $INCLUDES $proj(CFLAGS) $proj(DEFS)" - } else { - set COMPILECPP $COMPILE - } - } - - set products [compile-sources $PROJECT $COMPILE $COMPILECPP] - - set map {} - lappend map %LIBRARY_NAME% $proj(name) - lappend map %LIBRARY_VERSION% $proj(version) - lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} $proj(version)] - lappend map %OUTFILE% $outfile - lappend map %LIBRARY_OBJECTS% $products - lappend map {${CFLAGS}} "$proj(CFLAGS_DEFAULT) $proj(CFLAGS_WARNING)" - - if {[string is true [$PROJECT define get SHARED_BUILD 1]]} { - set cmd [$PROJECT define get PRACTCL_SHARED_LIB] - append cmd " [$PROJECT define get PRACTCL_LIBS]" - set cmd [string map $map $cmd] - puts $cmd - exec {*}$cmd >&@ stdout - if {[$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL] ni {: {}}} { - set cmd [string map $map [$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL]] - puts $cmd - exec {*}$cmd >&@ stdout - } - } else { - set cmd [string map $map [$PROJECT define get PRACTCL_STATIC_LIB]] - puts $cmd - exec {*}$cmd >&@ stdout - } -} - -### -# Produce a static executable -### -proc ::practcl::build::static-tclsh {outfile PROJECT} { - puts " BUILDING STATIC TCLSH " - set TCLOBJ [$PROJECT project TCLCORE] - set TKOBJ [$PROJECT project TKCORE] - set ODIEOBJ [$PROJECT project odie] - - set PKG_OBJS {} - foreach item [$PROJECT link list package] { - if {[string is true [$item define get static]]} { - lappend PKG_OBJS $item - } - } - array set TCL [$TCLOBJ config.sh] - array set TK [$TKOBJ config.sh] - set path [file dirname $outfile] - cd $path - ### - # For a static Tcl shell, we need to build all local sources - # with the same DEFS flags as the tcl core was compiled with. - # The DEFS produced by a TEA extension aren't intended to operate - # with the internals of a staticly linked Tcl - ### - ::practcl::build::DEFS $PROJECT $TCL(defs) name version defs - set debug [$PROJECT define get debug 0] - set NAME [string toupper $name] - set result {} - set libraries {} - set thisline {} - set OBJECTS {} - set EXTERN_OBJS {} - foreach obj $PKG_OBJS { - $obj compile - set config($obj) [$obj config.sh] - } - set os [$PROJECT define get os] - set TCLSRCDIR [$TCLOBJ define get srcroot] - set TKSRCDIR [$TKOBJ define get srcroot] - - set includedir . - foreach include [$TCLOBJ generate-include-directory] { - set cpath [::practcl::file_relative $path [file normalize $include]] - if {$cpath ni $includedir} { - lappend includedir $cpath - } - } - lappend includedir [::practcl::file_relative $path [file normalize ../tcl/compat/zlib]] - foreach include [$PROJECT generate-include-directory] { - set cpath [::practcl::file_relative $path [file normalize $include]] - if {$cpath ni $includedir} { - lappend includedir $cpath - } - } - - set INCLUDES "-I[join $includedir " -I"]" - if {$debug} { - set COMPILE "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_debug) -ggdb \ -$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" - } else { - set COMPILE "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_optimize) \ -$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" - } - append COMPILE " " $defs - lappend OBJECTS {*}[compile-sources $PROJECT $COMPILE $COMPILE] - - if {[${PROJECT} define get platform] eq "windows"} { - set RSOBJ [file join $path build tclkit.res.o] - set RCSRC [${PROJECT} define get kit_resource_file] - if {$RCSRC eq {} || ![file exists $RCSRC]} { - set RCSRC [file join $TKSRCDIR win rc wish.rc] - } - set cmd [list windres -o $RSOBJ -DSTATIC_BUILD] - set TCLSRC [file normalize $TCLSRCDIR] - set TKSRC [file normalize $TKSRCDIR] - - lappend cmd --include [::practcl::file_relative $path [file join $TCLSRC generic]] \ - --include [::practcl::file_relative $path [file join $TKSRC generic]] \ - --include [::practcl::file_relative $path [file join $TKSRC win]] \ - --include [::practcl::file_relative $path [file join $TKSRC win rc]] - foreach item [${PROJECT} define get resource_include] { - lappend cmd --include [::practcl::file_relative $path [file normalize $item]] - } - lappend cmd $RCSRC - doexec {*}$cmd - - lappend OBJECTS $RSOBJ - set LDFLAGS_CONSOLE {-mconsole -pipe -static-libgcc} - set LDFLAGS_WINDOW {-mwindows -pipe -static-libgcc} - } else { - set LDFLAGS_CONSOLE {} - set LDFLAGS_WINDOW {} - } - puts "***" - if {$debug} { - set cmd "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_debug) \ -$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" - } else { - set cmd "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_optimize) \ -$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" - } - append cmd " $OBJECTS" - append cmd " $EXTERN_OBJS " - # On OSX it is impossibly to generate a completely static - # executable - if {[$PROJECT define get TEACUP_OS] ne "macosx"} { - append cmd " -static " - } - parray TCL - if {$debug} { - if {$os eq "windows"} { - append cmd " -L${TCL(src_dir)}/win -ltcl86g" - append cmd " -L${TK(src_dir)}/win -ltk86g" - } else { - append cmd " -L${TCL(src_dir)}/unix -ltcl86g" - append cmd " -L${TK(src_dir)}/unix -ltk86g" - } - } else { - append cmd " $TCL(build_lib_spec) $TK(build_lib_spec)" - } - foreach obj $PKG_OBJS { - append cmd " [$obj linker-products $config($obj)]" - } - append cmd " $TCL(libs) $TK(libs)" - foreach obj $PKG_OBJS { - append cmd " [$obj linker-external $config($obj)]" - } - if {$debug} { - if {$os eq "windows"} { - append cmd " -L${TCL(src_dir)}/win ${TCL(stub_lib_flag)}" - append cmd " -L${TK(src_dir)}/win ${TK(stub_lib_flag)}" - } else { - append cmd " -L${TCL(src_dir)}/unix ${TCL(stub_lib_flag)}" - append cmd " -L${TK(src_dir)}/unix ${TK(stub_lib_flag)}" - } - } else { - append cmd " $TCL(build_stub_lib_spec)" - append cmd " $TK(build_stub_lib_spec)" - } - append cmd " -o $outfile $LDFLAGS_CONSOLE" - puts "LINK: $cmd" - exec {*}$cmd >&@ stdout -} - -::oo::class create ::practcl::target_obj { - superclass ::practcl::metaclass - - constructor {name info} { - my variable define triggered domake - set triggered 0 - set domake 0 - set define(name) $name - set data [uplevel 2 [list subst $info]] - array set define $data - my select - my initialize - } - - method do {} { - my variable domake - return $domake - } - - method check {} { - my variable needs_make domake - if {$domake} { - return 1 - } - if {[info exists needs_make]} { - return $needs_make - } - set needs_make 0 - foreach item [my define get depends] { - if {![dict exists $::make_objects $item]} continue - set depobj [dict get $::make_objects $item] - if {$depobj eq [self]} { - puts "WARNING [self] depends on itself" - continue - } - if {[$depobj check]} { - set needs_make 1 - } - } - if {!$needs_make} { - set filename [my define get filename] - if {$filename ne {} && ![file exists $filename]} { - set needs_make 1 - } - } - return $needs_make - } - - method triggers {} { - my variable triggered domake define - if {$triggered} { - return $domake - } - set triggered 1 - foreach item [my define get depends] { - puts [list $item [dict exists $::make_objects $item]] - if {![dict exists $::make_objects $item]} continue - set depobj [dict get $::make_objects $item] - if {$depobj eq [self]} { - puts "WARNING [self] triggers itself" - continue - } else { - set r [$depobj check] - puts [list $depobj check $r] - if {$r} { - puts [list $depobj TRIGGER] - $depobj triggers - } - } - } - if {[info exists ::make($define(name))] && $::make($define(name))} { - return - } - set ::make($define(name)) 1 - ::practcl::trigger {*}[my define get triggers] - } -} - - -### -# Define the metaclass -### -::oo::class create ::practcl::object { - superclass ::practcl::metaclass - - constructor {parent args} { - my variable links define - set organs [$parent child organs] - my graft {*}$organs - array set define $organs - array set define [$parent child define] - array set links {} - if {[llength $args]==1 && [file exists [lindex $args 0]]} { - my InitializeSourceFile [lindex $args 0] - } elseif {[llength $args] == 1} { - set data [uplevel 1 [list subst [lindex $args 0]]] - array set define $data - my select - my initialize - } else { - array set define [uplevel 1 [list subst $args]] - my select - my initialize - } - } - - - method include_dir args { - my define add include_dir {*}$args - } - - method include_directory args { - my define add include_dir {*}$args - } - - method Collate_Source CWD {} - - - method child {method} { - return {} - } - - method InitializeSourceFile filename { - my define set filename $filename - set class {} - switch [file extension $filename] { - .tcl { - set class ::practcl::dynamic - } - .h { - set class ::practcl::cheader - } - .c { - set class ::practcl::csource - } - .ini { - switch [file tail $filename] { - module.ini { - set class ::practcl::module - } - library.ini { - set class ::practcl::subproject - } - } - } - .so - - .dll - - .dylib - - .a { - set class ::practcl::clibrary - } - } - if {$class ne {}} { - oo::objdefine [self] class $class - my initialize - } - } - - method add args { - my variable links - set object [::practcl::object new [self] {*}$args] - foreach linktype [$object linktype] { - lappend links($linktype) $object - } - return $object - } - - method go {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable links - foreach {linktype objs} [array get links] { - foreach obj $objs { - $obj go - } - } - debug [list /[self] [self method] [self class]] - } - - method code {section body} { - my variable code - ::practcl::cputs code($section) $body - } - - method Ofile filename { - set lpath [my define get localpath] - if {$lpath eq {}} { - set lpath [my define get name] - } - return ${lpath}_[file rootname [file tail $filename]].o - } - - method compile-products {} { - set filename [my define get filename] - set result {} - if {$filename ne {}} { - if {[my define exists ofile]} { - set ofile [my define get ofile] - } else { - set ofile [my Ofile $filename] - my define set ofile $ofile - } - lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]] object [self]] - } - foreach item [my link list subordinate] { - lappend result {*}[$item compile-products] - } - return $result - } - - method generate-include-directory {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result [my define get include_dir] - foreach obj [my link list product] { - foreach path [$obj generate-include-directory] { - lappend result $path - } - } - return $result - } - - method generate-debug {{spaces {}}} { - set result {} - ::practcl::cputs result "$spaces[list [self] [list class [info object class [self]] filename [my define get filename]] links [my link list]]" - foreach item [my link list subordinate] { - practcl::cputs result [$item generate-debug "$spaces "] - } - return $result - } - - # Empty template methods - method generate-cheader {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cfunct cstruct methods tcltype tclprocs - set result {} - if {[info exists code(header)]} { - ::practcl::cputs result $code(header) - } - foreach obj [my link list product] { - # Exclude products that will generate their own C files - if {[$obj define get output_c] ne {}} continue - ::practcl::cputs result "/* BEGIN [$obj define get filename] generate-cheader */" - ::practcl::cputs result [$obj generate-cheader] - ::practcl::cputs result "/* END [$obj define get filename] generate-cheader */" - } - debug [list cfunct [info exists cfunct]] - if {[info exists cfunct]} { - foreach {funcname info} $cfunct { - if {[dict get $info public]} continue - ::practcl::cputs result "[dict get $info header]\;" - } - } - debug [list tclprocs [info exists tclprocs]] - if {[info exists tclprocs]} { - foreach {name info} $tclprocs { - if {[dict exists $info header]} { - ::practcl::cputs result "[dict get $info header]\;" - } - } - } - debug [list methods [info exists methods] [my define get cclass]] - - if {[info exists methods]} { - set thisclass [my define get cclass] - foreach {name info} $methods { - if {[dict exists $info header]} { - ::practcl::cputs result "[dict get $info header]\;" - } - } - # Add the initializer wrapper for the class - ::practcl::cputs result "static int ${thisclass}_OO_Init(Tcl_Interp *interp)\;" - } - return $result - } - - method generate-public-define {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code - set result {} - if {[info exists code(public-define)]} { - ::practcl::cputs result $code(public-define) - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-public-define] - } - return $result - } - - method generate-public-macro {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code - set result {} - if {[info exists code(public-macro)]} { - ::practcl::cputs result $code(public-macro) - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-public-macro] - } - return $result - } - - method generate-public-typedef {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cstruct - set result {} - if {[info exists code(public-typedef)]} { - ::practcl::cputs result $code(public-typedef) - } - if {[info exists cstruct]} { - # Add defintion for native c data structures - foreach {name info} $cstruct { - ::practcl::cputs result "typedef struct $name ${name}\;" - if {[dict exists $info aliases]} { - foreach n [dict get $info aliases] { - ::practcl::cputs result "typedef struct $name ${n}\;" - } - } - } - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-public-typedef] - } - return $result - } - - method generate-public-structure {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cstruct - set result {} - if {[info exists code(public-structure)]} { - ::practcl::cputs result $code(public-structure) - } - if {[info exists cstruct]} { - foreach {name info} $cstruct { - if {[dict exists $info comment]} { - ::practcl::cputs result [dict get $info comment] - } - ::practcl::cputs result "struct $name \{[dict get $info body]\}\;" - } - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-public-structure] - } - return $result - } - method generate-public-headers {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code tcltype - set result {} - if {[info exists code(public-header)]} { - ::practcl::cputs result $code(public-header) - } - if {[info exists tcltype]} { - foreach {type info} $tcltype { - if {![dict exists $info cname]} { - set cname [string tolower ${type}]_tclobjtype - dict set tcltype $type cname $cname - } else { - set cname [dict get $info cname] - } - ::practcl::cputs result "extern const Tcl_ObjType $cname\;" - } - } - if {[info exists code(public)]} { - ::practcl::cputs result $code(public) - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-public-headers] - } - return $result - } - - method generate-stub-function {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cfunct tcltype - set result {} - foreach mod [my link list product] { - foreach {funct def} [$mod generate-stub-function] { - dict set result $funct $def - } - } - if {[info exists cfunct]} { - foreach {funcname info} $cfunct { - if {![dict get $info export]} continue - dict set result $funcname [dict get $info header] - } - } - return $result - } - - method generate-public-function {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cfunct tcltype - set result {} - - if {[my define get initfunc] ne {}} { - ::practcl::cputs result "int [my define get initfunc](Tcl_Interp *interp);" - } - if {[info exists cfunct]} { - foreach {funcname info} $cfunct { - if {![dict get $info public]} continue - ::practcl::cputs result "[dict get $info header]\;" - } - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-public-function] - } - return $result - } - - method generate-public-includes {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set includes {} - foreach item [my define get public-include] { - if {$item ni $includes} { - lappend includes $item - } - } - foreach mod [my link list product] { - foreach item [$mod generate-public-includes] { - if {$item ni $includes} { - lappend includes $item - } - } - } - return $includes - } - method generate-public-verbatim {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set includes {} - foreach item [my define get public-verbatim] { - if {$item ni $includes} { - lappend includes $item - } - } - foreach mod [my link list subordinate] { - foreach item [$mod generate-public-verbatim] { - if {$item ni $includes} { - lappend includes $item - } - } - } - return $includes - } - ### - # This methods generates the contents of an amalgamated .h file - # which describes the public API of this module - ### - method generate-h {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result {} - set includes [my generate-public-includes] - foreach inc $includes { - if {[string index $inc 0] ni {< \"}} { - ::practcl::cputs result "#include \"$inc\"" - } else { - ::practcl::cputs result "#include $inc" - } - } - foreach file [my generate-public-verbatim] { - ::practcl::cputs result "/* BEGIN $file */" - ::practcl::cputs result [::practcl::cat $file] - ::practcl::cputs result "/* END $file */" - } - foreach method { - generate-public-define - generate-public-macro - generate-public-typedef - generate-public-structure - generate-public-headers - generate-public-function - } { - ::practcl::cputs result "/* BEGIN SECTION $method */" - ::practcl::cputs result [my $method] - ::practcl::cputs result "/* END SECTION $method */" - } - return $result - } - - ### - # This methods generates the contents of an amalgamated .c file - # which implements the loader for a batch of tools - ### - method generate-c {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result { -/* This file was generated by practcl */ - } - set includes {} - lappend headers - if {[my define get tk 0]} { - lappend headers - } - lappend headers {*}[my define get include] - if {[my define get output_h] ne {}} { - lappend headers "\"[my define get output_h]\"" - } - foreach mod [my link list product] { - # Signal modules to formulate final implementation - $mod go - } - foreach mod [my link list dynamic] { - foreach inc [$mod define get include] { - if {$inc ni $headers} { - lappend headers $inc - } - } - } - foreach inc $headers { - if {[string index $inc 0] ni {< \"}} { - ::practcl::cputs result "#include \"$inc\"" - } else { - ::practcl::cputs result "#include $inc" - } - } - foreach {method} { - generate-cheader - generate-cstruct - generate-constant - generate-cfunct - generate-cmethod - } { - ::practcl::cputs result "/* BEGIN $method [my define get filename] */" - ::practcl::cputs result [my $method] - ::practcl::cputs result "/* END $method [my define get filename] */" - } - debug [list /[self] [self method] [self class] -- [my define get filename] [info object class [self]]] - return $result - } - - - method generate-loader {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result {} - if {[my define get initfunc] eq {}} return - ::practcl::cputs result " -extern int DLLEXPORT [my define get initfunc]( Tcl_Interp *interp ) \{" - ::practcl::cputs result { - /* Initialise the stubs tables. */ - #ifdef USE_TCL_STUBS - if (Tcl_InitStubs(interp, "8.6", 0)==NULL) return TCL_ERROR; - if (TclOOInitializeStubs(interp, "1.0") == NULL) return TCL_ERROR; -} - if {[my define get tk 0]} { - ::practcl::cputs result { if (Tk_InitStubs(interp, "8.6", 0)==NULL) return TCL_ERROR;} - } - ::practcl::cputs result { #endif} - set TCLINIT [my generate-tcl] - ::practcl::cputs result " if(Tcl_Eval(interp,[::practcl::tcl_to_c $TCLINIT])) return TCL_ERROR ;" - foreach item [my link list product] { - if {[$item define get output_c] ne {}} { - ::practcl::cputs result [$item generate-cinit-external] - } else { - ::practcl::cputs result [$item generate-cinit] - } - } - if {[my define exists pkg_name]} { - ::practcl::cputs result " if (Tcl_PkgProvide(interp, \"[my define get pkg_name [my define get name]]\" , \"[my define get pkg_vers [my define get version]]\" )) return TCL_ERROR\;" - } - ::practcl::cputs result " return TCL_OK\;\n\}\n" - return $result - } - - ### - # This methods generates any Tcl script file - # which is required to pre-initialize the C library - ### - method generate-tcl {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result {} - my variable code - if {[info exists code(tcl)]} { - ::practcl::cputs result $code(tcl) - } - set result [::practcl::_tagblock $result tcl [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-tcl] - } - return $result - } - - method static-packages {} { - set result [my define get static_packages] - set statpkg [my define get static_pkg] - set initfunc [my define get initfunc] - if {$initfunc ne {}} { - set pkg_name [my define get pkg_name] - if {$pkg_name ne {}} { - dict set result $pkg_name initfunc $initfunc - dict set result $pkg_name version [my define get version [my define get pkg_vers]] - dict set result $pkg_name autoload [my define get autoload 0] - } - } - foreach item [my link list subordinate] { - foreach {pkg info} [$item static-packages] { - dict set result $pkg $info - } - } - return $result - } - - method target {method args} { - switch $method { - is_unix { return [expr {$::tcl_platform(platform) eq "unix"}] } - } - } - -} - -::oo::class create ::practcl::product { - superclass ::practcl::object - - method linktype {} { - return {subordinate product} - } - - method include header { - my define add include $header - } - - method cstructure {name definition {argdat {}}} { - my variable cstruct - dict set cstruct $name body $definition - foreach {f v} $argdat { - dict set cstruct $name $f $v - } - } - - method generate-cinit {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code - set result {} - if {[info exists code(cinit)]} { - ::practcl::cputs result $code(cinit) - } - if {[my define get initfunc] ne {}} { - ::practcl::cputs result " if([my define get initfunc](interp)!=TCL_OK) return TCL_ERROR\;" - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach obj [my link list product] { - ::practcl::cputs result [$obj generate-cinit] - } - return $result - } -} - -### -# Dynamic blocks do not generate their own .c files, -# instead the contribute to the amalgamation -# of the main library file -### -::oo::class create ::practcl::dynamic { - superclass ::practcl::product - - # Retrieve any additional source files required - - method compile-products {} { - set filename [my define get output_c] - set result {} - if {$filename ne {}} { - if {[my define exists ofile]} { - set ofile [my define get ofile] - } else { - set ofile [my Ofile $filename] - my define set ofile $ofile - } - lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]]] - } else { - set filename [my define get cfile] - if {$filename ne {}} { - if {[my define exists ofile]} { - set ofile [my define get ofile] - } else { - set ofile [my Ofile $filename] - my define set ofile $ofile - } - lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]]] - } - } - foreach item [my link list subordinate] { - lappend result {*}[$item compile-products] - } - return $result - } - - method implement path { - my go - my Collate_Source $path - if {[my define get output_c] eq {}} return - set filename [file join $path [my define get output_c]] - my define set cfile $filename - set fout [open $filename w] - puts $fout [my generate-c] - puts $fout "extern int DLLEXPORT [my define get initfunc]( Tcl_Interp *interp ) \x7B" - puts $fout [my generate-cinit] - if {[my define get pkg_name] ne {}} { - puts $fout " Tcl_PkgProvide(interp, \"[my define get pkg_name]\", \"[my define get pkg_vers]\");" - } - puts $fout " return TCL_OK\;" - puts $fout "\x7D" - close $fout - } - - method initialize {} { - set filename [my define get filename] - if {$filename eq {}} { - return - } - if {[my define get name] eq {}} { - my define set name [file tail [file rootname $filename]] - } - if {[my define get localpath] eq {}} { - my define set localpath [my define get localpath]_[my define get name] - } - ::source $filename - } - - method linktype {} { - return {subordinate product dynamic} - } - - ### - # Populate const static data structures - ### - method generate-cstruct {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cstruct methods tcltype - set result {} - if {[info exists code(struct)]} { - ::practcl::cputs result $code(struct) - } - foreach obj [my link list dynamic] { - # Exclude products that will generate their own C files - if {[$obj define get output_c] ne {}} continue - ::practcl::cputs result [$obj generate-cstruct] - } - return $result - } - - method generate-constant {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result {} - my variable code cstruct methods tcltype - if {[info exists code(constant)]} { - ::practcl::cputs result "/* [my define get filename] CONSTANT */" - ::practcl::cputs result $code(constant) - } - if {[info exists cstruct]} { - foreach {name info} $cstruct { - set map {} - lappend map @NAME@ $name - lappend map @MACRO@ GET[string toupper $name] - - if {[dict exists $info deleteproc]} { - lappend map @DELETEPROC@ [dict get $info deleteproc] - } else { - lappend map @DELETEPROC@ NULL - } - if {[dict exists $info cloneproc]} { - lappend map @CLONEPROC@ [dict get $info cloneproc] - } else { - lappend map @CLONEPROC@ NULL - } - ::practcl::cputs result [string map $map { -const static Tcl_ObjectMetadataType @NAME@DataType = { - TCL_OO_METADATA_VERSION_CURRENT, - "@NAME@", - @DELETEPROC@, - @CLONEPROC@ -}; -#define @MACRO@(OBJCONTEXT) (@NAME@ *) Tcl_ObjectGetMetadata(OBJCONTEXT,&@NAME@DataType) -}] - } - } - if {[info exists tcltype]} { - foreach {type info} $tcltype { - dict with info {} - ::practcl::cputs result "const Tcl_ObjType $cname = \{\n .freeIntRepProc = &${freeproc},\n .dupIntRepProc = &${dupproc},\n .updateStringProc = &${updatestringproc},\n .setFromAnyProc = &${setfromanyproc}\n\}\;" - } - } - - if {[info exists methods]} { - set mtypes {} - foreach {name info} $methods { - set callproc [dict get $info callproc] - set methodtype [dict get $info methodtype] - if {$methodtype in $mtypes} continue - lappend mtypes $methodtype - ### - # Build the data struct for this method - ### - ::practcl::cputs result "const static Tcl_MethodType $methodtype = \{" - ::practcl::cputs result " .version = TCL_OO_METADATA_VERSION_CURRENT,\n .name = \"$name\",\n .callProc = $callproc," - if {[dict exists $info deleteproc]} { - set deleteproc [dict get $info deleteproc] - } else { - set deleteproc NULL - } - if {$deleteproc ni { {} NULL }} { - ::practcl::cputs result " .deleteProc = $deleteproc," - } else { - ::practcl::cputs result " .deleteProc = NULL," - } - if {[dict exists $info cloneproc]} { - set cloneproc [dict get $info cloneproc] - } else { - set cloneproc NULL - } - if {$cloneproc ni { {} NULL }} { - ::practcl::cputs result " .cloneProc = $cloneproc\n\}\;" - } else { - ::practcl::cputs result " .cloneProc = NULL\n\}\;" - } - dict set methods $name methodtype $methodtype - } - } - foreach obj [my link list dynamic] { - # Exclude products that will generate their own C files - if {[$obj define get output_c] ne {}} continue - ::practcl::cputs result [$obj generate-constant] - } - return $result - } - - ### - # Generate code that provides subroutines called by - # Tcl API methods - ### - method generate-cfunct {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cfunct - set result {} - if {[info exists code(funct)]} { - ::practcl::cputs result $code(funct) - } - if {[info exists cfunct]} { - foreach {funcname info} $cfunct { - ::practcl::cputs result "[dict get $info header]\{[dict get $info body]\}\;" - } - } - foreach obj [my link list dynamic] { - # Exclude products that will generate their own C files - if {[$obj define get output_c] ne {}} { - continue - } - ::practcl::cputs result [$obj generate-cfunct] - } - return $result - } - - ### - # Generate code that provides implements Tcl API - # calls - ### - method generate-cmethod {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code methods tclprocs - set result {} - if {[info exists code(method)]} { - ::practcl::cputs result $code(method) - } - - if {[info exists tclprocs]} { - foreach {name info} $tclprocs { - if {![dict exists $info body]} continue - set callproc [dict get $info callproc] - set header [dict get $info header] - set body [dict get $info body] - ::practcl::cputs result "${header} \{${body}\}" - } - } - - - if {[info exists methods]} { - set thisclass [my define get cclass] - foreach {name info} $methods { - if {![dict exists $info body]} continue - set callproc [dict get $info callproc] - set header [dict get $info header] - set body [dict get $info body] - ::practcl::cputs result "${header} \{${body}\}" - } - # Build the OO_Init function - ::practcl::cputs result "static int ${thisclass}_OO_Init(Tcl_Interp *interp) \{" - ::practcl::cputs result [string map [list @CCLASS@ $thisclass @TCLCLASS@ [my define get class]] { - /* - ** Build the "@TCLCLASS@" class - */ - Tcl_Obj* nameObj; /* Name of a class or method being looked up */ - Tcl_Object curClassObject; /* Tcl_Object representing the current class */ - Tcl_Class curClass; /* Tcl_Class representing the current class */ - - /* - * Find the "@TCLCLASS@" class, and attach an 'init' method to it. - */ - - nameObj = Tcl_NewStringObj("@TCLCLASS@", -1); - Tcl_IncrRefCount(nameObj); - if ((curClassObject = Tcl_GetObjectFromObj(interp, nameObj)) == NULL) { - Tcl_DecrRefCount(nameObj); - return TCL_ERROR; - } - Tcl_DecrRefCount(nameObj); - curClass = Tcl_GetObjectAsClass(curClassObject); -}] - if {[dict exists $methods constructor]} { - set mtype [dict get $methods constructor methodtype] - ::practcl::cputs result [string map [list @MTYPE@ $mtype] { - /* Attach the constructor to the class */ - Tcl_ClassSetConstructor(interp, curClass, Tcl_NewMethod(interp, curClass, NULL, 1, &@MTYPE@, NULL)); - }] - } - foreach {name info} $methods { - dict with info {} - if {$name in {constructor destructor}} continue - ::practcl::cputs result [string map [list @NAME@ $name @MTYPE@ $methodtype] { - nameObj=Tcl_NewStringObj("@NAME@",-1); - Tcl_NewMethod(interp, curClass, nameObj, 1, &@MTYPE@, (ClientData) NULL); - Tcl_DecrRefCount(nameObj); -}] - if {[dict exists $info aliases]} { - foreach alias [dict get $info aliases] { - if {[dict exists $methods $alias]} continue - ::practcl::cputs result [string map [list @NAME@ $alias @MTYPE@ $methodtype] { - nameObj=Tcl_NewStringObj("@NAME@",-1); - Tcl_NewMethod(interp, curClass, nameObj, 1, &@MTYPE@, (ClientData) NULL); - Tcl_DecrRefCount(nameObj); -}] - } - } - } - ::practcl::cputs result " return TCL_OK\;\n\}\n" - } - foreach obj [my link list dynamic] { - # Exclude products that will generate their own C files - if {[$obj define get output_c] ne {}} continue - ::practcl::cputs result [$obj generate-cmethod] - } - return $result - } - - method generate-cinit-external {} { - if {[my define get initfunc] eq {}} { - return "/* [my define get filename] declared not initfunc */" - } - return " if([my define get initfunc](interp)) return TCL_ERROR\;" - } - - ### - # Generate code that runs when the package/module is - # initialized into the interpreter - ### - method generate-cinit {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result {} - my variable code methods tclprocs - if {[info exists code(nspace)]} { - ::practcl::cputs result " \{\n Tcl_Namespace *modPtr;" - foreach nspace $code(nspace) { - ::practcl::cputs result [string map [list @NSPACE@ $nspace] { - modPtr=Tcl_FindNamespace(interp,"@NSPACE@",NULL,TCL_NAMESPACE_ONLY); - if(!modPtr) { - modPtr = Tcl_CreateNamespace(interp, "@NSPACE@", NULL, NULL); - } -}] - } - ::practcl::cputs result " \}" - } - if {[info exists code(tclinit)]} { - ::practcl::cputs result $code(tclinit) - } - if {[info exists code(cinit)]} { - ::practcl::cputs result $code(cinit) - } - if {[info exists code(initfuncts)]} { - foreach func $code(initfuncts) { - ::practcl::cputs result " if (${func}(interp) != TCL_OK) return TCL_ERROR\;" - } - } - if {[info exists tclprocs]} { - foreach {name info} $tclprocs { - set map [list @NAME@ $name @CALLPROC@ [dict get $info callproc]] - ::practcl::cputs result [string map $map { Tcl_CreateObjCommand(interp,"@NAME@",(Tcl_ObjCmdProc *)@CALLPROC@,NULL,NULL);}] - if {[dict exists $info aliases]} { - foreach alias [dict get $info aliases] { - set map [list @NAME@ $alias @CALLPROC@ [dict get $info callproc]] - ::practcl::cputs result [string map $map { Tcl_CreateObjCommand(interp,"@NAME@",(Tcl_ObjCmdProc *)@CALLPROC@,NULL,NULL);}] - } - } - } - } - - if {[info exists code(nspace)]} { - ::practcl::cputs result " \{\n Tcl_Namespace *modPtr;" - foreach nspace $code(nspace) { - ::practcl::cputs result [string map [list @NSPACE@ $nspace] { - modPtr=Tcl_FindNamespace(interp,"@NSPACE@",NULL,TCL_NAMESPACE_ONLY); - Tcl_CreateEnsemble(interp, modPtr->fullName, modPtr, TCL_ENSEMBLE_PREFIX); - Tcl_Export(interp, modPtr, "[a-z]*", 1); -}] - } - ::practcl::cputs result " \}" - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach obj [my link list product] { - # Exclude products that will generate their own C files - if {[$obj define get output_c] ne {}} { - ::practcl::cputs result [$obj generate-cinit-external] - } else { - ::practcl::cputs result [$obj generate-cinit] - } - } - return $result - } - - method c_header body { - my variable code - ::practcl::cputs code(header) $body - } - - method c_code body { - my variable code - ::practcl::cputs code(funct) $body - } - method c_function {header body} { - my variable code cfunct - foreach regexp { - {(.*) ([a-zA-Z_][a-zA-Z0-9_]*) *\((.*)\)} - {(.*) (\x2a[a-zA-Z_][a-zA-Z0-9_]*) *\((.*)\)} - } { - if {[regexp $regexp $header all keywords funcname arglist]} { - dict set cfunct $funcname header $header - dict set cfunct $funcname body $body - dict set cfunct $funcname keywords $keywords - dict set cfunct $funcname arglist $arglist - dict set cfunct $funcname public [expr {"static" ni $keywords}] - dict set cfunct $funcname export [expr {"STUB_EXPORT" in $keywords}] - - return - } - } - ::practcl::cputs code(header) "$header\;" - # Could not parse that block as a function - # append it verbatim to our c_implementation - ::practcl::cputs code(funct) "$header [list $body]" - } - - - method cmethod {name body {arginfo {}}} { - my variable methods code - foreach {f v} $arginfo { - dict set methods $name $f $v - } - dict set methods $name body "Tcl_Object thisObject = Tcl_ObjectContextObject(objectContext); /* The current connection object */ -$body" - } - - method c_tclproc_nspace nspace { - my variable code - if {![info exists code(nspace)]} { - set code(nspace) {} - } - if {$nspace ni $code(nspace)} { - lappend code(nspace) $nspace - } - } - - method c_tclproc_raw {name body {arginfo {}}} { - my variable tclprocs code - - foreach {f v} $arginfo { - dict set tclprocs $name $f $v - } - dict set tclprocs $name body $body - } - - method go {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - next - my variable methods code cstruct tclprocs - if {[info exists methods]} { - debug [self] methods [my define get cclass] - set thisclass [my define get cclass] - foreach {name info} $methods { - # Provide a callproc - if {![dict exists $info callproc]} { - set callproc [string map {____ _ ___ _ __ _} [string map {{ } _ : _} OOMethod_${thisclass}_${name}]] - dict set methods $name callproc $callproc - } else { - set callproc [dict get $info callproc] - } - if {[dict exists $info body] && ![dict exists $info header]} { - dict set methods $name header "static int ${callproc}(ClientData clientData, Tcl_Interp *interp, Tcl_ObjectContext objectContext ,int objc ,Tcl_Obj *const *objv)" - } - if {![dict exists $info methodtype]} { - set methodtype [string map {{ } _ : _} MethodType_${thisclass}_${name}] - dict set methods $name methodtype $methodtype - } - } - if {![info exists code(initfuncts)] || "${thisclass}_OO_Init" ni $code(initfuncts)} { - lappend code(initfuncts) "${thisclass}_OO_Init" - } - } - set thisnspace [my define get nspace] - - if {[info exists tclprocs]} { - debug [self] tclprocs [dict keys $tclprocs] - foreach {name info} $tclprocs { - if {![dict exists $info callproc]} { - set callproc [string map {____ _ ___ _ __ _} [string map {{ } _ : _} Tclcmd_${thisnspace}_${name}]] - dict set tclprocs $name callproc $callproc - } else { - set callproc [dict get $info callproc] - } - if {[dict exists $info body] && ![dict exists $info header]} { - dict set tclprocs $name header "static int ${callproc}(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv\[\])" - } - } - } - debug [list /[self] [self method] [self class]] - } - - # Once an object marks itself as some - # flavor of dynamic, stop trying to morph - # it into something else - method select {} {} - - - method tcltype {name argdat} { - my variable tcltype - foreach {f v} $argdat { - dict set tcltype $name $f $v - } - if {![dict exists tcltype $name cname]} { - dict set tcltype $name cname [string tolower $name]_tclobjtype - } - lappend map @NAME@ $name - set info [dict get $tcltype $name] - foreach {f v} $info { - lappend map @[string toupper $f]@ $v - } - foreach {func fpat template} { - freeproc {@Name@Obj_freeIntRepProc} {void @FNAME@(Tcl_Obj *objPtr)} - dupproc {@Name@Obj_dupIntRepProc} {void @FNAME@(Tcl_Obj *srcPtr,Tcl_Obj *dupPtr)} - updatestringproc {@Name@Obj_updateStringRepProc} {void @FNAME@(Tcl_Obj *objPtr)} - setfromanyproc {@Name@Obj_setFromAnyProc} {int @FNAME@(Tcl_Interp *interp,Tcl_Obj *objPtr)} - } { - if {![dict exists $info $func]} { - error "$name does not define $func" - } - set body [dict get $info $func] - # We were given a function name to call - if {[llength $body] eq 1} continue - set fname [string map [list @Name@ [string totitle $name]] $fpat] - my c_function [string map [list @FNAME@ $fname] $template] [string map $map $body] - dict set tcltype $name $func $fname - } - } -} - -::oo::class create ::practcl::cheader { - superclass ::practcl::product - - method compile-products {} {} - method generate-cinit {} {} -} - -::oo::class create ::practcl::csource { - superclass ::practcl::product -} - -::oo::class create ::practcl::clibrary { - superclass ::practcl::product - - method linker-products {configdict} { - return [my define get filename] - } - -} - -### -# In the end, all C code must be loaded into a module -# This will either be a dynamically loaded library implementing -# a tcl extension, or a compiled in segment of a custom shell/app -### -::oo::class create ::practcl::module { - superclass ::practcl::dynamic - - method child which { - switch $which { - organs { - return [list project [my define get project] module [self]] - } - } - } - - method initialize {} { - set filename [my define get filename] - if {$filename eq {}} { - return - } - if {[my define get name] eq {}} { - my define set name [file tail [file dirname $filename]] - } - if {[my define get localpath] eq {}} { - my define set localpath [my define get name]_[my define get name] - } - debug [self] SOURCE $filename - my source $filename - } - - method implement path { - my go - my Collate_Source $path - foreach item [my link list dynamic] { - if {[catch {$item implement $path} err]} { - puts "Skipped $item: $err" - } - } - foreach item [my link list module] { - if {[catch {$item implement $path} err]} { - puts "Skipped $item: $err" - } - } - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set filename [my define get output_c] - if {$filename eq {}} { - debug [list /[self] [self method] [self class]] - return - } - set cout [open [file join $path [file rootname $filename].c] w] - puts $cout [subst {/* -** This file is generated by the [info script] script -** any changes will be overwritten the next time it is run -*/}] - puts $cout [my generate-c] - puts $cout [my generate-loader] - close $cout - debug [list /[self] [self method] [self class]] - } - - method linktype {} { - return {subordinate product dynamic module} - } -} - -::oo::class create ::practcl::autoconf { - - ### - # find or fake a key/value list describing this project - ### - method config.sh {} { - my variable conf_result - if {[info exists conf_result]} { - return $conf_result - } - set result {} - set name [my define get name] - set PWD $::CWD - set builddir [my define get builddir] - my unpack - set srcroot [my define get srcroot] - if {![file exists $builddir]} { - my Configure - } - set filename [file join $builddir config.tcl] - # Project uses the practcl template. Use the leavings from autoconf - if {[file exists $filename]} { - set dat [::practcl::config.tcl $builddir] - foreach {item value} [lsort -stride 2 -dictionary $dat] { - dict set result $item $value - } - set conf_result $result - return $result - } - set filename [file join $builddir ${name}Config.sh] - if {[file exists $filename]} { - set l [expr {[string length $name]+1}] - foreach {field dat} [::practcl::read_Config.sh $filename] { - set field [string tolower $field] - if {[string match ${name}_* $field]} { - set field [string range $field $l end] - } - dict set result $field $dat - } - set conf_result $result - return $result - } - ### - # Oh man... we have to guess - ### - set filename [file join $builddir Makefile] - if {![file exists $filename]} { - error "Could not locate any configuration data in $srcroot" - } - foreach {field dat} [::practcl::read_Makefile $filename] { - dict set result $field $dat - } - set conf_result $result - cd $PWD - return $result - } -} - - -::oo::class create ::practcl::project { - superclass ::practcl::module ::practcl::autoconf - - constructor args { - my variable define - if {[llength $args] == 1} { - if {[catch {uplevel 1 [list subst [lindex $args 0]]} contents]} { - set contents [lindex $args 0] - } - } else { - if {[catch {uplevel 1 [list subst $args]} contents]} { - set contents $args - } - } - array set define $contents - my select - my initialize - } - - - method add_project {pkg info {oodefine {}}} { - set os [my define get os] - if {$os eq {}} { - set os [::practcl::os] - my define set os $os - } - set fossilinfo [list download [my define get download] tag trunk sandbox [my define get sandbox]] - if {[dict exists $info os] && ($os ni [dict get $info os])} return - # Select which tag to use here. - # For production builds: tag-release - if {[::info exists ::env(FOSSIL_MIRROR)]} { - dict set info localmirror $::env(FOSSIL_MIRROR) - } - set profile [my define get profile release]: - if {[dict exists $info profile $profile]} { - dict set info tag [dict get $info profile $profile] - } - set obj [namespace current]::PROJECT.$pkg - if {[info command $obj] eq {}} { - set obj [::practcl::subproject create $obj [self] [dict merge $fossilinfo [list name $pkg pkg_name $pkg static 0] $info]] - } - my link object $obj - oo::objdefine $obj $oodefine - $obj define set masterpath $::CWD - $obj go - return $obj - } - - method child which { - switch $which { - organs { - # A library can be a project, it can be a module. Any - # subordinate modules will indicate their existance - return [list project [self] module [self]] - } - } - } - - method linktype {} { - return project - } - - # Exercise the methods of a sub-object - method project {pkg args} { - set obj [namespace current]::PROJECT.$pkg - if {[llength $args]==0} { - return $obj - } - tailcall ${obj} {*}$args - } -} - -::oo::class create ::practcl::library { - superclass ::practcl::project - - method compile-products {} { - set result {} - foreach item [my link list subordinate] { - lappend result {*}[$item compile-products] - } - set filename [my define get output_c] - if {$filename ne {}} { - set ofile [file rootname [file tail $filename]]_main.o - lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]]] - } - return $result - } - - method generate-tcl-loader {} { - set result {} - set PKGINIT [my define get pkginit] - set PKG_NAME [my define get name [my define get pkg_name]] - set PKG_VERSION [my define get pkg_vers [my define get version]] - if {[string is true [my define get SHARED_BUILD 0]]} { - set LIBFILE [my define get libfile] - ::practcl::cputs result [string map \ - [list @LIBFILE@ $LIBFILE @PKGINIT@ $PKGINIT @PKG_NAME@ $PKG_NAME @PKG_VERSION@ $PKG_VERSION] { -# Shared Library Style -load [file join [file dirname [file join [pwd] [info script]]] @LIBFILE@] @PKGINIT@ -package provide @PKG_NAME@ @PKG_VERSION@ -}] - } else { - ::practcl::cputs result [string map \ - [list @PKGINIT@ $PKGINIT @PKG_NAME@ $PKG_NAME @PKG_VERSION@ $PKG_VERSION] { -# Tclkit Style -load {} @PKGINIT@ -package provide @PKG_NAME@ @PKG_VERSION@ -}] - } - return $result - } - - method go {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set name [my define getnull name] - if {$name eq {}} { - set name generic - my define name generic - } - if {[my define get tk] eq {@TEA_TK_EXTENSION@}} { - my define set tk 0 - } - set output_c [my define getnull output_c] - if {$output_c eq {}} { - set output_c [file rootname $name].c - my define set output_c $output_c - } - set output_h [my define getnull output_h] - if {$output_h eq {}} { - set output_h [file rootname $output_c].h - my define set output_h $output_h - } - set output_tcl [my define getnull output_tcl] - #if {$output_tcl eq {}} { - # set output_tcl [file rootname $output_c].tcl - # my define set output_tcl $output_tcl - #} - #set output_mk [my define getnull output_mk] - #if {$output_mk eq {}} { - # set output_mk [file rootname $output_c].mk - # my define set output_mk $output_mk - #} - set initfunc [my define getnull initfunc] - if {$initfunc eq {}} { - set initfunc [string totitle $name]_Init - my define set initfunc $initfunc - } - set output_decls [my define getnull output_decls] - if {$output_decls eq {}} { - set output_decls [file rootname $output_c].decls - my define set output_decls $output_decls - } - my variable links - foreach {linktype objs} [array get links] { - foreach obj $objs { - $obj go - } - } - debug [list /[self] [self method] [self class] -- [my define get filename] [info object class [self]]] - } - - method implement path { - my go - my Collate_Source $path - foreach item [my link list dynamic] { - if {[catch {$item implement $path} err]} { - puts "Skipped $item: $err" - } - } - foreach item [my link list module] { - if {[catch {$item implement $path} err]} { - puts "Skipped $item: $err" - } - } - set cout [open [file join $path [my define get output_c]] w] - puts $cout [subst {/* -** This file is generated by the [info script] script -** any changes will be overwritten the next time it is run -*/}] - puts $cout [my generate-c] - puts $cout [my generate-loader] - close $cout - - set macro HAVE_[string toupper [file rootname [my define get output_h]]]_H - set hout [open [file join $path [my define get output_h]] w] - puts $hout [subst {/* -** This file is generated by the [info script] script -** any changes will be overwritten the next time it is run -*/}] - puts $hout "#ifndef ${macro}" - puts $hout "#define ${macro}" - puts $hout [my generate-h] - puts $hout "#endif" - close $hout - - set output_tcl [my define get output_tcl] - if {$output_tcl ne {}} { - set tclout [open [file join $path [my define get output_tcl]] w] - puts $tclout "### -# This file is generated by the [info script] script -# any changes will be overwritten the next time it is run -###" - puts $tclout [my generate-tcl] - puts $tclout [my generate-tcl-loader] - close $tclout - } - } - - method generate-decls {pkgname path} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set outfile [file join $path/$pkgname.decls] - - ### - # Build the decls file - ### - set fout [open $outfile w] - puts $fout [subst {### - # $outfile - # - # This file was generated by [info script] - ### - - library $pkgname - interface $pkgname - }] - - ### - # Generate list of functions - ### - set stubfuncts [my generate-stub-function] - set thisline {} - set functcount 0 - foreach {func header} $stubfuncts { - puts $fout [list declare [incr functcount] $header] - } - puts $fout [list export "int [my define get initfunc](Tcl_Inter *interp)"] - puts $fout [list export "char *[string totitle [my define get name]]_InitStubs(Tcl_Inter *interp, char *version, int exact)"] - - close $fout - - ### - # Build [package]Decls.h - ### - set hout [open [file join $path ${pkgname}Decls.h] w] - - close $hout - - set cout [open [file join $path ${pkgname}StubInit.c] w] -puts $cout [string map [list %pkgname% $pkgname %PkgName% [string totitle $pkgname]] { -#ifndef USE_TCL_STUBS -#define USE_TCL_STUBS -#endif -#undef USE_TCL_STUB_PROCS - -#include "tcl.h" -#include "%pkgname%.h" - - /* - ** Ensure that Tdom_InitStubs is built as an exported symbol. The other stub - ** functions should be built as non-exported symbols. - */ - -#undef TCL_STORAGE_CLASS -#define TCL_STORAGE_CLASS DLLEXPORT - -%PkgName%Stubs *%pkgname%StubsPtr; - - /* - **---------------------------------------------------------------------- - ** - ** %PkgName%_InitStubs -- - ** - ** Checks that the correct version of %PkgName% is loaded and that it - ** supports stubs. It then initialises the stub table pointers. - ** - ** Results: - ** The actual version of %PkgName% that satisfies the request, or - ** NULL to indicate that an error occurred. - ** - ** Side effects: - ** Sets the stub table pointers. - ** - **---------------------------------------------------------------------- - */ - -char * -%PkgName%_InitStubs (Tcl_Interp *interp, char *version, int exact) -{ - char *actualVersion; - actualVersion = Tcl_PkgRequireEx(interp, "%pkgname%", version, exact,(ClientData *) &%pkgname%StubsPtr); - if (!actualVersion) { - return NULL; - } - if (!%pkgname%StubsPtr) { - Tcl_SetResult(interp,"This implementation of %PkgName% does not support stubs",TCL_STATIC); - return NULL; - } - return actualVersion; -} -}] - close $cout - } - - # Backward compadible call - method generate-make path { - ::practcl::build::Makefile $path [self] - } - - method install-headers {} { - set result {} - return $result - } - - method linktype {} { - return library - } - - # Create a "package ifneeded" - # Args are a list of aliases for which this package will answer to - method package-ifneeded {args} { - set result {} - set name [my define get pkg_name [my define get name]] - set version [my define get pkg_vers [my define get version]] - if {$version eq {}} { - set version 0.1a - } - set output_tcl [my define get output_tcl] - if {$output_tcl ne {}} { - set script "\[list source \[file join \$dir $output_tcl\]\]" - } elseif {[string is true -strict [my define get SHARED_BUILD]]} { - set script "\[list load \[file join \$dir [my define get libfile]\] $name\]" - } else { - # Provide a null passthrough - set script [list package provide $name $version] - } - set result "package ifneeded [list $name] [list $version] $script" - foreach alias $args { - set script "package require $name $version \; package provide $alias $version" - append result \n\n [list package ifneeded $alias $version $script] - } - return $result - } - - - method shared_library {} { - set name [string tolower [my define get name [my define get pkg_name]]] - set NAME [string toupper $name] - set version [my define get version [my define get pkg_vers]] - set map {} - lappend map %LIBRARY_NAME% $name - lappend map %LIBRARY_VERSION% $version - lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} $version] - lappend map %LIBRARY_PREFIX% [my define getnull libprefix] - set outfile [string map $map [my define get PRACTCL_NAME_LIBRARY]][my define get SHLIB_SUFFIX] - return $outfile - } -} - -::oo::class create ::practcl::tclkit { - superclass ::practcl::library - - method Collate_Source CWD { - my define set SHARED_BUILD 0 - set name [my define get name] - - if {![my define exists TCL_LOCAL_APPINIT]} { - my define set TCL_LOCAL_APPINIT Tclkit_AppInit - } - if {![my define exists TCL_LOCAL_MAIN_HOOK]} { - my define set TCL_LOCAL_MAIN_HOOK Tclkit_MainHook - } - - set PROJECT [self] - set os [$PROJECT define get os] - set TCLOBJ [$PROJECT project TCLCORE] - set TKOBJ [$PROJECT project TKCORE] - set ODIEOBJ [$PROJECT project odie] - - set TCLSRCDIR [$TCLOBJ define get srcroot] - set TKSRCDIR [$TKOBJ define get srcroot] - set PKG_OBJS {} - foreach item [$PROJECT link list package] { - if {[string is true [$item define get static]]} { - lappend PKG_OBJS $item - } - } - # Arrange to build an main.c that utilizes TCL_LOCAL_APPINIT and TCL_LOCAL_MAIN_HOOK - if {$os eq "windows"} { - set PLATFORM_SRC_DIR win - my add class csource filename [file join $TCLSRCDIR win tclWinReg.c] initfunc Registry_Init pkg_name registry pkg_vers 1.3.1 autoload 1 - my add class csource filename [file join $TCLSRCDIR win tclWinDde.c] initfunc Dde_Init pkg_name dde pkg_vers 1.4.0 autoload 1 - my add class csource ofile [my define get name]_appinit.o filename [file join $TCLSRCDIR win tclAppInit.c] extra [list -DTCL_LOCAL_MAIN_HOOK=[my define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] -DTCL_LOCAL_APPINIT=[my define get TCL_LOCAL_APPINIT Tclkit_AppInit]] - } else { - set PLATFORM_SRC_DIR unix - my add class csource ofile [my define get name]_appinit.o filename [file join $TCLSRCDIR unix tclAppInit.c] extra [list -DTCL_LOCAL_MAIN_HOOK=[my define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] -DTCL_LOCAL_APPINIT=[my define get TCL_LOCAL_APPINIT Tclkit_AppInit]] - } - ### - # Add local static Zlib implementation - ### - set cdir [file join $TCLSRCDIR compat zlib] - foreach file { - adler32.c compress.c crc32.c - deflate.c infback.c inffast.c - inflate.c inftrees.c trees.c - uncompr.c zutil.c - } { - my add [file join $cdir $file] - } - - ### - # Pre 8.7, Tcl doesn't include a Zipfs implementation - # in the core. Grab the one from odielib - ### - set zipfs [file join $TCLSRCDIR generic zvfs.c] - if {![file exists $zipfs]} { - # The Odie project maintains a mirror of the version - # released with the Tcl core - my add_project odie { - tag trunk - class subproject - vfsinstall 0 - } - my project odie unpack - set ODIESRCROOT [my project odie define get srcroot] - set cdir [file join $ODIESRCROOT compat zipfs] - my define add include_dir $cdir - set zipfs [file join $cdir zvfs.c] - } - - my add class csource filename $zipfs initfunc Tclzipfs_Init pkg_name zipfs pkg_vers 1.0 autoload 1 - - my define add include_dir [file join $TKSRCDIR generic] - my define add include_dir [file join $TKSRCDIR $PLATFORM_SRC_DIR] - my define add include_dir [file join $TKSRCDIR bitmaps] - my define add include_dir [file join $TKSRCDIR xlib] - my define add include_dir [file join $TCLSRCDIR generic] - my define add include_dir [file join $TCLSRCDIR $PLATFORM_SRC_DIR] - my define add include_dir [file join $TCLSRCDIR compat zlib] - # This file will implement TCL_LOCAL_APPINIT and TCL_LOCAL_MAIN_HOOK - ::practcl::build::tclkit_main $PROJECT $PKG_OBJS - } - - ## Wrap an executable - # - method wrap {PWD exename vfspath args} { - cd $PWD - if {![file exists $vfspath]} { - file mkdir $vfspath - } - foreach item [my link list core.library] { - set name [$item define get name] - set libsrcroot [$item define get srcroot] - if {[file exists [file join $libsrcroot library]]} { - ::practcl::copyDir [file join $libsrcroot library] [file join $vfspath boot $name] - } - } - if {[my define get installdir] ne {}} { - ::practcl::copyDir [file join [my define get installdir] [string trimleft [my define get prefix] /] lib] [file join $vfspath lib] - } - foreach arg $args { - ::practcl::copyDir $arg $vfspath - } - - set fout [open [file join $vfspath packages.tcl] w] - puts $fout { - set ::PKGIDXFILE [info script] - set dir [file dirname $::PKGIDXFILE] - } - #set BASEVFS [my define get BASEVFS] - set EXEEXT [my define get EXEEXT] - - set tclkit_bare [my define get tclkit_bare] - - set buffer [::practcl::pkgindex_path $vfspath] - puts $fout $buffer - puts $fout { - # Advertise statically linked packages - foreach {pkg script} [array get ::kitpkg] { - eval $script - } - } - close $fout - package require zipfile::mkzip - ::zipfile::mkzip::mkzip ${exename}${EXEEXT} -runtime $tclkit_bare -directory $vfspath - if { [my define get platform] ne "windows" } { - file attributes ${exename}${EXEEXT} -permissions a+x - } - } -} - -### -# Meta repository -# The default is an inert source code block -### -oo::class create ::practcl::subproject { - superclass ::practcl::object - - method compile {} {} - - method go {} { - set platform [my define get platform] - my define get USEMSVC [my define get USEMSVC] - set name [my define get name] - if {![my define exists srcroot]} { - my define set srcroot [file join [my define get sandbox] $name] - } - set srcroot [my define get srcroot] - my define set localsrcdir $srcroot - my define add include_dir [file join $srcroot generic] - my sources - } - - # Install project into the local build system - method install-local {} { - my unpack - } - - # Install project into the virtual file system - method install-vfs {} {} - - method linktype {} { - return {subordinate package} - } - - method linker-products {configdict} {} - - method linker-external {configdict} { - if {[dict exists $configdict PRACTCL_LIBS]} { - return [dict get $configdict PRACTCL_LIBS] - } - } - - method sources {} {} - - method unpack {} { - set name [my define get name] - puts [list $name [self] UNPACK] - my define set [::practcl::fossil_sandbox $name [my define dump]] - } - - method update {} { - set name [my define get name] - my define set [::practcl::fossil_sandbox $name [dict merge [my define dump] {update 1}]] - } -} - -### -# A project which the kit compiles and integrates -# the source for itself -### -oo::class create ::practcl::subproject.source { - superclass ::practcl::subproject ::practcl::library - - method linktype {} { - return {subordinate package source} - } - -} - -# a copy from the teapot -oo::class create ::practcl::subproject.teapot { - superclass ::practcl::subproject - - method install-local {} { - my install-vfs - } - - method install-vfs {} { - set pkg [my define get pkg_name [my define get name]] - set download [my define get download] - my unpack - set DEST [my define get installdir] - set prefix [string trimleft [my define get prefix] /] - # Get tcllib from our destination - set dir [file join $DEST $prefix lib tcllib] - source [file join $DEST $prefix lib tcllib pkgIndex.tcl] - package require zipfile::decode - ::zipfile::decode::unzipfile [file join $download $pkg.zip] [file join $DEST $prefix lib $pkg] - } -} - -oo::class create ::practcl::subproject.sak { - superclass ::practcl::subproject - - method install-local {} { - my install-vfs - } - - method install-vfs {} { - ### - # Handle teapot installs - ### - set pkg [my define get pkg_name [my define get name]] - my unpack - set DEST [my define get installdir] - set prefix [string trimleft [my define get prefix] /] - set srcroot [my define get srcroot] - ::dotclexec [file join $srcroot installer.tcl] \ - -pkg-path [file join $DEST $prefix lib $pkg] \ - -no-examples -no-html -no-nroff \ - -no-wait -no-gui -no-apps - } -} - -### -# A binary package -### -oo::class create ::practcl::subproject.binary { - superclass ::practcl::subproject ::practcl::autoconf - - - method compile-products {} {} - - method ConfigureOpts {} { - set opts {} - set builddir [my define get builddir] - if {[my define get broken_destroot 0]} { - set PREFIX [my define get prefix_broken_destdir] - } else { - set PREFIX [my define get prefix] - } - if {[my define get HOST] != [my define get TARGET]} { - lappend opts --host=[my define get TARGET] - } - if {[my define exists tclsrcdir]} { - set TCLSRCDIR [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tclsrcdir]]]] - set TCLGENERIC [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tclsrcdir] .. generic]]] - lappend opts --with-tcl=$TCLSRCDIR --with-tclinclude=$TCLGENERIC - } - if {[my define exists tksrcdir]} { - set TKSRCDIR [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tksrcdir]]]] - set TKGENERIC [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tksrcdir] .. generic]]] - lappend opts --with-tk=$TKSRCDIR --with-tkinclude=$TKGENERIC - } - lappend opts {*}[my define get config_opts] - lappend opts --prefix=$PREFIX - #--exec_prefix=$PREFIX - #if {$::tcl_platform(platform) eq "windows"} { - # lappend opts --disable-64bit - #} - if {[my define get static 1]} { - lappend opts --disable-shared --disable-stubs - # - } else { - lappend opts --enable-shared - } - return $opts - } - - method go {} { - next - my define set builddir [my BuildDir [my define get masterpath]] - } - - method linker-products {configdict} { - if {![my define get static 0]} { - return {} - } - set srcdir [my define get builddir] - if {[dict exists $configdict libfile]} { - return " [file join $srcdir [dict get $configdict libfile]]" - } - } - - method static-packages {} { - if {![my define get static 0]} { - return {} - } - set result [my define get static_packages] - set statpkg [my define get static_pkg] - set initfunc [my define get initfunc] - if {$initfunc ne {}} { - set pkg_name [my define get pkg_name] - if {$pkg_name ne {}} { - dict set result $pkg_name initfunc $initfunc - set version [my define get version] - if {$version eq {}} { - set info [my config.sh] - set version [dict get $info version] - set pl {} - if {[dict exists $info patch_level]} { - set pl [dict get $info patch_level] - append version $pl - } - my define set version $version - } - dict set result $pkg_name version $version - dict set result $pkg_name autoload [my define get autoload 0] - } - } - foreach item [my link list subordinate] { - foreach {pkg info} [$item static-packages] { - dict set result $pkg $info - } - } - return $result - } - - method BuildDir {PWD} { - set name [my define get name] - return [my define get builddir [file join $PWD pkg.$name]] - } - - method compile {} { - set name [my define get name] - set PWD $::CWD - cd $PWD - my go - set srcroot [file normalize [my define get srcroot]] - my Collate_Source $PWD - - ### - # Build a starter VFS for both Tcl and wish - ### - set srcroot [my define get srcroot] - if {[my define get static 1]} { - puts "BUILDING Static $name $srcroot" - } else { - puts "BUILDING Dynamic $name $srcroot" - } - if {[my define get USEMSVC 0]} { - cd $srcroot - doexec nmake -f makefile.vc INSTALLDIR=[my define get installdir] release - } else { - cd $::CWD - set builddir [file normalize [my define get builddir]] - file mkdir $builddir - if {![file exists [file join $builddir Makefile]]} { - my Configure - } - if {[file exists [file join $builddir make.tcl]]} { - domake.tcl $builddir library - } else { - domake $builddir all - } - } - cd $PWD - } - - - method Configure {} { - cd $::CWD - my unpack - my TeaConfig - set builddir [file normalize [my define get builddir]] - file mkdir $builddir - set srcroot [file normalize [my define get srcroot]] - if {[my define get USEMSVC 0]} { - return - } - set opts [my ConfigureOpts] - puts [list [self] CONFIGURE] - puts [list PWD [pwd]] - puts [list LOCALSRC $srcroot] - puts [list BUILDDIR $builddir] - puts [list CONFIGURE {*}$opts] - cd $builddir - exec sh [file join $srcroot configure] {*}$opts >& [file join $builddir practcl.log] - cd $::CWD - } - - method install-vfs {} { - set PWD [pwd] - set PKGROOT [my define get installdir] - set PREFIX [my define get prefix] - - ### - # Handle teapot installs - ### - set pkg [my define get pkg_name [my define get name]] - if {[my define get teapot] ne {}} { - set TEAPOT [my define get teapot] - set found 0 - foreach ver [my define get pkg_vers [my define get version]] { - set teapath [file join $TEAPOT $pkg$ver] - if {[file exists $teapath]} { - set dest [file join $PKGROOT [string trimleft $PREFIX /] lib [file tail $teapath]] - ::practcl::copyDir $teapath $dest - return - } - } - } - my compile - if {[my define get USEMSVC 0]} { - set srcroot [my define get srcroot] - cd $srcroot - puts "[self] VFS INSTALL $PKGROOT" - doexec nmake -f makefile.vc INSTALLDIR=$PKGROOT install - } else { - set builddir [my define get builddir] - if {[file exists [file join $builddir make.tcl]]} { - # Practcl builds can inject right to where we need them - puts "[self] VFS INSTALL $PKGROOT (Practcl)" - domake.tcl $builddir install-package $PKGROOT - } elseif {[my define get broken_destroot 0] == 0} { - # Most modern TEA projects understand DESTROOT in the makefile - puts "[self] VFS INSTALL $PKGROOT (TEA)" - domake $builddir install DESTDIR=$PKGROOT - } else { - # But some require us to do an install into a fictitious filesystem - # and then extract the gooey parts within. - # (*cough*) TkImg - set PREFIX [my define get prefix] - set BROKENROOT [::practcl::msys_to_tclpath [my define get prefix_broken_destdir]] - file delete -force $BROKENROOT - file mkdir $BROKENROOT - domake $builddir $install - ::practcl::copyDir $BROKENROOT [file join $PKGROOT [string trimleft $PREFIX /]] - file delete -force $BROKENROOT - } - } - cd $PWD - } - - method TeaConfig {} { - set srcroot [file normalize [my define get srcroot]] - set copytea 0 - if {![file exists [file join $srcroot tclconfig]]} { - set copytea 1 - } else { - if {![file exists [file join $srcroot tclconfig practcl.tcl]] || ![file exists [file join $srcroot tclconfig config.tcl.in]]} { - set copytea 1 - } - } - # ensure we have tclconfig with all of the trimming - if {$copytea} { - set tclconfiginfo [::practcl::fossil_sandbox tclconfig [list sandbox [my define get sandbox]]] - ::practcl::copyDir [dict get $tclconfiginfo srcroot] [file join $srcroot tclconfig] - if {$::tcl_platform(platform) ne "windows"} { - set pwd [pwd] - cd $srcroot - # On windows there's no practical way to execute - # autoconf. We'll have to trust that configure - # us up to date - foreach template {configure.ac configure.in} { - set input [file join $srcroot $template] - if {[file exists $input]} { - puts "autoconf -f $input > [file join $srcroot configure]" - exec autoconf -f $input > [file join $srcroot configure] - } - } - cd $pwd - } - } - } -} - -oo::class create ::practcl::subproject.core { - superclass ::practcl::subproject.binary - - # On the windows platform MinGW must build - # from the platform directory in the source repo - method BuildDir {PWD} { - return [my define get localsrcdir] - } - - method Configure {} { - if {[my define get USEMSVC 0]} { - return - } - set opts [my ConfigureOpts] - puts [list PWD [pwd]] - puts [list [self] CONFIGURE] - set builddir [file normalize [my define get builddir]] - set localsrcdir [file normalize [my define get localsrcdir]] - puts [list LOCALSRC $localsrcdir] - puts [list BUILDDIR $builddir] - puts [list CONFIGURE {*}$opts] - cd $localsrcdir - exec sh [file join $localsrcdir configure] {*}$opts >& [file join $builddir practcl.log] - } - - method ConfigureOpts {} { - set opts {} - set builddir [file normalize [my define get builddir]] - set PREFIX [my define get prefix] - if {[my define get HOST] != [my define get TARGET]} { - lappend opts --host=[my define get TARGET] - } - lappend opts {*}[my define get config_opts] - lappend opts --prefix=$PREFIX - #--exec_prefix=$PREFIX - lappend opts --disable-shared - return $opts - } - - method go {} { - set name [my define get name] - set platform [my define get platform] - if {![my define exists srcroot]} { - my define set srcroot [file join [my define get sandbox] $name] - } - set srcroot [my define get srcroot] - my define add include_dir [file join $srcroot generic] - switch $platform { - windows { - my define set localsrcdir [file join $srcroot win] - my define add include_dir [file join $srcroot win] - } - default { - my define set localsrcdir [file join $srcroot unix] - my define add include_dir [file join $srcroot $name unix] - } - } - my define set builddir [my BuildDir [my define get masterpath]] - } - - method linktype {} { - return {subordinate core.library} - } -} - -package provide practcl 0.5 + ::practcl::cputs appinit " if(${initfunc}(interp)) return TCL_ERROR\;" + ::practcl::cputs appinit " Tcl_StaticPackage(interp,\"$statpkg\",$initfunc,NULL)\;" + } else { + ::practcl::cputs appinit "\n Tcl_StaticPackage(NULL,\"$statpkg\",$initfunc,NULL)\;" + append main_init_script \n $script + } + } + append main_init_script \n { +if {[file exists [file join $::SRCDIR packages.tcl]]} { + #In a wrapped exe, we don't go out to the environment + set dir $::SRCDIR + source [file join $::SRCDIR packages.tcl] +} +# Specify a user-specific startup file to invoke if the application +# is run interactively. Typically the startup file is "~/.apprc" +# where "app" is the name of the application. If this line is deleted +# then no user-specific startup file will be run under any conditions. + } + append main_init_script \n [list set tcl_rcFileName [$PROJECT define get tcl_rcFileName ~/.tclshrc]] + practcl::cputs appinit " Tcl_Eval(interp,[::practcl::tcl_to_c $main_init_script]);" + practcl::cputs appinit { return TCL_OK;} + $PROJECT c_function [string map $map "int %mainfunc%(Tcl_Interp *interp)"] [string map $map $appinit] +} + +proc ::practcl::build::compile-sources {PROJECT COMPILE {CPPCOMPILE {}}} { + set EXTERN_OBJS {} + set OBJECTS {} + set result {} + set builddir [$PROJECT define get builddir] + file mkdir [file join $builddir objs] + set debug [$PROJECT define get debug 0] + if {$CPPCOMPILE eq {}} { + set CPPCOMPILE $COMPILE + } + set task [${PROJECT} compile-products] + ### + # Compile the C sources + ### + foreach {ofile info} $task { + dict set task $ofile done 0 + if {[dict exists $info external] && [dict get $info external]==1} { + dict set task $ofile external 1 + } else { + dict set task $ofile external 0 + } + if {[dict exists $info library]} { + dict set task $ofile done 1 + continue + } + # Products with no cfile aren't compiled + if {![dict exists $info cfile] || [set cfile [dict get $info cfile]] eq {}} { + dict set task $ofile done 1 + continue + } + set cfile [dict get $info cfile] + set ofilename [file join $builddir objs [file tail $ofile]] + if {$debug} { + set ofilename [file join $builddir objs [file rootname [file tail $ofile]].debug.o] + } + dict set task $ofile filename $ofilename + if {[file exists $ofilename] && [file mtime $ofilename]>[file mtime $cfile]} { + lappend result $ofilename + dict set task $ofile done 1 + continue + } + if {![dict exist $info command]} { + if {[file extension $cfile] in {.c++ .cpp}} { + set cmd $CPPCOMPILE + } else { + set cmd $COMPILE + } + if {[dict exists $info extra]} { + append cmd " [dict get $info extra]" + } + append cmd " -c $cfile" + append cmd " -o $ofilename" + dict set task $ofile command $cmd + } + } + set completed 0 + while {$completed==0} { + set completed 1 + foreach {ofile info} $task { + set waiting {} + if {[dict exists $info done] && [dict get $info done]} continue + if {[dict exists $info depend]} { + foreach file [dict get $info depend] { + if {[dict exists $task $file command] && [dict exists $task $file done] && [dict get $task $file done] != 1} { + set waiting $file + break + } + } + } + if {$waiting ne {}} { + set completed 0 + puts "$ofile waiting for $waiting" + continue + } + if {[dict exists $info command]} { + set cmd [dict get $info command] + puts "$cmd" + exec {*}$cmd >&@ stdout + } + lappend result [dict get $info filename] + dict set task $ofile done 1 + } + } + return $result +} + +proc ::practcl::de_shell {data} { + set values {} + foreach flag {DEFS TCL_DEFS TK_DEFS} { + if {[dict exists $data $flag]} { + set value {} + foreach item [dict get $data $flag] { + append value " " [string map {{ } {\ }} $item] + } + dict set values $flag $value + } + } + set map {} + lappend map {${PKG_OBJECTS}} %LIBRARY_OBJECTS% + lappend map {$(PKG_OBJECTS)} %LIBRARY_OBJECTS% + lappend map {${PKG_STUB_OBJECTS}} %LIBRARY_STUB_OBJECTS% + lappend map {$(PKG_STUB_OBJECTS)} %LIBRARY_STUB_OBJECTS% + + lappend map %LIBRARY_NAME% [dict get $data name] + lappend map %LIBRARY_VERSION% [dict get $data version] + lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} [dict get $data version]] + if {[dict exists $data libprefix]} { + lappend map %LIBRARY_PREFIX% [dict get $data libprefix] + } else { + lappend map %LIBRARY_PREFIX% [dict get $data prefix] + } + foreach flag [dict keys $data] { + if {$flag in {TCL_DEFS TK_DEFS DEFS}} continue + + dict set map "%${flag}%" [dict get $data $flag] + dict set map "\$\{${flag}\}" [dict get $data $flag] + dict set map "\$\(${flag}\)" [dict get $data $flag] + dict set values $flag [dict get $data $flag] + #dict set map "\$\{${flag}\}" $proj($flag) + } + set changed 1 + while {$changed} { + set changed 0 + foreach {field value} $values { + if {$field in {TCL_DEFS TK_DEFS DEFS}} continue + dict with values {} + set newval [string map $map $value] + if {$newval eq $value} continue + set changed 1 + dict set values $field $newval + } + } + return $values +} + +proc ::practcl::build::Makefile {path PROJECT} { + array set proj [$PROJECT define dump] + set path $proj(builddir) + cd $path + set includedir . + #lappend includedir [::practcl::file_relative $path $proj(TCL_INCLUDES)] + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TCL_SRC_DIR) generic]]] + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(srcdir) generic]]] + foreach include [$PROJECT generate-include-directory] { + set cpath [::practcl::file_relative $path [file normalize $include]] + if {$cpath ni $includedir} { + lappend includedir $cpath + } + } + set INCLUDES "-I[join $includedir " -I"]" + set NAME [string toupper $proj(name)] + set result {} + set products {} + set libraries {} + set thisline {} + ::practcl::cputs result "${NAME}_DEFS = $proj(DEFS)\n" + ::practcl::cputs result "${NAME}_INCLUDES = -I\"[join $includedir "\" -I\""]\"\n" + ::practcl::cputs result "${NAME}_COMPILE = \$(CC) \$(CFLAGS) \$(PKG_CFLAGS) \$(${NAME}_DEFS) \$(${NAME}_INCLUDES) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS) \$(AM_CFLAGS)" + ::practcl::cputs result "${NAME}_CPPCOMPILE = \$(CXX) \$(CFLAGS) \$(PKG_CFLAGS) \$(${NAME}_DEFS) \$(${NAME}_INCLUDES) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS) \$(AM_CFLAGS)" + + foreach {ofile info} [$PROJECT compile-products] { + dict set products $ofile $info + if {[dict exists $info library]} { +lappend libraries $ofile +continue + } + if {[dict exists $info depend]} { + ::practcl::cputs result "\n${ofile}: [dict get $info depend]" + } else { + ::practcl::cputs result "\n${ofile}:" + } + set cfile [dict get $info cfile] + if {[file extension $cfile] in {.c++ .cpp}} { + set cmd "\t\$\(${NAME}_CPPCOMPILE\)" + } else { + set cmd "\t\$\(${NAME}_COMPILE\)" + } + if {[dict exists $info extra]} { + append cmd " [dict get $info extra]" + } + append cmd " -c [dict get $info cfile] -o \$@\n\t" + ::practcl::cputs result $cmd + } + + set map {} + lappend map %LIBRARY_NAME% $proj(name) + lappend map %LIBRARY_VERSION% $proj(version) + lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} $proj(version)] + lappend map %LIBRARY_PREFIX% [$PROJECT define getnull libprefix] + + if {[string is true [$PROJECT define get SHARED_BUILD]]} { + set outfile [$PROJECT define get libfile] + } else { + set outfile [$PROJECT shared_library] + } + $PROJECT define set shared_library $outfile + ::practcl::cputs result " +${NAME}_SHLIB = $outfile +${NAME}_OBJS = [dict keys $products] +" + + #lappend map %OUTFILE% {\[$]@} + lappend map %OUTFILE% $outfile + lappend map %LIBRARY_OBJECTS% "\$(${NAME}_OBJS)" + ::practcl::cputs result "$outfile: \$(${NAME}_OBJS)" + ::practcl::cputs result "\t[string map $map [$PROJECT define get PRACTCL_SHARED_LIB]]" + if {[$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL] ni {: {}}} { + ::practcl::cputs result "\t[string map $map [$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL]]" + } + ::practcl::cputs result {} + if {[string is true [$PROJECT define get SHARED_BUILD]]} { + #set outfile [$PROJECT static_library] + set outfile $proj(name).a + } else { + set outfile [$PROJECT define get libfile] + } + $PROJECT define set static_library $outfile + dict set map %OUTFILE% $outfile + ::practcl::cputs result "$outfile: \$(${NAME}_OBJS)" + ::practcl::cputs result "\t[string map $map [$PROJECT define get PRACTCL_STATIC_LIB]]" + ::practcl::cputs result {} + return $result +} + +### +# Produce a dynamic library +### +proc ::practcl::build::library {outfile PROJECT} { + array set proj [$PROJECT define dump] + set path $proj(builddir) + cd $path + set includedir . + #lappend includedir [::practcl::file_relative $path $proj(TCL_INCLUDES)] + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TCL_SRC_DIR) generic]]] + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(srcdir) generic]]] + if {[$PROJECT define get tk 0]} { + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TK_SRC_DIR) generic]]] + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TK_SRC_DIR) ttk]]] + lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TK_SRC_DIR) xlib]]] + lappend includedir [::practcl::file_relative $path [file normalize $proj(TK_BIN_DIR)]] + } + foreach include [$PROJECT generate-include-directory] { + set cpath [::practcl::file_relative $path [file normalize $include]] + if {$cpath ni $includedir} { + lappend includedir $cpath + } + } + ::practcl::build::DEFS $PROJECT $proj(DEFS) name version defs + set NAME [string toupper $name] + set debug [$PROJECT define get debug 0] + set os [$PROJECT define get os] + + set INCLUDES "-I[join $includedir " -I"]" + if {$debug} { + set COMPILE "$proj(CC) $proj(CFLAGS_DEBUG) -ggdb \ +$proj(CFLAGS_WARNING) $INCLUDES $defs" + + if {[info exists proc(CXX)]} { + set COMPILECPP "$proj(CXX) $defs $INCLUDES $proj(CFLAGS_DEBUG) -ggdb \ + $proj(DEFS) $proj(CFLAGS_WARNING)" + } else { + set COMPILECPP $COMPILE + } + } else { + set COMPILE "$proj(CC) $proj(CFLAGS) $defs $INCLUDES " + + if {[info exists proc(CXX)]} { + set COMPILECPP "$proj(CXX) $defs $INCLUDES $proj(CFLAGS) $proj(DEFS)" + } else { + set COMPILECPP $COMPILE + } + } + + set products [compile-sources $PROJECT $COMPILE $COMPILECPP] + + set map {} + lappend map %LIBRARY_NAME% $proj(name) + lappend map %LIBRARY_VERSION% $proj(version) + lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} $proj(version)] + lappend map %OUTFILE% $outfile + lappend map %LIBRARY_OBJECTS% $products + lappend map {${CFLAGS}} "$proj(CFLAGS_DEFAULT) $proj(CFLAGS_WARNING)" + + if {[string is true [$PROJECT define get SHARED_BUILD 1]]} { + set cmd [$PROJECT define get PRACTCL_SHARED_LIB] + append cmd " [$PROJECT define get PRACTCL_LIBS]" + set cmd [string map $map $cmd] + puts $cmd + exec {*}$cmd >&@ stdout + if {[$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL] ni {: {}}} { + set cmd [string map $map [$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL]] + puts $cmd + exec {*}$cmd >&@ stdout + } + } else { + set cmd [string map $map [$PROJECT define get PRACTCL_STATIC_LIB]] + puts $cmd + exec {*}$cmd >&@ stdout + } +} + +### +# Produce a static executable +### +proc ::practcl::build::static-tclsh {outfile PROJECT} { + puts " BUILDING STATIC TCLSH " + set TCLOBJ [$PROJECT project TCLCORE] + set TKOBJ [$PROJECT project TKCORE] + set ODIEOBJ [$PROJECT project odie] + + set PKG_OBJS {} + foreach item [$PROJECT link list package] { + if {[string is true [$item define get static]]} { + lappend PKG_OBJS $item + } + } + array set TCL [$TCLOBJ config.sh] + array set TK [$TKOBJ config.sh] + set path [file dirname $outfile] + cd $path + ### + # For a static Tcl shell, we need to build all local sources + # with the same DEFS flags as the tcl core was compiled with. + # The DEFS produced by a TEA extension aren't intended to operate + # with the internals of a staticly linked Tcl + ### + ::practcl::build::DEFS $PROJECT $TCL(defs) name version defs + set debug [$PROJECT define get debug 0] + set NAME [string toupper $name] + set result {} + set libraries {} + set thisline {} + set OBJECTS {} + set EXTERN_OBJS {} + foreach obj $PKG_OBJS { + $obj compile + set config($obj) [$obj config.sh] + } + set os [$PROJECT define get os] + set TCLSRCDIR [$TCLOBJ define get srcroot] + set TKSRCDIR [$TKOBJ define get srcroot] + + set includedir . + foreach include [$TCLOBJ generate-include-directory] { + set cpath [::practcl::file_relative $path [file normalize $include]] + if {$cpath ni $includedir} { + lappend includedir $cpath + } + } + lappend includedir [::practcl::file_relative $path [file normalize ../tcl/compat/zlib]] + foreach include [$PROJECT generate-include-directory] { + set cpath [::practcl::file_relative $path [file normalize $include]] + if {$cpath ni $includedir} { + lappend includedir $cpath + } + } + + set INCLUDES "-I[join $includedir " -I"]" + if {$debug} { + set COMPILE "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_debug) -ggdb \ +$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" + } else { + set COMPILE "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_optimize) \ +$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" + } + append COMPILE " " $defs + lappend OBJECTS {*}[compile-sources $PROJECT $COMPILE $COMPILE] + + if {[${PROJECT} define get platform] eq "windows"} { + set RSOBJ [file join $path build tclkit.res.o] + set RCSRC [${PROJECT} define get kit_resource_file] + if {$RCSRC eq {} || ![file exists $RCSRC]} { + set RCSRC [file join $TKSRCDIR win rc wish.rc] + } + set cmd [list windres -o $RSOBJ -DSTATIC_BUILD] + set TCLSRC [file normalize $TCLSRCDIR] + set TKSRC [file normalize $TKSRCDIR] + + lappend cmd --include [::practcl::file_relative $path [file join $TCLSRC generic]] \ + --include [::practcl::file_relative $path [file join $TKSRC generic]] \ + --include [::practcl::file_relative $path [file join $TKSRC win]] \ + --include [::practcl::file_relative $path [file join $TKSRC win rc]] + foreach item [${PROJECT} define get resource_include] { + lappend cmd --include [::practcl::file_relative $path [file normalize $item]] + } + lappend cmd $RCSRC + doexec {*}$cmd + + lappend OBJECTS $RSOBJ + set LDFLAGS_CONSOLE {-mconsole -pipe -static-libgcc} + set LDFLAGS_WINDOW {-mwindows -pipe -static-libgcc} + } else { + set LDFLAGS_CONSOLE {} + set LDFLAGS_WINDOW {} + } + puts "***" + if {$debug} { + set cmd "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_debug) \ +$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" + } else { + set cmd "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_optimize) \ +$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" + } + append cmd " $OBJECTS" + append cmd " $EXTERN_OBJS " + # On OSX it is impossibly to generate a completely static + # executable + if {[$PROJECT define get TEACUP_OS] ne "macosx"} { + append cmd " -static " + } + parray TCL + if {$debug} { + if {$os eq "windows"} { + append cmd " -L${TCL(src_dir)}/win -ltcl86g" + append cmd " -L${TK(src_dir)}/win -ltk86g" + } else { + append cmd " -L${TCL(src_dir)}/unix -ltcl86g" + append cmd " -L${TK(src_dir)}/unix -ltk86g" + } + } else { + append cmd " $TCL(build_lib_spec) $TK(build_lib_spec)" + } + foreach obj $PKG_OBJS { + append cmd " [$obj linker-products $config($obj)]" + } + append cmd " $TCL(libs) $TK(libs)" + foreach obj $PKG_OBJS { + append cmd " [$obj linker-external $config($obj)]" + } + if {$debug} { + if {$os eq "windows"} { + append cmd " -L${TCL(src_dir)}/win ${TCL(stub_lib_flag)}" + append cmd " -L${TK(src_dir)}/win ${TK(stub_lib_flag)}" + } else { + append cmd " -L${TCL(src_dir)}/unix ${TCL(stub_lib_flag)}" + append cmd " -L${TK(src_dir)}/unix ${TK(stub_lib_flag)}" + } + } else { + append cmd " $TCL(build_stub_lib_spec)" + append cmd " $TK(build_stub_lib_spec)" + } + append cmd " -o $outfile $LDFLAGS_CONSOLE" + puts "LINK: $cmd" + exec {*}$cmd >&@ stdout +} + +::oo::class create ::practcl::target_obj { + superclass ::practcl::metaclass + + constructor {name info} { + my variable define triggered domake + set triggered 0 + set domake 0 + set define(name) $name + set data [uplevel 2 [list subst $info]] + array set define $data + my select + my initialize + } + + method do {} { + my variable domake + return $domake + } + + method check {} { + my variable needs_make domake + if {$domake} { + return 1 + } + if {[info exists needs_make]} { + return $needs_make + } + set needs_make 0 + foreach item [my define get depends] { + if {![dict exists $::make_objects $item]} continue + set depobj [dict get $::make_objects $item] + if {$depobj eq [self]} { + puts "WARNING [self] depends on itself" + continue + } + if {[$depobj check]} { + set needs_make 1 + } + } + if {!$needs_make} { + set filename [my define get filename] + if {$filename ne {} && ![file exists $filename]} { + set needs_make 1 + } + } + return $needs_make + } + + method triggers {} { + my variable triggered domake define + if {$triggered} { + return $domake + } + set triggered 1 + foreach item [my define get depends] { + puts [list $item [dict exists $::make_objects $item]] + if {![dict exists $::make_objects $item]} continue + set depobj [dict get $::make_objects $item] + if {$depobj eq [self]} { + puts "WARNING [self] triggers itself" + continue + } else { + set r [$depobj check] + puts [list $depobj check $r] + if {$r} { + puts [list $depobj TRIGGER] + $depobj triggers + } + } + } + if {[info exists ::make($define(name))] && $::make($define(name))} { + return + } + set ::make($define(name)) 1 + ::practcl::trigger {*}[my define get triggers] + } +} + + +### +# Define the metaclass +### +::oo::class create ::practcl::object { + superclass ::practcl::metaclass + + constructor {parent args} { + my variable links define + set organs [$parent child organs] + my graft {*}$organs + array set define $organs + array set define [$parent child define] + array set links {} + if {[llength $args]==1 && [file exists [lindex $args 0]]} { + my InitializeSourceFile [lindex $args 0] + } elseif {[llength $args] == 1} { + set data [uplevel 1 [list subst [lindex $args 0]]] + array set define $data + my select + my initialize + } else { + array set define [uplevel 1 [list subst $args]] + my select + my initialize + } + } + + + method include_dir args { + my define add include_dir {*}$args + } + + method include_directory args { + my define add include_dir {*}$args + } + + method Collate_Source CWD {} + + + method child {method} { + return {} + } + + method InitializeSourceFile filename { + my define set filename $filename + set class {} + switch [file extension $filename] { + .tcl { + set class ::practcl::dynamic + } + .h { + set class ::practcl::cheader + } + .c { + set class ::practcl::csource + } + .ini { + switch [file tail $filename] { + module.ini { + set class ::practcl::module + } + library.ini { + set class ::practcl::subproject + } + } + } + .so - + .dll - + .dylib - + .a { + set class ::practcl::clibrary + } + } + if {$class ne {}} { + oo::objdefine [self] class $class + my initialize + } + } + + method add args { + my variable links + set object [::practcl::object new [self] {*}$args] + foreach linktype [$object linktype] { + lappend links($linktype) $object + } + return $object + } + + method go {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable links + foreach {linktype objs} [array get links] { + foreach obj $objs { + $obj go + } + } + debug [list /[self] [self method] [self class]] + } + + method code {section body} { + my variable code + ::practcl::cputs code($section) $body + } + + method Ofile filename { + set lpath [my define get localpath] + if {$lpath eq {}} { + set lpath [my define get name] + } + return ${lpath}_[file rootname [file tail $filename]].o + } + + method compile-products {} { + set filename [my define get filename] + set result {} + if {$filename ne {}} { + if {[my define exists ofile]} { + set ofile [my define get ofile] + } else { + set ofile [my Ofile $filename] + my define set ofile $ofile + } + lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]] object [self]] + } + foreach item [my link list subordinate] { + lappend result {*}[$item compile-products] + } + return $result + } + + method generate-include-directory {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result [my define get include_dir] + foreach obj [my link list product] { + foreach path [$obj generate-include-directory] { + lappend result $path + } + } + return $result + } + + method generate-debug {{spaces {}}} { + set result {} + ::practcl::cputs result "$spaces[list [self] [list class [info object class [self]] filename [my define get filename]] links [my link list]]" + foreach item [my link list subordinate] { + practcl::cputs result [$item generate-debug "$spaces "] + } + return $result + } + + # Empty template methods + method generate-cheader {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cfunct cstruct methods tcltype tclprocs + set result {} + if {[info exists code(header)]} { + ::practcl::cputs result $code(header) + } + foreach obj [my link list product] { + # Exclude products that will generate their own C files + if {[$obj define get output_c] ne {}} continue + ::practcl::cputs result "/* BEGIN [$obj define get filename] generate-cheader */" + ::practcl::cputs result [$obj generate-cheader] + ::practcl::cputs result "/* END [$obj define get filename] generate-cheader */" + } + debug [list cfunct [info exists cfunct]] + if {[info exists cfunct]} { + foreach {funcname info} $cfunct { + if {[dict get $info public]} continue + ::practcl::cputs result "[dict get $info header]\;" + } + } + debug [list tclprocs [info exists tclprocs]] + if {[info exists tclprocs]} { + foreach {name info} $tclprocs { + if {[dict exists $info header]} { + ::practcl::cputs result "[dict get $info header]\;" + } + } + } + debug [list methods [info exists methods] [my define get cclass]] + + if {[info exists methods]} { + set thisclass [my define get cclass] + foreach {name info} $methods { + if {[dict exists $info header]} { + ::practcl::cputs result "[dict get $info header]\;" + } + } + # Add the initializer wrapper for the class + ::practcl::cputs result "static int ${thisclass}_OO_Init(Tcl_Interp *interp)\;" + } + return $result + } + + method generate-public-define {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code + set result {} + if {[info exists code(public-define)]} { + ::practcl::cputs result $code(public-define) + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-public-define] + } + return $result + } + + method generate-public-macro {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code + set result {} + if {[info exists code(public-macro)]} { + ::practcl::cputs result $code(public-macro) + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-public-macro] + } + return $result + } + + method generate-public-typedef {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cstruct + set result {} + if {[info exists code(public-typedef)]} { + ::practcl::cputs result $code(public-typedef) + } + if {[info exists cstruct]} { + # Add defintion for native c data structures + foreach {name info} $cstruct { + ::practcl::cputs result "typedef struct $name ${name}\;" + if {[dict exists $info aliases]} { + foreach n [dict get $info aliases] { + ::practcl::cputs result "typedef struct $name ${n}\;" + } + } + } + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-public-typedef] + } + return $result + } + + method generate-public-structure {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cstruct + set result {} + if {[info exists code(public-structure)]} { + ::practcl::cputs result $code(public-structure) + } + if {[info exists cstruct]} { + foreach {name info} $cstruct { + if {[dict exists $info comment]} { + ::practcl::cputs result [dict get $info comment] + } + ::practcl::cputs result "struct $name \{[dict get $info body]\}\;" + } + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-public-structure] + } + return $result + } + method generate-public-headers {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code tcltype + set result {} + if {[info exists code(public-header)]} { + ::practcl::cputs result $code(public-header) + } + if {[info exists tcltype]} { + foreach {type info} $tcltype { + if {![dict exists $info cname]} { + set cname [string tolower ${type}]_tclobjtype + dict set tcltype $type cname $cname + } else { + set cname [dict get $info cname] + } + ::practcl::cputs result "extern const Tcl_ObjType $cname\;" + } + } + if {[info exists code(public)]} { + ::practcl::cputs result $code(public) + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-public-headers] + } + return $result + } + + method generate-stub-function {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cfunct tcltype + set result {} + foreach mod [my link list product] { + foreach {funct def} [$mod generate-stub-function] { + dict set result $funct $def + } + } + if {[info exists cfunct]} { + foreach {funcname info} $cfunct { + if {![dict get $info export]} continue + dict set result $funcname [dict get $info header] + } + } + return $result + } + + method generate-public-function {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cfunct tcltype + set result {} + + if {[my define get initfunc] ne {}} { + ::practcl::cputs result "int [my define get initfunc](Tcl_Interp *interp);" + } + if {[info exists cfunct]} { + foreach {funcname info} $cfunct { + if {![dict get $info public]} continue + ::practcl::cputs result "[dict get $info header]\;" + } + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-public-function] + } + return $result + } + + method generate-public-includes {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set includes {} + foreach item [my define get public-include] { + if {$item ni $includes} { + lappend includes $item + } + } + foreach mod [my link list product] { + foreach item [$mod generate-public-includes] { + if {$item ni $includes} { + lappend includes $item + } + } + } + return $includes + } + method generate-public-verbatim {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set includes {} + foreach item [my define get public-verbatim] { + if {$item ni $includes} { + lappend includes $item + } + } + foreach mod [my link list subordinate] { + foreach item [$mod generate-public-verbatim] { + if {$item ni $includes} { + lappend includes $item + } + } + } + return $includes + } + ### + # This methods generates the contents of an amalgamated .h file + # which describes the public API of this module + ### + method generate-h {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result {} + set includes [my generate-public-includes] + foreach inc $includes { + if {[string index $inc 0] ni {< \"}} { + ::practcl::cputs result "#include \"$inc\"" + } else { + ::practcl::cputs result "#include $inc" + } + } + foreach file [my generate-public-verbatim] { + ::practcl::cputs result "/* BEGIN $file */" + ::practcl::cputs result [::practcl::cat $file] + ::practcl::cputs result "/* END $file */" + } + foreach method { + generate-public-define + generate-public-macro + generate-public-typedef + generate-public-structure + generate-public-headers + generate-public-function + } { + ::practcl::cputs result "/* BEGIN SECTION $method */" + ::practcl::cputs result [my $method] + ::practcl::cputs result "/* END SECTION $method */" + } + return $result + } + + ### + # This methods generates the contents of an amalgamated .c file + # which implements the loader for a batch of tools + ### + method generate-c {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result { +/* This file was generated by practcl */ + } + set includes {} + lappend headers + if {[my define get tk 0]} { + lappend headers + } + lappend headers {*}[my define get include] + if {[my define get output_h] ne {}} { + lappend headers "\"[my define get output_h]\"" + } + foreach mod [my link list product] { + # Signal modules to formulate final implementation + $mod go + } + foreach mod [my link list dynamic] { + foreach inc [$mod define get include] { + if {$inc ni $headers} { + lappend headers $inc + } + } + } + foreach inc $headers { + if {[string index $inc 0] ni {< \"}} { + ::practcl::cputs result "#include \"$inc\"" + } else { + ::practcl::cputs result "#include $inc" + } + } + foreach {method} { + generate-cheader + generate-cstruct + generate-constant + generate-cfunct + generate-cmethod + } { + ::practcl::cputs result "/* BEGIN $method [my define get filename] */" + ::practcl::cputs result [my $method] + ::practcl::cputs result "/* END $method [my define get filename] */" + } + debug [list /[self] [self method] [self class] -- [my define get filename] [info object class [self]]] + return $result + } + + + method generate-loader {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result {} + if {[my define get initfunc] eq {}} return + ::practcl::cputs result " +extern int DLLEXPORT [my define get initfunc]( Tcl_Interp *interp ) \{" + ::practcl::cputs result { + /* Initialise the stubs tables. */ + #ifdef USE_TCL_STUBS + if (Tcl_InitStubs(interp, "8.6", 0)==NULL) return TCL_ERROR; + if (TclOOInitializeStubs(interp, "1.0") == NULL) return TCL_ERROR; +} + if {[my define get tk 0]} { + ::practcl::cputs result { if (Tk_InitStubs(interp, "8.6", 0)==NULL) return TCL_ERROR;} + } + ::practcl::cputs result { #endif} + set TCLINIT [my generate-tcl] + ::practcl::cputs result " if(Tcl_Eval(interp,[::practcl::tcl_to_c $TCLINIT])) return TCL_ERROR ;" + foreach item [my link list product] { + if {[$item define get output_c] ne {}} { + ::practcl::cputs result [$item generate-cinit-external] + } else { + ::practcl::cputs result [$item generate-cinit] + } + } + if {[my define exists pkg_name]} { + ::practcl::cputs result " if (Tcl_PkgProvide(interp, \"[my define get pkg_name [my define get name]]\" , \"[my define get pkg_vers [my define get version]]\" )) return TCL_ERROR\;" + } + ::practcl::cputs result " return TCL_OK\;\n\}\n" + return $result + } + + ### + # This methods generates any Tcl script file + # which is required to pre-initialize the C library + ### + method generate-tcl {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result {} + my variable code + if {[info exists code(tcl)]} { + ::practcl::cputs result $code(tcl) + } + set result [::practcl::_tagblock $result tcl [my define get filename]] + foreach mod [my link list product] { + ::practcl::cputs result [$mod generate-tcl] + } + return $result + } + + method static-packages {} { + set result [my define get static_packages] + set statpkg [my define get static_pkg] + set initfunc [my define get initfunc] + if {$initfunc ne {}} { + set pkg_name [my define get pkg_name] + if {$pkg_name ne {}} { + dict set result $pkg_name initfunc $initfunc + dict set result $pkg_name version [my define get version [my define get pkg_vers]] + dict set result $pkg_name autoload [my define get autoload 0] + } + } + foreach item [my link list subordinate] { + foreach {pkg info} [$item static-packages] { + dict set result $pkg $info + } + } + return $result + } + + method target {method args} { + switch $method { + is_unix { return [expr {$::tcl_platform(platform) eq "unix"}] } + } + } + +} + +::oo::class create ::practcl::product { + superclass ::practcl::object + + method linktype {} { + return {subordinate product} + } + + method include header { + my define add include $header + } + + method cstructure {name definition {argdat {}}} { + my variable cstruct + dict set cstruct $name body $definition + foreach {f v} $argdat { + dict set cstruct $name $f $v + } + } + + method generate-cinit {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code + set result {} + if {[info exists code(cinit)]} { + ::practcl::cputs result $code(cinit) + } + if {[my define get initfunc] ne {}} { + ::practcl::cputs result " if([my define get initfunc](interp)!=TCL_OK) return TCL_ERROR\;" + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach obj [my link list product] { + ::practcl::cputs result [$obj generate-cinit] + } + return $result + } +} + +### +# Dynamic blocks do not generate their own .c files, +# instead the contribute to the amalgamation +# of the main library file +### +::oo::class create ::practcl::dynamic { + superclass ::practcl::product + + # Retrieve any additional source files required + + method compile-products {} { + set filename [my define get output_c] + set result {} + if {$filename ne {}} { + if {[my define exists ofile]} { + set ofile [my define get ofile] + } else { + set ofile [my Ofile $filename] + my define set ofile $ofile + } + lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]]] + } else { + set filename [my define get cfile] + if {$filename ne {}} { + if {[my define exists ofile]} { + set ofile [my define get ofile] + } else { + set ofile [my Ofile $filename] + my define set ofile $ofile + } + lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]]] + } + } + foreach item [my link list subordinate] { + lappend result {*}[$item compile-products] + } + return $result + } + + method implement path { + my go + my Collate_Source $path + if {[my define get output_c] eq {}} return + set filename [file join $path [my define get output_c]] + my define set cfile $filename + set fout [open $filename w] + puts $fout [my generate-c] + puts $fout "extern int DLLEXPORT [my define get initfunc]( Tcl_Interp *interp ) \x7B" + puts $fout [my generate-cinit] + if {[my define get pkg_name] ne {}} { + puts $fout " Tcl_PkgProvide(interp, \"[my define get pkg_name]\", \"[my define get pkg_vers]\");" + } + puts $fout " return TCL_OK\;" + puts $fout "\x7D" + close $fout + } + + method initialize {} { + set filename [my define get filename] + if {$filename eq {}} { + return + } + if {[my define get name] eq {}} { + my define set name [file tail [file rootname $filename]] + } + if {[my define get localpath] eq {}} { + my define set localpath [my define get localpath]_[my define get name] + } + ::source $filename + } + + method linktype {} { + return {subordinate product dynamic} + } + + ### + # Populate const static data structures + ### + method generate-cstruct {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cstruct methods tcltype + set result {} + if {[info exists code(struct)]} { + ::practcl::cputs result $code(struct) + } + foreach obj [my link list dynamic] { + # Exclude products that will generate their own C files + if {[$obj define get output_c] ne {}} continue + ::practcl::cputs result [$obj generate-cstruct] + } + return $result + } + + method generate-constant {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result {} + my variable code cstruct methods tcltype + if {[info exists code(constant)]} { + ::practcl::cputs result "/* [my define get filename] CONSTANT */" + ::practcl::cputs result $code(constant) + } + if {[info exists cstruct]} { + foreach {name info} $cstruct { + set map {} + lappend map @NAME@ $name + lappend map @MACRO@ GET[string toupper $name] + + if {[dict exists $info deleteproc]} { + lappend map @DELETEPROC@ [dict get $info deleteproc] + } else { + lappend map @DELETEPROC@ NULL + } + if {[dict exists $info cloneproc]} { + lappend map @CLONEPROC@ [dict get $info cloneproc] + } else { + lappend map @CLONEPROC@ NULL + } + ::practcl::cputs result [string map $map { +const static Tcl_ObjectMetadataType @NAME@DataType = { + TCL_OO_METADATA_VERSION_CURRENT, + "@NAME@", + @DELETEPROC@, + @CLONEPROC@ +}; +#define @MACRO@(OBJCONTEXT) (@NAME@ *) Tcl_ObjectGetMetadata(OBJCONTEXT,&@NAME@DataType) +}] + } + } + if {[info exists tcltype]} { + foreach {type info} $tcltype { + dict with info {} + ::practcl::cputs result "const Tcl_ObjType $cname = \{\n .freeIntRepProc = &${freeproc},\n .dupIntRepProc = &${dupproc},\n .updateStringProc = &${updatestringproc},\n .setFromAnyProc = &${setfromanyproc}\n\}\;" + } + } + + if {[info exists methods]} { + set mtypes {} + foreach {name info} $methods { + set callproc [dict get $info callproc] + set methodtype [dict get $info methodtype] + if {$methodtype in $mtypes} continue + lappend mtypes $methodtype + ### + # Build the data struct for this method + ### + ::practcl::cputs result "const static Tcl_MethodType $methodtype = \{" + ::practcl::cputs result " .version = TCL_OO_METADATA_VERSION_CURRENT,\n .name = \"$name\",\n .callProc = $callproc," + if {[dict exists $info deleteproc]} { + set deleteproc [dict get $info deleteproc] + } else { + set deleteproc NULL + } + if {$deleteproc ni { {} NULL }} { + ::practcl::cputs result " .deleteProc = $deleteproc," + } else { + ::practcl::cputs result " .deleteProc = NULL," + } + if {[dict exists $info cloneproc]} { + set cloneproc [dict get $info cloneproc] + } else { + set cloneproc NULL + } + if {$cloneproc ni { {} NULL }} { + ::practcl::cputs result " .cloneProc = $cloneproc\n\}\;" + } else { + ::practcl::cputs result " .cloneProc = NULL\n\}\;" + } + dict set methods $name methodtype $methodtype + } + } + foreach obj [my link list dynamic] { + # Exclude products that will generate their own C files + if {[$obj define get output_c] ne {}} continue + ::practcl::cputs result [$obj generate-constant] + } + return $result + } + + ### + # Generate code that provides subroutines called by + # Tcl API methods + ### + method generate-cfunct {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code cfunct + set result {} + if {[info exists code(funct)]} { + ::practcl::cputs result $code(funct) + } + if {[info exists cfunct]} { + foreach {funcname info} $cfunct { + ::practcl::cputs result "[dict get $info header]\{[dict get $info body]\}\;" + } + } + foreach obj [my link list dynamic] { + # Exclude products that will generate their own C files + if {[$obj define get output_c] ne {}} { + continue + } + ::practcl::cputs result [$obj generate-cfunct] + } + return $result + } + + ### + # Generate code that provides implements Tcl API + # calls + ### + method generate-cmethod {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + my variable code methods tclprocs + set result {} + if {[info exists code(method)]} { + ::practcl::cputs result $code(method) + } + + if {[info exists tclprocs]} { + foreach {name info} $tclprocs { + if {![dict exists $info body]} continue + set callproc [dict get $info callproc] + set header [dict get $info header] + set body [dict get $info body] + ::practcl::cputs result "${header} \{${body}\}" + } + } + + + if {[info exists methods]} { + set thisclass [my define get cclass] + foreach {name info} $methods { + if {![dict exists $info body]} continue + set callproc [dict get $info callproc] + set header [dict get $info header] + set body [dict get $info body] + ::practcl::cputs result "${header} \{${body}\}" + } + # Build the OO_Init function + ::practcl::cputs result "static int ${thisclass}_OO_Init(Tcl_Interp *interp) \{" + ::practcl::cputs result [string map [list @CCLASS@ $thisclass @TCLCLASS@ [my define get class]] { + /* + ** Build the "@TCLCLASS@" class + */ + Tcl_Obj* nameObj; /* Name of a class or method being looked up */ + Tcl_Object curClassObject; /* Tcl_Object representing the current class */ + Tcl_Class curClass; /* Tcl_Class representing the current class */ + + /* + * Find the "@TCLCLASS@" class, and attach an 'init' method to it. + */ + + nameObj = Tcl_NewStringObj("@TCLCLASS@", -1); + Tcl_IncrRefCount(nameObj); + if ((curClassObject = Tcl_GetObjectFromObj(interp, nameObj)) == NULL) { + Tcl_DecrRefCount(nameObj); + return TCL_ERROR; + } + Tcl_DecrRefCount(nameObj); + curClass = Tcl_GetObjectAsClass(curClassObject); +}] + if {[dict exists $methods constructor]} { + set mtype [dict get $methods constructor methodtype] + ::practcl::cputs result [string map [list @MTYPE@ $mtype] { + /* Attach the constructor to the class */ + Tcl_ClassSetConstructor(interp, curClass, Tcl_NewMethod(interp, curClass, NULL, 1, &@MTYPE@, NULL)); + }] + } + foreach {name info} $methods { + dict with info {} + if {$name in {constructor destructor}} continue + ::practcl::cputs result [string map [list @NAME@ $name @MTYPE@ $methodtype] { + nameObj=Tcl_NewStringObj("@NAME@",-1); + Tcl_NewMethod(interp, curClass, nameObj, 1, &@MTYPE@, (ClientData) NULL); + Tcl_DecrRefCount(nameObj); +}] + if {[dict exists $info aliases]} { + foreach alias [dict get $info aliases] { + if {[dict exists $methods $alias]} continue + ::practcl::cputs result [string map [list @NAME@ $alias @MTYPE@ $methodtype] { + nameObj=Tcl_NewStringObj("@NAME@",-1); + Tcl_NewMethod(interp, curClass, nameObj, 1, &@MTYPE@, (ClientData) NULL); + Tcl_DecrRefCount(nameObj); +}] + } + } + } + ::practcl::cputs result " return TCL_OK\;\n\}\n" + } + foreach obj [my link list dynamic] { + # Exclude products that will generate their own C files + if {[$obj define get output_c] ne {}} continue + ::practcl::cputs result [$obj generate-cmethod] + } + return $result + } + + method generate-cinit-external {} { + if {[my define get initfunc] eq {}} { + return "/* [my define get filename] declared not initfunc */" + } + return " if([my define get initfunc](interp)) return TCL_ERROR\;" + } + + ### + # Generate code that runs when the package/module is + # initialized into the interpreter + ### + method generate-cinit {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set result {} + my variable code methods tclprocs + if {[info exists code(nspace)]} { + ::practcl::cputs result " \{\n Tcl_Namespace *modPtr;" + foreach nspace $code(nspace) { + ::practcl::cputs result [string map [list @NSPACE@ $nspace] { + modPtr=Tcl_FindNamespace(interp,"@NSPACE@",NULL,TCL_NAMESPACE_ONLY); + if(!modPtr) { + modPtr = Tcl_CreateNamespace(interp, "@NSPACE@", NULL, NULL); + } +}] + } + ::practcl::cputs result " \}" + } + if {[info exists code(tclinit)]} { + ::practcl::cputs result $code(tclinit) + } + if {[info exists code(cinit)]} { + ::practcl::cputs result $code(cinit) + } + if {[info exists code(initfuncts)]} { + foreach func $code(initfuncts) { + ::practcl::cputs result " if (${func}(interp) != TCL_OK) return TCL_ERROR\;" + } + } + if {[info exists tclprocs]} { + foreach {name info} $tclprocs { + set map [list @NAME@ $name @CALLPROC@ [dict get $info callproc]] + ::practcl::cputs result [string map $map { Tcl_CreateObjCommand(interp,"@NAME@",(Tcl_ObjCmdProc *)@CALLPROC@,NULL,NULL);}] + if {[dict exists $info aliases]} { + foreach alias [dict get $info aliases] { + set map [list @NAME@ $alias @CALLPROC@ [dict get $info callproc]] + ::practcl::cputs result [string map $map { Tcl_CreateObjCommand(interp,"@NAME@",(Tcl_ObjCmdProc *)@CALLPROC@,NULL,NULL);}] + } + } + } + } + + if {[info exists code(nspace)]} { + ::practcl::cputs result " \{\n Tcl_Namespace *modPtr;" + foreach nspace $code(nspace) { + ::practcl::cputs result [string map [list @NSPACE@ $nspace] { + modPtr=Tcl_FindNamespace(interp,"@NSPACE@",NULL,TCL_NAMESPACE_ONLY); + Tcl_CreateEnsemble(interp, modPtr->fullName, modPtr, TCL_ENSEMBLE_PREFIX); + Tcl_Export(interp, modPtr, "[a-z]*", 1); +}] + } + ::practcl::cputs result " \}" + } + set result [::practcl::_tagblock $result c [my define get filename]] + foreach obj [my link list product] { + # Exclude products that will generate their own C files + if {[$obj define get output_c] ne {}} { + ::practcl::cputs result [$obj generate-cinit-external] + } else { + ::practcl::cputs result [$obj generate-cinit] + } + } + return $result + } + + method c_header body { + my variable code + ::practcl::cputs code(header) $body + } + + method c_code body { + my variable code + ::practcl::cputs code(funct) $body + } + method c_function {header body} { + my variable code cfunct + foreach regexp { + {(.*) ([a-zA-Z_][a-zA-Z0-9_]*) *\((.*)\)} + {(.*) (\x2a[a-zA-Z_][a-zA-Z0-9_]*) *\((.*)\)} + } { + if {[regexp $regexp $header all keywords funcname arglist]} { + dict set cfunct $funcname header $header + dict set cfunct $funcname body $body + dict set cfunct $funcname keywords $keywords + dict set cfunct $funcname arglist $arglist + dict set cfunct $funcname public [expr {"static" ni $keywords}] + dict set cfunct $funcname export [expr {"STUB_EXPORT" in $keywords}] + + return + } + } + ::practcl::cputs code(header) "$header\;" + # Could not parse that block as a function + # append it verbatim to our c_implementation + ::practcl::cputs code(funct) "$header [list $body]" + } + + + method cmethod {name body {arginfo {}}} { + my variable methods code + foreach {f v} $arginfo { + dict set methods $name $f $v + } + dict set methods $name body "Tcl_Object thisObject = Tcl_ObjectContextObject(objectContext); /* The current connection object */ +$body" + } + + method c_tclproc_nspace nspace { + my variable code + if {![info exists code(nspace)]} { + set code(nspace) {} + } + if {$nspace ni $code(nspace)} { + lappend code(nspace) $nspace + } + } + + method c_tclproc_raw {name body {arginfo {}}} { + my variable tclprocs code + + foreach {f v} $arginfo { + dict set tclprocs $name $f $v + } + dict set tclprocs $name body $body + } + + method go {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + next + my variable methods code cstruct tclprocs + if {[info exists methods]} { + debug [self] methods [my define get cclass] + set thisclass [my define get cclass] + foreach {name info} $methods { + # Provide a callproc + if {![dict exists $info callproc]} { + set callproc [string map {____ _ ___ _ __ _} [string map {{ } _ : _} OOMethod_${thisclass}_${name}]] + dict set methods $name callproc $callproc + } else { + set callproc [dict get $info callproc] + } + if {[dict exists $info body] && ![dict exists $info header]} { + dict set methods $name header "static int ${callproc}(ClientData clientData, Tcl_Interp *interp, Tcl_ObjectContext objectContext ,int objc ,Tcl_Obj *const *objv)" + } + if {![dict exists $info methodtype]} { + set methodtype [string map {{ } _ : _} MethodType_${thisclass}_${name}] + dict set methods $name methodtype $methodtype + } + } + if {![info exists code(initfuncts)] || "${thisclass}_OO_Init" ni $code(initfuncts)} { + lappend code(initfuncts) "${thisclass}_OO_Init" + } + } + set thisnspace [my define get nspace] + + if {[info exists tclprocs]} { + debug [self] tclprocs [dict keys $tclprocs] + foreach {name info} $tclprocs { + if {![dict exists $info callproc]} { + set callproc [string map {____ _ ___ _ __ _} [string map {{ } _ : _} Tclcmd_${thisnspace}_${name}]] + dict set tclprocs $name callproc $callproc + } else { + set callproc [dict get $info callproc] + } + if {[dict exists $info body] && ![dict exists $info header]} { + dict set tclprocs $name header "static int ${callproc}(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv\[\])" + } + } + } + debug [list /[self] [self method] [self class]] + } + + # Once an object marks itself as some + # flavor of dynamic, stop trying to morph + # it into something else + method select {} {} + + + method tcltype {name argdat} { + my variable tcltype + foreach {f v} $argdat { + dict set tcltype $name $f $v + } + if {![dict exists tcltype $name cname]} { + dict set tcltype $name cname [string tolower $name]_tclobjtype + } + lappend map @NAME@ $name + set info [dict get $tcltype $name] + foreach {f v} $info { + lappend map @[string toupper $f]@ $v + } + foreach {func fpat template} { + freeproc {@Name@Obj_freeIntRepProc} {void @FNAME@(Tcl_Obj *objPtr)} + dupproc {@Name@Obj_dupIntRepProc} {void @FNAME@(Tcl_Obj *srcPtr,Tcl_Obj *dupPtr)} + updatestringproc {@Name@Obj_updateStringRepProc} {void @FNAME@(Tcl_Obj *objPtr)} + setfromanyproc {@Name@Obj_setFromAnyProc} {int @FNAME@(Tcl_Interp *interp,Tcl_Obj *objPtr)} + } { + if {![dict exists $info $func]} { + error "$name does not define $func" + } + set body [dict get $info $func] + # We were given a function name to call + if {[llength $body] eq 1} continue + set fname [string map [list @Name@ [string totitle $name]] $fpat] + my c_function [string map [list @FNAME@ $fname] $template] [string map $map $body] + dict set tcltype $name $func $fname + } + } +} + +::oo::class create ::practcl::cheader { + superclass ::practcl::product + + method compile-products {} {} + method generate-cinit {} {} +} + +::oo::class create ::practcl::csource { + superclass ::practcl::product +} + +::oo::class create ::practcl::clibrary { + superclass ::practcl::product + + method linker-products {configdict} { + return [my define get filename] + } + +} + +### +# In the end, all C code must be loaded into a module +# This will either be a dynamically loaded library implementing +# a tcl extension, or a compiled in segment of a custom shell/app +### +::oo::class create ::practcl::module { + superclass ::practcl::dynamic + + method child which { + switch $which { + organs { + return [list project [my define get project] module [self]] + } + } + } + + method initialize {} { + set filename [my define get filename] + if {$filename eq {}} { + return + } + if {[my define get name] eq {}} { + my define set name [file tail [file dirname $filename]] + } + if {[my define get localpath] eq {}} { + my define set localpath [my define get name]_[my define get name] + } + debug [self] SOURCE $filename + my source $filename + } + + method implement path { + my go + my Collate_Source $path + foreach item [my link list dynamic] { + if {[catch {$item implement $path} err]} { + puts "Skipped $item: $err" + } + } + foreach item [my link list module] { + if {[catch {$item implement $path} err]} { + puts "Skipped $item: $err" + } + } + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set filename [my define get output_c] + if {$filename eq {}} { + debug [list /[self] [self method] [self class]] + return + } + set cout [open [file join $path [file rootname $filename].c] w] + puts $cout [subst {/* +** This file is generated by the [info script] script +** any changes will be overwritten the next time it is run +*/}] + puts $cout [my generate-c] + puts $cout [my generate-loader] + close $cout + debug [list /[self] [self method] [self class]] + } + + method linktype {} { + return {subordinate product dynamic module} + } +} + +::oo::class create ::practcl::autoconf { + + ### + # find or fake a key/value list describing this project + ### + method config.sh {} { + my variable conf_result + if {[info exists conf_result]} { + return $conf_result + } + set result {} + set name [my define get name] + set PWD $::CWD + set builddir [my define get builddir] + my unpack + set srcroot [my define get srcroot] + if {![file exists $builddir]} { + my Configure + } + set filename [file join $builddir config.tcl] + # Project uses the practcl template. Use the leavings from autoconf + if {[file exists $filename]} { + set dat [::practcl::config.tcl $builddir] + foreach {item value} [lsort -stride 2 -dictionary $dat] { + dict set result $item $value + } + set conf_result $result + return $result + } + set filename [file join $builddir ${name}Config.sh] + if {[file exists $filename]} { + set l [expr {[string length $name]+1}] + foreach {field dat} [::practcl::read_Config.sh $filename] { + set field [string tolower $field] + if {[string match ${name}_* $field]} { + set field [string range $field $l end] + } + dict set result $field $dat + } + set conf_result $result + return $result + } + ### + # Oh man... we have to guess + ### + set filename [file join $builddir Makefile] + if {![file exists $filename]} { + error "Could not locate any configuration data in $srcroot" + } + foreach {field dat} [::practcl::read_Makefile $filename] { + dict set result $field $dat + } + set conf_result $result + cd $PWD + return $result + } +} + + +::oo::class create ::practcl::project { + superclass ::practcl::module ::practcl::autoconf + + constructor args { + my variable define + if {[llength $args] == 1} { + if {[catch {uplevel 1 [list subst [lindex $args 0]]} contents]} { + set contents [lindex $args 0] + } + } else { + if {[catch {uplevel 1 [list subst $args]} contents]} { + set contents $args + } + } + array set define $contents + my select + my initialize + } + + + method add_project {pkg info {oodefine {}}} { + set os [my define get os] + if {$os eq {}} { + set os [::practcl::os] + my define set os $os + } + set fossilinfo [list download [my define get download] tag trunk sandbox [my define get sandbox]] + if {[dict exists $info os] && ($os ni [dict get $info os])} return + # Select which tag to use here. + # For production builds: tag-release + if {[::info exists ::env(FOSSIL_MIRROR)]} { + dict set info localmirror $::env(FOSSIL_MIRROR) + } + set profile [my define get profile release]: + if {[dict exists $info profile $profile]} { + dict set info tag [dict get $info profile $profile] + } + set obj [namespace current]::PROJECT.$pkg + if {[info command $obj] eq {}} { + set obj [::practcl::subproject create $obj [self] [dict merge $fossilinfo [list name $pkg pkg_name $pkg static 0] $info]] + } + my link object $obj + oo::objdefine $obj $oodefine + $obj define set masterpath $::CWD + $obj go + return $obj + } + + method child which { + switch $which { + organs { + # A library can be a project, it can be a module. Any + # subordinate modules will indicate their existance + return [list project [self] module [self]] + } + } + } + + method linktype {} { + return project + } + + # Exercise the methods of a sub-object + method project {pkg args} { + set obj [namespace current]::PROJECT.$pkg + if {[llength $args]==0} { + return $obj + } + tailcall ${obj} {*}$args + } +} + +::oo::class create ::practcl::library { + superclass ::practcl::project + + method compile-products {} { + set result {} + foreach item [my link list subordinate] { + lappend result {*}[$item compile-products] + } + set filename [my define get output_c] + if {$filename ne {}} { + set ofile [file rootname [file tail $filename]]_main.o + lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]]] + } + return $result + } + + method generate-tcl-loader {} { + set result {} + set PKGINIT [my define get pkginit] + set PKG_NAME [my define get name [my define get pkg_name]] + set PKG_VERSION [my define get pkg_vers [my define get version]] + if {[string is true [my define get SHARED_BUILD 0]]} { + set LIBFILE [my define get libfile] + ::practcl::cputs result [string map \ + [list @LIBFILE@ $LIBFILE @PKGINIT@ $PKGINIT @PKG_NAME@ $PKG_NAME @PKG_VERSION@ $PKG_VERSION] { +# Shared Library Style +load [file join [file dirname [file join [pwd] [info script]]] @LIBFILE@] @PKGINIT@ +package provide @PKG_NAME@ @PKG_VERSION@ +}] + } else { + ::practcl::cputs result [string map \ + [list @PKGINIT@ $PKGINIT @PKG_NAME@ $PKG_NAME @PKG_VERSION@ $PKG_VERSION] { +# Tclkit Style +load {} @PKGINIT@ +package provide @PKG_NAME@ @PKG_VERSION@ +}] + } + return $result + } + + method go {} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set name [my define getnull name] + if {$name eq {}} { + set name generic + my define name generic + } + if {[my define get tk] eq {@TEA_TK_EXTENSION@}} { + my define set tk 0 + } + set output_c [my define getnull output_c] + if {$output_c eq {}} { + set output_c [file rootname $name].c + my define set output_c $output_c + } + set output_h [my define getnull output_h] + if {$output_h eq {}} { + set output_h [file rootname $output_c].h + my define set output_h $output_h + } + set output_tcl [my define getnull output_tcl] + #if {$output_tcl eq {}} { + # set output_tcl [file rootname $output_c].tcl + # my define set output_tcl $output_tcl + #} + #set output_mk [my define getnull output_mk] + #if {$output_mk eq {}} { + # set output_mk [file rootname $output_c].mk + # my define set output_mk $output_mk + #} + set initfunc [my define getnull initfunc] + if {$initfunc eq {}} { + set initfunc [string totitle $name]_Init + my define set initfunc $initfunc + } + set output_decls [my define getnull output_decls] + if {$output_decls eq {}} { + set output_decls [file rootname $output_c].decls + my define set output_decls $output_decls + } + my variable links + foreach {linktype objs} [array get links] { + foreach obj $objs { + $obj go + } + } + debug [list /[self] [self method] [self class] -- [my define get filename] [info object class [self]]] + } + + method implement path { + my go + my Collate_Source $path + foreach item [my link list dynamic] { + if {[catch {$item implement $path} err]} { + puts "Skipped $item: $err" + } + } + foreach item [my link list module] { + if {[catch {$item implement $path} err]} { + puts "Skipped $item: $err" + } + } + set cout [open [file join $path [my define get output_c]] w] + puts $cout [subst {/* +** This file is generated by the [info script] script +** any changes will be overwritten the next time it is run +*/}] + puts $cout [my generate-c] + puts $cout [my generate-loader] + close $cout + + set macro HAVE_[string toupper [file rootname [my define get output_h]]]_H + set hout [open [file join $path [my define get output_h]] w] + puts $hout [subst {/* +** This file is generated by the [info script] script +** any changes will be overwritten the next time it is run +*/}] + puts $hout "#ifndef ${macro}" + puts $hout "#define ${macro}" + puts $hout [my generate-h] + puts $hout "#endif" + close $hout + + set output_tcl [my define get output_tcl] + if {$output_tcl ne {}} { + set tclout [open [file join $path [my define get output_tcl]] w] + puts $tclout "### +# This file is generated by the [info script] script +# any changes will be overwritten the next time it is run +###" + puts $tclout [my generate-tcl] + puts $tclout [my generate-tcl-loader] + close $tclout + } + } + + method generate-decls {pkgname path} { + debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] + set outfile [file join $path/$pkgname.decls] + + ### + # Build the decls file + ### + set fout [open $outfile w] + puts $fout [subst {### + # $outfile + # + # This file was generated by [info script] + ### + + library $pkgname + interface $pkgname + }] + + ### + # Generate list of functions + ### + set stubfuncts [my generate-stub-function] + set thisline {} + set functcount 0 + foreach {func header} $stubfuncts { + puts $fout [list declare [incr functcount] $header] + } + puts $fout [list export "int [my define get initfunc](Tcl_Inter *interp)"] + puts $fout [list export "char *[string totitle [my define get name]]_InitStubs(Tcl_Inter *interp, char *version, int exact)"] + + close $fout + + ### + # Build [package]Decls.h + ### + set hout [open [file join $path ${pkgname}Decls.h] w] + + close $hout + + set cout [open [file join $path ${pkgname}StubInit.c] w] +puts $cout [string map [list %pkgname% $pkgname %PkgName% [string totitle $pkgname]] { +#ifndef USE_TCL_STUBS +#define USE_TCL_STUBS +#endif +#undef USE_TCL_STUB_PROCS + +#include "tcl.h" +#include "%pkgname%.h" + + /* + ** Ensure that Tdom_InitStubs is built as an exported symbol. The other stub + ** functions should be built as non-exported symbols. + */ + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLEXPORT + +%PkgName%Stubs *%pkgname%StubsPtr; + + /* + **---------------------------------------------------------------------- + ** + ** %PkgName%_InitStubs -- + ** + ** Checks that the correct version of %PkgName% is loaded and that it + ** supports stubs. It then initialises the stub table pointers. + ** + ** Results: + ** The actual version of %PkgName% that satisfies the request, or + ** NULL to indicate that an error occurred. + ** + ** Side effects: + ** Sets the stub table pointers. + ** + **---------------------------------------------------------------------- + */ + +char * +%PkgName%_InitStubs (Tcl_Interp *interp, char *version, int exact) +{ + char *actualVersion; + actualVersion = Tcl_PkgRequireEx(interp, "%pkgname%", version, exact,(ClientData *) &%pkgname%StubsPtr); + if (!actualVersion) { + return NULL; + } + if (!%pkgname%StubsPtr) { + Tcl_SetResult(interp,"This implementation of %PkgName% does not support stubs",TCL_STATIC); + return NULL; + } + return actualVersion; +} +}] + close $cout + } + + # Backward compadible call + method generate-make path { + ::practcl::build::Makefile $path [self] + } + + method install-headers {} { + set result {} + return $result + } + + method linktype {} { + return library + } + + # Create a "package ifneeded" + # Args are a list of aliases for which this package will answer to + method package-ifneeded {args} { + set result {} + set name [my define get pkg_name [my define get name]] + set version [my define get pkg_vers [my define get version]] + if {$version eq {}} { + set version 0.1a + } + set output_tcl [my define get output_tcl] + if {$output_tcl ne {}} { + set script "\[list source \[file join \$dir $output_tcl\]\]" + } elseif {[string is true -strict [my define get SHARED_BUILD]]} { + set script "\[list load \[file join \$dir [my define get libfile]\] $name\]" + } else { + # Provide a null passthrough + set script [list package provide $name $version] + } + set result "package ifneeded [list $name] [list $version] $script" + foreach alias $args { + set script "package require $name $version \; package provide $alias $version" + append result \n\n [list package ifneeded $alias $version $script] + } + return $result + } + + + method shared_library {} { + set name [string tolower [my define get name [my define get pkg_name]]] + set NAME [string toupper $name] + set version [my define get version [my define get pkg_vers]] + set map {} + lappend map %LIBRARY_NAME% $name + lappend map %LIBRARY_VERSION% $version + lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} $version] + lappend map %LIBRARY_PREFIX% [my define getnull libprefix] + set outfile [string map $map [my define get PRACTCL_NAME_LIBRARY]][my define get SHLIB_SUFFIX] + return $outfile + } +} + +::oo::class create ::practcl::tclkit { + superclass ::practcl::library + + method Collate_Source CWD { + my define set SHARED_BUILD 0 + set name [my define get name] + + if {![my define exists TCL_LOCAL_APPINIT]} { + my define set TCL_LOCAL_APPINIT Tclkit_AppInit + } + if {![my define exists TCL_LOCAL_MAIN_HOOK]} { + my define set TCL_LOCAL_MAIN_HOOK Tclkit_MainHook + } + + set PROJECT [self] + set os [$PROJECT define get os] + set TCLOBJ [$PROJECT project TCLCORE] + set TKOBJ [$PROJECT project TKCORE] + set ODIEOBJ [$PROJECT project odie] + + set TCLSRCDIR [$TCLOBJ define get srcroot] + set TKSRCDIR [$TKOBJ define get srcroot] + set PKG_OBJS {} + foreach item [$PROJECT link list package] { + if {[string is true [$item define get static]]} { + lappend PKG_OBJS $item + } + } + # Arrange to build an main.c that utilizes TCL_LOCAL_APPINIT and TCL_LOCAL_MAIN_HOOK + if {$os eq "windows"} { + set PLATFORM_SRC_DIR win + my add class csource filename [file join $TCLSRCDIR win tclWinReg.c] initfunc Registry_Init pkg_name registry pkg_vers 1.3.1 autoload 1 + my add class csource filename [file join $TCLSRCDIR win tclWinDde.c] initfunc Dde_Init pkg_name dde pkg_vers 1.4.0 autoload 1 + my add class csource ofile [my define get name]_appinit.o filename [file join $TCLSRCDIR win tclAppInit.c] extra [list -DTCL_LOCAL_MAIN_HOOK=[my define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] -DTCL_LOCAL_APPINIT=[my define get TCL_LOCAL_APPINIT Tclkit_AppInit]] + } else { + set PLATFORM_SRC_DIR unix + my add class csource ofile [my define get name]_appinit.o filename [file join $TCLSRCDIR unix tclAppInit.c] extra [list -DTCL_LOCAL_MAIN_HOOK=[my define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] -DTCL_LOCAL_APPINIT=[my define get TCL_LOCAL_APPINIT Tclkit_AppInit]] + } + ### + # Add local static Zlib implementation + ### + set cdir [file join $TCLSRCDIR compat zlib] + foreach file { + adler32.c compress.c crc32.c + deflate.c infback.c inffast.c + inflate.c inftrees.c trees.c + uncompr.c zutil.c + } { + my add [file join $cdir $file] + } + + ### + # Pre 8.7, Tcl doesn't include a Zipfs implementation + # in the core. Grab the one from odielib + ### + set zipfs [file join $TCLSRCDIR generic zvfs.c] + if {![file exists $zipfs]} { + # The Odie project maintains a mirror of the version + # released with the Tcl core + my add_project odie { + tag trunk + class subproject + vfsinstall 0 + } + my project odie unpack + set ODIESRCROOT [my project odie define get srcroot] + set cdir [file join $ODIESRCROOT compat zipfs] + my define add include_dir $cdir + set zipfs [file join $cdir zvfs.c] + } + + my add class csource filename $zipfs initfunc Tclzipfs_Init pkg_name zipfs pkg_vers 1.0 autoload 1 + + my define add include_dir [file join $TKSRCDIR generic] + my define add include_dir [file join $TKSRCDIR $PLATFORM_SRC_DIR] + my define add include_dir [file join $TKSRCDIR bitmaps] + my define add include_dir [file join $TKSRCDIR xlib] + my define add include_dir [file join $TCLSRCDIR generic] + my define add include_dir [file join $TCLSRCDIR $PLATFORM_SRC_DIR] + my define add include_dir [file join $TCLSRCDIR compat zlib] + # This file will implement TCL_LOCAL_APPINIT and TCL_LOCAL_MAIN_HOOK + ::practcl::build::tclkit_main $PROJECT $PKG_OBJS + } + + ## Wrap an executable + # + method wrap {PWD exename vfspath args} { + cd $PWD + if {![file exists $vfspath]} { + file mkdir $vfspath + } + foreach item [my link list core.library] { + set name [$item define get name] + set libsrcroot [$item define get srcroot] + if {[file exists [file join $libsrcroot library]]} { + ::practcl::copyDir [file join $libsrcroot library] [file join $vfspath boot $name] + } + } + if {[my define get installdir] ne {}} { + ::practcl::copyDir [file join [my define get installdir] [string trimleft [my define get prefix] /] lib] [file join $vfspath lib] + } + foreach arg $args { + ::practcl::copyDir $arg $vfspath + } + + set fout [open [file join $vfspath packages.tcl] w] + puts $fout { + set ::PKGIDXFILE [info script] + set dir [file dirname $::PKGIDXFILE] + } + #set BASEVFS [my define get BASEVFS] + set EXEEXT [my define get EXEEXT] + + set tclkit_bare [my define get tclkit_bare] + + set buffer [::practcl::pkgindex_path $vfspath] + puts $fout $buffer + puts $fout { + # Advertise statically linked packages + foreach {pkg script} [array get ::kitpkg] { + eval $script + } + } + close $fout + package require zipfile::mkzip + ::zipfile::mkzip::mkzip ${exename}${EXEEXT} -runtime $tclkit_bare -directory $vfspath + if { [my define get platform] ne "windows" } { + file attributes ${exename}${EXEEXT} -permissions a+x + } + } +} + +### +# Meta repository +# The default is an inert source code block +### +oo::class create ::practcl::subproject { + superclass ::practcl::object + + method compile {} {} + + method go {} { + set platform [my define get platform] + my define get USEMSVC [my define get USEMSVC] + set name [my define get name] + if {![my define exists srcroot]} { + my define set srcroot [file join [my define get sandbox] $name] + } + set srcroot [my define get srcroot] + my define set localsrcdir $srcroot + my define add include_dir [file join $srcroot generic] + my sources + } + + # Install project into the local build system + method install-local {} { + my unpack + } + + # Install project into the virtual file system + method install-vfs {} {} + + method linktype {} { + return {subordinate package} + } + + method linker-products {configdict} {} + + method linker-external {configdict} { + if {[dict exists $configdict PRACTCL_LIBS]} { + return [dict get $configdict PRACTCL_LIBS] + } + } + + method sources {} {} + + method unpack {} { + set name [my define get name] + puts [list $name [self] UNPACK] + my define set [::practcl::fossil_sandbox $name [my define dump]] + } + + method update {} { + set name [my define get name] + my define set [::practcl::fossil_sandbox $name [dict merge [my define dump] {update 1}]] + } +} + +### +# A project which the kit compiles and integrates +# the source for itself +### +oo::class create ::practcl::subproject.source { + superclass ::practcl::subproject ::practcl::library + + method linktype {} { + return {subordinate package source} + } + +} + +# a copy from the teapot +oo::class create ::practcl::subproject.teapot { + superclass ::practcl::subproject + + method install-local {} { + my install-vfs + } + + method install-vfs {} { + set pkg [my define get pkg_name [my define get name]] + set download [my define get download] + my unpack + set DEST [my define get installdir] + set prefix [string trimleft [my define get prefix] /] + # Get tcllib from our destination + set dir [file join $DEST $prefix lib tcllib] + source [file join $DEST $prefix lib tcllib pkgIndex.tcl] + package require zipfile::decode + ::zipfile::decode::unzipfile [file join $download $pkg.zip] [file join $DEST $prefix lib $pkg] + } +} + +oo::class create ::practcl::subproject.sak { + superclass ::practcl::subproject + + method install-local {} { + my install-vfs + } + + method install-vfs {} { + ### + # Handle teapot installs + ### + set pkg [my define get pkg_name [my define get name]] + my unpack + set DEST [my define get installdir] + set prefix [string trimleft [my define get prefix] /] + set srcroot [my define get srcroot] + ::dotclexec [file join $srcroot installer.tcl] \ + -pkg-path [file join $DEST $prefix lib $pkg] \ + -no-examples -no-html -no-nroff \ + -no-wait -no-gui -no-apps + } +} + +### +# A binary package +### +oo::class create ::practcl::subproject.binary { + superclass ::practcl::subproject ::practcl::autoconf + + + method compile-products {} {} + + method ConfigureOpts {} { + set opts {} + set builddir [my define get builddir] + if {[my define get broken_destroot 0]} { + set PREFIX [my define get prefix_broken_destdir] + } else { + set PREFIX [my define get prefix] + } + if {[my define get HOST] != [my define get TARGET]} { + lappend opts --host=[my define get TARGET] + } + if {[my define exists tclsrcdir]} { + set TCLSRCDIR [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tclsrcdir]]]] + set TCLGENERIC [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tclsrcdir] .. generic]]] + lappend opts --with-tcl=$TCLSRCDIR --with-tclinclude=$TCLGENERIC + } + if {[my define exists tksrcdir]} { + set TKSRCDIR [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tksrcdir]]]] + set TKGENERIC [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tksrcdir] .. generic]]] + lappend opts --with-tk=$TKSRCDIR --with-tkinclude=$TKGENERIC + } + lappend opts {*}[my define get config_opts] + lappend opts --prefix=$PREFIX + #--exec_prefix=$PREFIX + #if {$::tcl_platform(platform) eq "windows"} { + # lappend opts --disable-64bit + #} + if {[my define get static 1]} { + lappend opts --disable-shared --disable-stubs + # + } else { + lappend opts --enable-shared + } + return $opts + } + + method go {} { + next + my define set builddir [my BuildDir [my define get masterpath]] + } + + method linker-products {configdict} { + if {![my define get static 0]} { + return {} + } + set srcdir [my define get builddir] + if {[dict exists $configdict libfile]} { + return " [file join $srcdir [dict get $configdict libfile]]" + } + } + + method static-packages {} { + if {![my define get static 0]} { + return {} + } + set result [my define get static_packages] + set statpkg [my define get static_pkg] + set initfunc [my define get initfunc] + if {$initfunc ne {}} { + set pkg_name [my define get pkg_name] + if {$pkg_name ne {}} { + dict set result $pkg_name initfunc $initfunc + set version [my define get version] + if {$version eq {}} { + set info [my config.sh] + set version [dict get $info version] + set pl {} + if {[dict exists $info patch_level]} { + set pl [dict get $info patch_level] + append version $pl + } + my define set version $version + } + dict set result $pkg_name version $version + dict set result $pkg_name autoload [my define get autoload 0] + } + } + foreach item [my link list subordinate] { + foreach {pkg info} [$item static-packages] { + dict set result $pkg $info + } + } + return $result + } + + method BuildDir {PWD} { + set name [my define get name] + return [my define get builddir [file join $PWD pkg.$name]] + } + + method compile {} { + set name [my define get name] + set PWD $::CWD + cd $PWD + my go + set srcroot [file normalize [my define get srcroot]] + my Collate_Source $PWD + + ### + # Build a starter VFS for both Tcl and wish + ### + set srcroot [my define get srcroot] + if {[my define get static 1]} { + puts "BUILDING Static $name $srcroot" + } else { + puts "BUILDING Dynamic $name $srcroot" + } + if {[my define get USEMSVC 0]} { + cd $srcroot + doexec nmake -f makefile.vc INSTALLDIR=[my define get installdir] release + } else { + cd $::CWD + set builddir [file normalize [my define get builddir]] + file mkdir $builddir + if {![file exists [file join $builddir Makefile]]} { + my Configure + } + if {[file exists [file join $builddir make.tcl]]} { + domake.tcl $builddir library + } else { + domake $builddir all + } + } + cd $PWD + } + + + method Configure {} { + cd $::CWD + my unpack + my TeaConfig + set builddir [file normalize [my define get builddir]] + file mkdir $builddir + set srcroot [file normalize [my define get srcroot]] + if {[my define get USEMSVC 0]} { + return + } + set opts [my ConfigureOpts] + puts [list [self] CONFIGURE] + puts [list PWD [pwd]] + puts [list LOCALSRC $srcroot] + puts [list BUILDDIR $builddir] + puts [list CONFIGURE {*}$opts] + cd $builddir + exec sh [file join $srcroot configure] {*}$opts >& [file join $builddir practcl.log] + cd $::CWD + } + + method install-vfs {} { + set PWD [pwd] + set PKGROOT [my define get installdir] + set PREFIX [my define get prefix] + + ### + # Handle teapot installs + ### + set pkg [my define get pkg_name [my define get name]] + if {[my define get teapot] ne {}} { + set TEAPOT [my define get teapot] + set found 0 + foreach ver [my define get pkg_vers [my define get version]] { + set teapath [file join $TEAPOT $pkg$ver] + if {[file exists $teapath]} { + set dest [file join $PKGROOT [string trimleft $PREFIX /] lib [file tail $teapath]] + ::practcl::copyDir $teapath $dest + return + } + } + } + my compile + if {[my define get USEMSVC 0]} { + set srcroot [my define get srcroot] + cd $srcroot + puts "[self] VFS INSTALL $PKGROOT" + doexec nmake -f makefile.vc INSTALLDIR=$PKGROOT install + } else { + set builddir [my define get builddir] + if {[file exists [file join $builddir make.tcl]]} { + # Practcl builds can inject right to where we need them + puts "[self] VFS INSTALL $PKGROOT (Practcl)" + domake.tcl $builddir install-package $PKGROOT + } elseif {[my define get broken_destroot 0] == 0} { + # Most modern TEA projects understand DESTROOT in the makefile + puts "[self] VFS INSTALL $PKGROOT (TEA)" + domake $builddir install DESTDIR=$PKGROOT + } else { + # But some require us to do an install into a fictitious filesystem + # and then extract the gooey parts within. + # (*cough*) TkImg + set PREFIX [my define get prefix] + set BROKENROOT [::practcl::msys_to_tclpath [my define get prefix_broken_destdir]] + file delete -force $BROKENROOT + file mkdir $BROKENROOT + domake $builddir $install + ::practcl::copyDir $BROKENROOT [file join $PKGROOT [string trimleft $PREFIX /]] + file delete -force $BROKENROOT + } + } + cd $PWD + } + + method TeaConfig {} { + set srcroot [file normalize [my define get srcroot]] + set copytea 0 + if {![file exists [file join $srcroot tclconfig]]} { + set copytea 1 + } else { + if {![file exists [file join $srcroot tclconfig practcl.tcl]] || ![file exists [file join $srcroot tclconfig config.tcl.in]]} { + set copytea 1 + } + } + # ensure we have tclconfig with all of the trimming + if {$copytea} { + set tclconfiginfo [::practcl::fossil_sandbox tclconfig [list sandbox [my define get sandbox]]] + ::practcl::copyDir [dict get $tclconfiginfo srcroot] [file join $srcroot tclconfig] + if {$::tcl_platform(platform) ne "windows"} { + set pwd [pwd] + cd $srcroot + # On windows there's no practical way to execute + # autoconf. We'll have to trust that configure + # us up to date + foreach template {configure.ac configure.in} { + set input [file join $srcroot $template] + if {[file exists $input]} { + puts "autoconf -f $input > [file join $srcroot configure]" + exec autoconf -f $input > [file join $srcroot configure] + } + } + cd $pwd + } + } + } +} + +oo::class create ::practcl::subproject.core { + superclass ::practcl::subproject.binary + + # On the windows platform MinGW must build + # from the platform directory in the source repo + method BuildDir {PWD} { + return [my define get localsrcdir] + } + + method Configure {} { + if {[my define get USEMSVC 0]} { + return + } + set opts [my ConfigureOpts] + puts [list PWD [pwd]] + puts [list [self] CONFIGURE] + set builddir [file normalize [my define get builddir]] + set localsrcdir [file normalize [my define get localsrcdir]] + puts [list LOCALSRC $localsrcdir] + puts [list BUILDDIR $builddir] + puts [list CONFIGURE {*}$opts] + cd $localsrcdir + exec sh [file join $localsrcdir configure] {*}$opts >& [file join $builddir practcl.log] + } + + method ConfigureOpts {} { + set opts {} + set builddir [file normalize [my define get builddir]] + set PREFIX [my define get prefix] + if {[my define get HOST] != [my define get TARGET]} { + lappend opts --host=[my define get TARGET] + } + lappend opts {*}[my define get config_opts] + lappend opts --prefix=$PREFIX + #--exec_prefix=$PREFIX + lappend opts --disable-shared + return $opts + } + + method go {} { + set name [my define get name] + set platform [my define get platform] + if {![my define exists srcroot]} { + my define set srcroot [file join [my define get sandbox] $name] + } + set srcroot [my define get srcroot] + my define add include_dir [file join $srcroot generic] + switch $platform { + windows { + my define set localsrcdir [file join $srcroot win] + my define add include_dir [file join $srcroot win] + } + default { + my define set localsrcdir [file join $srcroot unix] + my define add include_dir [file join $srcroot $name unix] + } + } + my define set builddir [my BuildDir [my define get masterpath]] + } + + method linktype {} { + return {subordinate core.library} + } +} + +package provide practcl 0.5 -- cgit v0.12 From 5bf83d86b6b6d8581410139efdc0312b88b99831 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Wed, 14 Sep 2016 15:04:41 +0000 Subject: Further adaptations and improvements to practcl. And get, tclsh make.tcl basekit even works now --- library/practcl/practcl.tcl | 62 +++++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/library/practcl/practcl.tcl b/library/practcl/practcl.tcl index f285116..77d1181 100644 --- a/library/practcl/practcl.tcl +++ b/library/practcl/practcl.tcl @@ -1121,11 +1121,16 @@ proc ::practcl::build::DEFS {PROJECT DEFS namevar versionvar defsvar} { set field [string range $item 0 [expr {$eqidx-1}]] set value [string range $item [expr {$eqidx+1}] end] set emap {} - lappend emap \x5c \x5c\x5c \x20 \x5c\x20 \x22 \x5c\x22 \x28 \x5c\x28 \x29 \x5c\x29 - if {[string is integer -strict $value]} { - append defs " -D${field}=$value" + # On Windows we need to do some munging of escape characters + if {[practcl::os]=="windows"} { + lappend emap \x5c \x5c\x5c \x20 \x5c\x20 \x22 \x5c\x22 \x28 \x5c\x28 \x29 \x5c\x29 + if {[string is integer -strict $value]} { + append defs " -D${field}=$value" + } else { + append defs " -D${field}=[string map $emap $value]" + } } else { - append defs " -D${field}=[string map $emap $value]" + append defs " -D${field}=$value" } set idx $ndx } @@ -1229,13 +1234,18 @@ if {[file exists {%vfs_tk_library%}]} { CONST char *archive; Tcl_FindExecutable(*argv[0]); archive=Tcl_GetNameOfExecutable(); - +} + if {![$PROJECT define get CORE_ZIPFS 0]} { + ::practcl::cputs zvfsboot { + /* + ** We have to initialize the virtual filesystem before calling + ** Tcl_Init(). Otherwise, Tcl_Init() will not be able to find + ** its startup script files. + */ Tclzipfs_Init(NULL); +} + $PROJECT include {"tclZipfs.h"} } - # We have to initialize the virtual filesystem before calling - # Tcl_Init(). Otherwise, Tcl_Init() will not be able to find - # its startup script files. - $PROJECT include {"tclZipfs.h"} ::practcl::cputs zvfsboot " if(!TclZipfsMount(NULL, archive, \"%vfsroot%\", NULL)) \x7B " ::practcl::cputs zvfsboot { @@ -1656,6 +1666,7 @@ proc ::practcl::build::static-tclsh {outfile PROJECT} { # with the internals of a staticly linked Tcl ### ::practcl::build::DEFS $PROJECT $TCL(defs) name version defs + set debug [$PROJECT define get debug 0] set NAME [string toupper $name] set result {} @@ -3481,27 +3492,30 @@ char * set PLATFORM_SRC_DIR unix my add class csource ofile [my define get name]_appinit.o filename [file join $TCLSRCDIR unix tclAppInit.c] extra [list -DTCL_LOCAL_MAIN_HOOK=[my define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] -DTCL_LOCAL_APPINIT=[my define get TCL_LOCAL_APPINIT Tclkit_AppInit]] } - ### - # Add local static Zlib implementation - ### - set cdir [file join $TCLSRCDIR compat zlib] - foreach file { - adler32.c compress.c crc32.c - deflate.c infback.c inffast.c - inflate.c inftrees.c trees.c - uncompr.c zutil.c - } { - my add [file join $cdir $file] - } ### # Pre 8.7, Tcl doesn't include a Zipfs implementation # in the core. Grab the one from odielib ### - set zipfs [file join $TCLSRCDIR generic zvfs.c] - if {![file exists $zipfs]} { + set zipfs [file join $TCLSRCDIR generic tclZipfs.c] + if {[file exists $zipfs]} { + my define set CORE_ZIPFS 1 + } else { + ### + # Add local static Zlib implementation + ### + set cdir [file join $TCLSRCDIR compat zlib] + foreach file { + adler32.c compress.c crc32.c + deflate.c infback.c inffast.c + inflate.c inftrees.c trees.c + uncompr.c zutil.c + } { + my add [file join $cdir $file] + } # The Odie project maintains a mirror of the version # released with the Tcl core + my define set CORE_ZIPFS 0 my add_project odie { tag trunk class subproject @@ -3512,9 +3526,9 @@ char * set cdir [file join $ODIESRCROOT compat zipfs] my define add include_dir $cdir set zipfs [file join $cdir zvfs.c] + my add class csource filename $zipfs initfunc Tclzipfs_Init pkg_name zipfs pkg_vers 1.0 autoload 1 } - my add class csource filename $zipfs initfunc Tclzipfs_Init pkg_name zipfs pkg_vers 1.0 autoload 1 my define add include_dir [file join $TKSRCDIR generic] my define add include_dir [file join $TKSRCDIR $PLATFORM_SRC_DIR] -- cgit v0.12 From a4dbdda70039562e22ccf70611cf68cfe09f41c1 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Wed, 14 Sep 2016 15:11:12 +0000 Subject: Adding build scripts to implement Tip#453 --- pkgs/make.tcl | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ pkgs/packages.tcl | 92 ++++++++++++++++++++++++++++++ 2 files changed, 257 insertions(+) create mode 100644 pkgs/make.tcl create mode 100644 pkgs/packages.tcl diff --git a/pkgs/make.tcl b/pkgs/make.tcl new file mode 100644 index 0000000..94a4050 --- /dev/null +++ b/pkgs/make.tcl @@ -0,0 +1,165 @@ +### +# This file contains instructions for how to build the Odielib library +# It will produce the following files in whatever directory it was called from: +# +# * odielibc.mk - A Makefile snippet needed to compile the odielib sources +# * odielibc.c - A C file which acts as the loader for odielibc +# * logicset.c/h - A c +# * (several .c and .h files) - C sources that are generated on the fly by automation +### +# Ad a "just in case" version or practcl we ship locally + +set ::CWD [pwd] +set ::project(builddir) $::CWD +set ::project(srcdir) [file dirname [file dirname [file normalize [info script]]]] +set ::project(sandbox) [file dirname $::project(srcdir)] +set ::project(download) [file join $::project(sandbox) download] +set ::project(teapot) [file join $::project(sandbox) teapot] +source [file join $::CWD .. library practcl practcl.tcl] +array set ::project [::practcl::config.tcl $CWD] + +set SRCPATH $::project(srcdir) +set SANDBOX $::project(sandbox) +file mkdir $CWD/build + +::practcl::target implement { + triggers {} +} +::practcl::target tcltk { + depends deps + triggers {script-packages script-pkgindex} +} +::practcl::target basekit { + depends {deps tcltk} + triggers {} + filename [file join $CWD tclkit_bare$::project(EXEEXT)] +} +::practcl::target packages { + depends {deps tcltk} +} +::practcl::target distclean {} +::practcl::target example { + depends basekit +} + +switch [lindex $argv 0] { + autoconf - + pre - + deps { + ::practcl::trigger implement + } + os { + puts "OS: [practcl::os]" + parray ::project + exit 0 + } + wrap { + ::practcl::depends basekit + } + all { + # Auto detect missing bits + foreach {item obj} $::make_objects { + if {[$obj check]} { + $obj trigger + } + } + } + package { + ::practcl::trigger packages + } + default { + ::practcl::trigger {*}$argv + } +} + +parray make + +set ::CWD [pwd] +::practcl::tclkit create BASEKIT {} +BASEKIT define set name tclkit +BASEKIT define set pkg_name tclkit +BASEKIT define set pkg_version 8.7.0a +BASEKIT define set localpath tclkit +BASEKIT define set profile devel +BASEKIT source [file join $::CWD packages.tcl] + +if {$make(distclean)} { + # Clean all source code back to it's pristine state from fossil + foreach item [BASEKIT link list package] { + $item go + set projdir [$item define get localsrcdir] + if {$projdir ne {} && [file exists $projdir]} { + fossil $projdir clean -force + } + } +} + +file mkdir [file join $CWD build] + +if {$make(tcltk)} { + ### + # Download our required packages + ### + set tcl_config_opts {} + set tk_config_opts {} + switch [::practcl::os] { + windows { + #lappend tcl_config_opts --disable-stubs + } + linux { + lappend tk_config_opts --enable-xft=no --enable-xss=no + } + macosx { + lappend tcl_config_opts --enable-corefoundation=yes --enable-framework=no + lappend tk_config_opts --enable-aqua=yes + } + } + lappend tcl_config_opts --with-tzdata --prefix [BASEKIT define get prefix] + BASEKIT project TCLCORE define set config_opts $tcl_config_opts + BASEKIT project TCLCORE go + set _TclSrcDir [BASEKIT project TCLCORE define get localsrcdir] + BASEKIT define set tclsrcdir $_TclSrcDir + lappend tk_config_opts --with-tcl=$_TclSrcDir + BASEKIT project TKCORE define set config_opts $tk_config_opts + BASEKIT project TCLCORE compile + BASEKIT project TKCORE compile +} + +if {$make(basekit)} { + BASEKIT implement $CWD + ::practcl::build::static-tclsh $target(basekit) BASEKIT +} + +if {[lindex $argv 0] eq "package"} { + #set result {} + foreach item [lrange $argv 1 end] { + set obj [BASEKIT project $item] + puts [list build $item [$obj define get static] [info object class $obj]] + if {[string is true [$obj define get static]]} { + $obj compile + } + if {[string is true [$obj define get vfsinstall]]} { + $obj install-vfs + } + } + #puts "RESULT: $result" +} elseif {$make(packages)} { + foreach item [BASEKIT link list package] { + if {[string is true [$item define get static]]} { + $item compile + } + if {[string is true [$item define get vfsinstall]]} { + $item install-vfs + } + } +} + + +if {$make(example)} { + file mkdir [file join $CWD example.vfs] + BASEKIT wrap $CWD example example.vfs +} + +if {[lindex $argv 0] eq "wrap"} { + BASEKIT wrap $CWD {*}[lrange $argv 1 end] +} diff --git a/pkgs/packages.tcl b/pkgs/packages.tcl new file mode 100644 index 0000000..2a84971 --- /dev/null +++ b/pkgs/packages.tcl @@ -0,0 +1,92 @@ +### +# This script implements a basic TclTkit with statically linked +# Tk, sqlite, threads, udp, and mmtk (which includes canvas3d and tkhtml) +### + +set CWD [pwd] + +my define set [array get ::project] +set os [::practcl::os] +my define set os $os +puts [list BASEKIT SANDBOX $::project(sandbox)] +my define set platform $::project(TEA_PLATFORM) +my define set prefix /zvfs +my define set sandbox [file normalize $::project(sandbox)] +my define set installdir [file join $::project(sandbox) pkg] +my define set teapot [file join $::project(sandbox) teapot] +my define set USEMSVC [info exists env(VisualStudioVersion)] +my define set prefix_broken_destdir [file join $::project(sandbox) tmp] +my define set HOST $os +my define set TARGET $os +my define set tclkit_bare [file join $CWD tclkit_bare$::project(EXEEXT)] + +my define set name tclkit +my define set output_c tclkit.c +my define set libs {} + +my add_project TCLCORE { + class subproject.core + name tcl + tag release + static 1 +} +my project TCLCORE define set srcdir [file dirname $::project(sandbox)] + +my add_project TKCORE { + class subproject.core + name tk + tag release + static 1 + autoload 0 + pkg_name Tk + initfunc Tk_Init +} + +my add_project tclconfig { + profile { + release: 3dfb97da548fae506374ac0015352ac0921d0cc9 + devel: practcl + } + class subproject + preload 1 + vfsinstall 0 +} + +my add_project thread { + profile { + release: 2a36d0a6c31569bfb3562e3d58e9e8204f447a7e + devel: practcl + } + class subproject.binary + pkg_name Thread + autoload 1 + initfunc Thread_Init + static 1 +} + +my add_project sqlite { + profile { + release: 40ffdfb26af3e7443b2912e1039c06bf9ed75846 + devel: practcl + } + class subproject.binary + pkg_name sqlite3 + autoload 1 + initfunc Sqlite3_Init + static 1 + vfsinstall 0 +} + +my add_project udp { + profile { + release: 7c396e1a767db57b07b48daa8e0cfc0ea622bbe9 + devel: practcl + } + class subproject.binary + static 1 + autoload 1 + initfunc Udp_Init + pkg_name udp + vfsinstall 0 +} + -- cgit v0.12 From e58a9dabbe2ced71aab80cdcb05f5db244dccd94 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sun, 2 Oct 2016 18:30:43 +0000 Subject: Typo fix for Makefile.in --- unix/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index ca15312..0a138ed 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -464,7 +464,7 @@ GENERIC_SRCS = \ $(GENERIC_DIR)/tclVar.c \ $(GENERIC_DIR)/tclAssembly.c \ $(GENERIC_DIR)/tclZlib.c \ - $(GENERIC_DIR)/zipfs.c + $(GENERIC_DIR)/tclZipfs.c OO_SRCS = \ $(GENERIC_DIR)/tclOO.c \ -- cgit v0.12 From 9dfe53af4ac9a368f01fd80c5c67fbe842d387df Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sun, 2 Oct 2016 18:42:56 +0000 Subject: Re-created the build mods for tip#340. Something I was doing was screwing with building a proper shell --- win/Makefile.in | 20 +++-------- win/makefile.vc | 8 ++--- win/tclkit.exe.manifest.in | 51 ---------------------------- win/tclkit.rc | 82 ---------------------------------------------- 4 files changed, 6 insertions(+), 155 deletions(-) delete mode 100644 win/tclkit.exe.manifest.in delete mode 100644 win/tclkit.rc diff --git a/win/Makefile.in b/win/Makefile.in index 7e371c8..b6533a4 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -152,7 +152,6 @@ SHARED_LIBRARIES = $(TCL_DLL_FILE) @ZLIB_DLL_FILE@ STATIC_LIBRARIES = $(TCL_LIB_FILE) TCLSH = tclsh$(VER)${EXESUFFIX} -TCLKIT = tclkit$(VER)${EXESUFFIX} CAT32 = cat32$(EXEEXT) MAN2TCL = man2tcl$(EXEEXT) @@ -303,8 +302,8 @@ GENERIC_OBJS = \ tclUtf.$(OBJEXT) \ tclUtil.$(OBJEXT) \ tclVar.$(OBJEXT) \ - tclZlib.$(OBJEXT) \ - tclZipfs.$(OBJEXT) + tclZipfs.$(OBJEXT) \ + tclZlib.$(OBJEXT) TOMMATH_OBJS = \ bncore.${OBJEXT} \ @@ -400,8 +399,6 @@ STUB_OBJS = \ TCLSH_OBJS = tclAppInit.$(OBJEXT) -TCLKIT_OBJS = tclkitMain.${OBJEXT} tclkit.${OBJEXT} - ZLIB_OBJS = \ adler32.$(OBJEXT) \ compress.$(OBJEXT) \ @@ -423,7 +420,7 @@ all: binaries libraries doc packages tcltest: $(TCLSH) $(TEST_DLL_FILE) -binaries: $(TCL_STUB_LIB_FILE) @LIBRARIES@ winextensions $(TCLSH) $(TCLKIT) +binaries: $(TCL_STUB_LIB_FILE) @LIBRARIES@ winextensions $(TCLSH) winextensions: ${DDE_DLL_FILE} ${REG_DLL_FILE} @@ -436,11 +433,6 @@ $(TCLSH): $(TCLSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) @VC_MANIFEST_EMBED_EXE@ -$(TCLKIT): $(TCLKIT_OBJ) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) - $(CC) $(CFLAGS) $(TCLKIT_OBJ) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ - tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) - @VC_MANIFEST_EMBED_EXE@ - cat32.$(OBJEXT): cat.c $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) @@ -504,9 +496,6 @@ testMain.${OBJEXT}: tclAppInit.c tclMain2.${OBJEXT}: tclMain.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_ASCII_MAIN @DEPARG@ $(CC_OBJNAME) -tclkitMain.${OBJEXT}: tclAppInit.c - $(CC) -c $(CC_SWITCHES) -DTCL_LOCAL_MAIN_HOOK="Tclkit_MainHook" -DTCL_LOCAL_APPINIT="Tclkit_AppInit" @DEPARG@ $(CC_OBJNAME) - # TIP #59, embedding of configuration information into the binary library. # # Part of Tcl's configuration information are the paths where it was installed @@ -647,7 +636,6 @@ install-libraries: libraries install-tzdata install-msgs @echo "Installing header files"; @for i in "$(GENERIC_DIR)/tcl.h" "$(GENERIC_DIR)/tclDecls.h" \ "$(GENERIC_DIR)/tclOO.h" "$(GENERIC_DIR)/tclOODecls.h" \ - "$(GENERIC_DIR)/tclZipfs.h" \ "$(GENERIC_DIR)/tclPlatDecls.h" \ "$(GENERIC_DIR)/tclTomMath.h" \ "$(GENERIC_DIR)/tclTomMathDecls.h"; \ @@ -762,7 +750,7 @@ clean: cleanhelp clean-packages distclean: distclean-packages clean $(RM) Makefile config.status config.cache config.log tclConfig.sh \ - tcl.hpj config.status.lineno tclsh.exe.manifest + tcl.hpj config.status.lineno # # Bundled package targets diff --git a/win/makefile.vc b/win/makefile.vc index d360e67..dd7b061 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -344,8 +344,8 @@ COREOBJS = \ $(TMP_DIR)\tclUtf.obj \ $(TMP_DIR)\tclUtil.obj \ $(TMP_DIR)\tclVar.obj \ - $(TMP_DIR)\tclZlib.obj \ - $(TMP_DIR)\tclZipfs.obj + $(TMP_DIR)\tclZipfs.obj \ + $(TMP_DIR)\tclZlib.obj ZLIBOBJS = \ $(TMP_DIR)\adler32.obj \ @@ -945,9 +945,6 @@ $(TMP_DIR)\tclWinTest.obj: $(WINDIR)\tclWinTest.c $(TMP_DIR)\tclZlib.obj: $(GENERICDIR)\tclZlib.c $(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -DBUILD_tcl -Fo$@ $? -$(TMP_DIR)\zipfs.obj: $(GENERICDIR)\zipfs.c - $(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -DBUILD_tcl -Fo$@ $? - $(TMP_DIR)\tclPkgConfig.obj: $(GENERICDIR)\tclPkgConfig.c $(cc32) -DBUILD_tcl $(TCL_CFLAGS) \ -DCFG_INSTALL_LIBDIR="\"$(LIB_INSTALL_DIR:\=\\)\"" \ @@ -1121,7 +1118,6 @@ install-libraries: tclConfig install-msgs install-tzdata @$(CPY) "$(GENERICDIR)\tclDecls.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclOO.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclOODecls.h" "$(INCLUDE_INSTALL_DIR)\" - @$(CPY) "$(GENERICDIR)\tclZipfs.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclPlatDecls.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclTomMath.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclTomMathDecls.h" "$(INCLUDE_INSTALL_DIR)\" diff --git a/win/tclkit.exe.manifest.in b/win/tclkit.exe.manifest.in deleted file mode 100644 index 13c1d24..0000000 --- a/win/tclkit.exe.manifest.in +++ /dev/null @@ -1,51 +0,0 @@ - - - - Tcl self-contained executable (tclkit) - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - diff --git a/win/tclkit.rc b/win/tclkit.rc deleted file mode 100644 index ebe37e1..0000000 --- a/win/tclkit.rc +++ /dev/null @@ -1,82 +0,0 @@ -// -// Version Resource Script -// - -#include -#include - -// -// build-up the name suffix that defines the type of build this is. -// -#if TCL_THREADS -#define SUFFIX_THREADS "t" -#else -#define SUFFIX_THREADS "" -#endif - -#if STATIC_BUILD -#define SUFFIX_STATIC "s" -#else -#define SUFFIX_STATIC "" -#endif - -#if DEBUG && !UNCHECKED -#define SUFFIX_DEBUG "g" -#else -#define SUFFIX_DEBUG "" -#endif - -#define SUFFIX SUFFIX_THREADS SUFFIX_STATIC SUFFIX_DEBUG - - -LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */ - -VS_VERSION_INFO VERSIONINFO - FILEVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL - PRODUCTVERSION TCL_MAJOR_VERSION,TCL_MINOR_VERSION,TCL_RELEASE_LEVEL,TCL_RELEASE_SERIAL - FILEFLAGSMASK 0x3fL -#ifdef DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "FileDescription", "Tclkit Application\0" - VALUE "OriginalFilename", "tclkit" STRINGIFY(TCL_MAJOR_VERSION) STRINGIFY(TCL_MINOR_VERSION) SUFFIX ".exe\0" - VALUE "CompanyName", "ActiveState Corporation\0" - VALUE "FileVersion", TCL_PATCH_LEVEL - VALUE "LegalCopyright", "Copyright \251 2000 by ActiveState Corporation, et al\0" - VALUE "ProductName", "Tcl " TCL_VERSION " for Windows\0" - VALUE "ProductVersion", TCL_PATCH_LEVEL - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -// -// Icon -// - -tclsh ICON DISCARDABLE "tclsh.ico" - -// -// This is needed for Windows 8.1 onwards. -// - -#ifndef RT_MANIFEST -#define RT_MANIFEST 24 -#endif -#ifndef CREATEPROCESS_MANIFEST_RESOURCE_ID -#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 -#endif -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "tclkit.exe.manifest" -- cgit v0.12 From cdb6b73776ae7e1c7680e33cbf9ea809a7bc5825 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 25 Nov 2016 15:44:43 +0000 Subject: =?UTF-8?q?Implementation=20of=20improved=20notifier=20from=20Luci?= =?UTF-8?q?o=20Andr=C3=A9s=20Illanes=20Albornoz.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unix/configure | 60 ++++ unix/configure.ac | 28 ++ unix/tclUnixNotfy.c | 768 ++++++++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 800 insertions(+), 56 deletions(-) diff --git a/unix/configure b/unix/configure index baea1f1..14f88f3 100755 --- a/unix/configure +++ b/unix/configure @@ -8439,6 +8439,66 @@ $as_echo "#define NO_FD_SET 1" >>confdefs.h fi +#----------------------------------------------------------------------------- +# Options for the notifier. Checks for epoll(7) on Linux, and kqueue(2) +# on FreeBSD. +#----------------------------------------------------------------------------- + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for advanced notifier support" >&5 +$as_echo_n "checking for advanced notifier support... " >&6; } +case x`uname -s` in + xLinux) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: epoll(7)" >&5 +$as_echo "epoll(7)" >&6; } + for ac_header in sys/epoll.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/epoll.h" "ac_cv_header_sys_epoll_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_epoll_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_EPOLL_H 1 +_ACEOF + +$as_echo "#define HAVE_EPOLL 1" >>confdefs.h + +fi + +done +;; + xFreeBSD) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: kqueue(2)" >&5 +$as_echo "kqueue(2)" >&6; } + # Messy because we want to check if *all* the headers are present, and not + # just *any* + tcl_kqueue_headers=x + for ac_header in sys/types.h sys/event.h sys/time.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + tcl_kqueue_headers=${tcl_kqueue_headers}y +fi + +done + + if test $tcl_kqueue_headers = xyyy; then : + + +$as_echo "#define HAVE_KQUEUE 1" >>confdefs.h + +fi;; + xDarwin) + # Assume that we've got CoreFoundation present (checked elsewhere because + # of wider impact). + { $as_echo "$as_me:${as_lineno-$LINENO}: result: OSX" >&5 +$as_echo "OSX" >&6; };; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; };; +esac + #------------------------------------------------------------------------------ # Find out all about time handling differences. #------------------------------------------------------------------------------ diff --git a/unix/configure.ac b/unix/configure.ac index bafb970..2389ab0 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -300,6 +300,34 @@ if test $tcl_ok = no; then AC_DEFINE(NO_FD_SET, 1, [Do we have fd_set?]) fi +#----------------------------------------------------------------------------- +# Options for the notifier. Checks for epoll(7) on Linux, and kqueue(2) +# on FreeBSD. +#----------------------------------------------------------------------------- + +AC_MSG_CHECKING([for advanced notifier support]) +case x`uname -s` in + xLinux) + AC_MSG_RESULT([epoll(7)]) + AC_CHECK_HEADERS([sys/epoll.h], + [AC_DEFINE(HAVE_EPOLL, [1], [Is epoll(7) supported?])]);; + xFreeBSD) + AC_MSG_RESULT([kqueue(2)]) + # Messy because we want to check if *all* the headers are present, and not + # just *any* + tcl_kqueue_headers=x + AC_CHECK_HEADERS([sys/types.h sys/event.h sys/time.h], + [tcl_kqueue_headers=${tcl_kqueue_headers}y]) + AS_IF([test $tcl_kqueue_headers = xyyy], [ + AC_DEFINE(HAVE_KQUEUE, [1], [Is kqueue(2) supported?])]);; + xDarwin) + # Assume that we've got CoreFoundation present (checked elsewhere because + # of wider impact). + AC_MSG_RESULT([OSX]);; + *) + AC_MSG_RESULT([none]);; +esac + #------------------------------------------------------------------------------ # Find out all about time handling differences. #------------------------------------------------------------------------------ diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index e37962d..485f6f7 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -1,9 +1,10 @@ /* * tclUnixNotfy.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. + * This file contains the implementation of the Unix-specific notifier, + * based on select()/epoll()/kqueue() depending on platform, 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. * @@ -15,12 +16,25 @@ #ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is * in tclMacOSXNotify.c */ #include +#if defined(HAVE_EPOLL) +# include +#elif defined(HAVE_KQUEUE) +# include +# include +# include +#endif /* * This structure is used to keep track of the notifier info for a registered * file. */ +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) +struct PlatformEventData; +#undef USE_SELECT_FOR_NOTIFIER +#else +#define USE_SELECT_FOR_NOTIFIER 1 +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ typedef struct FileHandler { int fd; int mask; /* Mask of desired events: TCL_READABLE, @@ -32,8 +46,41 @@ typedef struct FileHandler { * Tcl_CreateFileHandler. */ ClientData clientData; /* Argument to pass to proc. */ struct FileHandler *nextPtr;/* Next in list of all files we care about. */ +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + struct PlatformEventData *platformEventData; + /* Pointer associating the platform-specific + * event structures with {file,tsd}Ptrs. */ + int platformReadyMask; /* Platform-specific mask of ready events. */ +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ } FileHandler; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) +/* + * The following structure is associated with a FileHandler through platform- + * specific event structures (currently either struct epoll_event or kevent) + * whenever Tcl_CreateFileHandler or Tcl_DeleteFileHandler are called. + * It contains a FileHandler and a ThreadSpecificData pointer in order to + * update readyMask and to alert waiting threads. + */ + +struct ThreadSpecificData; +struct PlatformEventData { + FileHandler *filePtr; + struct ThreadSpecificData *tsdPtr; +}; +#else /* !(HAVE_EPOLL || HAVE_KQUEUE) */ +/* + * The following structure contains a set of select() masks to track readable, + * writable, and exception conditions. + */ + +typedef struct { + fd_set readable; + fd_set writable; + fd_set exception; +} SelectMasks; +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ + /* * The following structure is what is added to the Tcl event queue when file * handlers are ready to fire. @@ -50,17 +97,6 @@ typedef struct { } FileHandlerEvent; /* - * The following structure contains a set of select() masks to track readable, - * writable, and exception conditions. - */ - -typedef struct { - fd_set readable; - fd_set writable; - fd_set exception; -} 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. @@ -69,6 +105,7 @@ typedef struct { typedef struct ThreadSpecificData { FileHandler *firstFileHandlerPtr; /* Pointer to head of file handler list. */ +#ifdef USE_SELECT_FOR_NOTIFIER 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 @@ -79,6 +116,7 @@ typedef struct ThreadSpecificData { int numFdBits; /* Number of valid bits in checkMasks (one * more than highest fd for which * Tcl_WatchFile has been called). */ +#endif /* USE_SELECT_FOR_NOTIFIER */ #ifdef TCL_THREADS int onList; /* True if it is in this list */ unsigned int pollState; /* pollState is used to implement a polling @@ -169,10 +207,11 @@ static int notifierThreadRunning = 0; static pthread_cond_t notifierCV = PTHREAD_COND_INITIALIZER; /* - * 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 + * The pollState bits. + * + * POLL_WANT: Set by each thread before it waits on its condition variable. + * It is checked by the notifier before it does select. + * POLL_DONE: 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. */ @@ -185,8 +224,29 @@ static pthread_cond_t notifierCV = PTHREAD_COND_INITIALIZER; */ static Tcl_ThreadId notifierThread; - #endif /* TCL_THREADS */ +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) +/* + * This is the file descriptor for the platform-specific events mechanism + * (currently either epoll_{ctl,wait} or kevent). + */ + +static int eventsFd; + +/* + * This array reflects the readable/writable/error event conditions that + * were found to exist by the last call to the platform-specific events + * mechanism (currently either epoll_wait or kevent) in NotifierThreadProc. + * maxReadyEvents specifies the maximum number of epoll_events in readyEvents. + */ + +#if defined(HAVE_EPOLL) +static struct epoll_event *readyEvents; +#elif defined(HAVE_KQUEUE) +static struct kevent *readyEvents; +#endif /* HAVE_EPOLL */ +static int maxReadyEvents; +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ /* * Static routines defined in this file. @@ -256,6 +316,28 @@ static const WCHAR className[] = L"TclNotifier"; static DWORD __stdcall NotifierProc(void *hwnd, unsigned int message, void *wParam, void *lParam); #endif /* TCL_THREADS && __CYGWIN__ */ + +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) +#define PLATFORMEVENTSCONTROL_ADD 0x01 +#define PLATFORMEVENTSCONTROL_DEL 0x02 +#define PLATFORMEVENTSCONTROL_MOD 0x04 +#define PLATFORMEVENTSCONTROL_AUTO_MASK 0x10 +static void PlatformEventsControl(FileHandler *filePtr, + ThreadSpecificData *tsdPtr, int op, int mask); +static void PlatformEventsFinalize(void); +static int PlatformEventsGet(int numEvent_last, + int numReadyEvents, int skipFd, int wantFd, + int onList); +static void PlatformEventsInit(void); +static int PlatformEventsTranslate(FileHandler *filePtr); +#if defined(HAVE_EPOLL) +static int PlatformEventsWait(struct epoll_event *events, + int numEvents, struct timeval *timePtr); +#elif defined(HAVE_KQUEUE) +static int PlatformEventsWait(struct kevent *events, + int numEvents, struct timeval *timePtr); +#endif /* HAVE_EPOLL */ +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ #if TCL_THREADS /* @@ -273,8 +355,10 @@ static DWORD __stdcall NotifierProc(void *hwnd, unsigned int message, * *---------------------------------------------------------------------- */ + static void -StartNotifierThread(const char *proc) +StartNotifierThread( + const char *proc) { if (!notifierThreadRunning) { pthread_mutex_lock(¬ifierInitMutex); @@ -285,6 +369,7 @@ StartNotifierThread(const char *proc) } pthread_mutex_lock(¬ifierMutex); + /* * Wait for the notifier pipe to be created. */ @@ -325,6 +410,9 @@ Tcl_InitNotifier(void) } else { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + PlatformEventsInit(); +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ #ifdef TCL_THREADS tsdPtr->eventReady = 0; @@ -443,6 +531,9 @@ Tcl_FinalizeNotifier( } notifierThreadRunning = 0; } +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + PlatformEventsFinalize(); +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ } } @@ -571,6 +662,360 @@ Tcl_ServiceModeHook( } } +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) +/* + *---------------------------------------------------------------------- + * + * PlatformEventsControl -- + * + * This function abstracts adding, modifying, or deleting a file + * descriptor and its associated FileHandler and ThreadSpecificData + * pointers from an epoll or kqueue fd via either epoll_ctl or kevent. + * + * Results: + * None. + * + * Side effects: + * If successful, a file descriptor is added, deleted, or modified from + * the epoll on Linux and kqueue on FreeBSD fd. + * + *---------------------------------------------------------------------- + */ + +void +PlatformEventsControl( + FileHandler *filePtr, + ThreadSpecificData *tsdPtr, + int op, + int mask) +{ +#if defined(HAVE_EPOLL) + struct epoll_event event; + int epollOp; +#elif defined(HAVE_KQUEUE) + int numEvents; + struct kevent event[2]; + int keventOp; +#endif /* HAVE_EPOLL */ + struct PlatformEventData *platformEventData; + + if (op & PLATFORMEVENTSCONTROL_AUTO_MASK) { + mask = filePtr->mask; + op &= ~PLATFORMEVENTSCONTROL_AUTO_MASK; + } + if (op == PLATFORMEVENTSCONTROL_ADD) { + platformEventData = ckalloc(sizeof(*platformEventData)); + platformEventData->filePtr = filePtr; + platformEventData->tsdPtr = tsdPtr; + filePtr->platformEventData = platformEventData; + } else { + platformEventData = filePtr->platformEventData; + } + filePtr->platformReadyMask = 0; + +#if defined(HAVE_EPOLL) + event.events = EPOLLET; + if (mask & TCL_READABLE) { + event.events |= EPOLLIN; + } + if (mask & TCL_WRITABLE) { + event.events |= EPOLLOUT; + } + if (mask & TCL_EXCEPTION) { + event.events |= EPOLLERR; + } + event.data.ptr = platformEventData; + if (op == PLATFORMEVENTSCONTROL_ADD) { + epollOp = EPOLL_CTL_ADD; + } else if (op == PLATFORMEVENTSCONTROL_DEL) { + epollOp = EPOLL_CTL_DEL; + } else if (op == PLATFORMEVENTSCONTROL_MOD) { + epollOp = EPOLL_CTL_MOD; + } + if (epoll_ctl(eventsFd, epollOp, filePtr->fd, &event) == -1) { + Tcl_Panic("epoll_ctl: %s", strerror(errno)); + } +#elif defined(HAVE_KQUEUE) + + numEvents = 0; + keventOp = 0; + if (op == PLATFORMEVENTSCONTROL_ADD) { + keventOp = EV_ADD; + } else if (op == PLATFORMEVENTSCONTROL_DEL) { + keventOp = EV_DELETE; + } else if (op == PLATFORMEVENTSCONTROL_MOD) { + keventOp = EV_ADD; + } + keventOp |= EV_CLEAR; + if ((mask & TCL_READABLE) || (mask & TCL_EXCEPTION)) { + EV_SET(&event[numEvents], filePtr->fd, EVFILT_READ, keventOp, 0, 0, + platformEventData); + numEvents++; + } + if (mask & TCL_WRITABLE) { + EV_SET(&event[numEvents], filePtr->fd, EVFILT_WRITE, keventOp, 0, 0, + platformEventData); + numEvents++; + } + if (kevent(eventsFd, event, numEvents, NULL, 0, NULL) == -1) { + Tcl_Panic("kevent: %s", strerror(errno)); + } +#endif /* HAVE_EPOLL */ +} + +/* + *---------------------------------------------------------------------- + * + * PlatformEventsFinalize -- + * + * This function abstracts closing the epoll on Linux and kqueue on + * FreeBSD file descriptor and freeing its associated array of returned + * events. + * + * Results: + * None. + * + * Side effects: + * The epoll or kqueue fd is closed if non-zero. The array of returned + * events is freed if non_NULL. + * + *---------------------------------------------------------------------- + */ + +void +PlatformEventsFinalize(void) +{ + if (eventsFd > 0) { + close(eventsFd); + eventsFd = 0; + } + if (readyEvents) { + ckfree(readyEvents); + maxReadyEvents = 0; + } +} + +/* + *---------------------------------------------------------------------- + * + * PlatformEventsGet -- + * + * This function abstracts iterating over the array of returned events + * since the last call to PlatformEventsWait(). If skipFd and/or wantFd + * are non-zero, the specified file descriptor will be skipped or hunted + * for respectively. If onList is non-zero, the ThreadSpecificData asso- + * ciated with the current event must specify a non-zero onList flag. + * + * Results: + * Returns -1 if there were no or no eligible events. Returns the index + * of the event in the array of returned events in all other cases. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +PlatformEventsGet( + int numEvent_last, + int numReadyEvents, + int skipFd, + int wantFd, + int onList) +{ + int numEvent; + struct PlatformEventData *platformEventData; + + for (numEvent = numEvent_last; numEvent < numReadyEvents; numEvent++) { +#if defined(HAVE_EPOLL) + platformEventData = readyEvents[numEvent].data.ptr; +#elif defined(HAVE_KQUEUE) + platformEventData = readyEvents[numEvent].udata; +#endif /* HAVE_EPOLL */ + if (!platformEventData) { + continue; + } else if (!platformEventData->filePtr) { + continue; + } else if (!platformEventData->tsdPtr) { + continue; + } else if (skipFd && (platformEventData->filePtr->fd == skipFd)) { + continue; + } else if (wantFd && (platformEventData->filePtr->fd != wantFd)) { + continue; + } else if (onList && !platformEventData->tsdPtr->onList) { + continue; + } else { + return numEvent; + } + } + return -1; +} + +/* + *---------------------------------------------------------------------- + * + * PlatformEventsInit -- + * This function abstracts creating an epoll fd on Linux and a kqueue + * fd on FreeBSD via epoll_create and kqueue system calls respectively. + * + * Results: + * None. + * + * Side effects: + * The epoll or kqueue fd is created if zero. The array of returned + * events is allocated and initialised with space for 128 events if zero. + * + *---------------------------------------------------------------------- + */ + +void +PlatformEventsInit(void) +{ +#if defined(HAVE_EPOLL) + if (eventsFd <= 0) { + eventsFd = epoll_create1(EPOLL_CLOEXEC); + if (eventsFd == -1) { + Tcl_Panic("epoll_create1: %s", strerror(errno)); + } + } +#elif defined(HAVE_KQUEUE) + if (eventsFd <= 0) { + eventsFd = kqueue(); + if (eventsFd == -1) { + Tcl_Panic("kqueue: %s", strerror(errno)); + } + } +#endif /* HAVE_EPOLL */ + if (!readyEvents) { + maxReadyEvents = 128; + readyEvents = ckalloc(maxReadyEvents * sizeof(readyEvents[0])); + } +} + +/* + *---------------------------------------------------------------------- + * + * PlatformEventsTranslate -- + * This function translates the platform-specific mask of returned events + * in and specific to a FileHandler to TCL_{READABLE,WRITABLE,EXCEPTION} + * bits. + * + * Results: + * Returns the translated and thus platform-independent mask. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +PlatformEventsTranslate( + FileHandler *filePtr) +{ + int mask; + + mask = 0; +#if defined(HAVE_EPOLL) + if (filePtr->platformReadyMask & EPOLLIN) { + mask |= TCL_READABLE; + } + if (filePtr->platformReadyMask & EPOLLOUT) { + mask |= TCL_WRITABLE; + } + if (filePtr->platformReadyMask & EPOLLERR) { + mask |= TCL_EXCEPTION; + } +#elif defined(HAVE_KQUEUE) + if (filePtr->platformReadyMask & EVFILT_READ) { + mask |= TCL_READABLE; + } + if (filePtr->platformReadyMask & EVFILT_WRITE) { + mask |= TCL_WRITABLE; + } +#endif /* HAVE_EPOLL */ + return mask; +} + +/* + *---------------------------------------------------------------------- + * + * PlatformEventsWait -- + * This function abstracts waiting for I/O events via either epoll_ctl(2) + * on Linux or kevent(2) on FreeBSD. + * + * Results: + * Returns -1 if epoll_ctl(2)/kevent(2) failed. Returns 0 if polling + * and if no events became available whilst polling. Returns a pointer + * to and the count of all returned events in all other cases. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +PlatformEventsWait( +#if defined(HAVE_EPOLL) + struct epoll_event *events, +#elif defined(HAVE_KQUEUE) + struct kevent *events, +#endif /* HAVE_EPOLL */ + int numEvents, + struct timeval *timePtr) +{ + int numFound; + struct timeval tv0, tv1, tv_delta; +#if defined(HAVE_EPOLL) + int timeout; +#elif defined(HAVE_KQUEUE) + struct timespec timeout, *timeoutPtr; +#endif /* HAVE_EPOLL */ + + bzero(events, numEvents * sizeof(events[0])); +#if defined(HAVE_EPOLL) + if (!timePtr) { + timeout = -1; + } else if (!timePtr->tv_sec && !timePtr->tv_usec) { + timeout = 0; + } else { + timeout = timePtr->tv_sec; + } + gettimeofday(&tv0, NULL); + numFound = epoll_wait(eventsFd, events, numEvents, timeout); + gettimeofday(&tv1, NULL); + +#elif defined(HAVE_KQUEUE) + if (!timePtr) { + timeoutPtr = NULL; + } else if (!timePtr->tv_sec && !timePtr->tv_usec) { + timeout.tv_sec = 0; + timeout.tv_nsec = 0; + timeoutPtr = &timeout; + } else { + timeout.tv_sec = timePtr->tv_sec; + timeout.tv_nsec = timePtr->tv_usec * 1000; + timeoutPtr = &timeout; + } + gettimeofday(&tv0, NULL); + numFound = kevent(eventsFd, NULL, 0, events, numEvents, timeoutPtr); + gettimeofday(&tv1, NULL); +#endif /* HAVE_EPOLL */ + + if (timePtr) { + timersub(&tv1, &tv0, &tv_delta); + timersub(&tv_delta, timePtr, timePtr); + } + if (numFound == -1) { + bzero(events, numEvents * sizeof(events[0])); + return -1; + } + return numFound; +} +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ + /* *---------------------------------------------------------------------- * @@ -598,6 +1043,10 @@ Tcl_CreateFileHandler( * event. */ ClientData clientData) /* Arbitrary data to pass to proc. */ { +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + int is_new; +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ + if (tclNotifierHooks.createFileHandlerProc) { tclNotifierHooks.createFileHandlerProc(fd, mask, proc, clientData); return; @@ -617,11 +1066,29 @@ Tcl_CreateFileHandler( filePtr->readyMask = 0; filePtr->nextPtr = tsdPtr->firstFileHandlerPtr; tsdPtr->firstFileHandlerPtr = filePtr; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + is_new = 1; + } else { + is_new = 0; +#endif /* HAVE_EPOLL */ } filePtr->proc = proc; filePtr->clientData = clientData; filePtr->mask = mask; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + if (eventsFd) { + if (is_new) { + PlatformEventsControl(filePtr, tsdPtr, + PLATFORMEVENTSCONTROL_ADD + | PLATFORMEVENTSCONTROL_AUTO_MASK, 0); + } else { + PlatformEventsControl(filePtr, tsdPtr, + PLATFORMEVENTSCONTROL_MOD + | PLATFORMEVENTSCONTROL_AUTO_MASK, 0); + } + } +#else /* * Update the check masks for this file. */ @@ -644,6 +1111,7 @@ Tcl_CreateFileHandler( if (tsdPtr->numFdBits <= fd) { tsdPtr->numFdBits = fd+1; } +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ } } @@ -673,7 +1141,9 @@ Tcl_DeleteFileHandler( return; } else { FileHandler *filePtr, *prevPtr; +#ifdef USE_SELECT_FOR_NOTIFIER int i; +#endif /* USE_SELECT_FOR_NOTIFIER */ ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); /* @@ -694,6 +1164,15 @@ Tcl_DeleteFileHandler( * Update the check masks for this file. */ +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + if (eventsFd) { + PlatformEventsControl(filePtr, tsdPtr, PLATFORMEVENTSCONTROL_DEL + | PLATFORMEVENTSCONTROL_AUTO_MASK, 0); + } + if (filePtr->platformEventData) { + ckfree(filePtr->platformEventData); + } +#else if (filePtr->mask & TCL_READABLE) { FD_CLR(fd, &tsdPtr->checkMasks.readable); } @@ -721,6 +1200,7 @@ Tcl_DeleteFileHandler( } tsdPtr->numFdBits = numFdBits; } +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ /* * Clean up information in the callback record. @@ -950,7 +1430,11 @@ Tcl_WaitForEvent( tsdPtr->pollState = POLL_WANT; timePtr = NULL; } else { +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + waitForFiles = 1; +#else waitForFiles = (tsdPtr->numFdBits > 0); +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ tsdPtr->pollState = 0; } @@ -975,9 +1459,11 @@ Tcl_WaitForEvent( } } +#ifdef USE_SELECT_FOR_NOTIFIER FD_ZERO(&tsdPtr->readyMasks.readable); FD_ZERO(&tsdPtr->readyMasks.writable); FD_ZERO(&tsdPtr->readyMasks.exception); +#endif /* USE_SELECT_FOR_NOTIFIER */ if (!tsdPtr->eventReady) { #ifdef __CYGWIN__ @@ -993,7 +1479,7 @@ Tcl_WaitForEvent( MsgWaitForMultipleObjects(1, &tsdPtr->event, 0, timeout, 1279); pthread_mutex_lock(¬ifierMutex); } -#else +#else /* !__CYGWIN__ */ if (timePtr != NULL) { Tcl_Time now; struct timespec ptime; @@ -1054,6 +1540,10 @@ Tcl_WaitForEvent( } #else +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + tsdPtr->numReadyEvents = PlatformEventsWait(readyEvents, + maxReadyEvents, timeoutPtr); +#else tsdPtr->readyMasks = tsdPtr->checkMasks; numFound = select(tsdPtr->numFdBits, &tsdPtr->readyMasks.readable, &tsdPtr->readyMasks.writable, &tsdPtr->readyMasks.exception, @@ -1069,6 +1559,7 @@ Tcl_WaitForEvent( FD_ZERO(&tsdPtr->readyMasks.writable); FD_ZERO(&tsdPtr->readyMasks.exception); } +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ #endif /* TCL_THREADS */ /* @@ -1077,6 +1568,9 @@ Tcl_WaitForEvent( for (filePtr = tsdPtr->firstFileHandlerPtr; (filePtr != NULL); filePtr = filePtr->nextPtr) { +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + mask = PlatformEventsTranslate(filePtr); +#else mask = 0; if (FD_ISSET(filePtr->fd, &tsdPtr->readyMasks.readable)) { mask |= TCL_READABLE; @@ -1087,6 +1581,7 @@ Tcl_WaitForEvent( if (FD_ISSET(filePtr->fd, &tsdPtr->readyMasks.exception)) { mask |= TCL_EXCEPTION; } +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ if (!mask) { continue; @@ -1106,6 +1601,9 @@ Tcl_WaitForEvent( Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL); } filePtr->readyMask = mask; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + filePtr->platformReadyMask = 0; +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ } #ifdef TCL_THREADS pthread_mutex_unlock(¬ifierMutex); @@ -1118,6 +1616,56 @@ Tcl_WaitForEvent( /* *---------------------------------------------------------------------- * + * AlertSingleThread -- + * + * Notify a single thread that is waiting on a file descriptor to become + * readable or writable or to have an exception condition. + * notifierMutex must be held. + * + * Result: + * None. + * + * Side effects: + * The condition variable associated with the thread is broadcasted. + * + *---------------------------------------------------------------------- + */ + +static void +AlertSingleThread( + ThreadSpecificData *tsdPtr) +{ + 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; + } +#ifdef __CYGWIN__ + PostMessageW(tsdPtr->hwnd, 1024, 0, 0); +#else /* __CYGWIN__ */ + pthread_cond_broadcast(&tsdPtr->waitCV); +#endif /* __CYGWIN__ */ +} + +/* + *---------------------------------------------------------------------- + * * NotifierThreadProc -- * * This routine is the initial (and only) function executed by the @@ -1144,14 +1692,23 @@ NotifierThreadProc( ClientData clientData) /* Not used. */ { ThreadSpecificData *tsdPtr; +#ifdef USE_SELECT_FOR_NOTIFIER fd_set readableMask; fd_set writableMask; fd_set exceptionMask; - int fds[2]; - int i, numFdBits = 0, receivePipe; +#endif /* USE_SELECT_FOR_NOTIFIER */ + int i; + int fds[2], receivePipe; long found; struct timeval poll = {0., 0.}, *timePtr; char buf[2]; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + int numReadyEvents, numEvent; + FileHandler *filePtr_rP; + struct PlatformEventData *eventDataPtr; +#else + int numFdBits = 0; +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ if (pipe(fds) != 0) { Tcl_Panic("NotifierThreadProc: %s", "could not create trigger pipe"); @@ -1183,6 +1740,19 @@ NotifierThreadProc( pthread_mutex_lock(¬ifierMutex); triggerPipe = fds[1]; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + /* + * Set up the epoll/kqueue fd to include the receive pipe. + */ + + filePtr_rP = ckalloc(sizeof(*filePtr_rP)); + filePtr_rP->fd = receivePipe; + tsdPtr = TCL_TSD_INIT(&dataKey); + PlatformEventsControl(filePtr_rP, tsdPtr, PLATFORMEVENTSCONTROL_ADD, + TCL_READABLE); + tsdPtr = NULL; +#endif /* HAVE_EPOLL || HAVE_KQUEUE*/ + /* * Signal any threads that are waiting. */ @@ -1195,12 +1765,28 @@ NotifierThreadProc( */ while (1) { +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + pthread_mutex_lock(¬ifierMutex); + timePtr = NULL; + for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) { + 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; + } + } + pthread_mutex_unlock(¬ifierMutex); +#else FD_ZERO(&readableMask); FD_ZERO(&writableMask); FD_ZERO(&exceptionMask); /* - * Compute the logical OR of the select masks from all the waiting + * Compute the logical OR of the masks from all the waiting * notifiers. */ @@ -1232,16 +1818,29 @@ NotifierThreadProc( } } pthread_mutex_unlock(¬ifierMutex); - +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ +#ifdef USE_SELECT_FOR_NOTIFIER /* - * Set up the select mask to include the receive pipe. + * Set up the mask to include the receive pipe. */ if (receivePipe >= numFdBits) { numFdBits = receivePipe + 1; } FD_SET(receivePipe, &readableMask); +#endif /* USE_SELECT_FOR_NOTIFIER */ +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + numReadyEvents = PlatformEventsWait(readyEvents, maxReadyEvents, + timePtr); + if (numReadyEvents == -1) { + /* + * Try again immediately on an error. + */ + numReadyEvents = 0; + continue; + } +#else if (select(numFdBits, &readableMask, &writableMask, &exceptionMask, timePtr) == -1) { /* @@ -1250,12 +1849,53 @@ NotifierThreadProc( continue; } +#endif /* HAVE_EPOLL || HAVE_KQUEUE*/ /* * Alert any threads that are waiting on a ready file descriptor. */ pthread_mutex_lock(¬ifierMutex); + numEvent = 0; +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) { + if (tsdPtr->pollState & POLL_DONE) { + AlertSingleThread(tsdPtr); + } + } + while (1) { + numEvent = PlatformEventsGet(numEvent, numReadyEvents, + receivePipe, 0, 1); + if (numEvent == -1) { + break; + } +#if defined(HAVE_EPOLL) + eventDataPtr = readyEvents[numEvent].data.ptr; + eventDataPtr->filePtr->platformReadyMask = + readyEvents[numEvent].events; +#elif defined(HAVE_KQUEUE) + eventDataPtr = readyEvents[numEvent].udata; + if (readyEvents[numEvent].filter == EVFILT_READ) { + if (readyEvents[numEvent].flags & (EV_EOF | EV_ERROR)) { + eventDataPtr->filePtr->platformReadyMask |= EV_ERROR; + } else { + eventDataPtr->filePtr->platformReadyMask + |= EVFILT_READ; + } + } + if (readyEvents[numEvent].filter == EVFILT_WRITE) { + if (readyEvents[numEvent].flags & (EV_EOF | EV_ERROR)) { + eventDataPtr->filePtr->platformReadyMask |= EV_ERROR; + } else { + eventDataPtr->filePtr->platformReadyMask + |= EVFILT_WRITE; + } + } +#endif /* HAVE_EPOLL */ + numEvent++; + found = 1; + tsdPtr = eventDataPtr->tsdPtr; +#else for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) { found = 0; @@ -1276,34 +1916,10 @@ NotifierThreadProc( found = 1; } } +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ 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; - } -#ifdef __CYGWIN__ - PostMessageW(tsdPtr->hwnd, 1024, 0, 0); -#else /* __CYGWIN__ */ - pthread_cond_broadcast(&tsdPtr->waitCV); -#endif /* __CYGWIN__ */ + AlertSingleThread(tsdPtr); } } pthread_mutex_unlock(¬ifierMutex); @@ -1314,7 +1930,40 @@ NotifierThreadProc( * avoid a race condition we only read one at a time. */ - if (FD_ISSET(receivePipe, &readableMask)) { +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + found = 0; + numEvent = 0; + while (1) { + numEvent = PlatformEventsGet(numEvent, numReadyEvents, 0, + receivePipe, 0); + if (numEvent == -1) { + break; + } +#if defined(HAVE_EPOLL) + eventDataPtr = readyEvents[numEvent].data.ptr; + eventDataPtr->filePtr->platformReadyMask = + readyEvents[numEvent].events; +#elif defined(HAVE_KQUEUE) + eventDataPtr = readyEvents[numEvent].udata; + eventDataPtr->filePtr->platformReadyMask = + readyEvents[numEvent].filter; +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ + if (eventDataPtr->filePtr->fd == receivePipe) { + found = 1; + break; + } + numEvent++; + } +#if defined(HAVE_EPOLL) + if (found && readyEvents[numEvent].events & EPOLLIN) +#elif defined(HAVE_KQUEUE) + if (found && (readyEvents[numEvent].filter == EVFILT_READ) + && !(readyEvents[numEvent].flags & (EV_EOF | EV_ERROR))) +#else + if (FD_ISSET(receivePipe, &readableMask)) +#endif /* HAVE_EPOLL */ + { +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ i = read(receivePipe, buf, 1); if ((i == 0) || ((i == 1) && (buf[0] == 'q'))) { @@ -1334,6 +1983,10 @@ NotifierThreadProc( * termination of the notifier thread. */ +#if defined(HAVE_EPOLL) || defined(HAVE_KQUEUE) + PlatformEventsControl(filePtr_rP, tsdPtr, PLATFORMEVENTSCONTROL_DEL, + TCL_READABLE); +#endif /* HAVE_EPOLL || HAVE_KQUEUE */ close(receivePipe); pthread_mutex_lock(¬ifierMutex); triggerPipe = -1; @@ -1371,32 +2024,35 @@ AtForkChild(void) pthread_cond_init(¬ifierCV, NULL); /* - * notifierThreadRunning == 1: thread is running, (there might be data in notifier lists) + * notifierThreadRunning == 1: thread is running, (there might be data in + * notifier lists) * atForkInit == 0: InitNotifier was never called * notifierCount != 0: unbalanced InitNotifier() / FinalizeNotifier calls * waitingListPtr != 0: there are threads currently waiting for events. */ if (atForkInit == 1) { - notifierCount = 0; if (notifierThreadRunning == 1) { ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - notifierThreadRunning = 0; + notifierThreadRunning = 0; close(triggerPipe); triggerPipe = -1; + /* * The waitingListPtr might contain event info from multiple * threads, which are invalid here, so setting it to NULL is not * unreasonable. */ + waitingListPtr = NULL; /* * The tsdPtr from before the fork is copied as well. But since * we are paranoic, we don't trust its condvar and reset it. */ + #ifdef __CYGWIN__ DestroyWindow(tsdPtr->hwnd); tsdPtr->hwnd = CreateWindowExW(NULL, className, -- cgit v0.12 From 2de37edd0d18facf3d79f7db22020c7fd3df5ab9 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 9 Jan 2017 19:09:49 +0000 Subject: New performance measurement routine "timerate" in opposition to "time" the execution limited by fixed time (in milliseconds) instead of repetition count (more precise results, to prevent very long execution time it is no more necessary to estimate repetition count) Syntax: timerate ?-direct? ?-calibrate? ?-overhead double? command ?time? --- generic/tclBasic.c | 1 + generic/tclCmdMZ.c | 333 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 333 insertions(+), 1 deletion(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 81b3513..dec26b4 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -286,6 +286,7 @@ static const CmdInfo builtInCmds[] = { {"source", Tcl_SourceObjCmd, NULL, TclNRSourceObjCmd, 0}, {"tell", Tcl_TellObjCmd, NULL, NULL, CMD_IS_SAFE}, {"time", Tcl_TimeObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"timerate", Tcl_TimeRateObjCmd, NULL, NULL, CMD_IS_SAFE}, {"unload", Tcl_UnloadObjCmd, NULL, NULL, 0}, {"update", Tcl_UpdateObjCmd, NULL, NULL, CMD_IS_SAFE}, {"vwait", Tcl_VwaitObjCmd, NULL, NULL, CMD_IS_SAFE}, diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 23e6bd1..c660596 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -17,6 +17,7 @@ */ #include "tclInt.h" +#include "tclCompile.h" #include "tclRegexp.h" #include "tclStringTrim.h" @@ -3984,7 +3985,7 @@ Tcl_TimeObjCmd( start = TclpGetWideClicks(); #endif while (i-- > 0) { - result = Tcl_EvalObjEx(interp, objPtr, 0); + result = TclEvalObjEx(interp, objPtr, 0, NULL, 0); if (result != TCL_OK) { return result; } @@ -4024,6 +4025,336 @@ Tcl_TimeObjCmd( /* *---------------------------------------------------------------------- * + * Tcl_TimeRateObjCmd -- + * + * This object-based procedure is invoked to process the "timerate" Tcl + * command. + * This is similar to command "time", except the execution limited by + * given time (in milliseconds) instead of repetition count. + * + * Example: + * timerate {after 5} 1000 ; # equivalent for `time {after 5} [expr 1000/5]` + * + * Results: + * A standard Tcl object result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_TimeRateObjCmd( + ClientData dummy, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ +{ + static + double measureOverhead = 0; /* global measure-overhead */ + double overhead = -1; /* given measure-overhead */ + register Tcl_Obj *objPtr; + register int result, i; + Tcl_Obj *calibrate = NULL, *direct = NULL; + Tcl_WideInt count = 0; /* Holds repetition count */ + Tcl_WideInt maxms = -0x7FFFFFFFFFFFFFFFL; + /* Maximal running time (in milliseconds) */ + Tcl_WideInt threshold = 1; /* Current threshold for check time (faster + * repeat count without time check) */ + Tcl_WideInt maxIterTm = 1; /* Max time of some iteration as max threshold + * additionally avoid divide to zero (never < 1) */ + register Tcl_WideInt start, middle, stop; +#ifndef TCL_WIDE_CLICKS + Tcl_Time now; +#endif + + static const char *const options[] = { + "-direct", "-overhead", "-calibrate", "--", NULL + }; + enum options { + TMRT_EV_DIRECT, TMRT_OVERHEAD, TMRT_CALIBRATE, TMRT_LAST + }; + + NRE_callback *rootPtr; + ByteCode *codePtr = NULL; + + for (i = 1; i < objc - 1; i++) { + int index; + if (Tcl_GetIndexFromObj(NULL, objv[i], options, "option", TCL_EXACT, + &index) != TCL_OK) { + break; + } + if (index == TMRT_LAST) { + i++; + break; + } + switch ((enum options) index) { + case TMRT_EV_DIRECT: + direct = objv[i]; + break; + case TMRT_OVERHEAD: + if (++i >= objc - 1) { + goto usage; + } + if (Tcl_GetDoubleFromObj(interp, objv[i], &overhead) != TCL_OK) { + return TCL_ERROR; + } + break; + case TMRT_CALIBRATE: + calibrate = objv[i]; + break; + } + } + + if (i >= objc || i < objc-2) { +usage: + Tcl_WrongNumArgs(interp, 1, objv, "?-direct? ?-calibrate? ?-overhead double? command ?time?"); + return TCL_ERROR; + } + objPtr = objv[i++]; + if (i < objc) { + result = TclGetWideIntFromObj(interp, objv[i], &maxms); + if (result != TCL_OK) { + return result; + } + } + + /* if calibrate */ + if (calibrate) { + + /* if no time specified for the calibration */ + if (maxms == -0x7FFFFFFFFFFFFFFFL) { + Tcl_Obj *clobjv[6]; + Tcl_WideInt maxCalTime = 5000; + double lastMeasureOverhead = measureOverhead; + + clobjv[0] = objv[0]; + i = 1; + if (direct) { + clobjv[i++] = direct; + } + clobjv[i++] = objPtr; + + /* reset last measurement overhead */ + measureOverhead = (double)0; + + /* self-call with 100 milliseconds to warm-up, + * before entering the calibration cycle */ + TclNewLongObj(clobjv[i], 100); + Tcl_IncrRefCount(clobjv[i]); + result = Tcl_TimeRateObjCmd(dummy, interp, i+1, clobjv); + Tcl_DecrRefCount(clobjv[i]); + if (result != TCL_OK) { + return result; + } + + i--; + clobjv[i++] = calibrate; + clobjv[i++] = objPtr; + + /* set last measurement overhead to max */ + measureOverhead = (double)0x7FFFFFFFFFFFFFFFL; + + /* calibration cycle until it'll be preciser */ + maxms = -1000; + do { + lastMeasureOverhead = measureOverhead; + TclNewLongObj(clobjv[i], (int)maxms); + Tcl_IncrRefCount(clobjv[i]); + result = Tcl_TimeRateObjCmd(dummy, interp, i+1, clobjv); + Tcl_DecrRefCount(clobjv[i]); + if (result != TCL_OK) { + return result; + } + maxCalTime += maxms; + /* increase maxms for preciser calibration */ + maxms -= (-maxms / 4); + /* as long as new value more as 0.05% better */ + } while ( (measureOverhead >= lastMeasureOverhead + || measureOverhead / lastMeasureOverhead <= 0.9995) + && maxCalTime > 0 + ); + + return result; + } + if (maxms == 0) { + /* reset last measurement overhead */ + measureOverhead = 0; + Tcl_SetObjResult(interp, Tcl_NewLongObj(0)); + return TCL_OK; + } + + /* if time is negative - make current overhead more precise */ + if (maxms > 0) { + /* set last measurement overhead to max */ + measureOverhead = (double)0x7FFFFFFFFFFFFFFFL; + } else { + maxms = -maxms; + } + + } + + if (maxms == -0x7FFFFFFFFFFFFFFFL) { + maxms = 1000; + } + if (overhead == -1) { + overhead = measureOverhead; + } + + /* be sure that resetting of result will not smudge the further measurement */ + Tcl_ResetResult(interp); + + /* compile object */ + if (!direct) { + if (TclInterpReady(interp) != TCL_OK) { + return TCL_ERROR; + } + codePtr = TclCompileObj(interp, objPtr, NULL, 0); + TclPreserveByteCode(codePtr); + } + + /* get start and stop time */ +#ifndef TCL_WIDE_CLICKS + Tcl_GetTime(&now); + start = now.sec; start *= 1000000; start += now.usec; +#else + start = TclpGetWideClicks(); +#endif + + /* start measurement */ + stop = start + maxms * 1000; + middle = start; + while (1) { + /* eval single iteration */ + count++; + + if (!direct) { + /* precompiled */ + rootPtr = TOP_CB(interp); + result = TclNRExecuteByteCode(interp, codePtr); + result = TclNRRunCallbacks(interp, result, rootPtr); + } else { + /* eval */ + result = TclEvalObjEx(interp, objPtr, 0, NULL, 0); + } + if (result != TCL_OK) { + goto done; + } + + /* don't check time up to threshold */ + if (--threshold > 0) continue; + + /* check stop time reached, estimate new threshold */ + #ifndef TCL_WIDE_CLICKS + Tcl_GetTime(&now); + middle = now.sec; middle *= 1000000; middle += now.usec; + #else + middle = TclpGetWideClicks(); + #endif + if (middle >= stop) { + break; + } + /* average iteration time in microsecs */ + threshold = (middle - start) / count; + if (threshold > maxIterTm) { + maxIterTm = threshold; + } + /* as relation between remaining time and time since last check */ + threshold = ((stop - middle) / maxIterTm) / 4; + if (threshold > 100000) { /* fix for too large threshold */ + threshold = 100000; + } + } + + { + Tcl_Obj *objarr[8], **objs = objarr; + Tcl_WideInt val; + const char *fmt; + + middle -= start; /* execution time in microsecs */ + + /* if not calibrate */ + if (!calibrate) { + /* minimize influence of measurement overhead */ + if (overhead > 0) { + /* estimate the time of overhead (microsecs) */ + Tcl_WideInt curOverhead = overhead * count; + if (middle > curOverhead) { + middle -= curOverhead; + } else { + middle = 1; + } + } + } else { + /* calibration - obtaining new measurement overhead */ + if (measureOverhead > (double)middle / count) { + measureOverhead = (double)middle / count; + } + objs[0] = Tcl_NewDoubleObj(measureOverhead); + TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#-overhead"); /* mics */ + objs += 2; + } + + val = middle / count; /* microsecs per iteration */ + if (val >= 1000000) { + objs[0] = Tcl_NewWideIntObj(val); + } else { + if (val < 10) { fmt = "%.6f"; } else + if (val < 100) { fmt = "%.4f"; } else + if (val < 1000) { fmt = "%.3f"; } else + if (val < 10000) { fmt = "%.2f"; } else + { fmt = "%.1f"; }; + objs[0] = Tcl_ObjPrintf(fmt, ((double)middle)/count); + } + + objs[2] = Tcl_NewWideIntObj(count); /* iterations */ + + /* calculate speed as rate (count) per sec */ + if (!middle) middle++; /* +1 ms, just to avoid divide by zero */ + if (count < (0x7FFFFFFFFFFFFFFFL / 1000000)) { + val = (count * 1000000) / middle; + if (val < 100000) { + if (val < 100) { fmt = "%.3f"; } else + if (val < 1000) { fmt = "%.2f"; } else + { fmt = "%.1f"; }; + objs[4] = Tcl_ObjPrintf(fmt, ((double)(count * 1000000)) / middle); + } else { + objs[4] = Tcl_NewWideIntObj(val); + } + } else { + objs[4] = Tcl_NewWideIntObj((count / middle) * 1000000); + } + + /* estimated net execution time (in millisecs) */ + if (!calibrate) { + objs[6] = Tcl_ObjPrintf("%.3f", (double)middle / 1000); + TclNewLiteralStringObj(objs[7], "nett-ms"); + } + + /* + * Construct the result as a list because many programs have always parsed + * as such (extracting the first element, typically). + */ + + TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#"); /* mics/# */ + TclNewLiteralStringObj(objs[3], "#"); + TclNewLiteralStringObj(objs[5], "#/sec"); + Tcl_SetObjResult(interp, Tcl_NewListObj(8, objarr)); + } + +done: + + if (codePtr != NULL) { + TclReleaseByteCode(codePtr); + } + + return result; +} + +/* + *---------------------------------------------------------------------- + * * Tcl_TryObjCmd, TclNRTryObjCmd -- * * This procedure is invoked to process the "try" Tcl command. See the -- cgit v0.12 From 704f3a5483fa3c45aaf38ddf4a83ac4d4f6c7733 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 9 Jan 2017 19:31:08 +0000 Subject: missing entry of tclInt.h added --- generic/tclInt.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/generic/tclInt.h b/generic/tclInt.h index dd0c11a..1b37d84 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3461,6 +3461,9 @@ MODULE_SCOPE int Tcl_ThrowObjCmd(ClientData dummy, Tcl_Interp *interp, MODULE_SCOPE int Tcl_TimeObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +MODULE_SCOPE int Tcl_TimeRateObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); MODULE_SCOPE int Tcl_TraceObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -- cgit v0.12 From 6aed9a663094ff9d4bd540007174aff66479b0c2 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 9 Jan 2017 19:33:23 +0000 Subject: [win] load win-registry library also in development environment (uninstalled) --- library/reg/pkgIndex.tcl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/library/reg/pkgIndex.tcl b/library/reg/pkgIndex.tcl index b1fe234..ab022ab 100755 --- a/library/reg/pkgIndex.tcl +++ b/library/reg/pkgIndex.tcl @@ -1,9 +1,19 @@ if {([info commands ::tcl::pkgconfig] eq "") - || ([info sharedlibextension] ne ".dll")} return + || ([info sharedlibextension] ne ".dll")} return if {[::tcl::pkgconfig get debug]} { + if {[info exists [file join $dir tclreg13g.dll]]} { package ifneeded registry 1.3.2 \ [list load [file join $dir tclreg13g.dll] registry] + } else { + package ifneeded registry 1.3.2 \ + [list load tclreg13g registry] + } } else { + if {[info exists [file join $dir tclreg13.dll]]} { package ifneeded registry 1.3.2 \ [list load [file join $dir tclreg13.dll] registry] + } else { + package ifneeded registry 1.3.2 \ + [list load tclreg13 registry] + } } -- cgit v0.12 -- cgit v0.12 From a3433951b0a141acbb0fd911aefffcbd34e3b0b3 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 21:57:06 +0000 Subject: 1st try to rewrite clock in C --- generic/tclClock.c | 253 ++++++++++++++++++++++++++++++++++++++++------------- library/clock.tcl | 6 +- library/init.tcl | 28 +++--- 3 files changed, 212 insertions(+), 75 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 27009fd..e9a59f3 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -69,6 +69,7 @@ typedef enum ClockLiteral { LIT_MONTH, LIT_SECONDS, LIT_TZNAME, LIT_TZOFFSET, LIT_YEAR, + LIT_FREESCAN, LIT__END } ClockLiteral; static const char *const literals[] = { @@ -84,7 +85,8 @@ static const char *const literals[] = { "julianDay", "localSeconds", "month", "seconds", "tzName", "tzOffset", - "year" + "year", + "::tcl::clock::FreeScan" }; /* @@ -190,6 +192,9 @@ static int ClockParseformatargsObjCmd( static int ClockSecondsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int ClockScanObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); static struct tm * ThreadSafeLocalTime(const time_t *); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); @@ -202,7 +207,7 @@ struct ClockCommand { const char *name; /* The tail of the command name. The full name * is "::tcl::clock::". When NULL marks * the end of the table. */ - Tcl_ObjCmdProc *objCmdProc; /* Function that implements the command. This + Tcl_ObjCmdProc *objCmdProc; /* Function that implements the command. This * will always have the ClockClientData sent * to it, but may well ignore this data. */ }; @@ -213,6 +218,7 @@ static const struct ClockCommand clockCommands[] = { { "microseconds", ClockMicrosecondsObjCmd }, { "milliseconds", ClockMillisecondsObjCmd }, { "seconds", ClockSecondsObjCmd }, + { "scan", ClockScanObjCmd }, { "Oldscan", TclClockOldscanObjCmd }, { "ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd }, { "GetDateFields", ClockGetdatefieldsObjCmd }, @@ -466,6 +472,9 @@ ClockGetdatefieldsObjCmd( GetMonthDay(&fields); GetYearWeekDay(&fields, changeover); + +/************* split to use structured version from here ************/ + dict = Tcl_NewDictObj(); Tcl_DictObjPut(NULL, dict, literals[LIT_LOCALSECONDS], Tcl_NewWideIntObj(fields.localSeconds)); @@ -1507,9 +1516,9 @@ GetJulianDayFromEraYearMonthDay( * See above bug for details. The casts are necessary. */ if (ym1 >= 0) - ym1o4 = ym1 / 4; + ym1o4 = ym1 / 4; else { - ym1o4 = - (int) (((unsigned int) -ym1) / 4); + ym1o4 = - (int) (((unsigned int) -ym1) / 4); } #endif if (ym1 % 4 < 0) { @@ -1843,6 +1852,96 @@ ClockMicrosecondsObjCmd( return TCL_OK; } + +typedef struct _ClockFmtScnArgs { + Tcl_Obj *formatObj; /* Format */ + Tcl_Obj *localeObj; /* Locale */ + Tcl_Obj *timezoneObj; /* Timezone */ + Tcl_Obj *baseObj; /* Base (scan only) */ +} _ClockFmtScnArgs; + +static int +_ClockParseFmtScnArgs( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Parameter count */ + Tcl_Obj *const objv[], /* Parameter vector */ + _ClockFmtScnArgs *resOpts, /* Result vector: format, locale, timezone... */ + int forScan /* Flag to differentiate between format and scan */ +) { + ClockClientData *dataPtr = clientData; + Tcl_Obj **litPtr = dataPtr->literals; + int gmtFlag = 0; + static const char *const options[2][6] = { + { /* Format command line options */ + "-format", "-gmt", "-locale", + "-timezone", NULL }, + { /* Scan command line options */ + "-format", "-gmt", "-locale", + "-timezone", "-base", NULL } + }; + enum optionInd { + CLOCK_FORMAT_FORMAT, CLOCK_FORMAT_GMT, CLOCK_FORMAT_LOCALE, + CLOCK_FORMAT_TIMEZONE, CLOCK_FORMAT_BASE + }; + int optionIndex; /* Index of an option. */ + int saw = 0; /* Flag == 1 if option was seen already. */ + int i; + + /* + * Extract values for the keywords. + */ + + resOpts->formatObj = NULL; + resOpts->localeObj = NULL; + resOpts->timezoneObj = NULL; + resOpts->baseObj = NULL; + for (i = 2; i < objc; i+=2) { + if (Tcl_GetIndexFromObj(interp, objv[i], options[forScan], + "option", 0, &optionIndex) != TCL_OK) { + Tcl_SetErrorCode(interp, "CLOCK", "badOption", + Tcl_GetString(objv[i]), NULL); + return TCL_ERROR; + } + switch (optionIndex) { + case CLOCK_FORMAT_FORMAT: + resOpts->formatObj = objv[i+1]; + break; + case CLOCK_FORMAT_GMT: + if (Tcl_GetBooleanFromObj(interp, objv[i+1], &gmtFlag) != TCL_OK){ + return TCL_ERROR; + } + break; + case CLOCK_FORMAT_LOCALE: + resOpts->localeObj = objv[i+1]; + break; + case CLOCK_FORMAT_TIMEZONE: + resOpts->timezoneObj = objv[i+1]; + break; + case CLOCK_FORMAT_BASE: + resOpts->baseObj = objv[i+1]; + break; + } + saw |= 1 << optionIndex; + } + + /* + * Check options. + */ + + if ((saw & (1 << CLOCK_FORMAT_GMT)) + && (saw & (1 << CLOCK_FORMAT_TIMEZONE))) { + Tcl_SetObjResult(interp, litPtr[LIT_CANNOT_USE_GMT_AND_TIMEZONE]); + Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); + return TCL_ERROR; + } + if (gmtFlag) { + resOpts->timezoneObj = litPtr[LIT_GMT]; + } + + return TCL_OK; +} + /* *----------------------------------------------------------------------------- * @@ -1870,22 +1969,9 @@ ClockParseformatargsObjCmd( { ClockClientData *dataPtr = clientData; Tcl_Obj **litPtr = dataPtr->literals; - Tcl_Obj *results[3]; /* Format, locale and timezone */ -#define formatObj results[0] -#define localeObj results[1] -#define timezoneObj results[2] - int gmtFlag = 0; - static const char *const options[] = { /* Command line options expected */ - "-format", "-gmt", "-locale", - "-timezone", NULL }; - enum optionInd { - CLOCK_FORMAT_FORMAT, CLOCK_FORMAT_GMT, CLOCK_FORMAT_LOCALE, - CLOCK_FORMAT_TIMEZONE - }; - int optionIndex; /* Index of an option. */ - int saw = 0; /* Flag == 1 if option was seen already. */ + _ClockFmtScnArgs resOpts; /* Format, locale and timezone */ Tcl_WideInt clockVal; /* Clock value - just used to parse. */ - int i; + int ret; /* * Args consist of a time followed by keyword-value pairs. @@ -1903,33 +1989,10 @@ ClockParseformatargsObjCmd( * Extract values for the keywords. */ - formatObj = litPtr[LIT__DEFAULT_FORMAT]; - localeObj = litPtr[LIT_C]; - timezoneObj = litPtr[LIT__NIL]; - for (i = 2; i < objc; i+=2) { - if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, - &optionIndex) != TCL_OK) { - Tcl_SetErrorCode(interp, "CLOCK", "badOption", - Tcl_GetString(objv[i]), NULL); - return TCL_ERROR; - } - switch (optionIndex) { - case CLOCK_FORMAT_FORMAT: - formatObj = objv[i+1]; - break; - case CLOCK_FORMAT_GMT: - if (Tcl_GetBooleanFromObj(interp, objv[i+1], &gmtFlag) != TCL_OK){ - return TCL_ERROR; - } - break; - case CLOCK_FORMAT_LOCALE: - localeObj = objv[i+1]; - break; - case CLOCK_FORMAT_TIMEZONE: - timezoneObj = objv[i+1]; - break; - } - saw |= 1 << optionIndex; + ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, + &resOpts, 0); + if (ret != TCL_OK) { + return ret; } /* @@ -1939,26 +2002,98 @@ ClockParseformatargsObjCmd( if (Tcl_GetWideIntFromObj(interp, objv[1], &clockVal) != TCL_OK) { return TCL_ERROR; } - if ((saw & (1 << CLOCK_FORMAT_GMT)) - && (saw & (1 << CLOCK_FORMAT_TIMEZONE))) { - Tcl_SetObjResult(interp, litPtr[LIT_CANNOT_USE_GMT_AND_TIMEZONE]); - Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); - return TCL_ERROR; - } - if (gmtFlag) { - timezoneObj = litPtr[LIT_GMT]; - } + if (resOpts.formatObj == NULL) + resOpts.formatObj = litPtr[LIT__DEFAULT_FORMAT]; + if (resOpts.localeObj == NULL) + resOpts.localeObj = litPtr[LIT_C]; + if (resOpts.timezoneObj == NULL) + resOpts.timezoneObj = litPtr[LIT__NIL]; /* * Return options as a list. */ - Tcl_SetObjResult(interp, Tcl_NewListObj(3, results)); + Tcl_SetObjResult(interp, Tcl_NewListObj(3, (Tcl_Obj**)&resOpts)); return TCL_OK; +} + +/*---------------------------------------------------------------------- + * + * ClockScanObjCmd - + * + *---------------------------------------------------------------------- + */ + +int +ClockScanObjCmd( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Parameter count */ + Tcl_Obj *const objv[]) /* Parameter values */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **litPtr = dataPtr->literals; + + Tcl_Time retClock; + char *string, *format = NULL; + int gmt, ret = 0; + char *locale; + _ClockFmtScnArgs opts; /* Format, locale, timezone and base */ + Tcl_WideInt baseVal; /* Base value */ + + if ((objc & 1) == 1) { + Tcl_WrongNumArgs(interp, 1, objv, "string " + "?-base seconds? " + "?-format string? " + "?-gmt boolean? " + "?-locale LOCALE? ?-timezone ZONE?"); + Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", NULL); + return TCL_ERROR; + } + + /* + * Extract values for the keywords. + */ + + ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, + &opts, 1); + if (ret != TCL_OK) { + return ret; + } + + if (opts.baseObj != NULL) { + if (Tcl_GetWideIntFromObj(interp, opts.baseObj, &baseVal) != TCL_OK) { + return TCL_ERROR; + } + } else { + Tcl_Time now; + Tcl_GetTime(&now); + baseVal = (Tcl_WideInt) now.sec; + } + + /* if free scan */ + if (opts.formatObj == NULL) { + Tcl_Obj *callargs[5]; + /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ + if (opts.localeObj != NULL) { + Tcl_SetResult(interp, + "legacy [clock scan] does not support -locale", TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); + return TCL_ERROR; + } + callargs[0] = litPtr[LIT_FREESCAN]; + callargs[1] = objv[1]; + callargs[2] = opts.baseObj != NULL ? opts.baseObj : Tcl_NewWideIntObj(baseVal); + callargs[3] = opts.timezoneObj != NULL ? opts.timezoneObj : litPtr[LIT__NIL]; + callargs[4] = opts.localeObj != NULL ? opts.localeObj : litPtr[LIT_C]; + return Tcl_EvalObjv(interp, 5, callargs, 0); + } -#undef timezoneObj -#undef localeObj -#undef formatObj + // **** + string = TclGetString(objv[1]); + // **** timezone = GetSystemTimeZone() + + return TCL_OK; } /*---------------------------------------------------------------------- diff --git a/library/clock.tcl b/library/clock.tcl index 535a67d..5b48eb3 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -1178,7 +1178,7 @@ proc ::tcl::clock::ParseClockFormatFormat2 {format locale procName} { # #---------------------------------------------------------------------- -proc ::tcl::clock::scan { args } { +proc ::tcl::clock::__org_scan { args } { set format {} @@ -1300,7 +1300,9 @@ proc ::tcl::clock::FreeScan { string base timezone locale } { variable TZData # Get the data for time changes in the given zone - + if {$timezone eq {}} { + set timezone [GetSystemTimeZone] + } try { SetupTimeZone $timezone } on error {retval opts} { diff --git a/library/init.tcl b/library/init.tcl index 544ea77..e6df12b 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -66,12 +66,12 @@ namespace eval tcl { } if {![interp issafe]} { - variable Path [encoding dirs] - set Dir [file join $::tcl_library encoding] - if {$Dir ni $Path} { + variable Path [encoding dirs] + set Dir [file join $::tcl_library encoding] + if {$Dir ni $Path} { lappend Path $Dir encoding dirs $Path - } + } } # TIP #255 min and max functions @@ -171,14 +171,14 @@ if {[interp issafe]} { 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 - }] + [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} { + foreach cmd {add format FreeScan} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] @@ -600,12 +600,12 @@ proc auto_import {pattern} { auto_load_index foreach pattern $patternList { - foreach name [array names auto_index $pattern] { - if {([namespace which -command $name] eq "") + foreach name [array names auto_index $pattern] { + if {([namespace which -command $name] eq "") && ([namespace qualifiers $pattern] eq [namespace qualifiers $name])} { - namespace eval :: $auto_index($name) - } - } + namespace eval :: $auto_index($name) + } + } } } -- cgit v0.12 From 9e52bb21b79848250f66adb912c1195cc9da2c56 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 21:58:33 +0000 Subject: [temp-commit]: clock scan with several optimization porting, still not-ready --- generic/tclClock.c | 520 +++++++++++++++++++++++++++++++++++++++++++++++---- generic/tclDate.c | 497 +++++++++++++++++++++++------------------------- generic/tclDate.h | 77 ++++++++ generic/tclGetDate.y | 134 ++++++------- library/clock.tcl | 19 +- library/init.tcl | 2 +- win/makefile.vc | 4 +- 7 files changed, 870 insertions(+), 383 deletions(-) create mode 100644 generic/tclDate.h diff --git a/generic/tclClock.c b/generic/tclClock.c index e9a59f3..24ed095 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -14,6 +14,7 @@ */ #include "tclInt.h" +#include "tclDate.h" /* * Windows has mktime. The configurators do not check. @@ -28,6 +29,7 @@ */ #define JULIAN_DAY_POSIX_EPOCH 2440588 +#define GREGORIAN_CHANGE_DATE 2361222 #define SECONDS_PER_DAY 86400 #define JULIAN_SEC_POSIX_EPOCH (((Tcl_WideInt) JULIAN_DAY_POSIX_EPOCH) \ * SECONDS_PER_DAY) @@ -69,7 +71,14 @@ typedef enum ClockLiteral { LIT_MONTH, LIT_SECONDS, LIT_TZNAME, LIT_TZOFFSET, LIT_YEAR, + LIT_CURRENTYEARCENTURY, + LIT_YEAROFCENTURYSWITCH, + LIT_TZDATA, + LIT_GETSYSTEMTIMEZONE, + LIT_SETUPTIMEZONE, +#if 0 LIT_FREESCAN, +#endif LIT__END } ClockLiteral; static const char *const literals[] = { @@ -86,9 +95,18 @@ static const char *const literals[] = { "month", "seconds", "tzName", "tzOffset", "year", + "::tcl::clock::CurrentYearCentury", + "::tcl::clock::YearOfCenturySwitch", + "::tcl::clock::TZData", + "::tcl::clock::GetSystemTimeZone", + "::tcl::clock::SetupTimeZone", +#if 0 "::tcl::clock::FreeScan" +#endif }; +#define CurrentYearCentury 2000 + /* * Structure containing the client data for [clock] */ @@ -168,6 +186,10 @@ static int ClockClicksObjCmd( static int ClockConvertlocaltoutcObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); + +static int ClockGetDateFields(Tcl_Interp *interp, + TclDateFields *fields, Tcl_Obj *tzdata, + int changeover); static int ClockGetdatefieldsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -195,6 +217,10 @@ static int ClockSecondsObjCmd( static int ClockScanObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int ClockFreeScan( + ClientData clientData, Tcl_Interp *interp, + Tcl_Obj *strObj, Tcl_WideInt baseVal, + Tcl_Obj *timezoneObj, Tcl_Obj *locale); static struct tm * ThreadSafeLocalTime(const time_t *); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); @@ -296,6 +322,123 @@ TclClockInit( /* *---------------------------------------------------------------------- + */ +inline Tcl_Obj* +ClockGetTZData( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *timezoneObj) /* Name of the timezone */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + + return Tcl_ObjGetVar2(interp, literals[LIT_TZDATA], + timezoneObj, TCL_LEAVE_ERR_MSG); +} +/* + *---------------------------------------------------------------------- + */ +static Tcl_Obj * +ClockGetSystemTimeZone( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp) /* Tcl interpreter */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + + if (Tcl_EvalObjv(interp, 1, &literals[LIT_GETSYSTEMTIMEZONE], 0) != TCL_OK) { + return NULL; + } + return Tcl_GetObjResult(interp); +} +/* + *---------------------------------------------------------------------- + */ +static int +ClockSetupTimeZone( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *timezoneObj) +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + Tcl_Obj *callargs[2]; + + callargs[0] = literals[LIT_SETUPTIMEZONE]; + callargs[1] = timezoneObj; + return Tcl_EvalObjv(interp, 2, callargs, 0); +} +/* + *---------------------------------------------------------------------- + * ClockFormatNumericTimeZone - + * + * Formats a time zone as +hhmmss + * + * Parameters: + * z - Time zone in seconds east of Greenwich + * + * Results: + * Returns the time zone object (formatted in a numeric form) + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Tcl_Obj * +ClockFormatNumericTimeZone(int z) { + char sign = '+'; + int h, m; + if ( z < 0 ) { + z = -z; + sign = '-'; + } + h = z / 3600; + z %= 3600; + m = z / 60; + z %= 60; + if (z != 0) { + return Tcl_ObjPrintf("%c%02d%02d%02d", sign, h, m, z); + } + return Tcl_ObjPrintf("%c%02d%02d", sign, h, m); +} + +/* + *---------------------------------------------------------------------- + * [SB] TODO: make constans cacheable (once per second, etc.) ... + */ +inline int +ClockCurrentYearCentury( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp) /* Tcl interpreter */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + int year = 2000; + + Tcl_Obj * yearObj = Tcl_ObjGetVar2(interp, + literals[LIT_CURRENTYEARCENTURY], NULL, TCL_LEAVE_ERR_MSG); + Tcl_GetIntFromObj(NULL, yearObj, &year); + return year; +} +inline int +ClockGetYearOfCenturySwitch( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp) /* Tcl interpreter */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + int year = 37; + + Tcl_Obj * yearObj = Tcl_ObjGetVar2(interp, + literals[LIT_YEAROFCENTURYSWITCH], NULL, TCL_LEAVE_ERR_MSG); + Tcl_GetIntFromObj(NULL, yearObj, &year); + return year; +} + +/* + *---------------------------------------------------------------------- * * ClockConvertlocaltoutcObjCmd -- * @@ -426,6 +569,8 @@ ClockGetdatefieldsObjCmd( Tcl_Obj *const *literals = data->literals; int changeover; + fields.tzName = NULL; + /* * Check params. */ @@ -449,31 +594,14 @@ ClockGetdatefieldsObjCmd( return TCL_ERROR; } - /* - * Convert UTC time to local. - */ + /* Extract fields */ - if (ConvertUTCToLocal(interp, &fields, objv[2], changeover) != TCL_OK) { + if (ClockGetDateFields(interp, &fields, objv[2], changeover) + != TCL_OK) { return TCL_ERROR; } - /* - * Extract Julian day. - */ - - fields.julianDay = (int) ((fields.localSeconds + JULIAN_SEC_POSIX_EPOCH) - / SECONDS_PER_DAY); - - /* - * Convert to Julian or Gregorian calendar. - */ - - GetGregorianEraYearDay(&fields, changeover); - GetMonthDay(&fields); - GetYearWeekDay(&fields, changeover); - - -/************* split to use structured version from here ************/ + /* Make dict of fields */ dict = Tcl_NewDictObj(); Tcl_DictObjPut(NULL, dict, literals[LIT_LOCALSECONDS], @@ -511,6 +639,59 @@ ClockGetdatefieldsObjCmd( /* *---------------------------------------------------------------------- + */ +int +ClockGetDateFields( + Tcl_Interp *interp, /* Tcl interpreter */ + TclDateFields *fields, /* Pointer to result fields, where + * fields->seconds contains date to extract */ + Tcl_Obj *tzdata, /* Time zone data object or NULL for gmt */ + int changeover) /* Julian Day Number */ +{ + /* + * Convert UTC time to local. + */ + + if (ConvertUTCToLocal(interp, fields, tzdata, changeover) != TCL_OK) { + return TCL_ERROR; + } + + /* + * Extract Julian day. + */ + + fields->julianDay = (int) ((fields->localSeconds + JULIAN_SEC_POSIX_EPOCH) + / SECONDS_PER_DAY); + + /* + * Convert to Julian or Gregorian calendar. + */ + + GetGregorianEraYearDay(fields, changeover); + GetMonthDay(fields); + GetYearWeekDay(fields, changeover); + + return TCL_OK; +} + +inline +SetDateFieldsTimeZone( + TclDateFields *fields, + Tcl_Obj *timezoneObj) +{ + if (fields->tzName != timezoneObj) { + if (timezoneObj) { + Tcl_IncrRefCount(timezoneObj); + } + if (fields->tzName != NULL) { + Tcl_DecrRefCount(fields->tzName); + } + fields->tzName = timezoneObj; + } +} + +/* + *---------------------------------------------------------------------- * * ClockGetjuliandayfromerayearmonthdayObjCmd -- * @@ -1013,8 +1194,7 @@ ConvertUTCToLocalUsingTable( * Convert the time. */ - fields->tzName = cellv[3]; - Tcl_IncrRefCount(fields->tzName); + SetDateFieldsTimeZone(fields, cellv[3]); fields->localSeconds = fields->seconds + fields->tzOffset; return TCL_OK; } @@ -1107,8 +1287,7 @@ ConvertUTCToLocalUsingC( if (diff > 0) { sprintf(buffer+5, "%02d", diff); } - fields->tzName = Tcl_NewStringObj(buffer, -1); - Tcl_IncrRefCount(fields->tzName); + SetDateFieldsTimeZone(fields, Tcl_NewStringObj(buffer, -1)); return TCL_OK; } @@ -1968,7 +2147,7 @@ ClockParseformatargsObjCmd( Tcl_Obj *const objv[]) /* Parameter vector */ { ClockClientData *dataPtr = clientData; - Tcl_Obj **litPtr = dataPtr->literals; + Tcl_Obj **literals = dataPtr->literals; _ClockFmtScnArgs resOpts; /* Format, locale and timezone */ Tcl_WideInt clockVal; /* Clock value - just used to parse. */ int ret; @@ -2003,11 +2182,11 @@ ClockParseformatargsObjCmd( return TCL_ERROR; } if (resOpts.formatObj == NULL) - resOpts.formatObj = litPtr[LIT__DEFAULT_FORMAT]; + resOpts.formatObj = literals[LIT__DEFAULT_FORMAT]; if (resOpts.localeObj == NULL) - resOpts.localeObj = litPtr[LIT_C]; + resOpts.localeObj = literals[LIT_C]; if (resOpts.timezoneObj == NULL) - resOpts.timezoneObj = litPtr[LIT__NIL]; + resOpts.timezoneObj = literals[LIT__NIL]; /* * Return options as a list. @@ -2032,7 +2211,7 @@ ClockScanObjCmd( Tcl_Obj *const objv[]) /* Parameter values */ { ClockClientData *dataPtr = clientData; - Tcl_Obj **litPtr = dataPtr->literals; + Tcl_Obj **literals = dataPtr->literals; Tcl_Time retClock; char *string, *format = NULL; @@ -2071,8 +2250,10 @@ ClockScanObjCmd( baseVal = (Tcl_WideInt) now.sec; } - /* if free scan */ + /* If free scan */ if (opts.formatObj == NULL) { +#if 0 + /* Tcled FreeScan proc - */ Tcl_Obj *callargs[5]; /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ if (opts.localeObj != NULL) { @@ -2081,18 +2262,287 @@ ClockScanObjCmd( Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } - callargs[0] = litPtr[LIT_FREESCAN]; + callargs[0] = literals[LIT_FREESCAN]; callargs[1] = objv[1]; callargs[2] = opts.baseObj != NULL ? opts.baseObj : Tcl_NewWideIntObj(baseVal); - callargs[3] = opts.timezoneObj != NULL ? opts.timezoneObj : litPtr[LIT__NIL]; - callargs[4] = opts.localeObj != NULL ? opts.localeObj : litPtr[LIT_C]; + callargs[3] = opts.timezoneObj != NULL ? opts.timezoneObj : literals[LIT__NIL]; + callargs[4] = opts.localeObj != NULL ? opts.localeObj : literals[LIT_C]; return Tcl_EvalObjv(interp, 5, callargs, 0); +#else + /* Use compiled version of FreeScan - */ + + + /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ + if (opts.localeObj != NULL) { + Tcl_SetResult(interp, + "legacy [clock scan] does not support -locale", TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); + return TCL_ERROR; + } + return ClockFreeScan(clientData, interp, objv[1], baseVal, + opts.timezoneObj, opts.localeObj); +#endif } + // **** string = TclGetString(objv[1]); - // **** timezone = GetSystemTimeZone() + // **** timezone = ClockGetSystemTimeZone(clientData, interp) + /* + if (timezoneObj == NULL) { + goto done; + } + */ + + return TCL_OK; +} + +/*---------------------------------------------------------------------- + */ +int +ClockFreeScan( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *strObj, /* String containing the time to scan */ + Tcl_WideInt baseVal, /* Base time, expressed in seconds from the Epoch */ + Tcl_Obj *timezoneObj, /* Default time zone in which the time will be expressed */ + Tcl_Obj *locale) /* (Unused) Name of the locale where the time will be scanned. */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + + DateInfo yy; /* parse structure of TclClockFreeScan */ + TclDateFields date; /* date fields used for converting from seconds */ + Tcl_Obj *tzdata; + int secondOfDay; /* Seconds of day (time only calculation) */ + Tcl_WideInt seconds; + int ret = TCL_ERROR; + Tcl_Obj *cleanUpList = Tcl_NewObj(); + + date.tzName = NULL; + + /* If time zone not specified use system time zone */ + if (timezoneObj == NULL || + TclGetString(timezoneObj) == NULL || timezoneObj->length == 0) { + timezoneObj = ClockGetSystemTimeZone(clientData, interp); + if (timezoneObj == NULL) { + goto done; + } + Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); + } + + /* Get the data for time changes in the given zone */ + + if (ClockSetupTimeZone(clientData, interp, timezoneObj) != TCL_OK) { + goto done; + } + + /* + * Extract year, month and day from the base time for the parser to use as + * defaults + */ + + tzdata = ClockGetTZData(clientData, interp, timezoneObj); + if (tzdata == NULL) { + goto done; + } + date.seconds = baseVal; + if (ClockGetDateFields(interp, &date, tzdata, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + goto done; + } + + secondOfDay = date.localSeconds % 86400; + + /* + * Parse the date. The parser will fill a structure "yy" with date, time, + * time zone, relative month/day/seconds, relative weekday, ordinal month. + */ + yy.dateInput = Tcl_GetString(strObj); + + yy.dateYear = date.year; + yy.dateMonth = date.month; + yy.dateDay = date.dayOfMonth; + + if (TclClockFreeScan(interp, &yy) != TCL_OK) { + Tcl_Obj *msg = Tcl_NewObj(); + Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"", + yy.dateInput, "\":", + TclGetString(Tcl_GetObjResult(interp))); + Tcl_SetObjResult(interp, msg); + goto done; + } + + /* + * If the caller supplied a date in the string, update the date with + * the value. If the caller didn't specify a time with the date, default to + * midnight. + */ + + if (yy.dateHaveDate) { + if (yy.dateYear < 100) { + yy.dateYear += ClockCurrentYearCentury(clientData, interp); + if (yy.dateYear > ClockGetYearOfCenturySwitch(clientData, interp)) { + yy.dateYear -= 100; + } + } + date.era = CE; + date.year = yy.dateYear; + date.month = yy.dateMonth; + date.dayOfMonth = yy.dateDay; + if (yy.dateHaveTime == 0) { + yy.dateHaveTime = -1; + } + } + + /* + * If the caller supplied a time zone in the string, make it into a time + * zone indicator of +-hhmm and setup this time zone. + */ + + if (yy.dateHaveZone) { + int minEast = -yy.dateTimezone; + int dstFlag = 1 - yy.dateDSTmode; + timezoneObj = ClockFormatNumericTimeZone( + 60 * minEast + 3600 * dstFlag); + Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); + if (ClockSetupTimeZone(clientData, interp, timezoneObj) != TCL_OK) { + goto done; + } + tzdata = ClockGetTZData(clientData, interp, timezoneObj); + if (tzdata == NULL) { + goto done; + } + } + + SetDateFieldsTimeZone(&date, timezoneObj); + + /* Assemble date, time, zone into seconds-from-epoch */ + + GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + + if (yy.dateHaveTime == -1) { + secondOfDay = 0; + } + else + if (yy.dateHaveTime) { + secondOfDay = ToSeconds(yy.dateHour, yy.dateMinutes, + yy.dateSeconds, yy.dateMeridian); + } + else + if ( (yy.dateHaveDay && !yy.dateHaveDate) + || yy.dateHaveOrdinalMonth + || ( yy.dateHaveRel + && ( yy.dateRelMonth != 0 + || yy.dateRelDay != 0 ) ) + ) { + secondOfDay = 0; + } + + date.localSeconds = + -210866803200L + + ( 86400 * (Tcl_WideInt)date.julianDay ) + + secondOfDay; + + SetDateFieldsTimeZone(&date, timezoneObj); + if (ConvertLocalToUTC(interp, &date, tzdata, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + goto done; + } + + seconds = date.seconds; + + /* + * Do relative times + */ + + if (yy.dateHaveRel) { + + /* [SB] TODO: rewrite it in C: * / + seconds = [add $seconds \ + yy.dateRelMonth months yy.dateRelDay days yy.dateRelMonthSecond seconds \ + -timezone $timezone -locale $locale] + */ + } + + /* + * Do relative weekday + */ + + if (yy.dateHaveDay && !yy.dateHaveDate) { + TclDateFields date2; + date2.tzName = NULL; + + SetDateFieldsTimeZone(&date2, timezoneObj); + + date2.seconds = date.seconds; + if (ClockGetDateFields(interp, &date2, tzdata, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + SetDateFieldsTimeZone(&date2, NULL); + goto done; + } + date2.era = CE; + date2.julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date2.julianDay + 6) + + 7 * yy.dateDayOrdinal; + if (yy.dateDayOrdinal > 0) { + date2.julianDay -= 7; + } + secondOfDay = date2.localSeconds % 86400; + date2.localSeconds = + -210866803200 + + ( 86400 * (Tcl_WideInt)date2.julianDay ) + + secondOfDay; + + SetDateFieldsTimeZone(&date2, timezoneObj); + if (ConvertLocalToUTC(interp, &date2, tzdata, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + SetDateFieldsTimeZone(&date2, NULL); + goto done; + } + SetDateFieldsTimeZone(&date2, NULL); + + seconds = date2.seconds; + } + + /* + * Do relative month + */ + + if (yy.dateHaveOrdinalMonth) { + int monthDiff; + if (yy.dateMonthOrdinal > 0) { + monthDiff = yy.dateMonth - date.month; + if (monthDiff <= 0) { + monthDiff += 12; + } + yy.dateMonthOrdinal--; + } else { + monthDiff = date.month - yy.dateMonth; + if (monthDiff >= 0) { + monthDiff -= 12; + } + yy.dateMonthOrdinal++; + } + /* [SB] TODO: rewrite it in C: * / + seconds = [add $seconds $yy.dateMonthOrdinal years $monthDiff months \ + -timezone $timezone -locale $locale] + */ + } + + ret = TCL_OK; + +done: + + if (date.tzName != NULL) { + Tcl_DecrRefCount(date.tzName); + } + Tcl_DecrRefCount(cleanUpList); + + if (ret != TCL_OK) { + return ret; + } + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(seconds)); return TCL_OK; } diff --git a/generic/tclDate.c b/generic/tclDate.c index e4dd000..a31e0fc 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -1,24 +1,22 @@ -/* A Bison parser, made by GNU Bison 2.3. */ +/* A Bison parser, made by GNU Bison 2.4.2. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software + Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +27,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +45,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,65 +53,24 @@ /* Pure parsers. */ #define YYPURE 1 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ -#define yyparse TclDateparse -#define yylex TclDatelex -#define yyerror TclDateerror -#define yylval TclDatelval -#define yychar TclDatechar -#define yydebug TclDatedebug -#define yynerrs TclDatenerrs -#define yylloc TclDatelloc - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - tAGO = 258, - tDAY = 259, - tDAYZONE = 260, - tID = 261, - tMERIDIAN = 262, - tMONTH = 263, - tMONTH_UNIT = 264, - tSTARDATE = 265, - tSEC_UNIT = 266, - tSNUMBER = 267, - tUNUMBER = 268, - tZONE = 269, - tEPOCH = 270, - tDST = 271, - tISOBASE = 272, - tDAY_UNIT = 273, - tNEXT = 274 - }; -#endif -/* Tokens. */ -#define tAGO 258 -#define tDAY 259 -#define tDAYZONE 260 -#define tID 261 -#define tMERIDIAN 262 -#define tMONTH 263 -#define tMONTH_UNIT 264 -#define tSTARDATE 265 -#define tSEC_UNIT 266 -#define tSNUMBER 267 -#define tUNUMBER 268 -#define tZONE 269 -#define tEPOCH 270 -#define tDST 271 -#define tISOBASE 272 -#define tDAY_UNIT 273 -#define tNEXT 274 - - - +#define yyparse TclDateparse +#define yylex TclDatelex +#define yyerror TclDateerror +#define yylval TclDatelval +#define yychar TclDatechar +#define yydebug TclDatedebug +#define yynerrs TclDatenerrs +#define yylloc TclDatelloc /* Copy the first part of user declarations. */ @@ -129,6 +86,7 @@ * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * */ #include "tclInt.h" @@ -146,44 +104,7 @@ * parsed fields will be returned. */ -typedef struct DateInfo { - - Tcl_Obj* messages; /* Error messages */ - const char* separatrix; /* String separating messages */ - - time_t dateYear; - time_t dateMonth; - time_t dateDay; - int dateHaveDate; - - time_t dateHour; - time_t dateMinutes; - time_t dateSeconds; - int dateMeridian; - int dateHaveTime; - - time_t dateTimezone; - int dateDSTmode; - int dateHaveZone; - - time_t dateRelMonth; - time_t dateRelDay; - time_t dateRelSeconds; - int dateHaveRel; - - time_t dateMonthOrdinal; - int dateHaveOrdinalMonth; - - time_t dateDayOrdinal; - time_t dateDayNumber; - int dateHaveDay; - - const char *dateStart; - const char *dateInput; - time_t *dateRelPointer; - - int dateDigitCount; -} DateInfo; +#include "tclDate.h" #define YYMALLOC ckalloc #define YYFREE(x) (ckfree((void*) (x))) @@ -246,13 +167,6 @@ typedef enum _DSTMODE { DSTon, DSToff, DSTmaybe } DSTMODE; -/* - * Meridian: am, pm, or 24-hour style. - */ - -typedef enum _MERIDIAN { - MERam, MERpm, MER24 -} MERIDIAN; @@ -274,19 +188,49 @@ typedef enum _MERIDIAN { # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + tAGO = 258, + tDAY = 259, + tDAYZONE = 260, + tID = 261, + tMERIDIAN = 262, + tMONTH = 263, + tMONTH_UNIT = 264, + tSTARDATE = 265, + tSEC_UNIT = 266, + tSNUMBER = 267, + tUNUMBER = 268, + tZONE = 269, + tEPOCH = 270, + tDST = 271, + tISOBASE = 272, + tDAY_UNIT = 273, + tNEXT = 274 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE - { + + time_t Number; enum _MERIDIAN Meridian; -} -/* Line 187 of yacc.c. */ - YYSTYPE; + + +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -316,14 +260,10 @@ static int LookupWord(YYSTYPE* yylvalPtr, char *buff); DateInfo* info, const char *s); static int TclDatelex(YYSTYPE* yylvalPtr, YYLTYPE* location, DateInfo* info); -static time_t ToSeconds(time_t Hours, time_t Minutes, - time_t Seconds, MERIDIAN Meridian); MODULE_SCOPE int yyparse(DateInfo*); -/* Line 216 of yacc.c. */ - #ifdef short # undef short @@ -359,15 +299,21 @@ typedef short int yytype_int16; #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ -# else +# elif defined size_t # define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if YYENABLE_NLS +# if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -392,14 +338,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -481,9 +427,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -518,12 +464,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -624,12 +570,12 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 225, 225, 226, 229, 232, 235, 238, 241, 244, - 247, 251, 256, 259, 265, 271, 279, 285, 296, 300, - 304, 310, 314, 318, 322, 326, 332, 336, 341, 346, - 351, 356, 360, 365, 369, 374, 381, 385, 391, 400, - 409, 419, 433, 438, 441, 444, 447, 450, 453, 458, - 461, 466, 470, 474, 480, 498, 501 + 0, 176, 176, 177, 180, 183, 186, 189, 192, 195, + 198, 202, 207, 210, 216, 222, 230, 236, 247, 251, + 255, 261, 265, 269, 273, 277, 283, 287, 292, 297, + 302, 307, 311, 316, 320, 325, 332, 336, 342, 351, + 360, 370, 384, 389, 392, 395, 398, 401, 404, 409, + 412, 417, 421, 425, 431, 449, 452 }; #endif @@ -783,9 +729,18 @@ static const yytype_uint8 yystos[] = /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ + Once GCC version 2 has supplanted version 1, this can go. However, + YYFAIL appears to be in use. Nevertheless, it is formally deprecated + in Bison 2.4.2's NEWS entry, where a plan to phase it out is + discussed. */ #define YYFAIL goto yyerrlab +#if defined YYFAIL + /* This is here to suppress warnings from the GCC cpp's + -Wunused-macros. Normally we don't worry about that warning, but + some users do, and we want to make it easy for users to remove + YYFAIL uses, which will produce warnings from Bison 2.5. */ +#endif #define YYRECOVERING() (!!yyerrstatus) @@ -842,7 +797,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL +# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -961,17 +916,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, info) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -1007,11 +965,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule, info) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) , info); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1295,10 +1253,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, info) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1317,10 +1273,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1344,88 +1299,97 @@ yyparse (info) #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ +/* Location data for the lookahead symbol. */ YYLTYPE yylloc; - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; - YYSIZE_T yystacksize = YYINITDEPTH; + YYSIZE_T yystacksize; + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) + /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; yylsp = yyls; -#if YYLTYPE_IS_TRIVIAL + +#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; + yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; @@ -1464,6 +1428,7 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -1485,9 +1450,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (yyls); + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -1508,6 +1473,9 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -1516,16 +1484,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -1557,20 +1525,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -2062,7 +2026,6 @@ yyreduce: break; -/* Line 1267 of yacc.c. */ default: break; } @@ -2139,7 +2102,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -2156,7 +2119,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -2214,14 +2177,11 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ + the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -2246,7 +2206,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -2257,7 +2217,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, info); /* Do not reclaim the symbols of the rule which action triggered @@ -2513,7 +2473,7 @@ TclDateerror( infoPtr->separatrix = "\n"; } -static time_t +time_t ToSeconds( time_t Hours, time_t Minutes, @@ -2680,7 +2640,7 @@ TclDatelex( location->first_column = yyInput - info->dateStart; for ( ; ; ) { - while (TclIsSpaceProc(*yyInput)) { + while (isspace(UCHAR(*yyInput))) { yyInput++; } @@ -2740,36 +2700,20 @@ TclDatelex( } while (Count > 0); } } - + int -TclClockOldscanObjCmd( - ClientData clientData, /* Unused */ +TclClockFreeScan( Tcl_Interp *interp, /* Tcl interpreter */ - int objc, /* Count of paraneters */ - Tcl_Obj *const *objv) /* Parameters */ + DateInfo *info) /* Input and result parameters */ { - Tcl_Obj *result, *resultElement; - int yr, mo, da; - DateInfo dateInfo; - DateInfo* info = &dateInfo; int status; - if (objc != 5) { - Tcl_WrongNumArgs(interp, 1, objv, - "stringToParse baseYear baseMonth baseDay" ); - return TCL_ERROR; - } - - yyInput = Tcl_GetString( objv[1] ); - dateInfo.dateStart = yyInput; + /* + * yyInput = stringToParse; + * yyYear = baseYear; yyMonth = baseMonth; yyDay = baseDay; + */ yyHaveDate = 0; - if (Tcl_GetIntFromObj(interp, objv[2], &yr) != TCL_OK - || Tcl_GetIntFromObj(interp, objv[3], &mo) != TCL_OK - || Tcl_GetIntFromObj(interp, objv[4], &da) != TCL_OK) { - return TCL_ERROR; - } - yyYear = yr; yyMonth = mo; yyDay = da; yyHaveTime = 0; yyHour = 0; yyMinutes = 0; yySeconds = 0; yyMeridian = MER24; @@ -2786,19 +2730,20 @@ TclClockOldscanObjCmd( yyHaveRel = 0; yyRelMonth = 0; yyRelDay = 0; yyRelSeconds = 0; yyRelPointer = NULL; - dateInfo.messages = Tcl_NewObj(); - dateInfo.separatrix = ""; - Tcl_IncrRefCount(dateInfo.messages); + info->messages = Tcl_NewObj(); + info->separatrix = ""; + Tcl_IncrRefCount(info->messages); - status = yyparse(&dateInfo); + info->dateStart = yyInput; + status = yyparse(info); if (status == 1) { - Tcl_SetObjResult(interp, dateInfo.messages); - Tcl_DecrRefCount(dateInfo.messages); + Tcl_SetObjResult(interp, info->messages); + Tcl_DecrRefCount(info->messages); Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "PARSE", NULL); return TCL_ERROR; } else if (status == 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj("memory exhausted", -1)); - Tcl_DecrRefCount(dateInfo.messages); + Tcl_DecrRefCount(info->messages); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); return TCL_ERROR; } else if (status != 0) { @@ -2806,11 +2751,11 @@ TclClockOldscanObjCmd( "from date parser. Please " "report this error as a " "bug in Tcl.", -1)); - Tcl_DecrRefCount(dateInfo.messages); + Tcl_DecrRefCount(info->messages); Tcl_SetErrorCode(interp, "TCL", "BUG", NULL); return TCL_ERROR; } - Tcl_DecrRefCount(dateInfo.messages); + Tcl_DecrRefCount(info->messages); if (yyHaveDate > 1) { Tcl_SetObjResult(interp, @@ -2843,6 +2788,40 @@ TclClockOldscanObjCmd( return TCL_ERROR; } + return TCL_OK; +} + +int +TclClockOldscanObjCmd( + ClientData clientData, /* Unused */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Count of paraneters */ + Tcl_Obj *const *objv) /* Parameters */ +{ + Tcl_Obj *result, *resultElement; + int yr, mo, da; + DateInfo dateInfo; + DateInfo* info = &dateInfo; + + if (objc != 5) { + Tcl_WrongNumArgs(interp, 1, objv, + "stringToParse baseYear baseMonth baseDay" ); + return TCL_ERROR; + } + + yyInput = Tcl_GetString( objv[1] ); + + if (Tcl_GetIntFromObj(interp, objv[2], &yr) != TCL_OK + || Tcl_GetIntFromObj(interp, objv[3], &mo) != TCL_OK + || Tcl_GetIntFromObj(interp, objv[4], &da) != TCL_OK) { + return TCL_ERROR; + } + yyYear = yr; yyMonth = mo; yyDay = da; + + if (TclClockFreeScan(interp, info) != TCL_OK) { + return TCL_ERROR; + } + result = Tcl_NewObj(); resultElement = Tcl_NewObj(); if (yyHaveDate) { diff --git a/generic/tclDate.h b/generic/tclDate.h new file mode 100644 index 0000000..91e677f --- /dev/null +++ b/generic/tclDate.h @@ -0,0 +1,77 @@ +/* + * tclDate.h -- + * + * This header file handles common usage of clock primitives + * between tclDate.c (yacc) and tclClock.c. + * + * Copyright (c) 2014 Serg G. Brester (aka sebres) + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCLCLOCK_H +#define _TCLCLOCK_H + +/* + * Structure contains return parsed fields. + */ + +typedef struct DateInfo { + + Tcl_Obj* messages; /* Error messages */ + const char* separatrix; /* String separating messages */ + + time_t dateYear; + time_t dateMonth; + time_t dateDay; + int dateHaveDate; + + time_t dateHour; + time_t dateMinutes; + time_t dateSeconds; + int dateMeridian; + int dateHaveTime; + + time_t dateTimezone; + int dateDSTmode; + int dateHaveZone; + + time_t dateRelMonth; + time_t dateRelDay; + time_t dateRelSeconds; + int dateHaveRel; + + time_t dateMonthOrdinal; + int dateHaveOrdinalMonth; + + time_t dateDayOrdinal; + time_t dateDayNumber; + int dateHaveDay; + + const char *dateStart; + const char *dateInput; + time_t *dateRelPointer; + + int dateDigitCount; +} DateInfo; + + +/* + * Meridian: am, pm, or 24-hour style. + */ + +typedef enum _MERIDIAN { + MERam, MERpm, MER24 +} MERIDIAN; + +/* + * Prototypes of module functions. + */ + +MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, + time_t Seconds, MERIDIAN Meridian); + +MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); + +#endif /* _TCLCLOCK_H */ diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index da4c3fd..ac781ad 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -50,44 +50,7 @@ * parsed fields will be returned. */ -typedef struct DateInfo { - - Tcl_Obj* messages; /* Error messages */ - const char* separatrix; /* String separating messages */ - - time_t dateYear; - time_t dateMonth; - time_t dateDay; - int dateHaveDate; - - time_t dateHour; - time_t dateMinutes; - time_t dateSeconds; - int dateMeridian; - int dateHaveTime; - - time_t dateTimezone; - int dateDSTmode; - int dateHaveZone; - - time_t dateRelMonth; - time_t dateRelDay; - time_t dateRelSeconds; - int dateHaveRel; - - time_t dateMonthOrdinal; - int dateHaveOrdinalMonth; - - time_t dateDayOrdinal; - time_t dateDayNumber; - int dateHaveDay; - - const char *dateStart; - const char *dateInput; - time_t *dateRelPointer; - - int dateDigitCount; -} DateInfo; +#include "tclDate.h" #define YYMALLOC ckalloc #define YYFREE(x) (ckfree((void*) (x))) @@ -150,14 +113,6 @@ typedef enum _DSTMODE { DSTon, DSToff, DSTmaybe } DSTMODE; -/* - * Meridian: am, pm, or 24-hour style. - */ - -typedef enum _MERIDIAN { - MERam, MERpm, MER24 -} MERIDIAN; - %} %union { @@ -176,8 +131,6 @@ static int LookupWord(YYSTYPE* yylvalPtr, char *buff); DateInfo* info, const char *s); static int TclDatelex(YYSTYPE* yylvalPtr, YYLTYPE* location, DateInfo* info); -static time_t ToSeconds(time_t Hours, time_t Minutes, - time_t Seconds, MERIDIAN Meridian); MODULE_SCOPE int yyparse(DateInfo*); %} @@ -730,7 +683,7 @@ TclDateerror( infoPtr->separatrix = "\n"; } -static time_t +time_t ToSeconds( time_t Hours, time_t Minutes, @@ -957,36 +910,20 @@ TclDatelex( } while (Count > 0); } } - + int -TclClockOldscanObjCmd( - ClientData clientData, /* Unused */ +TclClockFreeScan( Tcl_Interp *interp, /* Tcl interpreter */ - int objc, /* Count of paraneters */ - Tcl_Obj *const *objv) /* Parameters */ + DateInfo *info) /* Input and result parameters */ { - Tcl_Obj *result, *resultElement; - int yr, mo, da; - DateInfo dateInfo; - DateInfo* info = &dateInfo; int status; - if (objc != 5) { - Tcl_WrongNumArgs(interp, 1, objv, - "stringToParse baseYear baseMonth baseDay" ); - return TCL_ERROR; - } - - yyInput = Tcl_GetString( objv[1] ); - dateInfo.dateStart = yyInput; + /* + * yyInput = stringToParse; + * yyYear = baseYear; yyMonth = baseMonth; yyDay = baseDay; + */ yyHaveDate = 0; - if (Tcl_GetIntFromObj(interp, objv[2], &yr) != TCL_OK - || Tcl_GetIntFromObj(interp, objv[3], &mo) != TCL_OK - || Tcl_GetIntFromObj(interp, objv[4], &da) != TCL_OK) { - return TCL_ERROR; - } - yyYear = yr; yyMonth = mo; yyDay = da; yyHaveTime = 0; yyHour = 0; yyMinutes = 0; yySeconds = 0; yyMeridian = MER24; @@ -1003,19 +940,20 @@ TclClockOldscanObjCmd( yyHaveRel = 0; yyRelMonth = 0; yyRelDay = 0; yyRelSeconds = 0; yyRelPointer = NULL; - dateInfo.messages = Tcl_NewObj(); - dateInfo.separatrix = ""; - Tcl_IncrRefCount(dateInfo.messages); + info->messages = Tcl_NewObj(); + info->separatrix = ""; + Tcl_IncrRefCount(info->messages); - status = yyparse(&dateInfo); + info->dateStart = yyInput; + status = yyparse(info); if (status == 1) { - Tcl_SetObjResult(interp, dateInfo.messages); - Tcl_DecrRefCount(dateInfo.messages); + Tcl_SetObjResult(interp, info->messages); + Tcl_DecrRefCount(info->messages); Tcl_SetErrorCode(interp, "TCL", "VALUE", "DATE", "PARSE", NULL); return TCL_ERROR; } else if (status == 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj("memory exhausted", -1)); - Tcl_DecrRefCount(dateInfo.messages); + Tcl_DecrRefCount(info->messages); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); return TCL_ERROR; } else if (status != 0) { @@ -1023,11 +961,11 @@ TclClockOldscanObjCmd( "from date parser. Please " "report this error as a " "bug in Tcl.", -1)); - Tcl_DecrRefCount(dateInfo.messages); + Tcl_DecrRefCount(info->messages); Tcl_SetErrorCode(interp, "TCL", "BUG", NULL); return TCL_ERROR; } - Tcl_DecrRefCount(dateInfo.messages); + Tcl_DecrRefCount(info->messages); if (yyHaveDate > 1) { Tcl_SetObjResult(interp, @@ -1060,6 +998,40 @@ TclClockOldscanObjCmd( return TCL_ERROR; } + return TCL_OK; +} + +int +TclClockOldscanObjCmd( + ClientData clientData, /* Unused */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Count of paraneters */ + Tcl_Obj *const *objv) /* Parameters */ +{ + Tcl_Obj *result, *resultElement; + int yr, mo, da; + DateInfo dateInfo; + DateInfo* info = &dateInfo; + + if (objc != 5) { + Tcl_WrongNumArgs(interp, 1, objv, + "stringToParse baseYear baseMonth baseDay" ); + return TCL_ERROR; + } + + yyInput = Tcl_GetString( objv[1] ); + + if (Tcl_GetIntFromObj(interp, objv[2], &yr) != TCL_OK + || Tcl_GetIntFromObj(interp, objv[3], &mo) != TCL_OK + || Tcl_GetIntFromObj(interp, objv[4], &da) != TCL_OK) { + return TCL_ERROR; + } + yyYear = yr; yyMonth = mo; yyDay = da; + + if (TclClockFreeScan(interp, info) != TCL_OK) { + return TCL_ERROR; + } + result = Tcl_NewObj(); resultElement = Tcl_NewObj(); if (yyHaveDate) { diff --git a/library/clock.tcl b/library/clock.tcl index 5b48eb3..9c3f95c 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -287,6 +287,10 @@ proc ::tcl::clock::Initialize {} { variable FEB_28 58 + # Current year century and year of century switch + variable CurrentYearCentury 2000 + variable YearOfCenturySwitch 37 + # Translation table to map Windows TZI onto cities, so that the Olson # rules can apply. In some cases the mapping is ambiguous, so it's wise # to specify $::env(TCL_TZ) rather than simply depending on the system @@ -1295,7 +1299,7 @@ proc ::tcl::clock::__org_scan { args } { # #---------------------------------------------------------------------- -proc ::tcl::clock::FreeScan { string base timezone locale } { +proc ::tcl::clock::__org_FreeScan { string base timezone locale } { variable TZData @@ -1341,7 +1345,8 @@ proc ::tcl::clock::FreeScan { string base timezone locale } { if { [llength $parseDate] > 0 } { lassign $parseDate y m d if { $y < 100 } { - if { $y >= 39 } { + variable YearOfCenturySwitch + if { $y > $YearOfCenturySwitch } { incr y 1900 } else { incr y 2000 @@ -2719,12 +2724,14 @@ proc ::tcl::clock::ScanWide { str } { proc ::tcl::clock::InterpretTwoDigitYear { date baseTime { twoDigitField yearOfCentury } { fourDigitField year } } { + variable CurrentYearCentury + variable YearOfCenturySwitch set yr [dict get $date $twoDigitField] - if { $yr <= 37 } { - dict set date $fourDigitField [expr { $yr + 2000 }] - } else { - dict set date $fourDigitField [expr { $yr + 1900 }] + incr yr $CurrentYearCentury + if { $yr <= $YearOfCenturySwitch } { + incr yr -100 } + dict set date $fourDigitField $yr return $date } diff --git a/library/init.tcl b/library/init.tcl index e6df12b..4bbce51 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -178,7 +178,7 @@ if {[interp issafe]} { # Auto-loading stubs for 'clock.tcl' - foreach cmd {add format FreeScan} { + foreach cmd {add format} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] diff --git a/win/makefile.vc b/win/makefile.vc index d6de5e1..26ee669 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -482,7 +482,9 @@ cdebug = $(cdebug) -Zi ### Warnings are too many, can't support warnings into errors. cdebug = -Zi -Od $(DEBUGFLAGS) !else -cdebug = -Zi -WX $(DEBUGFLAGS) +# no -WX option here (error C2220: warning treated as error): +#cdebug = -Zi -WX $(DEBUGFLAGS) +cdebug = -Zi $(DEBUGFLAGS) !endif ### Declarations common to all compiler options -- cgit v0.12 From 736824a25976c9bdf14978f1592078171cb6dd5b Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 21:59:59 +0000 Subject: [temp-commit]: ClockFreeScan almost ready, test-performance cases merged --- generic/tclClock.c | 370 +++++++++++++++++++++++++++++++++++++++------- library/clock.tcl | 75 +++++----- library/init.tcl | 2 +- tests-perf/clock.perf.tcl | 59 ++++++++ 4 files changed, 415 insertions(+), 91 deletions(-) create mode 100644 tests-perf/clock.perf.tcl diff --git a/generic/tclClock.c b/generic/tclClock.c index 24ed095..6d619e0 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -81,7 +81,7 @@ typedef enum ClockLiteral { #endif LIT__END } ClockLiteral; -static const char *const literals[] = { +static const char *const Literals[] = { "", "%a %b %d %H:%M:%S %Z %Y", "BCE", "C", @@ -114,6 +114,14 @@ static const char *const literals[] = { typedef struct ClockClientData { size_t refCount; /* Number of live references. */ Tcl_Obj **literals; /* Pool of object literals. */ + /* Cache for current clock parameters, imparted via "configure" */ + unsigned int LastTZEpoch; + Tcl_Obj *LastSystemTimeZone; + Tcl_Obj *SystemSetupTZData; + Tcl_Obj *GMTSetupTimeZone; + Tcl_Obj *GMTSetupTZData; + Tcl_Obj *LastSetupTimeZone; + Tcl_Obj *LastSetupTZData; } ClockClientData; /* @@ -171,6 +179,8 @@ static int ConvertLocalToUTCUsingTable(Tcl_Interp *, TclDateFields *, int, Tcl_Obj *const[]); static int ConvertLocalToUTCUsingC(Tcl_Interp *, TclDateFields *, int); +static int ClockConfigureObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static Tcl_Obj * LookupLastTransition(Tcl_Interp *, Tcl_WideInt, int, Tcl_Obj *const *); static void GetYearWeekDay(TclDateFields *, int); @@ -222,6 +232,7 @@ static int ClockFreeScan( Tcl_Obj *strObj, Tcl_WideInt baseVal, Tcl_Obj *timezoneObj, Tcl_Obj *locale); static struct tm * ThreadSafeLocalTime(const time_t *); +static unsigned int TzsetGetEpoch(void); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); @@ -245,6 +256,7 @@ static const struct ClockCommand clockCommands[] = { { "milliseconds", ClockMillisecondsObjCmd }, { "seconds", ClockSecondsObjCmd }, { "scan", ClockScanObjCmd }, + { "configure", ClockConfigureObjCmd }, { "Oldscan", TclClockOldscanObjCmd }, { "ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd }, { "GetDateFields", ClockGetdatefieldsObjCmd }, @@ -302,9 +314,16 @@ TclClockInit( data->refCount = 0; data->literals = ckalloc(LIT__END * sizeof(Tcl_Obj*)); for (i = 0; i < LIT__END; ++i) { - data->literals[i] = Tcl_NewStringObj(literals[i], -1); + data->literals[i] = Tcl_NewStringObj(Literals[i], -1); Tcl_IncrRefCount(data->literals[i]); } + data->LastTZEpoch = 0; + data->LastSystemTimeZone = NULL; + data->SystemSetupTZData = NULL; + data->GMTSetupTimeZone = NULL; + data->GMTSetupTZData = NULL; + data->LastSetupTimeZone = NULL; + data->LastSetupTZData = NULL; /* * Install the commands. @@ -322,6 +341,191 @@ TclClockInit( /* *---------------------------------------------------------------------- + * + * ClockDeleteCmdProc -- + * + * Remove a reference to the clock client data, and clean up memory + * when it's all gone. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +ClockDeleteCmdProc( + ClientData clientData) /* Opaque pointer to the client data */ +{ + ClockClientData *data = clientData; + int i; + + if (data->refCount-- <= 1) { + for (i = 0; i < LIT__END; ++i) { + Tcl_DecrRefCount(data->literals[i]); + } + + if (data->LastSystemTimeZone) { + Tcl_DecrRefCount(data->LastSystemTimeZone); + } + if (data->GMTSetupTimeZone) { + Tcl_DecrRefCount(data->GMTSetupTimeZone); + } + if (data->LastSetupTimeZone) { + Tcl_DecrRefCount(data->LastSetupTimeZone); + } + + ckfree(data->literals); + ckfree(data); + } +} + +/* + *---------------------------------------------------------------------- + */ +inline Tcl_Obj * +NormTimezoneObj( + ClockClientData *dataPtr, /* Client data containing literal pool */ + Tcl_Obj * timezoneObj) +{ + const char * tz; + if ( timezoneObj == dataPtr->literals[LIT_GMT] + || timezoneObj == dataPtr->LastSystemTimeZone + || timezoneObj == dataPtr->LastSetupTimeZone + ) { + return timezoneObj; + } + + tz = TclGetString(timezoneObj); + if ( + strcmp(tz, Literals[LIT_GMT]) == 0 + ) { + timezoneObj = dataPtr->literals[LIT_GMT]; + } + else + if (dataPtr->LastSystemTimeZone != NULL && + (timezoneObj == dataPtr->LastSystemTimeZone + || strcmp(tz, TclGetString(dataPtr->LastSystemTimeZone)) == 0 + ) + ) { + timezoneObj = dataPtr->LastSystemTimeZone; + } + else + if (dataPtr->LastSetupTimeZone != NULL && + (timezoneObj == dataPtr->LastSetupTimeZone + || strcmp(tz, TclGetString(dataPtr->LastSetupTimeZone)) == 0 + ) + ) { + timezoneObj = dataPtr->LastSetupTimeZone; + } + return timezoneObj; +} + +/* + *---------------------------------------------------------------------- + */ +static int +ClockConfigureObjCmd( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Parameter count */ + Tcl_Obj *const objv[]) /* Parameter vector */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **litPtr = dataPtr->literals; + + static const char *const options[] = { + "-system-tz", "-setup-tz", "-clear", + NULL + }; + enum optionInd { + CLOCK_SYSTEM_TZ, CLOCK_SETUP_TZ, CLOCK_CLEAR_CACHE, + CLOCK_SETUP_GMT, CLOCK_SETUP_NOP + }; + int optionIndex; /* Index of an option. */ + int i; + + for (i = 1; i < objc; i+=2) { + if (Tcl_GetIndexFromObj(interp, objv[i], options, + "option", 0, &optionIndex) != TCL_OK) { + Tcl_SetErrorCode(interp, "CLOCK", "badOption", + Tcl_GetString(objv[i]), NULL); + return TCL_ERROR; + } + if (optionIndex == CLOCK_SYSTEM_TZ || optionIndex == CLOCK_CLEAR_CACHE) { + if (dataPtr->LastSystemTimeZone) { + Tcl_DecrRefCount(dataPtr->LastSystemTimeZone); + dataPtr->LastSystemTimeZone = NULL; + dataPtr->SystemSetupTZData = NULL; + } + if (optionIndex != CLOCK_CLEAR_CACHE) { + /* validate current tz-epoch */ + unsigned int lastTZEpoch = TzsetGetEpoch(); + if (i+1 < objc) { + Tcl_IncrRefCount( + dataPtr->LastSystemTimeZone = objv[i+1]); + dataPtr->LastTZEpoch = lastTZEpoch; + } else if (dataPtr->LastSystemTimeZone + && dataPtr->LastTZEpoch == lastTZEpoch) { + Tcl_SetObjResult(interp, dataPtr->LastSystemTimeZone); + } + } + } + if (optionIndex == CLOCK_SETUP_TZ || optionIndex == CLOCK_CLEAR_CACHE) { + Tcl_Obj *timezoneObj = NULL; + /* differentiate GMT and system zones, because used often */ + if (i+1 < objc) { + timezoneObj = NormTimezoneObj(dataPtr, objv[i+1]); + if (optionIndex == CLOCK_SETUP_TZ) { + if (timezoneObj == litPtr[LIT_GMT]) { + optionIndex = CLOCK_SETUP_GMT; + } else if (timezoneObj == dataPtr->LastSystemTimeZone) { + optionIndex = CLOCK_SETUP_NOP; + } + } + } + + if (optionIndex == CLOCK_SETUP_GMT || optionIndex == CLOCK_CLEAR_CACHE) { + if (dataPtr->GMTSetupTimeZone) { + Tcl_DecrRefCount(dataPtr->GMTSetupTimeZone); + dataPtr->GMTSetupTimeZone = NULL; + dataPtr->GMTSetupTZData = NULL; + } + if (optionIndex != CLOCK_CLEAR_CACHE) { + if (i+1 < objc) { + Tcl_IncrRefCount( + dataPtr->GMTSetupTimeZone = timezoneObj); + } else if (dataPtr->GMTSetupTimeZone) { + Tcl_SetObjResult(interp, dataPtr->GMTSetupTimeZone); + } + } + } + if (optionIndex == CLOCK_SETUP_TZ || optionIndex == CLOCK_CLEAR_CACHE) { + if (dataPtr->LastSetupTimeZone) { + Tcl_DecrRefCount(dataPtr->LastSetupTimeZone); + dataPtr->LastSetupTimeZone = NULL; + dataPtr->LastSetupTZData = NULL; + } + if (optionIndex != CLOCK_CLEAR_CACHE) { + if (i+1 < objc) { + Tcl_IncrRefCount( + dataPtr->LastSetupTimeZone = timezoneObj); + } else if (dataPtr->LastSetupTimeZone) { + Tcl_SetObjResult(interp, dataPtr->LastSetupTimeZone); + } + } + } + } + if (optionIndex == CLOCK_CLEAR_CACHE) { + dataPtr->LastTZEpoch = 0; + } + } + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- */ inline Tcl_Obj* ClockGetTZData( @@ -331,9 +535,38 @@ ClockGetTZData( { ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; + Tcl_Obj *ret, **out = NULL; + + /* differentiate GMT and system zones, because used often */ + /* simple caching, because almost used the tz-data of last timezone, (unnecessary to + * touch the refCount of it, because it is always referenced in TZData array) + */ + if (timezoneObj == dataPtr->LastSystemTimeZone) { + if (dataPtr->SystemSetupTZData != NULL) + return dataPtr->SystemSetupTZData; + out = &dataPtr->SystemSetupTZData; + } + else + if (timezoneObj == dataPtr->GMTSetupTimeZone) { + if (dataPtr->GMTSetupTZData != NULL) + return dataPtr->GMTSetupTZData; + out = &dataPtr->GMTSetupTZData; + } + else + if (timezoneObj == dataPtr->LastSetupTimeZone) { + if (dataPtr->LastSetupTZData != NULL) { + return dataPtr->LastSetupTZData; + } + out = &dataPtr->LastSetupTZData; + } - return Tcl_ObjGetVar2(interp, literals[LIT_TZDATA], + ret = Tcl_ObjGetVar2(interp, literals[LIT_TZDATA], timezoneObj, TCL_LEAVE_ERR_MSG); + + /* cache using corresponding slot */ + if (ret != NULL && out != NULL) + *out = ret; + return ret; } /* *---------------------------------------------------------------------- @@ -344,7 +577,15 @@ ClockGetSystemTimeZone( Tcl_Interp *interp) /* Tcl interpreter */ { ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; + Tcl_Obj **literals; + + /* if known (cached and same epoch) - return now */ + if (dataPtr->LastSystemTimeZone != NULL + && dataPtr->LastTZEpoch == TzsetGetEpoch()) { + return dataPtr->LastSystemTimeZone; + } + + literals = dataPtr->literals; if (Tcl_EvalObjv(interp, 1, &literals[LIT_GETSYSTEMTIMEZONE], 0) != TCL_OK) { return NULL; @@ -354,7 +595,7 @@ ClockGetSystemTimeZone( /* *---------------------------------------------------------------------- */ -static int +static Tcl_Obj * ClockSetupTimeZone( ClientData clientData, /* Opaque pointer to literal pool, etc. */ Tcl_Interp *interp, /* Tcl interpreter */ @@ -364,9 +605,22 @@ ClockSetupTimeZone( Tcl_Obj **literals = dataPtr->literals; Tcl_Obj *callargs[2]; + /* differentiate GMT and system zones, because used often and already set */ + timezoneObj = NormTimezoneObj(dataPtr, timezoneObj); + if ( timezoneObj == dataPtr->GMTSetupTimeZone + || timezoneObj == dataPtr->LastSystemTimeZone + || timezoneObj == dataPtr->LastSetupTimeZone + ) { + return timezoneObj; + } + callargs[0] = literals[LIT_SETUPTIMEZONE]; callargs[1] = timezoneObj; - return Tcl_EvalObjv(interp, 2, callargs, 0); + + if (Tcl_EvalObjv(interp, 2, callargs, 0) == TCL_OK) { + return NormTimezoneObj(dataPtr, timezoneObj); + } + return NULL; } /* *---------------------------------------------------------------------- @@ -1752,12 +2006,10 @@ static int IsGregorianLeapYear( TclDateFields *fields) /* Date to test */ { - int year; + int year = fields->year; if (fields->era == BCE) { - year = 1 - fields->year; - } else { - year = fields->year; + year = 1 - year; } if (year%4 != 0) { return 0; @@ -2313,13 +2565,15 @@ ClockFreeScan( DateInfo yy; /* parse structure of TclClockFreeScan */ TclDateFields date; /* date fields used for converting from seconds */ + TclDateFields date2; /* date fields used for in-between calculation */ Tcl_Obj *tzdata; int secondOfDay; /* Seconds of day (time only calculation) */ Tcl_WideInt seconds; int ret = TCL_ERROR; - Tcl_Obj *cleanUpList = Tcl_NewObj(); + // Tcl_Obj *cleanUpList = Tcl_NewObj(); date.tzName = NULL; + date2.tzName = NULL; /* If time zone not specified use system time zone */ if (timezoneObj == NULL || @@ -2328,12 +2582,13 @@ ClockFreeScan( if (timezoneObj == NULL) { goto done; } - Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); + // Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); } /* Get the data for time changes in the given zone */ - if (ClockSetupTimeZone(clientData, interp, timezoneObj) != TCL_OK) { + timezoneObj = ClockSetupTimeZone(clientData, interp, timezoneObj); + if (timezoneObj == NULL) { goto done; } @@ -2366,9 +2621,8 @@ ClockFreeScan( if (TclClockFreeScan(interp, &yy) != TCL_OK) { Tcl_Obj *msg = Tcl_NewObj(); - Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"", - yy.dateInput, "\":", - TclGetString(Tcl_GetObjResult(interp))); + Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"%s\": %s", + Tcl_GetString(strObj), TclGetString(Tcl_GetObjResult(interp))); Tcl_SetObjResult(interp, msg); goto done; } @@ -2405,8 +2659,9 @@ ClockFreeScan( int dstFlag = 1 - yy.dateDSTmode; timezoneObj = ClockFormatNumericTimeZone( 60 * minEast + 3600 * dstFlag); - Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); - if (ClockSetupTimeZone(clientData, interp, timezoneObj) != TCL_OK) { + // Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); + timezoneObj = ClockSetupTimeZone(clientData, interp, timezoneObj); + if (timezoneObj == NULL) { goto done; } tzdata = ClockGetTZData(clientData, interp, timezoneObj); @@ -2458,7 +2713,7 @@ ClockFreeScan( if (yy.dateHaveRel) { - /* [SB] TODO: rewrite it in C: * / + /* seconds = [add $seconds \ yy.dateRelMonth months yy.dateRelDay days yy.dateRelMonthSecond seconds \ -timezone $timezone -locale $locale] @@ -2470,17 +2725,21 @@ ClockFreeScan( */ if (yy.dateHaveDay && !yy.dateHaveDate) { - TclDateFields date2; - date2.tzName = NULL; + memcpy(&date2, &date, sizeof(date)); + if (date2.tzName != NULL) { + Tcl_IncrRefCount(date2.tzName); + } + /* SetDateFieldsTimeZone(&date2, timezoneObj); date2.seconds = date.seconds; if (ClockGetDateFields(interp, &date2, tzdata, GREGORIAN_CHANGE_DATE) != TCL_OK) { - SetDateFieldsTimeZone(&date2, NULL); goto done; } + */ + date2.era = CE; date2.julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date2.julianDay + 6) + 7 * yy.dateDayOrdinal; @@ -2493,13 +2752,12 @@ ClockFreeScan( + ( 86400 * (Tcl_WideInt)date2.julianDay ) + secondOfDay; - SetDateFieldsTimeZone(&date2, timezoneObj); + // check set time zone again may be really necessary here: + // SetDateFieldsTimeZone(&date2, timezoneObj); if (ConvertLocalToUTC(interp, &date2, tzdata, GREGORIAN_CHANGE_DATE) != TCL_OK) { - SetDateFieldsTimeZone(&date2, NULL); goto done; } - SetDateFieldsTimeZone(&date2, NULL); seconds = date2.seconds; } @@ -2536,7 +2794,10 @@ done: if (date.tzName != NULL) { Tcl_DecrRefCount(date.tzName); } - Tcl_DecrRefCount(cleanUpList); + if (date2.tzName != NULL) { + Tcl_DecrRefCount(date2.tzName); + } + // Tcl_DecrRefCount(cleanUpList); if (ret != TCL_OK) { return ret; @@ -2599,15 +2860,30 @@ ClockSecondsObjCmd( *---------------------------------------------------------------------- */ -static void -TzsetIfNecessary(void) +static unsigned int +TzsetGetEpoch(void) { static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by - * clockMutex. */ - const char *tzIsNow; /* Current value of TZ */ + * clockMutex. */ + static long tzNextRefresh = 0; /* Latence before next refresh */ + static unsigned int tzWasEpoch = 1; /* Epoch, signals that TZ changed */ + + const char *tzIsNow; /* Current value of TZ */ + + /* fast check whether environment was changed (once per second) */ + Tcl_Time now; + Tcl_GetTime(&now); + if (now.sec < tzNextRefresh) { + return tzWasEpoch; + } + tzNextRefresh = now.sec + 1; + /* check in lock */ Tcl_MutexLock(&clockMutex); - tzIsNow = getenv("TZ"); + tzIsNow = getenv("TCL_TZ"); + if (tzIsNow == NULL) { + tzIsNow = getenv("TZ"); + } if (tzIsNow != NULL && (tzWas == NULL || tzWas == INT2PTR(-1) || strcmp(tzIsNow, tzWas) != 0)) { tzset(); @@ -2616,42 +2892,22 @@ TzsetIfNecessary(void) } tzWas = ckalloc(strlen(tzIsNow) + 1); strcpy(tzWas, tzIsNow); + tzWasEpoch++; } else if (tzIsNow == NULL && tzWas != NULL) { tzset(); if (tzWas != INT2PTR(-1)) ckfree(tzWas); tzWas = NULL; + tzWasEpoch++; } Tcl_MutexUnlock(&clockMutex); + + return tzWasEpoch; } - -/* - *---------------------------------------------------------------------- - * - * ClockDeleteCmdProc -- - * - * Remove a reference to the clock client data, and clean up memory - * when it's all gone. - * - * Results: - * None. - * - *---------------------------------------------------------------------- - */ static void -ClockDeleteCmdProc( - ClientData clientData) /* Opaque pointer to the client data */ +TzsetIfNecessary(void) { - ClockClientData *data = clientData; - int i; - - if (data->refCount-- <= 1) { - for (i = 0; i < LIT__END; ++i) { - Tcl_DecrRefCount(data->literals[i]); - } - ckfree(data->literals); - ckfree(data); - } + TzsetGetEpoch(); } /* diff --git a/library/clock.tcl b/library/clock.tcl index 9c3f95c..90b3c69 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -633,10 +633,6 @@ proc ::tcl::clock::Initialize {} { # in the given locales and dictionaries # mapping the numerals to their numeric # values. - # variable CachedSystemTimeZone; # If 'CachedSystemTimeZone' exists, - # it contains the value of the - # system time zone, as determined from - # the environment. variable TimeZoneBad {}; # Dictionary whose keys are time zone # names and whose values are 1 if # the time zone is unknown and 0 @@ -2984,13 +2980,12 @@ proc ::tcl::clock::InterpretHMS { date } { # Returns the system time zone. # # Side effects: -# Stores the sustem time zone in the 'CachedSystemTimeZone' -# variable, since determining it may be an expensive process. +# Stores the sustem time zone in engine configuration, since +# determining it may be an expensive process. # #---------------------------------------------------------------------- proc ::tcl::clock::GetSystemTimeZone {} { - variable CachedSystemTimeZone variable TimeZoneBad if {[set result [getenv TCL_TZ]] ne {}} { @@ -2999,29 +2994,33 @@ proc ::tcl::clock::GetSystemTimeZone {} { set timezone $result } if {![info exists timezone]} { - # Cache the time zone only if it was detected by one of the - # expensive methods. - if { [info exists CachedSystemTimeZone] } { - set timezone $CachedSystemTimeZone - } elseif { $::tcl_platform(platform) eq {windows} } { - set timezone [GuessWindowsTimeZone] - } elseif { [file exists /etc/localtime] - && ![catch {ReadZoneinfoFile \ - Tcl/Localtime /etc/localtime}] } { - set timezone :Tcl/Localtime - } else { - set timezone :localtime + # ask engine for the cached timezone: + set timezone [configure -system-tz] + if { $timezone ne "" } { + return $timezone } - set CachedSystemTimeZone $timezone + if { $::tcl_platform(platform) eq {windows} } { + set timezone [GuessWindowsTimeZone] + } elseif { [file exists /etc/localtime] + && ![catch {ReadZoneinfoFile \ + Tcl/Localtime /etc/localtime}] } { + set timezone :Tcl/Localtime + } else { + set timezone :localtime + } } if { ![dict exists $TimeZoneBad $timezone] } { - dict set TimeZoneBad $timezone [catch {SetupTimeZone $timezone}] + catch {SetupTimeZone $timezone} } - if { [dict get $TimeZoneBad $timezone] } { - return :localtime - } else { - return $timezone + + if { [dict exists $TimeZoneBad $timezone] } { + set timezone :localtime } + + # tell backend - current system timezone: + configure -system-tz $timezone + + return $timezone } #---------------------------------------------------------------------- @@ -3077,6 +3076,13 @@ proc ::tcl::clock::SetupTimeZone { timezone } { variable TZData if {! [info exists TZData($timezone)] } { + + variable TimeZoneBad + if { [dict exists $TimeZoneBad $timezone] } { + return -code error \ + -errorcode [list CLOCK badTimeZone $timezone] \ + "time zone \"$timezone\" not found" + } variable MINWIDE if { $timezone eq {:localtime} } { # Nothing to do, we'll convert using the localtime function @@ -3114,6 +3120,7 @@ proc ::tcl::clock::SetupTimeZone { timezone } { LoadZoneinfoFile [string range $timezone 1 end] }] } then { + dict set TimeZoneBad $timezone 1 return -code error \ -errorcode [list CLOCK badTimeZone $timezone] \ "time zone \"$timezone\" not found" @@ -3125,6 +3132,7 @@ proc ::tcl::clock::SetupTimeZone { timezone } { if { [lindex [dict get $opts -errorcode] 0] eq {CLOCK} } { dict unset opts -errorinfo } + dict set TimeZoneBad $timezone 1 return -options $opts $data } else { set TZData($timezone) $data @@ -3137,13 +3145,15 @@ proc ::tcl::clock::SetupTimeZone { timezone } { if { [catch { LoadTimeZoneFile $timezone }] && [catch { LoadZoneinfoFile $timezone } - opts] } { dict unset opts -errorinfo + dict set TimeZoneBad $timezone 1 return -options $opts "time zone $timezone not found" } set TZData($timezone) $TZData(:$timezone) } } - return + # tell backend - timezone is initialized: + configure -setup-tz $timezone } #---------------------------------------------------------------------- @@ -3214,12 +3224,12 @@ proc ::tcl::clock::GuessWindowsTimeZone {} { if { [dict exists $WinZoneInfo $data] } { set tzname [dict get $WinZoneInfo $data] if { ! [dict exists $TimeZoneBad $tzname] } { - dict set TimeZoneBad $tzname [catch {SetupTimeZone $tzname}] + catch {SetupTimeZone $tzname} } } else { set tzname {} } - if { $tzname eq {} || [dict get $TimeZoneBad $tzname] } { + if { $tzname eq {} || [dict exists $TimeZoneBad $tzname] } { lassign $data \ bias stdBias dstBias \ stdYear stdMonth stdDayOfWeek stdDayOfMonth \ @@ -4556,8 +4566,6 @@ proc ::tcl::clock::AddDays { days clockval timezone changeover } { proc ::tcl::clock::ChangeCurrentLocale {args} { variable FormatProc variable LocaleNumeralCache - variable CachedSystemTimeZone - variable TimeZoneBad foreach p [info procs [namespace current]::scanproc'*'current] { rename $p {} @@ -4590,9 +4598,11 @@ proc ::tcl::clock::ChangeCurrentLocale {args} { proc ::tcl::clock::ClearCaches {} { variable FormatProc variable LocaleNumeralCache - variable CachedSystemTimeZone variable TimeZoneBad + # tell backend - should invalidate: + configure -clear + foreach p [info procs [namespace current]::scanproc'*] { rename $p {} } @@ -4600,9 +4610,8 @@ proc ::tcl::clock::ClearCaches {} { rename $p {} } - catch {unset FormatProc} + unset -nocomplain FormatProc set LocaleNumeralCache {} - catch {unset CachedSystemTimeZone} set TimeZoneBad {} InitTZData } diff --git a/library/init.tcl b/library/init.tcl index 4bbce51..5e452b0 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -178,7 +178,7 @@ if {[interp issafe]} { # Auto-loading stubs for 'clock.tcl' - foreach cmd {add format} { + foreach cmd {add format SetupTimeZone} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl new file mode 100644 index 0000000..2e77a26 --- /dev/null +++ b/tests-perf/clock.perf.tcl @@ -0,0 +1,59 @@ +#!/usr/bin/tclsh +# ------------------------------------------------------------------------ +# +# test-performance.tcl -- +# +# This file provides common performance tests for comparison of tcl-speed +# degradation by switching between branches. +# (currently for clock ensemble only) +# +# ------------------------------------------------------------------------ +# +# Copyright (c) 2014 Serg G. Brester (aka sebres) +# +# See the file "license.terms" for information on usage and redistribution +# of this file. +# + +proc test-scan {{rep 100000}} { + foreach {comment c} { + "# FreeScan : relative date" + {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} + "# FreeScan : time only with base" + {clock scan "19:18:30" -base 148863600 -gmt 1} + "# FreeScan : time only without base" + {clock scan "19:18:30" -gmt 1} + "# FreeScan : date, system time zone" + {clock scan "05/08/2016 20:18:30"} + "# FreeScan : date, supplied time zone" + {clock scan "05/08/2016 20:18:30" -timezone :CET} + "# FreeScan : date, supplied gmt (equivalent -timezone :GMT)" + {clock scan "05/08/2016 20:18:30" -gmt 1} + "# FreeScan : time only, numeric zone in string, base time gmt (exchange zones between gmt / -0500)" + {clock scan "20:18:30 -0500" -base 148863600 -gmt 1} + "# FreeScan : time only, zone in string (exchange zones between system / gmt)" + {clock scan "19:18:30 GMT" -base 148863600} + } { + puts "\n% $comment\n% $c" + puts [clock format [{*}$c]] + puts [time $c $rep] + } +} + +proc test-other {{rep 100000}} { + foreach {comment c} { + "# Bad zone" + {catch {clock scan "1 day" -timezone BAD_ZONE}} + } { + puts "\n% $comment\n% $c" + puts [if 1 $c] + puts [time $c $rep] + } +} + +if 1 {;# + test-scan 100000 + test-other 50000 + + puts \n**OK** +};# \ No newline at end of file -- cgit v0.12 From 18b31092c654c918fdb833a1bc70f6ee61449ff4 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:01:13 +0000 Subject: [temp-commit]: ClockFreeScan seems to be ready, test case should be checked --- generic/tclClock.c | 171 ++++++++++++++++++++++++++++------------------ tests-perf/clock.perf.tcl | 21 +++++- 2 files changed, 124 insertions(+), 68 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 6d619e0..5710d6d 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -2560,12 +2560,13 @@ ClockFreeScan( Tcl_Obj *timezoneObj, /* Default time zone in which the time will be expressed */ Tcl_Obj *locale) /* (Unused) Name of the locale where the time will be scanned. */ { + enum Flags {CL_INVALIDATE = (signed int)0x80000000}; + ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; DateInfo yy; /* parse structure of TclClockFreeScan */ TclDateFields date; /* date fields used for converting from seconds */ - TclDateFields date2; /* date fields used for in-between calculation */ Tcl_Obj *tzdata; int secondOfDay; /* Seconds of day (time only calculation) */ Tcl_WideInt seconds; @@ -2573,7 +2574,6 @@ ClockFreeScan( // Tcl_Obj *cleanUpList = Tcl_NewObj(); date.tzName = NULL; - date2.tzName = NULL; /* If time zone not specified use system time zone */ if (timezoneObj == NULL || @@ -2670,11 +2670,14 @@ ClockFreeScan( } } - SetDateFieldsTimeZone(&date, timezoneObj); + /* on demand (lazy) assemble julianDay using new year, month, etc. */ + date.julianDay = CL_INVALIDATE; - /* Assemble date, time, zone into seconds-from-epoch */ + /* + * Assemble date, time, zone into seconds-from-epoch + */ - GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + SetDateFieldsTimeZone(&date, timezoneObj); if (yy.dateHaveTime == -1) { secondOfDay = 0; @@ -2694,80 +2697,79 @@ ClockFreeScan( secondOfDay = 0; } - date.localSeconds = - -210866803200L - + ( 86400 * (Tcl_WideInt)date.julianDay ) - + secondOfDay; - - SetDateFieldsTimeZone(&date, timezoneObj); - if (ConvertLocalToUTC(interp, &date, tzdata, GREGORIAN_CHANGE_DATE) - != TCL_OK) { - goto done; - } - - seconds = date.seconds; - /* * Do relative times */ +repeat_rel: + if (yy.dateHaveRel) { - /* - seconds = [add $seconds \ - yy.dateRelMonth months yy.dateRelDay days yy.dateRelMonthSecond seconds \ - -timezone $timezone -locale $locale] - */ - } + /* add months (or years in months) */ - /* - * Do relative weekday - */ + if (yy.dateRelMonth != 0) { + int m, h; - if (yy.dateHaveDay && !yy.dateHaveDate) { + /* if needed extract year, month, etc. again */ + if (date.month == CL_INVALIDATE) { + GetGregorianEraYearDay(&date, GREGORIAN_CHANGE_DATE); + GetMonthDay(&date); + GetYearWeekDay(&date, GREGORIAN_CHANGE_DATE); + } - memcpy(&date2, &date, sizeof(date)); - if (date2.tzName != NULL) { - Tcl_IncrRefCount(date2.tzName); - } - /* - SetDateFieldsTimeZone(&date2, timezoneObj); + /* add the requisite number of months */ + date.month += yy.dateRelMonth - 1; + date.year += date.month / 12; + m = date.month % 12; + date.month = m + 1; - date2.seconds = date.seconds; - if (ClockGetDateFields(interp, &date2, tzdata, GREGORIAN_CHANGE_DATE) - != TCL_OK) { - goto done; - } - */ + /* if the day doesn't exist in the current month, repair it */ + h = hath[IsGregorianLeapYear(&date)][m]; + if (date.dayOfMonth > h) { + date.dayOfMonth = h; + } - date2.era = CE; - date2.julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date2.julianDay + 6) - + 7 * yy.dateDayOrdinal; - if (yy.dateDayOrdinal > 0) { - date2.julianDay -= 7; + /* on demand (lazy) assemble julianDay using new year, month, etc. */ + date.julianDay = CL_INVALIDATE; + + yy.dateRelMonth = 0; } - secondOfDay = date2.localSeconds % 86400; - date2.localSeconds = - -210866803200 - + ( 86400 * (Tcl_WideInt)date2.julianDay ) - + secondOfDay; - - // check set time zone again may be really necessary here: - // SetDateFieldsTimeZone(&date2, timezoneObj); - if (ConvertLocalToUTC(interp, &date2, tzdata, GREGORIAN_CHANGE_DATE) - != TCL_OK) { - goto done; + + /* add days (or other parts aligned to days) */ + if (yy.dateRelDay) { + + /* assemble julianDay using new year, month, etc. */ + if (date.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + } + date.julianDay += yy.dateRelDay; + + /* julianDay was changed, on demand (lazy) extract year, month, etc. again */ + date.month = CL_INVALIDATE; + + yy.dateRelDay = 0; } - seconds = date2.seconds; + /* relative time (seconds) */ + secondOfDay += yy.dateRelSeconds; + yy.dateRelSeconds = 0; + } /* - * Do relative month + * Do relative (ordinal) month */ if (yy.dateHaveOrdinalMonth) { int monthDiff; + + /* if needed extract year, month, etc. again */ + if (date.month == CL_INVALIDATE) { + GetGregorianEraYearDay(&date, GREGORIAN_CHANGE_DATE); + GetMonthDay(&date); + GetYearWeekDay(&date, GREGORIAN_CHANGE_DATE); + } + if (yy.dateMonthOrdinal > 0) { monthDiff = yy.dateMonth - date.month; if (monthDiff <= 0) { @@ -2781,12 +2783,54 @@ ClockFreeScan( } yy.dateMonthOrdinal++; } - /* [SB] TODO: rewrite it in C: * / - seconds = [add $seconds $yy.dateMonthOrdinal years $monthDiff months \ - -timezone $timezone -locale $locale] - */ + + /* process it further via relative times */ + yy.dateHaveRel++; + date.year += yy.dateMonthOrdinal; + yy.dateRelMonth += monthDiff; + yy.dateHaveOrdinalMonth = 0; + + goto repeat_rel; + } + + /* + * Do relative weekday + */ + + if (yy.dateHaveDay && !yy.dateHaveDate) { + + /* if needed assemble julianDay now */ + if (date.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + } + + date.era = CE; + date.julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date.julianDay + 6) + + 7 * yy.dateDayOrdinal; + if (yy.dateDayOrdinal > 0) { + date.julianDay -= 7; + } + } + + /* If needed assemble julianDay using new year, month, etc. */ + if (date.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + } + + /* Local seconds to UTC */ + + date.localSeconds = + -210866803200L + + ( 86400 * (Tcl_WideInt)date.julianDay ) + + ( secondOfDay % 86400 ); + + if (ConvertLocalToUTC(interp, &date, tzdata, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + goto done; } + seconds = date.seconds; + ret = TCL_OK; done: @@ -2794,9 +2838,6 @@ done: if (date.tzName != NULL) { Tcl_DecrRefCount(date.tzName); } - if (date2.tzName != NULL) { - Tcl_DecrRefCount(date2.tzName); - } // Tcl_DecrRefCount(cleanUpList); if (ret != TCL_OK) { diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 2e77a26..52bc91f 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -19,6 +19,18 @@ proc test-scan {{rep 100000}} { foreach {comment c} { "# FreeScan : relative date" {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} + "# FreeScan : relative date with relative weekday" + {clock scan "5 years 18 months 385 days Fri" -base 0 -gmt 1} + "# FreeScan : relative date with ordinal month" + {clock scan "5 years 18 months 385 days next 1 January" -base 0 -gmt 1} + "# FreeScan : relative date with ordinal month and relative weekday" + {clock scan "5 years 18 months 385 days next January Fri" -base 0 -gmt 1} + "# FreeScan : ordinal month" + {clock scan "next January" -base 0 -gmt 1} + "# FreeScan : relative week" + {clock scan "next Fri" -base 0 -gmt 1} + "# FreeScan : relative weekday and week offset " + {clock scan "next January + 2 week" -base 0 -gmt 1} "# FreeScan : time only with base" {clock scan "19:18:30" -base 148863600 -gmt 1} "# FreeScan : time only without base" @@ -34,8 +46,9 @@ proc test-scan {{rep 100000}} { "# FreeScan : time only, zone in string (exchange zones between system / gmt)" {clock scan "19:18:30 GMT" -base 148863600} } { + if {[string first "**STOP**" $comment] != -1} { return -code error "**STOP**" } puts "\n% $comment\n% $c" - puts [clock format [{*}$c]] + puts [clock format [{*}$c] -locale en] puts [time $c $rep] } } @@ -45,15 +58,17 @@ proc test-other {{rep 100000}} { "# Bad zone" {catch {clock scan "1 day" -timezone BAD_ZONE}} } { + if {[string first "**STOP**" $comment] != -1} { return -code error "**STOP**" } puts "\n% $comment\n% $c" puts [if 1 $c] puts [time $c $rep] } } +set factor 10; # 50 if 1 {;# - test-scan 100000 - test-other 50000 + test-scan [expr 10000 * $factor] + test-other [expr 5000 * $factor] puts \n**OK** };# \ No newline at end of file -- cgit v0.12 From 21878028d55c47c9a84ab38e38d69b0a8123dbe3 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:02:10 +0000 Subject: [temp-commit]: ClockFreeScan ready, test case passed (2 failure because of wrong :localtime zone by TZ-switch, to be fixed) --- generic/tclClock.c | 26 +++++-- library/clock.tcl | 198 ++--------------------------------------------------- library/init.tcl | 2 +- tests/clock.test | 12 +++- 4 files changed, 37 insertions(+), 201 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 5710d6d..7256320 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -122,6 +122,7 @@ typedef struct ClockClientData { Tcl_Obj *GMTSetupTZData; Tcl_Obj *LastSetupTimeZone; Tcl_Obj *LastSetupTZData; + Tcl_Obj *LastUsedSetupTimeZone; } ClockClientData; /* @@ -324,6 +325,7 @@ TclClockInit( data->GMTSetupTZData = NULL; data->LastSetupTimeZone = NULL; data->LastSetupTZData = NULL; + data->LastUsedSetupTimeZone = NULL; /* * Install the commands. @@ -477,6 +479,7 @@ ClockConfigureObjCmd( if (i+1 < objc) { timezoneObj = NormTimezoneObj(dataPtr, objv[i+1]); if (optionIndex == CLOCK_SETUP_TZ) { + dataPtr->LastUsedSetupTimeZone = timezoneObj; if (timezoneObj == litPtr[LIT_GMT]) { optionIndex = CLOCK_SETUP_GMT; } else if (timezoneObj == dataPtr->LastSystemTimeZone) { @@ -510,14 +513,15 @@ ClockConfigureObjCmd( if (i+1 < objc) { Tcl_IncrRefCount( dataPtr->LastSetupTimeZone = timezoneObj); - } else if (dataPtr->LastSetupTimeZone) { - Tcl_SetObjResult(interp, dataPtr->LastSetupTimeZone); + } else if (dataPtr->LastUsedSetupTimeZone) { + Tcl_SetObjResult(interp, dataPtr->LastUsedSetupTimeZone); } } } } if (optionIndex == CLOCK_CLEAR_CACHE) { dataPtr->LastTZEpoch = 0; + dataPtr->LastUsedSetupTimeZone = NULL; } } @@ -605,6 +609,11 @@ ClockSetupTimeZone( Tcl_Obj **literals = dataPtr->literals; Tcl_Obj *callargs[2]; + /* if cached (if already setup this one) */ + if (timezoneObj == dataPtr->LastUsedSetupTimeZone) { + return timezoneObj; + } + /* differentiate GMT and system zones, because used often and already set */ timezoneObj = NormTimezoneObj(dataPtr, timezoneObj); if ( timezoneObj == dataPtr->GMTSetupTimeZone @@ -2546,6 +2555,15 @@ ClockScanObjCmd( } */ + if (1) { + /* TODO: Tcled Scan proc - */ + Tcl_Obj *callargs[10]; + memcpy(callargs, objv, objc * sizeof(*objv)); + callargs[0] = Tcl_NewStringObj("::tcl::clock::__org_scan", -1); + return Tcl_EvalObjv(interp, objc, callargs, 0); + } + // Tcl_SetObjResult(interp, Tcl_NewWideIntObj(10000000)); + return TCL_OK; } @@ -2635,10 +2653,10 @@ ClockFreeScan( if (yy.dateHaveDate) { if (yy.dateYear < 100) { - yy.dateYear += ClockCurrentYearCentury(clientData, interp); - if (yy.dateYear > ClockGetYearOfCenturySwitch(clientData, interp)) { + if (yy.dateYear >= ClockGetYearOfCenturySwitch(clientData, interp)) { yy.dateYear -= 100; } + yy.dateYear += ClockCurrentYearCentury(clientData, interp); } date.era = CE; date.year = yy.dateYear; diff --git a/library/clock.tcl b/library/clock.tcl index 90b3c69..b4a7639 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -289,7 +289,7 @@ proc ::tcl::clock::Initialize {} { # Current year century and year of century switch variable CurrentYearCentury 2000 - variable YearOfCenturySwitch 37 + variable YearOfCenturySwitch 38 # Translation table to map Windows TZI onto cities, so that the Olson # rules can apply. In some cases the mapping is ambiguous, so it's wise @@ -1249,18 +1249,6 @@ proc ::tcl::clock::__org_scan { args } { set timezone :GMT } - if { ![info exists saw(-format)] } { - # Perhaps someday we'll localize the legacy code. Right now, it's not - # localized. - if { [info exists saw(-locale)] } { - return -code error \ - -errorcode [list CLOCK flagWithLegacyFormat] \ - "legacy \[clock scan\] does not support -locale" - - } - return [FreeScan $string $base $timezone $locale] - } - # Change locale if a fresh locale has been given on the command line. EnterLocale $locale @@ -1279,184 +1267,6 @@ proc ::tcl::clock::__org_scan { args } { #---------------------------------------------------------------------- # -# FreeScan -- -# -# Scans a time in free format -# -# Parameters: -# string - String containing the time to scan -# base - Base time, expressed in seconds from the Epoch -# timezone - Default time zone in which the time will be expressed -# locale - (Unused) Name of the locale where the time will be scanned. -# -# Results: -# Returns the date and time extracted from the string in seconds from -# the epoch -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::__org_FreeScan { string base timezone locale } { - - variable TZData - - # Get the data for time changes in the given zone - if {$timezone eq {}} { - set timezone [GetSystemTimeZone] - } - try { - SetupTimeZone $timezone - } on error {retval opts} { - dict unset opts -errorinfo - return -options $opts $retval - } - - # Extract year, month and day from the base time for the parser to use as - # defaults - - set date [GetDateFields $base $TZData($timezone) 2361222] - dict set date secondOfDay [expr { - [dict get $date localSeconds] % 86400 - }] - - # Parse the date. The parser will return a list comprising date, time, - # time zone, relative month/day/seconds, relative weekday, ordinal month. - - try { - set scanned [Oldscan $string \ - [dict get $date year] \ - [dict get $date month] \ - [dict get $date dayOfMonth]] - lassign $scanned \ - parseDate parseTime parseZone parseRel \ - parseWeekday parseOrdinalMonth - } on error message { - return -code error \ - "unable to convert date-time string \"$string\": $message" - } - - # If the caller supplied a date in the string, update the 'date' dict with - # the value. If the caller didn't specify a time with the date, default to - # midnight. - - if { [llength $parseDate] > 0 } { - lassign $parseDate y m d - if { $y < 100 } { - variable YearOfCenturySwitch - if { $y > $YearOfCenturySwitch } { - incr y 1900 - } else { - incr y 2000 - } - } - dict set date era CE - dict set date year $y - dict set date month $m - dict set date dayOfMonth $d - if { $parseTime eq {} } { - set parseTime 0 - } - } - - # If the caller supplied a time zone in the string, it comes back as a - # two-element list; the first element is the number of minutes east of - # Greenwich, and the second is a Daylight Saving Time indicator (1 == yes, - # 0 == no, -1 == unknown). We make it into a time zone indicator of - # +-hhmm. - - if { [llength $parseZone] > 0 } { - lassign $parseZone minEast dstFlag - set timezone [FormatNumericTimeZone \ - [expr { 60 * $minEast + 3600 * $dstFlag }]] - SetupTimeZone $timezone - } - dict set date tzName $timezone - - # Assemble date, time, zone into seconds-from-epoch - - set date [GetJulianDayFromEraYearMonthDay $date[set date {}] 2361222] - if { $parseTime ne {} } { - dict set date secondOfDay $parseTime - } elseif { [llength $parseWeekday] != 0 - || [llength $parseOrdinalMonth] != 0 - || ( [llength $parseRel] != 0 - && ( [lindex $parseRel 0] != 0 - || [lindex $parseRel 1] != 0 ) ) } { - dict set date secondOfDay 0 - } - - dict set date localSeconds [expr { - -210866803200 - + ( 86400 * wide([dict get $date julianDay]) ) - + [dict get $date secondOfDay] - }] - dict set date tzName $timezone - set date [ConvertLocalToUTC $date[set date {}] $TZData($timezone) 2361222] - set seconds [dict get $date seconds] - - # Do relative times - - if { [llength $parseRel] > 0 } { - lassign $parseRel relMonth relDay relSecond - set seconds [add $seconds \ - $relMonth months $relDay days $relSecond seconds \ - -timezone $timezone -locale $locale] - } - - # Do relative weekday - - if { [llength $parseWeekday] > 0 } { - lassign $parseWeekday dayOrdinal dayOfWeek - set date2 [GetDateFields $seconds $TZData($timezone) 2361222] - dict set date2 era CE - set jdwkday [WeekdayOnOrBefore $dayOfWeek [expr { - [dict get $date2 julianDay] + 6 - }]] - incr jdwkday [expr { 7 * $dayOrdinal }] - if { $dayOrdinal > 0 } { - incr jdwkday -7 - } - dict set date2 secondOfDay \ - [expr { [dict get $date2 localSeconds] % 86400 }] - dict set date2 julianDay $jdwkday - dict set date2 localSeconds [expr { - -210866803200 - + ( 86400 * wide([dict get $date2 julianDay]) ) - + [dict get $date secondOfDay] - }] - dict set date2 tzName $timezone - set date2 [ConvertLocalToUTC $date2[set date2 {}] $TZData($timezone) \ - 2361222] - set seconds [dict get $date2 seconds] - - } - - # Do relative month - - if { [llength $parseOrdinalMonth] > 0 } { - lassign $parseOrdinalMonth monthOrdinal monthNumber - if { $monthOrdinal > 0 } { - set monthDiff [expr { $monthNumber - [dict get $date month] }] - if { $monthDiff <= 0 } { - incr monthDiff 12 - } - incr monthOrdinal -1 - } else { - set monthDiff [expr { [dict get $date month] - $monthNumber }] - if { $monthDiff >= 0 } { - incr monthDiff -12 - } - incr monthOrdinal - } - set seconds [add $seconds $monthOrdinal years $monthDiff months \ - -timezone $timezone -locale $locale] - } - - return $seconds -} - - -#---------------------------------------------------------------------- -# # ParseClockScanFormat -- # # Parses a format string given to [clock scan -format] @@ -2723,10 +2533,10 @@ proc ::tcl::clock::InterpretTwoDigitYear { date baseTime variable CurrentYearCentury variable YearOfCenturySwitch set yr [dict get $date $twoDigitField] - incr yr $CurrentYearCentury - if { $yr <= $YearOfCenturySwitch } { + if { $yr >= $YearOfCenturySwitch } { incr yr -100 } + incr yr $CurrentYearCentury dict set date $fourDigitField $yr return $date } @@ -3120,7 +2930,7 @@ proc ::tcl::clock::SetupTimeZone { timezone } { LoadZoneinfoFile [string range $timezone 1 end] }] } then { - dict set TimeZoneBad $timezone 1 + dict set TimeZoneBad $timezone 1 return -code error \ -errorcode [list CLOCK badTimeZone $timezone] \ "time zone \"$timezone\" not found" diff --git a/library/init.tcl b/library/init.tcl index 5e452b0..06a9459 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -178,7 +178,7 @@ if {[interp issafe]} { # Auto-loading stubs for 'clock.tcl' - foreach cmd {add format SetupTimeZone} { + foreach cmd {add format SetupTimeZone GetSystemTimeZone __org_scan} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] diff --git a/tests/clock.test b/tests/clock.test index 6a0fecd..ecc6f5f 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -35662,7 +35662,7 @@ test clock-34.8 {clock scan tests} { } {Oct 23,1992 15:00 GMT} test clock-34.9 {clock scan tests} { list [catch {clock scan "Jan 12" -bad arg} msg] $msg -} {1 {bad option "-bad", must be -base, -format, -gmt, -locale or -timezone}} +} {1 {bad option "-bad": must be -format, -gmt, -locale, -timezone, or -base}} # The following two two tests test the two year date policy test clock-34.10 {clock scan tests} { set time [clock scan "1/1/71" -gmt true] @@ -35672,7 +35672,15 @@ test clock-34.11 {clock scan tests} { set time [clock scan "1/1/37" -gmt true] clock format $time -format {%b %d,%Y %H:%M GMT} -gmt true } {Jan 01,2037 00:00 GMT} - +test clock-34.11.1 {clock scan tests: same century switch} { + set times [clock scan "1/1/37" -gmt true] +} [clock scan "1/1/37" -format "%m/%d/%y" -gmt true] +test clock-34.11.2 {clock scan tests: same century switch} { + set times [clock scan "1/1/38" -gmt true] +} [clock scan "1/1/38" -format "%m/%d/%y" -gmt true] +test clock-34.11.3 {clock scan tests: same century switch} { + set times [clock scan "1/1/39" -gmt true] +} [clock scan "1/1/39" -format "%m/%d/%y" -gmt true] test clock-34.12 {clock scan, relative times} { set time [clock scan "Oct 23, 1992 -1 day"] clock format $time -format {%b %d, %Y} -- cgit v0.12 From 32b5c49ef3414668839b0fab063c85c2583a15e6 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:04:49 +0000 Subject: [temp-commit]: ClockFreeScan back-ported (cherry picked), all tests case passed + several new test-cases for bug fixing implemented here; environment epoch ported, several fixes for the time zone / tzdata caching ported; mem-leak fix + memory leak test cases passed --- generic/tclClock.c | 342 +++++++++++++++++++++++++++------------------- generic/tclDate.h | 13 +- generic/tclEnv.c | 8 ++ library/clock.tcl | 12 +- tests-perf/clock.perf.tcl | 78 +++++++---- tests/clock.test | 21 +++ 6 files changed, 296 insertions(+), 178 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 7256320..e39e032 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -115,14 +115,24 @@ typedef struct ClockClientData { size_t refCount; /* Number of live references. */ Tcl_Obj **literals; /* Pool of object literals. */ /* Cache for current clock parameters, imparted via "configure" */ - unsigned int LastTZEpoch; - Tcl_Obj *LastSystemTimeZone; + unsigned long LastTZEpoch; + Tcl_Obj *SystemTimeZone; Tcl_Obj *SystemSetupTZData; Tcl_Obj *GMTSetupTimeZone; Tcl_Obj *GMTSetupTZData; + Tcl_Obj *AnySetupTimeZone; + Tcl_Obj *AnySetupTZData; + Tcl_Obj *LastUnnormSetupTimeZone; Tcl_Obj *LastSetupTimeZone; Tcl_Obj *LastSetupTZData; - Tcl_Obj *LastUsedSetupTimeZone; + /* + /* [SB] TODO: back-port (from tclSE) the same date caching ... + * Cache for last date (fast convert if date parsed was the same) * / + struct { + DateInfo yy; + TclDateFields date; + } lastDate; + */ } ClockClientData; /* @@ -233,11 +243,29 @@ static int ClockFreeScan( Tcl_Obj *strObj, Tcl_WideInt baseVal, Tcl_Obj *timezoneObj, Tcl_Obj *locale); static struct tm * ThreadSafeLocalTime(const time_t *); -static unsigned int TzsetGetEpoch(void); +static unsigned long TzsetGetEpoch(void); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); /* + * Primitives to safe set, reset and free references. + */ + +#define Tcl_UnsetObjRef(obj) \ + if (obj != NULL) { Tcl_DecrRefCount(obj); obj = NULL; } +#define Tcl_InitObjRef(obj, val) \ + obj = val; if (obj) { Tcl_IncrRefCount(obj); } +#define Tcl_SetObjRef(obj, val) \ +if (1) { \ + Tcl_Obj *nval = val; \ + if (obj != nval) { \ + Tcl_Obj *prev = obj; \ + Tcl_InitObjRef(obj, nval); \ + if (prev != NULL) { Tcl_DecrRefCount(prev); }; \ + } \ +} + +/* * Structure containing description of "native" clock commands to create. */ @@ -319,13 +347,15 @@ TclClockInit( Tcl_IncrRefCount(data->literals[i]); } data->LastTZEpoch = 0; - data->LastSystemTimeZone = NULL; + data->SystemTimeZone = NULL; data->SystemSetupTZData = NULL; data->GMTSetupTimeZone = NULL; data->GMTSetupTZData = NULL; + data->AnySetupTimeZone = NULL; + data->AnySetupTZData = NULL; + data->LastUnnormSetupTimeZone = NULL; data->LastSetupTimeZone = NULL; data->LastSetupTZData = NULL; - data->LastUsedSetupTimeZone = NULL; /* * Install the commands. @@ -356,6 +386,22 @@ TclClockInit( */ static void +ClockConfigureClear( + ClockClientData *data) +{ + data->LastTZEpoch = 0; + Tcl_UnsetObjRef(data->SystemTimeZone); + Tcl_UnsetObjRef(data->SystemSetupTZData); + Tcl_UnsetObjRef(data->GMTSetupTimeZone); + Tcl_UnsetObjRef(data->GMTSetupTZData); + Tcl_UnsetObjRef(data->AnySetupTimeZone); + Tcl_UnsetObjRef(data->AnySetupTZData); + Tcl_UnsetObjRef(data->LastUnnormSetupTimeZone); + Tcl_UnsetObjRef(data->LastSetupTimeZone); + Tcl_UnsetObjRef(data->LastSetupTZData); +} + +static void ClockDeleteCmdProc( ClientData clientData) /* Opaque pointer to the client data */ { @@ -367,15 +413,7 @@ ClockDeleteCmdProc( Tcl_DecrRefCount(data->literals[i]); } - if (data->LastSystemTimeZone) { - Tcl_DecrRefCount(data->LastSystemTimeZone); - } - if (data->GMTSetupTimeZone) { - Tcl_DecrRefCount(data->GMTSetupTimeZone); - } - if (data->LastSetupTimeZone) { - Tcl_DecrRefCount(data->LastSetupTimeZone); - } + ClockConfigureClear(data); ckfree(data->literals); ckfree(data); @@ -391,34 +429,40 @@ NormTimezoneObj( Tcl_Obj * timezoneObj) { const char * tz; - if ( timezoneObj == dataPtr->literals[LIT_GMT] - || timezoneObj == dataPtr->LastSystemTimeZone - || timezoneObj == dataPtr->LastSetupTimeZone + if ( timezoneObj == dataPtr->LastUnnormSetupTimeZone + && dataPtr->LastSetupTimeZone != NULL + ) { + return dataPtr->LastSetupTimeZone; + } + if ( timezoneObj == dataPtr->LastSetupTimeZone + || timezoneObj == dataPtr->literals[LIT_GMT] + || timezoneObj == dataPtr->SystemTimeZone + || timezoneObj == dataPtr->AnySetupTimeZone ) { return timezoneObj; } tz = TclGetString(timezoneObj); - if ( - strcmp(tz, Literals[LIT_GMT]) == 0 + if (dataPtr->AnySetupTimeZone != NULL && + (timezoneObj == dataPtr->AnySetupTimeZone + || strcmp(tz, TclGetString(dataPtr->AnySetupTimeZone)) == 0 + ) ) { - timezoneObj = dataPtr->literals[LIT_GMT]; + timezoneObj = dataPtr->AnySetupTimeZone; } else - if (dataPtr->LastSystemTimeZone != NULL && - (timezoneObj == dataPtr->LastSystemTimeZone - || strcmp(tz, TclGetString(dataPtr->LastSystemTimeZone)) == 0 + if (dataPtr->SystemTimeZone != NULL && + (timezoneObj == dataPtr->SystemTimeZone + || strcmp(tz, TclGetString(dataPtr->SystemTimeZone)) == 0 ) ) { - timezoneObj = dataPtr->LastSystemTimeZone; + timezoneObj = dataPtr->SystemTimeZone; } else - if (dataPtr->LastSetupTimeZone != NULL && - (timezoneObj == dataPtr->LastSetupTimeZone - || strcmp(tz, TclGetString(dataPtr->LastSetupTimeZone)) == 0 - ) + if ( + strcmp(tz, Literals[LIT_GMT]) == 0 ) { - timezoneObj = dataPtr->LastSetupTimeZone; + timezoneObj = dataPtr->literals[LIT_GMT]; } return timezoneObj; } @@ -454,74 +498,64 @@ ClockConfigureObjCmd( Tcl_GetString(objv[i]), NULL); return TCL_ERROR; } - if (optionIndex == CLOCK_SYSTEM_TZ || optionIndex == CLOCK_CLEAR_CACHE) { - if (dataPtr->LastSystemTimeZone) { - Tcl_DecrRefCount(dataPtr->LastSystemTimeZone); - dataPtr->LastSystemTimeZone = NULL; - dataPtr->SystemSetupTZData = NULL; - } - if (optionIndex != CLOCK_CLEAR_CACHE) { - /* validate current tz-epoch */ - unsigned int lastTZEpoch = TzsetGetEpoch(); - if (i+1 < objc) { - Tcl_IncrRefCount( - dataPtr->LastSystemTimeZone = objv[i+1]); - dataPtr->LastTZEpoch = lastTZEpoch; - } else if (dataPtr->LastSystemTimeZone - && dataPtr->LastTZEpoch == lastTZEpoch) { - Tcl_SetObjResult(interp, dataPtr->LastSystemTimeZone); + switch (optionIndex) { + case CLOCK_SYSTEM_TZ: + if (1) { + /* validate current tz-epoch */ + unsigned long lastTZEpoch = TzsetGetEpoch(); + if (i+1 < objc) { + if (dataPtr->SystemTimeZone != objv[i+1]) { + Tcl_SetObjRef(dataPtr->SystemTimeZone, objv[i+1]); + Tcl_UnsetObjRef(dataPtr->SystemSetupTZData); } + dataPtr->LastTZEpoch = lastTZEpoch; + } + if (dataPtr->SystemTimeZone != NULL + && dataPtr->LastTZEpoch == lastTZEpoch) { + Tcl_SetObjResult(interp, dataPtr->SystemTimeZone); } } - if (optionIndex == CLOCK_SETUP_TZ || optionIndex == CLOCK_CLEAR_CACHE) { - Tcl_Obj *timezoneObj = NULL; - /* differentiate GMT and system zones, because used often */ + break; + case CLOCK_SETUP_TZ: if (i+1 < objc) { - timezoneObj = NormTimezoneObj(dataPtr, objv[i+1]); - if (optionIndex == CLOCK_SETUP_TZ) { - dataPtr->LastUsedSetupTimeZone = timezoneObj; - if (timezoneObj == litPtr[LIT_GMT]) { - optionIndex = CLOCK_SETUP_GMT; - } else if (timezoneObj == dataPtr->LastSystemTimeZone) { - optionIndex = CLOCK_SETUP_NOP; - } + /* differentiate GMT and system zones, because used often */ + Tcl_Obj *timezoneObj = NormTimezoneObj(dataPtr, objv[i+1]); + Tcl_SetObjRef(dataPtr->LastUnnormSetupTimeZone, objv[i+1]); + if (dataPtr->LastSetupTimeZone != timezoneObj) { + Tcl_SetObjRef(dataPtr->LastSetupTimeZone, timezoneObj); + Tcl_UnsetObjRef(dataPtr->LastSetupTZData); } - } - - if (optionIndex == CLOCK_SETUP_GMT || optionIndex == CLOCK_CLEAR_CACHE) { - if (dataPtr->GMTSetupTimeZone) { - Tcl_DecrRefCount(dataPtr->GMTSetupTimeZone); - dataPtr->GMTSetupTimeZone = NULL; - dataPtr->GMTSetupTZData = NULL; + if (timezoneObj == litPtr[LIT_GMT]) { + optionIndex = CLOCK_SETUP_GMT; + } else if (timezoneObj == dataPtr->SystemTimeZone) { + optionIndex = CLOCK_SETUP_NOP; } - if (optionIndex != CLOCK_CLEAR_CACHE) { + switch (optionIndex) { + case CLOCK_SETUP_GMT: if (i+1 < objc) { - Tcl_IncrRefCount( - dataPtr->GMTSetupTimeZone = timezoneObj); - } else if (dataPtr->GMTSetupTimeZone) { - Tcl_SetObjResult(interp, dataPtr->GMTSetupTimeZone); + if (dataPtr->GMTSetupTimeZone != timezoneObj) { + Tcl_SetObjRef(dataPtr->GMTSetupTimeZone, timezoneObj); + Tcl_UnsetObjRef(dataPtr->GMTSetupTZData); + } } - } - } - if (optionIndex == CLOCK_SETUP_TZ || optionIndex == CLOCK_CLEAR_CACHE) { - if (dataPtr->LastSetupTimeZone) { - Tcl_DecrRefCount(dataPtr->LastSetupTimeZone); - dataPtr->LastSetupTimeZone = NULL; - dataPtr->LastSetupTZData = NULL; - } - if (optionIndex != CLOCK_CLEAR_CACHE) { + break; + case CLOCK_SETUP_TZ: if (i+1 < objc) { - Tcl_IncrRefCount( - dataPtr->LastSetupTimeZone = timezoneObj); - } else if (dataPtr->LastUsedSetupTimeZone) { - Tcl_SetObjResult(interp, dataPtr->LastUsedSetupTimeZone); - } + if (dataPtr->AnySetupTimeZone != timezoneObj) { + Tcl_SetObjRef(dataPtr->AnySetupTimeZone, timezoneObj); + Tcl_UnsetObjRef(dataPtr->AnySetupTZData); + } + } + break; } } - } - if (optionIndex == CLOCK_CLEAR_CACHE) { - dataPtr->LastTZEpoch = 0; - dataPtr->LastUsedSetupTimeZone = NULL; + if (dataPtr->LastSetupTimeZone != NULL) { + Tcl_SetObjResult(interp, dataPtr->LastSetupTimeZone); + } + break; + case CLOCK_CLEAR_CACHE: + ClockConfigureClear(dataPtr); + break; } } @@ -541,11 +575,19 @@ ClockGetTZData( Tcl_Obj **literals = dataPtr->literals; Tcl_Obj *ret, **out = NULL; + /* if cached (if already setup this one) */ + if ( dataPtr->LastSetupTZData != NULL + && ( timezoneObj == dataPtr->LastSetupTimeZone + || timezoneObj == dataPtr->LastUnnormSetupTimeZone + ) + ) { + return dataPtr->LastSetupTZData; + } + /* differentiate GMT and system zones, because used often */ - /* simple caching, because almost used the tz-data of last timezone, (unnecessary to - * touch the refCount of it, because it is always referenced in TZData array) + /* simple caching, because almost used the tz-data of last timezone */ - if (timezoneObj == dataPtr->LastSystemTimeZone) { + if (timezoneObj == dataPtr->SystemTimeZone) { if (dataPtr->SystemSetupTZData != NULL) return dataPtr->SystemSetupTZData; out = &dataPtr->SystemSetupTZData; @@ -557,19 +599,25 @@ ClockGetTZData( out = &dataPtr->GMTSetupTZData; } else - if (timezoneObj == dataPtr->LastSetupTimeZone) { - if (dataPtr->LastSetupTZData != NULL) { - return dataPtr->LastSetupTZData; + if (timezoneObj == dataPtr->AnySetupTimeZone) { + if (dataPtr->AnySetupTZData != NULL) { + return dataPtr->AnySetupTZData; } - out = &dataPtr->LastSetupTZData; + out = &dataPtr->AnySetupTZData; } ret = Tcl_ObjGetVar2(interp, literals[LIT_TZDATA], timezoneObj, TCL_LEAVE_ERR_MSG); - /* cache using corresponding slot */ - if (ret != NULL && out != NULL) - *out = ret; + /* cache using corresponding slot and as last used */ + if (out != NULL) { + Tcl_SetObjRef(*out, ret); + } + Tcl_SetObjRef(dataPtr->LastSetupTZData, ret); + if (dataPtr->LastSetupTimeZone != timezoneObj) { + Tcl_SetObjRef(dataPtr->LastSetupTimeZone, timezoneObj); + Tcl_UnsetObjRef(dataPtr->LastUnnormSetupTimeZone); + } return ret; } /* @@ -584,9 +632,9 @@ ClockGetSystemTimeZone( Tcl_Obj **literals; /* if known (cached and same epoch) - return now */ - if (dataPtr->LastSystemTimeZone != NULL + if (dataPtr->SystemTimeZone != NULL && dataPtr->LastTZEpoch == TzsetGetEpoch()) { - return dataPtr->LastSystemTimeZone; + return dataPtr->SystemTimeZone; } literals = dataPtr->literals; @@ -610,15 +658,19 @@ ClockSetupTimeZone( Tcl_Obj *callargs[2]; /* if cached (if already setup this one) */ - if (timezoneObj == dataPtr->LastUsedSetupTimeZone) { - return timezoneObj; + if ( dataPtr->LastSetupTimeZone != NULL + && ( timezoneObj == dataPtr->LastSetupTimeZone + || timezoneObj == dataPtr->LastUnnormSetupTimeZone + ) + ) { + return dataPtr->LastSetupTimeZone; } /* differentiate GMT and system zones, because used often and already set */ timezoneObj = NormTimezoneObj(dataPtr, timezoneObj); if ( timezoneObj == dataPtr->GMTSetupTimeZone - || timezoneObj == dataPtr->LastSystemTimeZone - || timezoneObj == dataPtr->LastSetupTimeZone + || timezoneObj == dataPtr->SystemTimeZone + || timezoneObj == dataPtr->AnySetupTimeZone ) { return timezoneObj; } @@ -627,7 +679,7 @@ ClockSetupTimeZone( callargs[1] = timezoneObj; if (Tcl_EvalObjv(interp, 2, callargs, 0) == TCL_OK) { - return NormTimezoneObj(dataPtr, timezoneObj); + return dataPtr->LastSetupTimeZone; } return NULL; } @@ -743,6 +795,7 @@ ClockConvertlocaltoutcObjCmd( int created = 0; int status; + fields.tzName = NULL; /* * Check params and convert time. */ @@ -936,22 +989,6 @@ ClockGetDateFields( return TCL_OK; } - -inline -SetDateFieldsTimeZone( - TclDateFields *fields, - Tcl_Obj *timezoneObj) -{ - if (fields->tzName != timezoneObj) { - if (timezoneObj) { - Tcl_IncrRefCount(timezoneObj); - } - if (fields->tzName != NULL) { - Tcl_DecrRefCount(fields->tzName); - } - fields->tzName = timezoneObj; - } -} /* *---------------------------------------------------------------------- @@ -1030,6 +1067,8 @@ ClockGetjuliandayfromerayearmonthdayObjCmd( int status; int era = 0; + fields.tzName = NULL; + /* * Check params. */ @@ -1114,6 +1153,8 @@ ClockGetjuliandayfromerayearweekdayObjCmd( int status; int era = 0; + fields.tzName = NULL; + /* * Check params. */ @@ -1457,7 +1498,7 @@ ConvertUTCToLocalUsingTable( * Convert the time. */ - SetDateFieldsTimeZone(fields, cellv[3]); + Tcl_SetObjRef(fields->tzName, cellv[3]); fields->localSeconds = fields->seconds + fields->tzOffset; return TCL_OK; } @@ -1550,7 +1591,7 @@ ConvertUTCToLocalUsingC( if (diff > 0) { sprintf(buffer+5, "%02d", diff); } - SetDateFieldsTimeZone(fields, Tcl_NewStringObj(buffer, -1)); + Tcl_SetObjRef(fields->tzName, Tcl_NewStringObj(buffer, -1)); return TCL_OK; } @@ -1647,6 +1688,8 @@ GetYearWeekDay( TclDateFields temp; int dayOfFiscalYear; + temp.tzName = NULL; + /* * Find the given date, minus three days, plus one year. That date's * iso8601 year is an upper bound on the ISO8601 year of the given date. @@ -1863,6 +1906,8 @@ GetJulianDayFromEraYearWeekDay( * given year */ TclDateFields firstWeek; + firstWeek.tzName = NULL; + /* * Find January 4 in the ISO8601 year, which will always be in week 1. */ @@ -2557,13 +2602,16 @@ ClockScanObjCmd( if (1) { /* TODO: Tcled Scan proc - */ + int ret; Tcl_Obj *callargs[10]; memcpy(callargs, objv, objc * sizeof(*objv)); callargs[0] = Tcl_NewStringObj("::tcl::clock::__org_scan", -1); - return Tcl_EvalObjv(interp, objc, callargs, 0); + Tcl_IncrRefCount(callargs[0]); + ret = Tcl_EvalObjv(interp, objc, callargs, 0); + Tcl_DecrRefCount(callargs[0]); + return ret; } - // Tcl_SetObjResult(interp, Tcl_NewWideIntObj(10000000)); - + return TCL_OK; } @@ -2589,7 +2637,6 @@ ClockFreeScan( int secondOfDay; /* Seconds of day (time only calculation) */ Tcl_WideInt seconds; int ret = TCL_ERROR; - // Tcl_Obj *cleanUpList = Tcl_NewObj(); date.tzName = NULL; @@ -2600,7 +2647,6 @@ ClockFreeScan( if (timezoneObj == NULL) { goto done; } - // Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); } /* Get the data for time changes in the given zone */ @@ -2673,12 +2719,16 @@ ClockFreeScan( */ if (yy.dateHaveZone) { + Tcl_Obj *tzObjStor = NULL; int minEast = -yy.dateTimezone; int dstFlag = 1 - yy.dateDSTmode; - timezoneObj = ClockFormatNumericTimeZone( + tzObjStor = ClockFormatNumericTimeZone( 60 * minEast + 3600 * dstFlag); - // Tcl_ListObjAppendElement(NULL, cleanUpList, timezoneObj); - timezoneObj = ClockSetupTimeZone(clientData, interp, timezoneObj); + + timezoneObj = ClockSetupTimeZone(clientData, interp, tzObjStor); + if (tzObjStor != timezoneObj) { + Tcl_DecrRefCount(tzObjStor); + } if (timezoneObj == NULL) { goto done; } @@ -2695,7 +2745,7 @@ ClockFreeScan( * Assemble date, time, zone into seconds-from-epoch */ - SetDateFieldsTimeZone(&date, timezoneObj); + Tcl_SetObjRef(date.tzName, timezoneObj); if (yy.dateHaveTime == -1) { secondOfDay = 0; @@ -2853,10 +2903,7 @@ repeat_rel: done: - if (date.tzName != NULL) { - Tcl_DecrRefCount(date.tzName); - } - // Tcl_DecrRefCount(cleanUpList); + Tcl_UnsetObjRef(date.tzName); if (ret != TCL_OK) { return ret; @@ -2919,23 +2966,30 @@ ClockSecondsObjCmd( *---------------------------------------------------------------------- */ -static unsigned int +static unsigned long TzsetGetEpoch(void) { - static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by - * clockMutex. */ - static long tzNextRefresh = 0; /* Latence before next refresh */ - static unsigned int tzWasEpoch = 1; /* Epoch, signals that TZ changed */ + static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by + * clockMutex. */ + static long tzLastRefresh = 0; /* Used for latency before next refresh */ + static unsigned long tzWasEpoch = 0; /* Epoch, signals that TZ changed */ + static unsigned long tzEnvEpoch = 0; /* Last env epoch, for faster signaling, + that TZ changed via TCL */ - const char *tzIsNow; /* Current value of TZ */ + const char *tzIsNow; /* Current value of TZ */ - /* fast check whether environment was changed (once per second) */ + /* + * Prevent performance regression on some platforms by resolving of system time zone: + * small latency for check whether environment was changed (once per second) + * no latency if environment was chaned with tcl-env (compare both epoch values) + */ Tcl_Time now; Tcl_GetTime(&now); - if (now.sec < tzNextRefresh) { + if (now.sec == tzLastRefresh && tzEnvEpoch == TclEnvEpoch) { return tzWasEpoch; } - tzNextRefresh = now.sec + 1; + tzEnvEpoch = TclEnvEpoch; + tzLastRefresh = now.sec; /* check in lock */ Tcl_MutexLock(&clockMutex); diff --git a/generic/tclDate.h b/generic/tclDate.h index 91e677f..6ba9620 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -19,9 +19,6 @@ typedef struct DateInfo { - Tcl_Obj* messages; /* Error messages */ - const char* separatrix; /* String separating messages */ - time_t dateYear; time_t dateMonth; time_t dateDay; @@ -54,6 +51,9 @@ typedef struct DateInfo { time_t *dateRelPointer; int dateDigitCount; + + Tcl_Obj* messages; /* Error messages */ + const char* separatrix; /* String separating messages */ } DateInfo; @@ -74,4 +74,11 @@ MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); +/* + * Other externals. + */ + +MODULE_SCOPE unsigned long TclEnvEpoch; /* Epoch of the tcl environment + * (if changed with tcl-env). */ + #endif /* _TCLCLOCK_H */ diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 66ddb57..fd0a8ce 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -17,6 +17,10 @@ TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */ + +MODULE_SCOPE unsigned long TclEnvEpoch = 0; /* Epoch of the tcl environment + * (if changed with tcl-env). */ + static struct { int cacheSize; /* Number of env strings in cache. */ char **cache; /* Array containing all of the environment @@ -371,6 +375,7 @@ Tcl_PutEnv( value[0] = '\0'; TclSetEnv(name, value+1); } + TclEnvEpoch++; Tcl_DStringFree(&nameString); return 0; @@ -579,6 +584,7 @@ EnvTraceProc( if (flags & TCL_TRACE_ARRAY) { TclSetupEnv(interp); + TclEnvEpoch++; return NULL; } @@ -599,6 +605,7 @@ EnvTraceProc( value = Tcl_GetVar2(interp, "env", name2, TCL_GLOBAL_ONLY); TclSetEnv(name2, value); + TclEnvEpoch++; } /* @@ -622,6 +629,7 @@ EnvTraceProc( if (flags & TCL_TRACE_UNSETS) { TclUnsetEnv(name2); + TclEnvEpoch++; } return NULL; } diff --git a/library/clock.tcl b/library/clock.tcl index b4a7639..ace4176 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -671,7 +671,9 @@ proc ::tcl::clock::format { args } { # Get the data for time changes in the given zone if {$timezone eq ""} { - set timezone [GetSystemTimeZone] + if {[set timezone [configure -system-tz]] eq ""} { + set timezone [GetSystemTimeZone] + } } if {![info exists TZData($timezone)]} { if {[catch {SetupTimeZone $timezone} retval opts]} { @@ -1202,7 +1204,9 @@ proc ::tcl::clock::__org_scan { args } { set format {} set gmt 0 set locale c - set timezone [GetSystemTimeZone] + if {[set timezone [configure -system-tz]] eq ""} { + set timezone [GetSystemTimeZone] + } # Pick up command line options. @@ -4083,7 +4087,9 @@ proc ::tcl::clock::add { clockval args } { set offsets {} set gmt 0 set locale c - set timezone [GetSystemTimeZone] + if {[set timezone [configure -system-tz]] eq ""} { + set timezone [GetSystemTimeZone] + } foreach { a b } $args { if { [string is integer -strict $a] } { diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 52bc91f..7ef70ce 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -15,60 +15,82 @@ # of this file. # +set ::env(TCL_TZ) :CET + +proc {**STOP**} {args} { + return -code error -level 2 "**STOP** in [info level [expr {[info level]-1}]] [join $args { }]" +} + +proc _test_get_commands {lst} { + regsub -all {(?:^|\n)[ \t]*(\#[^\n]*)(?=\n\s*[\{\#])} $lst "\n{\\1}" +} + proc test-scan {{rep 100000}} { - foreach {comment c} { - "# FreeScan : relative date" + foreach c [_test_get_commands { + # FreeScan : relative date {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} - "# FreeScan : relative date with relative weekday" + # FreeScan : relative date with relative weekday {clock scan "5 years 18 months 385 days Fri" -base 0 -gmt 1} - "# FreeScan : relative date with ordinal month" + # FreeScan : relative date with ordinal month {clock scan "5 years 18 months 385 days next 1 January" -base 0 -gmt 1} - "# FreeScan : relative date with ordinal month and relative weekday" + # FreeScan : relative date with ordinal month and relative weekday {clock scan "5 years 18 months 385 days next January Fri" -base 0 -gmt 1} - "# FreeScan : ordinal month" + # FreeScan : ordinal month {clock scan "next January" -base 0 -gmt 1} - "# FreeScan : relative week" + # FreeScan : relative week {clock scan "next Fri" -base 0 -gmt 1} - "# FreeScan : relative weekday and week offset " + # FreeScan : relative weekday and week offset {clock scan "next January + 2 week" -base 0 -gmt 1} - "# FreeScan : time only with base" + # FreeScan : time only with base {clock scan "19:18:30" -base 148863600 -gmt 1} - "# FreeScan : time only without base" + # FreeScan : time only without base, gmt {clock scan "19:18:30" -gmt 1} - "# FreeScan : date, system time zone" + # FreeScan : time only without base, system + {clock scan "19:18:30"} + # FreeScan : date, system time zone {clock scan "05/08/2016 20:18:30"} - "# FreeScan : date, supplied time zone" + # FreeScan : date, supplied time zone {clock scan "05/08/2016 20:18:30" -timezone :CET} - "# FreeScan : date, supplied gmt (equivalent -timezone :GMT)" + # FreeScan : date, supplied gmt (equivalent -timezone :GMT) {clock scan "05/08/2016 20:18:30" -gmt 1} - "# FreeScan : time only, numeric zone in string, base time gmt (exchange zones between gmt / -0500)" + # FreeScan : date, supplied time zone gmt + {clock scan "05/08/2016 20:18:30" -timezone :GMT} + # FreeScan : time only, numeric zone in string, base time gmt (exchange zones between gmt / -0500) {clock scan "20:18:30 -0500" -base 148863600 -gmt 1} - "# FreeScan : time only, zone in string (exchange zones between system / gmt)" + # FreeScan : time only, zone in string (exchange zones between system / gmt) {clock scan "19:18:30 GMT" -base 148863600} - } { - if {[string first "**STOP**" $comment] != -1} { return -code error "**STOP**" } - puts "\n% $comment\n% $c" - puts [clock format [{*}$c] -locale en] + # FreeScan : fast switch of zones in cycle - GMT, MST, CET (system) and EST + {clock scan "19:18:30 MST" -base 148863600 -gmt 1 + clock scan "19:18:30 EST" -base 148863600 + } + }] { + puts "% [regsub -all {\n[ \t]*} $c {; }]" + if {[regexp {\s*\#} $c]} continue + puts [clock format [if 1 $c] -locale en] puts [time $c $rep] + puts "" } } proc test-other {{rep 100000}} { - foreach {comment c} { - "# Bad zone" - {catch {clock scan "1 day" -timezone BAD_ZONE}} - } { - if {[string first "**STOP**" $comment] != -1} { return -code error "**STOP**" } - puts "\n% $comment\n% $c" + foreach c [_test_get_commands { + # Bad zone + {catch {clock scan "1 day" -timezone BAD_ZONE -locale en}} + }] { + puts "% [regsub -all {\n[ \t]*} $c {; }]" + if {[regexp {\s*\#} $c]} continue puts [if 1 $c] puts [time $c $rep] + puts "" } } -set factor 10; # 50 -if 1 {;# +proc test {factor} { + puts "" test-scan [expr 10000 * $factor] test-other [expr 5000 * $factor] puts \n**OK** -};# \ No newline at end of file +} + +test 20; # 50 diff --git a/tests/clock.test b/tests/clock.test index ecc6f5f..477f142 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -35803,6 +35803,27 @@ test clock-34.40 {clock scan, next day of week} { clock format [clock scan "next thursday" -base [clock scan 20000112]] \ -format {%b %d, %Y} } "Jan 20, 2000" +test clock-34.40.1 {clock scan, ordinal month after relative date} { + # This will fail without the bug fix (clock.tcl), as still missing + # month/julian day conversion before ordinal month increment + clock format [ \ + clock scan "5 years 18 months 387 days" -base 0 -gmt 1 + ] -format {%a, %b %d, %Y} -gmt 1 -locale en_US_roman +} "Sat, Jul 23, 1977" +test clock-34.40.2 {clock scan, ordinal month after relative date} { + # This will fail without the bug fix (clock.tcl), as still missing + # month/julian day conversion before ordinal month increment + clock format [ \ + clock scan "5 years 18 months 387 days next Jan" -base 0 -gmt 1 + ] -format {%a, %b %d, %Y} -gmt 1 -locale en_US_roman +} "Mon, Jan 23, 1978" +test clock-34.40.3 {clock scan, day of week after ordinal date} { + # This will fail without the bug fix (clock.tcl), because the relative + # week day should be applied after whole date conversion + clock format [ \ + clock scan "5 years 18 months 387 days next January Fri" -base 0 -gmt 1 + ] -format {%a, %b %d, %Y} -gmt 1 -locale en_US_roman +} "Fri, Jan 27, 1978" # weekday specification and base. test clock-34.41 {2nd monday in november} { -- cgit v0.12 From 1f1f1e4dfcb5859424591754a5ecc2bdf25a087b Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:07:37 +0000 Subject: [temp-commit]: tclClockFmt.c - 1st try using "timerate" instead "time" by performance measurement tests (more precise and fixed time, so no switch of factor expected) --- generic/tclClock.c | 17 +- generic/tclClockFmt.c | 417 ++++++++++++++++++++++++++++++++++++++++++++++ generic/tclDate.c | 12 +- generic/tclDate.h | 44 ++++- generic/tclGetDate.y | 1 + tests-perf/clock.perf.tcl | 40 +++-- unix/Makefile.in | 4 + win/Makefile.in | 1 + win/makefile.vc | 1 + 9 files changed, 512 insertions(+), 25 deletions(-) create mode 100644 generic/tclClockFmt.c diff --git a/generic/tclClock.c b/generic/tclClock.c index e39e032..c869cf4 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -8,6 +8,7 @@ * Copyright 1991-1995 Karl Lehenbauer and Mark Diekhans. * Copyright (c) 1995 Sun Microsystems, Inc. * Copyright (c) 2004 by Kevin B. Kenny. All rights reserved. + * Copyright (c) 2015 by Sergey G. Brester aka sebres. All rights reserved. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -2600,9 +2601,9 @@ ClockScanObjCmd( } */ - if (1) { + if (0) { /* TODO: Tcled Scan proc - */ - int ret; + int ret; Tcl_Obj *callargs[10]; memcpy(callargs, objv, objc * sizeof(*objv)); callargs[0] = Tcl_NewStringObj("::tcl::clock::__org_scan", -1); @@ -2611,6 +2612,18 @@ ClockScanObjCmd( Tcl_DecrRefCount(callargs[0]); return ret; } + + if (1) { + + ClockFmtScnStorage * fss; + + if ((fss = Tcl_GetClockFrmScnFromObj(interp, opts.formatObj)) == NULL) { + return TCL_ERROR; + }; + + Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)fss)); + + } return TCL_OK; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c new file mode 100644 index 0000000..fa89dde --- /dev/null +++ b/generic/tclClockFmt.c @@ -0,0 +1,417 @@ +/* + * tclClockFmt.c -- + * + * Contains the date format (and scan) routines. This code is back-ported + * from the time and date facilities of tclSE engine, by Serg G. Brester. + * + * Copyright (c) 2015 by Sergey G. Brester aka sebres. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#include "tclInt.h" +#include "tclDate.h" + +/* + * Miscellaneous forward declarations and functions used within this file + */ + +static void +ClockFmtObj_DupInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); +static void +ClockFmtObj_FreeInternalRep(Tcl_Obj *objPtr); +static int +ClockFmtObj_SetFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); +static void +ClockFmtObj_UpdateString(Tcl_Obj *objPtr); + + +TCL_DECLARE_MUTEX(ClockFmtMutex); /* Serializes access to common format list. */ + +static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); + +/* + * Clock scan and format facilities. + */ + +#define TOK_CHAIN_BLOCK_SIZE 8 + +/* + *---------------------------------------------------------------------- + */ + +#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + +static struct { + ClockFmtScnStorage *stackPtr; + ClockFmtScnStorage *stackBound; + unsigned int count; +} ClockFmtScnStorage_GC = {NULL, NULL, 0}; + +inline void +ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) +{ + /* add new entry */ + TclSpliceIn(entry, ClockFmtScnStorage_GC.stackPtr); + if (ClockFmtScnStorage_GC.stackBound == NULL) { + ClockFmtScnStorage_GC.stackBound = entry; + } + ClockFmtScnStorage_GC.count++; + + /* if GC ist full */ + if (ClockFmtScnStorage_GC.count > CLOCK_FMT_SCN_STORAGE_GC_SIZE) { + + /* GC stack is LIFO: delete first inserted entry */ + ClockFmtScnStorage *delEnt = ClockFmtScnStorage_GC.stackBound; + ClockFmtScnStorage_GC.stackBound = delEnt->prevPtr; + TclSpliceOut(delEnt, ClockFmtScnStorage_GC.stackPtr); + ClockFmtScnStorage_GC.count--; + delEnt->prevPtr = delEnt->nextPtr = NULL; + /* remove it now */ + ClockFmtScnStorageDelete(delEnt); + } +} +inline void +ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) +{ + TclSpliceOut(entry, ClockFmtScnStorage_GC.stackPtr); + ClockFmtScnStorage_GC.count--; + if (ClockFmtScnStorage_GC.stackBound == entry) { + ClockFmtScnStorage_GC.stackBound = entry->prevPtr; + } + entry->prevPtr = entry->nextPtr = NULL; +} + +#endif + +/* + *---------------------------------------------------------------------- + */ + +static Tcl_HashTable FmtScnHashTable; +static int initFmtScnHashTable = 0; + +inline Tcl_HashEntry * +HashEntry4FmtScn(ClockFmtScnStorage *fss) { + return (Tcl_HashEntry*)(fss + 1); +}; +inline ClockFmtScnStorage * +FmtScn4HashEntry(Tcl_HashEntry *hKeyPtr) { + return (ClockFmtScnStorage*)(((char*)hKeyPtr) - sizeof(ClockFmtScnStorage)); +}; + +/* + * Format storage hash (list of formats shared across all threads). + */ + +static Tcl_HashEntry * +ClockFmtScnStorageAllocProc( + Tcl_HashTable *tablePtr, /* Hash table. */ + void *keyPtr) /* Key to store in the hash table entry. */ +{ + ClockFmtScnStorage *fss; + + const char *string = (const char *) keyPtr; + Tcl_HashEntry *hPtr; + unsigned int size, + allocsize = sizeof(ClockFmtScnStorage) + sizeof(Tcl_HashEntry); + + allocsize += (size = strlen(string) + 1); + if (size > sizeof(hPtr->key)) { + allocsize -= sizeof(hPtr->key); + } + + fss = ckalloc(allocsize); + + /* initialize */ + memset(fss, 0, sizeof(*fss)); + + hPtr = HashEntry4FmtScn(fss); + memcpy(&hPtr->key.string, string, size); + hPtr->clientData = 0; /* currently unused */ + + return hPtr; +} + +static void +ClockFmtScnStorageFreeProc( + Tcl_HashEntry *hPtr) +{ + ClockFmtScnStorage *fss = FmtScn4HashEntry(hPtr); + ClockScanToken *tok; + + tok = fss->firstScnTok; + while (tok != NULL) { + if (tok->nextTok == tok + 1) { + tok++; + /*****************************/ + } else { + tok = tok->nextTok; + } + } + + ckfree(fss); +} + +static void +ClockFmtScnStorageDelete(ClockFmtScnStorage *fss) { + Tcl_HashEntry *hPtr = HashEntry4FmtScn(fss); + /* + * This will delete a hash entry and call "ckfree" for storage self, if + * some additionally handling required, freeEntryProc can be used instead + */ + Tcl_DeleteHashEntry(hPtr); +} + + +/* + * Derivation of tclStringHashKeyType with another allocEntryProc + */ + +static Tcl_HashKeyType ClockFmtScnStorageHashKeyType; + + +/* + *---------------------------------------------------------------------- + */ + +static ClockFmtScnStorage * +FindOrCreateFmtScnStorage( + Tcl_Interp *interp, + const char *strFmt) +{ + ClockFmtScnStorage *fss = NULL; + int new; + Tcl_HashEntry *hPtr; + + Tcl_MutexLock(&ClockFmtMutex); + + /* if not yet initialized */ + if (!initFmtScnHashTable) { + /* initialize type */ + memcpy(&ClockFmtScnStorageHashKeyType, &tclStringHashKeyType, sizeof(tclStringHashKeyType)); + ClockFmtScnStorageHashKeyType.allocEntryProc = ClockFmtScnStorageAllocProc; + ClockFmtScnStorageHashKeyType.freeEntryProc = ClockFmtScnStorageFreeProc; + initFmtScnHashTable = 1; + + /* initialize hash table */ + Tcl_InitCustomHashTable(&FmtScnHashTable, TCL_CUSTOM_TYPE_KEYS, + &ClockFmtScnStorageHashKeyType); + } + + /* get or create entry (and alocate storage) */ + hPtr = Tcl_CreateHashEntry(&FmtScnHashTable, strFmt, &new); + if (hPtr != NULL) { + + fss = FmtScn4HashEntry(hPtr); + + #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* unlink if it is currently in GC */ + if (new == 0 && fss->objRefCount == 0) { + ClockFmtScnStorage_GC_Out(fss); + } + #endif + + /* new reference, so increment in lock right now */ + fss->objRefCount++; + } + + Tcl_MutexUnlock(&ClockFmtMutex); + + if (fss == NULL && interp != NULL) { + Tcl_AppendResult(interp, "retrieve clock format failed \"", + strFmt ? strFmt : "", "\"", NULL); + Tcl_SetErrorCode(interp, "TCL", "EINVAL", NULL); + } + + return fss; +} + + +/* + * Type definition. + */ + +Tcl_ObjType ClockFmtObjType = { + "clock-format", /* name */ + ClockFmtObj_FreeInternalRep, /* freeIntRepProc */ + ClockFmtObj_DupInternalRep, /* dupIntRepProc */ + ClockFmtObj_UpdateString, /* updateStringProc */ + ClockFmtObj_SetFromAny /* setFromAnyProc */ +}; + +#define SetObjClockFmtScn(objPtr, fss) \ + objPtr->internalRep.twoPtrValue.ptr1 = fss +#define ObjClockFmtScn(objPtr) \ + (ClockFmtScnStorage *)objPtr->internalRep.twoPtrValue.ptr1; + +#define SetObjLitStorage(objPtr, lit) \ + objPtr->internalRep.twoPtrValue.ptr2 = lit +#define ObjLitStorage(objPtr) \ + (ClockLitStorage *)objPtr->internalRep.twoPtrValue.ptr2; + +#define ClockFmtObj_SetObjIntRep(objPtr, fss, lit) \ + objPtr->internalRep.twoPtrValue.ptr1 = fss, \ + objPtr->internalRep.twoPtrValue.ptr2 = lit, \ + objPtr->typePtr = &ClockFmtObjType; + +/* + *---------------------------------------------------------------------- + */ +static void +ClockFmtObj_DupInternalRep(srcPtr, copyPtr) + Tcl_Obj *srcPtr; + Tcl_Obj *copyPtr; +{ + ClockFmtScnStorage *fss = ObjClockFmtScn(srcPtr); + // ClockLitStorage *lit = ObjLitStorage(srcPtr); + + if (fss != NULL) { + Tcl_MutexLock(&ClockFmtMutex); + fss->objRefCount++; + Tcl_MutexUnlock(&ClockFmtMutex); + } + + ClockFmtObj_SetObjIntRep(copyPtr, fss, NULL); + + /* if no format representation, dup string representation */ + if (fss == NULL) { + copyPtr->bytes = ckalloc(srcPtr->length + 1); + memcpy(copyPtr->bytes, srcPtr->bytes, srcPtr->length + 1); + copyPtr->length = srcPtr->length; + } +} +/* + *---------------------------------------------------------------------- + */ +static void +ClockFmtObj_FreeInternalRep(objPtr) + Tcl_Obj *objPtr; +{ + ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); + // ClockLitStorage *lit = ObjLitStorage(objPtr); + if (fss != NULL) { + Tcl_MutexLock(&ClockFmtMutex); + /* decrement object reference count of format/scan storage */ + if (--fss->objRefCount <= 0) { + #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* don't remove it right now (may be reusable), just add to GC */ + ClockFmtScnStorageGC_In(fss); + #else + /* remove storage (format representation) */ + ClockFmtScnStorageDelete(fss); + #endif + } + Tcl_MutexUnlock(&ClockFmtMutex); + } + SetObjClockFmtScn(objPtr, NULL); + SetObjLitStorage(objPtr, NULL); + objPtr->typePtr = NULL; +}; +/* + *---------------------------------------------------------------------- + */ +static int +ClockFmtObj_SetFromAny(interp, objPtr) + Tcl_Interp *interp; + Tcl_Obj *objPtr; +{ + ClockFmtScnStorage *fss; + const char *strFmt = TclGetString(objPtr); + + if (!strFmt || (fss = FindOrCreateFmtScnStorage(interp, strFmt)) == NULL) { + return TCL_ERROR; + } + + if (objPtr->typePtr && objPtr->typePtr->freeIntRepProc) + objPtr->typePtr->freeIntRepProc(objPtr); + ClockFmtObj_SetObjIntRep(objPtr, fss, NULL); + return TCL_OK; +}; +/* + *---------------------------------------------------------------------- + */ +static void +ClockFmtObj_UpdateString(objPtr) + Tcl_Obj *objPtr; +{ + char *name = "UNKNOWN"; + int len; + ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); + + if (fss != NULL) { + Tcl_HashEntry *hPtr = HashEntry4FmtScn(fss); + name = hPtr->key.string; + } + len = strlen(name); + objPtr->length = len, + objPtr->bytes = ckalloc((size_t)++len); + if (objPtr->bytes) + memcpy(objPtr->bytes, name, len); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GetClockFrmScnFromObj -- + * + * Returns a clock format/scan representation of (*objPtr), if possible. + * If something goes wrong, NULL is returned, and if interp is non-NULL, + * an error message is written there. + * + * Results: + * Valid representation of type ClockFmtScnStorage. + * + * Side effects: + * Caches the ClockFmtScnStorage reference as the internal rep of (*objPtr) + * and in global hash table, shared across all threads. + * + *---------------------------------------------------------------------- + */ + +ClockFmtScnStorage * +Tcl_GetClockFrmScnFromObj( + Tcl_Interp *interp, + Tcl_Obj *objPtr) +{ + ClockFmtScnStorage *fss; + + if (objPtr->typePtr != &ClockFmtObjType) { + if (ClockFmtObj_SetFromAny(interp, objPtr) != TCL_OK) { + return NULL; + } + } + + fss = ObjClockFmtScn(objPtr); + + if (fss == NULL) { + const char *strFmt = TclGetString(objPtr); + fss = FindOrCreateFmtScnStorage(interp, strFmt); + } + + return fss; +} + + +static void +Tcl_GetClockFrmScnFinalize() +{ +#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* clear GC */ + ClockFmtScnStorage_GC.stackPtr = NULL; + ClockFmtScnStorage_GC.stackBound = NULL; + ClockFmtScnStorage_GC.count = 0; +#endif + if (initFmtScnHashTable) { + Tcl_DeleteHashTable(&FmtScnHashTable); + } + Tcl_MutexFinalize(&ClockFmtMutex); +} +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/generic/tclDate.c b/generic/tclDate.c index a31e0fc..389b245 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -570,12 +570,12 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 176, 176, 177, 180, 183, 186, 189, 192, 195, - 198, 202, 207, 210, 216, 222, 230, 236, 247, 251, - 255, 261, 265, 269, 273, 277, 283, 287, 292, 297, - 302, 307, 311, 316, 320, 325, 332, 336, 342, 351, - 360, 370, 384, 389, 392, 395, 398, 401, 404, 409, - 412, 417, 421, 425, 431, 449, 452 + 0, 177, 177, 178, 181, 184, 187, 190, 193, 196, + 199, 203, 208, 211, 217, 223, 231, 237, 248, 252, + 256, 262, 266, 270, 274, 278, 284, 288, 293, 298, + 303, 308, 312, 317, 321, 326, 333, 337, 343, 352, + 361, 371, 385, 390, 393, 396, 399, 402, 405, 410, + 413, 418, 422, 426, 432, 450, 453 }; #endif diff --git a/generic/tclDate.h b/generic/tclDate.h index 6ba9620..c3c362a 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -66,13 +66,55 @@ typedef enum _MERIDIAN { } MERIDIAN; /* + * Clock scan and format facilities. + */ + +#define CLOCK_FMT_SCN_STORAGE_GC_SIZE 32 + + +typedef struct ClockFormatToken ClockFormatToken; +typedef struct ClockScanToken ClockScanToken; +typedef struct ClockFmtScnStorage ClockFmtScnStorage; + +typedef struct ClockFormatToken { + ClockFormatToken *nextTok; +} ClockFormatToken; + +typedef struct ClockScanToken { + ClockScanToken *nextTok; +} ClockScanToken; + +typedef struct ClockFmtScnStorage { + int objRefCount; /* Reference count shared across threads */ + ClockScanToken *firstScnTok; + ClockFormatToken *firstFmtTok; +#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + ClockFmtScnStorage *nextPtr; + ClockFmtScnStorage *prevPtr; +#endif +/* +Tcl_HashEntry hashEntry /* ClockFmtScnStorage is a derivate of Tcl_HashEntry, + * stored by offset +sizeof(self) */ +} ClockFmtScnStorage; + +typedef struct ClockLitStorage { + int dummy; +} ClockLitStorage; + +/* * Prototypes of module functions. */ MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian); -MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); +MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); + +/* tclClockFmt.c module declarations */ + +MODULE_SCOPE ClockFmtScnStorage * + Tcl_GetClockFrmScnFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr); + /* * Other externals. diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index ac781ad..d500d6b 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -9,6 +9,7 @@ * * Copyright (c) 1992-1995 Karl Lehenbauer and Mark Diekhans. * Copyright (c) 1995-1997 Sun Microsystems, Inc. + * Copyright (c) 2015 Sergey G. Brester aka sebres. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 7ef70ce..59469fd 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -25,8 +25,12 @@ proc _test_get_commands {lst} { regsub -all {(?:^|\n)[ \t]*(\#[^\n]*)(?=\n\s*[\{\#])} $lst "\n{\\1}" } -proc test-scan {{rep 100000}} { - foreach c [_test_get_commands { +proc test-scan {{reptime 1000}} { + foreach _(c) [_test_get_commands { + # Scan : date + {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} + #return + #{**STOP** : Wed Nov 25 01:00:00 CET 2015} # FreeScan : relative date {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} # FreeScan : relative date with relative weekday @@ -64,33 +68,37 @@ proc test-scan {{rep 100000}} { clock scan "19:18:30 EST" -base 148863600 } }] { - puts "% [regsub -all {\n[ \t]*} $c {; }]" - if {[regexp {\s*\#} $c]} continue - puts [clock format [if 1 $c] -locale en] - puts [time $c $rep] + puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" + if {[regexp {\s*\#} $_(c)]} continue + puts [clock format [if 1 $_(c)] -locale en] + puts [timerate $_(c) $reptime] puts "" } } -proc test-other {{rep 100000}} { - foreach c [_test_get_commands { +proc test-other {{reptime 1000}} { + foreach _(c) [_test_get_commands { # Bad zone {catch {clock scan "1 day" -timezone BAD_ZONE -locale en}} + # Scan : test rotate of GC objects (format is dynamic, so tcl-obj removed with last reference) + {set i 0; time { clock scan "[incr i] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} + # Scan : test reusability of GC objects (format is dynamic, so tcl-obj removed with last reference) + {set i 50; time { clock scan "[incr i -1] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} }] { - puts "% [regsub -all {\n[ \t]*} $c {; }]" - if {[regexp {\s*\#} $c]} continue - puts [if 1 $c] - puts [time $c $rep] + puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" + if {[regexp {\s*\#} $_(c)]} continue + puts [if 1 $_(c)] + puts [timerate $_(c) $reptime] puts "" } } -proc test {factor} { +proc test {{reptime 1000}} { puts "" - test-scan [expr 10000 * $factor] - test-other [expr 5000 * $factor] + test-scan $reptime + test-other $reptime puts \n**OK** } -test 20; # 50 +test 250; # 250 ms diff --git a/unix/Makefile.in b/unix/Makefile.in index c4f6136..b220139 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -396,6 +396,7 @@ GENERIC_SRCS = \ $(GENERIC_DIR)/tclBinary.c \ $(GENERIC_DIR)/tclCkalloc.c \ $(GENERIC_DIR)/tclClock.c \ + $(GENERIC_DIR)/tclClockFmt.c \ $(GENERIC_DIR)/tclCmdAH.c \ $(GENERIC_DIR)/tclCmdIL.c \ $(GENERIC_DIR)/tclCmdMZ.c \ @@ -1073,6 +1074,9 @@ tclCkalloc.o: $(GENERIC_DIR)/tclCkalloc.c tclClock.o: $(GENERIC_DIR)/tclClock.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclClock.c +tclClockFmt.o: $(GENERIC_DIR)/tclClockFmt.c + $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclClockFmt.c + tclCmdAH.o: $(GENERIC_DIR)/tclCmdAH.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclCmdAH.c diff --git a/win/Makefile.in b/win/Makefile.in index e967ef3..82e5516 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -228,6 +228,7 @@ GENERIC_OBJS = \ tclBinary.$(OBJEXT) \ tclCkalloc.$(OBJEXT) \ tclClock.$(OBJEXT) \ + tclClockFmt.$(OBJEXT) \ tclCmdAH.$(OBJEXT) \ tclCmdIL.$(OBJEXT) \ tclCmdMZ.$(OBJEXT) \ diff --git a/win/makefile.vc b/win/makefile.vc index 26ee669..d6dbf85 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -270,6 +270,7 @@ COREOBJS = \ $(TMP_DIR)\tclBinary.obj \ $(TMP_DIR)\tclCkalloc.obj \ $(TMP_DIR)\tclClock.obj \ + $(TMP_DIR)\tclClockFmt.obj \ $(TMP_DIR)\tclCmdAH.obj \ $(TMP_DIR)\tclCmdIL.obj \ $(TMP_DIR)\tclCmdMZ.obj \ -- cgit v0.12 From 5ab3eafa66c83eedbe4da87a549cb83dfa8abac7 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:09:02 +0000 Subject: [temp-commit]: tclClockFmt.c - 2nd try (with cherry picking of tclSE incompatible facilities) Prepared for common usage of scan command (free scan / format scan) --- generic/tclClock.c | 328 +++++++++++++++++++--------------------------- generic/tclClockFmt.c | 117 +++++++++++++++-- generic/tclDate.h | 63 ++++++++- tests-perf/clock.perf.tcl | 4 +- 4 files changed, 297 insertions(+), 215 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index c869cf4..888757f 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -136,29 +136,6 @@ typedef struct ClockClientData { */ } ClockClientData; -/* - * Structure containing the fields used in [clock format] and [clock scan] - */ - -typedef struct TclDateFields { - Tcl_WideInt seconds; /* Time expressed in seconds from the Posix - * epoch */ - Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds - * from the Posix epoch */ - int tzOffset; /* Time zone offset in seconds east of - * Greenwich */ - Tcl_Obj *tzName; /* Time zone name */ - int julianDay; /* Julian Day Number in local time zone */ - enum {BCE=1, CE=0} era; /* Era */ - int gregorian; /* Flag == 1 if the date is Gregorian */ - int year; /* Year of the era */ - int dayOfYear; /* Day of the year (1 January == 1) */ - int month; /* Month number */ - int dayOfMonth; /* Day of the month */ - int iso8601Year; /* ISO8601 week-based year */ - int iso8601Week; /* ISO8601 week number */ - int dayOfWeek; /* Day of the week */ -} TclDateFields; static const char *const eras[] = { "CE", "BCE", NULL }; /* @@ -241,8 +218,8 @@ static int ClockScanObjCmd( int objc, Tcl_Obj *const objv[]); static int ClockFreeScan( ClientData clientData, Tcl_Interp *interp, - Tcl_Obj *strObj, Tcl_WideInt baseVal, - Tcl_Obj *timezoneObj, Tcl_Obj *locale); + register TclDateFields *date, + Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); static struct tm * ThreadSafeLocalTime(const time_t *); static unsigned long TzsetGetEpoch(void); static void TzsetIfNecessary(void); @@ -2339,20 +2316,13 @@ ClockMicrosecondsObjCmd( } -typedef struct _ClockFmtScnArgs { - Tcl_Obj *formatObj; /* Format */ - Tcl_Obj *localeObj; /* Locale */ - Tcl_Obj *timezoneObj; /* Timezone */ - Tcl_Obj *baseObj; /* Base (scan only) */ -} _ClockFmtScnArgs; - static int _ClockParseFmtScnArgs( ClientData clientData, /* Client data containing literal pool */ Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const objv[], /* Parameter vector */ - _ClockFmtScnArgs *resOpts, /* Result vector: format, locale, timezone... */ + ClockFmtScnCmdArgs *resOpts, /* Result vector: format, locale, timezone... */ int forScan /* Flag to differentiate between format and scan */ ) { ClockClientData *dataPtr = clientData; @@ -2455,7 +2425,7 @@ ClockParseformatargsObjCmd( { ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; - _ClockFmtScnArgs resOpts; /* Format, locale and timezone */ + ClockFmtScnCmdArgs resOpts; /* Format, locale and timezone */ Tcl_WideInt clockVal; /* Clock value - just used to parse. */ int ret; @@ -2520,12 +2490,10 @@ ClockScanObjCmd( ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; - Tcl_Time retClock; - char *string, *format = NULL; - int gmt, ret = 0; - char *locale; - _ClockFmtScnArgs opts; /* Format, locale, timezone and base */ - Tcl_WideInt baseVal; /* Base value */ + int ret; + ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ + Tcl_WideInt baseVal; /* Base time, expressed in seconds from the Epoch */ + TclDateFields date; /* Date fields used for converting */ if ((objc & 1) == 1) { Tcl_WrongNumArgs(interp, 1, objv, "string " @@ -2547,6 +2515,8 @@ ClockScanObjCmd( return ret; } + ret = TCL_ERROR; + if (opts.baseObj != NULL) { if (Tcl_GetWideIntFromObj(interp, opts.baseObj, &baseVal) != TCL_OK) { return TCL_ERROR; @@ -2557,28 +2527,45 @@ ClockScanObjCmd( baseVal = (Tcl_WideInt) now.sec; } + date.tzName = NULL; + + /* If time zone not specified use system time zone */ + if ( opts.timezoneObj == NULL + || TclGetString(opts.timezoneObj) == NULL + || opts.timezoneObj->length == 0 + ) { + opts.timezoneObj = ClockGetSystemTimeZone(clientData, interp); + if (opts.timezoneObj == NULL) { + goto done; + } + } + + /* Get the data for time changes in the given zone */ + + opts.timezoneObj = ClockSetupTimeZone(clientData, interp, opts.timezoneObj); + if (opts.timezoneObj == NULL) { + goto done; + } + + /* + * Extract year, month and day from the base time for the parser to use as + * defaults + */ + + date.tzData = ClockGetTZData(clientData, interp, opts.timezoneObj); + if (date.tzData == NULL) { + goto done; + } + date.seconds = baseVal; + if (ClockGetDateFields(interp, &date, date.tzData, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + goto done; + } + /* If free scan */ if (opts.formatObj == NULL) { -#if 0 - /* Tcled FreeScan proc - */ - Tcl_Obj *callargs[5]; - /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ - if (opts.localeObj != NULL) { - Tcl_SetResult(interp, - "legacy [clock scan] does not support -locale", TCL_STATIC); - Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); - return TCL_ERROR; - } - callargs[0] = literals[LIT_FREESCAN]; - callargs[1] = objv[1]; - callargs[2] = opts.baseObj != NULL ? opts.baseObj : Tcl_NewWideIntObj(baseVal); - callargs[3] = opts.timezoneObj != NULL ? opts.timezoneObj : literals[LIT__NIL]; - callargs[4] = opts.localeObj != NULL ? opts.localeObj : literals[LIT_C]; - return Tcl_EvalObjv(interp, 5, callargs, 0); -#else /* Use compiled version of FreeScan - */ - /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ if (opts.localeObj != NULL) { Tcl_SetResult(interp, @@ -2586,21 +2573,9 @@ ClockScanObjCmd( Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } - return ClockFreeScan(clientData, interp, objv[1], baseVal, - opts.timezoneObj, opts.localeObj); -#endif - } - - - // **** - string = TclGetString(objv[1]); - // **** timezone = ClockGetSystemTimeZone(clientData, interp) - /* - if (timezoneObj == NULL) { - goto done; - } - */ - + ret = ClockFreeScan(clientData, interp, &date, objv[1], &opts); + } + else if (0) { /* TODO: Tcled Scan proc - */ int ret; @@ -2612,19 +2587,45 @@ ClockScanObjCmd( Tcl_DecrRefCount(callargs[0]); return ret; } + else { + /* Use compiled version of Scan - */ + + ret = ClockScan(clientData, interp, &date, objv[1], &opts); + } - if (1) { + if (ret != TCL_OK) { + goto done; + } - ClockFmtScnStorage * fss; - if ((fss = Tcl_GetClockFrmScnFromObj(interp, opts.formatObj)) == NULL) { - return TCL_ERROR; - }; + /* If needed assemble julianDay using new year, month, etc. */ + if (date.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + } + + /* Local seconds to UTC (stored in date.seconds) */ - Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)fss)); + date.localSeconds = + -210866803200L + + ( 86400 * (Tcl_WideInt)date.julianDay ) + + ( date.secondOfDay % 86400 ); + if (ConvertLocalToUTC(interp, &date, date.tzData, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + goto done; } - + + ret = TCL_OK; + +done: + + Tcl_UnsetObjRef(date.tzName); + + if (ret != TCL_OK) { + return ret; + } + + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(date.seconds)); return TCL_OK; } @@ -2634,57 +2635,17 @@ int ClockFreeScan( ClientData clientData, /* Client data containing literal pool */ Tcl_Interp *interp, /* Tcl interpreter */ + register + TclDateFields *date, /* Date fields used for converting */ Tcl_Obj *strObj, /* String containing the time to scan */ - Tcl_WideInt baseVal, /* Base time, expressed in seconds from the Epoch */ - Tcl_Obj *timezoneObj, /* Default time zone in which the time will be expressed */ - Tcl_Obj *locale) /* (Unused) Name of the locale where the time will be scanned. */ + ClockFmtScnCmdArgs *opts) /* Command options */ { - enum Flags {CL_INVALIDATE = (signed int)0x80000000}; - ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; DateInfo yy; /* parse structure of TclClockFreeScan */ - TclDateFields date; /* date fields used for converting from seconds */ - Tcl_Obj *tzdata; - int secondOfDay; /* Seconds of day (time only calculation) */ - Tcl_WideInt seconds; int ret = TCL_ERROR; - date.tzName = NULL; - - /* If time zone not specified use system time zone */ - if (timezoneObj == NULL || - TclGetString(timezoneObj) == NULL || timezoneObj->length == 0) { - timezoneObj = ClockGetSystemTimeZone(clientData, interp); - if (timezoneObj == NULL) { - goto done; - } - } - - /* Get the data for time changes in the given zone */ - - timezoneObj = ClockSetupTimeZone(clientData, interp, timezoneObj); - if (timezoneObj == NULL) { - goto done; - } - - /* - * Extract year, month and day from the base time for the parser to use as - * defaults - */ - - tzdata = ClockGetTZData(clientData, interp, timezoneObj); - if (tzdata == NULL) { - goto done; - } - date.seconds = baseVal; - if (ClockGetDateFields(interp, &date, tzdata, GREGORIAN_CHANGE_DATE) - != TCL_OK) { - goto done; - } - - secondOfDay = date.localSeconds % 86400; /* * Parse the date. The parser will fill a structure "yy" with date, time, @@ -2692,9 +2653,9 @@ ClockFreeScan( */ yy.dateInput = Tcl_GetString(strObj); - yy.dateYear = date.year; - yy.dateMonth = date.month; - yy.dateDay = date.dayOfMonth; + yy.dateYear = date->year; + yy.dateMonth = date->month; + yy.dateDay = date->dayOfMonth; if (TclClockFreeScan(interp, &yy) != TCL_OK) { Tcl_Obj *msg = Tcl_NewObj(); @@ -2717,10 +2678,10 @@ ClockFreeScan( } yy.dateYear += ClockCurrentYearCentury(clientData, interp); } - date.era = CE; - date.year = yy.dateYear; - date.month = yy.dateMonth; - date.dayOfMonth = yy.dateDay; + date->era = CE; + date->year = yy.dateYear; + date->month = yy.dateMonth; + date->dayOfMonth = yy.dateDay; if (yy.dateHaveTime == 0) { yy.dateHaveTime = -1; } @@ -2738,34 +2699,34 @@ ClockFreeScan( tzObjStor = ClockFormatNumericTimeZone( 60 * minEast + 3600 * dstFlag); - timezoneObj = ClockSetupTimeZone(clientData, interp, tzObjStor); - if (tzObjStor != timezoneObj) { + opts->timezoneObj = ClockSetupTimeZone(clientData, interp, tzObjStor); + if (tzObjStor != opts->timezoneObj) { Tcl_DecrRefCount(tzObjStor); } - if (timezoneObj == NULL) { + if (opts->timezoneObj == NULL) { goto done; } - tzdata = ClockGetTZData(clientData, interp, timezoneObj); - if (tzdata == NULL) { + date->tzData = ClockGetTZData(clientData, interp, opts->timezoneObj); + if (date->tzData == NULL) { goto done; } } /* on demand (lazy) assemble julianDay using new year, month, etc. */ - date.julianDay = CL_INVALIDATE; + date->julianDay = CL_INVALIDATE; /* * Assemble date, time, zone into seconds-from-epoch */ - Tcl_SetObjRef(date.tzName, timezoneObj); + Tcl_SetObjRef(date->tzName, opts->timezoneObj); if (yy.dateHaveTime == -1) { - secondOfDay = 0; + date->secondOfDay = 0; } else if (yy.dateHaveTime) { - secondOfDay = ToSeconds(yy.dateHour, yy.dateMinutes, + date->secondOfDay = ToSeconds(yy.dateHour, yy.dateMinutes, yy.dateSeconds, yy.dateMeridian); } else @@ -2775,7 +2736,10 @@ ClockFreeScan( && ( yy.dateRelMonth != 0 || yy.dateRelDay != 0 ) ) ) { - secondOfDay = 0; + date->secondOfDay = 0; + } + else { + date->secondOfDay = date->localSeconds % 86400; } /* @@ -2792,26 +2756,26 @@ repeat_rel: int m, h; /* if needed extract year, month, etc. again */ - if (date.month == CL_INVALIDATE) { - GetGregorianEraYearDay(&date, GREGORIAN_CHANGE_DATE); - GetMonthDay(&date); - GetYearWeekDay(&date, GREGORIAN_CHANGE_DATE); + if (date->month == CL_INVALIDATE) { + GetGregorianEraYearDay(date, GREGORIAN_CHANGE_DATE); + GetMonthDay(date); + GetYearWeekDay(date, GREGORIAN_CHANGE_DATE); } /* add the requisite number of months */ - date.month += yy.dateRelMonth - 1; - date.year += date.month / 12; - m = date.month % 12; - date.month = m + 1; + date->month += yy.dateRelMonth - 1; + date->year += date->month / 12; + m = date->month % 12; + date->month = m + 1; /* if the day doesn't exist in the current month, repair it */ - h = hath[IsGregorianLeapYear(&date)][m]; - if (date.dayOfMonth > h) { - date.dayOfMonth = h; + h = hath[IsGregorianLeapYear(date)][m]; + if (date->dayOfMonth > h) { + date->dayOfMonth = h; } /* on demand (lazy) assemble julianDay using new year, month, etc. */ - date.julianDay = CL_INVALIDATE; + date->julianDay = CL_INVALIDATE; yy.dateRelMonth = 0; } @@ -2820,19 +2784,19 @@ repeat_rel: if (yy.dateRelDay) { /* assemble julianDay using new year, month, etc. */ - if (date.julianDay == CL_INVALIDATE) { - GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + if (date->julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(date, GREGORIAN_CHANGE_DATE); } - date.julianDay += yy.dateRelDay; + date->julianDay += yy.dateRelDay; /* julianDay was changed, on demand (lazy) extract year, month, etc. again */ - date.month = CL_INVALIDATE; + date->month = CL_INVALIDATE; yy.dateRelDay = 0; } /* relative time (seconds) */ - secondOfDay += yy.dateRelSeconds; + date->secondOfDay += yy.dateRelSeconds; yy.dateRelSeconds = 0; } @@ -2845,20 +2809,20 @@ repeat_rel: int monthDiff; /* if needed extract year, month, etc. again */ - if (date.month == CL_INVALIDATE) { - GetGregorianEraYearDay(&date, GREGORIAN_CHANGE_DATE); - GetMonthDay(&date); - GetYearWeekDay(&date, GREGORIAN_CHANGE_DATE); + if (date->month == CL_INVALIDATE) { + GetGregorianEraYearDay(date, GREGORIAN_CHANGE_DATE); + GetMonthDay(date); + GetYearWeekDay(date, GREGORIAN_CHANGE_DATE); } if (yy.dateMonthOrdinal > 0) { - monthDiff = yy.dateMonth - date.month; + monthDiff = yy.dateMonth - date->month; if (monthDiff <= 0) { monthDiff += 12; } yy.dateMonthOrdinal--; } else { - monthDiff = date.month - yy.dateMonth; + monthDiff = date->month - yy.dateMonth; if (monthDiff >= 0) { monthDiff -= 12; } @@ -2867,7 +2831,7 @@ repeat_rel: /* process it further via relative times */ yy.dateHaveRel++; - date.year += yy.dateMonthOrdinal; + date->year += yy.dateMonthOrdinal; yy.dateRelMonth += monthDiff; yy.dateHaveOrdinalMonth = 0; @@ -2881,48 +2845,24 @@ repeat_rel: if (yy.dateHaveDay && !yy.dateHaveDate) { /* if needed assemble julianDay now */ - if (date.julianDay == CL_INVALIDATE) { - GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + if (date->julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(date, GREGORIAN_CHANGE_DATE); } - date.era = CE; - date.julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date.julianDay + 6) + date->era = CE; + date->julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date->julianDay + 6) + 7 * yy.dateDayOrdinal; if (yy.dateDayOrdinal > 0) { - date.julianDay -= 7; + date->julianDay -= 7; } } - /* If needed assemble julianDay using new year, month, etc. */ - if (date.julianDay == CL_INVALIDATE) { - GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); - } - - /* Local seconds to UTC */ - - date.localSeconds = - -210866803200L - + ( 86400 * (Tcl_WideInt)date.julianDay ) - + ( secondOfDay % 86400 ); - - if (ConvertLocalToUTC(interp, &date, tzdata, GREGORIAN_CHANGE_DATE) - != TCL_OK) { - goto done; - } - - seconds = date.seconds; + /* Free scanning completed - date ready */ ret = TCL_OK; done: - Tcl_UnsetObjRef(date.tzName); - - if (ret != TCL_OK) { - return ret; - } - - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(seconds)); return TCL_OK; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index fa89dde..356965d 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -35,8 +35,6 @@ static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); * Clock scan and format facilities. */ -#define TOK_CHAIN_BLOCK_SIZE 8 - /* *---------------------------------------------------------------------- */ @@ -139,16 +137,16 @@ ClockFmtScnStorageFreeProc( Tcl_HashEntry *hPtr) { ClockFmtScnStorage *fss = FmtScn4HashEntry(hPtr); - ClockScanToken *tok; - - tok = fss->firstScnTok; - while (tok != NULL) { - if (tok->nextTok == tok + 1) { - tok++; - /*****************************/ - } else { - tok = tok->nextTok; - } + + if (fss->scnTok != NULL) { + ckfree(fss->scnTok); + fss->scnTok = NULL; + fss->scnTokC = 0; + } + if (fss->fmtTok != NULL) { + ckfree(fss->fmtTok); + fss->fmtTok = NULL; + fss->fmtTokC = 0; } ckfree(fss); @@ -394,6 +392,101 @@ Tcl_GetClockFrmScnFromObj( } +#define AllocTokenInChain(tok, chain, tokC) \ + if ((tok) >= (chain) + (tokC)) { \ + (char *)(chain) = ckrealloc((char *)(chain), \ + (tokC) + sizeof((**(tok))) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); \ + if ((chain) == NULL) { return NULL; }; \ + (tok) = (chain) + (tokC); \ + (tokC) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ + } + +const char *ScnSTokenChars = "dmyYHMS"; +static ClockScanToken ScnSTokens[] = { + {CTOKT_DIGIT, 1, 2, 0}, +}; + +/* + *---------------------------------------------------------------------- + */ +ClockScanToken ** +ClockGetOrParseScanFormat( + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *formatObj) /* Format container */ +{ + ClockFmtScnStorage *fss; + ClockScanToken **tok; + + if (formatObj->typePtr != &ClockFmtObjType) { + if (ClockFmtObj_SetFromAny(interp, formatObj) != TCL_OK) { + return NULL; + } + } + + fss = ObjClockFmtScn(formatObj); + + if (fss == NULL) { + fss = FindOrCreateFmtScnStorage(interp, TclGetString(formatObj)); + if (fss == NULL) { + return NULL; + } + } + + /* if first time scanning - tokenize format */ + if (fss->scnTok == NULL) { + const char *strFmt; + register const char *p, *e; + + fss->scnTokC = CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; + fss->scnTok = + tok = ckalloc(sizeof(**tok) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); + (*tok)->type = CTOKT_EOB; + strFmt = TclGetString(formatObj); + for (e = p = strFmt, e += formatObj->length; p != e; p++) { + switch (*p) { + case '%': + if (p+1 >= e) + goto word_tok; + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + p++; + // *tok = + break; + case ' ': + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + // *tok = + break; + default: +word_tok: + break; + } + } + } + + return fss->scnTok; +} + +/* + *---------------------------------------------------------------------- + */ +int +ClockScan( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + TclDateFields *date, /* Date fields used for converting */ + Tcl_Obj *strObj, /* String containing the time to scan */ + ClockFmtScnCmdArgs *opts) /* Command options */ +{ + ClockScanToken **tok; + + if (ClockGetOrParseScanFormat(interp, opts->formatObj) == NULL) { + return TCL_ERROR; + } + + // Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)fss)); + return TCL_ERROR; +} + + static void Tcl_GetClockFrmScnFinalize() { diff --git a/generic/tclDate.h b/generic/tclDate.h index c3c362a..0329b2c 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -57,6 +57,44 @@ typedef struct DateInfo { } DateInfo; +enum {CL_INVALIDATE = (signed int)0x80000000}; +/* + * Structure containing the command arguments supplied to [clock format] and [clock scan] + */ + +typedef struct ClockFmtScnCmdArgs { + Tcl_Obj *formatObj; /* Format */ + Tcl_Obj *localeObj; /* Name of the locale where the time will be expressed. */ + Tcl_Obj *timezoneObj; /* Default time zone in which the time will be expressed */ + Tcl_Obj *baseObj; /* Base (scan only) */ +} ClockFmtScnCmdArgs; + +/* + * Structure containing the fields used in [clock format] and [clock scan] + */ + +typedef struct TclDateFields { + Tcl_WideInt seconds; /* Time expressed in seconds from the Posix + * epoch */ + Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds + * from the Posix epoch */ + int secondOfDay; /* Seconds of day (in-between time only calculation) */ + int tzOffset; /* Time zone offset in seconds east of + * Greenwich */ + Tcl_Obj *tzName; /* Time zone name (if set the refCount is incremented) */ + Tcl_Obj *tzData; /* Time zone data object (internally referenced) */ + int julianDay; /* Julian Day Number in local time zone */ + enum {BCE=1, CE=0} era; /* Era */ + int gregorian; /* Flag == 1 if the date is Gregorian */ + int year; /* Year of the era */ + int dayOfYear; /* Day of the year (1 January == 1) */ + int month; /* Month number */ + int dayOfMonth; /* Day of the month */ + int iso8601Year; /* ISO8601 week-based year */ + int iso8601Week; /* ISO8601 week number */ + int dayOfWeek; /* Day of the week */ +} TclDateFields; + /* * Meridian: am, pm, or 24-hour style. */ @@ -71,23 +109,31 @@ typedef enum _MERIDIAN { #define CLOCK_FMT_SCN_STORAGE_GC_SIZE 32 +#define CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE 12 + +typedef enum _CLCKTOK_TYPE { + CTOKT_EOB=0, CTOKT_DIGIT, CTOKT_SPACE +} CLCKTOK_TYPE; -typedef struct ClockFormatToken ClockFormatToken; -typedef struct ClockScanToken ClockScanToken; typedef struct ClockFmtScnStorage ClockFmtScnStorage; typedef struct ClockFormatToken { - ClockFormatToken *nextTok; + CLCKTOK_TYPE type; } ClockFormatToken; typedef struct ClockScanToken { - ClockScanToken *nextTok; + unsigned short int type; + unsigned short int minSize; + unsigned short int maxSize; + unsigned short int offs; } ClockScanToken; typedef struct ClockFmtScnStorage { - int objRefCount; /* Reference count shared across threads */ - ClockScanToken *firstScnTok; - ClockFormatToken *firstFmtTok; + int objRefCount; /* Reference count shared across threads */ + ClockScanToken **scnTok; + unsigned int scnTokC; + ClockFormatToken **fmtTok; + unsigned int fmtTokC; #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 ClockFmtScnStorage *nextPtr; ClockFmtScnStorage *prevPtr; @@ -115,6 +161,9 @@ MODULE_SCOPE ClockFmtScnStorage * Tcl_GetClockFrmScnFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr); +MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, + TclDateFields *date, Tcl_Obj *strObj, + ClockFmtScnCmdArgs *opts); /* * Other externals. diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 59469fd..7994428 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -28,8 +28,7 @@ proc _test_get_commands {lst} { proc test-scan {{reptime 1000}} { foreach _(c) [_test_get_commands { # Scan : date - {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} - #return + #{clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} #{**STOP** : Wed Nov 25 01:00:00 CET 2015} # FreeScan : relative date {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} @@ -80,6 +79,7 @@ proc test-other {{reptime 1000}} { foreach _(c) [_test_get_commands { # Bad zone {catch {clock scan "1 day" -timezone BAD_ZONE -locale en}} + **STOP** # Scan : test rotate of GC objects (format is dynamic, so tcl-obj removed with last reference) {set i 0; time { clock scan "[incr i] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} # Scan : test reusability of GC objects (format is dynamic, so tcl-obj removed with last reference) -- cgit v0.12 From 898bc97bbea9601d6d2a7ac526e14e9a3b540362 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:10:44 +0000 Subject: [temp-commit]: tclClockFmt.c - amend for 2nd try (with cherry picking of tclSE incompatible facilities) Prepared for common usage of both scan commands - free scan / scan with format (currently faked via eval to __org_scan); test cases passed. --- generic/tclClock.c | 218 +++++++++++++++++++++++++-------------------------- generic/tclDate.c | 51 +++--------- generic/tclDate.h | 93 ++++++++++++++-------- generic/tclGetDate.y | 39 ++------- 4 files changed, 189 insertions(+), 212 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 888757f..3c296b5 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -218,7 +218,7 @@ static int ClockScanObjCmd( int objc, Tcl_Obj *const objv[]); static int ClockFreeScan( ClientData clientData, Tcl_Interp *interp, - register TclDateFields *date, + register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); static struct tm * ThreadSafeLocalTime(const time_t *); static unsigned long TzsetGetEpoch(void); @@ -2492,8 +2492,9 @@ ClockScanObjCmd( int ret; ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ - Tcl_WideInt baseVal; /* Base time, expressed in seconds from the Epoch */ - TclDateFields date; /* Date fields used for converting */ + Tcl_WideInt baseVal; /* Base time, expressed in seconds from the Epoch */ + DateInfo yy; /* Common structure used for parsing */ + DateInfo *info = &yy; if ((objc & 1) == 1) { Tcl_WrongNumArgs(interp, 1, objv, "string " @@ -2527,7 +2528,7 @@ ClockScanObjCmd( baseVal = (Tcl_WideInt) now.sec; } - date.tzName = NULL; + yydate.tzName = NULL; /* If time zone not specified use system time zone */ if ( opts.timezoneObj == NULL @@ -2552,12 +2553,12 @@ ClockScanObjCmd( * defaults */ - date.tzData = ClockGetTZData(clientData, interp, opts.timezoneObj); - if (date.tzData == NULL) { + yydate.tzData = ClockGetTZData(clientData, interp, opts.timezoneObj); + if (yydate.tzData == NULL) { goto done; } - date.seconds = baseVal; - if (ClockGetDateFields(interp, &date, date.tzData, GREGORIAN_CHANGE_DATE) + yydate.seconds = baseVal; + if (ClockGetDateFields(interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } @@ -2573,10 +2574,10 @@ ClockScanObjCmd( Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } - ret = ClockFreeScan(clientData, interp, &date, objv[1], &opts); + ret = ClockFreeScan(clientData, interp, info, objv[1], &opts); } else - if (0) { + if (1) { /* TODO: Tcled Scan proc - */ int ret; Tcl_Obj *callargs[10]; @@ -2585,12 +2586,12 @@ ClockScanObjCmd( Tcl_IncrRefCount(callargs[0]); ret = Tcl_EvalObjv(interp, objc, callargs, 0); Tcl_DecrRefCount(callargs[0]); - return ret; + return ret; } else { /* Use compiled version of Scan - */ - ret = ClockScan(clientData, interp, &date, objv[1], &opts); + ret = ClockScan(clientData, interp, &yydate, objv[1], &opts); } if (ret != TCL_OK) { @@ -2599,18 +2600,18 @@ ClockScanObjCmd( /* If needed assemble julianDay using new year, month, etc. */ - if (date.julianDay == CL_INVALIDATE) { - GetJulianDayFromEraYearMonthDay(&date, GREGORIAN_CHANGE_DATE); + if (yydate.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); } - /* Local seconds to UTC (stored in date.seconds) */ + /* Local seconds to UTC (stored in yydate.seconds) */ - date.localSeconds = + yydate.localSeconds = -210866803200L - + ( 86400 * (Tcl_WideInt)date.julianDay ) - + ( date.secondOfDay % 86400 ); + + ( 86400 * (Tcl_WideInt)yydate.julianDay ) + + ( yySeconds % 86400 ); - if (ConvertLocalToUTC(interp, &date, date.tzData, GREGORIAN_CHANGE_DATE) + if (ConvertLocalToUTC(interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } @@ -2619,13 +2620,13 @@ ClockScanObjCmd( done: - Tcl_UnsetObjRef(date.tzName); + Tcl_UnsetObjRef(yydate.tzName); if (ret != TCL_OK) { return ret; } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(date.seconds)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(yydate.seconds)); return TCL_OK; } @@ -2636,28 +2637,28 @@ ClockFreeScan( ClientData clientData, /* Client data containing literal pool */ Tcl_Interp *interp, /* Tcl interpreter */ register - TclDateFields *date, /* Date fields used for converting */ + DateInfo *info, /* Date fields used for parsing & converting + * simultaneously a yy-parse structure of the + * TclClockFreeScan */ Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { - ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; + // ClockClientData *dataPtr = clientData; + // Tcl_Obj **literals = dataPtr->literals; - DateInfo yy; /* parse structure of TclClockFreeScan */ int ret = TCL_ERROR; - /* - * Parse the date. The parser will fill a structure "yy" with date, time, - * time zone, relative month/day/seconds, relative weekday, ordinal month. + * Parse the date. The parser will fill a structure "info" with date, + * time, time zone, relative month/day/seconds, relative weekday, ordinal + * month. + * Notice that many yy-defines point to values in the "info" or "date" + * structure, e. g. yySeconds -> info->date.secondOfDay or + * yySeconds -> info->date.month (same as yydate.month) */ - yy.dateInput = Tcl_GetString(strObj); + yyInput = Tcl_GetString(strObj); - yy.dateYear = date->year; - yy.dateMonth = date->month; - yy.dateDay = date->dayOfMonth; - - if (TclClockFreeScan(interp, &yy) != TCL_OK) { + if (TclClockFreeScan(interp, info) != TCL_OK) { Tcl_Obj *msg = Tcl_NewObj(); Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"%s\": %s", Tcl_GetString(strObj), TclGetString(Tcl_GetObjResult(interp))); @@ -2671,19 +2672,16 @@ ClockFreeScan( * midnight. */ - if (yy.dateHaveDate) { - if (yy.dateYear < 100) { - if (yy.dateYear >= ClockGetYearOfCenturySwitch(clientData, interp)) { - yy.dateYear -= 100; + if (yyHaveDate) { + if (yyYear < 100) { + if (yyYear >= ClockGetYearOfCenturySwitch(clientData, interp)) { + yyYear -= 100; } - yy.dateYear += ClockCurrentYearCentury(clientData, interp); + yyYear += ClockCurrentYearCentury(clientData, interp); } - date->era = CE; - date->year = yy.dateYear; - date->month = yy.dateMonth; - date->dayOfMonth = yy.dateDay; - if (yy.dateHaveTime == 0) { - yy.dateHaveTime = -1; + yydate.era = CE; + if (yyHaveTime == 0) { + yyHaveTime = -1; } } @@ -2692,10 +2690,10 @@ ClockFreeScan( * zone indicator of +-hhmm and setup this time zone. */ - if (yy.dateHaveZone) { + if (yyHaveZone) { Tcl_Obj *tzObjStor = NULL; - int minEast = -yy.dateTimezone; - int dstFlag = 1 - yy.dateDSTmode; + int minEast = -yyTimezone; + int dstFlag = 1 - yyDSTmode; tzObjStor = ClockFormatNumericTimeZone( 60 * minEast + 3600 * dstFlag); @@ -2706,40 +2704,40 @@ ClockFreeScan( if (opts->timezoneObj == NULL) { goto done; } - date->tzData = ClockGetTZData(clientData, interp, opts->timezoneObj); - if (date->tzData == NULL) { + yydate.tzData = ClockGetTZData(clientData, interp, opts->timezoneObj); + if (yydate.tzData == NULL) { goto done; } } /* on demand (lazy) assemble julianDay using new year, month, etc. */ - date->julianDay = CL_INVALIDATE; + yydate.julianDay = CL_INVALIDATE; /* * Assemble date, time, zone into seconds-from-epoch */ - Tcl_SetObjRef(date->tzName, opts->timezoneObj); + Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); - if (yy.dateHaveTime == -1) { - date->secondOfDay = 0; + if (yyHaveTime == -1) { + yySeconds = 0; } else - if (yy.dateHaveTime) { - date->secondOfDay = ToSeconds(yy.dateHour, yy.dateMinutes, - yy.dateSeconds, yy.dateMeridian); + if (yyHaveTime) { + yySeconds = ToSeconds(yyHour, yyMinutes, + yySeconds, yyMeridian); } else - if ( (yy.dateHaveDay && !yy.dateHaveDate) - || yy.dateHaveOrdinalMonth - || ( yy.dateHaveRel - && ( yy.dateRelMonth != 0 - || yy.dateRelDay != 0 ) ) + if ( (yyHaveDay && !yyHaveDate) + || yyHaveOrdinalMonth + || ( yyHaveRel + && ( yyRelMonth != 0 + || yyRelDay != 0 ) ) ) { - date->secondOfDay = 0; + yySeconds = 0; } else { - date->secondOfDay = date->localSeconds % 86400; + yySeconds = yydate.localSeconds % 86400; } /* @@ -2748,56 +2746,56 @@ ClockFreeScan( repeat_rel: - if (yy.dateHaveRel) { + if (yyHaveRel) { /* add months (or years in months) */ - if (yy.dateRelMonth != 0) { + if (yyRelMonth != 0) { int m, h; /* if needed extract year, month, etc. again */ - if (date->month == CL_INVALIDATE) { - GetGregorianEraYearDay(date, GREGORIAN_CHANGE_DATE); - GetMonthDay(date); - GetYearWeekDay(date, GREGORIAN_CHANGE_DATE); + if (yyMonth == CL_INVALIDATE) { + GetGregorianEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); + GetMonthDay(&yydate); + GetYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); } /* add the requisite number of months */ - date->month += yy.dateRelMonth - 1; - date->year += date->month / 12; - m = date->month % 12; - date->month = m + 1; + yyMonth += yyRelMonth - 1; + yyYear += yyMonth / 12; + m = yyMonth % 12; + yyMonth = m + 1; /* if the day doesn't exist in the current month, repair it */ - h = hath[IsGregorianLeapYear(date)][m]; - if (date->dayOfMonth > h) { - date->dayOfMonth = h; + h = hath[IsGregorianLeapYear(&yydate)][m]; + if (yyDay > h) { + yyDay = h; } /* on demand (lazy) assemble julianDay using new year, month, etc. */ - date->julianDay = CL_INVALIDATE; + yydate.julianDay = CL_INVALIDATE; - yy.dateRelMonth = 0; + yyRelMonth = 0; } /* add days (or other parts aligned to days) */ - if (yy.dateRelDay) { + if (yyRelDay) { /* assemble julianDay using new year, month, etc. */ - if (date->julianDay == CL_INVALIDATE) { - GetJulianDayFromEraYearMonthDay(date, GREGORIAN_CHANGE_DATE); + if (yydate.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); } - date->julianDay += yy.dateRelDay; + yydate.julianDay += yyRelDay; /* julianDay was changed, on demand (lazy) extract year, month, etc. again */ - date->month = CL_INVALIDATE; + yyMonth = CL_INVALIDATE; - yy.dateRelDay = 0; + yyRelDay = 0; } /* relative time (seconds) */ - date->secondOfDay += yy.dateRelSeconds; - yy.dateRelSeconds = 0; + yySeconds += yyRelSeconds; + yyRelSeconds = 0; } @@ -2805,35 +2803,35 @@ repeat_rel: * Do relative (ordinal) month */ - if (yy.dateHaveOrdinalMonth) { + if (yyHaveOrdinalMonth) { int monthDiff; /* if needed extract year, month, etc. again */ - if (date->month == CL_INVALIDATE) { - GetGregorianEraYearDay(date, GREGORIAN_CHANGE_DATE); - GetMonthDay(date); - GetYearWeekDay(date, GREGORIAN_CHANGE_DATE); + if (yyMonth == CL_INVALIDATE) { + GetGregorianEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); + GetMonthDay(&yydate); + GetYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); } - if (yy.dateMonthOrdinal > 0) { - monthDiff = yy.dateMonth - date->month; + if (yyMonthOrdinalIncr > 0) { + monthDiff = yyMonthOrdinal - yyMonth; if (monthDiff <= 0) { monthDiff += 12; } - yy.dateMonthOrdinal--; + yyMonthOrdinalIncr--; } else { - monthDiff = date->month - yy.dateMonth; + monthDiff = yyMonth - yyMonthOrdinal; if (monthDiff >= 0) { monthDiff -= 12; } - yy.dateMonthOrdinal++; + yyMonthOrdinalIncr++; } /* process it further via relative times */ - yy.dateHaveRel++; - date->year += yy.dateMonthOrdinal; - yy.dateRelMonth += monthDiff; - yy.dateHaveOrdinalMonth = 0; + yyHaveRel++; + yyYear += yyMonthOrdinalIncr; + yyRelMonth += monthDiff; + yyHaveOrdinalMonth = 0; goto repeat_rel; } @@ -2842,18 +2840,18 @@ repeat_rel: * Do relative weekday */ - if (yy.dateHaveDay && !yy.dateHaveDate) { + if (yyHaveDay && !yyHaveDate) { /* if needed assemble julianDay now */ - if (date->julianDay == CL_INVALIDATE) { - GetJulianDayFromEraYearMonthDay(date, GREGORIAN_CHANGE_DATE); + if (yydate.julianDay == CL_INVALIDATE) { + GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); } - date->era = CE; - date->julianDay = WeekdayOnOrBefore(yy.dateDayNumber, date->julianDay + 6) - + 7 * yy.dateDayOrdinal; - if (yy.dateDayOrdinal > 0) { - date->julianDay -= 7; + yydate.era = CE; + yydate.julianDay = WeekdayOnOrBefore(yyDayNumber, yydate.julianDay + 6) + + 7 * yyDayOrdinal; + if (yyDayOrdinal > 0) { + yydate.julianDay -= 7; } } @@ -2863,7 +2861,7 @@ repeat_rel: done: - return TCL_OK; + return ret; } /*---------------------------------------------------------------------- diff --git a/generic/tclDate.c b/generic/tclDate.c index 389b245..a47f43d 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -109,31 +109,6 @@ #define YYMALLOC ckalloc #define YYFREE(x) (ckfree((void*) (x))) -#define yyDSTmode (info->dateDSTmode) -#define yyDayOrdinal (info->dateDayOrdinal) -#define yyDayNumber (info->dateDayNumber) -#define yyMonthOrdinal (info->dateMonthOrdinal) -#define yyHaveDate (info->dateHaveDate) -#define yyHaveDay (info->dateHaveDay) -#define yyHaveOrdinalMonth (info->dateHaveOrdinalMonth) -#define yyHaveRel (info->dateHaveRel) -#define yyHaveTime (info->dateHaveTime) -#define yyHaveZone (info->dateHaveZone) -#define yyTimezone (info->dateTimezone) -#define yyDay (info->dateDay) -#define yyMonth (info->dateMonth) -#define yyYear (info->dateYear) -#define yyHour (info->dateHour) -#define yyMinutes (info->dateMinutes) -#define yySeconds (info->dateSeconds) -#define yyMeridian (info->dateMeridian) -#define yyRelMonth (info->dateRelMonth) -#define yyRelDay (info->dateRelDay) -#define yyRelSeconds (info->dateRelSeconds) -#define yyRelPointer (info->dateRelPointer) -#define yyInput (info->dateInput) -#define yyDigitCount (info->dateDigitCount) - #define EPOCH 1970 #define START_OF_TIME 1902 #define END_OF_TIME 2037 @@ -570,12 +545,12 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 177, 177, 178, 181, 184, 187, 190, 193, 196, - 199, 203, 208, 211, 217, 223, 231, 237, 248, 252, - 256, 262, 266, 270, 274, 278, 284, 288, 293, 298, - 303, 308, 312, 317, 321, 326, 333, 337, 343, 352, - 361, 371, 385, 390, 393, 396, 399, 402, 405, 410, - 413, 418, 422, 426, 432, 450, 453 + 0, 152, 152, 153, 156, 159, 162, 165, 168, 171, + 174, 178, 183, 186, 192, 198, 206, 212, 223, 227, + 231, 237, 241, 245, 249, 253, 259, 263, 268, 273, + 278, 283, 287, 292, 296, 301, 308, 312, 318, 327, + 336, 346, 360, 365, 368, 371, 374, 377, 380, 385, + 388, 393, 397, 401, 407, 425, 428 }; #endif @@ -1842,16 +1817,16 @@ yyreduce: case 36: { - yyMonthOrdinal = 1; - yyMonth = (yyvsp[(2) - (2)].Number); + yyMonthOrdinalIncr = 1; + yyMonthOrdinal = (yyvsp[(2) - (2)].Number); ;} break; case 37: { - yyMonthOrdinal = (yyvsp[(2) - (3)].Number); - yyMonth = (yyvsp[(3) - (3)].Number); + yyMonthOrdinalIncr = (yyvsp[(2) - (3)].Number); + yyMonthOrdinal = (yyvsp[(3) - (3)].Number); ;} break; @@ -2722,7 +2697,7 @@ TclClockFreeScan( yyTimezone = 0; yyDSTmode = DSTmaybe; yyHaveOrdinalMonth = 0; - yyMonthOrdinal = 0; + yyMonthOrdinalIncr = 0; yyHaveDay = 0; yyDayOrdinal = 0; yyDayNumber = 0; @@ -2873,9 +2848,9 @@ TclClockOldscanObjCmd( resultElement = Tcl_NewObj(); if (yyHaveOrdinalMonth) { Tcl_ListObjAppendElement(interp, resultElement, - Tcl_NewIntObj((int) yyMonthOrdinal)); + Tcl_NewIntObj((int) yyMonthOrdinalIncr)); Tcl_ListObjAppendElement(interp, resultElement, - Tcl_NewIntObj((int) yyMonth)); + Tcl_NewIntObj((int) yyMonthOrdinal)); } Tcl_ListObjAppendElement(interp, result, resultElement); diff --git a/generic/tclDate.h b/generic/tclDate.h index 0329b2c..49420a2 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -14,19 +14,43 @@ #define _TCLCLOCK_H /* + * Structure containing the fields used in [clock format] and [clock scan] + */ + +typedef struct TclDateFields { + Tcl_WideInt seconds; /* Time expressed in seconds from the Posix + * epoch */ + Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds + * from the Posix epoch */ + int tzOffset; /* Time zone offset in seconds east of + * Greenwich */ + Tcl_Obj *tzName; /* Time zone name (if set the refCount is incremented) */ + Tcl_Obj *tzData; /* Time zone data object (internally referenced) */ + int julianDay; /* Julian Day Number in local time zone */ + enum {BCE=1, CE=0} era; /* Era */ + int gregorian; /* Flag == 1 if the date is Gregorian */ + int year; /* Year of the era */ + int dayOfYear; /* Day of the year (1 January == 1) */ + int month; /* Month number */ + int dayOfMonth; /* Day of the month */ + int iso8601Year; /* ISO8601 week-based year */ + int iso8601Week; /* ISO8601 week number */ + int dayOfWeek; /* Day of the week */ + int hour; /* Hours of day (in-between time only calculation) */ + int minutes; /* Minutes of day (in-between time only calculation) */ + int secondOfDay; /* Seconds of day (in-between time only calculation) */ +} TclDateFields; + +/* * Structure contains return parsed fields. */ typedef struct DateInfo { - time_t dateYear; - time_t dateMonth; - time_t dateDay; + TclDateFields date; + int dateHaveDate; - time_t dateHour; - time_t dateMinutes; - time_t dateSeconds; int dateMeridian; int dateHaveTime; @@ -39,6 +63,7 @@ typedef struct DateInfo { time_t dateRelSeconds; int dateHaveRel; + time_t dateMonthOrdinalIncr; time_t dateMonthOrdinal; int dateHaveOrdinalMonth; @@ -56,6 +81,36 @@ typedef struct DateInfo { const char* separatrix; /* String separating messages */ } DateInfo; +#define yydate (info->date) /* Date fields used for converting */ + +#define yyDay (info->date.dayOfMonth) +#define yyMonth (info->date.month) +#define yyYear (info->date.year) + +#define yyHour (info->date.hour) +#define yyMinutes (info->date.minutes) +#define yySeconds (info->date.secondOfDay) + +#define yyDSTmode (info->dateDSTmode) +#define yyDayOrdinal (info->dateDayOrdinal) +#define yyDayNumber (info->dateDayNumber) +#define yyMonthOrdinalIncr (info->dateMonthOrdinalIncr) +#define yyMonthOrdinal (info->dateMonthOrdinal) +#define yyHaveDate (info->dateHaveDate) +#define yyHaveDay (info->dateHaveDay) +#define yyHaveOrdinalMonth (info->dateHaveOrdinalMonth) +#define yyHaveRel (info->dateHaveRel) +#define yyHaveTime (info->dateHaveTime) +#define yyHaveZone (info->dateHaveZone) +#define yyTimezone (info->dateTimezone) +#define yyMeridian (info->dateMeridian) +#define yyRelMonth (info->dateRelMonth) +#define yyRelDay (info->dateRelDay) +#define yyRelSeconds (info->dateRelSeconds) +#define yyRelPointer (info->dateRelPointer) +#define yyInput (info->dateInput) +#define yyDigitCount (info->dateDigitCount) + enum {CL_INVALIDATE = (signed int)0x80000000}; /* @@ -70,32 +125,6 @@ typedef struct ClockFmtScnCmdArgs { } ClockFmtScnCmdArgs; /* - * Structure containing the fields used in [clock format] and [clock scan] - */ - -typedef struct TclDateFields { - Tcl_WideInt seconds; /* Time expressed in seconds from the Posix - * epoch */ - Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds - * from the Posix epoch */ - int secondOfDay; /* Seconds of day (in-between time only calculation) */ - int tzOffset; /* Time zone offset in seconds east of - * Greenwich */ - Tcl_Obj *tzName; /* Time zone name (if set the refCount is incremented) */ - Tcl_Obj *tzData; /* Time zone data object (internally referenced) */ - int julianDay; /* Julian Day Number in local time zone */ - enum {BCE=1, CE=0} era; /* Era */ - int gregorian; /* Flag == 1 if the date is Gregorian */ - int year; /* Year of the era */ - int dayOfYear; /* Day of the year (1 January == 1) */ - int month; /* Month number */ - int dayOfMonth; /* Day of the month */ - int iso8601Year; /* ISO8601 week-based year */ - int iso8601Week; /* ISO8601 week number */ - int dayOfWeek; /* Day of the week */ -} TclDateFields; - -/* * Meridian: am, pm, or 24-hour style. */ diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index d500d6b..571b7df 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -56,31 +56,6 @@ #define YYMALLOC ckalloc #define YYFREE(x) (ckfree((void*) (x))) -#define yyDSTmode (info->dateDSTmode) -#define yyDayOrdinal (info->dateDayOrdinal) -#define yyDayNumber (info->dateDayNumber) -#define yyMonthOrdinal (info->dateMonthOrdinal) -#define yyHaveDate (info->dateHaveDate) -#define yyHaveDay (info->dateHaveDay) -#define yyHaveOrdinalMonth (info->dateHaveOrdinalMonth) -#define yyHaveRel (info->dateHaveRel) -#define yyHaveTime (info->dateHaveTime) -#define yyHaveZone (info->dateHaveZone) -#define yyTimezone (info->dateTimezone) -#define yyDay (info->dateDay) -#define yyMonth (info->dateMonth) -#define yyYear (info->dateYear) -#define yyHour (info->dateHour) -#define yyMinutes (info->dateMinutes) -#define yySeconds (info->dateSeconds) -#define yyMeridian (info->dateMeridian) -#define yyRelMonth (info->dateRelMonth) -#define yyRelDay (info->dateRelDay) -#define yyRelSeconds (info->dateRelSeconds) -#define yyRelPointer (info->dateRelPointer) -#define yyInput (info->dateInput) -#define yyDigitCount (info->dateDigitCount) - #define EPOCH 1970 #define START_OF_TIME 1902 #define END_OF_TIME 2037 @@ -331,12 +306,12 @@ date : tUNUMBER '/' tUNUMBER { ; ordMonth: tNEXT tMONTH { - yyMonthOrdinal = 1; - yyMonth = $2; + yyMonthOrdinalIncr = 1; + yyMonthOrdinal = $2; } | tNEXT tUNUMBER tMONTH { - yyMonthOrdinal = $2; - yyMonth = $3; + yyMonthOrdinalIncr = $2; + yyMonthOrdinal = $3; } ; @@ -933,7 +908,7 @@ TclClockFreeScan( yyTimezone = 0; yyDSTmode = DSTmaybe; yyHaveOrdinalMonth = 0; - yyMonthOrdinal = 0; + yyMonthOrdinalIncr = 0; yyHaveDay = 0; yyDayOrdinal = 0; yyDayNumber = 0; @@ -1084,9 +1059,9 @@ TclClockOldscanObjCmd( resultElement = Tcl_NewObj(); if (yyHaveOrdinalMonth) { Tcl_ListObjAppendElement(interp, resultElement, - Tcl_NewIntObj((int) yyMonthOrdinal)); + Tcl_NewIntObj((int) yyMonthOrdinalIncr)); Tcl_ListObjAppendElement(interp, resultElement, - Tcl_NewIntObj((int) yyMonth)); + Tcl_NewIntObj((int) yyMonthOrdinal)); } Tcl_ListObjAppendElement(interp, result, resultElement); -- cgit v0.12 From aba1f29686731df92a81ca76ce22cd65601f4070 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:12:07 +0000 Subject: [temp-commit]: rewrite scan token map handling --- generic/tclClock.c | 2 + generic/tclClockFmt.c | 102 ++++++++++++++++++++++++++++++++++++---------- tests-perf/clock.perf.tcl | 12 +++++- 3 files changed, 93 insertions(+), 23 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 3c296b5..e00d6a2 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -2576,6 +2576,7 @@ ClockScanObjCmd( } ret = ClockFreeScan(clientData, interp, info, objv[1], &opts); } +#if 0 else if (1) { /* TODO: Tcled Scan proc - */ @@ -2588,6 +2589,7 @@ ClockScanObjCmd( Tcl_DecrRefCount(callargs[0]); return ret; } +#endif else { /* Use compiled version of Scan - */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 356965d..93416af 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -392,19 +392,32 @@ Tcl_GetClockFrmScnFromObj( } -#define AllocTokenInChain(tok, chain, tokC) \ - if ((tok) >= (chain) + (tokC)) { \ +#define AllocTokenInChain(tok, chain, tokCnt) \ + if (++(tok) >= (chain) + (tokCnt)) { \ (char *)(chain) = ckrealloc((char *)(chain), \ - (tokC) + sizeof((**(tok))) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); \ - if ((chain) == NULL) { return NULL; }; \ - (tok) = (chain) + (tokC); \ - (tokC) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ - } - -const char *ScnSTokenChars = "dmyYHMS"; -static ClockScanToken ScnSTokens[] = { + (tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \ + if ((chain) == NULL) { goto done; }; \ + (tok) = (chain) + (tokCnt); \ + (tokCnt) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ + } \ + *(tok) = NULL; + +const char *ScnSTokenMapChars = + "dmyYHMS"; +static ClockScanToken ScnSTokenMap[] = { + {CTOKT_DIGIT, 1, 2, 0}, + {CTOKT_DIGIT, 1, 2, 0}, + {CTOKT_DIGIT, 1, 2, 0}, + {CTOKT_DIGIT, 1, 4, 0}, + {CTOKT_DIGIT, 1, 2, 0}, + {CTOKT_DIGIT, 1, 2, 0}, {CTOKT_DIGIT, 1, 2, 0}, }; +const char *ScnSpecTokenMapChars = + " %"; +static ClockScanToken ScnSpecTokenMap[] = { + {CTOKT_SPACE, 1, 0xffff, 0}, +}; /* *---------------------------------------------------------------------- @@ -435,31 +448,73 @@ ClockGetOrParseScanFormat( /* if first time scanning - tokenize format */ if (fss->scnTok == NULL) { const char *strFmt; - register const char *p, *e; + register const char *p, *e, *cp, *word_start = NULL; + + Tcl_MutexLock(&ClockFmtMutex); fss->scnTokC = CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; fss->scnTok = - tok = ckalloc(sizeof(**tok) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); - (*tok)->type = CTOKT_EOB; + tok = ckalloc(sizeof(*tok) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); + *tok = NULL; strFmt = TclGetString(formatObj); for (e = p = strFmt, e += formatObj->length; p != e; p++) { switch (*p) { case '%': - if (p+1 >= e) - goto word_tok; - AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + if (p+1 >= e) { + word_start = p; + continue; + } p++; - // *tok = + /* try to find modifier: */ + switch (*p) { + case '%': + word_start = p-1; + continue; + break; + case 'E': + goto ext_tok_E; + break; + case 'O': + goto ext_tok_O; + break; + default: + cp = strchr(ScnSTokenMapChars, *p); + if (!cp || *cp == '\0') { + word_start = p-1; + continue; + } + *tok = &ScnSTokenMap[cp - ScnSTokenMapChars]; + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + break; + } break; case ' ': + cp = strchr(ScnSpecTokenMapChars, *p); + if (!cp || *cp == '\0') { + p--; + goto word_tok; + } + *tok = &ScnSpecTokenMap[cp - ScnSpecTokenMapChars]; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); - // *tok = break; default: word_tok: - break; + + continue; } + + continue; +ext_tok_E: + +ext_tok_O: + + /*******************/ + continue; + } + +done: + Tcl_MutexUnlock(&ClockFmtMutex); } return fss->scnTok; @@ -478,11 +533,16 @@ ClockScan( { ClockScanToken **tok; - if (ClockGetOrParseScanFormat(interp, opts->formatObj) == NULL) { + if ((tok = ClockGetOrParseScanFormat(interp, opts->formatObj)) == NULL) { return TCL_ERROR; } - // Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)fss)); + //*********************************** + + Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)tok)); + return TCL_OK; + + return TCL_ERROR; } diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 7994428..969e279 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -28,8 +28,16 @@ proc _test_get_commands {lst} { proc test-scan {{reptime 1000}} { foreach _(c) [_test_get_commands { # Scan : date - #{clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} - #{**STOP** : Wed Nov 25 01:00:00 CET 2015} + {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} + {clock scan "1111" -format "%d%m%y" -base 0 -gmt 1} + {**STOP** : Wed Nov 25 01:00:00 CET 2015} + # Scan : long format test (allock chain) + {clock scan "25.11.2015" -format "%d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y" -base 0 -gmt 1} + # Scan : dynamic, very long format test (create obj representation, allock chain, GC, etc): + {clock scan "25.11.2015" -format [string repeat "[incr i] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + # Scan : again: + {clock scan "25.11.2015" -format [string repeat "[incr i -1] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + # FreeScan : relative date {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} # FreeScan : relative date with relative weekday -- cgit v0.12 From a3c42aef3efed25bc18881155ac08426831649dd Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:15:36 +0000 Subject: [temp-commit]: clock scan tokenizer logic ready (still needs many rules) caching extended (currentYearCentury, yearOfCenturySwitch, lastBaseDate ...) --- generic/tclClock.c | 69 +++++++++++---- generic/tclClockFmt.c | 218 +++++++++++++++++++++++++++++++++++++++------- generic/tclDate.c | 1 - generic/tclDate.h | 88 ++++++++++++------- generic/tclGetDate.y | 1 - tests-perf/clock.perf.tcl | 98 ++++++++++++++++----- 6 files changed, 372 insertions(+), 103 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index e00d6a2..2e7b854 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -117,6 +117,8 @@ typedef struct ClockClientData { Tcl_Obj **literals; /* Pool of object literals. */ /* Cache for current clock parameters, imparted via "configure" */ unsigned long LastTZEpoch; + int currentYearCentury; + int yearOfCenturySwitch; Tcl_Obj *SystemTimeZone; Tcl_Obj *SystemSetupTZData; Tcl_Obj *GMTSetupTimeZone; @@ -126,6 +128,9 @@ typedef struct ClockClientData { Tcl_Obj *LastUnnormSetupTimeZone; Tcl_Obj *LastSetupTimeZone; Tcl_Obj *LastSetupTZData; + /* Cache for last base (fast convert if base/tz not changed) */ + Tcl_Obj *lastBaseTimeZone; + TclDateFields lastBaseDate; /* /* [SB] TODO: back-port (from tclSE) the same date caching ... * Cache for last date (fast convert if date parsed was the same) * / @@ -325,6 +330,8 @@ TclClockInit( Tcl_IncrRefCount(data->literals[i]); } data->LastTZEpoch = 0; + data->currentYearCentury = -1; + data->yearOfCenturySwitch = -1; data->SystemTimeZone = NULL; data->SystemSetupTZData = NULL; data->GMTSetupTimeZone = NULL; @@ -335,6 +342,8 @@ TclClockInit( data->LastSetupTimeZone = NULL; data->LastSetupTZData = NULL; + data->lastBaseTimeZone = NULL; + /* * Install the commands. */ @@ -368,6 +377,8 @@ ClockConfigureClear( ClockClientData *data) { data->LastTZEpoch = 0; + data->currentYearCentury = -1; + data->yearOfCenturySwitch = -1; Tcl_UnsetObjRef(data->SystemTimeZone); Tcl_UnsetObjRef(data->SystemSetupTZData); Tcl_UnsetObjRef(data->GMTSetupTimeZone); @@ -708,11 +719,16 @@ ClockCurrentYearCentury( { ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; - int year = 2000; + int year = dataPtr->currentYearCentury; - Tcl_Obj * yearObj = Tcl_ObjGetVar2(interp, - literals[LIT_CURRENTYEARCENTURY], NULL, TCL_LEAVE_ERR_MSG); - Tcl_GetIntFromObj(NULL, yearObj, &year); + if (year == -1) { + Tcl_Obj * yearObj; + year = 2000; + yearObj = Tcl_ObjGetVar2(interp, + literals[LIT_CURRENTYEARCENTURY], NULL, TCL_LEAVE_ERR_MSG); + Tcl_GetIntFromObj(NULL, yearObj, &year); + dataPtr->currentYearCentury = year; + } return year; } inline int @@ -722,11 +738,16 @@ ClockGetYearOfCenturySwitch( { ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; - int year = 37; - - Tcl_Obj * yearObj = Tcl_ObjGetVar2(interp, - literals[LIT_YEAROFCENTURYSWITCH], NULL, TCL_LEAVE_ERR_MSG); - Tcl_GetIntFromObj(NULL, yearObj, &year); + int year = dataPtr->yearOfCenturySwitch; + + if (year == -1) { + Tcl_Obj * yearObj; + year = 37; + yearObj = Tcl_ObjGetVar2(interp, + literals[LIT_YEAROFCENTURYSWITCH], NULL, TCL_LEAVE_ERR_MSG); + Tcl_GetIntFromObj(NULL, yearObj, &year); + dataPtr->yearOfCenturySwitch = year; + } return year; } @@ -2557,12 +2578,27 @@ ClockScanObjCmd( if (yydate.tzData == NULL) { goto done; } - yydate.seconds = baseVal; - if (ClockGetDateFields(interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) - != TCL_OK) { - goto done; + Tcl_SetObjRef(yydate.tzName, opts.timezoneObj); + + /* check cached */ + if ( dataPtr->lastBaseTimeZone == opts.timezoneObj + && dataPtr->lastBaseDate.seconds == baseVal) { + memcpy(&yydate, &dataPtr->lastBaseDate, ClockCacheableDateFieldsSize); + } else { + /* extact fields from base */ + yydate.seconds = baseVal; + if (ClockGetDateFields(interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) + != TCL_OK) { + goto done; + } + /* cache last base */ + memcpy(&dataPtr->lastBaseDate, &yydate, ClockCacheableDateFieldsSize); + dataPtr->lastBaseTimeZone = opts.timezoneObj; } + /* seconds are in localSeconds (relative base date), so reset time here */ + yyHour = 0; yyMinutes = 0; yySeconds = 0; yyMeridian = MER24; + /* If free scan */ if (opts.formatObj == NULL) { /* Use compiled version of FreeScan - */ @@ -2593,7 +2629,7 @@ ClockScanObjCmd( else { /* Use compiled version of Scan - */ - ret = ClockScan(clientData, interp, &yydate, objv[1], &opts); + ret = ClockScan(clientData, interp, info, objv[1], &opts); } if (ret != TCL_OK) { @@ -2710,6 +2746,9 @@ ClockFreeScan( if (yydate.tzData == NULL) { goto done; } + + Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); + } /* on demand (lazy) assemble julianDay using new year, month, etc. */ @@ -2719,8 +2758,6 @@ ClockFreeScan( * Assemble date, time, zone into seconds-from-epoch */ - Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); - if (yyHaveTime == -1) { yySeconds = 0; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 93416af..b074681 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -400,35 +400,48 @@ Tcl_GetClockFrmScnFromObj( (tok) = (chain) + (tokCnt); \ (tokCnt) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ } \ - *(tok) = NULL; + memset(tok, 0, sizeof(*(tok))); const char *ScnSTokenMapChars = "dmyYHMS"; -static ClockScanToken ScnSTokenMap[] = { - {CTOKT_DIGIT, 1, 2, 0}, - {CTOKT_DIGIT, 1, 2, 0}, - {CTOKT_DIGIT, 1, 2, 0}, - {CTOKT_DIGIT, 1, 4, 0}, - {CTOKT_DIGIT, 1, 2, 0}, - {CTOKT_DIGIT, 1, 2, 0}, - {CTOKT_DIGIT, 1, 2, 0}, +static ClockScanTokenMap ScnSTokenMap[] = { + {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.dayOfMonth), + NULL}, + {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.month), + NULL}, + {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.year), + NULL}, + {CTOKT_DIGIT, CLF_DATE, 1, 4, TclOffset(DateInfo, date.year), + NULL}, + {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.hour), + NULL}, + {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.minutes), + NULL}, + {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.secondOfDay), + NULL}, }; const char *ScnSpecTokenMapChars = - " %"; -static ClockScanToken ScnSpecTokenMap[] = { - {CTOKT_SPACE, 1, 0xffff, 0}, + " "; +static ClockScanTokenMap ScnSpecTokenMap[] = { + {CTOKT_SPACE, 0, 1, 0xffff, 0, + NULL}, +}; + +static ClockScanTokenMap ScnWordTokenMap = { + CTOKT_WORD, 0, 1, 0, 0, + NULL }; /* *---------------------------------------------------------------------- */ -ClockScanToken ** +ClockScanToken * ClockGetOrParseScanFormat( Tcl_Interp *interp, /* Tcl interpreter */ Tcl_Obj *formatObj) /* Format container */ { ClockFmtScnStorage *fss; - ClockScanToken **tok; + ClockScanToken *tok; if (formatObj->typePtr != &ClockFmtObjType) { if (ClockFmtObj_SetFromAny(interp, formatObj) != TCL_OK) { @@ -448,27 +461,30 @@ ClockGetOrParseScanFormat( /* if first time scanning - tokenize format */ if (fss->scnTok == NULL) { const char *strFmt; - register const char *p, *e, *cp, *word_start = NULL; + register const char *p, *e, *cp; Tcl_MutexLock(&ClockFmtMutex); fss->scnTokC = CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; fss->scnTok = tok = ckalloc(sizeof(*tok) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); - *tok = NULL; + memset(tok, 0, sizeof(*(tok))); strFmt = TclGetString(formatObj); for (e = p = strFmt, e += formatObj->length; p != e; p++) { switch (*p) { case '%': if (p+1 >= e) { - word_start = p; - continue; + goto word_tok; } p++; /* try to find modifier: */ switch (*p) { case '%': - word_start = p-1; + /* begin new word token - don't join with previous word token, + * because current mapping should be "...%%..." -> "...%..." */ + tok->map = &ScnWordTokenMap; + tok->tokWord.start = tok->tokWord.end = p; + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); continue; break; case 'E': @@ -480,10 +496,24 @@ ClockGetOrParseScanFormat( default: cp = strchr(ScnSTokenMapChars, *p); if (!cp || *cp == '\0') { - word_start = p-1; - continue; + p--; + goto word_tok; + } + tok->map = &ScnSTokenMap[cp - ScnSTokenMapChars]; + /* calculate look ahead value by standing together tokens */ + if (tok > fss->scnTok) { + ClockScanToken *prevTok = tok - 1; + unsigned int lookAhead = tok->map->minSize; + + while (prevTok >= fss->scnTok) { + if (prevTok->map->type != tok->map->type) { + break; + } + prevTok->lookAhead += lookAhead; + prevTok--; + } } - *tok = &ScnSTokenMap[cp - ScnSTokenMapChars]; + /* next token */ AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); break; } @@ -494,18 +524,33 @@ ClockGetOrParseScanFormat( p--; goto word_tok; } - *tok = &ScnSpecTokenMap[cp - ScnSpecTokenMapChars]; + tok->map = &ScnSpecTokenMap[cp - ScnSpecTokenMapChars]; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); break; default: word_tok: - - continue; + if (1) { + ClockScanToken *wordTok = tok; + if (tok > fss->scnTok && (tok-1)->map == &ScnWordTokenMap) { + wordTok = tok-1; + } + wordTok->tokWord.end = p; + if (wordTok == tok) { + wordTok->tokWord.start = p; + wordTok->map = &ScnWordTokenMap; + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + } + continue; + } } continue; + ext_tok_E: + /*******************/ + continue; + ext_tok_O: /*******************/ @@ -527,23 +572,134 @@ int ClockScan( ClientData clientData, /* Client data containing literal pool */ Tcl_Interp *interp, /* Tcl interpreter */ - TclDateFields *date, /* Date fields used for converting */ + register DateInfo *info, /* Date fields used for parsing & converting */ Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { - ClockScanToken **tok; + ClockScanToken *tok; + ClockScanTokenMap *map; + register const char *p, *x, *end; + unsigned short int flags = 0; + int ret = TCL_ERROR; if ((tok = ClockGetOrParseScanFormat(interp, opts->formatObj)) == NULL) { return TCL_ERROR; } + + /* prepare parsing */ + + yyMeridian = MER24; + + /* bypass spaces at begin of string */ + + p = TclGetString(strObj); + end = p + strObj->length; + while (p < end && isspace(UCHAR(*p))) { + p++; + } + info->dateStart = yyInput = p; + + /* parse string */ + for (; tok->map != NULL; yyInput = p, tok++) { + map = tok->map; + switch (map->type) + { + case CTOKT_DIGIT: + if (1) { + unsigned int val = 0; + int size = map->maxSize; + /* greedy find digits (look forward), corresponding pre-calculated lookAhead */ + size += tok->lookAhead; + x = yyInput + size; + while (isdigit(UCHAR(*p)) && p < x) { p++; }; + /* consider reserved (lookAhead) for next tokens */ + p -= tok->lookAhead; + size = p - yyInput; + if (size < map->minSize) { + /* missing input -> error */ + goto done; + } + /* string 2 number */ + p = yyInput; x = p + size; + while (p < x) { + val = val * 10 + (*p++ - '0'); + } + /* put number into info by offset */ + *(time_t *)(((char *)info) + map->offs) = val; + flags |= map->flags; + } + break; + case CTOKT_SPACE: + while (p < end && isspace(UCHAR(*p))) { + p++; + } + break; + case CTOKT_WORD: + x = tok->tokWord.start; + if (x == tok->tokWord.end) { /* single char word */ + if (*p != *x) { + /* no match -> error */ + goto done; + } + p++; + continue; + } + /* multi-char word */ + while (p < end && x < tok->tokWord.end && *p++ == *x++) {}; + if (x < tok->tokWord.end) { + /* no match -> error */ + goto done; + } + break; + } + } - //*********************************** + /* ignore spaces at end */ + while (p < end && isspace(UCHAR(*p))) { + p++; + } + /* check end was reached */ + if (p < end) { + /* something after last token - wrong format */ + goto done; + } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj((Tcl_WideInt)tok)); - return TCL_OK; + /* invalidate result */ + if (flags & CLF_DATE) { + yydate.julianDay = CL_INVALIDATE; + + if (yyYear < 100) { + if (yyYear >= ClockGetYearOfCenturySwitch(clientData, interp)) { + yyYear -= 100; + } + yyYear += ClockCurrentYearCentury(clientData, interp); + } + yydate.era = CE; + if (!(flags & CLF_TIME)) { + yydate.localSeconds = 0; + } + } + + if (flags & CLF_TIME) { + yySeconds = ToSeconds(yyHour, yyMinutes, + yySeconds, yyMeridian); + } else { + yySeconds = yydate.localSeconds % 86400; + } + + ret = TCL_OK; + +done: + + if (ret != TCL_OK) { + Tcl_SetResult(interp, + "input string does not match supplied format", TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); + return ret; + } - return TCL_ERROR; + return ret; } diff --git a/generic/tclDate.c b/generic/tclDate.c index a47f43d..97d13b4 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2691,7 +2691,6 @@ TclClockFreeScan( yyHaveDate = 0; yyHaveTime = 0; - yyHour = 0; yyMinutes = 0; yySeconds = 0; yyMeridian = MER24; yyHaveZone = 0; yyTimezone = 0; yyDSTmode = DSTmaybe; diff --git a/generic/tclDate.h b/generic/tclDate.h index 49420a2..4b0b47e 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -22,60 +22,64 @@ typedef struct TclDateFields { * epoch */ Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds * from the Posix epoch */ - int tzOffset; /* Time zone offset in seconds east of + time_t tzOffset; /* Time zone offset in seconds east of * Greenwich */ + time_t julianDay; /* Julian Day Number in local time zone */ + enum {BCE=1, CE=0} era; /* Era */ + time_t gregorian; /* Flag == 1 if the date is Gregorian */ + time_t year; /* Year of the era */ + time_t dayOfYear; /* Day of the year (1 January == 1) */ + time_t month; /* Month number */ + time_t dayOfMonth; /* Day of the month */ + time_t iso8601Year; /* ISO8601 week-based year */ + time_t iso8601Week; /* ISO8601 week number */ + time_t dayOfWeek; /* Day of the week */ + time_t hour; /* Hours of day (in-between time only calculation) */ + time_t minutes; /* Minutes of day (in-between time only calculation) */ + time_t secondOfDay; /* Seconds of day (in-between time only calculation) */ + Tcl_Obj *tzName; /* Time zone name (if set the refCount is incremented) */ Tcl_Obj *tzData; /* Time zone data object (internally referenced) */ - int julianDay; /* Julian Day Number in local time zone */ - enum {BCE=1, CE=0} era; /* Era */ - int gregorian; /* Flag == 1 if the date is Gregorian */ - int year; /* Year of the era */ - int dayOfYear; /* Day of the year (1 January == 1) */ - int month; /* Month number */ - int dayOfMonth; /* Day of the month */ - int iso8601Year; /* ISO8601 week-based year */ - int iso8601Week; /* ISO8601 week number */ - int dayOfWeek; /* Day of the week */ - int hour; /* Hours of day (in-between time only calculation) */ - int minutes; /* Minutes of day (in-between time only calculation) */ - int secondOfDay; /* Seconds of day (in-between time only calculation) */ } TclDateFields; +#define ClockCacheableDateFieldsSize \ + TclOffset(TclDateFields, tzName) + /* * Structure contains return parsed fields. */ typedef struct DateInfo { + const char *dateStart; + const char *dateInput; TclDateFields date; - int dateHaveDate; + time_t dateHaveDate; - int dateMeridian; - int dateHaveTime; + time_t dateMeridian; + time_t dateHaveTime; time_t dateTimezone; - int dateDSTmode; - int dateHaveZone; + time_t dateDSTmode; + time_t dateHaveZone; time_t dateRelMonth; time_t dateRelDay; time_t dateRelSeconds; - int dateHaveRel; + time_t dateHaveRel; time_t dateMonthOrdinalIncr; time_t dateMonthOrdinal; - int dateHaveOrdinalMonth; + time_t dateHaveOrdinalMonth; time_t dateDayOrdinal; time_t dateDayNumber; - int dateHaveDay; + time_t dateHaveDay; - const char *dateStart; - const char *dateInput; time_t *dateRelPointer; - int dateDigitCount; + time_t dateDigitCount; Tcl_Obj* messages; /* Error messages */ const char* separatrix; /* String separating messages */ @@ -140,8 +144,19 @@ typedef enum _MERIDIAN { #define CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE 12 +typedef struct ClockScanToken ClockScanToken; + + +typedef int ClockScanTokenProc( + DateInfo *info, + ClockScanToken *tok); + + +#define CLF_DATE (1 << 2) +#define CLF_TIME (1 << 3) + typedef enum _CLCKTOK_TYPE { - CTOKT_EOB=0, CTOKT_DIGIT, CTOKT_SPACE + CTOKT_DIGIT = 1, CTOKT_SPACE, CTOKT_WORD } CLCKTOK_TYPE; typedef struct ClockFmtScnStorage ClockFmtScnStorage; @@ -150,18 +165,29 @@ typedef struct ClockFormatToken { CLCKTOK_TYPE type; } ClockFormatToken; -typedef struct ClockScanToken { +typedef struct ClockScanTokenMap { unsigned short int type; + unsigned short int flags; unsigned short int minSize; unsigned short int maxSize; unsigned short int offs; + ClockScanTokenProc *parser; +} ClockScanTokenMap; + +typedef struct ClockScanToken { + ClockScanTokenMap *map; + unsigned int lookAhead; + struct { + const char *start; + const char *end; + } tokWord; } ClockScanToken; typedef struct ClockFmtScnStorage { int objRefCount; /* Reference count shared across threads */ - ClockScanToken **scnTok; + ClockScanToken *scnTok; unsigned int scnTokC; - ClockFormatToken **fmtTok; + ClockFormatToken *fmtTok; unsigned int fmtTokC; #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 ClockFmtScnStorage *nextPtr; @@ -191,8 +217,8 @@ MODULE_SCOPE ClockFmtScnStorage * Tcl_Obj *objPtr); MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, - TclDateFields *date, Tcl_Obj *strObj, - ClockFmtScnCmdArgs *opts); + register DateInfo *info, + Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); /* * Other externals. diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 571b7df..54087ca 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -902,7 +902,6 @@ TclClockFreeScan( yyHaveDate = 0; yyHaveTime = 0; - yyHour = 0; yyMinutes = 0; yySeconds = 0; yyMeridian = MER24; yyHaveZone = 0; yyTimezone = 0; yyDSTmode = DSTmaybe; diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 969e279..93a78e4 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -25,19 +25,82 @@ proc _test_get_commands {lst} { regsub -all {(?:^|\n)[ \t]*(\#[^\n]*)(?=\n\s*[\{\#])} $lst "\n{\\1}" } +proc _test_out_total {} { + upvar _ _ + + puts [string repeat ** 40] + puts [format "Total %d cases in %.2f sec.:" [llength $_(itcnt)] [expr {[llength $_(itcnt)] * $_(reptime) / 1000.0}]] + lset _(m) 0 [format %.6f [expr [join $_(ittm) +]]] + lset _(m) 2 [expr [join $_(itcnt) +]] + lset _(m) 4 [expr {[lindex $_(m) 2] / ([llength $_(itcnt)] * $_(reptime) / 1000.0)}] + puts $_(m) + puts "Average:" + lset _(m) 0 [format %.6f [expr {[lindex $_(m) 0] / [llength $_(itcnt)]}]] + lset _(m) 2 [expr {[lindex $_(m) 2] / [llength $_(itcnt)]}] + lset _(m) 4 [expr {[lindex $_(m) 2] * (1000 / $_(reptime))}] + puts $_(m) + puts [string repeat ** 40] + puts "" +} + +proc _test_run {reptime lst {outcmd {puts {$_(r)}}}} { + upvar _ _ + array set _ [list ittm {} itcnt {} itrate {} reptime $reptime] + + foreach _(c) [_test_get_commands $lst] { + puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" + if {[regexp {\s*\#} $_(c)]} continue + set _(r) [if 1 $_(c)] + if {$outcmd ne {}} $outcmd + puts [set _(m) [timerate $_(c) $reptime]] + lappend _(ittm) [lindex $_(m) 0] + lappend _(itcnt) [lindex $_(m) 2] + lappend _(itrate) [lindex $_(m) 4] + puts "" + } + _test_out_total +} + proc test-scan {{reptime 1000}} { - foreach _(c) [_test_get_commands { - # Scan : date + _test_run $reptime { + # Scan : date (in gmt) {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} + # Scan : date (system time zone, with base) + {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0} + # Scan : date (system time zone, without base) + {clock scan "25.11.2015" -format "%d.%m.%Y"} + # Scan : greedy match + {clock scan "111" -format "%d%m%y" -base 0 -gmt 1} {clock scan "1111" -format "%d%m%y" -base 0 -gmt 1} - {**STOP** : Wed Nov 25 01:00:00 CET 2015} - # Scan : long format test (allock chain) - {clock scan "25.11.2015" -format "%d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y" -base 0 -gmt 1} - # Scan : dynamic, very long format test (create obj representation, allock chain, GC, etc): - {clock scan "25.11.2015" -format [string repeat "[incr i] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} - # Scan : again: - {clock scan "25.11.2015" -format [string repeat "[incr i -1] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + {clock scan "11111" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "111111" -format "%d%m%y" -base 0 -gmt 1} + + # Scan : date-time (in gmt) + {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S" -base 0 -gmt 1} + # Scan : date-time (system time zone with base) + {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S" -base 0} + # Scan : date-time (system time zone without base) + {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S"} + # Scan : dynamic format (cacheable) + {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} + + # Scan : zone only + {clock scan "CET" -format "%z"} + {clock scan "EST" -format "%z"} + #{**STOP** : Wed Nov 25 01:00:00 CET 2015} + + # # Scan : long format test (allock chain) + # {clock scan "25.11.2015" -format "%d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y" -base 0 -gmt 1} + # # Scan : dynamic, very long format test (create obj representation, allock chain, GC, etc): + # {clock scan "25.11.2015" -format [string repeat "[incr i] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + # # Scan : again: + # {clock scan "25.11.2015" -format [string repeat "[incr i -1] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + } {puts [clock format $_(r) -locale en]} +} + +proc test-freescan {{reptime 1000}} { + _test_run $reptime { # FreeScan : relative date {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} # FreeScan : relative date with relative weekday @@ -74,17 +137,11 @@ proc test-scan {{reptime 1000}} { {clock scan "19:18:30 MST" -base 148863600 -gmt 1 clock scan "19:18:30 EST" -base 148863600 } - }] { - puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" - if {[regexp {\s*\#} $_(c)]} continue - puts [clock format [if 1 $_(c)] -locale en] - puts [timerate $_(c) $reptime] - puts "" - } + } {puts [clock format $_(r) -locale en]} } proc test-other {{reptime 1000}} { - foreach _(c) [_test_get_commands { + _test_run $reptime { # Bad zone {catch {clock scan "1 day" -timezone BAD_ZONE -locale en}} **STOP** @@ -92,18 +149,13 @@ proc test-other {{reptime 1000}} { {set i 0; time { clock scan "[incr i] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} # Scan : test reusability of GC objects (format is dynamic, so tcl-obj removed with last reference) {set i 50; time { clock scan "[incr i -1] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} - }] { - puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" - if {[regexp {\s*\#} $_(c)]} continue - puts [if 1 $_(c)] - puts [timerate $_(c) $reptime] - puts "" } } proc test {{reptime 1000}} { puts "" test-scan $reptime + #test-freescan $reptime test-other $reptime puts \n**OK** -- cgit v0.12 From 940c0805c073986447f70bc21a1db6e576911548 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:19:01 +0000 Subject: [temp-commit]: code review, DST-hole mistake by scan with relative time resolved; caching of UTC2Local / Local2UTC cherry picked --- generic/tclClock.c | 394 ++++++++++++++++++++++++++++------------------ generic/tclClockFmt.c | 220 +++++++++++++++++++++----- generic/tclDate.h | 84 +++++++++- library/clock.tcl | 13 +- tests-perf/clock.perf.tcl | 50 +++++- tests/clock.test | 87 ++++++++++ 6 files changed, 638 insertions(+), 210 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 2e7b854..7cc5d86 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -26,22 +26,6 @@ #endif /* - * Constants - */ - -#define JULIAN_DAY_POSIX_EPOCH 2440588 -#define GREGORIAN_CHANGE_DATE 2361222 -#define SECONDS_PER_DAY 86400 -#define JULIAN_SEC_POSIX_EPOCH (((Tcl_WideInt) JULIAN_DAY_POSIX_EPOCH) \ - * SECONDS_PER_DAY) -#define FOUR_CENTURIES 146097 /* days */ -#define JDAY_1_JAN_1_CE_JULIAN 1721424 -#define JDAY_1_JAN_1_CE_GREGORIAN 1721426 -#define ONE_CENTURY_GREGORIAN 36524 /* days */ -#define FOUR_YEARS 1461 /* days */ -#define ONE_YEAR 365 /* days */ - -/* * Table of the days in each month, leap and common years */ @@ -72,8 +56,6 @@ typedef enum ClockLiteral { LIT_MONTH, LIT_SECONDS, LIT_TZNAME, LIT_TZOFFSET, LIT_YEAR, - LIT_CURRENTYEARCENTURY, - LIT_YEAROFCENTURYSWITCH, LIT_TZDATA, LIT_GETSYSTEMTIMEZONE, LIT_SETUPTIMEZONE, @@ -96,8 +78,6 @@ static const char *const Literals[] = { "month", "seconds", "tzName", "tzOffset", "year", - "::tcl::clock::CurrentYearCentury", - "::tcl::clock::YearOfCenturySwitch", "::tcl::clock::TZData", "::tcl::clock::GetSystemTimeZone", "::tcl::clock::SetupTimeZone", @@ -106,41 +86,6 @@ static const char *const Literals[] = { #endif }; -#define CurrentYearCentury 2000 - -/* - * Structure containing the client data for [clock] - */ - -typedef struct ClockClientData { - size_t refCount; /* Number of live references. */ - Tcl_Obj **literals; /* Pool of object literals. */ - /* Cache for current clock parameters, imparted via "configure" */ - unsigned long LastTZEpoch; - int currentYearCentury; - int yearOfCenturySwitch; - Tcl_Obj *SystemTimeZone; - Tcl_Obj *SystemSetupTZData; - Tcl_Obj *GMTSetupTimeZone; - Tcl_Obj *GMTSetupTZData; - Tcl_Obj *AnySetupTimeZone; - Tcl_Obj *AnySetupTZData; - Tcl_Obj *LastUnnormSetupTimeZone; - Tcl_Obj *LastSetupTimeZone; - Tcl_Obj *LastSetupTZData; - /* Cache for last base (fast convert if base/tz not changed) */ - Tcl_Obj *lastBaseTimeZone; - TclDateFields lastBaseDate; - /* - /* [SB] TODO: back-port (from tclSE) the same date caching ... - * Cache for last date (fast convert if date parsed was the same) * / - struct { - DateInfo yy; - TclDateFields date; - } lastDate; - */ -} ClockClientData; - static const char *const eras[] = { "CE", "BCE", NULL }; /* @@ -161,13 +106,13 @@ TCL_DECLARE_MUTEX(clockMutex) * Function prototypes for local procedures in this file: */ -static int ConvertUTCToLocal(Tcl_Interp *, +static int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, TclDateFields *, Tcl_Obj *, int); static int ConvertUTCToLocalUsingTable(Tcl_Interp *, TclDateFields *, int, Tcl_Obj *const[]); static int ConvertUTCToLocalUsingC(Tcl_Interp *, TclDateFields *, int); -static int ConvertLocalToUTC(Tcl_Interp *, +static int ConvertLocalToUTC(ClientData clientData, Tcl_Interp *, TclDateFields *, Tcl_Obj *, int); static int ConvertLocalToUTCUsingTable(Tcl_Interp *, TclDateFields *, int, Tcl_Obj *const[]); @@ -191,9 +136,9 @@ static int ClockConvertlocaltoutcObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ClockGetDateFields(Tcl_Interp *interp, - TclDateFields *fields, Tcl_Obj *tzdata, - int changeover); +static int ClockGetDateFields(ClientData clientData, + Tcl_Interp *interp, TclDateFields *fields, + Tcl_Obj *tzdata, int changeover); static int ClockGetdatefieldsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -330,8 +275,8 @@ TclClockInit( Tcl_IncrRefCount(data->literals[i]); } data->LastTZEpoch = 0; - data->currentYearCentury = -1; - data->yearOfCenturySwitch = -1; + data->currentYearCentury = ClockDefaultYearCentury; + data->yearOfCenturySwitch = ClockDefaultCenturySwitch; data->SystemTimeZone = NULL; data->SystemSetupTZData = NULL; data->GMTSetupTimeZone = NULL; @@ -342,7 +287,10 @@ TclClockInit( data->LastSetupTimeZone = NULL; data->LastSetupTZData = NULL; - data->lastBaseTimeZone = NULL; + data->lastBase.TimeZone = NULL; + data->UTC2Local.tzData = NULL; + data->UTC2Local.tzName = NULL; + data->Local2UTC.tzData = NULL; /* * Install the commands. @@ -377,8 +325,6 @@ ClockConfigureClear( ClockClientData *data) { data->LastTZEpoch = 0; - data->currentYearCentury = -1; - data->yearOfCenturySwitch = -1; Tcl_UnsetObjRef(data->SystemTimeZone); Tcl_UnsetObjRef(data->SystemSetupTZData); Tcl_UnsetObjRef(data->GMTSetupTimeZone); @@ -388,6 +334,11 @@ ClockConfigureClear( Tcl_UnsetObjRef(data->LastUnnormSetupTimeZone); Tcl_UnsetObjRef(data->LastSetupTimeZone); Tcl_UnsetObjRef(data->LastSetupTZData); + + Tcl_UnsetObjRef(data->lastBase.TimeZone); + Tcl_UnsetObjRef(data->UTC2Local.tzData); + Tcl_UnsetObjRef(data->UTC2Local.tzName); + Tcl_UnsetObjRef(data->Local2UTC.tzData); } static void @@ -397,7 +348,8 @@ ClockDeleteCmdProc( ClockClientData *data = clientData; int i; - if (data->refCount-- <= 1) { + data->refCount--; + if (data->refCount == 0) { for (i = 0; i < LIT__END; ++i) { Tcl_DecrRefCount(data->literals[i]); } @@ -471,10 +423,12 @@ ClockConfigureObjCmd( static const char *const options[] = { "-system-tz", "-setup-tz", "-clear", + "-year-century", "-century-switch", NULL }; enum optionInd { CLOCK_SYSTEM_TZ, CLOCK_SETUP_TZ, CLOCK_CLEAR_CACHE, + CLOCK_YEAR_CENTURY, CLOCK_CENTURY_SWITCH, CLOCK_SETUP_GMT, CLOCK_SETUP_NOP }; int optionIndex; /* Index of an option. */ @@ -542,6 +496,32 @@ ClockConfigureObjCmd( Tcl_SetObjResult(interp, dataPtr->LastSetupTimeZone); } break; + case CLOCK_YEAR_CENTURY: + if (i+1 < objc) { + int year; + if (TclGetIntFromObj(interp, objv[i+1], &year) != TCL_OK) { + return TCL_ERROR; + } + dataPtr->currentYearCentury = year; + Tcl_SetObjResult(interp, objv[i+1]); + continue; + } + Tcl_SetObjResult(interp, + Tcl_NewIntObj(dataPtr->currentYearCentury)); + break; + case CLOCK_CENTURY_SWITCH: + if (i+1 < objc) { + int year; + if (TclGetIntFromObj(interp, objv[i+1], &year) != TCL_OK) { + return TCL_ERROR; + } + dataPtr->yearOfCenturySwitch = year; + Tcl_SetObjResult(interp, objv[i+1]); + continue; + } + Tcl_SetObjResult(interp, + Tcl_NewIntObj(dataPtr->yearOfCenturySwitch)); + break; case CLOCK_CLEAR_CACHE: ClockConfigureClear(dataPtr); break; @@ -577,14 +557,16 @@ ClockGetTZData( /* simple caching, because almost used the tz-data of last timezone */ if (timezoneObj == dataPtr->SystemTimeZone) { - if (dataPtr->SystemSetupTZData != NULL) + if (dataPtr->SystemSetupTZData != NULL) { return dataPtr->SystemSetupTZData; + } out = &dataPtr->SystemSetupTZData; } else if (timezoneObj == dataPtr->GMTSetupTimeZone) { - if (dataPtr->GMTSetupTZData != NULL) + if (dataPtr->GMTSetupTZData != NULL) { return dataPtr->GMTSetupTZData; + } out = &dataPtr->GMTSetupTZData; } else @@ -602,11 +584,11 @@ ClockGetTZData( if (out != NULL) { Tcl_SetObjRef(*out, ret); } - Tcl_SetObjRef(dataPtr->LastSetupTZData, ret); + Tcl_SetObjRef(dataPtr->LastSetupTZData, ret); if (dataPtr->LastSetupTimeZone != timezoneObj) { Tcl_SetObjRef(dataPtr->LastSetupTimeZone, timezoneObj); Tcl_UnsetObjRef(dataPtr->LastUnnormSetupTimeZone); - } + } return ret; } /* @@ -710,49 +692,6 @@ ClockFormatNumericTimeZone(int z) { /* *---------------------------------------------------------------------- - * [SB] TODO: make constans cacheable (once per second, etc.) ... - */ -inline int -ClockCurrentYearCentury( - ClientData clientData, /* Opaque pointer to literal pool, etc. */ - Tcl_Interp *interp) /* Tcl interpreter */ -{ - ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; - int year = dataPtr->currentYearCentury; - - if (year == -1) { - Tcl_Obj * yearObj; - year = 2000; - yearObj = Tcl_ObjGetVar2(interp, - literals[LIT_CURRENTYEARCENTURY], NULL, TCL_LEAVE_ERR_MSG); - Tcl_GetIntFromObj(NULL, yearObj, &year); - dataPtr->currentYearCentury = year; - } - return year; -} -inline int -ClockGetYearOfCenturySwitch( - ClientData clientData, /* Opaque pointer to literal pool, etc. */ - Tcl_Interp *interp) /* Tcl interpreter */ -{ - ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; - int year = dataPtr->yearOfCenturySwitch; - - if (year == -1) { - Tcl_Obj * yearObj; - year = 37; - yearObj = Tcl_ObjGetVar2(interp, - literals[LIT_YEAROFCENTURYSWITCH], NULL, TCL_LEAVE_ERR_MSG); - Tcl_GetIntFromObj(NULL, yearObj, &year); - dataPtr->yearOfCenturySwitch = year; - } - return year; -} - -/* - *---------------------------------------------------------------------- * * ClockConvertlocaltoutcObjCmd -- * @@ -816,7 +755,7 @@ ClockConvertlocaltoutcObjCmd( if ((Tcl_GetWideIntFromObj(interp, secondsObj, &fields.localSeconds) != TCL_OK) || (TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK) - || ConvertLocalToUTC(interp, &fields, objv[2], changeover)) { + || ConvertLocalToUTC(clientData, interp, &fields, objv[2], changeover)) { return TCL_ERROR; } @@ -911,8 +850,8 @@ ClockGetdatefieldsObjCmd( /* Extract fields */ - if (ClockGetDateFields(interp, &fields, objv[2], changeover) - != TCL_OK) { + if (ClockGetDateFields(clientData, interp, &fields, objv[2], + changeover) != TCL_OK) { return TCL_ERROR; } @@ -957,6 +896,7 @@ ClockGetdatefieldsObjCmd( */ int ClockGetDateFields( + ClientData clientData, /* Client data of the interpreter */ Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Pointer to result fields, where * fields->seconds contains date to extract */ @@ -967,7 +907,8 @@ ClockGetDateFields( * Convert UTC time to local. */ - if (ConvertUTCToLocal(interp, fields, tzdata, changeover) != TCL_OK) { + if (ConvertUTCToLocal(clientData, interp, fields, tzdata, + changeover) != TCL_OK) { return TCL_ERROR; } @@ -1221,15 +1162,33 @@ ClockGetjuliandayfromerayearweekdayObjCmd( static int ConvertLocalToUTC( + ClientData clientData, /* Client data of the interpreter */ Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Fields of the time */ Tcl_Obj *tzdata, /* Time zone data */ int changeover) /* Julian Day of the Gregorian transition */ { + ClockClientData *dataPtr = clientData; int rowc; /* Number of rows in tzdata */ Tcl_Obj **rowv; /* Pointers to the rows */ /* + * Check cacheable conversion could be used + * (last-minute Local2UTC cache with the same TZ) + */ + if ( tzdata == dataPtr->Local2UTC.tzData + && ( fields->localSeconds == dataPtr->Local2UTC.localSeconds + || fields->localSeconds / 60 == dataPtr->Local2UTC.localSeconds / 60 + ) + && changeover == dataPtr->Local2UTC.changeover + ) { + /* the same time zone and offset (UTC time inside the last minute) */ + fields->tzOffset = dataPtr->Local2UTC.tzOffset; + fields->seconds = fields->localSeconds - fields->tzOffset; + return TCL_OK; + } + + /* * Unpack the tz data. */ @@ -1243,10 +1202,22 @@ ConvertLocalToUTC( */ if (rowc == 0) { - return ConvertLocalToUTCUsingC(interp, fields, changeover); + if (ConvertLocalToUTCUsingC(interp, fields, changeover) != TCL_OK) { + return TCL_ERROR; + }; } else { - return ConvertLocalToUTCUsingTable(interp, fields, rowc, rowv); + if (ConvertLocalToUTCUsingTable(interp, fields, rowc, rowv) != TCL_OK) { + return TCL_ERROR; + }; } + + /* Cache the last conversion */ + Tcl_SetObjRef(dataPtr->Local2UTC.tzData, tzdata); + dataPtr->Local2UTC.localSeconds = fields->localSeconds; + dataPtr->Local2UTC.changeover = changeover; + dataPtr->Local2UTC.tzOffset = fields->tzOffset; + + return TCL_OK; } /* @@ -1321,6 +1292,40 @@ ConvertLocalToUTCUsingTable( } fields->tzOffset = have[i]; fields->seconds = fields->localSeconds - fields->tzOffset; + +#if 0 + /* + * Convert back from UTC, if local times are different - wrong local time + * (local time seems to be in between DST-hole). + */ + if (fields->tzOffset) { + + int corrOffset; + Tcl_WideInt backCompVal; + /* check DST-hole interval contains UTC time */ + Tcl_GetWideIntFromObj(NULL, cellv[0], &backCompVal); + if ( fields->seconds >= backCompVal - fields->tzOffset + && fields->seconds <= backCompVal + fields->tzOffset + ) { + row = LookupLastTransition(interp, fields->seconds, rowc, rowv); + if (row == NULL || + TclListObjGetElements(interp, row, &cellc, &cellv) != TCL_OK || + TclGetIntFromObj(interp, cellv[1], &corrOffset) != TCL_OK) { + return TCL_ERROR; + } + if (fields->localSeconds != fields->seconds + corrOffset) { + Tcl_Panic("wrong local time %ld by LocalToUTC conversion," + " local time seems to be in between DST-hole", + fields->localSeconds); + /* correcting offset * / + fields->tzOffset -= corrOffset; + fields->seconds += fields->tzOffset; + */ + } + } + } +#endif + return TCL_OK; } @@ -1424,15 +1429,34 @@ ConvertLocalToUTCUsingC( static int ConvertUTCToLocal( + ClientData clientData, /* Client data of the interpreter */ Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Fields of the time */ Tcl_Obj *tzdata, /* Time zone data */ int changeover) /* Julian Day of the Gregorian transition */ { + ClockClientData *dataPtr = clientData; int rowc; /* Number of rows in tzdata */ Tcl_Obj **rowv; /* Pointers to the rows */ /* + * Check cacheable conversion could be used + * (last-minute UTC2Local cache with the same TZ) + */ + if ( tzdata == dataPtr->UTC2Local.tzData + && ( fields->seconds == dataPtr->UTC2Local.seconds + || fields->seconds / 60 == dataPtr->UTC2Local.seconds / 60 + ) + && changeover == dataPtr->UTC2Local.changeover + ) { + /* the same time zone and offset (UTC time inside the last minute) */ + Tcl_SetObjRef(fields->tzName, dataPtr->UTC2Local.tzName); + fields->tzOffset = dataPtr->UTC2Local.tzOffset; + fields->localSeconds = fields->seconds + fields->tzOffset; + return TCL_OK; + } + + /* * Unpack the tz data. */ @@ -1446,10 +1470,22 @@ ConvertUTCToLocal( */ if (rowc == 0) { - return ConvertUTCToLocalUsingC(interp, fields, changeover); + if (ConvertUTCToLocalUsingC(interp, fields, changeover) != TCL_OK) { + return TCL_ERROR; + } } else { - return ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv); + if (ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv) != TCL_OK) { + return TCL_ERROR; + } } + + /* Cache the last conversion */ + Tcl_SetObjRef(dataPtr->UTC2Local.tzData, tzdata); + dataPtr->UTC2Local.seconds = fields->seconds; + dataPtr->UTC2Local.changeover = changeover; + dataPtr->UTC2Local.tzOffset = fields->tzOffset; + Tcl_SetObjRef(dataPtr->UTC2Local.tzName, fields->tzName); + return TCL_OK; } /* @@ -2373,6 +2409,7 @@ _ClockParseFmtScnArgs( resOpts->localeObj = NULL; resOpts->timezoneObj = NULL; resOpts->baseObj = NULL; + resOpts->flags = 0; for (i = 2; i < objc; i+=2) { if (Tcl_GetIndexFromObj(interp, objv[i], options[forScan], "option", 0, &optionIndex) != TCL_OK) { @@ -2539,6 +2576,8 @@ ClockScanObjCmd( ret = TCL_ERROR; + info->flags = 0; + if (opts.baseObj != NULL) { if (Tcl_GetWideIntFromObj(interp, opts.baseObj, &baseVal) != TCL_OK) { return TCL_ERROR; @@ -2580,20 +2619,20 @@ ClockScanObjCmd( } Tcl_SetObjRef(yydate.tzName, opts.timezoneObj); - /* check cached */ - if ( dataPtr->lastBaseTimeZone == opts.timezoneObj - && dataPtr->lastBaseDate.seconds == baseVal) { - memcpy(&yydate, &dataPtr->lastBaseDate, ClockCacheableDateFieldsSize); + /* check base fields already cached (by TZ, last-second cache) */ + if ( dataPtr->lastBase.TimeZone == opts.timezoneObj + && dataPtr->lastBase.Date.seconds == baseVal) { + memcpy(&yydate, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); } else { /* extact fields from base */ yydate.seconds = baseVal; - if (ClockGetDateFields(interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) - != TCL_OK) { + if (ClockGetDateFields(clientData, interp, &yydate, yydate.tzData, + GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } /* cache last base */ - memcpy(&dataPtr->lastBaseDate, &yydate, ClockCacheableDateFieldsSize); - dataPtr->lastBaseTimeZone = opts.timezoneObj; + memcpy(&dataPtr->lastBase.Date, &yydate, ClockCacheableDateFieldsSize); + Tcl_SetObjRef(dataPtr->lastBase.TimeZone, opts.timezoneObj); } /* seconds are in localSeconds (relative base date), so reset time here */ @@ -2612,7 +2651,7 @@ ClockScanObjCmd( } ret = ClockFreeScan(clientData, interp, info, objv[1], &opts); } -#if 0 +#if 1 else if (1) { /* TODO: Tcled Scan proc - */ @@ -2636,24 +2675,40 @@ ClockScanObjCmd( goto done; } - /* If needed assemble julianDay using new year, month, etc. */ - if (yydate.julianDay == CL_INVALIDATE) { + if (info->flags & CLF_INVALIDATE_JULIANDAY) { GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); } - + + /* some overflow checks, if not extended */ + if (!(opts.flags & CLF_EXTENDED)) { + if (yydate.julianDay > 5373484) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "requested date too large to represent", -1)); + Tcl_SetErrorCode(interp, "CLOCK", "dateTooLarge", NULL); + ret = TCL_ERROR; + goto done; + } + } + /* Local seconds to UTC (stored in yydate.seconds) */ - yydate.localSeconds = - -210866803200L - + ( 86400 * (Tcl_WideInt)yydate.julianDay ) - + ( yySeconds % 86400 ); + if (info->flags & (CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY)) { + yydate.localSeconds = + -210866803200L + + ( SECONDS_PER_DAY * (Tcl_WideInt)yydate.julianDay ) + + ( yySeconds % SECONDS_PER_DAY ); + } - if (ConvertLocalToUTC(interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) + if (ConvertLocalToUTC(clientData, interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } + /* Increment UTC seconds with relative time */ + + yydate.seconds += yyRelSeconds; + ret = TCL_OK; done: @@ -2681,7 +2736,7 @@ ClockFreeScan( Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { - // ClockClientData *dataPtr = clientData; + ClockClientData *dataPtr = clientData; // Tcl_Obj **literals = dataPtr->literals; int ret = TCL_ERROR; @@ -2712,15 +2767,16 @@ ClockFreeScan( if (yyHaveDate) { if (yyYear < 100) { - if (yyYear >= ClockGetYearOfCenturySwitch(clientData, interp)) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { yyYear -= 100; } - yyYear += ClockCurrentYearCentury(clientData, interp); + yyYear += dataPtr->currentYearCentury; } yydate.era = CE; if (yyHaveTime == 0) { yyHaveTime = -1; } + info->flags |= CLF_INVALIDATE_JULIANDAY|CLF_INVALIDATE_SECONDS; } /* @@ -2749,22 +2805,22 @@ ClockFreeScan( Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); + info->flags |= CLF_INVALIDATE_SECONDS; } - /* on demand (lazy) assemble julianDay using new year, month, etc. */ - yydate.julianDay = CL_INVALIDATE; - /* * Assemble date, time, zone into seconds-from-epoch */ if (yyHaveTime == -1) { yySeconds = 0; + info->flags |= CLF_INVALIDATE_SECONDS; } else if (yyHaveTime) { yySeconds = ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian); + info->flags |= CLF_INVALIDATE_SECONDS; } else if ( (yyHaveDay && !yyHaveDate) @@ -2774,9 +2830,10 @@ ClockFreeScan( || yyRelDay != 0 ) ) ) { yySeconds = 0; + info->flags |= CLF_INVALIDATE_SECONDS; } else { - yySeconds = yydate.localSeconds % 86400; + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; } /* @@ -2787,16 +2844,24 @@ repeat_rel: if (yyHaveRel) { + /* + * Relative conversion normally possible in UTC time only, because + * of possible wrong local time increment if ignores in-between DST-hole. + * (see test-cases clock-34.53, clock-34.54). + * So increment date in julianDay, but time inside day in UTC (seconds). + */ + /* add months (or years in months) */ if (yyRelMonth != 0) { int m, h; /* if needed extract year, month, etc. again */ - if (yyMonth == CL_INVALIDATE) { + if (info->flags & CLF_INVALIDATE_DATE) { GetGregorianEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); GetMonthDay(&yydate); GetYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); + info->flags &= ~CLF_INVALIDATE_DATE; } /* add the requisite number of months */ @@ -2812,7 +2877,7 @@ repeat_rel: } /* on demand (lazy) assemble julianDay using new year, month, etc. */ - yydate.julianDay = CL_INVALIDATE; + info->flags |= CLF_INVALIDATE_JULIANDAY|CLF_INVALIDATE_SECONDS; yyRelMonth = 0; } @@ -2821,21 +2886,33 @@ repeat_rel: if (yyRelDay) { /* assemble julianDay using new year, month, etc. */ - if (yydate.julianDay == CL_INVALIDATE) { + if (info->flags & CLF_INVALIDATE_JULIANDAY) { GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); + info->flags &= ~CLF_INVALIDATE_JULIANDAY; } - yydate.julianDay += yyRelDay; + yydate.julianDay += yyRelDay; /* julianDay was changed, on demand (lazy) extract year, month, etc. again */ - yyMonth = CL_INVALIDATE; + info->flags |= CLF_INVALIDATE_DATE|CLF_INVALIDATE_SECONDS; yyRelDay = 0; } - /* relative time (seconds) */ - yySeconds += yyRelSeconds; - yyRelSeconds = 0; - + /* relative time (seconds), if exceeds current date, do the day conversion and + * leave rest of the increment in yyRelSeconds to add it hereafter in UTC seconds */ + if (yyRelSeconds) { + time_t newSecs = yySeconds + yyRelSeconds; + + /* if seconds increment outside of current date, increment day */ + if (newSecs / SECONDS_PER_DAY != yySeconds / SECONDS_PER_DAY) { + + yyRelDay += newSecs / SECONDS_PER_DAY; + yySeconds = 0; + yyRelSeconds = newSecs % SECONDS_PER_DAY; + + goto repeat_rel; + } + } } /* @@ -2846,10 +2923,11 @@ repeat_rel: int monthDiff; /* if needed extract year, month, etc. again */ - if (yyMonth == CL_INVALIDATE) { + if (info->flags & CLF_INVALIDATE_DATE) { GetGregorianEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); GetMonthDay(&yydate); GetYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); + info->flags &= ~CLF_INVALIDATE_DATE; } if (yyMonthOrdinalIncr > 0) { @@ -2872,6 +2950,8 @@ repeat_rel: yyRelMonth += monthDiff; yyHaveOrdinalMonth = 0; + info->flags |= CLF_INVALIDATE_JULIANDAY|CLF_INVALIDATE_SECONDS; + goto repeat_rel; } @@ -2882,8 +2962,9 @@ repeat_rel: if (yyHaveDay && !yyHaveDate) { /* if needed assemble julianDay now */ - if (yydate.julianDay == CL_INVALIDATE) { + if (info->flags & CLF_INVALIDATE_JULIANDAY) { GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); + info->flags &= ~CLF_INVALIDATE_JULIANDAY; } yydate.era = CE; @@ -2892,6 +2973,7 @@ repeat_rel: if (yyDayOrdinal > 0) { yydate.julianDay -= 7; } + info->flags |= CLF_INVALIDATE_DATE|CLF_INVALIDATE_SECONDS; } /* Free scanning completed - date ready */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index b074681..48b9b69 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -35,6 +35,66 @@ static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); * Clock scan and format facilities. */ +inline int +_str2int( + time_t *out, + register + const char *p, + const char *e, + int sign) +{ + register time_t val = 0, prev = 0; + if (sign > 0) { + while (p < e) { + val = val * 10 + (*p++ - '0'); + if (val < prev) { + return TCL_ERROR; + } + prev = val; + } + } else { + while (p < e) { + val = val * 10 - (*p++ - '0'); + if (val > prev) { + return TCL_ERROR; + } + prev = val; + } + } + *out = val; + return TCL_OK; +} + +inline int +_str2wideInt( + Tcl_WideInt *out, + register + const char *p, + const char *e, + int sign) +{ + register Tcl_WideInt val = 0, prev = 0; + if (sign > 0) { + while (p < e) { + val = val * 10 + (*p++ - '0'); + if (val < prev) { + return TCL_ERROR; + } + prev = val; + } + } else { + while (p < e) { + val = val * 10 - (*p++ - '0'); + if (val > prev) { + return TCL_ERROR; + } + prev = val; + } + } + *out = val; + return TCL_OK; +} + /* *---------------------------------------------------------------------- */ @@ -403,22 +463,35 @@ Tcl_GetClockFrmScnFromObj( memset(tok, 0, sizeof(*(tok))); const char *ScnSTokenMapChars = - "dmyYHMS"; + "dmyYHMSJs"; static ClockScanTokenMap ScnSTokenMap[] = { - {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.dayOfMonth), + /* %d */ + {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.dayOfMonth), NULL}, + /* %m */ {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.month), NULL}, + /* %y */ {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.year), NULL}, + /* %Y */ {CTOKT_DIGIT, CLF_DATE, 1, 4, TclOffset(DateInfo, date.year), NULL}, + /* %H */ {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.hour), NULL}, + /* %M */ {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.minutes), NULL}, + /* %S */ {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.secondOfDay), NULL}, + /* %J */ + {CTOKT_DIGIT, CLF_DATE | CLF_JULIANDAY, 1, 0xffff, TclOffset(DateInfo, date.julianDay), + NULL}, + /* %s */ + {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), + NULL}, }; const char *ScnSpecTokenMapChars = " "; @@ -576,6 +649,7 @@ ClockScan( Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { + ClockClientData *dataPtr = clientData; ClockScanToken *tok; ClockScanTokenMap *map; register const char *p, *x, *end; @@ -590,46 +664,100 @@ ClockScan( yyMeridian = MER24; - /* bypass spaces at begin of string */ - p = TclGetString(strObj); end = p + strObj->length; - while (p < end && isspace(UCHAR(*p))) { - p++; + /* in strict mode - bypass spaces at begin / end only (not between tokens) */ + if (opts->flags & CLF_STRICT) { + while (p < end && isspace(UCHAR(*p))) { + p++; + } } info->dateStart = yyInput = p; /* parse string */ - for (; tok->map != NULL; yyInput = p, tok++) { + for (; tok->map != NULL; tok++) { map = tok->map; + /* bypass spaces at begin of input before parsing each token */ + if (!(opts->flags & CLF_STRICT) && map->type != CTOKT_SPACE) { + while (p < end && isspace(UCHAR(*p))) { + p++; + } + yyInput = p; + } switch (map->type) { case CTOKT_DIGIT: if (1) { - unsigned int val = 0; int size = map->maxSize; - /* greedy find digits (look forward), corresponding pre-calculated lookAhead */ - size += tok->lookAhead; - x = yyInput + size; - while (isdigit(UCHAR(*p)) && p < x) { p++; }; - /* consider reserved (lookAhead) for next tokens */ - p -= tok->lookAhead; + int sign = 1; + if (map->flags & CLF_SIGNED) { + if (*p == '+') { yyInput = ++p; } + else + if (*p == '-') { yyInput = ++p; sign = -1; }; + } + /* greedy find digits (look for forward digits consider spaces), + * corresponding pre-calculated lookAhead */ + if (size != map->minSize && tok->lookAhead) { + int spcnt = 0; + const char *pe; + size += tok->lookAhead; + x = p + size; if (x > end) { x = end; }; + pe = x; + while (p < x) { + if (isspace(UCHAR(*p))) { + if (pe > p) { pe = p; }; + if (x < end) x++; + p++; + spcnt++; + continue; + } + if (isdigit(UCHAR(*p))) { + p++; + continue; + } + break; + } + /* consider reserved (lookAhead) for next tokens */ + p -= tok->lookAhead + spcnt; + if (p > pe) { + p = pe; + } + } else { + x = p + size; if (x > end) { x = end; }; + while (isdigit(UCHAR(*p)) && p < x) { p++; }; + } size = p - yyInput; if (size < map->minSize) { /* missing input -> error */ - goto done; + goto error; } - /* string 2 number */ + /* string 2 number, put number into info structure by offset */ p = yyInput; x = p + size; - while (p < x) { - val = val * 10 + (*p++ - '0'); + if (!(map->flags & CLF_LOCALSEC)) { + if (_str2int((time_t *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; + } else { + if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; } - /* put number into info by offset */ - *(time_t *)(((char *)info) + map->offs) = val; flags |= map->flags; } break; case CTOKT_SPACE: + /* at least one space in strict mode */ + if (opts->flags & CLF_STRICT) { + if (!isspace(UCHAR(*p))) { + /* unmatched -> error */ + goto error; + } + p++; + } while (p < end && isspace(UCHAR(*p))) { p++; } @@ -639,7 +767,7 @@ ClockScan( if (x == tok->tokWord.end) { /* single char word */ if (*p != *x) { /* no match -> error */ - goto done; + goto error; } p++; continue; @@ -648,7 +776,7 @@ ClockScan( while (p < end && x < tok->tokWord.end && *p++ == *x++) {}; if (x < tok->tokWord.end) { /* no match -> error */ - goto done; + goto error; } break; } @@ -661,43 +789,57 @@ ClockScan( /* check end was reached */ if (p < end) { /* something after last token - wrong format */ - goto done; + goto error; } /* invalidate result */ if (flags & CLF_DATE) { - yydate.julianDay = CL_INVALIDATE; + if (!(flags & CLF_JULIANDAY)) { + info->flags |= CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY; - if (yyYear < 100) { - if (yyYear >= ClockGetYearOfCenturySwitch(clientData, interp)) { - yyYear -= 100; + if (yyYear < 100) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { + yyYear -= 100; + } + yyYear += dataPtr->currentYearCentury; } - yyYear += ClockCurrentYearCentury(clientData, interp); + yydate.era = CE; } - yydate.era = CE; - if (!(flags & CLF_TIME)) { + /* if date but no time - reset time */ + if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { + info->flags |= CLF_INVALIDATE_SECONDS; yydate.localSeconds = 0; } } if (flags & CLF_TIME) { + info->flags |= CLF_INVALIDATE_SECONDS; yySeconds = ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian); - } else { - yySeconds = yydate.localSeconds % 86400; + } else + if (!(flags & CLF_LOCALSEC)) { + info->flags |= CLF_INVALIDATE_SECONDS; + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; } ret = TCL_OK; + goto done; -done: +overflow: - if (ret != TCL_OK) { - Tcl_SetResult(interp, - "input string does not match supplied format", TCL_STATIC); - Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); - return ret; - } + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "integer value too large to represent", -1)); + Tcl_SetErrorCode(interp, "CLOCK", "integervalueTooLarge", NULL); + goto done; + +error: + + Tcl_SetResult(interp, + "input string does not match supplied format", TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); + +done: return ret; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 4b0b47e..47f2a21 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -14,6 +14,28 @@ #define _TCLCLOCK_H /* + * Constants + */ + +#define JULIAN_DAY_POSIX_EPOCH 2440588 +#define GREGORIAN_CHANGE_DATE 2361222 +#define SECONDS_PER_DAY 86400 +#define JULIAN_SEC_POSIX_EPOCH (((Tcl_WideInt) JULIAN_DAY_POSIX_EPOCH) \ + * SECONDS_PER_DAY) +#define FOUR_CENTURIES 146097 /* days */ +#define JDAY_1_JAN_1_CE_JULIAN 1721424 +#define JDAY_1_JAN_1_CE_GREGORIAN 1721426 +#define ONE_CENTURY_GREGORIAN 36524 /* days */ +#define FOUR_YEARS 1461 /* days */ +#define ONE_YEAR 365 /* days */ + + +/* On demand (lazy) assemble flags */ +#define CLF_INVALIDATE_DATE (1 << 6) /* assemble year, month, etc. using julianDay */ +#define CLF_INVALIDATE_JULIANDAY (1 << 7) /* assemble julianDay using year, month, etc. */ +#define CLF_INVALIDATE_SECONDS (1 << 8) /* assemble localSeconds (and seconds at end) */ + +/* * Structure containing the fields used in [clock format] and [clock scan] */ @@ -52,6 +74,7 @@ typedef struct TclDateFields { typedef struct DateInfo { const char *dateStart; const char *dateInput; + int flags; TclDateFields date; @@ -116,19 +139,71 @@ typedef struct DateInfo { #define yyDigitCount (info->dateDigitCount) -enum {CL_INVALIDATE = (signed int)0x80000000}; /* * Structure containing the command arguments supplied to [clock format] and [clock scan] */ +#define CLF_EXTENDED (1 << 4) +#define CLF_STRICT (1 << 8) + typedef struct ClockFmtScnCmdArgs { Tcl_Obj *formatObj; /* Format */ Tcl_Obj *localeObj; /* Name of the locale where the time will be expressed. */ Tcl_Obj *timezoneObj; /* Default time zone in which the time will be expressed */ Tcl_Obj *baseObj; /* Base (scan only) */ + int flags; /* Flags control scanning */ } ClockFmtScnCmdArgs; /* + * Structure containing the client data for [clock] + */ + +typedef struct ClockClientData { + int refCount; /* Number of live references. */ + Tcl_Obj **literals; /* Pool of object literals. */ + /* Cache for current clock parameters, imparted via "configure" */ + unsigned long LastTZEpoch; + int currentYearCentury; + int yearOfCenturySwitch; + Tcl_Obj *SystemTimeZone; + Tcl_Obj *SystemSetupTZData; + Tcl_Obj *GMTSetupTimeZone; + Tcl_Obj *GMTSetupTZData; + Tcl_Obj *AnySetupTimeZone; + Tcl_Obj *AnySetupTZData; + Tcl_Obj *LastUnnormSetupTimeZone; + Tcl_Obj *LastSetupTimeZone; + Tcl_Obj *LastSetupTZData; + /* Cache for last base (last-second fast convert if base/tz not changed) */ + struct { + Tcl_Obj *TimeZone; + TclDateFields Date; + } lastBase; + /* Las-minute cache for fast UTC2Local conversion */ + struct { + /* keys */ + Tcl_Obj *tzData; + int changeover; + Tcl_WideInt seconds; + /* values */ + time_t tzOffset; + Tcl_Obj *tzName; + } UTC2Local; + /* Las-minute cache for fast Local2UTC conversion */ + struct { + /* keys */ + Tcl_Obj *tzData; + int changeover; + Tcl_WideInt localSeconds; + /* values */ + time_t tzOffset; + } Local2UTC; +} ClockClientData; + +#define ClockDefaultYearCentury 2000 +#define ClockDefaultCenturySwitch 38 + +/* * Meridian: am, pm, or 24-hour style. */ @@ -152,8 +227,11 @@ typedef int ClockScanTokenProc( ClockScanToken *tok); -#define CLF_DATE (1 << 2) -#define CLF_TIME (1 << 3) +#define CLF_DATE (1 << 2) +#define CLF_JULIANDAY (1 << 3) +#define CLF_TIME (1 << 4) +#define CLF_LOCALSEC (1 << 5) +#define CLF_SIGNED (1 << 8) typedef enum _CLCKTOK_TYPE { CTOKT_DIGIT = 1, CTOKT_SPACE, CTOKT_WORD diff --git a/library/clock.tcl b/library/clock.tcl index ace4176..e0de904 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -287,9 +287,10 @@ proc ::tcl::clock::Initialize {} { variable FEB_28 58 - # Current year century and year of century switch - variable CurrentYearCentury 2000 - variable YearOfCenturySwitch 38 + # Default configuration + + # configure -year-century 2000 \ + # -century-switch 38 # Translation table to map Windows TZI onto cities, so that the Olson # rules can apply. In some cases the mapping is ambiguous, so it's wise @@ -2534,13 +2535,11 @@ proc ::tcl::clock::ScanWide { str } { proc ::tcl::clock::InterpretTwoDigitYear { date baseTime { twoDigitField yearOfCentury } { fourDigitField year } } { - variable CurrentYearCentury - variable YearOfCenturySwitch set yr [dict get $date $twoDigitField] - if { $yr >= $YearOfCenturySwitch } { + if { $yr >= [configure -century-switch] } { incr yr -100 } - incr yr $CurrentYearCentury + incr yr [configure -year-century] dict set date $fourDigitField $yr return $date } diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 93a78e4..9267684 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -15,10 +15,19 @@ # of this file. # + +## set testing defaults: set ::env(TCL_TZ) :CET +## warm-up (load clock.tcl, system zones, etc.): +clock scan "" -gmt 1 +clock scan "" +clock scan "" -timezone :CET + +## ------------------------------------------ + proc {**STOP**} {args} { - return -code error -level 2 "**STOP** in [info level [expr {[info level]-1}]] [join $args { }]" + return -code error -level 4 "**STOP** in [info level [expr {[info level]-2}]] [join $args { }]" } proc _test_get_commands {lst} { @@ -43,7 +52,7 @@ proc _test_out_total {} { puts "" } -proc _test_run {reptime lst {outcmd {puts {$_(r)}}}} { +proc _test_run {reptime lst {outcmd {puts $_(r)}}} { upvar _ _ array set _ [list ittm {} itcnt {} itrate {} reptime $reptime] @@ -74,6 +83,22 @@ proc test-scan {{reptime 1000}} { {clock scan "1111" -format "%d%m%y" -base 0 -gmt 1} {clock scan "11111" -format "%d%m%y" -base 0 -gmt 1} {clock scan "111111" -format "%d%m%y" -base 0 -gmt 1} + # Scan : greedy match (space separated) + {clock scan "1 1 1" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "111 1" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1 111" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1 11 1" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1 11 11" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "11 11 11" -format "%d%m%y" -base 0 -gmt 1} + + # Scan : time (in gmt) + {clock scan "10:35:55" -format "%H:%M:%S" -base 1000000000 -gmt 1} + # Scan : time (system time zone, with base) + {clock scan "10:35:55" -format "%H:%M:%S" -base 1000000000} + # Scan : time (gmt, without base) + {clock scan "10:35:55" -format "%H:%M:%S" -gmt 1} + # Scan : time (system time zone, without base) + {clock scan "10:35:55" -format "%H:%M:%S"} # Scan : date-time (in gmt) {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S" -base 0 -gmt 1} @@ -85,6 +110,17 @@ proc test-scan {{reptime 1000}} { # Scan : dynamic format (cacheable) {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} + # Scan : julian day in gmt + {clock scan 2451545 -format %J -gmt 1} + # Scan : julian day in system TZ + {clock scan 2451545 -format %J} + # Scan : julian day in other TZ + {clock scan 2451545 -format %J -timezone +0200} + # Scan : julian day with time: + {clock scan "2451545 10:20:30" -format "%J %H:%M:%S"} + # Scan : julian day with time (greedy match): + {clock scan "2451545 102030" -format "%J%H%M%S"} + # Scan : zone only {clock scan "CET" -format "%z"} {clock scan "EST" -format "%z"} @@ -144,6 +180,10 @@ proc test-other {{reptime 1000}} { _test_run $reptime { # Bad zone {catch {clock scan "1 day" -timezone BAD_ZONE -locale en}} + + # Scan : julian day (overflow) + {catch {clock scan 5373485 -format %J}} + **STOP** # Scan : test rotate of GC objects (format is dynamic, so tcl-obj removed with last reference) {set i 0; time { clock scan "[incr i] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} @@ -154,11 +194,11 @@ proc test-other {{reptime 1000}} { proc test {{reptime 1000}} { puts "" - test-scan $reptime - #test-freescan $reptime + #test-scan $reptime + test-freescan $reptime test-other $reptime puts \n**OK** } -test 250; # 250 ms +test 100; # ms diff --git a/tests/clock.test b/tests/clock.test index 477f142..9e3dbd7 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -35917,7 +35917,94 @@ test clock-34.52 {more than one ordinal month} {*}{ -result {unable to convert date-time string "next January next March": more than one ordinal month in string} } +test clock-34.53.1 {relative from base, date switch} { + set base [clock scan "12/31/2016 23:59:59" -gmt 1] + clock format [clock scan "+1 second" \ + -base $base -gmt 1] -gmt 1 -format {%Y-%m-%d %H:%M:%S} +} {2017-01-01 00:00:00} +test clock-34.53.2 {relative time, daylight switch} { + set base [clock scan "03/27/2016" -timezone CET] + set res {} + lappend res [clock format [clock scan "+1 hour" \ + -base $base -timezone CET] -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}] + lappend res [clock format [clock scan "+2 hour" \ + -base $base -timezone CET] -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}] +} {{2016-03-27 01:00:00 CET} {2016-03-27 03:00:00 CEST}} + +test clock-34.53.3 {relative time with day increment / daylight switch} { + set base [clock scan "03/27/2016" -timezone CET] + set res {} + lappend res [clock format [clock scan "+5 day +25 hour" \ + -base [expr {$base - 6*24*60*60}] -timezone CET] -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}] + lappend res [clock format [clock scan "+5 day +26 hour" \ + -base [expr {$base - 6*24*60*60}] -timezone CET] -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}] +} {{2016-03-27 01:00:00 CET} {2016-03-27 03:00:00 CEST}} + +test clock-34.53.4 {relative time with month & day increment / daylight switch} { + set base [clock scan "03/27/2016" -timezone CET] + set res {} + lappend res [clock format [clock scan "next Mar +5 day +25 hour" \ + -base [expr {$base - 35*24*60*60}] -timezone CET] -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}] + lappend res [clock format [clock scan "next Mar +5 day +26 hour" \ + -base [expr {$base - 35*24*60*60}] -timezone CET] -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}] +} {{2016-03-27 01:00:00 CET} {2016-03-27 03:00:00 CEST}} + +test clock-34.54.1 {check date in DST-hole: daylight switch CET -> CEST} { + set res {} + # forwards + set base 1459033200 + for {set i 0} {$i <= 3} {incr i} { + set d [clock scan "+$i hour" -base $base -timezone CET] + lappend res "$d = [clock format $d -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}]" + } + lappend res "#--" + # backwards + set base 1459044000 + for {set i 0} {$i <= 3} {incr i} { + set d [clock scan "-$i hour" -base $base -timezone CET] + lappend res "$d = [clock format $d -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}]" + } + set res +} [split [regsub -all {^\n|\n$} { +1459033200 = 2016-03-27 00:00:00 CET +1459036800 = 2016-03-27 01:00:00 CET +1459040400 = 2016-03-27 03:00:00 CEST +1459044000 = 2016-03-27 04:00:00 CEST +#-- +1459044000 = 2016-03-27 04:00:00 CEST +1459040400 = 2016-03-27 03:00:00 CEST +1459036800 = 2016-03-27 01:00:00 CET +1459033200 = 2016-03-27 00:00:00 CET +} {}] \n] + +test clock-34.54.2 {check date in DST-hole: daylight switch CEST -> CET} { + set res {} + # forwards + set base 1477782000 + for {set i 0} {$i <= 3} {incr i} { + set d [clock scan "+$i hour" -base $base -timezone CET] + lappend res "$d = [clock format $d -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}]" + } + lappend res "#--" + # backwards + set base 1477792800 + for {set i 0} {$i <= 3} {incr i} { + set d [clock scan "-$i hour" -base $base -timezone CET] + lappend res "$d = [clock format $d -timezone CET -format {%Y-%m-%d %H:%M:%S %Z}]" + } + set res +} [split [regsub -all {^\n|\n$} { +1477782000 = 2016-10-30 01:00:00 CEST +1477785600 = 2016-10-30 02:00:00 CEST +1477789200 = 2016-10-30 02:00:00 CET +1477792800 = 2016-10-30 03:00:00 CET +#-- +1477792800 = 2016-10-30 03:00:00 CET +1477789200 = 2016-10-30 02:00:00 CET +1477785600 = 2016-10-30 02:00:00 CEST +1477782000 = 2016-10-30 01:00:00 CEST +} {}] \n] # clock seconds test clock-35.1 {clock seconds tests} { -- cgit v0.12 From bcb2a0a181c0de95732c70b66d5040ec6bd4b2b9 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:20:25 +0000 Subject: amend for caching of UTC2Local / Local2UTC: * tzdata used internally only (because cached, replaced with timezone object as parameter for several functions) * small improvement (don't need to convert UTC to UTC) --- generic/tclClock.c | 104 ++++++++++++++++++++++++++++++++--------------------- generic/tclDate.h | 14 ++++---- library/clock.tcl | 34 +++++++++--------- 3 files changed, 88 insertions(+), 64 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 7cc5d86..6bd6336 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -107,13 +107,13 @@ TCL_DECLARE_MUTEX(clockMutex) */ static int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, - TclDateFields *, Tcl_Obj *, int); + TclDateFields *, Tcl_Obj *timezoneObj, int); static int ConvertUTCToLocalUsingTable(Tcl_Interp *, TclDateFields *, int, Tcl_Obj *const[]); static int ConvertUTCToLocalUsingC(Tcl_Interp *, TclDateFields *, int); static int ConvertLocalToUTC(ClientData clientData, Tcl_Interp *, - TclDateFields *, Tcl_Obj *, int); + TclDateFields *, Tcl_Obj *timezoneObj, int); static int ConvertLocalToUTCUsingTable(Tcl_Interp *, TclDateFields *, int, Tcl_Obj *const[]); static int ConvertLocalToUTCUsingC(Tcl_Interp *, @@ -138,7 +138,7 @@ static int ClockConvertlocaltoutcObjCmd( static int ClockGetDateFields(ClientData clientData, Tcl_Interp *interp, TclDateFields *fields, - Tcl_Obj *tzdata, int changeover); + Tcl_Obj *timezoneObj, int changeover); static int ClockGetdatefieldsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -287,10 +287,10 @@ TclClockInit( data->LastSetupTimeZone = NULL; data->LastSetupTZData = NULL; - data->lastBase.TimeZone = NULL; - data->UTC2Local.tzData = NULL; + data->lastBase.timezoneObj = NULL; + data->UTC2Local.timezoneObj = NULL; data->UTC2Local.tzName = NULL; - data->Local2UTC.tzData = NULL; + data->Local2UTC.timezoneObj = NULL; /* * Install the commands. @@ -335,10 +335,10 @@ ClockConfigureClear( Tcl_UnsetObjRef(data->LastSetupTimeZone); Tcl_UnsetObjRef(data->LastSetupTZData); - Tcl_UnsetObjRef(data->lastBase.TimeZone); - Tcl_UnsetObjRef(data->UTC2Local.tzData); + Tcl_UnsetObjRef(data->lastBase.timezoneObj); + Tcl_UnsetObjRef(data->UTC2Local.timezoneObj); Tcl_UnsetObjRef(data->UTC2Local.tzName); - Tcl_UnsetObjRef(data->Local2UTC.tzData); + Tcl_UnsetObjRef(data->Local2UTC.timezoneObj); } static void @@ -699,11 +699,11 @@ ClockFormatNumericTimeZone(int z) { * is available. * * Usage: - * ::tcl::clock::ConvertUTCToLocal dictionary tzdata changeover + * ::tcl::clock::ConvertUTCToLocal dictionary timezone changeover * * Parameters: * dict - Dictionary containing a 'localSeconds' entry. - * tzdata - Time zone data + * timezone - Time zone * changeover - Julian Day of the adoption of the Gregorian calendar. * * Results: @@ -739,7 +739,7 @@ ClockConvertlocaltoutcObjCmd( */ if (objc != 4) { - Tcl_WrongNumArgs(interp, 1, objv, "dict tzdata changeover"); + Tcl_WrongNumArgs(interp, 1, objv, "dict timezone changeover"); return TCL_ERROR; } dict = objv[1]; @@ -789,12 +789,11 @@ ClockConvertlocaltoutcObjCmd( * formatting a date, and populates a dictionary with them. * * Usage: - * ::tcl::clock::GetDateFields seconds tzdata changeover + * ::tcl::clock::GetDateFields seconds timezone changeover * * Parameters: * seconds - Time expressed in seconds from the Posix epoch. - * tzdata - Time zone data of the time zone in which time is to be - * expressed. + * timezone - Time zone in which time is to be expressed. * changeover - Julian Day Number at which the current locale adopted * the Gregorian calendar * @@ -830,7 +829,7 @@ ClockGetdatefieldsObjCmd( */ if (objc != 4) { - Tcl_WrongNumArgs(interp, 1, objv, "seconds tzdata changeover"); + Tcl_WrongNumArgs(interp, 1, objv, "seconds timezone changeover"); return TCL_ERROR; } if (Tcl_GetWideIntFromObj(interp, objv[1], &fields.seconds) != TCL_OK @@ -900,14 +899,14 @@ ClockGetDateFields( Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Pointer to result fields, where * fields->seconds contains date to extract */ - Tcl_Obj *tzdata, /* Time zone data object or NULL for gmt */ + Tcl_Obj *timezoneObj, /* Time zone object or NULL for gmt */ int changeover) /* Julian Day Number */ { /* * Convert UTC time to local. */ - if (ConvertUTCToLocal(clientData, interp, fields, tzdata, + if (ConvertUTCToLocal(clientData, interp, fields, timezoneObj, changeover) != TCL_OK) { return TCL_ERROR; } @@ -1165,18 +1164,26 @@ ConvertLocalToUTC( ClientData clientData, /* Client data of the interpreter */ Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Fields of the time */ - Tcl_Obj *tzdata, /* Time zone data */ + Tcl_Obj *timezoneObj, /* Time zone */ int changeover) /* Julian Day of the Gregorian transition */ { ClockClientData *dataPtr = clientData; + Tcl_Obj *tzdata; /* Time zone data */ int rowc; /* Number of rows in tzdata */ Tcl_Obj **rowv; /* Pointers to the rows */ + /* fast phase-out for shared GMT-object (don't need to convert UTC 2 UTC) */ + if (timezoneObj == dataPtr->GMTSetupTimeZone && dataPtr->GMTSetupTimeZone != NULL) { + fields->seconds = fields->localSeconds; + fields->tzOffset = 0; + return TCL_OK; + } + /* * Check cacheable conversion could be used * (last-minute Local2UTC cache with the same TZ) */ - if ( tzdata == dataPtr->Local2UTC.tzData + if ( timezoneObj == dataPtr->Local2UTC.timezoneObj && ( fields->localSeconds == dataPtr->Local2UTC.localSeconds || fields->localSeconds / 60 == dataPtr->Local2UTC.localSeconds / 60 ) @@ -1192,6 +1199,11 @@ ConvertLocalToUTC( * Unpack the tz data. */ + tzdata = ClockGetTZData(clientData, interp, timezoneObj); + if (tzdata == NULL) { + return TCL_ERROR; + } + if (TclListObjGetElements(interp, tzdata, &rowc, &rowv) != TCL_OK) { return TCL_ERROR; } @@ -1212,7 +1224,7 @@ ConvertLocalToUTC( } /* Cache the last conversion */ - Tcl_SetObjRef(dataPtr->Local2UTC.tzData, tzdata); + Tcl_SetObjRef(dataPtr->Local2UTC.timezoneObj, timezoneObj); dataPtr->Local2UTC.localSeconds = fields->localSeconds; dataPtr->Local2UTC.changeover = changeover; dataPtr->Local2UTC.tzOffset = fields->tzOffset; @@ -1432,18 +1444,34 @@ ConvertUTCToLocal( ClientData clientData, /* Client data of the interpreter */ Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Fields of the time */ - Tcl_Obj *tzdata, /* Time zone data */ + Tcl_Obj *timezoneObj, /* Time zone */ int changeover) /* Julian Day of the Gregorian transition */ { ClockClientData *dataPtr = clientData; + Tcl_Obj *tzdata; /* Time zone data */ int rowc; /* Number of rows in tzdata */ Tcl_Obj **rowv; /* Pointers to the rows */ + /* fast phase-out for shared GMT-object (don't need to convert UTC 2 UTC) */ + if (timezoneObj == dataPtr->GMTSetupTimeZone + && dataPtr->GMTSetupTimeZone != NULL + && dataPtr->GMTSetupTZData != NULL + ) { + fields->localSeconds = fields->seconds; + fields->tzOffset = 0; + if ( TclListObjGetElements(interp, dataPtr->GMTSetupTZData, &rowc, &rowv) != TCL_OK + || Tcl_ListObjIndex(interp, rowv[0], 3, &fields->tzName) != TCL_OK) { + return TCL_ERROR; + } + Tcl_IncrRefCount(fields->tzName); + return TCL_OK; + } + /* * Check cacheable conversion could be used * (last-minute UTC2Local cache with the same TZ) */ - if ( tzdata == dataPtr->UTC2Local.tzData + if ( timezoneObj == dataPtr->UTC2Local.timezoneObj && ( fields->seconds == dataPtr->UTC2Local.seconds || fields->seconds / 60 == dataPtr->UTC2Local.seconds / 60 ) @@ -1460,6 +1488,11 @@ ConvertUTCToLocal( * Unpack the tz data. */ + tzdata = ClockGetTZData(clientData, interp, timezoneObj); + if (tzdata == NULL) { + return TCL_ERROR; + } + if (TclListObjGetElements(interp, tzdata, &rowc, &rowv) != TCL_OK) { return TCL_ERROR; } @@ -1480,7 +1513,7 @@ ConvertUTCToLocal( } /* Cache the last conversion */ - Tcl_SetObjRef(dataPtr->UTC2Local.tzData, tzdata); + Tcl_SetObjRef(dataPtr->UTC2Local.timezoneObj, timezoneObj); dataPtr->UTC2Local.seconds = fields->seconds; dataPtr->UTC2Local.changeover = changeover; dataPtr->UTC2Local.tzOffset = fields->tzOffset; @@ -2607,32 +2640,27 @@ ClockScanObjCmd( if (opts.timezoneObj == NULL) { goto done; } + // Tcl_SetObjRef(yydate.tzName, opts.timezoneObj); /* * Extract year, month and day from the base time for the parser to use as * defaults */ - yydate.tzData = ClockGetTZData(clientData, interp, opts.timezoneObj); - if (yydate.tzData == NULL) { - goto done; - } - Tcl_SetObjRef(yydate.tzName, opts.timezoneObj); - /* check base fields already cached (by TZ, last-second cache) */ - if ( dataPtr->lastBase.TimeZone == opts.timezoneObj + if ( dataPtr->lastBase.timezoneObj == opts.timezoneObj && dataPtr->lastBase.Date.seconds == baseVal) { memcpy(&yydate, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); } else { /* extact fields from base */ yydate.seconds = baseVal; - if (ClockGetDateFields(clientData, interp, &yydate, yydate.tzData, + if (ClockGetDateFields(clientData, interp, &yydate, opts.timezoneObj, GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } /* cache last base */ memcpy(&dataPtr->lastBase.Date, &yydate, ClockCacheableDateFieldsSize); - Tcl_SetObjRef(dataPtr->lastBase.TimeZone, opts.timezoneObj); + Tcl_SetObjRef(dataPtr->lastBase.timezoneObj, opts.timezoneObj); } /* seconds are in localSeconds (relative base date), so reset time here */ @@ -2700,8 +2728,8 @@ ClockScanObjCmd( + ( yySeconds % SECONDS_PER_DAY ); } - if (ConvertLocalToUTC(clientData, interp, &yydate, yydate.tzData, GREGORIAN_CHANGE_DATE) - != TCL_OK) { + if (ConvertLocalToUTC(clientData, interp, &yydate, opts.timezoneObj, + GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } @@ -2798,12 +2826,8 @@ ClockFreeScan( if (opts->timezoneObj == NULL) { goto done; } - yydate.tzData = ClockGetTZData(clientData, interp, opts->timezoneObj); - if (yydate.tzData == NULL) { - goto done; - } - Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); + // Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); info->flags |= CLF_INVALIDATE_SECONDS; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 47f2a21..9585258 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -60,8 +60,8 @@ typedef struct TclDateFields { time_t minutes; /* Minutes of day (in-between time only calculation) */ time_t secondOfDay; /* Seconds of day (in-between time only calculation) */ - Tcl_Obj *tzName; /* Time zone name (if set the refCount is incremented) */ - Tcl_Obj *tzData; /* Time zone data object (internally referenced) */ + Tcl_Obj *tzName; /* Name (or corresponding DST-abbreviation) of the + * time zone, if set the refCount is incremented */ } TclDateFields; #define ClockCacheableDateFieldsSize \ @@ -176,14 +176,14 @@ typedef struct ClockClientData { Tcl_Obj *LastSetupTZData; /* Cache for last base (last-second fast convert if base/tz not changed) */ struct { - Tcl_Obj *TimeZone; + Tcl_Obj *timezoneObj; TclDateFields Date; } lastBase; /* Las-minute cache for fast UTC2Local conversion */ struct { /* keys */ - Tcl_Obj *tzData; - int changeover; + Tcl_Obj *timezoneObj; + int changeover; Tcl_WideInt seconds; /* values */ time_t tzOffset; @@ -192,8 +192,8 @@ typedef struct ClockClientData { /* Las-minute cache for fast Local2UTC conversion */ struct { /* keys */ - Tcl_Obj *tzData; - int changeover; + Tcl_Obj *timezoneObj; + int changeover; Tcl_WideInt localSeconds; /* values */ time_t tzOffset; diff --git a/library/clock.tcl b/library/clock.tcl index e0de904..ebbecb9 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -677,7 +677,7 @@ proc ::tcl::clock::format { args } { } } if {![info exists TZData($timezone)]} { - if {[catch {SetupTimeZone $timezone} retval opts]} { + if {[catch {set timezone [SetupTimeZone $timezone]} retval opts]} { dict unset opts -errorinfo return -options $opts $retval } @@ -744,7 +744,7 @@ proc ::tcl::clock::ParseClockFormatFormat2 {format locale procName} { { variable TZData set date [GetDateFields $clockval \ - $TZData($timezone) \ + $timezone \ @GREGORIAN_CHANGE_DATE@] }] set formatString {} @@ -1776,7 +1776,7 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} { } } append procBody { - ::tcl::clock::SetupTimeZone $timeZone + set timeZone [::tcl::clock::SetupTimeZone $timeZone] } } @@ -1810,7 +1810,7 @@ proc ::tcl::clock::ParseClockScanFormat {formatString locale} { append procBody { set date [::tcl::clock::ConvertLocalToUTC $date[set date {}] \ - $TZData($timeZone) $changeover] + $timeZone $changeover] } } @@ -2572,7 +2572,7 @@ proc ::tcl::clock::AssignBaseYear { date baseTime timezone changeover } { # Find the Julian Day Number corresponding to the base time, and # find the Gregorian year corresponding to that Julian Day. - set date2 [GetDateFields $baseTime $TZData($timezone) $changeover] + set date2 [GetDateFields $baseTime $timezone $changeover] # Store the converted year @@ -2610,7 +2610,7 @@ proc ::tcl::clock::AssignBaseIso8601Year {date baseTime timeZone changeover} { # Find the Julian Day Number corresponding to the base time - set date2 [GetDateFields $baseTime $TZData($timeZone) $changeover] + set date2 [GetDateFields $baseTime $timeZone $changeover] # Calculate the ISO8601 date and transfer the year @@ -2646,7 +2646,7 @@ proc ::tcl::clock::AssignBaseMonth {date baseTime timezone changeover} { # Find the year and month corresponding to the base time - set date2 [GetDateFields $baseTime $TZData($timezone) $changeover] + set date2 [GetDateFields $baseTime $timezone $changeover] dict set date era [dict get $date2 era] dict set date year [dict get $date2 year] dict set date month [dict get $date2 month] @@ -2680,7 +2680,7 @@ proc ::tcl::clock::AssignBaseWeek {date baseTime timeZone changeover} { # Find the Julian Day Number corresponding to the base time - set date2 [GetDateFields $baseTime $TZData($timeZone) $changeover] + set date2 [GetDateFields $baseTime $timeZone $changeover] # Calculate the ISO8601 date and transfer the year @@ -2716,7 +2716,7 @@ proc ::tcl::clock::AssignBaseJulianDay { date baseTime timeZone changeover } { # Find the Julian Day Number corresponding to the base time - set date2 [GetDateFields $baseTime $TZData($timeZone) $changeover] + set date2 [GetDateFields $baseTime $timeZone $changeover] dict set date julianDay [dict get $date2 julianDay] return $date @@ -2823,7 +2823,7 @@ proc ::tcl::clock::GetSystemTimeZone {} { } } if { ![dict exists $TimeZoneBad $timezone] } { - catch {SetupTimeZone $timezone} + catch {set timezone [SetupTimeZone $timezone]} } if { [dict exists $TimeZoneBad $timezone] } { @@ -2965,7 +2965,7 @@ proc ::tcl::clock::SetupTimeZone { timezone } { } } - # tell backend - timezone is initialized: + # tell backend - timezone is initialized and return shared timezone object: configure -setup-tz $timezone } @@ -3037,7 +3037,7 @@ proc ::tcl::clock::GuessWindowsTimeZone {} { if { [dict exists $WinZoneInfo $data] } { set tzname [dict get $WinZoneInfo $data] if { ! [dict exists $TimeZoneBad $tzname] } { - catch {SetupTimeZone $tzname} + catch {set tzname [SetupTimeZone $tzname]} } } else { set tzname {} @@ -4131,7 +4131,7 @@ proc ::tcl::clock::add { clockval args } { set changeover [mc GREGORIAN_CHANGE_DATE] - if {[catch {SetupTimeZone $timezone} retval opts]} { + if {[catch {set timezone [SetupTimeZone $timezone]} retval opts]} { dict unset opts -errorinfo return -options $opts $retval } @@ -4215,7 +4215,7 @@ proc ::tcl::clock::AddMonths { months clockval timezone changeover } { # Convert the time to year, month, day, and fraction of day. - set date [GetDateFields $clockval $TZData($timezone) $changeover] + set date [GetDateFields $clockval $timezone $changeover] dict set date secondOfDay [expr { [dict get $date localSeconds] % 86400 }] @@ -4252,7 +4252,7 @@ proc ::tcl::clock::AddMonths { months clockval timezone changeover } { + ( 86400 * wide([dict get $date julianDay]) ) + [dict get $date secondOfDay] }] - set date [ConvertLocalToUTC $date[set date {}] $TZData($timezone) \ + set date [ConvertLocalToUTC $date[set date {}] $timezone \ $changeover] return [dict get $date seconds] @@ -4336,7 +4336,7 @@ proc ::tcl::clock::AddDays { days clockval timezone changeover } { # Convert the time to Julian Day - set date [GetDateFields $clockval $TZData($timezone) $changeover] + set date [GetDateFields $clockval $timezone $changeover] dict set date secondOfDay [expr { [dict get $date localSeconds] % 86400 }] @@ -4353,7 +4353,7 @@ proc ::tcl::clock::AddDays { days clockval timezone changeover } { + ( 86400 * wide([dict get $date julianDay]) ) + [dict get $date secondOfDay] }] - set date [ConvertLocalToUTC $date[set date {}] $TZData($timezone) \ + set date [ConvertLocalToUTC $date[set date {}] $timezone \ $changeover] return [dict get $date seconds] -- cgit v0.12 From c5d6cc90d9239f54b212d06b8f98516ff145545b Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:21:26 +0000 Subject: several initialize and finalize facilities --- generic/tclClock.c | 16 +++++++++------- generic/tclClockFmt.c | 26 +++++++++++++++++++++----- generic/tclDate.c | 19 +++---------------- generic/tclDate.h | 14 +++++++++++++- generic/tclGetDate.y | 19 +++---------------- 5 files changed, 49 insertions(+), 45 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 6bd6336..a4edb82 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -324,6 +324,8 @@ static void ClockConfigureClear( ClockClientData *data) { + ClockFrmScnClearCaches(); + data->LastTZEpoch = 0; Tcl_UnsetObjRef(data->SystemTimeZone); Tcl_UnsetObjRef(data->SystemSetupTZData); @@ -2609,8 +2611,6 @@ ClockScanObjCmd( ret = TCL_ERROR; - info->flags = 0; - if (opts.baseObj != NULL) { if (Tcl_GetWideIntFromObj(interp, opts.baseObj, &baseVal) != TCL_OK) { return TCL_ERROR; @@ -2621,8 +2621,6 @@ ClockScanObjCmd( baseVal = (Tcl_WideInt) now.sec; } - yydate.tzName = NULL; - /* If time zone not specified use system time zone */ if ( opts.timezoneObj == NULL || TclGetString(opts.timezoneObj) == NULL @@ -2630,7 +2628,7 @@ ClockScanObjCmd( ) { opts.timezoneObj = ClockGetSystemTimeZone(clientData, interp); if (opts.timezoneObj == NULL) { - goto done; + return TCL_ERROR; } } @@ -2638,8 +2636,12 @@ ClockScanObjCmd( opts.timezoneObj = ClockSetupTimeZone(clientData, interp, opts.timezoneObj); if (opts.timezoneObj == NULL) { - goto done; + return TCL_ERROR; } + + ClockInitDateInfo(info); + yydate.tzName = NULL; + // Tcl_SetObjRef(yydate.tzName, opts.timezoneObj); /* @@ -2679,7 +2681,7 @@ ClockScanObjCmd( } ret = ClockFreeScan(clientData, interp, info, objv[1], &opts); } -#if 1 +#if 0 else if (1) { /* TODO: Tcled Scan proc - */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 48b9b69..ad04e4b 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -31,6 +31,8 @@ TCL_DECLARE_MUTEX(ClockFmtMutex); /* Serializes access to common format list. */ static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); +static void ClockFrmScnFinalize(ClientData clientData); + /* * Clock scan and format facilities. */ @@ -148,7 +150,7 @@ ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) */ static Tcl_HashTable FmtScnHashTable; -static int initFmtScnHashTable = 0; +static int initialized = 0; inline Tcl_HashEntry * HashEntry4FmtScn(ClockFmtScnStorage *fss) { @@ -246,16 +248,18 @@ FindOrCreateFmtScnStorage( Tcl_MutexLock(&ClockFmtMutex); /* if not yet initialized */ - if (!initFmtScnHashTable) { + if (!initialized) { /* initialize type */ memcpy(&ClockFmtScnStorageHashKeyType, &tclStringHashKeyType, sizeof(tclStringHashKeyType)); ClockFmtScnStorageHashKeyType.allocEntryProc = ClockFmtScnStorageAllocProc; ClockFmtScnStorageHashKeyType.freeEntryProc = ClockFmtScnStorageFreeProc; - initFmtScnHashTable = 1; /* initialize hash table */ Tcl_InitCustomHashTable(&FmtScnHashTable, TCL_CUSTOM_TYPE_KEYS, &ClockFmtScnStorageHashKeyType); + + initialized = 1; + Tcl_CreateExitHandler(ClockFrmScnFinalize, NULL); } /* get or create entry (and alocate storage) */ @@ -845,18 +849,30 @@ done: } +MODULE_SCOPE void +ClockFrmScnClearCaches(void) +{ + Tcl_MutexLock(&ClockFmtMutex); + /* clear caches ... */ + Tcl_MutexUnlock(&ClockFmtMutex); +} + static void -Tcl_GetClockFrmScnFinalize() +ClockFrmScnFinalize( + ClientData clientData) /* Not used. */ { + Tcl_MutexLock(&ClockFmtMutex); #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 /* clear GC */ ClockFmtScnStorage_GC.stackPtr = NULL; ClockFmtScnStorage_GC.stackBound = NULL; ClockFmtScnStorage_GC.count = 0; #endif - if (initFmtScnHashTable) { + if (initialized) { Tcl_DeleteHashTable(&FmtScnHashTable); + initialized = 0; } + Tcl_MutexUnlock(&ClockFmtMutex); Tcl_MutexFinalize(&ClockFmtMutex); } /* diff --git a/generic/tclDate.c b/generic/tclDate.c index 97d13b4..5bd96d0 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2685,24 +2685,11 @@ TclClockFreeScan( /* * yyInput = stringToParse; - * yyYear = baseYear; yyMonth = baseMonth; yyDay = baseDay; + * + * ClockInitDateInfo(info) should be executed to pre-init info; */ - yyHaveDate = 0; - - yyHaveTime = 0; - - yyHaveZone = 0; - yyTimezone = 0; yyDSTmode = DSTmaybe; - - yyHaveOrdinalMonth = 0; - yyMonthOrdinalIncr = 0; - - yyHaveDay = 0; - yyDayOrdinal = 0; yyDayNumber = 0; - - yyHaveRel = 0; - yyRelMonth = 0; yyRelDay = 0; yyRelSeconds = 0; yyRelPointer = NULL; + yyDSTmode = DSTmaybe; info->messages = Tcl_NewObj(); info->separatrix = ""; diff --git a/generic/tclDate.h b/generic/tclDate.h index 9585258..2010178 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -40,6 +40,9 @@ */ typedef struct TclDateFields { + + /* Cacheable fields: */ + Tcl_WideInt seconds; /* Time expressed in seconds from the Posix * epoch */ Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds @@ -60,6 +63,8 @@ typedef struct TclDateFields { time_t minutes; /* Minutes of day (in-between time only calculation) */ time_t secondOfDay; /* Seconds of day (in-between time only calculation) */ + /* Non cacheable fields: */ + Tcl_Obj *tzName; /* Name (or corresponding DST-abbreviation) of the * time zone, if set the refCount is incremented */ } TclDateFields; @@ -74,10 +79,11 @@ typedef struct TclDateFields { typedef struct DateInfo { const char *dateStart; const char *dateInput; - int flags; TclDateFields date; + int flags; + time_t dateHaveDate; time_t dateMeridian; @@ -138,6 +144,10 @@ typedef struct DateInfo { #define yyInput (info->dateInput) #define yyDigitCount (info->dateDigitCount) +inline void +ClockInitDateInfo(DateInfo *info) { + memset(info, 0, sizeof(DateInfo)); +} /* * Structure containing the command arguments supplied to [clock format] and [clock scan] @@ -298,6 +308,8 @@ MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); +MODULE_SCOPE void ClockFrmScnClearCaches(void); + /* * Other externals. */ diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 54087ca..9e3623f 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -896,24 +896,11 @@ TclClockFreeScan( /* * yyInput = stringToParse; - * yyYear = baseYear; yyMonth = baseMonth; yyDay = baseDay; + * + * ClockInitDateInfo(info) should be executed to pre-init info; */ - yyHaveDate = 0; - - yyHaveTime = 0; - - yyHaveZone = 0; - yyTimezone = 0; yyDSTmode = DSTmaybe; - - yyHaveOrdinalMonth = 0; - yyMonthOrdinalIncr = 0; - - yyHaveDay = 0; - yyDayOrdinal = 0; yyDayNumber = 0; - - yyHaveRel = 0; - yyRelMonth = 0; yyRelDay = 0; yyRelSeconds = 0; yyRelPointer = NULL; + yyDSTmode = DSTmaybe; info->messages = Tcl_NewObj(); info->separatrix = ""; -- cgit v0.12 From 18dc49dd083ec10211463e17378e1655a791df28 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:23:37 +0000 Subject: [temp-commit]: not ready --- generic/tclClock.c | 167 ++++++++++++++++++++---- generic/tclClockFmt.c | 319 ++++++++++++++++++++++++++++++++++++++-------- generic/tclDate.h | 32 ++++- library/msgcat/msgcat.tcl | 54 +++++++- tests-perf/clock.perf.tcl | 13 +- 5 files changed, 501 insertions(+), 84 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a4edb82..1e9abba 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -59,6 +59,8 @@ typedef enum ClockLiteral { LIT_TZDATA, LIT_GETSYSTEMTIMEZONE, LIT_SETUPTIMEZONE, + LIT_GETSYSTEMLOCALE, + LIT_SETUPLOCALE, #if 0 LIT_FREESCAN, #endif @@ -81,6 +83,8 @@ static const char *const Literals[] = { "::tcl::clock::TZData", "::tcl::clock::GetSystemTimeZone", "::tcl::clock::SetupTimeZone", + "::tcl::clock::mclocale", + "::tcl::clock::EnterLocale", #if 0 "::tcl::clock::FreeScan" #endif @@ -176,24 +180,6 @@ static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); /* - * Primitives to safe set, reset and free references. - */ - -#define Tcl_UnsetObjRef(obj) \ - if (obj != NULL) { Tcl_DecrRefCount(obj); obj = NULL; } -#define Tcl_InitObjRef(obj, val) \ - obj = val; if (obj) { Tcl_IncrRefCount(obj); } -#define Tcl_SetObjRef(obj, val) \ -if (1) { \ - Tcl_Obj *nval = val; \ - if (obj != nval) { \ - Tcl_Obj *prev = obj; \ - Tcl_InitObjRef(obj, nval); \ - if (prev != NULL) { Tcl_DecrRefCount(prev); }; \ - } \ -} - -/* * Structure containing description of "native" clock commands to create. */ @@ -610,12 +596,18 @@ ClockGetSystemTimeZone( return dataPtr->SystemTimeZone; } + Tcl_UnsetObjRef(dataPtr->SystemTimeZone); + Tcl_UnsetObjRef(data->SystemSetupTZData); + literals = dataPtr->literals; if (Tcl_EvalObjv(interp, 1, &literals[LIT_GETSYSTEMTIMEZONE], 0) != TCL_OK) { return NULL; } - return Tcl_GetObjResult(interp); + if (dataPtr->SystemTimeZone == NULL) { + Tcl_SetObjRef(dataPtr->SystemTimeZone, Tcl_GetObjResult(interp)); + } + return dataPtr->SystemTimeZone; } /* *---------------------------------------------------------------------- @@ -694,6 +686,124 @@ ClockFormatNumericTimeZone(int z) { /* *---------------------------------------------------------------------- + */ +inline Tcl_Obj * +NormLocaleObj( + ClockClientData *dataPtr, /* Client data containing literal pool */ + Tcl_Obj *localeObj) +{ + const char * tz; + if ( localeObj == dataPtr->LastUnnormSetupLocale + && dataPtr->LastSetupLocale != NULL + ) { + return dataPtr->LastSetupLocale; + } + if ( localeObj == dataPtr->LastSetupLocale + || localeObj == dataPtr->literals[LIT_CLOCALE] + || localeObj == dataPtr->SystemLocale + || localeObj == dataPtr->AnySetupLocale + ) { + return localeObj; + } + + tz = TclGetString(localeObj); + if (dataPtr->AnySetupLocale != NULL && + (localeObj == dataPtr->AnySetupLocale + || strcmp(tz, TclGetString(dataPtr->AnySetupLocale)) == 0 + ) + ) { + localeObj = dataPtr->AnySetupLocale; + } + else + if (dataPtr->SystemLocale != NULL && + (localeObj == dataPtr->SystemLocale + || strcmp(tz, TclGetString(dataPtr->SystemLocale)) == 0 + ) + ) { + localeObj = dataPtr->SystemLocale; + } + else + if ( + strcmp(tz, Literals[LIT_GMT]) == 0 + ) { + localeObj = dataPtr->literals[LIT_GMT]; + } + return localeObj; +} +/* + *---------------------------------------------------------------------- + */ +static Tcl_Obj * +ClockGetSystemLocale( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp) /* Tcl interpreter */ +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals; + + /* if known (cached) - return now */ + if (dataPtr->SystemLocale != NULL) { + return dataPtr->SystemLocale; + } + + literals = dataPtr->literals; + + if (Tcl_EvalObjv(interp, 1, &literals[LIT_GETSYSTEMLOCALE], 0) != TCL_OK) { + return NULL; + } + Tcl_SetObjRef(dataPtr->SystemLocale, Tcl_GetObjResult(interp)); + return dataPtr->SystemLocale; +} +/* + *---------------------------------------------------------------------- + */ +static Tcl_Obj * +ClockSetupLocale( + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *localeObj) +{ + ClockClientData *dataPtr = clientData; + Tcl_Obj **literals = dataPtr->literals; + Tcl_Obj *callargs[2]; + + if (localeObj == NULL || localeObj == dataPtr->SystemLocale) { + if (dataPtr->SystemLocale == NULL) { + return ClockGetSystemLocale(clientData, interp); + } + return dataPtr->SystemLocale; + } + +#if 0 + /* if cached (if already setup this one) */ + if ( dataPtr->LastSetupTimeZone != NULL + && ( localeObj == dataPtr->LastSetupTimeZone + || timezoneObj == dataPtr->LastUnnormSetupTimeZone + ) + ) { + return dataPtr->LastSetupTimeZone; + } + + /* differentiate GMT and system zones, because used often and already set */ + timezoneObj = NormTimezoneObj(dataPtr, timezoneObj); + if ( timezoneObj == dataPtr->GMTSetupTimeZone + || timezoneObj == dataPtr->SystemTimeZone + || timezoneObj == dataPtr->AnySetupTimeZone + ) { + return timezoneObj; + } + +#endif + callargs[0] = literals[LIT_SETUPLOCALE]; + callargs[1] = localeObj; + + if (Tcl_EvalObjv(interp, 2, callargs, 0) == TCL_OK) { + return localeObj; // dataPtr->CurrentLocale; + } + return NULL; +} +/* + *---------------------------------------------------------------------- * * ClockConvertlocaltoutcObjCmd -- * @@ -2440,11 +2550,7 @@ _ClockParseFmtScnArgs( * Extract values for the keywords. */ - resOpts->formatObj = NULL; - resOpts->localeObj = NULL; - resOpts->timezoneObj = NULL; - resOpts->baseObj = NULL; - resOpts->flags = 0; + memset(resOpts, 0, sizeof(*resOpts)); for (i = 2; i < objc; i+=2) { if (Tcl_GetIndexFromObj(interp, objv[i], options[forScan], "option", 0, &optionIndex) != TCL_OK) { @@ -2488,6 +2594,9 @@ _ClockParseFmtScnArgs( resOpts->timezoneObj = litPtr[LIT_GMT]; } + resOpts->clientData = clientData; + resOpts->interp = interp; + return TCL_OK; } @@ -2562,7 +2671,7 @@ ClockParseformatargsObjCmd( * Return options as a list. */ - Tcl_SetObjResult(interp, Tcl_NewListObj(3, (Tcl_Obj**)&resOpts)); + Tcl_SetObjResult(interp, Tcl_NewListObj(3, (Tcl_Obj**)&resOpts.formatObj)); return TCL_OK; } @@ -2632,13 +2741,19 @@ ClockScanObjCmd( } } - /* Get the data for time changes in the given zone */ + /* Setup timezone and locale */ opts.timezoneObj = ClockSetupTimeZone(clientData, interp, opts.timezoneObj); if (opts.timezoneObj == NULL) { return TCL_ERROR; } + opts.localeObj = ClockSetupLocale(clientData, interp, opts.localeObj); + if (opts.localeObj == NULL) { + return TCL_ERROR; + } + + ClockInitDateInfo(info); yydate.tzName = NULL; diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index ad04e4b..17181d9 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -454,32 +454,170 @@ Tcl_GetClockFrmScnFromObj( return fss; } + +static int +LocaleListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, const char * mcKey, int *val) +{ + Tcl_Obj *callargs[4] = {NULL, NULL, NULL, NULL}, **lstv; + int i, lstc; + Tcl_Obj *valObj = NULL; + int ret = TCL_RETURN; + + /* get msgcat value */ + TclNewLiteralStringObj(callargs[0], "::msgcat::mcget"); + TclNewLiteralStringObj(callargs[1], "::tcl::clock"); + callargs[2] = opts->localeObj; + if (opts->localeObj == NULL) { + TclNewLiteralStringObj(callargs[1], "c"); + } + callargs[3] = Tcl_NewStringObj(mcKey, -1); -#define AllocTokenInChain(tok, chain, tokCnt) \ - if (++(tok) >= (chain) + (tokCnt)) { \ - (char *)(chain) = ckrealloc((char *)(chain), \ - (tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \ - if ((chain) == NULL) { goto done; }; \ - (tok) = (chain) + (tokCnt); \ - (tokCnt) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ - } \ - memset(tok, 0, sizeof(*(tok))); + for (i = 0; i < 4; i++) { + Tcl_IncrRefCount(callargs[i]); + } + if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK) { + goto done; + } + + Tcl_InitObjRef(valObj, Tcl_GetObjResult(opts->interp)); + + /* is a list */ + if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { + goto done; + } + + /* search in list */ + for (i = 0; i < lstc; i++) { + const char *s = TclGetString(lstv[i]); + int l = lstv[i]->length; + if ( l <= info->dateEnd - yyInput + && strncasecmp(yyInput, s, l) == 0 + ) { + *val = i; + yyInput += l; + break; + } + } + + ret = TCL_OK; + /* if not found */ + if (i >= lstc) { + ret = TCL_ERROR; + } + +done: + + Tcl_UnsetObjRef(valObj); + + for (i = 0; i < 4; i++) { + Tcl_UnsetObjRef(callargs[i]); + } + + return ret; +} + +static int +StaticListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, const char **lst, int *val) +{ + int len; + const char **s = lst; + while (*s != NULL) { + len = strlen(*s); + if ( len <= info->dateEnd - yyInput + && strncasecmp(yyInput, *s, len) == 0 + ) { + *val = (s - lst); + yyInput += len; + break; + } + s++; + } + if (*s == NULL) { + return TCL_ERROR; + } + + return TCL_OK; +}; + +static int +ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + /* + static const char * months[] = { + /* full * / + "January", "February", "March", + "April", "May", "June", + "July", "August", "September", + "October", "November", "December", + /* abbr * / + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", + NULL + }; + int val; + if (StaticListSearch(opts, info, months, &val) != TCL_OK) { + return TCL_ERROR; + } + yyMonth = (val % 12) + 1; + return TCL_OK; + */ + + int val; + int ret = LocaleListSearch(opts, info, "MONTHS_FULL", &val); + if (ret != TCL_OK) { + if (ret == TCL_RETURN) { + return ret; + } + ret = LocaleListSearch(opts, info, "MONTHS_ABBREV", &val); + if (ret != TCL_OK) { + return ret; + } + } + + yyMonth = val + 1; + return TCL_OK; + +} + + +static int +ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int val; + + int ret = LocaleListSearch(opts, info, (char *)tok->map->data, &val); + if (ret != TCL_OK) { + return ret; + } + + *(time_t *)(((char *)info) + tok->map->offs) = val; + + return TCL_OK; +} -const char *ScnSTokenMapChars = - "dmyYHMSJs"; + +static const char *ScnSTokenMapIndex = + "dmbyYHMSJCs"; static ClockScanTokenMap ScnSTokenMap[] = { - /* %d */ + /* %d %e */ {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.dayOfMonth), NULL}, /* %m */ {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.month), NULL}, + /* %b %B %h */ + {CTOKT_PARSER, CLF_DATE, 0, 0, 0, + ClockScnToken_Month_Proc}, /* %y */ {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.year), NULL}, /* %Y */ - {CTOKT_DIGIT, CLF_DATE, 1, 4, TclOffset(DateInfo, date.year), + {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 1, 4, TclOffset(DateInfo, date.year), NULL}, /* %H */ {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.hour), @@ -493,11 +631,41 @@ static ClockScanTokenMap ScnSTokenMap[] = { /* %J */ {CTOKT_DIGIT, CLF_DATE | CLF_JULIANDAY, 1, 0xffff, TclOffset(DateInfo, date.julianDay), NULL}, + /* %C */ + {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 1, 2, TclOffset(DateInfo, dateCentury), + NULL}, /* %s */ {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), NULL}, }; -const char *ScnSpecTokenMapChars = +static const char *ScnSTokenWrapMapIndex[2] = { + "eBh", + "dbb" +}; + +static const char *ScnETokenMapIndex = + ""; +static ClockScanTokenMap ScnETokenMap[] = { + {0, 0, 0} +}; +static const char *ScnETokenWrapMapIndex[2] = { + "", + "" +}; + +static const char *ScnOTokenMapIndex = + "d"; +static ClockScanTokenMap ScnOTokenMap[] = { + /* %Od %Oe */ + {CTOKT_PARSER, CLF_DATE, 0, 0, TclOffset(DateInfo, date.dayOfMonth), + ClockScnToken_LocaleListMatcher_Proc, "LOCALE_NUMERALS"}, +}; +static const char *ScnOTokenWrapMapIndex[2] = { + "e", + "d" +}; + +static const char *ScnSpecTokenMapIndex = " "; static ClockScanTokenMap ScnSpecTokenMap[] = { {CTOKT_SPACE, 0, 1, 0xffff, 0, @@ -508,6 +676,17 @@ static ClockScanTokenMap ScnWordTokenMap = { CTOKT_WORD, 0, 1, 0, 0, NULL }; + + +#define AllocTokenInChain(tok, chain, tokCnt) \ + if (++(tok) >= (chain) + (tokCnt)) { \ + (char *)(chain) = ckrealloc((char *)(chain), \ + (tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \ + if ((chain) == NULL) { goto done; }; \ + (tok) = (chain) + (tokCnt); \ + (tokCnt) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ + } \ + memset(tok, 0, sizeof(*(tok))); /* *---------------------------------------------------------------------- @@ -546,10 +725,14 @@ ClockGetOrParseScanFormat( fss->scnTok = tok = ckalloc(sizeof(*tok) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); memset(tok, 0, sizeof(*(tok))); - strFmt = TclGetString(formatObj); - for (e = p = strFmt, e += formatObj->length; p != e; p++) { + strFmt = HashEntry4FmtScn(fss)->key.string; + for (e = p = strFmt, e += strlen(strFmt); p != e; p++) { switch (*p) { case '%': + if (1) { + ClockScanTokenMap * maps = ScnSTokenMap; + const char *mapIndex = ScnSTokenMapIndex, + **wrapIndex = ScnSTokenWrapMapIndex; if (p+1 >= e) { goto word_tok; } @@ -565,43 +748,62 @@ ClockGetOrParseScanFormat( continue; break; case 'E': - goto ext_tok_E; + maps = ScnETokenMap, + mapIndex = ScnETokenMapIndex, + wrapIndex = ScnETokenWrapMapIndex; + p++; break; case 'O': - goto ext_tok_O; + maps = ScnOTokenMap, + mapIndex = ScnOTokenMapIndex, + wrapIndex = ScnOTokenWrapMapIndex; + p++; break; - default: - cp = strchr(ScnSTokenMapChars, *p); + } + /* search direct index */ + cp = strchr(mapIndex, *p); + if (!cp || *cp == '\0') { + /* search wrapper index (multiple chars for same token) */ + cp = strchr(wrapIndex[0], *p); if (!cp || *cp == '\0') { p--; goto word_tok; } - tok->map = &ScnSTokenMap[cp - ScnSTokenMapChars]; - /* calculate look ahead value by standing together tokens */ - if (tok > fss->scnTok) { - ClockScanToken *prevTok = tok - 1; - unsigned int lookAhead = tok->map->minSize; - - while (prevTok >= fss->scnTok) { - if (prevTok->map->type != tok->map->type) { - break; - } - prevTok->lookAhead += lookAhead; - prevTok--; + cp = strchr(mapIndex, wrapIndex[1][cp - wrapIndex[0]]); + if (!cp || *cp == '\0') { /* unexpected, but ... */ + #ifdef DEBUG + Tcl_Panic("token \"%c\" has no map in wrapper resolver", *p); + #endif + p--; + goto word_tok; + } + } + tok->map = &ScnSTokenMap[cp - mapIndex]; + tok->tokWord.start = p; + /* calculate look ahead value by standing together tokens */ + if (tok > fss->scnTok) { + ClockScanToken *prevTok = tok - 1; + unsigned int lookAhead = tok->map->minSize; + + while (prevTok >= fss->scnTok) { + if (prevTok->map->type != tok->map->type) { + break; } + prevTok->lookAhead += lookAhead; + prevTok--; } - /* next token */ - AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); - break; } + /* next token */ + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + } break; case ' ': - cp = strchr(ScnSpecTokenMapChars, *p); + cp = strchr(ScnSpecTokenMapIndex, *p); if (!cp || *cp == '\0') { p--; goto word_tok; } - tok->map = &ScnSpecTokenMap[cp - ScnSpecTokenMapChars]; + tok->map = &ScnSpecTokenMap[cp - ScnSpecTokenMapIndex]; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); break; default: @@ -619,20 +821,10 @@ word_tok: } continue; } + break; } continue; - -ext_tok_E: - - /*******************/ - continue; - -ext_tok_O: - - /*******************/ - continue; - } done: @@ -677,17 +869,20 @@ ClockScan( } } info->dateStart = yyInput = p; + info->dateEnd = end; /* parse string */ for (; tok->map != NULL; tok++) { map = tok->map; /* bypass spaces at begin of input before parsing each token */ - if (!(opts->flags & CLF_STRICT) && map->type != CTOKT_SPACE) { + if ( !(opts->flags & CLF_STRICT) + && (map->type != CTOKT_SPACE && map->type != CTOKT_WORD) + ) { while (p < end && isspace(UCHAR(*p))) { p++; } - yyInput = p; } + yyInput = p; switch (map->type) { case CTOKT_DIGIT: @@ -753,6 +948,20 @@ ClockScan( flags |= map->flags; } break; + case CTOKT_PARSER: + switch (map->parser(opts, info, tok)) { + case TCL_OK: + break; + case TCL_RETURN: + goto done; + break; + default: + goto error; + break; + }; + p = yyInput; + flags |= map->flags; + break; case CTOKT_SPACE: /* at least one space in strict mode */ if (opts->flags & CLF_STRICT) { @@ -803,10 +1012,14 @@ ClockScan( info->flags |= CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY; if (yyYear < 100) { - if (yyYear >= dataPtr->yearOfCenturySwitch) { - yyYear -= 100; + if (!(flags & CLF_CENTURY)) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { + yyYear -= 100; + } + yyYear += dataPtr->currentYearCentury; + } else { + yyYear += info->dateCentury * 100; } - yyYear += dataPtr->currentYearCentury; } yydate.era = CE; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 2010178..d97cd3c 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -36,6 +36,24 @@ #define CLF_INVALIDATE_SECONDS (1 << 8) /* assemble localSeconds (and seconds at end) */ /* + * Primitives to safe set, reset and free references. + */ + +#define Tcl_UnsetObjRef(obj) \ + if (obj != NULL) { Tcl_DecrRefCount(obj); obj = NULL; } +#define Tcl_InitObjRef(obj, val) \ + obj = val; if (obj) { Tcl_IncrRefCount(obj); } +#define Tcl_SetObjRef(obj, val) \ +if (1) { \ + Tcl_Obj *nval = val; \ + if (obj != nval) { \ + Tcl_Obj *prev = obj; \ + Tcl_InitObjRef(obj, nval); \ + if (prev != NULL) { Tcl_DecrRefCount(prev); }; \ + } \ +} + +/* * Structure containing the fields used in [clock format] and [clock scan] */ @@ -79,6 +97,7 @@ typedef struct TclDateFields { typedef struct DateInfo { const char *dateStart; const char *dateInput; + const char *dateEnd; TclDateFields date; @@ -110,6 +129,8 @@ typedef struct DateInfo { time_t dateDigitCount; + time_t dateCentury; + Tcl_Obj* messages; /* Error messages */ const char* separatrix; /* String separating messages */ } DateInfo; @@ -157,6 +178,9 @@ ClockInitDateInfo(DateInfo *info) { #define CLF_STRICT (1 << 8) typedef struct ClockFmtScnCmdArgs { + ClientData clientData, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *formatObj; /* Format */ Tcl_Obj *localeObj; /* Name of the locale where the time will be expressed. */ Tcl_Obj *timezoneObj; /* Default time zone in which the time will be expressed */ @@ -233,6 +257,7 @@ typedef struct ClockScanToken ClockScanToken; typedef int ClockScanTokenProc( + ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok); @@ -241,10 +266,11 @@ typedef int ClockScanTokenProc( #define CLF_JULIANDAY (1 << 3) #define CLF_TIME (1 << 4) #define CLF_LOCALSEC (1 << 5) +#define CLF_CENTURY (1 << 6) #define CLF_SIGNED (1 << 8) typedef enum _CLCKTOK_TYPE { - CTOKT_DIGIT = 1, CTOKT_SPACE, CTOKT_WORD + CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD } CLCKTOK_TYPE; typedef struct ClockFmtScnStorage ClockFmtScnStorage; @@ -260,6 +286,7 @@ typedef struct ClockScanTokenMap { unsigned short int maxSize; unsigned short int offs; ClockScanTokenProc *parser; + void *data; } ClockScanTokenMap; typedef struct ClockScanToken { @@ -271,6 +298,9 @@ typedef struct ClockScanToken { } tokWord; } ClockScanToken; +#define ClockScnTokenChar(tok) \ + *tok->tokWord.start; + typedef struct ClockFmtScnStorage { int objRefCount; /* Reference count shared across threads */ ClockScanToken *scnTok; diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 928474d..7f23568 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -package require Tcl 8.5- +package require Tcl 8.5 # When the version number changes, be sure to update the pkgIndex.tcl file, # and the installation directory in the Makefiles. package provide msgcat 1.6.0 @@ -225,6 +225,56 @@ proc msgcat::mc {src args} { } } +# msgcat::mcget -- +# +# Find the translation for the given string based on the given +# locale setting. Check the given namespace first, then look in each +# parent namespace until the source is found. If additional args are +# specified, use the format command to work them into the traslated +# string. +# If no catalog item is found, mcunknown is called in the caller frame +# and its result is returned. +# +# Arguments: +# src The string to translate. +# args Args to pass to the format command +# +# Results: +# Returns the translated string. Propagates errors thrown by the +# format command. + +proc msgcat::mcget {ns loc src args} { + variable Msgs + + if {$loc eq {C}} { + set loclist [PackagePreferences $ns] + } else { + variable PackageConfig + # if {![dict exists $PackageConfig $ns $loc]} { + # set loc [mclocale] + # } + set loclist [dict get $PackageConfig locales $ns $loc] + } + for {set nscur $ns} {$nscur != ""} {set nscur [namespace parent $nscur]} { + foreach loc $loclist { + if {[dict exists $Msgs $nscur $loc $src]} { + if {[llength $args]} { + return [format [dict get $Msgs $nscur $loc $src] {*}$args] + } else { + return [dict get $Msgs $nscur $loc $src] + } + } + } + } + # call package local or default unknown command + set args [linsert $args 0 $loclist $src] + switch -exact -- [Invoke unknowncmd $args $ns result 1] { + 0 { return [uplevel 1 [linsert $args 0 [namespace origin mcunknown]]] } + 1 { return [DefaultUnknown {*}$args] } + default { return $result } + } +} + # msgcat::mcexists -- # # Check if a catalog item is set or if mc would invoke mcunknown. @@ -488,6 +538,7 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { set loclist [GetPreferences $locale] set locale [lindex $loclist 0] dict set PackageConfig loclist $ns $loclist + dict set PackageConfig locales $ns $locale $loclist # load eventual missing locales set loadedLocales [dict get $PackageConfig loadedlocales $ns] @@ -521,6 +572,7 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { [dict get $PackageConfig loadedlocales $ns] $LoadedLocales] dict unset PackageConfig loadedlocales $ns dict unset PackageConfig loclist $ns + dict unset PackageConfig locales $ns # unset keys not in global loaded locales if {[dict exists $Msgs $ns]} { diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 9267684..fd24068 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -121,10 +121,17 @@ proc test-scan {{reptime 1000}} { # Scan : julian day with time (greedy match): {clock scan "2451545 102030" -format "%J%H%M%S"} + # Scan : century, lookup table month + {clock scan {1970 Jan 2} -format {%C%y %b %d} -locale en -gmt 1} + # Scan : century, lookup table month and day + {clock scan {1970 Jan 02} -format {%C%y %b %Od} -locale en -gmt 1} + + break + # Scan : zone only {clock scan "CET" -format "%z"} {clock scan "EST" -format "%z"} - #{**STOP** : Wed Nov 25 01:00:00 CET 2015} + {**STOP** : Wed Nov 25 01:00:00 CET 2015} # # Scan : long format test (allock chain) # {clock scan "25.11.2015" -format "%d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y" -base 0 -gmt 1} @@ -194,8 +201,8 @@ proc test-other {{reptime 1000}} { proc test {{reptime 1000}} { puts "" - #test-scan $reptime - test-freescan $reptime + test-scan $reptime + #test-freescan $reptime test-other $reptime puts \n**OK** -- cgit v0.12 From a4c93085d2edbf7fd16083ac2766eae0c57e6278 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:25:20 +0000 Subject: l10n (with caching) implemented, msgcat package optimized, code review, etc. --- generic/tclClock.c | 448 +++++++++++++++++++++++++++++----------------- generic/tclClockFmt.c | 193 +++++++++++--------- generic/tclDate.h | 45 ++++- library/clock.tcl | 79 +++++--- library/msgcat/msgcat.tcl | 113 +++++++++--- tests-perf/clock.perf.tcl | 31 +++- tests/clock.test | 8 +- 7 files changed, 608 insertions(+), 309 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 1e9abba..166a4b3 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -59,8 +59,7 @@ typedef enum ClockLiteral { LIT_TZDATA, LIT_GETSYSTEMTIMEZONE, LIT_SETUPTIMEZONE, - LIT_GETSYSTEMLOCALE, - LIT_SETUPLOCALE, + LIT_MCGET, LIT_TCL_CLOCK, #if 0 LIT_FREESCAN, #endif @@ -83,13 +82,17 @@ static const char *const Literals[] = { "::tcl::clock::TZData", "::tcl::clock::GetSystemTimeZone", "::tcl::clock::SetupTimeZone", - "::tcl::clock::mclocale", - "::tcl::clock::EnterLocale", + "::msgcat::mcget", "::tcl::clock" #if 0 "::tcl::clock::FreeScan" #endif }; +/* Msgcat literals for exact match (mcKey) */ +CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLiterals, ""); +/* Msgcat index literals prefixed with _IDX_, used for quick dictionary search */ +CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); + static const char *const eras[] = { "CE", "BCE", NULL }; /* @@ -257,9 +260,10 @@ TclClockInit( data->refCount = 0; data->literals = ckalloc(LIT__END * sizeof(Tcl_Obj*)); for (i = 0; i < LIT__END; ++i) { - data->literals[i] = Tcl_NewStringObj(Literals[i], -1); - Tcl_IncrRefCount(data->literals[i]); + Tcl_InitObjRef(data->literals[i], Tcl_NewStringObj(Literals[i], -1)); } + data->mcLiterals = NULL; + data->mcLitIdxs = NULL; data->LastTZEpoch = 0; data->currentYearCentury = ClockDefaultYearCentury; data->yearOfCenturySwitch = ClockDefaultCenturySwitch; @@ -273,6 +277,12 @@ TclClockInit( data->LastSetupTimeZone = NULL; data->LastSetupTZData = NULL; + data->CurrentLocale = NULL; + data->CurrentLocaleDict = NULL; + data->LastUnnormUsedLocale = NULL; + data->LastUsedLocale = NULL; + data->LastUsedLocaleDict = NULL; + data->lastBase.timezoneObj = NULL; data->UTC2Local.timezoneObj = NULL; data->UTC2Local.tzName = NULL; @@ -323,6 +333,12 @@ ClockConfigureClear( Tcl_UnsetObjRef(data->LastSetupTimeZone); Tcl_UnsetObjRef(data->LastSetupTZData); + Tcl_UnsetObjRef(data->CurrentLocale); + Tcl_UnsetObjRef(data->CurrentLocaleDict); + Tcl_UnsetObjRef(data->LastUnnormUsedLocale); + Tcl_UnsetObjRef(data->LastUsedLocale); + Tcl_UnsetObjRef(data->LastUsedLocaleDict); + Tcl_UnsetObjRef(data->lastBase.timezoneObj); Tcl_UnsetObjRef(data->UTC2Local.timezoneObj); Tcl_UnsetObjRef(data->UTC2Local.tzName); @@ -341,6 +357,18 @@ ClockDeleteCmdProc( for (i = 0; i < LIT__END; ++i) { Tcl_DecrRefCount(data->literals[i]); } + if (data->mcLiterals != NULL) { + for (i = 0; i < MCLIT__END; ++i) { + Tcl_DecrRefCount(data->mcLiterals[i]); + } + data->mcLiterals = NULL; + } + if (data->mcLitIdxs != NULL) { + for (i = 0; i < MCLIT__END; ++i) { + Tcl_DecrRefCount(data->mcLitIdxs[i]); + } + data->mcLitIdxs = NULL; + } ClockConfigureClear(data); @@ -355,9 +383,9 @@ ClockDeleteCmdProc( inline Tcl_Obj * NormTimezoneObj( ClockClientData *dataPtr, /* Client data containing literal pool */ - Tcl_Obj * timezoneObj) + Tcl_Obj *timezoneObj) { - const char * tz; + const char *tz; if ( timezoneObj == dataPtr->LastUnnormSetupTimeZone && dataPtr->LastSetupTimeZone != NULL ) { @@ -399,6 +427,208 @@ NormTimezoneObj( /* *---------------------------------------------------------------------- */ +static Tcl_Obj * +NormLocaleObj( + ClockClientData *dataPtr, /* Client data containing literal pool */ + Tcl_Obj *localeObj, + Tcl_Obj **mcDictObj) +{ + const char *loc; + if ( localeObj == NULL || localeObj == dataPtr->CurrentLocale + || localeObj == dataPtr->literals[LIT_C] + ) { + *mcDictObj = dataPtr->CurrentLocaleDict; + return dataPtr->CurrentLocale; + } + if ( localeObj == dataPtr->LastUsedLocale + || localeObj == dataPtr->LastUnnormUsedLocale + ) { + *mcDictObj = dataPtr->LastUsedLocaleDict; + return dataPtr->LastUsedLocale; + } + + loc = TclGetString(localeObj); + if (dataPtr->CurrentLocale != NULL && + (localeObj == dataPtr->CurrentLocale + || strcmp(loc, TclGetString(dataPtr->CurrentLocale)) == 0 + ) + ) { + *mcDictObj = dataPtr->CurrentLocaleDict; + localeObj = dataPtr->CurrentLocale; + } + else + if (dataPtr->LastUsedLocale != NULL && + (localeObj == dataPtr->LastUsedLocale + || strcmp(loc, TclGetString(dataPtr->LastUsedLocale)) == 0 + ) + ) { + *mcDictObj = dataPtr->LastUsedLocaleDict; + Tcl_SetObjRef(dataPtr->LastUnnormUsedLocale, localeObj); + localeObj = dataPtr->LastUsedLocale; + } + else + if ( + strcmp(loc, Literals[LIT_C]) == 0 + ) { + *mcDictObj = dataPtr->CurrentLocaleDict; + localeObj = dataPtr->CurrentLocale; + } + else + { + *mcDictObj = NULL; + } + return localeObj; +} + +/* + *---------------------------------------------------------------------- + */ +MODULE_SCOPE Tcl_Obj * +ClockMCDict(ClockFmtScnCmdArgs *opts) +{ + ClockClientData *dataPtr = opts->clientData; + Tcl_Obj *callargs[3]; + + /* if dict not yet retrieved */ + if (opts->mcDictObj == NULL) { + + /* if locale was not yet used */ + if ( !(opts->flags & CLF_LOCALE_USED) ) { + + opts->localeObj = NormLocaleObj(opts->clientData, + opts->localeObj, &opts->mcDictObj); + + if (opts->localeObj == NULL) { + Tcl_SetResult(opts->interp, + "locale not specified and no default locale set", TCL_STATIC); + Tcl_SetErrorCode(opts->interp, "CLOCK", "badOption", NULL); + return NULL; + } + opts->flags |= CLF_LOCALE_USED; + + /* check locale literals already available (on demand creation) */ + if (dataPtr->mcLiterals == NULL) { + int i; + dataPtr->mcLiterals = ckalloc(MCLIT__END * sizeof(Tcl_Obj*)); + for (i = 0; i < MCLIT__END; ++i) { + Tcl_InitObjRef(dataPtr->mcLiterals[i], + Tcl_NewStringObj(MsgCtLiterals[i], -1)); + } + } + } + + if (opts->mcDictObj == NULL) { + /* get msgcat dictionary - ::msgcat::mcget ::tcl::clock locale */ + callargs[0] = dataPtr->literals[LIT_MCGET]; + callargs[1] = dataPtr->literals[LIT_TCL_CLOCK]; + callargs[2] = opts->localeObj; + + if (Tcl_EvalObjv(opts->interp, 3, callargs, 0) != TCL_OK) { + return NULL; + } + + opts->mcDictObj = Tcl_GetObjResult(opts->interp); + if ( opts->localeObj == dataPtr->CurrentLocale ) { + Tcl_SetObjRef(dataPtr->CurrentLocaleDict, opts->mcDictObj); + } else { + Tcl_SetObjRef(dataPtr->LastUsedLocale, opts->localeObj); + Tcl_UnsetObjRef(dataPtr->LastUnnormUsedLocale); + Tcl_SetObjRef(dataPtr->LastUsedLocaleDict, opts->mcDictObj); + } + } + } + + return opts->mcDictObj; +} + +MODULE_SCOPE Tcl_Obj * +ClockMCGet( + ClockFmtScnCmdArgs *opts, + int mcKey) +{ + ClockClientData *dataPtr = opts->clientData; + + Tcl_Obj *valObj = NULL; + + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return NULL; + } + + Tcl_DictObjGet(opts->interp, opts->mcDictObj, + dataPtr->mcLiterals[mcKey], &valObj); + + return valObj; /* or NULL in obscure case if Tcl_DictObjGet failed */ +} + +MODULE_SCOPE Tcl_Obj * +ClockMCGetListIdxDict( + ClockFmtScnCmdArgs *opts, + int mcKey) +{ + ClockClientData *dataPtr = opts->clientData; + + Tcl_Obj *valObj = NULL; + + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return NULL; + } + + /* try to get indices dictionray, + * if not available - create from list */ + + if (Tcl_DictObjGet(NULL, opts->mcDictObj, + dataPtr->mcLitIdxs[mcKey], &valObj) != TCL_OK + ) { + Tcl_Obj **lstv, *intObj; + int i, lstc; + + if (dataPtr->mcLitIdxs == NULL) { + dataPtr->mcLitIdxs = ckalloc(MCLIT__END * sizeof(Tcl_Obj*)); + for (i = 0; i < MCLIT__END; ++i) { + Tcl_InitObjRef(dataPtr->mcLitIdxs[i], + Tcl_NewStringObj(MsgCtLitIdxs[i], -1)); + } + } + + if (Tcl_DictObjGet(opts->interp, opts->mcDictObj, + dataPtr->mcLiterals[mcKey], &valObj) != TCL_OK) { + return NULL; + }; + if (TclListObjGetElements(opts->interp, valObj, + &lstc, &lstv) != TCL_OK) { + return NULL; + }; + + valObj = Tcl_NewDictObj(); + for (i = 0; i < lstc; i++) { + intObj = Tcl_NewIntObj(i); + if (Tcl_DictObjPut(opts->interp, valObj, + lstv[i], intObj) != TCL_OK + ) { + Tcl_DecrRefCount(valObj); + Tcl_DecrRefCount(intObj); + return NULL; + } + }; + + if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, + dataPtr->mcLitIdxs[mcKey], valObj) != TCL_OK + ) { + Tcl_DecrRefCount(valObj); + return NULL; + } + }; + + return valObj; +} + +/* + *---------------------------------------------------------------------- + */ static int ClockConfigureObjCmd( ClientData clientData, /* Client data containing literal pool */ @@ -410,23 +640,25 @@ ClockConfigureObjCmd( Tcl_Obj **litPtr = dataPtr->literals; static const char *const options[] = { - "-system-tz", "-setup-tz", "-clear", + "-system-tz", "-setup-tz", "-default-locale", + "-clear", "-year-century", "-century-switch", NULL }; enum optionInd { - CLOCK_SYSTEM_TZ, CLOCK_SETUP_TZ, CLOCK_CLEAR_CACHE, + CLOCK_SYSTEM_TZ, CLOCK_SETUP_TZ, CLOCK_CURRENT_LOCALE, + CLOCK_CLEAR_CACHE, CLOCK_YEAR_CENTURY, CLOCK_CENTURY_SWITCH, CLOCK_SETUP_GMT, CLOCK_SETUP_NOP }; int optionIndex; /* Index of an option. */ int i; - for (i = 1; i < objc; i+=2) { - if (Tcl_GetIndexFromObj(interp, objv[i], options, + for (i = 1; i < objc; i++) { + if (Tcl_GetIndexFromObj(interp, objv[i++], options, "option", 0, &optionIndex) != TCL_OK) { Tcl_SetErrorCode(interp, "CLOCK", "badOption", - Tcl_GetString(objv[i]), NULL); + Tcl_GetString(objv[i-1]), NULL); return TCL_ERROR; } switch (optionIndex) { @@ -434,24 +666,24 @@ ClockConfigureObjCmd( if (1) { /* validate current tz-epoch */ unsigned long lastTZEpoch = TzsetGetEpoch(); - if (i+1 < objc) { - if (dataPtr->SystemTimeZone != objv[i+1]) { - Tcl_SetObjRef(dataPtr->SystemTimeZone, objv[i+1]); + if (i < objc) { + if (dataPtr->SystemTimeZone != objv[i]) { + Tcl_SetObjRef(dataPtr->SystemTimeZone, objv[i]); Tcl_UnsetObjRef(dataPtr->SystemSetupTZData); } dataPtr->LastTZEpoch = lastTZEpoch; } - if (dataPtr->SystemTimeZone != NULL + if (i+1 >= objc && dataPtr->SystemTimeZone != NULL && dataPtr->LastTZEpoch == lastTZEpoch) { Tcl_SetObjResult(interp, dataPtr->SystemTimeZone); } } break; case CLOCK_SETUP_TZ: - if (i+1 < objc) { + if (i < objc) { /* differentiate GMT and system zones, because used often */ - Tcl_Obj *timezoneObj = NormTimezoneObj(dataPtr, objv[i+1]); - Tcl_SetObjRef(dataPtr->LastUnnormSetupTimeZone, objv[i+1]); + Tcl_Obj *timezoneObj = NormTimezoneObj(dataPtr, objv[i]); + Tcl_SetObjRef(dataPtr->LastUnnormSetupTimeZone, objv[i]); if (dataPtr->LastSetupTimeZone != timezoneObj) { Tcl_SetObjRef(dataPtr->LastSetupTimeZone, timezoneObj); Tcl_UnsetObjRef(dataPtr->LastSetupTZData); @@ -463,7 +695,7 @@ ClockConfigureObjCmd( } switch (optionIndex) { case CLOCK_SETUP_GMT: - if (i+1 < objc) { + if (i < objc) { if (dataPtr->GMTSetupTimeZone != timezoneObj) { Tcl_SetObjRef(dataPtr->GMTSetupTimeZone, timezoneObj); Tcl_UnsetObjRef(dataPtr->GMTSetupTZData); @@ -471,7 +703,7 @@ ClockConfigureObjCmd( } break; case CLOCK_SETUP_TZ: - if (i+1 < objc) { + if (i < objc) { if (dataPtr->AnySetupTimeZone != timezoneObj) { Tcl_SetObjRef(dataPtr->AnySetupTimeZone, timezoneObj); Tcl_UnsetObjRef(dataPtr->AnySetupTZData); @@ -480,35 +712,52 @@ ClockConfigureObjCmd( break; } } - if (dataPtr->LastSetupTimeZone != NULL) { + if (i+1 >= objc && dataPtr->LastSetupTimeZone != NULL) { Tcl_SetObjResult(interp, dataPtr->LastSetupTimeZone); } break; + case CLOCK_CURRENT_LOCALE: + if (i < objc) { + if (dataPtr->CurrentLocale != objv[i]) { + Tcl_SetObjRef(dataPtr->CurrentLocale, objv[i]); + Tcl_UnsetObjRef(dataPtr->CurrentLocaleDict); + } + } + if (i+1 >= objc && dataPtr->CurrentLocale != NULL) { + Tcl_SetObjResult(interp, dataPtr->CurrentLocale); + } + break; case CLOCK_YEAR_CENTURY: - if (i+1 < objc) { + if (i < objc) { int year; - if (TclGetIntFromObj(interp, objv[i+1], &year) != TCL_OK) { + if (TclGetIntFromObj(interp, objv[i], &year) != TCL_OK) { return TCL_ERROR; } dataPtr->currentYearCentury = year; - Tcl_SetObjResult(interp, objv[i+1]); + if (i+1 >= objc) { + Tcl_SetObjResult(interp, objv[i]); + } continue; - } - Tcl_SetObjResult(interp, - Tcl_NewIntObj(dataPtr->currentYearCentury)); + } + if (i+1 >= objc) { + Tcl_SetObjResult(interp, + Tcl_NewIntObj(dataPtr->currentYearCentury)); + } break; case CLOCK_CENTURY_SWITCH: - if (i+1 < objc) { + if (i < objc) { int year; - if (TclGetIntFromObj(interp, objv[i+1], &year) != TCL_OK) { + if (TclGetIntFromObj(interp, objv[i], &year) != TCL_OK) { return TCL_ERROR; } dataPtr->yearOfCenturySwitch = year; - Tcl_SetObjResult(interp, objv[i+1]); + Tcl_SetObjResult(interp, objv[i]); continue; - } - Tcl_SetObjResult(interp, - Tcl_NewIntObj(dataPtr->yearOfCenturySwitch)); + } + if (i+1 >= objc) { + Tcl_SetObjResult(interp, + Tcl_NewIntObj(dataPtr->yearOfCenturySwitch)); + } break; case CLOCK_CLEAR_CACHE: ClockConfigureClear(dataPtr); @@ -597,7 +846,7 @@ ClockGetSystemTimeZone( } Tcl_UnsetObjRef(dataPtr->SystemTimeZone); - Tcl_UnsetObjRef(data->SystemSetupTZData); + Tcl_UnsetObjRef(dataPtr->SystemSetupTZData); literals = dataPtr->literals; @@ -683,125 +932,6 @@ ClockFormatNumericTimeZone(int z) { } return Tcl_ObjPrintf("%c%02d%02d", sign, h, m); } - -/* - *---------------------------------------------------------------------- - */ -inline Tcl_Obj * -NormLocaleObj( - ClockClientData *dataPtr, /* Client data containing literal pool */ - Tcl_Obj *localeObj) -{ - const char * tz; - if ( localeObj == dataPtr->LastUnnormSetupLocale - && dataPtr->LastSetupLocale != NULL - ) { - return dataPtr->LastSetupLocale; - } - if ( localeObj == dataPtr->LastSetupLocale - || localeObj == dataPtr->literals[LIT_CLOCALE] - || localeObj == dataPtr->SystemLocale - || localeObj == dataPtr->AnySetupLocale - ) { - return localeObj; - } - - tz = TclGetString(localeObj); - if (dataPtr->AnySetupLocale != NULL && - (localeObj == dataPtr->AnySetupLocale - || strcmp(tz, TclGetString(dataPtr->AnySetupLocale)) == 0 - ) - ) { - localeObj = dataPtr->AnySetupLocale; - } - else - if (dataPtr->SystemLocale != NULL && - (localeObj == dataPtr->SystemLocale - || strcmp(tz, TclGetString(dataPtr->SystemLocale)) == 0 - ) - ) { - localeObj = dataPtr->SystemLocale; - } - else - if ( - strcmp(tz, Literals[LIT_GMT]) == 0 - ) { - localeObj = dataPtr->literals[LIT_GMT]; - } - return localeObj; -} -/* - *---------------------------------------------------------------------- - */ -static Tcl_Obj * -ClockGetSystemLocale( - ClientData clientData, /* Opaque pointer to literal pool, etc. */ - Tcl_Interp *interp) /* Tcl interpreter */ -{ - ClockClientData *dataPtr = clientData; - Tcl_Obj **literals; - - /* if known (cached) - return now */ - if (dataPtr->SystemLocale != NULL) { - return dataPtr->SystemLocale; - } - - literals = dataPtr->literals; - - if (Tcl_EvalObjv(interp, 1, &literals[LIT_GETSYSTEMLOCALE], 0) != TCL_OK) { - return NULL; - } - Tcl_SetObjRef(dataPtr->SystemLocale, Tcl_GetObjResult(interp)); - return dataPtr->SystemLocale; -} -/* - *---------------------------------------------------------------------- - */ -static Tcl_Obj * -ClockSetupLocale( - ClientData clientData, /* Opaque pointer to literal pool, etc. */ - Tcl_Interp *interp, /* Tcl interpreter */ - Tcl_Obj *localeObj) -{ - ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; - Tcl_Obj *callargs[2]; - - if (localeObj == NULL || localeObj == dataPtr->SystemLocale) { - if (dataPtr->SystemLocale == NULL) { - return ClockGetSystemLocale(clientData, interp); - } - return dataPtr->SystemLocale; - } - -#if 0 - /* if cached (if already setup this one) */ - if ( dataPtr->LastSetupTimeZone != NULL - && ( localeObj == dataPtr->LastSetupTimeZone - || timezoneObj == dataPtr->LastUnnormSetupTimeZone - ) - ) { - return dataPtr->LastSetupTimeZone; - } - - /* differentiate GMT and system zones, because used often and already set */ - timezoneObj = NormTimezoneObj(dataPtr, timezoneObj); - if ( timezoneObj == dataPtr->GMTSetupTimeZone - || timezoneObj == dataPtr->SystemTimeZone - || timezoneObj == dataPtr->AnySetupTimeZone - ) { - return timezoneObj; - } - -#endif - callargs[0] = literals[LIT_SETUPLOCALE]; - callargs[1] = localeObj; - - if (Tcl_EvalObjv(interp, 2, callargs, 0) == TCL_OK) { - return localeObj; // dataPtr->CurrentLocale; - } - return NULL; -} /* *---------------------------------------------------------------------- * @@ -2741,19 +2871,13 @@ ClockScanObjCmd( } } - /* Setup timezone and locale */ + /* Setup timezone (normalize object id needed and load TZ on demand) */ opts.timezoneObj = ClockSetupTimeZone(clientData, interp, opts.timezoneObj); if (opts.timezoneObj == NULL) { return TCL_ERROR; } - opts.localeObj = ClockSetupLocale(clientData, interp, opts.localeObj); - if (opts.localeObj == NULL) { - return TCL_ERROR; - } - - ClockInitDateInfo(info); yydate.tzName = NULL; diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 17181d9..a3c7f20 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -454,45 +454,55 @@ Tcl_GetClockFrmScnFromObj( return fss; } - + +/* + * DetermineGreedySearchLen -- + * + * Determine min/max lengths as exact as possible (speed, greedy match) + * + */ +inline +void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok, int *minLen, int *maxLen) +{ + register const char*p = yyInput; + *minLen = 0; + *maxLen = info->dateEnd - p; + + /* if no tokens anymore */ + if (!(tok+1)->map) { + /* should match to end or first space */ + while (!isspace(UCHAR(*p)) && ++p < info->dateEnd) {}; + *minLen = p - yyInput; + } +} static int LocaleListSearch(ClockFmtScnCmdArgs *opts, - DateInfo *info, const char * mcKey, int *val) + DateInfo *info, int mcKey, int *val, + int minLen, int maxLen) { - Tcl_Obj *callargs[4] = {NULL, NULL, NULL, NULL}, **lstv; - int i, lstc; - Tcl_Obj *valObj = NULL; - int ret = TCL_RETURN; + Tcl_Obj **lstv; + int lstc, i, l; + const char *s; + Tcl_Obj *valObj; /* get msgcat value */ - TclNewLiteralStringObj(callargs[0], "::msgcat::mcget"); - TclNewLiteralStringObj(callargs[1], "::tcl::clock"); - callargs[2] = opts->localeObj; - if (opts->localeObj == NULL) { - TclNewLiteralStringObj(callargs[1], "c"); - } - callargs[3] = Tcl_NewStringObj(mcKey, -1); - - for (i = 0; i < 4; i++) { - Tcl_IncrRefCount(callargs[i]); - } - if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK) { - goto done; + valObj = ClockMCGet(opts, mcKey); + if (valObj == NULL) { + return TCL_ERROR; } - Tcl_InitObjRef(valObj, Tcl_GetObjResult(opts->interp)); - /* is a list */ if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { - goto done; + return TCL_ERROR; } /* search in list */ for (i = 0; i < lstc; i++) { - const char *s = TclGetString(lstv[i]); - int l = lstv[i]->length; - if ( l <= info->dateEnd - yyInput + s = TclGetString(lstv[i]); + l = lstv[i]->length; + if ( l >= minLen && l <= maxLen && strncasecmp(yyInput, s, l) == 0 ) { *val = i; @@ -501,21 +511,11 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, } } - ret = TCL_OK; /* if not found */ - if (i >= lstc) { - ret = TCL_ERROR; - } - -done: - - Tcl_UnsetObjRef(valObj); - - for (i = 0; i < 4; i++) { - Tcl_UnsetObjRef(callargs[i]); + if (i < lstc) { + return TCL_OK; } - - return ret; + return TCL_RETURN; } static int @@ -535,12 +535,34 @@ StaticListSearch(ClockFmtScnCmdArgs *opts, } s++; } - if (*s == NULL) { - return TCL_ERROR; + if (*s != NULL) { + return TCL_OK; } - - return TCL_OK; -}; + return TCL_RETURN; +} + +inline const char * +FindWordEnd( + ClockScanToken *tok, + register const char * p, const char * end) +{ + register const char *x = tok->tokWord.start; + if (x == tok->tokWord.end) { /* single char word */ + if (*p != *x) { + /* no match -> error */ + return NULL; + } + return ++p; + } + /* multi-char word */ + while (*p++ == *x++) { + if (x >= tok->tokWord.end || p >= end) { + /* no match -> error */ + return NULL; + } + }; + return p; +} static int ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, @@ -560,19 +582,26 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, }; int val; if (StaticListSearch(opts, info, months, &val) != TCL_OK) { - return TCL_ERROR; + return TCL_RETURN; } yyMonth = (val % 12) + 1; return TCL_OK; */ - int val; - int ret = LocaleListSearch(opts, info, "MONTHS_FULL", &val); + int ret, val; + int minLen; + int maxLen; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + ret = LocaleListSearch(opts, info, MCLIT_MONTHS_FULL, &val, + minLen, maxLen); if (ret != TCL_OK) { + /* if not found */ if (ret == TCL_RETURN) { - return ret; + ret = LocaleListSearch(opts, info, MCLIT_MONTHS_ABBREV, &val, + minLen, maxLen); } - ret = LocaleListSearch(opts, info, "MONTHS_ABBREV", &val); if (ret != TCL_OK) { return ret; } @@ -588,9 +617,14 @@ static int ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { - int val; + int ret, val; + int minLen; + int maxLen; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); - int ret = LocaleListSearch(opts, info, (char *)tok->map->data, &val); + ret = LocaleListSearch(opts, info, (int)tok->map->data, &val, + minLen, maxLen); if (ret != TCL_OK) { return ret; } @@ -639,8 +673,8 @@ static ClockScanTokenMap ScnSTokenMap[] = { NULL}, }; static const char *ScnSTokenWrapMapIndex[2] = { - "eBh", - "dbb" + "eNBh", + "dmbb" }; static const char *ScnETokenMapIndex = @@ -654,11 +688,14 @@ static const char *ScnETokenWrapMapIndex[2] = { }; static const char *ScnOTokenMapIndex = - "d"; + "dm"; static ClockScanTokenMap ScnOTokenMap[] = { /* %Od %Oe */ {CTOKT_PARSER, CLF_DATE, 0, 0, TclOffset(DateInfo, date.dayOfMonth), - ClockScnToken_LocaleListMatcher_Proc, "LOCALE_NUMERALS"}, + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Om */ + {CTOKT_PARSER, CLF_DATE, 0, 0, TclOffset(DateInfo, date.month), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *ScnOTokenWrapMapIndex[2] = { "e", @@ -730,7 +767,7 @@ ClockGetOrParseScanFormat( switch (*p) { case '%': if (1) { - ClockScanTokenMap * maps = ScnSTokenMap; + ClockScanTokenMap * scnMap = ScnSTokenMap; const char *mapIndex = ScnSTokenMapIndex, **wrapIndex = ScnSTokenWrapMapIndex; if (p+1 >= e) { @@ -748,13 +785,13 @@ ClockGetOrParseScanFormat( continue; break; case 'E': - maps = ScnETokenMap, + scnMap = ScnETokenMap, mapIndex = ScnETokenMapIndex, wrapIndex = ScnETokenWrapMapIndex; p++; break; case 'O': - maps = ScnOTokenMap, + scnMap = ScnOTokenMap, mapIndex = ScnOTokenMapIndex, wrapIndex = ScnOTokenWrapMapIndex; p++; @@ -778,7 +815,7 @@ ClockGetOrParseScanFormat( goto word_tok; } } - tok->map = &ScnSTokenMap[cp - mapIndex]; + tok->map = &scnMap[cp - mapIndex]; tok->tokWord.start = p; /* calculate look ahead value by standing together tokens */ if (tok > fss->scnTok) { @@ -928,7 +965,7 @@ ClockScan( size = p - yyInput; if (size < map->minSize) { /* missing input -> error */ - goto error; + goto not_match; } /* string 2 number, put number into info structure by offset */ p = yyInput; x = p + size; @@ -953,10 +990,10 @@ ClockScan( case TCL_OK: break; case TCL_RETURN: - goto done; + goto not_match; break; default: - goto error; + goto done; break; }; p = yyInput; @@ -967,7 +1004,7 @@ ClockScan( if (opts->flags & CLF_STRICT) { if (!isspace(UCHAR(*p))) { /* unmatched -> error */ - goto error; + goto not_match; } p++; } @@ -976,21 +1013,13 @@ ClockScan( } break; case CTOKT_WORD: - x = tok->tokWord.start; - if (x == tok->tokWord.end) { /* single char word */ - if (*p != *x) { - /* no match -> error */ - goto error; - } - p++; - continue; - } - /* multi-char word */ - while (p < end && x < tok->tokWord.end && *p++ == *x++) {}; - if (x < tok->tokWord.end) { + x = FindWordEnd(tok, p, end); + if (!x) { /* no match -> error */ - goto error; + goto not_match; } + p = x; + continue; break; } } @@ -1002,7 +1031,7 @@ ClockScan( /* check end was reached */ if (p < end) { /* something after last token - wrong format */ - goto error; + goto not_match; } /* invalidate result */ @@ -1045,15 +1074,15 @@ ClockScan( overflow: - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "integer value too large to represent", -1)); - Tcl_SetErrorCode(interp, "CLOCK", "integervalueTooLarge", NULL); + Tcl_SetResult(interp, "requested date too large to represent", + TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "dateTooLarge", NULL); goto done; -error: +not_match: - Tcl_SetResult(interp, - "input string does not match supplied format", TCL_STATIC); + Tcl_SetResult(interp, "input string does not match supplied format", + TCL_STATIC); Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); done: diff --git a/generic/tclDate.h b/generic/tclDate.h index d97cd3c..1c51a02 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -35,6 +35,22 @@ #define CLF_INVALIDATE_JULIANDAY (1 << 7) /* assemble julianDay using year, month, etc. */ #define CLF_INVALIDATE_SECONDS (1 << 8) /* assemble localSeconds (and seconds at end) */ + +/* + * Enumeration of the msgcat literals used in [clock] + */ + +typedef enum ClockMsgCtLiteral { + MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, + MCLIT_LOCALE_NUMERALS, + MCLIT__END +} ClockMsgCtLiteral; + +#define CLOCK_LOCALE_LITERAL_ARRAY(litarr, pref) static const char *const litarr[] = { \ + pref "MONTHS_FULL", pref "MONTHS_ABBREV", \ + pref "LOCALE_NUMERALS", \ +} + /* * Primitives to safe set, reset and free references. */ @@ -176,16 +192,19 @@ ClockInitDateInfo(DateInfo *info) { #define CLF_EXTENDED (1 << 4) #define CLF_STRICT (1 << 8) +#define CLF_LOCALE_USED (1 << 15) typedef struct ClockFmtScnCmdArgs { - ClientData clientData, /* Opaque pointer to literal pool, etc. */ - Tcl_Interp *interp, /* Tcl interpreter */ + ClientData clientData; /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp; /* Tcl interpreter */ Tcl_Obj *formatObj; /* Format */ Tcl_Obj *localeObj; /* Name of the locale where the time will be expressed. */ Tcl_Obj *timezoneObj; /* Default time zone in which the time will be expressed */ Tcl_Obj *baseObj; /* Base (scan only) */ int flags; /* Flags control scanning */ + + Tcl_Obj *mcDictObj; /* Current dictionary of tcl::clock package for given localeObj*/ } ClockFmtScnCmdArgs; /* @@ -194,7 +213,11 @@ typedef struct ClockFmtScnCmdArgs { typedef struct ClockClientData { int refCount; /* Number of live references. */ - Tcl_Obj **literals; /* Pool of object literals. */ + Tcl_Obj **literals; /* Pool of object literals (common, locale independent). */ + Tcl_Obj **mcLiterals; /* Msgcat object literals with mc-keys for search with locale. */ + Tcl_Obj **mcLitIdxs; /* Msgcat object indices prefixed with _IDX_, + * used for quick dictionary search */ + /* Cache for current clock parameters, imparted via "configure" */ unsigned long LastTZEpoch; int currentYearCentury; @@ -208,6 +231,13 @@ typedef struct ClockClientData { Tcl_Obj *LastUnnormSetupTimeZone; Tcl_Obj *LastSetupTimeZone; Tcl_Obj *LastSetupTZData; + + Tcl_Obj *CurrentLocale; + Tcl_Obj *CurrentLocaleDict; + Tcl_Obj *LastUnnormUsedLocale; + Tcl_Obj *LastUsedLocale; + Tcl_Obj *LastUsedLocaleDict; + /* Cache for last base (last-second fast convert if base/tz not changed) */ struct { Tcl_Obj *timezoneObj; @@ -328,6 +358,15 @@ MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); +/* tclClock.c module declarations */ + +MODULE_SCOPE Tcl_Obj * + ClockMCDict(ClockFmtScnCmdArgs *opts); +MODULE_SCOPE Tcl_Obj * + ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); +MODULE_SCOPE Tcl_Obj * + ClockMCGetListIdxDict(ClockFmtScnCmdArgs *opts, int mcKey); + /* tclClockFmt.c module declarations */ MODULE_SCOPE ClockFmtScnStorage * diff --git a/library/clock.tcl b/library/clock.tcl index ebbecb9..b4632b1 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -289,8 +289,9 @@ proc ::tcl::clock::Initialize {} { # Default configuration - # configure -year-century 2000 \ - # -century-switch 38 + configure -default-locale [mclocale] + #configure -year-century 2000 \ + # -century-switch 38 # Translation table to map Windows TZI onto cities, so that the Olson # rules can apply. In some cases the mapping is ambiguous, so it's wise @@ -2105,6 +2106,51 @@ proc ::tcl::clock::MakeParseCodeFromFields { dateFields parseActions } { #---------------------------------------------------------------------- # +# GetSystemTimeZone -- +# +# Determines the system time zone, which is the default for the +# 'clock' command if no other zone is supplied. +# +# Parameters: +# None. +# +# Results: +# Returns the system time zone. +# +# Side effects: +# Stores the sustem time zone in engine configuration, since +# determining it may be an expensive process. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::GetSystemLocale {} { + if { $::tcl_platform(platform) ne {windows} } { + # On a non-windows platform, the 'system' locale is the same as + # the 'current' locale + + return [mclocale] + } + + # On a windows platform, the 'system' locale is adapted from the + # 'current' locale by applying the date and time formats from the + # Control Panel. First, load the 'current' locale if it's not yet + # loaded + + mcpackagelocale set [mclocale] + + # Make a new locale string for the system locale, and get the + # Control Panel information + + set locale [mclocale]_windows + if { ! [mcpackagelocale present $locale] } { + LoadWindowsDateTimeFormats $locale + } + + return $locale +} + +#---------------------------------------------------------------------- +# # EnterLocale -- # # Switch [mclocale] to a given locale if necessary @@ -2121,33 +2167,12 @@ proc ::tcl::clock::MakeParseCodeFromFields { dateFields parseActions } { #---------------------------------------------------------------------- proc ::tcl::clock::EnterLocale { locale } { - if { $locale eq {system} } { - if { $::tcl_platform(platform) ne {windows} } { - # On a non-windows platform, the 'system' locale is the same as - # the 'current' locale - - set locale current - } else { - # On a windows platform, the 'system' locale is adapted from the - # 'current' locale by applying the date and time formats from the - # Control Panel. First, load the 'current' locale if it's not yet - # loaded - - mcpackagelocale set [mclocale] - - # Make a new locale string for the system locale, and get the - # Control Panel information - - set locale [mclocale]_windows - if { ! [mcpackagelocale present $locale] } { - LoadWindowsDateTimeFormats $locale - } - } - } - if { $locale eq {current}} { + switch -- $locale system { + set locale [GetSystemLocale] + } current { set locale [mclocale] } - # Eventually load the locale + # Select the locale, eventually load it mcpackagelocale set $locale } diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 7f23568..3fd2cdb 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -227,52 +227,61 @@ proc msgcat::mc {src args} { # msgcat::mcget -- # -# Find the translation for the given string based on the given -# locale setting. Check the given namespace first, then look in each -# parent namespace until the source is found. If additional args are -# specified, use the format command to work them into the traslated -# string. -# If no catalog item is found, mcunknown is called in the caller frame -# and its result is returned. +# Return the translation for the given string based on the given +# locale setting or the whole dictionary object of the package/locale. +# Searching of catalog is similar to "msgcat::mc". +# +# Contrary to "msgcat::mc" may additionally load a package catalog +# on demand. # # Arguments: -# src The string to translate. -# args Args to pass to the format command +# ns The package namespace (as catalog selector). +# loc The locale used for translation. +# {src} The string to translate. +# {args} Args to pass to the format command # # Results: # Returns the translated string. Propagates errors thrown by the # format command. -proc msgcat::mcget {ns loc src args} { +proc msgcat::mcget {ns loc args} { variable Msgs if {$loc eq {C}} { set loclist [PackagePreferences $ns] + set loc [lindex $loclist 0] } else { + set loc [string tolower $loc] variable PackageConfig - # if {![dict exists $PackageConfig $ns $loc]} { - # set loc [mclocale] - # } - set loclist [dict get $PackageConfig locales $ns $loc] + # get locales list for given locale (de_de -> {de_de de {}}) + if {[catch { + set loclist [dict get $PackageConfig locales $ns $loc] + }]} { + # lazy load catalog on demand + mcpackagelocale load $loc $ns + set loclist [dict get $PackageConfig locales $ns $loc] + } } + if {![llength $args]} { + # get whole catalog: + return [msgcat::Merge $ns $loclist] + } + set src [lindex $args 0] + # search translation for each locale (regarding parent namespaces) for {set nscur $ns} {$nscur != ""} {set nscur [namespace parent $nscur]} { foreach loc $loclist { if {[dict exists $Msgs $nscur $loc $src]} { - if {[llength $args]} { - return [format [dict get $Msgs $nscur $loc $src] {*}$args] + if {[llength $args] > 1} { + return [format [dict get $Msgs $nscur $loc $src] \ + {*}[lrange $args 1 end]] } else { return [dict get $Msgs $nscur $loc $src] } } } } - # call package local or default unknown command - set args [linsert $args 0 $loclist $src] - switch -exact -- [Invoke unknowncmd $args $ns result 1] { - 0 { return [uplevel 1 [linsert $args 0 [namespace origin mcunknown]]] } - 1 { return [DefaultUnknown {*}$args] } - default { return $result } - } + # get with package default locale + mcget $ns [lindex $loclist 0] {*}$args } # msgcat::mcexists -- @@ -465,6 +474,10 @@ proc msgcat::mcloadedlocales {subcommand} { # items, if the former locale was the default locale. # Returns the normalized set locale. # The default locale is taken, if locale is not given. +# load +# Load a package locale without set it (lazy loading from mcget). +# Returns the normalized set locale. +# The default locale is taken, if locale is not given. # get # Get the locale valid for this package. # isset @@ -492,7 +505,7 @@ proc msgcat::mcloadedlocales {subcommand} { # Results: # Empty string, if not stated differently for the subcommand -proc msgcat::mcpackagelocale {subcommand {locale ""}} { +proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} { # todo: implement using an ensemble variable Loclist variable LoadedLocales @@ -512,7 +525,9 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { } set locale [string tolower $locale] } - set ns [uplevel 1 {::namespace current}] + if {$ns eq ""} { + set ns [uplevel 1 {::namespace current}] + } switch -exact -- $subcommand { get { return [lindex [PackagePreferences $ns] 0] } @@ -520,7 +535,7 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { loaded { return [PackageLocales $ns] } present { return [expr {$locale in [PackageLocales $ns]} ]} isset { return [dict exists $PackageConfig loclist $ns] } - set { # set a package locale or add a package locale + set - load { # set a package locale or add a package locale # Copy the default locale if no package locale set so far if {![dict exists $PackageConfig loclist $ns]} { @@ -530,18 +545,21 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { # Check if changed set loclist [dict get $PackageConfig loclist $ns] - if {! [info exists locale] || $locale eq [lindex $loclist 0] } { + if {[llength [info level 0]] == 2 || $locale eq [lindex $loclist 0] } { return [lindex $loclist 0] } # Change loclist set loclist [GetPreferences $locale] set locale [lindex $loclist 0] - dict set PackageConfig loclist $ns $loclist - dict set PackageConfig locales $ns $locale $loclist + if {$subcommand eq {set}} { + # set loclist + dict set PackageConfig loclist $ns $loclist + } # load eventual missing locales set loadedLocales [dict get $PackageConfig loadedlocales $ns] + dict set PackageConfig locales $ns $locale $loclist if {$locale in $loadedLocales} { return $locale } set loadLocales [ListComplement $loadedLocales $loclist] dict set PackageConfig loadedlocales $ns\ @@ -899,6 +917,39 @@ proc msgcat::Load {ns locales {callbackonly 0}} { return $x } +# msgcat::Merge -- +# +# Merge message catalog dictionaries to one dictionary. +# +# Arguments: +# ns Namespace (equal package) to load the message catalog. +# locales List of locales to merge. +# +# Results: +# Returns the merged dictionary of message catalogs. +proc msgcat::Merge {ns locales} { + variable Merged + if {![catch { + set mrgcat [dict get $Merged $ns [set loc [lindex $locales 0]]] + }]} { + return $mrgcat + } + variable Msgs + # Merge sequential locales (in reverse order, e. g. {} -> en -> en_en): + if {[llength $locales] > 1} { + set mrgcat [msgcat::Merge $ns [lrange $locales 1 end]] + catch { + set mrgcat [dict merge $mrgcat [dict get $Msgs $ns $loc]] + } + } else { + catch { + set mrgcat [dict get $Msgs $ns $loc] + } + } + dict set Merged $ns $loc $mrgcat + return $mrgcat +} + # msgcat::Invoke -- # # Invoke a set of registered callbacks. @@ -971,6 +1022,7 @@ proc msgcat::Invoke {index arglist {ns ""} {resultname ""} {failerror 0}} { proc msgcat::mcset {locale src {dest ""}} { variable Msgs + variable Merged if {[llength [info level 0]] == 3} { ;# dest not specified set dest $src } @@ -980,6 +1032,7 @@ proc msgcat::mcset {locale src {dest ""}} { set locale [string tolower $locale] dict set Msgs $ns $locale $src $dest + dict unset Merged $ns return $dest } @@ -1019,6 +1072,7 @@ proc msgcat::mcflset {src {dest ""}} { proc msgcat::mcmset {locale pairs} { variable Msgs + variable Merged set length [llength $pairs] if {$length % 2} { @@ -1032,6 +1086,7 @@ proc msgcat::mcmset {locale pairs} { foreach {src dest} $pairs { dict set Msgs $ns $locale $src $dest } + dict unset Merged $ns return [expr {$length / 2}] } diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index fd24068..a005648 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -19,10 +19,11 @@ ## set testing defaults: set ::env(TCL_TZ) :CET -## warm-up (load clock.tcl, system zones, etc.): +## warm-up (load clock.tcl, system zones, locales, etc.): clock scan "" -gmt 1 clock scan "" clock scan "" -timezone :CET +clock scan "" -format "" -locale en ## ------------------------------------------ @@ -37,6 +38,20 @@ proc _test_get_commands {lst} { proc _test_out_total {} { upvar _ _ + if {![llength $_(ittm)]} { + puts "" + return + } + + set mintm 0x7fffffff + set maxtm 0 + set i 0 + foreach tm $_(ittm) { + if {$tm > $maxtm} {set maxtm $tm; set maxi $i} + if {$tm < $mintm} {set mintm $tm; set mini $i} + incr i + } + puts [string repeat ** 40] puts [format "Total %d cases in %.2f sec.:" [llength $_(itcnt)] [expr {[llength $_(itcnt)] * $_(reptime) / 1000.0}]] lset _(m) 0 [format %.6f [expr [join $_(ittm) +]]] @@ -48,6 +63,16 @@ proc _test_out_total {} { lset _(m) 2 [expr {[lindex $_(m) 2] / [llength $_(itcnt)]}] lset _(m) 4 [expr {[lindex $_(m) 2] * (1000 / $_(reptime))}] puts $_(m) + puts "Min:" + lset _(m) 0 [lindex $_(ittm) $mini] + lset _(m) 2 [lindex $_(itcnt) $mini] + lset _(m) 2 [lindex $_(itrate) $mini] + puts $_(m) + puts "Max:" + lset _(m) 0 [lindex $_(ittm) $maxi] + lset _(m) 2 [lindex $_(itcnt) $maxi] + lset _(m) 2 [lindex $_(itrate) $maxi] + puts $_(m) puts [string repeat ** 40] puts "" } @@ -123,8 +148,10 @@ proc test-scan {{reptime 1000}} { # Scan : century, lookup table month {clock scan {1970 Jan 2} -format {%C%y %b %d} -locale en -gmt 1} - # Scan : century, lookup table month and day + # Scan : century, lookup table month and day (both entries are first) {clock scan {1970 Jan 02} -format {%C%y %b %Od} -locale en -gmt 1} + # Scan : century, lookup table month and day (list scan: entries with position 12 / 31) + {clock scan {2016 Dec 31} -format {%C%y %b %Od} -locale en -gmt 1} break diff --git a/tests/clock.test b/tests/clock.test index 9e3dbd7..22b5bc1 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18553,12 +18553,12 @@ test clock-6.8 {input of seconds} { } 9223372036854775807 test clock-6.9 {input of seconds - overflow} { - list [catch {clock scan -9223372036854775809 -format %s -gmt true} result] $result -} {1 {integer value too large to represent}} + list [catch {clock scan -9223372036854775809 -format %s -gmt true} result] $result $::errorCode +} {1 {requested date too large to represent} {CLOCK dateTooLarge}} test clock-6.10 {input of seconds - overflow} { - list [catch {clock scan 9223372036854775808 -format %s -gmt true} result] $result -} {1 {integer value too large to represent}} + list [catch {clock scan 9223372036854775808 -format %s -gmt true} result] $result $::errorCode +} {1 {requested date too large to represent} {CLOCK dateTooLarge}} test clock-6.11 {input of seconds - two values} { clock scan {1 2} -format {%s %s} -gmt true -- cgit v0.12 From c52322d40935741e19091f547619c69a831515e1 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:28:25 +0000 Subject: improve LocalizeFormat, internal caching of localized formats inside msgcat for locale and format objects smart reference introduced in dict (smart pointer with 0 object reference but increase dict-reference, provide changeable locale dict) --- generic/tclClock.c | 64 ++++++++++++++++++++++-- generic/tclClockFmt.c | 75 ++++++++++++++++++++-------- generic/tclDate.h | 10 ++-- generic/tclDictObj.c | 122 ++++++++++++++++++++++++++++++++++------------ generic/tclInt.h | 1 + library/clock.tcl | 83 ++++++++++++++++++++----------- library/init.tcl | 2 +- library/msgcat/msgcat.tcl | 3 +- 8 files changed, 269 insertions(+), 91 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 166a4b3..e066812 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -60,6 +60,7 @@ typedef enum ClockLiteral { LIT_GETSYSTEMTIMEZONE, LIT_SETUPTIMEZONE, LIT_MCGET, LIT_TCL_CLOCK, + LIT_LOCALIZE_FORMAT, #if 0 LIT_FREESCAN, #endif @@ -82,7 +83,8 @@ static const char *const Literals[] = { "::tcl::clock::TZData", "::tcl::clock::GetSystemTimeZone", "::tcl::clock::SetupTimeZone", - "::msgcat::mcget", "::tcl::clock" + "::msgcat::mcget", "::tcl::clock", + "::tcl::clock::LocalizeFormat" #if 0 "::tcl::clock::FreeScan" #endif @@ -487,7 +489,6 @@ MODULE_SCOPE Tcl_Obj * ClockMCDict(ClockFmtScnCmdArgs *opts) { ClockClientData *dataPtr = opts->clientData; - Tcl_Obj *callargs[3]; /* if dict not yet retrieved */ if (opts->mcDictObj == NULL) { @@ -518,6 +519,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) } if (opts->mcDictObj == NULL) { + Tcl_Obj *callargs[3]; /* get msgcat dictionary - ::msgcat::mcget ::tcl::clock locale */ callargs[0] = dataPtr->literals[LIT_MCGET]; callargs[1] = dataPtr->literals[LIT_TCL_CLOCK]; @@ -528,6 +530,11 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) } opts->mcDictObj = Tcl_GetObjResult(opts->interp); + /* be sure that object reference not increases (dict changeable) */ + if (opts->mcDictObj->refCount > 0) { + /* smart reference (shared dict as object with no ref-counter) */ + opts->mcDictObj = Tcl_DictObjSmartRef(opts->interp, opts->mcDictObj); + } if ( opts->localeObj == dataPtr->CurrentLocale ) { Tcl_SetObjRef(dataPtr->CurrentLocaleDict, opts->mcDictObj); } else { @@ -535,6 +542,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) Tcl_UnsetObjRef(dataPtr->LastUnnormUsedLocale); Tcl_SetObjRef(dataPtr->LastUsedLocaleDict, opts->mcDictObj); } + Tcl_ResetResult(opts->interp); } } @@ -626,6 +634,56 @@ ClockMCGetListIdxDict( return valObj; } +MODULE_SCOPE Tcl_Obj * +ClockLocalizeFormat( + ClockFmtScnCmdArgs *opts) +{ + ClockClientData *dataPtr = opts->clientData; + Tcl_Obj *valObj, *keyObj; + + keyObj = ClockFrmObjGetLocFmtKey(opts->interp, opts->formatObj); + + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return NULL; + } + + /* try to find in cache within mc-catalog */ + if (Tcl_DictObjGet(NULL, opts->mcDictObj, + keyObj, &valObj) != TCL_OK) { + return NULL; + } + if (valObj == NULL) { + Tcl_Obj *callargs[4]; + /* call LocalizeFormat locale format fmtkey */ + callargs[0] = dataPtr->literals[LIT_LOCALIZE_FORMAT]; + callargs[1] = opts->localeObj; + callargs[2] = opts->formatObj; + callargs[3] = keyObj; + Tcl_IncrRefCount(keyObj); + if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK + ) { + Tcl_DecrRefCount(keyObj); + return NULL; + } + + valObj = Tcl_GetObjResult(opts->interp); + + if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, + keyObj, valObj) != TCL_OK + ) { + Tcl_DecrRefCount(keyObj); + return NULL; + } + + Tcl_DecrRefCount(keyObj); + Tcl_ResetResult(opts->interp); + } + + return (opts->formatObj = valObj); +} + /* *---------------------------------------------------------------------- */ @@ -2936,7 +2994,7 @@ ClockScanObjCmd( #endif else { /* Use compiled version of Scan - */ - + ret = ClockScan(clientData, interp, info, objv[1], &opts); } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index a3c7f20..184b52a 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -308,14 +308,14 @@ Tcl_ObjType ClockFmtObjType = { #define ObjClockFmtScn(objPtr) \ (ClockFmtScnStorage *)objPtr->internalRep.twoPtrValue.ptr1; -#define SetObjLitStorage(objPtr, lit) \ - objPtr->internalRep.twoPtrValue.ptr2 = lit -#define ObjLitStorage(objPtr) \ - (ClockLitStorage *)objPtr->internalRep.twoPtrValue.ptr2; - -#define ClockFmtObj_SetObjIntRep(objPtr, fss, lit) \ - objPtr->internalRep.twoPtrValue.ptr1 = fss, \ - objPtr->internalRep.twoPtrValue.ptr2 = lit, \ +#define SetObjLocFmtKey(objPtr, key) \ + Tcl_InitObjRef((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2, key) +#define ObjLocFmtKey(objPtr) \ + ((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2) + +#define ClockFmtObj_SetObjIntRep(objPtr, fss, key) \ + objPtr->internalRep.twoPtrValue.ptr1 = fss; \ + Tcl_InitObjRef((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2, key); \ objPtr->typePtr = &ClockFmtObjType; /* @@ -327,7 +327,6 @@ ClockFmtObj_DupInternalRep(srcPtr, copyPtr) Tcl_Obj *copyPtr; { ClockFmtScnStorage *fss = ObjClockFmtScn(srcPtr); - // ClockLitStorage *lit = ObjLitStorage(srcPtr); if (fss != NULL) { Tcl_MutexLock(&ClockFmtMutex); @@ -335,7 +334,7 @@ ClockFmtObj_DupInternalRep(srcPtr, copyPtr) Tcl_MutexUnlock(&ClockFmtMutex); } - ClockFmtObj_SetObjIntRep(copyPtr, fss, NULL); + ClockFmtObj_SetObjIntRep(copyPtr, fss, ObjLocFmtKey(srcPtr)); /* if no format representation, dup string representation */ if (fss == NULL) { @@ -352,7 +351,6 @@ ClockFmtObj_FreeInternalRep(objPtr) Tcl_Obj *objPtr; { ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); - // ClockLitStorage *lit = ObjLitStorage(objPtr); if (fss != NULL) { Tcl_MutexLock(&ClockFmtMutex); /* decrement object reference count of format/scan storage */ @@ -368,7 +366,7 @@ ClockFmtObj_FreeInternalRep(objPtr) Tcl_MutexUnlock(&ClockFmtMutex); } SetObjClockFmtScn(objPtr, NULL); - SetObjLitStorage(objPtr, NULL); + Tcl_UnsetObjRef(ObjLocFmtKey(objPtr)); objPtr->typePtr = NULL; }; /* @@ -379,16 +377,18 @@ ClockFmtObj_SetFromAny(interp, objPtr) Tcl_Interp *interp; Tcl_Obj *objPtr; { - ClockFmtScnStorage *fss; - const char *strFmt = TclGetString(objPtr); - - if (!strFmt || (fss = FindOrCreateFmtScnStorage(interp, strFmt)) == NULL) { - return TCL_ERROR; - } - + /* validate string representation before free old internal represenation */ + (void)TclGetString(objPtr); + + /* free old internal represenation */ if (objPtr->typePtr && objPtr->typePtr->freeIntRepProc) objPtr->typePtr->freeIntRepProc(objPtr); - ClockFmtObj_SetObjIntRep(objPtr, fss, NULL); + + /* initial state of format object */ + objPtr->internalRep.twoPtrValue.ptr1 = NULL; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; + objPtr->typePtr = &ClockFmtObjType; + return TCL_OK; }; /* @@ -415,6 +415,33 @@ ClockFmtObj_UpdateString(objPtr) /* *---------------------------------------------------------------------- + */ +MODULE_SCOPE Tcl_Obj* +ClockFrmObjGetLocFmtKey( + Tcl_Interp *interp, + Tcl_Obj *objPtr) +{ + Tcl_Obj *keyObj; + + if (objPtr->typePtr != &ClockFmtObjType) { + if (ClockFmtObj_SetFromAny(interp, objPtr) != TCL_OK) { + return NULL; + } + } + + keyObj = ObjLocFmtKey(objPtr); + if (keyObj) { + return keyObj; + } + + keyObj = Tcl_ObjPrintf("FMT_%s", TclGetString(objPtr)); + SetObjLocFmtKey(objPtr, keyObj); + + return keyObj; +} + +/* + *---------------------------------------------------------------------- * * Tcl_GetClockFrmScnFromObj -- * @@ -731,7 +758,7 @@ static ClockScanTokenMap ScnWordTokenMap = { ClockScanToken * ClockGetOrParseScanFormat( Tcl_Interp *interp, /* Tcl interpreter */ - Tcl_Obj *formatObj) /* Format container */ + Tcl_Obj *formatObj) /* Format container */ { ClockFmtScnStorage *fss; ClockScanToken *tok; @@ -889,6 +916,12 @@ ClockScan( unsigned short int flags = 0; int ret = TCL_ERROR; + /* get localized format */ + + if (ClockLocalizeFormat(opts) == NULL) { + return TCL_ERROR; + } + if ((tok = ClockGetOrParseScanFormat(interp, opts->formatObj)) == NULL) { return TCL_ERROR; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 1c51a02..62fa693 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -345,10 +345,6 @@ typedef struct ClockFmtScnStorage { * stored by offset +sizeof(self) */ } ClockFmtScnStorage; -typedef struct ClockLitStorage { - int dummy; -} ClockLitStorage; - /* * Prototypes of module functions. */ @@ -366,9 +362,15 @@ MODULE_SCOPE Tcl_Obj * ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); MODULE_SCOPE Tcl_Obj * ClockMCGetListIdxDict(ClockFmtScnCmdArgs *opts, int mcKey); +MODULE_SCOPE Tcl_Obj * + ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); /* tclClockFmt.c module declarations */ +MODULE_SCOPE Tcl_Obj* + ClockFrmObjGetLocFmtKey(Tcl_Interp *interp, + Tcl_Obj *objPtr); + MODULE_SCOPE ClockFmtScnStorage * Tcl_GetClockFrmScnFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr); diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 1115999..3944173 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -51,6 +51,8 @@ static int DictSetCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); static int DictSizeCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); +static int DictSmartRefCmd(ClientData dummy, Tcl_Interp *interp, + int objc, Tcl_Obj *const *objv); static int DictUnsetCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); static int DictUpdateCmd(ClientData dummy, Tcl_Interp *interp, @@ -98,6 +100,7 @@ static const EnsembleImplMap implementationMap[] = { {"replace", DictReplaceCmd, NULL, NULL, NULL, 0 }, {"set", DictSetCmd, TclCompileDictSetCmd, NULL, NULL, 0 }, {"size", DictSizeCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0 }, + {"smartref",DictSmartRefCmd,NULL, NULL, NULL, 0 }, {"unset", DictUnsetCmd, TclCompileDictUnsetCmd, NULL, NULL, 0 }, {"update", DictUpdateCmd, TclCompileDictUpdateCmd, NULL, NULL, 0 }, {"values", DictValuesCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0 }, @@ -142,7 +145,7 @@ typedef struct Dict { * the entries in the order that they are * created. */ int epoch; /* Epoch counter */ - size_t refCount; /* Reference counter (see above) */ + int refcount; /* Reference counter (see above) */ Tcl_Obj *chain; /* Linked list used for invalidating the * string representations of updated nested * dictionaries. */ @@ -392,7 +395,7 @@ DupDictInternalRep( newDict->epoch = 0; newDict->chain = NULL; - newDict->refCount = 1; + newDict->refcount = 1; /* * Store in the object. @@ -427,7 +430,8 @@ FreeDictInternalRep( { Dict *dict = DICT(dictPtr); - if (dict->refCount-- <= 1) { + dict->refcount--; + if (dict->refcount <= 0) { DeleteDict(dict); } dictPtr->typePtr = NULL; @@ -712,7 +716,7 @@ SetDictFromAny( TclFreeIntRep(objPtr); dict->epoch = 0; dict->chain = NULL; - dict->refCount = 1; + dict->refcount = 1; DICT(objPtr) = dict; objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclDictType; @@ -1116,7 +1120,7 @@ Tcl_DictObjFirst( searchPtr->dictionaryPtr = (Tcl_Dict) dict; searchPtr->epoch = dict->epoch; searchPtr->next = cPtr->nextPtr; - dict->refCount++; + dict->refcount++; if (keyPtrPtr != NULL) { *keyPtrPtr = Tcl_GetHashKey(&dict->table, &cPtr->entry); } @@ -1230,7 +1234,8 @@ Tcl_DictObjDone( if (searchPtr->epoch != -1) { searchPtr->epoch = -1; dict = (Dict *) searchPtr->dictionaryPtr; - if (dict->refCount-- <= 1) { + dict->refcount--; + if (dict->refcount <= 0) { DeleteDict(dict); } } @@ -1382,7 +1387,7 @@ Tcl_NewDictObj(void) InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refCount = 1; + dict->refcount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1432,7 +1437,7 @@ Tcl_DbNewDictObj( InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refCount = 1; + dict->refcount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1957,6 +1962,77 @@ DictSizeCmd( /* *---------------------------------------------------------------------- + */ + +Tcl_Obj * +Tcl_DictObjSmartRef( + Tcl_Interp *interp, + Tcl_Obj *dictPtr) +{ + Tcl_Obj *result; + Dict *dict; + + if (dictPtr->typePtr != &tclDictType + && SetDictFromAny(interp, dictPtr) != TCL_OK) { + return NULL; + } + + dict = DICT(dictPtr); + + result = Tcl_NewObj(); + DICT(result) = dict; + dict->refcount++; + result->internalRep.twoPtrValue.ptr2 = NULL; + result->typePtr = &tclDictType; + + return result; +} + +/* + *---------------------------------------------------------------------- + * + * DictSmartRefCmd -- + * + * This function implements the "dict smartref" Tcl command. See the user + * documentation for details on what it does, and TIP#111 for the formal + * specification. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + +static int +DictSmartRefCmd( + ClientData dummy, + Tcl_Interp *interp, + int objc, + Tcl_Obj *const *objv) +{ + Tcl_Obj *result; + Dict *dict; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "dictionary"); + return TCL_ERROR; + } + + result = Tcl_DictObjSmartRef(interp, objv[1]); + if (result == NULL) { + return TCL_ERROR; + } + + Tcl_SetObjResult(interp, result); + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- * * DictExistsCmd -- * @@ -2280,7 +2356,7 @@ DictAppendCmd( Tcl_Obj *const *objv) { Tcl_Obj *dictPtr, *valuePtr, *resultPtr; - int allocatedDict = 0; + int i, allocatedDict = 0; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?value ...?"); @@ -2305,33 +2381,15 @@ DictAppendCmd( if ((objc > 3) || (valuePtr == NULL)) { /* Only go through append activites when something will change. */ - Tcl_Obj *appendObjPtr = NULL; - - if (objc > 3) { - /* Something to append */ - - if (objc == 4) { - appendObjPtr = objv[3]; - } else if (TCL_OK != TclStringCatObjv(interp, /* inPlace */ 1, - objc-3, objv+3, &appendObjPtr)) { - return TCL_ERROR; - } - } - if (appendObjPtr == NULL) { - /* => (objc == 3) => (valuePtr == NULL) */ + if (valuePtr == NULL) { TclNewObj(valuePtr); - } else if (valuePtr == NULL) { - valuePtr = appendObjPtr; - appendObjPtr = NULL; + } else if (Tcl_IsShared(valuePtr)) { + valuePtr = Tcl_DuplicateObj(valuePtr); } - if (appendObjPtr) { - if (Tcl_IsShared(valuePtr)) { - valuePtr = Tcl_DuplicateObj(valuePtr); - } - - Tcl_AppendObjToObj(valuePtr, appendObjPtr); + for (i=3 ; i Date: Tue, 10 Jan 2017 22:30:24 +0000 Subject: improve LocalizeFormat, internal caching of localized formats inside msgcat for locale and format objects smart reference introduced in dict (smart pointer with 0 object reference but increase dict-reference, provide changeable locale dict) code review --- generic/tclClock.c | 98 +------------------- generic/tclClockFmt.c | 229 ++++++++++++++++++++++++++++++---------------- generic/tclDate.h | 52 ++++++++++- library/clock.tcl | 19 ++-- tests-perf/clock.perf.tcl | 6 +- 5 files changed, 214 insertions(+), 190 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index e066812..08bc6ef 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -42,53 +42,7 @@ static const int daysInPriorMonths[2][13] = { * Enumeration of the string literals used in [clock] */ -typedef enum ClockLiteral { - LIT__NIL, - LIT__DEFAULT_FORMAT, - LIT_BCE, LIT_C, - LIT_CANNOT_USE_GMT_AND_TIMEZONE, - LIT_CE, - LIT_DAYOFMONTH, LIT_DAYOFWEEK, LIT_DAYOFYEAR, - LIT_ERA, LIT_GMT, LIT_GREGORIAN, - LIT_INTEGER_VALUE_TOO_LARGE, - LIT_ISO8601WEEK, LIT_ISO8601YEAR, - LIT_JULIANDAY, LIT_LOCALSECONDS, - LIT_MONTH, - LIT_SECONDS, LIT_TZNAME, LIT_TZOFFSET, - LIT_YEAR, - LIT_TZDATA, - LIT_GETSYSTEMTIMEZONE, - LIT_SETUPTIMEZONE, - LIT_MCGET, LIT_TCL_CLOCK, - LIT_LOCALIZE_FORMAT, -#if 0 - LIT_FREESCAN, -#endif - LIT__END -} ClockLiteral; -static const char *const Literals[] = { - "", - "%a %b %d %H:%M:%S %Z %Y", - "BCE", "C", - "cannot use -gmt and -timezone in same call", - "CE", - "dayOfMonth", "dayOfWeek", "dayOfYear", - "era", ":GMT", "gregorian", - "integer value too large to represent", - "iso8601Week", "iso8601Year", - "julianDay", "localSeconds", - "month", - "seconds", "tzName", "tzOffset", - "year", - "::tcl::clock::TZData", - "::tcl::clock::GetSystemTimeZone", - "::tcl::clock::SetupTimeZone", - "::msgcat::mcget", "::tcl::clock", - "::tcl::clock::LocalizeFormat" -#if 0 - "::tcl::clock::FreeScan" -#endif -}; +CLOCK_LITERAL_ARRAY(Literals); /* Msgcat literals for exact match (mcKey) */ CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLiterals, ""); @@ -634,56 +588,6 @@ ClockMCGetListIdxDict( return valObj; } -MODULE_SCOPE Tcl_Obj * -ClockLocalizeFormat( - ClockFmtScnCmdArgs *opts) -{ - ClockClientData *dataPtr = opts->clientData; - Tcl_Obj *valObj, *keyObj; - - keyObj = ClockFrmObjGetLocFmtKey(opts->interp, opts->formatObj); - - if (opts->mcDictObj == NULL) { - ClockMCDict(opts); - if (opts->mcDictObj == NULL) - return NULL; - } - - /* try to find in cache within mc-catalog */ - if (Tcl_DictObjGet(NULL, opts->mcDictObj, - keyObj, &valObj) != TCL_OK) { - return NULL; - } - if (valObj == NULL) { - Tcl_Obj *callargs[4]; - /* call LocalizeFormat locale format fmtkey */ - callargs[0] = dataPtr->literals[LIT_LOCALIZE_FORMAT]; - callargs[1] = opts->localeObj; - callargs[2] = opts->formatObj; - callargs[3] = keyObj; - Tcl_IncrRefCount(keyObj); - if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK - ) { - Tcl_DecrRefCount(keyObj); - return NULL; - } - - valObj = Tcl_GetObjResult(opts->interp); - - if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, - keyObj, valObj) != TCL_OK - ) { - Tcl_DecrRefCount(keyObj); - return NULL; - } - - Tcl_DecrRefCount(keyObj); - Tcl_ResetResult(opts->interp); - } - - return (opts->formatObj = valObj); -} - /* *---------------------------------------------------------------------- */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 184b52a..daedb26 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -233,65 +233,6 @@ static Tcl_HashKeyType ClockFmtScnStorageHashKeyType; /* - *---------------------------------------------------------------------- - */ - -static ClockFmtScnStorage * -FindOrCreateFmtScnStorage( - Tcl_Interp *interp, - const char *strFmt) -{ - ClockFmtScnStorage *fss = NULL; - int new; - Tcl_HashEntry *hPtr; - - Tcl_MutexLock(&ClockFmtMutex); - - /* if not yet initialized */ - if (!initialized) { - /* initialize type */ - memcpy(&ClockFmtScnStorageHashKeyType, &tclStringHashKeyType, sizeof(tclStringHashKeyType)); - ClockFmtScnStorageHashKeyType.allocEntryProc = ClockFmtScnStorageAllocProc; - ClockFmtScnStorageHashKeyType.freeEntryProc = ClockFmtScnStorageFreeProc; - - /* initialize hash table */ - Tcl_InitCustomHashTable(&FmtScnHashTable, TCL_CUSTOM_TYPE_KEYS, - &ClockFmtScnStorageHashKeyType); - - initialized = 1; - Tcl_CreateExitHandler(ClockFrmScnFinalize, NULL); - } - - /* get or create entry (and alocate storage) */ - hPtr = Tcl_CreateHashEntry(&FmtScnHashTable, strFmt, &new); - if (hPtr != NULL) { - - fss = FmtScn4HashEntry(hPtr); - - #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 - /* unlink if it is currently in GC */ - if (new == 0 && fss->objRefCount == 0) { - ClockFmtScnStorage_GC_Out(fss); - } - #endif - - /* new reference, so increment in lock right now */ - fss->objRefCount++; - } - - Tcl_MutexUnlock(&ClockFmtMutex); - - if (fss == NULL && interp != NULL) { - Tcl_AppendResult(interp, "retrieve clock format failed \"", - strFmt ? strFmt : "", "\"", NULL); - Tcl_SetErrorCode(interp, "TCL", "EINVAL", NULL); - } - - return fss; -} - - -/* * Type definition. */ @@ -303,20 +244,11 @@ Tcl_ObjType ClockFmtObjType = { ClockFmtObj_SetFromAny /* setFromAnyProc */ }; -#define SetObjClockFmtScn(objPtr, fss) \ - objPtr->internalRep.twoPtrValue.ptr1 = fss #define ObjClockFmtScn(objPtr) \ - (ClockFmtScnStorage *)objPtr->internalRep.twoPtrValue.ptr1; + (*((ClockFmtScnStorage **)&(objPtr)->internalRep.twoPtrValue.ptr1)) -#define SetObjLocFmtKey(objPtr, key) \ - Tcl_InitObjRef((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2, key) #define ObjLocFmtKey(objPtr) \ - ((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2) - -#define ClockFmtObj_SetObjIntRep(objPtr, fss, key) \ - objPtr->internalRep.twoPtrValue.ptr1 = fss; \ - Tcl_InitObjRef((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr2, key); \ - objPtr->typePtr = &ClockFmtObjType; + (*((Tcl_Obj **)&(objPtr)->internalRep.twoPtrValue.ptr2)) /* *---------------------------------------------------------------------- @@ -334,7 +266,15 @@ ClockFmtObj_DupInternalRep(srcPtr, copyPtr) Tcl_MutexUnlock(&ClockFmtMutex); } - ClockFmtObj_SetObjIntRep(copyPtr, fss, ObjLocFmtKey(srcPtr)); + ObjClockFmtScn(copyPtr) = fss; + /* regards special case - format not localizable */ + if (ObjLocFmtKey(srcPtr) != srcPtr) { + Tcl_InitObjRef(ObjLocFmtKey(copyPtr), ObjLocFmtKey(srcPtr)); + } else { + ObjLocFmtKey(copyPtr) = copyPtr; + } + copyPtr->typePtr = &ClockFmtObjType; + /* if no format representation, dup string representation */ if (fss == NULL) { @@ -365,8 +305,12 @@ ClockFmtObj_FreeInternalRep(objPtr) } Tcl_MutexUnlock(&ClockFmtMutex); } - SetObjClockFmtScn(objPtr, NULL); - Tcl_UnsetObjRef(ObjLocFmtKey(objPtr)); + ObjClockFmtScn(objPtr) = NULL; + if (ObjLocFmtKey(objPtr) != objPtr) { + Tcl_UnsetObjRef(ObjLocFmtKey(objPtr)); + } else { + ObjLocFmtKey(objPtr) = NULL; + } objPtr->typePtr = NULL; }; /* @@ -385,8 +329,8 @@ ClockFmtObj_SetFromAny(interp, objPtr) objPtr->typePtr->freeIntRepProc(objPtr); /* initial state of format object */ - objPtr->internalRep.twoPtrValue.ptr1 = NULL; - objPtr->internalRep.twoPtrValue.ptr2 = NULL; + ObjClockFmtScn(objPtr) = NULL; + ObjLocFmtKey(objPtr) = NULL; objPtr->typePtr = &ClockFmtObjType; return TCL_OK; @@ -435,13 +379,74 @@ ClockFrmObjGetLocFmtKey( } keyObj = Tcl_ObjPrintf("FMT_%s", TclGetString(objPtr)); - SetObjLocFmtKey(objPtr, keyObj); + Tcl_InitObjRef(ObjLocFmtKey(objPtr), keyObj); return keyObj; } /* *---------------------------------------------------------------------- + */ + +static ClockFmtScnStorage * +FindOrCreateFmtScnStorage( + Tcl_Interp *interp, + Tcl_Obj *objPtr) +{ + const char *strFmt = TclGetString(objPtr); + ClockFmtScnStorage *fss = NULL; + int new; + Tcl_HashEntry *hPtr; + + Tcl_MutexLock(&ClockFmtMutex); + + /* if not yet initialized */ + if (!initialized) { + /* initialize type */ + memcpy(&ClockFmtScnStorageHashKeyType, &tclStringHashKeyType, sizeof(tclStringHashKeyType)); + ClockFmtScnStorageHashKeyType.allocEntryProc = ClockFmtScnStorageAllocProc; + ClockFmtScnStorageHashKeyType.freeEntryProc = ClockFmtScnStorageFreeProc; + + /* initialize hash table */ + Tcl_InitCustomHashTable(&FmtScnHashTable, TCL_CUSTOM_TYPE_KEYS, + &ClockFmtScnStorageHashKeyType); + + initialized = 1; + Tcl_CreateExitHandler(ClockFrmScnFinalize, NULL); + } + + /* get or create entry (and alocate storage) */ + hPtr = Tcl_CreateHashEntry(&FmtScnHashTable, strFmt, &new); + if (hPtr != NULL) { + + fss = FmtScn4HashEntry(hPtr); + + #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* unlink if it is currently in GC */ + if (new == 0 && fss->objRefCount == 0) { + ClockFmtScnStorage_GC_Out(fss); + } + #endif + + /* new reference, so increment in lock right now */ + fss->objRefCount++; + + ObjClockFmtScn(objPtr) = fss; + } + + Tcl_MutexUnlock(&ClockFmtMutex); + + if (fss == NULL && interp != NULL) { + Tcl_AppendResult(interp, "retrieve clock format failed \"", + strFmt ? strFmt : "", "\"", NULL); + Tcl_SetErrorCode(interp, "TCL", "EINVAL", NULL); + } + + return fss; +} + +/* + *---------------------------------------------------------------------- * * Tcl_GetClockFrmScnFromObj -- * @@ -475,8 +480,7 @@ Tcl_GetClockFrmScnFromObj( fss = ObjClockFmtScn(objPtr); if (fss == NULL) { - const char *strFmt = TclGetString(objPtr); - fss = FindOrCreateFmtScnStorage(interp, strFmt); + fss = FindOrCreateFmtScnStorage(interp, objPtr); } return fss; @@ -772,7 +776,7 @@ ClockGetOrParseScanFormat( fss = ObjClockFmtScn(formatObj); if (fss == NULL) { - fss = FindOrCreateFmtScnStorage(interp, TclGetString(formatObj)); + fss = FindOrCreateFmtScnStorage(interp, formatObj); if (fss == NULL) { return NULL; } @@ -898,6 +902,72 @@ done: return fss->scnTok; } +MODULE_SCOPE Tcl_Obj * +ClockLocalizeFormat( + ClockFmtScnCmdArgs *opts) +{ + ClockClientData *dataPtr = opts->clientData; + Tcl_Obj *valObj = NULL, *keyObj; + + keyObj = ClockFrmObjGetLocFmtKey(opts->interp, opts->formatObj); + + /* special case - format object is not localizable */ + if (keyObj == opts->formatObj) { + return opts->formatObj; + } + + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return NULL; + } + + /* try to find in cache within locale mc-catalog */ + if (Tcl_DictObjGet(NULL, opts->mcDictObj, + keyObj, &valObj) != TCL_OK) { + return NULL; + } + + /* call LocalizeFormat locale format fmtkey */ + if (valObj == NULL) { + Tcl_Obj *callargs[4]; + callargs[0] = dataPtr->literals[LIT_LOCALIZE_FORMAT]; + callargs[1] = opts->localeObj; + callargs[2] = opts->formatObj; + callargs[3] = keyObj; + Tcl_IncrRefCount(keyObj); + if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK + ) { + goto clean; + } + + valObj = Tcl_GetObjResult(opts->interp); + + /* cache it inside mc-dictionary (this incr. ref count of keyObj/valObj) */ + if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, + keyObj, valObj) != TCL_OK + ) { + valObj = NULL; + goto clean; + } + + /* check special case - format object is not localizable */ + if (valObj == opts->formatObj) { + /* mark it as unlocalizable, by setting self as key (without refcount incr) */ + if (opts->formatObj->typePtr == &ClockFmtObjType) { + Tcl_UnsetObjRef(ObjLocFmtKey(opts->formatObj)); + ObjLocFmtKey(opts->formatObj) = opts->formatObj; + } + } +clean: + + Tcl_UnsetObjRef(keyObj); + Tcl_ResetResult(opts->interp); + } + + return (opts->formatObj = valObj); +} + /* *---------------------------------------------------------------------- */ @@ -917,7 +987,6 @@ ClockScan( int ret = TCL_ERROR; /* get localized format */ - if (ClockLocalizeFormat(opts) == NULL) { return TCL_ERROR; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 62fa693..9f65b1b 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -37,6 +37,53 @@ /* + * Enumeration of the string literals used in [clock] + */ + +typedef enum ClockLiteral { + LIT__NIL, + LIT__DEFAULT_FORMAT, + LIT_BCE, LIT_C, + LIT_CANNOT_USE_GMT_AND_TIMEZONE, + LIT_CE, + LIT_DAYOFMONTH, LIT_DAYOFWEEK, LIT_DAYOFYEAR, + LIT_ERA, LIT_GMT, LIT_GREGORIAN, + LIT_INTEGER_VALUE_TOO_LARGE, + LIT_ISO8601WEEK, LIT_ISO8601YEAR, + LIT_JULIANDAY, LIT_LOCALSECONDS, + LIT_MONTH, + LIT_SECONDS, LIT_TZNAME, LIT_TZOFFSET, + LIT_YEAR, + LIT_TZDATA, + LIT_GETSYSTEMTIMEZONE, + LIT_SETUPTIMEZONE, + LIT_MCGET, LIT_TCL_CLOCK, + LIT_LOCALIZE_FORMAT, + LIT__END +} ClockLiteral; + +#define CLOCK_LITERAL_ARRAY(litarr) static const char *const litarr[] = { \ + "", \ + "%a %b %d %H:%M:%S %Z %Y", \ + "BCE", "C", \ + "cannot use -gmt and -timezone in same call", \ + "CE", \ + "dayOfMonth", "dayOfWeek", "dayOfYear", \ + "era", ":GMT", "gregorian", \ + "integer value too large to represent", \ + "iso8601Week", "iso8601Year", \ + "julianDay", "localSeconds", \ + "month", \ + "seconds", "tzName", "tzOffset", \ + "year", \ + "::tcl::clock::TZData", \ + "::tcl::clock::GetSystemTimeZone", \ + "::tcl::clock::SetupTimeZone", \ + "::msgcat::mcget", "::tcl::clock", \ + "::tcl::clock::LocalizeFormat" \ +} + +/* * Enumeration of the msgcat literals used in [clock] */ @@ -362,8 +409,6 @@ MODULE_SCOPE Tcl_Obj * ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); MODULE_SCOPE Tcl_Obj * ClockMCGetListIdxDict(ClockFmtScnCmdArgs *opts, int mcKey); -MODULE_SCOPE Tcl_Obj * - ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); /* tclClockFmt.c module declarations */ @@ -374,7 +419,8 @@ MODULE_SCOPE Tcl_Obj* MODULE_SCOPE ClockFmtScnStorage * Tcl_GetClockFrmScnFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr); - +MODULE_SCOPE Tcl_Obj * + ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); diff --git a/library/clock.tcl b/library/clock.tcl index 4173174..a532c0d 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -2365,18 +2365,23 @@ proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { dict set LocaleFormats $locale MLST $mlst } - # translate: - set locfmt [string map $mlst $format] - - # Save original format as long as possible, because of internal representation (performance) - if {$locfmt eq $format} { - set locfmt $format - } + # translate copy of format (don't use format object here, because otherwise + # it can lose its internal representation (string map - convert to unicode) + set locfmt [string map $mlst [string range " $format" 1 end]] # cache it: dict set LocaleFormats $locale $fmtkey $locfmt } + # Save original format as long as possible, because of internal + # representation (performance). + # Note that in this case such format will be never localized (also + # using another locales). To prevent this return a duplicate (but + # it may be slower). + if {$locfmt eq $format} { + set locfmt $format + } + return $locfmt } diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index a005648..3c69414 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -132,9 +132,6 @@ proc test-scan {{reptime 1000}} { # Scan : date-time (system time zone without base) {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S"} - # Scan : dynamic format (cacheable) - {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} - # Scan : julian day in gmt {clock scan 2451545 -format %J -gmt 1} # Scan : julian day in system TZ @@ -153,6 +150,9 @@ proc test-scan {{reptime 1000}} { # Scan : century, lookup table month and day (list scan: entries with position 12 / 31) {clock scan {2016 Dec 31} -format {%C%y %b %Od} -locale en -gmt 1} + # Scan : dynamic format (cacheable) + {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} + break # Scan : zone only -- cgit v0.12 From c51ce8e8796729eba5d0dc8d17ff0d7903bebb20 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:30:49 +0000 Subject: list index logic optimized regarding greedy search (don't stop by first found - try to find longest) --- generic/tclClockFmt.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index daedb26..09cbfa4 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -514,7 +514,7 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, int minLen, int maxLen) { Tcl_Obj **lstv; - int lstc, i, l; + int lstc, i, l, lf = -1; const char *s; Tcl_Obj *valObj; @@ -536,16 +536,27 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, if ( l >= minLen && l <= maxLen && strncasecmp(yyInput, s, l) == 0 ) { + /* found, try to find longest value (greedy search) */ + if (l < maxLen && minLen != maxLen) { + lf = i; + minLen = l + 1; + continue; + } *val = i; yyInput += l; break; } } - /* if not found */ + /* if found */ if (i < lstc) { return TCL_OK; } + if (lf >= 0) { + *val = lf; + yyInput += minLen - 1; + return TCL_OK; + } return TCL_RETURN; } -- cgit v0.12 From caf50ef7eab0d54375a495f8eb9d36ffa264dde2 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:31:12 +0000 Subject: seconds token (%s) take precedence over all other tokens --- generic/tclClockFmt.c | 56 ++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 09cbfa4..ba924fd 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1147,41 +1147,47 @@ ClockScan( goto not_match; } - /* invalidate result */ - if (flags & CLF_DATE) { + /* + * Invalidate result + */ + + /* seconds token (%s) take precedence over all other tokens */ + if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) { + if (flags & CLF_DATE) { - if (!(flags & CLF_JULIANDAY)) { - info->flags |= CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY; + if (!(flags & CLF_JULIANDAY)) { + info->flags |= CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY; - if (yyYear < 100) { - if (!(flags & CLF_CENTURY)) { - if (yyYear >= dataPtr->yearOfCenturySwitch) { - yyYear -= 100; + if (yyYear < 100) { + if (!(flags & CLF_CENTURY)) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { + yyYear -= 100; + } + yyYear += dataPtr->currentYearCentury; + } else { + yyYear += info->dateCentury * 100; } - yyYear += dataPtr->currentYearCentury; - } else { - yyYear += info->dateCentury * 100; } + yydate.era = CE; + } + /* if date but no time - reset time */ + if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { + info->flags |= CLF_INVALIDATE_SECONDS; + yydate.localSeconds = 0; } - yydate.era = CE; } - /* if date but no time - reset time */ - if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { + + if (flags & CLF_TIME) { + info->flags |= CLF_INVALIDATE_SECONDS; + yySeconds = ToSeconds(yyHour, yyMinutes, + yySeconds, yyMeridian); + } else + if (!(flags & CLF_LOCALSEC)) { info->flags |= CLF_INVALIDATE_SECONDS; - yydate.localSeconds = 0; + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; } } - if (flags & CLF_TIME) { - info->flags |= CLF_INVALIDATE_SECONDS; - yySeconds = ToSeconds(yyHour, yyMinutes, - yySeconds, yyMeridian); - } else - if (!(flags & CLF_LOCALSEC)) { - info->flags |= CLF_INVALIDATE_SECONDS; - yySeconds = yydate.localSeconds % SECONDS_PER_DAY; - } - ret = TCL_OK; goto done; -- cgit v0.12 From 6c38124bb987bb10c82631122bcb4a981a47e559 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:31:43 +0000 Subject: %j token as day of year; clear flags implemented (to provide last-wins functionality) --- generic/tclClock.c | 86 ++++++++++++++++++++++++++++++++++++++------------- generic/tclClockFmt.c | 48 +++++++++++++++------------- generic/tclDate.h | 22 +++++++------ 3 files changed, 103 insertions(+), 53 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 08bc6ef..ef0e46b 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -2313,7 +2313,47 @@ GetJulianDayFromEraYearMonthDay( + ym1o4; } } +/* + *---------------------------------------------------------------------- + */ +static void +GetJulianDayFromEraYearDay( + TclDateFields *fields, /* Date to convert */ + int changeover) /* Gregorian transition date as a Julian Day */ +{ + int year, ym1; + + /* Get absolute year number from the civil year */ + if (fields->era == BCE) { + year = 1 - fields->year; + } else { + year = fields->year; + } + + ym1 = year - 1; + + /* Try the Gregorian calendar first. */ + fields->gregorian = 1; + fields->julianDay = + 1721425 + + fields->dayOfYear + + ( 365 * ym1 ) + + ( ym1 / 4 ) + - ( ym1 / 100 ) + + ( ym1 / 400 ); + + /* If the date is before the Gregorian change, use the Julian calendar. */ + + if ( fields->julianDay < changeover ) { + fields->gregorian = 0; + fields->julianDay = + 1721423 + + fields->dayOfYear + + ( 365 * ym1 ) + + ( ym1 / 4 ); + } +} /* *---------------------------------------------------------------------- * @@ -2906,9 +2946,13 @@ ClockScanObjCmd( goto done; } - /* If needed assemble julianDay using new year, month, etc. */ - if (info->flags & CLF_INVALIDATE_JULIANDAY) { - GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); + /* If needed assemble julianDay using year, month, etc. */ + if (info->flags & CLF_ASSEMBLE_JULIANDAY) { + if ((info->flags & CLF_DAYOFMONTH) || !(info->flags & CLF_DAYOFYEAR)) { + GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); + } else { + GetJulianDayFromEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); + } } /* some overflow checks, if not extended */ @@ -2924,7 +2968,7 @@ ClockScanObjCmd( /* Local seconds to UTC (stored in yydate.seconds) */ - if (info->flags & (CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY)) { + if (info->flags & (CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY)) { yydate.localSeconds = -210866803200L + ( SECONDS_PER_DAY * (Tcl_WideInt)yydate.julianDay ) @@ -3007,7 +3051,7 @@ ClockFreeScan( if (yyHaveTime == 0) { yyHaveTime = -1; } - info->flags |= CLF_INVALIDATE_JULIANDAY|CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_JULIANDAY|CLF_ASSEMBLE_SECONDS; } /* @@ -3032,7 +3076,7 @@ ClockFreeScan( // Tcl_SetObjRef(yydate.tzName, opts->timezoneObj); - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; } /* @@ -3041,13 +3085,13 @@ ClockFreeScan( if (yyHaveTime == -1) { yySeconds = 0; - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; } else if (yyHaveTime) { yySeconds = ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian); - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; } else if ( (yyHaveDay && !yyHaveDate) @@ -3057,7 +3101,7 @@ ClockFreeScan( || yyRelDay != 0 ) ) ) { yySeconds = 0; - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; } else { yySeconds = yydate.localSeconds % SECONDS_PER_DAY; @@ -3084,11 +3128,11 @@ repeat_rel: int m, h; /* if needed extract year, month, etc. again */ - if (info->flags & CLF_INVALIDATE_DATE) { + if (info->flags & CLF_ASSEMBLE_DATE) { GetGregorianEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); GetMonthDay(&yydate); GetYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); - info->flags &= ~CLF_INVALIDATE_DATE; + info->flags &= ~CLF_ASSEMBLE_DATE; } /* add the requisite number of months */ @@ -3104,7 +3148,7 @@ repeat_rel: } /* on demand (lazy) assemble julianDay using new year, month, etc. */ - info->flags |= CLF_INVALIDATE_JULIANDAY|CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_JULIANDAY|CLF_ASSEMBLE_SECONDS; yyRelMonth = 0; } @@ -3113,14 +3157,14 @@ repeat_rel: if (yyRelDay) { /* assemble julianDay using new year, month, etc. */ - if (info->flags & CLF_INVALIDATE_JULIANDAY) { + if (info->flags & CLF_ASSEMBLE_JULIANDAY) { GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); - info->flags &= ~CLF_INVALIDATE_JULIANDAY; + info->flags &= ~CLF_ASSEMBLE_JULIANDAY; } yydate.julianDay += yyRelDay; /* julianDay was changed, on demand (lazy) extract year, month, etc. again */ - info->flags |= CLF_INVALIDATE_DATE|CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_DATE|CLF_ASSEMBLE_SECONDS; yyRelDay = 0; } @@ -3150,11 +3194,11 @@ repeat_rel: int monthDiff; /* if needed extract year, month, etc. again */ - if (info->flags & CLF_INVALIDATE_DATE) { + if (info->flags & CLF_ASSEMBLE_DATE) { GetGregorianEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); GetMonthDay(&yydate); GetYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); - info->flags &= ~CLF_INVALIDATE_DATE; + info->flags &= ~CLF_ASSEMBLE_DATE; } if (yyMonthOrdinalIncr > 0) { @@ -3177,7 +3221,7 @@ repeat_rel: yyRelMonth += monthDiff; yyHaveOrdinalMonth = 0; - info->flags |= CLF_INVALIDATE_JULIANDAY|CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_JULIANDAY|CLF_ASSEMBLE_SECONDS; goto repeat_rel; } @@ -3189,9 +3233,9 @@ repeat_rel: if (yyHaveDay && !yyHaveDate) { /* if needed assemble julianDay now */ - if (info->flags & CLF_INVALIDATE_JULIANDAY) { + if (info->flags & CLF_ASSEMBLE_JULIANDAY) { GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); - info->flags &= ~CLF_INVALIDATE_JULIANDAY; + info->flags &= ~CLF_ASSEMBLE_JULIANDAY; } yydate.era = CE; @@ -3200,7 +3244,7 @@ repeat_rel: if (yyDayOrdinal > 0) { yydate.julianDay -= 7; } - info->flags |= CLF_INVALIDATE_DATE|CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_DATE|CLF_ASSEMBLE_SECONDS; } /* Free scanning completed - date ready */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index ba924fd..2c1dfc1 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -678,40 +678,43 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, static const char *ScnSTokenMapIndex = - "dmbyYHMSJCs"; + "dmbyYHMSJjCs"; static ClockScanTokenMap ScnSTokenMap[] = { /* %d %e */ - {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.dayOfMonth), + {CTOKT_DIGIT, CLF_DATE | CLF_DAYOFMONTH, CLF_DAYOFYEAR, 1, 2, TclOffset(DateInfo, date.dayOfMonth), NULL}, /* %m */ - {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.month), + {CTOKT_DIGIT, CLF_DATE, CLF_DAYOFYEAR, 1, 2, TclOffset(DateInfo, date.month), NULL}, /* %b %B %h */ - {CTOKT_PARSER, CLF_DATE, 0, 0, 0, + {CTOKT_PARSER, CLF_DATE, CLF_DAYOFYEAR, 0, 0, 0, ClockScnToken_Month_Proc}, /* %y */ - {CTOKT_DIGIT, CLF_DATE, 1, 2, TclOffset(DateInfo, date.year), + {CTOKT_DIGIT, CLF_DATE, 0, 1, 2, TclOffset(DateInfo, date.year), NULL}, /* %Y */ - {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 1, 4, TclOffset(DateInfo, date.year), + {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 0, 1, 4, TclOffset(DateInfo, date.year), NULL}, /* %H */ - {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.hour), + {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.hour), NULL}, /* %M */ - {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.minutes), + {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.minutes), NULL}, /* %S */ - {CTOKT_DIGIT, CLF_TIME, 1, 2, TclOffset(DateInfo, date.secondOfDay), + {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.secondOfDay), NULL}, /* %J */ - {CTOKT_DIGIT, CLF_DATE | CLF_JULIANDAY, 1, 0xffff, TclOffset(DateInfo, date.julianDay), + {CTOKT_DIGIT, CLF_DATE | CLF_JULIANDAY, 0, 1, 0xffff, TclOffset(DateInfo, date.julianDay), + NULL}, + /* %j */ + {CTOKT_DIGIT, CLF_DATE | CLF_DAYOFYEAR, CLF_DAYOFMONTH, 1, 3, TclOffset(DateInfo, date.dayOfYear), NULL}, /* %C */ - {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 1, 2, TclOffset(DateInfo, dateCentury), + {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 0, 1, 2, TclOffset(DateInfo, dateCentury), NULL}, /* %s */ - {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), + {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), NULL}, }; static const char *ScnSTokenWrapMapIndex[2] = { @@ -733,10 +736,10 @@ static const char *ScnOTokenMapIndex = "dm"; static ClockScanTokenMap ScnOTokenMap[] = { /* %Od %Oe */ - {CTOKT_PARSER, CLF_DATE, 0, 0, TclOffset(DateInfo, date.dayOfMonth), + {CTOKT_PARSER, CLF_DATE | CLF_DAYOFMONTH, CLF_DAYOFYEAR, 0, 0, TclOffset(DateInfo, date.dayOfMonth), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Om */ - {CTOKT_PARSER, CLF_DATE, 0, 0, TclOffset(DateInfo, date.month), + {CTOKT_PARSER, CLF_DATE, CLF_DAYOFYEAR, 0, 0, TclOffset(DateInfo, date.month), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *ScnOTokenWrapMapIndex[2] = { @@ -747,12 +750,12 @@ static const char *ScnOTokenWrapMapIndex[2] = { static const char *ScnSpecTokenMapIndex = " "; static ClockScanTokenMap ScnSpecTokenMap[] = { - {CTOKT_SPACE, 0, 1, 0xffff, 0, + {CTOKT_SPACE, 0, 0, 1, 0xffff, 0, NULL}, }; static ClockScanTokenMap ScnWordTokenMap = { - CTOKT_WORD, 0, 1, 0, 0, + CTOKT_WORD, 0, 0, 1, 0, 0, NULL }; @@ -1095,7 +1098,7 @@ ClockScan( } p = x; } - flags |= map->flags; + flags = (flags & ~map->clearFlags) | map->flags; } break; case CTOKT_PARSER: @@ -1110,7 +1113,7 @@ ClockScan( break; }; p = yyInput; - flags |= map->flags; + flags = (flags & ~map->clearFlags) | map->flags; break; case CTOKT_SPACE: /* at least one space in strict mode */ @@ -1150,13 +1153,14 @@ ClockScan( /* * Invalidate result */ + info->flags |= flags; /* seconds token (%s) take precedence over all other tokens */ if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) { if (flags & CLF_DATE) { if (!(flags & CLF_JULIANDAY)) { - info->flags |= CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY; + info->flags |= CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY; if (yyYear < 100) { if (!(flags & CLF_CENTURY)) { @@ -1172,18 +1176,18 @@ ClockScan( } /* if date but no time - reset time */ if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; yydate.localSeconds = 0; } } if (flags & CLF_TIME) { - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; yySeconds = ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian); } else if (!(flags & CLF_LOCALSEC)) { - info->flags |= CLF_INVALIDATE_SECONDS; + info->flags |= CLF_ASSEMBLE_SECONDS; yySeconds = yydate.localSeconds % SECONDS_PER_DAY; } } diff --git a/generic/tclDate.h b/generic/tclDate.h index 9f65b1b..23fe5b3 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -30,10 +30,18 @@ #define ONE_YEAR 365 /* days */ +#define CLF_DATE (1 << 2) +#define CLF_JULIANDAY (1 << 3) +#define CLF_TIME (1 << 4) +#define CLF_LOCALSEC (1 << 5) +#define CLF_CENTURY (1 << 6) +#define CLF_DAYOFMONTH (1 << 7) +#define CLF_DAYOFYEAR (1 << 8) +#define CLF_SIGNED (1 << 15) /* On demand (lazy) assemble flags */ -#define CLF_INVALIDATE_DATE (1 << 6) /* assemble year, month, etc. using julianDay */ -#define CLF_INVALIDATE_JULIANDAY (1 << 7) /* assemble julianDay using year, month, etc. */ -#define CLF_INVALIDATE_SECONDS (1 << 8) /* assemble localSeconds (and seconds at end) */ +#define CLF_ASSEMBLE_DATE (1 << 28) /* assemble year, month, etc. using julianDay */ +#define CLF_ASSEMBLE_JULIANDAY (1 << 29) /* assemble julianDay using year, month, etc. */ +#define CLF_ASSEMBLE_SECONDS (1 << 30) /* assemble localSeconds (and seconds at end) */ /* @@ -339,13 +347,6 @@ typedef int ClockScanTokenProc( ClockScanToken *tok); -#define CLF_DATE (1 << 2) -#define CLF_JULIANDAY (1 << 3) -#define CLF_TIME (1 << 4) -#define CLF_LOCALSEC (1 << 5) -#define CLF_CENTURY (1 << 6) -#define CLF_SIGNED (1 << 8) - typedef enum _CLCKTOK_TYPE { CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD } CLCKTOK_TYPE; @@ -359,6 +360,7 @@ typedef struct ClockFormatToken { typedef struct ClockScanTokenMap { unsigned short int type; unsigned short int flags; + unsigned short int clearFlags; unsigned short int minSize; unsigned short int maxSize; unsigned short int offs; -- cgit v0.12 From feb62aa2bdc63e80cb401c06a17959af188f14c9 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:32:46 +0000 Subject: scan format: several tokens implemented, bug fixing and code review; precedence yyyymmdd over yyyyddd was changed (and re-covered in test-cases also), see http://core.tcl.tk/tcl/tktview/e7a722cd3573fedda5d1e528f95902776f996e06 --- generic/tclClock.c | 25 +-- generic/tclClockFmt.c | 384 +++++++++++++++++++++++++++++++++++++++------- generic/tclDate.h | 21 ++- library/clock.tcl | 37 ++++- library/msgcat/msgcat.tcl | 5 + tests/clock.test | 66 ++++---- 6 files changed, 436 insertions(+), 102 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index ef0e46b..1a5141b 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -473,13 +473,12 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) } if (opts->mcDictObj == NULL) { - Tcl_Obj *callargs[3]; - /* get msgcat dictionary - ::msgcat::mcget ::tcl::clock locale */ + Tcl_Obj *callargs[2]; + /* get msgcat dictionary - ::tcl::clock::mcget locale */ callargs[0] = dataPtr->literals[LIT_MCGET]; - callargs[1] = dataPtr->literals[LIT_TCL_CLOCK]; - callargs[2] = opts->localeObj; + callargs[1] = opts->localeObj; - if (Tcl_EvalObjv(opts->interp, 3, callargs, 0) != TCL_OK) { + if (Tcl_EvalObjv(opts->interp, 2, callargs, 0) != TCL_OK) { return NULL; } @@ -823,7 +822,7 @@ ClockGetSystemTimeZone( /* *---------------------------------------------------------------------- */ -static Tcl_Obj * +MODULE_SCOPE Tcl_Obj * ClockSetupTimeZone( ClientData clientData, /* Opaque pointer to literal pool, etc. */ Tcl_Interp *interp, /* Tcl interpreter */ @@ -2948,7 +2947,11 @@ ClockScanObjCmd( /* If needed assemble julianDay using year, month, etc. */ if (info->flags & CLF_ASSEMBLE_JULIANDAY) { - if ((info->flags & CLF_DAYOFMONTH) || !(info->flags & CLF_DAYOFYEAR)) { + if ((info->flags & CLF_ISO8601)) { + GetJulianDayFromEraYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE); + } + else + if (!(info->flags & CLF_DAYOFYEAR)) { GetJulianDayFromEraYearMonthDay(&yydate, GREGORIAN_CHANGE_DATE); } else { GetJulianDayFromEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); @@ -3065,11 +3068,11 @@ ClockFreeScan( int dstFlag = 1 - yyDSTmode; tzObjStor = ClockFormatNumericTimeZone( 60 * minEast + 3600 * dstFlag); - + Tcl_IncrRefCount(tzObjStor); + opts->timezoneObj = ClockSetupTimeZone(clientData, interp, tzObjStor); - if (tzObjStor != opts->timezoneObj) { - Tcl_DecrRefCount(tzObjStor); - } + + Tcl_DecrRefCount(tzObjStor); if (opts->timezoneObj == NULL) { goto done; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 2c1dfc1..f965a17 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -508,27 +508,14 @@ void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, } } -static int -LocaleListSearch(ClockFmtScnCmdArgs *opts, - DateInfo *info, int mcKey, int *val, +inline int +ObjListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, int *val, + Tcl_Obj **lstv, int lstc, int minLen, int maxLen) { - Tcl_Obj **lstv; - int lstc, i, l, lf = -1; + int i, l, lf = -1; const char *s; - Tcl_Obj *valObj; - - /* get msgcat value */ - valObj = ClockMCGet(opts, mcKey); - if (valObj == NULL) { - return TCL_ERROR; - } - - /* is a list */ - if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { - return TCL_ERROR; - } - /* search in list */ for (i = 0; i < lstc; i++) { s = TclGetString(lstv[i]); @@ -561,6 +548,31 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, } static int +LocaleListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, int mcKey, int *val, + int minLen, int maxLen) +{ + Tcl_Obj **lstv; + int lstc; + Tcl_Obj *valObj; + + /* get msgcat value */ + valObj = ClockMCGet(opts, mcKey); + if (valObj == NULL) { + return TCL_ERROR; + } + + /* is a list */ + if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { + return TCL_ERROR; + } + + /* search in list */ + return ObjListSearch(opts, info, val, lstv, lstc, + minLen, maxLen); +} + +static int StaticListSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, const char **lst, int *val) { @@ -631,8 +643,7 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, */ int ret, val; - int minLen; - int maxLen; + int minLen, maxLen; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); @@ -653,15 +664,115 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } + +static int +ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int ret, val; + int minLen, maxLen; + char curTok = *tok->tokWord.start; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + /* %u %w %Ou %Ow */ + if ( curTok != 'a' && curTok != 'A' + && ((minLen <= 1 && maxLen >= 1) || (int)tok->map->data) + ) { + + val = -1; + + if (!(int)tok->map->data) { + if (*yyInput >= '0' && *yyInput <= '9') { + val = *yyInput - '0'; + } + } else { + int ret = LocaleListSearch(opts, info, (int)tok->map->data, &val, + minLen, maxLen); + if (ret == TCL_ERROR) { + return ret; + } + } + + if (val != -1) { + if (val == 0) { + val = 7; + } + if (val > 7 && curTok != 'a' && curTok != 'A') { + Tcl_SetResult(opts->interp, "day of week is greater than 7", + TCL_STATIC); + Tcl_SetErrorCode(opts->interp, "CLOCK", "badDayOfWeek", NULL); + return TCL_ERROR; + } + info->date.dayOfWeek = val; + yyInput++; + return TCL_OK; + } + + + return TCL_RETURN; + } + + /* %a %A */ + ret = LocaleListSearch(opts, info, MCLIT_DAYS_OF_WEEK_FULL, &val, + minLen, maxLen); + if (ret != TCL_OK) { + /* if not found */ + if (ret == TCL_RETURN) { + ret = LocaleListSearch(opts, info, MCLIT_DAYS_OF_WEEK_ABBREV, &val, + minLen, maxLen); + } + if (ret != TCL_OK) { + return ret; + } + } + + if (val == 0) { + val = 7; + } + info->date.dayOfWeek = val; + return TCL_OK; + +} + +static int +ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int ret, val; + int minLen, maxLen; + Tcl_Obj *amPmObj[2]; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + amPmObj[0] = ClockMCGet(opts, MCLIT_AM); + amPmObj[1] = ClockMCGet(opts, MCLIT_PM); + + if (amPmObj[0] == NULL || amPmObj == NULL) { + return TCL_ERROR; + } + + ret = ObjListSearch(opts, info, &val, amPmObj, 2, + minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + if (val == 0) { + yyMeridian = MERam; + } else { + yyMeridian = MERpm; + } + return TCL_OK; +} static int ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { int ret, val; - int minLen; - int maxLen; + int minLen, maxLen; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); @@ -675,27 +786,106 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } + +static int +ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int minLen, maxLen; + int len = 0; + register const char *p = yyInput; + Tcl_Obj *tzObjStor = NULL; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + /* numeric timezone */ + if (*p == '+' || *p == '-') { + /* max chars in numeric zone = "+00:00:00" */ + #define MAX_ZONE_LEN 9 + char buf[MAX_ZONE_LEN + 1]; + char *bp = buf; + *bp++ = *p++; len++; + if (maxLen > MAX_ZONE_LEN) + maxLen = MAX_ZONE_LEN; + /* cumulate zone into buf without ':' */ + while (len + 1 < maxLen) { + if (!isdigit(UCHAR(*p))) break; + *bp++ = *p++; len++; + if (!isdigit(UCHAR(*p))) break; + *bp++ = *p++; len++; + if (len + 2 < maxLen) { + if (*p == ':') { + *p++; len++; + } + } + } + *bp = '\0'; + + if (len < minLen) { + return TCL_RETURN; + } + #undef MAX_ZONE_LEN + + /* timezone */ + tzObjStor = Tcl_NewStringObj(buf, bp-buf); + } else { + /* legacy (alnum) timezone like CEST, etc. */ + if (maxLen > 4) + maxLen = 4; + while (len < maxLen) { + if ( (*p & 0x80) + || (!isalpha(UCHAR(*p)) && !isdigit(UCHAR(*p))) + ) { /* INTL: ISO only. */ + break; + } + p++; len++; + } + if (len < minLen) { + return TCL_RETURN; + } + + /* timezone */ + tzObjStor = Tcl_NewStringObj(yyInput, p-yyInput); + + /* convert using dict */ + } + + /* try to apply new time zone */ + Tcl_IncrRefCount(tzObjStor); + + opts->timezoneObj = ClockSetupTimeZone(opts->clientData, opts->interp, + tzObjStor); + + Tcl_DecrRefCount(tzObjStor); + if (opts->timezoneObj == NULL) { + return TCL_ERROR; + } + + yyInput += len; + return TCL_OK; +} + static const char *ScnSTokenMapIndex = - "dmbyYHMSJjCs"; + "dmbyYHMSpJjCgGVazs"; static ClockScanTokenMap ScnSTokenMap[] = { /* %d %e */ - {CTOKT_DIGIT, CLF_DATE | CLF_DAYOFMONTH, CLF_DAYOFYEAR, 1, 2, TclOffset(DateInfo, date.dayOfMonth), + {CTOKT_DIGIT, CLF_DAYOFMONTH, 0, 1, 2, TclOffset(DateInfo, date.dayOfMonth), NULL}, /* %m */ - {CTOKT_DIGIT, CLF_DATE, CLF_DAYOFYEAR, 1, 2, TclOffset(DateInfo, date.month), + {CTOKT_DIGIT, CLF_MONTH, 0, 1, 2, TclOffset(DateInfo, date.month), NULL}, /* %b %B %h */ - {CTOKT_PARSER, CLF_DATE, CLF_DAYOFYEAR, 0, 0, 0, + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0, 0, ClockScnToken_Month_Proc}, /* %y */ - {CTOKT_DIGIT, CLF_DATE, 0, 1, 2, TclOffset(DateInfo, date.year), + {CTOKT_DIGIT, CLF_YEAR, 0, 1, 2, TclOffset(DateInfo, date.year), NULL}, /* %Y */ - {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 0, 1, 4, TclOffset(DateInfo, date.year), + {CTOKT_DIGIT, CLF_YEAR | CLF_CENTURY, 0, 1, 4, TclOffset(DateInfo, date.year), NULL}, - /* %H */ + /* %H %k %I %l */ {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.hour), NULL}, /* %M */ @@ -704,22 +894,40 @@ static ClockScanTokenMap ScnSTokenMap[] = { /* %S */ {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.secondOfDay), NULL}, + /* %p %P */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + ClockScnToken_amPmInd_Proc, NULL}, /* %J */ - {CTOKT_DIGIT, CLF_DATE | CLF_JULIANDAY, 0, 1, 0xffff, TclOffset(DateInfo, date.julianDay), + {CTOKT_DIGIT, CLF_JULIANDAY, 0, 1, 0xffff, TclOffset(DateInfo, date.julianDay), NULL}, /* %j */ - {CTOKT_DIGIT, CLF_DATE | CLF_DAYOFYEAR, CLF_DAYOFMONTH, 1, 3, TclOffset(DateInfo, date.dayOfYear), + {CTOKT_DIGIT, CLF_DAYOFYEAR, 0, 1, 3, TclOffset(DateInfo, date.dayOfYear), NULL}, /* %C */ - {CTOKT_DIGIT, CLF_DATE | CLF_CENTURY, 0, 1, 2, TclOffset(DateInfo, dateCentury), + {CTOKT_DIGIT, CLF_CENTURY|CLF_ISO8601CENTURY, 0, 1, 2, TclOffset(DateInfo, dateCentury), + NULL}, + /* %g */ + {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601, 0, 2, 2, TclOffset(DateInfo, date.iso8601Year), + NULL}, + /* %G */ + {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601 | CLF_ISO8601CENTURY, 0, 1, 4, TclOffset(DateInfo, date.iso8601Year), NULL}, + /* %V */ + {CTOKT_DIGIT, CLF_ISO8601, 0, 1, 2, TclOffset(DateInfo, date.iso8601Week), + NULL}, + /* %a %A %u %w */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + ClockScnToken_DayOfWeek_Proc, NULL}, + /* %z %Z */ + {CTOKT_PARSER, 0, 0, 0, 0, 0, + ClockScnToken_TimeZone_Proc, NULL}, /* %s */ {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), NULL}, }; static const char *ScnSTokenWrapMapIndex[2] = { - "eNBh", - "dmbb" + "eNBhkIlPAuwZ", + "dmbbHHHpaaaz" }; static const char *ScnETokenMapIndex = @@ -733,18 +941,33 @@ static const char *ScnETokenWrapMapIndex[2] = { }; static const char *ScnOTokenMapIndex = - "dm"; + "dmyHMSu"; static ClockScanTokenMap ScnOTokenMap[] = { /* %Od %Oe */ - {CTOKT_PARSER, CLF_DATE | CLF_DAYOFMONTH, CLF_DAYOFYEAR, 0, 0, TclOffset(DateInfo, date.dayOfMonth), + {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0, TclOffset(DateInfo, date.dayOfMonth), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Om */ - {CTOKT_PARSER, CLF_DATE, CLF_DAYOFYEAR, 0, 0, TclOffset(DateInfo, date.month), + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0, TclOffset(DateInfo, date.month), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Oy */ + {CTOKT_PARSER, CLF_YEAR, 0, 0, 0, TclOffset(DateInfo, date.year), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OH %Ok %OI %Ol */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateInfo, date.hour), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OM */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateInfo, date.minutes), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OS */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateInfo, date.secondOfDay), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ou Ow */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + ClockScnToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *ScnOTokenWrapMapIndex[2] = { - "e", - "d" + "ekIlw", + "dHHHu" }; static const char *ScnSpecTokenMapIndex = @@ -1153,7 +1376,6 @@ ClockScan( /* * Invalidate result */ - info->flags |= flags; /* seconds token (%s) take precedence over all other tokens */ if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) { @@ -1162,23 +1384,78 @@ ClockScan( if (!(flags & CLF_JULIANDAY)) { info->flags |= CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY; - if (yyYear < 100) { - if (!(flags & CLF_CENTURY)) { - if (yyYear >= dataPtr->yearOfCenturySwitch) { - yyYear -= 100; + /* dd precedence below ddd */ + switch (flags & (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH)) { + case (CLF_DAYOFYEAR|CLF_DAYOFMONTH): + /* miss month: ddd over dd (without month) */ + flags &= ~CLF_DAYOFMONTH; + case (CLF_DAYOFYEAR): + /* ddd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + break; + case (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH): + /* both available: mmdd over ddd */ + flags &= ~CLF_DAYOFYEAR; + case (CLF_MONTH|CLF_DAYOFMONTH): + case (CLF_DAYOFMONTH): + /* mmdd / dd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + break; + } + + /* YearWeekDay below YearMonthDay */ + if ( (flags & CLF_ISO8601) + && ( (flags & (CLF_YEAR|CLF_DAYOFYEAR)) == (CLF_YEAR|CLF_DAYOFYEAR) + || (flags & (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH)) == (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH) + ) + ) { + /* yy precedence below yyyy */ + if (!(flags & CLF_ISO8601CENTURY) && (flags & CLF_CENTURY)) { + /* normally precedence of ISO is higher, but no century - so put it down */ + flags &= ~CLF_ISO8601; + } + else + /* yymmdd or yyddd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + } + + if (!(flags & CLF_ISO8601)) { + if (yyYear < 100) { + if (!(flags & CLF_CENTURY)) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { + yyYear -= 100; + } + yyYear += dataPtr->currentYearCentury; + } else { + yyYear += info->dateCentury * 100; + } + } + } else { + if (info->date.iso8601Year < 100) { + if (!(flags & CLF_ISO8601CENTURY)) { + if (info->date.iso8601Year >= dataPtr->yearOfCenturySwitch) { + info->date.iso8601Year -= 100; + } + info->date.iso8601Year += dataPtr->currentYearCentury; + } else { + info->date.iso8601Year += info->dateCentury * 100; } - yyYear += dataPtr->currentYearCentury; - } else { - yyYear += info->dateCentury * 100; } } yydate.era = CE; } - /* if date but no time - reset time */ - if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { - info->flags |= CLF_ASSEMBLE_SECONDS; - yydate.localSeconds = 0; - } + } + + /* if no time - reset time */ + if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yydate.localSeconds = 0; } if (flags & CLF_TIME) { @@ -1192,6 +1469,9 @@ ClockScan( } } + /* tell caller which flags were set */ + info->flags |= flags; + ret = TCL_OK; goto done; diff --git a/generic/tclDate.h b/generic/tclDate.h index 23fe5b3..fc922cb 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -30,19 +30,26 @@ #define ONE_YEAR 365 /* days */ -#define CLF_DATE (1 << 2) #define CLF_JULIANDAY (1 << 3) #define CLF_TIME (1 << 4) #define CLF_LOCALSEC (1 << 5) #define CLF_CENTURY (1 << 6) #define CLF_DAYOFMONTH (1 << 7) #define CLF_DAYOFYEAR (1 << 8) +#define CLF_MONTH (1 << 9) +#define CLF_YEAR (1 << 10) +#define CLF_ISO8601YEAR (1 << 12) +#define CLF_ISO8601 (1 << 13) +#define CLF_ISO8601CENTURY (1 << 14) #define CLF_SIGNED (1 << 15) /* On demand (lazy) assemble flags */ #define CLF_ASSEMBLE_DATE (1 << 28) /* assemble year, month, etc. using julianDay */ #define CLF_ASSEMBLE_JULIANDAY (1 << 29) /* assemble julianDay using year, month, etc. */ #define CLF_ASSEMBLE_SECONDS (1 << 30) /* assemble localSeconds (and seconds at end) */ +#define CLF_DATE (CLF_JULIANDAY | CLF_DAYOFMONTH | CLF_DAYOFYEAR | \ + CLF_MONTH | CLF_YEAR | CLF_ISO8601YEAR | CLF_ISO8601) + /* * Enumeration of the string literals used in [clock] @@ -87,7 +94,7 @@ typedef enum ClockLiteral { "::tcl::clock::TZData", \ "::tcl::clock::GetSystemTimeZone", \ "::tcl::clock::SetupTimeZone", \ - "::msgcat::mcget", "::tcl::clock", \ + "::tcl::clock::mcget", "::tcl::clock", \ "::tcl::clock::LocalizeFormat" \ } @@ -96,13 +103,19 @@ typedef enum ClockLiteral { */ typedef enum ClockMsgCtLiteral { + MCLIT__NIL, /* placeholder */ MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, + MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, + MCLIT_AM, MCLIT_PM, MCLIT_LOCALE_NUMERALS, MCLIT__END } ClockMsgCtLiteral; #define CLOCK_LOCALE_LITERAL_ARRAY(litarr, pref) static const char *const litarr[] = { \ + pref "", \ pref "MONTHS_FULL", pref "MONTHS_ABBREV", \ + pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", \ + pref "AM", pref "PM", \ pref "LOCALE_NUMERALS", \ } @@ -406,6 +419,10 @@ MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); /* tclClock.c module declarations */ MODULE_SCOPE Tcl_Obj * + ClockSetupTimeZone(ClientData clientData, + Tcl_Interp *interp, Tcl_Obj *timezoneObj); + +MODULE_SCOPE Tcl_Obj * ClockMCDict(ClockFmtScnCmdArgs *opts); MODULE_SCOPE Tcl_Obj * ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); diff --git a/library/clock.tcl b/library/clock.tcl index a532c0d..d4e29d5 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -629,15 +629,17 @@ proc ::tcl::clock::Initialize {} { # Caches - variable LocaleFormats {}; # Dictionary with localized formats + variable LocaleFormats \ + [dict create]; # Dictionary with localized formats - variable LocaleNumeralCache {}; # Dictionary whose keys are locale + variable LocaleNumeralCache \ + [dict create]; # Dictionary whose keys are locale # names and whose values are pairs # comprising regexes matching numerals # in the given locales and dictionaries # mapping the numerals to their numeric # values. - variable TimeZoneBad {}; # Dictionary whose keys are time zone + variable TimeZoneBad [dict create]; # Dictionary whose keys are time zone # names and whose values are 1 if # the time zone is unknown and 0 # if it is known. @@ -653,6 +655,17 @@ proc ::tcl::clock::Initialize {} { ::tcl::clock::Initialize #---------------------------------------------------------------------- + +proc mcget {locale args} { + switch -- $locale system { + set locale [GetSystemLocale] + } current { + set locale [mclocale] + } + msgcat::mcget ::tcl::clock $locale {*}$args +} + +#---------------------------------------------------------------------- # # clock format -- # @@ -2938,7 +2951,7 @@ proc ::tcl::clock::ConvertLegacyTimeZone { tzname } { # #---------------------------------------------------------------------- -proc ::tcl::clock::SetupTimeZone { timezone } { +proc ::tcl::clock::SetupTimeZone { timezone {alias {}} } { variable TZData if {! [info exists TZData($timezone)] } { @@ -3005,6 +3018,19 @@ proc ::tcl::clock::SetupTimeZone { timezone } { } } else { + + variable LegacyTimeZone + + # Check may be a legacy zone: + if { $alias eq {} && ![catch { + set tzname [dict get $LegacyTimeZone [string tolower $timezone]] + }] } { + set tzname [::tcl::clock::SetupTimeZone $tzname $timezone] + set TZData($timezone) $TZData($tzname) + # tell backend - timezone is initialized and return shared timezone object: + return [configure -setup-tz $timezone] + } + # We couldn't parse this as a POSIX time zone. Try again with a # time zone file - this time without a colon @@ -4472,6 +4498,9 @@ proc ::tcl::clock::ClearCaches {} { # tell backend - should invalidate: configure -clear + # clear msgcat cache: + msgcat::ClearCaches ::tcl::clock + foreach p [info procs [namespace current]::scanproc'*] { rename $p {} } diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index a25f6c8..e6452d2 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -951,6 +951,11 @@ proc msgcat::Merge {ns locales} { return [dict smartref $mrgcat] } +proc msgcat::ClearCaches {ns} { + variable Merged + dict unset Merged $ns +} + # msgcat::Invoke -- # # Invoke a set of registered callbacks. diff --git a/tests/clock.test b/tests/clock.test index 22b5bc1..e96dec6 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -21070,78 +21070,78 @@ test clock-10.10 {julian day takes precedence over ccyyddd} { # BEGIN testcases11 -# Test precedence among yyyymmdd and yyyyddd +# Test precedence yyyymmdd over yyyyddd -test clock-11.1 {precedence of ccyyddd and ccyymmdd} { +test clock-11.1 {precedence of ccyymmdd over ccyyddd} { clock scan 19700101002 -format %Y%m%d%j -gmt 1 -} 86400 -test clock-11.2 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.2 {precedence of ccyymmdd over ccyyddd} { clock scan 01197001002 -format %m%Y%d%j -gmt 1 -} 86400 -test clock-11.3 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.3 {precedence of ccyymmdd over ccyyddd} { clock scan 01197001002 -format %d%Y%m%j -gmt 1 -} 86400 -test clock-11.4 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.4 {precedence of ccyymmdd over ccyyddd} { clock scan 00219700101 -format %j%Y%m%d -gmt 1 } 0 -test clock-11.5 {precedence of ccyyddd and ccyymmdd} { +test clock-11.5 {precedence of ccyymmdd over ccyyddd} { clock scan 19700100201 -format %Y%m%j%d -gmt 1 } 0 -test clock-11.6 {precedence of ccyyddd and ccyymmdd} { +test clock-11.6 {precedence of ccyymmdd over ccyyddd} { clock scan 01197000201 -format %m%Y%j%d -gmt 1 } 0 -test clock-11.7 {precedence of ccyyddd and ccyymmdd} { +test clock-11.7 {precedence of ccyymmdd over ccyyddd} { clock scan 01197000201 -format %d%Y%j%m -gmt 1 } 0 -test clock-11.8 {precedence of ccyyddd and ccyymmdd} { +test clock-11.8 {precedence of ccyymmdd over ccyyddd} { clock scan 00219700101 -format %j%Y%d%m -gmt 1 } 0 -test clock-11.9 {precedence of ccyyddd and ccyymmdd} { +test clock-11.9 {precedence of ccyymmdd over ccyyddd} { clock scan 19700101002 -format %Y%d%m%j -gmt 1 -} 86400 -test clock-11.10 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.10 {precedence of ccyymmdd over ccyyddd} { clock scan 01011970002 -format %m%d%Y%j -gmt 1 -} 86400 -test clock-11.11 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.11 {precedence of ccyymmdd over ccyyddd} { clock scan 01011970002 -format %d%m%Y%j -gmt 1 -} 86400 -test clock-11.12 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.12 {precedence of ccyymmdd over ccyyddd} { clock scan 00201197001 -format %j%m%Y%d -gmt 1 } 0 -test clock-11.13 {precedence of ccyyddd and ccyymmdd} { +test clock-11.13 {precedence of ccyymmdd over ccyyddd} { clock scan 19700100201 -format %Y%d%j%m -gmt 1 } 0 -test clock-11.14 {precedence of ccyyddd and ccyymmdd} { +test clock-11.14 {precedence of ccyymmdd over ccyyddd} { clock scan 01010021970 -format %m%d%j%Y -gmt 1 -} 86400 -test clock-11.15 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.15 {precedence of ccyymmdd over ccyyddd} { clock scan 01010021970 -format %d%m%j%Y -gmt 1 -} 86400 -test clock-11.16 {precedence of ccyyddd and ccyymmdd} { +} 0 +test clock-11.16 {precedence of ccyymmdd over ccyyddd} { clock scan 00201011970 -format %j%m%d%Y -gmt 1 } 0 -test clock-11.17 {precedence of ccyyddd and ccyymmdd} { +test clock-11.17 {precedence of ccyymmdd over ccyyddd} { clock scan 19700020101 -format %Y%j%m%d -gmt 1 } 0 -test clock-11.18 {precedence of ccyyddd and ccyymmdd} { +test clock-11.18 {precedence of ccyymmdd over ccyyddd} { clock scan 01002197001 -format %m%j%Y%d -gmt 1 } 0 -test clock-11.19 {precedence of ccyyddd and ccyymmdd} { +test clock-11.19 {precedence of ccyymmdd over ccyyddd} { clock scan 01002197001 -format %d%j%Y%m -gmt 1 } 0 -test clock-11.20 {precedence of ccyyddd and ccyymmdd} { +test clock-11.20 {precedence of ccyymmdd over ccyyddd} { clock scan 00201197001 -format %j%d%Y%m -gmt 1 } 0 -test clock-11.21 {precedence of ccyyddd and ccyymmdd} { +test clock-11.21 {precedence of ccyymmdd over ccyyddd} { clock scan 19700020101 -format %Y%j%d%m -gmt 1 } 0 -test clock-11.22 {precedence of ccyyddd and ccyymmdd} { +test clock-11.22 {precedence of ccyymmdd over ccyyddd} { clock scan 01002011970 -format %m%j%d%Y -gmt 1 } 0 -test clock-11.23 {precedence of ccyyddd and ccyymmdd} { +test clock-11.23 {precedence of ccyymmdd over ccyyddd} { clock scan 01002011970 -format %d%j%m%Y -gmt 1 } 0 -test clock-11.24 {precedence of ccyyddd and ccyymmdd} { +test clock-11.24 {precedence of ccyymmdd over ccyyddd} { clock scan 00201011970 -format %j%d%m%Y -gmt 1 } 0 # END testcases11 -- cgit v0.12 From 02b4c1de38afe8c1a068834cbab9ea7f403e0c60 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:33:41 +0000 Subject: repaired system/current locale caching (also for legacy clock format) and legacy timezone cached as last --- generic/tclClock.c | 80 ++++++++++++++++++++++++++++++++++++++++++++------- generic/tclClockFmt.c | 4 ++- generic/tclDate.h | 16 +++++------ library/clock.tcl | 24 +++++++++------- 4 files changed, 93 insertions(+), 31 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 1a5141b..a84300a 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -383,16 +383,52 @@ NormTimezoneObj( /* *---------------------------------------------------------------------- */ +inline Tcl_Obj * +ClockGetSystemLocale( + ClockClientData *dataPtr, /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp) /* Tcl interpreter */ +{ + if (Tcl_EvalObjv(interp, 1, &dataPtr->literals[LIT_GETSYSTEMLOCALE], 0) != TCL_OK) { + return NULL; + } + + return Tcl_GetObjResult(interp); +} +/* + *---------------------------------------------------------------------- + */ +inline Tcl_Obj * +ClockGetCurrentLocale( + ClockClientData *dataPtr, /* Client data containing literal pool */ + Tcl_Interp *interp) /* Tcl interpreter */ +{ + if (Tcl_EvalObjv(interp, 1, &dataPtr->literals[LIT_GETCURRENTLOCALE], 0) != TCL_OK) { + return NULL; + } + + Tcl_SetObjRef(dataPtr->CurrentLocale, Tcl_GetObjResult(interp)); + Tcl_UnsetObjRef(dataPtr->CurrentLocaleDict); + + return dataPtr->CurrentLocale; +} +/* + *---------------------------------------------------------------------- + */ static Tcl_Obj * NormLocaleObj( - ClockClientData *dataPtr, /* Client data containing literal pool */ + ClockClientData *dataPtr, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ Tcl_Obj *localeObj, Tcl_Obj **mcDictObj) { const char *loc; if ( localeObj == NULL || localeObj == dataPtr->CurrentLocale - || localeObj == dataPtr->literals[LIT_C] + || localeObj == dataPtr->literals[LIT_C] + || localeObj == dataPtr->literals[LIT_CURRENT] ) { + if (dataPtr->CurrentLocale == NULL) { + ClockGetCurrentLocale(dataPtr, interp); + } *mcDictObj = dataPtr->CurrentLocaleDict; return dataPtr->CurrentLocale; } @@ -404,19 +440,23 @@ NormLocaleObj( } loc = TclGetString(localeObj); - if (dataPtr->CurrentLocale != NULL && - (localeObj == dataPtr->CurrentLocale - || strcmp(loc, TclGetString(dataPtr->CurrentLocale)) == 0 + if ( dataPtr->CurrentLocale != NULL + && ( localeObj == dataPtr->CurrentLocale + || (localeObj->length == dataPtr->CurrentLocale->length + && strcmp(loc, TclGetString(dataPtr->CurrentLocale)) == 0 ) + ) ) { *mcDictObj = dataPtr->CurrentLocaleDict; localeObj = dataPtr->CurrentLocale; } else - if (dataPtr->LastUsedLocale != NULL && - (localeObj == dataPtr->LastUsedLocale - || strcmp(loc, TclGetString(dataPtr->LastUsedLocale)) == 0 + if ( dataPtr->LastUsedLocale != NULL + && ( localeObj == dataPtr->LastUsedLocale + || (localeObj->length == dataPtr->LastUsedLocale->length + && strcmp(loc, TclGetString(dataPtr->LastUsedLocale)) == 0 ) + ) ) { *mcDictObj = dataPtr->LastUsedLocaleDict; Tcl_SetObjRef(dataPtr->LastUnnormUsedLocale, localeObj); @@ -424,12 +464,28 @@ NormLocaleObj( } else if ( - strcmp(loc, Literals[LIT_C]) == 0 + (localeObj->length == 1 /* C */ + && strncasecmp(loc, Literals[LIT_C], localeObj->length) == 0) + || (localeObj->length == 7 /* current */ + && strncasecmp(loc, Literals[LIT_CURRENT], localeObj->length) == 0) ) { + if (dataPtr->CurrentLocale == NULL) { + ClockGetCurrentLocale(dataPtr, interp); + } *mcDictObj = dataPtr->CurrentLocaleDict; localeObj = dataPtr->CurrentLocale; } else + if ( + (localeObj->length == 6 /* system */ + && strncasecmp(loc, Literals[LIT_SYSTEM], localeObj->length) == 0) + ) { + Tcl_SetObjRef(dataPtr->LastUnnormUsedLocale, localeObj); + localeObj = ClockGetSystemLocale(dataPtr, interp); + Tcl_SetObjRef(dataPtr->LastUsedLocale, localeObj); + *mcDictObj = NULL; + } + else { *mcDictObj = NULL; } @@ -450,7 +506,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) /* if locale was not yet used */ if ( !(opts->flags & CLF_LOCALE_USED) ) { - opts->localeObj = NormLocaleObj(opts->clientData, + opts->localeObj = NormLocaleObj(opts->clientData, opts->interp, opts->localeObj, &opts->mcDictObj); if (opts->localeObj == NULL) { @@ -490,6 +546,8 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) } if ( opts->localeObj == dataPtr->CurrentLocale ) { Tcl_SetObjRef(dataPtr->CurrentLocaleDict, opts->mcDictObj); + } else if ( opts->localeObj == dataPtr->LastUsedLocale ) { + Tcl_SetObjRef(dataPtr->LastUsedLocaleDict, opts->mcDictObj); } else { Tcl_SetObjRef(dataPtr->LastUsedLocale, opts->localeObj); Tcl_UnsetObjRef(dataPtr->LastUnnormUsedLocale); @@ -2717,7 +2775,7 @@ _ClockParseFmtScnArgs( if ((saw & (1 << CLOCK_FORMAT_GMT)) && (saw & (1 << CLOCK_FORMAT_TIMEZONE))) { - Tcl_SetObjResult(interp, litPtr[LIT_CANNOT_USE_GMT_AND_TIMEZONE]); + Tcl_SetResult(interp, "cannot use -gmt and -timezone in same call", TCL_STATIC); Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); return TCL_ERROR; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index f965a17..5d3dcaf 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1199,7 +1199,9 @@ ClockLocalizeFormat( clean: Tcl_UnsetObjRef(keyObj); - Tcl_ResetResult(opts->interp); + if (valObj) { + Tcl_ResetResult(opts->interp); + } } return (opts->formatObj = valObj); diff --git a/generic/tclDate.h b/generic/tclDate.h index fc922cb..e78d4f8 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -58,9 +58,8 @@ typedef enum ClockLiteral { LIT__NIL, LIT__DEFAULT_FORMAT, - LIT_BCE, LIT_C, - LIT_CANNOT_USE_GMT_AND_TIMEZONE, - LIT_CE, + LIT_SYSTEM, LIT_CURRENT, + LIT_BCE, LIT_C, LIT_CE, LIT_DAYOFMONTH, LIT_DAYOFWEEK, LIT_DAYOFYEAR, LIT_ERA, LIT_GMT, LIT_GREGORIAN, LIT_INTEGER_VALUE_TOO_LARGE, @@ -72,7 +71,8 @@ typedef enum ClockLiteral { LIT_TZDATA, LIT_GETSYSTEMTIMEZONE, LIT_SETUPTIMEZONE, - LIT_MCGET, LIT_TCL_CLOCK, + LIT_MCGET, + LIT_GETSYSTEMLOCALE, LIT_GETCURRENTLOCALE, LIT_LOCALIZE_FORMAT, LIT__END } ClockLiteral; @@ -80,9 +80,8 @@ typedef enum ClockLiteral { #define CLOCK_LITERAL_ARRAY(litarr) static const char *const litarr[] = { \ "", \ "%a %b %d %H:%M:%S %Z %Y", \ - "BCE", "C", \ - "cannot use -gmt and -timezone in same call", \ - "CE", \ + "system", "current", \ + "BCE", "C", "CE", \ "dayOfMonth", "dayOfWeek", "dayOfYear", \ "era", ":GMT", "gregorian", \ "integer value too large to represent", \ @@ -94,7 +93,8 @@ typedef enum ClockLiteral { "::tcl::clock::TZData", \ "::tcl::clock::GetSystemTimeZone", \ "::tcl::clock::SetupTimeZone", \ - "::tcl::clock::mcget", "::tcl::clock", \ + "::tcl::clock::mcget", \ + "::tcl::clock::GetSystemLocale", "::tcl::clock::mclocale", \ "::tcl::clock::LocalizeFormat" \ } diff --git a/library/clock.tcl b/library/clock.tcl index d4e29d5..f874e4d 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -2352,7 +2352,7 @@ proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { }] } { # message catalog dictionary: - set mcd [::msgcat::mcget ::tcl::clock $locale] + set mcd [mcget $locale] # Handle locale-dependent format groups by mapping them out of the format # string. Note that the order of the [string map] operations is @@ -3021,21 +3021,23 @@ proc ::tcl::clock::SetupTimeZone { timezone {alias {}} } { variable LegacyTimeZone - # Check may be a legacy zone: - if { $alias eq {} && ![catch { - set tzname [dict get $LegacyTimeZone [string tolower $timezone]] - }] } { - set tzname [::tcl::clock::SetupTimeZone $tzname $timezone] - set TZData($timezone) $TZData($tzname) - # tell backend - timezone is initialized and return shared timezone object: - return [configure -setup-tz $timezone] - } - # We couldn't parse this as a POSIX time zone. Try again with a # time zone file - this time without a colon if { [catch { LoadTimeZoneFile $timezone }] && [catch { LoadZoneinfoFile $timezone } - opts] } { + + # Check may be a legacy zone: + + if { $alias eq {} && ![catch { + set tzname [dict get $LegacyTimeZone [string tolower $timezone]] + }] } { + set tzname [::tcl::clock::SetupTimeZone $tzname $timezone] + set TZData($timezone) $TZData($tzname) + # tell backend - timezone is initialized and return shared timezone object: + return [configure -setup-tz $timezone] + } + dict unset opts -errorinfo dict set TimeZoneBad $timezone 1 return -options $opts "time zone $timezone not found" -- cgit v0.12 From e9177a25c1cbdc5ee7108dbadc69acab26f9abf5 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:34:11 +0000 Subject: bug fix by match word token (FindWordEnd fixed); repaired current locale switch --- generic/tclClockFmt.c | 6 +++--- library/clock.tcl | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 5d3dcaf..a10d05d 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -609,12 +609,12 @@ FindWordEnd( return ++p; } /* multi-char word */ - while (*p++ == *x++) { - if (x >= tok->tokWord.end || p >= end) { + do + if (*p++ != *x++) { /* no match -> error */ return NULL; } - }; + while (x <= tok->tokWord.end && p < end); return p; } diff --git a/library/clock.tcl b/library/clock.tcl index f874e4d..ca12f4a 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -739,7 +739,7 @@ proc ::tcl::clock::ParseClockFormatFormat {procName format locale} { # Map away the locale-dependent composite format groups - EnterLocale $locale + set locale [EnterLocale $locale] # Change locale if a fresh locale has been given on the command line. @@ -2189,6 +2189,7 @@ proc ::tcl::clock::EnterLocale { locale } { } # Select the locale, eventually load it mcpackagelocale set $locale + return $locale } #---------------------------------------------------------------------- @@ -3028,7 +3029,7 @@ proc ::tcl::clock::SetupTimeZone { timezone {alias {}} } { && [catch { LoadZoneinfoFile $timezone } - opts] } { # Check may be a legacy zone: - + if { $alias eq {} && ![catch { set tzname [dict get $LegacyTimeZone [string tolower $timezone]] }] } { @@ -4460,6 +4461,9 @@ proc ::tcl::clock::AddDays { days clockval timezone changeover } { #---------------------------------------------------------------------- proc ::tcl::clock::ChangeCurrentLocale {args} { + + configure -default-locale [lindex $args 0] + variable FormatProc variable LocaleNumeralCache -- cgit v0.12 From 36d60df82c46ec5b74df8d791793fc94347e7938 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:34:42 +0000 Subject: clock scan almost ready (currently test-case covered tokens only), test cases passed; todo - check other tokens from "clock.tcl" --- generic/tclClockFmt.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++----- generic/tclDate.h | 16 ++++++++++----- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index a10d05d..c8158cc 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -748,7 +748,7 @@ ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, amPmObj[0] = ClockMCGet(opts, MCLIT_AM); amPmObj[1] = ClockMCGet(opts, MCLIT_PM); - if (amPmObj[0] == NULL || amPmObj == NULL) { + if (amPmObj[0] == NULL || amPmObj[1] == NULL) { return TCL_ERROR; } @@ -768,6 +768,44 @@ ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, } static int +ClockScnToken_LocaleERA_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + ClockClientData *dataPtr = opts->clientData; + + int ret, val; + int minLen, maxLen; + Tcl_Obj *eraObj[6]; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + eraObj[0] = ClockMCGet(opts, MCLIT_BCE); + eraObj[1] = ClockMCGet(opts, MCLIT_CE); + eraObj[2] = dataPtr->mcLiterals[MCLIT_BCE2]; + eraObj[3] = dataPtr->mcLiterals[MCLIT_CE2]; + eraObj[4] = dataPtr->mcLiterals[MCLIT_BCE3]; + eraObj[5] = dataPtr->mcLiterals[MCLIT_CE3]; + + if (eraObj[0] == NULL || eraObj[1] == NULL) { + return TCL_ERROR; + } + + ret = ObjListSearch(opts, info, &val, eraObj, 6, + minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + if (val & 1) { + yydate.era = CE; + } else { + yydate.era = BCE; + } + + return TCL_OK; +} + +static int ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { @@ -782,7 +820,9 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, return ret; } - *(time_t *)(((char *)info) + tok->map->offs) = val; + if (tok->map->offs > 0) { + *(time_t *)(((char *)info) + tok->map->offs) = val; + } return TCL_OK; } @@ -931,9 +971,14 @@ static const char *ScnSTokenWrapMapIndex[2] = { }; static const char *ScnETokenMapIndex = - ""; + "Ey"; static ClockScanTokenMap ScnETokenMap[] = { - {0, 0, 0} + /* %EE */ + {CTOKT_PARSER, 0, 0, 0, 0, TclOffset(DateInfo, date.year), + ClockScnToken_LocaleERA_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ey */ + {CTOKT_PARSER, 0, 0, 0, 0, 0, /* currently no capture, parse only token */ + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *ScnETokenWrapMapIndex[2] = { "", @@ -1450,7 +1495,6 @@ ClockScan( } } } - yydate.era = CE; } } diff --git a/generic/tclDate.h b/generic/tclDate.h index e78d4f8..020fa64 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -58,8 +58,8 @@ typedef enum ClockLiteral { LIT__NIL, LIT__DEFAULT_FORMAT, - LIT_SYSTEM, LIT_CURRENT, - LIT_BCE, LIT_C, LIT_CE, + LIT_SYSTEM, LIT_CURRENT, LIT_C, + LIT_BCE, LIT_CE, LIT_DAYOFMONTH, LIT_DAYOFWEEK, LIT_DAYOFYEAR, LIT_ERA, LIT_GMT, LIT_GREGORIAN, LIT_INTEGER_VALUE_TOO_LARGE, @@ -80,8 +80,8 @@ typedef enum ClockLiteral { #define CLOCK_LITERAL_ARRAY(litarr) static const char *const litarr[] = { \ "", \ "%a %b %d %H:%M:%S %Z %Y", \ - "system", "current", \ - "BCE", "C", "CE", \ + "system", "current", "C", \ + "BCE", "CE", \ "dayOfMonth", "dayOfWeek", "dayOfYear", \ "era", ":GMT", "gregorian", \ "integer value too large to represent", \ @@ -107,6 +107,9 @@ typedef enum ClockMsgCtLiteral { MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_AM, MCLIT_PM, + MCLIT_BCE, MCLIT_CE, + MCLIT_BCE2, MCLIT_CE2, + MCLIT_BCE3, MCLIT_CE3, MCLIT_LOCALE_NUMERALS, MCLIT__END } ClockMsgCtLiteral; @@ -115,7 +118,10 @@ typedef enum ClockMsgCtLiteral { pref "", \ pref "MONTHS_FULL", pref "MONTHS_ABBREV", \ pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", \ - pref "AM", pref "PM", \ + pref "AM", pref "PM", \ + pref "BCE", pref "CE", \ + pref "b.c.e.", pref "c.e.", \ + pref "b.c.", pref "a.d.", \ pref "LOCALE_NUMERALS", \ } -- cgit v0.12 From e130d09c74bdbd2531f7c8bf75f5ede84eb0bdab Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:35:14 +0000 Subject: small optimization (determine min/max length, end distance, etc.) --- generic/tclClockFmt.c | 34 ++++++++++++++++++++++++++++++---- generic/tclDate.h | 3 ++- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index c8158cc..2873ff7 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -498,13 +498,24 @@ void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, { register const char*p = yyInput; *minLen = 0; - *maxLen = info->dateEnd - p; + /* max length to the end regarding distance to end (min-width of following tokens) */ + *maxLen = info->dateEnd - p - tok->endDistance; /* if no tokens anymore */ if (!(tok+1)->map) { /* should match to end or first space */ while (!isspace(UCHAR(*p)) && ++p < info->dateEnd) {}; *minLen = p - yyInput; + } else + /* next token is a word */ + if ((tok+1)->map->type == CTOKT_WORD) { + /* should match at least to the first char of this word */ + while (*p != *((tok+1)->tokWord.start) && ++p < info->dateEnd) {}; + *minLen = p - yyInput; + } + + if (*minLen > *maxLen) { + *maxLen = *minLen; } } @@ -1018,7 +1029,7 @@ static const char *ScnOTokenWrapMapIndex[2] = { static const char *ScnSpecTokenMapIndex = " "; static ClockScanTokenMap ScnSpecTokenMap[] = { - {CTOKT_SPACE, 0, 0, 1, 0xffff, 0, + {CTOKT_SPACE, 0, 0, 0, 0xffff, 0, NULL}, }; @@ -1131,9 +1142,9 @@ ClockGetOrParseScanFormat( tok->map = &scnMap[cp - mapIndex]; tok->tokWord.start = p; /* calculate look ahead value by standing together tokens */ - if (tok > fss->scnTok) { - ClockScanToken *prevTok = tok - 1; + if (tok > fss->scnTok && tok->map->minSize) { unsigned int lookAhead = tok->map->minSize; + ClockScanToken *prevTok = tok - 1; while (prevTok >= fss->scnTok) { if (prevTok->map->type != tok->map->type) { @@ -1177,6 +1188,21 @@ word_tok: continue; } + /* calculate end distance value for each tokens */ + if (tok > fss->scnTok) { + unsigned int endDist = 0; + ClockScanToken *prevTok = tok-1; + + while (prevTok >= fss->scnTok) { + prevTok->endDistance = endDist; + if (prevTok->map->type != CTOKT_WORD) { + endDist += prevTok->map->minSize; + } else { + endDist += prevTok->tokWord.end - prevTok->tokWord.start + 1; + } + prevTok--; + } + } done: Tcl_MutexUnlock(&ClockFmtMutex); } diff --git a/generic/tclDate.h b/generic/tclDate.h index 020fa64..00bd234 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -389,7 +389,8 @@ typedef struct ClockScanTokenMap { typedef struct ClockScanToken { ClockScanTokenMap *map; - unsigned int lookAhead; + unsigned short int lookAhead; + unsigned short int endDistance; struct { const char *start; const char *end; -- cgit v0.12 From 717e43f1bd2a2b769c8e2a60db22a98c8690db1a Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:35:34 +0000 Subject: estimate token count by % char and format length (don't use fix TOK_CHAIN_BLOCK_SIZE by creation, minimized memory usage) --- generic/tclClockFmt.c | 26 +++++++++++++++++++++----- generic/tclDate.h | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 2873ff7..ac34e68 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1080,14 +1080,30 @@ ClockGetOrParseScanFormat( const char *strFmt; register const char *p, *e, *cp; + e = strFmt = HashEntry4FmtScn(fss)->key.string; + e += strlen(strFmt); + + /* estimate token count by % char and format length */ + fss->scnTokC = 0; + p = strFmt; + while (p != e) { + if (*p++ == '%') fss->scnTokC++; + } + p = strFmt + fss->scnTokC * 2; + if (p < e) { + if ((e - p) < fss->scnTokC) { + fss->scnTokC += (e - p); + } else { + fss->scnTokC += fss->scnTokC; + } + } + fss->scnTokC++; + Tcl_MutexLock(&ClockFmtMutex); - fss->scnTokC = CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; - fss->scnTok = - tok = ckalloc(sizeof(*tok) * CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE); + fss->scnTok = tok = ckalloc(sizeof(*tok) * fss->scnTokC); memset(tok, 0, sizeof(*(tok))); - strFmt = HashEntry4FmtScn(fss)->key.string; - for (e = p = strFmt, e += strlen(strFmt); p != e; p++) { + for (p = strFmt; p != e; p++) { switch (*p) { case '%': if (1) { diff --git a/generic/tclDate.h b/generic/tclDate.h index 00bd234..9e1c506 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -355,7 +355,7 @@ typedef enum _MERIDIAN { #define CLOCK_FMT_SCN_STORAGE_GC_SIZE 32 -#define CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE 12 +#define CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE 2 typedef struct ClockScanToken ClockScanToken; -- cgit v0.12 From c5ff074db9dcb68224ba79b0e8a72edcbf63610a Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:36:19 +0000 Subject: cacheable conversions Local2UTC / UTC2Local fixed (some TZ switches time seconds bound) and optimized (last period ranges saved); prepare to back-port clock format --- generic/tclClock.c | 265 +++++++++++++++++++++++++++++++++------------- generic/tclClockFmt.c | 287 +++++++++++++++++++++++++++++++++++++++++++++++++- generic/tclDate.h | 28 ++++- library/clock.tcl | 14 --- 4 files changed, 502 insertions(+), 92 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a84300a..0c08391 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -72,19 +72,21 @@ TCL_DECLARE_MUTEX(clockMutex) static int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, TclDateFields *, Tcl_Obj *timezoneObj, int); static int ConvertUTCToLocalUsingTable(Tcl_Interp *, - TclDateFields *, int, Tcl_Obj *const[]); + TclDateFields *, int, Tcl_Obj *const[], + Tcl_WideInt rangesVal[2]); static int ConvertUTCToLocalUsingC(Tcl_Interp *, TclDateFields *, int); static int ConvertLocalToUTC(ClientData clientData, Tcl_Interp *, TclDateFields *, Tcl_Obj *timezoneObj, int); static int ConvertLocalToUTCUsingTable(Tcl_Interp *, - TclDateFields *, int, Tcl_Obj *const[]); + TclDateFields *, int, Tcl_Obj *const[], + Tcl_WideInt rangesVal[2]); static int ConvertLocalToUTCUsingC(Tcl_Interp *, TclDateFields *, int); static int ClockConfigureObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static Tcl_Obj * LookupLastTransition(Tcl_Interp *, Tcl_WideInt, - int, Tcl_Obj *const *); + int, Tcl_Obj *const *, Tcl_WideInt rangesVal[2]); static void GetYearWeekDay(TclDateFields *, int); static void GetGregorianEraYearDay(TclDateFields *, int); static void GetMonthDay(TclDateFields *); @@ -1432,6 +1434,7 @@ ConvertLocalToUTC( Tcl_Obj *tzdata; /* Time zone data */ int rowc; /* Number of rows in tzdata */ Tcl_Obj **rowv; /* Pointers to the rows */ + Tcl_WideInt seconds; /* fast phase-out for shared GMT-object (don't need to convert UTC 2 UTC) */ if (timezoneObj == dataPtr->GMTSetupTimeZone && dataPtr->GMTSetupTimeZone != NULL) { @@ -1442,17 +1445,37 @@ ConvertLocalToUTC( /* * Check cacheable conversion could be used - * (last-minute Local2UTC cache with the same TZ) + * (last-period Local2UTC cache within the same TZ) */ + seconds = fields->localSeconds - dataPtr->Local2UTC.tzOffset; if ( timezoneObj == dataPtr->Local2UTC.timezoneObj && ( fields->localSeconds == dataPtr->Local2UTC.localSeconds - || fields->localSeconds / 60 == dataPtr->Local2UTC.localSeconds / 60 + || ( seconds >= dataPtr->Local2UTC.rangesVal[0] + && seconds < dataPtr->Local2UTC.rangesVal[1]) ) && changeover == dataPtr->Local2UTC.changeover ) { /* the same time zone and offset (UTC time inside the last minute) */ fields->tzOffset = dataPtr->Local2UTC.tzOffset; - fields->seconds = fields->localSeconds - fields->tzOffset; + fields->seconds = seconds; + return TCL_OK; + } + + /* + * Check cacheable back-conversion could be used + * (last-period UTC2Local cache within the same TZ) + */ + seconds = fields->localSeconds - dataPtr->UTC2Local.tzOffset; + if ( timezoneObj == dataPtr->UTC2Local.timezoneObj + && ( seconds == dataPtr->UTC2Local.seconds + || ( seconds >= dataPtr->UTC2Local.rangesVal[0] + && seconds < dataPtr->UTC2Local.rangesVal[1]) + ) + && changeover == dataPtr->UTC2Local.changeover + ) { + /* the same time zone and offset (UTC time inside the last minute) */ + fields->tzOffset = dataPtr->UTC2Local.tzOffset; + fields->seconds = seconds; return TCL_OK; } @@ -1475,11 +1498,15 @@ ConvertLocalToUTC( */ if (rowc == 0) { + dataPtr->Local2UTC.rangesVal[0] = 0; + dataPtr->Local2UTC.rangesVal[1] = 0; + if (ConvertLocalToUTCUsingC(interp, fields, changeover) != TCL_OK) { return TCL_ERROR; }; } else { - if (ConvertLocalToUTCUsingTable(interp, fields, rowc, rowv) != TCL_OK) { + if (ConvertLocalToUTCUsingTable(interp, fields, rowc, rowv, + dataPtr->Local2UTC.rangesVal) != TCL_OK) { return TCL_ERROR; }; } @@ -1516,7 +1543,8 @@ ConvertLocalToUTCUsingTable( Tcl_Interp *interp, /* Tcl interpreter */ TclDateFields *fields, /* Time to convert, with 'seconds' filled in */ int rowc, /* Number of points at which time changes */ - Tcl_Obj *const rowv[]) /* Points at which time changes */ + Tcl_Obj *const rowv[], /* Points at which time changes */ + Tcl_WideInt rangesVal[2]) /* Return bounds for time period */ { Tcl_Obj *row; int cellc; @@ -1540,7 +1568,8 @@ ConvertLocalToUTCUsingTable( fields->tzOffset = 0; fields->seconds = fields->localSeconds; while (!found) { - row = LookupLastTransition(interp, fields->seconds, rowc, rowv); + row = LookupLastTransition(interp, fields->seconds, rowc, rowv, + rangesVal); if ((row == NULL) || TclListObjGetElements(interp, row, &cellc, &cellv) != TCL_OK @@ -1730,11 +1759,12 @@ ConvertUTCToLocal( /* * Check cacheable conversion could be used - * (last-minute UTC2Local cache with the same TZ) + * (last-period UTC2Local cache within the same TZ) */ if ( timezoneObj == dataPtr->UTC2Local.timezoneObj && ( fields->seconds == dataPtr->UTC2Local.seconds - || fields->seconds / 60 == dataPtr->UTC2Local.seconds / 60 + || ( fields->seconds >= dataPtr->UTC2Local.rangesVal[0] + && fields->seconds < dataPtr->UTC2Local.rangesVal[1]) ) && changeover == dataPtr->UTC2Local.changeover ) { @@ -1764,11 +1794,15 @@ ConvertUTCToLocal( */ if (rowc == 0) { + dataPtr->UTC2Local.rangesVal[0] = 0; + dataPtr->UTC2Local.rangesVal[1] = 0; + if (ConvertUTCToLocalUsingC(interp, fields, changeover) != TCL_OK) { return TCL_ERROR; } } else { - if (ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv) != TCL_OK) { + if (ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv, + dataPtr->UTC2Local.rangesVal) != TCL_OK) { return TCL_ERROR; } } @@ -1806,7 +1840,8 @@ ConvertUTCToLocalUsingTable( TclDateFields *fields, /* Fields of the date */ int rowc, /* Number of rows in the conversion table * (>= 1) */ - Tcl_Obj *const rowv[]) /* Rows of the conversion table */ + Tcl_Obj *const rowv[], /* Rows of the conversion table */ + Tcl_WideInt rangesVal[2]) /* Return bounds for time period */ { Tcl_Obj *row; /* Row containing the current information */ int cellc; /* Count of cells in the row (must be 4) */ @@ -1816,7 +1851,7 @@ ConvertUTCToLocalUsingTable( * Look up the nearest transition time. */ - row = LookupLastTransition(interp, fields->seconds, rowc, rowv); + row = LookupLastTransition(interp, fields->seconds, rowc, rowv, rangesVal); if (row == NULL || TclListObjGetElements(interp, row, &cellc, &cellv) != TCL_OK || TclGetIntFromObj(interp, cellv[1], &fields->tzOffset) != TCL_OK) { @@ -1943,12 +1978,13 @@ LookupLastTransition( Tcl_Interp *interp, /* Interpreter for error messages */ Tcl_WideInt tick, /* Time from the epoch */ int rowc, /* Number of rows of tzdata */ - Tcl_Obj *const *rowv) /* Rows in tzdata */ + Tcl_Obj *const *rowv, /* Rows in tzdata */ + Tcl_WideInt rangesVal[2]) /* Return bounds for time period */ { - int l; + int l = 0; int u; Tcl_Obj *compObj; - Tcl_WideInt compVal; + Tcl_WideInt compVal, fromVal = tick, toVal = tick; /* * Examine the first row to make sure we're in bounds. @@ -1965,14 +2001,13 @@ LookupLastTransition( */ if (tick < compVal) { - return rowv[0]; + goto done; } /* * Binary-search to find the transition. */ - l = 0; u = rowc-1; while (l < u) { int m = (l + u + 1) / 2; @@ -1983,10 +2018,19 @@ LookupLastTransition( } if (tick >= compVal) { l = m; + fromVal = compVal; } else { u = m-1; + toVal = compVal; } } + +done: + + if (rangesVal) { + rangesVal[0] = fromVal; + rangesVal[1] = toVal; + } return rowv[l]; } @@ -2713,7 +2757,7 @@ _ClockParseFmtScnArgs( Tcl_Interp *interp, /* Tcl interpreter */ int objc, /* Parameter count */ Tcl_Obj *const objv[], /* Parameter vector */ - ClockFmtScnCmdArgs *resOpts, /* Result vector: format, locale, timezone... */ + ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */ int forScan /* Flag to differentiate between format and scan */ ) { ClockClientData *dataPtr = clientData; @@ -2739,7 +2783,7 @@ _ClockParseFmtScnArgs( * Extract values for the keywords. */ - memset(resOpts, 0, sizeof(*resOpts)); + memset(opts, 0, sizeof(*opts)); for (i = 2; i < objc; i+=2) { if (Tcl_GetIndexFromObj(interp, objv[i], options[forScan], "option", 0, &optionIndex) != TCL_OK) { @@ -2749,7 +2793,7 @@ _ClockParseFmtScnArgs( } switch (optionIndex) { case CLOCK_FORMAT_FORMAT: - resOpts->formatObj = objv[i+1]; + opts->formatObj = objv[i+1]; break; case CLOCK_FORMAT_GMT: if (Tcl_GetBooleanFromObj(interp, objv[i+1], &gmtFlag) != TCL_OK){ @@ -2757,13 +2801,13 @@ _ClockParseFmtScnArgs( } break; case CLOCK_FORMAT_LOCALE: - resOpts->localeObj = objv[i+1]; + opts->localeObj = objv[i+1]; break; case CLOCK_FORMAT_TIMEZONE: - resOpts->timezoneObj = objv[i+1]; + opts->timezoneObj = objv[i+1]; break; case CLOCK_FORMAT_BASE: - resOpts->baseObj = objv[i+1]; + opts->baseObj = objv[i+1]; break; } saw |= 1 << optionIndex; @@ -2780,11 +2824,30 @@ _ClockParseFmtScnArgs( return TCL_ERROR; } if (gmtFlag) { - resOpts->timezoneObj = litPtr[LIT_GMT]; + opts->timezoneObj = litPtr[LIT_GMT]; + } + + opts->clientData = clientData; + opts->interp = interp; + + /* If time zone not specified use system time zone */ + + if ( opts->timezoneObj == NULL + || TclGetString(opts->timezoneObj) == NULL + || opts->timezoneObj->length == 0 + ) { + opts->timezoneObj = ClockGetSystemTimeZone(clientData, interp); + if (opts->timezoneObj == NULL) { + return TCL_ERROR; + } } - resOpts->clientData = clientData; - resOpts->interp = interp; + /* Setup timezone (normalize object if needed and load TZ on demand) */ + + opts->timezoneObj = ClockSetupTimeZone(clientData, interp, opts->timezoneObj); + if (opts->timezoneObj == NULL) { + return TCL_ERROR; + } return TCL_OK; } @@ -2816,7 +2879,7 @@ ClockParseformatargsObjCmd( { ClockClientData *dataPtr = clientData; Tcl_Obj **literals = dataPtr->literals; - ClockFmtScnCmdArgs resOpts; /* Format, locale and timezone */ + ClockFmtScnCmdArgs opts; /* Format, locale and timezone */ Tcl_WideInt clockVal; /* Clock value - just used to parse. */ int ret; @@ -2837,7 +2900,7 @@ ClockParseformatargsObjCmd( */ ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, - &resOpts, 0); + &opts, 0); if (ret != TCL_OK) { return ret; } @@ -2849,18 +2912,110 @@ ClockParseformatargsObjCmd( if (Tcl_GetWideIntFromObj(interp, objv[1], &clockVal) != TCL_OK) { return TCL_ERROR; } - if (resOpts.formatObj == NULL) - resOpts.formatObj = literals[LIT__DEFAULT_FORMAT]; - if (resOpts.localeObj == NULL) - resOpts.localeObj = literals[LIT_C]; - if (resOpts.timezoneObj == NULL) - resOpts.timezoneObj = literals[LIT__NIL]; + if (opts.formatObj == NULL) + opts.formatObj = literals[LIT__DEFAULT_FORMAT]; + if (opts.localeObj == NULL) + opts.localeObj = literals[LIT_C]; + if (opts.timezoneObj == NULL) + opts.timezoneObj = literals[LIT__NIL]; /* * Return options as a list. */ - Tcl_SetObjResult(interp, Tcl_NewListObj(3, (Tcl_Obj**)&resOpts.formatObj)); + Tcl_SetObjResult(interp, Tcl_NewListObj(3, (Tcl_Obj**)&opts.formatObj)); + return TCL_OK; +} + +/*---------------------------------------------------------------------- + * + * ClockFormatObjCmd - + * + *---------------------------------------------------------------------- + */ + +int +ClockFormatObjCmd( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Parameter count */ + Tcl_Obj *const objv[]) /* Parameter values */ +{ + ClockClientData *dataPtr = clientData; + + int ret; + ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ + Tcl_WideInt clockVal; /* Time, expressed in seconds from the Epoch */ + DateInfo yy; /* Common structure used for parsing */ + DateInfo *info = &yy; + + if ((objc & 1) == 1) { + Tcl_WrongNumArgs(interp, 1, objv, "string " + "?-format string? " + "?-gmt boolean? " + "?-locale LOCALE? ?-timezone ZONE?"); + Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", NULL); + return TCL_ERROR; + } + + /* + * Extract values for the keywords. + */ + + ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, + &opts, 0); + if (ret != TCL_OK) { + return ret; + } + + ret = TCL_ERROR; + + if (Tcl_GetWideIntFromObj(interp, objv[1], &clockVal) != TCL_OK) { + return TCL_ERROR; + } + + + ClockInitDateInfo(info); + yydate.tzName = NULL; + + /* + * Extract year, month and day from the base time for the parser to use as + * defaults + */ + + /* check base fields already cached (by TZ, last-second cache) */ + if ( dataPtr->lastBase.timezoneObj == opts.timezoneObj + && dataPtr->lastBase.Date.seconds == clockVal) { + memcpy(&yydate, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); + } else { + /* extact fields from base */ + yydate.seconds = clockVal; + if (ClockGetDateFields(clientData, interp, &yydate, opts.timezoneObj, + GREGORIAN_CHANGE_DATE) != TCL_OK) { + goto done; + } + /* cache last base */ + memcpy(&dataPtr->lastBase.Date, &yydate, ClockCacheableDateFieldsSize); + Tcl_SetObjRef(dataPtr->lastBase.timezoneObj, opts.timezoneObj); + } + + /* Default format */ + if (opts.formatObj == NULL) { + opts.formatObj = dataPtr->literals[LIT__DEFAULT_FORMAT]; + } + + /* Use compiled version of Format - */ + + ret = ClockFormat(clientData, interp, info, &opts); + +done: + + Tcl_UnsetObjRef(yydate.tzName); + + if (ret != TCL_OK) { + return ret; + } + return TCL_OK; } @@ -2879,7 +3034,6 @@ ClockScanObjCmd( Tcl_Obj *const objv[]) /* Parameter values */ { ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; int ret; ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ @@ -2919,29 +3073,9 @@ ClockScanObjCmd( baseVal = (Tcl_WideInt) now.sec; } - /* If time zone not specified use system time zone */ - if ( opts.timezoneObj == NULL - || TclGetString(opts.timezoneObj) == NULL - || opts.timezoneObj->length == 0 - ) { - opts.timezoneObj = ClockGetSystemTimeZone(clientData, interp); - if (opts.timezoneObj == NULL) { - return TCL_ERROR; - } - } - - /* Setup timezone (normalize object id needed and load TZ on demand) */ - - opts.timezoneObj = ClockSetupTimeZone(clientData, interp, opts.timezoneObj); - if (opts.timezoneObj == NULL) { - return TCL_ERROR; - } - ClockInitDateInfo(info); yydate.tzName = NULL; - // Tcl_SetObjRef(yydate.tzName, opts.timezoneObj); - /* * Extract year, month and day from the base time for the parser to use as * defaults @@ -2979,20 +3113,6 @@ ClockScanObjCmd( } ret = ClockFreeScan(clientData, interp, info, objv[1], &opts); } -#if 0 - else - if (1) { - /* TODO: Tcled Scan proc - */ - int ret; - Tcl_Obj *callargs[10]; - memcpy(callargs, objv, objc * sizeof(*objv)); - callargs[0] = Tcl_NewStringObj("::tcl::clock::__org_scan", -1); - Tcl_IncrRefCount(callargs[0]); - ret = Tcl_EvalObjv(interp, objc, callargs, 0); - Tcl_DecrRefCount(callargs[0]); - return ret; - } -#endif else { /* Use compiled version of Scan - */ @@ -3073,7 +3193,6 @@ ClockFreeScan( ClockFmtScnCmdArgs *opts) /* Command options */ { ClockClientData *dataPtr = clientData; - // Tcl_Obj **literals = dataPtr->literals; int ret = TCL_ERROR; diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index ac34e68..5469ee1 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1091,7 +1091,7 @@ ClockGetOrParseScanFormat( } p = strFmt + fss->scnTokC * 2; if (p < e) { - if ((e - p) < fss->scnTokC) { + if ((unsigned int)(e - p) < fss->scnTokC) { fss->scnTokC += (e - p); } else { fss->scnTokC += fss->scnTokC; @@ -1581,6 +1581,291 @@ done: return ret; } +/* + *---------------------------------------------------------------------- + */ +int +ClockFormat( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + register DateInfo *info, /* Date fields used for parsing & converting */ + ClockFmtScnCmdArgs *opts) /* Command options */ +{ + ClockClientData *dataPtr = clientData; + ClockFormatToken *tok; + ClockFormatTokenMap *map; + + /* get localized format */ + if (ClockLocalizeFormat(opts) == NULL) { + return TCL_ERROR; + } + +/* if ((tok = ClockGetOrParseFmtFormat(interp, opts->formatObj)) == NULL) { + return TCL_ERROR; + } +*/ +#if 0 + /* prepare parsing */ + + yyMeridian = MER24; + + p = TclGetString(strObj); + end = p + strObj->length; + /* in strict mode - bypass spaces at begin / end only (not between tokens) */ + if (opts->flags & CLF_STRICT) { + while (p < end && isspace(UCHAR(*p))) { + p++; + } + } + info->dateStart = yyInput = p; + info->dateEnd = end; + + /* parse string */ + for (; tok->map != NULL; tok++) { + map = tok->map; + /* bypass spaces at begin of input before parsing each token */ + if ( !(opts->flags & CLF_STRICT) + && (map->type != CTOKT_SPACE && map->type != CTOKT_WORD) + ) { + while (p < end && isspace(UCHAR(*p))) { + p++; + } + } + yyInput = p; + switch (map->type) + { + case CTOKT_DIGIT: + if (1) { + int size = map->maxSize; + int sign = 1; + if (map->flags & CLF_SIGNED) { + if (*p == '+') { yyInput = ++p; } + else + if (*p == '-') { yyInput = ++p; sign = -1; }; + } + /* greedy find digits (look for forward digits consider spaces), + * corresponding pre-calculated lookAhead */ + if (size != map->minSize && tok->lookAhead) { + int spcnt = 0; + const char *pe; + size += tok->lookAhead; + x = p + size; if (x > end) { x = end; }; + pe = x; + while (p < x) { + if (isspace(UCHAR(*p))) { + if (pe > p) { pe = p; }; + if (x < end) x++; + p++; + spcnt++; + continue; + } + if (isdigit(UCHAR(*p))) { + p++; + continue; + } + break; + } + /* consider reserved (lookAhead) for next tokens */ + p -= tok->lookAhead + spcnt; + if (p > pe) { + p = pe; + } + } else { + x = p + size; if (x > end) { x = end; }; + while (isdigit(UCHAR(*p)) && p < x) { p++; }; + } + size = p - yyInput; + if (size < map->minSize) { + /* missing input -> error */ + goto not_match; + } + /* string 2 number, put number into info structure by offset */ + p = yyInput; x = p + size; + if (!(map->flags & CLF_LOCALSEC)) { + if (_str2int((time_t *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; + } else { + if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; + } + flags = (flags & ~map->clearFlags) | map->flags; + } + break; + case CTOKT_PARSER: + switch (map->parser(opts, info, tok)) { + case TCL_OK: + break; + case TCL_RETURN: + goto not_match; + break; + default: + goto done; + break; + }; + p = yyInput; + flags = (flags & ~map->clearFlags) | map->flags; + break; + case CTOKT_SPACE: + /* at least one space in strict mode */ + if (opts->flags & CLF_STRICT) { + if (!isspace(UCHAR(*p))) { + /* unmatched -> error */ + goto not_match; + } + p++; + } + while (p < end && isspace(UCHAR(*p))) { + p++; + } + break; + case CTOKT_WORD: + x = FindWordEnd(tok, p, end); + if (!x) { + /* no match -> error */ + goto not_match; + } + p = x; + continue; + break; + } + } + + /* ignore spaces at end */ + while (p < end && isspace(UCHAR(*p))) { + p++; + } + /* check end was reached */ + if (p < end) { + /* something after last token - wrong format */ + goto not_match; + } + + /* + * Invalidate result + */ + + /* seconds token (%s) take precedence over all other tokens */ + if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) { + if (flags & CLF_DATE) { + + if (!(flags & CLF_JULIANDAY)) { + info->flags |= CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY; + + /* dd precedence below ddd */ + switch (flags & (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH)) { + case (CLF_DAYOFYEAR|CLF_DAYOFMONTH): + /* miss month: ddd over dd (without month) */ + flags &= ~CLF_DAYOFMONTH; + case (CLF_DAYOFYEAR): + /* ddd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + break; + case (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH): + /* both available: mmdd over ddd */ + flags &= ~CLF_DAYOFYEAR; + case (CLF_MONTH|CLF_DAYOFMONTH): + case (CLF_DAYOFMONTH): + /* mmdd / dd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + break; + } + + /* YearWeekDay below YearMonthDay */ + if ( (flags & CLF_ISO8601) + && ( (flags & (CLF_YEAR|CLF_DAYOFYEAR)) == (CLF_YEAR|CLF_DAYOFYEAR) + || (flags & (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH)) == (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH) + ) + ) { + /* yy precedence below yyyy */ + if (!(flags & CLF_ISO8601CENTURY) && (flags & CLF_CENTURY)) { + /* normally precedence of ISO is higher, but no century - so put it down */ + flags &= ~CLF_ISO8601; + } + else + /* yymmdd or yyddd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + } + + if (!(flags & CLF_ISO8601)) { + if (yyYear < 100) { + if (!(flags & CLF_CENTURY)) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { + yyYear -= 100; + } + yyYear += dataPtr->currentYearCentury; + } else { + yyYear += info->dateCentury * 100; + } + } + } else { + if (info->date.iso8601Year < 100) { + if (!(flags & CLF_ISO8601CENTURY)) { + if (info->date.iso8601Year >= dataPtr->yearOfCenturySwitch) { + info->date.iso8601Year -= 100; + } + info->date.iso8601Year += dataPtr->currentYearCentury; + } else { + info->date.iso8601Year += info->dateCentury * 100; + } + } + } + } + } + + /* if no time - reset time */ + if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yydate.localSeconds = 0; + } + + if (flags & CLF_TIME) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yySeconds = ToSeconds(yyHour, yyMinutes, + yySeconds, yyMeridian); + } else + if (!(flags & CLF_LOCALSEC)) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; + } + } + + /* tell caller which flags were set */ + info->flags |= flags; + + ret = TCL_OK; + goto done; + +overflow: + + Tcl_SetResult(interp, "requested date too large to represent", + TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "dateTooLarge", NULL); + goto done; + +not_match: + + Tcl_SetResult(interp, "input string does not match supplied format", + TCL_STATIC); + Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); + +done: + + return ret; +#endif +} + MODULE_SCOPE void ClockFrmScnClearCaches(void) diff --git a/generic/tclDate.h b/generic/tclDate.h index 9e1c506..112ed31 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -2,7 +2,7 @@ * tclDate.h -- * * This header file handles common usage of clock primitives - * between tclDate.c (yacc) and tclClock.c. + * between tclDate.c (yacc), tclClock.c and tclClockFmt.c. * * Copyright (c) 2014 Serg G. Brester (aka sebres) * @@ -317,22 +317,24 @@ typedef struct ClockClientData { Tcl_Obj *timezoneObj; TclDateFields Date; } lastBase; - /* Las-minute cache for fast UTC2Local conversion */ + /* Las-period cache for fast UTC2Local conversion */ struct { /* keys */ Tcl_Obj *timezoneObj; int changeover; Tcl_WideInt seconds; + Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ /* values */ time_t tzOffset; Tcl_Obj *tzName; } UTC2Local; - /* Las-minute cache for fast Local2UTC conversion */ + /* Las-period cache for fast Local2UTC conversion */ struct { /* keys */ Tcl_Obj *timezoneObj; int changeover; Tcl_WideInt localSeconds; + Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ /* values */ time_t tzOffset; } Local2UTC; @@ -372,8 +374,22 @@ typedef enum _CLCKTOK_TYPE { typedef struct ClockFmtScnStorage ClockFmtScnStorage; +typedef struct ClockFormatTokenMap { + unsigned short int type; + unsigned short int flags; + unsigned short int clearFlags; + unsigned short int minSize; + unsigned short int maxSize; + unsigned short int offs; + ClockScanTokenProc *parser; + void *data; +} ClockFormatTokenMap; typedef struct ClockFormatToken { - CLCKTOK_TYPE type; + ClockFormatTokenMap *map; + struct { + const char *start; + const char *end; + } tokWord; } ClockFormatToken; typedef struct ClockScanTokenMap { @@ -447,10 +463,14 @@ MODULE_SCOPE ClockFmtScnStorage * Tcl_Obj *objPtr); MODULE_SCOPE Tcl_Obj * ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); + MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); +MODULE_SCOPE int ClockFormat(ClientData clientData, Tcl_Interp *interp, + register DateInfo *info, ClockFmtScnCmdArgs *opts); + MODULE_SCOPE void ClockFrmScnClearCaches(void); /* diff --git a/library/clock.tcl b/library/clock.tcl index ca12f4a..c4e698c 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -685,20 +685,6 @@ proc ::tcl::clock::format { args } { set locale [string tolower $locale] set clockval [lindex $args 0] - # Get the data for time changes in the given zone - - if {$timezone eq ""} { - if {[set timezone [configure -system-tz]] eq ""} { - set timezone [GetSystemTimeZone] - } - } - if {![info exists TZData($timezone)]} { - if {[catch {set timezone [SetupTimeZone $timezone]} retval opts]} { - dict unset opts -errorinfo - return -options $opts $retval - } - } - # Build a procedure to format the result. Cache the built procedure's name # in the 'FormatProc' array to avoid losing its internal representation, # which contains the name resolution. -- cgit v0.12 From 2ba998572c987982e003b6f55f1c51f12bf4b4ce Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:37:40 +0000 Subject: string index tree for fast greedy search of the string (index) by unique string prefix as key; clock scan rewritten to use string index tries search; --- generic/tclClock.c | 74 ++++--- generic/tclClockFmt.c | 444 ++++++++++++++++------------------------- generic/tclDate.h | 22 +- generic/tclStrIdxTree.c | 519 ++++++++++++++++++++++++++++++++++++++++++++++++ generic/tclStrIdxTree.h | 134 +++++++++++++ unix/Makefile.in | 4 + win/Makefile.in | 1 + win/makefile.vc | 1 + 8 files changed, 865 insertions(+), 334 deletions(-) create mode 100644 generic/tclStrIdxTree.c create mode 100644 generic/tclStrIdxTree.h diff --git a/generic/tclClock.c b/generic/tclClock.c index 0c08391..e52b2e7 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -15,6 +15,7 @@ */ #include "tclInt.h" +#include "tclStrIdxTree.h" #include "tclDate.h" /* @@ -140,6 +141,10 @@ static unsigned long TzsetGetEpoch(void); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); +static int ClockTestObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); + /* * Structure containing description of "native" clock commands to create. */ @@ -169,6 +174,7 @@ static const struct ClockCommand clockCommands[] = { { "GetJulianDayFromEraYearWeekDay", ClockGetjuliandayfromerayearweekdayObjCmd }, { "ParseFormatArgs", ClockParseformatargsObjCmd }, + { "_test", TclStrIdxTreeTestObjCmd }, { NULL, NULL } }; @@ -584,7 +590,7 @@ ClockMCGet( } MODULE_SCOPE Tcl_Obj * -ClockMCGetListIdxDict( +ClockMCGetIdx( ClockFmtScnCmdArgs *opts, int mcKey) { @@ -598,53 +604,45 @@ ClockMCGetListIdxDict( return NULL; } - /* try to get indices dictionray, - * if not available - create from list */ + /* try to get indices object */ + if (dataPtr->mcLitIdxs == NULL) { + return NULL; + } if (Tcl_DictObjGet(NULL, opts->mcDictObj, dataPtr->mcLitIdxs[mcKey], &valObj) != TCL_OK ) { - Tcl_Obj **lstv, *intObj; - int i, lstc; + return NULL; + } - if (dataPtr->mcLitIdxs == NULL) { - dataPtr->mcLitIdxs = ckalloc(MCLIT__END * sizeof(Tcl_Obj*)); - for (i = 0; i < MCLIT__END; ++i) { - Tcl_InitObjRef(dataPtr->mcLitIdxs[i], - Tcl_NewStringObj(MsgCtLitIdxs[i], -1)); - } - } + return valObj; +} - if (Tcl_DictObjGet(opts->interp, opts->mcDictObj, - dataPtr->mcLiterals[mcKey], &valObj) != TCL_OK) { - return NULL; - }; - if (TclListObjGetElements(opts->interp, valObj, - &lstc, &lstv) != TCL_OK) { - return NULL; - }; +MODULE_SCOPE int +ClockMCSetIdx( + ClockFmtScnCmdArgs *opts, + int mcKey, Tcl_Obj *valObj) +{ + ClockClientData *dataPtr = opts->clientData; - valObj = Tcl_NewDictObj(); - for (i = 0; i < lstc; i++) { - intObj = Tcl_NewIntObj(i); - if (Tcl_DictObjPut(opts->interp, valObj, - lstv[i], intObj) != TCL_OK - ) { - Tcl_DecrRefCount(valObj); - Tcl_DecrRefCount(intObj); - return NULL; - } - }; + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return TCL_ERROR; + } - if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, - dataPtr->mcLitIdxs[mcKey], valObj) != TCL_OK - ) { - Tcl_DecrRefCount(valObj); - return NULL; + /* if literal storage for indices not yet created */ + if (dataPtr->mcLitIdxs == NULL) { + int i; + dataPtr->mcLitIdxs = ckalloc(MCLIT__END * sizeof(Tcl_Obj*)); + for (i = 0; i < MCLIT__END; ++i) { + Tcl_InitObjRef(dataPtr->mcLitIdxs[i], + Tcl_NewStringObj(MsgCtLitIdxs[i], -1)); } - }; + } - return valObj; + return Tcl_DictObjPut(opts->interp, opts->mcDictObj, + dataPtr->mcLitIdxs[mcKey], valObj); } /* diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 5469ee1..e66c525 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -11,6 +11,7 @@ */ #include "tclInt.h" +#include "tclStrIdxTree.h" #include "tclDate.h" /* @@ -33,6 +34,9 @@ static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); static void ClockFrmScnFinalize(ClientData clientData); +/* Msgcat index literals prefixed with _IDX_, used for quick dictionary search */ +CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); + /* * Clock scan and format facilities. */ @@ -583,6 +587,139 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, minLen, maxLen); } +static TclStrIdxTree * +ClockMCGetListIdxTree( + ClockFmtScnCmdArgs *opts, + int mcKey) +{ + TclStrIdxTree * idxTree; + Tcl_Obj *objPtr = ClockMCGetIdx(opts, mcKey); + if ( objPtr != NULL + && (idxTree = TclStrIdxTreeGetFromObj(objPtr)) != NULL + ) { + return idxTree; + + } else { + /* build new index */ + + Tcl_Obj **lstv; + int lstc; + Tcl_Obj *valObj; + + objPtr = TclStrIdxTreeNewObj(); + if ((idxTree = TclStrIdxTreeGetFromObj(objPtr)) == NULL) { + goto done; /* unexpected, but ...*/ + } + + valObj = ClockMCGet(opts, mcKey); + if (valObj == NULL) { + goto done; + } + + if (TclListObjGetElements(opts->interp, valObj, + &lstc, &lstv) != TCL_OK) { + goto done; + }; + + if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv) != TCL_OK) { + goto done; + } + + ClockMCSetIdx(opts, mcKey, objPtr); + objPtr = NULL; + }; + +done: + if (objPtr) { + Tcl_DecrRefCount(objPtr); + idxTree = NULL; + } + + return idxTree; +} + +static TclStrIdxTree * +ClockMCGetMultiListIdxTree( + ClockFmtScnCmdArgs *opts, + int mcKey, + int *mcKeys) +{ + TclStrIdxTree * idxTree; + Tcl_Obj *objPtr = ClockMCGetIdx(opts, mcKey); + if ( objPtr != NULL + && (idxTree = TclStrIdxTreeGetFromObj(objPtr)) != NULL + ) { + return idxTree; + + } else { + /* build new index */ + + Tcl_Obj **lstv; + int lstc; + Tcl_Obj *valObj; + + objPtr = TclStrIdxTreeNewObj(); + if ((idxTree = TclStrIdxTreeGetFromObj(objPtr)) == NULL) { + goto done; /* unexpected, but ...*/ + } + + while (*mcKeys) { + + valObj = ClockMCGet(opts, *mcKeys); + if (valObj == NULL) { + goto done; + } + + if (TclListObjGetElements(opts->interp, valObj, + &lstc, &lstv) != TCL_OK) { + goto done; + }; + + if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv) != TCL_OK) { + goto done; + } + mcKeys++; + } + + ClockMCSetIdx(opts, mcKey, objPtr); + }; + +done: + if (objPtr) { + Tcl_DecrRefCount(objPtr); + idxTree = NULL; + } + + return idxTree; +} + +inline int +ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, TclStrIdxTree *idxTree, int *val, + int minLen, int maxLen) +{ + const char *f; + TclStrIdx *foundItem; + f = TclStrIdxTreeSearch(NULL, &foundItem, idxTree, + yyInput, yyInput + maxLen); + + if (f <= yyInput || (f - yyInput) < minLen) { + /* not found */ + return TCL_RETURN; + } + if (foundItem->value == -1) { + /* ambigous */ + return TCL_RETURN; + } + + *val = foundItem->value; + + /* shift input pointer */ + yyInput = f; + + return TCL_OK; +} + static int StaticListSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, const char **lst, int *val) @@ -612,21 +749,19 @@ FindWordEnd( register const char * p, const char * end) { register const char *x = tok->tokWord.start; - if (x == tok->tokWord.end) { /* single char word */ - if (*p != *x) { - /* no match -> error */ - return NULL; + const char *pfnd; + if (x == tok->tokWord.end - 1) { /* fast phase-out for single char word */ + if (*p == *x) { + return ++p; } - return ++p; } /* multi-char word */ - do - if (*p++ != *x++) { - /* no match -> error */ - return NULL; - } - while (x <= tok->tokWord.end && p < end); - return p; + x = TclUtfFindEqualNC(x, tok->tokWord.end, p, end, &pfnd); + if (x < tok->tokWord.end) { + /* no match -> error */ + return NULL; + } + return pfnd; } static int @@ -822,11 +957,18 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, { int ret, val; int minLen, maxLen; + TclStrIdxTree *idxTree; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); - ret = LocaleListSearch(opts, info, (int)tok->map->data, &val, - minLen, maxLen); + /* get or create tree in msgcat dict */ + + idxTree = ClockMCGetListIdxTree(opts, (int)tok->map->data /* mcKey */); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); if (ret != TCL_OK) { return ret; } @@ -1120,7 +1262,8 @@ ClockGetOrParseScanFormat( /* begin new word token - don't join with previous word token, * because current mapping should be "...%%..." -> "...%..." */ tok->map = &ScnWordTokenMap; - tok->tokWord.start = tok->tokWord.end = p; + tok->tokWord.start = p; + tok->tokWord.end = p+1; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); continue; break; @@ -1190,7 +1333,7 @@ word_tok: if (tok > fss->scnTok && (tok-1)->map == &ScnWordTokenMap) { wordTok = tok-1; } - wordTok->tokWord.end = p; + wordTok->tokWord.end = p+1; if (wordTok == tok) { wordTok->tokWord.start = p; wordTok->map = &ScnWordTokenMap; @@ -1214,7 +1357,7 @@ word_tok: if (prevTok->map->type != CTOKT_WORD) { endDist += prevTok->map->minSize; } else { - endDist += prevTok->tokWord.end - prevTok->tokWord.start + 1; + endDist += prevTok->tokWord.end - prevTok->tokWord.start; } prevTok--; } @@ -1325,6 +1468,11 @@ ClockScan( yyMeridian = MER24; + /* lower case given string into new object */ + strObj = Tcl_NewStringObj(TclGetString(strObj), strObj->length); + Tcl_IncrRefCount(strObj); + strObj->length = Tcl_UtfToLower(TclGetString(strObj)); + p = TclGetString(strObj); end = p + strObj->length; /* in strict mode - bypass spaces at begin / end only (not between tokens) */ @@ -1578,6 +1726,8 @@ not_match: done: + Tcl_DecrRefCount(strObj); + return ret; } @@ -1604,266 +1754,6 @@ ClockFormat( return TCL_ERROR; } */ -#if 0 - /* prepare parsing */ - - yyMeridian = MER24; - - p = TclGetString(strObj); - end = p + strObj->length; - /* in strict mode - bypass spaces at begin / end only (not between tokens) */ - if (opts->flags & CLF_STRICT) { - while (p < end && isspace(UCHAR(*p))) { - p++; - } - } - info->dateStart = yyInput = p; - info->dateEnd = end; - - /* parse string */ - for (; tok->map != NULL; tok++) { - map = tok->map; - /* bypass spaces at begin of input before parsing each token */ - if ( !(opts->flags & CLF_STRICT) - && (map->type != CTOKT_SPACE && map->type != CTOKT_WORD) - ) { - while (p < end && isspace(UCHAR(*p))) { - p++; - } - } - yyInput = p; - switch (map->type) - { - case CTOKT_DIGIT: - if (1) { - int size = map->maxSize; - int sign = 1; - if (map->flags & CLF_SIGNED) { - if (*p == '+') { yyInput = ++p; } - else - if (*p == '-') { yyInput = ++p; sign = -1; }; - } - /* greedy find digits (look for forward digits consider spaces), - * corresponding pre-calculated lookAhead */ - if (size != map->minSize && tok->lookAhead) { - int spcnt = 0; - const char *pe; - size += tok->lookAhead; - x = p + size; if (x > end) { x = end; }; - pe = x; - while (p < x) { - if (isspace(UCHAR(*p))) { - if (pe > p) { pe = p; }; - if (x < end) x++; - p++; - spcnt++; - continue; - } - if (isdigit(UCHAR(*p))) { - p++; - continue; - } - break; - } - /* consider reserved (lookAhead) for next tokens */ - p -= tok->lookAhead + spcnt; - if (p > pe) { - p = pe; - } - } else { - x = p + size; if (x > end) { x = end; }; - while (isdigit(UCHAR(*p)) && p < x) { p++; }; - } - size = p - yyInput; - if (size < map->minSize) { - /* missing input -> error */ - goto not_match; - } - /* string 2 number, put number into info structure by offset */ - p = yyInput; x = p + size; - if (!(map->flags & CLF_LOCALSEC)) { - if (_str2int((time_t *)(((char *)info) + map->offs), - p, x, sign) != TCL_OK) { - goto overflow; - } - p = x; - } else { - if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), - p, x, sign) != TCL_OK) { - goto overflow; - } - p = x; - } - flags = (flags & ~map->clearFlags) | map->flags; - } - break; - case CTOKT_PARSER: - switch (map->parser(opts, info, tok)) { - case TCL_OK: - break; - case TCL_RETURN: - goto not_match; - break; - default: - goto done; - break; - }; - p = yyInput; - flags = (flags & ~map->clearFlags) | map->flags; - break; - case CTOKT_SPACE: - /* at least one space in strict mode */ - if (opts->flags & CLF_STRICT) { - if (!isspace(UCHAR(*p))) { - /* unmatched -> error */ - goto not_match; - } - p++; - } - while (p < end && isspace(UCHAR(*p))) { - p++; - } - break; - case CTOKT_WORD: - x = FindWordEnd(tok, p, end); - if (!x) { - /* no match -> error */ - goto not_match; - } - p = x; - continue; - break; - } - } - - /* ignore spaces at end */ - while (p < end && isspace(UCHAR(*p))) { - p++; - } - /* check end was reached */ - if (p < end) { - /* something after last token - wrong format */ - goto not_match; - } - - /* - * Invalidate result - */ - - /* seconds token (%s) take precedence over all other tokens */ - if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) { - if (flags & CLF_DATE) { - - if (!(flags & CLF_JULIANDAY)) { - info->flags |= CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY; - - /* dd precedence below ddd */ - switch (flags & (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH)) { - case (CLF_DAYOFYEAR|CLF_DAYOFMONTH): - /* miss month: ddd over dd (without month) */ - flags &= ~CLF_DAYOFMONTH; - case (CLF_DAYOFYEAR): - /* ddd over naked weekday */ - if (!(flags & CLF_ISO8601YEAR)) { - flags &= ~CLF_ISO8601; - } - break; - case (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH): - /* both available: mmdd over ddd */ - flags &= ~CLF_DAYOFYEAR; - case (CLF_MONTH|CLF_DAYOFMONTH): - case (CLF_DAYOFMONTH): - /* mmdd / dd over naked weekday */ - if (!(flags & CLF_ISO8601YEAR)) { - flags &= ~CLF_ISO8601; - } - break; - } - - /* YearWeekDay below YearMonthDay */ - if ( (flags & CLF_ISO8601) - && ( (flags & (CLF_YEAR|CLF_DAYOFYEAR)) == (CLF_YEAR|CLF_DAYOFYEAR) - || (flags & (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH)) == (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH) - ) - ) { - /* yy precedence below yyyy */ - if (!(flags & CLF_ISO8601CENTURY) && (flags & CLF_CENTURY)) { - /* normally precedence of ISO is higher, but no century - so put it down */ - flags &= ~CLF_ISO8601; - } - else - /* yymmdd or yyddd over naked weekday */ - if (!(flags & CLF_ISO8601YEAR)) { - flags &= ~CLF_ISO8601; - } - } - - if (!(flags & CLF_ISO8601)) { - if (yyYear < 100) { - if (!(flags & CLF_CENTURY)) { - if (yyYear >= dataPtr->yearOfCenturySwitch) { - yyYear -= 100; - } - yyYear += dataPtr->currentYearCentury; - } else { - yyYear += info->dateCentury * 100; - } - } - } else { - if (info->date.iso8601Year < 100) { - if (!(flags & CLF_ISO8601CENTURY)) { - if (info->date.iso8601Year >= dataPtr->yearOfCenturySwitch) { - info->date.iso8601Year -= 100; - } - info->date.iso8601Year += dataPtr->currentYearCentury; - } else { - info->date.iso8601Year += info->dateCentury * 100; - } - } - } - } - } - - /* if no time - reset time */ - if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { - info->flags |= CLF_ASSEMBLE_SECONDS; - yydate.localSeconds = 0; - } - - if (flags & CLF_TIME) { - info->flags |= CLF_ASSEMBLE_SECONDS; - yySeconds = ToSeconds(yyHour, yyMinutes, - yySeconds, yyMeridian); - } else - if (!(flags & CLF_LOCALSEC)) { - info->flags |= CLF_ASSEMBLE_SECONDS; - yySeconds = yydate.localSeconds % SECONDS_PER_DAY; - } - } - - /* tell caller which flags were set */ - info->flags |= flags; - - ret = TCL_OK; - goto done; - -overflow: - - Tcl_SetResult(interp, "requested date too large to represent", - TCL_STATIC); - Tcl_SetErrorCode(interp, "CLOCK", "dateTooLarge", NULL); - goto done; - -not_match: - - Tcl_SetResult(interp, "input string does not match supplied format", - TCL_STATIC); - Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); - -done: - - return ret; -#endif } diff --git a/generic/tclDate.h b/generic/tclDate.h index 112ed31..2728dd3 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -126,24 +126,6 @@ typedef enum ClockMsgCtLiteral { } /* - * Primitives to safe set, reset and free references. - */ - -#define Tcl_UnsetObjRef(obj) \ - if (obj != NULL) { Tcl_DecrRefCount(obj); obj = NULL; } -#define Tcl_InitObjRef(obj, val) \ - obj = val; if (obj) { Tcl_IncrRefCount(obj); } -#define Tcl_SetObjRef(obj, val) \ -if (1) { \ - Tcl_Obj *nval = val; \ - if (obj != nval) { \ - Tcl_Obj *prev = obj; \ - Tcl_InitObjRef(obj, nval); \ - if (prev != NULL) { Tcl_DecrRefCount(prev); }; \ - } \ -} - -/* * Structure containing the fields used in [clock format] and [clock scan] */ @@ -450,7 +432,9 @@ MODULE_SCOPE Tcl_Obj * MODULE_SCOPE Tcl_Obj * ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); MODULE_SCOPE Tcl_Obj * - ClockMCGetListIdxDict(ClockFmtScnCmdArgs *opts, int mcKey); + ClockMCGetIdx(ClockFmtScnCmdArgs *opts, int mcKey); +MODULE_SCOPE int ClockMCSetIdx(ClockFmtScnCmdArgs *opts, int mcKey, + Tcl_Obj *valObj); /* tclClockFmt.c module declarations */ diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c new file mode 100644 index 0000000..f078c7a --- /dev/null +++ b/generic/tclStrIdxTree.c @@ -0,0 +1,519 @@ +/* + * tclStrIdxTree.c -- + * + * Contains the routines for managing string index tries in Tcl. + * + * This code is back-ported from the tclSE engine, by Serg G. Brester. + * + * Copyright (c) 2016 by Sergey G. Brester aka sebres. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * ----------------------------------------------------------------------- + * + * String index tries are prepaired structures used for fast greedy search of the string + * (index) by unique string prefix as key. + * + * Index tree build for two lists together can be explained in the following datagram + * + * Lists: + * + * {Januar Februar Maerz April Mai Juni Juli August September Oktober November Dezember} + * {Jnr Fbr Mrz Apr Mai Jni Jli Agt Spt Okt Nvb Dzb} + * + * Index-Tree: + * + * j -1 * ... + * anuar 0 * + * u -1 * a -1 + * ni 5 * pril 3 + * li 6 * ugust 7 + * n -1 * gt 7 + * r 0 * s 8 + * i 5 * eptember 8 + * li 6 * pt 8 + * f 1 * oktober 9 + * ebruar 1 * n 10 + * br 1 * ovember 10 + * m -1 * vb 10 + * a -1 * d 11 + * erz 2 * ezember 11 + * i 4 * zb 11 + * rz 2 * + * ... + * + * Thereby value -1 shows pure group items (corresponding ambigous matches). + * + * StrIdxTree's are very fast, so: + * build of above-mentioned tree takes about 10 microseconds. + * search of string index in this tree takes fewer as 0.1 microseconds. + * + */ + +#include "tclInt.h" +#include "tclStrIdxTree.h" + + +/* + *---------------------------------------------------------------------- + * + * TclStrIdxTreeSearch -- + * + * Find largest part of string "start" in indexed tree (case sensitive). + * + * Also used for building of string index tree. + * + * Results: + * Return position of UTF character in start after last equal character + * and found item (with parent). + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE const char* +TclStrIdxTreeSearch( + TclStrIdxTree **foundParent, /* Return value of found sub tree (used for tree build) */ + TclStrIdx **foundItem, /* Return value of found item */ + TclStrIdxTree *tree, /* Index tree will be browsed */ + const char *start, /* UTF string to find in tree */ + const char *end) /* End of string */ +{ + TclStrIdxTree *parent = tree, *prevParent = tree; + TclStrIdx *item = tree->firstPtr, *prevItem = NULL; + const char *s = start, *e, *cin, *preve; + int offs = 0; + + if (item == NULL) { + goto done; + } + + /* search in tree */ + do { + cin = TclGetString(item->key) + offs; + e = TclUtfFindEqual(s, end, cin, cin + item->length); + /* if something was found */ + if (e > s) { + /* if whole string was found */ + if (e >= end) { + start = e; + goto done; + }; + /* set new offset and shift start string */ + offs += (e - s); + s = e; + /* if match item, go deeper as long as possible */ + if (offs >= item->length && item->childTree.firstPtr) { + /* save previuosly found item (if not ambigous) for + * possible fallback (few greedy match) */ + if (item->value != -1) { + preve = e; + prevItem = item; + prevParent = parent; + } + parent = &item->childTree; + item = item->childTree.firstPtr; + continue; + } + /* no children - return this item and current chars found */ + start = e; + goto done; + } + + item = item->nextPtr; + + } while (item != NULL); + + /* fallback (few greedy match) not ambigous (has a value) */ + if (prevItem != NULL) { + item = prevItem; + parent = prevParent; + start = preve; + } + +done: + + if (foundParent) + *foundParent = parent; + if (foundItem) + *foundItem = item; + return start; +} + +MODULE_SCOPE void +TclStrIdxTreeFree( + TclStrIdx *tree) +{ + while (tree != NULL) { + TclStrIdx *t; + Tcl_DecrRefCount(tree->key); + if (tree->childTree.firstPtr != NULL) { + TclStrIdxTreeFree(tree->childTree.firstPtr); + } + t = tree, tree = tree->nextPtr; + ckfree(t); + } +} + +/* + * Several bidirectional list primitives + */ +inline void +TclStrIdxTreeInsertBranch( + TclStrIdxTree *parent, + register TclStrIdx *item, + register TclStrIdx *child) +{ + if (parent->firstPtr == child) + parent->firstPtr = item; + if (parent->lastPtr == child) + parent->lastPtr = item; + if (item->nextPtr = child->nextPtr) { + item->nextPtr->prevPtr = item; + child->nextPtr = NULL; + } + if (item->prevPtr = child->prevPtr) { + item->prevPtr->nextPtr = item; + child->prevPtr = NULL; + } + item->childTree.firstPtr = child; + item->childTree.lastPtr = child; +} + +inline void +TclStrIdxTreeAppend( + register TclStrIdxTree *parent, + register TclStrIdx *item) +{ + if (parent->lastPtr != NULL) { + parent->lastPtr->nextPtr = item; + } + item->prevPtr = parent->lastPtr; + item->nextPtr = NULL; + parent->lastPtr = item; + if (parent->firstPtr == NULL) { + parent->firstPtr = item; + } +} + + +/* + *---------------------------------------------------------------------- + * + * TclStrIdxTreeBuildFromList -- + * + * Build or extend string indexed tree from tcl list. + * + * Important: by multiple lists, optimal tree can be created only if list with + * larger strings used firstly. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE int +TclStrIdxTreeBuildFromList( + TclStrIdxTree *idxTree, + int lstc, + Tcl_Obj **lstv) +{ + Tcl_Obj **lwrv; + int i, ret = TCL_ERROR; + const char *s, *e, *f; + TclStrIdx *item; + + /* create lowercase reflection of the list keys */ + + lwrv = ckalloc(sizeof(Tcl_Obj*) * lstc); + if (lwrv == NULL) { + return TCL_ERROR; + } + for (i = 0; i < lstc; i++) { + lwrv[i] = Tcl_DuplicateObj(lstv[i]); + if (lwrv[i] == NULL) { + return TCL_ERROR; + } + Tcl_IncrRefCount(lwrv[i]); + lwrv[i]->length = Tcl_UtfToLower(TclGetString(lwrv[i])); + } + + /* build index tree of the list keys */ + for (i = 0; i < lstc; i++) { + TclStrIdxTree *foundParent = idxTree; + e = s = TclGetString(lwrv[i]); + e += lwrv[i]->length; + + /* ignore empty values (impossible to index it) */ + if (lwrv[i]->length == 0) continue; + + item = NULL; + if (idxTree->firstPtr != NULL) { + TclStrIdx *foundItem; + f = TclStrIdxTreeSearch(&foundParent, &foundItem, + idxTree, s, e); + /* if common prefix was found */ + if (f > s) { + /* ignore element if fulfilled or ambigous */ + if (f == e) { + continue; + } + /* if shortest key was found with the same value, + * just replace its current key with longest key */ + if ( foundItem->value == i + && foundItem->length < lwrv[i]->length + && foundItem->childTree.firstPtr == NULL + ) { + Tcl_SetObjRef(foundItem->key, lwrv[i]); + foundItem->length = lwrv[i]->length; + continue; + } + /* split tree (e. g. j->(jan,jun) + jul == j->(jan,ju->(jun,jul)) ) + * but don't split by fulfilled child of found item ( ii->iii->iiii ) */ + if (foundItem->length != (f - s)) { + /* first split found item (insert one between parent and found + new one) */ + item = ckalloc(sizeof(*item)); + if (item == NULL) { + goto done; + } + Tcl_InitObjRef(item->key, foundItem->key); + item->length = f - s; + /* set value or mark as ambigous if not the same value of both */ + item->value = (foundItem->value == i) ? i : -1; + /* insert group item between foundParent and foundItem */ + TclStrIdxTreeInsertBranch(foundParent, item, foundItem); + foundParent = &item->childTree; + } else { + /* the new item should be added as child of found item */ + foundParent = &foundItem->childTree; + } + } + } + /* append item at end of found parent */ + item = ckalloc(sizeof(*item)); + if (item == NULL) { + goto done; + } + item->childTree.lastPtr = item->childTree.firstPtr = NULL; + Tcl_InitObjRef(item->key, lwrv[i]); + item->length = lwrv[i]->length; + item->value = i; + TclStrIdxTreeAppend(foundParent, item); + }; + + ret = TCL_OK; + +done: + + if (lwrv != NULL) { + for (i = 0; i < lstc; i++) { + Tcl_DecrRefCount(lwrv[i]); + } + ckfree(lwrv); + } + + if (ret != TCL_OK) { + if (idxTree->firstPtr != NULL) { + TclStrIdxTreeFree(idxTree->firstPtr); + } + } + + return ret; +} + + +static void +StrIdxTreeObj_DupIntRepProc(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); +static void +StrIdxTreeObj_FreeIntRepProc(Tcl_Obj *objPtr); +static void +StrIdxTreeObj_UpdateStringProc(Tcl_Obj *objPtr); + +Tcl_ObjType StrIdxTreeObjType = { + "str-idx-tree", /* name */ + StrIdxTreeObj_FreeIntRepProc, /* freeIntRepProc */ + StrIdxTreeObj_DupIntRepProc, /* dupIntRepProc */ + StrIdxTreeObj_UpdateStringProc, /* updateStringProc */ + NULL /* setFromAnyProc */ +}; + +MODULE_SCOPE Tcl_Obj* +TclStrIdxTreeNewObj() +{ + Tcl_Obj *objPtr = Tcl_NewObj(); + objPtr->internalRep.twoPtrValue.ptr1 = NULL; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; + objPtr->typePtr = &StrIdxTreeObjType; + /* return tree root in internal representation */ + return objPtr; +} + +static void +StrIdxTreeObj_DupIntRepProc(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) +{ + /* follow links (smart pointers) */ + if ( srcPtr->internalRep.twoPtrValue.ptr1 != NULL + && srcPtr->internalRep.twoPtrValue.ptr2 == NULL + ) { + srcPtr = (Tcl_Obj*)srcPtr->internalRep.twoPtrValue.ptr1; + } + /* create smart pointer to it (ptr1 != NULL, ptr2 = NULL) */ + Tcl_InitObjRef(((Tcl_Obj *)copyPtr->internalRep.twoPtrValue.ptr1), + srcPtr); + copyPtr->internalRep.twoPtrValue.ptr2 = NULL; + copyPtr->typePtr = &StrIdxTreeObjType; +} + +static void +StrIdxTreeObj_FreeIntRepProc(Tcl_Obj *objPtr) +{ + /* follow links (smart pointers) */ + if ( objPtr->internalRep.twoPtrValue.ptr1 != NULL + && objPtr->internalRep.twoPtrValue.ptr2 == NULL + ) { + /* is a link */ + Tcl_UnsetObjRef(((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr1)); + } else { + /* is a tree */ + TclStrIdxTree *tree = (TclStrIdxTree*)&objPtr->internalRep.twoPtrValue.ptr1; + if (tree->firstPtr != NULL) { + TclStrIdxTreeFree(tree->firstPtr); + } + objPtr->internalRep.twoPtrValue.ptr1 = NULL; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; + } + objPtr->typePtr = NULL; +}; + +static void +StrIdxTreeObj_UpdateStringProc(Tcl_Obj *objPtr) +{ + /* currently only dummy empty string possible */ + objPtr->length = 0; + objPtr->bytes = tclEmptyStringRep; +}; + +MODULE_SCOPE TclStrIdxTree * +TclStrIdxTreeGetFromObj(Tcl_Obj *objPtr) { + /* follow links (smart pointers) */ + if (objPtr->typePtr != &StrIdxTreeObjType) { + return NULL; + } + if ( objPtr->internalRep.twoPtrValue.ptr1 != NULL + && objPtr->internalRep.twoPtrValue.ptr2 == NULL + ) { + objPtr = (Tcl_Obj*)objPtr->internalRep.twoPtrValue.ptr1; + } + /* return tree root in internal representation */ + return (TclStrIdxTree*)&objPtr->internalRep.twoPtrValue.ptr1; +} + +/* + * Several debug primitives + */ +#if 1 + +void +TclStrIdxTreePrint( + Tcl_Interp *interp, + TclStrIdx *tree, + int offs) +{ + Tcl_Obj *obj[2]; + const char *s; + Tcl_InitObjRef(obj[0], Tcl_NewStringObj("::puts", -1)); + while (tree != NULL) { + s = TclGetString(tree->key) + offs; + Tcl_InitObjRef(obj[1], Tcl_ObjPrintf("%*s%.*s\t:%d", + offs, "", tree->length - offs, s, tree->value)); + Tcl_PutsObjCmd(NULL, interp, 2, obj); + Tcl_UnsetObjRef(obj[1]); + if (tree->childTree.firstPtr != NULL) { + TclStrIdxTreePrint(interp, tree->childTree.firstPtr, tree->length); + } + tree = tree->nextPtr; + } + Tcl_UnsetObjRef(obj[0]); +} + + +MODULE_SCOPE int +TclStrIdxTreeTestObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + const char *cs, *cin, *ret; + + static const char *const options[] = { + "index", "puts-index", "findequal", + NULL + }; + enum optionInd { + O_INDEX, O_PUTS_INDEX, O_FINDEQUAL + }; + int optionIndex; + + if (objc < 2) { + Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + return TCL_ERROR; + } + if (Tcl_GetIndexFromObj(interp, objv[1], options, + "option", 0, &optionIndex) != TCL_OK) { + Tcl_SetErrorCode(interp, "CLOCK", "badOption", + Tcl_GetString(objv[1]), NULL); + return TCL_ERROR; + } + switch (optionIndex) { + case O_FINDEQUAL: + if (objc < 4) { + Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + return TCL_ERROR; + } + cs = TclGetString(objv[2]); + cin = TclGetString(objv[3]); + ret = TclUtfFindEqual( + cs, cs + objv[1]->length, cin, cin + objv[2]->length); + Tcl_SetObjResult(interp, Tcl_NewIntObj(ret - cs)); + break; + case O_INDEX: + case O_PUTS_INDEX: + + if (1) { + Tcl_Obj **lstv; + int i, lstc; + TclStrIdxTree idxTree = {NULL, NULL}; + i = 1; + while (++i < objc) { + if (TclListObjGetElements(interp, objv[i], + &lstc, &lstv) != TCL_OK) { + return TCL_ERROR; + }; + TclStrIdxTreeBuildFromList(&idxTree, lstc, lstv); + } + if (optionIndex == O_PUTS_INDEX) { + TclStrIdxTreePrint(interp, idxTree.firstPtr, 0); + } + TclStrIdxTreeFree(idxTree.firstPtr); + } + break; + } + + return TCL_OK; +} + +#endif + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h new file mode 100644 index 0000000..e80d3db --- /dev/null +++ b/generic/tclStrIdxTree.h @@ -0,0 +1,134 @@ +/* + * tclStrIdxTree.h -- + * + * Declarations of string index tries and other primitives currently + * back-ported from tclSE. + * + * Copyright (c) 2016 Serg G. Brester (aka sebres) + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCLSTRIDXTREE_H +#define _TCLSTRIDXTREE_H + + +/* + * Main structures declarations of index tree and entry + */ + +typedef struct TclStrIdxTree { + struct TclStrIdx *firstPtr; + struct TclStrIdx *lastPtr; +} TclStrIdxTree; + +typedef struct TclStrIdx { + struct TclStrIdxTree childTree; + struct TclStrIdx *nextPtr; + struct TclStrIdx *prevPtr; + Tcl_Obj *key; + int length; + int value; +} TclStrIdx; + + +/* + *---------------------------------------------------------------------- + * + * TclUtfFindEqual, TclUtfFindEqualNC -- + * + * Find largest part of string cs in string cin (case sensitive and not). + * + * Results: + * Return position of UTF character in cs after last equal character. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +inline const char * +TclUtfFindEqual( + register const char *cs, /* UTF string to find in cin. */ + register const char *cse, /* End of cs */ + register const char *cin, /* UTF string will be browsed. */ + register const char *cine) /* End of cin */ +{ + register const char *ret = cs; + Tcl_UniChar ch1, ch2; + do { + cs += TclUtfToUniChar(cs, &ch1); + cin += TclUtfToUniChar(cin, &ch2); + if (ch1 != ch2) break; + } while ((ret = cs) < cse && cin < cine); + return ret; +} + +inline const char * +TclUtfFindEqualNC( + register const char *cs, /* UTF string to find in cin. */ + register const char *cse, /* End of cs */ + register const char *cin, /* UTF string will be browsed. */ + register const char *cine, /* End of cin */ + const char **cinfnd) /* Return position in cin */ +{ + register const char *ret = cs; + Tcl_UniChar ch1, ch2; + do { + cs += TclUtfToUniChar(cs, &ch1); + cin += TclUtfToUniChar(cin, &ch2); + if (ch1 != ch2) { + ch1 = Tcl_UniCharToLower(ch1); + ch2 = Tcl_UniCharToLower(ch2); + if (ch1 != ch2) break; + } + *cinfnd = cin; + } while ((ret = cs) < cse && cin < cine); + return ret; +} + +/* + * Primitives to safe set, reset and free references. + */ + +#define Tcl_UnsetObjRef(obj) \ + if (obj != NULL) { Tcl_DecrRefCount(obj); obj = NULL; } +#define Tcl_InitObjRef(obj, val) \ + obj = val; if (obj) { Tcl_IncrRefCount(obj); } +#define Tcl_SetObjRef(obj, val) \ +if (1) { \ + Tcl_Obj *nval = val; \ + if (obj != nval) { \ + Tcl_Obj *prev = obj; \ + Tcl_InitObjRef(obj, nval); \ + if (prev != NULL) { Tcl_DecrRefCount(prev); }; \ + } \ +} + +/* + * Prototypes of module functions. + */ + +MODULE_SCOPE const char* + TclStrIdxTreeSearch(TclStrIdxTree **foundParent, + TclStrIdx **foundItem, TclStrIdxTree *tree, + const char *start, const char *end); + +MODULE_SCOPE int TclStrIdxTreeBuildFromList(TclStrIdxTree *idxTree, + int lstc, Tcl_Obj **lstv); + +MODULE_SCOPE Tcl_Obj* + TclStrIdxTreeNewObj(); + +MODULE_SCOPE TclStrIdxTree* + TclStrIdxTreeGetFromObj(Tcl_Obj *objPtr); + +#if 1 + +MODULE_SCOPE int TclStrIdxTreeTestObjCmd(ClientData, Tcl_Interp *, + int, Tcl_Obj *const objv[]); +#endif + +#endif /* _TCLSTRIDXTREE_H */ diff --git a/unix/Makefile.in b/unix/Makefile.in index b220139..19ab6ec 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -451,6 +451,7 @@ GENERIC_SRCS = \ $(GENERIC_DIR)/tclScan.c \ $(GENERIC_DIR)/tclStubInit.c \ $(GENERIC_DIR)/tclStringObj.c \ + $(GENERIC_DIR)/tclStrIdxTree.c \ $(GENERIC_DIR)/tclStrToD.c \ $(GENERIC_DIR)/tclTest.c \ $(GENERIC_DIR)/tclTestObj.c \ @@ -1305,6 +1306,9 @@ tclScan.o: $(GENERIC_DIR)/tclScan.c tclStringObj.o: $(GENERIC_DIR)/tclStringObj.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclStringObj.c +tclStrIdxTree.o: $(GENERIC_DIR)/tclStrIdxTree.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclStrIdxTree.c + tclStrToD.o: $(GENERIC_DIR)/tclStrToD.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclStrToD.c diff --git a/win/Makefile.in b/win/Makefile.in index 82e5516..478bbb9 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -291,6 +291,7 @@ GENERIC_OBJS = \ tclResult.$(OBJEXT) \ tclScan.$(OBJEXT) \ tclStringObj.$(OBJEXT) \ + tclStrIdxTree.$(OBJEXT) \ tclStrToD.$(OBJEXT) \ tclStubInit.$(OBJEXT) \ tclThread.$(OBJEXT) \ diff --git a/win/makefile.vc b/win/makefile.vc index d6dbf85..48bacbc 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -333,6 +333,7 @@ COREOBJS = \ $(TMP_DIR)\tclResult.obj \ $(TMP_DIR)\tclScan.obj \ $(TMP_DIR)\tclStringObj.obj \ + $(TMP_DIR)\tclStrIdxTree.obj \ $(TMP_DIR)\tclStrToD.obj \ $(TMP_DIR)\tclStubInit.obj \ $(TMP_DIR)\tclThread.obj \ -- cgit v0.12 From 20ec6252d16fc908dbef8703ac59d9247c043445 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:38:22 +0000 Subject: lowercase on demand, string index tree can search any-case now, clock scan considered utf-8 char length in words by format parsing --- generic/tclClockFmt.c | 17 +++++++---------- generic/tclStrIdxTree.c | 20 ++++++++++---------- generic/tclStrIdxTree.h | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 20 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index e66c525..92040d8 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1245,7 +1245,7 @@ ClockGetOrParseScanFormat( fss->scnTok = tok = ckalloc(sizeof(*tok) * fss->scnTokC); memset(tok, 0, sizeof(*(tok))); - for (p = strFmt; p != e; p++) { + for (p = strFmt; p < e;) { switch (*p) { case '%': if (1) { @@ -1265,6 +1265,7 @@ ClockGetOrParseScanFormat( tok->tokWord.start = p; tok->tokWord.end = p+1; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + p++; continue; break; case 'E': @@ -1315,6 +1316,8 @@ ClockGetOrParseScanFormat( } /* next token */ AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + p++; + continue; } break; case ' ': @@ -1325,6 +1328,8 @@ ClockGetOrParseScanFormat( } tok->map = &ScnSpecTokenMap[cp - ScnSpecTokenMapIndex]; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + p++; + continue; break; default: word_tok: @@ -1339,12 +1344,11 @@ word_tok: wordTok->map = &ScnWordTokenMap; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); } - continue; } break; } - continue; + p = TclUtfNext(p); } /* calculate end distance value for each tokens */ @@ -1468,11 +1472,6 @@ ClockScan( yyMeridian = MER24; - /* lower case given string into new object */ - strObj = Tcl_NewStringObj(TclGetString(strObj), strObj->length); - Tcl_IncrRefCount(strObj); - strObj->length = Tcl_UtfToLower(TclGetString(strObj)); - p = TclGetString(strObj); end = p + strObj->length; /* in strict mode - bypass spaces at begin / end only (not between tokens) */ @@ -1726,8 +1725,6 @@ not_match: done: - Tcl_DecrRefCount(strObj); - return ret; } diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index f078c7a..afb53e5 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -84,7 +84,7 @@ TclStrIdxTreeSearch( { TclStrIdxTree *parent = tree, *prevParent = tree; TclStrIdx *item = tree->firstPtr, *prevItem = NULL; - const char *s = start, *e, *cin, *preve; + const char *s = start, *f, *cin, *cinf, *prevf; int offs = 0; if (item == NULL) { @@ -94,23 +94,23 @@ TclStrIdxTreeSearch( /* search in tree */ do { cin = TclGetString(item->key) + offs; - e = TclUtfFindEqual(s, end, cin, cin + item->length); + f = TclUtfFindEqualNCInLwr(s, end, cin, cin + item->length, &cinf); /* if something was found */ - if (e > s) { + if (f > s) { /* if whole string was found */ - if (e >= end) { - start = e; + if (f >= end) { + start = f; goto done; }; /* set new offset and shift start string */ - offs += (e - s); - s = e; + offs += cinf - cin; + s = f; /* if match item, go deeper as long as possible */ if (offs >= item->length && item->childTree.firstPtr) { /* save previuosly found item (if not ambigous) for * possible fallback (few greedy match) */ if (item->value != -1) { - preve = e; + prevf = f; prevItem = item; prevParent = parent; } @@ -119,7 +119,7 @@ TclStrIdxTreeSearch( continue; } /* no children - return this item and current chars found */ - start = e; + start = f; goto done; } @@ -131,7 +131,7 @@ TclStrIdxTreeSearch( if (prevItem != NULL) { item = prevItem; parent = prevParent; - start = preve; + start = prevf; } done: diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h index e80d3db..d2d6f0b 100644 --- a/generic/tclStrIdxTree.h +++ b/generic/tclStrIdxTree.h @@ -89,6 +89,41 @@ TclUtfFindEqualNC( return ret; } +inline const char * +TclUtfFindEqualNCInLwr( + register const char *cs, /* UTF string (in anycase) to find in cin. */ + register const char *cse, /* End of cs */ + register const char *cin, /* UTF string (in lowercase) will be browsed. */ + register const char *cine, /* End of cin */ + const char **cinfnd) /* Return position in cin */ +{ + register const char *ret = cs; + Tcl_UniChar ch1, ch2; + do { + cs += TclUtfToUniChar(cs, &ch1); + cin += TclUtfToUniChar(cin, &ch2); + if (ch1 != ch2) { + ch1 = Tcl_UniCharToLower(ch1); + if (ch1 != ch2) break; + } + *cinfnd = cin; + } while ((ret = cs) < cse && cin < cine); + return ret; +} + +inline char * +TclUtfNext( + register const char *src) /* The current location in the string. */ +{ + if (((unsigned char) *(src)) < 0xC0) { + return ++src; + } else { + Tcl_UniChar ch; + return src + TclUtfToUniChar(src, &ch); + } +} + + /* * Primitives to safe set, reset and free references. */ -- cgit v0.12 From 95b63f4c39cdae6600e1b364f58d663c870b1012 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:38:56 +0000 Subject: locale months scan switched to from list seek to index tree; bug fixing --- generic/tclClockFmt.c | 23 +++++++++++++---------- generic/tclDate.h | 4 ++-- generic/tclStrIdxTree.h | 2 +- tests/clock.test | 24 ++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 92040d8..478941b 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -682,6 +682,7 @@ ClockMCGetMultiListIdxTree( } ClockMCSetIdx(opts, mcKey, objPtr); + objPtr = NULL; }; done: @@ -788,22 +789,24 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; */ + static int monthsKeys[] = {MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, 0}; + int ret, val; int minLen, maxLen; + TclStrIdxTree *idxTree; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); - ret = LocaleListSearch(opts, info, MCLIT_MONTHS_FULL, &val, - minLen, maxLen); + /* get or create tree in msgcat dict */ + + idxTree = ClockMCGetMultiListIdxTree(opts, MCLIT_MONTHS_COMB, monthsKeys); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); if (ret != TCL_OK) { - /* if not found */ - if (ret == TCL_RETURN) { - ret = LocaleListSearch(opts, info, MCLIT_MONTHS_ABBREV, &val, - minLen, maxLen); - } - if (ret != TCL_OK) { - return ret; - } + return ret; } yyMonth = val + 1; diff --git a/generic/tclDate.h b/generic/tclDate.h index 2728dd3..85bcd35 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -104,7 +104,7 @@ typedef enum ClockLiteral { typedef enum ClockMsgCtLiteral { MCLIT__NIL, /* placeholder */ - MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, + MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, MCLIT_MONTHS_COMB, MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_AM, MCLIT_PM, MCLIT_BCE, MCLIT_CE, @@ -116,7 +116,7 @@ typedef enum ClockMsgCtLiteral { #define CLOCK_LOCALE_LITERAL_ARRAY(litarr, pref) static const char *const litarr[] = { \ pref "", \ - pref "MONTHS_FULL", pref "MONTHS_ABBREV", \ + pref "MONTHS_FULL", pref "MONTHS_ABBREV", pref "MONTHS_COMB", \ pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", \ pref "AM", pref "PM", \ pref "BCE", pref "CE", \ diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h index d2d6f0b..934e28f 100644 --- a/generic/tclStrIdxTree.h +++ b/generic/tclStrIdxTree.h @@ -111,7 +111,7 @@ TclUtfFindEqualNCInLwr( return ret; } -inline char * +inline const char * TclUtfNext( register const char *src) /* The current location in the string. */ { diff --git a/tests/clock.test b/tests/clock.test index e96dec6..1d02f39 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18564,6 +18564,30 @@ test clock-6.11 {input of seconds - two values} { clock scan {1 2} -format {%s %s} -gmt true } 2 +test clock-6.12 {input of unambiguous short locale token (%b)} { + list [clock scan "12 Ja 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1] \ + [clock scan "12 Au 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1] +} {979257600 997574400} +test clock-6.13 {input of lowercase locale token (%b)} { + list [clock scan "12 ja 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1] \ + [clock scan "12 au 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1] +} {979257600 997574400} +test clock-6.14 {input of uppercase locale token (%b)} { + list [clock scan "12 JA 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1] \ + [clock scan "12 AU 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1] +} {979257600 997574400} +test clock-6.15 {input of ambiguous short locale token (%b)} { + list [catch { + clock scan "12 J 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1 + } result] $result $errorCode +} {1 {input string does not match supplied format} {CLOCK badInputString}} +test clock-6.16 {input of ambiguous short locale token (%b)} { + list [catch { + clock scan "12 Ju 2001" -format "%d %b %Y" -locale en_US_roman -gmt 1 + } result] $result $errorCode +} {1 {input string does not match supplied format} {CLOCK badInputString}} + + test clock-7.1 {Julian Day} { clock scan 0 -format %J -gmt true } -210866803200 -- cgit v0.12 From 0f7c885e8c08fc7013f73284498823585b59b2b3 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:39:45 +0000 Subject: other locale scan token switched from list seek to index tree + list search case insensitive now --- generic/tclClockFmt.c | 44 +++++++++++++++++++++++++++----------------- generic/tclDate.h | 8 ++++---- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 478941b..999f191 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -530,20 +530,26 @@ ObjListSearch(ClockFmtScnCmdArgs *opts, int minLen, int maxLen) { int i, l, lf = -1; - const char *s; + const char *s, *f, *sf; /* search in list */ for (i = 0; i < lstc; i++) { s = TclGetString(lstv[i]); l = lstv[i]->length; - if ( l >= minLen && l <= maxLen - && strncasecmp(yyInput, s, l) == 0 + + if ( l >= minLen + && (f = TclUtfFindEqualNC(yyInput, yyInput + maxLen, s, s + l, &sf)) > yyInput ) { + l = f - yyInput; + if (l < minLen) { + continue; + } /* found, try to find longest value (greedy search) */ if (l < maxLen && minLen != maxLen) { lf = i; minLen = l + 1; continue; } + /* max possible - end of search */ *val = i; yyInput += l; break; @@ -818,9 +824,12 @@ static int ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { + static int dowKeys[] = {MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_DAYS_OF_WEEK_FULL, 0}; + int ret, val; int minLen, maxLen; char curTok = *tok->tokWord.start; + TclStrIdxTree *idxTree; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); @@ -836,9 +845,13 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, val = *yyInput - '0'; } } else { - int ret = LocaleListSearch(opts, info, (int)tok->map->data, &val, - minLen, maxLen); - if (ret == TCL_ERROR) { + idxTree = ClockMCGetListIdxTree(opts, (int)tok->map->data /* mcKey */); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); + if (ret != TCL_OK) { return ret; } } @@ -847,7 +860,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, if (val == 0) { val = 7; } - if (val > 7 && curTok != 'a' && curTok != 'A') { + if (val > 7) { Tcl_SetResult(opts->interp, "day of week is greater than 7", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "badDayOfWeek", NULL); @@ -863,17 +876,14 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, } /* %a %A */ - ret = LocaleListSearch(opts, info, MCLIT_DAYS_OF_WEEK_FULL, &val, - minLen, maxLen); + idxTree = ClockMCGetMultiListIdxTree(opts, MCLIT_DAYS_OF_WEEK_COMB, dowKeys); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); if (ret != TCL_OK) { - /* if not found */ - if (ret == TCL_RETURN) { - ret = LocaleListSearch(opts, info, MCLIT_DAYS_OF_WEEK_ABBREV, &val, - minLen, maxLen); - } - if (ret != TCL_OK) { - return ret; - } + return ret; } if (val == 0) { diff --git a/generic/tclDate.h b/generic/tclDate.h index 85bcd35..fe38436 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -105,8 +105,8 @@ typedef enum ClockLiteral { typedef enum ClockMsgCtLiteral { MCLIT__NIL, /* placeholder */ MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, MCLIT_MONTHS_COMB, - MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, - MCLIT_AM, MCLIT_PM, + MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_DAYS_OF_WEEK_COMB, + MCLIT_AM, MCLIT_PM, MCLIT_BCE, MCLIT_CE, MCLIT_BCE2, MCLIT_CE2, MCLIT_BCE3, MCLIT_CE3, @@ -117,8 +117,8 @@ typedef enum ClockMsgCtLiteral { #define CLOCK_LOCALE_LITERAL_ARRAY(litarr, pref) static const char *const litarr[] = { \ pref "", \ pref "MONTHS_FULL", pref "MONTHS_ABBREV", pref "MONTHS_COMB", \ - pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", \ - pref "AM", pref "PM", \ + pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", pref "DAYS_OF_WEEK_COMB", \ + pref "AM", pref "PM", \ pref "BCE", pref "CE", \ pref "b.c.e.", pref "c.e.", \ pref "b.c.", pref "a.d.", \ -- cgit v0.12 From 9d7b1b2b0319162c58225a5f443a040be63628f8 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:40:16 +0000 Subject: min length of %Y token (year with century) is 4, optional tokens possibility (zone), test cases extended --- generic/tclClockFmt.c | 40 ++++++++++++++++++++++++++++++---------- generic/tclDate.h | 1 + tests-perf/clock.perf.tcl | 7 +++++++ tests/clock.test | 12 ++++++++++++ 4 files changed, 50 insertions(+), 10 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 999f191..9211481 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1089,7 +1089,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_YEAR, 0, 1, 2, TclOffset(DateInfo, date.year), NULL}, /* %Y */ - {CTOKT_DIGIT, CLF_YEAR | CLF_CENTURY, 0, 1, 4, TclOffset(DateInfo, date.year), + {CTOKT_DIGIT, CLF_YEAR | CLF_CENTURY, 0, 4, 4, TclOffset(DateInfo, date.year), NULL}, /* %H %k %I %l */ {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.hour), @@ -1116,7 +1116,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601, 0, 2, 2, TclOffset(DateInfo, date.iso8601Year), NULL}, /* %G */ - {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601 | CLF_ISO8601CENTURY, 0, 1, 4, TclOffset(DateInfo, date.iso8601Year), + {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601 | CLF_ISO8601CENTURY, 0, 4, 4, TclOffset(DateInfo, date.iso8601Year), NULL}, /* %V */ {CTOKT_DIGIT, CLF_ISO8601, 0, 1, 2, TclOffset(DateInfo, date.iso8601Week), @@ -1125,7 +1125,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, ClockScnToken_DayOfWeek_Proc, NULL}, /* %z %Z */ - {CTOKT_PARSER, 0, 0, 0, 0, 0, + {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0, 0, ClockScnToken_TimeZone_Proc, NULL}, /* %s */ {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), @@ -1508,6 +1508,10 @@ ClockScan( } } yyInput = p; + /* end of input string */ + if (p >= end) { + break; + } switch (map->type) { case CTOKT_DIGIT: @@ -1553,6 +1557,10 @@ ClockScan( size = p - yyInput; if (size < map->minSize) { /* missing input -> error */ + if ((map->flags & CLF_OPTIONAL)) { + yyInput = p; + continue; + } goto not_match; } /* string 2 number, put number into info structure by offset */ @@ -1578,6 +1586,10 @@ ClockScan( case TCL_OK: break; case TCL_RETURN: + if ((map->flags & CLF_OPTIONAL)) { + yyInput = p; + continue; + } goto not_match; break; default: @@ -1611,15 +1623,23 @@ ClockScan( break; } } - - /* ignore spaces at end */ - while (p < end && isspace(UCHAR(*p))) { - p++; - } /* check end was reached */ if (p < end) { - /* something after last token - wrong format */ - goto not_match; + /* ignore spaces at end */ + while (p < end && isspace(UCHAR(*p))) { + p++; + } + if (p < end) { + /* something after last token - wrong format */ + goto not_match; + } + } + /* end of string, check only optional tokens at end, otherwise - not match */ + if (tok->map != NULL) { + if ( !(opts->flags & CLF_STRICT) && (tok->map->type == CTOKT_SPACE) + || (tok->map->flags & CLF_OPTIONAL)) { + goto not_match; + } } /* diff --git a/generic/tclDate.h b/generic/tclDate.h index fe38436..64135d3 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -30,6 +30,7 @@ #define ONE_YEAR 365 /* days */ +#define CLF_OPTIONAL (1 << 0) /* token is non mandatory */ #define CLF_JULIANDAY (1 << 3) #define CLF_TIME (1 << 4) #define CLF_LOCALSEC (1 << 5) diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 3c69414..41cc9e1 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -150,6 +150,13 @@ proc test-scan {{reptime 1000}} { # Scan : century, lookup table month and day (list scan: entries with position 12 / 31) {clock scan {2016 Dec 31} -format {%C%y %b %Od} -locale en -gmt 1} + # Scan : ISO date-time (CEST) + {clock scan "2009-06-30T18:30:00+02:00" -format "%Y-%m-%dT%H:%M:%S%z"} + {clock scan "2009-06-30T18:30:00 CEST" -format "%Y-%m-%dT%H:%M:%S %z"} + # Scan : ISO date-time (UTC) + {clock scan "2009-06-30T18:30:00Z" -format "%Y-%m-%dT%H:%M:%S%z"} + {clock scan "2009-06-30T18:30:00 UTC" -format "%Y-%m-%dT%H:%M:%S %z"} + # Scan : dynamic format (cacheable) {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} diff --git a/tests/clock.test b/tests/clock.test index 1d02f39..a4641c6 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18587,6 +18587,18 @@ test clock-6.16 {input of ambiguous short locale token (%b)} { } result] $result $errorCode } {1 {input string does not match supplied format} {CLOCK badInputString}} +test clock-6.17 {spaces are always optional in non-strict mode (default)} { + list [clock scan "2009-06-30T18:30:00+02:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ + [clock scan "2009-06-30T18:30:00 +02:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ + [clock scan "2009-06-30T18:30:00Z" -format "%Y-%m-%dT%H:%M:%S %z" -timezone CET] \ + [clock scan "2009-06-30T18:30:00 Z" -format "%Y-%m-%dT%H:%M:%S %z" -timezone CET] +} {1246379400 1246379400 1246386600 1246386600} + +test clock-6.18 {zone token (%z) is optional} { + list [clock scan "2009-06-30T18:30:00 -01:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ + [clock scan "2009-06-30T18:30:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ + [clock scan " 2009-06-30T18:30:00 " -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ +} {1246390200 1246386600 1246386600} test clock-7.1 {Julian Day} { clock scan 0 -format %J -gmt true -- cgit v0.12 From 63c8495242fba7a73308cadbe99d5b9baa687aa6 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:41:18 +0000 Subject: [temp-commit]: format almost ready (missing some tokens) --- generic/tclClock.c | 28 +- generic/tclClockFmt.c | 711 +++++++++++++++++++++++++++++++++++++++++--------- generic/tclDate.h | 75 ++++-- library/clock.tcl | 2 +- library/init.tcl | 2 +- tests/clock.test | 5 + 6 files changed, 651 insertions(+), 172 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index e52b2e7..935a347 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -129,6 +129,9 @@ static int ClockParseformatargsObjCmd( static int ClockSecondsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int ClockFormatObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); static int ClockScanObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -164,6 +167,7 @@ static const struct ClockCommand clockCommands[] = { { "microseconds", ClockMicrosecondsObjCmd }, { "milliseconds", ClockMillisecondsObjCmd }, { "seconds", ClockSecondsObjCmd }, + { "format", ClockFormatObjCmd }, { "scan", ClockScanObjCmd }, { "configure", ClockConfigureObjCmd }, { "Oldscan", TclClockOldscanObjCmd }, @@ -2944,8 +2948,7 @@ ClockFormatObjCmd( int ret; ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ Tcl_WideInt clockVal; /* Time, expressed in seconds from the Epoch */ - DateInfo yy; /* Common structure used for parsing */ - DateInfo *info = &yy; + DateFormat dateFmt; /* Common structure used for formatting */ if ((objc & 1) == 1) { Tcl_WrongNumArgs(interp, 1, objv, "string " @@ -2972,9 +2975,7 @@ ClockFormatObjCmd( return TCL_ERROR; } - - ClockInitDateInfo(info); - yydate.tzName = NULL; + memset(&dateFmt, 0, sizeof(dateFmt)); /* * Extract year, month and day from the base time for the parser to use as @@ -2984,16 +2985,16 @@ ClockFormatObjCmd( /* check base fields already cached (by TZ, last-second cache) */ if ( dataPtr->lastBase.timezoneObj == opts.timezoneObj && dataPtr->lastBase.Date.seconds == clockVal) { - memcpy(&yydate, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); + memcpy(&dateFmt.date, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); } else { /* extact fields from base */ - yydate.seconds = clockVal; - if (ClockGetDateFields(clientData, interp, &yydate, opts.timezoneObj, + dateFmt.date.seconds = clockVal; + if (ClockGetDateFields(clientData, interp, &dateFmt.date, opts.timezoneObj, GREGORIAN_CHANGE_DATE) != TCL_OK) { goto done; } /* cache last base */ - memcpy(&dataPtr->lastBase.Date, &yydate, ClockCacheableDateFieldsSize); + memcpy(&dataPtr->lastBase.Date, &dateFmt.date, ClockCacheableDateFieldsSize); Tcl_SetObjRef(dataPtr->lastBase.timezoneObj, opts.timezoneObj); } @@ -3004,11 +3005,11 @@ ClockFormatObjCmd( /* Use compiled version of Format - */ - ret = ClockFormat(clientData, interp, info, &opts); + ret = ClockFormat(&dateFmt, &opts); done: - Tcl_UnsetObjRef(yydate.tzName); + Tcl_UnsetObjRef(dateFmt.date.tzName); if (ret != TCL_OK) { return ret; @@ -3072,8 +3073,7 @@ ClockScanObjCmd( } ClockInitDateInfo(info); - yydate.tzName = NULL; - + /* * Extract year, month and day from the base time for the parser to use as * defaults @@ -3114,7 +3114,7 @@ ClockScanObjCmd( else { /* Use compiled version of Scan - */ - ret = ClockScan(clientData, interp, info, objv[1], &opts); + ret = ClockScan(info, objv[1], &opts); } if (ret != TCL_OK) { diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 9211481..b46b7bf 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -490,6 +490,74 @@ Tcl_GetClockFrmScnFromObj( return fss; } +MODULE_SCOPE Tcl_Obj * +ClockLocalizeFormat( + ClockFmtScnCmdArgs *opts) +{ + ClockClientData *dataPtr = opts->clientData; + Tcl_Obj *valObj = NULL, *keyObj; + + keyObj = ClockFrmObjGetLocFmtKey(opts->interp, opts->formatObj); + + /* special case - format object is not localizable */ + if (keyObj == opts->formatObj) { + return opts->formatObj; + } + + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return NULL; + } + + /* try to find in cache within locale mc-catalog */ + if (Tcl_DictObjGet(NULL, opts->mcDictObj, + keyObj, &valObj) != TCL_OK) { + return NULL; + } + + /* call LocalizeFormat locale format fmtkey */ + if (valObj == NULL) { + Tcl_Obj *callargs[4]; + callargs[0] = dataPtr->literals[LIT_LOCALIZE_FORMAT]; + callargs[1] = opts->localeObj; + callargs[2] = opts->formatObj; + callargs[3] = keyObj; + Tcl_IncrRefCount(keyObj); + if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK + ) { + goto clean; + } + + valObj = Tcl_GetObjResult(opts->interp); + + /* cache it inside mc-dictionary (this incr. ref count of keyObj/valObj) */ + if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, + keyObj, valObj) != TCL_OK + ) { + valObj = NULL; + goto clean; + } + + /* check special case - format object is not localizable */ + if (valObj == opts->formatObj) { + /* mark it as unlocalizable, by setting self as key (without refcount incr) */ + if (opts->formatObj->typePtr == &ClockFmtObjType) { + Tcl_UnsetObjRef(ObjLocFmtKey(opts->formatObj)); + ObjLocFmtKey(opts->formatObj) = opts->formatObj; + } + } +clean: + + Tcl_UnsetObjRef(keyObj); + if (valObj) { + Tcl_ResetResult(opts->interp); + } + } + + return (opts->formatObj = valObj); +} + /* * DetermineGreedySearchLen -- * @@ -1131,7 +1199,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), NULL}, }; -static const char *ScnSTokenWrapMapIndex[2] = { +static const char *ScnSTokenMapAliasIndex[2] = { "eNBhkIlPAuwZ", "dmbbHHHpaaaz" }; @@ -1146,7 +1214,7 @@ static ClockScanTokenMap ScnETokenMap[] = { {CTOKT_PARSER, 0, 0, 0, 0, 0, /* currently no capture, parse only token */ ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; -static const char *ScnETokenWrapMapIndex[2] = { +static const char *ScnETokenMapAliasIndex[2] = { "", "" }; @@ -1176,7 +1244,7 @@ static ClockScanTokenMap ScnOTokenMap[] = { {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, ClockScnToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; -static const char *ScnOTokenWrapMapIndex[2] = { +static const char *ScnOTokenMapAliasIndex[2] = { "ekIlw", "dHHHu" }; @@ -1194,6 +1262,29 @@ static ClockScanTokenMap ScnWordTokenMap = { }; +inline unsigned int +EstimateTokenCount( + register const char *fmt, + register const char *end) +{ + register const char *p = fmt; + unsigned int tokcnt; + /* estimate token count by % char and format length */ + tokcnt = 0; + while (p <= end) { + if (*p++ == '%') tokcnt++; + } + p = fmt + tokcnt * 2; + if (p < end) { + if ((unsigned int)(end - p) < tokcnt) { + tokcnt += (end - p); + } else { + tokcnt += tokcnt; + } + } + return ++tokcnt; +} + #define AllocTokenInChain(tok, chain, tokCnt) \ if (++(tok) >= (chain) + (tokCnt)) { \ (char *)(chain) = ckrealloc((char *)(chain), \ @@ -1215,56 +1306,32 @@ ClockGetOrParseScanFormat( ClockFmtScnStorage *fss; ClockScanToken *tok; - if (formatObj->typePtr != &ClockFmtObjType) { - if (ClockFmtObj_SetFromAny(interp, formatObj) != TCL_OK) { - return NULL; - } - } - - fss = ObjClockFmtScn(formatObj); - + fss = Tcl_GetClockFrmScnFromObj(interp, formatObj); if (fss == NULL) { - fss = FindOrCreateFmtScnStorage(interp, formatObj); - if (fss == NULL) { - return NULL; - } + return NULL; } /* if first time scanning - tokenize format */ if (fss->scnTok == NULL) { - const char *strFmt; register const char *p, *e, *cp; - e = strFmt = HashEntry4FmtScn(fss)->key.string; - e += strlen(strFmt); + e = p = HashEntry4FmtScn(fss)->key.string; + e += strlen(p); /* estimate token count by % char and format length */ - fss->scnTokC = 0; - p = strFmt; - while (p != e) { - if (*p++ == '%') fss->scnTokC++; - } - p = strFmt + fss->scnTokC * 2; - if (p < e) { - if ((unsigned int)(e - p) < fss->scnTokC) { - fss->scnTokC += (e - p); - } else { - fss->scnTokC += fss->scnTokC; - } - } - fss->scnTokC++; + fss->scnTokC = EstimateTokenCount(p, e); Tcl_MutexLock(&ClockFmtMutex); fss->scnTok = tok = ckalloc(sizeof(*tok) * fss->scnTokC); memset(tok, 0, sizeof(*(tok))); - for (p = strFmt; p < e;) { + while (p < e) { switch (*p) { case '%': if (1) { ClockScanTokenMap * scnMap = ScnSTokenMap; const char *mapIndex = ScnSTokenMapIndex, - **wrapIndex = ScnSTokenWrapMapIndex; + **aliasIndex = ScnSTokenMapAliasIndex; if (p+1 >= e) { goto word_tok; } @@ -1284,13 +1351,13 @@ ClockGetOrParseScanFormat( case 'E': scnMap = ScnETokenMap, mapIndex = ScnETokenMapIndex, - wrapIndex = ScnETokenWrapMapIndex; + aliasIndex = ScnETokenMapAliasIndex; p++; break; case 'O': scnMap = ScnOTokenMap, mapIndex = ScnOTokenMapIndex, - wrapIndex = ScnOTokenWrapMapIndex; + aliasIndex = ScnOTokenMapAliasIndex; p++; break; } @@ -1298,17 +1365,17 @@ ClockGetOrParseScanFormat( cp = strchr(mapIndex, *p); if (!cp || *cp == '\0') { /* search wrapper index (multiple chars for same token) */ - cp = strchr(wrapIndex[0], *p); + cp = strchr(aliasIndex[0], *p); if (!cp || *cp == '\0') { - p--; + p--; if (scnMap != ScnSTokenMap) p--; goto word_tok; } - cp = strchr(mapIndex, wrapIndex[1][cp - wrapIndex[0]]); + cp = strchr(mapIndex, aliasIndex[1][cp - aliasIndex[0]]); if (!cp || *cp == '\0') { /* unexpected, but ... */ #ifdef DEBUG Tcl_Panic("token \"%c\" has no map in wrapper resolver", *p); #endif - p--; + p--; if (scnMap != ScnSTokenMap) p--; goto word_tok; } } @@ -1351,17 +1418,16 @@ word_tok: if (tok > fss->scnTok && (tok-1)->map == &ScnWordTokenMap) { wordTok = tok-1; } - wordTok->tokWord.end = p+1; if (wordTok == tok) { wordTok->tokWord.start = p; wordTok->map = &ScnWordTokenMap; AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); } + p = TclUtfNext(p); + wordTok->tokWord.end = p; } break; } - - p = TclUtfNext(p); } /* calculate end distance value for each tokens */ @@ -1386,86 +1452,16 @@ done: return fss->scnTok; } -MODULE_SCOPE Tcl_Obj * -ClockLocalizeFormat( - ClockFmtScnCmdArgs *opts) -{ - ClockClientData *dataPtr = opts->clientData; - Tcl_Obj *valObj = NULL, *keyObj; - - keyObj = ClockFrmObjGetLocFmtKey(opts->interp, opts->formatObj); - - /* special case - format object is not localizable */ - if (keyObj == opts->formatObj) { - return opts->formatObj; - } - - if (opts->mcDictObj == NULL) { - ClockMCDict(opts); - if (opts->mcDictObj == NULL) - return NULL; - } - - /* try to find in cache within locale mc-catalog */ - if (Tcl_DictObjGet(NULL, opts->mcDictObj, - keyObj, &valObj) != TCL_OK) { - return NULL; - } - - /* call LocalizeFormat locale format fmtkey */ - if (valObj == NULL) { - Tcl_Obj *callargs[4]; - callargs[0] = dataPtr->literals[LIT_LOCALIZE_FORMAT]; - callargs[1] = opts->localeObj; - callargs[2] = opts->formatObj; - callargs[3] = keyObj; - Tcl_IncrRefCount(keyObj); - if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK - ) { - goto clean; - } - - valObj = Tcl_GetObjResult(opts->interp); - - /* cache it inside mc-dictionary (this incr. ref count of keyObj/valObj) */ - if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, - keyObj, valObj) != TCL_OK - ) { - valObj = NULL; - goto clean; - } - - /* check special case - format object is not localizable */ - if (valObj == opts->formatObj) { - /* mark it as unlocalizable, by setting self as key (without refcount incr) */ - if (opts->formatObj->typePtr == &ClockFmtObjType) { - Tcl_UnsetObjRef(ObjLocFmtKey(opts->formatObj)); - ObjLocFmtKey(opts->formatObj) = opts->formatObj; - } - } -clean: - - Tcl_UnsetObjRef(keyObj); - if (valObj) { - Tcl_ResetResult(opts->interp); - } - } - - return (opts->formatObj = valObj); -} - /* *---------------------------------------------------------------------- */ int ClockScan( - ClientData clientData, /* Client data containing literal pool */ - Tcl_Interp *interp, /* Tcl interpreter */ register DateInfo *info, /* Date fields used for parsing & converting */ Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { - ClockClientData *dataPtr = clientData; + ClockClientData *dataPtr = opts->clientData; ClockScanToken *tok; ClockScanTokenMap *map; register const char *p, *x, *end; @@ -1477,7 +1473,8 @@ ClockScan( return TCL_ERROR; } - if ((tok = ClockGetOrParseScanFormat(interp, opts->formatObj)) == NULL) { + if ((tok = ClockGetOrParseScanFormat(opts->interp, + opts->formatObj)) == NULL) { return TCL_ERROR; } @@ -1635,11 +1632,14 @@ ClockScan( } } /* end of string, check only optional tokens at end, otherwise - not match */ - if (tok->map != NULL) { - if ( !(opts->flags & CLF_STRICT) && (tok->map->type == CTOKT_SPACE) - || (tok->map->flags & CLF_OPTIONAL)) { + while (tok->map != NULL) { + if (!(opts->flags & CLF_STRICT) && (tok->map->type == CTOKT_SPACE)) { + tok++; + } + if (tok->map != NULL && !(tok->map->flags & CLF_OPTIONAL)) { goto not_match; } + tok++; } /* @@ -1745,33 +1745,377 @@ ClockScan( overflow: - Tcl_SetResult(interp, "requested date too large to represent", + Tcl_SetResult(opts->interp, "requested date too large to represent", TCL_STATIC); - Tcl_SetErrorCode(interp, "CLOCK", "dateTooLarge", NULL); + Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL); goto done; not_match: - Tcl_SetResult(interp, "input string does not match supplied format", + Tcl_SetResult(opts->interp, "input string does not match supplied format", TCL_STATIC); - Tcl_SetErrorCode(interp, "CLOCK", "badInputString", NULL); + Tcl_SetErrorCode(opts->interp, "CLOCK", "badInputString", NULL); done: return ret; } + + +inline int +FrmResultAllocate( + register DateFormat *dateFmt, + int len) +{ + int needed = dateFmt->output + len - dateFmt->resEnd; + if (needed >= 0) { /* >= 0 - regards NTS zero */ + int newsize = dateFmt->resEnd - dateFmt->resMem + + needed + MIN_FMT_RESULT_BLOCK_ALLOC; + char *newRes = ckrealloc(dateFmt->resMem, newsize); + if (newRes == NULL) { + return TCL_ERROR; + } + dateFmt->output = newRes + (dateFmt->output - dateFmt->resMem); + dateFmt->resMem = newRes; + dateFmt->resEnd = newRes + newsize; + } + return TCL_OK; +} + +static int +ClockFmtToken_HourAMPM_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + *val = ( ( ( *val % 86400 ) + 86400 - 3600 ) / 3600 ) % 12 + 1; + return TCL_OK; +} + +static int +ClockFmtToken_AMPM_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + Tcl_Obj *mcObj; + const char *s; + int len; + + if ((*val % 84600) < (84600 / 2)) { + mcObj = ClockMCGet(opts, MCLIT_AM); + } else { + mcObj = ClockMCGet(opts, MCLIT_PM); + } + if (mcObj == NULL) { + return TCL_ERROR; + } + s = TclGetString(mcObj); len = mcObj->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + if (*tok->tokWord.start == 'p') { + len = Tcl_UtfToUpper(dateFmt->output); + } + dateFmt->output += len; + *dateFmt->output = '\0'; + + return TCL_OK; +} + +static const char *FmtSTokenMapIndex = + "demNbByYCHMSIklpaAugGjJsnt"; +static ClockFormatTokenMap FmtSTokenMap[] = { + /* %d */ + {CFMTT_INT, "%02d", 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, + /* %e */ + {CFMTT_INT, "%2d", 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, + /* %m */ + {CFMTT_INT, "%02d", 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, + /* %N */ + {CFMTT_INT, "%2d", 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, + /* %b %h */ + {CFMTT_INT, NULL, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), + NULL, (void *)MCLIT_MONTHS_ABBREV}, + /* %B */ + {CFMTT_INT, NULL, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), + NULL, (void *)MCLIT_MONTHS_FULL}, + /* %y */ + {CFMTT_INT, "%02d", 0, 0, 100, TclOffset(DateFormat, date.year), NULL}, + /* %Y */ + {CFMTT_INT, "%04d", 0, 0, 0, TclOffset(DateFormat, date.year), NULL}, + /* %C */ + {CFMTT_INT, "%02d", 0, 100, 0, TclOffset(DateFormat, date.year), NULL}, + /* %H */ + {CFMTT_INT, "%02d", 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, + /* %M */ + {CFMTT_INT, "%02d", 0, 60, 60, TclOffset(DateFormat, date.localSeconds), NULL}, + /* %S */ + {CFMTT_INT, "%02d", 0, 0, 60, TclOffset(DateFormat, date.localSeconds), NULL}, + /* %I */ + {CFMTT_INT, "%02d", CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), + ClockFmtToken_HourAMPM_Proc, NULL}, + /* %k */ + {CFMTT_INT, "%2d", 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, + /* %l */ + {CFMTT_INT, "%2d", CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), + ClockFmtToken_HourAMPM_Proc, NULL}, + /* %p %P */ + {CFMTT_INT, "%02d", 0, 0, 0, TclOffset(DateFormat, date.localSeconds), + ClockFmtToken_AMPM_Proc, NULL}, + /* %a */ + {CFMTT_INT, NULL, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_DAYS_OF_WEEK_ABBREV}, + /* %A */ + {CFMTT_INT, NULL, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_DAYS_OF_WEEK_FULL}, + /* %u */ + {CFMTT_INT, "%1d", 0, 0, 0, TclOffset(DateFormat, date.dayOfWeek), NULL}, + /* %g */ + {CFMTT_INT, "%02d", 0, 0, 100, TclOffset(DateFormat, date.iso8601Year), NULL}, + /* %G */ + {CFMTT_INT, "%04d", 0, 0, 0, TclOffset(DateFormat, date.iso8601Year), NULL}, + /* %j */ + {CFMTT_INT, "%03d", 0, 0, 0, TclOffset(DateFormat, date.dayOfYear), NULL}, + /* %J */ + {CFMTT_INT, "%07d", 0, 0, 0, TclOffset(DateFormat, date.julianDay), NULL}, + /* %s */ + {CFMTT_WIDE, "%ld", 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, + /* %n */ + {CFMTT_CHAR, "\n", 0, 0, 0, 0, NULL}, + /* %t */ + {CFMTT_CHAR, "\t", 0, 0, 0, 0, NULL}, + +#if 0 + /* %H %k %I %l */ + {CFMTT_INT, CLF_TIME, 1, 2, TclOffset(DateFormat, date.hour), + NULL}, + /* %M */ + {CFMTT_INT, CLF_TIME, 1, 2, TclOffset(DateFormat, date.minutes), + NULL}, + /* %S */ + {CFMTT_INT, CLF_TIME, 1, 2, TclOffset(DateFormat, date.secondOfDay), + NULL}, + /* %p %P */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, + ClockFmtToken_amPmInd_Proc, NULL}, + /* %J */ + {CFMTT_INT, CLF_JULIANDAY, 1, 0xffff, TclOffset(DateFormat, date.julianDay), + NULL}, + /* %j */ + {CFMTT_INT, CLF_DAYOFYEAR, 1, 3, TclOffset(DateFormat, date.dayOfYear), + NULL}, + /* %g */ + {CFMTT_INT, CLF_ISO8601YEAR | CLF_ISO8601, 2, 2, TclOffset(DateFormat, date.iso8601Year), + NULL}, + /* %G */ + {CFMTT_INT, CLF_ISO8601YEAR | CLF_ISO8601 | CLF_ISO8601CENTURY, 4, 4, TclOffset(DateFormat, date.iso8601Year), + NULL}, + /* %V */ + {CFMTT_INT, CLF_ISO8601, 1, 2, TclOffset(DateFormat, date.iso8601Week), + NULL}, + /* %a %A %u %w */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, + ClockFmtToken_DayOfWeek_Proc, NULL}, + /* %z %Z */ + {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0, + ClockFmtToken_TimeZone_Proc, NULL}, + /* %s */ + {CFMTT_INT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateFormat, date.localSeconds), + NULL}, +#endif +}; +static const char *FmtSTokenMapAliasIndex[2] = { + "hP", + "bp" +}; + +static const char *FmtETokenMapIndex = +"";// "Ey"; +static ClockFormatTokenMap FmtETokenMap[] = { + {CFMTT_INT, "%02d", 0, 0, 0, 0, NULL}, +#if 0 + /* %EE */ + {CTOKT_PARSER, 0, 0, 0, 0, TclOffset(DateFormat, date.year), + ClockFmtToken_LocaleERA_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ey */ + {CTOKT_PARSER, 0, 0, 0, 0, 0, /* currently no capture, parse only token */ + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, +#endif +}; +static const char *FmtETokenMapAliasIndex[2] = { + "", + "" +}; + +static const char *FmtOTokenMapIndex = +"";// "dmyHMSu"; +static ClockFormatTokenMap FmtOTokenMap[] = { + {CFMTT_INT, "%02d", 0, 0, 0, 0, NULL}, +#if 0 + /* %Od %Oe */ + {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Om */ + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0, TclOffset(DateFormat, date.month), + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Oy */ + {CTOKT_PARSER, CLF_YEAR, 0, 0, 0, TclOffset(DateFormat, date.year), + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OH %Ok %OI %Ol */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateFormat, date.hour), + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OM */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateFormat, date.minutes), + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OS */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateFormat, date.secondOfDay), + ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ou Ow */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + ClockFmtToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS}, +#endif +}; +static const char *FmtOTokenMapAliasIndex[2] = { +"", "" +#if 0 + "ekIlw", + "dHHHu" +#endif +}; + +static ClockFormatTokenMap FmtWordTokenMap = { + CTOKT_WORD, NULL, 0, 0, 0, 0, NULL +}; + +/* + *---------------------------------------------------------------------- + */ +ClockFormatToken * +ClockGetOrParseFmtFormat( + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *formatObj) /* Format container */ +{ + ClockFmtScnStorage *fss; + ClockFormatToken *tok; + + fss = Tcl_GetClockFrmScnFromObj(interp, formatObj); + if (fss == NULL) { + return NULL; + } + + /* if first time scanning - tokenize format */ + if (fss->fmtTok == NULL) { + register const char *p, *e, *cp; + + e = p = HashEntry4FmtScn(fss)->key.string; + e += strlen(p); + + /* estimate token count by % char and format length */ + fss->fmtTokC = EstimateTokenCount(p, e); + + Tcl_MutexLock(&ClockFmtMutex); + + fss->fmtTok = tok = ckalloc(sizeof(*tok) * fss->fmtTokC); + memset(tok, 0, sizeof(*(tok))); + while (p < e) { + switch (*p) { + case '%': + if (1) { + ClockFormatTokenMap * fmtMap = FmtSTokenMap; + const char *mapIndex = FmtSTokenMapIndex, + **aliasIndex = FmtSTokenMapAliasIndex; + if (p+1 >= e) { + goto word_tok; + } + p++; + /* try to find modifier: */ + switch (*p) { + case '%': + /* begin new word token - don't join with previous word token, + * because current mapping should be "...%%..." -> "...%..." */ + tok->map = &FmtWordTokenMap; + tok->tokWord.start = p; + tok->tokWord.end = p+1; + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); + p++; + continue; + break; + case 'E': + fmtMap = FmtETokenMap, + mapIndex = FmtETokenMapIndex, + aliasIndex = FmtETokenMapAliasIndex; + p++; + break; + case 'O': + fmtMap = FmtOTokenMap, + mapIndex = FmtOTokenMapIndex, + aliasIndex = FmtOTokenMapAliasIndex; + p++; + break; + } + /* search direct index */ + cp = strchr(mapIndex, *p); + if (!cp || *cp == '\0') { + /* search wrapper index (multiple chars for same token) */ + cp = strchr(aliasIndex[0], *p); + if (!cp || *cp == '\0') { + p--; if (fmtMap != FmtSTokenMap) p--; + goto word_tok; + } + cp = strchr(mapIndex, aliasIndex[1][cp - aliasIndex[0]]); + if (!cp || *cp == '\0') { /* unexpected, but ... */ + #ifdef DEBUG + Tcl_Panic("token \"%c\" has no map in wrapper resolver", *p); + #endif + p--; if (fmtMap != FmtSTokenMap) p--; + goto word_tok; + } + } + tok->map = &fmtMap[cp - mapIndex]; + tok->tokWord.start = p; + /* next token */ + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); + p++; + continue; + } + break; + default: +word_tok: + if (1) { + ClockFormatToken *wordTok = tok; + if (tok > fss->fmtTok && (tok-1)->map == &FmtWordTokenMap) { + wordTok = tok-1; + } + if (wordTok == tok) { + wordTok->tokWord.start = p; + wordTok->map = &FmtWordTokenMap; + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); + } + p = TclUtfNext(p); + wordTok->tokWord.end = p; + } + break; + } + } + +done: + Tcl_MutexUnlock(&ClockFmtMutex); + } + + return fss->fmtTok; +} /* *---------------------------------------------------------------------- */ int ClockFormat( - ClientData clientData, /* Client data containing literal pool */ - Tcl_Interp *interp, /* Tcl interpreter */ - register DateInfo *info, /* Date fields used for parsing & converting */ - ClockFmtScnCmdArgs *opts) /* Command options */ + register DateFormat *dateFmt, /* Date fields used for parsing & converting */ + ClockFmtScnCmdArgs *opts) /* Command options */ { - ClockClientData *dataPtr = clientData; + ClockClientData *dataPtr = opts->clientData; ClockFormatToken *tok; ClockFormatTokenMap *map; @@ -1780,10 +2124,119 @@ ClockFormat( return TCL_ERROR; } -/* if ((tok = ClockGetOrParseFmtFormat(interp, opts->formatObj)) == NULL) { + if ((tok = ClockGetOrParseFmtFormat(opts->interp, + opts->formatObj)) == NULL) { return TCL_ERROR; } -*/ + + dateFmt->resMem = ckalloc(MIN_FMT_RESULT_BLOCK_ALLOC); /* result container object */ + if (dateFmt->resMem == NULL) { + return TCL_ERROR; + } + dateFmt->output = dateFmt->resMem; + dateFmt->resEnd = dateFmt->resMem + MIN_FMT_RESULT_BLOCK_ALLOC; + *dateFmt->output = '\0'; + + /* do format each token */ + for (; tok->map != NULL; tok++) { + map = tok->map; + switch (map->type) + { + case CFMTT_INT: + if (1) { + int val = (int)*(time_t *)(((char *)dateFmt) + map->offs); + if (map->fmtproc == NULL) { + if (map->flags & CLFMT_DECR) { + val--; + } + if (map->flags & CLFMT_INCR) { + val++; + } + if (map->divider) { + val /= map->divider; + } + if (map->divmod) { + val %= map->divmod; + } + } else { + if (map->fmtproc(opts, dateFmt, tok, &val) != TCL_OK) { + goto done; + } + /* if not calculate only (output inside fmtproc) */ + if (!(map->flags & CLFMT_CALC)) { + continue; + } + } + if (!(map->flags & CLFMT_LOCALE_INDX)) { + if (FrmResultAllocate(dateFmt, 10) != TCL_OK) { goto error; }; + dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + } else { + const char *s; + Tcl_Obj * mcObj = ClockMCGet(opts, (int)map->data /* mcKey */); + if (mcObj == NULL) { + goto error; + } + if (Tcl_ListObjIndex(opts->interp, mcObj, val, &mcObj) != TCL_OK) { + goto error; + } + s = TclGetString(mcObj); + if (FrmResultAllocate(dateFmt, mcObj->length) != TCL_OK) { goto error; }; + memcpy(dateFmt->output, s, mcObj->length + 1); + dateFmt->output += mcObj->length; + } + } + break; + case CFMTT_WIDE: + if (1) { + Tcl_WideInt val = *(Tcl_WideInt *)(((char *)dateFmt) + map->offs); + if (FrmResultAllocate(dateFmt, 20) != TCL_OK) { goto error; }; + dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + } + break; + case CFMTT_CHAR: + if (FrmResultAllocate(dateFmt, 1) != TCL_OK) { goto error; }; + *dateFmt->output++ = *map->tostr; + *dateFmt->output = '\0'; + break; + case CFMTT_PROC: + if (map->fmtproc(opts, dateFmt, tok, NULL) != TCL_OK) { + goto error; + }; + break; + case CTOKT_WORD: + if (1) { + int len = tok->tokWord.end - tok->tokWord.start; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { goto error; }; + memcpy(dateFmt->output, tok->tokWord.start, len); + dateFmt->output += len; + *dateFmt->output = '\0'; + } + break; + } + } + + goto done; + +error: + + ckfree(dateFmt->resMem); + dateFmt->resMem = NULL; + +done: + + if (dateFmt->resMem) { + Tcl_Obj * result = Tcl_NewObj(); + result->length = dateFmt->output - dateFmt->resMem; + result->bytes = NULL; + result->bytes = ckrealloc(dateFmt->resMem, result->length+1); + if (result->bytes == NULL) { + result->bytes = dateFmt->resMem; + } + Tcl_SetObjResult(opts->interp, result); + return TCL_OK; + } + + return TCL_ERROR; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 64135d3..141ad60 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -51,7 +51,6 @@ #define CLF_DATE (CLF_JULIANDAY | CLF_DAYOFMONTH | CLF_DAYOFYEAR | \ CLF_MONTH | CLF_YEAR | CLF_ISO8601YEAR | CLF_ISO8601) - /* * Enumeration of the string literals used in [clock] */ @@ -352,12 +351,11 @@ typedef int ClockScanTokenProc( typedef enum _CLCKTOK_TYPE { - CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD + CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD, + CFMTT_INT, CFMTT_WIDE, CFMTT_CHAR, CFMTT_PROC } CLCKTOK_TYPE; -typedef struct ClockFmtScnStorage ClockFmtScnStorage; - -typedef struct ClockFormatTokenMap { +typedef struct ClockScanTokenMap { unsigned short int type; unsigned short int flags; unsigned short int clearFlags; @@ -366,38 +364,62 @@ typedef struct ClockFormatTokenMap { unsigned short int offs; ClockScanTokenProc *parser; void *data; -} ClockFormatTokenMap; -typedef struct ClockFormatToken { - ClockFormatTokenMap *map; +} ClockScanTokenMap; + +typedef struct ClockScanToken { + ClockScanTokenMap *map; + unsigned short int lookAhead; + unsigned short int endDistance; struct { const char *start; const char *end; } tokWord; -} ClockFormatToken; +} ClockScanToken; -typedef struct ClockScanTokenMap { + +#define MIN_FMT_RESULT_BLOCK_ALLOC 200 + +typedef struct DateFormat { + char *resMem; + char *resEnd; + char *output; + + TclDateFields date; +} DateFormat; + +#define CLFMT_INCR (1 << 3) +#define CLFMT_DECR (1 << 4) +#define CLFMT_CALC (1 << 5) +#define CLFMT_LOCALE_INDX (1 << 8) + +typedef struct ClockFormatToken ClockFormatToken; + +typedef int ClockFormatTokenProc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val); + +typedef struct ClockFormatTokenMap { unsigned short int type; + const char *tostr; unsigned short int flags; - unsigned short int clearFlags; - unsigned short int minSize; - unsigned short int maxSize; + unsigned short int divider; + unsigned short int divmod; unsigned short int offs; - ClockScanTokenProc *parser; + ClockFormatTokenProc *fmtproc; void *data; -} ClockScanTokenMap; - -typedef struct ClockScanToken { - ClockScanTokenMap *map; - unsigned short int lookAhead; - unsigned short int endDistance; +} ClockFormatTokenMap; +typedef struct ClockFormatToken { + ClockFormatTokenMap *map; struct { const char *start; const char *end; } tokWord; -} ClockScanToken; +} ClockFormatToken; -#define ClockScnTokenChar(tok) \ - *tok->tokWord.start; + +typedef struct ClockFmtScnStorage ClockFmtScnStorage; typedef struct ClockFmtScnStorage { int objRefCount; /* Reference count shared across threads */ @@ -449,12 +471,11 @@ MODULE_SCOPE ClockFmtScnStorage * MODULE_SCOPE Tcl_Obj * ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); -MODULE_SCOPE int ClockScan(ClientData clientData, Tcl_Interp *interp, - register DateInfo *info, +MODULE_SCOPE int ClockScan(register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); -MODULE_SCOPE int ClockFormat(ClientData clientData, Tcl_Interp *interp, - register DateInfo *info, ClockFmtScnCmdArgs *opts); +MODULE_SCOPE int ClockFormat(register DateFormat *dateFmt, + ClockFmtScnCmdArgs *opts); MODULE_SCOPE void ClockFrmScnClearCaches(void); diff --git a/library/clock.tcl b/library/clock.tcl index c4e698c..06aa10a 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -676,7 +676,7 @@ proc mcget {locale args} { # #---------------------------------------------------------------------- -proc ::tcl::clock::format { args } { +proc ::tcl::clock::__org_format { args } { variable FormatProc variable TZData diff --git a/library/init.tcl b/library/init.tcl index ef0a84a..6f34302 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -178,7 +178,7 @@ if {[interp issafe]} { # Auto-loading stubs for 'clock.tcl' - foreach cmd {add format LocalizeFormat SetupTimeZone GetSystemTimeZone __org_scan} { + foreach cmd {add LocalizeFormat SetupTimeZone GetSystemTimeZone} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] diff --git a/tests/clock.test b/tests/clock.test index a4641c6..b27d2a3 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18600,6 +18600,11 @@ test clock-6.18 {zone token (%z) is optional} { [clock scan " 2009-06-30T18:30:00 " -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ } {1246390200 1246386600 1246386600} +test clock-6.19 {no token parsing} { + list [catch { clock scan "%E%O%" -format "%E%O%" }] \ + [catch { clock scan "...%..." -format "...%%..." }] +} {0 0} + test clock-7.1 {Julian Day} { clock scan 0 -format %J -gmt true } -210866803200 -- cgit v0.12 From d830389b535a333aca4b9f10cf3746317807f2cb Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:42:15 +0000 Subject: [temp-commit]: format almost ready (missing some tokens), sprintf replaced with _itoaw (because "sprintf" too slow) --- generic/tclClock.c | 3 +- generic/tclClockFmt.c | 194 +++++++++++++++++++++++++++++++++++++++----------- generic/tclDate.h | 4 ++ 3 files changed, 157 insertions(+), 44 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 935a347..2e2c44b 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -93,7 +93,6 @@ static void GetGregorianEraYearDay(TclDateFields *, int); static void GetMonthDay(TclDateFields *); static void GetJulianDayFromEraYearWeekDay(TclDateFields *, int); static void GetJulianDayFromEraYearMonthDay(TclDateFields *, int); -static int IsGregorianLeapYear(TclDateFields *); static int WeekdayOnOrBefore(int, int); static int ClockClicksObjCmd( ClientData clientData, Tcl_Interp *interp, @@ -2471,7 +2470,7 @@ GetJulianDayFromEraYearDay( *---------------------------------------------------------------------- */ -static int +MODULE_SCOPE int IsGregorianLeapYear( TclDateFields *fields) /* Date to test */ { diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index b46b7bf..f1fdf27 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1762,6 +1762,50 @@ done: } +inline char * +_itoaw( + char *buf, + register int val, + char padchar, + unsigned short int width) +{ + register char *p; + static int wrange[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; + unsigned short int sign = 0; + + /* sign = 1 by negative number */ + if (val < 0) + { + sign = 1; + val = -val; + if (!width) width++; + } + /* check resp. recalculate width (regarding sign) */ + width -= sign; + while (width <= 9 && val >= wrange[width]) { + width++; + } + width += sign; + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + do { + *p-- = '0' + (val % 10); + val /= 10; + } while (val > 0); + /* sign by 0 padding */ + if (sign && padchar != '0') { *p-- = '-'; sign = 0; } + /* fulling with pad-char */ + while (p >= buf + sign) { + *p-- = padchar; + } + /* sign by non 0 padding */ + if (sign) { *p = '-'; } + + return buf + width; +} + + inline int FrmResultAllocate( register DateFormat *dateFmt, @@ -1789,8 +1833,8 @@ ClockFmtToken_HourAMPM_Proc( ClockFormatToken *tok, int *val) { - *val = ( ( ( *val % 86400 ) + 86400 - 3600 ) / 3600 ) % 12 + 1; - return TCL_OK; + *val = ( ( ( *val % 86400 ) + 86400 - 3600 ) / 3600 ) % 12 + 1; + return TCL_OK; } static int @@ -1819,73 +1863,132 @@ ClockFmtToken_AMPM_Proc( len = Tcl_UtfToUpper(dateFmt->output); } dateFmt->output += len; - *dateFmt->output = '\0'; return TCL_OK; } + +static int +ClockFmtToken_StarDate_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) + { + int fractYear; + /* Get day of year, zero based */ + int doy = dateFmt->date.dayOfYear - 1; + + /* Convert day of year to a fractional year */ + if (IsGregorianLeapYear(&dateFmt->date)) { + fractYear = 1000 * doy / 366; + } else { + fractYear = 1000 * doy / 365; + } + + /* Put together the StarDate as "Stardate %02d%03d.%1d" */ + if (FrmResultAllocate(dateFmt, 20) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, "Stardate ", 9); + dateFmt->output += 9; + dateFmt->output = _itoaw(dateFmt->output, + dateFmt->date.year - RODDENBERRY, '0', 2); + dateFmt->output = _itoaw(dateFmt->output, + fractYear, '0', 3); + *dateFmt->output++ = '.'; + dateFmt->output = _itoaw(dateFmt->output, + dateFmt->date.localSeconds % 86400 / ( 86400 / 10 ), '0', 1); + + return TCL_OK; +} +static int +ClockFmtToken_WeekOfYear_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + int dow = dateFmt->date.dayOfWeek; + if (*tok->tokWord.start == 'U') { + if (dow == 7) { + dow = 0; + } + dow++; + } + *val = ( dateFmt->date.dayOfYear - dow + 7 ) / 7; + return TCL_OK; +} static const char *FmtSTokenMapIndex = - "demNbByYCHMSIklpaAugGjJsnt"; + "demNbByYCHMSIklpaAuwUVgGjJsntQ"; static ClockFormatTokenMap FmtSTokenMap[] = { /* %d */ - {CFMTT_INT, "%02d", 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, + {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, /* %e */ - {CFMTT_INT, "%2d", 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, + {CFMTT_INT, " ", 2, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, /* %m */ - {CFMTT_INT, "%02d", 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, + {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, /* %N */ - {CFMTT_INT, "%2d", 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, + {CFMTT_INT, " ", 2, 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, /* %b %h */ - {CFMTT_INT, NULL, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), NULL, (void *)MCLIT_MONTHS_ABBREV}, /* %B */ - {CFMTT_INT, NULL, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), NULL, (void *)MCLIT_MONTHS_FULL}, /* %y */ - {CFMTT_INT, "%02d", 0, 0, 100, TclOffset(DateFormat, date.year), NULL}, + {CFMTT_INT, "0", 2, 0, 0, 100, TclOffset(DateFormat, date.year), NULL}, /* %Y */ - {CFMTT_INT, "%04d", 0, 0, 0, TclOffset(DateFormat, date.year), NULL}, + {CFMTT_INT, "0", 4, 0, 0, 0, TclOffset(DateFormat, date.year), NULL}, /* %C */ - {CFMTT_INT, "%02d", 0, 100, 0, TclOffset(DateFormat, date.year), NULL}, + {CFMTT_INT, "0", 2, 0, 100, 0, TclOffset(DateFormat, date.year), NULL}, /* %H */ - {CFMTT_INT, "%02d", 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, "0", 2, 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, /* %M */ - {CFMTT_INT, "%02d", 0, 60, 60, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, "0", 2, 0, 60, 60, TclOffset(DateFormat, date.localSeconds), NULL}, /* %S */ - {CFMTT_INT, "%02d", 0, 0, 60, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, "0", 2, 0, 0, 60, TclOffset(DateFormat, date.localSeconds), NULL}, /* %I */ - {CFMTT_INT, "%02d", CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), ClockFmtToken_HourAMPM_Proc, NULL}, /* %k */ - {CFMTT_INT, "%2d", 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, " ", 2, 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, /* %l */ - {CFMTT_INT, "%2d", CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), + {CFMTT_INT, " ", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), ClockFmtToken_HourAMPM_Proc, NULL}, /* %p %P */ - {CFMTT_INT, "%02d", 0, 0, 0, TclOffset(DateFormat, date.localSeconds), + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.localSeconds), ClockFmtToken_AMPM_Proc, NULL}, /* %a */ - {CFMTT_INT, NULL, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), NULL, (void *)MCLIT_DAYS_OF_WEEK_ABBREV}, /* %A */ - {CFMTT_INT, NULL, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), NULL, (void *)MCLIT_DAYS_OF_WEEK_FULL}, /* %u */ - {CFMTT_INT, "%1d", 0, 0, 0, TclOffset(DateFormat, date.dayOfWeek), NULL}, + {CFMTT_INT, " ", 1, 0, 0, 0, TclOffset(DateFormat, date.dayOfWeek), NULL}, + /* %w */ + {CFMTT_INT, " ", 1, 0, 0, 7, TclOffset(DateFormat, date.dayOfWeek), NULL}, + /* %U %W */ + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.dayOfYear), + ClockFmtToken_WeekOfYear_Proc, NULL}, + /* %V */ + {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.iso8601Week), NULL}, /* %g */ - {CFMTT_INT, "%02d", 0, 0, 100, TclOffset(DateFormat, date.iso8601Year), NULL}, + {CFMTT_INT, "0", 2, 0, 0, 100, TclOffset(DateFormat, date.iso8601Year), NULL}, /* %G */ - {CFMTT_INT, "%04d", 0, 0, 0, TclOffset(DateFormat, date.iso8601Year), NULL}, + {CFMTT_INT, "0", 4, 0, 0, 0, TclOffset(DateFormat, date.iso8601Year), NULL}, /* %j */ - {CFMTT_INT, "%03d", 0, 0, 0, TclOffset(DateFormat, date.dayOfYear), NULL}, + {CFMTT_INT, "0", 3, 0, 0, 0, TclOffset(DateFormat, date.dayOfYear), NULL}, /* %J */ - {CFMTT_INT, "%07d", 0, 0, 0, TclOffset(DateFormat, date.julianDay), NULL}, + {CFMTT_INT, "0", 7, 0, 0, 0, TclOffset(DateFormat, date.julianDay), NULL}, /* %s */ - {CFMTT_WIDE, "%ld", 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, + {CFMTT_WIDE, "%ld", 0, 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, /* %n */ - {CFMTT_CHAR, "\n", 0, 0, 0, 0, NULL}, + {CFMTT_CHAR, "\n", 0, 0, 0, 0, 0, NULL}, /* %t */ - {CFMTT_CHAR, "\t", 0, 0, 0, 0, NULL}, + {CFMTT_CHAR, "\t", 0, 0, 0, 0, 0, NULL}, + /* %Q */ + {CFMTT_INT, NULL, 0, 0, 0, 0, 0, + ClockFmtToken_StarDate_Proc, NULL}, #if 0 /* %H %k %I %l */ @@ -1927,14 +2030,14 @@ static ClockFormatTokenMap FmtSTokenMap[] = { #endif }; static const char *FmtSTokenMapAliasIndex[2] = { - "hP", - "bp" + "hPW", + "bpU" }; static const char *FmtETokenMapIndex = "";// "Ey"; static ClockFormatTokenMap FmtETokenMap[] = { - {CFMTT_INT, "%02d", 0, 0, 0, 0, NULL}, + {CFMTT_INT, "0", 2, 0, 0, 0, 0, NULL}, #if 0 /* %EE */ {CTOKT_PARSER, 0, 0, 0, 0, TclOffset(DateFormat, date.year), @@ -1952,7 +2055,7 @@ static const char *FmtETokenMapAliasIndex[2] = { static const char *FmtOTokenMapIndex = "";// "dmyHMSu"; static ClockFormatTokenMap FmtOTokenMap[] = { - {CFMTT_INT, "%02d", 0, 0, 0, 0, NULL}, + {CFMTT_INT, "0", 2, 0, 0, 0, 0, NULL}, #if 0 /* %Od %Oe */ {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), @@ -1986,7 +2089,7 @@ static const char *FmtOTokenMapAliasIndex[2] = { }; static ClockFormatTokenMap FmtWordTokenMap = { - CTOKT_WORD, NULL, 0, 0, 0, 0, NULL + CTOKT_WORD, NULL, 0, 0, 0, 0, 0, NULL }; /* @@ -2168,8 +2271,12 @@ ClockFormat( } } if (!(map->flags & CLFMT_LOCALE_INDX)) { - if (FrmResultAllocate(dateFmt, 10) != TCL_OK) { goto error; }; - dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { goto error; }; + if (map->width) { + dateFmt->output = _itoaw(dateFmt->output, val, *map->tostr, map->width); + } else { + dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + } } else { const char *s; Tcl_Obj * mcObj = ClockMCGet(opts, (int)map->data /* mcKey */); @@ -2189,14 +2296,13 @@ ClockFormat( case CFMTT_WIDE: if (1) { Tcl_WideInt val = *(Tcl_WideInt *)(((char *)dateFmt) + map->offs); - if (FrmResultAllocate(dateFmt, 20) != TCL_OK) { goto error; }; + if (FrmResultAllocate(dateFmt, 21) != TCL_OK) { goto error; }; dateFmt->output += sprintf(dateFmt->output, map->tostr, val); } break; case CFMTT_CHAR: if (FrmResultAllocate(dateFmt, 1) != TCL_OK) { goto error; }; *dateFmt->output++ = *map->tostr; - *dateFmt->output = '\0'; break; case CFMTT_PROC: if (map->fmtproc(opts, dateFmt, tok, NULL) != TCL_OK) { @@ -2207,9 +2313,12 @@ ClockFormat( if (1) { int len = tok->tokWord.end - tok->tokWord.start; if (FrmResultAllocate(dateFmt, len) != TCL_OK) { goto error; }; - memcpy(dateFmt->output, tok->tokWord.start, len); - dateFmt->output += len; - *dateFmt->output = '\0'; + if (len == 1) { + *dateFmt->output++ = *tok->tokWord.start; + } else { + memcpy(dateFmt->output, tok->tokWord.start, len); + dateFmt->output += len; + } } break; } @@ -2232,6 +2341,7 @@ done: if (result->bytes == NULL) { result->bytes = dateFmt->resMem; } + result->bytes[result->length] = '\0'; Tcl_SetObjResult(opts->interp, result); return TCL_OK; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 141ad60..c5d7da5 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -29,6 +29,8 @@ #define FOUR_YEARS 1461 /* days */ #define ONE_YEAR 365 /* days */ +#define RODDENBERRY 1946 /* Another epoch (Hi, Jeff!) */ + #define CLF_OPTIONAL (1 << 0) /* token is non mandatory */ #define CLF_JULIANDAY (1 << 3) @@ -403,6 +405,7 @@ typedef int ClockFormatTokenProc( typedef struct ClockFormatTokenMap { unsigned short int type; const char *tostr; + unsigned short int width; unsigned short int flags; unsigned short int divider; unsigned short int divmod; @@ -441,6 +444,7 @@ typedef struct ClockFmtScnStorage { MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian); +MODULE_SCOPE int IsGregorianLeapYear(TclDateFields *); MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); -- cgit v0.12 From bd20b3429aa04d1c42d1f25a1eaf32008211e1d2 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:43:22 +0000 Subject: porting of clock format completed; all clock test cases passed --- generic/tclClock.c | 30 ++- generic/tclClockFmt.c | 511 +++++++++++++++++++++++++++++++++------------- generic/tclDate.h | 9 + tests-perf/clock.perf.tcl | 75 ++++++- 4 files changed, 478 insertions(+), 147 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 2e2c44b..28a484f 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -70,8 +70,6 @@ TCL_DECLARE_MUTEX(clockMutex) * Function prototypes for local procedures in this file: */ -static int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, - TclDateFields *, Tcl_Obj *timezoneObj, int); static int ConvertUTCToLocalUsingTable(Tcl_Interp *, TclDateFields *, int, Tcl_Obj *const[], Tcl_WideInt rangesVal[2]); @@ -86,8 +84,6 @@ static int ConvertLocalToUTCUsingC(Tcl_Interp *, TclDateFields *, int); static int ClockConfigureObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static Tcl_Obj * LookupLastTransition(Tcl_Interp *, Tcl_WideInt, - int, Tcl_Obj *const *, Tcl_WideInt rangesVal[2]); static void GetYearWeekDay(TclDateFields *, int); static void GetGregorianEraYearDay(TclDateFields *, int); static void GetMonthDay(TclDateFields *); @@ -1730,7 +1726,7 @@ ConvertLocalToUTCUsingC( *---------------------------------------------------------------------- */ -static int +MODULE_SCOPE int ConvertUTCToLocal( ClientData clientData, /* Client data of the interpreter */ Tcl_Interp *interp, /* Tcl interpreter */ @@ -1974,7 +1970,7 @@ ConvertUTCToLocalUsingC( *---------------------------------------------------------------------- */ -static Tcl_Obj * +MODULE_SCOPE Tcl_Obj * LookupLastTransition( Tcl_Interp *interp, /* Interpreter for error messages */ Tcl_WideInt tick, /* Time from the epoch */ @@ -2950,7 +2946,7 @@ ClockFormatObjCmd( DateFormat dateFmt; /* Common structure used for formatting */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "string " + Tcl_WrongNumArgs(interp, 1, objv, "clockval " "?-format string? " "?-gmt boolean? " "?-locale LOCALE? ?-timezone ZONE?"); @@ -2974,6 +2970,16 @@ ClockFormatObjCmd( return TCL_ERROR; } + /* + * seconds could be an unsigned number that overflowed. Make sure + * that it isn't. + */ + + if (objv[1]->typePtr == &tclBignumType) { + Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); + return TCL_ERROR; + } + memset(&dateFmt, 0, sizeof(dateFmt)); /* @@ -3065,6 +3071,16 @@ ClockScanObjCmd( if (Tcl_GetWideIntFromObj(interp, opts.baseObj, &baseVal) != TCL_OK) { return TCL_ERROR; } + /* + * seconds could be an unsigned number that overflowed. Make sure + * that it isn't. + */ + + if (opts.baseObj->typePtr == &tclBignumType) { + Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); + return TCL_ERROR; + } + } else { Tcl_Time now; Tcl_GetTime(&now); diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index f1fdf27..55e328c 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -101,6 +101,161 @@ _str2wideInt( return TCL_OK; } +inline char * +_itoaw( + char *buf, + register int val, + char padchar, + unsigned short int width) +{ + register char *p; + static int wrange[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; + + /* positive integer */ + + if (val >= 0) + { + /* check resp. recalculate width */ + while (width <= 9 && val >= wrange[width]) { + width++; + } + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val > 0); + /* fulling with pad-char */ + while (p >= buf) { + *p-- = padchar; + } + + return buf + width; + } + /* negative integer */ + + if (!width) width++; + /* check resp. recalculate width (regarding sign) */ + width--; + while (width <= 9 && val <= -wrange[width]) { + width++; + } + width++; + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + /* differentiate platforms with -1 % 10 == 1 and -1 % 10 == -1 */ + if (-1 % 10 == -1) { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' - c; + } while (val < 0); + } else { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val < 0); + } + /* sign by 0 padding */ + if (padchar != '0') { *p-- = '-'; } + /* fulling with pad-char */ + while (p >= buf + 1) { + *p-- = padchar; + } + /* sign by non 0 padding */ + if (padchar == '0') { *p = '-'; } + + return buf + width; +} + +inline char * +_witoaw( + char *buf, + register Tcl_WideInt val, + char padchar, + unsigned short int width) +{ + register char *p; + static int wrange[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; + + /* positive integer */ + + if (val >= 0) + { + /* check resp. recalculate width */ + if (val >= 10000000000L) { + Tcl_WideInt val2; + val2 = val / 10000000000L; + while (width <= 9 && val2 >= wrange[width]) { + width++; + } + width += 10; + } else { + while (width <= 9 && val >= wrange[width]) { + width++; + } + } + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val > 0); + /* fulling with pad-char */ + while (p >= buf) { + *p-- = padchar; + } + + return buf + width; + } + + /* negative integer */ + + if (!width) width++; + /* check resp. recalculate width (regarding sign) */ + width--; + if (val <= 10000000000L) { + Tcl_WideInt val2; + val2 = val / 10000000000L; + while (width <= 9 && val2 <= -wrange[width]) { + width++; + } + width += 10; + } else { + while (width <= 9 && val <= -wrange[width]) { + width++; + } + } + width++; + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + /* differentiate platforms with -1 % 10 == 1 and -1 % 10 == -1 */ + if (-1 % 10 == -1) { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' - c; + } while (val < 0); + } else { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val < 0); + } + /* sign by 0 padding */ + if (padchar != '0') { *p-- = '-'; } + /* fulling with pad-char */ + while (p >= buf + 1) { + *p-- = padchar; + } + /* sign by non 0 padding */ + if (padchar == '0') { *p = '-'; } + + return buf + width; +} + /* *---------------------------------------------------------------------- */ @@ -1760,51 +1915,6 @@ done: return ret; } - - -inline char * -_itoaw( - char *buf, - register int val, - char padchar, - unsigned short int width) -{ - register char *p; - static int wrange[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; - unsigned short int sign = 0; - - /* sign = 1 by negative number */ - if (val < 0) - { - sign = 1; - val = -val; - if (!width) width++; - } - /* check resp. recalculate width (regarding sign) */ - width -= sign; - while (width <= 9 && val >= wrange[width]) { - width++; - } - width += sign; - /* number to string backwards */ - p = buf + width; - *p-- = '\0'; - do { - *p-- = '0' + (val % 10); - val /= 10; - } while (val > 0); - /* sign by 0 padding */ - if (sign && padchar != '0') { *p-- = '-'; sign = 0; } - /* fulling with pad-char */ - while (p >= buf + sign) { - *p-- = padchar; - } - /* sign by non 0 padding */ - if (sign) { *p = '-'; } - - return buf + width; -} - inline int FrmResultAllocate( @@ -1833,7 +1943,7 @@ ClockFmtToken_HourAMPM_Proc( ClockFormatToken *tok, int *val) { - *val = ( ( ( *val % 86400 ) + 86400 - 3600 ) / 3600 ) % 12 + 1; + *val = ( ( ( *val % SECONDS_PER_DAY ) + SECONDS_PER_DAY - 3600 ) / 3600 ) % 12 + 1; return TCL_OK; } @@ -1848,7 +1958,7 @@ ClockFmtToken_AMPM_Proc( const char *s; int len; - if ((*val % 84600) < (84600 / 2)) { + if ((*val % SECONDS_PER_DAY) < (SECONDS_PER_DAY / 2)) { mcObj = ClockMCGet(opts, MCLIT_AM); } else { mcObj = ClockMCGet(opts, MCLIT_PM); @@ -1895,7 +2005,7 @@ ClockFmtToken_StarDate_Proc( fractYear, '0', 3); *dateFmt->output++ = '.'; dateFmt->output = _itoaw(dateFmt->output, - dateFmt->date.localSeconds % 86400 / ( 86400 / 10 ), '0', 1); + dateFmt->date.localSeconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); return TCL_OK; } @@ -1916,9 +2026,162 @@ ClockFmtToken_WeekOfYear_Proc( *val = ( dateFmt->date.dayOfYear - dow + 7 ) / 7; return TCL_OK; } +static int +ClockFmtToken_TimeZone_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + if (*tok->tokWord.start == 'z') { + int z = dateFmt->date.tzOffset; + char sign = '+'; + if ( z < 0 ) { + z = -z; + sign = '-'; + } + if (FrmResultAllocate(dateFmt, 7) != TCL_OK) { return TCL_ERROR; }; + *dateFmt->output++ = sign; + dateFmt->output = _itoaw(dateFmt->output, z / 3600, '0', 2); + z %= 3600; + dateFmt->output = _itoaw(dateFmt->output, z / 60, '0', 2); + z %= 60; + if (z != 0) { + dateFmt->output = _itoaw(dateFmt->output, z, '0', 2); + } + } else { + Tcl_Obj * objPtr; + const char *s; int len; + /* convert seconds to local seconds to obtain tzName object */ + if (ConvertUTCToLocal(opts->clientData, opts->interp, + &dateFmt->date, opts->timezoneObj, + GREGORIAN_CHANGE_DATE) != TCL_OK) { + return TCL_ERROR; + }; + objPtr = dateFmt->date.tzName; + s = TclGetString(objPtr); + len = objPtr->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + dateFmt->output += len; + } + return TCL_OK; +} + +static int +ClockFmtToken_LocaleERA_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + Tcl_Obj *mcObj; + const char *s; + int len; + + if (dateFmt->date.era == BCE) { + mcObj = ClockMCGet(opts, MCLIT_BCE); + } else { + mcObj = ClockMCGet(opts, MCLIT_CE); + } + if (mcObj == NULL) { + return TCL_ERROR; + } + s = TclGetString(mcObj); len = mcObj->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + dateFmt->output += len; + + return TCL_OK; +} + +static int +ClockFmtToken_LocaleERAYear_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + int rowc; + Tcl_Obj **rowv; + + if (dateFmt->localeEra == NULL) { + Tcl_Obj *mcObj = ClockMCGet(opts, MCLIT_LOCALE_ERAS); + if (mcObj == NULL) { + return TCL_ERROR; + } + if (TclListObjGetElements(opts->interp, mcObj, &rowc, &rowv) != TCL_OK) { + return TCL_ERROR; + } + if (rowc != 0) { + dateFmt->localeEra = LookupLastTransition(opts->interp, + dateFmt->date.localSeconds, rowc, rowv, NULL); + } + if (dateFmt->localeEra == NULL) { + dateFmt->localeEra = (Tcl_Obj*)1; + } + } + + /* if no LOCALE_ERAS in catalog or era not found */ + if (dateFmt->localeEra == (Tcl_Obj*)1) { + if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { return TCL_ERROR; }; + if (*tok->tokWord.start == 'C') { /* %EC */ + *val = dateFmt->date.year / 100; + dateFmt->output = _itoaw(dateFmt->output, + *val, '0', 2); + } else { /* %Ey */ + *val = dateFmt->date.year % 100; + dateFmt->output = _itoaw(dateFmt->output, + *val, '0', 2); + } + } else { + Tcl_Obj *objPtr; + const char *s; + int len; + if (*tok->tokWord.start == 'C') { /* %EC */ + if (Tcl_ListObjIndex(opts->interp, dateFmt->localeEra, 1, + &objPtr) != TCL_OK ) { + return TCL_ERROR; + } + } else { /* %Ey */ + if (Tcl_ListObjIndex(opts->interp, dateFmt->localeEra, 2, + &objPtr) != TCL_OK ) { + return TCL_ERROR; + } + if (Tcl_GetIntFromObj(opts->interp, objPtr, val) != TCL_OK) { + return TCL_ERROR; + } + *val = dateFmt->date.year - *val; + /* if year in locale numerals */ + if (*val >= 0 && *val < 100) { + /* year as integer */ + Tcl_Obj * mcObj = ClockMCGet(opts, MCLIT_LOCALE_NUMERALS); + if (mcObj == NULL) { + return TCL_ERROR; + } + if (Tcl_ListObjIndex(opts->interp, mcObj, *val, &objPtr) != TCL_OK) { + return TCL_ERROR; + } + } else { + /* year as integer */ + if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { return TCL_ERROR; }; + dateFmt->output = _itoaw(dateFmt->output, + *val, '0', 2); + return TCL_OK; + } + } + s = TclGetString(objPtr); + len = objPtr->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + dateFmt->output += len; + } + return TCL_OK; +} + static const char *FmtSTokenMapIndex = - "demNbByYCHMSIklpaAuwUVgGjJsntQ"; + "demNbByYCHMSIklpaAuwUVzgGjJsntQ"; static ClockFormatTokenMap FmtSTokenMap[] = { /* %d */ {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, @@ -1941,21 +2204,21 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %C */ {CFMTT_INT, "0", 2, 0, 100, 0, TclOffset(DateFormat, date.year), NULL}, /* %H */ - {CFMTT_INT, "0", 2, 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, "0", 2, 0, 3600, 24, TclOffset(DateFormat, date.secondOfDay), NULL}, /* %M */ - {CFMTT_INT, "0", 2, 0, 60, 60, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, "0", 2, 0, 60, 60, TclOffset(DateFormat, date.secondOfDay), NULL}, /* %S */ - {CFMTT_INT, "0", 2, 0, 0, 60, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, "0", 2, 0, 0, 60, TclOffset(DateFormat, date.secondOfDay), NULL}, /* %I */ - {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_HourAMPM_Proc, NULL}, /* %k */ - {CFMTT_INT, " ", 2, 0, 3600, 24, TclOffset(DateFormat, date.localSeconds), NULL}, + {CFMTT_INT, " ", 2, 0, 3600, 24, TclOffset(DateFormat, date.secondOfDay), NULL}, /* %l */ - {CFMTT_INT, " ", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.localSeconds), + {CFMTT_INT, " ", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_HourAMPM_Proc, NULL}, /* %p %P */ - {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.localSeconds), + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_AMPM_Proc, NULL}, /* %a */ {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), @@ -1972,6 +2235,9 @@ static ClockFormatTokenMap FmtSTokenMap[] = { ClockFmtToken_WeekOfYear_Proc, NULL}, /* %V */ {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.iso8601Week), NULL}, + /* %z %Z */ + {CFMTT_INT, NULL, 0, 0, 0, 0, 0, + ClockFmtToken_TimeZone_Proc, NULL}, /* %g */ {CFMTT_INT, "0", 2, 0, 0, 100, TclOffset(DateFormat, date.iso8601Year), NULL}, /* %G */ @@ -1981,7 +2247,7 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %J */ {CFMTT_INT, "0", 7, 0, 0, 0, TclOffset(DateFormat, date.julianDay), NULL}, /* %s */ - {CFMTT_WIDE, "%ld", 0, 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, + {CFMTT_WIDE, "0", 1, 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, /* %n */ {CFMTT_CHAR, "\n", 0, 0, 0, 0, 0, NULL}, /* %t */ @@ -1989,103 +2255,61 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %Q */ {CFMTT_INT, NULL, 0, 0, 0, 0, 0, ClockFmtToken_StarDate_Proc, NULL}, - -#if 0 - /* %H %k %I %l */ - {CFMTT_INT, CLF_TIME, 1, 2, TclOffset(DateFormat, date.hour), - NULL}, - /* %M */ - {CFMTT_INT, CLF_TIME, 1, 2, TclOffset(DateFormat, date.minutes), - NULL}, - /* %S */ - {CFMTT_INT, CLF_TIME, 1, 2, TclOffset(DateFormat, date.secondOfDay), - NULL}, - /* %p %P */ - {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, - ClockFmtToken_amPmInd_Proc, NULL}, - /* %J */ - {CFMTT_INT, CLF_JULIANDAY, 1, 0xffff, TclOffset(DateFormat, date.julianDay), - NULL}, - /* %j */ - {CFMTT_INT, CLF_DAYOFYEAR, 1, 3, TclOffset(DateFormat, date.dayOfYear), - NULL}, - /* %g */ - {CFMTT_INT, CLF_ISO8601YEAR | CLF_ISO8601, 2, 2, TclOffset(DateFormat, date.iso8601Year), - NULL}, - /* %G */ - {CFMTT_INT, CLF_ISO8601YEAR | CLF_ISO8601 | CLF_ISO8601CENTURY, 4, 4, TclOffset(DateFormat, date.iso8601Year), - NULL}, - /* %V */ - {CFMTT_INT, CLF_ISO8601, 1, 2, TclOffset(DateFormat, date.iso8601Week), - NULL}, - /* %a %A %u %w */ - {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, - ClockFmtToken_DayOfWeek_Proc, NULL}, - /* %z %Z */ - {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0, - ClockFmtToken_TimeZone_Proc, NULL}, - /* %s */ - {CFMTT_INT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateFormat, date.localSeconds), - NULL}, -#endif }; static const char *FmtSTokenMapAliasIndex[2] = { - "hPW", - "bpU" + "hPWZ", + "bpUz" }; static const char *FmtETokenMapIndex = -"";// "Ey"; + "Ey"; static ClockFormatTokenMap FmtETokenMap[] = { - {CFMTT_INT, "0", 2, 0, 0, 0, 0, NULL}, -#if 0 /* %EE */ - {CTOKT_PARSER, 0, 0, 0, 0, TclOffset(DateFormat, date.year), - ClockFmtToken_LocaleERA_Proc, (void *)MCLIT_LOCALE_NUMERALS}, - /* %Ey */ - {CTOKT_PARSER, 0, 0, 0, 0, 0, /* currently no capture, parse only token */ - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, -#endif + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.era), + ClockFmtToken_LocaleERA_Proc, NULL}, + /* %Ey %EC */ + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.year), + ClockFmtToken_LocaleERAYear_Proc, NULL}, }; static const char *FmtETokenMapAliasIndex[2] = { - "", - "" + "C", + "y" }; static const char *FmtOTokenMapIndex = -"";// "dmyHMSu"; + "dmyHIMSuw"; static ClockFormatTokenMap FmtOTokenMap[] = { - {CFMTT_INT, "0", 2, 0, 0, 0, 0, NULL}, -#if 0 /* %Od %Oe */ - {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.dayOfMonth), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %Om */ - {CTOKT_PARSER, CLF_MONTH, 0, 0, 0, TclOffset(DateFormat, date.month), - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.month), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %Oy */ - {CTOKT_PARSER, CLF_YEAR, 0, 0, 0, TclOffset(DateFormat, date.year), - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, - /* %OH %Ok %OI %Ol */ - {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateFormat, date.hour), - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.year), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OH %Ok */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 3600, 24, TclOffset(DateFormat, date.secondOfDay), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OI %Ol */ + {CFMTT_INT, NULL, 0, CLFMT_CALC | CLFMT_LOCALE_INDX, 0, 0, TclOffset(DateFormat, date.secondOfDay), + ClockFmtToken_HourAMPM_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %OM */ - {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateFormat, date.minutes), - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 60, 60, TclOffset(DateFormat, date.secondOfDay), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %OS */ - {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateFormat, date.secondOfDay), - ClockFmtToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, - /* %Ou Ow */ - {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, - ClockFmtToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS}, -#endif + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 60, TclOffset(DateFormat, date.secondOfDay), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ou */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ow */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *FmtOTokenMapAliasIndex[2] = { -"", "" -#if 0 - "ekIlw", - "dHHHu" -#endif + "ekl", + "dHI" }; static ClockFormatTokenMap FmtWordTokenMap = { @@ -2232,7 +2456,14 @@ ClockFormat( return TCL_ERROR; } - dateFmt->resMem = ckalloc(MIN_FMT_RESULT_BLOCK_ALLOC); /* result container object */ + /* prepare formatting */ + dateFmt->date.secondOfDay = (int)(dateFmt->date.localSeconds % SECONDS_PER_DAY); + if (dateFmt->date.secondOfDay < 0) { + dateFmt->date.secondOfDay += SECONDS_PER_DAY; + } + + /* result container object */ + dateFmt->resMem = ckalloc(MIN_FMT_RESULT_BLOCK_ALLOC); if (dateFmt->resMem == NULL) { return TCL_ERROR; } @@ -2283,7 +2514,9 @@ ClockFormat( if (mcObj == NULL) { goto error; } - if (Tcl_ListObjIndex(opts->interp, mcObj, val, &mcObj) != TCL_OK) { + if ( Tcl_ListObjIndex(opts->interp, mcObj, val, &mcObj) != TCL_OK + || mcObj == NULL + ) { goto error; } s = TclGetString(mcObj); @@ -2297,7 +2530,11 @@ ClockFormat( if (1) { Tcl_WideInt val = *(Tcl_WideInt *)(((char *)dateFmt) + map->offs); if (FrmResultAllocate(dateFmt, 21) != TCL_OK) { goto error; }; - dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + if (map->width) { + dateFmt->output = _witoaw(dateFmt->output, val, *map->tostr, map->width); + } else { + dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + } } break; case CFMTT_CHAR: diff --git a/generic/tclDate.h b/generic/tclDate.h index c5d7da5..7c68b2a 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -109,6 +109,7 @@ typedef enum ClockMsgCtLiteral { MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, MCLIT_MONTHS_COMB, MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_DAYS_OF_WEEK_COMB, MCLIT_AM, MCLIT_PM, + MCLIT_LOCALE_ERAS, MCLIT_BCE, MCLIT_CE, MCLIT_BCE2, MCLIT_CE2, MCLIT_BCE3, MCLIT_CE3, @@ -121,6 +122,7 @@ typedef enum ClockMsgCtLiteral { pref "MONTHS_FULL", pref "MONTHS_ABBREV", pref "MONTHS_COMB", \ pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", pref "DAYS_OF_WEEK_COMB", \ pref "AM", pref "PM", \ + pref "LOCALE_ERAS", \ pref "BCE", pref "CE", \ pref "b.c.e.", pref "c.e.", \ pref "b.c.", pref "a.d.", \ @@ -387,6 +389,8 @@ typedef struct DateFormat { char *output; TclDateFields date; + + Tcl_Obj *localeEra; } DateFormat; #define CLFMT_INCR (1 << 3) @@ -445,6 +449,11 @@ typedef struct ClockFmtScnStorage { MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian); MODULE_SCOPE int IsGregorianLeapYear(TclDateFields *); +MODULE_SCOPE int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, + TclDateFields *, Tcl_Obj *timezoneObj, int); +MODULE_SCOPE Tcl_Obj * + LookupLastTransition(Tcl_Interp *, Tcl_WideInt, + int, Tcl_Obj *const *, Tcl_WideInt rangesVal[2]); MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 41cc9e1..043d27f 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -56,7 +56,7 @@ proc _test_out_total {} { puts [format "Total %d cases in %.2f sec.:" [llength $_(itcnt)] [expr {[llength $_(itcnt)] * $_(reptime) / 1000.0}]] lset _(m) 0 [format %.6f [expr [join $_(ittm) +]]] lset _(m) 2 [expr [join $_(itcnt) +]] - lset _(m) 4 [expr {[lindex $_(m) 2] / ([llength $_(itcnt)] * $_(reptime) / 1000.0)}] + lset _(m) 4 [format %.3f [expr {[lindex $_(m) 2] / ([llength $_(itcnt)] * $_(reptime) / 1000.0)}]] puts $_(m) puts "Average:" lset _(m) 0 [format %.6f [expr {[lindex $_(m) 0] / [llength $_(itcnt)]}]] @@ -95,6 +95,74 @@ proc _test_run {reptime lst {outcmd {puts $_(r)}}} { _test_out_total } +proc test-format {{reptime 1000}} { + _test_run $reptime { + # Format : date only (in gmt) + {clock format 1482525936 -format "%Y-%m-%d" -gmt 1} + # Format : date only (system zone) + {clock format 1482525936 -format "%Y-%m-%d"} + # Format : date only (CEST) + {clock format 1482525936 -format "%Y-%m-%d" -timezone :CET} + # Format : time only (in gmt) + {clock format 1482525936 -format "%H:%M" -gmt 1} + # Format : time only (system zone) + {clock format 1482525936 -format "%H:%M"} + # Format : time only (CEST) + {clock format 1482525936 -format "%H:%M" -timezone :CET} + # Format : time only (in gmt) + {clock format 1482525936 -format "%H:%M:%S" -gmt 1} + # Format : time only (system zone) + {clock format 1482525936 -format "%H:%M:%S"} + # Format : time only (CEST) + {clock format 1482525936 -format "%H:%M:%S" -timezone :CET} + # Format : default (in gmt) + {clock format 1482525936 -gmt 1} + # Format : default (system zone) + {clock format 1482525936} + # Format : default (CEST) + {clock format 1482525936 -timezone :CET} + # Format : ISO date-time (in gmt, numeric zone) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1} + # Format : ISO date-time (system zone, CEST, numeric zone) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z"} + # Format : ISO date-time (CEST, numeric zone) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z" -timezone :CET} + # Format : ISO date-time (system zone, CEST) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %Z"} + # Format : julian day with time (in gmt): + {clock format 1246379415 -format "%J %H:%M:%S" -gmt 1} + # Format : julian day with time (system zone): + {clock format 1246379415 -format "%J %H:%M:%S"} + + # Format : locale date-time (en): + {clock format 1246379415 -format "%x %X" -locale en} + # Format : locale date-time (de): + {clock format 1246379415 -format "%x %X" -locale de} + + # Format : locale lookup table month: + {clock format 1246379400 -format "%b" -locale en -gmt 1} + # Format : locale lookup 2 tables - month and day: + {clock format 1246379400 -format "%b %Od" -locale en -gmt 1} + + # Format : dynamic clock value (without converter caches): + {set i 0; continue} + {clock format [incr i] -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1} + {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1]\n; continue} + # Format : dynamic clock value (without any converter caches, zone range overflow): + {set i 0; continue} + {clock format [incr i 86400] -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1} + {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1]\n; continue} + + # Format : dynamic format (cacheable) + {clock format 1246379415 -format [string trim "%d.%m.%Y %H:%M:%S "] -gmt 1} + + # Format : all (in gmt, locale en) + {clock format 1482525936 -format "%%a = %a | %%A = %A | %%b = %b | %%h = %h | %%B = %B | %%C = %C | %%d = %d | %%e = %e | %%g = %g | %%G = %G | %%H = %H | %%I = %I | %%j = %j | %%J = %J | %%k = %k | %%l = %l | %%m = %m | %%M = %M | %%N = %N | %%p = %p | %%P = %P | %%Q = %Q | %%s = %s | %%S = %S | %%t = %t | %%u = %u | %%U = %U | %%V = %V | %%w = %w | %%W = %W | %%y = %y | %%Y = %Y | %%z = %z | %%Z = %Z | %%n = %n | %%EE = %EE | %%EC = %EC | %%Ey = %Ey | %%n = %n | %%Od = %Od | %%Oe = %Oe | %%OH = %OH | %%Ok = %Ok | %%OI = %OI | %%Ol = %Ol | %%Om = %Om | %%OM = %OM | %%OS = %OS | %%Ou = %Ou | %%Ow = %Ow | %%Oy = %Oy" -gmt 1 -locale en} + # Format : all (in CET, locale de) + {clock format 1482525936 -format "%%a = %a | %%A = %A | %%b = %b | %%h = %h | %%B = %B | %%C = %C | %%d = %d | %%e = %e | %%g = %g | %%G = %G | %%H = %H | %%I = %I | %%j = %j | %%J = %J | %%k = %k | %%l = %l | %%m = %m | %%M = %M | %%N = %N | %%p = %p | %%P = %P | %%Q = %Q | %%s = %s | %%S = %S | %%t = %t | %%u = %u | %%U = %U | %%V = %V | %%w = %w | %%W = %W | %%y = %y | %%Y = %Y | %%z = %z | %%Z = %Z | %%n = %n | %%EE = %EE | %%EC = %EC | %%Ey = %Ey | %%n = %n | %%Od = %Od | %%Oe = %Oe | %%OH = %OH | %%Ok = %Ok | %%OI = %OI | %%Ol = %Ol | %%Om = %Om | %%OM = %OM | %%OS = %OS | %%Ou = %Ou | %%Ow = %Ow | %%Oy = %Oy" -timezone :CET -locale de} + } +} + proc test-scan {{reptime 1000}} { _test_run $reptime { # Scan : date (in gmt) @@ -146,7 +214,7 @@ proc test-scan {{reptime 1000}} { # Scan : century, lookup table month {clock scan {1970 Jan 2} -format {%C%y %b %d} -locale en -gmt 1} # Scan : century, lookup table month and day (both entries are first) - {clock scan {1970 Jan 02} -format {%C%y %b %Od} -locale en -gmt 1} + {clock scan {1970 Jan 01} -format {%C%y %b %Od} -locale en -gmt 1} # Scan : century, lookup table month and day (list scan: entries with position 12 / 31) {clock scan {2016 Dec 31} -format {%C%y %b %Od} -locale en -gmt 1} @@ -235,8 +303,9 @@ proc test-other {{reptime 1000}} { proc test {{reptime 1000}} { puts "" + test-format $reptime test-scan $reptime - #test-freescan $reptime + test-freescan $reptime test-other $reptime puts \n**OK** -- cgit v0.12 From c97ddc73f6481193801401514372fb3df1993939 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:44:30 +0000 Subject: several missing scan tokens added, test cases extended and fixed; token "%s" used for seconds only (time zone independent), additionally "%Es" token added for local seconds (zone dependent seconds); --- generic/tclClock.c | 16 ++--- generic/tclClockFmt.c | 174 ++++++++++++++++++++++++++++++++++++++++---------- generic/tclDate.h | 16 ++++- tests/clock.test | 49 +++++++++++++- 4 files changed, 208 insertions(+), 47 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 28a484f..a3a9332 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -87,8 +87,6 @@ static int ClockConfigureObjCmd(ClientData clientData, static void GetYearWeekDay(TclDateFields *, int); static void GetGregorianEraYearDay(TclDateFields *, int); static void GetMonthDay(TclDateFields *); -static void GetJulianDayFromEraYearWeekDay(TclDateFields *, int); -static void GetJulianDayFromEraYearMonthDay(TclDateFields *, int); static int WeekdayOnOrBefore(int, int); static int ClockClicksObjCmd( ClientData clientData, Tcl_Interp *interp, @@ -2266,7 +2264,7 @@ GetMonthDay( *---------------------------------------------------------------------- */ -static void +MODULE_SCOPE void GetJulianDayFromEraYearWeekDay( TclDateFields *fields, /* Date to convert */ int changeover) /* Julian Day Number of the Gregorian @@ -2319,7 +2317,7 @@ GetJulianDayFromEraYearWeekDay( *---------------------------------------------------------------------- */ -static void +MODULE_SCOPE void GetJulianDayFromEraYearMonthDay( TclDateFields *fields, /* Date to convert */ int changeover) /* Gregorian transition date as a Julian Day */ @@ -2415,7 +2413,7 @@ GetJulianDayFromEraYearMonthDay( *---------------------------------------------------------------------- */ -static void +MODULE_SCOPE void GetJulianDayFromEraYearDay( TclDateFields *fields, /* Date to convert */ int changeover) /* Gregorian transition date as a Julian Day */ @@ -3169,9 +3167,11 @@ ClockScanObjCmd( + ( yySeconds % SECONDS_PER_DAY ); } - if (ConvertLocalToUTC(clientData, interp, &yydate, opts.timezoneObj, - GREGORIAN_CHANGE_DATE) != TCL_OK) { - goto done; + if (info->flags & (CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY|CLF_LOCALSEC)) { + if (ConvertLocalToUTC(clientData, interp, &yydate, opts.timezoneObj, + GREGORIAN_CHANGE_DATE) != TCL_OK) { + goto done; + } } /* Increment UTC seconds with relative time */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 55e328c..7a6fa0b 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -50,7 +50,7 @@ _str2int( int sign) { register time_t val = 0, prev = 0; - if (sign > 0) { + if (sign >= 0) { while (p < e) { val = val * 10 + (*p++ - '0'); if (val < prev) { @@ -80,7 +80,7 @@ _str2wideInt( int sign) { register Tcl_WideInt val = 0, prev = 0; - if (sign > 0) { + if (sign >= 0) { while (p < e) { val = val * 10 + (*p++ - '0'); if (val < prev) { @@ -1296,13 +1296,91 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } +static int +ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int minLen, maxLen; + register const char *p = yyInput, *end; const char *s; + time_t year, fractYear, fractDayDiv, fractDay; + static const char *stardatePref = "stardate "; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + end = yyInput + maxLen; + + /* stardate string */ + p = TclUtfFindEqualNCInLwr(p, end, stardatePref, stardatePref + 9, &s); + if (p >= end || p - yyInput < 9) { + return TCL_RETURN; + } + /* bypass spaces */ + while (p < end && isspace(UCHAR(*p))) { + p++; + } + if (p >= end) { + return TCL_RETURN; + } + /* currently positive stardate only */ + if (*p == '+') { p++; }; + s = p; + while (p < end && isdigit(UCHAR(*p))) { + p++; + } + if (p >= end || p - s < 4) { + return TCL_RETURN; + } + if ( _str2int(&year, s, p-3, 1) != TCL_OK + || _str2int(&fractYear, p-3, p, 1) != TCL_OK) { + return TCL_RETURN; + }; + if (*p++ != '.') { + return TCL_RETURN; + } + s = p; + fractDayDiv = 1; + while (p < end && isdigit(UCHAR(*p))) { + fractDayDiv *= 10; + p++; + } + if ( _str2int(&fractDay, s, p, 1) != TCL_OK) { + return TCL_RETURN; + }; + yyInput = p; + + /* Build a date from year and fraction. */ + + yydate.year = year + RODDENBERRY; + yydate.era = CE; + yydate.gregorian = 1; + + if (IsGregorianLeapYear(&yydate)) { + fractYear *= 366; + } else { + fractYear *= 365; + } + yydate.dayOfYear = fractYear / 1000 + 1; + if (fractYear % 1000 >= 500) { + yydate.dayOfYear++; + } + + GetJulianDayFromEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); + + yydate.seconds = + -210866803200L + + ( SECONDS_PER_DAY * (Tcl_WideInt)yydate.julianDay ) + + ( SECONDS_PER_DAY * fractDay / fractDayDiv ); + + return TCL_OK; +} + static const char *ScnSTokenMapIndex = - "dmbyYHMSpJjCgGVazs"; + "dmbyYHMSpJjCgGVazUsntQ"; static ClockScanTokenMap ScnSTokenMap[] = { /* %d %e */ {CTOKT_DIGIT, CLF_DAYOFMONTH, 0, 1, 2, TclOffset(DateInfo, date.dayOfMonth), NULL}, - /* %m */ + /* %m %N */ {CTOKT_DIGIT, CLF_MONTH, 0, 1, 2, TclOffset(DateInfo, date.month), NULL}, /* %b %B %h */ @@ -1350,17 +1428,27 @@ static ClockScanTokenMap ScnSTokenMap[] = { /* %z %Z */ {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0, 0, ClockScnToken_TimeZone_Proc, NULL}, + /* %U %W */ + {CTOKT_DIGIT, CLF_OPTIONAL, 0, 1, 2, 0, /* currently no capture, parse only token */ + NULL}, /* %s */ - {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), + {CTOKT_DIGIT, CLF_POSIXSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.seconds), NULL}, + /* %n */ + {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\n"}, + /* %t */ + {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\t"}, + /* %Q */ + {CTOKT_PARSER, CLF_POSIXSEC, 0, 16, 30, 0, + ClockScnToken_StarDate_Proc, NULL}, }; static const char *ScnSTokenMapAliasIndex[2] = { - "eNBhkIlPAuwZ", - "dmbbHHHpaaaz" + "eNBhkIlPAuwZW", + "dmbbHHHpaaazU" }; static const char *ScnETokenMapIndex = - "Ey"; + "Eys"; static ClockScanTokenMap ScnETokenMap[] = { /* %EE */ {CTOKT_PARSER, 0, 0, 0, 0, TclOffset(DateInfo, date.year), @@ -1368,6 +1456,9 @@ static ClockScanTokenMap ScnETokenMap[] = { /* %Ey */ {CTOKT_PARSER, 0, 0, 0, 0, 0, /* currently no capture, parse only token */ ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Es */ + {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), + NULL}, }; static const char *ScnETokenMapAliasIndex[2] = { "", @@ -1427,7 +1518,10 @@ EstimateTokenCount( /* estimate token count by % char and format length */ tokcnt = 0; while (p <= end) { - if (*p++ == '%') tokcnt++; + if (*p++ == '%') { + tokcnt++; + p++; + } } p = fmt + tokcnt * 2; if (p < end) { @@ -1653,7 +1747,9 @@ ClockScan( map = tok->map; /* bypass spaces at begin of input before parsing each token */ if ( !(opts->flags & CLF_STRICT) - && (map->type != CTOKT_SPACE && map->type != CTOKT_WORD) + && ( map->type != CTOKT_SPACE + && map->type != CTOKT_WORD + && map->type != CTOKT_CHAR ) ) { while (p < end && isspace(UCHAR(*p))) { p++; @@ -1710,27 +1806,28 @@ ClockScan( if (size < map->minSize) { /* missing input -> error */ if ((map->flags & CLF_OPTIONAL)) { - yyInput = p; continue; } goto not_match; } /* string 2 number, put number into info structure by offset */ - p = yyInput; x = p + size; - if (!(map->flags & CLF_LOCALSEC)) { - if (_str2int((time_t *)(((char *)info) + map->offs), - p, x, sign) != TCL_OK) { - goto overflow; - } - p = x; - } else { - if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), - p, x, sign) != TCL_OK) { - goto overflow; + if (map->offs) { + p = yyInput; x = p + size; + if (!(map->flags & (CLF_LOCALSEC|CLF_POSIXSEC))) { + if (_str2int((time_t *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; + } else { + if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; } - p = x; + flags = (flags & ~map->clearFlags) | map->flags; } - flags = (flags & ~map->clearFlags) | map->flags; } break; case CTOKT_PARSER: @@ -1771,7 +1868,14 @@ ClockScan( goto not_match; } p = x; - continue; + break; + case CTOKT_CHAR: + x = (char *)map->data; + if (*x != *p) { + /* no match -> error */ + goto not_match; + } + p++; break; } } @@ -1802,7 +1906,7 @@ ClockScan( */ /* seconds token (%s) take precedence over all other tokens */ - if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) { + if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_POSIXSEC)) { if (flags & CLF_DATE) { if (!(flags & CLF_JULIANDAY)) { @@ -1876,7 +1980,7 @@ ClockScan( } /* if no time - reset time */ - if (!(flags & (CLF_TIME|CLF_LOCALSEC))) { + if (!(flags & (CLF_TIME|CLF_LOCALSEC|CLF_POSIXSEC))) { info->flags |= CLF_ASSEMBLE_SECONDS; yydate.localSeconds = 0; } @@ -1886,7 +1990,7 @@ ClockScan( yySeconds = ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian); } else - if (!(flags & CLF_LOCALSEC)) { + if (!(flags & (CLF_LOCALSEC|CLF_POSIXSEC))) { info->flags |= CLF_ASSEMBLE_SECONDS; yySeconds = yydate.localSeconds % SECONDS_PER_DAY; } @@ -1996,7 +2100,7 @@ ClockFmtToken_StarDate_Proc( } /* Put together the StarDate as "Stardate %02d%03d.%1d" */ - if (FrmResultAllocate(dateFmt, 20) != TCL_OK) { return TCL_ERROR; }; + if (FrmResultAllocate(dateFmt, 30) != TCL_OK) { return TCL_ERROR; }; memcpy(dateFmt->output, "Stardate ", 9); dateFmt->output += 9; dateFmt->output = _itoaw(dateFmt->output, @@ -2005,7 +2109,7 @@ ClockFmtToken_StarDate_Proc( fractYear, '0', 3); *dateFmt->output++ = '.'; dateFmt->output = _itoaw(dateFmt->output, - dateFmt->date.localSeconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); + dateFmt->date.seconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); return TCL_OK; } @@ -2249,9 +2353,9 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %s */ {CFMTT_WIDE, "0", 1, 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, /* %n */ - {CFMTT_CHAR, "\n", 0, 0, 0, 0, 0, NULL}, + {CTOKT_CHAR, "\n", 0, 0, 0, 0, 0, NULL}, /* %t */ - {CFMTT_CHAR, "\t", 0, 0, 0, 0, 0, NULL}, + {CTOKT_CHAR, "\t", 0, 0, 0, 0, 0, NULL}, /* %Q */ {CFMTT_INT, NULL, 0, 0, 0, 0, 0, ClockFmtToken_StarDate_Proc, NULL}, @@ -2262,7 +2366,7 @@ static const char *FmtSTokenMapAliasIndex[2] = { }; static const char *FmtETokenMapIndex = - "Ey"; + "Eys"; static ClockFormatTokenMap FmtETokenMap[] = { /* %EE */ {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.era), @@ -2270,6 +2374,8 @@ static ClockFormatTokenMap FmtETokenMap[] = { /* %Ey %EC */ {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.year), ClockFmtToken_LocaleERAYear_Proc, NULL}, + /* %Es */ + {CFMTT_WIDE, "0", 1, 0, 0, 0, TclOffset(DateFormat, date.localSeconds), NULL}, }; static const char *FmtETokenMapAliasIndex[2] = { "C", @@ -2537,7 +2643,7 @@ ClockFormat( } } break; - case CFMTT_CHAR: + case CTOKT_CHAR: if (FrmResultAllocate(dateFmt, 1) != TCL_OK) { goto error; }; *dateFmt->output++ = *map->tostr; break; diff --git a/generic/tclDate.h b/generic/tclDate.h index 7c68b2a..2ce629d 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -33,9 +33,10 @@ #define CLF_OPTIONAL (1 << 0) /* token is non mandatory */ +#define CLF_POSIXSEC (1 << 1) +#define CLF_LOCALSEC (1 << 2) #define CLF_JULIANDAY (1 << 3) #define CLF_TIME (1 << 4) -#define CLF_LOCALSEC (1 << 5) #define CLF_CENTURY (1 << 6) #define CLF_DAYOFMONTH (1 << 7) #define CLF_DAYOFYEAR (1 << 8) @@ -355,8 +356,8 @@ typedef int ClockScanTokenProc( typedef enum _CLCKTOK_TYPE { - CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD, - CFMTT_INT, CFMTT_WIDE, CFMTT_CHAR, CFMTT_PROC + CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD, CTOKT_CHAR, + CFMTT_INT, CFMTT_WIDE, CFMTT_PROC } CLCKTOK_TYPE; typedef struct ClockScanTokenMap { @@ -449,6 +450,15 @@ typedef struct ClockFmtScnStorage { MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian); MODULE_SCOPE int IsGregorianLeapYear(TclDateFields *); +MODULE_SCOPE void + GetJulianDayFromEraYearWeekDay( + TclDateFields *fields, int changeover); +MODULE_SCOPE void + GetJulianDayFromEraYearMonthDay( + TclDateFields *fields, int changeover); +MODULE_SCOPE void + GetJulianDayFromEraYearDay( + TclDateFields *fields, int changeover); MODULE_SCOPE int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, TclDateFields *, Tcl_Obj *timezoneObj, int); MODULE_SCOPE Tcl_Obj * diff --git a/tests/clock.test b/tests/clock.test index b27d2a3..4b0587a 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18605,6 +18605,40 @@ test clock-6.19 {no token parsing} { [catch { clock scan "...%..." -format "...%%..." }] } {0 0} +test clock-6.20 {special char tokens %n, %t} { + clock scan "30\t06\t2009\n18\t30" -format "%d%t%m%t%Y%n%H%t%M" -gmt 1 +} 1246386600 + +# Hi, Jeff! +test clock-6.21.0 {Stardate 0 day} { + list [set d [clock format -757382400 -format "%Q" -gmt 1]] \ + [clock scan $d -format "%Q" -gmt 1] +} [list "Stardate 00000.0" -757382400] +test clock-6.21.1 {Stardate} { + list [set d [clock format 1482857280 -format "%Q" -gmt 1]] \ + [clock scan $d -format "%Q" -gmt 1] +} [list "Stardate 70986.7" 1482857280] +test clock-6.21.2 {Stardate next time} { + list [set d [clock format 1482865920 -format "%Q" -gmt 1]] \ + [clock scan $d -format "%Q" -gmt 1] +} [list "Stardate 70986.8" 1482865920] +test clock-6.21.3 {Stardate correct scan over year (leap year, begin, middle and end of the year)} -body { + set s [clock scan "01.01.2016" -f "%d.%m.%Y" -g 1] + set s [set i [clock scan [clock format $s -f "%Q" -g 1] -g 1]] + set wrong {} + while {[incr i 86400] < $s + 86400*366*2} { + set d [clock format $i -f "%Q" -g 1] + set i2 [clock scan $d -f "%Q" -g 1] + if {$i != $i2} { + lappend wrong "$d -- ($i != $i2) -- [clock format $i -g 1]" + } + } + join $wrong \n +} -result {} -cleanup { + unset -nocomplain wrong i i2 s d +} + + test clock-7.1 {Julian Day} { clock scan 0 -format %J -gmt true } -210866803200 @@ -36080,10 +36114,21 @@ test clock-37.1 {%s gmt testing} { set s [clock seconds] set a [clock format $s -format %s -gmt 0] set b [clock format $s -format %s -gmt 1] + set c [clock scan $s -format %s -gmt 0] + set d [clock scan $s -format %s -gmt 1] # %s, being the difference between local and Greenwich, does not # depend on the time zone. - set c [expr {$b-$a}] -} {0} + list [expr {$b-$a}] [expr {$d-$c}] +} {0 0} +test clock-37.2 {%Es gmt testing} { + set s [clock seconds] + set a [clock format $s -format %Es -timezone CET] + set b [clock format $s -format %Es -gmt 1] + set c [clock scan $s -format %Es -timezone CET] + set d [clock scan $s -format %Es -gmt 1] + # %Es depend on the time zone (local seconds instead of posix seconds). + list [expr {$b-$a}] [expr {$d-$c}] +} {-3600 3600} test clock-38.1 {regression - convertUTCToLocalViaC - east of Greenwich} \ -setup { -- cgit v0.12 From 4600d7c02647505afea5e1fdb0f3ae09ec0a8084 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:44:55 +0000 Subject: performance test cases ready --- tests-perf/clock.perf.tcl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 043d27f..34d9429 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -97,6 +97,12 @@ proc _test_run {reptime lst {outcmd {puts $_(r)}}} { proc test-format {{reptime 1000}} { _test_run $reptime { + # Format : short, week only (in gmt) + {clock format 1482525936 -format "%u" -gmt 1} + # Format : short, week only (system zone) + {clock format 1482525936 -format "%u"} + # Format : short, week only (CEST) + {clock format 1482525936 -format "%u" -timezone :CET} # Format : date only (in gmt) {clock format 1482525936 -format "%Y-%m-%d" -gmt 1} # Format : date only (system zone) @@ -229,12 +235,6 @@ proc test-scan {{reptime 1000}} { {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} break - - # Scan : zone only - {clock scan "CET" -format "%z"} - {clock scan "EST" -format "%z"} - {**STOP** : Wed Nov 25 01:00:00 CET 2015} - # # Scan : long format test (allock chain) # {clock scan "25.11.2015" -format "%d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y" -base 0 -gmt 1} # # Scan : dynamic, very long format test (create obj representation, allock chain, GC, etc): @@ -293,7 +293,6 @@ proc test-other {{reptime 1000}} { # Scan : julian day (overflow) {catch {clock scan 5373485 -format %J}} - **STOP** # Scan : test rotate of GC objects (format is dynamic, so tcl-obj removed with last reference) {set i 0; time { clock scan "[incr i] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} # Scan : test reusability of GC objects (format is dynamic, so tcl-obj removed with last reference) -- cgit v0.12 From 7a654297a08c44ecc24062e08b31343ffddd2bd6 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:45:29 +0000 Subject: small code review, performance test cases ready. --- generic/tclClock.c | 2 +- generic/tclClockFmt.c | 6 +++--- tests-perf/clock.perf.tcl | 32 ++++++++++++++++++++------------ 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a3a9332..7d4263c 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -3488,7 +3488,7 @@ ClockSecondsObjCmd( /* *---------------------------------------------------------------------- * - * TzsetIfNecessary -- + * TzsetGetEpoch --, TzsetIfNecessary -- * * Calls the tzset() library function if the contents of the TZ * environment variable has changed. diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 7a6fa0b..307fc28 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1366,7 +1366,7 @@ ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, GetJulianDayFromEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); - yydate.seconds = + yydate.localSeconds = -210866803200L + ( SECONDS_PER_DAY * (Tcl_WideInt)yydate.julianDay ) + ( SECONDS_PER_DAY * fractDay / fractDayDiv ); @@ -1439,7 +1439,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { /* %t */ {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\t"}, /* %Q */ - {CTOKT_PARSER, CLF_POSIXSEC, 0, 16, 30, 0, + {CTOKT_PARSER, CLF_LOCALSEC, 0, 16, 30, 0, ClockScnToken_StarDate_Proc, NULL}, }; static const char *ScnSTokenMapAliasIndex[2] = { @@ -2109,7 +2109,7 @@ ClockFmtToken_StarDate_Proc( fractYear, '0', 3); *dateFmt->output++ = '.'; dateFmt->output = _itoaw(dateFmt->output, - dateFmt->date.seconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); + dateFmt->date.localSeconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); return TCL_OK; } diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 34d9429..f3b8a10 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -32,7 +32,7 @@ proc {**STOP**} {args} { } proc _test_get_commands {lst} { - regsub -all {(?:^|\n)[ \t]*(\#[^\n]*)(?=\n\s*[\{\#])} $lst "\n{\\1}" + regsub -all {(?:^|\n)[ \t]*(\#[^\n]*|\msetup\M[^\n]*|\mcleanup\M[^\n]*)(?=\n\s*(?:[\{\#]|setup|cleanup))} $lst "\n{\\1}" } proc _test_out_total {} { @@ -83,7 +83,11 @@ proc _test_run {reptime lst {outcmd {puts $_(r)}}} { foreach _(c) [_test_get_commands $lst] { puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" - if {[regexp {\s*\#} $_(c)]} continue + if {[regexp {^\s*\#} $_(c)]} continue + if {[regexp {^\s*(?:setup|cleanup)\s+} $_(c)]} { + puts [if 1 [lindex $_(c) 1]] + continue + } set _(r) [if 1 $_(c)] if {$outcmd ne {}} $outcmd puts [set _(m) [timerate $_(c) $reptime]] @@ -122,11 +126,11 @@ proc test-format {{reptime 1000}} { # Format : time only (CEST) {clock format 1482525936 -format "%H:%M:%S" -timezone :CET} # Format : default (in gmt) - {clock format 1482525936 -gmt 1} + {clock format 1482525936 -gmt 1 -locale en} # Format : default (system zone) - {clock format 1482525936} + {clock format 1482525936 -locale en} # Format : default (CEST) - {clock format 1482525936 -timezone :CET} + {clock format 1482525936 -timezone :CET -locale en} # Format : ISO date-time (in gmt, numeric zone) {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1} # Format : ISO date-time (system zone, CEST, numeric zone) @@ -149,15 +153,19 @@ proc test-format {{reptime 1000}} { {clock format 1246379400 -format "%b" -locale en -gmt 1} # Format : locale lookup 2 tables - month and day: {clock format 1246379400 -format "%b %Od" -locale en -gmt 1} + # Format : locale lookup 3 tables - week, month and day: + {clock format 1246379400 -format "%a %b %Od" -locale en -gmt 1} + # Format : locale lookup 4 tables - week, month, day and year: + {clock format 1246379400 -format "%a %b %Od %Oy" -locale en -gmt 1} # Format : dynamic clock value (without converter caches): - {set i 0; continue} - {clock format [incr i] -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1} - {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1]\n; continue} + setup {set i 0} + {clock format [incr i] -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET} + cleanup {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET]} # Format : dynamic clock value (without any converter caches, zone range overflow): - {set i 0; continue} - {clock format [incr i 86400] -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1} - {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -gmt 1]\n; continue} + setup {set i 0} + {clock format [incr i 86400] -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET} + cleanup {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET]} # Format : dynamic format (cacheable) {clock format 1246379415 -format [string trim "%d.%m.%Y %H:%M:%S "] -gmt 1} @@ -310,4 +318,4 @@ proc test {{reptime 1000}} { puts \n**OK** } -test 100; # ms +test 500; # ms -- cgit v0.12 From 941e45f9078176fa27d4d7b627b2c4e1c6642d06 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:45:59 +0000 Subject: clock.tcl: clean unused resp. obsolete commands --- library/clock.tcl | 2578 +++++------------------------------------------------ library/init.tcl | 2 +- 2 files changed, 213 insertions(+), 2367 deletions(-) diff --git a/library/clock.tcl b/library/clock.tcl index 06aa10a..3caa270 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -389,152 +389,6 @@ proc ::tcl::clock::Initialize {} { {46800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Tongatapu }] - # Groups of fields that specify the date, priorities, and code bursts that - # determine Julian Day Number given those groups. The code in [clock - # scan] will choose the highest priority (lowest numbered) set of fields - # that determines the date. - - variable DateParseActions { - - { seconds } 0 {} - - { julianDay } 1 {} - - { era century yearOfCentury month dayOfMonth } 2 { - dict set date year [expr { 100 * [dict get $date century] - + [dict get $date yearOfCentury] }] - set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ - $changeover] - } - { era century yearOfCentury dayOfYear } 2 { - dict set date year [expr { 100 * [dict get $date century] - + [dict get $date yearOfCentury] }] - set date [GetJulianDayFromEraYearDay $date[set date {}] \ - $changeover] - } - - { century yearOfCentury month dayOfMonth } 3 { - dict set date era CE - dict set date year [expr { 100 * [dict get $date century] - + [dict get $date yearOfCentury] }] - set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ - $changeover] - } - { century yearOfCentury dayOfYear } 3 { - dict set date era CE - dict set date year [expr { 100 * [dict get $date century] - + [dict get $date yearOfCentury] }] - set date [GetJulianDayFromEraYearDay $date[set date {}] \ - $changeover] - } - { iso8601Century iso8601YearOfCentury iso8601Week dayOfWeek } 3 { - dict set date era CE - dict set date iso8601Year \ - [expr { 100 * [dict get $date iso8601Century] - + [dict get $date iso8601YearOfCentury] }] - set date [GetJulianDayFromEraYearWeekDay $date[set date {}] \ - $changeover] - } - - { yearOfCentury month dayOfMonth } 4 { - set date [InterpretTwoDigitYear $date[set date {}] $baseTime] - dict set date era CE - set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ - $changeover] - } - { yearOfCentury dayOfYear } 4 { - set date [InterpretTwoDigitYear $date[set date {}] $baseTime] - dict set date era CE - set date [GetJulianDayFromEraYearDay $date[set date {}] \ - $changeover] - } - { iso8601YearOfCentury iso8601Week dayOfWeek } 4 { - set date [InterpretTwoDigitYear \ - $date[set date {}] $baseTime \ - iso8601YearOfCentury iso8601Year] - dict set date era CE - set date [GetJulianDayFromEraYearWeekDay $date[set date {}] \ - $changeover] - } - - { month dayOfMonth } 5 { - set date [AssignBaseYear $date[set date {}] \ - $baseTime $timeZone $changeover] - set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ - $changeover] - } - { dayOfYear } 5 { - set date [AssignBaseYear $date[set date {}] \ - $baseTime $timeZone $changeover] - set date [GetJulianDayFromEraYearDay $date[set date {}] \ - $changeover] - } - { iso8601Week dayOfWeek } 5 { - set date [AssignBaseIso8601Year $date[set date {}] \ - $baseTime $timeZone $changeover] - set date [GetJulianDayFromEraYearWeekDay $date[set date {}] \ - $changeover] - } - - { dayOfMonth } 6 { - set date [AssignBaseMonth $date[set date {}] \ - $baseTime $timeZone $changeover] - set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ - $changeover] - } - - { dayOfWeek } 7 { - set date [AssignBaseWeek $date[set date {}] \ - $baseTime $timeZone $changeover] - set date [GetJulianDayFromEraYearWeekDay $date[set date {}] \ - $changeover] - } - - {} 8 { - set date [AssignBaseJulianDay $date[set date {}] \ - $baseTime $timeZone $changeover] - } - } - - # Groups of fields that specify time of day, priorities, and code that - # processes them - - variable TimeParseActions { - - seconds 1 {} - - { hourAMPM minute second amPmIndicator } 2 { - dict set date secondOfDay [InterpretHMSP $date] - } - { hour minute second } 2 { - dict set date secondOfDay [InterpretHMS $date] - } - - { hourAMPM minute amPmIndicator } 3 { - dict set date second 0 - dict set date secondOfDay [InterpretHMSP $date] - } - { hour minute } 3 { - dict set date second 0 - dict set date secondOfDay [InterpretHMS $date] - } - - { hourAMPM amPmIndicator } 4 { - dict set date minute 0 - dict set date second 0 - dict set date secondOfDay [InterpretHMSP $date] - } - { hour } 4 { - dict set date minute 0 - dict set date second 0 - dict set date secondOfDay [InterpretHMS $date] - } - - { } 5 { - dict set date secondOfDay 0 - } - } - # Legacy time zones, used primarily for parsing RFC822 dates. variable LegacyTimeZone [dict create \ @@ -667,2169 +521,281 @@ proc mcget {locale args} { #---------------------------------------------------------------------- # -# clock format -- -# -# Formats a count of seconds since the Posix Epoch as a time of day. -# -# The 'clock format' command formats times of day for output. Refer to the -# user documentation to see what it does. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::__org_format { args } { - - variable FormatProc - variable TZData - - lassign [ParseFormatArgs {*}$args] format locale timezone - set locale [string tolower $locale] - set clockval [lindex $args 0] - - # Build a procedure to format the result. Cache the built procedure's name - # in the 'FormatProc' array to avoid losing its internal representation, - # which contains the name resolution. - - set procName formatproc'$format'$locale - set procName [namespace current]::[string map {: {\:} \\ {\\}} $procName] - if {[info exists FormatProc($procName)]} { - set procName $FormatProc($procName) - } else { - set FormatProc($procName) \ - [ParseClockFormatFormat $procName $format $locale] - } - - return [$procName $clockval $timezone] - -} - -#---------------------------------------------------------------------- -# -# ParseClockFormatFormat -- -# -# Builds and caches a procedure that formats a time value. -# -# Parameters: -# format -- Format string to use -# locale -- Locale in which the format string is to be interpreted -# -# Results: -# Returns the name of the newly-built procedure. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::ParseClockFormatFormat {procName format locale} { - - if {[namespace which $procName] ne {}} { - return $procName - } - - # Map away the locale-dependent composite format groups - - set locale [EnterLocale $locale] - - # Change locale if a fresh locale has been given on the command line. - - try { - return [ParseClockFormatFormat2 $format $locale $procName] - } trap CLOCK {result opts} { - dict unset opts -errorinfo - return -options $opts $result - } -} - -proc ::tcl::clock::ParseClockFormatFormat2 {format locale procName} { - set didLocaleEra 0 - set didLocaleNumerals 0 - set preFormatCode \ - [string map [list @GREGORIAN_CHANGE_DATE@ \ - [mc GREGORIAN_CHANGE_DATE]] \ - { - variable TZData - set date [GetDateFields $clockval \ - $timezone \ - @GREGORIAN_CHANGE_DATE@] - }] - set formatString {} - set substituents {} - set state {} - - set format [LocalizeFormat $locale $format] - - foreach char [split $format {}] { - switch -exact -- $state { - {} { - if { [string equal % $char] } { - set state percent - } else { - append formatString $char - } - } - percent { # Character following a '%' character - set state {} - switch -exact -- $char { - % { # A literal character, '%' - append formatString %% - } - a { # Day of week, abbreviated - append formatString %s - append substituents \ - [string map \ - [list @DAYS_OF_WEEK_ABBREV@ \ - [list [mc DAYS_OF_WEEK_ABBREV]]] \ - { [lindex @DAYS_OF_WEEK_ABBREV@ \ - [expr {[dict get $date dayOfWeek] \ - % 7}]]}] - } - A { # Day of week, spelt out. - append formatString %s - append substituents \ - [string map \ - [list @DAYS_OF_WEEK_FULL@ \ - [list [mc DAYS_OF_WEEK_FULL]]] \ - { [lindex @DAYS_OF_WEEK_FULL@ \ - [expr {[dict get $date dayOfWeek] \ - % 7}]]}] - } - b - h { # Name of month, abbreviated. - append formatString %s - append substituents \ - [string map \ - [list @MONTHS_ABBREV@ \ - [list [mc MONTHS_ABBREV]]] \ - { [lindex @MONTHS_ABBREV@ \ - [expr {[dict get $date month]-1}]]}] - } - B { # Name of month, spelt out - append formatString %s - append substituents \ - [string map \ - [list @MONTHS_FULL@ \ - [list [mc MONTHS_FULL]]] \ - { [lindex @MONTHS_FULL@ \ - [expr {[dict get $date month]-1}]]}] - } - C { # Century number - append formatString %02d - append substituents \ - { [expr {[dict get $date year] / 100}]} - } - d { # Day of month, with leading zero - append formatString %02d - append substituents { [dict get $date dayOfMonth]} - } - e { # Day of month, without leading zero - append formatString %2d - append substituents { [dict get $date dayOfMonth]} - } - E { # Format group in a locale-dependent - # alternative era - set state percentE - if {!$didLocaleEra} { - append preFormatCode \ - [string map \ - [list @LOCALE_ERAS@ \ - [list [mc LOCALE_ERAS]]] \ - { - set date [GetLocaleEra \ - $date[set date {}] \ - @LOCALE_ERAS@]}] \n - set didLocaleEra 1 - } - if {!$didLocaleNumerals} { - append preFormatCode \ - [list set localeNumerals \ - [mc LOCALE_NUMERALS]] \n - set didLocaleNumerals 1 - } - } - g { # Two-digit year relative to ISO8601 - # week number - append formatString %02d - append substituents \ - { [expr { [dict get $date iso8601Year] % 100 }]} - } - G { # Four-digit year relative to ISO8601 - # week number - append formatString %02d - append substituents { [dict get $date iso8601Year]} - } - H { # Hour in the 24-hour day, leading zero - append formatString %02d - append substituents \ - { [expr { [dict get $date localSeconds] \ - / 3600 % 24}]} - } - I { # Hour AM/PM, with leading zero - append formatString %02d - append substituents \ - { [expr { ( ( ( [dict get $date localSeconds] \ - % 86400 ) \ - + 86400 \ - - 3600 ) \ - / 3600 ) \ - % 12 + 1 }] } - } - j { # Day of year (001-366) - append formatString %03d - append substituents { [dict get $date dayOfYear]} - } - J { # Julian Day Number - append formatString %07ld - append substituents { [dict get $date julianDay]} - } - k { # Hour (0-23), no leading zero - append formatString %2d - append substituents \ - { [expr { [dict get $date localSeconds] - / 3600 - % 24 }]} - } - l { # Hour (12-11), no leading zero - append formatString %2d - append substituents \ - { [expr { ( ( ( [dict get $date localSeconds] - % 86400 ) - + 86400 - - 3600 ) - / 3600 ) - % 12 + 1 }]} - } - m { # Month number, leading zero - append formatString %02d - append substituents { [dict get $date month]} - } - M { # Minute of the hour, leading zero - append formatString %02d - append substituents \ - { [expr { [dict get $date localSeconds] - / 60 - % 60 }]} - } - n { # A literal newline - append formatString \n - } - N { # Month number, no leading zero - append formatString %2d - append substituents { [dict get $date month]} - } - O { # A format group in the locale's - # alternative numerals - set state percentO - if {!$didLocaleNumerals} { - append preFormatCode \ - [list set localeNumerals \ - [mc LOCALE_NUMERALS]] \n - set didLocaleNumerals 1 - } - } - p { # Localized 'AM' or 'PM' indicator - # converted to uppercase - append formatString %s - append preFormatCode \ - [list set AM [string toupper [mc AM]]] \n \ - [list set PM [string toupper [mc PM]]] \n - append substituents \ - { [expr {(([dict get $date localSeconds] - % 86400) < 43200) ? - $AM : $PM}]} - } - P { # Localized 'AM' or 'PM' indicator - append formatString %s - append preFormatCode \ - [list set am [mc AM]] \n \ - [list set pm [mc PM]] \n - append substituents \ - { [expr {(([dict get $date localSeconds] - % 86400) < 43200) ? - $am : $pm}]} - - } - Q { # Hi, Jeff! - append formatString %s - append substituents { [FormatStarDate $date]} - } - s { # Seconds from the Posix Epoch - append formatString %s - append substituents { [dict get $date seconds]} - } - S { # Second of the minute, with - # leading zero - append formatString %02d - append substituents \ - { [expr { [dict get $date localSeconds] - % 60 }]} - } - t { # A literal tab character - append formatString \t - } - u { # Day of the week (1-Monday, 7-Sunday) - append formatString %1d - append substituents { [dict get $date dayOfWeek]} - } - U { # Week of the year (00-53). The - # first Sunday of the year is the - # first day of week 01 - append formatString %02d - append preFormatCode { - set dow [dict get $date dayOfWeek] - if { $dow == 7 } { - set dow 0 - } - incr dow - set UweekNumber \ - [expr { ( [dict get $date dayOfYear] - - $dow + 7 ) - / 7 }] - } - append substituents { $UweekNumber} - } - V { # The ISO8601 week number - append formatString %02d - append substituents { [dict get $date iso8601Week]} - } - w { # Day of the week (0-Sunday, - # 6-Saturday) - append formatString %1d - append substituents \ - { [expr { [dict get $date dayOfWeek] % 7 }]} - } - W { # Week of the year (00-53). The first - # Monday of the year is the first day - # of week 01. - append preFormatCode { - set WweekNumber \ - [expr { ( [dict get $date dayOfYear] - - [dict get $date dayOfWeek] - + 7 ) - / 7 }] - } - append formatString %02d - append substituents { $WweekNumber} - } - y { # The two-digit year of the century - append formatString %02d - append substituents \ - { [expr { [dict get $date year] % 100 }]} - } - Y { # The four-digit year - append formatString %04d - append substituents { [dict get $date year]} - } - z { # The time zone as hours and minutes - # east (+) or west (-) of Greenwich - append formatString %s - append substituents { [FormatNumericTimeZone \ - [dict get $date tzOffset]]} - } - Z { # The name of the time zone - append formatString %s - append substituents { [dict get $date tzName]} - } - % { # A literal percent character - append formatString %% - } - default { # An unknown escape sequence - append formatString %% $char - } - } - } - percentE { # Character following %E - set state {} - switch -exact -- $char { - E { - append formatString %s - append substituents { } \ - [string map \ - [list @BCE@ [list [mc BCE]] \ - @CE@ [list [mc CE]]] \ - {[dict get {BCE @BCE@ CE @CE@} \ - [dict get $date era]]}] - } - C { # Locale-dependent era - append formatString %s - append substituents { [dict get $date localeEra]} - } - y { # Locale-dependent year of the era - append preFormatCode { - set y [dict get $date localeYear] - if { $y >= 0 && $y < 100 } { - set Eyear [lindex $localeNumerals $y] - } else { - set Eyear $y - } - } - append formatString %s - append substituents { $Eyear} - } - default { # Unknown %E format group - append formatString %%E $char - } - } - } - percentO { # Character following %O - set state {} - switch -exact -- $char { - d - e { # Day of the month in alternative - # numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [dict get $date dayOfMonth]]} - } - H - k { # Hour of the day in alternative - # numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [expr { [dict get $date localSeconds] - / 3600 - % 24 }]]} - } - I - l { # Hour (12-11) AM/PM in alternative - # numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [expr { ( ( ( [dict get $date localSeconds] - % 86400 ) - + 86400 - - 3600 ) - / 3600 ) - % 12 + 1 }]]} - } - m { # Month number in alternative numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals [dict get $date month]]} - } - M { # Minute of the hour in alternative - # numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [expr { [dict get $date localSeconds] - / 60 - % 60 }]]} - } - S { # Second of the minute in alternative - # numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [expr { [dict get $date localSeconds] - % 60 }]]} - } - u { # Day of the week (Monday=1,Sunday=7) - # in alternative numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [dict get $date dayOfWeek]]} - } - w { # Day of the week (Sunday=0,Saturday=6) - # in alternative numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [expr { [dict get $date dayOfWeek] % 7 }]]} - } - y { # Year of the century in alternative - # numerals - append formatString %s - append substituents \ - { [lindex $localeNumerals \ - [expr { [dict get $date year] % 100 }]]} - } - default { # Unknown format group - append formatString %%O $char - } - } - } - } - } - - # Clean up any improperly terminated groups - - switch -exact -- $state { - percent { - append formatString %% - } - percentE { - append retval %%E - } - percentO { - append retval %%O - } - } - - proc $procName {clockval timezone} " - $preFormatCode - return \[::format [list $formatString] $substituents\] - " - - # puts [list $procName [info args $procName] [info body $procName]] - - return $procName -} - -#---------------------------------------------------------------------- -# -# clock scan -- -# -# Inputs a count of seconds since the Posix Epoch as a time of day. -# -# The 'clock format' command scans times of day on input. Refer to the user -# documentation to see what it does. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::__org_scan { args } { - - set format {} - - # Check the count of args - - if { [llength $args] < 1 || [llength $args] % 2 != 1 } { - set cmdName "clock scan" - return -code error \ - -errorcode [list CLOCK wrongNumArgs] \ - "wrong \# args: should be\ - \"$cmdName string\ - ?-base seconds?\ - ?-format string? ?-gmt boolean?\ - ?-locale LOCALE? ?-timezone ZONE?\"" - } - - # Set defaults - - set base [clock seconds] - set string [lindex $args 0] - set format {} - set gmt 0 - set locale c - if {[set timezone [configure -system-tz]] eq ""} { - set timezone [GetSystemTimeZone] - } - - # Pick up command line options. - - foreach { flag value } [lreplace $args 0 0] { - set saw($flag) {} - switch -exact -- $flag { - -b - -ba - -bas - -base { - set base $value - } - -f - -fo - -for - -form - -forma - -format { - set format $value - } - -g - -gm - -gmt { - set gmt $value - } - -l - -lo - -loc - -loca - -local - -locale { - set locale [string tolower $value] - } - -t - -ti - -tim - -time - -timez - -timezo - -timezon - -timezone { - set timezone $value - } - default { - return -code error \ - -errorcode [list CLOCK badOption $flag] \ - "bad option \"$flag\",\ - must be -base, -format, -gmt, -locale or -timezone" - } - } - } - - # Check options for validity - - if { [info exists saw(-gmt)] && [info exists saw(-timezone)] } { - return -code error \ - -errorcode [list CLOCK gmtWithTimezone] \ - "cannot use -gmt and -timezone in same call" - } - if { [catch { expr { wide($base) } } result] } { - return -code error "expected integer but got \"$base\"" - } - if { ![string is boolean -strict $gmt] } { - return -code error "expected boolean value but got \"$gmt\"" - } elseif { $gmt } { - set timezone :GMT - } - - # Change locale if a fresh locale has been given on the command line. - - EnterLocale $locale - - try { - # Map away the locale-dependent composite format groups - - set scanner [ParseClockScanFormat $format $locale] - return [$scanner $string $base $timezone] - } trap CLOCK {result opts} { - # Conceal location of generation of expected errors - dict unset opts -errorinfo - return -options $opts $result - } -} - -#---------------------------------------------------------------------- -# -# ParseClockScanFormat -- +# GetSystemLocale -- # -# Parses a format string given to [clock scan -format] +# Determines the system locale, which corresponds to "system" +# keyword for locale parameter of 'clock' command. # # Parameters: -# formatString - The format being parsed -# locale - The current locale +# None. # # Results: -# Constructs and returns a procedure that accepts the string being -# scanned, the base time, and the time zone. The procedure will either -# return the scanned time or else throw an error that should be rethrown -# to the caller of [clock scan] +# Returns the system locale. # # Side effects: -# The given procedure is defined in the ::tcl::clock namespace. Scan -# procedures are not deleted once installed. -# -# Why do we parse dates by defining a procedure to parse them? The reason is -# that by doing so, we have one convenient place to cache all the information: -# the regular expressions that match the patterns (which will be compiled), -# the code that assembles the date information, everything lands in one place. -# In this way, when a given format is reused at run time, all the information -# of how to apply it is available in a single place. +# None # #---------------------------------------------------------------------- -proc ::tcl::clock::ParseClockScanFormat {formatString locale} { - # Check whether the format has been parsed previously, and return the - # existing recognizer if it has. - - set procName scanproc'$formatString'$locale - set procName [namespace current]::[string map {: {\:} \\ {\\}} $procName] - if { [namespace which $procName] != {} } { - return $procName - } - - variable DateParseActions - variable TimeParseActions - - # Localize the %x, %X, etc. groups - - set formatString [LocalizeFormat $locale $formatString] - - # Condense whitespace - - regsub -all {[[:space:]]+} $formatString { } formatString - - # Walk through the groups of the format string. In this loop, we - # accumulate: - # - a regular expression that matches the string, - # - the count of capturing brackets in the regexp - # - a set of code that post-processes the fields captured by the regexp, - # - a dictionary whose keys are the names of fields that are present - # in the format string. - - set re {^[[:space:]]*} - set captureCount 0 - set postcode {} - set fieldSet [dict create] - set fieldCount 0 - set postSep {} - set state {} - - foreach c [split $formatString {}] { - switch -exact -- $state { - {} { - if { $c eq "%" } { - set state % - } elseif { $c eq " " } { - append re {[[:space:]]+} - } else { - if { ! [string is alnum $c] } { - append re "\\" - } - append re $c - } - } - % { - set state {} - switch -exact -- $c { - % { - append re % - } - { } { - append re "\[\[:space:\]\]*" - } - a - A { # Day of week, in words - set l {} - foreach \ - i {7 1 2 3 4 5 6} \ - abr [mc DAYS_OF_WEEK_ABBREV] \ - full [mc DAYS_OF_WEEK_FULL] { - dict set l [string tolower $abr] $i - dict set l [string tolower $full] $i - incr i - } - lassign [UniquePrefixRegexp $l] regex lookup - append re ( $regex ) - dict set fieldSet dayOfWeek [incr fieldCount] - append postcode "dict set date dayOfWeek \[" \ - "dict get " [list $lookup] " " \ - \[ {string tolower $field} [incr captureCount] \] \ - "\]\n" - } - b - B - h { # Name of month - set i 0 - set l {} - foreach \ - abr [mc MONTHS_ABBREV] \ - full [mc MONTHS_FULL] { - incr i - dict set l [string tolower $abr] $i - dict set l [string tolower $full] $i - } - lassign [UniquePrefixRegexp $l] regex lookup - append re ( $regex ) - dict set fieldSet month [incr fieldCount] - append postcode "dict set date month \[" \ - "dict get " [list $lookup] \ - " " \[ {string tolower $field} \ - [incr captureCount] \] \ - "\]\n" - } - C { # Gregorian century - append re \\s*(\\d\\d?) - dict set fieldSet century [incr fieldCount] - append postcode "dict set date century \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - d - e { # Day of month - append re \\s*(\\d\\d?) - dict set fieldSet dayOfMonth [incr fieldCount] - append postcode "dict set date dayOfMonth \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - E { # Prefix for locale-specific codes - set state %E - } - g { # ISO8601 2-digit year - append re \\s*(\\d\\d) - dict set fieldSet iso8601YearOfCentury \ - [incr fieldCount] - append postcode \ - "dict set date iso8601YearOfCentury \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - G { # ISO8601 4-digit year - append re \\s*(\\d\\d)(\\d\\d) - dict set fieldSet iso8601Century [incr fieldCount] - dict set fieldSet iso8601YearOfCentury \ - [incr fieldCount] - append postcode \ - "dict set date iso8601Century \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" \ - "dict set date iso8601YearOfCentury \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - H - k { # Hour of day - append re \\s*(\\d\\d?) - dict set fieldSet hour [incr fieldCount] - append postcode "dict set date hour \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - I - l { # Hour, AM/PM - append re \\s*(\\d\\d?) - dict set fieldSet hourAMPM [incr fieldCount] - append postcode "dict set date hourAMPM \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - j { # Day of year - append re \\s*(\\d\\d?\\d?) - dict set fieldSet dayOfYear [incr fieldCount] - append postcode "dict set date dayOfYear \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - J { # Julian Day Number - append re \\s*(\\d+) - dict set fieldSet julianDay [incr fieldCount] - append postcode "dict set date julianDay \[" \ - "::scan \$field" [incr captureCount] " %ld" \ - "\]\n" - } - m - N { # Month number - append re \\s*(\\d\\d?) - dict set fieldSet month [incr fieldCount] - append postcode "dict set date month \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - M { # Minute - append re \\s*(\\d\\d?) - dict set fieldSet minute [incr fieldCount] - append postcode "dict set date minute \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - n { # Literal newline - append re \\n - } - O { # Prefix for locale numerics - set state %O - } - p - P { # AM/PM indicator - set l [list [string tolower [mc AM]] 0 \ - [string tolower [mc PM]] 1] - lassign [UniquePrefixRegexp $l] regex lookup - append re ( $regex ) - dict set fieldSet amPmIndicator [incr fieldCount] - append postcode "dict set date amPmIndicator \[" \ - "dict get " [list $lookup] " \[string tolower " \ - "\$field" \ - [incr captureCount] \ - "\]\]\n" - } - Q { # Hi, Jeff! - append re {Stardate\s+([-+]?\d+)(\d\d\d)[.](\d)} - incr captureCount - dict set fieldSet seconds [incr fieldCount] - append postcode {dict set date seconds } \[ \ - {ParseStarDate $field} [incr captureCount] \ - { $field} [incr captureCount] \ - { $field} [incr captureCount] \ - \] \n - } - s { # Seconds from Posix Epoch - # This next case is insanely difficult, because it's - # problematic to determine whether the field is - # actually within the range of a wide integer. - append re {\s*([-+]?\d+)} - dict set fieldSet seconds [incr fieldCount] - append postcode {dict set date seconds } \[ \ - {ScanWide $field} [incr captureCount] \] \n - } - S { # Second - append re \\s*(\\d\\d?) - dict set fieldSet second [incr fieldCount] - append postcode "dict set date second \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - t { # Literal tab character - append re \\t - } - u - w { # Day number within week, 0 or 7 == Sun - # 1=Mon, 6=Sat - append re \\s*(\\d) - dict set fieldSet dayOfWeek [incr fieldCount] - append postcode {::scan $field} [incr captureCount] \ - { %d dow} \n \ - { - if { $dow == 0 } { - set dow 7 - } elseif { $dow > 7 } { - return -code error \ - -errorcode [list CLOCK badDayOfWeek] \ - "day of week is greater than 7" - } - dict set date dayOfWeek $dow - } - } - U { # Week of year. The first Sunday of - # the year is the first day of week - # 01. No scan rule uses this group. - append re \\s*\\d\\d? - } - V { # Week of ISO8601 year - - append re \\s*(\\d\\d?) - dict set fieldSet iso8601Week [incr fieldCount] - append postcode "dict set date iso8601Week \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - W { # Week of the year (00-53). The first - # Monday of the year is the first day - # of week 01. No scan rule uses this - # group. - append re \\s*\\d\\d? - } - y { # Two-digit Gregorian year - append re \\s*(\\d\\d?) - dict set fieldSet yearOfCentury [incr fieldCount] - append postcode "dict set date yearOfCentury \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - Y { # 4-digit Gregorian year - append re \\s*(\\d\\d)(\\d\\d) - dict set fieldSet century [incr fieldCount] - dict set fieldSet yearOfCentury [incr fieldCount] - append postcode \ - "dict set date century \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" \ - "dict set date yearOfCentury \[" \ - "::scan \$field" [incr captureCount] " %d" \ - "\]\n" - } - z - Z { # Time zone name - append re {(?:([-+]\d\d(?::?\d\d(?::?\d\d)?)?)|([[:alnum:]]{1,4}))} - dict set fieldSet tzName [incr fieldCount] - append postcode \ - {if } \{ { $field} [incr captureCount] \ - { ne "" } \} { } \{ \n \ - {dict set date tzName $field} \ - $captureCount \n \ - \} { else } \{ \n \ - {dict set date tzName } \[ \ - {ConvertLegacyTimeZone $field} \ - [incr captureCount] \] \n \ - \} \n \ - } - % { # Literal percent character - append re % - } - default { - append re % - if { ! [string is alnum $c] } { - append re \\ - } - append re $c - } - } - } - %E { - switch -exact -- $c { - C { # Locale-dependent era - set d {} - foreach triple [mc LOCALE_ERAS] { - lassign $triple t symbol year - dict set d [string tolower $symbol] $year - } - lassign [UniquePrefixRegexp $d] regex lookup - append re (?: $regex ) - } - E { - set l {} - dict set l [string tolower [mc BCE]] BCE - dict set l [string tolower [mc CE]] CE - dict set l b.c.e. BCE - dict set l c.e. CE - dict set l b.c. BCE - dict set l a.d. CE - lassign [UniquePrefixRegexp $l] regex lookup - append re ( $regex ) - dict set fieldSet era [incr fieldCount] - append postcode "dict set date era \["\ - "dict get " [list $lookup] \ - { } \[ {string tolower $field} \ - [incr captureCount] \] \ - "\]\n" - } - y { # Locale-dependent year of the era - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - incr captureCount - } - default { - append re %E - if { ! [string is alnum $c] } { - append re \\ - } - append re $c - } - } - set state {} - } - %O { - switch -exact -- $c { - d - e { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet dayOfMonth [incr fieldCount] - append postcode "dict set date dayOfMonth \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ - "\]\n" - } - H - k { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet hour [incr fieldCount] - append postcode "dict set date hour \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ - "\]\n" - } - I - l { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet hourAMPM [incr fieldCount] - append postcode "dict set date hourAMPM \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ - "\]\n" - } - m { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet month [incr fieldCount] - append postcode "dict set date month \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ - "\]\n" - } - M { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet minute [incr fieldCount] - append postcode "dict set date minute \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ - "\]\n" - } - S { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet second [incr fieldCount] - append postcode "dict set date second \[" \ - "dict get " [list $lookup] " \$field" \ - [incr captureCount] \ - "\]\n" - } - u - w { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet dayOfWeek [incr fieldCount] - append postcode "set dow \[dict get " [list $lookup] \ - { $field} [incr captureCount] \] \n \ - { - if { $dow == 0 } { - set dow 7 - } elseif { $dow > 7 } { - return -code error \ - -errorcode [list CLOCK badDayOfWeek] \ - "day of week is greater than 7" - } - dict set date dayOfWeek $dow - } - } - y { - lassign [LocaleNumeralMatcher $locale] regex lookup - append re $regex - dict set fieldSet yearOfCentury [incr fieldCount] - append postcode {dict set date yearOfCentury } \[ \ - {dict get } [list $lookup] { $field} \ - [incr captureCount] \] \n - } - default { - append re %O - if { ! [string is alnum $c] } { - append re \\ - } - append re $c - } - } - set state {} - } - } - } - - # Clean up any unfinished format groups - - append re $state \\s*\$ - - # Build the procedure - - set procBody {} - append procBody "variable ::tcl::clock::TZData" \n - append procBody "if \{ !\[ regexp -nocase [list $re] \$string ->" - for { set i 1 } { $i <= $captureCount } { incr i } { - append procBody " " field $i - } - append procBody "\] \} \{" \n - append procBody { - return -code error -errorcode [list CLOCK badInputString] \ - {input string does not match supplied format} - } - append procBody \}\n - append procBody "set date \[dict create\]" \n - append procBody {dict set date tzName $timeZone} \n - append procBody $postcode - append procBody [list set changeover [mc GREGORIAN_CHANGE_DATE]] \n - - # Set up the time zone before doing anything with a default base date - # that might need a timezone to interpret it. - - if { ![dict exists $fieldSet seconds] - && ![dict exists $fieldSet starDate] } { - if { [dict exists $fieldSet tzName] } { - append procBody { - set timeZone [dict get $date tzName] - } - } - append procBody { - set timeZone [::tcl::clock::SetupTimeZone $timeZone] - } - } - - # Add code that gets Julian Day Number from the fields. - - append procBody [MakeParseCodeFromFields $fieldSet $DateParseActions] - - # Get time of day - - append procBody [MakeParseCodeFromFields $fieldSet $TimeParseActions] - - # Assemble seconds from the Julian day and second of the day. - # Convert to local time unless epoch seconds or stardate are - # being processed - they're always absolute - - if { ![dict exists $fieldSet seconds] - && ![dict exists $fieldSet starDate] } { - append procBody { - if { [dict get $date julianDay] > 5373484 } { - return -code error -errorcode [list CLOCK dateTooLarge] \ - "requested date too large to represent" - } - dict set date localSeconds [expr { - -210866803200 - + ( 86400 * wide([dict get $date julianDay]) ) - + [dict get $date secondOfDay] - }] - } - - # Finally, convert the date to local time +proc ::tcl::clock::GetSystemLocale {} { + if { $::tcl_platform(platform) ne {windows} } { + # On a non-windows platform, the 'system' locale is the same as + # the 'current' locale - append procBody { - set date [::tcl::clock::ConvertLocalToUTC $date[set date {}] \ - $timeZone $changeover] - } + return [mclocale] } - # Return result - - append procBody {return [dict get $date seconds]} \n - - proc $procName { string baseTime timeZone } $procBody - - # puts [list proc $procName [list string baseTime timeZone] $procBody] - - return $procName -} + # On a windows platform, the 'system' locale is adapted from the + # 'current' locale by applying the date and time formats from the + # Control Panel. First, load the 'current' locale if it's not yet + # loaded -#---------------------------------------------------------------------- -# -# LocaleNumeralMatcher -- -# -# Composes a regexp that captures the numerals in the given locale, and -# a dictionary to map them to conventional numerals. -# -# Parameters: -# locale - Name of the current locale -# -# Results: -# Returns a two-element list comprising the regexp and the dictionary. -# -# Side effects: -# Caches the result. -# -#---------------------------------------------------------------------- + mcpackagelocale set [mclocale] -proc ::tcl::clock::LocaleNumeralMatcher {l} { - variable LocaleNumeralCache + # Make a new locale string for the system locale, and get the + # Control Panel information - if { ![dict exists $LocaleNumeralCache $l] } { - set d {} - set i 0 - set sep \( - foreach n [mc LOCALE_NUMERALS] { - dict set d $n $i - regsub -all {[^[:alnum:]]} $n \\\\& subex - append re $sep $subex - set sep | - incr i - } - append re \) - dict set LocaleNumeralCache $l [list $re $d] + set locale [mclocale]_windows + if { ! [mcpackagelocale present $locale] } { + LoadWindowsDateTimeFormats $locale } - return [dict get $LocaleNumeralCache $l] -} - - - -#---------------------------------------------------------------------- -# -# UniquePrefixRegexp -- -# -# Composes a regexp that performs unique-prefix matching. The RE -# matches one of a supplied set of strings, or any unique prefix -# thereof. -# -# Parameters: -# data - List of alternating match-strings and values. -# Match-strings with distinct values are considered -# distinct. -# -# Results: -# Returns a two-element list. The first is a regexp that matches any -# unique prefix of any of the strings. The second is a dictionary whose -# keys are match values from the regexp and whose values are the -# corresponding values from 'data'. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::UniquePrefixRegexp { data } { - # The 'successors' dictionary will contain, for each string that is a - # prefix of any key, all characters that may follow that prefix. The - # 'prefixMapping' dictionary will have keys that are prefixes of keys and - # values that correspond to the keys. - - set prefixMapping [dict create] - set successors [dict create {} {}] - - # Walk the key-value pairs - - foreach { key value } $data { - # Construct all prefixes of the key; - - set prefix {} - foreach char [split $key {}] { - set oldPrefix $prefix - dict set successors $oldPrefix $char {} - append prefix $char - - # Put the prefixes in the 'prefixMapping' and 'successors' - # dictionaries - - dict lappend prefixMapping $prefix $value - if { ![dict exists $successors $prefix] } { - dict set successors $prefix {} - } - } - } - - # Identify those prefixes that designate unique values, and those that are - # the full keys - - set uniquePrefixMapping {} - dict for { key valueList } $prefixMapping { - if { [llength $valueList] == 1 } { - dict set uniquePrefixMapping $key [lindex $valueList 0] - } - } - foreach { key value } $data { - dict set uniquePrefixMapping $key $value - } - - # Construct the re. - - return [list \ - [MakeUniquePrefixRegexp $successors $uniquePrefixMapping {}] \ - $uniquePrefixMapping] -} - -#---------------------------------------------------------------------- -# -# MakeUniquePrefixRegexp -- -# -# Service procedure for 'UniquePrefixRegexp' that constructs a regular -# expresison that matches the unique prefixes. -# -# Parameters: -# successors - Dictionary whose keys are all prefixes -# of keys passed to 'UniquePrefixRegexp' and whose -# values are dictionaries whose keys are the characters -# that may follow those prefixes. -# uniquePrefixMapping - Dictionary whose keys are the unique -# prefixes and whose values are not examined. -# prefixString - Current prefix being processed. -# -# Results: -# Returns a constructed regular expression that matches the set of -# unique prefixes beginning with the 'prefixString'. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::MakeUniquePrefixRegexp { successors - uniquePrefixMapping - prefixString } { - - # Get the characters that may follow the current prefix string - - set schars [lsort -ascii [dict keys [dict get $successors $prefixString]]] - if { [llength $schars] == 0 } { - return {} - } - - # If there is more than one successor character, or if the current prefix - # is a unique prefix, surround the generated re with non-capturing - # parentheses. - - set re {} - if { - [dict exists $uniquePrefixMapping $prefixString] - || [llength $schars] > 1 - } then { - append re "(?:" - } - - # Generate a regexp that matches the successors. - - set sep "" - foreach { c } $schars { - set nextPrefix $prefixString$c - regsub -all {[^[:alnum:]]} $c \\\\& rechar - append re $sep $rechar \ - [MakeUniquePrefixRegexp \ - $successors $uniquePrefixMapping $nextPrefix] - set sep | - } - - # If the current prefix is a unique prefix, make all following text - # optional. Otherwise, if there is more than one successor character, - # close the non-capturing parentheses. - - if { [dict exists $uniquePrefixMapping $prefixString] } { - append re ")?" - } elseif { [llength $schars] > 1 } { - append re ")" - } - - return $re -} - -#---------------------------------------------------------------------- -# -# MakeParseCodeFromFields -- -# -# Composes Tcl code to extract the Julian Day Number from a dictionary -# containing date fields. -# -# Parameters: -# dateFields -- Dictionary whose keys are fields of the date, -# and whose values are the rightmost positions -# at which those fields appear. -# parseActions -- List of triples: field set, priority, and -# code to emit. Smaller priorities are better, and -# the list must be in ascending order by priority -# -# Results: -# Returns a burst of code that extracts the day number from the given -# date. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::MakeParseCodeFromFields { dateFields parseActions } { - - set currPrio 999 - set currFieldPos [list] - set currCodeBurst { - error "in ::tcl::clock::MakeParseCodeFromFields: can't happen" - } - - foreach { fieldSet prio parseAction } $parseActions { - # If we've found an answer that's better than any that follow, quit - # now. - - if { $prio > $currPrio } { - break - } - - # Accumulate the field positions that are used in the current field - # grouping. - - set fieldPos [list] - set ok true - foreach field $fieldSet { - if { ! [dict exists $dateFields $field] } { - set ok 0 - break - } - lappend fieldPos [dict get $dateFields $field] - } - - # Quit if we don't have a complete set of fields - if { !$ok } { - continue - } - - # Determine whether the current answer is better than the last. - - set fPos [lsort -integer -decreasing $fieldPos] - - if { $prio == $currPrio } { - foreach currPos $currFieldPos newPos $fPos { - if { - ![string is integer $newPos] - || ![string is integer $currPos] - || $newPos > $currPos - } then { - break - } - if { $newPos < $currPos } { - set ok 0 - break - } - } - } - if { !$ok } { - continue - } - - # Remember the best possibility for extracting date information - - set currPrio $prio - set currFieldPos $fPos - set currCodeBurst $parseAction - } - - return $currCodeBurst -} - -#---------------------------------------------------------------------- -# -# GetSystemTimeZone -- -# -# Determines the system time zone, which is the default for the -# 'clock' command if no other zone is supplied. -# -# Parameters: -# None. -# -# Results: -# Returns the system time zone. -# -# Side effects: -# Stores the sustem time zone in engine configuration, since -# determining it may be an expensive process. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::GetSystemLocale {} { - if { $::tcl_platform(platform) ne {windows} } { - # On a non-windows platform, the 'system' locale is the same as - # the 'current' locale - - return [mclocale] - } - - # On a windows platform, the 'system' locale is adapted from the - # 'current' locale by applying the date and time formats from the - # Control Panel. First, load the 'current' locale if it's not yet - # loaded - - mcpackagelocale set [mclocale] - - # Make a new locale string for the system locale, and get the - # Control Panel information - - set locale [mclocale]_windows - if { ! [mcpackagelocale present $locale] } { - LoadWindowsDateTimeFormats $locale - } - - return $locale -} - -#---------------------------------------------------------------------- -# -# EnterLocale -- -# -# Switch [mclocale] to a given locale if necessary -# -# Parameters: -# locale -- Desired locale -# -# Results: -# Returns the locale that was previously current. -# -# Side effects: -# Does [mclocale]. If necessary, loades the designated locale's files. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::EnterLocale { locale } { - switch -- $locale system { - set locale [GetSystemLocale] - } current { - set locale [mclocale] - } - # Select the locale, eventually load it - mcpackagelocale set $locale - return $locale -} - -#---------------------------------------------------------------------- -# -# LoadWindowsDateTimeFormats -- -# -# Load the date/time formats from the Control Panel in Windows and -# convert them so that they're usable by Tcl. -# -# Parameters: -# locale - Name of the locale in whose message catalog -# the converted formats are to be stored. -# -# Results: -# None. -# -# Side effects: -# Updates the given message catalog with the locale strings. -# -# Presumes that on entry, [mclocale] is set to the current locale, so that -# default strings can be obtained if the Registry query fails. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::LoadWindowsDateTimeFormats { locale } { - # Bail out if we can't find the Registry - - variable NoRegistry - if { [info exists NoRegistry] } return - - if { ![catch { - registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ - sShortDate - } string] } { - set quote {} - set datefmt {} - foreach { unquoted quoted } [split $string '] { - append datefmt $quote [string map { - dddd %A - ddd %a - dd %d - d %e - MMMM %B - MMM %b - MM %m - M %N - yyyy %Y - yy %y - y %y - gg {} - } $unquoted] - if { $quoted eq {} } { - set quote ' - } else { - set quote $quoted - } - } - ::msgcat::mcset $locale DATE_FORMAT $datefmt - } - - if { ![catch { - registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ - sLongDate - } string] } { - set quote {} - set ldatefmt {} - foreach { unquoted quoted } [split $string '] { - append ldatefmt $quote [string map { - dddd %A - ddd %a - dd %d - d %e - MMMM %B - MMM %b - MM %m - M %N - yyyy %Y - yy %y - y %y - gg {} - } $unquoted] - if { $quoted eq {} } { - set quote ' - } else { - set quote $quoted - } - } - ::msgcat::mcset $locale LOCALE_DATE_FORMAT $ldatefmt - } - - if { ![catch { - registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ - sTimeFormat - } string] } { - set quote {} - set timefmt {} - foreach { unquoted quoted } [split $string '] { - append timefmt $quote [string map { - HH %H - H %k - hh %I - h %l - mm %M - m %M - ss %S - s %S - tt %p - t %p - } $unquoted] - if { $quoted eq {} } { - set quote ' - } else { - set quote $quoted - } - } - ::msgcat::mcset $locale TIME_FORMAT $timefmt - } - - catch { - ::msgcat::mcset $locale DATE_TIME_FORMAT "$datefmt $timefmt" - } - catch { - ::msgcat::mcset $locale LOCALE_DATE_TIME_FORMAT "$ldatefmt $timefmt" - } - - return - -} - -#---------------------------------------------------------------------- -# -# LocalizeFormat -- -# -# Map away locale-dependent format groups in a clock format. -# -# Parameters: -# locale -- Current [mclocale] locale, supplied to avoid -# an extra call -# format -- Format supplied to [clock scan] or [clock format] -# -# Results: -# Returns the string with locale-dependent composite format groups -# substituted out. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { - variable LocaleFormats - - if { $fmtkey eq {} } { set fmtkey FMT_$format } - if { [catch { - set locfmt [dict get $LocaleFormats $locale $fmtkey] - }] } { - - # get map list cached or build it: - if { [catch { - set mlst [dict get $LocaleFormats $locale MLST] - }] } { - - # message catalog dictionary: - set mcd [mcget $locale] - - # Handle locale-dependent format groups by mapping them out of the format - # string. Note that the order of the [string map] operations is - # significant because later formats can refer to later ones; for example - # %c can refer to %X, which in turn can refer to %T. - - set mlst { - %% %% - %D %m/%d/%Y - %+ {%a %b %e %H:%M:%S %Z %Y} - } - lappend mlst %EY [string map $mlst [dict get $mcd LOCALE_YEAR_FORMAT]] - lappend mlst %T [string map $mlst [dict get $mcd TIME_FORMAT_24_SECS]] - lappend mlst %R [string map $mlst [dict get $mcd TIME_FORMAT_24]] - lappend mlst %r [string map $mlst [dict get $mcd TIME_FORMAT_12]] - lappend mlst %X [string map $mlst [dict get $mcd TIME_FORMAT]] - lappend mlst %EX [string map $mlst [dict get $mcd LOCALE_TIME_FORMAT]] - lappend mlst %x [string map $mlst [dict get $mcd DATE_FORMAT]] - lappend mlst %Ex [string map $mlst [dict get $mcd LOCALE_DATE_FORMAT]] - lappend mlst %c [string map $mlst [dict get $mcd DATE_TIME_FORMAT]] - lappend mlst %Ec [string map $mlst [dict get $mcd LOCALE_DATE_TIME_FORMAT]] - - dict set LocaleFormats $locale MLST $mlst - } - - # translate copy of format (don't use format object here, because otherwise - # it can lose its internal representation (string map - convert to unicode) - set locfmt [string map $mlst [string range " $format" 1 end]] - - # cache it: - dict set LocaleFormats $locale $fmtkey $locfmt - } - - # Save original format as long as possible, because of internal - # representation (performance). - # Note that in this case such format will be never localized (also - # using another locales). To prevent this return a duplicate (but - # it may be slower). - if {$locfmt eq $format} { - set locfmt $format - } - - return $locfmt -} - -#---------------------------------------------------------------------- -# -# FormatNumericTimeZone -- -# -# Formats a time zone as +hhmmss -# -# Parameters: -# z - Time zone in seconds east of Greenwich -# -# Results: -# Returns the time zone formatted in a numeric form -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::FormatNumericTimeZone { z } { - if { $z < 0 } { - set z [expr { - $z }] - set retval - - } else { - set retval + - } - append retval [::format %02d [expr { $z / 3600 }]] - set z [expr { $z % 3600 }] - append retval [::format %02d [expr { $z / 60 }]] - set z [expr { $z % 60 }] - if { $z != 0 } { - append retval [::format %02d $z] - } - return $retval -} - -#---------------------------------------------------------------------- -# -# FormatStarDate -- -# -# Formats a date as a StarDate. -# -# Parameters: -# date - Dictionary containing 'year', 'dayOfYear', and -# 'localSeconds' fields. -# -# Results: -# Returns the given date formatted as a StarDate. -# -# Side effects: -# None. -# -# Jeff Hobbs put this in to support an atrocious pun about Tcl being -# "Enterprise ready." Now we're stuck with it. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::FormatStarDate { date } { - variable Roddenberry - - # Get day of year, zero based - - set doy [expr { [dict get $date dayOfYear] - 1 }] - - # Determine whether the year is a leap year - - set lp [IsGregorianLeapYear $date] - - # Convert day of year to a fractional year - - if { $lp } { - set fractYear [expr { 1000 * $doy / 366 }] - } else { - set fractYear [expr { 1000 * $doy / 365 }] - } - - # Put together the StarDate - - return [::format "Stardate %02d%03d.%1d" \ - [expr { [dict get $date year] - $Roddenberry }] \ - $fractYear \ - [expr { [dict get $date localSeconds] % 86400 - / ( 86400 / 10 ) }]] -} - -#---------------------------------------------------------------------- -# -# ParseStarDate -- -# -# Parses a StarDate -# -# Parameters: -# year - Year from the Roddenberry epoch -# fractYear - Fraction of a year specifiying the day of year. -# fractDay - Fraction of a day -# -# Results: -# Returns a count of seconds from the Posix epoch. -# -# Side effects: -# None. -# -# Jeff Hobbs put this in to support an atrocious pun about Tcl being -# "Enterprise ready." Now we're stuck with it. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::ParseStarDate { year fractYear fractDay } { - variable Roddenberry - - # Build a tentative date from year and fraction. - - set date [dict create \ - gregorian 1 \ - era CE \ - year [expr { $year + $Roddenberry }] \ - dayOfYear [expr { $fractYear * 365 / 1000 + 1 }]] - set date [GetJulianDayFromGregorianEraYearDay $date[set date {}]] - - # Determine whether the given year is a leap year - - set lp [IsGregorianLeapYear $date] - - # Reconvert the fractional year according to whether the given year is a - # leap year - - if { $lp } { - dict set date dayOfYear \ - [expr { $fractYear * 366 / 1000 + 1 }] - } else { - dict set date dayOfYear \ - [expr { $fractYear * 365 / 1000 + 1 }] - } - dict unset date julianDay - dict unset date gregorian - set date [GetJulianDayFromGregorianEraYearDay $date[set date {}]] - - return [expr { - 86400 * [dict get $date julianDay] - - 210866803200 - + ( 86400 / 10 ) * $fractDay - }] -} - -#---------------------------------------------------------------------- -# -# ScanWide -- -# -# Scans a wide integer from an input -# -# Parameters: -# str - String containing a decimal wide integer -# -# Results: -# Returns the string as a pure wide integer. Throws an error if the -# string is misformatted or out of range. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::ScanWide { str } { - set count [::scan $str {%ld %c} result junk] - if { $count != 1 } { - return -code error -errorcode [list CLOCK notAnInteger $str] \ - "\"$str\" is not an integer" - } - if { [incr result 0] != $str } { - return -code error -errorcode [list CLOCK integervalueTooLarge] \ - "integer value too large to represent" - } - return $result -} - -#---------------------------------------------------------------------- -# -# InterpretTwoDigitYear -- -# -# Given a date that contains only the year of the century, determines -# the target value of a two-digit year. -# -# Parameters: -# date - Dictionary containing fields of the date. -# baseTime - Base time relative to which the date is expressed. -# twoDigitField - Name of the field that stores the two-digit year. -# Default is 'yearOfCentury' -# fourDigitField - Name of the field that will receive the four-digit -# year. Default is 'year' -# -# Results: -# Returns the dictionary augmented with the four-digit year, stored in -# the given key. -# -# Side effects: -# None. -# -# The current rule for interpreting a two-digit year is that the year shall be -# between 1937 and 2037, thus staying within the range of a 32-bit signed -# value for time. This rule may change to a sliding window in future -# versions, so the 'baseTime' parameter (which is currently ignored) is -# provided in the procedure signature. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::InterpretTwoDigitYear { date baseTime - { twoDigitField yearOfCentury } - { fourDigitField year } } { - set yr [dict get $date $twoDigitField] - if { $yr >= [configure -century-switch] } { - incr yr -100 - } - incr yr [configure -year-century] - dict set date $fourDigitField $yr - return $date -} - -#---------------------------------------------------------------------- -# -# AssignBaseYear -- -# -# Places the number of the current year into a dictionary. -# -# Parameters: -# date - Dictionary value to update -# baseTime - Base time from which to extract the year, expressed -# in seconds from the Posix epoch -# timezone - the time zone in which the date is being scanned -# changeover - the Julian Day on which the Gregorian calendar -# was adopted in the target locale. -# -# Results: -# Returns the dictionary with the current year assigned. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AssignBaseYear { date baseTime timezone changeover } { - variable TZData - - # Find the Julian Day Number corresponding to the base time, and - # find the Gregorian year corresponding to that Julian Day. - - set date2 [GetDateFields $baseTime $timezone $changeover] - - # Store the converted year - - dict set date era [dict get $date2 era] - dict set date year [dict get $date2 year] - - return $date -} - -#---------------------------------------------------------------------- -# -# AssignBaseIso8601Year -- -# -# Determines the base year in the ISO8601 fiscal calendar. -# -# Parameters: -# date - Dictionary containing the fields of the date that -# is to be augmented with the base year. -# baseTime - Base time expressed in seconds from the Posix epoch. -# timeZone - Target time zone -# changeover - Julian Day of adoption of the Gregorian calendar in -# the target locale. -# -# Results: -# Returns the given date with "iso8601Year" set to the -# base year. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AssignBaseIso8601Year {date baseTime timeZone changeover} { - variable TZData - - # Find the Julian Day Number corresponding to the base time - - set date2 [GetDateFields $baseTime $timeZone $changeover] - - # Calculate the ISO8601 date and transfer the year - - dict set date era CE - dict set date iso8601Year [dict get $date2 iso8601Year] - return $date -} - -#---------------------------------------------------------------------- -# -# AssignBaseMonth -- -# -# Places the number of the current year and month into a -# dictionary. -# -# Parameters: -# date - Dictionary value to update -# baseTime - Time from which the year and month are to be -# obtained, expressed in seconds from the Posix epoch. -# timezone - Name of the desired time zone -# changeover - Julian Day on which the Gregorian calendar was adopted. -# -# Results: -# Returns the dictionary with the base year and month assigned. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AssignBaseMonth {date baseTime timezone changeover} { - variable TZData - - # Find the year and month corresponding to the base time - - set date2 [GetDateFields $baseTime $timezone $changeover] - dict set date era [dict get $date2 era] - dict set date year [dict get $date2 year] - dict set date month [dict get $date2 month] - return $date -} - -#---------------------------------------------------------------------- -# -# AssignBaseWeek -- -# -# Determines the base year and week in the ISO8601 fiscal calendar. -# -# Parameters: -# date - Dictionary containing the fields of the date that -# is to be augmented with the base year and week. -# baseTime - Base time expressed in seconds from the Posix epoch. -# changeover - Julian Day on which the Gregorian calendar was adopted -# in the target locale. -# -# Results: -# Returns the given date with "iso8601Year" set to the -# base year and "iso8601Week" to the week number. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AssignBaseWeek {date baseTime timeZone changeover} { - variable TZData - - # Find the Julian Day Number corresponding to the base time - - set date2 [GetDateFields $baseTime $timeZone $changeover] - - # Calculate the ISO8601 date and transfer the year - dict set date era CE - dict set date iso8601Year [dict get $date2 iso8601Year] - dict set date iso8601Week [dict get $date2 iso8601Week] - return $date + return $locale } #---------------------------------------------------------------------- # -# AssignBaseJulianDay -- +# EnterLocale -- # -# Determines the base day for a time-of-day conversion. +# Switch [mclocale] to a given locale if necessary # # Parameters: -# date - Dictionary that is to get the base day -# baseTime - Base time expressed in seconds from the Posix epoch -# changeover - Julian day on which the Gregorian calendar was -# adpoted in the target locale. +# locale -- Desired locale # # Results: -# Returns the given dictionary augmented with a 'julianDay' field -# that contains the base day. +# Returns the locale that was previously current. # # Side effects: -# None. +# Does [mclocale]. If necessary, loades the designated locale's files. # #---------------------------------------------------------------------- -proc ::tcl::clock::AssignBaseJulianDay { date baseTime timeZone changeover } { - variable TZData - - # Find the Julian Day Number corresponding to the base time - - set date2 [GetDateFields $baseTime $timeZone $changeover] - dict set date julianDay [dict get $date2 julianDay] - - return $date +proc ::tcl::clock::EnterLocale { locale } { + switch -- $locale system { + set locale [GetSystemLocale] + } current { + set locale [mclocale] + } + # Select the locale, eventually load it + mcpackagelocale set $locale + return $locale } #---------------------------------------------------------------------- # -# InterpretHMSP -- +# LoadWindowsDateTimeFormats -- # -# Interprets a time in the form "hh:mm:ss am". +# Load the date/time formats from the Control Panel in Windows and +# convert them so that they're usable by Tcl. # # Parameters: -# date -- Dictionary containing "hourAMPM", "minute", "second" -# and "amPmIndicator" fields. +# locale - Name of the locale in whose message catalog +# the converted formats are to be stored. # # Results: -# Returns the number of seconds from local midnight. +# None. # # Side effects: -# None. +# Updates the given message catalog with the locale strings. +# +# Presumes that on entry, [mclocale] is set to the current locale, so that +# default strings can be obtained if the Registry query fails. # #---------------------------------------------------------------------- -proc ::tcl::clock::InterpretHMSP { date } { - set hr [dict get $date hourAMPM] - if { $hr == 12 } { - set hr 0 +proc ::tcl::clock::LoadWindowsDateTimeFormats { locale } { + # Bail out if we can't find the Registry + + variable NoRegistry + if { [info exists NoRegistry] } return + + if { ![catch { + registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ + sShortDate + } string] } { + set quote {} + set datefmt {} + foreach { unquoted quoted } [split $string '] { + append datefmt $quote [string map { + dddd %A + ddd %a + dd %d + d %e + MMMM %B + MMM %b + MM %m + M %N + yyyy %Y + yy %y + y %y + gg {} + } $unquoted] + if { $quoted eq {} } { + set quote ' + } else { + set quote $quoted + } + } + ::msgcat::mcset $locale DATE_FORMAT $datefmt + } + + if { ![catch { + registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ + sLongDate + } string] } { + set quote {} + set ldatefmt {} + foreach { unquoted quoted } [split $string '] { + append ldatefmt $quote [string map { + dddd %A + ddd %a + dd %d + d %e + MMMM %B + MMM %b + MM %m + M %N + yyyy %Y + yy %y + y %y + gg {} + } $unquoted] + if { $quoted eq {} } { + set quote ' + } else { + set quote $quoted + } + } + ::msgcat::mcset $locale LOCALE_DATE_FORMAT $ldatefmt + } + + if { ![catch { + registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ + sTimeFormat + } string] } { + set quote {} + set timefmt {} + foreach { unquoted quoted } [split $string '] { + append timefmt $quote [string map { + HH %H + H %k + hh %I + h %l + mm %M + m %M + ss %S + s %S + tt %p + t %p + } $unquoted] + if { $quoted eq {} } { + set quote ' + } else { + set quote $quoted + } + } + ::msgcat::mcset $locale TIME_FORMAT $timefmt + } + + catch { + ::msgcat::mcset $locale DATE_TIME_FORMAT "$datefmt $timefmt" } - if { [dict get $date amPmIndicator] } { - incr hr 12 + catch { + ::msgcat::mcset $locale LOCALE_DATE_TIME_FORMAT "$ldatefmt $timefmt" } - dict set date hour $hr - return [InterpretHMS $date[set date {}]] + + return + } #---------------------------------------------------------------------- # -# InterpretHMS -- +# LocalizeFormat -- # -# Interprets a 24-hour time "hh:mm:ss" +# Map away locale-dependent format groups in a clock format. # # Parameters: -# date -- Dictionary containing the "hour", "minute" and "second" -# fields. +# locale -- Current [mclocale] locale, supplied to avoid +# an extra call +# format -- Format supplied to [clock scan] or [clock format] # # Results: -# Returns the given dictionary augmented with a "secondOfDay" -# field containing the number of seconds from local midnight. +# Returns the string with locale-dependent composite format groups +# substituted out. # # Side effects: # None. # #---------------------------------------------------------------------- -proc ::tcl::clock::InterpretHMS { date } { - return [expr { - ( [dict get $date hour] * 60 - + [dict get $date minute] ) * 60 - + [dict get $date second] - }] +proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { + variable LocaleFormats + + if { $fmtkey eq {} } { set fmtkey FMT_$format } + if { [catch { + set locfmt [dict get $LocaleFormats $locale $fmtkey] + }] } { + + # get map list cached or build it: + if { [catch { + set mlst [dict get $LocaleFormats $locale MLST] + }] } { + + # message catalog dictionary: + set mcd [mcget $locale] + + # Handle locale-dependent format groups by mapping them out of the format + # string. Note that the order of the [string map] operations is + # significant because later formats can refer to later ones; for example + # %c can refer to %X, which in turn can refer to %T. + + set mlst { + %% %% + %D %m/%d/%Y + %+ {%a %b %e %H:%M:%S %Z %Y} + } + lappend mlst %EY [string map $mlst [dict get $mcd LOCALE_YEAR_FORMAT]] + lappend mlst %T [string map $mlst [dict get $mcd TIME_FORMAT_24_SECS]] + lappend mlst %R [string map $mlst [dict get $mcd TIME_FORMAT_24]] + lappend mlst %r [string map $mlst [dict get $mcd TIME_FORMAT_12]] + lappend mlst %X [string map $mlst [dict get $mcd TIME_FORMAT]] + lappend mlst %EX [string map $mlst [dict get $mcd LOCALE_TIME_FORMAT]] + lappend mlst %x [string map $mlst [dict get $mcd DATE_FORMAT]] + lappend mlst %Ex [string map $mlst [dict get $mcd LOCALE_DATE_FORMAT]] + lappend mlst %c [string map $mlst [dict get $mcd DATE_TIME_FORMAT]] + lappend mlst %Ec [string map $mlst [dict get $mcd LOCALE_DATE_TIME_FORMAT]] + + dict set LocaleFormats $locale MLST $mlst + } + + # translate copy of format (don't use format object here, because otherwise + # it can lose its internal representation (string map - convert to unicode) + set locfmt [string map $mlst [string range " $format" 1 end]] + + # cache it: + dict set LocaleFormats $locale $fmtkey $locfmt + } + + # Save original format as long as possible, because of internal + # representation (performance). + # Note that in this case such format will be never localized (also + # using another locales). To prevent this return a duplicate (but + # it may be slower). + if {$locfmt eq $format} { + set locfmt $format + } + + return $locfmt } #---------------------------------------------------------------------- @@ -2891,38 +857,6 @@ proc ::tcl::clock::GetSystemTimeZone {} { #---------------------------------------------------------------------- # -# ConvertLegacyTimeZone -- -# -# Given an alphanumeric time zone identifier and the system time zone, -# convert the alphanumeric identifier to an unambiguous time zone. -# -# Parameters: -# tzname - Name of the time zone to convert -# -# Results: -# Returns a time zone name corresponding to tzname, but in an -# unambiguous form, generally +hhmm. -# -# This procedure is implemented primarily to allow the parsing of RFC822 -# date/time strings. Processing a time zone name on input is not recommended -# practice, because there is considerable room for ambiguity; for instance, is -# BST Brazilian Standard Time, or British Summer Time? -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::ConvertLegacyTimeZone { tzname } { - variable LegacyTimeZone - - set tzname [string tolower $tzname] - if { ![dict exists $LegacyTimeZone $tzname] } { - return -code error -errorcode [list CLOCK badTZName $tzname] \ - "time zone \"$tzname\" not found" - } - return [dict get $LegacyTimeZone $tzname] -} - -#---------------------------------------------------------------------- -# # SetupTimeZone -- # # Given the name or specification of a time zone, sets up its in-memory @@ -3837,43 +1771,6 @@ proc ::tcl::clock::DeterminePosixDSTTime { z bound y } { #---------------------------------------------------------------------- # -# GetLocaleEra -- -# -# Given local time expressed in seconds from the Posix epoch, -# determine localized era and year within the era. -# -# Parameters: -# date - Dictionary that must contain the keys, 'localSeconds', -# whose value is expressed as the appropriate local time; -# and 'year', whose value is the Gregorian year. -# etable - Value of the LOCALE_ERAS key in the message catalogue -# for the target locale. -# -# Results: -# Returns the dictionary, augmented with the keys, 'localeEra' and -# 'localeYear'. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::GetLocaleEra { date etable } { - set index [BSearch $etable [dict get $date localSeconds]] - if { $index < 0} { - dict set date localeEra \ - [::format %02d [expr { [dict get $date year] / 100 }]] - dict set date localeYear [expr { - [dict get $date year] % 100 - }] - } else { - dict set date localeEra [lindex $etable $index 1] - dict set date localeYear [expr { - [dict get $date year] - [lindex $etable $index 2] - }] - } - return $date -} - -#---------------------------------------------------------------------- -# # GetJulianDayFromEraYearDay -- # # Given a year, month and day on the Gregorian calendar, determines @@ -4051,57 +1948,6 @@ proc ::tcl::clock::WeekdayOnOrBefore { weekday j } { #---------------------------------------------------------------------- # -# BSearch -- -# -# Service procedure that does binary search in several places inside the -# 'clock' command. -# -# Parameters: -# list - List of lists, sorted in ascending order by the -# first elements -# key - Value to search for -# -# Results: -# Returns the index of the greatest element in $list that is less than -# or equal to $key. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::BSearch { list key } { - if {[llength $list] == 0} { - return -1 - } - if { $key < [lindex $list 0 0] } { - return -1 - } - - set l 0 - set u [expr { [llength $list] - 1 }] - - while { $l < $u } { - # At this point, we know that - # $k >= [lindex $list $l 0] - # Either $u == [llength $list] or else $k < [lindex $list $u+1 0] - # We find the midpoint of the interval {l,u} rounded UP, compare - # against it, and set l or u to maintain the invariant. Note that the - # interval shrinks at each step, guaranteeing convergence. - - set m [expr { ( $l + $u + 1 ) / 2 }] - if { $key >= [lindex $list $m 0] } { - set l $m - } else { - set u [expr { $m - 1 }] - } - } - - return $l -} - -#---------------------------------------------------------------------- -# # clock add -- # # Adds an offset to a given time. diff --git a/library/init.tcl b/library/init.tcl index 6f34302..f1f1bb4 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -178,7 +178,7 @@ if {[interp issafe]} { # Auto-loading stubs for 'clock.tcl' - foreach cmd {add LocalizeFormat SetupTimeZone GetSystemTimeZone} { + foreach cmd {add mcget LocalizeFormat SetupTimeZone GetSystemTimeZone} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] -- cgit v0.12 From 866efbc90481ea60325dd2439e321f0d8280c826 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:52:12 +0000 Subject: some greedy matches are fixed (see test cases clock-6.22.11 and clock-6.22.12), involving space count in look ahead and end distance calculation (because spaces are optional in date-time string as well as in scanning format). --- generic/tclClockFmt.c | 121 ++++++++++++++++++++++++++++++++------------------ generic/tclDate.h | 2 + tests/clock.test | 37 +++++++++++++++ 3 files changed, 117 insertions(+), 43 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 307fc28..00ea0ed 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -723,24 +723,36 @@ inline void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok, int *minLen, int *maxLen) { - register const char*p = yyInput; + register const char *p = yyInput, + *end = info->dateEnd; *minLen = 0; - /* max length to the end regarding distance to end (min-width of following tokens) */ - *maxLen = info->dateEnd - p - tok->endDistance; - /* if no tokens anymore */ - if (!(tok+1)->map) { - /* should match to end or first space */ - while (!isspace(UCHAR(*p)) && ++p < info->dateEnd) {}; - *minLen = p - yyInput; - } else - /* next token is a word */ - if ((tok+1)->map->type == CTOKT_WORD) { - /* should match at least to the first char of this word */ - while (*p != *((tok+1)->tokWord.start) && ++p < info->dateEnd) {}; - *minLen = p - yyInput; + /* if still tokens available */ + if ((tok+1)->map) { + end -= tok->endDistance + yySpaceCount; + /* next token is a word */ + switch ((tok+1)->map->type) { + case CTOKT_WORD: + /* should match at least to the first char of this word */ + while (*p != *((tok+1)->tokWord.start) && ++p < end) {}; + *minLen = p - yyInput; + break; + case CTOKT_CHAR: + while (*p != *((char *)(tok+1)->map->data) && ++p < end) {}; + *minLen = p - yyInput; + break; + } } + /* max length to the end regarding distance to end (min-width of following tokens) */ + *maxLen = end - p; + if (*maxLen > tok->map->maxSize) { + *maxLen = tok->map->maxSize; + }; + + if (*minLen < tok->map->minSize) { + *minLen = tok->map->minSize; + } if (*minLen > *maxLen) { *maxLen = *minLen; } @@ -1384,7 +1396,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_MONTH, 0, 1, 2, TclOffset(DateInfo, date.month), NULL}, /* %b %B %h */ - {CTOKT_PARSER, CLF_MONTH, 0, 0, 0, 0, + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0xffff, 0, ClockScnToken_Month_Proc}, /* %y */ {CTOKT_DIGIT, CLF_YEAR, 0, 1, 2, TclOffset(DateInfo, date.year), @@ -1402,7 +1414,7 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.secondOfDay), NULL}, /* %p %P */ - {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0xffff, 0, ClockScnToken_amPmInd_Proc, NULL}, /* %J */ {CTOKT_DIGIT, CLF_JULIANDAY, 0, 1, 0xffff, TclOffset(DateInfo, date.julianDay), @@ -1423,10 +1435,10 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_ISO8601, 0, 1, 2, TclOffset(DateInfo, date.iso8601Week), NULL}, /* %a %A %u %w */ - {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0xffff, 0, ClockScnToken_DayOfWeek_Proc, NULL}, /* %z %Z */ - {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0, 0, + {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0xffff, 0, ClockScnToken_TimeZone_Proc, NULL}, /* %U %W */ {CTOKT_DIGIT, CLF_OPTIONAL, 0, 1, 2, 0, /* currently no capture, parse only token */ @@ -1435,9 +1447,9 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_POSIXSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.seconds), NULL}, /* %n */ - {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\n"}, + {CTOKT_CHAR, 0, 0, 0, 1, 0, NULL, "\n"}, /* min=0 - spaces are optional (in yySpaceCount) */ /* %t */ - {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\t"}, + {CTOKT_CHAR, 0, 0, 0, 1, 0, NULL, "\t"}, /* min=0 - spaces are optional (in yySpaceCount) */ /* %Q */ {CTOKT_PARSER, CLF_LOCALSEC, 0, 16, 30, 0, ClockScnToken_StarDate_Proc, NULL}, @@ -1451,10 +1463,10 @@ static const char *ScnETokenMapIndex = "Eys"; static ClockScanTokenMap ScnETokenMap[] = { /* %EE */ - {CTOKT_PARSER, 0, 0, 0, 0, TclOffset(DateInfo, date.year), + {CTOKT_PARSER, 0, 0, 0, 0xffff, TclOffset(DateInfo, date.year), ClockScnToken_LocaleERA_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Ey */ - {CTOKT_PARSER, 0, 0, 0, 0, 0, /* currently no capture, parse only token */ + {CTOKT_PARSER, 0, 0, 0, 0xffff, 0, /* currently no capture, parse only token */ ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Es */ {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), @@ -1469,25 +1481,25 @@ static const char *ScnOTokenMapIndex = "dmyHMSu"; static ClockScanTokenMap ScnOTokenMap[] = { /* %Od %Oe */ - {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0, TclOffset(DateInfo, date.dayOfMonth), + {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0xffff, TclOffset(DateInfo, date.dayOfMonth), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Om */ - {CTOKT_PARSER, CLF_MONTH, 0, 0, 0, TclOffset(DateInfo, date.month), + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0xffff, TclOffset(DateInfo, date.month), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Oy */ - {CTOKT_PARSER, CLF_YEAR, 0, 0, 0, TclOffset(DateInfo, date.year), + {CTOKT_PARSER, CLF_YEAR, 0, 0, 0xffff, TclOffset(DateInfo, date.year), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %OH %Ok %OI %Ol */ - {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateInfo, date.hour), + {CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.hour), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %OM */ - {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateInfo, date.minutes), + {CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.minutes), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %OS */ - {CTOKT_PARSER, CLF_TIME, 0, 0, 0, TclOffset(DateInfo, date.secondOfDay), + {CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.secondOfDay), ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %Ou Ow */ - {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0, 0, + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0xffff, 0, ClockScnToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *ScnOTokenMapAliasIndex[2] = { @@ -1498,12 +1510,12 @@ static const char *ScnOTokenMapAliasIndex[2] = { static const char *ScnSpecTokenMapIndex = " "; static ClockScanTokenMap ScnSpecTokenMap[] = { - {CTOKT_SPACE, 0, 0, 0, 0xffff, 0, + {CTOKT_SPACE, 0, 0, 0, 0xffff, 0, /* min=0 - spaces are optional (in yySpaceCount) */ NULL}, }; static ClockScanTokenMap ScnWordTokenMap = { - CTOKT_WORD, 0, 0, 1, 0, 0, + CTOKT_WORD, 0, 0, 1, 0xffff, 0, NULL }; @@ -1739,7 +1751,22 @@ ClockScan( p++; } } - info->dateStart = yyInput = p; + yyInput = p; + /* look ahead to count spaces (bypass it by count length and distances) */ + x = end; + while (p < end) { + if (isspace(UCHAR(*p))) { + x = p++; + yySpaceCount++; + continue; + } + x = end; + p++; + } + /* ignore spaces at end */ + yySpaceCount -= (end - x); + end = x; + info->dateStart = p = yyInput; info->dateEnd = end; /* parse string */ @@ -1752,6 +1779,7 @@ ClockScan( && map->type != CTOKT_CHAR ) ) { while (p < end && isspace(UCHAR(*p))) { + yySpaceCount--; p++; } } @@ -1764,16 +1792,17 @@ ClockScan( { case CTOKT_DIGIT: if (1) { - int size = map->maxSize; + int minLen, size; int sign = 1; if (map->flags & CLF_SIGNED) { if (*p == '+') { yyInput = ++p; } else if (*p == '-') { yyInput = ++p; sign = -1; }; } + DetermineGreedySearchLen(opts, info, tok, &minLen, &size); /* greedy find digits (look for forward digits consider spaces), * corresponding pre-calculated lookAhead */ - if (size != map->minSize && tok->lookAhead) { + if (size != minLen && tok->lookAhead) { int spcnt = 0; const char *pe; size += tok->lookAhead; @@ -1845,6 +1874,12 @@ ClockScan( goto done; break; }; + /* decrement count for possible spaces in match */ + while (p < yyInput) { + if (isspace(UCHAR(*p++))) { + yySpaceCount--; + } + } p = yyInput; flags = (flags & ~map->clearFlags) | map->flags; break; @@ -1855,9 +1890,11 @@ ClockScan( /* unmatched -> error */ goto not_match; } + yySpaceCount--; p++; } while (p < end && isspace(UCHAR(*p))) { + yySpaceCount--; p++; } break; @@ -1875,27 +1912,25 @@ ClockScan( /* no match -> error */ goto not_match; } + if (isspace(UCHAR(*x))) { + yySpaceCount--; + } p++; break; } } /* check end was reached */ if (p < end) { - /* ignore spaces at end */ - while (p < end && isspace(UCHAR(*p))) { - p++; - } - if (p < end) { - /* something after last token - wrong format */ - goto not_match; - } + /* something after last token - wrong format */ + goto not_match; } /* end of string, check only optional tokens at end, otherwise - not match */ while (tok->map != NULL) { if (!(opts->flags & CLF_STRICT) && (tok->map->type == CTOKT_SPACE)) { tok++; + if (tok->map == NULL) break; } - if (tok->map != NULL && !(tok->map->flags & CLF_OPTIONAL)) { + if (!(tok->map->flags & CLF_OPTIONAL)) { goto not_match; } tok++; diff --git a/generic/tclDate.h b/generic/tclDate.h index 2ce629d..519a3e5 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -204,6 +204,7 @@ typedef struct DateInfo { time_t *dateRelPointer; + time_t dateSpaceCount; time_t dateDigitCount; time_t dateCentury; @@ -241,6 +242,7 @@ typedef struct DateInfo { #define yyRelPointer (info->dateRelPointer) #define yyInput (info->dateInput) #define yyDigitCount (info->dateDigitCount) +#define yySpaceCount (info->dateSpaceCount) inline void ClockInitDateInfo(DateInfo *info) { diff --git a/tests/clock.test b/tests/clock.test index 4b0587a..46a2b29 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18638,6 +18638,43 @@ test clock-6.21.3 {Stardate correct scan over year (leap year, begin, middle and unset -nocomplain wrong i i2 s d } +test clock-6.22.1 {Greedy match} { + clock format [clock scan "111" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Mon Jan 01 00:00:00 GMT 2001} +test clock-6.22.2 {Greedy match} { + clock format [clock scan "1111" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Thu Jan 11 00:00:00 GMT 2001} +test clock-6.22.3 {Greedy match} { + clock format [clock scan "11111" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Sun Nov 11 00:00:00 GMT 2001} +test clock-6.22.4 {Greedy match} { + clock format [clock scan "111111" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Fri Nov 11 00:00:00 GMT 2011} +test clock-6.22.5 {Greedy match} { + clock format [clock scan "1 1 1" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Mon Jan 01 00:00:00 GMT 2001} +test clock-6.22.6 {Greedy match} { + clock format [clock scan "111 1" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Thu Jan 11 00:00:00 GMT 2001} +test clock-6.22.7 {Greedy match} { + clock format [clock scan "1 111" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Thu Nov 01 00:00:00 GMT 2001} +test clock-6.22.8 {Greedy match} { + clock format [clock scan "1 11 1" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Thu Nov 01 00:00:00 GMT 2001} +test clock-6.22.9 {Greedy match} { + clock format [clock scan "1 11 11" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Tue Nov 01 00:00:00 GMT 2011} +test clock-6.22.10 {Greedy match} { + clock format [clock scan "11 11 11" -format "%d%m%y" -gmt 1] -locale en -gmt 1 +} {Fri Nov 11 00:00:00 GMT 2011} +test clock-6.22.11 {Greedy match} { + clock format [clock scan "1111 120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Sat Jan 01 01:02:00 GMT 2011} +test clock-6.22.12 {Greedy match} { + clock format [clock scan "11 1 120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Mon Jan 01 01:02:00 GMT 2001} + test clock-7.1 {Julian Day} { clock scan 0 -format %J -gmt true -- cgit v0.12 From 264cc47fd4ff7109cc19d544d1102b011b6183b0 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:52:44 +0000 Subject: another way to make greedy search more precise, some greedy matches are fixed (see test cases clock-6.22.11 - clock-6.22.20), additionally involving look ahead token of known type into pre-search process. --- generic/tclClockFmt.c | 273 ++++++++++++++++++++++++++++++++++---------------- generic/tclDate.h | 7 +- tests/clock.test | 41 ++++++-- 3 files changed, 224 insertions(+), 97 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 00ea0ed..680e33d 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -713,49 +713,127 @@ clean: return (opts->formatObj = valObj); } +static const char * +FindTokenBegin( + register const char *p, + register const char *end, + ClockScanToken *tok) +{ + char c; + if (p < end) { + /* next token a known token type */ + switch (tok->map->type) { + case CTOKT_DIGIT: + /* should match at least one digit */ + while (!isdigit(UCHAR(*p)) && (p = TclUtfNext(p)) < end) {}; + return p; + break; + case CTOKT_WORD: + c = *(tok->tokWord.start); + /* should match at least to the first char of this word */ + while (*p != c && (p = TclUtfNext(p)) < end) {}; + return p; + break; + case CTOKT_SPACE: + while (!isspace(UCHAR(*p)) && (p = TclUtfNext(p)) < end) {}; + return p; + break; + case CTOKT_CHAR: + c = *((char *)tok->map->data); + while (*p != c && (p = TclUtfNext(p)) < end) {}; + return p; + break; + } + } + return p; +} + /* * DetermineGreedySearchLen -- * * Determine min/max lengths as exact as possible (speed, greedy match) * */ -inline -void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, - DateInfo *info, ClockScanToken *tok, int *minLen, int *maxLen) +static void +DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok, + int *minLenPtr, int *maxLenPtr) { - register const char *p = yyInput, + register int minLen = tok->map->minSize; + register int maxLen; + register const char *p = yyInput + minLen, *end = info->dateEnd; - *minLen = 0; - /* if still tokens available */ + /* if still tokens available, try to correct minimum length */ if ((tok+1)->map) { end -= tok->endDistance + yySpaceCount; - /* next token is a word */ - switch ((tok+1)->map->type) { - case CTOKT_WORD: - /* should match at least to the first char of this word */ - while (*p != *((tok+1)->tokWord.start) && ++p < end) {}; - *minLen = p - yyInput; - break; - case CTOKT_CHAR: - while (*p != *((char *)(tok+1)->map->data) && ++p < end) {}; - *minLen = p - yyInput; - break; + /* find position of next known token */ + p = FindTokenBegin(p, end, tok+1); + if (p < end) { + minLen = p - yyInput; } } /* max length to the end regarding distance to end (min-width of following tokens) */ - *maxLen = end - p; - if (*maxLen > tok->map->maxSize) { - *maxLen = tok->map->maxSize; + maxLen = end - yyInput; + /* several amendments */ + if (maxLen > tok->map->maxSize) { + maxLen = tok->map->maxSize; }; - - if (*minLen < tok->map->minSize) { - *minLen = tok->map->minSize; + if (minLen < tok->map->minSize) { + minLen = tok->map->minSize; } - if (*minLen > *maxLen) { - *maxLen = *minLen; + if (minLen > maxLen) { + maxLen = minLen; + } + if (maxLen > info->dateEnd - yyInput) { + maxLen = info->dateEnd - yyInput; + } + + /* check digits rigth now */ + if (tok->map->type == CTOKT_DIGIT) { + p = yyInput; + end = p + maxLen; + if (end > info->dateEnd) { end = info->dateEnd; }; + while (isdigit(UCHAR(*p)) && p < end) { p++; }; + maxLen = p - yyInput; + } + + /* try to get max length more precise for greedy match, + * check the next ahead token available there */ + if (minLen < maxLen && tok->lookAhTok) { + ClockScanToken *laTok = tok + tok->lookAhTok + 1; + p = yyInput + maxLen; + /* regards all possible spaces here (because they are optional) */ + end = p + tok->lookAhMax + yySpaceCount + 1; + if (end > info->dateEnd) { + end = info->dateEnd; + } + p += tok->lookAhMin; + if (laTok->map && p < end) { + const char *f; + /* try to find laTok between [lookAhMin, lookAhMax] */ + while (minLen < maxLen) { + f = FindTokenBegin(p, end, laTok); + /* if found (not below lookAhMax) */ + if (f < end) { + break; + } + /* try again with fewer length */ + maxLen--; + p--; + end--; + } + } else if (p > end) { + maxLen -= (p - end); + if (maxLen < minLen) { + maxLen = minLen; + } + } } + + *minLenPtr = minLen; + *maxLenPtr = maxLen; } inline int @@ -1447,9 +1525,9 @@ static ClockScanTokenMap ScnSTokenMap[] = { {CTOKT_DIGIT, CLF_POSIXSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.seconds), NULL}, /* %n */ - {CTOKT_CHAR, 0, 0, 0, 1, 0, NULL, "\n"}, /* min=0 - spaces are optional (in yySpaceCount) */ + {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\n"}, /* %t */ - {CTOKT_CHAR, 0, 0, 0, 1, 0, NULL, "\t"}, /* min=0 - spaces are optional (in yySpaceCount) */ + {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\t"}, /* %Q */ {CTOKT_PARSER, CLF_LOCALSEC, 0, 16, 30, 0, ClockScnToken_StarDate_Proc, NULL}, @@ -1510,12 +1588,12 @@ static const char *ScnOTokenMapAliasIndex[2] = { static const char *ScnSpecTokenMapIndex = " "; static ClockScanTokenMap ScnSpecTokenMap[] = { - {CTOKT_SPACE, 0, 0, 0, 0xffff, 0, /* min=0 - spaces are optional (in yySpaceCount) */ + {CTOKT_SPACE, 0, 0, 1, 1, 0, NULL}, }; static ClockScanTokenMap ScnWordTokenMap = { - CTOKT_WORD, 0, 0, 1, 0xffff, 0, + CTOKT_WORD, 0, 0, 1, 1, 0, NULL }; @@ -1559,7 +1637,7 @@ EstimateTokenCount( /* *---------------------------------------------------------------------- */ -ClockScanToken * +ClockFmtScnStorage * ClockGetOrParseScanFormat( Tcl_Interp *interp, /* Tcl interpreter */ Tcl_Obj *formatObj) /* Format container */ @@ -1574,6 +1652,7 @@ ClockGetOrParseScanFormat( /* if first time scanning - tokenize format */ if (fss->scnTok == NULL) { + unsigned int tokCnt; register const char *p, *e, *cp; e = p = HashEntry4FmtScn(fss)->key.string; @@ -1581,11 +1660,14 @@ ClockGetOrParseScanFormat( /* estimate token count by % char and format length */ fss->scnTokC = EstimateTokenCount(p, e); + + fss->scnSpaceCount = 0; Tcl_MutexLock(&ClockFmtMutex); fss->scnTok = tok = ckalloc(sizeof(*tok) * fss->scnTokC); memset(tok, 0, sizeof(*(tok))); + tokCnt = 1; while (p < e) { switch (*p) { case '%': @@ -1605,7 +1687,7 @@ ClockGetOrParseScanFormat( tok->map = &ScnWordTokenMap; tok->tokWord.start = p; tok->tokWord.end = p+1; - AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; p++; continue; break; @@ -1642,21 +1724,31 @@ ClockGetOrParseScanFormat( } tok->map = &scnMap[cp - mapIndex]; tok->tokWord.start = p; + /* calculate look ahead value by standing together tokens */ - if (tok > fss->scnTok && tok->map->minSize) { - unsigned int lookAhead = tok->map->minSize; + if (tok > fss->scnTok) { ClockScanToken *prevTok = tok - 1; while (prevTok >= fss->scnTok) { if (prevTok->map->type != tok->map->type) { break; } - prevTok->lookAhead += lookAhead; + prevTok->lookAhMin += tok->map->minSize; + prevTok->lookAhMax += tok->map->maxSize; + prevTok->lookAhTok++; prevTok--; } } + + /* increase space count used in format */ + if ( tok->map->type == CTOKT_CHAR + && isspace(UCHAR(*((char *)tok->map->data))) + ) { + fss->scnSpaceCount++; + } + /* next token */ - AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; p++; continue; } @@ -1668,7 +1760,10 @@ ClockGetOrParseScanFormat( goto word_tok; } tok->map = &ScnSpecTokenMap[cp - ScnSpecTokenMapIndex]; - AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + /* increase space count used in format */ + fss->scnSpaceCount++; + /* next token */ + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; p++; continue; break; @@ -1679,10 +1774,14 @@ word_tok: if (tok > fss->scnTok && (tok-1)->map == &ScnWordTokenMap) { wordTok = tok-1; } + /* new word token */ if (wordTok == tok) { wordTok->tokWord.start = p; wordTok->map = &ScnWordTokenMap; - AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; + } + if (isspace(UCHAR(*p))) { + fss->scnSpaceCount++; } p = TclUtfNext(p); wordTok->tokWord.end = p; @@ -1705,12 +1804,22 @@ word_tok: } prevTok--; } - } + } + + /* correct count of real used tokens and free mem if desired + * (1 is acceptable delta to prevent memory fragmentation) */ + if (fss->scnTokC > tokCnt + (CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE / 2)) { + if ( (tok = ckrealloc(fss->scnTok, tokCnt * sizeof(*tok))) != NULL ) { + fss->scnTok = tok; + } + } + fss->scnTokC = tokCnt; + done: Tcl_MutexUnlock(&ClockFmtMutex); } - return fss->scnTok; + return fss; } /* @@ -1723,6 +1832,7 @@ ClockScan( ClockFmtScnCmdArgs *opts) /* Command options */ { ClockClientData *dataPtr = opts->clientData; + ClockFmtScnStorage *fss; ClockScanToken *tok; ClockScanTokenMap *map; register const char *p, *x, *end; @@ -1734,8 +1844,9 @@ ClockScan( return TCL_ERROR; } - if ((tok = ClockGetOrParseScanFormat(opts->interp, - opts->formatObj)) == NULL) { + if ( !(fss = ClockGetOrParseScanFormat(opts->interp, opts->formatObj)) + || !(tok = fss->scnTok) + ) { return TCL_ERROR; } @@ -1766,6 +1877,11 @@ ClockScan( /* ignore spaces at end */ yySpaceCount -= (end - x); end = x; + /* ignore mandatory spaces used in format */ + yySpaceCount -= fss->scnSpaceCount; + if (yySpaceCount < 0) { + yySpaceCount = 0; + } info->dateStart = p = yyInput; info->dateEnd = end; @@ -1799,39 +1915,9 @@ ClockScan( else if (*p == '-') { yyInput = ++p; sign = -1; }; } + DetermineGreedySearchLen(opts, info, tok, &minLen, &size); - /* greedy find digits (look for forward digits consider spaces), - * corresponding pre-calculated lookAhead */ - if (size != minLen && tok->lookAhead) { - int spcnt = 0; - const char *pe; - size += tok->lookAhead; - x = p + size; if (x > end) { x = end; }; - pe = x; - while (p < x) { - if (isspace(UCHAR(*p))) { - if (pe > p) { pe = p; }; - if (x < end) x++; - p++; - spcnt++; - continue; - } - if (isdigit(UCHAR(*p))) { - p++; - continue; - } - break; - } - /* consider reserved (lookAhead) for next tokens */ - p -= tok->lookAhead + spcnt; - if (p > pe) { - p = pe; - } - } else { - x = p + size; if (x > end) { x = end; }; - while (isdigit(UCHAR(*p)) && p < x) { p++; }; - } - size = p - yyInput; + if (size < map->minSize) { /* missing input -> error */ if ((map->flags & CLF_OPTIONAL)) { @@ -1884,15 +1970,13 @@ ClockScan( flags = (flags & ~map->clearFlags) | map->flags; break; case CTOKT_SPACE: - /* at least one space in strict mode */ - if (opts->flags & CLF_STRICT) { - if (!isspace(UCHAR(*p))) { - /* unmatched -> error */ - goto not_match; - } - yySpaceCount--; - p++; + /* at least one space */ + if (!isspace(UCHAR(*p))) { + /* unmatched -> error */ + goto not_match; } + yySpaceCount--; + p++; while (p < end && isspace(UCHAR(*p))) { yySpaceCount--; p++; @@ -2460,7 +2544,7 @@ static ClockFormatTokenMap FmtWordTokenMap = { /* *---------------------------------------------------------------------- */ -ClockFormatToken * +ClockFmtScnStorage * ClockGetOrParseFmtFormat( Tcl_Interp *interp, /* Tcl interpreter */ Tcl_Obj *formatObj) /* Format container */ @@ -2475,6 +2559,7 @@ ClockGetOrParseFmtFormat( /* if first time scanning - tokenize format */ if (fss->fmtTok == NULL) { + unsigned int tokCnt; register const char *p, *e, *cp; e = p = HashEntry4FmtScn(fss)->key.string; @@ -2487,6 +2572,7 @@ ClockGetOrParseFmtFormat( fss->fmtTok = tok = ckalloc(sizeof(*tok) * fss->fmtTokC); memset(tok, 0, sizeof(*(tok))); + tokCnt = 1; while (p < e) { switch (*p) { case '%': @@ -2506,7 +2592,7 @@ ClockGetOrParseFmtFormat( tok->map = &FmtWordTokenMap; tok->tokWord.start = p; tok->tokWord.end = p+1; - AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); tokCnt++; p++; continue; break; @@ -2544,7 +2630,7 @@ ClockGetOrParseFmtFormat( tok->map = &fmtMap[cp - mapIndex]; tok->tokWord.start = p; /* next token */ - AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); tokCnt++; p++; continue; } @@ -2559,7 +2645,7 @@ word_tok: if (wordTok == tok) { wordTok->tokWord.start = p; wordTok->map = &FmtWordTokenMap; - AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); tokCnt++; } p = TclUtfNext(p); wordTok->tokWord.end = p; @@ -2568,11 +2654,20 @@ word_tok: } } + /* correct count of real used tokens and free mem if desired + * (1 is acceptable delta to prevent memory fragmentation) */ + if (fss->fmtTokC > tokCnt + (CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE / 2)) { + if ( (tok = ckrealloc(fss->fmtTok, tokCnt * sizeof(*tok))) != NULL ) { + fss->fmtTok = tok; + } + } + fss->fmtTokC = tokCnt; + done: Tcl_MutexUnlock(&ClockFmtMutex); } - return fss->fmtTok; + return fss; } /* @@ -2584,6 +2679,7 @@ ClockFormat( ClockFmtScnCmdArgs *opts) /* Command options */ { ClockClientData *dataPtr = opts->clientData; + ClockFmtScnStorage *fss; ClockFormatToken *tok; ClockFormatTokenMap *map; @@ -2592,8 +2688,9 @@ ClockFormat( return TCL_ERROR; } - if ((tok = ClockGetOrParseFmtFormat(opts->interp, - opts->formatObj)) == NULL) { + if ( !(fss = ClockGetOrParseFmtFormat(opts->interp, opts->formatObj)) + || !(tok = fss->fmtTok) + ) { return TCL_ERROR; } diff --git a/generic/tclDate.h b/generic/tclDate.h index 519a3e5..c50753d 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -375,12 +375,14 @@ typedef struct ClockScanTokenMap { typedef struct ClockScanToken { ClockScanTokenMap *map; - unsigned short int lookAhead; - unsigned short int endDistance; struct { const char *start; const char *end; } tokWord; + unsigned short int endDistance; + unsigned short int lookAhMin; + unsigned short int lookAhMax; + unsigned short int lookAhTok; } ClockScanToken; @@ -435,6 +437,7 @@ typedef struct ClockFmtScnStorage { int objRefCount; /* Reference count shared across threads */ ClockScanToken *scnTok; unsigned int scnTokC; + unsigned int scnSpaceCount; /* Count of mandatory spaces used in format */ ClockFormatToken *fmtTok; unsigned int fmtTokC; #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 diff --git a/tests/clock.test b/tests/clock.test index 46a2b29..d9c491a 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18588,16 +18588,16 @@ test clock-6.16 {input of ambiguous short locale token (%b)} { } {1 {input string does not match supplied format} {CLOCK badInputString}} test clock-6.17 {spaces are always optional in non-strict mode (default)} { - list [clock scan "2009-06-30T18:30:00+02:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ - [clock scan "2009-06-30T18:30:00 +02:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ - [clock scan "2009-06-30T18:30:00Z" -format "%Y-%m-%dT%H:%M:%S %z" -timezone CET] \ - [clock scan "2009-06-30T18:30:00 Z" -format "%Y-%m-%dT%H:%M:%S %z" -timezone CET] + list [clock scan "2009-06-30T18:30:00+02:00" -format "%Y-%m-%dT%H:%M:%S%z" -gmt 1] \ + [clock scan "2009-06-30T18:30:00 +02:00" -format "%Y-%m-%dT%H:%M:%S%z" -gmt 1] \ + [clock scan "2009-06-30T18:30:00Z" -format "%Y-%m-%dT%H:%M:%S%z" -timezone CET] \ + [clock scan "2009-06-30T18:30:00 Z" -format "%Y-%m-%dT%H:%M:%S%z" -timezone CET] } {1246379400 1246379400 1246386600 1246386600} test clock-6.18 {zone token (%z) is optional} { - list [clock scan "2009-06-30T18:30:00 -01:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ - [clock scan "2009-06-30T18:30:00" -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ - [clock scan " 2009-06-30T18:30:00 " -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1] \ + list [clock scan "2009-06-30T18:30:00 -01:00" -format "%Y-%m-%dT%H:%M:%S%z" -gmt 1] \ + [clock scan "2009-06-30T18:30:00" -format "%Y-%m-%dT%H:%M:%S%z" -gmt 1] \ + [clock scan " 2009-06-30T18:30:00 " -format "%Y-%m-%dT%H:%M:%S%z" -gmt 1] \ } {1246390200 1246386600 1246386600} test clock-6.19 {no token parsing} { @@ -18674,6 +18674,33 @@ test clock-6.22.11 {Greedy match} { test clock-6.22.12 {Greedy match} { clock format [clock scan "11 1 120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 } {Mon Jan 01 01:02:00 GMT 2001} +test clock-6.22.13 {Greedy match} { + clock format [clock scan "1 11 120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Mon Jan 01 01:02:00 GMT 2001} +test clock-6.22.14 {Greedy match} { + clock format [clock scan "111120" -format "%y%m%d%H%M%S" -gmt 1] -locale en -gmt 1 +} {Mon Jan 01 01:02:00 GMT 2001} +test clock-6.22.15 {Greedy match} { + clock format [clock scan "1111120" -format "%y%m%d%H%M%S" -gmt 1] -locale en -gmt 1 +} {Sat Jan 01 01:02:00 GMT 2011} +test clock-6.22.16 {Greedy match} { + clock format [clock scan "11121120" -format "%y%m%d%H%M%S" -gmt 1] -locale en -gmt 1 +} {Thu Dec 01 01:02:00 GMT 2011} +test clock-6.22.17 {Greedy match} { + clock format [clock scan "111213120" -format "%y%m%d%H%M%S" -gmt 1] -locale en -gmt 1 +} {Tue Dec 13 01:02:00 GMT 2011} +test clock-6.22.17 {Greedy match (space wins as date-time separator)} { + clock format [clock scan "1112 13120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Sun Jan 02 13:12:00 GMT 2011} +test clock-6.22.18 {Greedy match (second space wins as date-time separator)} { + clock format [clock scan "1112 13 120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Tue Dec 13 01:02:00 GMT 2011} +test clock-6.22.19 {Greedy match (space wins as date-time separator)} { + clock format [clock scan "111 213120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Mon Jan 01 21:31:20 GMT 2001} +test clock-6.22.20 {Greedy match (second space wins as date-time separator)} { + clock format [clock scan "111 2 13120" -format "%y%m%d %H%M%S" -gmt 1] -locale en -gmt 1 +} {Sun Jan 02 13:12:00 GMT 2011} test clock-7.1 {Julian Day} { -- cgit v0.12 From 27fd5c0793a7bf5332cd99885869ae7e79d66dfb Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:53:05 +0000 Subject: dict: unused variable removed --- generic/tclDictObj.c | 1 - 1 file changed, 1 deletion(-) diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 3944173..8e11bfe 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -2014,7 +2014,6 @@ DictSmartRefCmd( Tcl_Obj *const *objv) { Tcl_Obj *result; - Dict *dict; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "dictionary"); -- cgit v0.12 From d551c0972c261cc3a69b07263ae3c8072d929a50 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:55:00 +0000 Subject: [unix] build for *nix fixed, code clean-ups; missing declarations; unused vars, functions etc; types normalization; --- generic/tclClock.c | 6 +--- generic/tclClockFmt.c | 31 ++++++++++--------- generic/tclDate.c | 8 ++--- generic/tclDate.h | 80 +++++++++++++++++++++++++------------------------ generic/tclGetDate.y | 8 ++--- generic/tclStrIdxTree.c | 8 ++--- generic/tclStrIdxTree.h | 8 ++--- unix/Makefile.in | 4 +-- 8 files changed, 77 insertions(+), 76 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 7d4263c..1b1faae 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -137,10 +137,6 @@ static unsigned long TzsetGetEpoch(void); static void TzsetIfNecessary(void); static void ClockDeleteCmdProc(ClientData); -static int ClockTestObjCmd( - ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); - /* * Structure containing description of "native" clock commands to create. */ @@ -3365,7 +3361,7 @@ repeat_rel: /* relative time (seconds), if exceeds current date, do the day conversion and * leave rest of the increment in yyRelSeconds to add it hereafter in UTC seconds */ if (yyRelSeconds) { - time_t newSecs = yySeconds + yyRelSeconds; + int newSecs = yySeconds + yyRelSeconds; /* if seconds increment outside of current date, increment day */ if (newSecs / SECONDS_PER_DAY != yySeconds / SECONDS_PER_DAY) { diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 680e33d..a5ddd18 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -43,13 +43,13 @@ CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); inline int _str2int( - time_t *out, + int *out, register const char *p, const char *e, int sign) { - register time_t val = 0, prev = 0; + register int val = 0, prev = 0; if (sign >= 0) { while (p < e) { val = val * 10 + (*p++ - '0'); @@ -880,6 +880,7 @@ ObjListSearch(ClockFmtScnCmdArgs *opts, } return TCL_RETURN; } +#if 0 static int LocaleListSearch(ClockFmtScnCmdArgs *opts, @@ -905,6 +906,7 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, return ObjListSearch(opts, info, val, lstv, lstc, minLen, maxLen); } +#endif static TclStrIdxTree * ClockMCGetListIdxTree( @@ -1039,6 +1041,7 @@ ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, return TCL_OK; } +#if 0 static int StaticListSearch(ClockFmtScnCmdArgs *opts, @@ -1062,6 +1065,7 @@ StaticListSearch(ClockFmtScnCmdArgs *opts, } return TCL_RETURN; } +#endif inline const char * FindWordEnd( @@ -1069,7 +1073,7 @@ FindWordEnd( register const char * p, const char * end) { register const char *x = tok->tokWord.start; - const char *pfnd; + const char *pfnd = p; if (x == tok->tokWord.end - 1) { /* fast phase-out for single char word */ if (*p == *x) { return ++p; @@ -1088,14 +1092,14 @@ static int ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { - /* +#if 0 static const char * months[] = { - /* full * / + /* full */ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", - /* abbr * / + /* abbr */ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL @@ -1106,7 +1110,7 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, } yyMonth = (val % 12) + 1; return TCL_OK; - */ +#endif static int monthsKeys[] = {MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, 0}; @@ -1300,7 +1304,7 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, } if (tok->map->offs > 0) { - *(time_t *)(((char *)info) + tok->map->offs) = val; + *(int *)(((char *)info) + tok->map->offs) = val; } return TCL_OK; @@ -1334,7 +1338,7 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, *bp++ = *p++; len++; if (len + 2 < maxLen) { if (*p == ':') { - *p++; len++; + p++; len++; } } } @@ -1392,7 +1396,7 @@ ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, { int minLen, maxLen; register const char *p = yyInput, *end; const char *s; - time_t year, fractYear, fractDayDiv, fractDay; + int year, fractYear, fractDayDiv, fractDay; static const char *stardatePref = "stardate "; DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); @@ -1626,7 +1630,7 @@ EstimateTokenCount( #define AllocTokenInChain(tok, chain, tokCnt) \ if (++(tok) >= (chain) + (tokCnt)) { \ - (char *)(chain) = ckrealloc((char *)(chain), \ + *((char **)&chain) = ckrealloc((char *)(chain), \ (tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \ if ((chain) == NULL) { goto done; }; \ (tok) = (chain) + (tokCnt); \ @@ -1929,7 +1933,7 @@ ClockScan( if (map->offs) { p = yyInput; x = p + size; if (!(map->flags & (CLF_LOCALSEC|CLF_POSIXSEC))) { - if (_str2int((time_t *)(((char *)info) + map->offs), + if (_str2int((int *)(((char *)info) + map->offs), p, x, sign) != TCL_OK) { goto overflow; } @@ -2678,7 +2682,6 @@ ClockFormat( register DateFormat *dateFmt, /* Date fields used for parsing & converting */ ClockFmtScnCmdArgs *opts) /* Command options */ { - ClockClientData *dataPtr = opts->clientData; ClockFmtScnStorage *fss; ClockFormatToken *tok; ClockFormatTokenMap *map; @@ -2716,7 +2719,7 @@ ClockFormat( { case CFMTT_INT: if (1) { - int val = (int)*(time_t *)(((char *)dateFmt) + map->offs); + int val = (int)*(int *)(((char *)dateFmt) + map->offs); if (map->fmtproc == NULL) { if (map->flags & CLFMT_DECR) { val--; diff --git a/generic/tclDate.c b/generic/tclDate.c index 5bd96d0..64cb804 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -2448,11 +2448,11 @@ TclDateerror( infoPtr->separatrix = "\n"; } -time_t +MODULE_SCOPE int ToSeconds( - time_t Hours, - time_t Minutes, - time_t Seconds, + int Hours, + int Minutes, + int Seconds, MERIDIAN Meridian) { if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59) { diff --git a/generic/tclDate.h b/generic/tclDate.h index c50753d..c9c6726 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -142,21 +142,21 @@ typedef struct TclDateFields { * epoch */ Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds * from the Posix epoch */ - time_t tzOffset; /* Time zone offset in seconds east of + int tzOffset; /* Time zone offset in seconds east of * Greenwich */ - time_t julianDay; /* Julian Day Number in local time zone */ + int julianDay; /* Julian Day Number in local time zone */ enum {BCE=1, CE=0} era; /* Era */ - time_t gregorian; /* Flag == 1 if the date is Gregorian */ - time_t year; /* Year of the era */ - time_t dayOfYear; /* Day of the year (1 January == 1) */ - time_t month; /* Month number */ - time_t dayOfMonth; /* Day of the month */ - time_t iso8601Year; /* ISO8601 week-based year */ - time_t iso8601Week; /* ISO8601 week number */ - time_t dayOfWeek; /* Day of the week */ - time_t hour; /* Hours of day (in-between time only calculation) */ - time_t minutes; /* Minutes of day (in-between time only calculation) */ - time_t secondOfDay; /* Seconds of day (in-between time only calculation) */ + int gregorian; /* Flag == 1 if the date is Gregorian */ + int year; /* Year of the era */ + int dayOfYear; /* Day of the year (1 January == 1) */ + int month; /* Month number */ + int dayOfMonth; /* Day of the month */ + int iso8601Year; /* ISO8601 week-based year */ + int iso8601Week; /* ISO8601 week number */ + int dayOfWeek; /* Day of the week */ + int hour; /* Hours of day (in-between time only calculation) */ + int minutes; /* Minutes of day (in-between time only calculation) */ + int secondOfDay; /* Seconds of day (in-between time only calculation) */ /* Non cacheable fields: */ @@ -180,34 +180,34 @@ typedef struct DateInfo { int flags; - time_t dateHaveDate; + int dateHaveDate; - time_t dateMeridian; - time_t dateHaveTime; + int dateMeridian; + int dateHaveTime; - time_t dateTimezone; - time_t dateDSTmode; - time_t dateHaveZone; + int dateTimezone; + int dateDSTmode; + int dateHaveZone; - time_t dateRelMonth; - time_t dateRelDay; - time_t dateRelSeconds; - time_t dateHaveRel; + int dateRelMonth; + int dateRelDay; + int dateRelSeconds; + int dateHaveRel; - time_t dateMonthOrdinalIncr; - time_t dateMonthOrdinal; - time_t dateHaveOrdinalMonth; + int dateMonthOrdinalIncr; + int dateMonthOrdinal; + int dateHaveOrdinalMonth; - time_t dateDayOrdinal; - time_t dateDayNumber; - time_t dateHaveDay; + int dateDayOrdinal; + int dateDayNumber; + int dateHaveDay; - time_t *dateRelPointer; + int *dateRelPointer; - time_t dateSpaceCount; - time_t dateDigitCount; + int dateSpaceCount; + int dateDigitCount; - time_t dateCentury; + int dateCentury; Tcl_Obj* messages; /* Error messages */ const char* separatrix; /* String separating messages */ @@ -244,7 +244,7 @@ typedef struct DateInfo { #define yyDigitCount (info->dateDigitCount) #define yySpaceCount (info->dateSpaceCount) -inline void +static inline void ClockInitDateInfo(DateInfo *info) { memset(info, 0, sizeof(DateInfo)); } @@ -314,7 +314,7 @@ typedef struct ClockClientData { Tcl_WideInt seconds; Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ /* values */ - time_t tzOffset; + int tzOffset; Tcl_Obj *tzName; } UTC2Local; /* Las-period cache for fast Local2UTC conversion */ @@ -325,7 +325,7 @@ typedef struct ClockClientData { Tcl_WideInt localSeconds; Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ /* values */ - time_t tzOffset; + int tzOffset; } Local2UTC; } ClockClientData; @@ -444,16 +444,18 @@ typedef struct ClockFmtScnStorage { ClockFmtScnStorage *nextPtr; ClockFmtScnStorage *prevPtr; #endif -/* +Tcl_HashEntry hashEntry /* ClockFmtScnStorage is a derivate of Tcl_HashEntry, +#if 0 + +Tcl_HashEntry hashEntry /* ClockFmtScnStorage is a derivate of Tcl_HashEntry, * stored by offset +sizeof(self) */ +#endif } ClockFmtScnStorage; /* * Prototypes of module functions. */ -MODULE_SCOPE time_t ToSeconds(time_t Hours, time_t Minutes, - time_t Seconds, MERIDIAN Meridian); +MODULE_SCOPE int ToSeconds(int Hours, int Minutes, + int Seconds, MERIDIAN Meridian); MODULE_SCOPE int IsGregorianLeapYear(TclDateFields *); MODULE_SCOPE void GetJulianDayFromEraYearWeekDay( diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 9e3623f..6d6a0d0 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -659,11 +659,11 @@ TclDateerror( infoPtr->separatrix = "\n"; } -time_t +MODULE_SCOPE int ToSeconds( - time_t Hours, - time_t Minutes, - time_t Seconds, + int Hours, + int Minutes, + int Seconds, MERIDIAN Meridian) { if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59) { diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index afb53e5..b47b4b7 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -171,11 +171,11 @@ TclStrIdxTreeInsertBranch( parent->firstPtr = item; if (parent->lastPtr == child) parent->lastPtr = item; - if (item->nextPtr = child->nextPtr) { + if ( (item->nextPtr = child->nextPtr) ) { item->nextPtr->prevPtr = item; child->nextPtr = NULL; } - if (item->prevPtr = child->prevPtr) { + if ( (item->prevPtr = child->prevPtr) ) { item->prevPtr->nextPtr = item; child->prevPtr = NULL; } @@ -365,7 +365,7 @@ StrIdxTreeObj_DupIntRepProc(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) srcPtr = (Tcl_Obj*)srcPtr->internalRep.twoPtrValue.ptr1; } /* create smart pointer to it (ptr1 != NULL, ptr2 = NULL) */ - Tcl_InitObjRef(((Tcl_Obj *)copyPtr->internalRep.twoPtrValue.ptr1), + Tcl_InitObjRef(*((Tcl_Obj **)©Ptr->internalRep.twoPtrValue.ptr1), srcPtr); copyPtr->internalRep.twoPtrValue.ptr2 = NULL; copyPtr->typePtr = &StrIdxTreeObjType; @@ -379,7 +379,7 @@ StrIdxTreeObj_FreeIntRepProc(Tcl_Obj *objPtr) && objPtr->internalRep.twoPtrValue.ptr2 == NULL ) { /* is a link */ - Tcl_UnsetObjRef(((Tcl_Obj *)objPtr->internalRep.twoPtrValue.ptr1)); + Tcl_UnsetObjRef(*((Tcl_Obj **)&objPtr->internalRep.twoPtrValue.ptr1)); } else { /* is a tree */ TclStrIdxTree *tree = (TclStrIdxTree*)&objPtr->internalRep.twoPtrValue.ptr1; diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h index 934e28f..305053c 100644 --- a/generic/tclStrIdxTree.h +++ b/generic/tclStrIdxTree.h @@ -49,7 +49,7 @@ typedef struct TclStrIdx { *---------------------------------------------------------------------- */ -inline const char * +static inline const char * TclUtfFindEqual( register const char *cs, /* UTF string to find in cin. */ register const char *cse, /* End of cs */ @@ -66,7 +66,7 @@ TclUtfFindEqual( return ret; } -inline const char * +static inline const char * TclUtfFindEqualNC( register const char *cs, /* UTF string to find in cin. */ register const char *cse, /* End of cs */ @@ -89,7 +89,7 @@ TclUtfFindEqualNC( return ret; } -inline const char * +static inline const char * TclUtfFindEqualNCInLwr( register const char *cs, /* UTF string (in anycase) to find in cin. */ register const char *cse, /* End of cs */ @@ -111,7 +111,7 @@ TclUtfFindEqualNCInLwr( return ret; } -inline const char * +static inline const char * TclUtfNext( register const char *src) /* The current location in the string. */ { diff --git a/unix/Makefile.in b/unix/Makefile.in index 19ab6ec..9bdcacd 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -292,7 +292,7 @@ XTTEST_OBJS = xtTestInit.o tclTest.o tclTestObj.o tclTestProcBodyObj.o \ GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \ tclAssembly.o tclAsync.o tclBasic.o tclBinary.o tclCkalloc.o \ - tclClock.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o \ + tclClock.o tclClockFmt.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o \ tclCompCmds.o tclCompCmdsGR.o tclCompCmdsSZ.o tclCompExpr.o \ tclCompile.o tclConfig.o tclDate.o tclDictObj.o tclDisassemble.o \ tclEncoding.o tclEnsemble.o \ @@ -304,7 +304,7 @@ GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \ tclObj.o tclOptimize.o tclPanic.o tclParse.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 \ + tclResolve.o tclResult.o tclScan.o tclStringObj.o tclStrIdxTree.o \ tclStrToD.o tclThread.o \ tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o \ tclTimer.o tclTrace.o tclUtf.o tclUtil.o tclVar.o tclZlib.o \ -- cgit v0.12 From bc879a58f2195dd85d8ba603de4a3ae84f1725ec Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:56:13 +0000 Subject: Merge remote-tracking branch 'remotes/fossil/trunk' into sb/trunk-rewrite-clock-in-c; + minor fixes after merge. --- generic/tclClock.c | 3 +-- generic/tclDate.h | 2 +- generic/tclDictObj.c | 50 +++++++++++++++++++++++++++++++---------------- library/msgcat/msgcat.tcl | 2 +- win/makefile.vc | 4 +--- 5 files changed, 37 insertions(+), 24 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 1b1faae..a417758 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -309,8 +309,7 @@ ClockDeleteCmdProc( ClockClientData *data = clientData; int i; - data->refCount--; - if (data->refCount == 0) { + if (data->refCount-- <= 1) { for (i = 0; i < LIT__END; ++i) { Tcl_DecrRefCount(data->literals[i]); } diff --git a/generic/tclDate.h b/generic/tclDate.h index c9c6726..cf307a6 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -275,7 +275,7 @@ typedef struct ClockFmtScnCmdArgs { */ typedef struct ClockClientData { - int refCount; /* Number of live references. */ + size_t refCount; /* Number of live references. */ Tcl_Obj **literals; /* Pool of object literals (common, locale independent). */ Tcl_Obj **mcLiterals; /* Msgcat object literals with mc-keys for search with locale. */ Tcl_Obj **mcLitIdxs; /* Msgcat object indices prefixed with _IDX_, diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 8e11bfe..caebbf1 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -145,7 +145,7 @@ typedef struct Dict { * the entries in the order that they are * created. */ int epoch; /* Epoch counter */ - int refcount; /* Reference counter (see above) */ + size_t refCount; /* Reference counter (see above) */ Tcl_Obj *chain; /* Linked list used for invalidating the * string representations of updated nested * dictionaries. */ @@ -395,7 +395,7 @@ DupDictInternalRep( newDict->epoch = 0; newDict->chain = NULL; - newDict->refcount = 1; + newDict->refCount = 1; /* * Store in the object. @@ -430,8 +430,7 @@ FreeDictInternalRep( { Dict *dict = DICT(dictPtr); - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } dictPtr->typePtr = NULL; @@ -716,7 +715,7 @@ SetDictFromAny( TclFreeIntRep(objPtr); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(objPtr) = dict; objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclDictType; @@ -1120,7 +1119,7 @@ Tcl_DictObjFirst( searchPtr->dictionaryPtr = (Tcl_Dict) dict; searchPtr->epoch = dict->epoch; searchPtr->next = cPtr->nextPtr; - dict->refcount++; + dict->refCount++; if (keyPtrPtr != NULL) { *keyPtrPtr = Tcl_GetHashKey(&dict->table, &cPtr->entry); } @@ -1234,8 +1233,7 @@ Tcl_DictObjDone( if (searchPtr->epoch != -1) { searchPtr->epoch = -1; dict = (Dict *) searchPtr->dictionaryPtr; - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } } @@ -1387,7 +1385,7 @@ Tcl_NewDictObj(void) InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1437,7 +1435,7 @@ Tcl_DbNewDictObj( InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1981,7 +1979,7 @@ Tcl_DictObjSmartRef( result = Tcl_NewObj(); DICT(result) = dict; - dict->refcount++; + dict->refCount++; result->internalRep.twoPtrValue.ptr2 = NULL; result->typePtr = &tclDictType; @@ -2355,7 +2353,7 @@ DictAppendCmd( Tcl_Obj *const *objv) { Tcl_Obj *dictPtr, *valuePtr, *resultPtr; - int i, allocatedDict = 0; + int allocatedDict = 0; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "dictVarName key ?value ...?"); @@ -2380,15 +2378,33 @@ DictAppendCmd( if ((objc > 3) || (valuePtr == NULL)) { /* Only go through append activites when something will change. */ + Tcl_Obj *appendObjPtr = NULL; - if (valuePtr == NULL) { + if (objc > 3) { + /* Something to append */ + + if (objc == 4) { + appendObjPtr = objv[3]; + } else if (TCL_OK != TclStringCatObjv(interp, /* inPlace */ 1, + objc-3, objv+3, &appendObjPtr)) { + return TCL_ERROR; + } + } + + if (appendObjPtr == NULL) { + /* => (objc == 3) => (valuePtr == NULL) */ TclNewObj(valuePtr); - } else if (Tcl_IsShared(valuePtr)) { - valuePtr = Tcl_DuplicateObj(valuePtr); + } else if (valuePtr == NULL) { + valuePtr = appendObjPtr; + appendObjPtr = NULL; } - for (i=3 ; i Date: Tue, 10 Jan 2017 22:58:29 +0000 Subject: test-performance: added calibration of `timerate` to minimize influence of the parasitical execution-overhead by extremely fast execution times --- tests-perf/clock.perf.tcl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index f3b8a10..7b522d0 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -19,11 +19,19 @@ ## set testing defaults: set ::env(TCL_TZ) :CET -## warm-up (load clock.tcl, system zones, locales, etc.): +# warm-up interpeter compiler env, clock platform-related features, +# calibrate timerate measurement functionality: +puts -nonewline "Calibration ... "; flush stdout +puts "done: [lrange \ + [timerate -calibrate {}] \ +0 1]" + +## warm-up test-related features (load clock.tcl, system zones, locales, etc.): clock scan "" -gmt 1 clock scan "" clock scan "" -timezone :CET clock scan "" -format "" -locale en +clock scan "" -format "" -locale de ## ------------------------------------------ @@ -239,6 +247,11 @@ proc test-scan {{reptime 1000}} { {clock scan "2009-06-30T18:30:00Z" -format "%Y-%m-%dT%H:%M:%S%z"} {clock scan "2009-06-30T18:30:00 UTC" -format "%Y-%m-%dT%H:%M:%S %z"} + # Scan : locale date-time (en): + {clock scan "06/30/2009 18:30:15" -format "%x %X" -gmt 1 -locale en} + # Scan : locale date-time (de): + {clock scan "30.06.2009 18:30:15" -format "%x %X" -gmt 1 -locale de} + # Scan : dynamic format (cacheable) {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} -- cgit v0.12 From c2ee1525efb460ab0045d454670d0f4b912aebbe Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 22:59:16 +0000 Subject: [unix] resolving of several warnings (gcc 5.x): - static used in non-static inline function; - x64 int cast on pointer [-Wpointer-to-int-cast]; - (obscure) may be used uninitialized in this function [-Wmaybe-uninitialized]; - TclEnvEpoch initialized and declared extern; --- generic/tclClock.c | 8 ++++---- generic/tclClockFmt.c | 36 ++++++++++++++++++------------------ generic/tclEnv.c | 5 +++-- generic/tclStrIdxTree.c | 2 +- 4 files changed, 26 insertions(+), 25 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a417758..a324b65 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -336,7 +336,7 @@ ClockDeleteCmdProc( /* *---------------------------------------------------------------------- */ -inline Tcl_Obj * +static inline Tcl_Obj * NormTimezoneObj( ClockClientData *dataPtr, /* Client data containing literal pool */ Tcl_Obj *timezoneObj) @@ -383,7 +383,7 @@ NormTimezoneObj( /* *---------------------------------------------------------------------- */ -inline Tcl_Obj * +static inline Tcl_Obj * ClockGetSystemLocale( ClockClientData *dataPtr, /* Opaque pointer to literal pool, etc. */ Tcl_Interp *interp) /* Tcl interpreter */ @@ -397,7 +397,7 @@ ClockGetSystemLocale( /* *---------------------------------------------------------------------- */ -inline Tcl_Obj * +static inline Tcl_Obj * ClockGetCurrentLocale( ClockClientData *dataPtr, /* Client data containing literal pool */ Tcl_Interp *interp) /* Tcl interpreter */ @@ -782,7 +782,7 @@ ClockConfigureObjCmd( /* *---------------------------------------------------------------------- */ -inline Tcl_Obj* +static inline Tcl_Obj * ClockGetTZData( ClientData clientData, /* Opaque pointer to literal pool, etc. */ Tcl_Interp *interp, /* Tcl interpreter */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index a5ddd18..24c0f1d 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -41,7 +41,7 @@ CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); * Clock scan and format facilities. */ -inline int +static inline int _str2int( int *out, register @@ -71,7 +71,7 @@ _str2int( return TCL_OK; } -inline int +static inline int _str2wideInt( Tcl_WideInt *out, register @@ -101,7 +101,7 @@ _str2wideInt( return TCL_OK; } -inline char * +static inline char * _itoaw( char *buf, register int val, @@ -169,7 +169,7 @@ _itoaw( return buf + width; } -inline char * +static inline char * _witoaw( char *buf, register Tcl_WideInt val, @@ -268,7 +268,7 @@ static struct { unsigned int count; } ClockFmtScnStorage_GC = {NULL, NULL, 0}; -inline void +static inline void ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) { /* add new entry */ @@ -291,7 +291,7 @@ ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) ClockFmtScnStorageDelete(delEnt); } } -inline void +static inline void ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) { TclSpliceOut(entry, ClockFmtScnStorage_GC.stackPtr); @@ -311,11 +311,11 @@ ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) static Tcl_HashTable FmtScnHashTable; static int initialized = 0; -inline Tcl_HashEntry * +static inline Tcl_HashEntry * HashEntry4FmtScn(ClockFmtScnStorage *fss) { return (Tcl_HashEntry*)(fss + 1); }; -inline ClockFmtScnStorage * +static inline ClockFmtScnStorage * FmtScn4HashEntry(Tcl_HashEntry *hKeyPtr) { return (ClockFmtScnStorage*)(((char*)hKeyPtr) - sizeof(ClockFmtScnStorage)); }; @@ -836,7 +836,7 @@ DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, *maxLenPtr = maxLen; } -inline int +static inline int ObjListSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, int *val, Tcl_Obj **lstv, int lstc, @@ -1015,7 +1015,7 @@ done: return idxTree; } -inline int +static inline int ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, TclStrIdxTree *idxTree, int *val, int minLen, int maxLen) @@ -1067,7 +1067,7 @@ StaticListSearch(ClockFmtScnCmdArgs *opts, } #endif -inline const char * +static inline const char * FindWordEnd( ClockScanToken *tok, register const char * p, const char * end) @@ -1152,17 +1152,17 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, /* %u %w %Ou %Ow */ if ( curTok != 'a' && curTok != 'A' - && ((minLen <= 1 && maxLen >= 1) || (int)tok->map->data) + && ((minLen <= 1 && maxLen >= 1) || PTR2INT(tok->map->data)) ) { val = -1; - if (!(int)tok->map->data) { + if (PTR2INT(tok->map->data) == 0) { if (*yyInput >= '0' && *yyInput <= '9') { val = *yyInput - '0'; } } else { - idxTree = ClockMCGetListIdxTree(opts, (int)tok->map->data /* mcKey */); + idxTree = ClockMCGetListIdxTree(opts, PTR2INT(tok->map->data) /* mcKey */); if (idxTree == NULL) { return TCL_ERROR; } @@ -1293,7 +1293,7 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, /* get or create tree in msgcat dict */ - idxTree = ClockMCGetListIdxTree(opts, (int)tok->map->data /* mcKey */); + idxTree = ClockMCGetListIdxTree(opts, PTR2INT(tok->map->data) /* mcKey */); if (idxTree == NULL) { return TCL_ERROR; } @@ -1602,7 +1602,7 @@ static ClockScanTokenMap ScnWordTokenMap = { }; -inline unsigned int +static inline unsigned int EstimateTokenCount( register const char *fmt, register const char *end) @@ -2143,7 +2143,7 @@ done: return ret; } -inline int +static inline int FrmResultAllocate( register DateFormat *dateFmt, int len) @@ -2751,7 +2751,7 @@ ClockFormat( } } else { const char *s; - Tcl_Obj * mcObj = ClockMCGet(opts, (int)map->data /* mcKey */); + Tcl_Obj * mcObj = ClockMCGet(opts, PTR2INT(map->data) /* mcKey */); if (mcObj == NULL) { goto error; } diff --git a/generic/tclEnv.c b/generic/tclEnv.c index fd0a8ce..0041a40 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -18,8 +18,9 @@ TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */ -MODULE_SCOPE unsigned long TclEnvEpoch = 0; /* Epoch of the tcl environment - * (if changed with tcl-env). */ +/* MODULE_SCOPE */ +unsigned long TclEnvEpoch = 0; /* Epoch of the tcl environment + * (if changed with tcl-env). */ static struct { int cacheSize; /* Number of env strings in cache. */ diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index b47b4b7..686c1e4 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -93,7 +93,7 @@ TclStrIdxTreeSearch( /* search in tree */ do { - cin = TclGetString(item->key) + offs; + cinf = cin = TclGetString(item->key) + offs; f = TclUtfFindEqualNCInLwr(s, end, cin, cin + item->length, &cinf); /* if something was found */ if (f > s) { -- cgit v0.12 From 8fa2e7802e55c700d1b4b40bcd58da827584ddde Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 23:00:05 +0000 Subject: correct output of total resp. average values considering net execution time (overhead considered) --- tests-perf/clock.perf.tcl | 54 +++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 7b522d0..16664b2 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -46,48 +46,62 @@ proc _test_get_commands {lst} { proc _test_out_total {} { upvar _ _ - if {![llength $_(ittm)]} { + set tcnt [llength $_(itm)] + if {!$tcnt} { puts "" return } set mintm 0x7fffffff set maxtm 0 + set nett 0 + set wtm 0 + set wcnt 0 set i 0 - foreach tm $_(ittm) { + foreach tm $_(itm) { + if {[llength $tm] > 6} { + set nett [expr {$nett + [lindex $tm 6]}] + } + set wtm [expr {$wtm + [lindex $tm 0]}] + set wcnt [expr {$wcnt + [lindex $tm 2]}] + set tm [lindex $tm 0] if {$tm > $maxtm} {set maxtm $tm; set maxi $i} if {$tm < $mintm} {set mintm $tm; set mini $i} incr i } puts [string repeat ** 40] - puts [format "Total %d cases in %.2f sec.:" [llength $_(itcnt)] [expr {[llength $_(itcnt)] * $_(reptime) / 1000.0}]] - lset _(m) 0 [format %.6f [expr [join $_(ittm) +]]] - lset _(m) 2 [expr [join $_(itcnt) +]] - lset _(m) 4 [format %.3f [expr {[lindex $_(m) 2] / ([llength $_(itcnt)] * $_(reptime) / 1000.0)}]] + set s [format "%d cases in %.2f sec." $tcnt [expr {$tcnt * $_(reptime) / 1000.0}]] + if {$nett > 0} { + append s [format " (%.2f nett-sec.)" [expr {$nett / 1000.0}]] + } + puts "Total $s:" + lset _(m) 0 [format %.6f $wtm] + lset _(m) 2 $wcnt + lset _(m) 4 [format %.3f [expr {$wcnt / (($nett ? $nett : ($tcnt * $_(reptime))) / 1000.0)}]] + if {[llength $_(m)] > 6} { + lset _(m) 6 [format %.3f $nett] + } puts $_(m) puts "Average:" - lset _(m) 0 [format %.6f [expr {[lindex $_(m) 0] / [llength $_(itcnt)]}]] - lset _(m) 2 [expr {[lindex $_(m) 2] / [llength $_(itcnt)]}] - lset _(m) 4 [expr {[lindex $_(m) 2] * (1000 / $_(reptime))}] + lset _(m) 0 [format %.6f [expr {[lindex $_(m) 0] / $tcnt}]] + lset _(m) 2 [expr {[lindex $_(m) 2] / $tcnt}] + if {[llength $_(m)] > 6} { + lset _(m) 6 [format %.3f [expr {[lindex $_(m) 6] / $tcnt}]] + lset _(m) 4 [format %.0f [expr {[lindex $_(m) 2] / [lindex $_(m) 6] * 1000}]] + } puts $_(m) puts "Min:" - lset _(m) 0 [lindex $_(ittm) $mini] - lset _(m) 2 [lindex $_(itcnt) $mini] - lset _(m) 2 [lindex $_(itrate) $mini] - puts $_(m) + puts [lindex $_(itm) $mini] puts "Max:" - lset _(m) 0 [lindex $_(ittm) $maxi] - lset _(m) 2 [lindex $_(itcnt) $maxi] - lset _(m) 2 [lindex $_(itrate) $maxi] - puts $_(m) + puts [lindex $_(itm) $maxi] puts [string repeat ** 40] puts "" } proc _test_run {reptime lst {outcmd {puts $_(r)}}} { upvar _ _ - array set _ [list ittm {} itcnt {} itrate {} reptime $reptime] + array set _ [list itm {} reptime $reptime] foreach _(c) [_test_get_commands $lst] { puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" @@ -99,9 +113,7 @@ proc _test_run {reptime lst {outcmd {puts $_(r)}}} { set _(r) [if 1 $_(c)] if {$outcmd ne {}} $outcmd puts [set _(m) [timerate $_(c) $reptime]] - lappend _(ittm) [lindex $_(m) 0] - lappend _(itcnt) [lindex $_(m) 2] - lappend _(itrate) [lindex $_(m) 4] + lappend _(itm) $_(m) puts "" } _test_out_total -- cgit v0.12 From 0a1c05fbb87bf517f2e9a49255351dfde5fc1961 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 23:01:23 +0000 Subject: code review and inline documentation --- generic/tclClock.c | 262 +++++++++++++++++++++++++++++++++++++++++++++--- generic/tclClockFmt.c | 3 + generic/tclDate.h | 7 -- generic/tclDictObj.c | 32 +++++- generic/tclInt.h | 7 ++ generic/tclStrIdxTree.c | 3 +- 6 files changed, 288 insertions(+), 26 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a324b65..fc7c70c 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -167,7 +167,6 @@ static const struct ClockCommand clockCommands[] = { { "GetJulianDayFromEraYearWeekDay", ClockGetjuliandayfromerayearweekdayObjCmd }, { "ParseFormatArgs", ClockParseformatargsObjCmd }, - { "_test", TclStrIdxTreeTestObjCmd }, { NULL, NULL } }; @@ -262,10 +261,11 @@ TclClockInit( /* *---------------------------------------------------------------------- * - * ClockDeleteCmdProc -- + * ClockConfigureClear -- * - * Remove a reference to the clock client data, and clean up memory - * when it's all gone. + * Clean up cached resp. run-time storages used in clock commands. + * + * Shared usage for clean-up (ClockDeleteCmdProc) and "configure -clear". * * Results: * None. @@ -301,7 +301,20 @@ ClockConfigureClear( Tcl_UnsetObjRef(data->UTC2Local.tzName); Tcl_UnsetObjRef(data->Local2UTC.timezoneObj); } - + +/* + *---------------------------------------------------------------------- + * + * ClockDeleteCmdProc -- + * + * Remove a reference to the clock client data, and clean up memory + * when it's all gone. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ static void ClockDeleteCmdProc( ClientData clientData) /* Opaque pointer to the client data */ @@ -335,7 +348,20 @@ ClockDeleteCmdProc( /* *---------------------------------------------------------------------- + * + * NormTimezoneObj -- + * + * Normalizes the timezone object (used for caching puposes). + * + * If already cached time zone could be found, returns this + * object (last setup or last used, system (current) or gmt). + * + * Results: + * Normalized tcl object pointer. + * + *---------------------------------------------------------------------- */ + static inline Tcl_Obj * NormTimezoneObj( ClockClientData *dataPtr, /* Client data containing literal pool */ @@ -411,9 +437,23 @@ ClockGetCurrentLocale( return dataPtr->CurrentLocale; } + /* *---------------------------------------------------------------------- + * + * NormLocaleObj -- + * + * Normalizes the locale object (used for caching puposes). + * + * If already cached locale could be found, returns this + * object (current, system (OS) or last used locales). + * + * Results: + * Normalized tcl object pointer. + * + *---------------------------------------------------------------------- */ + static Tcl_Obj * NormLocaleObj( ClockClientData *dataPtr, /* Client data containing literal pool */ @@ -494,7 +534,21 @@ NormLocaleObj( /* *---------------------------------------------------------------------- + * + * ClockMCDict -- + * + * Retrieves a localized storage dictionary object for the given + * locale object. + * + * This corresponds with call `::tcl::clock::mcget locale`. + * Cached representation stored in options (for further access). + * + * Results: + * Tcl-object contains smart reference to msgcat dictionary. + * + *---------------------------------------------------------------------- */ + MODULE_SCOPE Tcl_Obj * ClockMCDict(ClockFmtScnCmdArgs *opts) { @@ -560,6 +614,21 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) return opts->mcDictObj; } +/* + *---------------------------------------------------------------------- + * + * ClockMCGet -- + * + * Retrieves a msgcat value for the given literal integer mcKey + * from localized storage (corresponding given locale object) + * by mcLiterals[mcKey] (e. g. MONTHS_FULL). + * + * Results: + * Tcl-object contains localized value. + * + *---------------------------------------------------------------------- + */ + MODULE_SCOPE Tcl_Obj * ClockMCGet( ClockFmtScnCmdArgs *opts, @@ -581,6 +650,21 @@ ClockMCGet( return valObj; /* or NULL in obscure case if Tcl_DictObjGet failed */ } +/* + *---------------------------------------------------------------------- + * + * ClockMCGetIdx -- + * + * Retrieves an indexed msgcat value for the given literal integer mcKey + * from localized storage (corresponding given locale object) + * by mcLitIdxs[mcKey] (e. g. _IDX_MONTHS_FULL). + * + * Results: + * Tcl-object contains localized indexed value. + * + *---------------------------------------------------------------------- + */ + MODULE_SCOPE Tcl_Obj * ClockMCGetIdx( ClockFmtScnCmdArgs *opts, @@ -609,6 +693,21 @@ ClockMCGetIdx( return valObj; } + +/* + *---------------------------------------------------------------------- + * + * ClockMCSetIdx -- + * + * Sets an indexed msgcat value for the given literal integer mcKey + * in localized storage (corresponding given locale object) + * by mcLitIdxs[mcKey] (e. g. _IDX_MONTHS_FULL). + * + * Results: + * Returns a standard Tcl result. + * + *---------------------------------------------------------------------- + */ MODULE_SCOPE int ClockMCSetIdx( @@ -639,7 +738,23 @@ ClockMCSetIdx( /* *---------------------------------------------------------------------- + * + * ClockConfigureObjCmd -- + * + * This function is invoked to process the Tcl "clock configure" command. + * + * Usage: + * ::tcl::clock::configure ?-option ?value?? + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- */ + static int ClockConfigureObjCmd( ClientData clientData, /* Client data containing literal pool */ @@ -781,7 +896,20 @@ ClockConfigureObjCmd( /* *---------------------------------------------------------------------- + * + * ClockGetTZData -- + * + * Retrieves tzdata table for given normalized timezone. + * + * Results: + * Returns a tcl object with tzdata. + * + * Side effects: + * The tzdata can be cached in ClockClientData structure. + * + *---------------------------------------------------------------------- */ + static inline Tcl_Obj * ClockGetTZData( ClientData clientData, /* Opaque pointer to literal pool, etc. */ @@ -839,9 +967,20 @@ ClockGetTZData( } return ret; } + /* *---------------------------------------------------------------------- + * + * ClockGetSystemTimeZone -- + * + * Returns system (current) timezone. + * + * Results: + * Returns normalized timezone object. + * + *---------------------------------------------------------------------- */ + static Tcl_Obj * ClockGetSystemTimeZone( ClientData clientData, /* Opaque pointer to literal pool, etc. */ @@ -869,9 +1008,20 @@ ClockGetSystemTimeZone( } return dataPtr->SystemTimeZone; } + /* *---------------------------------------------------------------------- + * + * ClockSetupTimeZone -- + * + * Sets up the timezone. Loads tzdata, etc. + * + * Results: + * Returns normalized timezone object. + * + *---------------------------------------------------------------------- */ + MODULE_SCOPE Tcl_Obj * ClockSetupTimeZone( ClientData clientData, /* Opaque pointer to literal pool, etc. */ @@ -908,20 +1058,22 @@ ClockSetupTimeZone( } return NULL; } + /* *---------------------------------------------------------------------- - * ClockFormatNumericTimeZone - * - * Formats a time zone as +hhmmss + * ClockFormatNumericTimeZone -- + * + * Formats a time zone as +hhmmss * * Parameters: - * z - Time zone in seconds east of Greenwich + * z - Time zone in seconds east of Greenwich * * Results: - * Returns the time zone object (formatted in a numeric form) + * Returns the time zone object (formatted in a numeric form) * * Side effects: - * None. + * None. * *---------------------------------------------------------------------- */ @@ -943,6 +1095,7 @@ ClockFormatNumericTimeZone(int z) { } return Tcl_ObjPrintf("%c%02d%02d", sign, h, m); } + /* *---------------------------------------------------------------------- * @@ -1145,7 +1298,20 @@ ClockGetdatefieldsObjCmd( /* *---------------------------------------------------------------------- + * + * ClockGetDateFields -- + * + * Converts given UTC time (seconds in a TclDateFields structure) + * to local time and determines the values that clock routines will + * use in scanning or formatting a date. + * + * Results: + * Date-time values are stored in structure "fields". + * Returns a standard Tcl result. + * + *---------------------------------------------------------------------- */ + int ClockGetDateFields( ClientData clientData, /* Client data of the interpreter */ @@ -1586,6 +1752,7 @@ ConvertLocalToUTCUsingTable( fields->seconds = fields->localSeconds - fields->tzOffset; #if 0 + /* currently unused, test purposes only */ /* * Convert back from UTC, if local times are different - wrong local time * (local time seems to be in between DST-hole). @@ -2404,9 +2571,24 @@ GetJulianDayFromEraYearMonthDay( + ym1o4; } } + /* *---------------------------------------------------------------------- + * + * GetJulianDayFromEraYearDay -- + * + * Given era, year, and dayOfYear (in TclDateFields), and the + * Gregorian transition date, computes the Julian Day Number. + * + * Results: + * None. + * + * Side effects: + * Stores day number in 'julianDay' + * + *---------------------------------------------------------------------- */ + MODULE_SCOPE void GetJulianDayFromEraYearDay( @@ -2740,6 +2922,19 @@ ClockMicrosecondsObjCmd( return TCL_OK; } +/* + *----------------------------------------------------------------------------- + * + * _ClockParseFmtScnArgs -- + * + * Parses the arguments for [clock scan] and [clock format]. + * + * Results: + * Returns a standard Tcl result, and stores parsed options + * (format, the locale, timezone and base) in structure "opts". + * + *----------------------------------------------------------------------------- + */ static int _ClockParseFmtScnArgs( @@ -2853,9 +3048,7 @@ _ClockParseFmtScnArgs( * Returns a standard Tcl result, whose value is a four-element list * comprising the time format, the locale, and the timezone. * - * This function exists because the loop that parses the [clock format] - * options is a known performance "hot spot", and is implemented in an effort - * to speed that particular code up. + * This function exists for backward compatibility purposes. * *----------------------------------------------------------------------------- */ @@ -2919,7 +3112,20 @@ ClockParseformatargsObjCmd( /*---------------------------------------------------------------------- * - * ClockFormatObjCmd - + * ClockFormatObjCmd -- , clock format -- + * + * This function is invoked to process the Tcl "clock format" command. + * + * Formats a count of seconds since the Posix Epoch as a time of day. + * + * The 'clock format' command formats times of day for output. Refer + * to the user documentation to see what it does. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. * *---------------------------------------------------------------------- */ @@ -3018,7 +3224,20 @@ done: /*---------------------------------------------------------------------- * - * ClockScanObjCmd - + * ClockScanObjCmd -- , clock scan -- + * + * This function is invoked to process the Tcl "clock scan" command. + * + * Inputs a count of seconds since the Posix Epoch as a time of day. + * + * The 'clock scan' command scans times of day on input. Refer to the + * user documentation to see what it does. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. * *---------------------------------------------------------------------- */ @@ -3188,7 +3407,20 @@ done: } /*---------------------------------------------------------------------- + * + * ClockFreeScan -- + * + * Used by ClockScanObjCmd for free scanning without format. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- */ + int ClockFreeScan( ClientData clientData, /* Client data containing literal pool */ diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 24c0f1d..ff16714 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -881,6 +881,7 @@ ObjListSearch(ClockFmtScnCmdArgs *opts, return TCL_RETURN; } #if 0 +/* currently unused */ static int LocaleListSearch(ClockFmtScnCmdArgs *opts, @@ -1042,6 +1043,7 @@ ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, return TCL_OK; } #if 0 +/* currently unused */ static int StaticListSearch(ClockFmtScnCmdArgs *opts, @@ -1093,6 +1095,7 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { #if 0 +/* currently unused, test purposes only */ static const char * months[] = { /* full */ "January", "February", "March", diff --git a/generic/tclDate.h b/generic/tclDate.h index cf307a6..1519842 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -509,11 +509,4 @@ MODULE_SCOPE int ClockFormat(register DateFormat *dateFmt, MODULE_SCOPE void ClockFrmScnClearCaches(void); -/* - * Other externals. - */ - -MODULE_SCOPE unsigned long TclEnvEpoch; /* Epoch of the tcl environment - * (if changed with tcl-env). */ - #endif /* _TCLCLOCK_H */ diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index caebbf1..b786c4f 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -1960,6 +1960,32 @@ DictSizeCmd( /* *---------------------------------------------------------------------- + * + * Tcl_DictObjSmartRef -- + * + * This function returns new tcl-object with the smart reference to + * dictionary object. + * + * Object returned with this function is a smart reference (pointer), + * so new object of type tclDictType, that directly references given + * dictionary object (with internally increased refCount). + * + * The usage of such pointer objects allows to hold more as one + * reference to the same real dictionary object, allows to make a pointer + * to part of another dictionary, allows to change the dictionary without + * regarding of the "shared" state of the dictionary object. + * + * Prevents "called with shared object" exception if object is multiple + * referenced. + * + * Results: + * The newly create object (contains smart reference) is returned. + * The returned object has a ref count of 0. + * + * Side effects: + * Increases ref count of the referenced dictionary. + * + *---------------------------------------------------------------------- */ Tcl_Obj * @@ -1991,9 +2017,9 @@ Tcl_DictObjSmartRef( * * DictSmartRefCmd -- * - * This function implements the "dict smartref" Tcl command. See the user - * documentation for details on what it does, and TIP#111 for the formal - * specification. + * This function implements the "dict smartref" Tcl command. + * + * See description of Tcl_DictObjSmartRef for details. * * Results: * A standard Tcl result. diff --git a/generic/tclInt.h b/generic/tclInt.h index a569788..15cb355 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4886,6 +4886,13 @@ typedef struct NRE_callback { #define Tcl_Free(ptr) TclpFree(ptr) #endif +/* + * Other externals. + */ + +MODULE_SCOPE unsigned long TclEnvEpoch; /* Epoch of the tcl environment + * (if changed with tcl-env). */ + #endif /* _TCLINT */ /* diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index 686c1e4..773eb6a 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -418,7 +418,8 @@ TclStrIdxTreeGetFromObj(Tcl_Obj *objPtr) { /* * Several debug primitives */ -#if 1 +#if 0 +/* currently unused, debug resp. test purposes only */ void TclStrIdxTreePrint( -- cgit v0.12 From 01697f2acc39c303ebeedd2f9ebb82380cb388ce Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 23:02:02 +0000 Subject: "clock add" rewritten in C, using common functionality of "clock scan" (and freescan)... test-performance.tcl: test cases extended to cover "clock add" --- generic/tclClock.c | 735 +++++++++++++++++++++++++++++++--------------- generic/tclDate.h | 2 +- library/clock.tcl | 328 --------------------- library/init.tcl | 2 +- tests-perf/clock.perf.tcl | 39 +++ tests/clock.test | 17 +- 6 files changed, 559 insertions(+), 564 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index fc7c70c..791898b 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -116,9 +116,6 @@ static int ClockMicrosecondsObjCmd( static int ClockMillisecondsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ClockParseformatargsObjCmd( - ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); static int ClockSecondsObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -128,10 +125,17 @@ static int ClockFormatObjCmd( static int ClockScanObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int ClockScanCommit( + ClientData clientData, register DateInfo *info, + register ClockFmtScnCmdArgs *opts); static int ClockFreeScan( - ClientData clientData, Tcl_Interp *interp, register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); +static int ClockCalcRelTime( + register DateInfo *info, ClockFmtScnCmdArgs *opts); +static int ClockAddObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]); static struct tm * ThreadSafeLocalTime(const time_t *); static unsigned long TzsetGetEpoch(void); static void TzsetIfNecessary(void); @@ -151,6 +155,7 @@ struct ClockCommand { }; static const struct ClockCommand clockCommands[] = { + { "add", ClockAddObjCmd }, { "clicks", ClockClicksObjCmd }, { "getenv", ClockGetenvObjCmd }, { "microseconds", ClockMicrosecondsObjCmd }, @@ -166,7 +171,6 @@ static const struct ClockCommand clockCommands[] = { ClockGetjuliandayfromerayearmonthdayObjCmd }, { "GetJulianDayFromEraYearWeekDay", ClockGetjuliandayfromerayearweekdayObjCmd }, - { "ParseFormatArgs", ClockParseformatargsObjCmd }, { NULL, NULL } }; @@ -763,7 +767,6 @@ ClockConfigureObjCmd( Tcl_Obj *const objv[]) /* Parameter vector */ { ClockClientData *dataPtr = clientData; - Tcl_Obj **litPtr = dataPtr->literals; static const char *const options[] = { "-system-tz", "-setup-tz", "-default-locale", @@ -814,7 +817,7 @@ ClockConfigureObjCmd( Tcl_SetObjRef(dataPtr->LastSetupTimeZone, timezoneObj); Tcl_UnsetObjRef(dataPtr->LastSetupTZData); } - if (timezoneObj == litPtr[LIT_GMT]) { + if (timezoneObj == dataPtr->literals[LIT_GMT]) { optionIndex = CLOCK_SETUP_GMT; } else if (timezoneObj == dataPtr->SystemTimeZone) { optionIndex = CLOCK_SETUP_NOP; @@ -1158,7 +1161,7 @@ ClockConvertlocaltoutcObjCmd( "found in dictionary", -1)); return TCL_ERROR; } - if ((Tcl_GetWideIntFromObj(interp, secondsObj, + if ((TclGetWideIntFromObj(interp, secondsObj, &fields.localSeconds) != TCL_OK) || (TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK) || ConvertLocalToUTC(clientData, interp, &fields, objv[2], changeover)) { @@ -1238,7 +1241,7 @@ ClockGetdatefieldsObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "seconds timezone changeover"); return TCL_ERROR; } - if (Tcl_GetWideIntFromObj(interp, objv[1], &fields.seconds) != TCL_OK + if (TclGetWideIntFromObj(interp, objv[1], &fields.seconds) != TCL_OK || TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK) { return TCL_ERROR; } @@ -1762,7 +1765,7 @@ ConvertLocalToUTCUsingTable( int corrOffset; Tcl_WideInt backCompVal; /* check DST-hole interval contains UTC time */ - Tcl_GetWideIntFromObj(NULL, cellv[0], &backCompVal); + TclGetWideIntFromObj(NULL, cellv[0], &backCompVal); if ( fields->seconds >= backCompVal - fields->tzOffset && fields->seconds <= backCompVal + fields->tzOffset ) { @@ -2148,7 +2151,7 @@ LookupLastTransition( */ if (Tcl_ListObjIndex(interp, rowv[0], 0, &compObj) != TCL_OK - || Tcl_GetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { + || TclGetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { return NULL; } @@ -2170,7 +2173,7 @@ LookupLastTransition( int m = (l + u + 1) / 2; if (Tcl_ListObjIndex(interp, rowv[m], 0, &compObj) != TCL_OK || - Tcl_GetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { + TclGetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { return NULL; } if (tick >= compVal) { @@ -2922,10 +2925,21 @@ ClockMicrosecondsObjCmd( return TCL_OK; } +static inline void +ClockInitFmtScnArgs( + ClientData clientData, + Tcl_Interp *interp, + ClockFmtScnCmdArgs *opts) +{ + memset(opts, 0, sizeof(*opts)); + opts->clientData = clientData; + opts->interp = interp; +} + /* *----------------------------------------------------------------------------- * - * _ClockParseFmtScnArgs -- + * ClockParseFmtScnArgs -- * * Parses the arguments for [clock scan] and [clock format]. * @@ -2936,92 +2950,116 @@ ClockMicrosecondsObjCmd( *----------------------------------------------------------------------------- */ +#define CLC_FMT_ARGS (0) +#define CLC_SCN_ARGS (1 << 0) +#define CLC_ADD_ARGS (1 << 1) + static int -_ClockParseFmtScnArgs( - ClientData clientData, /* Client data containing literal pool */ - Tcl_Interp *interp, /* Tcl interpreter */ +ClockParseFmtScnArgs( + register + ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */ + TclDateFields *date, /* Extracted date-time corresponding base + * (by scan or add) resp. clockval (by format) */ int objc, /* Parameter count */ Tcl_Obj *const objv[], /* Parameter vector */ - ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */ - int forScan /* Flag to differentiate between format and scan */ + int flags /* Flags, differentiates between format, scan, add */ ) { - ClockClientData *dataPtr = clientData; - Tcl_Obj **litPtr = dataPtr->literals; + Tcl_Interp *interp = opts->interp; + ClockClientData *dataPtr = opts->clientData; int gmtFlag = 0; - static const char *const options[2][6] = { - { /* Format command line options */ - "-format", "-gmt", "-locale", - "-timezone", NULL }, - { /* Scan command line options */ + static const char *const options[] = { "-format", "-gmt", "-locale", - "-timezone", "-base", NULL } + "-timezone", "-base", NULL }; enum optionInd { - CLOCK_FORMAT_FORMAT, CLOCK_FORMAT_GMT, CLOCK_FORMAT_LOCALE, - CLOCK_FORMAT_TIMEZONE, CLOCK_FORMAT_BASE + CLC_ARGS_FORMAT, CLC_ARGS_GMT, CLC_ARGS_LOCALE, + CLC_ARGS_TIMEZONE, CLC_ARGS_BASE }; int optionIndex; /* Index of an option. */ int saw = 0; /* Flag == 1 if option was seen already. */ int i; + Tcl_WideInt baseVal; /* Base time, expressed in seconds from the Epoch */ + + /* clock value (as current base) */ + if ( !(flags & (CLC_SCN_ARGS)) ) { + opts->baseObj = objv[1]; + saw |= (1 << CLC_ARGS_BASE); + } /* * Extract values for the keywords. */ - memset(opts, 0, sizeof(*opts)); for (i = 2; i < objc; i+=2) { - if (Tcl_GetIndexFromObj(interp, objv[i], options[forScan], + /* bypass integers (offsets) by "clock add" */ + if (flags & CLC_ADD_ARGS) { + Tcl_WideInt num; + if (TclGetWideIntFromObj(NULL, objv[i], &num) == TCL_OK) { + continue; + } + } + /* get option */ + if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, &optionIndex) != TCL_OK) { - Tcl_SetErrorCode(interp, "CLOCK", "badOption", - Tcl_GetString(objv[i]), NULL); - return TCL_ERROR; + goto badOption; + } + /* if already specified */ + if (saw & (1 << optionIndex)) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "bad option \"%s\": doubly present", + TclGetString(objv[i])) + ); + goto badOption; } switch (optionIndex) { - case CLOCK_FORMAT_FORMAT: + case CLC_ARGS_FORMAT: + if (flags & CLC_ADD_ARGS) { + goto badOptionMsg; + } opts->formatObj = objv[i+1]; break; - case CLOCK_FORMAT_GMT: + case CLC_ARGS_GMT: if (Tcl_GetBooleanFromObj(interp, objv[i+1], &gmtFlag) != TCL_OK){ return TCL_ERROR; } break; - case CLOCK_FORMAT_LOCALE: + case CLC_ARGS_LOCALE: opts->localeObj = objv[i+1]; break; - case CLOCK_FORMAT_TIMEZONE: + case CLC_ARGS_TIMEZONE: opts->timezoneObj = objv[i+1]; break; - case CLOCK_FORMAT_BASE: + case CLC_ARGS_BASE: + if ( !(flags & (CLC_SCN_ARGS)) ) { + goto badOptionMsg; + } opts->baseObj = objv[i+1]; break; } - saw |= 1 << optionIndex; + saw |= (1 << optionIndex); } /* * Check options. */ - if ((saw & (1 << CLOCK_FORMAT_GMT)) - && (saw & (1 << CLOCK_FORMAT_TIMEZONE))) { + if ((saw & (1 << CLC_ARGS_GMT)) + && (saw & (1 << CLC_ARGS_TIMEZONE))) { Tcl_SetResult(interp, "cannot use -gmt and -timezone in same call", TCL_STATIC); Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); return TCL_ERROR; } if (gmtFlag) { - opts->timezoneObj = litPtr[LIT_GMT]; + opts->timezoneObj = dataPtr->literals[LIT_GMT]; } - opts->clientData = clientData; - opts->interp = interp; - /* If time zone not specified use system time zone */ if ( opts->timezoneObj == NULL || TclGetString(opts->timezoneObj) == NULL || opts->timezoneObj->length == 0 ) { - opts->timezoneObj = ClockGetSystemTimeZone(clientData, interp); + opts->timezoneObj = ClockGetSystemTimeZone(opts->clientData, interp); if (opts->timezoneObj == NULL) { return TCL_ERROR; } @@ -3029,85 +3067,90 @@ _ClockParseFmtScnArgs( /* Setup timezone (normalize object if needed and load TZ on demand) */ - opts->timezoneObj = ClockSetupTimeZone(clientData, interp, opts->timezoneObj); + opts->timezoneObj = ClockSetupTimeZone(opts->clientData, interp, opts->timezoneObj); if (opts->timezoneObj == NULL) { return TCL_ERROR; } - return TCL_OK; -} - -/* - *----------------------------------------------------------------------------- - * - * ClockParseformatargsObjCmd -- - * - * Parses the arguments for [clock format]. - * - * Results: - * Returns a standard Tcl result, whose value is a four-element list - * comprising the time format, the locale, and the timezone. - * - * This function exists for backward compatibility purposes. - * - *----------------------------------------------------------------------------- - */ + /* Base (by scan or add) or clock value (by format) */ -static int -ClockParseformatargsObjCmd( - ClientData clientData, /* Client data containing literal pool */ - Tcl_Interp *interp, /* Tcl interpreter */ - int objc, /* Parameter count */ - Tcl_Obj *const objv[]) /* Parameter vector */ -{ - ClockClientData *dataPtr = clientData; - Tcl_Obj **literals = dataPtr->literals; - ClockFmtScnCmdArgs opts; /* Format, locale and timezone */ - Tcl_WideInt clockVal; /* Clock value - just used to parse. */ - int ret; + if (opts->baseObj != NULL) { + if (TclGetWideIntFromObj(NULL, opts->baseObj, &baseVal) != TCL_OK) { - /* - * Args consist of a time followed by keyword-value pairs. - */ + /* we accept "-now" as current date-time */ + const char *const nowOpts[] = { + "-now", NULL + }; + int idx; + if (Tcl_GetIndexFromObj(NULL, opts->baseObj, nowOpts, "seconds or -now", + TCL_EXACT, &idx) == TCL_OK + ) { + goto baseNow; + } - if (objc < 2 || (objc % 2) != 0) { - Tcl_WrongNumArgs(interp, 0, objv, - "clock format clockval ?-format string? " - "?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"); - Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", NULL); - return TCL_ERROR; - } + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "expected integer but got \"%s\"", + Tcl_GetString(opts->baseObj))); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "INTEGER", NULL); + i = 1; + goto badOption; + } + /* + * seconds could be an unsigned number that overflowed. Make sure + * that it isn't. + */ - /* - * Extract values for the keywords. - */ + if (opts->baseObj->typePtr == &tclBignumType) { + Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); + return TCL_ERROR; + } - ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, - &opts, 0); - if (ret != TCL_OK) { - return ret; + } else { + +baseNow: + { + Tcl_Time now; + Tcl_GetTime(&now); + baseVal = (Tcl_WideInt) now.sec; + } } /* - * Check options. + * Extract year, month and day from the base time for the parser to use as + * defaults */ - if (Tcl_GetWideIntFromObj(interp, objv[1], &clockVal) != TCL_OK) { - return TCL_ERROR; + /* check base fields already cached (by TZ, last-second cache) */ + if ( dataPtr->lastBase.timezoneObj == opts->timezoneObj + && dataPtr->lastBase.Date.seconds == baseVal) { + memcpy(date, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); + } else { + /* extact fields from base */ + date->seconds = baseVal; + if (ClockGetDateFields(opts->clientData, interp, date, opts->timezoneObj, + GREGORIAN_CHANGE_DATE) != TCL_OK) { /* TODO - GREGORIAN_CHANGE_DATE should be locale-dependent */ + return TCL_ERROR; + } + /* cache last base */ + memcpy(&dataPtr->lastBase.Date, date, ClockCacheableDateFieldsSize); + Tcl_SetObjRef(dataPtr->lastBase.timezoneObj, opts->timezoneObj); } - if (opts.formatObj == NULL) - opts.formatObj = literals[LIT__DEFAULT_FORMAT]; - if (opts.localeObj == NULL) - opts.localeObj = literals[LIT_C]; - if (opts.timezoneObj == NULL) - opts.timezoneObj = literals[LIT__NIL]; - /* - * Return options as a list. - */ - - Tcl_SetObjResult(interp, Tcl_NewListObj(3, (Tcl_Obj**)&opts.formatObj)); return TCL_OK; + +badOptionMsg: + + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "bad option \"%s\": unexpected for command \"%s\"", + TclGetString(objv[i]), TclGetString(objv[0])) + ); + +badOption: + + Tcl_SetErrorCode(interp, "CLOCK", "badOption", + i < objc ? Tcl_GetString(objv[i]) : NULL, NULL); + + return TCL_ERROR; } /*---------------------------------------------------------------------- @@ -3141,11 +3184,11 @@ ClockFormatObjCmd( int ret; ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ - Tcl_WideInt clockVal; /* Time, expressed in seconds from the Epoch */ DateFormat dateFmt; /* Common structure used for formatting */ + /* even number of arguments */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "clockval " + Tcl_WrongNumArgs(interp, 1, objv, "clockval|-now " "?-format string? " "?-gmt boolean? " "?-locale LOCALE? ?-timezone ZONE?"); @@ -3153,53 +3196,17 @@ ClockFormatObjCmd( return TCL_ERROR; } - /* - * Extract values for the keywords. - */ - - ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, - &opts, 0); - if (ret != TCL_OK) { - return ret; - } - - ret = TCL_ERROR; - - if (Tcl_GetWideIntFromObj(interp, objv[1], &clockVal) != TCL_OK) { - return TCL_ERROR; - } - - /* - * seconds could be an unsigned number that overflowed. Make sure - * that it isn't. - */ - - if (objv[1]->typePtr == &tclBignumType) { - Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); - return TCL_ERROR; - } - memset(&dateFmt, 0, sizeof(dateFmt)); /* - * Extract year, month and day from the base time for the parser to use as - * defaults + * Extract values for the keywords. */ - /* check base fields already cached (by TZ, last-second cache) */ - if ( dataPtr->lastBase.timezoneObj == opts.timezoneObj - && dataPtr->lastBase.Date.seconds == clockVal) { - memcpy(&dateFmt.date, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); - } else { - /* extact fields from base */ - dateFmt.date.seconds = clockVal; - if (ClockGetDateFields(clientData, interp, &dateFmt.date, opts.timezoneObj, - GREGORIAN_CHANGE_DATE) != TCL_OK) { - goto done; - } - /* cache last base */ - memcpy(&dataPtr->lastBase.Date, &dateFmt.date, ClockCacheableDateFieldsSize); - Tcl_SetObjRef(dataPtr->lastBase.timezoneObj, opts.timezoneObj); + ClockInitFmtScnArgs(clientData, interp, &opts); + ret = ClockParseFmtScnArgs(&opts, &dateFmt.date, objc, objv, + CLC_FMT_ARGS); + if (ret != TCL_OK) { + goto done; } /* Default format */ @@ -3249,14 +3256,12 @@ ClockScanObjCmd( int objc, /* Parameter count */ Tcl_Obj *const objv[]) /* Parameter values */ { - ClockClientData *dataPtr = clientData; - int ret; ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ - Tcl_WideInt baseVal; /* Base time, expressed in seconds from the Epoch */ DateInfo yy; /* Common structure used for parsing */ DateInfo *info = &yy; + /* even number of arguments */ if ((objc & 1) == 1) { Tcl_WrongNumArgs(interp, 1, objv, "string " "?-base seconds? " @@ -3267,59 +3272,17 @@ ClockScanObjCmd( return TCL_ERROR; } + ClockInitDateInfo(&yy); + /* * Extract values for the keywords. */ - ret = _ClockParseFmtScnArgs(clientData, interp, objc, objv, - &opts, 1); + ClockInitFmtScnArgs(clientData, interp, &opts); + ret = ClockParseFmtScnArgs(&opts, &yy.date, objc, objv, + CLC_SCN_ARGS); if (ret != TCL_OK) { - return ret; - } - - ret = TCL_ERROR; - - if (opts.baseObj != NULL) { - if (Tcl_GetWideIntFromObj(interp, opts.baseObj, &baseVal) != TCL_OK) { - return TCL_ERROR; - } - /* - * seconds could be an unsigned number that overflowed. Make sure - * that it isn't. - */ - - if (opts.baseObj->typePtr == &tclBignumType) { - Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); - return TCL_ERROR; - } - - } else { - Tcl_Time now; - Tcl_GetTime(&now); - baseVal = (Tcl_WideInt) now.sec; - } - - ClockInitDateInfo(info); - - /* - * Extract year, month and day from the base time for the parser to use as - * defaults - */ - - /* check base fields already cached (by TZ, last-second cache) */ - if ( dataPtr->lastBase.timezoneObj == opts.timezoneObj - && dataPtr->lastBase.Date.seconds == baseVal) { - memcpy(&yydate, &dataPtr->lastBase.Date, ClockCacheableDateFieldsSize); - } else { - /* extact fields from base */ - yydate.seconds = baseVal; - if (ClockGetDateFields(clientData, interp, &yydate, opts.timezoneObj, - GREGORIAN_CHANGE_DATE) != TCL_OK) { - goto done; - } - /* cache last base */ - memcpy(&dataPtr->lastBase.Date, &yydate, ClockCacheableDateFieldsSize); - Tcl_SetObjRef(dataPtr->lastBase.timezoneObj, opts.timezoneObj); + goto done; } /* seconds are in localSeconds (relative base date), so reset time here */ @@ -3336,18 +3299,54 @@ ClockScanObjCmd( Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } - ret = ClockFreeScan(clientData, interp, info, objv[1], &opts); + ret = ClockFreeScan(&yy, objv[1], &opts); } else { /* Use compiled version of Scan - */ - ret = ClockScan(info, objv[1], &opts); + ret = ClockScan(&yy, objv[1], &opts); + } + + /* Convert date info structure into UTC seconds */ + + if (ret == TCL_OK) { + ret = ClockScanCommit(clientData, &yy, &opts); } +done: + + Tcl_UnsetObjRef(yy.date.tzName); + if (ret != TCL_OK) { - goto done; + return ret; } + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(yy.date.seconds)); + return TCL_OK; +} + +/*---------------------------------------------------------------------- + * + * ClockScanCommit -- + * + * Converts date info structure into UTC seconds. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +ClockScanCommit( + ClientData clientData, /* Client data containing literal pool */ + register DateInfo *info, /* Clock scan info structure */ + register + ClockFmtScnCmdArgs *opts) /* Format, locale, timezone and base */ +{ /* If needed assemble julianDay using year, month, etc. */ if (info->flags & CLF_ASSEMBLE_JULIANDAY) { if ((info->flags & CLF_ISO8601)) { @@ -3362,13 +3361,12 @@ ClockScanObjCmd( } /* some overflow checks, if not extended */ - if (!(opts.flags & CLF_EXTENDED)) { + if (!(opts->flags & CLF_EXTENDED)) { if (yydate.julianDay > 5373484) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( + Tcl_SetObjResult(opts->interp, Tcl_NewStringObj( "requested date too large to represent", -1)); - Tcl_SetErrorCode(interp, "CLOCK", "dateTooLarge", NULL); - ret = TCL_ERROR; - goto done; + Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL); + return TCL_ERROR; } } @@ -3382,9 +3380,9 @@ ClockScanObjCmd( } if (info->flags & (CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY|CLF_LOCALSEC)) { - if (ConvertLocalToUTC(clientData, interp, &yydate, opts.timezoneObj, + if (ConvertLocalToUTC(clientData, opts->interp, &yydate, opts->timezoneObj, GREGORIAN_CHANGE_DATE) != TCL_OK) { - goto done; + return TCL_ERROR; } } @@ -3392,17 +3390,6 @@ ClockScanObjCmd( yydate.seconds += yyRelSeconds; - ret = TCL_OK; - -done: - - Tcl_UnsetObjRef(yydate.tzName); - - if (ret != TCL_OK) { - return ret; - } - - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(yydate.seconds)); return TCL_OK; } @@ -3423,8 +3410,6 @@ done: int ClockFreeScan( - ClientData clientData, /* Client data containing literal pool */ - Tcl_Interp *interp, /* Tcl interpreter */ register DateInfo *info, /* Date fields used for parsing & converting * simultaneously a yy-parse structure of the @@ -3432,7 +3417,8 @@ ClockFreeScan( Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { - ClockClientData *dataPtr = clientData; + Tcl_Interp *interp = opts->interp; + ClockClientData *dataPtr = opts->clientData; int ret = TCL_ERROR; @@ -3487,7 +3473,7 @@ ClockFreeScan( 60 * minEast + 3600 * dstFlag); Tcl_IncrRefCount(tzObjStor); - opts->timezoneObj = ClockSetupTimeZone(clientData, interp, tzObjStor); + opts->timezoneObj = ClockSetupTimeZone(dataPtr, interp, tzObjStor); Tcl_DecrRefCount(tzObjStor); if (opts->timezoneObj == NULL) { @@ -3531,6 +3517,39 @@ ClockFreeScan( * Do relative times */ + ret = ClockCalcRelTime(info, opts); + + /* Free scanning completed - date ready */ + +done: + + return ret; +} + +/*---------------------------------------------------------------------- + * + * ClockCalcRelTime -- + * + * Used for calculating of relative times. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ +int +ClockCalcRelTime( + register + DateInfo *info, /* Date fields used for converting */ + ClockFmtScnCmdArgs *opts) /* Command options */ +{ + /* + * Because some calculations require in-between conversion of the + * julian day, we can repeat this processing multiple times + */ repeat_rel: if (yyHaveRel) { @@ -3667,13 +3686,267 @@ repeat_rel: info->flags |= CLF_ASSEMBLE_DATE|CLF_ASSEMBLE_SECONDS; } - /* Free scanning completed - date ready */ + return TCL_OK; +} + + +/*---------------------------------------------------------------------- + * + * ClockWeekdaysOffs -- + * + * Get offset in days for the number of week days corresponding the + * given day of week (skipping Saturdays and Sundays). + * + * + * Results: + * Returns a day increment adjusted the given weekdays + * + *---------------------------------------------------------------------- + */ + +static inline int +ClockWeekdaysOffs( + register int dayOfWeek, + register int offs) +{ + register int weeks, resDayOfWeek; + + /* offset in days */ + weeks = offs / 5; + offs = offs % 5; + /* compiler fix for negative offs - wrap (0, -1) -> (-1, 4) */ + if (offs < 0) { + weeks--; + offs = 5 + offs; + } + offs += 7 * weeks; + + /* resulting day of week */ + { + register int day = (offs % 7); + /* compiler fix for negative offs - wrap (0, -1) -> (-1, 6) */ + if (day < 0) { + day = 7 + day; + } + resDayOfWeek = dayOfWeek + day; + } + + /* adjust if we start from a weekend */ + if (dayOfWeek > 5) { + int adj = 5 - dayOfWeek; + offs += adj; + resDayOfWeek += adj; + } + + /* adjust if we end up on a weekend */ + if (resDayOfWeek > 5) { + offs += 2; + } + + return offs; +} + + + +/*---------------------------------------------------------------------- + * + * ClockAddObjCmd -- , clock add -- + * + * Adds an offset to a given time. + * + * Refer to the user documentation to see what it exactly does. + * + * Syntax: + * clock add clockval ?count unit?... ?-option value? + * + * Parameters: + * clockval -- Starting time value + * count -- Amount of a unit of time to add + * unit -- Unit of time to add, must be one of: + * years year months month weeks week + * days day hours hour minutes minute + * seconds second + * + * Options: + * -gmt BOOLEAN + * Flag synonymous with '-timezone :GMT' + * -timezone ZONE + * Name of the time zone in which calculations are to be done. + * -locale NAME + * Name of the locale in which calculations are to be done. + * Used to determine the Gregorian change date. + * + * Results: + * Returns a standard Tcl result with the given time adjusted + * by the given offset(s) in order. + * + * Notes: + * It is possible that adding a number of months or years will adjust the + * day of the month as well. For instance, the time at one month after + * 31 January is either 28 or 29 February, because February has fewer + * than 31 days. + * + *---------------------------------------------------------------------- + */ + +int +ClockAddObjCmd( + ClientData clientData, /* Client data containing literal pool */ + Tcl_Interp *interp, /* Tcl interpreter */ + int objc, /* Parameter count */ + Tcl_Obj *const objv[]) /* Parameter values */ +{ + ClockClientData *dataPtr = clientData; + int ret; + ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */ + DateInfo yy; /* Common structure used for parsing */ + DateInfo *info = &yy; + + /* add "week" to units also (because otherwise ambiguous) */ + static const char *const units[] = { + "years", "months", "week", "weeks", + "days", "weekdays", + "hours", "minutes", "seconds", + NULL + }; + enum unitInd { + CLC_ADD_YEARS, CLC_ADD_MONTHS, CLC_ADD_WEEK, CLC_ADD_WEEKS, + CLC_ADD_DAYS, CLC_ADD_WEEKDAYS, + CLC_ADD_HOURS, CLC_ADD_MINUTES, CLC_ADD_SECONDS + }; + int unitIndex; /* Index of an option. */ + int i; + Tcl_WideInt offs; - ret = TCL_OK; + /* even number of arguments */ + if ((objc & 1) == 1) { + Tcl_WrongNumArgs(interp, 1, objv, "clockval|-now ?number units?..." + "?-gmt boolean? " + "?-locale LOCALE? ?-timezone ZONE?"); + Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", NULL); + return TCL_ERROR; + } + + ClockInitDateInfo(&yy); + + /* + * Extract values for the keywords. + */ + + ClockInitFmtScnArgs(clientData, interp, &opts); + ret = ClockParseFmtScnArgs(&opts, &yy.date, objc, objv, + CLC_ADD_ARGS); + if (ret != TCL_OK) { + goto done; + } + + /* time together as seconds of the day */ + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; + /* seconds are in localSeconds (relative base date), so reset time here */ + yyHour = 0; yyMinutes = 0; yyMeridian = MER24; + + ret = TCL_ERROR; + + /* + * Find each offset and process date increment + */ + + for (i = 2; i < objc; i+=2) { + /* bypass not integers (options, allready processed above) */ + if (TclGetWideIntFromObj(NULL, objv[i], &offs) != TCL_OK) { + continue; + } + if (objv[i]->typePtr == &tclBignumType) { + Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); + goto done; + } + /* get unit */ + if (Tcl_GetIndexFromObj(interp, objv[i+1], units, "unit", 0, + &unitIndex) != TCL_OK) { + goto done; + } + + /* nothing to do if zero quantity */ + if (!offs) { + continue; + } + + /* if in-between conversion needed (already have relative date/time), + * correct date info, because the date may be changed, + * so refresh it now */ + + if ( yyHaveRel + && ( unitIndex == CLC_ADD_WEEKDAYS + /* some months can be shorter as another */ + || yyRelMonth || yyRelDay + /* day changed */ + || yySeconds + yyRelSeconds > SECONDS_PER_DAY + || yySeconds + yyRelSeconds < 0 + ) + ) { + if (ClockCalcRelTime(info, &opts) != TCL_OK) { + goto done; + } + } + + /* process increment by offset + unit */ + yyHaveRel++; + switch (unitIndex) { + case CLC_ADD_YEARS: + yyRelMonth += offs * 12; + break; + case CLC_ADD_MONTHS: + yyRelMonth += offs; + break; + case CLC_ADD_WEEK: + case CLC_ADD_WEEKS: + yyRelDay += offs * 7; + break; + case CLC_ADD_DAYS: + yyRelDay += offs; + break; + case CLC_ADD_WEEKDAYS: + /* add number of week days (skipping Saturdays and Sundays) + * to a relative days value. */ + offs = ClockWeekdaysOffs(yy.date.dayOfWeek, offs); + yyRelDay += offs; + break; + case CLC_ADD_HOURS: + yyRelSeconds += offs * 60 * 60; + break; + case CLC_ADD_MINUTES: + yyRelSeconds += offs * 60; + break; + case CLC_ADD_SECONDS: + yyRelSeconds += offs; + break; + } + } + + /* + * Do relative times (if not yet already processed interim): + */ + + if (yyHaveRel) { + if (ClockCalcRelTime(info, &opts) != TCL_OK) { + goto done; + } + } + + /* Convert date info structure into UTC seconds */ + + ret = ClockScanCommit(clientData, &yy, &opts); done: - return ret; + Tcl_UnsetObjRef(yy.date.tzName); + + if (ret != TCL_OK) { + return ret; + } + + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(yy.date.seconds)); + return TCL_OK; } /*---------------------------------------------------------------------- diff --git a/generic/tclDate.h b/generic/tclDate.h index 1519842..e614f9d 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -264,7 +264,7 @@ typedef struct ClockFmtScnCmdArgs { Tcl_Obj *formatObj; /* Format */ Tcl_Obj *localeObj; /* Name of the locale where the time will be expressed. */ Tcl_Obj *timezoneObj; /* Default time zone in which the time will be expressed */ - Tcl_Obj *baseObj; /* Base (scan only) */ + Tcl_Obj *baseObj; /* Base (scan and add) or clockValue (format) */ int flags; /* Flags control scanning */ Tcl_Obj *mcDictObj; /* Current dictionary of tcl::clock package for given localeObj*/ diff --git a/library/clock.tcl b/library/clock.tcl index 3caa270..ba4676b 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -1948,334 +1948,6 @@ proc ::tcl::clock::WeekdayOnOrBefore { weekday j } { #---------------------------------------------------------------------- # -# clock add -- -# -# Adds an offset to a given time. -# -# Syntax: -# clock add clockval ?count unit?... ?-option value? -# -# Parameters: -# clockval -- Starting time value -# count -- Amount of a unit of time to add -# unit -- Unit of time to add, must be one of: -# years year months month weeks week -# days day hours hour minutes minute -# seconds second -# -# Options: -# -gmt BOOLEAN -# (Deprecated) Flag synonymous with '-timezone :GMT' -# -timezone ZONE -# Name of the time zone in which calculations are to be done. -# -locale NAME -# Name of the locale in which calculations are to be done. -# Used to determine the Gregorian change date. -# -# Results: -# Returns the given time adjusted by the given offset(s) in -# order. -# -# Notes: -# It is possible that adding a number of months or years will adjust the -# day of the month as well. For instance, the time at one month after -# 31 January is either 28 or 29 February, because February has fewer -# than 31 days. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::add { clockval args } { - if { [llength $args] % 2 != 0 } { - set cmdName "clock add" - return -code error \ - -errorcode [list CLOCK wrongNumArgs] \ - "wrong \# args: should be\ - \"$cmdName clockval ?number units?...\ - ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?\"" - } - if { [catch { expr {wide($clockval)} } result] } { - return -code error "expected integer but got \"$clockval\"" - } - - set offsets {} - set gmt 0 - set locale c - if {[set timezone [configure -system-tz]] eq ""} { - set timezone [GetSystemTimeZone] - } - - foreach { a b } $args { - if { [string is integer -strict $a] } { - lappend offsets $a $b - } else { - switch -exact -- $a { - -g - -gm - -gmt { - set gmt $b - } - -l - -lo - -loc - -loca - -local - -locale { - set locale [string tolower $b] - } - -t - -ti - -tim - -time - -timez - -timezo - -timezon - - -timezone { - set timezone $b - } - default { - throw [list CLOCK badOption $a] \ - "bad option \"$a\",\ - must be -gmt, -locale or -timezone" - } - } - } - } - - # Check options for validity - - if { [info exists saw(-gmt)] && [info exists saw(-timezone)] } { - return -code error \ - -errorcode [list CLOCK gmtWithTimezone] \ - "cannot use -gmt and -timezone in same call" - } - if { ![string is boolean -strict $gmt] } { - return -code error "expected boolean value but got \"$gmt\"" - } elseif { $gmt } { - set timezone :GMT - } - - EnterLocale $locale - - set changeover [mc GREGORIAN_CHANGE_DATE] - - if {[catch {set timezone [SetupTimeZone $timezone]} retval opts]} { - dict unset opts -errorinfo - return -options $opts $retval - } - - try { - foreach { quantity unit } $offsets { - switch -exact -- $unit { - years - year { - set clockval [AddMonths [expr { 12 * $quantity }] \ - $clockval $timezone $changeover] - } - months - month { - set clockval [AddMonths $quantity $clockval $timezone \ - $changeover] - } - - weeks - week { - set clockval [AddDays [expr { 7 * $quantity }] \ - $clockval $timezone $changeover] - } - days - day { - set clockval [AddDays $quantity $clockval $timezone \ - $changeover] - } - - weekdays - weekday { - set clockval [AddWeekDays $quantity $clockval $timezone \ - $changeover] - } - - hours - hour { - set clockval [expr { 3600 * $quantity + $clockval }] - } - minutes - minute { - set clockval [expr { 60 * $quantity + $clockval }] - } - seconds - second { - set clockval [expr { $quantity + $clockval }] - } - - default { - throw [list CLOCK badUnit $unit] \ - "unknown unit \"$unit\", must be \ - years, months, weeks, days, hours, minutes or seconds" - } - } - } - return $clockval - } trap CLOCK {result opts} { - # Conceal the innards of [clock] when it's an expected error - dict unset opts -errorinfo - return -options $opts $result - } -} - -#---------------------------------------------------------------------- -# -# AddMonths -- -# -# Add a given number of months to a given clock value in a given -# time zone. -# -# Parameters: -# months - Number of months to add (may be negative) -# clockval - Seconds since the epoch before the operation -# timezone - Time zone in which the operation is to be performed -# -# Results: -# Returns the new clock value as a number of seconds since -# the epoch. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AddMonths { months clockval timezone changeover } { - variable DaysInRomanMonthInCommonYear - variable DaysInRomanMonthInLeapYear - variable TZData - - # Convert the time to year, month, day, and fraction of day. - - set date [GetDateFields $clockval $timezone $changeover] - dict set date secondOfDay [expr { - [dict get $date localSeconds] % 86400 - }] - dict set date tzName $timezone - - # Add the requisite number of months - - set m [dict get $date month] - incr m $months - incr m -1 - set delta [expr { $m / 12 }] - set mm [expr { $m % 12 }] - dict set date month [expr { $mm + 1 }] - dict incr date year $delta - - # If the date doesn't exist in the current month, repair it - - if { [IsGregorianLeapYear $date] } { - set hath [lindex $DaysInRomanMonthInLeapYear $mm] - } else { - set hath [lindex $DaysInRomanMonthInCommonYear $mm] - } - if { [dict get $date dayOfMonth] > $hath } { - dict set date dayOfMonth $hath - } - - # Reconvert to a number of seconds - - set date [GetJulianDayFromEraYearMonthDay \ - $date[set date {}]\ - $changeover] - dict set date localSeconds [expr { - -210866803200 - + ( 86400 * wide([dict get $date julianDay]) ) - + [dict get $date secondOfDay] - }] - set date [ConvertLocalToUTC $date[set date {}] $timezone \ - $changeover] - - return [dict get $date seconds] - -} - -#---------------------------------------------------------------------- -# -# AddWeekDays -- -# -# Add a given number of week days (skipping Saturdays and Sundays) -# to a given clock value in a given time zone. -# -# Parameters: -# days - Number of days to add (may be negative) -# clockval - Seconds since the epoch before the operation -# timezone - Time zone in which the operation is to be performed -# changeover - Julian Day on which the Gregorian calendar was adopted -# in the target locale. -# -# Results: -# Returns the new clock value as a number of seconds since the epoch. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AddWeekDays { days clockval timezone changeover } { - - if {$days == 0} { - return $clockval - } - - set day [format $clockval -format %u] - - set weeks [expr {$days / 5}] - set rdays [expr {$days % 5}] - set toAdd [expr {7 * $weeks + $rdays}] - set resDay [expr {$day + ($toAdd % 7)}] - - # Adjust if we start from a weekend - if {$day > 5} { - set adj [expr {5 - $day}] - incr toAdd $adj - incr resDay $adj - } - - # Adjust if we end up on a weekend - if {$resDay > 5} { - incr toAdd 2 - } - - AddDays $toAdd $clockval $timezone $changeover -} - -#---------------------------------------------------------------------- -# -# AddDays -- -# -# Add a given number of days to a given clock value in a given time -# zone. -# -# Parameters: -# days - Number of days to add (may be negative) -# clockval - Seconds since the epoch before the operation -# timezone - Time zone in which the operation is to be performed -# changeover - Julian Day on which the Gregorian calendar was adopted -# in the target locale. -# -# Results: -# Returns the new clock value as a number of seconds since the epoch. -# -# Side effects: -# None. -# -#---------------------------------------------------------------------- - -proc ::tcl::clock::AddDays { days clockval timezone changeover } { - variable TZData - - # Convert the time to Julian Day - - set date [GetDateFields $clockval $timezone $changeover] - dict set date secondOfDay [expr { - [dict get $date localSeconds] % 86400 - }] - dict set date tzName $timezone - - # Add the requisite number of days - - dict incr date julianDay $days - - # Reconvert to a number of seconds - - dict set date localSeconds [expr { - -210866803200 - + ( 86400 * wide([dict get $date julianDay]) ) - + [dict get $date secondOfDay] - }] - set date [ConvertLocalToUTC $date[set date {}] $timezone \ - $changeover] - - return [dict get $date seconds] - -} - -#---------------------------------------------------------------------- -# # ChangeCurrentLocale -- # # The global locale was changed within msgcat. diff --git a/library/init.tcl b/library/init.tcl index f1f1bb4..405a400 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -178,7 +178,7 @@ if {[interp issafe]} { # Auto-loading stubs for 'clock.tcl' - foreach cmd {add mcget LocalizeFormat SetupTimeZone GetSystemTimeZone} { + foreach cmd {mcget LocalizeFormat SetupTimeZone GetSystemTimeZone} { proc ::tcl::clock::$cmd args { variable TclLibDir source -encoding utf-8 [file join $TclLibDir clock.tcl] diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 16664b2..733db1a 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -318,6 +318,44 @@ proc test-freescan {{reptime 1000}} { } {puts [clock format $_(r) -locale en]} } +proc test-add {{reptime 1000}} { + _test_run $reptime { + # Add : years + {clock add 1246379415 5 years -gmt 1} + # Add : months + {clock add 1246379415 18 months -gmt 1} + # Add : weeks + {clock add 1246379415 20 weeks -gmt 1} + # Add : days + {clock add 1246379415 385 days -gmt 1} + # Add : weekdays + {clock add 1246379415 3 weekdays -gmt 1} + + # Add : hours + {clock add 1246379415 5 hours -gmt 1} + # Add : minutes + {clock add 1246379415 55 minutes -gmt 1} + # Add : seconds + {clock add 1246379415 100 seconds -gmt 1} + + # Add : +/- in gmt + {clock add 1246379415 -5 years +21 months -20 weeks +386 days -19 hours +30 minutes -10 seconds -gmt 1} + # Add : +/- in system timezone + {clock add 1246379415 -5 years +21 months -20 weeks +386 days -19 hours +30 minutes -10 seconds -timezone :CET} + + # Add : gmt + {clock add 1246379415 -5 years 18 months 366 days 5 hours 30 minutes 10 seconds -gmt 1} + # Add : system timezone + {clock add 1246379415 -5 years 18 months 366 days 5 hours 30 minutes 10 seconds -timezone :CET} + + # Add : all in gmt + {clock add 1246379415 4 years 18 months 50 weeks 378 days 3 weekdays 5 hours 30 minutes 10 seconds -gmt 1} + # Add : all in system timezone + {clock add 1246379415 4 years 18 months 50 weeks 378 days 3 weekdays 5 hours 30 minutes 10 seconds -timezone :CET} + + } {puts [clock format $_(r) -locale en]} +} + proc test-other {{reptime 1000}} { _test_run $reptime { # Bad zone @@ -338,6 +376,7 @@ proc test {{reptime 1000}} { test-format $reptime test-scan $reptime test-freescan $reptime + test-add $reptime test-other $reptime puts \n**OK** diff --git a/tests/clock.test b/tests/clock.test index d9c491a..b540024 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -254,7 +254,7 @@ proc ::testClock::registry { cmd path key } { test clock-1.0 "clock format - wrong # args" { list [catch {clock format} msg] $msg $::errorCode -} {1 {wrong # args: should be "clock format clockval ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"} {CLOCK wrongNumArgs}} +} {1 {wrong # args: should be "clock format clockval|-now ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"} {CLOCK wrongNumArgs}} test clock-1.1 "clock format - bad time" { list [catch {clock format foo} msg] $msg @@ -270,10 +270,11 @@ test clock-1.3 "clock format - empty val" { test clock-1.4 "clock format - bad flag" {*}{ -body { - list [catch {clock format 0 -oops badflag} msg] $msg $::errorCode + # range error message for possible extensions: + list [catch {clock format 0 -oops badflag} msg] [string range $msg 0 60] $::errorCode } -match glob - -result {1 {bad option "-oops": must be -format, -gmt, -locale, or -timezone} {CLOCK badOption -oops}} + -result {1 {bad option "-oops": must be -format, -gmt, -locale, -timezone} {CLOCK badOption -oops}} } test clock-1.5 "clock format - bad timezone" { @@ -288,6 +289,16 @@ test clock-1.7 "clock format - option abbreviations" { clock format 0 -g true -f "%Y-%m-%d" } 1970-01-01 +test clock-1.8 "clock format -now" { + # give one second more for test (if on boundary of the current second): + set n [clock format [clock seconds] -g 1 -f "%s"] + expr {[clock format -now -g 1 -f "%s"] in [list $n [incr n]]} +} 1 + +test clock-1.9 "clock arguments: option doubly present" { + list [catch {clock format 0 -gmt 1 -gmt 0} result] $result +} {1 {bad option "-gmt": doubly present}} + # BEGIN testcases2 # Test formatting of Gregorian year, month, day, all formats -- cgit v0.12 From df7cbb28e0aaf30b8564ec1636870b0327c2ac21 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 23:02:14 +0000 Subject: small amend (reset have rel flag) --- generic/tclClock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generic/tclClock.c b/generic/tclClock.c index 791898b..efa9120 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -3623,6 +3623,8 @@ repeat_rel: goto repeat_rel; } } + + yyHaveRel = 0; } /* -- cgit v0.12 From a841205be9defa27d0eb12214555f45bf141f858 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 23:09:23 +0000 Subject: amend lost changes after rebase to fossil --- library/clock.tcl | 1 + tests/clock.test | 1 + 2 files changed, 2 insertions(+) diff --git a/library/clock.tcl b/library/clock.tcl index ba4676b..94d2341 100755 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -10,6 +10,7 @@ #---------------------------------------------------------------------- # # Copyright (c) 2004,2005,2006,2007 by Kevin B. Kenny +# Copyright (c) 2015 by Sergey G. Brester aka sebres. # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # diff --git a/tests/clock.test b/tests/clock.test index b540024..9e86c97 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -7,6 +7,7 @@ # generates output for errors. No output means no errors were found. # # Copyright (c) 2004 by Kevin B. Kenny. All rights reserved. +# Copyright (c) 2015 by Sergey G. Brester aka sebres. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -- cgit v0.12 From f03990cd122b2a54155a90896713d3783b343ddd Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 11 Jan 2017 16:35:41 +0000 Subject: code review: small optimization of msgcat::mcget, prevents infinite loop if at all no translation --- library/msgcat/msgcat.tcl | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 1260139..f9f57db 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -245,8 +245,6 @@ proc msgcat::mc {src args} { # format command. proc msgcat::mcget {ns loc args} { - variable Msgs - if {$loc eq {C}} { set loclist [PackagePreferences $ns] set loc [lindex $loclist 0] @@ -270,18 +268,20 @@ proc msgcat::mcget {ns loc args} { # search translation for each locale (regarding parent namespaces) for {set nscur $ns} {$nscur != ""} {set nscur [namespace parent $nscur]} { foreach loc $loclist { - if {[dict exists $Msgs $nscur $loc $src]} { - if {[llength $args] > 1} { - return [format [dict get $Msgs $nscur $loc $src] \ - {*}[lrange $args 1 end]] - } else { - return [dict get $Msgs $nscur $loc $src] + set msgs [mcget $nscur $loc] + if {![catch { set val [dict get $msgs $src] }]} { + if {[llength $args] == 1} { + return $val } + return [format $val {*}[lrange $args 1 end]] } } } - # get with package default locale - mcget $ns [lindex $loclist 0] {*}$args + # no translation : + if {[llength $args] == 1} { + return $src + } + return [format $src {*}[lrange $args 1 end]] } # msgcat::mcexists -- @@ -942,8 +942,10 @@ proc msgcat::Merge {ns locales} { set mrgcat [dict merge $mrgcat [dict get $Msgs $ns $loc]] } } else { - catch { + if {[catch { set mrgcat [dict get $Msgs $ns $loc] + }]} { + set mrgcat [dict create] } } dict set Merged $ns $loc $mrgcat -- cgit v0.12 From 77481ec3e1c4841e2c18ba404b55e98b2a9995f0 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 11 Jan 2017 16:36:28 +0000 Subject: code review and inline documentation --- generic/tclClock.c | 27 +++++ generic/tclClockFmt.c | 323 +++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 323 insertions(+), 27 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index efa9120..c63f425 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -412,7 +412,19 @@ NormTimezoneObj( /* *---------------------------------------------------------------------- + * + * ClockGetSystemLocale -- + * + * Returns system locale. + * + * Executes ::tcl::clock::GetSystemLocale in given interpreter. + * + * Results: + * Returns system locale tcl object. + * + *---------------------------------------------------------------------- */ + static inline Tcl_Obj * ClockGetSystemLocale( ClockClientData *dataPtr, /* Opaque pointer to literal pool, etc. */ @@ -426,7 +438,19 @@ ClockGetSystemLocale( } /* *---------------------------------------------------------------------- + * + * ClockGetCurrentLocale -- + * + * Returns current locale. + * + * Executes ::tcl::clock::mclocale in given interpreter. + * + * Results: + * Returns current locale tcl object. + * + *---------------------------------------------------------------------- */ + static inline Tcl_Obj * ClockGetCurrentLocale( ClockClientData *dataPtr, /* Client data containing literal pool */ @@ -978,6 +1002,9 @@ ClockGetTZData( * * Returns system (current) timezone. * + * If system zone not yet cached, it executes ::tcl::clock::GetSystemTimeZone + * in given interpreter and caches its result. + * * Results: * Returns normalized timezone object. * diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index ff16714..d875bd4 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -41,6 +41,24 @@ CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); * Clock scan and format facilities. */ +/* + *---------------------------------------------------------------------- + * + * _str2int -- , _str2wideInt -- + * + * Fast inline-convertion of string to signed int or wide int by given + * start/end. + * + * The given string should contain numbers chars only (because already + * pre-validated within parsing routines) + * + * Results: + * Returns a standard Tcl result. + * TCL_OK - by successful conversion, TCL_ERROR by (wide) int overflow + * + *---------------------------------------------------------------------- + */ + static inline int _str2int( int *out, @@ -101,6 +119,22 @@ _str2wideInt( return TCL_OK; } +/* + *---------------------------------------------------------------------- + * + * _itoaw -- , _witoaw -- + * + * Fast inline-convertion of signed int or wide int to string, using + * given padding with specified padchar and width (or without padding). + * + * This is a very fast replacement for sprintf("%02d"). + * + * Results: + * Returns position in buffer after end of conversion result. + * + *---------------------------------------------------------------------- + */ + static inline char * _itoaw( char *buf, @@ -257,7 +291,15 @@ _witoaw( } /* - *---------------------------------------------------------------------- + * Global GC as LIFO for released scan/format object storages. + * + * Used to holds last released CLOCK_FMT_SCN_STORAGE_GC_SIZE formats + * (after last reference from Tcl-object will be removed). This is helpful + * to avoid continuous (re)creation and compiling by some dynamically resp. + * variable format objects, that could be often reused. + * + * As long as format storage is used resp. belongs to GC, it takes place in + * FmtScnHashTable also. */ #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 @@ -268,6 +310,24 @@ static struct { unsigned int count; } ClockFmtScnStorage_GC = {NULL, NULL, 0}; +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageGC_In -- + * + * Adds an format storage object to GC. + * + * If current GC is full (size larger as CLOCK_FMT_SCN_STORAGE_GC_SIZE) + * this removes last unused storage at begin of GC stack (LIFO). + * + * Assumes caller holds the ClockFmtMutex. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + static inline void ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) { @@ -291,6 +351,22 @@ ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) ClockFmtScnStorageDelete(delEnt); } } + +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorage_GC_Out -- + * + * Restores (for reusing) given format storage object from GC. + * + * Assumes caller holds the ClockFmtMutex. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + static inline void ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) { @@ -304,13 +380,19 @@ ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) #endif + /* - *---------------------------------------------------------------------- + * Global format storage hash table of type ClockFmtScnStorageHashKeyType + * (contains list of scan/format object storages, shared across all threads). + * + * Used for fast searching by format string. */ - static Tcl_HashTable FmtScnHashTable; static int initialized = 0; +/* + * Wrappers between pointers to hash entry and format storage object + */ static inline Tcl_HashEntry * HashEntry4FmtScn(ClockFmtScnStorage *fss) { return (Tcl_HashEntry*)(fss + 1); @@ -320,8 +402,18 @@ FmtScn4HashEntry(Tcl_HashEntry *hKeyPtr) { return (ClockFmtScnStorage*)(((char*)hKeyPtr) - sizeof(ClockFmtScnStorage)); }; -/* - * Format storage hash (list of formats shared across all threads). +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageAllocProc -- + * + * Allocate space for a hash entry containing format storage together + * with the string key. + * + * Results: + * The return value is a pointer to the created entry. + * + *---------------------------------------------------------------------- */ static Tcl_HashEntry * @@ -353,6 +445,19 @@ ClockFmtScnStorageAllocProc( return hPtr; } +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageFreeProc -- + * + * Free format storage object and space of given hash entry. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + static void ClockFmtScnStorageFreeProc( Tcl_HashEntry *hPtr) @@ -373,6 +478,19 @@ ClockFmtScnStorageFreeProc( ckfree(fss); } +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageDelete -- + * + * Delete format storage object. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss) { Tcl_HashEntry *hPtr = HashEntry4FmtScn(fss); @@ -392,7 +510,7 @@ static Tcl_HashKeyType ClockFmtScnStorageHashKeyType; /* - * Type definition. + * Type definition of clock-format tcl object type. */ Tcl_ObjType ClockFmtObjType = { @@ -409,9 +527,6 @@ Tcl_ObjType ClockFmtObjType = { #define ObjLocFmtKey(objPtr) \ (*((Tcl_Obj **)&(objPtr)->internalRep.twoPtrValue.ptr2)) -/* - *---------------------------------------------------------------------- - */ static void ClockFmtObj_DupInternalRep(srcPtr, copyPtr) Tcl_Obj *srcPtr; @@ -442,9 +557,7 @@ ClockFmtObj_DupInternalRep(srcPtr, copyPtr) copyPtr->length = srcPtr->length; } } -/* - *---------------------------------------------------------------------- - */ + static void ClockFmtObj_FreeInternalRep(objPtr) Tcl_Obj *objPtr; @@ -472,9 +585,7 @@ ClockFmtObj_FreeInternalRep(objPtr) } objPtr->typePtr = NULL; }; -/* - *---------------------------------------------------------------------- - */ + static int ClockFmtObj_SetFromAny(interp, objPtr) Tcl_Interp *interp; @@ -494,9 +605,7 @@ ClockFmtObj_SetFromAny(interp, objPtr) return TCL_OK; }; -/* - *---------------------------------------------------------------------- - */ + static void ClockFmtObj_UpdateString(objPtr) Tcl_Obj *objPtr; @@ -518,7 +627,25 @@ ClockFmtObj_UpdateString(objPtr) /* *---------------------------------------------------------------------- + * + * ClockFrmObjGetLocFmtKey -- + * + * Retrieves format key object used to search localized format. + * + * This is normally stored in second pointer of internal representation. + * If format object is not localizable, it is equal the given format + * pointer and the first pointer of internal representation may be NULL. + * + * Results: + * Returns tcl object with key or format object if not localizable. + * + * Side effects: + * Converts given format object to ClockFmtObjType on demand for caching + * the key inside its internal representation. + * + *---------------------------------------------------------------------- */ + MODULE_SCOPE Tcl_Obj* ClockFrmObjGetLocFmtKey( Tcl_Interp *interp, @@ -545,6 +672,25 @@ ClockFrmObjGetLocFmtKey( /* *---------------------------------------------------------------------- + * + * FindOrCreateFmtScnStorage -- + * + * Retrieves format storage for given string format. + * + * This will find the given format in the global storage hash table + * or create a format storage object on demaind and save the + * reference in the first pointer of internal representation of given + * object. + * + * Results: + * Returns scan/format storage pointer to ClockFmtScnStorage. + * + * Side effects: + * Converts given format object to ClockFmtObjType on demand for caching + * the format storage reference inside its internal representation. + * Increments objRefCount of the ClockFmtScnStorage reference. + * + *---------------------------------------------------------------------- */ static ClockFmtScnStorage * @@ -609,16 +755,16 @@ FindOrCreateFmtScnStorage( * * Tcl_GetClockFrmScnFromObj -- * - * Returns a clock format/scan representation of (*objPtr), if possible. - * If something goes wrong, NULL is returned, and if interp is non-NULL, - * an error message is written there. + * Returns a clock format/scan representation of (*objPtr), if possible. + * If something goes wrong, NULL is returned, and if interp is non-NULL, + * an error message is written there. * * Results: - * Valid representation of type ClockFmtScnStorage. + * Valid representation of type ClockFmtScnStorage. * * Side effects: - * Caches the ClockFmtScnStorage reference as the internal rep of (*objPtr) - * and in global hash table, shared across all threads. + * Caches the ClockFmtScnStorage reference as the internal rep of (*objPtr) + * and in global hash table, shared across all threads. * *---------------------------------------------------------------------- */ @@ -644,7 +790,27 @@ Tcl_GetClockFrmScnFromObj( return fss; } - +/* + *---------------------------------------------------------------------- + * + * ClockLocalizeFormat -- + * + * Wrap the format object in options to the localized format, + * corresponding given locale. + * + * This searches localized format in locale catalog, and if not yet + * exists, it executes ::tcl::clock::LocalizeFormat in given interpreter + * and caches its result in the locale catalog. + * + * Results: + * Localized format object. + * + * Side effects: + * Caches the localized format inside locale catalog. + * + *---------------------------------------------------------------------- + */ + MODULE_SCOPE Tcl_Obj * ClockLocalizeFormat( ClockFmtScnCmdArgs *opts) @@ -713,6 +879,22 @@ clean: return (opts->formatObj = valObj); } +/* + *---------------------------------------------------------------------- + * + * FindTokenBegin -- + * + * Find begin of given scan token in string, corresponding token type. + * + * Results: + * Position of token inside string if found. Otherwise - end of string. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + static const char * FindTokenBegin( register const char *p, @@ -748,12 +930,22 @@ FindTokenBegin( return p; } -/* +/* + *---------------------------------------------------------------------- + * * DetermineGreedySearchLen -- * - * Determine min/max lengths as exact as possible (speed, greedy match) + * Determine min/max lengths as exact as possible (speed, greedy match). * + * Results: + * None. Lengths are stored in *minLenPtr, *maxLenPtr. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- */ + static void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok, @@ -836,6 +1028,23 @@ DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, *maxLenPtr = maxLen; } +/* + *---------------------------------------------------------------------- + * + * ObjListSearch -- + * + * Find largest part of the input string from start regarding min and + * max lengths in the given list (utf-8, case sensitive). + * + * Results: + * TCL_OK - match found, TCL_RETURN - not matched, TCL_ERROR in error case. + * + * Side effects: + * Input points to end of the found token in string. + * + *---------------------------------------------------------------------- + */ + static inline int ObjListSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, int *val, @@ -909,6 +1118,26 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, } #endif +/* + *---------------------------------------------------------------------- + * + * ClockMCGetListIdxTree -- + * + * Retrieves localized string indexed tree in the locale catalog for + * given literal index mcKey (and builds it on demand). + * + * Searches localized index in locale catalog, and if not yet exists, + * creates string indexed tree and stores it in the locale catalog. + * + * Results: + * Localized string index tree. + * + * Side effects: + * Caches the localized string index tree inside locale catalog. + * + *---------------------------------------------------------------------- + */ + static TclStrIdxTree * ClockMCGetListIdxTree( ClockFmtScnCmdArgs *opts, @@ -960,6 +1189,27 @@ done: return idxTree; } +/* + *---------------------------------------------------------------------- + * + * ClockMCGetMultiListIdxTree -- + * + * Retrieves localized string indexed tree in the locale catalog for + * multiple lists by literal indices mcKeys (and builds it on demand). + * + * Searches localized index in locale catalog for mcKey, and if not + * yet exists, creates string indexed tree and stores it in the + * locale catalog. + * + * Results: + * Localized string index tree. + * + * Side effects: + * Caches the localized string index tree inside locale catalog. + * + *---------------------------------------------------------------------- + */ + static TclStrIdxTree * ClockMCGetMultiListIdxTree( ClockFmtScnCmdArgs *opts, @@ -1016,6 +1266,25 @@ done: return idxTree; } +/* + *---------------------------------------------------------------------- + * + * ClockStrIdxTreeSearch -- + * + * Find largest part of the input string from start regarding lengths + * in the given localized string indexed tree (utf-8, case sensitive). + * + * Results: + * TCL_OK - match found and the index stored in *val, + * TCL_RETURN - not matched or ambigous, + * TCL_ERROR - in error case. + * + * Side effects: + * Input points to end of the found token in string. + * + *---------------------------------------------------------------------- + */ + static inline int ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, TclStrIdxTree *idxTree, int *val, -- cgit v0.12 From 35539e2f98f007de63a0bef192a769c9f8f9ad91 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 9 Feb 2017 11:34:43 +0000 Subject: =?UTF-8?q?resolve=20warning:=20enumeration=20value=20=E2=80=98TMR?= =?UTF-8?q?T=5FLAST=E2=80=99=20not=20handled=20in=20switch=20(impossible?= =?UTF-8?q?=20to=20handle=20in=20switch=20because=20of=20break);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generic/tclCmdMZ.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index c660596..319799c 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4089,7 +4089,7 @@ Tcl_TimeRateObjCmd( i++; break; } - switch ((enum options) index) { + switch (index) { case TMRT_EV_DIRECT: direct = objv[i]; break; -- cgit v0.12 From ca98340c4c69feed95b1823e8a83800a1ea8fae3 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 9 Feb 2017 11:36:17 +0000 Subject: [timerate] bug fix: missing scale conversion by Mac OSX on platform where high resolution clicks are not microseconds based; [win] use high resolution timer for the wide clicks and microseconds directly, prevent several forwards/backwards conversions; [win, unix, mac-osx] normalize some functions for common usage in different time units (clicks, micro- and nanoseconds) --- generic/tclClock.c | 9 +-- generic/tclCmdMZ.c | 24 +++++--- generic/tclInt.h | 16 ++++++ unix/tclUnixTime.c | 71 +++++++++++++++++++++++ win/tclWinTime.c | 166 ++++++++++++++++++++++++++++++++++++++++++----------- 5 files changed, 238 insertions(+), 48 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 27009fd..5da9511 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -1760,8 +1760,7 @@ ClockClicksObjCmd( #endif break; case CLICKS_MICROS: - Tcl_GetTime(&now); - clicks = ((Tcl_WideInt) now.sec * 1000000) + now.usec; + clicks = TclpGetMicroseconds(); break; } @@ -1831,15 +1830,11 @@ ClockMicrosecondsObjCmd( int objc, /* Parameter count */ Tcl_Obj *const *objv) /* Parameter values */ { - Tcl_Time now; - if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } - Tcl_GetTime(&now); - Tcl_SetObjResult(interp, Tcl_NewWideIntObj( - ((Tcl_WideInt) now.sec * 1000000) + now.usec)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclpGetMicroseconds())); return TCL_OK; } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 319799c..b0212c3 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4215,16 +4215,19 @@ usage: } /* get start and stop time */ -#ifndef TCL_WIDE_CLICKS +#ifdef TCL_WIDE_CLICKS + start = middle = TclpGetWideClicks(); + /* time to stop execution (in wide clicks) */ + stop = start + (maxms * 1000 / TclpWideClickInMicrosec()); +#else Tcl_GetTime(&now); start = now.sec; start *= 1000000; start += now.usec; -#else - start = TclpGetWideClicks(); + middle = start; + /* time to stop execution (in microsecs) */ + stop = start + maxms * 1000; #endif /* start measurement */ - stop = start + maxms * 1000; - middle = start; while (1) { /* eval single iteration */ count++; @@ -4246,11 +4249,11 @@ usage: if (--threshold > 0) continue; /* check stop time reached, estimate new threshold */ - #ifndef TCL_WIDE_CLICKS + #ifdef TCL_WIDE_CLICKS + middle = TclpGetWideClicks(); + #else Tcl_GetTime(&now); middle = now.sec; middle *= 1000000; middle += now.usec; - #else - middle = TclpGetWideClicks(); #endif if (middle >= stop) { break; @@ -4274,6 +4277,11 @@ usage: middle -= start; /* execution time in microsecs */ + #ifdef TCL_WIDE_CLICKS + /* convert execution time in wide clicks to microsecs */ + middle *= TclpWideClickInMicrosec(); + #endif + /* if not calibrate */ if (!calibrate) { /* minimize influence of measurement overhead */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 1b37d84..fb0bcb7 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3189,7 +3189,23 @@ MODULE_SCOPE void TclFinalizeThreadStorage(void); #ifdef TCL_WIDE_CLICKS MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks); +MODULE_SCOPE double TclpWideClickInMicrosec(void); +#else +# ifdef _WIN32 +# define TCL_WIDE_CLICKS 1 +MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); +# define TclpWideClicksToNanoseconds(clicks) \ + ((double)(clicks) * 1000) +# define TclpWideClickInMicrosec() (1) +# endif #endif +#ifndef _WIN32 +MODULE_SCOPE Tcl_WideInt TclpGetMicroseconds(void); +#else +# define TclpGetMicroseconds() \ + TclpGetWideClicks() +#endif + MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp); MODULE_SCOPE void * TclpThreadCreateKey(void); MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr); diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index d634449..8ec6e8a 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -84,6 +84,32 @@ TclpGetSeconds(void) /* *---------------------------------------------------------------------- * + * TclpGetMicroseconds -- + * + * This procedure returns the number of microseconds from the epoch. + * On most Unix systems the epoch is Midnight Jan 1, 1970 GMT. + * + * Results: + * Number of microseconds from the epoch. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Tcl_WideInt +TclpGetMicroseconds(void) +{ + Tcl_Time time; + + tclGetTimeProcPtr(&time, tclTimeClientData); + return ((Tcl_WideInt)time.sec)*1000000 + time.usec; +} + +/* + *---------------------------------------------------------------------- + * * TclpGetClicks -- * * This procedure returns a value that represents the highest resolution @@ -216,6 +242,51 @@ TclpWideClicksToNanoseconds( return nsec; } + +/* + *---------------------------------------------------------------------- + * + * TclpWideClickInMicrosec -- + * + * This procedure return scale to convert click values from the + * TclpGetWideClicks native resolution to microsecond resolution + * and back. + * + * Results: + * 1 click in microseconds as double. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +double +TclpWideClickInMicrosec(void) +{ + if (tclGetTimeProcPtr != NativeGetTime) { + return 1.0; + } else { +#ifdef MAC_OSX_TCL + static int initialized = 0; + static double scale = 0.0; + + if (initialized) { + return scale; + } else { + mach_timebase_info_data_t tb; + + mach_timebase_info(&tb); + /* value of tb.numer / tb.denom = 1 click in nanoseconds */ + scale = ((double)tb.numer) / tb.denom / 1000; + initialized = 1; + return scale; + } +#else +#error Wide high-resolution clicks not implemented on this platform +#endif + } +} #endif /* TCL_WIDE_CLICKS */ /* diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 81d9458..06ea6cd 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -123,6 +123,7 @@ static Tcl_WideInt AccumulateSample(Tcl_WideInt perfCounter, Tcl_WideUInt fileTime); static void NativeScaleTime(Tcl_Time* timebuf, ClientData clientData); +static Tcl_WideInt NativeGetMicroseconds(void); static void NativeGetTime(Tcl_Time* timebuf, ClientData clientData); @@ -154,10 +155,19 @@ ClientData tclTimeClientData = NULL; unsigned long TclpGetSeconds(void) { - Tcl_Time t; + Tcl_WideInt usecSincePosixEpoch; - tclGetTimeProcPtr(&t, tclTimeClientData); /* Tcl_GetTime inlined. */ - return t.sec; + /* Try to use high resolution timer */ + if ( tclGetTimeProcPtr == NativeGetTime + && (usecSincePosixEpoch = NativeGetMicroseconds()) + ) { + return usecSincePosixEpoch / 1000000; + } else { + Tcl_Time t; + + tclGetTimeProcPtr(&t, tclTimeClientData); /* Tcl_GetTime inlined. */ + return t.sec; + } } /* @@ -182,19 +192,66 @@ TclpGetSeconds(void) unsigned long TclpGetClicks(void) { - /* - * Use the Tcl_GetTime abstraction to get the time in microseconds, as - * nearly as we can, and return it. - */ + Tcl_WideInt usecSincePosixEpoch; - Tcl_Time now; /* Current Tcl time */ - unsigned long retval; /* Value to return */ + /* Try to use high resolution timer */ + if ( tclGetTimeProcPtr == NativeGetTime + && (usecSincePosixEpoch = NativeGetMicroseconds()) + ) { + return (unsigned long)usecSincePosixEpoch; + } else { + /* + * Use the Tcl_GetTime abstraction to get the time in microseconds, as + * nearly as we can, and return it. + */ - tclGetTimeProcPtr(&now, tclTimeClientData); /* Tcl_GetTime inlined */ + Tcl_Time now; /* Current Tcl time */ - retval = (now.sec * 1000000) + now.usec; - return retval; + tclGetTimeProcPtr(&now, tclTimeClientData); /* Tcl_GetTime inlined */ + return (unsigned long)(now.sec * 1000000) + now.usec; + } +} + +/* + *---------------------------------------------------------------------- + * + * TclpGetWideClicks -- + * + * This procedure returns a WideInt value that represents the highest + * resolution clock in microseconds available on the system. + * + * Results: + * Number of microseconds (from the epoch). + * + * Side effects: + * This should be used for time-delta resp. for measurement purposes + * only, because on some platforms can return microseconds from some + * start time (not from the epoch). + * + *---------------------------------------------------------------------- + */ + +Tcl_WideInt +TclpGetWideClicks(void) +{ + Tcl_WideInt usecSincePosixEpoch; + + /* Try to use high resolution timer */ + if ( tclGetTimeProcPtr == NativeGetTime + && (usecSincePosixEpoch = NativeGetMicroseconds()) + ) { + return usecSincePosixEpoch; + } else { + /* + * Use the Tcl_GetTime abstraction to get the time in microseconds, as + * nearly as we can, and return it. + */ + + Tcl_Time now; + tclGetTimeProcPtr(&now, tclTimeClientData); /* Tcl_GetTime inlined */ + return (((Tcl_WideInt)now.sec) * 1000000) + now.usec; + } } /* @@ -223,7 +280,17 @@ void Tcl_GetTime( Tcl_Time *timePtr) /* Location to store time information. */ { - tclGetTimeProcPtr(timePtr, tclTimeClientData); + Tcl_WideInt usecSincePosixEpoch; + + /* Try to use high resolution timer */ + if ( tclGetTimeProcPtr == NativeGetTime + && (usecSincePosixEpoch = NativeGetMicroseconds()) + ) { + timePtr->sec = (long) (usecSincePosixEpoch / 1000000); + timePtr->usec = (unsigned long) (usecSincePosixEpoch % 1000000); + } else { + tclGetTimeProcPtr(timePtr, tclTimeClientData); + } } /* @@ -256,13 +323,14 @@ NativeScaleTime( /* *---------------------------------------------------------------------- * - * NativeGetTime -- + * NativeGetMicroseconds -- * - * TIP #233: Gets the current system time in seconds and microseconds - * since the beginning of the epoch: 00:00 UCT, January 1, 1970. + * Gets the current system time in microseconds since the beginning + * of the epoch: 00:00 UCT, January 1, 1970. * * Results: - * Returns the current time in timePtr. + * Returns the wide integer with number of microseconds from the epoch, or + * 0 if high resolution timer is not available. * * Side effects: * On the first call, initializes a set of static variables to keep track @@ -275,13 +343,9 @@ NativeScaleTime( *---------------------------------------------------------------------- */ -static void -NativeGetTime( - Tcl_Time *timePtr, - ClientData clientData) +static Tcl_WideInt +NativeGetMicroseconds(void) { - struct _timeb t; - /* * Initialize static storage on the first trip through. * @@ -432,9 +496,7 @@ NativeGetTime( if (curCounter.QuadPart <= perfCounterLastCall.QuadPart) { usecSincePosixEpoch = (fileTimeLastCall.QuadPart - posixEpoch.QuadPart) / 10; - timePtr->sec = (long) (usecSincePosixEpoch / 1000000); - timePtr->usec = (unsigned long) (usecSincePosixEpoch % 1000000); - return; + return usecSincePosixEpoch; } /* @@ -455,19 +517,57 @@ NativeGetTime( * 10000000 / curCounterFreq.QuadPart); usecSincePosixEpoch = (curFileTime - posixEpoch.QuadPart) / 10; - timePtr->sec = (long) (usecSincePosixEpoch / 1000000); - timePtr->usec = (unsigned long) (usecSincePosixEpoch % 1000000); - return; + return usecSincePosixEpoch; } } /* - * High resolution timer is not available. Just use ftime. + * High resolution timer is not available. */ + return 0; +} + +/* + *---------------------------------------------------------------------- + * + * NativeGetTime -- + * + * TIP #233: Gets the current system time in seconds and microseconds + * since the beginning of the epoch: 00:00 UCT, January 1, 1970. + * + * Results: + * Returns the current time in timePtr. + * + * Side effects: + * See NativeGetMicroseconds for more information. + * + *---------------------------------------------------------------------- + */ - _ftime(&t); - timePtr->sec = (long)t.time; - timePtr->usec = t.millitm * 1000; +static void +NativeGetTime( + Tcl_Time *timePtr, + ClientData clientData) +{ + Tcl_WideInt usecSincePosixEpoch; + + /* + * Try to use high resolution timer. + */ + if ( (usecSincePosixEpoch = NativeGetMicroseconds()) ) { + timePtr->sec = (long) (usecSincePosixEpoch / 1000000); + timePtr->usec = (unsigned long) (usecSincePosixEpoch % 1000000); + } else { + /* + * High resolution timer is not available. Just use ftime. + */ + + struct _timeb t; + + _ftime(&t); + timePtr->sec = (long)t.time; + timePtr->usec = t.millitm * 1000; + } } /* -- cgit v0.12 From 8dde174dd4188f1b4d55f6d88a01a1d3887f507b Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 9 Feb 2017 13:45:14 +0000 Subject: =?UTF-8?q?[win]=20accomplished=20winTime=20module=20using=20very?= =?UTF-8?q?=20fast=20wide=20clicks,=20with=20denominator=20scale=20to/from?= =?UTF-8?q?=20microseconds,=20and=20therefore=20more=20precise=20"timerate?= =?UTF-8?q?"=20results=20under=20windows=20(using=20similar=20mechanisms?= =?UTF-8?q?=20as=20by=20Mac=20OSX).=20Especially=20multi-threaded,=20becau?= =?UTF-8?q?se=20it=20works=20without=20lock=20opposite=20to=20microseconds?= =?UTF-8?q?=20(that=20use=20crictical=20section,=20because=20of=20the=20ca?= =?UTF-8?q?libration=20thread).=20The=20reason=20for=20usage=20of=20wide?= =?UTF-8?q?=20clicks=20instead=20microseconds=20explains=20following=20exa?= =?UTF-8?q?mple=20(shows=2020%=20performance=20deference):=20%=20timerate?= =?UTF-8?q?=20-calibrate=20{}=20%=20timerate=20{clock=20microseconds}=2050?= =?UTF-8?q?00=200.297037=20=C2=B5s/#=2014465901=20#=203366585=20#/sec=2042?= =?UTF-8?q?96.906=20nett-ms=20%=20timerate=20{clock=20clicks}=205000=200.2?= =?UTF-8?q?47797=20=C2=B5s/#=2016869084=20#=204035554=20#/sec=204180.116?= =?UTF-8?q?=20nett-ms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generic/tclInt.h | 10 ++---- win/tclWinTime.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 103 insertions(+), 14 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index fb0bcb7..3c21de0 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3186,6 +3186,7 @@ MODULE_SCOPE int TclpLoadMemory(Tcl_Interp *interp, void *buffer, MODULE_SCOPE void TclInitThreadStorage(void); MODULE_SCOPE void TclFinalizeThreadDataThread(void); MODULE_SCOPE void TclFinalizeThreadStorage(void); + #ifdef TCL_WIDE_CLICKS MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks); @@ -3194,17 +3195,12 @@ MODULE_SCOPE double TclpWideClickInMicrosec(void); # ifdef _WIN32 # define TCL_WIDE_CLICKS 1 MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); +MODULE_SCOPE double TclpWideClickInMicrosec(void); # define TclpWideClicksToNanoseconds(clicks) \ - ((double)(clicks) * 1000) -# define TclpWideClickInMicrosec() (1) + ((double)(clicks) * TclpWideClickInMicrosec() * 1000) # endif #endif -#ifndef _WIN32 MODULE_SCOPE Tcl_WideInt TclpGetMicroseconds(void); -#else -# define TclpGetMicroseconds() \ - TclpGetWideClicks() -#endif MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp); MODULE_SCOPE void * TclpThreadCreateKey(void); diff --git a/win/tclWinTime.c b/win/tclWinTime.c index 06ea6cd..7cbc1ba 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -110,6 +110,17 @@ static TimeInfo timeInfo = { }; /* + * Scale to convert wide click values from the TclpGetWideClicks native + * resolution to microsecond resolution and back. + */ +static struct { + int initialized; /* 1 if initialized, 0 otherwise */ + int perfCounter; /* 1 if performance counter usable for wide clicks */ + double microsecsScale; /* Denominator scale between clock / microsecs */ +} wideClick = {0, 0.0}; + + +/* * Declarations for functions defined later in this file. */ @@ -221,7 +232,7 @@ TclpGetClicks(void) * resolution clock in microseconds available on the system. * * Results: - * Number of microseconds (from the epoch). + * Number of microseconds (from some start time). * * Side effects: * This should be used for time-delta resp. for measurement purposes @@ -234,6 +245,87 @@ TclpGetClicks(void) Tcl_WideInt TclpGetWideClicks(void) { + LARGE_INTEGER curCounter; + + if (!wideClick.initialized) { + LARGE_INTEGER perfCounterFreq; + + /* + * The frequency of the performance counter is fixed at system boot and + * is consistent across all processors. Therefore, the frequency need + * only be queried upon application initialization. + */ + if (QueryPerformanceFrequency(&perfCounterFreq)) { + wideClick.perfCounter = 1; + wideClick.microsecsScale = 1000000.0 / perfCounterFreq.QuadPart; + } else { + /* fallback using microseconds */ + wideClick.perfCounter = 0; + wideClick.microsecsScale = 1; + } + + wideClick.initialized = 1; + } + if (wideClick.perfCounter) { + if (QueryPerformanceCounter(&curCounter)) { + return (Tcl_WideInt)curCounter.QuadPart; + } + /* fallback using microseconds */ + wideClick.perfCounter = 0; + wideClick.microsecsScale = 1; + return TclpGetMicroseconds(); + } else { + return TclpGetMicroseconds(); + } +} + +/* + *---------------------------------------------------------------------- + * + * TclpWideClickInMicrosec -- + * + * This procedure return scale to convert wide click values from the + * TclpGetWideClicks native resolution to microsecond resolution + * and back. + * + * Results: + * 1 click in microseconds as double. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +double +TclpWideClickInMicrosec(void) +{ + if (!wideClick.initialized) { + (void)TclpGetWideClicks(); /* initialize */ + } + return wideClick.microsecsScale; +} + +/* + *---------------------------------------------------------------------- + * + * TclpGetMicroseconds -- + * + * This procedure returns a WideInt value that represents the highest + * resolution clock in microseconds available on the system. + * + * Results: + * Number of microseconds (from the epoch). + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Tcl_WideInt +TclpGetMicroseconds(void) +{ Tcl_WideInt usecSincePosixEpoch; /* Try to use high resolution timer */ @@ -346,6 +438,9 @@ NativeScaleTime( static Tcl_WideInt NativeGetMicroseconds(void) { + static LARGE_INTEGER posixEpoch; + /* Posix epoch expressed as 100-ns ticks since + * the windows epoch. */ /* * Initialize static storage on the first trip through. * @@ -356,6 +451,10 @@ NativeGetMicroseconds(void) if (!timeInfo.initialized) { TclpInitLock(); if (!timeInfo.initialized) { + + posixEpoch.LowPart = 0xD53E8000; + posixEpoch.HighPart = 0x019DB1DE; + timeInfo.perfCounterAvailable = QueryPerformanceFrequency(&timeInfo.nominalFreq); @@ -468,15 +567,9 @@ NativeGetMicroseconds(void) /* Current performance counter. */ Tcl_WideInt curFileTime;/* Current estimated time, expressed as 100-ns * ticks since the Windows epoch. */ - static LARGE_INTEGER posixEpoch; - /* Posix epoch expressed as 100-ns ticks since - * the windows epoch. */ Tcl_WideInt usecSincePosixEpoch; /* Current microseconds since Posix epoch. */ - posixEpoch.LowPart = 0xD53E8000; - posixEpoch.HighPart = 0x019DB1DE; - QueryPerformanceCounter(&curCounter); /* -- cgit v0.12 From efa3ec69393a1dee51e76e848dbe10ebaa55603e Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 11 Feb 2017 21:36:36 +0000 Subject: Proposed implementation of [regsub -command]. --- generic/tclCmdMZ.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++---- tests/regexp.test | 22 +++++++++++++- tests/regexpComp.test | 2 +- 3 files changed, 98 insertions(+), 8 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ba1fc41..ffae8b2 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -487,26 +487,28 @@ Tcl_RegsubObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int idx, result, cflags, all, wlen, wsublen, numMatches, offset; - int start, end, subStart, subEnd, match; + int start, end, subStart, subEnd, match, command; Tcl_RegExp regExpr; Tcl_RegExpInfo info; Tcl_Obj *resultPtr, *subPtr, *objPtr, *startIndex = NULL; + Tcl_Obj **args = NULL, *parts[2], *cmdObj; Tcl_UniChar ch, *wsrc, *wfirstChar, *wstring, *wsubspec, *wend; static const char *const options[] = { - "-all", "-nocase", "-expanded", - "-line", "-linestop", "-lineanchor", "-start", + "-all", "-command", "-expanded", "-line", + "-linestop", "-lineanchor", "-nocase", "-start", "--", NULL }; enum options { - REGSUB_ALL, REGSUB_NOCASE, REGSUB_EXPANDED, - REGSUB_LINE, REGSUB_LINESTOP, REGSUB_LINEANCHOR, REGSUB_START, + REGSUB_ALL, REGSUB_COMMAND, REGSUB_EXPANDED, REGSUB_LINE, + REGSUB_LINESTOP, REGSUB_LINEANCHOR, REGSUB_NOCASE, REGSUB_START, REGSUB_LAST }; cflags = TCL_REG_ADVANCED; all = 0; offset = 0; + command = 0; resultPtr = NULL; for (idx = 1; idx < objc; idx++) { @@ -528,6 +530,9 @@ Tcl_RegsubObjCmd( case REGSUB_NOCASE: cflags |= TCL_REG_NOCASE; break; + case REGSUB_COMMAND: + command = 1; + break; case REGSUB_EXPANDED: cflags |= TCL_REG_EXPANDED; break; @@ -585,7 +590,7 @@ Tcl_RegsubObjCmd( } } - if (all && (offset == 0) + if (all && (offset == 0) && (command == 0) && (strpbrk(TclGetString(objv[2]), "&\\") == NULL) && (strpbrk(TclGetString(objv[0]), "*+?{}()[].\\|^$") == NULL)) { /* @@ -737,6 +742,68 @@ Tcl_RegsubObjCmd( Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, start); /* + * In -command mode, the substitutions are added as quoted arguments + * to the subSpec to form a command, that is then executed and the + * result used as the string to substitute in. + */ + + if (command) { + if (args == NULL) { + args = ckalloc(sizeof(Tcl_Obj*) * (info.nsubs + 1)); + } + + for (idx = 0 ; idx <= info.nsubs ; idx++) { + subStart = info.matches[idx].start; + subEnd = info.matches[idx].end; + if ((subStart >= 0) && (subEnd >= 0)) { + args[idx] = Tcl_NewUnicodeObj( + wstring + offset + subStart, subEnd - subStart); + } else { + args[idx] = Tcl_NewObj(); + } + } + parts[0] = subPtr; + parts[1] = Tcl_NewListObj(info.nsubs+1, args); + cmdObj = Tcl_ConcatObj(2, parts); + Tcl_IncrRefCount(cmdObj); + Tcl_DecrRefCount(parts[1]); + + result = Tcl_EvalObjEx(interp, cmdObj, TCL_EVAL_DIRECT); + Tcl_DecrRefCount(cmdObj); + if (result != TCL_OK) { + if (result == TCL_ERROR) { + Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( + "\n (%s substitution computation script)", + options[REGSUB_COMMAND])); + } + goto done; + } + + Tcl_AppendObjToObj(resultPtr, Tcl_GetObjResult(interp)); + Tcl_ResetResult(interp); + + offset += end; + if (end == 0 || start == end) { + /* + * Always consume at least one character of the input string + * in order to prevent infinite loops, even when we + * technically matched the empty string; we must not match + * again at the same spot. + */ + + if (offset < wlen) { + Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, 1); + } + offset++; + } + if (all) { + continue; + } else { + break; + } + } + + /* * Append the subSpec argument to the variable, making appropriate * substitutions. This code is a bit hairy because of the backslash * conventions and because the code saves up ranges of characters in @@ -864,6 +931,9 @@ Tcl_RegsubObjCmd( if (subPtr && (objv[2] == objv[0])) { Tcl_DecrRefCount(subPtr); } + if (args) { + ckfree(args); + } if (resultPtr) { Tcl_DecrRefCount(resultPtr); } diff --git a/tests/regexp.test b/tests/regexp.test index 4ffdbdb..6c77b41 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -453,7 +453,7 @@ test regexp-11.4 {regsub errors} { } {1 {wrong # args: should be "regsub ?-option ...? exp string subSpec ?varName?"}} test regexp-11.5 {regsub errors} { list [catch {regsub -gorp a b c} msg] $msg -} {1 {bad option "-gorp": must be -all, -nocase, -expanded, -line, -linestop, -lineanchor, -start, or --}} +} {1 {bad option "-gorp": must be -all, -command, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --}} test regexp-11.6 {regsub errors} { list [catch {regsub -nocase a( b c d} msg] $msg } {1 {couldn't compile regular expression pattern: parentheses () not balanced}} @@ -1123,6 +1123,26 @@ test regexp-26.12 {regexp with -line option} { test regexp-26.13 {regexp without -line option} { regexp -all -inline -- {a*} "b\n" } {{} {}} + +test regexp-27.1 {regsub -command} { + regsub -command {.x.} {abcxdef} {string length} +} ab3ef +test regexp-27.2 {regsub -command} { + regsub -command {.x.} {abcxdefxghi} {string length} +} ab3efxghi +test regexp-27.3 {regsub -command} { + set x 0 + regsub -all -command {(?=.)} abcde "incr x;#" +} 1a2b3c4d5e +test regexp-27.4 {regsub -command} -body { + regsub -command {.x.} {abcxdef} error +} -returnCodes error -result cxd +test regexp-27.5 {regsub -command} { + regsub -command {(.)(.)} {abcdef} {list ,} +} {, ab a bcdef} +test regexp-27.6 {regsub -command} { + regsub -command -all {(.)(.)} {abcdef} {list ,} +} {, ab a b, cd c d, ef e f} # cleanup ::tcltest::cleanupTests diff --git a/tests/regexpComp.test b/tests/regexpComp.test index b8e64b6..fbf8012 100644 --- a/tests/regexpComp.test +++ b/tests/regexpComp.test @@ -587,7 +587,7 @@ test regexpComp-11.5 {regsub errors} { evalInProc { list [catch {regsub -gorp a b c} msg] $msg } -} {1 {bad option "-gorp": must be -all, -nocase, -expanded, -line, -linestop, -lineanchor, -start, or --}} +} {1 {bad option "-gorp": must be -all, -command, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --}} test regexpComp-11.6 {regsub errors} { evalInProc { list [catch {regsub -nocase a( b c d} msg] $msg -- cgit v0.12 From c8646e5c72e90d6e78802f41ce39fa603e32e6b3 Mon Sep 17 00:00:00 2001 From: aspect Date: Sun, 12 Feb 2017 12:57:29 +0000 Subject: fix chan leak with http keepalive vs close (bug [6ca52aec14]) --- library/http/http.tcl | 7 ++++--- tests/http.test | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/library/http/http.tcl b/library/http/http.tcl index ccd4cd1..19799b9 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -197,9 +197,10 @@ proc http::Finish {token {errormsg ""} {skipCB 0}} { set state(error) [list $errormsg $errorInfo $errorCode] set state(status) "error" } - if { - ($state(status) eq "timeout") || ($state(status) eq "error") || - ([info exists state(connection)] && ($state(connection) eq "close")) + if { ($state(status) eq "timeout") + || ($state(status) eq "error") + || ([info exists state(-keepalive)] && !$state(-keepalive)) + || ([info exists state(connection)] && ($state(connection) eq "close")) } { CloseSocket $state(sock) $token } diff --git a/tests/http.test b/tests/http.test index 12ad475..d7e42c2 100644 --- a/tests/http.test +++ b/tests/http.test @@ -592,6 +592,14 @@ test http-4.15 {http::Event} -body { } -cleanup { catch {http::cleanup $token} } -returnCodes 1 -match glob -result "couldn't open socket*" +test http-1.15 {Leak with Close vs Keepalive (bug [6ca52aec14]} -body { + set before [chan names] + set token [http::geturl $url -headers {X-Connection keep-alive}] + http::cleanup $token + update + set after [chan names] + expr {$before eq $after} +} -result 1 test http-5.1 {http::formatQuery} { http::formatQuery name1 value1 name2 "value two" -- cgit v0.12 From 3ef7160d4155e52cf26b62290674100b34243e00 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 17 Feb 2017 06:08:18 +0000 Subject: Switch to using command prefixes properly. This is quite a bit faster. --- generic/tclCmdMZ.c | 63 +++++++++++++++++++++++++++++++++++++++--------------- tests/regexp.test | 2 +- 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ffae8b2..d6d0152 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -487,11 +487,11 @@ Tcl_RegsubObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int idx, result, cflags, all, wlen, wsublen, numMatches, offset; - int start, end, subStart, subEnd, match, command; + int start, end, subStart, subEnd, match, command, numParts, numArgs; Tcl_RegExp regExpr; Tcl_RegExpInfo info; Tcl_Obj *resultPtr, *subPtr, *objPtr, *startIndex = NULL; - Tcl_Obj **args = NULL, *parts[2], *cmdObj; + Tcl_Obj **args = NULL, **parts; Tcl_UniChar ch, *wsrc, *wfirstChar, *wstring, *wsubspec, *wend; static const char *const options[] = { @@ -666,6 +666,20 @@ Tcl_RegsubObjCmd( return TCL_ERROR; } + if (command) { + /* + * In command-prefix mode, we require that the third non-option + * argument be a list, so we enforce that here. Afterwards, we fetch + * the RE compilation again in case objv[0] and objv[2] are the same + * object. (If they aren't, that's cheap to do.) + */ + + if (Tcl_ListObjLength(interp, objv[2], &numParts) != TCL_OK) { + return TCL_ERROR; + } + regExpr = Tcl_GetRegExpFromObj(interp, objv[0], cflags); + } + /* * Make sure to avoid problems where the objects are shared. This can * cause RegExpObj <> UnicodeObj shimmering that causes data corruption. @@ -683,7 +697,9 @@ Tcl_RegsubObjCmd( } else { subPtr = objv[2]; } - wsubspec = Tcl_GetUnicodeFromObj(subPtr, &wsublen); + if (!command) { + wsubspec = Tcl_GetUnicodeFromObj(subPtr, &wsublen); + } result = TCL_OK; @@ -742,34 +758,47 @@ Tcl_RegsubObjCmd( Tcl_AppendUnicodeToObj(resultPtr, wstring + offset, start); /* - * In -command mode, the substitutions are added as quoted arguments - * to the subSpec to form a command, that is then executed and the - * result used as the string to substitute in. + * In command-prefix mode, the substitutions are added as quoted + * arguments to the subSpec to form a command, that is then executed + * and the result used as the string to substitute in. Actually, + * everything is passed through Tcl_EvalObjv, as that's much faster. */ if (command) { if (args == NULL) { - args = ckalloc(sizeof(Tcl_Obj*) * (info.nsubs + 1)); + Tcl_ListObjGetElements(interp, subPtr, &numParts, &parts); + numArgs = numParts + info.nsubs + 1; + args = ckalloc(sizeof(Tcl_Obj*) * numArgs); + memcpy(args, parts, sizeof(Tcl_Obj*) * numParts); } for (idx = 0 ; idx <= info.nsubs ; idx++) { subStart = info.matches[idx].start; subEnd = info.matches[idx].end; if ((subStart >= 0) && (subEnd >= 0)) { - args[idx] = Tcl_NewUnicodeObj( + args[idx + numParts] = Tcl_NewUnicodeObj( wstring + offset + subStart, subEnd - subStart); } else { - args[idx] = Tcl_NewObj(); + args[idx + numParts] = Tcl_NewObj(); } + Tcl_IncrRefCount(args[idx + numParts]); + } + + /* + * At this point, we're locally holding the references to the + * argument words we added for this time round the loop, and the + * subPtr is holding the references to the words that the user + * supplied directly. None are zero-refcount, which is important + * because Tcl_EvalObjv is "hairy monster" in terms of refcount + * handling, being able to optionally add references to any of its + * argument words. We'll drop the local refs immediately + * afterwarsds; subPtr is handled in the main exit stanza. + */ + + result = Tcl_EvalObjv(interp, numArgs, args, 0); + for (idx = 0 ; idx <= info.nsubs ; idx++) { + TclDecrRefCount(args[idx + numParts]); } - parts[0] = subPtr; - parts[1] = Tcl_NewListObj(info.nsubs+1, args); - cmdObj = Tcl_ConcatObj(2, parts); - Tcl_IncrRefCount(cmdObj); - Tcl_DecrRefCount(parts[1]); - - result = Tcl_EvalObjEx(interp, cmdObj, TCL_EVAL_DIRECT); - Tcl_DecrRefCount(cmdObj); if (result != TCL_OK) { if (result == TCL_ERROR) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( diff --git a/tests/regexp.test b/tests/regexp.test index 6c77b41..6c3d774 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -1132,7 +1132,7 @@ test regexp-27.2 {regsub -command} { } ab3efxghi test regexp-27.3 {regsub -command} { set x 0 - regsub -all -command {(?=.)} abcde "incr x;#" + regsub -all -command {(?=.)} abcde {apply {args {incr ::x}}} } 1a2b3c4d5e test regexp-27.4 {regsub -command} -body { regsub -command {.x.} {abcxdef} error -- cgit v0.12 From 5772e32729279c7caac6968a62a65e0eb3550eb4 Mon Sep 17 00:00:00 2001 From: dkf Date: Fri, 17 Feb 2017 09:20:49 +0000 Subject: Stop problems with representation smashes. --- generic/tclCmdMZ.c | 7 +++++++ tests/regexp.test | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index d6d0152..110de4c 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -811,6 +811,13 @@ Tcl_RegsubObjCmd( Tcl_AppendObjToObj(resultPtr, Tcl_GetObjResult(interp)); Tcl_ResetResult(interp); + /* + * Refetch the unicode, in case the representation was smashed by + * the user code. + */ + + wstring = Tcl_GetUnicodeFromObj(objPtr, &wlen); + offset += end; if (end == 0 || start == end) { /* diff --git a/tests/regexp.test b/tests/regexp.test index 6c3d774..ad770fa 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -1143,6 +1143,12 @@ test regexp-27.5 {regsub -command} { test regexp-27.6 {regsub -command} { regsub -command -all {(.)(.)} {abcdef} {list ,} } {, ab a b, cd c d, ef e f} +test regexp-27.7 {regsub -command representation smash} { + set ::s {123=456 789} + regsub -command -all {\d+} $::s {apply {n { + expr {[llength $::s] + $n} + }}} +} {125=458 791} # cleanup ::tcltest::cleanupTests -- cgit v0.12 From 82296abf086a1bc70975fe726a9887fe102b0330 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 18 Feb 2017 14:26:34 +0000 Subject: Add more representation smashing testing and a memleak test. --- tests/regexp.test | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/regexp.test b/tests/regexp.test index ad770fa..f1be6eb 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -19,6 +19,20 @@ if {"::tcltest" ni [namespace children]} { unset -nocomplain foo testConstraint exec [llength [info commands exec]] + +# Used for constraining memory leak tests +testConstraint memory [llength [info commands memory]] +if {[testConstraint memory]} { + proc memtest script { + set end [lindex [split [memory info] \n] 3 3] + for {set i 0} {$i < 5} {incr i} { + uplevel 1 $script + set tmp $end + set end [lindex [split [memory info] \n] 3 3] + } + expr {$end - $tmp} + } +} test regexp-1.1 {basic regexp operation} { regexp ab*c abbbc @@ -1149,6 +1163,21 @@ test regexp-27.7 {regsub -command representation smash} { expr {[llength $::s] + $n} }}} } {125=458 791} +test regexp-27.8 {regsub -command representation smash} { + set ::t {apply {n { + expr {[llength [lindex $::t 1 1 1]] + $n} + }}} + regsub -command -all {\d+} "123=456 789" $::t +} {131=464 797} +test regexp-27.9 {regsub -command memory leak testing} memory { + set ::s "123=456 789" + set ::t {apply {n { + expr {[llength [lindex $::t 1 1 1]] + [llength $::s] + $n} + }}} + memtest { + regsub -command -all {\d+} $::s $::t + } +} 0 # cleanup ::tcltest::cleanupTests -- cgit v0.12 From d18329a21ef2b1a00069fd1be86bd9062a97f4cd Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 18 Feb 2017 16:24:09 +0000 Subject: Testing for some error cases. --- generic/tclCmdMZ.c | 8 ++++++++ tests/regexp.test | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 110de4c..d5a6b01 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -677,6 +677,14 @@ Tcl_RegsubObjCmd( if (Tcl_ListObjLength(interp, objv[2], &numParts) != TCL_OK) { return TCL_ERROR; } + if (numParts < 1) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "command prefix must be a list of at least one element", + -1)); + Tcl_SetErrorCode(interp, "TCL", "OPERATION", "REGSUB", + "CMDEMPTY", NULL); + return TCL_ERROR; + } regExpr = Tcl_GetRegExpFromObj(interp, objv[0], cflags); } diff --git a/tests/regexp.test b/tests/regexp.test index f1be6eb..2686526 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -1178,6 +1178,12 @@ test regexp-27.9 {regsub -command memory leak testing} memory { regsub -command -all {\d+} $::s $::t } } 0 +test regexp-27.10 {regsub -command error cases} -returnCodes error -body { + regsub -command . abc "def \{ghi" +} -result {unmatched open brace in list} +test regexp-27.11 {regsub -command error cases} -returnCodes error -body { + regsub -command . abc {} +} -result {command prefix must be a list of at least one element} # cleanup ::tcltest::cleanupTests -- cgit v0.12 From 874b8643e02da9a44cbed7f908d260f372420946 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 18 Feb 2017 18:38:52 +0000 Subject: Add documentation of [regsub -command]. --- doc/regsub.n | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ generic/tclCmdMZ.c | 4 +-- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/doc/regsub.n b/doc/regsub.n index a5b79de..23bbff9 100644 --- a/doc/regsub.n +++ b/doc/regsub.n @@ -68,6 +68,31 @@ and sequences are handled for each substitution using the information from the corresponding match. .TP +\fB\-command\fR +.VS 8.7 +Changes the handling of the substitution string so that it no longer treats +.QW & +and +.QW \e +as special characters, but instead uses them as a non-empty list of words. +Each time a substitution is processed, another complete Tcl word is appended +to that list for each substitution value (the first such argument represents +the overall matched substring, the subsequent arguments will be one per +capturing sub-RE, much as are returned from \fBregexp\fR \fB\-inline\fR) and +the overall list is then evaluated as a Tcl command call. If the command +finishes successfully, the result of command call is substituted into the +resulting string. +.RS +.PP +If \fB\-all\fR is not also given, the command callback will be invoked at most +once (exactly when the regular expression matches). If \fB\-all\fR is given, +the command callback will be invoked for each matched location, in sequence. +The exact location indices that matched are not made available to the script. +.PP +See \fBEXAMPLES\fR below for illustrative cases. +.RE +.VE 8.7 +.TP \fB\-expanded\fR . Enables use of the expanded regular expression syntax where @@ -183,6 +208,53 @@ set substitution {[format \e\e\e\eu%04x [scan "\e\e&" %c]]} set quoted [subst [string map {\en {\e\eu000a}} \e [\fBregsub\fR -all $RE $string $substitution]]] .CE +.PP +.VS 8.7 +The above operation can be done using \fBregsub \-command\fR instead, which is +often faster. (A full pre-computed \fBstring map\fR would be faster still, but +the cost of computing the map for a transformation as complex as this can be +quite large.) +.PP +.CS +# This RE is just a character class for everything "bad" +set RE {[][{};#\e\e\e$\es\eu0080-\euffff]} + +# This encodes what the RE described above matches +proc encodeChar {ch} { + # newline is handled specially since backslash-newline is a + # special sequence. + if {$ch eq "\en"} { + return "\e\eu000a" + } + # No point in writing this as a one-liner + scan $ch %c charNumber + format "\e\eu%04x" $charNumber +} + +set quoted [\fBregsub\fR -all -command $RE $string encodeChar] +.CE +.PP +Decoding a URL-encoded string using \fBregsub \-command\fR, a lambda term and +the \fBapply\fR command. +.PP +.CS +# Match one of the sequences in a URL-encoded string that needs +# fixing, converting + to space and %XX to the right character +# (e.g., %7e becomes ~) +set RE {(\e+)|%([0-9A-Fa-f]{2})} + +# Note that -command uses a command prefix, not a command name +set decoded [\fBregsub\fR -all -command $RE $string {apply {{- p h} { + # + is a special case; handle directly + if {$p eq "+"} { + return " " + } + # convert hex to a char + scan $h %x charNumber + format %c $charNumber +}}}] +.CE +.VE 8.7 .SH "SEE ALSO" regexp(n), re_syntax(n), subst(n), string(n) .SH KEYWORDS diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index d5a6b01..4178ba8 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -500,8 +500,8 @@ Tcl_RegsubObjCmd( "--", NULL }; enum options { - REGSUB_ALL, REGSUB_COMMAND, REGSUB_EXPANDED, REGSUB_LINE, - REGSUB_LINESTOP, REGSUB_LINEANCHOR, REGSUB_NOCASE, REGSUB_START, + REGSUB_ALL, REGSUB_COMMAND, REGSUB_EXPANDED, REGSUB_LINE, + REGSUB_LINESTOP, REGSUB_LINEANCHOR, REGSUB_NOCASE, REGSUB_START, REGSUB_LAST }; -- cgit v0.12 From aaa76b7a7da0a9f73cef7abc18e26aa92d154e43 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 6 Mar 2017 20:32:54 +0000 Subject: msgcat.test: fixed mcpackagelocale syntax usage test case (msgcat-12.1) --- tests/msgcat.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/msgcat.test b/tests/msgcat.test index 1c3ce58..584e420 100644 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -811,7 +811,7 @@ namespace eval ::msgcat::test { test msgcat-12.1 {mcpackagelocale no subcommand} -body { mcpackagelocale } -returnCodes 1\ - -result {wrong # args: should be "mcpackagelocale subcommand ?locale?"} + -result {wrong # args: should be "mcpackagelocale subcommand ?locale? ?ns?"} test msgcat-12.2 {mclpackagelocale wrong subcommand} -body { mcpackagelocale junk -- cgit v0.12 From fa0de66105f11524c686e70e023dbcdbaa59826e Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 6 Mar 2017 21:01:53 +0000 Subject: tclEmptyStringRep -> &tclEmptyString --- generic/tclStrIdxTree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index 773eb6a..d9b5da0 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -397,7 +397,7 @@ StrIdxTreeObj_UpdateStringProc(Tcl_Obj *objPtr) { /* currently only dummy empty string possible */ objPtr->length = 0; - objPtr->bytes = tclEmptyStringRep; + objPtr->bytes = &tclEmptyString; }; MODULE_SCOPE TclStrIdxTree * -- cgit v0.12 From 279bfdeef3577e9767bfafc7102011176f88034f Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 7 Mar 2017 11:35:03 +0000 Subject: timerate: don't calculate threshold by too few iterations, because sometimes first iteration(s) can be too fast (cached, delayed clean up, etc). --- generic/tclCmdMZ.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 14ff5f0..b62ccf8 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4282,6 +4282,13 @@ usage: if (middle >= stop) { break; } + + /* don't calculate threshold by few iterations, because sometimes + * first iteration(s) can be too fast (cached, delayed clean up, etc) */ + if (count < 10) { + threshold = 1; continue; + } + /* average iteration time in microsecs */ threshold = (middle - start) / count; if (threshold > maxIterTm) { -- cgit v0.12 From b2181df698c6eb7d579e90e5690d23e24cd6c730 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 8 Mar 2017 13:56:55 +0000 Subject: Fix compile error on Cygwin, and double definition of TclUnixWaitForFile() --- unix/tclEpollNotfy.c | 2 +- unix/tclUnixChan.c | 160 --------------------------------------------------- unix/tclUnixNotfy.c | 4 +- 3 files changed, 2 insertions(+), 164 deletions(-) diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 7355564..28fc834 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -745,7 +745,7 @@ Tcl_WaitForEvent( * Wait or poll for new events, queue Tcl events for the FileHandlers * corresponding to them, and update the FileHandlers' mask of events * of interest registered by the last call to Tcl_CreateFileHandler(). - * + * * Events for the eventfd(2)/trigger pipe are processed here in order * to facilitate inter-thread IPC. If another thread intends to wake * up this thread whilst it's blocking on PlatformEventsWait(), it diff --git a/unix/tclUnixChan.c b/unix/tclUnixChan.c index 6418f48..08b4805 100644 --- a/unix/tclUnixChan.c +++ b/unix/tclUnixChan.c @@ -1726,166 +1726,6 @@ Tcl_GetOpenFile( return TCL_ERROR; } -#ifndef HAVE_COREFOUNDATION /* Darwin/Mac OS X CoreFoundation notifier is - * in tclMacOSXNotify.c */ -/* - *---------------------------------------------------------------------- - * - * TclUnixWaitForFile -- - * - * This function waits synchronously for a file to become readable or - * writable, with an optional timeout. - * - * Results: - * The return value is an OR'ed combination of TCL_READABLE, - * TCL_WRITABLE, and TCL_EXCEPTION, indicating the conditions that are - * present on file at the time of the return. This function will not - * return until either "timeout" milliseconds have elapsed or at least - * one of the conditions given by mask has occurred for file (a return - * value of 0 means that a timeout occurred). No normal events will be - * serviced during the execution of this function. - * - * Side effects: - * Time passes. - * - *---------------------------------------------------------------------- - */ - -int -TclUnixWaitForFile( - int fd, /* Handle for file on which to wait. */ - int mask, /* What to wait for: OR'ed combination of - * TCL_READABLE, TCL_WRITABLE, and - * TCL_EXCEPTION. */ - int timeout) /* Maximum amount of time to wait for one of - * the conditions in mask to occur, in - * milliseconds. A value of 0 means don't wait - * at all, and a value of -1 means wait - * forever. */ -{ - Tcl_Time abortTime = {0, 0}, now; /* silence gcc 4 warning */ - struct timeval blockTime, *timeoutPtr; - int numFound, result = 0; - fd_set readableMask; - fd_set writableMask; - fd_set exceptionMask; - -#ifndef _DARWIN_C_SOURCE - /* - * Sanity check fd. - */ - - if (fd >= FD_SETSIZE) { - Tcl_Panic("TclUnixWaitForFile can't handle file id %d", fd); - /* must never get here, or select masks overrun will occur below */ - } -#endif - - /* - * If there is a non-zero finite timeout, compute the time when we give - * up. - */ - - if (timeout > 0) { - Tcl_GetTime(&now); - abortTime.sec = now.sec + timeout/1000; - abortTime.usec = now.usec + (timeout%1000)*1000; - if (abortTime.usec >= 1000000) { - abortTime.usec -= 1000000; - abortTime.sec += 1; - } - timeoutPtr = &blockTime; - } else if (timeout == 0) { - timeoutPtr = &blockTime; - blockTime.tv_sec = 0; - blockTime.tv_usec = 0; - } else { - timeoutPtr = NULL; - } - - /* - * Initialize the select masks. - */ - - FD_ZERO(&readableMask); - FD_ZERO(&writableMask); - FD_ZERO(&exceptionMask); - - /* - * Loop in a mini-event loop of our own, waiting for either the file to - * become ready or a timeout to occur. - */ - - while (1) { - if (timeout > 0) { - blockTime.tv_sec = abortTime.sec - now.sec; - blockTime.tv_usec = abortTime.usec - now.usec; - if (blockTime.tv_usec < 0) { - blockTime.tv_sec -= 1; - blockTime.tv_usec += 1000000; - } - if (blockTime.tv_sec < 0) { - blockTime.tv_sec = 0; - blockTime.tv_usec = 0; - } - } - - /* - * Setup the select masks for the fd. - */ - - if (mask & TCL_READABLE) { - FD_SET(fd, &readableMask); - } - if (mask & TCL_WRITABLE) { - FD_SET(fd, &writableMask); - } - if (mask & TCL_EXCEPTION) { - FD_SET(fd, &exceptionMask); - } - - /* - * Wait for the event or a timeout. - */ - - numFound = select(fd + 1, &readableMask, &writableMask, - &exceptionMask, timeoutPtr); - if (numFound == 1) { - if (FD_ISSET(fd, &readableMask)) { - SET_BITS(result, TCL_READABLE); - } - if (FD_ISSET(fd, &writableMask)) { - SET_BITS(result, TCL_WRITABLE); - } - if (FD_ISSET(fd, &exceptionMask)) { - SET_BITS(result, TCL_EXCEPTION); - } - result &= mask; - if (result) { - break; - } - } - if (timeout == 0) { - break; - } - if (timeout < 0) { - continue; - } - - /* - * The select returned early, so we need to recompute the timeout. - */ - - Tcl_GetTime(&now); - if ((abortTime.sec < now.sec) - || (abortTime.sec==now.sec && abortTime.usec<=now.usec)) { - break; - } - } - return result; -} -#endif /* HAVE_COREFOUNDATION */ - /* *---------------------------------------------------------------------- * diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 248504b..eb3e8ba 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -322,7 +322,7 @@ AlertSingleThread( * continuously spinning on epoll_wait until the other * threads runs and services the file event. */ - + if (tsdPtr->prevPtr) { tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr; } else { @@ -396,8 +396,6 @@ AtForkChild(void) * The tsdPtr from before the fork is copied as well. But since * we are paranoic, we don't trust its condvar and reset it. */ - pthread_cond_destroy(&tsdPtr->waitCV); - pthread_cond_init(&tsdPtr->waitCV, NULL); #ifdef __CYGWIN__ DestroyWindow(tsdPtr->hwnd); tsdPtr->hwnd = CreateWindowExW(NULL, className, -- cgit v0.12 From bed000d72e4b356700d7e2c85ca69971331f827a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 8 Mar 2017 14:32:15 +0000 Subject: A few more end-of-line spacings --- unix/tclKqueueNotfy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/tclKqueueNotfy.c b/unix/tclKqueueNotfy.c index 5522f06..049829e 100644 --- a/unix/tclKqueueNotfy.c +++ b/unix/tclKqueueNotfy.c @@ -387,7 +387,7 @@ PlatformEventsInit( Tcl_Panic("fcntl: %s", strerror(errno)); } else { fdFl = fcntl(tsdPtr->triggerPipe[i], F_GETFL); - fdFl |= O_NONBLOCK; + fdFl |= O_NONBLOCK; } if (fcntl(tsdPtr->triggerPipe[i], F_SETFL, fdFl) == -1) { Tcl_Panic("fcntl: %s", strerror(errno)); @@ -780,7 +780,7 @@ Tcl_WaitForEvent( * Wait or poll for new events, queue Tcl events for the FileHandlers * corresponding to them, and update the FileHandlers' mask of events * of interest registered by the last call to Tcl_CreateFileHandler(). - * + * * Events for the trigger pipe are processed here in order to facilitate * inter-thread IPC. If another thread intends to wake up this thread * whilst it's blocking on PlatformEventsWait(), it write(2)s to the -- cgit v0.12 From f55296bdf01aad11441825c162f074824f3031b5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 8 Mar 2017 14:50:44 +0000 Subject: minor simplification --- unix/tclUnixNotfy.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index eb3e8ba..d7bbabe 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -127,8 +127,7 @@ Tcl_AlertNotifier( #endif /* TCL_THREADS */ #else ThreadSpecificData *tsdPtr = clientData; -#ifdef NOTIFIER_EPOLL -#ifdef HAVE_EVENTFD +#if defined(NOTIFIER_EPOLL) && defined(HAVE_EVENTFD) eventFdVal = 1; if (write(tsdPtr->triggerEventFd, &eventFdVal, sizeof(eventFdVal)) != sizeof(eventFdVal)) { @@ -136,14 +135,9 @@ Tcl_AlertNotifier( (void *)tsdPtr); #else if (write(tsdPtr->triggerPipe[1], "", 1) != 1) { - Tcl_Panic("Tcl_AlertNotifier: unable to write to %p->triggerEventFd", - (void *)tsdPtr); -#endif -#else - if (write(tsdPtr->triggerPipe[1], "", 1) != 1) { Tcl_Panic("Tcl_AlertNotifier: unable to write to %p->triggerPipe", (void *)tsdPtr); -#endif /* NOTIFIER_EPOLL */ +#endif /* NOTIFIER_EPOLL && HAVE_EVENTFD */ } #endif /* NOTIFIER_SELECT */ } -- cgit v0.12 From f090fee89b41ac4813b896edbdb20a31bdd9c703 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 10 Mar 2017 15:22:08 +0000 Subject: Start RC branch for Tcl 8.6.7 --- README | 2 +- generic/tcl.h | 4 ++-- library/init.tcl | 2 +- unix/configure | 2 +- unix/configure.in | 2 +- unix/tcl.spec | 2 +- win/configure | 2 +- win/configure.in | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README b/README index 401b6e6..57985d3 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ README: Tcl - This is the Tcl 8.6.6 source distribution. + This is the Tcl 8.6.7 source distribution. http://sourceforge.net/projects/tcl/files/Tcl/ You can get any source release of Tcl from the URL above. diff --git a/generic/tcl.h b/generic/tcl.h index 64c7d14..3790b58 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -55,10 +55,10 @@ extern "C" { #define TCL_MAJOR_VERSION 8 #define TCL_MINOR_VERSION 6 #define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE -#define TCL_RELEASE_SERIAL 6 +#define TCL_RELEASE_SERIAL 7 #define TCL_VERSION "8.6" -#define TCL_PATCH_LEVEL "8.6.6" +#define TCL_PATCH_LEVEL "8.6.7" /* *---------------------------------------------------------------------------- diff --git a/library/init.tcl b/library/init.tcl index 9ca4514..0437412 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -16,7 +16,7 @@ if {[info commands package] == ""} { error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]" } -package require -exact Tcl 8.6.6 +package require -exact Tcl 8.6.7 # Compute the auto path to use in this interpreter. # The values on the path come from several locations: diff --git a/unix/configure b/unix/configure index 38c3f9a..a333fc1 100755 --- a/unix/configure +++ b/unix/configure @@ -1335,7 +1335,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL=".6" +TCL_PATCH_LEVEL=".7" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/configure.in b/unix/configure.in index 1d86213..220a4aa 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -25,7 +25,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL=".6" +TCL_PATCH_LEVEL=".7" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/tcl.spec b/unix/tcl.spec index 8bf77f3..141511d 100644 --- a/unix/tcl.spec +++ b/unix/tcl.spec @@ -4,7 +4,7 @@ Name: tcl Summary: Tcl scripting language development environment -Version: 8.6.6 +Version: 8.6.7 Release: 2 License: BSD Group: Development/Languages diff --git a/win/configure b/win/configure index e8e4b87..835afb8 100755 --- a/win/configure +++ b/win/configure @@ -1311,7 +1311,7 @@ SHELL=/bin/sh TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL=".6" +TCL_PATCH_LEVEL=".7" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 diff --git a/win/configure.in b/win/configure.in index 8bb9c48..8d712eb 100644 --- a/win/configure.in +++ b/win/configure.in @@ -14,7 +14,7 @@ SHELL=/bin/sh TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL=".6" +TCL_PATCH_LEVEL=".7" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 -- cgit v0.12 From e9e0f57d92722f8c472764114b517ff3556731a0 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 10 Mar 2017 15:28:46 +0000 Subject: Dup test name --- tests/link.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/link.test b/tests/link.test index dda7d6b..6bff356 100644 --- a/tests/link.test +++ b/tests/link.test @@ -152,7 +152,7 @@ test link-2.8 {writing C variables from Tcl} -constraints {testlink} -setup { set uwide "0O" concat [testlink get] | $int $real $bool $string $wide $char $uchar $short $ushort $uint $long $ulong $float $uwide } -result {0 0.0 0 0 0 0 0 0 0 0 0 0 0.0 0 | 0x 0b 0 0 0O 0X 0B 0O 0x 0b 0o 0X 0B 0O} -test link-2.8 {writing C variables from Tcl} -constraints {testlink} -setup { +test link-2.9 {writing C variables from Tcl} -constraints {testlink} -setup { testlink delete } -body { testlink set 43 1.21 4 - 56785678 64 250 30000 60000 0xbaadbeef 12321 32123 3.25 1231231234 -- cgit v0.12 From 91d32c45568c29a04d91d4ea742c10c290a05e8b Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 10 Mar 2017 16:41:32 +0000 Subject: Silence valgrind complaints from [representation]. --- generic/tclInt.h | 2 ++ generic/tclObj.c | 1 + 2 files changed, 3 insertions(+) diff --git a/generic/tclInt.h b/generic/tclInt.h index 4d3c0b1..65ef1c6 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4521,6 +4521,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; do { \ TclInvalidateStringRep(objPtr); \ TclFreeIntRep(objPtr); \ + (objPtr)->internalRep.twoPtrValue.ptr2 = NULL; \ (objPtr)->internalRep.doubleValue = (double)(d); \ (objPtr)->typePtr = &tclDoubleType; \ } while (0) @@ -4570,6 +4571,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; TclAllocObjStorage(objPtr); \ (objPtr)->refCount = 0; \ (objPtr)->bytes = NULL; \ + (objPtr)->internalRep.twoPtrValue.ptr2 = NULL; \ (objPtr)->internalRep.doubleValue = (double)(d); \ (objPtr)->typePtr = &tclDoubleType; \ TCL_DTRACE_OBJ_CREATE(objPtr); \ diff --git a/generic/tclObj.c b/generic/tclObj.c index a346987..d549fdc 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -2203,6 +2203,7 @@ Tcl_DbNewDoubleObj( TclDbNewObj(objPtr, file, line); objPtr->bytes = NULL; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; /* valgrind */ objPtr->internalRep.doubleValue = dblValue; objPtr->typePtr = &tclDoubleType; return objPtr; -- cgit v0.12 From daac4e5d3412030256d30b357bd455dbfa09630f Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 13 Mar 2017 17:03:50 +0000 Subject: Different solution to silencing the non-useful valgrind alerts. --- generic/tclInt.h | 2 -- generic/tclObj.c | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 65ef1c6..4d3c0b1 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4521,7 +4521,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; do { \ TclInvalidateStringRep(objPtr); \ TclFreeIntRep(objPtr); \ - (objPtr)->internalRep.twoPtrValue.ptr2 = NULL; \ (objPtr)->internalRep.doubleValue = (double)(d); \ (objPtr)->typePtr = &tclDoubleType; \ } while (0) @@ -4571,7 +4570,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; TclAllocObjStorage(objPtr); \ (objPtr)->refCount = 0; \ (objPtr)->bytes = NULL; \ - (objPtr)->internalRep.twoPtrValue.ptr2 = NULL; \ (objPtr)->internalRep.doubleValue = (double)(d); \ (objPtr)->typePtr = &tclDoubleType; \ TCL_DTRACE_OBJ_CREATE(objPtr); \ diff --git a/generic/tclObj.c b/generic/tclObj.c index d549fdc..3bf5b8e 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -2203,7 +2203,6 @@ Tcl_DbNewDoubleObj( TclDbNewObj(objPtr, file, line); objPtr->bytes = NULL; - objPtr->internalRep.twoPtrValue.ptr2 = NULL; /* valgrind */ objPtr->internalRep.doubleValue = dblValue; objPtr->typePtr = &tclDoubleType; return objPtr; @@ -4489,6 +4488,24 @@ Tcl_RepresentationCmd( objv[1]->typePtr ? objv[1]->typePtr->name : "pure string", objv[1]->refCount, ptrBuffer); + /* + * This is a workaround to silence reports from `make valgrind` + * on 64-bit systems. The problem is that the test suite + * includes calling the [represenation] command on values of + * &tclDoubleType. When these values are created, the "doubleValue" + * is set, but when the "twoPtrValue" is examined, its "ptr2" + * field has never been initialized. Since [representation] + * presents the value of the ptr2 value in its output, valgrind + * alerts about the read of uninitialized memory. + * + * The general problem with [representation], that it can read + * and report uninitialized fields, is still present. This is + * just the minimal workaround to silence one particular test. + */ + + if ((sizeof(void *) > 4) && objv[1]->typePtr == &tclDoubleType) { + objv[1]->internalRep.twoPtrValue.ptr2 = NULL; + } if (objv[1]->typePtr) { sprintf(ptrBuffer, "%p:%p", (void *) objv[1]->internalRep.twoPtrValue.ptr1, -- cgit v0.12 From 802974ec843d30bdac3822c14d7d3abf164cb34e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 23 Mar 2017 13:35:43 +0000 Subject: (cherry-pick from core-8-6-branch): Update TZ info to tzcode2017b. --- library/tzdata/Africa/Accra | 94 ++-- library/tzdata/Africa/Bissau | 2 +- library/tzdata/Africa/Ceuta | 12 +- library/tzdata/Africa/El_Aaiun | 2 +- library/tzdata/Africa/Monrovia | 4 +- library/tzdata/Africa/Nairobi | 4 +- library/tzdata/Africa/Windhoek | 2 +- library/tzdata/America/Anchorage | 11 +- library/tzdata/America/Araguaina | 110 ++--- library/tzdata/America/Argentina/Buenos_Aires | 122 ++--- library/tzdata/America/Argentina/Catamarca | 124 ++--- library/tzdata/America/Argentina/Cordoba | 122 ++--- library/tzdata/America/Argentina/Jujuy | 122 ++--- library/tzdata/America/Argentina/La_Rioja | 126 ++--- library/tzdata/America/Argentina/Mendoza | 124 ++--- library/tzdata/America/Argentina/Rio_Gallegos | 124 ++--- library/tzdata/America/Argentina/Salta | 120 ++--- library/tzdata/America/Argentina/San_Juan | 126 ++--- library/tzdata/America/Argentina/San_Luis | 124 ++--- library/tzdata/America/Argentina/Tucuman | 126 ++--- library/tzdata/America/Argentina/Ushuaia | 124 ++--- library/tzdata/America/Asuncion | 506 +++++++++---------- library/tzdata/America/Bahia | 126 ++--- library/tzdata/America/Belem | 60 +-- library/tzdata/America/Belize | 50 +- library/tzdata/America/Boa_Vista | 70 +-- library/tzdata/America/Bogota | 6 +- library/tzdata/America/Campo_Grande | 504 +++++++++---------- library/tzdata/America/Caracas | 8 +- library/tzdata/America/Cayenne | 4 +- library/tzdata/America/Cuiaba | 504 +++++++++---------- library/tzdata/America/Curacao | 2 +- library/tzdata/America/Danmarkshavn | 66 +-- library/tzdata/America/Eirunepe | 72 +-- library/tzdata/America/Fortaleza | 86 ++-- library/tzdata/America/Godthab | 482 +++++++++--------- library/tzdata/America/Guayaquil | 4 +- library/tzdata/America/Guyana | 7 +- library/tzdata/America/La_Paz | 2 +- library/tzdata/America/Lima | 20 +- library/tzdata/America/Maceio | 94 ++-- library/tzdata/America/Manaus | 68 +-- library/tzdata/America/Miquelon | 456 ++++++++--------- library/tzdata/America/Montevideo | 176 +++---- library/tzdata/America/Noronha | 86 ++-- library/tzdata/America/Paramaribo | 5 +- library/tzdata/America/Port-au-Prince | 166 +++++++ library/tzdata/America/Porto_Velho | 60 +-- library/tzdata/America/Punta_Arenas | 122 +++++ library/tzdata/America/Recife | 86 ++-- library/tzdata/America/Rio_Branco | 64 +-- library/tzdata/America/Santarem | 62 +-- library/tzdata/America/Santiago | 562 ++++++++++----------- library/tzdata/America/Santo_Domingo | 10 +- library/tzdata/America/Sao_Paulo | 506 +++++++++---------- library/tzdata/America/Scoresbysund | 482 +++++++++--------- library/tzdata/Antarctica/Macquarie | 2 +- library/tzdata/Antarctica/Palmer | 329 ++++--------- library/tzdata/Asia/Atyrau | 4 +- library/tzdata/Asia/Baghdad | 106 ++-- library/tzdata/Asia/Bangkok | 2 +- library/tzdata/Asia/Brunei | 4 +- library/tzdata/Asia/Choibalsan | 268 ++-------- library/tzdata/Asia/Dhaka | 15 +- library/tzdata/Asia/Dili | 9 +- library/tzdata/Asia/Dubai | 2 +- library/tzdata/Asia/Ho_Chi_Minh | 16 +- library/tzdata/Asia/Hovd | 266 ++-------- library/tzdata/Asia/Jakarta | 12 +- library/tzdata/Asia/Jayapura | 4 +- library/tzdata/Asia/Kabul | 4 +- library/tzdata/Asia/Karachi | 8 +- library/tzdata/Asia/Kathmandu | 4 +- library/tzdata/Asia/Kolkata | 4 +- library/tzdata/Asia/Kuala_Lumpur | 14 +- library/tzdata/Asia/Kuching | 37 +- library/tzdata/Asia/Macau | 82 ++-- library/tzdata/Asia/Makassar | 4 +- library/tzdata/Asia/Manila | 18 +- library/tzdata/Asia/Oral | 4 +- library/tzdata/Asia/Pontianak | 10 +- library/tzdata/Asia/Pyongyang | 3 +- library/tzdata/Asia/Qatar | 4 +- library/tzdata/Asia/Riyadh | 2 +- library/tzdata/Asia/Seoul | 3 +- library/tzdata/Asia/Singapore | 15 +- library/tzdata/Asia/Taipei | 2 +- library/tzdata/Asia/Tehran | 446 ++++++++--------- library/tzdata/Asia/Thimphu | 4 +- library/tzdata/Asia/Tokyo | 2 - library/tzdata/Asia/Ulaanbaatar | 266 ++-------- library/tzdata/Asia/Urumqi | 2 +- library/tzdata/Asia/Yangon | 6 +- library/tzdata/Atlantic/Azores | 682 +++++++++++++------------- library/tzdata/Atlantic/Canary | 2 +- library/tzdata/Atlantic/Cape_Verde | 8 +- library/tzdata/Atlantic/Madeira | 190 ++++--- library/tzdata/Atlantic/Reykjavik | 134 ++--- library/tzdata/Atlantic/South_Georgia | 2 +- library/tzdata/Atlantic/Stanley | 138 +++--- library/tzdata/Australia/Eucla | 40 +- library/tzdata/Australia/Lord_Howe | 477 +++++++++--------- library/tzdata/Europe/Amsterdam | 12 +- library/tzdata/Europe/Madrid | 64 ++- library/tzdata/Europe/Zaporozhye | 2 +- library/tzdata/Indian/Chagos | 4 +- library/tzdata/Indian/Christmas | 2 +- library/tzdata/Indian/Cocos | 2 +- library/tzdata/Indian/Mahe | 2 +- library/tzdata/Indian/Maldives | 2 +- library/tzdata/Indian/Mauritius | 10 +- library/tzdata/Indian/Reunion | 2 +- library/tzdata/Pacific/Apia | 364 +++++++------- library/tzdata/Pacific/Bougainville | 8 +- library/tzdata/Pacific/Chatham | 506 +++++++++---------- library/tzdata/Pacific/Chuuk | 2 +- library/tzdata/Pacific/Easter | 524 ++++++++++---------- library/tzdata/Pacific/Efate | 42 +- library/tzdata/Pacific/Enderbury | 6 +- library/tzdata/Pacific/Fakaofo | 4 +- library/tzdata/Pacific/Fiji | 372 +++++++------- library/tzdata/Pacific/Funafuti | 2 +- library/tzdata/Pacific/Galapagos | 6 +- library/tzdata/Pacific/Gambier | 2 +- library/tzdata/Pacific/Guadalcanal | 2 +- library/tzdata/Pacific/Kiritimati | 6 +- library/tzdata/Pacific/Kosrae | 6 +- library/tzdata/Pacific/Kwajalein | 6 +- library/tzdata/Pacific/Majuro | 4 +- library/tzdata/Pacific/Marquesas | 2 +- library/tzdata/Pacific/Nauru | 8 +- library/tzdata/Pacific/Niue | 6 +- library/tzdata/Pacific/Norfolk | 10 +- library/tzdata/Pacific/Noumea | 14 +- library/tzdata/Pacific/Pago_Pago | 4 +- library/tzdata/Pacific/Palau | 2 +- library/tzdata/Pacific/Pitcairn | 4 +- library/tzdata/Pacific/Pohnpei | 2 +- library/tzdata/Pacific/Port_Moresby | 2 +- library/tzdata/Pacific/Rarotonga | 54 +- library/tzdata/Pacific/Tahiti | 2 +- library/tzdata/Pacific/Tarawa | 2 +- library/tzdata/Pacific/Wake | 2 +- library/tzdata/Pacific/Wallis | 2 +- 144 files changed, 6328 insertions(+), 6717 deletions(-) create mode 100644 library/tzdata/America/Punta_Arenas diff --git a/library/tzdata/Africa/Accra b/library/tzdata/Africa/Accra index 39db976..18f4522 100644 --- a/library/tzdata/Africa/Accra +++ b/library/tzdata/Africa/Accra @@ -2,51 +2,51 @@ set TZData(:Africa/Accra) { {-9223372036854775808 -52 0 LMT} - {-1640995148 0 0 GMT} - {-1556841600 1200 1 GHST} - {-1546388400 0 0 GMT} - {-1525305600 1200 1 GHST} - {-1514852400 0 0 GMT} - {-1493769600 1200 1 GHST} - {-1483316400 0 0 GMT} - {-1462233600 1200 1 GHST} - {-1451780400 0 0 GMT} - {-1430611200 1200 1 GHST} - {-1420158000 0 0 GMT} - {-1399075200 1200 1 GHST} - {-1388622000 0 0 GMT} - {-1367539200 1200 1 GHST} - {-1357086000 0 0 GMT} - {-1336003200 1200 1 GHST} - {-1325550000 0 0 GMT} - {-1304380800 1200 1 GHST} - {-1293927600 0 0 GMT} - {-1272844800 1200 1 GHST} - {-1262391600 0 0 GMT} - {-1241308800 1200 1 GHST} - {-1230855600 0 0 GMT} - {-1209772800 1200 1 GHST} - {-1199319600 0 0 GMT} - {-1178150400 1200 1 GHST} - {-1167697200 0 0 GMT} - {-1146614400 1200 1 GHST} - {-1136161200 0 0 GMT} - {-1115078400 1200 1 GHST} - {-1104625200 0 0 GMT} - {-1083542400 1200 1 GHST} - {-1073089200 0 0 GMT} - {-1051920000 1200 1 GHST} - {-1041466800 0 0 GMT} - {-1020384000 1200 1 GHST} - {-1009930800 0 0 GMT} - {-988848000 1200 1 GHST} - {-978394800 0 0 GMT} - {-957312000 1200 1 GHST} - {-946858800 0 0 GMT} - {-925689600 1200 1 GHST} - {-915236400 0 0 GMT} - {-894153600 1200 1 GHST} - {-883700400 0 0 GMT} - {-862617600 1200 1 GHST} - {-852164400 0 0 GMT} + {-1640995148 0 0 +0020} + {-1556841600 1200 1 +0020} + {-1546388400 0 0 +0020} + {-1525305600 1200 1 +0020} + {-1514852400 0 0 +0020} + {-1493769600 1200 1 +0020} + {-1483316400 0 0 +0020} + {-1462233600 1200 1 +0020} + {-1451780400 0 0 +0020} + {-1430611200 1200 1 +0020} + {-1420158000 0 0 +0020} + {-1399075200 1200 1 +0020} + {-1388622000 0 0 +0020} + {-1367539200 1200 1 +0020} + {-1357086000 0 0 +0020} + {-1336003200 1200 1 +0020} + {-1325550000 0 0 +0020} + {-1304380800 1200 1 +0020} + {-1293927600 0 0 +0020} + {-1272844800 1200 1 +0020} + {-1262391600 0 0 +0020} + {-1241308800 1200 1 +0020} + {-1230855600 0 0 +0020} + {-1209772800 1200 1 +0020} + {-1199319600 0 0 +0020} + {-1178150400 1200 1 +0020} + {-1167697200 0 0 +0020} + {-1146614400 1200 1 +0020} + {-1136161200 0 0 +0020} + {-1115078400 1200 1 +0020} + {-1104625200 0 0 +0020} + {-1083542400 1200 1 +0020} + {-1073089200 0 0 +0020} + {-1051920000 1200 1 +0020} + {-1041466800 0 0 +0020} + {-1020384000 1200 1 +0020} + {-1009930800 0 0 +0020} + {-988848000 1200 1 +0020} + {-978394800 0 0 +0020} + {-957312000 1200 1 +0020} + {-946858800 0 0 +0020} + {-925689600 1200 1 +0020} + {-915236400 0 0 +0020} + {-894153600 1200 1 +0020} + {-883700400 0 0 +0020} + {-862617600 1200 1 +0020} + {-852164400 0 0 +0020} } diff --git a/library/tzdata/Africa/Bissau b/library/tzdata/Africa/Bissau index 5693228..88d9d03 100644 --- a/library/tzdata/Africa/Bissau +++ b/library/tzdata/Africa/Bissau @@ -2,6 +2,6 @@ set TZData(:Africa/Bissau) { {-9223372036854775808 -3740 0 LMT} - {-1830380260 -3600 0 WAT} + {-1830380260 -3600 0 -01} {157770000 0 0 GMT} } diff --git a/library/tzdata/Africa/Ceuta b/library/tzdata/Africa/Ceuta index 882c13d..057ca22 100644 --- a/library/tzdata/Africa/Ceuta +++ b/library/tzdata/Africa/Ceuta @@ -2,18 +2,18 @@ set TZData(:Africa/Ceuta) { {-9223372036854775808 -1276 0 LMT} - {-2177451524 0 0 WET} + {-2177452800 0 0 WET} {-1630112400 3600 1 WEST} {-1616810400 0 0 WET} {-1451692800 0 0 WET} {-1442451600 3600 1 WEST} - {-1427677200 0 0 WET} + {-1427673600 0 0 WET} {-1379293200 3600 1 WEST} - {-1364778000 0 0 WET} + {-1364774400 0 0 WET} {-1348448400 3600 1 WEST} - {-1333328400 0 0 WET} - {-1316394000 3600 1 WEST} - {-1301274000 0 0 WET} + {-1333324800 0 0 WET} + {-1316390400 3600 1 WEST} + {-1301270400 0 0 WET} {-1293840000 0 0 WET} {-81432000 3600 1 WEST} {-71110800 0 0 WET} diff --git a/library/tzdata/Africa/El_Aaiun b/library/tzdata/Africa/El_Aaiun index 77e149e..7bdc496 100644 --- a/library/tzdata/Africa/El_Aaiun +++ b/library/tzdata/Africa/El_Aaiun @@ -2,7 +2,7 @@ set TZData(:Africa/El_Aaiun) { {-9223372036854775808 -3168 0 LMT} - {-1136070432 -3600 0 WAT} + {-1136070432 -3600 0 -01} {198291600 0 0 WET} {199756800 3600 1 WEST} {207702000 0 0 WET} diff --git a/library/tzdata/Africa/Monrovia b/library/tzdata/Africa/Monrovia index 1cfff58..2b311bb 100644 --- a/library/tzdata/Africa/Monrovia +++ b/library/tzdata/Africa/Monrovia @@ -3,6 +3,6 @@ set TZData(:Africa/Monrovia) { {-9223372036854775808 -2588 0 LMT} {-2776979812 -2588 0 MMT} - {-1604359012 -2670 0 LRT} - {73529070 0 0 GMT} + {-1604359012 -2670 0 MMT} + {63593070 0 0 GMT} } diff --git a/library/tzdata/Africa/Nairobi b/library/tzdata/Africa/Nairobi index 6846069..715dc45 100644 --- a/library/tzdata/Africa/Nairobi +++ b/library/tzdata/Africa/Nairobi @@ -3,7 +3,7 @@ set TZData(:Africa/Nairobi) { {-9223372036854775808 8836 0 LMT} {-1309746436 10800 0 EAT} - {-1262314800 9000 0 BEAT} - {-946780200 9900 0 BEAUT} + {-1262314800 9000 0 +0230} + {-946780200 9900 0 +0245} {-315629100 10800 0 EAT} } diff --git a/library/tzdata/Africa/Windhoek b/library/tzdata/Africa/Windhoek index a655f2e..1b8f86a 100644 --- a/library/tzdata/Africa/Windhoek +++ b/library/tzdata/Africa/Windhoek @@ -2,7 +2,7 @@ set TZData(:Africa/Windhoek) { {-9223372036854775808 4104 0 LMT} - {-2458170504 5400 0 SWAT} + {-2458170504 5400 0 +0130} {-2109288600 7200 0 SAST} {-860976000 10800 1 SAST} {-845254800 7200 0 SAST} diff --git a/library/tzdata/America/Anchorage b/library/tzdata/America/Anchorage index e02dd01..127d365 100644 --- a/library/tzdata/America/Anchorage +++ b/library/tzdata/America/Anchorage @@ -3,12 +3,11 @@ set TZData(:America/Anchorage) { {-9223372036854775808 50424 0 LMT} {-3225362424 -35976 0 LMT} - {-2188951224 -36000 0 CAT} - {-883576800 -36000 0 CAWT} - {-880200000 -32400 1 CAWT} - {-769395600 -32400 0 CAPT} - {-765378000 -36000 0 CAPT} - {-757346400 -36000 0 CAT} + {-2188951224 -36000 0 AST} + {-883576800 -36000 0 AST} + {-880200000 -32400 1 AWT} + {-769395600 -32400 1 APT} + {-765378000 -36000 0 AST} {-86882400 -36000 0 AHST} {-31500000 -36000 0 AHST} {-21470400 -32400 1 AHDT} diff --git a/library/tzdata/America/Araguaina b/library/tzdata/America/Araguaina index e4a0d52..b9e2aec 100644 --- a/library/tzdata/America/Araguaina +++ b/library/tzdata/America/Araguaina @@ -2,59 +2,59 @@ set TZData(:America/Araguaina) { {-9223372036854775808 -11568 0 LMT} - {-1767214032 -10800 0 BRT} - {-1206957600 -7200 1 BRST} - {-1191362400 -10800 0 BRT} - {-1175374800 -7200 1 BRST} - {-1159826400 -10800 0 BRT} - {-633819600 -7200 1 BRST} - {-622069200 -10800 0 BRT} - {-602283600 -7200 1 BRST} - {-591832800 -10800 0 BRT} - {-570747600 -7200 1 BRST} - {-560210400 -10800 0 BRT} - {-539125200 -7200 1 BRST} - {-531352800 -10800 0 BRT} - {-191365200 -7200 1 BRST} - {-184197600 -10800 0 BRT} - {-155163600 -7200 1 BRST} - {-150069600 -10800 0 BRT} - {-128898000 -7200 1 BRST} - {-121125600 -10800 0 BRT} - {-99954000 -7200 1 BRST} - {-89589600 -10800 0 BRT} - {-68418000 -7200 1 BRST} - {-57967200 -10800 0 BRT} - {499748400 -7200 1 BRST} - {511236000 -10800 0 BRT} - {530593200 -7200 1 BRST} - {540266400 -10800 0 BRT} - {562129200 -7200 1 BRST} - {571197600 -10800 0 BRT} - {592974000 -7200 1 BRST} - {602042400 -10800 0 BRT} - {624423600 -7200 1 BRST} - {634701600 -10800 0 BRT} - {653536800 -10800 0 BRT} - {811047600 -10800 0 BRT} - {813726000 -7200 1 BRST} - {824004000 -10800 0 BRT} - {844570800 -7200 1 BRST} - {856058400 -10800 0 BRT} - {876106800 -7200 1 BRST} - {888717600 -10800 0 BRT} - {908074800 -7200 1 BRST} - {919562400 -10800 0 BRT} - {938919600 -7200 1 BRST} - {951616800 -10800 0 BRT} - {970974000 -7200 1 BRST} - {982461600 -10800 0 BRT} - {1003028400 -7200 1 BRST} - {1013911200 -10800 0 BRT} - {1036292400 -7200 1 BRST} - {1045360800 -10800 0 BRT} - {1064368800 -10800 0 BRT} - {1350788400 -7200 0 BRST} - {1361066400 -10800 0 BRT} - {1378000800 -10800 0 BRT} + {-1767214032 -10800 0 -03} + {-1206957600 -7200 1 -02} + {-1191362400 -10800 0 -03} + {-1175374800 -7200 1 -02} + {-1159826400 -10800 0 -03} + {-633819600 -7200 1 -02} + {-622069200 -10800 0 -03} + {-602283600 -7200 1 -02} + {-591832800 -10800 0 -03} + {-570747600 -7200 1 -02} + {-560210400 -10800 0 -03} + {-539125200 -7200 1 -02} + {-531352800 -10800 0 -03} + {-191365200 -7200 1 -02} + {-184197600 -10800 0 -03} + {-155163600 -7200 1 -02} + {-150069600 -10800 0 -03} + {-128898000 -7200 1 -02} + {-121125600 -10800 0 -03} + {-99954000 -7200 1 -02} + {-89589600 -10800 0 -03} + {-68418000 -7200 1 -02} + {-57967200 -10800 0 -03} + {499748400 -7200 1 -02} + {511236000 -10800 0 -03} + {530593200 -7200 1 -02} + {540266400 -10800 0 -03} + {562129200 -7200 1 -02} + {571197600 -10800 0 -03} + {592974000 -7200 1 -02} + {602042400 -10800 0 -03} + {624423600 -7200 1 -02} + {634701600 -10800 0 -03} + {653536800 -10800 0 -03} + {811047600 -10800 0 -03} + {813726000 -7200 1 -02} + {824004000 -10800 0 -03} + {844570800 -7200 1 -02} + {856058400 -10800 0 -03} + {876106800 -7200 1 -02} + {888717600 -10800 0 -03} + {908074800 -7200 1 -02} + {919562400 -10800 0 -03} + {938919600 -7200 1 -02} + {951616800 -10800 0 -03} + {970974000 -7200 1 -02} + {982461600 -10800 0 -03} + {1003028400 -7200 1 -02} + {1013911200 -10800 0 -03} + {1036292400 -7200 1 -02} + {1045360800 -10800 0 -03} + {1064368800 -10800 0 -03} + {1350788400 -7200 0 -02} + {1361066400 -10800 0 -03} + {1378000800 -10800 0 -03} } diff --git a/library/tzdata/America/Argentina/Buenos_Aires b/library/tzdata/America/Argentina/Buenos_Aires index 73cc8e9..8be2c45 100644 --- a/library/tzdata/America/Argentina/Buenos_Aires +++ b/library/tzdata/America/Argentina/Buenos_Aires @@ -3,65 +3,65 @@ set TZData(:America/Argentina/Buenos_Aires) { {-9223372036854775808 -14028 0 LMT} {-2372097972 -15408 0 CMT} - {-1567453392 -14400 0 ART} - {-1233432000 -10800 0 ARST} - {-1222981200 -14400 0 ART} - {-1205956800 -10800 1 ARST} - {-1194037200 -14400 0 ART} - {-1172865600 -10800 1 ARST} - {-1162501200 -14400 0 ART} - {-1141329600 -10800 1 ARST} - {-1130965200 -14400 0 ART} - {-1109793600 -10800 1 ARST} - {-1099429200 -14400 0 ART} - {-1078257600 -10800 1 ARST} - {-1067806800 -14400 0 ART} - {-1046635200 -10800 1 ARST} - {-1036270800 -14400 0 ART} - {-1015099200 -10800 1 ARST} - {-1004734800 -14400 0 ART} - {-983563200 -10800 1 ARST} - {-973198800 -14400 0 ART} - {-952027200 -10800 1 ARST} - {-941576400 -14400 0 ART} - {-931032000 -10800 1 ARST} - {-900882000 -14400 0 ART} - {-890337600 -10800 1 ARST} - {-833749200 -14400 0 ART} - {-827265600 -10800 1 ARST} - {-752274000 -14400 0 ART} - {-733780800 -10800 1 ARST} - {-197326800 -14400 0 ART} - {-190843200 -10800 1 ARST} - {-184194000 -14400 0 ART} - {-164491200 -10800 1 ARST} - {-152658000 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {596948400 -7200 1 ARST} - {605066400 -10800 0 ART} - {624423600 -7200 1 ARST} - {636516000 -10800 0 ART} - {656478000 -7200 1 ARST} - {667965600 -10800 0 ART} - {687927600 -7200 1 ARST} - {699415200 -10800 0 ART} - {719377200 -7200 1 ARST} - {731469600 -10800 0 ART} - {938916000 -10800 0 ART} - {938919600 -10800 1 ARST} - {952056000 -10800 0 ART} - {1198983600 -7200 1 ARST} - {1205632800 -10800 0 ART} - {1224385200 -7200 1 ARST} - {1237082400 -10800 0 ART} + {-1567453392 -14400 0 -04} + {-1233432000 -10800 0 -03} + {-1222981200 -14400 0 -04} + {-1205956800 -10800 1 -03} + {-1194037200 -14400 0 -04} + {-1172865600 -10800 1 -03} + {-1162501200 -14400 0 -04} + {-1141329600 -10800 1 -03} + {-1130965200 -14400 0 -04} + {-1109793600 -10800 1 -03} + {-1099429200 -14400 0 -04} + {-1078257600 -10800 1 -03} + {-1067806800 -14400 0 -04} + {-1046635200 -10800 1 -03} + {-1036270800 -14400 0 -04} + {-1015099200 -10800 1 -03} + {-1004734800 -14400 0 -04} + {-983563200 -10800 1 -03} + {-973198800 -14400 0 -04} + {-952027200 -10800 1 -03} + {-941576400 -14400 0 -04} + {-931032000 -10800 1 -03} + {-900882000 -14400 0 -04} + {-890337600 -10800 1 -03} + {-833749200 -14400 0 -04} + {-827265600 -10800 1 -03} + {-752274000 -14400 0 -04} + {-733780800 -10800 1 -03} + {-197326800 -14400 0 -04} + {-190843200 -10800 1 -03} + {-184194000 -14400 0 -04} + {-164491200 -10800 1 -03} + {-152658000 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {596948400 -7200 1 -02} + {605066400 -10800 0 -03} + {624423600 -7200 1 -02} + {636516000 -10800 0 -03} + {656478000 -7200 1 -02} + {667965600 -10800 0 -03} + {687927600 -7200 1 -02} + {699415200 -10800 0 -03} + {719377200 -7200 1 -02} + {731469600 -10800 0 -03} + {938916000 -10800 0 -04} + {938919600 -10800 1 -03} + {952056000 -10800 0 -03} + {1198983600 -7200 1 -02} + {1205632800 -10800 0 -03} + {1224385200 -7200 1 -02} + {1237082400 -10800 0 -03} } diff --git a/library/tzdata/America/Argentina/Catamarca b/library/tzdata/America/Argentina/Catamarca index 7739203..a546bfc 100644 --- a/library/tzdata/America/Argentina/Catamarca +++ b/library/tzdata/America/Argentina/Catamarca @@ -3,66 +3,66 @@ set TZData(:America/Argentina/Catamarca) { {-9223372036854775808 -15788 0 LMT} {-2372096212 -15408 0 CMT} - {-1567453392 -14400 0 ART} - {-1233432000 -10800 0 ARST} - {-1222981200 -14400 0 ART} - {-1205956800 -10800 1 ARST} - {-1194037200 -14400 0 ART} - {-1172865600 -10800 1 ARST} - {-1162501200 -14400 0 ART} - {-1141329600 -10800 1 ARST} - {-1130965200 -14400 0 ART} - {-1109793600 -10800 1 ARST} - {-1099429200 -14400 0 ART} - {-1078257600 -10800 1 ARST} - {-1067806800 -14400 0 ART} - {-1046635200 -10800 1 ARST} - {-1036270800 -14400 0 ART} - {-1015099200 -10800 1 ARST} - {-1004734800 -14400 0 ART} - {-983563200 -10800 1 ARST} - {-973198800 -14400 0 ART} - {-952027200 -10800 1 ARST} - {-941576400 -14400 0 ART} - {-931032000 -10800 1 ARST} - {-900882000 -14400 0 ART} - {-890337600 -10800 1 ARST} - {-833749200 -14400 0 ART} - {-827265600 -10800 1 ARST} - {-752274000 -14400 0 ART} - {-733780800 -10800 1 ARST} - {-197326800 -14400 0 ART} - {-190843200 -10800 1 ARST} - {-184194000 -14400 0 ART} - {-164491200 -10800 1 ARST} - {-152658000 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {596948400 -7200 1 ARST} - {605066400 -10800 0 ART} - {624423600 -7200 1 ARST} - {636516000 -10800 0 ART} - {656478000 -7200 1 ARST} - {667965600 -14400 0 WART} - {687931200 -7200 0 ARST} - {699415200 -10800 0 ART} - {719377200 -7200 1 ARST} - {731469600 -10800 0 ART} - {938916000 -10800 0 ART} - {938919600 -10800 1 ARST} - {952056000 -10800 0 ART} - {1086058800 -14400 0 WART} - {1087704000 -10800 0 ART} - {1198983600 -7200 1 ARST} - {1205632800 -10800 0 ART} - {1224295200 -10800 0 ART} + {-1567453392 -14400 0 -04} + {-1233432000 -10800 0 -03} + {-1222981200 -14400 0 -04} + {-1205956800 -10800 1 -03} + {-1194037200 -14400 0 -04} + {-1172865600 -10800 1 -03} + {-1162501200 -14400 0 -04} + {-1141329600 -10800 1 -03} + {-1130965200 -14400 0 -04} + {-1109793600 -10800 1 -03} + {-1099429200 -14400 0 -04} + {-1078257600 -10800 1 -03} + {-1067806800 -14400 0 -04} + {-1046635200 -10800 1 -03} + {-1036270800 -14400 0 -04} + {-1015099200 -10800 1 -03} + {-1004734800 -14400 0 -04} + {-983563200 -10800 1 -03} + {-973198800 -14400 0 -04} + {-952027200 -10800 1 -03} + {-941576400 -14400 0 -04} + {-931032000 -10800 1 -03} + {-900882000 -14400 0 -04} + {-890337600 -10800 1 -03} + {-833749200 -14400 0 -04} + {-827265600 -10800 1 -03} + {-752274000 -14400 0 -04} + {-733780800 -10800 1 -03} + {-197326800 -14400 0 -04} + {-190843200 -10800 1 -03} + {-184194000 -14400 0 -04} + {-164491200 -10800 1 -03} + {-152658000 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {596948400 -7200 1 -02} + {605066400 -10800 0 -03} + {624423600 -7200 1 -02} + {636516000 -10800 0 -03} + {656478000 -7200 1 -02} + {667965600 -14400 0 -04} + {687931200 -7200 0 -02} + {699415200 -10800 0 -03} + {719377200 -7200 1 -02} + {731469600 -10800 0 -03} + {938916000 -10800 0 -04} + {938919600 -10800 1 -03} + {952056000 -10800 0 -03} + {1086058800 -14400 0 -04} + {1087704000 -10800 0 -03} + {1198983600 -7200 1 -02} + {1205632800 -10800 0 -03} + {1224295200 -10800 0 -03} } diff --git a/library/tzdata/America/Argentina/Cordoba b/library/tzdata/America/Argentina/Cordoba index b08539e..ec6978e 100644 --- a/library/tzdata/America/Argentina/Cordoba +++ b/library/tzdata/America/Argentina/Cordoba @@ -3,65 +3,65 @@ set TZData(:America/Argentina/Cordoba) { {-9223372036854775808 -15408 0 LMT} {-2372096592 -15408 0 CMT} - {-1567453392 -14400 0 ART} - {-1233432000 -10800 0 ARST} - {-1222981200 -14400 0 ART} - {-1205956800 -10800 1 ARST} - {-1194037200 -14400 0 ART} - {-1172865600 -10800 1 ARST} - {-1162501200 -14400 0 ART} - {-1141329600 -10800 1 ARST} - {-1130965200 -14400 0 ART} - {-1109793600 -10800 1 ARST} - {-1099429200 -14400 0 ART} - {-1078257600 -10800 1 ARST} - {-1067806800 -14400 0 ART} - {-1046635200 -10800 1 ARST} - {-1036270800 -14400 0 ART} - {-1015099200 -10800 1 ARST} - {-1004734800 -14400 0 ART} - {-983563200 -10800 1 ARST} - {-973198800 -14400 0 ART} - {-952027200 -10800 1 ARST} - {-941576400 -14400 0 ART} - {-931032000 -10800 1 ARST} - {-900882000 -14400 0 ART} - {-890337600 -10800 1 ARST} - {-833749200 -14400 0 ART} - {-827265600 -10800 1 ARST} - {-752274000 -14400 0 ART} - {-733780800 -10800 1 ARST} - {-197326800 -14400 0 ART} - {-190843200 -10800 1 ARST} - {-184194000 -14400 0 ART} - {-164491200 -10800 1 ARST} - {-152658000 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {596948400 -7200 1 ARST} - {605066400 -10800 0 ART} - {624423600 -7200 1 ARST} - {636516000 -10800 0 ART} - {656478000 -7200 1 ARST} - {667965600 -14400 0 WART} - {687931200 -7200 0 ARST} - {699415200 -10800 0 ART} - {719377200 -7200 1 ARST} - {731469600 -10800 0 ART} - {938916000 -10800 0 ART} - {938919600 -10800 1 ARST} - {952056000 -10800 0 ART} - {1198983600 -7200 1 ARST} - {1205632800 -10800 0 ART} - {1224385200 -7200 1 ARST} - {1237082400 -10800 0 ART} + {-1567453392 -14400 0 -04} + {-1233432000 -10800 0 -03} + {-1222981200 -14400 0 -04} + {-1205956800 -10800 1 -03} + {-1194037200 -14400 0 -04} + {-1172865600 -10800 1 -03} + {-1162501200 -14400 0 -04} + {-1141329600 -10800 1 -03} + {-1130965200 -14400 0 -04} + {-1109793600 -10800 1 -03} + {-1099429200 -14400 0 -04} + {-1078257600 -10800 1 -03} + {-1067806800 -14400 0 -04} + {-1046635200 -10800 1 -03} + {-1036270800 -14400 0 -04} + {-1015099200 -10800 1 -03} + {-1004734800 -14400 0 -04} + {-983563200 -10800 1 -03} + {-973198800 -14400 0 -04} + {-952027200 -10800 1 -03} + {-941576400 -14400 0 -04} + {-931032000 -10800 1 -03} + {-900882000 -14400 0 -04} + {-890337600 -10800 1 -03} + {-833749200 -14400 0 -04} + {-827265600 -10800 1 -03} + {-752274000 -14400 0 -04} + {-733780800 -10800 1 -03} + {-197326800 -14400 0 -04} + {-190843200 -10800 1 -03} + {-184194000 -14400 0 -04} + {-164491200 -10800 1 -03} + {-152658000 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {596948400 -7200 1 -02} + {605066400 -10800 0 -03} + {624423600 -7200 1 -02} + {636516000 -10800 0 -03} + {656478000 -7200 1 -02} + {667965600 -14400 0 -04} + {687931200 -7200 0 -02} + {699415200 -10800 0 -03} + {719377200 -7200 1 -02} + {731469600 -10800 0 -03} + {938916000 -10800 0 -04} + {938919600 -10800 1 -03} + {952056000 -10800 0 -03} + {1198983600 -7200 1 -02} + {1205632800 -10800 0 -03} + {1224385200 -7200 1 -02} + {1237082400 -10800 0 -03} } diff --git a/library/tzdata/America/Argentina/Jujuy b/library/tzdata/America/Argentina/Jujuy index 4f95f8a..0e11ba2 100644 --- a/library/tzdata/America/Argentina/Jujuy +++ b/library/tzdata/America/Argentina/Jujuy @@ -3,65 +3,65 @@ set TZData(:America/Argentina/Jujuy) { {-9223372036854775808 -15672 0 LMT} {-2372096328 -15408 0 CMT} - {-1567453392 -14400 0 ART} - {-1233432000 -10800 0 ARST} - {-1222981200 -14400 0 ART} - {-1205956800 -10800 1 ARST} - {-1194037200 -14400 0 ART} - {-1172865600 -10800 1 ARST} - {-1162501200 -14400 0 ART} - {-1141329600 -10800 1 ARST} - {-1130965200 -14400 0 ART} - {-1109793600 -10800 1 ARST} - {-1099429200 -14400 0 ART} - {-1078257600 -10800 1 ARST} - {-1067806800 -14400 0 ART} - {-1046635200 -10800 1 ARST} - {-1036270800 -14400 0 ART} - {-1015099200 -10800 1 ARST} - {-1004734800 -14400 0 ART} - {-983563200 -10800 1 ARST} - {-973198800 -14400 0 ART} - {-952027200 -10800 1 ARST} - {-941576400 -14400 0 ART} - {-931032000 -10800 1 ARST} - {-900882000 -14400 0 ART} - {-890337600 -10800 1 ARST} - {-833749200 -14400 0 ART} - {-827265600 -10800 1 ARST} - {-752274000 -14400 0 ART} - {-733780800 -10800 1 ARST} - {-197326800 -14400 0 ART} - {-190843200 -10800 1 ARST} - {-184194000 -14400 0 ART} - {-164491200 -10800 1 ARST} - {-152658000 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {596948400 -7200 1 ARST} - {605066400 -10800 0 ART} - {624423600 -7200 1 ARST} - {636516000 -14400 0 WART} - {657086400 -10800 1 WARST} - {669178800 -14400 0 WART} - {686721600 -7200 1 ARST} - {694231200 -7200 0 ART} - {699415200 -10800 0 ART} - {719377200 -7200 1 ARST} - {731469600 -10800 0 ART} - {938916000 -10800 0 ART} - {938919600 -10800 1 ARST} - {952056000 -10800 0 ART} - {1198983600 -7200 1 ARST} - {1205632800 -10800 0 ART} - {1224295200 -10800 0 ART} + {-1567453392 -14400 0 -04} + {-1233432000 -10800 0 -03} + {-1222981200 -14400 0 -04} + {-1205956800 -10800 1 -03} + {-1194037200 -14400 0 -04} + {-1172865600 -10800 1 -03} + {-1162501200 -14400 0 -04} + {-1141329600 -10800 1 -03} + {-1130965200 -14400 0 -04} + {-1109793600 -10800 1 -03} + {-1099429200 -14400 0 -04} + {-1078257600 -10800 1 -03} + {-1067806800 -14400 0 -04} + {-1046635200 -10800 1 -03} + {-1036270800 -14400 0 -04} + {-1015099200 -10800 1 -03} + {-1004734800 -14400 0 -04} + {-983563200 -10800 1 -03} + {-973198800 -14400 0 -04} + {-952027200 -10800 1 -03} + {-941576400 -14400 0 -04} + {-931032000 -10800 1 -03} + {-900882000 -14400 0 -04} + {-890337600 -10800 1 -03} + {-833749200 -14400 0 -04} + {-827265600 -10800 1 -03} + {-752274000 -14400 0 -04} + {-733780800 -10800 1 -03} + {-197326800 -14400 0 -04} + {-190843200 -10800 1 -03} + {-184194000 -14400 0 -04} + {-164491200 -10800 1 -03} + {-152658000 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {596948400 -7200 1 -02} + {605066400 -10800 0 -03} + {624423600 -7200 1 -02} + {636516000 -14400 0 -04} + {657086400 -10800 1 -03} + {669178800 -14400 0 -04} + {686721600 -7200 1 -02} + {694231200 -7200 0 -03} + {699415200 -10800 0 -03} + {719377200 -7200 1 -02} + {731469600 -10800 0 -03} + {938916000 -10800 0 -04} + {938919600 -10800 1 -03} + {952056000 -10800 0 -03} + {1198983600 -7200 1 -02} + {1205632800 -10800 0 -03} + {1224295200 -10800 0 -03} } diff --git a/library/tzdata/America/Argentina/La_Rioja b/library/tzdata/America/Argentina/La_Rioja index 835e29d..90e0030 100644 --- a/library/tzdata/America/Argentina/La_Rioja +++ b/library/tzdata/America/Argentina/La_Rioja @@ -3,67 +3,67 @@ set TZData(:America/Argentina/La_Rioja) { {-9223372036854775808 -16044 0 LMT} {-2372095956 -15408 0 CMT} - {-1567453392 -14400 0 ART} - {-1233432000 -10800 0 ARST} - {-1222981200 -14400 0 ART} - {-1205956800 -10800 1 ARST} - {-1194037200 -14400 0 ART} - {-1172865600 -10800 1 ARST} - {-1162501200 -14400 0 ART} - {-1141329600 -10800 1 ARST} - {-1130965200 -14400 0 ART} - {-1109793600 -10800 1 ARST} - {-1099429200 -14400 0 ART} - {-1078257600 -10800 1 ARST} - {-1067806800 -14400 0 ART} - {-1046635200 -10800 1 ARST} - {-1036270800 -14400 0 ART} - {-1015099200 -10800 1 ARST} - {-1004734800 -14400 0 ART} - {-983563200 -10800 1 ARST} - {-973198800 -14400 0 ART} - {-952027200 -10800 1 ARST} - {-941576400 -14400 0 ART} - {-931032000 -10800 1 ARST} - {-900882000 -14400 0 ART} - {-890337600 -10800 1 ARST} - {-833749200 -14400 0 ART} - {-827265600 -10800 1 ARST} - {-752274000 -14400 0 ART} - {-733780800 -10800 1 ARST} - {-197326800 -14400 0 ART} - {-190843200 -10800 1 ARST} - {-184194000 -14400 0 ART} - {-164491200 -10800 1 ARST} - {-152658000 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {596948400 -7200 1 ARST} - {605066400 -10800 0 ART} - {624423600 -7200 1 ARST} - {636516000 -10800 0 ART} - {656478000 -7200 1 ARST} - {667792800 -14400 0 WART} - {673588800 -10800 0 ART} - {687927600 -7200 1 ARST} - {699415200 -10800 0 ART} - {719377200 -7200 1 ARST} - {731469600 -10800 0 ART} - {938916000 -10800 0 ART} - {938919600 -10800 1 ARST} - {952056000 -10800 0 ART} - {1086058800 -14400 0 WART} - {1087704000 -10800 0 ART} - {1198983600 -7200 1 ARST} - {1205632800 -10800 0 ART} - {1224295200 -10800 0 ART} + {-1567453392 -14400 0 -04} + {-1233432000 -10800 0 -03} + {-1222981200 -14400 0 -04} + {-1205956800 -10800 1 -03} + {-1194037200 -14400 0 -04} + {-1172865600 -10800 1 -03} + {-1162501200 -14400 0 -04} + {-1141329600 -10800 1 -03} + {-1130965200 -14400 0 -04} + {-1109793600 -10800 1 -03} + {-1099429200 -14400 0 -04} + {-1078257600 -10800 1 -03} + {-1067806800 -14400 0 -04} + {-1046635200 -10800 1 -03} + {-1036270800 -14400 0 -04} + {-1015099200 -10800 1 -03} + {-1004734800 -14400 0 -04} + {-983563200 -10800 1 -03} + {-973198800 -14400 0 -04} + {-952027200 -10800 1 -03} + {-941576400 -14400 0 -04} + {-931032000 -10800 1 -03} + {-900882000 -14400 0 -04} + {-890337600 -10800 1 -03} + {-833749200 -14400 0 -04} + {-827265600 -10800 1 -03} + {-752274000 -14400 0 -04} + {-733780800 -10800 1 -03} + {-197326800 -14400 0 -04} + {-190843200 -10800 1 -03} + {-184194000 -14400 0 -04} + {-164491200 -10800 1 -03} + {-152658000 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {596948400 -7200 1 -02} + {605066400 -10800 0 -03} + {624423600 -7200 1 -02} + {636516000 -10800 0 -03} + {656478000 -7200 1 -02} + {667792800 -14400 0 -04} + {673588800 -10800 0 -03} + {687927600 -7200 1 -02} + {699415200 -10800 0 -03} + {719377200 -7200 1 -02} + {731469600 -10800 0 -03} + {938916000 -10800 0 -04} + {938919600 -10800 1 -03} + {952056000 -10800 0 -03} + {1086058800 -14400 0 -04} + {1087704000 -10800 0 -03} + {1198983600 -7200 1 -02} + {1205632800 -10800 0 -03} + {1224295200 -10800 0 -03} } diff --git a/library/tzdata/America/Argentina/Mendoza b/library/tzdata/America/Argentina/Mendoza index 2c6fb58..8dfcd2b 100644 --- a/library/tzdata/America/Argentina/Mendoza +++ b/library/tzdata/America/Argentina/Mendoza @@ -3,66 +3,66 @@ set TZData(:America/Argentina/Mendoza) { {-9223372036854775808 -16516 0 LMT} {-2372095484 -15408 0 CMT} - {-1567453392 -14400 0 ART} - {-1233432000 -10800 0 ARST} - {-1222981200 -14400 0 ART} - {-1205956800 -10800 1 ARST} - {-1194037200 -14400 0 ART} - {-1172865600 -10800 1 ARST} - {-1162501200 -14400 0 ART} - {-1141329600 -10800 1 ARST} - {-1130965200 -14400 0 ART} - {-1109793600 -10800 1 ARST} - {-1099429200 -14400 0 ART} - {-1078257600 -10800 1 ARST} - {-1067806800 -14400 0 ART} - {-1046635200 -10800 1 ARST} - {-1036270800 -14400 0 ART} - {-1015099200 -10800 1 ARST} - {-1004734800 -14400 0 ART} - {-983563200 -10800 1 ARST} - {-973198800 -14400 0 ART} - {-952027200 -10800 1 ARST} - {-941576400 -14400 0 ART} - {-931032000 -10800 1 ARST} - {-900882000 -14400 0 ART} - {-890337600 -10800 1 ARST} - {-833749200 -14400 0 ART} - {-827265600 -10800 1 ARST} - {-752274000 -14400 0 ART} - {-733780800 -10800 1 ARST} - {-197326800 -14400 0 ART} - {-190843200 -10800 1 ARST} - {-184194000 -14400 0 ART} - {-164491200 -10800 1 ARST} - {-152658000 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {596948400 -7200 1 ARST} - {605066400 -10800 0 ART} - {624423600 -7200 1 ARST} - {636516000 -14400 0 WART} - {655963200 -10800 1 WARST} - {667796400 -14400 0 WART} - {687499200 -10800 1 WARST} - {699418800 -14400 0 WART} - {719380800 -7200 0 ARST} - {731469600 -10800 0 ART} - {938916000 -10800 0 ART} - {938919600 -10800 1 ARST} - {952056000 -10800 0 ART} - {1085281200 -14400 0 WART} - {1096171200 -10800 0 ART} - {1198983600 -7200 1 ARST} - {1205632800 -10800 0 ART} - {1224295200 -10800 0 ART} + {-1567453392 -14400 0 -04} + {-1233432000 -10800 0 -03} + {-1222981200 -14400 0 -04} + {-1205956800 -10800 1 -03} + {-1194037200 -14400 0 -04} + {-1172865600 -10800 1 -03} + {-1162501200 -14400 0 -04} + {-1141329600 -10800 1 -03} + {-1130965200 -14400 0 -04} + {-1109793600 -10800 1 -03} + {-1099429200 -14400 0 -04} + {-1078257600 -10800 1 -03} + {-1067806800 -14400 0 -04} + {-1046635200 -10800 1 -03} + {-1036270800 -14400 0 -04} + {-1015099200 -10800 1 -03} + {-1004734800 -14400 0 -04} + {-983563200 -10800 1 -03} + {-973198800 -14400 0 -04} + {-952027200 -10800 1 -03} + {-941576400 -14400 0 -04} + {-931032000 -10800 1 -03} + {-900882000 -14400 0 -04} + {-890337600 -10800 1 -03} + {-833749200 -14400 0 -04} + {-827265600 -10800 1 -03} + {-752274000 -14400 0 -04} + {-733780800 -10800 1 -03} + {-197326800 -14400 0 -04} + {-190843200 -10800 1 -03} + {-184194000 -14400 0 -04} + {-164491200 -10800 1 -03} + {-152658000 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {596948400 -7200 1 -02} + {605066400 -10800 0 -03} + {624423600 -7200 1 -02} + {636516000 -14400 0 -04} + {655963200 -10800 1 -03} + {667796400 -14400 0 -04} + {687499200 -10800 1 -03} + {699418800 -14400 0 -04} + {719380800 -7200 0 -02} + {731469600 -10800 0 -03} + {938916000 -10800 0 -04} + {938919600 -10800 1 -03} + {952056000 -10800 0 -03} + {1085281200 -14400 0 -04} + {1096171200 -10800 0 -03} + {1198983600 -7200 1 -02} + {1205632800 -10800 0 -03} + {1224295200 -10800 0 -03} } diff --git a/library/tzdata/America/Argentina/Rio_Gallegos b/library/tzdata/America/Argentina/Rio_Gallegos index 91d37dd..4b2a348 100644 --- a/library/tzdata/America/Argentina/Rio_Gallegos +++ b/library/tzdata/America/Argentina/Rio_Gallegos @@ -3,66 +3,66 @@ set TZData(:America/Argentina/Rio_Gallegos) { {-9223372036854775808 -16612 0 LMT} {-2372095388 -15408 0 CMT} - {-1567453392 -14400 0 ART} - {-1233432000 -10800 0 ARST} - {-1222981200 -14400 0 ART} - {-1205956800 -10800 1 ARST} - {-1194037200 -14400 0 ART} - {-1172865600 -10800 1 ARST} - {-1162501200 -14400 0 ART} - {-1141329600 -10800 1 ARST} - {-1130965200 -14400 0 ART} - {-1109793600 -10800 1 ARST} - {-1099429200 -14400 0 ART} - {-1078257600 -10800 1 ARST} - {-1067806800 -14400 0 ART} - {-1046635200 -10800 1 ARST} - {-1036270800 -14400 0 ART} - {-1015099200 -10800 1 ARST} - {-1004734800 -14400 0 ART} - {-983563200 -10800 1 ARST} - {-973198800 -14400 0 ART} - {-952027200 -10800 1 ARST} - {-941576400 -14400 0 ART} - {-931032000 -10800 1 ARST} - {-900882000 -14400 0 ART} - {-890337600 -10800 1 ARST} - {-833749200 -14400 0 ART} - {-827265600 -10800 1 ARST} - {-752274000 -14400 0 ART} - {-733780800 -10800 1 ARST} - {-197326800 -14400 0 ART} - {-190843200 -10800 1 ARST} - {-184194000 -14400 0 ART} - {-164491200 -10800 1 ARST} - {-152658000 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {596948400 -7200 1 ARST} - {605066400 -10800 0 ART} - {624423600 -7200 1 ARST} - {636516000 -10800 0 ART} - {656478000 -7200 1 ARST} - {667965600 -10800 0 ART} - {687927600 -7200 1 ARST} - {699415200 -10800 0 ART} - {719377200 -7200 1 ARST} - {731469600 -10800 0 ART} - {938916000 -10800 0 ART} - {938919600 -10800 1 ARST} - {952056000 -10800 0 ART} - {1086058800 -14400 0 WART} - {1087704000 -10800 0 ART} - {1198983600 -7200 1 ARST} - {1205632800 -10800 0 ART} - {1224295200 -10800 0 ART} + {-1567453392 -14400 0 -04} + {-1233432000 -10800 0 -03} + {-1222981200 -14400 0 -04} + {-1205956800 -10800 1 -03} + {-1194037200 -14400 0 -04} + {-1172865600 -10800 1 -03} + {-1162501200 -14400 0 -04} + {-1141329600 -10800 1 -03} + {-1130965200 -14400 0 -04} + {-1109793600 -10800 1 -03} + {-1099429200 -14400 0 -04} + {-1078257600 -10800 1 -03} + {-1067806800 -14400 0 -04} + {-1046635200 -10800 1 -03} + {-1036270800 -14400 0 -04} + {-1015099200 -10800 1 -03} + {-1004734800 -14400 0 -04} + {-983563200 -10800 1 -03} + {-973198800 -14400 0 -04} + {-952027200 -10800 1 -03} + {-941576400 -14400 0 -04} + {-931032000 -10800 1 -03} + {-900882000 -14400 0 -04} + {-890337600 -10800 1 -03} + {-833749200 -14400 0 -04} + {-827265600 -10800 1 -03} + {-752274000 -14400 0 -04} + {-733780800 -10800 1 -03} + {-197326800 -14400 0 -04} + {-190843200 -10800 1 -03} + {-184194000 -14400 0 -04} + {-164491200 -10800 1 -03} + {-152658000 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {596948400 -7200 1 -02} + {605066400 -10800 0 -03} + {624423600 -7200 1 -02} + {636516000 -10800 0 -03} + {656478000 -7200 1 -02} + {667965600 -10800 0 -03} + {687927600 -7200 1 -02} + {699415200 -10800 0 -03} + {719377200 -7200 1 -02} + {731469600 -10800 0 -03} + {938916000 -10800 0 -04} + {938919600 -10800 1 -03} + {952056000 -10800 0 -03} + {1086058800 -14400 0 -04} + {1087704000 -10800 0 -03} + {1198983600 -7200 1 -02} + {1205632800 -10800 0 -03} + {1224295200 -10800 0 -03} } diff --git a/library/tzdata/America/Argentina/Salta b/library/tzdata/America/Argentina/Salta index a5a7010..4f9ccf9 100644 --- a/library/tzdata/America/Argentina/Salta +++ b/library/tzdata/America/Argentina/Salta @@ -3,64 +3,64 @@ set TZData(:America/Argentina/Salta) { {-9223372036854775808 -15700 0 LMT} {-2372096300 -15408 0 CMT} - {-1567453392 -14400 0 ART} - {-1233432000 -10800 0 ARST} - {-1222981200 -14400 0 ART} - {-1205956800 -10800 1 ARST} - {-1194037200 -14400 0 ART} - {-1172865600 -10800 1 ARST} - {-1162501200 -14400 0 ART} - {-1141329600 -10800 1 ARST} - {-1130965200 -14400 0 ART} - {-1109793600 -10800 1 ARST} - {-1099429200 -14400 0 ART} - {-1078257600 -10800 1 ARST} - {-1067806800 -14400 0 ART} - {-1046635200 -10800 1 ARST} - {-1036270800 -14400 0 ART} - {-1015099200 -10800 1 ARST} - {-1004734800 -14400 0 ART} - {-983563200 -10800 1 ARST} - {-973198800 -14400 0 ART} - {-952027200 -10800 1 ARST} - {-941576400 -14400 0 ART} - {-931032000 -10800 1 ARST} - {-900882000 -14400 0 ART} - {-890337600 -10800 1 ARST} - {-833749200 -14400 0 ART} - {-827265600 -10800 1 ARST} - {-752274000 -14400 0 ART} - {-733780800 -10800 1 ARST} - {-197326800 -14400 0 ART} - {-190843200 -10800 1 ARST} - {-184194000 -14400 0 ART} - {-164491200 -10800 1 ARST} - {-152658000 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {596948400 -7200 1 ARST} - {605066400 -10800 0 ART} - {624423600 -7200 1 ARST} - {636516000 -10800 0 ART} - {656478000 -7200 1 ARST} - {667965600 -14400 0 WART} - {687931200 -7200 0 ARST} - {699415200 -10800 0 ART} - {719377200 -7200 1 ARST} - {731469600 -10800 0 ART} - {938916000 -10800 0 ART} - {938919600 -10800 1 ARST} - {952056000 -10800 0 ART} - {1198983600 -7200 1 ARST} - {1205632800 -10800 0 ART} - {1224295200 -10800 0 ART} + {-1567453392 -14400 0 -04} + {-1233432000 -10800 0 -03} + {-1222981200 -14400 0 -04} + {-1205956800 -10800 1 -03} + {-1194037200 -14400 0 -04} + {-1172865600 -10800 1 -03} + {-1162501200 -14400 0 -04} + {-1141329600 -10800 1 -03} + {-1130965200 -14400 0 -04} + {-1109793600 -10800 1 -03} + {-1099429200 -14400 0 -04} + {-1078257600 -10800 1 -03} + {-1067806800 -14400 0 -04} + {-1046635200 -10800 1 -03} + {-1036270800 -14400 0 -04} + {-1015099200 -10800 1 -03} + {-1004734800 -14400 0 -04} + {-983563200 -10800 1 -03} + {-973198800 -14400 0 -04} + {-952027200 -10800 1 -03} + {-941576400 -14400 0 -04} + {-931032000 -10800 1 -03} + {-900882000 -14400 0 -04} + {-890337600 -10800 1 -03} + {-833749200 -14400 0 -04} + {-827265600 -10800 1 -03} + {-752274000 -14400 0 -04} + {-733780800 -10800 1 -03} + {-197326800 -14400 0 -04} + {-190843200 -10800 1 -03} + {-184194000 -14400 0 -04} + {-164491200 -10800 1 -03} + {-152658000 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {596948400 -7200 1 -02} + {605066400 -10800 0 -03} + {624423600 -7200 1 -02} + {636516000 -10800 0 -03} + {656478000 -7200 1 -02} + {667965600 -14400 0 -04} + {687931200 -7200 0 -02} + {699415200 -10800 0 -03} + {719377200 -7200 1 -02} + {731469600 -10800 0 -03} + {938916000 -10800 0 -04} + {938919600 -10800 1 -03} + {952056000 -10800 0 -03} + {1198983600 -7200 1 -02} + {1205632800 -10800 0 -03} + {1224295200 -10800 0 -03} } diff --git a/library/tzdata/America/Argentina/San_Juan b/library/tzdata/America/Argentina/San_Juan index 417e234..1f0530a 100644 --- a/library/tzdata/America/Argentina/San_Juan +++ b/library/tzdata/America/Argentina/San_Juan @@ -3,67 +3,67 @@ set TZData(:America/Argentina/San_Juan) { {-9223372036854775808 -16444 0 LMT} {-2372095556 -15408 0 CMT} - {-1567453392 -14400 0 ART} - {-1233432000 -10800 0 ARST} - {-1222981200 -14400 0 ART} - {-1205956800 -10800 1 ARST} - {-1194037200 -14400 0 ART} - {-1172865600 -10800 1 ARST} - {-1162501200 -14400 0 ART} - {-1141329600 -10800 1 ARST} - {-1130965200 -14400 0 ART} - {-1109793600 -10800 1 ARST} - {-1099429200 -14400 0 ART} - {-1078257600 -10800 1 ARST} - {-1067806800 -14400 0 ART} - {-1046635200 -10800 1 ARST} - {-1036270800 -14400 0 ART} - {-1015099200 -10800 1 ARST} - {-1004734800 -14400 0 ART} - {-983563200 -10800 1 ARST} - {-973198800 -14400 0 ART} - {-952027200 -10800 1 ARST} - {-941576400 -14400 0 ART} - {-931032000 -10800 1 ARST} - {-900882000 -14400 0 ART} - {-890337600 -10800 1 ARST} - {-833749200 -14400 0 ART} - {-827265600 -10800 1 ARST} - {-752274000 -14400 0 ART} - {-733780800 -10800 1 ARST} - {-197326800 -14400 0 ART} - {-190843200 -10800 1 ARST} - {-184194000 -14400 0 ART} - {-164491200 -10800 1 ARST} - {-152658000 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {596948400 -7200 1 ARST} - {605066400 -10800 0 ART} - {624423600 -7200 1 ARST} - {636516000 -10800 0 ART} - {656478000 -7200 1 ARST} - {667792800 -14400 0 WART} - {673588800 -10800 0 ART} - {687927600 -7200 1 ARST} - {699415200 -10800 0 ART} - {719377200 -7200 1 ARST} - {731469600 -10800 0 ART} - {938916000 -10800 0 ART} - {938919600 -10800 1 ARST} - {952056000 -10800 0 ART} - {1085972400 -14400 0 WART} - {1090728000 -10800 0 ART} - {1198983600 -7200 1 ARST} - {1205632800 -10800 0 ART} - {1224295200 -10800 0 ART} + {-1567453392 -14400 0 -04} + {-1233432000 -10800 0 -03} + {-1222981200 -14400 0 -04} + {-1205956800 -10800 1 -03} + {-1194037200 -14400 0 -04} + {-1172865600 -10800 1 -03} + {-1162501200 -14400 0 -04} + {-1141329600 -10800 1 -03} + {-1130965200 -14400 0 -04} + {-1109793600 -10800 1 -03} + {-1099429200 -14400 0 -04} + {-1078257600 -10800 1 -03} + {-1067806800 -14400 0 -04} + {-1046635200 -10800 1 -03} + {-1036270800 -14400 0 -04} + {-1015099200 -10800 1 -03} + {-1004734800 -14400 0 -04} + {-983563200 -10800 1 -03} + {-973198800 -14400 0 -04} + {-952027200 -10800 1 -03} + {-941576400 -14400 0 -04} + {-931032000 -10800 1 -03} + {-900882000 -14400 0 -04} + {-890337600 -10800 1 -03} + {-833749200 -14400 0 -04} + {-827265600 -10800 1 -03} + {-752274000 -14400 0 -04} + {-733780800 -10800 1 -03} + {-197326800 -14400 0 -04} + {-190843200 -10800 1 -03} + {-184194000 -14400 0 -04} + {-164491200 -10800 1 -03} + {-152658000 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {596948400 -7200 1 -02} + {605066400 -10800 0 -03} + {624423600 -7200 1 -02} + {636516000 -10800 0 -03} + {656478000 -7200 1 -02} + {667792800 -14400 0 -04} + {673588800 -10800 0 -03} + {687927600 -7200 1 -02} + {699415200 -10800 0 -03} + {719377200 -7200 1 -02} + {731469600 -10800 0 -03} + {938916000 -10800 0 -04} + {938919600 -10800 1 -03} + {952056000 -10800 0 -03} + {1085972400 -14400 0 -04} + {1090728000 -10800 0 -03} + {1198983600 -7200 1 -02} + {1205632800 -10800 0 -03} + {1224295200 -10800 0 -03} } diff --git a/library/tzdata/America/Argentina/San_Luis b/library/tzdata/America/Argentina/San_Luis index 8ca55d7..3583a39 100644 --- a/library/tzdata/America/Argentina/San_Luis +++ b/library/tzdata/America/Argentina/San_Luis @@ -3,66 +3,66 @@ set TZData(:America/Argentina/San_Luis) { {-9223372036854775808 -15924 0 LMT} {-2372096076 -15408 0 CMT} - {-1567453392 -14400 0 ART} - {-1233432000 -10800 0 ARST} - {-1222981200 -14400 0 ART} - {-1205956800 -10800 1 ARST} - {-1194037200 -14400 0 ART} - {-1172865600 -10800 1 ARST} - {-1162501200 -14400 0 ART} - {-1141329600 -10800 1 ARST} - {-1130965200 -14400 0 ART} - {-1109793600 -10800 1 ARST} - {-1099429200 -14400 0 ART} - {-1078257600 -10800 1 ARST} - {-1067806800 -14400 0 ART} - {-1046635200 -10800 1 ARST} - {-1036270800 -14400 0 ART} - {-1015099200 -10800 1 ARST} - {-1004734800 -14400 0 ART} - {-983563200 -10800 1 ARST} - {-973198800 -14400 0 ART} - {-952027200 -10800 1 ARST} - {-941576400 -14400 0 ART} - {-931032000 -10800 1 ARST} - {-900882000 -14400 0 ART} - {-890337600 -10800 1 ARST} - {-833749200 -14400 0 ART} - {-827265600 -10800 1 ARST} - {-752274000 -14400 0 ART} - {-733780800 -10800 1 ARST} - {-197326800 -14400 0 ART} - {-190843200 -10800 1 ARST} - {-184194000 -14400 0 ART} - {-164491200 -10800 1 ARST} - {-152658000 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {596948400 -7200 1 ARST} - {605066400 -10800 0 ART} - {624423600 -7200 1 ARST} - {631159200 -7200 1 ARST} - {637380000 -14400 0 WART} - {655963200 -10800 1 WARST} - {667796400 -14400 0 WART} - {675748800 -10800 0 ART} - {938919600 -10800 1 WARST} - {952052400 -10800 0 ART} - {1085972400 -14400 0 WART} - {1090728000 -10800 0 ART} - {1198983600 -7200 1 ARST} - {1200880800 -10800 0 WART} - {1205031600 -14400 0 WART} - {1223784000 -10800 1 WARST} - {1236481200 -14400 0 WART} - {1255233600 -10800 0 ART} + {-1567453392 -14400 0 -04} + {-1233432000 -10800 0 -03} + {-1222981200 -14400 0 -04} + {-1205956800 -10800 1 -03} + {-1194037200 -14400 0 -04} + {-1172865600 -10800 1 -03} + {-1162501200 -14400 0 -04} + {-1141329600 -10800 1 -03} + {-1130965200 -14400 0 -04} + {-1109793600 -10800 1 -03} + {-1099429200 -14400 0 -04} + {-1078257600 -10800 1 -03} + {-1067806800 -14400 0 -04} + {-1046635200 -10800 1 -03} + {-1036270800 -14400 0 -04} + {-1015099200 -10800 1 -03} + {-1004734800 -14400 0 -04} + {-983563200 -10800 1 -03} + {-973198800 -14400 0 -04} + {-952027200 -10800 1 -03} + {-941576400 -14400 0 -04} + {-931032000 -10800 1 -03} + {-900882000 -14400 0 -04} + {-890337600 -10800 1 -03} + {-833749200 -14400 0 -04} + {-827265600 -10800 1 -03} + {-752274000 -14400 0 -04} + {-733780800 -10800 1 -03} + {-197326800 -14400 0 -04} + {-190843200 -10800 1 -03} + {-184194000 -14400 0 -04} + {-164491200 -10800 1 -03} + {-152658000 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {596948400 -7200 1 -02} + {605066400 -10800 0 -03} + {624423600 -7200 1 -02} + {631159200 -7200 1 -02} + {637380000 -14400 0 -04} + {655963200 -10800 1 -03} + {667796400 -14400 0 -04} + {675748800 -10800 0 -03} + {938919600 -10800 1 -03} + {952052400 -10800 0 -03} + {1085972400 -14400 0 -04} + {1090728000 -10800 0 -03} + {1198983600 -7200 1 -02} + {1200880800 -10800 0 -04} + {1205031600 -14400 0 -04} + {1223784000 -10800 1 -03} + {1236481200 -14400 0 -04} + {1255233600 -10800 0 -03} } diff --git a/library/tzdata/America/Argentina/Tucuman b/library/tzdata/America/Argentina/Tucuman index 3500986..15c5c63 100644 --- a/library/tzdata/America/Argentina/Tucuman +++ b/library/tzdata/America/Argentina/Tucuman @@ -3,67 +3,67 @@ set TZData(:America/Argentina/Tucuman) { {-9223372036854775808 -15652 0 LMT} {-2372096348 -15408 0 CMT} - {-1567453392 -14400 0 ART} - {-1233432000 -10800 0 ARST} - {-1222981200 -14400 0 ART} - {-1205956800 -10800 1 ARST} - {-1194037200 -14400 0 ART} - {-1172865600 -10800 1 ARST} - {-1162501200 -14400 0 ART} - {-1141329600 -10800 1 ARST} - {-1130965200 -14400 0 ART} - {-1109793600 -10800 1 ARST} - {-1099429200 -14400 0 ART} - {-1078257600 -10800 1 ARST} - {-1067806800 -14400 0 ART} - {-1046635200 -10800 1 ARST} - {-1036270800 -14400 0 ART} - {-1015099200 -10800 1 ARST} - {-1004734800 -14400 0 ART} - {-983563200 -10800 1 ARST} - {-973198800 -14400 0 ART} - {-952027200 -10800 1 ARST} - {-941576400 -14400 0 ART} - {-931032000 -10800 1 ARST} - {-900882000 -14400 0 ART} - {-890337600 -10800 1 ARST} - {-833749200 -14400 0 ART} - {-827265600 -10800 1 ARST} - {-752274000 -14400 0 ART} - {-733780800 -10800 1 ARST} - {-197326800 -14400 0 ART} - {-190843200 -10800 1 ARST} - {-184194000 -14400 0 ART} - {-164491200 -10800 1 ARST} - {-152658000 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {596948400 -7200 1 ARST} - {605066400 -10800 0 ART} - {624423600 -7200 1 ARST} - {636516000 -10800 0 ART} - {656478000 -7200 1 ARST} - {667965600 -14400 0 WART} - {687931200 -7200 0 ARST} - {699415200 -10800 0 ART} - {719377200 -7200 1 ARST} - {731469600 -10800 0 ART} - {938916000 -10800 0 ART} - {938919600 -10800 1 ARST} - {952056000 -10800 0 ART} - {1086058800 -14400 0 WART} - {1087099200 -10800 0 ART} - {1198983600 -7200 1 ARST} - {1205632800 -10800 0 ART} - {1224385200 -7200 1 ARST} - {1237082400 -10800 0 ART} + {-1567453392 -14400 0 -04} + {-1233432000 -10800 0 -03} + {-1222981200 -14400 0 -04} + {-1205956800 -10800 1 -03} + {-1194037200 -14400 0 -04} + {-1172865600 -10800 1 -03} + {-1162501200 -14400 0 -04} + {-1141329600 -10800 1 -03} + {-1130965200 -14400 0 -04} + {-1109793600 -10800 1 -03} + {-1099429200 -14400 0 -04} + {-1078257600 -10800 1 -03} + {-1067806800 -14400 0 -04} + {-1046635200 -10800 1 -03} + {-1036270800 -14400 0 -04} + {-1015099200 -10800 1 -03} + {-1004734800 -14400 0 -04} + {-983563200 -10800 1 -03} + {-973198800 -14400 0 -04} + {-952027200 -10800 1 -03} + {-941576400 -14400 0 -04} + {-931032000 -10800 1 -03} + {-900882000 -14400 0 -04} + {-890337600 -10800 1 -03} + {-833749200 -14400 0 -04} + {-827265600 -10800 1 -03} + {-752274000 -14400 0 -04} + {-733780800 -10800 1 -03} + {-197326800 -14400 0 -04} + {-190843200 -10800 1 -03} + {-184194000 -14400 0 -04} + {-164491200 -10800 1 -03} + {-152658000 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {596948400 -7200 1 -02} + {605066400 -10800 0 -03} + {624423600 -7200 1 -02} + {636516000 -10800 0 -03} + {656478000 -7200 1 -02} + {667965600 -14400 0 -04} + {687931200 -7200 0 -02} + {699415200 -10800 0 -03} + {719377200 -7200 1 -02} + {731469600 -10800 0 -03} + {938916000 -10800 0 -04} + {938919600 -10800 1 -03} + {952056000 -10800 0 -03} + {1086058800 -14400 0 -04} + {1087099200 -10800 0 -03} + {1198983600 -7200 1 -02} + {1205632800 -10800 0 -03} + {1224385200 -7200 1 -02} + {1237082400 -10800 0 -03} } diff --git a/library/tzdata/America/Argentina/Ushuaia b/library/tzdata/America/Argentina/Ushuaia index 4fcf92d..4214c1d 100644 --- a/library/tzdata/America/Argentina/Ushuaia +++ b/library/tzdata/America/Argentina/Ushuaia @@ -3,66 +3,66 @@ set TZData(:America/Argentina/Ushuaia) { {-9223372036854775808 -16392 0 LMT} {-2372095608 -15408 0 CMT} - {-1567453392 -14400 0 ART} - {-1233432000 -10800 0 ARST} - {-1222981200 -14400 0 ART} - {-1205956800 -10800 1 ARST} - {-1194037200 -14400 0 ART} - {-1172865600 -10800 1 ARST} - {-1162501200 -14400 0 ART} - {-1141329600 -10800 1 ARST} - {-1130965200 -14400 0 ART} - {-1109793600 -10800 1 ARST} - {-1099429200 -14400 0 ART} - {-1078257600 -10800 1 ARST} - {-1067806800 -14400 0 ART} - {-1046635200 -10800 1 ARST} - {-1036270800 -14400 0 ART} - {-1015099200 -10800 1 ARST} - {-1004734800 -14400 0 ART} - {-983563200 -10800 1 ARST} - {-973198800 -14400 0 ART} - {-952027200 -10800 1 ARST} - {-941576400 -14400 0 ART} - {-931032000 -10800 1 ARST} - {-900882000 -14400 0 ART} - {-890337600 -10800 1 ARST} - {-833749200 -14400 0 ART} - {-827265600 -10800 1 ARST} - {-752274000 -14400 0 ART} - {-733780800 -10800 1 ARST} - {-197326800 -14400 0 ART} - {-190843200 -10800 1 ARST} - {-184194000 -14400 0 ART} - {-164491200 -10800 1 ARST} - {-152658000 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {596948400 -7200 1 ARST} - {605066400 -10800 0 ART} - {624423600 -7200 1 ARST} - {636516000 -10800 0 ART} - {656478000 -7200 1 ARST} - {667965600 -10800 0 ART} - {687927600 -7200 1 ARST} - {699415200 -10800 0 ART} - {719377200 -7200 1 ARST} - {731469600 -10800 0 ART} - {938916000 -10800 0 ART} - {938919600 -10800 1 ARST} - {952056000 -10800 0 ART} - {1085886000 -14400 0 WART} - {1087704000 -10800 0 ART} - {1198983600 -7200 1 ARST} - {1205632800 -10800 0 ART} - {1224295200 -10800 0 ART} + {-1567453392 -14400 0 -04} + {-1233432000 -10800 0 -03} + {-1222981200 -14400 0 -04} + {-1205956800 -10800 1 -03} + {-1194037200 -14400 0 -04} + {-1172865600 -10800 1 -03} + {-1162501200 -14400 0 -04} + {-1141329600 -10800 1 -03} + {-1130965200 -14400 0 -04} + {-1109793600 -10800 1 -03} + {-1099429200 -14400 0 -04} + {-1078257600 -10800 1 -03} + {-1067806800 -14400 0 -04} + {-1046635200 -10800 1 -03} + {-1036270800 -14400 0 -04} + {-1015099200 -10800 1 -03} + {-1004734800 -14400 0 -04} + {-983563200 -10800 1 -03} + {-973198800 -14400 0 -04} + {-952027200 -10800 1 -03} + {-941576400 -14400 0 -04} + {-931032000 -10800 1 -03} + {-900882000 -14400 0 -04} + {-890337600 -10800 1 -03} + {-833749200 -14400 0 -04} + {-827265600 -10800 1 -03} + {-752274000 -14400 0 -04} + {-733780800 -10800 1 -03} + {-197326800 -14400 0 -04} + {-190843200 -10800 1 -03} + {-184194000 -14400 0 -04} + {-164491200 -10800 1 -03} + {-152658000 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {596948400 -7200 1 -02} + {605066400 -10800 0 -03} + {624423600 -7200 1 -02} + {636516000 -10800 0 -03} + {656478000 -7200 1 -02} + {667965600 -10800 0 -03} + {687927600 -7200 1 -02} + {699415200 -10800 0 -03} + {719377200 -7200 1 -02} + {731469600 -10800 0 -03} + {938916000 -10800 0 -04} + {938919600 -10800 1 -03} + {952056000 -10800 0 -03} + {1085886000 -14400 0 -04} + {1087704000 -10800 0 -03} + {1198983600 -7200 1 -02} + {1205632800 -10800 0 -03} + {1224295200 -10800 0 -03} } diff --git a/library/tzdata/America/Asuncion b/library/tzdata/America/Asuncion index 9ea30da..606db57 100644 --- a/library/tzdata/America/Asuncion +++ b/library/tzdata/America/Asuncion @@ -3,257 +3,257 @@ set TZData(:America/Asuncion) { {-9223372036854775808 -13840 0 LMT} {-2524507760 -13840 0 AMT} - {-1206389360 -14400 0 PYT} - {86760000 -10800 0 PYT} - {134017200 -14400 0 PYT} - {162878400 -14400 0 PYT} - {181368000 -10800 1 PYST} - {194497200 -14400 0 PYT} - {212990400 -10800 1 PYST} - {226033200 -14400 0 PYT} - {244526400 -10800 1 PYST} - {257569200 -14400 0 PYT} - {276062400 -10800 1 PYST} - {291783600 -14400 0 PYT} - {307598400 -10800 1 PYST} - {323406000 -14400 0 PYT} - {339220800 -10800 1 PYST} - {354942000 -14400 0 PYT} - {370756800 -10800 1 PYST} - {386478000 -14400 0 PYT} - {402292800 -10800 1 PYST} - {418014000 -14400 0 PYT} - {433828800 -10800 1 PYST} - {449636400 -14400 0 PYT} - {465451200 -10800 1 PYST} - {481172400 -14400 0 PYT} - {496987200 -10800 1 PYST} - {512708400 -14400 0 PYT} - {528523200 -10800 1 PYST} - {544244400 -14400 0 PYT} - {560059200 -10800 1 PYST} - {575866800 -14400 0 PYT} - {591681600 -10800 1 PYST} - {607402800 -14400 0 PYT} - {625032000 -10800 1 PYST} - {638938800 -14400 0 PYT} - {654753600 -10800 1 PYST} - {670474800 -14400 0 PYT} - {686721600 -10800 1 PYST} - {699418800 -14400 0 PYT} - {718257600 -10800 1 PYST} - {733546800 -14400 0 PYT} - {749448000 -10800 1 PYST} - {762318000 -14400 0 PYT} - {780984000 -10800 1 PYST} - {793767600 -14400 0 PYT} - {812520000 -10800 1 PYST} - {825649200 -14400 0 PYT} - {844574400 -10800 1 PYST} - {856666800 -14400 0 PYT} - {876024000 -10800 1 PYST} - {888721200 -14400 0 PYT} - {907473600 -10800 1 PYST} - {920775600 -14400 0 PYT} - {938923200 -10800 1 PYST} - {952225200 -14400 0 PYT} - {970372800 -10800 1 PYST} - {983674800 -14400 0 PYT} - {1002427200 -10800 1 PYST} - {1018148400 -14400 0 PYT} - {1030852800 -10800 1 PYST} - {1049598000 -14400 0 PYT} - {1062907200 -10800 1 PYST} - {1081047600 -14400 0 PYT} - {1097985600 -10800 1 PYST} - {1110682800 -14400 0 PYT} - {1129435200 -10800 1 PYST} - {1142132400 -14400 0 PYT} - {1160884800 -10800 1 PYST} - {1173582000 -14400 0 PYT} - {1192939200 -10800 1 PYST} - {1205031600 -14400 0 PYT} - {1224388800 -10800 1 PYST} - {1236481200 -14400 0 PYT} - {1255838400 -10800 1 PYST} - {1270954800 -14400 0 PYT} - {1286078400 -10800 1 PYST} - {1302404400 -14400 0 PYT} - {1317528000 -10800 1 PYST} - {1333854000 -14400 0 PYT} - {1349582400 -10800 1 PYST} - {1364094000 -14400 0 PYT} - {1381032000 -10800 1 PYST} - {1395543600 -14400 0 PYT} - {1412481600 -10800 1 PYST} - {1426993200 -14400 0 PYT} - {1443931200 -10800 1 PYST} - {1459047600 -14400 0 PYT} - {1475380800 -10800 1 PYST} - {1490497200 -14400 0 PYT} - {1506830400 -10800 1 PYST} - {1521946800 -14400 0 PYT} - {1538884800 -10800 1 PYST} - {1553396400 -14400 0 PYT} - {1570334400 -10800 1 PYST} - {1584846000 -14400 0 PYT} - {1601784000 -10800 1 PYST} - {1616900400 -14400 0 PYT} - {1633233600 -10800 1 PYST} - {1648350000 -14400 0 PYT} - {1664683200 -10800 1 PYST} - {1679799600 -14400 0 PYT} - {1696132800 -10800 1 PYST} - {1711249200 -14400 0 PYT} - {1728187200 -10800 1 PYST} - {1742698800 -14400 0 PYT} - {1759636800 -10800 1 PYST} - {1774148400 -14400 0 PYT} - {1791086400 -10800 1 PYST} - {1806202800 -14400 0 PYT} - {1822536000 -10800 1 PYST} - {1837652400 -14400 0 PYT} - {1853985600 -10800 1 PYST} - {1869102000 -14400 0 PYT} - {1886040000 -10800 1 PYST} - {1900551600 -14400 0 PYT} - {1917489600 -10800 1 PYST} - {1932001200 -14400 0 PYT} - {1948939200 -10800 1 PYST} - {1964055600 -14400 0 PYT} - {1980388800 -10800 1 PYST} - {1995505200 -14400 0 PYT} - {2011838400 -10800 1 PYST} - {2026954800 -14400 0 PYT} - {2043288000 -10800 1 PYST} - {2058404400 -14400 0 PYT} - {2075342400 -10800 1 PYST} - {2089854000 -14400 0 PYT} - {2106792000 -10800 1 PYST} - {2121303600 -14400 0 PYT} - {2138241600 -10800 1 PYST} - {2153358000 -14400 0 PYT} - {2169691200 -10800 1 PYST} - {2184807600 -14400 0 PYT} - {2201140800 -10800 1 PYST} - {2216257200 -14400 0 PYT} - {2233195200 -10800 1 PYST} - {2247706800 -14400 0 PYT} - {2264644800 -10800 1 PYST} - {2279156400 -14400 0 PYT} - {2296094400 -10800 1 PYST} - {2310606000 -14400 0 PYT} - {2327544000 -10800 1 PYST} - {2342660400 -14400 0 PYT} - {2358993600 -10800 1 PYST} - {2374110000 -14400 0 PYT} - {2390443200 -10800 1 PYST} - {2405559600 -14400 0 PYT} - {2422497600 -10800 1 PYST} - {2437009200 -14400 0 PYT} - {2453947200 -10800 1 PYST} - {2468458800 -14400 0 PYT} - {2485396800 -10800 1 PYST} - {2500513200 -14400 0 PYT} - {2516846400 -10800 1 PYST} - {2531962800 -14400 0 PYT} - {2548296000 -10800 1 PYST} - {2563412400 -14400 0 PYT} - {2579745600 -10800 1 PYST} - {2594862000 -14400 0 PYT} - {2611800000 -10800 1 PYST} - {2626311600 -14400 0 PYT} - {2643249600 -10800 1 PYST} - {2657761200 -14400 0 PYT} - {2674699200 -10800 1 PYST} - {2689815600 -14400 0 PYT} - {2706148800 -10800 1 PYST} - {2721265200 -14400 0 PYT} - {2737598400 -10800 1 PYST} - {2752714800 -14400 0 PYT} - {2769652800 -10800 1 PYST} - {2784164400 -14400 0 PYT} - {2801102400 -10800 1 PYST} - {2815614000 -14400 0 PYT} - {2832552000 -10800 1 PYST} - {2847668400 -14400 0 PYT} - {2864001600 -10800 1 PYST} - {2879118000 -14400 0 PYT} - {2895451200 -10800 1 PYST} - {2910567600 -14400 0 PYT} - {2926900800 -10800 1 PYST} - {2942017200 -14400 0 PYT} - {2958955200 -10800 1 PYST} - {2973466800 -14400 0 PYT} - {2990404800 -10800 1 PYST} - {3004916400 -14400 0 PYT} - {3021854400 -10800 1 PYST} - {3036970800 -14400 0 PYT} - {3053304000 -10800 1 PYST} - {3068420400 -14400 0 PYT} - {3084753600 -10800 1 PYST} - {3099870000 -14400 0 PYT} - {3116808000 -10800 1 PYST} - {3131319600 -14400 0 PYT} - {3148257600 -10800 1 PYST} - {3162769200 -14400 0 PYT} - {3179707200 -10800 1 PYST} - {3194218800 -14400 0 PYT} - {3211156800 -10800 1 PYST} - {3226273200 -14400 0 PYT} - {3242606400 -10800 1 PYST} - {3257722800 -14400 0 PYT} - {3274056000 -10800 1 PYST} - {3289172400 -14400 0 PYT} - {3306110400 -10800 1 PYST} - {3320622000 -14400 0 PYT} - {3337560000 -10800 1 PYST} - {3352071600 -14400 0 PYT} - {3369009600 -10800 1 PYST} - {3384126000 -14400 0 PYT} - {3400459200 -10800 1 PYST} - {3415575600 -14400 0 PYT} - {3431908800 -10800 1 PYST} - {3447025200 -14400 0 PYT} - {3463358400 -10800 1 PYST} - {3478474800 -14400 0 PYT} - {3495412800 -10800 1 PYST} - {3509924400 -14400 0 PYT} - {3526862400 -10800 1 PYST} - {3541374000 -14400 0 PYT} - {3558312000 -10800 1 PYST} - {3573428400 -14400 0 PYT} - {3589761600 -10800 1 PYST} - {3604878000 -14400 0 PYT} - {3621211200 -10800 1 PYST} - {3636327600 -14400 0 PYT} - {3653265600 -10800 1 PYST} - {3667777200 -14400 0 PYT} - {3684715200 -10800 1 PYST} - {3699226800 -14400 0 PYT} - {3716164800 -10800 1 PYST} - {3731281200 -14400 0 PYT} - {3747614400 -10800 1 PYST} - {3762730800 -14400 0 PYT} - {3779064000 -10800 1 PYST} - {3794180400 -14400 0 PYT} - {3810513600 -10800 1 PYST} - {3825630000 -14400 0 PYT} - {3842568000 -10800 1 PYST} - {3857079600 -14400 0 PYT} - {3874017600 -10800 1 PYST} - {3888529200 -14400 0 PYT} - {3905467200 -10800 1 PYST} - {3920583600 -14400 0 PYT} - {3936916800 -10800 1 PYST} - {3952033200 -14400 0 PYT} - {3968366400 -10800 1 PYST} - {3983482800 -14400 0 PYT} - {4000420800 -10800 1 PYST} - {4014932400 -14400 0 PYT} - {4031870400 -10800 1 PYST} - {4046382000 -14400 0 PYT} - {4063320000 -10800 1 PYST} - {4077831600 -14400 0 PYT} - {4094769600 -10800 1 PYST} + {-1206389360 -14400 0 -04} + {86760000 -10800 0 -03} + {134017200 -14400 0 -04} + {162878400 -14400 0 -04} + {181368000 -10800 1 -03} + {194497200 -14400 0 -04} + {212990400 -10800 1 -03} + {226033200 -14400 0 -04} + {244526400 -10800 1 -03} + {257569200 -14400 0 -04} + {276062400 -10800 1 -03} + {291783600 -14400 0 -04} + {307598400 -10800 1 -03} + {323406000 -14400 0 -04} + {339220800 -10800 1 -03} + {354942000 -14400 0 -04} + {370756800 -10800 1 -03} + {386478000 -14400 0 -04} + {402292800 -10800 1 -03} + {418014000 -14400 0 -04} + {433828800 -10800 1 -03} + {449636400 -14400 0 -04} + {465451200 -10800 1 -03} + {481172400 -14400 0 -04} + {496987200 -10800 1 -03} + {512708400 -14400 0 -04} + {528523200 -10800 1 -03} + {544244400 -14400 0 -04} + {560059200 -10800 1 -03} + {575866800 -14400 0 -04} + {591681600 -10800 1 -03} + {607402800 -14400 0 -04} + {625032000 -10800 1 -03} + {638938800 -14400 0 -04} + {654753600 -10800 1 -03} + {670474800 -14400 0 -04} + {686721600 -10800 1 -03} + {699418800 -14400 0 -04} + {718257600 -10800 1 -03} + {733546800 -14400 0 -04} + {749448000 -10800 1 -03} + {762318000 -14400 0 -04} + {780984000 -10800 1 -03} + {793767600 -14400 0 -04} + {812520000 -10800 1 -03} + {825649200 -14400 0 -04} + {844574400 -10800 1 -03} + {856666800 -14400 0 -04} + {876024000 -10800 1 -03} + {888721200 -14400 0 -04} + {907473600 -10800 1 -03} + {920775600 -14400 0 -04} + {938923200 -10800 1 -03} + {952225200 -14400 0 -04} + {970372800 -10800 1 -03} + {983674800 -14400 0 -04} + {1002427200 -10800 1 -03} + {1018148400 -14400 0 -04} + {1030852800 -10800 1 -03} + {1049598000 -14400 0 -04} + {1062907200 -10800 1 -03} + {1081047600 -14400 0 -04} + {1097985600 -10800 1 -03} + {1110682800 -14400 0 -04} + {1129435200 -10800 1 -03} + {1142132400 -14400 0 -04} + {1160884800 -10800 1 -03} + {1173582000 -14400 0 -04} + {1192939200 -10800 1 -03} + {1205031600 -14400 0 -04} + {1224388800 -10800 1 -03} + {1236481200 -14400 0 -04} + {1255838400 -10800 1 -03} + {1270954800 -14400 0 -04} + {1286078400 -10800 1 -03} + {1302404400 -14400 0 -04} + {1317528000 -10800 1 -03} + {1333854000 -14400 0 -04} + {1349582400 -10800 1 -03} + {1364094000 -14400 0 -04} + {1381032000 -10800 1 -03} + {1395543600 -14400 0 -04} + {1412481600 -10800 1 -03} + {1426993200 -14400 0 -04} + {1443931200 -10800 1 -03} + {1459047600 -14400 0 -04} + {1475380800 -10800 1 -03} + {1490497200 -14400 0 -04} + {1506830400 -10800 1 -03} + {1521946800 -14400 0 -04} + {1538884800 -10800 1 -03} + {1553396400 -14400 0 -04} + {1570334400 -10800 1 -03} + {1584846000 -14400 0 -04} + {1601784000 -10800 1 -03} + {1616900400 -14400 0 -04} + {1633233600 -10800 1 -03} + {1648350000 -14400 0 -04} + {1664683200 -10800 1 -03} + {1679799600 -14400 0 -04} + {1696132800 -10800 1 -03} + {1711249200 -14400 0 -04} + {1728187200 -10800 1 -03} + {1742698800 -14400 0 -04} + {1759636800 -10800 1 -03} + {1774148400 -14400 0 -04} + {1791086400 -10800 1 -03} + {1806202800 -14400 0 -04} + {1822536000 -10800 1 -03} + {1837652400 -14400 0 -04} + {1853985600 -10800 1 -03} + {1869102000 -14400 0 -04} + {1886040000 -10800 1 -03} + {1900551600 -14400 0 -04} + {1917489600 -10800 1 -03} + {1932001200 -14400 0 -04} + {1948939200 -10800 1 -03} + {1964055600 -14400 0 -04} + {1980388800 -10800 1 -03} + {1995505200 -14400 0 -04} + {2011838400 -10800 1 -03} + {2026954800 -14400 0 -04} + {2043288000 -10800 1 -03} + {2058404400 -14400 0 -04} + {2075342400 -10800 1 -03} + {2089854000 -14400 0 -04} + {2106792000 -10800 1 -03} + {2121303600 -14400 0 -04} + {2138241600 -10800 1 -03} + {2153358000 -14400 0 -04} + {2169691200 -10800 1 -03} + {2184807600 -14400 0 -04} + {2201140800 -10800 1 -03} + {2216257200 -14400 0 -04} + {2233195200 -10800 1 -03} + {2247706800 -14400 0 -04} + {2264644800 -10800 1 -03} + {2279156400 -14400 0 -04} + {2296094400 -10800 1 -03} + {2310606000 -14400 0 -04} + {2327544000 -10800 1 -03} + {2342660400 -14400 0 -04} + {2358993600 -10800 1 -03} + {2374110000 -14400 0 -04} + {2390443200 -10800 1 -03} + {2405559600 -14400 0 -04} + {2422497600 -10800 1 -03} + {2437009200 -14400 0 -04} + {2453947200 -10800 1 -03} + {2468458800 -14400 0 -04} + {2485396800 -10800 1 -03} + {2500513200 -14400 0 -04} + {2516846400 -10800 1 -03} + {2531962800 -14400 0 -04} + {2548296000 -10800 1 -03} + {2563412400 -14400 0 -04} + {2579745600 -10800 1 -03} + {2594862000 -14400 0 -04} + {2611800000 -10800 1 -03} + {2626311600 -14400 0 -04} + {2643249600 -10800 1 -03} + {2657761200 -14400 0 -04} + {2674699200 -10800 1 -03} + {2689815600 -14400 0 -04} + {2706148800 -10800 1 -03} + {2721265200 -14400 0 -04} + {2737598400 -10800 1 -03} + {2752714800 -14400 0 -04} + {2769652800 -10800 1 -03} + {2784164400 -14400 0 -04} + {2801102400 -10800 1 -03} + {2815614000 -14400 0 -04} + {2832552000 -10800 1 -03} + {2847668400 -14400 0 -04} + {2864001600 -10800 1 -03} + {2879118000 -14400 0 -04} + {2895451200 -10800 1 -03} + {2910567600 -14400 0 -04} + {2926900800 -10800 1 -03} + {2942017200 -14400 0 -04} + {2958955200 -10800 1 -03} + {2973466800 -14400 0 -04} + {2990404800 -10800 1 -03} + {3004916400 -14400 0 -04} + {3021854400 -10800 1 -03} + {3036970800 -14400 0 -04} + {3053304000 -10800 1 -03} + {3068420400 -14400 0 -04} + {3084753600 -10800 1 -03} + {3099870000 -14400 0 -04} + {3116808000 -10800 1 -03} + {3131319600 -14400 0 -04} + {3148257600 -10800 1 -03} + {3162769200 -14400 0 -04} + {3179707200 -10800 1 -03} + {3194218800 -14400 0 -04} + {3211156800 -10800 1 -03} + {3226273200 -14400 0 -04} + {3242606400 -10800 1 -03} + {3257722800 -14400 0 -04} + {3274056000 -10800 1 -03} + {3289172400 -14400 0 -04} + {3306110400 -10800 1 -03} + {3320622000 -14400 0 -04} + {3337560000 -10800 1 -03} + {3352071600 -14400 0 -04} + {3369009600 -10800 1 -03} + {3384126000 -14400 0 -04} + {3400459200 -10800 1 -03} + {3415575600 -14400 0 -04} + {3431908800 -10800 1 -03} + {3447025200 -14400 0 -04} + {3463358400 -10800 1 -03} + {3478474800 -14400 0 -04} + {3495412800 -10800 1 -03} + {3509924400 -14400 0 -04} + {3526862400 -10800 1 -03} + {3541374000 -14400 0 -04} + {3558312000 -10800 1 -03} + {3573428400 -14400 0 -04} + {3589761600 -10800 1 -03} + {3604878000 -14400 0 -04} + {3621211200 -10800 1 -03} + {3636327600 -14400 0 -04} + {3653265600 -10800 1 -03} + {3667777200 -14400 0 -04} + {3684715200 -10800 1 -03} + {3699226800 -14400 0 -04} + {3716164800 -10800 1 -03} + {3731281200 -14400 0 -04} + {3747614400 -10800 1 -03} + {3762730800 -14400 0 -04} + {3779064000 -10800 1 -03} + {3794180400 -14400 0 -04} + {3810513600 -10800 1 -03} + {3825630000 -14400 0 -04} + {3842568000 -10800 1 -03} + {3857079600 -14400 0 -04} + {3874017600 -10800 1 -03} + {3888529200 -14400 0 -04} + {3905467200 -10800 1 -03} + {3920583600 -14400 0 -04} + {3936916800 -10800 1 -03} + {3952033200 -14400 0 -04} + {3968366400 -10800 1 -03} + {3983482800 -14400 0 -04} + {4000420800 -10800 1 -03} + {4014932400 -14400 0 -04} + {4031870400 -10800 1 -03} + {4046382000 -14400 0 -04} + {4063320000 -10800 1 -03} + {4077831600 -14400 0 -04} + {4094769600 -10800 1 -03} } diff --git a/library/tzdata/America/Bahia b/library/tzdata/America/Bahia index ac67b71..7dbcb90 100644 --- a/library/tzdata/America/Bahia +++ b/library/tzdata/America/Bahia @@ -2,67 +2,67 @@ set TZData(:America/Bahia) { {-9223372036854775808 -9244 0 LMT} - {-1767216356 -10800 0 BRT} - {-1206957600 -7200 1 BRST} - {-1191362400 -10800 0 BRT} - {-1175374800 -7200 1 BRST} - {-1159826400 -10800 0 BRT} - {-633819600 -7200 1 BRST} - {-622069200 -10800 0 BRT} - {-602283600 -7200 1 BRST} - {-591832800 -10800 0 BRT} - {-570747600 -7200 1 BRST} - {-560210400 -10800 0 BRT} - {-539125200 -7200 1 BRST} - {-531352800 -10800 0 BRT} - {-191365200 -7200 1 BRST} - {-184197600 -10800 0 BRT} - {-155163600 -7200 1 BRST} - {-150069600 -10800 0 BRT} - {-128898000 -7200 1 BRST} - {-121125600 -10800 0 BRT} - {-99954000 -7200 1 BRST} - {-89589600 -10800 0 BRT} - {-68418000 -7200 1 BRST} - {-57967200 -10800 0 BRT} - {499748400 -7200 1 BRST} - {511236000 -10800 0 BRT} - {530593200 -7200 1 BRST} - {540266400 -10800 0 BRT} - {562129200 -7200 1 BRST} - {571197600 -10800 0 BRT} - {592974000 -7200 1 BRST} - {602042400 -10800 0 BRT} - {624423600 -7200 1 BRST} - {634701600 -10800 0 BRT} - {656478000 -7200 1 BRST} - {666756000 -10800 0 BRT} - {687927600 -7200 1 BRST} - {697600800 -10800 0 BRT} - {719982000 -7200 1 BRST} - {728445600 -10800 0 BRT} - {750826800 -7200 1 BRST} - {761709600 -10800 0 BRT} - {782276400 -7200 1 BRST} - {793159200 -10800 0 BRT} - {813726000 -7200 1 BRST} - {824004000 -10800 0 BRT} - {844570800 -7200 1 BRST} - {856058400 -10800 0 BRT} - {876106800 -7200 1 BRST} - {888717600 -10800 0 BRT} - {908074800 -7200 1 BRST} - {919562400 -10800 0 BRT} - {938919600 -7200 1 BRST} - {951616800 -10800 0 BRT} - {970974000 -7200 1 BRST} - {982461600 -10800 0 BRT} - {1003028400 -7200 1 BRST} - {1013911200 -10800 0 BRT} - {1036292400 -7200 1 BRST} - {1045360800 -10800 0 BRT} - {1064368800 -10800 0 BRT} - {1318734000 -7200 0 BRST} - {1330221600 -10800 0 BRT} - {1350784800 -10800 0 BRT} + {-1767216356 -10800 0 -03} + {-1206957600 -7200 1 -02} + {-1191362400 -10800 0 -03} + {-1175374800 -7200 1 -02} + {-1159826400 -10800 0 -03} + {-633819600 -7200 1 -02} + {-622069200 -10800 0 -03} + {-602283600 -7200 1 -02} + {-591832800 -10800 0 -03} + {-570747600 -7200 1 -02} + {-560210400 -10800 0 -03} + {-539125200 -7200 1 -02} + {-531352800 -10800 0 -03} + {-191365200 -7200 1 -02} + {-184197600 -10800 0 -03} + {-155163600 -7200 1 -02} + {-150069600 -10800 0 -03} + {-128898000 -7200 1 -02} + {-121125600 -10800 0 -03} + {-99954000 -7200 1 -02} + {-89589600 -10800 0 -03} + {-68418000 -7200 1 -02} + {-57967200 -10800 0 -03} + {499748400 -7200 1 -02} + {511236000 -10800 0 -03} + {530593200 -7200 1 -02} + {540266400 -10800 0 -03} + {562129200 -7200 1 -02} + {571197600 -10800 0 -03} + {592974000 -7200 1 -02} + {602042400 -10800 0 -03} + {624423600 -7200 1 -02} + {634701600 -10800 0 -03} + {656478000 -7200 1 -02} + {666756000 -10800 0 -03} + {687927600 -7200 1 -02} + {697600800 -10800 0 -03} + {719982000 -7200 1 -02} + {728445600 -10800 0 -03} + {750826800 -7200 1 -02} + {761709600 -10800 0 -03} + {782276400 -7200 1 -02} + {793159200 -10800 0 -03} + {813726000 -7200 1 -02} + {824004000 -10800 0 -03} + {844570800 -7200 1 -02} + {856058400 -10800 0 -03} + {876106800 -7200 1 -02} + {888717600 -10800 0 -03} + {908074800 -7200 1 -02} + {919562400 -10800 0 -03} + {938919600 -7200 1 -02} + {951616800 -10800 0 -03} + {970974000 -7200 1 -02} + {982461600 -10800 0 -03} + {1003028400 -7200 1 -02} + {1013911200 -10800 0 -03} + {1036292400 -7200 1 -02} + {1045360800 -10800 0 -03} + {1064368800 -10800 0 -03} + {1318734000 -7200 0 -02} + {1330221600 -10800 0 -03} + {1350784800 -10800 0 -03} } diff --git a/library/tzdata/America/Belem b/library/tzdata/America/Belem index ed92fd1..b2bf3a6 100644 --- a/library/tzdata/America/Belem +++ b/library/tzdata/America/Belem @@ -2,34 +2,34 @@ set TZData(:America/Belem) { {-9223372036854775808 -11636 0 LMT} - {-1767213964 -10800 0 BRT} - {-1206957600 -7200 1 BRST} - {-1191362400 -10800 0 BRT} - {-1175374800 -7200 1 BRST} - {-1159826400 -10800 0 BRT} - {-633819600 -7200 1 BRST} - {-622069200 -10800 0 BRT} - {-602283600 -7200 1 BRST} - {-591832800 -10800 0 BRT} - {-570747600 -7200 1 BRST} - {-560210400 -10800 0 BRT} - {-539125200 -7200 1 BRST} - {-531352800 -10800 0 BRT} - {-191365200 -7200 1 BRST} - {-184197600 -10800 0 BRT} - {-155163600 -7200 1 BRST} - {-150069600 -10800 0 BRT} - {-128898000 -7200 1 BRST} - {-121125600 -10800 0 BRT} - {-99954000 -7200 1 BRST} - {-89589600 -10800 0 BRT} - {-68418000 -7200 1 BRST} - {-57967200 -10800 0 BRT} - {499748400 -7200 1 BRST} - {511236000 -10800 0 BRT} - {530593200 -7200 1 BRST} - {540266400 -10800 0 BRT} - {562129200 -7200 1 BRST} - {571197600 -10800 0 BRT} - {590032800 -10800 0 BRT} + {-1767213964 -10800 0 -03} + {-1206957600 -7200 1 -02} + {-1191362400 -10800 0 -03} + {-1175374800 -7200 1 -02} + {-1159826400 -10800 0 -03} + {-633819600 -7200 1 -02} + {-622069200 -10800 0 -03} + {-602283600 -7200 1 -02} + {-591832800 -10800 0 -03} + {-570747600 -7200 1 -02} + {-560210400 -10800 0 -03} + {-539125200 -7200 1 -02} + {-531352800 -10800 0 -03} + {-191365200 -7200 1 -02} + {-184197600 -10800 0 -03} + {-155163600 -7200 1 -02} + {-150069600 -10800 0 -03} + {-128898000 -7200 1 -02} + {-121125600 -10800 0 -03} + {-99954000 -7200 1 -02} + {-89589600 -10800 0 -03} + {-68418000 -7200 1 -02} + {-57967200 -10800 0 -03} + {499748400 -7200 1 -02} + {511236000 -10800 0 -03} + {530593200 -7200 1 -02} + {540266400 -10800 0 -03} + {562129200 -7200 1 -02} + {571197600 -10800 0 -03} + {590032800 -10800 0 -03} } diff --git a/library/tzdata/America/Belize b/library/tzdata/America/Belize index 547fd72..5b46388 100644 --- a/library/tzdata/America/Belize +++ b/library/tzdata/America/Belize @@ -3,55 +3,55 @@ set TZData(:America/Belize) { {-9223372036854775808 -21168 0 LMT} {-1822500432 -21600 0 CST} - {-1616954400 -19800 1 CHDT} + {-1616954400 -19800 1 -0530} {-1606069800 -21600 0 CST} - {-1585504800 -19800 1 CHDT} + {-1585504800 -19800 1 -0530} {-1574015400 -21600 0 CST} - {-1554055200 -19800 1 CHDT} + {-1554055200 -19800 1 -0530} {-1542565800 -21600 0 CST} - {-1522605600 -19800 1 CHDT} + {-1522605600 -19800 1 -0530} {-1511116200 -21600 0 CST} - {-1490551200 -19800 1 CHDT} + {-1490551200 -19800 1 -0530} {-1479666600 -21600 0 CST} - {-1459101600 -19800 1 CHDT} + {-1459101600 -19800 1 -0530} {-1448217000 -21600 0 CST} - {-1427652000 -19800 1 CHDT} + {-1427652000 -19800 1 -0530} {-1416162600 -21600 0 CST} - {-1396202400 -19800 1 CHDT} + {-1396202400 -19800 1 -0530} {-1384713000 -21600 0 CST} - {-1364752800 -19800 1 CHDT} + {-1364752800 -19800 1 -0530} {-1353263400 -21600 0 CST} - {-1333303200 -19800 1 CHDT} + {-1333303200 -19800 1 -0530} {-1321813800 -21600 0 CST} - {-1301248800 -19800 1 CHDT} + {-1301248800 -19800 1 -0530} {-1290364200 -21600 0 CST} - {-1269799200 -19800 1 CHDT} + {-1269799200 -19800 1 -0530} {-1258914600 -21600 0 CST} - {-1238349600 -19800 1 CHDT} + {-1238349600 -19800 1 -0530} {-1226860200 -21600 0 CST} - {-1206900000 -19800 1 CHDT} + {-1206900000 -19800 1 -0530} {-1195410600 -21600 0 CST} - {-1175450400 -19800 1 CHDT} + {-1175450400 -19800 1 -0530} {-1163961000 -21600 0 CST} - {-1143396000 -19800 1 CHDT} + {-1143396000 -19800 1 -0530} {-1132511400 -21600 0 CST} - {-1111946400 -19800 1 CHDT} + {-1111946400 -19800 1 -0530} {-1101061800 -21600 0 CST} - {-1080496800 -19800 1 CHDT} + {-1080496800 -19800 1 -0530} {-1069612200 -21600 0 CST} - {-1049047200 -19800 1 CHDT} + {-1049047200 -19800 1 -0530} {-1037557800 -21600 0 CST} - {-1017597600 -19800 1 CHDT} + {-1017597600 -19800 1 -0530} {-1006108200 -21600 0 CST} - {-986148000 -19800 1 CHDT} + {-986148000 -19800 1 -0530} {-974658600 -21600 0 CST} - {-954093600 -19800 1 CHDT} + {-954093600 -19800 1 -0530} {-943209000 -21600 0 CST} - {-922644000 -19800 1 CHDT} + {-922644000 -19800 1 -0530} {-911759400 -21600 0 CST} - {-891194400 -19800 1 CHDT} + {-891194400 -19800 1 -0530} {-879705000 -21600 0 CST} - {-859744800 -19800 1 CHDT} + {-859744800 -19800 1 -0530} {-848255400 -21600 0 CST} {123919200 -18000 1 CDT} {129618000 -21600 0 CST} diff --git a/library/tzdata/America/Boa_Vista b/library/tzdata/America/Boa_Vista index c85bc27..982249b 100644 --- a/library/tzdata/America/Boa_Vista +++ b/library/tzdata/America/Boa_Vista @@ -2,39 +2,39 @@ set TZData(:America/Boa_Vista) { {-9223372036854775808 -14560 0 LMT} - {-1767211040 -14400 0 AMT} - {-1206954000 -10800 1 AMST} - {-1191358800 -14400 0 AMT} - {-1175371200 -10800 1 AMST} - {-1159822800 -14400 0 AMT} - {-633816000 -10800 1 AMST} - {-622065600 -14400 0 AMT} - {-602280000 -10800 1 AMST} - {-591829200 -14400 0 AMT} - {-570744000 -10800 1 AMST} - {-560206800 -14400 0 AMT} - {-539121600 -10800 1 AMST} - {-531349200 -14400 0 AMT} - {-191361600 -10800 1 AMST} - {-184194000 -14400 0 AMT} - {-155160000 -10800 1 AMST} - {-150066000 -14400 0 AMT} - {-128894400 -10800 1 AMST} - {-121122000 -14400 0 AMT} - {-99950400 -10800 1 AMST} - {-89586000 -14400 0 AMT} - {-68414400 -10800 1 AMST} - {-57963600 -14400 0 AMT} - {499752000 -10800 1 AMST} - {511239600 -14400 0 AMT} - {530596800 -10800 1 AMST} - {540270000 -14400 0 AMT} - {562132800 -10800 1 AMST} - {571201200 -14400 0 AMT} - {590036400 -14400 0 AMT} - {938664000 -14400 0 AMT} - {938923200 -10800 1 AMST} - {951620400 -14400 0 AMT} - {970977600 -10800 1 AMST} - {971578800 -14400 0 AMT} + {-1767211040 -14400 0 -04} + {-1206954000 -10800 1 -03} + {-1191358800 -14400 0 -04} + {-1175371200 -10800 1 -03} + {-1159822800 -14400 0 -04} + {-633816000 -10800 1 -03} + {-622065600 -14400 0 -04} + {-602280000 -10800 1 -03} + {-591829200 -14400 0 -04} + {-570744000 -10800 1 -03} + {-560206800 -14400 0 -04} + {-539121600 -10800 1 -03} + {-531349200 -14400 0 -04} + {-191361600 -10800 1 -03} + {-184194000 -14400 0 -04} + {-155160000 -10800 1 -03} + {-150066000 -14400 0 -04} + {-128894400 -10800 1 -03} + {-121122000 -14400 0 -04} + {-99950400 -10800 1 -03} + {-89586000 -14400 0 -04} + {-68414400 -10800 1 -03} + {-57963600 -14400 0 -04} + {499752000 -10800 1 -03} + {511239600 -14400 0 -04} + {530596800 -10800 1 -03} + {540270000 -14400 0 -04} + {562132800 -10800 1 -03} + {571201200 -14400 0 -04} + {590036400 -14400 0 -04} + {938664000 -14400 0 -04} + {938923200 -10800 1 -03} + {951620400 -14400 0 -04} + {970977600 -10800 1 -03} + {971578800 -14400 0 -04} } diff --git a/library/tzdata/America/Bogota b/library/tzdata/America/Bogota index b28abc1..69e4557 100644 --- a/library/tzdata/America/Bogota +++ b/library/tzdata/America/Bogota @@ -3,7 +3,7 @@ set TZData(:America/Bogota) { {-9223372036854775808 -17776 0 LMT} {-2707671824 -17776 0 BMT} - {-1739041424 -18000 0 COT} - {704869200 -14400 1 COST} - {733896000 -18000 0 COT} + {-1739041424 -18000 0 -05} + {704869200 -14400 1 -04} + {733896000 -18000 0 -05} } diff --git a/library/tzdata/America/Campo_Grande b/library/tzdata/America/Campo_Grande index 2cafe14..77cb4d1 100644 --- a/library/tzdata/America/Campo_Grande +++ b/library/tzdata/America/Campo_Grande @@ -2,256 +2,256 @@ set TZData(:America/Campo_Grande) { {-9223372036854775808 -13108 0 LMT} - {-1767212492 -14400 0 AMT} - {-1206954000 -10800 1 AMST} - {-1191358800 -14400 0 AMT} - {-1175371200 -10800 1 AMST} - {-1159822800 -14400 0 AMT} - {-633816000 -10800 1 AMST} - {-622065600 -14400 0 AMT} - {-602280000 -10800 1 AMST} - {-591829200 -14400 0 AMT} - {-570744000 -10800 1 AMST} - {-560206800 -14400 0 AMT} - {-539121600 -10800 1 AMST} - {-531349200 -14400 0 AMT} - {-191361600 -10800 1 AMST} - {-184194000 -14400 0 AMT} - {-155160000 -10800 1 AMST} - {-150066000 -14400 0 AMT} - {-128894400 -10800 1 AMST} - {-121122000 -14400 0 AMT} - {-99950400 -10800 1 AMST} - {-89586000 -14400 0 AMT} - {-68414400 -10800 1 AMST} - {-57963600 -14400 0 AMT} - {499752000 -10800 1 AMST} - {511239600 -14400 0 AMT} - {530596800 -10800 1 AMST} - {540270000 -14400 0 AMT} - {562132800 -10800 1 AMST} - {571201200 -14400 0 AMT} - {592977600 -10800 1 AMST} - {602046000 -14400 0 AMT} - {624427200 -10800 1 AMST} - {634705200 -14400 0 AMT} - {656481600 -10800 1 AMST} - {666759600 -14400 0 AMT} - {687931200 -10800 1 AMST} - {697604400 -14400 0 AMT} - {719985600 -10800 1 AMST} - {728449200 -14400 0 AMT} - {750830400 -10800 1 AMST} - {761713200 -14400 0 AMT} - {782280000 -10800 1 AMST} - {793162800 -14400 0 AMT} - {813729600 -10800 1 AMST} - {824007600 -14400 0 AMT} - {844574400 -10800 1 AMST} - {856062000 -14400 0 AMT} - {876110400 -10800 1 AMST} - {888721200 -14400 0 AMT} - {908078400 -10800 1 AMST} - {919566000 -14400 0 AMT} - {938923200 -10800 1 AMST} - {951620400 -14400 0 AMT} - {970977600 -10800 1 AMST} - {982465200 -14400 0 AMT} - {1003032000 -10800 1 AMST} - {1013914800 -14400 0 AMT} - {1036296000 -10800 1 AMST} - {1045364400 -14400 0 AMT} - {1066536000 -10800 1 AMST} - {1076814000 -14400 0 AMT} - {1099368000 -10800 1 AMST} - {1108868400 -14400 0 AMT} - {1129435200 -10800 1 AMST} - {1140318000 -14400 0 AMT} - {1162699200 -10800 1 AMST} - {1172372400 -14400 0 AMT} - {1192334400 -10800 1 AMST} - {1203217200 -14400 0 AMT} - {1224388800 -10800 1 AMST} - {1234666800 -14400 0 AMT} - {1255838400 -10800 1 AMST} - {1266721200 -14400 0 AMT} - {1287288000 -10800 1 AMST} - {1298170800 -14400 0 AMT} - {1318737600 -10800 1 AMST} - {1330225200 -14400 0 AMT} - {1350792000 -10800 1 AMST} - {1361070000 -14400 0 AMT} - {1382241600 -10800 1 AMST} - {1392519600 -14400 0 AMT} - {1413691200 -10800 1 AMST} - {1424574000 -14400 0 AMT} - {1445140800 -10800 1 AMST} - {1456023600 -14400 0 AMT} - {1476590400 -10800 1 AMST} - {1487473200 -14400 0 AMT} - {1508040000 -10800 1 AMST} - {1518922800 -14400 0 AMT} - {1540094400 -10800 1 AMST} - {1550372400 -14400 0 AMT} - {1571544000 -10800 1 AMST} - {1581822000 -14400 0 AMT} - {1602993600 -10800 1 AMST} - {1613876400 -14400 0 AMT} - {1634443200 -10800 1 AMST} - {1645326000 -14400 0 AMT} - {1665892800 -10800 1 AMST} - {1677380400 -14400 0 AMT} - {1697342400 -10800 1 AMST} - {1708225200 -14400 0 AMT} - {1729396800 -10800 1 AMST} - {1739674800 -14400 0 AMT} - {1760846400 -10800 1 AMST} - {1771729200 -14400 0 AMT} - {1792296000 -10800 1 AMST} - {1803178800 -14400 0 AMT} - {1823745600 -10800 1 AMST} - {1834628400 -14400 0 AMT} - {1855195200 -10800 1 AMST} - {1866078000 -14400 0 AMT} - {1887249600 -10800 1 AMST} - {1897527600 -14400 0 AMT} - {1918699200 -10800 1 AMST} - {1928977200 -14400 0 AMT} - {1950148800 -10800 1 AMST} - {1960426800 -14400 0 AMT} - {1981598400 -10800 1 AMST} - {1992481200 -14400 0 AMT} - {2013048000 -10800 1 AMST} - {2024535600 -14400 0 AMT} - {2044497600 -10800 1 AMST} - {2055380400 -14400 0 AMT} - {2076552000 -10800 1 AMST} - {2086830000 -14400 0 AMT} - {2108001600 -10800 1 AMST} - {2118884400 -14400 0 AMT} - {2139451200 -10800 1 AMST} - {2150334000 -14400 0 AMT} - {2170900800 -10800 1 AMST} - {2181783600 -14400 0 AMT} - {2202350400 -10800 1 AMST} - {2213233200 -14400 0 AMT} - {2234404800 -10800 1 AMST} - {2244682800 -14400 0 AMT} - {2265854400 -10800 1 AMST} - {2276132400 -14400 0 AMT} - {2297304000 -10800 1 AMST} - {2307582000 -14400 0 AMT} - {2328753600 -10800 1 AMST} - {2339636400 -14400 0 AMT} - {2360203200 -10800 1 AMST} - {2371086000 -14400 0 AMT} - {2391652800 -10800 1 AMST} - {2402535600 -14400 0 AMT} - {2423707200 -10800 1 AMST} - {2433985200 -14400 0 AMT} - {2455156800 -10800 1 AMST} - {2465434800 -14400 0 AMT} - {2486606400 -10800 1 AMST} - {2497489200 -14400 0 AMT} - {2518056000 -10800 1 AMST} - {2528938800 -14400 0 AMT} - {2549505600 -10800 1 AMST} - {2560388400 -14400 0 AMT} - {2580955200 -10800 1 AMST} - {2591838000 -14400 0 AMT} - {2613009600 -10800 1 AMST} - {2623287600 -14400 0 AMT} - {2644459200 -10800 1 AMST} - {2654737200 -14400 0 AMT} - {2675908800 -10800 1 AMST} - {2686791600 -14400 0 AMT} - {2707358400 -10800 1 AMST} - {2718241200 -14400 0 AMT} - {2738808000 -10800 1 AMST} - {2749690800 -14400 0 AMT} - {2770862400 -10800 1 AMST} - {2781140400 -14400 0 AMT} - {2802312000 -10800 1 AMST} - {2812590000 -14400 0 AMT} - {2833761600 -10800 1 AMST} - {2844039600 -14400 0 AMT} - {2865211200 -10800 1 AMST} - {2876094000 -14400 0 AMT} - {2896660800 -10800 1 AMST} - {2907543600 -14400 0 AMT} - {2928110400 -10800 1 AMST} - {2938993200 -14400 0 AMT} - {2960164800 -10800 1 AMST} - {2970442800 -14400 0 AMT} - {2991614400 -10800 1 AMST} - {3001892400 -14400 0 AMT} - {3023064000 -10800 1 AMST} - {3033946800 -14400 0 AMT} - {3054513600 -10800 1 AMST} - {3065396400 -14400 0 AMT} - {3085963200 -10800 1 AMST} - {3096846000 -14400 0 AMT} - {3118017600 -10800 1 AMST} - {3128295600 -14400 0 AMT} - {3149467200 -10800 1 AMST} - {3159745200 -14400 0 AMT} - {3180916800 -10800 1 AMST} - {3191194800 -14400 0 AMT} - {3212366400 -10800 1 AMST} - {3223249200 -14400 0 AMT} - {3243816000 -10800 1 AMST} - {3254698800 -14400 0 AMT} - {3275265600 -10800 1 AMST} - {3286148400 -14400 0 AMT} - {3307320000 -10800 1 AMST} - {3317598000 -14400 0 AMT} - {3338769600 -10800 1 AMST} - {3349047600 -14400 0 AMT} - {3370219200 -10800 1 AMST} - {3381102000 -14400 0 AMT} - {3401668800 -10800 1 AMST} - {3412551600 -14400 0 AMT} - {3433118400 -10800 1 AMST} - {3444001200 -14400 0 AMT} - {3464568000 -10800 1 AMST} - {3475450800 -14400 0 AMT} - {3496622400 -10800 1 AMST} - {3506900400 -14400 0 AMT} - {3528072000 -10800 1 AMST} - {3538350000 -14400 0 AMT} - {3559521600 -10800 1 AMST} - {3570404400 -14400 0 AMT} - {3590971200 -10800 1 AMST} - {3601854000 -14400 0 AMT} - {3622420800 -10800 1 AMST} - {3633303600 -14400 0 AMT} - {3654475200 -10800 1 AMST} - {3664753200 -14400 0 AMT} - {3685924800 -10800 1 AMST} - {3696202800 -14400 0 AMT} - {3717374400 -10800 1 AMST} - {3727652400 -14400 0 AMT} - {3748824000 -10800 1 AMST} - {3759706800 -14400 0 AMT} - {3780273600 -10800 1 AMST} - {3791156400 -14400 0 AMT} - {3811723200 -10800 1 AMST} - {3822606000 -14400 0 AMT} - {3843777600 -10800 1 AMST} - {3854055600 -14400 0 AMT} - {3875227200 -10800 1 AMST} - {3885505200 -14400 0 AMT} - {3906676800 -10800 1 AMST} - {3917559600 -14400 0 AMT} - {3938126400 -10800 1 AMST} - {3949009200 -14400 0 AMT} - {3969576000 -10800 1 AMST} - {3980458800 -14400 0 AMT} - {4001630400 -10800 1 AMST} - {4011908400 -14400 0 AMT} - {4033080000 -10800 1 AMST} - {4043358000 -14400 0 AMT} - {4064529600 -10800 1 AMST} - {4074807600 -14400 0 AMT} - {4095979200 -10800 1 AMST} + {-1767212492 -14400 0 -04} + {-1206954000 -10800 1 -03} + {-1191358800 -14400 0 -04} + {-1175371200 -10800 1 -03} + {-1159822800 -14400 0 -04} + {-633816000 -10800 1 -03} + {-622065600 -14400 0 -04} + {-602280000 -10800 1 -03} + {-591829200 -14400 0 -04} + {-570744000 -10800 1 -03} + {-560206800 -14400 0 -04} + {-539121600 -10800 1 -03} + {-531349200 -14400 0 -04} + {-191361600 -10800 1 -03} + {-184194000 -14400 0 -04} + {-155160000 -10800 1 -03} + {-150066000 -14400 0 -04} + {-128894400 -10800 1 -03} + {-121122000 -14400 0 -04} + {-99950400 -10800 1 -03} + {-89586000 -14400 0 -04} + {-68414400 -10800 1 -03} + {-57963600 -14400 0 -04} + {499752000 -10800 1 -03} + {511239600 -14400 0 -04} + {530596800 -10800 1 -03} + {540270000 -14400 0 -04} + {562132800 -10800 1 -03} + {571201200 -14400 0 -04} + {592977600 -10800 1 -03} + {602046000 -14400 0 -04} + {624427200 -10800 1 -03} + {634705200 -14400 0 -04} + {656481600 -10800 1 -03} + {666759600 -14400 0 -04} + {687931200 -10800 1 -03} + {697604400 -14400 0 -04} + {719985600 -10800 1 -03} + {728449200 -14400 0 -04} + {750830400 -10800 1 -03} + {761713200 -14400 0 -04} + {782280000 -10800 1 -03} + {793162800 -14400 0 -04} + {813729600 -10800 1 -03} + {824007600 -14400 0 -04} + {844574400 -10800 1 -03} + {856062000 -14400 0 -04} + {876110400 -10800 1 -03} + {888721200 -14400 0 -04} + {908078400 -10800 1 -03} + {919566000 -14400 0 -04} + {938923200 -10800 1 -03} + {951620400 -14400 0 -04} + {970977600 -10800 1 -03} + {982465200 -14400 0 -04} + {1003032000 -10800 1 -03} + {1013914800 -14400 0 -04} + {1036296000 -10800 1 -03} + {1045364400 -14400 0 -04} + {1066536000 -10800 1 -03} + {1076814000 -14400 0 -04} + {1099368000 -10800 1 -03} + {1108868400 -14400 0 -04} + {1129435200 -10800 1 -03} + {1140318000 -14400 0 -04} + {1162699200 -10800 1 -03} + {1172372400 -14400 0 -04} + {1192334400 -10800 1 -03} + {1203217200 -14400 0 -04} + {1224388800 -10800 1 -03} + {1234666800 -14400 0 -04} + {1255838400 -10800 1 -03} + {1266721200 -14400 0 -04} + {1287288000 -10800 1 -03} + {1298170800 -14400 0 -04} + {1318737600 -10800 1 -03} + {1330225200 -14400 0 -04} + {1350792000 -10800 1 -03} + {1361070000 -14400 0 -04} + {1382241600 -10800 1 -03} + {1392519600 -14400 0 -04} + {1413691200 -10800 1 -03} + {1424574000 -14400 0 -04} + {1445140800 -10800 1 -03} + {1456023600 -14400 0 -04} + {1476590400 -10800 1 -03} + {1487473200 -14400 0 -04} + {1508040000 -10800 1 -03} + {1518922800 -14400 0 -04} + {1540094400 -10800 1 -03} + {1550372400 -14400 0 -04} + {1571544000 -10800 1 -03} + {1581822000 -14400 0 -04} + {1602993600 -10800 1 -03} + {1613876400 -14400 0 -04} + {1634443200 -10800 1 -03} + {1645326000 -14400 0 -04} + {1665892800 -10800 1 -03} + {1677380400 -14400 0 -04} + {1697342400 -10800 1 -03} + {1708225200 -14400 0 -04} + {1729396800 -10800 1 -03} + {1739674800 -14400 0 -04} + {1760846400 -10800 1 -03} + {1771729200 -14400 0 -04} + {1792296000 -10800 1 -03} + {1803178800 -14400 0 -04} + {1823745600 -10800 1 -03} + {1834628400 -14400 0 -04} + {1855195200 -10800 1 -03} + {1866078000 -14400 0 -04} + {1887249600 -10800 1 -03} + {1897527600 -14400 0 -04} + {1918699200 -10800 1 -03} + {1928977200 -14400 0 -04} + {1950148800 -10800 1 -03} + {1960426800 -14400 0 -04} + {1981598400 -10800 1 -03} + {1992481200 -14400 0 -04} + {2013048000 -10800 1 -03} + {2024535600 -14400 0 -04} + {2044497600 -10800 1 -03} + {2055380400 -14400 0 -04} + {2076552000 -10800 1 -03} + {2086830000 -14400 0 -04} + {2108001600 -10800 1 -03} + {2118884400 -14400 0 -04} + {2139451200 -10800 1 -03} + {2150334000 -14400 0 -04} + {2170900800 -10800 1 -03} + {2181783600 -14400 0 -04} + {2202350400 -10800 1 -03} + {2213233200 -14400 0 -04} + {2234404800 -10800 1 -03} + {2244682800 -14400 0 -04} + {2265854400 -10800 1 -03} + {2276132400 -14400 0 -04} + {2297304000 -10800 1 -03} + {2307582000 -14400 0 -04} + {2328753600 -10800 1 -03} + {2339636400 -14400 0 -04} + {2360203200 -10800 1 -03} + {2371086000 -14400 0 -04} + {2391652800 -10800 1 -03} + {2402535600 -14400 0 -04} + {2423707200 -10800 1 -03} + {2433985200 -14400 0 -04} + {2455156800 -10800 1 -03} + {2465434800 -14400 0 -04} + {2486606400 -10800 1 -03} + {2497489200 -14400 0 -04} + {2518056000 -10800 1 -03} + {2528938800 -14400 0 -04} + {2549505600 -10800 1 -03} + {2560388400 -14400 0 -04} + {2580955200 -10800 1 -03} + {2591838000 -14400 0 -04} + {2613009600 -10800 1 -03} + {2623287600 -14400 0 -04} + {2644459200 -10800 1 -03} + {2654737200 -14400 0 -04} + {2675908800 -10800 1 -03} + {2686791600 -14400 0 -04} + {2707358400 -10800 1 -03} + {2718241200 -14400 0 -04} + {2738808000 -10800 1 -03} + {2749690800 -14400 0 -04} + {2770862400 -10800 1 -03} + {2781140400 -14400 0 -04} + {2802312000 -10800 1 -03} + {2812590000 -14400 0 -04} + {2833761600 -10800 1 -03} + {2844039600 -14400 0 -04} + {2865211200 -10800 1 -03} + {2876094000 -14400 0 -04} + {2896660800 -10800 1 -03} + {2907543600 -14400 0 -04} + {2928110400 -10800 1 -03} + {2938993200 -14400 0 -04} + {2960164800 -10800 1 -03} + {2970442800 -14400 0 -04} + {2991614400 -10800 1 -03} + {3001892400 -14400 0 -04} + {3023064000 -10800 1 -03} + {3033946800 -14400 0 -04} + {3054513600 -10800 1 -03} + {3065396400 -14400 0 -04} + {3085963200 -10800 1 -03} + {3096846000 -14400 0 -04} + {3118017600 -10800 1 -03} + {3128295600 -14400 0 -04} + {3149467200 -10800 1 -03} + {3159745200 -14400 0 -04} + {3180916800 -10800 1 -03} + {3191194800 -14400 0 -04} + {3212366400 -10800 1 -03} + {3223249200 -14400 0 -04} + {3243816000 -10800 1 -03} + {3254698800 -14400 0 -04} + {3275265600 -10800 1 -03} + {3286148400 -14400 0 -04} + {3307320000 -10800 1 -03} + {3317598000 -14400 0 -04} + {3338769600 -10800 1 -03} + {3349047600 -14400 0 -04} + {3370219200 -10800 1 -03} + {3381102000 -14400 0 -04} + {3401668800 -10800 1 -03} + {3412551600 -14400 0 -04} + {3433118400 -10800 1 -03} + {3444001200 -14400 0 -04} + {3464568000 -10800 1 -03} + {3475450800 -14400 0 -04} + {3496622400 -10800 1 -03} + {3506900400 -14400 0 -04} + {3528072000 -10800 1 -03} + {3538350000 -14400 0 -04} + {3559521600 -10800 1 -03} + {3570404400 -14400 0 -04} + {3590971200 -10800 1 -03} + {3601854000 -14400 0 -04} + {3622420800 -10800 1 -03} + {3633303600 -14400 0 -04} + {3654475200 -10800 1 -03} + {3664753200 -14400 0 -04} + {3685924800 -10800 1 -03} + {3696202800 -14400 0 -04} + {3717374400 -10800 1 -03} + {3727652400 -14400 0 -04} + {3748824000 -10800 1 -03} + {3759706800 -14400 0 -04} + {3780273600 -10800 1 -03} + {3791156400 -14400 0 -04} + {3811723200 -10800 1 -03} + {3822606000 -14400 0 -04} + {3843777600 -10800 1 -03} + {3854055600 -14400 0 -04} + {3875227200 -10800 1 -03} + {3885505200 -14400 0 -04} + {3906676800 -10800 1 -03} + {3917559600 -14400 0 -04} + {3938126400 -10800 1 -03} + {3949009200 -14400 0 -04} + {3969576000 -10800 1 -03} + {3980458800 -14400 0 -04} + {4001630400 -10800 1 -03} + {4011908400 -14400 0 -04} + {4033080000 -10800 1 -03} + {4043358000 -14400 0 -04} + {4064529600 -10800 1 -03} + {4074807600 -14400 0 -04} + {4095979200 -10800 1 -03} } diff --git a/library/tzdata/America/Caracas b/library/tzdata/America/Caracas index 253c4ce..f0dbffe 100644 --- a/library/tzdata/America/Caracas +++ b/library/tzdata/America/Caracas @@ -3,8 +3,8 @@ set TZData(:America/Caracas) { {-9223372036854775808 -16064 0 LMT} {-2524505536 -16060 0 CMT} - {-1826739140 -16200 0 VET} - {-157750200 -14400 0 VET} - {1197183600 -16200 0 VET} - {1462086000 -14400 0 VET} + {-1826739140 -16200 0 -0430} + {-157750200 -14400 0 -04} + {1197183600 -16200 0 -0430} + {1462086000 -14400 0 -04} } diff --git a/library/tzdata/America/Cayenne b/library/tzdata/America/Cayenne index de3d65b..6b1a3e9 100644 --- a/library/tzdata/America/Cayenne +++ b/library/tzdata/America/Cayenne @@ -2,6 +2,6 @@ set TZData(:America/Cayenne) { {-9223372036854775808 -12560 0 LMT} - {-1846269040 -14400 0 GFT} - {-71092800 -10800 0 GFT} + {-1846269040 -14400 0 -04} + {-71092800 -10800 0 -03} } diff --git a/library/tzdata/America/Cuiaba b/library/tzdata/America/Cuiaba index 0301862..57cd38c 100644 --- a/library/tzdata/America/Cuiaba +++ b/library/tzdata/America/Cuiaba @@ -2,256 +2,256 @@ set TZData(:America/Cuiaba) { {-9223372036854775808 -13460 0 LMT} - {-1767212140 -14400 0 AMT} - {-1206954000 -10800 1 AMST} - {-1191358800 -14400 0 AMT} - {-1175371200 -10800 1 AMST} - {-1159822800 -14400 0 AMT} - {-633816000 -10800 1 AMST} - {-622065600 -14400 0 AMT} - {-602280000 -10800 1 AMST} - {-591829200 -14400 0 AMT} - {-570744000 -10800 1 AMST} - {-560206800 -14400 0 AMT} - {-539121600 -10800 1 AMST} - {-531349200 -14400 0 AMT} - {-191361600 -10800 1 AMST} - {-184194000 -14400 0 AMT} - {-155160000 -10800 1 AMST} - {-150066000 -14400 0 AMT} - {-128894400 -10800 1 AMST} - {-121122000 -14400 0 AMT} - {-99950400 -10800 1 AMST} - {-89586000 -14400 0 AMT} - {-68414400 -10800 1 AMST} - {-57963600 -14400 0 AMT} - {499752000 -10800 1 AMST} - {511239600 -14400 0 AMT} - {530596800 -10800 1 AMST} - {540270000 -14400 0 AMT} - {562132800 -10800 1 AMST} - {571201200 -14400 0 AMT} - {592977600 -10800 1 AMST} - {602046000 -14400 0 AMT} - {624427200 -10800 1 AMST} - {634705200 -14400 0 AMT} - {656481600 -10800 1 AMST} - {666759600 -14400 0 AMT} - {687931200 -10800 1 AMST} - {697604400 -14400 0 AMT} - {719985600 -10800 1 AMST} - {728449200 -14400 0 AMT} - {750830400 -10800 1 AMST} - {761713200 -14400 0 AMT} - {782280000 -10800 1 AMST} - {793162800 -14400 0 AMT} - {813729600 -10800 1 AMST} - {824007600 -14400 0 AMT} - {844574400 -10800 1 AMST} - {856062000 -14400 0 AMT} - {876110400 -10800 1 AMST} - {888721200 -14400 0 AMT} - {908078400 -10800 1 AMST} - {919566000 -14400 0 AMT} - {938923200 -10800 1 AMST} - {951620400 -14400 0 AMT} - {970977600 -10800 1 AMST} - {982465200 -14400 0 AMT} - {1003032000 -10800 1 AMST} - {1013914800 -14400 0 AMT} - {1036296000 -10800 1 AMST} - {1045364400 -14400 0 AMT} - {1064372400 -14400 0 AMT} - {1096603200 -14400 0 AMT} - {1099368000 -10800 1 AMST} - {1108868400 -14400 0 AMT} - {1129435200 -10800 1 AMST} - {1140318000 -14400 0 AMT} - {1162699200 -10800 1 AMST} - {1172372400 -14400 0 AMT} - {1192334400 -10800 1 AMST} - {1203217200 -14400 0 AMT} - {1224388800 -10800 1 AMST} - {1234666800 -14400 0 AMT} - {1255838400 -10800 1 AMST} - {1266721200 -14400 0 AMT} - {1287288000 -10800 1 AMST} - {1298170800 -14400 0 AMT} - {1318737600 -10800 1 AMST} - {1330225200 -14400 0 AMT} - {1350792000 -10800 1 AMST} - {1361070000 -14400 0 AMT} - {1382241600 -10800 1 AMST} - {1392519600 -14400 0 AMT} - {1413691200 -10800 1 AMST} - {1424574000 -14400 0 AMT} - {1445140800 -10800 1 AMST} - {1456023600 -14400 0 AMT} - {1476590400 -10800 1 AMST} - {1487473200 -14400 0 AMT} - {1508040000 -10800 1 AMST} - {1518922800 -14400 0 AMT} - {1540094400 -10800 1 AMST} - {1550372400 -14400 0 AMT} - {1571544000 -10800 1 AMST} - {1581822000 -14400 0 AMT} - {1602993600 -10800 1 AMST} - {1613876400 -14400 0 AMT} - {1634443200 -10800 1 AMST} - {1645326000 -14400 0 AMT} - {1665892800 -10800 1 AMST} - {1677380400 -14400 0 AMT} - {1697342400 -10800 1 AMST} - {1708225200 -14400 0 AMT} - {1729396800 -10800 1 AMST} - {1739674800 -14400 0 AMT} - {1760846400 -10800 1 AMST} - {1771729200 -14400 0 AMT} - {1792296000 -10800 1 AMST} - {1803178800 -14400 0 AMT} - {1823745600 -10800 1 AMST} - {1834628400 -14400 0 AMT} - {1855195200 -10800 1 AMST} - {1866078000 -14400 0 AMT} - {1887249600 -10800 1 AMST} - {1897527600 -14400 0 AMT} - {1918699200 -10800 1 AMST} - {1928977200 -14400 0 AMT} - {1950148800 -10800 1 AMST} - {1960426800 -14400 0 AMT} - {1981598400 -10800 1 AMST} - {1992481200 -14400 0 AMT} - {2013048000 -10800 1 AMST} - {2024535600 -14400 0 AMT} - {2044497600 -10800 1 AMST} - {2055380400 -14400 0 AMT} - {2076552000 -10800 1 AMST} - {2086830000 -14400 0 AMT} - {2108001600 -10800 1 AMST} - {2118884400 -14400 0 AMT} - {2139451200 -10800 1 AMST} - {2150334000 -14400 0 AMT} - {2170900800 -10800 1 AMST} - {2181783600 -14400 0 AMT} - {2202350400 -10800 1 AMST} - {2213233200 -14400 0 AMT} - {2234404800 -10800 1 AMST} - {2244682800 -14400 0 AMT} - {2265854400 -10800 1 AMST} - {2276132400 -14400 0 AMT} - {2297304000 -10800 1 AMST} - {2307582000 -14400 0 AMT} - {2328753600 -10800 1 AMST} - {2339636400 -14400 0 AMT} - {2360203200 -10800 1 AMST} - {2371086000 -14400 0 AMT} - {2391652800 -10800 1 AMST} - {2402535600 -14400 0 AMT} - {2423707200 -10800 1 AMST} - {2433985200 -14400 0 AMT} - {2455156800 -10800 1 AMST} - {2465434800 -14400 0 AMT} - {2486606400 -10800 1 AMST} - {2497489200 -14400 0 AMT} - {2518056000 -10800 1 AMST} - {2528938800 -14400 0 AMT} - {2549505600 -10800 1 AMST} - {2560388400 -14400 0 AMT} - {2580955200 -10800 1 AMST} - {2591838000 -14400 0 AMT} - {2613009600 -10800 1 AMST} - {2623287600 -14400 0 AMT} - {2644459200 -10800 1 AMST} - {2654737200 -14400 0 AMT} - {2675908800 -10800 1 AMST} - {2686791600 -14400 0 AMT} - {2707358400 -10800 1 AMST} - {2718241200 -14400 0 AMT} - {2738808000 -10800 1 AMST} - {2749690800 -14400 0 AMT} - {2770862400 -10800 1 AMST} - {2781140400 -14400 0 AMT} - {2802312000 -10800 1 AMST} - {2812590000 -14400 0 AMT} - {2833761600 -10800 1 AMST} - {2844039600 -14400 0 AMT} - {2865211200 -10800 1 AMST} - {2876094000 -14400 0 AMT} - {2896660800 -10800 1 AMST} - {2907543600 -14400 0 AMT} - {2928110400 -10800 1 AMST} - {2938993200 -14400 0 AMT} - {2960164800 -10800 1 AMST} - {2970442800 -14400 0 AMT} - {2991614400 -10800 1 AMST} - {3001892400 -14400 0 AMT} - {3023064000 -10800 1 AMST} - {3033946800 -14400 0 AMT} - {3054513600 -10800 1 AMST} - {3065396400 -14400 0 AMT} - {3085963200 -10800 1 AMST} - {3096846000 -14400 0 AMT} - {3118017600 -10800 1 AMST} - {3128295600 -14400 0 AMT} - {3149467200 -10800 1 AMST} - {3159745200 -14400 0 AMT} - {3180916800 -10800 1 AMST} - {3191194800 -14400 0 AMT} - {3212366400 -10800 1 AMST} - {3223249200 -14400 0 AMT} - {3243816000 -10800 1 AMST} - {3254698800 -14400 0 AMT} - {3275265600 -10800 1 AMST} - {3286148400 -14400 0 AMT} - {3307320000 -10800 1 AMST} - {3317598000 -14400 0 AMT} - {3338769600 -10800 1 AMST} - {3349047600 -14400 0 AMT} - {3370219200 -10800 1 AMST} - {3381102000 -14400 0 AMT} - {3401668800 -10800 1 AMST} - {3412551600 -14400 0 AMT} - {3433118400 -10800 1 AMST} - {3444001200 -14400 0 AMT} - {3464568000 -10800 1 AMST} - {3475450800 -14400 0 AMT} - {3496622400 -10800 1 AMST} - {3506900400 -14400 0 AMT} - {3528072000 -10800 1 AMST} - {3538350000 -14400 0 AMT} - {3559521600 -10800 1 AMST} - {3570404400 -14400 0 AMT} - {3590971200 -10800 1 AMST} - {3601854000 -14400 0 AMT} - {3622420800 -10800 1 AMST} - {3633303600 -14400 0 AMT} - {3654475200 -10800 1 AMST} - {3664753200 -14400 0 AMT} - {3685924800 -10800 1 AMST} - {3696202800 -14400 0 AMT} - {3717374400 -10800 1 AMST} - {3727652400 -14400 0 AMT} - {3748824000 -10800 1 AMST} - {3759706800 -14400 0 AMT} - {3780273600 -10800 1 AMST} - {3791156400 -14400 0 AMT} - {3811723200 -10800 1 AMST} - {3822606000 -14400 0 AMT} - {3843777600 -10800 1 AMST} - {3854055600 -14400 0 AMT} - {3875227200 -10800 1 AMST} - {3885505200 -14400 0 AMT} - {3906676800 -10800 1 AMST} - {3917559600 -14400 0 AMT} - {3938126400 -10800 1 AMST} - {3949009200 -14400 0 AMT} - {3969576000 -10800 1 AMST} - {3980458800 -14400 0 AMT} - {4001630400 -10800 1 AMST} - {4011908400 -14400 0 AMT} - {4033080000 -10800 1 AMST} - {4043358000 -14400 0 AMT} - {4064529600 -10800 1 AMST} - {4074807600 -14400 0 AMT} - {4095979200 -10800 1 AMST} + {-1767212140 -14400 0 -04} + {-1206954000 -10800 1 -03} + {-1191358800 -14400 0 -04} + {-1175371200 -10800 1 -03} + {-1159822800 -14400 0 -04} + {-633816000 -10800 1 -03} + {-622065600 -14400 0 -04} + {-602280000 -10800 1 -03} + {-591829200 -14400 0 -04} + {-570744000 -10800 1 -03} + {-560206800 -14400 0 -04} + {-539121600 -10800 1 -03} + {-531349200 -14400 0 -04} + {-191361600 -10800 1 -03} + {-184194000 -14400 0 -04} + {-155160000 -10800 1 -03} + {-150066000 -14400 0 -04} + {-128894400 -10800 1 -03} + {-121122000 -14400 0 -04} + {-99950400 -10800 1 -03} + {-89586000 -14400 0 -04} + {-68414400 -10800 1 -03} + {-57963600 -14400 0 -04} + {499752000 -10800 1 -03} + {511239600 -14400 0 -04} + {530596800 -10800 1 -03} + {540270000 -14400 0 -04} + {562132800 -10800 1 -03} + {571201200 -14400 0 -04} + {592977600 -10800 1 -03} + {602046000 -14400 0 -04} + {624427200 -10800 1 -03} + {634705200 -14400 0 -04} + {656481600 -10800 1 -03} + {666759600 -14400 0 -04} + {687931200 -10800 1 -03} + {697604400 -14400 0 -04} + {719985600 -10800 1 -03} + {728449200 -14400 0 -04} + {750830400 -10800 1 -03} + {761713200 -14400 0 -04} + {782280000 -10800 1 -03} + {793162800 -14400 0 -04} + {813729600 -10800 1 -03} + {824007600 -14400 0 -04} + {844574400 -10800 1 -03} + {856062000 -14400 0 -04} + {876110400 -10800 1 -03} + {888721200 -14400 0 -04} + {908078400 -10800 1 -03} + {919566000 -14400 0 -04} + {938923200 -10800 1 -03} + {951620400 -14400 0 -04} + {970977600 -10800 1 -03} + {982465200 -14400 0 -04} + {1003032000 -10800 1 -03} + {1013914800 -14400 0 -04} + {1036296000 -10800 1 -03} + {1045364400 -14400 0 -04} + {1064372400 -14400 0 -04} + {1096603200 -14400 0 -04} + {1099368000 -10800 1 -03} + {1108868400 -14400 0 -04} + {1129435200 -10800 1 -03} + {1140318000 -14400 0 -04} + {1162699200 -10800 1 -03} + {1172372400 -14400 0 -04} + {1192334400 -10800 1 -03} + {1203217200 -14400 0 -04} + {1224388800 -10800 1 -03} + {1234666800 -14400 0 -04} + {1255838400 -10800 1 -03} + {1266721200 -14400 0 -04} + {1287288000 -10800 1 -03} + {1298170800 -14400 0 -04} + {1318737600 -10800 1 -03} + {1330225200 -14400 0 -04} + {1350792000 -10800 1 -03} + {1361070000 -14400 0 -04} + {1382241600 -10800 1 -03} + {1392519600 -14400 0 -04} + {1413691200 -10800 1 -03} + {1424574000 -14400 0 -04} + {1445140800 -10800 1 -03} + {1456023600 -14400 0 -04} + {1476590400 -10800 1 -03} + {1487473200 -14400 0 -04} + {1508040000 -10800 1 -03} + {1518922800 -14400 0 -04} + {1540094400 -10800 1 -03} + {1550372400 -14400 0 -04} + {1571544000 -10800 1 -03} + {1581822000 -14400 0 -04} + {1602993600 -10800 1 -03} + {1613876400 -14400 0 -04} + {1634443200 -10800 1 -03} + {1645326000 -14400 0 -04} + {1665892800 -10800 1 -03} + {1677380400 -14400 0 -04} + {1697342400 -10800 1 -03} + {1708225200 -14400 0 -04} + {1729396800 -10800 1 -03} + {1739674800 -14400 0 -04} + {1760846400 -10800 1 -03} + {1771729200 -14400 0 -04} + {1792296000 -10800 1 -03} + {1803178800 -14400 0 -04} + {1823745600 -10800 1 -03} + {1834628400 -14400 0 -04} + {1855195200 -10800 1 -03} + {1866078000 -14400 0 -04} + {1887249600 -10800 1 -03} + {1897527600 -14400 0 -04} + {1918699200 -10800 1 -03} + {1928977200 -14400 0 -04} + {1950148800 -10800 1 -03} + {1960426800 -14400 0 -04} + {1981598400 -10800 1 -03} + {1992481200 -14400 0 -04} + {2013048000 -10800 1 -03} + {2024535600 -14400 0 -04} + {2044497600 -10800 1 -03} + {2055380400 -14400 0 -04} + {2076552000 -10800 1 -03} + {2086830000 -14400 0 -04} + {2108001600 -10800 1 -03} + {2118884400 -14400 0 -04} + {2139451200 -10800 1 -03} + {2150334000 -14400 0 -04} + {2170900800 -10800 1 -03} + {2181783600 -14400 0 -04} + {2202350400 -10800 1 -03} + {2213233200 -14400 0 -04} + {2234404800 -10800 1 -03} + {2244682800 -14400 0 -04} + {2265854400 -10800 1 -03} + {2276132400 -14400 0 -04} + {2297304000 -10800 1 -03} + {2307582000 -14400 0 -04} + {2328753600 -10800 1 -03} + {2339636400 -14400 0 -04} + {2360203200 -10800 1 -03} + {2371086000 -14400 0 -04} + {2391652800 -10800 1 -03} + {2402535600 -14400 0 -04} + {2423707200 -10800 1 -03} + {2433985200 -14400 0 -04} + {2455156800 -10800 1 -03} + {2465434800 -14400 0 -04} + {2486606400 -10800 1 -03} + {2497489200 -14400 0 -04} + {2518056000 -10800 1 -03} + {2528938800 -14400 0 -04} + {2549505600 -10800 1 -03} + {2560388400 -14400 0 -04} + {2580955200 -10800 1 -03} + {2591838000 -14400 0 -04} + {2613009600 -10800 1 -03} + {2623287600 -14400 0 -04} + {2644459200 -10800 1 -03} + {2654737200 -14400 0 -04} + {2675908800 -10800 1 -03} + {2686791600 -14400 0 -04} + {2707358400 -10800 1 -03} + {2718241200 -14400 0 -04} + {2738808000 -10800 1 -03} + {2749690800 -14400 0 -04} + {2770862400 -10800 1 -03} + {2781140400 -14400 0 -04} + {2802312000 -10800 1 -03} + {2812590000 -14400 0 -04} + {2833761600 -10800 1 -03} + {2844039600 -14400 0 -04} + {2865211200 -10800 1 -03} + {2876094000 -14400 0 -04} + {2896660800 -10800 1 -03} + {2907543600 -14400 0 -04} + {2928110400 -10800 1 -03} + {2938993200 -14400 0 -04} + {2960164800 -10800 1 -03} + {2970442800 -14400 0 -04} + {2991614400 -10800 1 -03} + {3001892400 -14400 0 -04} + {3023064000 -10800 1 -03} + {3033946800 -14400 0 -04} + {3054513600 -10800 1 -03} + {3065396400 -14400 0 -04} + {3085963200 -10800 1 -03} + {3096846000 -14400 0 -04} + {3118017600 -10800 1 -03} + {3128295600 -14400 0 -04} + {3149467200 -10800 1 -03} + {3159745200 -14400 0 -04} + {3180916800 -10800 1 -03} + {3191194800 -14400 0 -04} + {3212366400 -10800 1 -03} + {3223249200 -14400 0 -04} + {3243816000 -10800 1 -03} + {3254698800 -14400 0 -04} + {3275265600 -10800 1 -03} + {3286148400 -14400 0 -04} + {3307320000 -10800 1 -03} + {3317598000 -14400 0 -04} + {3338769600 -10800 1 -03} + {3349047600 -14400 0 -04} + {3370219200 -10800 1 -03} + {3381102000 -14400 0 -04} + {3401668800 -10800 1 -03} + {3412551600 -14400 0 -04} + {3433118400 -10800 1 -03} + {3444001200 -14400 0 -04} + {3464568000 -10800 1 -03} + {3475450800 -14400 0 -04} + {3496622400 -10800 1 -03} + {3506900400 -14400 0 -04} + {3528072000 -10800 1 -03} + {3538350000 -14400 0 -04} + {3559521600 -10800 1 -03} + {3570404400 -14400 0 -04} + {3590971200 -10800 1 -03} + {3601854000 -14400 0 -04} + {3622420800 -10800 1 -03} + {3633303600 -14400 0 -04} + {3654475200 -10800 1 -03} + {3664753200 -14400 0 -04} + {3685924800 -10800 1 -03} + {3696202800 -14400 0 -04} + {3717374400 -10800 1 -03} + {3727652400 -14400 0 -04} + {3748824000 -10800 1 -03} + {3759706800 -14400 0 -04} + {3780273600 -10800 1 -03} + {3791156400 -14400 0 -04} + {3811723200 -10800 1 -03} + {3822606000 -14400 0 -04} + {3843777600 -10800 1 -03} + {3854055600 -14400 0 -04} + {3875227200 -10800 1 -03} + {3885505200 -14400 0 -04} + {3906676800 -10800 1 -03} + {3917559600 -14400 0 -04} + {3938126400 -10800 1 -03} + {3949009200 -14400 0 -04} + {3969576000 -10800 1 -03} + {3980458800 -14400 0 -04} + {4001630400 -10800 1 -03} + {4011908400 -14400 0 -04} + {4033080000 -10800 1 -03} + {4043358000 -14400 0 -04} + {4064529600 -10800 1 -03} + {4074807600 -14400 0 -04} + {4095979200 -10800 1 -03} } diff --git a/library/tzdata/America/Curacao b/library/tzdata/America/Curacao index 5189e9c..0a19090 100644 --- a/library/tzdata/America/Curacao +++ b/library/tzdata/America/Curacao @@ -2,6 +2,6 @@ set TZData(:America/Curacao) { {-9223372036854775808 -16547 0 LMT} - {-1826738653 -16200 0 ANT} + {-1826738653 -16200 0 -0430} {-157750200 -14400 0 AST} } diff --git a/library/tzdata/America/Danmarkshavn b/library/tzdata/America/Danmarkshavn index 8d66d3a..4d9d7bb 100644 --- a/library/tzdata/America/Danmarkshavn +++ b/library/tzdata/America/Danmarkshavn @@ -2,38 +2,38 @@ set TZData(:America/Danmarkshavn) { {-9223372036854775808 -4480 0 LMT} - {-1686091520 -10800 0 WGT} - {323845200 -7200 0 WGST} - {338950800 -10800 0 WGT} - {354675600 -7200 1 WGST} - {370400400 -10800 0 WGT} - {386125200 -7200 1 WGST} - {401850000 -10800 0 WGT} - {417574800 -7200 1 WGST} - {433299600 -10800 0 WGT} - {449024400 -7200 1 WGST} - {465354000 -10800 0 WGT} - {481078800 -7200 1 WGST} - {496803600 -10800 0 WGT} - {512528400 -7200 1 WGST} - {528253200 -10800 0 WGT} - {543978000 -7200 1 WGST} - {559702800 -10800 0 WGT} - {575427600 -7200 1 WGST} - {591152400 -10800 0 WGT} - {606877200 -7200 1 WGST} - {622602000 -10800 0 WGT} - {638326800 -7200 1 WGST} - {654656400 -10800 0 WGT} - {670381200 -7200 1 WGST} - {686106000 -10800 0 WGT} - {701830800 -7200 1 WGST} - {717555600 -10800 0 WGT} - {733280400 -7200 1 WGST} - {749005200 -10800 0 WGT} - {764730000 -7200 1 WGST} - {780454800 -10800 0 WGT} - {796179600 -7200 1 WGST} - {811904400 -10800 0 WGT} + {-1686091520 -10800 0 -03} + {323845200 -7200 0 -02} + {338950800 -10800 0 -03} + {354675600 -7200 1 -02} + {370400400 -10800 0 -03} + {386125200 -7200 1 -02} + {401850000 -10800 0 -03} + {417574800 -7200 1 -02} + {433299600 -10800 0 -03} + {449024400 -7200 1 -02} + {465354000 -10800 0 -03} + {481078800 -7200 1 -02} + {496803600 -10800 0 -03} + {512528400 -7200 1 -02} + {528253200 -10800 0 -03} + {543978000 -7200 1 -02} + {559702800 -10800 0 -03} + {575427600 -7200 1 -02} + {591152400 -10800 0 -03} + {606877200 -7200 1 -02} + {622602000 -10800 0 -03} + {638326800 -7200 1 -02} + {654656400 -10800 0 -03} + {670381200 -7200 1 -02} + {686106000 -10800 0 -03} + {701830800 -7200 1 -02} + {717555600 -10800 0 -03} + {733280400 -7200 1 -02} + {749005200 -10800 0 -03} + {764730000 -7200 1 -02} + {780454800 -10800 0 -03} + {796179600 -7200 1 -02} + {811904400 -10800 0 -03} {820465200 0 0 GMT} } diff --git a/library/tzdata/America/Eirunepe b/library/tzdata/America/Eirunepe index a05631f..41b4cc9 100644 --- a/library/tzdata/America/Eirunepe +++ b/library/tzdata/America/Eirunepe @@ -2,40 +2,40 @@ set TZData(:America/Eirunepe) { {-9223372036854775808 -16768 0 LMT} - {-1767208832 -18000 0 ACT} - {-1206950400 -14400 1 ACST} - {-1191355200 -18000 0 ACT} - {-1175367600 -14400 1 ACST} - {-1159819200 -18000 0 ACT} - {-633812400 -14400 1 ACST} - {-622062000 -18000 0 ACT} - {-602276400 -14400 1 ACST} - {-591825600 -18000 0 ACT} - {-570740400 -14400 1 ACST} - {-560203200 -18000 0 ACT} - {-539118000 -14400 1 ACST} - {-531345600 -18000 0 ACT} - {-191358000 -14400 1 ACST} - {-184190400 -18000 0 ACT} - {-155156400 -14400 1 ACST} - {-150062400 -18000 0 ACT} - {-128890800 -14400 1 ACST} - {-121118400 -18000 0 ACT} - {-99946800 -14400 1 ACST} - {-89582400 -18000 0 ACT} - {-68410800 -14400 1 ACST} - {-57960000 -18000 0 ACT} - {499755600 -14400 1 ACST} - {511243200 -18000 0 ACT} - {530600400 -14400 1 ACST} - {540273600 -18000 0 ACT} - {562136400 -14400 1 ACST} - {571204800 -18000 0 ACT} - {590040000 -18000 0 ACT} - {749192400 -18000 0 ACT} - {750834000 -14400 1 ACST} - {761716800 -18000 0 ACT} - {780206400 -18000 0 ACT} - {1214283600 -14400 0 AMT} - {1384056000 -18000 0 ACT} + {-1767208832 -18000 0 -05} + {-1206950400 -14400 1 -04} + {-1191355200 -18000 0 -05} + {-1175367600 -14400 1 -04} + {-1159819200 -18000 0 -05} + {-633812400 -14400 1 -04} + {-622062000 -18000 0 -05} + {-602276400 -14400 1 -04} + {-591825600 -18000 0 -05} + {-570740400 -14400 1 -04} + {-560203200 -18000 0 -05} + {-539118000 -14400 1 -04} + {-531345600 -18000 0 -05} + {-191358000 -14400 1 -04} + {-184190400 -18000 0 -05} + {-155156400 -14400 1 -04} + {-150062400 -18000 0 -05} + {-128890800 -14400 1 -04} + {-121118400 -18000 0 -05} + {-99946800 -14400 1 -04} + {-89582400 -18000 0 -05} + {-68410800 -14400 1 -04} + {-57960000 -18000 0 -05} + {499755600 -14400 1 -04} + {511243200 -18000 0 -05} + {530600400 -14400 1 -04} + {540273600 -18000 0 -05} + {562136400 -14400 1 -04} + {571204800 -18000 0 -05} + {590040000 -18000 0 -05} + {749192400 -18000 0 -05} + {750834000 -14400 1 -04} + {761716800 -18000 0 -05} + {780206400 -18000 0 -05} + {1214283600 -14400 0 -04} + {1384056000 -18000 0 -05} } diff --git a/library/tzdata/America/Fortaleza b/library/tzdata/America/Fortaleza index 581faa5..06c7b84 100644 --- a/library/tzdata/America/Fortaleza +++ b/library/tzdata/America/Fortaleza @@ -2,47 +2,47 @@ set TZData(:America/Fortaleza) { {-9223372036854775808 -9240 0 LMT} - {-1767216360 -10800 0 BRT} - {-1206957600 -7200 1 BRST} - {-1191362400 -10800 0 BRT} - {-1175374800 -7200 1 BRST} - {-1159826400 -10800 0 BRT} - {-633819600 -7200 1 BRST} - {-622069200 -10800 0 BRT} - {-602283600 -7200 1 BRST} - {-591832800 -10800 0 BRT} - {-570747600 -7200 1 BRST} - {-560210400 -10800 0 BRT} - {-539125200 -7200 1 BRST} - {-531352800 -10800 0 BRT} - {-191365200 -7200 1 BRST} - {-184197600 -10800 0 BRT} - {-155163600 -7200 1 BRST} - {-150069600 -10800 0 BRT} - {-128898000 -7200 1 BRST} - {-121125600 -10800 0 BRT} - {-99954000 -7200 1 BRST} - {-89589600 -10800 0 BRT} - {-68418000 -7200 1 BRST} - {-57967200 -10800 0 BRT} - {499748400 -7200 1 BRST} - {511236000 -10800 0 BRT} - {530593200 -7200 1 BRST} - {540266400 -10800 0 BRT} - {562129200 -7200 1 BRST} - {571197600 -10800 0 BRT} - {592974000 -7200 1 BRST} - {602042400 -10800 0 BRT} - {624423600 -7200 1 BRST} - {634701600 -10800 0 BRT} - {653536800 -10800 0 BRT} - {938660400 -10800 0 BRT} - {938919600 -7200 1 BRST} - {951616800 -10800 0 BRT} - {970974000 -7200 1 BRST} - {972180000 -10800 0 BRT} - {1000350000 -10800 0 BRT} - {1003028400 -7200 1 BRST} - {1013911200 -10800 0 BRT} - {1033437600 -10800 0 BRT} + {-1767216360 -10800 0 -03} + {-1206957600 -7200 1 -02} + {-1191362400 -10800 0 -03} + {-1175374800 -7200 1 -02} + {-1159826400 -10800 0 -03} + {-633819600 -7200 1 -02} + {-622069200 -10800 0 -03} + {-602283600 -7200 1 -02} + {-591832800 -10800 0 -03} + {-570747600 -7200 1 -02} + {-560210400 -10800 0 -03} + {-539125200 -7200 1 -02} + {-531352800 -10800 0 -03} + {-191365200 -7200 1 -02} + {-184197600 -10800 0 -03} + {-155163600 -7200 1 -02} + {-150069600 -10800 0 -03} + {-128898000 -7200 1 -02} + {-121125600 -10800 0 -03} + {-99954000 -7200 1 -02} + {-89589600 -10800 0 -03} + {-68418000 -7200 1 -02} + {-57967200 -10800 0 -03} + {499748400 -7200 1 -02} + {511236000 -10800 0 -03} + {530593200 -7200 1 -02} + {540266400 -10800 0 -03} + {562129200 -7200 1 -02} + {571197600 -10800 0 -03} + {592974000 -7200 1 -02} + {602042400 -10800 0 -03} + {624423600 -7200 1 -02} + {634701600 -10800 0 -03} + {653536800 -10800 0 -03} + {938660400 -10800 0 -03} + {938919600 -7200 1 -02} + {951616800 -10800 0 -03} + {970974000 -7200 1 -02} + {972180000 -10800 0 -03} + {1000350000 -10800 0 -03} + {1003028400 -7200 1 -02} + {1013911200 -10800 0 -03} + {1033437600 -10800 0 -03} } diff --git a/library/tzdata/America/Godthab b/library/tzdata/America/Godthab index 3c003cc..3e45f87 100644 --- a/library/tzdata/America/Godthab +++ b/library/tzdata/America/Godthab @@ -2,245 +2,245 @@ set TZData(:America/Godthab) { {-9223372036854775808 -12416 0 LMT} - {-1686083584 -10800 0 WGT} - {323845200 -7200 0 WGST} - {338950800 -10800 0 WGT} - {354675600 -7200 1 WGST} - {370400400 -10800 0 WGT} - {386125200 -7200 1 WGST} - {401850000 -10800 0 WGT} - {417574800 -7200 1 WGST} - {433299600 -10800 0 WGT} - {449024400 -7200 1 WGST} - {465354000 -10800 0 WGT} - {481078800 -7200 1 WGST} - {496803600 -10800 0 WGT} - {512528400 -7200 1 WGST} - {528253200 -10800 0 WGT} - {543978000 -7200 1 WGST} - {559702800 -10800 0 WGT} - {575427600 -7200 1 WGST} - {591152400 -10800 0 WGT} - {606877200 -7200 1 WGST} - {622602000 -10800 0 WGT} - {638326800 -7200 1 WGST} - {654656400 -10800 0 WGT} - {670381200 -7200 1 WGST} - {686106000 -10800 0 WGT} - {701830800 -7200 1 WGST} - {717555600 -10800 0 WGT} - {733280400 -7200 1 WGST} - {749005200 -10800 0 WGT} - {764730000 -7200 1 WGST} - {780454800 -10800 0 WGT} - {796179600 -7200 1 WGST} - {811904400 -10800 0 WGT} - {828234000 -7200 1 WGST} - {846378000 -10800 0 WGT} - {859683600 -7200 1 WGST} - {877827600 -10800 0 WGT} - {891133200 -7200 1 WGST} - {909277200 -10800 0 WGT} - {922582800 -7200 1 WGST} - {941331600 -10800 0 WGT} - {954032400 -7200 1 WGST} - {972781200 -10800 0 WGT} - {985482000 -7200 1 WGST} - {1004230800 -10800 0 WGT} - {1017536400 -7200 1 WGST} - {1035680400 -10800 0 WGT} - {1048986000 -7200 1 WGST} - {1067130000 -10800 0 WGT} - {1080435600 -7200 1 WGST} - {1099184400 -10800 0 WGT} - {1111885200 -7200 1 WGST} - {1130634000 -10800 0 WGT} - {1143334800 -7200 1 WGST} - {1162083600 -10800 0 WGT} - {1174784400 -7200 1 WGST} - {1193533200 -10800 0 WGT} - {1206838800 -7200 1 WGST} - {1224982800 -10800 0 WGT} - {1238288400 -7200 1 WGST} - {1256432400 -10800 0 WGT} - {1269738000 -7200 1 WGST} - {1288486800 -10800 0 WGT} - {1301187600 -7200 1 WGST} - {1319936400 -10800 0 WGT} - {1332637200 -7200 1 WGST} - {1351386000 -10800 0 WGT} - {1364691600 -7200 1 WGST} - {1382835600 -10800 0 WGT} - {1396141200 -7200 1 WGST} - {1414285200 -10800 0 WGT} - {1427590800 -7200 1 WGST} - {1445734800 -10800 0 WGT} - {1459040400 -7200 1 WGST} - {1477789200 -10800 0 WGT} - {1490490000 -7200 1 WGST} - {1509238800 -10800 0 WGT} - {1521939600 -7200 1 WGST} - {1540688400 -10800 0 WGT} - {1553994000 -7200 1 WGST} - {1572138000 -10800 0 WGT} - {1585443600 -7200 1 WGST} - {1603587600 -10800 0 WGT} - {1616893200 -7200 1 WGST} - {1635642000 -10800 0 WGT} - {1648342800 -7200 1 WGST} - {1667091600 -10800 0 WGT} - {1679792400 -7200 1 WGST} - {1698541200 -10800 0 WGT} - {1711846800 -7200 1 WGST} - {1729990800 -10800 0 WGT} - {1743296400 -7200 1 WGST} - {1761440400 -10800 0 WGT} - {1774746000 -7200 1 WGST} - {1792890000 -10800 0 WGT} - {1806195600 -7200 1 WGST} - {1824944400 -10800 0 WGT} - {1837645200 -7200 1 WGST} - {1856394000 -10800 0 WGT} - {1869094800 -7200 1 WGST} - {1887843600 -10800 0 WGT} - {1901149200 -7200 1 WGST} - {1919293200 -10800 0 WGT} - {1932598800 -7200 1 WGST} - {1950742800 -10800 0 WGT} - {1964048400 -7200 1 WGST} - {1982797200 -10800 0 WGT} - {1995498000 -7200 1 WGST} - {2014246800 -10800 0 WGT} - {2026947600 -7200 1 WGST} - {2045696400 -10800 0 WGT} - {2058397200 -7200 1 WGST} - {2077146000 -10800 0 WGT} - {2090451600 -7200 1 WGST} - {2108595600 -10800 0 WGT} - {2121901200 -7200 1 WGST} - {2140045200 -10800 0 WGT} - {2153350800 -7200 1 WGST} - {2172099600 -10800 0 WGT} - {2184800400 -7200 1 WGST} - {2203549200 -10800 0 WGT} - {2216250000 -7200 1 WGST} - {2234998800 -10800 0 WGT} - {2248304400 -7200 1 WGST} - {2266448400 -10800 0 WGT} - {2279754000 -7200 1 WGST} - {2297898000 -10800 0 WGT} - {2311203600 -7200 1 WGST} - {2329347600 -10800 0 WGT} - {2342653200 -7200 1 WGST} - {2361402000 -10800 0 WGT} - {2374102800 -7200 1 WGST} - {2392851600 -10800 0 WGT} - {2405552400 -7200 1 WGST} - {2424301200 -10800 0 WGT} - {2437606800 -7200 1 WGST} - {2455750800 -10800 0 WGT} - {2469056400 -7200 1 WGST} - {2487200400 -10800 0 WGT} - {2500506000 -7200 1 WGST} - {2519254800 -10800 0 WGT} - {2531955600 -7200 1 WGST} - {2550704400 -10800 0 WGT} - {2563405200 -7200 1 WGST} - {2582154000 -10800 0 WGT} - {2595459600 -7200 1 WGST} - {2613603600 -10800 0 WGT} - {2626909200 -7200 1 WGST} - {2645053200 -10800 0 WGT} - {2658358800 -7200 1 WGST} - {2676502800 -10800 0 WGT} - {2689808400 -7200 1 WGST} - {2708557200 -10800 0 WGT} - {2721258000 -7200 1 WGST} - {2740006800 -10800 0 WGT} - {2752707600 -7200 1 WGST} - {2771456400 -10800 0 WGT} - {2784762000 -7200 1 WGST} - {2802906000 -10800 0 WGT} - {2816211600 -7200 1 WGST} - {2834355600 -10800 0 WGT} - {2847661200 -7200 1 WGST} - {2866410000 -10800 0 WGT} - {2879110800 -7200 1 WGST} - {2897859600 -10800 0 WGT} - {2910560400 -7200 1 WGST} - {2929309200 -10800 0 WGT} - {2942010000 -7200 1 WGST} - {2960758800 -10800 0 WGT} - {2974064400 -7200 1 WGST} - {2992208400 -10800 0 WGT} - {3005514000 -7200 1 WGST} - {3023658000 -10800 0 WGT} - {3036963600 -7200 1 WGST} - {3055712400 -10800 0 WGT} - {3068413200 -7200 1 WGST} - {3087162000 -10800 0 WGT} - {3099862800 -7200 1 WGST} - {3118611600 -10800 0 WGT} - {3131917200 -7200 1 WGST} - {3150061200 -10800 0 WGT} - {3163366800 -7200 1 WGST} - {3181510800 -10800 0 WGT} - {3194816400 -7200 1 WGST} - {3212960400 -10800 0 WGT} - {3226266000 -7200 1 WGST} - {3245014800 -10800 0 WGT} - {3257715600 -7200 1 WGST} - {3276464400 -10800 0 WGT} - {3289165200 -7200 1 WGST} - {3307914000 -10800 0 WGT} - {3321219600 -7200 1 WGST} - {3339363600 -10800 0 WGT} - {3352669200 -7200 1 WGST} - {3370813200 -10800 0 WGT} - {3384118800 -7200 1 WGST} - {3402867600 -10800 0 WGT} - {3415568400 -7200 1 WGST} - {3434317200 -10800 0 WGT} - {3447018000 -7200 1 WGST} - {3465766800 -10800 0 WGT} - {3479072400 -7200 1 WGST} - {3497216400 -10800 0 WGT} - {3510522000 -7200 1 WGST} - {3528666000 -10800 0 WGT} - {3541971600 -7200 1 WGST} - {3560115600 -10800 0 WGT} - {3573421200 -7200 1 WGST} - {3592170000 -10800 0 WGT} - {3604870800 -7200 1 WGST} - {3623619600 -10800 0 WGT} - {3636320400 -7200 1 WGST} - {3655069200 -10800 0 WGT} - {3668374800 -7200 1 WGST} - {3686518800 -10800 0 WGT} - {3699824400 -7200 1 WGST} - {3717968400 -10800 0 WGT} - {3731274000 -7200 1 WGST} - {3750022800 -10800 0 WGT} - {3762723600 -7200 1 WGST} - {3781472400 -10800 0 WGT} - {3794173200 -7200 1 WGST} - {3812922000 -10800 0 WGT} - {3825622800 -7200 1 WGST} - {3844371600 -10800 0 WGT} - {3857677200 -7200 1 WGST} - {3875821200 -10800 0 WGT} - {3889126800 -7200 1 WGST} - {3907270800 -10800 0 WGT} - {3920576400 -7200 1 WGST} - {3939325200 -10800 0 WGT} - {3952026000 -7200 1 WGST} - {3970774800 -10800 0 WGT} - {3983475600 -7200 1 WGST} - {4002224400 -10800 0 WGT} - {4015530000 -7200 1 WGST} - {4033674000 -10800 0 WGT} - {4046979600 -7200 1 WGST} - {4065123600 -10800 0 WGT} - {4078429200 -7200 1 WGST} - {4096573200 -10800 0 WGT} + {-1686083584 -10800 0 -03} + {323845200 -7200 0 -02} + {338950800 -10800 0 -03} + {354675600 -7200 1 -02} + {370400400 -10800 0 -03} + {386125200 -7200 1 -02} + {401850000 -10800 0 -03} + {417574800 -7200 1 -02} + {433299600 -10800 0 -03} + {449024400 -7200 1 -02} + {465354000 -10800 0 -03} + {481078800 -7200 1 -02} + {496803600 -10800 0 -03} + {512528400 -7200 1 -02} + {528253200 -10800 0 -03} + {543978000 -7200 1 -02} + {559702800 -10800 0 -03} + {575427600 -7200 1 -02} + {591152400 -10800 0 -03} + {606877200 -7200 1 -02} + {622602000 -10800 0 -03} + {638326800 -7200 1 -02} + {654656400 -10800 0 -03} + {670381200 -7200 1 -02} + {686106000 -10800 0 -03} + {701830800 -7200 1 -02} + {717555600 -10800 0 -03} + {733280400 -7200 1 -02} + {749005200 -10800 0 -03} + {764730000 -7200 1 -02} + {780454800 -10800 0 -03} + {796179600 -7200 1 -02} + {811904400 -10800 0 -03} + {828234000 -7200 1 -02} + {846378000 -10800 0 -03} + {859683600 -7200 1 -02} + {877827600 -10800 0 -03} + {891133200 -7200 1 -02} + {909277200 -10800 0 -03} + {922582800 -7200 1 -02} + {941331600 -10800 0 -03} + {954032400 -7200 1 -02} + {972781200 -10800 0 -03} + {985482000 -7200 1 -02} + {1004230800 -10800 0 -03} + {1017536400 -7200 1 -02} + {1035680400 -10800 0 -03} + {1048986000 -7200 1 -02} + {1067130000 -10800 0 -03} + {1080435600 -7200 1 -02} + {1099184400 -10800 0 -03} + {1111885200 -7200 1 -02} + {1130634000 -10800 0 -03} + {1143334800 -7200 1 -02} + {1162083600 -10800 0 -03} + {1174784400 -7200 1 -02} + {1193533200 -10800 0 -03} + {1206838800 -7200 1 -02} + {1224982800 -10800 0 -03} + {1238288400 -7200 1 -02} + {1256432400 -10800 0 -03} + {1269738000 -7200 1 -02} + {1288486800 -10800 0 -03} + {1301187600 -7200 1 -02} + {1319936400 -10800 0 -03} + {1332637200 -7200 1 -02} + {1351386000 -10800 0 -03} + {1364691600 -7200 1 -02} + {1382835600 -10800 0 -03} + {1396141200 -7200 1 -02} + {1414285200 -10800 0 -03} + {1427590800 -7200 1 -02} + {1445734800 -10800 0 -03} + {1459040400 -7200 1 -02} + {1477789200 -10800 0 -03} + {1490490000 -7200 1 -02} + {1509238800 -10800 0 -03} + {1521939600 -7200 1 -02} + {1540688400 -10800 0 -03} + {1553994000 -7200 1 -02} + {1572138000 -10800 0 -03} + {1585443600 -7200 1 -02} + {1603587600 -10800 0 -03} + {1616893200 -7200 1 -02} + {1635642000 -10800 0 -03} + {1648342800 -7200 1 -02} + {1667091600 -10800 0 -03} + {1679792400 -7200 1 -02} + {1698541200 -10800 0 -03} + {1711846800 -7200 1 -02} + {1729990800 -10800 0 -03} + {1743296400 -7200 1 -02} + {1761440400 -10800 0 -03} + {1774746000 -7200 1 -02} + {1792890000 -10800 0 -03} + {1806195600 -7200 1 -02} + {1824944400 -10800 0 -03} + {1837645200 -7200 1 -02} + {1856394000 -10800 0 -03} + {1869094800 -7200 1 -02} + {1887843600 -10800 0 -03} + {1901149200 -7200 1 -02} + {1919293200 -10800 0 -03} + {1932598800 -7200 1 -02} + {1950742800 -10800 0 -03} + {1964048400 -7200 1 -02} + {1982797200 -10800 0 -03} + {1995498000 -7200 1 -02} + {2014246800 -10800 0 -03} + {2026947600 -7200 1 -02} + {2045696400 -10800 0 -03} + {2058397200 -7200 1 -02} + {2077146000 -10800 0 -03} + {2090451600 -7200 1 -02} + {2108595600 -10800 0 -03} + {2121901200 -7200 1 -02} + {2140045200 -10800 0 -03} + {2153350800 -7200 1 -02} + {2172099600 -10800 0 -03} + {2184800400 -7200 1 -02} + {2203549200 -10800 0 -03} + {2216250000 -7200 1 -02} + {2234998800 -10800 0 -03} + {2248304400 -7200 1 -02} + {2266448400 -10800 0 -03} + {2279754000 -7200 1 -02} + {2297898000 -10800 0 -03} + {2311203600 -7200 1 -02} + {2329347600 -10800 0 -03} + {2342653200 -7200 1 -02} + {2361402000 -10800 0 -03} + {2374102800 -7200 1 -02} + {2392851600 -10800 0 -03} + {2405552400 -7200 1 -02} + {2424301200 -10800 0 -03} + {2437606800 -7200 1 -02} + {2455750800 -10800 0 -03} + {2469056400 -7200 1 -02} + {2487200400 -10800 0 -03} + {2500506000 -7200 1 -02} + {2519254800 -10800 0 -03} + {2531955600 -7200 1 -02} + {2550704400 -10800 0 -03} + {2563405200 -7200 1 -02} + {2582154000 -10800 0 -03} + {2595459600 -7200 1 -02} + {2613603600 -10800 0 -03} + {2626909200 -7200 1 -02} + {2645053200 -10800 0 -03} + {2658358800 -7200 1 -02} + {2676502800 -10800 0 -03} + {2689808400 -7200 1 -02} + {2708557200 -10800 0 -03} + {2721258000 -7200 1 -02} + {2740006800 -10800 0 -03} + {2752707600 -7200 1 -02} + {2771456400 -10800 0 -03} + {2784762000 -7200 1 -02} + {2802906000 -10800 0 -03} + {2816211600 -7200 1 -02} + {2834355600 -10800 0 -03} + {2847661200 -7200 1 -02} + {2866410000 -10800 0 -03} + {2879110800 -7200 1 -02} + {2897859600 -10800 0 -03} + {2910560400 -7200 1 -02} + {2929309200 -10800 0 -03} + {2942010000 -7200 1 -02} + {2960758800 -10800 0 -03} + {2974064400 -7200 1 -02} + {2992208400 -10800 0 -03} + {3005514000 -7200 1 -02} + {3023658000 -10800 0 -03} + {3036963600 -7200 1 -02} + {3055712400 -10800 0 -03} + {3068413200 -7200 1 -02} + {3087162000 -10800 0 -03} + {3099862800 -7200 1 -02} + {3118611600 -10800 0 -03} + {3131917200 -7200 1 -02} + {3150061200 -10800 0 -03} + {3163366800 -7200 1 -02} + {3181510800 -10800 0 -03} + {3194816400 -7200 1 -02} + {3212960400 -10800 0 -03} + {3226266000 -7200 1 -02} + {3245014800 -10800 0 -03} + {3257715600 -7200 1 -02} + {3276464400 -10800 0 -03} + {3289165200 -7200 1 -02} + {3307914000 -10800 0 -03} + {3321219600 -7200 1 -02} + {3339363600 -10800 0 -03} + {3352669200 -7200 1 -02} + {3370813200 -10800 0 -03} + {3384118800 -7200 1 -02} + {3402867600 -10800 0 -03} + {3415568400 -7200 1 -02} + {3434317200 -10800 0 -03} + {3447018000 -7200 1 -02} + {3465766800 -10800 0 -03} + {3479072400 -7200 1 -02} + {3497216400 -10800 0 -03} + {3510522000 -7200 1 -02} + {3528666000 -10800 0 -03} + {3541971600 -7200 1 -02} + {3560115600 -10800 0 -03} + {3573421200 -7200 1 -02} + {3592170000 -10800 0 -03} + {3604870800 -7200 1 -02} + {3623619600 -10800 0 -03} + {3636320400 -7200 1 -02} + {3655069200 -10800 0 -03} + {3668374800 -7200 1 -02} + {3686518800 -10800 0 -03} + {3699824400 -7200 1 -02} + {3717968400 -10800 0 -03} + {3731274000 -7200 1 -02} + {3750022800 -10800 0 -03} + {3762723600 -7200 1 -02} + {3781472400 -10800 0 -03} + {3794173200 -7200 1 -02} + {3812922000 -10800 0 -03} + {3825622800 -7200 1 -02} + {3844371600 -10800 0 -03} + {3857677200 -7200 1 -02} + {3875821200 -10800 0 -03} + {3889126800 -7200 1 -02} + {3907270800 -10800 0 -03} + {3920576400 -7200 1 -02} + {3939325200 -10800 0 -03} + {3952026000 -7200 1 -02} + {3970774800 -10800 0 -03} + {3983475600 -7200 1 -02} + {4002224400 -10800 0 -03} + {4015530000 -7200 1 -02} + {4033674000 -10800 0 -03} + {4046979600 -7200 1 -02} + {4065123600 -10800 0 -03} + {4078429200 -7200 1 -02} + {4096573200 -10800 0 -03} } diff --git a/library/tzdata/America/Guayaquil b/library/tzdata/America/Guayaquil index e940a5b..353eb69 100644 --- a/library/tzdata/America/Guayaquil +++ b/library/tzdata/America/Guayaquil @@ -3,5 +3,7 @@ set TZData(:America/Guayaquil) { {-9223372036854775808 -19160 0 LMT} {-2524502440 -18840 0 QMT} - {-1230749160 -18000 0 ECT} + {-1230749160 -18000 0 -05} + {722926800 -14400 1 -04} + {728884800 -18000 0 -05} } diff --git a/library/tzdata/America/Guyana b/library/tzdata/America/Guyana index c58a989..fab7855 100644 --- a/library/tzdata/America/Guyana +++ b/library/tzdata/America/Guyana @@ -2,8 +2,7 @@ set TZData(:America/Guyana) { {-9223372036854775808 -13960 0 LMT} - {-1730578040 -13500 0 GBGT} - {-113688900 -13500 0 GYT} - {176010300 -10800 0 GYT} - {662698800 -14400 0 GYT} + {-1730578040 -13500 0 -0345} + {176010300 -10800 0 -03} + {662698800 -14400 0 -04} } diff --git a/library/tzdata/America/La_Paz b/library/tzdata/America/La_Paz index 38ffbb0..a245afd 100644 --- a/library/tzdata/America/La_Paz +++ b/library/tzdata/America/La_Paz @@ -4,5 +4,5 @@ set TZData(:America/La_Paz) { {-9223372036854775808 -16356 0 LMT} {-2524505244 -16356 0 CMT} {-1205954844 -12756 1 BOST} - {-1192307244 -14400 0 BOT} + {-1192307244 -14400 0 -04} } diff --git a/library/tzdata/America/Lima b/library/tzdata/America/Lima index c6e6ac1..b224a64 100644 --- a/library/tzdata/America/Lima +++ b/library/tzdata/America/Lima @@ -3,14 +3,14 @@ set TZData(:America/Lima) { {-9223372036854775808 -18492 0 LMT} {-2524503108 -18516 0 LMT} - {-1938538284 -14400 0 PEST} - {-1002052800 -18000 0 PET} - {-986756400 -14400 1 PEST} - {-971035200 -18000 0 PET} - {-955306800 -14400 1 PEST} - {-939585600 -18000 0 PET} - {512712000 -18000 0 PET} - {544248000 -18000 0 PET} - {638942400 -18000 0 PET} - {765172800 -18000 0 PET} + {-1938538284 -14400 0 -04} + {-1002052800 -18000 0 -05} + {-986756400 -14400 1 -04} + {-971035200 -18000 0 -05} + {-955306800 -14400 1 -04} + {-939585600 -18000 0 -05} + {512712000 -18000 0 -05} + {544248000 -18000 0 -05} + {638942400 -18000 0 -05} + {765172800 -18000 0 -05} } diff --git a/library/tzdata/America/Maceio b/library/tzdata/America/Maceio index 333b878..e6ed548 100644 --- a/library/tzdata/America/Maceio +++ b/library/tzdata/America/Maceio @@ -2,51 +2,51 @@ set TZData(:America/Maceio) { {-9223372036854775808 -8572 0 LMT} - {-1767217028 -10800 0 BRT} - {-1206957600 -7200 1 BRST} - {-1191362400 -10800 0 BRT} - {-1175374800 -7200 1 BRST} - {-1159826400 -10800 0 BRT} - {-633819600 -7200 1 BRST} - {-622069200 -10800 0 BRT} - {-602283600 -7200 1 BRST} - {-591832800 -10800 0 BRT} - {-570747600 -7200 1 BRST} - {-560210400 -10800 0 BRT} - {-539125200 -7200 1 BRST} - {-531352800 -10800 0 BRT} - {-191365200 -7200 1 BRST} - {-184197600 -10800 0 BRT} - {-155163600 -7200 1 BRST} - {-150069600 -10800 0 BRT} - {-128898000 -7200 1 BRST} - {-121125600 -10800 0 BRT} - {-99954000 -7200 1 BRST} - {-89589600 -10800 0 BRT} - {-68418000 -7200 1 BRST} - {-57967200 -10800 0 BRT} - {499748400 -7200 1 BRST} - {511236000 -10800 0 BRT} - {530593200 -7200 1 BRST} - {540266400 -10800 0 BRT} - {562129200 -7200 1 BRST} - {571197600 -10800 0 BRT} - {592974000 -7200 1 BRST} - {602042400 -10800 0 BRT} - {624423600 -7200 1 BRST} - {634701600 -10800 0 BRT} - {653536800 -10800 0 BRT} - {813553200 -10800 0 BRT} - {813726000 -7200 1 BRST} - {824004000 -10800 0 BRT} - {841802400 -10800 0 BRT} - {938660400 -10800 0 BRT} - {938919600 -7200 1 BRST} - {951616800 -10800 0 BRT} - {970974000 -7200 1 BRST} - {972180000 -10800 0 BRT} - {1000350000 -10800 0 BRT} - {1003028400 -7200 1 BRST} - {1013911200 -10800 0 BRT} - {1033437600 -10800 0 BRT} + {-1767217028 -10800 0 -03} + {-1206957600 -7200 1 -02} + {-1191362400 -10800 0 -03} + {-1175374800 -7200 1 -02} + {-1159826400 -10800 0 -03} + {-633819600 -7200 1 -02} + {-622069200 -10800 0 -03} + {-602283600 -7200 1 -02} + {-591832800 -10800 0 -03} + {-570747600 -7200 1 -02} + {-560210400 -10800 0 -03} + {-539125200 -7200 1 -02} + {-531352800 -10800 0 -03} + {-191365200 -7200 1 -02} + {-184197600 -10800 0 -03} + {-155163600 -7200 1 -02} + {-150069600 -10800 0 -03} + {-128898000 -7200 1 -02} + {-121125600 -10800 0 -03} + {-99954000 -7200 1 -02} + {-89589600 -10800 0 -03} + {-68418000 -7200 1 -02} + {-57967200 -10800 0 -03} + {499748400 -7200 1 -02} + {511236000 -10800 0 -03} + {530593200 -7200 1 -02} + {540266400 -10800 0 -03} + {562129200 -7200 1 -02} + {571197600 -10800 0 -03} + {592974000 -7200 1 -02} + {602042400 -10800 0 -03} + {624423600 -7200 1 -02} + {634701600 -10800 0 -03} + {653536800 -10800 0 -03} + {813553200 -10800 0 -03} + {813726000 -7200 1 -02} + {824004000 -10800 0 -03} + {841802400 -10800 0 -03} + {938660400 -10800 0 -03} + {938919600 -7200 1 -02} + {951616800 -10800 0 -03} + {970974000 -7200 1 -02} + {972180000 -10800 0 -03} + {1000350000 -10800 0 -03} + {1003028400 -7200 1 -02} + {1013911200 -10800 0 -03} + {1033437600 -10800 0 -03} } diff --git a/library/tzdata/America/Manaus b/library/tzdata/America/Manaus index 058e0f7..f17023c 100644 --- a/library/tzdata/America/Manaus +++ b/library/tzdata/America/Manaus @@ -2,38 +2,38 @@ set TZData(:America/Manaus) { {-9223372036854775808 -14404 0 LMT} - {-1767211196 -14400 0 AMT} - {-1206954000 -10800 1 AMST} - {-1191358800 -14400 0 AMT} - {-1175371200 -10800 1 AMST} - {-1159822800 -14400 0 AMT} - {-633816000 -10800 1 AMST} - {-622065600 -14400 0 AMT} - {-602280000 -10800 1 AMST} - {-591829200 -14400 0 AMT} - {-570744000 -10800 1 AMST} - {-560206800 -14400 0 AMT} - {-539121600 -10800 1 AMST} - {-531349200 -14400 0 AMT} - {-191361600 -10800 1 AMST} - {-184194000 -14400 0 AMT} - {-155160000 -10800 1 AMST} - {-150066000 -14400 0 AMT} - {-128894400 -10800 1 AMST} - {-121122000 -14400 0 AMT} - {-99950400 -10800 1 AMST} - {-89586000 -14400 0 AMT} - {-68414400 -10800 1 AMST} - {-57963600 -14400 0 AMT} - {499752000 -10800 1 AMST} - {511239600 -14400 0 AMT} - {530596800 -10800 1 AMST} - {540270000 -14400 0 AMT} - {562132800 -10800 1 AMST} - {571201200 -14400 0 AMT} - {590036400 -14400 0 AMT} - {749188800 -14400 0 AMT} - {750830400 -10800 1 AMST} - {761713200 -14400 0 AMT} - {780202800 -14400 0 AMT} + {-1767211196 -14400 0 -04} + {-1206954000 -10800 1 -03} + {-1191358800 -14400 0 -04} + {-1175371200 -10800 1 -03} + {-1159822800 -14400 0 -04} + {-633816000 -10800 1 -03} + {-622065600 -14400 0 -04} + {-602280000 -10800 1 -03} + {-591829200 -14400 0 -04} + {-570744000 -10800 1 -03} + {-560206800 -14400 0 -04} + {-539121600 -10800 1 -03} + {-531349200 -14400 0 -04} + {-191361600 -10800 1 -03} + {-184194000 -14400 0 -04} + {-155160000 -10800 1 -03} + {-150066000 -14400 0 -04} + {-128894400 -10800 1 -03} + {-121122000 -14400 0 -04} + {-99950400 -10800 1 -03} + {-89586000 -14400 0 -04} + {-68414400 -10800 1 -03} + {-57963600 -14400 0 -04} + {499752000 -10800 1 -03} + {511239600 -14400 0 -04} + {530596800 -10800 1 -03} + {540270000 -14400 0 -04} + {562132800 -10800 1 -03} + {571201200 -14400 0 -04} + {590036400 -14400 0 -04} + {749188800 -14400 0 -04} + {750830400 -10800 1 -03} + {761713200 -14400 0 -04} + {780202800 -14400 0 -04} } diff --git a/library/tzdata/America/Miquelon b/library/tzdata/America/Miquelon index a7410f1..c299be6 100644 --- a/library/tzdata/America/Miquelon +++ b/library/tzdata/America/Miquelon @@ -3,232 +3,232 @@ set TZData(:America/Miquelon) { {-9223372036854775808 -13480 0 LMT} {-1850328920 -14400 0 AST} - {326001600 -10800 0 PMST} - {536468400 -10800 0 PMST} - {544597200 -7200 1 PMDT} - {562132800 -10800 0 PMST} - {576046800 -7200 1 PMDT} - {594187200 -10800 0 PMST} - {607496400 -7200 1 PMDT} - {625636800 -10800 0 PMST} - {638946000 -7200 1 PMDT} - {657086400 -10800 0 PMST} - {671000400 -7200 1 PMDT} - {688536000 -10800 0 PMST} - {702450000 -7200 1 PMDT} - {719985600 -10800 0 PMST} - {733899600 -7200 1 PMDT} - {752040000 -10800 0 PMST} - {765349200 -7200 1 PMDT} - {783489600 -10800 0 PMST} - {796798800 -7200 1 PMDT} - {814939200 -10800 0 PMST} - {828853200 -7200 1 PMDT} - {846388800 -10800 0 PMST} - {860302800 -7200 1 PMDT} - {877838400 -10800 0 PMST} - {891752400 -7200 1 PMDT} - {909288000 -10800 0 PMST} - {923202000 -7200 1 PMDT} - {941342400 -10800 0 PMST} - {954651600 -7200 1 PMDT} - {972792000 -10800 0 PMST} - {986101200 -7200 1 PMDT} - {1004241600 -10800 0 PMST} - {1018155600 -7200 1 PMDT} - {1035691200 -10800 0 PMST} - {1049605200 -7200 1 PMDT} - {1067140800 -10800 0 PMST} - {1081054800 -7200 1 PMDT} - {1099195200 -10800 0 PMST} - {1112504400 -7200 1 PMDT} - {1130644800 -10800 0 PMST} - {1143954000 -7200 1 PMDT} - {1162094400 -10800 0 PMST} - {1173589200 -7200 1 PMDT} - {1194148800 -10800 0 PMST} - {1205038800 -7200 1 PMDT} - {1225598400 -10800 0 PMST} - {1236488400 -7200 1 PMDT} - {1257048000 -10800 0 PMST} - {1268542800 -7200 1 PMDT} - {1289102400 -10800 0 PMST} - {1299992400 -7200 1 PMDT} - {1320552000 -10800 0 PMST} - {1331442000 -7200 1 PMDT} - {1352001600 -10800 0 PMST} - {1362891600 -7200 1 PMDT} - {1383451200 -10800 0 PMST} - {1394341200 -7200 1 PMDT} - {1414900800 -10800 0 PMST} - {1425790800 -7200 1 PMDT} - {1446350400 -10800 0 PMST} - {1457845200 -7200 1 PMDT} - {1478404800 -10800 0 PMST} - {1489294800 -7200 1 PMDT} - {1509854400 -10800 0 PMST} - {1520744400 -7200 1 PMDT} - {1541304000 -10800 0 PMST} - {1552194000 -7200 1 PMDT} - {1572753600 -10800 0 PMST} - {1583643600 -7200 1 PMDT} - {1604203200 -10800 0 PMST} - {1615698000 -7200 1 PMDT} - {1636257600 -10800 0 PMST} - {1647147600 -7200 1 PMDT} - {1667707200 -10800 0 PMST} - {1678597200 -7200 1 PMDT} - {1699156800 -10800 0 PMST} - {1710046800 -7200 1 PMDT} - {1730606400 -10800 0 PMST} - {1741496400 -7200 1 PMDT} - {1762056000 -10800 0 PMST} - {1772946000 -7200 1 PMDT} - {1793505600 -10800 0 PMST} - {1805000400 -7200 1 PMDT} - {1825560000 -10800 0 PMST} - {1836450000 -7200 1 PMDT} - {1857009600 -10800 0 PMST} - {1867899600 -7200 1 PMDT} - {1888459200 -10800 0 PMST} - {1899349200 -7200 1 PMDT} - {1919908800 -10800 0 PMST} - {1930798800 -7200 1 PMDT} - {1951358400 -10800 0 PMST} - {1962853200 -7200 1 PMDT} - {1983412800 -10800 0 PMST} - {1994302800 -7200 1 PMDT} - {2014862400 -10800 0 PMST} - {2025752400 -7200 1 PMDT} - {2046312000 -10800 0 PMST} - {2057202000 -7200 1 PMDT} - {2077761600 -10800 0 PMST} - {2088651600 -7200 1 PMDT} - {2109211200 -10800 0 PMST} - {2120101200 -7200 1 PMDT} - {2140660800 -10800 0 PMST} - {2152155600 -7200 1 PMDT} - {2172715200 -10800 0 PMST} - {2183605200 -7200 1 PMDT} - {2204164800 -10800 0 PMST} - {2215054800 -7200 1 PMDT} - {2235614400 -10800 0 PMST} - {2246504400 -7200 1 PMDT} - {2267064000 -10800 0 PMST} - {2277954000 -7200 1 PMDT} - {2298513600 -10800 0 PMST} - {2309403600 -7200 1 PMDT} - {2329963200 -10800 0 PMST} - {2341458000 -7200 1 PMDT} - {2362017600 -10800 0 PMST} - {2372907600 -7200 1 PMDT} - {2393467200 -10800 0 PMST} - {2404357200 -7200 1 PMDT} - {2424916800 -10800 0 PMST} - {2435806800 -7200 1 PMDT} - {2456366400 -10800 0 PMST} - {2467256400 -7200 1 PMDT} - {2487816000 -10800 0 PMST} - {2499310800 -7200 1 PMDT} - {2519870400 -10800 0 PMST} - {2530760400 -7200 1 PMDT} - {2551320000 -10800 0 PMST} - {2562210000 -7200 1 PMDT} - {2582769600 -10800 0 PMST} - {2593659600 -7200 1 PMDT} - {2614219200 -10800 0 PMST} - {2625109200 -7200 1 PMDT} - {2645668800 -10800 0 PMST} - {2656558800 -7200 1 PMDT} - {2677118400 -10800 0 PMST} - {2688613200 -7200 1 PMDT} - {2709172800 -10800 0 PMST} - {2720062800 -7200 1 PMDT} - {2740622400 -10800 0 PMST} - {2751512400 -7200 1 PMDT} - {2772072000 -10800 0 PMST} - {2782962000 -7200 1 PMDT} - {2803521600 -10800 0 PMST} - {2814411600 -7200 1 PMDT} - {2834971200 -10800 0 PMST} - {2846466000 -7200 1 PMDT} - {2867025600 -10800 0 PMST} - {2877915600 -7200 1 PMDT} - {2898475200 -10800 0 PMST} - {2909365200 -7200 1 PMDT} - {2929924800 -10800 0 PMST} - {2940814800 -7200 1 PMDT} - {2961374400 -10800 0 PMST} - {2972264400 -7200 1 PMDT} - {2992824000 -10800 0 PMST} - {3003714000 -7200 1 PMDT} - {3024273600 -10800 0 PMST} - {3035768400 -7200 1 PMDT} - {3056328000 -10800 0 PMST} - {3067218000 -7200 1 PMDT} - {3087777600 -10800 0 PMST} - {3098667600 -7200 1 PMDT} - {3119227200 -10800 0 PMST} - {3130117200 -7200 1 PMDT} - {3150676800 -10800 0 PMST} - {3161566800 -7200 1 PMDT} - {3182126400 -10800 0 PMST} - {3193016400 -7200 1 PMDT} - {3213576000 -10800 0 PMST} - {3225070800 -7200 1 PMDT} - {3245630400 -10800 0 PMST} - {3256520400 -7200 1 PMDT} - {3277080000 -10800 0 PMST} - {3287970000 -7200 1 PMDT} - {3308529600 -10800 0 PMST} - {3319419600 -7200 1 PMDT} - {3339979200 -10800 0 PMST} - {3350869200 -7200 1 PMDT} - {3371428800 -10800 0 PMST} - {3382923600 -7200 1 PMDT} - {3403483200 -10800 0 PMST} - {3414373200 -7200 1 PMDT} - {3434932800 -10800 0 PMST} - {3445822800 -7200 1 PMDT} - {3466382400 -10800 0 PMST} - {3477272400 -7200 1 PMDT} - {3497832000 -10800 0 PMST} - {3508722000 -7200 1 PMDT} - {3529281600 -10800 0 PMST} - {3540171600 -7200 1 PMDT} - {3560731200 -10800 0 PMST} - {3572226000 -7200 1 PMDT} - {3592785600 -10800 0 PMST} - {3603675600 -7200 1 PMDT} - {3624235200 -10800 0 PMST} - {3635125200 -7200 1 PMDT} - {3655684800 -10800 0 PMST} - {3666574800 -7200 1 PMDT} - {3687134400 -10800 0 PMST} - {3698024400 -7200 1 PMDT} - {3718584000 -10800 0 PMST} - {3730078800 -7200 1 PMDT} - {3750638400 -10800 0 PMST} - {3761528400 -7200 1 PMDT} - {3782088000 -10800 0 PMST} - {3792978000 -7200 1 PMDT} - {3813537600 -10800 0 PMST} - {3824427600 -7200 1 PMDT} - {3844987200 -10800 0 PMST} - {3855877200 -7200 1 PMDT} - {3876436800 -10800 0 PMST} - {3887326800 -7200 1 PMDT} - {3907886400 -10800 0 PMST} - {3919381200 -7200 1 PMDT} - {3939940800 -10800 0 PMST} - {3950830800 -7200 1 PMDT} - {3971390400 -10800 0 PMST} - {3982280400 -7200 1 PMDT} - {4002840000 -10800 0 PMST} - {4013730000 -7200 1 PMDT} - {4034289600 -10800 0 PMST} - {4045179600 -7200 1 PMDT} - {4065739200 -10800 0 PMST} - {4076629200 -7200 1 PMDT} - {4097188800 -10800 0 PMST} + {326001600 -10800 0 -03} + {536468400 -10800 0 -02} + {544597200 -7200 1 -02} + {562132800 -10800 0 -02} + {576046800 -7200 1 -02} + {594187200 -10800 0 -02} + {607496400 -7200 1 -02} + {625636800 -10800 0 -02} + {638946000 -7200 1 -02} + {657086400 -10800 0 -02} + {671000400 -7200 1 -02} + {688536000 -10800 0 -02} + {702450000 -7200 1 -02} + {719985600 -10800 0 -02} + {733899600 -7200 1 -02} + {752040000 -10800 0 -02} + {765349200 -7200 1 -02} + {783489600 -10800 0 -02} + {796798800 -7200 1 -02} + {814939200 -10800 0 -02} + {828853200 -7200 1 -02} + {846388800 -10800 0 -02} + {860302800 -7200 1 -02} + {877838400 -10800 0 -02} + {891752400 -7200 1 -02} + {909288000 -10800 0 -02} + {923202000 -7200 1 -02} + {941342400 -10800 0 -02} + {954651600 -7200 1 -02} + {972792000 -10800 0 -02} + {986101200 -7200 1 -02} + {1004241600 -10800 0 -02} + {1018155600 -7200 1 -02} + {1035691200 -10800 0 -02} + {1049605200 -7200 1 -02} + {1067140800 -10800 0 -02} + {1081054800 -7200 1 -02} + {1099195200 -10800 0 -02} + {1112504400 -7200 1 -02} + {1130644800 -10800 0 -02} + {1143954000 -7200 1 -02} + {1162094400 -10800 0 -02} + {1173589200 -7200 1 -02} + {1194148800 -10800 0 -02} + {1205038800 -7200 1 -02} + {1225598400 -10800 0 -02} + {1236488400 -7200 1 -02} + {1257048000 -10800 0 -02} + {1268542800 -7200 1 -02} + {1289102400 -10800 0 -02} + {1299992400 -7200 1 -02} + {1320552000 -10800 0 -02} + {1331442000 -7200 1 -02} + {1352001600 -10800 0 -02} + {1362891600 -7200 1 -02} + {1383451200 -10800 0 -02} + {1394341200 -7200 1 -02} + {1414900800 -10800 0 -02} + {1425790800 -7200 1 -02} + {1446350400 -10800 0 -02} + {1457845200 -7200 1 -02} + {1478404800 -10800 0 -02} + {1489294800 -7200 1 -02} + {1509854400 -10800 0 -02} + {1520744400 -7200 1 -02} + {1541304000 -10800 0 -02} + {1552194000 -7200 1 -02} + {1572753600 -10800 0 -02} + {1583643600 -7200 1 -02} + {1604203200 -10800 0 -02} + {1615698000 -7200 1 -02} + {1636257600 -10800 0 -02} + {1647147600 -7200 1 -02} + {1667707200 -10800 0 -02} + {1678597200 -7200 1 -02} + {1699156800 -10800 0 -02} + {1710046800 -7200 1 -02} + {1730606400 -10800 0 -02} + {1741496400 -7200 1 -02} + {1762056000 -10800 0 -02} + {1772946000 -7200 1 -02} + {1793505600 -10800 0 -02} + {1805000400 -7200 1 -02} + {1825560000 -10800 0 -02} + {1836450000 -7200 1 -02} + {1857009600 -10800 0 -02} + {1867899600 -7200 1 -02} + {1888459200 -10800 0 -02} + {1899349200 -7200 1 -02} + {1919908800 -10800 0 -02} + {1930798800 -7200 1 -02} + {1951358400 -10800 0 -02} + {1962853200 -7200 1 -02} + {1983412800 -10800 0 -02} + {1994302800 -7200 1 -02} + {2014862400 -10800 0 -02} + {2025752400 -7200 1 -02} + {2046312000 -10800 0 -02} + {2057202000 -7200 1 -02} + {2077761600 -10800 0 -02} + {2088651600 -7200 1 -02} + {2109211200 -10800 0 -02} + {2120101200 -7200 1 -02} + {2140660800 -10800 0 -02} + {2152155600 -7200 1 -02} + {2172715200 -10800 0 -02} + {2183605200 -7200 1 -02} + {2204164800 -10800 0 -02} + {2215054800 -7200 1 -02} + {2235614400 -10800 0 -02} + {2246504400 -7200 1 -02} + {2267064000 -10800 0 -02} + {2277954000 -7200 1 -02} + {2298513600 -10800 0 -02} + {2309403600 -7200 1 -02} + {2329963200 -10800 0 -02} + {2341458000 -7200 1 -02} + {2362017600 -10800 0 -02} + {2372907600 -7200 1 -02} + {2393467200 -10800 0 -02} + {2404357200 -7200 1 -02} + {2424916800 -10800 0 -02} + {2435806800 -7200 1 -02} + {2456366400 -10800 0 -02} + {2467256400 -7200 1 -02} + {2487816000 -10800 0 -02} + {2499310800 -7200 1 -02} + {2519870400 -10800 0 -02} + {2530760400 -7200 1 -02} + {2551320000 -10800 0 -02} + {2562210000 -7200 1 -02} + {2582769600 -10800 0 -02} + {2593659600 -7200 1 -02} + {2614219200 -10800 0 -02} + {2625109200 -7200 1 -02} + {2645668800 -10800 0 -02} + {2656558800 -7200 1 -02} + {2677118400 -10800 0 -02} + {2688613200 -7200 1 -02} + {2709172800 -10800 0 -02} + {2720062800 -7200 1 -02} + {2740622400 -10800 0 -02} + {2751512400 -7200 1 -02} + {2772072000 -10800 0 -02} + {2782962000 -7200 1 -02} + {2803521600 -10800 0 -02} + {2814411600 -7200 1 -02} + {2834971200 -10800 0 -02} + {2846466000 -7200 1 -02} + {2867025600 -10800 0 -02} + {2877915600 -7200 1 -02} + {2898475200 -10800 0 -02} + {2909365200 -7200 1 -02} + {2929924800 -10800 0 -02} + {2940814800 -7200 1 -02} + {2961374400 -10800 0 -02} + {2972264400 -7200 1 -02} + {2992824000 -10800 0 -02} + {3003714000 -7200 1 -02} + {3024273600 -10800 0 -02} + {3035768400 -7200 1 -02} + {3056328000 -10800 0 -02} + {3067218000 -7200 1 -02} + {3087777600 -10800 0 -02} + {3098667600 -7200 1 -02} + {3119227200 -10800 0 -02} + {3130117200 -7200 1 -02} + {3150676800 -10800 0 -02} + {3161566800 -7200 1 -02} + {3182126400 -10800 0 -02} + {3193016400 -7200 1 -02} + {3213576000 -10800 0 -02} + {3225070800 -7200 1 -02} + {3245630400 -10800 0 -02} + {3256520400 -7200 1 -02} + {3277080000 -10800 0 -02} + {3287970000 -7200 1 -02} + {3308529600 -10800 0 -02} + {3319419600 -7200 1 -02} + {3339979200 -10800 0 -02} + {3350869200 -7200 1 -02} + {3371428800 -10800 0 -02} + {3382923600 -7200 1 -02} + {3403483200 -10800 0 -02} + {3414373200 -7200 1 -02} + {3434932800 -10800 0 -02} + {3445822800 -7200 1 -02} + {3466382400 -10800 0 -02} + {3477272400 -7200 1 -02} + {3497832000 -10800 0 -02} + {3508722000 -7200 1 -02} + {3529281600 -10800 0 -02} + {3540171600 -7200 1 -02} + {3560731200 -10800 0 -02} + {3572226000 -7200 1 -02} + {3592785600 -10800 0 -02} + {3603675600 -7200 1 -02} + {3624235200 -10800 0 -02} + {3635125200 -7200 1 -02} + {3655684800 -10800 0 -02} + {3666574800 -7200 1 -02} + {3687134400 -10800 0 -02} + {3698024400 -7200 1 -02} + {3718584000 -10800 0 -02} + {3730078800 -7200 1 -02} + {3750638400 -10800 0 -02} + {3761528400 -7200 1 -02} + {3782088000 -10800 0 -02} + {3792978000 -7200 1 -02} + {3813537600 -10800 0 -02} + {3824427600 -7200 1 -02} + {3844987200 -10800 0 -02} + {3855877200 -7200 1 -02} + {3876436800 -10800 0 -02} + {3887326800 -7200 1 -02} + {3907886400 -10800 0 -02} + {3919381200 -7200 1 -02} + {3939940800 -10800 0 -02} + {3950830800 -7200 1 -02} + {3971390400 -10800 0 -02} + {3982280400 -7200 1 -02} + {4002840000 -10800 0 -02} + {4013730000 -7200 1 -02} + {4034289600 -10800 0 -02} + {4045179600 -7200 1 -02} + {4065739200 -10800 0 -02} + {4076629200 -7200 1 -02} + {4097188800 -10800 0 -02} } diff --git a/library/tzdata/America/Montevideo b/library/tzdata/America/Montevideo index 91a5117..ff85fb3 100644 --- a/library/tzdata/America/Montevideo +++ b/library/tzdata/America/Montevideo @@ -3,90 +3,94 @@ set TZData(:America/Montevideo) { {-9223372036854775808 -13484 0 LMT} {-2256668116 -13484 0 MMT} - {-1567455316 -12600 0 UYT} - {-1459542600 -10800 1 UYHST} - {-1443819600 -12600 0 UYT} - {-1428006600 -10800 1 UYHST} - {-1412283600 -12600 0 UYT} - {-1396470600 -10800 1 UYHST} - {-1380747600 -12600 0 UYT} - {-1141590600 -10800 1 UYHST} - {-1128286800 -12600 0 UYT} - {-1110141000 -10800 1 UYHST} - {-1096837200 -12600 0 UYT} - {-1078691400 -10800 1 UYHST} - {-1065387600 -12600 0 UYT} - {-1046637000 -10800 1 UYHST} - {-1033938000 -12600 0 UYT} - {-1015187400 -10800 1 UYHST} - {-1002488400 -12600 0 UYT} - {-983737800 -10800 1 UYHST} - {-971038800 -12600 0 UYT} - {-952288200 -10800 1 UYHST} - {-938984400 -12600 0 UYT} - {-920838600 -10800 1 UYHST} - {-907534800 -12600 0 UYT} - {-896819400 -10800 1 UYHST} - {-853623000 -10800 0 UYT} - {-853621200 -7200 1 UYST} - {-845848800 -10800 0 UYT} - {-334789200 -7200 1 UYST} - {-319672800 -10800 0 UYT} - {-314226000 -7200 1 UYST} - {-309996000 -10800 0 UYT} - {-149720400 -7200 1 UYST} - {-134604000 -10800 0 UYT} - {-118270800 -7200 1 UYST} - {-100044000 -10800 0 UYT} - {-86821200 -7200 1 UYST} - {-68508000 -10800 0 UYT} - {-50446800 -9000 1 UYHST} - {-34119000 -10800 0 UYT} - {-18910800 -9000 1 UYHST} - {-2583000 -10800 0 UYT} - {12625200 -9000 1 UYHST} - {28953000 -10800 0 UYT} - {72932400 -7200 1 UYST} - {82692000 -10800 0 UYT} - {132116400 -9000 1 UYHST} - {156911400 -7200 1 UYST} - {212983200 -10800 0 UYT} - {250052400 -7200 1 UYST} - {260244000 -10800 0 UYT} - {307594800 -7200 1 UYST} - {325994400 -10800 0 UYT} - {566449200 -7200 1 UYST} - {574308000 -10800 0 UYT} - {597812400 -7200 1 UYST} - {605671200 -10800 0 UYT} - {625633200 -7200 1 UYST} - {636516000 -10800 0 UYT} - {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} - {1128834000 -7200 1 UYST} - {1142136000 -10800 0 UYT} - {1159678800 -7200 1 UYST} - {1173585600 -10800 0 UYT} - {1191733200 -7200 1 UYST} - {1205035200 -10800 0 UYT} - {1223182800 -7200 1 UYST} - {1236484800 -10800 0 UYT} - {1254632400 -7200 1 UYST} - {1268539200 -10800 0 UYT} - {1286082000 -7200 1 UYST} - {1299988800 -10800 0 UYT} - {1317531600 -7200 1 UYST} - {1331438400 -10800 0 UYT} - {1349586000 -7200 1 UYST} - {1362888000 -10800 0 UYT} - {1381035600 -7200 1 UYST} - {1394337600 -10800 0 UYT} - {1412485200 -7200 1 UYST} - {1425787200 -10800 0 UYT} + {-1567455316 -12600 0 -0330} + {-1459542600 -10800 1 -03} + {-1443819600 -12600 0 -0330} + {-1428006600 -10800 1 -03} + {-1412283600 -12600 0 -0330} + {-1396470600 -10800 1 -03} + {-1380747600 -12600 0 -0330} + {-1141590600 -10800 1 -03} + {-1128286800 -12600 0 -0330} + {-1110141000 -10800 1 -03} + {-1096837200 -12600 0 -0330} + {-1078691400 -10800 1 -03} + {-1065387600 -12600 0 -0330} + {-1046637000 -10800 1 -03} + {-1033938000 -12600 0 -0330} + {-1015187400 -10800 1 -03} + {-1002488400 -12600 0 -0330} + {-983737800 -10800 1 -03} + {-971038800 -12600 0 -0330} + {-952288200 -10800 1 -03} + {-938984400 -12600 0 -0330} + {-920838600 -10800 1 -03} + {-907534800 -12600 0 -0330} + {-896819400 -10800 1 -03} + {-853623000 -10800 0 -03} + {-853621200 -7200 1 -02} + {-845848800 -10800 0 -03} + {-334789200 -7200 1 -02} + {-319672800 -10800 0 -03} + {-314226000 -7200 1 -02} + {-309996000 -10800 0 -03} + {-149720400 -7200 1 -02} + {-134604000 -10800 0 -03} + {-118270800 -7200 1 -02} + {-100044000 -10800 0 -03} + {-86821200 -7200 1 -02} + {-68508000 -10800 0 -03} + {-63147600 -10800 0 -03} + {-50446800 -9000 1 -0230} + {-34119000 -10800 0 -03} + {-18910800 -9000 1 -0230} + {-2583000 -10800 0 -03} + {12625200 -9000 1 -0230} + {28953000 -10800 0 -03} + {31546800 -10800 0 -03} + {72932400 -7200 1 -02} + {82692000 -10800 0 -03} + {126241200 -10800 0 -03} + {132116400 -9000 1 -0230} + {156909600 -9000 0 -02} + {156911400 -7200 1 -02} + {212983200 -10800 0 -03} + {250052400 -7200 1 -02} + {260244000 -10800 0 -03} + {307594800 -7200 1 -02} + {325994400 -10800 0 -03} + {566449200 -7200 1 -02} + {574308000 -10800 0 -03} + {597812400 -7200 1 -02} + {605671200 -10800 0 -03} + {625633200 -7200 1 -02} + {636516000 -10800 0 -03} + {656478000 -7200 1 -02} + {667965600 -10800 0 -03} + {688532400 -7200 1 -02} + {699415200 -10800 0 -03} + {719377200 -7200 1 -02} + {730864800 -10800 0 -03} + {1095562800 -7200 1 -02} + {1111896000 -10800 0 -03} + {1128834000 -7200 1 -02} + {1142136000 -10800 0 -03} + {1159678800 -7200 1 -02} + {1173585600 -10800 0 -03} + {1191733200 -7200 1 -02} + {1205035200 -10800 0 -03} + {1223182800 -7200 1 -02} + {1236484800 -10800 0 -03} + {1254632400 -7200 1 -02} + {1268539200 -10800 0 -03} + {1286082000 -7200 1 -02} + {1299988800 -10800 0 -03} + {1317531600 -7200 1 -02} + {1331438400 -10800 0 -03} + {1349586000 -7200 1 -02} + {1362888000 -10800 0 -03} + {1381035600 -7200 1 -02} + {1394337600 -10800 0 -03} + {1412485200 -7200 1 -02} + {1425787200 -10800 0 -03} } diff --git a/library/tzdata/America/Noronha b/library/tzdata/America/Noronha index 94d6f42..f24b412 100644 --- a/library/tzdata/America/Noronha +++ b/library/tzdata/America/Noronha @@ -2,47 +2,47 @@ set TZData(:America/Noronha) { {-9223372036854775808 -7780 0 LMT} - {-1767217820 -7200 0 FNT} - {-1206961200 -3600 1 FNST} - {-1191366000 -7200 0 FNT} - {-1175378400 -3600 1 FNST} - {-1159830000 -7200 0 FNT} - {-633823200 -3600 1 FNST} - {-622072800 -7200 0 FNT} - {-602287200 -3600 1 FNST} - {-591836400 -7200 0 FNT} - {-570751200 -3600 1 FNST} - {-560214000 -7200 0 FNT} - {-539128800 -3600 1 FNST} - {-531356400 -7200 0 FNT} - {-191368800 -3600 1 FNST} - {-184201200 -7200 0 FNT} - {-155167200 -3600 1 FNST} - {-150073200 -7200 0 FNT} - {-128901600 -3600 1 FNST} - {-121129200 -7200 0 FNT} - {-99957600 -3600 1 FNST} - {-89593200 -7200 0 FNT} - {-68421600 -3600 1 FNST} - {-57970800 -7200 0 FNT} - {499744800 -3600 1 FNST} - {511232400 -7200 0 FNT} - {530589600 -3600 1 FNST} - {540262800 -7200 0 FNT} - {562125600 -3600 1 FNST} - {571194000 -7200 0 FNT} - {592970400 -3600 1 FNST} - {602038800 -7200 0 FNT} - {624420000 -3600 1 FNST} - {634698000 -7200 0 FNT} - {653533200 -7200 0 FNT} - {938656800 -7200 0 FNT} - {938916000 -3600 1 FNST} - {951613200 -7200 0 FNT} - {970970400 -3600 1 FNST} - {971571600 -7200 0 FNT} - {1000346400 -7200 0 FNT} - {1003024800 -3600 1 FNST} - {1013907600 -7200 0 FNT} - {1033434000 -7200 0 FNT} + {-1767217820 -7200 0 -02} + {-1206961200 -3600 1 -01} + {-1191366000 -7200 0 -02} + {-1175378400 -3600 1 -01} + {-1159830000 -7200 0 -02} + {-633823200 -3600 1 -01} + {-622072800 -7200 0 -02} + {-602287200 -3600 1 -01} + {-591836400 -7200 0 -02} + {-570751200 -3600 1 -01} + {-560214000 -7200 0 -02} + {-539128800 -3600 1 -01} + {-531356400 -7200 0 -02} + {-191368800 -3600 1 -01} + {-184201200 -7200 0 -02} + {-155167200 -3600 1 -01} + {-150073200 -7200 0 -02} + {-128901600 -3600 1 -01} + {-121129200 -7200 0 -02} + {-99957600 -3600 1 -01} + {-89593200 -7200 0 -02} + {-68421600 -3600 1 -01} + {-57970800 -7200 0 -02} + {499744800 -3600 1 -01} + {511232400 -7200 0 -02} + {530589600 -3600 1 -01} + {540262800 -7200 0 -02} + {562125600 -3600 1 -01} + {571194000 -7200 0 -02} + {592970400 -3600 1 -01} + {602038800 -7200 0 -02} + {624420000 -3600 1 -01} + {634698000 -7200 0 -02} + {653533200 -7200 0 -02} + {938656800 -7200 0 -02} + {938916000 -3600 1 -01} + {951613200 -7200 0 -02} + {970970400 -3600 1 -01} + {971571600 -7200 0 -02} + {1000346400 -7200 0 -02} + {1003024800 -3600 1 -01} + {1013907600 -7200 0 -02} + {1033434000 -7200 0 -02} } diff --git a/library/tzdata/America/Paramaribo b/library/tzdata/America/Paramaribo index d15f5c7..7a80f1d 100644 --- a/library/tzdata/America/Paramaribo +++ b/library/tzdata/America/Paramaribo @@ -4,7 +4,6 @@ set TZData(:America/Paramaribo) { {-9223372036854775808 -13240 0 LMT} {-1861906760 -13252 0 PMT} {-1104524348 -13236 0 PMT} - {-765317964 -12600 0 NEGT} - {185686200 -12600 0 SRT} - {465449400 -10800 0 SRT} + {-765317964 -12600 0 -0330} + {465449400 -10800 0 -03} } diff --git a/library/tzdata/America/Port-au-Prince b/library/tzdata/America/Port-au-Prince index b8b60d6..23e7de4 100644 --- a/library/tzdata/America/Port-au-Prince +++ b/library/tzdata/America/Port-au-Prince @@ -46,4 +46,170 @@ set TZData(:America/Port-au-Prince) { {1414908000 -18000 0 EST} {1425798000 -14400 1 EDT} {1446357600 -18000 0 EST} + {1489302000 -14400 1 EDT} + {1509861600 -18000 0 EST} + {1520751600 -14400 1 EDT} + {1541311200 -18000 0 EST} + {1552201200 -14400 1 EDT} + {1572760800 -18000 0 EST} + {1583650800 -14400 1 EDT} + {1604210400 -18000 0 EST} + {1615705200 -14400 1 EDT} + {1636264800 -18000 0 EST} + {1647154800 -14400 1 EDT} + {1667714400 -18000 0 EST} + {1678604400 -14400 1 EDT} + {1699164000 -18000 0 EST} + {1710054000 -14400 1 EDT} + {1730613600 -18000 0 EST} + {1741503600 -14400 1 EDT} + {1762063200 -18000 0 EST} + {1772953200 -14400 1 EDT} + {1793512800 -18000 0 EST} + {1805007600 -14400 1 EDT} + {1825567200 -18000 0 EST} + {1836457200 -14400 1 EDT} + {1857016800 -18000 0 EST} + {1867906800 -14400 1 EDT} + {1888466400 -18000 0 EST} + {1899356400 -14400 1 EDT} + {1919916000 -18000 0 EST} + {1930806000 -14400 1 EDT} + {1951365600 -18000 0 EST} + {1962860400 -14400 1 EDT} + {1983420000 -18000 0 EST} + {1994310000 -14400 1 EDT} + {2014869600 -18000 0 EST} + {2025759600 -14400 1 EDT} + {2046319200 -18000 0 EST} + {2057209200 -14400 1 EDT} + {2077768800 -18000 0 EST} + {2088658800 -14400 1 EDT} + {2109218400 -18000 0 EST} + {2120108400 -14400 1 EDT} + {2140668000 -18000 0 EST} + {2152162800 -14400 1 EDT} + {2172722400 -18000 0 EST} + {2183612400 -14400 1 EDT} + {2204172000 -18000 0 EST} + {2215062000 -14400 1 EDT} + {2235621600 -18000 0 EST} + {2246511600 -14400 1 EDT} + {2267071200 -18000 0 EST} + {2277961200 -14400 1 EDT} + {2298520800 -18000 0 EST} + {2309410800 -14400 1 EDT} + {2329970400 -18000 0 EST} + {2341465200 -14400 1 EDT} + {2362024800 -18000 0 EST} + {2372914800 -14400 1 EDT} + {2393474400 -18000 0 EST} + {2404364400 -14400 1 EDT} + {2424924000 -18000 0 EST} + {2435814000 -14400 1 EDT} + {2456373600 -18000 0 EST} + {2467263600 -14400 1 EDT} + {2487823200 -18000 0 EST} + {2499318000 -14400 1 EDT} + {2519877600 -18000 0 EST} + {2530767600 -14400 1 EDT} + {2551327200 -18000 0 EST} + {2562217200 -14400 1 EDT} + {2582776800 -18000 0 EST} + {2593666800 -14400 1 EDT} + {2614226400 -18000 0 EST} + {2625116400 -14400 1 EDT} + {2645676000 -18000 0 EST} + {2656566000 -14400 1 EDT} + {2677125600 -18000 0 EST} + {2688620400 -14400 1 EDT} + {2709180000 -18000 0 EST} + {2720070000 -14400 1 EDT} + {2740629600 -18000 0 EST} + {2751519600 -14400 1 EDT} + {2772079200 -18000 0 EST} + {2782969200 -14400 1 EDT} + {2803528800 -18000 0 EST} + {2814418800 -14400 1 EDT} + {2834978400 -18000 0 EST} + {2846473200 -14400 1 EDT} + {2867032800 -18000 0 EST} + {2877922800 -14400 1 EDT} + {2898482400 -18000 0 EST} + {2909372400 -14400 1 EDT} + {2929932000 -18000 0 EST} + {2940822000 -14400 1 EDT} + {2961381600 -18000 0 EST} + {2972271600 -14400 1 EDT} + {2992831200 -18000 0 EST} + {3003721200 -14400 1 EDT} + {3024280800 -18000 0 EST} + {3035775600 -14400 1 EDT} + {3056335200 -18000 0 EST} + {3067225200 -14400 1 EDT} + {3087784800 -18000 0 EST} + {3098674800 -14400 1 EDT} + {3119234400 -18000 0 EST} + {3130124400 -14400 1 EDT} + {3150684000 -18000 0 EST} + {3161574000 -14400 1 EDT} + {3182133600 -18000 0 EST} + {3193023600 -14400 1 EDT} + {3213583200 -18000 0 EST} + {3225078000 -14400 1 EDT} + {3245637600 -18000 0 EST} + {3256527600 -14400 1 EDT} + {3277087200 -18000 0 EST} + {3287977200 -14400 1 EDT} + {3308536800 -18000 0 EST} + {3319426800 -14400 1 EDT} + {3339986400 -18000 0 EST} + {3350876400 -14400 1 EDT} + {3371436000 -18000 0 EST} + {3382930800 -14400 1 EDT} + {3403490400 -18000 0 EST} + {3414380400 -14400 1 EDT} + {3434940000 -18000 0 EST} + {3445830000 -14400 1 EDT} + {3466389600 -18000 0 EST} + {3477279600 -14400 1 EDT} + {3497839200 -18000 0 EST} + {3508729200 -14400 1 EDT} + {3529288800 -18000 0 EST} + {3540178800 -14400 1 EDT} + {3560738400 -18000 0 EST} + {3572233200 -14400 1 EDT} + {3592792800 -18000 0 EST} + {3603682800 -14400 1 EDT} + {3624242400 -18000 0 EST} + {3635132400 -14400 1 EDT} + {3655692000 -18000 0 EST} + {3666582000 -14400 1 EDT} + {3687141600 -18000 0 EST} + {3698031600 -14400 1 EDT} + {3718591200 -18000 0 EST} + {3730086000 -14400 1 EDT} + {3750645600 -18000 0 EST} + {3761535600 -14400 1 EDT} + {3782095200 -18000 0 EST} + {3792985200 -14400 1 EDT} + {3813544800 -18000 0 EST} + {3824434800 -14400 1 EDT} + {3844994400 -18000 0 EST} + {3855884400 -14400 1 EDT} + {3876444000 -18000 0 EST} + {3887334000 -14400 1 EDT} + {3907893600 -18000 0 EST} + {3919388400 -14400 1 EDT} + {3939948000 -18000 0 EST} + {3950838000 -14400 1 EDT} + {3971397600 -18000 0 EST} + {3982287600 -14400 1 EDT} + {4002847200 -18000 0 EST} + {4013737200 -14400 1 EDT} + {4034296800 -18000 0 EST} + {4045186800 -14400 1 EDT} + {4065746400 -18000 0 EST} + {4076636400 -14400 1 EDT} + {4097196000 -18000 0 EST} } diff --git a/library/tzdata/America/Porto_Velho b/library/tzdata/America/Porto_Velho index ce611d2..42566ad 100644 --- a/library/tzdata/America/Porto_Velho +++ b/library/tzdata/America/Porto_Velho @@ -2,34 +2,34 @@ set TZData(:America/Porto_Velho) { {-9223372036854775808 -15336 0 LMT} - {-1767210264 -14400 0 AMT} - {-1206954000 -10800 1 AMST} - {-1191358800 -14400 0 AMT} - {-1175371200 -10800 1 AMST} - {-1159822800 -14400 0 AMT} - {-633816000 -10800 1 AMST} - {-622065600 -14400 0 AMT} - {-602280000 -10800 1 AMST} - {-591829200 -14400 0 AMT} - {-570744000 -10800 1 AMST} - {-560206800 -14400 0 AMT} - {-539121600 -10800 1 AMST} - {-531349200 -14400 0 AMT} - {-191361600 -10800 1 AMST} - {-184194000 -14400 0 AMT} - {-155160000 -10800 1 AMST} - {-150066000 -14400 0 AMT} - {-128894400 -10800 1 AMST} - {-121122000 -14400 0 AMT} - {-99950400 -10800 1 AMST} - {-89586000 -14400 0 AMT} - {-68414400 -10800 1 AMST} - {-57963600 -14400 0 AMT} - {499752000 -10800 1 AMST} - {511239600 -14400 0 AMT} - {530596800 -10800 1 AMST} - {540270000 -14400 0 AMT} - {562132800 -10800 1 AMST} - {571201200 -14400 0 AMT} - {590036400 -14400 0 AMT} + {-1767210264 -14400 0 -04} + {-1206954000 -10800 1 -03} + {-1191358800 -14400 0 -04} + {-1175371200 -10800 1 -03} + {-1159822800 -14400 0 -04} + {-633816000 -10800 1 -03} + {-622065600 -14400 0 -04} + {-602280000 -10800 1 -03} + {-591829200 -14400 0 -04} + {-570744000 -10800 1 -03} + {-560206800 -14400 0 -04} + {-539121600 -10800 1 -03} + {-531349200 -14400 0 -04} + {-191361600 -10800 1 -03} + {-184194000 -14400 0 -04} + {-155160000 -10800 1 -03} + {-150066000 -14400 0 -04} + {-128894400 -10800 1 -03} + {-121122000 -14400 0 -04} + {-99950400 -10800 1 -03} + {-89586000 -14400 0 -04} + {-68414400 -10800 1 -03} + {-57963600 -14400 0 -04} + {499752000 -10800 1 -03} + {511239600 -14400 0 -04} + {530596800 -10800 1 -03} + {540270000 -14400 0 -04} + {562132800 -10800 1 -03} + {571201200 -14400 0 -04} + {590036400 -14400 0 -04} } diff --git a/library/tzdata/America/Punta_Arenas b/library/tzdata/America/Punta_Arenas new file mode 100644 index 0000000..75487e7 --- /dev/null +++ b/library/tzdata/America/Punta_Arenas @@ -0,0 +1,122 @@ +# created by tools/tclZIC.tcl - do not edit + +set TZData(:America/Punta_Arenas) { + {-9223372036854775808 -17020 0 LMT} + {-2524504580 -16966 0 SMT} + {-1892661434 -18000 0 -05} + {-1688410800 -16966 0 SMT} + {-1619205434 -14400 0 -04} + {-1593806400 -16966 0 SMT} + {-1335986234 -18000 0 -05} + {-1335985200 -14400 1 -04} + {-1317585600 -18000 0 -05} + {-1304362800 -14400 1 -04} + {-1286049600 -18000 0 -05} + {-1272826800 -14400 1 -04} + {-1254513600 -18000 0 -05} + {-1241290800 -14400 1 -04} + {-1222977600 -18000 0 -05} + {-1209754800 -14400 1 -04} + {-1191355200 -18000 0 -05} + {-1178132400 -14400 0 -04} + {-870552000 -18000 0 -05} + {-865278000 -14400 0 -04} + {-718056000 -18000 0 -05} + {-713649600 -14400 0 -04} + {-36619200 -10800 1 -03} + {-23922000 -14400 0 -04} + {-3355200 -10800 1 -03} + {7527600 -14400 0 -04} + {24465600 -10800 1 -03} + {37767600 -14400 0 -04} + {55915200 -10800 1 -03} + {69217200 -14400 0 -04} + {87969600 -10800 1 -03} + {100666800 -14400 0 -04} + {118209600 -10800 1 -03} + {132116400 -14400 0 -04} + {150868800 -10800 1 -03} + {163566000 -14400 0 -04} + {182318400 -10800 1 -03} + {195620400 -14400 0 -04} + {213768000 -10800 1 -03} + {227070000 -14400 0 -04} + {245217600 -10800 1 -03} + {258519600 -14400 0 -04} + {277272000 -10800 1 -03} + {289969200 -14400 0 -04} + {308721600 -10800 1 -03} + {321418800 -14400 0 -04} + {340171200 -10800 1 -03} + {353473200 -14400 0 -04} + {371620800 -10800 1 -03} + {384922800 -14400 0 -04} + {403070400 -10800 1 -03} + {416372400 -14400 0 -04} + {434520000 -10800 1 -03} + {447822000 -14400 0 -04} + {466574400 -10800 1 -03} + {479271600 -14400 0 -04} + {498024000 -10800 1 -03} + {510721200 -14400 0 -04} + {529473600 -10800 1 -03} + {545194800 -14400 0 -04} + {560923200 -10800 1 -03} + {574225200 -14400 0 -04} + {592372800 -10800 1 -03} + {605674800 -14400 0 -04} + {624427200 -10800 1 -03} + {637124400 -14400 0 -04} + {653457600 -10800 1 -03} + {668574000 -14400 0 -04} + {687326400 -10800 1 -03} + {700628400 -14400 0 -04} + {718776000 -10800 1 -03} + {732078000 -14400 0 -04} + {750225600 -10800 1 -03} + {763527600 -14400 0 -04} + {781675200 -10800 1 -03} + {794977200 -14400 0 -04} + {813729600 -10800 1 -03} + {826426800 -14400 0 -04} + {845179200 -10800 1 -03} + {859690800 -14400 0 -04} + {876628800 -10800 1 -03} + {889930800 -14400 0 -04} + {906868800 -10800 1 -03} + {923194800 -14400 0 -04} + {939528000 -10800 1 -03} + {952830000 -14400 0 -04} + {971582400 -10800 1 -03} + {984279600 -14400 0 -04} + {1003032000 -10800 1 -03} + {1015729200 -14400 0 -04} + {1034481600 -10800 1 -03} + {1047178800 -14400 0 -04} + {1065931200 -10800 1 -03} + {1079233200 -14400 0 -04} + {1097380800 -10800 1 -03} + {1110682800 -14400 0 -04} + {1128830400 -10800 1 -03} + {1142132400 -14400 0 -04} + {1160884800 -10800 1 -03} + {1173582000 -14400 0 -04} + {1192334400 -10800 1 -03} + {1206846000 -14400 0 -04} + {1223784000 -10800 1 -03} + {1237086000 -14400 0 -04} + {1255233600 -10800 1 -03} + {1270350000 -14400 0 -04} + {1286683200 -10800 1 -03} + {1304823600 -14400 0 -04} + {1313899200 -10800 1 -03} + {1335668400 -14400 0 -04} + {1346558400 -10800 1 -03} + {1367118000 -14400 0 -04} + {1378612800 -10800 1 -03} + {1398567600 -14400 0 -04} + {1410062400 -10800 1 -03} + {1463281200 -14400 0 -04} + {1471147200 -10800 1 -03} + {1480820400 -10800 0 -03} +} diff --git a/library/tzdata/America/Recife b/library/tzdata/America/Recife index f6ae00e..8eae571 100644 --- a/library/tzdata/America/Recife +++ b/library/tzdata/America/Recife @@ -2,47 +2,47 @@ set TZData(:America/Recife) { {-9223372036854775808 -8376 0 LMT} - {-1767217224 -10800 0 BRT} - {-1206957600 -7200 1 BRST} - {-1191362400 -10800 0 BRT} - {-1175374800 -7200 1 BRST} - {-1159826400 -10800 0 BRT} - {-633819600 -7200 1 BRST} - {-622069200 -10800 0 BRT} - {-602283600 -7200 1 BRST} - {-591832800 -10800 0 BRT} - {-570747600 -7200 1 BRST} - {-560210400 -10800 0 BRT} - {-539125200 -7200 1 BRST} - {-531352800 -10800 0 BRT} - {-191365200 -7200 1 BRST} - {-184197600 -10800 0 BRT} - {-155163600 -7200 1 BRST} - {-150069600 -10800 0 BRT} - {-128898000 -7200 1 BRST} - {-121125600 -10800 0 BRT} - {-99954000 -7200 1 BRST} - {-89589600 -10800 0 BRT} - {-68418000 -7200 1 BRST} - {-57967200 -10800 0 BRT} - {499748400 -7200 1 BRST} - {511236000 -10800 0 BRT} - {530593200 -7200 1 BRST} - {540266400 -10800 0 BRT} - {562129200 -7200 1 BRST} - {571197600 -10800 0 BRT} - {592974000 -7200 1 BRST} - {602042400 -10800 0 BRT} - {624423600 -7200 1 BRST} - {634701600 -10800 0 BRT} - {653536800 -10800 0 BRT} - {938660400 -10800 0 BRT} - {938919600 -7200 1 BRST} - {951616800 -10800 0 BRT} - {970974000 -7200 1 BRST} - {971575200 -10800 0 BRT} - {1000350000 -10800 0 BRT} - {1003028400 -7200 1 BRST} - {1013911200 -10800 0 BRT} - {1033437600 -10800 0 BRT} + {-1767217224 -10800 0 -03} + {-1206957600 -7200 1 -02} + {-1191362400 -10800 0 -03} + {-1175374800 -7200 1 -02} + {-1159826400 -10800 0 -03} + {-633819600 -7200 1 -02} + {-622069200 -10800 0 -03} + {-602283600 -7200 1 -02} + {-591832800 -10800 0 -03} + {-570747600 -7200 1 -02} + {-560210400 -10800 0 -03} + {-539125200 -7200 1 -02} + {-531352800 -10800 0 -03} + {-191365200 -7200 1 -02} + {-184197600 -10800 0 -03} + {-155163600 -7200 1 -02} + {-150069600 -10800 0 -03} + {-128898000 -7200 1 -02} + {-121125600 -10800 0 -03} + {-99954000 -7200 1 -02} + {-89589600 -10800 0 -03} + {-68418000 -7200 1 -02} + {-57967200 -10800 0 -03} + {499748400 -7200 1 -02} + {511236000 -10800 0 -03} + {530593200 -7200 1 -02} + {540266400 -10800 0 -03} + {562129200 -7200 1 -02} + {571197600 -10800 0 -03} + {592974000 -7200 1 -02} + {602042400 -10800 0 -03} + {624423600 -7200 1 -02} + {634701600 -10800 0 -03} + {653536800 -10800 0 -03} + {938660400 -10800 0 -03} + {938919600 -7200 1 -02} + {951616800 -10800 0 -03} + {970974000 -7200 1 -02} + {971575200 -10800 0 -03} + {1000350000 -10800 0 -03} + {1003028400 -7200 1 -02} + {1013911200 -10800 0 -03} + {1033437600 -10800 0 -03} } diff --git a/library/tzdata/America/Rio_Branco b/library/tzdata/America/Rio_Branco index f0ff7fa..e3c2f31 100644 --- a/library/tzdata/America/Rio_Branco +++ b/library/tzdata/America/Rio_Branco @@ -2,36 +2,36 @@ set TZData(:America/Rio_Branco) { {-9223372036854775808 -16272 0 LMT} - {-1767209328 -18000 0 ACT} - {-1206950400 -14400 1 ACST} - {-1191355200 -18000 0 ACT} - {-1175367600 -14400 1 ACST} - {-1159819200 -18000 0 ACT} - {-633812400 -14400 1 ACST} - {-622062000 -18000 0 ACT} - {-602276400 -14400 1 ACST} - {-591825600 -18000 0 ACT} - {-570740400 -14400 1 ACST} - {-560203200 -18000 0 ACT} - {-539118000 -14400 1 ACST} - {-531345600 -18000 0 ACT} - {-191358000 -14400 1 ACST} - {-184190400 -18000 0 ACT} - {-155156400 -14400 1 ACST} - {-150062400 -18000 0 ACT} - {-128890800 -14400 1 ACST} - {-121118400 -18000 0 ACT} - {-99946800 -14400 1 ACST} - {-89582400 -18000 0 ACT} - {-68410800 -14400 1 ACST} - {-57960000 -18000 0 ACT} - {499755600 -14400 1 ACST} - {511243200 -18000 0 ACT} - {530600400 -14400 1 ACST} - {540273600 -18000 0 ACT} - {562136400 -14400 1 ACST} - {571204800 -18000 0 ACT} - {590040000 -18000 0 ACT} - {1214283600 -14400 0 AMT} - {1384056000 -18000 0 ACT} + {-1767209328 -18000 0 -05} + {-1206950400 -14400 1 -04} + {-1191355200 -18000 0 -05} + {-1175367600 -14400 1 -04} + {-1159819200 -18000 0 -05} + {-633812400 -14400 1 -04} + {-622062000 -18000 0 -05} + {-602276400 -14400 1 -04} + {-591825600 -18000 0 -05} + {-570740400 -14400 1 -04} + {-560203200 -18000 0 -05} + {-539118000 -14400 1 -04} + {-531345600 -18000 0 -05} + {-191358000 -14400 1 -04} + {-184190400 -18000 0 -05} + {-155156400 -14400 1 -04} + {-150062400 -18000 0 -05} + {-128890800 -14400 1 -04} + {-121118400 -18000 0 -05} + {-99946800 -14400 1 -04} + {-89582400 -18000 0 -05} + {-68410800 -14400 1 -04} + {-57960000 -18000 0 -05} + {499755600 -14400 1 -04} + {511243200 -18000 0 -05} + {530600400 -14400 1 -04} + {540273600 -18000 0 -05} + {562136400 -14400 1 -04} + {571204800 -18000 0 -05} + {590040000 -18000 0 -05} + {1214283600 -14400 0 -04} + {1384056000 -18000 0 -05} } diff --git a/library/tzdata/America/Santarem b/library/tzdata/America/Santarem index b6e9264..f81e9b6 100644 --- a/library/tzdata/America/Santarem +++ b/library/tzdata/America/Santarem @@ -2,35 +2,35 @@ set TZData(:America/Santarem) { {-9223372036854775808 -13128 0 LMT} - {-1767212472 -14400 0 AMT} - {-1206954000 -10800 1 AMST} - {-1191358800 -14400 0 AMT} - {-1175371200 -10800 1 AMST} - {-1159822800 -14400 0 AMT} - {-633816000 -10800 1 AMST} - {-622065600 -14400 0 AMT} - {-602280000 -10800 1 AMST} - {-591829200 -14400 0 AMT} - {-570744000 -10800 1 AMST} - {-560206800 -14400 0 AMT} - {-539121600 -10800 1 AMST} - {-531349200 -14400 0 AMT} - {-191361600 -10800 1 AMST} - {-184194000 -14400 0 AMT} - {-155160000 -10800 1 AMST} - {-150066000 -14400 0 AMT} - {-128894400 -10800 1 AMST} - {-121122000 -14400 0 AMT} - {-99950400 -10800 1 AMST} - {-89586000 -14400 0 AMT} - {-68414400 -10800 1 AMST} - {-57963600 -14400 0 AMT} - {499752000 -10800 1 AMST} - {511239600 -14400 0 AMT} - {530596800 -10800 1 AMST} - {540270000 -14400 0 AMT} - {562132800 -10800 1 AMST} - {571201200 -14400 0 AMT} - {590036400 -14400 0 AMT} - {1214280000 -10800 0 BRT} + {-1767212472 -14400 0 -04} + {-1206954000 -10800 1 -03} + {-1191358800 -14400 0 -04} + {-1175371200 -10800 1 -03} + {-1159822800 -14400 0 -04} + {-633816000 -10800 1 -03} + {-622065600 -14400 0 -04} + {-602280000 -10800 1 -03} + {-591829200 -14400 0 -04} + {-570744000 -10800 1 -03} + {-560206800 -14400 0 -04} + {-539121600 -10800 1 -03} + {-531349200 -14400 0 -04} + {-191361600 -10800 1 -03} + {-184194000 -14400 0 -04} + {-155160000 -10800 1 -03} + {-150066000 -14400 0 -04} + {-128894400 -10800 1 -03} + {-121122000 -14400 0 -04} + {-99950400 -10800 1 -03} + {-89586000 -14400 0 -04} + {-68414400 -10800 1 -03} + {-57963600 -14400 0 -04} + {499752000 -10800 1 -03} + {511239600 -14400 0 -04} + {530596800 -10800 1 -03} + {540270000 -14400 0 -04} + {562132800 -10800 1 -03} + {571201200 -14400 0 -04} + {590036400 -14400 0 -04} + {1214280000 -10800 0 -03} } diff --git a/library/tzdata/America/Santiago b/library/tzdata/America/Santiago index 3a5c0fd..95e920d 100644 --- a/library/tzdata/America/Santiago +++ b/library/tzdata/America/Santiago @@ -3,287 +3,287 @@ set TZData(:America/Santiago) { {-9223372036854775808 -16966 0 LMT} {-2524504634 -16966 0 SMT} - {-1892661434 -18000 0 CLT} + {-1892661434 -18000 0 -05} {-1688410800 -16966 0 SMT} - {-1619205434 -14400 0 CLT} + {-1619205434 -14400 0 -04} {-1593806400 -16966 0 SMT} - {-1335986234 -18000 0 CLT} - {-1335985200 -14400 1 CLST} - {-1317585600 -18000 0 CLT} - {-1304362800 -14400 1 CLST} - {-1286049600 -18000 0 CLT} - {-1272826800 -14400 1 CLST} - {-1254513600 -18000 0 CLT} - {-1241290800 -14400 1 CLST} - {-1222977600 -18000 0 CLT} - {-1209754800 -14400 1 CLST} - {-1191355200 -18000 0 CLT} - {-1178132400 -14400 0 CLT} - {-870552000 -18000 0 CLT} - {-865278000 -14400 0 CLT} - {-740520000 -10800 1 CLST} - {-736376400 -14400 0 CLT} - {-718056000 -18000 0 CLT} - {-713649600 -14400 0 CLT} - {-36619200 -10800 1 CLST} - {-23922000 -14400 0 CLT} - {-3355200 -10800 1 CLST} - {7527600 -14400 0 CLT} - {24465600 -10800 1 CLST} - {37767600 -14400 0 CLT} - {55915200 -10800 1 CLST} - {69217200 -14400 0 CLT} - {87969600 -10800 1 CLST} - {100666800 -14400 0 CLT} - {118209600 -10800 1 CLST} - {132116400 -14400 0 CLT} - {150868800 -10800 1 CLST} - {163566000 -14400 0 CLT} - {182318400 -10800 1 CLST} - {195620400 -14400 0 CLT} - {213768000 -10800 1 CLST} - {227070000 -14400 0 CLT} - {245217600 -10800 1 CLST} - {258519600 -14400 0 CLT} - {277272000 -10800 1 CLST} - {289969200 -14400 0 CLT} - {308721600 -10800 1 CLST} - {321418800 -14400 0 CLT} - {340171200 -10800 1 CLST} - {353473200 -14400 0 CLT} - {371620800 -10800 1 CLST} - {384922800 -14400 0 CLT} - {403070400 -10800 1 CLST} - {416372400 -14400 0 CLT} - {434520000 -10800 1 CLST} - {447822000 -14400 0 CLT} - {466574400 -10800 1 CLST} - {479271600 -14400 0 CLT} - {498024000 -10800 1 CLST} - {510721200 -14400 0 CLT} - {529473600 -10800 1 CLST} - {545194800 -14400 0 CLT} - {560923200 -10800 1 CLST} - {574225200 -14400 0 CLT} - {592372800 -10800 1 CLST} - {605674800 -14400 0 CLT} - {624427200 -10800 1 CLST} - {637124400 -14400 0 CLT} - {653457600 -10800 1 CLST} - {668574000 -14400 0 CLT} - {687326400 -10800 1 CLST} - {700628400 -14400 0 CLT} - {718776000 -10800 1 CLST} - {732078000 -14400 0 CLT} - {750225600 -10800 1 CLST} - {763527600 -14400 0 CLT} - {781675200 -10800 1 CLST} - {794977200 -14400 0 CLT} - {813729600 -10800 1 CLST} - {826426800 -14400 0 CLT} - {845179200 -10800 1 CLST} - {859690800 -14400 0 CLT} - {876628800 -10800 1 CLST} - {889930800 -14400 0 CLT} - {906868800 -10800 1 CLST} - {923194800 -14400 0 CLT} - {939528000 -10800 1 CLST} - {952830000 -14400 0 CLT} - {971582400 -10800 1 CLST} - {984279600 -14400 0 CLT} - {1003032000 -10800 1 CLST} - {1015729200 -14400 0 CLT} - {1034481600 -10800 1 CLST} - {1047178800 -14400 0 CLT} - {1065931200 -10800 1 CLST} - {1079233200 -14400 0 CLT} - {1097380800 -10800 1 CLST} - {1110682800 -14400 0 CLT} - {1128830400 -10800 1 CLST} - {1142132400 -14400 0 CLT} - {1160884800 -10800 1 CLST} - {1173582000 -14400 0 CLT} - {1192334400 -10800 1 CLST} - {1206846000 -14400 0 CLT} - {1223784000 -10800 1 CLST} - {1237086000 -14400 0 CLT} - {1255233600 -10800 1 CLST} - {1270350000 -14400 0 CLT} - {1286683200 -10800 1 CLST} - {1304823600 -14400 0 CLT} - {1313899200 -10800 1 CLST} - {1335668400 -14400 0 CLT} - {1346558400 -10800 1 CLST} - {1367118000 -14400 0 CLT} - {1378612800 -10800 1 CLST} - {1398567600 -14400 0 CLT} - {1410062400 -10800 1 CLST} - {1463281200 -14400 0 CLT} - {1471147200 -10800 1 CLST} - {1494730800 -14400 0 CLT} - {1502596800 -10800 1 CLST} - {1526180400 -14400 0 CLT} - {1534046400 -10800 1 CLST} - {1557630000 -14400 0 CLT} - {1565496000 -10800 1 CLST} - {1589079600 -14400 0 CLT} - {1596945600 -10800 1 CLST} - {1620529200 -14400 0 CLT} - {1629000000 -10800 1 CLST} - {1652583600 -14400 0 CLT} - {1660449600 -10800 1 CLST} - {1684033200 -14400 0 CLT} - {1691899200 -10800 1 CLST} - {1715482800 -14400 0 CLT} - {1723348800 -10800 1 CLST} - {1746932400 -14400 0 CLT} - {1754798400 -10800 1 CLST} - {1778382000 -14400 0 CLT} - {1786248000 -10800 1 CLST} - {1809831600 -14400 0 CLT} - {1818302400 -10800 1 CLST} - {1841886000 -14400 0 CLT} - {1849752000 -10800 1 CLST} - {1873335600 -14400 0 CLT} - {1881201600 -10800 1 CLST} - {1904785200 -14400 0 CLT} - {1912651200 -10800 1 CLST} - {1936234800 -14400 0 CLT} - {1944100800 -10800 1 CLST} - {1967684400 -14400 0 CLT} - {1976155200 -10800 1 CLST} - {1999738800 -14400 0 CLT} - {2007604800 -10800 1 CLST} - {2031188400 -14400 0 CLT} - {2039054400 -10800 1 CLST} - {2062638000 -14400 0 CLT} - {2070504000 -10800 1 CLST} - {2094087600 -14400 0 CLT} - {2101953600 -10800 1 CLST} - {2125537200 -14400 0 CLT} - {2133403200 -10800 1 CLST} - {2156986800 -14400 0 CLT} - {2165457600 -10800 1 CLST} - {2189041200 -14400 0 CLT} - {2196907200 -10800 1 CLST} - {2220490800 -14400 0 CLT} - {2228356800 -10800 1 CLST} - {2251940400 -14400 0 CLT} - {2259806400 -10800 1 CLST} - {2283390000 -14400 0 CLT} - {2291256000 -10800 1 CLST} - {2314839600 -14400 0 CLT} - {2322705600 -10800 1 CLST} - {2346894000 -14400 0 CLT} - {2354760000 -10800 1 CLST} - {2378343600 -14400 0 CLT} - {2386209600 -10800 1 CLST} - {2409793200 -14400 0 CLT} - {2417659200 -10800 1 CLST} - {2441242800 -14400 0 CLT} - {2449108800 -10800 1 CLST} - {2472692400 -14400 0 CLT} - {2480558400 -10800 1 CLST} - {2504142000 -14400 0 CLT} - {2512612800 -10800 1 CLST} - {2536196400 -14400 0 CLT} - {2544062400 -10800 1 CLST} - {2567646000 -14400 0 CLT} - {2575512000 -10800 1 CLST} - {2599095600 -14400 0 CLT} - {2606961600 -10800 1 CLST} - {2630545200 -14400 0 CLT} - {2638411200 -10800 1 CLST} - {2661994800 -14400 0 CLT} - {2669860800 -10800 1 CLST} - {2693444400 -14400 0 CLT} - {2701915200 -10800 1 CLST} - {2725498800 -14400 0 CLT} - {2733364800 -10800 1 CLST} - {2756948400 -14400 0 CLT} - {2764814400 -10800 1 CLST} - {2788398000 -14400 0 CLT} - {2796264000 -10800 1 CLST} - {2819847600 -14400 0 CLT} - {2827713600 -10800 1 CLST} - {2851297200 -14400 0 CLT} - {2859768000 -10800 1 CLST} - {2883351600 -14400 0 CLT} - {2891217600 -10800 1 CLST} - {2914801200 -14400 0 CLT} - {2922667200 -10800 1 CLST} - {2946250800 -14400 0 CLT} - {2954116800 -10800 1 CLST} - {2977700400 -14400 0 CLT} - {2985566400 -10800 1 CLST} - {3009150000 -14400 0 CLT} - {3017016000 -10800 1 CLST} - {3040599600 -14400 0 CLT} - {3049070400 -10800 1 CLST} - {3072654000 -14400 0 CLT} - {3080520000 -10800 1 CLST} - {3104103600 -14400 0 CLT} - {3111969600 -10800 1 CLST} - {3135553200 -14400 0 CLT} - {3143419200 -10800 1 CLST} - {3167002800 -14400 0 CLT} - {3174868800 -10800 1 CLST} - {3198452400 -14400 0 CLT} - {3206318400 -10800 1 CLST} - {3230506800 -14400 0 CLT} - {3238372800 -10800 1 CLST} - {3261956400 -14400 0 CLT} - {3269822400 -10800 1 CLST} - {3293406000 -14400 0 CLT} - {3301272000 -10800 1 CLST} - {3324855600 -14400 0 CLT} - {3332721600 -10800 1 CLST} - {3356305200 -14400 0 CLT} - {3364171200 -10800 1 CLST} - {3387754800 -14400 0 CLT} - {3396225600 -10800 1 CLST} - {3419809200 -14400 0 CLT} - {3427675200 -10800 1 CLST} - {3451258800 -14400 0 CLT} - {3459124800 -10800 1 CLST} - {3482708400 -14400 0 CLT} - {3490574400 -10800 1 CLST} - {3514158000 -14400 0 CLT} - {3522024000 -10800 1 CLST} - {3545607600 -14400 0 CLT} - {3553473600 -10800 1 CLST} - {3577057200 -14400 0 CLT} - {3585528000 -10800 1 CLST} - {3609111600 -14400 0 CLT} - {3616977600 -10800 1 CLST} - {3640561200 -14400 0 CLT} - {3648427200 -10800 1 CLST} - {3672010800 -14400 0 CLT} - {3679876800 -10800 1 CLST} - {3703460400 -14400 0 CLT} - {3711326400 -10800 1 CLST} - {3734910000 -14400 0 CLT} - {3743380800 -10800 1 CLST} - {3766964400 -14400 0 CLT} - {3774830400 -10800 1 CLST} - {3798414000 -14400 0 CLT} - {3806280000 -10800 1 CLST} - {3829863600 -14400 0 CLT} - {3837729600 -10800 1 CLST} - {3861313200 -14400 0 CLT} - {3869179200 -10800 1 CLST} - {3892762800 -14400 0 CLT} - {3900628800 -10800 1 CLST} - {3924212400 -14400 0 CLT} - {3932683200 -10800 1 CLST} - {3956266800 -14400 0 CLT} - {3964132800 -10800 1 CLST} - {3987716400 -14400 0 CLT} - {3995582400 -10800 1 CLST} - {4019166000 -14400 0 CLT} - {4027032000 -10800 1 CLST} - {4050615600 -14400 0 CLT} - {4058481600 -10800 1 CLST} - {4082065200 -14400 0 CLT} - {4089931200 -10800 1 CLST} + {-1335986234 -18000 0 -05} + {-1335985200 -14400 1 -04} + {-1317585600 -18000 0 -05} + {-1304362800 -14400 1 -04} + {-1286049600 -18000 0 -05} + {-1272826800 -14400 1 -04} + {-1254513600 -18000 0 -05} + {-1241290800 -14400 1 -04} + {-1222977600 -18000 0 -05} + {-1209754800 -14400 1 -04} + {-1191355200 -18000 0 -05} + {-1178132400 -14400 0 -04} + {-870552000 -18000 0 -05} + {-865278000 -14400 0 -04} + {-740520000 -10800 1 -03} + {-736376400 -14400 0 -04} + {-718056000 -18000 0 -05} + {-713649600 -14400 0 -04} + {-36619200 -10800 1 -03} + {-23922000 -14400 0 -04} + {-3355200 -10800 1 -03} + {7527600 -14400 0 -04} + {24465600 -10800 1 -03} + {37767600 -14400 0 -04} + {55915200 -10800 1 -03} + {69217200 -14400 0 -04} + {87969600 -10800 1 -03} + {100666800 -14400 0 -04} + {118209600 -10800 1 -03} + {132116400 -14400 0 -04} + {150868800 -10800 1 -03} + {163566000 -14400 0 -04} + {182318400 -10800 1 -03} + {195620400 -14400 0 -04} + {213768000 -10800 1 -03} + {227070000 -14400 0 -04} + {245217600 -10800 1 -03} + {258519600 -14400 0 -04} + {277272000 -10800 1 -03} + {289969200 -14400 0 -04} + {308721600 -10800 1 -03} + {321418800 -14400 0 -04} + {340171200 -10800 1 -03} + {353473200 -14400 0 -04} + {371620800 -10800 1 -03} + {384922800 -14400 0 -04} + {403070400 -10800 1 -03} + {416372400 -14400 0 -04} + {434520000 -10800 1 -03} + {447822000 -14400 0 -04} + {466574400 -10800 1 -03} + {479271600 -14400 0 -04} + {498024000 -10800 1 -03} + {510721200 -14400 0 -04} + {529473600 -10800 1 -03} + {545194800 -14400 0 -04} + {560923200 -10800 1 -03} + {574225200 -14400 0 -04} + {592372800 -10800 1 -03} + {605674800 -14400 0 -04} + {624427200 -10800 1 -03} + {637124400 -14400 0 -04} + {653457600 -10800 1 -03} + {668574000 -14400 0 -04} + {687326400 -10800 1 -03} + {700628400 -14400 0 -04} + {718776000 -10800 1 -03} + {732078000 -14400 0 -04} + {750225600 -10800 1 -03} + {763527600 -14400 0 -04} + {781675200 -10800 1 -03} + {794977200 -14400 0 -04} + {813729600 -10800 1 -03} + {826426800 -14400 0 -04} + {845179200 -10800 1 -03} + {859690800 -14400 0 -04} + {876628800 -10800 1 -03} + {889930800 -14400 0 -04} + {906868800 -10800 1 -03} + {923194800 -14400 0 -04} + {939528000 -10800 1 -03} + {952830000 -14400 0 -04} + {971582400 -10800 1 -03} + {984279600 -14400 0 -04} + {1003032000 -10800 1 -03} + {1015729200 -14400 0 -04} + {1034481600 -10800 1 -03} + {1047178800 -14400 0 -04} + {1065931200 -10800 1 -03} + {1079233200 -14400 0 -04} + {1097380800 -10800 1 -03} + {1110682800 -14400 0 -04} + {1128830400 -10800 1 -03} + {1142132400 -14400 0 -04} + {1160884800 -10800 1 -03} + {1173582000 -14400 0 -04} + {1192334400 -10800 1 -03} + {1206846000 -14400 0 -04} + {1223784000 -10800 1 -03} + {1237086000 -14400 0 -04} + {1255233600 -10800 1 -03} + {1270350000 -14400 0 -04} + {1286683200 -10800 1 -03} + {1304823600 -14400 0 -04} + {1313899200 -10800 1 -03} + {1335668400 -14400 0 -04} + {1346558400 -10800 1 -03} + {1367118000 -14400 0 -04} + {1378612800 -10800 1 -03} + {1398567600 -14400 0 -04} + {1410062400 -10800 1 -03} + {1463281200 -14400 0 -04} + {1471147200 -10800 1 -03} + {1494730800 -14400 0 -04} + {1502596800 -10800 1 -03} + {1526180400 -14400 0 -04} + {1534046400 -10800 1 -03} + {1557630000 -14400 0 -04} + {1565496000 -10800 1 -03} + {1589079600 -14400 0 -04} + {1596945600 -10800 1 -03} + {1620529200 -14400 0 -04} + {1629000000 -10800 1 -03} + {1652583600 -14400 0 -04} + {1660449600 -10800 1 -03} + {1684033200 -14400 0 -04} + {1691899200 -10800 1 -03} + {1715482800 -14400 0 -04} + {1723348800 -10800 1 -03} + {1746932400 -14400 0 -04} + {1754798400 -10800 1 -03} + {1778382000 -14400 0 -04} + {1786248000 -10800 1 -03} + {1809831600 -14400 0 -04} + {1818302400 -10800 1 -03} + {1841886000 -14400 0 -04} + {1849752000 -10800 1 -03} + {1873335600 -14400 0 -04} + {1881201600 -10800 1 -03} + {1904785200 -14400 0 -04} + {1912651200 -10800 1 -03} + {1936234800 -14400 0 -04} + {1944100800 -10800 1 -03} + {1967684400 -14400 0 -04} + {1976155200 -10800 1 -03} + {1999738800 -14400 0 -04} + {2007604800 -10800 1 -03} + {2031188400 -14400 0 -04} + {2039054400 -10800 1 -03} + {2062638000 -14400 0 -04} + {2070504000 -10800 1 -03} + {2094087600 -14400 0 -04} + {2101953600 -10800 1 -03} + {2125537200 -14400 0 -04} + {2133403200 -10800 1 -03} + {2156986800 -14400 0 -04} + {2165457600 -10800 1 -03} + {2189041200 -14400 0 -04} + {2196907200 -10800 1 -03} + {2220490800 -14400 0 -04} + {2228356800 -10800 1 -03} + {2251940400 -14400 0 -04} + {2259806400 -10800 1 -03} + {2283390000 -14400 0 -04} + {2291256000 -10800 1 -03} + {2314839600 -14400 0 -04} + {2322705600 -10800 1 -03} + {2346894000 -14400 0 -04} + {2354760000 -10800 1 -03} + {2378343600 -14400 0 -04} + {2386209600 -10800 1 -03} + {2409793200 -14400 0 -04} + {2417659200 -10800 1 -03} + {2441242800 -14400 0 -04} + {2449108800 -10800 1 -03} + {2472692400 -14400 0 -04} + {2480558400 -10800 1 -03} + {2504142000 -14400 0 -04} + {2512612800 -10800 1 -03} + {2536196400 -14400 0 -04} + {2544062400 -10800 1 -03} + {2567646000 -14400 0 -04} + {2575512000 -10800 1 -03} + {2599095600 -14400 0 -04} + {2606961600 -10800 1 -03} + {2630545200 -14400 0 -04} + {2638411200 -10800 1 -03} + {2661994800 -14400 0 -04} + {2669860800 -10800 1 -03} + {2693444400 -14400 0 -04} + {2701915200 -10800 1 -03} + {2725498800 -14400 0 -04} + {2733364800 -10800 1 -03} + {2756948400 -14400 0 -04} + {2764814400 -10800 1 -03} + {2788398000 -14400 0 -04} + {2796264000 -10800 1 -03} + {2819847600 -14400 0 -04} + {2827713600 -10800 1 -03} + {2851297200 -14400 0 -04} + {2859768000 -10800 1 -03} + {2883351600 -14400 0 -04} + {2891217600 -10800 1 -03} + {2914801200 -14400 0 -04} + {2922667200 -10800 1 -03} + {2946250800 -14400 0 -04} + {2954116800 -10800 1 -03} + {2977700400 -14400 0 -04} + {2985566400 -10800 1 -03} + {3009150000 -14400 0 -04} + {3017016000 -10800 1 -03} + {3040599600 -14400 0 -04} + {3049070400 -10800 1 -03} + {3072654000 -14400 0 -04} + {3080520000 -10800 1 -03} + {3104103600 -14400 0 -04} + {3111969600 -10800 1 -03} + {3135553200 -14400 0 -04} + {3143419200 -10800 1 -03} + {3167002800 -14400 0 -04} + {3174868800 -10800 1 -03} + {3198452400 -14400 0 -04} + {3206318400 -10800 1 -03} + {3230506800 -14400 0 -04} + {3238372800 -10800 1 -03} + {3261956400 -14400 0 -04} + {3269822400 -10800 1 -03} + {3293406000 -14400 0 -04} + {3301272000 -10800 1 -03} + {3324855600 -14400 0 -04} + {3332721600 -10800 1 -03} + {3356305200 -14400 0 -04} + {3364171200 -10800 1 -03} + {3387754800 -14400 0 -04} + {3396225600 -10800 1 -03} + {3419809200 -14400 0 -04} + {3427675200 -10800 1 -03} + {3451258800 -14400 0 -04} + {3459124800 -10800 1 -03} + {3482708400 -14400 0 -04} + {3490574400 -10800 1 -03} + {3514158000 -14400 0 -04} + {3522024000 -10800 1 -03} + {3545607600 -14400 0 -04} + {3553473600 -10800 1 -03} + {3577057200 -14400 0 -04} + {3585528000 -10800 1 -03} + {3609111600 -14400 0 -04} + {3616977600 -10800 1 -03} + {3640561200 -14400 0 -04} + {3648427200 -10800 1 -03} + {3672010800 -14400 0 -04} + {3679876800 -10800 1 -03} + {3703460400 -14400 0 -04} + {3711326400 -10800 1 -03} + {3734910000 -14400 0 -04} + {3743380800 -10800 1 -03} + {3766964400 -14400 0 -04} + {3774830400 -10800 1 -03} + {3798414000 -14400 0 -04} + {3806280000 -10800 1 -03} + {3829863600 -14400 0 -04} + {3837729600 -10800 1 -03} + {3861313200 -14400 0 -04} + {3869179200 -10800 1 -03} + {3892762800 -14400 0 -04} + {3900628800 -10800 1 -03} + {3924212400 -14400 0 -04} + {3932683200 -10800 1 -03} + {3956266800 -14400 0 -04} + {3964132800 -10800 1 -03} + {3987716400 -14400 0 -04} + {3995582400 -10800 1 -03} + {4019166000 -14400 0 -04} + {4027032000 -10800 1 -03} + {4050615600 -14400 0 -04} + {4058481600 -10800 1 -03} + {4082065200 -14400 0 -04} + {4089931200 -10800 1 -03} } diff --git a/library/tzdata/America/Santo_Domingo b/library/tzdata/America/Santo_Domingo index 7706918..28d3a9c 100644 --- a/library/tzdata/America/Santo_Domingo +++ b/library/tzdata/America/Santo_Domingo @@ -6,15 +6,15 @@ set TZData(:America/Santo_Domingo) { {-1159773600 -18000 0 EST} {-100119600 -14400 1 EDT} {-89668800 -18000 0 EST} - {-5770800 -16200 1 EHDT} + {-5770800 -16200 1 -0430} {4422600 -18000 0 EST} - {25678800 -16200 1 EHDT} + {25678800 -16200 1 -0430} {33193800 -18000 0 EST} - {57733200 -16200 1 EHDT} + {57733200 -16200 1 -0430} {64816200 -18000 0 EST} - {89182800 -16200 1 EHDT} + {89182800 -16200 1 -0430} {96438600 -18000 0 EST} - {120632400 -16200 1 EHDT} + {120632400 -16200 1 -0430} {127974600 -18000 0 EST} {152082000 -14400 0 AST} {975823200 -14400 0 AST} diff --git a/library/tzdata/America/Sao_Paulo b/library/tzdata/America/Sao_Paulo index 8d70063..a61c638 100644 --- a/library/tzdata/America/Sao_Paulo +++ b/library/tzdata/America/Sao_Paulo @@ -2,257 +2,257 @@ set TZData(:America/Sao_Paulo) { {-9223372036854775808 -11188 0 LMT} - {-1767214412 -10800 0 BRT} - {-1206957600 -7200 1 BRST} - {-1191362400 -10800 0 BRT} - {-1175374800 -7200 1 BRST} - {-1159826400 -10800 0 BRT} - {-633819600 -7200 1 BRST} - {-622069200 -10800 0 BRT} - {-602283600 -7200 1 BRST} - {-591832800 -10800 0 BRT} - {-570747600 -7200 1 BRST} - {-560210400 -10800 0 BRT} - {-539125200 -7200 1 BRST} - {-531352800 -10800 0 BRT} - {-195429600 -7200 1 BRST} - {-189381600 -7200 0 BRT} - {-184197600 -10800 0 BRT} - {-155163600 -7200 1 BRST} - {-150069600 -10800 0 BRT} - {-128898000 -7200 1 BRST} - {-121125600 -10800 0 BRT} - {-99954000 -7200 1 BRST} - {-89589600 -10800 0 BRT} - {-68418000 -7200 1 BRST} - {-57967200 -10800 0 BRT} - {499748400 -7200 1 BRST} - {511236000 -10800 0 BRT} - {530593200 -7200 1 BRST} - {540266400 -10800 0 BRT} - {562129200 -7200 1 BRST} - {571197600 -10800 0 BRT} - {592974000 -7200 1 BRST} - {602042400 -10800 0 BRT} - {624423600 -7200 1 BRST} - {634701600 -10800 0 BRT} - {656478000 -7200 1 BRST} - {666756000 -10800 0 BRT} - {687927600 -7200 1 BRST} - {697600800 -10800 0 BRT} - {719982000 -7200 1 BRST} - {728445600 -10800 0 BRT} - {750826800 -7200 1 BRST} - {761709600 -10800 0 BRT} - {782276400 -7200 1 BRST} - {793159200 -10800 0 BRT} - {813726000 -7200 1 BRST} - {824004000 -10800 0 BRT} - {844570800 -7200 1 BRST} - {856058400 -10800 0 BRT} - {876106800 -7200 1 BRST} - {888717600 -10800 0 BRT} - {908074800 -7200 1 BRST} - {919562400 -10800 0 BRT} - {938919600 -7200 1 BRST} - {951616800 -10800 0 BRT} - {970974000 -7200 1 BRST} - {982461600 -10800 0 BRT} - {1003028400 -7200 1 BRST} - {1013911200 -10800 0 BRT} - {1036292400 -7200 1 BRST} - {1045360800 -10800 0 BRT} - {1066532400 -7200 1 BRST} - {1076810400 -10800 0 BRT} - {1099364400 -7200 1 BRST} - {1108864800 -10800 0 BRT} - {1129431600 -7200 1 BRST} - {1140314400 -10800 0 BRT} - {1162695600 -7200 1 BRST} - {1172368800 -10800 0 BRT} - {1192330800 -7200 1 BRST} - {1203213600 -10800 0 BRT} - {1224385200 -7200 1 BRST} - {1234663200 -10800 0 BRT} - {1255834800 -7200 1 BRST} - {1266717600 -10800 0 BRT} - {1287284400 -7200 1 BRST} - {1298167200 -10800 0 BRT} - {1318734000 -7200 1 BRST} - {1330221600 -10800 0 BRT} - {1350788400 -7200 1 BRST} - {1361066400 -10800 0 BRT} - {1382238000 -7200 1 BRST} - {1392516000 -10800 0 BRT} - {1413687600 -7200 1 BRST} - {1424570400 -10800 0 BRT} - {1445137200 -7200 1 BRST} - {1456020000 -10800 0 BRT} - {1476586800 -7200 1 BRST} - {1487469600 -10800 0 BRT} - {1508036400 -7200 1 BRST} - {1518919200 -10800 0 BRT} - {1540090800 -7200 1 BRST} - {1550368800 -10800 0 BRT} - {1571540400 -7200 1 BRST} - {1581818400 -10800 0 BRT} - {1602990000 -7200 1 BRST} - {1613872800 -10800 0 BRT} - {1634439600 -7200 1 BRST} - {1645322400 -10800 0 BRT} - {1665889200 -7200 1 BRST} - {1677376800 -10800 0 BRT} - {1697338800 -7200 1 BRST} - {1708221600 -10800 0 BRT} - {1729393200 -7200 1 BRST} - {1739671200 -10800 0 BRT} - {1760842800 -7200 1 BRST} - {1771725600 -10800 0 BRT} - {1792292400 -7200 1 BRST} - {1803175200 -10800 0 BRT} - {1823742000 -7200 1 BRST} - {1834624800 -10800 0 BRT} - {1855191600 -7200 1 BRST} - {1866074400 -10800 0 BRT} - {1887246000 -7200 1 BRST} - {1897524000 -10800 0 BRT} - {1918695600 -7200 1 BRST} - {1928973600 -10800 0 BRT} - {1950145200 -7200 1 BRST} - {1960423200 -10800 0 BRT} - {1981594800 -7200 1 BRST} - {1992477600 -10800 0 BRT} - {2013044400 -7200 1 BRST} - {2024532000 -10800 0 BRT} - {2044494000 -7200 1 BRST} - {2055376800 -10800 0 BRT} - {2076548400 -7200 1 BRST} - {2086826400 -10800 0 BRT} - {2107998000 -7200 1 BRST} - {2118880800 -10800 0 BRT} - {2139447600 -7200 1 BRST} - {2150330400 -10800 0 BRT} - {2170897200 -7200 1 BRST} - {2181780000 -10800 0 BRT} - {2202346800 -7200 1 BRST} - {2213229600 -10800 0 BRT} - {2234401200 -7200 1 BRST} - {2244679200 -10800 0 BRT} - {2265850800 -7200 1 BRST} - {2276128800 -10800 0 BRT} - {2297300400 -7200 1 BRST} - {2307578400 -10800 0 BRT} - {2328750000 -7200 1 BRST} - {2339632800 -10800 0 BRT} - {2360199600 -7200 1 BRST} - {2371082400 -10800 0 BRT} - {2391649200 -7200 1 BRST} - {2402532000 -10800 0 BRT} - {2423703600 -7200 1 BRST} - {2433981600 -10800 0 BRT} - {2455153200 -7200 1 BRST} - {2465431200 -10800 0 BRT} - {2486602800 -7200 1 BRST} - {2497485600 -10800 0 BRT} - {2518052400 -7200 1 BRST} - {2528935200 -10800 0 BRT} - {2549502000 -7200 1 BRST} - {2560384800 -10800 0 BRT} - {2580951600 -7200 1 BRST} - {2591834400 -10800 0 BRT} - {2613006000 -7200 1 BRST} - {2623284000 -10800 0 BRT} - {2644455600 -7200 1 BRST} - {2654733600 -10800 0 BRT} - {2675905200 -7200 1 BRST} - {2686788000 -10800 0 BRT} - {2707354800 -7200 1 BRST} - {2718237600 -10800 0 BRT} - {2738804400 -7200 1 BRST} - {2749687200 -10800 0 BRT} - {2770858800 -7200 1 BRST} - {2781136800 -10800 0 BRT} - {2802308400 -7200 1 BRST} - {2812586400 -10800 0 BRT} - {2833758000 -7200 1 BRST} - {2844036000 -10800 0 BRT} - {2865207600 -7200 1 BRST} - {2876090400 -10800 0 BRT} - {2896657200 -7200 1 BRST} - {2907540000 -10800 0 BRT} - {2928106800 -7200 1 BRST} - {2938989600 -10800 0 BRT} - {2960161200 -7200 1 BRST} - {2970439200 -10800 0 BRT} - {2991610800 -7200 1 BRST} - {3001888800 -10800 0 BRT} - {3023060400 -7200 1 BRST} - {3033943200 -10800 0 BRT} - {3054510000 -7200 1 BRST} - {3065392800 -10800 0 BRT} - {3085959600 -7200 1 BRST} - {3096842400 -10800 0 BRT} - {3118014000 -7200 1 BRST} - {3128292000 -10800 0 BRT} - {3149463600 -7200 1 BRST} - {3159741600 -10800 0 BRT} - {3180913200 -7200 1 BRST} - {3191191200 -10800 0 BRT} - {3212362800 -7200 1 BRST} - {3223245600 -10800 0 BRT} - {3243812400 -7200 1 BRST} - {3254695200 -10800 0 BRT} - {3275262000 -7200 1 BRST} - {3286144800 -10800 0 BRT} - {3307316400 -7200 1 BRST} - {3317594400 -10800 0 BRT} - {3338766000 -7200 1 BRST} - {3349044000 -10800 0 BRT} - {3370215600 -7200 1 BRST} - {3381098400 -10800 0 BRT} - {3401665200 -7200 1 BRST} - {3412548000 -10800 0 BRT} - {3433114800 -7200 1 BRST} - {3443997600 -10800 0 BRT} - {3464564400 -7200 1 BRST} - {3475447200 -10800 0 BRT} - {3496618800 -7200 1 BRST} - {3506896800 -10800 0 BRT} - {3528068400 -7200 1 BRST} - {3538346400 -10800 0 BRT} - {3559518000 -7200 1 BRST} - {3570400800 -10800 0 BRT} - {3590967600 -7200 1 BRST} - {3601850400 -10800 0 BRT} - {3622417200 -7200 1 BRST} - {3633300000 -10800 0 BRT} - {3654471600 -7200 1 BRST} - {3664749600 -10800 0 BRT} - {3685921200 -7200 1 BRST} - {3696199200 -10800 0 BRT} - {3717370800 -7200 1 BRST} - {3727648800 -10800 0 BRT} - {3748820400 -7200 1 BRST} - {3759703200 -10800 0 BRT} - {3780270000 -7200 1 BRST} - {3791152800 -10800 0 BRT} - {3811719600 -7200 1 BRST} - {3822602400 -10800 0 BRT} - {3843774000 -7200 1 BRST} - {3854052000 -10800 0 BRT} - {3875223600 -7200 1 BRST} - {3885501600 -10800 0 BRT} - {3906673200 -7200 1 BRST} - {3917556000 -10800 0 BRT} - {3938122800 -7200 1 BRST} - {3949005600 -10800 0 BRT} - {3969572400 -7200 1 BRST} - {3980455200 -10800 0 BRT} - {4001626800 -7200 1 BRST} - {4011904800 -10800 0 BRT} - {4033076400 -7200 1 BRST} - {4043354400 -10800 0 BRT} - {4064526000 -7200 1 BRST} - {4074804000 -10800 0 BRT} - {4095975600 -7200 1 BRST} + {-1767214412 -10800 0 -03} + {-1206957600 -7200 1 -02} + {-1191362400 -10800 0 -03} + {-1175374800 -7200 1 -02} + {-1159826400 -10800 0 -03} + {-633819600 -7200 1 -02} + {-622069200 -10800 0 -03} + {-602283600 -7200 1 -02} + {-591832800 -10800 0 -03} + {-570747600 -7200 1 -02} + {-560210400 -10800 0 -03} + {-539125200 -7200 1 -02} + {-531352800 -10800 0 -03} + {-195429600 -7200 1 -02} + {-189381600 -7200 0 -03} + {-184197600 -10800 0 -03} + {-155163600 -7200 1 -02} + {-150069600 -10800 0 -03} + {-128898000 -7200 1 -02} + {-121125600 -10800 0 -03} + {-99954000 -7200 1 -02} + {-89589600 -10800 0 -03} + {-68418000 -7200 1 -02} + {-57967200 -10800 0 -03} + {499748400 -7200 1 -02} + {511236000 -10800 0 -03} + {530593200 -7200 1 -02} + {540266400 -10800 0 -03} + {562129200 -7200 1 -02} + {571197600 -10800 0 -03} + {592974000 -7200 1 -02} + {602042400 -10800 0 -03} + {624423600 -7200 1 -02} + {634701600 -10800 0 -03} + {656478000 -7200 1 -02} + {666756000 -10800 0 -03} + {687927600 -7200 1 -02} + {697600800 -10800 0 -03} + {719982000 -7200 1 -02} + {728445600 -10800 0 -03} + {750826800 -7200 1 -02} + {761709600 -10800 0 -03} + {782276400 -7200 1 -02} + {793159200 -10800 0 -03} + {813726000 -7200 1 -02} + {824004000 -10800 0 -03} + {844570800 -7200 1 -02} + {856058400 -10800 0 -03} + {876106800 -7200 1 -02} + {888717600 -10800 0 -03} + {908074800 -7200 1 -02} + {919562400 -10800 0 -03} + {938919600 -7200 1 -02} + {951616800 -10800 0 -03} + {970974000 -7200 1 -02} + {982461600 -10800 0 -03} + {1003028400 -7200 1 -02} + {1013911200 -10800 0 -03} + {1036292400 -7200 1 -02} + {1045360800 -10800 0 -03} + {1066532400 -7200 1 -02} + {1076810400 -10800 0 -03} + {1099364400 -7200 1 -02} + {1108864800 -10800 0 -03} + {1129431600 -7200 1 -02} + {1140314400 -10800 0 -03} + {1162695600 -7200 1 -02} + {1172368800 -10800 0 -03} + {1192330800 -7200 1 -02} + {1203213600 -10800 0 -03} + {1224385200 -7200 1 -02} + {1234663200 -10800 0 -03} + {1255834800 -7200 1 -02} + {1266717600 -10800 0 -03} + {1287284400 -7200 1 -02} + {1298167200 -10800 0 -03} + {1318734000 -7200 1 -02} + {1330221600 -10800 0 -03} + {1350788400 -7200 1 -02} + {1361066400 -10800 0 -03} + {1382238000 -7200 1 -02} + {1392516000 -10800 0 -03} + {1413687600 -7200 1 -02} + {1424570400 -10800 0 -03} + {1445137200 -7200 1 -02} + {1456020000 -10800 0 -03} + {1476586800 -7200 1 -02} + {1487469600 -10800 0 -03} + {1508036400 -7200 1 -02} + {1518919200 -10800 0 -03} + {1540090800 -7200 1 -02} + {1550368800 -10800 0 -03} + {1571540400 -7200 1 -02} + {1581818400 -10800 0 -03} + {1602990000 -7200 1 -02} + {1613872800 -10800 0 -03} + {1634439600 -7200 1 -02} + {1645322400 -10800 0 -03} + {1665889200 -7200 1 -02} + {1677376800 -10800 0 -03} + {1697338800 -7200 1 -02} + {1708221600 -10800 0 -03} + {1729393200 -7200 1 -02} + {1739671200 -10800 0 -03} + {1760842800 -7200 1 -02} + {1771725600 -10800 0 -03} + {1792292400 -7200 1 -02} + {1803175200 -10800 0 -03} + {1823742000 -7200 1 -02} + {1834624800 -10800 0 -03} + {1855191600 -7200 1 -02} + {1866074400 -10800 0 -03} + {1887246000 -7200 1 -02} + {1897524000 -10800 0 -03} + {1918695600 -7200 1 -02} + {1928973600 -10800 0 -03} + {1950145200 -7200 1 -02} + {1960423200 -10800 0 -03} + {1981594800 -7200 1 -02} + {1992477600 -10800 0 -03} + {2013044400 -7200 1 -02} + {2024532000 -10800 0 -03} + {2044494000 -7200 1 -02} + {2055376800 -10800 0 -03} + {2076548400 -7200 1 -02} + {2086826400 -10800 0 -03} + {2107998000 -7200 1 -02} + {2118880800 -10800 0 -03} + {2139447600 -7200 1 -02} + {2150330400 -10800 0 -03} + {2170897200 -7200 1 -02} + {2181780000 -10800 0 -03} + {2202346800 -7200 1 -02} + {2213229600 -10800 0 -03} + {2234401200 -7200 1 -02} + {2244679200 -10800 0 -03} + {2265850800 -7200 1 -02} + {2276128800 -10800 0 -03} + {2297300400 -7200 1 -02} + {2307578400 -10800 0 -03} + {2328750000 -7200 1 -02} + {2339632800 -10800 0 -03} + {2360199600 -7200 1 -02} + {2371082400 -10800 0 -03} + {2391649200 -7200 1 -02} + {2402532000 -10800 0 -03} + {2423703600 -7200 1 -02} + {2433981600 -10800 0 -03} + {2455153200 -7200 1 -02} + {2465431200 -10800 0 -03} + {2486602800 -7200 1 -02} + {2497485600 -10800 0 -03} + {2518052400 -7200 1 -02} + {2528935200 -10800 0 -03} + {2549502000 -7200 1 -02} + {2560384800 -10800 0 -03} + {2580951600 -7200 1 -02} + {2591834400 -10800 0 -03} + {2613006000 -7200 1 -02} + {2623284000 -10800 0 -03} + {2644455600 -7200 1 -02} + {2654733600 -10800 0 -03} + {2675905200 -7200 1 -02} + {2686788000 -10800 0 -03} + {2707354800 -7200 1 -02} + {2718237600 -10800 0 -03} + {2738804400 -7200 1 -02} + {2749687200 -10800 0 -03} + {2770858800 -7200 1 -02} + {2781136800 -10800 0 -03} + {2802308400 -7200 1 -02} + {2812586400 -10800 0 -03} + {2833758000 -7200 1 -02} + {2844036000 -10800 0 -03} + {2865207600 -7200 1 -02} + {2876090400 -10800 0 -03} + {2896657200 -7200 1 -02} + {2907540000 -10800 0 -03} + {2928106800 -7200 1 -02} + {2938989600 -10800 0 -03} + {2960161200 -7200 1 -02} + {2970439200 -10800 0 -03} + {2991610800 -7200 1 -02} + {3001888800 -10800 0 -03} + {3023060400 -7200 1 -02} + {3033943200 -10800 0 -03} + {3054510000 -7200 1 -02} + {3065392800 -10800 0 -03} + {3085959600 -7200 1 -02} + {3096842400 -10800 0 -03} + {3118014000 -7200 1 -02} + {3128292000 -10800 0 -03} + {3149463600 -7200 1 -02} + {3159741600 -10800 0 -03} + {3180913200 -7200 1 -02} + {3191191200 -10800 0 -03} + {3212362800 -7200 1 -02} + {3223245600 -10800 0 -03} + {3243812400 -7200 1 -02} + {3254695200 -10800 0 -03} + {3275262000 -7200 1 -02} + {3286144800 -10800 0 -03} + {3307316400 -7200 1 -02} + {3317594400 -10800 0 -03} + {3338766000 -7200 1 -02} + {3349044000 -10800 0 -03} + {3370215600 -7200 1 -02} + {3381098400 -10800 0 -03} + {3401665200 -7200 1 -02} + {3412548000 -10800 0 -03} + {3433114800 -7200 1 -02} + {3443997600 -10800 0 -03} + {3464564400 -7200 1 -02} + {3475447200 -10800 0 -03} + {3496618800 -7200 1 -02} + {3506896800 -10800 0 -03} + {3528068400 -7200 1 -02} + {3538346400 -10800 0 -03} + {3559518000 -7200 1 -02} + {3570400800 -10800 0 -03} + {3590967600 -7200 1 -02} + {3601850400 -10800 0 -03} + {3622417200 -7200 1 -02} + {3633300000 -10800 0 -03} + {3654471600 -7200 1 -02} + {3664749600 -10800 0 -03} + {3685921200 -7200 1 -02} + {3696199200 -10800 0 -03} + {3717370800 -7200 1 -02} + {3727648800 -10800 0 -03} + {3748820400 -7200 1 -02} + {3759703200 -10800 0 -03} + {3780270000 -7200 1 -02} + {3791152800 -10800 0 -03} + {3811719600 -7200 1 -02} + {3822602400 -10800 0 -03} + {3843774000 -7200 1 -02} + {3854052000 -10800 0 -03} + {3875223600 -7200 1 -02} + {3885501600 -10800 0 -03} + {3906673200 -7200 1 -02} + {3917556000 -10800 0 -03} + {3938122800 -7200 1 -02} + {3949005600 -10800 0 -03} + {3969572400 -7200 1 -02} + {3980455200 -10800 0 -03} + {4001626800 -7200 1 -02} + {4011904800 -10800 0 -03} + {4033076400 -7200 1 -02} + {4043354400 -10800 0 -03} + {4064526000 -7200 1 -02} + {4074804000 -10800 0 -03} + {4095975600 -7200 1 -02} } diff --git a/library/tzdata/America/Scoresbysund b/library/tzdata/America/Scoresbysund index 74a332c..7430635 100644 --- a/library/tzdata/America/Scoresbysund +++ b/library/tzdata/America/Scoresbysund @@ -2,245 +2,245 @@ set TZData(:America/Scoresbysund) { {-9223372036854775808 -5272 0 LMT} - {-1686090728 -7200 0 CGT} - {323841600 -3600 0 CGST} - {338961600 -7200 0 CGT} - {354679200 0 0 EGST} - {370400400 -3600 0 EGT} - {386125200 0 1 EGST} - {401850000 -3600 0 EGT} - {417574800 0 1 EGST} - {433299600 -3600 0 EGT} - {449024400 0 1 EGST} - {465354000 -3600 0 EGT} - {481078800 0 1 EGST} - {496803600 -3600 0 EGT} - {512528400 0 1 EGST} - {528253200 -3600 0 EGT} - {543978000 0 1 EGST} - {559702800 -3600 0 EGT} - {575427600 0 1 EGST} - {591152400 -3600 0 EGT} - {606877200 0 1 EGST} - {622602000 -3600 0 EGT} - {638326800 0 1 EGST} - {654656400 -3600 0 EGT} - {670381200 0 1 EGST} - {686106000 -3600 0 EGT} - {701830800 0 1 EGST} - {717555600 -3600 0 EGT} - {733280400 0 1 EGST} - {749005200 -3600 0 EGT} - {764730000 0 1 EGST} - {780454800 -3600 0 EGT} - {796179600 0 1 EGST} - {811904400 -3600 0 EGT} - {828234000 0 1 EGST} - {846378000 -3600 0 EGT} - {859683600 0 1 EGST} - {877827600 -3600 0 EGT} - {891133200 0 1 EGST} - {909277200 -3600 0 EGT} - {922582800 0 1 EGST} - {941331600 -3600 0 EGT} - {954032400 0 1 EGST} - {972781200 -3600 0 EGT} - {985482000 0 1 EGST} - {1004230800 -3600 0 EGT} - {1017536400 0 1 EGST} - {1035680400 -3600 0 EGT} - {1048986000 0 1 EGST} - {1067130000 -3600 0 EGT} - {1080435600 0 1 EGST} - {1099184400 -3600 0 EGT} - {1111885200 0 1 EGST} - {1130634000 -3600 0 EGT} - {1143334800 0 1 EGST} - {1162083600 -3600 0 EGT} - {1174784400 0 1 EGST} - {1193533200 -3600 0 EGT} - {1206838800 0 1 EGST} - {1224982800 -3600 0 EGT} - {1238288400 0 1 EGST} - {1256432400 -3600 0 EGT} - {1269738000 0 1 EGST} - {1288486800 -3600 0 EGT} - {1301187600 0 1 EGST} - {1319936400 -3600 0 EGT} - {1332637200 0 1 EGST} - {1351386000 -3600 0 EGT} - {1364691600 0 1 EGST} - {1382835600 -3600 0 EGT} - {1396141200 0 1 EGST} - {1414285200 -3600 0 EGT} - {1427590800 0 1 EGST} - {1445734800 -3600 0 EGT} - {1459040400 0 1 EGST} - {1477789200 -3600 0 EGT} - {1490490000 0 1 EGST} - {1509238800 -3600 0 EGT} - {1521939600 0 1 EGST} - {1540688400 -3600 0 EGT} - {1553994000 0 1 EGST} - {1572138000 -3600 0 EGT} - {1585443600 0 1 EGST} - {1603587600 -3600 0 EGT} - {1616893200 0 1 EGST} - {1635642000 -3600 0 EGT} - {1648342800 0 1 EGST} - {1667091600 -3600 0 EGT} - {1679792400 0 1 EGST} - {1698541200 -3600 0 EGT} - {1711846800 0 1 EGST} - {1729990800 -3600 0 EGT} - {1743296400 0 1 EGST} - {1761440400 -3600 0 EGT} - {1774746000 0 1 EGST} - {1792890000 -3600 0 EGT} - {1806195600 0 1 EGST} - {1824944400 -3600 0 EGT} - {1837645200 0 1 EGST} - {1856394000 -3600 0 EGT} - {1869094800 0 1 EGST} - {1887843600 -3600 0 EGT} - {1901149200 0 1 EGST} - {1919293200 -3600 0 EGT} - {1932598800 0 1 EGST} - {1950742800 -3600 0 EGT} - {1964048400 0 1 EGST} - {1982797200 -3600 0 EGT} - {1995498000 0 1 EGST} - {2014246800 -3600 0 EGT} - {2026947600 0 1 EGST} - {2045696400 -3600 0 EGT} - {2058397200 0 1 EGST} - {2077146000 -3600 0 EGT} - {2090451600 0 1 EGST} - {2108595600 -3600 0 EGT} - {2121901200 0 1 EGST} - {2140045200 -3600 0 EGT} - {2153350800 0 1 EGST} - {2172099600 -3600 0 EGT} - {2184800400 0 1 EGST} - {2203549200 -3600 0 EGT} - {2216250000 0 1 EGST} - {2234998800 -3600 0 EGT} - {2248304400 0 1 EGST} - {2266448400 -3600 0 EGT} - {2279754000 0 1 EGST} - {2297898000 -3600 0 EGT} - {2311203600 0 1 EGST} - {2329347600 -3600 0 EGT} - {2342653200 0 1 EGST} - {2361402000 -3600 0 EGT} - {2374102800 0 1 EGST} - {2392851600 -3600 0 EGT} - {2405552400 0 1 EGST} - {2424301200 -3600 0 EGT} - {2437606800 0 1 EGST} - {2455750800 -3600 0 EGT} - {2469056400 0 1 EGST} - {2487200400 -3600 0 EGT} - {2500506000 0 1 EGST} - {2519254800 -3600 0 EGT} - {2531955600 0 1 EGST} - {2550704400 -3600 0 EGT} - {2563405200 0 1 EGST} - {2582154000 -3600 0 EGT} - {2595459600 0 1 EGST} - {2613603600 -3600 0 EGT} - {2626909200 0 1 EGST} - {2645053200 -3600 0 EGT} - {2658358800 0 1 EGST} - {2676502800 -3600 0 EGT} - {2689808400 0 1 EGST} - {2708557200 -3600 0 EGT} - {2721258000 0 1 EGST} - {2740006800 -3600 0 EGT} - {2752707600 0 1 EGST} - {2771456400 -3600 0 EGT} - {2784762000 0 1 EGST} - {2802906000 -3600 0 EGT} - {2816211600 0 1 EGST} - {2834355600 -3600 0 EGT} - {2847661200 0 1 EGST} - {2866410000 -3600 0 EGT} - {2879110800 0 1 EGST} - {2897859600 -3600 0 EGT} - {2910560400 0 1 EGST} - {2929309200 -3600 0 EGT} - {2942010000 0 1 EGST} - {2960758800 -3600 0 EGT} - {2974064400 0 1 EGST} - {2992208400 -3600 0 EGT} - {3005514000 0 1 EGST} - {3023658000 -3600 0 EGT} - {3036963600 0 1 EGST} - {3055712400 -3600 0 EGT} - {3068413200 0 1 EGST} - {3087162000 -3600 0 EGT} - {3099862800 0 1 EGST} - {3118611600 -3600 0 EGT} - {3131917200 0 1 EGST} - {3150061200 -3600 0 EGT} - {3163366800 0 1 EGST} - {3181510800 -3600 0 EGT} - {3194816400 0 1 EGST} - {3212960400 -3600 0 EGT} - {3226266000 0 1 EGST} - {3245014800 -3600 0 EGT} - {3257715600 0 1 EGST} - {3276464400 -3600 0 EGT} - {3289165200 0 1 EGST} - {3307914000 -3600 0 EGT} - {3321219600 0 1 EGST} - {3339363600 -3600 0 EGT} - {3352669200 0 1 EGST} - {3370813200 -3600 0 EGT} - {3384118800 0 1 EGST} - {3402867600 -3600 0 EGT} - {3415568400 0 1 EGST} - {3434317200 -3600 0 EGT} - {3447018000 0 1 EGST} - {3465766800 -3600 0 EGT} - {3479072400 0 1 EGST} - {3497216400 -3600 0 EGT} - {3510522000 0 1 EGST} - {3528666000 -3600 0 EGT} - {3541971600 0 1 EGST} - {3560115600 -3600 0 EGT} - {3573421200 0 1 EGST} - {3592170000 -3600 0 EGT} - {3604870800 0 1 EGST} - {3623619600 -3600 0 EGT} - {3636320400 0 1 EGST} - {3655069200 -3600 0 EGT} - {3668374800 0 1 EGST} - {3686518800 -3600 0 EGT} - {3699824400 0 1 EGST} - {3717968400 -3600 0 EGT} - {3731274000 0 1 EGST} - {3750022800 -3600 0 EGT} - {3762723600 0 1 EGST} - {3781472400 -3600 0 EGT} - {3794173200 0 1 EGST} - {3812922000 -3600 0 EGT} - {3825622800 0 1 EGST} - {3844371600 -3600 0 EGT} - {3857677200 0 1 EGST} - {3875821200 -3600 0 EGT} - {3889126800 0 1 EGST} - {3907270800 -3600 0 EGT} - {3920576400 0 1 EGST} - {3939325200 -3600 0 EGT} - {3952026000 0 1 EGST} - {3970774800 -3600 0 EGT} - {3983475600 0 1 EGST} - {4002224400 -3600 0 EGT} - {4015530000 0 1 EGST} - {4033674000 -3600 0 EGT} - {4046979600 0 1 EGST} - {4065123600 -3600 0 EGT} - {4078429200 0 1 EGST} - {4096573200 -3600 0 EGT} + {-1686090728 -7200 0 -02} + {323841600 -3600 0 -01} + {338961600 -7200 0 -02} + {354679200 0 0 +00} + {370400400 -3600 0 -01} + {386125200 0 1 +00} + {401850000 -3600 0 -01} + {417574800 0 1 +00} + {433299600 -3600 0 -01} + {449024400 0 1 +00} + {465354000 -3600 0 -01} + {481078800 0 1 +00} + {496803600 -3600 0 -01} + {512528400 0 1 +00} + {528253200 -3600 0 -01} + {543978000 0 1 +00} + {559702800 -3600 0 -01} + {575427600 0 1 +00} + {591152400 -3600 0 -01} + {606877200 0 1 +00} + {622602000 -3600 0 -01} + {638326800 0 1 +00} + {654656400 -3600 0 -01} + {670381200 0 1 +00} + {686106000 -3600 0 -01} + {701830800 0 1 +00} + {717555600 -3600 0 -01} + {733280400 0 1 +00} + {749005200 -3600 0 -01} + {764730000 0 1 +00} + {780454800 -3600 0 -01} + {796179600 0 1 +00} + {811904400 -3600 0 -01} + {828234000 0 1 +00} + {846378000 -3600 0 -01} + {859683600 0 1 +00} + {877827600 -3600 0 -01} + {891133200 0 1 +00} + {909277200 -3600 0 -01} + {922582800 0 1 +00} + {941331600 -3600 0 -01} + {954032400 0 1 +00} + {972781200 -3600 0 -01} + {985482000 0 1 +00} + {1004230800 -3600 0 -01} + {1017536400 0 1 +00} + {1035680400 -3600 0 -01} + {1048986000 0 1 +00} + {1067130000 -3600 0 -01} + {1080435600 0 1 +00} + {1099184400 -3600 0 -01} + {1111885200 0 1 +00} + {1130634000 -3600 0 -01} + {1143334800 0 1 +00} + {1162083600 -3600 0 -01} + {1174784400 0 1 +00} + {1193533200 -3600 0 -01} + {1206838800 0 1 +00} + {1224982800 -3600 0 -01} + {1238288400 0 1 +00} + {1256432400 -3600 0 -01} + {1269738000 0 1 +00} + {1288486800 -3600 0 -01} + {1301187600 0 1 +00} + {1319936400 -3600 0 -01} + {1332637200 0 1 +00} + {1351386000 -3600 0 -01} + {1364691600 0 1 +00} + {1382835600 -3600 0 -01} + {1396141200 0 1 +00} + {1414285200 -3600 0 -01} + {1427590800 0 1 +00} + {1445734800 -3600 0 -01} + {1459040400 0 1 +00} + {1477789200 -3600 0 -01} + {1490490000 0 1 +00} + {1509238800 -3600 0 -01} + {1521939600 0 1 +00} + {1540688400 -3600 0 -01} + {1553994000 0 1 +00} + {1572138000 -3600 0 -01} + {1585443600 0 1 +00} + {1603587600 -3600 0 -01} + {1616893200 0 1 +00} + {1635642000 -3600 0 -01} + {1648342800 0 1 +00} + {1667091600 -3600 0 -01} + {1679792400 0 1 +00} + {1698541200 -3600 0 -01} + {1711846800 0 1 +00} + {1729990800 -3600 0 -01} + {1743296400 0 1 +00} + {1761440400 -3600 0 -01} + {1774746000 0 1 +00} + {1792890000 -3600 0 -01} + {1806195600 0 1 +00} + {1824944400 -3600 0 -01} + {1837645200 0 1 +00} + {1856394000 -3600 0 -01} + {1869094800 0 1 +00} + {1887843600 -3600 0 -01} + {1901149200 0 1 +00} + {1919293200 -3600 0 -01} + {1932598800 0 1 +00} + {1950742800 -3600 0 -01} + {1964048400 0 1 +00} + {1982797200 -3600 0 -01} + {1995498000 0 1 +00} + {2014246800 -3600 0 -01} + {2026947600 0 1 +00} + {2045696400 -3600 0 -01} + {2058397200 0 1 +00} + {2077146000 -3600 0 -01} + {2090451600 0 1 +00} + {2108595600 -3600 0 -01} + {2121901200 0 1 +00} + {2140045200 -3600 0 -01} + {2153350800 0 1 +00} + {2172099600 -3600 0 -01} + {2184800400 0 1 +00} + {2203549200 -3600 0 -01} + {2216250000 0 1 +00} + {2234998800 -3600 0 -01} + {2248304400 0 1 +00} + {2266448400 -3600 0 -01} + {2279754000 0 1 +00} + {2297898000 -3600 0 -01} + {2311203600 0 1 +00} + {2329347600 -3600 0 -01} + {2342653200 0 1 +00} + {2361402000 -3600 0 -01} + {2374102800 0 1 +00} + {2392851600 -3600 0 -01} + {2405552400 0 1 +00} + {2424301200 -3600 0 -01} + {2437606800 0 1 +00} + {2455750800 -3600 0 -01} + {2469056400 0 1 +00} + {2487200400 -3600 0 -01} + {2500506000 0 1 +00} + {2519254800 -3600 0 -01} + {2531955600 0 1 +00} + {2550704400 -3600 0 -01} + {2563405200 0 1 +00} + {2582154000 -3600 0 -01} + {2595459600 0 1 +00} + {2613603600 -3600 0 -01} + {2626909200 0 1 +00} + {2645053200 -3600 0 -01} + {2658358800 0 1 +00} + {2676502800 -3600 0 -01} + {2689808400 0 1 +00} + {2708557200 -3600 0 -01} + {2721258000 0 1 +00} + {2740006800 -3600 0 -01} + {2752707600 0 1 +00} + {2771456400 -3600 0 -01} + {2784762000 0 1 +00} + {2802906000 -3600 0 -01} + {2816211600 0 1 +00} + {2834355600 -3600 0 -01} + {2847661200 0 1 +00} + {2866410000 -3600 0 -01} + {2879110800 0 1 +00} + {2897859600 -3600 0 -01} + {2910560400 0 1 +00} + {2929309200 -3600 0 -01} + {2942010000 0 1 +00} + {2960758800 -3600 0 -01} + {2974064400 0 1 +00} + {2992208400 -3600 0 -01} + {3005514000 0 1 +00} + {3023658000 -3600 0 -01} + {3036963600 0 1 +00} + {3055712400 -3600 0 -01} + {3068413200 0 1 +00} + {3087162000 -3600 0 -01} + {3099862800 0 1 +00} + {3118611600 -3600 0 -01} + {3131917200 0 1 +00} + {3150061200 -3600 0 -01} + {3163366800 0 1 +00} + {3181510800 -3600 0 -01} + {3194816400 0 1 +00} + {3212960400 -3600 0 -01} + {3226266000 0 1 +00} + {3245014800 -3600 0 -01} + {3257715600 0 1 +00} + {3276464400 -3600 0 -01} + {3289165200 0 1 +00} + {3307914000 -3600 0 -01} + {3321219600 0 1 +00} + {3339363600 -3600 0 -01} + {3352669200 0 1 +00} + {3370813200 -3600 0 -01} + {3384118800 0 1 +00} + {3402867600 -3600 0 -01} + {3415568400 0 1 +00} + {3434317200 -3600 0 -01} + {3447018000 0 1 +00} + {3465766800 -3600 0 -01} + {3479072400 0 1 +00} + {3497216400 -3600 0 -01} + {3510522000 0 1 +00} + {3528666000 -3600 0 -01} + {3541971600 0 1 +00} + {3560115600 -3600 0 -01} + {3573421200 0 1 +00} + {3592170000 -3600 0 -01} + {3604870800 0 1 +00} + {3623619600 -3600 0 -01} + {3636320400 0 1 +00} + {3655069200 -3600 0 -01} + {3668374800 0 1 +00} + {3686518800 -3600 0 -01} + {3699824400 0 1 +00} + {3717968400 -3600 0 -01} + {3731274000 0 1 +00} + {3750022800 -3600 0 -01} + {3762723600 0 1 +00} + {3781472400 -3600 0 -01} + {3794173200 0 1 +00} + {3812922000 -3600 0 -01} + {3825622800 0 1 +00} + {3844371600 -3600 0 -01} + {3857677200 0 1 +00} + {3875821200 -3600 0 -01} + {3889126800 0 1 +00} + {3907270800 -3600 0 -01} + {3920576400 0 1 +00} + {3939325200 -3600 0 -01} + {3952026000 0 1 +00} + {3970774800 -3600 0 -01} + {3983475600 0 1 +00} + {4002224400 -3600 0 -01} + {4015530000 0 1 +00} + {4033674000 -3600 0 -01} + {4046979600 0 1 +00} + {4065123600 -3600 0 -01} + {4078429200 0 1 +00} + {4096573200 -3600 0 -01} } diff --git a/library/tzdata/Antarctica/Macquarie b/library/tzdata/Antarctica/Macquarie index 9ed0630..60bf7a6 100644 --- a/library/tzdata/Antarctica/Macquarie +++ b/library/tzdata/Antarctica/Macquarie @@ -93,5 +93,5 @@ set TZData(:Antarctica/Macquarie) { {1223136000 39600 1 AEDT} {1238860800 36000 0 AEST} {1254585600 39600 1 AEDT} - {1270310400 39600 0 MIST} + {1270310400 39600 0 +11} } diff --git a/library/tzdata/Antarctica/Palmer b/library/tzdata/Antarctica/Palmer index 62b17e1..bb2be4d 100644 --- a/library/tzdata/Antarctica/Palmer +++ b/library/tzdata/Antarctica/Palmer @@ -2,251 +2,86 @@ set TZData(:Antarctica/Palmer) { {-9223372036854775808 0 0 -00} - {-157766400 -14400 0 ART} - {-152654400 -14400 0 ART} - {-132955200 -10800 1 ARST} - {-121122000 -14400 0 ART} - {-101419200 -10800 1 ARST} - {-86821200 -14400 0 ART} - {-71092800 -10800 1 ARST} - {-54766800 -14400 0 ART} - {-39038400 -10800 1 ARST} - {-23317200 -14400 0 ART} - {-7588800 -10800 0 ART} - {128142000 -7200 1 ARST} - {136605600 -10800 0 ART} - {389070000 -14400 0 CLT} - {403070400 -10800 1 CLST} - {416372400 -14400 0 CLT} - {434520000 -10800 1 CLST} - {447822000 -14400 0 CLT} - {466574400 -10800 1 CLST} - {479271600 -14400 0 CLT} - {498024000 -10800 1 CLST} - {510721200 -14400 0 CLT} - {529473600 -10800 1 CLST} - {545194800 -14400 0 CLT} - {560923200 -10800 1 CLST} - {574225200 -14400 0 CLT} - {592372800 -10800 1 CLST} - {605674800 -14400 0 CLT} - {624427200 -10800 1 CLST} - {637124400 -14400 0 CLT} - {653457600 -10800 1 CLST} - {668574000 -14400 0 CLT} - {687326400 -10800 1 CLST} - {700628400 -14400 0 CLT} - {718776000 -10800 1 CLST} - {732078000 -14400 0 CLT} - {750225600 -10800 1 CLST} - {763527600 -14400 0 CLT} - {781675200 -10800 1 CLST} - {794977200 -14400 0 CLT} - {813729600 -10800 1 CLST} - {826426800 -14400 0 CLT} - {845179200 -10800 1 CLST} - {859690800 -14400 0 CLT} - {876628800 -10800 1 CLST} - {889930800 -14400 0 CLT} - {906868800 -10800 1 CLST} - {923194800 -14400 0 CLT} - {939528000 -10800 1 CLST} - {952830000 -14400 0 CLT} - {971582400 -10800 1 CLST} - {984279600 -14400 0 CLT} - {1003032000 -10800 1 CLST} - {1015729200 -14400 0 CLT} - {1034481600 -10800 1 CLST} - {1047178800 -14400 0 CLT} - {1065931200 -10800 1 CLST} - {1079233200 -14400 0 CLT} - {1097380800 -10800 1 CLST} - {1110682800 -14400 0 CLT} - {1128830400 -10800 1 CLST} - {1142132400 -14400 0 CLT} - {1160884800 -10800 1 CLST} - {1173582000 -14400 0 CLT} - {1192334400 -10800 1 CLST} - {1206846000 -14400 0 CLT} - {1223784000 -10800 1 CLST} - {1237086000 -14400 0 CLT} - {1255233600 -10800 1 CLST} - {1270350000 -14400 0 CLT} - {1286683200 -10800 1 CLST} - {1304823600 -14400 0 CLT} - {1313899200 -10800 1 CLST} - {1335668400 -14400 0 CLT} - {1346558400 -10800 1 CLST} - {1367118000 -14400 0 CLT} - {1378612800 -10800 1 CLST} - {1398567600 -14400 0 CLT} - {1410062400 -10800 1 CLST} - {1463281200 -14400 0 CLT} - {1471147200 -10800 1 CLST} - {1494730800 -14400 0 CLT} - {1502596800 -10800 1 CLST} - {1526180400 -14400 0 CLT} - {1534046400 -10800 1 CLST} - {1557630000 -14400 0 CLT} - {1565496000 -10800 1 CLST} - {1589079600 -14400 0 CLT} - {1596945600 -10800 1 CLST} - {1620529200 -14400 0 CLT} - {1629000000 -10800 1 CLST} - {1652583600 -14400 0 CLT} - {1660449600 -10800 1 CLST} - {1684033200 -14400 0 CLT} - {1691899200 -10800 1 CLST} - {1715482800 -14400 0 CLT} - {1723348800 -10800 1 CLST} - {1746932400 -14400 0 CLT} - {1754798400 -10800 1 CLST} - {1778382000 -14400 0 CLT} - {1786248000 -10800 1 CLST} - {1809831600 -14400 0 CLT} - {1818302400 -10800 1 CLST} - {1841886000 -14400 0 CLT} - {1849752000 -10800 1 CLST} - {1873335600 -14400 0 CLT} - {1881201600 -10800 1 CLST} - {1904785200 -14400 0 CLT} - {1912651200 -10800 1 CLST} - {1936234800 -14400 0 CLT} - {1944100800 -10800 1 CLST} - {1967684400 -14400 0 CLT} - {1976155200 -10800 1 CLST} - {1999738800 -14400 0 CLT} - {2007604800 -10800 1 CLST} - {2031188400 -14400 0 CLT} - {2039054400 -10800 1 CLST} - {2062638000 -14400 0 CLT} - {2070504000 -10800 1 CLST} - {2094087600 -14400 0 CLT} - {2101953600 -10800 1 CLST} - {2125537200 -14400 0 CLT} - {2133403200 -10800 1 CLST} - {2156986800 -14400 0 CLT} - {2165457600 -10800 1 CLST} - {2189041200 -14400 0 CLT} - {2196907200 -10800 1 CLST} - {2220490800 -14400 0 CLT} - {2228356800 -10800 1 CLST} - {2251940400 -14400 0 CLT} - {2259806400 -10800 1 CLST} - {2283390000 -14400 0 CLT} - {2291256000 -10800 1 CLST} - {2314839600 -14400 0 CLT} - {2322705600 -10800 1 CLST} - {2346894000 -14400 0 CLT} - {2354760000 -10800 1 CLST} - {2378343600 -14400 0 CLT} - {2386209600 -10800 1 CLST} - {2409793200 -14400 0 CLT} - {2417659200 -10800 1 CLST} - {2441242800 -14400 0 CLT} - {2449108800 -10800 1 CLST} - {2472692400 -14400 0 CLT} - {2480558400 -10800 1 CLST} - {2504142000 -14400 0 CLT} - {2512612800 -10800 1 CLST} - {2536196400 -14400 0 CLT} - {2544062400 -10800 1 CLST} - {2567646000 -14400 0 CLT} - {2575512000 -10800 1 CLST} - {2599095600 -14400 0 CLT} - {2606961600 -10800 1 CLST} - {2630545200 -14400 0 CLT} - {2638411200 -10800 1 CLST} - {2661994800 -14400 0 CLT} - {2669860800 -10800 1 CLST} - {2693444400 -14400 0 CLT} - {2701915200 -10800 1 CLST} - {2725498800 -14400 0 CLT} - {2733364800 -10800 1 CLST} - {2756948400 -14400 0 CLT} - {2764814400 -10800 1 CLST} - {2788398000 -14400 0 CLT} - {2796264000 -10800 1 CLST} - {2819847600 -14400 0 CLT} - {2827713600 -10800 1 CLST} - {2851297200 -14400 0 CLT} - {2859768000 -10800 1 CLST} - {2883351600 -14400 0 CLT} - {2891217600 -10800 1 CLST} - {2914801200 -14400 0 CLT} - {2922667200 -10800 1 CLST} - {2946250800 -14400 0 CLT} - {2954116800 -10800 1 CLST} - {2977700400 -14400 0 CLT} - {2985566400 -10800 1 CLST} - {3009150000 -14400 0 CLT} - {3017016000 -10800 1 CLST} - {3040599600 -14400 0 CLT} - {3049070400 -10800 1 CLST} - {3072654000 -14400 0 CLT} - {3080520000 -10800 1 CLST} - {3104103600 -14400 0 CLT} - {3111969600 -10800 1 CLST} - {3135553200 -14400 0 CLT} - {3143419200 -10800 1 CLST} - {3167002800 -14400 0 CLT} - {3174868800 -10800 1 CLST} - {3198452400 -14400 0 CLT} - {3206318400 -10800 1 CLST} - {3230506800 -14400 0 CLT} - {3238372800 -10800 1 CLST} - {3261956400 -14400 0 CLT} - {3269822400 -10800 1 CLST} - {3293406000 -14400 0 CLT} - {3301272000 -10800 1 CLST} - {3324855600 -14400 0 CLT} - {3332721600 -10800 1 CLST} - {3356305200 -14400 0 CLT} - {3364171200 -10800 1 CLST} - {3387754800 -14400 0 CLT} - {3396225600 -10800 1 CLST} - {3419809200 -14400 0 CLT} - {3427675200 -10800 1 CLST} - {3451258800 -14400 0 CLT} - {3459124800 -10800 1 CLST} - {3482708400 -14400 0 CLT} - {3490574400 -10800 1 CLST} - {3514158000 -14400 0 CLT} - {3522024000 -10800 1 CLST} - {3545607600 -14400 0 CLT} - {3553473600 -10800 1 CLST} - {3577057200 -14400 0 CLT} - {3585528000 -10800 1 CLST} - {3609111600 -14400 0 CLT} - {3616977600 -10800 1 CLST} - {3640561200 -14400 0 CLT} - {3648427200 -10800 1 CLST} - {3672010800 -14400 0 CLT} - {3679876800 -10800 1 CLST} - {3703460400 -14400 0 CLT} - {3711326400 -10800 1 CLST} - {3734910000 -14400 0 CLT} - {3743380800 -10800 1 CLST} - {3766964400 -14400 0 CLT} - {3774830400 -10800 1 CLST} - {3798414000 -14400 0 CLT} - {3806280000 -10800 1 CLST} - {3829863600 -14400 0 CLT} - {3837729600 -10800 1 CLST} - {3861313200 -14400 0 CLT} - {3869179200 -10800 1 CLST} - {3892762800 -14400 0 CLT} - {3900628800 -10800 1 CLST} - {3924212400 -14400 0 CLT} - {3932683200 -10800 1 CLST} - {3956266800 -14400 0 CLT} - {3964132800 -10800 1 CLST} - {3987716400 -14400 0 CLT} - {3995582400 -10800 1 CLST} - {4019166000 -14400 0 CLT} - {4027032000 -10800 1 CLST} - {4050615600 -14400 0 CLT} - {4058481600 -10800 1 CLST} - {4082065200 -14400 0 CLT} - {4089931200 -10800 1 CLST} + {-157766400 -14400 0 -04} + {-152654400 -14400 0 -04} + {-132955200 -10800 1 -03} + {-121122000 -14400 0 -04} + {-101419200 -10800 1 -03} + {-86821200 -14400 0 -04} + {-71092800 -10800 1 -03} + {-54766800 -14400 0 -04} + {-39038400 -10800 1 -03} + {-23317200 -14400 0 -04} + {-7588800 -10800 0 -03} + {128142000 -7200 1 -02} + {136605600 -10800 0 -03} + {389070000 -14400 0 -04} + {403070400 -10800 1 -03} + {416372400 -14400 0 -04} + {434520000 -10800 1 -03} + {447822000 -14400 0 -04} + {466574400 -10800 1 -03} + {479271600 -14400 0 -04} + {498024000 -10800 1 -03} + {510721200 -14400 0 -04} + {529473600 -10800 1 -03} + {545194800 -14400 0 -04} + {560923200 -10800 1 -03} + {574225200 -14400 0 -04} + {592372800 -10800 1 -03} + {605674800 -14400 0 -04} + {624427200 -10800 1 -03} + {637124400 -14400 0 -04} + {653457600 -10800 1 -03} + {668574000 -14400 0 -04} + {687326400 -10800 1 -03} + {700628400 -14400 0 -04} + {718776000 -10800 1 -03} + {732078000 -14400 0 -04} + {750225600 -10800 1 -03} + {763527600 -14400 0 -04} + {781675200 -10800 1 -03} + {794977200 -14400 0 -04} + {813729600 -10800 1 -03} + {826426800 -14400 0 -04} + {845179200 -10800 1 -03} + {859690800 -14400 0 -04} + {876628800 -10800 1 -03} + {889930800 -14400 0 -04} + {906868800 -10800 1 -03} + {923194800 -14400 0 -04} + {939528000 -10800 1 -03} + {952830000 -14400 0 -04} + {971582400 -10800 1 -03} + {984279600 -14400 0 -04} + {1003032000 -10800 1 -03} + {1015729200 -14400 0 -04} + {1034481600 -10800 1 -03} + {1047178800 -14400 0 -04} + {1065931200 -10800 1 -03} + {1079233200 -14400 0 -04} + {1097380800 -10800 1 -03} + {1110682800 -14400 0 -04} + {1128830400 -10800 1 -03} + {1142132400 -14400 0 -04} + {1160884800 -10800 1 -03} + {1173582000 -14400 0 -04} + {1192334400 -10800 1 -03} + {1206846000 -14400 0 -04} + {1223784000 -10800 1 -03} + {1237086000 -14400 0 -04} + {1255233600 -10800 1 -03} + {1270350000 -14400 0 -04} + {1286683200 -10800 1 -03} + {1304823600 -14400 0 -04} + {1313899200 -10800 1 -03} + {1335668400 -14400 0 -04} + {1346558400 -10800 1 -03} + {1367118000 -14400 0 -04} + {1378612800 -10800 1 -03} + {1398567600 -14400 0 -04} + {1410062400 -10800 1 -03} + {1463281200 -14400 0 -04} + {1471147200 -10800 1 -03} + {1480820400 -10800 0 -03} } diff --git a/library/tzdata/Asia/Atyrau b/library/tzdata/Asia/Atyrau index f274540..c31ff11 100644 --- a/library/tzdata/Asia/Atyrau +++ b/library/tzdata/Asia/Atyrau @@ -2,8 +2,8 @@ set TZData(:Asia/Atyrau) { {-9223372036854775808 12464 0 LMT} - {-1441164464 14400 0 +04} - {-1247544000 18000 0 +05} + {-1441164464 10800 0 +03} + {-1247540400 18000 0 +05} {370724400 21600 0 +06} {386445600 18000 0 +05} {386449200 21600 1 +06} diff --git a/library/tzdata/Asia/Baghdad b/library/tzdata/Asia/Baghdad index c1058cb..623e310 100644 --- a/library/tzdata/Asia/Baghdad +++ b/library/tzdata/Asia/Baghdad @@ -3,57 +3,57 @@ set TZData(:Asia/Baghdad) { {-9223372036854775808 10660 0 LMT} {-2524532260 10656 0 BMT} - {-1641005856 10800 0 AST} - {389048400 14400 0 ADT} - {402264000 10800 0 AST} - {417906000 14400 1 ADT} - {433800000 10800 0 AST} - {449614800 14400 1 ADT} - {465422400 10800 0 AST} - {481150800 14400 1 ADT} - {496792800 10800 0 AST} - {512517600 14400 1 ADT} - {528242400 10800 0 AST} - {543967200 14400 1 ADT} - {559692000 10800 0 AST} - {575416800 14400 1 ADT} - {591141600 10800 0 AST} - {606866400 14400 1 ADT} - {622591200 10800 0 AST} - {638316000 14400 1 ADT} - {654645600 10800 0 AST} - {670464000 14400 1 ADT} - {686275200 10800 0 AST} - {702086400 14400 1 ADT} - {717897600 10800 0 AST} - {733622400 14400 1 ADT} - {749433600 10800 0 AST} - {765158400 14400 1 ADT} - {780969600 10800 0 AST} - {796694400 14400 1 ADT} - {812505600 10800 0 AST} - {828316800 14400 1 ADT} - {844128000 10800 0 AST} - {859852800 14400 1 ADT} - {875664000 10800 0 AST} - {891388800 14400 1 ADT} - {907200000 10800 0 AST} - {922924800 14400 1 ADT} - {938736000 10800 0 AST} - {954547200 14400 1 ADT} - {970358400 10800 0 AST} - {986083200 14400 1 ADT} - {1001894400 10800 0 AST} - {1017619200 14400 1 ADT} - {1033430400 10800 0 AST} - {1049155200 14400 1 ADT} - {1064966400 10800 0 AST} - {1080777600 14400 1 ADT} - {1096588800 10800 0 AST} - {1112313600 14400 1 ADT} - {1128124800 10800 0 AST} - {1143849600 14400 1 ADT} - {1159660800 10800 0 AST} - {1175385600 14400 1 ADT} - {1191196800 10800 0 AST} + {-1641005856 10800 0 +03} + {389048400 14400 0 +04} + {402264000 10800 0 +04} + {417906000 14400 1 +04} + {433800000 10800 0 +04} + {449614800 14400 1 +04} + {465422400 10800 0 +04} + {481150800 14400 1 +04} + {496792800 10800 0 +04} + {512517600 14400 1 +04} + {528242400 10800 0 +04} + {543967200 14400 1 +04} + {559692000 10800 0 +04} + {575416800 14400 1 +04} + {591141600 10800 0 +04} + {606866400 14400 1 +04} + {622591200 10800 0 +04} + {638316000 14400 1 +04} + {654645600 10800 0 +04} + {670464000 14400 1 +04} + {686275200 10800 0 +04} + {702086400 14400 1 +04} + {717897600 10800 0 +04} + {733622400 14400 1 +04} + {749433600 10800 0 +04} + {765158400 14400 1 +04} + {780969600 10800 0 +04} + {796694400 14400 1 +04} + {812505600 10800 0 +04} + {828316800 14400 1 +04} + {844128000 10800 0 +04} + {859852800 14400 1 +04} + {875664000 10800 0 +04} + {891388800 14400 1 +04} + {907200000 10800 0 +04} + {922924800 14400 1 +04} + {938736000 10800 0 +04} + {954547200 14400 1 +04} + {970358400 10800 0 +04} + {986083200 14400 1 +04} + {1001894400 10800 0 +04} + {1017619200 14400 1 +04} + {1033430400 10800 0 +04} + {1049155200 14400 1 +04} + {1064966400 10800 0 +04} + {1080777600 14400 1 +04} + {1096588800 10800 0 +04} + {1112313600 14400 1 +04} + {1128124800 10800 0 +04} + {1143849600 14400 1 +04} + {1159660800 10800 0 +04} + {1175385600 14400 1 +04} + {1191196800 10800 0 +04} } diff --git a/library/tzdata/Asia/Bangkok b/library/tzdata/Asia/Bangkok index 6df7680..aeb5473 100644 --- a/library/tzdata/Asia/Bangkok +++ b/library/tzdata/Asia/Bangkok @@ -3,5 +3,5 @@ set TZData(:Asia/Bangkok) { {-9223372036854775808 24124 0 LMT} {-2840164924 24124 0 BMT} - {-1570084924 25200 0 ICT} + {-1570084924 25200 0 +07} } diff --git a/library/tzdata/Asia/Brunei b/library/tzdata/Asia/Brunei index 63d380b..e8cc8c3 100644 --- a/library/tzdata/Asia/Brunei +++ b/library/tzdata/Asia/Brunei @@ -2,6 +2,6 @@ set TZData(:Asia/Brunei) { {-9223372036854775808 27580 0 LMT} - {-1383464380 27000 0 BNT} - {-1167636600 28800 0 BNT} + {-1383464380 27000 0 +0730} + {-1167636600 28800 0 +08} } diff --git a/library/tzdata/Asia/Choibalsan b/library/tzdata/Asia/Choibalsan index 2bcf7f7..3db65de 100644 --- a/library/tzdata/Asia/Choibalsan +++ b/library/tzdata/Asia/Choibalsan @@ -2,221 +2,55 @@ set TZData(:Asia/Choibalsan) { {-9223372036854775808 27480 0 LMT} - {-2032933080 25200 0 ULAT} - {252435600 28800 0 ULAT} - {417974400 36000 0 CHOST} - {433778400 32400 0 CHOT} - {449593200 36000 1 CHOST} - {465314400 32400 0 CHOT} - {481042800 36000 1 CHOST} - {496764000 32400 0 CHOT} - {512492400 36000 1 CHOST} - {528213600 32400 0 CHOT} - {543942000 36000 1 CHOST} - {559663200 32400 0 CHOT} - {575391600 36000 1 CHOST} - {591112800 32400 0 CHOT} - {606841200 36000 1 CHOST} - {622562400 32400 0 CHOT} - {638290800 36000 1 CHOST} - {654616800 32400 0 CHOT} - {670345200 36000 1 CHOST} - {686066400 32400 0 CHOT} - {701794800 36000 1 CHOST} - {717516000 32400 0 CHOT} - {733244400 36000 1 CHOST} - {748965600 32400 0 CHOT} - {764694000 36000 1 CHOST} - {780415200 32400 0 CHOT} - {796143600 36000 1 CHOST} - {811864800 32400 0 CHOT} - {828198000 36000 1 CHOST} - {843919200 32400 0 CHOT} - {859647600 36000 1 CHOST} - {875368800 32400 0 CHOT} - {891097200 36000 1 CHOST} - {906818400 32400 0 CHOT} - {988390800 36000 1 CHOST} - {1001692800 32400 0 CHOT} - {1017421200 36000 1 CHOST} - {1033142400 32400 0 CHOT} - {1048870800 36000 1 CHOST} - {1064592000 32400 0 CHOT} - {1080320400 36000 1 CHOST} - {1096041600 32400 0 CHOT} - {1111770000 36000 1 CHOST} - {1127491200 32400 0 CHOT} - {1143219600 36000 1 CHOST} - {1159545600 32400 0 CHOT} - {1206889200 28800 0 CHOT} - {1427479200 32400 1 CHOST} - {1443193200 28800 0 CHOT} - {1458928800 32400 1 CHOST} - {1474642800 28800 0 CHOT} - {1490378400 32400 1 CHOST} - {1506697200 28800 0 CHOT} - {1522432800 32400 1 CHOST} - {1538146800 28800 0 CHOT} - {1553882400 32400 1 CHOST} - {1569596400 28800 0 CHOT} - {1585332000 32400 1 CHOST} - {1601046000 28800 0 CHOT} - {1616781600 32400 1 CHOST} - {1632495600 28800 0 CHOT} - {1648231200 32400 1 CHOST} - {1663945200 28800 0 CHOT} - {1679680800 32400 1 CHOST} - {1695999600 28800 0 CHOT} - {1711735200 32400 1 CHOST} - {1727449200 28800 0 CHOT} - {1743184800 32400 1 CHOST} - {1758898800 28800 0 CHOT} - {1774634400 32400 1 CHOST} - {1790348400 28800 0 CHOT} - {1806084000 32400 1 CHOST} - {1821798000 28800 0 CHOT} - {1837533600 32400 1 CHOST} - {1853852400 28800 0 CHOT} - {1869588000 32400 1 CHOST} - {1885302000 28800 0 CHOT} - {1901037600 32400 1 CHOST} - {1916751600 28800 0 CHOT} - {1932487200 32400 1 CHOST} - {1948201200 28800 0 CHOT} - {1963936800 32400 1 CHOST} - {1979650800 28800 0 CHOT} - {1995386400 32400 1 CHOST} - {2011100400 28800 0 CHOT} - {2026836000 32400 1 CHOST} - {2043154800 28800 0 CHOT} - {2058890400 32400 1 CHOST} - {2074604400 28800 0 CHOT} - {2090340000 32400 1 CHOST} - {2106054000 28800 0 CHOT} - {2121789600 32400 1 CHOST} - {2137503600 28800 0 CHOT} - {2153239200 32400 1 CHOST} - {2168953200 28800 0 CHOT} - {2184688800 32400 1 CHOST} - {2200402800 28800 0 CHOT} - {2216743200 32400 1 CHOST} - {2232457200 28800 0 CHOT} - {2248192800 32400 1 CHOST} - {2263906800 28800 0 CHOT} - {2279642400 32400 1 CHOST} - {2295356400 28800 0 CHOT} - {2311092000 32400 1 CHOST} - {2326806000 28800 0 CHOT} - {2342541600 32400 1 CHOST} - {2358255600 28800 0 CHOT} - {2373991200 32400 1 CHOST} - {2390310000 28800 0 CHOT} - {2406045600 32400 1 CHOST} - {2421759600 28800 0 CHOT} - {2437495200 32400 1 CHOST} - {2453209200 28800 0 CHOT} - {2468944800 32400 1 CHOST} - {2484658800 28800 0 CHOT} - {2500394400 32400 1 CHOST} - {2516108400 28800 0 CHOT} - {2531844000 32400 1 CHOST} - {2547558000 28800 0 CHOT} - {2563293600 32400 1 CHOST} - {2579612400 28800 0 CHOT} - {2595348000 32400 1 CHOST} - {2611062000 28800 0 CHOT} - {2626797600 32400 1 CHOST} - {2642511600 28800 0 CHOT} - {2658247200 32400 1 CHOST} - {2673961200 28800 0 CHOT} - {2689696800 32400 1 CHOST} - {2705410800 28800 0 CHOT} - {2721146400 32400 1 CHOST} - {2737465200 28800 0 CHOT} - {2753200800 32400 1 CHOST} - {2768914800 28800 0 CHOT} - {2784650400 32400 1 CHOST} - {2800364400 28800 0 CHOT} - {2816100000 32400 1 CHOST} - {2831814000 28800 0 CHOT} - {2847549600 32400 1 CHOST} - {2863263600 28800 0 CHOT} - {2878999200 32400 1 CHOST} - {2894713200 28800 0 CHOT} - {2910448800 32400 1 CHOST} - {2926767600 28800 0 CHOT} - {2942503200 32400 1 CHOST} - {2958217200 28800 0 CHOT} - {2973952800 32400 1 CHOST} - {2989666800 28800 0 CHOT} - {3005402400 32400 1 CHOST} - {3021116400 28800 0 CHOT} - {3036852000 32400 1 CHOST} - {3052566000 28800 0 CHOT} - {3068301600 32400 1 CHOST} - {3084015600 28800 0 CHOT} - {3100356000 32400 1 CHOST} - {3116070000 28800 0 CHOT} - {3131805600 32400 1 CHOST} - {3147519600 28800 0 CHOT} - {3163255200 32400 1 CHOST} - {3178969200 28800 0 CHOT} - {3194704800 32400 1 CHOST} - {3210418800 28800 0 CHOT} - {3226154400 32400 1 CHOST} - {3241868400 28800 0 CHOT} - {3257604000 32400 1 CHOST} - {3273922800 28800 0 CHOT} - {3289658400 32400 1 CHOST} - {3305372400 28800 0 CHOT} - {3321108000 32400 1 CHOST} - {3336822000 28800 0 CHOT} - {3352557600 32400 1 CHOST} - {3368271600 28800 0 CHOT} - {3384007200 32400 1 CHOST} - {3399721200 28800 0 CHOT} - {3415456800 32400 1 CHOST} - {3431170800 28800 0 CHOT} - {3446906400 32400 1 CHOST} - {3463225200 28800 0 CHOT} - {3478960800 32400 1 CHOST} - {3494674800 28800 0 CHOT} - {3510410400 32400 1 CHOST} - {3526124400 28800 0 CHOT} - {3541860000 32400 1 CHOST} - {3557574000 28800 0 CHOT} - {3573309600 32400 1 CHOST} - {3589023600 28800 0 CHOT} - {3604759200 32400 1 CHOST} - {3621078000 28800 0 CHOT} - {3636813600 32400 1 CHOST} - {3652527600 28800 0 CHOT} - {3668263200 32400 1 CHOST} - {3683977200 28800 0 CHOT} - {3699712800 32400 1 CHOST} - {3715426800 28800 0 CHOT} - {3731162400 32400 1 CHOST} - {3746876400 28800 0 CHOT} - {3762612000 32400 1 CHOST} - {3778326000 28800 0 CHOT} - {3794061600 32400 1 CHOST} - {3810380400 28800 0 CHOT} - {3826116000 32400 1 CHOST} - {3841830000 28800 0 CHOT} - {3857565600 32400 1 CHOST} - {3873279600 28800 0 CHOT} - {3889015200 32400 1 CHOST} - {3904729200 28800 0 CHOT} - {3920464800 32400 1 CHOST} - {3936178800 28800 0 CHOT} - {3951914400 32400 1 CHOST} - {3967628400 28800 0 CHOT} - {3983968800 32400 1 CHOST} - {3999682800 28800 0 CHOT} - {4015418400 32400 1 CHOST} - {4031132400 28800 0 CHOT} - {4046868000 32400 1 CHOST} - {4062582000 28800 0 CHOT} - {4078317600 32400 1 CHOST} - {4094031600 28800 0 CHOT} + {-2032933080 25200 0 +07} + {252435600 28800 0 +08} + {417974400 36000 0 +10} + {433778400 32400 0 +09} + {449593200 36000 1 +10} + {465314400 32400 0 +09} + {481042800 36000 1 +10} + {496764000 32400 0 +09} + {512492400 36000 1 +10} + {528213600 32400 0 +09} + {543942000 36000 1 +10} + {559663200 32400 0 +09} + {575391600 36000 1 +10} + {591112800 32400 0 +09} + {606841200 36000 1 +10} + {622562400 32400 0 +09} + {638290800 36000 1 +10} + {654616800 32400 0 +09} + {670345200 36000 1 +10} + {686066400 32400 0 +09} + {701794800 36000 1 +10} + {717516000 32400 0 +09} + {733244400 36000 1 +10} + {748965600 32400 0 +09} + {764694000 36000 1 +10} + {780415200 32400 0 +09} + {796143600 36000 1 +10} + {811864800 32400 0 +09} + {828198000 36000 1 +10} + {843919200 32400 0 +09} + {859647600 36000 1 +10} + {875368800 32400 0 +09} + {891097200 36000 1 +10} + {906818400 32400 0 +09} + {988390800 36000 1 +10} + {1001692800 32400 0 +09} + {1017421200 36000 1 +10} + {1033142400 32400 0 +09} + {1048870800 36000 1 +10} + {1064592000 32400 0 +09} + {1080320400 36000 1 +10} + {1096041600 32400 0 +09} + {1111770000 36000 1 +10} + {1127491200 32400 0 +09} + {1143219600 36000 1 +10} + {1159545600 32400 0 +09} + {1206889200 28800 0 +08} + {1427479200 32400 1 +09} + {1443193200 28800 0 +08} + {1458928800 32400 1 +09} + {1474642800 28800 0 +08} } diff --git a/library/tzdata/Asia/Dhaka b/library/tzdata/Asia/Dhaka index 6e8a334..0dc3987 100644 --- a/library/tzdata/Asia/Dhaka +++ b/library/tzdata/Asia/Dhaka @@ -3,12 +3,11 @@ set TZData(:Asia/Dhaka) { {-9223372036854775808 21700 0 LMT} {-2524543300 21200 0 HMT} - {-891582800 23400 0 BURT} - {-872058600 19800 0 IST} - {-862637400 23400 0 BURT} - {-576138600 21600 0 DACT} - {38772000 21600 0 BDT} - {1230746400 21600 0 BDT} - {1245430800 25200 1 BDST} - {1262278800 21600 0 BDT} + {-891582800 23400 0 +0630} + {-872058600 19800 0 +0530} + {-862637400 23400 0 +0630} + {-576138600 21600 0 +06} + {1230746400 21600 0 +06} + {1245430800 25200 1 +07} + {1262278800 21600 0 +06} } diff --git a/library/tzdata/Asia/Dili b/library/tzdata/Asia/Dili index f783557..89cf22f 100644 --- a/library/tzdata/Asia/Dili +++ b/library/tzdata/Asia/Dili @@ -2,9 +2,8 @@ set TZData(:Asia/Dili) { {-9223372036854775808 30140 0 LMT} - {-1830414140 28800 0 TLT} - {-879152400 32400 0 JST} - {-766054800 32400 0 TLT} - {199897200 28800 0 WITA} - {969120000 32400 0 TLT} + {-1830414140 28800 0 +08} + {-879152400 32400 0 +09} + {199897200 28800 0 +08} + {969120000 32400 0 +09} } diff --git a/library/tzdata/Asia/Dubai b/library/tzdata/Asia/Dubai index b8730e5..6c18e79 100644 --- a/library/tzdata/Asia/Dubai +++ b/library/tzdata/Asia/Dubai @@ -2,5 +2,5 @@ set TZData(:Asia/Dubai) { {-9223372036854775808 13272 0 LMT} - {-1577936472 14400 0 GST} + {-1577936472 14400 0 +04} } diff --git a/library/tzdata/Asia/Ho_Chi_Minh b/library/tzdata/Asia/Ho_Chi_Minh index 9da89f4..b4e749b 100644 --- a/library/tzdata/Asia/Ho_Chi_Minh +++ b/library/tzdata/Asia/Ho_Chi_Minh @@ -3,12 +3,12 @@ set TZData(:Asia/Ho_Chi_Minh) { {-9223372036854775808 25600 0 LMT} {-2004073600 25590 0 PLMT} - {-1851577590 25200 0 ICT} - {-852105600 28800 0 IDT} - {-782643600 32400 0 JST} - {-767869200 25200 0 ICT} - {-718095600 28800 0 IDT} - {-457776000 25200 0 ICT} - {-315648000 28800 0 IDT} - {171820800 25200 0 ICT} + {-1851577590 25200 0 +07} + {-852105600 28800 0 +08} + {-782643600 32400 0 +09} + {-767869200 25200 0 +07} + {-718095600 28800 0 +08} + {-457776000 25200 0 +07} + {-315648000 28800 0 +08} + {171820800 25200 0 +07} } diff --git a/library/tzdata/Asia/Hovd b/library/tzdata/Asia/Hovd index 3d200a6..a9c995b 100644 --- a/library/tzdata/Asia/Hovd +++ b/library/tzdata/Asia/Hovd @@ -2,220 +2,54 @@ set TZData(:Asia/Hovd) { {-9223372036854775808 21996 0 LMT} - {-2032927596 21600 0 HOVT} - {252439200 25200 0 HOVT} - {417978000 28800 1 HOVST} - {433785600 25200 0 HOVT} - {449600400 28800 1 HOVST} - {465321600 25200 0 HOVT} - {481050000 28800 1 HOVST} - {496771200 25200 0 HOVT} - {512499600 28800 1 HOVST} - {528220800 25200 0 HOVT} - {543949200 28800 1 HOVST} - {559670400 25200 0 HOVT} - {575398800 28800 1 HOVST} - {591120000 25200 0 HOVT} - {606848400 28800 1 HOVST} - {622569600 25200 0 HOVT} - {638298000 28800 1 HOVST} - {654624000 25200 0 HOVT} - {670352400 28800 1 HOVST} - {686073600 25200 0 HOVT} - {701802000 28800 1 HOVST} - {717523200 25200 0 HOVT} - {733251600 28800 1 HOVST} - {748972800 25200 0 HOVT} - {764701200 28800 1 HOVST} - {780422400 25200 0 HOVT} - {796150800 28800 1 HOVST} - {811872000 25200 0 HOVT} - {828205200 28800 1 HOVST} - {843926400 25200 0 HOVT} - {859654800 28800 1 HOVST} - {875376000 25200 0 HOVT} - {891104400 28800 1 HOVST} - {906825600 25200 0 HOVT} - {988398000 28800 1 HOVST} - {1001700000 25200 0 HOVT} - {1017428400 28800 1 HOVST} - {1033149600 25200 0 HOVT} - {1048878000 28800 1 HOVST} - {1064599200 25200 0 HOVT} - {1080327600 28800 1 HOVST} - {1096048800 25200 0 HOVT} - {1111777200 28800 1 HOVST} - {1127498400 25200 0 HOVT} - {1143226800 28800 1 HOVST} - {1159552800 25200 0 HOVT} - {1427482800 28800 1 HOVST} - {1443196800 25200 0 HOVT} - {1458932400 28800 1 HOVST} - {1474646400 25200 0 HOVT} - {1490382000 28800 1 HOVST} - {1506700800 25200 0 HOVT} - {1522436400 28800 1 HOVST} - {1538150400 25200 0 HOVT} - {1553886000 28800 1 HOVST} - {1569600000 25200 0 HOVT} - {1585335600 28800 1 HOVST} - {1601049600 25200 0 HOVT} - {1616785200 28800 1 HOVST} - {1632499200 25200 0 HOVT} - {1648234800 28800 1 HOVST} - {1663948800 25200 0 HOVT} - {1679684400 28800 1 HOVST} - {1696003200 25200 0 HOVT} - {1711738800 28800 1 HOVST} - {1727452800 25200 0 HOVT} - {1743188400 28800 1 HOVST} - {1758902400 25200 0 HOVT} - {1774638000 28800 1 HOVST} - {1790352000 25200 0 HOVT} - {1806087600 28800 1 HOVST} - {1821801600 25200 0 HOVT} - {1837537200 28800 1 HOVST} - {1853856000 25200 0 HOVT} - {1869591600 28800 1 HOVST} - {1885305600 25200 0 HOVT} - {1901041200 28800 1 HOVST} - {1916755200 25200 0 HOVT} - {1932490800 28800 1 HOVST} - {1948204800 25200 0 HOVT} - {1963940400 28800 1 HOVST} - {1979654400 25200 0 HOVT} - {1995390000 28800 1 HOVST} - {2011104000 25200 0 HOVT} - {2026839600 28800 1 HOVST} - {2043158400 25200 0 HOVT} - {2058894000 28800 1 HOVST} - {2074608000 25200 0 HOVT} - {2090343600 28800 1 HOVST} - {2106057600 25200 0 HOVT} - {2121793200 28800 1 HOVST} - {2137507200 25200 0 HOVT} - {2153242800 28800 1 HOVST} - {2168956800 25200 0 HOVT} - {2184692400 28800 1 HOVST} - {2200406400 25200 0 HOVT} - {2216746800 28800 1 HOVST} - {2232460800 25200 0 HOVT} - {2248196400 28800 1 HOVST} - {2263910400 25200 0 HOVT} - {2279646000 28800 1 HOVST} - {2295360000 25200 0 HOVT} - {2311095600 28800 1 HOVST} - {2326809600 25200 0 HOVT} - {2342545200 28800 1 HOVST} - {2358259200 25200 0 HOVT} - {2373994800 28800 1 HOVST} - {2390313600 25200 0 HOVT} - {2406049200 28800 1 HOVST} - {2421763200 25200 0 HOVT} - {2437498800 28800 1 HOVST} - {2453212800 25200 0 HOVT} - {2468948400 28800 1 HOVST} - {2484662400 25200 0 HOVT} - {2500398000 28800 1 HOVST} - {2516112000 25200 0 HOVT} - {2531847600 28800 1 HOVST} - {2547561600 25200 0 HOVT} - {2563297200 28800 1 HOVST} - {2579616000 25200 0 HOVT} - {2595351600 28800 1 HOVST} - {2611065600 25200 0 HOVT} - {2626801200 28800 1 HOVST} - {2642515200 25200 0 HOVT} - {2658250800 28800 1 HOVST} - {2673964800 25200 0 HOVT} - {2689700400 28800 1 HOVST} - {2705414400 25200 0 HOVT} - {2721150000 28800 1 HOVST} - {2737468800 25200 0 HOVT} - {2753204400 28800 1 HOVST} - {2768918400 25200 0 HOVT} - {2784654000 28800 1 HOVST} - {2800368000 25200 0 HOVT} - {2816103600 28800 1 HOVST} - {2831817600 25200 0 HOVT} - {2847553200 28800 1 HOVST} - {2863267200 25200 0 HOVT} - {2879002800 28800 1 HOVST} - {2894716800 25200 0 HOVT} - {2910452400 28800 1 HOVST} - {2926771200 25200 0 HOVT} - {2942506800 28800 1 HOVST} - {2958220800 25200 0 HOVT} - {2973956400 28800 1 HOVST} - {2989670400 25200 0 HOVT} - {3005406000 28800 1 HOVST} - {3021120000 25200 0 HOVT} - {3036855600 28800 1 HOVST} - {3052569600 25200 0 HOVT} - {3068305200 28800 1 HOVST} - {3084019200 25200 0 HOVT} - {3100359600 28800 1 HOVST} - {3116073600 25200 0 HOVT} - {3131809200 28800 1 HOVST} - {3147523200 25200 0 HOVT} - {3163258800 28800 1 HOVST} - {3178972800 25200 0 HOVT} - {3194708400 28800 1 HOVST} - {3210422400 25200 0 HOVT} - {3226158000 28800 1 HOVST} - {3241872000 25200 0 HOVT} - {3257607600 28800 1 HOVST} - {3273926400 25200 0 HOVT} - {3289662000 28800 1 HOVST} - {3305376000 25200 0 HOVT} - {3321111600 28800 1 HOVST} - {3336825600 25200 0 HOVT} - {3352561200 28800 1 HOVST} - {3368275200 25200 0 HOVT} - {3384010800 28800 1 HOVST} - {3399724800 25200 0 HOVT} - {3415460400 28800 1 HOVST} - {3431174400 25200 0 HOVT} - {3446910000 28800 1 HOVST} - {3463228800 25200 0 HOVT} - {3478964400 28800 1 HOVST} - {3494678400 25200 0 HOVT} - {3510414000 28800 1 HOVST} - {3526128000 25200 0 HOVT} - {3541863600 28800 1 HOVST} - {3557577600 25200 0 HOVT} - {3573313200 28800 1 HOVST} - {3589027200 25200 0 HOVT} - {3604762800 28800 1 HOVST} - {3621081600 25200 0 HOVT} - {3636817200 28800 1 HOVST} - {3652531200 25200 0 HOVT} - {3668266800 28800 1 HOVST} - {3683980800 25200 0 HOVT} - {3699716400 28800 1 HOVST} - {3715430400 25200 0 HOVT} - {3731166000 28800 1 HOVST} - {3746880000 25200 0 HOVT} - {3762615600 28800 1 HOVST} - {3778329600 25200 0 HOVT} - {3794065200 28800 1 HOVST} - {3810384000 25200 0 HOVT} - {3826119600 28800 1 HOVST} - {3841833600 25200 0 HOVT} - {3857569200 28800 1 HOVST} - {3873283200 25200 0 HOVT} - {3889018800 28800 1 HOVST} - {3904732800 25200 0 HOVT} - {3920468400 28800 1 HOVST} - {3936182400 25200 0 HOVT} - {3951918000 28800 1 HOVST} - {3967632000 25200 0 HOVT} - {3983972400 28800 1 HOVST} - {3999686400 25200 0 HOVT} - {4015422000 28800 1 HOVST} - {4031136000 25200 0 HOVT} - {4046871600 28800 1 HOVST} - {4062585600 25200 0 HOVT} - {4078321200 28800 1 HOVST} - {4094035200 25200 0 HOVT} + {-2032927596 21600 0 +06} + {252439200 25200 0 +07} + {417978000 28800 1 +08} + {433785600 25200 0 +07} + {449600400 28800 1 +08} + {465321600 25200 0 +07} + {481050000 28800 1 +08} + {496771200 25200 0 +07} + {512499600 28800 1 +08} + {528220800 25200 0 +07} + {543949200 28800 1 +08} + {559670400 25200 0 +07} + {575398800 28800 1 +08} + {591120000 25200 0 +07} + {606848400 28800 1 +08} + {622569600 25200 0 +07} + {638298000 28800 1 +08} + {654624000 25200 0 +07} + {670352400 28800 1 +08} + {686073600 25200 0 +07} + {701802000 28800 1 +08} + {717523200 25200 0 +07} + {733251600 28800 1 +08} + {748972800 25200 0 +07} + {764701200 28800 1 +08} + {780422400 25200 0 +07} + {796150800 28800 1 +08} + {811872000 25200 0 +07} + {828205200 28800 1 +08} + {843926400 25200 0 +07} + {859654800 28800 1 +08} + {875376000 25200 0 +07} + {891104400 28800 1 +08} + {906825600 25200 0 +07} + {988398000 28800 1 +08} + {1001700000 25200 0 +07} + {1017428400 28800 1 +08} + {1033149600 25200 0 +07} + {1048878000 28800 1 +08} + {1064599200 25200 0 +07} + {1080327600 28800 1 +08} + {1096048800 25200 0 +07} + {1111777200 28800 1 +08} + {1127498400 25200 0 +07} + {1143226800 28800 1 +08} + {1159552800 25200 0 +07} + {1427482800 28800 1 +08} + {1443196800 25200 0 +07} + {1458932400 28800 1 +08} + {1474646400 25200 0 +07} } diff --git a/library/tzdata/Asia/Jakarta b/library/tzdata/Asia/Jakarta index 75cd659..21da168 100644 --- a/library/tzdata/Asia/Jakarta +++ b/library/tzdata/Asia/Jakarta @@ -3,11 +3,11 @@ set TZData(:Asia/Jakarta) { {-9223372036854775808 25632 0 LMT} {-3231299232 25632 0 BMT} - {-1451719200 26400 0 JAVT} - {-1172906400 27000 0 WIB} - {-876641400 32400 0 JST} - {-766054800 27000 0 WIB} - {-683883000 28800 0 WIB} - {-620812800 27000 0 WIB} + {-1451719200 26400 0 +0720} + {-1172906400 27000 0 +0730} + {-876641400 32400 0 +09} + {-766054800 27000 0 +0730} + {-683883000 28800 0 +08} + {-620812800 27000 0 +0730} {-189415800 25200 0 WIB} } diff --git a/library/tzdata/Asia/Jayapura b/library/tzdata/Asia/Jayapura index f3a4c44..1432488 100644 --- a/library/tzdata/Asia/Jayapura +++ b/library/tzdata/Asia/Jayapura @@ -2,7 +2,7 @@ set TZData(:Asia/Jayapura) { {-9223372036854775808 33768 0 LMT} - {-1172913768 32400 0 WIT} - {-799491600 34200 0 ACST} + {-1172913768 32400 0 +09} + {-799491600 34200 0 +0930} {-189423000 32400 0 WIT} } diff --git a/library/tzdata/Asia/Kabul b/library/tzdata/Asia/Kabul index 33d7282..3613de4 100644 --- a/library/tzdata/Asia/Kabul +++ b/library/tzdata/Asia/Kabul @@ -2,6 +2,6 @@ set TZData(:Asia/Kabul) { {-9223372036854775808 16608 0 LMT} - {-2524538208 14400 0 AFT} - {-788932800 16200 0 AFT} + {-2524538208 14400 0 +04} + {-788932800 16200 0 +0430} } diff --git a/library/tzdata/Asia/Karachi b/library/tzdata/Asia/Karachi index 669c11a..1d81926 100644 --- a/library/tzdata/Asia/Karachi +++ b/library/tzdata/Asia/Karachi @@ -2,10 +2,10 @@ set TZData(:Asia/Karachi) { {-9223372036854775808 16092 0 LMT} - {-1988166492 19800 0 IST} - {-862637400 23400 1 IST} - {-764145000 19800 0 IST} - {-576135000 18000 0 KART} + {-1988166492 19800 0 +0530} + {-862637400 23400 1 +0630} + {-764145000 19800 0 +0530} + {-576135000 18000 0 +05} {38775600 18000 0 PKT} {1018119600 21600 1 PKST} {1033840800 18000 0 PKT} diff --git a/library/tzdata/Asia/Kathmandu b/library/tzdata/Asia/Kathmandu index dbec1f0..f88a5a2 100644 --- a/library/tzdata/Asia/Kathmandu +++ b/library/tzdata/Asia/Kathmandu @@ -2,6 +2,6 @@ set TZData(:Asia/Kathmandu) { {-9223372036854775808 20476 0 LMT} - {-1577943676 19800 0 IST} - {504901800 20700 0 NPT} + {-1577943676 19800 0 +0530} + {504901800 20700 0 +0545} } diff --git a/library/tzdata/Asia/Kolkata b/library/tzdata/Asia/Kolkata index a87bf31..6b3b9fb 100644 --- a/library/tzdata/Asia/Kolkata +++ b/library/tzdata/Asia/Kolkata @@ -3,8 +3,8 @@ set TZData(:Asia/Kolkata) { {-9223372036854775808 21208 0 LMT} {-2840162008 21200 0 HMT} - {-891582800 23400 0 BURT} + {-891582800 23400 0 +0630} {-872058600 19800 0 IST} - {-862637400 23400 1 IST} + {-862637400 23400 1 +0630} {-764145000 19800 0 IST} } diff --git a/library/tzdata/Asia/Kuala_Lumpur b/library/tzdata/Asia/Kuala_Lumpur index 7a54bd6..84eae1d 100644 --- a/library/tzdata/Asia/Kuala_Lumpur +++ b/library/tzdata/Asia/Kuala_Lumpur @@ -3,11 +3,11 @@ set TZData(:Asia/Kuala_Lumpur) { {-9223372036854775808 24406 0 LMT} {-2177477206 24925 0 SMT} - {-2038200925 25200 0 MALT} - {-1167634800 26400 1 MALST} - {-1073028000 26400 0 MALT} - {-894180000 27000 0 MALT} - {-879665400 32400 0 JST} - {-767005200 27000 0 MALT} - {378664200 28800 0 MYT} + {-2038200925 25200 0 +07} + {-1167634800 26400 1 +0720} + {-1073028000 26400 0 +0720} + {-894180000 27000 0 +0730} + {-879665400 32400 0 +09} + {-767005200 27000 0 +0730} + {378664200 28800 0 +08} } diff --git a/library/tzdata/Asia/Kuching b/library/tzdata/Asia/Kuching index 0f9110c..d6f5ad4 100644 --- a/library/tzdata/Asia/Kuching +++ b/library/tzdata/Asia/Kuching @@ -2,23 +2,22 @@ set TZData(:Asia/Kuching) { {-9223372036854775808 26480 0 LMT} - {-1383463280 27000 0 BORT} - {-1167636600 28800 0 BORT} - {-1082448000 30000 1 BORTST} - {-1074586800 28800 0 BORT} - {-1050825600 30000 1 BORTST} - {-1042964400 28800 0 BORT} - {-1019289600 30000 1 BORTST} - {-1011428400 28800 0 BORT} - {-987753600 30000 1 BORTST} - {-979892400 28800 0 BORT} - {-956217600 30000 1 BORTST} - {-948356400 28800 0 BORT} - {-924595200 30000 1 BORTST} - {-916734000 28800 0 BORT} - {-893059200 30000 1 BORTST} - {-885198000 28800 0 BORT} - {-879667200 32400 0 JST} - {-767005200 28800 0 BORT} - {378662400 28800 0 MYT} + {-1383463280 27000 0 +0730} + {-1167636600 28800 0 +08} + {-1082448000 30000 1 +0820} + {-1074586800 28800 0 +08} + {-1050825600 30000 1 +0820} + {-1042964400 28800 0 +08} + {-1019289600 30000 1 +0820} + {-1011428400 28800 0 +08} + {-987753600 30000 1 +0820} + {-979892400 28800 0 +08} + {-956217600 30000 1 +0820} + {-948356400 28800 0 +08} + {-924595200 30000 1 +0820} + {-916734000 28800 0 +08} + {-893059200 30000 1 +0820} + {-885198000 28800 0 +08} + {-879667200 32400 0 +09} + {-767005200 28800 0 +08} } diff --git a/library/tzdata/Asia/Macau b/library/tzdata/Asia/Macau index 9d4abfe..8458a8a 100644 --- a/library/tzdata/Asia/Macau +++ b/library/tzdata/Asia/Macau @@ -2,45 +2,45 @@ set TZData(:Asia/Macau) { {-9223372036854775808 27260 0 LMT} - {-1830411260 28800 0 MOT} - {-277360200 32400 1 MOST} - {-257405400 28800 0 MOT} - {-245910600 32400 1 MOST} - {-225955800 28800 0 MOT} - {-214473600 32400 1 MOST} - {-194506200 28800 0 MOT} - {-182406600 32400 1 MOST} - {-163056600 28800 0 MOT} - {-150969600 32400 1 MOST} - {-131619600 28800 0 MOT} - {-117088200 32400 1 MOST} - {-101367000 28800 0 MOT} - {-85638600 32400 1 MOST} - {-69312600 28800 0 MOT} - {-53584200 32400 1 MOST} - {-37863000 28800 0 MOT} - {-22134600 32400 1 MOST} - {-6413400 28800 0 MOT} - {9315000 32400 1 MOST} - {25036200 28800 0 MOT} - {40764600 32400 1 MOST} - {56485800 28800 0 MOT} - {72201600 32400 1 MOST} - {87922800 28800 0 MOT} - {103651200 32400 1 MOST} - {119977200 28800 0 MOT} - {135705600 32400 1 MOST} - {151439400 28800 0 MOT} - {167167800 32400 1 MOST} - {182889000 28800 0 MOT} - {198617400 32400 1 MOST} - {214338600 28800 0 MOT} - {230067000 32400 1 MOST} - {245788200 28800 0 MOT} - {261504000 32400 1 MOST} - {277225200 28800 0 MOT} - {292953600 32400 1 MOST} - {309279600 28800 0 MOT} - {325008000 32400 1 MOST} - {340729200 28800 0 MOT} + {-1830411260 28800 0 CST} + {-277360200 32400 1 CDT} + {-257405400 28800 0 CST} + {-245910600 32400 1 CDT} + {-225955800 28800 0 CST} + {-214473600 32400 1 CDT} + {-194506200 28800 0 CST} + {-182406600 32400 1 CDT} + {-163056600 28800 0 CST} + {-150969600 32400 1 CDT} + {-131619600 28800 0 CST} + {-117088200 32400 1 CDT} + {-101367000 28800 0 CST} + {-85638600 32400 1 CDT} + {-69312600 28800 0 CST} + {-53584200 32400 1 CDT} + {-37863000 28800 0 CST} + {-22134600 32400 1 CDT} + {-6413400 28800 0 CST} + {9315000 32400 1 CDT} + {25036200 28800 0 CST} + {40764600 32400 1 CDT} + {56485800 28800 0 CST} + {72201600 32400 1 CDT} + {87922800 28800 0 CST} + {103651200 32400 1 CDT} + {119977200 28800 0 CST} + {135705600 32400 1 CDT} + {151439400 28800 0 CST} + {167167800 32400 1 CDT} + {182889000 28800 0 CST} + {198617400 32400 1 CDT} + {214338600 28800 0 CST} + {230067000 32400 1 CDT} + {245788200 28800 0 CST} + {261504000 32400 1 CDT} + {277225200 28800 0 CST} + {292953600 32400 1 CDT} + {309279600 28800 0 CST} + {325008000 32400 1 CDT} + {340729200 28800 0 CST} } diff --git a/library/tzdata/Asia/Makassar b/library/tzdata/Asia/Makassar index be947f3..1be5c59 100644 --- a/library/tzdata/Asia/Makassar +++ b/library/tzdata/Asia/Makassar @@ -3,7 +3,7 @@ set TZData(:Asia/Makassar) { {-9223372036854775808 28656 0 LMT} {-1577951856 28656 0 MMT} - {-1172908656 28800 0 WITA} - {-880272000 32400 0 JST} + {-1172908656 28800 0 +08} + {-880272000 32400 0 +09} {-766054800 28800 0 WITA} } diff --git a/library/tzdata/Asia/Manila b/library/tzdata/Asia/Manila index 9cc25e8..987919a 100644 --- a/library/tzdata/Asia/Manila +++ b/library/tzdata/Asia/Manila @@ -3,13 +3,13 @@ set TZData(:Asia/Manila) { {-9223372036854775808 -57360 0 LMT} {-3944621040 29040 0 LMT} - {-2229321840 28800 0 PHT} - {-1046678400 32400 1 PHST} - {-1038733200 28800 0 PHT} - {-873273600 32400 0 JST} - {-794221200 28800 0 PHT} - {-496224000 32400 1 PHST} - {-489315600 28800 0 PHT} - {259344000 32400 1 PHST} - {275151600 28800 0 PHT} + {-2229321840 28800 0 +08} + {-1046678400 32400 1 +09} + {-1038733200 28800 0 +08} + {-873273600 32400 0 +09} + {-794221200 28800 0 +08} + {-496224000 32400 1 +09} + {-489315600 28800 0 +08} + {259344000 32400 1 +09} + {275151600 28800 0 +08} } diff --git a/library/tzdata/Asia/Oral b/library/tzdata/Asia/Oral index 962111b..624a59d 100644 --- a/library/tzdata/Asia/Oral +++ b/library/tzdata/Asia/Oral @@ -2,8 +2,8 @@ set TZData(:Asia/Oral) { {-9223372036854775808 12324 0 LMT} - {-1441164324 14400 0 +04} - {-1247544000 18000 0 +05} + {-1441164324 10800 0 +03} + {-1247540400 18000 0 +05} {354913200 21600 1 +06} {370720800 21600 0 +06} {386445600 18000 0 +05} diff --git a/library/tzdata/Asia/Pontianak b/library/tzdata/Asia/Pontianak index 728b552..ed59e9d 100644 --- a/library/tzdata/Asia/Pontianak +++ b/library/tzdata/Asia/Pontianak @@ -3,11 +3,11 @@ set TZData(:Asia/Pontianak) { {-9223372036854775808 26240 0 LMT} {-1946186240 26240 0 PMT} - {-1172906240 27000 0 WIB} - {-881220600 32400 0 JST} - {-766054800 27000 0 WIB} - {-683883000 28800 0 WIB} - {-620812800 27000 0 WIB} + {-1172906240 27000 0 +0730} + {-881220600 32400 0 +09} + {-766054800 27000 0 +0730} + {-683883000 28800 0 +08} + {-620812800 27000 0 +0730} {-189415800 28800 0 WITA} {567964800 25200 0 WIB} } diff --git a/library/tzdata/Asia/Pyongyang b/library/tzdata/Asia/Pyongyang index 4ade8e6..72e7f23 100644 --- a/library/tzdata/Asia/Pyongyang +++ b/library/tzdata/Asia/Pyongyang @@ -3,8 +3,7 @@ set TZData(:Asia/Pyongyang) { {-9223372036854775808 30180 0 LMT} {-1948782180 30600 0 KST} - {-1830414600 32400 0 JCST} - {-1017824400 32400 0 JST} + {-1830414600 32400 0 JST} {-768646800 32400 0 KST} {1439564400 30600 0 KST} } diff --git a/library/tzdata/Asia/Qatar b/library/tzdata/Asia/Qatar index bfb4eb4..10b4f6d 100644 --- a/library/tzdata/Asia/Qatar +++ b/library/tzdata/Asia/Qatar @@ -2,6 +2,6 @@ set TZData(:Asia/Qatar) { {-9223372036854775808 12368 0 LMT} - {-1577935568 14400 0 GST} - {76190400 10800 0 AST} + {-1577935568 14400 0 +04} + {76190400 10800 0 +03} } diff --git a/library/tzdata/Asia/Riyadh b/library/tzdata/Asia/Riyadh index 12c9e24..af5efa8 100644 --- a/library/tzdata/Asia/Riyadh +++ b/library/tzdata/Asia/Riyadh @@ -2,5 +2,5 @@ set TZData(:Asia/Riyadh) { {-9223372036854775808 11212 0 LMT} - {-719636812 10800 0 AST} + {-719636812 10800 0 +03} } diff --git a/library/tzdata/Asia/Seoul b/library/tzdata/Asia/Seoul index c24a1d8..b226eb5 100644 --- a/library/tzdata/Asia/Seoul +++ b/library/tzdata/Asia/Seoul @@ -3,8 +3,7 @@ set TZData(:Asia/Seoul) { {-9223372036854775808 30472 0 LMT} {-1948782472 30600 0 KST} - {-1830414600 32400 0 JCST} - {-1017824400 32400 0 JST} + {-1830414600 32400 0 JST} {-767350800 32400 0 KST} {-498128400 30600 0 KST} {-462702600 34200 1 KDT} diff --git a/library/tzdata/Asia/Singapore b/library/tzdata/Asia/Singapore index e2f226e..f10eb1f 100644 --- a/library/tzdata/Asia/Singapore +++ b/library/tzdata/Asia/Singapore @@ -3,12 +3,11 @@ set TZData(:Asia/Singapore) { {-9223372036854775808 24925 0 LMT} {-2177477725 24925 0 SMT} - {-2038200925 25200 0 MALT} - {-1167634800 26400 1 MALST} - {-1073028000 26400 0 MALT} - {-894180000 27000 0 MALT} - {-879665400 32400 0 JST} - {-767005200 27000 0 MALT} - {-138785400 27000 0 SGT} - {378664200 28800 0 SGT} + {-2038200925 25200 0 +07} + {-1167634800 26400 1 +0720} + {-1073028000 26400 0 +0720} + {-894180000 27000 0 +0730} + {-879665400 32400 0 +09} + {-767005200 27000 0 +0730} + {378664200 28800 0 +08} } diff --git a/library/tzdata/Asia/Taipei b/library/tzdata/Asia/Taipei index 61c77ef..cb8fb89 100644 --- a/library/tzdata/Asia/Taipei +++ b/library/tzdata/Asia/Taipei @@ -2,7 +2,7 @@ set TZData(:Asia/Taipei) { {-9223372036854775808 29160 0 LMT} - {-2335248360 28800 0 JWST} + {-2335248360 28800 0 CST} {-1017820800 32400 0 JST} {-766224000 28800 0 CST} {-745833600 32400 1 CDT} diff --git a/library/tzdata/Asia/Tehran b/library/tzdata/Asia/Tehran index 5fd840d..a8912ce 100644 --- a/library/tzdata/Asia/Tehran +++ b/library/tzdata/Asia/Tehran @@ -3,227 +3,227 @@ set TZData(:Asia/Tehran) { {-9223372036854775808 12344 0 LMT} {-1704165944 12344 0 TMT} - {-757394744 12600 0 IRST} - {247177800 14400 0 IRST} - {259272000 18000 1 IRDT} - {277758000 14400 0 IRST} - {283982400 12600 0 IRST} - {290809800 16200 1 IRDT} - {306531000 12600 0 IRST} - {322432200 16200 1 IRDT} - {338499000 12600 0 IRST} - {673216200 16200 1 IRDT} - {685481400 12600 0 IRST} - {701209800 16200 1 IRDT} - {717103800 12600 0 IRST} - {732745800 16200 1 IRDT} - {748639800 12600 0 IRST} - {764281800 16200 1 IRDT} - {780175800 12600 0 IRST} - {795817800 16200 1 IRDT} - {811711800 12600 0 IRST} - {827353800 16200 1 IRDT} - {843247800 12600 0 IRST} - {858976200 16200 1 IRDT} - {874870200 12600 0 IRST} - {890512200 16200 1 IRDT} - {906406200 12600 0 IRST} - {922048200 16200 1 IRDT} - {937942200 12600 0 IRST} - {953584200 16200 1 IRDT} - {969478200 12600 0 IRST} - {985206600 16200 1 IRDT} - {1001100600 12600 0 IRST} - {1016742600 16200 1 IRDT} - {1032636600 12600 0 IRST} - {1048278600 16200 1 IRDT} - {1064172600 12600 0 IRST} - {1079814600 16200 1 IRDT} - {1095708600 12600 0 IRST} - {1111437000 16200 1 IRDT} - {1127331000 12600 0 IRST} - {1206045000 16200 1 IRDT} - {1221939000 12600 0 IRST} - {1237667400 16200 1 IRDT} - {1253561400 12600 0 IRST} - {1269203400 16200 1 IRDT} - {1285097400 12600 0 IRST} - {1300739400 16200 1 IRDT} - {1316633400 12600 0 IRST} - {1332275400 16200 1 IRDT} - {1348169400 12600 0 IRST} - {1363897800 16200 1 IRDT} - {1379791800 12600 0 IRST} - {1395433800 16200 1 IRDT} - {1411327800 12600 0 IRST} - {1426969800 16200 1 IRDT} - {1442863800 12600 0 IRST} - {1458505800 16200 1 IRDT} - {1474399800 12600 0 IRST} - {1490128200 16200 1 IRDT} - {1506022200 12600 0 IRST} - {1521664200 16200 1 IRDT} - {1537558200 12600 0 IRST} - {1553200200 16200 1 IRDT} - {1569094200 12600 0 IRST} - {1584736200 16200 1 IRDT} - {1600630200 12600 0 IRST} - {1616358600 16200 1 IRDT} - {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} - {1884627000 12600 0 IRST} - {1900355400 16200 1 IRDT} - {1916249400 12600 0 IRST} - {1931891400 16200 1 IRDT} - {1947785400 12600 0 IRST} - {1963427400 16200 1 IRDT} - {1979321400 12600 0 IRST} - {1994963400 16200 1 IRDT} - {2010857400 12600 0 IRST} - {2026585800 16200 1 IRDT} - {2042479800 12600 0 IRST} - {2058121800 16200 1 IRDT} - {2074015800 12600 0 IRST} - {2089657800 16200 1 IRDT} - {2105551800 12600 0 IRST} - {2121193800 16200 1 IRDT} - {2137087800 12600 0 IRST} - {2152729800 16200 1 IRDT} - {2168623800 12600 0 IRST} - {2184265800 16200 1 IRDT} - {2200159800 12600 0 IRST} - {2215888200 16200 1 IRDT} - {2231782200 12600 0 IRST} - {2247424200 16200 1 IRDT} - {2263318200 12600 0 IRST} - {2278960200 16200 1 IRDT} - {2294854200 12600 0 IRST} - {2310496200 16200 1 IRDT} - {2326390200 12600 0 IRST} - {2342118600 16200 1 IRDT} - {2358012600 12600 0 IRST} - {2373654600 16200 1 IRDT} - {2389548600 12600 0 IRST} - {2405190600 16200 1 IRDT} - {2421084600 12600 0 IRST} - {2436726600 16200 1 IRDT} - {2452620600 12600 0 IRST} - {2468349000 16200 1 IRDT} - {2484243000 12600 0 IRST} - {2499885000 16200 1 IRDT} - {2515779000 12600 0 IRST} - {2531421000 16200 1 IRDT} - {2547315000 12600 0 IRST} - {2562957000 16200 1 IRDT} - {2578851000 12600 0 IRST} - {2594579400 16200 1 IRDT} - {2610473400 12600 0 IRST} - {2626115400 16200 1 IRDT} - {2642009400 12600 0 IRST} - {2657651400 16200 1 IRDT} - {2673545400 12600 0 IRST} - {2689187400 16200 1 IRDT} - {2705081400 12600 0 IRST} - {2720809800 16200 1 IRDT} - {2736703800 12600 0 IRST} - {2752345800 16200 1 IRDT} - {2768239800 12600 0 IRST} - {2783881800 16200 1 IRDT} - {2799775800 12600 0 IRST} - {2815417800 16200 1 IRDT} - {2831311800 12600 0 IRST} - {2847040200 16200 1 IRDT} - {2862934200 12600 0 IRST} - {2878576200 16200 1 IRDT} - {2894470200 12600 0 IRST} - {2910112200 16200 1 IRDT} - {2926006200 12600 0 IRST} - {2941648200 16200 1 IRDT} - {2957542200 12600 0 IRST} - {2973270600 16200 1 IRDT} - {2989164600 12600 0 IRST} - {3004806600 16200 1 IRDT} - {3020700600 12600 0 IRST} - {3036342600 16200 1 IRDT} - {3052236600 12600 0 IRST} - {3067878600 16200 1 IRDT} - {3083772600 12600 0 IRST} - {3099501000 16200 1 IRDT} - {3115395000 12600 0 IRST} - {3131037000 16200 1 IRDT} - {3146931000 12600 0 IRST} - {3162573000 16200 1 IRDT} - {3178467000 12600 0 IRST} - {3194109000 16200 1 IRDT} - {3210003000 12600 0 IRST} - {3225731400 16200 1 IRDT} - {3241625400 12600 0 IRST} - {3257267400 16200 1 IRDT} - {3273161400 12600 0 IRST} - {3288803400 16200 1 IRDT} - {3304697400 12600 0 IRST} - {3320339400 16200 1 IRDT} - {3336233400 12600 0 IRST} - {3351961800 16200 1 IRDT} - {3367855800 12600 0 IRST} - {3383497800 16200 1 IRDT} - {3399391800 12600 0 IRST} - {3415033800 16200 1 IRDT} - {3430927800 12600 0 IRST} - {3446569800 16200 1 IRDT} - {3462463800 12600 0 IRST} - {3478192200 16200 1 IRDT} - {3494086200 12600 0 IRST} - {3509728200 16200 1 IRDT} - {3525622200 12600 0 IRST} - {3541264200 16200 1 IRDT} - {3557158200 12600 0 IRST} - {3572800200 16200 1 IRDT} - {3588694200 12600 0 IRST} - {3604422600 16200 1 IRDT} - {3620316600 12600 0 IRST} - {3635958600 16200 1 IRDT} - {3651852600 12600 0 IRST} - {3667494600 16200 1 IRDT} - {3683388600 12600 0 IRST} - {3699030600 16200 1 IRDT} - {3714924600 12600 0 IRST} - {3730653000 16200 1 IRDT} - {3746547000 12600 0 IRST} - {3762189000 16200 1 IRDT} - {3778083000 12600 0 IRST} - {3793725000 16200 1 IRDT} - {3809619000 12600 0 IRST} - {3825261000 16200 1 IRDT} - {3841155000 12600 0 IRST} - {3856883400 16200 1 IRDT} - {3872777400 12600 0 IRST} - {3888419400 16200 1 IRDT} - {3904313400 12600 0 IRST} - {3919955400 16200 1 IRDT} - {3935849400 12600 0 IRST} - {3951491400 16200 1 IRDT} - {3967385400 12600 0 IRST} - {3983113800 16200 1 IRDT} - {3999007800 12600 0 IRST} - {4014649800 16200 1 IRDT} - {4030543800 12600 0 IRST} - {4046185800 16200 1 IRDT} - {4062079800 12600 0 IRST} - {4077721800 16200 1 IRDT} - {4093615800 12600 0 IRST} + {-757394744 12600 0 +0330} + {247177800 14400 0 +05} + {259272000 18000 1 +05} + {277758000 14400 0 +05} + {283982400 12600 0 +0430} + {290809800 16200 1 +0430} + {306531000 12600 0 +0430} + {322432200 16200 1 +0430} + {338499000 12600 0 +0430} + {673216200 16200 1 +0430} + {685481400 12600 0 +0430} + {701209800 16200 1 +0430} + {717103800 12600 0 +0430} + {732745800 16200 1 +0430} + {748639800 12600 0 +0430} + {764281800 16200 1 +0430} + {780175800 12600 0 +0430} + {795817800 16200 1 +0430} + {811711800 12600 0 +0430} + {827353800 16200 1 +0430} + {843247800 12600 0 +0430} + {858976200 16200 1 +0430} + {874870200 12600 0 +0430} + {890512200 16200 1 +0430} + {906406200 12600 0 +0430} + {922048200 16200 1 +0430} + {937942200 12600 0 +0430} + {953584200 16200 1 +0430} + {969478200 12600 0 +0430} + {985206600 16200 1 +0430} + {1001100600 12600 0 +0430} + {1016742600 16200 1 +0430} + {1032636600 12600 0 +0430} + {1048278600 16200 1 +0430} + {1064172600 12600 0 +0430} + {1079814600 16200 1 +0430} + {1095708600 12600 0 +0430} + {1111437000 16200 1 +0430} + {1127331000 12600 0 +0430} + {1206045000 16200 1 +0430} + {1221939000 12600 0 +0430} + {1237667400 16200 1 +0430} + {1253561400 12600 0 +0430} + {1269203400 16200 1 +0430} + {1285097400 12600 0 +0430} + {1300739400 16200 1 +0430} + {1316633400 12600 0 +0430} + {1332275400 16200 1 +0430} + {1348169400 12600 0 +0430} + {1363897800 16200 1 +0430} + {1379791800 12600 0 +0430} + {1395433800 16200 1 +0430} + {1411327800 12600 0 +0430} + {1426969800 16200 1 +0430} + {1442863800 12600 0 +0430} + {1458505800 16200 1 +0430} + {1474399800 12600 0 +0430} + {1490128200 16200 1 +0430} + {1506022200 12600 0 +0430} + {1521664200 16200 1 +0430} + {1537558200 12600 0 +0430} + {1553200200 16200 1 +0430} + {1569094200 12600 0 +0430} + {1584736200 16200 1 +0430} + {1600630200 12600 0 +0430} + {1616358600 16200 1 +0430} + {1632252600 12600 0 +0430} + {1647894600 16200 1 +0430} + {1663788600 12600 0 +0430} + {1679430600 16200 1 +0430} + {1695324600 12600 0 +0430} + {1710966600 16200 1 +0430} + {1726860600 12600 0 +0430} + {1742589000 16200 1 +0430} + {1758483000 12600 0 +0430} + {1774125000 16200 1 +0430} + {1790019000 12600 0 +0430} + {1805661000 16200 1 +0430} + {1821555000 12600 0 +0430} + {1837197000 16200 1 +0430} + {1853091000 12600 0 +0430} + {1868733000 16200 1 +0430} + {1884627000 12600 0 +0430} + {1900355400 16200 1 +0430} + {1916249400 12600 0 +0430} + {1931891400 16200 1 +0430} + {1947785400 12600 0 +0430} + {1963427400 16200 1 +0430} + {1979321400 12600 0 +0430} + {1994963400 16200 1 +0430} + {2010857400 12600 0 +0430} + {2026585800 16200 1 +0430} + {2042479800 12600 0 +0430} + {2058121800 16200 1 +0430} + {2074015800 12600 0 +0430} + {2089657800 16200 1 +0430} + {2105551800 12600 0 +0430} + {2121193800 16200 1 +0430} + {2137087800 12600 0 +0430} + {2152729800 16200 1 +0430} + {2168623800 12600 0 +0430} + {2184265800 16200 1 +0430} + {2200159800 12600 0 +0430} + {2215888200 16200 1 +0430} + {2231782200 12600 0 +0430} + {2247424200 16200 1 +0430} + {2263318200 12600 0 +0430} + {2278960200 16200 1 +0430} + {2294854200 12600 0 +0430} + {2310496200 16200 1 +0430} + {2326390200 12600 0 +0430} + {2342118600 16200 1 +0430} + {2358012600 12600 0 +0430} + {2373654600 16200 1 +0430} + {2389548600 12600 0 +0430} + {2405190600 16200 1 +0430} + {2421084600 12600 0 +0430} + {2436726600 16200 1 +0430} + {2452620600 12600 0 +0430} + {2468349000 16200 1 +0430} + {2484243000 12600 0 +0430} + {2499885000 16200 1 +0430} + {2515779000 12600 0 +0430} + {2531421000 16200 1 +0430} + {2547315000 12600 0 +0430} + {2562957000 16200 1 +0430} + {2578851000 12600 0 +0430} + {2594579400 16200 1 +0430} + {2610473400 12600 0 +0430} + {2626115400 16200 1 +0430} + {2642009400 12600 0 +0430} + {2657651400 16200 1 +0430} + {2673545400 12600 0 +0430} + {2689187400 16200 1 +0430} + {2705081400 12600 0 +0430} + {2720809800 16200 1 +0430} + {2736703800 12600 0 +0430} + {2752345800 16200 1 +0430} + {2768239800 12600 0 +0430} + {2783881800 16200 1 +0430} + {2799775800 12600 0 +0430} + {2815417800 16200 1 +0430} + {2831311800 12600 0 +0430} + {2847040200 16200 1 +0430} + {2862934200 12600 0 +0430} + {2878576200 16200 1 +0430} + {2894470200 12600 0 +0430} + {2910112200 16200 1 +0430} + {2926006200 12600 0 +0430} + {2941648200 16200 1 +0430} + {2957542200 12600 0 +0430} + {2973270600 16200 1 +0430} + {2989164600 12600 0 +0430} + {3004806600 16200 1 +0430} + {3020700600 12600 0 +0430} + {3036342600 16200 1 +0430} + {3052236600 12600 0 +0430} + {3067878600 16200 1 +0430} + {3083772600 12600 0 +0430} + {3099501000 16200 1 +0430} + {3115395000 12600 0 +0430} + {3131037000 16200 1 +0430} + {3146931000 12600 0 +0430} + {3162573000 16200 1 +0430} + {3178467000 12600 0 +0430} + {3194109000 16200 1 +0430} + {3210003000 12600 0 +0430} + {3225731400 16200 1 +0430} + {3241625400 12600 0 +0430} + {3257267400 16200 1 +0430} + {3273161400 12600 0 +0430} + {3288803400 16200 1 +0430} + {3304697400 12600 0 +0430} + {3320339400 16200 1 +0430} + {3336233400 12600 0 +0430} + {3351961800 16200 1 +0430} + {3367855800 12600 0 +0430} + {3383497800 16200 1 +0430} + {3399391800 12600 0 +0430} + {3415033800 16200 1 +0430} + {3430927800 12600 0 +0430} + {3446569800 16200 1 +0430} + {3462463800 12600 0 +0430} + {3478192200 16200 1 +0430} + {3494086200 12600 0 +0430} + {3509728200 16200 1 +0430} + {3525622200 12600 0 +0430} + {3541264200 16200 1 +0430} + {3557158200 12600 0 +0430} + {3572800200 16200 1 +0430} + {3588694200 12600 0 +0430} + {3604422600 16200 1 +0430} + {3620316600 12600 0 +0430} + {3635958600 16200 1 +0430} + {3651852600 12600 0 +0430} + {3667494600 16200 1 +0430} + {3683388600 12600 0 +0430} + {3699030600 16200 1 +0430} + {3714924600 12600 0 +0430} + {3730653000 16200 1 +0430} + {3746547000 12600 0 +0430} + {3762189000 16200 1 +0430} + {3778083000 12600 0 +0430} + {3793725000 16200 1 +0430} + {3809619000 12600 0 +0430} + {3825261000 16200 1 +0430} + {3841155000 12600 0 +0430} + {3856883400 16200 1 +0430} + {3872777400 12600 0 +0430} + {3888419400 16200 1 +0430} + {3904313400 12600 0 +0430} + {3919955400 16200 1 +0430} + {3935849400 12600 0 +0430} + {3951491400 16200 1 +0430} + {3967385400 12600 0 +0430} + {3983113800 16200 1 +0430} + {3999007800 12600 0 +0430} + {4014649800 16200 1 +0430} + {4030543800 12600 0 +0430} + {4046185800 16200 1 +0430} + {4062079800 12600 0 +0430} + {4077721800 16200 1 +0430} + {4093615800 12600 0 +0430} } diff --git a/library/tzdata/Asia/Thimphu b/library/tzdata/Asia/Thimphu index 8c981de..55c3d7f 100644 --- a/library/tzdata/Asia/Thimphu +++ b/library/tzdata/Asia/Thimphu @@ -2,6 +2,6 @@ set TZData(:Asia/Thimphu) { {-9223372036854775808 21516 0 LMT} - {-706341516 19800 0 IST} - {560025000 21600 0 BTT} + {-706341516 19800 0 +0530} + {560025000 21600 0 +06} } diff --git a/library/tzdata/Asia/Tokyo b/library/tzdata/Asia/Tokyo index 5bfc75c..10add1c 100644 --- a/library/tzdata/Asia/Tokyo +++ b/library/tzdata/Asia/Tokyo @@ -3,8 +3,6 @@ set TZData(:Asia/Tokyo) { {-9223372036854775808 33539 0 LMT} {-2587712400 32400 0 JST} - {-2335251600 32400 0 JCST} - {-1017824400 32400 0 JST} {-683794800 36000 1 JDT} {-672393600 32400 0 JST} {-654764400 36000 1 JDT} diff --git a/library/tzdata/Asia/Ulaanbaatar b/library/tzdata/Asia/Ulaanbaatar index 93e066c..e0ba7ab 100644 --- a/library/tzdata/Asia/Ulaanbaatar +++ b/library/tzdata/Asia/Ulaanbaatar @@ -2,220 +2,54 @@ set TZData(:Asia/Ulaanbaatar) { {-9223372036854775808 25652 0 LMT} - {-2032931252 25200 0 ULAT} - {252435600 28800 0 ULAT} - {417974400 32400 1 ULAST} - {433782000 28800 0 ULAT} - {449596800 32400 1 ULAST} - {465318000 28800 0 ULAT} - {481046400 32400 1 ULAST} - {496767600 28800 0 ULAT} - {512496000 32400 1 ULAST} - {528217200 28800 0 ULAT} - {543945600 32400 1 ULAST} - {559666800 28800 0 ULAT} - {575395200 32400 1 ULAST} - {591116400 28800 0 ULAT} - {606844800 32400 1 ULAST} - {622566000 28800 0 ULAT} - {638294400 32400 1 ULAST} - {654620400 28800 0 ULAT} - {670348800 32400 1 ULAST} - {686070000 28800 0 ULAT} - {701798400 32400 1 ULAST} - {717519600 28800 0 ULAT} - {733248000 32400 1 ULAST} - {748969200 28800 0 ULAT} - {764697600 32400 1 ULAST} - {780418800 28800 0 ULAT} - {796147200 32400 1 ULAST} - {811868400 28800 0 ULAT} - {828201600 32400 1 ULAST} - {843922800 28800 0 ULAT} - {859651200 32400 1 ULAST} - {875372400 28800 0 ULAT} - {891100800 32400 1 ULAST} - {906822000 28800 0 ULAT} - {988394400 32400 1 ULAST} - {1001696400 28800 0 ULAT} - {1017424800 32400 1 ULAST} - {1033146000 28800 0 ULAT} - {1048874400 32400 1 ULAST} - {1064595600 28800 0 ULAT} - {1080324000 32400 1 ULAST} - {1096045200 28800 0 ULAT} - {1111773600 32400 1 ULAST} - {1127494800 28800 0 ULAT} - {1143223200 32400 1 ULAST} - {1159549200 28800 0 ULAT} - {1427479200 32400 1 ULAST} - {1443193200 28800 0 ULAT} - {1458928800 32400 1 ULAST} - {1474642800 28800 0 ULAT} - {1490378400 32400 1 ULAST} - {1506697200 28800 0 ULAT} - {1522432800 32400 1 ULAST} - {1538146800 28800 0 ULAT} - {1553882400 32400 1 ULAST} - {1569596400 28800 0 ULAT} - {1585332000 32400 1 ULAST} - {1601046000 28800 0 ULAT} - {1616781600 32400 1 ULAST} - {1632495600 28800 0 ULAT} - {1648231200 32400 1 ULAST} - {1663945200 28800 0 ULAT} - {1679680800 32400 1 ULAST} - {1695999600 28800 0 ULAT} - {1711735200 32400 1 ULAST} - {1727449200 28800 0 ULAT} - {1743184800 32400 1 ULAST} - {1758898800 28800 0 ULAT} - {1774634400 32400 1 ULAST} - {1790348400 28800 0 ULAT} - {1806084000 32400 1 ULAST} - {1821798000 28800 0 ULAT} - {1837533600 32400 1 ULAST} - {1853852400 28800 0 ULAT} - {1869588000 32400 1 ULAST} - {1885302000 28800 0 ULAT} - {1901037600 32400 1 ULAST} - {1916751600 28800 0 ULAT} - {1932487200 32400 1 ULAST} - {1948201200 28800 0 ULAT} - {1963936800 32400 1 ULAST} - {1979650800 28800 0 ULAT} - {1995386400 32400 1 ULAST} - {2011100400 28800 0 ULAT} - {2026836000 32400 1 ULAST} - {2043154800 28800 0 ULAT} - {2058890400 32400 1 ULAST} - {2074604400 28800 0 ULAT} - {2090340000 32400 1 ULAST} - {2106054000 28800 0 ULAT} - {2121789600 32400 1 ULAST} - {2137503600 28800 0 ULAT} - {2153239200 32400 1 ULAST} - {2168953200 28800 0 ULAT} - {2184688800 32400 1 ULAST} - {2200402800 28800 0 ULAT} - {2216743200 32400 1 ULAST} - {2232457200 28800 0 ULAT} - {2248192800 32400 1 ULAST} - {2263906800 28800 0 ULAT} - {2279642400 32400 1 ULAST} - {2295356400 28800 0 ULAT} - {2311092000 32400 1 ULAST} - {2326806000 28800 0 ULAT} - {2342541600 32400 1 ULAST} - {2358255600 28800 0 ULAT} - {2373991200 32400 1 ULAST} - {2390310000 28800 0 ULAT} - {2406045600 32400 1 ULAST} - {2421759600 28800 0 ULAT} - {2437495200 32400 1 ULAST} - {2453209200 28800 0 ULAT} - {2468944800 32400 1 ULAST} - {2484658800 28800 0 ULAT} - {2500394400 32400 1 ULAST} - {2516108400 28800 0 ULAT} - {2531844000 32400 1 ULAST} - {2547558000 28800 0 ULAT} - {2563293600 32400 1 ULAST} - {2579612400 28800 0 ULAT} - {2595348000 32400 1 ULAST} - {2611062000 28800 0 ULAT} - {2626797600 32400 1 ULAST} - {2642511600 28800 0 ULAT} - {2658247200 32400 1 ULAST} - {2673961200 28800 0 ULAT} - {2689696800 32400 1 ULAST} - {2705410800 28800 0 ULAT} - {2721146400 32400 1 ULAST} - {2737465200 28800 0 ULAT} - {2753200800 32400 1 ULAST} - {2768914800 28800 0 ULAT} - {2784650400 32400 1 ULAST} - {2800364400 28800 0 ULAT} - {2816100000 32400 1 ULAST} - {2831814000 28800 0 ULAT} - {2847549600 32400 1 ULAST} - {2863263600 28800 0 ULAT} - {2878999200 32400 1 ULAST} - {2894713200 28800 0 ULAT} - {2910448800 32400 1 ULAST} - {2926767600 28800 0 ULAT} - {2942503200 32400 1 ULAST} - {2958217200 28800 0 ULAT} - {2973952800 32400 1 ULAST} - {2989666800 28800 0 ULAT} - {3005402400 32400 1 ULAST} - {3021116400 28800 0 ULAT} - {3036852000 32400 1 ULAST} - {3052566000 28800 0 ULAT} - {3068301600 32400 1 ULAST} - {3084015600 28800 0 ULAT} - {3100356000 32400 1 ULAST} - {3116070000 28800 0 ULAT} - {3131805600 32400 1 ULAST} - {3147519600 28800 0 ULAT} - {3163255200 32400 1 ULAST} - {3178969200 28800 0 ULAT} - {3194704800 32400 1 ULAST} - {3210418800 28800 0 ULAT} - {3226154400 32400 1 ULAST} - {3241868400 28800 0 ULAT} - {3257604000 32400 1 ULAST} - {3273922800 28800 0 ULAT} - {3289658400 32400 1 ULAST} - {3305372400 28800 0 ULAT} - {3321108000 32400 1 ULAST} - {3336822000 28800 0 ULAT} - {3352557600 32400 1 ULAST} - {3368271600 28800 0 ULAT} - {3384007200 32400 1 ULAST} - {3399721200 28800 0 ULAT} - {3415456800 32400 1 ULAST} - {3431170800 28800 0 ULAT} - {3446906400 32400 1 ULAST} - {3463225200 28800 0 ULAT} - {3478960800 32400 1 ULAST} - {3494674800 28800 0 ULAT} - {3510410400 32400 1 ULAST} - {3526124400 28800 0 ULAT} - {3541860000 32400 1 ULAST} - {3557574000 28800 0 ULAT} - {3573309600 32400 1 ULAST} - {3589023600 28800 0 ULAT} - {3604759200 32400 1 ULAST} - {3621078000 28800 0 ULAT} - {3636813600 32400 1 ULAST} - {3652527600 28800 0 ULAT} - {3668263200 32400 1 ULAST} - {3683977200 28800 0 ULAT} - {3699712800 32400 1 ULAST} - {3715426800 28800 0 ULAT} - {3731162400 32400 1 ULAST} - {3746876400 28800 0 ULAT} - {3762612000 32400 1 ULAST} - {3778326000 28800 0 ULAT} - {3794061600 32400 1 ULAST} - {3810380400 28800 0 ULAT} - {3826116000 32400 1 ULAST} - {3841830000 28800 0 ULAT} - {3857565600 32400 1 ULAST} - {3873279600 28800 0 ULAT} - {3889015200 32400 1 ULAST} - {3904729200 28800 0 ULAT} - {3920464800 32400 1 ULAST} - {3936178800 28800 0 ULAT} - {3951914400 32400 1 ULAST} - {3967628400 28800 0 ULAT} - {3983968800 32400 1 ULAST} - {3999682800 28800 0 ULAT} - {4015418400 32400 1 ULAST} - {4031132400 28800 0 ULAT} - {4046868000 32400 1 ULAST} - {4062582000 28800 0 ULAT} - {4078317600 32400 1 ULAST} - {4094031600 28800 0 ULAT} + {-2032931252 25200 0 +07} + {252435600 28800 0 +08} + {417974400 32400 1 +09} + {433782000 28800 0 +08} + {449596800 32400 1 +09} + {465318000 28800 0 +08} + {481046400 32400 1 +09} + {496767600 28800 0 +08} + {512496000 32400 1 +09} + {528217200 28800 0 +08} + {543945600 32400 1 +09} + {559666800 28800 0 +08} + {575395200 32400 1 +09} + {591116400 28800 0 +08} + {606844800 32400 1 +09} + {622566000 28800 0 +08} + {638294400 32400 1 +09} + {654620400 28800 0 +08} + {670348800 32400 1 +09} + {686070000 28800 0 +08} + {701798400 32400 1 +09} + {717519600 28800 0 +08} + {733248000 32400 1 +09} + {748969200 28800 0 +08} + {764697600 32400 1 +09} + {780418800 28800 0 +08} + {796147200 32400 1 +09} + {811868400 28800 0 +08} + {828201600 32400 1 +09} + {843922800 28800 0 +08} + {859651200 32400 1 +09} + {875372400 28800 0 +08} + {891100800 32400 1 +09} + {906822000 28800 0 +08} + {988394400 32400 1 +09} + {1001696400 28800 0 +08} + {1017424800 32400 1 +09} + {1033146000 28800 0 +08} + {1048874400 32400 1 +09} + {1064595600 28800 0 +08} + {1080324000 32400 1 +09} + {1096045200 28800 0 +08} + {1111773600 32400 1 +09} + {1127494800 28800 0 +08} + {1143223200 32400 1 +09} + {1159549200 28800 0 +08} + {1427479200 32400 1 +09} + {1443193200 28800 0 +08} + {1458928800 32400 1 +09} + {1474642800 28800 0 +08} } diff --git a/library/tzdata/Asia/Urumqi b/library/tzdata/Asia/Urumqi index 4f3cd67..194e090 100644 --- a/library/tzdata/Asia/Urumqi +++ b/library/tzdata/Asia/Urumqi @@ -2,5 +2,5 @@ set TZData(:Asia/Urumqi) { {-9223372036854775808 21020 0 LMT} - {-1325483420 21600 0 XJT} + {-1325483420 21600 0 +06} } diff --git a/library/tzdata/Asia/Yangon b/library/tzdata/Asia/Yangon index 40cfa02..8e17d82 100644 --- a/library/tzdata/Asia/Yangon +++ b/library/tzdata/Asia/Yangon @@ -3,7 +3,7 @@ set TZData(:Asia/Yangon) { {-9223372036854775808 23080 0 LMT} {-2840163880 23080 0 RMT} - {-1577946280 23400 0 BURT} - {-873268200 32400 0 JST} - {-778410000 23400 0 MMT} + {-1577946280 23400 0 +0630} + {-873268200 32400 0 +09} + {-778410000 23400 0 +0630} } diff --git a/library/tzdata/Atlantic/Azores b/library/tzdata/Atlantic/Azores index fd47ba5..a9bec94 100644 --- a/library/tzdata/Atlantic/Azores +++ b/library/tzdata/Atlantic/Azores @@ -3,347 +3,343 @@ set TZData(:Atlantic/Azores) { {-9223372036854775808 -6160 0 LMT} {-2713904240 -6872 0 HMT} - {-1830377128 -7200 0 AZOT} - {-1689548400 -3600 1 AZOST} - {-1677794400 -7200 0 AZOT} - {-1667430000 -3600 1 AZOST} - {-1647730800 -7200 0 AZOT} - {-1635807600 -3600 1 AZOST} - {-1616194800 -7200 0 AZOT} - {-1604358000 -3600 1 AZOST} - {-1584658800 -7200 0 AZOT} - {-1572735600 -3600 1 AZOST} - {-1553036400 -7200 0 AZOT} - {-1541199600 -3600 1 AZOST} - {-1521500400 -7200 0 AZOT} - {-1442444400 -3600 1 AZOST} - {-1426806000 -7200 0 AZOT} - {-1379286000 -3600 1 AZOST} - {-1364770800 -7200 0 AZOT} - {-1348441200 -3600 1 AZOST} - {-1333321200 -7200 0 AZOT} - {-1316386800 -3600 1 AZOST} - {-1301266800 -7200 0 AZOT} - {-1284332400 -3600 1 AZOST} - {-1269817200 -7200 0 AZOT} - {-1221433200 -3600 1 AZOST} - {-1206918000 -7200 0 AZOT} - {-1191193200 -3600 1 AZOST} - {-1175468400 -7200 0 AZOT} - {-1127689200 -3600 1 AZOST} - {-1111964400 -7200 0 AZOT} - {-1096844400 -3600 1 AZOST} - {-1080514800 -7200 0 AZOT} - {-1063580400 -3600 1 AZOST} - {-1049065200 -7200 0 AZOT} - {-1033340400 -3600 1 AZOST} - {-1017615600 -7200 0 AZOT} - {-1002495600 -3600 1 AZOST} - {-986166000 -7200 0 AZOT} - {-969231600 -3600 1 AZOST} - {-950482800 -7200 0 AZOT} - {-942015600 -3600 1 AZOST} - {-922662000 -7200 0 AZOT} - {-906937200 -3600 1 AZOST} - {-891126000 -7200 0 AZOT} - {-877302000 -3600 1 AZOST} - {-873676800 0 1 AZOMT} - {-864000000 -3600 1 AZOST} - {-857948400 -7200 0 AZOT} - {-845852400 -3600 1 AZOST} - {-842832000 0 1 AZOMT} - {-831340800 -3600 1 AZOST} - {-825894000 -7200 0 AZOT} - {-814402800 -3600 1 AZOST} - {-810777600 0 1 AZOMT} - {-799891200 -3600 1 AZOST} - {-794444400 -7200 0 AZOT} - {-782953200 -3600 1 AZOST} - {-779328000 0 1 AZOMT} - {-768441600 -3600 1 AZOST} - {-762994800 -7200 0 AZOT} - {-749084400 -3600 1 AZOST} - {-733359600 -7200 0 AZOT} - {-717624000 -3600 1 AZOST} - {-701899200 -7200 0 AZOT} - {-686174400 -3600 1 AZOST} - {-670449600 -7200 0 AZOT} - {-654724800 -3600 1 AZOST} - {-639000000 -7200 0 AZOT} - {-591825600 -3600 1 AZOST} - {-575496000 -7200 0 AZOT} - {-559771200 -3600 1 AZOST} - {-544046400 -7200 0 AZOT} - {-528321600 -3600 1 AZOST} - {-512596800 -7200 0 AZOT} - {-496872000 -3600 1 AZOST} - {-481147200 -7200 0 AZOT} - {-465422400 -3600 1 AZOST} - {-449697600 -7200 0 AZOT} - {-433972800 -3600 1 AZOST} - {-417643200 -7200 0 AZOT} - {-401918400 -3600 1 AZOST} - {-386193600 -7200 0 AZOT} - {-370468800 -3600 1 AZOST} - {-354744000 -7200 0 AZOT} - {-339019200 -3600 1 AZOST} - {-323294400 -7200 0 AZOT} - {-307569600 -3600 1 AZOST} - {-291844800 -7200 0 AZOT} - {-276120000 -3600 1 AZOST} - {-260395200 -7200 0 AZOT} - {-244670400 -3600 1 AZOST} - {-228340800 -7200 0 AZOT} - {-212616000 -3600 1 AZOST} - {-196891200 -7200 0 AZOT} - {-181166400 -3600 1 AZOST} - {-165441600 -7200 0 AZOT} - {-149716800 -3600 1 AZOST} - {-133992000 -7200 0 AZOT} - {-118267200 -3600 0 AZOT} - {228272400 0 1 AZOST} - {243997200 -3600 0 AZOT} - {260326800 0 1 AZOST} - {276051600 -3600 0 AZOT} - {291776400 0 1 AZOST} - {307504800 -3600 0 AZOT} - {323226000 0 1 AZOST} - {338954400 -3600 0 AZOT} - {354679200 0 1 AZOST} - {370404000 -3600 0 AZOT} - {386128800 0 1 AZOST} - {401853600 -3600 0 AZOT} - {417582000 0 1 AZOST} - {433303200 -3600 0 AZOT} - {449028000 0 1 AZOST} - {465357600 -3600 0 AZOT} - {481082400 0 1 AZOST} - {496807200 -3600 0 AZOT} - {512532000 0 1 AZOST} - {528256800 -3600 0 AZOT} - {543981600 0 1 AZOST} - {559706400 -3600 0 AZOT} - {575431200 0 1 AZOST} - {591156000 -3600 0 AZOT} - {606880800 0 1 AZOST} - {622605600 -3600 0 AZOT} - {638330400 0 1 AZOST} - {654660000 -3600 0 AZOT} - {670384800 0 1 AZOST} - {686109600 -3600 0 AZOT} - {701834400 0 1 AZOST} - {733280400 0 0 AZOST} - {749005200 -3600 0 AZOT} - {764730000 0 1 AZOST} - {780454800 -3600 0 AZOT} - {796179600 0 1 AZOST} - {811904400 -3600 0 AZOT} - {828234000 0 1 AZOST} - {846378000 -3600 0 AZOT} - {859683600 0 1 AZOST} - {877827600 -3600 0 AZOT} - {891133200 0 1 AZOST} - {909277200 -3600 0 AZOT} - {922582800 0 1 AZOST} - {941331600 -3600 0 AZOT} - {954032400 0 1 AZOST} - {972781200 -3600 0 AZOT} - {985482000 0 1 AZOST} - {1004230800 -3600 0 AZOT} - {1017536400 0 1 AZOST} - {1035680400 -3600 0 AZOT} - {1048986000 0 1 AZOST} - {1067130000 -3600 0 AZOT} - {1080435600 0 1 AZOST} - {1099184400 -3600 0 AZOT} - {1111885200 0 1 AZOST} - {1130634000 -3600 0 AZOT} - {1143334800 0 1 AZOST} - {1162083600 -3600 0 AZOT} - {1174784400 0 1 AZOST} - {1193533200 -3600 0 AZOT} - {1206838800 0 1 AZOST} - {1224982800 -3600 0 AZOT} - {1238288400 0 1 AZOST} - {1256432400 -3600 0 AZOT} - {1269738000 0 1 AZOST} - {1288486800 -3600 0 AZOT} - {1301187600 0 1 AZOST} - {1319936400 -3600 0 AZOT} - {1332637200 0 1 AZOST} - {1351386000 -3600 0 AZOT} - {1364691600 0 1 AZOST} - {1382835600 -3600 0 AZOT} - {1396141200 0 1 AZOST} - {1414285200 -3600 0 AZOT} - {1427590800 0 1 AZOST} - {1445734800 -3600 0 AZOT} - {1459040400 0 1 AZOST} - {1477789200 -3600 0 AZOT} - {1490490000 0 1 AZOST} - {1509238800 -3600 0 AZOT} - {1521939600 0 1 AZOST} - {1540688400 -3600 0 AZOT} - {1553994000 0 1 AZOST} - {1572138000 -3600 0 AZOT} - {1585443600 0 1 AZOST} - {1603587600 -3600 0 AZOT} - {1616893200 0 1 AZOST} - {1635642000 -3600 0 AZOT} - {1648342800 0 1 AZOST} - {1667091600 -3600 0 AZOT} - {1679792400 0 1 AZOST} - {1698541200 -3600 0 AZOT} - {1711846800 0 1 AZOST} - {1729990800 -3600 0 AZOT} - {1743296400 0 1 AZOST} - {1761440400 -3600 0 AZOT} - {1774746000 0 1 AZOST} - {1792890000 -3600 0 AZOT} - {1806195600 0 1 AZOST} - {1824944400 -3600 0 AZOT} - {1837645200 0 1 AZOST} - {1856394000 -3600 0 AZOT} - {1869094800 0 1 AZOST} - {1887843600 -3600 0 AZOT} - {1901149200 0 1 AZOST} - {1919293200 -3600 0 AZOT} - {1932598800 0 1 AZOST} - {1950742800 -3600 0 AZOT} - {1964048400 0 1 AZOST} - {1982797200 -3600 0 AZOT} - {1995498000 0 1 AZOST} - {2014246800 -3600 0 AZOT} - {2026947600 0 1 AZOST} - {2045696400 -3600 0 AZOT} - {2058397200 0 1 AZOST} - {2077146000 -3600 0 AZOT} - {2090451600 0 1 AZOST} - {2108595600 -3600 0 AZOT} - {2121901200 0 1 AZOST} - {2140045200 -3600 0 AZOT} - {2153350800 0 1 AZOST} - {2172099600 -3600 0 AZOT} - {2184800400 0 1 AZOST} - {2203549200 -3600 0 AZOT} - {2216250000 0 1 AZOST} - {2234998800 -3600 0 AZOT} - {2248304400 0 1 AZOST} - {2266448400 -3600 0 AZOT} - {2279754000 0 1 AZOST} - {2297898000 -3600 0 AZOT} - {2311203600 0 1 AZOST} - {2329347600 -3600 0 AZOT} - {2342653200 0 1 AZOST} - {2361402000 -3600 0 AZOT} - {2374102800 0 1 AZOST} - {2392851600 -3600 0 AZOT} - {2405552400 0 1 AZOST} - {2424301200 -3600 0 AZOT} - {2437606800 0 1 AZOST} - {2455750800 -3600 0 AZOT} - {2469056400 0 1 AZOST} - {2487200400 -3600 0 AZOT} - {2500506000 0 1 AZOST} - {2519254800 -3600 0 AZOT} - {2531955600 0 1 AZOST} - {2550704400 -3600 0 AZOT} - {2563405200 0 1 AZOST} - {2582154000 -3600 0 AZOT} - {2595459600 0 1 AZOST} - {2613603600 -3600 0 AZOT} - {2626909200 0 1 AZOST} - {2645053200 -3600 0 AZOT} - {2658358800 0 1 AZOST} - {2676502800 -3600 0 AZOT} - {2689808400 0 1 AZOST} - {2708557200 -3600 0 AZOT} - {2721258000 0 1 AZOST} - {2740006800 -3600 0 AZOT} - {2752707600 0 1 AZOST} - {2771456400 -3600 0 AZOT} - {2784762000 0 1 AZOST} - {2802906000 -3600 0 AZOT} - {2816211600 0 1 AZOST} - {2834355600 -3600 0 AZOT} - {2847661200 0 1 AZOST} - {2866410000 -3600 0 AZOT} - {2879110800 0 1 AZOST} - {2897859600 -3600 0 AZOT} - {2910560400 0 1 AZOST} - {2929309200 -3600 0 AZOT} - {2942010000 0 1 AZOST} - {2960758800 -3600 0 AZOT} - {2974064400 0 1 AZOST} - {2992208400 -3600 0 AZOT} - {3005514000 0 1 AZOST} - {3023658000 -3600 0 AZOT} - {3036963600 0 1 AZOST} - {3055712400 -3600 0 AZOT} - {3068413200 0 1 AZOST} - {3087162000 -3600 0 AZOT} - {3099862800 0 1 AZOST} - {3118611600 -3600 0 AZOT} - {3131917200 0 1 AZOST} - {3150061200 -3600 0 AZOT} - {3163366800 0 1 AZOST} - {3181510800 -3600 0 AZOT} - {3194816400 0 1 AZOST} - {3212960400 -3600 0 AZOT} - {3226266000 0 1 AZOST} - {3245014800 -3600 0 AZOT} - {3257715600 0 1 AZOST} - {3276464400 -3600 0 AZOT} - {3289165200 0 1 AZOST} - {3307914000 -3600 0 AZOT} - {3321219600 0 1 AZOST} - {3339363600 -3600 0 AZOT} - {3352669200 0 1 AZOST} - {3370813200 -3600 0 AZOT} - {3384118800 0 1 AZOST} - {3402867600 -3600 0 AZOT} - {3415568400 0 1 AZOST} - {3434317200 -3600 0 AZOT} - {3447018000 0 1 AZOST} - {3465766800 -3600 0 AZOT} - {3479072400 0 1 AZOST} - {3497216400 -3600 0 AZOT} - {3510522000 0 1 AZOST} - {3528666000 -3600 0 AZOT} - {3541971600 0 1 AZOST} - {3560115600 -3600 0 AZOT} - {3573421200 0 1 AZOST} - {3592170000 -3600 0 AZOT} - {3604870800 0 1 AZOST} - {3623619600 -3600 0 AZOT} - {3636320400 0 1 AZOST} - {3655069200 -3600 0 AZOT} - {3668374800 0 1 AZOST} - {3686518800 -3600 0 AZOT} - {3699824400 0 1 AZOST} - {3717968400 -3600 0 AZOT} - {3731274000 0 1 AZOST} - {3750022800 -3600 0 AZOT} - {3762723600 0 1 AZOST} - {3781472400 -3600 0 AZOT} - {3794173200 0 1 AZOST} - {3812922000 -3600 0 AZOT} - {3825622800 0 1 AZOST} - {3844371600 -3600 0 AZOT} - {3857677200 0 1 AZOST} - {3875821200 -3600 0 AZOT} - {3889126800 0 1 AZOST} - {3907270800 -3600 0 AZOT} - {3920576400 0 1 AZOST} - {3939325200 -3600 0 AZOT} - {3952026000 0 1 AZOST} - {3970774800 -3600 0 AZOT} - {3983475600 0 1 AZOST} - {4002224400 -3600 0 AZOT} - {4015530000 0 1 AZOST} - {4033674000 -3600 0 AZOT} - {4046979600 0 1 AZOST} - {4065123600 -3600 0 AZOT} - {4078429200 0 1 AZOST} - {4096573200 -3600 0 AZOT} + {-1830377128 -7200 0 -02} + {-1689548400 -3600 1 -01} + {-1677794400 -7200 0 -02} + {-1667430000 -3600 1 -01} + {-1647730800 -7200 0 -02} + {-1635807600 -3600 1 -01} + {-1616194800 -7200 0 -02} + {-1604358000 -3600 1 -01} + {-1584658800 -7200 0 -02} + {-1572735600 -3600 1 -01} + {-1553036400 -7200 0 -02} + {-1541199600 -3600 1 -01} + {-1521500400 -7200 0 -02} + {-1442444400 -3600 1 -01} + {-1426806000 -7200 0 -02} + {-1379286000 -3600 1 -01} + {-1364770800 -7200 0 -02} + {-1348441200 -3600 1 -01} + {-1333321200 -7200 0 -02} + {-1316386800 -3600 1 -01} + {-1301266800 -7200 0 -02} + {-1284332400 -3600 1 -01} + {-1269817200 -7200 0 -02} + {-1221433200 -3600 1 -01} + {-1206918000 -7200 0 -02} + {-1191193200 -3600 1 -01} + {-1175468400 -7200 0 -02} + {-1127689200 -3600 1 -01} + {-1111964400 -7200 0 -02} + {-1096844400 -3600 1 -01} + {-1080514800 -7200 0 -02} + {-1063580400 -3600 1 -01} + {-1049065200 -7200 0 -02} + {-1033340400 -3600 1 -01} + {-1017615600 -7200 0 -02} + {-1002495600 -3600 1 -01} + {-986166000 -7200 0 -02} + {-969231600 -3600 1 -01} + {-950482800 -7200 0 -02} + {-942015600 -3600 1 -01} + {-922662000 -7200 0 -02} + {-906937200 -3600 1 -01} + {-891126000 -7200 0 -02} + {-877302000 -3600 1 -01} + {-864000000 -3600 0 -01} + {-857948400 -7200 0 -02} + {-845852400 -3600 1 -01} + {-831340800 -3600 0 -01} + {-825894000 -7200 0 -02} + {-814402800 -3600 1 -01} + {-799891200 -3600 0 -01} + {-794444400 -7200 0 -02} + {-782953200 -3600 1 -01} + {-768441600 -3600 0 -01} + {-762994800 -7200 0 -02} + {-749084400 -3600 1 -01} + {-733359600 -7200 0 -02} + {-717624000 -3600 1 -01} + {-701899200 -7200 0 -02} + {-686174400 -3600 1 -01} + {-670449600 -7200 0 -02} + {-654724800 -3600 1 -01} + {-639000000 -7200 0 -02} + {-591825600 -3600 1 -01} + {-575496000 -7200 0 -02} + {-559771200 -3600 1 -01} + {-544046400 -7200 0 -02} + {-528321600 -3600 1 -01} + {-512596800 -7200 0 -02} + {-496872000 -3600 1 -01} + {-481147200 -7200 0 -02} + {-465422400 -3600 1 -01} + {-449697600 -7200 0 -02} + {-433972800 -3600 1 -01} + {-417643200 -7200 0 -02} + {-401918400 -3600 1 -01} + {-386193600 -7200 0 -02} + {-370468800 -3600 1 -01} + {-354744000 -7200 0 -02} + {-339019200 -3600 1 -01} + {-323294400 -7200 0 -02} + {-307569600 -3600 1 -01} + {-291844800 -7200 0 -02} + {-276120000 -3600 1 -01} + {-260395200 -7200 0 -02} + {-244670400 -3600 1 -01} + {-228340800 -7200 0 -02} + {-212616000 -3600 1 -01} + {-196891200 -7200 0 -02} + {-181166400 -3600 1 -01} + {-165441600 -7200 0 -02} + {-149716800 -3600 1 -01} + {-133992000 -7200 0 -02} + {-118267200 -3600 0 -01} + {228272400 0 1 +00} + {243997200 -3600 0 -01} + {260326800 0 1 +00} + {276051600 -3600 0 -01} + {291776400 0 1 +00} + {307504800 -3600 0 -01} + {323226000 0 1 +00} + {338954400 -3600 0 -01} + {354679200 0 1 +00} + {370404000 -3600 0 -01} + {386128800 0 1 +00} + {401853600 -3600 0 -01} + {417582000 0 1 +00} + {433303200 -3600 0 -01} + {449028000 0 1 +00} + {465357600 -3600 0 -01} + {481082400 0 1 +00} + {496807200 -3600 0 -01} + {512532000 0 1 +00} + {528256800 -3600 0 -01} + {543981600 0 1 +00} + {559706400 -3600 0 -01} + {575431200 0 1 +00} + {591156000 -3600 0 -01} + {606880800 0 1 +00} + {622605600 -3600 0 -01} + {638330400 0 1 +00} + {654660000 -3600 0 -01} + {670384800 0 1 +00} + {686109600 -3600 0 -01} + {701834400 0 1 +00} + {733280400 0 0 +00} + {749005200 -3600 0 -01} + {764730000 0 1 +00} + {780454800 -3600 0 -01} + {796179600 0 1 +00} + {811904400 -3600 0 -01} + {828234000 0 1 +00} + {846378000 -3600 0 -01} + {859683600 0 1 +00} + {877827600 -3600 0 -01} + {891133200 0 1 +00} + {909277200 -3600 0 -01} + {922582800 0 1 +00} + {941331600 -3600 0 -01} + {954032400 0 1 +00} + {972781200 -3600 0 -01} + {985482000 0 1 +00} + {1004230800 -3600 0 -01} + {1017536400 0 1 +00} + {1035680400 -3600 0 -01} + {1048986000 0 1 +00} + {1067130000 -3600 0 -01} + {1080435600 0 1 +00} + {1099184400 -3600 0 -01} + {1111885200 0 1 +00} + {1130634000 -3600 0 -01} + {1143334800 0 1 +00} + {1162083600 -3600 0 -01} + {1174784400 0 1 +00} + {1193533200 -3600 0 -01} + {1206838800 0 1 +00} + {1224982800 -3600 0 -01} + {1238288400 0 1 +00} + {1256432400 -3600 0 -01} + {1269738000 0 1 +00} + {1288486800 -3600 0 -01} + {1301187600 0 1 +00} + {1319936400 -3600 0 -01} + {1332637200 0 1 +00} + {1351386000 -3600 0 -01} + {1364691600 0 1 +00} + {1382835600 -3600 0 -01} + {1396141200 0 1 +00} + {1414285200 -3600 0 -01} + {1427590800 0 1 +00} + {1445734800 -3600 0 -01} + {1459040400 0 1 +00} + {1477789200 -3600 0 -01} + {1490490000 0 1 +00} + {1509238800 -3600 0 -01} + {1521939600 0 1 +00} + {1540688400 -3600 0 -01} + {1553994000 0 1 +00} + {1572138000 -3600 0 -01} + {1585443600 0 1 +00} + {1603587600 -3600 0 -01} + {1616893200 0 1 +00} + {1635642000 -3600 0 -01} + {1648342800 0 1 +00} + {1667091600 -3600 0 -01} + {1679792400 0 1 +00} + {1698541200 -3600 0 -01} + {1711846800 0 1 +00} + {1729990800 -3600 0 -01} + {1743296400 0 1 +00} + {1761440400 -3600 0 -01} + {1774746000 0 1 +00} + {1792890000 -3600 0 -01} + {1806195600 0 1 +00} + {1824944400 -3600 0 -01} + {1837645200 0 1 +00} + {1856394000 -3600 0 -01} + {1869094800 0 1 +00} + {1887843600 -3600 0 -01} + {1901149200 0 1 +00} + {1919293200 -3600 0 -01} + {1932598800 0 1 +00} + {1950742800 -3600 0 -01} + {1964048400 0 1 +00} + {1982797200 -3600 0 -01} + {1995498000 0 1 +00} + {2014246800 -3600 0 -01} + {2026947600 0 1 +00} + {2045696400 -3600 0 -01} + {2058397200 0 1 +00} + {2077146000 -3600 0 -01} + {2090451600 0 1 +00} + {2108595600 -3600 0 -01} + {2121901200 0 1 +00} + {2140045200 -3600 0 -01} + {2153350800 0 1 +00} + {2172099600 -3600 0 -01} + {2184800400 0 1 +00} + {2203549200 -3600 0 -01} + {2216250000 0 1 +00} + {2234998800 -3600 0 -01} + {2248304400 0 1 +00} + {2266448400 -3600 0 -01} + {2279754000 0 1 +00} + {2297898000 -3600 0 -01} + {2311203600 0 1 +00} + {2329347600 -3600 0 -01} + {2342653200 0 1 +00} + {2361402000 -3600 0 -01} + {2374102800 0 1 +00} + {2392851600 -3600 0 -01} + {2405552400 0 1 +00} + {2424301200 -3600 0 -01} + {2437606800 0 1 +00} + {2455750800 -3600 0 -01} + {2469056400 0 1 +00} + {2487200400 -3600 0 -01} + {2500506000 0 1 +00} + {2519254800 -3600 0 -01} + {2531955600 0 1 +00} + {2550704400 -3600 0 -01} + {2563405200 0 1 +00} + {2582154000 -3600 0 -01} + {2595459600 0 1 +00} + {2613603600 -3600 0 -01} + {2626909200 0 1 +00} + {2645053200 -3600 0 -01} + {2658358800 0 1 +00} + {2676502800 -3600 0 -01} + {2689808400 0 1 +00} + {2708557200 -3600 0 -01} + {2721258000 0 1 +00} + {2740006800 -3600 0 -01} + {2752707600 0 1 +00} + {2771456400 -3600 0 -01} + {2784762000 0 1 +00} + {2802906000 -3600 0 -01} + {2816211600 0 1 +00} + {2834355600 -3600 0 -01} + {2847661200 0 1 +00} + {2866410000 -3600 0 -01} + {2879110800 0 1 +00} + {2897859600 -3600 0 -01} + {2910560400 0 1 +00} + {2929309200 -3600 0 -01} + {2942010000 0 1 +00} + {2960758800 -3600 0 -01} + {2974064400 0 1 +00} + {2992208400 -3600 0 -01} + {3005514000 0 1 +00} + {3023658000 -3600 0 -01} + {3036963600 0 1 +00} + {3055712400 -3600 0 -01} + {3068413200 0 1 +00} + {3087162000 -3600 0 -01} + {3099862800 0 1 +00} + {3118611600 -3600 0 -01} + {3131917200 0 1 +00} + {3150061200 -3600 0 -01} + {3163366800 0 1 +00} + {3181510800 -3600 0 -01} + {3194816400 0 1 +00} + {3212960400 -3600 0 -01} + {3226266000 0 1 +00} + {3245014800 -3600 0 -01} + {3257715600 0 1 +00} + {3276464400 -3600 0 -01} + {3289165200 0 1 +00} + {3307914000 -3600 0 -01} + {3321219600 0 1 +00} + {3339363600 -3600 0 -01} + {3352669200 0 1 +00} + {3370813200 -3600 0 -01} + {3384118800 0 1 +00} + {3402867600 -3600 0 -01} + {3415568400 0 1 +00} + {3434317200 -3600 0 -01} + {3447018000 0 1 +00} + {3465766800 -3600 0 -01} + {3479072400 0 1 +00} + {3497216400 -3600 0 -01} + {3510522000 0 1 +00} + {3528666000 -3600 0 -01} + {3541971600 0 1 +00} + {3560115600 -3600 0 -01} + {3573421200 0 1 +00} + {3592170000 -3600 0 -01} + {3604870800 0 1 +00} + {3623619600 -3600 0 -01} + {3636320400 0 1 +00} + {3655069200 -3600 0 -01} + {3668374800 0 1 +00} + {3686518800 -3600 0 -01} + {3699824400 0 1 +00} + {3717968400 -3600 0 -01} + {3731274000 0 1 +00} + {3750022800 -3600 0 -01} + {3762723600 0 1 +00} + {3781472400 -3600 0 -01} + {3794173200 0 1 +00} + {3812922000 -3600 0 -01} + {3825622800 0 1 +00} + {3844371600 -3600 0 -01} + {3857677200 0 1 +00} + {3875821200 -3600 0 -01} + {3889126800 0 1 +00} + {3907270800 -3600 0 -01} + {3920576400 0 1 +00} + {3939325200 -3600 0 -01} + {3952026000 0 1 +00} + {3970774800 -3600 0 -01} + {3983475600 0 1 +00} + {4002224400 -3600 0 -01} + {4015530000 0 1 +00} + {4033674000 -3600 0 -01} + {4046979600 0 1 +00} + {4065123600 -3600 0 -01} + {4078429200 0 1 +00} + {4096573200 -3600 0 -01} } diff --git a/library/tzdata/Atlantic/Canary b/library/tzdata/Atlantic/Canary index dcfba83..b5c2997 100644 --- a/library/tzdata/Atlantic/Canary +++ b/library/tzdata/Atlantic/Canary @@ -2,7 +2,7 @@ set TZData(:Atlantic/Canary) { {-9223372036854775808 -3696 0 LMT} - {-1509663504 -3600 0 CANT} + {-1509663504 -3600 0 -01} {-733874400 0 0 WET} {323827200 3600 1 WEST} {338950800 0 0 WET} diff --git a/library/tzdata/Atlantic/Cape_Verde b/library/tzdata/Atlantic/Cape_Verde index f0bb79f..6fc94eb 100644 --- a/library/tzdata/Atlantic/Cape_Verde +++ b/library/tzdata/Atlantic/Cape_Verde @@ -2,8 +2,8 @@ set TZData(:Atlantic/Cape_Verde) { {-9223372036854775808 -5644 0 LMT} - {-1988144756 -7200 0 CVT} - {-862610400 -3600 1 CVST} - {-764118000 -7200 0 CVT} - {186120000 -3600 0 CVT} + {-1988144756 -7200 0 -02} + {-862610400 -3600 1 -01} + {-764118000 -7200 0 -02} + {186120000 -3600 0 -01} } diff --git a/library/tzdata/Atlantic/Madeira b/library/tzdata/Atlantic/Madeira index fac7f92..cc5e5f8 100644 --- a/library/tzdata/Atlantic/Madeira +++ b/library/tzdata/Atlantic/Madeira @@ -3,103 +3,99 @@ set TZData(:Atlantic/Madeira) { {-9223372036854775808 -4056 0 LMT} {-2713906344 -4056 0 FMT} - {-1830379944 -3600 0 MADT} - {-1689552000 0 1 MADST} - {-1677798000 -3600 0 MADT} - {-1667433600 0 1 MADST} - {-1647734400 -3600 0 MADT} - {-1635811200 0 1 MADST} - {-1616198400 -3600 0 MADT} - {-1604361600 0 1 MADST} - {-1584662400 -3600 0 MADT} - {-1572739200 0 1 MADST} - {-1553040000 -3600 0 MADT} - {-1541203200 0 1 MADST} - {-1521504000 -3600 0 MADT} - {-1442448000 0 1 MADST} - {-1426809600 -3600 0 MADT} - {-1379289600 0 1 MADST} - {-1364774400 -3600 0 MADT} - {-1348444800 0 1 MADST} - {-1333324800 -3600 0 MADT} - {-1316390400 0 1 MADST} - {-1301270400 -3600 0 MADT} - {-1284336000 0 1 MADST} - {-1269820800 -3600 0 MADT} - {-1221436800 0 1 MADST} - {-1206921600 -3600 0 MADT} - {-1191196800 0 1 MADST} - {-1175472000 -3600 0 MADT} - {-1127692800 0 1 MADST} - {-1111968000 -3600 0 MADT} - {-1096848000 0 1 MADST} - {-1080518400 -3600 0 MADT} - {-1063584000 0 1 MADST} - {-1049068800 -3600 0 MADT} - {-1033344000 0 1 MADST} - {-1017619200 -3600 0 MADT} - {-1002499200 0 1 MADST} - {-986169600 -3600 0 MADT} - {-969235200 0 1 MADST} - {-950486400 -3600 0 MADT} - {-942019200 0 1 MADST} - {-922665600 -3600 0 MADT} - {-906940800 0 1 MADST} - {-891129600 -3600 0 MADT} - {-877305600 0 1 MADST} - {-873680400 3600 1 MADMT} - {-864003600 0 1 MADST} - {-857952000 -3600 0 MADT} - {-845856000 0 1 MADST} - {-842835600 3600 1 MADMT} - {-831344400 0 1 MADST} - {-825897600 -3600 0 MADT} - {-814406400 0 1 MADST} - {-810781200 3600 1 MADMT} - {-799894800 0 1 MADST} - {-794448000 -3600 0 MADT} - {-782956800 0 1 MADST} - {-779331600 3600 1 MADMT} - {-768445200 0 1 MADST} - {-762998400 -3600 0 MADT} - {-749088000 0 1 MADST} - {-733363200 -3600 0 MADT} - {-717627600 0 1 MADST} - {-701902800 -3600 0 MADT} - {-686178000 0 1 MADST} - {-670453200 -3600 0 MADT} - {-654728400 0 1 MADST} - {-639003600 -3600 0 MADT} - {-591829200 0 1 MADST} - {-575499600 -3600 0 MADT} - {-559774800 0 1 MADST} - {-544050000 -3600 0 MADT} - {-528325200 0 1 MADST} - {-512600400 -3600 0 MADT} - {-496875600 0 1 MADST} - {-481150800 -3600 0 MADT} - {-465426000 0 1 MADST} - {-449701200 -3600 0 MADT} - {-433976400 0 1 MADST} - {-417646800 -3600 0 MADT} - {-401922000 0 1 MADST} - {-386197200 -3600 0 MADT} - {-370472400 0 1 MADST} - {-354747600 -3600 0 MADT} - {-339022800 0 1 MADST} - {-323298000 -3600 0 MADT} - {-307573200 0 1 MADST} - {-291848400 -3600 0 MADT} - {-276123600 0 1 MADST} - {-260398800 -3600 0 MADT} - {-244674000 0 1 MADST} - {-228344400 -3600 0 MADT} - {-212619600 0 1 MADST} - {-196894800 -3600 0 MADT} - {-181170000 0 1 MADST} - {-165445200 -3600 0 MADT} - {-149720400 0 1 MADST} - {-133995600 -3600 0 MADT} + {-1830379944 -3600 0 -01} + {-1689552000 0 1 +00} + {-1677798000 -3600 0 -01} + {-1667433600 0 1 +00} + {-1647734400 -3600 0 -01} + {-1635811200 0 1 +00} + {-1616198400 -3600 0 -01} + {-1604361600 0 1 +00} + {-1584662400 -3600 0 -01} + {-1572739200 0 1 +00} + {-1553040000 -3600 0 -01} + {-1541203200 0 1 +00} + {-1521504000 -3600 0 -01} + {-1442448000 0 1 +00} + {-1426809600 -3600 0 -01} + {-1379289600 0 1 +00} + {-1364774400 -3600 0 -01} + {-1348444800 0 1 +00} + {-1333324800 -3600 0 -01} + {-1316390400 0 1 +00} + {-1301270400 -3600 0 -01} + {-1284336000 0 1 +00} + {-1269820800 -3600 0 -01} + {-1221436800 0 1 +00} + {-1206921600 -3600 0 -01} + {-1191196800 0 1 +00} + {-1175472000 -3600 0 -01} + {-1127692800 0 1 +00} + {-1111968000 -3600 0 -01} + {-1096848000 0 1 +00} + {-1080518400 -3600 0 -01} + {-1063584000 0 1 +00} + {-1049068800 -3600 0 -01} + {-1033344000 0 1 +00} + {-1017619200 -3600 0 -01} + {-1002499200 0 1 +00} + {-986169600 -3600 0 -01} + {-969235200 0 1 +00} + {-950486400 -3600 0 -01} + {-942019200 0 1 +00} + {-922665600 -3600 0 -01} + {-906940800 0 1 +00} + {-891129600 -3600 0 -01} + {-877305600 0 1 +00} + {-864003600 0 0 +00} + {-857952000 -3600 0 -01} + {-845856000 0 1 +00} + {-831344400 0 0 +00} + {-825897600 -3600 0 -01} + {-814406400 0 1 +00} + {-799894800 0 0 +00} + {-794448000 -3600 0 -01} + {-782956800 0 1 +00} + {-768445200 0 0 +00} + {-762998400 -3600 0 -01} + {-749088000 0 1 +00} + {-733363200 -3600 0 -01} + {-717627600 0 1 +00} + {-701902800 -3600 0 -01} + {-686178000 0 1 +00} + {-670453200 -3600 0 -01} + {-654728400 0 1 +00} + {-639003600 -3600 0 -01} + {-591829200 0 1 +00} + {-575499600 -3600 0 -01} + {-559774800 0 1 +00} + {-544050000 -3600 0 -01} + {-528325200 0 1 +00} + {-512600400 -3600 0 -01} + {-496875600 0 1 +00} + {-481150800 -3600 0 -01} + {-465426000 0 1 +00} + {-449701200 -3600 0 -01} + {-433976400 0 1 +00} + {-417646800 -3600 0 -01} + {-401922000 0 1 +00} + {-386197200 -3600 0 -01} + {-370472400 0 1 +00} + {-354747600 -3600 0 -01} + {-339022800 0 1 +00} + {-323298000 -3600 0 -01} + {-307573200 0 1 +00} + {-291848400 -3600 0 -01} + {-276123600 0 1 +00} + {-260398800 -3600 0 -01} + {-244674000 0 1 +00} + {-228344400 -3600 0 -01} + {-212619600 0 1 +00} + {-196894800 -3600 0 -01} + {-181170000 0 1 +00} + {-165445200 -3600 0 -01} + {-149720400 0 1 +00} + {-133995600 -3600 0 -01} {-118270800 0 0 WET} {228268800 3600 1 WEST} {243993600 0 0 WET} diff --git a/library/tzdata/Atlantic/Reykjavik b/library/tzdata/Atlantic/Reykjavik index ad7f0db..5555460 100644 --- a/library/tzdata/Atlantic/Reykjavik +++ b/library/tzdata/Atlantic/Reykjavik @@ -2,72 +2,72 @@ set TZData(:Atlantic/Reykjavik) { {-9223372036854775808 -5280 0 LMT} - {-1956609120 -3600 0 IST} - {-1668211200 0 1 ISST} - {-1647212400 -3600 0 IST} - {-1636675200 0 1 ISST} - {-1613430000 -3600 0 IST} - {-1605139200 0 1 ISST} - {-1581894000 -3600 0 IST} - {-1539561600 0 1 ISST} - {-1531350000 -3600 0 IST} - {-968025600 0 1 ISST} - {-952293600 -3600 0 IST} - {-942008400 0 1 ISST} - {-920239200 -3600 0 IST} - {-909957600 0 1 ISST} - {-888789600 -3600 0 IST} - {-877903200 0 1 ISST} - {-857944800 -3600 0 IST} - {-846453600 0 1 ISST} - {-826495200 -3600 0 IST} - {-815004000 0 1 ISST} - {-795045600 -3600 0 IST} - {-783554400 0 1 ISST} - {-762991200 -3600 0 IST} - {-752104800 0 1 ISST} - {-731541600 -3600 0 IST} - {-717631200 0 1 ISST} - {-700092000 -3600 0 IST} - {-686181600 0 1 ISST} - {-668642400 -3600 0 IST} - {-654732000 0 1 ISST} - {-636588000 -3600 0 IST} - {-623282400 0 1 ISST} - {-605743200 -3600 0 IST} - {-591832800 0 1 ISST} - {-573688800 -3600 0 IST} - {-559778400 0 1 ISST} - {-542239200 -3600 0 IST} - {-528328800 0 1 ISST} - {-510789600 -3600 0 IST} - {-496879200 0 1 ISST} - {-479340000 -3600 0 IST} - {-465429600 0 1 ISST} - {-447890400 -3600 0 IST} - {-433980000 0 1 ISST} - {-415836000 -3600 0 IST} - {-401925600 0 1 ISST} - {-384386400 -3600 0 IST} - {-370476000 0 1 ISST} - {-352936800 -3600 0 IST} - {-339026400 0 1 ISST} - {-321487200 -3600 0 IST} - {-307576800 0 1 ISST} - {-290037600 -3600 0 IST} - {-276127200 0 1 ISST} - {-258588000 -3600 0 IST} - {-244677600 0 1 ISST} - {-226533600 -3600 0 IST} - {-212623200 0 1 ISST} - {-195084000 -3600 0 IST} - {-181173600 0 1 ISST} - {-163634400 -3600 0 IST} - {-149724000 0 1 ISST} - {-132184800 -3600 0 IST} - {-118274400 0 1 ISST} - {-100735200 -3600 0 IST} - {-86824800 0 1 ISST} - {-68680800 -3600 0 IST} + {-1956609120 -3600 0 -01} + {-1668211200 0 1 +00} + {-1647212400 -3600 0 -01} + {-1636675200 0 1 +00} + {-1613430000 -3600 0 -01} + {-1605139200 0 1 +00} + {-1581894000 -3600 0 -01} + {-1539561600 0 1 +00} + {-1531350000 -3600 0 -01} + {-968025600 0 1 +00} + {-952293600 -3600 0 -01} + {-942008400 0 1 +00} + {-920239200 -3600 0 -01} + {-909957600 0 1 +00} + {-888789600 -3600 0 -01} + {-877903200 0 1 +00} + {-857944800 -3600 0 -01} + {-846453600 0 1 +00} + {-826495200 -3600 0 -01} + {-815004000 0 1 +00} + {-795045600 -3600 0 -01} + {-783554400 0 1 +00} + {-762991200 -3600 0 -01} + {-752104800 0 1 +00} + {-731541600 -3600 0 -01} + {-717631200 0 1 +00} + {-700092000 -3600 0 -01} + {-686181600 0 1 +00} + {-668642400 -3600 0 -01} + {-654732000 0 1 +00} + {-636588000 -3600 0 -01} + {-623282400 0 1 +00} + {-605743200 -3600 0 -01} + {-591832800 0 1 +00} + {-573688800 -3600 0 -01} + {-559778400 0 1 +00} + {-542239200 -3600 0 -01} + {-528328800 0 1 +00} + {-510789600 -3600 0 -01} + {-496879200 0 1 +00} + {-479340000 -3600 0 -01} + {-465429600 0 1 +00} + {-447890400 -3600 0 -01} + {-433980000 0 1 +00} + {-415836000 -3600 0 -01} + {-401925600 0 1 +00} + {-384386400 -3600 0 -01} + {-370476000 0 1 +00} + {-352936800 -3600 0 -01} + {-339026400 0 1 +00} + {-321487200 -3600 0 -01} + {-307576800 0 1 +00} + {-290037600 -3600 0 -01} + {-276127200 0 1 +00} + {-258588000 -3600 0 -01} + {-244677600 0 1 +00} + {-226533600 -3600 0 -01} + {-212623200 0 1 +00} + {-195084000 -3600 0 -01} + {-181173600 0 1 +00} + {-163634400 -3600 0 -01} + {-149724000 0 1 +00} + {-132184800 -3600 0 -01} + {-118274400 0 1 +00} + {-100735200 -3600 0 -01} + {-86824800 0 1 +00} + {-68680800 -3600 0 -01} {-54770400 0 0 GMT} } diff --git a/library/tzdata/Atlantic/South_Georgia b/library/tzdata/Atlantic/South_Georgia index cbfc826..eb7307c 100644 --- a/library/tzdata/Atlantic/South_Georgia +++ b/library/tzdata/Atlantic/South_Georgia @@ -2,5 +2,5 @@ set TZData(:Atlantic/South_Georgia) { {-9223372036854775808 -8768 0 LMT} - {-2524512832 -7200 0 GST} + {-2524512832 -7200 0 -02} } diff --git a/library/tzdata/Atlantic/Stanley b/library/tzdata/Atlantic/Stanley index c287238..5210832 100644 --- a/library/tzdata/Atlantic/Stanley +++ b/library/tzdata/Atlantic/Stanley @@ -3,73 +3,73 @@ set TZData(:Atlantic/Stanley) { {-9223372036854775808 -13884 0 LMT} {-2524507716 -13884 0 SMT} - {-1824235716 -14400 0 FKT} - {-1018209600 -10800 1 FKST} - {-1003093200 -14400 0 FKT} - {-986760000 -10800 1 FKST} - {-971643600 -14400 0 FKT} - {-954705600 -10800 1 FKST} - {-939589200 -14400 0 FKT} - {-923256000 -10800 1 FKST} - {-908139600 -14400 0 FKT} - {-891806400 -10800 1 FKST} - {-876690000 -14400 0 FKT} - {-860356800 -10800 1 FKST} - {420606000 -7200 0 FKT} - {433303200 -7200 1 FKST} - {452052000 -10800 0 FKT} - {464151600 -7200 1 FKST} - {483501600 -10800 0 FKT} - {495597600 -14400 0 FKT} - {495604800 -10800 1 FKST} - {514350000 -14400 0 FKT} - {527054400 -10800 1 FKST} - {545799600 -14400 0 FKT} - {558504000 -10800 1 FKST} - {577249200 -14400 0 FKT} - {589953600 -10800 1 FKST} - {608698800 -14400 0 FKT} - {621403200 -10800 1 FKST} - {640753200 -14400 0 FKT} - {652852800 -10800 1 FKST} - {672202800 -14400 0 FKT} - {684907200 -10800 1 FKST} - {703652400 -14400 0 FKT} - {716356800 -10800 1 FKST} - {735102000 -14400 0 FKT} - {747806400 -10800 1 FKST} - {766551600 -14400 0 FKT} - {779256000 -10800 1 FKST} - {798001200 -14400 0 FKT} - {810705600 -10800 1 FKST} - {830055600 -14400 0 FKT} - {842760000 -10800 1 FKST} - {861505200 -14400 0 FKT} - {874209600 -10800 1 FKST} - {892954800 -14400 0 FKT} - {905659200 -10800 1 FKST} - {924404400 -14400 0 FKT} - {937108800 -10800 1 FKST} - {955854000 -14400 0 FKT} - {968558400 -10800 1 FKST} - {987310800 -14400 0 FKT} - {999410400 -10800 1 FKST} - {1019365200 -14400 0 FKT} - {1030860000 -10800 1 FKST} - {1050814800 -14400 0 FKT} - {1062914400 -10800 1 FKST} - {1082264400 -14400 0 FKT} - {1094364000 -10800 1 FKST} - {1113714000 -14400 0 FKT} - {1125813600 -10800 1 FKST} - {1145163600 -14400 0 FKT} - {1157263200 -10800 1 FKST} - {1176613200 -14400 0 FKT} - {1188712800 -10800 1 FKST} - {1208667600 -14400 0 FKT} - {1220767200 -10800 1 FKST} - {1240117200 -14400 0 FKT} - {1252216800 -10800 1 FKST} - {1271566800 -14400 0 FKT} - {1283662800 -10800 0 FKST} + {-1824235716 -14400 0 -04} + {-1018209600 -10800 1 -03} + {-1003093200 -14400 0 -04} + {-986760000 -10800 1 -03} + {-971643600 -14400 0 -04} + {-954705600 -10800 1 -03} + {-939589200 -14400 0 -04} + {-923256000 -10800 1 -03} + {-908139600 -14400 0 -04} + {-891806400 -10800 1 -03} + {-876690000 -14400 0 -04} + {-860356800 -10800 1 -03} + {420606000 -7200 0 -03} + {433303200 -7200 1 -02} + {452052000 -10800 0 -03} + {464151600 -7200 1 -02} + {483501600 -10800 0 -03} + {495597600 -14400 0 -04} + {495604800 -10800 1 -03} + {514350000 -14400 0 -04} + {527054400 -10800 1 -03} + {545799600 -14400 0 -04} + {558504000 -10800 1 -03} + {577249200 -14400 0 -04} + {589953600 -10800 1 -03} + {608698800 -14400 0 -04} + {621403200 -10800 1 -03} + {640753200 -14400 0 -04} + {652852800 -10800 1 -03} + {672202800 -14400 0 -04} + {684907200 -10800 1 -03} + {703652400 -14400 0 -04} + {716356800 -10800 1 -03} + {735102000 -14400 0 -04} + {747806400 -10800 1 -03} + {766551600 -14400 0 -04} + {779256000 -10800 1 -03} + {798001200 -14400 0 -04} + {810705600 -10800 1 -03} + {830055600 -14400 0 -04} + {842760000 -10800 1 -03} + {861505200 -14400 0 -04} + {874209600 -10800 1 -03} + {892954800 -14400 0 -04} + {905659200 -10800 1 -03} + {924404400 -14400 0 -04} + {937108800 -10800 1 -03} + {955854000 -14400 0 -04} + {968558400 -10800 1 -03} + {987310800 -14400 0 -04} + {999410400 -10800 1 -03} + {1019365200 -14400 0 -04} + {1030860000 -10800 1 -03} + {1050814800 -14400 0 -04} + {1062914400 -10800 1 -03} + {1082264400 -14400 0 -04} + {1094364000 -10800 1 -03} + {1113714000 -14400 0 -04} + {1125813600 -10800 1 -03} + {1145163600 -14400 0 -04} + {1157263200 -10800 1 -03} + {1176613200 -14400 0 -04} + {1188712800 -10800 1 -03} + {1208667600 -14400 0 -04} + {1220767200 -10800 1 -03} + {1240117200 -14400 0 -04} + {1252216800 -10800 1 -03} + {1271566800 -14400 0 -04} + {1283662800 -10800 0 -03} } diff --git a/library/tzdata/Australia/Eucla b/library/tzdata/Australia/Eucla index 08a1948..8008980 100644 --- a/library/tzdata/Australia/Eucla +++ b/library/tzdata/Australia/Eucla @@ -2,24 +2,24 @@ set TZData(:Australia/Eucla) { {-9223372036854775808 30928 0 LMT} - {-2337928528 31500 0 ACWST} - {-1672562640 35100 1 ACWDT} - {-1665387900 31500 0 ACWST} - {-883637100 35100 1 ACWDT} - {-876123900 31500 0 ACWST} - {-860395500 35100 1 ACWDT} - {-844674300 31500 0 ACWST} - {-836473500 35100 0 ACWST} - {152039700 35100 1 ACWDT} - {162926100 31500 0 ACWST} - {436295700 35100 1 ACWDT} - {447182100 31500 0 ACWST} - {690311700 35100 1 ACWDT} - {699383700 31500 0 ACWST} - {1165079700 35100 1 ACWDT} - {1174756500 31500 0 ACWST} - {1193505300 35100 1 ACWDT} - {1206810900 31500 0 ACWST} - {1224954900 35100 1 ACWDT} - {1238260500 31500 0 ACWST} + {-2337928528 31500 0 +0945} + {-1672562640 35100 1 +0945} + {-1665387900 31500 0 +0945} + {-883637100 35100 1 +0945} + {-876123900 31500 0 +0945} + {-860395500 35100 1 +0945} + {-844674300 31500 0 +0945} + {-836473500 35100 0 +0945} + {152039700 35100 1 +0945} + {162926100 31500 0 +0945} + {436295700 35100 1 +0945} + {447182100 31500 0 +0945} + {690311700 35100 1 +0945} + {699383700 31500 0 +0945} + {1165079700 35100 1 +0945} + {1174756500 31500 0 +0945} + {1193505300 35100 1 +0945} + {1206810900 31500 0 +0945} + {1224954900 35100 1 +0945} + {1238260500 31500 0 +0945} } diff --git a/library/tzdata/Australia/Lord_Howe b/library/tzdata/Australia/Lord_Howe index a8ff80e..0e2405e 100644 --- a/library/tzdata/Australia/Lord_Howe +++ b/library/tzdata/Australia/Lord_Howe @@ -3,242 +3,243 @@ set TZData(:Australia/Lord_Howe) { {-9223372036854775808 38180 0 LMT} {-2364114980 36000 0 AEST} - {352216800 37800 0 LHST} - {372785400 41400 1 LHDT} - {384273000 37800 0 LHST} - {404839800 41400 1 LHDT} - {415722600 37800 0 LHST} - {436289400 41400 1 LHDT} - {447172200 37800 0 LHST} - {467739000 41400 1 LHDT} - {478621800 37800 0 LHST} - {499188600 39600 1 LHDT} - {511282800 37800 0 LHST} - {530033400 39600 1 LHDT} - {542732400 37800 0 LHST} - {562087800 39600 1 LHDT} - {574786800 37800 0 LHST} - {594142200 39600 1 LHDT} - {606236400 37800 0 LHST} - {625591800 39600 1 LHDT} - {636476400 37800 0 LHST} - {657041400 39600 1 LHDT} - {667926000 37800 0 LHST} - {688491000 39600 1 LHDT} - {699375600 37800 0 LHST} - {719940600 39600 1 LHDT} - {731430000 37800 0 LHST} - {751995000 39600 1 LHDT} - {762879600 37800 0 LHST} - {783444600 39600 1 LHDT} - {794329200 37800 0 LHST} - {814894200 39600 1 LHDT} - {828198000 37800 0 LHST} - {846343800 39600 1 LHDT} - {859647600 37800 0 LHST} - {877793400 39600 1 LHDT} - {891097200 37800 0 LHST} - {909243000 39600 1 LHDT} - {922546800 37800 0 LHST} - {941297400 39600 1 LHDT} - {953996400 37800 0 LHST} - {967303800 39600 1 LHDT} - {985446000 37800 0 LHST} - {1004196600 39600 1 LHDT} - {1017500400 37800 0 LHST} - {1035646200 39600 1 LHDT} - {1048950000 37800 0 LHST} - {1067095800 39600 1 LHDT} - {1080399600 37800 0 LHST} - {1099150200 39600 1 LHDT} - {1111849200 37800 0 LHST} - {1130599800 39600 1 LHDT} - {1143903600 37800 0 LHST} - {1162049400 39600 1 LHDT} - {1174748400 37800 0 LHST} - {1193499000 39600 1 LHDT} - {1207407600 37800 0 LHST} - {1223134200 39600 1 LHDT} - {1238857200 37800 0 LHST} - {1254583800 39600 1 LHDT} - {1270306800 37800 0 LHST} - {1286033400 39600 1 LHDT} - {1301756400 37800 0 LHST} - {1317483000 39600 1 LHDT} - {1333206000 37800 0 LHST} - {1349537400 39600 1 LHDT} - {1365260400 37800 0 LHST} - {1380987000 39600 1 LHDT} - {1396710000 37800 0 LHST} - {1412436600 39600 1 LHDT} - {1428159600 37800 0 LHST} - {1443886200 39600 1 LHDT} - {1459609200 37800 0 LHST} - {1475335800 39600 1 LHDT} - {1491058800 37800 0 LHST} - {1506785400 39600 1 LHDT} - {1522508400 37800 0 LHST} - {1538839800 39600 1 LHDT} - {1554562800 37800 0 LHST} - {1570289400 39600 1 LHDT} - {1586012400 37800 0 LHST} - {1601739000 39600 1 LHDT} - {1617462000 37800 0 LHST} - {1633188600 39600 1 LHDT} - {1648911600 37800 0 LHST} - {1664638200 39600 1 LHDT} - {1680361200 37800 0 LHST} - {1696087800 39600 1 LHDT} - {1712415600 37800 0 LHST} - {1728142200 39600 1 LHDT} - {1743865200 37800 0 LHST} - {1759591800 39600 1 LHDT} - {1775314800 37800 0 LHST} - {1791041400 39600 1 LHDT} - {1806764400 37800 0 LHST} - {1822491000 39600 1 LHDT} - {1838214000 37800 0 LHST} - {1853940600 39600 1 LHDT} - {1869663600 37800 0 LHST} - {1885995000 39600 1 LHDT} - {1901718000 37800 0 LHST} - {1917444600 39600 1 LHDT} - {1933167600 37800 0 LHST} - {1948894200 39600 1 LHDT} - {1964617200 37800 0 LHST} - {1980343800 39600 1 LHDT} - {1996066800 37800 0 LHST} - {2011793400 39600 1 LHDT} - {2027516400 37800 0 LHST} - {2043243000 39600 1 LHDT} - {2058966000 37800 0 LHST} - {2075297400 39600 1 LHDT} - {2091020400 37800 0 LHST} - {2106747000 39600 1 LHDT} - {2122470000 37800 0 LHST} - {2138196600 39600 1 LHDT} - {2153919600 37800 0 LHST} - {2169646200 39600 1 LHDT} - {2185369200 37800 0 LHST} - {2201095800 39600 1 LHDT} - {2216818800 37800 0 LHST} - {2233150200 39600 1 LHDT} - {2248873200 37800 0 LHST} - {2264599800 39600 1 LHDT} - {2280322800 37800 0 LHST} - {2296049400 39600 1 LHDT} - {2311772400 37800 0 LHST} - {2327499000 39600 1 LHDT} - {2343222000 37800 0 LHST} - {2358948600 39600 1 LHDT} - {2374671600 37800 0 LHST} - {2390398200 39600 1 LHDT} - {2406121200 37800 0 LHST} - {2422452600 39600 1 LHDT} - {2438175600 37800 0 LHST} - {2453902200 39600 1 LHDT} - {2469625200 37800 0 LHST} - {2485351800 39600 1 LHDT} - {2501074800 37800 0 LHST} - {2516801400 39600 1 LHDT} - {2532524400 37800 0 LHST} - {2548251000 39600 1 LHDT} - {2563974000 37800 0 LHST} - {2579700600 39600 1 LHDT} - {2596028400 37800 0 LHST} - {2611755000 39600 1 LHDT} - {2627478000 37800 0 LHST} - {2643204600 39600 1 LHDT} - {2658927600 37800 0 LHST} - {2674654200 39600 1 LHDT} - {2690377200 37800 0 LHST} - {2706103800 39600 1 LHDT} - {2721826800 37800 0 LHST} - {2737553400 39600 1 LHDT} - {2753276400 37800 0 LHST} - {2769607800 39600 1 LHDT} - {2785330800 37800 0 LHST} - {2801057400 39600 1 LHDT} - {2816780400 37800 0 LHST} - {2832507000 39600 1 LHDT} - {2848230000 37800 0 LHST} - {2863956600 39600 1 LHDT} - {2879679600 37800 0 LHST} - {2895406200 39600 1 LHDT} - {2911129200 37800 0 LHST} - {2926855800 39600 1 LHDT} - {2942578800 37800 0 LHST} - {2958910200 39600 1 LHDT} - {2974633200 37800 0 LHST} - {2990359800 39600 1 LHDT} - {3006082800 37800 0 LHST} - {3021809400 39600 1 LHDT} - {3037532400 37800 0 LHST} - {3053259000 39600 1 LHDT} - {3068982000 37800 0 LHST} - {3084708600 39600 1 LHDT} - {3100431600 37800 0 LHST} - {3116763000 39600 1 LHDT} - {3132486000 37800 0 LHST} - {3148212600 39600 1 LHDT} - {3163935600 37800 0 LHST} - {3179662200 39600 1 LHDT} - {3195385200 37800 0 LHST} - {3211111800 39600 1 LHDT} - {3226834800 37800 0 LHST} - {3242561400 39600 1 LHDT} - {3258284400 37800 0 LHST} - {3274011000 39600 1 LHDT} - {3289734000 37800 0 LHST} - {3306065400 39600 1 LHDT} - {3321788400 37800 0 LHST} - {3337515000 39600 1 LHDT} - {3353238000 37800 0 LHST} - {3368964600 39600 1 LHDT} - {3384687600 37800 0 LHST} - {3400414200 39600 1 LHDT} - {3416137200 37800 0 LHST} - {3431863800 39600 1 LHDT} - {3447586800 37800 0 LHST} - {3463313400 39600 1 LHDT} - {3479641200 37800 0 LHST} - {3495367800 39600 1 LHDT} - {3511090800 37800 0 LHST} - {3526817400 39600 1 LHDT} - {3542540400 37800 0 LHST} - {3558267000 39600 1 LHDT} - {3573990000 37800 0 LHST} - {3589716600 39600 1 LHDT} - {3605439600 37800 0 LHST} - {3621166200 39600 1 LHDT} - {3636889200 37800 0 LHST} - {3653220600 39600 1 LHDT} - {3668943600 37800 0 LHST} - {3684670200 39600 1 LHDT} - {3700393200 37800 0 LHST} - {3716119800 39600 1 LHDT} - {3731842800 37800 0 LHST} - {3747569400 39600 1 LHDT} - {3763292400 37800 0 LHST} - {3779019000 39600 1 LHDT} - {3794742000 37800 0 LHST} - {3810468600 39600 1 LHDT} - {3826191600 37800 0 LHST} - {3842523000 39600 1 LHDT} - {3858246000 37800 0 LHST} - {3873972600 39600 1 LHDT} - {3889695600 37800 0 LHST} - {3905422200 39600 1 LHDT} - {3921145200 37800 0 LHST} - {3936871800 39600 1 LHDT} - {3952594800 37800 0 LHST} - {3968321400 39600 1 LHDT} - {3984044400 37800 0 LHST} - {4000375800 39600 1 LHDT} - {4016098800 37800 0 LHST} - {4031825400 39600 1 LHDT} - {4047548400 37800 0 LHST} - {4063275000 39600 1 LHDT} - {4078998000 37800 0 LHST} - {4094724600 39600 1 LHDT} + {352216800 37800 0 +1130} + {372785400 41400 1 +1130} + {384273000 37800 0 +1130} + {404839800 41400 1 +1130} + {415722600 37800 0 +1130} + {436289400 41400 1 +1130} + {447172200 37800 0 +1130} + {467739000 41400 1 +1130} + {478621800 37800 0 +1130} + {488984400 37800 0 +11} + {499188600 39600 1 +11} + {511282800 37800 0 +11} + {530033400 39600 1 +11} + {542732400 37800 0 +11} + {562087800 39600 1 +11} + {574786800 37800 0 +11} + {594142200 39600 1 +11} + {606236400 37800 0 +11} + {625591800 39600 1 +11} + {636476400 37800 0 +11} + {657041400 39600 1 +11} + {667926000 37800 0 +11} + {688491000 39600 1 +11} + {699375600 37800 0 +11} + {719940600 39600 1 +11} + {731430000 37800 0 +11} + {751995000 39600 1 +11} + {762879600 37800 0 +11} + {783444600 39600 1 +11} + {794329200 37800 0 +11} + {814894200 39600 1 +11} + {828198000 37800 0 +11} + {846343800 39600 1 +11} + {859647600 37800 0 +11} + {877793400 39600 1 +11} + {891097200 37800 0 +11} + {909243000 39600 1 +11} + {922546800 37800 0 +11} + {941297400 39600 1 +11} + {953996400 37800 0 +11} + {967303800 39600 1 +11} + {985446000 37800 0 +11} + {1004196600 39600 1 +11} + {1017500400 37800 0 +11} + {1035646200 39600 1 +11} + {1048950000 37800 0 +11} + {1067095800 39600 1 +11} + {1080399600 37800 0 +11} + {1099150200 39600 1 +11} + {1111849200 37800 0 +11} + {1130599800 39600 1 +11} + {1143903600 37800 0 +11} + {1162049400 39600 1 +11} + {1174748400 37800 0 +11} + {1193499000 39600 1 +11} + {1207407600 37800 0 +11} + {1223134200 39600 1 +11} + {1238857200 37800 0 +11} + {1254583800 39600 1 +11} + {1270306800 37800 0 +11} + {1286033400 39600 1 +11} + {1301756400 37800 0 +11} + {1317483000 39600 1 +11} + {1333206000 37800 0 +11} + {1349537400 39600 1 +11} + {1365260400 37800 0 +11} + {1380987000 39600 1 +11} + {1396710000 37800 0 +11} + {1412436600 39600 1 +11} + {1428159600 37800 0 +11} + {1443886200 39600 1 +11} + {1459609200 37800 0 +11} + {1475335800 39600 1 +11} + {1491058800 37800 0 +11} + {1506785400 39600 1 +11} + {1522508400 37800 0 +11} + {1538839800 39600 1 +11} + {1554562800 37800 0 +11} + {1570289400 39600 1 +11} + {1586012400 37800 0 +11} + {1601739000 39600 1 +11} + {1617462000 37800 0 +11} + {1633188600 39600 1 +11} + {1648911600 37800 0 +11} + {1664638200 39600 1 +11} + {1680361200 37800 0 +11} + {1696087800 39600 1 +11} + {1712415600 37800 0 +11} + {1728142200 39600 1 +11} + {1743865200 37800 0 +11} + {1759591800 39600 1 +11} + {1775314800 37800 0 +11} + {1791041400 39600 1 +11} + {1806764400 37800 0 +11} + {1822491000 39600 1 +11} + {1838214000 37800 0 +11} + {1853940600 39600 1 +11} + {1869663600 37800 0 +11} + {1885995000 39600 1 +11} + {1901718000 37800 0 +11} + {1917444600 39600 1 +11} + {1933167600 37800 0 +11} + {1948894200 39600 1 +11} + {1964617200 37800 0 +11} + {1980343800 39600 1 +11} + {1996066800 37800 0 +11} + {2011793400 39600 1 +11} + {2027516400 37800 0 +11} + {2043243000 39600 1 +11} + {2058966000 37800 0 +11} + {2075297400 39600 1 +11} + {2091020400 37800 0 +11} + {2106747000 39600 1 +11} + {2122470000 37800 0 +11} + {2138196600 39600 1 +11} + {2153919600 37800 0 +11} + {2169646200 39600 1 +11} + {2185369200 37800 0 +11} + {2201095800 39600 1 +11} + {2216818800 37800 0 +11} + {2233150200 39600 1 +11} + {2248873200 37800 0 +11} + {2264599800 39600 1 +11} + {2280322800 37800 0 +11} + {2296049400 39600 1 +11} + {2311772400 37800 0 +11} + {2327499000 39600 1 +11} + {2343222000 37800 0 +11} + {2358948600 39600 1 +11} + {2374671600 37800 0 +11} + {2390398200 39600 1 +11} + {2406121200 37800 0 +11} + {2422452600 39600 1 +11} + {2438175600 37800 0 +11} + {2453902200 39600 1 +11} + {2469625200 37800 0 +11} + {2485351800 39600 1 +11} + {2501074800 37800 0 +11} + {2516801400 39600 1 +11} + {2532524400 37800 0 +11} + {2548251000 39600 1 +11} + {2563974000 37800 0 +11} + {2579700600 39600 1 +11} + {2596028400 37800 0 +11} + {2611755000 39600 1 +11} + {2627478000 37800 0 +11} + {2643204600 39600 1 +11} + {2658927600 37800 0 +11} + {2674654200 39600 1 +11} + {2690377200 37800 0 +11} + {2706103800 39600 1 +11} + {2721826800 37800 0 +11} + {2737553400 39600 1 +11} + {2753276400 37800 0 +11} + {2769607800 39600 1 +11} + {2785330800 37800 0 +11} + {2801057400 39600 1 +11} + {2816780400 37800 0 +11} + {2832507000 39600 1 +11} + {2848230000 37800 0 +11} + {2863956600 39600 1 +11} + {2879679600 37800 0 +11} + {2895406200 39600 1 +11} + {2911129200 37800 0 +11} + {2926855800 39600 1 +11} + {2942578800 37800 0 +11} + {2958910200 39600 1 +11} + {2974633200 37800 0 +11} + {2990359800 39600 1 +11} + {3006082800 37800 0 +11} + {3021809400 39600 1 +11} + {3037532400 37800 0 +11} + {3053259000 39600 1 +11} + {3068982000 37800 0 +11} + {3084708600 39600 1 +11} + {3100431600 37800 0 +11} + {3116763000 39600 1 +11} + {3132486000 37800 0 +11} + {3148212600 39600 1 +11} + {3163935600 37800 0 +11} + {3179662200 39600 1 +11} + {3195385200 37800 0 +11} + {3211111800 39600 1 +11} + {3226834800 37800 0 +11} + {3242561400 39600 1 +11} + {3258284400 37800 0 +11} + {3274011000 39600 1 +11} + {3289734000 37800 0 +11} + {3306065400 39600 1 +11} + {3321788400 37800 0 +11} + {3337515000 39600 1 +11} + {3353238000 37800 0 +11} + {3368964600 39600 1 +11} + {3384687600 37800 0 +11} + {3400414200 39600 1 +11} + {3416137200 37800 0 +11} + {3431863800 39600 1 +11} + {3447586800 37800 0 +11} + {3463313400 39600 1 +11} + {3479641200 37800 0 +11} + {3495367800 39600 1 +11} + {3511090800 37800 0 +11} + {3526817400 39600 1 +11} + {3542540400 37800 0 +11} + {3558267000 39600 1 +11} + {3573990000 37800 0 +11} + {3589716600 39600 1 +11} + {3605439600 37800 0 +11} + {3621166200 39600 1 +11} + {3636889200 37800 0 +11} + {3653220600 39600 1 +11} + {3668943600 37800 0 +11} + {3684670200 39600 1 +11} + {3700393200 37800 0 +11} + {3716119800 39600 1 +11} + {3731842800 37800 0 +11} + {3747569400 39600 1 +11} + {3763292400 37800 0 +11} + {3779019000 39600 1 +11} + {3794742000 37800 0 +11} + {3810468600 39600 1 +11} + {3826191600 37800 0 +11} + {3842523000 39600 1 +11} + {3858246000 37800 0 +11} + {3873972600 39600 1 +11} + {3889695600 37800 0 +11} + {3905422200 39600 1 +11} + {3921145200 37800 0 +11} + {3936871800 39600 1 +11} + {3952594800 37800 0 +11} + {3968321400 39600 1 +11} + {3984044400 37800 0 +11} + {4000375800 39600 1 +11} + {4016098800 37800 0 +11} + {4031825400 39600 1 +11} + {4047548400 37800 0 +11} + {4063275000 39600 1 +11} + {4078998000 37800 0 +11} + {4094724600 39600 1 +11} } diff --git a/library/tzdata/Europe/Amsterdam b/library/tzdata/Europe/Amsterdam index bd89127..b683c99 100644 --- a/library/tzdata/Europe/Amsterdam +++ b/library/tzdata/Europe/Amsterdam @@ -46,12 +46,12 @@ set TZData(:Europe/Amsterdam) { {-1061331572 4772 1 NST} {-1049062772 1172 0 AMT} {-1029190772 4772 1 NST} - {-1025741972 4800 0 NEST} - {-1017613200 1200 0 NET} - {-998259600 4800 1 NEST} - {-986163600 1200 0 NET} - {-966723600 4800 1 NEST} - {-954109200 1200 0 NET} + {-1025741972 4800 0 +0120} + {-1017613200 1200 0 +0020} + {-998259600 4800 1 +0120} + {-986163600 1200 0 +0020} + {-966723600 4800 1 +0120} + {-954109200 1200 0 +0020} {-935022000 7200 0 CEST} {-857257200 3600 0 CET} {-844556400 7200 1 CEST} diff --git a/library/tzdata/Europe/Madrid b/library/tzdata/Europe/Madrid index 50de14f..f4dd484 100644 --- a/library/tzdata/Europe/Madrid +++ b/library/tzdata/Europe/Madrid @@ -2,52 +2,50 @@ set TZData(:Europe/Madrid) { {-9223372036854775808 -884 0 LMT} - {-2177451916 0 0 WET} - {-1661734800 3600 1 WEST} - {-1648429200 0 0 WET} + {-2177452800 0 0 WET} {-1631926800 3600 1 WEST} - {-1616893200 0 0 WET} - {-1601254800 3600 1 WEST} - {-1585357200 0 0 WET} + {-1616889600 0 0 WET} + {-1601168400 3600 1 WEST} + {-1585353600 0 0 WET} {-1442451600 3600 1 WEST} - {-1427677200 0 0 WET} + {-1427673600 0 0 WET} {-1379293200 3600 1 WEST} - {-1364778000 0 0 WET} + {-1364774400 0 0 WET} {-1348448400 3600 1 WEST} - {-1333328400 0 0 WET} - {-1316394000 3600 1 WEST} - {-1301274000 0 0 WET} + {-1333324800 0 0 WET} + {-1316390400 3600 1 WEST} + {-1301270400 0 0 WET} {-1284339600 3600 1 WEST} - {-1269824400 0 0 WET} - {-1029114000 3600 1 WEST} - {-1017622800 0 0 WET} - {-1002848400 3600 1 WEST} - {-986173200 0 0 WET} - {-969238800 3600 1 WEST} - {-954118800 0 0 WET} - {-940208400 3600 1 WEST} - {-873079200 7200 1 WEMT} - {-862538400 3600 1 WEST} - {-842839200 7200 1 WEMT} - {-828237600 3600 1 WEST} - {-811389600 7200 1 WEMT} - {-796010400 3600 1 WEST} - {-779940000 7200 1 WEMT} - {-765421200 3600 1 WEST} - {-748490400 7200 1 WEMT} - {-733881600 3600 0 CET} + {-1269820800 0 0 WET} + {-1026954000 3600 1 WEST} + {-1017619200 0 0 WET} + {-1001898000 3600 1 WEST} + {-999482400 7200 1 WEMT} + {-986090400 3600 1 WEST} + {-954115200 0 0 WET} + {-940208400 3600 0 CET} + {-873079200 7200 1 CEST} + {-862621200 3600 0 CET} + {-842839200 7200 1 CEST} + {-828320400 3600 0 CET} + {-811389600 7200 1 CEST} + {-796870800 3600 0 CET} + {-779940000 7200 1 CEST} + {-765421200 3600 0 CET} + {-748490400 7200 1 CEST} + {-733971600 3600 0 CET} {-652327200 7200 1 CEST} - {-639190800 3600 0 CET} + {-639018000 3600 0 CET} {135122400 7200 1 CEST} {150246000 3600 0 CET} - {167176800 7200 1 CEST} + {166572000 7200 1 CEST} {181695600 3600 0 CET} {196812000 7200 1 CEST} {212540400 3600 0 CET} {228866400 7200 1 CEST} {243990000 3600 0 CET} - {260402400 7200 1 CEST} - {276044400 3600 0 CET} + {260326800 7200 1 CEST} + {276051600 3600 0 CET} {283993200 3600 0 CET} {291776400 7200 1 CEST} {307501200 3600 0 CET} diff --git a/library/tzdata/Europe/Zaporozhye b/library/tzdata/Europe/Zaporozhye index 01418cd..478a61c 100644 --- a/library/tzdata/Europe/Zaporozhye +++ b/library/tzdata/Europe/Zaporozhye @@ -2,7 +2,7 @@ set TZData(:Europe/Zaporozhye) { {-9223372036854775808 8440 0 LMT} - {-2840149240 8400 0 CUT} + {-2840149240 8400 0 +0220} {-1441160400 7200 0 EET} {-1247536800 10800 0 MSK} {-894769200 3600 0 CET} diff --git a/library/tzdata/Indian/Chagos b/library/tzdata/Indian/Chagos index a5cec61..23ea790 100644 --- a/library/tzdata/Indian/Chagos +++ b/library/tzdata/Indian/Chagos @@ -2,6 +2,6 @@ set TZData(:Indian/Chagos) { {-9223372036854775808 17380 0 LMT} - {-1988167780 18000 0 IOT} - {820436400 21600 0 IOT} + {-1988167780 18000 0 +05} + {820436400 21600 0 +06} } diff --git a/library/tzdata/Indian/Christmas b/library/tzdata/Indian/Christmas index c36e973..76f8cbe 100644 --- a/library/tzdata/Indian/Christmas +++ b/library/tzdata/Indian/Christmas @@ -2,5 +2,5 @@ set TZData(:Indian/Christmas) { {-9223372036854775808 25372 0 LMT} - {-2364102172 25200 0 CXT} + {-2364102172 25200 0 +07} } diff --git a/library/tzdata/Indian/Cocos b/library/tzdata/Indian/Cocos index a63ae68..833eb20 100644 --- a/library/tzdata/Indian/Cocos +++ b/library/tzdata/Indian/Cocos @@ -2,5 +2,5 @@ set TZData(:Indian/Cocos) { {-9223372036854775808 23260 0 LMT} - {-2209012060 23400 0 CCT} + {-2209012060 23400 0 +0630} } diff --git a/library/tzdata/Indian/Mahe b/library/tzdata/Indian/Mahe index c88a24b..3dd5b40 100644 --- a/library/tzdata/Indian/Mahe +++ b/library/tzdata/Indian/Mahe @@ -2,5 +2,5 @@ set TZData(:Indian/Mahe) { {-9223372036854775808 13308 0 LMT} - {-2006653308 14400 0 SCT} + {-2006653308 14400 0 +04} } diff --git a/library/tzdata/Indian/Maldives b/library/tzdata/Indian/Maldives index 2c2c739..b23bf2b 100644 --- a/library/tzdata/Indian/Maldives +++ b/library/tzdata/Indian/Maldives @@ -3,5 +3,5 @@ set TZData(:Indian/Maldives) { {-9223372036854775808 17640 0 LMT} {-2840158440 17640 0 MMT} - {-315636840 18000 0 MVT} + {-315636840 18000 0 +05} } diff --git a/library/tzdata/Indian/Mauritius b/library/tzdata/Indian/Mauritius index a9c07eb..2a7a0b1 100644 --- a/library/tzdata/Indian/Mauritius +++ b/library/tzdata/Indian/Mauritius @@ -2,9 +2,9 @@ set TZData(:Indian/Mauritius) { {-9223372036854775808 13800 0 LMT} - {-1988164200 14400 0 MUT} - {403041600 18000 1 MUST} - {417034800 14400 0 MUT} - {1224972000 18000 1 MUST} - {1238274000 14400 0 MUT} + {-1988164200 14400 0 +04} + {403041600 18000 1 +05} + {417034800 14400 0 +04} + {1224972000 18000 1 +05} + {1238274000 14400 0 +04} } diff --git a/library/tzdata/Indian/Reunion b/library/tzdata/Indian/Reunion index de2dd60..aa78dec 100644 --- a/library/tzdata/Indian/Reunion +++ b/library/tzdata/Indian/Reunion @@ -2,5 +2,5 @@ set TZData(:Indian/Reunion) { {-9223372036854775808 13312 0 LMT} - {-1848886912 14400 0 RET} + {-1848886912 14400 0 +04} } diff --git a/library/tzdata/Pacific/Apia b/library/tzdata/Pacific/Apia index 21d6669..feef374 100644 --- a/library/tzdata/Pacific/Apia +++ b/library/tzdata/Pacific/Apia @@ -3,186 +3,186 @@ set TZData(:Pacific/Apia) { {-9223372036854775808 45184 0 LMT} {-2855737984 -41216 0 LMT} - {-1861878784 -41400 0 WSST} - {-631110600 -39600 0 SST} - {1285498800 -36000 1 SDT} - {1301752800 -39600 0 SST} - {1316872800 -36000 1 SDT} - {1325239200 50400 0 WSDT} - {1333202400 46800 0 WSST} - {1348927200 50400 1 WSDT} - {1365256800 46800 0 WSST} - {1380376800 50400 1 WSDT} - {1396706400 46800 0 WSST} - {1411826400 50400 1 WSDT} - {1428156000 46800 0 WSST} - {1443276000 50400 1 WSDT} - {1459605600 46800 0 WSST} - {1474725600 50400 1 WSDT} - {1491055200 46800 0 WSST} - {1506175200 50400 1 WSDT} - {1522504800 46800 0 WSST} - {1538229600 50400 1 WSDT} - {1554559200 46800 0 WSST} - {1569679200 50400 1 WSDT} - {1586008800 46800 0 WSST} - {1601128800 50400 1 WSDT} - {1617458400 46800 0 WSST} - {1632578400 50400 1 WSDT} - {1648908000 46800 0 WSST} - {1664028000 50400 1 WSDT} - {1680357600 46800 0 WSST} - {1695477600 50400 1 WSDT} - {1712412000 46800 0 WSST} - {1727532000 50400 1 WSDT} - {1743861600 46800 0 WSST} - {1758981600 50400 1 WSDT} - {1775311200 46800 0 WSST} - {1790431200 50400 1 WSDT} - {1806760800 46800 0 WSST} - {1821880800 50400 1 WSDT} - {1838210400 46800 0 WSST} - {1853330400 50400 1 WSDT} - {1869660000 46800 0 WSST} - {1885384800 50400 1 WSDT} - {1901714400 46800 0 WSST} - {1916834400 50400 1 WSDT} - {1933164000 46800 0 WSST} - {1948284000 50400 1 WSDT} - {1964613600 46800 0 WSST} - {1979733600 50400 1 WSDT} - {1996063200 46800 0 WSST} - {2011183200 50400 1 WSDT} - {2027512800 46800 0 WSST} - {2042632800 50400 1 WSDT} - {2058962400 46800 0 WSST} - {2074687200 50400 1 WSDT} - {2091016800 46800 0 WSST} - {2106136800 50400 1 WSDT} - {2122466400 46800 0 WSST} - {2137586400 50400 1 WSDT} - {2153916000 46800 0 WSST} - {2169036000 50400 1 WSDT} - {2185365600 46800 0 WSST} - {2200485600 50400 1 WSDT} - {2216815200 46800 0 WSST} - {2232540000 50400 1 WSDT} - {2248869600 46800 0 WSST} - {2263989600 50400 1 WSDT} - {2280319200 46800 0 WSST} - {2295439200 50400 1 WSDT} - {2311768800 46800 0 WSST} - {2326888800 50400 1 WSDT} - {2343218400 46800 0 WSST} - {2358338400 50400 1 WSDT} - {2374668000 46800 0 WSST} - {2389788000 50400 1 WSDT} - {2406117600 46800 0 WSST} - {2421842400 50400 1 WSDT} - {2438172000 46800 0 WSST} - {2453292000 50400 1 WSDT} - {2469621600 46800 0 WSST} - {2484741600 50400 1 WSDT} - {2501071200 46800 0 WSST} - {2516191200 50400 1 WSDT} - {2532520800 46800 0 WSST} - {2547640800 50400 1 WSDT} - {2563970400 46800 0 WSST} - {2579090400 50400 1 WSDT} - {2596024800 46800 0 WSST} - {2611144800 50400 1 WSDT} - {2627474400 46800 0 WSST} - {2642594400 50400 1 WSDT} - {2658924000 46800 0 WSST} - {2674044000 50400 1 WSDT} - {2690373600 46800 0 WSST} - {2705493600 50400 1 WSDT} - {2721823200 46800 0 WSST} - {2736943200 50400 1 WSDT} - {2753272800 46800 0 WSST} - {2768997600 50400 1 WSDT} - {2785327200 46800 0 WSST} - {2800447200 50400 1 WSDT} - {2816776800 46800 0 WSST} - {2831896800 50400 1 WSDT} - {2848226400 46800 0 WSST} - {2863346400 50400 1 WSDT} - {2879676000 46800 0 WSST} - {2894796000 50400 1 WSDT} - {2911125600 46800 0 WSST} - {2926245600 50400 1 WSDT} - {2942575200 46800 0 WSST} - {2958300000 50400 1 WSDT} - {2974629600 46800 0 WSST} - {2989749600 50400 1 WSDT} - {3006079200 46800 0 WSST} - {3021199200 50400 1 WSDT} - {3037528800 46800 0 WSST} - {3052648800 50400 1 WSDT} - {3068978400 46800 0 WSST} - {3084098400 50400 1 WSDT} - {3100428000 46800 0 WSST} - {3116152800 50400 1 WSDT} - {3132482400 46800 0 WSST} - {3147602400 50400 1 WSDT} - {3163932000 46800 0 WSST} - {3179052000 50400 1 WSDT} - {3195381600 46800 0 WSST} - {3210501600 50400 1 WSDT} - {3226831200 46800 0 WSST} - {3241951200 50400 1 WSDT} - {3258280800 46800 0 WSST} - {3273400800 50400 1 WSDT} - {3289730400 46800 0 WSST} - {3305455200 50400 1 WSDT} - {3321784800 46800 0 WSST} - {3336904800 50400 1 WSDT} - {3353234400 46800 0 WSST} - {3368354400 50400 1 WSDT} - {3384684000 46800 0 WSST} - {3399804000 50400 1 WSDT} - {3416133600 46800 0 WSST} - {3431253600 50400 1 WSDT} - {3447583200 46800 0 WSST} - {3462703200 50400 1 WSDT} - {3479637600 46800 0 WSST} - {3494757600 50400 1 WSDT} - {3511087200 46800 0 WSST} - {3526207200 50400 1 WSDT} - {3542536800 46800 0 WSST} - {3557656800 50400 1 WSDT} - {3573986400 46800 0 WSST} - {3589106400 50400 1 WSDT} - {3605436000 46800 0 WSST} - {3620556000 50400 1 WSDT} - {3636885600 46800 0 WSST} - {3652610400 50400 1 WSDT} - {3668940000 46800 0 WSST} - {3684060000 50400 1 WSDT} - {3700389600 46800 0 WSST} - {3715509600 50400 1 WSDT} - {3731839200 46800 0 WSST} - {3746959200 50400 1 WSDT} - {3763288800 46800 0 WSST} - {3778408800 50400 1 WSDT} - {3794738400 46800 0 WSST} - {3809858400 50400 1 WSDT} - {3826188000 46800 0 WSST} - {3841912800 50400 1 WSDT} - {3858242400 46800 0 WSST} - {3873362400 50400 1 WSDT} - {3889692000 46800 0 WSST} - {3904812000 50400 1 WSDT} - {3921141600 46800 0 WSST} - {3936261600 50400 1 WSDT} - {3952591200 46800 0 WSST} - {3967711200 50400 1 WSDT} - {3984040800 46800 0 WSST} - {3999765600 50400 1 WSDT} - {4016095200 46800 0 WSST} - {4031215200 50400 1 WSDT} - {4047544800 46800 0 WSST} - {4062664800 50400 1 WSDT} - {4078994400 46800 0 WSST} - {4094114400 50400 1 WSDT} + {-1861878784 -41400 0 -1130} + {-631110600 -39600 0 -10} + {1285498800 -36000 1 -10} + {1301752800 -39600 0 -10} + {1316872800 -36000 1 -10} + {1325239200 50400 0 +14} + {1333202400 46800 0 +14} + {1348927200 50400 1 +14} + {1365256800 46800 0 +14} + {1380376800 50400 1 +14} + {1396706400 46800 0 +14} + {1411826400 50400 1 +14} + {1428156000 46800 0 +14} + {1443276000 50400 1 +14} + {1459605600 46800 0 +14} + {1474725600 50400 1 +14} + {1491055200 46800 0 +14} + {1506175200 50400 1 +14} + {1522504800 46800 0 +14} + {1538229600 50400 1 +14} + {1554559200 46800 0 +14} + {1569679200 50400 1 +14} + {1586008800 46800 0 +14} + {1601128800 50400 1 +14} + {1617458400 46800 0 +14} + {1632578400 50400 1 +14} + {1648908000 46800 0 +14} + {1664028000 50400 1 +14} + {1680357600 46800 0 +14} + {1695477600 50400 1 +14} + {1712412000 46800 0 +14} + {1727532000 50400 1 +14} + {1743861600 46800 0 +14} + {1758981600 50400 1 +14} + {1775311200 46800 0 +14} + {1790431200 50400 1 +14} + {1806760800 46800 0 +14} + {1821880800 50400 1 +14} + {1838210400 46800 0 +14} + {1853330400 50400 1 +14} + {1869660000 46800 0 +14} + {1885384800 50400 1 +14} + {1901714400 46800 0 +14} + {1916834400 50400 1 +14} + {1933164000 46800 0 +14} + {1948284000 50400 1 +14} + {1964613600 46800 0 +14} + {1979733600 50400 1 +14} + {1996063200 46800 0 +14} + {2011183200 50400 1 +14} + {2027512800 46800 0 +14} + {2042632800 50400 1 +14} + {2058962400 46800 0 +14} + {2074687200 50400 1 +14} + {2091016800 46800 0 +14} + {2106136800 50400 1 +14} + {2122466400 46800 0 +14} + {2137586400 50400 1 +14} + {2153916000 46800 0 +14} + {2169036000 50400 1 +14} + {2185365600 46800 0 +14} + {2200485600 50400 1 +14} + {2216815200 46800 0 +14} + {2232540000 50400 1 +14} + {2248869600 46800 0 +14} + {2263989600 50400 1 +14} + {2280319200 46800 0 +14} + {2295439200 50400 1 +14} + {2311768800 46800 0 +14} + {2326888800 50400 1 +14} + {2343218400 46800 0 +14} + {2358338400 50400 1 +14} + {2374668000 46800 0 +14} + {2389788000 50400 1 +14} + {2406117600 46800 0 +14} + {2421842400 50400 1 +14} + {2438172000 46800 0 +14} + {2453292000 50400 1 +14} + {2469621600 46800 0 +14} + {2484741600 50400 1 +14} + {2501071200 46800 0 +14} + {2516191200 50400 1 +14} + {2532520800 46800 0 +14} + {2547640800 50400 1 +14} + {2563970400 46800 0 +14} + {2579090400 50400 1 +14} + {2596024800 46800 0 +14} + {2611144800 50400 1 +14} + {2627474400 46800 0 +14} + {2642594400 50400 1 +14} + {2658924000 46800 0 +14} + {2674044000 50400 1 +14} + {2690373600 46800 0 +14} + {2705493600 50400 1 +14} + {2721823200 46800 0 +14} + {2736943200 50400 1 +14} + {2753272800 46800 0 +14} + {2768997600 50400 1 +14} + {2785327200 46800 0 +14} + {2800447200 50400 1 +14} + {2816776800 46800 0 +14} + {2831896800 50400 1 +14} + {2848226400 46800 0 +14} + {2863346400 50400 1 +14} + {2879676000 46800 0 +14} + {2894796000 50400 1 +14} + {2911125600 46800 0 +14} + {2926245600 50400 1 +14} + {2942575200 46800 0 +14} + {2958300000 50400 1 +14} + {2974629600 46800 0 +14} + {2989749600 50400 1 +14} + {3006079200 46800 0 +14} + {3021199200 50400 1 +14} + {3037528800 46800 0 +14} + {3052648800 50400 1 +14} + {3068978400 46800 0 +14} + {3084098400 50400 1 +14} + {3100428000 46800 0 +14} + {3116152800 50400 1 +14} + {3132482400 46800 0 +14} + {3147602400 50400 1 +14} + {3163932000 46800 0 +14} + {3179052000 50400 1 +14} + {3195381600 46800 0 +14} + {3210501600 50400 1 +14} + {3226831200 46800 0 +14} + {3241951200 50400 1 +14} + {3258280800 46800 0 +14} + {3273400800 50400 1 +14} + {3289730400 46800 0 +14} + {3305455200 50400 1 +14} + {3321784800 46800 0 +14} + {3336904800 50400 1 +14} + {3353234400 46800 0 +14} + {3368354400 50400 1 +14} + {3384684000 46800 0 +14} + {3399804000 50400 1 +14} + {3416133600 46800 0 +14} + {3431253600 50400 1 +14} + {3447583200 46800 0 +14} + {3462703200 50400 1 +14} + {3479637600 46800 0 +14} + {3494757600 50400 1 +14} + {3511087200 46800 0 +14} + {3526207200 50400 1 +14} + {3542536800 46800 0 +14} + {3557656800 50400 1 +14} + {3573986400 46800 0 +14} + {3589106400 50400 1 +14} + {3605436000 46800 0 +14} + {3620556000 50400 1 +14} + {3636885600 46800 0 +14} + {3652610400 50400 1 +14} + {3668940000 46800 0 +14} + {3684060000 50400 1 +14} + {3700389600 46800 0 +14} + {3715509600 50400 1 +14} + {3731839200 46800 0 +14} + {3746959200 50400 1 +14} + {3763288800 46800 0 +14} + {3778408800 50400 1 +14} + {3794738400 46800 0 +14} + {3809858400 50400 1 +14} + {3826188000 46800 0 +14} + {3841912800 50400 1 +14} + {3858242400 46800 0 +14} + {3873362400 50400 1 +14} + {3889692000 46800 0 +14} + {3904812000 50400 1 +14} + {3921141600 46800 0 +14} + {3936261600 50400 1 +14} + {3952591200 46800 0 +14} + {3967711200 50400 1 +14} + {3984040800 46800 0 +14} + {3999765600 50400 1 +14} + {4016095200 46800 0 +14} + {4031215200 50400 1 +14} + {4047544800 46800 0 +14} + {4062664800 50400 1 +14} + {4078994400 46800 0 +14} + {4094114400 50400 1 +14} } diff --git a/library/tzdata/Pacific/Bougainville b/library/tzdata/Pacific/Bougainville index 06996f9..3c00b29 100644 --- a/library/tzdata/Pacific/Bougainville +++ b/library/tzdata/Pacific/Bougainville @@ -3,8 +3,8 @@ set TZData(:Pacific/Bougainville) { {-9223372036854775808 37336 0 LMT} {-2840178136 35312 0 PMMT} - {-2366790512 36000 0 PGT} - {-868010400 32400 0 JST} - {-768906000 36000 0 PGT} - {1419696000 39600 0 BST} + {-2366790512 36000 0 +10} + {-868010400 32400 0 +09} + {-768906000 36000 0 +10} + {1419696000 39600 0 +11} } diff --git a/library/tzdata/Pacific/Chatham b/library/tzdata/Pacific/Chatham index 94a5512..5d39879 100644 --- a/library/tzdata/Pacific/Chatham +++ b/library/tzdata/Pacific/Chatham @@ -2,257 +2,257 @@ set TZData(:Pacific/Chatham) { {-9223372036854775808 44028 0 LMT} - {-3192437628 44100 0 CHAST} - {-757426500 45900 0 CHAST} - {152632800 49500 1 CHADT} - {162309600 45900 0 CHAST} - {183477600 49500 1 CHADT} - {194968800 45900 0 CHAST} - {215532000 49500 1 CHADT} - {226418400 45900 0 CHAST} - {246981600 49500 1 CHADT} - {257868000 45900 0 CHAST} - {278431200 49500 1 CHADT} - {289317600 45900 0 CHAST} - {309880800 49500 1 CHADT} - {320767200 45900 0 CHAST} - {341330400 49500 1 CHADT} - {352216800 45900 0 CHAST} - {372780000 49500 1 CHADT} - {384271200 45900 0 CHAST} - {404834400 49500 1 CHADT} - {415720800 45900 0 CHAST} - {436284000 49500 1 CHADT} - {447170400 45900 0 CHAST} - {467733600 49500 1 CHADT} - {478620000 45900 0 CHAST} - {499183200 49500 1 CHADT} - {510069600 45900 0 CHAST} - {530632800 49500 1 CHADT} - {541519200 45900 0 CHAST} - {562082400 49500 1 CHADT} - {573573600 45900 0 CHAST} - {594136800 49500 1 CHADT} - {605023200 45900 0 CHAST} - {623772000 49500 1 CHADT} - {637682400 45900 0 CHAST} - {655221600 49500 1 CHADT} - {669132000 45900 0 CHAST} - {686671200 49500 1 CHADT} - {700581600 45900 0 CHAST} - {718120800 49500 1 CHADT} - {732636000 45900 0 CHAST} - {749570400 49500 1 CHADT} - {764085600 45900 0 CHAST} - {781020000 49500 1 CHADT} - {795535200 45900 0 CHAST} - {812469600 49500 1 CHADT} - {826984800 45900 0 CHAST} - {844524000 49500 1 CHADT} - {858434400 45900 0 CHAST} - {875973600 49500 1 CHADT} - {889884000 45900 0 CHAST} - {907423200 49500 1 CHADT} - {921938400 45900 0 CHAST} - {938872800 49500 1 CHADT} - {953388000 45900 0 CHAST} - {970322400 49500 1 CHADT} - {984837600 45900 0 CHAST} - {1002376800 49500 1 CHADT} - {1016287200 45900 0 CHAST} - {1033826400 49500 1 CHADT} - {1047736800 45900 0 CHAST} - {1065276000 49500 1 CHADT} - {1079791200 45900 0 CHAST} - {1096725600 49500 1 CHADT} - {1111240800 45900 0 CHAST} - {1128175200 49500 1 CHADT} - {1142690400 45900 0 CHAST} - {1159624800 49500 1 CHADT} - {1174140000 45900 0 CHAST} - {1191074400 49500 1 CHADT} - {1207404000 45900 0 CHAST} - {1222524000 49500 1 CHADT} - {1238853600 45900 0 CHAST} - {1253973600 49500 1 CHADT} - {1270303200 45900 0 CHAST} - {1285423200 49500 1 CHADT} - {1301752800 45900 0 CHAST} - {1316872800 49500 1 CHADT} - {1333202400 45900 0 CHAST} - {1348927200 49500 1 CHADT} - {1365256800 45900 0 CHAST} - {1380376800 49500 1 CHADT} - {1396706400 45900 0 CHAST} - {1411826400 49500 1 CHADT} - {1428156000 45900 0 CHAST} - {1443276000 49500 1 CHADT} - {1459605600 45900 0 CHAST} - {1474725600 49500 1 CHADT} - {1491055200 45900 0 CHAST} - {1506175200 49500 1 CHADT} - {1522504800 45900 0 CHAST} - {1538229600 49500 1 CHADT} - {1554559200 45900 0 CHAST} - {1569679200 49500 1 CHADT} - {1586008800 45900 0 CHAST} - {1601128800 49500 1 CHADT} - {1617458400 45900 0 CHAST} - {1632578400 49500 1 CHADT} - {1648908000 45900 0 CHAST} - {1664028000 49500 1 CHADT} - {1680357600 45900 0 CHAST} - {1695477600 49500 1 CHADT} - {1712412000 45900 0 CHAST} - {1727532000 49500 1 CHADT} - {1743861600 45900 0 CHAST} - {1758981600 49500 1 CHADT} - {1775311200 45900 0 CHAST} - {1790431200 49500 1 CHADT} - {1806760800 45900 0 CHAST} - {1821880800 49500 1 CHADT} - {1838210400 45900 0 CHAST} - {1853330400 49500 1 CHADT} - {1869660000 45900 0 CHAST} - {1885384800 49500 1 CHADT} - {1901714400 45900 0 CHAST} - {1916834400 49500 1 CHADT} - {1933164000 45900 0 CHAST} - {1948284000 49500 1 CHADT} - {1964613600 45900 0 CHAST} - {1979733600 49500 1 CHADT} - {1996063200 45900 0 CHAST} - {2011183200 49500 1 CHADT} - {2027512800 45900 0 CHAST} - {2042632800 49500 1 CHADT} - {2058962400 45900 0 CHAST} - {2074687200 49500 1 CHADT} - {2091016800 45900 0 CHAST} - {2106136800 49500 1 CHADT} - {2122466400 45900 0 CHAST} - {2137586400 49500 1 CHADT} - {2153916000 45900 0 CHAST} - {2169036000 49500 1 CHADT} - {2185365600 45900 0 CHAST} - {2200485600 49500 1 CHADT} - {2216815200 45900 0 CHAST} - {2232540000 49500 1 CHADT} - {2248869600 45900 0 CHAST} - {2263989600 49500 1 CHADT} - {2280319200 45900 0 CHAST} - {2295439200 49500 1 CHADT} - {2311768800 45900 0 CHAST} - {2326888800 49500 1 CHADT} - {2343218400 45900 0 CHAST} - {2358338400 49500 1 CHADT} - {2374668000 45900 0 CHAST} - {2389788000 49500 1 CHADT} - {2406117600 45900 0 CHAST} - {2421842400 49500 1 CHADT} - {2438172000 45900 0 CHAST} - {2453292000 49500 1 CHADT} - {2469621600 45900 0 CHAST} - {2484741600 49500 1 CHADT} - {2501071200 45900 0 CHAST} - {2516191200 49500 1 CHADT} - {2532520800 45900 0 CHAST} - {2547640800 49500 1 CHADT} - {2563970400 45900 0 CHAST} - {2579090400 49500 1 CHADT} - {2596024800 45900 0 CHAST} - {2611144800 49500 1 CHADT} - {2627474400 45900 0 CHAST} - {2642594400 49500 1 CHADT} - {2658924000 45900 0 CHAST} - {2674044000 49500 1 CHADT} - {2690373600 45900 0 CHAST} - {2705493600 49500 1 CHADT} - {2721823200 45900 0 CHAST} - {2736943200 49500 1 CHADT} - {2753272800 45900 0 CHAST} - {2768997600 49500 1 CHADT} - {2785327200 45900 0 CHAST} - {2800447200 49500 1 CHADT} - {2816776800 45900 0 CHAST} - {2831896800 49500 1 CHADT} - {2848226400 45900 0 CHAST} - {2863346400 49500 1 CHADT} - {2879676000 45900 0 CHAST} - {2894796000 49500 1 CHADT} - {2911125600 45900 0 CHAST} - {2926245600 49500 1 CHADT} - {2942575200 45900 0 CHAST} - {2958300000 49500 1 CHADT} - {2974629600 45900 0 CHAST} - {2989749600 49500 1 CHADT} - {3006079200 45900 0 CHAST} - {3021199200 49500 1 CHADT} - {3037528800 45900 0 CHAST} - {3052648800 49500 1 CHADT} - {3068978400 45900 0 CHAST} - {3084098400 49500 1 CHADT} - {3100428000 45900 0 CHAST} - {3116152800 49500 1 CHADT} - {3132482400 45900 0 CHAST} - {3147602400 49500 1 CHADT} - {3163932000 45900 0 CHAST} - {3179052000 49500 1 CHADT} - {3195381600 45900 0 CHAST} - {3210501600 49500 1 CHADT} - {3226831200 45900 0 CHAST} - {3241951200 49500 1 CHADT} - {3258280800 45900 0 CHAST} - {3273400800 49500 1 CHADT} - {3289730400 45900 0 CHAST} - {3305455200 49500 1 CHADT} - {3321784800 45900 0 CHAST} - {3336904800 49500 1 CHADT} - {3353234400 45900 0 CHAST} - {3368354400 49500 1 CHADT} - {3384684000 45900 0 CHAST} - {3399804000 49500 1 CHADT} - {3416133600 45900 0 CHAST} - {3431253600 49500 1 CHADT} - {3447583200 45900 0 CHAST} - {3462703200 49500 1 CHADT} - {3479637600 45900 0 CHAST} - {3494757600 49500 1 CHADT} - {3511087200 45900 0 CHAST} - {3526207200 49500 1 CHADT} - {3542536800 45900 0 CHAST} - {3557656800 49500 1 CHADT} - {3573986400 45900 0 CHAST} - {3589106400 49500 1 CHADT} - {3605436000 45900 0 CHAST} - {3620556000 49500 1 CHADT} - {3636885600 45900 0 CHAST} - {3652610400 49500 1 CHADT} - {3668940000 45900 0 CHAST} - {3684060000 49500 1 CHADT} - {3700389600 45900 0 CHAST} - {3715509600 49500 1 CHADT} - {3731839200 45900 0 CHAST} - {3746959200 49500 1 CHADT} - {3763288800 45900 0 CHAST} - {3778408800 49500 1 CHADT} - {3794738400 45900 0 CHAST} - {3809858400 49500 1 CHADT} - {3826188000 45900 0 CHAST} - {3841912800 49500 1 CHADT} - {3858242400 45900 0 CHAST} - {3873362400 49500 1 CHADT} - {3889692000 45900 0 CHAST} - {3904812000 49500 1 CHADT} - {3921141600 45900 0 CHAST} - {3936261600 49500 1 CHADT} - {3952591200 45900 0 CHAST} - {3967711200 49500 1 CHADT} - {3984040800 45900 0 CHAST} - {3999765600 49500 1 CHADT} - {4016095200 45900 0 CHAST} - {4031215200 49500 1 CHADT} - {4047544800 45900 0 CHAST} - {4062664800 49500 1 CHADT} - {4078994400 45900 0 CHAST} - {4094114400 49500 1 CHADT} + {-3192437628 44100 0 +1215} + {-757426500 45900 0 +1345} + {152632800 49500 1 +1345} + {162309600 45900 0 +1345} + {183477600 49500 1 +1345} + {194968800 45900 0 +1345} + {215532000 49500 1 +1345} + {226418400 45900 0 +1345} + {246981600 49500 1 +1345} + {257868000 45900 0 +1345} + {278431200 49500 1 +1345} + {289317600 45900 0 +1345} + {309880800 49500 1 +1345} + {320767200 45900 0 +1345} + {341330400 49500 1 +1345} + {352216800 45900 0 +1345} + {372780000 49500 1 +1345} + {384271200 45900 0 +1345} + {404834400 49500 1 +1345} + {415720800 45900 0 +1345} + {436284000 49500 1 +1345} + {447170400 45900 0 +1345} + {467733600 49500 1 +1345} + {478620000 45900 0 +1345} + {499183200 49500 1 +1345} + {510069600 45900 0 +1345} + {530632800 49500 1 +1345} + {541519200 45900 0 +1345} + {562082400 49500 1 +1345} + {573573600 45900 0 +1345} + {594136800 49500 1 +1345} + {605023200 45900 0 +1345} + {623772000 49500 1 +1345} + {637682400 45900 0 +1345} + {655221600 49500 1 +1345} + {669132000 45900 0 +1345} + {686671200 49500 1 +1345} + {700581600 45900 0 +1345} + {718120800 49500 1 +1345} + {732636000 45900 0 +1345} + {749570400 49500 1 +1345} + {764085600 45900 0 +1345} + {781020000 49500 1 +1345} + {795535200 45900 0 +1345} + {812469600 49500 1 +1345} + {826984800 45900 0 +1345} + {844524000 49500 1 +1345} + {858434400 45900 0 +1345} + {875973600 49500 1 +1345} + {889884000 45900 0 +1345} + {907423200 49500 1 +1345} + {921938400 45900 0 +1345} + {938872800 49500 1 +1345} + {953388000 45900 0 +1345} + {970322400 49500 1 +1345} + {984837600 45900 0 +1345} + {1002376800 49500 1 +1345} + {1016287200 45900 0 +1345} + {1033826400 49500 1 +1345} + {1047736800 45900 0 +1345} + {1065276000 49500 1 +1345} + {1079791200 45900 0 +1345} + {1096725600 49500 1 +1345} + {1111240800 45900 0 +1345} + {1128175200 49500 1 +1345} + {1142690400 45900 0 +1345} + {1159624800 49500 1 +1345} + {1174140000 45900 0 +1345} + {1191074400 49500 1 +1345} + {1207404000 45900 0 +1345} + {1222524000 49500 1 +1345} + {1238853600 45900 0 +1345} + {1253973600 49500 1 +1345} + {1270303200 45900 0 +1345} + {1285423200 49500 1 +1345} + {1301752800 45900 0 +1345} + {1316872800 49500 1 +1345} + {1333202400 45900 0 +1345} + {1348927200 49500 1 +1345} + {1365256800 45900 0 +1345} + {1380376800 49500 1 +1345} + {1396706400 45900 0 +1345} + {1411826400 49500 1 +1345} + {1428156000 45900 0 +1345} + {1443276000 49500 1 +1345} + {1459605600 45900 0 +1345} + {1474725600 49500 1 +1345} + {1491055200 45900 0 +1345} + {1506175200 49500 1 +1345} + {1522504800 45900 0 +1345} + {1538229600 49500 1 +1345} + {1554559200 45900 0 +1345} + {1569679200 49500 1 +1345} + {1586008800 45900 0 +1345} + {1601128800 49500 1 +1345} + {1617458400 45900 0 +1345} + {1632578400 49500 1 +1345} + {1648908000 45900 0 +1345} + {1664028000 49500 1 +1345} + {1680357600 45900 0 +1345} + {1695477600 49500 1 +1345} + {1712412000 45900 0 +1345} + {1727532000 49500 1 +1345} + {1743861600 45900 0 +1345} + {1758981600 49500 1 +1345} + {1775311200 45900 0 +1345} + {1790431200 49500 1 +1345} + {1806760800 45900 0 +1345} + {1821880800 49500 1 +1345} + {1838210400 45900 0 +1345} + {1853330400 49500 1 +1345} + {1869660000 45900 0 +1345} + {1885384800 49500 1 +1345} + {1901714400 45900 0 +1345} + {1916834400 49500 1 +1345} + {1933164000 45900 0 +1345} + {1948284000 49500 1 +1345} + {1964613600 45900 0 +1345} + {1979733600 49500 1 +1345} + {1996063200 45900 0 +1345} + {2011183200 49500 1 +1345} + {2027512800 45900 0 +1345} + {2042632800 49500 1 +1345} + {2058962400 45900 0 +1345} + {2074687200 49500 1 +1345} + {2091016800 45900 0 +1345} + {2106136800 49500 1 +1345} + {2122466400 45900 0 +1345} + {2137586400 49500 1 +1345} + {2153916000 45900 0 +1345} + {2169036000 49500 1 +1345} + {2185365600 45900 0 +1345} + {2200485600 49500 1 +1345} + {2216815200 45900 0 +1345} + {2232540000 49500 1 +1345} + {2248869600 45900 0 +1345} + {2263989600 49500 1 +1345} + {2280319200 45900 0 +1345} + {2295439200 49500 1 +1345} + {2311768800 45900 0 +1345} + {2326888800 49500 1 +1345} + {2343218400 45900 0 +1345} + {2358338400 49500 1 +1345} + {2374668000 45900 0 +1345} + {2389788000 49500 1 +1345} + {2406117600 45900 0 +1345} + {2421842400 49500 1 +1345} + {2438172000 45900 0 +1345} + {2453292000 49500 1 +1345} + {2469621600 45900 0 +1345} + {2484741600 49500 1 +1345} + {2501071200 45900 0 +1345} + {2516191200 49500 1 +1345} + {2532520800 45900 0 +1345} + {2547640800 49500 1 +1345} + {2563970400 45900 0 +1345} + {2579090400 49500 1 +1345} + {2596024800 45900 0 +1345} + {2611144800 49500 1 +1345} + {2627474400 45900 0 +1345} + {2642594400 49500 1 +1345} + {2658924000 45900 0 +1345} + {2674044000 49500 1 +1345} + {2690373600 45900 0 +1345} + {2705493600 49500 1 +1345} + {2721823200 45900 0 +1345} + {2736943200 49500 1 +1345} + {2753272800 45900 0 +1345} + {2768997600 49500 1 +1345} + {2785327200 45900 0 +1345} + {2800447200 49500 1 +1345} + {2816776800 45900 0 +1345} + {2831896800 49500 1 +1345} + {2848226400 45900 0 +1345} + {2863346400 49500 1 +1345} + {2879676000 45900 0 +1345} + {2894796000 49500 1 +1345} + {2911125600 45900 0 +1345} + {2926245600 49500 1 +1345} + {2942575200 45900 0 +1345} + {2958300000 49500 1 +1345} + {2974629600 45900 0 +1345} + {2989749600 49500 1 +1345} + {3006079200 45900 0 +1345} + {3021199200 49500 1 +1345} + {3037528800 45900 0 +1345} + {3052648800 49500 1 +1345} + {3068978400 45900 0 +1345} + {3084098400 49500 1 +1345} + {3100428000 45900 0 +1345} + {3116152800 49500 1 +1345} + {3132482400 45900 0 +1345} + {3147602400 49500 1 +1345} + {3163932000 45900 0 +1345} + {3179052000 49500 1 +1345} + {3195381600 45900 0 +1345} + {3210501600 49500 1 +1345} + {3226831200 45900 0 +1345} + {3241951200 49500 1 +1345} + {3258280800 45900 0 +1345} + {3273400800 49500 1 +1345} + {3289730400 45900 0 +1345} + {3305455200 49500 1 +1345} + {3321784800 45900 0 +1345} + {3336904800 49500 1 +1345} + {3353234400 45900 0 +1345} + {3368354400 49500 1 +1345} + {3384684000 45900 0 +1345} + {3399804000 49500 1 +1345} + {3416133600 45900 0 +1345} + {3431253600 49500 1 +1345} + {3447583200 45900 0 +1345} + {3462703200 49500 1 +1345} + {3479637600 45900 0 +1345} + {3494757600 49500 1 +1345} + {3511087200 45900 0 +1345} + {3526207200 49500 1 +1345} + {3542536800 45900 0 +1345} + {3557656800 49500 1 +1345} + {3573986400 45900 0 +1345} + {3589106400 49500 1 +1345} + {3605436000 45900 0 +1345} + {3620556000 49500 1 +1345} + {3636885600 45900 0 +1345} + {3652610400 49500 1 +1345} + {3668940000 45900 0 +1345} + {3684060000 49500 1 +1345} + {3700389600 45900 0 +1345} + {3715509600 49500 1 +1345} + {3731839200 45900 0 +1345} + {3746959200 49500 1 +1345} + {3763288800 45900 0 +1345} + {3778408800 49500 1 +1345} + {3794738400 45900 0 +1345} + {3809858400 49500 1 +1345} + {3826188000 45900 0 +1345} + {3841912800 49500 1 +1345} + {3858242400 45900 0 +1345} + {3873362400 49500 1 +1345} + {3889692000 45900 0 +1345} + {3904812000 49500 1 +1345} + {3921141600 45900 0 +1345} + {3936261600 49500 1 +1345} + {3952591200 45900 0 +1345} + {3967711200 49500 1 +1345} + {3984040800 45900 0 +1345} + {3999765600 49500 1 +1345} + {4016095200 45900 0 +1345} + {4031215200 49500 1 +1345} + {4047544800 45900 0 +1345} + {4062664800 49500 1 +1345} + {4078994400 45900 0 +1345} + {4094114400 49500 1 +1345} } diff --git a/library/tzdata/Pacific/Chuuk b/library/tzdata/Pacific/Chuuk index 70b14b2..4e9d099 100644 --- a/library/tzdata/Pacific/Chuuk +++ b/library/tzdata/Pacific/Chuuk @@ -2,5 +2,5 @@ set TZData(:Pacific/Chuuk) { {-9223372036854775808 36428 0 LMT} - {-2177489228 36000 0 CHUT} + {-2177489228 36000 0 +10} } diff --git a/library/tzdata/Pacific/Easter b/library/tzdata/Pacific/Easter index ef0f2d5..474a32b 100644 --- a/library/tzdata/Pacific/Easter +++ b/library/tzdata/Pacific/Easter @@ -3,266 +3,266 @@ set TZData(:Pacific/Easter) { {-9223372036854775808 -26248 0 LMT} {-2524495352 -26248 0 EMT} - {-1178124152 -25200 0 EAST} - {-36619200 -21600 1 EASST} - {-23922000 -25200 0 EAST} - {-3355200 -21600 1 EASST} - {7527600 -25200 0 EAST} - {24465600 -21600 1 EASST} - {37767600 -25200 0 EAST} - {55915200 -21600 1 EASST} - {69217200 -25200 0 EAST} - {87969600 -21600 1 EASST} - {100666800 -25200 0 EAST} - {118209600 -21600 1 EASST} - {132116400 -25200 0 EAST} - {150868800 -21600 1 EASST} - {163566000 -25200 0 EAST} - {182318400 -21600 1 EASST} - {195620400 -25200 0 EAST} - {213768000 -21600 1 EASST} - {227070000 -25200 0 EAST} - {245217600 -21600 1 EASST} - {258519600 -25200 0 EAST} - {277272000 -21600 1 EASST} - {289969200 -25200 0 EAST} - {308721600 -21600 1 EASST} - {321418800 -25200 0 EAST} - {340171200 -21600 1 EASST} - {353473200 -25200 0 EAST} - {371620800 -21600 1 EASST} - {384922800 -21600 0 EAST} - {403070400 -18000 1 EASST} - {416372400 -21600 0 EAST} - {434520000 -18000 1 EASST} - {447822000 -21600 0 EAST} - {466574400 -18000 1 EASST} - {479271600 -21600 0 EAST} - {498024000 -18000 1 EASST} - {510721200 -21600 0 EAST} - {529473600 -18000 1 EASST} - {545194800 -21600 0 EAST} - {560923200 -18000 1 EASST} - {574225200 -21600 0 EAST} - {592372800 -18000 1 EASST} - {605674800 -21600 0 EAST} - {624427200 -18000 1 EASST} - {637124400 -21600 0 EAST} - {653457600 -18000 1 EASST} - {668574000 -21600 0 EAST} - {687326400 -18000 1 EASST} - {700628400 -21600 0 EAST} - {718776000 -18000 1 EASST} - {732078000 -21600 0 EAST} - {750225600 -18000 1 EASST} - {763527600 -21600 0 EAST} - {781675200 -18000 1 EASST} - {794977200 -21600 0 EAST} - {813729600 -18000 1 EASST} - {826426800 -21600 0 EAST} - {845179200 -18000 1 EASST} - {859690800 -21600 0 EAST} - {876628800 -18000 1 EASST} - {889930800 -21600 0 EAST} - {906868800 -18000 1 EASST} - {923194800 -21600 0 EAST} - {939528000 -18000 1 EASST} - {952830000 -21600 0 EAST} - {971582400 -18000 1 EASST} - {984279600 -21600 0 EAST} - {1003032000 -18000 1 EASST} - {1015729200 -21600 0 EAST} - {1034481600 -18000 1 EASST} - {1047178800 -21600 0 EAST} - {1065931200 -18000 1 EASST} - {1079233200 -21600 0 EAST} - {1097380800 -18000 1 EASST} - {1110682800 -21600 0 EAST} - {1128830400 -18000 1 EASST} - {1142132400 -21600 0 EAST} - {1160884800 -18000 1 EASST} - {1173582000 -21600 0 EAST} - {1192334400 -18000 1 EASST} - {1206846000 -21600 0 EAST} - {1223784000 -18000 1 EASST} - {1237086000 -21600 0 EAST} - {1255233600 -18000 1 EASST} - {1270350000 -21600 0 EAST} - {1286683200 -18000 1 EASST} - {1304823600 -21600 0 EAST} - {1313899200 -18000 1 EASST} - {1335668400 -21600 0 EAST} - {1346558400 -18000 1 EASST} - {1367118000 -21600 0 EAST} - {1378612800 -18000 1 EASST} - {1398567600 -21600 0 EAST} - {1410062400 -18000 1 EASST} - {1463281200 -21600 0 EAST} - {1471147200 -18000 1 EASST} - {1494730800 -21600 0 EAST} - {1502596800 -18000 1 EASST} - {1526180400 -21600 0 EAST} - {1534046400 -18000 1 EASST} - {1557630000 -21600 0 EAST} - {1565496000 -18000 1 EASST} - {1589079600 -21600 0 EAST} - {1596945600 -18000 1 EASST} - {1620529200 -21600 0 EAST} - {1629000000 -18000 1 EASST} - {1652583600 -21600 0 EAST} - {1660449600 -18000 1 EASST} - {1684033200 -21600 0 EAST} - {1691899200 -18000 1 EASST} - {1715482800 -21600 0 EAST} - {1723348800 -18000 1 EASST} - {1746932400 -21600 0 EAST} - {1754798400 -18000 1 EASST} - {1778382000 -21600 0 EAST} - {1786248000 -18000 1 EASST} - {1809831600 -21600 0 EAST} - {1818302400 -18000 1 EASST} - {1841886000 -21600 0 EAST} - {1849752000 -18000 1 EASST} - {1873335600 -21600 0 EAST} - {1881201600 -18000 1 EASST} - {1904785200 -21600 0 EAST} - {1912651200 -18000 1 EASST} - {1936234800 -21600 0 EAST} - {1944100800 -18000 1 EASST} - {1967684400 -21600 0 EAST} - {1976155200 -18000 1 EASST} - {1999738800 -21600 0 EAST} - {2007604800 -18000 1 EASST} - {2031188400 -21600 0 EAST} - {2039054400 -18000 1 EASST} - {2062638000 -21600 0 EAST} - {2070504000 -18000 1 EASST} - {2094087600 -21600 0 EAST} - {2101953600 -18000 1 EASST} - {2125537200 -21600 0 EAST} - {2133403200 -18000 1 EASST} - {2156986800 -21600 0 EAST} - {2165457600 -18000 1 EASST} - {2189041200 -21600 0 EAST} - {2196907200 -18000 1 EASST} - {2220490800 -21600 0 EAST} - {2228356800 -18000 1 EASST} - {2251940400 -21600 0 EAST} - {2259806400 -18000 1 EASST} - {2283390000 -21600 0 EAST} - {2291256000 -18000 1 EASST} - {2314839600 -21600 0 EAST} - {2322705600 -18000 1 EASST} - {2346894000 -21600 0 EAST} - {2354760000 -18000 1 EASST} - {2378343600 -21600 0 EAST} - {2386209600 -18000 1 EASST} - {2409793200 -21600 0 EAST} - {2417659200 -18000 1 EASST} - {2441242800 -21600 0 EAST} - {2449108800 -18000 1 EASST} - {2472692400 -21600 0 EAST} - {2480558400 -18000 1 EASST} - {2504142000 -21600 0 EAST} - {2512612800 -18000 1 EASST} - {2536196400 -21600 0 EAST} - {2544062400 -18000 1 EASST} - {2567646000 -21600 0 EAST} - {2575512000 -18000 1 EASST} - {2599095600 -21600 0 EAST} - {2606961600 -18000 1 EASST} - {2630545200 -21600 0 EAST} - {2638411200 -18000 1 EASST} - {2661994800 -21600 0 EAST} - {2669860800 -18000 1 EASST} - {2693444400 -21600 0 EAST} - {2701915200 -18000 1 EASST} - {2725498800 -21600 0 EAST} - {2733364800 -18000 1 EASST} - {2756948400 -21600 0 EAST} - {2764814400 -18000 1 EASST} - {2788398000 -21600 0 EAST} - {2796264000 -18000 1 EASST} - {2819847600 -21600 0 EAST} - {2827713600 -18000 1 EASST} - {2851297200 -21600 0 EAST} - {2859768000 -18000 1 EASST} - {2883351600 -21600 0 EAST} - {2891217600 -18000 1 EASST} - {2914801200 -21600 0 EAST} - {2922667200 -18000 1 EASST} - {2946250800 -21600 0 EAST} - {2954116800 -18000 1 EASST} - {2977700400 -21600 0 EAST} - {2985566400 -18000 1 EASST} - {3009150000 -21600 0 EAST} - {3017016000 -18000 1 EASST} - {3040599600 -21600 0 EAST} - {3049070400 -18000 1 EASST} - {3072654000 -21600 0 EAST} - {3080520000 -18000 1 EASST} - {3104103600 -21600 0 EAST} - {3111969600 -18000 1 EASST} - {3135553200 -21600 0 EAST} - {3143419200 -18000 1 EASST} - {3167002800 -21600 0 EAST} - {3174868800 -18000 1 EASST} - {3198452400 -21600 0 EAST} - {3206318400 -18000 1 EASST} - {3230506800 -21600 0 EAST} - {3238372800 -18000 1 EASST} - {3261956400 -21600 0 EAST} - {3269822400 -18000 1 EASST} - {3293406000 -21600 0 EAST} - {3301272000 -18000 1 EASST} - {3324855600 -21600 0 EAST} - {3332721600 -18000 1 EASST} - {3356305200 -21600 0 EAST} - {3364171200 -18000 1 EASST} - {3387754800 -21600 0 EAST} - {3396225600 -18000 1 EASST} - {3419809200 -21600 0 EAST} - {3427675200 -18000 1 EASST} - {3451258800 -21600 0 EAST} - {3459124800 -18000 1 EASST} - {3482708400 -21600 0 EAST} - {3490574400 -18000 1 EASST} - {3514158000 -21600 0 EAST} - {3522024000 -18000 1 EASST} - {3545607600 -21600 0 EAST} - {3553473600 -18000 1 EASST} - {3577057200 -21600 0 EAST} - {3585528000 -18000 1 EASST} - {3609111600 -21600 0 EAST} - {3616977600 -18000 1 EASST} - {3640561200 -21600 0 EAST} - {3648427200 -18000 1 EASST} - {3672010800 -21600 0 EAST} - {3679876800 -18000 1 EASST} - {3703460400 -21600 0 EAST} - {3711326400 -18000 1 EASST} - {3734910000 -21600 0 EAST} - {3743380800 -18000 1 EASST} - {3766964400 -21600 0 EAST} - {3774830400 -18000 1 EASST} - {3798414000 -21600 0 EAST} - {3806280000 -18000 1 EASST} - {3829863600 -21600 0 EAST} - {3837729600 -18000 1 EASST} - {3861313200 -21600 0 EAST} - {3869179200 -18000 1 EASST} - {3892762800 -21600 0 EAST} - {3900628800 -18000 1 EASST} - {3924212400 -21600 0 EAST} - {3932683200 -18000 1 EASST} - {3956266800 -21600 0 EAST} - {3964132800 -18000 1 EASST} - {3987716400 -21600 0 EAST} - {3995582400 -18000 1 EASST} - {4019166000 -21600 0 EAST} - {4027032000 -18000 1 EASST} - {4050615600 -21600 0 EAST} - {4058481600 -18000 1 EASST} - {4082065200 -21600 0 EAST} - {4089931200 -18000 1 EASST} + {-1178124152 -25200 0 -07} + {-36619200 -21600 1 -06} + {-23922000 -25200 0 -07} + {-3355200 -21600 1 -06} + {7527600 -25200 0 -07} + {24465600 -21600 1 -06} + {37767600 -25200 0 -07} + {55915200 -21600 1 -06} + {69217200 -25200 0 -07} + {87969600 -21600 1 -06} + {100666800 -25200 0 -07} + {118209600 -21600 1 -06} + {132116400 -25200 0 -07} + {150868800 -21600 1 -06} + {163566000 -25200 0 -07} + {182318400 -21600 1 -06} + {195620400 -25200 0 -07} + {213768000 -21600 1 -06} + {227070000 -25200 0 -07} + {245217600 -21600 1 -06} + {258519600 -25200 0 -07} + {277272000 -21600 1 -06} + {289969200 -25200 0 -07} + {308721600 -21600 1 -06} + {321418800 -25200 0 -07} + {340171200 -21600 1 -06} + {353473200 -25200 0 -07} + {371620800 -21600 1 -06} + {384922800 -21600 0 -06} + {403070400 -18000 1 -05} + {416372400 -21600 0 -06} + {434520000 -18000 1 -05} + {447822000 -21600 0 -06} + {466574400 -18000 1 -05} + {479271600 -21600 0 -06} + {498024000 -18000 1 -05} + {510721200 -21600 0 -06} + {529473600 -18000 1 -05} + {545194800 -21600 0 -06} + {560923200 -18000 1 -05} + {574225200 -21600 0 -06} + {592372800 -18000 1 -05} + {605674800 -21600 0 -06} + {624427200 -18000 1 -05} + {637124400 -21600 0 -06} + {653457600 -18000 1 -05} + {668574000 -21600 0 -06} + {687326400 -18000 1 -05} + {700628400 -21600 0 -06} + {718776000 -18000 1 -05} + {732078000 -21600 0 -06} + {750225600 -18000 1 -05} + {763527600 -21600 0 -06} + {781675200 -18000 1 -05} + {794977200 -21600 0 -06} + {813729600 -18000 1 -05} + {826426800 -21600 0 -06} + {845179200 -18000 1 -05} + {859690800 -21600 0 -06} + {876628800 -18000 1 -05} + {889930800 -21600 0 -06} + {906868800 -18000 1 -05} + {923194800 -21600 0 -06} + {939528000 -18000 1 -05} + {952830000 -21600 0 -06} + {971582400 -18000 1 -05} + {984279600 -21600 0 -06} + {1003032000 -18000 1 -05} + {1015729200 -21600 0 -06} + {1034481600 -18000 1 -05} + {1047178800 -21600 0 -06} + {1065931200 -18000 1 -05} + {1079233200 -21600 0 -06} + {1097380800 -18000 1 -05} + {1110682800 -21600 0 -06} + {1128830400 -18000 1 -05} + {1142132400 -21600 0 -06} + {1160884800 -18000 1 -05} + {1173582000 -21600 0 -06} + {1192334400 -18000 1 -05} + {1206846000 -21600 0 -06} + {1223784000 -18000 1 -05} + {1237086000 -21600 0 -06} + {1255233600 -18000 1 -05} + {1270350000 -21600 0 -06} + {1286683200 -18000 1 -05} + {1304823600 -21600 0 -06} + {1313899200 -18000 1 -05} + {1335668400 -21600 0 -06} + {1346558400 -18000 1 -05} + {1367118000 -21600 0 -06} + {1378612800 -18000 1 -05} + {1398567600 -21600 0 -06} + {1410062400 -18000 1 -05} + {1463281200 -21600 0 -06} + {1471147200 -18000 1 -05} + {1494730800 -21600 0 -06} + {1502596800 -18000 1 -05} + {1526180400 -21600 0 -06} + {1534046400 -18000 1 -05} + {1557630000 -21600 0 -06} + {1565496000 -18000 1 -05} + {1589079600 -21600 0 -06} + {1596945600 -18000 1 -05} + {1620529200 -21600 0 -06} + {1629000000 -18000 1 -05} + {1652583600 -21600 0 -06} + {1660449600 -18000 1 -05} + {1684033200 -21600 0 -06} + {1691899200 -18000 1 -05} + {1715482800 -21600 0 -06} + {1723348800 -18000 1 -05} + {1746932400 -21600 0 -06} + {1754798400 -18000 1 -05} + {1778382000 -21600 0 -06} + {1786248000 -18000 1 -05} + {1809831600 -21600 0 -06} + {1818302400 -18000 1 -05} + {1841886000 -21600 0 -06} + {1849752000 -18000 1 -05} + {1873335600 -21600 0 -06} + {1881201600 -18000 1 -05} + {1904785200 -21600 0 -06} + {1912651200 -18000 1 -05} + {1936234800 -21600 0 -06} + {1944100800 -18000 1 -05} + {1967684400 -21600 0 -06} + {1976155200 -18000 1 -05} + {1999738800 -21600 0 -06} + {2007604800 -18000 1 -05} + {2031188400 -21600 0 -06} + {2039054400 -18000 1 -05} + {2062638000 -21600 0 -06} + {2070504000 -18000 1 -05} + {2094087600 -21600 0 -06} + {2101953600 -18000 1 -05} + {2125537200 -21600 0 -06} + {2133403200 -18000 1 -05} + {2156986800 -21600 0 -06} + {2165457600 -18000 1 -05} + {2189041200 -21600 0 -06} + {2196907200 -18000 1 -05} + {2220490800 -21600 0 -06} + {2228356800 -18000 1 -05} + {2251940400 -21600 0 -06} + {2259806400 -18000 1 -05} + {2283390000 -21600 0 -06} + {2291256000 -18000 1 -05} + {2314839600 -21600 0 -06} + {2322705600 -18000 1 -05} + {2346894000 -21600 0 -06} + {2354760000 -18000 1 -05} + {2378343600 -21600 0 -06} + {2386209600 -18000 1 -05} + {2409793200 -21600 0 -06} + {2417659200 -18000 1 -05} + {2441242800 -21600 0 -06} + {2449108800 -18000 1 -05} + {2472692400 -21600 0 -06} + {2480558400 -18000 1 -05} + {2504142000 -21600 0 -06} + {2512612800 -18000 1 -05} + {2536196400 -21600 0 -06} + {2544062400 -18000 1 -05} + {2567646000 -21600 0 -06} + {2575512000 -18000 1 -05} + {2599095600 -21600 0 -06} + {2606961600 -18000 1 -05} + {2630545200 -21600 0 -06} + {2638411200 -18000 1 -05} + {2661994800 -21600 0 -06} + {2669860800 -18000 1 -05} + {2693444400 -21600 0 -06} + {2701915200 -18000 1 -05} + {2725498800 -21600 0 -06} + {2733364800 -18000 1 -05} + {2756948400 -21600 0 -06} + {2764814400 -18000 1 -05} + {2788398000 -21600 0 -06} + {2796264000 -18000 1 -05} + {2819847600 -21600 0 -06} + {2827713600 -18000 1 -05} + {2851297200 -21600 0 -06} + {2859768000 -18000 1 -05} + {2883351600 -21600 0 -06} + {2891217600 -18000 1 -05} + {2914801200 -21600 0 -06} + {2922667200 -18000 1 -05} + {2946250800 -21600 0 -06} + {2954116800 -18000 1 -05} + {2977700400 -21600 0 -06} + {2985566400 -18000 1 -05} + {3009150000 -21600 0 -06} + {3017016000 -18000 1 -05} + {3040599600 -21600 0 -06} + {3049070400 -18000 1 -05} + {3072654000 -21600 0 -06} + {3080520000 -18000 1 -05} + {3104103600 -21600 0 -06} + {3111969600 -18000 1 -05} + {3135553200 -21600 0 -06} + {3143419200 -18000 1 -05} + {3167002800 -21600 0 -06} + {3174868800 -18000 1 -05} + {3198452400 -21600 0 -06} + {3206318400 -18000 1 -05} + {3230506800 -21600 0 -06} + {3238372800 -18000 1 -05} + {3261956400 -21600 0 -06} + {3269822400 -18000 1 -05} + {3293406000 -21600 0 -06} + {3301272000 -18000 1 -05} + {3324855600 -21600 0 -06} + {3332721600 -18000 1 -05} + {3356305200 -21600 0 -06} + {3364171200 -18000 1 -05} + {3387754800 -21600 0 -06} + {3396225600 -18000 1 -05} + {3419809200 -21600 0 -06} + {3427675200 -18000 1 -05} + {3451258800 -21600 0 -06} + {3459124800 -18000 1 -05} + {3482708400 -21600 0 -06} + {3490574400 -18000 1 -05} + {3514158000 -21600 0 -06} + {3522024000 -18000 1 -05} + {3545607600 -21600 0 -06} + {3553473600 -18000 1 -05} + {3577057200 -21600 0 -06} + {3585528000 -18000 1 -05} + {3609111600 -21600 0 -06} + {3616977600 -18000 1 -05} + {3640561200 -21600 0 -06} + {3648427200 -18000 1 -05} + {3672010800 -21600 0 -06} + {3679876800 -18000 1 -05} + {3703460400 -21600 0 -06} + {3711326400 -18000 1 -05} + {3734910000 -21600 0 -06} + {3743380800 -18000 1 -05} + {3766964400 -21600 0 -06} + {3774830400 -18000 1 -05} + {3798414000 -21600 0 -06} + {3806280000 -18000 1 -05} + {3829863600 -21600 0 -06} + {3837729600 -18000 1 -05} + {3861313200 -21600 0 -06} + {3869179200 -18000 1 -05} + {3892762800 -21600 0 -06} + {3900628800 -18000 1 -05} + {3924212400 -21600 0 -06} + {3932683200 -18000 1 -05} + {3956266800 -21600 0 -06} + {3964132800 -18000 1 -05} + {3987716400 -21600 0 -06} + {3995582400 -18000 1 -05} + {4019166000 -21600 0 -06} + {4027032000 -18000 1 -05} + {4050615600 -21600 0 -06} + {4058481600 -18000 1 -05} + {4082065200 -21600 0 -06} + {4089931200 -18000 1 -05} } diff --git a/library/tzdata/Pacific/Efate b/library/tzdata/Pacific/Efate index 18db6de..a43852e 100644 --- a/library/tzdata/Pacific/Efate +++ b/library/tzdata/Pacific/Efate @@ -2,25 +2,25 @@ set TZData(:Pacific/Efate) { {-9223372036854775808 40396 0 LMT} - {-1829387596 39600 0 VUT} - {433256400 43200 1 VUST} - {448977600 39600 0 VUT} - {467298000 43200 1 VUST} - {480427200 39600 0 VUT} - {496760400 43200 1 VUST} - {511876800 39600 0 VUT} - {528210000 43200 1 VUST} - {543931200 39600 0 VUT} - {559659600 43200 1 VUST} - {575380800 39600 0 VUT} - {591109200 43200 1 VUST} - {606830400 39600 0 VUT} - {622558800 43200 1 VUST} - {638280000 39600 0 VUT} - {654008400 43200 1 VUST} - {669729600 39600 0 VUT} - {686062800 43200 1 VUST} - {696340800 39600 0 VUT} - {719931600 43200 1 VUST} - {727790400 39600 0 VUT} + {-1829387596 39600 0 +11} + {433256400 43200 1 +12} + {448977600 39600 0 +11} + {467298000 43200 1 +12} + {480427200 39600 0 +11} + {496760400 43200 1 +12} + {511876800 39600 0 +11} + {528210000 43200 1 +12} + {543931200 39600 0 +11} + {559659600 43200 1 +12} + {575380800 39600 0 +11} + {591109200 43200 1 +12} + {606830400 39600 0 +11} + {622558800 43200 1 +12} + {638280000 39600 0 +11} + {654008400 43200 1 +12} + {669729600 39600 0 +11} + {686062800 43200 1 +12} + {696340800 39600 0 +11} + {719931600 43200 1 +12} + {727790400 39600 0 +11} } diff --git a/library/tzdata/Pacific/Enderbury b/library/tzdata/Pacific/Enderbury index 55784c4..6abd57e 100644 --- a/library/tzdata/Pacific/Enderbury +++ b/library/tzdata/Pacific/Enderbury @@ -2,7 +2,7 @@ set TZData(:Pacific/Enderbury) { {-9223372036854775808 -41060 0 LMT} - {-2177411740 -43200 0 PHOT} - {307627200 -39600 0 PHOT} - {788958000 46800 0 PHOT} + {-2177411740 -43200 0 -12} + {307627200 -39600 0 -11} + {788958000 46800 0 +13} } diff --git a/library/tzdata/Pacific/Fakaofo b/library/tzdata/Pacific/Fakaofo index 6ec98eb..d75030d 100644 --- a/library/tzdata/Pacific/Fakaofo +++ b/library/tzdata/Pacific/Fakaofo @@ -2,6 +2,6 @@ set TZData(:Pacific/Fakaofo) { {-9223372036854775808 -41096 0 LMT} - {-2177411704 -39600 0 TKT} - {1325242800 46800 0 TKT} + {-2177411704 -39600 0 -11} + {1325242800 46800 0 +13} } diff --git a/library/tzdata/Pacific/Fiji b/library/tzdata/Pacific/Fiji index 8f8b12f..fa8c99e 100644 --- a/library/tzdata/Pacific/Fiji +++ b/library/tzdata/Pacific/Fiji @@ -2,190 +2,190 @@ set TZData(:Pacific/Fiji) { {-9223372036854775808 42944 0 LMT} - {-1709985344 43200 0 FJT} - {909842400 46800 1 FJST} - {920124000 43200 0 FJT} - {941896800 46800 1 FJST} - {951573600 43200 0 FJT} - {1259416800 46800 1 FJST} - {1269698400 43200 0 FJT} - {1287842400 46800 1 FJST} - {1299333600 43200 0 FJT} - {1319292000 46800 1 FJST} - {1327154400 43200 0 FJT} - {1350741600 46800 1 FJST} - {1358604000 43200 0 FJT} - {1382796000 46800 1 FJST} - {1390050000 43200 0 FJT} - {1414850400 46800 1 FJST} - {1421503200 43200 0 FJT} - {1446300000 46800 1 FJST} - {1452952800 43200 0 FJT} - {1478354400 46800 1 FJST} - {1484402400 43200 0 FJT} - {1509804000 46800 1 FJST} - {1516456800 43200 0 FJT} - {1541253600 46800 1 FJST} - {1547906400 43200 0 FJT} - {1572703200 46800 1 FJST} - {1579356000 43200 0 FJT} - {1604152800 46800 1 FJST} - {1610805600 43200 0 FJT} - {1636207200 46800 1 FJST} - {1642255200 43200 0 FJT} - {1667656800 46800 1 FJST} - {1673704800 43200 0 FJT} - {1699106400 46800 1 FJST} - {1705759200 43200 0 FJT} - {1730556000 46800 1 FJST} - {1737208800 43200 0 FJT} - {1762005600 46800 1 FJST} - {1768658400 43200 0 FJT} - {1793455200 46800 1 FJST} - {1800108000 43200 0 FJT} - {1825509600 46800 1 FJST} - {1831557600 43200 0 FJT} - {1856959200 46800 1 FJST} - {1863612000 43200 0 FJT} - {1888408800 46800 1 FJST} - {1895061600 43200 0 FJT} - {1919858400 46800 1 FJST} - {1926511200 43200 0 FJT} - {1951308000 46800 1 FJST} - {1957960800 43200 0 FJT} - {1983362400 46800 1 FJST} - {1989410400 43200 0 FJT} - {2014812000 46800 1 FJST} - {2020860000 43200 0 FJT} - {2046261600 46800 1 FJST} - {2052914400 43200 0 FJT} - {2077711200 46800 1 FJST} - {2084364000 43200 0 FJT} - {2109160800 46800 1 FJST} - {2115813600 43200 0 FJT} - {2140610400 46800 1 FJST} - {2147263200 43200 0 FJT} - {2172664800 46800 1 FJST} - {2178712800 43200 0 FJT} - {2204114400 46800 1 FJST} - {2210162400 43200 0 FJT} - {2235564000 46800 1 FJST} - {2242216800 43200 0 FJT} - {2267013600 46800 1 FJST} - {2273666400 43200 0 FJT} - {2298463200 46800 1 FJST} - {2305116000 43200 0 FJT} - {2329912800 46800 1 FJST} - {2336565600 43200 0 FJT} - {2361967200 46800 1 FJST} - {2368015200 43200 0 FJT} - {2393416800 46800 1 FJST} - {2400069600 43200 0 FJT} - {2424866400 46800 1 FJST} - {2431519200 43200 0 FJT} - {2456316000 46800 1 FJST} - {2462968800 43200 0 FJT} - {2487765600 46800 1 FJST} - {2494418400 43200 0 FJT} - {2519820000 46800 1 FJST} - {2525868000 43200 0 FJT} - {2551269600 46800 1 FJST} - {2557317600 43200 0 FJT} - {2582719200 46800 1 FJST} - {2589372000 43200 0 FJT} - {2614168800 46800 1 FJST} - {2620821600 43200 0 FJT} - {2645618400 46800 1 FJST} - {2652271200 43200 0 FJT} - {2677068000 46800 1 FJST} - {2683720800 43200 0 FJT} - {2709122400 46800 1 FJST} - {2715170400 43200 0 FJT} - {2740572000 46800 1 FJST} - {2747224800 43200 0 FJT} - {2772021600 46800 1 FJST} - {2778674400 43200 0 FJT} - {2803471200 46800 1 FJST} - {2810124000 43200 0 FJT} - {2834920800 46800 1 FJST} - {2841573600 43200 0 FJT} - {2866975200 46800 1 FJST} - {2873023200 43200 0 FJT} - {2898424800 46800 1 FJST} - {2904472800 43200 0 FJT} - {2929874400 46800 1 FJST} - {2936527200 43200 0 FJT} - {2961324000 46800 1 FJST} - {2967976800 43200 0 FJT} - {2992773600 46800 1 FJST} - {2999426400 43200 0 FJT} - {3024223200 46800 1 FJST} - {3030876000 43200 0 FJT} - {3056277600 46800 1 FJST} - {3062325600 43200 0 FJT} - {3087727200 46800 1 FJST} - {3093775200 43200 0 FJT} - {3119176800 46800 1 FJST} - {3125829600 43200 0 FJT} - {3150626400 46800 1 FJST} - {3157279200 43200 0 FJT} - {3182076000 46800 1 FJST} - {3188728800 43200 0 FJT} - {3213525600 46800 1 FJST} - {3220178400 43200 0 FJT} - {3245580000 46800 1 FJST} - {3251628000 43200 0 FJT} - {3277029600 46800 1 FJST} - {3283682400 43200 0 FJT} - {3308479200 46800 1 FJST} - {3315132000 43200 0 FJT} - {3339928800 46800 1 FJST} - {3346581600 43200 0 FJT} - {3371378400 46800 1 FJST} - {3378031200 43200 0 FJT} - {3403432800 46800 1 FJST} - {3409480800 43200 0 FJT} - {3434882400 46800 1 FJST} - {3440930400 43200 0 FJT} - {3466332000 46800 1 FJST} - {3472984800 43200 0 FJT} - {3497781600 46800 1 FJST} - {3504434400 43200 0 FJT} - {3529231200 46800 1 FJST} - {3535884000 43200 0 FJT} - {3560680800 46800 1 FJST} - {3567333600 43200 0 FJT} - {3592735200 46800 1 FJST} - {3598783200 43200 0 FJT} - {3624184800 46800 1 FJST} - {3630837600 43200 0 FJT} - {3655634400 46800 1 FJST} - {3662287200 43200 0 FJT} - {3687084000 46800 1 FJST} - {3693736800 43200 0 FJT} - {3718533600 46800 1 FJST} - {3725186400 43200 0 FJT} - {3750588000 46800 1 FJST} - {3756636000 43200 0 FJT} - {3782037600 46800 1 FJST} - {3788085600 43200 0 FJT} - {3813487200 46800 1 FJST} - {3820140000 43200 0 FJT} - {3844936800 46800 1 FJST} - {3851589600 43200 0 FJT} - {3876386400 46800 1 FJST} - {3883039200 43200 0 FJT} - {3907836000 46800 1 FJST} - {3914488800 43200 0 FJT} - {3939890400 46800 1 FJST} - {3945938400 43200 0 FJT} - {3971340000 46800 1 FJST} - {3977388000 43200 0 FJT} - {4002789600 46800 1 FJST} - {4009442400 43200 0 FJT} - {4034239200 46800 1 FJST} - {4040892000 43200 0 FJT} - {4065688800 46800 1 FJST} - {4072341600 43200 0 FJT} - {4097138400 46800 1 FJST} + {-1709985344 43200 0 +12} + {909842400 46800 1 +13} + {920124000 43200 0 +12} + {941896800 46800 1 +13} + {951573600 43200 0 +12} + {1259416800 46800 1 +13} + {1269698400 43200 0 +12} + {1287842400 46800 1 +13} + {1299333600 43200 0 +12} + {1319292000 46800 1 +13} + {1327154400 43200 0 +12} + {1350741600 46800 1 +13} + {1358604000 43200 0 +12} + {1382796000 46800 1 +13} + {1390050000 43200 0 +12} + {1414850400 46800 1 +13} + {1421503200 43200 0 +12} + {1446300000 46800 1 +13} + {1452952800 43200 0 +12} + {1478354400 46800 1 +13} + {1484402400 43200 0 +12} + {1509804000 46800 1 +13} + {1516456800 43200 0 +12} + {1541253600 46800 1 +13} + {1547906400 43200 0 +12} + {1572703200 46800 1 +13} + {1579356000 43200 0 +12} + {1604152800 46800 1 +13} + {1610805600 43200 0 +12} + {1636207200 46800 1 +13} + {1642255200 43200 0 +12} + {1667656800 46800 1 +13} + {1673704800 43200 0 +12} + {1699106400 46800 1 +13} + {1705759200 43200 0 +12} + {1730556000 46800 1 +13} + {1737208800 43200 0 +12} + {1762005600 46800 1 +13} + {1768658400 43200 0 +12} + {1793455200 46800 1 +13} + {1800108000 43200 0 +12} + {1825509600 46800 1 +13} + {1831557600 43200 0 +12} + {1856959200 46800 1 +13} + {1863612000 43200 0 +12} + {1888408800 46800 1 +13} + {1895061600 43200 0 +12} + {1919858400 46800 1 +13} + {1926511200 43200 0 +12} + {1951308000 46800 1 +13} + {1957960800 43200 0 +12} + {1983362400 46800 1 +13} + {1989410400 43200 0 +12} + {2014812000 46800 1 +13} + {2020860000 43200 0 +12} + {2046261600 46800 1 +13} + {2052914400 43200 0 +12} + {2077711200 46800 1 +13} + {2084364000 43200 0 +12} + {2109160800 46800 1 +13} + {2115813600 43200 0 +12} + {2140610400 46800 1 +13} + {2147263200 43200 0 +12} + {2172664800 46800 1 +13} + {2178712800 43200 0 +12} + {2204114400 46800 1 +13} + {2210162400 43200 0 +12} + {2235564000 46800 1 +13} + {2242216800 43200 0 +12} + {2267013600 46800 1 +13} + {2273666400 43200 0 +12} + {2298463200 46800 1 +13} + {2305116000 43200 0 +12} + {2329912800 46800 1 +13} + {2336565600 43200 0 +12} + {2361967200 46800 1 +13} + {2368015200 43200 0 +12} + {2393416800 46800 1 +13} + {2400069600 43200 0 +12} + {2424866400 46800 1 +13} + {2431519200 43200 0 +12} + {2456316000 46800 1 +13} + {2462968800 43200 0 +12} + {2487765600 46800 1 +13} + {2494418400 43200 0 +12} + {2519820000 46800 1 +13} + {2525868000 43200 0 +12} + {2551269600 46800 1 +13} + {2557317600 43200 0 +12} + {2582719200 46800 1 +13} + {2589372000 43200 0 +12} + {2614168800 46800 1 +13} + {2620821600 43200 0 +12} + {2645618400 46800 1 +13} + {2652271200 43200 0 +12} + {2677068000 46800 1 +13} + {2683720800 43200 0 +12} + {2709122400 46800 1 +13} + {2715170400 43200 0 +12} + {2740572000 46800 1 +13} + {2747224800 43200 0 +12} + {2772021600 46800 1 +13} + {2778674400 43200 0 +12} + {2803471200 46800 1 +13} + {2810124000 43200 0 +12} + {2834920800 46800 1 +13} + {2841573600 43200 0 +12} + {2866975200 46800 1 +13} + {2873023200 43200 0 +12} + {2898424800 46800 1 +13} + {2904472800 43200 0 +12} + {2929874400 46800 1 +13} + {2936527200 43200 0 +12} + {2961324000 46800 1 +13} + {2967976800 43200 0 +12} + {2992773600 46800 1 +13} + {2999426400 43200 0 +12} + {3024223200 46800 1 +13} + {3030876000 43200 0 +12} + {3056277600 46800 1 +13} + {3062325600 43200 0 +12} + {3087727200 46800 1 +13} + {3093775200 43200 0 +12} + {3119176800 46800 1 +13} + {3125829600 43200 0 +12} + {3150626400 46800 1 +13} + {3157279200 43200 0 +12} + {3182076000 46800 1 +13} + {3188728800 43200 0 +12} + {3213525600 46800 1 +13} + {3220178400 43200 0 +12} + {3245580000 46800 1 +13} + {3251628000 43200 0 +12} + {3277029600 46800 1 +13} + {3283682400 43200 0 +12} + {3308479200 46800 1 +13} + {3315132000 43200 0 +12} + {3339928800 46800 1 +13} + {3346581600 43200 0 +12} + {3371378400 46800 1 +13} + {3378031200 43200 0 +12} + {3403432800 46800 1 +13} + {3409480800 43200 0 +12} + {3434882400 46800 1 +13} + {3440930400 43200 0 +12} + {3466332000 46800 1 +13} + {3472984800 43200 0 +12} + {3497781600 46800 1 +13} + {3504434400 43200 0 +12} + {3529231200 46800 1 +13} + {3535884000 43200 0 +12} + {3560680800 46800 1 +13} + {3567333600 43200 0 +12} + {3592735200 46800 1 +13} + {3598783200 43200 0 +12} + {3624184800 46800 1 +13} + {3630837600 43200 0 +12} + {3655634400 46800 1 +13} + {3662287200 43200 0 +12} + {3687084000 46800 1 +13} + {3693736800 43200 0 +12} + {3718533600 46800 1 +13} + {3725186400 43200 0 +12} + {3750588000 46800 1 +13} + {3756636000 43200 0 +12} + {3782037600 46800 1 +13} + {3788085600 43200 0 +12} + {3813487200 46800 1 +13} + {3820140000 43200 0 +12} + {3844936800 46800 1 +13} + {3851589600 43200 0 +12} + {3876386400 46800 1 +13} + {3883039200 43200 0 +12} + {3907836000 46800 1 +13} + {3914488800 43200 0 +12} + {3939890400 46800 1 +13} + {3945938400 43200 0 +12} + {3971340000 46800 1 +13} + {3977388000 43200 0 +12} + {4002789600 46800 1 +13} + {4009442400 43200 0 +12} + {4034239200 46800 1 +13} + {4040892000 43200 0 +12} + {4065688800 46800 1 +13} + {4072341600 43200 0 +12} + {4097138400 46800 1 +13} } diff --git a/library/tzdata/Pacific/Funafuti b/library/tzdata/Pacific/Funafuti index b94e4fb..d806525 100644 --- a/library/tzdata/Pacific/Funafuti +++ b/library/tzdata/Pacific/Funafuti @@ -2,5 +2,5 @@ set TZData(:Pacific/Funafuti) { {-9223372036854775808 43012 0 LMT} - {-2177495812 43200 0 TVT} + {-2177495812 43200 0 +12} } diff --git a/library/tzdata/Pacific/Galapagos b/library/tzdata/Pacific/Galapagos index d8c80e8..f276f73 100644 --- a/library/tzdata/Pacific/Galapagos +++ b/library/tzdata/Pacific/Galapagos @@ -2,6 +2,8 @@ set TZData(:Pacific/Galapagos) { {-9223372036854775808 -21504 0 LMT} - {-1230746496 -18000 0 ECT} - {504939600 -21600 0 GALT} + {-1230746496 -18000 0 -05} + {504939600 -21600 0 -06} + {722930400 -18000 1 -05} + {728888400 -21600 0 -06} } diff --git a/library/tzdata/Pacific/Gambier b/library/tzdata/Pacific/Gambier index d69f99a..9ebd97c 100644 --- a/library/tzdata/Pacific/Gambier +++ b/library/tzdata/Pacific/Gambier @@ -2,5 +2,5 @@ set TZData(:Pacific/Gambier) { {-9223372036854775808 -32388 0 LMT} - {-1806678012 -32400 0 GAMT} + {-1806678012 -32400 0 -09} } diff --git a/library/tzdata/Pacific/Guadalcanal b/library/tzdata/Pacific/Guadalcanal index 09a67dd..7e13e6e 100644 --- a/library/tzdata/Pacific/Guadalcanal +++ b/library/tzdata/Pacific/Guadalcanal @@ -2,5 +2,5 @@ set TZData(:Pacific/Guadalcanal) { {-9223372036854775808 38388 0 LMT} - {-1806748788 39600 0 SBT} + {-1806748788 39600 0 +11} } diff --git a/library/tzdata/Pacific/Kiritimati b/library/tzdata/Pacific/Kiritimati index 06b695b..b703f19 100644 --- a/library/tzdata/Pacific/Kiritimati +++ b/library/tzdata/Pacific/Kiritimati @@ -2,7 +2,7 @@ set TZData(:Pacific/Kiritimati) { {-9223372036854775808 -37760 0 LMT} - {-2177415040 -38400 0 LINT} - {307622400 -36000 0 LINT} - {788954400 50400 0 LINT} + {-2177415040 -38400 0 -1040} + {307622400 -36000 0 -10} + {788954400 50400 0 +14} } diff --git a/library/tzdata/Pacific/Kosrae b/library/tzdata/Pacific/Kosrae index a16b19d..04bed35 100644 --- a/library/tzdata/Pacific/Kosrae +++ b/library/tzdata/Pacific/Kosrae @@ -2,7 +2,7 @@ set TZData(:Pacific/Kosrae) { {-9223372036854775808 39116 0 LMT} - {-2177491916 39600 0 KOST} - {-7988400 43200 0 KOST} - {915105600 39600 0 KOST} + {-2177491916 39600 0 +11} + {-7988400 43200 0 +12} + {915105600 39600 0 +11} } diff --git a/library/tzdata/Pacific/Kwajalein b/library/tzdata/Pacific/Kwajalein index 8600b3b..19e1067 100644 --- a/library/tzdata/Pacific/Kwajalein +++ b/library/tzdata/Pacific/Kwajalein @@ -2,7 +2,7 @@ set TZData(:Pacific/Kwajalein) { {-9223372036854775808 40160 0 LMT} - {-2177492960 39600 0 MHT} - {-7988400 -43200 0 KWAT} - {745848000 43200 0 MHT} + {-2177492960 39600 0 +11} + {-7988400 -43200 0 -12} + {745848000 43200 0 +12} } diff --git a/library/tzdata/Pacific/Majuro b/library/tzdata/Pacific/Majuro index 468baab..5e9ac99 100644 --- a/library/tzdata/Pacific/Majuro +++ b/library/tzdata/Pacific/Majuro @@ -2,6 +2,6 @@ set TZData(:Pacific/Majuro) { {-9223372036854775808 41088 0 LMT} - {-2177493888 39600 0 MHT} - {-7988400 43200 0 MHT} + {-2177493888 39600 0 +11} + {-7988400 43200 0 +12} } diff --git a/library/tzdata/Pacific/Marquesas b/library/tzdata/Pacific/Marquesas index 9bb508f..ac77a2f 100644 --- a/library/tzdata/Pacific/Marquesas +++ b/library/tzdata/Pacific/Marquesas @@ -2,5 +2,5 @@ set TZData(:Pacific/Marquesas) { {-9223372036854775808 -33480 0 LMT} - {-1806676920 -34200 0 MART} + {-1806676920 -34200 0 -0930} } diff --git a/library/tzdata/Pacific/Nauru b/library/tzdata/Pacific/Nauru index 2da1e25..de10811 100644 --- a/library/tzdata/Pacific/Nauru +++ b/library/tzdata/Pacific/Nauru @@ -2,8 +2,8 @@ set TZData(:Pacific/Nauru) { {-9223372036854775808 40060 0 LMT} - {-1545131260 41400 0 NRT} - {-877347000 32400 0 JST} - {-800960400 41400 0 NRT} - {294323400 43200 0 NRT} + {-1545131260 41400 0 +1130} + {-877347000 32400 0 +09} + {-800960400 41400 0 +1130} + {294323400 43200 0 +12} } diff --git a/library/tzdata/Pacific/Niue b/library/tzdata/Pacific/Niue index cf149fc..fe19c59 100644 --- a/library/tzdata/Pacific/Niue +++ b/library/tzdata/Pacific/Niue @@ -2,7 +2,7 @@ set TZData(:Pacific/Niue) { {-9223372036854775808 -40780 0 LMT} - {-2177412020 -40800 0 NUT} - {-599575200 -41400 0 NUT} - {276089400 -39600 0 NUT} + {-2177412020 -40800 0 -1120} + {-599575200 -41400 0 -1130} + {276089400 -39600 0 -11} } diff --git a/library/tzdata/Pacific/Norfolk b/library/tzdata/Pacific/Norfolk index b12ab8c..f0556ab 100644 --- a/library/tzdata/Pacific/Norfolk +++ b/library/tzdata/Pacific/Norfolk @@ -2,9 +2,9 @@ set TZData(:Pacific/Norfolk) { {-9223372036854775808 40312 0 LMT} - {-2177493112 40320 0 NMT} - {-599656320 41400 0 NFT} - {152029800 45000 1 NFST} - {162912600 41400 0 NFT} - {1443882600 39600 0 NFT} + {-2177493112 40320 0 +1112} + {-599656320 41400 0 +1130} + {152029800 45000 1 +1230} + {162912600 41400 0 +1130} + {1443882600 39600 0 +11} } diff --git a/library/tzdata/Pacific/Noumea b/library/tzdata/Pacific/Noumea index db1eeae..36b570d 100644 --- a/library/tzdata/Pacific/Noumea +++ b/library/tzdata/Pacific/Noumea @@ -2,11 +2,11 @@ set TZData(:Pacific/Noumea) { {-9223372036854775808 39948 0 LMT} - {-1829387148 39600 0 NCT} - {250002000 43200 1 NCST} - {257342400 39600 0 NCT} - {281451600 43200 1 NCST} - {288878400 39600 0 NCT} - {849366000 43200 1 NCST} - {857228400 39600 0 NCT} + {-1829387148 39600 0 +11} + {250002000 43200 1 +12} + {257342400 39600 0 +11} + {281451600 43200 1 +12} + {288878400 39600 0 +11} + {849366000 43200 1 +12} + {857228400 39600 0 +11} } diff --git a/library/tzdata/Pacific/Pago_Pago b/library/tzdata/Pacific/Pago_Pago index ca261d0..d30c981 100644 --- a/library/tzdata/Pacific/Pago_Pago +++ b/library/tzdata/Pacific/Pago_Pago @@ -3,7 +3,5 @@ set TZData(:Pacific/Pago_Pago) { {-9223372036854775808 45432 0 LMT} {-2855738232 -40968 0 LMT} - {-1861879032 -39600 0 NST} - {-86878800 -39600 0 BST} - {439038000 -39600 0 SST} + {-1861879032 -39600 0 SST} } diff --git a/library/tzdata/Pacific/Palau b/library/tzdata/Pacific/Palau index ee0606d..a50fd2a 100644 --- a/library/tzdata/Pacific/Palau +++ b/library/tzdata/Pacific/Palau @@ -2,5 +2,5 @@ set TZData(:Pacific/Palau) { {-9223372036854775808 32276 0 LMT} - {-2177485076 32400 0 PWT} + {-2177485076 32400 0 +09} } diff --git a/library/tzdata/Pacific/Pitcairn b/library/tzdata/Pacific/Pitcairn index d62644e..6813978 100644 --- a/library/tzdata/Pacific/Pitcairn +++ b/library/tzdata/Pacific/Pitcairn @@ -2,6 +2,6 @@ set TZData(:Pacific/Pitcairn) { {-9223372036854775808 -31220 0 LMT} - {-2177421580 -30600 0 PNT} - {893665800 -28800 0 PST} + {-2177421580 -30600 0 -0830} + {893665800 -28800 0 -08} } diff --git a/library/tzdata/Pacific/Pohnpei b/library/tzdata/Pacific/Pohnpei index 58978da..3fcb5d0 100644 --- a/library/tzdata/Pacific/Pohnpei +++ b/library/tzdata/Pacific/Pohnpei @@ -2,5 +2,5 @@ set TZData(:Pacific/Pohnpei) { {-9223372036854775808 37972 0 LMT} - {-2177490772 39600 0 PONT} + {-2177490772 39600 0 +11} } diff --git a/library/tzdata/Pacific/Port_Moresby b/library/tzdata/Pacific/Port_Moresby index 65eb533..c3a5e4f 100644 --- a/library/tzdata/Pacific/Port_Moresby +++ b/library/tzdata/Pacific/Port_Moresby @@ -3,5 +3,5 @@ set TZData(:Pacific/Port_Moresby) { {-9223372036854775808 35320 0 LMT} {-2840176120 35312 0 PMMT} - {-2366790512 36000 0 PGT} + {-2366790512 36000 0 +10} } diff --git a/library/tzdata/Pacific/Rarotonga b/library/tzdata/Pacific/Rarotonga index a4ecf8d..9a70318 100644 --- a/library/tzdata/Pacific/Rarotonga +++ b/library/tzdata/Pacific/Rarotonga @@ -2,31 +2,31 @@ set TZData(:Pacific/Rarotonga) { {-9223372036854775808 -38344 0 LMT} - {-2177414456 -37800 0 CKT} - {279714600 -34200 0 CKHST} - {289387800 -36000 0 CKT} - {309952800 -34200 1 CKHST} - {320837400 -36000 0 CKT} - {341402400 -34200 1 CKHST} - {352287000 -36000 0 CKT} - {372852000 -34200 1 CKHST} - {384341400 -36000 0 CKT} - {404906400 -34200 1 CKHST} - {415791000 -36000 0 CKT} - {436356000 -34200 1 CKHST} - {447240600 -36000 0 CKT} - {467805600 -34200 1 CKHST} - {478690200 -36000 0 CKT} - {499255200 -34200 1 CKHST} - {510139800 -36000 0 CKT} - {530704800 -34200 1 CKHST} - {541589400 -36000 0 CKT} - {562154400 -34200 1 CKHST} - {573643800 -36000 0 CKT} - {594208800 -34200 1 CKHST} - {605093400 -36000 0 CKT} - {625658400 -34200 1 CKHST} - {636543000 -36000 0 CKT} - {657108000 -34200 1 CKHST} - {667992600 -36000 0 CKT} + {-2177414456 -37800 0 -1030} + {279714600 -34200 0 -0930} + {289387800 -36000 0 -10} + {309952800 -34200 1 -0930} + {320837400 -36000 0 -10} + {341402400 -34200 1 -0930} + {352287000 -36000 0 -10} + {372852000 -34200 1 -0930} + {384341400 -36000 0 -10} + {404906400 -34200 1 -0930} + {415791000 -36000 0 -10} + {436356000 -34200 1 -0930} + {447240600 -36000 0 -10} + {467805600 -34200 1 -0930} + {478690200 -36000 0 -10} + {499255200 -34200 1 -0930} + {510139800 -36000 0 -10} + {530704800 -34200 1 -0930} + {541589400 -36000 0 -10} + {562154400 -34200 1 -0930} + {573643800 -36000 0 -10} + {594208800 -34200 1 -0930} + {605093400 -36000 0 -10} + {625658400 -34200 1 -0930} + {636543000 -36000 0 -10} + {657108000 -34200 1 -0930} + {667992600 -36000 0 -10} } diff --git a/library/tzdata/Pacific/Tahiti b/library/tzdata/Pacific/Tahiti index f739223..768553c 100644 --- a/library/tzdata/Pacific/Tahiti +++ b/library/tzdata/Pacific/Tahiti @@ -2,5 +2,5 @@ set TZData(:Pacific/Tahiti) { {-9223372036854775808 -35896 0 LMT} - {-1806674504 -36000 0 TAHT} + {-1806674504 -36000 0 -10} } diff --git a/library/tzdata/Pacific/Tarawa b/library/tzdata/Pacific/Tarawa index 2dab5a2..2b9b556 100644 --- a/library/tzdata/Pacific/Tarawa +++ b/library/tzdata/Pacific/Tarawa @@ -2,5 +2,5 @@ set TZData(:Pacific/Tarawa) { {-9223372036854775808 41524 0 LMT} - {-2177494324 43200 0 GILT} + {-2177494324 43200 0 +12} } diff --git a/library/tzdata/Pacific/Wake b/library/tzdata/Pacific/Wake index 5afedf5..67eab37 100644 --- a/library/tzdata/Pacific/Wake +++ b/library/tzdata/Pacific/Wake @@ -2,5 +2,5 @@ set TZData(:Pacific/Wake) { {-9223372036854775808 39988 0 LMT} - {-2177492788 43200 0 WAKT} + {-2177492788 43200 0 +12} } diff --git a/library/tzdata/Pacific/Wallis b/library/tzdata/Pacific/Wallis index 7bdd964..152e6af 100644 --- a/library/tzdata/Pacific/Wallis +++ b/library/tzdata/Pacific/Wallis @@ -2,5 +2,5 @@ set TZData(:Pacific/Wallis) { {-9223372036854775808 44120 0 LMT} - {-2177496920 43200 0 WFT} + {-2177496920 43200 0 +12} } -- cgit v0.12 -- cgit v0.12 From eb03584c16b7a1b99800e60e00ed43a73745b2d2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 28 Mar 2017 07:14:47 +0000 Subject: (experimental) new internal macro TCL_Z_MODIFIER, just like TCL_LL_MODIFIER but then for size_t. --- generic/tcl.h | 8 ++++++++ generic/tclAlloc.c | 10 +++++----- generic/tclCkalloc.c | 14 +++++++------- generic/tclExecute.c | 6 +++--- generic/tclStringObj.c | 12 ++++++------ 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 731724e..24dd0be 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -394,9 +394,11 @@ typedef long LONG; # if defined(_WIN32) # define TCL_WIDE_INT_TYPE __int64 # define TCL_LL_MODIFIER "I64" +# define TCL_Z_MODIFIER "I" # elif defined(__GNUC__) # define TCL_WIDE_INT_TYPE long long # define TCL_LL_MODIFIER "ll" +# define TCL_Z_MODIFIER "z" # else /* ! _WIN32 && ! __GNUC__ */ /* * Don't know what platform it is and configure hasn't discovered what is @@ -426,6 +428,9 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; # ifndef TCL_LL_MODIFIER # define TCL_LL_MODIFIER "l" # endif /* !TCL_LL_MODIFIER */ +# ifndef TCL_Z_MODIFIER +# define TCL_Z_MODIFIER "l" +# endif /* !TCL_Z_MODIFIER */ #else /* TCL_WIDE_INT_IS_LONG */ /* * The next short section of defines are only done when not running on Windows @@ -434,6 +439,9 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; # ifndef TCL_LL_MODIFIER # define TCL_LL_MODIFIER "ll" # endif /* !TCL_LL_MODIFIER */ +# ifndef TCL_Z_MODIFIER +# define TCL_Z_MODIFIER "" +# endif /* !TCL_Z_MODIFIER */ # define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) # define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) # define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c index 64df1a2..fbd8f6e 100644 --- a/generic/tclAlloc.c +++ b/generic/tclAlloc.c @@ -661,14 +661,14 @@ mstats( fprintf(stderr, "\nused:\t"); for (i = 0; i < NBUCKETS; i++) { - fprintf(stderr, " %" TCL_LL_MODIFIER "d", (Tcl_WideInt)numMallocs[i]); + fprintf(stderr, " %" TCL_Z_MODIFIER "d", numMallocs[i]); totalUsed += numMallocs[i] * (1 << (i + 3)); } - fprintf(stderr, "\n\tTotal small in use: %" TCL_LL_MODIFIER "d, total free: %" TCL_LL_MODIFIER "d\n", - (Tcl_WideInt)totalUsed, (Tcl_WideInt)totalFree); - fprintf(stderr, "\n\tNumber of big (>%d) blocks in use: %" TCL_LL_MODIFIER "d\n", - MAXMALLOC, (Tcl_WideInt)numMallocs[NBUCKETS]); + fprintf(stderr, "\n\tTotal small in use: %" TCL_Z_MODIFIER "d, total free: %" TCL_Z_MODIFIER "d\n", + totalUsed, totalFree); + fprintf(stderr, "\n\tNumber of big (>%d) blocks in use: %" TCL_Z_MODIFIER "d\n", + MAXMALLOC, numMallocs[NBUCKETS]); Tcl_MutexUnlock(allocMutexPtr); } diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index d42536e..394287a 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -254,7 +254,7 @@ ValidateMemory( fprintf(stderr, "low guard failed at %p, %s %d\n", memHeaderP->body, file, line); fflush(stderr); /* In case name pointer is bad. */ - fprintf(stderr, "%" TCL_LL_MODIFIER "d bytes allocated at (%s %d)\n", (Tcl_WideInt) memHeaderP->length, + fprintf(stderr, "%" TCL_Z_MODIFIER "d bytes allocated at (%s %d)\n", memHeaderP->length, memHeaderP->file, memHeaderP->line); Tcl_Panic("Memory validation failure"); } @@ -276,8 +276,8 @@ ValidateMemory( fprintf(stderr, "high guard failed at %p, %s %d\n", memHeaderP->body, file, line); fflush(stderr); /* In case name pointer is bad. */ - fprintf(stderr, "%" TCL_LL_MODIFIER "d bytes allocated at (%s %d)\n", - (Tcl_WideInt)memHeaderP->length, memHeaderP->file, + fprintf(stderr, "%" TCL_Z_MODIFIER "d bytes allocated at (%s %d)\n", + memHeaderP->length, memHeaderP->file, memHeaderP->line); Tcl_Panic("Memory validation failure"); } @@ -359,10 +359,10 @@ Tcl_DumpActiveMemory( Tcl_MutexLock(ckallocMutexPtr); for (memScanP = allocHead; memScanP != NULL; memScanP = memScanP->flink) { address = &memScanP->body[0]; - fprintf(fileP, "%8" TCL_LL_MODIFIER "x - %8" TCL_LL_MODIFIER "x %7" TCL_LL_MODIFIER "d @ %s %d %s", - (Tcl_WideInt)(size_t)address, - (Tcl_WideInt)((size_t)address + memScanP->length - 1), - (Tcl_WideInt)memScanP->length, memScanP->file, memScanP->line, + fprintf(fileP, "%8" TCL_Z_MODIFIER "x - %8" TCL_Z_MODIFIER "x %7" TCL_Z_MODIFIER "d @ %s %d %s", + (size_t)address, + ((size_t)address + memScanP->length - 1), + memScanP->length, memScanP->file, memScanP->line, (memScanP->tagPtr == NULL) ? "" : memScanP->tagPtr->string); (void) fputc('\n', fileP); } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index ad80b28..98fe51d 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -9477,9 +9477,9 @@ PrintByteCodeInfo( Proc *procPtr = codePtr->procPtr; Interp *iPtr = (Interp *) *codePtr->interpHandle; - fprintf(stdout, "\nExecuting ByteCode 0x%p, refCt %" TCL_LL_MODIFIER "u, epoch %" TCL_LL_MODIFIER "u, interp 0x%p (epoch %" TCL_LL_MODIFIER "u)\n", - codePtr, (Tcl_WideInt)codePtr->refCount, (Tcl_WideInt)codePtr->compileEpoch, iPtr, - (Tcl_WideInt)iPtr->compileEpoch); + fprintf(stdout, "\nExecuting ByteCode 0x%p, refCt %" TCL_Z_MODIFIER "u, epoch %" TCL_Z_MODIFIER "u, interp 0x%p (epoch %" TCL_Z_MODIFIER "u)\n", + codePtr, codePtr->refCount, codePtr->compileEpoch, iPtr, + (size_t)iPtr->compileEpoch); fprintf(stdout, " Source: "); TclPrintSource(stdout, codePtr->source, 60); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index b8b64d4..d12cc74 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2759,8 +2759,8 @@ TclStringRepeat( if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "string size overflow: unable to alloc %" - TCL_LL_MODIFIER "u bytes", - (Tcl_WideUInt)STRING_SIZE(count*length))); + TCL_Z_MODIFIER "u bytes", + STRING_SIZE(count*length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } return TCL_ERROR; @@ -2983,8 +2983,8 @@ TclStringCatObjv( if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "concatenation failed: unable to alloc %" - TCL_LL_MODIFIER "u bytes", - (Tcl_WideUInt)STRING_SIZE(length))); + TCL_Z_MODIFIER "u bytes", + STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } return TCL_ERROR; @@ -2999,8 +2999,8 @@ TclStringCatObjv( if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "concatenation failed: unable to alloc %" - TCL_LL_MODIFIER "u bytes", - (Tcl_WideUInt)STRING_SIZE(length))); + TCL_Z_MODIFIER "u bytes", + STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } return TCL_ERROR; -- cgit v0.12 From cf3f133df1d082197bba097362768af248e334dc Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 29 Mar 2017 12:05:59 +0000 Subject: (more experimenting): Make TCL_LL_MODIFIER behave more close to intuitive expectations: If the platform has a "long long" type, use it for Tcl_WideInt, so TCL_LL_MODIFIER is really a replacement for "ll" on most platforms (Win32/Win64 as most notable exception). Will need a new TIP. --- doc/IntObj.3 | 2 +- generic/tcl.h | 15 +++++++-------- generic/tclIO.c | 2 +- unix/configure | 6 +++--- unix/tcl.m4 | 6 +++--- unix/tclConfig.h.in | 2 +- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/doc/IntObj.3 b/doc/IntObj.3 index dc62642..6d5ee69 100644 --- a/doc/IntObj.3 +++ b/doc/IntObj.3 @@ -97,7 +97,7 @@ are provided by the C language standard. The \fBTcl_WideInt\fR type is a typedef defined to be whatever signed integral type covers at least the 64-bit integer range (-9223372036854775808 to 9223372036854775807). Depending on the platform and the C compiler, the actual type might be -\fBlong int\fR, \fBlong long int\fR, \fBint64\fR, or something else. +\fBlong long int\fR, \fB__int64\fR, or something else. The \fBmp_int\fR type is a multiple-precision integer type defined by the LibTomMath multiple-precision integer library. .PP diff --git a/generic/tcl.h b/generic/tcl.h index 24dd0be..c038dce 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -412,21 +412,17 @@ typedef long LONG; # endif # endif /* _WIN32 */ #endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */ -#ifdef TCL_WIDE_INT_IS_LONG -# undef TCL_WIDE_INT_TYPE -# define TCL_WIDE_INT_TYPE long -#endif /* TCL_WIDE_INT_IS_LONG */ - -typedef TCL_WIDE_INT_TYPE Tcl_WideInt; -typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; #ifdef TCL_WIDE_INT_IS_LONG # define Tcl_WideAsLong(val) ((long)(val)) # define Tcl_LongAsWide(val) ((long)(val)) # define Tcl_WideAsDouble(val) ((double)((long)(val))) # define Tcl_DoubleAsWide(val) ((long)((double)(val))) +# ifndef TCL_WIDE_INT_TYPE +# define TCL_WIDE_INT_TYPE long long +# endif /* !TCL_WIDE_INT_TYPE */ # ifndef TCL_LL_MODIFIER -# define TCL_LL_MODIFIER "l" +# define TCL_LL_MODIFIER "ll" # endif /* !TCL_LL_MODIFIER */ # ifndef TCL_Z_MODIFIER # define TCL_Z_MODIFIER "l" @@ -448,6 +444,9 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; # define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) #endif /* TCL_WIDE_INT_IS_LONG */ +typedef TCL_WIDE_INT_TYPE Tcl_WideInt; +typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; + #if defined(_WIN32) # ifdef __BORLANDC__ typedef struct stati64 Tcl_StatBuf; diff --git a/generic/tclIO.c b/generic/tclIO.c index 6bf8451..a509ebf 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -9276,7 +9276,7 @@ MBWrite( * then the calculations involving extra must be made wide too. * * Noted with Win32/MSVC debug build treating the warning (possible of - * data in int64 to int conversion) as error. + * data in __int64 to int conversion) as error. */ bufPtr = AllocChannelBuffer(extra); diff --git a/unix/configure b/unix/configure index 741ae47..ba8e19b 100755 --- a/unix/configure +++ b/unix/configure @@ -7044,7 +7044,7 @@ else tcl_type_64bit="long long" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - # See if we should use long anyway Note that we substitute in the + # See if we could use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7070,8 +7070,8 @@ fi $as_echo "#define TCL_WIDE_INT_IS_LONG 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using long" >&5 -$as_echo "using long" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else cat >>confdefs.h <<_ACEOF diff --git a/unix/tcl.m4 b/unix/tcl.m4 index c1d7a7d..ac40e5d 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2614,15 +2614,15 @@ AC_DEFUN([SC_TCL_64BIT_FLAGS], [ # See if the compiler knows natively about __int64 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], tcl_type_64bit=__int64, tcl_type_64bit="long long") - # See if we should use long anyway Note that we substitute in the + # See if we could use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... AC_TRY_COMPILE(,[switch (0) { case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; }],tcl_cv_type_64bit=${tcl_type_64bit})]) if test "${tcl_cv_type_64bit}" = none ; then - AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?]) - AC_MSG_RESULT([using long]) + AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?]) + AC_MSG_RESULT([yes]) else AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}, [What type should be used to define wide integers?]) diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index adbc80d..fed3872 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -400,7 +400,7 @@ /* Does this platform have wide high-resolution clicks? */ #undef TCL_WIDE_CLICKS -/* Are wide integers to be implemented with C 'long's? */ +/* Do Tcl_WideInt, 'long' and 'long long' all have the same size (64-bit) ? */ #undef TCL_WIDE_INT_IS_LONG /* What type should be used to define wide integers? */ -- cgit v0.12 From 0515becf7a31a04247d286856d70790c3ca43a2f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 31 Mar 2017 11:05:28 +0000 Subject: Fix fall-back test for TCL_WIDE_INT_IS_LONG, making it do the same as "configure": Should be 1 if sizeof(long long) == sizeof(long), 0 otherwise. --- generic/tcl.h | 49 ++++++++++++++----------------------------------- 1 file changed, 14 insertions(+), 35 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index c038dce..bacd73c 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -396,8 +396,6 @@ typedef long LONG; # define TCL_LL_MODIFIER "I64" # define TCL_Z_MODIFIER "I" # elif defined(__GNUC__) -# define TCL_WIDE_INT_TYPE long long -# define TCL_LL_MODIFIER "ll" # define TCL_Z_MODIFIER "z" # else /* ! _WIN32 && ! __GNUC__ */ /* @@ -405,44 +403,25 @@ typedef long LONG; * going on for us. Try to guess... */ # include -# if (INT_MAX < LONG_MAX) +# if defined(LLONG_MAX) && (LLONG_MAX == LONG_MAX) # define TCL_WIDE_INT_IS_LONG 1 -# else -# define TCL_WIDE_INT_TYPE long long # endif # endif /* _WIN32 */ #endif /* !TCL_WIDE_INT_TYPE & !TCL_WIDE_INT_IS_LONG */ -#ifdef TCL_WIDE_INT_IS_LONG -# define Tcl_WideAsLong(val) ((long)(val)) -# define Tcl_LongAsWide(val) ((long)(val)) -# define Tcl_WideAsDouble(val) ((double)((long)(val))) -# define Tcl_DoubleAsWide(val) ((long)((double)(val))) -# ifndef TCL_WIDE_INT_TYPE -# define TCL_WIDE_INT_TYPE long long -# endif /* !TCL_WIDE_INT_TYPE */ -# ifndef TCL_LL_MODIFIER -# define TCL_LL_MODIFIER "ll" -# endif /* !TCL_LL_MODIFIER */ -# ifndef TCL_Z_MODIFIER -# define TCL_Z_MODIFIER "l" -# endif /* !TCL_Z_MODIFIER */ -#else /* TCL_WIDE_INT_IS_LONG */ -/* - * The next short section of defines are only done when not running on Windows - * or some other strange platform. - */ -# ifndef TCL_LL_MODIFIER -# define TCL_LL_MODIFIER "ll" -# endif /* !TCL_LL_MODIFIER */ -# ifndef TCL_Z_MODIFIER -# define TCL_Z_MODIFIER "" -# endif /* !TCL_Z_MODIFIER */ -# define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) -# define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) -# define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) -# define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) -#endif /* TCL_WIDE_INT_IS_LONG */ +#ifndef TCL_WIDE_INT_TYPE +# define TCL_WIDE_INT_TYPE long long +#endif /* !TCL_WIDE_INT_TYPE */ +#ifndef TCL_LL_MODIFIER +# define TCL_LL_MODIFIER "ll" +#endif /* !TCL_LL_MODIFIER */ +#ifndef TCL_Z_MODIFIER +# define TCL_Z_MODIFIER "l" +#endif /* !TCL_Z_MODIFIER */ +#define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) +#define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) +#define Tcl_WideAsDouble(val) ((double)((Tcl_WideInt)(val))) +#define Tcl_DoubleAsWide(val) ((Tcl_WideInt)((double)(val))) typedef TCL_WIDE_INT_TYPE Tcl_WideInt; typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; -- cgit v0.12 -- cgit v0.12 From 72ac20b7d7e65869c797750d7aad03dc0aed22bf Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 4 Apr 2017 11:13:36 +0000 Subject: bug fix for [42202ba1e5ff566e0f9abb9f890e460fbc6c1c5c]: segfault by coro inject rewritten callback for ::tcl::unsupported::inject, without leave the interpreter in unusable state (inaccurate environment exchange by adding eval callback), test covered now. --- generic/tclBasic.c | 32 +++++++++++++++++++++++++++++++- tests/coroutine.test | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 4bddbce..f604ac1 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -8748,6 +8748,35 @@ TclNRCoroutineActivateCallback( /* *---------------------------------------------------------------------- * + * TclNREvalList -- + * + * Callback to invoke command as list, used in order to delayed + * processing of canonical list command in sane environment. + * + *---------------------------------------------------------------------- + */ + +static int +TclNREvalList( + ClientData data[], + Tcl_Interp *interp, + int result) +{ + int objc; + Tcl_Obj **objv; + Tcl_Obj *listPtr = data[0]; + + Tcl_IncrRefCount(listPtr); + + TclMarkTailcall(interp); + TclNRAddCallback(interp, TclNRReleaseValues, listPtr, NULL, NULL,NULL); + TclListObjGetElements(NULL, listPtr, &objc, &objv); + return TclNREvalObjv(interp, objc, objv, 0, NULL); +} + +/* + *---------------------------------------------------------------------- + * * NRCoroInjectObjCmd -- * * Implementation of [::tcl::unsupported::inject] command. @@ -8799,7 +8828,8 @@ NRCoroInjectObjCmd( */ iPtr->execEnvPtr = corPtr->eePtr; - TclNREvalObjEx(interp, Tcl_NewListObj(objc-2, objv+2), 0, NULL, INT_MIN); + TclNRAddCallback(interp, TclNREvalList, Tcl_NewListObj(objc-2, objv+2), + NULL, NULL, NULL); iPtr->execEnvPtr = savedEEPtr; return TCL_OK; diff --git a/tests/coroutine.test b/tests/coroutine.test index 205da67..fd68567 100644 --- a/tests/coroutine.test +++ b/tests/coroutine.test @@ -741,6 +741,45 @@ test coroutine-7.12 {coro floor above street level #3008307} -body { list } -result {} +test coroutine-8.0.0 {coro inject executed} -body { + coroutine demo apply {{} { foreach i {1 2} yield }} + demo + set ::result none + tcl::unsupported::inject demo set ::result inject-executed + demo + set ::result +} -result {inject-executed} +test coroutine-8.0.1 {coro inject after error} -body { + coroutine demo apply {{} { foreach i {1 2} yield; error test }} + demo + set ::result none + tcl::unsupported::inject demo set ::result inject-executed + lappend ::result [catch {demo} err] $err +} -result {inject-executed 1 test} +test coroutine-8.1.1 {coro inject, ticket 42202ba1e5ff566e} -body { + interp create slave + slave eval { + coroutine demo apply {{} { while {1} yield }} + demo + tcl::unsupported::inject demo set ::result inject-executed + } + interp delete slave +} -result {} +test coroutine-8.1.2 {coro inject with result, ticket 42202ba1e5ff566e} -body { + interp create slave + slave eval { + coroutine demo apply {{} { while {1} yield }} + demo + tcl::unsupported::inject demo set ::result inject-executed + } + slave eval demo + set result [slave eval {set ::result}] + + interp delete slave + set result +} -result {inject-executed} + + # cleanup unset lambda -- cgit v0.12 From 14192d21ddce62aa6d4736302ae3711fceb4c5ae Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 5 Apr 2017 10:40:29 +0000 Subject: Contributed by "stanko" as patch within 8bd13f07bde6fb0631f27927e36461fdefe8ca95 Resolves blocking of pipes-thread (reader/writer) under huge last: Terminating threads during their initialization resp. teardown phase may result LoaderLock in the ntdll.dll's (to remain locked indefinitely). This causes ntdll.dll's LdrpInitializeThread() to deadlock trying to acquire LoaderLock. Possible fix for 9d75181ee70af318830e99ede6ebb5df72a9b079 --- win/tclWinConsole.c | 53 +++++++++++++++++++++++++++++++-- win/tclWinPipe.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++---- win/tclWinSerial.c | 41 ++++++++++++++++++++++++-- 3 files changed, 167 insertions(+), 11 deletions(-) diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index ab55035..5c0b43b 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -51,6 +51,8 @@ TCL_DECLARE_MUTEX(consoleMutex) typedef struct ConsoleThreadInfo { HANDLE thread; /* Handle to reader or writer thread. */ + HANDLE threadInitialized; /* Manual-reset event to signal that thread has been initialized. */ + int threadExiting; /* Boolean indicating that thread is exiting. */ HANDLE readyEvent; /* Manual-reset event to signal _to_ the main * thread when the worker thread has finished * waiting for its normal work to happen. */ @@ -536,9 +538,12 @@ StartChannelThread( threadInfoPtr->readyEvent = CreateEvent(NULL, TRUE, TRUE, NULL); threadInfoPtr->startEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + threadInfoPtr->threadInitialized = CreateEvent(NULL, TRUE, FALSE, NULL); + threadInfoPtr->threadExiting = FALSE; threadInfoPtr->stopEvent = CreateEvent(NULL, FALSE, FALSE, NULL); threadInfoPtr->thread = CreateThread(NULL, 256, threadProc, infoPtr, 0, &id); + WaitForSingleObject(threadInfoPtr->threadInitialized, INFINITE); /* wait for thread to initialize */ SetThreadPriority(threadInfoPtr->thread, THREAD_PRIORITY_HIGHEST); } @@ -572,11 +577,28 @@ StopChannelThread( * Note that we need to guard against terminating the thread while * it is in the middle of Tcl_ThreadAlert because it won't be able * to release the notifier lock. + * + * Also note that terminating threads during their initialization or teardown phase + * may result in ntdll.dll's LoaderLock to remain locked indefinitely. + * This causes ntdll.dll's LdrpInitializeThread() to deadlock trying to acquire LoaderLock. + * LdrpInitializeThread() is executed within new threads to perform + * initialization and to execute DllMain() of all loaded dlls. + * As a result, all new threads are deadlocked in their initialization phase and never execute, + * even though CreateThread() reports successful thread creation. + * This results in a very weird process-wide behavior, which is extremely hard to debug. + * + * THREADS SHOULD NEVER BE TERMINATED. Period. + * + * But for now, check if thread is exiting, and if so, let it die peacefully. */ Tcl_MutexLock(&consoleMutex); - /* BUG: this leaks memory. */ - TerminateThread(threadInfoPtr->thread, 0); + if ( threadInfoPtr->threadExiting ) { + WaitForSingleObject(threadInfoPtr->thread, INFINITE); + } else { + /* BUG: this leaks memory. */ + TerminateThread(threadInfoPtr->thread, 0); + } Tcl_MutexUnlock(&consoleMutex); } } @@ -587,6 +609,7 @@ StopChannelThread( */ CloseHandle(threadInfoPtr->thread); + CloseHandle(threadInfoPtr->threadInitialized); CloseHandle(threadInfoPtr->readyEvent); CloseHandle(threadInfoPtr->startEvent); CloseHandle(threadInfoPtr->stopEvent); @@ -1186,6 +1209,11 @@ ConsoleReaderThread( HANDLE wEvents[2]; /* + * Notify StartChannelThread() that this thread is initialized + */ + SetEvent(threadInfo->threadInitialized); + + /* * The first event takes precedence. */ @@ -1253,6 +1281,14 @@ ConsoleReaderThread( Tcl_MutexUnlock(&consoleMutex); } + /* + * Inform StopChannelThread() that this thread should not be terminated, since it is about to exit. + * See comment in StopChannelThread() for reasons. + */ + Tcl_MutexLock(&consoleMutex); + threadInfo->threadExiting = TRUE; + Tcl_MutexUnlock(&consoleMutex); + return 0; } @@ -1287,6 +1323,11 @@ ConsoleWriterThread( HANDLE wEvents[2]; /* + * Notify StartChannelThread() that this thread is initialized + */ + SetEvent(threadInfo->threadInitialized); + + /* * The first event takes precedence. */ @@ -1351,6 +1392,14 @@ ConsoleWriterThread( Tcl_MutexUnlock(&consoleMutex); } + /* + * Inform StopChannelThread() that this thread should not be terminated, since it is about to exit. + * See comment in StopChannelThread() for reasons. + */ + Tcl_MutexLock(&consoleMutex); + threadInfo->threadExiting = TRUE; + Tcl_MutexUnlock(&consoleMutex); + return 0; } diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 4666deb..9677792 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -111,6 +111,10 @@ typedef struct PipeInfo { * threads. */ HANDLE writeThread; /* Handle to writer thread. */ HANDLE readThread; /* Handle to reader thread. */ + HANDLE writeThreadInitialized; /* Manual-reset event to signal that writer thread has been initialized */ + HANDLE readThreadInitialized; /* Manual-reset event to signal that reader thread has been initialized */ + int writeThreadExiting; /* Boolean indicating that write thread is exiting */ + int readThreadExiting; /* Boolean indicating that read thread is exiting */ HANDLE writable; /* Manual-reset event to signal when the * writer thread has finished waiting for the * current buffer to be written. */ @@ -1601,8 +1605,11 @@ TclpCreateCommandChannel( infoPtr->readable = CreateEvent(NULL, TRUE, TRUE, NULL); infoPtr->startReader = CreateEvent(NULL, FALSE, FALSE, NULL); infoPtr->stopReader = CreateEvent(NULL, TRUE, FALSE, NULL); + infoPtr->readThreadInitialized = CreateEvent(NULL, TRUE, FALSE, NULL); + infoPtr->readThreadExiting = FALSE; infoPtr->readThread = CreateThread(NULL, 256, PipeReaderThread, infoPtr, 0, &id); + WaitForSingleObject(infoPtr->readThreadInitialized, INFINITE); /* wait for thread to initialize */ SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_READABLE; } else { @@ -1616,8 +1623,11 @@ TclpCreateCommandChannel( infoPtr->writable = CreateEvent(NULL, TRUE, TRUE, NULL); infoPtr->startWriter = CreateEvent(NULL, FALSE, FALSE, NULL); infoPtr->stopWriter = CreateEvent(NULL, TRUE, FALSE, NULL); + infoPtr->writeThreadInitialized = CreateEvent(NULL, TRUE, FALSE, NULL); + infoPtr->writeThreadExiting = FALSE; infoPtr->writeThread = CreateThread(NULL, 256, PipeWriterThread, infoPtr, 0, &id); + WaitForSingleObject(infoPtr->writeThreadInitialized, INFINITE); /* wait for thread to initialize */ SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_WRITABLE; } @@ -1853,17 +1863,35 @@ PipeClose2Proc( * Note that we need to guard against terminating the * thread while it is in the middle of Tcl_ThreadAlert * because it won't be able to release the notifier lock. + * + * Also note that terminating threads during their initialization or teardown phase + * may result in ntdll.dll's LoaderLock to remain locked indefinitely. + * This causes ntdll.dll's LdrpInitializeThread() to deadlock trying to acquire LoaderLock. + * LdrpInitializeThread() is executed within new threads to perform + * initialization and to execute DllMain() of all loaded dlls. + * As a result, all new threads are deadlocked in their initialization phase and never execute, + * even though CreateThread() reports successful thread creation. + * This results in a very weird process-wide behavior, which is extremely hard to debug. + * + * THREADS SHOULD NEVER BE TERMINATED. Period. + * + * But for now, check if thread is exiting, and if so, let it die peacefully. */ Tcl_MutexLock(&pipeMutex); - /* BUG: this leaks memory */ - TerminateThread(pipePtr->readThread, 0); + if ( pipePtr->readThreadExiting ) { + WaitForSingleObject(pipePtr->readThread, INFINITE); + } else { + /* BUG: this leaks memory */ + TerminateThread(pipePtr->readThread, 0); + } Tcl_MutexUnlock(&pipeMutex); } } CloseHandle(pipePtr->readThread); + CloseHandle(pipePtr->readThreadInitialized); CloseHandle(pipePtr->readable); CloseHandle(pipePtr->startReader); CloseHandle(pipePtr->stopReader); @@ -1909,8 +1937,8 @@ PipeClose2Proc( if (exitCode == STILL_ACTIVE) { /* - * Set the stop event so that if the reader thread is blocked - * in PipeReaderThread on WaitForMultipleEvents, it will exit + * Set the stop event so that if the writer thread is blocked + * in PipeWriterThread on WaitForMultipleEvents, it will exit * cleanly. */ @@ -1935,17 +1963,35 @@ PipeClose2Proc( * Note that we need to guard against terminating the * thread while it is in the middle of Tcl_ThreadAlert * because it won't be able to release the notifier lock. + * + * Also note that terminating threads during their initialization or teardown phase + * may result in ntdll.dll's LoaderLock to remain locked indefinitely. + * This causes ntdll.dll's LdrpInitializeThread() to deadlock trying to acquire LoaderLock. + * LdrpInitializeThread() is executed within new threads to perform + * initialization and to execute DllMain() of all loaded dlls. + * As a result, all new threads are deadlocked in their initialization phase and never execute, + * even though CreateThread() reports successful thread creation. + * This results in a very weird process-wide behavior, which is extremely hard to debug. + * + * THREADS SHOULD NEVER BE TERMINATED. Period. + * + * But for now, check if thread is exiting, and if so, let it die peacefully. */ Tcl_MutexLock(&pipeMutex); - /* BUG: this leaks memory */ - TerminateThread(pipePtr->writeThread, 0); + if ( pipePtr->writeThreadExiting ) { + WaitForSingleObject(pipePtr->writeThread, INFINITE); + } else { + /* BUG: this leaks memory */ + TerminateThread(pipePtr->writeThread, 0); + } Tcl_MutexUnlock(&pipeMutex); } } CloseHandle(pipePtr->writeThread); + CloseHandle(pipePtr->writeThreadInitialized); CloseHandle(pipePtr->writable); CloseHandle(pipePtr->startWriter); CloseHandle(pipePtr->stopWriter); @@ -2821,6 +2867,11 @@ PipeReaderThread( HANDLE wEvents[2]; DWORD waitResult; + /* + * Let TclpCreateCommandChannel() know that this thread has been initialized + */ + SetEvent(infoPtr->readThreadInitialized); + wEvents[0] = infoPtr->stopReader; wEvents[1] = infoPtr->startReader; @@ -2913,6 +2964,14 @@ PipeReaderThread( Tcl_MutexUnlock(&pipeMutex); } + /* + * Inform PipeClose2Proc() that this thread should not be terminated, since it is about to exit. + * See comment in PipeClose2Proc() for reasons. + */ + Tcl_MutexLock(&pipeMutex); + infoPtr->readThreadExiting = TRUE; + Tcl_MutexUnlock(&pipeMutex); + return 0; } @@ -2945,6 +3004,11 @@ PipeWriterThread( HANDLE wEvents[2]; DWORD waitResult; + /* + * Let TclpCreateCommandChannel() know that this thread has been initialized + */ + SetEvent(infoPtr->writeThreadInitialized); + wEvents[0] = infoPtr->stopWriter; wEvents[1] = infoPtr->startWriter; @@ -3011,6 +3075,14 @@ PipeWriterThread( Tcl_MutexUnlock(&pipeMutex); } + /* + * Inform PipeClose2Proc() that this thread should not be terminated, since it is about to exit. + * See comment in PipeClose2Proc() for reasons. + */ + Tcl_MutexLock(&pipeMutex); + infoPtr->writeThreadExiting = TRUE; + Tcl_MutexUnlock(&pipeMutex); + return 0; } diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 0730a46..3c6a3cc 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -94,6 +94,8 @@ typedef struct SerialInfo { OVERLAPPED osRead; /* OVERLAPPED structure for read operations. */ OVERLAPPED osWrite; /* OVERLAPPED structure for write operations */ HANDLE writeThread; /* Handle to writer thread. */ + HANDLE writeThreadInitialized; /* Manual-reset event to signal that thread has been initialized. */ + int writeThreadExiting; /* Boolean indicating that thread is exiting. */ CRITICAL_SECTION csWrite; /* Writer thread synchronisation. */ HANDLE evWritable; /* Manual-reset event to signal when the * writer thread has finished waiting for the @@ -643,18 +645,35 @@ SerialCloseProc( * Note that we need to guard against terminating the thread * while it is in the middle of Tcl_ThreadAlert because it * won't be able to release the notifier lock. + * + * Also note that terminating threads during their initialization or teardown phase + * may result in ntdll.dll's LoaderLock to remain locked indefinitely. + * This causes ntdll.dll's LdrpInitializeThread() to deadlock trying to acquire LoaderLock. + * LdrpInitializeThread() is executed within new threads to perform + * initialization and to execute DllMain() of all loaded dlls. + * As a result, all new threads are deadlocked in their initialization phase and never execute, + * even though CreateThread() reports successful thread creation. + * This results in a very weird process-wide behavior, which is extremely hard to debug. + * + * THREADS SHOULD NEVER BE TERMINATED. Period. + * + * But for now, check if thread is exiting, and if so, let it die peacefully. */ Tcl_MutexLock(&serialMutex); - /* BUG: this leaks memory */ - TerminateThread(serialPtr->writeThread, 0); - + if ( serialPtr->writeThreadExiting ) { + WaitForSingleObject(serialPtr->writeThread, INFINITE); + } else { + /* BUG: this leaks memory. */ + TerminateThread(serialPtr->writeThread, 0); + } Tcl_MutexUnlock(&serialMutex); } } CloseHandle(serialPtr->writeThread); + CloseHandle(serialPtr->writeThreadInitialized); CloseHandle(serialPtr->osWrite.hEvent); CloseHandle(serialPtr->evWritable); CloseHandle(serialPtr->evStartWriter); @@ -1320,6 +1339,11 @@ SerialWriterThread( HANDLE wEvents[2]; /* + * Notify TclWinOpenSerialChannel() that this thread is initialized + */ + SetEvent(infoPtr->writeThreadInitialized); + + /* * The stop event takes precedence by being first in the list. */ @@ -1404,6 +1428,14 @@ SerialWriterThread( Tcl_MutexUnlock(&serialMutex); } + /* + * Inform SerialCloseProc() that this thread should not be terminated, since it is about to exit. + * See comment in SerialCloseProc() for reasons. + */ + Tcl_MutexLock(&serialMutex); + infoPtr->writeThreadExiting = TRUE; + Tcl_MutexUnlock(&serialMutex); + return 0; } @@ -1531,8 +1563,11 @@ TclWinOpenSerialChannel( infoPtr->evWritable = CreateEvent(NULL, TRUE, TRUE, NULL); infoPtr->evStartWriter = CreateEvent(NULL, FALSE, FALSE, NULL); infoPtr->evStopWriter = CreateEvent(NULL, FALSE, FALSE, NULL); + infoPtr->writeThreadInitialized = CreateEvent(NULL, TRUE, FALSE, NULL); + infoPtr->writeThreadExiting = FALSE; infoPtr->writeThread = CreateThread(NULL, 256, SerialWriterThread, infoPtr, 0, &id); + WaitForSingleObject(infoPtr->writeThreadInitialized, INFINITE); /* wait for thread to initialize */ } /* -- cgit v0.12 From b9cc513f2fc6fc01a9c999ce5397d77a74221742 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 5 Apr 2017 10:40:51 +0000 Subject: small review: rewritten using already available event handles, additionally prevents infinite waits (using timeout 5000ms); --- win/tclWinConsole.c | 55 +++++++++++++++++++--------------- win/tclWinPipe.c | 85 +++++++++++++++++++++++++++++------------------------ win/tclWinSerial.c | 34 ++++++++++----------- 3 files changed, 94 insertions(+), 80 deletions(-) diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 5c0b43b..42bc56f 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -51,14 +51,14 @@ TCL_DECLARE_MUTEX(consoleMutex) typedef struct ConsoleThreadInfo { HANDLE thread; /* Handle to reader or writer thread. */ - HANDLE threadInitialized; /* Manual-reset event to signal that thread has been initialized. */ int threadExiting; /* Boolean indicating that thread is exiting. */ HANDLE readyEvent; /* Manual-reset event to signal _to_ the main * thread when the worker thread has finished * waiting for its normal work to happen. */ HANDLE startEvent; /* Auto-reset event used by the main thread to * signal when the thread should attempt to do - * its normal work. */ + * its normal work. Additionally this event + * used as wait for thread event (init phase). */ HANDLE stopEvent; /* Auto-reset event used by the main thread to * signal when the thread should exit. */ } ConsoleThreadInfo; @@ -538,12 +538,10 @@ StartChannelThread( threadInfoPtr->readyEvent = CreateEvent(NULL, TRUE, TRUE, NULL); threadInfoPtr->startEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - threadInfoPtr->threadInitialized = CreateEvent(NULL, TRUE, FALSE, NULL); threadInfoPtr->threadExiting = FALSE; threadInfoPtr->stopEvent = CreateEvent(NULL, FALSE, FALSE, NULL); threadInfoPtr->thread = CreateThread(NULL, 256, threadProc, infoPtr, 0, &id); - WaitForSingleObject(threadInfoPtr->threadInitialized, INFINITE); /* wait for thread to initialize */ SetThreadPriority(threadInfoPtr->thread, THREAD_PRIORITY_HIGHEST); } @@ -592,14 +590,14 @@ StopChannelThread( * But for now, check if thread is exiting, and if so, let it die peacefully. */ - Tcl_MutexLock(&consoleMutex); - if ( threadInfoPtr->threadExiting ) { - WaitForSingleObject(threadInfoPtr->thread, INFINITE); - } else { - /* BUG: this leaks memory. */ - TerminateThread(threadInfoPtr->thread, 0); + if ( !threadInfoPtr->threadExiting + || WaitForSingleObject(threadInfoPtr->thread, 5000) != WAIT_OBJECT_0 + ) { + Tcl_MutexLock(&consoleMutex); + /* BUG: this leaks memory. */ + TerminateThread(threadInfoPtr->thread, 0); + Tcl_MutexUnlock(&consoleMutex); } - Tcl_MutexUnlock(&consoleMutex); } } @@ -609,7 +607,6 @@ StopChannelThread( */ CloseHandle(threadInfoPtr->thread); - CloseHandle(threadInfoPtr->threadInitialized); CloseHandle(threadInfoPtr->readyEvent); CloseHandle(threadInfoPtr->startEvent); CloseHandle(threadInfoPtr->stopEvent); @@ -1209,9 +1206,10 @@ ConsoleReaderThread( HANDLE wEvents[2]; /* - * Notify StartChannelThread() that this thread is initialized + * Notify caller (using startEvent) that this thread is initialized */ - SetEvent(threadInfo->threadInitialized); + SetEvent(threadInfo->startEvent); + SuspendThread(threadInfo->thread); /* until main thread get an event */ /* * The first event takes precedence. @@ -1282,12 +1280,10 @@ ConsoleReaderThread( } /* - * Inform StopChannelThread() that this thread should not be terminated, since it is about to exit. + * Inform caller that this thread should not be terminated, since it is about to exit. * See comment in StopChannelThread() for reasons. */ - Tcl_MutexLock(&consoleMutex); threadInfo->threadExiting = TRUE; - Tcl_MutexUnlock(&consoleMutex); return 0; } @@ -1323,9 +1319,10 @@ ConsoleWriterThread( HANDLE wEvents[2]; /* - * Notify StartChannelThread() that this thread is initialized + * Notify caller (using startEvent) that this thread is initialized */ - SetEvent(threadInfo->threadInitialized); + SetEvent(threadInfo->startEvent); + SuspendThread(threadInfo->thread); /* until main thread get an event */ /* * The first event takes precedence. @@ -1393,12 +1390,10 @@ ConsoleWriterThread( } /* - * Inform StopChannelThread() that this thread should not be terminated, since it is about to exit. + * Inform caller that this thread should not be terminated, since it is about to exit. * See comment in StopChannelThread() for reasons. */ - Tcl_MutexLock(&consoleMutex); threadInfo->threadExiting = TRUE; - Tcl_MutexUnlock(&consoleMutex); return 0; } @@ -1429,7 +1424,8 @@ TclWinOpenConsoleChannel( { char encoding[4 + TCL_INTEGER_SPACE]; ConsoleInfo *infoPtr; - DWORD modes; + DWORD modes, wEventsCnt = 0; + HANDLE wEvents[2], wEventsPtr = wEvents; ConsoleInit(); @@ -1471,12 +1467,25 @@ TclWinOpenConsoleChannel( modes |= ENABLE_LINE_INPUT; SetConsoleMode(infoPtr->handle, modes); StartChannelThread(infoPtr, &infoPtr->reader, ConsoleReaderThread); + wEvents[wEventsCnt++] = infoPtr->reader.startEvent; } if (permissions & TCL_WRITABLE) { StartChannelThread(infoPtr, &infoPtr->writer, ConsoleWriterThread); + wEvents[wEventsCnt++] = infoPtr->writer.startEvent; } + /* + * Wait for both threads to initialize (using theirs startEvent) + */ + if (wEventsCnt) { + WaitForMultipleObjects(wEventsCnt, wEvents, TRUE, 5000); + /* Resume both waiting threads */ + if (infoPtr->reader.thread) + ResumeThread(infoPtr->reader.thread); + if (infoPtr->writer.thread) + ResumeThread(infoPtr->writer.thread); + } /* * Files have default translation of AUTO and ^Z eof char, which means * that a ^Z will be accepted as EOF when reading. diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 9677792..48dcc25 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -111,10 +111,8 @@ typedef struct PipeInfo { * threads. */ HANDLE writeThread; /* Handle to writer thread. */ HANDLE readThread; /* Handle to reader thread. */ - HANDLE writeThreadInitialized; /* Manual-reset event to signal that writer thread has been initialized */ - HANDLE readThreadInitialized; /* Manual-reset event to signal that reader thread has been initialized */ - int writeThreadExiting; /* Boolean indicating that write thread is exiting */ - int readThreadExiting; /* Boolean indicating that read thread is exiting */ + int writeThreadExiting; /* Boolean indicating that write thread is exiting */ + int readThreadExiting; /* Boolean indicating that read thread is exiting */ HANDLE writable; /* Manual-reset event to signal when the * writer thread has finished waiting for the * current buffer to be written. */ @@ -123,12 +121,14 @@ typedef struct PipeInfo { * input. */ HANDLE startWriter; /* Auto-reset event used by the main thread to * signal when the writer thread should - * attempt to write to the pipe. */ + * attempt to write to the pipe. Additionally + * this event used as wait for thread event (init). */ HANDLE stopWriter; /* Manual-reset event used to alert the reader * thread to fall-out and exit */ HANDLE startReader; /* Auto-reset event used by the main thread to * signal when the reader thread should - * attempt to read from the pipe. */ + * attempt to read from the pipe. Additionally + * this event used as wait for thread event (init). */ HANDLE stopReader; /* Manual-reset event used to alert the reader * thread to fall-out and exit */ DWORD writeError; /* An error caused by the last background @@ -1575,7 +1575,8 @@ TclpCreateCommandChannel( Tcl_Pid *pidPtr) /* An array of process identifiers. */ { char channelName[16 + TCL_INTEGER_SPACE]; - DWORD id; + DWORD id, wEventsCnt = 0; + HANDLE wEvents[2]; PipeInfo *infoPtr = ckalloc(sizeof(PipeInfo)); PipeInit(); @@ -1605,13 +1606,12 @@ TclpCreateCommandChannel( infoPtr->readable = CreateEvent(NULL, TRUE, TRUE, NULL); infoPtr->startReader = CreateEvent(NULL, FALSE, FALSE, NULL); infoPtr->stopReader = CreateEvent(NULL, TRUE, FALSE, NULL); - infoPtr->readThreadInitialized = CreateEvent(NULL, TRUE, FALSE, NULL); infoPtr->readThreadExiting = FALSE; infoPtr->readThread = CreateThread(NULL, 256, PipeReaderThread, infoPtr, 0, &id); - WaitForSingleObject(infoPtr->readThreadInitialized, INFINITE); /* wait for thread to initialize */ SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_READABLE; + wEvents[wEventsCnt++] = infoPtr->startReader; } else { infoPtr->readThread = 0; } @@ -1623,13 +1623,26 @@ TclpCreateCommandChannel( infoPtr->writable = CreateEvent(NULL, TRUE, TRUE, NULL); infoPtr->startWriter = CreateEvent(NULL, FALSE, FALSE, NULL); infoPtr->stopWriter = CreateEvent(NULL, TRUE, FALSE, NULL); - infoPtr->writeThreadInitialized = CreateEvent(NULL, TRUE, FALSE, NULL); infoPtr->writeThreadExiting = FALSE; infoPtr->writeThread = CreateThread(NULL, 256, PipeWriterThread, infoPtr, 0, &id); - WaitForSingleObject(infoPtr->writeThreadInitialized, INFINITE); /* wait for thread to initialize */ SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_WRITABLE; + wEvents[wEventsCnt++] = infoPtr->startWriter; + } else { + infoPtr->writeThread = 0; + } + + /* + * Wait for both threads to initialize (using theirs start-events) + */ + if (wEventsCnt) { + WaitForMultipleObjects(wEventsCnt, wEvents, TRUE, 5000); + /* Resume both waiting threads */ + if (infoPtr->readThread) + ResumeThread(infoPtr->readThread); + if (infoPtr->writeThread) + ResumeThread(infoPtr->writeThread); } /* @@ -1878,20 +1891,18 @@ PipeClose2Proc( * But for now, check if thread is exiting, and if so, let it die peacefully. */ - Tcl_MutexLock(&pipeMutex); - - if ( pipePtr->readThreadExiting ) { - WaitForSingleObject(pipePtr->readThread, INFINITE); - } else { - /* BUG: this leaks memory */ - TerminateThread(pipePtr->readThread, 0); + if ( !pipePtr->readThreadExiting + || WaitForSingleObject(pipePtr->readThread, 5000) != WAIT_OBJECT_0 + ) { + Tcl_MutexLock(&pipeMutex); + /* BUG: this leaks memory */ + TerminateThread(pipePtr->readThread, 0); + Tcl_MutexUnlock(&pipeMutex); } - Tcl_MutexUnlock(&pipeMutex); } } CloseHandle(pipePtr->readThread); - CloseHandle(pipePtr->readThreadInitialized); CloseHandle(pipePtr->readable); CloseHandle(pipePtr->startReader); CloseHandle(pipePtr->stopReader); @@ -1978,20 +1989,18 @@ PipeClose2Proc( * But for now, check if thread is exiting, and if so, let it die peacefully. */ - Tcl_MutexLock(&pipeMutex); - - if ( pipePtr->writeThreadExiting ) { - WaitForSingleObject(pipePtr->writeThread, INFINITE); - } else { - /* BUG: this leaks memory */ - TerminateThread(pipePtr->writeThread, 0); + if ( !pipePtr->writeThreadExiting + || WaitForSingleObject(pipePtr->writeThread, 5000) != WAIT_OBJECT_0 + ) { + Tcl_MutexLock(&pipeMutex); + /* BUG: this leaks memory */ + TerminateThread(pipePtr->writeThread, 0); + Tcl_MutexUnlock(&pipeMutex); } - Tcl_MutexUnlock(&pipeMutex); } } CloseHandle(pipePtr->writeThread); - CloseHandle(pipePtr->writeThreadInitialized); CloseHandle(pipePtr->writable); CloseHandle(pipePtr->startWriter); CloseHandle(pipePtr->stopWriter); @@ -2868,9 +2877,10 @@ PipeReaderThread( DWORD waitResult; /* - * Let TclpCreateCommandChannel() know that this thread has been initialized + * Notify caller that this thread has been initialized */ - SetEvent(infoPtr->readThreadInitialized); + SetEvent(infoPtr->startReader); + SuspendThread(infoPtr->readThread); /* until main thread get an event */ wEvents[0] = infoPtr->stopReader; wEvents[1] = infoPtr->startReader; @@ -2965,12 +2975,10 @@ PipeReaderThread( } /* - * Inform PipeClose2Proc() that this thread should not be terminated, since it is about to exit. + * Inform caller that this thread should not be terminated, since it is about to exit. * See comment in PipeClose2Proc() for reasons. */ - Tcl_MutexLock(&pipeMutex); infoPtr->readThreadExiting = TRUE; - Tcl_MutexUnlock(&pipeMutex); return 0; } @@ -3005,9 +3013,10 @@ PipeWriterThread( DWORD waitResult; /* - * Let TclpCreateCommandChannel() know that this thread has been initialized + * Notify caller that this thread has been initialized */ - SetEvent(infoPtr->writeThreadInitialized); + SetEvent(infoPtr->startWriter); + SuspendThread(infoPtr->writeThread); /* until main thread get an event */ wEvents[0] = infoPtr->stopWriter; wEvents[1] = infoPtr->startWriter; @@ -3076,12 +3085,10 @@ PipeWriterThread( } /* - * Inform PipeClose2Proc() that this thread should not be terminated, since it is about to exit. + * Inform caller that this thread should not be terminated, since it is about to exit. * See comment in PipeClose2Proc() for reasons. */ - Tcl_MutexLock(&pipeMutex); infoPtr->writeThreadExiting = TRUE; - Tcl_MutexUnlock(&pipeMutex); return 0; } diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 3c6a3cc..fa135ab 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -94,15 +94,15 @@ typedef struct SerialInfo { OVERLAPPED osRead; /* OVERLAPPED structure for read operations. */ OVERLAPPED osWrite; /* OVERLAPPED structure for write operations */ HANDLE writeThread; /* Handle to writer thread. */ - HANDLE writeThreadInitialized; /* Manual-reset event to signal that thread has been initialized. */ - int writeThreadExiting; /* Boolean indicating that thread is exiting. */ + int writeThreadExiting; /* Boolean indicating that thread is exiting. */ CRITICAL_SECTION csWrite; /* Writer thread synchronisation. */ HANDLE evWritable; /* Manual-reset event to signal when the * writer thread has finished waiting for the * current buffer to be written. */ HANDLE evStartWriter; /* Auto-reset event used by the main thread to * signal when the writer thread should - * attempt to write to the serial. */ + * attempt to write to the serial. Additionally + * this event used as wait for thread event (init). */ HANDLE evStopWriter; /* Auto-reset event used by the main thread to * signal when the writer thread should close. */ @@ -660,20 +660,18 @@ SerialCloseProc( * But for now, check if thread is exiting, and if so, let it die peacefully. */ - Tcl_MutexLock(&serialMutex); - - if ( serialPtr->writeThreadExiting ) { - WaitForSingleObject(serialPtr->writeThread, INFINITE); - } else { - /* BUG: this leaks memory. */ - TerminateThread(serialPtr->writeThread, 0); + if ( !serialPtr->writeThreadExiting + || WaitForSingleObject(serialPtr->writeThread, 5000) != WAIT_OBJECT_0 + ) { + Tcl_MutexLock(&serialMutex); + /* BUG: this leaks memory. */ + TerminateThread(serialPtr->writeThread, 0); + Tcl_MutexUnlock(&serialMutex); } - Tcl_MutexUnlock(&serialMutex); } } CloseHandle(serialPtr->writeThread); - CloseHandle(serialPtr->writeThreadInitialized); CloseHandle(serialPtr->osWrite.hEvent); CloseHandle(serialPtr->evWritable); CloseHandle(serialPtr->evStartWriter); @@ -1341,7 +1339,8 @@ SerialWriterThread( /* * Notify TclWinOpenSerialChannel() that this thread is initialized */ - SetEvent(infoPtr->writeThreadInitialized); + SetEvent(infoPtr->evStartWriter); + SuspendThread(infoPtr->writeThread); /* until main thread get an event */ /* * The stop event takes precedence by being first in the list. @@ -1429,12 +1428,10 @@ SerialWriterThread( } /* - * Inform SerialCloseProc() that this thread should not be terminated, since it is about to exit. + * Inform caller that this thread should not be terminated, since it is about to exit. * See comment in SerialCloseProc() for reasons. */ - Tcl_MutexLock(&serialMutex); infoPtr->writeThreadExiting = TRUE; - Tcl_MutexUnlock(&serialMutex); return 0; } @@ -1563,11 +1560,12 @@ TclWinOpenSerialChannel( infoPtr->evWritable = CreateEvent(NULL, TRUE, TRUE, NULL); infoPtr->evStartWriter = CreateEvent(NULL, FALSE, FALSE, NULL); infoPtr->evStopWriter = CreateEvent(NULL, FALSE, FALSE, NULL); - infoPtr->writeThreadInitialized = CreateEvent(NULL, TRUE, FALSE, NULL); infoPtr->writeThreadExiting = FALSE; infoPtr->writeThread = CreateThread(NULL, 256, SerialWriterThread, infoPtr, 0, &id); - WaitForSingleObject(infoPtr->writeThreadInitialized, INFINITE); /* wait for thread to initialize */ + /* Wait for thread to initialize (using evStartWriter) */ + WaitForSingleObject(infoPtr->evStartWriter, 5000); + ResumeThread(infoPtr->writeThread); } /* -- cgit v0.12 From 2ae10f0b3391991adbe6138238681d4d0f3ead11 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 5 Apr 2017 10:41:05 +0000 Subject: fix typo-bug (using wrong thread handle by set priority) --- win/tclWinPipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 48dcc25..fce039c 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1626,7 +1626,7 @@ TclpCreateCommandChannel( infoPtr->writeThreadExiting = FALSE; infoPtr->writeThread = CreateThread(NULL, 256, PipeWriterThread, infoPtr, 0, &id); - SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); + SetThreadPriority(infoPtr->writeThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_WRITABLE; wEvents[wEventsCnt++] = infoPtr->startWriter; } else { -- cgit v0.12 From ceb75ca9ffc56aa82860dae87970bee9d91914f3 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 5 Apr 2017 19:52:23 +0000 Subject: the same handling to initialize thread without suspend/resume helpers (otherwise may be dangerous by very huge resp. too busy system); --- win/tclWinConsole.c | 12 +++++------- win/tclWinPipe.c | 14 +++++++------- win/tclWinSerial.c | 6 +++--- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index 42bc56f..d4893ee 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -1208,8 +1208,7 @@ ConsoleReaderThread( /* * Notify caller (using startEvent) that this thread is initialized */ - SetEvent(threadInfo->startEvent); - SuspendThread(threadInfo->thread); /* until main thread get an event */ + SignalObjectAndWait(threadInfo->startEvent, threadInfo->stopEvent, INFINITE, FALSE); /* * The first event takes precedence. @@ -1321,8 +1320,7 @@ ConsoleWriterThread( /* * Notify caller (using startEvent) that this thread is initialized */ - SetEvent(threadInfo->startEvent); - SuspendThread(threadInfo->thread); /* until main thread get an event */ + SignalObjectAndWait(threadInfo->startEvent, threadInfo->stopEvent, INFINITE, FALSE); /* * The first event takes precedence. @@ -1480,11 +1478,11 @@ TclWinOpenConsoleChannel( */ if (wEventsCnt) { WaitForMultipleObjects(wEventsCnt, wEvents, TRUE, 5000); - /* Resume both waiting threads */ + /* Resume both waiting threads, we've get the events */ if (infoPtr->reader.thread) - ResumeThread(infoPtr->reader.thread); + SetEvent(infoPtr->reader.stopEvent); if (infoPtr->writer.thread) - ResumeThread(infoPtr->writer.thread); + SetEvent(infoPtr->writer.stopEvent); } /* * Files have default translation of AUTO and ^Z eof char, which means diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index fce039c..523d4eb 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1638,11 +1638,11 @@ TclpCreateCommandChannel( */ if (wEventsCnt) { WaitForMultipleObjects(wEventsCnt, wEvents, TRUE, 5000); - /* Resume both waiting threads */ + /* Resume both waiting threads, we've get the events */ if (infoPtr->readThread) - ResumeThread(infoPtr->readThread); + SetEvent(infoPtr->stopReader); if (infoPtr->writeThread) - ResumeThread(infoPtr->writeThread); + SetEvent(infoPtr->stopWriter); } /* @@ -2879,8 +2879,8 @@ PipeReaderThread( /* * Notify caller that this thread has been initialized */ - SetEvent(infoPtr->startReader); - SuspendThread(infoPtr->readThread); /* until main thread get an event */ + SignalObjectAndWait(infoPtr->startReader, infoPtr->stopReader, INFINITE, FALSE); + ResetEvent(infoPtr->stopReader); /* not auto-reset */ wEvents[0] = infoPtr->stopReader; wEvents[1] = infoPtr->startReader; @@ -3015,8 +3015,8 @@ PipeWriterThread( /* * Notify caller that this thread has been initialized */ - SetEvent(infoPtr->startWriter); - SuspendThread(infoPtr->writeThread); /* until main thread get an event */ + SignalObjectAndWait(infoPtr->startWriter, infoPtr->stopWriter, INFINITE, FALSE); + ResetEvent(infoPtr->stopWriter); /* not auto-reset */ wEvents[0] = infoPtr->stopWriter; wEvents[1] = infoPtr->startWriter; diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index fa135ab..f55f5f1 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -1339,8 +1339,7 @@ SerialWriterThread( /* * Notify TclWinOpenSerialChannel() that this thread is initialized */ - SetEvent(infoPtr->evStartWriter); - SuspendThread(infoPtr->writeThread); /* until main thread get an event */ + SignalObjectAndWait(infoPtr->evStartWriter, infoPtr->evStopWriter, INFINITE, FALSE); /* * The stop event takes precedence by being first in the list. @@ -1565,7 +1564,8 @@ TclWinOpenSerialChannel( infoPtr, 0, &id); /* Wait for thread to initialize (using evStartWriter) */ WaitForSingleObject(infoPtr->evStartWriter, 5000); - ResumeThread(infoPtr->writeThread); + /* Wake-up it to signal we've get an event */ + SetEvent(infoPtr->evStopWriter); } /* -- cgit v0.12 From de59a00a303f0acfad8f990f62e5095d0e327298 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 7 Apr 2017 14:48:49 +0000 Subject: Use "0o" in stead of "0" as octal prefix in more places. --- generic/tclStringObj.c | 21 +++++---------------- tests/chanio.test | 8 ++++---- tests/format.test | 4 ++-- tests/io.test | 4 ++-- 4 files changed, 13 insertions(+), 24 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index c574003..239f88f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1880,20 +1880,10 @@ Tcl_AppendFormatToObj( format += step; step = Tcl_UtfToUniChar(format, &ch); } - } else if ((ch == 't') || (ch == 'z')) { + } else if ((ch == 't') || (ch == 'z') || (ch == 'q') || (ch == 'j') || (ch == 'L')) { format += step; step = Tcl_UtfToUniChar(format, &ch); -#ifndef TCL_WIDE_INT_IS_LONG - if (sizeof(size_t) > sizeof(int)) { - useWide = 1; - } -#endif - } else if ((ch == 'q') ||(ch == 'j')) { - format += step; - step = Tcl_UtfToUniChar(format, &ch); -#ifndef TCL_WIDE_INT_IS_LONG - useWide = 1; -#endif + useBig = 1; } format += step; @@ -2035,9 +2025,8 @@ Tcl_AppendFormatToObj( if (gotHash || (ch == 'p')) { switch (ch) { case 'o': - Tcl_AppendToObj(segment, "0", 1); - segmentLimit -= 1; - precision--; + Tcl_AppendToObj(segment, "0o", 2); + segmentLimit -= 2; break; case 'p': case 'x': @@ -2186,7 +2175,7 @@ Tcl_AppendFormatToObj( * Need to be sure zero becomes "0", not "". */ - if ((numDigits == 0) && !((ch == 'o') && gotHash)) { + if (numDigits == 0) { numDigits = 1; } pure = Tcl_NewObj(); diff --git a/tests/chanio.test b/tests/chanio.test index 8e27af9..2d900d0 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -5338,22 +5338,22 @@ test chan-io-40.2 {POSIX open access modes: CREAT} -setup { } -constraints {unix} -body { set f [open $path(test3) {WRONLY CREAT} 0600] file stat $path(test3) stats - set x [format "0%o" [expr $stats(mode)&0o777]] + set x [format "%#o" [expr $stats(mode)&0o777]] chan puts $f "line 1" chan close $f set f [open $path(test3) r] lappend x [chan gets $f] } -cleanup { chan close $f -} -result {0600 {line 1}} +} -result {0o600 {line 1}} test chan-io-40.3 {POSIX open access modes: CREAT} -setup { file delete $path(test3) } -constraints {unix umask} -body { # This test only works if your umask is 2, like ouster's. chan close [open $path(test3) {WRONLY CREAT}] file stat $path(test3) stats - format "0%o" [expr $stats(mode)&0o777] -} -result [format %04o [expr {0o666 & ~ $umaskValue}]] + format "%#o" [expr $stats(mode)&0o777] +} -result [format %#5o [expr {0o666 & ~ $umaskValue}]] test chan-io-40.4 {POSIX open access modes: CREAT} -setup { file delete $path(test3) } -body { diff --git a/tests/format.test b/tests/format.test index ad127a4..801a735 100644 --- a/tests/format.test +++ b/tests/format.test @@ -72,10 +72,10 @@ test format-1.10.1 {integer formatting} longIs64bit { } {0 0x6 0x22 0x421b 0xfffffffffffffff4 } test format-1.11 {integer formatting} longIs32bit { format "%-#5o %-#20o %#-20o %#-20o %#-20o" 0 6 34 16923 -12 -1 -} {0 06 042 041033 037777777764 } +} {0 0o6 0o42 0o41033 0o37777777764 } test format-1.11.1 {integer formatting} longIs64bit { format "%-#5o %-#20o %#-20o %#-20o %#-20o" 0 6 34 16923 -12 -1 -} {0 06 042 041033 01777777777777777777764} +} {0 0o6 0o42 0o41033 0o1777777777777777777764} test format-1.12 {integer formatting} { format "%b %#b %llb" 5 5 [expr {2**100}] } {101 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} diff --git a/tests/io.test b/tests/io.test index 6e7420d..aaceec5 100644 --- a/tests/io.test +++ b/tests/io.test @@ -5652,8 +5652,8 @@ test io-40.3 {POSIX open access modes: CREAT} {unix umask} { set f [open $path(test3) {WRONLY CREAT}] close $f file stat $path(test3) stats - format "0%o" [expr $stats(mode)&0o777] -} [format %04o [expr {0o666 & ~ $umaskValue}]] + format "%#o" [expr $stats(mode)&0o777] +} [format %#5o [expr {0o666 & ~ $umaskValue}]] test io-40.4 {POSIX open access modes: CREAT} { file delete $path(test3) set f [open $path(test3) w] -- cgit v0.12 From bbfc7b1ea2d467b198933a82184a6c53de48ac00 Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 10 Apr 2017 16:21:31 +0000 Subject: More minor style fixes. --- generic/tclIO.c | 729 ++++++++++++++++++++++++++++----------------------- generic/tclIORChan.c | 57 ++-- generic/tclIOUtil.c | 51 ++-- generic/tclTimer.c | 12 +- unix/tclUnixSock.c | 48 ++-- win/tclWinSock.c | 150 ++++++----- 6 files changed, 572 insertions(+), 475 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index a509ebf..32fbd59 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -321,7 +321,7 @@ static int WillRead(Channel *chanPtr); typedef struct ResolvedChanName { ChannelState *statePtr; /* The saved lookup result */ Tcl_Interp *interp; /* The interp in which the lookup was done. */ - size_t epoch; /* The epoch of the channel when the lookup + size_t epoch; /* The epoch of the channel when the lookup * was done. Use to verify validity. */ size_t refCount; /* Share this struct among many Tcl_Obj. */ } ResolvedChanName; @@ -381,20 +381,20 @@ ChanCloseHalf( * * ChanRead -- * - * Read up to dstSize bytes using the inputProc of chanPtr, store - * them at dst, and return the number of bytes stored. + * Read up to dstSize bytes using the inputProc of chanPtr, store them at + * dst, and return the number of bytes stored. * * Results: * The return value of the driver inputProc, * - number of bytes stored at dst, ot - * - -1 on error, with a Posix error code available to the - * caller by calling Tcl_GetErrno(). + * - -1 on error, with a Posix error code available to the caller by + * calling Tcl_GetErrno(). * * Side effects: - * The CHANNEL_BLOCKED and CHANNEL_EOF flags of the channel state are - * set as appropriate. - * On EOF, the inputEncodingFlags are set to perform ending operations - * on decoding. + * The CHANNEL_BLOCKED and CHANNEL_EOF flags of the channel state are set + * as appropriate. On EOF, the inputEncodingFlags are set to perform + * ending operations on decoding. + * * TODO - Is this really the right place for that? * *--------------------------------------------------------------------------- @@ -408,15 +408,17 @@ ChanRead( int bytesRead, result; /* - * If the caller asked for zero bytes, we'd force the inputProc - * to return zero bytes, and then misinterpret that as EOF. + * If the caller asked for zero bytes, we'd force the inputProc to return + * zero bytes, and then misinterpret that as EOF. */ + assert(dstSize > 0); /* * Each read op must set the blocked and eof states anew, not let * the effect of prior reads leak through. */ + if (GotFlag(chanPtr->state, CHANNEL_EOF)) { chanPtr->state->inputEncodingFlags |= TCL_ENCODING_START; } @@ -429,7 +431,10 @@ ChanRead( bytesRead = chanPtr->typePtr->inputProc(chanPtr->instanceData, dst, dstSize, &result); - /* Stop any flag leakage through stacked channel levels */ + /* + * Stop any flag leakage through stacked channel levels. + */ + if (GotFlag(chanPtr->state, CHANNEL_EOF)) { chanPtr->state->inputEncodingFlags |= TCL_ENCODING_START; } @@ -437,10 +442,10 @@ ChanRead( chanPtr->state->inputEncodingFlags &= ~TCL_ENCODING_END; if (bytesRead > 0) { /* - * If we get a short read, signal up that we may be BLOCKED. - * We should avoid calling the driver because on some - * platforms we will block in the low level reading code even - * though the channel is set into nonblocking mode. + * If we get a short read, signal up that we may be BLOCKED. We should + * avoid calling the driver because on some platforms we will block in + * the low level reading code even though the channel is set into + * nonblocking mode. */ if (bytesRead < dstSize) { @@ -574,7 +579,10 @@ TclFinalizeIOSubsystem(void) int active = 1; /* Flag == 1 while there's still work to do */ int doflushnb; - /* Fetch the pre-TIP#398 compatibility flag */ + /* + * Fetch the pre-TIP#398 compatibility flag. + */ + { const char *s; Tcl_DString ds; @@ -619,18 +627,20 @@ TclFinalizeIOSubsystem(void) */ if (active) { - TclChannelPreserve((Tcl_Channel)chanPtr); + /* - * TIP #398: by default, we no longer set the channel back into - * blocking mode. To restore the old blocking behavior, the - * environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT must be set + * TIP #398: by default, we no longer set the channel back into + * blocking mode. To restore the old blocking behavior, the + * environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT must be set * and not be "0". */ + if (doflushnb) { - /* Set the channel back into blocking mode to ensure that we wait - * for all data to flush out. - */ + /* + * Set the channel back into blocking mode to ensure that we + * wait for all data to flush out. + */ (void) Tcl_SetChannelOption(NULL, (Tcl_Channel) chanPtr, "-blocking", "on"); @@ -1511,8 +1521,10 @@ TclGetChannelFromObj( if ((resPtr->interp == interp) /* Same interp context */ /* No epoch change in channel since lookup */ && (resPtr->epoch == statePtr->epoch)) { + /* + * Have a valid saved lookup. Jump to end to return it. + */ - /* Have a valid saved lookup. Jump to end to return it. */ goto valid; } } @@ -1527,7 +1539,10 @@ TclGetChannelFromObj( } if (resPtr && resPtr->refCount == 1) { - /* Re-use the ResolvedCmdName struct */ + /* + * Re-use the ResolvedCmdName struct. + */ + Tcl_Release((ClientData) resPtr->statePtr); } else { @@ -1671,7 +1686,7 @@ Tcl_CreateChannel( * Set the channel up initially in AUTO input translation mode to accept * "\n", "\r" and "\r\n". Output translation mode is set to a platform * specific default value. The eofChar is set to 0 for both input and - * output, so that Tcl does not look for an in-file EOF indicator (e.g. + * output, so that Tcl does not look for an in-file EOF indicator (e.g., * ^Z) and does not append an EOF indicator to files. */ @@ -1899,7 +1914,6 @@ Tcl_StackChannel( */ if (((mask & TCL_READABLE) != 0) && (statePtr->inQueueHead != NULL)) { - /* * When statePtr->inQueueHead is not NULL, we know * prevChanPtr->inQueueHead must be NULL. @@ -2031,9 +2045,7 @@ Tcl_UnstackChannel( * of registered channels we wind down the state of the * transformation, and then restore the state of underlying channel * into the old structure. - */ - - /* + * * TODO: Figure out how to handle the situation where the chan * operations called below by this unstacking operation cause * another unstacking recursively. In that case the downChanPtr @@ -2511,6 +2523,7 @@ RecycleBuffer( /* * Do we have to free the buffer to the OS? */ + if (IsShared(bufPtr)) { mustDiscard = 1; } @@ -2521,9 +2534,8 @@ RecycleBuffer( } /* - * Only save buffers which have the requested buffersize for the - * channel. This is to honor dynamic changes of the buffersize - * made by the user. + * Only save buffers which have the requested buffersize for the channel. + * This is to honor dynamic changes of the buffersize made by the user. */ if ((bufPtr->bufLength - BUFFER_PADDING) != statePtr->bufSize) { @@ -2693,14 +2705,18 @@ FlushChannel( /* * Should we shift the current output buffer over to the output queue? * First check that there are bytes in it. If so then... - * If the output queue is empty, then yes, trusting the caller called - * us only when written bytes ought to be flushed. - * If the current output buffer is full, then yes, so we can meet - * the post-condition that on a successful return to caller we've - * left space in the current output buffer for more writing (the flush - * call was to make new room). - * If the channel is blocking, then yes, so we guarantee that - * blocking flushes actually flush all pending data. + * + * If the output queue is empty, then yes, trusting the caller called us + * only when written bytes ought to be flushed. + * + * If the current output buffer is full, then yes, so we can meet the + * post-condition that on a successful return to caller we've left space + * in the current output buffer for more writing (the flush call was to + * make new room). + * + * If the channel is blocking, then yes, so we guarantee that blocking + * flushes actually flush all pending data. + * * Otherwise, no. Keep the current output buffer where it is so more * can be written to it, possibly filling it, to promote more efficient * buffer usage. @@ -2794,8 +2810,8 @@ FlushChannel( /* * TIP #219, Tcl Channel Reflection API. * When defering the error copy a message from the bypass into - * the unreported area. Or discard it if the new error is to be - * ignored in favor of an earlier defered error. + * the unreported area. Or discard it if the new error is to + * be ignored in favor of an earlier defered error. */ Tcl_Obj *msg = statePtr->chanMsg; @@ -2847,8 +2863,11 @@ FlushChannel( ReleaseChannelBuffer(bufPtr); break; } else { - /* TODO: Consider detecting and reacting to short writes - * on blocking channels. Ought not happen. See iocmd-24.2. */ + /* + * TODO: Consider detecting and reacting to short writes on + * blocking channels. Ought not happen. See iocmd-24.2. + */ + wroteSome = 1; } @@ -2882,7 +2901,6 @@ FlushChannel( ResetFlag(statePtr, BG_FLUSH_SCHEDULED); ChanWatch(chanPtr, statePtr->interestMask); } else { - /* * When we are calledFromAsyncFlush, that means a writable * state on the channel triggered the call, so we should be @@ -2927,7 +2945,8 @@ FlushChannel( (statePtr->outQueueHead == NULL) && ((statePtr->curOutPtr == NULL) || IsBufferEmpty(statePtr->curOutPtr))) { - errorCode = CloseChannelPart(interp, chanPtr, errorCode, TCL_CLOSE_WRITE); + errorCode = CloseChannelPart(interp, chanPtr, errorCode, + TCL_CLOSE_WRITE); goto done; } @@ -3398,7 +3417,6 @@ Tcl_Close( if (GotFlag(statePtr, TCL_WRITABLE) && (statePtr->encoding != NULL) && !(statePtr->outputEncodingFlags & TCL_ENCODING_START)) { - int code = CheckChannelErrors(statePtr, TCL_WRITABLE); if (code == 0) { @@ -3488,12 +3506,14 @@ Tcl_Close( } return TCL_ERROR; } + /* * Bug 97069ea11a: set error message if a flush code is set and no error * message set up to now. */ + if (flushcode != 0 && interp != NULL - && 0 == Tcl_GetCharLength(Tcl_GetObjResult(interp)) ) { + && 0 == Tcl_GetCharLength(Tcl_GetObjResult(interp))) { Tcl_SetErrno(flushcode); Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_PosixError(interp), -1)); @@ -3588,8 +3608,8 @@ Tcl_CloseEx( } /* - * A user may try to call half-close from within a channel close - * handler. That won't do. + * A user may try to call half-close from within a channel close handler. + * That won't do. */ if (statePtr->flags & CHANNEL_INCLOSE) { @@ -3660,9 +3680,12 @@ CloseWrite( * closed. May still be used by some * interpreter */ { - /* Notes: clear-channel-handlers - write side only ? or keep around, just - * not called. */ - /* No close cllbacks are run - channel is still open (read side) */ + /* + * Notes: clear-channel-handlers - write side only ? or keep around, just + * not called. + * + * No close callbacks are run - channel is still open (read side) + */ ChannelState *statePtr = chanPtr->state; /* State of real IO channel. */ @@ -3687,9 +3710,9 @@ CloseWrite( * Notes: Due to the assertion of CHANNEL_CLOSEDWRITE in the flags * FlushChannel() has called CloseChannelPart(). While we can still access * "chan" (no structures were freed), the only place which may still - * contain a message is the interpreter itself, and "CloseChannelPart" made - * sure to lift any channel message it generated into it. Hence the NULL - * argument in the call below. + * contain a message is the interpreter itself, and "CloseChannelPart" + * made sure to lift any channel message it generated into it. Hence the + * NULL argument in the call below. */ if (TclChanCaughtErrorBypass(interp, NULL)) { @@ -3913,10 +3936,10 @@ Tcl_ClearChannelHandlers( StopCopy(statePtr->csPtrW); /* - * Must set the interest mask now to 0, otherwise infinite loops - * will occur if Tcl_DoOneEvent is called before the channel is - * finally deleted in FlushChannel. This can happen if the channel - * has a background flush active. + * Must set the interest mask now to 0, otherwise infinite loops will + * occur if Tcl_DoOneEvent is called before the channel is finally deleted + * in FlushChannel. This can happen if the channel has a background flush + * active. */ statePtr->interestMask = 0; @@ -4185,22 +4208,24 @@ WillRead( Channel *chanPtr) { if (chanPtr->typePtr == NULL) { - /* Prevent read attempts on a closed channel */ + /* + * Prevent read attempts on a closed channel. + */ + DiscardInputQueued(chanPtr->state, 0); Tcl_SetErrno(EINVAL); return -1; } if ((chanPtr->typePtr->seekProc != NULL) && (Tcl_OutputBuffered((Tcl_Channel) chanPtr) > 0)) { - /* - * CAVEAT - The assumption here is that FlushChannel() will - * push out the bytes of any writes that are in progress. - * Since this is a seekable channel, we assume it is not one - * that can block and force bg flushing. Channels we know that - * can do that -- sockets, pipes -- are not seekable. If the - * assumption is wrong, more drastic measures may be required here - * like temporarily setting the channel into blocking mode. + * CAVEAT - The assumption here is that FlushChannel() will push out + * the bytes of any writes that are in progress. Since this is a + * seekable channel, we assume it is not one that can block and force + * bg flushing. Channels we know that can do that - sockets, pipes - + * are not seekable. If the assumption is wrong, more drastic measures + * may be required here like temporarily setting the channel into + * blocking mode. */ if (FlushChannel(NULL, chanPtr, 0) != 0) { @@ -4292,11 +4317,17 @@ Write( &statePtr->outputEncodingState, dst, dstLen + BUFFER_PADDING, &srcRead, &dstWrote, NULL); - /* See chan-io-1.[89]. Tcl Bug 506297. */ + /* + * See chan-io-1.[89]. Tcl Bug 506297. + */ + statePtr->outputEncodingFlags &= ~TCL_ENCODING_START; if ((result != TCL_OK) && (srcRead + dstWrote == 0)) { - /* We're reading from invalid/incomplete UTF-8 */ + /* + * We're reading from invalid/incomplete UTF-8. + */ + ReleaseChannelBuffer(bufPtr); if (total == 0) { Tcl_SetErrno(EINVAL); @@ -4336,11 +4367,10 @@ Write( } result |= Tcl_UtfToExternal(NULL, encoding, nl, nlLen, - statePtr->outputEncodingFlags, - &statePtr->outputEncodingState, dst, - dstLen + BUFFER_PADDING, &srcRead, &dstWrote, NULL); - - assert (srcRead == nlLen); + statePtr->outputEncodingFlags, + &statePtr->outputEncodingState, dst, + dstLen + BUFFER_PADDING, &srcRead, &dstWrote, NULL); + assert(srcRead == nlLen); bufPtr->nextAdded += dstWrote; src++; @@ -4354,11 +4384,11 @@ Write( if (IsBufferOverflowing(bufPtr)) { /* - * When translating from UTF-8 to external encoding, we - * allowed the translation to produce a character that crossed - * the end of the output buffer, so that we would get a - * completely full buffer before flushing it. The extra bytes - * will be moved to the beginning of the next buffer. + * When translating from UTF-8 to external encoding, we allowed + * the translation to produce a character that crossed the end of + * the output buffer, so that we would get a completely full + * buffer before flushing it. The extra bytes will be moved to the + * beginning of the next buffer. */ saved = -SpaceLeft(bufPtr); @@ -4378,15 +4408,16 @@ Write( flushed += statePtr->bufSize; /* - * We just flushed. So if we have needNlFlush set to record - * that we need to flush because theres a (translated) newline - * in the buffer, that's likely not true any more. But there - * is a tricky exception. If we have saved bytes that did not - * really get flushed and those bytes came from a translation - * of a newline as the last thing taken from the src array, - * then needNlFlush needs to remain set to flag that the - * next buffer still needs a newline flush. + * We just flushed. So if we have needNlFlush set to record that + * we need to flush because theres a (translated) newline in the + * buffer, that's likely not true any more. But there is a tricky + * exception. If we have saved bytes that did not really get + * flushed and those bytes came from a translation of a newline as + * the last thing taken from the src array, then needNlFlush needs + * to remain set to flag that the next buffer still needs a + * newline flush. */ + if (needNlFlush && (saved == 0 || src[-1] != '\n')) { needNlFlush = 0; } @@ -4492,8 +4523,8 @@ Tcl_GetsObj( if (GotFlag(statePtr, CHANNEL_STICKY_EOF)) { SetFlag(statePtr, CHANNEL_EOF); - assert( statePtr->inputEncodingFlags & TCL_ENCODING_END ); - assert( !GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR) ); + assert(statePtr->inputEncodingFlags & TCL_ENCODING_END); + assert(!GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR)); /* TODO: Do we need this? */ UpdateInterest(chanPtr); @@ -4833,17 +4864,17 @@ Tcl_GetsObj( */ done: - assert(!GotFlag(statePtr, CHANNEL_EOF) - || GotFlag(statePtr, CHANNEL_STICKY_EOF) - || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); - - assert( !(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) - == (CHANNEL_EOF|CHANNEL_BLOCKED)) ); + assert(!GotFlag(statePtr, CHANNEL_EOF) + || GotFlag(statePtr, CHANNEL_STICKY_EOF) + || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); + assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) + == (CHANNEL_EOF|CHANNEL_BLOCKED))); /* * Regenerate the top channel, in case it was changed due to * self-modifying reflected transforms. */ + if (chanPtr != statePtr->topChanPtr) { TclChannelRelease((Tcl_Channel)chanPtr); chanPtr = statePtr->topChanPtr; @@ -4863,10 +4894,9 @@ Tcl_GetsObj( * end-of-line or end-of-file has been seen. Bytes read from the input * channel return as a ByteArray obj. * - * WARNING! The notion of "binary" used here is different from - * notions of "binary" used in other places. In particular, this - * "binary" routine may be called when an -eofchar is set on the - * channel. + * WARNING! The notion of "binary" used here is different from notions + * of "binary" used in other places. In particular, this "binary" routine + * may be called when an -eofchar is set on the channel. * * Results: * Number of characters accumulated in the object or -1 if error, @@ -4932,8 +4962,8 @@ TclGetsObjBinary( ResetFlag(statePtr, CHANNEL_BLOCKED); while (1) { /* - * Subtract the number of bytes that were removed from channel - * buffer during last call. + * Subtract the number of bytes that were removed from channel buffer + * during last call. */ if (bufPtr != NULL) { @@ -4945,10 +4975,11 @@ TclGetsObjBinary( if ((bufPtr == NULL) || (bufPtr->nextAdded == BUFFER_PADDING)) { /* - * All channel buffers were exhausted and the caller still - * hasn't seen EOL. Need to read more bytes from the channel - * device. Side effect is to allocate another channel buffer. + * All channel buffers were exhausted and the caller still hasn't + * seen EOL. Need to read more bytes from the channel device. Side + * effect is to allocate another channel buffer. */ + if (GetInput(chanPtr) != 0) { goto restore; } @@ -4958,15 +4989,15 @@ TclGetsObjBinary( } } else { /* - * Incoming CHANNEL_STICKY_EOF is filtered out on entry. - * A new CHANNEL_STICKY_EOF set in this routine leads to - * return before coming back here. When we are not dealing - * with CHANNEL_STICKY_EOF, a CHANNEL_EOF implies an - * empty buffer. Here the buffer is non-empty so we know - * we're a non-EOF */ + * Incoming CHANNEL_STICKY_EOF is filtered out on entry. A new + * CHANNEL_STICKY_EOF set in this routine leads to return before + * coming back here. When we are not dealing with + * CHANNEL_STICKY_EOF, a CHANNEL_EOF implies an empty buffer. + * Here the buffer is non-empty so we know we're a non-EOF. + */ - assert ( !GotFlag(statePtr, CHANNEL_STICKY_EOF) ); - assert ( !GotFlag(statePtr, CHANNEL_EOF) ); + assert(!GotFlag(statePtr, CHANNEL_STICKY_EOF)); + assert(!GotFlag(statePtr, CHANNEL_EOF)); } dst = (unsigned char *) RemovePoint(bufPtr); @@ -5033,8 +5064,8 @@ TclGetsObjBinary( } /* - * Copy bytes from the channel buffer to the ByteArray. - * This may realloc space, so keep track of result. + * Copy bytes from the channel buffer to the ByteArray. This may + * realloc space, so keep track of result. */ rawLen = dstEnd - dst; @@ -5118,11 +5149,11 @@ TclGetsObjBinary( */ done: - assert(!GotFlag(statePtr, CHANNEL_EOF) - || GotFlag(statePtr, CHANNEL_STICKY_EOF) - || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); - assert( !(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) - == (CHANNEL_EOF|CHANNEL_BLOCKED)) ); + assert(!GotFlag(statePtr, CHANNEL_EOF) + || GotFlag(statePtr, CHANNEL_STICKY_EOF) + || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); + assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) + == (CHANNEL_EOF|CHANNEL_BLOCKED))); UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return copiedTotal; @@ -5255,15 +5286,15 @@ FilterInputBytes( } } else { /* - * Incoming CHANNEL_STICKY_EOF is filtered out on entry. - * A new CHANNEL_STICKY_EOF set in this routine leads to - * return before coming back here. When we are not dealing - * with CHANNEL_STICKY_EOF, a CHANNEL_EOF implies an - * empty buffer. Here the buffer is non-empty so we know - * we're a non-EOF */ + * Incoming CHANNEL_STICKY_EOF is filtered out on entry. A new + * CHANNEL_STICKY_EOF set in this routine leads to return before + * coming back here. When we are not dealing with CHANNEL_STICKY_EOF, + * a CHANNEL_EOF implies an empty buffer. Here the buffer is + * non-empty so we know we're a non-EOF. + */ - assert ( !GotFlag(statePtr, CHANNEL_STICKY_EOF) ); - assert ( !GotFlag(statePtr, CHANNEL_EOF) ); + assert(!GotFlag(statePtr, CHANNEL_STICKY_EOF)); + assert(!GotFlag(statePtr, CHANNEL_EOF)); } /* @@ -5593,7 +5624,9 @@ Tcl_ReadRaw( return -1; } - /* First read bytes from the push-back buffers. */ + /* + * First read bytes from the push-back buffers. + */ while (chanPtr->inQueueHead && bytesToRead > 0) { ChannelBuffer *bufPtr = chanPtr->inQueueHead; @@ -5601,7 +5634,9 @@ Tcl_ReadRaw( int toCopy = (bytesInBuffer < bytesToRead) ? bytesInBuffer : bytesToRead; - /* Copy the current chunk into the read buffer. */ + /* + * Copy the current chunk into the read buffer. + */ memcpy(readBuf, RemovePoint(bufPtr), (size_t) toCopy); bufPtr->nextRemoved += toCopy; @@ -5609,7 +5644,9 @@ Tcl_ReadRaw( readBuf += toCopy; bytesToRead -= toCopy; - /* If the current buffer is empty recycle it. */ + /* + * If the current buffer is empty recycle it. + */ if (IsBufferEmpty(bufPtr)) { chanPtr->inQueueHead = bufPtr->nextPtr; @@ -5621,37 +5658,40 @@ Tcl_ReadRaw( } /* - * Go to the driver only if we got nothing from pushback. - * Have to do it this way to avoid EOF mis-timings when we - * consider the ability that EOF may not be a permanent - * condition in the driver, and in that case we have to - * synchronize. + * Go to the driver only if we got nothing from pushback. Have to do it + * this way to avoid EOF mis-timings when we consider the ability that EOF + * may not be a permanent condition in the driver, and in that case we + * have to synchronize. */ if (copied) { return copied; } - /* This test not needed. */ - if (bytesToRead > 0) { + /* + * This test not needed. + */ + if (bytesToRead > 0) { int nread = ChanRead(chanPtr, readBuf, bytesToRead); if (nread > 0) { - /* Successful read (short is OK) - add to bytes copied */ + /* + * Successful read (short is OK) - add to bytes copied. + */ + copied += nread; } else if (nread < 0) { /* - * An error signaled. If CHANNEL_BLOCKED, then the error - * is not real, but an indication of blocked state. In - * that case, retain the flag and let caller receive the - * short read of copied bytes from the pushback. - * HOWEVER, if copied==0 bytes from pushback then repeat - * signalling the blocked state as an error to caller so - * there is no false report of an EOF. - * When !CHANNEL_BLOCKED, the error is real and passes on - * to caller. + * An error signaled. If CHANNEL_BLOCKED, then the error is not + * real, but an indication of blocked state. In that case, retain + * the flag and let caller receive the short read of copied bytes + * from the pushback. HOWEVER, if copied==0 bytes from pushback + * then repeat signalling the blocked state as an error to caller + * so there is no false report of an EOF. When !CHANNEL_BLOCKED, + * the error is real and passes on to caller. */ + if (!GotFlag(statePtr, CHANNEL_BLOCKED) || copied == 0) { copied = -1; } @@ -5788,21 +5828,23 @@ DoReadChars( /* * Early out when next read will see eofchar. * - * NOTE: See DoRead for argument that it's a bug (one we're keeping) - * to have this escape before the one for zero-char read request. + * NOTE: See DoRead for argument that it's a bug (one we're keeping) to + * have this escape before the one for zero-char read request. */ if (GotFlag(statePtr, CHANNEL_STICKY_EOF)) { SetFlag(statePtr, CHANNEL_EOF); - assert( statePtr->inputEncodingFlags & TCL_ENCODING_END ); - assert( !GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR) ); + assert(statePtr->inputEncodingFlags & TCL_ENCODING_END); + assert(!GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR)); /* TODO: We don't need this call? */ UpdateInterest(chanPtr); return 0; } - /* Special handling for zero-char read request. */ + /* + * Special handling for zero-char read request. + */ if (toRead == 0) { if (GotFlag(statePtr, CHANNEL_EOF)) { statePtr->inputEncodingFlags |= TCL_ENCODING_START; @@ -5821,7 +5863,10 @@ DoReadChars( chanPtr = statePtr->topChanPtr; TclChannelPreserve((Tcl_Channel)chanPtr); - /* Must clear the BLOCKED|EOF flags here since we check before reading */ + /* + * Must clear the BLOCKED|EOF flags here since we check before reading. + */ + if (GotFlag(statePtr, CHANNEL_EOF)) { statePtr->inputEncodingFlags |= TCL_ENCODING_START; } @@ -5879,10 +5924,11 @@ DoReadChars( } /* - * Failure to fill a channel buffer may have left channel reporting - * a "blocked" state, but so long as we fulfilled the request here, - * the caller does not consider us blocked. + * Failure to fill a channel buffer may have left channel reporting a + * "blocked" state, but so long as we fulfilled the request here, the + * caller does not consider us blocked. */ + if (toRead == 0) { ResetFlag(statePtr, CHANNEL_BLOCKED); } @@ -5891,6 +5937,7 @@ DoReadChars( * Regenerate the top channel, in case it was changed due to * self-modifying reflected transforms. */ + if (chanPtr != statePtr->topChanPtr) { TclChannelRelease((Tcl_Channel)chanPtr); chanPtr = statePtr->topChanPtr; @@ -5901,11 +5948,12 @@ DoReadChars( * Update the notifier state so we don't block while there is still data * in the buffers. */ - assert(!GotFlag(statePtr, CHANNEL_EOF) - || GotFlag(statePtr, CHANNEL_STICKY_EOF) - || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); - assert( !(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) - == (CHANNEL_EOF|CHANNEL_BLOCKED)) ); + + assert(!GotFlag(statePtr, CHANNEL_EOF) + || GotFlag(statePtr, CHANNEL_STICKY_EOF) + || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); + assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) + == (CHANNEL_EOF|CHANNEL_BLOCKED))); UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return copied; @@ -6022,11 +6070,10 @@ ReadChars( int numBytes, srcLen = BytesLeft(bufPtr); /* - * One src byte can yield at most one character. So when the - * number of src bytes we plan to read is less than the limit on - * character count to be read, clearly we will remain within that - * limit, and we can use the value of "srcLen" as a tighter limit - * for sizing receiving buffers. + * One src byte can yield at most one character. So when the number of + * src bytes we plan to read is less than the limit on character count to + * be read, clearly we will remain within that limit, and we can use the + * value of "srcLen" as a tighter limit for sizing receiving buffers. */ int toRead = ((charsToRead<0)||(charsToRead > srcLen)) ? srcLen : charsToRead; @@ -6044,6 +6091,7 @@ ReadChars( Tcl_AppendToObj(objPtr, NULL, dstLimit); if (toRead == srcLen) { unsigned int size; + dst = TclGetStringStorage(objPtr, &size) + numBytes; dstLimit = size - numBytes; } else { @@ -6051,19 +6099,18 @@ ReadChars( } /* - * This routine is burdened with satisfying several constraints. - * It cannot append more than 'charsToRead` chars onto objPtr. - * This is measured after encoding and translation transformations - * are completed. There is no precise number of src bytes that can - * be associated with the limit. Yet, when we are done, we must know - * precisely the number of src bytes that were consumed to produce - * the appended chars, so that all subsequent bytes are left in - * the buffers for future read operations. + * This routine is burdened with satisfying several constraints. It cannot + * append more than 'charsToRead` chars onto objPtr. This is measured + * after encoding and translation transformations are completed. There is + * no precise number of src bytes that can be associated with the limit. + * Yet, when we are done, we must know precisely the number of src bytes + * that were consumed to produce the appended chars, so that all + * subsequent bytes are left in the buffers for future read operations. * - * The consequence is that we have no choice but to implement a - * "trial and error" approach, where in general we may need to - * perform transformations and copies multiple times to achieve - * a consistent set of results. This takes the shape of a loop. + * The consequence is that we have no choice but to implement a "trial and + * error" approach, where in general we may need to perform + * transformations and copies multiple times to achieve a consistent set + * of results. This takes the shape of a loop. */ while (1) { @@ -6076,18 +6123,17 @@ ReadChars( } /* - * Perform the encoding transformation. Read no more than - * srcLen bytes, write no more than dstLimit bytes. + * Perform the encoding transformation. Read no more than srcLen + * bytes, write no more than dstLimit bytes. * - * Some trickiness with encoding flags here. We do not want - * the end of a buffer to be treated as the end of all input - * when the presence of bytes in a next buffer are already - * known to exist. This is checked with an assert() because - * so far no test case causing the assertion to be false has - * been created. The normal operations of channel reading - * appear to cause EOF and TCL_ENCODING_END setting to appear - * only in situations where there are no further bytes in - * any buffers. + * Some trickiness with encoding flags here. We do not want the end + * of a buffer to be treated as the end of all input when the presence + * of bytes in a next buffer are already known to exist. This is + * checked with an assert() because so far no test case causing the + * assertion to be false has been created. The normal operations of + * channel reading appear to cause EOF and TCL_ENCODING_END setting to + * appear only in situations where there are no further bytes in any + * buffers. */ assert(bufPtr->nextPtr == NULL || BytesLeft(bufPtr->nextPtr) == 0 @@ -6098,10 +6144,10 @@ ReadChars( dst, dstLimit, &srcRead, &dstDecoded, &numChars); /* - * Perform the translation transformation in place. Read no more - * than the dstDecoded bytes the encoding transformation actually - * produced. Capture the number of bytes written in dstWrote. - * Capture the number of bytes actually consumed in dstRead. + * Perform the translation transformation in place. Read no more than + * the dstDecoded bytes the encoding transformation actually produced. + * Capture the number of bytes written in dstWrote. Capture the number + * of bytes actually consumed in dstRead. */ dstWrote = dstLimit; @@ -6109,11 +6155,9 @@ ReadChars( TranslateInputEOL(statePtr, dst, dst, &dstWrote, &dstRead); if (dstRead < dstDecoded) { - /* - * The encoding transformation produced bytes that the - * translation transformation did not consume. Why did - * this happen? + * The encoding transformation produced bytes that the translation + * transformation did not consume. Why did this happen? */ if (statePtr->inEofChar && dst[dstRead] == statePtr->inEofChar) { @@ -6122,40 +6166,38 @@ ReadChars( * we saw it and stopped translating at that point. * * NOTE the bizarre spec of TranslateInputEOL in this case. - * Clearly the eof char had to be read in order to account - * for the stopping, but the value of dstRead does not - * include it. + * Clearly the eof char had to be read in order to account for + * the stopping, but the value of dstRead does not include it. * - * Also rather bizarre, our caller can only notice an - * EOF condition if we return the value -1 as the number - * of chars read. This forces us to perform a 2-call - * dance where the first call can read all the chars - * up to the eof char, and the second call is solely - * for consuming the encoded eof char then pointed at - * by src so that we can return that magic -1 value. - * This seems really wasteful, especially since - * the first decoding pass of each call is likely to - * decode many bytes beyond that eof char that's all we - * care about. + * Also rather bizarre, our caller can only notice an EOF + * condition if we return the value -1 as the number of chars + * read. This forces us to perform a 2-call dance where the + * first call can read all the chars up to the eof char, and + * the second call is solely for consuming the encoded eof + * char then pointed at by src so that we can return that + * magic -1 value. This seems really wasteful, especially + * since the first decoding pass of each call is likely to + * decode many bytes beyond that eof char that's all we care + * about. */ if (dstRead == 0) { /* - * Curious choice in the eof char handling. We leave - * the eof char in the buffer. So, no need to compute - * a proper srcRead value. At this point, there - * are no chars before the eof char in the buffer. + * Curious choice in the eof char handling. We leave the + * eof char in the buffer. So, no need to compute a proper + * srcRead value. At this point, there are no chars before + * the eof char in the buffer. */ + Tcl_SetObjLength(objPtr, numBytes); return -1; } { /* - * There are chars leading the buffer before the eof - * char. Adjust the dstLimit so we go back and read - * only those and do not encounter the eof char this - * time. + * There are chars leading the buffer before the eof char. + * Adjust the dstLimit so we go back and read only those + * and do not encounter the eof char this time. */ dstLimit = dstRead - 1 + TCL_UTF_MAX; @@ -6167,10 +6209,9 @@ ReadChars( } /* - * 2) The other way to read fewer bytes than are decoded - * is when the final byte is \r and we're in a CRLF - * translation mode so we cannot decide whether to - * record \r or \n yet. + * 2) The other way to read fewer bytes than are decoded is when + * the final byte is \r and we're in a CRLF translation mode so + * we cannot decide whether to record \r or \n yet. */ assert(dst[dstRead] == '\r'); @@ -6178,10 +6219,10 @@ ReadChars( if (dstWrote > 0) { /* - * There are chars we can read before we hit the bare cr. - * Go back with a smaller dstLimit so we get them in the - * next pass, compute a matching srcRead, and don't end - * up back here in this call. + * There are chars we can read before we hit the bare CR. Go + * back with a smaller dstLimit so we get them in the next + * pass, compute a matching srcRead, and don't end up back + * here in this call. */ dstLimit = dstRead - 1 + TCL_UTF_MAX; @@ -6195,9 +6236,9 @@ ReadChars( assert(dstRead == 0); /* - * We decoded only the bare cr, and we cannot read a - * translated char from that alone. We have to know what's - * next. So why do we only have the one decoded char? + * We decoded only the bare CR, and we cannot read a translated + * char from that alone. We have to know what's next. So why do + * we only have the one decoded char? */ if (code != TCL_OK) { @@ -6238,10 +6279,9 @@ ReadChars( } } else if (statePtr->flags & CHANNEL_EOF) { - /* - * The bare \r is the only char and we will never read - * a subsequent char to make the determination. + * The bare \r is the only char and we will never read a + * subsequent char to make the determination. */ dst[0] = '\r'; @@ -6251,8 +6291,8 @@ ReadChars( } /* - * Revise the dstRead value so that the numChars calc - * below correctly computes zero characters read. + * Revise the dstRead value so that the numChars calc below + * correctly computes zero characters read. */ dstRead = numChars; @@ -6261,9 +6301,9 @@ ReadChars( } /* - * The translation transformation can only reduce the number - * of chars when it converts \r\n into \n. The reduction in - * the number of chars is the difference in bytes read and written. + * The translation transformation can only reduce the number of chars + * when it converts \r\n into \n. The reduction in the number of chars + * is the difference in bytes read and written. */ numChars -= (dstRead - dstWrote); @@ -6273,10 +6313,9 @@ ReadChars( /* * TODO: This cannot happen anymore. * - * We read more chars than allowed. Reset limits to - * prevent that and try again. Don't forget the extra - * padding of TCL_UTF_MAX bytes demanded by the - * Tcl_ExternalToUtf() call! + * We read more chars than allowed. Reset limits to prevent that + * and try again. Don't forget the extra padding of TCL_UTF_MAX + * bytes demanded by the Tcl_ExternalToUtf() call! */ dstLimit = Tcl_UtfAtIndex(dst, charsToRead) - 1 + TCL_UTF_MAX - dst; @@ -6289,18 +6328,19 @@ ReadChars( if (dstWrote == 0) { ChannelBuffer *nextPtr; - /* We were not able to read any chars. */ + /* + * We were not able to read any chars. + */ - assert (numChars == 0); + assert(numChars == 0); /* - * There is one situation where this is the correct final - * result. If the src buffer contains only a single \n - * byte, and we are in TCL_TRANSLATE_AUTO mode, and - * when the translation pass was made the INPUT_SAW_CR - * flag was set on the channel. In that case, the - * correct behavior is to consume that \n and produce the - * empty string. + * There is one situation where this is the correct final result. + * If the src buffer contains only a single \n byte, and we are in + * TCL_TRANSLATE_AUTO mode, and when the translation pass was made + * the INPUT_SAW_CR flag was set on the channel. In that case, the + * correct behavior is to consume that \n and produce the empty + * string. */ if (dstRead == 1 && dst[0] == '\n') { @@ -6309,12 +6349,13 @@ ReadChars( goto consume; } - /* Otherwise, reading zero characters indicates there's - * something incomplete at the end of the src buffer. - * Maybe there were not enough src bytes to decode into - * a char. Maybe a lone \r could not be translated (crlf - * mode). Need to combine any unused src bytes we have - * in the first buffer with subsequent bytes to try again. + /* + * Otherwise, reading zero characters indicates there's something + * incomplete at the end of the src buffer. Maybe there were not + * enough src bytes to decode into a char. Maybe a lone \r could + * not be translated (crlf mode). Need to combine any unused src + * bytes we have in the first buffer with subsequent bytes to try + * again. */ nextPtr = bufPtr->nextPtr; @@ -6329,15 +6370,15 @@ ReadChars( /* * Space is made at the beginning of the buffer to copy the - * previous unused bytes there. Check first if the buffer we - * are using actually has enough space at its beginning for - * the data we are copying. Because if not we will write over - * the buffer management information, especially the 'nextPtr'. + * previous unused bytes there. Check first if the buffer we are + * using actually has enough space at its beginning for the data + * we are copying. Because if not we will write over the buffer + * management information, especially the 'nextPtr'. * - * Note that the BUFFER_PADDING (See AllocChannelBuffer) is - * used to prevent exactly this situation. I.e. it should never - * happen. Therefore it is ok to panic should it happen despite - * the precautions. + * Note that the BUFFER_PADDING (See AllocChannelBuffer) is used + * to prevent exactly this situation. I.e. it should never happen. + * Therefore it is ok to panic should it happen despite the + * precautions. */ if (nextPtr->nextRemoved - srcLen < 0) { @@ -6356,10 +6397,12 @@ ReadChars( consume: bufPtr->nextRemoved += srcRead; + /* - * If this read contained multibyte characters, revise factorPtr - * so the next read will allocate bigger buffers. + * If this read contained multibyte characters, revise factorPtr so + * the next read will allocate bigger buffers. */ + if (numChars && numChars < srcRead) { *factorPtr = srcRead * UTF_EXPANSION_FACTOR / numChars; } @@ -6407,22 +6450,27 @@ TranslateInputEOL( int inEofChar = statePtr->inEofChar; /* - * Depending on the translation mode in use, there's no need - * to scan more srcLen bytes at srcStart than can possibly transform - * to dstLen bytes. This keeps the scan for eof char below from - * being pointlessly long. + * Depending on the translation mode in use, there's no need to scan more + * srcLen bytes at srcStart than can possibly transform to dstLen bytes. + * This keeps the scan for eof char below from being pointlessly long. */ switch (statePtr->inputTranslation) { case TCL_TRANSLATE_LF: case TCL_TRANSLATE_CR: if (srcLen > dstLen) { - /* In these modes, each src byte become a dst byte. */ + /* + * In these modes, each src byte become a dst byte. + */ + srcLen = dstLen; } break; default: - /* In other modes, at most 2 src bytes become a dst byte. */ + /* + * In other modes, at most 2 src bytes become a dst byte. + */ + if (srcLen/2 > dstLen) { srcLen = 2 * dstLen; } @@ -6755,7 +6803,7 @@ GetInput( * eofchar. */ - assert( !GotFlag(statePtr, CHANNEL_STICKY_EOF) ); + assert(!GotFlag(statePtr, CHANNEL_STICKY_EOF)); /* * Prevent reading from a dead channel -- a channel that has been closed @@ -6769,24 +6817,21 @@ GetInput( } /* - * WARNING: There was once a comment here claiming that it was - * a bad idea to make another call to the inputproc of a channel - * driver when EOF has already been detected on the channel. Through - * much of Tcl's history, this warning was then completely negated - * by having all (most?) read paths clear the EOF setting before - * reaching here. So we had a guard that was never triggered. + * WARNING: There was once a comment here claiming that it was a bad idea + * to make another call to the inputproc of a channel driver when EOF has + * already been detected on the channel. Through much of Tcl's history, + * this warning was then completely negated by having all (most?) read + * paths clear the EOF setting before reaching here. So we had a guard + * that was never triggered. + * + * Don't be tempted to restore the guard. Even if EOF is set on the + * channel, continue through and call the inputproc again. This is the + * way to enable the ability to [read] again beyond the EOF, which seems a + * strange thing to do, but for which use cases exist [Tcl Bug 5adc350683] + * and which may even be essential for channels representing things like + * ttys or other devices where the stream might take the logical form of a + * series of 'files' separated by an EOF condition. * - * Don't be tempted to restore the guard. Even if EOF is set on - * the channel, continue through and call the inputproc again. This - * is the way to enable the ability to [read] again beyond the EOF, - * which seems a strange thing to do, but for which use cases exist - * [Tcl Bug 5adc350683] and which may even be essential for channels - * representing things like ttys or other devices where the stream - * might take the logical form of a series of 'files' separated by - * an EOF condition. - */ - - /* * First check for more buffers in the pushback area of the topmost * channel in the stack and use them. They can be the result of a * transformation which went away without reading all the information @@ -6794,7 +6839,6 @@ GetInput( */ if (chanPtr->inQueueHead != NULL) { - /* TODO: Tests to cover this. */ assert(statePtr->inQueueHead == NULL); @@ -6824,8 +6868,9 @@ GetInput( /* * Check the actual buffersize against the requested buffersize. - * Saved buffers of the wrong size are squashed. This is done - * to honor dynamic changes of the buffersize made by the user. + * Saved buffers of the wrong size are squashed. This is done to honor + * dynamic changes of the buffersize made by the user. + * * TODO: Tests to cover this. */ @@ -7132,7 +7177,7 @@ Tcl_Tell( * Truncate a channel to the given length. * * Results: - * TCL_OK on success, TCL_ERROR if the operation failed (e.g. is not + * 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). * @@ -9492,7 +9537,10 @@ CopyData( } if (size == 0) { if (!GotFlag(inStatePtr, CHANNEL_NONBLOCKING)) { - /* We allowed a short read. Keep trying. */ + /* + * We allowed a short read. Keep trying. + */ + continue; } if (bufObj != NULL) { @@ -9706,7 +9754,7 @@ DoRead( ChannelState *statePtr = chanPtr->state; char *p = dst; - assert (bytesToRead >= 0); + assert(bytesToRead >= 0); /* * Early out when we know a read will get the eofchar. @@ -9722,15 +9770,18 @@ DoRead( if (GotFlag(statePtr, CHANNEL_STICKY_EOF)) { SetFlag(statePtr, CHANNEL_EOF); - assert( statePtr->inputEncodingFlags & TCL_ENCODING_END ); - assert( !GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR) ); + assert(statePtr->inputEncodingFlags & TCL_ENCODING_END); + assert(!GotFlag(statePtr, CHANNEL_BLOCKED|INPUT_SAW_CR)); /* TODO: Don't need this call */ UpdateInterest(chanPtr); return 0; } - /* Special handling for zero-char read request. */ + /* + * Special handling for zero-char read request. + */ + if (bytesToRead == 0) { if (GotFlag(statePtr, CHANNEL_EOF)) { statePtr->inputEncodingFlags |= TCL_ENCODING_START; @@ -9745,8 +9796,8 @@ DoRead( TclChannelPreserve((Tcl_Channel)chanPtr); while (bytesToRead) { /* - * Each pass through the loop is intended to process up to - * one channel buffer. + * Each pass through the loop is intended to process up to one channel + * buffer. */ int bytesRead, bytesWritten; @@ -9758,33 +9809,39 @@ DoRead( while (!bufPtr || /* We got no buffer! OR */ (!IsBufferFull(bufPtr) && /* Our buffer has room AND */ - (BytesLeft(bufPtr) < bytesToRead) ) ) { - /* Not enough bytes in it - * yet to fill the dst */ + (BytesLeft(bufPtr) < bytesToRead))) { + /* Not enough bytes in it yet + * to fill the dst */ int code; moreData: code = GetInput(chanPtr); bufPtr = statePtr->inQueueHead; - assert (bufPtr != NULL); + assert(bufPtr != NULL); if (GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED)) { - /* Further reads cannot do any more */ + /* + * Further reads cannot do any more. + */ + break; } if (code) { - /* Read error */ + /* + * Read error + */ + UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return -1; } - assert (IsBufferFull(bufPtr)); + assert(IsBufferFull(bufPtr)); } - assert (bufPtr != NULL); + assert(bufPtr != NULL); bytesRead = BytesLeft(bufPtr); bytesWritten = bytesToRead; @@ -9799,8 +9856,8 @@ DoRead( /* * Buffer is not empty. How can that be? * - * 0) We stopped early because we got all the bytes - * we were seeking. That's fine. + * 0) We stopped early because we got all the bytes we were + * seeking. That's fine. */ if (bytesToRead == 0) { @@ -9816,8 +9873,8 @@ DoRead( } /* - * 2) The buffer holds a \r while in CRLF translation, - * followed by the end of the buffer. + * 2) The buffer holds a \r while in CRLF translation, followed by + * the end of the buffer. */ assert(statePtr->inputTranslation == TCL_TRANSLATE_CRLF); @@ -9825,26 +9882,38 @@ DoRead( assert(BytesLeft(bufPtr) == 1); if (bufPtr->nextPtr == NULL) { - /* There's no more buffered data.... */ + /* + * There's no more buffered data... + */ if (statePtr->flags & CHANNEL_EOF) { - /* ...and there never will be. */ + /* + * ...and there never will be. + */ *p++ = '\r'; bytesToRead--; bufPtr->nextRemoved++; } else if (statePtr->flags & CHANNEL_BLOCKED) { - /* ...and we cannot get more now. */ + /* + * ...and we cannot get more now. + */ + SetFlag(statePtr, CHANNEL_NEED_MORE_DATA); break; } else { - /* ... so we need to get some. */ + /* + * ...so we need to get some. + */ + goto moreData; } } if (bufPtr->nextPtr) { - /* There's a next buffer. Shift orphan \r to it. */ + /* + * There's a next buffer. Shift orphan \r to it. + */ ChannelBuffer *nextPtr = bufPtr->nextPtr; @@ -9869,8 +9938,8 @@ DoRead( } /* - * When there's no buffered data to read, and we're at EOF, - * escape to the caller. + * When there's no buffered data to read, and we're at EOF, escape to + * the caller. */ if (GotFlag(statePtr, CHANNEL_EOF) @@ -9882,11 +9951,11 @@ DoRead( ResetFlag(statePtr, CHANNEL_BLOCKED); } - assert(!GotFlag(statePtr, CHANNEL_EOF) - || GotFlag(statePtr, CHANNEL_STICKY_EOF) - || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); - assert( !(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) - == (CHANNEL_EOF|CHANNEL_BLOCKED)) ); + assert(!GotFlag(statePtr, CHANNEL_EOF) + || GotFlag(statePtr, CHANNEL_STICKY_EOF) + || Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0); + assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED) + == (CHANNEL_EOF|CHANNEL_BLOCKED))); UpdateInterest(chanPtr); TclChannelRelease((Tcl_Channel)chanPtr); return (int)(p - dst); diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 2fed3f4..433fb6f 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -851,11 +851,12 @@ TclChanPostEventObjCmd( } /* - * Note that the search above subsumes several of the older checks, namely: + * Note that the search above subsumes several of the older checks, + * namely: * - * (1) Does the channel handle refer to a reflected channel ? + * (1) Does the channel handle refer to a reflected channel? * (2) Is the post event issued from the interpreter holding the handler - * of the reflected channel ? + * of the reflected channel? * * A successful search answers yes to both. Because the map holds only * handles of reflected channels, and only of such whose handler is @@ -939,7 +940,8 @@ TclChanPostEventObjCmd( (void) GetThreadReflectedChannelMap(); - /* XXX Race condition !! + /* + * XXX Race condition !! * XXX The destination thread may not exist anymore already. * XXX (Delayed postevent executed after channel got removed). * XXX Can we detect this ? (check the validity of the owner threadid ?) @@ -1221,8 +1223,8 @@ ReflectClose( #endif tctPtr = ((Channel *)rcPtr->chan)->typePtr; if (tctPtr && tctPtr != &tclRChannelType) { - ckfree(tctPtr); - ((Channel *)rcPtr->chan)->typePtr = NULL; + ckfree(tctPtr); + ((Channel *)rcPtr->chan)->typePtr = NULL; } Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel); return (result == TCL_OK) ? EOK : EINVAL; @@ -1272,7 +1274,10 @@ ReflectInput( if (p.base.code != TCL_OK) { if (p.base.code < 0) { - /* No error message, this is an errno signal. */ + /* + * No error message, this is an errno signal. + */ + *errorCodePtr = -p.base.code; } else { PassReceivedError(rcPtr->chan, &p); @@ -1375,7 +1380,10 @@ ReflectOutput( if (p.base.code != TCL_OK) { if (p.base.code < 0) { - /* No error message, this is an errno signal. */ + /* + * No error message, this is an errno signal. + */ + *errorCodePtr = -p.base.code; } else { PassReceivedError(rcPtr->chan, &p); @@ -1426,8 +1434,8 @@ ReflectOutput( if ((written == 0) && (toWrite > 0)) { /* - * The handler claims to have written nothing of what it was - * given. That is bad. + * The handler claims to have written nothing of what it was given. + * That is bad. */ SetChannelErrorStr(rcPtr->chan, msg_write_nothing); @@ -2373,8 +2381,8 @@ InvokeTclMethod( * None. * * Users: - * ReflectInput/Output(), to enable the signaling of EAGAIN - * on 0-sized short reads/writes. + * ReflectInput/Output(), to enable the signaling of EAGAIN on 0-sized + * short reads/writes. * *---------------------------------------------------------------------- */ @@ -2560,7 +2568,10 @@ DeleteReflectedChannelMap( evPtr = resultPtr->evPtr; - /* Basic crash safety until this routine can get revised [3411310] */ + /* + * Basic crash safety until this routine can get revised [3411310] + */ + if (evPtr == NULL) { continue; } @@ -2675,8 +2686,8 @@ DeleteThreadReflectedChannelMap( /* * Go through the list of pending results and cancel all whose events were - * destined for this thread. While this is in progress we block any - * other access to the list of pending results. + * destined for this thread. While this is in progress we block any other + * access to the list of pending results. */ Tcl_MutexLock(&rcForwardMutex); @@ -2707,7 +2718,10 @@ DeleteThreadReflectedChannelMap( evPtr = resultPtr->evPtr; - /* Basic crash safety until this routine can get revised [3411310] */ + /* + * Basic crash safety until this routine can get revised [3411310] + */ + if (evPtr == NULL ) { continue; } @@ -2761,8 +2775,8 @@ ForwardOpToHandlerThread( const void *param) /* Arguments */ { /* - * Core of the communication from OWNER to HANDLER thread. - * The receiver is ForwardProc() below. + * Core of the communication from OWNER to HANDLER thread. The receiver is + * ForwardProc() below. */ Tcl_ThreadId dst = rcPtr->thread; @@ -2812,7 +2826,10 @@ ForwardOpToHandlerThread( */ TclSpliceIn(resultPtr, forwardList); - /* Do not unlock here. That is done by the ConditionWait */ + + /* + * Do not unlock here. That is done by the ConditionWait. + */ /* * Ensure cleanup of the event if the origin thread exits while this event @@ -2888,7 +2905,7 @@ ForwardProc( * Notes regarding access to the referenced data. * * In principle the data belongs to the originating thread (see - * evPtr->src), however this thread is currently blocked at (*), i.e. + * evPtr->src), however this thread is currently blocked at (*), i.e., * quiescent. Because of this we can treat the data as belonging to us, * without fear of race conditions. I.e. we can read and write as we like. * diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index de5d62d..5f79e6e 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -611,6 +611,7 @@ FsRecacheFilesystemList(void) while (toFree) { FilesystemRecord *next = toFree->nextPtr; + toFree->fsPtr = NULL; ckfree(toFree); toFree = next; @@ -672,7 +673,6 @@ TclFSEpoch(void) return tsdPtr->filesystemEpoch; } - /* * If non-NULL, clientData is owned by us and must be freed later. @@ -784,7 +784,9 @@ TclFinalizeFilesystem(void) while (fsRecPtr != NULL) { FilesystemRecord *tmpFsRecPtr = fsRecPtr->nextPtr; - /* The native filesystem is static, so we don't free it. */ + /* + * The native filesystem is static, so we don't free it. + */ if (fsRecPtr != &nativeFilesystemRecord) { ckfree(fsRecPtr); @@ -947,7 +949,7 @@ Tcl_FSRegister( int Tcl_FSUnregister( - const Tcl_Filesystem *fsPtr) /* The filesystem record to remove. */ + const Tcl_Filesystem *fsPtr)/* The filesystem record to remove. */ { int retVal = TCL_ERROR; FilesystemRecord *fsRecPtr; @@ -1233,7 +1235,7 @@ FsAddMountsToGlobResult( len--; } - len++; /* account for '/' in the mElt [Bug 1602539] */ + len++; /* account for '/' in the mElt [Bug 1602539] */ mElt = TclNewFSPathObj(pathPtr, mount + len, mlen - len); Tcl_ListObjAppendElement(NULL, resultPtr, mElt); } @@ -1403,7 +1405,7 @@ TclFSNormalizeToUniquePath( * Call each of the "normalise path" functions in succession. This is a * special case, in which if we have a native filesystem handler, we call * it first. This is because the root of Tcl's filesystem is always a - * native filesystem (i.e. '/' on unix is native). + * native filesystem (i.e., '/' on unix is native). */ firstFsRecPtr = FsGetFirstFilesystem(); @@ -1525,7 +1527,7 @@ TclGetOpenModeEx( #define RW_MODES (O_RDONLY|O_WRONLY|O_RDWR) /* - * Check for the simpler fopen-like access modes (e.g. "r"). They are + * 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. */ @@ -2671,6 +2673,7 @@ Tcl_FSGetCwd( fsRecPtr = fsRecPtr->nextPtr) { ClientData retCd; TclFSGetCwdProc2 *proc2; + if (fsRecPtr->fsPtr->getCwdProc == NULL) { continue; } @@ -3143,8 +3146,8 @@ Tcl_FSLoadFile( * Workaround for issue with modern HPUX which do allow the unlink (no ETXTBSY * error) yet somehow trash some internal data structures which prevents the * second and further shared libraries from getting properly loaded. Only the - * first is ok. We try to get around the issue by not unlinking, - * i.e. emulating the behaviour of the older HPUX which denied removal. + * first is ok. We try to get around the issue by not unlinking, i.e., + * emulating the behaviour of the older HPUX which denied removal. * * Doing the unlink is also an issue within docker containers, whose AUFS * bungles this as well, see @@ -3162,28 +3165,30 @@ Tcl_FSLoadFile( */ int -TclSkipUnlink (Tcl_Obj* shlibFile) +TclSkipUnlink( + Tcl_Obj *shlibFile) { - /* Order of testing: + /* + * Order of testing: * 1. On hpux we generally want to skip unlink in general * * Outside of hpux then: - * 2. For a general user request (TCL_TEMPLOAD_NO_UNLINK present, non-empty, => int) + * 2. For a general user request (TCL_TEMPLOAD_NO_UNLINK present, + * non-empty, => int) * 3. For general AUFS environment (statfs, if available). * * Ad 2: This variable can disable/override the AUFS detection, i.e. for - * testing if a newer AUFS does not have the bug any more. + * testing if a newer AUFS does not have the bug any more. * - * Ad 3: This is conditionally compiled in. Condition currently must be set manually. - * This part needs proper tests in the configure(.in). + * Ad 3: This is conditionally compiled in. Condition currently must be + * set manually. This part needs proper tests in the configure(.in). */ #ifdef hpux return 1; #else - char* skipstr; + char *skipstr = getenv("TCL_TEMPLOAD_NO_UNLINK"); - skipstr = getenv ("TCL_TEMPLOAD_NO_UNLINK"); if (skipstr && (skipstr[0] != '\0')) { return atoi(skipstr); } @@ -3192,7 +3197,8 @@ TclSkipUnlink (Tcl_Obj* shlibFile) #ifndef NO_FSTATFS { struct statfs fs; - /* Have fstatfs. May not have the AUFS super magic ... Indeed our build + /* + * Have fstatfs. May not have the AUFS super magic ... Indeed our build * box is too old to have it directly in the headers. Define taken from * http://mooon.googlecode.com/svn/trunk/linux_include/linux/aufs_type.h * http://aufs.sourceforge.net/ @@ -3209,8 +3215,10 @@ TclSkipUnlink (Tcl_Obj* shlibFile) #endif /* ... NO_FSTATFS */ #endif /* ... TCL_TEMPLOAD_NO_UNLINK */ - /* Fallback: !hpux, no EV override, no AUFS (detection, nor detected): - * Don't skip */ + /* + * Fallback: !hpux, no EV override, no AUFS (detection, nor detected): + * Don't skip + */ return 0; #endif /* hpux */ } @@ -3415,9 +3423,8 @@ Tcl_LoadFile( * avoids any worries about leaving the copy laying around on exit. */ - if ( - !TclSkipUnlink (copyToPtr) && - (Tcl_FSDeleteFile(copyToPtr) == TCL_OK)) { + if (!TclSkipUnlink(copyToPtr) && + (Tcl_FSDeleteFile(copyToPtr) == TCL_OK)) { Tcl_DecrRefCount(copyToPtr); /* diff --git a/generic/tclTimer.c b/generic/tclTimer.c index 6d3938b..3467305 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.c @@ -1053,11 +1053,17 @@ AfterDelay( if (diff > TCL_TIME_MAXIMUM_SLICE) { diff = TCL_TIME_MAXIMUM_SLICE; } - if (diff == 0 && TCL_TIME_BEFORE(now, endTime)) diff = 1; + if (diff == 0 && TCL_TIME_BEFORE(now, endTime)) { + diff = 1; + } if (diff > 0) { Tcl_Sleep((long) diff); - if (diff < SLEEP_OFFLOAD_GETTIMEOFDAY) break; - } else break; + if (diff < SLEEP_OFFLOAD_GETTIMEOFDAY) { + break; + } + } else { + break; + } } else { diff = TCL_TIME_DIFF_MS(iPtr->limit.time, now); #ifndef TCL_WIDE_INT_IS_LONG diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 0ae500b..b404080 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -19,6 +19,7 @@ #define SET_BITS(var, bits) ((var) |= (bits)) #define CLEAR_BITS(var, bits) ((var) &= ~(bits)) +#define GOT_BITS(var, bits) (((var) & (bits)) != 0) /* "sock" + a pointer in hex + \0 */ #define SOCK_CHAN_LENGTH (4 + sizeof(void *) * 2 + 1) @@ -99,9 +100,9 @@ struct TcpState { * structure. */ -#define TCP_ASYNC_TEST_MODE (1<<0) /* Async testing activated - * Do not automatically continue connection - * process */ +#define TCP_ASYNC_TEST_MODE (1<<0) /* Async testing activated. Do not + * automatically continue connection + * process. */ /* * The following defines the maximum length of the listen queue. This is the @@ -389,7 +390,7 @@ TcpBlockModeProc( } else { SET_BITS(statePtr->flags, TCP_NONBLOCKING); } - if (statePtr->flags & TCP_ASYNC_CONNECT) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { statePtr->cachedBlocking = mode; return 0; } @@ -442,7 +443,7 @@ WaitForConnect( * demanded, return the error ENOTCONN */ - if (errorCodePtr != NULL && (statePtr->flags & TCP_ASYNC_FAILED)) { + if (errorCodePtr != NULL && GOT_BITS(statePtr->flags, TCP_ASYNC_FAILED)) { *errorCodePtr = ENOTCONN; return -1; } @@ -451,24 +452,25 @@ WaitForConnect( * Check if an async connect is running. If not return ok */ - if (!(statePtr->flags & TCP_ASYNC_PENDING)) { + if (!GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { return 0; } /* - * In socket test mode do not continue with the connect + * In socket test mode do not continue with the connect. * Exceptions are: * - Call by recv/send and blocking socket - * (errorCodePtr != NULL && ! flags & TCP_NONBLOCKING) + * (errorCodePtr != NULL && !GOT_BITS(flags, TCP_NONBLOCKING)) */ - if ( (statePtr->testFlags & TCP_ASYNC_TEST_MODE) - && ! (errorCodePtr != NULL && ! (statePtr->flags & TCP_NONBLOCKING))) { + if (GOT_BITS(statePtr->testFlags, TCP_ASYNC_TEST_MODE) + && !(errorCodePtr != NULL + && !GOT_BITS(statePtr->flags, TCP_NONBLOCKING))) { *errorCodePtr = EWOULDBLOCK; return -1; } - if (errorCodePtr == NULL || (statePtr->flags & TCP_NONBLOCKING)) { + if (errorCodePtr == NULL || GOT_BITS(statePtr->flags, TCP_NONBLOCKING)) { timeout = 0; } else { timeout = -1; @@ -483,10 +485,10 @@ WaitForConnect( * Do this only once in the nonblocking case and repeat it until the * socket is final when blocking. */ - } while (timeout == -1 && statePtr->flags & TCP_ASYNC_CONNECT); + } while (timeout == -1 && GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)); if (errorCodePtr != NULL) { - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { *errorCodePtr = EAGAIN; return -1; } else if (statePtr->connectError != 0) { @@ -832,7 +834,7 @@ TcpGetOptionProc( (strncmp(optionName, "-error", len) == 0)) { socklen_t optlen = sizeof(int); - if (statePtr->flags & TCP_ASYNC_CONNECT) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { /* * Suppress errors as long as we are not done. */ @@ -856,9 +858,8 @@ TcpGetOptionProc( if ((len > 1) && (optionName[1] == 'c') && (strncmp(optionName, "-connecting", len) == 0)) { - Tcl_DStringAppend(dsPtr, - (statePtr->flags & TCP_ASYNC_CONNECT) ? "1" : "0", -1); + GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT) ? "1" : "0", -1); return TCL_OK; } @@ -867,7 +868,7 @@ TcpGetOptionProc( address peername; socklen_t size = sizeof(peername); - if (statePtr->flags & TCP_ASYNC_CONNECT) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { /* * In async connect output an empty string */ @@ -922,7 +923,7 @@ TcpGetOptionProc( Tcl_DStringAppendElement(dsPtr, "-sockname"); Tcl_DStringStartSublist(dsPtr); } - if (statePtr->flags & TCP_ASYNC_CONNECT) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { /* * In async connect output an empty string */ @@ -1024,7 +1025,7 @@ TcpWatchProc( return; } - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { /* * Async sockets use a FileHandler internally while connecting, so we * need to cache this request until the connection has succeeded. @@ -1149,9 +1150,9 @@ TcpConnect( TcpState *statePtr) { socklen_t optlen; - int async_callback = statePtr->flags & TCP_ASYNC_PENDING; + int async_callback = GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING); int ret = -1, error = EHOSTUNREACH; - int async = statePtr->flags & TCP_ASYNC_CONNECT; + int async = GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT); if (async_callback) { goto reenter; @@ -1159,7 +1160,6 @@ TcpConnect( for (statePtr->addr = statePtr->addrlist; statePtr->addr != NULL; statePtr->addr = statePtr->addr->ai_next) { - for (statePtr->myaddr = statePtr->myaddrlist; statePtr->myaddr != NULL; statePtr->myaddr = statePtr->myaddr->ai_next) { @@ -1580,13 +1580,13 @@ Tcl_OpenTcpServerEx( * Set up to reuse server addresses and/or ports if requested. */ - if (flags & TCL_TCPSERVER_REUSEADDR) { + if (GOT_BITS(flags, TCL_TCPSERVER_REUSEADDR)) { optvalue = 1; (void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &optvalue, sizeof(optvalue)); } - if (flags & TCL_TCPSERVER_REUSEPORT) { + if (GOT_BITS(flags, TCL_TCPSERVER_REUSEPORT)) { #ifndef SO_REUSEPORT /* * If the platform doesn't support the SO_REUSEPORT flag we can't diff --git a/win/tclWinSock.c b/win/tclWinSock.c index a5d98ae..8e0f7d0 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -69,6 +69,7 @@ #define SET_BITS(var, bits) ((var) |= (bits)) #define CLEAR_BITS(var, bits) ((var) &= ~(bits)) +#define GOT_BITS(var, bits) (((var) & (bits)) != 0) /* "sock" + a pointer in hex + \0 */ #define SOCK_CHAN_LENGTH (4 + sizeof(void *) * 2 + 1) @@ -190,8 +191,8 @@ struct TcpState { * structure. */ -#define TCP_ASYNC_TEST_MODE (1<<0) /* Async testing activated - * Do not automatically continue connection +#define TCP_ASYNC_TEST_MODE (1<<0) /* Async testing activated. Do not + * automatically continue connection * process */ /* @@ -303,6 +304,15 @@ static const Tcl_ChannelType tcpChannelType = { static TclInitProcessGlobalValueProc InitializeHostName; static ProcessGlobalValue hostName = {0, 0, NULL, NULL, InitializeHostName, NULL, NULL}; + +/* + * Simple wrapper round the SendMessage syscall. + */ + +#define SendSelectMessage(tsdPtr, message, payload) \ + SendMessage((tsdPtr)->hwnd, SOCKET_SELECT, \ + (WPARAM) (message), (LPARAM) (payload)) + /* * Address print debug functions @@ -596,7 +606,7 @@ WaitForConnect( * demanded, return the error ENOTCONN. */ - if (errorCodePtr != NULL && (statePtr->flags & TCP_ASYNC_FAILED)) { + if (errorCodePtr != NULL && GOT_BITS(statePtr->flags, TCP_ASYNC_FAILED)) { *errorCodePtr = ENOTCONN; return -1; } @@ -605,7 +615,7 @@ WaitForConnect( * Check if an async connect is running. If not return ok */ - if (!(statePtr->flags & TCP_ASYNC_CONNECT)) { + if (!GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { return 0; } @@ -613,12 +623,13 @@ WaitForConnect( * In socket test mode do not continue with the connect * Exceptions are: * - Call by recv/send and blocking socket - * (errorCodePtr != NULL && ! flags & TCP_NONBLOCKING) + * (errorCodePtr != NULL && !GOT_BITS(flags, TCP_NONBLOCKING)) * - Call by the event queue (errorCodePtr == NULL) */ - if ( (statePtr->testFlags & TCP_ASYNC_TEST_MODE) - && errorCodePtr != NULL && (statePtr->flags & TCP_NONBLOCKING)) { + if (GOT_BITS(statePtr->testFlags, TCP_ASYNC_TEST_MODE) + && errorCodePtr != NULL + && GOT_BITS(statePtr->flags, TCP_NONBLOCKING)) { *errorCodePtr = EWOULDBLOCK; return -1; } @@ -645,7 +656,7 @@ WaitForConnect( * Check for connect event. */ - if (statePtr->readyEvents & FD_CONNECT) { + if (GOT_BITS(statePtr->readyEvents, FD_CONNECT)) { /* * Consume the connect event. */ @@ -658,7 +669,7 @@ WaitForConnect( */ if (errorCodePtr != NULL && - !(statePtr->flags & TCP_NONBLOCKING)) { + !GOT_BITS(statePtr->flags, TCP_NONBLOCKING)) { CLEAR_BITS(statePtr->flags, TCP_ASYNC_CONNECT); } @@ -691,7 +702,7 @@ WaitForConnect( * foreground blocking operation) */ - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { if (errorCodePtr != NULL) { *errorCodePtr = EWOULDBLOCK; } @@ -731,7 +742,7 @@ WaitForConnect( * directly the error EWOULDBLOCK. */ - if (statePtr->flags & TCP_NONBLOCKING) { + if (GOT_BITS(statePtr->flags, TCP_NONBLOCKING)) { *errorCodePtr = EWOULDBLOCK; return -1; } @@ -795,7 +806,7 @@ TcpInputProc( * socket stack after the first time EOF is detected. */ - if (statePtr->flags & SOCKET_EOF) { + if (GOT_BITS(statePtr->flags, SOCKET_EOF)) { return 0; } @@ -818,8 +829,8 @@ TcpInputProc( */ while (1) { - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, - (WPARAM) UNSELECT, (LPARAM) statePtr); + SendSelectMessage(tsdPtr, UNSELECT, statePtr); + /* * Single fd operation: this proc is only called for a connected * socket. @@ -844,7 +855,7 @@ TcpInputProc( * error and report an EOF. */ - if (statePtr->readyEvents & FD_CLOSE) { + if (GOT_BITS(statePtr->readyEvents, FD_CLOSE)) { SET_BITS(statePtr->flags, SOCKET_EOF); bytesRead = 0; break; @@ -867,7 +878,8 @@ TcpInputProc( * Check for error condition or underflow in non-blocking case. */ - if ((statePtr->flags & TCP_NONBLOCKING) || (error != WSAEWOULDBLOCK)) { + if (GOT_BITS(statePtr->flags, TCP_NONBLOCKING) + || (error != WSAEWOULDBLOCK)) { TclWinConvertError(error); *errorCodePtr = Tcl_GetErrno(); bytesRead = -1; @@ -885,7 +897,7 @@ TcpInputProc( } } - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM)SELECT, (LPARAM)statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); return bytesRead; } @@ -943,8 +955,7 @@ TcpOutputProc( } while (1) { - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, - (WPARAM) UNSELECT, (LPARAM) statePtr); + SendSelectMessage(tsdPtr, UNSELECT, statePtr); /* * Single fd operation: this proc is only called for a connected @@ -959,8 +970,9 @@ TcpOutputProc( * until the condition changes. */ - if (statePtr->watchEvents & FD_WRITE) { + if (GOT_BITS(statePtr->watchEvents, FD_WRITE)) { Tcl_Time blockTime = { 0, 0 }; + Tcl_SetMaxBlockTime(&blockTime); } break; @@ -976,7 +988,7 @@ TcpOutputProc( error = WSAGetLastError(); if (error == WSAEWOULDBLOCK) { CLEAR_BITS(statePtr->readyEvents, FD_WRITE); - if (statePtr->flags & TCP_NONBLOCKING) { + if (GOT_BITS(statePtr->flags, TCP_NONBLOCKING)) { *errorCodePtr = EWOULDBLOCK; written = -1; break; @@ -999,8 +1011,7 @@ TcpOutputProc( } } - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM)SELECT, - (LPARAM)statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); return written; } @@ -1317,7 +1328,7 @@ TcpGetOptionProc( * below. */ - if (! (statePtr->testFlags & TCP_ASYNC_TEST_MODE) ) { + if (!GOT_BITS(statePtr->testFlags, TCP_ASYNC_TEST_MODE)) { WaitForConnect(statePtr, NULL); } @@ -1332,8 +1343,8 @@ TcpGetOptionProc( * Do not return any errors if async connect is running. */ - if (!(statePtr->flags & TCP_ASYNC_PENDING)) { - if (statePtr->flags & TCP_ASYNC_FAILED) { + if (!GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_FAILED)) { /* * In case of a failed async connect, eventually report the * connect error only once. Do not report the system error, @@ -1388,7 +1399,7 @@ TcpGetOptionProc( if ((len > 1) && (optionName[1] == 'c') && (strncmp(optionName, "-connecting", len) == 0)) { Tcl_DStringAppend(dsPtr, - (statePtr->flags & TCP_ASYNC_PENDING) + GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING) ? "1" : "0", -1); return TCL_OK; } @@ -1403,7 +1414,7 @@ TcpGetOptionProc( address peername; socklen_t size = sizeof(peername); - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { /* * In async connect output an empty string */ @@ -1468,7 +1479,7 @@ TcpGetOptionProc( Tcl_DStringAppendElement(dsPtr, "-sockname"); Tcl_DStringStartSublist(dsPtr); } - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { /* * In async connect output an empty string */ @@ -1617,10 +1628,10 @@ TcpWatchProc( if (!statePtr->acceptProc) { statePtr->watchEvents = 0; - if (mask & TCL_READABLE) { + if (GOT_BITS(mask, TCL_READABLE)) { SET_BITS(statePtr->watchEvents, FD_READ | FD_CLOSE); } - if (mask & TCL_WRITABLE) { + if (GOT_BITS(mask, TCL_WRITABLE)) { SET_BITS(statePtr->watchEvents, FD_WRITE | FD_CLOSE); } @@ -1712,11 +1723,11 @@ TcpConnect( TcpState *statePtr) { DWORD error; - int async_connect = statePtr->flags & TCP_ASYNC_CONNECT; + int async_connect = GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT); /* We are started with async connect and the * connect notification was not yet * received. */ - int async_callback = statePtr->flags & TCP_ASYNC_PENDING; + int async_callback = GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING); /* We were called by the event procedure and * continue our loop. */ ThreadSpecificData *tsdPtr = TclThreadDataKeyGet(&dataKey); @@ -1860,8 +1871,7 @@ TcpConnect( * Activate accept notification. */ - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); } /* @@ -1957,8 +1967,7 @@ TcpConnect( * automatically places the socket into non-blocking mode. */ - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); } else { /* * Connect failed @@ -2155,8 +2164,7 @@ Tcl_MakeTcpClientChannel( */ statePtr->selectEvents = FD_READ | FD_CLOSE | FD_WRITE; - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM)SELECT, - (LPARAM)statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); sprintf(channelName, SOCK_TEMPLATE, statePtr); statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, @@ -2270,7 +2278,7 @@ Tcl_OpenTcpServerEx( * unix systems. */ - if (flags & TCL_TCPSERVER_REUSEPORT) { + if (GOT_BITS(flags, TCL_TCPSERVER_REUSEPORT)) { optvalue = 1; (void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &optvalue, sizeof(optvalue)); @@ -2352,8 +2360,7 @@ Tcl_OpenTcpServerEx( */ ioctlsocket(sock, (long) FIONBIO, &flag); - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); if (Tcl_SetChannelOption(interp, statePtr->channel, "-eofchar", "") == TCL_ERROR) { Tcl_Close(NULL, statePtr->channel); @@ -2422,8 +2429,7 @@ TcpAccept( */ newInfoPtr->selectEvents = (FD_READ | FD_WRITE | FD_CLOSE); - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) newInfoPtr); + SendSelectMessage(tsdPtr, SELECT, newInfoPtr); sprintf(channelName, SOCK_TEMPLATE, newInfoPtr); newInfoPtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, @@ -2654,7 +2660,7 @@ SocketSetupProc( Tcl_Time blockTime = { 0, 0 }; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - if (!(flags & TCL_FILE_EVENTS)) { + if (!GET_BITS(flags, TCL_FILE_EVENTS)) { return; } @@ -2664,9 +2670,8 @@ SocketSetupProc( WaitForSingleObject(tsdPtr->socketListLock, INFINITE); for (statePtr = tsdPtr->socketList; statePtr != NULL; statePtr = statePtr->nextPtr) { - if (statePtr->readyEvents & - (statePtr->watchEvents | FD_CONNECT | FD_ACCEPT) - ) { + if (GOT_BITS(statePtr->readyEvents, + statePtr->watchEvents | FD_CONNECT | FD_ACCEPT)) { Tcl_SetMaxBlockTime(&blockTime); break; } @@ -2700,7 +2705,7 @@ SocketCheckProc( SocketEvent *evPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - if (!(flags & TCL_FILE_EVENTS)) { + if (!GOT_BITS(flags, TCL_FILE_EVENTS)) { return; } @@ -2713,9 +2718,9 @@ SocketCheckProc( WaitForSingleObject(tsdPtr->socketListLock, INFINITE); for (statePtr = tsdPtr->socketList; statePtr != NULL; statePtr = statePtr->nextPtr) { - if ((statePtr->readyEvents & - (statePtr->watchEvents | FD_CONNECT | FD_ACCEPT)) - && !(statePtr->flags & SOCKET_PENDING)) { + if (GOT_BITS(statePtr->readyEvents, + statePtr->watchEvents | FD_CONNECT | FD_ACCEPT) + && !GOT_BITS(statePtr->flags, SOCKET_PENDING)) { SET_BITS(statePtr->flags, SOCKET_PENDING); evPtr = ckalloc(sizeof(SocketEvent)); evPtr->header.proc = SocketEventProc; @@ -2762,7 +2767,7 @@ SocketEventProc( address addr; int len; - if (!(flags & TCL_FILE_EVENTS)) { + if (!GOT_BITS(flags, TCL_FILE_EVENTS)) { return 0; } @@ -2797,8 +2802,8 @@ SocketEventProc( * Continue async connect if pending and ready */ - if (statePtr->readyEvents & FD_CONNECT) { - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->readyEvents, FD_CONNECT)) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { /* * Do one step and save eventual connect error */ @@ -2820,7 +2825,7 @@ SocketEventProc( * Handle connection requests directly. */ - if (statePtr->readyEvents & FD_ACCEPT) { + if (GOT_BITS(statePtr->readyEvents, FD_ACCEPT)) { for (fds = statePtr->sockets; fds != NULL; fds = fds->next) { /* * Accept the incoming connection request. @@ -2895,7 +2900,7 @@ SocketEventProc( events = statePtr->readyEvents & statePtr->watchEvents; - if (events & FD_CLOSE) { + if (GOT_BITS(events, FD_CLOSE)) { /* * If the socket was closed and the channel is still interested in * read events, then we need to ensure that we keep polling for this @@ -2910,15 +2915,13 @@ SocketEventProc( Tcl_SetMaxBlockTime(&blockTime); SET_BITS(mask, TCL_READABLE | TCL_WRITABLE); - } else if (events & FD_READ) { - + } else if (GOT_BITS(events, FD_READ)) { /* * Throw the readable event if an async connect failed. */ - if (statePtr->flags & TCP_ASYNC_FAILED) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_FAILED)) { SET_BITS(mask, TCL_READABLE); - } else { fd_set readFds; struct timeval timeout; @@ -2931,8 +2934,7 @@ SocketEventProc( * async select handler and keep waiting. */ - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, - (WPARAM) UNSELECT, (LPARAM) statePtr); + SendSelectMessage(tsdPtr, UNSELECT, statePtr); FD_ZERO(&readFds); FD_SET(statePtr->sockets->fd, &readFds); @@ -2943,8 +2945,7 @@ SocketEventProc( SET_BITS(mask, TCL_READABLE); } else { CLEAR_BITS(statePtr->readyEvents, FD_READ); - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, - (WPARAM) SELECT, (LPARAM) statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); } } } @@ -2953,7 +2954,7 @@ SocketEventProc( * writable event */ - if (events & FD_WRITE) { + if (GOT_BITS(events, FD_WRITE)) { SET_BITS(mask, TCL_WRITABLE); } @@ -3095,10 +3096,8 @@ WaitForSocketEvent( * Reset WSAAsyncSelect so we have a fresh set of events pending. */ - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) UNSELECT, - (LPARAM) statePtr); - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, (WPARAM) SELECT, - (LPARAM) statePtr); + SendSelectMessage(tsdPtr, UNSELECT, statePtr); + SendSelectMessage(tsdPtr, SELECT, statePtr); while (1) { int event_found; @@ -3113,7 +3112,7 @@ WaitForSocketEvent( * Check if event occured. */ - event_found = (statePtr->readyEvents & events); + event_found = GOT_BITS(statePtr->readyEvents, events); /* * Free list lock. @@ -3314,14 +3313,14 @@ SocketProc( * the count if the current event is an FD_ACCEPT. */ - if (event & FD_CLOSE) { + if (GOT_BITS(event, FD_CLOSE)) { statePtr->acceptEventCount = 0; CLEAR_BITS(statePtr->readyEvents, FD_WRITE | FD_ACCEPT); - } else if (event & FD_ACCEPT) { + } else if (GOT_BITS(event, FD_ACCEPT)) { statePtr->acceptEventCount++; } - if (event & FD_CONNECT) { + if (GOT_BITS(event, FD_CONNECT)) { /* * Remember any error that occurred so we can report * connection failures. @@ -3552,8 +3551,7 @@ TcpThreadActionProc( * thread. */ - SendMessage(tsdPtr->hwnd, SOCKET_SELECT, - (WPARAM) notifyCmd, (LPARAM) statePtr); + SendSelectMessage(tsdPtr, notifyCmd, statePtr); } /* -- cgit v0.12 From 26f98a5e562b865e82adcc6b7de05df4b0fa07de Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 11 Apr 2017 11:30:47 +0000 Subject: unbreak windows build (by previous commit) --- win/tclWinSock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tclWinSock.c b/win/tclWinSock.c index 8e0f7d0..ee6be96 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -2660,7 +2660,7 @@ SocketSetupProc( Tcl_Time blockTime = { 0, 0 }; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - if (!GET_BITS(flags, TCL_FILE_EVENTS)) { + if (!GOT_BITS(flags, TCL_FILE_EVENTS)) { return; } -- cgit v0.12 From cd48f2d3131be957186014e7012d9445e2bd26ff Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 11 Apr 2017 15:20:07 +0000 Subject: Remove some unnecessary "struct" definitions and some type casts no longer necessary. No functional changes. --- generic/tclBasic.c | 2 +- generic/tclClock.c | 2 +- generic/tclEvent.c | 2 +- generic/tclIO.c | 2 +- generic/tclIOCmd.c | 5 ++--- generic/tclIORChan.c | 14 +++++++------- generic/tclIORTrans.c | 2 +- generic/tclIOSock.c | 2 +- generic/tclIOUtil.c | 2 +- generic/tclInt.h | 2 +- generic/tclNamesp.c | 2 +- generic/tclObj.c | 2 +- generic/tclRegexp.c | 4 ++-- generic/tclUtil.c | 4 ++-- 14 files changed, 23 insertions(+), 24 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index b29e19e..aae7ab6 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -1071,7 +1071,7 @@ Tcl_CallWhenDeleted( Interp *iPtr = (Interp *) interp; static Tcl_ThreadDataKey assocDataCounterKey; int *assocDataCounterPtr = - Tcl_GetThreadData(&assocDataCounterKey, (int)sizeof(int)); + Tcl_GetThreadData(&assocDataCounterKey, sizeof(int)); int isNew; char buffer[32 + TCL_INTEGER_SPACE]; AssocData *dPtr = ckalloc(sizeof(AssocData)); diff --git a/generic/tclClock.c b/generic/tclClock.c index ac4a4d6..d44e9dc 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -1694,7 +1694,7 @@ ThreadSafeLocalTime( * Get a thread-local buffer to hold the returned time. */ - struct tm *tmPtr = Tcl_GetThreadData(&tmKey, (int) sizeof(struct tm)); + struct tm *tmPtr = Tcl_GetThreadData(&tmKey, sizeof(struct tm)); #ifdef HAVE_LOCALTIME_R localtime_r(timePtr, tmPtr); #else diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 436db7a..49fd2ae 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -37,7 +37,7 @@ typedef struct BgError { * pending background errors for the interpreter. */ -typedef struct ErrAssocData { +typedef struct { Tcl_Interp *interp; /* Interpreter in which error occurred. */ Tcl_Obj *cmdPrefix; /* First word(s) of the handler command */ BgError *firstBgPtr; /* First in list of all background errors diff --git a/generic/tclIO.c b/generic/tclIO.c index 32fbd59..1460392 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -116,7 +116,7 @@ typedef struct CopyState { * The structure defined below is used in this file only. */ -typedef struct ThreadSpecificData { +typedef struct { NextChannelHandler *nestedHandlerPtr; /* This variable holds the list of nested * Tcl_NotifyChannel invocations. */ diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index e52200d..6e8bd09 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -25,7 +25,7 @@ typedef struct AcceptCallback { * It must be per-thread because of std channel limitations. */ -typedef struct ThreadSpecificData { +typedef struct { int initialized; /* Set to 1 when the module is initialized. */ Tcl_Obj *stdoutObjPtr; /* Cached stdout channel Tcl_Obj */ } ThreadSpecificData; @@ -113,7 +113,6 @@ Tcl_PutsObjCmd( int newline; /* Add a newline at end? */ int result; /* Result of puts operation. */ int mode; /* Mode in which channel is opened. */ - ThreadSpecificData *tsdPtr; switch (objc) { case 2: /* [puts $x] */ @@ -160,7 +159,7 @@ Tcl_PutsObjCmd( } if (chanObjPtr == NULL) { - tsdPtr = TCL_TSD_INIT(&dataKey); + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index 433fb6f..aefa104 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -234,7 +234,7 @@ typedef enum { * sharing problems. */ -typedef struct ForwardParamBase { +typedef struct { int code; /* O: Ok/Fail of the cmd handler */ char *msgStr; /* O: Error message for handler failure */ int mustFree; /* O: True if msgStr is allocated, false if @@ -309,7 +309,7 @@ typedef struct ForwardingResult ForwardingResult; * General event structure, with reference to operation specific data. */ -typedef struct ForwardingEvent { +typedef struct { Tcl_Event event; /* Basic event data, has to be first item */ ForwardingResult *resultPtr; ForwardedOperation op; /* Forwarded driver operation */ @@ -346,7 +346,7 @@ struct ForwardingResult { * results. */ }; -typedef struct ThreadSpecificData { +typedef struct { /* * Table of all reflected channels owned by this thread. This is the * per-thread version of the per-interpreter map. @@ -723,7 +723,7 @@ TclChanCreateObjCmd( Tcl_DecrRefCount(rcPtr->name); Tcl_DecrRefCount(rcPtr->methods); Tcl_DecrRefCount(rcPtr->cmd); - ckfree((char*) rcPtr); + ckfree(rcPtr); return TCL_ERROR; #undef MODE @@ -748,7 +748,7 @@ TclChanCreateObjCmd( *---------------------------------------------------------------------- */ -typedef struct ReflectEvent { +typedef struct { Tcl_Event header; ReflectedChannel *rcPtr; int events; @@ -1223,8 +1223,8 @@ ReflectClose( #endif tctPtr = ((Channel *)rcPtr->chan)->typePtr; if (tctPtr && tctPtr != &tclRChannelType) { - ckfree(tctPtr); - ((Channel *)rcPtr->chan)->typePtr = NULL; + ckfree(tctPtr); + ((Channel *)rcPtr->chan)->typePtr = NULL; } Tcl_EventuallyFree(rcPtr, (Tcl_FreeProc *) FreeReflectedChannel); return (result == TCL_OK) ? EOK : EINVAL; diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index 8375926..f198c69 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -329,7 +329,7 @@ struct ForwardingResult { * results. */ }; -typedef struct ThreadSpecificData { +typedef struct { /* * Table of all reflected transformations owned by this thread. */ diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index 82d2fc1..6abfa60 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -16,7 +16,7 @@ * On Windows, we need to do proper Unicode->UTF-8 conversion. */ -typedef struct ThreadSpecificData { +typedef struct { int initialized; Tcl_DString errorMsg; /* UTF-8 encoded error-message */ } ThreadSpecificData; diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 5f79e6e..ea407ab 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -57,7 +57,7 @@ typedef struct FilesystemRecord { * this information each time the corresponding epoch counter changes. */ -typedef struct ThreadSpecificData { +typedef struct { int initialized; size_t cwdPathEpoch; size_t filesystemEpoch; diff --git a/generic/tclInt.h b/generic/tclInt.h index 1fbc541..d725688 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1357,7 +1357,7 @@ MODULE_SCOPE void TclThreadDataKeySet(Tcl_ThreadDataKey *keyPtr, */ #define TCL_TSD_INIT(keyPtr) \ - (ThreadSpecificData *)Tcl_GetThreadData((keyPtr), sizeof(ThreadSpecificData)) + Tcl_GetThreadData((keyPtr), sizeof(ThreadSpecificData)) /* *---------------------------------------------------------------- diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 1e360d1..e1bad0e 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -31,7 +31,7 @@ * limited to a single interpreter. */ -typedef struct ThreadSpecificData { +typedef struct { size_t numNsCreated; /* Count of the number of namespaces created * within the thread. This value is used as a * unique id for each namespace. Cannot be diff --git a/generic/tclObj.c b/generic/tclObj.c index dfcaff0..f4b81f2 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -75,7 +75,7 @@ typedef struct ObjData { * The structure defined below is used in this file only. */ -typedef struct ThreadSpecificData { +typedef struct { Tcl_HashTable *lineCLPtr; /* This table remembers for each Tcl_Obj * generated by a call to the function * TclSubstTokens() from a literal text diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index eb23f72..5f8dc20 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -64,7 +64,7 @@ #define NUM_REGEXPS 30 -typedef struct ThreadSpecificData { +typedef struct { int initialized; /* Set to 1 when the module is initialized. */ char *patterns[NUM_REGEXPS];/* Strings corresponding to compiled regular * expression patterns. NULL means that this @@ -679,7 +679,7 @@ TclRegAbout( resultObj = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, resultObj, - Tcl_NewIntObj((int) regexpPtr->re.re_nsub)); + Tcl_NewWideIntObj((Tcl_WideInt) regexpPtr->re.re_nsub)); /* * Now append a list of all the bit-flags set for the RE. diff --git a/generic/tclUtil.c b/generic/tclUtil.c index a4d523a..91cc3b4 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3153,7 +3153,7 @@ Tcl_PrintDouble( int signum; char *digits; char *end; - int *precisionPtr = Tcl_GetThreadData(&precisionKey, (int) sizeof(int)); + int *precisionPtr = Tcl_GetThreadData(&precisionKey, sizeof(int)); /* * Handle NaN. @@ -3326,7 +3326,7 @@ TclPrecTraceProc( { Tcl_Obj *value; int prec; - int *precisionPtr = Tcl_GetThreadData(&precisionKey, (int) sizeof(int)); + int *precisionPtr = Tcl_GetThreadData(&precisionKey, sizeof(int)); /* * If the variable is unset, then recreate the trace. -- cgit v0.12 From 8b0910d31f1affbd2ccefd74d2df1eeba7a1f736 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 11 Apr 2017 18:07:30 +0000 Subject: fix typo- resp. copy-paste-bug (using wrong threadInfo pointer in ConsoleOutputProc, should be writer, not reader) --- win/tclWinConsole.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index d4893ee..da995c5 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -828,7 +828,7 @@ ConsoleOutputProc( int *errorCode) /* Where to store error code. */ { ConsoleInfo *infoPtr = instanceData; - ConsoleThreadInfo *threadInfo = &infoPtr->reader; + ConsoleThreadInfo *threadInfo = &infoPtr->writer; DWORD bytesWritten, timeout; *errorCode = 0; -- cgit v0.12 From 119d9ad3aa713f76079c0aebb625fb861b09fa68 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 11 Apr 2017 18:08:12 +0000 Subject: shared structures of pipe-workers rewritten using atomic state of the thread; asynchronous start/stop of pipe-workers (if possible), try the soft way to end workers using cancelSynchronousIo before it would be terminated; --- win/tclWinInit.c | 20 ++ win/tclWinInt.h | 9 + win/tclWinPipe.c | 578 ++++++++++++++++++++++++++++++++----------------------- 3 files changed, 371 insertions(+), 236 deletions(-) diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 8b600f6..03ef5df 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -76,6 +76,15 @@ typedef struct { #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF #endif + +/* + * Windows version dependend functions + */ +static TclWinProcs _tclWinProcs = { + NULL +}; +TclWinProcs *tclWinProcs = &_tclWinProcs; + /* * The following arrays contain the human readable strings for the Windows * platform and processor values. @@ -132,6 +141,7 @@ TclpInitPlatform(void) { WSADATA wsaData; WORD wVersionRequested = MAKEWORD(2, 2); + HINSTANCE hInstance; tclPlatform = TCL_PLATFORM_WINDOWS; @@ -150,6 +160,16 @@ TclpInitPlatform(void) TclWinInit(GetModuleHandle(NULL)); #endif + + /* + * Fill available functions depending on windows version + */ + hInstance = LoadLibraryW(L"kernel32"); + if (hInstance != NULL) { + _tclWinProcs.cancelSynchronousIo = + (BOOL (WINAPI *)(HANDLE)) GetProcAddress(hInstance, + "CancelSynchronousIo"); + } } /* diff --git a/win/tclWinInt.h b/win/tclWinInt.h index 6b098f8..b8d493e 100644 --- a/win/tclWinInt.h +++ b/win/tclWinInt.h @@ -32,6 +32,15 @@ typedef struct TCLEXCEPTION_REGISTRATION { #endif /* + * Windows version dependend functions + */ +typedef struct TclWinProcs { + BOOL (WINAPI *cancelSynchronousIo)(HANDLE); +} TclWinProcs; + +MODULE_SCOPE TclWinProcs *tclWinProcs; + +/* * Some versions of Borland C have a define for the OSVERSIONINFO for * Win32s and for NT, but not for Windows 95. * Define VER_PLATFORM_WIN32_CE for those without newer headers. diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 523d4eb..bb76eef 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -91,6 +91,284 @@ static ProcInfo *procList; * This structure describes per-instance data for a pipe based channel. */ +typedef struct PipeThreadInfo { + HANDLE evControl; /* Auto-reset event used by the main thread to + * signal when the pipe thread should attempt + * to do read/write operation. Additionally + * used as signal to stop (state set to -1) */ + volatile LONG state; /* Indicates current state of the thread */ + ClientData clientData; /* Referenced data of the main thread */ +} PipeThreadInfo; + + +#define PTI_STATE_IDLE 0 +#define PTI_STATE_WORK 1 +#define PTI_STATE_STOP 2 +#define PTI_STATE_END 4 +#define PTI_STATE_DOWN 8 + +int +PipeThreadWaitForSignal( + PipeThreadInfo **pipeTIPtr) +{ + PipeThreadInfo *pipeTI = *pipeTIPtr; + LONG state; + DWORD waitResult; + + if (!pipeTI) { + return 0; + } + /* + * Wait for the main thread to signal before attempting to do the work. + */ + + /* reset work state of thread (idle/waiting) */ + if ((state = InterlockedCompareExchange(&pipeTI->state, + PTI_STATE_IDLE, PTI_STATE_WORK)) & (PTI_STATE_STOP|PTI_STATE_END)) { + /* end of work, check the owner of structure */ + goto end; + } + /* entering wait */ + waitResult = WaitForSingleObject(pipeTI->evControl, INFINITE); + + if (waitResult != WAIT_OBJECT_0) { + + /* + * The control event was not signaled, so end of work (unexpected + * behaviour, main thread can be dead?). + */ + goto end; + } + + /* try to set work state of thread */ + if ((state = InterlockedCompareExchange(&pipeTI->state, + PTI_STATE_WORK, PTI_STATE_IDLE)) & (PTI_STATE_STOP|PTI_STATE_END)) { + /* end of work */ + goto end; + } + + /* signaled to work */ + return 1; + +end: + /* end of work, check the owner of the TI structure */ + if (state != PTI_STATE_STOP) { + *pipeTIPtr = NULL; + } + return 0; +} + +static inline void +PipeThreadSignal( + PipeThreadInfo **pipeTIPtr) +{ + PipeThreadInfo *pipeTI = *pipeTIPtr; + if (pipeTI) { + SetEvent(pipeTI->evControl); + } +} + +int +PipeThreadStopSignal( + PipeThreadInfo **pipeTIPtr) +{ + PipeThreadInfo *pipeTI = *pipeTIPtr; + HANDLE evControl; + int state; + + if (!pipeTI) { + return 1; + } + evControl = pipeTI->evControl; + switch ( + (state = InterlockedCompareExchange(&pipeTI->state, + PTI_STATE_STOP, PTI_STATE_IDLE)) + ) { + + case PTI_STATE_IDLE: + + /* Thread was idle/waiting, notify it goes teardown */ + SetEvent(evControl); + + *pipeTIPtr = NULL; + + case PTI_STATE_DOWN: + + return 1; + + default: + /* + * Thread works currently, we should try to end it, own the TI structure + * (because of possible sharing the joint structures with thread) + */ + InterlockedExchange(&pipeTI->state, PTI_STATE_END); + break; + } + + return 0; +} + +void +PipeThreadStop( + PipeThreadInfo **pipeTIPtr, + HANDLE hThread) +{ + PipeThreadInfo *pipeTI = *pipeTIPtr; + HANDLE evControl; + int state; + + if (!pipeTI) { + return; + } + pipeTI = *pipeTIPtr; + evControl = pipeTI->evControl; + /* + * Try to sane stop the pipe worker, corresponding its current state + */ + switch ( + (state = InterlockedCompareExchange(&pipeTI->state, + PTI_STATE_STOP, PTI_STATE_IDLE)) + ) { + + case PTI_STATE_IDLE: + + /* Thread was idle/waiting, notify it goes teardown */ + SetEvent(evControl); + + /* we don't need to wait for it at all, thread frees himself (owns the TI structure) */ + pipeTI = NULL; + break; + + case PTI_STATE_STOP: + /* already stopped, thread frees himself (owns the TI structure) */ + pipeTI = NULL; + break; + case PTI_STATE_DOWN: + /* Thread already down (?), do nothing */ + + /* we don't need to wait for it, but we should free pipeTI */ + hThread = NULL; + break; + + /* case PTI_STATE_WORK: */ + default: + /* + * Thread works currently, we should try to end it, own the TI structure + * (because of possible sharing the joint structures with thread) + */ + InterlockedExchange(&pipeTI->state, PTI_STATE_END); + break; + } + + if (pipeTI && hThread) { + DWORD exitCode; + + /* + * The thread may already have closed on its own. Check its exit + * code. + */ + + GetExitCodeThread(hThread, &exitCode); + + if (exitCode == STILL_ACTIVE) { + /* + * Set the stop event so that if the pipe thread is blocked + * somewhere, it may hereafter sane exit cleanly. + */ + + SetEvent(evControl); + + /* + * Cancel all sync-IO of this thread (may be blocked there). + */ + if (tclWinProcs->cancelSynchronousIo) { + tclWinProcs->cancelSynchronousIo(hThread); + } + + /* + * Wait at most 20 milliseconds for the reader thread to + * close (regarding TIP#398-fast-exit). + */ + + /* if we want TIP#398-fast-exit. */ + if (WaitForSingleObject(hThread, + TclInExit() ? 0 : 0) == WAIT_TIMEOUT) { + + /* + * The thread must be blocked waiting for the pipe to + * become readable in ReadFile(). There isn't a clean way + * to exit the thread from this condition. We should + * terminate the child process instead to get the reader + * thread to fall out of ReadFile with a FALSE. (below) is + * not the correct way to do this, but will stay here + * until a better solution is found. + * + * Note that we need to guard against terminating the + * thread while it is in the middle of Tcl_ThreadAlert + * because it won't be able to release the notifier lock. + * + * Also note that terminating threads during their initialization or teardown phase + * may result in ntdll.dll's LoaderLock to remain locked indefinitely. + * This causes ntdll.dll's LdrpInitializeThread() to deadlock trying to acquire LoaderLock. + * LdrpInitializeThread() is executed within new threads to perform + * initialization and to execute DllMain() of all loaded dlls. + * As a result, all new threads are deadlocked in their initialization phase and never execute, + * even though CreateThread() reports successful thread creation. + * This results in a very weird process-wide behavior, which is extremely hard to debug. + * + * THREADS SHOULD NEVER BE TERMINATED. Period. + * + * But for now, check if thread is exiting, and if so, let it die peacefully. + */ + + if ( pipeTI->state != PTI_STATE_DOWN + && WaitForSingleObject(hThread, + TclInExit() ? 0 : 5000) != WAIT_OBJECT_0 + ) { + Tcl_MutexLock(&pipeMutex); + /* BUG: this leaks memory */ + if (!TerminateThread(hThread, 0)) { + /* terminate fails, just give thread a chance to exit */ + if (InterlockedExchange(&pipeTI->state, + PTI_STATE_STOP) != PTI_STATE_DOWN) { + pipeTI = NULL; + } + }; + Tcl_MutexUnlock(&pipeMutex); + } + } + } + } + + *pipeTIPtr = NULL; + if (pipeTI) { + CloseHandle(pipeTI->evControl); + ckfree(pipeTI); + } +} + +void +PipeThreadExit( + PipeThreadInfo **pipeTIPtr) +{ + LONG state; + PipeThreadInfo *pipeTI = *pipeTIPtr; + /* + * If state of thread was set to stop (exactly), we can sane free its info + * structure, otherwise it is shared with main thread, so main thread will + * own it. + */ + if (!pipeTI) { + return; + } + *pipeTIPtr = NULL; + if ((state = InterlockedExchange(&pipeTI->state, + PTI_STATE_DOWN)) == PTI_STATE_STOP) { + CloseHandle(pipeTI->evControl); + ckfree(pipeTI); + } +} + typedef struct PipeInfo { struct PipeInfo *nextPtr; /* Pointer to next registered pipe. */ Tcl_Channel channel; /* Pointer to channel structure. */ @@ -109,28 +387,17 @@ typedef struct PipeInfo { Tcl_ThreadId threadId; /* Thread to which events should be reported. * This value is used by the reader/writer * threads. */ + PipeThreadInfo *writeTI; /* Thread info of writer and reader, this */ + PipeThreadInfo *readTI; /* structure owned by corresponding thread. */ HANDLE writeThread; /* Handle to writer thread. */ HANDLE readThread; /* Handle to reader thread. */ - int writeThreadExiting; /* Boolean indicating that write thread is exiting */ - int readThreadExiting; /* Boolean indicating that read thread is exiting */ + HANDLE writable; /* Manual-reset event to signal when the * writer thread has finished waiting for the * current buffer to be written. */ HANDLE readable; /* Manual-reset event to signal when the * reader thread has finished waiting for * input. */ - HANDLE startWriter; /* Auto-reset event used by the main thread to - * signal when the writer thread should - * attempt to write to the pipe. Additionally - * this event used as wait for thread event (init). */ - HANDLE stopWriter; /* Manual-reset event used to alert the reader - * thread to fall-out and exit */ - HANDLE startReader; /* Auto-reset event used by the main thread to - * signal when the reader thread should - * attempt to read from the pipe. Additionally - * this event used as wait for thread event (init). */ - HANDLE stopReader; /* Manual-reset event used to alert the reader - * thread to fall-out and exit */ DWORD writeError; /* An error caused by the last background * write. Set to 0 if no error has been * detected. This word is shared with the @@ -1575,8 +1842,7 @@ TclpCreateCommandChannel( Tcl_Pid *pidPtr) /* An array of process identifiers. */ { char channelName[16 + TCL_INTEGER_SPACE]; - DWORD id, wEventsCnt = 0; - HANDLE wEvents[2]; + DWORD id; PipeInfo *infoPtr = ckalloc(sizeof(PipeInfo)); PipeInit(); @@ -1603,16 +1869,18 @@ TclpCreateCommandChannel( * Start the background reader thread. */ + PipeThreadInfo *pipeTI = ckalloc(sizeof(PipeThreadInfo)); + pipeTI->evControl = CreateEvent(NULL, FALSE, FALSE, NULL); + pipeTI->state = PTI_STATE_IDLE; + pipeTI->clientData = infoPtr; + infoPtr->readTI = pipeTI; infoPtr->readable = CreateEvent(NULL, TRUE, TRUE, NULL); - infoPtr->startReader = CreateEvent(NULL, FALSE, FALSE, NULL); - infoPtr->stopReader = CreateEvent(NULL, TRUE, FALSE, NULL); - infoPtr->readThreadExiting = FALSE; infoPtr->readThread = CreateThread(NULL, 256, PipeReaderThread, - infoPtr, 0, &id); + pipeTI, 0, &id); SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_READABLE; - wEvents[wEventsCnt++] = infoPtr->startReader; } else { + infoPtr->readTI = NULL; infoPtr->readThread = 0; } if (writeFile != NULL) { @@ -1620,31 +1888,21 @@ TclpCreateCommandChannel( * Start the background writer thread. */ + PipeThreadInfo *pipeTI = ckalloc(sizeof(PipeThreadInfo)); + pipeTI->evControl = CreateEvent(NULL, FALSE, FALSE, NULL); + pipeTI->state = PTI_STATE_IDLE; + pipeTI->clientData = infoPtr; + infoPtr->writeTI = pipeTI; infoPtr->writable = CreateEvent(NULL, TRUE, TRUE, NULL); - infoPtr->startWriter = CreateEvent(NULL, FALSE, FALSE, NULL); - infoPtr->stopWriter = CreateEvent(NULL, TRUE, FALSE, NULL); - infoPtr->writeThreadExiting = FALSE; infoPtr->writeThread = CreateThread(NULL, 256, PipeWriterThread, - infoPtr, 0, &id); + pipeTI, 0, &id); SetThreadPriority(infoPtr->writeThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_WRITABLE; - wEvents[wEventsCnt++] = infoPtr->startWriter; } else { + infoPtr->writeTI = NULL; infoPtr->writeThread = 0; } - /* - * Wait for both threads to initialize (using theirs start-events) - */ - if (wEventsCnt) { - WaitForMultipleObjects(wEventsCnt, wEvents, TRUE, 5000); - /* Resume both waiting threads, we've get the events */ - if (infoPtr->readThread) - SetEvent(infoPtr->stopReader); - if (infoPtr->writeThread) - SetEvent(infoPtr->stopWriter); - } - /* * For backward compatibility with previous versions of Tcl, we use * "file%d" as the base name for pipes even though it would be more @@ -1828,7 +2086,6 @@ PipeClose2Proc( int errorCode, result; PipeInfo *infoPtr, **nextPtrPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - DWORD exitCode; errorCode = 0; result = 0; @@ -1841,71 +2098,10 @@ PipeClose2Proc( */ if (pipePtr->readThread) { - /* - * The thread may already have closed on its own. Check its exit - * code. - */ - - GetExitCodeThread(pipePtr->readThread, &exitCode); - - if (exitCode == STILL_ACTIVE) { - /* - * Set the stop event so that if the reader thread is blocked - * in PipeReaderThread on WaitForMultipleEvents, it will exit - * cleanly. - */ - - SetEvent(pipePtr->stopReader); - - /* - * Wait at most 20 milliseconds for the reader thread to - * close. - */ - - if (WaitForSingleObject(pipePtr->readThread, - 20) == WAIT_TIMEOUT) { - /* - * The thread must be blocked waiting for the pipe to - * become readable in ReadFile(). There isn't a clean way - * to exit the thread from this condition. We should - * terminate the child process instead to get the reader - * thread to fall out of ReadFile with a FALSE. (below) is - * not the correct way to do this, but will stay here - * until a better solution is found. - * - * Note that we need to guard against terminating the - * thread while it is in the middle of Tcl_ThreadAlert - * because it won't be able to release the notifier lock. - * - * Also note that terminating threads during their initialization or teardown phase - * may result in ntdll.dll's LoaderLock to remain locked indefinitely. - * This causes ntdll.dll's LdrpInitializeThread() to deadlock trying to acquire LoaderLock. - * LdrpInitializeThread() is executed within new threads to perform - * initialization and to execute DllMain() of all loaded dlls. - * As a result, all new threads are deadlocked in their initialization phase and never execute, - * even though CreateThread() reports successful thread creation. - * This results in a very weird process-wide behavior, which is extremely hard to debug. - * - * THREADS SHOULD NEVER BE TERMINATED. Period. - * - * But for now, check if thread is exiting, and if so, let it die peacefully. - */ - - if ( !pipePtr->readThreadExiting - || WaitForSingleObject(pipePtr->readThread, 5000) != WAIT_OBJECT_0 - ) { - Tcl_MutexLock(&pipeMutex); - /* BUG: this leaks memory */ - TerminateThread(pipePtr->readThread, 0); - Tcl_MutexUnlock(&pipeMutex); - } - } - } + PipeThreadStop(&pipePtr->readTI, pipePtr->readThread); CloseHandle(pipePtr->readThread); CloseHandle(pipePtr->readable); - CloseHandle(pipePtr->startReader); - CloseHandle(pipePtr->stopReader); pipePtr->readThread = NULL; } if (TclpCloseFile(pipePtr->readFile) != 0) { @@ -1917,93 +2113,32 @@ PipeClose2Proc( if ((!flags || flags & TCL_CLOSE_WRITE) && (pipePtr->writeFile != NULL)) { if (pipePtr->writeThread) { - /* - * Wait for the writer thread to finish the current buffer, then - * terminate the thread and close the handles. If the channel is - * nonblocking but blocked during exit, bail out since the worker - * thread is not interruptible and we want TIP#398-fast-exit. - */ - if (TclInExit() - && (pipePtr->flags & PIPE_ASYNC)) { - - /* give it a chance to leave honorably */ - SetEvent(pipePtr->stopWriter); - - if (WaitForSingleObject(pipePtr->writable, 0) == WAIT_TIMEOUT) { - return EWOULDBLOCK; - } - - } else { - WaitForSingleObject(pipePtr->writable, INFINITE); - - } - - /* - * The thread may already have closed on it's own. Check its exit - * code. - */ - - GetExitCodeThread(pipePtr->writeThread, &exitCode); - - if (exitCode == STILL_ACTIVE) { + /* Notify thread we will stop work and check it still seems to work */ + if (!PipeThreadStopSignal(&pipePtr->writeTI)) { /* - * Set the stop event so that if the writer thread is blocked - * in PipeWriterThread on WaitForMultipleEvents, it will exit - * cleanly. + * Wait for the writer thread to finish the current buffer, then + * terminate the thread and close the handles. If the channel is + * nonblocking or may block during exit, bail out since the worker + * thread is not interruptible and we want TIP#398-fast-exit. */ + if ((pipePtr->flags & PIPE_ASYNC) || TclInExit()) { - SetEvent(pipePtr->stopWriter); + /* give it a chance to leave honorably */ + if (WaitForSingleObject(pipePtr->writable, 0) == WAIT_TIMEOUT) { + return EWOULDBLOCK; + } - /* - * Wait at most 20 milliseconds for the reader thread to - * close. - */ + } else { - if (WaitForSingleObject(pipePtr->writeThread, - 20) == WAIT_TIMEOUT) { - /* - * The thread must be blocked waiting for the pipe to - * consume input in WriteFile(). There isn't a clean way - * to exit the thread from this condition. We should - * terminate the child process instead to get the writer - * thread to fall out of WriteFile with a FALSE. (below) - * is not the correct way to do this, but will stay here - * until a better solution is found. - * - * Note that we need to guard against terminating the - * thread while it is in the middle of Tcl_ThreadAlert - * because it won't be able to release the notifier lock. - * - * Also note that terminating threads during their initialization or teardown phase - * may result in ntdll.dll's LoaderLock to remain locked indefinitely. - * This causes ntdll.dll's LdrpInitializeThread() to deadlock trying to acquire LoaderLock. - * LdrpInitializeThread() is executed within new threads to perform - * initialization and to execute DllMain() of all loaded dlls. - * As a result, all new threads are deadlocked in their initialization phase and never execute, - * even though CreateThread() reports successful thread creation. - * This results in a very weird process-wide behavior, which is extremely hard to debug. - * - * THREADS SHOULD NEVER BE TERMINATED. Period. - * - * But for now, check if thread is exiting, and if so, let it die peacefully. - */ + WaitForSingleObject(pipePtr->writable, INFINITE); - if ( !pipePtr->writeThreadExiting - || WaitForSingleObject(pipePtr->writeThread, 5000) != WAIT_OBJECT_0 - ) { - Tcl_MutexLock(&pipeMutex); - /* BUG: this leaks memory */ - TerminateThread(pipePtr->writeThread, 0); - Tcl_MutexUnlock(&pipeMutex); - } } } + PipeThreadStop(&pipePtr->writeTI, pipePtr->writeThread); - CloseHandle(pipePtr->writeThread); CloseHandle(pipePtr->writable); - CloseHandle(pipePtr->startWriter); - CloseHandle(pipePtr->stopWriter); + CloseHandle(pipePtr->writeThread); pipePtr->writeThread = NULL; } if (TclpCloseFile(pipePtr->writeFile) != 0) { @@ -2257,7 +2392,7 @@ PipeOutputProc( memcpy(infoPtr->writeBuf, buf, (size_t) toWrite); infoPtr->toWrite = toWrite; ResetEvent(infoPtr->writable); - SetEvent(infoPtr->startWriter); + PipeThreadSignal(&infoPtr->writeTI); bytesWritten = toWrite; } else { /* @@ -2841,7 +2976,7 @@ WaitForRead( */ ResetEvent(infoPtr->readable); - SetEvent(infoPtr->startReader); + PipeThreadSignal(&infoPtr->readTI); } } @@ -2869,39 +3004,27 @@ static DWORD WINAPI PipeReaderThread( LPVOID arg) { - PipeInfo *infoPtr = (PipeInfo *)arg; - HANDLE *handle = ((WinFile *) infoPtr->readFile)->handle; + PipeThreadInfo *pipeTI = (PipeThreadInfo *)arg; + PipeInfo *infoPtr = NULL; /* access info only after success init/wait */ + HANDLE handle = NULL; DWORD count, err; int done = 0; - HANDLE wEvents[2]; - DWORD waitResult; - - /* - * Notify caller that this thread has been initialized - */ - SignalObjectAndWait(infoPtr->startReader, infoPtr->stopReader, INFINITE, FALSE); - ResetEvent(infoPtr->stopReader); /* not auto-reset */ - - wEvents[0] = infoPtr->stopReader; - wEvents[1] = infoPtr->startReader; - + while (!done) { /* * Wait for the main thread to signal before attempting to wait on the * pipe becoming readable. */ - - waitResult = WaitForMultipleObjects(2, wEvents, FALSE, INFINITE); - - if (waitResult != (WAIT_OBJECT_0 + 1)) { - /* - * The start event was not signaled. It might be the stop event or - * an error, so exit. - */ - + if (!PipeThreadWaitForSignal(&pipeTI)) { + /* exit */ break; } + if (!infoPtr) { + infoPtr = (PipeInfo *)pipeTI->clientData; + handle = ((WinFile *) infoPtr->readFile)->handle; + } + /* * Try waiting for 0 bytes. This will block until some data is * available on NT, but will return immediately on Win 95. So, if no @@ -2948,7 +3071,6 @@ PipeReaderThread( } } - /* * Signal the main thread by signalling the readable event and then * waking up the notifier thread. @@ -2975,10 +3097,10 @@ PipeReaderThread( } /* - * Inform caller that this thread should not be terminated, since it is about to exit. - * See comment in PipeClose2Proc() for reasons. - */ - infoPtr->readThreadExiting = TRUE; + * If state of thread was set to stop, we can sane free info structure, + * otherwise it is shared with main thread, so main thread will own it + */ + PipeThreadExit(&pipeTI); return 0; } @@ -3004,43 +3126,27 @@ static DWORD WINAPI PipeWriterThread( LPVOID arg) { - PipeInfo *infoPtr = (PipeInfo *)arg; - HANDLE *handle = ((WinFile *) infoPtr->writeFile)->handle; + PipeThreadInfo *pipeTI = (PipeThreadInfo *)arg; + PipeInfo *infoPtr = NULL; /* access info only after success init/wait */ + HANDLE handle = NULL; DWORD count, toWrite; char *buf; int done = 0; - HANDLE wEvents[2]; - DWORD waitResult; - - /* - * Notify caller that this thread has been initialized - */ - SignalObjectAndWait(infoPtr->startWriter, infoPtr->stopWriter, INFINITE, FALSE); - ResetEvent(infoPtr->stopWriter); /* not auto-reset */ - - wEvents[0] = infoPtr->stopWriter; - wEvents[1] = infoPtr->startWriter; while (!done) { /* * Wait for the main thread to signal before attempting to write. */ - - waitResult = WaitForMultipleObjects(2, wEvents, FALSE, INFINITE); - - if (waitResult != (WAIT_OBJECT_0 + 1)) { - /* - * The start event was not signaled. It might be the stop event or - * an error, so exit. - */ - - if (waitResult == WAIT_OBJECT_0) { - SetEvent(infoPtr->writable); - } - + if (!PipeThreadWaitForSignal(&pipeTI)) { + /* exit */ break; } + if (!infoPtr) { + infoPtr = (PipeInfo *)pipeTI->clientData; + handle = ((WinFile *) infoPtr->writeFile)->handle; + } + buf = infoPtr->writeBuf; toWrite = infoPtr->toWrite; @@ -3085,10 +3191,10 @@ PipeWriterThread( } /* - * Inform caller that this thread should not be terminated, since it is about to exit. - * See comment in PipeClose2Proc() for reasons. + * If state of thread was set to stop, we can sane free info structure, + * otherwise it is shared with main thread, so main thread will own it. */ - infoPtr->writeThreadExiting = TRUE; + PipeThreadExit(&pipeTI); return 0; } -- cgit v0.12 From f5538049ef0a44bcdc024febef5803c397b4067a Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 11 Apr 2017 18:08:43 +0000 Subject: code review and fix small memory leak using ckalloc, without finalization of tcl subsystem in the worker (if it owns TI structure and calls ckfree) --- win/tclWinPipe.c | 107 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 36 deletions(-) diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index bb76eef..13d90b6 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -101,11 +101,42 @@ typedef struct PipeThreadInfo { } PipeThreadInfo; -#define PTI_STATE_IDLE 0 -#define PTI_STATE_WORK 1 -#define PTI_STATE_STOP 2 -#define PTI_STATE_END 4 -#define PTI_STATE_DOWN 8 +/* If pipe-workers will use some tcl subsystem, we can use ckalloc without + * more overhead for finalize thread (should be executed anyway) + * + * #define _PTI_USE_CKALLOC 1 + */ + +/* + * State of the pipe-worker. + * + * State PTI_STATE_STOP possible from idle state only, worker owns TI structure. + * Otherwise PTI_STATE_END used (main thread hold ownership of the TI). + */ + +#define PTI_STATE_IDLE 0 /* idle or not yet initialzed */ +#define PTI_STATE_WORK 1 /* in work */ +#define PTI_STATE_STOP 2 /* thread should stop work (owns TI structure) */ +#define PTI_STATE_END 4 /* thread should stop work (worker is busy) */ +#define PTI_STATE_DOWN 8 /* worker is down */ + + +PipeThreadInfo * +PipeThreadCreateTI( + PipeThreadInfo **pipeTIPtr, + ClientData clientData) +{ + PipeThreadInfo *pipeTI; +#ifndef _PTI_USE_CKALLOC + pipeTI = malloc(sizeof(PipeThreadInfo)); +#else + pipeTI = ckalloc(sizeof(PipeThreadInfo)); +#endif + pipeTI->evControl = CreateEvent(NULL, FALSE, FALSE, NULL); + pipeTI->state = PTI_STATE_IDLE; + pipeTI->clientData = clientData; + return (*pipeTIPtr = pipeTI); +} int PipeThreadWaitForSignal( @@ -292,7 +323,7 @@ PipeThreadStop( /* if we want TIP#398-fast-exit. */ if (WaitForSingleObject(hThread, - TclInExit() ? 0 : 0) == WAIT_TIMEOUT) { + TclInExit() ? 0 : 20) == WAIT_TIMEOUT) { /* * The thread must be blocked waiting for the pipe to @@ -343,7 +374,11 @@ PipeThreadStop( *pipeTIPtr = NULL; if (pipeTI) { CloseHandle(pipeTI->evControl); + #ifndef _PTI_USE_CKALLOC + free(pipeTI); + #else ckfree(pipeTI); + #endif } } @@ -365,7 +400,13 @@ PipeThreadExit( if ((state = InterlockedExchange(&pipeTI->state, PTI_STATE_DOWN)) == PTI_STATE_STOP) { CloseHandle(pipeTI->evControl); + #ifndef _PTI_USE_CKALLOC + free(pipeTI); + #else ckfree(pipeTI); + /* be sure all subsystems used are finalized */ + Tcl_FinalizeThread(); + #endif } } @@ -1869,14 +1910,9 @@ TclpCreateCommandChannel( * Start the background reader thread. */ - PipeThreadInfo *pipeTI = ckalloc(sizeof(PipeThreadInfo)); - pipeTI->evControl = CreateEvent(NULL, FALSE, FALSE, NULL); - pipeTI->state = PTI_STATE_IDLE; - pipeTI->clientData = infoPtr; - infoPtr->readTI = pipeTI; infoPtr->readable = CreateEvent(NULL, TRUE, TRUE, NULL); infoPtr->readThread = CreateThread(NULL, 256, PipeReaderThread, - pipeTI, 0, &id); + PipeThreadCreateTI(&infoPtr->readTI, infoPtr), 0, &id); SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_READABLE; } else { @@ -1888,14 +1924,9 @@ TclpCreateCommandChannel( * Start the background writer thread. */ - PipeThreadInfo *pipeTI = ckalloc(sizeof(PipeThreadInfo)); - pipeTI->evControl = CreateEvent(NULL, FALSE, FALSE, NULL); - pipeTI->state = PTI_STATE_IDLE; - pipeTI->clientData = infoPtr; - infoPtr->writeTI = pipeTI; infoPtr->writable = CreateEvent(NULL, TRUE, TRUE, NULL); infoPtr->writeThread = CreateThread(NULL, 256, PipeWriterThread, - pipeTI, 0, &id); + PipeThreadCreateTI(&infoPtr->writeTI, infoPtr), 0, &id); SetThreadPriority(infoPtr->writeThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_WRITABLE; } else { @@ -2114,27 +2145,27 @@ PipeClose2Proc( && (pipePtr->writeFile != NULL)) { if (pipePtr->writeThread) { - /* Notify thread we will stop work and check it still seems to work */ - if (!PipeThreadStopSignal(&pipePtr->writeTI)) { - /* - * Wait for the writer thread to finish the current buffer, then - * terminate the thread and close the handles. If the channel is - * nonblocking or may block during exit, bail out since the worker - * thread is not interruptible and we want TIP#398-fast-exit. - */ - if ((pipePtr->flags & PIPE_ASYNC) || TclInExit()) { + /* + * Wait for the writer thread to finish the current buffer, then + * terminate the thread and close the handles. If the channel is + * nonblocking or may block during exit, bail out since the worker + * thread is not interruptible and we want TIP#398-fast-exit. + */ + if ((pipePtr->flags & PIPE_ASYNC) && TclInExit()) { - /* give it a chance to leave honorably */ - if (WaitForSingleObject(pipePtr->writable, 0) == WAIT_TIMEOUT) { - return EWOULDBLOCK; - } + /* give it a chance to leave honorably */ + PipeThreadStopSignal(&pipePtr->writeTI); - } else { + if (WaitForSingleObject(pipePtr->writable, 20) == WAIT_TIMEOUT) { + return EWOULDBLOCK; + } - WaitForSingleObject(pipePtr->writable, INFINITE); + } else { + + WaitForSingleObject(pipePtr->writable, INFINITE); - } } + PipeThreadStop(&pipePtr->writeTI, pipePtr->writeThread); CloseHandle(pipePtr->writable); @@ -3128,7 +3159,7 @@ PipeWriterThread( { PipeThreadInfo *pipeTI = (PipeThreadInfo *)arg; PipeInfo *infoPtr = NULL; /* access info only after success init/wait */ - HANDLE handle = NULL; + HANDLE handle = NULL, writable = NULL; DWORD count, toWrite; char *buf; int done = 0; @@ -3139,12 +3170,16 @@ PipeWriterThread( */ if (!PipeThreadWaitForSignal(&pipeTI)) { /* exit */ + if (writable) { + SetEvent(writable); + } break; } if (!infoPtr) { infoPtr = (PipeInfo *)pipeTI->clientData; handle = ((WinFile *) infoPtr->writeFile)->handle; + writable = infoPtr->writable; } buf = infoPtr->writeBuf; @@ -3170,7 +3205,7 @@ PipeWriterThread( * waking up the notifier thread. */ - SetEvent(infoPtr->writable); + SetEvent(writable); /* * Alert the foreground thread. Note that we need to treat this like a -- cgit v0.12 From b8186ff7078b1c41f2c3cb7dec93cc7d72cd2c01 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 11 Apr 2017 18:09:06 +0000 Subject: prepared to use pipe-helpers (TI-structure handling) for all pipe-workers (tclWinConsole, tclWinSerial) --- win/tclWinInt.h | 56 + win/tclWinPipe.c | 4698 +++++++++++++++++++++++++++--------------------------- 2 files changed, 2428 insertions(+), 2326 deletions(-) diff --git a/win/tclWinInt.h b/win/tclWinInt.h index b8d493e..8ce4152 100644 --- a/win/tclWinInt.h +++ b/win/tclWinInt.h @@ -95,4 +95,60 @@ MODULE_SCOPE void TclpSetAllocCache(void *); #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 #endif +/* + *---------------------------------------------------------------------- + * Declarations of helper-workers threaded facilities for a pipe based channel. + * + * Corresponding functionality provided in "tclWinPipe.c". + *---------------------------------------------------------------------- + */ + +typedef struct TclPipeThreadInfo { + HANDLE evControl; /* Auto-reset event used by the main thread to + * signal when the pipe thread should attempt + * to do read/write operation. Additionally + * used as signal to stop (state set to -1) */ + volatile LONG state; /* Indicates current state of the thread */ + ClientData clientData; /* Referenced data of the main thread */ +} TclPipeThreadInfo; + + +/* If pipe-workers will use some tcl subsystem, we can use ckalloc without + * more overhead for finalize thread (should be executed anyway) + * + * #define _PTI_USE_CKALLOC 1 + */ + +/* + * State of the pipe-worker. + * + * State PTI_STATE_STOP possible from idle state only, worker owns TI structure. + * Otherwise PTI_STATE_END used (main thread hold ownership of the TI). + */ + +#define PTI_STATE_IDLE 0 /* idle or not yet initialzed */ +#define PTI_STATE_WORK 1 /* in work */ +#define PTI_STATE_STOP 2 /* thread should stop work (owns TI structure) */ +#define PTI_STATE_END 4 /* thread should stop work (worker is busy) */ +#define PTI_STATE_DOWN 8 /* worker is down */ + + +MODULE_SCOPE +TclPipeThreadInfo * TclPipeThreadCreateTI(TclPipeThreadInfo **pipeTIPtr, ClientData clientData); +MODULE_SCOPE int TclPipeThreadWaitForSignal(TclPipeThreadInfo **pipeTIPtr); + +static inline void +TclPipeThreadSignal( + TclPipeThreadInfo **pipeTIPtr) +{ + TclPipeThreadInfo *pipeTI = *pipeTIPtr; + if (pipeTI) { + SetEvent(pipeTI->evControl); + } +}; + +MODULE_SCOPE int TclPipeThreadStopSignal(TclPipeThreadInfo **pipeTIPtr); +MODULE_SCOPE void TclPipeThreadStop(TclPipeThreadInfo **pipeTIPtr, HANDLE hThread); +MODULE_SCOPE void TclPipeThreadExit(TclPipeThreadInfo **pipeTIPtr); + #endif /* _TCLWININT */ diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 13d90b6..4b4e68d 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -91,325 +91,6 @@ static ProcInfo *procList; * This structure describes per-instance data for a pipe based channel. */ -typedef struct PipeThreadInfo { - HANDLE evControl; /* Auto-reset event used by the main thread to - * signal when the pipe thread should attempt - * to do read/write operation. Additionally - * used as signal to stop (state set to -1) */ - volatile LONG state; /* Indicates current state of the thread */ - ClientData clientData; /* Referenced data of the main thread */ -} PipeThreadInfo; - - -/* If pipe-workers will use some tcl subsystem, we can use ckalloc without - * more overhead for finalize thread (should be executed anyway) - * - * #define _PTI_USE_CKALLOC 1 - */ - -/* - * State of the pipe-worker. - * - * State PTI_STATE_STOP possible from idle state only, worker owns TI structure. - * Otherwise PTI_STATE_END used (main thread hold ownership of the TI). - */ - -#define PTI_STATE_IDLE 0 /* idle or not yet initialzed */ -#define PTI_STATE_WORK 1 /* in work */ -#define PTI_STATE_STOP 2 /* thread should stop work (owns TI structure) */ -#define PTI_STATE_END 4 /* thread should stop work (worker is busy) */ -#define PTI_STATE_DOWN 8 /* worker is down */ - - -PipeThreadInfo * -PipeThreadCreateTI( - PipeThreadInfo **pipeTIPtr, - ClientData clientData) -{ - PipeThreadInfo *pipeTI; -#ifndef _PTI_USE_CKALLOC - pipeTI = malloc(sizeof(PipeThreadInfo)); -#else - pipeTI = ckalloc(sizeof(PipeThreadInfo)); -#endif - pipeTI->evControl = CreateEvent(NULL, FALSE, FALSE, NULL); - pipeTI->state = PTI_STATE_IDLE; - pipeTI->clientData = clientData; - return (*pipeTIPtr = pipeTI); -} - -int -PipeThreadWaitForSignal( - PipeThreadInfo **pipeTIPtr) -{ - PipeThreadInfo *pipeTI = *pipeTIPtr; - LONG state; - DWORD waitResult; - - if (!pipeTI) { - return 0; - } - /* - * Wait for the main thread to signal before attempting to do the work. - */ - - /* reset work state of thread (idle/waiting) */ - if ((state = InterlockedCompareExchange(&pipeTI->state, - PTI_STATE_IDLE, PTI_STATE_WORK)) & (PTI_STATE_STOP|PTI_STATE_END)) { - /* end of work, check the owner of structure */ - goto end; - } - /* entering wait */ - waitResult = WaitForSingleObject(pipeTI->evControl, INFINITE); - - if (waitResult != WAIT_OBJECT_0) { - - /* - * The control event was not signaled, so end of work (unexpected - * behaviour, main thread can be dead?). - */ - goto end; - } - - /* try to set work state of thread */ - if ((state = InterlockedCompareExchange(&pipeTI->state, - PTI_STATE_WORK, PTI_STATE_IDLE)) & (PTI_STATE_STOP|PTI_STATE_END)) { - /* end of work */ - goto end; - } - - /* signaled to work */ - return 1; - -end: - /* end of work, check the owner of the TI structure */ - if (state != PTI_STATE_STOP) { - *pipeTIPtr = NULL; - } - return 0; -} - -static inline void -PipeThreadSignal( - PipeThreadInfo **pipeTIPtr) -{ - PipeThreadInfo *pipeTI = *pipeTIPtr; - if (pipeTI) { - SetEvent(pipeTI->evControl); - } -} - -int -PipeThreadStopSignal( - PipeThreadInfo **pipeTIPtr) -{ - PipeThreadInfo *pipeTI = *pipeTIPtr; - HANDLE evControl; - int state; - - if (!pipeTI) { - return 1; - } - evControl = pipeTI->evControl; - switch ( - (state = InterlockedCompareExchange(&pipeTI->state, - PTI_STATE_STOP, PTI_STATE_IDLE)) - ) { - - case PTI_STATE_IDLE: - - /* Thread was idle/waiting, notify it goes teardown */ - SetEvent(evControl); - - *pipeTIPtr = NULL; - - case PTI_STATE_DOWN: - - return 1; - - default: - /* - * Thread works currently, we should try to end it, own the TI structure - * (because of possible sharing the joint structures with thread) - */ - InterlockedExchange(&pipeTI->state, PTI_STATE_END); - break; - } - - return 0; -} - -void -PipeThreadStop( - PipeThreadInfo **pipeTIPtr, - HANDLE hThread) -{ - PipeThreadInfo *pipeTI = *pipeTIPtr; - HANDLE evControl; - int state; - - if (!pipeTI) { - return; - } - pipeTI = *pipeTIPtr; - evControl = pipeTI->evControl; - /* - * Try to sane stop the pipe worker, corresponding its current state - */ - switch ( - (state = InterlockedCompareExchange(&pipeTI->state, - PTI_STATE_STOP, PTI_STATE_IDLE)) - ) { - - case PTI_STATE_IDLE: - - /* Thread was idle/waiting, notify it goes teardown */ - SetEvent(evControl); - - /* we don't need to wait for it at all, thread frees himself (owns the TI structure) */ - pipeTI = NULL; - break; - - case PTI_STATE_STOP: - /* already stopped, thread frees himself (owns the TI structure) */ - pipeTI = NULL; - break; - case PTI_STATE_DOWN: - /* Thread already down (?), do nothing */ - - /* we don't need to wait for it, but we should free pipeTI */ - hThread = NULL; - break; - - /* case PTI_STATE_WORK: */ - default: - /* - * Thread works currently, we should try to end it, own the TI structure - * (because of possible sharing the joint structures with thread) - */ - InterlockedExchange(&pipeTI->state, PTI_STATE_END); - break; - } - - if (pipeTI && hThread) { - DWORD exitCode; - - /* - * The thread may already have closed on its own. Check its exit - * code. - */ - - GetExitCodeThread(hThread, &exitCode); - - if (exitCode == STILL_ACTIVE) { - /* - * Set the stop event so that if the pipe thread is blocked - * somewhere, it may hereafter sane exit cleanly. - */ - - SetEvent(evControl); - - /* - * Cancel all sync-IO of this thread (may be blocked there). - */ - if (tclWinProcs->cancelSynchronousIo) { - tclWinProcs->cancelSynchronousIo(hThread); - } - - /* - * Wait at most 20 milliseconds for the reader thread to - * close (regarding TIP#398-fast-exit). - */ - - /* if we want TIP#398-fast-exit. */ - if (WaitForSingleObject(hThread, - TclInExit() ? 0 : 20) == WAIT_TIMEOUT) { - - /* - * The thread must be blocked waiting for the pipe to - * become readable in ReadFile(). There isn't a clean way - * to exit the thread from this condition. We should - * terminate the child process instead to get the reader - * thread to fall out of ReadFile with a FALSE. (below) is - * not the correct way to do this, but will stay here - * until a better solution is found. - * - * Note that we need to guard against terminating the - * thread while it is in the middle of Tcl_ThreadAlert - * because it won't be able to release the notifier lock. - * - * Also note that terminating threads during their initialization or teardown phase - * may result in ntdll.dll's LoaderLock to remain locked indefinitely. - * This causes ntdll.dll's LdrpInitializeThread() to deadlock trying to acquire LoaderLock. - * LdrpInitializeThread() is executed within new threads to perform - * initialization and to execute DllMain() of all loaded dlls. - * As a result, all new threads are deadlocked in their initialization phase and never execute, - * even though CreateThread() reports successful thread creation. - * This results in a very weird process-wide behavior, which is extremely hard to debug. - * - * THREADS SHOULD NEVER BE TERMINATED. Period. - * - * But for now, check if thread is exiting, and if so, let it die peacefully. - */ - - if ( pipeTI->state != PTI_STATE_DOWN - && WaitForSingleObject(hThread, - TclInExit() ? 0 : 5000) != WAIT_OBJECT_0 - ) { - Tcl_MutexLock(&pipeMutex); - /* BUG: this leaks memory */ - if (!TerminateThread(hThread, 0)) { - /* terminate fails, just give thread a chance to exit */ - if (InterlockedExchange(&pipeTI->state, - PTI_STATE_STOP) != PTI_STATE_DOWN) { - pipeTI = NULL; - } - }; - Tcl_MutexUnlock(&pipeMutex); - } - } - } - } - - *pipeTIPtr = NULL; - if (pipeTI) { - CloseHandle(pipeTI->evControl); - #ifndef _PTI_USE_CKALLOC - free(pipeTI); - #else - ckfree(pipeTI); - #endif - } -} - -void -PipeThreadExit( - PipeThreadInfo **pipeTIPtr) -{ - LONG state; - PipeThreadInfo *pipeTI = *pipeTIPtr; - /* - * If state of thread was set to stop (exactly), we can sane free its info - * structure, otherwise it is shared with main thread, so main thread will - * own it. - */ - if (!pipeTI) { - return; - } - *pipeTIPtr = NULL; - if ((state = InterlockedExchange(&pipeTI->state, - PTI_STATE_DOWN)) == PTI_STATE_STOP) { - CloseHandle(pipeTI->evControl); - #ifndef _PTI_USE_CKALLOC - free(pipeTI); - #else - ckfree(pipeTI); - /* be sure all subsystems used are finalized */ - Tcl_FinalizeThread(); - #endif - } -} - typedef struct PipeInfo { struct PipeInfo *nextPtr; /* Pointer to next registered pipe. */ Tcl_Channel channel; /* Pointer to channel structure. */ @@ -428,8 +109,8 @@ typedef struct PipeInfo { Tcl_ThreadId threadId; /* Thread to which events should be reported. * This value is used by the reader/writer * threads. */ - PipeThreadInfo *writeTI; /* Thread info of writer and reader, this */ - PipeThreadInfo *readTI; /* structure owned by corresponding thread. */ + TclPipeThreadInfo *writeTI; /* Thread info of writer and reader, this */ + TclPipeThreadInfo *readTI; /* structure owned by corresponding thread. */ HANDLE writeThread; /* Handle to writer thread. */ HANDLE readThread; /* Handle to reader thread. */ @@ -614,445 +295,921 @@ TclpFinalizePipes(void) /* *---------------------------------------------------------------------- * - * PipeSetupProc -- + * PipeSetupProc -- + * + * This function is invoked before Tcl_DoOneEvent blocks waiting for an + * event. + * + * Results: + * None. + * + * Side effects: + * Adjusts the block time if needed. + * + *---------------------------------------------------------------------- + */ + +void +PipeSetupProc( + ClientData data, /* Not used. */ + int flags) /* Event flags as passed to Tcl_DoOneEvent. */ +{ + PipeInfo *infoPtr; + Tcl_Time blockTime = { 0, 0 }; + int block = 1; + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + + if (!(flags & TCL_FILE_EVENTS)) { + return; + } + + /* + * Look to see if any events are already pending. If they are, poll. + */ + + for (infoPtr = tsdPtr->firstPipePtr; infoPtr != NULL; + infoPtr = infoPtr->nextPtr) { + if (infoPtr->watchMask & TCL_WRITABLE) { + if (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT) { + block = 0; + } + } + if (infoPtr->watchMask & TCL_READABLE) { + if (WaitForRead(infoPtr, 0) >= 0) { + block = 0; + } + } + } + if (!block) { + Tcl_SetMaxBlockTime(&blockTime); + } +} + +/* + *---------------------------------------------------------------------- + * + * PipeCheckProc -- + * + * This function is called by Tcl_DoOneEvent to check the pipe event + * source for events. + * + * Results: + * None. + * + * Side effects: + * May queue an event. + * + *---------------------------------------------------------------------- + */ + +static void +PipeCheckProc( + ClientData data, /* Not used. */ + int flags) /* Event flags as passed to Tcl_DoOneEvent. */ +{ + PipeInfo *infoPtr; + PipeEvent *evPtr; + int needEvent; + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + + if (!(flags & TCL_FILE_EVENTS)) { + return; + } + + /* + * Queue events for any ready pipes that don't already have events queued. + */ + + for (infoPtr = tsdPtr->firstPipePtr; infoPtr != NULL; + infoPtr = infoPtr->nextPtr) { + if (infoPtr->flags & PIPE_PENDING) { + continue; + } + + /* + * Queue an event if the pipe is signaled for reading or writing. + */ + + needEvent = 0; + if ((infoPtr->watchMask & TCL_WRITABLE) && + (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT)) { + needEvent = 1; + } + + if ((infoPtr->watchMask & TCL_READABLE) && + (WaitForRead(infoPtr, 0) >= 0)) { + needEvent = 1; + } + + if (needEvent) { + infoPtr->flags |= PIPE_PENDING; + evPtr = ckalloc(sizeof(PipeEvent)); + evPtr->header.proc = PipeEventProc; + evPtr->infoPtr = infoPtr; + Tcl_QueueEvent((Tcl_Event *) evPtr, TCL_QUEUE_TAIL); + } + } +} + +/* + *---------------------------------------------------------------------- + * + * TclWinMakeFile -- + * + * This function constructs a new TclFile from a given data and type + * value. + * + * Results: + * Returns a newly allocated WinFile as a TclFile. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +TclFile +TclWinMakeFile( + HANDLE handle) /* Type-specific data. */ +{ + WinFile *filePtr; + + filePtr = ckalloc(sizeof(WinFile)); + filePtr->type = WIN_FILE; + filePtr->handle = handle; + + return (TclFile)filePtr; +} + +/* + *---------------------------------------------------------------------- + * + * TempFileName -- + * + * Gets a temporary file name and deals with the fact that the temporary + * file path provided by Windows may not actually exist if the TMP or + * TEMP environment variables refer to a non-existent directory. + * + * Results: + * 0 if error, non-zero otherwise. If non-zero is returned, the name + * buffer will be filled with a name that can be used to construct a + * temporary file. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +TempFileName( + TCHAR name[MAX_PATH]) /* Buffer in which name for temporary file + * gets stored. */ +{ + const TCHAR *prefix = TEXT("TCL"); + if (GetTempPath(MAX_PATH, name) != 0) { + if (GetTempFileName(name, prefix, 0, name) != 0) { + return 1; + } + } + name[0] = '.'; + name[1] = '\0'; + return GetTempFileName(name, prefix, 0, name); +} + +/* + *---------------------------------------------------------------------- + * + * TclpMakeFile -- + * + * Make a TclFile from a channel. + * + * Results: + * Returns a new TclFile or NULL on failure. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +TclFile +TclpMakeFile( + Tcl_Channel channel, /* Channel to get file from. */ + int direction) /* Either TCL_READABLE or TCL_WRITABLE. */ +{ + HANDLE handle; + + if (Tcl_GetChannelHandle(channel, direction, + (ClientData *) &handle) == TCL_OK) { + return TclWinMakeFile(handle); + } else { + return (TclFile) NULL; + } +} + +/* + *---------------------------------------------------------------------- + * + * TclpOpenFile -- * - * This function is invoked before Tcl_DoOneEvent blocks waiting for an - * event. + * This function opens files for use in a pipeline. * * Results: - * None. + * Returns a newly allocated TclFile structure containing the file + * handle. * * Side effects: - * Adjusts the block time if needed. + * None. * *---------------------------------------------------------------------- */ -void -PipeSetupProc( - ClientData data, /* Not used. */ - int flags) /* Event flags as passed to Tcl_DoOneEvent. */ +TclFile +TclpOpenFile( + const char *path, /* The name of the file to open. */ + int mode) /* In what mode to open the file? */ { - PipeInfo *infoPtr; - Tcl_Time blockTime = { 0, 0 }; - int block = 1; - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + HANDLE handle; + DWORD accessMode, createMode, shareMode, flags; + Tcl_DString ds; + const TCHAR *nativePath; - if (!(flags & TCL_FILE_EVENTS)) { - return; + /* + * Map the access bits to the NT access mode. + */ + + switch (mode & (O_RDONLY | O_WRONLY | O_RDWR)) { + case O_RDONLY: + accessMode = GENERIC_READ; + break; + case O_WRONLY: + accessMode = GENERIC_WRITE; + break; + case O_RDWR: + accessMode = (GENERIC_READ | GENERIC_WRITE); + break; + default: + TclWinConvertError(ERROR_INVALID_FUNCTION); + return NULL; } /* - * Look to see if any events are already pending. If they are, poll. + * Map the creation flags to the NT create mode. */ - for (infoPtr = tsdPtr->firstPipePtr; infoPtr != NULL; - infoPtr = infoPtr->nextPtr) { - if (infoPtr->watchMask & TCL_WRITABLE) { - if (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT) { - block = 0; - } + switch (mode & (O_CREAT | O_EXCL | O_TRUNC)) { + case (O_CREAT | O_EXCL): + case (O_CREAT | O_EXCL | O_TRUNC): + createMode = CREATE_NEW; + break; + case (O_CREAT | O_TRUNC): + createMode = CREATE_ALWAYS; + break; + case O_CREAT: + createMode = OPEN_ALWAYS; + break; + case O_TRUNC: + case (O_TRUNC | O_EXCL): + createMode = TRUNCATE_EXISTING; + break; + default: + createMode = OPEN_EXISTING; + break; + } + + nativePath = Tcl_WinUtfToTChar(path, -1, &ds); + + /* + * If the file is not being created, use the existing file attributes. + */ + + flags = 0; + if (!(mode & O_CREAT)) { + flags = GetFileAttributes(nativePath); + if (flags == 0xFFFFFFFF) { + flags = 0; } - if (infoPtr->watchMask & TCL_READABLE) { - if (WaitForRead(infoPtr, 0) >= 0) { - block = 0; - } + } + + /* + * Set up the file sharing mode. We want to allow simultaneous access. + */ + + shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; + + /* + * Now we get to create the file. + */ + + handle = CreateFile(nativePath, accessMode, shareMode, + NULL, createMode, flags, NULL); + Tcl_DStringFree(&ds); + + if (handle == INVALID_HANDLE_VALUE) { + DWORD err; + + err = GetLastError(); + if ((err & 0xffffL) == ERROR_OPEN_FAILED) { + err = (mode & O_CREAT) ? ERROR_FILE_EXISTS : ERROR_FILE_NOT_FOUND; } + TclWinConvertError(err); + return NULL; } - if (!block) { - Tcl_SetMaxBlockTime(&blockTime); + + /* + * Seek to the end of file if we are writing. + */ + + if (mode & (O_WRONLY|O_APPEND)) { + SetFilePointer(handle, 0, NULL, FILE_END); } + + return TclWinMakeFile(handle); } /* *---------------------------------------------------------------------- * - * PipeCheckProc -- + * TclpCreateTempFile -- * - * This function is called by Tcl_DoOneEvent to check the pipe event - * source for events. + * This function opens a unique file with the property that it will be + * deleted when its file handle is closed. The temporary file is created + * in the system temporary directory. * * Results: - * None. + * Returns a valid TclFile, or NULL on failure. * * Side effects: - * May queue an event. + * Creates a new temporary file. * *---------------------------------------------------------------------- */ -static void -PipeCheckProc( - ClientData data, /* Not used. */ - int flags) /* Event flags as passed to Tcl_DoOneEvent. */ +TclFile +TclpCreateTempFile( + const char *contents) /* String to write into temp file, or NULL. */ { - PipeInfo *infoPtr; - PipeEvent *evPtr; - int needEvent; - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + TCHAR name[MAX_PATH]; + const char *native; + Tcl_DString dstring; + HANDLE handle; - if (!(flags & TCL_FILE_EVENTS)) { - return; + if (TempFileName(name) == 0) { + return NULL; + } + + handle = CreateFile(name, + GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE, NULL); + if (handle == INVALID_HANDLE_VALUE) { + goto error; } /* - * Queue events for any ready pipes that don't already have events queued. + * Write the file out, doing line translations on the way. */ - for (infoPtr = tsdPtr->firstPipePtr; infoPtr != NULL; - infoPtr = infoPtr->nextPtr) { - if (infoPtr->flags & PIPE_PENDING) { - continue; - } + if (contents != NULL) { + DWORD result, length; + const char *p; + int toCopy; /* - * Queue an event if the pipe is signaled for reading or writing. + * Convert the contents from UTF to native encoding */ - needEvent = 0; - if ((infoPtr->watchMask & TCL_WRITABLE) && - (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT)) { - needEvent = 1; - } + native = Tcl_UtfToExternalDString(NULL, contents, -1, &dstring); - if ((infoPtr->watchMask & TCL_READABLE) && - (WaitForRead(infoPtr, 0) >= 0)) { - needEvent = 1; + toCopy = Tcl_DStringLength(&dstring); + for (p = native; toCopy > 0; p++, toCopy--) { + if (*p == '\n') { + length = p - native; + if (length > 0) { + if (!WriteFile(handle, native, length, &result, NULL)) { + goto error; + } + } + if (!WriteFile(handle, "\r\n", 2, &result, NULL)) { + goto error; + } + native = p+1; + } } - - if (needEvent) { - infoPtr->flags |= PIPE_PENDING; - evPtr = ckalloc(sizeof(PipeEvent)); - evPtr->header.proc = PipeEventProc; - evPtr->infoPtr = infoPtr; - Tcl_QueueEvent((Tcl_Event *) evPtr, TCL_QUEUE_TAIL); + length = p - native; + if (length > 0) { + if (!WriteFile(handle, native, length, &result, NULL)) { + goto error; + } + } + Tcl_DStringFree(&dstring); + if (SetFilePointer(handle, 0, NULL, FILE_BEGIN) == 0xFFFFFFFF) { + goto error; } } + + return TclWinMakeFile(handle); + + error: + /* + * Free the native representation of the contents if necessary. + */ + + if (contents != NULL) { + Tcl_DStringFree(&dstring); + } + + TclWinConvertError(GetLastError()); + CloseHandle(handle); + DeleteFile(name); + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * TclpTempFileName -- + * + * This function returns a unique filename. + * + * Results: + * Returns a valid Tcl_Obj* with refCount 0, or NULL on failure. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Tcl_Obj * +TclpTempFileName(void) +{ + TCHAR fileName[MAX_PATH]; + + if (TempFileName(fileName) == 0) { + return NULL; + } + + return TclpNativeToNormalized(fileName); } /* *---------------------------------------------------------------------- * - * TclWinMakeFile -- + * TclpCreatePipe -- * - * This function constructs a new TclFile from a given data and type - * value. + * Creates an anonymous pipe. * * Results: - * Returns a newly allocated WinFile as a TclFile. + * Returns 1 on success, 0 on failure. * * Side effects: - * None. + * Creates a pipe. * *---------------------------------------------------------------------- */ -TclFile -TclWinMakeFile( - HANDLE handle) /* Type-specific data. */ +int +TclpCreatePipe( + TclFile *readPipe, /* Location to store file handle for read side + * of pipe. */ + TclFile *writePipe) /* Location to store file handle for write + * side of pipe. */ { - WinFile *filePtr; + HANDLE readHandle, writeHandle; - filePtr = ckalloc(sizeof(WinFile)); - filePtr->type = WIN_FILE; - filePtr->handle = handle; + if (CreatePipe(&readHandle, &writeHandle, NULL, 0) != 0) { + *readPipe = TclWinMakeFile(readHandle); + *writePipe = TclWinMakeFile(writeHandle); + return 1; + } - return (TclFile)filePtr; + TclWinConvertError(GetLastError()); + return 0; } /* *---------------------------------------------------------------------- * - * TempFileName -- + * TclpCloseFile -- * - * Gets a temporary file name and deals with the fact that the temporary - * file path provided by Windows may not actually exist if the TMP or - * TEMP environment variables refer to a non-existent directory. + * Closes a pipeline file handle. These handles are created by + * TclpOpenFile, TclpCreatePipe, or TclpMakeFile. * * Results: - * 0 if error, non-zero otherwise. If non-zero is returned, the name - * buffer will be filled with a name that can be used to construct a - * temporary file. + * 0 on success, -1 on failure. * * Side effects: - * None. + * The file is closed and deallocated. * *---------------------------------------------------------------------- */ -static int -TempFileName( - TCHAR name[MAX_PATH]) /* Buffer in which name for temporary file - * gets stored. */ +int +TclpCloseFile( + TclFile file) /* The file to close. */ { - const TCHAR *prefix = TEXT("TCL"); - if (GetTempPath(MAX_PATH, name) != 0) { - if (GetTempFileName(name, prefix, 0, name) != 0) { - return 1; + WinFile *filePtr = (WinFile *) file; + + switch (filePtr->type) { + case WIN_FILE: + /* + * Don't close the Win32 handle if the handle is a standard channel + * during the thread exit process. Otherwise, one thread may kill the + * stdio of another. + */ + + if (!TclInThreadExit() + || ((GetStdHandle(STD_INPUT_HANDLE) != filePtr->handle) + && (GetStdHandle(STD_OUTPUT_HANDLE) != filePtr->handle) + && (GetStdHandle(STD_ERROR_HANDLE) != filePtr->handle))) { + if (filePtr->handle != NULL && + CloseHandle(filePtr->handle) == FALSE) { + TclWinConvertError(GetLastError()); + ckfree(filePtr); + return -1; + } } + break; + + default: + Tcl_Panic("TclpCloseFile: unexpected file type"); } - name[0] = '.'; - name[1] = '\0'; - return GetTempFileName(name, prefix, 0, name); + + ckfree(filePtr); + return 0; } /* - *---------------------------------------------------------------------- + *-------------------------------------------------------------------------- * - * TclpMakeFile -- + * TclpGetPid -- * - * Make a TclFile from a channel. + * Given a HANDLE to a child process, return the process id for that + * child process. * * Results: - * Returns a new TclFile or NULL on failure. + * Returns the process id for the child process. If the pid was not known + * by Tcl, either because the pid was not created by Tcl or the child + * process has already been reaped, -1 is returned. * * Side effects: * None. * - *---------------------------------------------------------------------- + *-------------------------------------------------------------------------- */ -TclFile -TclpMakeFile( - Tcl_Channel channel, /* Channel to get file from. */ - int direction) /* Either TCL_READABLE or TCL_WRITABLE. */ +int +TclpGetPid( + Tcl_Pid pid) /* The HANDLE of the child process. */ { - HANDLE handle; + ProcInfo *infoPtr; - if (Tcl_GetChannelHandle(channel, direction, - (ClientData *) &handle) == TCL_OK) { - return TclWinMakeFile(handle); - } else { - return (TclFile) NULL; + PipeInit(); + + Tcl_MutexLock(&pipeMutex); + for (infoPtr = procList; infoPtr != NULL; infoPtr = infoPtr->nextPtr) { + if (infoPtr->hProcess == (HANDLE) pid) { + Tcl_MutexUnlock(&pipeMutex); + return infoPtr->dwProcessId; + } } + Tcl_MutexUnlock(&pipeMutex); + return (unsigned long) -1; } /* *---------------------------------------------------------------------- * - * TclpOpenFile -- + * TclpCreateProcess -- * - * This function opens files for use in a pipeline. + * Create a child process that has the specified files as its standard + * input, output, and error. The child process runs asynchronously under + * Windows NT and Windows 9x, and runs with the same environment + * variables as the creating process. + * + * The complete Windows search path is searched to find the specified + * executable. If an executable by the given name is not found, + * automatically tries appending standard extensions to the + * executable name. * * Results: - * Returns a newly allocated TclFile structure containing the file - * handle. + * The return value is TCL_ERROR and an error message is left in the + * interp's result if there was a problem creating the child process. + * Otherwise, the return value is TCL_OK and *pidPtr is filled with the + * process id of the child process. * * Side effects: - * None. + * A process is created. * *---------------------------------------------------------------------- */ -TclFile -TclpOpenFile( - const char *path, /* The name of the file to open. */ - int mode) /* In what mode to open the file? */ +int +TclpCreateProcess( + Tcl_Interp *interp, /* Interpreter in which to leave errors that + * occurred when creating the child process. + * Error messages from the child process + * itself are sent to errorFile. */ + int argc, /* Number of arguments in following array. */ + const char **argv, /* Array of argument strings. argv[0] contains + * the name of the executable converted to + * native format (using the + * Tcl_TranslateFileName call). Additional + * arguments have not been converted. */ + TclFile inputFile, /* If non-NULL, gives the file to use as input + * for the child process. If inputFile file is + * not readable or is NULL, the child will + * receive no standard input. */ + TclFile outputFile, /* If non-NULL, gives the file that receives + * output from the child process. If + * outputFile file is not writeable or is + * NULL, output from the child will be + * discarded. */ + TclFile errorFile, /* If non-NULL, gives the file that receives + * errors from the child process. If errorFile + * file is not writeable or is NULL, errors + * from the child will be discarded. errorFile + * may be the same as outputFile. */ + Tcl_Pid *pidPtr) /* If this function is successful, pidPtr is + * filled with the process id of the child + * process. */ { - HANDLE handle; - DWORD accessMode, createMode, shareMode, flags; - Tcl_DString ds; - const TCHAR *nativePath; - - /* - * Map the access bits to the NT access mode. - */ - - switch (mode & (O_RDONLY | O_WRONLY | O_RDWR)) { - case O_RDONLY: - accessMode = GENERIC_READ; - break; - case O_WRONLY: - accessMode = GENERIC_WRITE; - break; - case O_RDWR: - accessMode = (GENERIC_READ | GENERIC_WRITE); - break; - default: - TclWinConvertError(ERROR_INVALID_FUNCTION); - return NULL; - } + int result, applType, createFlags; + Tcl_DString cmdLine; /* Complete command line (TCHAR). */ + STARTUPINFO startInfo; + PROCESS_INFORMATION procInfo; + SECURITY_ATTRIBUTES secAtts; + HANDLE hProcess, h, inputHandle, outputHandle, errorHandle; + char execPath[MAX_PATH * TCL_UTF_MAX]; + WinFile *filePtr; - /* - * Map the creation flags to the NT create mode. - */ + PipeInit(); - switch (mode & (O_CREAT | O_EXCL | O_TRUNC)) { - case (O_CREAT | O_EXCL): - case (O_CREAT | O_EXCL | O_TRUNC): - createMode = CREATE_NEW; - break; - case (O_CREAT | O_TRUNC): - createMode = CREATE_ALWAYS; - break; - case O_CREAT: - createMode = OPEN_ALWAYS; - break; - case O_TRUNC: - case (O_TRUNC | O_EXCL): - createMode = TRUNCATE_EXISTING; - break; - default: - createMode = OPEN_EXISTING; - break; + applType = ApplicationType(interp, argv[0], execPath); + if (applType == APPL_NONE) { + return TCL_ERROR; } - nativePath = Tcl_WinUtfToTChar(path, -1, &ds); + result = TCL_ERROR; + Tcl_DStringInit(&cmdLine); + hProcess = GetCurrentProcess(); /* - * If the file is not being created, use the existing file attributes. + * STARTF_USESTDHANDLES must be used to pass handles to child process. + * Using SetStdHandle() and/or dup2() only works when a console mode + * parent process is spawning an attached console mode child process. */ - flags = 0; - if (!(mode & O_CREAT)) { - flags = GetFileAttributes(nativePath); - if (flags == 0xFFFFFFFF) { - flags = 0; - } - } + ZeroMemory(&startInfo, sizeof(startInfo)); + startInfo.cb = sizeof(startInfo); + startInfo.dwFlags = STARTF_USESTDHANDLES; + startInfo.hStdInput = INVALID_HANDLE_VALUE; + startInfo.hStdOutput= INVALID_HANDLE_VALUE; + startInfo.hStdError = INVALID_HANDLE_VALUE; + + secAtts.nLength = sizeof(SECURITY_ATTRIBUTES); + secAtts.lpSecurityDescriptor = NULL; + secAtts.bInheritHandle = TRUE; /* - * Set up the file sharing mode. We want to allow simultaneous access. + * We have to check the type of each file, since we cannot duplicate some + * file types. */ - shareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; + inputHandle = INVALID_HANDLE_VALUE; + if (inputFile != NULL) { + filePtr = (WinFile *)inputFile; + if (filePtr->type == WIN_FILE) { + inputHandle = filePtr->handle; + } + } + outputHandle = INVALID_HANDLE_VALUE; + if (outputFile != NULL) { + filePtr = (WinFile *)outputFile; + if (filePtr->type == WIN_FILE) { + outputHandle = filePtr->handle; + } + } + errorHandle = INVALID_HANDLE_VALUE; + if (errorFile != NULL) { + filePtr = (WinFile *)errorFile; + if (filePtr->type == WIN_FILE) { + errorHandle = filePtr->handle; + } + } /* - * Now we get to create the file. + * Duplicate all the handles which will be passed off as stdin, stdout and + * stderr of the child process. The duplicate handles are set to be + * inheritable, so the child process can use them. */ - handle = CreateFile(nativePath, accessMode, shareMode, - NULL, createMode, flags, NULL); - Tcl_DStringFree(&ds); - - if (handle == INVALID_HANDLE_VALUE) { - DWORD err; + if (inputHandle == INVALID_HANDLE_VALUE) { + /* + * If handle was not set, stdin should return immediate EOF. Under + * Windows95, some applications (both 16 and 32 bit!) cannot read from + * the NUL device; they read from console instead. When running tk, + * this is fatal because the child process would hang forever waiting + * for EOF from the unmapped console window used by the helper + * application. + * + * Fortunately, the helper application detects a closed pipe as an + * immediate EOF and can pass that information to the child process. + */ - err = GetLastError(); - if ((err & 0xffffL) == ERROR_OPEN_FAILED) { - err = (mode & O_CREAT) ? ERROR_FILE_EXISTS : ERROR_FILE_NOT_FOUND; + if (CreatePipe(&startInfo.hStdInput, &h, &secAtts, 0) != FALSE) { + CloseHandle(h); } - TclWinConvertError(err); - return NULL; + } else { + DuplicateHandle(hProcess, inputHandle, hProcess, &startInfo.hStdInput, + 0, TRUE, DUPLICATE_SAME_ACCESS); + } + if (startInfo.hStdInput == INVALID_HANDLE_VALUE) { + TclWinConvertError(GetLastError()); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "couldn't duplicate input handle: %s", + Tcl_PosixError(interp))); + goto end; } - /* - * Seek to the end of file if we are writing. - */ + if (outputHandle == INVALID_HANDLE_VALUE) { + /* + * If handle was not set, output should be sent to an infinitely deep + * sink. Under Windows 95, some 16 bit applications cannot have stdout + * redirected to NUL; they send their output to the console instead. + * Some applications, like "more" or "dir /p", when outputting + * multiple pages to the console, also then try and read from the + * console to go the next page. When running tk, this is fatal because + * the child process would hang forever waiting for input from the + * unmapped console window used by the helper application. + * + * Fortunately, the helper application will detect a closed pipe as a + * sink. + */ - if (mode & (O_WRONLY|O_APPEND)) { - SetFilePointer(handle, 0, NULL, FILE_END); + startInfo.hStdOutput = CreateFile(TEXT("NUL:"), GENERIC_WRITE, 0, + &secAtts, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + } else { + DuplicateHandle(hProcess, outputHandle, hProcess, + &startInfo.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS); + } + if (startInfo.hStdOutput == INVALID_HANDLE_VALUE) { + TclWinConvertError(GetLastError()); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "couldn't duplicate output handle: %s", + Tcl_PosixError(interp))); + goto end; } - return TclWinMakeFile(handle); -} - -/* - *---------------------------------------------------------------------- - * - * TclpCreateTempFile -- - * - * This function opens a unique file with the property that it will be - * deleted when its file handle is closed. The temporary file is created - * in the system temporary directory. - * - * Results: - * Returns a valid TclFile, or NULL on failure. - * - * Side effects: - * Creates a new temporary file. - * - *---------------------------------------------------------------------- - */ - -TclFile -TclpCreateTempFile( - const char *contents) /* String to write into temp file, or NULL. */ -{ - TCHAR name[MAX_PATH]; - const char *native; - Tcl_DString dstring; - HANDLE handle; + if (errorHandle == INVALID_HANDLE_VALUE) { + /* + * If handle was not set, errors should be sent to an infinitely deep + * sink. + */ - if (TempFileName(name) == 0) { - return NULL; + startInfo.hStdError = CreateFile(TEXT("NUL:"), GENERIC_WRITE, 0, + &secAtts, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + } else { + DuplicateHandle(hProcess, errorHandle, hProcess, &startInfo.hStdError, + 0, TRUE, DUPLICATE_SAME_ACCESS); } - - handle = CreateFile(name, - GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, - FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE, NULL); - if (handle == INVALID_HANDLE_VALUE) { - goto error; + if (startInfo.hStdError == INVALID_HANDLE_VALUE) { + TclWinConvertError(GetLastError()); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "couldn't duplicate error handle: %s", + Tcl_PosixError(interp))); + goto end; } /* - * Write the file out, doing line translations on the way. + * If we do not have a console window, then we must run DOS and WIN32 + * console mode applications as detached processes. This tells the loader + * that the child application should not inherit the console, and that it + * should not create a new console window for the child application. The + * child application should get its stdio from the redirection handles + * provided by this application, and run in the background. + * + * If we are starting a GUI process, they don't automatically get a + * console, so it doesn't matter if they are started as foreground or + * detached processes. The GUI window will still pop up to the foreground. */ - if (contents != NULL) { - DWORD result, length; - const char *p; - int toCopy; - - /* - * Convert the contents from UTF to native encoding - */ - - native = Tcl_UtfToExternalDString(NULL, contents, -1, &dstring); + if (TclWinGetPlatformId() == VER_PLATFORM_WIN32_NT) { + if (HasConsole()) { + createFlags = 0; + } else if (applType == APPL_DOS) { + /* + * Under NT, 16-bit DOS applications will not run unless they can + * be attached to a console. If we are running without a console, + * run the 16-bit program as an normal process inside of a hidden + * console application, and then run that hidden console as a + * detached process. + */ - toCopy = Tcl_DStringLength(&dstring); - for (p = native; toCopy > 0; p++, toCopy--) { - if (*p == '\n') { - length = p - native; - if (length > 0) { - if (!WriteFile(handle, native, length, &result, NULL)) { - goto error; - } - } - if (!WriteFile(handle, "\r\n", 2, &result, NULL)) { - goto error; - } - native = p+1; - } + startInfo.wShowWindow = SW_HIDE; + startInfo.dwFlags |= STARTF_USESHOWWINDOW; + createFlags = CREATE_NEW_CONSOLE; + TclDStringAppendLiteral(&cmdLine, "cmd.exe /c"); + } else { + createFlags = DETACHED_PROCESS; } - length = p - native; - if (length > 0) { - if (!WriteFile(handle, native, length, &result, NULL)) { - goto error; - } + } else { + if (HasConsole()) { + createFlags = 0; + } else { + createFlags = DETACHED_PROCESS; } - Tcl_DStringFree(&dstring); - if (SetFilePointer(handle, 0, NULL, FILE_BEGIN) == 0xFFFFFFFF) { - goto error; + + if (applType == APPL_DOS) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "DOS application process not supported on this platform", + -1)); + Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC", "DOS_APP", + NULL); + goto end; } } - return TclWinMakeFile(handle); + /* + * cmdLine gets the full command line used to invoke the executable, + * including the name of the executable itself. The command line arguments + * in argv[] are stored in cmdLine separated by spaces. Special characters + * in individual arguments from argv[] must be quoted when being stored in + * cmdLine. + * + * When calling any application, bear in mind that arguments that specify + * a path name are not converted. If an argument contains forward slashes + * as path separators, it may or may not be recognized as a path name, + * depending on the program. In general, most applications accept forward + * slashes only as option delimiters and backslashes only as paths. + * + * Additionally, when calling a 16-bit dos or windows application, all + * path names must use the short, cryptic, path format (e.g., using + * ab~1.def instead of "a b.default"). + */ + + BuildCommandLine(execPath, argc, argv, &cmdLine); + + if (CreateProcess(NULL, (TCHAR *) Tcl_DStringValue(&cmdLine), + NULL, NULL, TRUE, (DWORD) createFlags, NULL, NULL, &startInfo, + &procInfo) == 0) { + TclWinConvertError(GetLastError()); + Tcl_SetObjResult(interp, Tcl_ObjPrintf("couldn't execute \"%s\": %s", + argv[0], Tcl_PosixError(interp))); + goto end; + } + + /* + * This wait is used to force the OS to give some time to the DOS process. + */ + + if (applType == APPL_DOS) { + WaitForSingleObject(procInfo.hProcess, 50); + } - error: /* - * Free the native representation of the contents if necessary. + * "When an application spawns a process repeatedly, a new thread instance + * will be created for each process but the previous instances may not be + * cleaned up. This results in a significant virtual memory loss each time + * the process is spawned. If there is a WaitForInputIdle() call between + * CreateProcess() and CloseHandle(), the problem does not occur." PSS ID + * Number: Q124121 */ - if (contents != NULL) { - Tcl_DStringFree(&dstring); + WaitForInputIdle(procInfo.hProcess, 5000); + CloseHandle(procInfo.hThread); + + *pidPtr = (Tcl_Pid) procInfo.hProcess; + if (*pidPtr != 0) { + TclWinAddProcess(procInfo.hProcess, procInfo.dwProcessId); } + result = TCL_OK; - TclWinConvertError(GetLastError()); - CloseHandle(handle); - DeleteFile(name); - return NULL; + end: + Tcl_DStringFree(&cmdLine); + if (startInfo.hStdInput != INVALID_HANDLE_VALUE) { + CloseHandle(startInfo.hStdInput); + } + if (startInfo.hStdOutput != INVALID_HANDLE_VALUE) { + CloseHandle(startInfo.hStdOutput); + } + if (startInfo.hStdError != INVALID_HANDLE_VALUE) { + CloseHandle(startInfo.hStdError); + } + return result; } + /* *---------------------------------------------------------------------- * - * TclpTempFileName -- + * HasConsole -- * - * This function returns a unique filename. + * Determines whether the current application is attached to a console. * * Results: - * Returns a valid Tcl_Obj* with refCount 0, or NULL on failure. + * Returns TRUE if this application has a console, else FALSE. * * Side effects: * None. @@ -1060,2322 +1217,2211 @@ TclpCreateTempFile( *---------------------------------------------------------------------- */ -Tcl_Obj * -TclpTempFileName(void) +static BOOL +HasConsole(void) { - TCHAR fileName[MAX_PATH]; + HANDLE handle; - if (TempFileName(fileName) == 0) { - return NULL; - } + handle = CreateFileA("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - return TclpNativeToNormalized(fileName); + if (handle != INVALID_HANDLE_VALUE) { + CloseHandle(handle); + return TRUE; + } else { + return FALSE; + } } /* - *---------------------------------------------------------------------- + *-------------------------------------------------------------------- * - * TclpCreatePipe -- + * ApplicationType -- * - * Creates an anonymous pipe. + * Search for the specified program and identify if it refers to a DOS, + * Windows 3.X, or Win32 program. Used to determine how to invoke a + * program, or if it can even be invoked. + * + * It is possible to almost positively identify DOS and Windows + * applications that contain the appropriate magic numbers. However, DOS + * .com files do not seem to contain a magic number; if the program name + * ends with .com and could not be identified as a Windows .com file, it + * will be assumed to be a DOS application, even if it was just random + * data. If the program name does not end with .com, no such assumption + * is made. + * + * The Win32 function GetBinaryType incorrectly identifies any junk file + * that ends with .exe as a dos executable and some executables that + * don't end with .exe as not executable. Plus it doesn't exist under + * win95, so I won't feel bad about reimplementing functionality. * * Results: - * Returns 1 on success, 0 on failure. + * The return value is one of APPL_DOS, APPL_WIN3X, or APPL_WIN32 if the + * filename referred to the corresponding application type. If the file + * name could not be found or did not refer to any known application + * type, APPL_NONE is returned and an error message is left in interp. + * .bat files are identified as APPL_DOS. * * Side effects: - * Creates a pipe. + * None. * *---------------------------------------------------------------------- */ -int -TclpCreatePipe( - TclFile *readPipe, /* Location to store file handle for read side - * of pipe. */ - TclFile *writePipe) /* Location to store file handle for write - * side of pipe. */ +static int +ApplicationType( + Tcl_Interp *interp, /* Interp, for error message. */ + const char *originalName, /* Name of the application to find. */ + char fullName[]) /* Filled with complete path to + * application. */ { - HANDLE readHandle, writeHandle; + int applType, i, nameLen, found; + HANDLE hFile; + TCHAR *rest; + char *ext; + char buf[2]; + DWORD attr, read; + IMAGE_DOS_HEADER header; + Tcl_DString nameBuf, ds; + const TCHAR *nativeName; + TCHAR nativeFullPath[MAX_PATH]; + static const char extensions[][5] = {"", ".com", ".exe", ".bat", ".cmd"}; - if (CreatePipe(&readHandle, &writeHandle, NULL, 0) != 0) { - *readPipe = TclWinMakeFile(readHandle); - *writePipe = TclWinMakeFile(writeHandle); - return 1; + /* + * Look for the program as an external program. First try the name as it + * is, then try adding .com, .exe, and .bat, in that order, to the name, + * looking for an executable. + * + * Using the raw SearchPath() function doesn't do quite what is necessary. + * If the name of the executable already contains a '.' character, it will + * not try appending the specified extension when searching (in other + * words, SearchPath will not find the program "a.b.exe" if the arguments + * specified "a.b" and ".exe"). So, first look for the file as it is + * named. Then manually append the extensions, looking for a match. + */ + + applType = APPL_NONE; + Tcl_DStringInit(&nameBuf); + Tcl_DStringAppend(&nameBuf, originalName, -1); + nameLen = Tcl_DStringLength(&nameBuf); + + for (i = 0; i < (int) (sizeof(extensions) / sizeof(extensions[0])); i++) { + Tcl_DStringSetLength(&nameBuf, nameLen); + Tcl_DStringAppend(&nameBuf, extensions[i], -1); + nativeName = Tcl_WinUtfToTChar(Tcl_DStringValue(&nameBuf), + Tcl_DStringLength(&nameBuf), &ds); + found = SearchPath(NULL, nativeName, NULL, MAX_PATH, + nativeFullPath, &rest); + Tcl_DStringFree(&ds); + if (found == 0) { + continue; + } + + /* + * Ignore matches on directories or data files, return if identified a + * known type. + */ + + attr = GetFileAttributes(nativeFullPath); + if ((attr == 0xffffffff) || (attr & FILE_ATTRIBUTE_DIRECTORY)) { + continue; + } + strcpy(fullName, Tcl_WinTCharToUtf(nativeFullPath, -1, &ds)); + Tcl_DStringFree(&ds); + + ext = strrchr(fullName, '.'); + if ((ext != NULL) && + (strcasecmp(ext, ".cmd") == 0 || strcasecmp(ext, ".bat") == 0)) { + applType = APPL_DOS; + break; + } + + hFile = CreateFile(nativeFullPath, + GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile == INVALID_HANDLE_VALUE) { + continue; + } + + header.e_magic = 0; + ReadFile(hFile, (void *) &header, sizeof(header), &read, NULL); + if (header.e_magic != IMAGE_DOS_SIGNATURE) { + /* + * Doesn't have the magic number for relocatable executables. If + * filename ends with .com, assume it's a DOS application anyhow. + * Note that we didn't make this assumption at first, because some + * supposed .com files are really 32-bit executables with all the + * magic numbers and everything. + */ + + CloseHandle(hFile); + if ((ext != NULL) && (strcasecmp(ext, ".com") == 0)) { + applType = APPL_DOS; + break; + } + continue; + } + if (header.e_lfarlc != sizeof(header)) { + /* + * All Windows 3.X and Win32 and some DOS programs have this value + * set here. If it doesn't, assume that since it already had the + * other magic number it was a DOS application. + */ + + CloseHandle(hFile); + applType = APPL_DOS; + break; + } + + /* + * The DWORD at header.e_lfanew points to yet another magic number. + */ + + buf[0] = '\0'; + SetFilePointer(hFile, header.e_lfanew, NULL, FILE_BEGIN); + ReadFile(hFile, (void *) buf, 2, &read, NULL); + CloseHandle(hFile); + + if ((buf[0] == 'N') && (buf[1] == 'E')) { + applType = APPL_WIN3X; + } else if ((buf[0] == 'P') && (buf[1] == 'E')) { + applType = APPL_WIN32; + } else { + /* + * Strictly speaking, there should be a test that there is an 'L' + * and 'E' at buf[0..1], to identify the type as DOS, but of + * course we ran into a DOS executable that _doesn't_ have the + * magic number - specifically, one compiled using the Lahey + * Fortran90 compiler. + */ + + applType = APPL_DOS; + } + break; } + Tcl_DStringFree(&nameBuf); - TclWinConvertError(GetLastError()); - return 0; + if (applType == APPL_NONE) { + TclWinConvertError(GetLastError()); + Tcl_SetObjResult(interp, Tcl_ObjPrintf("couldn't execute \"%s\": %s", + originalName, Tcl_PosixError(interp))); + return APPL_NONE; + } + + if ((applType == APPL_DOS) || (applType == APPL_WIN3X)) { + /* + * Replace long path name of executable with short path name for + * 16-bit applications. Otherwise the application may not be able to + * correctly parse its own command line to separate off the + * application name from the arguments. + */ + + GetShortPathName(nativeFullPath, nativeFullPath, MAX_PATH); + strcpy(fullName, Tcl_WinTCharToUtf(nativeFullPath, -1, &ds)); + Tcl_DStringFree(&ds); + } + return applType; } /* *---------------------------------------------------------------------- * - * TclpCloseFile -- + * BuildCommandLine -- * - * Closes a pipeline file handle. These handles are created by - * TclpOpenFile, TclpCreatePipe, or TclpMakeFile. + * The command line arguments are stored in linePtr separated by spaces, + * in a form that CreateProcess() understands. Special characters in + * individual arguments from argv[] must be quoted when being stored in + * cmdLine. * * Results: - * 0 on success, -1 on failure. + * None. * * Side effects: - * The file is closed and deallocated. + * None. * *---------------------------------------------------------------------- */ -int -TclpCloseFile( - TclFile file) /* The file to close. */ +static void +BuildCommandLine( + const char *executable, /* Full path of executable (including + * extension). Replacement for argv[0]. */ + int argc, /* Number of arguments. */ + const char **argv, /* Argument strings in UTF. */ + Tcl_DString *linePtr) /* Initialized Tcl_DString that receives the + * command line (TCHAR). */ { - WinFile *filePtr = (WinFile *) file; + const char *arg, *start, *special; + int quote, i; + Tcl_DString ds; - switch (filePtr->type) { - case WIN_FILE: - /* - * Don't close the Win32 handle if the handle is a standard channel - * during the thread exit process. Otherwise, one thread may kill the - * stdio of another. - */ + Tcl_DStringInit(&ds); - if (!TclInThreadExit() - || ((GetStdHandle(STD_INPUT_HANDLE) != filePtr->handle) - && (GetStdHandle(STD_OUTPUT_HANDLE) != filePtr->handle) - && (GetStdHandle(STD_ERROR_HANDLE) != filePtr->handle))) { - if (filePtr->handle != NULL && - CloseHandle(filePtr->handle) == FALSE) { - TclWinConvertError(GetLastError()); - ckfree(filePtr); - return -1; - } - } - break; + /* + * Prime the path. Add a space separator if we were primed with something. + */ - default: - Tcl_Panic("TclpCloseFile: unexpected file type"); + TclDStringAppendDString(&ds, linePtr); + if (Tcl_DStringLength(linePtr) > 0) { + TclDStringAppendLiteral(&ds, " "); } - ckfree(filePtr); - return 0; -} - -/* - *-------------------------------------------------------------------------- - * - * TclpGetPid -- - * - * Given a HANDLE to a child process, return the process id for that - * child process. - * - * Results: - * Returns the process id for the child process. If the pid was not known - * by Tcl, either because the pid was not created by Tcl or the child - * process has already been reaped, -1 is returned. - * - * Side effects: - * None. - * - *-------------------------------------------------------------------------- - */ + for (i = 0; i < argc; i++) { + if (i == 0) { + arg = executable; + } else { + arg = argv[i]; + TclDStringAppendLiteral(&ds, " "); + } -int -TclpGetPid( - Tcl_Pid pid) /* The HANDLE of the child process. */ -{ - ProcInfo *infoPtr; + quote = 0; + if (arg[0] == '\0') { + quote = 1; + } else { + int count; + Tcl_UniChar ch; - PipeInit(); + for (start = arg; *start != '\0'; start += count) { + count = Tcl_UtfToUniChar(start, &ch); + if (Tcl_UniCharIsSpace(ch)) { /* INTL: ISO space. */ + quote = 1; + break; + } + } + } + if (quote) { + TclDStringAppendLiteral(&ds, "\""); + } + start = arg; + for (special = arg; ; ) { + if ((*special == '\\') && (special[1] == '\\' || + special[1] == '"' || (quote && special[1] == '\0'))) { + Tcl_DStringAppend(&ds, start, (int) (special - start)); + start = special; + while (1) { + special++; + if (*special == '"' || (quote && *special == '\0')) { + /* + * N backslashes followed a quote -> insert N * 2 + 1 + * backslashes then a quote. + */ - Tcl_MutexLock(&pipeMutex); - for (infoPtr = procList; infoPtr != NULL; infoPtr = infoPtr->nextPtr) { - if (infoPtr->hProcess == (HANDLE) pid) { - Tcl_MutexUnlock(&pipeMutex); - return infoPtr->dwProcessId; + Tcl_DStringAppend(&ds, start, + (int) (special - start)); + break; + } + if (*special != '\\') { + break; + } + } + Tcl_DStringAppend(&ds, start, (int) (special - start)); + start = special; + } + if (*special == '"') { + Tcl_DStringAppend(&ds, start, (int) (special - start)); + TclDStringAppendLiteral(&ds, "\\\""); + start = special + 1; + } + if (*special == '\0') { + break; + } + special++; + } + Tcl_DStringAppend(&ds, start, (int) (special - start)); + if (quote) { + TclDStringAppendLiteral(&ds, "\""); } } - Tcl_MutexUnlock(&pipeMutex); - return (unsigned long) -1; + Tcl_DStringFree(linePtr); + Tcl_WinUtfToTChar(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), linePtr); + Tcl_DStringFree(&ds); } /* *---------------------------------------------------------------------- * - * TclpCreateProcess -- - * - * Create a child process that has the specified files as its standard - * input, output, and error. The child process runs asynchronously under - * Windows NT and Windows 9x, and runs with the same environment - * variables as the creating process. + * TclpCreateCommandChannel -- * - * The complete Windows search path is searched to find the specified - * executable. If an executable by the given name is not found, - * automatically tries appending standard extensions to the - * executable name. + * This function is called by Tcl_OpenCommandChannel to perform the + * platform specific channel initialization for a command channel. * * Results: - * The return value is TCL_ERROR and an error message is left in the - * interp's result if there was a problem creating the child process. - * Otherwise, the return value is TCL_OK and *pidPtr is filled with the - * process id of the child process. + * Returns a new channel or NULL on failure. * * Side effects: - * A process is created. + * Allocates a new channel. * *---------------------------------------------------------------------- */ -int -TclpCreateProcess( - Tcl_Interp *interp, /* Interpreter in which to leave errors that - * occurred when creating the child process. - * Error messages from the child process - * itself are sent to errorFile. */ - int argc, /* Number of arguments in following array. */ - const char **argv, /* Array of argument strings. argv[0] contains - * the name of the executable converted to - * native format (using the - * Tcl_TranslateFileName call). Additional - * arguments have not been converted. */ - TclFile inputFile, /* If non-NULL, gives the file to use as input - * for the child process. If inputFile file is - * not readable or is NULL, the child will - * receive no standard input. */ - TclFile outputFile, /* If non-NULL, gives the file that receives - * output from the child process. If - * outputFile file is not writeable or is - * NULL, output from the child will be - * discarded. */ - TclFile errorFile, /* If non-NULL, gives the file that receives - * errors from the child process. If errorFile - * file is not writeable or is NULL, errors - * from the child will be discarded. errorFile - * may be the same as outputFile. */ - Tcl_Pid *pidPtr) /* If this function is successful, pidPtr is - * filled with the process id of the child - * process. */ +Tcl_Channel +TclpCreateCommandChannel( + TclFile readFile, /* If non-null, gives the file for reading. */ + TclFile writeFile, /* If non-null, gives the file for writing. */ + TclFile errorFile, /* If non-null, gives the file where errors + * can be read. */ + int numPids, /* The number of pids in the pid array. */ + Tcl_Pid *pidPtr) /* An array of process identifiers. */ { - int result, applType, createFlags; - Tcl_DString cmdLine; /* Complete command line (TCHAR). */ - STARTUPINFO startInfo; - PROCESS_INFORMATION procInfo; - SECURITY_ATTRIBUTES secAtts; - HANDLE hProcess, h, inputHandle, outputHandle, errorHandle; - char execPath[MAX_PATH * TCL_UTF_MAX]; - WinFile *filePtr; - - PipeInit(); - - applType = ApplicationType(interp, argv[0], execPath); - if (applType == APPL_NONE) { - return TCL_ERROR; - } - - result = TCL_ERROR; - Tcl_DStringInit(&cmdLine); - hProcess = GetCurrentProcess(); - - /* - * STARTF_USESTDHANDLES must be used to pass handles to child process. - * Using SetStdHandle() and/or dup2() only works when a console mode - * parent process is spawning an attached console mode child process. - */ - - ZeroMemory(&startInfo, sizeof(startInfo)); - startInfo.cb = sizeof(startInfo); - startInfo.dwFlags = STARTF_USESTDHANDLES; - startInfo.hStdInput = INVALID_HANDLE_VALUE; - startInfo.hStdOutput= INVALID_HANDLE_VALUE; - startInfo.hStdError = INVALID_HANDLE_VALUE; - - secAtts.nLength = sizeof(SECURITY_ATTRIBUTES); - secAtts.lpSecurityDescriptor = NULL; - secAtts.bInheritHandle = TRUE; - - /* - * We have to check the type of each file, since we cannot duplicate some - * file types. - */ + char channelName[16 + TCL_INTEGER_SPACE]; + DWORD id; + PipeInfo *infoPtr = ckalloc(sizeof(PipeInfo)); - inputHandle = INVALID_HANDLE_VALUE; - if (inputFile != NULL) { - filePtr = (WinFile *)inputFile; - if (filePtr->type == WIN_FILE) { - inputHandle = filePtr->handle; - } - } - outputHandle = INVALID_HANDLE_VALUE; - if (outputFile != NULL) { - filePtr = (WinFile *)outputFile; - if (filePtr->type == WIN_FILE) { - outputHandle = filePtr->handle; - } - } - errorHandle = INVALID_HANDLE_VALUE; - if (errorFile != NULL) { - filePtr = (WinFile *)errorFile; - if (filePtr->type == WIN_FILE) { - errorHandle = filePtr->handle; - } - } + PipeInit(); - /* - * Duplicate all the handles which will be passed off as stdin, stdout and - * stderr of the child process. The duplicate handles are set to be - * inheritable, so the child process can use them. - */ + infoPtr->watchMask = 0; + infoPtr->flags = 0; + infoPtr->readFlags = 0; + infoPtr->readFile = readFile; + infoPtr->writeFile = writeFile; + infoPtr->errorFile = errorFile; + infoPtr->numPids = numPids; + infoPtr->pidPtr = pidPtr; + infoPtr->writeBuf = 0; + infoPtr->writeBufLen = 0; + infoPtr->writeError = 0; + infoPtr->channel = NULL; - if (inputHandle == INVALID_HANDLE_VALUE) { - /* - * If handle was not set, stdin should return immediate EOF. Under - * Windows95, some applications (both 16 and 32 bit!) cannot read from - * the NUL device; they read from console instead. When running tk, - * this is fatal because the child process would hang forever waiting - * for EOF from the unmapped console window used by the helper - * application. - * - * Fortunately, the helper application detects a closed pipe as an - * immediate EOF and can pass that information to the child process. - */ + infoPtr->validMask = 0; - if (CreatePipe(&startInfo.hStdInput, &h, &secAtts, 0) != FALSE) { - CloseHandle(h); - } - } else { - DuplicateHandle(hProcess, inputHandle, hProcess, &startInfo.hStdInput, - 0, TRUE, DUPLICATE_SAME_ACCESS); - } - if (startInfo.hStdInput == INVALID_HANDLE_VALUE) { - TclWinConvertError(GetLastError()); - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "couldn't duplicate input handle: %s", - Tcl_PosixError(interp))); - goto end; - } + infoPtr->threadId = Tcl_GetCurrentThread(); - if (outputHandle == INVALID_HANDLE_VALUE) { + if (readFile != NULL) { /* - * If handle was not set, output should be sent to an infinitely deep - * sink. Under Windows 95, some 16 bit applications cannot have stdout - * redirected to NUL; they send their output to the console instead. - * Some applications, like "more" or "dir /p", when outputting - * multiple pages to the console, also then try and read from the - * console to go the next page. When running tk, this is fatal because - * the child process would hang forever waiting for input from the - * unmapped console window used by the helper application. - * - * Fortunately, the helper application will detect a closed pipe as a - * sink. + * Start the background reader thread. */ - startInfo.hStdOutput = CreateFile(TEXT("NUL:"), GENERIC_WRITE, 0, - &secAtts, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + infoPtr->readable = CreateEvent(NULL, TRUE, TRUE, NULL); + infoPtr->readThread = CreateThread(NULL, 256, PipeReaderThread, + TclPipeThreadCreateTI(&infoPtr->readTI, infoPtr), 0, &id); + SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); + infoPtr->validMask |= TCL_READABLE; } else { - DuplicateHandle(hProcess, outputHandle, hProcess, - &startInfo.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS); - } - if (startInfo.hStdOutput == INVALID_HANDLE_VALUE) { - TclWinConvertError(GetLastError()); - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "couldn't duplicate output handle: %s", - Tcl_PosixError(interp))); - goto end; + infoPtr->readTI = NULL; + infoPtr->readThread = 0; } - - if (errorHandle == INVALID_HANDLE_VALUE) { + if (writeFile != NULL) { /* - * If handle was not set, errors should be sent to an infinitely deep - * sink. + * Start the background writer thread. */ - startInfo.hStdError = CreateFile(TEXT("NUL:"), GENERIC_WRITE, 0, - &secAtts, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + infoPtr->writable = CreateEvent(NULL, TRUE, TRUE, NULL); + infoPtr->writeThread = CreateThread(NULL, 256, PipeWriterThread, + TclPipeThreadCreateTI(&infoPtr->writeTI, infoPtr), 0, &id); + SetThreadPriority(infoPtr->writeThread, THREAD_PRIORITY_HIGHEST); + infoPtr->validMask |= TCL_WRITABLE; } else { - DuplicateHandle(hProcess, errorHandle, hProcess, &startInfo.hStdError, - 0, TRUE, DUPLICATE_SAME_ACCESS); - } - if (startInfo.hStdError == INVALID_HANDLE_VALUE) { - TclWinConvertError(GetLastError()); - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "couldn't duplicate error handle: %s", - Tcl_PosixError(interp))); - goto end; + infoPtr->writeTI = NULL; + infoPtr->writeThread = 0; } /* - * If we do not have a console window, then we must run DOS and WIN32 - * console mode applications as detached processes. This tells the loader - * that the child application should not inherit the console, and that it - * should not create a new console window for the child application. The - * child application should get its stdio from the redirection handles - * provided by this application, and run in the background. - * - * If we are starting a GUI process, they don't automatically get a - * console, so it doesn't matter if they are started as foreground or - * detached processes. The GUI window will still pop up to the foreground. + * For backward compatibility with previous versions of Tcl, we use + * "file%d" as the base name for pipes even though it would be more + * natural to use "pipe%d". Use the pointer to keep the channel names + * unique, in case channels share handles (stdin/stdout). */ - if (TclWinGetPlatformId() == VER_PLATFORM_WIN32_NT) { - if (HasConsole()) { - createFlags = 0; - } else if (applType == APPL_DOS) { - /* - * Under NT, 16-bit DOS applications will not run unless they can - * be attached to a console. If we are running without a console, - * run the 16-bit program as an normal process inside of a hidden - * console application, and then run that hidden console as a - * detached process. - */ - - startInfo.wShowWindow = SW_HIDE; - startInfo.dwFlags |= STARTF_USESHOWWINDOW; - createFlags = CREATE_NEW_CONSOLE; - TclDStringAppendLiteral(&cmdLine, "cmd.exe /c"); - } else { - createFlags = DETACHED_PROCESS; - } - } else { - if (HasConsole()) { - createFlags = 0; - } else { - createFlags = DETACHED_PROCESS; - } - - if (applType == APPL_DOS) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "DOS application process not supported on this platform", - -1)); - Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC", "DOS_APP", - NULL); - goto end; - } - } + sprintf(channelName, "file%" TCL_I_MODIFIER "x", (size_t) infoPtr); + infoPtr->channel = Tcl_CreateChannel(&pipeChannelType, channelName, + infoPtr, infoPtr->validMask); /* - * cmdLine gets the full command line used to invoke the executable, - * including the name of the executable itself. The command line arguments - * in argv[] are stored in cmdLine separated by spaces. Special characters - * in individual arguments from argv[] must be quoted when being stored in - * cmdLine. - * - * When calling any application, bear in mind that arguments that specify - * a path name are not converted. If an argument contains forward slashes - * as path separators, it may or may not be recognized as a path name, - * depending on the program. In general, most applications accept forward - * slashes only as option delimiters and backslashes only as paths. - * - * Additionally, when calling a 16-bit dos or windows application, all - * path names must use the short, cryptic, path format (e.g., using - * ab~1.def instead of "a b.default"). + * Pipes have AUTO translation mode on Windows and ^Z eof char, which + * means that a ^Z will be appended to them at close. This is needed for + * Windows programs that expect a ^Z at EOF. */ - BuildCommandLine(execPath, argc, argv, &cmdLine); + Tcl_SetChannelOption(NULL, infoPtr->channel, "-translation", "auto"); + Tcl_SetChannelOption(NULL, infoPtr->channel, "-eofchar", "\032 {}"); + return infoPtr->channel; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_CreatePipe -- + * + * System dependent interface to create a pipe for the [chan pipe] + * command. Stolen from TclX. + * + * Results: + * TCL_OK or TCL_ERROR. + * + *---------------------------------------------------------------------- + */ - if (CreateProcess(NULL, (TCHAR *) Tcl_DStringValue(&cmdLine), - NULL, NULL, TRUE, (DWORD) createFlags, NULL, NULL, &startInfo, - &procInfo) == 0) { +int +Tcl_CreatePipe( + Tcl_Interp *interp, /* Errors returned in result.*/ + Tcl_Channel *rchan, /* Where to return the read side. */ + Tcl_Channel *wchan, /* Where to return the write side. */ + int flags) /* Reserved for future use. */ +{ + HANDLE readHandle, writeHandle; + SECURITY_ATTRIBUTES sec; + + sec.nLength = sizeof(SECURITY_ATTRIBUTES); + sec.lpSecurityDescriptor = NULL; + sec.bInheritHandle = FALSE; + + if (!CreatePipe(&readHandle, &writeHandle, &sec, 0)) { TclWinConvertError(GetLastError()); - Tcl_SetObjResult(interp, Tcl_ObjPrintf("couldn't execute \"%s\": %s", - argv[0], Tcl_PosixError(interp))); - goto end; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "pipe creation failed: %s", Tcl_PosixError(interp))); + return TCL_ERROR; } - /* - * This wait is used to force the OS to give some time to the DOS process. - */ + *rchan = Tcl_MakeFileChannel((ClientData) readHandle, TCL_READABLE); + Tcl_RegisterChannel(interp, *rchan); + + *wchan = Tcl_MakeFileChannel((ClientData) writeHandle, TCL_WRITABLE); + Tcl_RegisterChannel(interp, *wchan); + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * TclGetAndDetachPids -- + * + * Stores a list of the command PIDs for a command channel in the + * interp's result. + * + * Results: + * None. + * + * Side effects: + * Modifies the interp's result. + * + *---------------------------------------------------------------------- + */ - if (applType == APPL_DOS) { - WaitForSingleObject(procInfo.hProcess, 50); - } +void +TclGetAndDetachPids( + Tcl_Interp *interp, + Tcl_Channel chan) +{ + PipeInfo *pipePtr; + const Tcl_ChannelType *chanTypePtr; + Tcl_Obj *pidsObj; + int i; /* - * "When an application spawns a process repeatedly, a new thread instance - * will be created for each process but the previous instances may not be - * cleaned up. This results in a significant virtual memory loss each time - * the process is spawned. If there is a WaitForInputIdle() call between - * CreateProcess() and CloseHandle(), the problem does not occur." PSS ID - * Number: Q124121 + * Punt if the channel is not a command channel. */ - WaitForInputIdle(procInfo.hProcess, 5000); - CloseHandle(procInfo.hThread); - - *pidPtr = (Tcl_Pid) procInfo.hProcess; - if (*pidPtr != 0) { - TclWinAddProcess(procInfo.hProcess, procInfo.dwProcessId); + chanTypePtr = Tcl_GetChannelType(chan); + if (chanTypePtr != &pipeChannelType) { + return; } - result = TCL_OK; - end: - Tcl_DStringFree(&cmdLine); - if (startInfo.hStdInput != INVALID_HANDLE_VALUE) { - CloseHandle(startInfo.hStdInput); - } - if (startInfo.hStdOutput != INVALID_HANDLE_VALUE) { - CloseHandle(startInfo.hStdOutput); + pipePtr = Tcl_GetChannelInstanceData(chan); + TclNewObj(pidsObj); + for (i = 0; i < pipePtr->numPids; i++) { + Tcl_ListObjAppendElement(NULL, pidsObj, + Tcl_NewWideIntObj((unsigned) + TclpGetPid(pipePtr->pidPtr[i]))); + Tcl_DetachPids(1, &pipePtr->pidPtr[i]); } - if (startInfo.hStdError != INVALID_HANDLE_VALUE) { - CloseHandle(startInfo.hStdError); + Tcl_SetObjResult(interp, pidsObj); + if (pipePtr->numPids > 0) { + ckfree(pipePtr->pidPtr); + pipePtr->numPids = 0; } - return result; } - /* *---------------------------------------------------------------------- * - * HasConsole -- + * PipeBlockModeProc -- * - * Determines whether the current application is attached to a console. + * Set blocking or non-blocking mode on channel. * * Results: - * Returns TRUE if this application has a console, else FALSE. + * 0 if successful, errno when failed. * * Side effects: - * None. + * Sets the device into blocking or non-blocking mode. * *---------------------------------------------------------------------- */ -static BOOL -HasConsole(void) +static int +PipeBlockModeProc( + ClientData instanceData, /* Instance data for channel. */ + int mode) /* TCL_MODE_BLOCKING or + * TCL_MODE_NONBLOCKING. */ { - HANDLE handle; + PipeInfo *infoPtr = (PipeInfo *) instanceData; - handle = CreateFileA("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + /* + * Pipes on Windows can not be switched between blocking and nonblocking, + * hence we have to emulate the behavior. This is done in the input + * function by checking against a bit in the state. We set or unset the + * bit here to cause the input function to emulate the correct behavior. + */ - if (handle != INVALID_HANDLE_VALUE) { - CloseHandle(handle); - return TRUE; + if (mode == TCL_MODE_NONBLOCKING) { + infoPtr->flags |= PIPE_ASYNC; } else { - return FALSE; + infoPtr->flags &= ~(PIPE_ASYNC); } + return 0; } /* - *-------------------------------------------------------------------- - * - * ApplicationType -- - * - * Search for the specified program and identify if it refers to a DOS, - * Windows 3.X, or Win32 program. Used to determine how to invoke a - * program, or if it can even be invoked. + *---------------------------------------------------------------------- * - * It is possible to almost positively identify DOS and Windows - * applications that contain the appropriate magic numbers. However, DOS - * .com files do not seem to contain a magic number; if the program name - * ends with .com and could not be identified as a Windows .com file, it - * will be assumed to be a DOS application, even if it was just random - * data. If the program name does not end with .com, no such assumption - * is made. + * PipeClose2Proc -- * - * The Win32 function GetBinaryType incorrectly identifies any junk file - * that ends with .exe as a dos executable and some executables that - * don't end with .exe as not executable. Plus it doesn't exist under - * win95, so I won't feel bad about reimplementing functionality. + * Closes a pipe based IO channel. * * Results: - * The return value is one of APPL_DOS, APPL_WIN3X, or APPL_WIN32 if the - * filename referred to the corresponding application type. If the file - * name could not be found or did not refer to any known application - * type, APPL_NONE is returned and an error message is left in interp. - * .bat files are identified as APPL_DOS. + * 0 on success, errno otherwise. * * Side effects: - * None. + * Closes the physical channel. * *---------------------------------------------------------------------- */ static int -ApplicationType( - Tcl_Interp *interp, /* Interp, for error message. */ - const char *originalName, /* Name of the application to find. */ - char fullName[]) /* Filled with complete path to - * application. */ +PipeClose2Proc( + ClientData instanceData, /* Pointer to PipeInfo structure. */ + Tcl_Interp *interp, /* For error reporting. */ + int flags) /* Flags that indicate which side to close. */ { - int applType, i, nameLen, found; - HANDLE hFile; - TCHAR *rest; - char *ext; - char buf[2]; - DWORD attr, read; - IMAGE_DOS_HEADER header; - Tcl_DString nameBuf, ds; - const TCHAR *nativeName; - TCHAR nativeFullPath[MAX_PATH]; - static const char extensions[][5] = {"", ".com", ".exe", ".bat", ".cmd"}; - - /* - * Look for the program as an external program. First try the name as it - * is, then try adding .com, .exe, and .bat, in that order, to the name, - * looking for an executable. - * - * Using the raw SearchPath() function doesn't do quite what is necessary. - * If the name of the executable already contains a '.' character, it will - * not try appending the specified extension when searching (in other - * words, SearchPath will not find the program "a.b.exe" if the arguments - * specified "a.b" and ".exe"). So, first look for the file as it is - * named. Then manually append the extensions, looking for a match. - */ - - applType = APPL_NONE; - Tcl_DStringInit(&nameBuf); - Tcl_DStringAppend(&nameBuf, originalName, -1); - nameLen = Tcl_DStringLength(&nameBuf); + PipeInfo *pipePtr = (PipeInfo *) instanceData; + Tcl_Channel errChan; + int errorCode, result; + PipeInfo *infoPtr, **nextPtrPtr; + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - for (i = 0; i < (int) (sizeof(extensions) / sizeof(extensions[0])); i++) { - Tcl_DStringSetLength(&nameBuf, nameLen); - Tcl_DStringAppend(&nameBuf, extensions[i], -1); - nativeName = Tcl_WinUtfToTChar(Tcl_DStringValue(&nameBuf), - Tcl_DStringLength(&nameBuf), &ds); - found = SearchPath(NULL, nativeName, NULL, MAX_PATH, - nativeFullPath, &rest); - Tcl_DStringFree(&ds); - if (found == 0) { - continue; - } + errorCode = 0; + result = 0; + if ((!flags || flags == TCL_CLOSE_READ) && (pipePtr->readFile != NULL)) { /* - * Ignore matches on directories or data files, return if identified a - * known type. + * Clean up the background thread if necessary. Note that this must be + * done before we can close the file, since the thread may be blocking + * trying to read from the pipe. */ - attr = GetFileAttributes(nativeFullPath); - if ((attr == 0xffffffff) || (attr & FILE_ATTRIBUTE_DIRECTORY)) { - continue; - } - strcpy(fullName, Tcl_WinTCharToUtf(nativeFullPath, -1, &ds)); - Tcl_DStringFree(&ds); + if (pipePtr->readThread) { - ext = strrchr(fullName, '.'); - if ((ext != NULL) && - (strcasecmp(ext, ".cmd") == 0 || strcasecmp(ext, ".bat") == 0)) { - applType = APPL_DOS; - break; + TclPipeThreadStop(&pipePtr->readTI, pipePtr->readThread); + CloseHandle(pipePtr->readThread); + CloseHandle(pipePtr->readable); + pipePtr->readThread = NULL; } - - hFile = CreateFile(nativeFullPath, - GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile == INVALID_HANDLE_VALUE) { - continue; + if (TclpCloseFile(pipePtr->readFile) != 0) { + errorCode = errno; } + pipePtr->validMask &= ~TCL_READABLE; + pipePtr->readFile = NULL; + } + if ((!flags || flags & TCL_CLOSE_WRITE) + && (pipePtr->writeFile != NULL)) { + if (pipePtr->writeThread) { - header.e_magic = 0; - ReadFile(hFile, (void *) &header, sizeof(header), &read, NULL); - if (header.e_magic != IMAGE_DOS_SIGNATURE) { /* - * Doesn't have the magic number for relocatable executables. If - * filename ends with .com, assume it's a DOS application anyhow. - * Note that we didn't make this assumption at first, because some - * supposed .com files are really 32-bit executables with all the - * magic numbers and everything. + * Wait for the writer thread to finish the current buffer, then + * terminate the thread and close the handles. If the channel is + * nonblocking or may block during exit, bail out since the worker + * thread is not interruptible and we want TIP#398-fast-exit. */ + if ((pipePtr->flags & PIPE_ASYNC) && TclInExit()) { + + /* give it a chance to leave honorably */ + TclPipeThreadStopSignal(&pipePtr->writeTI); + + if (WaitForSingleObject(pipePtr->writable, 20) == WAIT_TIMEOUT) { + return EWOULDBLOCK; + } + + } else { + + WaitForSingleObject(pipePtr->writable, INFINITE); + + } + + TclPipeThreadStop(&pipePtr->writeTI, pipePtr->writeThread); + + CloseHandle(pipePtr->writable); + CloseHandle(pipePtr->writeThread); + pipePtr->writeThread = NULL; + } + if (TclpCloseFile(pipePtr->writeFile) != 0) { + if (errorCode == 0) { + errorCode = errno; + } + } + pipePtr->validMask &= ~TCL_WRITABLE; + pipePtr->writeFile = NULL; + } + + pipePtr->watchMask &= pipePtr->validMask; + + /* + * Don't free the channel if any of the flags were set. + */ + + if (flags) { + return errorCode; + } - CloseHandle(hFile); - if ((ext != NULL) && (strcasecmp(ext, ".com") == 0)) { - applType = APPL_DOS; - break; - } - continue; - } - if (header.e_lfarlc != sizeof(header)) { - /* - * All Windows 3.X and Win32 and some DOS programs have this value - * set here. If it doesn't, assume that since it already had the - * other magic number it was a DOS application. - */ + /* + * Remove the file from the list of watched files. + */ - CloseHandle(hFile); - applType = APPL_DOS; + for (nextPtrPtr = &(tsdPtr->firstPipePtr), infoPtr = *nextPtrPtr; + infoPtr != NULL; + nextPtrPtr = &infoPtr->nextPtr, infoPtr = *nextPtrPtr) { + if (infoPtr == (PipeInfo *)pipePtr) { + *nextPtrPtr = infoPtr->nextPtr; break; } + } + if ((pipePtr->flags & PIPE_ASYNC) || TclInExit()) { /* - * The DWORD at header.e_lfanew points to yet another magic number. + * If the channel is non-blocking or Tcl is being cleaned up, just + * detach the children PIDs, reap them (important if we are in a + * dynamic load module), and discard the errorFile. */ - buf[0] = '\0'; - SetFilePointer(hFile, header.e_lfanew, NULL, FILE_BEGIN); - ReadFile(hFile, (void *) buf, 2, &read, NULL); - CloseHandle(hFile); + Tcl_DetachPids(pipePtr->numPids, pipePtr->pidPtr); + Tcl_ReapDetachedProcs(); - if ((buf[0] == 'N') && (buf[1] == 'E')) { - applType = APPL_WIN3X; - } else if ((buf[0] == 'P') && (buf[1] == 'E')) { - applType = APPL_WIN32; - } else { - /* - * Strictly speaking, there should be a test that there is an 'L' - * and 'E' at buf[0..1], to identify the type as DOS, but of - * course we ran into a DOS executable that _doesn't_ have the - * magic number - specifically, one compiled using the Lahey - * Fortran90 compiler. - */ + if (pipePtr->errorFile) { + if (TclpCloseFile(pipePtr->errorFile) != 0) { + if (errorCode == 0) { + errorCode = errno; + } + } + } + result = 0; + } else { + /* + * Wrap the error file into a channel and give it to the cleanup + * routine. + */ - applType = APPL_DOS; + if (pipePtr->errorFile) { + WinFile *filePtr = (WinFile *) pipePtr->errorFile; + + errChan = Tcl_MakeFileChannel((ClientData) filePtr->handle, + TCL_READABLE); + ckfree(filePtr); + } else { + errChan = NULL; } - break; + + result = TclCleanupChildren(interp, pipePtr->numPids, + pipePtr->pidPtr, errChan); } - Tcl_DStringFree(&nameBuf); - if (applType == APPL_NONE) { - TclWinConvertError(GetLastError()); - Tcl_SetObjResult(interp, Tcl_ObjPrintf("couldn't execute \"%s\": %s", - originalName, Tcl_PosixError(interp))); - return APPL_NONE; + if (pipePtr->numPids > 0) { + ckfree(pipePtr->pidPtr); } - if ((applType == APPL_DOS) || (applType == APPL_WIN3X)) { - /* - * Replace long path name of executable with short path name for - * 16-bit applications. Otherwise the application may not be able to - * correctly parse its own command line to separate off the - * application name from the arguments. - */ + if (pipePtr->writeBuf != NULL) { + ckfree(pipePtr->writeBuf); + } - GetShortPathName(nativeFullPath, nativeFullPath, MAX_PATH); - strcpy(fullName, Tcl_WinTCharToUtf(nativeFullPath, -1, &ds)); - Tcl_DStringFree(&ds); + ckfree(pipePtr); + + if (errorCode == 0) { + return result; } - return applType; + return errorCode; } /* *---------------------------------------------------------------------- * - * BuildCommandLine -- + * PipeInputProc -- * - * The command line arguments are stored in linePtr separated by spaces, - * in a form that CreateProcess() understands. Special characters in - * individual arguments from argv[] must be quoted when being stored in - * cmdLine. + * Reads input from the IO channel into the buffer given. Returns count + * of how many bytes were actually read, and an error indication. * * Results: - * None. + * A count of how many bytes were read is returned and an error + * indication is returned in an output argument. * * Side effects: - * None. + * Reads input from the actual channel. * *---------------------------------------------------------------------- */ -static void -BuildCommandLine( - const char *executable, /* Full path of executable (including - * extension). Replacement for argv[0]. */ - int argc, /* Number of arguments. */ - const char **argv, /* Argument strings in UTF. */ - Tcl_DString *linePtr) /* Initialized Tcl_DString that receives the - * command line (TCHAR). */ +static int +PipeInputProc( + ClientData instanceData, /* Pipe state. */ + char *buf, /* Where to store data read. */ + int bufSize, /* How much space is available in the + * buffer? */ + int *errorCode) /* Where to store error code. */ { - const char *arg, *start, *special; - int quote, i; - Tcl_DString ds; + PipeInfo *infoPtr = (PipeInfo *) instanceData; + WinFile *filePtr = (WinFile*) infoPtr->readFile; + DWORD count, bytesRead = 0; + int result; - Tcl_DStringInit(&ds); + *errorCode = 0; + /* + * Synchronize with the reader thread. + */ + + result = WaitForRead(infoPtr, (infoPtr->flags & PIPE_ASYNC) ? 0 : 1); /* - * Prime the path. Add a space separator if we were primed with something. + * If an error occurred, return immediately. */ - TclDStringAppendDString(&ds, linePtr); - if (Tcl_DStringLength(linePtr) > 0) { - TclDStringAppendLiteral(&ds, " "); + if (result == -1) { + *errorCode = errno; + return -1; } - for (i = 0; i < argc; i++) { - if (i == 0) { - arg = executable; - } else { - arg = argv[i]; - TclDStringAppendLiteral(&ds, " "); - } + if (infoPtr->readFlags & PIPE_EXTRABYTE) { + /* + * The reader thread consumed 1 byte as a side effect of waiting so we + * need to move it into the buffer. + */ - quote = 0; - if (arg[0] == '\0') { - quote = 1; - } else { - int count; - Tcl_UniChar ch; + *buf = infoPtr->extraByte; + infoPtr->readFlags &= ~PIPE_EXTRABYTE; + buf++; + bufSize--; + bytesRead = 1; - for (start = arg; *start != '\0'; start += count) { - count = Tcl_UtfToUniChar(start, &ch); - if (Tcl_UniCharIsSpace(ch)) { /* INTL: ISO space. */ - quote = 1; - break; - } - } - } - if (quote) { - TclDStringAppendLiteral(&ds, "\""); - } - start = arg; - for (special = arg; ; ) { - if ((*special == '\\') && (special[1] == '\\' || - special[1] == '"' || (quote && special[1] == '\0'))) { - Tcl_DStringAppend(&ds, start, (int) (special - start)); - start = special; - while (1) { - special++; - if (*special == '"' || (quote && *special == '\0')) { - /* - * N backslashes followed a quote -> insert N * 2 + 1 - * backslashes then a quote. - */ + /* + * If further read attempts would block, return what we have. + */ - Tcl_DStringAppend(&ds, start, - (int) (special - start)); - break; - } - if (*special != '\\') { - break; - } - } - Tcl_DStringAppend(&ds, start, (int) (special - start)); - start = special; - } - if (*special == '"') { - Tcl_DStringAppend(&ds, start, (int) (special - start)); - TclDStringAppendLiteral(&ds, "\\\""); - start = special + 1; - } - if (*special == '\0') { - break; - } - special++; - } - Tcl_DStringAppend(&ds, start, (int) (special - start)); - if (quote) { - TclDStringAppendLiteral(&ds, "\""); + if (result == 0) { + return bytesRead; } } - Tcl_DStringFree(linePtr); - Tcl_WinUtfToTChar(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), linePtr); - Tcl_DStringFree(&ds); + + /* + * Attempt to read bufSize bytes. The read will return immediately if + * there is any data available. Otherwise it will block until at least one + * byte is available or an EOF occurs. + */ + + if (ReadFile(filePtr->handle, (LPVOID) buf, (DWORD) bufSize, &count, + (LPOVERLAPPED) NULL) == TRUE) { + return bytesRead + count; + } else if (bytesRead) { + /* + * Ignore errors if we have data to return. + */ + + return bytesRead; + } + + TclWinConvertError(GetLastError()); + if (errno == EPIPE) { + infoPtr->readFlags |= PIPE_EOF; + return 0; + } + *errorCode = errno; + return -1; } /* *---------------------------------------------------------------------- * - * TclpCreateCommandChannel -- + * PipeOutputProc -- * - * This function is called by Tcl_OpenCommandChannel to perform the - * platform specific channel initialization for a command channel. + * Writes the given output on the IO channel. Returns count of how many + * characters were actually written, and an error indication. * * Results: - * Returns a new channel or NULL on failure. + * A count of how many characters were written is returned and an error + * indication is returned in an output argument. * * Side effects: - * Allocates a new channel. + * Writes output on the actual channel. * *---------------------------------------------------------------------- */ -Tcl_Channel -TclpCreateCommandChannel( - TclFile readFile, /* If non-null, gives the file for reading. */ - TclFile writeFile, /* If non-null, gives the file for writing. */ - TclFile errorFile, /* If non-null, gives the file where errors - * can be read. */ - int numPids, /* The number of pids in the pid array. */ - Tcl_Pid *pidPtr) /* An array of process identifiers. */ +static int +PipeOutputProc( + ClientData instanceData, /* Pipe state. */ + const char *buf, /* The data buffer. */ + int toWrite, /* How many bytes to write? */ + int *errorCode) /* Where to store error code. */ { - char channelName[16 + TCL_INTEGER_SPACE]; - DWORD id; - PipeInfo *infoPtr = ckalloc(sizeof(PipeInfo)); + PipeInfo *infoPtr = (PipeInfo *) instanceData; + WinFile *filePtr = (WinFile*) infoPtr->writeFile; + DWORD bytesWritten, timeout; - PipeInit(); + *errorCode = 0; + timeout = (infoPtr->flags & PIPE_ASYNC) ? 0 : INFINITE; + if (WaitForSingleObject(infoPtr->writable, timeout) == WAIT_TIMEOUT) { + /* + * The writer thread is blocked waiting for a write to complete and + * the channel is in non-blocking mode. + */ - infoPtr->watchMask = 0; - infoPtr->flags = 0; - infoPtr->readFlags = 0; - infoPtr->readFile = readFile; - infoPtr->writeFile = writeFile; - infoPtr->errorFile = errorFile; - infoPtr->numPids = numPids; - infoPtr->pidPtr = pidPtr; - infoPtr->writeBuf = 0; - infoPtr->writeBufLen = 0; - infoPtr->writeError = 0; - infoPtr->channel = NULL; + errno = EWOULDBLOCK; + goto error; + } - infoPtr->validMask = 0; + /* + * Check for a background error on the last write. + */ - infoPtr->threadId = Tcl_GetCurrentThread(); + if (infoPtr->writeError) { + TclWinConvertError(infoPtr->writeError); + infoPtr->writeError = 0; + goto error; + } - if (readFile != NULL) { + if (infoPtr->flags & PIPE_ASYNC) { /* - * Start the background reader thread. + * The pipe is non-blocking, so copy the data into the output buffer + * and restart the writer thread. */ - infoPtr->readable = CreateEvent(NULL, TRUE, TRUE, NULL); - infoPtr->readThread = CreateThread(NULL, 256, PipeReaderThread, - PipeThreadCreateTI(&infoPtr->readTI, infoPtr), 0, &id); - SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); - infoPtr->validMask |= TCL_READABLE; + if (toWrite > infoPtr->writeBufLen) { + /* + * Reallocate the buffer to be large enough to hold the data. + */ + + if (infoPtr->writeBuf) { + ckfree(infoPtr->writeBuf); + } + infoPtr->writeBufLen = toWrite; + infoPtr->writeBuf = ckalloc(toWrite); + } + memcpy(infoPtr->writeBuf, buf, (size_t) toWrite); + infoPtr->toWrite = toWrite; + ResetEvent(infoPtr->writable); + TclPipeThreadSignal(&infoPtr->writeTI); + bytesWritten = toWrite; } else { - infoPtr->readTI = NULL; - infoPtr->readThread = 0; - } - if (writeFile != NULL) { /* - * Start the background writer thread. + * In the blocking case, just try to write the buffer directly. This + * avoids an unnecessary copy. */ - infoPtr->writable = CreateEvent(NULL, TRUE, TRUE, NULL); - infoPtr->writeThread = CreateThread(NULL, 256, PipeWriterThread, - PipeThreadCreateTI(&infoPtr->writeTI, infoPtr), 0, &id); - SetThreadPriority(infoPtr->writeThread, THREAD_PRIORITY_HIGHEST); - infoPtr->validMask |= TCL_WRITABLE; - } else { - infoPtr->writeTI = NULL; - infoPtr->writeThread = 0; + if (WriteFile(filePtr->handle, (LPVOID) buf, (DWORD) toWrite, + &bytesWritten, (LPOVERLAPPED) NULL) == FALSE) { + TclWinConvertError(GetLastError()); + goto error; + } } + return bytesWritten; - /* - * For backward compatibility with previous versions of Tcl, we use - * "file%d" as the base name for pipes even though it would be more - * natural to use "pipe%d". Use the pointer to keep the channel names - * unique, in case channels share handles (stdin/stdout). - */ - - sprintf(channelName, "file%" TCL_I_MODIFIER "x", (size_t) infoPtr); - infoPtr->channel = Tcl_CreateChannel(&pipeChannelType, channelName, - infoPtr, infoPtr->validMask); - - /* - * Pipes have AUTO translation mode on Windows and ^Z eof char, which - * means that a ^Z will be appended to them at close. This is needed for - * Windows programs that expect a ^Z at EOF. - */ + error: + *errorCode = errno; + return -1; - Tcl_SetChannelOption(NULL, infoPtr->channel, "-translation", "auto"); - Tcl_SetChannelOption(NULL, infoPtr->channel, "-eofchar", "\032 {}"); - return infoPtr->channel; } /* *---------------------------------------------------------------------- * - * Tcl_CreatePipe -- + * PipeEventProc -- * - * System dependent interface to create a pipe for the [chan pipe] - * command. Stolen from TclX. + * This function is invoked by Tcl_ServiceEvent when a file event reaches + * the front of the event queue. This function invokes Tcl_NotifyChannel + * on the pipe. * * Results: - * TCL_OK or TCL_ERROR. + * 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 notifier callback does. * *---------------------------------------------------------------------- */ -int -Tcl_CreatePipe( - Tcl_Interp *interp, /* Errors returned in result.*/ - Tcl_Channel *rchan, /* Where to return the read side. */ - Tcl_Channel *wchan, /* Where to return the write side. */ - int flags) /* Reserved for future use. */ +static int +PipeEventProc( + Tcl_Event *evPtr, /* Event to service. */ + int flags) /* Flags that indicate what events to + * handle, such as TCL_FILE_EVENTS. */ { - HANDLE readHandle, writeHandle; - SECURITY_ATTRIBUTES sec; + PipeEvent *pipeEvPtr = (PipeEvent *)evPtr; + PipeInfo *infoPtr; + int mask; + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - sec.nLength = sizeof(SECURITY_ATTRIBUTES); - sec.lpSecurityDescriptor = NULL; - sec.bInheritHandle = FALSE; + if (!(flags & TCL_FILE_EVENTS)) { + return 0; + } - if (!CreatePipe(&readHandle, &writeHandle, &sec, 0)) { - TclWinConvertError(GetLastError()); - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "pipe creation failed: %s", Tcl_PosixError(interp))); - return TCL_ERROR; + /* + * Search through the list of watched pipes for the one whose handle + * matches the event. We do this rather than simply dereferencing the + * handle in the event so that pipes can be deleted while the event is in + * the queue. + */ + + for (infoPtr = tsdPtr->firstPipePtr; infoPtr != NULL; + infoPtr = infoPtr->nextPtr) { + if (pipeEvPtr->infoPtr == infoPtr) { + infoPtr->flags &= ~(PIPE_PENDING); + break; + } } - *rchan = Tcl_MakeFileChannel((ClientData) readHandle, TCL_READABLE); - Tcl_RegisterChannel(interp, *rchan); + /* + * Remove stale events. + */ - *wchan = Tcl_MakeFileChannel((ClientData) writeHandle, TCL_WRITABLE); - Tcl_RegisterChannel(interp, *wchan); + if (!infoPtr) { + return 1; + } - return TCL_OK; + /* + * Check to see if the pipe is readable. Note that we can't tell if a pipe + * is writable, so we always report it as being writable unless we have + * detected EOF. + */ + + mask = 0; + if ((infoPtr->watchMask & TCL_WRITABLE) && + (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT)) { + mask = TCL_WRITABLE; + } + + if ((infoPtr->watchMask & TCL_READABLE) && (WaitForRead(infoPtr,0) >= 0)) { + if (infoPtr->readFlags & PIPE_EOF) { + mask = TCL_READABLE; + } else { + mask |= TCL_READABLE; + } + } + + /* + * Inform the channel of the events. + */ + + Tcl_NotifyChannel(infoPtr->channel, infoPtr->watchMask & mask); + return 1; } /* *---------------------------------------------------------------------- * - * TclGetAndDetachPids -- + * PipeWatchProc -- * - * Stores a list of the command PIDs for a command channel in the - * interp's result. + * Called by the notifier to set up to watch for events on this channel. * * Results: * None. * * Side effects: - * Modifies the interp's result. + * None. * *---------------------------------------------------------------------- */ -void -TclGetAndDetachPids( - Tcl_Interp *interp, - Tcl_Channel chan) +static void +PipeWatchProc( + ClientData instanceData, /* Pipe state. */ + int mask) /* What events to watch for, OR-ed combination + * of TCL_READABLE, TCL_WRITABLE and + * TCL_EXCEPTION. */ { - PipeInfo *pipePtr; - const Tcl_ChannelType *chanTypePtr; - Tcl_Obj *pidsObj; - int i; + PipeInfo **nextPtrPtr, *ptr; + PipeInfo *infoPtr = (PipeInfo *) instanceData; + int oldMask = infoPtr->watchMask; + ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); /* - * Punt if the channel is not a command channel. + * Since most of the work is handled by the background threads, we just + * need to update the watchMask and then force the notifier to poll once. */ - chanTypePtr = Tcl_GetChannelType(chan); - if (chanTypePtr != &pipeChannelType) { - return; - } + infoPtr->watchMask = mask & infoPtr->validMask; + if (infoPtr->watchMask) { + Tcl_Time blockTime = { 0, 0 }; + if (!oldMask) { + infoPtr->nextPtr = tsdPtr->firstPipePtr; + tsdPtr->firstPipePtr = infoPtr; + } + Tcl_SetMaxBlockTime(&blockTime); + } else { + if (oldMask) { + /* + * Remove the pipe from the list of watched pipes. + */ - pipePtr = Tcl_GetChannelInstanceData(chan); - TclNewObj(pidsObj); - for (i = 0; i < pipePtr->numPids; i++) { - Tcl_ListObjAppendElement(NULL, pidsObj, - Tcl_NewWideIntObj((unsigned) - TclpGetPid(pipePtr->pidPtr[i]))); - Tcl_DetachPids(1, &pipePtr->pidPtr[i]); - } - Tcl_SetObjResult(interp, pidsObj); - if (pipePtr->numPids > 0) { - ckfree(pipePtr->pidPtr); - pipePtr->numPids = 0; + for (nextPtrPtr = &(tsdPtr->firstPipePtr), ptr = *nextPtrPtr; + ptr != NULL; + nextPtrPtr = &ptr->nextPtr, ptr = *nextPtrPtr) { + if (infoPtr == ptr) { + *nextPtrPtr = ptr->nextPtr; + break; + } + } + } } } /* *---------------------------------------------------------------------- * - * PipeBlockModeProc -- + * PipeGetHandleProc -- * - * Set blocking or non-blocking mode on channel. + * Called from Tcl_GetChannelHandle to retrieve OS handles from inside a + * command pipeline based channel. * * Results: - * 0 if successful, errno when failed. + * Returns TCL_OK with the fd in handlePtr, or TCL_ERROR if there is no + * handle for the specified direction. * * Side effects: - * Sets the device into blocking or non-blocking mode. + * None. * *---------------------------------------------------------------------- */ static int -PipeBlockModeProc( - ClientData instanceData, /* Instance data for channel. */ - int mode) /* TCL_MODE_BLOCKING or - * TCL_MODE_NONBLOCKING. */ +PipeGetHandleProc( + ClientData instanceData, /* The pipe state. */ + int direction, /* TCL_READABLE or TCL_WRITABLE */ + ClientData *handlePtr) /* Where to store the handle. */ { PipeInfo *infoPtr = (PipeInfo *) instanceData; + WinFile *filePtr; - /* - * Pipes on Windows can not be switched between blocking and nonblocking, - * hence we have to emulate the behavior. This is done in the input - * function by checking against a bit in the state. We set or unset the - * bit here to cause the input function to emulate the correct behavior. - */ - - if (mode == TCL_MODE_NONBLOCKING) { - infoPtr->flags |= PIPE_ASYNC; - } else { - infoPtr->flags &= ~(PIPE_ASYNC); + if (direction == TCL_READABLE && infoPtr->readFile) { + filePtr = (WinFile*) infoPtr->readFile; + *handlePtr = (ClientData) filePtr->handle; + return TCL_OK; } - return 0; + if (direction == TCL_WRITABLE && infoPtr->writeFile) { + filePtr = (WinFile*) infoPtr->writeFile; + *handlePtr = (ClientData) filePtr->handle; + return TCL_OK; + } + return TCL_ERROR; } /* *---------------------------------------------------------------------- * - * PipeClose2Proc -- + * Tcl_WaitPid -- * - * Closes a pipe based IO channel. + * Emulates the waitpid system call. * * Results: - * 0 on success, errno otherwise. + * Returns 0 if the process is still alive, -1 on an error, or the pid on + * a clean close. * * Side effects: - * Closes the physical channel. + * Unless WNOHANG is set and the wait times out, the process information + * record will be deleted and the process handle will be closed. * *---------------------------------------------------------------------- */ -static int -PipeClose2Proc( - ClientData instanceData, /* Pointer to PipeInfo structure. */ - Tcl_Interp *interp, /* For error reporting. */ - int flags) /* Flags that indicate which side to close. */ +Tcl_Pid +Tcl_WaitPid( + Tcl_Pid pid, + int *statPtr, + int options) { - PipeInfo *pipePtr = (PipeInfo *) instanceData; - Tcl_Channel errChan; - int errorCode, result; - PipeInfo *infoPtr, **nextPtrPtr; - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - - errorCode = 0; - result = 0; + ProcInfo *infoPtr = NULL, **prevPtrPtr; + DWORD flags; + Tcl_Pid result; + DWORD ret, exitCode; - if ((!flags || flags == TCL_CLOSE_READ) && (pipePtr->readFile != NULL)) { - /* - * Clean up the background thread if necessary. Note that this must be - * done before we can close the file, since the thread may be blocking - * trying to read from the pipe. - */ + PipeInit(); - if (pipePtr->readThread) { + /* + * If no pid is specified, do nothing. + */ - PipeThreadStop(&pipePtr->readTI, pipePtr->readThread); - CloseHandle(pipePtr->readThread); - CloseHandle(pipePtr->readable); - pipePtr->readThread = NULL; - } - if (TclpCloseFile(pipePtr->readFile) != 0) { - errorCode = errno; - } - pipePtr->validMask &= ~TCL_READABLE; - pipePtr->readFile = NULL; + if (pid == 0) { + *statPtr = 0; + return 0; } - if ((!flags || flags & TCL_CLOSE_WRITE) - && (pipePtr->writeFile != NULL)) { - if (pipePtr->writeThread) { - - /* - * Wait for the writer thread to finish the current buffer, then - * terminate the thread and close the handles. If the channel is - * nonblocking or may block during exit, bail out since the worker - * thread is not interruptible and we want TIP#398-fast-exit. - */ - if ((pipePtr->flags & PIPE_ASYNC) && TclInExit()) { - - /* give it a chance to leave honorably */ - PipeThreadStopSignal(&pipePtr->writeTI); - - if (WaitForSingleObject(pipePtr->writable, 20) == WAIT_TIMEOUT) { - return EWOULDBLOCK; - } - - } else { - - WaitForSingleObject(pipePtr->writable, INFINITE); - - } - PipeThreadStop(&pipePtr->writeTI, pipePtr->writeThread); + /* + * Find the process and cut it from the process list. + */ - CloseHandle(pipePtr->writable); - CloseHandle(pipePtr->writeThread); - pipePtr->writeThread = NULL; - } - if (TclpCloseFile(pipePtr->writeFile) != 0) { - if (errorCode == 0) { - errorCode = errno; - } + Tcl_MutexLock(&pipeMutex); + prevPtrPtr = &procList; + for (infoPtr = procList; infoPtr != NULL; + prevPtrPtr = &infoPtr->nextPtr, infoPtr = infoPtr->nextPtr) { + if (infoPtr->hProcess == (HANDLE) pid) { + *prevPtrPtr = infoPtr->nextPtr; + break; } - pipePtr->validMask &= ~TCL_WRITABLE; - pipePtr->writeFile = NULL; } - - pipePtr->watchMask &= pipePtr->validMask; + Tcl_MutexUnlock(&pipeMutex); /* - * Don't free the channel if any of the flags were set. + * If the pid is not one of the processes we know about (we started it) + * then do nothing. */ - if (flags) { - return errorCode; + if (infoPtr == NULL) { + *statPtr = 0; + return 0; } /* - * Remove the file from the list of watched files. + * Officially "wait" for it to finish. We either poll (WNOHANG) or wait + * for an infinite amount of time. */ - for (nextPtrPtr = &(tsdPtr->firstPipePtr), infoPtr = *nextPtrPtr; - infoPtr != NULL; - nextPtrPtr = &infoPtr->nextPtr, infoPtr = *nextPtrPtr) { - if (infoPtr == (PipeInfo *)pipePtr) { - *nextPtrPtr = infoPtr->nextPtr; - break; - } + if (options & WNOHANG) { + flags = 0; + } else { + flags = INFINITE; } + ret = WaitForSingleObject(infoPtr->hProcess, flags); + if (ret == WAIT_TIMEOUT) { + *statPtr = 0; + if (options & WNOHANG) { + /* + * Re-insert this infoPtr back on the list. + */ + + Tcl_MutexLock(&pipeMutex); + infoPtr->nextPtr = procList; + procList = infoPtr; + Tcl_MutexUnlock(&pipeMutex); + return 0; + } else { + result = 0; + } + } else if (ret == WAIT_OBJECT_0) { + GetExitCodeProcess(infoPtr->hProcess, &exitCode); - if ((pipePtr->flags & PIPE_ASYNC) || TclInExit()) { /* - * If the channel is non-blocking or Tcl is being cleaned up, just - * detach the children PIDs, reap them (important if we are in a - * dynamic load module), and discard the errorFile. + * Does the exit code look like one of the exception codes? */ - Tcl_DetachPids(pipePtr->numPids, pipePtr->pidPtr); - Tcl_ReapDetachedProcs(); + switch (exitCode) { + case EXCEPTION_FLT_DENORMAL_OPERAND: + case EXCEPTION_FLT_DIVIDE_BY_ZERO: + case EXCEPTION_FLT_INEXACT_RESULT: + case EXCEPTION_FLT_INVALID_OPERATION: + case EXCEPTION_FLT_OVERFLOW: + case EXCEPTION_FLT_STACK_CHECK: + case EXCEPTION_FLT_UNDERFLOW: + case EXCEPTION_INT_DIVIDE_BY_ZERO: + case EXCEPTION_INT_OVERFLOW: + *statPtr = 0xC0000000 | SIGFPE; + break; - if (pipePtr->errorFile) { - if (TclpCloseFile(pipePtr->errorFile) != 0) { - if (errorCode == 0) { - errorCode = errno; - } - } - } - result = 0; - } else { - /* - * Wrap the error file into a channel and give it to the cleanup - * routine. - */ + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + *statPtr = 0xC0000000 | SIGILL; + break; + + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + case EXCEPTION_INVALID_DISPOSITION: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_INVALID_HANDLE: + *statPtr = 0xC0000000 | SIGSEGV; + break; - if (pipePtr->errorFile) { - WinFile *filePtr = (WinFile *) pipePtr->errorFile; + case EXCEPTION_DATATYPE_MISALIGNMENT: + *statPtr = 0xC0000000 | SIGBUS; + break; - errChan = Tcl_MakeFileChannel((ClientData) filePtr->handle, - TCL_READABLE); - ckfree(filePtr); - } else { - errChan = NULL; - } + case EXCEPTION_BREAKPOINT: + case EXCEPTION_SINGLE_STEP: + *statPtr = 0xC0000000 | SIGTRAP; + break; - result = TclCleanupChildren(interp, pipePtr->numPids, - pipePtr->pidPtr, errChan); - } + case CONTROL_C_EXIT: + *statPtr = 0xC0000000 | SIGINT; + break; - if (pipePtr->numPids > 0) { - ckfree(pipePtr->pidPtr); - } + default: + /* + * Non-exceptional, normal, exit code. Note that the exit code is + * truncated to a signed short range [-32768,32768) whether it + * fits into this range or not. + * + * BUG: Even though the exit code is a DWORD, it is understood by + * convention to be a signed integer, yet there isn't enough room + * to fit this into the POSIX style waitstatus mask without + * truncating it. + */ - if (pipePtr->writeBuf != NULL) { - ckfree(pipePtr->writeBuf); + *statPtr = exitCode; + break; + } + result = pid; + } else { + errno = ECHILD; + *statPtr = 0xC0000000 | ECHILD; + result = (Tcl_Pid) -1; } - ckfree(pipePtr); + /* + * Officially close the process handle. + */ - if (errorCode == 0) { - return result; - } - return errorCode; + CloseHandle(infoPtr->hProcess); + ckfree(infoPtr); + + return result; } /* *---------------------------------------------------------------------- * - * PipeInputProc -- + * TclWinAddProcess -- * - * Reads input from the IO channel into the buffer given. Returns count - * of how many bytes were actually read, and an error indication. + * Add a process to the process list so that we can use Tcl_WaitPid on + * the process. * * Results: - * A count of how many bytes were read is returned and an error - * indication is returned in an output argument. + * None * * Side effects: - * Reads input from the actual channel. + * Adds the specified process handle to the process list so Tcl_WaitPid + * knows about it. * *---------------------------------------------------------------------- */ -static int -PipeInputProc( - ClientData instanceData, /* Pipe state. */ - char *buf, /* Where to store data read. */ - int bufSize, /* How much space is available in the - * buffer? */ - int *errorCode) /* Where to store error code. */ +void +TclWinAddProcess( + void *hProcess, /* Handle to process */ + unsigned long id) /* Global process identifier */ { - PipeInfo *infoPtr = (PipeInfo *) instanceData; - WinFile *filePtr = (WinFile*) infoPtr->readFile; - DWORD count, bytesRead = 0; - int result; - - *errorCode = 0; - /* - * Synchronize with the reader thread. - */ - - result = WaitForRead(infoPtr, (infoPtr->flags & PIPE_ASYNC) ? 0 : 1); - - /* - * If an error occurred, return immediately. - */ - - if (result == -1) { - *errorCode = errno; - return -1; - } - - if (infoPtr->readFlags & PIPE_EXTRABYTE) { - /* - * The reader thread consumed 1 byte as a side effect of waiting so we - * need to move it into the buffer. - */ - - *buf = infoPtr->extraByte; - infoPtr->readFlags &= ~PIPE_EXTRABYTE; - buf++; - bufSize--; - bytesRead = 1; - - /* - * If further read attempts would block, return what we have. - */ - - if (result == 0) { - return bytesRead; - } - } - - /* - * Attempt to read bufSize bytes. The read will return immediately if - * there is any data available. Otherwise it will block until at least one - * byte is available or an EOF occurs. - */ - - if (ReadFile(filePtr->handle, (LPVOID) buf, (DWORD) bufSize, &count, - (LPOVERLAPPED) NULL) == TRUE) { - return bytesRead + count; - } else if (bytesRead) { - /* - * Ignore errors if we have data to return. - */ + ProcInfo *procPtr = ckalloc(sizeof(ProcInfo)); - return bytesRead; - } + PipeInit(); - TclWinConvertError(GetLastError()); - if (errno == EPIPE) { - infoPtr->readFlags |= PIPE_EOF; - return 0; - } - *errorCode = errno; - return -1; + procPtr->hProcess = hProcess; + procPtr->dwProcessId = id; + Tcl_MutexLock(&pipeMutex); + procPtr->nextPtr = procList; + procList = procPtr; + Tcl_MutexUnlock(&pipeMutex); } /* *---------------------------------------------------------------------- * - * PipeOutputProc -- + * Tcl_PidObjCmd -- * - * Writes the given output on the IO channel. Returns count of how many - * characters were actually written, and an error indication. + * This function is invoked to process the "pid" Tcl command. See the + * user documentation for details on what it does. * * Results: - * A count of how many characters were written is returned and an error - * indication is returned in an output argument. + * A standard Tcl result. * * Side effects: - * Writes output on the actual channel. + * See the user documentation. * *---------------------------------------------------------------------- */ -static int -PipeOutputProc( - ClientData instanceData, /* Pipe state. */ - const char *buf, /* The data buffer. */ - int toWrite, /* How many bytes to write? */ - int *errorCode) /* Where to store error code. */ + /* ARGSUSED */ +int +Tcl_PidObjCmd( + ClientData dummy, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const *objv) /* Argument strings. */ { - PipeInfo *infoPtr = (PipeInfo *) instanceData; - WinFile *filePtr = (WinFile*) infoPtr->writeFile; - DWORD bytesWritten, timeout; - - *errorCode = 0; - timeout = (infoPtr->flags & PIPE_ASYNC) ? 0 : INFINITE; - if (WaitForSingleObject(infoPtr->writable, timeout) == WAIT_TIMEOUT) { - /* - * The writer thread is blocked waiting for a write to complete and - * the channel is in non-blocking mode. - */ - - errno = EWOULDBLOCK; - goto error; - } - - /* - * Check for a background error on the last write. - */ + Tcl_Channel chan; + const Tcl_ChannelType *chanTypePtr; + PipeInfo *pipePtr; + int i; + Tcl_Obj *resultPtr; - if (infoPtr->writeError) { - TclWinConvertError(infoPtr->writeError); - infoPtr->writeError = 0; - goto error; + if (objc > 2) { + Tcl_WrongNumArgs(interp, 1, objv, "?channelId?"); + return TCL_ERROR; } - - if (infoPtr->flags & PIPE_ASYNC) { - /* - * The pipe is non-blocking, so copy the data into the output buffer - * and restart the writer thread. - */ - - if (toWrite > infoPtr->writeBufLen) { - /* - * Reallocate the buffer to be large enough to hold the data. - */ - - if (infoPtr->writeBuf) { - ckfree(infoPtr->writeBuf); - } - infoPtr->writeBufLen = toWrite; - infoPtr->writeBuf = ckalloc(toWrite); - } - memcpy(infoPtr->writeBuf, buf, (size_t) toWrite); - infoPtr->toWrite = toWrite; - ResetEvent(infoPtr->writable); - PipeThreadSignal(&infoPtr->writeTI); - bytesWritten = toWrite; + if (objc == 1) { + Tcl_SetObjResult(interp, Tcl_NewWideIntObj((unsigned) getpid())); } else { - /* - * In the blocking case, just try to write the buffer directly. This - * avoids an unnecessary copy. - */ + chan = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), + NULL); + if (chan == (Tcl_Channel) NULL) { + return TCL_ERROR; + } + chanTypePtr = Tcl_GetChannelType(chan); + if (chanTypePtr != &pipeChannelType) { + return TCL_OK; + } - if (WriteFile(filePtr->handle, (LPVOID) buf, (DWORD) toWrite, - &bytesWritten, (LPOVERLAPPED) NULL) == FALSE) { - TclWinConvertError(GetLastError()); - goto error; + pipePtr = (PipeInfo *) Tcl_GetChannelInstanceData(chan); + resultPtr = Tcl_NewObj(); + for (i = 0; i < pipePtr->numPids; i++) { + Tcl_ListObjAppendElement(/*interp*/ NULL, resultPtr, + Tcl_NewWideIntObj((unsigned) + TclpGetPid(pipePtr->pidPtr[i]))); } + Tcl_SetObjResult(interp, resultPtr); } - return bytesWritten; - - error: - *errorCode = errno; - return -1; - + return TCL_OK; } /* *---------------------------------------------------------------------- * - * PipeEventProc -- + * WaitForRead -- * - * This function is invoked by Tcl_ServiceEvent when a file event reaches - * the front of the event queue. This function invokes Tcl_NotifyChannel - * on the pipe. + * Wait until some data is available, the pipe is at EOF or the reader + * thread is blocked waiting for data (if the channel is in non-blocking + * mode). * * 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. + * Returns 1 if pipe is readable. Returns 0 if there is no data on the + * pipe, but there is buffered data. Returns -1 if an error occurred. If + * an error occurred, the threads may not be synchronized. * * Side effects: - * Whatever the notifier callback does. + * Updates the shared state flags and may consume 1 byte of data from the + * pipe. If no error occurred, the reader thread is blocked waiting for a + * signal from the main thread. * *---------------------------------------------------------------------- */ static int -PipeEventProc( - Tcl_Event *evPtr, /* Event to service. */ - int flags) /* Flags that indicate what events to - * handle, such as TCL_FILE_EVENTS. */ +WaitForRead( + PipeInfo *infoPtr, /* Pipe state. */ + int blocking) /* Indicates whether call should be blocking + * or not. */ { - PipeEvent *pipeEvPtr = (PipeEvent *)evPtr; - PipeInfo *infoPtr; - int mask; - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + DWORD timeout, count; + HANDLE *handle = ((WinFile *) infoPtr->readFile)->handle; - if (!(flags & TCL_FILE_EVENTS)) { - return 0; - } + while (1) { + /* + * Synchronize with the reader thread. + */ - /* - * Search through the list of watched pipes for the one whose handle - * matches the event. We do this rather than simply dereferencing the - * handle in the event so that pipes can be deleted while the event is in - * the queue. - */ + timeout = blocking ? INFINITE : 0; + if (WaitForSingleObject(infoPtr->readable, timeout) == WAIT_TIMEOUT) { + /* + * The reader thread is blocked waiting for data and the channel + * is in non-blocking mode. + */ - for (infoPtr = tsdPtr->firstPipePtr; infoPtr != NULL; - infoPtr = infoPtr->nextPtr) { - if (pipeEvPtr->infoPtr == infoPtr) { - infoPtr->flags &= ~(PIPE_PENDING); - break; + errno = EWOULDBLOCK; + return -1; } - } - /* - * Remove stale events. - */ + /* + * At this point, the two threads are synchronized, so it is safe to + * access shared state. + */ - if (!infoPtr) { - return 1; - } + /* + * If the pipe has hit EOF, it is always readable. + */ - /* - * Check to see if the pipe is readable. Note that we can't tell if a pipe - * is writable, so we always report it as being writable unless we have - * detected EOF. - */ + if (infoPtr->readFlags & PIPE_EOF) { + return 1; + } - mask = 0; - if ((infoPtr->watchMask & TCL_WRITABLE) && - (WaitForSingleObject(infoPtr->writable, 0) != WAIT_TIMEOUT)) { - mask = TCL_WRITABLE; - } + /* + * Check to see if there is any data sitting in the pipe. + */ - if ((infoPtr->watchMask & TCL_READABLE) && (WaitForRead(infoPtr,0) >= 0)) { - if (infoPtr->readFlags & PIPE_EOF) { - mask = TCL_READABLE; - } else { - mask |= TCL_READABLE; + if (PeekNamedPipe(handle, (LPVOID) NULL, (DWORD) 0, + (LPDWORD) NULL, &count, (LPDWORD) NULL) != TRUE) { + TclWinConvertError(GetLastError()); + + /* + * Check to see if the peek failed because of EOF. + */ + + if (errno == EPIPE) { + infoPtr->readFlags |= PIPE_EOF; + return 1; + } + + /* + * Ignore errors if there is data in the buffer. + */ + + if (infoPtr->readFlags & PIPE_EXTRABYTE) { + return 0; + } else { + return -1; + } } - } - /* - * Inform the channel of the events. - */ + /* + * We found some data in the pipe, so it must be readable. + */ - Tcl_NotifyChannel(infoPtr->channel, infoPtr->watchMask & mask); - return 1; + if (count > 0) { + return 1; + } + + /* + * The pipe isn't readable, but there is some data sitting in the + * buffer, so return immediately. + */ + + if (infoPtr->readFlags & PIPE_EXTRABYTE) { + return 0; + } + + /* + * There wasn't any data available, so reset the thread and try again. + */ + + ResetEvent(infoPtr->readable); + TclPipeThreadSignal(&infoPtr->readTI); + } } /* *---------------------------------------------------------------------- * - * PipeWatchProc -- + * PipeReaderThread -- * - * Called by the notifier to set up to watch for events on this channel. + * This function runs in a separate thread and waits for input to become + * available on a pipe. * * Results: * None. * * Side effects: - * None. + * Signals the main thread when input become available. May cause the + * main thread to wake up by posting a message. May consume one byte from + * the pipe for each wait operation. Will cause a memory leak of ~4k, if + * forcefully terminated with TerminateThread(). * *---------------------------------------------------------------------- */ -static void -PipeWatchProc( - ClientData instanceData, /* Pipe state. */ - int mask) /* What events to watch for, OR-ed combination - * of TCL_READABLE, TCL_WRITABLE and - * TCL_EXCEPTION. */ +static DWORD WINAPI +PipeReaderThread( + LPVOID arg) { - PipeInfo **nextPtrPtr, *ptr; - PipeInfo *infoPtr = (PipeInfo *) instanceData; - int oldMask = infoPtr->watchMask; - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + TclPipeThreadInfo *pipeTI = (TclPipeThreadInfo *)arg; + PipeInfo *infoPtr = NULL; /* access info only after success init/wait */ + HANDLE handle = NULL; + DWORD count, err; + int done = 0; + + while (!done) { + /* + * Wait for the main thread to signal before attempting to wait on the + * pipe becoming readable. + */ + if (!TclPipeThreadWaitForSignal(&pipeTI)) { + /* exit */ + break; + } - /* - * Since most of the work is handled by the background threads, we just - * need to update the watchMask and then force the notifier to poll once. - */ + if (!infoPtr) { + infoPtr = (PipeInfo *)pipeTI->clientData; + handle = ((WinFile *) infoPtr->readFile)->handle; + } + + /* + * Try waiting for 0 bytes. This will block until some data is + * available on NT, but will return immediately on Win 95. So, if no + * data is available after the first read, we block until we can read + * a single byte off of the pipe. + */ + + if (ReadFile(handle, NULL, 0, &count, NULL) == FALSE || + PeekNamedPipe(handle, NULL, 0, NULL, &count, NULL) == FALSE) { + /* + * The error is a result of an EOF condition, so set the EOF bit + * before signalling the main thread. + */ + + err = GetLastError(); + if (err == ERROR_BROKEN_PIPE) { + infoPtr->readFlags |= PIPE_EOF; + done = 1; + } else if (err == ERROR_INVALID_HANDLE) { + break; + } + } else if (count == 0) { + if (ReadFile(handle, &(infoPtr->extraByte), 1, &count, NULL) + != FALSE) { + /* + * One byte was consumed as a side effect of waiting for the + * pipe to become readable. + */ + + infoPtr->readFlags |= PIPE_EXTRABYTE; + } else { + err = GetLastError(); + if (err == ERROR_BROKEN_PIPE) { + /* + * The error is a result of an EOF condition, so set the + * EOF bit before signalling the main thread. + */ + + infoPtr->readFlags |= PIPE_EOF; + done = 1; + } else if (err == ERROR_INVALID_HANDLE) { + break; + } + } + } + + /* + * Signal the main thread by signalling the readable event and then + * waking up the notifier thread. + */ + + SetEvent(infoPtr->readable); + + /* + * Alert the foreground thread. Note that we need to treat this like a + * critical section so the foreground thread does not terminate this + * thread while we are holding a mutex in the notifier code. + */ - infoPtr->watchMask = mask & infoPtr->validMask; - if (infoPtr->watchMask) { - Tcl_Time blockTime = { 0, 0 }; - if (!oldMask) { - infoPtr->nextPtr = tsdPtr->firstPipePtr; - tsdPtr->firstPipePtr = infoPtr; - } - Tcl_SetMaxBlockTime(&blockTime); - } else { - if (oldMask) { + Tcl_MutexLock(&pipeMutex); + if (infoPtr->threadId != NULL) { /* - * Remove the pipe from the list of watched pipes. + * TIP #218. When in flight ignore the event, no one will receive + * it anyway. */ - for (nextPtrPtr = &(tsdPtr->firstPipePtr), ptr = *nextPtrPtr; - ptr != NULL; - nextPtrPtr = &ptr->nextPtr, ptr = *nextPtrPtr) { - if (infoPtr == ptr) { - *nextPtrPtr = ptr->nextPtr; - break; - } - } + Tcl_ThreadAlert(infoPtr->threadId); } + Tcl_MutexUnlock(&pipeMutex); } -} - -/* - *---------------------------------------------------------------------- - * - * PipeGetHandleProc -- - * - * Called from Tcl_GetChannelHandle to retrieve OS handles from inside a - * command pipeline based channel. - * - * Results: - * Returns TCL_OK with the fd in handlePtr, or TCL_ERROR if there is no - * handle for the specified direction. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ -static int -PipeGetHandleProc( - ClientData instanceData, /* The pipe state. */ - int direction, /* TCL_READABLE or TCL_WRITABLE */ - ClientData *handlePtr) /* Where to store the handle. */ -{ - PipeInfo *infoPtr = (PipeInfo *) instanceData; - WinFile *filePtr; + /* + * If state of thread was set to stop, we can sane free info structure, + * otherwise it is shared with main thread, so main thread will own it + */ + TclPipeThreadExit(&pipeTI); - if (direction == TCL_READABLE && infoPtr->readFile) { - filePtr = (WinFile*) infoPtr->readFile; - *handlePtr = (ClientData) filePtr->handle; - return TCL_OK; - } - if (direction == TCL_WRITABLE && infoPtr->writeFile) { - filePtr = (WinFile*) infoPtr->writeFile; - *handlePtr = (ClientData) filePtr->handle; - return TCL_OK; - } - return TCL_ERROR; + return 0; } /* *---------------------------------------------------------------------- * - * Tcl_WaitPid -- + * PipeWriterThread -- * - * Emulates the waitpid system call. + * This function runs in a separate thread and writes data onto a pipe. * * Results: - * Returns 0 if the process is still alive, -1 on an error, or the pid on - * a clean close. + * Always returns 0. * * Side effects: - * Unless WNOHANG is set and the wait times out, the process information - * record will be deleted and the process handle will be closed. + * Signals the main thread when an output operation is completed. May + * cause the main thread to wake up by posting a message. * *---------------------------------------------------------------------- */ -Tcl_Pid -Tcl_WaitPid( - Tcl_Pid pid, - int *statPtr, - int options) +static DWORD WINAPI +PipeWriterThread( + LPVOID arg) { - ProcInfo *infoPtr = NULL, **prevPtrPtr; - DWORD flags; - Tcl_Pid result; - DWORD ret, exitCode; - - PipeInit(); - - /* - * If no pid is specified, do nothing. - */ - - if (pid == 0) { - *statPtr = 0; - return 0; - } - - /* - * Find the process and cut it from the process list. - */ + TclPipeThreadInfo *pipeTI = (TclPipeThreadInfo *)arg; + PipeInfo *infoPtr = NULL; /* access info only after success init/wait */ + HANDLE handle = NULL, writable = NULL; + DWORD count, toWrite; + char *buf; + int done = 0; - Tcl_MutexLock(&pipeMutex); - prevPtrPtr = &procList; - for (infoPtr = procList; infoPtr != NULL; - prevPtrPtr = &infoPtr->nextPtr, infoPtr = infoPtr->nextPtr) { - if (infoPtr->hProcess == (HANDLE) pid) { - *prevPtrPtr = infoPtr->nextPtr; + while (!done) { + /* + * Wait for the main thread to signal before attempting to write. + */ + if (!TclPipeThreadWaitForSignal(&pipeTI)) { + /* exit */ + if (writable) { + SetEvent(writable); + } break; } - } - Tcl_MutexUnlock(&pipeMutex); - - /* - * If the pid is not one of the processes we know about (we started it) - * then do nothing. - */ - if (infoPtr == NULL) { - *statPtr = 0; - return 0; - } + if (!infoPtr) { + infoPtr = (PipeInfo *)pipeTI->clientData; + handle = ((WinFile *) infoPtr->writeFile)->handle; + writable = infoPtr->writable; + } - /* - * Officially "wait" for it to finish. We either poll (WNOHANG) or wait - * for an infinite amount of time. - */ + buf = infoPtr->writeBuf; + toWrite = infoPtr->toWrite; - if (options & WNOHANG) { - flags = 0; - } else { - flags = INFINITE; - } - ret = WaitForSingleObject(infoPtr->hProcess, flags); - if (ret == WAIT_TIMEOUT) { - *statPtr = 0; - if (options & WNOHANG) { - /* - * Re-insert this infoPtr back on the list. - */ + /* + * Loop until all of the bytes are written or an error occurs. + */ - Tcl_MutexLock(&pipeMutex); - infoPtr->nextPtr = procList; - procList = infoPtr; - Tcl_MutexUnlock(&pipeMutex); - return 0; - } else { - result = 0; + while (toWrite > 0) { + if (WriteFile(handle, buf, toWrite, &count, NULL) == FALSE) { + infoPtr->writeError = GetLastError(); + done = 1; + break; + } else { + toWrite -= count; + buf += count; + } } - } else if (ret == WAIT_OBJECT_0) { - GetExitCodeProcess(infoPtr->hProcess, &exitCode); /* - * Does the exit code look like one of the exception codes? + * Signal the main thread by signalling the writable event and then + * waking up the notifier thread. */ - switch (exitCode) { - case EXCEPTION_FLT_DENORMAL_OPERAND: - case EXCEPTION_FLT_DIVIDE_BY_ZERO: - case EXCEPTION_FLT_INEXACT_RESULT: - case EXCEPTION_FLT_INVALID_OPERATION: - case EXCEPTION_FLT_OVERFLOW: - case EXCEPTION_FLT_STACK_CHECK: - case EXCEPTION_FLT_UNDERFLOW: - case EXCEPTION_INT_DIVIDE_BY_ZERO: - case EXCEPTION_INT_OVERFLOW: - *statPtr = 0xC0000000 | SIGFPE; - break; - - case EXCEPTION_PRIV_INSTRUCTION: - case EXCEPTION_ILLEGAL_INSTRUCTION: - *statPtr = 0xC0000000 | SIGILL; - break; - - case EXCEPTION_ACCESS_VIOLATION: - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - case EXCEPTION_STACK_OVERFLOW: - case EXCEPTION_NONCONTINUABLE_EXCEPTION: - case EXCEPTION_INVALID_DISPOSITION: - case EXCEPTION_GUARD_PAGE: - case EXCEPTION_INVALID_HANDLE: - *statPtr = 0xC0000000 | SIGSEGV; - break; - - case EXCEPTION_DATATYPE_MISALIGNMENT: - *statPtr = 0xC0000000 | SIGBUS; - break; - - case EXCEPTION_BREAKPOINT: - case EXCEPTION_SINGLE_STEP: - *statPtr = 0xC0000000 | SIGTRAP; - break; + SetEvent(writable); - case CONTROL_C_EXIT: - *statPtr = 0xC0000000 | SIGINT; - break; + /* + * Alert the foreground thread. Note that we need to treat this like a + * critical section so the foreground thread does not terminate this + * thread while we are holding a mutex in the notifier code. + */ - default: + Tcl_MutexLock(&pipeMutex); + if (infoPtr->threadId != NULL) { /* - * Non-exceptional, normal, exit code. Note that the exit code is - * truncated to a signed short range [-32768,32768) whether it - * fits into this range or not. - * - * BUG: Even though the exit code is a DWORD, it is understood by - * convention to be a signed integer, yet there isn't enough room - * to fit this into the POSIX style waitstatus mask without - * truncating it. + * TIP #218. When in flight ignore the event, no one will receive + * it anyway. */ - *statPtr = exitCode; - break; + Tcl_ThreadAlert(infoPtr->threadId); } - result = pid; - } else { - errno = ECHILD; - *statPtr = 0xC0000000 | ECHILD; - result = (Tcl_Pid) -1; + Tcl_MutexUnlock(&pipeMutex); } /* - * Officially close the process handle. + * If state of thread was set to stop, we can sane free info structure, + * otherwise it is shared with main thread, so main thread will own it. */ + TclPipeThreadExit(&pipeTI); - CloseHandle(infoPtr->hProcess); - ckfree(infoPtr); - - return result; + return 0; } /* *---------------------------------------------------------------------- * - * TclWinAddProcess -- + * PipeThreadActionProc -- * - * Add a process to the process list so that we can use Tcl_WaitPid on - * the process. + * Insert or remove any thread local refs to this channel. * * Results: - * None + * None. * * Side effects: - * Adds the specified process handle to the process list so Tcl_WaitPid - * knows about it. + * Changes thread local list of valid channels. * *---------------------------------------------------------------------- */ -void -TclWinAddProcess( - void *hProcess, /* Handle to process */ - unsigned long id) /* Global process identifier */ +static void +PipeThreadActionProc( + ClientData instanceData, + int action) { - ProcInfo *procPtr = ckalloc(sizeof(ProcInfo)); + PipeInfo *infoPtr = (PipeInfo *) instanceData; - PipeInit(); + /* + * We do not access firstPipePtr in the thread structures. This is not for + * all pipes managed by the thread, but only those we are watching. + * Removal of the filevent handlers before transfer thus takes care of + * this structure. + */ - procPtr->hProcess = hProcess; - procPtr->dwProcessId = id; Tcl_MutexLock(&pipeMutex); - procPtr->nextPtr = procList; - procList = procPtr; - Tcl_MutexUnlock(&pipeMutex); -} - -/* - *---------------------------------------------------------------------- - * - * Tcl_PidObjCmd -- - * - * This function is invoked to process the "pid" Tcl command. See the - * user documentation for details on what it does. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * See the user documentation. - * - *---------------------------------------------------------------------- - */ - - /* ARGSUSED */ -int -Tcl_PidObjCmd( - ClientData dummy, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const *objv) /* Argument strings. */ -{ - Tcl_Channel chan; - const Tcl_ChannelType *chanTypePtr; - PipeInfo *pipePtr; - int i; - Tcl_Obj *resultPtr; - - if (objc > 2) { - Tcl_WrongNumArgs(interp, 1, objv, "?channelId?"); - return TCL_ERROR; - } - if (objc == 1) { - Tcl_SetObjResult(interp, Tcl_NewWideIntObj((unsigned) getpid())); - } else { - chan = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), - NULL); - if (chan == (Tcl_Channel) NULL) { - return TCL_ERROR; - } - chanTypePtr = Tcl_GetChannelType(chan); - if (chanTypePtr != &pipeChannelType) { - return TCL_OK; - } + if (action == TCL_CHANNEL_THREAD_INSERT) { + /* + * We can't copy the thread information from the channel when the + * channel is created. At this time the channel back pointer has not + * been set yet. However in that case the threadId has already been + * set by TclpCreateCommandChannel itself, so the structure is still + * good. + */ - pipePtr = (PipeInfo *) Tcl_GetChannelInstanceData(chan); - resultPtr = Tcl_NewObj(); - for (i = 0; i < pipePtr->numPids; i++) { - Tcl_ListObjAppendElement(/*interp*/ NULL, resultPtr, - Tcl_NewWideIntObj((unsigned) - TclpGetPid(pipePtr->pidPtr[i]))); + PipeInit(); + if (infoPtr->channel != NULL) { + infoPtr->threadId = Tcl_GetChannelThread(infoPtr->channel); } - Tcl_SetObjResult(interp, resultPtr); + } else { + infoPtr->threadId = NULL; } - return TCL_OK; + Tcl_MutexUnlock(&pipeMutex); } /* *---------------------------------------------------------------------- * - * WaitForRead -- + * TclpOpenTemporaryFile -- * - * Wait until some data is available, the pipe is at EOF or the reader - * thread is blocked waiting for data (if the channel is in non-blocking - * mode). + * Creates a temporary file, possibly based on the supplied bits and + * pieces of template supplied in the first three arguments. If the + * fourth argument is non-NULL, it contains a Tcl_Obj to store the name + * of the temporary file in (and it is caller's responsibility to clean + * up). If the fourth argument is NULL, try to arrange for the temporary + * file to go away once it is no longer needed. * * Results: - * Returns 1 if pipe is readable. Returns 0 if there is no data on the - * pipe, but there is buffered data. Returns -1 if an error occurred. If - * an error occurred, the threads may not be synchronized. - * - * Side effects: - * Updates the shared state flags and may consume 1 byte of data from the - * pipe. If no error occurred, the reader thread is blocked waiting for a - * signal from the main thread. + * A read-write Tcl Channel open on the file. * *---------------------------------------------------------------------- */ -static int -WaitForRead( - PipeInfo *infoPtr, /* Pipe state. */ - int blocking) /* Indicates whether call should be blocking - * or not. */ +Tcl_Channel +TclpOpenTemporaryFile( + Tcl_Obj *dirObj, + Tcl_Obj *basenameObj, + Tcl_Obj *extensionObj, + Tcl_Obj *resultingNameObj) { - DWORD timeout, count; - HANDLE *handle = ((WinFile *) infoPtr->readFile)->handle; - - while (1) { - /* - * Synchronize with the reader thread. - */ - - timeout = blocking ? INFINITE : 0; - if (WaitForSingleObject(infoPtr->readable, timeout) == WAIT_TIMEOUT) { - /* - * The reader thread is blocked waiting for data and the channel - * is in non-blocking mode. - */ - - errno = EWOULDBLOCK; - return -1; - } - - /* - * At this point, the two threads are synchronized, so it is safe to - * access shared state. - */ - - /* - * If the pipe has hit EOF, it is always readable. - */ - - if (infoPtr->readFlags & PIPE_EOF) { - return 1; - } + TCHAR name[MAX_PATH]; + char *namePtr; + HANDLE handle; + DWORD flags = FILE_ATTRIBUTE_TEMPORARY; + int length, counter, counter2; + Tcl_DString buf; - /* - * Check to see if there is any data sitting in the pipe. - */ + if (!resultingNameObj) { + flags |= FILE_FLAG_DELETE_ON_CLOSE; + } - if (PeekNamedPipe(handle, (LPVOID) NULL, (DWORD) 0, - (LPDWORD) NULL, &count, (LPDWORD) NULL) != TRUE) { - TclWinConvertError(GetLastError()); + namePtr = (char *) name; + length = GetTempPath(MAX_PATH, name); + if (length == 0) { + goto gotError; + } + namePtr += length * sizeof(TCHAR); + if (basenameObj) { + const char *string = Tcl_GetString(basenameObj); - /* - * Check to see if the peek failed because of EOF. - */ + Tcl_WinUtfToTChar(string, basenameObj->length, &buf); + memcpy(namePtr, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf)); + namePtr += Tcl_DStringLength(&buf); + Tcl_DStringFree(&buf); + } else { + const TCHAR *baseStr = TEXT("TCL"); + int length = 3 * sizeof(TCHAR); - if (errno == EPIPE) { - infoPtr->readFlags |= PIPE_EOF; - return 1; - } + memcpy(namePtr, baseStr, length); + namePtr += length; + } + counter = TclpGetClicks() % 65533; + counter2 = 1024; /* Only try this many times! Prevents + * an infinite loop. */ - /* - * Ignore errors if there is data in the buffer. - */ + do { + char number[TCL_INTEGER_SPACE + 4]; - if (infoPtr->readFlags & PIPE_EXTRABYTE) { - return 0; - } else { - return -1; - } - } + sprintf(number, "%d.TMP", counter); + counter = (unsigned short) (counter + 1); + Tcl_WinUtfToTChar(number, strlen(number), &buf); + Tcl_DStringSetLength(&buf, Tcl_DStringLength(&buf) + 1); + memcpy(namePtr, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf) + 1); + Tcl_DStringFree(&buf); - /* - * We found some data in the pipe, so it must be readable. - */ + handle = CreateFile(name, + GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, flags, NULL); + } while (handle == INVALID_HANDLE_VALUE + && --counter2 > 0 + && GetLastError() == ERROR_FILE_EXISTS); + if (handle == INVALID_HANDLE_VALUE) { + goto gotError; + } - if (count > 0) { - return 1; - } + if (resultingNameObj) { + Tcl_Obj *tmpObj = TclpNativeToNormalized(name); - /* - * The pipe isn't readable, but there is some data sitting in the - * buffer, so return immediately. - */ + Tcl_AppendObjToObj(resultingNameObj, tmpObj); + TclDecrRefCount(tmpObj); + } - if (infoPtr->readFlags & PIPE_EXTRABYTE) { - return 0; - } + return Tcl_MakeFileChannel((ClientData) handle, + TCL_READABLE|TCL_WRITABLE); - /* - * There wasn't any data available, so reset the thread and try again. - */ + gotError: + TclWinConvertError(GetLastError()); + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * TclPipeThreadCreateTI -- + * + * Creates a thread info structure, can be owned by worker. + * + * Results: + * Pointer to created TI structure. + * + *---------------------------------------------------------------------- + */ - ResetEvent(infoPtr->readable); - PipeThreadSignal(&infoPtr->readTI); - } +TclPipeThreadInfo * +TclPipeThreadCreateTI( + TclPipeThreadInfo **pipeTIPtr, + ClientData clientData) +{ + TclPipeThreadInfo *pipeTI; +#ifndef _PTI_USE_CKALLOC + pipeTI = malloc(sizeof(TclPipeThreadInfo)); +#else + pipeTI = ckalloc(sizeof(TclPipeThreadInfo)); +#endif + pipeTI->evControl = CreateEvent(NULL, FALSE, FALSE, NULL); + pipeTI->state = PTI_STATE_IDLE; + pipeTI->clientData = clientData; + return (*pipeTIPtr = pipeTI); } /* *---------------------------------------------------------------------- * - * PipeReaderThread -- + * TclPipeThreadWaitForSignal -- * - * This function runs in a separate thread and waits for input to become - * available on a pipe. + * Wait for work/stop signals inside pipe worker. * * Results: - * None. + * 1 if signaled to work, 0 if signaled to stop. * * Side effects: - * Signals the main thread when input become available. May cause the - * main thread to wake up by posting a message. May consume one byte from - * the pipe for each wait operation. Will cause a memory leak of ~4k, if - * forcefully terminated with TerminateThread(). + * If this function returns 0, TI-structure pointer given via pipeTIPtr + * may be NULL, so not accessible (can be owned by main thread). * *---------------------------------------------------------------------- */ -static DWORD WINAPI -PipeReaderThread( - LPVOID arg) +int +TclPipeThreadWaitForSignal( + TclPipeThreadInfo **pipeTIPtr) { - PipeThreadInfo *pipeTI = (PipeThreadInfo *)arg; - PipeInfo *infoPtr = NULL; /* access info only after success init/wait */ - HANDLE handle = NULL; - DWORD count, err; - int done = 0; - - while (!done) { - /* - * Wait for the main thread to signal before attempting to wait on the - * pipe becoming readable. - */ - if (!PipeThreadWaitForSignal(&pipeTI)) { - /* exit */ - break; - } - - if (!infoPtr) { - infoPtr = (PipeInfo *)pipeTI->clientData; - handle = ((WinFile *) infoPtr->readFile)->handle; - } - - /* - * Try waiting for 0 bytes. This will block until some data is - * available on NT, but will return immediately on Win 95. So, if no - * data is available after the first read, we block until we can read - * a single byte off of the pipe. - */ - - if (ReadFile(handle, NULL, 0, &count, NULL) == FALSE || - PeekNamedPipe(handle, NULL, 0, NULL, &count, NULL) == FALSE) { - /* - * The error is a result of an EOF condition, so set the EOF bit - * before signalling the main thread. - */ - - err = GetLastError(); - if (err == ERROR_BROKEN_PIPE) { - infoPtr->readFlags |= PIPE_EOF; - done = 1; - } else if (err == ERROR_INVALID_HANDLE) { - break; - } - } else if (count == 0) { - if (ReadFile(handle, &(infoPtr->extraByte), 1, &count, NULL) - != FALSE) { - /* - * One byte was consumed as a side effect of waiting for the - * pipe to become readable. - */ - - infoPtr->readFlags |= PIPE_EXTRABYTE; - } else { - err = GetLastError(); - if (err == ERROR_BROKEN_PIPE) { - /* - * The error is a result of an EOF condition, so set the - * EOF bit before signalling the main thread. - */ + TclPipeThreadInfo *pipeTI = *pipeTIPtr; + LONG state; + DWORD waitResult; - infoPtr->readFlags |= PIPE_EOF; - done = 1; - } else if (err == ERROR_INVALID_HANDLE) { - break; - } - } - } + if (!pipeTI) { + return 0; + } + /* + * Wait for the main thread to signal before attempting to do the work. + */ - /* - * Signal the main thread by signalling the readable event and then - * waking up the notifier thread. - */ + /* reset work state of thread (idle/waiting) */ + if ((state = InterlockedCompareExchange(&pipeTI->state, + PTI_STATE_IDLE, PTI_STATE_WORK)) & (PTI_STATE_STOP|PTI_STATE_END)) { + /* end of work, check the owner of structure */ + goto end; + } + /* entering wait */ + waitResult = WaitForSingleObject(pipeTI->evControl, INFINITE); - SetEvent(infoPtr->readable); + if (waitResult != WAIT_OBJECT_0) { /* - * Alert the foreground thread. Note that we need to treat this like a - * critical section so the foreground thread does not terminate this - * thread while we are holding a mutex in the notifier code. + * The control event was not signaled, so end of work (unexpected + * behaviour, main thread can be dead?). */ + goto end; + } - Tcl_MutexLock(&pipeMutex); - if (infoPtr->threadId != NULL) { - /* - * TIP #218. When in flight ignore the event, no one will receive - * it anyway. - */ - - Tcl_ThreadAlert(infoPtr->threadId); - } - Tcl_MutexUnlock(&pipeMutex); + /* try to set work state of thread */ + if ((state = InterlockedCompareExchange(&pipeTI->state, + PTI_STATE_WORK, PTI_STATE_IDLE)) & (PTI_STATE_STOP|PTI_STATE_END)) { + /* end of work */ + goto end; } - /* - * If state of thread was set to stop, we can sane free info structure, - * otherwise it is shared with main thread, so main thread will own it - */ - PipeThreadExit(&pipeTI); + /* signaled to work */ + return 1; +end: + /* end of work, check the owner of the TI structure */ + if (state != PTI_STATE_STOP) { + *pipeTIPtr = NULL; + } return 0; } /* *---------------------------------------------------------------------- * - * PipeWriterThread -- + * TclPipeThreadStopSignal -- * - * This function runs in a separate thread and writes data onto a pipe. + * Send stop signal to the pipe worker (without waiting). * - * Results: - * Always returns 0. + * After calling of this function, TI-structure pointer given via pipeTIPtr + * may be NULL. * - * Side effects: - * Signals the main thread when an output operation is completed. May - * cause the main thread to wake up by posting a message. + * Results: + * 1 if signaled (or pipe-thread is down), 0 if pipe thread still working. * *---------------------------------------------------------------------- */ -static DWORD WINAPI -PipeWriterThread( - LPVOID arg) +int +TclPipeThreadStopSignal( + TclPipeThreadInfo **pipeTIPtr) { - PipeThreadInfo *pipeTI = (PipeThreadInfo *)arg; - PipeInfo *infoPtr = NULL; /* access info only after success init/wait */ - HANDLE handle = NULL, writable = NULL; - DWORD count, toWrite; - char *buf; - int done = 0; - - while (!done) { - /* - * Wait for the main thread to signal before attempting to write. - */ - if (!PipeThreadWaitForSignal(&pipeTI)) { - /* exit */ - if (writable) { - SetEvent(writable); - } - break; - } - - if (!infoPtr) { - infoPtr = (PipeInfo *)pipeTI->clientData; - handle = ((WinFile *) infoPtr->writeFile)->handle; - writable = infoPtr->writable; - } - - buf = infoPtr->writeBuf; - toWrite = infoPtr->toWrite; + TclPipeThreadInfo *pipeTI = *pipeTIPtr; + HANDLE evControl; + int state; - /* - * Loop until all of the bytes are written or an error occurs. - */ + if (!pipeTI) { + return 1; + } + evControl = pipeTI->evControl; + switch ( + (state = InterlockedCompareExchange(&pipeTI->state, + PTI_STATE_STOP, PTI_STATE_IDLE)) + ) { - while (toWrite > 0) { - if (WriteFile(handle, buf, toWrite, &count, NULL) == FALSE) { - infoPtr->writeError = GetLastError(); - done = 1; - break; - } else { - toWrite -= count; - buf += count; - } - } + case PTI_STATE_IDLE: - /* - * Signal the main thread by signalling the writable event and then - * waking up the notifier thread. - */ + /* Thread was idle/waiting, notify it goes teardown */ + SetEvent(evControl); - SetEvent(writable); + *pipeTIPtr = NULL; - /* - * Alert the foreground thread. Note that we need to treat this like a - * critical section so the foreground thread does not terminate this - * thread while we are holding a mutex in the notifier code. - */ + case PTI_STATE_DOWN: + + return 1; - Tcl_MutexLock(&pipeMutex); - if (infoPtr->threadId != NULL) { + default: /* - * TIP #218. When in flight ignore the event, no one will receive - * it anyway. + * Thread works currently, we should try to end it, own the TI structure + * (because of possible sharing the joint structures with thread) */ - - Tcl_ThreadAlert(infoPtr->threadId); - } - Tcl_MutexUnlock(&pipeMutex); + InterlockedExchange(&pipeTI->state, PTI_STATE_END); + break; } - /* - * If state of thread was set to stop, we can sane free info structure, - * otherwise it is shared with main thread, so main thread will own it. - */ - PipeThreadExit(&pipeTI); - return 0; } /* *---------------------------------------------------------------------- * - * PipeThreadActionProc -- + * TclPipeThreadStop -- + * + * Send stop signal to the pipe worker and wait for thread completion. * - * Insert or remove any thread local refs to this channel. + * May be combined with TclPipeThreadStopSignal. + * + * After calling of this function, TI-structure pointer given via pipeTIPtr + * is not accessible (owned by pipe worker or released here). * * Results: * None. * * Side effects: - * Changes thread local list of valid channels. + * Can terminate pipe worker (and / or stop its synchronous operations). * *---------------------------------------------------------------------- */ -static void -PipeThreadActionProc( - ClientData instanceData, - int action) +void +TclPipeThreadStop( + TclPipeThreadInfo **pipeTIPtr, + HANDLE hThread) { - PipeInfo *infoPtr = (PipeInfo *) instanceData; + TclPipeThreadInfo *pipeTI = *pipeTIPtr; + HANDLE evControl; + int state; + if (!pipeTI) { + return; + } + pipeTI = *pipeTIPtr; + evControl = pipeTI->evControl; /* - * We do not access firstPipePtr in the thread structures. This is not for - * all pipes managed by the thread, but only those we are watching. - * Removal of the filevent handlers before transfer thus takes care of - * this structure. + * Try to sane stop the pipe worker, corresponding its current state */ + switch ( + (state = InterlockedCompareExchange(&pipeTI->state, + PTI_STATE_STOP, PTI_STATE_IDLE)) + ) { - Tcl_MutexLock(&pipeMutex); - if (action == TCL_CHANNEL_THREAD_INSERT) { + case PTI_STATE_IDLE: + + /* Thread was idle/waiting, notify it goes teardown */ + SetEvent(evControl); + + /* we don't need to wait for it at all, thread frees himself (owns the TI structure) */ + pipeTI = NULL; + break; + + case PTI_STATE_STOP: + /* already stopped, thread frees himself (owns the TI structure) */ + pipeTI = NULL; + break; + case PTI_STATE_DOWN: + /* Thread already down (?), do nothing */ + + /* we don't need to wait for it, but we should free pipeTI */ + hThread = NULL; + break; + + /* case PTI_STATE_WORK: */ + default: + /* + * Thread works currently, we should try to end it, own the TI structure + * (because of possible sharing the joint structures with thread) + */ + InterlockedExchange(&pipeTI->state, PTI_STATE_END); + break; + } + + if (pipeTI && hThread) { + DWORD exitCode; + /* - * We can't copy the thread information from the channel when the - * channel is created. At this time the channel back pointer has not - * been set yet. However in that case the threadId has already been - * set by TclpCreateCommandChannel itself, so the structure is still - * good. + * The thread may already have closed on its own. Check its exit + * code. */ - PipeInit(); - if (infoPtr->channel != NULL) { - infoPtr->threadId = Tcl_GetChannelThread(infoPtr->channel); + GetExitCodeThread(hThread, &exitCode); + + if (exitCode == STILL_ACTIVE) { + /* + * Set the stop event so that if the pipe thread is blocked + * somewhere, it may hereafter sane exit cleanly. + */ + + SetEvent(evControl); + + /* + * Cancel all sync-IO of this thread (may be blocked there). + */ + if (tclWinProcs->cancelSynchronousIo) { + tclWinProcs->cancelSynchronousIo(hThread); + } + + /* + * Wait at most 20 milliseconds for the reader thread to + * close (regarding TIP#398-fast-exit). + */ + + /* if we want TIP#398-fast-exit. */ + if (WaitForSingleObject(hThread, + TclInExit() ? 0 : 20) == WAIT_TIMEOUT) { + + /* + * The thread must be blocked waiting for the pipe to + * become readable in ReadFile(). There isn't a clean way + * to exit the thread from this condition. We should + * terminate the child process instead to get the reader + * thread to fall out of ReadFile with a FALSE. (below) is + * not the correct way to do this, but will stay here + * until a better solution is found. + * + * Note that we need to guard against terminating the + * thread while it is in the middle of Tcl_ThreadAlert + * because it won't be able to release the notifier lock. + * + * Also note that terminating threads during their initialization or teardown phase + * may result in ntdll.dll's LoaderLock to remain locked indefinitely. + * This causes ntdll.dll's LdrpInitializeThread() to deadlock trying to acquire LoaderLock. + * LdrpInitializeThread() is executed within new threads to perform + * initialization and to execute DllMain() of all loaded dlls. + * As a result, all new threads are deadlocked in their initialization phase and never execute, + * even though CreateThread() reports successful thread creation. + * This results in a very weird process-wide behavior, which is extremely hard to debug. + * + * THREADS SHOULD NEVER BE TERMINATED. Period. + * + * But for now, check if thread is exiting, and if so, let it die peacefully. + */ + + if ( pipeTI->state != PTI_STATE_DOWN + && WaitForSingleObject(hThread, + TclInExit() ? 0 : 5000) != WAIT_OBJECT_0 + ) { + Tcl_MutexLock(&pipeMutex); + /* BUG: this leaks memory */ + if (!TerminateThread(hThread, 0)) { + /* terminate fails, just give thread a chance to exit */ + if (InterlockedExchange(&pipeTI->state, + PTI_STATE_STOP) != PTI_STATE_DOWN) { + pipeTI = NULL; + } + }; + Tcl_MutexUnlock(&pipeMutex); + } + } } - } else { - infoPtr->threadId = NULL; } - Tcl_MutexUnlock(&pipeMutex); + + *pipeTIPtr = NULL; + if (pipeTI) { + CloseHandle(pipeTI->evControl); + #ifndef _PTI_USE_CKALLOC + free(pipeTI); + #else + ckfree(pipeTI); + #endif + } } /* *---------------------------------------------------------------------- * - * TclpOpenTemporaryFile -- + * TclPipeThreadExit -- * - * Creates a temporary file, possibly based on the supplied bits and - * pieces of template supplied in the first three arguments. If the - * fourth argument is non-NULL, it contains a Tcl_Obj to store the name - * of the temporary file in (and it is caller's responsibility to clean - * up). If the fourth argument is NULL, try to arrange for the temporary - * file to go away once it is no longer needed. + * Clean-up for the pipe thread (removes owned TI-structure in worker). + * + * Should be executed on worker exit, to inform the main thread or + * free TI-structure (if owned). + * + * After calling of this function, TI-structure pointer given via pipeTIPtr + * is not accessible (owned by main thread or released here). * * Results: - * A read-write Tcl Channel open on the file. + * None. * *---------------------------------------------------------------------- */ -Tcl_Channel -TclpOpenTemporaryFile( - Tcl_Obj *dirObj, - Tcl_Obj *basenameObj, - Tcl_Obj *extensionObj, - Tcl_Obj *resultingNameObj) +void +TclPipeThreadExit( + TclPipeThreadInfo **pipeTIPtr) { - TCHAR name[MAX_PATH]; - char *namePtr; - HANDLE handle; - DWORD flags = FILE_ATTRIBUTE_TEMPORARY; - int length, counter, counter2; - Tcl_DString buf; - - if (!resultingNameObj) { - flags |= FILE_FLAG_DELETE_ON_CLOSE; - } - - namePtr = (char *) name; - length = GetTempPath(MAX_PATH, name); - if (length == 0) { - goto gotError; - } - namePtr += length * sizeof(TCHAR); - if (basenameObj) { - const char *string = Tcl_GetString(basenameObj); - - Tcl_WinUtfToTChar(string, basenameObj->length, &buf); - memcpy(namePtr, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf)); - namePtr += Tcl_DStringLength(&buf); - Tcl_DStringFree(&buf); - } else { - const TCHAR *baseStr = TEXT("TCL"); - int length = 3 * sizeof(TCHAR); - - memcpy(namePtr, baseStr, length); - namePtr += length; - } - counter = TclpGetClicks() % 65533; - counter2 = 1024; /* Only try this many times! Prevents - * an infinite loop. */ - - do { - char number[TCL_INTEGER_SPACE + 4]; - - sprintf(number, "%d.TMP", counter); - counter = (unsigned short) (counter + 1); - Tcl_WinUtfToTChar(number, strlen(number), &buf); - Tcl_DStringSetLength(&buf, Tcl_DStringLength(&buf) + 1); - memcpy(namePtr, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf) + 1); - Tcl_DStringFree(&buf); - - handle = CreateFile(name, - GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, flags, NULL); - } while (handle == INVALID_HANDLE_VALUE - && --counter2 > 0 - && GetLastError() == ERROR_FILE_EXISTS); - if (handle == INVALID_HANDLE_VALUE) { - goto gotError; + LONG state; + TclPipeThreadInfo *pipeTI = *pipeTIPtr; + /* + * If state of thread was set to stop (exactly), we can sane free its info + * structure, otherwise it is shared with main thread, so main thread will + * own it. + */ + if (!pipeTI) { + return; } - - if (resultingNameObj) { - Tcl_Obj *tmpObj = TclpNativeToNormalized(name); - - Tcl_AppendObjToObj(resultingNameObj, tmpObj); - TclDecrRefCount(tmpObj); + *pipeTIPtr = NULL; + if ((state = InterlockedExchange(&pipeTI->state, + PTI_STATE_DOWN)) == PTI_STATE_STOP) { + CloseHandle(pipeTI->evControl); + #ifndef _PTI_USE_CKALLOC + free(pipeTI); + #else + ckfree(pipeTI); + /* be sure all subsystems used are finalized */ + Tcl_FinalizeThread(); + #endif } - - return Tcl_MakeFileChannel((ClientData) handle, - TCL_READABLE|TCL_WRITABLE); - - gotError: - TclWinConvertError(GetLastError()); - return NULL; } /* -- cgit v0.12 From 9b95c002189e5e5c0a09edb48f595afc8e236dab Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 11 Apr 2017 18:09:38 +0000 Subject: added wake-up event to prevent possible dead-locks by some waiting thread (e. g. for writable events) --- win/tclWinInt.h | 6 ++++-- win/tclWinPipe.c | 35 +++++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/win/tclWinInt.h b/win/tclWinInt.h index 8ce4152..67b00a8 100644 --- a/win/tclWinInt.h +++ b/win/tclWinInt.h @@ -110,6 +110,7 @@ typedef struct TclPipeThreadInfo { * used as signal to stop (state set to -1) */ volatile LONG state; /* Indicates current state of the thread */ ClientData clientData; /* Referenced data of the main thread */ + HANDLE evWakeUp; /* Optional wake-up event worker set by shutdown */ } TclPipeThreadInfo; @@ -134,7 +135,8 @@ typedef struct TclPipeThreadInfo { MODULE_SCOPE -TclPipeThreadInfo * TclPipeThreadCreateTI(TclPipeThreadInfo **pipeTIPtr, ClientData clientData); +TclPipeThreadInfo * TclPipeThreadCreateTI(TclPipeThreadInfo **pipeTIPtr, + ClientData clientData, HANDLE wakeEvent); MODULE_SCOPE int TclPipeThreadWaitForSignal(TclPipeThreadInfo **pipeTIPtr); static inline void @@ -147,7 +149,7 @@ TclPipeThreadSignal( } }; -MODULE_SCOPE int TclPipeThreadStopSignal(TclPipeThreadInfo **pipeTIPtr); +MODULE_SCOPE int TclPipeThreadStopSignal(TclPipeThreadInfo **pipeTIPtr, HANDLE wakeEvent); MODULE_SCOPE void TclPipeThreadStop(TclPipeThreadInfo **pipeTIPtr, HANDLE hThread); MODULE_SCOPE void TclPipeThreadExit(TclPipeThreadInfo **pipeTIPtr); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 4b4e68d..528f950 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1564,7 +1564,6 @@ TclpCreateCommandChannel( Tcl_Pid *pidPtr) /* An array of process identifiers. */ { char channelName[16 + TCL_INTEGER_SPACE]; - DWORD id; PipeInfo *infoPtr = ckalloc(sizeof(PipeInfo)); PipeInit(); @@ -1593,7 +1592,7 @@ TclpCreateCommandChannel( infoPtr->readable = CreateEvent(NULL, TRUE, TRUE, NULL); infoPtr->readThread = CreateThread(NULL, 256, PipeReaderThread, - TclPipeThreadCreateTI(&infoPtr->readTI, infoPtr), 0, &id); + TclPipeThreadCreateTI(&infoPtr->readTI, infoPtr, NULL), 0, NULL); SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_READABLE; } else { @@ -1607,7 +1606,8 @@ TclpCreateCommandChannel( infoPtr->writable = CreateEvent(NULL, TRUE, TRUE, NULL); infoPtr->writeThread = CreateThread(NULL, 256, PipeWriterThread, - TclPipeThreadCreateTI(&infoPtr->writeTI, infoPtr), 0, &id); + TclPipeThreadCreateTI(&infoPtr->writeTI, infoPtr, infoPtr->writable), + 0, NULL); SetThreadPriority(infoPtr->writeThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_WRITABLE; } else { @@ -1835,7 +1835,7 @@ PipeClose2Proc( if ((pipePtr->flags & PIPE_ASYNC) && TclInExit()) { /* give it a chance to leave honorably */ - TclPipeThreadStopSignal(&pipePtr->writeTI); + TclPipeThreadStopSignal(&pipePtr->writeTI, pipePtr->writable); if (WaitForSingleObject(pipePtr->writable, 20) == WAIT_TIMEOUT) { return EWOULDBLOCK; @@ -2840,7 +2840,7 @@ PipeWriterThread( { TclPipeThreadInfo *pipeTI = (TclPipeThreadInfo *)arg; PipeInfo *infoPtr = NULL; /* access info only after success init/wait */ - HANDLE handle = NULL, writable = NULL; + HANDLE handle = NULL; DWORD count, toWrite; char *buf; int done = 0; @@ -2851,16 +2851,12 @@ PipeWriterThread( */ if (!TclPipeThreadWaitForSignal(&pipeTI)) { /* exit */ - if (writable) { - SetEvent(writable); - } break; } if (!infoPtr) { infoPtr = (PipeInfo *)pipeTI->clientData; handle = ((WinFile *) infoPtr->writeFile)->handle; - writable = infoPtr->writable; } buf = infoPtr->writeBuf; @@ -2886,7 +2882,7 @@ PipeWriterThread( * waking up the notifier thread. */ - SetEvent(writable); + SetEvent(infoPtr->writable); /* * Alert the foreground thread. Note that we need to treat this like a @@ -3075,7 +3071,8 @@ TclpOpenTemporaryFile( TclPipeThreadInfo * TclPipeThreadCreateTI( TclPipeThreadInfo **pipeTIPtr, - ClientData clientData) + ClientData clientData, + HANDLE wakeEvent) { TclPipeThreadInfo *pipeTI; #ifndef _PTI_USE_CKALLOC @@ -3086,6 +3083,7 @@ TclPipeThreadCreateTI( pipeTI->evControl = CreateEvent(NULL, FALSE, FALSE, NULL); pipeTI->state = PTI_STATE_IDLE; pipeTI->clientData = clientData; + pipeTI->evWakeUp = wakeEvent; return (*pipeTIPtr = pipeTI); } @@ -3113,10 +3111,13 @@ TclPipeThreadWaitForSignal( TclPipeThreadInfo *pipeTI = *pipeTIPtr; LONG state; DWORD waitResult; + HANDLE wakeEvent; if (!pipeTI) { return 0; } + + wakeEvent = pipeTI->evWakeUp; /* * Wait for the main thread to signal before attempting to do the work. */ @@ -3153,6 +3154,11 @@ end: /* end of work, check the owner of the TI structure */ if (state != PTI_STATE_STOP) { *pipeTIPtr = NULL; + } else { + pipeTI->evWakeUp = NULL; + } + if (wakeEvent) { + SetEvent(wakeEvent); } return 0; } @@ -3175,7 +3181,7 @@ end: int TclPipeThreadStopSignal( - TclPipeThreadInfo **pipeTIPtr) + TclPipeThreadInfo **pipeTIPtr, HANDLE wakeEvent) { TclPipeThreadInfo *pipeTI = *pipeTIPtr; HANDLE evControl; @@ -3185,6 +3191,7 @@ TclPipeThreadStopSignal( return 1; } evControl = pipeTI->evControl; + pipeTI->evWakeUp = wakeEvent; switch ( (state = InterlockedCompareExchange(&pipeTI->state, PTI_STATE_STOP, PTI_STATE_IDLE)) @@ -3248,6 +3255,7 @@ TclPipeThreadStop( } pipeTI = *pipeTIPtr; evControl = pipeTI->evControl; + pipeTI->evWakeUp = NULL; /* * Try to sane stop the pipe worker, corresponding its current state */ @@ -3414,6 +3422,9 @@ TclPipeThreadExit( if ((state = InterlockedExchange(&pipeTI->state, PTI_STATE_DOWN)) == PTI_STATE_STOP) { CloseHandle(pipeTI->evControl); + if (pipeTI->evWakeUp) { + SetEvent(pipeTI->evWakeUp); + } #ifndef _PTI_USE_CKALLOC free(pipeTI); #else -- cgit v0.12 From 76054b46467848b368ff2641818ca2a72ad2b98e Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 11 Apr 2017 18:09:52 +0000 Subject: code review, robustness increase, avoid infinite wait by exit, thread exit and by pipes of closed processes); use pipe-helpers (TI-structure handling) for all pipe-workers (tclWinConsole, tclWinSerial); --- win/tclWinConsole.c | 281 ++++++++++++++-------------------------------------- win/tclWinInt.h | 8 ++ win/tclWinPipe.c | 51 ++++++---- win/tclWinSerial.c | 124 +++-------------------- 4 files changed, 132 insertions(+), 332 deletions(-) diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index da995c5..7a0965d 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -51,16 +51,10 @@ TCL_DECLARE_MUTEX(consoleMutex) typedef struct ConsoleThreadInfo { HANDLE thread; /* Handle to reader or writer thread. */ - int threadExiting; /* Boolean indicating that thread is exiting. */ HANDLE readyEvent; /* Manual-reset event to signal _to_ the main * thread when the worker thread has finished * waiting for its normal work to happen. */ - HANDLE startEvent; /* Auto-reset event used by the main thread to - * signal when the thread should attempt to do - * its normal work. Additionally this event - * used as wait for thread event (init phase). */ - HANDLE stopEvent; /* Auto-reset event used by the main thread to - * signal when the thread should exit. */ + TclPipeThreadInfo *TI; /* Thread info structure of writer and reader. */ } ConsoleThreadInfo; /* @@ -84,16 +78,14 @@ typedef struct ConsoleInfo { * threads. */ ConsoleThreadInfo writer; /* A specialized thread for handling * asynchronous writes to the console; the - * waiting starts when a start event is sent, + * waiting starts when a control event is sent, * and a reset event is sent back to the main - * thread when the write is done. A stop event - * is used to terminate the thread. */ + * thread when the write is done. */ ConsoleThreadInfo reader; /* A specialized thread for handling * asynchronous reads from the console; the - * waiting starts when a start event is sent, + * waiting starts when a control event is sent, * and a reset event is sent back to the main - * thread when input is available. A stop - * event is used to terminate the thread. */ + * thread when input is available. */ DWORD writeError; /* An error caused by the last background * write. Set to 0 if no error has been * detected. This word is shared with the @@ -170,10 +162,6 @@ static BOOL ReadConsoleBytes(HANDLE hConsole, LPVOID lpBuffer, static BOOL WriteConsoleBytes(HANDLE hConsole, const void *lpBuffer, DWORD nbytes, LPDWORD nbyteswritten); -static void StartChannelThread(ConsoleInfo *infoPtr, - ConsoleThreadInfo *threadInfoPtr, - LPTHREAD_START_ROUTINE threadProc); -static void StopChannelThread(ConsoleThreadInfo *threadInfoPtr); /* * This structure describes the channel type structure for command console @@ -520,102 +508,6 @@ ConsoleBlockModeProc( /* *---------------------------------------------------------------------- * - * StartChannelThread, StopChannelThread -- - * - * Helpers that codify how to ask one of the console service threads to - * start and stop. - * - *---------------------------------------------------------------------- - */ - -static void -StartChannelThread( - ConsoleInfo *infoPtr, - ConsoleThreadInfo *threadInfoPtr, - LPTHREAD_START_ROUTINE threadProc) -{ - DWORD id; - - threadInfoPtr->readyEvent = CreateEvent(NULL, TRUE, TRUE, NULL); - threadInfoPtr->startEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - threadInfoPtr->threadExiting = FALSE; - threadInfoPtr->stopEvent = CreateEvent(NULL, FALSE, FALSE, NULL); - threadInfoPtr->thread = CreateThread(NULL, 256, threadProc, infoPtr, 0, - &id); - SetThreadPriority(threadInfoPtr->thread, THREAD_PRIORITY_HIGHEST); -} - -static void -StopChannelThread( - ConsoleThreadInfo *threadInfoPtr) -{ - DWORD exitCode = 0; - - /* - * The thread may already have closed on it's own. Check it's exit - * code. - */ - - GetExitCodeThread(threadInfoPtr->thread, &exitCode); - if (exitCode == STILL_ACTIVE) { - /* - * Set the stop event so that if the reader thread is blocked in - * ConsoleReaderThread on WaitForMultipleEvents, it will exit cleanly. - */ - - SetEvent(threadInfoPtr->stopEvent); - - /* - * Wait at most 20 milliseconds for the reader thread to close. - */ - - if (WaitForSingleObject(threadInfoPtr->thread, 20) == WAIT_TIMEOUT) { - /* - * Forcibly terminate the background thread as a last resort. - * Note that we need to guard against terminating the thread while - * it is in the middle of Tcl_ThreadAlert because it won't be able - * to release the notifier lock. - * - * Also note that terminating threads during their initialization or teardown phase - * may result in ntdll.dll's LoaderLock to remain locked indefinitely. - * This causes ntdll.dll's LdrpInitializeThread() to deadlock trying to acquire LoaderLock. - * LdrpInitializeThread() is executed within new threads to perform - * initialization and to execute DllMain() of all loaded dlls. - * As a result, all new threads are deadlocked in their initialization phase and never execute, - * even though CreateThread() reports successful thread creation. - * This results in a very weird process-wide behavior, which is extremely hard to debug. - * - * THREADS SHOULD NEVER BE TERMINATED. Period. - * - * But for now, check if thread is exiting, and if so, let it die peacefully. - */ - - if ( !threadInfoPtr->threadExiting - || WaitForSingleObject(threadInfoPtr->thread, 5000) != WAIT_OBJECT_0 - ) { - Tcl_MutexLock(&consoleMutex); - /* BUG: this leaks memory. */ - TerminateThread(threadInfoPtr->thread, 0); - Tcl_MutexUnlock(&consoleMutex); - } - } - } - - /* - * Close all the handles associated with the thread, and set the thread - * handle field to NULL to mark that the thread has been cleaned up. - */ - - CloseHandle(threadInfoPtr->thread); - CloseHandle(threadInfoPtr->readyEvent); - CloseHandle(threadInfoPtr->startEvent); - CloseHandle(threadInfoPtr->stopEvent); - threadInfoPtr->thread = NULL; -} - -/* - *---------------------------------------------------------------------- - * * ConsoleCloseProc -- * * Closes a console based IO channel. @@ -646,7 +538,10 @@ ConsoleCloseProc( */ if (consolePtr->reader.thread) { - StopChannelThread(&consolePtr->reader); + TclPipeThreadStop(&consolePtr->reader.TI, consolePtr->reader.thread); + CloseHandle(consolePtr->reader.thread); + CloseHandle(consolePtr->reader.readyEvent); + consolePtr->reader.thread = NULL; } consolePtr->validMask &= ~TCL_READABLE; @@ -663,10 +558,13 @@ ConsoleCloseProc( * prevent infinite wait on exit. [Python Bug 216289] */ - WaitForSingleObject(consolePtr->writer.readyEvent, INFINITE); + WaitForSingleObject(consolePtr->writer.readyEvent, 5000); } - StopChannelThread(&consolePtr->writer); + TclPipeThreadStop(&consolePtr->writer.TI, consolePtr->writer.thread); + CloseHandle(consolePtr->writer.thread); + CloseHandle(consolePtr->writer.readyEvent); + consolePtr->writer.thread = NULL; } consolePtr->validMask &= ~TCL_WRITABLE; @@ -832,8 +730,11 @@ ConsoleOutputProc( DWORD bytesWritten, timeout; *errorCode = 0; - timeout = (infoPtr->flags & CONSOLE_ASYNC) ? 0 : INFINITE; - if (WaitForSingleObject(threadInfo->readyEvent,timeout) == WAIT_TIMEOUT) { + + /* avoid blocking if pipe-thread exited */ + timeout = (infoPtr->flags & CONSOLE_ASYNC) || !TclPipeThreadIsAlive(&threadInfo->TI) + || TclInExit() || TclInThreadExit() ? 0 : INFINITE; + if (WaitForSingleObject(threadInfo->readyEvent, timeout) == WAIT_TIMEOUT) { /* * The writer thread is blocked waiting for a write to complete and * the channel is in non-blocking mode. @@ -873,7 +774,7 @@ ConsoleOutputProc( memcpy(infoPtr->writeBuf, buf, (size_t) toWrite); infoPtr->toWrite = toWrite; ResetEvent(threadInfo->readyEvent); - SetEvent(threadInfo->startEvent); + TclPipeThreadSignal(&threadInfo->TI); bytesWritten = toWrite; } else { /* @@ -1110,9 +1011,10 @@ WaitForRead( * Synchronize with the reader thread. */ - timeout = blocking ? INFINITE : 0; - if (WaitForSingleObject(threadInfo->readyEvent, - timeout) == WAIT_TIMEOUT) { + /* avoid blocking if pipe-thread exited */ + timeout = (!blocking || !TclPipeThreadIsAlive(&threadInfo->TI) + || TclInExit() || TclInThreadExit()) ? 0 : INFINITE; + if (WaitForSingleObject(threadInfo->readyEvent, timeout) == WAIT_TIMEOUT) { /* * The reader thread is blocked waiting for data and the channel * is in non-blocking mode. @@ -1172,7 +1074,7 @@ WaitForRead( */ ResetEvent(threadInfo->readyEvent); - SetEvent(threadInfo->startEvent); + TclPipeThreadSignal(&threadInfo->TI); } } @@ -1199,39 +1101,27 @@ static DWORD WINAPI ConsoleReaderThread( LPVOID arg) { - ConsoleInfo *infoPtr = arg; - HANDLE *handle = infoPtr->handle; - ConsoleThreadInfo *threadInfo = &infoPtr->reader; - DWORD waitResult; - HANDLE wEvents[2]; - - /* - * Notify caller (using startEvent) that this thread is initialized - */ - SignalObjectAndWait(threadInfo->startEvent, threadInfo->stopEvent, INFINITE, FALSE); - - /* - * The first event takes precedence. - */ - - wEvents[0] = threadInfo->stopEvent; - wEvents[1] = threadInfo->startEvent; - - for (;;) { + TclPipeThreadInfo *pipeTI = (TclPipeThreadInfo *)arg; + ConsoleInfo *infoPtr = NULL; /* access info only after success init/wait */ + HANDLE *handle = NULL; + ConsoleThreadInfo *threadInfo = NULL; + int done = 0; + + while (!done) { /* - * Wait for the main thread to signal before attempting to wait. + * Wait for the main thread to signal before attempting to read. */ - waitResult = WaitForMultipleObjects(2, wEvents, FALSE, INFINITE); - - if (waitResult != (WAIT_OBJECT_0 + 1)) { - /* - * The start event was not signaled. It must be the stop event or - * an error, so exit this thread. - */ - + if (!TclPipeThreadWaitForSignal(&pipeTI)) { + /* exit */ break; } + if (!infoPtr) { + infoPtr = (ConsoleInfo *)pipeTI->clientData; + handle = infoPtr->handle; + threadInfo = &infoPtr->reader; + } + /* * Look for data on the console, but first ignore any events that are @@ -1251,6 +1141,7 @@ ConsoleReaderThread( if (err == (DWORD) EOF) { infoPtr->readFlags = CONSOLE_EOF; } + done = 1; } /* @@ -1278,11 +1169,8 @@ ConsoleReaderThread( Tcl_MutexUnlock(&consoleMutex); } - /* - * Inform caller that this thread should not be terminated, since it is about to exit. - * See comment in StopChannelThread() for reasons. - */ - threadInfo->threadExiting = TRUE; + /* Worker exit, so inform the main thread or free TI-structure (if owned) */ + TclPipeThreadExit(&pipeTI); return 0; } @@ -1310,40 +1198,27 @@ static DWORD WINAPI ConsoleWriterThread( LPVOID arg) { - ConsoleInfo *infoPtr = arg; - HANDLE *handle = infoPtr->handle; - ConsoleThreadInfo *threadInfo = &infoPtr->writer; - DWORD count, toWrite, waitResult; + TclPipeThreadInfo *pipeTI = (TclPipeThreadInfo *)arg; + ConsoleInfo *infoPtr = NULL; /* access info only after success init/wait */ + HANDLE *handle = NULL; + ConsoleThreadInfo *threadInfo = NULL; + DWORD count, toWrite; char *buf; - HANDLE wEvents[2]; - - /* - * Notify caller (using startEvent) that this thread is initialized - */ - SignalObjectAndWait(threadInfo->startEvent, threadInfo->stopEvent, INFINITE, FALSE); - - /* - * The first event takes precedence. - */ - - wEvents[0] = threadInfo->stopEvent; - wEvents[1] = threadInfo->startEvent; - - for (;;) { + int done = 0; + + while (!done) { /* * Wait for the main thread to signal before attempting to write. */ - - waitResult = WaitForMultipleObjects(2, wEvents, FALSE, INFINITE); - - if (waitResult != (WAIT_OBJECT_0 + 1)) { - /* - * The start event was not signaled. It must be the stop event or - * an error, so exit this thread. - */ - + if (!TclPipeThreadWaitForSignal(&pipeTI)) { + /* exit */ break; } + if (!infoPtr) { + infoPtr = (ConsoleInfo *)pipeTI->clientData; + handle = infoPtr->handle; + threadInfo = &infoPtr->writer; + } buf = infoPtr->writeBuf; toWrite = infoPtr->toWrite; @@ -1356,6 +1231,7 @@ ConsoleWriterThread( if (WriteConsoleBytes(handle, buf, (DWORD) toWrite, &count) == FALSE) { infoPtr->writeError = GetLastError(); + done = 1; break; } toWrite -= count; @@ -1387,11 +1263,8 @@ ConsoleWriterThread( Tcl_MutexUnlock(&consoleMutex); } - /* - * Inform caller that this thread should not be terminated, since it is about to exit. - * See comment in StopChannelThread() for reasons. - */ - threadInfo->threadExiting = TRUE; + /* Worker exit, so inform the main thread or free TI-structure (if owned) */ + TclPipeThreadExit(&pipeTI); return 0; } @@ -1422,8 +1295,7 @@ TclWinOpenConsoleChannel( { char encoding[4 + TCL_INTEGER_SPACE]; ConsoleInfo *infoPtr; - DWORD modes, wEventsCnt = 0; - HANDLE wEvents[2], wEventsPtr = wEvents; + DWORD modes; ConsoleInit(); @@ -1464,26 +1336,23 @@ TclWinOpenConsoleChannel( modes &= ~(ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT); modes |= ENABLE_LINE_INPUT; SetConsoleMode(infoPtr->handle, modes); - StartChannelThread(infoPtr, &infoPtr->reader, ConsoleReaderThread); - wEvents[wEventsCnt++] = infoPtr->reader.startEvent; + + infoPtr->reader.readyEvent = CreateEvent(NULL, TRUE, TRUE, NULL); + infoPtr->reader.thread = CreateThread(NULL, 256, ConsoleReaderThread, + TclPipeThreadCreateTI(&infoPtr->reader.TI, infoPtr, + infoPtr->reader.readyEvent), 0, NULL); + SetThreadPriority(infoPtr->reader.thread, THREAD_PRIORITY_HIGHEST); } if (permissions & TCL_WRITABLE) { - StartChannelThread(infoPtr, &infoPtr->writer, ConsoleWriterThread); - wEvents[wEventsCnt++] = infoPtr->writer.startEvent; - } - /* - * Wait for both threads to initialize (using theirs startEvent) - */ - if (wEventsCnt) { - WaitForMultipleObjects(wEventsCnt, wEvents, TRUE, 5000); - /* Resume both waiting threads, we've get the events */ - if (infoPtr->reader.thread) - SetEvent(infoPtr->reader.stopEvent); - if (infoPtr->writer.thread) - SetEvent(infoPtr->writer.stopEvent); + infoPtr->writer.readyEvent = CreateEvent(NULL, TRUE, TRUE, NULL); + infoPtr->writer.thread = CreateThread(NULL, 256, ConsoleWriterThread, + TclPipeThreadCreateTI(&infoPtr->writer.TI, infoPtr, + infoPtr->writer.readyEvent), 0, NULL); + SetThreadPriority(infoPtr->writer.thread, THREAD_PRIORITY_HIGHEST); } + /* * Files have default translation of AUTO and ^Z eof char, which means * that a ^Z will be accepted as EOF when reading. diff --git a/win/tclWinInt.h b/win/tclWinInt.h index 67b00a8..86945a9 100644 --- a/win/tclWinInt.h +++ b/win/tclWinInt.h @@ -149,6 +149,14 @@ TclPipeThreadSignal( } }; +static inline int +TclPipeThreadIsAlive( + TclPipeThreadInfo **pipeTIPtr) +{ + TclPipeThreadInfo *pipeTI = *pipeTIPtr; + return (pipeTI && pipeTI->state != PTI_STATE_DOWN); +}; + MODULE_SCOPE int TclPipeThreadStopSignal(TclPipeThreadInfo **pipeTIPtr, HANDLE wakeEvent); MODULE_SCOPE void TclPipeThreadStop(TclPipeThreadInfo **pipeTIPtr, HANDLE hThread); MODULE_SCOPE void TclPipeThreadExit(TclPipeThreadInfo **pipeTIPtr); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 528f950..87ce790 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1592,7 +1592,8 @@ TclpCreateCommandChannel( infoPtr->readable = CreateEvent(NULL, TRUE, TRUE, NULL); infoPtr->readThread = CreateThread(NULL, 256, PipeReaderThread, - TclPipeThreadCreateTI(&infoPtr->readTI, infoPtr, NULL), 0, NULL); + TclPipeThreadCreateTI(&infoPtr->readTI, infoPtr, infoPtr->readable), + 0, NULL); SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_READABLE; } else { @@ -1798,6 +1799,7 @@ PipeClose2Proc( int errorCode, result; PipeInfo *infoPtr, **nextPtrPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); + int inExit = (TclInExit() || TclInThreadExit()); errorCode = 0; result = 0; @@ -1832,7 +1834,7 @@ PipeClose2Proc( * nonblocking or may block during exit, bail out since the worker * thread is not interruptible and we want TIP#398-fast-exit. */ - if ((pipePtr->flags & PIPE_ASYNC) && TclInExit()) { + if ((pipePtr->flags & PIPE_ASYNC) && inExit) { /* give it a chance to leave honorably */ TclPipeThreadStopSignal(&pipePtr->writeTI, pipePtr->writable); @@ -1843,7 +1845,7 @@ PipeClose2Proc( } else { - WaitForSingleObject(pipePtr->writable, INFINITE); + WaitForSingleObject(pipePtr->writable, inExit ? 5000 : INFINITE); } @@ -1885,7 +1887,7 @@ PipeClose2Proc( } } - if ((pipePtr->flags & PIPE_ASYNC) || TclInExit()) { + if ((pipePtr->flags & PIPE_ASYNC) || inExit) { /* * If the channel is non-blocking or Tcl is being cleaned up, just * detach the children PIDs, reap them (important if we are in a @@ -2063,7 +2065,10 @@ PipeOutputProc( DWORD bytesWritten, timeout; *errorCode = 0; - timeout = (infoPtr->flags & PIPE_ASYNC) ? 0 : INFINITE; + + /* avoid blocking if pipe-thread exited */ + timeout = ((infoPtr->flags & PIPE_ASYNC) || !TclPipeThreadIsAlive(&infoPtr->writeTI) + || TclInExit() || TclInThreadExit()) ? 0 : INFINITE; if (WaitForSingleObject(infoPtr->writable, timeout) == WAIT_TIMEOUT) { /* * The writer thread is blocked waiting for a write to complete and @@ -2614,7 +2619,9 @@ WaitForRead( * Synchronize with the reader thread. */ - timeout = blocking ? INFINITE : 0; + /* avoid blocking if pipe-thread exited */ + timeout = (!blocking || !TclPipeThreadIsAlive(&infoPtr->readTI) + || TclInExit() || TclInThreadExit()) ? 0 : INFINITE; if (WaitForSingleObject(infoPtr->readable, timeout) == WAIT_TIMEOUT) { /* * The reader thread is blocked waiting for data and the channel @@ -2756,7 +2763,7 @@ PipeReaderThread( infoPtr->readFlags |= PIPE_EOF; done = 1; } else if (err == ERROR_INVALID_HANDLE) { - break; + done = 1; } } else if (count == 0) { if (ReadFile(handle, &(infoPtr->extraByte), 1, &count, NULL) @@ -2778,7 +2785,7 @@ PipeReaderThread( infoPtr->readFlags |= PIPE_EOF; done = 1; } else if (err == ERROR_INVALID_HANDLE) { - break; + done = 1; } } } @@ -3247,7 +3254,7 @@ TclPipeThreadStop( HANDLE hThread) { TclPipeThreadInfo *pipeTI = *pipeTIPtr; - HANDLE evControl; + HANDLE evControl, wakeEvent; int state; if (!pipeTI) { @@ -3255,6 +3262,7 @@ TclPipeThreadStop( } pipeTI = *pipeTIPtr; evControl = pipeTI->evControl; + wakeEvent = pipeTI->evWakeUp; pipeTI->evWakeUp = NULL; /* * Try to sane stop the pipe worker, corresponding its current state @@ -3290,7 +3298,12 @@ TclPipeThreadStop( * Thread works currently, we should try to end it, own the TI structure * (because of possible sharing the joint structures with thread) */ - InterlockedExchange(&pipeTI->state, PTI_STATE_END); + if ((state = InterlockedCompareExchange(&pipeTI->state, + PTI_STATE_END, PTI_STATE_WORK)) == PTI_STATE_DOWN + ) { + /* we don't need to wait for it, but we should free pipeTI */ + hThread = NULL; + }; break; } @@ -3305,6 +3318,8 @@ TclPipeThreadStop( GetExitCodeThread(hThread, &exitCode); if (exitCode == STILL_ACTIVE) { + + int inExit = (TclInExit() || TclInThreadExit()); /* * Set the stop event so that if the pipe thread is blocked * somewhere, it may hereafter sane exit cleanly. @@ -3325,8 +3340,7 @@ TclPipeThreadStop( */ /* if we want TIP#398-fast-exit. */ - if (WaitForSingleObject(hThread, - TclInExit() ? 0 : 20) == WAIT_TIMEOUT) { + if (WaitForSingleObject(hThread, inExit ? 0 : 20) == WAIT_TIMEOUT) { /* * The thread must be blocked waiting for the pipe to @@ -3353,22 +3367,22 @@ TclPipeThreadStop( * THREADS SHOULD NEVER BE TERMINATED. Period. * * But for now, check if thread is exiting, and if so, let it die peacefully. + * + * Also don't terminate if in exit (otherwise deadlocked in ntdll.dll's). */ if ( pipeTI->state != PTI_STATE_DOWN && WaitForSingleObject(hThread, - TclInExit() ? 0 : 5000) != WAIT_OBJECT_0 + inExit ? 50 : 5000) != WAIT_OBJECT_0 ) { - Tcl_MutexLock(&pipeMutex); /* BUG: this leaks memory */ - if (!TerminateThread(hThread, 0)) { - /* terminate fails, just give thread a chance to exit */ + if (inExit || !TerminateThread(hThread, 0)) { + /* in exit or terminate fails, just give thread a chance to exit */ if (InterlockedExchange(&pipeTI->state, PTI_STATE_STOP) != PTI_STATE_DOWN) { pipeTI = NULL; } }; - Tcl_MutexUnlock(&pipeMutex); } } } @@ -3376,6 +3390,9 @@ TclPipeThreadStop( *pipeTIPtr = NULL; if (pipeTI) { + if (pipeTI->evWakeUp) { + SetEvent(pipeTI->evWakeUp); + } CloseHandle(pipeTI->evControl); #ifndef _PTI_USE_CKALLOC free(pipeTI); diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index f55f5f1..f78aa5a 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -93,19 +93,12 @@ typedef struct SerialInfo { * threads. */ OVERLAPPED osRead; /* OVERLAPPED structure for read operations. */ OVERLAPPED osWrite; /* OVERLAPPED structure for write operations */ + TclPipeThreadInfo *writeTI; /* Thread info structure of writer worker. */ HANDLE writeThread; /* Handle to writer thread. */ - int writeThreadExiting; /* Boolean indicating that thread is exiting. */ CRITICAL_SECTION csWrite; /* Writer thread synchronisation. */ HANDLE evWritable; /* Manual-reset event to signal when the * writer thread has finished waiting for the * current buffer to be written. */ - HANDLE evStartWriter; /* Auto-reset event used by the main thread to - * signal when the writer thread should - * attempt to write to the serial. Additionally - * this event used as wait for thread event (init). */ - HANDLE evStopWriter; /* Auto-reset event used by the main thread to - * signal when the writer thread should close. - */ DWORD writeError; /* An error caused by the last background * write. Set to 0 if no error has been * detected. This word is shared with the @@ -601,7 +594,6 @@ SerialCloseProc( int errorCode, result = 0; SerialInfo *infoPtr, **nextPtrPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - DWORD exitCode; errorCode = 0; @@ -611,71 +603,13 @@ SerialCloseProc( } serialPtr->validMask &= ~TCL_READABLE; - if (serialPtr->validMask & TCL_WRITABLE) { - /* - * Generally we cannot wait for a pending write operation because it - * may hang due to handshake - * WaitForSingleObject(serialPtr->evWritable, INFINITE); - */ - - /* - * The thread may have already closed on it's own. Check it's exit - * code. - */ - - GetExitCodeThread(serialPtr->writeThread, &exitCode); - - if (exitCode == STILL_ACTIVE) { - /* - * Set the stop event so that if the writer thread is blocked in - * SerialWriterThread on WaitForMultipleEvents, it will exit - * cleanly. - */ + if (serialPtr->writeThread) { - SetEvent(serialPtr->evStopWriter); + TclPipeThreadStop(&serialPtr->writeTI, serialPtr->writeThread); - /* - * Wait at most 20 milliseconds for the writer thread to close. - */ - - if (WaitForSingleObject(serialPtr->writeThread, - 20) == WAIT_TIMEOUT) { - /* - * Forcibly terminate the background thread as a last resort. - * Note that we need to guard against terminating the thread - * while it is in the middle of Tcl_ThreadAlert because it - * won't be able to release the notifier lock. - * - * Also note that terminating threads during their initialization or teardown phase - * may result in ntdll.dll's LoaderLock to remain locked indefinitely. - * This causes ntdll.dll's LdrpInitializeThread() to deadlock trying to acquire LoaderLock. - * LdrpInitializeThread() is executed within new threads to perform - * initialization and to execute DllMain() of all loaded dlls. - * As a result, all new threads are deadlocked in their initialization phase and never execute, - * even though CreateThread() reports successful thread creation. - * This results in a very weird process-wide behavior, which is extremely hard to debug. - * - * THREADS SHOULD NEVER BE TERMINATED. Period. - * - * But for now, check if thread is exiting, and if so, let it die peacefully. - */ - - if ( !serialPtr->writeThreadExiting - || WaitForSingleObject(serialPtr->writeThread, 5000) != WAIT_OBJECT_0 - ) { - Tcl_MutexLock(&serialMutex); - /* BUG: this leaks memory. */ - TerminateThread(serialPtr->writeThread, 0); - Tcl_MutexUnlock(&serialMutex); - } - } - } - - CloseHandle(serialPtr->writeThread); CloseHandle(serialPtr->osWrite.hEvent); CloseHandle(serialPtr->evWritable); - CloseHandle(serialPtr->evStartWriter); - CloseHandle(serialPtr->evStopWriter); + CloseHandle(serialPtr->writeThread); serialPtr->writeThread = NULL; PurgeComm(serialPtr->handle, PURGE_TXABORT | PURGE_TXCLEAR); @@ -1093,7 +1027,7 @@ SerialOutputProc( memcpy(infoPtr->writeBuf, buf, (size_t) toWrite); infoPtr->toWrite = toWrite; ResetEvent(infoPtr->evWritable); - SetEvent(infoPtr->evStartWriter); + TclPipeThreadSignal(&infoPtr->writeTI); bytesWritten = (DWORD) toWrite; } else { @@ -1330,39 +1264,21 @@ static DWORD WINAPI SerialWriterThread( LPVOID arg) { - SerialInfo *infoPtr = (SerialInfo *)arg; - DWORD bytesWritten, toWrite, waitResult; + TclPipeThreadInfo *pipeTI = (TclPipeThreadInfo *)arg; + SerialInfo *infoPtr = NULL; /* access info only after success init/wait */ + DWORD bytesWritten, toWrite; char *buf; OVERLAPPED myWrite; /* Have an own OVERLAPPED in this thread. */ - HANDLE wEvents[2]; - - /* - * Notify TclWinOpenSerialChannel() that this thread is initialized - */ - SignalObjectAndWait(infoPtr->evStartWriter, infoPtr->evStopWriter, INFINITE, FALSE); - - /* - * The stop event takes precedence by being first in the list. - */ - - wEvents[0] = infoPtr->evStopWriter; - wEvents[1] = infoPtr->evStartWriter; for (;;) { /* * Wait for the main thread to signal before attempting to write. */ - - waitResult = WaitForMultipleObjects(2, wEvents, FALSE, INFINITE); - - if (waitResult != (WAIT_OBJECT_0 + 1)) { - /* - * The start event was not signaled. It might be the stop event or - * an error, so exit. - */ - + if (!TclPipeThreadWaitForSignal(&pipeTI)) { + /* exit */ break; } + infoPtr = (SerialInfo *)pipeTI->clientData; buf = infoPtr->writeBuf; toWrite = infoPtr->toWrite; @@ -1426,11 +1342,8 @@ SerialWriterThread( Tcl_MutexUnlock(&serialMutex); } - /* - * Inform caller that this thread should not be terminated, since it is about to exit. - * See comment in SerialCloseProc() for reasons. - */ - infoPtr->writeThreadExiting = TRUE; + /* Worker exit, so inform the main thread or free TI-structure (if owned) */ + TclPipeThreadExit(&pipeTI); return 0; } @@ -1505,7 +1418,6 @@ TclWinOpenSerialChannel( int permissions) { SerialInfo *infoPtr; - DWORD id; SerialInit(); @@ -1557,15 +1469,9 @@ TclWinOpenSerialChannel( infoPtr->osWrite.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); infoPtr->evWritable = CreateEvent(NULL, TRUE, TRUE, NULL); - infoPtr->evStartWriter = CreateEvent(NULL, FALSE, FALSE, NULL); - infoPtr->evStopWriter = CreateEvent(NULL, FALSE, FALSE, NULL); - infoPtr->writeThreadExiting = FALSE; infoPtr->writeThread = CreateThread(NULL, 256, SerialWriterThread, - infoPtr, 0, &id); - /* Wait for thread to initialize (using evStartWriter) */ - WaitForSingleObject(infoPtr->evStartWriter, 5000); - /* Wake-up it to signal we've get an event */ - SetEvent(infoPtr->evStopWriter); + TclPipeThreadCreateTI(&infoPtr->writeTI, infoPtr, + infoPtr->evWritable), 0, NULL); } /* -- cgit v0.12 From 85cc06f56cc4b132ed6cd77c097bb83150af55bd Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 11 Apr 2017 18:10:09 +0000 Subject: improves robustness of the socket tests against busy random ports (fixed sporadic errors "already in use") --- tests/socket.test | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/socket.test b/tests/socket.test index d43c41c..a3e5704 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -69,7 +69,22 @@ testConstraint exec [llength [info commands exec]] # Produce a random port number in the Dynamic/Private range # from 49152 through 65535. -proc randport {} { expr {int(rand()*16383+49152)} } +proc randport {} { + # firstly try dynamic port via server-socket(0): + set port 0x7fffffff + catch { + set port [lindex [fconfigure [set s [socket -server {} 0]] -sockname] 2] + close $s + } + while {[catch { + close [socket -server {} $port] + } msg]} { + if {[incr i] > 1000} {return -code error "too many iterations to get free random port: $msg"} + # try random port: + set port [expr {int(rand()*16383+49152)}] + } + return $port +} # Test the latency of tcp connections over the loopback interface. Some OSes # (e.g. NetBSD) seem to use the Nagle algorithm and delayed ACKs, so it takes -- cgit v0.12 From 1638a98f0ed7697b66bdba7f4bb6b5b85f8f17e9 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 11 Apr 2017 18:13:56 +0000 Subject: fixes sporadically errors in several not event-driven test cases zlib-8.x (wrong non-blocking pipe usage, without fileevent resp. vwait) --- tests/zlib.test | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/zlib.test b/tests/zlib.test index 63bac7e..9f06eb1 100644 --- a/tests/zlib.test +++ b/tests/zlib.test @@ -330,7 +330,7 @@ test zlib-8.9 {transformation and fconfigure} -setup { set strm [zlib stream decompress] } -constraints zlib -body { zlib push compress $outSide -dictionary $spdyDict - fconfigure $outSide -blocking 0 -translation binary -buffering none + fconfigure $outSide -blocking 1 -translation binary -buffering none fconfigure $inSide -blocking 1 -translation binary puts -nonewline $outSide $spdyHeaders set result [fconfigure $outSide -checksum] @@ -347,7 +347,7 @@ test zlib-8.10 {transformation and fconfigure} -setup { lassign [chan pipe] inSide outSide } -constraints {zlib recentZlib} -body { zlib push deflate $outSide -dictionary $spdyDict - fconfigure $outSide -blocking 0 -translation binary -buffering none + fconfigure $outSide -blocking 1 -translation binary -buffering none fconfigure $inSide -blocking 1 -translation binary puts -nonewline $outSide $spdyHeaders chan pop $outSide @@ -369,7 +369,7 @@ test zlib-8.11 {transformation and fconfigure} -setup { set strm [zlib stream inflate] } -constraints zlib -body { zlib push deflate $outSide -dictionary $spdyDict - fconfigure $outSide -blocking 0 -translation binary -buffering none + fconfigure $outSide -blocking 1 -translation binary -buffering none fconfigure $inSide -blocking 1 -translation binary puts -nonewline $outSide $spdyHeaders chan pop $outSide @@ -387,7 +387,7 @@ test zlib-8.12 {transformation and fconfigure} -setup { } -constraints zlib -body { $strm put -dictionary $spdyDict -finalize $spdyHeaders zlib push decompress $inSide - fconfigure $outSide -blocking 0 -translation binary + fconfigure $outSide -blocking 1 -translation binary fconfigure $inSide -translation binary -dictionary $spdyDict puts -nonewline $outSide [$strm get] close $outSide @@ -404,7 +404,7 @@ test zlib-8.13 {transformation and fconfigure} -setup { } -constraints zlib -body { $strm put -dictionary $spdyDict -finalize $spdyHeaders zlib push decompress $inSide -dictionary $spdyDict - fconfigure $outSide -blocking 0 -translation binary + fconfigure $outSide -blocking 1 -translation binary fconfigure $inSide -translation binary puts -nonewline $outSide [$strm get] close $outSide @@ -421,7 +421,7 @@ test zlib-8.14 {transformation and fconfigure} -setup { } -constraints zlib -body { $strm put -finalize -dictionary $spdyDict $spdyHeaders zlib push inflate $inSide - fconfigure $outSide -blocking 0 -buffering none -translation binary + fconfigure $outSide -blocking 1 -buffering none -translation binary fconfigure $inSide -translation binary -dictionary $spdyDict puts -nonewline $outSide [$strm get] close $outSide @@ -437,7 +437,7 @@ test zlib-8.15 {transformation and fconfigure} -setup { } -constraints zlib -body { $strm put -finalize -dictionary $spdyDict $spdyHeaders zlib push inflate $inSide -dictionary $spdyDict - fconfigure $outSide -blocking 0 -buffering none -translation binary + fconfigure $outSide -blocking 1 -buffering none -translation binary fconfigure $inSide -translation binary puts -nonewline $outSide [$strm get] close $outSide -- cgit v0.12 From 1e22d92c69c72995470074b19b377d18ad60b4e6 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 11 Apr 2017 19:11:27 +0000 Subject: More changes work --- changes | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/changes b/changes index 68b2fb5..c3a4be3 100644 --- a/changes +++ b/changes @@ -8704,6 +8704,15 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2016-09-07 (bug)[4dbdd9] Memleak in test var-8.3 (mr_calvin,porter) 2016-10-03 (bug)[2bf561] Allow empty command as alias target (yorick,nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2016-10-04 (bug)[4d5ae7] Crash in async connects host no address (gahr,fellows) + +2016-10-08 (bug)[838e99] treat application/xml as text (gahr,fellows) +=> http 2.8.10 + +2016-10-11 (bug)[3cc1d9] Thread finalization crash in zippy (neumann) + -- cgit v0.12 From 0cc7fd3498bf486b2eb5bc20a67f5671f2830097 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 12 Apr 2017 09:23:23 +0000 Subject: Fix sporadically errors in zlib-8.x and socket tests, cherry-picked from "fix-1997007" branch. Credit to "sebres"! --- tests/socket.test | 17 ++++++++++++++++- tests/zlib.test | 14 +++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/tests/socket.test b/tests/socket.test index d43c41c..a3e5704 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -69,7 +69,22 @@ testConstraint exec [llength [info commands exec]] # Produce a random port number in the Dynamic/Private range # from 49152 through 65535. -proc randport {} { expr {int(rand()*16383+49152)} } +proc randport {} { + # firstly try dynamic port via server-socket(0): + set port 0x7fffffff + catch { + set port [lindex [fconfigure [set s [socket -server {} 0]] -sockname] 2] + close $s + } + while {[catch { + close [socket -server {} $port] + } msg]} { + if {[incr i] > 1000} {return -code error "too many iterations to get free random port: $msg"} + # try random port: + set port [expr {int(rand()*16383+49152)}] + } + return $port +} # Test the latency of tcp connections over the loopback interface. Some OSes # (e.g. NetBSD) seem to use the Nagle algorithm and delayed ACKs, so it takes diff --git a/tests/zlib.test b/tests/zlib.test index 63bac7e..9f06eb1 100644 --- a/tests/zlib.test +++ b/tests/zlib.test @@ -330,7 +330,7 @@ test zlib-8.9 {transformation and fconfigure} -setup { set strm [zlib stream decompress] } -constraints zlib -body { zlib push compress $outSide -dictionary $spdyDict - fconfigure $outSide -blocking 0 -translation binary -buffering none + fconfigure $outSide -blocking 1 -translation binary -buffering none fconfigure $inSide -blocking 1 -translation binary puts -nonewline $outSide $spdyHeaders set result [fconfigure $outSide -checksum] @@ -347,7 +347,7 @@ test zlib-8.10 {transformation and fconfigure} -setup { lassign [chan pipe] inSide outSide } -constraints {zlib recentZlib} -body { zlib push deflate $outSide -dictionary $spdyDict - fconfigure $outSide -blocking 0 -translation binary -buffering none + fconfigure $outSide -blocking 1 -translation binary -buffering none fconfigure $inSide -blocking 1 -translation binary puts -nonewline $outSide $spdyHeaders chan pop $outSide @@ -369,7 +369,7 @@ test zlib-8.11 {transformation and fconfigure} -setup { set strm [zlib stream inflate] } -constraints zlib -body { zlib push deflate $outSide -dictionary $spdyDict - fconfigure $outSide -blocking 0 -translation binary -buffering none + fconfigure $outSide -blocking 1 -translation binary -buffering none fconfigure $inSide -blocking 1 -translation binary puts -nonewline $outSide $spdyHeaders chan pop $outSide @@ -387,7 +387,7 @@ test zlib-8.12 {transformation and fconfigure} -setup { } -constraints zlib -body { $strm put -dictionary $spdyDict -finalize $spdyHeaders zlib push decompress $inSide - fconfigure $outSide -blocking 0 -translation binary + fconfigure $outSide -blocking 1 -translation binary fconfigure $inSide -translation binary -dictionary $spdyDict puts -nonewline $outSide [$strm get] close $outSide @@ -404,7 +404,7 @@ test zlib-8.13 {transformation and fconfigure} -setup { } -constraints zlib -body { $strm put -dictionary $spdyDict -finalize $spdyHeaders zlib push decompress $inSide -dictionary $spdyDict - fconfigure $outSide -blocking 0 -translation binary + fconfigure $outSide -blocking 1 -translation binary fconfigure $inSide -translation binary puts -nonewline $outSide [$strm get] close $outSide @@ -421,7 +421,7 @@ test zlib-8.14 {transformation and fconfigure} -setup { } -constraints zlib -body { $strm put -finalize -dictionary $spdyDict $spdyHeaders zlib push inflate $inSide - fconfigure $outSide -blocking 0 -buffering none -translation binary + fconfigure $outSide -blocking 1 -buffering none -translation binary fconfigure $inSide -translation binary -dictionary $spdyDict puts -nonewline $outSide [$strm get] close $outSide @@ -437,7 +437,7 @@ test zlib-8.15 {transformation and fconfigure} -setup { } -constraints zlib -body { $strm put -finalize -dictionary $spdyDict $spdyHeaders zlib push inflate $inSide -dictionary $spdyDict - fconfigure $outSide -blocking 0 -buffering none -translation binary + fconfigure $outSide -blocking 1 -buffering none -translation binary fconfigure $inSide -translation binary puts -nonewline $outSide [$strm get] close $outSide -- cgit v0.12 -- cgit v0.12 From 9faad3da69bd700e51e75388518f53efd46cb32c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 12 Apr 2017 12:11:12 +0000 Subject: Another attempt to fix the two executable flags. --- library/clock.tcl | 0 win/tclWinFile.c | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 library/clock.tcl mode change 100755 => 100644 win/tclWinFile.c diff --git a/library/clock.tcl b/library/clock.tcl old mode 100755 new mode 100644 diff --git a/win/tclWinFile.c b/win/tclWinFile.c old mode 100755 new mode 100644 -- cgit v0.12 From 244e69a10ad133c5b1b878b0a8bb22537625762e Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 12 Apr 2017 13:14:38 +0000 Subject: Revert recent commit [80252e0aed]. TIP 237 is clear that %llu is invalid. --- generic/tclScan.c | 21 ++++++++------------- generic/tclStringObj.c | 14 +++++--------- tests/format.test | 6 ------ tests/scan.test | 13 ------------- 4 files changed, 13 insertions(+), 41 deletions(-) diff --git a/generic/tclScan.c b/generic/tclScan.c index 5ea7e46..3edb8be 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -10,7 +10,6 @@ */ #include "tclInt.h" -#include "tommath.h" /* * Flag values used by Tcl_ScanObjCmd. @@ -416,7 +415,14 @@ ValidateFormat( case 'x': case 'X': case 'b': + break; case 'u': + if (flags & SCAN_BIG) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "unsigned bignum scans are invalid", -1)); + Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADUNSIGNED",NULL); + goto error; + } break; /* * Bracket terms need special checking @@ -930,18 +936,7 @@ Tcl_ScanObjCmd( } else { Tcl_SetWideIntObj(objPtr, wideValue); } - } else if (flags & SCAN_BIG) { - if (flags & SCAN_UNSIGNED) { - mp_int big; - if ((Tcl_GetBignumFromObj(interp, objPtr, &big) != TCL_OK) - || (mp_cmp_d(&big, 0) == MP_LT)) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "unsigned bignum scans are invalid", -1)); - Tcl_SetErrorCode(interp, "TCL", "FORMAT", "BADUNSIGNED",NULL); - return TCL_ERROR; - } - } - } else { + } else if (!(flags & SCAN_BIG)) { if (TclGetLongFromObj(NULL, objPtr, &value) != TCL_OK) { if (TclGetString(objPtr)[0] == '-') { value = LONG_MIN; diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 6cce073..4e19750 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1943,6 +1943,11 @@ Tcl_AppendFormatToObj( } case 'u': + if (useBig) { + msg = "unsigned bignum format is invalid"; + errCode = "BADUNSIGNED"; + goto errorMsg; + } case 'd': case 'o': case 'x': @@ -1960,15 +1965,6 @@ Tcl_AppendFormatToObj( goto error; } isNegative = (mp_cmp_d(&big, 0) == MP_LT); - if (ch == 'u') { - if (isNegative) { - msg = "unsigned bignum format is invalid"; - errCode = "BADUNSIGNED"; - goto errorMsg; - } else { - ch = 'd'; - } - } #ifndef TCL_WIDE_INT_IS_LONG } else if (useWide) { if (Tcl_GetWideIntFromObj(NULL, segment, &w) != TCL_OK) { diff --git a/tests/format.test b/tests/format.test index dbf6af0..e199398 100644 --- a/tests/format.test +++ b/tests/format.test @@ -528,12 +528,6 @@ test format-17.3 {testing %ld with non-wide} {wideIs64bit} { test format-17.4 {testing %l with non-integer} { format %lf 1 } 1.000000 -test format-17.5 {testing %llu with bignum} { - format %llu 0xabcdef0123456789abcdef -} 207698809136909011942886895 -test format-17.6 {testing %llu with negative number} -body { - format %llu -1 -} -returnCodes 1 -result {unsigned bignum format is invalid} test format-18.1 {do not demote existing numeric values} { set a 0xaaaaaaaa diff --git a/tests/scan.test b/tests/scan.test index 8ddb595..7540c9c 100644 --- a/tests/scan.test +++ b/tests/scan.test @@ -541,19 +541,6 @@ test scan-5.15 {Bug be003d570f} { test scan-5.16 {Bug be003d570f} { scan 0x40 %b } 0 -test scan-5.17 {bigint scanning} -setup { - set a {}; set b {}; set c {}; set d {} -} -body { - list [scan "207698809136909011942886895,207698809136909011942886895,abcdef0123456789abcdef,125715736004432126361152746757" \ - %llu,%lld,%llx,%llo a b c d] $a $b $c $d -} -result {4 207698809136909011942886895 207698809136909011942886895 207698809136909011942886895 207698809136909011942886895} -test scan-5.18 {bigint scanning underflow} -setup { - set a {}; -} -body { - list [scan "-207698809136909011942886895" \ - %llu a] $a -} -returnCodes 1 -result {unsigned bignum scans are invalid} - test scan-6.1 {floating-point scanning} -setup { set a {}; set b {}; set c {}; set d {} -- cgit v0.12 From 5ba18ec98dfa4afe775a3f7a7caa8d55774d907d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 12 Apr 2017 13:43:15 +0000 Subject: If %llu is considered invalid, it means that "%" TCL_LL_MODIFIER "u" cannot be used Tcl_ObjPrintf(), but only in sprintf(). That's unfortunate, clearly an oversight in TIP #237. Conclusion: new TIP must be written to correct this. I'll read a TIP and see what case you have, but TCL_LL_MODIFIER was never meant to play any role in [format] or in Tcl_ObjPrintf(). TCL_LL_MODIFIER exists to help deal with platform differences in sprintf() calls. Tcl_ObjPrintf() in contrast ought to be consistent in its behavior across platforms and should not need such things. If that's false, then fixes to Tcl_ObjPrintf() are in order. --- generic/tclCkalloc.c | 2 +- generic/tclStringObj.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c index 3484a97..123d872 100644 --- a/generic/tclCkalloc.c +++ b/generic/tclCkalloc.c @@ -859,7 +859,7 @@ MemoryCmd( } if (strcmp(argv[1],"info") == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "%-25s %10u\n%-25s %10u\n%-25s %10u\n%-25s %10" TCL_LL_MODIFIER"u\n%-25s %10u\n%-25s %10" TCL_LL_MODIFIER "u\n", + "%-25s %10u\n%-25s %10u\n%-25s %10u\n%-25s %10" TCL_LL_MODIFIER"d\n%-25s %10u\n%-25s %10" TCL_LL_MODIFIER "d\n", "total mallocs", total_mallocs, "total frees", total_frees, "current packets allocated", current_malloc_packets, "current bytes allocated", (Tcl_WideInt)current_bytes_malloced, diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 560c169..7c898b7 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2780,7 +2780,7 @@ TclStringRepeat( if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "string size overflow: unable to alloc %" - TCL_LL_MODIFIER "u bytes", + TCL_LL_MODIFIER "d bytes", (Tcl_WideUInt)STRING_SIZE(count*length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } @@ -3004,7 +3004,7 @@ TclStringCatObjv( if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "concatenation failed: unable to alloc %" - TCL_LL_MODIFIER "u bytes", + TCL_LL_MODIFIER "d bytes", (Tcl_WideUInt)STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } @@ -3020,7 +3020,7 @@ TclStringCatObjv( if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "concatenation failed: unable to alloc %" - TCL_LL_MODIFIER "u bytes", + TCL_LL_MODIFIER "d bytes", (Tcl_WideUInt)STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } -- cgit v0.12 From ea1a2f3fbf4607b58ceffe3606b2d2e7e59e609f Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 12 Apr 2017 14:52:10 +0000 Subject: [win] fixes "wrong" checking of the flag TCL_CLOSE_READ in close2proc (using mask) --- win/tclWinPipe.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 87ce790..d303f8f 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1804,7 +1804,7 @@ PipeClose2Proc( errorCode = 0; result = 0; - if ((!flags || flags == TCL_CLOSE_READ) && (pipePtr->readFile != NULL)) { + if ((!flags || flags & TCL_CLOSE_READ) && (pipePtr->readFile != NULL)) { /* * Clean up the background thread if necessary. Note that this must be * done before we can close the file, since the thread may be blocking @@ -1824,8 +1824,7 @@ PipeClose2Proc( pipePtr->validMask &= ~TCL_READABLE; pipePtr->readFile = NULL; } - if ((!flags || flags & TCL_CLOSE_WRITE) - && (pipePtr->writeFile != NULL)) { + if ((!flags || flags & TCL_CLOSE_WRITE) && (pipePtr->writeFile != NULL)) { if (pipePtr->writeThread) { /* -- cgit v0.12 From 5b059dfd6b3afbaed367204e6b690a4dafb54908 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 12 Apr 2017 20:23:56 +0000 Subject: Bump msgcat and tcl tests and continue updates to changes. --- changes | 12 ++++++++++++ library/msgcat/msgcat.tcl | 2 +- library/msgcat/pkgIndex.tcl | 2 +- library/tcltest/pkgIndex.tcl | 2 +- library/tcltest/tcltest.tcl | 2 +- unix/Makefile.in | 8 ++++---- win/Makefile.in | 8 ++++---- 7 files changed, 24 insertions(+), 12 deletions(-) diff --git a/changes b/changes index c3a4be3..bf25784 100644 --- a/changes +++ b/changes @@ -8713,6 +8713,18 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2016-10-11 (bug)[3cc1d9] Thread finalization crash in zippy (neumann) +2016-10-12 (bug)[be003d] Fix [scan 0x1 %b], [scan 0x1 %o] (porter) + +2016-10-14 (bug)[eb6b68] Fix stringComp-14.5 (porter) + +2016-10-30 (bug)[b26e38] Fix zlib-7.8 (fellows) + +2016-10-30 (bug)[1ae129] Fix memleak in [history] destruction (fellows) + +2016-11-04 (feature) Provision Tcl 9 support in msgcat and tcltest (nijtmans) +=> msgcat 1.6.1 +=> tcltest 2.4.1 + diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 928474d..646bc17 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -14,7 +14,7 @@ package require Tcl 8.5- # When the version number changes, be sure to update the pkgIndex.tcl file, # and the installation directory in the Makefiles. -package provide msgcat 1.6.0 +package provide msgcat 1.6.1 namespace eval msgcat { namespace export mc mcexists mcload mclocale mcmax mcmset mcpreferences mcset\ diff --git a/library/msgcat/pkgIndex.tcl b/library/msgcat/pkgIndex.tcl index 7399c92..7cdb703 100644 --- a/library/msgcat/pkgIndex.tcl +++ b/library/msgcat/pkgIndex.tcl @@ -1,2 +1,2 @@ if {![package vsatisfies [package provide Tcl] 8.5]} {return} -package ifneeded msgcat 1.6.0 [list source [file join $dir msgcat.tcl]] +package ifneeded msgcat 1.6.1 [list source [file join $dir msgcat.tcl]] diff --git a/library/tcltest/pkgIndex.tcl b/library/tcltest/pkgIndex.tcl index 5ac8823..c9d3759 100644 --- a/library/tcltest/pkgIndex.tcl +++ b/library/tcltest/pkgIndex.tcl @@ -9,4 +9,4 @@ # full path name of this file's directory. if {![package vsatisfies [package provide Tcl] 8.5]} {return} -package ifneeded tcltest 2.4.0 [list source [file join $dir tcltest.tcl]] +package ifneeded tcltest 2.4.1 [list source [file join $dir tcltest.tcl]] diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index 75975d2..f1b6082 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -22,7 +22,7 @@ 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. - variable Version 2.4.0 + variable Version 2.4.1 # Compatibility support for dumb variables defined in tcltest 1 # Do not use these. Call [package provide Tcl] and [info patchlevel] diff --git a/unix/Makefile.in b/unix/Makefile.in index 9ad106c..e03e874 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -847,10 +847,10 @@ install-libraries: libraries do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/opt0.4; \ done; - @echo "Installing package msgcat 1.6.0 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.6.0.tm; - @echo "Installing package tcltest 2.4.0 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.4.0.tm; + @echo "Installing package msgcat 1.6.1 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.6.1.tm; + @echo "Installing package tcltest 2.4.1 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.4.1.tm; @echo "Installing package platform 1.0.14 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform-1.0.14.tm; diff --git a/win/Makefile.in b/win/Makefile.in index 0ab4204..255c9b4 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -658,10 +658,10 @@ install-libraries: libraries install-tzdata install-msgs do \ $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \ done; - @echo "Installing package msgcat 1.6.0 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.6.0.tm; - @echo "Installing package tcltest 2.4.0 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.4.0.tm; + @echo "Installing package msgcat 1.6.1 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.6.1.tm; + @echo "Installing package tcltest 2.4.1 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.4.1.tm; @echo "Installing package platform 1.0.14 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform-1.0.14.tm; @echo "Installing package platform::shell 1.1.4 as a Tcl Module"; -- cgit v0.12 From 6be0cf66e023bc64e38f0a037a3e74e5d31b18f7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 13 Apr 2017 12:20:37 +0000 Subject: Translate all \u???? sequences to their UTF-8 counterpart in *.msg files: It is faster during parsing (since no backslash-sequences have to be handled) and makes the msg-files better readable by humans. TODO: adapt tools/loadICU.tcl to generate UTF-8 in stead of those sequences. This tools seems to be out-of-date a long time already, I couldn't make it run with latest ICU. --- library/msgs/ar.msg | 84 ++++++++++++++++++++++----------------------- library/msgs/ar_jo.msg | 62 +++++++++++++++++----------------- library/msgs/ar_lb.msg | 62 +++++++++++++++++----------------- library/msgs/ar_sy.msg | 62 +++++++++++++++++----------------- library/msgs/be.msg | 80 +++++++++++++++++++++---------------------- library/msgs/bg.msg | 56 +++++++++++++++--------------- library/msgs/bn.msg | 80 +++++++++++++++++++++---------------------- library/msgs/ca.msg | 4 +-- library/msgs/cs.msg | 34 +++++++++---------- library/msgs/da.msg | 8 ++--- library/msgs/de.msg | 2 +- library/msgs/de_at.msg | 8 ++--- library/msgs/de_be.msg | 4 +-- library/msgs/el.msg | 80 +++++++++++++++++++++---------------------- library/msgs/eo.msg | 10 +++--- library/msgs/es.msg | 8 ++--- library/msgs/et.msg | 16 ++++----- library/msgs/fa.msg | 76 ++++++++++++++++++++--------------------- library/msgs/fa_in.msg | 80 +++++++++++++++++++++---------------------- library/msgs/fa_ir.msg | 8 ++--- library/msgs/fi.msg | 8 ++--- library/msgs/fo.msg | 18 +++++----- library/msgs/fr.msg | 12 +++---- library/msgs/ga.msg | 50 +++++++++++++-------------- library/msgs/gl.msg | 12 +++---- library/msgs/he.msg | 80 +++++++++++++++++++++---------------------- library/msgs/hi.msg | 64 +++++++++++++++++------------------ library/msgs/hr.msg | 12 +++---- library/msgs/hu.msg | 34 +++++++++---------- library/msgs/is.msg | 44 ++++++++++++------------ library/msgs/it.msg | 10 +++--- library/msgs/ja.msg | 68 ++++++++++++++++++------------------- library/msgs/ko.msg | 86 +++++++++++++++++++++++----------------------- library/msgs/ko_kr.msg | 4 +-- library/msgs/kok.msg | 66 ++++++++++++++++++------------------ library/msgs/lt.msg | 20 +++++------ library/msgs/lv.msg | 22 ++++++------ library/msgs/mk.msg | 80 +++++++++++++++++++++---------------------- library/msgs/mr.msg | 62 +++++++++++++++++----------------- library/msgs/mt.msg | 8 ++--- library/msgs/nb.msg | 8 ++--- library/msgs/nn.msg | 4 +-- library/msgs/pl.msg | 22 ++++++------ library/msgs/pt.msg | 8 ++--- library/msgs/ro.msg | 8 ++--- library/msgs/ru.msg | 80 +++++++++++++++++++++---------------------- library/msgs/sh.msg | 4 +-- library/msgs/sk.msg | 26 +++++++------- library/msgs/sl.msg | 6 ++-- library/msgs/sq.msg | 16 ++++----- library/msgs/sr.msg | 80 +++++++++++++++++++++---------------------- library/msgs/sv.msg | 12 +++---- library/msgs/ta.msg | 66 ++++++++++++++++++------------------ library/msgs/te.msg | 76 ++++++++++++++++++++--------------------- library/msgs/te_in.msg | 4 +-- library/msgs/th.msg | 84 ++++++++++++++++++++++----------------------- library/msgs/tr.msg | 24 ++++++------- library/msgs/uk.msg | 80 +++++++++++++++++++++---------------------- library/msgs/vi.msg | 38 ++++++++++----------- library/msgs/zh.msg | 92 +++++++++++++++++++++++++------------------------- library/msgs/zh_cn.msg | 2 +- library/msgs/zh_hk.msg | 42 +++++++++++------------ library/msgs/zh_sg.msg | 4 +-- library/msgs/zh_tw.msg | 4 +-- tools/loadICU.tcl | 3 ++ 65 files changed, 1190 insertions(+), 1187 deletions(-) diff --git a/library/msgs/ar.msg b/library/msgs/ar.msg index 257157f..2d403ec 100644 --- a/library/msgs/ar.msg +++ b/library/msgs/ar.msg @@ -1,53 +1,53 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ar DAYS_OF_WEEK_ABBREV [list \ - "\u062d"\ - "\u0646"\ - "\u062b"\ - "\u0631"\ - "\u062e"\ - "\u062c"\ - "\u0633"] + "Ø­"\ + "Ù†"\ + "Ø«"\ + "ر"\ + "Ø®"\ + "ج"\ + "س"] ::msgcat::mcset ar DAYS_OF_WEEK_FULL [list \ - "\u0627\u0644\u0623\u062d\u062f"\ - "\u0627\u0644\u0627\u062b\u0646\u064a\u0646"\ - "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621"\ - "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621"\ - "\u0627\u0644\u062e\u0645\u064a\u0633"\ - "\u0627\u0644\u062c\u0645\u0639\u0629"\ - "\u0627\u0644\u0633\u0628\u062a"] + "الأحد"\ + "الاثنين"\ + "الثلاثاء"\ + "الأربعاء"\ + "الخميس"\ + "الجمعة"\ + "السبت"] ::msgcat::mcset ar MONTHS_ABBREV [list \ - "\u064a\u0646\u0627"\ - "\u0641\u0628\u0631"\ - "\u0645\u0627\u0631"\ - "\u0623\u0628\u0631"\ - "\u0645\u0627\u064a"\ - "\u064a\u0648\u0646"\ - "\u064a\u0648\u0644"\ - "\u0623\u063a\u0633"\ - "\u0633\u0628\u062a"\ - "\u0623\u0643\u062a"\ - "\u0646\u0648\u0641"\ - "\u062f\u064a\u0633"\ + "ينا"\ + "ÙØ¨Ø±"\ + "مار"\ + "أبر"\ + "ماي"\ + "يون"\ + "يول"\ + "أغس"\ + "سبت"\ + "أكت"\ + "نوÙ"\ + "ديس"\ ""] ::msgcat::mcset ar MONTHS_FULL [list \ - "\u064a\u0646\u0627\u064a\u0631"\ - "\u0641\u0628\u0631\u0627\u064a\u0631"\ - "\u0645\u0627\u0631\u0633"\ - "\u0623\u0628\u0631\u064a\u0644"\ - "\u0645\u0627\u064a\u0648"\ - "\u064a\u0648\u0646\u064a\u0648"\ - "\u064a\u0648\u0644\u064a\u0648"\ - "\u0623\u063a\u0633\u0637\u0633"\ - "\u0633\u0628\u062a\u0645\u0628\u0631"\ - "\u0623\u0643\u062a\u0648\u0628\u0631"\ - "\u0646\u0648\u0641\u0645\u0628\u0631"\ - "\u062f\u064a\u0633\u0645\u0628\u0631"\ + "يناير"\ + "ÙØ¨Ø±Ø§ÙŠØ±"\ + "مارس"\ + "أبريل"\ + "مايو"\ + "يونيو"\ + "يوليو"\ + "أغسطس"\ + "سبتمبر"\ + "أكتوبر"\ + "نوÙمبر"\ + "ديسمبر"\ ""] - ::msgcat::mcset ar BCE "\u0642.\u0645" - ::msgcat::mcset ar CE "\u0645" - ::msgcat::mcset ar AM "\u0635" - ::msgcat::mcset ar PM "\u0645" + ::msgcat::mcset ar BCE "Ù‚.Ù…" + ::msgcat::mcset ar CE "Ù…" + ::msgcat::mcset ar AM "ص" + ::msgcat::mcset ar PM "Ù…" ::msgcat::mcset ar DATE_FORMAT "%d/%m/%Y" ::msgcat::mcset ar TIME_FORMAT_12 "%I:%M:%S %P" ::msgcat::mcset ar DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z" diff --git a/library/msgs/ar_jo.msg b/library/msgs/ar_jo.msg index 0f5e269..9a9dda0 100644 --- a/library/msgs/ar_jo.msg +++ b/library/msgs/ar_jo.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ar_JO DAYS_OF_WEEK_ABBREV [list \ - "\u0627\u0644\u0623\u062d\u062f"\ - "\u0627\u0644\u0627\u062b\u0646\u064a\u0646"\ - "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621"\ - "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621"\ - "\u0627\u0644\u062e\u0645\u064a\u0633"\ - "\u0627\u0644\u062c\u0645\u0639\u0629"\ - "\u0627\u0644\u0633\u0628\u062a"] + "الأحد"\ + "الاثنين"\ + "الثلاثاء"\ + "الأربعاء"\ + "الخميس"\ + "الجمعة"\ + "السبت"] ::msgcat::mcset ar_JO MONTHS_ABBREV [list \ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0634\u0628\u0627\u0637"\ - "\u0622\u0630\u0627\u0631"\ - "\u0646\u064a\u0633\u0627\u0646"\ - "\u0646\u0648\u0627\u0631"\ - "\u062d\u0632\u064a\u0631\u0627\u0646"\ - "\u062a\u0645\u0648\u0632"\ - "\u0622\u0628"\ - "\u0623\u064a\u0644\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "كانون الثاني"\ + "شباط"\ + "آذار"\ + "نيسان"\ + "نوار"\ + "حزيران"\ + "تموز"\ + "آب"\ + "أيلول"\ + "تشرين الأول"\ + "تشرين الثاني"\ + "كانون الأول"\ ""] ::msgcat::mcset ar_JO MONTHS_FULL [list \ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0634\u0628\u0627\u0637"\ - "\u0622\u0630\u0627\u0631"\ - "\u0646\u064a\u0633\u0627\u0646"\ - "\u0646\u0648\u0627\u0631"\ - "\u062d\u0632\u064a\u0631\u0627\u0646"\ - "\u062a\u0645\u0648\u0632"\ - "\u0622\u0628"\ - "\u0623\u064a\u0644\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "كانون الثاني"\ + "شباط"\ + "آذار"\ + "نيسان"\ + "نوار"\ + "حزيران"\ + "تموز"\ + "آب"\ + "أيلول"\ + "تشرين الأول"\ + "تشرين الثاني"\ + "كانون الأول"\ ""] } diff --git a/library/msgs/ar_lb.msg b/library/msgs/ar_lb.msg index e62acd3..c23aa2c 100644 --- a/library/msgs/ar_lb.msg +++ b/library/msgs/ar_lb.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ar_LB DAYS_OF_WEEK_ABBREV [list \ - "\u0627\u0644\u0623\u062d\u062f"\ - "\u0627\u0644\u0627\u062b\u0646\u064a\u0646"\ - "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621"\ - "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621"\ - "\u0627\u0644\u062e\u0645\u064a\u0633"\ - "\u0627\u0644\u062c\u0645\u0639\u0629"\ - "\u0627\u0644\u0633\u0628\u062a"] + "الأحد"\ + "الاثنين"\ + "الثلاثاء"\ + "الأربعاء"\ + "الخميس"\ + "الجمعة"\ + "السبت"] ::msgcat::mcset ar_LB MONTHS_ABBREV [list \ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0634\u0628\u0627\u0637"\ - "\u0622\u0630\u0627\u0631"\ - "\u0646\u064a\u0633\u0627\u0646"\ - "\u0646\u0648\u0627\u0631"\ - "\u062d\u0632\u064a\u0631\u0627\u0646"\ - "\u062a\u0645\u0648\u0632"\ - "\u0622\u0628"\ - "\u0623\u064a\u0644\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "كانون الثاني"\ + "شباط"\ + "آذار"\ + "نيسان"\ + "نوار"\ + "حزيران"\ + "تموز"\ + "آب"\ + "أيلول"\ + "تشرين الأول"\ + "تشرين الثاني"\ + "كانون الأول"\ ""] ::msgcat::mcset ar_LB MONTHS_FULL [list \ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0634\u0628\u0627\u0637"\ - "\u0622\u0630\u0627\u0631"\ - "\u0646\u064a\u0633\u0627\u0646"\ - "\u0646\u0648\u0627\u0631"\ - "\u062d\u0632\u064a\u0631\u0627\u0646"\ - "\u062a\u0645\u0648\u0632"\ - "\u0622\u0628"\ - "\u0623\u064a\u0644\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "كانون الثاني"\ + "شباط"\ + "آذار"\ + "نيسان"\ + "نوار"\ + "حزيران"\ + "تموز"\ + "آب"\ + "أيلول"\ + "تشرين الأول"\ + "تشرين الثاني"\ + "كانون الأول"\ ""] } diff --git a/library/msgs/ar_sy.msg b/library/msgs/ar_sy.msg index d5e1c87..f0daec0 100644 --- a/library/msgs/ar_sy.msg +++ b/library/msgs/ar_sy.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ar_SY DAYS_OF_WEEK_ABBREV [list \ - "\u0627\u0644\u0623\u062d\u062f"\ - "\u0627\u0644\u0627\u062b\u0646\u064a\u0646"\ - "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621"\ - "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621"\ - "\u0627\u0644\u062e\u0645\u064a\u0633"\ - "\u0627\u0644\u062c\u0645\u0639\u0629"\ - "\u0627\u0644\u0633\u0628\u062a"] + "الأحد"\ + "الاثنين"\ + "الثلاثاء"\ + "الأربعاء"\ + "الخميس"\ + "الجمعة"\ + "السبت"] ::msgcat::mcset ar_SY MONTHS_ABBREV [list \ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0634\u0628\u0627\u0637"\ - "\u0622\u0630\u0627\u0631"\ - "\u0646\u064a\u0633\u0627\u0646"\ - "\u0646\u0648\u0627\u0631"\ - "\u062d\u0632\u064a\u0631\u0627\u0646"\ - "\u062a\u0645\u0648\u0632"\ - "\u0622\u0628"\ - "\u0623\u064a\u0644\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "كانون الثاني"\ + "شباط"\ + "آذار"\ + "نيسان"\ + "نوار"\ + "حزيران"\ + "تموز"\ + "آب"\ + "أيلول"\ + "تشرين الأول"\ + "تشرين الثاني"\ + "كانون الأول"\ ""] ::msgcat::mcset ar_SY MONTHS_FULL [list \ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0634\u0628\u0627\u0637"\ - "\u0622\u0630\u0627\u0631"\ - "\u0646\u064a\u0633\u0627\u0646"\ - "\u0646\u0648\u0627\u0631\u0627\u0646"\ - "\u062d\u0632\u064a\u0631"\ - "\u062a\u0645\u0648\u0632"\ - "\u0622\u0628"\ - "\u0623\u064a\u0644\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ - "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ - "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "كانون الثاني"\ + "شباط"\ + "آذار"\ + "نيسان"\ + "نواران"\ + "حزير"\ + "تموز"\ + "آب"\ + "أيلول"\ + "تشرين الأول"\ + "تشرين الثاني"\ + "كانون الأول"\ ""] } diff --git a/library/msgs/be.msg b/library/msgs/be.msg index 379a1d7..a0aceed 100644 --- a/library/msgs/be.msg +++ b/library/msgs/be.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset be DAYS_OF_WEEK_ABBREV [list \ - "\u043d\u0434"\ - "\u043f\u043d"\ - "\u0430\u0442"\ - "\u0441\u0440"\ - "\u0447\u0446"\ - "\u043f\u0442"\ - "\u0441\u0431"] + "нд"\ + "пн"\ + "ат"\ + "ÑÑ€"\ + "чц"\ + "пт"\ + "Ñб"] ::msgcat::mcset be DAYS_OF_WEEK_FULL [list \ - "\u043d\u044f\u0434\u0437\u0435\u043b\u044f"\ - "\u043f\u0430\u043d\u044f\u0434\u0437\u0435\u043b\u0430\u043a"\ - "\u0430\u045e\u0442\u043e\u0440\u0430\u043a"\ - "\u0441\u0435\u0440\u0430\u0434\u0430"\ - "\u0447\u0430\u0446\u0432\u0435\u0440"\ - "\u043f\u044f\u0442\u043d\u0456\u0446\u0430"\ - "\u0441\u0443\u0431\u043e\u0442\u0430"] + "нÑдзелÑ"\ + "панÑдзелак"\ + "аўторак"\ + "Ñерада"\ + "чацвер"\ + "пÑтніца"\ + "Ñубота"] ::msgcat::mcset be MONTHS_ABBREV [list \ - "\u0441\u0442\u0434"\ - "\u043b\u044e\u0442"\ - "\u0441\u043a\u0432"\ - "\u043a\u0440\u0441"\ - "\u043c\u0430\u0439"\ - "\u0447\u0440\u0432"\ - "\u043b\u043f\u043d"\ - "\u0436\u043d\u0432"\ - "\u0432\u0440\u0441"\ - "\u043a\u0441\u0442"\ - "\u043b\u0441\u0442"\ - "\u0441\u043d\u0436"\ + "Ñтд"\ + "лют"\ + "Ñкв"\ + "крÑ"\ + "май"\ + "чрв"\ + "лпн"\ + "жнв"\ + "врÑ"\ + "кÑÑ‚"\ + "лÑÑ‚"\ + "Ñнж"\ ""] ::msgcat::mcset be MONTHS_FULL [list \ - "\u0441\u0442\u0443\u0434\u0437\u0435\u043d\u044f"\ - "\u043b\u044e\u0442\u0430\u0433\u0430"\ - "\u0441\u0430\u043a\u0430\u0432\u0456\u043a\u0430"\ - "\u043a\u0440\u0430\u0441\u0430\u0432\u0456\u043a\u0430"\ - "\u043c\u0430\u044f"\ - "\u0447\u0440\u0432\u0435\u043d\u044f"\ - "\u043b\u0456\u043f\u0435\u043d\u044f"\ - "\u0436\u043d\u0456\u045e\u043d\u044f"\ - "\u0432\u0435\u0440\u0430\u0441\u043d\u044f"\ - "\u043a\u0430\u0441\u0442\u0440\u044b\u0447\u043d\u0456\u043a\u0430"\ - "\u043b\u0438\u0441\u0442\u0430\u043f\u0430\u0434\u0430"\ - "\u0441\u043d\u0435\u0436\u043d\u044f"\ + "ÑтудзенÑ"\ + "лютага"\ + "Ñакавіка"\ + "краÑавіка"\ + "маÑ"\ + "чрвенÑ"\ + "ліпенÑ"\ + "жніўнÑ"\ + "вераÑнÑ"\ + "каÑтрычніка"\ + "лиÑтапада"\ + "ÑнежнÑ"\ ""] - ::msgcat::mcset be BCE "\u0434\u0430 \u043d.\u0435." - ::msgcat::mcset be CE "\u043d.\u0435." + ::msgcat::mcset be BCE "да н.е." + ::msgcat::mcset be CE "н.е." ::msgcat::mcset be DATE_FORMAT "%e.%m.%Y" ::msgcat::mcset be TIME_FORMAT "%k.%M.%S" ::msgcat::mcset be DATE_TIME_FORMAT "%e.%m.%Y %k.%M.%S %z" diff --git a/library/msgs/bg.msg b/library/msgs/bg.msg index ff17759..2e7730d 100644 --- a/library/msgs/bg.msg +++ b/library/msgs/bg.msg @@ -1,21 +1,21 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset bg DAYS_OF_WEEK_ABBREV [list \ - "\u041d\u0434"\ - "\u041f\u043d"\ - "\u0412\u0442"\ - "\u0421\u0440"\ - "\u0427\u0442"\ - "\u041f\u0442"\ - "\u0421\u0431"] + "Ðд"\ + "Пн"\ + "Ð’Ñ‚"\ + "Ср"\ + "Чт"\ + "Пт"\ + "Сб"] ::msgcat::mcset bg DAYS_OF_WEEK_FULL [list \ - "\u041d\u0435\u0434\u0435\u043b\u044f"\ - "\u041f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a"\ - "\u0412\u0442\u043e\u0440\u043d\u0438\u043a"\ - "\u0421\u0440\u044f\u0434\u0430"\ - "\u0427\u0435\u0442\u0432\u044a\u0440\u0442\u044a\u043a"\ - "\u041f\u0435\u0442\u044a\u043a"\ - "\u0421\u044a\u0431\u043e\u0442\u0430"] + "ÐеделÑ"\ + "Понеделник"\ + "Вторник"\ + "СрÑда"\ + "Четвъртък"\ + "Петък"\ + "Събота"] ::msgcat::mcset bg MONTHS_ABBREV [list \ "I"\ "II"\ @@ -31,21 +31,21 @@ namespace eval ::tcl::clock { "XII"\ ""] ::msgcat::mcset bg MONTHS_FULL [list \ - "\u042f\u043d\u0443\u0430\u0440\u0438"\ - "\u0424\u0435\u0432\u0440\u0443\u0430\u0440\u0438"\ - "\u041c\u0430\u0440\u0442"\ - "\u0410\u043f\u0440\u0438\u043b"\ - "\u041c\u0430\u0439"\ - "\u042e\u043d\u0438"\ - "\u042e\u043b\u0438"\ - "\u0410\u0432\u0433\u0443\u0441\u0442"\ - "\u0421\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438"\ - "\u041e\u043a\u0442\u043e\u043c\u0432\u0440\u0438"\ - "\u041d\u043e\u0435\u043c\u0432\u0440\u0438"\ - "\u0414\u0435\u043a\u0435\u043c\u0432\u0440\u0438"\ + "Януари"\ + "Февруари"\ + "Март"\ + "Ðприл"\ + "Май"\ + "Юни"\ + "Юли"\ + "ÐвгуÑÑ‚"\ + "Септември"\ + "Октомври"\ + "Ðоември"\ + "Декември"\ ""] - ::msgcat::mcset bg BCE "\u043f\u0440.\u043d.\u0435." - ::msgcat::mcset bg CE "\u043d.\u0435." + ::msgcat::mcset bg BCE "пр.н.е." + ::msgcat::mcset bg CE "н.е." ::msgcat::mcset bg DATE_FORMAT "%Y-%m-%e" ::msgcat::mcset bg TIME_FORMAT "%k:%M:%S" ::msgcat::mcset bg DATE_TIME_FORMAT "%Y-%m-%e %k:%M:%S %z" diff --git a/library/msgs/bn.msg b/library/msgs/bn.msg index 664b9d8..a0aef13 100644 --- a/library/msgs/bn.msg +++ b/library/msgs/bn.msg @@ -1,49 +1,49 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset bn DAYS_OF_WEEK_ABBREV [list \ - "\u09b0\u09ac\u09bf"\ - "\u09b8\u09cb\u09ae"\ - "\u09ae\u0999\u0997\u09b2"\ - "\u09ac\u09c1\u09a7"\ - "\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf"\ - "\u09b6\u09c1\u0995\u09cd\u09b0"\ - "\u09b6\u09a8\u09bf"] + "রবি"\ + "সোম"\ + "মঙগল"\ + "বà§à¦§"\ + "বৃহসà§à¦ªà¦¤à¦¿"\ + "শà§à¦•à§à¦°"\ + "শনি"] ::msgcat::mcset bn DAYS_OF_WEEK_FULL [list \ - "\u09b0\u09ac\u09bf\u09ac\u09be\u09b0"\ - "\u09b8\u09cb\u09ae\u09ac\u09be\u09b0"\ - "\u09ae\u0999\u0997\u09b2\u09ac\u09be\u09b0"\ - "\u09ac\u09c1\u09a7\u09ac\u09be\u09b0"\ - "\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf\u09ac\u09be\u09b0"\ - "\u09b6\u09c1\u0995\u09cd\u09b0\u09ac\u09be\u09b0"\ - "\u09b6\u09a8\u09bf\u09ac\u09be\u09b0"] + "রবিবার"\ + "সোমবার"\ + "মঙগলবার"\ + "বà§à¦§à¦¬à¦¾à¦°"\ + "বৃহসà§à¦ªà¦¤à¦¿à¦¬à¦¾à¦°"\ + "শà§à¦•à§à¦°à¦¬à¦¾à¦°"\ + "শনিবার"] ::msgcat::mcset bn MONTHS_ABBREV [list \ - "\u099c\u09be\u09a8\u09c1\u09df\u09be\u09b0\u09c0"\ - "\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09df\u09be\u09b0\u09c0"\ - "\u09ae\u09be\u09b0\u09cd\u099a"\ - "\u098f\u09aa\u09cd\u09b0\u09bf\u09b2"\ - "\u09ae\u09c7"\ - "\u099c\u09c1\u09a8"\ - "\u099c\u09c1\u09b2\u09be\u0987"\ - "\u0986\u0997\u09b8\u09cd\u099f"\ - "\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0"\ - "\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0"\ - "\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0"\ - "\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0"\ + "জানà§à§Ÿà¦¾à¦°à§€"\ + "ফেবà§à¦°à§à§Ÿà¦¾à¦°à§€"\ + "মারà§à¦š"\ + "à¦à¦ªà§à¦°à¦¿à¦²"\ + "মে"\ + "জà§à¦¨"\ + "জà§à¦²à¦¾à¦‡"\ + "আগসà§à¦Ÿ"\ + "সেপà§à¦Ÿà§‡à¦®à§à¦¬à¦°"\ + "অকà§à¦Ÿà§‹à¦¬à¦°"\ + "নভেমà§à¦¬à¦°"\ + "ডিসেমà§à¦¬à¦°"\ ""] ::msgcat::mcset bn MONTHS_FULL [list \ - "\u099c\u09be\u09a8\u09c1\u09df\u09be\u09b0\u09c0"\ - "\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09df\u09be\u09b0\u09c0"\ - "\u09ae\u09be\u09b0\u09cd\u099a"\ - "\u098f\u09aa\u09cd\u09b0\u09bf\u09b2"\ - "\u09ae\u09c7"\ - "\u099c\u09c1\u09a8"\ - "\u099c\u09c1\u09b2\u09be\u0987"\ - "\u0986\u0997\u09b8\u09cd\u099f"\ - "\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0"\ - "\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0"\ - "\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0"\ - "\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0"\ + "জানà§à§Ÿà¦¾à¦°à§€"\ + "ফেবà§à¦°à§à§Ÿà¦¾à¦°à§€"\ + "মারà§à¦š"\ + "à¦à¦ªà§à¦°à¦¿à¦²"\ + "মে"\ + "জà§à¦¨"\ + "জà§à¦²à¦¾à¦‡"\ + "আগসà§à¦Ÿ"\ + "সেপà§à¦Ÿà§‡à¦®à§à¦¬à¦°"\ + "অকà§à¦Ÿà§‹à¦¬à¦°"\ + "নভেমà§à¦¬à¦°"\ + "ডিসেমà§à¦¬à¦°"\ ""] - ::msgcat::mcset bn AM "\u09aa\u09c2\u09b0\u09cd\u09ac\u09be\u09b9\u09cd\u09a3" - ::msgcat::mcset bn PM "\u0985\u09aa\u09b0\u09be\u09b9\u09cd\u09a3" + ::msgcat::mcset bn AM "পূরà§à¦¬à¦¾à¦¹à§à¦£" + ::msgcat::mcset bn PM "অপরাহà§à¦£" } diff --git a/library/msgs/ca.msg b/library/msgs/ca.msg index 36c9772..272f682 100644 --- a/library/msgs/ca.msg +++ b/library/msgs/ca.msg @@ -19,7 +19,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset ca MONTHS_ABBREV [list \ "gen."\ "feb."\ - "mar\u00e7"\ + "març"\ "abr."\ "maig"\ "juny"\ @@ -33,7 +33,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset ca MONTHS_FULL [list \ "gener"\ "febrer"\ - "mar\u00e7"\ + "març"\ "abril"\ "maig"\ "juny"\ diff --git a/library/msgs/cs.msg b/library/msgs/cs.msg index 8db8bdd..4673cd4 100644 --- a/library/msgs/cs.msg +++ b/library/msgs/cs.msg @@ -3,18 +3,18 @@ namespace eval ::tcl::clock { ::msgcat::mcset cs DAYS_OF_WEEK_ABBREV [list \ "Ne"\ "Po"\ - "\u00dat"\ + "Út"\ "St"\ - "\u010ct"\ - "P\u00e1"\ + "ÄŒt"\ + "Pá"\ "So"] ::msgcat::mcset cs DAYS_OF_WEEK_FULL [list \ - "Ned\u011ble"\ - "Pond\u011bl\u00ed"\ - "\u00dater\u00fd"\ - "St\u0159eda"\ - "\u010ctvrtek"\ - "P\u00e1tek"\ + "NedÄ›le"\ + "PondÄ›lí"\ + "Úterý"\ + "StÅ™eda"\ + "ÄŒtvrtek"\ + "Pátek"\ "Sobota"] ::msgcat::mcset cs MONTHS_ABBREV [list \ "I"\ @@ -32,19 +32,19 @@ namespace eval ::tcl::clock { ""] ::msgcat::mcset cs MONTHS_FULL [list \ "leden"\ - "\u00fanor"\ - "b\u0159ezen"\ + "únor"\ + "bÅ™ezen"\ "duben"\ - "kv\u011bten"\ - "\u010derven"\ - "\u010dervenec"\ + "kvÄ›ten"\ + "Äerven"\ + "Äervenec"\ "srpen"\ - "z\u00e1\u0159\u00ed"\ - "\u0159\u00edjen"\ + "září"\ + "říjen"\ "listopad"\ "prosinec"\ ""] - ::msgcat::mcset cs BCE "p\u0159.Kr." + ::msgcat::mcset cs BCE "pÅ™.Kr." ::msgcat::mcset cs CE "po Kr." ::msgcat::mcset cs AM "dop." ::msgcat::mcset cs PM "odp." diff --git a/library/msgs/da.msg b/library/msgs/da.msg index e4fec7f..abed3c5 100644 --- a/library/msgs/da.msg +++ b/library/msgs/da.msg @@ -1,21 +1,21 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset da DAYS_OF_WEEK_ABBREV [list \ - "s\u00f8"\ + "sø"\ "ma"\ "ti"\ "on"\ "to"\ "fr"\ - "l\u00f8"] + "lø"] ::msgcat::mcset da DAYS_OF_WEEK_FULL [list \ - "s\u00f8ndag"\ + "søndag"\ "mandag"\ "tirsdag"\ "onsdag"\ "torsdag"\ "fredag"\ - "l\u00f8rdag"] + "lørdag"] ::msgcat::mcset da MONTHS_ABBREV [list \ "jan"\ "feb"\ diff --git a/library/msgs/de.msg b/library/msgs/de.msg index 9eb3145..0bb7399 100644 --- a/library/msgs/de.msg +++ b/library/msgs/de.msg @@ -33,7 +33,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset de MONTHS_FULL [list \ "Januar"\ "Februar"\ - "M\u00e4rz"\ + "März"\ "April"\ "Mai"\ "Juni"\ diff --git a/library/msgs/de_at.msg b/library/msgs/de_at.msg index 61bc266..1a0a0f5 100644 --- a/library/msgs/de_at.msg +++ b/library/msgs/de_at.msg @@ -1,9 +1,9 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset de_AT MONTHS_ABBREV [list \ - "J\u00e4n"\ + "Jän"\ "Feb"\ - "M\u00e4r"\ + "Mär"\ "Apr"\ "Mai"\ "Jun"\ @@ -15,9 +15,9 @@ namespace eval ::tcl::clock { "Dez"\ ""] ::msgcat::mcset de_AT MONTHS_FULL [list \ - "J\u00e4nner"\ + "Jänner"\ "Februar"\ - "M\u00e4rz"\ + "März"\ "April"\ "Mai"\ "Juni"\ diff --git a/library/msgs/de_be.msg b/library/msgs/de_be.msg index 3614763..04cf88c 100644 --- a/library/msgs/de_be.msg +++ b/library/msgs/de_be.msg @@ -19,7 +19,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset de_BE MONTHS_ABBREV [list \ "Jan"\ "Feb"\ - "M\u00e4r"\ + "Mär"\ "Apr"\ "Mai"\ "Jun"\ @@ -33,7 +33,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset de_BE MONTHS_FULL [list \ "Januar"\ "Februar"\ - "M\u00e4rz"\ + "März"\ "April"\ "Mai"\ "Juni"\ diff --git a/library/msgs/el.msg b/library/msgs/el.msg index ac19f62..26bdfe9 100644 --- a/library/msgs/el.msg +++ b/library/msgs/el.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset el DAYS_OF_WEEK_ABBREV [list \ - "\u039a\u03c5\u03c1"\ - "\u0394\u03b5\u03c5"\ - "\u03a4\u03c1\u03b9"\ - "\u03a4\u03b5\u03c4"\ - "\u03a0\u03b5\u03bc"\ - "\u03a0\u03b1\u03c1"\ - "\u03a3\u03b1\u03b2"] + "ΚυÏ"\ + "Δευ"\ + "ΤÏι"\ + "Τετ"\ + "Πεμ"\ + "ΠαÏ"\ + "Σαβ"] ::msgcat::mcset el DAYS_OF_WEEK_FULL [list \ - "\u039a\u03c5\u03c1\u03b9\u03b1\u03ba\u03ae"\ - "\u0394\u03b5\u03c5\u03c4\u03ad\u03c1\u03b1"\ - "\u03a4\u03c1\u03af\u03c4\u03b7"\ - "\u03a4\u03b5\u03c4\u03ac\u03c1\u03c4\u03b7"\ - "\u03a0\u03ad\u03bc\u03c0\u03c4\u03b7"\ - "\u03a0\u03b1\u03c1\u03b1\u03c3\u03ba\u03b5\u03c5\u03ae"\ - "\u03a3\u03ac\u03b2\u03b2\u03b1\u03c4\u03bf"] + "ΚυÏιακή"\ + "ΔευτέÏα"\ + "ΤÏίτη"\ + "ΤετάÏτη"\ + "Πέμπτη"\ + "ΠαÏασκευή"\ + "Σάββατο"] ::msgcat::mcset el MONTHS_ABBREV [list \ - "\u0399\u03b1\u03bd"\ - "\u03a6\u03b5\u03b2"\ - "\u039c\u03b1\u03c1"\ - "\u0391\u03c0\u03c1"\ - "\u039c\u03b1\u03ca"\ - "\u0399\u03bf\u03c5\u03bd"\ - "\u0399\u03bf\u03c5\u03bb"\ - "\u0391\u03c5\u03b3"\ - "\u03a3\u03b5\u03c0"\ - "\u039f\u03ba\u03c4"\ - "\u039d\u03bf\u03b5"\ - "\u0394\u03b5\u03ba"\ + "Ιαν"\ + "Φεβ"\ + "ΜαÏ"\ + "ΑπÏ"\ + "Μαϊ"\ + "Ιουν"\ + "Ιουλ"\ + "Αυγ"\ + "Σεπ"\ + "Οκτ"\ + "Îοε"\ + "Δεκ"\ ""] ::msgcat::mcset el MONTHS_FULL [list \ - "\u0399\u03b1\u03bd\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2"\ - "\u03a6\u03b5\u03b2\u03c1\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2"\ - "\u039c\u03ac\u03c1\u03c4\u03b9\u03bf\u03c2"\ - "\u0391\u03c0\u03c1\u03af\u03bb\u03b9\u03bf\u03c2"\ - "\u039c\u03ac\u03ca\u03bf\u03c2"\ - "\u0399\u03bf\u03cd\u03bd\u03b9\u03bf\u03c2"\ - "\u0399\u03bf\u03cd\u03bb\u03b9\u03bf\u03c2"\ - "\u0391\u03cd\u03b3\u03bf\u03c5\u03c3\u03c4\u03bf\u03c2"\ - "\u03a3\u03b5\u03c0\u03c4\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2"\ - "\u039f\u03ba\u03c4\u03ce\u03b2\u03c1\u03b9\u03bf\u03c2"\ - "\u039d\u03bf\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2"\ - "\u0394\u03b5\u03ba\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2"\ + "ΙανουάÏιος"\ + "ΦεβÏουάÏιος"\ + "ΜάÏτιος"\ + "ΑπÏίλιος"\ + "Μάϊος"\ + "ΙοÏνιος"\ + "ΙοÏλιος"\ + "ΑÏγουστος"\ + "ΣεπτέμβÏιος"\ + "ΟκτώβÏιος"\ + "ÎοέμβÏιος"\ + "ΔεκέμβÏιος"\ ""] - ::msgcat::mcset el AM "\u03c0\u03bc" - ::msgcat::mcset el PM "\u03bc\u03bc" + ::msgcat::mcset el AM "πμ" + ::msgcat::mcset el PM "μμ" ::msgcat::mcset el DATE_FORMAT "%e/%m/%Y" ::msgcat::mcset el TIME_FORMAT_12 "%l:%M:%S %P" ::msgcat::mcset el DATE_TIME_FORMAT "%e/%m/%Y %l:%M:%S %P %z" diff --git a/library/msgs/eo.msg b/library/msgs/eo.msg index 1d2a24f..b9b1500 100644 --- a/library/msgs/eo.msg +++ b/library/msgs/eo.msg @@ -5,15 +5,15 @@ namespace eval ::tcl::clock { "lu"\ "ma"\ "me"\ - "\u0135a"\ + "ĵa"\ "ve"\ "sa"] ::msgcat::mcset eo DAYS_OF_WEEK_FULL [list \ - "diman\u0109o"\ + "dimanĉo"\ "lundo"\ "mardo"\ "merkredo"\ - "\u0135a\u016ddo"\ + "ĵaÅ­do"\ "vendredo"\ "sabato"] ::msgcat::mcset eo MONTHS_ABBREV [list \ @@ -24,7 +24,7 @@ namespace eval ::tcl::clock { "maj"\ "jun"\ "jul"\ - "a\u016dg"\ + "aÅ­g"\ "sep"\ "okt"\ "nov"\ @@ -38,7 +38,7 @@ namespace eval ::tcl::clock { "majo"\ "junio"\ "julio"\ - "a\u016dgusto"\ + "aÅ­gusto"\ "septembro"\ "oktobro"\ "novembro"\ diff --git a/library/msgs/es.msg b/library/msgs/es.msg index a24f0a1..6090eab 100644 --- a/library/msgs/es.msg +++ b/library/msgs/es.msg @@ -4,18 +4,18 @@ namespace eval ::tcl::clock { "dom"\ "lun"\ "mar"\ - "mi\u00e9"\ + "mié"\ "jue"\ "vie"\ - "s\u00e1b"] + "sáb"] ::msgcat::mcset es DAYS_OF_WEEK_FULL [list \ "domingo"\ "lunes"\ "martes"\ - "mi\u00e9rcoles"\ + "miércoles"\ "jueves"\ "viernes"\ - "s\u00e1bado"] + "sábado"] ::msgcat::mcset es MONTHS_ABBREV [list \ "ene"\ "feb"\ diff --git a/library/msgs/et.msg b/library/msgs/et.msg index 8d32e9e..a782f9b 100644 --- a/library/msgs/et.msg +++ b/library/msgs/et.msg @@ -9,17 +9,17 @@ namespace eval ::tcl::clock { "R"\ "L"] ::msgcat::mcset et DAYS_OF_WEEK_FULL [list \ - "p\u00fchap\u00e4ev"\ - "esmasp\u00e4ev"\ - "teisip\u00e4ev"\ - "kolmap\u00e4ev"\ - "neljap\u00e4ev"\ + "pühapäev"\ + "esmaspäev"\ + "teisipäev"\ + "kolmapäev"\ + "neljapäev"\ "reede"\ - "laup\u00e4ev"] + "laupäev"] ::msgcat::mcset et MONTHS_ABBREV [list \ "Jaan"\ "Veebr"\ - "M\u00e4rts"\ + "Märts"\ "Apr"\ "Mai"\ "Juuni"\ @@ -33,7 +33,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset et MONTHS_FULL [list \ "Jaanuar"\ "Veebruar"\ - "M\u00e4rts"\ + "Märts"\ "Aprill"\ "Mai"\ "Juuni"\ diff --git a/library/msgs/fa.msg b/library/msgs/fa.msg index 89b2f90..6166e28 100644 --- a/library/msgs/fa.msg +++ b/library/msgs/fa.msg @@ -1,47 +1,47 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset fa DAYS_OF_WEEK_ABBREV [list \ - "\u06cc\u2214"\ - "\u062f\u2214"\ - "\u0633\u2214"\ - "\u0686\u2214"\ - "\u067e\u2214"\ - "\u062c\u2214"\ - "\u0634\u2214"] + "ی∔"\ + "د∔"\ + "س∔"\ + "چ∔"\ + "پ∔"\ + "ج∔"\ + "ش∔"] ::msgcat::mcset fa DAYS_OF_WEEK_FULL [list \ - "\u06cc\u06cc\u200c\u0634\u0646\u0628\u0647"\ - "\u062f\u0648\u0634\u0646\u0628\u0647"\ - "\u0633\u0647\u200c\u0634\u0646\u0628\u0647"\ - "\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647"\ - "\u067e\u0646\u062c\u200c\u0634\u0646\u0628\u0647"\ - "\u062c\u0645\u0639\u0647"\ - "\u0634\u0646\u0628\u0647"] + "یی‌شنبه"\ + "دوشنبه"\ + "سه‌شنبه"\ + "چهارشنبه"\ + "پنج‌شنبه"\ + "جمعه"\ + "شنبه"] ::msgcat::mcset fa MONTHS_ABBREV [list \ - "\u0698\u0627\u0646"\ - "\u0641\u0648\u0631"\ - "\u0645\u0627\u0631"\ - "\u0622\u0648\u0631"\ - "\u0645\u0640\u0647"\ - "\u0698\u0648\u0646"\ - "\u0698\u0648\u06cc"\ - "\u0627\u0648\u062a"\ - "\u0633\u067e\u062a"\ - "\u0627\u0643\u062a"\ - "\u0646\u0648\u0627"\ - "\u062f\u0633\u0627"\ + "ژان"\ + "Ùور"\ + "مار"\ + "آور"\ + "مـه"\ + "ژون"\ + "Ú˜ÙˆÛŒ"\ + "اوت"\ + "سپت"\ + "اكت"\ + "نوا"\ + "دسا"\ ""] ::msgcat::mcset fa MONTHS_FULL [list \ - "\u0698\u0627\u0646\u0648\u06cc\u0647"\ - "\u0641\u0648\u0631\u0648\u06cc\u0647"\ - "\u0645\u0627\u0631\u0633"\ - "\u0622\u0648\u0631\u06cc\u0644"\ - "\u0645\u0647"\ - "\u0698\u0648\u0626\u0646"\ - "\u0698\u0648\u0626\u06cc\u0647"\ - "\u0627\u0648\u062a"\ - "\u0633\u067e\u062a\u0627\u0645\u0628\u0631"\ - "\u0627\u0643\u062a\u0628\u0631"\ - "\u0646\u0648\u0627\u0645\u0628\u0631"\ - "\u062f\u0633\u0627\u0645\u0628\u0631"\ + "ژانویه"\ + "Ùورویه"\ + "مارس"\ + "آوریل"\ + "مه"\ + "ژوئن"\ + "ژوئیه"\ + "اوت"\ + "سپتامبر"\ + "اكتبر"\ + "نوامبر"\ + "دسامبر"\ ""] } diff --git a/library/msgs/fa_in.msg b/library/msgs/fa_in.msg index adc9e91..ce32f99 100644 --- a/library/msgs/fa_in.msg +++ b/library/msgs/fa_in.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset fa_IN DAYS_OF_WEEK_ABBREV [list \ - "\u06cc\u2214"\ - "\u062f\u2214"\ - "\u0633\u2214"\ - "\u0686\u2214"\ - "\u067e\u2214"\ - "\u062c\u2214"\ - "\u0634\u2214"] + "ی∔"\ + "د∔"\ + "س∔"\ + "چ∔"\ + "پ∔"\ + "ج∔"\ + "ش∔"] ::msgcat::mcset fa_IN DAYS_OF_WEEK_FULL [list \ - "\u06cc\u06cc\u200c\u0634\u0646\u0628\u0647"\ - "\u062f\u0648\u0634\u0646\u0628\u0647"\ - "\u0633\u0647\u200c\u0634\u0646\u0628\u0647"\ - "\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647"\ - "\u067e\u0646\u062c\u200c\u0634\u0646\u0628\u0647"\ - "\u062c\u0645\u0639\u0647"\ - "\u0634\u0646\u0628\u0647"] + "یی‌شنبه"\ + "دوشنبه"\ + "سه‌شنبه"\ + "چهارشنبه"\ + "پنج‌شنبه"\ + "جمعه"\ + "شنبه"] ::msgcat::mcset fa_IN MONTHS_ABBREV [list \ - "\u0698\u0627\u0646"\ - "\u0641\u0648\u0631"\ - "\u0645\u0627\u0631"\ - "\u0622\u0648\u0631"\ - "\u0645\u0640\u0647"\ - "\u0698\u0648\u0646"\ - "\u0698\u0648\u06cc"\ - "\u0627\u0648\u062a"\ - "\u0633\u067e\u062a"\ - "\u0627\u0643\u062a"\ - "\u0646\u0648\u0627"\ - "\u062f\u0633\u0627"\ + "ژان"\ + "Ùور"\ + "مار"\ + "آور"\ + "مـه"\ + "ژون"\ + "Ú˜ÙˆÛŒ"\ + "اوت"\ + "سپت"\ + "اكت"\ + "نوا"\ + "دسا"\ ""] ::msgcat::mcset fa_IN MONTHS_FULL [list \ - "\u0698\u0627\u0646\u0648\u06cc\u0647"\ - "\u0641\u0648\u0631\u0648\u06cc\u0647"\ - "\u0645\u0627\u0631\u0633"\ - "\u0622\u0648\u0631\u06cc\u0644"\ - "\u0645\u0647"\ - "\u0698\u0648\u0626\u0646"\ - "\u0698\u0648\u0626\u06cc\u0647"\ - "\u0627\u0648\u062a"\ - "\u0633\u067e\u062a\u0627\u0645\u0628\u0631"\ - "\u0627\u0643\u062a\u0628\u0631"\ - "\u0646\u0648\u0627\u0645\u0628\u0631"\ - "\u062f\u0633\u0627\u0645\u0628\u0631"\ + "ژانویه"\ + "Ùورویه"\ + "مارس"\ + "آوریل"\ + "مه"\ + "ژوئن"\ + "ژوئیه"\ + "اوت"\ + "سپتامبر"\ + "اكتبر"\ + "نوامبر"\ + "دسامبر"\ ""] - ::msgcat::mcset fa_IN AM "\u0635\u0628\u062d" - ::msgcat::mcset fa_IN PM "\u0639\u0635\u0631" + ::msgcat::mcset fa_IN AM "صبح" + ::msgcat::mcset fa_IN PM "عصر" ::msgcat::mcset fa_IN DATE_FORMAT "%A %d %B %Y" ::msgcat::mcset fa_IN TIME_FORMAT_12 "%I:%M:%S %z" ::msgcat::mcset fa_IN DATE_TIME_FORMAT "%A %d %B %Y %I:%M:%S %z %z" diff --git a/library/msgs/fa_ir.msg b/library/msgs/fa_ir.msg index 597ce9d..9ce9284 100644 --- a/library/msgs/fa_ir.msg +++ b/library/msgs/fa_ir.msg @@ -1,9 +1,9 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { - ::msgcat::mcset fa_IR AM "\u0635\u0628\u062d" - ::msgcat::mcset fa_IR PM "\u0639\u0635\u0631" - ::msgcat::mcset fa_IR DATE_FORMAT "%d\u2044%m\u2044%Y" + ::msgcat::mcset fa_IR AM "صبح" + ::msgcat::mcset fa_IR PM "عصر" + ::msgcat::mcset fa_IR DATE_FORMAT "%dâ„%mâ„%Y" ::msgcat::mcset fa_IR TIME_FORMAT "%S:%M:%H" ::msgcat::mcset fa_IR TIME_FORMAT_12 "%S:%M:%l %P" - ::msgcat::mcset fa_IR DATE_TIME_FORMAT "%d\u2044%m\u2044%Y %S:%M:%H %z" + ::msgcat::mcset fa_IR DATE_TIME_FORMAT "%dâ„%mâ„%Y %S:%M:%H %z" } diff --git a/library/msgs/fi.msg b/library/msgs/fi.msg index acabba0..69be367 100644 --- a/library/msgs/fi.msg +++ b/library/msgs/fi.msg @@ -22,8 +22,8 @@ namespace eval ::tcl::clock { "maalis"\ "huhti"\ "touko"\ - "kes\u00e4"\ - "hein\u00e4"\ + "kesä"\ + "heinä"\ "elo"\ "syys"\ "loka"\ @@ -36,8 +36,8 @@ namespace eval ::tcl::clock { "maaliskuu"\ "huhtikuu"\ "toukokuu"\ - "kes\u00e4kuu"\ - "hein\u00e4kuu"\ + "kesäkuu"\ + "heinäkuu"\ "elokuu"\ "syyskuu"\ "lokakuu"\ diff --git a/library/msgs/fo.msg b/library/msgs/fo.msg index 4696e62..1f1794d 100644 --- a/library/msgs/fo.msg +++ b/library/msgs/fo.msg @@ -2,19 +2,19 @@ namespace eval ::tcl::clock { ::msgcat::mcset fo DAYS_OF_WEEK_ABBREV [list \ "sun"\ - "m\u00e1n"\ - "t\u00fds"\ + "mán"\ + "týs"\ "mik"\ - "h\u00f3s"\ - "fr\u00ed"\ + "hós"\ + "frí"\ "ley"] ::msgcat::mcset fo DAYS_OF_WEEK_FULL [list \ "sunnudagur"\ - "m\u00e1nadagur"\ - "t\u00fdsdagur"\ + "mánadagur"\ + "týsdagur"\ "mikudagur"\ - "h\u00f3sdagur"\ - "fr\u00edggjadagur"\ + "hósdagur"\ + "fríggjadagur"\ "leygardagur"] ::msgcat::mcset fo MONTHS_ABBREV [list \ "jan"\ @@ -34,7 +34,7 @@ namespace eval ::tcl::clock { "januar"\ "februar"\ "mars"\ - "apr\u00edl"\ + "apríl"\ "mai"\ "juni"\ "juli"\ diff --git a/library/msgs/fr.msg b/library/msgs/fr.msg index 55b19bf..a274468 100644 --- a/library/msgs/fr.msg +++ b/library/msgs/fr.msg @@ -18,31 +18,31 @@ namespace eval ::tcl::clock { "samedi"] ::msgcat::mcset fr MONTHS_ABBREV [list \ "janv."\ - "f\u00e9vr."\ + "févr."\ "mars"\ "avr."\ "mai"\ "juin"\ "juil."\ - "ao\u00fbt"\ + "août"\ "sept."\ "oct."\ "nov."\ - "d\u00e9c."\ + "déc."\ ""] ::msgcat::mcset fr MONTHS_FULL [list \ "janvier"\ - "f\u00e9vrier"\ + "février"\ "mars"\ "avril"\ "mai"\ "juin"\ "juillet"\ - "ao\u00fbt"\ + "août"\ "septembre"\ "octobre"\ "novembre"\ - "d\u00e9cembre"\ + "décembre"\ ""] ::msgcat::mcset fr BCE "av. J.-C." ::msgcat::mcset fr CE "ap. J.-C." diff --git a/library/msgs/ga.msg b/library/msgs/ga.msg index 6edf13a..056c9a0 100644 --- a/library/msgs/ga.msg +++ b/library/msgs/ga.msg @@ -3,45 +3,45 @@ namespace eval ::tcl::clock { ::msgcat::mcset ga DAYS_OF_WEEK_ABBREV [list \ "Domh"\ "Luan"\ - "M\u00e1irt"\ - "C\u00e9ad"\ - "D\u00e9ar"\ + "Máirt"\ + "Céad"\ + "Déar"\ "Aoine"\ "Sath"] ::msgcat::mcset ga DAYS_OF_WEEK_FULL [list \ - "D\u00e9 Domhnaigh"\ - "D\u00e9 Luain"\ - "D\u00e9 M\u00e1irt"\ - "D\u00e9 C\u00e9adaoin"\ - "D\u00e9ardaoin"\ - "D\u00e9 hAoine"\ - "D\u00e9 Sathairn"] + "Dé Domhnaigh"\ + "Dé Luain"\ + "Dé Máirt"\ + "Dé Céadaoin"\ + "Déardaoin"\ + "Dé hAoine"\ + "Dé Sathairn"] ::msgcat::mcset ga MONTHS_ABBREV [list \ "Ean"\ "Feabh"\ - "M\u00e1rta"\ + "Márta"\ "Aib"\ "Beal"\ "Meith"\ - "I\u00fail"\ - "L\u00fan"\ - "MF\u00f3mh"\ - "DF\u00f3mh"\ + "Iúil"\ + "Lún"\ + "MFómh"\ + "DFómh"\ "Samh"\ "Noll"\ ""] ::msgcat::mcset ga MONTHS_FULL [list \ - "Ean\u00e1ir"\ + "Eanáir"\ "Feabhra"\ - "M\u00e1rta"\ - "Aibre\u00e1n"\ - "M\u00ed na Bealtaine"\ + "Márta"\ + "Aibreán"\ + "Mí na Bealtaine"\ "Meith"\ - "I\u00fail"\ - "L\u00fanasa"\ - "Me\u00e1n F\u00f3mhair"\ - "Deireadh F\u00f3mhair"\ - "M\u00ed na Samhna"\ - "M\u00ed na Nollag"\ + "Iúil"\ + "Lúnasa"\ + "Meán Fómhair"\ + "Deireadh Fómhair"\ + "Mí na Samhna"\ + "Mí na Nollag"\ ""] } diff --git a/library/msgs/gl.msg b/library/msgs/gl.msg index 4b869e8..c2fefc9 100644 --- a/library/msgs/gl.msg +++ b/library/msgs/gl.msg @@ -4,25 +4,25 @@ namespace eval ::tcl::clock { "Dom"\ "Lun"\ "Mar"\ - "M\u00e9r"\ + "Mér"\ "Xov"\ "Ven"\ - "S\u00e1b"] + "Sáb"] ::msgcat::mcset gl DAYS_OF_WEEK_FULL [list \ "Domingo"\ "Luns"\ "Martes"\ - "M\u00e9rcores"\ + "Mércores"\ "Xoves"\ "Venres"\ - "S\u00e1bado"] + "Sábado"] ::msgcat::mcset gl MONTHS_ABBREV [list \ "Xan"\ "Feb"\ "Mar"\ "Abr"\ "Mai"\ - "Xu\u00f1"\ + "Xuñ"\ "Xul"\ "Ago"\ "Set"\ @@ -36,7 +36,7 @@ namespace eval ::tcl::clock { "Marzo"\ "Abril"\ "Maio"\ - "Xu\u00f1o"\ + "Xuño"\ "Xullo"\ "Agosto"\ "Setembro"\ diff --git a/library/msgs/he.msg b/library/msgs/he.msg index 4fd921d..13a81b7 100644 --- a/library/msgs/he.msg +++ b/library/msgs/he.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset he DAYS_OF_WEEK_ABBREV [list \ - "\u05d0"\ - "\u05d1"\ - "\u05d2"\ - "\u05d3"\ - "\u05d4"\ - "\u05d5"\ - "\u05e9"] + "×"\ + "ב"\ + "×’"\ + "ד"\ + "×”"\ + "ו"\ + "ש"] ::msgcat::mcset he DAYS_OF_WEEK_FULL [list \ - "\u05d9\u05d5\u05dd \u05e8\u05d0\u05e9\u05d5\u05df"\ - "\u05d9\u05d5\u05dd \u05e9\u05e0\u05d9"\ - "\u05d9\u05d5\u05dd \u05e9\u05dc\u05d9\u05e9\u05d9"\ - "\u05d9\u05d5\u05dd \u05e8\u05d1\u05d9\u05e2\u05d9"\ - "\u05d9\u05d5\u05dd \u05d7\u05de\u05d9\u05e9\u05d9"\ - "\u05d9\u05d5\u05dd \u05e9\u05d9\u05e9\u05d9"\ - "\u05e9\u05d1\u05ea"] + "×™×•× ×¨×שון"\ + "×™×•× ×©× ×™"\ + "×™×•× ×©×œ×™×©×™"\ + "×™×•× ×¨×‘×™×¢×™"\ + "×™×•× ×—×ž×™×©×™"\ + "×™×•× ×©×™×©×™"\ + "שבת"] ::msgcat::mcset he MONTHS_ABBREV [list \ - "\u05d9\u05e0\u05d5"\ - "\u05e4\u05d1\u05e8"\ - "\u05de\u05e8\u05e5"\ - "\u05d0\u05e4\u05e8"\ - "\u05de\u05d0\u05d9"\ - "\u05d9\u05d5\u05e0"\ - "\u05d9\u05d5\u05dc"\ - "\u05d0\u05d5\u05d2"\ - "\u05e1\u05e4\u05d8"\ - "\u05d0\u05d5\u05e7"\ - "\u05e0\u05d5\u05d1"\ - "\u05d3\u05e6\u05de"\ + "ינו"\ + "פבר"\ + "מרץ"\ + "×פר"\ + "מ××™"\ + "יונ"\ + "יול"\ + "×וג"\ + "ספט"\ + "×וק"\ + "נוב"\ + "דצמ"\ ""] ::msgcat::mcset he MONTHS_FULL [list \ - "\u05d9\u05e0\u05d5\u05d0\u05e8"\ - "\u05e4\u05d1\u05e8\u05d5\u05d0\u05e8"\ - "\u05de\u05e8\u05e5"\ - "\u05d0\u05e4\u05e8\u05d9\u05dc"\ - "\u05de\u05d0\u05d9"\ - "\u05d9\u05d5\u05e0\u05d9"\ - "\u05d9\u05d5\u05dc\u05d9"\ - "\u05d0\u05d5\u05d2\u05d5\u05e1\u05d8"\ - "\u05e1\u05e4\u05d8\u05de\u05d1\u05e8"\ - "\u05d0\u05d5\u05e7\u05d8\u05d5\u05d1\u05e8"\ - "\u05e0\u05d5\u05d1\u05de\u05d1\u05e8"\ - "\u05d3\u05e6\u05de\u05d1\u05e8"\ + "ינו×ר"\ + "פברו×ר"\ + "מרץ"\ + "×פריל"\ + "מ××™"\ + "יוני"\ + "יולי"\ + "×וגוסט"\ + "ספטמבר"\ + "×וקטובר"\ + "נובמבר"\ + "דצמבר"\ ""] - ::msgcat::mcset he BCE "\u05dc\u05e1\u05d4\u0022\u05e0" - ::msgcat::mcset he CE "\u05dc\u05e4\u05e1\u05d4\u0022\u05e0" + ::msgcat::mcset he BCE "לסה"× " + ::msgcat::mcset he CE "לפסה"× " ::msgcat::mcset he DATE_FORMAT "%d/%m/%Y" ::msgcat::mcset he TIME_FORMAT "%H:%M:%S" ::msgcat::mcset he DATE_TIME_FORMAT "%d/%m/%Y %H:%M:%S %z" diff --git a/library/msgs/hi.msg b/library/msgs/hi.msg index 50c9fb8..18c8bf0 100644 --- a/library/msgs/hi.msg +++ b/library/msgs/hi.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset hi DAYS_OF_WEEK_FULL [list \ - "\u0930\u0935\u093f\u0935\u093e\u0930"\ - "\u0938\u094b\u092e\u0935\u093e\u0930"\ - "\u092e\u0902\u0917\u0932\u0935\u093e\u0930"\ - "\u092c\u0941\u0927\u0935\u093e\u0930"\ - "\u0917\u0941\u0930\u0941\u0935\u093e\u0930"\ - "\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930"\ - "\u0936\u0928\u093f\u0935\u093e\u0930"] + "रविवार"\ + "सोमवार"\ + "मंगलवार"\ + "बà¥à¤§à¤µà¤¾à¤°"\ + "गà¥à¤°à¥à¤µà¤¾à¤°"\ + "शà¥à¤•à¥à¤°à¤µà¤¾à¤°"\ + "शनिवार"] ::msgcat::mcset hi MONTHS_ABBREV [list \ - "\u091c\u0928\u0935\u0930\u0940"\ - "\u092b\u093c\u0930\u0935\u0930\u0940"\ - "\u092e\u093e\u0930\u094d\u091a"\ - "\u0905\u092a\u094d\u0930\u0947\u0932"\ - "\u092e\u0908"\ - "\u091c\u0942\u0928"\ - "\u091c\u0941\u0932\u093e\u0908"\ - "\u0905\u0917\u0938\u094d\u0924"\ - "\u0938\u093f\u0924\u092e\u094d\u092c\u0930"\ - "\u0905\u0915\u094d\u091f\u0942\u092c\u0930"\ - "\u0928\u0935\u092e\u094d\u092c\u0930"\ - "\u0926\u093f\u0938\u092e\u094d\u092c\u0930"] + "जनवरी"\ + "फ़रवरी"\ + "मारà¥à¤š"\ + "अपà¥à¤°à¥‡à¤²"\ + "मई"\ + "जून"\ + "जà¥à¤²à¤¾à¤ˆ"\ + "अगसà¥à¤¤"\ + "सितमà¥à¤¬à¤°"\ + "अकà¥à¤Ÿà¥‚बर"\ + "नवमà¥à¤¬à¤°"\ + "दिसमà¥à¤¬à¤°"] ::msgcat::mcset hi MONTHS_FULL [list \ - "\u091c\u0928\u0935\u0930\u0940"\ - "\u092b\u093c\u0930\u0935\u0930\u0940"\ - "\u092e\u093e\u0930\u094d\u091a"\ - "\u0905\u092a\u094d\u0930\u0947\u0932"\ - "\u092e\u0908"\ - "\u091c\u0942\u0928"\ - "\u091c\u0941\u0932\u093e\u0908"\ - "\u0905\u0917\u0938\u094d\u0924"\ - "\u0938\u093f\u0924\u092e\u094d\u092c\u0930"\ - "\u0905\u0915\u094d\u091f\u0942\u092c\u0930"\ - "\u0928\u0935\u092e\u094d\u092c\u0930"\ - "\u0926\u093f\u0938\u092e\u094d\u092c\u0930"] - ::msgcat::mcset hi AM "\u0908\u0938\u093e\u092a\u0942\u0930\u094d\u0935" + "जनवरी"\ + "फ़रवरी"\ + "मारà¥à¤š"\ + "अपà¥à¤°à¥‡à¤²"\ + "मई"\ + "जून"\ + "जà¥à¤²à¤¾à¤ˆ"\ + "अगसà¥à¤¤"\ + "सितमà¥à¤¬à¤°"\ + "अकà¥à¤Ÿà¥‚बर"\ + "नवमà¥à¤¬à¤°"\ + "दिसमà¥à¤¬à¤°"] + ::msgcat::mcset hi AM "ईसापूरà¥à¤µ" ::msgcat::mcset hi PM "." } diff --git a/library/msgs/hr.msg b/library/msgs/hr.msg index cec145b..30491e1 100644 --- a/library/msgs/hr.msg +++ b/library/msgs/hr.msg @@ -5,7 +5,7 @@ namespace eval ::tcl::clock { "pon"\ "uto"\ "sri"\ - "\u010det"\ + "Äet"\ "pet"\ "sub"] ::msgcat::mcset hr DAYS_OF_WEEK_FULL [list \ @@ -13,13 +13,13 @@ namespace eval ::tcl::clock { "ponedjeljak"\ "utorak"\ "srijeda"\ - "\u010detvrtak"\ + "Äetvrtak"\ "petak"\ "subota"] ::msgcat::mcset hr MONTHS_ABBREV [list \ "sij"\ "vel"\ - "o\u017eu"\ + "ožu"\ "tra"\ "svi"\ "lip"\ @@ -31,9 +31,9 @@ namespace eval ::tcl::clock { "pro"\ ""] ::msgcat::mcset hr MONTHS_FULL [list \ - "sije\u010danj"\ - "velja\u010da"\ - "o\u017eujak"\ + "sijeÄanj"\ + "veljaÄa"\ + "ožujak"\ "travanj"\ "svibanj"\ "lipanj"\ diff --git a/library/msgs/hu.msg b/library/msgs/hu.msg index e5e68d9..46776dd 100644 --- a/library/msgs/hu.msg +++ b/library/msgs/hu.msg @@ -9,21 +9,21 @@ namespace eval ::tcl::clock { "P"\ "Szo"] ::msgcat::mcset hu DAYS_OF_WEEK_FULL [list \ - "vas\u00e1rnap"\ - "h\u00e9tf\u0151"\ + "vasárnap"\ + "hétfÅ‘"\ "kedd"\ "szerda"\ - "cs\u00fct\u00f6rt\u00f6k"\ - "p\u00e9ntek"\ + "csütörtök"\ + "péntek"\ "szombat"] ::msgcat::mcset hu MONTHS_ABBREV [list \ "jan."\ "febr."\ - "m\u00e1rc."\ - "\u00e1pr."\ - "m\u00e1j."\ - "j\u00fan."\ - "j\u00fal."\ + "márc."\ + "ápr."\ + "máj."\ + "jún."\ + "júl."\ "aug."\ "szept."\ "okt."\ @@ -31,16 +31,16 @@ namespace eval ::tcl::clock { "dec."\ ""] ::msgcat::mcset hu MONTHS_FULL [list \ - "janu\u00e1r"\ - "febru\u00e1r"\ - "m\u00e1rcius"\ - "\u00e1prilis"\ - "m\u00e1jus"\ - "j\u00fanius"\ - "j\u00falius"\ + "január"\ + "február"\ + "március"\ + "április"\ + "május"\ + "június"\ + "július"\ "augusztus"\ "szeptember"\ - "okt\u00f3ber"\ + "október"\ "november"\ "december"\ ""] diff --git a/library/msgs/is.msg b/library/msgs/is.msg index adc2d2a..a369b89 100644 --- a/library/msgs/is.msg +++ b/library/msgs/is.msg @@ -2,46 +2,46 @@ namespace eval ::tcl::clock { ::msgcat::mcset is DAYS_OF_WEEK_ABBREV [list \ "sun."\ - "m\u00e1n."\ - "\u00feri."\ - "mi\u00f0."\ + "mán."\ + "þri."\ + "mið."\ "fim."\ - "f\u00f6s."\ + "fös."\ "lau."] ::msgcat::mcset is DAYS_OF_WEEK_FULL [list \ "sunnudagur"\ - "m\u00e1nudagur"\ - "\u00feri\u00f0judagur"\ - "mi\u00f0vikudagur"\ + "mánudagur"\ + "þriðjudagur"\ + "miðvikudagur"\ "fimmtudagur"\ - "f\u00f6studagur"\ + "föstudagur"\ "laugardagur"] ::msgcat::mcset is MONTHS_ABBREV [list \ "jan."\ "feb."\ "mar."\ "apr."\ - "ma\u00ed"\ - "j\u00fan."\ - "j\u00fal."\ - "\u00e1g\u00fa."\ + "maí"\ + "jún."\ + "júl."\ + "ágú."\ "sep."\ "okt."\ - "n\u00f3v."\ + "nóv."\ "des."\ ""] ::msgcat::mcset is MONTHS_FULL [list \ - "jan\u00faar"\ - "febr\u00faar"\ + "janúar"\ + "febrúar"\ "mars"\ - "apr\u00edl"\ - "ma\u00ed"\ - "j\u00fan\u00ed"\ - "j\u00fal\u00ed"\ - "\u00e1g\u00fast"\ + "apríl"\ + "maí"\ + "júní"\ + "júlí"\ + "ágúst"\ "september"\ - "okt\u00f3ber"\ - "n\u00f3vember"\ + "október"\ + "nóvember"\ "desember"\ ""] ::msgcat::mcset is DATE_FORMAT "%e.%m.%Y" diff --git a/library/msgs/it.msg b/library/msgs/it.msg index b641cde..e51aee2 100644 --- a/library/msgs/it.msg +++ b/library/msgs/it.msg @@ -10,11 +10,11 @@ namespace eval ::tcl::clock { "sab"] ::msgcat::mcset it DAYS_OF_WEEK_FULL [list \ "domenica"\ - "luned\u00ec"\ - "marted\u00ec"\ - "mercoled\u00ec"\ - "gioved\u00ec"\ - "venerd\u00ec"\ + "lunedì"\ + "martedì"\ + "mercoledì"\ + "giovedì"\ + "venerdì"\ "sabato"] ::msgcat::mcset it MONTHS_ABBREV [list \ "gen"\ diff --git a/library/msgs/ja.msg b/library/msgs/ja.msg index 2767665..76b5fa4 100644 --- a/library/msgs/ja.msg +++ b/library/msgs/ja.msg @@ -1,44 +1,44 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ja DAYS_OF_WEEK_ABBREV [list \ - "\u65e5"\ - "\u6708"\ - "\u706b"\ - "\u6c34"\ - "\u6728"\ - "\u91d1"\ - "\u571f"] + "æ—¥"\ + "月"\ + "ç«"\ + "æ°´"\ + "木"\ + "金"\ + "土"] ::msgcat::mcset ja DAYS_OF_WEEK_FULL [list \ - "\u65e5\u66dc\u65e5"\ - "\u6708\u66dc\u65e5"\ - "\u706b\u66dc\u65e5"\ - "\u6c34\u66dc\u65e5"\ - "\u6728\u66dc\u65e5"\ - "\u91d1\u66dc\u65e5"\ - "\u571f\u66dc\u65e5"] + "日曜日"\ + "月曜日"\ + "ç«æ›œæ—¥"\ + "水曜日"\ + "木曜日"\ + "金曜日"\ + "土曜日"] ::msgcat::mcset ja MONTHS_FULL [list \ - "1\u6708"\ - "2\u6708"\ - "3\u6708"\ - "4\u6708"\ - "5\u6708"\ - "6\u6708"\ - "7\u6708"\ - "8\u6708"\ - "9\u6708"\ - "10\u6708"\ - "11\u6708"\ - "12\u6708"] - ::msgcat::mcset ja BCE "\u7d00\u5143\u524d" - ::msgcat::mcset ja CE "\u897f\u66a6" - ::msgcat::mcset ja AM "\u5348\u524d" - ::msgcat::mcset ja PM "\u5348\u5f8c" + "1月"\ + "2月"\ + "3月"\ + "4月"\ + "5月"\ + "6月"\ + "7月"\ + "8月"\ + "9月"\ + "10月"\ + "11月"\ + "12月"] + ::msgcat::mcset ja BCE "紀元å‰" + ::msgcat::mcset ja CE "西暦" + ::msgcat::mcset ja AM "åˆå‰" + ::msgcat::mcset ja PM "åˆå¾Œ" ::msgcat::mcset ja DATE_FORMAT "%Y/%m/%d" ::msgcat::mcset ja TIME_FORMAT "%k:%M:%S" ::msgcat::mcset ja TIME_FORMAT_12 "%P %I:%M:%S" ::msgcat::mcset ja DATE_TIME_FORMAT "%Y/%m/%d %k:%M:%S %z" - ::msgcat::mcset ja LOCALE_DATE_FORMAT "%EY\u5e74%m\u6708%d\u65e5" - ::msgcat::mcset ja LOCALE_TIME_FORMAT "%H\u6642%M\u5206%S\u79d2" - ::msgcat::mcset ja LOCALE_DATE_TIME_FORMAT "%EY\u5e74%m\u6708%d\u65e5 (%a) %H\u6642%M\u5206%S\u79d2 %z" - ::msgcat::mcset ja LOCALE_ERAS "\u007b-9223372036854775808 \u897f\u66a6 0\u007d \u007b-3061011600 \u660e\u6cbb 1867\u007d \u007b-1812186000 \u5927\u6b63 1911\u007d \u007b-1357635600 \u662d\u548c 1925\u007d \u007b600220800 \u5e73\u6210 1988\u007d" + ::msgcat::mcset ja LOCALE_DATE_FORMAT "%EYå¹´%m月%dæ—¥" + ::msgcat::mcset ja LOCALE_TIME_FORMAT "%H時%M分%Sç§’" + ::msgcat::mcset ja LOCALE_DATE_TIME_FORMAT "%EYå¹´%m月%dæ—¥ (%a) %H時%M分%Sç§’ %z" + ::msgcat::mcset ja LOCALE_ERAS "{-9223372036854775808 西暦 0} {-3061011600 明治 1867} {-1812186000 大正 1911} {-1357635600 昭和 1925} {600220800 å¹³æˆ 1988}" } diff --git a/library/msgs/ko.msg b/library/msgs/ko.msg index 0cd17a1..817c2e7 100644 --- a/library/msgs/ko.msg +++ b/library/msgs/ko.msg @@ -1,55 +1,55 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ko DAYS_OF_WEEK_ABBREV [list \ - "\uc77c"\ - "\uc6d4"\ - "\ud654"\ - "\uc218"\ - "\ubaa9"\ - "\uae08"\ - "\ud1a0"] + "ì¼"\ + "ì›”"\ + "í™”"\ + "수"\ + "목"\ + "금"\ + "토"] ::msgcat::mcset ko DAYS_OF_WEEK_FULL [list \ - "\uc77c\uc694\uc77c"\ - "\uc6d4\uc694\uc77c"\ - "\ud654\uc694\uc77c"\ - "\uc218\uc694\uc77c"\ - "\ubaa9\uc694\uc77c"\ - "\uae08\uc694\uc77c"\ - "\ud1a0\uc694\uc77c"] + "ì¼ìš”ì¼"\ + "월요ì¼"\ + "화요ì¼"\ + "수요ì¼"\ + "목요ì¼"\ + "금요ì¼"\ + "토요ì¼"] ::msgcat::mcset ko MONTHS_ABBREV [list \ - "1\uc6d4"\ - "2\uc6d4"\ - "3\uc6d4"\ - "4\uc6d4"\ - "5\uc6d4"\ - "6\uc6d4"\ - "7\uc6d4"\ - "8\uc6d4"\ - "9\uc6d4"\ - "10\uc6d4"\ - "11\uc6d4"\ - "12\uc6d4"\ + "1ì›”"\ + "2ì›”"\ + "3ì›”"\ + "4ì›”"\ + "5ì›”"\ + "6ì›”"\ + "7ì›”"\ + "8ì›”"\ + "9ì›”"\ + "10ì›”"\ + "11ì›”"\ + "12ì›”"\ ""] ::msgcat::mcset ko MONTHS_FULL [list \ - "1\uc6d4"\ - "2\uc6d4"\ - "3\uc6d4"\ - "4\uc6d4"\ - "5\uc6d4"\ - "6\uc6d4"\ - "7\uc6d4"\ - "8\uc6d4"\ - "9\uc6d4"\ - "10\uc6d4"\ - "11\uc6d4"\ - "12\uc6d4"\ + "1ì›”"\ + "2ì›”"\ + "3ì›”"\ + "4ì›”"\ + "5ì›”"\ + "6ì›”"\ + "7ì›”"\ + "8ì›”"\ + "9ì›”"\ + "10ì›”"\ + "11ì›”"\ + "12ì›”"\ ""] - ::msgcat::mcset ko AM "\uc624\uc804" - ::msgcat::mcset ko PM "\uc624\ud6c4" + ::msgcat::mcset ko AM "오전" + ::msgcat::mcset ko PM "오후" ::msgcat::mcset ko DATE_FORMAT "%Y-%m-%d" ::msgcat::mcset ko TIME_FORMAT_12 "%P %l:%M:%S" ::msgcat::mcset ko DATE_TIME_FORMAT "%Y-%m-%d %P %l:%M:%S %z" - ::msgcat::mcset ko LOCALE_DATE_FORMAT "%Y\ub144%B%Od\uc77c" - ::msgcat::mcset ko LOCALE_TIME_FORMAT "%H\uc2dc%M\ubd84%S\ucd08" - ::msgcat::mcset ko LOCALE_DATE_TIME_FORMAT "%A %Y\ub144%B%Od\uc77c%H\uc2dc%M\ubd84%S\ucd08 %z" + ::msgcat::mcset ko LOCALE_DATE_FORMAT "%Yë…„%B%Odì¼" + ::msgcat::mcset ko LOCALE_TIME_FORMAT "%H시%Më¶„%Sì´ˆ" + ::msgcat::mcset ko LOCALE_DATE_TIME_FORMAT "%A %Yë…„%B%Odì¼%H시%Më¶„%Sì´ˆ %z" } diff --git a/library/msgs/ko_kr.msg b/library/msgs/ko_kr.msg index ea5bbd7..f23bd6b 100644 --- a/library/msgs/ko_kr.msg +++ b/library/msgs/ko_kr.msg @@ -1,7 +1,7 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { - ::msgcat::mcset ko_KR BCE "\uae30\uc6d0\uc804" - ::msgcat::mcset ko_KR CE "\uc11c\uae30" + ::msgcat::mcset ko_KR BCE "기ì›ì „" + ::msgcat::mcset ko_KR CE "서기" ::msgcat::mcset ko_KR DATE_FORMAT "%Y.%m.%d" ::msgcat::mcset ko_KR TIME_FORMAT_12 "%P %l:%M:%S" ::msgcat::mcset ko_KR DATE_TIME_FORMAT "%Y.%m.%d %P %l:%M:%S %z" diff --git a/library/msgs/kok.msg b/library/msgs/kok.msg index 0869f20..231853b 100644 --- a/library/msgs/kok.msg +++ b/library/msgs/kok.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset kok DAYS_OF_WEEK_FULL [list \ - "\u0906\u0926\u093f\u0924\u094d\u092f\u0935\u093e\u0930"\ - "\u0938\u094b\u092e\u0935\u093e\u0930"\ - "\u092e\u0902\u0917\u0933\u093e\u0930"\ - "\u092c\u0941\u0927\u0935\u093e\u0930"\ - "\u0917\u0941\u0930\u0941\u0935\u093e\u0930"\ - "\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930"\ - "\u0936\u0928\u093f\u0935\u093e\u0930"] + "आदितà¥à¤¯à¤µà¤¾à¤°"\ + "सोमवार"\ + "मंगळार"\ + "बà¥à¤§à¤µà¤¾à¤°"\ + "गà¥à¤°à¥à¤µà¤¾à¤°"\ + "शà¥à¤•à¥à¤°à¤µà¤¾à¤°"\ + "शनिवार"] ::msgcat::mcset kok MONTHS_ABBREV [list \ - "\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940"\ - "\u092b\u0947\u092c\u0943\u0935\u093e\u0930\u0940"\ - "\u092e\u093e\u0930\u094d\u091a"\ - "\u090f\u092a\u094d\u0930\u093f\u0932"\ - "\u092e\u0947"\ - "\u091c\u0942\u0928"\ - "\u091c\u0941\u0932\u0948"\ - "\u0913\u0917\u0938\u094d\u091f"\ - "\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930"\ - "\u0913\u0915\u094d\u091f\u094b\u092c\u0930"\ - "\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930"\ - "\u0921\u093f\u0938\u0947\u0902\u092c\u0930"] + "जानेवारी"\ + "फेबृवारी"\ + "मारà¥à¤š"\ + "à¤à¤ªà¥à¤°à¤¿à¤²"\ + "मे"\ + "जून"\ + "जà¥à¤²à¥ˆ"\ + "ओगसà¥à¤Ÿ"\ + "सेपà¥à¤Ÿà¥‡à¤‚बर"\ + "ओकà¥à¤Ÿà¥‹à¤¬à¤°"\ + "नोवà¥à¤¹à¥‡à¤‚बर"\ + "डिसेंबर"] ::msgcat::mcset kok MONTHS_FULL [list \ - "\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940"\ - "\u092b\u0947\u092c\u094d\u0930\u0941\u0935\u093e\u0930\u0940"\ - "\u092e\u093e\u0930\u094d\u091a"\ - "\u090f\u092a\u094d\u0930\u093f\u0932"\ - "\u092e\u0947"\ - "\u091c\u0942\u0928"\ - "\u091c\u0941\u0932\u0948"\ - "\u0913\u0917\u0938\u094d\u091f"\ - "\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930"\ - "\u0913\u0915\u094d\u091f\u094b\u092c\u0930"\ - "\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930"\ - "\u0921\u093f\u0938\u0947\u0902\u092c\u0930"] - ::msgcat::mcset kok AM "\u0915\u094d\u0930\u093f\u0938\u094d\u0924\u092a\u0942\u0930\u094d\u0935" - ::msgcat::mcset kok PM "\u0915\u094d\u0930\u093f\u0938\u094d\u0924\u0936\u0916\u093e" + "जानेवारी"\ + "फेबà¥à¤°à¥à¤µà¤¾à¤°à¥€"\ + "मारà¥à¤š"\ + "à¤à¤ªà¥à¤°à¤¿à¤²"\ + "मे"\ + "जून"\ + "जà¥à¤²à¥ˆ"\ + "ओगसà¥à¤Ÿ"\ + "सेपà¥à¤Ÿà¥‡à¤‚बर"\ + "ओकà¥à¤Ÿà¥‹à¤¬à¤°"\ + "नोवà¥à¤¹à¥‡à¤‚बर"\ + "डिसेंबर"] + ::msgcat::mcset kok AM "कà¥à¤°à¤¿à¤¸à¥à¤¤à¤ªà¥‚रà¥à¤µ" + ::msgcat::mcset kok PM "कà¥à¤°à¤¿à¤¸à¥à¤¤à¤¶à¤–ा" } diff --git a/library/msgs/lt.msg b/library/msgs/lt.msg index 27b0985..15829a9 100644 --- a/library/msgs/lt.msg +++ b/library/msgs/lt.msg @@ -7,15 +7,15 @@ namespace eval ::tcl::clock { "Tr"\ "Kt"\ "Pn"\ - "\u0160t"] + "Å t"] ::msgcat::mcset lt DAYS_OF_WEEK_FULL [list \ "Sekmadienis"\ "Pirmadienis"\ "Antradienis"\ - "Tre\u010diadienis"\ + "TreÄiadienis"\ "Ketvirtadienis"\ "Penktadienis"\ - "\u0160e\u0161tadienis"] + "Å eÅ¡tadienis"] ::msgcat::mcset lt MONTHS_ABBREV [list \ "Sau"\ "Vas"\ @@ -34,15 +34,15 @@ namespace eval ::tcl::clock { "Sausio"\ "Vasario"\ "Kovo"\ - "Baland\u017eio"\ - "Gegu\u017e\u0117s"\ - "Bir\u017eelio"\ + "Balandžio"\ + "Gegužės"\ + "Birželio"\ "Liepos"\ - "Rugpj\u016b\u010dio"\ - "Rugs\u0117jo"\ + "RugpjÅ«Äio"\ + "RugsÄ—jo"\ "Spalio"\ - "Lapkri\u010dio"\ - "Gruod\u017eio"\ + "LapkriÄio"\ + "Gruodžio"\ ""] ::msgcat::mcset lt BCE "pr.Kr." ::msgcat::mcset lt CE "po.Kr." diff --git a/library/msgs/lv.msg b/library/msgs/lv.msg index a037b15..730fd33 100644 --- a/library/msgs/lv.msg +++ b/library/msgs/lv.msg @@ -9,10 +9,10 @@ namespace eval ::tcl::clock { "Pk"\ "S"] ::msgcat::mcset lv DAYS_OF_WEEK_FULL [list \ - "sv\u0113tdiena"\ + "svÄ“tdiena"\ "pirmdiena"\ "otrdiena"\ - "tre\u0161diena"\ + "treÅ¡diena"\ "ceturdien"\ "piektdiena"\ "sestdiena"] @@ -22,8 +22,8 @@ namespace eval ::tcl::clock { "Mar"\ "Apr"\ "Maijs"\ - "J\u016bn"\ - "J\u016bl"\ + "JÅ«n"\ + "JÅ«l"\ "Aug"\ "Sep"\ "Okt"\ @@ -31,21 +31,21 @@ namespace eval ::tcl::clock { "Dec"\ ""] ::msgcat::mcset lv MONTHS_FULL [list \ - "janv\u0101ris"\ - "febru\u0101ris"\ + "janvÄris"\ + "februÄris"\ "marts"\ - "apr\u012blis"\ + "aprÄ«lis"\ "maijs"\ - "j\u016bnijs"\ - "j\u016blijs"\ + "jÅ«nijs"\ + "jÅ«lijs"\ "augusts"\ "septembris"\ "oktobris"\ "novembris"\ "decembris"\ ""] - ::msgcat::mcset lv BCE "pm\u0113" - ::msgcat::mcset lv CE "m\u0113" + ::msgcat::mcset lv BCE "pmÄ“" + ::msgcat::mcset lv CE "mÄ“" ::msgcat::mcset lv DATE_FORMAT "%Y.%e.%m" ::msgcat::mcset lv TIME_FORMAT "%H:%M:%S" ::msgcat::mcset lv DATE_TIME_FORMAT "%Y.%e.%m %H:%M:%S %z" diff --git a/library/msgs/mk.msg b/library/msgs/mk.msg index 41cf60d..9b7bd9d 100644 --- a/library/msgs/mk.msg +++ b/library/msgs/mk.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset mk DAYS_OF_WEEK_ABBREV [list \ - "\u043d\u0435\u0434."\ - "\u043f\u043e\u043d."\ - "\u0432\u0442."\ - "\u0441\u0440\u0435."\ - "\u0447\u0435\u0442."\ - "\u043f\u0435\u0442."\ - "\u0441\u0430\u0431."] + "нед."\ + "пон."\ + "вт."\ + "Ñре."\ + "чет."\ + "пет."\ + "Ñаб."] ::msgcat::mcset mk DAYS_OF_WEEK_FULL [list \ - "\u043d\u0435\u0434\u0435\u043b\u0430"\ - "\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a"\ - "\u0432\u0442\u043e\u0440\u043d\u0438\u043a"\ - "\u0441\u0440\u0435\u0434\u0430"\ - "\u0447\u0435\u0442\u0432\u0440\u0442\u043e\u043a"\ - "\u043f\u0435\u0442\u043e\u043a"\ - "\u0441\u0430\u0431\u043e\u0442\u0430"] + "недела"\ + "понеделник"\ + "вторник"\ + "Ñреда"\ + "четврток"\ + "петок"\ + "Ñабота"] ::msgcat::mcset mk MONTHS_ABBREV [list \ - "\u0458\u0430\u043d."\ - "\u0444\u0435\u0432."\ - "\u043c\u0430\u0440."\ - "\u0430\u043f\u0440."\ - "\u043c\u0430\u0458."\ - "\u0458\u0443\u043d."\ - "\u0458\u0443\u043b."\ - "\u0430\u0432\u0433."\ - "\u0441\u0435\u043f\u0442."\ - "\u043e\u043a\u0442."\ - "\u043d\u043e\u0435\u043c."\ - "\u0434\u0435\u043a\u0435\u043c."\ + "јан."\ + "фев."\ + "мар."\ + "апр."\ + "мај."\ + "јун."\ + "јул."\ + "авг."\ + "Ñепт."\ + "окт."\ + "ноем."\ + "декем."\ ""] ::msgcat::mcset mk MONTHS_FULL [list \ - "\u0458\u0430\u043d\u0443\u0430\u0440\u0438"\ - "\u0444\u0435\u0432\u0440\u0443\u0430\u0440\u0438"\ - "\u043c\u0430\u0440\u0442"\ - "\u0430\u043f\u0440\u0438\u043b"\ - "\u043c\u0430\u0458"\ - "\u0458\u0443\u043d\u0438"\ - "\u0458\u0443\u043b\u0438"\ - "\u0430\u0432\u0433\u0443\u0441\u0442"\ - "\u0441\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438"\ - "\u043e\u043a\u0442\u043e\u043c\u0432\u0440\u0438"\ - "\u043d\u043e\u0435\u043c\u0432\u0440\u0438"\ - "\u0434\u0435\u043a\u0435\u043c\u0432\u0440\u0438"\ + "јануари"\ + "февруари"\ + "март"\ + "април"\ + "мај"\ + "јуни"\ + "јули"\ + "авгуÑÑ‚"\ + "Ñептември"\ + "октомври"\ + "ноември"\ + "декември"\ ""] - ::msgcat::mcset mk BCE "\u043f\u0440.\u043d.\u0435." - ::msgcat::mcset mk CE "\u0430\u0435." + ::msgcat::mcset mk BCE "пр.н.е." + ::msgcat::mcset mk CE "ае." ::msgcat::mcset mk DATE_FORMAT "%e.%m.%Y" ::msgcat::mcset mk TIME_FORMAT "%H:%M:%S %z" ::msgcat::mcset mk DATE_TIME_FORMAT "%e.%m.%Y %H:%M:%S %z %z" diff --git a/library/msgs/mr.msg b/library/msgs/mr.msg index cea427a..e475615 100644 --- a/library/msgs/mr.msg +++ b/library/msgs/mr.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset mr DAYS_OF_WEEK_FULL [list \ - "\u0930\u0935\u093f\u0935\u093e\u0930"\ - "\u0938\u094b\u092e\u0935\u093e\u0930"\ - "\u092e\u0902\u0917\u0933\u0935\u093e\u0930"\ - "\u092e\u0902\u0917\u0933\u0935\u093e\u0930"\ - "\u0917\u0941\u0930\u0941\u0935\u093e\u0930"\ - "\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930"\ - "\u0936\u0928\u093f\u0935\u093e\u0930"] + "रविवार"\ + "सोमवार"\ + "मंगळवार"\ + "मंगळवार"\ + "गà¥à¤°à¥à¤µà¤¾à¤°"\ + "शà¥à¤•à¥à¤°à¤µà¤¾à¤°"\ + "शनिवार"] ::msgcat::mcset mr MONTHS_ABBREV [list \ - "\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940"\ - "\u092b\u0947\u092c\u0943\u0935\u093e\u0930\u0940"\ - "\u092e\u093e\u0930\u094d\u091a"\ - "\u090f\u092a\u094d\u0930\u093f\u0932"\ - "\u092e\u0947"\ - "\u091c\u0942\u0928"\ - "\u091c\u0941\u0932\u0948"\ - "\u0913\u0917\u0938\u094d\u091f"\ - "\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930"\ - "\u0913\u0915\u094d\u091f\u094b\u092c\u0930"\ - "\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930"\ - "\u0921\u093f\u0938\u0947\u0902\u092c\u0930"] + "जानेवारी"\ + "फेबृवारी"\ + "मारà¥à¤š"\ + "à¤à¤ªà¥à¤°à¤¿à¤²"\ + "मे"\ + "जून"\ + "जà¥à¤²à¥ˆ"\ + "ओगसà¥à¤Ÿ"\ + "सेपà¥à¤Ÿà¥‡à¤‚बर"\ + "ओकà¥à¤Ÿà¥‹à¤¬à¤°"\ + "नोवà¥à¤¹à¥‡à¤‚बर"\ + "डिसेंबर"] ::msgcat::mcset mr MONTHS_FULL [list \ - "\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940"\ - "\u092b\u0947\u092c\u0943\u0935\u093e\u0930\u0940"\ - "\u092e\u093e\u0930\u094d\u091a"\ - "\u090f\u092a\u094d\u0930\u093f\u0932"\ - "\u092e\u0947"\ - "\u091c\u0942\u0928"\ - "\u091c\u0941\u0932\u0948"\ - "\u0913\u0917\u0938\u094d\u091f"\ - "\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930"\ - "\u0913\u0915\u094d\u091f\u094b\u092c\u0930"\ - "\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930"\ - "\u0921\u093f\u0938\u0947\u0902\u092c\u0930"] + "जानेवारी"\ + "फेबृवारी"\ + "मारà¥à¤š"\ + "à¤à¤ªà¥à¤°à¤¿à¤²"\ + "मे"\ + "जून"\ + "जà¥à¤²à¥ˆ"\ + "ओगसà¥à¤Ÿ"\ + "सेपà¥à¤Ÿà¥‡à¤‚बर"\ + "ओकà¥à¤Ÿà¥‹à¤¬à¤°"\ + "नोवà¥à¤¹à¥‡à¤‚बर"\ + "डिसेंबर"] ::msgcat::mcset mr AM "BC" ::msgcat::mcset mr PM "AD" } diff --git a/library/msgs/mt.msg b/library/msgs/mt.msg index ddd5446..c479e47 100644 --- a/library/msgs/mt.msg +++ b/library/msgs/mt.msg @@ -1,19 +1,19 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset mt DAYS_OF_WEEK_ABBREV [list \ - "\u0126ad"\ + "Ħad"\ "Tne"\ "Tli"\ "Erb"\ - "\u0126am"\ - "\u0120im"] + "Ħam"\ + "Ä im"] ::msgcat::mcset mt MONTHS_ABBREV [list \ "Jan"\ "Fra"\ "Mar"\ "Apr"\ "Mej"\ - "\u0120un"\ + "Ä un"\ "Lul"\ "Awi"\ "Set"\ diff --git a/library/msgs/nb.msg b/library/msgs/nb.msg index 90d49a3..4dd76c7 100644 --- a/library/msgs/nb.msg +++ b/library/msgs/nb.msg @@ -1,21 +1,21 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset nb DAYS_OF_WEEK_ABBREV [list \ - "s\u00f8"\ + "sø"\ "ma"\ "ti"\ "on"\ "to"\ "fr"\ - "l\u00f8"] + "lø"] ::msgcat::mcset nb DAYS_OF_WEEK_FULL [list \ - "s\u00f8ndag"\ + "søndag"\ "mandag"\ "tirsdag"\ "onsdag"\ "torsdag"\ "fredag"\ - "l\u00f8rdag"] + "lørdag"] ::msgcat::mcset nb MONTHS_ABBREV [list \ "jan"\ "feb"\ diff --git a/library/msgs/nn.msg b/library/msgs/nn.msg index bd61ac9..b61a2dd 100644 --- a/library/msgs/nn.msg +++ b/library/msgs/nn.msg @@ -2,7 +2,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset nn DAYS_OF_WEEK_ABBREV [list \ "su"\ - "m\u00e5"\ + "mÃ¥"\ "ty"\ "on"\ "to"\ @@ -10,7 +10,7 @@ namespace eval ::tcl::clock { "lau"] ::msgcat::mcset nn DAYS_OF_WEEK_FULL [list \ "sundag"\ - "m\u00e5ndag"\ + "mÃ¥ndag"\ "tysdag"\ "onsdag"\ "torsdag"\ diff --git a/library/msgs/pl.msg b/library/msgs/pl.msg index d206f4b..821eea7 100644 --- a/library/msgs/pl.msg +++ b/library/msgs/pl.msg @@ -4,17 +4,17 @@ namespace eval ::tcl::clock { "N"\ "Pn"\ "Wt"\ - "\u015ar"\ + "Åšr"\ "Cz"\ "Pt"\ "So"] ::msgcat::mcset pl DAYS_OF_WEEK_FULL [list \ "niedziela"\ - "poniedzia\u0142ek"\ + "poniedziaÅ‚ek"\ "wtorek"\ - "\u015broda"\ + "Å›roda"\ "czwartek"\ - "pi\u0105tek"\ + "piÄ…tek"\ "sobota"] ::msgcat::mcset pl MONTHS_ABBREV [list \ "sty"\ @@ -26,23 +26,23 @@ namespace eval ::tcl::clock { "lip"\ "sie"\ "wrz"\ - "pa\u017a"\ + "paź"\ "lis"\ "gru"\ ""] ::msgcat::mcset pl MONTHS_FULL [list \ - "stycze\u0144"\ + "styczeÅ„"\ "luty"\ "marzec"\ - "kwiecie\u0144"\ + "kwiecieÅ„"\ "maj"\ "czerwiec"\ "lipiec"\ - "sierpie\u0144"\ - "wrzesie\u0144"\ - "pa\u017adziernik"\ + "sierpieÅ„"\ + "wrzesieÅ„"\ + "październik"\ "listopad"\ - "grudzie\u0144"\ + "grudzieÅ„"\ ""] ::msgcat::mcset pl BCE "p.n.e." ::msgcat::mcset pl CE "n.e." diff --git a/library/msgs/pt.msg b/library/msgs/pt.msg index 96fdb35..425c1f6 100644 --- a/library/msgs/pt.msg +++ b/library/msgs/pt.msg @@ -7,15 +7,15 @@ namespace eval ::tcl::clock { "Qua"\ "Qui"\ "Sex"\ - "S\u00e1b"] + "Sáb"] ::msgcat::mcset pt DAYS_OF_WEEK_FULL [list \ "Domingo"\ "Segunda-feira"\ - "Ter\u00e7a-feira"\ + "Terça-feira"\ "Quarta-feira"\ "Quinta-feira"\ "Sexta-feira"\ - "S\u00e1bado"] + "Sábado"] ::msgcat::mcset pt MONTHS_ABBREV [list \ "Jan"\ "Fev"\ @@ -33,7 +33,7 @@ namespace eval ::tcl::clock { ::msgcat::mcset pt MONTHS_FULL [list \ "Janeiro"\ "Fevereiro"\ - "Mar\u00e7o"\ + "Março"\ "Abril"\ "Maio"\ "Junho"\ diff --git a/library/msgs/ro.msg b/library/msgs/ro.msg index bdd7c61..f4452ba 100644 --- a/library/msgs/ro.msg +++ b/library/msgs/ro.msg @@ -9,13 +9,13 @@ namespace eval ::tcl::clock { "V"\ "S"] ::msgcat::mcset ro DAYS_OF_WEEK_FULL [list \ - "duminic\u0103"\ + "duminică"\ "luni"\ - "mar\u0163i"\ + "marÅ£i"\ "miercuri"\ "joi"\ "vineri"\ - "s\u00eemb\u0103t\u0103"] + "sîmbătă"] ::msgcat::mcset ro MONTHS_ABBREV [list \ "Ian"\ "Feb"\ @@ -45,7 +45,7 @@ namespace eval ::tcl::clock { "decembrie"\ ""] ::msgcat::mcset ro BCE "d.C." - ::msgcat::mcset ro CE "\u00ee.d.C." + ::msgcat::mcset ro CE "î.d.C." ::msgcat::mcset ro DATE_FORMAT "%d.%m.%Y" ::msgcat::mcset ro TIME_FORMAT "%H:%M:%S" ::msgcat::mcset ro DATE_TIME_FORMAT "%d.%m.%Y %H:%M:%S %z" diff --git a/library/msgs/ru.msg b/library/msgs/ru.msg index 65b075d..983a253 100644 --- a/library/msgs/ru.msg +++ b/library/msgs/ru.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ru DAYS_OF_WEEK_ABBREV [list \ - "\u0412\u0441"\ - "\u041f\u043d"\ - "\u0412\u0442"\ - "\u0421\u0440"\ - "\u0427\u0442"\ - "\u041f\u0442"\ - "\u0421\u0431"] + "Ð’Ñ"\ + "Пн"\ + "Ð’Ñ‚"\ + "Ср"\ + "Чт"\ + "Пт"\ + "Сб"] ::msgcat::mcset ru DAYS_OF_WEEK_FULL [list \ - "\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435"\ - "\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a"\ - "\u0432\u0442\u043e\u0440\u043d\u0438\u043a"\ - "\u0441\u0440\u0435\u0434\u0430"\ - "\u0447\u0435\u0442\u0432\u0435\u0440\u0433"\ - "\u043f\u044f\u0442\u043d\u0438\u0446\u0430"\ - "\u0441\u0443\u0431\u0431\u043e\u0442\u0430"] + "воÑкреÑенье"\ + "понедельник"\ + "вторник"\ + "Ñреда"\ + "четверг"\ + "пÑтница"\ + "Ñуббота"] ::msgcat::mcset ru MONTHS_ABBREV [list \ - "\u044f\u043d\u0432"\ - "\u0444\u0435\u0432"\ - "\u043c\u0430\u0440"\ - "\u0430\u043f\u0440"\ - "\u043c\u0430\u0439"\ - "\u0438\u044e\u043d"\ - "\u0438\u044e\u043b"\ - "\u0430\u0432\u0433"\ - "\u0441\u0435\u043d"\ - "\u043e\u043a\u0442"\ - "\u043d\u043e\u044f"\ - "\u0434\u0435\u043a"\ + "Ñнв"\ + "фев"\ + "мар"\ + "апр"\ + "май"\ + "июн"\ + "июл"\ + "авг"\ + "Ñен"\ + "окт"\ + "ноÑ"\ + "дек"\ ""] ::msgcat::mcset ru MONTHS_FULL [list \ - "\u042f\u043d\u0432\u0430\u0440\u044c"\ - "\u0424\u0435\u0432\u0440\u0430\u043b\u044c"\ - "\u041c\u0430\u0440\u0442"\ - "\u0410\u043f\u0440\u0435\u043b\u044c"\ - "\u041c\u0430\u0439"\ - "\u0418\u044e\u043d\u044c"\ - "\u0418\u044e\u043b\u044c"\ - "\u0410\u0432\u0433\u0443\u0441\u0442"\ - "\u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c"\ - "\u041e\u043a\u0442\u044f\u0431\u0440\u044c"\ - "\u041d\u043e\u044f\u0431\u0440\u044c"\ - "\u0414\u0435\u043a\u0430\u0431\u0440\u044c"\ + "Январь"\ + "Февраль"\ + "Март"\ + "Ðпрель"\ + "Май"\ + "Июнь"\ + "Июль"\ + "ÐвгуÑÑ‚"\ + "СентÑбрь"\ + "ОктÑбрь"\ + "ÐоÑбрь"\ + "Декабрь"\ ""] - ::msgcat::mcset ru BCE "\u0434\u043e \u043d.\u044d." - ::msgcat::mcset ru CE "\u043d.\u044d." + ::msgcat::mcset ru BCE "до н.Ñ." + ::msgcat::mcset ru CE "н.Ñ." ::msgcat::mcset ru DATE_FORMAT "%d.%m.%Y" ::msgcat::mcset ru TIME_FORMAT "%k:%M:%S" ::msgcat::mcset ru DATE_TIME_FORMAT "%d.%m.%Y %k:%M:%S %z" diff --git a/library/msgs/sh.msg b/library/msgs/sh.msg index 6ee0fc7..2e4143d 100644 --- a/library/msgs/sh.msg +++ b/library/msgs/sh.msg @@ -5,7 +5,7 @@ namespace eval ::tcl::clock { "Pon"\ "Uto"\ "Sre"\ - "\u010cet"\ + "ÄŒet"\ "Pet"\ "Sub"] ::msgcat::mcset sh DAYS_OF_WEEK_FULL [list \ @@ -13,7 +13,7 @@ namespace eval ::tcl::clock { "Ponedeljak"\ "Utorak"\ "Sreda"\ - "\u010cetvrtak"\ + "ÄŒetvrtak"\ "Petak"\ "Subota"] ::msgcat::mcset sh MONTHS_ABBREV [list \ diff --git a/library/msgs/sk.msg b/library/msgs/sk.msg index 9b2f0aa..dc6f6b6 100644 --- a/library/msgs/sk.msg +++ b/library/msgs/sk.msg @@ -5,15 +5,15 @@ namespace eval ::tcl::clock { "Po"\ "Ut"\ "St"\ - "\u0160t"\ + "Å t"\ "Pa"\ "So"] ::msgcat::mcset sk DAYS_OF_WEEK_FULL [list \ - "Nede\u013ee"\ + "Nedeľe"\ "Pondelok"\ "Utorok"\ "Streda"\ - "\u0160tvrtok"\ + "Å tvrtok"\ "Piatok"\ "Sobota"] ::msgcat::mcset sk MONTHS_ABBREV [list \ @@ -21,9 +21,9 @@ namespace eval ::tcl::clock { "feb"\ "mar"\ "apr"\ - "m\u00e1j"\ - "j\u00fan"\ - "j\u00fal"\ + "máj"\ + "jún"\ + "júl"\ "aug"\ "sep"\ "okt"\ @@ -31,16 +31,16 @@ namespace eval ::tcl::clock { "dec"\ ""] ::msgcat::mcset sk MONTHS_FULL [list \ - "janu\u00e1r"\ - "febru\u00e1r"\ + "január"\ + "február"\ "marec"\ - "apr\u00edl"\ - "m\u00e1j"\ - "j\u00fan"\ - "j\u00fal"\ + "apríl"\ + "máj"\ + "jún"\ + "júl"\ "august"\ "september"\ - "okt\u00f3ber"\ + "október"\ "november"\ "december"\ ""] diff --git a/library/msgs/sl.msg b/library/msgs/sl.msg index 42bc509..2ee0a03 100644 --- a/library/msgs/sl.msg +++ b/library/msgs/sl.msg @@ -5,7 +5,7 @@ namespace eval ::tcl::clock { "Pon"\ "Tor"\ "Sre"\ - "\u010cet"\ + "ÄŒet"\ "Pet"\ "Sob"] ::msgcat::mcset sl DAYS_OF_WEEK_FULL [list \ @@ -13,7 +13,7 @@ namespace eval ::tcl::clock { "Ponedeljek"\ "Torek"\ "Sreda"\ - "\u010cetrtek"\ + "ÄŒetrtek"\ "Petek"\ "Sobota"] ::msgcat::mcset sl MONTHS_ABBREV [list \ @@ -44,7 +44,7 @@ namespace eval ::tcl::clock { "november"\ "december"\ ""] - ::msgcat::mcset sl BCE "pr.n.\u0161." + ::msgcat::mcset sl BCE "pr.n.Å¡." ::msgcat::mcset sl CE "po Kr." ::msgcat::mcset sl DATE_FORMAT "%Y.%m.%e" ::msgcat::mcset sl TIME_FORMAT "%k:%M:%S" diff --git a/library/msgs/sq.msg b/library/msgs/sq.msg index 8fb1fce..65da407 100644 --- a/library/msgs/sq.msg +++ b/library/msgs/sq.msg @@ -2,20 +2,20 @@ namespace eval ::tcl::clock { ::msgcat::mcset sq DAYS_OF_WEEK_ABBREV [list \ "Die"\ - "H\u00ebn"\ + "Hën"\ "Mar"\ - "M\u00ebr"\ + "Mër"\ "Enj"\ "Pre"\ "Sht"] ::msgcat::mcset sq DAYS_OF_WEEK_FULL [list \ "e diel"\ - "e h\u00ebn\u00eb"\ - "e mart\u00eb"\ - "e m\u00ebrkur\u00eb"\ + "e hënë"\ + "e martë"\ + "e mërkurë"\ "e enjte"\ "e premte"\ - "e shtun\u00eb"] + "e shtunë"] ::msgcat::mcset sq MONTHS_ABBREV [list \ "Jan"\ "Shk"\ @@ -27,7 +27,7 @@ namespace eval ::tcl::clock { "Gsh"\ "Sht"\ "Tet"\ - "N\u00ebn"\ + "Nën"\ "Dhj"\ ""] ::msgcat::mcset sq MONTHS_FULL [list \ @@ -41,7 +41,7 @@ namespace eval ::tcl::clock { "gusht"\ "shtator"\ "tetor"\ - "n\u00ebntor"\ + "nëntor"\ "dhjetor"\ ""] ::msgcat::mcset sq BCE "p.e.r." diff --git a/library/msgs/sr.msg b/library/msgs/sr.msg index 7576668..3d84d6c 100644 --- a/library/msgs/sr.msg +++ b/library/msgs/sr.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset sr DAYS_OF_WEEK_ABBREV [list \ - "\u041d\u0435\u0434"\ - "\u041f\u043e\u043d"\ - "\u0423\u0442\u043e"\ - "\u0421\u0440\u0435"\ - "\u0427\u0435\u0442"\ - "\u041f\u0435\u0442"\ - "\u0421\u0443\u0431"] + "Ðед"\ + "Пон"\ + "Уто"\ + "Сре"\ + "Чет"\ + "Пет"\ + "Суб"] ::msgcat::mcset sr DAYS_OF_WEEK_FULL [list \ - "\u041d\u0435\u0434\u0435\u0459\u0430"\ - "\u041f\u043e\u043d\u0435\u0434\u0435\u0459\u0430\u043a"\ - "\u0423\u0442\u043e\u0440\u0430\u043a"\ - "\u0421\u0440\u0435\u0434\u0430"\ - "\u0427\u0435\u0442\u0432\u0440\u0442\u0430\u043a"\ - "\u041f\u0435\u0442\u0430\u043a"\ - "\u0421\u0443\u0431\u043e\u0442\u0430"] + "Ðедеља"\ + "Понедељак"\ + "Уторак"\ + "Среда"\ + "Четвртак"\ + "Петак"\ + "Субота"] ::msgcat::mcset sr MONTHS_ABBREV [list \ - "\u0408\u0430\u043d"\ - "\u0424\u0435\u0431"\ - "\u041c\u0430\u0440"\ - "\u0410\u043f\u0440"\ - "\u041c\u0430\u0458"\ - "\u0408\u0443\u043d"\ - "\u0408\u0443\u043b"\ - "\u0410\u0432\u0433"\ - "\u0421\u0435\u043f"\ - "\u041e\u043a\u0442"\ - "\u041d\u043e\u0432"\ - "\u0414\u0435\u0446"\ + "Јан"\ + "Феб"\ + "Мар"\ + "Ðпр"\ + "Мај"\ + "Јун"\ + "Јул"\ + "Ðвг"\ + "Сеп"\ + "Окт"\ + "Ðов"\ + "Дец"\ ""] ::msgcat::mcset sr MONTHS_FULL [list \ - "\u0408\u0430\u043d\u0443\u0430\u0440"\ - "\u0424\u0435\u0431\u0440\u0443\u0430\u0440"\ - "\u041c\u0430\u0440\u0442"\ - "\u0410\u043f\u0440\u0438\u043b"\ - "\u041c\u0430\u0458"\ - "\u0408\u0443\u043d\u0438"\ - "\u0408\u0443\u043b\u0438"\ - "\u0410\u0432\u0433\u0443\u0441\u0442"\ - "\u0421\u0435\u043f\u0442\u0435\u043c\u0431\u0430\u0440"\ - "\u041e\u043a\u0442\u043e\u0431\u0430\u0440"\ - "\u041d\u043e\u0432\u0435\u043c\u0431\u0430\u0440"\ - "\u0414\u0435\u0446\u0435\u043c\u0431\u0430\u0440"\ + "Јануар"\ + "Фебруар"\ + "Март"\ + "Ðприл"\ + "Мај"\ + "Јуни"\ + "Јули"\ + "ÐвгуÑÑ‚"\ + "Септембар"\ + "Октобар"\ + "Ðовембар"\ + "Децембар"\ ""] - ::msgcat::mcset sr BCE "\u043f. \u043d. \u0435." - ::msgcat::mcset sr CE "\u043d. \u0435" + ::msgcat::mcset sr BCE "п. н. е." + ::msgcat::mcset sr CE "н. е" ::msgcat::mcset sr DATE_FORMAT "%Y.%m.%e" ::msgcat::mcset sr TIME_FORMAT "%k.%M.%S" ::msgcat::mcset sr DATE_TIME_FORMAT "%Y.%m.%e %k.%M.%S %z" diff --git a/library/msgs/sv.msg b/library/msgs/sv.msg index f7a67c6..5716092 100644 --- a/library/msgs/sv.msg +++ b/library/msgs/sv.msg @@ -1,21 +1,21 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset sv DAYS_OF_WEEK_ABBREV [list \ - "s\u00f6"\ - "m\u00e5"\ + "sö"\ + "mÃ¥"\ "ti"\ "on"\ "to"\ "fr"\ - "l\u00f6"] + "lö"] ::msgcat::mcset sv DAYS_OF_WEEK_FULL [list \ - "s\u00f6ndag"\ - "m\u00e5ndag"\ + "söndag"\ + "mÃ¥ndag"\ "tisdag"\ "onsdag"\ "torsdag"\ "fredag"\ - "l\u00f6rdag"] + "lördag"] ::msgcat::mcset sv MONTHS_ABBREV [list \ "jan"\ "feb"\ diff --git a/library/msgs/ta.msg b/library/msgs/ta.msg index 4abb90c..ea62552 100644 --- a/library/msgs/ta.msg +++ b/library/msgs/ta.msg @@ -1,39 +1,39 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset ta DAYS_OF_WEEK_FULL [list \ - "\u0b9e\u0bbe\u0baf\u0bbf\u0bb1\u0bc1"\ - "\u0ba4\u0bbf\u0b99\u0bcd\u0b95\u0bb3\u0bcd"\ - "\u0b9a\u0bc6\u0bb5\u0bcd\u0bb5\u0bbe\u0baf\u0bcd"\ - "\u0baa\u0bc1\u0ba4\u0ba9\u0bcd"\ - "\u0bb5\u0bbf\u0baf\u0bbe\u0bb4\u0ba9\u0bcd"\ - "\u0bb5\u0bc6\u0bb3\u0bcd\u0bb3\u0bbf"\ - "\u0b9a\u0ba9\u0bbf"] + "ஞாயிறà¯"\ + "திஙà¯à®•ளà¯"\ + "செவà¯à®µà®¾à®¯à¯"\ + "பà¯à®¤à®©à¯"\ + "வியாழனà¯"\ + "வெளà¯à®³à®¿"\ + "சனி"] ::msgcat::mcset ta MONTHS_ABBREV [list \ - "\u0b9c\u0ba9\u0bb5\u0bb0\u0bbf"\ - "\u0baa\u0bc6\u0baa\u0bcd\u0bb0\u0bb5\u0bb0\u0bbf"\ - "\u0bae\u0bbe\u0bb0\u0bcd\u0b9a\u0bcd"\ - "\u0b8f\u0baa\u0bcd\u0bb0\u0bb2\u0bcd"\ - "\u0bae\u0bc7"\ - "\u0b9c\u0bc2\u0ba9\u0bcd"\ - "\u0b9c\u0bc2\u0bb2\u0bc8"\ - "\u0b86\u0b95\u0bb8\u0bcd\u0b9f\u0bcd"\ - "\u0b9a\u0bc6\u0baa\u0bcd\u0b9f\u0bae\u0bcd\u0baa\u0bb0\u0bcd"\ - "\u0b85\u0b95\u0bcd\u0b9f\u0bcb\u0baa\u0bb0\u0bcd"\ - "\u0ba8\u0bb5\u0bae\u0bcd\u0baa\u0bb0\u0bcd"\ - "\u0b9f\u0bbf\u0b9a\u0bae\u0bcd\u0baa\u0bb0\u0bcdr"] + "ஜனவரி"\ + "பெபà¯à®°à®µà®°à®¿"\ + "மாரà¯à®šà¯"\ + "à®à®ªà¯à®°à®²à¯"\ + "மே"\ + "ஜூனà¯"\ + "ஜூலை"\ + "ஆகஸà¯à®Ÿà¯"\ + "செபà¯à®Ÿà®®à¯à®ªà®°à¯"\ + "அகà¯à®Ÿà¯‹à®ªà®°à¯"\ + "நவமà¯à®ªà®°à¯"\ + "டிசமà¯à®ªà®°à¯r"] ::msgcat::mcset ta MONTHS_FULL [list \ - "\u0b9c\u0ba9\u0bb5\u0bb0\u0bbf"\ - "\u0baa\u0bc6\u0baa\u0bcd\u0bb0\u0bb5\u0bb0\u0bbf"\ - "\u0bae\u0bbe\u0bb0\u0bcd\u0b9a\u0bcd"\ - "\u0b8f\u0baa\u0bcd\u0bb0\u0bb2\u0bcd"\ - "\u0bae\u0bc7"\ - "\u0b9c\u0bc2\u0ba9\u0bcd"\ - "\u0b9c\u0bc2\u0bb2\u0bc8"\ - "\u0b86\u0b95\u0bb8\u0bcd\u0b9f\u0bcd"\ - "\u0b9a\u0bc6\u0baa\u0bcd\u0b9f\u0bae\u0bcd\u0baa\u0bb0\u0bcd"\ - "\u0b85\u0b95\u0bcd\u0b9f\u0bcb\u0baa\u0bb0\u0bcd"\ - "\u0ba8\u0bb5\u0bae\u0bcd\u0baa\u0bb0\u0bcd"\ - "\u0b9f\u0bbf\u0b9a\u0bae\u0bcd\u0baa\u0bb0\u0bcdr"] - ::msgcat::mcset ta AM "\u0b95\u0bbf\u0bae\u0bc1" - ::msgcat::mcset ta PM "\u0b95\u0bbf\u0baa\u0bbf" + "ஜனவரி"\ + "பெபà¯à®°à®µà®°à®¿"\ + "மாரà¯à®šà¯"\ + "à®à®ªà¯à®°à®²à¯"\ + "மே"\ + "ஜூனà¯"\ + "ஜூலை"\ + "ஆகஸà¯à®Ÿà¯"\ + "செபà¯à®Ÿà®®à¯à®ªà®°à¯"\ + "அகà¯à®Ÿà¯‹à®ªà®°à¯"\ + "நவமà¯à®ªà®°à¯"\ + "டிசமà¯à®ªà®°à¯r"] + ::msgcat::mcset ta AM "கிமà¯" + ::msgcat::mcset ta PM "கிபி" } diff --git a/library/msgs/te.msg b/library/msgs/te.msg index 6111473..f35ece4 100644 --- a/library/msgs/te.msg +++ b/library/msgs/te.msg @@ -1,47 +1,47 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset te DAYS_OF_WEEK_ABBREV [list \ - "\u0c06\u0c26\u0c3f"\ - "\u0c38\u0c4b\u0c2e"\ - "\u0c2e\u0c02\u0c17\u0c33"\ - "\u0c2c\u0c41\u0c27"\ - "\u0c17\u0c41\u0c30\u0c41"\ - "\u0c36\u0c41\u0c15\u0c4d\u0c30"\ - "\u0c36\u0c28\u0c3f"] + "ఆది"\ + "సోమ"\ + "మంగళ"\ + "à°¬à±à°§"\ + "à°—à±à°°à±"\ + "à°¶à±à°•à±à°°"\ + "శని"] ::msgcat::mcset te DAYS_OF_WEEK_FULL [list \ - "\u0c06\u0c26\u0c3f\u0c35\u0c3e\u0c30\u0c02"\ - "\u0c38\u0c4b\u0c2e\u0c35\u0c3e\u0c30\u0c02"\ - "\u0c2e\u0c02\u0c17\u0c33\u0c35\u0c3e\u0c30\u0c02"\ - "\u0c2c\u0c41\u0c27\u0c35\u0c3e\u0c30\u0c02"\ - "\u0c17\u0c41\u0c30\u0c41\u0c35\u0c3e\u0c30\u0c02"\ - "\u0c36\u0c41\u0c15\u0c4d\u0c30\u0c35\u0c3e\u0c30\u0c02"\ - "\u0c36\u0c28\u0c3f\u0c35\u0c3e\u0c30\u0c02"] + "ఆదివారం"\ + "సోమవారం"\ + "మంగళవారం"\ + "à°¬à±à°§à°µà°¾à°°à°‚"\ + "à°—à±à°°à±à°µà°¾à°°à°‚"\ + "à°¶à±à°•à±à°°à°µà°¾à°°à°‚"\ + "శనివారం"] ::msgcat::mcset te MONTHS_ABBREV [list \ - "\u0c1c\u0c28\u0c35\u0c30\u0c3f"\ - "\u0c2b\u0c3f\u0c2c\u0c4d\u0c30\u0c35\u0c30\u0c3f"\ - "\u0c2e\u0c3e\u0c30\u0c4d\u0c1a\u0c3f"\ - "\u0c0f\u0c2a\u0c4d\u0c30\u0c3f\u0c32\u0c4d"\ - "\u0c2e\u0c47"\ - "\u0c1c\u0c42\u0c28\u0c4d"\ - "\u0c1c\u0c42\u0c32\u0c48"\ - "\u0c06\u0c17\u0c38\u0c4d\u0c1f\u0c41"\ - "\u0c38\u0c46\u0c2a\u0c4d\u0c1f\u0c46\u0c02\u0c2c\u0c30\u0c4d"\ - "\u0c05\u0c15\u0c4d\u0c1f\u0c4b\u0c2c\u0c30\u0c4d"\ - "\u0c28\u0c35\u0c02\u0c2c\u0c30\u0c4d"\ - "\u0c21\u0c3f\u0c38\u0c46\u0c02\u0c2c\u0c30\u0c4d"\ + "జనవరి"\ + "à°«à°¿à°¬à±à°°à°µà°°à°¿"\ + "మారà±à°šà°¿"\ + "à°à°ªà±à°°à°¿à°²à±"\ + "మే"\ + "జూనà±"\ + "జూలై"\ + "ఆగసà±à°Ÿà±"\ + "సెపà±à°Ÿà±†à°‚బరà±"\ + "à°…à°•à±à°Ÿà±‹à°¬à°°à±"\ + "నవంబరà±"\ + "డిసెంబరà±"\ ""] ::msgcat::mcset te MONTHS_FULL [list \ - "\u0c1c\u0c28\u0c35\u0c30\u0c3f"\ - "\u0c2b\u0c3f\u0c2c\u0c4d\u0c30\u0c35\u0c30\u0c3f"\ - "\u0c2e\u0c3e\u0c30\u0c4d\u0c1a\u0c3f"\ - "\u0c0f\u0c2a\u0c4d\u0c30\u0c3f\u0c32\u0c4d"\ - "\u0c2e\u0c47"\ - "\u0c1c\u0c42\u0c28\u0c4d"\ - "\u0c1c\u0c42\u0c32\u0c48"\ - "\u0c06\u0c17\u0c38\u0c4d\u0c1f\u0c41"\ - "\u0c38\u0c46\u0c2a\u0c4d\u0c1f\u0c46\u0c02\u0c2c\u0c30\u0c4d"\ - "\u0c05\u0c15\u0c4d\u0c1f\u0c4b\u0c2c\u0c30\u0c4d"\ - "\u0c28\u0c35\u0c02\u0c2c\u0c30\u0c4d"\ - "\u0c21\u0c3f\u0c38\u0c46\u0c02\u0c2c\u0c30\u0c4d"\ + "జనవరి"\ + "à°«à°¿à°¬à±à°°à°µà°°à°¿"\ + "మారà±à°šà°¿"\ + "à°à°ªà±à°°à°¿à°²à±"\ + "మే"\ + "జూనà±"\ + "జూలై"\ + "ఆగసà±à°Ÿà±"\ + "సెపà±à°Ÿà±†à°‚బరà±"\ + "à°…à°•à±à°Ÿà±‹à°¬à°°à±"\ + "నవంబరà±"\ + "డిసెంబరà±"\ ""] } diff --git a/library/msgs/te_in.msg b/library/msgs/te_in.msg index 61638b5..84dd2b3 100644 --- a/library/msgs/te_in.msg +++ b/library/msgs/te_in.msg @@ -1,7 +1,7 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { - ::msgcat::mcset te_IN AM "\u0c2a\u0c42\u0c30\u0c4d\u0c35\u0c3e\u0c39\u0c4d\u0c28" - ::msgcat::mcset te_IN PM "\u0c05\u0c2a\u0c30\u0c3e\u0c39\u0c4d\u0c28" + ::msgcat::mcset te_IN AM "పూరà±à°µà°¾à°¹à±à°¨" + ::msgcat::mcset te_IN PM "అపరాహà±à°¨" ::msgcat::mcset te_IN DATE_FORMAT "%d/%m/%Y" ::msgcat::mcset te_IN TIME_FORMAT_12 "%I:%M:%S %P" ::msgcat::mcset te_IN DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z" diff --git a/library/msgs/th.msg b/library/msgs/th.msg index 7486c35..edaa149 100644 --- a/library/msgs/th.msg +++ b/library/msgs/th.msg @@ -1,53 +1,53 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset th DAYS_OF_WEEK_ABBREV [list \ - "\u0e2d\u0e32."\ - "\u0e08."\ - "\u0e2d."\ - "\u0e1e."\ - "\u0e1e\u0e24."\ - "\u0e28."\ - "\u0e2a."] + "อา."\ + "จ."\ + "อ."\ + "พ."\ + "พฤ."\ + "ศ."\ + "ส."] ::msgcat::mcset th DAYS_OF_WEEK_FULL [list \ - "\u0e27\u0e31\u0e19\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c"\ - "\u0e27\u0e31\u0e19\u0e08\u0e31\u0e19\u0e17\u0e23\u0e4c"\ - "\u0e27\u0e31\u0e19\u0e2d\u0e31\u0e07\u0e04\u0e32\u0e23"\ - "\u0e27\u0e31\u0e19\u0e1e\u0e38\u0e18"\ - "\u0e27\u0e31\u0e19\u0e1e\u0e24\u0e2b\u0e31\u0e2a\u0e1a\u0e14\u0e35"\ - "\u0e27\u0e31\u0e19\u0e28\u0e38\u0e01\u0e23\u0e4c"\ - "\u0e27\u0e31\u0e19\u0e40\u0e2a\u0e32\u0e23\u0e4c"] + "วันอาทิตย์"\ + "วันจันทร์"\ + "วันอังคาร"\ + "วันพุธ"\ + "วันพฤหัสบดี"\ + "วันศุà¸à¸£à¹Œ"\ + "วันเสาร์"] ::msgcat::mcset th MONTHS_ABBREV [list \ - "\u0e21.\u0e04."\ - "\u0e01.\u0e1e."\ - "\u0e21\u0e35.\u0e04."\ - "\u0e40\u0e21.\u0e22."\ - "\u0e1e.\u0e04."\ - "\u0e21\u0e34.\u0e22."\ - "\u0e01.\u0e04."\ - "\u0e2a.\u0e04."\ - "\u0e01.\u0e22."\ - "\u0e15.\u0e04."\ - "\u0e1e.\u0e22."\ - "\u0e18.\u0e04."\ + "ม.ค."\ + "à¸.พ."\ + "มี.ค."\ + "เม.ย."\ + "พ.ค."\ + "มิ.ย."\ + "à¸.ค."\ + "ส.ค."\ + "à¸.ย."\ + "ต.ค."\ + "พ.ย."\ + "ธ.ค."\ ""] ::msgcat::mcset th MONTHS_FULL [list \ - "\u0e21\u0e01\u0e23\u0e32\u0e04\u0e21"\ - "\u0e01\u0e38\u0e21\u0e20\u0e32\u0e1e\u0e31\u0e19\u0e18\u0e4c"\ - "\u0e21\u0e35\u0e19\u0e32\u0e04\u0e21"\ - "\u0e40\u0e21\u0e29\u0e32\u0e22\u0e19"\ - "\u0e1e\u0e24\u0e29\u0e20\u0e32\u0e04\u0e21"\ - "\u0e21\u0e34\u0e16\u0e38\u0e19\u0e32\u0e22\u0e19"\ - "\u0e01\u0e23\u0e01\u0e0e\u0e32\u0e04\u0e21"\ - "\u0e2a\u0e34\u0e07\u0e2b\u0e32\u0e04\u0e21"\ - "\u0e01\u0e31\u0e19\u0e22\u0e32\u0e22\u0e19"\ - "\u0e15\u0e38\u0e25\u0e32\u0e04\u0e21"\ - "\u0e1e\u0e24\u0e28\u0e08\u0e34\u0e01\u0e32\u0e22\u0e19"\ - "\u0e18\u0e31\u0e19\u0e27\u0e32\u0e04\u0e21"\ + "มà¸à¸£à¸²à¸„ม"\ + "à¸à¸¸à¸¡à¸ à¸²à¸žà¸±à¸™à¸˜à¹Œ"\ + "มีนาคม"\ + "เมษายน"\ + "พฤษภาคม"\ + "มิถุนายน"\ + "à¸à¸£à¸à¸Žà¸²à¸„ม"\ + "สิงหาคม"\ + "à¸à¸±à¸™à¸¢à¸²à¸¢à¸™"\ + "ตุลาคม"\ + "พฤศจิà¸à¸²à¸¢à¸™"\ + "ธันวาคม"\ ""] - ::msgcat::mcset th BCE "\u0e25\u0e17\u0e35\u0e48" - ::msgcat::mcset th CE "\u0e04.\u0e28." - ::msgcat::mcset th AM "\u0e01\u0e48\u0e2d\u0e19\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07" - ::msgcat::mcset th PM "\u0e2b\u0e25\u0e31\u0e07\u0e40\u0e17\u0e35\u0e48\u0e22\u0e07" + ::msgcat::mcset th BCE "ลที่" + ::msgcat::mcset th CE "ค.ศ." + ::msgcat::mcset th AM "à¸à¹ˆà¸­à¸™à¹€à¸—ี่ยง" + ::msgcat::mcset th PM "หลังเที่ยง" ::msgcat::mcset th DATE_FORMAT "%e/%m/%Y" ::msgcat::mcset th TIME_FORMAT "%k:%M:%S" ::msgcat::mcset th DATE_TIME_FORMAT "%e/%m/%Y %k:%M:%S %z" diff --git a/library/msgs/tr.msg b/library/msgs/tr.msg index 7b2ecf9..12869ee 100644 --- a/library/msgs/tr.msg +++ b/library/msgs/tr.msg @@ -4,27 +4,27 @@ namespace eval ::tcl::clock { "Paz"\ "Pzt"\ "Sal"\ - "\u00c7ar"\ + "Çar"\ "Per"\ "Cum"\ "Cmt"] ::msgcat::mcset tr DAYS_OF_WEEK_FULL [list \ "Pazar"\ "Pazartesi"\ - "Sal\u0131"\ - "\u00c7ar\u015famba"\ - "Per\u015fembe"\ + "Salı"\ + "ÇarÅŸamba"\ + "PerÅŸembe"\ "Cuma"\ "Cumartesi"] ::msgcat::mcset tr MONTHS_ABBREV [list \ "Oca"\ - "\u015eub"\ + "Åžub"\ "Mar"\ "Nis"\ "May"\ "Haz"\ "Tem"\ - "A\u011fu"\ + "AÄŸu"\ "Eyl"\ "Eki"\ "Kas"\ @@ -32,17 +32,17 @@ namespace eval ::tcl::clock { ""] ::msgcat::mcset tr MONTHS_FULL [list \ "Ocak"\ - "\u015eubat"\ + "Åžubat"\ "Mart"\ "Nisan"\ - "May\u0131s"\ + "Mayıs"\ "Haziran"\ "Temmuz"\ - "A\u011fustos"\ - "Eyl\u00fcl"\ + "AÄŸustos"\ + "Eylül"\ "Ekim"\ - "Kas\u0131m"\ - "Aral\u0131k"\ + "Kasım"\ + "Aralık"\ ""] ::msgcat::mcset tr DATE_FORMAT "%d.%m.%Y" ::msgcat::mcset tr TIME_FORMAT "%H:%M:%S" diff --git a/library/msgs/uk.msg b/library/msgs/uk.msg index 7d4c64a..42eb095 100644 --- a/library/msgs/uk.msg +++ b/library/msgs/uk.msg @@ -1,51 +1,51 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset uk DAYS_OF_WEEK_ABBREV [list \ - "\u043d\u0434"\ - "\u043f\u043d"\ - "\u0432\u0442"\ - "\u0441\u0440"\ - "\u0447\u0442"\ - "\u043f\u0442"\ - "\u0441\u0431"] + "нд"\ + "пн"\ + "вт"\ + "ÑÑ€"\ + "чт"\ + "пт"\ + "Ñб"] ::msgcat::mcset uk DAYS_OF_WEEK_FULL [list \ - "\u043d\u0435\u0434\u0456\u043b\u044f"\ - "\u043f\u043e\u043d\u0435\u0434\u0456\u043b\u043e\u043a"\ - "\u0432\u0456\u0432\u0442\u043e\u0440\u043e\u043a"\ - "\u0441\u0435\u0440\u0435\u0434\u0430"\ - "\u0447\u0435\u0442\u0432\u0435\u0440"\ - "\u043f'\u044f\u0442\u043d\u0438\u0446\u044f"\ - "\u0441\u0443\u0431\u043e\u0442\u0430"] + "неділÑ"\ + "понеділок"\ + "вівторок"\ + "Ñереда"\ + "четвер"\ + "п'ÑтницÑ"\ + "Ñубота"] ::msgcat::mcset uk MONTHS_ABBREV [list \ - "\u0441\u0456\u0447"\ - "\u043b\u044e\u0442"\ - "\u0431\u0435\u0440"\ - "\u043a\u0432\u0456\u0442"\ - "\u0442\u0440\u0430\u0432"\ - "\u0447\u0435\u0440\u0432"\ - "\u043b\u0438\u043f"\ - "\u0441\u0435\u0440\u043f"\ - "\u0432\u0435\u0440"\ - "\u0436\u043e\u0432\u0442"\ - "\u043b\u0438\u0441\u0442"\ - "\u0433\u0440\u0443\u0434"\ + "Ñіч"\ + "лют"\ + "бер"\ + "квіт"\ + "трав"\ + "черв"\ + "лип"\ + "Ñерп"\ + "вер"\ + "жовт"\ + "лиÑÑ‚"\ + "груд"\ ""] ::msgcat::mcset uk MONTHS_FULL [list \ - "\u0441\u0456\u0447\u043d\u044f"\ - "\u043b\u044e\u0442\u043e\u0433\u043e"\ - "\u0431\u0435\u0440\u0435\u0437\u043d\u044f"\ - "\u043a\u0432\u0456\u0442\u043d\u044f"\ - "\u0442\u0440\u0430\u0432\u043d\u044f"\ - "\u0447\u0435\u0440\u0432\u043d\u044f"\ - "\u043b\u0438\u043f\u043d\u044f"\ - "\u0441\u0435\u0440\u043f\u043d\u044f"\ - "\u0432\u0435\u0440\u0435\u0441\u043d\u044f"\ - "\u0436\u043e\u0432\u0442\u043d\u044f"\ - "\u043b\u0438\u0441\u0442\u043e\u043f\u0430\u0434\u0430"\ - "\u0433\u0440\u0443\u0434\u043d\u044f"\ + "ÑічнÑ"\ + "лютого"\ + "березнÑ"\ + "квітнÑ"\ + "травнÑ"\ + "червнÑ"\ + "липнÑ"\ + "ÑерпнÑ"\ + "вереÑнÑ"\ + "жовтнÑ"\ + "лиÑтопада"\ + "груднÑ"\ ""] - ::msgcat::mcset uk BCE "\u0434\u043e \u043d.\u0435." - ::msgcat::mcset uk CE "\u043f\u0456\u0441\u043b\u044f \u043d.\u0435." + ::msgcat::mcset uk BCE "до н.е." + ::msgcat::mcset uk CE "піÑÐ»Ñ Ð½.е." ::msgcat::mcset uk DATE_FORMAT "%e/%m/%Y" ::msgcat::mcset uk TIME_FORMAT "%k:%M:%S" ::msgcat::mcset uk DATE_TIME_FORMAT "%e/%m/%Y %k:%M:%S %z" diff --git a/library/msgs/vi.msg b/library/msgs/vi.msg index c98b2a6..3437ebf 100644 --- a/library/msgs/vi.msg +++ b/library/msgs/vi.msg @@ -9,13 +9,13 @@ namespace eval ::tcl::clock { "Th 7"\ "CN"] ::msgcat::mcset vi DAYS_OF_WEEK_FULL [list \ - "Th\u01b0\u0301 hai"\ - "Th\u01b0\u0301 ba"\ - "Th\u01b0\u0301 t\u01b0"\ - "Th\u01b0\u0301 n\u0103m"\ - "Th\u01b0\u0301 s\u00e1u"\ - "Th\u01b0\u0301 ba\u0309y"\ - "Chu\u0309 nh\u00e2\u0323t"] + "ThÆ°Ì hai"\ + "ThÆ°Ì ba"\ + "ThÆ°Ì tư"\ + "ThÆ°Ì năm"\ + "ThÆ°Ì sáu"\ + "ThÆ°Ì bảy"\ + "Chủ nhật"] ::msgcat::mcset vi MONTHS_ABBREV [list \ "Thg 1"\ "Thg 2"\ @@ -31,18 +31,18 @@ namespace eval ::tcl::clock { "Thg 12"\ ""] ::msgcat::mcset vi MONTHS_FULL [list \ - "Th\u00e1ng m\u00f4\u0323t"\ - "Th\u00e1ng hai"\ - "Th\u00e1ng ba"\ - "Th\u00e1ng t\u01b0"\ - "Th\u00e1ng n\u0103m"\ - "Th\u00e1ng s\u00e1u"\ - "Th\u00e1ng ba\u0309y"\ - "Th\u00e1ng t\u00e1m"\ - "Th\u00e1ng ch\u00edn"\ - "Th\u00e1ng m\u01b0\u01a1\u0300i"\ - "Th\u00e1ng m\u01b0\u01a1\u0300i m\u00f4\u0323t"\ - "Th\u00e1ng m\u01b0\u01a1\u0300i hai"\ + "Tháng một"\ + "Tháng hai"\ + "Tháng ba"\ + "Tháng tư"\ + "Tháng năm"\ + "Tháng sáu"\ + "Tháng bảy"\ + "Tháng tám"\ + "Tháng chín"\ + "Tháng mười"\ + "Tháng mười một"\ + "Tháng mười hai"\ ""] ::msgcat::mcset vi DATE_FORMAT "%d %b %Y" ::msgcat::mcset vi TIME_FORMAT "%H:%M:%S" diff --git a/library/msgs/zh.msg b/library/msgs/zh.msg index b799a32..9c1d08b 100644 --- a/library/msgs/zh.msg +++ b/library/msgs/zh.msg @@ -1,55 +1,55 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset zh DAYS_OF_WEEK_ABBREV [list \ - "\u661f\u671f\u65e5"\ - "\u661f\u671f\u4e00"\ - "\u661f\u671f\u4e8c"\ - "\u661f\u671f\u4e09"\ - "\u661f\u671f\u56db"\ - "\u661f\u671f\u4e94"\ - "\u661f\u671f\u516d"] + "星期日"\ + "星期一"\ + "星期二"\ + "星期三"\ + "星期四"\ + "星期五"\ + "星期六"] ::msgcat::mcset zh DAYS_OF_WEEK_FULL [list \ - "\u661f\u671f\u65e5"\ - "\u661f\u671f\u4e00"\ - "\u661f\u671f\u4e8c"\ - "\u661f\u671f\u4e09"\ - "\u661f\u671f\u56db"\ - "\u661f\u671f\u4e94"\ - "\u661f\u671f\u516d"] + "星期日"\ + "星期一"\ + "星期二"\ + "星期三"\ + "星期四"\ + "星期五"\ + "星期六"] ::msgcat::mcset zh MONTHS_ABBREV [list \ - "\u4e00\u6708"\ - "\u4e8c\u6708"\ - "\u4e09\u6708"\ - "\u56db\u6708"\ - "\u4e94\u6708"\ - "\u516d\u6708"\ - "\u4e03\u6708"\ - "\u516b\u6708"\ - "\u4e5d\u6708"\ - "\u5341\u6708"\ - "\u5341\u4e00\u6708"\ - "\u5341\u4e8c\u6708"\ + "一月"\ + "二月"\ + "三月"\ + "四月"\ + "五月"\ + "六月"\ + "七月"\ + "八月"\ + "乿œˆ"\ + "åæœˆ"\ + "å一月"\ + "å二月"\ ""] ::msgcat::mcset zh MONTHS_FULL [list \ - "\u4e00\u6708"\ - "\u4e8c\u6708"\ - "\u4e09\u6708"\ - "\u56db\u6708"\ - "\u4e94\u6708"\ - "\u516d\u6708"\ - "\u4e03\u6708"\ - "\u516b\u6708"\ - "\u4e5d\u6708"\ - "\u5341\u6708"\ - "\u5341\u4e00\u6708"\ - "\u5341\u4e8c\u6708"\ + "一月"\ + "二月"\ + "三月"\ + "四月"\ + "五月"\ + "六月"\ + "七月"\ + "八月"\ + "乿œˆ"\ + "åæœˆ"\ + "å一月"\ + "å二月"\ ""] - ::msgcat::mcset zh BCE "\u516c\u5143\u524d" - ::msgcat::mcset zh CE "\u516c\u5143" - ::msgcat::mcset zh AM "\u4e0a\u5348" - ::msgcat::mcset zh PM "\u4e0b\u5348" - ::msgcat::mcset zh LOCALE_NUMERALS "\u3007 \u4e00 \u4e8c \u4e09 \u56db \u4e94 \u516d \u4e03 \u516b \u4e5d \u5341 \u5341\u4e00 \u5341\u4e8c \u5341\u4e09 \u5341\u56db \u5341\u4e94 \u5341\u516d \u5341\u4e03 \u5341\u516b \u5341\u4e5d \u4e8c\u5341 \u5eff\u4e00 \u5eff\u4e8c \u5eff\u4e09 \u5eff\u56db \u5eff\u4e94 \u5eff\u516d \u5eff\u4e03 \u5eff\u516b \u5eff\u4e5d \u4e09\u5341 \u5345\u4e00 \u5345\u4e8c \u5345\u4e09 \u5345\u56db \u5345\u4e94 \u5345\u516d \u5345\u4e03 \u5345\u516b \u5345\u4e5d \u56db\u5341 \u56db\u5341\u4e00 \u56db\u5341\u4e8c \u56db\u5341\u4e09 \u56db\u5341\u56db \u56db\u5341\u4e94 \u56db\u5341\u516d \u56db\u5341\u4e03 \u56db\u5341\u516b \u56db\u5341\u4e5d \u4e94\u5341 \u4e94\u5341\u4e00 \u4e94\u5341\u4e8c \u4e94\u5341\u4e09 \u4e94\u5341\u56db \u4e94\u5341\u4e94 \u4e94\u5341\u516d \u4e94\u5341\u4e03 \u4e94\u5341\u516b \u4e94\u5341\u4e5d \u516d\u5341 \u516d\u5341\u4e00 \u516d\u5341\u4e8c \u516d\u5341\u4e09 \u516d\u5341\u56db \u516d\u5341\u4e94 \u516d\u5341\u516d \u516d\u5341\u4e03 \u516d\u5341\u516b \u516d\u5341\u4e5d \u4e03\u5341 \u4e03\u5341\u4e00 \u4e03\u5341\u4e8c \u4e03\u5341\u4e09 \u4e03\u5341\u56db \u4e03\u5341\u4e94 \u4e03\u5341\u516d \u4e03\u5341\u4e03 \u4e03\u5341\u516b \u4e03\u5341\u4e5d \u516b\u5341 \u516b\u5341\u4e00 \u516b\u5341\u4e8c \u516b\u5341\u4e09 \u516b\u5341\u56db \u516b\u5341\u4e94 \u516b\u5341\u516d \u516b\u5341\u4e03 \u516b\u5341\u516b \u516b\u5341\u4e5d \u4e5d\u5341 \u4e5d\u5341\u4e00 \u4e5d\u5341\u4e8c \u4e5d\u5341\u4e09 \u4e5d\u5341\u56db \u4e5d\u5341\u4e94 \u4e5d\u5341\u516d \u4e5d\u5341\u4e03 \u4e5d\u5341\u516b \u4e5d\u5341\u4e5d" - ::msgcat::mcset zh LOCALE_DATE_FORMAT "\u516c\u5143%Y\u5e74%B%Od\u65e5" - ::msgcat::mcset zh LOCALE_TIME_FORMAT "%OH\u65f6%OM\u5206%OS\u79d2" - ::msgcat::mcset zh LOCALE_DATE_TIME_FORMAT "%A %Y\u5e74%B%Od\u65e5%OH\u65f6%OM\u5206%OS\u79d2 %z" + ::msgcat::mcset zh BCE "公元å‰" + ::msgcat::mcset zh CE "公元" + ::msgcat::mcset zh AM "上åˆ" + ::msgcat::mcset zh PM "下åˆ" + ::msgcat::mcset zh LOCALE_NUMERALS "〇 一 二 三 å›› 五 å…­ 七 å…« ä¹ å å一 å二 å三 åå›› å五 åå…­ å七 åå…« åä¹ äºŒå 廿一 廿二 廿三 廿四 廿五 廿六 廿七 廿八 å»¿ä¹ ä¸‰å å…一 å…二 å…三 å…å›› å…五 å…å…­ å…七 å…å…« å…ä¹ å››å å››å一 å››å二 å››å三 å››åå›› å››å五 å››åå…­ å››å七 å››åå…« å››åä¹ äº”å 五å一 五å二 五å三 五åå›› 五å五 五åå…­ 五å七 五åå…« 五åä¹ å…­å å…­å一 å…­å二 å…­å三 å…­åå›› å…­å五 å…­åå…­ å…­å七 å…­åå…« å…­åä¹ ä¸ƒå 七å一 七å二 七å三 七åå›› 七å五 七åå…­ 七å七 七åå…« 七åä¹ å…«å å…«å一 å…«å二 å…«å三 å…«åå›› å…«å五 å…«åå…­ å…«å七 å…«åå…« å…«åä¹ ä¹å ä¹å一 ä¹å二 ä¹å三 ä¹åå›› ä¹å五 ä¹åå…­ ä¹å七 ä¹åå…« ä¹åä¹" + ::msgcat::mcset zh LOCALE_DATE_FORMAT "公元%Yå¹´%B%Odæ—¥" + ::msgcat::mcset zh LOCALE_TIME_FORMAT "%OHæ—¶%OM分%OSç§’" + ::msgcat::mcset zh LOCALE_DATE_TIME_FORMAT "%A %Yå¹´%B%Odæ—¥%OHæ—¶%OM分%OSç§’ %z" } diff --git a/library/msgs/zh_cn.msg b/library/msgs/zh_cn.msg index d62ce77..da2869a 100644 --- a/library/msgs/zh_cn.msg +++ b/library/msgs/zh_cn.msg @@ -2,6 +2,6 @@ namespace eval ::tcl::clock { ::msgcat::mcset zh_CN DATE_FORMAT "%Y-%m-%e" ::msgcat::mcset zh_CN TIME_FORMAT "%k:%M:%S" - ::msgcat::mcset zh_CN TIME_FORMAT_12 "%P%I\u65f6%M\u5206%S\u79d2" + ::msgcat::mcset zh_CN TIME_FORMAT_12 "%P%Iæ—¶%M分%Sç§’" ::msgcat::mcset zh_CN DATE_TIME_FORMAT "%Y-%m-%e %k:%M:%S %z" } diff --git a/library/msgs/zh_hk.msg b/library/msgs/zh_hk.msg index badb1dd..7f1b181 100644 --- a/library/msgs/zh_hk.msg +++ b/library/msgs/zh_hk.msg @@ -1,28 +1,28 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { ::msgcat::mcset zh_HK DAYS_OF_WEEK_ABBREV [list \ - "\u65e5"\ - "\u4e00"\ - "\u4e8c"\ - "\u4e09"\ - "\u56db"\ - "\u4e94"\ - "\u516d"] + "æ—¥"\ + "一"\ + "二"\ + "三"\ + "å››"\ + "五"\ + "å…­"] ::msgcat::mcset zh_HK MONTHS_ABBREV [list \ - "1\u6708"\ - "2\u6708"\ - "3\u6708"\ - "4\u6708"\ - "5\u6708"\ - "6\u6708"\ - "7\u6708"\ - "8\u6708"\ - "9\u6708"\ - "10\u6708"\ - "11\u6708"\ - "12\u6708"\ + "1月"\ + "2月"\ + "3月"\ + "4月"\ + "5月"\ + "6月"\ + "7月"\ + "8月"\ + "9月"\ + "10月"\ + "11月"\ + "12月"\ ""] - ::msgcat::mcset zh_HK DATE_FORMAT "%Y\u5e74%m\u6708%e\u65e5" + ::msgcat::mcset zh_HK DATE_FORMAT "%Yå¹´%m月%eæ—¥" ::msgcat::mcset zh_HK TIME_FORMAT_12 "%P%I:%M:%S" - ::msgcat::mcset zh_HK DATE_TIME_FORMAT "%Y\u5e74%m\u6708%e\u65e5 %P%I:%M:%S %z" + ::msgcat::mcset zh_HK DATE_TIME_FORMAT "%Yå¹´%m月%eæ—¥ %P%I:%M:%S %z" } diff --git a/library/msgs/zh_sg.msg b/library/msgs/zh_sg.msg index a2f3e39..690edf7 100644 --- a/library/msgs/zh_sg.msg +++ b/library/msgs/zh_sg.msg @@ -1,7 +1,7 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { - ::msgcat::mcset zh_SG AM "\u4e0a\u5348" - ::msgcat::mcset zh_SG PM "\u4e2d\u5348" + ::msgcat::mcset zh_SG AM "上åˆ" + ::msgcat::mcset zh_SG PM "中åˆ" ::msgcat::mcset zh_SG DATE_FORMAT "%d %B %Y" ::msgcat::mcset zh_SG TIME_FORMAT_12 "%P %I:%M:%S" ::msgcat::mcset zh_SG DATE_TIME_FORMAT "%d %B %Y %P %I:%M:%S %z" diff --git a/library/msgs/zh_tw.msg b/library/msgs/zh_tw.msg index e0796b1..17a6dd7 100644 --- a/library/msgs/zh_tw.msg +++ b/library/msgs/zh_tw.msg @@ -1,7 +1,7 @@ # created by tools/loadICU.tcl -- do not edit namespace eval ::tcl::clock { - ::msgcat::mcset zh_TW BCE "\u6c11\u570b\u524d" - ::msgcat::mcset zh_TW CE "\u6c11\u570b" + ::msgcat::mcset zh_TW BCE "民國å‰" + ::msgcat::mcset zh_TW CE "民國" ::msgcat::mcset zh_TW DATE_FORMAT "%Y/%m/%e" ::msgcat::mcset zh_TW TIME_FORMAT_12 "%P %I:%M:%S" ::msgcat::mcset zh_TW DATE_TIME_FORMAT "%Y/%m/%e %P %I:%M:%S %z" diff --git a/tools/loadICU.tcl b/tools/loadICU.tcl index 31f1e54..43d7e6a 100755 --- a/tools/loadICU.tcl +++ b/tools/loadICU.tcl @@ -27,6 +27,9 @@ # of this file, and for a DISCLAIMER OF ALL WARRANTIES. #---------------------------------------------------------------------- +puts stdout "TODO: output in UTF-8 in stead of using \\uhhhh sequences" +exit; # Remove those two lines after modifying this tool. + # Calculate the Chinese numerals from zero to ninety-nine. set zhDigits [list {} \u4e00 \u4e8c \u4e09 \u56db \ -- cgit v0.12 From d2595ccfea5ca3671786fe69396b9ad3130be57a Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 13 Apr 2017 16:39:15 +0000 Subject: Bump TclOO 1.0.6; finish changes. --- changes | 29 +++++++++++++++++++++++++++-- generic/tclOO.h | 2 +- unix/tclooConfig.sh | 2 +- win/tclooConfig.sh | 2 +- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/changes b/changes index bf25784..74ab4ee 100644 --- a/changes +++ b/changes @@ -8721,19 +8721,44 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2016-10-30 (bug)[1ae129] Fix memleak in [history] destruction (fellows) -2016-11-04 (feature) Provision Tcl 9 support in msgcat and tcltest (nijtmans) +2016-11-04 (feature) Provisional Tcl 9 support in msgcat and tcltest (nijtmans) => msgcat 1.6.1 => tcltest 2.4.1 +2016-11-04 (bug)[824752] Crash in Tcl_ListObjReplace() (gahr,porter) +2016-11-11 (bug)[79614f] invalidate VFS mounts on sytem encoding change (yorick) +2016-11-14 OSX: End panic() as legacy support macro; system conflicts (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2016-11-15 (bug) TclOO fix stops crash mixing Itcl and snit (fellows) +2016-11-17 (update) Reconcile libtommath updates; purge unused files (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** +2017-01-09 (bug)[b87ad7] Repair drifts in timer clock (sebres) +2017-01-17 (update) => zlib 1.2.11 (nijtmans) + +2017-01-31 (bug)[39f630] Revise Tcl_LinkVar to tolerate some prefixes (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-02-01 (bug)[d0f7ba] Improper NAN optimization. expr-22.1[01] (aspect) + +2017-02-26 (bug)[25842c] zlib stream finalization (aspect) + +2017-03-07 (deprecate) Remove unmaintained makefile.bc file (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** +2017-03-14 (enhancement) [clock] and [encoding] are now ensembles (kenny) +2017-03-15 (enhancement) several [clock] subcommands bytecoded (kenny) +2017-03-23 tzdata updated to Olson's tzdata2017b (jima) +2017-03-29 (bug)[900cb0] Fix OO unexport introspection (napier) +2017-04-12 (bug)[42202b] Nesting imbalance in coro injection (nadkarni,sebres) ---- Released 8.6.7, March 31, 2016 --- http://core.tcl.tk/tcl/ for details +--- Released 8.6.7, April 30, 2016 --- http://core.tcl.tk/tcl/ for details diff --git a/generic/tclOO.h b/generic/tclOO.h index 46f01fb..823d773 100644 --- a/generic/tclOO.h +++ b/generic/tclOO.h @@ -24,7 +24,7 @@ * win/tclooConfig.sh */ -#define TCLOO_VERSION "1.0.5" +#define TCLOO_VERSION "1.0.6" #define TCLOO_PATCHLEVEL TCLOO_VERSION #include "tcl.h" diff --git a/unix/tclooConfig.sh b/unix/tclooConfig.sh index ee10b81..e5d42bb 100644 --- a/unix/tclooConfig.sh +++ b/unix/tclooConfig.sh @@ -16,4 +16,4 @@ TCLOO_STUB_LIB_SPEC="" TCLOO_INCLUDE_SPEC="" TCLOO_PRIVATE_INCLUDE_SPEC="" TCLOO_CFLAGS="" -TCLOO_VERSION=1.0.4 +TCLOO_VERSION=1.0.6 diff --git a/win/tclooConfig.sh b/win/tclooConfig.sh index ee10b81..e5d42bb 100644 --- a/win/tclooConfig.sh +++ b/win/tclooConfig.sh @@ -16,4 +16,4 @@ TCLOO_STUB_LIB_SPEC="" TCLOO_INCLUDE_SPEC="" TCLOO_PRIVATE_INCLUDE_SPEC="" TCLOO_CFLAGS="" -TCLOO_VERSION=1.0.4 +TCLOO_VERSION=1.0.6 -- cgit v0.12 From 490e5ace3ad5f5790685e654bb03b2fe5e5d2048 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 14 Apr 2017 09:05:01 +0000 Subject: Don't use "0%o" format in test-cases, as it suggest's it's the normal way to format octal numbers: it isn't. Better use "%#o". Add tests for "format" and "scan" corner-cases which weren't documented (except in TIP's) neither had tests before. --- generic/tclBasic.c | 2 +- tests/chanio.test | 8 ++++---- tests/format.test | 42 ++++++++++++++++++++++++------------------ tests/io.test | 4 ++-- tests/scan.test | 18 ++++++++++++++++++ 5 files changed, 49 insertions(+), 25 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index f604ac1..0486383 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -8765,7 +8765,7 @@ TclNREvalList( int objc; Tcl_Obj **objv; Tcl_Obj *listPtr = data[0]; - + Tcl_IncrRefCount(listPtr); TclMarkTailcall(interp); diff --git a/tests/chanio.test b/tests/chanio.test index 31bef36..cee2675 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -5338,22 +5338,22 @@ test chan-io-40.2 {POSIX open access modes: CREAT} -setup { } -constraints {unix} -body { set f [open $path(test3) {WRONLY CREAT} 0600] file stat $path(test3) stats - set x [format "0%o" [expr $stats(mode)&0o777]] + set x [format "%#o" [expr $stats(mode)&0o777]] chan puts $f "line 1" chan close $f set f [open $path(test3) r] lappend x [chan gets $f] } -cleanup { chan close $f -} -result {0600 {line 1}} +} -result {0o600 {line 1}} test chan-io-40.3 {POSIX open access modes: CREAT} -setup { file delete $path(test3) } -constraints {unix umask} -body { # This test only works if your umask is 2, like ouster's. chan close [open $path(test3) {WRONLY CREAT}] file stat $path(test3) stats - format "0%o" [expr $stats(mode)&0o777] -} -result [format %04o [expr {0o666 & ~ $umaskValue}]] + format "%#o" [expr $stats(mode)&0o777] +} -result [format %#5o [expr {0o666 & ~ $umaskValue}]] test chan-io-40.4 {POSIX open access modes: CREAT} -setup { file delete $path(test3) } -body { diff --git a/tests/format.test b/tests/format.test index e199398..9afedd9 100644 --- a/tests/format.test +++ b/tests/format.test @@ -52,32 +52,32 @@ test format-1.7.1 {integer formatting} longIs64bit { format "%4x %4x %4x %4x" 6 34 16923 -12 -1 } { 6 22 421b fffffffffffffff4} test format-1.8 {integer formatting} longIs32bit { - format "%#x %#X %#X %#x" 6 34 16923 -12 -1 -} {0x6 0X22 0X421B 0xfffffff4} + format "%#x %#x %#X %#X %#x" 0 6 34 16923 -12 -1 +} {0x0 0x6 0X22 0X421B 0xfffffff4} test format-1.8.1 {integer formatting} longIs64bit { - format "%#x %#X %#X %#x" 6 34 16923 -12 -1 -} {0x6 0X22 0X421B 0xfffffffffffffff4} + format "%#x %#x %#X %#X %#x" 0 6 34 16923 -12 -1 +} {0x0 0x6 0X22 0X421B 0xfffffffffffffff4} test format-1.9 {integer formatting} longIs32bit { - format "%#20x %#20x %#20x %#20x" 6 34 16923 -12 -1 -} { 0x6 0x22 0x421b 0xfffffff4} + format "%#5x %#20x %#20x %#20x %#20x" 0 6 34 16923 -12 -1 +} { 0x0 0x6 0x22 0x421b 0xfffffff4} test format-1.9.1 {integer formatting} longIs64bit { - format "%#20x %#20x %#20x %#20x" 6 34 16923 -12 -1 -} { 0x6 0x22 0x421b 0xfffffffffffffff4} + format "%#5x %#20x %#20x %#20x %#20x" 0 6 34 16923 -12 -1 +} { 0x0 0x6 0x22 0x421b 0xfffffffffffffff4} test format-1.10 {integer formatting} longIs32bit { - format "%-#20x %-#20x %-#20x %-#20x" 6 34 16923 -12 -1 -} {0x6 0x22 0x421b 0xfffffff4 } + format "%-#5x %-#20x %-#20x %-#20x %-#20x" 0 6 34 16923 -12 -1 +} {0x0 0x6 0x22 0x421b 0xfffffff4 } test format-1.10.1 {integer formatting} longIs64bit { - format "%-#20x %-#20x %-#20x %-#20x" 6 34 16923 -12 -1 -} {0x6 0x22 0x421b 0xfffffffffffffff4 } + format "%-#5x %-#20x %-#20x %-#20x %-#20x" 0 6 34 16923 -12 -1 +} {0x0 0x6 0x22 0x421b 0xfffffffffffffff4 } test format-1.11 {integer formatting} longIs32bit { - format "%-#20o %#-20o %#-20o %#-20o" 6 34 16923 -12 -1 -} {06 042 041033 037777777764 } + format "%-#5o %-#20o %#-20o %#-20o %#-20o" 0 6 34 16923 -12 -1 +} {0 06 042 041033 037777777764 } test format-1.11.1 {integer formatting} longIs64bit { - format "%-#20o %#-20o %#-20o %#-20o" 6 34 16923 -12 -1 -} {06 042 041033 01777777777777777777764} + format "%-#5o %-#20o %#-20o %#-20o %#-20o" 0 6 34 16923 -12 -1 +} {0 06 042 041033 01777777777777777777764} test format-1.12 {integer formatting} { - format "%b %#b %llb" 5 5 [expr {2**100}] -} {101 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} + format "%b %#b %#b %llb" 5 0 5 [expr {2**100}] +} {101 0b0 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} test format-2.1 {string formatting} { format "%s %s %c %s" abcd {This is a very long test string.} 120 x @@ -528,6 +528,12 @@ test format-17.3 {testing %ld with non-wide} {wideIs64bit} { test format-17.4 {testing %l with non-integer} { format %lf 1 } 1.000000 +test format-17.5 {testing %llu with positive bignum} -body { + format %llu 0xabcdef0123456789abcdef +} -returnCodes 1 -result {unsigned bignum format is invalid} +test format-17.6 {testing %llu with negative number} -body { + format %llu -1 +} -returnCodes 1 -result {unsigned bignum format is invalid} test format-18.1 {do not demote existing numeric values} { set a 0xaaaaaaaa diff --git a/tests/io.test b/tests/io.test index e2a05dc..7d8c80f 100644 --- a/tests/io.test +++ b/tests/io.test @@ -5652,8 +5652,8 @@ test io-40.3 {POSIX open access modes: CREAT} {unix umask} { set f [open $path(test3) {WRONLY CREAT}] close $f file stat $path(test3) stats - format "0%o" [expr $stats(mode)&0o777] -} [format %04o [expr {0o666 & ~ $umaskValue}]] + format "%#o" [expr $stats(mode)&0o777] +} [format %#5o [expr {0o666 & ~ $umaskValue}]] test io-40.4 {POSIX open access modes: CREAT} { file delete $path(test3) set f [open $path(test3) w] diff --git a/tests/scan.test b/tests/scan.test index 7540c9c..b36b412 100644 --- a/tests/scan.test +++ b/tests/scan.test @@ -541,6 +541,24 @@ test scan-5.15 {Bug be003d570f} { test scan-5.16 {Bug be003d570f} { scan 0x40 %b } 0 +test scan-5.17 {bigint scanning} -setup { + set a {}; set b {}; set c {} +} -body { + list [scan "207698809136909011942886895,abcdef0123456789abcdef,125715736004432126361152746757" \ + %lld,%llx,%llo a b c] $a $b $c +} -result {3 207698809136909011942886895 207698809136909011942886895 207698809136909011942886895} +test scan-5.18 {bigint scanning underflow} -setup { + set a {}; +} -body { + list [scan "-207698809136909011942886895" \ + %llu a] $a +} -returnCodes 1 -result {unsigned bignum scans are invalid} +test scan-5.18 {bigint scanning invalid} -setup { + set a {}; +} -body { + list [scan "207698809136909011942886895" \ + %llu a] $a +} -returnCodes 1 -result {unsigned bignum scans are invalid} test scan-6.1 {floating-point scanning} -setup { set a {}; set b {}; set c {}; set d {} -- cgit v0.12 From 56739b80365465180878af37675a2e8524cc1976 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 17 Apr 2017 11:59:35 +0000 Subject: Repair revised tests that failed. --- tests/chanio.test | 4 ++-- tests/io.test | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/chanio.test b/tests/chanio.test index cee2675..db2475c 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -5345,7 +5345,7 @@ test chan-io-40.2 {POSIX open access modes: CREAT} -setup { lappend x [chan gets $f] } -cleanup { chan close $f -} -result {0o600 {line 1}} +} -result {0600 {line 1}} test chan-io-40.3 {POSIX open access modes: CREAT} -setup { file delete $path(test3) } -constraints {unix umask} -body { @@ -5353,7 +5353,7 @@ test chan-io-40.3 {POSIX open access modes: CREAT} -setup { chan close [open $path(test3) {WRONLY CREAT}] file stat $path(test3) stats format "%#o" [expr $stats(mode)&0o777] -} -result [format %#5o [expr {0o666 & ~ $umaskValue}]] +} -result [format %#4o [expr {0o666 & ~ $umaskValue}]] test chan-io-40.4 {POSIX open access modes: CREAT} -setup { file delete $path(test3) } -body { diff --git a/tests/io.test b/tests/io.test index 7d8c80f..197fc36 100644 --- a/tests/io.test +++ b/tests/io.test @@ -5653,7 +5653,7 @@ test io-40.3 {POSIX open access modes: CREAT} {unix umask} { close $f file stat $path(test3) stats format "%#o" [expr $stats(mode)&0o777] -} [format %#5o [expr {0o666 & ~ $umaskValue}]] +} [format %#4o [expr {0o666 & ~ $umaskValue}]] test io-40.4 {POSIX open access modes: CREAT} { file delete $path(test3) set f [open $path(test3) w] -- cgit v0.12 From 6f7ac0e29ceacd0fce5b06ff83d80c43812c3b3d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 18 Apr 2017 19:01:51 +0000 Subject: Fix [bc432269b74e9b246bf01f354714fed47cb227ed|bc432269]: http fails in a safe interpreter --- library/http/http.tcl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/library/http/http.tcl b/library/http/http.tcl index ccd4cd1..03751a3 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -28,10 +28,19 @@ namespace eval http { # We need a useragent string of this style or various servers will refuse to # send us compressed content even when we ask for it. This follows the # de-facto layout of user-agent strings in current browsers. - set http(-useragent) "Mozilla/5.0\ - ([string totitle $::tcl_platform(platform)]; U;\ - $::tcl_platform(os) $::tcl_platform(osVersion))\ - http/[package provide http] Tcl/[package provide Tcl]" + # Safe interpreters do not have ::tcl_platform(os) or + # ::tcl_platform(osVersion). + if {[interp issafe]} { + set http(-useragent) "Mozilla/5.0\ + (Windows; U;\ + Windows NT 10.0)\ + http/[package provide http] Tcl/[package provide Tcl]" + } else { + set http(-useragent) "Mozilla/5.0\ + ([string totitle $::tcl_platform(platform)]; U;\ + $::tcl_platform(os) $::tcl_platform(osVersion))\ + http/[package provide http] Tcl/[package provide Tcl]" + } } proc init {} { -- cgit v0.12 From bcbbf6dacf34d9e895fb57c1fea54adc38baed35 Mon Sep 17 00:00:00 2001 From: gcramer Date: Thu, 20 Apr 2017 10:13:02 +0000 Subject: Entry for text.n into exclude_refs_map inserted. --- tools/tcltk-man2html.tcl | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl index 5d21866..b0c2d8f 100755 --- a/tools/tcltk-man2html.tcl +++ b/tools/tcltk-man2html.tcl @@ -586,6 +586,7 @@ array set exclude_refs_map { scrollbar.n {set} selection.n {string} tcltest.n {error} + text.n {bind image lower raise} tkvars.n {tk} tkwait.n {variable} tm.n {exec} -- cgit v0.12 From c1b1e9af62be03f294b7d515133f9e55c0c9688e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 20 Apr 2017 11:44:05 +0000 Subject: Remove unused functions like TclWinSetSockOpt()/Tcl_DStringTrunc() if compiled with -DTCL_NO_DEPRECATED --- generic/tcl.h | 17 +++++++++++------ generic/tclInt.h | 2 +- generic/tclStubInit.c | 2 ++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 6ec47c6..6fa26f9 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -60,6 +60,7 @@ extern "C" { #define TCL_VERSION "8.7" #define TCL_PATCH_LEVEL "8.7a0" +#if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED) /* *---------------------------------------------------------------------------- * The following definitions set up the proper options for Windows compilers. @@ -88,6 +89,7 @@ extern "C" { # define JOIN(a,b) JOIN1(a,b) # define JOIN1(a,b) a##b #endif +#endif /* !TCL_NO_DEPRECATED */ /* * A special definition used to allow this header file to be included from @@ -139,7 +141,7 @@ extern "C" { # define TCL_VARARGS(type, name) (type name, ...) # define TCL_VARARGS_DEF(type, name) (type name, ...) # define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) -#endif +#endif /* !TCL_NO_DEPRECATED */ #if defined(__GNUC__) && (__GNUC__ > 2) # define TCL_FORMAT_PRINTF(a,b) __attribute__ ((__format__ (__printf__, a, b))) # define TCL_NORETURN __attribute__ ((noreturn)) @@ -255,7 +257,7 @@ extern "C" { #ifndef TCL_NO_DEPRECATED # undef _ANSI_ARGS_ # define _ANSI_ARGS_(x) x -#endif +#endif /* !TCL_NO_DEPRECATED */ /* * Definitions that allow this header file to be used either with or without @@ -521,7 +523,7 @@ typedef struct Tcl_Interp int errorLineDontUse; /* Don't use in extensions! */ #endif } -#endif /* TCL_NO_DEPRECATED */ +#endif /* !TCL_NO_DEPRECATED */ Tcl_Interp; typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; @@ -995,7 +997,9 @@ typedef struct Tcl_DString { #define Tcl_DStringLength(dsPtr) ((dsPtr)->length) #define Tcl_DStringValue(dsPtr) ((dsPtr)->string) -#define Tcl_DStringTrunc Tcl_DStringSetLength +#ifndef TCL_NO_DEPRECATED +# define Tcl_DStringTrunc Tcl_DStringSetLength +#endif /* !TCL_NO_DEPRECATED */ /* * Definitions for the maximum number of digits of precision that may be @@ -1123,7 +1127,7 @@ typedef struct Tcl_DString { #ifndef TCL_NO_DEPRECATED # define TCL_PARSE_PART1 0x400 -#endif +#endif /* !TCL_NO_DEPRECATED */ /* * Types for linked variables: @@ -2624,7 +2628,6 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); # define panic Tcl_Panic #endif # define panicVA Tcl_PanicVA -#endif /* !TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------------- @@ -2635,6 +2638,8 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); extern Tcl_AppInitProc Tcl_AppInit; +#endif /* !TCL_NO_DEPRECATED */ + #endif /* RC_INVOKED */ /* diff --git a/generic/tclInt.h b/generic/tclInt.h index d725688..fdbdb9b 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2630,7 +2630,7 @@ typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, size_t *lengthPtr, */ typedef struct ProcessGlobalValue { - size_t epoch; /* Epoch counter to detect changes in the + size_t epoch; /* Epoch counter to detect changes in the * master value. */ size_t numBytes; /* Length of the master string. */ char *value; /* The master string value. */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 59325b7..55ef325 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -143,6 +143,7 @@ void *TclWinGetTclInstance() return hInstance; } +#ifndef TCL_NO_DEPRECATED #define TclWinSetSockOpt winSetSockOpt static int TclWinSetSockOpt(SOCKET s, int level, int optname, @@ -165,6 +166,7 @@ TclWinGetServByName(const char *name, const char *proto) { return getservbyname(name, proto); } +#endif /* TCL_NO_DEPRECATED */ #define TclWinNoBackslash winNoBackslash static char * -- cgit v0.12 From 251dc3a322ad2fd4b39b11c5696ac34ddc9a15a5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 20 Apr 2017 14:07:30 +0000 Subject: Add flag TCL_CC_SEARCH_FLAGS to tclConfig.sh on Windows, just as it exists on unix, even though it should just be empty: TEA extensions might depend on it. --- unix/tclConfig.sh.in | 2 +- win/configure | 3 ++- win/configure.in | 1 + win/makefile.vc | 1 + win/tclConfig.sh.in | 3 ++- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/unix/tclConfig.sh.in b/unix/tclConfig.sh.in index b58e9fd..f768690 100644 --- a/unix/tclConfig.sh.in +++ b/unix/tclConfig.sh.in @@ -81,7 +81,7 @@ TCL_DL_LIBS='@DL_LIBS@' # an executable tclsh or tcltest binary. TCL_LD_FLAGS='@LDFLAGS@' -# Flags to pass to ld, such as "-R /usr/local/tcl/lib", that tell the +# Flags to pass to cc/ld, such as "-R /usr/local/tcl/lib", that tell the # run-time dynamic linker where to look for shared libraries such as # libtcl.so. Used when linking applications. Only works if there # is a variable "LIB_RUNTIME_DIR" defined in the Makefile. diff --git a/win/configure b/win/configure index e8e4b87..85dc0ba 100755 --- a/win/configure +++ b/win/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include #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 CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AR ac_ct_AR RANLIB ac_ct_RANLIB RC ac_ct_RC SET_MAKE TCL_THREADS CYGPATH CELIB_DIR DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING ZLIB_DLL_FILE ZLIB_LIBS ZLIB_OBJS CFLAGS_DEFAULT LDFLAGS_DEFAULT VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE TCL_WIN_VERSION MACHINE TCL_VERSION TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL PKG_CFG_ARGS TCL_EXE TCL_LIB_FILE TCL_LIB_FLAG TCL_STATIC_LIB_FILE TCL_STATIC_LIB_FLAG TCL_IMPORT_LIB_FILE TCL_IMPORT_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_DLL_FILE TCL_SRC_DIR TCL_BIN_DIR TCL_DBGX CFG_TCL_SHARED_LIB_SUFFIX CFG_TCL_UNSHARED_LIB_SUFFIX CFG_TCL_EXPORT_FILE_SUFFIX EXTRA_CFLAGS DEPARG CC_OBJNAME CC_EXENAME LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LDFLAGS_CONSOLE LDFLAGS_WINDOW STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX TCL_SHARED_BUILD LIBS_GUI DLLSUFFIX LIBPREFIX LIBSUFFIX EXESUFFIX LIBRARIES MAKE_LIB MAKE_STUB_LIB POST_MAKE_LIB MAKE_DLL MAKE_EXE TCL_BUILD_LIB_SPEC TCL_LD_SEARCH_FLAGS TCL_NEEDS_EXP_FILE TCL_BUILD_EXP_FILE TCL_EXP_FILE TCL_LIB_VERSIONS_OK TCL_PACKAGE_PATH TCL_DDE_VERSION TCL_DDE_MAJOR_VERSION TCL_DDE_MINOR_VERSION TCL_REG_VERSION TCL_REG_MAJOR_VERSION TCL_REG_MINOR_VERSION RC_OUT RC_TYPE RC_INCLUDE RC_DEFINE RC_DEFINES RES LIBOBJS LTLIBOBJS' +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 CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AR ac_ct_AR RANLIB ac_ct_RANLIB RC ac_ct_RC SET_MAKE TCL_THREADS CYGPATH CELIB_DIR DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING ZLIB_DLL_FILE ZLIB_LIBS ZLIB_OBJS CFLAGS_DEFAULT LDFLAGS_DEFAULT VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE TCL_WIN_VERSION MACHINE TCL_VERSION TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL PKG_CFG_ARGS TCL_EXE TCL_LIB_FILE TCL_LIB_FLAG TCL_STATIC_LIB_FILE TCL_STATIC_LIB_FLAG TCL_IMPORT_LIB_FILE TCL_IMPORT_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_DLL_FILE TCL_SRC_DIR TCL_BIN_DIR TCL_DBGX CFG_TCL_SHARED_LIB_SUFFIX CFG_TCL_UNSHARED_LIB_SUFFIX CFG_TCL_EXPORT_FILE_SUFFIX EXTRA_CFLAGS DEPARG CC_OBJNAME CC_EXENAME LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LDFLAGS_CONSOLE LDFLAGS_WINDOW STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX TCL_SHARED_BUILD LIBS_GUI DLLSUFFIX LIBPREFIX LIBSUFFIX EXESUFFIX LIBRARIES MAKE_LIB MAKE_STUB_LIB POST_MAKE_LIB MAKE_DLL MAKE_EXE TCL_BUILD_LIB_SPEC TCL_CC_SEARCH_FLAGS TCL_LD_SEARCH_FLAGS TCL_NEEDS_EXP_FILE TCL_BUILD_EXP_FILE TCL_EXP_FILE TCL_LIB_VERSIONS_OK TCL_PACKAGE_PATH TCL_DDE_VERSION TCL_DDE_MAJOR_VERSION TCL_DDE_MINOR_VERSION TCL_REG_VERSION TCL_REG_MAJOR_VERSION TCL_REG_MINOR_VERSION RC_OUT RC_TYPE RC_INCLUDE RC_DEFINE RC_DEFINES RES LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -6010,6 +6010,7 @@ s,@POST_MAKE_LIB@,$POST_MAKE_LIB,;t t s,@MAKE_DLL@,$MAKE_DLL,;t t s,@MAKE_EXE@,$MAKE_EXE,;t t s,@TCL_BUILD_LIB_SPEC@,$TCL_BUILD_LIB_SPEC,;t t +s,@TCL_CC_SEARCH_FLAGS@,$TCL_CC_SEARCH_FLAGS,;t t s,@TCL_LD_SEARCH_FLAGS@,$TCL_LD_SEARCH_FLAGS,;t t s,@TCL_NEEDS_EXP_FILE@,$TCL_NEEDS_EXP_FILE,;t t s,@TCL_BUILD_EXP_FILE@,$TCL_BUILD_EXP_FILE,;t t diff --git a/win/configure.in b/win/configure.in index 8bb9c48..b478d1e 100644 --- a/win/configure.in +++ b/win/configure.in @@ -433,6 +433,7 @@ AC_SUBST(MAKE_EXE) # empty on win, but needs sub'ing AC_SUBST(TCL_BUILD_LIB_SPEC) +AC_SUBST(TCL_CC_SEARCH_FLAGS) AC_SUBST(TCL_LD_SEARCH_FLAGS) AC_SUBST(TCL_NEEDS_EXP_FILE) AC_SUBST(TCL_BUILD_EXP_FILE) diff --git a/win/makefile.vc b/win/makefile.vc index 8cbae2e..ada08cc 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -878,6 +878,7 @@ $(OUT_DIR)\tclConfig.sh: $(WINDIR)\tclConfig.sh.in @SHLIB_SUFFIX@ .dll @DL_LIBS@ @LDFLAGS@ +@TCL_CC_SEARCH_FLAGS@ @TCL_LD_SEARCH_FLAGS@ @LIBOBJS@ @RANLIB@ diff --git a/win/tclConfig.sh.in b/win/tclConfig.sh.in index 75324b2..6ed06e2 100644 --- a/win/tclConfig.sh.in +++ b/win/tclConfig.sh.in @@ -92,10 +92,11 @@ TCL_DL_LIBS='@DL_LIBS@' # an executable tclsh or tcltest binary. TCL_LD_FLAGS='@LDFLAGS@' -# Flags to pass to ld, such as "-R /usr/local/tcl/lib", that tell the +# Flags to pass to cc/ld, such as "-R /usr/local/tcl/lib", that tell the # run-time dynamic linker where to look for shared libraries such as # libtcl.so. Used when linking applications. Only works if there # is a variable "LIB_RUNTIME_DIR" defined in the Makefile. +TCL_CC_SEARCH_FLAGS='@TCL_CC_SEARCH_FLAGS@' TCL_LD_SEARCH_FLAGS='@TCL_LD_SEARCH_FLAGS@' # Additional object files linked with Tcl to provide compatibility -- cgit v0.12 From 99143db529398b45e139029b3af9727927b1f7c6 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 22 Apr 2017 14:57:17 +0000 Subject: A better way of getting source file location information when disassembling. --- generic/tclDisassemble.c | 34 ++++++++++++++++------------------ generic/tclInt.h | 5 +++-- generic/tclProc.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 20 deletions(-) diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index 1d616fb..f62c260 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -27,9 +27,8 @@ static Tcl_Obj * DisassembleByteCodeObj(Tcl_Interp *interp, Tcl_Obj *objPtr); static int FormatInstruction(ByteCode *codePtr, const unsigned char *pc, Tcl_Obj *bufferObj); -static void GetLocationInformation(Tcl_Interp *interp, - Proc *procPtr, Tcl_Obj **fileObjPtr, - int *linePtr); +static void GetLocationInformation(Proc *procPtr, + Tcl_Obj **fileObjPtr, int *linePtr); static void PrintSourceToObj(Tcl_Obj *appendObj, const char *stringPtr, int maxChars); static void UpdateStringOfInstName(Tcl_Obj *objPtr); @@ -73,8 +72,6 @@ static const Tcl_ObjType tclInstNameType = { static void GetLocationInformation( - Tcl_Interp *interp, /* Where to look up the location - * information. */ Proc *procPtr, /* What to look up the information for. */ Tcl_Obj **fileObjPtr, /* Where to write the information about what * file the code came from. Will be written @@ -88,20 +85,21 @@ GetLocationInformation( * either with the line number or with -1 if * the information is not available. */ { - Interp *iPtr = (Interp *) interp; - Tcl_HashEntry *hePtr; - CmdFrame *cfPtr; + CmdFrame *cfPtr = TclGetCmdFrameForProcedure(procPtr); *fileObjPtr = NULL; *linePtr = -1; - if (iPtr != NULL && procPtr != NULL) { - hePtr = Tcl_FindHashEntry(iPtr->linePBodyPtr, procPtr); - if (hePtr != NULL && (cfPtr = Tcl_GetHashValue(hePtr)) != NULL) { - *linePtr = cfPtr->line[0]; - if (cfPtr->type == TCL_LOCATION_SOURCE) { - *fileObjPtr = cfPtr->data.eval.path; - } - } + if (cfPtr == NULL) { + return; + } + + /* + * Get the source location data out of the CmdFrame. + */ + + *linePtr = cfPtr->line[0]; + if (cfPtr->type == TCL_LOCATION_SOURCE) { + *fileObjPtr = cfPtr->data.eval.path; } } @@ -278,7 +276,7 @@ DisassembleByteCodeObj( Tcl_AppendToObj(bufferObj, " Source ", -1); PrintSourceToObj(bufferObj, codePtr->source, TclMin(codePtr->numSrcBytes, 55)); - GetLocationInformation(interp, codePtr->procPtr, &fileObj, &line); + GetLocationInformation(codePtr->procPtr, &fileObj, &line); if (line > -1 && fileObj != NULL) { Tcl_AppendPrintfToObj(bufferObj, "\n File \"%s\" Line %d", Tcl_GetString(fileObj), line); @@ -1221,7 +1219,7 @@ DisassembleByteCodeAsDicts( * system if it is available. */ - GetLocationInformation(interp, codePtr->procPtr, &file, &line); + GetLocationInformation(codePtr->procPtr, &file, &line); /* * Build the overall result. diff --git a/generic/tclInt.h b/generic/tclInt.h index 1deda3c..fe4fefd 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2940,7 +2940,8 @@ MODULE_SCOPE Tcl_Obj * TclGetBgErrorHandler(Tcl_Interp *interp); MODULE_SCOPE int TclGetChannelFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Channel *chanPtr, int *modePtr, int flags); -MODULE_SCOPE int TclGetCompletionCodeFromObj(Tcl_Interp *interp, +MODULE_SCOPE CmdFrame * TclGetCmdFrameForProcedure(Proc *procPtr); +MODULE_SCOPE int TclGetCompletionCodeFromObj(Tcl_Interp *interp, Tcl_Obj *value, int *code); MODULE_SCOPE int TclGetNumberFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, ClientData *clientDataPtr, @@ -3920,7 +3921,7 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp, struct CompileEnv *envPtr); /* - * Functions defined in generic/tclVar.c and currenttly exported only for use + * Functions defined in generic/tclVar.c and currently exported only for use * by the bytecode compiler and engine. Some of these could later be placed in * the public interface. */ diff --git a/generic/tclProc.c b/generic/tclProc.c index ae9e7cd..5c68e17 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -2774,6 +2774,41 @@ MakeLambdaError( } /* + *---------------------------------------------------------------------- + * + * TclGetCmdFrameForProcedure -- + * + * How to get the CmdFrame information for a procedure. + * + * Results: + * A pointer to the CmdFrame (only guaranteed to be valid until the next + * Tcl command is processed or the interpreter's state is otherwise + * modified) or a NULL if the information is not available. + * + * Side effects: + * none. + * + *---------------------------------------------------------------------- + */ + +CmdFrame * +TclGetCmdFrameForProcedure( + Proc *procPtr) /* The procedure whose cmd-frame is to be + * looked up. */ +{ + Tcl_HashEntry *hePtr; + + if (procPtr == NULL || procPtr->iPtr == NULL) { + return NULL; + } + hePtr = Tcl_FindHashEntry(procPtr->iPtr->linePBodyPtr, procPtr); + if (hePtr == NULL) { + return NULL; + } + return (CmdFrame *) Tcl_GetHashValue(hePtr); +} + +/* * Local Variables: * mode: c * c-basic-offset: 4 -- cgit v0.12 From 1f25f80d5bca40729db30c5a551cdbf1e6fa145a Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 25 Apr 2017 13:08:52 +0000 Subject: Deal with a couple of obscure causes of warnings on some versions of OSX. --- unix/tclUnixInit.c | 58 ++++++++++++++++++++++++++++++++++++------------------ unix/tclUnixSock.c | 35 +++++++++++++++++++++++++------- 2 files changed, 67 insertions(+), 26 deletions(-) diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index badfb36..67e0b65 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -744,6 +744,43 @@ Tcl_GetEncodingNameFromEnvironment( *---------------------------------------------------------------------- */ +#if defined(HAVE_COREFOUNDATION) && MAC_OS_X_VERSION_MAX_ALLOWED > 1020 +/* + * Helper because whether CFLocaleCopyCurrent and CFLocaleGetIdentifier are + * strongly or weakly bound varies by version of OSX, triggering warnings. + */ + +static inline void +InitMacLocaleInfoVar( + CFLocaleRef (*localeCopyCurrent)(void), + CFStringRef (*localeGetIdentifier)(CFLocaleRef), + Tcl_Interp *interp) +{ + CFLocaleRef localeRef; + CFStringRef locale; + char loc[256]; + + if (localeCopyCurrent == NULL || localeGetIdentifier == NULL) { + return; + } + + localeRef = localeCopyCurrent(); + if (!localeRef) { + return; + } + + locale = localeGetIdentifier(localeRef); + if (locale && CFStringGetCString(locale, loc, 256, + kCFStringEncodingUTF8)) { + if (!Tcl_CreateNamespace(interp, "::tcl::mac", NULL, NULL)) { + Tcl_ResetResult(interp); + } + Tcl_SetVar(interp, "::tcl::mac::locale", loc, TCL_GLOBAL_ONLY); + } + CFRelease(localeRef); +} +#endif /*defined(HAVE_COREFOUNDATION) && MAC_OS_X_VERSION_MAX_ALLOWED > 1020*/ + void TclpSetVariables( Tcl_Interp *interp) @@ -762,29 +799,12 @@ TclpSetVariables( #ifdef HAVE_COREFOUNDATION char tclLibPath[MAXPATHLEN + 1]; -#if MAC_OS_X_VERSION_MAX_ALLOWED > 1020 /* * Set msgcat fallback locale to current CFLocale identifier. */ - CFLocaleRef localeRef; - - if (&CFLocaleCopyCurrent != NULL && &CFLocaleGetIdentifier != NULL && - (localeRef = CFLocaleCopyCurrent())) { - CFStringRef locale = CFLocaleGetIdentifier(localeRef); - - if (locale) { - char loc[256]; - - if (CFStringGetCString(locale, loc, 256, kCFStringEncodingUTF8)) { - if (!Tcl_CreateNamespace(interp, "::tcl::mac", NULL, NULL)) { - Tcl_ResetResult(interp); - } - Tcl_SetVar(interp, "::tcl::mac::locale", loc, TCL_GLOBAL_ONLY); - } - } - CFRelease(localeRef); - } +#if MAC_OS_X_VERSION_MAX_ALLOWED > 1020 + InitMacLocaleInfoVar(CFLocaleCopyCurrent, CFLocaleGetIdentifier, interp); #endif /* MAC_OS_X_VERSION_MAX_ALLOWED > 1020 */ if (MacOSXGetLibraryPath(interp, MAXPATHLEN, tclLibPath) == TCL_OK) { diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index ca8d677..e8767e2 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -698,6 +698,33 @@ TcpClose2Proc( * *---------------------------------------------------------------------- */ + +#ifndef NEED_FAKE_RFC2553 +static inline int +IPv6AddressNeedsNumericRendering( + struct in6_addr addr) +{ + if (IN6_ARE_ADDR_EQUAL(&addr, &in6addr_any)) { + return 1; + } + + /* + * The IN6_IS_ADDR_V4MAPPED macro has a problem with aliasing warnings on + * at least some versions of OSX. + */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" + if (!IN6_IS_ADDR_V4MAPPED(&addr)) { +#pragma GCC diagnostic pop + return 0; + } + + return (addr.s6_addr[12] == 0 && addr.s6_addr[13] == 0 + && addr.s6_addr[14] == 0 && addr.s6_addr[15] == 0); +} +#endif /* NEED_FAKE_RFC2553 */ + static void TcpHostPortList( Tcl_Interp *interp, @@ -723,13 +750,7 @@ TcpHostPortList( } #ifndef NEED_FAKE_RFC2553 } else if (addr.sa.sa_family == AF_INET6) { - if ((IN6_ARE_ADDR_EQUAL(&addr.sa6.sin6_addr, - &in6addr_any)) - || (IN6_IS_ADDR_V4MAPPED(&addr.sa6.sin6_addr) && - addr.sa6.sin6_addr.s6_addr[12] == 0 && - addr.sa6.sin6_addr.s6_addr[13] == 0 && - addr.sa6.sin6_addr.s6_addr[14] == 0 && - addr.sa6.sin6_addr.s6_addr[15] == 0)) { + if (IPv6AddressNeedsNumericRendering(addr.sa6.sin6_addr)) { flags |= NI_NUMERICHOST; } #endif /* NEED_FAKE_RFC2553 */ -- cgit v0.12 From 85dbf412fdd48e0963d920799c9b611556663b1c Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 25 Apr 2017 19:32:46 +0000 Subject: [50750c735a] Fix for uninit memory handling issue in zlib transforms. --- generic/tclZlib.c | 34 ++++++++++++++++------------------ tests/zlib.test | 2 +- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 82486d2..fc20d7e 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -3113,30 +3113,28 @@ ZlibTransformOutput( errorCodePtr); } + /* + * No zero-length writes. Flushes must be explicit. + */ + + if (toWrite == 0) { + return 0; + } + cd->outStream.next_in = (Bytef *) buf; cd->outStream.avail_in = toWrite; - do { + while (cd->outStream.avail_in > 0) { e = Deflate(&cd->outStream, cd->outBuffer, cd->outAllocated, Z_NO_FLUSH, &produced); + if (e != Z_OK || produced == 0) { + break; + } - if ((e == Z_OK && produced > 0) || e == Z_BUF_ERROR) { - /* - * deflate() indicates that it is out of space by returning - * Z_BUF_ERROR *or* by simply returning Z_OK with no remaining - * space; in either case, we must write the whole buffer out and - * retry to compress what is left. - */ - - if (e == Z_BUF_ERROR) { - produced = cd->outAllocated; - e = Z_OK; - } - if (Tcl_WriteRaw(cd->parent, cd->outBuffer, produced) < 0) { - *errorCodePtr = Tcl_GetErrno(); - return -1; - } + if (Tcl_WriteRaw(cd->parent, cd->outBuffer, produced) < 0) { + *errorCodePtr = Tcl_GetErrno(); + return -1; } - } while (e == Z_OK && produced > 0 && cd->outStream.avail_in > 0); + } if (e == Z_OK) { return toWrite - cd->outStream.avail_in; diff --git a/tests/zlib.test b/tests/zlib.test index 9f06eb1..c2f7825 100644 --- a/tests/zlib.test +++ b/tests/zlib.test @@ -1004,7 +1004,7 @@ test zlib-12.2 {Patrick Dunnigan's issue} -constraints zlib -setup { } -cleanup { removeFile $filesrc removeFile $filedst -} -result 4152 +} -result 56 ::tcltest::cleanupTests return -- cgit v0.12 From fbbc93906e624113a7eeaa6d2dd6ddc01072804d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Apr 2017 13:48:13 +0000 Subject: Move some variable declarations closer to where they are used. No change in functionality. --- unix/tclEpollNotfy.c | 16 +++++----------- unix/tclUnixNotfy.c | 7 +------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 28fc834..5ed5d5d 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -354,24 +354,21 @@ PlatformEventsInit( if (errno) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create mutex"); } + filePtr = ckalloc(sizeof(*filePtr)); #ifdef HAVE_EVENTFD if ((tsdPtr->triggerEventFd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK)) <= 0) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create trigger eventfd"); } + filePtr->fd = tsdPtr->triggerEventFd; #else if (pipe2(tsdPtr->triggerPipe, O_CLOEXEC | O_NONBLOCK) != 0) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create trigger pipe"); } + filePtr->fd = tsdPtr->triggerPipe[0]; #endif if ((tsdPtr->eventsFd = epoll_create1(EPOLL_CLOEXEC)) == -1) { Tcl_Panic("epoll_create1: %s", strerror(errno)); } - filePtr = ckalloc(sizeof(*filePtr)); -#ifdef HAVE_EVENTFD - filePtr->fd = tsdPtr->triggerEventFd; -#else - filePtr->fd = tsdPtr->triggerPipe[0]; -#endif filePtr->mask = TCL_READABLE; PlatformEventsControl(filePtr, tsdPtr, EPOLL_CTL_ADD, 1); if (!tsdPtr->readyEvents) { @@ -660,11 +657,6 @@ Tcl_WaitForEvent( ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); int numQueued; ssize_t i; -#ifdef HAVE_EVENTFD - uint64_t eventFdVal; -#else - char triggerPipeVal; -#endif /* * Set up the timeout structure. Note that if there are no events to @@ -760,10 +752,12 @@ Tcl_WaitForEvent( mask = PlatformEventsTranslate(&tsdPtr->readyEvents[numEvent]); #ifdef HAVE_EVENTFD if (filePtr->fd == tsdPtr->triggerEventFd) { + uint64_t eventFdVal; i = read(tsdPtr->triggerEventFd, &eventFdVal, sizeof(eventFdVal)); if ((i != sizeof(eventFdVal)) && (errno != EAGAIN)) { #else if (filePtr->fd == tsdPtr->triggerPipe[0]) { + char triggerPipeVal; i = read(tsdPtr->triggerPipe[0], &triggerPipeVal, sizeof(triggerPipeVal)); if ((i != sizeof(triggerPipeVal)) && (errno != EAGAIN)) { #endif diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 17307dc..5bc753a 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -102,11 +102,6 @@ void Tcl_AlertNotifier( ClientData clientData) { -#ifdef NOTIFIER_EPOLL -#ifdef HAVE_EVENTFD - uint64_t eventFdVal; -#endif /* HAVE_EVENTFD */ -#endif /* NOTIFIER_EPOLL */ if (tclNotifierHooks.alertNotifierProc) { tclNotifierHooks.alertNotifierProc(clientData); return; @@ -128,7 +123,7 @@ Tcl_AlertNotifier( #else ThreadSpecificData *tsdPtr = clientData; #if defined(NOTIFIER_EPOLL) && defined(HAVE_EVENTFD) - eventFdVal = 1; + uint64_t eventFdVal = 1; if (write(tsdPtr->triggerEventFd, &eventFdVal, sizeof(eventFdVal)) != sizeof(eventFdVal)) { Tcl_Panic("Tcl_AlertNotifier: unable to write to %p->triggerEventFd", -- cgit v0.12 From e3a9350e58588d7d50bc37bc15abd1efb84dcbc1 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 27 Apr 2017 12:38:21 +0000 Subject: Start of implementation of TIP #470. --- generic/tclOO.c | 1 + generic/tclOODefineCmds.c | 43 ++++++++++++++++++++++++++++++++++++++----- generic/tclOOInt.h | 3 +++ 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index ef0c987..73acce8 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -41,6 +41,7 @@ static const struct { {"forward", TclOODefineForwardObjCmd, 1}, {"method", TclOODefineMethodObjCmd, 1}, {"renamemethod", TclOODefineRenameMethodObjCmd, 1}, + {"self", TclOODefineObjSelfObjCmd, 0}, {"unexport", TclOODefineUnexportObjCmd, 1}, {NULL, NULL, 0} }; diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index 5b0dfc3..d3ab1eb 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -1028,16 +1028,16 @@ TclOODefineSelfObjCmd( int result; Object *oPtr; - if (objc < 2) { - Tcl_WrongNumArgs(interp, 1, objv, "arg ?arg ...?"); - return TCL_ERROR; - } - oPtr = (Object *) TclOOGetDefineCmdContext(interp); if (oPtr == NULL) { return TCL_ERROR; } + if (objc < 2) { + Tcl_SetObjResult(interp, TclOOObjectName(interp, oPtr)); + return TCL_OK; + } + /* * Make the oo::objdefine namespace the current namespace and evaluate the * command(s). @@ -1113,6 +1113,39 @@ TclOODefineSelfObjCmd( /* * ---------------------------------------------------------------------- * + * TclOODefineObjSelfObjCmd -- + * Implementation of the "self" subcommand of the "oo::objdefine" + * command. + * + * ---------------------------------------------------------------------- + */ + +int +TclOODefineObjSelfObjCmd( + ClientData clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *const *objv) +{ + Object *oPtr; + + if (objc != 1) { + Tcl_WrongNumArgs(interp, 1, objv, NULL); + return TCL_ERROR; + } + + oPtr = (Object *) TclOOGetDefineCmdContext(interp); + if (oPtr == NULL) { + return TCL_ERROR; + } + + Tcl_SetObjResult(interp, TclOOObjectName(interp, oPtr)); + return TCL_OK; +} + +/* + * ---------------------------------------------------------------------- + * * TclOODefineClassObjCmd -- * Implementation of the "class" subcommand of the "oo::objdefine" * command. diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index ae24dee..476446d 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -431,6 +431,9 @@ MODULE_SCOPE int TclOODefineClassObjCmd(ClientData clientData, MODULE_SCOPE int TclOODefineSelfObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); +MODULE_SCOPE int TclOODefineObjSelfObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const *objv); MODULE_SCOPE int TclOOUnknownDefinition(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); -- cgit v0.12 From 879750b2782dfe14fb50ab912be80011348ab23d Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 27 Apr 2017 17:02:19 +0000 Subject: [04e26c02c0] Remove useless condition that raises warnings. --- generic/tclExecute.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 608b420..e85863d 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -363,9 +363,7 @@ VarHashCreateVar( : (*(tPtr) = TCL_NUMBER_DOUBLE)), \ *(ptrPtr) = (ClientData) \ (&((objPtr)->internalRep.doubleValue)), TCL_OK) : \ - ((((objPtr)->typePtr == NULL) && ((objPtr)->bytes == NULL)) || \ - (((objPtr)->bytes != NULL) && ((objPtr)->length == 0))) \ - ? TCL_ERROR : \ + (((objPtr)->bytes != NULL) && ((objPtr)->length == 0))? TCL_ERROR : \ TclGetNumberFromObj((interp), (objPtr), (ptrPtr), (tPtr))) #else @@ -385,9 +383,7 @@ VarHashCreateVar( : (*(tPtr) = TCL_NUMBER_DOUBLE)), \ *(ptrPtr) = (ClientData) \ (&((objPtr)->internalRep.doubleValue)), TCL_OK) : \ - ((((objPtr)->typePtr == NULL) && ((objPtr)->bytes == NULL)) || \ - (((objPtr)->bytes != NULL) && ((objPtr)->length == 0))) \ - ? TCL_ERROR : \ + (((objPtr)->bytes != NULL) && ((objPtr)->length == 0))? TCL_ERROR : \ TclGetNumberFromObj((interp), (objPtr), (ptrPtr), (tPtr))) #endif -- cgit v0.12 From 2bf6ae09b3ac48095177c0f52735fb9bfa10f164 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 27 Apr 2017 17:19:31 +0000 Subject: [04e26c02c0] Remove useless condition that raises warnings. --- generic/tclExecute.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index cb4e6dc..d30e757 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -510,8 +510,7 @@ VarHashCreateVar( : (*(tPtr) = TCL_NUMBER_DOUBLE)), \ *(ptrPtr) = (ClientData) \ (&((objPtr)->internalRep.doubleValue)), TCL_OK) : \ - ((((objPtr)->typePtr == NULL) && ((objPtr)->bytes == NULL)) || \ - (((objPtr)->bytes != NULL) && ((objPtr)->length == 0))) \ + (((objPtr)->bytes != NULL) && ((objPtr)->length == 0)) \ ? (*(tPtr) = TCL_NUMBER_LONG),TCL_ERROR : \ TclGetNumberFromObj((interp), (objPtr), (ptrPtr), (tPtr))) #else /* !TCL_WIDE_INT_IS_LONG */ @@ -530,8 +529,7 @@ VarHashCreateVar( : (*(tPtr) = TCL_NUMBER_DOUBLE)), \ *(ptrPtr) = (ClientData) \ (&((objPtr)->internalRep.doubleValue)), TCL_OK) : \ - ((((objPtr)->typePtr == NULL) && ((objPtr)->bytes == NULL)) || \ - (((objPtr)->bytes != NULL) && ((objPtr)->length == 0))) \ + (((objPtr)->bytes != NULL) && ((objPtr)->length == 0)) \ ? (*(tPtr) = TCL_NUMBER_LONG),TCL_ERROR : \ TclGetNumberFromObj((interp), (objPtr), (ptrPtr), (tPtr))) #endif /* TCL_WIDE_INT_IS_LONG */ -- cgit v0.12 From 513d77788d26b5ffb845e468b2d6451aab09d199 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 28 Apr 2017 13:13:10 +0000 Subject: (cherry-pick from "fix-1997007" branch): fix typo-bug (using wrong thread handle by set priority) --- win/tclWinPipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 4666deb..4775418 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1618,7 +1618,7 @@ TclpCreateCommandChannel( infoPtr->stopWriter = CreateEvent(NULL, TRUE, FALSE, NULL); infoPtr->writeThread = CreateThread(NULL, 256, PipeWriterThread, infoPtr, 0, &id); - SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); + SetThreadPriority(infoPtr->writeThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_WRITABLE; } -- cgit v0.12 From fecff1bcf0617bd35993cd9cb43a5f6a61618336 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 28 Apr 2017 13:17:20 +0000 Subject: (cherry-pick from "fix-1997007" branch): fix typo- resp. copy-paste-bug (using wrong threadInfo pointer in ConsoleOutputProc, should be writer, not reader) --- unix/tclUnixSock.c | 2 +- win/tclWinConsole.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index e8767e2..b9b6b53 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -713,7 +713,7 @@ IPv6AddressNeedsNumericRendering( * at least some versions of OSX. */ -#pragma GCC diagnostic push +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" if (!IN6_IS_ADDR_V4MAPPED(&addr)) { #pragma GCC diagnostic pop diff --git a/win/tclWinConsole.c b/win/tclWinConsole.c index ab55035..71facef 100644 --- a/win/tclWinConsole.c +++ b/win/tclWinConsole.c @@ -808,7 +808,7 @@ ConsoleOutputProc( int *errorCode) /* Where to store error code. */ { ConsoleInfo *infoPtr = instanceData; - ConsoleThreadInfo *threadInfo = &infoPtr->reader; + ConsoleThreadInfo *threadInfo = &infoPtr->writer; DWORD bytesWritten, timeout; *errorCode = 0; -- cgit v0.12 From 1200929a72dd28e06bd03bd356feb451efd0ff3a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 28 Apr 2017 13:41:13 +0000 Subject: (cherry-pick): fix typo-bug (using wrong thread handle by set priority) --- win/tclWinPipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index ee088a5..b5f035db 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1694,7 +1694,7 @@ TclpCreateCommandChannel( infoPtr->stopWriter = CreateEvent(NULL, TRUE, FALSE, NULL); infoPtr->writeThread = CreateThread(NULL, 256, PipeWriterThread, infoPtr, 0, &id); - SetThreadPriority(infoPtr->readThread, THREAD_PRIORITY_HIGHEST); + SetThreadPriority(infoPtr->writeThread, THREAD_PRIORITY_HIGHEST); infoPtr->validMask |= TCL_WRITABLE; } -- cgit v0.12 From dc9c72819c2c48b04051b15afad583edecfc5aa7 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 28 Apr 2017 14:15:18 +0000 Subject: silence uninit variable warnings --- generic/tclExecute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index d30e757..6499cf8 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -9408,7 +9408,7 @@ TclCompareTwoNumbers( Tcl_Obj *valuePtr, Tcl_Obj *value2Ptr) { - int type1, type2, compare; + int type1 = TCL_NUMBER_NAN, type2 = TCL_NUMBER_NAN, compare; ClientData ptr1, ptr2; mp_int big1, big2; double d1, d2, tmp; -- cgit v0.12 From 79426acd5509c22fe6948d2668a349775b72067e Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 28 Apr 2017 17:43:49 +0000 Subject: Test for [f34cf83dd0]. --- tests/fileName.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/fileName.test b/tests/fileName.test index 68c5592..d224011 100644 --- a/tests/fileName.test +++ b/tests/fileName.test @@ -434,6 +434,9 @@ test filename-7.18 {Tcl_JoinPath: unix} {testsetplatform} { testsetplatform unix file join /// a b } "/a/b" +test filename-7.19 {[Bug f34cf83dd0]} { + file join foo //bar +} /bar test filename-9.1 {Tcl_JoinPath: win} {testsetplatform} { -- cgit v0.12 From 64f999ee893448c079cadda5b07e13a51066dad0 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 28 Apr 2017 17:49:43 +0000 Subject: [f34cf83dd0] An optimization was being taken in a case where it produced the wrong result, failing to collapse multiple /// into /. Testing on Windows where path expectations may vary would be a good idea, but since this is just an optimization avoidance, I suspect we're ok. --- generic/tclPathObj.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 95c57bf..6dd2f3f 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -948,6 +948,7 @@ Tcl_FSJoinPath( } } strElt = Tcl_GetStringFromObj(elt, &strEltLen); + driveNameLength = 0; type = TclGetPathType(elt, &fsPtr, &driveNameLength, &driveName); if (type != TCL_PATH_RELATIVE) { /* @@ -1003,6 +1004,12 @@ Tcl_FSJoinPath( } } ptr = strElt; + /* [Bug f34cf83dd0] */ + if (driveNameLength > 0) { + if (ptr[0] == '/' && ptr[-1] == '/') { + goto noQuickReturn; + } + } while (*ptr != '\0') { if (*ptr == '/' && (ptr[1] == '/' || ptr[1] == '\0')) { /* -- cgit v0.12 From 90ffbb41701e9550ed98e8454d100d5a48531b33 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sat, 29 Apr 2017 14:41:20 +0000 Subject: Make trunk compile on MSVC (problem was: warning C4554: '&' : check operator precedence for possible error; use parentheses to clarify precedence) --- win/tclWinChan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tclWinChan.c b/win/tclWinChan.c index 010621c..2898db0 100644 --- a/win/tclWinChan.c +++ b/win/tclWinChan.c @@ -128,7 +128,7 @@ static const Tcl_ChannelType fileChannelType = { #define SET_FLAG(var, flag) ((var) |= (flag)) #define CLEAR_FLAG(var, flag) ((var) &= ~(flag)) -#define TEST_FLAG(value, flag) ((value) & (flag) != 0) +#define TEST_FLAG(value, flag) (((value) & (flag)) != 0) /* *---------------------------------------------------------------------- -- cgit v0.12 From ed853e1ffb7933562c641af3d69686df27520a8f Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 1 May 2017 20:23:28 +0000 Subject: [f9fe90d0fa] [file join] normalization. See filesystem-1.52* --- generic/tclPathObj.c | 12 +++++++++++- tests/fileSystem.test | 10 ++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 6dd2f3f..88e49b5 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -921,7 +921,17 @@ Tcl_FSJoinPath( if (res != NULL) { TclDecrRefCount(res); } - return TclNewFSPathObj(elt, str, len); + + if (PATHFLAGS(elt)) { + return TclNewFSPathObj(elt, str, len); + } + if (TCL_PATH_ABSOLUTE != Tcl_FSGetPathType(elt)) { + return TclNewFSPathObj(elt, str, len); + } + (void) Tcl_FSGetNormalizedPath(NULL, elt); + if (elt == PATHOBJ(elt)->normPathPtr) { + return TclNewFSPathObj(elt, str, len); + } } } diff --git a/tests/fileSystem.test b/tests/fileSystem.test index c255b1e..28e5268 100644 --- a/tests/fileSystem.test +++ b/tests/fileSystem.test @@ -498,6 +498,16 @@ test filesystem-1.51.1 {file normalisation .. beyond root (Bug 1379287)} { set res "ok" } } {ok} +test filesystem-1.52 {bug f9f390d0fa: file join where strep is not canonical} -body { + set x //foo + file normalize $x + file join $x bar +} -result /foo/bar +test filesystem-1.52.1 {bug f9f390d0fa: file join where strep is not canonical} -body { + set x //foo + file normalize $x + file join $x +} -result /foo test filesystem-2.0 {new native path} {unix} { foreach f [lsort [glob -nocomplain /usr/bin/c*]] { -- cgit v0.12 From be831d7ecb9df8ebfad280ac50be1773124c08bd Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 1 May 2017 20:29:02 +0000 Subject: Revert the colorful debug garbage mistakenly committed. --- generic/tclPathObj.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index ffeb688..5984c16 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -1322,14 +1322,8 @@ TclNewFSPathObj( fsPathPtr->translatedPathPtr = NULL; fsPathPtr->normPathPtr = Tcl_NewStringObj(addStrRep, len); Tcl_IncrRefCount(fsPathPtr->normPathPtr); - - if (TCL_PATH_ABSOLUTE == Tcl_FSGetPathType(dirPtr)) { - fsPathPtr->cwdPtr = Tcl_FSGetNormalizedPath(NULL, dirPtr); - } else { -fprintf(stdout, "FUCKING BROKEN!\n"); fflush(stdout); - fsPathPtr->cwdPtr = dirPtr; - } - Tcl_IncrRefCount(fsPathPtr->cwdPtr); + fsPathPtr->cwdPtr = dirPtr; + Tcl_IncrRefCount(dirPtr); fsPathPtr->nativePathPtr = NULL; fsPathPtr->fsPtr = NULL; fsPathPtr->filesystemEpoch = 0; -- cgit v0.12 From 910200b637f2025d21da89213ea124bb28785632 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 2 May 2017 12:36:42 +0000 Subject: Extend "deprecated" functionality of genStubs.tcl: XX_DEPRECATED macro now accepts a message text, which will be used in the compiler's error message. Not used (yet) in Tcl. --- tools/genStubs.tcl | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index 742aa46..5956711 100644 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl @@ -191,19 +191,21 @@ proc genStubs::declare {args} { regsub -all "\[ \t\n\]+" [string trim $decl] " " decl set decl [parseDecl $decl] - foreach platform $platformList { - if {$decl ne ""} { - set stubs($curName,$platform,$index) $decl - if {![info exists stubs($curName,$platform,lastNum)] \ - || ($index > $stubs($curName,$platform,lastNum))} { - set stubs($curName,$platform,lastNum) $index - } + if {([lindex $platformList 0] eq "deprecated")} { + set stubs($curName,deprecated,$index) [lindex $platformList 1] + set stubs($curName,generic,$index) $decl + if {![info exists stubs($curName,generic,lastNum)] \ + || ($index > $stubs($curName,generic,lastNum))} { + set stubs($curName,generic,lastNum) $index } - if {$platformList eq "deprecated"} { - set stubs($curName,generic,$index) $decl - if {![info exists stubs($curName,generic,lastNum)] \ - || ($index > $stubs($curName,generic,lastNum))} { - set stubs($curName,$platform,lastNum) $index + } else { + foreach platform $platformList { + if {$decl ne ""} { + set stubs($curName,$platform,$index) $decl + if {![info exists stubs($curName,$platform,lastNum)] \ + || ($index > $stubs($curName,$platform,lastNum))} { + set stubs($curName,$platform,lastNum) $index + } } } } @@ -468,7 +470,7 @@ proc genStubs::makeDecl {name decl index} { append text "/* $index */\n" if {[info exists stubs($name,deprecated,$index)]} { - set line "[string toupper $libraryName]_DEPRECATED $rtype" + set line "[string toupper $libraryName]_DEPRECATED(\"$stubs($name,deprecated,$index)\")\n$rtype" } else { set line "$scspec $rtype" } @@ -582,11 +584,15 @@ proc genStubs::makeMacro {name decl index} { proc genStubs::makeSlot {name decl index} { lassign $decl rtype fname args + variable stubs set lfname [string tolower [string index $fname 0]] append lfname [string range $fname 1 end] set text " " + if {[info exists stubs($name,deprecated,$index)]} { + append text "TCL_DEPRECATED_API(\"$stubs($name,deprecated,$index)\") " + } if {$args eq ""} { append text $rtype " *" $lfname "; /* $index */\n" return $text -- cgit v0.12 From 709366bdfe97b432487806c7cdbfe1eed1c365f2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 3 May 2017 10:03:00 +0000 Subject: slightly better formatting, both in genStubs.tcl and in the generated XXX_DEPRECATED functions. --- tools/genStubs.tcl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index 5956711..830ba2b 100644 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl @@ -470,9 +470,10 @@ proc genStubs::makeDecl {name decl index} { append text "/* $index */\n" if {[info exists stubs($name,deprecated,$index)]} { - set line "[string toupper $libraryName]_DEPRECATED(\"$stubs($name,deprecated,$index)\")\n$rtype" + append text "[string toupper $libraryName]_DEPRECATED(\"$stubs($name,deprecated,$index)\")\n" + set line "$rtype" } else { - set line "$scspec $rtype" + set line "$scspec $rtype" } set count [expr {2 - ([string length $line] / 8)}] append line [string range "\t\t\t" 0 $count] -- cgit v0.12 From 3d65f9905d4ad6e2b7700d7da4e5a1598902b53e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 3 May 2017 15:05:41 +0000 Subject: Use GetModuleHandle() in stead of LoadLibrary() when the handle is needed for an already loaded dll. Fix filesystem-1.52 (only works correctly on UNIX) --- tests/fileSystem.test | 2 +- win/tclWin32Dll.c | 156 ++++++++++++++++++++++++-------------------------- win/tclWinInit.c | 5 +- win/tclWinTest.c | 32 +++++------ 4 files changed, 92 insertions(+), 103 deletions(-) diff --git a/tests/fileSystem.test b/tests/fileSystem.test index 28e5268..d34de8f 100644 --- a/tests/fileSystem.test +++ b/tests/fileSystem.test @@ -498,7 +498,7 @@ test filesystem-1.51.1 {file normalisation .. beyond root (Bug 1379287)} { set res "ok" } } {ok} -test filesystem-1.52 {bug f9f390d0fa: file join where strep is not canonical} -body { +test filesystem-1.52 {bug f9f390d0fa: file join where strep is not canonical} -constraints unix -body { set x //foo file normalize $x file join $x bar diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index e5e5202..560b448 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -619,93 +619,85 @@ TclWinSetInterfaces( 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); - } + HMODULE handle = GetModuleHandle(TEXT("KERNEL32")); + tclWinProcs->getFileAttributesExProc = + (BOOL (WINAPI *)(CONST TCHAR *, GET_FILEEX_INFO_LEVELS, + LPVOID)) GetProcAddress(handle, + "GetFileAttributesExW"); + tclWinProcs->createHardLinkProc = + (BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR*, + LPSECURITY_ATTRIBUTES)) GetProcAddress(handle, + "CreateHardLinkW"); + tclWinProcs->findFirstFileExProc = + (HANDLE (WINAPI *)(CONST TCHAR*, UINT, LPVOID, UINT, + LPVOID, DWORD)) GetProcAddress(handle, + "FindFirstFileExW"); + tclWinProcs->getVolumeNameForVMPProc = + (BOOL (WINAPI *)(CONST TCHAR*, TCHAR*, + DWORD)) GetProcAddress(handle, + "GetVolumeNameForVolumeMountPointW"); + tclWinProcs->getLongPathNameProc = + (DWORD (WINAPI *)(CONST TCHAR*, TCHAR*, + DWORD)) GetProcAddress(handle, "GetLongPathNameW"); + + handle = GetModuleHandle(TEXT("ADVAPI32")); + tclWinProcs->getFileSecurityProc = (BOOL (WINAPI *)( + LPCTSTR lpFileName, + SECURITY_INFORMATION RequestedInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, + DWORD nLength, LPDWORD lpnLengthNeeded)) + GetProcAddress(handle, "GetFileSecurityW"); + tclWinProcs->impersonateSelfProc = (BOOL (WINAPI *) ( + SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)) + GetProcAddress(handle, "ImpersonateSelf"); + tclWinProcs->openThreadTokenProc = (BOOL (WINAPI *) ( + HANDLE ThreadHandle, DWORD DesiredAccess, + BOOL OpenAsSelf, PHANDLE TokenHandle)) + GetProcAddress(handle, "OpenThreadToken"); + tclWinProcs->revertToSelfProc = (BOOL (WINAPI *) (void)) + GetProcAddress(handle, "RevertToSelf"); + tclWinProcs->mapGenericMaskProc = (VOID (WINAPI *) ( + PDWORD AccessMask, PGENERIC_MAPPING GenericMapping)) + GetProcAddress(handle, "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(handle, + "AccessCheck"); } } 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); - } + HMODULE handle = GetModuleHandle(TEXT("KERNEL32")); + tclWinProcs->getFileAttributesExProc = + (BOOL (WINAPI *)(CONST TCHAR *, GET_FILEEX_INFO_LEVELS, + LPVOID)) GetProcAddress(handle, + "GetFileAttributesExA"); + tclWinProcs->createHardLinkProc = + (BOOL (WINAPI *)(CONST TCHAR *, CONST TCHAR*, + LPSECURITY_ATTRIBUTES)) GetProcAddress(handle, + "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(handle, + * "FindFirstFileExA"); + */ + tclWinProcs->getVolumeNameForVMPProc = + (BOOL (WINAPI *)(CONST TCHAR*, TCHAR*, + DWORD)) GetProcAddress(handle, + "GetVolumeNameForVolumeMountPointA"); } } } diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 4e860b2..1ba7a31 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -569,16 +569,13 @@ TclpSetVariables( TclGetProcessGlobalValue(&defaultLibraryDir), TCL_GLOBAL_ONLY); if (!osInfoInitialized) { - HANDLE handle = LoadLibraryW(L"NTDLL"); + HMODULE handle = GetModuleHandle(TEXT("NTDLL")); int(__stdcall *getversion)(void *) = (int(__stdcall *)(void *)) GetProcAddress(handle, "RtlGetVersion"); osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); if (!getversion || getversion(&osInfo)) { GetVersionExW(&osInfo); } - if (handle) { - FreeLibrary(handle); - } osInfoInitialized = 1; } GetSystemInfo(&sys.info); diff --git a/win/tclWinTest.c b/win/tclWinTest.c index e493fbf..73f4e45 100644 --- a/win/tclWinTest.c +++ b/win/tclWinTest.c @@ -466,37 +466,37 @@ TestplatformChmod( TCL_DECLARE_MUTEX(initializeMutex) Tcl_MutexLock(&initializeMutex); if (!initialized) { - HINSTANCE hInstance = LoadLibrary("Advapi32"); + HMODULE handle = GetModuleHandle(TEXT("ADVAPI")); - if (hInstance != NULL) { + if (handle != NULL) { setNamedSecurityInfoProc = (setNamedSecurityInfoADef) - GetProcAddress(hInstance, "SetNamedSecurityInfoA"); + GetProcAddress(handle, "SetNamedSecurityInfoA"); getFileSecurityProc = (getFileSecurityADef) - GetProcAddress(hInstance, "GetFileSecurityA"); + GetProcAddress(handle, "GetFileSecurityA"); getAceProc = (getAceDef) - GetProcAddress(hInstance, "GetAce"); + GetProcAddress(handle, "GetAce"); addAceProc = (addAceDef) - GetProcAddress(hInstance, "AddAce"); + GetProcAddress(handle, "AddAce"); equalSidProc = (equalSidDef) - GetProcAddress(hInstance, "EqualSid"); + GetProcAddress(handle, "EqualSid"); addAccessDeniedAceProc = (addAccessDeniedAceDef) - GetProcAddress(hInstance, "AddAccessDeniedAce"); + GetProcAddress(handle, "AddAccessDeniedAce"); initializeAclProc = (initializeAclDef) - GetProcAddress(hInstance, "InitializeAcl"); + GetProcAddress(handle, "InitializeAcl"); getLengthSidProc = (getLengthSidDef) - GetProcAddress(hInstance, "GetLengthSid"); + GetProcAddress(handle, "GetLengthSid"); getAclInformationProc = (getAclInformationDef) - GetProcAddress(hInstance, "GetAclInformation"); + GetProcAddress(handle, "GetAclInformation"); getSecurityDescriptorDaclProc = (getSecurityDescriptorDaclDef) - GetProcAddress(hInstance, "GetSecurityDescriptorDacl"); + GetProcAddress(handle, "GetSecurityDescriptorDacl"); lookupAccountNameProc = (lookupAccountNameADef) - GetProcAddress(hInstance, "LookupAccountNameA"); + GetProcAddress(handle, "LookupAccountNameA"); getSidLengthRequiredProc = (getSidLengthRequiredDef) - GetProcAddress(hInstance, "GetSidLengthRequired"); + GetProcAddress(handle, "GetSidLengthRequired"); initializeSidProc = (initializeSidDef) - GetProcAddress(hInstance, "InitializeSid"); + GetProcAddress(handle, "InitializeSid"); getSidSubAuthorityProc = (getSidSubAuthorityDef) - GetProcAddress(hInstance, "GetSidSubAuthority"); + GetProcAddress(handle, "GetSidSubAuthority"); if (setNamedSecurityInfoProc && getAceProc && addAceProc && equalSidProc && addAccessDeniedAceProc -- cgit v0.12 From fd7ea3420f7e0a7c10eae2adb29e7fe119c8eddf Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 4 May 2017 09:35:14 +0000 Subject: Fix gcc warning: unused variable wakeEvent --- win/tclWinPipe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 3e7e5eb..5246d53 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -3253,7 +3253,7 @@ TclPipeThreadStop( HANDLE hThread) { TclPipeThreadInfo *pipeTI = *pipeTIPtr; - HANDLE evControl, wakeEvent; + HANDLE evControl; int state; if (!pipeTI) { @@ -3261,7 +3261,6 @@ TclPipeThreadStop( } pipeTI = *pipeTIPtr; evControl = pipeTI->evControl; - wakeEvent = pipeTI->evWakeUp; pipeTI->evWakeUp = NULL; /* * Try to sane stop the pipe worker, corresponding its current state -- cgit v0.12 From 6f18f8d37545e22e2a21d6e7b54e4318ab0c4c98 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 4 May 2017 12:01:23 +0000 Subject: Cherry-pick/backport [65cc894ac5c24495|65cc894ac5]: fix off-by-one possible buffer overrun when looking for encodings; found by coverity Use GetModuleHandle() in stead of LoadLibrary() for ntdll, which is already loaded by Cygwin. --- unix/tclUnixInit.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index a873f6e..b1a4b24 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -14,11 +14,11 @@ #ifdef HAVE_LANGINFO # include # ifdef __APPLE__ -# if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1030 +# if defined(HAVE_WEAK_IMPORT) && MAC_OS_X_VERSION_MIN_REQUIRED < 1030 /* Support for weakly importing nl_langinfo on Darwin. */ -# define WEAK_IMPORT_NL_LANGINFO +# define WEAK_IMPORT_NL_LANGINFO extern char *nl_langinfo(nl_item) WEAK_IMPORT_ATTRIBUTE; -# endif +# endif # endif #endif #include @@ -34,7 +34,7 @@ #ifdef __CYGWIN__ DLLIMPORT extern __stdcall unsigned char GetVersionExW(void *); -DLLIMPORT extern __stdcall void *LoadLibraryW(const void *); +DLLIMPORT extern __stdcall void *GetModuleHandleW(const void *); DLLIMPORT extern __stdcall void FreeLibrary(void *); DLLIMPORT extern __stdcall void *GetProcAddress(void *, const char *); DLLIMPORT extern __stdcall void GetSystemInfo(void *); @@ -45,12 +45,12 @@ static const char *const platforms[NUMPLATFORMS] = { }; #define NUMPROCESSORS 11 -static const char *const processors[NUMPROCESSORS] = { +static const char *const processors[NUMPROCESSORS] = { "intel", "mips", "alpha", "ppc", "shx", "arm", "ia64", "alpha64", "msil", "amd64", "ia32_on_win64" }; -typedef struct _SYSTEM_INFO { +typedef struct { union { DWORD dwOemId; struct { @@ -69,7 +69,7 @@ typedef struct _SYSTEM_INFO { int wProcessorRevision; } SYSTEM_INFO; -typedef struct _OSVERSIONINFOW { +typedef struct { DWORD dwOSVersionInfoSize; DWORD dwMajorVersion; DWORD dwMinorVersion; @@ -666,7 +666,7 @@ SearchKnownEncodings( int left = 0; int right = sizeof(localeTable)/sizeof(LocaleTable); - while (left <= right) { + while (left < right) { int test = (left + right)/2; int code = strcmp(localeTable[test].lang, encoding); @@ -832,7 +832,7 @@ TclpSetVariables( */ CFLocaleRef localeRef; - + if (&CFLocaleCopyCurrent != NULL && &CFLocaleGetIdentifier != NULL && (localeRef = CFLocaleCopyCurrent())) { CFStringRef locale = CFLocaleGetIdentifier(localeRef); @@ -929,16 +929,13 @@ TclpSetVariables( #ifdef __CYGWIN__ unameOK = 1; if (!osInfoInitialized) { - HANDLE handle = LoadLibraryW(L"NTDLL"); + HANDLE handle = GetModuleHandleW(L"NTDLL"); int(__stdcall *getversion)(void *) = (int(__stdcall *)(void *))GetProcAddress(handle, "RtlGetVersion"); osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); if (!getversion || getversion(&osInfo)) { GetVersionExW(&osInfo); } - if (handle) { - FreeLibrary(handle); - } osInfoInitialized = 1; } @@ -1130,7 +1127,7 @@ TclpGetCStackParams( stackGrowsDown = StackGrowsDown(NULL); } #endif - + /* * The first time through in a thread: record the "outermost" stack * frame and inquire with the OS about the stack size. @@ -1159,7 +1156,7 @@ TclpGetCStackParams( if (!stackSize) { /* * Stack failure: if we didn't already blow up, we are within the - * safety area. Recheck with the OS in case the stack was grown. + * safety area. Recheck with the OS in case the stack was grown. */ result = GetStackSize(&stackSize); if (result != TCL_OK) { -- cgit v0.12 From 71a9a4406a6d1f7e004030f8e928d42fa18c3e3c Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 5 May 2017 17:12:52 +0000 Subject: [6015221f59] Segfault after overflow of [binary] field specifier numeric count. --- generic/tclBinary.c | 10 +++++++++- tests/binary.test | 12 ++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 68289f2..cbe4970 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -1528,7 +1528,15 @@ GetFormatSpec( (*formatPtr)++; (*countPtr) = BINARY_ALL; } else if (isdigit(UCHAR(**formatPtr))) { /* INTL: digit */ - (*countPtr) = strtoul(*formatPtr, formatPtr, 10); + unsigned long int count; + + errno = 0; + count = strtoul(*formatPtr, formatPtr, 10); + if (errno || (count > (unsigned long) INT_MAX)) { + (*countPtr) = INT_MAX; + } else { + (*countPtr) = (int) count; + } } else { (*countPtr) = BINARY_NOCOUNT; } diff --git a/tests/binary.test b/tests/binary.test index e43b9f4..20aa7d3 100644 --- a/tests/binary.test +++ b/tests/binary.test @@ -1420,6 +1420,18 @@ test binary-37.9 {GetFormatSpec: numbers} { binary scan $x f* bla set bla } {1.0 -1.0 2.0 -2.0 0.0} +test binary-37.10 {GetFormatSpec: count overflow} { + binary scan x a[format %ld 0x7fffffff] r +} 0 +test binary-37.11 {GetFormatSpec: count overflow} { + binary scan x a[format %ld 0x10000000] r +} 0 +test binary-37.12 {GetFormatSpec: count overflow} { + binary scan x a[format %ld 0x100000000] r +} 0 +test binary-37.13 {GetFormatSpec: count overflow} { + binary scan x a[format %lld 0x10000000000000000] r +} 0 test binary-38.1 {FormatNumber: word alignment} { set x [binary format c1s1 1 1] -- cgit v0.12 From 46f75926ff14edcf9e58e0f665d1f2cd3a413a3f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 9 May 2017 09:28:06 +0000 Subject: Let local variables declared from within macro's always start with underscore, this fixes some gcc warnings with -Wshadow. --- generic/tclCompile.h | 24 +++++++++++----------- generic/tclInt.h | 58 ++++++++++++++++++++++++++-------------------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/generic/tclCompile.h b/generic/tclCompile.h index e5d026c..c04fc0e 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1261,10 +1261,10 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData, #define TclCheckStackDepth(depth, envPtr) \ do { \ - int dd = (depth); \ - if (dd != (envPtr)->currStackDepth) { \ + int _dd = (depth); \ + if (_dd != (envPtr)->currStackDepth) { \ Tcl_Panic("bad stack depth computations: is %i, should be %i", \ - (envPtr)->currStackDepth, dd); \ + (envPtr)->currStackDepth, _dd); \ } \ } while (0) @@ -1280,12 +1280,12 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData, #define TclUpdateStackReqs(op, i, envPtr) \ do { \ - int delta = tclInstructionTable[(op)].stackEffect; \ - if (delta) { \ - if (delta == INT_MIN) { \ - delta = 1 - (i); \ + int _delta = tclInstructionTable[(op)].stackEffect; \ + if (_delta) { \ + if (_delta == INT_MIN) { \ + _delta = 1 - (i); \ } \ - TclAdjustStackDepth(delta, envPtr); \ + TclAdjustStackDepth(_delta, envPtr); \ } \ } while (0) @@ -1399,11 +1399,11 @@ MODULE_SCOPE int TclPushProcCallFrame(ClientData clientData, #define TclEmitPush(objIndex, envPtr) \ do { \ - register int objIndexCopy = (objIndex); \ - if (objIndexCopy <= 255) { \ - TclEmitInstInt1(INST_PUSH1, objIndexCopy, (envPtr)); \ + register int _objIndexCopy = (objIndex); \ + if (_objIndexCopy <= 255) { \ + TclEmitInstInt1(INST_PUSH1, _objIndexCopy, (envPtr)); \ } else { \ - TclEmitInstInt4(INST_PUSH4, objIndexCopy, (envPtr)); \ + TclEmitInstInt4(INST_PUSH4, _objIndexCopy, (envPtr)); \ } \ } while (0) diff --git a/generic/tclInt.h b/generic/tclInt.h index fe4fefd..2938074 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4305,13 +4305,13 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, #define TCL_MAX_TOKENS (int)(UINT_MAX / sizeof(Tcl_Token)) #define TclGrowTokenArray(tokenPtr, used, available, append, staticPtr) \ do { \ - int needed = (used) + (append); \ - if (needed > TCL_MAX_TOKENS) { \ + int _needed = (used) + (append); \ + if (_needed > TCL_MAX_TOKENS) { \ Tcl_Panic("max # of tokens for a Tcl parse (%d) exceeded", \ TCL_MAX_TOKENS); \ } \ - if (needed > (available)) { \ - int allocated = 2 * needed; \ + if (_needed > (available)) { \ + int allocated = 2 * _needed; \ Tcl_Token *oldPtr = (tokenPtr); \ Tcl_Token *newPtr; \ if (oldPtr == (staticPtr)) { \ @@ -4323,7 +4323,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, newPtr = (Tcl_Token *) attemptckrealloc((char *) oldPtr, \ (unsigned int) (allocated * sizeof(Tcl_Token))); \ if (newPtr == NULL) { \ - allocated = needed + (append) + TCL_MIN_TOKEN_GROWTH; \ + allocated = _needed + (append) + TCL_MIN_TOKEN_GROWTH; \ if (allocated > TCL_MAX_TOKENS) { \ allocated = TCL_MAX_TOKENS; \ } \ @@ -4375,14 +4375,14 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, #define TclNumUtfChars(numChars, bytes, numBytes) \ do { \ - int count, i = (numBytes); \ - unsigned char *str = (unsigned char *) (bytes); \ - while (i && (*str < 0xC0)) { i--; str++; } \ - count = (numBytes) - i; \ - if (i) { \ - count += Tcl_NumUtfChars((bytes) + count, i); \ + int _count, _i = (numBytes); \ + unsigned char *_str = (unsigned char *) (bytes); \ + while (_i && (*_str < 0xC0)) { _i--; _str++; } \ + _count = (numBytes) - _i; \ + if (_i) { \ + _count += Tcl_NumUtfChars((bytes) + _count, _i); \ } \ - (numChars) = count; \ + (numChars) = _count; \ } while (0); /* @@ -4741,11 +4741,11 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; #ifndef TCL_MEM_DEBUG #define TclSmallAllocEx(interp, nbytes, memPtr) \ do { \ - Tcl_Obj *objPtr; \ + Tcl_Obj *_objPtr; \ TCL_CT_ASSERT((nbytes)<=sizeof(Tcl_Obj)); \ TclIncrObjsAllocated(); \ - TclAllocObjStorageEx((interp), (objPtr)); \ - memPtr = (ClientData) (objPtr); \ + TclAllocObjStorageEx((interp), (_objPtr)); \ + memPtr = (ClientData) (_objPtr); \ } while (0) #define TclSmallFreeEx(interp, memPtr) \ @@ -4757,19 +4757,19 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; #else /* TCL_MEM_DEBUG */ #define TclSmallAllocEx(interp, nbytes, memPtr) \ do { \ - Tcl_Obj *objPtr; \ + Tcl_Obj *_objPtr; \ TCL_CT_ASSERT((nbytes)<=sizeof(Tcl_Obj)); \ - TclNewObj(objPtr); \ - memPtr = (ClientData) objPtr; \ + TclNewObj(_objPtr); \ + memPtr = (ClientData) _objPtr; \ } while (0) #define TclSmallFreeEx(interp, memPtr) \ do { \ - Tcl_Obj *objPtr = (Tcl_Obj *) memPtr; \ + Tcl_Obj *_objPtr = (Tcl_Obj *) memPtr; \ objPtr->bytes = NULL; \ objPtr->typePtr = NULL; \ objPtr->refCount = 1; \ - TclDecrRefCount(objPtr); \ + TclDecrRefCount(_objPtr); \ } while (0) #endif /* TCL_MEM_DEBUG */ @@ -4821,15 +4821,15 @@ typedef struct NRE_callback { #define TclNRAddCallback(interp,postProcPtr,data0,data1,data2,data3) \ do { \ - NRE_callback *callbackPtr; \ - TCLNR_ALLOC((interp), (callbackPtr)); \ - callbackPtr->procPtr = (postProcPtr); \ - callbackPtr->data[0] = (ClientData)(data0); \ - callbackPtr->data[1] = (ClientData)(data1); \ - callbackPtr->data[2] = (ClientData)(data2); \ - callbackPtr->data[3] = (ClientData)(data3); \ - callbackPtr->nextPtr = TOP_CB(interp); \ - TOP_CB(interp) = callbackPtr; \ + NRE_callback *_callbackPtr; \ + TCLNR_ALLOC((interp), (_callbackPtr)); \ + _callbackPtr->procPtr = (postProcPtr); \ + _callbackPtr->data[0] = (ClientData)(data0); \ + _callbackPtr->data[1] = (ClientData)(data1); \ + _callbackPtr->data[2] = (ClientData)(data2); \ + _callbackPtr->data[3] = (ClientData)(data3); \ + _callbackPtr->nextPtr = TOP_CB(interp); \ + TOP_CB(interp) = _callbackPtr; \ } while (0) #if NRE_USE_SMALL_ALLOC -- cgit v0.12 From 2752a9f58b6ee57703c3bc087133751e0192f150 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 9 May 2017 22:24:44 +0000 Subject: add missing compile functionality (TclPreserveByteCode/TclReleaseByteCode back-ported as inline from trunk) --- generic/tclCompile.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/generic/tclCompile.h b/generic/tclCompile.h index c04fc0e..90edf07 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -1159,6 +1159,25 @@ MODULE_SCOPE void TclPushVarName(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr, int flags, int *localIndexPtr, int *isScalarPtr); + +static inline void +TclPreserveByteCode( + register ByteCode *codePtr) +{ + codePtr->refCount++; +} + +static inline void +TclReleaseByteCode( + register ByteCode *codePtr) +{ + if (codePtr->refCount-- > 1) { + return; + } + /* Just dropped to refcount==0. Clean up. */ + TclCleanupByteCode(codePtr); +} + MODULE_SCOPE void TclReleaseLiteral(Tcl_Interp *interp, Tcl_Obj *objPtr); MODULE_SCOPE void TclInvalidateCmdLiteral(Tcl_Interp *interp, const char *name, Namespace *nsPtr); -- cgit v0.12 From a021af135e023aebc82a9062835c46473a1777fd Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 10 May 2017 12:29:42 +0000 Subject: clock.test normalized (compared with trunk) --- tests/clock.test | 135 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 95 insertions(+), 40 deletions(-) diff --git a/tests/clock.test b/tests/clock.test index 103f254..9e86c97 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -36,9 +36,9 @@ testConstraint y2038 \ # TEST PLAN # clock-1: -# [clock format] - tests of bad and empty arguments +# [clock format] - tests of bad and empty arguments # -# clock-2 +# clock-2 # formatting of year, month and day of month # # clock-3 @@ -196,7 +196,7 @@ namespace eval ::tcl::clock { l li lii liii liv lv lvi lvii lviii lix lx lxi lxii lxiii lxiv lxv lxvi lxvii lxviii lxix lxx lxxi lxxii lxxiii lxxiv lxxv lxxvi lxxvii lxxviii lxxix - lxxx lxxxi lxxxii lxxxiii lxxxiv lxxxv lxxxvi lxxxvii lxxxviii + lxxx lxxxi lxxxii lxxxiii lxxxiv lxxxv lxxxvi lxxxvii lxxxviii lxxxix xc xci xcii xciii xciv xcv xcvi xcvii xcviii xcix c @@ -273,7 +273,7 @@ test clock-1.4 "clock format - bad flag" {*}{ -body { # range error message for possible extensions: list [catch {clock format 0 -oops badflag} msg] [string range $msg 0 60] $::errorCode - } + } -match glob -result {1 {bad option "-oops": must be -format, -gmt, -locale, -timezone} {CLOCK badOption -oops}} } @@ -35143,6 +35143,10 @@ test clock-29.1800 {time parsing} { } 86399 # END testcases29 + +# BEGIN testcases30 + +# Test [clock add] test clock-30.1 {clock add years} { set t [clock scan 2000-01-01 -format %Y-%m-%d -timezone :UTC] set f [clock add $t 1 year -timezone :UTC] @@ -35369,10 +35373,61 @@ test clock-30.25 {clock add seconds at DST conversion} { set x1 [clock format $f1 -format {%Y-%m-%d %H:%M:%S %z} \ -timezone EST05:00EDT04:00,M4.1.0/02:00,M10.5.0/02:00] } {2004-10-31 01:00:00 -0500} +test clock-30.26 {clock add weekdays} { + set t [clock scan {2013-11-20}] ;# Wednesday + set f1 [clock add $t 3 weekdays] + set x1 [clock format $f1 -format {%Y-%m-%d}] +} {2013-11-25} +test clock-30.27 {clock add weekdays starting on Saturday} { + set t [clock scan {2013-11-23}] ;# Saturday + set f1 [clock add $t 1 weekday] + set x1 [clock format $f1 -format {%Y-%m-%d}] +} {2013-11-25} +test clock-30.28 {clock add weekdays starting on Sunday} { + set t [clock scan {2013-11-24}] ;# Sunday + set f1 [clock add $t 1 weekday] + set x1 [clock format $f1 -format {%Y-%m-%d}] +} {2013-11-25} +test clock-30.29 {clock add 0 weekdays starting on a weekend} { + set t [clock scan {2016-02-27}] ;# Saturday + set f1 [clock add $t 0 weekdays] + set x1 [clock format $f1 -format {%Y-%m-%d}] +} {2016-02-27} +test clock-30.30 {clock add weekdays and back} -body { + set n [clock seconds] + # we start on each day of the week + for {set i 0} {$i < 7} {incr i} { + set start [clock add $n $i days] + set startu [clock format $start -format %u] + # add 0 - 100 weekdays + for {set j 0} {$j < 100} {incr j} { + set forth [clock add $start $j weekdays] + set back [clock add $forth -$j weekdays] + # If $s was a weekday or $j was 0, $b must be the same day. + # Otherwise, $b must be the immediately preceeding Friday + set fail 0 + if {$j == 0 || $startu < 6} { + if {$start != $back} { set fail 1} + } else { + set friday [clock add $start -[expr {$startu % 5}] days] + if {$friday != $back} { set fail 1 } + } + if {$fail} { + set sdate [clock format $start -format {%Y-%m-%d}] + set bdate [clock format $back -format {%Y-%m-%d}] + return "$sdate + $j - $j := $bdate" + } + } + } + return "OK" +} -result {OK} + +# END testcases30 + test clock-31.1 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35395,7 +35450,7 @@ test clock-31.1 {system locale} \ test clock-31.2 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35418,7 +35473,7 @@ test clock-31.2 {system locale} \ test clock-31.3 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35441,7 +35496,7 @@ test clock-31.3 {system locale} \ test clock-31.4 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35478,7 +35533,7 @@ test clock-31.4 {system locale} \ test clock-31.5 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35515,7 +35570,7 @@ test clock-31.5 {system locale} \ test clock-31.6 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35585,7 +35640,7 @@ test clock-32.1 {scan/format across the Gregorian change} { } set problems } {} - + # Legacy tests # clock clicks @@ -35619,7 +35674,7 @@ test clock-33.5 {clock clicks tests, millisecond timing test} { # 60 msecs seems to be the max time slice under Windows 95/98 expr { ($end > $start) && (($end - $start) <= 60) ? - "ok" : + "ok" : "test should have taken 0-60 ms, actually took [expr $end - $start]"} } {ok} test clock-33.5a {clock tests, millisecond timing test} { @@ -35631,7 +35686,7 @@ test clock-33.5a {clock tests, millisecond timing test} { # 60 msecs seems to be the max time slice under Windows 95/98 expr { ($end > $start) && (($end - $start) <= 60) ? - "ok" : + "ok" : "test should have taken 0-60 ms, actually took [expr $end - $start]"} } {ok} test clock-33.6 {clock clicks, milli with too much abbreviation} { @@ -35984,31 +36039,31 @@ test clock-34.47 {ago with multiple relative units} { } 180000 test clock-34.48 {more than one ToD} {*}{ - -body {clock scan {10:00 11:00}} + -body {clock scan {10:00 11:00}} -returnCodes error -result {unable to convert date-time string "10:00 11:00": more than one time of day in string} } test clock-34.49 {more than one date} {*}{ - -body {clock scan {1/1/2001 2/2/2002}} + -body {clock scan {1/1/2001 2/2/2002}} -returnCodes error -result {unable to convert date-time string "1/1/2001 2/2/2002": more than one date in string} } test clock-34.50 {more than one time zone} {*}{ - -body {clock scan {10:00 EST CST}} + -body {clock scan {10:00 EST CST}} -returnCodes error -result {unable to convert date-time string "10:00 EST CST": more than one time zone in string} } test clock-34.51 {more than one weekday} {*}{ - -body {clock scan {Monday Tuesday}} + -body {clock scan {Monday Tuesday}} -returnCodes error -result {unable to convert date-time string "Monday Tuesday": more than one weekday in string} } test clock-34.52 {more than one ordinal month} {*}{ - -body {clock scan {next January next March}} + -body {clock scan {next January next March}} -returnCodes error -result {unable to convert date-time string "next January next March": more than one ordinal month in string} } @@ -36202,7 +36257,7 @@ test clock-38.2 {make sure TZ is not cached after unset} \ } } \ -result 1 - + test clock-39.1 {regression - synonym timezones} { clock format 0 -format {%H:%M:%S} -timezone :US/Eastern @@ -36274,7 +36329,7 @@ test clock-44.1 {regression test - time zone name containing hyphen } \ } } \ -result {12:34:56-0500} - + test clock-45.1 {regression test - time zone containing only two digits} \ -body { clock scan 1985-04-12T10:15:30+04 -format %Y-%m-%dT%H:%M:%S%Z @@ -36319,7 +36374,7 @@ test clock-48.1 {Bug 1185933: 'i' destroyed by clock init} -setup { test clock-49.1 {regression test - localtime with negative arg (Bug 1237907)} \ -body { - list [catch { + list [catch { clock format -86400 -timezone :localtime -format %Y } result] $result } \ @@ -36558,7 +36613,7 @@ test clock-56.1 {use of zoneinfo, version 1} {*}{ } -result {2004-01-01 00:00:00 MST} } - + test clock-56.2 {use of zoneinfo, version 2} {*}{ -setup { clock format [clock seconds] @@ -36608,7 +36663,7 @@ test clock-56.2 {use of zoneinfo, version 2} {*}{ removeFile PhoenixTwo $tzdir2 removeDirectory Test $tzdir removeDirectory zoneinfo - } + } -body { clock format 1072940400 -timezone :Test/PhoenixTwo \ -format {%Y-%m-%d %H:%M:%S %Z} @@ -36818,7 +36873,7 @@ test clock-56.3 {use of zoneinfo, version 2, Y2038 compliance} {*}{ removeFile TijuanaTwo $tzdir2 removeDirectory Test $tzdir removeDirectory zoneinfo - } + } -body { clock format 2224738800 -timezone :Test/TijuanaTwo \ -format {%Y-%m-%d %H:%M:%S %Z} @@ -36970,7 +37025,7 @@ test clock-56.4 {Bug 3470928} {*}{ removeFile Windhoek $tzdir2 removeDirectory Test $tzdir removeDirectory zoneinfo - } + } -result {Sun Jan 08 22:30:06 WAST 2012} } @@ -36981,7 +37036,7 @@ test clock-57.1 {clock scan - abbreviated options} { test clock-58.1 {clock l10n - Japanese localisation} {*}{ -setup { proc backslashify { string } { - + set retval {} foreach char [split $string {}] { scan $char %c ccode @@ -37087,52 +37142,52 @@ test clock-59.1 {military time zones} { test clock-60.1 {case insensitive weekday names} { clock scan "2000-W01 monday" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] test clock-60.2 {case insensitive weekday names} { clock scan "2000-W01 Monday" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] test clock-60.3 {case insensitive weekday names} { clock scan "2000-W01 MONDAY" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] test clock-60.4 {case insensitive weekday names} { clock scan "2000-W01 friday" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] test clock-60.5 {case insensitive weekday names} { clock scan "2000-W01 Friday" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] test clock-60.6 {case insensitive weekday names} { clock scan "2000-W01 FRIDAY" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] test clock-60.7 {case insensitive month names} { clock scan "1 january 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] test clock-60.8 {case insensitive month names} { clock scan "1 January 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] test clock-60.9 {case insensitive month names} { clock scan "1 JANUARY 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] test clock-60.10 {case insensitive month names} { clock scan "1 december 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] test clock-60.11 {case insensitive month names} { clock scan "1 December 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] test clock-60.12 {case insensitive month names} { clock scan "1 DECEMBER 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] test clock-61.1 {overflow of a wide integer on output} {*}{ -body { clock format 0x8000000000000000 -format %s -gmt true - } + } -result {integer value too large to represent} -returnCodes error } test clock-61.2 {overflow of a wide integer on output} {*}{ -body { clock format -0x8000000000000001 -format %s -gmt true - } + } -result {integer value too large to represent} -returnCodes error } -- cgit v0.12 From d9b0bec7d68dc00ac744a5a0e3d0ba5d7d8404f1 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 10 May 2017 12:29:49 +0000 Subject: resolving differences between 8.6 and trunk --- generic/tclDictObj.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 4088883..593f5a3 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -145,7 +145,7 @@ typedef struct Dict { * the entries in the order that they are * created. */ int epoch; /* Epoch counter */ - int refcount; /* Reference counter (see above) */ + size_t refCount; /* Reference counter (see above) */ Tcl_Obj *chain; /* Linked list used for invalidating the * string representations of updated nested * dictionaries. */ @@ -395,7 +395,7 @@ DupDictInternalRep( newDict->epoch = 0; newDict->chain = NULL; - newDict->refcount = 1; + newDict->refCount = 1; /* * Store in the object. @@ -430,8 +430,7 @@ FreeDictInternalRep( { Dict *dict = DICT(dictPtr); - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } dictPtr->typePtr = NULL; @@ -716,7 +715,7 @@ SetDictFromAny( TclFreeIntRep(objPtr); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(objPtr) = dict; objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclDictType; @@ -1120,7 +1119,7 @@ Tcl_DictObjFirst( searchPtr->dictionaryPtr = (Tcl_Dict) dict; searchPtr->epoch = dict->epoch; searchPtr->next = cPtr->nextPtr; - dict->refcount++; + dict->refCount++; if (keyPtrPtr != NULL) { *keyPtrPtr = Tcl_GetHashKey(&dict->table, &cPtr->entry); } @@ -1234,8 +1233,7 @@ Tcl_DictObjDone( if (searchPtr->epoch != -1) { searchPtr->epoch = -1; dict = (Dict *) searchPtr->dictionaryPtr; - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } } @@ -1387,7 +1385,7 @@ Tcl_NewDictObj(void) InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1437,7 +1435,7 @@ Tcl_DbNewDictObj( InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; -- cgit v0.12 From 3fe213e03172327d71bc8a7b2d174b5887434738 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 10 May 2017 12:29:54 +0000 Subject: Ensemble "clock" fixed after merge with kbk's clock ensemble solution. All commands (including new) compiled now also in ensemble (implemented without TclMakeEnsemble, because it can be extended via new map entries). Ensemble handling partially cherry-picked from new performance branch (TODO: check temporary "-compile" option can be reverted if it becomes ready/merged). --- generic/tclClock.c | 66 +++++++++++++++++++++++++-------------------------- generic/tclEnsemble.c | 20 +++++++++++++--- library/init.tcl | 15 ++++++++---- 3 files changed, 61 insertions(+), 40 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 8e176b6..ad3d6e7 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -17,6 +17,7 @@ #include "tclInt.h" #include "tclStrIdxTree.h" #include "tclDate.h" +#include "tclCompile.h" /* * Windows has mktime. The configurators do not check. @@ -152,21 +153,29 @@ struct ClockCommand { Tcl_ObjCmdProc *objCmdProc; /* Function that implements the command. This * will always have the ClockClientData sent * to it, but may well ignore this data. */ + CompileProc *compileProc; /* The compiler for the command. */ + ClientData clientData; /* Any clientData to give the command (if NULL + * a reference to ClockClientData will be sent) */ }; static const struct ClockCommand clockCommands[] = { - { "getenv", ClockGetenvObjCmd }, - { "format", ClockFormatObjCmd }, - { "scan", ClockScanObjCmd }, - { "configure", ClockConfigureObjCmd }, - { "Oldscan", TclClockOldscanObjCmd }, - { "ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd }, - { "GetDateFields", ClockGetdatefieldsObjCmd }, - { "GetJulianDayFromEraYearMonthDay", - ClockGetjuliandayfromerayearmonthdayObjCmd }, - { "GetJulianDayFromEraYearWeekDay", - ClockGetjuliandayfromerayearweekdayObjCmd }, - { NULL, NULL } + {"add", ClockAddObjCmd, TclCompileBasicMin1ArgCmd, NULL}, + {"clicks", ClockClicksObjCmd, TclCompileClockClicksCmd, NULL}, + {"format", ClockFormatObjCmd, TclCompileBasicMin1ArgCmd, NULL}, + {"getenv", ClockGetenvObjCmd, TclCompileBasicMin1ArgCmd, NULL}, + {"microseconds", ClockMicrosecondsObjCmd,TclCompileClockReadingCmd, INT2PTR(1)}, + {"milliseconds", ClockMillisecondsObjCmd,TclCompileClockReadingCmd, INT2PTR(2)}, + {"scan", ClockScanObjCmd, TclCompileBasicMin1ArgCmd, NULL}, + {"seconds", ClockSecondsObjCmd, TclCompileClockReadingCmd, INT2PTR(3)}, + {"configure", ClockConfigureObjCmd, NULL, NULL}, + {"Oldscan", TclClockOldscanObjCmd, NULL, NULL}, + {"ConvertLocalToUTC", ClockConvertlocaltoutcObjCmd, NULL, NULL}, + {"GetDateFields", ClockGetdatefieldsObjCmd, NULL, NULL}, + {"GetJulianDayFromEraYearMonthDay", + ClockGetjuliandayfromerayearmonthdayObjCmd, NULL, NULL}, + {"GetJulianDayFromEraYearWeekDay", + ClockGetjuliandayfromerayearweekdayObjCmd, NULL, NULL}, + {NULL, NULL, NULL, NULL} }; /* @@ -195,22 +204,10 @@ TclClockInit( char cmdName[50]; /* Buffer large enough to hold the string *::tcl::clock::GetJulianDayFromEraYearMonthDay * plus a terminating NUL. */ + Command *cmdPtr; ClockClientData *data; int i; - /* Structure of the 'clock' ensemble */ - - static const EnsembleImplMap clockImplMap[] = { - {"add", NULL, TclCompileBasicMin1ArgCmd, NULL, NULL, 0}, - {"clicks", ClockClicksObjCmd, TclCompileClockClicksCmd, NULL, NULL, 0}, - {"format", NULL, TclCompileBasicMin1ArgCmd, NULL, NULL, 0}, - {"microseconds", ClockMicrosecondsObjCmd, TclCompileClockReadingCmd, NULL, INT2PTR(1), 0}, - {"milliseconds", ClockMillisecondsObjCmd, TclCompileClockReadingCmd, NULL, INT2PTR(2), 0}, - {"scan", NULL, TclCompileBasicMin1ArgCmd, NULL, NULL , 0}, - {"seconds", ClockSecondsObjCmd, TclCompileClockReadingCmd, NULL, INT2PTR(3), 0}, - {NULL, NULL, NULL, NULL, NULL, 0} - }; - /* * Safe interps get [::clock] as alias to a master, so do not need their * own copies of the support routines. @@ -258,21 +255,24 @@ TclClockInit( /* * Install the commands. - * TODO - Let Tcl_MakeEnsemble do this? */ #define TCL_CLOCK_PREFIX_LEN 14 /* == strlen("::tcl::clock::") */ memcpy(cmdName, "::tcl::clock::", TCL_CLOCK_PREFIX_LEN); for (clockCmdPtr=clockCommands ; clockCmdPtr->name!=NULL ; clockCmdPtr++) { + ClientData clientData; + strcpy(cmdName + TCL_CLOCK_PREFIX_LEN, clockCmdPtr->name); - data->refCount++; - Tcl_CreateObjCommand(interp, cmdName, clockCmdPtr->objCmdProc, data, - ClockDeleteCmdProc); + if (!(clientData = clockCmdPtr->clientData)) { + clientData = data; + data->refCount++; + } + cmdPtr = (Command *)Tcl_CreateObjCommand(interp, cmdName, + clockCmdPtr->objCmdProc, clientData, + clockCmdPtr->clientData ? NULL : ClockDeleteCmdProc); + cmdPtr->compileProc = clockCmdPtr->compileProc ? + clockCmdPtr->compileProc : TclCompileBasicMin0ArgCmd; } - - /* Make the clock ensemble */ - - TclMakeEnsemble(interp, "clock", clockImplMap); } /* diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index c1b0890..2480685 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -55,11 +55,12 @@ enum EnsSubcmds { }; static const char *const ensembleCreateOptions[] = { - "-command", "-map", "-parameters", "-prefixes", "-subcommands", - "-unknown", NULL + "-command", "-compile", "-map", "-parameters", "-prefixes", + "-subcommands", "-unknown", NULL }; enum EnsCreateOpts { - CRT_CMD, CRT_MAP, CRT_PARAM, CRT_PREFIX, CRT_SUBCMDS, CRT_UNKNOWN + CRT_CMD, CRT_COMPILE, CRT_MAP, CRT_PARAM, CRT_PREFIX, + CRT_SUBCMDS, CRT_UNKNOWN }; static const char *const ensembleConfigOptions[] = { @@ -183,6 +184,7 @@ TclNamespaceEnsembleCmd( int permitPrefix = 1; Tcl_Obj *unknownObj = NULL; Tcl_Obj *paramObj = NULL; + int ensCompFlag = -1; /* * Check that we've got option-value pairs... [Bug 1558654] @@ -325,6 +327,12 @@ TclNamespaceEnsembleCmd( return TCL_ERROR; } continue; + case CRT_COMPILE: + if (Tcl_GetBooleanFromObj(interp, objv[1], + &ensCompFlag) != TCL_OK) { + return TCL_ERROR; + }; + continue; case CRT_UNKNOWN: if (TclListObjLength(interp, objv[1], &len) != TCL_OK) { if (allocatedMapFlag) { @@ -350,6 +358,12 @@ TclNamespaceEnsembleCmd( Tcl_SetEnsembleMappingDict(interp, token, mapObj); Tcl_SetEnsembleUnknownHandler(interp, token, unknownObj); Tcl_SetEnsembleParameterList(interp, token, paramObj); + /* + * Ensemble should be compiled if it has map (performance purposes) + */ + if (ensCompFlag > 0 && mapObj != NULL) { + Tcl_SetEnsembleFlags(interp, token, ENSEMBLE_COMPILE); + } /* * Tricky! Must ensure that the result is not shared (command delete diff --git a/library/init.tcl b/library/init.tcl index 87e84e4..824f66f 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -45,6 +45,7 @@ if {![info exists auto_path]} { set auto_path "" } } + namespace eval tcl { variable Dir foreach Dir [list $::tcl_library [file dirname $::tcl_library]] { @@ -169,9 +170,16 @@ if {[interp issafe]} { namespace eval ::tcl::clock [list variable TclLibDir $::tcl_library] - proc ::tcl::initClock {} { - # Auto-loading stubs for 'clock.tcl' + proc clock args { + set cmdmap [dict create] + foreach cmd {add clicks format microseconds milliseconds scan seconds configure} { + dict set cmdmap $cmd ::tcl::clock::$cmd + } + namespace eval ::tcl::clock [list namespace ensemble create -command \ + [uplevel 1 [list namespace origin [lindex [info level 0] 0]]] \ + -map $cmdmap -compile 1] + # Auto-loading stubs for 'clock.tcl' foreach cmd {mcget LocalizeFormat SetupTimeZone GetSystemTimeZone} { proc ::tcl::clock::$cmd args { variable TclLibDir @@ -180,9 +188,8 @@ if {[interp issafe]} { } } - rename ::tcl::initClock {} + return [uplevel 1 [info level 0]] } - ::tcl::initClock } # Conditionalize for presence of exec. -- cgit v0.12 From ba8e7c4211e910d243158064e8e7dcd85620fce7 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 10 May 2017 12:29:59 +0000 Subject: Fixed wrong args message (e.g. "clock format ..." instead of "::tcl::clock::format") if failed through compiled ensemble execution. --- generic/tclClock.c | 14 +++++++------- tests/clock.test | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index ad3d6e7..a066f73 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -2865,7 +2865,7 @@ ClockClicksObjCmd( } break; default: - Tcl_WrongNumArgs(interp, 1, objv, "?-switch?"); + Tcl_WrongNumArgs(interp, 0, NULL, "clock clicks ?-switch?"); return TCL_ERROR; } @@ -2918,7 +2918,7 @@ ClockMillisecondsObjCmd( Tcl_Time now; if (objc != 1) { - Tcl_WrongNumArgs(interp, 1, objv, NULL); + Tcl_WrongNumArgs(interp, 0, NULL, "clock milliseconds"); return TCL_ERROR; } Tcl_GetTime(&now); @@ -2953,7 +2953,7 @@ ClockMicrosecondsObjCmd( Tcl_Obj *const *objv) /* Parameter values */ { if (objc != 1) { - Tcl_WrongNumArgs(interp, 1, objv, NULL); + Tcl_WrongNumArgs(interp, 0, NULL, "clock microseconds"); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(TclpGetMicroseconds())); @@ -3223,7 +3223,7 @@ ClockFormatObjCmd( /* even number of arguments */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "clockval|-now " + Tcl_WrongNumArgs(interp, 0, NULL, "clock format clockval|-now " "?-format string? " "?-gmt boolean? " "?-locale LOCALE? ?-timezone ZONE?"); @@ -3298,7 +3298,7 @@ ClockScanObjCmd( /* even number of arguments */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "string " + Tcl_WrongNumArgs(interp, 0, NULL, "clock scan string " "?-base seconds? " "?-format string? " "?-gmt boolean? " @@ -3857,7 +3857,7 @@ ClockAddObjCmd( /* even number of arguments */ if ((objc & 1) == 1) { - Tcl_WrongNumArgs(interp, 1, objv, "clockval|-now ?number units?..." + Tcl_WrongNumArgs(interp, 0, NULL, "clock add clockval|-now ?number units?..." "?-gmt boolean? " "?-locale LOCALE? ?-timezone ZONE?"); Tcl_SetErrorCode(interp, "CLOCK", "wrongNumArgs", NULL); @@ -4014,7 +4014,7 @@ ClockSecondsObjCmd( Tcl_Time now; if (objc != 1) { - Tcl_WrongNumArgs(interp, 1, objv, NULL); + Tcl_WrongNumArgs(interp, 0, NULL, "clock seconds"); return TCL_ERROR; } Tcl_GetTime(&now); diff --git a/tests/clock.test b/tests/clock.test index 9e86c97..214d4cb 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -257,6 +257,10 @@ test clock-1.0 "clock format - wrong # args" { list [catch {clock format} msg] $msg $::errorCode } {1 {wrong # args: should be "clock format clockval|-now ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"} {CLOCK wrongNumArgs}} +test clock-1.0.1 "clock format - wrong # args (compiled ensemble with invalid syntax)" { + list [catch {clock format 0 -too-few-options-4-test} msg] $msg $::errorCode +} {1 {wrong # args: should be "clock format clockval|-now ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"} {CLOCK wrongNumArgs}} + test clock-1.1 "clock format - bad time" { list [catch {clock format foo} msg] $msg } {1 {expected integer but got "foo"}} -- cgit v0.12 From 19b2d40089ec87c4f53419baea8e46524011eb54 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 10 May 2017 12:30:04 +0000 Subject: Fixed possible wrong current date for CET / CEST test cases. --- tests/clock.test | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/clock.test b/tests/clock.test index 214d4cb..0737558 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -36191,7 +36191,7 @@ test clock-36.3 {clock scan next monthname} { } "05.2001" test clock-37.1 {%s gmt testing} { - set s [clock seconds] + set s [clock scan "2017-05-10 09:00:00" -gmt 1] set a [clock format $s -format %s -gmt 0] set b [clock format $s -format %s -gmt 1] set c [clock scan $s -format %s -gmt 0] @@ -36200,8 +36200,8 @@ test clock-37.1 {%s gmt testing} { # depend on the time zone. list [expr {$b-$a}] [expr {$d-$c}] } {0 0} -test clock-37.2 {%Es gmt testing} { - set s [clock seconds] +test clock-37.2 {%Es gmt testing CET} { + set s [clock scan "2017-01-10 09:00:00" -gmt 1] set a [clock format $s -format %Es -timezone CET] set b [clock format $s -format %Es -gmt 1] set c [clock scan $s -format %Es -timezone CET] @@ -36209,6 +36209,15 @@ test clock-37.2 {%Es gmt testing} { # %Es depend on the time zone (local seconds instead of posix seconds). list [expr {$b-$a}] [expr {$d-$c}] } {-3600 3600} +test clock-37.3 {%Es gmt testing CEST} { + set s [clock scan "2017-05-10 09:00:00" -gmt 1] + set a [clock format $s -format %Es -timezone CET] + set b [clock format $s -format %Es -gmt 1] + set c [clock scan $s -format %Es -timezone CET] + set d [clock scan $s -format %Es -gmt 1] + # %Es depend on the time zone (local seconds instead of posix seconds). + list [expr {$b-$a}] [expr {$d-$c}] +} {-7200 7200} test clock-38.1 {regression - convertUTCToLocalViaC - east of Greenwich} \ -setup { -- cgit v0.12 From 2eaa3d3c8d7ede2057e65ea1e7edaaa2214f51c2 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 10 May 2017 13:02:17 +0000 Subject: Added files missing after merge/back-port (rebase with merge point) --- generic/tclClockFmt.c | 3135 +++++++++++++++++++++++++++++++++++++++++++++ generic/tclDate.h | 512 ++++++++ generic/tclStrIdxTree.c | 520 ++++++++ generic/tclStrIdxTree.h | 169 +++ tests-perf/clock.perf.tcl | 385 ++++++ 5 files changed, 4721 insertions(+) create mode 100644 generic/tclClockFmt.c create mode 100644 generic/tclDate.h create mode 100644 generic/tclStrIdxTree.c create mode 100644 generic/tclStrIdxTree.h create mode 100644 tests-perf/clock.perf.tcl diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c new file mode 100644 index 0000000..d875bd4 --- /dev/null +++ b/generic/tclClockFmt.c @@ -0,0 +1,3135 @@ +/* + * tclClockFmt.c -- + * + * Contains the date format (and scan) routines. This code is back-ported + * from the time and date facilities of tclSE engine, by Serg G. Brester. + * + * Copyright (c) 2015 by Sergey G. Brester aka sebres. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#include "tclInt.h" +#include "tclStrIdxTree.h" +#include "tclDate.h" + +/* + * Miscellaneous forward declarations and functions used within this file + */ + +static void +ClockFmtObj_DupInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); +static void +ClockFmtObj_FreeInternalRep(Tcl_Obj *objPtr); +static int +ClockFmtObj_SetFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); +static void +ClockFmtObj_UpdateString(Tcl_Obj *objPtr); + + +TCL_DECLARE_MUTEX(ClockFmtMutex); /* Serializes access to common format list. */ + +static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); + +static void ClockFrmScnFinalize(ClientData clientData); + +/* Msgcat index literals prefixed with _IDX_, used for quick dictionary search */ +CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); + +/* + * Clock scan and format facilities. + */ + +/* + *---------------------------------------------------------------------- + * + * _str2int -- , _str2wideInt -- + * + * Fast inline-convertion of string to signed int or wide int by given + * start/end. + * + * The given string should contain numbers chars only (because already + * pre-validated within parsing routines) + * + * Results: + * Returns a standard Tcl result. + * TCL_OK - by successful conversion, TCL_ERROR by (wide) int overflow + * + *---------------------------------------------------------------------- + */ + +static inline int +_str2int( + int *out, + register + const char *p, + const char *e, + int sign) +{ + register int val = 0, prev = 0; + if (sign >= 0) { + while (p < e) { + val = val * 10 + (*p++ - '0'); + if (val < prev) { + return TCL_ERROR; + } + prev = val; + } + } else { + while (p < e) { + val = val * 10 - (*p++ - '0'); + if (val > prev) { + return TCL_ERROR; + } + prev = val; + } + } + *out = val; + return TCL_OK; +} + +static inline int +_str2wideInt( + Tcl_WideInt *out, + register + const char *p, + const char *e, + int sign) +{ + register Tcl_WideInt val = 0, prev = 0; + if (sign >= 0) { + while (p < e) { + val = val * 10 + (*p++ - '0'); + if (val < prev) { + return TCL_ERROR; + } + prev = val; + } + } else { + while (p < e) { + val = val * 10 - (*p++ - '0'); + if (val > prev) { + return TCL_ERROR; + } + prev = val; + } + } + *out = val; + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * _itoaw -- , _witoaw -- + * + * Fast inline-convertion of signed int or wide int to string, using + * given padding with specified padchar and width (or without padding). + * + * This is a very fast replacement for sprintf("%02d"). + * + * Results: + * Returns position in buffer after end of conversion result. + * + *---------------------------------------------------------------------- + */ + +static inline char * +_itoaw( + char *buf, + register int val, + char padchar, + unsigned short int width) +{ + register char *p; + static int wrange[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; + + /* positive integer */ + + if (val >= 0) + { + /* check resp. recalculate width */ + while (width <= 9 && val >= wrange[width]) { + width++; + } + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val > 0); + /* fulling with pad-char */ + while (p >= buf) { + *p-- = padchar; + } + + return buf + width; + } + /* negative integer */ + + if (!width) width++; + /* check resp. recalculate width (regarding sign) */ + width--; + while (width <= 9 && val <= -wrange[width]) { + width++; + } + width++; + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + /* differentiate platforms with -1 % 10 == 1 and -1 % 10 == -1 */ + if (-1 % 10 == -1) { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' - c; + } while (val < 0); + } else { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val < 0); + } + /* sign by 0 padding */ + if (padchar != '0') { *p-- = '-'; } + /* fulling with pad-char */ + while (p >= buf + 1) { + *p-- = padchar; + } + /* sign by non 0 padding */ + if (padchar == '0') { *p = '-'; } + + return buf + width; +} + +static inline char * +_witoaw( + char *buf, + register Tcl_WideInt val, + char padchar, + unsigned short int width) +{ + register char *p; + static int wrange[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000}; + + /* positive integer */ + + if (val >= 0) + { + /* check resp. recalculate width */ + if (val >= 10000000000L) { + Tcl_WideInt val2; + val2 = val / 10000000000L; + while (width <= 9 && val2 >= wrange[width]) { + width++; + } + width += 10; + } else { + while (width <= 9 && val >= wrange[width]) { + width++; + } + } + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val > 0); + /* fulling with pad-char */ + while (p >= buf) { + *p-- = padchar; + } + + return buf + width; + } + + /* negative integer */ + + if (!width) width++; + /* check resp. recalculate width (regarding sign) */ + width--; + if (val <= 10000000000L) { + Tcl_WideInt val2; + val2 = val / 10000000000L; + while (width <= 9 && val2 <= -wrange[width]) { + width++; + } + width += 10; + } else { + while (width <= 9 && val <= -wrange[width]) { + width++; + } + } + width++; + /* number to string backwards */ + p = buf + width; + *p-- = '\0'; + /* differentiate platforms with -1 % 10 == 1 and -1 % 10 == -1 */ + if (-1 % 10 == -1) { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' - c; + } while (val < 0); + } else { + do { + register char c = (val % 10); val /= 10; + *p-- = '0' + c; + } while (val < 0); + } + /* sign by 0 padding */ + if (padchar != '0') { *p-- = '-'; } + /* fulling with pad-char */ + while (p >= buf + 1) { + *p-- = padchar; + } + /* sign by non 0 padding */ + if (padchar == '0') { *p = '-'; } + + return buf + width; +} + +/* + * Global GC as LIFO for released scan/format object storages. + * + * Used to holds last released CLOCK_FMT_SCN_STORAGE_GC_SIZE formats + * (after last reference from Tcl-object will be removed). This is helpful + * to avoid continuous (re)creation and compiling by some dynamically resp. + * variable format objects, that could be often reused. + * + * As long as format storage is used resp. belongs to GC, it takes place in + * FmtScnHashTable also. + */ + +#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + +static struct { + ClockFmtScnStorage *stackPtr; + ClockFmtScnStorage *stackBound; + unsigned int count; +} ClockFmtScnStorage_GC = {NULL, NULL, 0}; + +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageGC_In -- + * + * Adds an format storage object to GC. + * + * If current GC is full (size larger as CLOCK_FMT_SCN_STORAGE_GC_SIZE) + * this removes last unused storage at begin of GC stack (LIFO). + * + * Assumes caller holds the ClockFmtMutex. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + +static inline void +ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) +{ + /* add new entry */ + TclSpliceIn(entry, ClockFmtScnStorage_GC.stackPtr); + if (ClockFmtScnStorage_GC.stackBound == NULL) { + ClockFmtScnStorage_GC.stackBound = entry; + } + ClockFmtScnStorage_GC.count++; + + /* if GC ist full */ + if (ClockFmtScnStorage_GC.count > CLOCK_FMT_SCN_STORAGE_GC_SIZE) { + + /* GC stack is LIFO: delete first inserted entry */ + ClockFmtScnStorage *delEnt = ClockFmtScnStorage_GC.stackBound; + ClockFmtScnStorage_GC.stackBound = delEnt->prevPtr; + TclSpliceOut(delEnt, ClockFmtScnStorage_GC.stackPtr); + ClockFmtScnStorage_GC.count--; + delEnt->prevPtr = delEnt->nextPtr = NULL; + /* remove it now */ + ClockFmtScnStorageDelete(delEnt); + } +} + +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorage_GC_Out -- + * + * Restores (for reusing) given format storage object from GC. + * + * Assumes caller holds the ClockFmtMutex. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + +static inline void +ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) +{ + TclSpliceOut(entry, ClockFmtScnStorage_GC.stackPtr); + ClockFmtScnStorage_GC.count--; + if (ClockFmtScnStorage_GC.stackBound == entry) { + ClockFmtScnStorage_GC.stackBound = entry->prevPtr; + } + entry->prevPtr = entry->nextPtr = NULL; +} + +#endif + + +/* + * Global format storage hash table of type ClockFmtScnStorageHashKeyType + * (contains list of scan/format object storages, shared across all threads). + * + * Used for fast searching by format string. + */ +static Tcl_HashTable FmtScnHashTable; +static int initialized = 0; + +/* + * Wrappers between pointers to hash entry and format storage object + */ +static inline Tcl_HashEntry * +HashEntry4FmtScn(ClockFmtScnStorage *fss) { + return (Tcl_HashEntry*)(fss + 1); +}; +static inline ClockFmtScnStorage * +FmtScn4HashEntry(Tcl_HashEntry *hKeyPtr) { + return (ClockFmtScnStorage*)(((char*)hKeyPtr) - sizeof(ClockFmtScnStorage)); +}; + +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageAllocProc -- + * + * Allocate space for a hash entry containing format storage together + * with the string key. + * + * Results: + * The return value is a pointer to the created entry. + * + *---------------------------------------------------------------------- + */ + +static Tcl_HashEntry * +ClockFmtScnStorageAllocProc( + Tcl_HashTable *tablePtr, /* Hash table. */ + void *keyPtr) /* Key to store in the hash table entry. */ +{ + ClockFmtScnStorage *fss; + + const char *string = (const char *) keyPtr; + Tcl_HashEntry *hPtr; + unsigned int size, + allocsize = sizeof(ClockFmtScnStorage) + sizeof(Tcl_HashEntry); + + allocsize += (size = strlen(string) + 1); + if (size > sizeof(hPtr->key)) { + allocsize -= sizeof(hPtr->key); + } + + fss = ckalloc(allocsize); + + /* initialize */ + memset(fss, 0, sizeof(*fss)); + + hPtr = HashEntry4FmtScn(fss); + memcpy(&hPtr->key.string, string, size); + hPtr->clientData = 0; /* currently unused */ + + return hPtr; +} + +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageFreeProc -- + * + * Free format storage object and space of given hash entry. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +ClockFmtScnStorageFreeProc( + Tcl_HashEntry *hPtr) +{ + ClockFmtScnStorage *fss = FmtScn4HashEntry(hPtr); + + if (fss->scnTok != NULL) { + ckfree(fss->scnTok); + fss->scnTok = NULL; + fss->scnTokC = 0; + } + if (fss->fmtTok != NULL) { + ckfree(fss->fmtTok); + fss->fmtTok = NULL; + fss->fmtTokC = 0; + } + + ckfree(fss); +} + +/* + *---------------------------------------------------------------------- + * + * ClockFmtScnStorageDelete -- + * + * Delete format storage object. + * + * Results: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +ClockFmtScnStorageDelete(ClockFmtScnStorage *fss) { + Tcl_HashEntry *hPtr = HashEntry4FmtScn(fss); + /* + * This will delete a hash entry and call "ckfree" for storage self, if + * some additionally handling required, freeEntryProc can be used instead + */ + Tcl_DeleteHashEntry(hPtr); +} + + +/* + * Derivation of tclStringHashKeyType with another allocEntryProc + */ + +static Tcl_HashKeyType ClockFmtScnStorageHashKeyType; + + +/* + * Type definition of clock-format tcl object type. + */ + +Tcl_ObjType ClockFmtObjType = { + "clock-format", /* name */ + ClockFmtObj_FreeInternalRep, /* freeIntRepProc */ + ClockFmtObj_DupInternalRep, /* dupIntRepProc */ + ClockFmtObj_UpdateString, /* updateStringProc */ + ClockFmtObj_SetFromAny /* setFromAnyProc */ +}; + +#define ObjClockFmtScn(objPtr) \ + (*((ClockFmtScnStorage **)&(objPtr)->internalRep.twoPtrValue.ptr1)) + +#define ObjLocFmtKey(objPtr) \ + (*((Tcl_Obj **)&(objPtr)->internalRep.twoPtrValue.ptr2)) + +static void +ClockFmtObj_DupInternalRep(srcPtr, copyPtr) + Tcl_Obj *srcPtr; + Tcl_Obj *copyPtr; +{ + ClockFmtScnStorage *fss = ObjClockFmtScn(srcPtr); + + if (fss != NULL) { + Tcl_MutexLock(&ClockFmtMutex); + fss->objRefCount++; + Tcl_MutexUnlock(&ClockFmtMutex); + } + + ObjClockFmtScn(copyPtr) = fss; + /* regards special case - format not localizable */ + if (ObjLocFmtKey(srcPtr) != srcPtr) { + Tcl_InitObjRef(ObjLocFmtKey(copyPtr), ObjLocFmtKey(srcPtr)); + } else { + ObjLocFmtKey(copyPtr) = copyPtr; + } + copyPtr->typePtr = &ClockFmtObjType; + + + /* if no format representation, dup string representation */ + if (fss == NULL) { + copyPtr->bytes = ckalloc(srcPtr->length + 1); + memcpy(copyPtr->bytes, srcPtr->bytes, srcPtr->length + 1); + copyPtr->length = srcPtr->length; + } +} + +static void +ClockFmtObj_FreeInternalRep(objPtr) + Tcl_Obj *objPtr; +{ + ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); + if (fss != NULL) { + Tcl_MutexLock(&ClockFmtMutex); + /* decrement object reference count of format/scan storage */ + if (--fss->objRefCount <= 0) { + #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* don't remove it right now (may be reusable), just add to GC */ + ClockFmtScnStorageGC_In(fss); + #else + /* remove storage (format representation) */ + ClockFmtScnStorageDelete(fss); + #endif + } + Tcl_MutexUnlock(&ClockFmtMutex); + } + ObjClockFmtScn(objPtr) = NULL; + if (ObjLocFmtKey(objPtr) != objPtr) { + Tcl_UnsetObjRef(ObjLocFmtKey(objPtr)); + } else { + ObjLocFmtKey(objPtr) = NULL; + } + objPtr->typePtr = NULL; +}; + +static int +ClockFmtObj_SetFromAny(interp, objPtr) + Tcl_Interp *interp; + Tcl_Obj *objPtr; +{ + /* validate string representation before free old internal represenation */ + (void)TclGetString(objPtr); + + /* free old internal represenation */ + if (objPtr->typePtr && objPtr->typePtr->freeIntRepProc) + objPtr->typePtr->freeIntRepProc(objPtr); + + /* initial state of format object */ + ObjClockFmtScn(objPtr) = NULL; + ObjLocFmtKey(objPtr) = NULL; + objPtr->typePtr = &ClockFmtObjType; + + return TCL_OK; +}; + +static void +ClockFmtObj_UpdateString(objPtr) + Tcl_Obj *objPtr; +{ + char *name = "UNKNOWN"; + int len; + ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); + + if (fss != NULL) { + Tcl_HashEntry *hPtr = HashEntry4FmtScn(fss); + name = hPtr->key.string; + } + len = strlen(name); + objPtr->length = len, + objPtr->bytes = ckalloc((size_t)++len); + if (objPtr->bytes) + memcpy(objPtr->bytes, name, len); +} + +/* + *---------------------------------------------------------------------- + * + * ClockFrmObjGetLocFmtKey -- + * + * Retrieves format key object used to search localized format. + * + * This is normally stored in second pointer of internal representation. + * If format object is not localizable, it is equal the given format + * pointer and the first pointer of internal representation may be NULL. + * + * Results: + * Returns tcl object with key or format object if not localizable. + * + * Side effects: + * Converts given format object to ClockFmtObjType on demand for caching + * the key inside its internal representation. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE Tcl_Obj* +ClockFrmObjGetLocFmtKey( + Tcl_Interp *interp, + Tcl_Obj *objPtr) +{ + Tcl_Obj *keyObj; + + if (objPtr->typePtr != &ClockFmtObjType) { + if (ClockFmtObj_SetFromAny(interp, objPtr) != TCL_OK) { + return NULL; + } + } + + keyObj = ObjLocFmtKey(objPtr); + if (keyObj) { + return keyObj; + } + + keyObj = Tcl_ObjPrintf("FMT_%s", TclGetString(objPtr)); + Tcl_InitObjRef(ObjLocFmtKey(objPtr), keyObj); + + return keyObj; +} + +/* + *---------------------------------------------------------------------- + * + * FindOrCreateFmtScnStorage -- + * + * Retrieves format storage for given string format. + * + * This will find the given format in the global storage hash table + * or create a format storage object on demaind and save the + * reference in the first pointer of internal representation of given + * object. + * + * Results: + * Returns scan/format storage pointer to ClockFmtScnStorage. + * + * Side effects: + * Converts given format object to ClockFmtObjType on demand for caching + * the format storage reference inside its internal representation. + * Increments objRefCount of the ClockFmtScnStorage reference. + * + *---------------------------------------------------------------------- + */ + +static ClockFmtScnStorage * +FindOrCreateFmtScnStorage( + Tcl_Interp *interp, + Tcl_Obj *objPtr) +{ + const char *strFmt = TclGetString(objPtr); + ClockFmtScnStorage *fss = NULL; + int new; + Tcl_HashEntry *hPtr; + + Tcl_MutexLock(&ClockFmtMutex); + + /* if not yet initialized */ + if (!initialized) { + /* initialize type */ + memcpy(&ClockFmtScnStorageHashKeyType, &tclStringHashKeyType, sizeof(tclStringHashKeyType)); + ClockFmtScnStorageHashKeyType.allocEntryProc = ClockFmtScnStorageAllocProc; + ClockFmtScnStorageHashKeyType.freeEntryProc = ClockFmtScnStorageFreeProc; + + /* initialize hash table */ + Tcl_InitCustomHashTable(&FmtScnHashTable, TCL_CUSTOM_TYPE_KEYS, + &ClockFmtScnStorageHashKeyType); + + initialized = 1; + Tcl_CreateExitHandler(ClockFrmScnFinalize, NULL); + } + + /* get or create entry (and alocate storage) */ + hPtr = Tcl_CreateHashEntry(&FmtScnHashTable, strFmt, &new); + if (hPtr != NULL) { + + fss = FmtScn4HashEntry(hPtr); + + #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* unlink if it is currently in GC */ + if (new == 0 && fss->objRefCount == 0) { + ClockFmtScnStorage_GC_Out(fss); + } + #endif + + /* new reference, so increment in lock right now */ + fss->objRefCount++; + + ObjClockFmtScn(objPtr) = fss; + } + + Tcl_MutexUnlock(&ClockFmtMutex); + + if (fss == NULL && interp != NULL) { + Tcl_AppendResult(interp, "retrieve clock format failed \"", + strFmt ? strFmt : "", "\"", NULL); + Tcl_SetErrorCode(interp, "TCL", "EINVAL", NULL); + } + + return fss; +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_GetClockFrmScnFromObj -- + * + * Returns a clock format/scan representation of (*objPtr), if possible. + * If something goes wrong, NULL is returned, and if interp is non-NULL, + * an error message is written there. + * + * Results: + * Valid representation of type ClockFmtScnStorage. + * + * Side effects: + * Caches the ClockFmtScnStorage reference as the internal rep of (*objPtr) + * and in global hash table, shared across all threads. + * + *---------------------------------------------------------------------- + */ + +ClockFmtScnStorage * +Tcl_GetClockFrmScnFromObj( + Tcl_Interp *interp, + Tcl_Obj *objPtr) +{ + ClockFmtScnStorage *fss; + + if (objPtr->typePtr != &ClockFmtObjType) { + if (ClockFmtObj_SetFromAny(interp, objPtr) != TCL_OK) { + return NULL; + } + } + + fss = ObjClockFmtScn(objPtr); + + if (fss == NULL) { + fss = FindOrCreateFmtScnStorage(interp, objPtr); + } + + return fss; +} +/* + *---------------------------------------------------------------------- + * + * ClockLocalizeFormat -- + * + * Wrap the format object in options to the localized format, + * corresponding given locale. + * + * This searches localized format in locale catalog, and if not yet + * exists, it executes ::tcl::clock::LocalizeFormat in given interpreter + * and caches its result in the locale catalog. + * + * Results: + * Localized format object. + * + * Side effects: + * Caches the localized format inside locale catalog. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE Tcl_Obj * +ClockLocalizeFormat( + ClockFmtScnCmdArgs *opts) +{ + ClockClientData *dataPtr = opts->clientData; + Tcl_Obj *valObj = NULL, *keyObj; + + keyObj = ClockFrmObjGetLocFmtKey(opts->interp, opts->formatObj); + + /* special case - format object is not localizable */ + if (keyObj == opts->formatObj) { + return opts->formatObj; + } + + if (opts->mcDictObj == NULL) { + ClockMCDict(opts); + if (opts->mcDictObj == NULL) + return NULL; + } + + /* try to find in cache within locale mc-catalog */ + if (Tcl_DictObjGet(NULL, opts->mcDictObj, + keyObj, &valObj) != TCL_OK) { + return NULL; + } + + /* call LocalizeFormat locale format fmtkey */ + if (valObj == NULL) { + Tcl_Obj *callargs[4]; + callargs[0] = dataPtr->literals[LIT_LOCALIZE_FORMAT]; + callargs[1] = opts->localeObj; + callargs[2] = opts->formatObj; + callargs[3] = keyObj; + Tcl_IncrRefCount(keyObj); + if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK + ) { + goto clean; + } + + valObj = Tcl_GetObjResult(opts->interp); + + /* cache it inside mc-dictionary (this incr. ref count of keyObj/valObj) */ + if (Tcl_DictObjPut(opts->interp, opts->mcDictObj, + keyObj, valObj) != TCL_OK + ) { + valObj = NULL; + goto clean; + } + + /* check special case - format object is not localizable */ + if (valObj == opts->formatObj) { + /* mark it as unlocalizable, by setting self as key (without refcount incr) */ + if (opts->formatObj->typePtr == &ClockFmtObjType) { + Tcl_UnsetObjRef(ObjLocFmtKey(opts->formatObj)); + ObjLocFmtKey(opts->formatObj) = opts->formatObj; + } + } +clean: + + Tcl_UnsetObjRef(keyObj); + if (valObj) { + Tcl_ResetResult(opts->interp); + } + } + + return (opts->formatObj = valObj); +} + +/* + *---------------------------------------------------------------------- + * + * FindTokenBegin -- + * + * Find begin of given scan token in string, corresponding token type. + * + * Results: + * Position of token inside string if found. Otherwise - end of string. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static const char * +FindTokenBegin( + register const char *p, + register const char *end, + ClockScanToken *tok) +{ + char c; + if (p < end) { + /* next token a known token type */ + switch (tok->map->type) { + case CTOKT_DIGIT: + /* should match at least one digit */ + while (!isdigit(UCHAR(*p)) && (p = TclUtfNext(p)) < end) {}; + return p; + break; + case CTOKT_WORD: + c = *(tok->tokWord.start); + /* should match at least to the first char of this word */ + while (*p != c && (p = TclUtfNext(p)) < end) {}; + return p; + break; + case CTOKT_SPACE: + while (!isspace(UCHAR(*p)) && (p = TclUtfNext(p)) < end) {}; + return p; + break; + case CTOKT_CHAR: + c = *((char *)tok->map->data); + while (*p != c && (p = TclUtfNext(p)) < end) {}; + return p; + break; + } + } + return p; +} + +/* + *---------------------------------------------------------------------- + * + * DetermineGreedySearchLen -- + * + * Determine min/max lengths as exact as possible (speed, greedy match). + * + * Results: + * None. Lengths are stored in *minLenPtr, *maxLenPtr. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok, + int *minLenPtr, int *maxLenPtr) +{ + register int minLen = tok->map->minSize; + register int maxLen; + register const char *p = yyInput + minLen, + *end = info->dateEnd; + + /* if still tokens available, try to correct minimum length */ + if ((tok+1)->map) { + end -= tok->endDistance + yySpaceCount; + /* find position of next known token */ + p = FindTokenBegin(p, end, tok+1); + if (p < end) { + minLen = p - yyInput; + } + } + + /* max length to the end regarding distance to end (min-width of following tokens) */ + maxLen = end - yyInput; + /* several amendments */ + if (maxLen > tok->map->maxSize) { + maxLen = tok->map->maxSize; + }; + if (minLen < tok->map->minSize) { + minLen = tok->map->minSize; + } + if (minLen > maxLen) { + maxLen = minLen; + } + if (maxLen > info->dateEnd - yyInput) { + maxLen = info->dateEnd - yyInput; + } + + /* check digits rigth now */ + if (tok->map->type == CTOKT_DIGIT) { + p = yyInput; + end = p + maxLen; + if (end > info->dateEnd) { end = info->dateEnd; }; + while (isdigit(UCHAR(*p)) && p < end) { p++; }; + maxLen = p - yyInput; + } + + /* try to get max length more precise for greedy match, + * check the next ahead token available there */ + if (minLen < maxLen && tok->lookAhTok) { + ClockScanToken *laTok = tok + tok->lookAhTok + 1; + p = yyInput + maxLen; + /* regards all possible spaces here (because they are optional) */ + end = p + tok->lookAhMax + yySpaceCount + 1; + if (end > info->dateEnd) { + end = info->dateEnd; + } + p += tok->lookAhMin; + if (laTok->map && p < end) { + const char *f; + /* try to find laTok between [lookAhMin, lookAhMax] */ + while (minLen < maxLen) { + f = FindTokenBegin(p, end, laTok); + /* if found (not below lookAhMax) */ + if (f < end) { + break; + } + /* try again with fewer length */ + maxLen--; + p--; + end--; + } + } else if (p > end) { + maxLen -= (p - end); + if (maxLen < minLen) { + maxLen = minLen; + } + } + } + + *minLenPtr = minLen; + *maxLenPtr = maxLen; +} + +/* + *---------------------------------------------------------------------- + * + * ObjListSearch -- + * + * Find largest part of the input string from start regarding min and + * max lengths in the given list (utf-8, case sensitive). + * + * Results: + * TCL_OK - match found, TCL_RETURN - not matched, TCL_ERROR in error case. + * + * Side effects: + * Input points to end of the found token in string. + * + *---------------------------------------------------------------------- + */ + +static inline int +ObjListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, int *val, + Tcl_Obj **lstv, int lstc, + int minLen, int maxLen) +{ + int i, l, lf = -1; + const char *s, *f, *sf; + /* search in list */ + for (i = 0; i < lstc; i++) { + s = TclGetString(lstv[i]); + l = lstv[i]->length; + + if ( l >= minLen + && (f = TclUtfFindEqualNC(yyInput, yyInput + maxLen, s, s + l, &sf)) > yyInput + ) { + l = f - yyInput; + if (l < minLen) { + continue; + } + /* found, try to find longest value (greedy search) */ + if (l < maxLen && minLen != maxLen) { + lf = i; + minLen = l + 1; + continue; + } + /* max possible - end of search */ + *val = i; + yyInput += l; + break; + } + } + + /* if found */ + if (i < lstc) { + return TCL_OK; + } + if (lf >= 0) { + *val = lf; + yyInput += minLen - 1; + return TCL_OK; + } + return TCL_RETURN; +} +#if 0 +/* currently unused */ + +static int +LocaleListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, int mcKey, int *val, + int minLen, int maxLen) +{ + Tcl_Obj **lstv; + int lstc; + Tcl_Obj *valObj; + + /* get msgcat value */ + valObj = ClockMCGet(opts, mcKey); + if (valObj == NULL) { + return TCL_ERROR; + } + + /* is a list */ + if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { + return TCL_ERROR; + } + + /* search in list */ + return ObjListSearch(opts, info, val, lstv, lstc, + minLen, maxLen); +} +#endif + +/* + *---------------------------------------------------------------------- + * + * ClockMCGetListIdxTree -- + * + * Retrieves localized string indexed tree in the locale catalog for + * given literal index mcKey (and builds it on demand). + * + * Searches localized index in locale catalog, and if not yet exists, + * creates string indexed tree and stores it in the locale catalog. + * + * Results: + * Localized string index tree. + * + * Side effects: + * Caches the localized string index tree inside locale catalog. + * + *---------------------------------------------------------------------- + */ + +static TclStrIdxTree * +ClockMCGetListIdxTree( + ClockFmtScnCmdArgs *opts, + int mcKey) +{ + TclStrIdxTree * idxTree; + Tcl_Obj *objPtr = ClockMCGetIdx(opts, mcKey); + if ( objPtr != NULL + && (idxTree = TclStrIdxTreeGetFromObj(objPtr)) != NULL + ) { + return idxTree; + + } else { + /* build new index */ + + Tcl_Obj **lstv; + int lstc; + Tcl_Obj *valObj; + + objPtr = TclStrIdxTreeNewObj(); + if ((idxTree = TclStrIdxTreeGetFromObj(objPtr)) == NULL) { + goto done; /* unexpected, but ...*/ + } + + valObj = ClockMCGet(opts, mcKey); + if (valObj == NULL) { + goto done; + } + + if (TclListObjGetElements(opts->interp, valObj, + &lstc, &lstv) != TCL_OK) { + goto done; + }; + + if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv) != TCL_OK) { + goto done; + } + + ClockMCSetIdx(opts, mcKey, objPtr); + objPtr = NULL; + }; + +done: + if (objPtr) { + Tcl_DecrRefCount(objPtr); + idxTree = NULL; + } + + return idxTree; +} + +/* + *---------------------------------------------------------------------- + * + * ClockMCGetMultiListIdxTree -- + * + * Retrieves localized string indexed tree in the locale catalog for + * multiple lists by literal indices mcKeys (and builds it on demand). + * + * Searches localized index in locale catalog for mcKey, and if not + * yet exists, creates string indexed tree and stores it in the + * locale catalog. + * + * Results: + * Localized string index tree. + * + * Side effects: + * Caches the localized string index tree inside locale catalog. + * + *---------------------------------------------------------------------- + */ + +static TclStrIdxTree * +ClockMCGetMultiListIdxTree( + ClockFmtScnCmdArgs *opts, + int mcKey, + int *mcKeys) +{ + TclStrIdxTree * idxTree; + Tcl_Obj *objPtr = ClockMCGetIdx(opts, mcKey); + if ( objPtr != NULL + && (idxTree = TclStrIdxTreeGetFromObj(objPtr)) != NULL + ) { + return idxTree; + + } else { + /* build new index */ + + Tcl_Obj **lstv; + int lstc; + Tcl_Obj *valObj; + + objPtr = TclStrIdxTreeNewObj(); + if ((idxTree = TclStrIdxTreeGetFromObj(objPtr)) == NULL) { + goto done; /* unexpected, but ...*/ + } + + while (*mcKeys) { + + valObj = ClockMCGet(opts, *mcKeys); + if (valObj == NULL) { + goto done; + } + + if (TclListObjGetElements(opts->interp, valObj, + &lstc, &lstv) != TCL_OK) { + goto done; + }; + + if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv) != TCL_OK) { + goto done; + } + mcKeys++; + } + + ClockMCSetIdx(opts, mcKey, objPtr); + objPtr = NULL; + }; + +done: + if (objPtr) { + Tcl_DecrRefCount(objPtr); + idxTree = NULL; + } + + return idxTree; +} + +/* + *---------------------------------------------------------------------- + * + * ClockStrIdxTreeSearch -- + * + * Find largest part of the input string from start regarding lengths + * in the given localized string indexed tree (utf-8, case sensitive). + * + * Results: + * TCL_OK - match found and the index stored in *val, + * TCL_RETURN - not matched or ambigous, + * TCL_ERROR - in error case. + * + * Side effects: + * Input points to end of the found token in string. + * + *---------------------------------------------------------------------- + */ + +static inline int +ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, TclStrIdxTree *idxTree, int *val, + int minLen, int maxLen) +{ + const char *f; + TclStrIdx *foundItem; + f = TclStrIdxTreeSearch(NULL, &foundItem, idxTree, + yyInput, yyInput + maxLen); + + if (f <= yyInput || (f - yyInput) < minLen) { + /* not found */ + return TCL_RETURN; + } + if (foundItem->value == -1) { + /* ambigous */ + return TCL_RETURN; + } + + *val = foundItem->value; + + /* shift input pointer */ + yyInput = f; + + return TCL_OK; +} +#if 0 +/* currently unused */ + +static int +StaticListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, const char **lst, int *val) +{ + int len; + const char **s = lst; + while (*s != NULL) { + len = strlen(*s); + if ( len <= info->dateEnd - yyInput + && strncasecmp(yyInput, *s, len) == 0 + ) { + *val = (s - lst); + yyInput += len; + break; + } + s++; + } + if (*s != NULL) { + return TCL_OK; + } + return TCL_RETURN; +} +#endif + +static inline const char * +FindWordEnd( + ClockScanToken *tok, + register const char * p, const char * end) +{ + register const char *x = tok->tokWord.start; + const char *pfnd = p; + if (x == tok->tokWord.end - 1) { /* fast phase-out for single char word */ + if (*p == *x) { + return ++p; + } + } + /* multi-char word */ + x = TclUtfFindEqualNC(x, tok->tokWord.end, p, end, &pfnd); + if (x < tok->tokWord.end) { + /* no match -> error */ + return NULL; + } + return pfnd; +} + +static int +ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ +#if 0 +/* currently unused, test purposes only */ + static const char * months[] = { + /* full */ + "January", "February", "March", + "April", "May", "June", + "July", "August", "September", + "October", "November", "December", + /* abbr */ + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", + NULL + }; + int val; + if (StaticListSearch(opts, info, months, &val) != TCL_OK) { + return TCL_RETURN; + } + yyMonth = (val % 12) + 1; + return TCL_OK; +#endif + + static int monthsKeys[] = {MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, 0}; + + int ret, val; + int minLen, maxLen; + TclStrIdxTree *idxTree; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + /* get or create tree in msgcat dict */ + + idxTree = ClockMCGetMultiListIdxTree(opts, MCLIT_MONTHS_COMB, monthsKeys); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + yyMonth = val + 1; + return TCL_OK; + +} + +static int +ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + static int dowKeys[] = {MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_DAYS_OF_WEEK_FULL, 0}; + + int ret, val; + int minLen, maxLen; + char curTok = *tok->tokWord.start; + TclStrIdxTree *idxTree; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + /* %u %w %Ou %Ow */ + if ( curTok != 'a' && curTok != 'A' + && ((minLen <= 1 && maxLen >= 1) || PTR2INT(tok->map->data)) + ) { + + val = -1; + + if (PTR2INT(tok->map->data) == 0) { + if (*yyInput >= '0' && *yyInput <= '9') { + val = *yyInput - '0'; + } + } else { + idxTree = ClockMCGetListIdxTree(opts, PTR2INT(tok->map->data) /* mcKey */); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + } + + if (val != -1) { + if (val == 0) { + val = 7; + } + if (val > 7) { + Tcl_SetResult(opts->interp, "day of week is greater than 7", + TCL_STATIC); + Tcl_SetErrorCode(opts->interp, "CLOCK", "badDayOfWeek", NULL); + return TCL_ERROR; + } + info->date.dayOfWeek = val; + yyInput++; + return TCL_OK; + } + + + return TCL_RETURN; + } + + /* %a %A */ + idxTree = ClockMCGetMultiListIdxTree(opts, MCLIT_DAYS_OF_WEEK_COMB, dowKeys); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + if (val == 0) { + val = 7; + } + info->date.dayOfWeek = val; + return TCL_OK; + +} + +static int +ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int ret, val; + int minLen, maxLen; + Tcl_Obj *amPmObj[2]; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + amPmObj[0] = ClockMCGet(opts, MCLIT_AM); + amPmObj[1] = ClockMCGet(opts, MCLIT_PM); + + if (amPmObj[0] == NULL || amPmObj[1] == NULL) { + return TCL_ERROR; + } + + ret = ObjListSearch(opts, info, &val, amPmObj, 2, + minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + if (val == 0) { + yyMeridian = MERam; + } else { + yyMeridian = MERpm; + } + + return TCL_OK; +} + +static int +ClockScnToken_LocaleERA_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + ClockClientData *dataPtr = opts->clientData; + + int ret, val; + int minLen, maxLen; + Tcl_Obj *eraObj[6]; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + eraObj[0] = ClockMCGet(opts, MCLIT_BCE); + eraObj[1] = ClockMCGet(opts, MCLIT_CE); + eraObj[2] = dataPtr->mcLiterals[MCLIT_BCE2]; + eraObj[3] = dataPtr->mcLiterals[MCLIT_CE2]; + eraObj[4] = dataPtr->mcLiterals[MCLIT_BCE3]; + eraObj[5] = dataPtr->mcLiterals[MCLIT_CE3]; + + if (eraObj[0] == NULL || eraObj[1] == NULL) { + return TCL_ERROR; + } + + ret = ObjListSearch(opts, info, &val, eraObj, 6, + minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + if (val & 1) { + yydate.era = CE; + } else { + yydate.era = BCE; + } + + return TCL_OK; +} + +static int +ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int ret, val; + int minLen, maxLen; + TclStrIdxTree *idxTree; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + /* get or create tree in msgcat dict */ + + idxTree = ClockMCGetListIdxTree(opts, PTR2INT(tok->map->data) /* mcKey */); + if (idxTree == NULL) { + return TCL_ERROR; + } + + ret = ClockStrIdxTreeSearch(opts, info, idxTree, &val, minLen, maxLen); + if (ret != TCL_OK) { + return ret; + } + + if (tok->map->offs > 0) { + *(int *)(((char *)info) + tok->map->offs) = val; + } + + return TCL_OK; +} + +static int +ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int minLen, maxLen; + int len = 0; + register const char *p = yyInput; + Tcl_Obj *tzObjStor = NULL; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + /* numeric timezone */ + if (*p == '+' || *p == '-') { + /* max chars in numeric zone = "+00:00:00" */ + #define MAX_ZONE_LEN 9 + char buf[MAX_ZONE_LEN + 1]; + char *bp = buf; + *bp++ = *p++; len++; + if (maxLen > MAX_ZONE_LEN) + maxLen = MAX_ZONE_LEN; + /* cumulate zone into buf without ':' */ + while (len + 1 < maxLen) { + if (!isdigit(UCHAR(*p))) break; + *bp++ = *p++; len++; + if (!isdigit(UCHAR(*p))) break; + *bp++ = *p++; len++; + if (len + 2 < maxLen) { + if (*p == ':') { + p++; len++; + } + } + } + *bp = '\0'; + + if (len < minLen) { + return TCL_RETURN; + } + #undef MAX_ZONE_LEN + + /* timezone */ + tzObjStor = Tcl_NewStringObj(buf, bp-buf); + } else { + /* legacy (alnum) timezone like CEST, etc. */ + if (maxLen > 4) + maxLen = 4; + while (len < maxLen) { + if ( (*p & 0x80) + || (!isalpha(UCHAR(*p)) && !isdigit(UCHAR(*p))) + ) { /* INTL: ISO only. */ + break; + } + p++; len++; + } + + if (len < minLen) { + return TCL_RETURN; + } + + /* timezone */ + tzObjStor = Tcl_NewStringObj(yyInput, p-yyInput); + + /* convert using dict */ + } + + /* try to apply new time zone */ + Tcl_IncrRefCount(tzObjStor); + + opts->timezoneObj = ClockSetupTimeZone(opts->clientData, opts->interp, + tzObjStor); + + Tcl_DecrRefCount(tzObjStor); + if (opts->timezoneObj == NULL) { + return TCL_ERROR; + } + + yyInput += len; + + return TCL_OK; +} + +static int +ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, + DateInfo *info, ClockScanToken *tok) +{ + int minLen, maxLen; + register const char *p = yyInput, *end; const char *s; + int year, fractYear, fractDayDiv, fractDay; + static const char *stardatePref = "stardate "; + + DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen); + + end = yyInput + maxLen; + + /* stardate string */ + p = TclUtfFindEqualNCInLwr(p, end, stardatePref, stardatePref + 9, &s); + if (p >= end || p - yyInput < 9) { + return TCL_RETURN; + } + /* bypass spaces */ + while (p < end && isspace(UCHAR(*p))) { + p++; + } + if (p >= end) { + return TCL_RETURN; + } + /* currently positive stardate only */ + if (*p == '+') { p++; }; + s = p; + while (p < end && isdigit(UCHAR(*p))) { + p++; + } + if (p >= end || p - s < 4) { + return TCL_RETURN; + } + if ( _str2int(&year, s, p-3, 1) != TCL_OK + || _str2int(&fractYear, p-3, p, 1) != TCL_OK) { + return TCL_RETURN; + }; + if (*p++ != '.') { + return TCL_RETURN; + } + s = p; + fractDayDiv = 1; + while (p < end && isdigit(UCHAR(*p))) { + fractDayDiv *= 10; + p++; + } + if ( _str2int(&fractDay, s, p, 1) != TCL_OK) { + return TCL_RETURN; + }; + yyInput = p; + + /* Build a date from year and fraction. */ + + yydate.year = year + RODDENBERRY; + yydate.era = CE; + yydate.gregorian = 1; + + if (IsGregorianLeapYear(&yydate)) { + fractYear *= 366; + } else { + fractYear *= 365; + } + yydate.dayOfYear = fractYear / 1000 + 1; + if (fractYear % 1000 >= 500) { + yydate.dayOfYear++; + } + + GetJulianDayFromEraYearDay(&yydate, GREGORIAN_CHANGE_DATE); + + yydate.localSeconds = + -210866803200L + + ( SECONDS_PER_DAY * (Tcl_WideInt)yydate.julianDay ) + + ( SECONDS_PER_DAY * fractDay / fractDayDiv ); + + return TCL_OK; +} + +static const char *ScnSTokenMapIndex = + "dmbyYHMSpJjCgGVazUsntQ"; +static ClockScanTokenMap ScnSTokenMap[] = { + /* %d %e */ + {CTOKT_DIGIT, CLF_DAYOFMONTH, 0, 1, 2, TclOffset(DateInfo, date.dayOfMonth), + NULL}, + /* %m %N */ + {CTOKT_DIGIT, CLF_MONTH, 0, 1, 2, TclOffset(DateInfo, date.month), + NULL}, + /* %b %B %h */ + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0xffff, 0, + ClockScnToken_Month_Proc}, + /* %y */ + {CTOKT_DIGIT, CLF_YEAR, 0, 1, 2, TclOffset(DateInfo, date.year), + NULL}, + /* %Y */ + {CTOKT_DIGIT, CLF_YEAR | CLF_CENTURY, 0, 4, 4, TclOffset(DateInfo, date.year), + NULL}, + /* %H %k %I %l */ + {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.hour), + NULL}, + /* %M */ + {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.minutes), + NULL}, + /* %S */ + {CTOKT_DIGIT, CLF_TIME, 0, 1, 2, TclOffset(DateInfo, date.secondOfDay), + NULL}, + /* %p %P */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0xffff, 0, + ClockScnToken_amPmInd_Proc, NULL}, + /* %J */ + {CTOKT_DIGIT, CLF_JULIANDAY, 0, 1, 0xffff, TclOffset(DateInfo, date.julianDay), + NULL}, + /* %j */ + {CTOKT_DIGIT, CLF_DAYOFYEAR, 0, 1, 3, TclOffset(DateInfo, date.dayOfYear), + NULL}, + /* %C */ + {CTOKT_DIGIT, CLF_CENTURY|CLF_ISO8601CENTURY, 0, 1, 2, TclOffset(DateInfo, dateCentury), + NULL}, + /* %g */ + {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601, 0, 2, 2, TclOffset(DateInfo, date.iso8601Year), + NULL}, + /* %G */ + {CTOKT_DIGIT, CLF_ISO8601YEAR | CLF_ISO8601 | CLF_ISO8601CENTURY, 0, 4, 4, TclOffset(DateInfo, date.iso8601Year), + NULL}, + /* %V */ + {CTOKT_DIGIT, CLF_ISO8601, 0, 1, 2, TclOffset(DateInfo, date.iso8601Week), + NULL}, + /* %a %A %u %w */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0xffff, 0, + ClockScnToken_DayOfWeek_Proc, NULL}, + /* %z %Z */ + {CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0xffff, 0, + ClockScnToken_TimeZone_Proc, NULL}, + /* %U %W */ + {CTOKT_DIGIT, CLF_OPTIONAL, 0, 1, 2, 0, /* currently no capture, parse only token */ + NULL}, + /* %s */ + {CTOKT_DIGIT, CLF_POSIXSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.seconds), + NULL}, + /* %n */ + {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\n"}, + /* %t */ + {CTOKT_CHAR, 0, 0, 1, 1, 0, NULL, "\t"}, + /* %Q */ + {CTOKT_PARSER, CLF_LOCALSEC, 0, 16, 30, 0, + ClockScnToken_StarDate_Proc, NULL}, +}; +static const char *ScnSTokenMapAliasIndex[2] = { + "eNBhkIlPAuwZW", + "dmbbHHHpaaazU" +}; + +static const char *ScnETokenMapIndex = + "Eys"; +static ClockScanTokenMap ScnETokenMap[] = { + /* %EE */ + {CTOKT_PARSER, 0, 0, 0, 0xffff, TclOffset(DateInfo, date.year), + ClockScnToken_LocaleERA_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ey */ + {CTOKT_PARSER, 0, 0, 0, 0xffff, 0, /* currently no capture, parse only token */ + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Es */ + {CTOKT_DIGIT, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds), + NULL}, +}; +static const char *ScnETokenMapAliasIndex[2] = { + "", + "" +}; + +static const char *ScnOTokenMapIndex = + "dmyHMSu"; +static ClockScanTokenMap ScnOTokenMap[] = { + /* %Od %Oe */ + {CTOKT_PARSER, CLF_DAYOFMONTH, 0, 0, 0xffff, TclOffset(DateInfo, date.dayOfMonth), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Om */ + {CTOKT_PARSER, CLF_MONTH, 0, 0, 0xffff, TclOffset(DateInfo, date.month), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Oy */ + {CTOKT_PARSER, CLF_YEAR, 0, 0, 0xffff, TclOffset(DateInfo, date.year), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OH %Ok %OI %Ol */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.hour), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OM */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.minutes), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OS */ + {CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.secondOfDay), + ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ou Ow */ + {CTOKT_PARSER, CLF_ISO8601, 0, 0, 0xffff, 0, + ClockScnToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS}, +}; +static const char *ScnOTokenMapAliasIndex[2] = { + "ekIlw", + "dHHHu" +}; + +static const char *ScnSpecTokenMapIndex = + " "; +static ClockScanTokenMap ScnSpecTokenMap[] = { + {CTOKT_SPACE, 0, 0, 1, 1, 0, + NULL}, +}; + +static ClockScanTokenMap ScnWordTokenMap = { + CTOKT_WORD, 0, 0, 1, 1, 0, + NULL +}; + + +static inline unsigned int +EstimateTokenCount( + register const char *fmt, + register const char *end) +{ + register const char *p = fmt; + unsigned int tokcnt; + /* estimate token count by % char and format length */ + tokcnt = 0; + while (p <= end) { + if (*p++ == '%') { + tokcnt++; + p++; + } + } + p = fmt + tokcnt * 2; + if (p < end) { + if ((unsigned int)(end - p) < tokcnt) { + tokcnt += (end - p); + } else { + tokcnt += tokcnt; + } + } + return ++tokcnt; +} + +#define AllocTokenInChain(tok, chain, tokCnt) \ + if (++(tok) >= (chain) + (tokCnt)) { \ + *((char **)&chain) = ckrealloc((char *)(chain), \ + (tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \ + if ((chain) == NULL) { goto done; }; \ + (tok) = (chain) + (tokCnt); \ + (tokCnt) += CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE; \ + } \ + memset(tok, 0, sizeof(*(tok))); + +/* + *---------------------------------------------------------------------- + */ +ClockFmtScnStorage * +ClockGetOrParseScanFormat( + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *formatObj) /* Format container */ +{ + ClockFmtScnStorage *fss; + ClockScanToken *tok; + + fss = Tcl_GetClockFrmScnFromObj(interp, formatObj); + if (fss == NULL) { + return NULL; + } + + /* if first time scanning - tokenize format */ + if (fss->scnTok == NULL) { + unsigned int tokCnt; + register const char *p, *e, *cp; + + e = p = HashEntry4FmtScn(fss)->key.string; + e += strlen(p); + + /* estimate token count by % char and format length */ + fss->scnTokC = EstimateTokenCount(p, e); + + fss->scnSpaceCount = 0; + + Tcl_MutexLock(&ClockFmtMutex); + + fss->scnTok = tok = ckalloc(sizeof(*tok) * fss->scnTokC); + memset(tok, 0, sizeof(*(tok))); + tokCnt = 1; + while (p < e) { + switch (*p) { + case '%': + if (1) { + ClockScanTokenMap * scnMap = ScnSTokenMap; + const char *mapIndex = ScnSTokenMapIndex, + **aliasIndex = ScnSTokenMapAliasIndex; + if (p+1 >= e) { + goto word_tok; + } + p++; + /* try to find modifier: */ + switch (*p) { + case '%': + /* begin new word token - don't join with previous word token, + * because current mapping should be "...%%..." -> "...%..." */ + tok->map = &ScnWordTokenMap; + tok->tokWord.start = p; + tok->tokWord.end = p+1; + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; + p++; + continue; + break; + case 'E': + scnMap = ScnETokenMap, + mapIndex = ScnETokenMapIndex, + aliasIndex = ScnETokenMapAliasIndex; + p++; + break; + case 'O': + scnMap = ScnOTokenMap, + mapIndex = ScnOTokenMapIndex, + aliasIndex = ScnOTokenMapAliasIndex; + p++; + break; + } + /* search direct index */ + cp = strchr(mapIndex, *p); + if (!cp || *cp == '\0') { + /* search wrapper index (multiple chars for same token) */ + cp = strchr(aliasIndex[0], *p); + if (!cp || *cp == '\0') { + p--; if (scnMap != ScnSTokenMap) p--; + goto word_tok; + } + cp = strchr(mapIndex, aliasIndex[1][cp - aliasIndex[0]]); + if (!cp || *cp == '\0') { /* unexpected, but ... */ + #ifdef DEBUG + Tcl_Panic("token \"%c\" has no map in wrapper resolver", *p); + #endif + p--; if (scnMap != ScnSTokenMap) p--; + goto word_tok; + } + } + tok->map = &scnMap[cp - mapIndex]; + tok->tokWord.start = p; + + /* calculate look ahead value by standing together tokens */ + if (tok > fss->scnTok) { + ClockScanToken *prevTok = tok - 1; + + while (prevTok >= fss->scnTok) { + if (prevTok->map->type != tok->map->type) { + break; + } + prevTok->lookAhMin += tok->map->minSize; + prevTok->lookAhMax += tok->map->maxSize; + prevTok->lookAhTok++; + prevTok--; + } + } + + /* increase space count used in format */ + if ( tok->map->type == CTOKT_CHAR + && isspace(UCHAR(*((char *)tok->map->data))) + ) { + fss->scnSpaceCount++; + } + + /* next token */ + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; + p++; + continue; + } + break; + case ' ': + cp = strchr(ScnSpecTokenMapIndex, *p); + if (!cp || *cp == '\0') { + p--; + goto word_tok; + } + tok->map = &ScnSpecTokenMap[cp - ScnSpecTokenMapIndex]; + /* increase space count used in format */ + fss->scnSpaceCount++; + /* next token */ + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; + p++; + continue; + break; + default: +word_tok: + if (1) { + ClockScanToken *wordTok = tok; + if (tok > fss->scnTok && (tok-1)->map == &ScnWordTokenMap) { + wordTok = tok-1; + } + /* new word token */ + if (wordTok == tok) { + wordTok->tokWord.start = p; + wordTok->map = &ScnWordTokenMap; + AllocTokenInChain(tok, fss->scnTok, fss->scnTokC); tokCnt++; + } + if (isspace(UCHAR(*p))) { + fss->scnSpaceCount++; + } + p = TclUtfNext(p); + wordTok->tokWord.end = p; + } + break; + } + } + + /* calculate end distance value for each tokens */ + if (tok > fss->scnTok) { + unsigned int endDist = 0; + ClockScanToken *prevTok = tok-1; + + while (prevTok >= fss->scnTok) { + prevTok->endDistance = endDist; + if (prevTok->map->type != CTOKT_WORD) { + endDist += prevTok->map->minSize; + } else { + endDist += prevTok->tokWord.end - prevTok->tokWord.start; + } + prevTok--; + } + } + + /* correct count of real used tokens and free mem if desired + * (1 is acceptable delta to prevent memory fragmentation) */ + if (fss->scnTokC > tokCnt + (CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE / 2)) { + if ( (tok = ckrealloc(fss->scnTok, tokCnt * sizeof(*tok))) != NULL ) { + fss->scnTok = tok; + } + } + fss->scnTokC = tokCnt; + +done: + Tcl_MutexUnlock(&ClockFmtMutex); + } + + return fss; +} + +/* + *---------------------------------------------------------------------- + */ +int +ClockScan( + register DateInfo *info, /* Date fields used for parsing & converting */ + Tcl_Obj *strObj, /* String containing the time to scan */ + ClockFmtScnCmdArgs *opts) /* Command options */ +{ + ClockClientData *dataPtr = opts->clientData; + ClockFmtScnStorage *fss; + ClockScanToken *tok; + ClockScanTokenMap *map; + register const char *p, *x, *end; + unsigned short int flags = 0; + int ret = TCL_ERROR; + + /* get localized format */ + if (ClockLocalizeFormat(opts) == NULL) { + return TCL_ERROR; + } + + if ( !(fss = ClockGetOrParseScanFormat(opts->interp, opts->formatObj)) + || !(tok = fss->scnTok) + ) { + return TCL_ERROR; + } + + /* prepare parsing */ + + yyMeridian = MER24; + + p = TclGetString(strObj); + end = p + strObj->length; + /* in strict mode - bypass spaces at begin / end only (not between tokens) */ + if (opts->flags & CLF_STRICT) { + while (p < end && isspace(UCHAR(*p))) { + p++; + } + } + yyInput = p; + /* look ahead to count spaces (bypass it by count length and distances) */ + x = end; + while (p < end) { + if (isspace(UCHAR(*p))) { + x = p++; + yySpaceCount++; + continue; + } + x = end; + p++; + } + /* ignore spaces at end */ + yySpaceCount -= (end - x); + end = x; + /* ignore mandatory spaces used in format */ + yySpaceCount -= fss->scnSpaceCount; + if (yySpaceCount < 0) { + yySpaceCount = 0; + } + info->dateStart = p = yyInput; + info->dateEnd = end; + + /* parse string */ + for (; tok->map != NULL; tok++) { + map = tok->map; + /* bypass spaces at begin of input before parsing each token */ + if ( !(opts->flags & CLF_STRICT) + && ( map->type != CTOKT_SPACE + && map->type != CTOKT_WORD + && map->type != CTOKT_CHAR ) + ) { + while (p < end && isspace(UCHAR(*p))) { + yySpaceCount--; + p++; + } + } + yyInput = p; + /* end of input string */ + if (p >= end) { + break; + } + switch (map->type) + { + case CTOKT_DIGIT: + if (1) { + int minLen, size; + int sign = 1; + if (map->flags & CLF_SIGNED) { + if (*p == '+') { yyInput = ++p; } + else + if (*p == '-') { yyInput = ++p; sign = -1; }; + } + + DetermineGreedySearchLen(opts, info, tok, &minLen, &size); + + if (size < map->minSize) { + /* missing input -> error */ + if ((map->flags & CLF_OPTIONAL)) { + continue; + } + goto not_match; + } + /* string 2 number, put number into info structure by offset */ + if (map->offs) { + p = yyInput; x = p + size; + if (!(map->flags & (CLF_LOCALSEC|CLF_POSIXSEC))) { + if (_str2int((int *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; + } else { + if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), + p, x, sign) != TCL_OK) { + goto overflow; + } + p = x; + } + flags = (flags & ~map->clearFlags) | map->flags; + } + } + break; + case CTOKT_PARSER: + switch (map->parser(opts, info, tok)) { + case TCL_OK: + break; + case TCL_RETURN: + if ((map->flags & CLF_OPTIONAL)) { + yyInput = p; + continue; + } + goto not_match; + break; + default: + goto done; + break; + }; + /* decrement count for possible spaces in match */ + while (p < yyInput) { + if (isspace(UCHAR(*p++))) { + yySpaceCount--; + } + } + p = yyInput; + flags = (flags & ~map->clearFlags) | map->flags; + break; + case CTOKT_SPACE: + /* at least one space */ + if (!isspace(UCHAR(*p))) { + /* unmatched -> error */ + goto not_match; + } + yySpaceCount--; + p++; + while (p < end && isspace(UCHAR(*p))) { + yySpaceCount--; + p++; + } + break; + case CTOKT_WORD: + x = FindWordEnd(tok, p, end); + if (!x) { + /* no match -> error */ + goto not_match; + } + p = x; + break; + case CTOKT_CHAR: + x = (char *)map->data; + if (*x != *p) { + /* no match -> error */ + goto not_match; + } + if (isspace(UCHAR(*x))) { + yySpaceCount--; + } + p++; + break; + } + } + /* check end was reached */ + if (p < end) { + /* something after last token - wrong format */ + goto not_match; + } + /* end of string, check only optional tokens at end, otherwise - not match */ + while (tok->map != NULL) { + if (!(opts->flags & CLF_STRICT) && (tok->map->type == CTOKT_SPACE)) { + tok++; + if (tok->map == NULL) break; + } + if (!(tok->map->flags & CLF_OPTIONAL)) { + goto not_match; + } + tok++; + } + + /* + * Invalidate result + */ + + /* seconds token (%s) take precedence over all other tokens */ + if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_POSIXSEC)) { + if (flags & CLF_DATE) { + + if (!(flags & CLF_JULIANDAY)) { + info->flags |= CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY; + + /* dd precedence below ddd */ + switch (flags & (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH)) { + case (CLF_DAYOFYEAR|CLF_DAYOFMONTH): + /* miss month: ddd over dd (without month) */ + flags &= ~CLF_DAYOFMONTH; + case (CLF_DAYOFYEAR): + /* ddd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + break; + case (CLF_MONTH|CLF_DAYOFYEAR|CLF_DAYOFMONTH): + /* both available: mmdd over ddd */ + flags &= ~CLF_DAYOFYEAR; + case (CLF_MONTH|CLF_DAYOFMONTH): + case (CLF_DAYOFMONTH): + /* mmdd / dd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + break; + } + + /* YearWeekDay below YearMonthDay */ + if ( (flags & CLF_ISO8601) + && ( (flags & (CLF_YEAR|CLF_DAYOFYEAR)) == (CLF_YEAR|CLF_DAYOFYEAR) + || (flags & (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH)) == (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH) + ) + ) { + /* yy precedence below yyyy */ + if (!(flags & CLF_ISO8601CENTURY) && (flags & CLF_CENTURY)) { + /* normally precedence of ISO is higher, but no century - so put it down */ + flags &= ~CLF_ISO8601; + } + else + /* yymmdd or yyddd over naked weekday */ + if (!(flags & CLF_ISO8601YEAR)) { + flags &= ~CLF_ISO8601; + } + } + + if (!(flags & CLF_ISO8601)) { + if (yyYear < 100) { + if (!(flags & CLF_CENTURY)) { + if (yyYear >= dataPtr->yearOfCenturySwitch) { + yyYear -= 100; + } + yyYear += dataPtr->currentYearCentury; + } else { + yyYear += info->dateCentury * 100; + } + } + } else { + if (info->date.iso8601Year < 100) { + if (!(flags & CLF_ISO8601CENTURY)) { + if (info->date.iso8601Year >= dataPtr->yearOfCenturySwitch) { + info->date.iso8601Year -= 100; + } + info->date.iso8601Year += dataPtr->currentYearCentury; + } else { + info->date.iso8601Year += info->dateCentury * 100; + } + } + } + } + } + + /* if no time - reset time */ + if (!(flags & (CLF_TIME|CLF_LOCALSEC|CLF_POSIXSEC))) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yydate.localSeconds = 0; + } + + if (flags & CLF_TIME) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yySeconds = ToSeconds(yyHour, yyMinutes, + yySeconds, yyMeridian); + } else + if (!(flags & (CLF_LOCALSEC|CLF_POSIXSEC))) { + info->flags |= CLF_ASSEMBLE_SECONDS; + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; + } + } + + /* tell caller which flags were set */ + info->flags |= flags; + + ret = TCL_OK; + goto done; + +overflow: + + Tcl_SetResult(opts->interp, "requested date too large to represent", + TCL_STATIC); + Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL); + goto done; + +not_match: + + Tcl_SetResult(opts->interp, "input string does not match supplied format", + TCL_STATIC); + Tcl_SetErrorCode(opts->interp, "CLOCK", "badInputString", NULL); + +done: + + return ret; +} + +static inline int +FrmResultAllocate( + register DateFormat *dateFmt, + int len) +{ + int needed = dateFmt->output + len - dateFmt->resEnd; + if (needed >= 0) { /* >= 0 - regards NTS zero */ + int newsize = dateFmt->resEnd - dateFmt->resMem + + needed + MIN_FMT_RESULT_BLOCK_ALLOC; + char *newRes = ckrealloc(dateFmt->resMem, newsize); + if (newRes == NULL) { + return TCL_ERROR; + } + dateFmt->output = newRes + (dateFmt->output - dateFmt->resMem); + dateFmt->resMem = newRes; + dateFmt->resEnd = newRes + newsize; + } + return TCL_OK; +} + +static int +ClockFmtToken_HourAMPM_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + *val = ( ( ( *val % SECONDS_PER_DAY ) + SECONDS_PER_DAY - 3600 ) / 3600 ) % 12 + 1; + return TCL_OK; +} + +static int +ClockFmtToken_AMPM_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + Tcl_Obj *mcObj; + const char *s; + int len; + + if ((*val % SECONDS_PER_DAY) < (SECONDS_PER_DAY / 2)) { + mcObj = ClockMCGet(opts, MCLIT_AM); + } else { + mcObj = ClockMCGet(opts, MCLIT_PM); + } + if (mcObj == NULL) { + return TCL_ERROR; + } + s = TclGetString(mcObj); len = mcObj->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + if (*tok->tokWord.start == 'p') { + len = Tcl_UtfToUpper(dateFmt->output); + } + dateFmt->output += len; + + return TCL_OK; +} + +static int +ClockFmtToken_StarDate_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) + { + int fractYear; + /* Get day of year, zero based */ + int doy = dateFmt->date.dayOfYear - 1; + + /* Convert day of year to a fractional year */ + if (IsGregorianLeapYear(&dateFmt->date)) { + fractYear = 1000 * doy / 366; + } else { + fractYear = 1000 * doy / 365; + } + + /* Put together the StarDate as "Stardate %02d%03d.%1d" */ + if (FrmResultAllocate(dateFmt, 30) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, "Stardate ", 9); + dateFmt->output += 9; + dateFmt->output = _itoaw(dateFmt->output, + dateFmt->date.year - RODDENBERRY, '0', 2); + dateFmt->output = _itoaw(dateFmt->output, + fractYear, '0', 3); + *dateFmt->output++ = '.'; + dateFmt->output = _itoaw(dateFmt->output, + dateFmt->date.localSeconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); + + return TCL_OK; +} +static int +ClockFmtToken_WeekOfYear_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + int dow = dateFmt->date.dayOfWeek; + if (*tok->tokWord.start == 'U') { + if (dow == 7) { + dow = 0; + } + dow++; + } + *val = ( dateFmt->date.dayOfYear - dow + 7 ) / 7; + return TCL_OK; +} +static int +ClockFmtToken_TimeZone_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + if (*tok->tokWord.start == 'z') { + int z = dateFmt->date.tzOffset; + char sign = '+'; + if ( z < 0 ) { + z = -z; + sign = '-'; + } + if (FrmResultAllocate(dateFmt, 7) != TCL_OK) { return TCL_ERROR; }; + *dateFmt->output++ = sign; + dateFmt->output = _itoaw(dateFmt->output, z / 3600, '0', 2); + z %= 3600; + dateFmt->output = _itoaw(dateFmt->output, z / 60, '0', 2); + z %= 60; + if (z != 0) { + dateFmt->output = _itoaw(dateFmt->output, z, '0', 2); + } + } else { + Tcl_Obj * objPtr; + const char *s; int len; + /* convert seconds to local seconds to obtain tzName object */ + if (ConvertUTCToLocal(opts->clientData, opts->interp, + &dateFmt->date, opts->timezoneObj, + GREGORIAN_CHANGE_DATE) != TCL_OK) { + return TCL_ERROR; + }; + objPtr = dateFmt->date.tzName; + s = TclGetString(objPtr); + len = objPtr->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + dateFmt->output += len; + } + return TCL_OK; +} + +static int +ClockFmtToken_LocaleERA_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + Tcl_Obj *mcObj; + const char *s; + int len; + + if (dateFmt->date.era == BCE) { + mcObj = ClockMCGet(opts, MCLIT_BCE); + } else { + mcObj = ClockMCGet(opts, MCLIT_CE); + } + if (mcObj == NULL) { + return TCL_ERROR; + } + s = TclGetString(mcObj); len = mcObj->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + dateFmt->output += len; + + return TCL_OK; +} + +static int +ClockFmtToken_LocaleERAYear_Proc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val) +{ + int rowc; + Tcl_Obj **rowv; + + if (dateFmt->localeEra == NULL) { + Tcl_Obj *mcObj = ClockMCGet(opts, MCLIT_LOCALE_ERAS); + if (mcObj == NULL) { + return TCL_ERROR; + } + if (TclListObjGetElements(opts->interp, mcObj, &rowc, &rowv) != TCL_OK) { + return TCL_ERROR; + } + if (rowc != 0) { + dateFmt->localeEra = LookupLastTransition(opts->interp, + dateFmt->date.localSeconds, rowc, rowv, NULL); + } + if (dateFmt->localeEra == NULL) { + dateFmt->localeEra = (Tcl_Obj*)1; + } + } + + /* if no LOCALE_ERAS in catalog or era not found */ + if (dateFmt->localeEra == (Tcl_Obj*)1) { + if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { return TCL_ERROR; }; + if (*tok->tokWord.start == 'C') { /* %EC */ + *val = dateFmt->date.year / 100; + dateFmt->output = _itoaw(dateFmt->output, + *val, '0', 2); + } else { /* %Ey */ + *val = dateFmt->date.year % 100; + dateFmt->output = _itoaw(dateFmt->output, + *val, '0', 2); + } + } else { + Tcl_Obj *objPtr; + const char *s; + int len; + if (*tok->tokWord.start == 'C') { /* %EC */ + if (Tcl_ListObjIndex(opts->interp, dateFmt->localeEra, 1, + &objPtr) != TCL_OK ) { + return TCL_ERROR; + } + } else { /* %Ey */ + if (Tcl_ListObjIndex(opts->interp, dateFmt->localeEra, 2, + &objPtr) != TCL_OK ) { + return TCL_ERROR; + } + if (Tcl_GetIntFromObj(opts->interp, objPtr, val) != TCL_OK) { + return TCL_ERROR; + } + *val = dateFmt->date.year - *val; + /* if year in locale numerals */ + if (*val >= 0 && *val < 100) { + /* year as integer */ + Tcl_Obj * mcObj = ClockMCGet(opts, MCLIT_LOCALE_NUMERALS); + if (mcObj == NULL) { + return TCL_ERROR; + } + if (Tcl_ListObjIndex(opts->interp, mcObj, *val, &objPtr) != TCL_OK) { + return TCL_ERROR; + } + } else { + /* year as integer */ + if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { return TCL_ERROR; }; + dateFmt->output = _itoaw(dateFmt->output, + *val, '0', 2); + return TCL_OK; + } + } + s = TclGetString(objPtr); + len = objPtr->length; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { return TCL_ERROR; }; + memcpy(dateFmt->output, s, len + 1); + dateFmt->output += len; + } + return TCL_OK; +} + + +static const char *FmtSTokenMapIndex = + "demNbByYCHMSIklpaAuwUVzgGjJsntQ"; +static ClockFormatTokenMap FmtSTokenMap[] = { + /* %d */ + {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, + /* %e */ + {CFMTT_INT, " ", 2, 0, 0, 0, TclOffset(DateFormat, date.dayOfMonth), NULL}, + /* %m */ + {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, + /* %N */ + {CFMTT_INT, " ", 2, 0, 0, 0, TclOffset(DateFormat, date.month), NULL}, + /* %b %h */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), + NULL, (void *)MCLIT_MONTHS_ABBREV}, + /* %B */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX | CLFMT_DECR, 0, 12, TclOffset(DateFormat, date.month), + NULL, (void *)MCLIT_MONTHS_FULL}, + /* %y */ + {CFMTT_INT, "0", 2, 0, 0, 100, TclOffset(DateFormat, date.year), NULL}, + /* %Y */ + {CFMTT_INT, "0", 4, 0, 0, 0, TclOffset(DateFormat, date.year), NULL}, + /* %C */ + {CFMTT_INT, "0", 2, 0, 100, 0, TclOffset(DateFormat, date.year), NULL}, + /* %H */ + {CFMTT_INT, "0", 2, 0, 3600, 24, TclOffset(DateFormat, date.secondOfDay), NULL}, + /* %M */ + {CFMTT_INT, "0", 2, 0, 60, 60, TclOffset(DateFormat, date.secondOfDay), NULL}, + /* %S */ + {CFMTT_INT, "0", 2, 0, 0, 60, TclOffset(DateFormat, date.secondOfDay), NULL}, + /* %I */ + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), + ClockFmtToken_HourAMPM_Proc, NULL}, + /* %k */ + {CFMTT_INT, " ", 2, 0, 3600, 24, TclOffset(DateFormat, date.secondOfDay), NULL}, + /* %l */ + {CFMTT_INT, " ", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), + ClockFmtToken_HourAMPM_Proc, NULL}, + /* %p %P */ + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.secondOfDay), + ClockFmtToken_AMPM_Proc, NULL}, + /* %a */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_DAYS_OF_WEEK_ABBREV}, + /* %A */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_DAYS_OF_WEEK_FULL}, + /* %u */ + {CFMTT_INT, " ", 1, 0, 0, 0, TclOffset(DateFormat, date.dayOfWeek), NULL}, + /* %w */ + {CFMTT_INT, " ", 1, 0, 0, 7, TclOffset(DateFormat, date.dayOfWeek), NULL}, + /* %U %W */ + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.dayOfYear), + ClockFmtToken_WeekOfYear_Proc, NULL}, + /* %V */ + {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.iso8601Week), NULL}, + /* %z %Z */ + {CFMTT_INT, NULL, 0, 0, 0, 0, 0, + ClockFmtToken_TimeZone_Proc, NULL}, + /* %g */ + {CFMTT_INT, "0", 2, 0, 0, 100, TclOffset(DateFormat, date.iso8601Year), NULL}, + /* %G */ + {CFMTT_INT, "0", 4, 0, 0, 0, TclOffset(DateFormat, date.iso8601Year), NULL}, + /* %j */ + {CFMTT_INT, "0", 3, 0, 0, 0, TclOffset(DateFormat, date.dayOfYear), NULL}, + /* %J */ + {CFMTT_INT, "0", 7, 0, 0, 0, TclOffset(DateFormat, date.julianDay), NULL}, + /* %s */ + {CFMTT_WIDE, "0", 1, 0, 0, 0, TclOffset(DateFormat, date.seconds), NULL}, + /* %n */ + {CTOKT_CHAR, "\n", 0, 0, 0, 0, 0, NULL}, + /* %t */ + {CTOKT_CHAR, "\t", 0, 0, 0, 0, 0, NULL}, + /* %Q */ + {CFMTT_INT, NULL, 0, 0, 0, 0, 0, + ClockFmtToken_StarDate_Proc, NULL}, +}; +static const char *FmtSTokenMapAliasIndex[2] = { + "hPWZ", + "bpUz" +}; + +static const char *FmtETokenMapIndex = + "Eys"; +static ClockFormatTokenMap FmtETokenMap[] = { + /* %EE */ + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.era), + ClockFmtToken_LocaleERA_Proc, NULL}, + /* %Ey %EC */ + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.year), + ClockFmtToken_LocaleERAYear_Proc, NULL}, + /* %Es */ + {CFMTT_WIDE, "0", 1, 0, 0, 0, TclOffset(DateFormat, date.localSeconds), NULL}, +}; +static const char *FmtETokenMapAliasIndex[2] = { + "C", + "y" +}; + +static const char *FmtOTokenMapIndex = + "dmyHIMSuw"; +static ClockFormatTokenMap FmtOTokenMap[] = { + /* %Od %Oe */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.dayOfMonth), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Om */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.month), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Oy */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.year), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OH %Ok */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 3600, 24, TclOffset(DateFormat, date.secondOfDay), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OI %Ol */ + {CFMTT_INT, NULL, 0, CLFMT_CALC | CLFMT_LOCALE_INDX, 0, 0, TclOffset(DateFormat, date.secondOfDay), + ClockFmtToken_HourAMPM_Proc, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OM */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 60, 60, TclOffset(DateFormat, date.secondOfDay), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %OS */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 60, TclOffset(DateFormat, date.secondOfDay), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ou */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, + /* %Ow */ + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + NULL, (void *)MCLIT_LOCALE_NUMERALS}, +}; +static const char *FmtOTokenMapAliasIndex[2] = { + "ekl", + "dHI" +}; + +static ClockFormatTokenMap FmtWordTokenMap = { + CTOKT_WORD, NULL, 0, 0, 0, 0, 0, NULL +}; + +/* + *---------------------------------------------------------------------- + */ +ClockFmtScnStorage * +ClockGetOrParseFmtFormat( + Tcl_Interp *interp, /* Tcl interpreter */ + Tcl_Obj *formatObj) /* Format container */ +{ + ClockFmtScnStorage *fss; + ClockFormatToken *tok; + + fss = Tcl_GetClockFrmScnFromObj(interp, formatObj); + if (fss == NULL) { + return NULL; + } + + /* if first time scanning - tokenize format */ + if (fss->fmtTok == NULL) { + unsigned int tokCnt; + register const char *p, *e, *cp; + + e = p = HashEntry4FmtScn(fss)->key.string; + e += strlen(p); + + /* estimate token count by % char and format length */ + fss->fmtTokC = EstimateTokenCount(p, e); + + Tcl_MutexLock(&ClockFmtMutex); + + fss->fmtTok = tok = ckalloc(sizeof(*tok) * fss->fmtTokC); + memset(tok, 0, sizeof(*(tok))); + tokCnt = 1; + while (p < e) { + switch (*p) { + case '%': + if (1) { + ClockFormatTokenMap * fmtMap = FmtSTokenMap; + const char *mapIndex = FmtSTokenMapIndex, + **aliasIndex = FmtSTokenMapAliasIndex; + if (p+1 >= e) { + goto word_tok; + } + p++; + /* try to find modifier: */ + switch (*p) { + case '%': + /* begin new word token - don't join with previous word token, + * because current mapping should be "...%%..." -> "...%..." */ + tok->map = &FmtWordTokenMap; + tok->tokWord.start = p; + tok->tokWord.end = p+1; + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); tokCnt++; + p++; + continue; + break; + case 'E': + fmtMap = FmtETokenMap, + mapIndex = FmtETokenMapIndex, + aliasIndex = FmtETokenMapAliasIndex; + p++; + break; + case 'O': + fmtMap = FmtOTokenMap, + mapIndex = FmtOTokenMapIndex, + aliasIndex = FmtOTokenMapAliasIndex; + p++; + break; + } + /* search direct index */ + cp = strchr(mapIndex, *p); + if (!cp || *cp == '\0') { + /* search wrapper index (multiple chars for same token) */ + cp = strchr(aliasIndex[0], *p); + if (!cp || *cp == '\0') { + p--; if (fmtMap != FmtSTokenMap) p--; + goto word_tok; + } + cp = strchr(mapIndex, aliasIndex[1][cp - aliasIndex[0]]); + if (!cp || *cp == '\0') { /* unexpected, but ... */ + #ifdef DEBUG + Tcl_Panic("token \"%c\" has no map in wrapper resolver", *p); + #endif + p--; if (fmtMap != FmtSTokenMap) p--; + goto word_tok; + } + } + tok->map = &fmtMap[cp - mapIndex]; + tok->tokWord.start = p; + /* next token */ + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); tokCnt++; + p++; + continue; + } + break; + default: +word_tok: + if (1) { + ClockFormatToken *wordTok = tok; + if (tok > fss->fmtTok && (tok-1)->map == &FmtWordTokenMap) { + wordTok = tok-1; + } + if (wordTok == tok) { + wordTok->tokWord.start = p; + wordTok->map = &FmtWordTokenMap; + AllocTokenInChain(tok, fss->fmtTok, fss->fmtTokC); tokCnt++; + } + p = TclUtfNext(p); + wordTok->tokWord.end = p; + } + break; + } + } + + /* correct count of real used tokens and free mem if desired + * (1 is acceptable delta to prevent memory fragmentation) */ + if (fss->fmtTokC > tokCnt + (CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE / 2)) { + if ( (tok = ckrealloc(fss->fmtTok, tokCnt * sizeof(*tok))) != NULL ) { + fss->fmtTok = tok; + } + } + fss->fmtTokC = tokCnt; + +done: + Tcl_MutexUnlock(&ClockFmtMutex); + } + + return fss; +} + +/* + *---------------------------------------------------------------------- + */ +int +ClockFormat( + register DateFormat *dateFmt, /* Date fields used for parsing & converting */ + ClockFmtScnCmdArgs *opts) /* Command options */ +{ + ClockFmtScnStorage *fss; + ClockFormatToken *tok; + ClockFormatTokenMap *map; + + /* get localized format */ + if (ClockLocalizeFormat(opts) == NULL) { + return TCL_ERROR; + } + + if ( !(fss = ClockGetOrParseFmtFormat(opts->interp, opts->formatObj)) + || !(tok = fss->fmtTok) + ) { + return TCL_ERROR; + } + + /* prepare formatting */ + dateFmt->date.secondOfDay = (int)(dateFmt->date.localSeconds % SECONDS_PER_DAY); + if (dateFmt->date.secondOfDay < 0) { + dateFmt->date.secondOfDay += SECONDS_PER_DAY; + } + + /* result container object */ + dateFmt->resMem = ckalloc(MIN_FMT_RESULT_BLOCK_ALLOC); + if (dateFmt->resMem == NULL) { + return TCL_ERROR; + } + dateFmt->output = dateFmt->resMem; + dateFmt->resEnd = dateFmt->resMem + MIN_FMT_RESULT_BLOCK_ALLOC; + *dateFmt->output = '\0'; + + /* do format each token */ + for (; tok->map != NULL; tok++) { + map = tok->map; + switch (map->type) + { + case CFMTT_INT: + if (1) { + int val = (int)*(int *)(((char *)dateFmt) + map->offs); + if (map->fmtproc == NULL) { + if (map->flags & CLFMT_DECR) { + val--; + } + if (map->flags & CLFMT_INCR) { + val++; + } + if (map->divider) { + val /= map->divider; + } + if (map->divmod) { + val %= map->divmod; + } + } else { + if (map->fmtproc(opts, dateFmt, tok, &val) != TCL_OK) { + goto done; + } + /* if not calculate only (output inside fmtproc) */ + if (!(map->flags & CLFMT_CALC)) { + continue; + } + } + if (!(map->flags & CLFMT_LOCALE_INDX)) { + if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { goto error; }; + if (map->width) { + dateFmt->output = _itoaw(dateFmt->output, val, *map->tostr, map->width); + } else { + dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + } + } else { + const char *s; + Tcl_Obj * mcObj = ClockMCGet(opts, PTR2INT(map->data) /* mcKey */); + if (mcObj == NULL) { + goto error; + } + if ( Tcl_ListObjIndex(opts->interp, mcObj, val, &mcObj) != TCL_OK + || mcObj == NULL + ) { + goto error; + } + s = TclGetString(mcObj); + if (FrmResultAllocate(dateFmt, mcObj->length) != TCL_OK) { goto error; }; + memcpy(dateFmt->output, s, mcObj->length + 1); + dateFmt->output += mcObj->length; + } + } + break; + case CFMTT_WIDE: + if (1) { + Tcl_WideInt val = *(Tcl_WideInt *)(((char *)dateFmt) + map->offs); + if (FrmResultAllocate(dateFmt, 21) != TCL_OK) { goto error; }; + if (map->width) { + dateFmt->output = _witoaw(dateFmt->output, val, *map->tostr, map->width); + } else { + dateFmt->output += sprintf(dateFmt->output, map->tostr, val); + } + } + break; + case CTOKT_CHAR: + if (FrmResultAllocate(dateFmt, 1) != TCL_OK) { goto error; }; + *dateFmt->output++ = *map->tostr; + break; + case CFMTT_PROC: + if (map->fmtproc(opts, dateFmt, tok, NULL) != TCL_OK) { + goto error; + }; + break; + case CTOKT_WORD: + if (1) { + int len = tok->tokWord.end - tok->tokWord.start; + if (FrmResultAllocate(dateFmt, len) != TCL_OK) { goto error; }; + if (len == 1) { + *dateFmt->output++ = *tok->tokWord.start; + } else { + memcpy(dateFmt->output, tok->tokWord.start, len); + dateFmt->output += len; + } + } + break; + } + } + + goto done; + +error: + + ckfree(dateFmt->resMem); + dateFmt->resMem = NULL; + +done: + + if (dateFmt->resMem) { + Tcl_Obj * result = Tcl_NewObj(); + result->length = dateFmt->output - dateFmt->resMem; + result->bytes = NULL; + result->bytes = ckrealloc(dateFmt->resMem, result->length+1); + if (result->bytes == NULL) { + result->bytes = dateFmt->resMem; + } + result->bytes[result->length] = '\0'; + Tcl_SetObjResult(opts->interp, result); + return TCL_OK; + } + + return TCL_ERROR; +} + + +MODULE_SCOPE void +ClockFrmScnClearCaches(void) +{ + Tcl_MutexLock(&ClockFmtMutex); + /* clear caches ... */ + Tcl_MutexUnlock(&ClockFmtMutex); +} + +static void +ClockFrmScnFinalize( + ClientData clientData) /* Not used. */ +{ + Tcl_MutexLock(&ClockFmtMutex); +#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + /* clear GC */ + ClockFmtScnStorage_GC.stackPtr = NULL; + ClockFmtScnStorage_GC.stackBound = NULL; + ClockFmtScnStorage_GC.count = 0; +#endif + if (initialized) { + Tcl_DeleteHashTable(&FmtScnHashTable); + initialized = 0; + } + Tcl_MutexUnlock(&ClockFmtMutex); + Tcl_MutexFinalize(&ClockFmtMutex); +} +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/generic/tclDate.h b/generic/tclDate.h new file mode 100644 index 0000000..e614f9d --- /dev/null +++ b/generic/tclDate.h @@ -0,0 +1,512 @@ +/* + * tclDate.h -- + * + * This header file handles common usage of clock primitives + * between tclDate.c (yacc), tclClock.c and tclClockFmt.c. + * + * Copyright (c) 2014 Serg G. Brester (aka sebres) + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCLCLOCK_H +#define _TCLCLOCK_H + +/* + * Constants + */ + +#define JULIAN_DAY_POSIX_EPOCH 2440588 +#define GREGORIAN_CHANGE_DATE 2361222 +#define SECONDS_PER_DAY 86400 +#define JULIAN_SEC_POSIX_EPOCH (((Tcl_WideInt) JULIAN_DAY_POSIX_EPOCH) \ + * SECONDS_PER_DAY) +#define FOUR_CENTURIES 146097 /* days */ +#define JDAY_1_JAN_1_CE_JULIAN 1721424 +#define JDAY_1_JAN_1_CE_GREGORIAN 1721426 +#define ONE_CENTURY_GREGORIAN 36524 /* days */ +#define FOUR_YEARS 1461 /* days */ +#define ONE_YEAR 365 /* days */ + +#define RODDENBERRY 1946 /* Another epoch (Hi, Jeff!) */ + + +#define CLF_OPTIONAL (1 << 0) /* token is non mandatory */ +#define CLF_POSIXSEC (1 << 1) +#define CLF_LOCALSEC (1 << 2) +#define CLF_JULIANDAY (1 << 3) +#define CLF_TIME (1 << 4) +#define CLF_CENTURY (1 << 6) +#define CLF_DAYOFMONTH (1 << 7) +#define CLF_DAYOFYEAR (1 << 8) +#define CLF_MONTH (1 << 9) +#define CLF_YEAR (1 << 10) +#define CLF_ISO8601YEAR (1 << 12) +#define CLF_ISO8601 (1 << 13) +#define CLF_ISO8601CENTURY (1 << 14) +#define CLF_SIGNED (1 << 15) +/* On demand (lazy) assemble flags */ +#define CLF_ASSEMBLE_DATE (1 << 28) /* assemble year, month, etc. using julianDay */ +#define CLF_ASSEMBLE_JULIANDAY (1 << 29) /* assemble julianDay using year, month, etc. */ +#define CLF_ASSEMBLE_SECONDS (1 << 30) /* assemble localSeconds (and seconds at end) */ + +#define CLF_DATE (CLF_JULIANDAY | CLF_DAYOFMONTH | CLF_DAYOFYEAR | \ + CLF_MONTH | CLF_YEAR | CLF_ISO8601YEAR | CLF_ISO8601) + +/* + * Enumeration of the string literals used in [clock] + */ + +typedef enum ClockLiteral { + LIT__NIL, + LIT__DEFAULT_FORMAT, + LIT_SYSTEM, LIT_CURRENT, LIT_C, + LIT_BCE, LIT_CE, + LIT_DAYOFMONTH, LIT_DAYOFWEEK, LIT_DAYOFYEAR, + LIT_ERA, LIT_GMT, LIT_GREGORIAN, + LIT_INTEGER_VALUE_TOO_LARGE, + LIT_ISO8601WEEK, LIT_ISO8601YEAR, + LIT_JULIANDAY, LIT_LOCALSECONDS, + LIT_MONTH, + LIT_SECONDS, LIT_TZNAME, LIT_TZOFFSET, + LIT_YEAR, + LIT_TZDATA, + LIT_GETSYSTEMTIMEZONE, + LIT_SETUPTIMEZONE, + LIT_MCGET, + LIT_GETSYSTEMLOCALE, LIT_GETCURRENTLOCALE, + LIT_LOCALIZE_FORMAT, + LIT__END +} ClockLiteral; + +#define CLOCK_LITERAL_ARRAY(litarr) static const char *const litarr[] = { \ + "", \ + "%a %b %d %H:%M:%S %Z %Y", \ + "system", "current", "C", \ + "BCE", "CE", \ + "dayOfMonth", "dayOfWeek", "dayOfYear", \ + "era", ":GMT", "gregorian", \ + "integer value too large to represent", \ + "iso8601Week", "iso8601Year", \ + "julianDay", "localSeconds", \ + "month", \ + "seconds", "tzName", "tzOffset", \ + "year", \ + "::tcl::clock::TZData", \ + "::tcl::clock::GetSystemTimeZone", \ + "::tcl::clock::SetupTimeZone", \ + "::tcl::clock::mcget", \ + "::tcl::clock::GetSystemLocale", "::tcl::clock::mclocale", \ + "::tcl::clock::LocalizeFormat" \ +} + +/* + * Enumeration of the msgcat literals used in [clock] + */ + +typedef enum ClockMsgCtLiteral { + MCLIT__NIL, /* placeholder */ + MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, MCLIT_MONTHS_COMB, + MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_DAYS_OF_WEEK_COMB, + MCLIT_AM, MCLIT_PM, + MCLIT_LOCALE_ERAS, + MCLIT_BCE, MCLIT_CE, + MCLIT_BCE2, MCLIT_CE2, + MCLIT_BCE3, MCLIT_CE3, + MCLIT_LOCALE_NUMERALS, + MCLIT__END +} ClockMsgCtLiteral; + +#define CLOCK_LOCALE_LITERAL_ARRAY(litarr, pref) static const char *const litarr[] = { \ + pref "", \ + pref "MONTHS_FULL", pref "MONTHS_ABBREV", pref "MONTHS_COMB", \ + pref "DAYS_OF_WEEK_FULL", pref "DAYS_OF_WEEK_ABBREV", pref "DAYS_OF_WEEK_COMB", \ + pref "AM", pref "PM", \ + pref "LOCALE_ERAS", \ + pref "BCE", pref "CE", \ + pref "b.c.e.", pref "c.e.", \ + pref "b.c.", pref "a.d.", \ + pref "LOCALE_NUMERALS", \ +} + +/* + * Structure containing the fields used in [clock format] and [clock scan] + */ + +typedef struct TclDateFields { + + /* Cacheable fields: */ + + Tcl_WideInt seconds; /* Time expressed in seconds from the Posix + * epoch */ + Tcl_WideInt localSeconds; /* Local time expressed in nominal seconds + * from the Posix epoch */ + int tzOffset; /* Time zone offset in seconds east of + * Greenwich */ + int julianDay; /* Julian Day Number in local time zone */ + enum {BCE=1, CE=0} era; /* Era */ + int gregorian; /* Flag == 1 if the date is Gregorian */ + int year; /* Year of the era */ + int dayOfYear; /* Day of the year (1 January == 1) */ + int month; /* Month number */ + int dayOfMonth; /* Day of the month */ + int iso8601Year; /* ISO8601 week-based year */ + int iso8601Week; /* ISO8601 week number */ + int dayOfWeek; /* Day of the week */ + int hour; /* Hours of day (in-between time only calculation) */ + int minutes; /* Minutes of day (in-between time only calculation) */ + int secondOfDay; /* Seconds of day (in-between time only calculation) */ + + /* Non cacheable fields: */ + + Tcl_Obj *tzName; /* Name (or corresponding DST-abbreviation) of the + * time zone, if set the refCount is incremented */ +} TclDateFields; + +#define ClockCacheableDateFieldsSize \ + TclOffset(TclDateFields, tzName) + +/* + * Structure contains return parsed fields. + */ + +typedef struct DateInfo { + const char *dateStart; + const char *dateInput; + const char *dateEnd; + + TclDateFields date; + + int flags; + + int dateHaveDate; + + int dateMeridian; + int dateHaveTime; + + int dateTimezone; + int dateDSTmode; + int dateHaveZone; + + int dateRelMonth; + int dateRelDay; + int dateRelSeconds; + int dateHaveRel; + + int dateMonthOrdinalIncr; + int dateMonthOrdinal; + int dateHaveOrdinalMonth; + + int dateDayOrdinal; + int dateDayNumber; + int dateHaveDay; + + int *dateRelPointer; + + int dateSpaceCount; + int dateDigitCount; + + int dateCentury; + + Tcl_Obj* messages; /* Error messages */ + const char* separatrix; /* String separating messages */ +} DateInfo; + +#define yydate (info->date) /* Date fields used for converting */ + +#define yyDay (info->date.dayOfMonth) +#define yyMonth (info->date.month) +#define yyYear (info->date.year) + +#define yyHour (info->date.hour) +#define yyMinutes (info->date.minutes) +#define yySeconds (info->date.secondOfDay) + +#define yyDSTmode (info->dateDSTmode) +#define yyDayOrdinal (info->dateDayOrdinal) +#define yyDayNumber (info->dateDayNumber) +#define yyMonthOrdinalIncr (info->dateMonthOrdinalIncr) +#define yyMonthOrdinal (info->dateMonthOrdinal) +#define yyHaveDate (info->dateHaveDate) +#define yyHaveDay (info->dateHaveDay) +#define yyHaveOrdinalMonth (info->dateHaveOrdinalMonth) +#define yyHaveRel (info->dateHaveRel) +#define yyHaveTime (info->dateHaveTime) +#define yyHaveZone (info->dateHaveZone) +#define yyTimezone (info->dateTimezone) +#define yyMeridian (info->dateMeridian) +#define yyRelMonth (info->dateRelMonth) +#define yyRelDay (info->dateRelDay) +#define yyRelSeconds (info->dateRelSeconds) +#define yyRelPointer (info->dateRelPointer) +#define yyInput (info->dateInput) +#define yyDigitCount (info->dateDigitCount) +#define yySpaceCount (info->dateSpaceCount) + +static inline void +ClockInitDateInfo(DateInfo *info) { + memset(info, 0, sizeof(DateInfo)); +} + +/* + * Structure containing the command arguments supplied to [clock format] and [clock scan] + */ + +#define CLF_EXTENDED (1 << 4) +#define CLF_STRICT (1 << 8) +#define CLF_LOCALE_USED (1 << 15) + +typedef struct ClockFmtScnCmdArgs { + ClientData clientData; /* Opaque pointer to literal pool, etc. */ + Tcl_Interp *interp; /* Tcl interpreter */ + + Tcl_Obj *formatObj; /* Format */ + Tcl_Obj *localeObj; /* Name of the locale where the time will be expressed. */ + Tcl_Obj *timezoneObj; /* Default time zone in which the time will be expressed */ + Tcl_Obj *baseObj; /* Base (scan and add) or clockValue (format) */ + int flags; /* Flags control scanning */ + + Tcl_Obj *mcDictObj; /* Current dictionary of tcl::clock package for given localeObj*/ +} ClockFmtScnCmdArgs; + +/* + * Structure containing the client data for [clock] + */ + +typedef struct ClockClientData { + size_t refCount; /* Number of live references. */ + Tcl_Obj **literals; /* Pool of object literals (common, locale independent). */ + Tcl_Obj **mcLiterals; /* Msgcat object literals with mc-keys for search with locale. */ + Tcl_Obj **mcLitIdxs; /* Msgcat object indices prefixed with _IDX_, + * used for quick dictionary search */ + + /* Cache for current clock parameters, imparted via "configure" */ + unsigned long LastTZEpoch; + int currentYearCentury; + int yearOfCenturySwitch; + Tcl_Obj *SystemTimeZone; + Tcl_Obj *SystemSetupTZData; + Tcl_Obj *GMTSetupTimeZone; + Tcl_Obj *GMTSetupTZData; + Tcl_Obj *AnySetupTimeZone; + Tcl_Obj *AnySetupTZData; + Tcl_Obj *LastUnnormSetupTimeZone; + Tcl_Obj *LastSetupTimeZone; + Tcl_Obj *LastSetupTZData; + + Tcl_Obj *CurrentLocale; + Tcl_Obj *CurrentLocaleDict; + Tcl_Obj *LastUnnormUsedLocale; + Tcl_Obj *LastUsedLocale; + Tcl_Obj *LastUsedLocaleDict; + + /* Cache for last base (last-second fast convert if base/tz not changed) */ + struct { + Tcl_Obj *timezoneObj; + TclDateFields Date; + } lastBase; + /* Las-period cache for fast UTC2Local conversion */ + struct { + /* keys */ + Tcl_Obj *timezoneObj; + int changeover; + Tcl_WideInt seconds; + Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ + /* values */ + int tzOffset; + Tcl_Obj *tzName; + } UTC2Local; + /* Las-period cache for fast Local2UTC conversion */ + struct { + /* keys */ + Tcl_Obj *timezoneObj; + int changeover; + Tcl_WideInt localSeconds; + Tcl_WideInt rangesVal[2]; /* Bounds for cached time zone offset */ + /* values */ + int tzOffset; + } Local2UTC; +} ClockClientData; + +#define ClockDefaultYearCentury 2000 +#define ClockDefaultCenturySwitch 38 + +/* + * Meridian: am, pm, or 24-hour style. + */ + +typedef enum _MERIDIAN { + MERam, MERpm, MER24 +} MERIDIAN; + +/* + * Clock scan and format facilities. + */ + +#define CLOCK_FMT_SCN_STORAGE_GC_SIZE 32 + +#define CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE 2 + +typedef struct ClockScanToken ClockScanToken; + + +typedef int ClockScanTokenProc( + ClockFmtScnCmdArgs *opts, + DateInfo *info, + ClockScanToken *tok); + + +typedef enum _CLCKTOK_TYPE { + CTOKT_DIGIT = 1, CTOKT_PARSER, CTOKT_SPACE, CTOKT_WORD, CTOKT_CHAR, + CFMTT_INT, CFMTT_WIDE, CFMTT_PROC +} CLCKTOK_TYPE; + +typedef struct ClockScanTokenMap { + unsigned short int type; + unsigned short int flags; + unsigned short int clearFlags; + unsigned short int minSize; + unsigned short int maxSize; + unsigned short int offs; + ClockScanTokenProc *parser; + void *data; +} ClockScanTokenMap; + +typedef struct ClockScanToken { + ClockScanTokenMap *map; + struct { + const char *start; + const char *end; + } tokWord; + unsigned short int endDistance; + unsigned short int lookAhMin; + unsigned short int lookAhMax; + unsigned short int lookAhTok; +} ClockScanToken; + + +#define MIN_FMT_RESULT_BLOCK_ALLOC 200 + +typedef struct DateFormat { + char *resMem; + char *resEnd; + char *output; + + TclDateFields date; + + Tcl_Obj *localeEra; +} DateFormat; + +#define CLFMT_INCR (1 << 3) +#define CLFMT_DECR (1 << 4) +#define CLFMT_CALC (1 << 5) +#define CLFMT_LOCALE_INDX (1 << 8) + +typedef struct ClockFormatToken ClockFormatToken; + +typedef int ClockFormatTokenProc( + ClockFmtScnCmdArgs *opts, + DateFormat *dateFmt, + ClockFormatToken *tok, + int *val); + +typedef struct ClockFormatTokenMap { + unsigned short int type; + const char *tostr; + unsigned short int width; + unsigned short int flags; + unsigned short int divider; + unsigned short int divmod; + unsigned short int offs; + ClockFormatTokenProc *fmtproc; + void *data; +} ClockFormatTokenMap; +typedef struct ClockFormatToken { + ClockFormatTokenMap *map; + struct { + const char *start; + const char *end; + } tokWord; +} ClockFormatToken; + + +typedef struct ClockFmtScnStorage ClockFmtScnStorage; + +typedef struct ClockFmtScnStorage { + int objRefCount; /* Reference count shared across threads */ + ClockScanToken *scnTok; + unsigned int scnTokC; + unsigned int scnSpaceCount; /* Count of mandatory spaces used in format */ + ClockFormatToken *fmtTok; + unsigned int fmtTokC; +#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 + ClockFmtScnStorage *nextPtr; + ClockFmtScnStorage *prevPtr; +#endif +#if 0 + +Tcl_HashEntry hashEntry /* ClockFmtScnStorage is a derivate of Tcl_HashEntry, + * stored by offset +sizeof(self) */ +#endif +} ClockFmtScnStorage; + +/* + * Prototypes of module functions. + */ + +MODULE_SCOPE int ToSeconds(int Hours, int Minutes, + int Seconds, MERIDIAN Meridian); +MODULE_SCOPE int IsGregorianLeapYear(TclDateFields *); +MODULE_SCOPE void + GetJulianDayFromEraYearWeekDay( + TclDateFields *fields, int changeover); +MODULE_SCOPE void + GetJulianDayFromEraYearMonthDay( + TclDateFields *fields, int changeover); +MODULE_SCOPE void + GetJulianDayFromEraYearDay( + TclDateFields *fields, int changeover); +MODULE_SCOPE int ConvertUTCToLocal(ClientData clientData, Tcl_Interp *, + TclDateFields *, Tcl_Obj *timezoneObj, int); +MODULE_SCOPE Tcl_Obj * + LookupLastTransition(Tcl_Interp *, Tcl_WideInt, + int, Tcl_Obj *const *, Tcl_WideInt rangesVal[2]); + +MODULE_SCOPE int TclClockFreeScan(Tcl_Interp *interp, DateInfo *info); + +/* tclClock.c module declarations */ + +MODULE_SCOPE Tcl_Obj * + ClockSetupTimeZone(ClientData clientData, + Tcl_Interp *interp, Tcl_Obj *timezoneObj); + +MODULE_SCOPE Tcl_Obj * + ClockMCDict(ClockFmtScnCmdArgs *opts); +MODULE_SCOPE Tcl_Obj * + ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); +MODULE_SCOPE Tcl_Obj * + ClockMCGetIdx(ClockFmtScnCmdArgs *opts, int mcKey); +MODULE_SCOPE int ClockMCSetIdx(ClockFmtScnCmdArgs *opts, int mcKey, + Tcl_Obj *valObj); + +/* tclClockFmt.c module declarations */ + +MODULE_SCOPE Tcl_Obj* + ClockFrmObjGetLocFmtKey(Tcl_Interp *interp, + Tcl_Obj *objPtr); + +MODULE_SCOPE ClockFmtScnStorage * + Tcl_GetClockFrmScnFromObj(Tcl_Interp *interp, + Tcl_Obj *objPtr); +MODULE_SCOPE Tcl_Obj * + ClockLocalizeFormat(ClockFmtScnCmdArgs *opts); + +MODULE_SCOPE int ClockScan(register DateInfo *info, + Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); + +MODULE_SCOPE int ClockFormat(register DateFormat *dateFmt, + ClockFmtScnCmdArgs *opts); + +MODULE_SCOPE void ClockFrmScnClearCaches(void); + +#endif /* _TCLCLOCK_H */ diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c new file mode 100644 index 0000000..d9b5da0 --- /dev/null +++ b/generic/tclStrIdxTree.c @@ -0,0 +1,520 @@ +/* + * tclStrIdxTree.c -- + * + * Contains the routines for managing string index tries in Tcl. + * + * This code is back-ported from the tclSE engine, by Serg G. Brester. + * + * Copyright (c) 2016 by Sergey G. Brester aka sebres. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * ----------------------------------------------------------------------- + * + * String index tries are prepaired structures used for fast greedy search of the string + * (index) by unique string prefix as key. + * + * Index tree build for two lists together can be explained in the following datagram + * + * Lists: + * + * {Januar Februar Maerz April Mai Juni Juli August September Oktober November Dezember} + * {Jnr Fbr Mrz Apr Mai Jni Jli Agt Spt Okt Nvb Dzb} + * + * Index-Tree: + * + * j -1 * ... + * anuar 0 * + * u -1 * a -1 + * ni 5 * pril 3 + * li 6 * ugust 7 + * n -1 * gt 7 + * r 0 * s 8 + * i 5 * eptember 8 + * li 6 * pt 8 + * f 1 * oktober 9 + * ebruar 1 * n 10 + * br 1 * ovember 10 + * m -1 * vb 10 + * a -1 * d 11 + * erz 2 * ezember 11 + * i 4 * zb 11 + * rz 2 * + * ... + * + * Thereby value -1 shows pure group items (corresponding ambigous matches). + * + * StrIdxTree's are very fast, so: + * build of above-mentioned tree takes about 10 microseconds. + * search of string index in this tree takes fewer as 0.1 microseconds. + * + */ + +#include "tclInt.h" +#include "tclStrIdxTree.h" + + +/* + *---------------------------------------------------------------------- + * + * TclStrIdxTreeSearch -- + * + * Find largest part of string "start" in indexed tree (case sensitive). + * + * Also used for building of string index tree. + * + * Results: + * Return position of UTF character in start after last equal character + * and found item (with parent). + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE const char* +TclStrIdxTreeSearch( + TclStrIdxTree **foundParent, /* Return value of found sub tree (used for tree build) */ + TclStrIdx **foundItem, /* Return value of found item */ + TclStrIdxTree *tree, /* Index tree will be browsed */ + const char *start, /* UTF string to find in tree */ + const char *end) /* End of string */ +{ + TclStrIdxTree *parent = tree, *prevParent = tree; + TclStrIdx *item = tree->firstPtr, *prevItem = NULL; + const char *s = start, *f, *cin, *cinf, *prevf; + int offs = 0; + + if (item == NULL) { + goto done; + } + + /* search in tree */ + do { + cinf = cin = TclGetString(item->key) + offs; + f = TclUtfFindEqualNCInLwr(s, end, cin, cin + item->length, &cinf); + /* if something was found */ + if (f > s) { + /* if whole string was found */ + if (f >= end) { + start = f; + goto done; + }; + /* set new offset and shift start string */ + offs += cinf - cin; + s = f; + /* if match item, go deeper as long as possible */ + if (offs >= item->length && item->childTree.firstPtr) { + /* save previuosly found item (if not ambigous) for + * possible fallback (few greedy match) */ + if (item->value != -1) { + prevf = f; + prevItem = item; + prevParent = parent; + } + parent = &item->childTree; + item = item->childTree.firstPtr; + continue; + } + /* no children - return this item and current chars found */ + start = f; + goto done; + } + + item = item->nextPtr; + + } while (item != NULL); + + /* fallback (few greedy match) not ambigous (has a value) */ + if (prevItem != NULL) { + item = prevItem; + parent = prevParent; + start = prevf; + } + +done: + + if (foundParent) + *foundParent = parent; + if (foundItem) + *foundItem = item; + return start; +} + +MODULE_SCOPE void +TclStrIdxTreeFree( + TclStrIdx *tree) +{ + while (tree != NULL) { + TclStrIdx *t; + Tcl_DecrRefCount(tree->key); + if (tree->childTree.firstPtr != NULL) { + TclStrIdxTreeFree(tree->childTree.firstPtr); + } + t = tree, tree = tree->nextPtr; + ckfree(t); + } +} + +/* + * Several bidirectional list primitives + */ +inline void +TclStrIdxTreeInsertBranch( + TclStrIdxTree *parent, + register TclStrIdx *item, + register TclStrIdx *child) +{ + if (parent->firstPtr == child) + parent->firstPtr = item; + if (parent->lastPtr == child) + parent->lastPtr = item; + if ( (item->nextPtr = child->nextPtr) ) { + item->nextPtr->prevPtr = item; + child->nextPtr = NULL; + } + if ( (item->prevPtr = child->prevPtr) ) { + item->prevPtr->nextPtr = item; + child->prevPtr = NULL; + } + item->childTree.firstPtr = child; + item->childTree.lastPtr = child; +} + +inline void +TclStrIdxTreeAppend( + register TclStrIdxTree *parent, + register TclStrIdx *item) +{ + if (parent->lastPtr != NULL) { + parent->lastPtr->nextPtr = item; + } + item->prevPtr = parent->lastPtr; + item->nextPtr = NULL; + parent->lastPtr = item; + if (parent->firstPtr == NULL) { + parent->firstPtr = item; + } +} + + +/* + *---------------------------------------------------------------------- + * + * TclStrIdxTreeBuildFromList -- + * + * Build or extend string indexed tree from tcl list. + * + * Important: by multiple lists, optimal tree can be created only if list with + * larger strings used firstly. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +MODULE_SCOPE int +TclStrIdxTreeBuildFromList( + TclStrIdxTree *idxTree, + int lstc, + Tcl_Obj **lstv) +{ + Tcl_Obj **lwrv; + int i, ret = TCL_ERROR; + const char *s, *e, *f; + TclStrIdx *item; + + /* create lowercase reflection of the list keys */ + + lwrv = ckalloc(sizeof(Tcl_Obj*) * lstc); + if (lwrv == NULL) { + return TCL_ERROR; + } + for (i = 0; i < lstc; i++) { + lwrv[i] = Tcl_DuplicateObj(lstv[i]); + if (lwrv[i] == NULL) { + return TCL_ERROR; + } + Tcl_IncrRefCount(lwrv[i]); + lwrv[i]->length = Tcl_UtfToLower(TclGetString(lwrv[i])); + } + + /* build index tree of the list keys */ + for (i = 0; i < lstc; i++) { + TclStrIdxTree *foundParent = idxTree; + e = s = TclGetString(lwrv[i]); + e += lwrv[i]->length; + + /* ignore empty values (impossible to index it) */ + if (lwrv[i]->length == 0) continue; + + item = NULL; + if (idxTree->firstPtr != NULL) { + TclStrIdx *foundItem; + f = TclStrIdxTreeSearch(&foundParent, &foundItem, + idxTree, s, e); + /* if common prefix was found */ + if (f > s) { + /* ignore element if fulfilled or ambigous */ + if (f == e) { + continue; + } + /* if shortest key was found with the same value, + * just replace its current key with longest key */ + if ( foundItem->value == i + && foundItem->length < lwrv[i]->length + && foundItem->childTree.firstPtr == NULL + ) { + Tcl_SetObjRef(foundItem->key, lwrv[i]); + foundItem->length = lwrv[i]->length; + continue; + } + /* split tree (e. g. j->(jan,jun) + jul == j->(jan,ju->(jun,jul)) ) + * but don't split by fulfilled child of found item ( ii->iii->iiii ) */ + if (foundItem->length != (f - s)) { + /* first split found item (insert one between parent and found + new one) */ + item = ckalloc(sizeof(*item)); + if (item == NULL) { + goto done; + } + Tcl_InitObjRef(item->key, foundItem->key); + item->length = f - s; + /* set value or mark as ambigous if not the same value of both */ + item->value = (foundItem->value == i) ? i : -1; + /* insert group item between foundParent and foundItem */ + TclStrIdxTreeInsertBranch(foundParent, item, foundItem); + foundParent = &item->childTree; + } else { + /* the new item should be added as child of found item */ + foundParent = &foundItem->childTree; + } + } + } + /* append item at end of found parent */ + item = ckalloc(sizeof(*item)); + if (item == NULL) { + goto done; + } + item->childTree.lastPtr = item->childTree.firstPtr = NULL; + Tcl_InitObjRef(item->key, lwrv[i]); + item->length = lwrv[i]->length; + item->value = i; + TclStrIdxTreeAppend(foundParent, item); + }; + + ret = TCL_OK; + +done: + + if (lwrv != NULL) { + for (i = 0; i < lstc; i++) { + Tcl_DecrRefCount(lwrv[i]); + } + ckfree(lwrv); + } + + if (ret != TCL_OK) { + if (idxTree->firstPtr != NULL) { + TclStrIdxTreeFree(idxTree->firstPtr); + } + } + + return ret; +} + + +static void +StrIdxTreeObj_DupIntRepProc(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); +static void +StrIdxTreeObj_FreeIntRepProc(Tcl_Obj *objPtr); +static void +StrIdxTreeObj_UpdateStringProc(Tcl_Obj *objPtr); + +Tcl_ObjType StrIdxTreeObjType = { + "str-idx-tree", /* name */ + StrIdxTreeObj_FreeIntRepProc, /* freeIntRepProc */ + StrIdxTreeObj_DupIntRepProc, /* dupIntRepProc */ + StrIdxTreeObj_UpdateStringProc, /* updateStringProc */ + NULL /* setFromAnyProc */ +}; + +MODULE_SCOPE Tcl_Obj* +TclStrIdxTreeNewObj() +{ + Tcl_Obj *objPtr = Tcl_NewObj(); + objPtr->internalRep.twoPtrValue.ptr1 = NULL; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; + objPtr->typePtr = &StrIdxTreeObjType; + /* return tree root in internal representation */ + return objPtr; +} + +static void +StrIdxTreeObj_DupIntRepProc(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) +{ + /* follow links (smart pointers) */ + if ( srcPtr->internalRep.twoPtrValue.ptr1 != NULL + && srcPtr->internalRep.twoPtrValue.ptr2 == NULL + ) { + srcPtr = (Tcl_Obj*)srcPtr->internalRep.twoPtrValue.ptr1; + } + /* create smart pointer to it (ptr1 != NULL, ptr2 = NULL) */ + Tcl_InitObjRef(*((Tcl_Obj **)©Ptr->internalRep.twoPtrValue.ptr1), + srcPtr); + copyPtr->internalRep.twoPtrValue.ptr2 = NULL; + copyPtr->typePtr = &StrIdxTreeObjType; +} + +static void +StrIdxTreeObj_FreeIntRepProc(Tcl_Obj *objPtr) +{ + /* follow links (smart pointers) */ + if ( objPtr->internalRep.twoPtrValue.ptr1 != NULL + && objPtr->internalRep.twoPtrValue.ptr2 == NULL + ) { + /* is a link */ + Tcl_UnsetObjRef(*((Tcl_Obj **)&objPtr->internalRep.twoPtrValue.ptr1)); + } else { + /* is a tree */ + TclStrIdxTree *tree = (TclStrIdxTree*)&objPtr->internalRep.twoPtrValue.ptr1; + if (tree->firstPtr != NULL) { + TclStrIdxTreeFree(tree->firstPtr); + } + objPtr->internalRep.twoPtrValue.ptr1 = NULL; + objPtr->internalRep.twoPtrValue.ptr2 = NULL; + } + objPtr->typePtr = NULL; +}; + +static void +StrIdxTreeObj_UpdateStringProc(Tcl_Obj *objPtr) +{ + /* currently only dummy empty string possible */ + objPtr->length = 0; + objPtr->bytes = &tclEmptyString; +}; + +MODULE_SCOPE TclStrIdxTree * +TclStrIdxTreeGetFromObj(Tcl_Obj *objPtr) { + /* follow links (smart pointers) */ + if (objPtr->typePtr != &StrIdxTreeObjType) { + return NULL; + } + if ( objPtr->internalRep.twoPtrValue.ptr1 != NULL + && objPtr->internalRep.twoPtrValue.ptr2 == NULL + ) { + objPtr = (Tcl_Obj*)objPtr->internalRep.twoPtrValue.ptr1; + } + /* return tree root in internal representation */ + return (TclStrIdxTree*)&objPtr->internalRep.twoPtrValue.ptr1; +} + +/* + * Several debug primitives + */ +#if 0 +/* currently unused, debug resp. test purposes only */ + +void +TclStrIdxTreePrint( + Tcl_Interp *interp, + TclStrIdx *tree, + int offs) +{ + Tcl_Obj *obj[2]; + const char *s; + Tcl_InitObjRef(obj[0], Tcl_NewStringObj("::puts", -1)); + while (tree != NULL) { + s = TclGetString(tree->key) + offs; + Tcl_InitObjRef(obj[1], Tcl_ObjPrintf("%*s%.*s\t:%d", + offs, "", tree->length - offs, s, tree->value)); + Tcl_PutsObjCmd(NULL, interp, 2, obj); + Tcl_UnsetObjRef(obj[1]); + if (tree->childTree.firstPtr != NULL) { + TclStrIdxTreePrint(interp, tree->childTree.firstPtr, tree->length); + } + tree = tree->nextPtr; + } + Tcl_UnsetObjRef(obj[0]); +} + + +MODULE_SCOPE int +TclStrIdxTreeTestObjCmd( + ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + const char *cs, *cin, *ret; + + static const char *const options[] = { + "index", "puts-index", "findequal", + NULL + }; + enum optionInd { + O_INDEX, O_PUTS_INDEX, O_FINDEQUAL + }; + int optionIndex; + + if (objc < 2) { + Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + return TCL_ERROR; + } + if (Tcl_GetIndexFromObj(interp, objv[1], options, + "option", 0, &optionIndex) != TCL_OK) { + Tcl_SetErrorCode(interp, "CLOCK", "badOption", + Tcl_GetString(objv[1]), NULL); + return TCL_ERROR; + } + switch (optionIndex) { + case O_FINDEQUAL: + if (objc < 4) { + Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + return TCL_ERROR; + } + cs = TclGetString(objv[2]); + cin = TclGetString(objv[3]); + ret = TclUtfFindEqual( + cs, cs + objv[1]->length, cin, cin + objv[2]->length); + Tcl_SetObjResult(interp, Tcl_NewIntObj(ret - cs)); + break; + case O_INDEX: + case O_PUTS_INDEX: + + if (1) { + Tcl_Obj **lstv; + int i, lstc; + TclStrIdxTree idxTree = {NULL, NULL}; + i = 1; + while (++i < objc) { + if (TclListObjGetElements(interp, objv[i], + &lstc, &lstv) != TCL_OK) { + return TCL_ERROR; + }; + TclStrIdxTreeBuildFromList(&idxTree, lstc, lstv); + } + if (optionIndex == O_PUTS_INDEX) { + TclStrIdxTreePrint(interp, idxTree.firstPtr, 0); + } + TclStrIdxTreeFree(idxTree.firstPtr); + } + break; + } + + return TCL_OK; +} + +#endif + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h new file mode 100644 index 0000000..305053c --- /dev/null +++ b/generic/tclStrIdxTree.h @@ -0,0 +1,169 @@ +/* + * tclStrIdxTree.h -- + * + * Declarations of string index tries and other primitives currently + * back-ported from tclSE. + * + * Copyright (c) 2016 Serg G. Brester (aka sebres) + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#ifndef _TCLSTRIDXTREE_H +#define _TCLSTRIDXTREE_H + + +/* + * Main structures declarations of index tree and entry + */ + +typedef struct TclStrIdxTree { + struct TclStrIdx *firstPtr; + struct TclStrIdx *lastPtr; +} TclStrIdxTree; + +typedef struct TclStrIdx { + struct TclStrIdxTree childTree; + struct TclStrIdx *nextPtr; + struct TclStrIdx *prevPtr; + Tcl_Obj *key; + int length; + int value; +} TclStrIdx; + + +/* + *---------------------------------------------------------------------- + * + * TclUtfFindEqual, TclUtfFindEqualNC -- + * + * Find largest part of string cs in string cin (case sensitive and not). + * + * Results: + * Return position of UTF character in cs after last equal character. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static inline const char * +TclUtfFindEqual( + register const char *cs, /* UTF string to find in cin. */ + register const char *cse, /* End of cs */ + register const char *cin, /* UTF string will be browsed. */ + register const char *cine) /* End of cin */ +{ + register const char *ret = cs; + Tcl_UniChar ch1, ch2; + do { + cs += TclUtfToUniChar(cs, &ch1); + cin += TclUtfToUniChar(cin, &ch2); + if (ch1 != ch2) break; + } while ((ret = cs) < cse && cin < cine); + return ret; +} + +static inline const char * +TclUtfFindEqualNC( + register const char *cs, /* UTF string to find in cin. */ + register const char *cse, /* End of cs */ + register const char *cin, /* UTF string will be browsed. */ + register const char *cine, /* End of cin */ + const char **cinfnd) /* Return position in cin */ +{ + register const char *ret = cs; + Tcl_UniChar ch1, ch2; + do { + cs += TclUtfToUniChar(cs, &ch1); + cin += TclUtfToUniChar(cin, &ch2); + if (ch1 != ch2) { + ch1 = Tcl_UniCharToLower(ch1); + ch2 = Tcl_UniCharToLower(ch2); + if (ch1 != ch2) break; + } + *cinfnd = cin; + } while ((ret = cs) < cse && cin < cine); + return ret; +} + +static inline const char * +TclUtfFindEqualNCInLwr( + register const char *cs, /* UTF string (in anycase) to find in cin. */ + register const char *cse, /* End of cs */ + register const char *cin, /* UTF string (in lowercase) will be browsed. */ + register const char *cine, /* End of cin */ + const char **cinfnd) /* Return position in cin */ +{ + register const char *ret = cs; + Tcl_UniChar ch1, ch2; + do { + cs += TclUtfToUniChar(cs, &ch1); + cin += TclUtfToUniChar(cin, &ch2); + if (ch1 != ch2) { + ch1 = Tcl_UniCharToLower(ch1); + if (ch1 != ch2) break; + } + *cinfnd = cin; + } while ((ret = cs) < cse && cin < cine); + return ret; +} + +static inline const char * +TclUtfNext( + register const char *src) /* The current location in the string. */ +{ + if (((unsigned char) *(src)) < 0xC0) { + return ++src; + } else { + Tcl_UniChar ch; + return src + TclUtfToUniChar(src, &ch); + } +} + + +/* + * Primitives to safe set, reset and free references. + */ + +#define Tcl_UnsetObjRef(obj) \ + if (obj != NULL) { Tcl_DecrRefCount(obj); obj = NULL; } +#define Tcl_InitObjRef(obj, val) \ + obj = val; if (obj) { Tcl_IncrRefCount(obj); } +#define Tcl_SetObjRef(obj, val) \ +if (1) { \ + Tcl_Obj *nval = val; \ + if (obj != nval) { \ + Tcl_Obj *prev = obj; \ + Tcl_InitObjRef(obj, nval); \ + if (prev != NULL) { Tcl_DecrRefCount(prev); }; \ + } \ +} + +/* + * Prototypes of module functions. + */ + +MODULE_SCOPE const char* + TclStrIdxTreeSearch(TclStrIdxTree **foundParent, + TclStrIdx **foundItem, TclStrIdxTree *tree, + const char *start, const char *end); + +MODULE_SCOPE int TclStrIdxTreeBuildFromList(TclStrIdxTree *idxTree, + int lstc, Tcl_Obj **lstv); + +MODULE_SCOPE Tcl_Obj* + TclStrIdxTreeNewObj(); + +MODULE_SCOPE TclStrIdxTree* + TclStrIdxTreeGetFromObj(Tcl_Obj *objPtr); + +#if 1 + +MODULE_SCOPE int TclStrIdxTreeTestObjCmd(ClientData, Tcl_Interp *, + int, Tcl_Obj *const objv[]); +#endif + +#endif /* _TCLSTRIDXTREE_H */ diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl new file mode 100644 index 0000000..733db1a --- /dev/null +++ b/tests-perf/clock.perf.tcl @@ -0,0 +1,385 @@ +#!/usr/bin/tclsh +# ------------------------------------------------------------------------ +# +# test-performance.tcl -- +# +# This file provides common performance tests for comparison of tcl-speed +# degradation by switching between branches. +# (currently for clock ensemble only) +# +# ------------------------------------------------------------------------ +# +# Copyright (c) 2014 Serg G. Brester (aka sebres) +# +# See the file "license.terms" for information on usage and redistribution +# of this file. +# + + +## set testing defaults: +set ::env(TCL_TZ) :CET + +# warm-up interpeter compiler env, clock platform-related features, +# calibrate timerate measurement functionality: +puts -nonewline "Calibration ... "; flush stdout +puts "done: [lrange \ + [timerate -calibrate {}] \ +0 1]" + +## warm-up test-related features (load clock.tcl, system zones, locales, etc.): +clock scan "" -gmt 1 +clock scan "" +clock scan "" -timezone :CET +clock scan "" -format "" -locale en +clock scan "" -format "" -locale de + +## ------------------------------------------ + +proc {**STOP**} {args} { + return -code error -level 4 "**STOP** in [info level [expr {[info level]-2}]] [join $args { }]" +} + +proc _test_get_commands {lst} { + regsub -all {(?:^|\n)[ \t]*(\#[^\n]*|\msetup\M[^\n]*|\mcleanup\M[^\n]*)(?=\n\s*(?:[\{\#]|setup|cleanup))} $lst "\n{\\1}" +} + +proc _test_out_total {} { + upvar _ _ + + set tcnt [llength $_(itm)] + if {!$tcnt} { + puts "" + return + } + + set mintm 0x7fffffff + set maxtm 0 + set nett 0 + set wtm 0 + set wcnt 0 + set i 0 + foreach tm $_(itm) { + if {[llength $tm] > 6} { + set nett [expr {$nett + [lindex $tm 6]}] + } + set wtm [expr {$wtm + [lindex $tm 0]}] + set wcnt [expr {$wcnt + [lindex $tm 2]}] + set tm [lindex $tm 0] + if {$tm > $maxtm} {set maxtm $tm; set maxi $i} + if {$tm < $mintm} {set mintm $tm; set mini $i} + incr i + } + + puts [string repeat ** 40] + set s [format "%d cases in %.2f sec." $tcnt [expr {$tcnt * $_(reptime) / 1000.0}]] + if {$nett > 0} { + append s [format " (%.2f nett-sec.)" [expr {$nett / 1000.0}]] + } + puts "Total $s:" + lset _(m) 0 [format %.6f $wtm] + lset _(m) 2 $wcnt + lset _(m) 4 [format %.3f [expr {$wcnt / (($nett ? $nett : ($tcnt * $_(reptime))) / 1000.0)}]] + if {[llength $_(m)] > 6} { + lset _(m) 6 [format %.3f $nett] + } + puts $_(m) + puts "Average:" + lset _(m) 0 [format %.6f [expr {[lindex $_(m) 0] / $tcnt}]] + lset _(m) 2 [expr {[lindex $_(m) 2] / $tcnt}] + if {[llength $_(m)] > 6} { + lset _(m) 6 [format %.3f [expr {[lindex $_(m) 6] / $tcnt}]] + lset _(m) 4 [format %.0f [expr {[lindex $_(m) 2] / [lindex $_(m) 6] * 1000}]] + } + puts $_(m) + puts "Min:" + puts [lindex $_(itm) $mini] + puts "Max:" + puts [lindex $_(itm) $maxi] + puts [string repeat ** 40] + puts "" +} + +proc _test_run {reptime lst {outcmd {puts $_(r)}}} { + upvar _ _ + array set _ [list itm {} reptime $reptime] + + foreach _(c) [_test_get_commands $lst] { + puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" + if {[regexp {^\s*\#} $_(c)]} continue + if {[regexp {^\s*(?:setup|cleanup)\s+} $_(c)]} { + puts [if 1 [lindex $_(c) 1]] + continue + } + set _(r) [if 1 $_(c)] + if {$outcmd ne {}} $outcmd + puts [set _(m) [timerate $_(c) $reptime]] + lappend _(itm) $_(m) + puts "" + } + _test_out_total +} + +proc test-format {{reptime 1000}} { + _test_run $reptime { + # Format : short, week only (in gmt) + {clock format 1482525936 -format "%u" -gmt 1} + # Format : short, week only (system zone) + {clock format 1482525936 -format "%u"} + # Format : short, week only (CEST) + {clock format 1482525936 -format "%u" -timezone :CET} + # Format : date only (in gmt) + {clock format 1482525936 -format "%Y-%m-%d" -gmt 1} + # Format : date only (system zone) + {clock format 1482525936 -format "%Y-%m-%d"} + # Format : date only (CEST) + {clock format 1482525936 -format "%Y-%m-%d" -timezone :CET} + # Format : time only (in gmt) + {clock format 1482525936 -format "%H:%M" -gmt 1} + # Format : time only (system zone) + {clock format 1482525936 -format "%H:%M"} + # Format : time only (CEST) + {clock format 1482525936 -format "%H:%M" -timezone :CET} + # Format : time only (in gmt) + {clock format 1482525936 -format "%H:%M:%S" -gmt 1} + # Format : time only (system zone) + {clock format 1482525936 -format "%H:%M:%S"} + # Format : time only (CEST) + {clock format 1482525936 -format "%H:%M:%S" -timezone :CET} + # Format : default (in gmt) + {clock format 1482525936 -gmt 1 -locale en} + # Format : default (system zone) + {clock format 1482525936 -locale en} + # Format : default (CEST) + {clock format 1482525936 -timezone :CET -locale en} + # Format : ISO date-time (in gmt, numeric zone) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z" -gmt 1} + # Format : ISO date-time (system zone, CEST, numeric zone) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z"} + # Format : ISO date-time (CEST, numeric zone) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %z" -timezone :CET} + # Format : ISO date-time (system zone, CEST) + {clock format 1246379400 -format "%Y-%m-%dT%H:%M:%S %Z"} + # Format : julian day with time (in gmt): + {clock format 1246379415 -format "%J %H:%M:%S" -gmt 1} + # Format : julian day with time (system zone): + {clock format 1246379415 -format "%J %H:%M:%S"} + + # Format : locale date-time (en): + {clock format 1246379415 -format "%x %X" -locale en} + # Format : locale date-time (de): + {clock format 1246379415 -format "%x %X" -locale de} + + # Format : locale lookup table month: + {clock format 1246379400 -format "%b" -locale en -gmt 1} + # Format : locale lookup 2 tables - month and day: + {clock format 1246379400 -format "%b %Od" -locale en -gmt 1} + # Format : locale lookup 3 tables - week, month and day: + {clock format 1246379400 -format "%a %b %Od" -locale en -gmt 1} + # Format : locale lookup 4 tables - week, month, day and year: + {clock format 1246379400 -format "%a %b %Od %Oy" -locale en -gmt 1} + + # Format : dynamic clock value (without converter caches): + setup {set i 0} + {clock format [incr i] -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET} + cleanup {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET]} + # Format : dynamic clock value (without any converter caches, zone range overflow): + setup {set i 0} + {clock format [incr i 86400] -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET} + cleanup {puts [clock format $i -format "%Y-%m-%dT%H:%M:%S" -locale en -timezone :CET]} + + # Format : dynamic format (cacheable) + {clock format 1246379415 -format [string trim "%d.%m.%Y %H:%M:%S "] -gmt 1} + + # Format : all (in gmt, locale en) + {clock format 1482525936 -format "%%a = %a | %%A = %A | %%b = %b | %%h = %h | %%B = %B | %%C = %C | %%d = %d | %%e = %e | %%g = %g | %%G = %G | %%H = %H | %%I = %I | %%j = %j | %%J = %J | %%k = %k | %%l = %l | %%m = %m | %%M = %M | %%N = %N | %%p = %p | %%P = %P | %%Q = %Q | %%s = %s | %%S = %S | %%t = %t | %%u = %u | %%U = %U | %%V = %V | %%w = %w | %%W = %W | %%y = %y | %%Y = %Y | %%z = %z | %%Z = %Z | %%n = %n | %%EE = %EE | %%EC = %EC | %%Ey = %Ey | %%n = %n | %%Od = %Od | %%Oe = %Oe | %%OH = %OH | %%Ok = %Ok | %%OI = %OI | %%Ol = %Ol | %%Om = %Om | %%OM = %OM | %%OS = %OS | %%Ou = %Ou | %%Ow = %Ow | %%Oy = %Oy" -gmt 1 -locale en} + # Format : all (in CET, locale de) + {clock format 1482525936 -format "%%a = %a | %%A = %A | %%b = %b | %%h = %h | %%B = %B | %%C = %C | %%d = %d | %%e = %e | %%g = %g | %%G = %G | %%H = %H | %%I = %I | %%j = %j | %%J = %J | %%k = %k | %%l = %l | %%m = %m | %%M = %M | %%N = %N | %%p = %p | %%P = %P | %%Q = %Q | %%s = %s | %%S = %S | %%t = %t | %%u = %u | %%U = %U | %%V = %V | %%w = %w | %%W = %W | %%y = %y | %%Y = %Y | %%z = %z | %%Z = %Z | %%n = %n | %%EE = %EE | %%EC = %EC | %%Ey = %Ey | %%n = %n | %%Od = %Od | %%Oe = %Oe | %%OH = %OH | %%Ok = %Ok | %%OI = %OI | %%Ol = %Ol | %%Om = %Om | %%OM = %OM | %%OS = %OS | %%Ou = %Ou | %%Ow = %Ow | %%Oy = %Oy" -timezone :CET -locale de} + } +} + +proc test-scan {{reptime 1000}} { + _test_run $reptime { + # Scan : date (in gmt) + {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0 -gmt 1} + # Scan : date (system time zone, with base) + {clock scan "25.11.2015" -format "%d.%m.%Y" -base 0} + # Scan : date (system time zone, without base) + {clock scan "25.11.2015" -format "%d.%m.%Y"} + # Scan : greedy match + {clock scan "111" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1111" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "11111" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "111111" -format "%d%m%y" -base 0 -gmt 1} + # Scan : greedy match (space separated) + {clock scan "1 1 1" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "111 1" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1 111" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1 11 1" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "1 11 11" -format "%d%m%y" -base 0 -gmt 1} + {clock scan "11 11 11" -format "%d%m%y" -base 0 -gmt 1} + + # Scan : time (in gmt) + {clock scan "10:35:55" -format "%H:%M:%S" -base 1000000000 -gmt 1} + # Scan : time (system time zone, with base) + {clock scan "10:35:55" -format "%H:%M:%S" -base 1000000000} + # Scan : time (gmt, without base) + {clock scan "10:35:55" -format "%H:%M:%S" -gmt 1} + # Scan : time (system time zone, without base) + {clock scan "10:35:55" -format "%H:%M:%S"} + + # Scan : date-time (in gmt) + {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S" -base 0 -gmt 1} + # Scan : date-time (system time zone with base) + {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S" -base 0} + # Scan : date-time (system time zone without base) + {clock scan "25.11.2015 10:35:55" -format "%d.%m.%Y %H:%M:%S"} + + # Scan : julian day in gmt + {clock scan 2451545 -format %J -gmt 1} + # Scan : julian day in system TZ + {clock scan 2451545 -format %J} + # Scan : julian day in other TZ + {clock scan 2451545 -format %J -timezone +0200} + # Scan : julian day with time: + {clock scan "2451545 10:20:30" -format "%J %H:%M:%S"} + # Scan : julian day with time (greedy match): + {clock scan "2451545 102030" -format "%J%H%M%S"} + + # Scan : century, lookup table month + {clock scan {1970 Jan 2} -format {%C%y %b %d} -locale en -gmt 1} + # Scan : century, lookup table month and day (both entries are first) + {clock scan {1970 Jan 01} -format {%C%y %b %Od} -locale en -gmt 1} + # Scan : century, lookup table month and day (list scan: entries with position 12 / 31) + {clock scan {2016 Dec 31} -format {%C%y %b %Od} -locale en -gmt 1} + + # Scan : ISO date-time (CEST) + {clock scan "2009-06-30T18:30:00+02:00" -format "%Y-%m-%dT%H:%M:%S%z"} + {clock scan "2009-06-30T18:30:00 CEST" -format "%Y-%m-%dT%H:%M:%S %z"} + # Scan : ISO date-time (UTC) + {clock scan "2009-06-30T18:30:00Z" -format "%Y-%m-%dT%H:%M:%S%z"} + {clock scan "2009-06-30T18:30:00 UTC" -format "%Y-%m-%dT%H:%M:%S %z"} + + # Scan : locale date-time (en): + {clock scan "06/30/2009 18:30:15" -format "%x %X" -gmt 1 -locale en} + # Scan : locale date-time (de): + {clock scan "30.06.2009 18:30:15" -format "%x %X" -gmt 1 -locale de} + + # Scan : dynamic format (cacheable) + {clock scan "25.11.2015 10:35:55" -format [string trim "%d.%m.%Y %H:%M:%S "] -base 0 -gmt 1} + + break + # # Scan : long format test (allock chain) + # {clock scan "25.11.2015" -format "%d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y %d.%m.%Y" -base 0 -gmt 1} + # # Scan : dynamic, very long format test (create obj representation, allock chain, GC, etc): + # {clock scan "25.11.2015" -format [string repeat "[incr i] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + # # Scan : again: + # {clock scan "25.11.2015" -format [string repeat "[incr i -1] %d.%m.%Y %d.%m.%Y" 10] -base 0 -gmt 1} + } {puts [clock format $_(r) -locale en]} +} + +proc test-freescan {{reptime 1000}} { + _test_run $reptime { + # FreeScan : relative date + {clock scan "5 years 18 months 385 days" -base 0 -gmt 1} + # FreeScan : relative date with relative weekday + {clock scan "5 years 18 months 385 days Fri" -base 0 -gmt 1} + # FreeScan : relative date with ordinal month + {clock scan "5 years 18 months 385 days next 1 January" -base 0 -gmt 1} + # FreeScan : relative date with ordinal month and relative weekday + {clock scan "5 years 18 months 385 days next January Fri" -base 0 -gmt 1} + # FreeScan : ordinal month + {clock scan "next January" -base 0 -gmt 1} + # FreeScan : relative week + {clock scan "next Fri" -base 0 -gmt 1} + # FreeScan : relative weekday and week offset + {clock scan "next January + 2 week" -base 0 -gmt 1} + # FreeScan : time only with base + {clock scan "19:18:30" -base 148863600 -gmt 1} + # FreeScan : time only without base, gmt + {clock scan "19:18:30" -gmt 1} + # FreeScan : time only without base, system + {clock scan "19:18:30"} + # FreeScan : date, system time zone + {clock scan "05/08/2016 20:18:30"} + # FreeScan : date, supplied time zone + {clock scan "05/08/2016 20:18:30" -timezone :CET} + # FreeScan : date, supplied gmt (equivalent -timezone :GMT) + {clock scan "05/08/2016 20:18:30" -gmt 1} + # FreeScan : date, supplied time zone gmt + {clock scan "05/08/2016 20:18:30" -timezone :GMT} + # FreeScan : time only, numeric zone in string, base time gmt (exchange zones between gmt / -0500) + {clock scan "20:18:30 -0500" -base 148863600 -gmt 1} + # FreeScan : time only, zone in string (exchange zones between system / gmt) + {clock scan "19:18:30 GMT" -base 148863600} + # FreeScan : fast switch of zones in cycle - GMT, MST, CET (system) and EST + {clock scan "19:18:30 MST" -base 148863600 -gmt 1 + clock scan "19:18:30 EST" -base 148863600 + } + } {puts [clock format $_(r) -locale en]} +} + +proc test-add {{reptime 1000}} { + _test_run $reptime { + # Add : years + {clock add 1246379415 5 years -gmt 1} + # Add : months + {clock add 1246379415 18 months -gmt 1} + # Add : weeks + {clock add 1246379415 20 weeks -gmt 1} + # Add : days + {clock add 1246379415 385 days -gmt 1} + # Add : weekdays + {clock add 1246379415 3 weekdays -gmt 1} + + # Add : hours + {clock add 1246379415 5 hours -gmt 1} + # Add : minutes + {clock add 1246379415 55 minutes -gmt 1} + # Add : seconds + {clock add 1246379415 100 seconds -gmt 1} + + # Add : +/- in gmt + {clock add 1246379415 -5 years +21 months -20 weeks +386 days -19 hours +30 minutes -10 seconds -gmt 1} + # Add : +/- in system timezone + {clock add 1246379415 -5 years +21 months -20 weeks +386 days -19 hours +30 minutes -10 seconds -timezone :CET} + + # Add : gmt + {clock add 1246379415 -5 years 18 months 366 days 5 hours 30 minutes 10 seconds -gmt 1} + # Add : system timezone + {clock add 1246379415 -5 years 18 months 366 days 5 hours 30 minutes 10 seconds -timezone :CET} + + # Add : all in gmt + {clock add 1246379415 4 years 18 months 50 weeks 378 days 3 weekdays 5 hours 30 minutes 10 seconds -gmt 1} + # Add : all in system timezone + {clock add 1246379415 4 years 18 months 50 weeks 378 days 3 weekdays 5 hours 30 minutes 10 seconds -timezone :CET} + + } {puts [clock format $_(r) -locale en]} +} + +proc test-other {{reptime 1000}} { + _test_run $reptime { + # Bad zone + {catch {clock scan "1 day" -timezone BAD_ZONE -locale en}} + + # Scan : julian day (overflow) + {catch {clock scan 5373485 -format %J}} + + # Scan : test rotate of GC objects (format is dynamic, so tcl-obj removed with last reference) + {set i 0; time { clock scan "[incr i] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} + # Scan : test reusability of GC objects (format is dynamic, so tcl-obj removed with last reference) + {set i 50; time { clock scan "[incr i -1] - 25.11.2015" -format "$i - %d.%m.%Y" -base 0 -gmt 1 } 50} + } +} + +proc test {{reptime 1000}} { + puts "" + test-format $reptime + test-scan $reptime + test-freescan $reptime + test-add $reptime + test-other $reptime + + puts \n**OK** +} + +test 500; # ms -- cgit v0.12 From f9abf9b060c15ad2d4b00f99f7814a388875c642 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 09:46:43 +0000 Subject: man for timerate (doc/timerate.n) --- doc/timerate.n | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 doc/timerate.n diff --git a/doc/timerate.n b/doc/timerate.n new file mode 100644 index 0000000..df9a8f7 --- /dev/null +++ b/doc/timerate.n @@ -0,0 +1,114 @@ +'\" +'\" Copyright (c) 2005 Sergey Brester aka sebres. +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +.TH timerate n "" Tcl "Tcl Built-In Commands" +.so man.macros +.BS +'\" Note: do not modify the .SH NAME line immediately below! +.SH NAME +timerate \- Time-related execution resp. performance measurement of a script +.SH SYNOPSIS +\fBtimerate \fIscript\fR \fI?time?\fR +.sp +\fBtimerate \fI?-direct?\fR \fI?-overhead double?\fR \fIscript\fR \fI?time?\fR +.sp +\fBtimerate \fI?-calibrate?\fR \fI?-direct?\fR \fIscript\fR \fI?time?\fR +.BE +.SH DESCRIPTION +.PP +The first and second form will evaluate \fIscript\fR until the interval +\fItime\fR given in milliseconds elapses, or for 1000 milliseconds (1 second) +if \fItime\fR is not specified. +.sp +It will then return a canonical tcl-list of the form +.PP +.CS +\f0.095977 µs/# 52095836 # 10419167 #/sec 5000.000 nett-ms\fR +.CE +.PP +which indicates: +.IP \(bu +the average amount of time required per iteration, in microseconds (lindex $result 0) +.IP \(bu +the count how many times it was executed (lindex $result 2) +.IP \(bu +the estimated rate per second (lindex $result 4) +.IP \(bu +the estimated real execution time without measurement overhead (lindex $result 6) +.PP +Time is measured in elapsed time using heighest timer resolution as possible, not CPU time. +This command may be used to provide information as to how well the script or a tcl-command +is performing and can help determine bottlenecks and fine-tune application performance. +.PP +\fI-calibrate\fR +. +To measure very fast scripts as exact as posible the calibration process +may be required. + +This parameter used to calibrate \fBtimerate\fR calculating the estimated overhead +of given \fIscript\fR as default overhead for further execution of \fBtimerate\fR. +It can take up to 10 seconds if parameter \fItime\fR is not specified. +.PP +\fI-overhead double\fR +. +This parameter used to supply the measurement overhead of single iteration +(in microseconds) that should be ignored during whole evaluation process. +.PP +\fI-direct\fR +. +Causes direct execution per iteration (not compiled variant of evaluation used). +.PP +In opposition to \fBtime\fR the execution limited here by fixed time instead of +repetition count. +Additionally the compiled variant of the script will be used during whole evaluation +(as if it were part of a compiled \fBproc\fR), if parameter \fI-direct\fR is not specified. +Therefore it provides more precise results and prevents very long execution time +by slow scripts resp. scripts with unknown speed. + +.SH EXAMPLE +Estimate how fast it takes for a simple Tcl \fBfor\fR loop (including +operations on variable \fIi\fR) to count to a ten: +.PP +.CS +# calibrate: +timerate -calibrate {} +# measure: +timerate { for {set i 0} {$i<10} {incr i} {} } 5000 +.CE +.PP +Estimate how fast it takes for a simple Tcl \fBfor\fR loop only (ignoring the +overhead for operations on variable \fIi\fR) to count to a ten: +.PP +.CS +# calibrate for overhead of variable operations: +set i 0; timerate -calibrate {expr {$i<10}; incr i} 1000 +# measure: +timerate { for {set i 0} {$i<10} {incr i} {} } 5000 +.CE +.PP +Estimate the rate of calculating the hour using \fBclock format\fR only, ignoring +overhead of the rest, without measurement how fast it takes for a whole script: +.PP +.CS +# calibrate: +timerate -calibrate {} +# estimate overhead: +set tm 0 +set ovh [lindex [timerate { incr tm [expr {24*60*60}] }] 0] +# measure using esimated overhead: +set tm 0 +timerate -overhead $ovh { + clock format $tm -format %H + incr tm [expr {24*60*60}]; # overhead for this is ignored +} 5000 +.CE +.SH "SEE ALSO" +time(n) +.SH KEYWORDS +script, timerate, time +.\" Local Variables: +.\" mode: nroff +.\" End: -- cgit v0.12 From 0cdf2fd457ccaaa079eb8da08b23c1367f092d53 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 12:25:59 +0000 Subject: performance test cases extended: several cases to cover absence of the ensemble overhead --- tests-perf/clock.perf.tcl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 733db1a..238e536 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -371,8 +371,34 @@ proc test-other {{reptime 1000}} { } } +proc test-ensemble-perf {{reptime 1000}} { + _test_run $reptime { + # Clock clicks (ensemble) + {clock clicks} + # Clock clicks (direct) + {::tcl::clock::clicks} + # Clock seconds (ensemble) + {clock seconds} + # Clock seconds (direct) + {::tcl::clock::seconds} + # Clock microseconds (ensemble) + {clock microseconds} + # Clock microseconds (direct) + {::tcl::clock::microseconds} + # Clock scan (ensemble) + {clock scan ""} + # Clock scan (direct) + {::tcl::clock::scan ""} + # Clock format (ensemble) + {clock format 0 -f %s} + # Clock format (direct) + {::tcl::clock::format 0 -f %s} + } +} + proc test {{reptime 1000}} { puts "" + test-ensemble-perf [expr {$reptime / 2}]; #fast enough test-format $reptime test-scan $reptime test-freescan $reptime -- cgit v0.12 From 1ea7d20306277fe9aab8d0f70fa57d214eb48ddb Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 12:32:47 +0000 Subject: auto-loading of ensemble and stubs on demand only (+ test covered now, see clock-0.1); introduces new possibility to implement namespace-based auto-loading, e. g.: set ::auto_index_ns(::some::namespace) [list ::source [::file join $dir some namespace.tcl]]] loading of clock-stubs (clock.tcl) implemented via handler "auto_index_ns" now. --- library/init.tcl | 73 ++++++++++++++++++++++++++++++++++---------------------- tests/clock.test | 21 ++++++++++++++++ 2 files changed, 65 insertions(+), 29 deletions(-) diff --git a/library/init.tcl b/library/init.tcl index 824f66f..d2c3b6e 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -156,6 +156,17 @@ if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} { if {[interp issafe]} { package unknown {::tcl::tm::UnknownHandler ::tclPkgUnknown} } else { + # Default known auto_index (avoid loading auto index implicit after interp create): + + array set ::auto_index { + ::tcl::tm::UnknownHandler {source [info library]/tm.tcl} + ::tclPkgUnknown {source [info library]/package.tcl} + ::history {source [info library]/history.tcl} + } + + # The newest possibility to load whole namespace: + array set ::auto_index_ns {} + # Set up search for Tcl Modules (TIP #189). # and setup platform specific unknown package handlers if {$tcl_platform(os) eq "Darwin" @@ -168,28 +179,19 @@ if {[interp issafe]} { # Set up the 'clock' ensemble - namespace eval ::tcl::clock [list variable TclLibDir $::tcl_library] - proc clock args { set cmdmap [dict create] foreach cmd {add clicks format microseconds milliseconds scan seconds configure} { dict set cmdmap $cmd ::tcl::clock::$cmd } - namespace eval ::tcl::clock [list namespace ensemble create -command \ - [uplevel 1 [list namespace origin [lindex [info level 0] 0]]] \ + namespace inscope ::tcl::clock [list namespace ensemble create -command \ + [uplevel 1 [list ::namespace origin [::lindex [info level 0] 0]]] \ -map $cmdmap -compile 1] - # Auto-loading stubs for 'clock.tcl' - foreach cmd {mcget LocalizeFormat SetupTimeZone GetSystemTimeZone} { - 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]] + uplevel 1 [info level 0] } + # Auto-loading stubs for 'clock.tcl' + set ::auto_index_ns(::tcl::clock) {::namespace inscope ::tcl::clock {::source [::file join [info library] clock.tcl]}} } # Conditionalize for presence of exec. @@ -417,18 +419,22 @@ proc unknown args { # for instance. If not given, namespace current is used. proc auto_load {cmd {namespace {}}} { - global auto_index auto_path + global auto_index auto_index_ns auto_path + # qualify names: if {$namespace eq ""} { set namespace [uplevel 1 [list ::namespace current]] } set nameList [auto_qualify $cmd $namespace] # workaround non canonical auto_index entries that might be around # from older auto_mkindex versions - lappend nameList $cmd - foreach name $nameList { + if {$cmd ni $nameList} {lappend nameList $cmd} + + # try to load (and create sub-cmd handler "_sub_load_cmd" for further usage): + foreach name $nameList [set _sub_load_cmd { + # via auto_index: if {[info exists auto_index($name)]} { - namespace eval :: $auto_index($name) + namespace inscope :: $auto_index($name) # There's a couple of ways to look for a command of a given # name. One is to use # info commands $name @@ -440,22 +446,31 @@ proc auto_load {cmd {namespace {}}} { return 1 } } - } + # via auto_index_ns - resolver for the whole namespace loaders + if {[set ns [::namespace qualifiers $name]] ni {"" "::"} && + [info exists auto_index_ns($ns)] + } { + # remove handler before loading (prevents several self-recursion cases): + set ldr $auto_index_ns($ns); unset auto_index_ns($ns) + namespace inscope :: $ldr + # if got it: + if {[namespace which -command $name] ne ""} { + return 1 + } + } + }] + + # load auto_index if possible: if {![info exists auto_path]} { return 0 } - if {![auto_load_index]} { return 0 } - foreach name $nameList { - if {[info exists auto_index($name)]} { - namespace eval :: $auto_index($name) - if {[namespace which -command $name] ne ""} { - return 1 - } - } - } + + # try again (something new could be loaded): + foreach name $nameList $_sub_load_cmd + return 0 } @@ -605,7 +620,7 @@ proc auto_import {pattern} { foreach name [array names auto_index $pattern] { if {([namespace which -command $name] eq "") && ([namespace qualifiers $pattern] eq [namespace qualifiers $name])} { - namespace eval :: $auto_index($name) + namespace inscope :: $auto_index($name) } } } diff --git a/tests/clock.test b/tests/clock.test index 0737558..af517c8 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -35,6 +35,9 @@ testConstraint y2038 \ # TEST PLAN +# clock-0: +# several base test-cases +# # clock-1: # [clock format] - tests of bad and empty arguments # @@ -251,6 +254,24 @@ proc ::testClock::registry { cmd path key } { return [dict get $reg $path $key] } +# Base test cases: + +test clock-0.1 "initial: auto-loading of ensemble and stubs on demand" { + set i [interp create]; # because clock can be used somewhere, test it in new interp: + + set ret [$i eval { + + lappend ret ens:[namespace ensemble exists ::clock] + clock seconds; # init ensemble (but not yet stubs, loading of clock.tcl retarded) + lappend ret ens:[namespace ensemble exists ::clock] + lappend ret stubs:[expr {[namespace which -command ::tcl::clock::GetSystemTimeZone] ne ""}] + clock format -now; # clock.tcl stubs expected + lappend ret stubs:[expr {[namespace which -command ::tcl::clock::GetSystemTimeZone] ne ""}] + }] + interp delete $i + set ret +} {ens:0 ens:1 stubs:0 stubs:1} + # Test some of the basics of [clock format] test clock-1.0 "clock format - wrong # args" { -- cgit v0.12 From 95d531e781ad6869e929820b306df7206c3f67b8 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 15:07:32 +0000 Subject: prevents loss of key object if the format object (where key stored) becomes changed (loses its internal representation during evals); should avoid possible theoretical segfault there. --- generic/tclClockFmt.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index d875bd4..18b82fa 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -634,7 +634,7 @@ ClockFmtObj_UpdateString(objPtr) * * This is normally stored in second pointer of internal representation. * If format object is not localizable, it is equal the given format - * pointer and the first pointer of internal representation may be NULL. + * pointer (special case to fast fallback by not-localizable formats). * * Results: * Returns tcl object with key or format object if not localizable. @@ -825,16 +825,20 @@ ClockLocalizeFormat( return opts->formatObj; } + /* prevents loss of key object if the format object (where key stored) + * becomes changed (loses its internal representation during evals) */ + Tcl_IncrRefCount(keyObj); + if (opts->mcDictObj == NULL) { ClockMCDict(opts); if (opts->mcDictObj == NULL) - return NULL; + goto done; } /* try to find in cache within locale mc-catalog */ if (Tcl_DictObjGet(NULL, opts->mcDictObj, keyObj, &valObj) != TCL_OK) { - return NULL; + goto done; } /* call LocalizeFormat locale format fmtkey */ @@ -844,10 +848,9 @@ ClockLocalizeFormat( callargs[1] = opts->localeObj; callargs[2] = opts->formatObj; callargs[3] = keyObj; - Tcl_IncrRefCount(keyObj); if (Tcl_EvalObjv(opts->interp, 4, callargs, 0) != TCL_OK ) { - goto clean; + goto done; } valObj = Tcl_GetObjResult(opts->interp); @@ -857,9 +860,11 @@ ClockLocalizeFormat( keyObj, valObj) != TCL_OK ) { valObj = NULL; - goto clean; + goto done; } + Tcl_ResetResult(opts->interp); + /* check special case - format object is not localizable */ if (valObj == opts->formatObj) { /* mark it as unlocalizable, by setting self as key (without refcount incr) */ @@ -868,14 +873,11 @@ ClockLocalizeFormat( ObjLocFmtKey(opts->formatObj) = opts->formatObj; } } -clean: - - Tcl_UnsetObjRef(keyObj); - if (valObj) { - Tcl_ResetResult(opts->interp); - } } +done: + + Tcl_UnsetObjRef(keyObj); return (opts->formatObj = valObj); } -- cgit v0.12 From ea1ae51d2d146dc75fd8132f6a7d9b9a24c3cb03 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 15:07:41 +0000 Subject: [clock] tclStrIdxTree extended with possibility to hold client data; also changed in clock - indices starts with 1 instead of 0, and 0(NULL) instead of -1 used as sign of ambiguous keys. --- generic/tclClockFmt.c | 14 +++++++----- generic/tclStrIdxTree.c | 59 +++++++++++++++++++++++++++---------------------- generic/tclStrIdxTree.h | 8 +++---- 3 files changed, 45 insertions(+), 36 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 18b82fa..70b3ad7 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -1174,7 +1174,7 @@ ClockMCGetListIdxTree( goto done; }; - if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv) != TCL_OK) { + if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv, NULL) != TCL_OK) { goto done; } @@ -1249,7 +1249,7 @@ ClockMCGetMultiListIdxTree( goto done; }; - if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv) != TCL_OK) { + if (TclStrIdxTreeBuildFromList(idxTree, lstc, lstv, NULL) != TCL_OK) { goto done; } mcKeys++; @@ -1301,12 +1301,12 @@ ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, /* not found */ return TCL_RETURN; } - if (foundItem->value == -1) { + if (!foundItem->value) { /* ambigous */ return TCL_RETURN; } - *val = foundItem->value; + *val = PTR2INT(foundItem->value); /* shift input pointer */ yyInput = f; @@ -1406,7 +1406,7 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, return ret; } - yyMonth = val + 1; + yyMonth = val; return TCL_OK; } @@ -1445,6 +1445,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, if (ret != TCL_OK) { return ret; } + --val; } if (val != -1) { @@ -1476,6 +1477,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, if (ret != TCL_OK) { return ret; } + --val; if (val == 0) { val = 7; @@ -1578,7 +1580,7 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, } if (tok->map->offs > 0) { - *(int *)(((char *)info) + tok->map->offs) = val; + *(int *)(((char *)info) + tok->map->offs) = --val; } return TCL_OK; diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index d9b5da0..291e481 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -24,26 +24,28 @@ * * Index-Tree: * - * j -1 * ... - * anuar 0 * - * u -1 * a -1 - * ni 5 * pril 3 - * li 6 * ugust 7 - * n -1 * gt 7 - * r 0 * s 8 - * i 5 * eptember 8 - * li 6 * pt 8 - * f 1 * oktober 9 - * ebruar 1 * n 10 - * br 1 * ovember 10 - * m -1 * vb 10 - * a -1 * d 11 - * erz 2 * ezember 11 - * i 4 * zb 11 - * rz 2 * + * j 0 * ... + * anuar 1 * + * u 0 * a 0 + * ni 6 * pril 4 + * li 7 * ugust 8 + * n 0 * gt 8 + * r 1 * s 9 + * i 6 * eptember 9 + * li 7 * pt 9 + * f 2 * oktober 10 + * ebruar 2 * n 11 + * br 2 * ovember 11 + * m 0 * vb 11 + * a 0 * d 12 + * erz 3 * ezember 12 + * i 5 * zb 12 + * rz 3 * * ... * - * Thereby value -1 shows pure group items (corresponding ambigous matches). + * Thereby value 0 shows pure group items (corresponding ambigous matches). + * But the group may have a value if it contains only same values + * (see for example group "f" above). * * StrIdxTree's are very fast, so: * build of above-mentioned tree takes about 10 microseconds. @@ -109,7 +111,7 @@ TclStrIdxTreeSearch( if (offs >= item->length && item->childTree.firstPtr) { /* save previuosly found item (if not ambigous) for * possible fallback (few greedy match) */ - if (item->value != -1) { + if (item->value != NULL) { prevf = f; prevItem = item; prevParent = parent; @@ -206,7 +208,9 @@ TclStrIdxTreeAppend( * TclStrIdxTreeBuildFromList -- * * Build or extend string indexed tree from tcl list. - * + * If the values not given the values of built list are indices starts with 1. + * Value of 0 is thereby reserved to the ambigous values. + * * Important: by multiple lists, optimal tree can be created only if list with * larger strings used firstly. * @@ -223,10 +227,12 @@ MODULE_SCOPE int TclStrIdxTreeBuildFromList( TclStrIdxTree *idxTree, int lstc, - Tcl_Obj **lstv) + Tcl_Obj **lstv, + ClientData *values) { Tcl_Obj **lwrv; int i, ret = TCL_ERROR; + ClientData val; const char *s, *e, *f; TclStrIdx *item; @@ -250,8 +256,9 @@ TclStrIdxTreeBuildFromList( TclStrIdxTree *foundParent = idxTree; e = s = TclGetString(lwrv[i]); e += lwrv[i]->length; + val = values ? values[i] : INT2PTR(i+1); - /* ignore empty values (impossible to index it) */ + /* ignore empty keys (impossible to index it) */ if (lwrv[i]->length == 0) continue; item = NULL; @@ -267,7 +274,7 @@ TclStrIdxTreeBuildFromList( } /* if shortest key was found with the same value, * just replace its current key with longest key */ - if ( foundItem->value == i + if ( foundItem->value == val && foundItem->length < lwrv[i]->length && foundItem->childTree.firstPtr == NULL ) { @@ -286,7 +293,7 @@ TclStrIdxTreeBuildFromList( Tcl_InitObjRef(item->key, foundItem->key); item->length = f - s; /* set value or mark as ambigous if not the same value of both */ - item->value = (foundItem->value == i) ? i : -1; + item->value = (foundItem->value == val) ? val : NULL; /* insert group item between foundParent and foundItem */ TclStrIdxTreeInsertBranch(foundParent, item, foundItem); foundParent = &item->childTree; @@ -304,7 +311,7 @@ TclStrIdxTreeBuildFromList( item->childTree.lastPtr = item->childTree.firstPtr = NULL; Tcl_InitObjRef(item->key, lwrv[i]); item->length = lwrv[i]->length; - item->value = i; + item->value = val; TclStrIdxTreeAppend(foundParent, item); }; @@ -496,7 +503,7 @@ TclStrIdxTreeTestObjCmd( &lstc, &lstv) != TCL_OK) { return TCL_ERROR; }; - TclStrIdxTreeBuildFromList(&idxTree, lstc, lstv); + TclStrIdxTreeBuildFromList(&idxTree, lstc, lstv, NULL); } if (optionIndex == O_PUTS_INDEX) { TclStrIdxTreePrint(interp, idxTree.firstPtr, 0); diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h index 305053c..9f26907 100644 --- a/generic/tclStrIdxTree.h +++ b/generic/tclStrIdxTree.h @@ -27,9 +27,9 @@ typedef struct TclStrIdx { struct TclStrIdxTree childTree; struct TclStrIdx *nextPtr; struct TclStrIdx *prevPtr; - Tcl_Obj *key; - int length; - int value; + Tcl_Obj *key; + int length; + ClientData value; } TclStrIdx; @@ -152,7 +152,7 @@ MODULE_SCOPE const char* const char *start, const char *end); MODULE_SCOPE int TclStrIdxTreeBuildFromList(TclStrIdxTree *idxTree, - int lstc, Tcl_Obj **lstv); + int lstc, Tcl_Obj **lstv, ClientData *values); MODULE_SCOPE Tcl_Obj* TclStrIdxTreeNewObj(); -- cgit v0.12 From 39a388f0350df40cc42cb9f09c2d1be32327ac93 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 16:56:56 +0000 Subject: update documentation doc/clock.n: small enhancements and relevant changes of new engine. --- doc/clock.n | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/doc/clock.n b/doc/clock.n index 889a5da..38b408d 100644 --- a/doc/clock.n +++ b/doc/clock.n @@ -87,6 +87,15 @@ slowing its clock by a tiny fraction for some minutes until it is back in sync with UTC; its data model does not represent minutes that have 59 or 61 seconds. .TP +\fI\-now\fR +Instead of \fItimeVal\fR a non-integer option \fI\-now\fR can be used as +replacement for today, which is simply interpolated to the runt-time as value +of \fBclock seconds\fR. For example: +.sp +\fBclock format -now -f %a; # current day of the week\fR +.sp +\fBclock add -now 1 month; # next month\fR +.TP \fIunit\fR One of the words, \fBseconds\fR, \fBminutes\fR, \fBhours\fR, \fBdays\fR, \fBweeks\fR, \fBmonths\fR, or \fByears\fR, or @@ -528,6 +537,12 @@ abbreviation appropriate to the current locale, and uses it to fix whether \fB%Y\fR refers to years before or after Year 1 of the Common Era. .TP +\fB%Es\fR +This affects similar to \fB%s\fR, but in opposition to \fB%s\fR it parses +or formats local seconds (not the posix seconds). +Because \fB%s\fR has the same precedence as \fB%s\fR (uniquely determines +a point in time), it overrides all other input formats. +.TP \fB%Ex\fR On output, produces a locale-dependent representation of the date in the locale's alternative calendar. On input, matches @@ -722,13 +737,15 @@ week number \fB%V\fR; programs should use \fB%G\fR for that purpose. On output, produces the current time zone, expressed in hours and minutes east (+hhmm) or west (\-hhmm) of Greenwich. On input, accepts a time zone specifier (see \fBTIME ZONES\fR below) that will be used to -determine the time zone. +determine the time zone (this token is optionally applicable on input, +so the value is not mandatory and can be missing in input). .TP \fB%Z\fR On output, produces the current time zone's name, possibly translated to the given locale. On input, accepts a time zone specifier (see \fBTIME ZONES\fR below) that will be used to determine the -time zone. This option should, in general, be used on input only when +time zone (token is also like \fB%z\fR optionally applicable on input). +This option should, in general, be used on input only when parsing RFC822 dates. Other uses are fraught with ambiguity; for instance, the string \fBBST\fR may represent British Summer Time or Brazilian Standard Time. It is recommended that date/time strings for @@ -927,6 +944,24 @@ used. Finally, a correction is applied so that the correct hour of the day is produced after allowing for daylight savings time differences and the correct date is given when going from the end of a long month to a short month. +.PP +The precedence of the applying of single tokens resp. which sequence will be +used by calculating of the time is complex, e. g. heavily dependent on the +precision of type of the token. +.sp +In example below the second date-string contains "next January", therefore +it results in next year but in January. And third date-string besides "January" +contains also additionally "Fri", so it results in the nearest Friday. +Thus both win before "385 days" resp. make it more precise, because of higher +precision of this token types. +.CS +% clock format [clock scan "5 years 18 months 385 days" -base 0 -gmt 1] -gmt 1 +Thu Jul 21 00:00:00 GMT 1977 +% clock format [clock scan "5 years 18 months 385 days next January" -base 0 -gmt 1] -gmt 1 +Sat Jan 21 00:00:00 GMT 1978 +% clock format [clock scan "5 years 18 months 385 days next January Fri" -base 0 -gmt 1] -gmt 1 +Fri Jan 27 00:00:00 GMT 1978 +.CE .SH "SEE ALSO" msgcat(n) .SH KEYWORDS -- cgit v0.12 From 0ec19f6b1194fb374ddf9865375671b07033d9e1 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 11 May 2017 21:53:38 +0000 Subject: fixes lost indentation during back-porting --- generic/tclClock.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index a066f73..17c19c3 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -150,7 +150,7 @@ struct ClockCommand { const char *name; /* The tail of the command name. The full name * is "::tcl::clock::". When NULL marks * the end of the table. */ - Tcl_ObjCmdProc *objCmdProc; /* Function that implements the command. This + Tcl_ObjCmdProc *objCmdProc; /* Function that implements the command. This * will always have the ClockClientData sent * to it, but may well ignore this data. */ CompileProc *compileProc; /* The compiler for the command. */ @@ -2004,7 +2004,7 @@ ConvertUTCToLocal( if (ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv, dataPtr->UTC2Local.rangesVal) != TCL_OK) { return TCL_ERROR; - } + } } /* Cache the last conversion */ @@ -2576,9 +2576,9 @@ GetJulianDayFromEraYearMonthDay( * See above bug for details. The casts are necessary. */ if (ym1 >= 0) - ym1o4 = ym1 / 4; + ym1o4 = ym1 / 4; else { - ym1o4 = - (int) (((unsigned int) -ym1) / 4); + ym1o4 = - (int) (((unsigned int) -ym1) / 4); } #endif if (ym1 % 4 < 0) { @@ -2992,12 +2992,12 @@ ClockInitFmtScnArgs( static int ClockParseFmtScnArgs( register - ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */ - TclDateFields *date, /* Extracted date-time corresponding base - * (by scan or add) resp. clockval (by format) */ + ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */ + TclDateFields *date, /* Extracted date-time corresponding base + * (by scan or add) resp. clockval (by format) */ int objc, /* Parameter count */ - Tcl_Obj *const objv[], /* Parameter vector */ - int flags /* Flags, differentiates between format, scan, add */ + Tcl_Obj *const objv[], /* Parameter vector */ + int flags /* Flags, differentiates between format, scan, add */ ) { Tcl_Interp *interp = opts->interp; ClockClientData *dataPtr = opts->clientData; @@ -3031,7 +3031,7 @@ ClockParseFmtScnArgs( Tcl_WideInt num; if (TclGetWideIntFromObj(NULL, objv[i], &num) == TCL_OK) { continue; - } + } } /* get option */ if (Tcl_GetIndexFromObj(interp, objv[i], options, @@ -3067,10 +3067,10 @@ ClockParseFmtScnArgs( case CLC_ARGS_BASE: if ( !(flags & (CLC_SCN_ARGS)) ) { goto badOptionMsg; - } + } opts->baseObj = objv[i+1]; break; - } + } saw |= (1 << optionIndex); } @@ -3130,10 +3130,10 @@ ClockParseFmtScnArgs( i = 1; goto badOption; } - /* + /* * seconds could be an unsigned number that overflowed. Make sure * that it isn't. - */ + */ if (opts->baseObj->typePtr == &tclBignumType) { Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); @@ -4042,14 +4042,14 @@ ClockSecondsObjCmd( static unsigned long TzsetGetEpoch(void) { - static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by - * clockMutex. */ + static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by + * clockMutex. */ static long tzLastRefresh = 0; /* Used for latency before next refresh */ static unsigned long tzWasEpoch = 0; /* Epoch, signals that TZ changed */ static unsigned long tzEnvEpoch = 0; /* Last env epoch, for faster signaling, that TZ changed via TCL */ - const char *tzIsNow; /* Current value of TZ */ + const char *tzIsNow; /* Current value of TZ */ /* * Prevent performance regression on some platforms by resolving of system time zone: @@ -4068,7 +4068,7 @@ TzsetGetEpoch(void) Tcl_MutexLock(&clockMutex); tzIsNow = getenv("TCL_TZ"); if (tzIsNow == NULL) { - tzIsNow = getenv("TZ"); + tzIsNow = getenv("TZ"); } if (tzIsNow != NULL && (tzWas == NULL || tzWas == INT2PTR(-1) || strcmp(tzIsNow, tzWas) != 0)) { -- cgit v0.12 From 0adb50f88bf8f3e5220dce66339ccc62c6139d28 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 12 May 2017 07:45:15 +0000 Subject: restored "-encoding utf-8" by source clock.tcl (lost by merging) --- library/init.tcl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/init.tcl b/library/init.tcl index d2c3b6e..de69730 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -191,7 +191,9 @@ if {[interp issafe]} { uplevel 1 [info level 0] } # Auto-loading stubs for 'clock.tcl' - set ::auto_index_ns(::tcl::clock) {::namespace inscope ::tcl::clock {::source [::file join [info library] clock.tcl]}} + set ::auto_index_ns(::tcl::clock) {::namespace inscope ::tcl::clock { + ::source -encoding utf-8 [::file join [info library] clock.tcl] + }} } # Conditionalize for presence of exec. -- cgit v0.12 From 5d20272000e4f0b9ad2d2e16c4835debcac832dd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 12 May 2017 14:31:17 +0000 Subject: Don't test Tcl_GetDefaultEncodingDir() any more (which is obsolete), test Tcl_GetEncodingSearchPath() in stead. --- tests/encoding.test | 14 +++++++------- tests/unixInit.test | 17 +++++++++++------ unix/tclUnixTest.c | 45 ++++++++++++++++++++++----------------------- 3 files changed, 40 insertions(+), 36 deletions(-) diff --git a/tests/encoding.test b/tests/encoding.test index 4dddbb5..d9ba072 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -35,7 +35,7 @@ proc runtests {} { # Some tests require the testencoding command testConstraint testencoding [llength [info commands testencoding]] testConstraint exec [llength [info commands exec]] -testConstraint testgetdefenc [llength [info commands testgetdefenc]] +testConstraint testgetencpath [llength [info commands testgetencpath]] # TclInitEncodingSubsystem is tested by the rest of this file # TclFinalizeEncodingSubsystem is not currently tested @@ -570,15 +570,15 @@ foreach from {cp932 shiftjis euc-jp iso2022-jp} { } } -test encoding-26.0 {Tcl_GetDefaultEncodingDir} -constraints { - testgetdefenc +test encoding-26.0 {Tcl_GetEncodingSearchPath} -constraints { + testgetencpath } -setup { - set origDir [testgetdefenc] - testsetdefenc slappy + set origPath [testgetencpath] + testsetencpath slappy } -body { - testgetdefenc + testgetencpath } -cleanup { - testsetdefenc $origDir + testsetencpath $origPath } -result slappy file delete {*}[glob -directory [temporaryDirectory] *.chars *.tcltestout] diff --git a/tests/unixInit.test b/tests/unixInit.test index 05338ed..0469ee8 100644 --- a/tests/unixInit.test +++ b/tests/unixInit.test @@ -15,6 +15,9 @@ namespace import ::tcltest::* unset -nocomplain path catch {set oldlang $env(LANG)} set env(LANG) C + +# Some tests require the testgetencpath command +testConstraint testgetencpath [llength [info commands testgetencpath]] test unixInit-1.1 {TclpInitPlatform: ignore SIGPIPE} {unix stdio} { set x {} @@ -87,13 +90,15 @@ test unixInit-1.2 {initialisation: standard channel type deduction} {unix stdio} skip [concat [skip] unixInit-2.*] -test unixInit-2.0 {TclpInitLibraryPath: setting tclDefaultEncodingDir} { - set origDir [testgetdefenc] - testsetdefenc slappy - set path [testgetdefenc] - testsetdefenc $origDir +test unixInit-2.0 {TclpInitLibraryPath: setting tclDefaultEncodingDir} -constraints { + testgetencpath +} -body { + set origPath [testgetencpath] + testsetencpath slappy + set path [testgetencpath] + testsetencpath $origPath set path -} {slappy} +} -result {slappy} test unixInit-2.1 {TclpInitLibraryPath: value of installLib, developLib} -setup { unset -nocomplain oldlibrary if {[info exists env(TCL_LIBRARY)]} { diff --git a/unix/tclUnixTest.c b/unix/tclUnixTest.c index 86e0925..ceb64d9 100644 --- a/unix/tclUnixTest.c +++ b/unix/tclUnixTest.c @@ -68,10 +68,10 @@ static Tcl_CmdProc TestfilehandlerCmd; static Tcl_CmdProc TestfilewaitCmd; static Tcl_CmdProc TestfindexecutableCmd; static Tcl_ObjCmdProc TestforkObjCmd; -static Tcl_CmdProc TestgetdefencdirCmd; +static Tcl_ObjCmdProc TestgetencpathObjCmd; static Tcl_CmdProc TestgetopenfileCmd; static Tcl_CmdProc TestgotsigCmd; -static Tcl_CmdProc TestsetdefencdirCmd; +static Tcl_ObjCmdProc TestsetencpathObjCmd; static Tcl_FileProc TestFileHandlerProc; static void AlarmHandler(int signum); @@ -108,9 +108,9 @@ TclplatformtestInit( NULL, NULL); Tcl_CreateCommand(interp, "testgetopenfile", TestgetopenfileCmd, NULL, NULL); - Tcl_CreateCommand(interp, "testgetdefenc", TestgetdefencdirCmd, + Tcl_CreateObjCommand(interp, "testgetencpath", TestgetencpathObjCmd, NULL, NULL); - Tcl_CreateCommand(interp, "testsetdefenc", TestsetdefencdirCmd, + Tcl_CreateObjCommand(interp, "testsetencpath", TestsetencpathObjCmd, NULL, NULL); Tcl_CreateCommand(interp, "testalarm", TestalarmCmd, NULL, NULL); @@ -499,9 +499,9 @@ TestgetopenfileCmd( /* *---------------------------------------------------------------------- * - * TestsetdefencdirCmd -- + * TestsetencpathCmd -- * - * This function implements the "testsetdefenc" command. It is used to + * This function implements the "testsetencpath" command. It is used to * test Tcl_SetDefaultEncodingDir(). * * Results: @@ -514,19 +514,18 @@ TestgetopenfileCmd( */ static int -TestsetdefencdirCmd( +TestsetencpathObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const *objv) /* Argument strings. */ { - if (argc != 2) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " defaultDir\"", NULL); + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "defaultDir"); return TCL_ERROR; } - Tcl_SetDefaultEncodingDir(argv[1]); + Tcl_SetEncodingSearchPath(objv[1]); return TCL_OK; } @@ -552,7 +551,7 @@ TestforkObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *const *objv) /* Argument strings. */ + Tcl_Obj *const *objv) /* Argument strings. */ { pid_t pid; @@ -578,10 +577,10 @@ TestforkObjCmd( /* *---------------------------------------------------------------------- * - * TestgetdefencdirCmd -- + * TestgetencpathObjCmd -- * - * This function implements the "testgetdefenc" command. It is used to - * test Tcl_GetDefaultEncodingDir(). + * This function implements the "testgetencpath" command. It is used to + * test Tcl_GetEncodingSearchPath(). * * Results: * A standard Tcl result. @@ -593,18 +592,18 @@ TestforkObjCmd( */ static int -TestgetdefencdirCmd( +TestgetencpathObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ - int argc, /* Number of arguments. */ - const char **argv) /* Argument strings. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const *objv) /* Argument strings. */ { - if (argc != 1) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], NULL); + if (objc != 1) { + Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } - Tcl_AppendResult(interp, Tcl_GetDefaultEncodingDir(), NULL); + Tcl_SetObjResult(interp, Tcl_GetEncodingSearchPath()); return TCL_OK; } -- cgit v0.12 From dcc8bd9aa801c05f114644fe9f6d520b03b3f812 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 12 May 2017 19:58:01 +0000 Subject: Fixed stardate format: be sure positive after decimal point (note: clock-value can be negative - modulo operation in C has the same sign as dividend) --- generic/tclClockFmt.c | 12 +++++++----- tests/clock.test | 51 ++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 70b3ad7..d3cb339 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -2489,13 +2489,13 @@ ClockFmtToken_StarDate_Proc( { int fractYear; /* Get day of year, zero based */ - int doy = dateFmt->date.dayOfYear - 1; + int v = dateFmt->date.dayOfYear - 1; /* Convert day of year to a fractional year */ if (IsGregorianLeapYear(&dateFmt->date)) { - fractYear = 1000 * doy / 366; + fractYear = 1000 * v / 366; } else { - fractYear = 1000 * doy / 365; + fractYear = 1000 * v / 365; } /* Put together the StarDate as "Stardate %02d%03d.%1d" */ @@ -2507,8 +2507,10 @@ ClockFmtToken_StarDate_Proc( dateFmt->output = _itoaw(dateFmt->output, fractYear, '0', 3); *dateFmt->output++ = '.'; - dateFmt->output = _itoaw(dateFmt->output, - dateFmt->date.localSeconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ), '0', 1); + /* be sure positive after decimal point (note: clock-value can be negative) */ + v = dateFmt->date.localSeconds % SECONDS_PER_DAY / ( SECONDS_PER_DAY / 10 ); + if (v < 0) v = 10 + v; + dateFmt->output = _itoaw(dateFmt->output, v, '0', 1); return TCL_OK; } diff --git a/tests/clock.test b/tests/clock.test index af517c8..5f9a3ec 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -18647,10 +18647,42 @@ test clock-6.20 {special char tokens %n, %t} { } 1246386600 # Hi, Jeff! +proc _testStarDates {s {days {366*2}} {step {86400}}} { + set step [expr {int($step * 86400)}] + # reconvert - arrange in order of stardate: + set s [set i [clock scan [clock format $s -f "%Q" -g 1] -g 1]] + # test: + set wrong {} + while {$i < $s + $days*86400} { + set d [clock format $i -f "%Q" -g 1] + if {![regexp {^Stardate \d+\.\d$} $d]} { + lappend wrong "wrong: $d -- ($i) -- [clock format $i -g 1]" + } + if {[catch { + set i2 [clock scan $d -f "%Q" -g 1] + } msg]} { + lappend wrong "$d -- ($i) -- [clock format $i -g 1]: $msg" + } + if {$i != $i2} { + lappend wrong "$d -- ($i != $i2) -- [clock format $i -g 1]" + } + incr i $step + } + join $wrong \n +} test clock-6.21.0 {Stardate 0 day} { list [set d [clock format -757382400 -format "%Q" -gmt 1]] \ [clock scan $d -format "%Q" -gmt 1] } [list "Stardate 00000.0" -757382400] +test clock-6.21.0.1 {Stardate 0.1 - 1.9 (test negative clock value -> positive Stardate)} { + _testStarDates -757382400 2 0.1 +} {} +test clock-6.21.0.2 {Stardate 10000.1 - 10002.9 (test negative clock value -> positive Stardate)} { + _testStarDates [clock scan "Stardate 10000.1" -f %Q -g 1] 3 0.1 +} {} +test clock-6.21.0.2 {Stardate 80000.1 - 80002.9 (test positive clock value)} { + _testStarDates [clock scan "Stardate 80001.1" -f %Q -g 1] 3 0.1 +} {} test clock-6.21.1 {Stardate} { list [set d [clock format 1482857280 -format "%Q" -gmt 1]] \ [clock scan $d -format "%Q" -gmt 1] @@ -18659,21 +18691,10 @@ test clock-6.21.2 {Stardate next time} { list [set d [clock format 1482865920 -format "%Q" -gmt 1]] \ [clock scan $d -format "%Q" -gmt 1] } [list "Stardate 70986.8" 1482865920] -test clock-6.21.3 {Stardate correct scan over year (leap year, begin, middle and end of the year)} -body { - set s [clock scan "01.01.2016" -f "%d.%m.%Y" -g 1] - set s [set i [clock scan [clock format $s -f "%Q" -g 1] -g 1]] - set wrong {} - while {[incr i 86400] < $s + 86400*366*2} { - set d [clock format $i -f "%Q" -g 1] - set i2 [clock scan $d -f "%Q" -g 1] - if {$i != $i2} { - lappend wrong "$d -- ($i != $i2) -- [clock format $i -g 1]" - } - } - join $wrong \n -} -result {} -cleanup { - unset -nocomplain wrong i i2 s d -} +test clock-6.21.3 {Stardate correct scan over year (leap year, begin, middle and end of the year)} { + _testStarDates [clock scan "01.01.2016" -f "%d.%m.%Y" -g 1] [expr {366*2}] 1 +} {} +rename _testStarDates {} test clock-6.22.1 {Greedy match} { clock format [clock scan "111" -format "%d%m%y" -gmt 1] -locale en -gmt 1 -- cgit v0.12 From 02d6d68a6834591e799e305cf937b13b205f8b59 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 16 May 2017 08:51:51 +0000 Subject: resolved warnings compiled with gcc, removed unused "MsgCtLitIdxs" (was moved to tclClock.c) --- generic/tclClockFmt.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index d3cb339..d923ede 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -34,9 +34,6 @@ static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss); static void ClockFrmScnFinalize(ClientData clientData); -/* Msgcat index literals prefixed with _IDX_, used for quick dictionary search */ -CLOCK_LOCALE_LITERAL_ARRAY(MsgCtLitIdxs, "_IDX_"); - /* * Clock scan and format facilities. */ @@ -1906,7 +1903,7 @@ EstimateTokenCount( #define AllocTokenInChain(tok, chain, tokCnt) \ if (++(tok) >= (chain) + (tokCnt)) { \ - *((char **)&chain) = ckrealloc((char *)(chain), \ + chain = ckrealloc((char *)(chain), \ (tokCnt + CLOCK_MIN_TOK_CHAIN_BLOCK_SIZE) * sizeof(*(tok))); \ if ((chain) == NULL) { goto done; }; \ (tok) = (chain) + (tokCnt); \ -- cgit v0.12 From c3077bd013037c9dd95e23e2ed2e69e332287ba9 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 16 May 2017 09:16:43 +0000 Subject: optimized special case "-now" of base (by scan or add) or clock value (by format): bypass integer recognition if it looks like option "-now" --- generic/tclClock.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 17c19c3..80740c8 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -3110,14 +3110,19 @@ ClockParseFmtScnArgs( /* Base (by scan or add) or clock value (by format) */ if (opts->baseObj != NULL) { - if (TclGetWideIntFromObj(NULL, opts->baseObj, &baseVal) != TCL_OK) { + register Tcl_Obj *baseObj = opts->baseObj; + /* bypass integer recognition if looks like option "-now" */ + if ( + (baseObj->length == 4 && baseObj->bytes && *(baseObj->bytes+1) == 'n') || + TclGetWideIntFromObj(NULL, baseObj, &baseVal) != TCL_OK + ) { /* we accept "-now" as current date-time */ const char *const nowOpts[] = { "-now", NULL }; int idx; - if (Tcl_GetIndexFromObj(NULL, opts->baseObj, nowOpts, "seconds or -now", + if (Tcl_GetIndexFromObj(NULL, baseObj, nowOpts, "seconds or -now", TCL_EXACT, &idx) == TCL_OK ) { goto baseNow; @@ -3125,7 +3130,7 @@ ClockParseFmtScnArgs( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "expected integer but got \"%s\"", - Tcl_GetString(opts->baseObj))); + Tcl_GetString(baseObj))); Tcl_SetErrorCode(interp, "TCL", "VALUE", "INTEGER", NULL); i = 1; goto badOption; @@ -3135,7 +3140,7 @@ ClockParseFmtScnArgs( * that it isn't. */ - if (opts->baseObj->typePtr == &tclBignumType) { + if (baseObj->typePtr == &tclBignumType) { Tcl_SetObjResult(interp, dataPtr->literals[LIT_INTEGER_VALUE_TOO_LARGE]); return TCL_ERROR; } -- cgit v0.12 From 993aa1b3384b98684c0c16c3c0c9df672b389054 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 16 May 2017 09:22:17 +0000 Subject: small amend with forgetten static keyword by option --- generic/tclClock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 80740c8..c980a27 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -3118,7 +3118,7 @@ ClockParseFmtScnArgs( ) { /* we accept "-now" as current date-time */ - const char *const nowOpts[] = { + static const char *const nowOpts[] = { "-now", NULL }; int idx; -- cgit v0.12 From 8bdc7941770d91df0f7f258d97a0bd1951e0a1dd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 18 May 2017 09:16:39 +0000 Subject: Cherry-pick [http://core.tcl.tk/tclconfig/info/18e79736d236d15d|All the world was a VAX] for OpenBSD. Also fix [http://core.tcl.tk/tk/tktview?name=84a27b1c67|84a27b1c67]: Tcl and Tk's tcl.m4 not synced? (configure script not re-generated yet, I'm sure Don will do that in the rc branch) --- library/http/http.tcl | 2 +- unix/tcl.m4 | 49 +++++++++++++------------------------------------ 2 files changed, 14 insertions(+), 37 deletions(-) diff --git a/library/http/http.tcl b/library/http/http.tcl index d950441..0350808 100644 --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -206,7 +206,7 @@ proc http::Finish {token {errormsg ""} {skipCB 0}} { set state(error) [list $errormsg $errorInfo $errorCode] set state(status) "error" } - if { ($state(status) eq "timeout") + if { ($state(status) eq "timeout") || ($state(status) eq "error") || ([info exists state(-keepalive)] && !$state(-keepalive)) || ([info exists state(connection)] && ($state(connection) eq "close")) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index b21ae31..22fe8c9 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1236,9 +1236,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ fi do64bit_ok=yes if test "x${SHARED_BUILD}" = "x1"; then - echo "running cd ${TCL_SRC_DIR}/win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args" + echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args" # The eval makes quoting arguments work. - if cd ${TCL_SRC_DIR}/win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args; cd ../unix + if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args; cd ../unix then : else { echo "configure: error: configure failed for ../win" 1>&2; exit 1; } @@ -1467,44 +1467,21 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ OpenBSD-*) arch=`arch -s` case "$arch" in - vax) - # Equivalent using configure option --disable-load - # Step 4 will set the necessary variables - DL_OBJS="" - SHLIB_LD_LIBS="" - LDFLAGS="" + alpha|sparc64) + SHLIB_CFLAGS="-fPIC" ;; *) - case "$arch" in - alpha|sparc|sparc64) - SHLIB_CFLAGS="-fPIC" - ;; - *) - SHLIB_CFLAGS="-fpic" - ;; - esac - SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' - SHLIB_SUFFIX=".so" - DL_OBJS="tclLoadDl.o" - DL_LIBS="" - AS_IF([test $doRpath = yes], [ - CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) - LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' - LDFLAGS="-Wl,-export-dynamic" - ;; - esac - case "$arch" in - vax) - CFLAGS_OPTIMIZE="-O1" - ;; - sh) - CFLAGS_OPTIMIZE="-O0" - ;; - *) - CFLAGS_OPTIMIZE="-O2" + SHLIB_CFLAGS="-fpic" ;; esac + SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' + SHLIB_SUFFIX=".so" + AS_IF([test $doRpath = yes], [ + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' + LDFLAGS="-Wl,-export-dynamic" + CFLAGS_OPTIMIZE="-O2" AS_IF([test "${TCL_THREADS}" = "1"], [ # On OpenBSD: Compile with -pthread # Don't link with -lpthread -- cgit v0.12 From 246869993a67bf863fd2d0cf5647e62a9152fae8 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 18 May 2017 12:09:00 +0000 Subject: autoconf-2.59 --- unix/configure | 53 +++++++++++++++-------------------------------------- 1 file changed, 15 insertions(+), 38 deletions(-) diff --git a/unix/configure b/unix/configure index 38c3f9a..8531e81 100755 --- a/unix/configure +++ b/unix/configure @@ -6929,9 +6929,9 @@ echo "$as_me: error: CYGWIN compile is only supported with --enable-threads" >&2 fi do64bit_ok=yes if test "x${SHARED_BUILD}" = "x1"; then - echo "running cd ${TCL_SRC_DIR}/win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args" + echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args" # The eval makes quoting arguments work. - if cd ${TCL_SRC_DIR}/win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args; cd ../unix + if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args; cd ../unix then : else { echo "configure: error: configure failed for ../win" 1>&2; exit 1; } @@ -7516,47 +7516,24 @@ fi OpenBSD-*) arch=`arch -s` case "$arch" in - vax) - # Equivalent using configure option --disable-load - # Step 4 will set the necessary variables - DL_OBJS="" - SHLIB_LD_LIBS="" - LDFLAGS="" + alpha|sparc64) + SHLIB_CFLAGS="-fPIC" ;; *) - case "$arch" in - alpha|sparc|sparc64) - SHLIB_CFLAGS="-fPIC" - ;; - *) - SHLIB_CFLAGS="-fpic" - ;; - esac - SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' - SHLIB_SUFFIX=".so" - DL_OBJS="tclLoadDl.o" - DL_LIBS="" - if test $doRpath = yes; then + SHLIB_CFLAGS="-fpic" + ;; + esac + SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' + SHLIB_SUFFIX=".so" + if test $doRpath = yes; then - CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi - LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' - LDFLAGS="-Wl,-export-dynamic" - ;; - esac - case "$arch" in - vax) - CFLAGS_OPTIMIZE="-O1" - ;; - sh) - CFLAGS_OPTIMIZE="-O0" - ;; - *) - CFLAGS_OPTIMIZE="-O2" - ;; - esac + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' + LDFLAGS="-Wl,-export-dynamic" + CFLAGS_OPTIMIZE="-O2" if test "${TCL_THREADS}" = "1"; then # On OpenBSD: Compile with -pthread -- cgit v0.12 From 8b5d3394c2827fa8bfa14ba8169b0139bc58195b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 18 May 2017 13:25:17 +0000 Subject: Fix test-case numbering --- tests/http.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/http.test b/tests/http.test index d7e42c2..e8f78e3 100644 --- a/tests/http.test +++ b/tests/http.test @@ -592,7 +592,7 @@ test http-4.15 {http::Event} -body { } -cleanup { catch {http::cleanup $token} } -returnCodes 1 -match glob -result "couldn't open socket*" -test http-1.15 {Leak with Close vs Keepalive (bug [6ca52aec14]} -body { +test http-4.16 {Leak with Close vs Keepalive (bug [6ca52aec14]} -body { set before [chan names] set token [http::geturl $url -headers {X-Connection keep-alive}] http::cleanup $token -- cgit v0.12 From 82ddcc716b49790cf70e81e2a116a93181f4ef12 Mon Sep 17 00:00:00 2001 From: aspect Date: Fri, 19 May 2017 14:21:46 +0000 Subject: fix build failure with TCL_MEM_DEBUG introduced by [8b717dc06a3e3d49] --- generic/tclInt.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 2938074..7b582c0 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4766,9 +4766,9 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; #define TclSmallFreeEx(interp, memPtr) \ do { \ Tcl_Obj *_objPtr = (Tcl_Obj *) memPtr; \ - objPtr->bytes = NULL; \ - objPtr->typePtr = NULL; \ - objPtr->refCount = 1; \ + _objPtr->bytes = NULL; \ + _objPtr->typePtr = NULL; \ + _objPtr->refCount = 1; \ TclDecrRefCount(_objPtr); \ } while (0) #endif /* TCL_MEM_DEBUG */ -- cgit v0.12 From 62e71e311e8c0f4d38de59686af77451b1754fcb Mon Sep 17 00:00:00 2001 From: stu Date: Sat, 20 May 2017 12:45:31 +0000 Subject: Fix build on OpenBSD. [82701b94c4] missed a couple of bits. Tcl/Tk's tcl.m4 isn't identical to TEA's tcl.m4 - be careful! --- unix/configure | 4 +++- unix/tcl.m4 | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/unix/configure b/unix/configure index 2097111..8b8a464 100755 --- a/unix/configure +++ b/unix/configure @@ -5757,12 +5757,14 @@ fi esac SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" if test $doRpath = yes; then : CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" CFLAGS_OPTIMIZE="-O2" if test "${TCL_THREADS}" = "1"; then : diff --git a/unix/tcl.m4 b/unix/tcl.m4 index a69715d..559d8f3 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1476,10 +1476,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ esac SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" CFLAGS_OPTIMIZE="-O2" AS_IF([test "${TCL_THREADS}" = "1"], [ -- cgit v0.12 From 4db003c2bf902b43e625ae690864201b9d3e51ed Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 21 May 2017 17:42:16 +0000 Subject: Cherrypick Fix build on OpenBSD. [82701b94c4] missed a couple of bits. Tcl/Tk's tcl.m4 isn't identical to TEA's tcl.m4 - be careful! --- unix/configure | 4 +++- unix/tcl.m4 | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/unix/configure b/unix/configure index 8531e81..1ebe843 100755 --- a/unix/configure +++ b/unix/configure @@ -7525,13 +7525,15 @@ fi esac SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" if test $doRpath = yes; then CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" CFLAGS_OPTIMIZE="-O2" if test "${TCL_THREADS}" = "1"; then diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 22fe8c9..26b2a4a 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1476,10 +1476,12 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ esac SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" CFLAGS_OPTIMIZE="-O2" AS_IF([test "${TCL_THREADS}" = "1"], [ -- cgit v0.12 From f100bae7463dd1f68be8be40745c526342bd5e9d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 22 May 2017 08:53:04 +0000 Subject: If SHLIB_VERSION is specified as empty, don't let the SHLIB filename end with a dot (taken over from TEA) Cherry-pick [http://core.tcl.tk/tclconfig/info/c8eddeddb9bbabc4|c8eddeddb9] from TEA: Added /usr/pkg/lib to the paths searched on the journey to find tclConfig.sh --- unix/tcl.m4 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 26b2a4a..8a802fb 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -91,8 +91,9 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [ for i in `ls -d ${libdir} 2>/dev/null` \ `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ - `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ ; do @@ -611,7 +612,6 @@ AC_DEFUN([SC_ENABLE_FRAMEWORK], [ # TCL_THREADS # _REENTRANT # _THREAD_SAFE -# #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_THREADS], [ @@ -727,7 +727,6 @@ AC_DEFUN([SC_ENABLE_THREADS], [ # Sets to $(LDFLAGS_OPTIMIZE) if false # DBGX Formerly used as debug library extension; # always blank now. -# #------------------------------------------------------------------------ AC_DEFUN([SC_ENABLE_SYMBOLS], [ @@ -977,7 +976,7 @@ AC_DEFUN([SC_CONFIG_SYSTEM], [ # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when # creating shared libraries. This symbol typically # goes at the end of the "ld" commands that build -# shared libraries. The value of the symbol is +# shared libraries. The value of the symbol defaults to # "${LIBS}" if all of the dependent libraries should # be specified when creating a shared library. If # dependent libraries should not be specified (as on @@ -1107,7 +1106,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ PLAT_OBJS="" PLAT_SRCS="" LDAIX_SRC="" - AS_IF([test x"${SHLIB_VERSION}" = x], [SHLIB_VERSION="1.0"]) + AS_IF([test "x${SHLIB_VERSION}" = x],[SHLIB_VERSION=".1.0"],[SHLIB_VERSION=".${SHLIB_VERSION}"]) case $system in AIX-*) AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [ @@ -1481,7 +1480,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" CFLAGS_OPTIMIZE="-O2" AS_IF([test "${TCL_THREADS}" = "1"], [ @@ -1804,7 +1803,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ # 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.${SHLIB_VERSION}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; -- cgit v0.12 From c571887777c0fea5679125daa68dc66e94e3f834 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 22 May 2017 09:04:22 +0000 Subject: autoconf --- unix/configure | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/unix/configure b/unix/configure index 1ebe843..3e3b4c4 100755 --- a/unix/configure +++ b/unix/configure @@ -6650,8 +6650,10 @@ fi PLAT_OBJS="" PLAT_SRCS="" LDAIX_SRC="" - if test x"${SHLIB_VERSION}" = x; then - SHLIB_VERSION="1.0" + if test "x${SHLIB_VERSION}" = x; then + SHLIB_VERSION=".1.0" +else + SHLIB_VERSION=".${SHLIB_VERSION}" fi case $system in @@ -7533,7 +7535,7 @@ fi fi LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" CFLAGS_OPTIMIZE="-O2" if test "${TCL_THREADS}" = "1"; then @@ -8274,7 +8276,7 @@ fi # 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.${SHLIB_VERSION}' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}' UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; -- cgit v0.12 From f3ea991996a821a92f44c7f822766e7d59800f6c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 May 2017 14:48:58 +0000 Subject: Update internal tables to Unicode 10.0. Still in Beta, but to be released soon. --- generic/regc_locale.c | 6164 ++++++++++++++++++++++++++++++++++++++++++++++--- generic/tclUniData.c | 1226 +++++----- 2 files changed, 6496 insertions(+), 894 deletions(-) diff --git a/generic/regc_locale.c b/generic/regc_locale.c index ab3b7f1..f0e8439 100644 --- a/generic/regc_locale.c +++ b/generic/regc_locale.c @@ -140,106 +140,1106 @@ static const crange alphaRangeTable[] = { {0x3f7, 0x481}, {0x48a, 0x52f}, {0x531, 0x556}, {0x561, 0x587}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x620, 0x64a}, {0x671, 0x6d3}, {0x6fa, 0x6fc}, {0x712, 0x72f}, {0x74d, 0x7a5}, {0x7ca, 0x7ea}, - {0x800, 0x815}, {0x840, 0x858}, {0x8a0, 0x8b4}, {0x8b6, 0x8bd}, - {0x904, 0x939}, {0x958, 0x961}, {0x971, 0x980}, {0x985, 0x98c}, - {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, {0x9df, 0x9e1}, - {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa59, 0xa5c}, - {0xa72, 0xa74}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, - {0xaaa, 0xab0}, {0xab5, 0xab9}, {0xb05, 0xb0c}, {0xb13, 0xb28}, - {0xb2a, 0xb30}, {0xb35, 0xb39}, {0xb5f, 0xb61}, {0xb85, 0xb8a}, - {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xba8, 0xbaa}, {0xbae, 0xbb9}, - {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, - {0xc58, 0xc5a}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, - {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, - {0xd12, 0xd3a}, {0xd54, 0xd56}, {0xd5f, 0xd61}, {0xd7a, 0xd7f}, - {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6}, - {0xe01, 0xe30}, {0xe40, 0xe46}, {0xe94, 0xe97}, {0xe99, 0xe9f}, - {0xea1, 0xea3}, {0xead, 0xeb0}, {0xec0, 0xec4}, {0xedc, 0xedf}, - {0xf40, 0xf47}, {0xf49, 0xf6c}, {0xf88, 0xf8c}, {0x1000, 0x102a}, - {0x1050, 0x1055}, {0x105a, 0x105d}, {0x106e, 0x1070}, {0x1075, 0x1081}, - {0x10a0, 0x10c5}, {0x10d0, 0x10fa}, {0x10fc, 0x1248}, {0x124a, 0x124d}, - {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, - {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5}, - {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, - {0x1380, 0x138f}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, {0x1401, 0x166c}, - {0x166f, 0x167f}, {0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x16f1, 0x16f8}, - {0x1700, 0x170c}, {0x170e, 0x1711}, {0x1720, 0x1731}, {0x1740, 0x1751}, - {0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17b3}, {0x1820, 0x1877}, - {0x1880, 0x1884}, {0x1887, 0x18a8}, {0x18b0, 0x18f5}, {0x1900, 0x191e}, - {0x1950, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9}, - {0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1b05, 0x1b33}, {0x1b45, 0x1b4b}, - {0x1b83, 0x1ba0}, {0x1bba, 0x1be5}, {0x1c00, 0x1c23}, {0x1c4d, 0x1c4f}, - {0x1c5a, 0x1c7d}, {0x1c80, 0x1c88}, {0x1ce9, 0x1cec}, {0x1cee, 0x1cf1}, - {0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, - {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, - {0x1fb6, 0x1fbc}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, - {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, - {0x2090, 0x209c}, {0x210a, 0x2113}, {0x2119, 0x211d}, {0x212a, 0x212d}, - {0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149}, {0x2c00, 0x2c2e}, - {0x2c30, 0x2c5e}, {0x2c60, 0x2ce4}, {0x2ceb, 0x2cee}, {0x2d00, 0x2d25}, - {0x2d30, 0x2d67}, {0x2d80, 0x2d96}, {0x2da0, 0x2da6}, {0x2da8, 0x2dae}, - {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, {0x2dc8, 0x2dce}, - {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x3031, 0x3035}, {0x3041, 0x3096}, - {0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff}, {0x3105, 0x312d}, - {0x3131, 0x318e}, {0x31a0, 0x31ba}, {0x31f0, 0x31ff}, {0x3400, 0x4db5}, - {0x4e00, 0x9fd5}, {0xa000, 0xa48c}, {0xa4d0, 0xa4fd}, {0xa500, 0xa60c}, - {0xa610, 0xa61f}, {0xa640, 0xa66e}, {0xa67f, 0xa69d}, {0xa6a0, 0xa6e5}, - {0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa7ae}, {0xa7b0, 0xa7b7}, - {0xa7f7, 0xa801}, {0xa803, 0xa805}, {0xa807, 0xa80a}, {0xa80c, 0xa822}, - {0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7}, {0xa90a, 0xa925}, - {0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2}, {0xa9e0, 0xa9e4}, - {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, {0xaa00, 0xaa28}, {0xaa40, 0xaa42}, - {0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7e, 0xaaaf}, {0xaab9, 0xaabd}, - {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4}, {0xab01, 0xab06}, - {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e}, - {0xab30, 0xab5a}, {0xab5c, 0xab65}, {0xab70, 0xabe2}, {0xac00, 0xd7a3}, - {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xdc00, 0xdc3e}, {0xdc40, 0xdc7e}, - {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, {0xdd00, 0xdd3e}, {0xdd40, 0xdd7e}, - {0xdd80, 0xddbe}, {0xddc0, 0xddfe}, {0xde00, 0xde3e}, {0xde40, 0xde7e}, - {0xde80, 0xdebe}, {0xdec0, 0xdefe}, {0xdf00, 0xdf3e}, {0xdf40, 0xdf7e}, - {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, - {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, - {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f}, - {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, {0xfe76, 0xfefc}, - {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, {0xffc2, 0xffc7}, - {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc} + {0x800, 0x815}, {0x840, 0x858}, {0x860, 0x86a}, {0x8a0, 0x8b4}, + {0x8b6, 0x8bd}, {0x904, 0x939}, {0x958, 0x961}, {0x971, 0x980}, + {0x985, 0x98c}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, + {0x9df, 0x9e1}, {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, + {0xa59, 0xa5c}, {0xa72, 0xa74}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, + {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab5, 0xab9}, {0xb05, 0xb0c}, + {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb35, 0xb39}, {0xb5f, 0xb61}, + {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xba8, 0xbaa}, + {0xbae, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, + {0xc2a, 0xc39}, {0xc58, 0xc5a}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, + {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xd05, 0xd0c}, + {0xd0e, 0xd10}, {0xd12, 0xd3a}, {0xd54, 0xd56}, {0xd5f, 0xd61}, + {0xd7a, 0xd7f}, {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, + {0xdc0, 0xdc6}, {0xe01, 0xe30}, {0xe40, 0xe46}, {0xe94, 0xe97}, + {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xead, 0xeb0}, {0xec0, 0xec4}, + {0xedc, 0xedf}, {0xf40, 0xf47}, {0xf49, 0xf6c}, {0xf88, 0xf8c}, + {0x1000, 0x102a}, {0x1050, 0x1055}, {0x105a, 0x105d}, {0x106e, 0x1070}, + {0x1075, 0x1081}, {0x10a0, 0x10c5}, {0x10d0, 0x10fa}, {0x10fc, 0x1248}, + {0x124a, 0x124d}, {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, + {0x128a, 0x128d}, {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, + {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, + {0x1318, 0x135a}, {0x1380, 0x138f}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, + {0x1401, 0x166c}, {0x166f, 0x167f}, {0x1681, 0x169a}, {0x16a0, 0x16ea}, + {0x16f1, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1711}, {0x1720, 0x1731}, + {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17b3}, + {0x1820, 0x1877}, {0x1880, 0x1884}, {0x1887, 0x18a8}, {0x18b0, 0x18f5}, + {0x1900, 0x191e}, {0x1950, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab}, + {0x19b0, 0x19c9}, {0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1b05, 0x1b33}, + {0x1b45, 0x1b4b}, {0x1b83, 0x1ba0}, {0x1bba, 0x1be5}, {0x1c00, 0x1c23}, + {0x1c4d, 0x1c4f}, {0x1c5a, 0x1c7d}, {0x1c80, 0x1c88}, {0x1ce9, 0x1cec}, + {0x1cee, 0x1cf1}, {0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d}, + {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, + {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, + {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, + {0x1ff6, 0x1ffc}, {0x2090, 0x209c}, {0x210a, 0x2113}, {0x2119, 0x211d}, + {0x212a, 0x212d}, {0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149}, + {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2ce4}, {0x2ceb, 0x2cee}, + {0x2d00, 0x2d25}, {0x2d30, 0x2d67}, {0x2d80, 0x2d96}, {0x2da0, 0x2da6}, + {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, + {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x3031, 0x3035}, + {0x3041, 0x3096}, {0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff}, + {0x3105, 0x312e}, {0x3131, 0x318e}, {0x31a0, 0x31ba}, {0x31f0, 0x31ff}, + {0x3400, 0x4db5}, {0x4e00, 0x9fea}, {0xa000, 0xa48c}, {0xa4d0, 0xa4fd}, + {0xa500, 0xa60c}, {0xa610, 0xa61f}, {0xa640, 0xa66e}, {0xa67f, 0xa69d}, + {0xa6a0, 0xa6e5}, {0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa7ae}, + {0xa7b0, 0xa7b7}, {0xa7f7, 0xa801}, {0xa803, 0xa805}, {0xa807, 0xa80a}, + {0xa80c, 0xa822}, {0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7}, + {0xa90a, 0xa925}, {0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2}, + {0xa9e0, 0xa9e4}, {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, {0xaa00, 0xaa28}, + {0xaa40, 0xaa42}, {0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7e, 0xaaaf}, + {0xaab9, 0xaabd}, {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4}, + {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, + {0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab65}, {0xab70, 0xabe2}, + {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xf900, 0xfa6d}, + {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28}, + {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, + {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, + {0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, + {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc} #if TCL_UTF_MAX > 4 - ,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d}, - {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10280, 0x1029c}, {0x102a0, 0x102d0}, - {0x10300, 0x1031f}, {0x10330, 0x10340}, {0x10342, 0x10349}, {0x10350, 0x10375}, - {0x10380, 0x1039d}, {0x103a0, 0x103c3}, {0x103c8, 0x103cf}, {0x10400, 0x1049d}, - {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, {0x10500, 0x10527}, {0x10530, 0x10563}, - {0x10600, 0x10736}, {0x10740, 0x10755}, {0x10760, 0x10767}, {0x10800, 0x10805}, - {0x1080a, 0x10835}, {0x1083f, 0x10855}, {0x10860, 0x10876}, {0x10880, 0x1089e}, - {0x108e0, 0x108f2}, {0x10900, 0x10915}, {0x10920, 0x10939}, {0x10980, 0x109b7}, - {0x10a10, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33}, {0x10a60, 0x10a7c}, - {0x10a80, 0x10a9c}, {0x10ac0, 0x10ac7}, {0x10ac9, 0x10ae4}, {0x10b00, 0x10b35}, - {0x10b40, 0x10b55}, {0x10b60, 0x10b72}, {0x10b80, 0x10b91}, {0x10c00, 0x10c48}, - {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x11003, 0x11037}, {0x11083, 0x110af}, - {0x110d0, 0x110e8}, {0x11103, 0x11126}, {0x11150, 0x11172}, {0x11183, 0x111b2}, - {0x111c1, 0x111c4}, {0x11200, 0x11211}, {0x11213, 0x1122b}, {0x11280, 0x11286}, - {0x1128a, 0x1128d}, {0x1128f, 0x1129d}, {0x1129f, 0x112a8}, {0x112b0, 0x112de}, - {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339}, - {0x1135d, 0x11361}, {0x11400, 0x11434}, {0x11447, 0x1144a}, {0x11480, 0x114af}, - {0x11580, 0x115ae}, {0x115d8, 0x115db}, {0x11600, 0x1162f}, {0x11680, 0x116aa}, - {0x11700, 0x11719}, {0x118a0, 0x118df}, {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, - {0x11c0a, 0x11c2e}, {0x11c72, 0x11c8f}, {0x12000, 0x12399}, {0x12480, 0x12543}, - {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e}, - {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f}, {0x16b40, 0x16b43}, {0x16b63, 0x16b77}, - {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44}, {0x16f93, 0x16f9f}, {0x17000, 0x187ec}, - {0x18800, 0x18af2}, {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, - {0x1bc90, 0x1bc99}, {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, - {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, - {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, - {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d6c0}, - {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734}, - {0x1d736, 0x1d74e}, {0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8}, - {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7cb}, {0x1e800, 0x1e8c4}, {0x1e900, 0x1e943}, - {0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, - {0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, - {0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, - {0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, - {0x2b740, 0x2b81d}, {0x2b820, 0x2cea1}, {0x2f800, 0x2fa1d} + ,{0x10041, 0x1005a}, {0x10061, 0x1007a}, {0x100c0, 0x100d6}, {0x100d8, 0x100f6}, + {0x100f8, 0x102c1}, {0x102c6, 0x102d1}, {0x102e0, 0x102e4}, {0x10370, 0x10374}, + {0x1037a, 0x1037d}, {0x10388, 0x1038a}, {0x1038e, 0x103a1}, {0x103a3, 0x103f5}, + {0x103f7, 0x10481}, {0x1048a, 0x1052f}, {0x10531, 0x10556}, {0x10561, 0x10587}, + {0x105d0, 0x105ea}, {0x105f0, 0x105f2}, {0x10620, 0x1064a}, {0x10671, 0x106d3}, + {0x106fa, 0x106fc}, {0x10712, 0x1072f}, {0x1074d, 0x107a5}, {0x107ca, 0x107ea}, + {0x10800, 0x10815}, {0x10840, 0x10858}, {0x10860, 0x1086a}, {0x108a0, 0x108b4}, + {0x108b6, 0x108bd}, {0x10904, 0x10939}, {0x10958, 0x10961}, {0x10971, 0x10980}, + {0x10985, 0x1098c}, {0x10993, 0x109a8}, {0x109aa, 0x109b0}, {0x109b6, 0x109b9}, + {0x109df, 0x109e1}, {0x10a05, 0x10a0a}, {0x10a13, 0x10a28}, {0x10a2a, 0x10a30}, + {0x10a59, 0x10a5c}, {0x10a72, 0x10a74}, {0x10a85, 0x10a8d}, {0x10a8f, 0x10a91}, + {0x10a93, 0x10aa8}, {0x10aaa, 0x10ab0}, {0x10ab5, 0x10ab9}, {0x10b05, 0x10b0c}, + {0x10b13, 0x10b28}, {0x10b2a, 0x10b30}, {0x10b35, 0x10b39}, {0x10b5f, 0x10b61}, + {0x10b85, 0x10b8a}, {0x10b8e, 0x10b90}, {0x10b92, 0x10b95}, {0x10ba8, 0x10baa}, + {0x10bae, 0x10bb9}, {0x10c05, 0x10c0c}, {0x10c0e, 0x10c10}, {0x10c12, 0x10c28}, + {0x10c2a, 0x10c39}, {0x10c58, 0x10c5a}, {0x10c85, 0x10c8c}, {0x10c8e, 0x10c90}, + {0x10c92, 0x10ca8}, {0x10caa, 0x10cb3}, {0x10cb5, 0x10cb9}, {0x10d05, 0x10d0c}, + {0x10d0e, 0x10d10}, {0x10d12, 0x10d3a}, {0x10d54, 0x10d56}, {0x10d5f, 0x10d61}, + {0x10d7a, 0x10d7f}, {0x10d85, 0x10d96}, {0x10d9a, 0x10db1}, {0x10db3, 0x10dbb}, + {0x10dc0, 0x10dc6}, {0x10e01, 0x10e30}, {0x10e40, 0x10e46}, {0x10e94, 0x10e97}, + {0x10e99, 0x10e9f}, {0x10ea1, 0x10ea3}, {0x10ead, 0x10eb0}, {0x10ec0, 0x10ec4}, + {0x10edc, 0x10edf}, {0x10f40, 0x10f47}, {0x10f49, 0x10f6c}, {0x10f88, 0x10f8c}, + {0x11000, 0x1102a}, {0x11050, 0x11055}, {0x1105a, 0x1105d}, {0x1106e, 0x11070}, + {0x11075, 0x11081}, {0x110a0, 0x110c5}, {0x110d0, 0x110fa}, {0x110fc, 0x11248}, + {0x1124a, 0x1124d}, {0x11250, 0x11256}, {0x1125a, 0x1125d}, {0x11260, 0x11288}, + {0x1128a, 0x1128d}, {0x11290, 0x112b0}, {0x112b2, 0x112b5}, {0x112b8, 0x112be}, + {0x112c2, 0x112c5}, {0x112c8, 0x112d6}, {0x112d8, 0x11310}, {0x11312, 0x11315}, + {0x11318, 0x1135a}, {0x11380, 0x1138f}, {0x113a0, 0x113f5}, {0x113f8, 0x113fd}, + {0x11401, 0x1166c}, {0x1166f, 0x1167f}, {0x11681, 0x1169a}, {0x116a0, 0x116ea}, + {0x116f1, 0x116f8}, {0x11700, 0x1170c}, {0x1170e, 0x11711}, {0x11720, 0x11731}, + {0x11740, 0x11751}, {0x11760, 0x1176c}, {0x1176e, 0x11770}, {0x11780, 0x117b3}, + {0x11820, 0x11877}, {0x11880, 0x11884}, {0x11887, 0x118a8}, {0x118b0, 0x118f5}, + {0x11900, 0x1191e}, {0x11950, 0x1196d}, {0x11970, 0x11974}, {0x11980, 0x119ab}, + {0x119b0, 0x119c9}, {0x11a00, 0x11a16}, {0x11a20, 0x11a54}, {0x11b05, 0x11b33}, + {0x11b45, 0x11b4b}, {0x11b83, 0x11ba0}, {0x11bba, 0x11be5}, {0x11c00, 0x11c23}, + {0x11c4d, 0x11c4f}, {0x11c5a, 0x11c7d}, {0x11c80, 0x11c88}, {0x11ce9, 0x11cec}, + {0x11cee, 0x11cf1}, {0x11d00, 0x11dbf}, {0x11e00, 0x11f15}, {0x11f18, 0x11f1d}, + {0x11f20, 0x11f45}, {0x11f48, 0x11f4d}, {0x11f50, 0x11f57}, {0x11f5f, 0x11f7d}, + {0x11f80, 0x11fb4}, {0x11fb6, 0x11fbc}, {0x11fc2, 0x11fc4}, {0x11fc6, 0x11fcc}, + {0x11fd0, 0x11fd3}, {0x11fd6, 0x11fdb}, {0x11fe0, 0x11fec}, {0x11ff2, 0x11ff4}, + {0x11ff6, 0x11ffc}, {0x12090, 0x1209c}, {0x1210a, 0x12113}, {0x12119, 0x1211d}, + {0x1212a, 0x1212d}, {0x1212f, 0x12139}, {0x1213c, 0x1213f}, {0x12145, 0x12149}, + {0x12c00, 0x12c2e}, {0x12c30, 0x12c5e}, {0x12c60, 0x12ce4}, {0x12ceb, 0x12cee}, + {0x12d00, 0x12d25}, {0x12d30, 0x12d67}, {0x12d80, 0x12d96}, {0x12da0, 0x12da6}, + {0x12da8, 0x12dae}, {0x12db0, 0x12db6}, {0x12db8, 0x12dbe}, {0x12dc0, 0x12dc6}, + {0x12dc8, 0x12dce}, {0x12dd0, 0x12dd6}, {0x12dd8, 0x12dde}, {0x13031, 0x13035}, + {0x13041, 0x13096}, {0x1309d, 0x1309f}, {0x130a1, 0x130fa}, {0x130fc, 0x130ff}, + {0x13105, 0x1312e}, {0x13131, 0x1318e}, {0x131a0, 0x131ba}, {0x131f0, 0x131ff}, + {0x13400, 0x14db5}, {0x14e00, 0x19fea}, {0x1a000, 0x1a48c}, {0x1a4d0, 0x1a4fd}, + {0x1a500, 0x1a60c}, {0x1a610, 0x1a61f}, {0x1a640, 0x1a66e}, {0x1a67f, 0x1a69d}, + {0x1a6a0, 0x1a6e5}, {0x1a717, 0x1a71f}, {0x1a722, 0x1a788}, {0x1a78b, 0x1a7ae}, + {0x1a7b0, 0x1a7b7}, {0x1a7f7, 0x1a801}, {0x1a803, 0x1a805}, {0x1a807, 0x1a80a}, + {0x1a80c, 0x1a822}, {0x1a840, 0x1a873}, {0x1a882, 0x1a8b3}, {0x1a8f2, 0x1a8f7}, + {0x1a90a, 0x1a925}, {0x1a930, 0x1a946}, {0x1a960, 0x1a97c}, {0x1a984, 0x1a9b2}, + {0x1a9e0, 0x1a9e4}, {0x1a9e6, 0x1a9ef}, {0x1a9fa, 0x1a9fe}, {0x1aa00, 0x1aa28}, + {0x1aa40, 0x1aa42}, {0x1aa44, 0x1aa4b}, {0x1aa60, 0x1aa76}, {0x1aa7e, 0x1aaaf}, + {0x1aab9, 0x1aabd}, {0x1aadb, 0x1aadd}, {0x1aae0, 0x1aaea}, {0x1aaf2, 0x1aaf4}, + {0x1ab01, 0x1ab06}, {0x1ab09, 0x1ab0e}, {0x1ab11, 0x1ab16}, {0x1ab20, 0x1ab26}, + {0x1ab28, 0x1ab2e}, {0x1ab30, 0x1ab5a}, {0x1ab5c, 0x1ab65}, {0x1ab70, 0x1abe2}, + {0x1ac00, 0x1d7a3}, {0x1d7b0, 0x1d7c6}, {0x1d7cb, 0x1d7fb}, {0x1f900, 0x1fa6d}, + {0x1fa70, 0x1fad9}, {0x1fb00, 0x1fb06}, {0x1fb13, 0x1fb17}, {0x1fb1f, 0x1fb28}, + {0x1fb2a, 0x1fb36}, {0x1fb38, 0x1fb3c}, {0x1fb46, 0x1fbb1}, {0x1fbd3, 0x1fd3d}, + {0x1fd50, 0x1fd8f}, {0x1fd92, 0x1fdc7}, {0x1fdf0, 0x1fdfb}, {0x1fe70, 0x1fe74}, + {0x1fe76, 0x1fefc}, {0x1ff21, 0x1ff3a}, {0x1ff41, 0x1ff5a}, {0x1ff66, 0x1ffbe}, + {0x1ffc2, 0x1ffc7}, {0x1ffca, 0x1ffcf}, {0x1ffd2, 0x1ffd7}, {0x1ffda, 0x1ffdc}, + {0x20041, 0x2005a}, {0x20061, 0x2007a}, {0x200c0, 0x200d6}, {0x200d8, 0x200f6}, + {0x200f8, 0x202c1}, {0x202c6, 0x202d1}, {0x202e0, 0x202e4}, {0x20370, 0x20374}, + {0x2037a, 0x2037d}, {0x20388, 0x2038a}, {0x2038e, 0x203a1}, {0x203a3, 0x203f5}, + {0x203f7, 0x20481}, {0x2048a, 0x2052f}, {0x20531, 0x20556}, {0x20561, 0x20587}, + {0x205d0, 0x205ea}, {0x205f0, 0x205f2}, {0x20620, 0x2064a}, {0x20671, 0x206d3}, + {0x206fa, 0x206fc}, {0x20712, 0x2072f}, {0x2074d, 0x207a5}, {0x207ca, 0x207ea}, + {0x20800, 0x20815}, {0x20840, 0x20858}, {0x20860, 0x2086a}, {0x208a0, 0x208b4}, + {0x208b6, 0x208bd}, {0x20904, 0x20939}, {0x20958, 0x20961}, {0x20971, 0x20980}, + {0x20985, 0x2098c}, {0x20993, 0x209a8}, {0x209aa, 0x209b0}, {0x209b6, 0x209b9}, + {0x209df, 0x209e1}, {0x20a05, 0x20a0a}, {0x20a13, 0x20a28}, {0x20a2a, 0x20a30}, + {0x20a59, 0x20a5c}, {0x20a72, 0x20a74}, {0x20a85, 0x20a8d}, {0x20a8f, 0x20a91}, + {0x20a93, 0x20aa8}, {0x20aaa, 0x20ab0}, {0x20ab5, 0x20ab9}, {0x20b05, 0x20b0c}, + {0x20b13, 0x20b28}, {0x20b2a, 0x20b30}, {0x20b35, 0x20b39}, {0x20b5f, 0x20b61}, + {0x20b85, 0x20b8a}, {0x20b8e, 0x20b90}, {0x20b92, 0x20b95}, {0x20ba8, 0x20baa}, + {0x20bae, 0x20bb9}, {0x20c05, 0x20c0c}, {0x20c0e, 0x20c10}, {0x20c12, 0x20c28}, + {0x20c2a, 0x20c39}, {0x20c58, 0x20c5a}, {0x20c85, 0x20c8c}, {0x20c8e, 0x20c90}, + {0x20c92, 0x20ca8}, {0x20caa, 0x20cb3}, {0x20cb5, 0x20cb9}, {0x20d05, 0x20d0c}, + {0x20d0e, 0x20d10}, {0x20d12, 0x20d3a}, {0x20d54, 0x20d56}, {0x20d5f, 0x20d61}, + {0x20d7a, 0x20d7f}, {0x20d85, 0x20d96}, {0x20d9a, 0x20db1}, {0x20db3, 0x20dbb}, + {0x20dc0, 0x20dc6}, {0x20e01, 0x20e30}, {0x20e40, 0x20e46}, {0x20e94, 0x20e97}, + {0x20e99, 0x20e9f}, {0x20ea1, 0x20ea3}, {0x20ead, 0x20eb0}, {0x20ec0, 0x20ec4}, + {0x20edc, 0x20edf}, {0x20f40, 0x20f47}, {0x20f49, 0x20f6c}, {0x20f88, 0x20f8c}, + {0x21000, 0x2102a}, {0x21050, 0x21055}, {0x2105a, 0x2105d}, {0x2106e, 0x21070}, + {0x21075, 0x21081}, {0x210a0, 0x210c5}, {0x210d0, 0x210fa}, {0x210fc, 0x21248}, + {0x2124a, 0x2124d}, {0x21250, 0x21256}, {0x2125a, 0x2125d}, {0x21260, 0x21288}, + {0x2128a, 0x2128d}, {0x21290, 0x212b0}, {0x212b2, 0x212b5}, {0x212b8, 0x212be}, + {0x212c2, 0x212c5}, {0x212c8, 0x212d6}, {0x212d8, 0x21310}, {0x21312, 0x21315}, + {0x21318, 0x2135a}, {0x21380, 0x2138f}, {0x213a0, 0x213f5}, {0x213f8, 0x213fd}, + {0x21401, 0x2166c}, {0x2166f, 0x2167f}, {0x21681, 0x2169a}, {0x216a0, 0x216ea}, + {0x216f1, 0x216f8}, {0x21700, 0x2170c}, {0x2170e, 0x21711}, {0x21720, 0x21731}, + {0x21740, 0x21751}, {0x21760, 0x2176c}, {0x2176e, 0x21770}, {0x21780, 0x217b3}, + {0x21820, 0x21877}, {0x21880, 0x21884}, {0x21887, 0x218a8}, {0x218b0, 0x218f5}, + {0x21900, 0x2191e}, {0x21950, 0x2196d}, {0x21970, 0x21974}, {0x21980, 0x219ab}, + {0x219b0, 0x219c9}, {0x21a00, 0x21a16}, {0x21a20, 0x21a54}, {0x21b05, 0x21b33}, + {0x21b45, 0x21b4b}, {0x21b83, 0x21ba0}, {0x21bba, 0x21be5}, {0x21c00, 0x21c23}, + {0x21c4d, 0x21c4f}, {0x21c5a, 0x21c7d}, {0x21c80, 0x21c88}, {0x21ce9, 0x21cec}, + {0x21cee, 0x21cf1}, {0x21d00, 0x21dbf}, {0x21e00, 0x21f15}, {0x21f18, 0x21f1d}, + {0x21f20, 0x21f45}, {0x21f48, 0x21f4d}, {0x21f50, 0x21f57}, {0x21f5f, 0x21f7d}, + {0x21f80, 0x21fb4}, {0x21fb6, 0x21fbc}, {0x21fc2, 0x21fc4}, {0x21fc6, 0x21fcc}, + {0x21fd0, 0x21fd3}, {0x21fd6, 0x21fdb}, {0x21fe0, 0x21fec}, {0x21ff2, 0x21ff4}, + {0x21ff6, 0x21ffc}, {0x22090, 0x2209c}, {0x2210a, 0x22113}, {0x22119, 0x2211d}, + {0x2212a, 0x2212d}, {0x2212f, 0x22139}, {0x2213c, 0x2213f}, {0x22145, 0x22149}, + {0x22c00, 0x22c2e}, {0x22c30, 0x22c5e}, {0x22c60, 0x22ce4}, {0x22ceb, 0x22cee}, + {0x22d00, 0x22d25}, {0x22d30, 0x22d67}, {0x22d80, 0x22d96}, {0x22da0, 0x22da6}, + {0x22da8, 0x22dae}, {0x22db0, 0x22db6}, {0x22db8, 0x22dbe}, {0x22dc0, 0x22dc6}, + {0x22dc8, 0x22dce}, {0x22dd0, 0x22dd6}, {0x22dd8, 0x22dde}, {0x23031, 0x23035}, + {0x23041, 0x23096}, {0x2309d, 0x2309f}, {0x230a1, 0x230fa}, {0x230fc, 0x230ff}, + {0x23105, 0x2312e}, {0x23131, 0x2318e}, {0x231a0, 0x231ba}, {0x231f0, 0x231ff}, + {0x23400, 0x24db5}, {0x24e00, 0x29fea}, {0x2a000, 0x2a48c}, {0x2a4d0, 0x2a4fd}, + {0x2a500, 0x2a60c}, {0x2a610, 0x2a61f}, {0x2a640, 0x2a66e}, {0x2a67f, 0x2a69d}, + {0x2a6a0, 0x2a6e5}, {0x2a717, 0x2a71f}, {0x2a722, 0x2a788}, {0x2a78b, 0x2a7ae}, + {0x2a7b0, 0x2a7b7}, {0x2a7f7, 0x2a801}, {0x2a803, 0x2a805}, {0x2a807, 0x2a80a}, + {0x2a80c, 0x2a822}, {0x2a840, 0x2a873}, {0x2a882, 0x2a8b3}, {0x2a8f2, 0x2a8f7}, + {0x2a90a, 0x2a925}, {0x2a930, 0x2a946}, {0x2a960, 0x2a97c}, {0x2a984, 0x2a9b2}, + {0x2a9e0, 0x2a9e4}, {0x2a9e6, 0x2a9ef}, {0x2a9fa, 0x2a9fe}, {0x2aa00, 0x2aa28}, + {0x2aa40, 0x2aa42}, {0x2aa44, 0x2aa4b}, {0x2aa60, 0x2aa76}, {0x2aa7e, 0x2aaaf}, + {0x2aab9, 0x2aabd}, {0x2aadb, 0x2aadd}, {0x2aae0, 0x2aaea}, {0x2aaf2, 0x2aaf4}, + {0x2ab01, 0x2ab06}, {0x2ab09, 0x2ab0e}, {0x2ab11, 0x2ab16}, {0x2ab20, 0x2ab26}, + {0x2ab28, 0x2ab2e}, {0x2ab30, 0x2ab5a}, {0x2ab5c, 0x2ab65}, {0x2ab70, 0x2abe2}, + {0x2ac00, 0x2d7a3}, {0x2d7b0, 0x2d7c6}, {0x2d7cb, 0x2d7fb}, {0x2f900, 0x2fa6d}, + {0x2fa70, 0x2fad9}, {0x2fb00, 0x2fb06}, {0x2fb13, 0x2fb17}, {0x2fb1f, 0x2fb28}, + {0x2fb2a, 0x2fb36}, {0x2fb38, 0x2fb3c}, {0x2fb46, 0x2fbb1}, {0x2fbd3, 0x2fd3d}, + {0x2fd50, 0x2fd8f}, {0x2fd92, 0x2fdc7}, {0x2fdf0, 0x2fdfb}, {0x2fe70, 0x2fe74}, + {0x2fe76, 0x2fefc}, {0x2ff21, 0x2ff3a}, {0x2ff41, 0x2ff5a}, {0x2ff66, 0x2ffbe}, + {0x2ffc2, 0x2ffc7}, {0x2ffca, 0x2ffcf}, {0x2ffd2, 0x2ffd7}, {0x2ffda, 0x2ffdc}, + {0x30041, 0x3005a}, {0x30061, 0x3007a}, {0x300c0, 0x300d6}, {0x300d8, 0x300f6}, + {0x300f8, 0x302c1}, {0x302c6, 0x302d1}, {0x302e0, 0x302e4}, {0x30370, 0x30374}, + {0x3037a, 0x3037d}, {0x30388, 0x3038a}, {0x3038e, 0x303a1}, {0x303a3, 0x303f5}, + {0x303f7, 0x30481}, {0x3048a, 0x3052f}, {0x30531, 0x30556}, {0x30561, 0x30587}, + {0x305d0, 0x305ea}, {0x305f0, 0x305f2}, {0x30620, 0x3064a}, {0x30671, 0x306d3}, + {0x306fa, 0x306fc}, {0x30712, 0x3072f}, {0x3074d, 0x307a5}, {0x307ca, 0x307ea}, + {0x30800, 0x30815}, {0x30840, 0x30858}, {0x30860, 0x3086a}, {0x308a0, 0x308b4}, + {0x308b6, 0x308bd}, {0x30904, 0x30939}, {0x30958, 0x30961}, {0x30971, 0x30980}, + {0x30985, 0x3098c}, {0x30993, 0x309a8}, {0x309aa, 0x309b0}, {0x309b6, 0x309b9}, + {0x309df, 0x309e1}, {0x30a05, 0x30a0a}, {0x30a13, 0x30a28}, {0x30a2a, 0x30a30}, + {0x30a59, 0x30a5c}, {0x30a72, 0x30a74}, {0x30a85, 0x30a8d}, {0x30a8f, 0x30a91}, + {0x30a93, 0x30aa8}, {0x30aaa, 0x30ab0}, {0x30ab5, 0x30ab9}, {0x30b05, 0x30b0c}, + {0x30b13, 0x30b28}, {0x30b2a, 0x30b30}, {0x30b35, 0x30b39}, {0x30b5f, 0x30b61}, + {0x30b85, 0x30b8a}, {0x30b8e, 0x30b90}, {0x30b92, 0x30b95}, {0x30ba8, 0x30baa}, + {0x30bae, 0x30bb9}, {0x30c05, 0x30c0c}, {0x30c0e, 0x30c10}, {0x30c12, 0x30c28}, + {0x30c2a, 0x30c39}, {0x30c58, 0x30c5a}, {0x30c85, 0x30c8c}, {0x30c8e, 0x30c90}, + {0x30c92, 0x30ca8}, {0x30caa, 0x30cb3}, {0x30cb5, 0x30cb9}, {0x30d05, 0x30d0c}, + {0x30d0e, 0x30d10}, {0x30d12, 0x30d3a}, {0x30d54, 0x30d56}, {0x30d5f, 0x30d61}, + {0x30d7a, 0x30d7f}, {0x30d85, 0x30d96}, {0x30d9a, 0x30db1}, {0x30db3, 0x30dbb}, + {0x30dc0, 0x30dc6}, {0x30e01, 0x30e30}, {0x30e40, 0x30e46}, {0x30e94, 0x30e97}, + {0x30e99, 0x30e9f}, {0x30ea1, 0x30ea3}, {0x30ead, 0x30eb0}, {0x30ec0, 0x30ec4}, + {0x30edc, 0x30edf}, {0x30f40, 0x30f47}, {0x30f49, 0x30f6c}, {0x30f88, 0x30f8c}, + {0x31000, 0x3102a}, {0x31050, 0x31055}, {0x3105a, 0x3105d}, {0x3106e, 0x31070}, + {0x31075, 0x31081}, {0x310a0, 0x310c5}, {0x310d0, 0x310fa}, {0x310fc, 0x31248}, + {0x3124a, 0x3124d}, {0x31250, 0x31256}, {0x3125a, 0x3125d}, {0x31260, 0x31288}, + {0x3128a, 0x3128d}, {0x31290, 0x312b0}, {0x312b2, 0x312b5}, {0x312b8, 0x312be}, + {0x312c2, 0x312c5}, {0x312c8, 0x312d6}, {0x312d8, 0x31310}, {0x31312, 0x31315}, + {0x31318, 0x3135a}, {0x31380, 0x3138f}, {0x313a0, 0x313f5}, {0x313f8, 0x313fd}, + {0x31401, 0x3166c}, {0x3166f, 0x3167f}, {0x31681, 0x3169a}, {0x316a0, 0x316ea}, + {0x316f1, 0x316f8}, {0x31700, 0x3170c}, {0x3170e, 0x31711}, {0x31720, 0x31731}, + {0x31740, 0x31751}, {0x31760, 0x3176c}, {0x3176e, 0x31770}, {0x31780, 0x317b3}, + {0x31820, 0x31877}, {0x31880, 0x31884}, {0x31887, 0x318a8}, {0x318b0, 0x318f5}, + {0x31900, 0x3191e}, {0x31950, 0x3196d}, {0x31970, 0x31974}, {0x31980, 0x319ab}, + {0x319b0, 0x319c9}, {0x31a00, 0x31a16}, {0x31a20, 0x31a54}, {0x31b05, 0x31b33}, + {0x31b45, 0x31b4b}, {0x31b83, 0x31ba0}, {0x31bba, 0x31be5}, {0x31c00, 0x31c23}, + {0x31c4d, 0x31c4f}, {0x31c5a, 0x31c7d}, {0x31c80, 0x31c88}, {0x31ce9, 0x31cec}, + {0x31cee, 0x31cf1}, {0x31d00, 0x31dbf}, {0x31e00, 0x31f15}, {0x31f18, 0x31f1d}, + {0x31f20, 0x31f45}, {0x31f48, 0x31f4d}, {0x31f50, 0x31f57}, {0x31f5f, 0x31f7d}, + {0x31f80, 0x31fb4}, {0x31fb6, 0x31fbc}, {0x31fc2, 0x31fc4}, {0x31fc6, 0x31fcc}, + {0x31fd0, 0x31fd3}, {0x31fd6, 0x31fdb}, {0x31fe0, 0x31fec}, {0x31ff2, 0x31ff4}, + {0x31ff6, 0x31ffc}, {0x32090, 0x3209c}, {0x3210a, 0x32113}, {0x32119, 0x3211d}, + {0x3212a, 0x3212d}, {0x3212f, 0x32139}, {0x3213c, 0x3213f}, {0x32145, 0x32149}, + {0x32c00, 0x32c2e}, {0x32c30, 0x32c5e}, {0x32c60, 0x32ce4}, {0x32ceb, 0x32cee}, + {0x32d00, 0x32d25}, {0x32d30, 0x32d67}, {0x32d80, 0x32d96}, {0x32da0, 0x32da6}, + {0x32da8, 0x32dae}, {0x32db0, 0x32db6}, {0x32db8, 0x32dbe}, {0x32dc0, 0x32dc6}, + {0x32dc8, 0x32dce}, {0x32dd0, 0x32dd6}, {0x32dd8, 0x32dde}, {0x33031, 0x33035}, + {0x33041, 0x33096}, {0x3309d, 0x3309f}, {0x330a1, 0x330fa}, {0x330fc, 0x330ff}, + {0x33105, 0x3312e}, {0x33131, 0x3318e}, {0x331a0, 0x331ba}, {0x331f0, 0x331ff}, + {0x33400, 0x34db5}, {0x34e00, 0x39fea}, {0x3a000, 0x3a48c}, {0x3a4d0, 0x3a4fd}, + {0x3a500, 0x3a60c}, {0x3a610, 0x3a61f}, {0x3a640, 0x3a66e}, {0x3a67f, 0x3a69d}, + {0x3a6a0, 0x3a6e5}, {0x3a717, 0x3a71f}, {0x3a722, 0x3a788}, {0x3a78b, 0x3a7ae}, + {0x3a7b0, 0x3a7b7}, {0x3a7f7, 0x3a801}, {0x3a803, 0x3a805}, {0x3a807, 0x3a80a}, + {0x3a80c, 0x3a822}, {0x3a840, 0x3a873}, {0x3a882, 0x3a8b3}, {0x3a8f2, 0x3a8f7}, + {0x3a90a, 0x3a925}, {0x3a930, 0x3a946}, {0x3a960, 0x3a97c}, {0x3a984, 0x3a9b2}, + {0x3a9e0, 0x3a9e4}, {0x3a9e6, 0x3a9ef}, {0x3a9fa, 0x3a9fe}, {0x3aa00, 0x3aa28}, + {0x3aa40, 0x3aa42}, {0x3aa44, 0x3aa4b}, {0x3aa60, 0x3aa76}, {0x3aa7e, 0x3aaaf}, + {0x3aab9, 0x3aabd}, {0x3aadb, 0x3aadd}, {0x3aae0, 0x3aaea}, {0x3aaf2, 0x3aaf4}, + {0x3ab01, 0x3ab06}, {0x3ab09, 0x3ab0e}, {0x3ab11, 0x3ab16}, {0x3ab20, 0x3ab26}, + {0x3ab28, 0x3ab2e}, {0x3ab30, 0x3ab5a}, {0x3ab5c, 0x3ab65}, {0x3ab70, 0x3abe2}, + {0x3ac00, 0x3d7a3}, {0x3d7b0, 0x3d7c6}, {0x3d7cb, 0x3d7fb}, {0x3f900, 0x3fa6d}, + {0x3fa70, 0x3fad9}, {0x3fb00, 0x3fb06}, {0x3fb13, 0x3fb17}, {0x3fb1f, 0x3fb28}, + {0x3fb2a, 0x3fb36}, {0x3fb38, 0x3fb3c}, {0x3fb46, 0x3fbb1}, {0x3fbd3, 0x3fd3d}, + {0x3fd50, 0x3fd8f}, {0x3fd92, 0x3fdc7}, {0x3fdf0, 0x3fdfb}, {0x3fe70, 0x3fe74}, + {0x3fe76, 0x3fefc}, {0x3ff21, 0x3ff3a}, {0x3ff41, 0x3ff5a}, {0x3ff66, 0x3ffbe}, + {0x3ffc2, 0x3ffc7}, {0x3ffca, 0x3ffcf}, {0x3ffd2, 0x3ffd7}, {0x3ffda, 0x3ffdc}, + {0x40041, 0x4005a}, {0x40061, 0x4007a}, {0x400c0, 0x400d6}, {0x400d8, 0x400f6}, + {0x400f8, 0x402c1}, {0x402c6, 0x402d1}, {0x402e0, 0x402e4}, {0x40370, 0x40374}, + {0x4037a, 0x4037d}, {0x40388, 0x4038a}, {0x4038e, 0x403a1}, {0x403a3, 0x403f5}, + {0x403f7, 0x40481}, {0x4048a, 0x4052f}, {0x40531, 0x40556}, {0x40561, 0x40587}, + {0x405d0, 0x405ea}, {0x405f0, 0x405f2}, {0x40620, 0x4064a}, {0x40671, 0x406d3}, + {0x406fa, 0x406fc}, {0x40712, 0x4072f}, {0x4074d, 0x407a5}, {0x407ca, 0x407ea}, + {0x40800, 0x40815}, {0x40840, 0x40858}, {0x40860, 0x4086a}, {0x408a0, 0x408b4}, + {0x408b6, 0x408bd}, {0x40904, 0x40939}, {0x40958, 0x40961}, {0x40971, 0x40980}, + {0x40985, 0x4098c}, {0x40993, 0x409a8}, {0x409aa, 0x409b0}, {0x409b6, 0x409b9}, + {0x409df, 0x409e1}, {0x40a05, 0x40a0a}, {0x40a13, 0x40a28}, {0x40a2a, 0x40a30}, + {0x40a59, 0x40a5c}, {0x40a72, 0x40a74}, {0x40a85, 0x40a8d}, {0x40a8f, 0x40a91}, + {0x40a93, 0x40aa8}, {0x40aaa, 0x40ab0}, {0x40ab5, 0x40ab9}, {0x40b05, 0x40b0c}, + {0x40b13, 0x40b28}, {0x40b2a, 0x40b30}, {0x40b35, 0x40b39}, {0x40b5f, 0x40b61}, + {0x40b85, 0x40b8a}, {0x40b8e, 0x40b90}, {0x40b92, 0x40b95}, {0x40ba8, 0x40baa}, + {0x40bae, 0x40bb9}, {0x40c05, 0x40c0c}, {0x40c0e, 0x40c10}, {0x40c12, 0x40c28}, + {0x40c2a, 0x40c39}, {0x40c58, 0x40c5a}, {0x40c85, 0x40c8c}, {0x40c8e, 0x40c90}, + {0x40c92, 0x40ca8}, {0x40caa, 0x40cb3}, {0x40cb5, 0x40cb9}, {0x40d05, 0x40d0c}, + {0x40d0e, 0x40d10}, {0x40d12, 0x40d3a}, {0x40d54, 0x40d56}, {0x40d5f, 0x40d61}, + {0x40d7a, 0x40d7f}, {0x40d85, 0x40d96}, {0x40d9a, 0x40db1}, {0x40db3, 0x40dbb}, + {0x40dc0, 0x40dc6}, {0x40e01, 0x40e30}, {0x40e40, 0x40e46}, {0x40e94, 0x40e97}, + {0x40e99, 0x40e9f}, {0x40ea1, 0x40ea3}, {0x40ead, 0x40eb0}, {0x40ec0, 0x40ec4}, + {0x40edc, 0x40edf}, {0x40f40, 0x40f47}, {0x40f49, 0x40f6c}, {0x40f88, 0x40f8c}, + {0x41000, 0x4102a}, {0x41050, 0x41055}, {0x4105a, 0x4105d}, {0x4106e, 0x41070}, + {0x41075, 0x41081}, {0x410a0, 0x410c5}, {0x410d0, 0x410fa}, {0x410fc, 0x41248}, + {0x4124a, 0x4124d}, {0x41250, 0x41256}, {0x4125a, 0x4125d}, {0x41260, 0x41288}, + {0x4128a, 0x4128d}, {0x41290, 0x412b0}, {0x412b2, 0x412b5}, {0x412b8, 0x412be}, + {0x412c2, 0x412c5}, {0x412c8, 0x412d6}, {0x412d8, 0x41310}, {0x41312, 0x41315}, + {0x41318, 0x4135a}, {0x41380, 0x4138f}, {0x413a0, 0x413f5}, {0x413f8, 0x413fd}, + {0x41401, 0x4166c}, {0x4166f, 0x4167f}, {0x41681, 0x4169a}, {0x416a0, 0x416ea}, + {0x416f1, 0x416f8}, {0x41700, 0x4170c}, {0x4170e, 0x41711}, {0x41720, 0x41731}, + {0x41740, 0x41751}, {0x41760, 0x4176c}, {0x4176e, 0x41770}, {0x41780, 0x417b3}, + {0x41820, 0x41877}, {0x41880, 0x41884}, {0x41887, 0x418a8}, {0x418b0, 0x418f5}, + {0x41900, 0x4191e}, {0x41950, 0x4196d}, {0x41970, 0x41974}, {0x41980, 0x419ab}, + {0x419b0, 0x419c9}, {0x41a00, 0x41a16}, {0x41a20, 0x41a54}, {0x41b05, 0x41b33}, + {0x41b45, 0x41b4b}, {0x41b83, 0x41ba0}, {0x41bba, 0x41be5}, {0x41c00, 0x41c23}, + {0x41c4d, 0x41c4f}, {0x41c5a, 0x41c7d}, {0x41c80, 0x41c88}, {0x41ce9, 0x41cec}, + {0x41cee, 0x41cf1}, {0x41d00, 0x41dbf}, {0x41e00, 0x41f15}, {0x41f18, 0x41f1d}, + {0x41f20, 0x41f45}, {0x41f48, 0x41f4d}, {0x41f50, 0x41f57}, {0x41f5f, 0x41f7d}, + {0x41f80, 0x41fb4}, {0x41fb6, 0x41fbc}, {0x41fc2, 0x41fc4}, {0x41fc6, 0x41fcc}, + {0x41fd0, 0x41fd3}, {0x41fd6, 0x41fdb}, {0x41fe0, 0x41fec}, {0x41ff2, 0x41ff4}, + {0x41ff6, 0x41ffc}, {0x42090, 0x4209c}, {0x4210a, 0x42113}, {0x42119, 0x4211d}, + {0x4212a, 0x4212d}, {0x4212f, 0x42139}, {0x4213c, 0x4213f}, {0x42145, 0x42149}, + {0x42c00, 0x42c2e}, {0x42c30, 0x42c5e}, {0x42c60, 0x42ce4}, {0x42ceb, 0x42cee}, + {0x42d00, 0x42d25}, {0x42d30, 0x42d67}, {0x42d80, 0x42d96}, {0x42da0, 0x42da6}, + {0x42da8, 0x42dae}, {0x42db0, 0x42db6}, {0x42db8, 0x42dbe}, {0x42dc0, 0x42dc6}, + {0x42dc8, 0x42dce}, {0x42dd0, 0x42dd6}, {0x42dd8, 0x42dde}, {0x43031, 0x43035}, + {0x43041, 0x43096}, {0x4309d, 0x4309f}, {0x430a1, 0x430fa}, {0x430fc, 0x430ff}, + {0x43105, 0x4312e}, {0x43131, 0x4318e}, {0x431a0, 0x431ba}, {0x431f0, 0x431ff}, + {0x43400, 0x44db5}, {0x44e00, 0x49fea}, {0x4a000, 0x4a48c}, {0x4a4d0, 0x4a4fd}, + {0x4a500, 0x4a60c}, {0x4a610, 0x4a61f}, {0x4a640, 0x4a66e}, {0x4a67f, 0x4a69d}, + {0x4a6a0, 0x4a6e5}, {0x4a717, 0x4a71f}, {0x4a722, 0x4a788}, {0x4a78b, 0x4a7ae}, + {0x4a7b0, 0x4a7b7}, {0x4a7f7, 0x4a801}, {0x4a803, 0x4a805}, {0x4a807, 0x4a80a}, + {0x4a80c, 0x4a822}, {0x4a840, 0x4a873}, {0x4a882, 0x4a8b3}, {0x4a8f2, 0x4a8f7}, + {0x4a90a, 0x4a925}, {0x4a930, 0x4a946}, {0x4a960, 0x4a97c}, {0x4a984, 0x4a9b2}, + {0x4a9e0, 0x4a9e4}, {0x4a9e6, 0x4a9ef}, {0x4a9fa, 0x4a9fe}, {0x4aa00, 0x4aa28}, + {0x4aa40, 0x4aa42}, {0x4aa44, 0x4aa4b}, {0x4aa60, 0x4aa76}, {0x4aa7e, 0x4aaaf}, + {0x4aab9, 0x4aabd}, {0x4aadb, 0x4aadd}, {0x4aae0, 0x4aaea}, {0x4aaf2, 0x4aaf4}, + {0x4ab01, 0x4ab06}, {0x4ab09, 0x4ab0e}, {0x4ab11, 0x4ab16}, {0x4ab20, 0x4ab26}, + {0x4ab28, 0x4ab2e}, {0x4ab30, 0x4ab5a}, {0x4ab5c, 0x4ab65}, {0x4ab70, 0x4abe2}, + {0x4ac00, 0x4d7a3}, {0x4d7b0, 0x4d7c6}, {0x4d7cb, 0x4d7fb}, {0x4f900, 0x4fa6d}, + {0x4fa70, 0x4fad9}, {0x4fb00, 0x4fb06}, {0x4fb13, 0x4fb17}, {0x4fb1f, 0x4fb28}, + {0x4fb2a, 0x4fb36}, {0x4fb38, 0x4fb3c}, {0x4fb46, 0x4fbb1}, {0x4fbd3, 0x4fd3d}, + {0x4fd50, 0x4fd8f}, {0x4fd92, 0x4fdc7}, {0x4fdf0, 0x4fdfb}, {0x4fe70, 0x4fe74}, + {0x4fe76, 0x4fefc}, {0x4ff21, 0x4ff3a}, {0x4ff41, 0x4ff5a}, {0x4ff66, 0x4ffbe}, + {0x4ffc2, 0x4ffc7}, {0x4ffca, 0x4ffcf}, {0x4ffd2, 0x4ffd7}, {0x4ffda, 0x4ffdc}, + {0x50041, 0x5005a}, {0x50061, 0x5007a}, {0x500c0, 0x500d6}, {0x500d8, 0x500f6}, + {0x500f8, 0x502c1}, {0x502c6, 0x502d1}, {0x502e0, 0x502e4}, {0x50370, 0x50374}, + {0x5037a, 0x5037d}, {0x50388, 0x5038a}, {0x5038e, 0x503a1}, {0x503a3, 0x503f5}, + {0x503f7, 0x50481}, {0x5048a, 0x5052f}, {0x50531, 0x50556}, {0x50561, 0x50587}, + {0x505d0, 0x505ea}, {0x505f0, 0x505f2}, {0x50620, 0x5064a}, {0x50671, 0x506d3}, + {0x506fa, 0x506fc}, {0x50712, 0x5072f}, {0x5074d, 0x507a5}, {0x507ca, 0x507ea}, + {0x50800, 0x50815}, {0x50840, 0x50858}, {0x50860, 0x5086a}, {0x508a0, 0x508b4}, + {0x508b6, 0x508bd}, {0x50904, 0x50939}, {0x50958, 0x50961}, {0x50971, 0x50980}, + {0x50985, 0x5098c}, {0x50993, 0x509a8}, {0x509aa, 0x509b0}, {0x509b6, 0x509b9}, + {0x509df, 0x509e1}, {0x50a05, 0x50a0a}, {0x50a13, 0x50a28}, {0x50a2a, 0x50a30}, + {0x50a59, 0x50a5c}, {0x50a72, 0x50a74}, {0x50a85, 0x50a8d}, {0x50a8f, 0x50a91}, + {0x50a93, 0x50aa8}, {0x50aaa, 0x50ab0}, {0x50ab5, 0x50ab9}, {0x50b05, 0x50b0c}, + {0x50b13, 0x50b28}, {0x50b2a, 0x50b30}, {0x50b35, 0x50b39}, {0x50b5f, 0x50b61}, + {0x50b85, 0x50b8a}, {0x50b8e, 0x50b90}, {0x50b92, 0x50b95}, {0x50ba8, 0x50baa}, + {0x50bae, 0x50bb9}, {0x50c05, 0x50c0c}, {0x50c0e, 0x50c10}, {0x50c12, 0x50c28}, + {0x50c2a, 0x50c39}, {0x50c58, 0x50c5a}, {0x50c85, 0x50c8c}, {0x50c8e, 0x50c90}, + {0x50c92, 0x50ca8}, {0x50caa, 0x50cb3}, {0x50cb5, 0x50cb9}, {0x50d05, 0x50d0c}, + {0x50d0e, 0x50d10}, {0x50d12, 0x50d3a}, {0x50d54, 0x50d56}, {0x50d5f, 0x50d61}, + {0x50d7a, 0x50d7f}, {0x50d85, 0x50d96}, {0x50d9a, 0x50db1}, {0x50db3, 0x50dbb}, + {0x50dc0, 0x50dc6}, {0x50e01, 0x50e30}, {0x50e40, 0x50e46}, {0x50e94, 0x50e97}, + {0x50e99, 0x50e9f}, {0x50ea1, 0x50ea3}, {0x50ead, 0x50eb0}, {0x50ec0, 0x50ec4}, + {0x50edc, 0x50edf}, {0x50f40, 0x50f47}, {0x50f49, 0x50f6c}, {0x50f88, 0x50f8c}, + {0x51000, 0x5102a}, {0x51050, 0x51055}, {0x5105a, 0x5105d}, {0x5106e, 0x51070}, + {0x51075, 0x51081}, {0x510a0, 0x510c5}, {0x510d0, 0x510fa}, {0x510fc, 0x51248}, + {0x5124a, 0x5124d}, {0x51250, 0x51256}, {0x5125a, 0x5125d}, {0x51260, 0x51288}, + {0x5128a, 0x5128d}, {0x51290, 0x512b0}, {0x512b2, 0x512b5}, {0x512b8, 0x512be}, + {0x512c2, 0x512c5}, {0x512c8, 0x512d6}, {0x512d8, 0x51310}, {0x51312, 0x51315}, + {0x51318, 0x5135a}, {0x51380, 0x5138f}, {0x513a0, 0x513f5}, {0x513f8, 0x513fd}, + {0x51401, 0x5166c}, {0x5166f, 0x5167f}, {0x51681, 0x5169a}, {0x516a0, 0x516ea}, + {0x516f1, 0x516f8}, {0x51700, 0x5170c}, {0x5170e, 0x51711}, {0x51720, 0x51731}, + {0x51740, 0x51751}, {0x51760, 0x5176c}, {0x5176e, 0x51770}, {0x51780, 0x517b3}, + {0x51820, 0x51877}, {0x51880, 0x51884}, {0x51887, 0x518a8}, {0x518b0, 0x518f5}, + {0x51900, 0x5191e}, {0x51950, 0x5196d}, {0x51970, 0x51974}, {0x51980, 0x519ab}, + {0x519b0, 0x519c9}, {0x51a00, 0x51a16}, {0x51a20, 0x51a54}, {0x51b05, 0x51b33}, + {0x51b45, 0x51b4b}, {0x51b83, 0x51ba0}, {0x51bba, 0x51be5}, {0x51c00, 0x51c23}, + {0x51c4d, 0x51c4f}, {0x51c5a, 0x51c7d}, {0x51c80, 0x51c88}, {0x51ce9, 0x51cec}, + {0x51cee, 0x51cf1}, {0x51d00, 0x51dbf}, {0x51e00, 0x51f15}, {0x51f18, 0x51f1d}, + {0x51f20, 0x51f45}, {0x51f48, 0x51f4d}, {0x51f50, 0x51f57}, {0x51f5f, 0x51f7d}, + {0x51f80, 0x51fb4}, {0x51fb6, 0x51fbc}, {0x51fc2, 0x51fc4}, {0x51fc6, 0x51fcc}, + {0x51fd0, 0x51fd3}, {0x51fd6, 0x51fdb}, {0x51fe0, 0x51fec}, {0x51ff2, 0x51ff4}, + {0x51ff6, 0x51ffc}, {0x52090, 0x5209c}, {0x5210a, 0x52113}, {0x52119, 0x5211d}, + {0x5212a, 0x5212d}, {0x5212f, 0x52139}, {0x5213c, 0x5213f}, {0x52145, 0x52149}, + {0x52c00, 0x52c2e}, {0x52c30, 0x52c5e}, {0x52c60, 0x52ce4}, {0x52ceb, 0x52cee}, + {0x52d00, 0x52d25}, {0x52d30, 0x52d67}, {0x52d80, 0x52d96}, {0x52da0, 0x52da6}, + {0x52da8, 0x52dae}, {0x52db0, 0x52db6}, {0x52db8, 0x52dbe}, {0x52dc0, 0x52dc6}, + {0x52dc8, 0x52dce}, {0x52dd0, 0x52dd6}, {0x52dd8, 0x52dde}, {0x53031, 0x53035}, + {0x53041, 0x53096}, {0x5309d, 0x5309f}, {0x530a1, 0x530fa}, {0x530fc, 0x530ff}, + {0x53105, 0x5312e}, {0x53131, 0x5318e}, {0x531a0, 0x531ba}, {0x531f0, 0x531ff}, + {0x53400, 0x54db5}, {0x54e00, 0x59fea}, {0x5a000, 0x5a48c}, {0x5a4d0, 0x5a4fd}, + {0x5a500, 0x5a60c}, {0x5a610, 0x5a61f}, {0x5a640, 0x5a66e}, {0x5a67f, 0x5a69d}, + {0x5a6a0, 0x5a6e5}, {0x5a717, 0x5a71f}, {0x5a722, 0x5a788}, {0x5a78b, 0x5a7ae}, + {0x5a7b0, 0x5a7b7}, {0x5a7f7, 0x5a801}, {0x5a803, 0x5a805}, {0x5a807, 0x5a80a}, + {0x5a80c, 0x5a822}, {0x5a840, 0x5a873}, {0x5a882, 0x5a8b3}, {0x5a8f2, 0x5a8f7}, + {0x5a90a, 0x5a925}, {0x5a930, 0x5a946}, {0x5a960, 0x5a97c}, {0x5a984, 0x5a9b2}, + {0x5a9e0, 0x5a9e4}, {0x5a9e6, 0x5a9ef}, {0x5a9fa, 0x5a9fe}, {0x5aa00, 0x5aa28}, + {0x5aa40, 0x5aa42}, {0x5aa44, 0x5aa4b}, {0x5aa60, 0x5aa76}, {0x5aa7e, 0x5aaaf}, + {0x5aab9, 0x5aabd}, {0x5aadb, 0x5aadd}, {0x5aae0, 0x5aaea}, {0x5aaf2, 0x5aaf4}, + {0x5ab01, 0x5ab06}, {0x5ab09, 0x5ab0e}, {0x5ab11, 0x5ab16}, {0x5ab20, 0x5ab26}, + {0x5ab28, 0x5ab2e}, {0x5ab30, 0x5ab5a}, {0x5ab5c, 0x5ab65}, {0x5ab70, 0x5abe2}, + {0x5ac00, 0x5d7a3}, {0x5d7b0, 0x5d7c6}, {0x5d7cb, 0x5d7fb}, {0x5f900, 0x5fa6d}, + {0x5fa70, 0x5fad9}, {0x5fb00, 0x5fb06}, {0x5fb13, 0x5fb17}, {0x5fb1f, 0x5fb28}, + {0x5fb2a, 0x5fb36}, {0x5fb38, 0x5fb3c}, {0x5fb46, 0x5fbb1}, {0x5fbd3, 0x5fd3d}, + {0x5fd50, 0x5fd8f}, {0x5fd92, 0x5fdc7}, {0x5fdf0, 0x5fdfb}, {0x5fe70, 0x5fe74}, + {0x5fe76, 0x5fefc}, {0x5ff21, 0x5ff3a}, {0x5ff41, 0x5ff5a}, {0x5ff66, 0x5ffbe}, + {0x5ffc2, 0x5ffc7}, {0x5ffca, 0x5ffcf}, {0x5ffd2, 0x5ffd7}, {0x5ffda, 0x5ffdc}, + {0x60041, 0x6005a}, {0x60061, 0x6007a}, {0x600c0, 0x600d6}, {0x600d8, 0x600f6}, + {0x600f8, 0x602c1}, {0x602c6, 0x602d1}, {0x602e0, 0x602e4}, {0x60370, 0x60374}, + {0x6037a, 0x6037d}, {0x60388, 0x6038a}, {0x6038e, 0x603a1}, {0x603a3, 0x603f5}, + {0x603f7, 0x60481}, {0x6048a, 0x6052f}, {0x60531, 0x60556}, {0x60561, 0x60587}, + {0x605d0, 0x605ea}, {0x605f0, 0x605f2}, {0x60620, 0x6064a}, {0x60671, 0x606d3}, + {0x606fa, 0x606fc}, {0x60712, 0x6072f}, {0x6074d, 0x607a5}, {0x607ca, 0x607ea}, + {0x60800, 0x60815}, {0x60840, 0x60858}, {0x60860, 0x6086a}, {0x608a0, 0x608b4}, + {0x608b6, 0x608bd}, {0x60904, 0x60939}, {0x60958, 0x60961}, {0x60971, 0x60980}, + {0x60985, 0x6098c}, {0x60993, 0x609a8}, {0x609aa, 0x609b0}, {0x609b6, 0x609b9}, + {0x609df, 0x609e1}, {0x60a05, 0x60a0a}, {0x60a13, 0x60a28}, {0x60a2a, 0x60a30}, + {0x60a59, 0x60a5c}, {0x60a72, 0x60a74}, {0x60a85, 0x60a8d}, {0x60a8f, 0x60a91}, + {0x60a93, 0x60aa8}, {0x60aaa, 0x60ab0}, {0x60ab5, 0x60ab9}, {0x60b05, 0x60b0c}, + {0x60b13, 0x60b28}, {0x60b2a, 0x60b30}, {0x60b35, 0x60b39}, {0x60b5f, 0x60b61}, + {0x60b85, 0x60b8a}, {0x60b8e, 0x60b90}, {0x60b92, 0x60b95}, {0x60ba8, 0x60baa}, + {0x60bae, 0x60bb9}, {0x60c05, 0x60c0c}, {0x60c0e, 0x60c10}, {0x60c12, 0x60c28}, + {0x60c2a, 0x60c39}, {0x60c58, 0x60c5a}, {0x60c85, 0x60c8c}, {0x60c8e, 0x60c90}, + {0x60c92, 0x60ca8}, {0x60caa, 0x60cb3}, {0x60cb5, 0x60cb9}, {0x60d05, 0x60d0c}, + {0x60d0e, 0x60d10}, {0x60d12, 0x60d3a}, {0x60d54, 0x60d56}, {0x60d5f, 0x60d61}, + {0x60d7a, 0x60d7f}, {0x60d85, 0x60d96}, {0x60d9a, 0x60db1}, {0x60db3, 0x60dbb}, + {0x60dc0, 0x60dc6}, {0x60e01, 0x60e30}, {0x60e40, 0x60e46}, {0x60e94, 0x60e97}, + {0x60e99, 0x60e9f}, {0x60ea1, 0x60ea3}, {0x60ead, 0x60eb0}, {0x60ec0, 0x60ec4}, + {0x60edc, 0x60edf}, {0x60f40, 0x60f47}, {0x60f49, 0x60f6c}, {0x60f88, 0x60f8c}, + {0x61000, 0x6102a}, {0x61050, 0x61055}, {0x6105a, 0x6105d}, {0x6106e, 0x61070}, + {0x61075, 0x61081}, {0x610a0, 0x610c5}, {0x610d0, 0x610fa}, {0x610fc, 0x61248}, + {0x6124a, 0x6124d}, {0x61250, 0x61256}, {0x6125a, 0x6125d}, {0x61260, 0x61288}, + {0x6128a, 0x6128d}, {0x61290, 0x612b0}, {0x612b2, 0x612b5}, {0x612b8, 0x612be}, + {0x612c2, 0x612c5}, {0x612c8, 0x612d6}, {0x612d8, 0x61310}, {0x61312, 0x61315}, + {0x61318, 0x6135a}, {0x61380, 0x6138f}, {0x613a0, 0x613f5}, {0x613f8, 0x613fd}, + {0x61401, 0x6166c}, {0x6166f, 0x6167f}, {0x61681, 0x6169a}, {0x616a0, 0x616ea}, + {0x616f1, 0x616f8}, {0x61700, 0x6170c}, {0x6170e, 0x61711}, {0x61720, 0x61731}, + {0x61740, 0x61751}, {0x61760, 0x6176c}, {0x6176e, 0x61770}, {0x61780, 0x617b3}, + {0x61820, 0x61877}, {0x61880, 0x61884}, {0x61887, 0x618a8}, {0x618b0, 0x618f5}, + {0x61900, 0x6191e}, {0x61950, 0x6196d}, {0x61970, 0x61974}, {0x61980, 0x619ab}, + {0x619b0, 0x619c9}, {0x61a00, 0x61a16}, {0x61a20, 0x61a54}, {0x61b05, 0x61b33}, + {0x61b45, 0x61b4b}, {0x61b83, 0x61ba0}, {0x61bba, 0x61be5}, {0x61c00, 0x61c23}, + {0x61c4d, 0x61c4f}, {0x61c5a, 0x61c7d}, {0x61c80, 0x61c88}, {0x61ce9, 0x61cec}, + {0x61cee, 0x61cf1}, {0x61d00, 0x61dbf}, {0x61e00, 0x61f15}, {0x61f18, 0x61f1d}, + {0x61f20, 0x61f45}, {0x61f48, 0x61f4d}, {0x61f50, 0x61f57}, {0x61f5f, 0x61f7d}, + {0x61f80, 0x61fb4}, {0x61fb6, 0x61fbc}, {0x61fc2, 0x61fc4}, {0x61fc6, 0x61fcc}, + {0x61fd0, 0x61fd3}, {0x61fd6, 0x61fdb}, {0x61fe0, 0x61fec}, {0x61ff2, 0x61ff4}, + {0x61ff6, 0x61ffc}, {0x62090, 0x6209c}, {0x6210a, 0x62113}, {0x62119, 0x6211d}, + {0x6212a, 0x6212d}, {0x6212f, 0x62139}, {0x6213c, 0x6213f}, {0x62145, 0x62149}, + {0x62c00, 0x62c2e}, {0x62c30, 0x62c5e}, {0x62c60, 0x62ce4}, {0x62ceb, 0x62cee}, + {0x62d00, 0x62d25}, {0x62d30, 0x62d67}, {0x62d80, 0x62d96}, {0x62da0, 0x62da6}, + {0x62da8, 0x62dae}, {0x62db0, 0x62db6}, {0x62db8, 0x62dbe}, {0x62dc0, 0x62dc6}, + {0x62dc8, 0x62dce}, {0x62dd0, 0x62dd6}, {0x62dd8, 0x62dde}, {0x63031, 0x63035}, + {0x63041, 0x63096}, {0x6309d, 0x6309f}, {0x630a1, 0x630fa}, {0x630fc, 0x630ff}, + {0x63105, 0x6312e}, {0x63131, 0x6318e}, {0x631a0, 0x631ba}, {0x631f0, 0x631ff}, + {0x63400, 0x64db5}, {0x64e00, 0x69fea}, {0x6a000, 0x6a48c}, {0x6a4d0, 0x6a4fd}, + {0x6a500, 0x6a60c}, {0x6a610, 0x6a61f}, {0x6a640, 0x6a66e}, {0x6a67f, 0x6a69d}, + {0x6a6a0, 0x6a6e5}, {0x6a717, 0x6a71f}, {0x6a722, 0x6a788}, {0x6a78b, 0x6a7ae}, + {0x6a7b0, 0x6a7b7}, {0x6a7f7, 0x6a801}, {0x6a803, 0x6a805}, {0x6a807, 0x6a80a}, + {0x6a80c, 0x6a822}, {0x6a840, 0x6a873}, {0x6a882, 0x6a8b3}, {0x6a8f2, 0x6a8f7}, + {0x6a90a, 0x6a925}, {0x6a930, 0x6a946}, {0x6a960, 0x6a97c}, {0x6a984, 0x6a9b2}, + {0x6a9e0, 0x6a9e4}, {0x6a9e6, 0x6a9ef}, {0x6a9fa, 0x6a9fe}, {0x6aa00, 0x6aa28}, + {0x6aa40, 0x6aa42}, {0x6aa44, 0x6aa4b}, {0x6aa60, 0x6aa76}, {0x6aa7e, 0x6aaaf}, + {0x6aab9, 0x6aabd}, {0x6aadb, 0x6aadd}, {0x6aae0, 0x6aaea}, {0x6aaf2, 0x6aaf4}, + {0x6ab01, 0x6ab06}, {0x6ab09, 0x6ab0e}, {0x6ab11, 0x6ab16}, {0x6ab20, 0x6ab26}, + {0x6ab28, 0x6ab2e}, {0x6ab30, 0x6ab5a}, {0x6ab5c, 0x6ab65}, {0x6ab70, 0x6abe2}, + {0x6ac00, 0x6d7a3}, {0x6d7b0, 0x6d7c6}, {0x6d7cb, 0x6d7fb}, {0x6f900, 0x6fa6d}, + {0x6fa70, 0x6fad9}, {0x6fb00, 0x6fb06}, {0x6fb13, 0x6fb17}, {0x6fb1f, 0x6fb28}, + {0x6fb2a, 0x6fb36}, {0x6fb38, 0x6fb3c}, {0x6fb46, 0x6fbb1}, {0x6fbd3, 0x6fd3d}, + {0x6fd50, 0x6fd8f}, {0x6fd92, 0x6fdc7}, {0x6fdf0, 0x6fdfb}, {0x6fe70, 0x6fe74}, + {0x6fe76, 0x6fefc}, {0x6ff21, 0x6ff3a}, {0x6ff41, 0x6ff5a}, {0x6ff66, 0x6ffbe}, + {0x6ffc2, 0x6ffc7}, {0x6ffca, 0x6ffcf}, {0x6ffd2, 0x6ffd7}, {0x6ffda, 0x6ffdc}, + {0x70041, 0x7005a}, {0x70061, 0x7007a}, {0x700c0, 0x700d6}, {0x700d8, 0x700f6}, + {0x700f8, 0x702c1}, {0x702c6, 0x702d1}, {0x702e0, 0x702e4}, {0x70370, 0x70374}, + {0x7037a, 0x7037d}, {0x70388, 0x7038a}, {0x7038e, 0x703a1}, {0x703a3, 0x703f5}, + {0x703f7, 0x70481}, {0x7048a, 0x7052f}, {0x70531, 0x70556}, {0x70561, 0x70587}, + {0x705d0, 0x705ea}, {0x705f0, 0x705f2}, {0x70620, 0x7064a}, {0x70671, 0x706d3}, + {0x706fa, 0x706fc}, {0x70712, 0x7072f}, {0x7074d, 0x707a5}, {0x707ca, 0x707ea}, + {0x70800, 0x70815}, {0x70840, 0x70858}, {0x70860, 0x7086a}, {0x708a0, 0x708b4}, + {0x708b6, 0x708bd}, {0x70904, 0x70939}, {0x70958, 0x70961}, {0x70971, 0x70980}, + {0x70985, 0x7098c}, {0x70993, 0x709a8}, {0x709aa, 0x709b0}, {0x709b6, 0x709b9}, + {0x709df, 0x709e1}, {0x70a05, 0x70a0a}, {0x70a13, 0x70a28}, {0x70a2a, 0x70a30}, + {0x70a59, 0x70a5c}, {0x70a72, 0x70a74}, {0x70a85, 0x70a8d}, {0x70a8f, 0x70a91}, + {0x70a93, 0x70aa8}, {0x70aaa, 0x70ab0}, {0x70ab5, 0x70ab9}, {0x70b05, 0x70b0c}, + {0x70b13, 0x70b28}, {0x70b2a, 0x70b30}, {0x70b35, 0x70b39}, {0x70b5f, 0x70b61}, + {0x70b85, 0x70b8a}, {0x70b8e, 0x70b90}, {0x70b92, 0x70b95}, {0x70ba8, 0x70baa}, + {0x70bae, 0x70bb9}, {0x70c05, 0x70c0c}, {0x70c0e, 0x70c10}, {0x70c12, 0x70c28}, + {0x70c2a, 0x70c39}, {0x70c58, 0x70c5a}, {0x70c85, 0x70c8c}, {0x70c8e, 0x70c90}, + {0x70c92, 0x70ca8}, {0x70caa, 0x70cb3}, {0x70cb5, 0x70cb9}, {0x70d05, 0x70d0c}, + {0x70d0e, 0x70d10}, {0x70d12, 0x70d3a}, {0x70d54, 0x70d56}, {0x70d5f, 0x70d61}, + {0x70d7a, 0x70d7f}, {0x70d85, 0x70d96}, {0x70d9a, 0x70db1}, {0x70db3, 0x70dbb}, + {0x70dc0, 0x70dc6}, {0x70e01, 0x70e30}, {0x70e40, 0x70e46}, {0x70e94, 0x70e97}, + {0x70e99, 0x70e9f}, {0x70ea1, 0x70ea3}, {0x70ead, 0x70eb0}, {0x70ec0, 0x70ec4}, + {0x70edc, 0x70edf}, {0x70f40, 0x70f47}, {0x70f49, 0x70f6c}, {0x70f88, 0x70f8c}, + {0x71000, 0x7102a}, {0x71050, 0x71055}, {0x7105a, 0x7105d}, {0x7106e, 0x71070}, + {0x71075, 0x71081}, {0x710a0, 0x710c5}, {0x710d0, 0x710fa}, {0x710fc, 0x71248}, + {0x7124a, 0x7124d}, {0x71250, 0x71256}, {0x7125a, 0x7125d}, {0x71260, 0x71288}, + {0x7128a, 0x7128d}, {0x71290, 0x712b0}, {0x712b2, 0x712b5}, {0x712b8, 0x712be}, + {0x712c2, 0x712c5}, {0x712c8, 0x712d6}, {0x712d8, 0x71310}, {0x71312, 0x71315}, + {0x71318, 0x7135a}, {0x71380, 0x7138f}, {0x713a0, 0x713f5}, {0x713f8, 0x713fd}, + {0x71401, 0x7166c}, {0x7166f, 0x7167f}, {0x71681, 0x7169a}, {0x716a0, 0x716ea}, + {0x716f1, 0x716f8}, {0x71700, 0x7170c}, {0x7170e, 0x71711}, {0x71720, 0x71731}, + {0x71740, 0x71751}, {0x71760, 0x7176c}, {0x7176e, 0x71770}, {0x71780, 0x717b3}, + {0x71820, 0x71877}, {0x71880, 0x71884}, {0x71887, 0x718a8}, {0x718b0, 0x718f5}, + {0x71900, 0x7191e}, {0x71950, 0x7196d}, {0x71970, 0x71974}, {0x71980, 0x719ab}, + {0x719b0, 0x719c9}, {0x71a00, 0x71a16}, {0x71a20, 0x71a54}, {0x71b05, 0x71b33}, + {0x71b45, 0x71b4b}, {0x71b83, 0x71ba0}, {0x71bba, 0x71be5}, {0x71c00, 0x71c23}, + {0x71c4d, 0x71c4f}, {0x71c5a, 0x71c7d}, {0x71c80, 0x71c88}, {0x71ce9, 0x71cec}, + {0x71cee, 0x71cf1}, {0x71d00, 0x71dbf}, {0x71e00, 0x71f15}, {0x71f18, 0x71f1d}, + {0x71f20, 0x71f45}, {0x71f48, 0x71f4d}, {0x71f50, 0x71f57}, {0x71f5f, 0x71f7d}, + {0x71f80, 0x71fb4}, {0x71fb6, 0x71fbc}, {0x71fc2, 0x71fc4}, {0x71fc6, 0x71fcc}, + {0x71fd0, 0x71fd3}, {0x71fd6, 0x71fdb}, {0x71fe0, 0x71fec}, {0x71ff2, 0x71ff4}, + {0x71ff6, 0x71ffc}, {0x72090, 0x7209c}, {0x7210a, 0x72113}, {0x72119, 0x7211d}, + {0x7212a, 0x7212d}, {0x7212f, 0x72139}, {0x7213c, 0x7213f}, {0x72145, 0x72149}, + {0x72c00, 0x72c2e}, {0x72c30, 0x72c5e}, {0x72c60, 0x72ce4}, {0x72ceb, 0x72cee}, + {0x72d00, 0x72d25}, {0x72d30, 0x72d67}, {0x72d80, 0x72d96}, {0x72da0, 0x72da6}, + {0x72da8, 0x72dae}, {0x72db0, 0x72db6}, {0x72db8, 0x72dbe}, {0x72dc0, 0x72dc6}, + {0x72dc8, 0x72dce}, {0x72dd0, 0x72dd6}, {0x72dd8, 0x72dde}, {0x73031, 0x73035}, + {0x73041, 0x73096}, {0x7309d, 0x7309f}, {0x730a1, 0x730fa}, {0x730fc, 0x730ff}, + {0x73105, 0x7312e}, {0x73131, 0x7318e}, {0x731a0, 0x731ba}, {0x731f0, 0x731ff}, + {0x73400, 0x74db5}, {0x74e00, 0x79fea}, {0x7a000, 0x7a48c}, {0x7a4d0, 0x7a4fd}, + {0x7a500, 0x7a60c}, {0x7a610, 0x7a61f}, {0x7a640, 0x7a66e}, {0x7a67f, 0x7a69d}, + {0x7a6a0, 0x7a6e5}, {0x7a717, 0x7a71f}, {0x7a722, 0x7a788}, {0x7a78b, 0x7a7ae}, + {0x7a7b0, 0x7a7b7}, {0x7a7f7, 0x7a801}, {0x7a803, 0x7a805}, {0x7a807, 0x7a80a}, + {0x7a80c, 0x7a822}, {0x7a840, 0x7a873}, {0x7a882, 0x7a8b3}, {0x7a8f2, 0x7a8f7}, + {0x7a90a, 0x7a925}, {0x7a930, 0x7a946}, {0x7a960, 0x7a97c}, {0x7a984, 0x7a9b2}, + {0x7a9e0, 0x7a9e4}, {0x7a9e6, 0x7a9ef}, {0x7a9fa, 0x7a9fe}, {0x7aa00, 0x7aa28}, + {0x7aa40, 0x7aa42}, {0x7aa44, 0x7aa4b}, {0x7aa60, 0x7aa76}, {0x7aa7e, 0x7aaaf}, + {0x7aab9, 0x7aabd}, {0x7aadb, 0x7aadd}, {0x7aae0, 0x7aaea}, {0x7aaf2, 0x7aaf4}, + {0x7ab01, 0x7ab06}, {0x7ab09, 0x7ab0e}, {0x7ab11, 0x7ab16}, {0x7ab20, 0x7ab26}, + {0x7ab28, 0x7ab2e}, {0x7ab30, 0x7ab5a}, {0x7ab5c, 0x7ab65}, {0x7ab70, 0x7abe2}, + {0x7ac00, 0x7d7a3}, {0x7d7b0, 0x7d7c6}, {0x7d7cb, 0x7d7fb}, {0x7f900, 0x7fa6d}, + {0x7fa70, 0x7fad9}, {0x7fb00, 0x7fb06}, {0x7fb13, 0x7fb17}, {0x7fb1f, 0x7fb28}, + {0x7fb2a, 0x7fb36}, {0x7fb38, 0x7fb3c}, {0x7fb46, 0x7fbb1}, {0x7fbd3, 0x7fd3d}, + {0x7fd50, 0x7fd8f}, {0x7fd92, 0x7fdc7}, {0x7fdf0, 0x7fdfb}, {0x7fe70, 0x7fe74}, + {0x7fe76, 0x7fefc}, {0x7ff21, 0x7ff3a}, {0x7ff41, 0x7ff5a}, {0x7ff66, 0x7ffbe}, + {0x7ffc2, 0x7ffc7}, {0x7ffca, 0x7ffcf}, {0x7ffd2, 0x7ffd7}, {0x7ffda, 0x7ffdc}, + {0x80041, 0x8005a}, {0x80061, 0x8007a}, {0x800c0, 0x800d6}, {0x800d8, 0x800f6}, + {0x800f8, 0x802c1}, {0x802c6, 0x802d1}, {0x802e0, 0x802e4}, {0x80370, 0x80374}, + {0x8037a, 0x8037d}, {0x80388, 0x8038a}, {0x8038e, 0x803a1}, {0x803a3, 0x803f5}, + {0x803f7, 0x80481}, {0x8048a, 0x8052f}, {0x80531, 0x80556}, {0x80561, 0x80587}, + {0x805d0, 0x805ea}, {0x805f0, 0x805f2}, {0x80620, 0x8064a}, {0x80671, 0x806d3}, + {0x806fa, 0x806fc}, {0x80712, 0x8072f}, {0x8074d, 0x807a5}, {0x807ca, 0x807ea}, + {0x80800, 0x80815}, {0x80840, 0x80858}, {0x80860, 0x8086a}, {0x808a0, 0x808b4}, + {0x808b6, 0x808bd}, {0x80904, 0x80939}, {0x80958, 0x80961}, {0x80971, 0x80980}, + {0x80985, 0x8098c}, {0x80993, 0x809a8}, {0x809aa, 0x809b0}, {0x809b6, 0x809b9}, + {0x809df, 0x809e1}, {0x80a05, 0x80a0a}, {0x80a13, 0x80a28}, {0x80a2a, 0x80a30}, + {0x80a59, 0x80a5c}, {0x80a72, 0x80a74}, {0x80a85, 0x80a8d}, {0x80a8f, 0x80a91}, + {0x80a93, 0x80aa8}, {0x80aaa, 0x80ab0}, {0x80ab5, 0x80ab9}, {0x80b05, 0x80b0c}, + {0x80b13, 0x80b28}, {0x80b2a, 0x80b30}, {0x80b35, 0x80b39}, {0x80b5f, 0x80b61}, + {0x80b85, 0x80b8a}, {0x80b8e, 0x80b90}, {0x80b92, 0x80b95}, {0x80ba8, 0x80baa}, + {0x80bae, 0x80bb9}, {0x80c05, 0x80c0c}, {0x80c0e, 0x80c10}, {0x80c12, 0x80c28}, + {0x80c2a, 0x80c39}, {0x80c58, 0x80c5a}, {0x80c85, 0x80c8c}, {0x80c8e, 0x80c90}, + {0x80c92, 0x80ca8}, {0x80caa, 0x80cb3}, {0x80cb5, 0x80cb9}, {0x80d05, 0x80d0c}, + {0x80d0e, 0x80d10}, {0x80d12, 0x80d3a}, {0x80d54, 0x80d56}, {0x80d5f, 0x80d61}, + {0x80d7a, 0x80d7f}, {0x80d85, 0x80d96}, {0x80d9a, 0x80db1}, {0x80db3, 0x80dbb}, + {0x80dc0, 0x80dc6}, {0x80e01, 0x80e30}, {0x80e40, 0x80e46}, {0x80e94, 0x80e97}, + {0x80e99, 0x80e9f}, {0x80ea1, 0x80ea3}, {0x80ead, 0x80eb0}, {0x80ec0, 0x80ec4}, + {0x80edc, 0x80edf}, {0x80f40, 0x80f47}, {0x80f49, 0x80f6c}, {0x80f88, 0x80f8c}, + {0x81000, 0x8102a}, {0x81050, 0x81055}, {0x8105a, 0x8105d}, {0x8106e, 0x81070}, + {0x81075, 0x81081}, {0x810a0, 0x810c5}, {0x810d0, 0x810fa}, {0x810fc, 0x81248}, + {0x8124a, 0x8124d}, {0x81250, 0x81256}, {0x8125a, 0x8125d}, {0x81260, 0x81288}, + {0x8128a, 0x8128d}, {0x81290, 0x812b0}, {0x812b2, 0x812b5}, {0x812b8, 0x812be}, + {0x812c2, 0x812c5}, {0x812c8, 0x812d6}, {0x812d8, 0x81310}, {0x81312, 0x81315}, + {0x81318, 0x8135a}, {0x81380, 0x8138f}, {0x813a0, 0x813f5}, {0x813f8, 0x813fd}, + {0x81401, 0x8166c}, {0x8166f, 0x8167f}, {0x81681, 0x8169a}, {0x816a0, 0x816ea}, + {0x816f1, 0x816f8}, {0x81700, 0x8170c}, {0x8170e, 0x81711}, {0x81720, 0x81731}, + {0x81740, 0x81751}, {0x81760, 0x8176c}, {0x8176e, 0x81770}, {0x81780, 0x817b3}, + {0x81820, 0x81877}, {0x81880, 0x81884}, {0x81887, 0x818a8}, {0x818b0, 0x818f5}, + {0x81900, 0x8191e}, {0x81950, 0x8196d}, {0x81970, 0x81974}, {0x81980, 0x819ab}, + {0x819b0, 0x819c9}, {0x81a00, 0x81a16}, {0x81a20, 0x81a54}, {0x81b05, 0x81b33}, + {0x81b45, 0x81b4b}, {0x81b83, 0x81ba0}, {0x81bba, 0x81be5}, {0x81c00, 0x81c23}, + {0x81c4d, 0x81c4f}, {0x81c5a, 0x81c7d}, {0x81c80, 0x81c88}, {0x81ce9, 0x81cec}, + {0x81cee, 0x81cf1}, {0x81d00, 0x81dbf}, {0x81e00, 0x81f15}, {0x81f18, 0x81f1d}, + {0x81f20, 0x81f45}, {0x81f48, 0x81f4d}, {0x81f50, 0x81f57}, {0x81f5f, 0x81f7d}, + {0x81f80, 0x81fb4}, {0x81fb6, 0x81fbc}, {0x81fc2, 0x81fc4}, {0x81fc6, 0x81fcc}, + {0x81fd0, 0x81fd3}, {0x81fd6, 0x81fdb}, {0x81fe0, 0x81fec}, {0x81ff2, 0x81ff4}, + {0x81ff6, 0x81ffc}, {0x82090, 0x8209c}, {0x8210a, 0x82113}, {0x82119, 0x8211d}, + {0x8212a, 0x8212d}, {0x8212f, 0x82139}, {0x8213c, 0x8213f}, {0x82145, 0x82149}, + {0x82c00, 0x82c2e}, {0x82c30, 0x82c5e}, {0x82c60, 0x82ce4}, {0x82ceb, 0x82cee}, + {0x82d00, 0x82d25}, {0x82d30, 0x82d67}, {0x82d80, 0x82d96}, {0x82da0, 0x82da6}, + {0x82da8, 0x82dae}, {0x82db0, 0x82db6}, {0x82db8, 0x82dbe}, {0x82dc0, 0x82dc6}, + {0x82dc8, 0x82dce}, {0x82dd0, 0x82dd6}, {0x82dd8, 0x82dde}, {0x83031, 0x83035}, + {0x83041, 0x83096}, {0x8309d, 0x8309f}, {0x830a1, 0x830fa}, {0x830fc, 0x830ff}, + {0x83105, 0x8312e}, {0x83131, 0x8318e}, {0x831a0, 0x831ba}, {0x831f0, 0x831ff}, + {0x83400, 0x84db5}, {0x84e00, 0x89fea}, {0x8a000, 0x8a48c}, {0x8a4d0, 0x8a4fd}, + {0x8a500, 0x8a60c}, {0x8a610, 0x8a61f}, {0x8a640, 0x8a66e}, {0x8a67f, 0x8a69d}, + {0x8a6a0, 0x8a6e5}, {0x8a717, 0x8a71f}, {0x8a722, 0x8a788}, {0x8a78b, 0x8a7ae}, + {0x8a7b0, 0x8a7b7}, {0x8a7f7, 0x8a801}, {0x8a803, 0x8a805}, {0x8a807, 0x8a80a}, + {0x8a80c, 0x8a822}, {0x8a840, 0x8a873}, {0x8a882, 0x8a8b3}, {0x8a8f2, 0x8a8f7}, + {0x8a90a, 0x8a925}, {0x8a930, 0x8a946}, {0x8a960, 0x8a97c}, {0x8a984, 0x8a9b2}, + {0x8a9e0, 0x8a9e4}, {0x8a9e6, 0x8a9ef}, {0x8a9fa, 0x8a9fe}, {0x8aa00, 0x8aa28}, + {0x8aa40, 0x8aa42}, {0x8aa44, 0x8aa4b}, {0x8aa60, 0x8aa76}, {0x8aa7e, 0x8aaaf}, + {0x8aab9, 0x8aabd}, {0x8aadb, 0x8aadd}, {0x8aae0, 0x8aaea}, {0x8aaf2, 0x8aaf4}, + {0x8ab01, 0x8ab06}, {0x8ab09, 0x8ab0e}, {0x8ab11, 0x8ab16}, {0x8ab20, 0x8ab26}, + {0x8ab28, 0x8ab2e}, {0x8ab30, 0x8ab5a}, {0x8ab5c, 0x8ab65}, {0x8ab70, 0x8abe2}, + {0x8ac00, 0x8d7a3}, {0x8d7b0, 0x8d7c6}, {0x8d7cb, 0x8d7fb}, {0x8f900, 0x8fa6d}, + {0x8fa70, 0x8fad9}, {0x8fb00, 0x8fb06}, {0x8fb13, 0x8fb17}, {0x8fb1f, 0x8fb28}, + {0x8fb2a, 0x8fb36}, {0x8fb38, 0x8fb3c}, {0x8fb46, 0x8fbb1}, {0x8fbd3, 0x8fd3d}, + {0x8fd50, 0x8fd8f}, {0x8fd92, 0x8fdc7}, {0x8fdf0, 0x8fdfb}, {0x8fe70, 0x8fe74}, + {0x8fe76, 0x8fefc}, {0x8ff21, 0x8ff3a}, {0x8ff41, 0x8ff5a}, {0x8ff66, 0x8ffbe}, + {0x8ffc2, 0x8ffc7}, {0x8ffca, 0x8ffcf}, {0x8ffd2, 0x8ffd7}, {0x8ffda, 0x8ffdc}, + {0x90041, 0x9005a}, {0x90061, 0x9007a}, {0x900c0, 0x900d6}, {0x900d8, 0x900f6}, + {0x900f8, 0x902c1}, {0x902c6, 0x902d1}, {0x902e0, 0x902e4}, {0x90370, 0x90374}, + {0x9037a, 0x9037d}, {0x90388, 0x9038a}, {0x9038e, 0x903a1}, {0x903a3, 0x903f5}, + {0x903f7, 0x90481}, {0x9048a, 0x9052f}, {0x90531, 0x90556}, {0x90561, 0x90587}, + {0x905d0, 0x905ea}, {0x905f0, 0x905f2}, {0x90620, 0x9064a}, {0x90671, 0x906d3}, + {0x906fa, 0x906fc}, {0x90712, 0x9072f}, {0x9074d, 0x907a5}, {0x907ca, 0x907ea}, + {0x90800, 0x90815}, {0x90840, 0x90858}, {0x90860, 0x9086a}, {0x908a0, 0x908b4}, + {0x908b6, 0x908bd}, {0x90904, 0x90939}, {0x90958, 0x90961}, {0x90971, 0x90980}, + {0x90985, 0x9098c}, {0x90993, 0x909a8}, {0x909aa, 0x909b0}, {0x909b6, 0x909b9}, + {0x909df, 0x909e1}, {0x90a05, 0x90a0a}, {0x90a13, 0x90a28}, {0x90a2a, 0x90a30}, + {0x90a59, 0x90a5c}, {0x90a72, 0x90a74}, {0x90a85, 0x90a8d}, {0x90a8f, 0x90a91}, + {0x90a93, 0x90aa8}, {0x90aaa, 0x90ab0}, {0x90ab5, 0x90ab9}, {0x90b05, 0x90b0c}, + {0x90b13, 0x90b28}, {0x90b2a, 0x90b30}, {0x90b35, 0x90b39}, {0x90b5f, 0x90b61}, + {0x90b85, 0x90b8a}, {0x90b8e, 0x90b90}, {0x90b92, 0x90b95}, {0x90ba8, 0x90baa}, + {0x90bae, 0x90bb9}, {0x90c05, 0x90c0c}, {0x90c0e, 0x90c10}, {0x90c12, 0x90c28}, + {0x90c2a, 0x90c39}, {0x90c58, 0x90c5a}, {0x90c85, 0x90c8c}, {0x90c8e, 0x90c90}, + {0x90c92, 0x90ca8}, {0x90caa, 0x90cb3}, {0x90cb5, 0x90cb9}, {0x90d05, 0x90d0c}, + {0x90d0e, 0x90d10}, {0x90d12, 0x90d3a}, {0x90d54, 0x90d56}, {0x90d5f, 0x90d61}, + {0x90d7a, 0x90d7f}, {0x90d85, 0x90d96}, {0x90d9a, 0x90db1}, {0x90db3, 0x90dbb}, + {0x90dc0, 0x90dc6}, {0x90e01, 0x90e30}, {0x90e40, 0x90e46}, {0x90e94, 0x90e97}, + {0x90e99, 0x90e9f}, {0x90ea1, 0x90ea3}, {0x90ead, 0x90eb0}, {0x90ec0, 0x90ec4}, + {0x90edc, 0x90edf}, {0x90f40, 0x90f47}, {0x90f49, 0x90f6c}, {0x90f88, 0x90f8c}, + {0x91000, 0x9102a}, {0x91050, 0x91055}, {0x9105a, 0x9105d}, {0x9106e, 0x91070}, + {0x91075, 0x91081}, {0x910a0, 0x910c5}, {0x910d0, 0x910fa}, {0x910fc, 0x91248}, + {0x9124a, 0x9124d}, {0x91250, 0x91256}, {0x9125a, 0x9125d}, {0x91260, 0x91288}, + {0x9128a, 0x9128d}, {0x91290, 0x912b0}, {0x912b2, 0x912b5}, {0x912b8, 0x912be}, + {0x912c2, 0x912c5}, {0x912c8, 0x912d6}, {0x912d8, 0x91310}, {0x91312, 0x91315}, + {0x91318, 0x9135a}, {0x91380, 0x9138f}, {0x913a0, 0x913f5}, {0x913f8, 0x913fd}, + {0x91401, 0x9166c}, {0x9166f, 0x9167f}, {0x91681, 0x9169a}, {0x916a0, 0x916ea}, + {0x916f1, 0x916f8}, {0x91700, 0x9170c}, {0x9170e, 0x91711}, {0x91720, 0x91731}, + {0x91740, 0x91751}, {0x91760, 0x9176c}, {0x9176e, 0x91770}, {0x91780, 0x917b3}, + {0x91820, 0x91877}, {0x91880, 0x91884}, {0x91887, 0x918a8}, {0x918b0, 0x918f5}, + {0x91900, 0x9191e}, {0x91950, 0x9196d}, {0x91970, 0x91974}, {0x91980, 0x919ab}, + {0x919b0, 0x919c9}, {0x91a00, 0x91a16}, {0x91a20, 0x91a54}, {0x91b05, 0x91b33}, + {0x91b45, 0x91b4b}, {0x91b83, 0x91ba0}, {0x91bba, 0x91be5}, {0x91c00, 0x91c23}, + {0x91c4d, 0x91c4f}, {0x91c5a, 0x91c7d}, {0x91c80, 0x91c88}, {0x91ce9, 0x91cec}, + {0x91cee, 0x91cf1}, {0x91d00, 0x91dbf}, {0x91e00, 0x91f15}, {0x91f18, 0x91f1d}, + {0x91f20, 0x91f45}, {0x91f48, 0x91f4d}, {0x91f50, 0x91f57}, {0x91f5f, 0x91f7d}, + {0x91f80, 0x91fb4}, {0x91fb6, 0x91fbc}, {0x91fc2, 0x91fc4}, {0x91fc6, 0x91fcc}, + {0x91fd0, 0x91fd3}, {0x91fd6, 0x91fdb}, {0x91fe0, 0x91fec}, {0x91ff2, 0x91ff4}, + {0x91ff6, 0x91ffc}, {0x92090, 0x9209c}, {0x9210a, 0x92113}, {0x92119, 0x9211d}, + {0x9212a, 0x9212d}, {0x9212f, 0x92139}, {0x9213c, 0x9213f}, {0x92145, 0x92149}, + {0x92c00, 0x92c2e}, {0x92c30, 0x92c5e}, {0x92c60, 0x92ce4}, {0x92ceb, 0x92cee}, + {0x92d00, 0x92d25}, {0x92d30, 0x92d67}, {0x92d80, 0x92d96}, {0x92da0, 0x92da6}, + {0x92da8, 0x92dae}, {0x92db0, 0x92db6}, {0x92db8, 0x92dbe}, {0x92dc0, 0x92dc6}, + {0x92dc8, 0x92dce}, {0x92dd0, 0x92dd6}, {0x92dd8, 0x92dde}, {0x93031, 0x93035}, + {0x93041, 0x93096}, {0x9309d, 0x9309f}, {0x930a1, 0x930fa}, {0x930fc, 0x930ff}, + {0x93105, 0x9312e}, {0x93131, 0x9318e}, {0x931a0, 0x931ba}, {0x931f0, 0x931ff}, + {0x93400, 0x94db5}, {0x94e00, 0x99fea}, {0x9a000, 0x9a48c}, {0x9a4d0, 0x9a4fd}, + {0x9a500, 0x9a60c}, {0x9a610, 0x9a61f}, {0x9a640, 0x9a66e}, {0x9a67f, 0x9a69d}, + {0x9a6a0, 0x9a6e5}, {0x9a717, 0x9a71f}, {0x9a722, 0x9a788}, {0x9a78b, 0x9a7ae}, + {0x9a7b0, 0x9a7b7}, {0x9a7f7, 0x9a801}, {0x9a803, 0x9a805}, {0x9a807, 0x9a80a}, + {0x9a80c, 0x9a822}, {0x9a840, 0x9a873}, {0x9a882, 0x9a8b3}, {0x9a8f2, 0x9a8f7}, + {0x9a90a, 0x9a925}, {0x9a930, 0x9a946}, {0x9a960, 0x9a97c}, {0x9a984, 0x9a9b2}, + {0x9a9e0, 0x9a9e4}, {0x9a9e6, 0x9a9ef}, {0x9a9fa, 0x9a9fe}, {0x9aa00, 0x9aa28}, + {0x9aa40, 0x9aa42}, {0x9aa44, 0x9aa4b}, {0x9aa60, 0x9aa76}, {0x9aa7e, 0x9aaaf}, + {0x9aab9, 0x9aabd}, {0x9aadb, 0x9aadd}, {0x9aae0, 0x9aaea}, {0x9aaf2, 0x9aaf4}, + {0x9ab01, 0x9ab06}, {0x9ab09, 0x9ab0e}, {0x9ab11, 0x9ab16}, {0x9ab20, 0x9ab26}, + {0x9ab28, 0x9ab2e}, {0x9ab30, 0x9ab5a}, {0x9ab5c, 0x9ab65}, {0x9ab70, 0x9abe2}, + {0x9ac00, 0x9d7a3}, {0x9d7b0, 0x9d7c6}, {0x9d7cb, 0x9d7fb}, {0x9f900, 0x9fa6d}, + {0x9fa70, 0x9fad9}, {0x9fb00, 0x9fb06}, {0x9fb13, 0x9fb17}, {0x9fb1f, 0x9fb28}, + {0x9fb2a, 0x9fb36}, {0x9fb38, 0x9fb3c}, {0x9fb46, 0x9fbb1}, {0x9fbd3, 0x9fd3d}, + {0x9fd50, 0x9fd8f}, {0x9fd92, 0x9fdc7}, {0x9fdf0, 0x9fdfb}, {0x9fe70, 0x9fe74}, + {0x9fe76, 0x9fefc}, {0x9ff21, 0x9ff3a}, {0x9ff41, 0x9ff5a}, {0x9ff66, 0x9ffbe}, + {0x9ffc2, 0x9ffc7}, {0x9ffca, 0x9ffcf}, {0x9ffd2, 0x9ffd7}, {0x9ffda, 0x9ffdc}, + {0xa0041, 0xa005a}, {0xa0061, 0xa007a}, {0xa00c0, 0xa00d6}, {0xa00d8, 0xa00f6}, + {0xa00f8, 0xa02c1}, {0xa02c6, 0xa02d1}, {0xa02e0, 0xa02e4}, {0xa0370, 0xa0374}, + {0xa037a, 0xa037d}, {0xa0388, 0xa038a}, {0xa038e, 0xa03a1}, {0xa03a3, 0xa03f5}, + {0xa03f7, 0xa0481}, {0xa048a, 0xa052f}, {0xa0531, 0xa0556}, {0xa0561, 0xa0587}, + {0xa05d0, 0xa05ea}, {0xa05f0, 0xa05f2}, {0xa0620, 0xa064a}, {0xa0671, 0xa06d3}, + {0xa06fa, 0xa06fc}, {0xa0712, 0xa072f}, {0xa074d, 0xa07a5}, {0xa07ca, 0xa07ea}, + {0xa0800, 0xa0815}, {0xa0840, 0xa0858}, {0xa0860, 0xa086a}, {0xa08a0, 0xa08b4}, + {0xa08b6, 0xa08bd}, {0xa0904, 0xa0939}, {0xa0958, 0xa0961}, {0xa0971, 0xa0980}, + {0xa0985, 0xa098c}, {0xa0993, 0xa09a8}, {0xa09aa, 0xa09b0}, {0xa09b6, 0xa09b9}, + {0xa09df, 0xa09e1}, {0xa0a05, 0xa0a0a}, {0xa0a13, 0xa0a28}, {0xa0a2a, 0xa0a30}, + {0xa0a59, 0xa0a5c}, {0xa0a72, 0xa0a74}, {0xa0a85, 0xa0a8d}, {0xa0a8f, 0xa0a91}, + {0xa0a93, 0xa0aa8}, {0xa0aaa, 0xa0ab0}, {0xa0ab5, 0xa0ab9}, {0xa0b05, 0xa0b0c}, + {0xa0b13, 0xa0b28}, {0xa0b2a, 0xa0b30}, {0xa0b35, 0xa0b39}, {0xa0b5f, 0xa0b61}, + {0xa0b85, 0xa0b8a}, {0xa0b8e, 0xa0b90}, {0xa0b92, 0xa0b95}, {0xa0ba8, 0xa0baa}, + {0xa0bae, 0xa0bb9}, {0xa0c05, 0xa0c0c}, {0xa0c0e, 0xa0c10}, {0xa0c12, 0xa0c28}, + {0xa0c2a, 0xa0c39}, {0xa0c58, 0xa0c5a}, {0xa0c85, 0xa0c8c}, {0xa0c8e, 0xa0c90}, + {0xa0c92, 0xa0ca8}, {0xa0caa, 0xa0cb3}, {0xa0cb5, 0xa0cb9}, {0xa0d05, 0xa0d0c}, + {0xa0d0e, 0xa0d10}, {0xa0d12, 0xa0d3a}, {0xa0d54, 0xa0d56}, {0xa0d5f, 0xa0d61}, + {0xa0d7a, 0xa0d7f}, {0xa0d85, 0xa0d96}, {0xa0d9a, 0xa0db1}, {0xa0db3, 0xa0dbb}, + {0xa0dc0, 0xa0dc6}, {0xa0e01, 0xa0e30}, {0xa0e40, 0xa0e46}, {0xa0e94, 0xa0e97}, + {0xa0e99, 0xa0e9f}, {0xa0ea1, 0xa0ea3}, {0xa0ead, 0xa0eb0}, {0xa0ec0, 0xa0ec4}, + {0xa0edc, 0xa0edf}, {0xa0f40, 0xa0f47}, {0xa0f49, 0xa0f6c}, {0xa0f88, 0xa0f8c}, + {0xa1000, 0xa102a}, {0xa1050, 0xa1055}, {0xa105a, 0xa105d}, {0xa106e, 0xa1070}, + {0xa1075, 0xa1081}, {0xa10a0, 0xa10c5}, {0xa10d0, 0xa10fa}, {0xa10fc, 0xa1248}, + {0xa124a, 0xa124d}, {0xa1250, 0xa1256}, {0xa125a, 0xa125d}, {0xa1260, 0xa1288}, + {0xa128a, 0xa128d}, {0xa1290, 0xa12b0}, {0xa12b2, 0xa12b5}, {0xa12b8, 0xa12be}, + {0xa12c2, 0xa12c5}, {0xa12c8, 0xa12d6}, {0xa12d8, 0xa1310}, {0xa1312, 0xa1315}, + {0xa1318, 0xa135a}, {0xa1380, 0xa138f}, {0xa13a0, 0xa13f5}, {0xa13f8, 0xa13fd}, + {0xa1401, 0xa166c}, {0xa166f, 0xa167f}, {0xa1681, 0xa169a}, {0xa16a0, 0xa16ea}, + {0xa16f1, 0xa16f8}, {0xa1700, 0xa170c}, {0xa170e, 0xa1711}, {0xa1720, 0xa1731}, + {0xa1740, 0xa1751}, {0xa1760, 0xa176c}, {0xa176e, 0xa1770}, {0xa1780, 0xa17b3}, + {0xa1820, 0xa1877}, {0xa1880, 0xa1884}, {0xa1887, 0xa18a8}, {0xa18b0, 0xa18f5}, + {0xa1900, 0xa191e}, {0xa1950, 0xa196d}, {0xa1970, 0xa1974}, {0xa1980, 0xa19ab}, + {0xa19b0, 0xa19c9}, {0xa1a00, 0xa1a16}, {0xa1a20, 0xa1a54}, {0xa1b05, 0xa1b33}, + {0xa1b45, 0xa1b4b}, {0xa1b83, 0xa1ba0}, {0xa1bba, 0xa1be5}, {0xa1c00, 0xa1c23}, + {0xa1c4d, 0xa1c4f}, {0xa1c5a, 0xa1c7d}, {0xa1c80, 0xa1c88}, {0xa1ce9, 0xa1cec}, + {0xa1cee, 0xa1cf1}, {0xa1d00, 0xa1dbf}, {0xa1e00, 0xa1f15}, {0xa1f18, 0xa1f1d}, + {0xa1f20, 0xa1f45}, {0xa1f48, 0xa1f4d}, {0xa1f50, 0xa1f57}, {0xa1f5f, 0xa1f7d}, + {0xa1f80, 0xa1fb4}, {0xa1fb6, 0xa1fbc}, {0xa1fc2, 0xa1fc4}, {0xa1fc6, 0xa1fcc}, + {0xa1fd0, 0xa1fd3}, {0xa1fd6, 0xa1fdb}, {0xa1fe0, 0xa1fec}, {0xa1ff2, 0xa1ff4}, + {0xa1ff6, 0xa1ffc}, {0xa2090, 0xa209c}, {0xa210a, 0xa2113}, {0xa2119, 0xa211d}, + {0xa212a, 0xa212d}, {0xa212f, 0xa2139}, {0xa213c, 0xa213f}, {0xa2145, 0xa2149}, + {0xa2c00, 0xa2c2e}, {0xa2c30, 0xa2c5e}, {0xa2c60, 0xa2ce4}, {0xa2ceb, 0xa2cee}, + {0xa2d00, 0xa2d25}, {0xa2d30, 0xa2d67}, {0xa2d80, 0xa2d96}, {0xa2da0, 0xa2da6}, + {0xa2da8, 0xa2dae}, {0xa2db0, 0xa2db6}, {0xa2db8, 0xa2dbe}, {0xa2dc0, 0xa2dc6}, + {0xa2dc8, 0xa2dce}, {0xa2dd0, 0xa2dd6}, {0xa2dd8, 0xa2dde}, {0xa3031, 0xa3035}, + {0xa3041, 0xa3096}, {0xa309d, 0xa309f}, {0xa30a1, 0xa30fa}, {0xa30fc, 0xa30ff}, + {0xa3105, 0xa312e}, {0xa3131, 0xa318e}, {0xa31a0, 0xa31ba}, {0xa31f0, 0xa31ff}, + {0xa3400, 0xa4db5}, {0xa4e00, 0xa9fea}, {0xaa000, 0xaa48c}, {0xaa4d0, 0xaa4fd}, + {0xaa500, 0xaa60c}, {0xaa610, 0xaa61f}, {0xaa640, 0xaa66e}, {0xaa67f, 0xaa69d}, + {0xaa6a0, 0xaa6e5}, {0xaa717, 0xaa71f}, {0xaa722, 0xaa788}, {0xaa78b, 0xaa7ae}, + {0xaa7b0, 0xaa7b7}, {0xaa7f7, 0xaa801}, {0xaa803, 0xaa805}, {0xaa807, 0xaa80a}, + {0xaa80c, 0xaa822}, {0xaa840, 0xaa873}, {0xaa882, 0xaa8b3}, {0xaa8f2, 0xaa8f7}, + {0xaa90a, 0xaa925}, {0xaa930, 0xaa946}, {0xaa960, 0xaa97c}, {0xaa984, 0xaa9b2}, + {0xaa9e0, 0xaa9e4}, {0xaa9e6, 0xaa9ef}, {0xaa9fa, 0xaa9fe}, {0xaaa00, 0xaaa28}, + {0xaaa40, 0xaaa42}, {0xaaa44, 0xaaa4b}, {0xaaa60, 0xaaa76}, {0xaaa7e, 0xaaaaf}, + {0xaaab9, 0xaaabd}, {0xaaadb, 0xaaadd}, {0xaaae0, 0xaaaea}, {0xaaaf2, 0xaaaf4}, + {0xaab01, 0xaab06}, {0xaab09, 0xaab0e}, {0xaab11, 0xaab16}, {0xaab20, 0xaab26}, + {0xaab28, 0xaab2e}, {0xaab30, 0xaab5a}, {0xaab5c, 0xaab65}, {0xaab70, 0xaabe2}, + {0xaac00, 0xad7a3}, {0xad7b0, 0xad7c6}, {0xad7cb, 0xad7fb}, {0xaf900, 0xafa6d}, + {0xafa70, 0xafad9}, {0xafb00, 0xafb06}, {0xafb13, 0xafb17}, {0xafb1f, 0xafb28}, + {0xafb2a, 0xafb36}, {0xafb38, 0xafb3c}, {0xafb46, 0xafbb1}, {0xafbd3, 0xafd3d}, + {0xafd50, 0xafd8f}, {0xafd92, 0xafdc7}, {0xafdf0, 0xafdfb}, {0xafe70, 0xafe74}, + {0xafe76, 0xafefc}, {0xaff21, 0xaff3a}, {0xaff41, 0xaff5a}, {0xaff66, 0xaffbe}, + {0xaffc2, 0xaffc7}, {0xaffca, 0xaffcf}, {0xaffd2, 0xaffd7}, {0xaffda, 0xaffdc}, + {0xb0041, 0xb005a}, {0xb0061, 0xb007a}, {0xb00c0, 0xb00d6}, {0xb00d8, 0xb00f6}, + {0xb00f8, 0xb02c1}, {0xb02c6, 0xb02d1}, {0xb02e0, 0xb02e4}, {0xb0370, 0xb0374}, + {0xb037a, 0xb037d}, {0xb0388, 0xb038a}, {0xb038e, 0xb03a1}, {0xb03a3, 0xb03f5}, + {0xb03f7, 0xb0481}, {0xb048a, 0xb052f}, {0xb0531, 0xb0556}, {0xb0561, 0xb0587}, + {0xb05d0, 0xb05ea}, {0xb05f0, 0xb05f2}, {0xb0620, 0xb064a}, {0xb0671, 0xb06d3}, + {0xb06fa, 0xb06fc}, {0xb0712, 0xb072f}, {0xb074d, 0xb07a5}, {0xb07ca, 0xb07ea}, + {0xb0800, 0xb0815}, {0xb0840, 0xb0858}, {0xb0860, 0xb086a}, {0xb08a0, 0xb08b4}, + {0xb08b6, 0xb08bd}, {0xb0904, 0xb0939}, {0xb0958, 0xb0961}, {0xb0971, 0xb0980}, + {0xb0985, 0xb098c}, {0xb0993, 0xb09a8}, {0xb09aa, 0xb09b0}, {0xb09b6, 0xb09b9}, + {0xb09df, 0xb09e1}, {0xb0a05, 0xb0a0a}, {0xb0a13, 0xb0a28}, {0xb0a2a, 0xb0a30}, + {0xb0a59, 0xb0a5c}, {0xb0a72, 0xb0a74}, {0xb0a85, 0xb0a8d}, {0xb0a8f, 0xb0a91}, + {0xb0a93, 0xb0aa8}, {0xb0aaa, 0xb0ab0}, {0xb0ab5, 0xb0ab9}, {0xb0b05, 0xb0b0c}, + {0xb0b13, 0xb0b28}, {0xb0b2a, 0xb0b30}, {0xb0b35, 0xb0b39}, {0xb0b5f, 0xb0b61}, + {0xb0b85, 0xb0b8a}, {0xb0b8e, 0xb0b90}, {0xb0b92, 0xb0b95}, {0xb0ba8, 0xb0baa}, + {0xb0bae, 0xb0bb9}, {0xb0c05, 0xb0c0c}, {0xb0c0e, 0xb0c10}, {0xb0c12, 0xb0c28}, + {0xb0c2a, 0xb0c39}, {0xb0c58, 0xb0c5a}, {0xb0c85, 0xb0c8c}, {0xb0c8e, 0xb0c90}, + {0xb0c92, 0xb0ca8}, {0xb0caa, 0xb0cb3}, {0xb0cb5, 0xb0cb9}, {0xb0d05, 0xb0d0c}, + {0xb0d0e, 0xb0d10}, {0xb0d12, 0xb0d3a}, {0xb0d54, 0xb0d56}, {0xb0d5f, 0xb0d61}, + {0xb0d7a, 0xb0d7f}, {0xb0d85, 0xb0d96}, {0xb0d9a, 0xb0db1}, {0xb0db3, 0xb0dbb}, + {0xb0dc0, 0xb0dc6}, {0xb0e01, 0xb0e30}, {0xb0e40, 0xb0e46}, {0xb0e94, 0xb0e97}, + {0xb0e99, 0xb0e9f}, {0xb0ea1, 0xb0ea3}, {0xb0ead, 0xb0eb0}, {0xb0ec0, 0xb0ec4}, + {0xb0edc, 0xb0edf}, {0xb0f40, 0xb0f47}, {0xb0f49, 0xb0f6c}, {0xb0f88, 0xb0f8c}, + {0xb1000, 0xb102a}, {0xb1050, 0xb1055}, {0xb105a, 0xb105d}, {0xb106e, 0xb1070}, + {0xb1075, 0xb1081}, {0xb10a0, 0xb10c5}, {0xb10d0, 0xb10fa}, {0xb10fc, 0xb1248}, + {0xb124a, 0xb124d}, {0xb1250, 0xb1256}, {0xb125a, 0xb125d}, {0xb1260, 0xb1288}, + {0xb128a, 0xb128d}, {0xb1290, 0xb12b0}, {0xb12b2, 0xb12b5}, {0xb12b8, 0xb12be}, + {0xb12c2, 0xb12c5}, {0xb12c8, 0xb12d6}, {0xb12d8, 0xb1310}, {0xb1312, 0xb1315}, + {0xb1318, 0xb135a}, {0xb1380, 0xb138f}, {0xb13a0, 0xb13f5}, {0xb13f8, 0xb13fd}, + {0xb1401, 0xb166c}, {0xb166f, 0xb167f}, {0xb1681, 0xb169a}, {0xb16a0, 0xb16ea}, + {0xb16f1, 0xb16f8}, {0xb1700, 0xb170c}, {0xb170e, 0xb1711}, {0xb1720, 0xb1731}, + {0xb1740, 0xb1751}, {0xb1760, 0xb176c}, {0xb176e, 0xb1770}, {0xb1780, 0xb17b3}, + {0xb1820, 0xb1877}, {0xb1880, 0xb1884}, {0xb1887, 0xb18a8}, {0xb18b0, 0xb18f5}, + {0xb1900, 0xb191e}, {0xb1950, 0xb196d}, {0xb1970, 0xb1974}, {0xb1980, 0xb19ab}, + {0xb19b0, 0xb19c9}, {0xb1a00, 0xb1a16}, {0xb1a20, 0xb1a54}, {0xb1b05, 0xb1b33}, + {0xb1b45, 0xb1b4b}, {0xb1b83, 0xb1ba0}, {0xb1bba, 0xb1be5}, {0xb1c00, 0xb1c23}, + {0xb1c4d, 0xb1c4f}, {0xb1c5a, 0xb1c7d}, {0xb1c80, 0xb1c88}, {0xb1ce9, 0xb1cec}, + {0xb1cee, 0xb1cf1}, {0xb1d00, 0xb1dbf}, {0xb1e00, 0xb1f15}, {0xb1f18, 0xb1f1d}, + {0xb1f20, 0xb1f45}, {0xb1f48, 0xb1f4d}, {0xb1f50, 0xb1f57}, {0xb1f5f, 0xb1f7d}, + {0xb1f80, 0xb1fb4}, {0xb1fb6, 0xb1fbc}, {0xb1fc2, 0xb1fc4}, {0xb1fc6, 0xb1fcc}, + {0xb1fd0, 0xb1fd3}, {0xb1fd6, 0xb1fdb}, {0xb1fe0, 0xb1fec}, {0xb1ff2, 0xb1ff4}, + {0xb1ff6, 0xb1ffc}, {0xb2090, 0xb209c}, {0xb210a, 0xb2113}, {0xb2119, 0xb211d}, + {0xb212a, 0xb212d}, {0xb212f, 0xb2139}, {0xb213c, 0xb213f}, {0xb2145, 0xb2149}, + {0xb2c00, 0xb2c2e}, {0xb2c30, 0xb2c5e}, {0xb2c60, 0xb2ce4}, {0xb2ceb, 0xb2cee}, + {0xb2d00, 0xb2d25}, {0xb2d30, 0xb2d67}, {0xb2d80, 0xb2d96}, {0xb2da0, 0xb2da6}, + {0xb2da8, 0xb2dae}, {0xb2db0, 0xb2db6}, {0xb2db8, 0xb2dbe}, {0xb2dc0, 0xb2dc6}, + {0xb2dc8, 0xb2dce}, {0xb2dd0, 0xb2dd6}, {0xb2dd8, 0xb2dde}, {0xb3031, 0xb3035}, + {0xb3041, 0xb3096}, {0xb309d, 0xb309f}, {0xb30a1, 0xb30fa}, {0xb30fc, 0xb30ff}, + {0xb3105, 0xb312e}, {0xb3131, 0xb318e}, {0xb31a0, 0xb31ba}, {0xb31f0, 0xb31ff}, + {0xb3400, 0xb4db5}, {0xb4e00, 0xb9fea}, {0xba000, 0xba48c}, {0xba4d0, 0xba4fd}, + {0xba500, 0xba60c}, {0xba610, 0xba61f}, {0xba640, 0xba66e}, {0xba67f, 0xba69d}, + {0xba6a0, 0xba6e5}, {0xba717, 0xba71f}, {0xba722, 0xba788}, {0xba78b, 0xba7ae}, + {0xba7b0, 0xba7b7}, {0xba7f7, 0xba801}, {0xba803, 0xba805}, {0xba807, 0xba80a}, + {0xba80c, 0xba822}, {0xba840, 0xba873}, {0xba882, 0xba8b3}, {0xba8f2, 0xba8f7}, + {0xba90a, 0xba925}, {0xba930, 0xba946}, {0xba960, 0xba97c}, {0xba984, 0xba9b2}, + {0xba9e0, 0xba9e4}, {0xba9e6, 0xba9ef}, {0xba9fa, 0xba9fe}, {0xbaa00, 0xbaa28}, + {0xbaa40, 0xbaa42}, {0xbaa44, 0xbaa4b}, {0xbaa60, 0xbaa76}, {0xbaa7e, 0xbaaaf}, + {0xbaab9, 0xbaabd}, {0xbaadb, 0xbaadd}, {0xbaae0, 0xbaaea}, {0xbaaf2, 0xbaaf4}, + {0xbab01, 0xbab06}, {0xbab09, 0xbab0e}, {0xbab11, 0xbab16}, {0xbab20, 0xbab26}, + {0xbab28, 0xbab2e}, {0xbab30, 0xbab5a}, {0xbab5c, 0xbab65}, {0xbab70, 0xbabe2}, + {0xbac00, 0xbd7a3}, {0xbd7b0, 0xbd7c6}, {0xbd7cb, 0xbd7fb}, {0xbf900, 0xbfa6d}, + {0xbfa70, 0xbfad9}, {0xbfb00, 0xbfb06}, {0xbfb13, 0xbfb17}, {0xbfb1f, 0xbfb28}, + {0xbfb2a, 0xbfb36}, {0xbfb38, 0xbfb3c}, {0xbfb46, 0xbfbb1}, {0xbfbd3, 0xbfd3d}, + {0xbfd50, 0xbfd8f}, {0xbfd92, 0xbfdc7}, {0xbfdf0, 0xbfdfb}, {0xbfe70, 0xbfe74}, + {0xbfe76, 0xbfefc}, {0xbff21, 0xbff3a}, {0xbff41, 0xbff5a}, {0xbff66, 0xbffbe}, + {0xbffc2, 0xbffc7}, {0xbffca, 0xbffcf}, {0xbffd2, 0xbffd7}, {0xbffda, 0xbffdc}, + {0xc0041, 0xc005a}, {0xc0061, 0xc007a}, {0xc00c0, 0xc00d6}, {0xc00d8, 0xc00f6}, + {0xc00f8, 0xc02c1}, {0xc02c6, 0xc02d1}, {0xc02e0, 0xc02e4}, {0xc0370, 0xc0374}, + {0xc037a, 0xc037d}, {0xc0388, 0xc038a}, {0xc038e, 0xc03a1}, {0xc03a3, 0xc03f5}, + {0xc03f7, 0xc0481}, {0xc048a, 0xc052f}, {0xc0531, 0xc0556}, {0xc0561, 0xc0587}, + {0xc05d0, 0xc05ea}, {0xc05f0, 0xc05f2}, {0xc0620, 0xc064a}, {0xc0671, 0xc06d3}, + {0xc06fa, 0xc06fc}, {0xc0712, 0xc072f}, {0xc074d, 0xc07a5}, {0xc07ca, 0xc07ea}, + {0xc0800, 0xc0815}, {0xc0840, 0xc0858}, {0xc0860, 0xc086a}, {0xc08a0, 0xc08b4}, + {0xc08b6, 0xc08bd}, {0xc0904, 0xc0939}, {0xc0958, 0xc0961}, {0xc0971, 0xc0980}, + {0xc0985, 0xc098c}, {0xc0993, 0xc09a8}, {0xc09aa, 0xc09b0}, {0xc09b6, 0xc09b9}, + {0xc09df, 0xc09e1}, {0xc0a05, 0xc0a0a}, {0xc0a13, 0xc0a28}, {0xc0a2a, 0xc0a30}, + {0xc0a59, 0xc0a5c}, {0xc0a72, 0xc0a74}, {0xc0a85, 0xc0a8d}, {0xc0a8f, 0xc0a91}, + {0xc0a93, 0xc0aa8}, {0xc0aaa, 0xc0ab0}, {0xc0ab5, 0xc0ab9}, {0xc0b05, 0xc0b0c}, + {0xc0b13, 0xc0b28}, {0xc0b2a, 0xc0b30}, {0xc0b35, 0xc0b39}, {0xc0b5f, 0xc0b61}, + {0xc0b85, 0xc0b8a}, {0xc0b8e, 0xc0b90}, {0xc0b92, 0xc0b95}, {0xc0ba8, 0xc0baa}, + {0xc0bae, 0xc0bb9}, {0xc0c05, 0xc0c0c}, {0xc0c0e, 0xc0c10}, {0xc0c12, 0xc0c28}, + {0xc0c2a, 0xc0c39}, {0xc0c58, 0xc0c5a}, {0xc0c85, 0xc0c8c}, {0xc0c8e, 0xc0c90}, + {0xc0c92, 0xc0ca8}, {0xc0caa, 0xc0cb3}, {0xc0cb5, 0xc0cb9}, {0xc0d05, 0xc0d0c}, + {0xc0d0e, 0xc0d10}, {0xc0d12, 0xc0d3a}, {0xc0d54, 0xc0d56}, {0xc0d5f, 0xc0d61}, + {0xc0d7a, 0xc0d7f}, {0xc0d85, 0xc0d96}, {0xc0d9a, 0xc0db1}, {0xc0db3, 0xc0dbb}, + {0xc0dc0, 0xc0dc6}, {0xc0e01, 0xc0e30}, {0xc0e40, 0xc0e46}, {0xc0e94, 0xc0e97}, + {0xc0e99, 0xc0e9f}, {0xc0ea1, 0xc0ea3}, {0xc0ead, 0xc0eb0}, {0xc0ec0, 0xc0ec4}, + {0xc0edc, 0xc0edf}, {0xc0f40, 0xc0f47}, {0xc0f49, 0xc0f6c}, {0xc0f88, 0xc0f8c}, + {0xc1000, 0xc102a}, {0xc1050, 0xc1055}, {0xc105a, 0xc105d}, {0xc106e, 0xc1070}, + {0xc1075, 0xc1081}, {0xc10a0, 0xc10c5}, {0xc10d0, 0xc10fa}, {0xc10fc, 0xc1248}, + {0xc124a, 0xc124d}, {0xc1250, 0xc1256}, {0xc125a, 0xc125d}, {0xc1260, 0xc1288}, + {0xc128a, 0xc128d}, {0xc1290, 0xc12b0}, {0xc12b2, 0xc12b5}, {0xc12b8, 0xc12be}, + {0xc12c2, 0xc12c5}, {0xc12c8, 0xc12d6}, {0xc12d8, 0xc1310}, {0xc1312, 0xc1315}, + {0xc1318, 0xc135a}, {0xc1380, 0xc138f}, {0xc13a0, 0xc13f5}, {0xc13f8, 0xc13fd}, + {0xc1401, 0xc166c}, {0xc166f, 0xc167f}, {0xc1681, 0xc169a}, {0xc16a0, 0xc16ea}, + {0xc16f1, 0xc16f8}, {0xc1700, 0xc170c}, {0xc170e, 0xc1711}, {0xc1720, 0xc1731}, + {0xc1740, 0xc1751}, {0xc1760, 0xc176c}, {0xc176e, 0xc1770}, {0xc1780, 0xc17b3}, + {0xc1820, 0xc1877}, {0xc1880, 0xc1884}, {0xc1887, 0xc18a8}, {0xc18b0, 0xc18f5}, + {0xc1900, 0xc191e}, {0xc1950, 0xc196d}, {0xc1970, 0xc1974}, {0xc1980, 0xc19ab}, + {0xc19b0, 0xc19c9}, {0xc1a00, 0xc1a16}, {0xc1a20, 0xc1a54}, {0xc1b05, 0xc1b33}, + {0xc1b45, 0xc1b4b}, {0xc1b83, 0xc1ba0}, {0xc1bba, 0xc1be5}, {0xc1c00, 0xc1c23}, + {0xc1c4d, 0xc1c4f}, {0xc1c5a, 0xc1c7d}, {0xc1c80, 0xc1c88}, {0xc1ce9, 0xc1cec}, + {0xc1cee, 0xc1cf1}, {0xc1d00, 0xc1dbf}, {0xc1e00, 0xc1f15}, {0xc1f18, 0xc1f1d}, + {0xc1f20, 0xc1f45}, {0xc1f48, 0xc1f4d}, {0xc1f50, 0xc1f57}, {0xc1f5f, 0xc1f7d}, + {0xc1f80, 0xc1fb4}, {0xc1fb6, 0xc1fbc}, {0xc1fc2, 0xc1fc4}, {0xc1fc6, 0xc1fcc}, + {0xc1fd0, 0xc1fd3}, {0xc1fd6, 0xc1fdb}, {0xc1fe0, 0xc1fec}, {0xc1ff2, 0xc1ff4}, + {0xc1ff6, 0xc1ffc}, {0xc2090, 0xc209c}, {0xc210a, 0xc2113}, {0xc2119, 0xc211d}, + {0xc212a, 0xc212d}, {0xc212f, 0xc2139}, {0xc213c, 0xc213f}, {0xc2145, 0xc2149}, + {0xc2c00, 0xc2c2e}, {0xc2c30, 0xc2c5e}, {0xc2c60, 0xc2ce4}, {0xc2ceb, 0xc2cee}, + {0xc2d00, 0xc2d25}, {0xc2d30, 0xc2d67}, {0xc2d80, 0xc2d96}, {0xc2da0, 0xc2da6}, + {0xc2da8, 0xc2dae}, {0xc2db0, 0xc2db6}, {0xc2db8, 0xc2dbe}, {0xc2dc0, 0xc2dc6}, + {0xc2dc8, 0xc2dce}, {0xc2dd0, 0xc2dd6}, {0xc2dd8, 0xc2dde}, {0xc3031, 0xc3035}, + {0xc3041, 0xc3096}, {0xc309d, 0xc309f}, {0xc30a1, 0xc30fa}, {0xc30fc, 0xc30ff}, + {0xc3105, 0xc312e}, {0xc3131, 0xc318e}, {0xc31a0, 0xc31ba}, {0xc31f0, 0xc31ff}, + {0xc3400, 0xc4db5}, {0xc4e00, 0xc9fea}, {0xca000, 0xca48c}, {0xca4d0, 0xca4fd}, + {0xca500, 0xca60c}, {0xca610, 0xca61f}, {0xca640, 0xca66e}, {0xca67f, 0xca69d}, + {0xca6a0, 0xca6e5}, {0xca717, 0xca71f}, {0xca722, 0xca788}, {0xca78b, 0xca7ae}, + {0xca7b0, 0xca7b7}, {0xca7f7, 0xca801}, {0xca803, 0xca805}, {0xca807, 0xca80a}, + {0xca80c, 0xca822}, {0xca840, 0xca873}, {0xca882, 0xca8b3}, {0xca8f2, 0xca8f7}, + {0xca90a, 0xca925}, {0xca930, 0xca946}, {0xca960, 0xca97c}, {0xca984, 0xca9b2}, + {0xca9e0, 0xca9e4}, {0xca9e6, 0xca9ef}, {0xca9fa, 0xca9fe}, {0xcaa00, 0xcaa28}, + {0xcaa40, 0xcaa42}, {0xcaa44, 0xcaa4b}, {0xcaa60, 0xcaa76}, {0xcaa7e, 0xcaaaf}, + {0xcaab9, 0xcaabd}, {0xcaadb, 0xcaadd}, {0xcaae0, 0xcaaea}, {0xcaaf2, 0xcaaf4}, + {0xcab01, 0xcab06}, {0xcab09, 0xcab0e}, {0xcab11, 0xcab16}, {0xcab20, 0xcab26}, + {0xcab28, 0xcab2e}, {0xcab30, 0xcab5a}, {0xcab5c, 0xcab65}, {0xcab70, 0xcabe2}, + {0xcac00, 0xcd7a3}, {0xcd7b0, 0xcd7c6}, {0xcd7cb, 0xcd7fb}, {0xcf900, 0xcfa6d}, + {0xcfa70, 0xcfad9}, {0xcfb00, 0xcfb06}, {0xcfb13, 0xcfb17}, {0xcfb1f, 0xcfb28}, + {0xcfb2a, 0xcfb36}, {0xcfb38, 0xcfb3c}, {0xcfb46, 0xcfbb1}, {0xcfbd3, 0xcfd3d}, + {0xcfd50, 0xcfd8f}, {0xcfd92, 0xcfdc7}, {0xcfdf0, 0xcfdfb}, {0xcfe70, 0xcfe74}, + {0xcfe76, 0xcfefc}, {0xcff21, 0xcff3a}, {0xcff41, 0xcff5a}, {0xcff66, 0xcffbe}, + {0xcffc2, 0xcffc7}, {0xcffca, 0xcffcf}, {0xcffd2, 0xcffd7}, {0xcffda, 0xcffdc}, + {0xd0041, 0xd005a}, {0xd0061, 0xd007a}, {0xd00c0, 0xd00d6}, {0xd00d8, 0xd00f6}, + {0xd00f8, 0xd02c1}, {0xd02c6, 0xd02d1}, {0xd02e0, 0xd02e4}, {0xd0370, 0xd0374}, + {0xd037a, 0xd037d}, {0xd0388, 0xd038a}, {0xd038e, 0xd03a1}, {0xd03a3, 0xd03f5}, + {0xd03f7, 0xd0481}, {0xd048a, 0xd052f}, {0xd0531, 0xd0556}, {0xd0561, 0xd0587}, + {0xd05d0, 0xd05ea}, {0xd05f0, 0xd05f2}, {0xd0620, 0xd064a}, {0xd0671, 0xd06d3}, + {0xd06fa, 0xd06fc}, {0xd0712, 0xd072f}, {0xd074d, 0xd07a5}, {0xd07ca, 0xd07ea}, + {0xd0800, 0xd0815}, {0xd0840, 0xd0858}, {0xd0860, 0xd086a}, {0xd08a0, 0xd08b4}, + {0xd08b6, 0xd08bd}, {0xd0904, 0xd0939}, {0xd0958, 0xd0961}, {0xd0971, 0xd0980}, + {0xd0985, 0xd098c}, {0xd0993, 0xd09a8}, {0xd09aa, 0xd09b0}, {0xd09b6, 0xd09b9}, + {0xd09df, 0xd09e1}, {0xd0a05, 0xd0a0a}, {0xd0a13, 0xd0a28}, {0xd0a2a, 0xd0a30}, + {0xd0a59, 0xd0a5c}, {0xd0a72, 0xd0a74}, {0xd0a85, 0xd0a8d}, {0xd0a8f, 0xd0a91}, + {0xd0a93, 0xd0aa8}, {0xd0aaa, 0xd0ab0}, {0xd0ab5, 0xd0ab9}, {0xd0b05, 0xd0b0c}, + {0xd0b13, 0xd0b28}, {0xd0b2a, 0xd0b30}, {0xd0b35, 0xd0b39}, {0xd0b5f, 0xd0b61}, + {0xd0b85, 0xd0b8a}, {0xd0b8e, 0xd0b90}, {0xd0b92, 0xd0b95}, {0xd0ba8, 0xd0baa}, + {0xd0bae, 0xd0bb9}, {0xd0c05, 0xd0c0c}, {0xd0c0e, 0xd0c10}, {0xd0c12, 0xd0c28}, + {0xd0c2a, 0xd0c39}, {0xd0c58, 0xd0c5a}, {0xd0c85, 0xd0c8c}, {0xd0c8e, 0xd0c90}, + {0xd0c92, 0xd0ca8}, {0xd0caa, 0xd0cb3}, {0xd0cb5, 0xd0cb9}, {0xd0d05, 0xd0d0c}, + {0xd0d0e, 0xd0d10}, {0xd0d12, 0xd0d3a}, {0xd0d54, 0xd0d56}, {0xd0d5f, 0xd0d61}, + {0xd0d7a, 0xd0d7f}, {0xd0d85, 0xd0d96}, {0xd0d9a, 0xd0db1}, {0xd0db3, 0xd0dbb}, + {0xd0dc0, 0xd0dc6}, {0xd0e01, 0xd0e30}, {0xd0e40, 0xd0e46}, {0xd0e94, 0xd0e97}, + {0xd0e99, 0xd0e9f}, {0xd0ea1, 0xd0ea3}, {0xd0ead, 0xd0eb0}, {0xd0ec0, 0xd0ec4}, + {0xd0edc, 0xd0edf}, {0xd0f40, 0xd0f47}, {0xd0f49, 0xd0f6c}, {0xd0f88, 0xd0f8c}, + {0xd1000, 0xd102a}, {0xd1050, 0xd1055}, {0xd105a, 0xd105d}, {0xd106e, 0xd1070}, + {0xd1075, 0xd1081}, {0xd10a0, 0xd10c5}, {0xd10d0, 0xd10fa}, {0xd10fc, 0xd1248}, + {0xd124a, 0xd124d}, {0xd1250, 0xd1256}, {0xd125a, 0xd125d}, {0xd1260, 0xd1288}, + {0xd128a, 0xd128d}, {0xd1290, 0xd12b0}, {0xd12b2, 0xd12b5}, {0xd12b8, 0xd12be}, + {0xd12c2, 0xd12c5}, {0xd12c8, 0xd12d6}, {0xd12d8, 0xd1310}, {0xd1312, 0xd1315}, + {0xd1318, 0xd135a}, {0xd1380, 0xd138f}, {0xd13a0, 0xd13f5}, {0xd13f8, 0xd13fd}, + {0xd1401, 0xd166c}, {0xd166f, 0xd167f}, {0xd1681, 0xd169a}, {0xd16a0, 0xd16ea}, + {0xd16f1, 0xd16f8}, {0xd1700, 0xd170c}, {0xd170e, 0xd1711}, {0xd1720, 0xd1731}, + {0xd1740, 0xd1751}, {0xd1760, 0xd176c}, {0xd176e, 0xd1770}, {0xd1780, 0xd17b3}, + {0xd1820, 0xd1877}, {0xd1880, 0xd1884}, {0xd1887, 0xd18a8}, {0xd18b0, 0xd18f5}, + {0xd1900, 0xd191e}, {0xd1950, 0xd196d}, {0xd1970, 0xd1974}, {0xd1980, 0xd19ab}, + {0xd19b0, 0xd19c9}, {0xd1a00, 0xd1a16}, {0xd1a20, 0xd1a54}, {0xd1b05, 0xd1b33}, + {0xd1b45, 0xd1b4b}, {0xd1b83, 0xd1ba0}, {0xd1bba, 0xd1be5}, {0xd1c00, 0xd1c23}, + {0xd1c4d, 0xd1c4f}, {0xd1c5a, 0xd1c7d}, {0xd1c80, 0xd1c88}, {0xd1ce9, 0xd1cec}, + {0xd1cee, 0xd1cf1}, {0xd1d00, 0xd1dbf}, {0xd1e00, 0xd1f15}, {0xd1f18, 0xd1f1d}, + {0xd1f20, 0xd1f45}, {0xd1f48, 0xd1f4d}, {0xd1f50, 0xd1f57}, {0xd1f5f, 0xd1f7d}, + {0xd1f80, 0xd1fb4}, {0xd1fb6, 0xd1fbc}, {0xd1fc2, 0xd1fc4}, {0xd1fc6, 0xd1fcc}, + {0xd1fd0, 0xd1fd3}, {0xd1fd6, 0xd1fdb}, {0xd1fe0, 0xd1fec}, {0xd1ff2, 0xd1ff4}, + {0xd1ff6, 0xd1ffc}, {0xd2090, 0xd209c}, {0xd210a, 0xd2113}, {0xd2119, 0xd211d}, + {0xd212a, 0xd212d}, {0xd212f, 0xd2139}, {0xd213c, 0xd213f}, {0xd2145, 0xd2149}, + {0xd2c00, 0xd2c2e}, {0xd2c30, 0xd2c5e}, {0xd2c60, 0xd2ce4}, {0xd2ceb, 0xd2cee}, + {0xd2d00, 0xd2d25}, {0xd2d30, 0xd2d67}, {0xd2d80, 0xd2d96}, {0xd2da0, 0xd2da6}, + {0xd2da8, 0xd2dae}, {0xd2db0, 0xd2db6}, {0xd2db8, 0xd2dbe}, {0xd2dc0, 0xd2dc6}, + {0xd2dc8, 0xd2dce}, {0xd2dd0, 0xd2dd6}, {0xd2dd8, 0xd2dde}, {0xd3031, 0xd3035}, + {0xd3041, 0xd3096}, {0xd309d, 0xd309f}, {0xd30a1, 0xd30fa}, {0xd30fc, 0xd30ff}, + {0xd3105, 0xd312e}, {0xd3131, 0xd318e}, {0xd31a0, 0xd31ba}, {0xd31f0, 0xd31ff}, + {0xd3400, 0xd4db5}, {0xd4e00, 0xd9fea}, {0xda000, 0xda48c}, {0xda4d0, 0xda4fd}, + {0xda500, 0xda60c}, {0xda610, 0xda61f}, {0xda640, 0xda66e}, {0xda67f, 0xda69d}, + {0xda6a0, 0xda6e5}, {0xda717, 0xda71f}, {0xda722, 0xda788}, {0xda78b, 0xda7ae}, + {0xda7b0, 0xda7b7}, {0xda7f7, 0xda801}, {0xda803, 0xda805}, {0xda807, 0xda80a}, + {0xda80c, 0xda822}, {0xda840, 0xda873}, {0xda882, 0xda8b3}, {0xda8f2, 0xda8f7}, + {0xda90a, 0xda925}, {0xda930, 0xda946}, {0xda960, 0xda97c}, {0xda984, 0xda9b2}, + {0xda9e0, 0xda9e4}, {0xda9e6, 0xda9ef}, {0xda9fa, 0xda9fe}, {0xdaa00, 0xdaa28}, + {0xdaa40, 0xdaa42}, {0xdaa44, 0xdaa4b}, {0xdaa60, 0xdaa76}, {0xdaa7e, 0xdaaaf}, + {0xdaab9, 0xdaabd}, {0xdaadb, 0xdaadd}, {0xdaae0, 0xdaaea}, {0xdaaf2, 0xdaaf4}, + {0xdab01, 0xdab06}, {0xdab09, 0xdab0e}, {0xdab11, 0xdab16}, {0xdab20, 0xdab26}, + {0xdab28, 0xdab2e}, {0xdab30, 0xdab5a}, {0xdab5c, 0xdab65}, {0xdab70, 0xdabe2}, + {0xdac00, 0xdd7a3}, {0xdd7b0, 0xdd7c6}, {0xdd7cb, 0xdd7fb}, {0xdf900, 0xdfa6d}, + {0xdfa70, 0xdfad9}, {0xdfb00, 0xdfb06}, {0xdfb13, 0xdfb17}, {0xdfb1f, 0xdfb28}, + {0xdfb2a, 0xdfb36}, {0xdfb38, 0xdfb3c}, {0xdfb46, 0xdfbb1}, {0xdfbd3, 0xdfd3d}, + {0xdfd50, 0xdfd8f}, {0xdfd92, 0xdfdc7}, {0xdfdf0, 0xdfdfb}, {0xdfe70, 0xdfe74}, + {0xdfe76, 0xdfefc}, {0xdff21, 0xdff3a}, {0xdff41, 0xdff5a}, {0xdff66, 0xdffbe}, + {0xdffc2, 0xdffc7}, {0xdffca, 0xdffcf}, {0xdffd2, 0xdffd7}, {0xdffda, 0xdffdc}, + {0xe0041, 0xe005a}, {0xe0061, 0xe007a}, {0xe00c0, 0xe00d6}, {0xe00d8, 0xe00f6}, + {0xe00f8, 0xe02c1}, {0xe02c6, 0xe02d1}, {0xe02e0, 0xe02e4}, {0xe0370, 0xe0374}, + {0xe037a, 0xe037d}, {0xe0388, 0xe038a}, {0xe038e, 0xe03a1}, {0xe03a3, 0xe03f5}, + {0xe03f7, 0xe0481}, {0xe048a, 0xe052f}, {0xe0531, 0xe0556}, {0xe0561, 0xe0587}, + {0xe05d0, 0xe05ea}, {0xe05f0, 0xe05f2}, {0xe0620, 0xe064a}, {0xe0671, 0xe06d3}, + {0xe06fa, 0xe06fc}, {0xe0712, 0xe072f}, {0xe074d, 0xe07a5}, {0xe07ca, 0xe07ea}, + {0xe0800, 0xe0815}, {0xe0840, 0xe0858}, {0xe0860, 0xe086a}, {0xe08a0, 0xe08b4}, + {0xe08b6, 0xe08bd}, {0xe0904, 0xe0939}, {0xe0958, 0xe0961}, {0xe0971, 0xe0980}, + {0xe0985, 0xe098c}, {0xe0993, 0xe09a8}, {0xe09aa, 0xe09b0}, {0xe09b6, 0xe09b9}, + {0xe09df, 0xe09e1}, {0xe0a05, 0xe0a0a}, {0xe0a13, 0xe0a28}, {0xe0a2a, 0xe0a30}, + {0xe0a59, 0xe0a5c}, {0xe0a72, 0xe0a74}, {0xe0a85, 0xe0a8d}, {0xe0a8f, 0xe0a91}, + {0xe0a93, 0xe0aa8}, {0xe0aaa, 0xe0ab0}, {0xe0ab5, 0xe0ab9}, {0xe0b05, 0xe0b0c}, + {0xe0b13, 0xe0b28}, {0xe0b2a, 0xe0b30}, {0xe0b35, 0xe0b39}, {0xe0b5f, 0xe0b61}, + {0xe0b85, 0xe0b8a}, {0xe0b8e, 0xe0b90}, {0xe0b92, 0xe0b95}, {0xe0ba8, 0xe0baa}, + {0xe0bae, 0xe0bb9}, {0xe0c05, 0xe0c0c}, {0xe0c0e, 0xe0c10}, {0xe0c12, 0xe0c28}, + {0xe0c2a, 0xe0c39}, {0xe0c58, 0xe0c5a}, {0xe0c85, 0xe0c8c}, {0xe0c8e, 0xe0c90}, + {0xe0c92, 0xe0ca8}, {0xe0caa, 0xe0cb3}, {0xe0cb5, 0xe0cb9}, {0xe0d05, 0xe0d0c}, + {0xe0d0e, 0xe0d10}, {0xe0d12, 0xe0d3a}, {0xe0d54, 0xe0d56}, {0xe0d5f, 0xe0d61}, + {0xe0d7a, 0xe0d7f}, {0xe0d85, 0xe0d96}, {0xe0d9a, 0xe0db1}, {0xe0db3, 0xe0dbb}, + {0xe0dc0, 0xe0dc6}, {0xe0e01, 0xe0e30}, {0xe0e40, 0xe0e46}, {0xe0e94, 0xe0e97}, + {0xe0e99, 0xe0e9f}, {0xe0ea1, 0xe0ea3}, {0xe0ead, 0xe0eb0}, {0xe0ec0, 0xe0ec4}, + {0xe0edc, 0xe0edf}, {0xe0f40, 0xe0f47}, {0xe0f49, 0xe0f6c}, {0xe0f88, 0xe0f8c}, + {0xe1000, 0xe102a}, {0xe1050, 0xe1055}, {0xe105a, 0xe105d}, {0xe106e, 0xe1070}, + {0xe1075, 0xe1081}, {0xe10a0, 0xe10c5}, {0xe10d0, 0xe10fa}, {0xe10fc, 0xe1248}, + {0xe124a, 0xe124d}, {0xe1250, 0xe1256}, {0xe125a, 0xe125d}, {0xe1260, 0xe1288}, + {0xe128a, 0xe128d}, {0xe1290, 0xe12b0}, {0xe12b2, 0xe12b5}, {0xe12b8, 0xe12be}, + {0xe12c2, 0xe12c5}, {0xe12c8, 0xe12d6}, {0xe12d8, 0xe1310}, {0xe1312, 0xe1315}, + {0xe1318, 0xe135a}, {0xe1380, 0xe138f}, {0xe13a0, 0xe13f5}, {0xe13f8, 0xe13fd}, + {0xe1401, 0xe166c}, {0xe166f, 0xe167f}, {0xe1681, 0xe169a}, {0xe16a0, 0xe16ea}, + {0xe16f1, 0xe16f8}, {0xe1700, 0xe170c}, {0xe170e, 0xe1711}, {0xe1720, 0xe1731}, + {0xe1740, 0xe1751}, {0xe1760, 0xe176c}, {0xe176e, 0xe1770}, {0xe1780, 0xe17b3}, + {0xe1820, 0xe1877}, {0xe1880, 0xe1884}, {0xe1887, 0xe18a8}, {0xe18b0, 0xe18f5}, + {0xe1900, 0xe191e}, {0xe1950, 0xe196d}, {0xe1970, 0xe1974}, {0xe1980, 0xe19ab}, + {0xe19b0, 0xe19c9}, {0xe1a00, 0xe1a16}, {0xe1a20, 0xe1a54}, {0xe1b05, 0xe1b33}, + {0xe1b45, 0xe1b4b}, {0xe1b83, 0xe1ba0}, {0xe1bba, 0xe1be5}, {0xe1c00, 0xe1c23}, + {0xe1c4d, 0xe1c4f}, {0xe1c5a, 0xe1c7d}, {0xe1c80, 0xe1c88}, {0xe1ce9, 0xe1cec}, + {0xe1cee, 0xe1cf1}, {0xe1d00, 0xe1dbf}, {0xe1e00, 0xe1f15}, {0xe1f18, 0xe1f1d}, + {0xe1f20, 0xe1f45}, {0xe1f48, 0xe1f4d}, {0xe1f50, 0xe1f57}, {0xe1f5f, 0xe1f7d}, + {0xe1f80, 0xe1fb4}, {0xe1fb6, 0xe1fbc}, {0xe1fc2, 0xe1fc4}, {0xe1fc6, 0xe1fcc}, + {0xe1fd0, 0xe1fd3}, {0xe1fd6, 0xe1fdb}, {0xe1fe0, 0xe1fec}, {0xe1ff2, 0xe1ff4}, + {0xe1ff6, 0xe1ffc}, {0xe2090, 0xe209c}, {0xe210a, 0xe2113}, {0xe2119, 0xe211d}, + {0xe212a, 0xe212d}, {0xe212f, 0xe2139}, {0xe213c, 0xe213f}, {0xe2145, 0xe2149}, + {0xe2c00, 0xe2c2e}, {0xe2c30, 0xe2c5e}, {0xe2c60, 0xe2ce4}, {0xe2ceb, 0xe2cee}, + {0xe2d00, 0xe2d25}, {0xe2d30, 0xe2d67}, {0xe2d80, 0xe2d96}, {0xe2da0, 0xe2da6}, + {0xe2da8, 0xe2dae}, {0xe2db0, 0xe2db6}, {0xe2db8, 0xe2dbe}, {0xe2dc0, 0xe2dc6}, + {0xe2dc8, 0xe2dce}, {0xe2dd0, 0xe2dd6}, {0xe2dd8, 0xe2dde}, {0xe3031, 0xe3035}, + {0xe3041, 0xe3096}, {0xe309d, 0xe309f}, {0xe30a1, 0xe30fa}, {0xe30fc, 0xe30ff}, + {0xe3105, 0xe312e}, {0xe3131, 0xe318e}, {0xe31a0, 0xe31ba}, {0xe31f0, 0xe31ff}, + {0xe3400, 0xe4db5}, {0xe4e00, 0xe9fea}, {0xea000, 0xea48c}, {0xea4d0, 0xea4fd}, + {0xea500, 0xea60c}, {0xea610, 0xea61f}, {0xea640, 0xea66e}, {0xea67f, 0xea69d}, + {0xea6a0, 0xea6e5}, {0xea717, 0xea71f}, {0xea722, 0xea788}, {0xea78b, 0xea7ae}, + {0xea7b0, 0xea7b7}, {0xea7f7, 0xea801}, {0xea803, 0xea805}, {0xea807, 0xea80a}, + {0xea80c, 0xea822}, {0xea840, 0xea873}, {0xea882, 0xea8b3}, {0xea8f2, 0xea8f7}, + {0xea90a, 0xea925}, {0xea930, 0xea946}, {0xea960, 0xea97c}, {0xea984, 0xea9b2}, + {0xea9e0, 0xea9e4}, {0xea9e6, 0xea9ef}, {0xea9fa, 0xea9fe}, {0xeaa00, 0xeaa28}, + {0xeaa40, 0xeaa42}, {0xeaa44, 0xeaa4b}, {0xeaa60, 0xeaa76}, {0xeaa7e, 0xeaaaf}, + {0xeaab9, 0xeaabd}, {0xeaadb, 0xeaadd}, {0xeaae0, 0xeaaea}, {0xeaaf2, 0xeaaf4}, + {0xeab01, 0xeab06}, {0xeab09, 0xeab0e}, {0xeab11, 0xeab16}, {0xeab20, 0xeab26}, + {0xeab28, 0xeab2e}, {0xeab30, 0xeab5a}, {0xeab5c, 0xeab65}, {0xeab70, 0xeabe2}, + {0xeac00, 0xed7a3}, {0xed7b0, 0xed7c6}, {0xed7cb, 0xed7fb}, {0xef900, 0xefa6d}, + {0xefa70, 0xefad9}, {0xefb00, 0xefb06}, {0xefb13, 0xefb17}, {0xefb1f, 0xefb28}, + {0xefb2a, 0xefb36}, {0xefb38, 0xefb3c}, {0xefb46, 0xefbb1}, {0xefbd3, 0xefd3d}, + {0xefd50, 0xefd8f}, {0xefd92, 0xefdc7}, {0xefdf0, 0xefdfb}, {0xefe70, 0xefe74}, + {0xefe76, 0xefefc}, {0xeff21, 0xeff3a}, {0xeff41, 0xeff5a}, {0xeff66, 0xeffbe}, + {0xeffc2, 0xeffc7}, {0xeffca, 0xeffcf}, {0xeffd2, 0xeffd7}, {0xeffda, 0xeffdc}, + {0xf0041, 0xf005a}, {0xf0061, 0xf007a}, {0xf00c0, 0xf00d6}, {0xf00d8, 0xf00f6}, + {0xf00f8, 0xf02c1}, {0xf02c6, 0xf02d1}, {0xf02e0, 0xf02e4}, {0xf0370, 0xf0374}, + {0xf037a, 0xf037d}, {0xf0388, 0xf038a}, {0xf038e, 0xf03a1}, {0xf03a3, 0xf03f5}, + {0xf03f7, 0xf0481}, {0xf048a, 0xf052f}, {0xf0531, 0xf0556}, {0xf0561, 0xf0587}, + {0xf05d0, 0xf05ea}, {0xf05f0, 0xf05f2}, {0xf0620, 0xf064a}, {0xf0671, 0xf06d3}, + {0xf06fa, 0xf06fc}, {0xf0712, 0xf072f}, {0xf074d, 0xf07a5}, {0xf07ca, 0xf07ea}, + {0xf0800, 0xf0815}, {0xf0840, 0xf0858}, {0xf0860, 0xf086a}, {0xf08a0, 0xf08b4}, + {0xf08b6, 0xf08bd}, {0xf0904, 0xf0939}, {0xf0958, 0xf0961}, {0xf0971, 0xf0980}, + {0xf0985, 0xf098c}, {0xf0993, 0xf09a8}, {0xf09aa, 0xf09b0}, {0xf09b6, 0xf09b9}, + {0xf09df, 0xf09e1}, {0xf0a05, 0xf0a0a}, {0xf0a13, 0xf0a28}, {0xf0a2a, 0xf0a30}, + {0xf0a59, 0xf0a5c}, {0xf0a72, 0xf0a74}, {0xf0a85, 0xf0a8d}, {0xf0a8f, 0xf0a91}, + {0xf0a93, 0xf0aa8}, {0xf0aaa, 0xf0ab0}, {0xf0ab5, 0xf0ab9}, {0xf0b05, 0xf0b0c}, + {0xf0b13, 0xf0b28}, {0xf0b2a, 0xf0b30}, {0xf0b35, 0xf0b39}, {0xf0b5f, 0xf0b61}, + {0xf0b85, 0xf0b8a}, {0xf0b8e, 0xf0b90}, {0xf0b92, 0xf0b95}, {0xf0ba8, 0xf0baa}, + {0xf0bae, 0xf0bb9}, {0xf0c05, 0xf0c0c}, {0xf0c0e, 0xf0c10}, {0xf0c12, 0xf0c28}, + {0xf0c2a, 0xf0c39}, {0xf0c58, 0xf0c5a}, {0xf0c85, 0xf0c8c}, {0xf0c8e, 0xf0c90}, + {0xf0c92, 0xf0ca8}, {0xf0caa, 0xf0cb3}, {0xf0cb5, 0xf0cb9}, {0xf0d05, 0xf0d0c}, + {0xf0d0e, 0xf0d10}, {0xf0d12, 0xf0d3a}, {0xf0d54, 0xf0d56}, {0xf0d5f, 0xf0d61}, + {0xf0d7a, 0xf0d7f}, {0xf0d85, 0xf0d96}, {0xf0d9a, 0xf0db1}, {0xf0db3, 0xf0dbb}, + {0xf0dc0, 0xf0dc6}, {0xf0e01, 0xf0e30}, {0xf0e40, 0xf0e46}, {0xf0e94, 0xf0e97}, + {0xf0e99, 0xf0e9f}, {0xf0ea1, 0xf0ea3}, {0xf0ead, 0xf0eb0}, {0xf0ec0, 0xf0ec4}, + {0xf0edc, 0xf0edf}, {0xf0f40, 0xf0f47}, {0xf0f49, 0xf0f6c}, {0xf0f88, 0xf0f8c}, + {0xf1000, 0xf102a}, {0xf1050, 0xf1055}, {0xf105a, 0xf105d}, {0xf106e, 0xf1070}, + {0xf1075, 0xf1081}, {0xf10a0, 0xf10c5}, {0xf10d0, 0xf10fa}, {0xf10fc, 0xf1248}, + {0xf124a, 0xf124d}, {0xf1250, 0xf1256}, {0xf125a, 0xf125d}, {0xf1260, 0xf1288}, + {0xf128a, 0xf128d}, {0xf1290, 0xf12b0}, {0xf12b2, 0xf12b5}, {0xf12b8, 0xf12be}, + {0xf12c2, 0xf12c5}, {0xf12c8, 0xf12d6}, {0xf12d8, 0xf1310}, {0xf1312, 0xf1315}, + {0xf1318, 0xf135a}, {0xf1380, 0xf138f}, {0xf13a0, 0xf13f5}, {0xf13f8, 0xf13fd}, + {0xf1401, 0xf166c}, {0xf166f, 0xf167f}, {0xf1681, 0xf169a}, {0xf16a0, 0xf16ea}, + {0xf16f1, 0xf16f8}, {0xf1700, 0xf170c}, {0xf170e, 0xf1711}, {0xf1720, 0xf1731}, + {0xf1740, 0xf1751}, {0xf1760, 0xf176c}, {0xf176e, 0xf1770}, {0xf1780, 0xf17b3}, + {0xf1820, 0xf1877}, {0xf1880, 0xf1884}, {0xf1887, 0xf18a8}, {0xf18b0, 0xf18f5}, + {0xf1900, 0xf191e}, {0xf1950, 0xf196d}, {0xf1970, 0xf1974}, {0xf1980, 0xf19ab}, + {0xf19b0, 0xf19c9}, {0xf1a00, 0xf1a16}, {0xf1a20, 0xf1a54}, {0xf1b05, 0xf1b33}, + {0xf1b45, 0xf1b4b}, {0xf1b83, 0xf1ba0}, {0xf1bba, 0xf1be5}, {0xf1c00, 0xf1c23}, + {0xf1c4d, 0xf1c4f}, {0xf1c5a, 0xf1c7d}, {0xf1c80, 0xf1c88}, {0xf1ce9, 0xf1cec}, + {0xf1cee, 0xf1cf1}, {0xf1d00, 0xf1dbf}, {0xf1e00, 0xf1f15}, {0xf1f18, 0xf1f1d}, + {0xf1f20, 0xf1f45}, {0xf1f48, 0xf1f4d}, {0xf1f50, 0xf1f57}, {0xf1f5f, 0xf1f7d}, + {0xf1f80, 0xf1fb4}, {0xf1fb6, 0xf1fbc}, {0xf1fc2, 0xf1fc4}, {0xf1fc6, 0xf1fcc}, + {0xf1fd0, 0xf1fd3}, {0xf1fd6, 0xf1fdb}, {0xf1fe0, 0xf1fec}, {0xf1ff2, 0xf1ff4}, + {0xf1ff6, 0xf1ffc}, {0xf2090, 0xf209c}, {0xf210a, 0xf2113}, {0xf2119, 0xf211d}, + {0xf212a, 0xf212d}, {0xf212f, 0xf2139}, {0xf213c, 0xf213f}, {0xf2145, 0xf2149}, + {0xf2c00, 0xf2c2e}, {0xf2c30, 0xf2c5e}, {0xf2c60, 0xf2ce4}, {0xf2ceb, 0xf2cee}, + {0xf2d00, 0xf2d25}, {0xf2d30, 0xf2d67}, {0xf2d80, 0xf2d96}, {0xf2da0, 0xf2da6}, + {0xf2da8, 0xf2dae}, {0xf2db0, 0xf2db6}, {0xf2db8, 0xf2dbe}, {0xf2dc0, 0xf2dc6}, + {0xf2dc8, 0xf2dce}, {0xf2dd0, 0xf2dd6}, {0xf2dd8, 0xf2dde}, {0xf3031, 0xf3035}, + {0xf3041, 0xf3096}, {0xf309d, 0xf309f}, {0xf30a1, 0xf30fa}, {0xf30fc, 0xf30ff}, + {0xf3105, 0xf312e}, {0xf3131, 0xf318e}, {0xf31a0, 0xf31ba}, {0xf31f0, 0xf31ff}, + {0xf3400, 0xf4db5}, {0xf4e00, 0xf9fea}, {0xfa000, 0xfa48c}, {0xfa4d0, 0xfa4fd}, + {0xfa500, 0xfa60c}, {0xfa610, 0xfa61f}, {0xfa640, 0xfa66e}, {0xfa67f, 0xfa69d}, + {0xfa6a0, 0xfa6e5}, {0xfa717, 0xfa71f}, {0xfa722, 0xfa788}, {0xfa78b, 0xfa7ae}, + {0xfa7b0, 0xfa7b7}, {0xfa7f7, 0xfa801}, {0xfa803, 0xfa805}, {0xfa807, 0xfa80a}, + {0xfa80c, 0xfa822}, {0xfa840, 0xfa873}, {0xfa882, 0xfa8b3}, {0xfa8f2, 0xfa8f7}, + {0xfa90a, 0xfa925}, {0xfa930, 0xfa946}, {0xfa960, 0xfa97c}, {0xfa984, 0xfa9b2}, + {0xfa9e0, 0xfa9e4}, {0xfa9e6, 0xfa9ef}, {0xfa9fa, 0xfa9fe}, {0xfaa00, 0xfaa28}, + {0xfaa40, 0xfaa42}, {0xfaa44, 0xfaa4b}, {0xfaa60, 0xfaa76}, {0xfaa7e, 0xfaaaf}, + {0xfaab9, 0xfaabd}, {0xfaadb, 0xfaadd}, {0xfaae0, 0xfaaea}, {0xfaaf2, 0xfaaf4}, + {0xfab01, 0xfab06}, {0xfab09, 0xfab0e}, {0xfab11, 0xfab16}, {0xfab20, 0xfab26}, + {0xfab28, 0xfab2e}, {0xfab30, 0xfab5a}, {0xfab5c, 0xfab65}, {0xfab70, 0xfabe2}, + {0xfac00, 0xfd7a3}, {0xfd7b0, 0xfd7c6}, {0xfd7cb, 0xfd7fb}, {0xff900, 0xffa6d}, + {0xffa70, 0xffad9}, {0xffb00, 0xffb06}, {0xffb13, 0xffb17}, {0xffb1f, 0xffb28}, + {0xffb2a, 0xffb36}, {0xffb38, 0xffb3c}, {0xffb46, 0xffbb1}, {0xffbd3, 0xffd3d}, + {0xffd50, 0xffd8f}, {0xffd92, 0xffdc7}, {0xffdf0, 0xffdfb}, {0xffe70, 0xffe74}, + {0xffe76, 0xffefc}, {0xfff21, 0xfff3a}, {0xfff41, 0xfff5a}, {0xfff66, 0xfffbe}, + {0xfffc2, 0xfffc7}, {0xfffca, 0xfffcf}, {0xfffd2, 0xfffd7}, {0xfffda, 0xfffdc}, + {0x100041, 0x10005a}, {0x100061, 0x10007a}, {0x1000c0, 0x1000d6}, {0x1000d8, 0x1000f6}, + {0x1000f8, 0x1002c1}, {0x1002c6, 0x1002d1}, {0x1002e0, 0x1002e4}, {0x100370, 0x100374}, + {0x10037a, 0x10037d}, {0x100388, 0x10038a}, {0x10038e, 0x1003a1}, {0x1003a3, 0x1003f5}, + {0x1003f7, 0x100481}, {0x10048a, 0x10052f}, {0x100531, 0x100556}, {0x100561, 0x100587}, + {0x1005d0, 0x1005ea}, {0x1005f0, 0x1005f2}, {0x100620, 0x10064a}, {0x100671, 0x1006d3}, + {0x1006fa, 0x1006fc}, {0x100712, 0x10072f}, {0x10074d, 0x1007a5}, {0x1007ca, 0x1007ea}, + {0x100800, 0x100815}, {0x100840, 0x100858}, {0x100860, 0x10086a}, {0x1008a0, 0x1008b4}, + {0x1008b6, 0x1008bd}, {0x100904, 0x100939}, {0x100958, 0x100961}, {0x100971, 0x100980}, + {0x100985, 0x10098c}, {0x100993, 0x1009a8}, {0x1009aa, 0x1009b0}, {0x1009b6, 0x1009b9}, + {0x1009df, 0x1009e1}, {0x100a05, 0x100a0a}, {0x100a13, 0x100a28}, {0x100a2a, 0x100a30}, + {0x100a59, 0x100a5c}, {0x100a72, 0x100a74}, {0x100a85, 0x100a8d}, {0x100a8f, 0x100a91}, + {0x100a93, 0x100aa8}, {0x100aaa, 0x100ab0}, {0x100ab5, 0x100ab9}, {0x100b05, 0x100b0c}, + {0x100b13, 0x100b28}, {0x100b2a, 0x100b30}, {0x100b35, 0x100b39}, {0x100b5f, 0x100b61}, + {0x100b85, 0x100b8a}, {0x100b8e, 0x100b90}, {0x100b92, 0x100b95}, {0x100ba8, 0x100baa}, + {0x100bae, 0x100bb9}, {0x100c05, 0x100c0c}, {0x100c0e, 0x100c10}, {0x100c12, 0x100c28}, + {0x100c2a, 0x100c39}, {0x100c58, 0x100c5a}, {0x100c85, 0x100c8c}, {0x100c8e, 0x100c90}, + {0x100c92, 0x100ca8}, {0x100caa, 0x100cb3}, {0x100cb5, 0x100cb9}, {0x100d05, 0x100d0c}, + {0x100d0e, 0x100d10}, {0x100d12, 0x100d3a}, {0x100d54, 0x100d56}, {0x100d5f, 0x100d61}, + {0x100d7a, 0x100d7f}, {0x100d85, 0x100d96}, {0x100d9a, 0x100db1}, {0x100db3, 0x100dbb}, + {0x100dc0, 0x100dc6}, {0x100e01, 0x100e30}, {0x100e40, 0x100e46}, {0x100e94, 0x100e97}, + {0x100e99, 0x100e9f}, {0x100ea1, 0x100ea3}, {0x100ead, 0x100eb0}, {0x100ec0, 0x100ec4}, + {0x100edc, 0x100edf}, {0x100f40, 0x100f47}, {0x100f49, 0x100f6c}, {0x100f88, 0x100f8c}, + {0x101000, 0x10102a}, {0x101050, 0x101055}, {0x10105a, 0x10105d}, {0x10106e, 0x101070}, + {0x101075, 0x101081}, {0x1010a0, 0x1010c5}, {0x1010d0, 0x1010fa}, {0x1010fc, 0x101248}, + {0x10124a, 0x10124d}, {0x101250, 0x101256}, {0x10125a, 0x10125d}, {0x101260, 0x101288}, + {0x10128a, 0x10128d}, {0x101290, 0x1012b0}, {0x1012b2, 0x1012b5}, {0x1012b8, 0x1012be}, + {0x1012c2, 0x1012c5}, {0x1012c8, 0x1012d6}, {0x1012d8, 0x101310}, {0x101312, 0x101315}, + {0x101318, 0x10135a}, {0x101380, 0x10138f}, {0x1013a0, 0x1013f5}, {0x1013f8, 0x1013fd}, + {0x101401, 0x10166c}, {0x10166f, 0x10167f}, {0x101681, 0x10169a}, {0x1016a0, 0x1016ea}, + {0x1016f1, 0x1016f8}, {0x101700, 0x10170c}, {0x10170e, 0x101711}, {0x101720, 0x101731}, + {0x101740, 0x101751}, {0x101760, 0x10176c}, {0x10176e, 0x101770}, {0x101780, 0x1017b3}, + {0x101820, 0x101877}, {0x101880, 0x101884}, {0x101887, 0x1018a8}, {0x1018b0, 0x1018f5}, + {0x101900, 0x10191e}, {0x101950, 0x10196d}, {0x101970, 0x101974}, {0x101980, 0x1019ab}, + {0x1019b0, 0x1019c9}, {0x101a00, 0x101a16}, {0x101a20, 0x101a54}, {0x101b05, 0x101b33}, + {0x101b45, 0x101b4b}, {0x101b83, 0x101ba0}, {0x101bba, 0x101be5}, {0x101c00, 0x101c23}, + {0x101c4d, 0x101c4f}, {0x101c5a, 0x101c7d}, {0x101c80, 0x101c88}, {0x101ce9, 0x101cec}, + {0x101cee, 0x101cf1}, {0x101d00, 0x101dbf}, {0x101e00, 0x101f15}, {0x101f18, 0x101f1d}, + {0x101f20, 0x101f45}, {0x101f48, 0x101f4d}, {0x101f50, 0x101f57}, {0x101f5f, 0x101f7d}, + {0x101f80, 0x101fb4}, {0x101fb6, 0x101fbc}, {0x101fc2, 0x101fc4}, {0x101fc6, 0x101fcc}, + {0x101fd0, 0x101fd3}, {0x101fd6, 0x101fdb}, {0x101fe0, 0x101fec}, {0x101ff2, 0x101ff4}, + {0x101ff6, 0x101ffc}, {0x102090, 0x10209c}, {0x10210a, 0x102113}, {0x102119, 0x10211d}, + {0x10212a, 0x10212d}, {0x10212f, 0x102139}, {0x10213c, 0x10213f}, {0x102145, 0x102149}, + {0x102c00, 0x102c2e}, {0x102c30, 0x102c5e}, {0x102c60, 0x102ce4}, {0x102ceb, 0x102cee}, + {0x102d00, 0x102d25}, {0x102d30, 0x102d67}, {0x102d80, 0x102d96}, {0x102da0, 0x102da6}, + {0x102da8, 0x102dae}, {0x102db0, 0x102db6}, {0x102db8, 0x102dbe}, {0x102dc0, 0x102dc6}, + {0x102dc8, 0x102dce}, {0x102dd0, 0x102dd6}, {0x102dd8, 0x102dde}, {0x103031, 0x103035}, + {0x103041, 0x103096}, {0x10309d, 0x10309f}, {0x1030a1, 0x1030fa}, {0x1030fc, 0x1030ff}, + {0x103105, 0x10312e}, {0x103131, 0x10318e}, {0x1031a0, 0x1031ba}, {0x1031f0, 0x1031ff}, + {0x103400, 0x104db5}, {0x104e00, 0x109fea}, {0x10a000, 0x10a48c}, {0x10a4d0, 0x10a4fd}, + {0x10a500, 0x10a60c}, {0x10a610, 0x10a61f}, {0x10a640, 0x10a66e}, {0x10a67f, 0x10a69d}, + {0x10a6a0, 0x10a6e5}, {0x10a717, 0x10a71f}, {0x10a722, 0x10a788}, {0x10a78b, 0x10a7ae}, + {0x10a7b0, 0x10a7b7}, {0x10a7f7, 0x10a801}, {0x10a803, 0x10a805}, {0x10a807, 0x10a80a}, + {0x10a80c, 0x10a822}, {0x10a840, 0x10a873}, {0x10a882, 0x10a8b3}, {0x10a8f2, 0x10a8f7}, + {0x10a90a, 0x10a925}, {0x10a930, 0x10a946}, {0x10a960, 0x10a97c}, {0x10a984, 0x10a9b2}, + {0x10a9e0, 0x10a9e4}, {0x10a9e6, 0x10a9ef}, {0x10a9fa, 0x10a9fe}, {0x10aa00, 0x10aa28}, + {0x10aa40, 0x10aa42}, {0x10aa44, 0x10aa4b}, {0x10aa60, 0x10aa76}, {0x10aa7e, 0x10aaaf}, + {0x10aab9, 0x10aabd}, {0x10aadb, 0x10aadd}, {0x10aae0, 0x10aaea}, {0x10aaf2, 0x10aaf4}, + {0x10ab01, 0x10ab06}, {0x10ab09, 0x10ab0e}, {0x10ab11, 0x10ab16}, {0x10ab20, 0x10ab26}, + {0x10ab28, 0x10ab2e}, {0x10ab30, 0x10ab5a}, {0x10ab5c, 0x10ab65}, {0x10ab70, 0x10abe2}, + {0x10ac00, 0x10d7a3}, {0x10d7b0, 0x10d7c6}, {0x10d7cb, 0x10d7fb}, {0x10f900, 0x10fa6d}, + {0x10fa70, 0x10fad9}, {0x10fb00, 0x10fb06}, {0x10fb13, 0x10fb17}, {0x10fb1f, 0x10fb28}, + {0x10fb2a, 0x10fb36}, {0x10fb38, 0x10fb3c}, {0x10fb46, 0x10fbb1}, {0x10fbd3, 0x10fd3d}, + {0x10fd50, 0x10fd8f}, {0x10fd92, 0x10fdc7}, {0x10fdf0, 0x10fdfb}, {0x10fe70, 0x10fe74}, + {0x10fe76, 0x10fefc}, {0x10ff21, 0x10ff3a}, {0x10ff41, 0x10ff5a}, {0x10ff66, 0x10ffbe}, + {0x10ffc2, 0x10ffc7}, {0x10ffca, 0x10ffcf}, {0x10ffd2, 0x10ffd7}, {0x10ffda, 0x10ffdc} #endif }; @@ -250,28 +1250,309 @@ static const chr alphaCharTable[] = { 0x38c, 0x559, 0x66e, 0x66f, 0x6d5, 0x6e5, 0x6e6, 0x6ee, 0x6ef, 0x6ff, 0x710, 0x7b1, 0x7f4, 0x7f5, 0x7fa, 0x81a, 0x824, 0x828, 0x93d, 0x950, 0x98f, 0x990, 0x9b2, 0x9bd, 0x9ce, 0x9dc, 0x9dd, - 0x9f0, 0x9f1, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36, 0xa38, - 0xa39, 0xa5e, 0xab2, 0xab3, 0xabd, 0xad0, 0xae0, 0xae1, 0xaf9, - 0xb0f, 0xb10, 0xb32, 0xb33, 0xb3d, 0xb5c, 0xb5d, 0xb71, 0xb83, - 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4, 0xbd0, 0xc3d, - 0xc60, 0xc61, 0xc80, 0xcbd, 0xcde, 0xce0, 0xce1, 0xcf1, 0xcf2, - 0xd3d, 0xd4e, 0xdbd, 0xe32, 0xe33, 0xe81, 0xe82, 0xe84, 0xe87, - 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, 0xeb2, 0xeb3, - 0xebd, 0xec6, 0xf00, 0x103f, 0x1061, 0x1065, 0x1066, 0x108e, 0x10c7, - 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1bae, 0x1baf, - 0x1cf5, 0x1cf6, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071, 0x207f, 0x2102, - 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2183, 0x2184, 0x2cf2, - 0x2cf3, 0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3005, 0x3006, 0x303b, 0x303c, - 0xa62a, 0xa62b, 0xa8fb, 0xa8fd, 0xa9cf, 0xaa7a, 0xaab1, 0xaab5, 0xaab6, - 0xaac0, 0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44 + 0x9f0, 0x9f1, 0x9fc, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36, + 0xa38, 0xa39, 0xa5e, 0xab2, 0xab3, 0xabd, 0xad0, 0xae0, 0xae1, + 0xaf9, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb3d, 0xb5c, 0xb5d, 0xb71, + 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4, 0xbd0, + 0xc3d, 0xc60, 0xc61, 0xc80, 0xcbd, 0xcde, 0xce0, 0xce1, 0xcf1, + 0xcf2, 0xd3d, 0xd4e, 0xdbd, 0xe32, 0xe33, 0xe81, 0xe82, 0xe84, + 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, 0xeb2, + 0xeb3, 0xebd, 0xec6, 0xf00, 0x103f, 0x1061, 0x1065, 0x1066, 0x108e, + 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1bae, + 0x1baf, 0x1cf5, 0x1cf6, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071, 0x207f, + 0x2102, 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2183, 0x2184, + 0x2cf2, 0x2cf3, 0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3005, 0x3006, 0x303b, + 0x303c, 0xa62a, 0xa62b, 0xa8fb, 0xa8fd, 0xa9cf, 0xaa7a, 0xaab1, 0xaab5, + 0xaab6, 0xaac0, 0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44 #if TCL_UTF_MAX > 4 - ,0x1003c, 0x1003d, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, 0x108f5, 0x109be, - 0x109bf, 0x10a00, 0x11176, 0x111da, 0x111dc, 0x11288, 0x1130f, 0x11310, 0x11332, - 0x11333, 0x1133d, 0x11350, 0x114c4, 0x114c5, 0x114c7, 0x11644, 0x118ff, 0x11c40, - 0x16f50, 0x16fe0, 0x1b000, 0x1b001, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, - 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, - 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, - 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e + ,0x100aa, 0x100b5, 0x100ba, 0x102ec, 0x102ee, 0x10376, 0x10377, 0x1037f, 0x10386, + 0x1038c, 0x10559, 0x1066e, 0x1066f, 0x106d5, 0x106e5, 0x106e6, 0x106ee, 0x106ef, + 0x106ff, 0x10710, 0x107b1, 0x107f4, 0x107f5, 0x107fa, 0x1081a, 0x10824, 0x10828, + 0x1093d, 0x10950, 0x1098f, 0x10990, 0x109b2, 0x109bd, 0x109ce, 0x109dc, 0x109dd, + 0x109f0, 0x109f1, 0x109fc, 0x10a0f, 0x10a10, 0x10a32, 0x10a33, 0x10a35, 0x10a36, + 0x10a38, 0x10a39, 0x10a5e, 0x10ab2, 0x10ab3, 0x10abd, 0x10ad0, 0x10ae0, 0x10ae1, + 0x10af9, 0x10b0f, 0x10b10, 0x10b32, 0x10b33, 0x10b3d, 0x10b5c, 0x10b5d, 0x10b71, + 0x10b83, 0x10b99, 0x10b9a, 0x10b9c, 0x10b9e, 0x10b9f, 0x10ba3, 0x10ba4, 0x10bd0, + 0x10c3d, 0x10c60, 0x10c61, 0x10c80, 0x10cbd, 0x10cde, 0x10ce0, 0x10ce1, 0x10cf1, + 0x10cf2, 0x10d3d, 0x10d4e, 0x10dbd, 0x10e32, 0x10e33, 0x10e81, 0x10e82, 0x10e84, + 0x10e87, 0x10e88, 0x10e8a, 0x10e8d, 0x10ea5, 0x10ea7, 0x10eaa, 0x10eab, 0x10eb2, + 0x10eb3, 0x10ebd, 0x10ec6, 0x10f00, 0x1103f, 0x11061, 0x11065, 0x11066, 0x1108e, + 0x110c7, 0x110cd, 0x11258, 0x112c0, 0x117d7, 0x117dc, 0x118aa, 0x11aa7, 0x11bae, + 0x11baf, 0x11cf5, 0x11cf6, 0x11f59, 0x11f5b, 0x11f5d, 0x11fbe, 0x12071, 0x1207f, + 0x12102, 0x12107, 0x12115, 0x12124, 0x12126, 0x12128, 0x1214e, 0x12183, 0x12184, + 0x12cf2, 0x12cf3, 0x12d27, 0x12d2d, 0x12d6f, 0x12e2f, 0x13005, 0x13006, 0x1303b, + 0x1303c, 0x1a62a, 0x1a62b, 0x1a8fb, 0x1a8fd, 0x1a9cf, 0x1aa7a, 0x1aab1, 0x1aab5, + 0x1aab6, 0x1aac0, 0x1aac2, 0x1fb1d, 0x1fb3e, 0x1fb40, 0x1fb41, 0x1fb43, 0x1fb44, + 0x200aa, 0x200b5, 0x200ba, 0x202ec, 0x202ee, 0x20376, 0x20377, 0x2037f, 0x20386, + 0x2038c, 0x20559, 0x2066e, 0x2066f, 0x206d5, 0x206e5, 0x206e6, 0x206ee, 0x206ef, + 0x206ff, 0x20710, 0x207b1, 0x207f4, 0x207f5, 0x207fa, 0x2081a, 0x20824, 0x20828, + 0x2093d, 0x20950, 0x2098f, 0x20990, 0x209b2, 0x209bd, 0x209ce, 0x209dc, 0x209dd, + 0x209f0, 0x209f1, 0x209fc, 0x20a0f, 0x20a10, 0x20a32, 0x20a33, 0x20a35, 0x20a36, + 0x20a38, 0x20a39, 0x20a5e, 0x20ab2, 0x20ab3, 0x20abd, 0x20ad0, 0x20ae0, 0x20ae1, + 0x20af9, 0x20b0f, 0x20b10, 0x20b32, 0x20b33, 0x20b3d, 0x20b5c, 0x20b5d, 0x20b71, + 0x20b83, 0x20b99, 0x20b9a, 0x20b9c, 0x20b9e, 0x20b9f, 0x20ba3, 0x20ba4, 0x20bd0, + 0x20c3d, 0x20c60, 0x20c61, 0x20c80, 0x20cbd, 0x20cde, 0x20ce0, 0x20ce1, 0x20cf1, + 0x20cf2, 0x20d3d, 0x20d4e, 0x20dbd, 0x20e32, 0x20e33, 0x20e81, 0x20e82, 0x20e84, + 0x20e87, 0x20e88, 0x20e8a, 0x20e8d, 0x20ea5, 0x20ea7, 0x20eaa, 0x20eab, 0x20eb2, + 0x20eb3, 0x20ebd, 0x20ec6, 0x20f00, 0x2103f, 0x21061, 0x21065, 0x21066, 0x2108e, + 0x210c7, 0x210cd, 0x21258, 0x212c0, 0x217d7, 0x217dc, 0x218aa, 0x21aa7, 0x21bae, + 0x21baf, 0x21cf5, 0x21cf6, 0x21f59, 0x21f5b, 0x21f5d, 0x21fbe, 0x22071, 0x2207f, + 0x22102, 0x22107, 0x22115, 0x22124, 0x22126, 0x22128, 0x2214e, 0x22183, 0x22184, + 0x22cf2, 0x22cf3, 0x22d27, 0x22d2d, 0x22d6f, 0x22e2f, 0x23005, 0x23006, 0x2303b, + 0x2303c, 0x2a62a, 0x2a62b, 0x2a8fb, 0x2a8fd, 0x2a9cf, 0x2aa7a, 0x2aab1, 0x2aab5, + 0x2aab6, 0x2aac0, 0x2aac2, 0x2fb1d, 0x2fb3e, 0x2fb40, 0x2fb41, 0x2fb43, 0x2fb44, + 0x300aa, 0x300b5, 0x300ba, 0x302ec, 0x302ee, 0x30376, 0x30377, 0x3037f, 0x30386, + 0x3038c, 0x30559, 0x3066e, 0x3066f, 0x306d5, 0x306e5, 0x306e6, 0x306ee, 0x306ef, + 0x306ff, 0x30710, 0x307b1, 0x307f4, 0x307f5, 0x307fa, 0x3081a, 0x30824, 0x30828, + 0x3093d, 0x30950, 0x3098f, 0x30990, 0x309b2, 0x309bd, 0x309ce, 0x309dc, 0x309dd, + 0x309f0, 0x309f1, 0x309fc, 0x30a0f, 0x30a10, 0x30a32, 0x30a33, 0x30a35, 0x30a36, + 0x30a38, 0x30a39, 0x30a5e, 0x30ab2, 0x30ab3, 0x30abd, 0x30ad0, 0x30ae0, 0x30ae1, + 0x30af9, 0x30b0f, 0x30b10, 0x30b32, 0x30b33, 0x30b3d, 0x30b5c, 0x30b5d, 0x30b71, + 0x30b83, 0x30b99, 0x30b9a, 0x30b9c, 0x30b9e, 0x30b9f, 0x30ba3, 0x30ba4, 0x30bd0, + 0x30c3d, 0x30c60, 0x30c61, 0x30c80, 0x30cbd, 0x30cde, 0x30ce0, 0x30ce1, 0x30cf1, + 0x30cf2, 0x30d3d, 0x30d4e, 0x30dbd, 0x30e32, 0x30e33, 0x30e81, 0x30e82, 0x30e84, + 0x30e87, 0x30e88, 0x30e8a, 0x30e8d, 0x30ea5, 0x30ea7, 0x30eaa, 0x30eab, 0x30eb2, + 0x30eb3, 0x30ebd, 0x30ec6, 0x30f00, 0x3103f, 0x31061, 0x31065, 0x31066, 0x3108e, + 0x310c7, 0x310cd, 0x31258, 0x312c0, 0x317d7, 0x317dc, 0x318aa, 0x31aa7, 0x31bae, + 0x31baf, 0x31cf5, 0x31cf6, 0x31f59, 0x31f5b, 0x31f5d, 0x31fbe, 0x32071, 0x3207f, + 0x32102, 0x32107, 0x32115, 0x32124, 0x32126, 0x32128, 0x3214e, 0x32183, 0x32184, + 0x32cf2, 0x32cf3, 0x32d27, 0x32d2d, 0x32d6f, 0x32e2f, 0x33005, 0x33006, 0x3303b, + 0x3303c, 0x3a62a, 0x3a62b, 0x3a8fb, 0x3a8fd, 0x3a9cf, 0x3aa7a, 0x3aab1, 0x3aab5, + 0x3aab6, 0x3aac0, 0x3aac2, 0x3fb1d, 0x3fb3e, 0x3fb40, 0x3fb41, 0x3fb43, 0x3fb44, + 0x400aa, 0x400b5, 0x400ba, 0x402ec, 0x402ee, 0x40376, 0x40377, 0x4037f, 0x40386, + 0x4038c, 0x40559, 0x4066e, 0x4066f, 0x406d5, 0x406e5, 0x406e6, 0x406ee, 0x406ef, + 0x406ff, 0x40710, 0x407b1, 0x407f4, 0x407f5, 0x407fa, 0x4081a, 0x40824, 0x40828, + 0x4093d, 0x40950, 0x4098f, 0x40990, 0x409b2, 0x409bd, 0x409ce, 0x409dc, 0x409dd, + 0x409f0, 0x409f1, 0x409fc, 0x40a0f, 0x40a10, 0x40a32, 0x40a33, 0x40a35, 0x40a36, + 0x40a38, 0x40a39, 0x40a5e, 0x40ab2, 0x40ab3, 0x40abd, 0x40ad0, 0x40ae0, 0x40ae1, + 0x40af9, 0x40b0f, 0x40b10, 0x40b32, 0x40b33, 0x40b3d, 0x40b5c, 0x40b5d, 0x40b71, + 0x40b83, 0x40b99, 0x40b9a, 0x40b9c, 0x40b9e, 0x40b9f, 0x40ba3, 0x40ba4, 0x40bd0, + 0x40c3d, 0x40c60, 0x40c61, 0x40c80, 0x40cbd, 0x40cde, 0x40ce0, 0x40ce1, 0x40cf1, + 0x40cf2, 0x40d3d, 0x40d4e, 0x40dbd, 0x40e32, 0x40e33, 0x40e81, 0x40e82, 0x40e84, + 0x40e87, 0x40e88, 0x40e8a, 0x40e8d, 0x40ea5, 0x40ea7, 0x40eaa, 0x40eab, 0x40eb2, + 0x40eb3, 0x40ebd, 0x40ec6, 0x40f00, 0x4103f, 0x41061, 0x41065, 0x41066, 0x4108e, + 0x410c7, 0x410cd, 0x41258, 0x412c0, 0x417d7, 0x417dc, 0x418aa, 0x41aa7, 0x41bae, + 0x41baf, 0x41cf5, 0x41cf6, 0x41f59, 0x41f5b, 0x41f5d, 0x41fbe, 0x42071, 0x4207f, + 0x42102, 0x42107, 0x42115, 0x42124, 0x42126, 0x42128, 0x4214e, 0x42183, 0x42184, + 0x42cf2, 0x42cf3, 0x42d27, 0x42d2d, 0x42d6f, 0x42e2f, 0x43005, 0x43006, 0x4303b, + 0x4303c, 0x4a62a, 0x4a62b, 0x4a8fb, 0x4a8fd, 0x4a9cf, 0x4aa7a, 0x4aab1, 0x4aab5, + 0x4aab6, 0x4aac0, 0x4aac2, 0x4fb1d, 0x4fb3e, 0x4fb40, 0x4fb41, 0x4fb43, 0x4fb44, + 0x500aa, 0x500b5, 0x500ba, 0x502ec, 0x502ee, 0x50376, 0x50377, 0x5037f, 0x50386, + 0x5038c, 0x50559, 0x5066e, 0x5066f, 0x506d5, 0x506e5, 0x506e6, 0x506ee, 0x506ef, + 0x506ff, 0x50710, 0x507b1, 0x507f4, 0x507f5, 0x507fa, 0x5081a, 0x50824, 0x50828, + 0x5093d, 0x50950, 0x5098f, 0x50990, 0x509b2, 0x509bd, 0x509ce, 0x509dc, 0x509dd, + 0x509f0, 0x509f1, 0x509fc, 0x50a0f, 0x50a10, 0x50a32, 0x50a33, 0x50a35, 0x50a36, + 0x50a38, 0x50a39, 0x50a5e, 0x50ab2, 0x50ab3, 0x50abd, 0x50ad0, 0x50ae0, 0x50ae1, + 0x50af9, 0x50b0f, 0x50b10, 0x50b32, 0x50b33, 0x50b3d, 0x50b5c, 0x50b5d, 0x50b71, + 0x50b83, 0x50b99, 0x50b9a, 0x50b9c, 0x50b9e, 0x50b9f, 0x50ba3, 0x50ba4, 0x50bd0, + 0x50c3d, 0x50c60, 0x50c61, 0x50c80, 0x50cbd, 0x50cde, 0x50ce0, 0x50ce1, 0x50cf1, + 0x50cf2, 0x50d3d, 0x50d4e, 0x50dbd, 0x50e32, 0x50e33, 0x50e81, 0x50e82, 0x50e84, + 0x50e87, 0x50e88, 0x50e8a, 0x50e8d, 0x50ea5, 0x50ea7, 0x50eaa, 0x50eab, 0x50eb2, + 0x50eb3, 0x50ebd, 0x50ec6, 0x50f00, 0x5103f, 0x51061, 0x51065, 0x51066, 0x5108e, + 0x510c7, 0x510cd, 0x51258, 0x512c0, 0x517d7, 0x517dc, 0x518aa, 0x51aa7, 0x51bae, + 0x51baf, 0x51cf5, 0x51cf6, 0x51f59, 0x51f5b, 0x51f5d, 0x51fbe, 0x52071, 0x5207f, + 0x52102, 0x52107, 0x52115, 0x52124, 0x52126, 0x52128, 0x5214e, 0x52183, 0x52184, + 0x52cf2, 0x52cf3, 0x52d27, 0x52d2d, 0x52d6f, 0x52e2f, 0x53005, 0x53006, 0x5303b, + 0x5303c, 0x5a62a, 0x5a62b, 0x5a8fb, 0x5a8fd, 0x5a9cf, 0x5aa7a, 0x5aab1, 0x5aab5, + 0x5aab6, 0x5aac0, 0x5aac2, 0x5fb1d, 0x5fb3e, 0x5fb40, 0x5fb41, 0x5fb43, 0x5fb44, + 0x600aa, 0x600b5, 0x600ba, 0x602ec, 0x602ee, 0x60376, 0x60377, 0x6037f, 0x60386, + 0x6038c, 0x60559, 0x6066e, 0x6066f, 0x606d5, 0x606e5, 0x606e6, 0x606ee, 0x606ef, + 0x606ff, 0x60710, 0x607b1, 0x607f4, 0x607f5, 0x607fa, 0x6081a, 0x60824, 0x60828, + 0x6093d, 0x60950, 0x6098f, 0x60990, 0x609b2, 0x609bd, 0x609ce, 0x609dc, 0x609dd, + 0x609f0, 0x609f1, 0x609fc, 0x60a0f, 0x60a10, 0x60a32, 0x60a33, 0x60a35, 0x60a36, + 0x60a38, 0x60a39, 0x60a5e, 0x60ab2, 0x60ab3, 0x60abd, 0x60ad0, 0x60ae0, 0x60ae1, + 0x60af9, 0x60b0f, 0x60b10, 0x60b32, 0x60b33, 0x60b3d, 0x60b5c, 0x60b5d, 0x60b71, + 0x60b83, 0x60b99, 0x60b9a, 0x60b9c, 0x60b9e, 0x60b9f, 0x60ba3, 0x60ba4, 0x60bd0, + 0x60c3d, 0x60c60, 0x60c61, 0x60c80, 0x60cbd, 0x60cde, 0x60ce0, 0x60ce1, 0x60cf1, + 0x60cf2, 0x60d3d, 0x60d4e, 0x60dbd, 0x60e32, 0x60e33, 0x60e81, 0x60e82, 0x60e84, + 0x60e87, 0x60e88, 0x60e8a, 0x60e8d, 0x60ea5, 0x60ea7, 0x60eaa, 0x60eab, 0x60eb2, + 0x60eb3, 0x60ebd, 0x60ec6, 0x60f00, 0x6103f, 0x61061, 0x61065, 0x61066, 0x6108e, + 0x610c7, 0x610cd, 0x61258, 0x612c0, 0x617d7, 0x617dc, 0x618aa, 0x61aa7, 0x61bae, + 0x61baf, 0x61cf5, 0x61cf6, 0x61f59, 0x61f5b, 0x61f5d, 0x61fbe, 0x62071, 0x6207f, + 0x62102, 0x62107, 0x62115, 0x62124, 0x62126, 0x62128, 0x6214e, 0x62183, 0x62184, + 0x62cf2, 0x62cf3, 0x62d27, 0x62d2d, 0x62d6f, 0x62e2f, 0x63005, 0x63006, 0x6303b, + 0x6303c, 0x6a62a, 0x6a62b, 0x6a8fb, 0x6a8fd, 0x6a9cf, 0x6aa7a, 0x6aab1, 0x6aab5, + 0x6aab6, 0x6aac0, 0x6aac2, 0x6fb1d, 0x6fb3e, 0x6fb40, 0x6fb41, 0x6fb43, 0x6fb44, + 0x700aa, 0x700b5, 0x700ba, 0x702ec, 0x702ee, 0x70376, 0x70377, 0x7037f, 0x70386, + 0x7038c, 0x70559, 0x7066e, 0x7066f, 0x706d5, 0x706e5, 0x706e6, 0x706ee, 0x706ef, + 0x706ff, 0x70710, 0x707b1, 0x707f4, 0x707f5, 0x707fa, 0x7081a, 0x70824, 0x70828, + 0x7093d, 0x70950, 0x7098f, 0x70990, 0x709b2, 0x709bd, 0x709ce, 0x709dc, 0x709dd, + 0x709f0, 0x709f1, 0x709fc, 0x70a0f, 0x70a10, 0x70a32, 0x70a33, 0x70a35, 0x70a36, + 0x70a38, 0x70a39, 0x70a5e, 0x70ab2, 0x70ab3, 0x70abd, 0x70ad0, 0x70ae0, 0x70ae1, + 0x70af9, 0x70b0f, 0x70b10, 0x70b32, 0x70b33, 0x70b3d, 0x70b5c, 0x70b5d, 0x70b71, + 0x70b83, 0x70b99, 0x70b9a, 0x70b9c, 0x70b9e, 0x70b9f, 0x70ba3, 0x70ba4, 0x70bd0, + 0x70c3d, 0x70c60, 0x70c61, 0x70c80, 0x70cbd, 0x70cde, 0x70ce0, 0x70ce1, 0x70cf1, + 0x70cf2, 0x70d3d, 0x70d4e, 0x70dbd, 0x70e32, 0x70e33, 0x70e81, 0x70e82, 0x70e84, + 0x70e87, 0x70e88, 0x70e8a, 0x70e8d, 0x70ea5, 0x70ea7, 0x70eaa, 0x70eab, 0x70eb2, + 0x70eb3, 0x70ebd, 0x70ec6, 0x70f00, 0x7103f, 0x71061, 0x71065, 0x71066, 0x7108e, + 0x710c7, 0x710cd, 0x71258, 0x712c0, 0x717d7, 0x717dc, 0x718aa, 0x71aa7, 0x71bae, + 0x71baf, 0x71cf5, 0x71cf6, 0x71f59, 0x71f5b, 0x71f5d, 0x71fbe, 0x72071, 0x7207f, + 0x72102, 0x72107, 0x72115, 0x72124, 0x72126, 0x72128, 0x7214e, 0x72183, 0x72184, + 0x72cf2, 0x72cf3, 0x72d27, 0x72d2d, 0x72d6f, 0x72e2f, 0x73005, 0x73006, 0x7303b, + 0x7303c, 0x7a62a, 0x7a62b, 0x7a8fb, 0x7a8fd, 0x7a9cf, 0x7aa7a, 0x7aab1, 0x7aab5, + 0x7aab6, 0x7aac0, 0x7aac2, 0x7fb1d, 0x7fb3e, 0x7fb40, 0x7fb41, 0x7fb43, 0x7fb44, + 0x800aa, 0x800b5, 0x800ba, 0x802ec, 0x802ee, 0x80376, 0x80377, 0x8037f, 0x80386, + 0x8038c, 0x80559, 0x8066e, 0x8066f, 0x806d5, 0x806e5, 0x806e6, 0x806ee, 0x806ef, + 0x806ff, 0x80710, 0x807b1, 0x807f4, 0x807f5, 0x807fa, 0x8081a, 0x80824, 0x80828, + 0x8093d, 0x80950, 0x8098f, 0x80990, 0x809b2, 0x809bd, 0x809ce, 0x809dc, 0x809dd, + 0x809f0, 0x809f1, 0x809fc, 0x80a0f, 0x80a10, 0x80a32, 0x80a33, 0x80a35, 0x80a36, + 0x80a38, 0x80a39, 0x80a5e, 0x80ab2, 0x80ab3, 0x80abd, 0x80ad0, 0x80ae0, 0x80ae1, + 0x80af9, 0x80b0f, 0x80b10, 0x80b32, 0x80b33, 0x80b3d, 0x80b5c, 0x80b5d, 0x80b71, + 0x80b83, 0x80b99, 0x80b9a, 0x80b9c, 0x80b9e, 0x80b9f, 0x80ba3, 0x80ba4, 0x80bd0, + 0x80c3d, 0x80c60, 0x80c61, 0x80c80, 0x80cbd, 0x80cde, 0x80ce0, 0x80ce1, 0x80cf1, + 0x80cf2, 0x80d3d, 0x80d4e, 0x80dbd, 0x80e32, 0x80e33, 0x80e81, 0x80e82, 0x80e84, + 0x80e87, 0x80e88, 0x80e8a, 0x80e8d, 0x80ea5, 0x80ea7, 0x80eaa, 0x80eab, 0x80eb2, + 0x80eb3, 0x80ebd, 0x80ec6, 0x80f00, 0x8103f, 0x81061, 0x81065, 0x81066, 0x8108e, + 0x810c7, 0x810cd, 0x81258, 0x812c0, 0x817d7, 0x817dc, 0x818aa, 0x81aa7, 0x81bae, + 0x81baf, 0x81cf5, 0x81cf6, 0x81f59, 0x81f5b, 0x81f5d, 0x81fbe, 0x82071, 0x8207f, + 0x82102, 0x82107, 0x82115, 0x82124, 0x82126, 0x82128, 0x8214e, 0x82183, 0x82184, + 0x82cf2, 0x82cf3, 0x82d27, 0x82d2d, 0x82d6f, 0x82e2f, 0x83005, 0x83006, 0x8303b, + 0x8303c, 0x8a62a, 0x8a62b, 0x8a8fb, 0x8a8fd, 0x8a9cf, 0x8aa7a, 0x8aab1, 0x8aab5, + 0x8aab6, 0x8aac0, 0x8aac2, 0x8fb1d, 0x8fb3e, 0x8fb40, 0x8fb41, 0x8fb43, 0x8fb44, + 0x900aa, 0x900b5, 0x900ba, 0x902ec, 0x902ee, 0x90376, 0x90377, 0x9037f, 0x90386, + 0x9038c, 0x90559, 0x9066e, 0x9066f, 0x906d5, 0x906e5, 0x906e6, 0x906ee, 0x906ef, + 0x906ff, 0x90710, 0x907b1, 0x907f4, 0x907f5, 0x907fa, 0x9081a, 0x90824, 0x90828, + 0x9093d, 0x90950, 0x9098f, 0x90990, 0x909b2, 0x909bd, 0x909ce, 0x909dc, 0x909dd, + 0x909f0, 0x909f1, 0x909fc, 0x90a0f, 0x90a10, 0x90a32, 0x90a33, 0x90a35, 0x90a36, + 0x90a38, 0x90a39, 0x90a5e, 0x90ab2, 0x90ab3, 0x90abd, 0x90ad0, 0x90ae0, 0x90ae1, + 0x90af9, 0x90b0f, 0x90b10, 0x90b32, 0x90b33, 0x90b3d, 0x90b5c, 0x90b5d, 0x90b71, + 0x90b83, 0x90b99, 0x90b9a, 0x90b9c, 0x90b9e, 0x90b9f, 0x90ba3, 0x90ba4, 0x90bd0, + 0x90c3d, 0x90c60, 0x90c61, 0x90c80, 0x90cbd, 0x90cde, 0x90ce0, 0x90ce1, 0x90cf1, + 0x90cf2, 0x90d3d, 0x90d4e, 0x90dbd, 0x90e32, 0x90e33, 0x90e81, 0x90e82, 0x90e84, + 0x90e87, 0x90e88, 0x90e8a, 0x90e8d, 0x90ea5, 0x90ea7, 0x90eaa, 0x90eab, 0x90eb2, + 0x90eb3, 0x90ebd, 0x90ec6, 0x90f00, 0x9103f, 0x91061, 0x91065, 0x91066, 0x9108e, + 0x910c7, 0x910cd, 0x91258, 0x912c0, 0x917d7, 0x917dc, 0x918aa, 0x91aa7, 0x91bae, + 0x91baf, 0x91cf5, 0x91cf6, 0x91f59, 0x91f5b, 0x91f5d, 0x91fbe, 0x92071, 0x9207f, + 0x92102, 0x92107, 0x92115, 0x92124, 0x92126, 0x92128, 0x9214e, 0x92183, 0x92184, + 0x92cf2, 0x92cf3, 0x92d27, 0x92d2d, 0x92d6f, 0x92e2f, 0x93005, 0x93006, 0x9303b, + 0x9303c, 0x9a62a, 0x9a62b, 0x9a8fb, 0x9a8fd, 0x9a9cf, 0x9aa7a, 0x9aab1, 0x9aab5, + 0x9aab6, 0x9aac0, 0x9aac2, 0x9fb1d, 0x9fb3e, 0x9fb40, 0x9fb41, 0x9fb43, 0x9fb44, + 0xa00aa, 0xa00b5, 0xa00ba, 0xa02ec, 0xa02ee, 0xa0376, 0xa0377, 0xa037f, 0xa0386, + 0xa038c, 0xa0559, 0xa066e, 0xa066f, 0xa06d5, 0xa06e5, 0xa06e6, 0xa06ee, 0xa06ef, + 0xa06ff, 0xa0710, 0xa07b1, 0xa07f4, 0xa07f5, 0xa07fa, 0xa081a, 0xa0824, 0xa0828, + 0xa093d, 0xa0950, 0xa098f, 0xa0990, 0xa09b2, 0xa09bd, 0xa09ce, 0xa09dc, 0xa09dd, + 0xa09f0, 0xa09f1, 0xa09fc, 0xa0a0f, 0xa0a10, 0xa0a32, 0xa0a33, 0xa0a35, 0xa0a36, + 0xa0a38, 0xa0a39, 0xa0a5e, 0xa0ab2, 0xa0ab3, 0xa0abd, 0xa0ad0, 0xa0ae0, 0xa0ae1, + 0xa0af9, 0xa0b0f, 0xa0b10, 0xa0b32, 0xa0b33, 0xa0b3d, 0xa0b5c, 0xa0b5d, 0xa0b71, + 0xa0b83, 0xa0b99, 0xa0b9a, 0xa0b9c, 0xa0b9e, 0xa0b9f, 0xa0ba3, 0xa0ba4, 0xa0bd0, + 0xa0c3d, 0xa0c60, 0xa0c61, 0xa0c80, 0xa0cbd, 0xa0cde, 0xa0ce0, 0xa0ce1, 0xa0cf1, + 0xa0cf2, 0xa0d3d, 0xa0d4e, 0xa0dbd, 0xa0e32, 0xa0e33, 0xa0e81, 0xa0e82, 0xa0e84, + 0xa0e87, 0xa0e88, 0xa0e8a, 0xa0e8d, 0xa0ea5, 0xa0ea7, 0xa0eaa, 0xa0eab, 0xa0eb2, + 0xa0eb3, 0xa0ebd, 0xa0ec6, 0xa0f00, 0xa103f, 0xa1061, 0xa1065, 0xa1066, 0xa108e, + 0xa10c7, 0xa10cd, 0xa1258, 0xa12c0, 0xa17d7, 0xa17dc, 0xa18aa, 0xa1aa7, 0xa1bae, + 0xa1baf, 0xa1cf5, 0xa1cf6, 0xa1f59, 0xa1f5b, 0xa1f5d, 0xa1fbe, 0xa2071, 0xa207f, + 0xa2102, 0xa2107, 0xa2115, 0xa2124, 0xa2126, 0xa2128, 0xa214e, 0xa2183, 0xa2184, + 0xa2cf2, 0xa2cf3, 0xa2d27, 0xa2d2d, 0xa2d6f, 0xa2e2f, 0xa3005, 0xa3006, 0xa303b, + 0xa303c, 0xaa62a, 0xaa62b, 0xaa8fb, 0xaa8fd, 0xaa9cf, 0xaaa7a, 0xaaab1, 0xaaab5, + 0xaaab6, 0xaaac0, 0xaaac2, 0xafb1d, 0xafb3e, 0xafb40, 0xafb41, 0xafb43, 0xafb44, + 0xb00aa, 0xb00b5, 0xb00ba, 0xb02ec, 0xb02ee, 0xb0376, 0xb0377, 0xb037f, 0xb0386, + 0xb038c, 0xb0559, 0xb066e, 0xb066f, 0xb06d5, 0xb06e5, 0xb06e6, 0xb06ee, 0xb06ef, + 0xb06ff, 0xb0710, 0xb07b1, 0xb07f4, 0xb07f5, 0xb07fa, 0xb081a, 0xb0824, 0xb0828, + 0xb093d, 0xb0950, 0xb098f, 0xb0990, 0xb09b2, 0xb09bd, 0xb09ce, 0xb09dc, 0xb09dd, + 0xb09f0, 0xb09f1, 0xb09fc, 0xb0a0f, 0xb0a10, 0xb0a32, 0xb0a33, 0xb0a35, 0xb0a36, + 0xb0a38, 0xb0a39, 0xb0a5e, 0xb0ab2, 0xb0ab3, 0xb0abd, 0xb0ad0, 0xb0ae0, 0xb0ae1, + 0xb0af9, 0xb0b0f, 0xb0b10, 0xb0b32, 0xb0b33, 0xb0b3d, 0xb0b5c, 0xb0b5d, 0xb0b71, + 0xb0b83, 0xb0b99, 0xb0b9a, 0xb0b9c, 0xb0b9e, 0xb0b9f, 0xb0ba3, 0xb0ba4, 0xb0bd0, + 0xb0c3d, 0xb0c60, 0xb0c61, 0xb0c80, 0xb0cbd, 0xb0cde, 0xb0ce0, 0xb0ce1, 0xb0cf1, + 0xb0cf2, 0xb0d3d, 0xb0d4e, 0xb0dbd, 0xb0e32, 0xb0e33, 0xb0e81, 0xb0e82, 0xb0e84, + 0xb0e87, 0xb0e88, 0xb0e8a, 0xb0e8d, 0xb0ea5, 0xb0ea7, 0xb0eaa, 0xb0eab, 0xb0eb2, + 0xb0eb3, 0xb0ebd, 0xb0ec6, 0xb0f00, 0xb103f, 0xb1061, 0xb1065, 0xb1066, 0xb108e, + 0xb10c7, 0xb10cd, 0xb1258, 0xb12c0, 0xb17d7, 0xb17dc, 0xb18aa, 0xb1aa7, 0xb1bae, + 0xb1baf, 0xb1cf5, 0xb1cf6, 0xb1f59, 0xb1f5b, 0xb1f5d, 0xb1fbe, 0xb2071, 0xb207f, + 0xb2102, 0xb2107, 0xb2115, 0xb2124, 0xb2126, 0xb2128, 0xb214e, 0xb2183, 0xb2184, + 0xb2cf2, 0xb2cf3, 0xb2d27, 0xb2d2d, 0xb2d6f, 0xb2e2f, 0xb3005, 0xb3006, 0xb303b, + 0xb303c, 0xba62a, 0xba62b, 0xba8fb, 0xba8fd, 0xba9cf, 0xbaa7a, 0xbaab1, 0xbaab5, + 0xbaab6, 0xbaac0, 0xbaac2, 0xbfb1d, 0xbfb3e, 0xbfb40, 0xbfb41, 0xbfb43, 0xbfb44, + 0xc00aa, 0xc00b5, 0xc00ba, 0xc02ec, 0xc02ee, 0xc0376, 0xc0377, 0xc037f, 0xc0386, + 0xc038c, 0xc0559, 0xc066e, 0xc066f, 0xc06d5, 0xc06e5, 0xc06e6, 0xc06ee, 0xc06ef, + 0xc06ff, 0xc0710, 0xc07b1, 0xc07f4, 0xc07f5, 0xc07fa, 0xc081a, 0xc0824, 0xc0828, + 0xc093d, 0xc0950, 0xc098f, 0xc0990, 0xc09b2, 0xc09bd, 0xc09ce, 0xc09dc, 0xc09dd, + 0xc09f0, 0xc09f1, 0xc09fc, 0xc0a0f, 0xc0a10, 0xc0a32, 0xc0a33, 0xc0a35, 0xc0a36, + 0xc0a38, 0xc0a39, 0xc0a5e, 0xc0ab2, 0xc0ab3, 0xc0abd, 0xc0ad0, 0xc0ae0, 0xc0ae1, + 0xc0af9, 0xc0b0f, 0xc0b10, 0xc0b32, 0xc0b33, 0xc0b3d, 0xc0b5c, 0xc0b5d, 0xc0b71, + 0xc0b83, 0xc0b99, 0xc0b9a, 0xc0b9c, 0xc0b9e, 0xc0b9f, 0xc0ba3, 0xc0ba4, 0xc0bd0, + 0xc0c3d, 0xc0c60, 0xc0c61, 0xc0c80, 0xc0cbd, 0xc0cde, 0xc0ce0, 0xc0ce1, 0xc0cf1, + 0xc0cf2, 0xc0d3d, 0xc0d4e, 0xc0dbd, 0xc0e32, 0xc0e33, 0xc0e81, 0xc0e82, 0xc0e84, + 0xc0e87, 0xc0e88, 0xc0e8a, 0xc0e8d, 0xc0ea5, 0xc0ea7, 0xc0eaa, 0xc0eab, 0xc0eb2, + 0xc0eb3, 0xc0ebd, 0xc0ec6, 0xc0f00, 0xc103f, 0xc1061, 0xc1065, 0xc1066, 0xc108e, + 0xc10c7, 0xc10cd, 0xc1258, 0xc12c0, 0xc17d7, 0xc17dc, 0xc18aa, 0xc1aa7, 0xc1bae, + 0xc1baf, 0xc1cf5, 0xc1cf6, 0xc1f59, 0xc1f5b, 0xc1f5d, 0xc1fbe, 0xc2071, 0xc207f, + 0xc2102, 0xc2107, 0xc2115, 0xc2124, 0xc2126, 0xc2128, 0xc214e, 0xc2183, 0xc2184, + 0xc2cf2, 0xc2cf3, 0xc2d27, 0xc2d2d, 0xc2d6f, 0xc2e2f, 0xc3005, 0xc3006, 0xc303b, + 0xc303c, 0xca62a, 0xca62b, 0xca8fb, 0xca8fd, 0xca9cf, 0xcaa7a, 0xcaab1, 0xcaab5, + 0xcaab6, 0xcaac0, 0xcaac2, 0xcfb1d, 0xcfb3e, 0xcfb40, 0xcfb41, 0xcfb43, 0xcfb44, + 0xd00aa, 0xd00b5, 0xd00ba, 0xd02ec, 0xd02ee, 0xd0376, 0xd0377, 0xd037f, 0xd0386, + 0xd038c, 0xd0559, 0xd066e, 0xd066f, 0xd06d5, 0xd06e5, 0xd06e6, 0xd06ee, 0xd06ef, + 0xd06ff, 0xd0710, 0xd07b1, 0xd07f4, 0xd07f5, 0xd07fa, 0xd081a, 0xd0824, 0xd0828, + 0xd093d, 0xd0950, 0xd098f, 0xd0990, 0xd09b2, 0xd09bd, 0xd09ce, 0xd09dc, 0xd09dd, + 0xd09f0, 0xd09f1, 0xd09fc, 0xd0a0f, 0xd0a10, 0xd0a32, 0xd0a33, 0xd0a35, 0xd0a36, + 0xd0a38, 0xd0a39, 0xd0a5e, 0xd0ab2, 0xd0ab3, 0xd0abd, 0xd0ad0, 0xd0ae0, 0xd0ae1, + 0xd0af9, 0xd0b0f, 0xd0b10, 0xd0b32, 0xd0b33, 0xd0b3d, 0xd0b5c, 0xd0b5d, 0xd0b71, + 0xd0b83, 0xd0b99, 0xd0b9a, 0xd0b9c, 0xd0b9e, 0xd0b9f, 0xd0ba3, 0xd0ba4, 0xd0bd0, + 0xd0c3d, 0xd0c60, 0xd0c61, 0xd0c80, 0xd0cbd, 0xd0cde, 0xd0ce0, 0xd0ce1, 0xd0cf1, + 0xd0cf2, 0xd0d3d, 0xd0d4e, 0xd0dbd, 0xd0e32, 0xd0e33, 0xd0e81, 0xd0e82, 0xd0e84, + 0xd0e87, 0xd0e88, 0xd0e8a, 0xd0e8d, 0xd0ea5, 0xd0ea7, 0xd0eaa, 0xd0eab, 0xd0eb2, + 0xd0eb3, 0xd0ebd, 0xd0ec6, 0xd0f00, 0xd103f, 0xd1061, 0xd1065, 0xd1066, 0xd108e, + 0xd10c7, 0xd10cd, 0xd1258, 0xd12c0, 0xd17d7, 0xd17dc, 0xd18aa, 0xd1aa7, 0xd1bae, + 0xd1baf, 0xd1cf5, 0xd1cf6, 0xd1f59, 0xd1f5b, 0xd1f5d, 0xd1fbe, 0xd2071, 0xd207f, + 0xd2102, 0xd2107, 0xd2115, 0xd2124, 0xd2126, 0xd2128, 0xd214e, 0xd2183, 0xd2184, + 0xd2cf2, 0xd2cf3, 0xd2d27, 0xd2d2d, 0xd2d6f, 0xd2e2f, 0xd3005, 0xd3006, 0xd303b, + 0xd303c, 0xda62a, 0xda62b, 0xda8fb, 0xda8fd, 0xda9cf, 0xdaa7a, 0xdaab1, 0xdaab5, + 0xdaab6, 0xdaac0, 0xdaac2, 0xdfb1d, 0xdfb3e, 0xdfb40, 0xdfb41, 0xdfb43, 0xdfb44, + 0xe00aa, 0xe00b5, 0xe00ba, 0xe02ec, 0xe02ee, 0xe0376, 0xe0377, 0xe037f, 0xe0386, + 0xe038c, 0xe0559, 0xe066e, 0xe066f, 0xe06d5, 0xe06e5, 0xe06e6, 0xe06ee, 0xe06ef, + 0xe06ff, 0xe0710, 0xe07b1, 0xe07f4, 0xe07f5, 0xe07fa, 0xe081a, 0xe0824, 0xe0828, + 0xe093d, 0xe0950, 0xe098f, 0xe0990, 0xe09b2, 0xe09bd, 0xe09ce, 0xe09dc, 0xe09dd, + 0xe09f0, 0xe09f1, 0xe09fc, 0xe0a0f, 0xe0a10, 0xe0a32, 0xe0a33, 0xe0a35, 0xe0a36, + 0xe0a38, 0xe0a39, 0xe0a5e, 0xe0ab2, 0xe0ab3, 0xe0abd, 0xe0ad0, 0xe0ae0, 0xe0ae1, + 0xe0af9, 0xe0b0f, 0xe0b10, 0xe0b32, 0xe0b33, 0xe0b3d, 0xe0b5c, 0xe0b5d, 0xe0b71, + 0xe0b83, 0xe0b99, 0xe0b9a, 0xe0b9c, 0xe0b9e, 0xe0b9f, 0xe0ba3, 0xe0ba4, 0xe0bd0, + 0xe0c3d, 0xe0c60, 0xe0c61, 0xe0c80, 0xe0cbd, 0xe0cde, 0xe0ce0, 0xe0ce1, 0xe0cf1, + 0xe0cf2, 0xe0d3d, 0xe0d4e, 0xe0dbd, 0xe0e32, 0xe0e33, 0xe0e81, 0xe0e82, 0xe0e84, + 0xe0e87, 0xe0e88, 0xe0e8a, 0xe0e8d, 0xe0ea5, 0xe0ea7, 0xe0eaa, 0xe0eab, 0xe0eb2, + 0xe0eb3, 0xe0ebd, 0xe0ec6, 0xe0f00, 0xe103f, 0xe1061, 0xe1065, 0xe1066, 0xe108e, + 0xe10c7, 0xe10cd, 0xe1258, 0xe12c0, 0xe17d7, 0xe17dc, 0xe18aa, 0xe1aa7, 0xe1bae, + 0xe1baf, 0xe1cf5, 0xe1cf6, 0xe1f59, 0xe1f5b, 0xe1f5d, 0xe1fbe, 0xe2071, 0xe207f, + 0xe2102, 0xe2107, 0xe2115, 0xe2124, 0xe2126, 0xe2128, 0xe214e, 0xe2183, 0xe2184, + 0xe2cf2, 0xe2cf3, 0xe2d27, 0xe2d2d, 0xe2d6f, 0xe2e2f, 0xe3005, 0xe3006, 0xe303b, + 0xe303c, 0xea62a, 0xea62b, 0xea8fb, 0xea8fd, 0xea9cf, 0xeaa7a, 0xeaab1, 0xeaab5, + 0xeaab6, 0xeaac0, 0xeaac2, 0xefb1d, 0xefb3e, 0xefb40, 0xefb41, 0xefb43, 0xefb44, + 0xf00aa, 0xf00b5, 0xf00ba, 0xf02ec, 0xf02ee, 0xf0376, 0xf0377, 0xf037f, 0xf0386, + 0xf038c, 0xf0559, 0xf066e, 0xf066f, 0xf06d5, 0xf06e5, 0xf06e6, 0xf06ee, 0xf06ef, + 0xf06ff, 0xf0710, 0xf07b1, 0xf07f4, 0xf07f5, 0xf07fa, 0xf081a, 0xf0824, 0xf0828, + 0xf093d, 0xf0950, 0xf098f, 0xf0990, 0xf09b2, 0xf09bd, 0xf09ce, 0xf09dc, 0xf09dd, + 0xf09f0, 0xf09f1, 0xf09fc, 0xf0a0f, 0xf0a10, 0xf0a32, 0xf0a33, 0xf0a35, 0xf0a36, + 0xf0a38, 0xf0a39, 0xf0a5e, 0xf0ab2, 0xf0ab3, 0xf0abd, 0xf0ad0, 0xf0ae0, 0xf0ae1, + 0xf0af9, 0xf0b0f, 0xf0b10, 0xf0b32, 0xf0b33, 0xf0b3d, 0xf0b5c, 0xf0b5d, 0xf0b71, + 0xf0b83, 0xf0b99, 0xf0b9a, 0xf0b9c, 0xf0b9e, 0xf0b9f, 0xf0ba3, 0xf0ba4, 0xf0bd0, + 0xf0c3d, 0xf0c60, 0xf0c61, 0xf0c80, 0xf0cbd, 0xf0cde, 0xf0ce0, 0xf0ce1, 0xf0cf1, + 0xf0cf2, 0xf0d3d, 0xf0d4e, 0xf0dbd, 0xf0e32, 0xf0e33, 0xf0e81, 0xf0e82, 0xf0e84, + 0xf0e87, 0xf0e88, 0xf0e8a, 0xf0e8d, 0xf0ea5, 0xf0ea7, 0xf0eaa, 0xf0eab, 0xf0eb2, + 0xf0eb3, 0xf0ebd, 0xf0ec6, 0xf0f00, 0xf103f, 0xf1061, 0xf1065, 0xf1066, 0xf108e, + 0xf10c7, 0xf10cd, 0xf1258, 0xf12c0, 0xf17d7, 0xf17dc, 0xf18aa, 0xf1aa7, 0xf1bae, + 0xf1baf, 0xf1cf5, 0xf1cf6, 0xf1f59, 0xf1f5b, 0xf1f5d, 0xf1fbe, 0xf2071, 0xf207f, + 0xf2102, 0xf2107, 0xf2115, 0xf2124, 0xf2126, 0xf2128, 0xf214e, 0xf2183, 0xf2184, + 0xf2cf2, 0xf2cf3, 0xf2d27, 0xf2d2d, 0xf2d6f, 0xf2e2f, 0xf3005, 0xf3006, 0xf303b, + 0xf303c, 0xfa62a, 0xfa62b, 0xfa8fb, 0xfa8fd, 0xfa9cf, 0xfaa7a, 0xfaab1, 0xfaab5, + 0xfaab6, 0xfaac0, 0xfaac2, 0xffb1d, 0xffb3e, 0xffb40, 0xffb41, 0xffb43, 0xffb44, + 0x1000aa, 0x1000b5, 0x1000ba, 0x1002ec, 0x1002ee, 0x100376, 0x100377, 0x10037f, 0x100386, + 0x10038c, 0x100559, 0x10066e, 0x10066f, 0x1006d5, 0x1006e5, 0x1006e6, 0x1006ee, 0x1006ef, + 0x1006ff, 0x100710, 0x1007b1, 0x1007f4, 0x1007f5, 0x1007fa, 0x10081a, 0x100824, 0x100828, + 0x10093d, 0x100950, 0x10098f, 0x100990, 0x1009b2, 0x1009bd, 0x1009ce, 0x1009dc, 0x1009dd, + 0x1009f0, 0x1009f1, 0x1009fc, 0x100a0f, 0x100a10, 0x100a32, 0x100a33, 0x100a35, 0x100a36, + 0x100a38, 0x100a39, 0x100a5e, 0x100ab2, 0x100ab3, 0x100abd, 0x100ad0, 0x100ae0, 0x100ae1, + 0x100af9, 0x100b0f, 0x100b10, 0x100b32, 0x100b33, 0x100b3d, 0x100b5c, 0x100b5d, 0x100b71, + 0x100b83, 0x100b99, 0x100b9a, 0x100b9c, 0x100b9e, 0x100b9f, 0x100ba3, 0x100ba4, 0x100bd0, + 0x100c3d, 0x100c60, 0x100c61, 0x100c80, 0x100cbd, 0x100cde, 0x100ce0, 0x100ce1, 0x100cf1, + 0x100cf2, 0x100d3d, 0x100d4e, 0x100dbd, 0x100e32, 0x100e33, 0x100e81, 0x100e82, 0x100e84, + 0x100e87, 0x100e88, 0x100e8a, 0x100e8d, 0x100ea5, 0x100ea7, 0x100eaa, 0x100eab, 0x100eb2, + 0x100eb3, 0x100ebd, 0x100ec6, 0x100f00, 0x10103f, 0x101061, 0x101065, 0x101066, 0x10108e, + 0x1010c7, 0x1010cd, 0x101258, 0x1012c0, 0x1017d7, 0x1017dc, 0x1018aa, 0x101aa7, 0x101bae, + 0x101baf, 0x101cf5, 0x101cf6, 0x101f59, 0x101f5b, 0x101f5d, 0x101fbe, 0x102071, 0x10207f, + 0x102102, 0x102107, 0x102115, 0x102124, 0x102126, 0x102128, 0x10214e, 0x102183, 0x102184, + 0x102cf2, 0x102cf3, 0x102d27, 0x102d2d, 0x102d6f, 0x102e2f, 0x103005, 0x103006, 0x10303b, + 0x10303c, 0x10a62a, 0x10a62b, 0x10a8fb, 0x10a8fd, 0x10a9cf, 0x10aa7a, 0x10aab1, 0x10aab5, + 0x10aab6, 0x10aac0, 0x10aac2, 0x10fb1d, 0x10fb3e, 0x10fb40, 0x10fb41, 0x10fb43, 0x10fb44 #endif }; @@ -286,8 +1567,42 @@ static const crange controlRangeTable[] = { {0x202a, 0x202e}, {0x2060, 0x2064}, {0x2066, 0x206f}, {0xe000, 0xf8ff}, {0xfff9, 0xfffb} #if TCL_UTF_MAX > 4 - ,{0x1bca0, 0x1bca3}, {0x1d173, 0x1d17a}, {0xe0020, 0xe007f}, {0xf0000, 0xffffd}, - {0x100000, 0x10fffd} + ,{0x10000, 0x1001f}, {0x1007f, 0x1009f}, {0x10600, 0x10605}, {0x1200b, 0x1200f}, + {0x1202a, 0x1202e}, {0x12060, 0x12064}, {0x12066, 0x1206f}, {0x1e000, 0x1f8ff}, + {0x1fff9, 0x1fffb}, {0x20000, 0x2001f}, {0x2007f, 0x2009f}, {0x20600, 0x20605}, + {0x2200b, 0x2200f}, {0x2202a, 0x2202e}, {0x22060, 0x22064}, {0x22066, 0x2206f}, + {0x2e000, 0x2f8ff}, {0x2fff9, 0x2fffb}, {0x30000, 0x3001f}, {0x3007f, 0x3009f}, + {0x30600, 0x30605}, {0x3200b, 0x3200f}, {0x3202a, 0x3202e}, {0x32060, 0x32064}, + {0x32066, 0x3206f}, {0x3e000, 0x3f8ff}, {0x3fff9, 0x3fffb}, {0x40000, 0x4001f}, + {0x4007f, 0x4009f}, {0x40600, 0x40605}, {0x4200b, 0x4200f}, {0x4202a, 0x4202e}, + {0x42060, 0x42064}, {0x42066, 0x4206f}, {0x4e000, 0x4f8ff}, {0x4fff9, 0x4fffb}, + {0x50000, 0x5001f}, {0x5007f, 0x5009f}, {0x50600, 0x50605}, {0x5200b, 0x5200f}, + {0x5202a, 0x5202e}, {0x52060, 0x52064}, {0x52066, 0x5206f}, {0x5e000, 0x5f8ff}, + {0x5fff9, 0x5fffb}, {0x60000, 0x6001f}, {0x6007f, 0x6009f}, {0x60600, 0x60605}, + {0x6200b, 0x6200f}, {0x6202a, 0x6202e}, {0x62060, 0x62064}, {0x62066, 0x6206f}, + {0x6e000, 0x6f8ff}, {0x6fff9, 0x6fffb}, {0x70000, 0x7001f}, {0x7007f, 0x7009f}, + {0x70600, 0x70605}, {0x7200b, 0x7200f}, {0x7202a, 0x7202e}, {0x72060, 0x72064}, + {0x72066, 0x7206f}, {0x7e000, 0x7f8ff}, {0x7fff9, 0x7fffb}, {0x80000, 0x8001f}, + {0x8007f, 0x8009f}, {0x80600, 0x80605}, {0x8200b, 0x8200f}, {0x8202a, 0x8202e}, + {0x82060, 0x82064}, {0x82066, 0x8206f}, {0x8e000, 0x8f8ff}, {0x8fff9, 0x8fffb}, + {0x90000, 0x9001f}, {0x9007f, 0x9009f}, {0x90600, 0x90605}, {0x9200b, 0x9200f}, + {0x9202a, 0x9202e}, {0x92060, 0x92064}, {0x92066, 0x9206f}, {0x9e000, 0x9f8ff}, + {0x9fff9, 0x9fffb}, {0xa0000, 0xa001f}, {0xa007f, 0xa009f}, {0xa0600, 0xa0605}, + {0xa200b, 0xa200f}, {0xa202a, 0xa202e}, {0xa2060, 0xa2064}, {0xa2066, 0xa206f}, + {0xae000, 0xaf8ff}, {0xafff9, 0xafffb}, {0xb0000, 0xb001f}, {0xb007f, 0xb009f}, + {0xb0600, 0xb0605}, {0xb200b, 0xb200f}, {0xb202a, 0xb202e}, {0xb2060, 0xb2064}, + {0xb2066, 0xb206f}, {0xbe000, 0xbf8ff}, {0xbfff9, 0xbfffb}, {0xc0000, 0xc001f}, + {0xc007f, 0xc009f}, {0xc0600, 0xc0605}, {0xc200b, 0xc200f}, {0xc202a, 0xc202e}, + {0xc2060, 0xc2064}, {0xc2066, 0xc206f}, {0xce000, 0xcf8ff}, {0xcfff9, 0xcfffb}, + {0xd0000, 0xd001f}, {0xd007f, 0xd009f}, {0xd0600, 0xd0605}, {0xd200b, 0xd200f}, + {0xd202a, 0xd202e}, {0xd2060, 0xd2064}, {0xd2066, 0xd206f}, {0xde000, 0xdf8ff}, + {0xdfff9, 0xdfffb}, {0xe0000, 0xe001f}, {0xe007f, 0xe009f}, {0xe0600, 0xe0605}, + {0xe200b, 0xe200f}, {0xe202a, 0xe202e}, {0xe2060, 0xe2064}, {0xe2066, 0xe206f}, + {0xee000, 0xef8ff}, {0xefff9, 0xefffb}, {0xf0000, 0xf001f}, {0xf007f, 0xf009f}, + {0xf0600, 0xf0605}, {0xf200b, 0xf200f}, {0xf202a, 0xf202e}, {0xf2060, 0xf2064}, + {0xf2066, 0xf206f}, {0xfe000, 0xff8ff}, {0xffff9, 0xffffb}, {0x100000, 0x10001f}, + {0x10007f, 0x10009f}, {0x100600, 0x100605}, {0x10200b, 0x10200f}, {0x10202a, 0x10202e}, + {0x102060, 0x102064}, {0x102066, 0x10206f}, {0x10e000, 0x10f8ff}, {0x10fff9, 0x10fffb} #endif }; @@ -296,7 +1611,19 @@ static const crange controlRangeTable[] = { static const chr controlCharTable[] = { 0xad, 0x61c, 0x6dd, 0x70f, 0x8e2, 0x180e, 0xfeff #if TCL_UTF_MAX > 4 - ,0x110bd, 0xe0001 + ,0x100ad, 0x1061c, 0x106dd, 0x1070f, 0x108e2, 0x1180e, 0x1feff, 0x200ad, 0x2061c, + 0x206dd, 0x2070f, 0x208e2, 0x2180e, 0x2feff, 0x300ad, 0x3061c, 0x306dd, 0x3070f, + 0x308e2, 0x3180e, 0x3feff, 0x400ad, 0x4061c, 0x406dd, 0x4070f, 0x408e2, 0x4180e, + 0x4feff, 0x500ad, 0x5061c, 0x506dd, 0x5070f, 0x508e2, 0x5180e, 0x5feff, 0x600ad, + 0x6061c, 0x606dd, 0x6070f, 0x608e2, 0x6180e, 0x6feff, 0x700ad, 0x7061c, 0x706dd, + 0x7070f, 0x708e2, 0x7180e, 0x7feff, 0x800ad, 0x8061c, 0x806dd, 0x8070f, 0x808e2, + 0x8180e, 0x8feff, 0x900ad, 0x9061c, 0x906dd, 0x9070f, 0x908e2, 0x9180e, 0x9feff, + 0xa00ad, 0xa061c, 0xa06dd, 0xa070f, 0xa08e2, 0xa180e, 0xafeff, 0xb00ad, 0xb061c, + 0xb06dd, 0xb070f, 0xb08e2, 0xb180e, 0xbfeff, 0xc00ad, 0xc061c, 0xc06dd, 0xc070f, + 0xc08e2, 0xc180e, 0xcfeff, 0xd00ad, 0xd061c, 0xd06dd, 0xd070f, 0xd08e2, 0xd180e, + 0xdfeff, 0xe00ad, 0xe061c, 0xe06dd, 0xe070f, 0xe08e2, 0xe180e, 0xefeff, 0xf00ad, + 0xf061c, 0xf06dd, 0xf070f, 0xf08e2, 0xf180e, 0xffeff, 0x1000ad, 0x10061c, 0x1006dd, + 0x10070f, 0x1008e2, 0x10180e, 0x10feff #endif }; @@ -318,11 +1645,154 @@ static const crange digitRangeTable[] = { {0xa9d0, 0xa9d9}, {0xa9f0, 0xa9f9}, {0xaa50, 0xaa59}, {0xabf0, 0xabf9}, {0xff10, 0xff19} #if TCL_UTF_MAX > 4 - ,{0x104a0, 0x104a9}, {0x11066, 0x1106f}, {0x110f0, 0x110f9}, {0x11136, 0x1113f}, - {0x111d0, 0x111d9}, {0x112f0, 0x112f9}, {0x11450, 0x11459}, {0x114d0, 0x114d9}, - {0x11650, 0x11659}, {0x116c0, 0x116c9}, {0x11730, 0x11739}, {0x118e0, 0x118e9}, - {0x11c50, 0x11c59}, {0x16a60, 0x16a69}, {0x16b50, 0x16b59}, {0x1d7ce, 0x1d7ff}, - {0x1e950, 0x1e959} + ,{0x10030, 0x10039}, {0x10660, 0x10669}, {0x106f0, 0x106f9}, {0x107c0, 0x107c9}, + {0x10966, 0x1096f}, {0x109e6, 0x109ef}, {0x10a66, 0x10a6f}, {0x10ae6, 0x10aef}, + {0x10b66, 0x10b6f}, {0x10be6, 0x10bef}, {0x10c66, 0x10c6f}, {0x10ce6, 0x10cef}, + {0x10d66, 0x10d6f}, {0x10de6, 0x10def}, {0x10e50, 0x10e59}, {0x10ed0, 0x10ed9}, + {0x10f20, 0x10f29}, {0x11040, 0x11049}, {0x11090, 0x11099}, {0x117e0, 0x117e9}, + {0x11810, 0x11819}, {0x11946, 0x1194f}, {0x119d0, 0x119d9}, {0x11a80, 0x11a89}, + {0x11a90, 0x11a99}, {0x11b50, 0x11b59}, {0x11bb0, 0x11bb9}, {0x11c40, 0x11c49}, + {0x11c50, 0x11c59}, {0x1a620, 0x1a629}, {0x1a8d0, 0x1a8d9}, {0x1a900, 0x1a909}, + {0x1a9d0, 0x1a9d9}, {0x1a9f0, 0x1a9f9}, {0x1aa50, 0x1aa59}, {0x1abf0, 0x1abf9}, + {0x1ff10, 0x1ff19}, {0x20030, 0x20039}, {0x20660, 0x20669}, {0x206f0, 0x206f9}, + {0x207c0, 0x207c9}, {0x20966, 0x2096f}, {0x209e6, 0x209ef}, {0x20a66, 0x20a6f}, + {0x20ae6, 0x20aef}, {0x20b66, 0x20b6f}, {0x20be6, 0x20bef}, {0x20c66, 0x20c6f}, + {0x20ce6, 0x20cef}, {0x20d66, 0x20d6f}, {0x20de6, 0x20def}, {0x20e50, 0x20e59}, + {0x20ed0, 0x20ed9}, {0x20f20, 0x20f29}, {0x21040, 0x21049}, {0x21090, 0x21099}, + {0x217e0, 0x217e9}, {0x21810, 0x21819}, {0x21946, 0x2194f}, {0x219d0, 0x219d9}, + {0x21a80, 0x21a89}, {0x21a90, 0x21a99}, {0x21b50, 0x21b59}, {0x21bb0, 0x21bb9}, + {0x21c40, 0x21c49}, {0x21c50, 0x21c59}, {0x2a620, 0x2a629}, {0x2a8d0, 0x2a8d9}, + {0x2a900, 0x2a909}, {0x2a9d0, 0x2a9d9}, {0x2a9f0, 0x2a9f9}, {0x2aa50, 0x2aa59}, + {0x2abf0, 0x2abf9}, {0x2ff10, 0x2ff19}, {0x30030, 0x30039}, {0x30660, 0x30669}, + {0x306f0, 0x306f9}, {0x307c0, 0x307c9}, {0x30966, 0x3096f}, {0x309e6, 0x309ef}, + {0x30a66, 0x30a6f}, {0x30ae6, 0x30aef}, {0x30b66, 0x30b6f}, {0x30be6, 0x30bef}, + {0x30c66, 0x30c6f}, {0x30ce6, 0x30cef}, {0x30d66, 0x30d6f}, {0x30de6, 0x30def}, + {0x30e50, 0x30e59}, {0x30ed0, 0x30ed9}, {0x30f20, 0x30f29}, {0x31040, 0x31049}, + {0x31090, 0x31099}, {0x317e0, 0x317e9}, {0x31810, 0x31819}, {0x31946, 0x3194f}, + {0x319d0, 0x319d9}, {0x31a80, 0x31a89}, {0x31a90, 0x31a99}, {0x31b50, 0x31b59}, + {0x31bb0, 0x31bb9}, {0x31c40, 0x31c49}, {0x31c50, 0x31c59}, {0x3a620, 0x3a629}, + {0x3a8d0, 0x3a8d9}, {0x3a900, 0x3a909}, {0x3a9d0, 0x3a9d9}, {0x3a9f0, 0x3a9f9}, + {0x3aa50, 0x3aa59}, {0x3abf0, 0x3abf9}, {0x3ff10, 0x3ff19}, {0x40030, 0x40039}, + {0x40660, 0x40669}, {0x406f0, 0x406f9}, {0x407c0, 0x407c9}, {0x40966, 0x4096f}, + {0x409e6, 0x409ef}, {0x40a66, 0x40a6f}, {0x40ae6, 0x40aef}, {0x40b66, 0x40b6f}, + {0x40be6, 0x40bef}, {0x40c66, 0x40c6f}, {0x40ce6, 0x40cef}, {0x40d66, 0x40d6f}, + {0x40de6, 0x40def}, {0x40e50, 0x40e59}, {0x40ed0, 0x40ed9}, {0x40f20, 0x40f29}, + {0x41040, 0x41049}, {0x41090, 0x41099}, {0x417e0, 0x417e9}, {0x41810, 0x41819}, + {0x41946, 0x4194f}, {0x419d0, 0x419d9}, {0x41a80, 0x41a89}, {0x41a90, 0x41a99}, + {0x41b50, 0x41b59}, {0x41bb0, 0x41bb9}, {0x41c40, 0x41c49}, {0x41c50, 0x41c59}, + {0x4a620, 0x4a629}, {0x4a8d0, 0x4a8d9}, {0x4a900, 0x4a909}, {0x4a9d0, 0x4a9d9}, + {0x4a9f0, 0x4a9f9}, {0x4aa50, 0x4aa59}, {0x4abf0, 0x4abf9}, {0x4ff10, 0x4ff19}, + {0x50030, 0x50039}, {0x50660, 0x50669}, {0x506f0, 0x506f9}, {0x507c0, 0x507c9}, + {0x50966, 0x5096f}, {0x509e6, 0x509ef}, {0x50a66, 0x50a6f}, {0x50ae6, 0x50aef}, + {0x50b66, 0x50b6f}, {0x50be6, 0x50bef}, {0x50c66, 0x50c6f}, {0x50ce6, 0x50cef}, + {0x50d66, 0x50d6f}, {0x50de6, 0x50def}, {0x50e50, 0x50e59}, {0x50ed0, 0x50ed9}, + {0x50f20, 0x50f29}, {0x51040, 0x51049}, {0x51090, 0x51099}, {0x517e0, 0x517e9}, + {0x51810, 0x51819}, {0x51946, 0x5194f}, {0x519d0, 0x519d9}, {0x51a80, 0x51a89}, + {0x51a90, 0x51a99}, {0x51b50, 0x51b59}, {0x51bb0, 0x51bb9}, {0x51c40, 0x51c49}, + {0x51c50, 0x51c59}, {0x5a620, 0x5a629}, {0x5a8d0, 0x5a8d9}, {0x5a900, 0x5a909}, + {0x5a9d0, 0x5a9d9}, {0x5a9f0, 0x5a9f9}, {0x5aa50, 0x5aa59}, {0x5abf0, 0x5abf9}, + {0x5ff10, 0x5ff19}, {0x60030, 0x60039}, {0x60660, 0x60669}, {0x606f0, 0x606f9}, + {0x607c0, 0x607c9}, {0x60966, 0x6096f}, {0x609e6, 0x609ef}, {0x60a66, 0x60a6f}, + {0x60ae6, 0x60aef}, {0x60b66, 0x60b6f}, {0x60be6, 0x60bef}, {0x60c66, 0x60c6f}, + {0x60ce6, 0x60cef}, {0x60d66, 0x60d6f}, {0x60de6, 0x60def}, {0x60e50, 0x60e59}, + {0x60ed0, 0x60ed9}, {0x60f20, 0x60f29}, {0x61040, 0x61049}, {0x61090, 0x61099}, + {0x617e0, 0x617e9}, {0x61810, 0x61819}, {0x61946, 0x6194f}, {0x619d0, 0x619d9}, + {0x61a80, 0x61a89}, {0x61a90, 0x61a99}, {0x61b50, 0x61b59}, {0x61bb0, 0x61bb9}, + {0x61c40, 0x61c49}, {0x61c50, 0x61c59}, {0x6a620, 0x6a629}, {0x6a8d0, 0x6a8d9}, + {0x6a900, 0x6a909}, {0x6a9d0, 0x6a9d9}, {0x6a9f0, 0x6a9f9}, {0x6aa50, 0x6aa59}, + {0x6abf0, 0x6abf9}, {0x6ff10, 0x6ff19}, {0x70030, 0x70039}, {0x70660, 0x70669}, + {0x706f0, 0x706f9}, {0x707c0, 0x707c9}, {0x70966, 0x7096f}, {0x709e6, 0x709ef}, + {0x70a66, 0x70a6f}, {0x70ae6, 0x70aef}, {0x70b66, 0x70b6f}, {0x70be6, 0x70bef}, + {0x70c66, 0x70c6f}, {0x70ce6, 0x70cef}, {0x70d66, 0x70d6f}, {0x70de6, 0x70def}, + {0x70e50, 0x70e59}, {0x70ed0, 0x70ed9}, {0x70f20, 0x70f29}, {0x71040, 0x71049}, + {0x71090, 0x71099}, {0x717e0, 0x717e9}, {0x71810, 0x71819}, {0x71946, 0x7194f}, + {0x719d0, 0x719d9}, {0x71a80, 0x71a89}, {0x71a90, 0x71a99}, {0x71b50, 0x71b59}, + {0x71bb0, 0x71bb9}, {0x71c40, 0x71c49}, {0x71c50, 0x71c59}, {0x7a620, 0x7a629}, + {0x7a8d0, 0x7a8d9}, {0x7a900, 0x7a909}, {0x7a9d0, 0x7a9d9}, {0x7a9f0, 0x7a9f9}, + {0x7aa50, 0x7aa59}, {0x7abf0, 0x7abf9}, {0x7ff10, 0x7ff19}, {0x80030, 0x80039}, + {0x80660, 0x80669}, {0x806f0, 0x806f9}, {0x807c0, 0x807c9}, {0x80966, 0x8096f}, + {0x809e6, 0x809ef}, {0x80a66, 0x80a6f}, {0x80ae6, 0x80aef}, {0x80b66, 0x80b6f}, + {0x80be6, 0x80bef}, {0x80c66, 0x80c6f}, {0x80ce6, 0x80cef}, {0x80d66, 0x80d6f}, + {0x80de6, 0x80def}, {0x80e50, 0x80e59}, {0x80ed0, 0x80ed9}, {0x80f20, 0x80f29}, + {0x81040, 0x81049}, {0x81090, 0x81099}, {0x817e0, 0x817e9}, {0x81810, 0x81819}, + {0x81946, 0x8194f}, {0x819d0, 0x819d9}, {0x81a80, 0x81a89}, {0x81a90, 0x81a99}, + {0x81b50, 0x81b59}, {0x81bb0, 0x81bb9}, {0x81c40, 0x81c49}, {0x81c50, 0x81c59}, + {0x8a620, 0x8a629}, {0x8a8d0, 0x8a8d9}, {0x8a900, 0x8a909}, {0x8a9d0, 0x8a9d9}, + {0x8a9f0, 0x8a9f9}, {0x8aa50, 0x8aa59}, {0x8abf0, 0x8abf9}, {0x8ff10, 0x8ff19}, + {0x90030, 0x90039}, {0x90660, 0x90669}, {0x906f0, 0x906f9}, {0x907c0, 0x907c9}, + {0x90966, 0x9096f}, {0x909e6, 0x909ef}, {0x90a66, 0x90a6f}, {0x90ae6, 0x90aef}, + {0x90b66, 0x90b6f}, {0x90be6, 0x90bef}, {0x90c66, 0x90c6f}, {0x90ce6, 0x90cef}, + {0x90d66, 0x90d6f}, {0x90de6, 0x90def}, {0x90e50, 0x90e59}, {0x90ed0, 0x90ed9}, + {0x90f20, 0x90f29}, {0x91040, 0x91049}, {0x91090, 0x91099}, {0x917e0, 0x917e9}, + {0x91810, 0x91819}, {0x91946, 0x9194f}, {0x919d0, 0x919d9}, {0x91a80, 0x91a89}, + {0x91a90, 0x91a99}, {0x91b50, 0x91b59}, {0x91bb0, 0x91bb9}, {0x91c40, 0x91c49}, + {0x91c50, 0x91c59}, {0x9a620, 0x9a629}, {0x9a8d0, 0x9a8d9}, {0x9a900, 0x9a909}, + {0x9a9d0, 0x9a9d9}, {0x9a9f0, 0x9a9f9}, {0x9aa50, 0x9aa59}, {0x9abf0, 0x9abf9}, + {0x9ff10, 0x9ff19}, {0xa0030, 0xa0039}, {0xa0660, 0xa0669}, {0xa06f0, 0xa06f9}, + {0xa07c0, 0xa07c9}, {0xa0966, 0xa096f}, {0xa09e6, 0xa09ef}, {0xa0a66, 0xa0a6f}, + {0xa0ae6, 0xa0aef}, {0xa0b66, 0xa0b6f}, {0xa0be6, 0xa0bef}, {0xa0c66, 0xa0c6f}, + {0xa0ce6, 0xa0cef}, {0xa0d66, 0xa0d6f}, {0xa0de6, 0xa0def}, {0xa0e50, 0xa0e59}, + {0xa0ed0, 0xa0ed9}, {0xa0f20, 0xa0f29}, {0xa1040, 0xa1049}, {0xa1090, 0xa1099}, + {0xa17e0, 0xa17e9}, {0xa1810, 0xa1819}, {0xa1946, 0xa194f}, {0xa19d0, 0xa19d9}, + {0xa1a80, 0xa1a89}, {0xa1a90, 0xa1a99}, {0xa1b50, 0xa1b59}, {0xa1bb0, 0xa1bb9}, + {0xa1c40, 0xa1c49}, {0xa1c50, 0xa1c59}, {0xaa620, 0xaa629}, {0xaa8d0, 0xaa8d9}, + {0xaa900, 0xaa909}, {0xaa9d0, 0xaa9d9}, {0xaa9f0, 0xaa9f9}, {0xaaa50, 0xaaa59}, + {0xaabf0, 0xaabf9}, {0xaff10, 0xaff19}, {0xb0030, 0xb0039}, {0xb0660, 0xb0669}, + {0xb06f0, 0xb06f9}, {0xb07c0, 0xb07c9}, {0xb0966, 0xb096f}, {0xb09e6, 0xb09ef}, + {0xb0a66, 0xb0a6f}, {0xb0ae6, 0xb0aef}, {0xb0b66, 0xb0b6f}, {0xb0be6, 0xb0bef}, + {0xb0c66, 0xb0c6f}, {0xb0ce6, 0xb0cef}, {0xb0d66, 0xb0d6f}, {0xb0de6, 0xb0def}, + {0xb0e50, 0xb0e59}, {0xb0ed0, 0xb0ed9}, {0xb0f20, 0xb0f29}, {0xb1040, 0xb1049}, + {0xb1090, 0xb1099}, {0xb17e0, 0xb17e9}, {0xb1810, 0xb1819}, {0xb1946, 0xb194f}, + {0xb19d0, 0xb19d9}, {0xb1a80, 0xb1a89}, {0xb1a90, 0xb1a99}, {0xb1b50, 0xb1b59}, + {0xb1bb0, 0xb1bb9}, {0xb1c40, 0xb1c49}, {0xb1c50, 0xb1c59}, {0xba620, 0xba629}, + {0xba8d0, 0xba8d9}, {0xba900, 0xba909}, {0xba9d0, 0xba9d9}, {0xba9f0, 0xba9f9}, + {0xbaa50, 0xbaa59}, {0xbabf0, 0xbabf9}, {0xbff10, 0xbff19}, {0xc0030, 0xc0039}, + {0xc0660, 0xc0669}, {0xc06f0, 0xc06f9}, {0xc07c0, 0xc07c9}, {0xc0966, 0xc096f}, + {0xc09e6, 0xc09ef}, {0xc0a66, 0xc0a6f}, {0xc0ae6, 0xc0aef}, {0xc0b66, 0xc0b6f}, + {0xc0be6, 0xc0bef}, {0xc0c66, 0xc0c6f}, {0xc0ce6, 0xc0cef}, {0xc0d66, 0xc0d6f}, + {0xc0de6, 0xc0def}, {0xc0e50, 0xc0e59}, {0xc0ed0, 0xc0ed9}, {0xc0f20, 0xc0f29}, + {0xc1040, 0xc1049}, {0xc1090, 0xc1099}, {0xc17e0, 0xc17e9}, {0xc1810, 0xc1819}, + {0xc1946, 0xc194f}, {0xc19d0, 0xc19d9}, {0xc1a80, 0xc1a89}, {0xc1a90, 0xc1a99}, + {0xc1b50, 0xc1b59}, {0xc1bb0, 0xc1bb9}, {0xc1c40, 0xc1c49}, {0xc1c50, 0xc1c59}, + {0xca620, 0xca629}, {0xca8d0, 0xca8d9}, {0xca900, 0xca909}, {0xca9d0, 0xca9d9}, + {0xca9f0, 0xca9f9}, {0xcaa50, 0xcaa59}, {0xcabf0, 0xcabf9}, {0xcff10, 0xcff19}, + {0xd0030, 0xd0039}, {0xd0660, 0xd0669}, {0xd06f0, 0xd06f9}, {0xd07c0, 0xd07c9}, + {0xd0966, 0xd096f}, {0xd09e6, 0xd09ef}, {0xd0a66, 0xd0a6f}, {0xd0ae6, 0xd0aef}, + {0xd0b66, 0xd0b6f}, {0xd0be6, 0xd0bef}, {0xd0c66, 0xd0c6f}, {0xd0ce6, 0xd0cef}, + {0xd0d66, 0xd0d6f}, {0xd0de6, 0xd0def}, {0xd0e50, 0xd0e59}, {0xd0ed0, 0xd0ed9}, + {0xd0f20, 0xd0f29}, {0xd1040, 0xd1049}, {0xd1090, 0xd1099}, {0xd17e0, 0xd17e9}, + {0xd1810, 0xd1819}, {0xd1946, 0xd194f}, {0xd19d0, 0xd19d9}, {0xd1a80, 0xd1a89}, + {0xd1a90, 0xd1a99}, {0xd1b50, 0xd1b59}, {0xd1bb0, 0xd1bb9}, {0xd1c40, 0xd1c49}, + {0xd1c50, 0xd1c59}, {0xda620, 0xda629}, {0xda8d0, 0xda8d9}, {0xda900, 0xda909}, + {0xda9d0, 0xda9d9}, {0xda9f0, 0xda9f9}, {0xdaa50, 0xdaa59}, {0xdabf0, 0xdabf9}, + {0xdff10, 0xdff19}, {0xe0030, 0xe0039}, {0xe0660, 0xe0669}, {0xe06f0, 0xe06f9}, + {0xe07c0, 0xe07c9}, {0xe0966, 0xe096f}, {0xe09e6, 0xe09ef}, {0xe0a66, 0xe0a6f}, + {0xe0ae6, 0xe0aef}, {0xe0b66, 0xe0b6f}, {0xe0be6, 0xe0bef}, {0xe0c66, 0xe0c6f}, + {0xe0ce6, 0xe0cef}, {0xe0d66, 0xe0d6f}, {0xe0de6, 0xe0def}, {0xe0e50, 0xe0e59}, + {0xe0ed0, 0xe0ed9}, {0xe0f20, 0xe0f29}, {0xe1040, 0xe1049}, {0xe1090, 0xe1099}, + {0xe17e0, 0xe17e9}, {0xe1810, 0xe1819}, {0xe1946, 0xe194f}, {0xe19d0, 0xe19d9}, + {0xe1a80, 0xe1a89}, {0xe1a90, 0xe1a99}, {0xe1b50, 0xe1b59}, {0xe1bb0, 0xe1bb9}, + {0xe1c40, 0xe1c49}, {0xe1c50, 0xe1c59}, {0xea620, 0xea629}, {0xea8d0, 0xea8d9}, + {0xea900, 0xea909}, {0xea9d0, 0xea9d9}, {0xea9f0, 0xea9f9}, {0xeaa50, 0xeaa59}, + {0xeabf0, 0xeabf9}, {0xeff10, 0xeff19}, {0xf0030, 0xf0039}, {0xf0660, 0xf0669}, + {0xf06f0, 0xf06f9}, {0xf07c0, 0xf07c9}, {0xf0966, 0xf096f}, {0xf09e6, 0xf09ef}, + {0xf0a66, 0xf0a6f}, {0xf0ae6, 0xf0aef}, {0xf0b66, 0xf0b6f}, {0xf0be6, 0xf0bef}, + {0xf0c66, 0xf0c6f}, {0xf0ce6, 0xf0cef}, {0xf0d66, 0xf0d6f}, {0xf0de6, 0xf0def}, + {0xf0e50, 0xf0e59}, {0xf0ed0, 0xf0ed9}, {0xf0f20, 0xf0f29}, {0xf1040, 0xf1049}, + {0xf1090, 0xf1099}, {0xf17e0, 0xf17e9}, {0xf1810, 0xf1819}, {0xf1946, 0xf194f}, + {0xf19d0, 0xf19d9}, {0xf1a80, 0xf1a89}, {0xf1a90, 0xf1a99}, {0xf1b50, 0xf1b59}, + {0xf1bb0, 0xf1bb9}, {0xf1c40, 0xf1c49}, {0xf1c50, 0xf1c59}, {0xfa620, 0xfa629}, + {0xfa8d0, 0xfa8d9}, {0xfa900, 0xfa909}, {0xfa9d0, 0xfa9d9}, {0xfa9f0, 0xfa9f9}, + {0xfaa50, 0xfaa59}, {0xfabf0, 0xfabf9}, {0xfff10, 0xfff19}, {0x100030, 0x100039}, + {0x100660, 0x100669}, {0x1006f0, 0x1006f9}, {0x1007c0, 0x1007c9}, {0x100966, 0x10096f}, + {0x1009e6, 0x1009ef}, {0x100a66, 0x100a6f}, {0x100ae6, 0x100aef}, {0x100b66, 0x100b6f}, + {0x100be6, 0x100bef}, {0x100c66, 0x100c6f}, {0x100ce6, 0x100cef}, {0x100d66, 0x100d6f}, + {0x100de6, 0x100def}, {0x100e50, 0x100e59}, {0x100ed0, 0x100ed9}, {0x100f20, 0x100f29}, + {0x101040, 0x101049}, {0x101090, 0x101099}, {0x1017e0, 0x1017e9}, {0x101810, 0x101819}, + {0x101946, 0x10194f}, {0x1019d0, 0x1019d9}, {0x101a80, 0x101a89}, {0x101a90, 0x101a99}, + {0x101b50, 0x101b59}, {0x101bb0, 0x101bb9}, {0x101c40, 0x101c49}, {0x101c50, 0x101c59}, + {0x10a620, 0x10a629}, {0x10a8d0, 0x10a8d9}, {0x10a900, 0x10a909}, {0x10a9d0, 0x10a9d9}, + {0x10a9f0, 0x10a9f9}, {0x10aa50, 0x10aa59}, {0x10abf0, 0x10abf9}, {0x10ff10, 0x10ff19} #endif }; @@ -345,18 +1815,225 @@ static const crange punctRangeTable[] = { {0x1b5a, 0x1b60}, {0x1bfc, 0x1bff}, {0x1c3b, 0x1c3f}, {0x1cc0, 0x1cc7}, {0x2010, 0x2027}, {0x2030, 0x2043}, {0x2045, 0x2051}, {0x2053, 0x205e}, {0x2308, 0x230b}, {0x2768, 0x2775}, {0x27e6, 0x27ef}, {0x2983, 0x2998}, - {0x29d8, 0x29db}, {0x2cf9, 0x2cfc}, {0x2e00, 0x2e2e}, {0x2e30, 0x2e44}, + {0x29d8, 0x29db}, {0x2cf9, 0x2cfc}, {0x2e00, 0x2e2e}, {0x2e30, 0x2e49}, {0x3001, 0x3003}, {0x3008, 0x3011}, {0x3014, 0x301f}, {0xa60d, 0xa60f}, {0xa6f2, 0xa6f7}, {0xa874, 0xa877}, {0xa8f8, 0xa8fa}, {0xa9c1, 0xa9cd}, {0xaa5c, 0xaa5f}, {0xfe10, 0xfe19}, {0xfe30, 0xfe52}, {0xfe54, 0xfe61}, {0xff01, 0xff03}, {0xff05, 0xff0a}, {0xff0c, 0xff0f}, {0xff3b, 0xff3d}, {0xff5f, 0xff65} #if TCL_UTF_MAX > 4 - ,{0x10100, 0x10102}, {0x10a50, 0x10a58}, {0x10af0, 0x10af6}, {0x10b39, 0x10b3f}, - {0x10b99, 0x10b9c}, {0x11047, 0x1104d}, {0x110be, 0x110c1}, {0x11140, 0x11143}, - {0x111c5, 0x111c9}, {0x111dd, 0x111df}, {0x11238, 0x1123d}, {0x1144b, 0x1144f}, - {0x115c1, 0x115d7}, {0x11641, 0x11643}, {0x11660, 0x1166c}, {0x1173c, 0x1173e}, - {0x11c41, 0x11c45}, {0x12470, 0x12474}, {0x16b37, 0x16b3b}, {0x1da87, 0x1da8b} + ,{0x10021, 0x10023}, {0x10025, 0x1002a}, {0x1002c, 0x1002f}, {0x1005b, 0x1005d}, + {0x1055a, 0x1055f}, {0x1066a, 0x1066d}, {0x10700, 0x1070d}, {0x107f7, 0x107f9}, + {0x10830, 0x1083e}, {0x10f04, 0x10f12}, {0x10f3a, 0x10f3d}, {0x10fd0, 0x10fd4}, + {0x1104a, 0x1104f}, {0x11360, 0x11368}, {0x116eb, 0x116ed}, {0x117d4, 0x117d6}, + {0x117d8, 0x117da}, {0x11800, 0x1180a}, {0x11aa0, 0x11aa6}, {0x11aa8, 0x11aad}, + {0x11b5a, 0x11b60}, {0x11bfc, 0x11bff}, {0x11c3b, 0x11c3f}, {0x11cc0, 0x11cc7}, + {0x12010, 0x12027}, {0x12030, 0x12043}, {0x12045, 0x12051}, {0x12053, 0x1205e}, + {0x12308, 0x1230b}, {0x12768, 0x12775}, {0x127e6, 0x127ef}, {0x12983, 0x12998}, + {0x129d8, 0x129db}, {0x12cf9, 0x12cfc}, {0x12e00, 0x12e2e}, {0x12e30, 0x12e49}, + {0x13001, 0x13003}, {0x13008, 0x13011}, {0x13014, 0x1301f}, {0x1a60d, 0x1a60f}, + {0x1a6f2, 0x1a6f7}, {0x1a874, 0x1a877}, {0x1a8f8, 0x1a8fa}, {0x1a9c1, 0x1a9cd}, + {0x1aa5c, 0x1aa5f}, {0x1fe10, 0x1fe19}, {0x1fe30, 0x1fe52}, {0x1fe54, 0x1fe61}, + {0x1ff01, 0x1ff03}, {0x1ff05, 0x1ff0a}, {0x1ff0c, 0x1ff0f}, {0x1ff3b, 0x1ff3d}, + {0x1ff5f, 0x1ff65}, {0x20021, 0x20023}, {0x20025, 0x2002a}, {0x2002c, 0x2002f}, + {0x2005b, 0x2005d}, {0x2055a, 0x2055f}, {0x2066a, 0x2066d}, {0x20700, 0x2070d}, + {0x207f7, 0x207f9}, {0x20830, 0x2083e}, {0x20f04, 0x20f12}, {0x20f3a, 0x20f3d}, + {0x20fd0, 0x20fd4}, {0x2104a, 0x2104f}, {0x21360, 0x21368}, {0x216eb, 0x216ed}, + {0x217d4, 0x217d6}, {0x217d8, 0x217da}, {0x21800, 0x2180a}, {0x21aa0, 0x21aa6}, + {0x21aa8, 0x21aad}, {0x21b5a, 0x21b60}, {0x21bfc, 0x21bff}, {0x21c3b, 0x21c3f}, + {0x21cc0, 0x21cc7}, {0x22010, 0x22027}, {0x22030, 0x22043}, {0x22045, 0x22051}, + {0x22053, 0x2205e}, {0x22308, 0x2230b}, {0x22768, 0x22775}, {0x227e6, 0x227ef}, + {0x22983, 0x22998}, {0x229d8, 0x229db}, {0x22cf9, 0x22cfc}, {0x22e00, 0x22e2e}, + {0x22e30, 0x22e49}, {0x23001, 0x23003}, {0x23008, 0x23011}, {0x23014, 0x2301f}, + {0x2a60d, 0x2a60f}, {0x2a6f2, 0x2a6f7}, {0x2a874, 0x2a877}, {0x2a8f8, 0x2a8fa}, + {0x2a9c1, 0x2a9cd}, {0x2aa5c, 0x2aa5f}, {0x2fe10, 0x2fe19}, {0x2fe30, 0x2fe52}, + {0x2fe54, 0x2fe61}, {0x2ff01, 0x2ff03}, {0x2ff05, 0x2ff0a}, {0x2ff0c, 0x2ff0f}, + {0x2ff3b, 0x2ff3d}, {0x2ff5f, 0x2ff65}, {0x30021, 0x30023}, {0x30025, 0x3002a}, + {0x3002c, 0x3002f}, {0x3005b, 0x3005d}, {0x3055a, 0x3055f}, {0x3066a, 0x3066d}, + {0x30700, 0x3070d}, {0x307f7, 0x307f9}, {0x30830, 0x3083e}, {0x30f04, 0x30f12}, + {0x30f3a, 0x30f3d}, {0x30fd0, 0x30fd4}, {0x3104a, 0x3104f}, {0x31360, 0x31368}, + {0x316eb, 0x316ed}, {0x317d4, 0x317d6}, {0x317d8, 0x317da}, {0x31800, 0x3180a}, + {0x31aa0, 0x31aa6}, {0x31aa8, 0x31aad}, {0x31b5a, 0x31b60}, {0x31bfc, 0x31bff}, + {0x31c3b, 0x31c3f}, {0x31cc0, 0x31cc7}, {0x32010, 0x32027}, {0x32030, 0x32043}, + {0x32045, 0x32051}, {0x32053, 0x3205e}, {0x32308, 0x3230b}, {0x32768, 0x32775}, + {0x327e6, 0x327ef}, {0x32983, 0x32998}, {0x329d8, 0x329db}, {0x32cf9, 0x32cfc}, + {0x32e00, 0x32e2e}, {0x32e30, 0x32e49}, {0x33001, 0x33003}, {0x33008, 0x33011}, + {0x33014, 0x3301f}, {0x3a60d, 0x3a60f}, {0x3a6f2, 0x3a6f7}, {0x3a874, 0x3a877}, + {0x3a8f8, 0x3a8fa}, {0x3a9c1, 0x3a9cd}, {0x3aa5c, 0x3aa5f}, {0x3fe10, 0x3fe19}, + {0x3fe30, 0x3fe52}, {0x3fe54, 0x3fe61}, {0x3ff01, 0x3ff03}, {0x3ff05, 0x3ff0a}, + {0x3ff0c, 0x3ff0f}, {0x3ff3b, 0x3ff3d}, {0x3ff5f, 0x3ff65}, {0x40021, 0x40023}, + {0x40025, 0x4002a}, {0x4002c, 0x4002f}, {0x4005b, 0x4005d}, {0x4055a, 0x4055f}, + {0x4066a, 0x4066d}, {0x40700, 0x4070d}, {0x407f7, 0x407f9}, {0x40830, 0x4083e}, + {0x40f04, 0x40f12}, {0x40f3a, 0x40f3d}, {0x40fd0, 0x40fd4}, {0x4104a, 0x4104f}, + {0x41360, 0x41368}, {0x416eb, 0x416ed}, {0x417d4, 0x417d6}, {0x417d8, 0x417da}, + {0x41800, 0x4180a}, {0x41aa0, 0x41aa6}, {0x41aa8, 0x41aad}, {0x41b5a, 0x41b60}, + {0x41bfc, 0x41bff}, {0x41c3b, 0x41c3f}, {0x41cc0, 0x41cc7}, {0x42010, 0x42027}, + {0x42030, 0x42043}, {0x42045, 0x42051}, {0x42053, 0x4205e}, {0x42308, 0x4230b}, + {0x42768, 0x42775}, {0x427e6, 0x427ef}, {0x42983, 0x42998}, {0x429d8, 0x429db}, + {0x42cf9, 0x42cfc}, {0x42e00, 0x42e2e}, {0x42e30, 0x42e49}, {0x43001, 0x43003}, + {0x43008, 0x43011}, {0x43014, 0x4301f}, {0x4a60d, 0x4a60f}, {0x4a6f2, 0x4a6f7}, + {0x4a874, 0x4a877}, {0x4a8f8, 0x4a8fa}, {0x4a9c1, 0x4a9cd}, {0x4aa5c, 0x4aa5f}, + {0x4fe10, 0x4fe19}, {0x4fe30, 0x4fe52}, {0x4fe54, 0x4fe61}, {0x4ff01, 0x4ff03}, + {0x4ff05, 0x4ff0a}, {0x4ff0c, 0x4ff0f}, {0x4ff3b, 0x4ff3d}, {0x4ff5f, 0x4ff65}, + {0x50021, 0x50023}, {0x50025, 0x5002a}, {0x5002c, 0x5002f}, {0x5005b, 0x5005d}, + {0x5055a, 0x5055f}, {0x5066a, 0x5066d}, {0x50700, 0x5070d}, {0x507f7, 0x507f9}, + {0x50830, 0x5083e}, {0x50f04, 0x50f12}, {0x50f3a, 0x50f3d}, {0x50fd0, 0x50fd4}, + {0x5104a, 0x5104f}, {0x51360, 0x51368}, {0x516eb, 0x516ed}, {0x517d4, 0x517d6}, + {0x517d8, 0x517da}, {0x51800, 0x5180a}, {0x51aa0, 0x51aa6}, {0x51aa8, 0x51aad}, + {0x51b5a, 0x51b60}, {0x51bfc, 0x51bff}, {0x51c3b, 0x51c3f}, {0x51cc0, 0x51cc7}, + {0x52010, 0x52027}, {0x52030, 0x52043}, {0x52045, 0x52051}, {0x52053, 0x5205e}, + {0x52308, 0x5230b}, {0x52768, 0x52775}, {0x527e6, 0x527ef}, {0x52983, 0x52998}, + {0x529d8, 0x529db}, {0x52cf9, 0x52cfc}, {0x52e00, 0x52e2e}, {0x52e30, 0x52e49}, + {0x53001, 0x53003}, {0x53008, 0x53011}, {0x53014, 0x5301f}, {0x5a60d, 0x5a60f}, + {0x5a6f2, 0x5a6f7}, {0x5a874, 0x5a877}, {0x5a8f8, 0x5a8fa}, {0x5a9c1, 0x5a9cd}, + {0x5aa5c, 0x5aa5f}, {0x5fe10, 0x5fe19}, {0x5fe30, 0x5fe52}, {0x5fe54, 0x5fe61}, + {0x5ff01, 0x5ff03}, {0x5ff05, 0x5ff0a}, {0x5ff0c, 0x5ff0f}, {0x5ff3b, 0x5ff3d}, + {0x5ff5f, 0x5ff65}, {0x60021, 0x60023}, {0x60025, 0x6002a}, {0x6002c, 0x6002f}, + {0x6005b, 0x6005d}, {0x6055a, 0x6055f}, {0x6066a, 0x6066d}, {0x60700, 0x6070d}, + {0x607f7, 0x607f9}, {0x60830, 0x6083e}, {0x60f04, 0x60f12}, {0x60f3a, 0x60f3d}, + {0x60fd0, 0x60fd4}, {0x6104a, 0x6104f}, {0x61360, 0x61368}, {0x616eb, 0x616ed}, + {0x617d4, 0x617d6}, {0x617d8, 0x617da}, {0x61800, 0x6180a}, {0x61aa0, 0x61aa6}, + {0x61aa8, 0x61aad}, {0x61b5a, 0x61b60}, {0x61bfc, 0x61bff}, {0x61c3b, 0x61c3f}, + {0x61cc0, 0x61cc7}, {0x62010, 0x62027}, {0x62030, 0x62043}, {0x62045, 0x62051}, + {0x62053, 0x6205e}, {0x62308, 0x6230b}, {0x62768, 0x62775}, {0x627e6, 0x627ef}, + {0x62983, 0x62998}, {0x629d8, 0x629db}, {0x62cf9, 0x62cfc}, {0x62e00, 0x62e2e}, + {0x62e30, 0x62e49}, {0x63001, 0x63003}, {0x63008, 0x63011}, {0x63014, 0x6301f}, + {0x6a60d, 0x6a60f}, {0x6a6f2, 0x6a6f7}, {0x6a874, 0x6a877}, {0x6a8f8, 0x6a8fa}, + {0x6a9c1, 0x6a9cd}, {0x6aa5c, 0x6aa5f}, {0x6fe10, 0x6fe19}, {0x6fe30, 0x6fe52}, + {0x6fe54, 0x6fe61}, {0x6ff01, 0x6ff03}, {0x6ff05, 0x6ff0a}, {0x6ff0c, 0x6ff0f}, + {0x6ff3b, 0x6ff3d}, {0x6ff5f, 0x6ff65}, {0x70021, 0x70023}, {0x70025, 0x7002a}, + {0x7002c, 0x7002f}, {0x7005b, 0x7005d}, {0x7055a, 0x7055f}, {0x7066a, 0x7066d}, + {0x70700, 0x7070d}, {0x707f7, 0x707f9}, {0x70830, 0x7083e}, {0x70f04, 0x70f12}, + {0x70f3a, 0x70f3d}, {0x70fd0, 0x70fd4}, {0x7104a, 0x7104f}, {0x71360, 0x71368}, + {0x716eb, 0x716ed}, {0x717d4, 0x717d6}, {0x717d8, 0x717da}, {0x71800, 0x7180a}, + {0x71aa0, 0x71aa6}, {0x71aa8, 0x71aad}, {0x71b5a, 0x71b60}, {0x71bfc, 0x71bff}, + {0x71c3b, 0x71c3f}, {0x71cc0, 0x71cc7}, {0x72010, 0x72027}, {0x72030, 0x72043}, + {0x72045, 0x72051}, {0x72053, 0x7205e}, {0x72308, 0x7230b}, {0x72768, 0x72775}, + {0x727e6, 0x727ef}, {0x72983, 0x72998}, {0x729d8, 0x729db}, {0x72cf9, 0x72cfc}, + {0x72e00, 0x72e2e}, {0x72e30, 0x72e49}, {0x73001, 0x73003}, {0x73008, 0x73011}, + {0x73014, 0x7301f}, {0x7a60d, 0x7a60f}, {0x7a6f2, 0x7a6f7}, {0x7a874, 0x7a877}, + {0x7a8f8, 0x7a8fa}, {0x7a9c1, 0x7a9cd}, {0x7aa5c, 0x7aa5f}, {0x7fe10, 0x7fe19}, + {0x7fe30, 0x7fe52}, {0x7fe54, 0x7fe61}, {0x7ff01, 0x7ff03}, {0x7ff05, 0x7ff0a}, + {0x7ff0c, 0x7ff0f}, {0x7ff3b, 0x7ff3d}, {0x7ff5f, 0x7ff65}, {0x80021, 0x80023}, + {0x80025, 0x8002a}, {0x8002c, 0x8002f}, {0x8005b, 0x8005d}, {0x8055a, 0x8055f}, + {0x8066a, 0x8066d}, {0x80700, 0x8070d}, {0x807f7, 0x807f9}, {0x80830, 0x8083e}, + {0x80f04, 0x80f12}, {0x80f3a, 0x80f3d}, {0x80fd0, 0x80fd4}, {0x8104a, 0x8104f}, + {0x81360, 0x81368}, {0x816eb, 0x816ed}, {0x817d4, 0x817d6}, {0x817d8, 0x817da}, + {0x81800, 0x8180a}, {0x81aa0, 0x81aa6}, {0x81aa8, 0x81aad}, {0x81b5a, 0x81b60}, + {0x81bfc, 0x81bff}, {0x81c3b, 0x81c3f}, {0x81cc0, 0x81cc7}, {0x82010, 0x82027}, + {0x82030, 0x82043}, {0x82045, 0x82051}, {0x82053, 0x8205e}, {0x82308, 0x8230b}, + {0x82768, 0x82775}, {0x827e6, 0x827ef}, {0x82983, 0x82998}, {0x829d8, 0x829db}, + {0x82cf9, 0x82cfc}, {0x82e00, 0x82e2e}, {0x82e30, 0x82e49}, {0x83001, 0x83003}, + {0x83008, 0x83011}, {0x83014, 0x8301f}, {0x8a60d, 0x8a60f}, {0x8a6f2, 0x8a6f7}, + {0x8a874, 0x8a877}, {0x8a8f8, 0x8a8fa}, {0x8a9c1, 0x8a9cd}, {0x8aa5c, 0x8aa5f}, + {0x8fe10, 0x8fe19}, {0x8fe30, 0x8fe52}, {0x8fe54, 0x8fe61}, {0x8ff01, 0x8ff03}, + {0x8ff05, 0x8ff0a}, {0x8ff0c, 0x8ff0f}, {0x8ff3b, 0x8ff3d}, {0x8ff5f, 0x8ff65}, + {0x90021, 0x90023}, {0x90025, 0x9002a}, {0x9002c, 0x9002f}, {0x9005b, 0x9005d}, + {0x9055a, 0x9055f}, {0x9066a, 0x9066d}, {0x90700, 0x9070d}, {0x907f7, 0x907f9}, + {0x90830, 0x9083e}, {0x90f04, 0x90f12}, {0x90f3a, 0x90f3d}, {0x90fd0, 0x90fd4}, + {0x9104a, 0x9104f}, {0x91360, 0x91368}, {0x916eb, 0x916ed}, {0x917d4, 0x917d6}, + {0x917d8, 0x917da}, {0x91800, 0x9180a}, {0x91aa0, 0x91aa6}, {0x91aa8, 0x91aad}, + {0x91b5a, 0x91b60}, {0x91bfc, 0x91bff}, {0x91c3b, 0x91c3f}, {0x91cc0, 0x91cc7}, + {0x92010, 0x92027}, {0x92030, 0x92043}, {0x92045, 0x92051}, {0x92053, 0x9205e}, + {0x92308, 0x9230b}, {0x92768, 0x92775}, {0x927e6, 0x927ef}, {0x92983, 0x92998}, + {0x929d8, 0x929db}, {0x92cf9, 0x92cfc}, {0x92e00, 0x92e2e}, {0x92e30, 0x92e49}, + {0x93001, 0x93003}, {0x93008, 0x93011}, {0x93014, 0x9301f}, {0x9a60d, 0x9a60f}, + {0x9a6f2, 0x9a6f7}, {0x9a874, 0x9a877}, {0x9a8f8, 0x9a8fa}, {0x9a9c1, 0x9a9cd}, + {0x9aa5c, 0x9aa5f}, {0x9fe10, 0x9fe19}, {0x9fe30, 0x9fe52}, {0x9fe54, 0x9fe61}, + {0x9ff01, 0x9ff03}, {0x9ff05, 0x9ff0a}, {0x9ff0c, 0x9ff0f}, {0x9ff3b, 0x9ff3d}, + {0x9ff5f, 0x9ff65}, {0xa0021, 0xa0023}, {0xa0025, 0xa002a}, {0xa002c, 0xa002f}, + {0xa005b, 0xa005d}, {0xa055a, 0xa055f}, {0xa066a, 0xa066d}, {0xa0700, 0xa070d}, + {0xa07f7, 0xa07f9}, {0xa0830, 0xa083e}, {0xa0f04, 0xa0f12}, {0xa0f3a, 0xa0f3d}, + {0xa0fd0, 0xa0fd4}, {0xa104a, 0xa104f}, {0xa1360, 0xa1368}, {0xa16eb, 0xa16ed}, + {0xa17d4, 0xa17d6}, {0xa17d8, 0xa17da}, {0xa1800, 0xa180a}, {0xa1aa0, 0xa1aa6}, + {0xa1aa8, 0xa1aad}, {0xa1b5a, 0xa1b60}, {0xa1bfc, 0xa1bff}, {0xa1c3b, 0xa1c3f}, + {0xa1cc0, 0xa1cc7}, {0xa2010, 0xa2027}, {0xa2030, 0xa2043}, {0xa2045, 0xa2051}, + {0xa2053, 0xa205e}, {0xa2308, 0xa230b}, {0xa2768, 0xa2775}, {0xa27e6, 0xa27ef}, + {0xa2983, 0xa2998}, {0xa29d8, 0xa29db}, {0xa2cf9, 0xa2cfc}, {0xa2e00, 0xa2e2e}, + {0xa2e30, 0xa2e49}, {0xa3001, 0xa3003}, {0xa3008, 0xa3011}, {0xa3014, 0xa301f}, + {0xaa60d, 0xaa60f}, {0xaa6f2, 0xaa6f7}, {0xaa874, 0xaa877}, {0xaa8f8, 0xaa8fa}, + {0xaa9c1, 0xaa9cd}, {0xaaa5c, 0xaaa5f}, {0xafe10, 0xafe19}, {0xafe30, 0xafe52}, + {0xafe54, 0xafe61}, {0xaff01, 0xaff03}, {0xaff05, 0xaff0a}, {0xaff0c, 0xaff0f}, + {0xaff3b, 0xaff3d}, {0xaff5f, 0xaff65}, {0xb0021, 0xb0023}, {0xb0025, 0xb002a}, + {0xb002c, 0xb002f}, {0xb005b, 0xb005d}, {0xb055a, 0xb055f}, {0xb066a, 0xb066d}, + {0xb0700, 0xb070d}, {0xb07f7, 0xb07f9}, {0xb0830, 0xb083e}, {0xb0f04, 0xb0f12}, + {0xb0f3a, 0xb0f3d}, {0xb0fd0, 0xb0fd4}, {0xb104a, 0xb104f}, {0xb1360, 0xb1368}, + {0xb16eb, 0xb16ed}, {0xb17d4, 0xb17d6}, {0xb17d8, 0xb17da}, {0xb1800, 0xb180a}, + {0xb1aa0, 0xb1aa6}, {0xb1aa8, 0xb1aad}, {0xb1b5a, 0xb1b60}, {0xb1bfc, 0xb1bff}, + {0xb1c3b, 0xb1c3f}, {0xb1cc0, 0xb1cc7}, {0xb2010, 0xb2027}, {0xb2030, 0xb2043}, + {0xb2045, 0xb2051}, {0xb2053, 0xb205e}, {0xb2308, 0xb230b}, {0xb2768, 0xb2775}, + {0xb27e6, 0xb27ef}, {0xb2983, 0xb2998}, {0xb29d8, 0xb29db}, {0xb2cf9, 0xb2cfc}, + {0xb2e00, 0xb2e2e}, {0xb2e30, 0xb2e49}, {0xb3001, 0xb3003}, {0xb3008, 0xb3011}, + {0xb3014, 0xb301f}, {0xba60d, 0xba60f}, {0xba6f2, 0xba6f7}, {0xba874, 0xba877}, + {0xba8f8, 0xba8fa}, {0xba9c1, 0xba9cd}, {0xbaa5c, 0xbaa5f}, {0xbfe10, 0xbfe19}, + {0xbfe30, 0xbfe52}, {0xbfe54, 0xbfe61}, {0xbff01, 0xbff03}, {0xbff05, 0xbff0a}, + {0xbff0c, 0xbff0f}, {0xbff3b, 0xbff3d}, {0xbff5f, 0xbff65}, {0xc0021, 0xc0023}, + {0xc0025, 0xc002a}, {0xc002c, 0xc002f}, {0xc005b, 0xc005d}, {0xc055a, 0xc055f}, + {0xc066a, 0xc066d}, {0xc0700, 0xc070d}, {0xc07f7, 0xc07f9}, {0xc0830, 0xc083e}, + {0xc0f04, 0xc0f12}, {0xc0f3a, 0xc0f3d}, {0xc0fd0, 0xc0fd4}, {0xc104a, 0xc104f}, + {0xc1360, 0xc1368}, {0xc16eb, 0xc16ed}, {0xc17d4, 0xc17d6}, {0xc17d8, 0xc17da}, + {0xc1800, 0xc180a}, {0xc1aa0, 0xc1aa6}, {0xc1aa8, 0xc1aad}, {0xc1b5a, 0xc1b60}, + {0xc1bfc, 0xc1bff}, {0xc1c3b, 0xc1c3f}, {0xc1cc0, 0xc1cc7}, {0xc2010, 0xc2027}, + {0xc2030, 0xc2043}, {0xc2045, 0xc2051}, {0xc2053, 0xc205e}, {0xc2308, 0xc230b}, + {0xc2768, 0xc2775}, {0xc27e6, 0xc27ef}, {0xc2983, 0xc2998}, {0xc29d8, 0xc29db}, + {0xc2cf9, 0xc2cfc}, {0xc2e00, 0xc2e2e}, {0xc2e30, 0xc2e49}, {0xc3001, 0xc3003}, + {0xc3008, 0xc3011}, {0xc3014, 0xc301f}, {0xca60d, 0xca60f}, {0xca6f2, 0xca6f7}, + {0xca874, 0xca877}, {0xca8f8, 0xca8fa}, {0xca9c1, 0xca9cd}, {0xcaa5c, 0xcaa5f}, + {0xcfe10, 0xcfe19}, {0xcfe30, 0xcfe52}, {0xcfe54, 0xcfe61}, {0xcff01, 0xcff03}, + {0xcff05, 0xcff0a}, {0xcff0c, 0xcff0f}, {0xcff3b, 0xcff3d}, {0xcff5f, 0xcff65}, + {0xd0021, 0xd0023}, {0xd0025, 0xd002a}, {0xd002c, 0xd002f}, {0xd005b, 0xd005d}, + {0xd055a, 0xd055f}, {0xd066a, 0xd066d}, {0xd0700, 0xd070d}, {0xd07f7, 0xd07f9}, + {0xd0830, 0xd083e}, {0xd0f04, 0xd0f12}, {0xd0f3a, 0xd0f3d}, {0xd0fd0, 0xd0fd4}, + {0xd104a, 0xd104f}, {0xd1360, 0xd1368}, {0xd16eb, 0xd16ed}, {0xd17d4, 0xd17d6}, + {0xd17d8, 0xd17da}, {0xd1800, 0xd180a}, {0xd1aa0, 0xd1aa6}, {0xd1aa8, 0xd1aad}, + {0xd1b5a, 0xd1b60}, {0xd1bfc, 0xd1bff}, {0xd1c3b, 0xd1c3f}, {0xd1cc0, 0xd1cc7}, + {0xd2010, 0xd2027}, {0xd2030, 0xd2043}, {0xd2045, 0xd2051}, {0xd2053, 0xd205e}, + {0xd2308, 0xd230b}, {0xd2768, 0xd2775}, {0xd27e6, 0xd27ef}, {0xd2983, 0xd2998}, + {0xd29d8, 0xd29db}, {0xd2cf9, 0xd2cfc}, {0xd2e00, 0xd2e2e}, {0xd2e30, 0xd2e49}, + {0xd3001, 0xd3003}, {0xd3008, 0xd3011}, {0xd3014, 0xd301f}, {0xda60d, 0xda60f}, + {0xda6f2, 0xda6f7}, {0xda874, 0xda877}, {0xda8f8, 0xda8fa}, {0xda9c1, 0xda9cd}, + {0xdaa5c, 0xdaa5f}, {0xdfe10, 0xdfe19}, {0xdfe30, 0xdfe52}, {0xdfe54, 0xdfe61}, + {0xdff01, 0xdff03}, {0xdff05, 0xdff0a}, {0xdff0c, 0xdff0f}, {0xdff3b, 0xdff3d}, + {0xdff5f, 0xdff65}, {0xe0021, 0xe0023}, {0xe0025, 0xe002a}, {0xe002c, 0xe002f}, + {0xe005b, 0xe005d}, {0xe055a, 0xe055f}, {0xe066a, 0xe066d}, {0xe0700, 0xe070d}, + {0xe07f7, 0xe07f9}, {0xe0830, 0xe083e}, {0xe0f04, 0xe0f12}, {0xe0f3a, 0xe0f3d}, + {0xe0fd0, 0xe0fd4}, {0xe104a, 0xe104f}, {0xe1360, 0xe1368}, {0xe16eb, 0xe16ed}, + {0xe17d4, 0xe17d6}, {0xe17d8, 0xe17da}, {0xe1800, 0xe180a}, {0xe1aa0, 0xe1aa6}, + {0xe1aa8, 0xe1aad}, {0xe1b5a, 0xe1b60}, {0xe1bfc, 0xe1bff}, {0xe1c3b, 0xe1c3f}, + {0xe1cc0, 0xe1cc7}, {0xe2010, 0xe2027}, {0xe2030, 0xe2043}, {0xe2045, 0xe2051}, + {0xe2053, 0xe205e}, {0xe2308, 0xe230b}, {0xe2768, 0xe2775}, {0xe27e6, 0xe27ef}, + {0xe2983, 0xe2998}, {0xe29d8, 0xe29db}, {0xe2cf9, 0xe2cfc}, {0xe2e00, 0xe2e2e}, + {0xe2e30, 0xe2e49}, {0xe3001, 0xe3003}, {0xe3008, 0xe3011}, {0xe3014, 0xe301f}, + {0xea60d, 0xea60f}, {0xea6f2, 0xea6f7}, {0xea874, 0xea877}, {0xea8f8, 0xea8fa}, + {0xea9c1, 0xea9cd}, {0xeaa5c, 0xeaa5f}, {0xefe10, 0xefe19}, {0xefe30, 0xefe52}, + {0xefe54, 0xefe61}, {0xeff01, 0xeff03}, {0xeff05, 0xeff0a}, {0xeff0c, 0xeff0f}, + {0xeff3b, 0xeff3d}, {0xeff5f, 0xeff65}, {0xf0021, 0xf0023}, {0xf0025, 0xf002a}, + {0xf002c, 0xf002f}, {0xf005b, 0xf005d}, {0xf055a, 0xf055f}, {0xf066a, 0xf066d}, + {0xf0700, 0xf070d}, {0xf07f7, 0xf07f9}, {0xf0830, 0xf083e}, {0xf0f04, 0xf0f12}, + {0xf0f3a, 0xf0f3d}, {0xf0fd0, 0xf0fd4}, {0xf104a, 0xf104f}, {0xf1360, 0xf1368}, + {0xf16eb, 0xf16ed}, {0xf17d4, 0xf17d6}, {0xf17d8, 0xf17da}, {0xf1800, 0xf180a}, + {0xf1aa0, 0xf1aa6}, {0xf1aa8, 0xf1aad}, {0xf1b5a, 0xf1b60}, {0xf1bfc, 0xf1bff}, + {0xf1c3b, 0xf1c3f}, {0xf1cc0, 0xf1cc7}, {0xf2010, 0xf2027}, {0xf2030, 0xf2043}, + {0xf2045, 0xf2051}, {0xf2053, 0xf205e}, {0xf2308, 0xf230b}, {0xf2768, 0xf2775}, + {0xf27e6, 0xf27ef}, {0xf2983, 0xf2998}, {0xf29d8, 0xf29db}, {0xf2cf9, 0xf2cfc}, + {0xf2e00, 0xf2e2e}, {0xf2e30, 0xf2e49}, {0xf3001, 0xf3003}, {0xf3008, 0xf3011}, + {0xf3014, 0xf301f}, {0xfa60d, 0xfa60f}, {0xfa6f2, 0xfa6f7}, {0xfa874, 0xfa877}, + {0xfa8f8, 0xfa8fa}, {0xfa9c1, 0xfa9cd}, {0xfaa5c, 0xfaa5f}, {0xffe10, 0xffe19}, + {0xffe30, 0xffe52}, {0xffe54, 0xffe61}, {0xfff01, 0xfff03}, {0xfff05, 0xfff0a}, + {0xfff0c, 0xfff0f}, {0xfff3b, 0xfff3d}, {0xfff5f, 0xfff65}, {0x100021, 0x100023}, + {0x100025, 0x10002a}, {0x10002c, 0x10002f}, {0x10005b, 0x10005d}, {0x10055a, 0x10055f}, + {0x10066a, 0x10066d}, {0x100700, 0x10070d}, {0x1007f7, 0x1007f9}, {0x100830, 0x10083e}, + {0x100f04, 0x100f12}, {0x100f3a, 0x100f3d}, {0x100fd0, 0x100fd4}, {0x10104a, 0x10104f}, + {0x101360, 0x101368}, {0x1016eb, 0x1016ed}, {0x1017d4, 0x1017d6}, {0x1017d8, 0x1017da}, + {0x101800, 0x10180a}, {0x101aa0, 0x101aa6}, {0x101aa8, 0x101aad}, {0x101b5a, 0x101b60}, + {0x101bfc, 0x101bff}, {0x101c3b, 0x101c3f}, {0x101cc0, 0x101cc7}, {0x102010, 0x102027}, + {0x102030, 0x102043}, {0x102045, 0x102051}, {0x102053, 0x10205e}, {0x102308, 0x10230b}, + {0x102768, 0x102775}, {0x1027e6, 0x1027ef}, {0x102983, 0x102998}, {0x1029d8, 0x1029db}, + {0x102cf9, 0x102cfc}, {0x102e00, 0x102e2e}, {0x102e30, 0x102e49}, {0x103001, 0x103003}, + {0x103008, 0x103011}, {0x103014, 0x10301f}, {0x10a60d, 0x10a60f}, {0x10a6f2, 0x10a6f7}, + {0x10a874, 0x10a877}, {0x10a8f8, 0x10a8fa}, {0x10a9c1, 0x10a9cd}, {0x10aa5c, 0x10aa5f}, + {0x10fe10, 0x10fe19}, {0x10fe30, 0x10fe52}, {0x10fe54, 0x10fe61}, {0x10ff01, 0x10ff03}, + {0x10ff05, 0x10ff0a}, {0x10ff0c, 0x10ff0f}, {0x10ff3b, 0x10ff3d}, {0x10ff5f, 0x10ff65} #endif }; @@ -367,18 +2044,207 @@ static const chr punctCharTable[] = { 0xab, 0xb6, 0xb7, 0xbb, 0xbf, 0x37e, 0x387, 0x589, 0x58a, 0x5be, 0x5c0, 0x5c3, 0x5c6, 0x5f3, 0x5f4, 0x609, 0x60a, 0x60c, 0x60d, 0x61b, 0x61e, 0x61f, 0x6d4, 0x85e, 0x964, 0x965, 0x970, - 0xaf0, 0xdf4, 0xe4f, 0xe5a, 0xe5b, 0xf14, 0xf85, 0xfd9, 0xfda, - 0x10fb, 0x1400, 0x166d, 0x166e, 0x169b, 0x169c, 0x1735, 0x1736, 0x1944, - 0x1945, 0x1a1e, 0x1a1f, 0x1c7e, 0x1c7f, 0x1cd3, 0x207d, 0x207e, 0x208d, - 0x208e, 0x2329, 0x232a, 0x27c5, 0x27c6, 0x29fc, 0x29fd, 0x2cfe, 0x2cff, - 0x2d70, 0x3030, 0x303d, 0x30a0, 0x30fb, 0xa4fe, 0xa4ff, 0xa673, 0xa67e, - 0xa8ce, 0xa8cf, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa9de, 0xa9df, 0xaade, - 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68, 0xfe6a, - 0xfe6b, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d + 0x9fd, 0xaf0, 0xdf4, 0xe4f, 0xe5a, 0xe5b, 0xf14, 0xf85, 0xfd9, + 0xfda, 0x10fb, 0x1400, 0x166d, 0x166e, 0x169b, 0x169c, 0x1735, 0x1736, + 0x1944, 0x1945, 0x1a1e, 0x1a1f, 0x1c7e, 0x1c7f, 0x1cd3, 0x207d, 0x207e, + 0x208d, 0x208e, 0x2329, 0x232a, 0x27c5, 0x27c6, 0x29fc, 0x29fd, 0x2cfe, + 0x2cff, 0x2d70, 0x3030, 0x303d, 0x30a0, 0x30fb, 0xa4fe, 0xa4ff, 0xa673, + 0xa67e, 0xa8ce, 0xa8cf, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa9de, 0xa9df, + 0xaade, 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68, + 0xfe6a, 0xfe6b, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d #if TCL_UTF_MAX > 4 - ,0x1039f, 0x103d0, 0x1056f, 0x10857, 0x1091f, 0x1093f, 0x10a7f, 0x110bb, 0x110bc, - 0x11174, 0x11175, 0x111cd, 0x111db, 0x112a9, 0x1145b, 0x1145d, 0x114c6, 0x11c70, - 0x11c71, 0x16a6e, 0x16a6f, 0x16af5, 0x16b44, 0x1bc9f, 0x1e95e, 0x1e95f + ,0x1003a, 0x1003b, 0x1003f, 0x10040, 0x1005f, 0x1007b, 0x1007d, 0x100a1, 0x100a7, + 0x100ab, 0x100b6, 0x100b7, 0x100bb, 0x100bf, 0x1037e, 0x10387, 0x10589, 0x1058a, + 0x105be, 0x105c0, 0x105c3, 0x105c6, 0x105f3, 0x105f4, 0x10609, 0x1060a, 0x1060c, + 0x1060d, 0x1061b, 0x1061e, 0x1061f, 0x106d4, 0x1085e, 0x10964, 0x10965, 0x10970, + 0x109fd, 0x10af0, 0x10df4, 0x10e4f, 0x10e5a, 0x10e5b, 0x10f14, 0x10f85, 0x10fd9, + 0x10fda, 0x110fb, 0x11400, 0x1166d, 0x1166e, 0x1169b, 0x1169c, 0x11735, 0x11736, + 0x11944, 0x11945, 0x11a1e, 0x11a1f, 0x11c7e, 0x11c7f, 0x11cd3, 0x1207d, 0x1207e, + 0x1208d, 0x1208e, 0x12329, 0x1232a, 0x127c5, 0x127c6, 0x129fc, 0x129fd, 0x12cfe, + 0x12cff, 0x12d70, 0x13030, 0x1303d, 0x130a0, 0x130fb, 0x1a4fe, 0x1a4ff, 0x1a673, + 0x1a67e, 0x1a8ce, 0x1a8cf, 0x1a8fc, 0x1a92e, 0x1a92f, 0x1a95f, 0x1a9de, 0x1a9df, + 0x1aade, 0x1aadf, 0x1aaf0, 0x1aaf1, 0x1abeb, 0x1fd3e, 0x1fd3f, 0x1fe63, 0x1fe68, + 0x1fe6a, 0x1fe6b, 0x1ff1a, 0x1ff1b, 0x1ff1f, 0x1ff20, 0x1ff3f, 0x1ff5b, 0x1ff5d, + 0x2003a, 0x2003b, 0x2003f, 0x20040, 0x2005f, 0x2007b, 0x2007d, 0x200a1, 0x200a7, + 0x200ab, 0x200b6, 0x200b7, 0x200bb, 0x200bf, 0x2037e, 0x20387, 0x20589, 0x2058a, + 0x205be, 0x205c0, 0x205c3, 0x205c6, 0x205f3, 0x205f4, 0x20609, 0x2060a, 0x2060c, + 0x2060d, 0x2061b, 0x2061e, 0x2061f, 0x206d4, 0x2085e, 0x20964, 0x20965, 0x20970, + 0x209fd, 0x20af0, 0x20df4, 0x20e4f, 0x20e5a, 0x20e5b, 0x20f14, 0x20f85, 0x20fd9, + 0x20fda, 0x210fb, 0x21400, 0x2166d, 0x2166e, 0x2169b, 0x2169c, 0x21735, 0x21736, + 0x21944, 0x21945, 0x21a1e, 0x21a1f, 0x21c7e, 0x21c7f, 0x21cd3, 0x2207d, 0x2207e, + 0x2208d, 0x2208e, 0x22329, 0x2232a, 0x227c5, 0x227c6, 0x229fc, 0x229fd, 0x22cfe, + 0x22cff, 0x22d70, 0x23030, 0x2303d, 0x230a0, 0x230fb, 0x2a4fe, 0x2a4ff, 0x2a673, + 0x2a67e, 0x2a8ce, 0x2a8cf, 0x2a8fc, 0x2a92e, 0x2a92f, 0x2a95f, 0x2a9de, 0x2a9df, + 0x2aade, 0x2aadf, 0x2aaf0, 0x2aaf1, 0x2abeb, 0x2fd3e, 0x2fd3f, 0x2fe63, 0x2fe68, + 0x2fe6a, 0x2fe6b, 0x2ff1a, 0x2ff1b, 0x2ff1f, 0x2ff20, 0x2ff3f, 0x2ff5b, 0x2ff5d, + 0x3003a, 0x3003b, 0x3003f, 0x30040, 0x3005f, 0x3007b, 0x3007d, 0x300a1, 0x300a7, + 0x300ab, 0x300b6, 0x300b7, 0x300bb, 0x300bf, 0x3037e, 0x30387, 0x30589, 0x3058a, + 0x305be, 0x305c0, 0x305c3, 0x305c6, 0x305f3, 0x305f4, 0x30609, 0x3060a, 0x3060c, + 0x3060d, 0x3061b, 0x3061e, 0x3061f, 0x306d4, 0x3085e, 0x30964, 0x30965, 0x30970, + 0x309fd, 0x30af0, 0x30df4, 0x30e4f, 0x30e5a, 0x30e5b, 0x30f14, 0x30f85, 0x30fd9, + 0x30fda, 0x310fb, 0x31400, 0x3166d, 0x3166e, 0x3169b, 0x3169c, 0x31735, 0x31736, + 0x31944, 0x31945, 0x31a1e, 0x31a1f, 0x31c7e, 0x31c7f, 0x31cd3, 0x3207d, 0x3207e, + 0x3208d, 0x3208e, 0x32329, 0x3232a, 0x327c5, 0x327c6, 0x329fc, 0x329fd, 0x32cfe, + 0x32cff, 0x32d70, 0x33030, 0x3303d, 0x330a0, 0x330fb, 0x3a4fe, 0x3a4ff, 0x3a673, + 0x3a67e, 0x3a8ce, 0x3a8cf, 0x3a8fc, 0x3a92e, 0x3a92f, 0x3a95f, 0x3a9de, 0x3a9df, + 0x3aade, 0x3aadf, 0x3aaf0, 0x3aaf1, 0x3abeb, 0x3fd3e, 0x3fd3f, 0x3fe63, 0x3fe68, + 0x3fe6a, 0x3fe6b, 0x3ff1a, 0x3ff1b, 0x3ff1f, 0x3ff20, 0x3ff3f, 0x3ff5b, 0x3ff5d, + 0x4003a, 0x4003b, 0x4003f, 0x40040, 0x4005f, 0x4007b, 0x4007d, 0x400a1, 0x400a7, + 0x400ab, 0x400b6, 0x400b7, 0x400bb, 0x400bf, 0x4037e, 0x40387, 0x40589, 0x4058a, + 0x405be, 0x405c0, 0x405c3, 0x405c6, 0x405f3, 0x405f4, 0x40609, 0x4060a, 0x4060c, + 0x4060d, 0x4061b, 0x4061e, 0x4061f, 0x406d4, 0x4085e, 0x40964, 0x40965, 0x40970, + 0x409fd, 0x40af0, 0x40df4, 0x40e4f, 0x40e5a, 0x40e5b, 0x40f14, 0x40f85, 0x40fd9, + 0x40fda, 0x410fb, 0x41400, 0x4166d, 0x4166e, 0x4169b, 0x4169c, 0x41735, 0x41736, + 0x41944, 0x41945, 0x41a1e, 0x41a1f, 0x41c7e, 0x41c7f, 0x41cd3, 0x4207d, 0x4207e, + 0x4208d, 0x4208e, 0x42329, 0x4232a, 0x427c5, 0x427c6, 0x429fc, 0x429fd, 0x42cfe, + 0x42cff, 0x42d70, 0x43030, 0x4303d, 0x430a0, 0x430fb, 0x4a4fe, 0x4a4ff, 0x4a673, + 0x4a67e, 0x4a8ce, 0x4a8cf, 0x4a8fc, 0x4a92e, 0x4a92f, 0x4a95f, 0x4a9de, 0x4a9df, + 0x4aade, 0x4aadf, 0x4aaf0, 0x4aaf1, 0x4abeb, 0x4fd3e, 0x4fd3f, 0x4fe63, 0x4fe68, + 0x4fe6a, 0x4fe6b, 0x4ff1a, 0x4ff1b, 0x4ff1f, 0x4ff20, 0x4ff3f, 0x4ff5b, 0x4ff5d, + 0x5003a, 0x5003b, 0x5003f, 0x50040, 0x5005f, 0x5007b, 0x5007d, 0x500a1, 0x500a7, + 0x500ab, 0x500b6, 0x500b7, 0x500bb, 0x500bf, 0x5037e, 0x50387, 0x50589, 0x5058a, + 0x505be, 0x505c0, 0x505c3, 0x505c6, 0x505f3, 0x505f4, 0x50609, 0x5060a, 0x5060c, + 0x5060d, 0x5061b, 0x5061e, 0x5061f, 0x506d4, 0x5085e, 0x50964, 0x50965, 0x50970, + 0x509fd, 0x50af0, 0x50df4, 0x50e4f, 0x50e5a, 0x50e5b, 0x50f14, 0x50f85, 0x50fd9, + 0x50fda, 0x510fb, 0x51400, 0x5166d, 0x5166e, 0x5169b, 0x5169c, 0x51735, 0x51736, + 0x51944, 0x51945, 0x51a1e, 0x51a1f, 0x51c7e, 0x51c7f, 0x51cd3, 0x5207d, 0x5207e, + 0x5208d, 0x5208e, 0x52329, 0x5232a, 0x527c5, 0x527c6, 0x529fc, 0x529fd, 0x52cfe, + 0x52cff, 0x52d70, 0x53030, 0x5303d, 0x530a0, 0x530fb, 0x5a4fe, 0x5a4ff, 0x5a673, + 0x5a67e, 0x5a8ce, 0x5a8cf, 0x5a8fc, 0x5a92e, 0x5a92f, 0x5a95f, 0x5a9de, 0x5a9df, + 0x5aade, 0x5aadf, 0x5aaf0, 0x5aaf1, 0x5abeb, 0x5fd3e, 0x5fd3f, 0x5fe63, 0x5fe68, + 0x5fe6a, 0x5fe6b, 0x5ff1a, 0x5ff1b, 0x5ff1f, 0x5ff20, 0x5ff3f, 0x5ff5b, 0x5ff5d, + 0x6003a, 0x6003b, 0x6003f, 0x60040, 0x6005f, 0x6007b, 0x6007d, 0x600a1, 0x600a7, + 0x600ab, 0x600b6, 0x600b7, 0x600bb, 0x600bf, 0x6037e, 0x60387, 0x60589, 0x6058a, + 0x605be, 0x605c0, 0x605c3, 0x605c6, 0x605f3, 0x605f4, 0x60609, 0x6060a, 0x6060c, + 0x6060d, 0x6061b, 0x6061e, 0x6061f, 0x606d4, 0x6085e, 0x60964, 0x60965, 0x60970, + 0x609fd, 0x60af0, 0x60df4, 0x60e4f, 0x60e5a, 0x60e5b, 0x60f14, 0x60f85, 0x60fd9, + 0x60fda, 0x610fb, 0x61400, 0x6166d, 0x6166e, 0x6169b, 0x6169c, 0x61735, 0x61736, + 0x61944, 0x61945, 0x61a1e, 0x61a1f, 0x61c7e, 0x61c7f, 0x61cd3, 0x6207d, 0x6207e, + 0x6208d, 0x6208e, 0x62329, 0x6232a, 0x627c5, 0x627c6, 0x629fc, 0x629fd, 0x62cfe, + 0x62cff, 0x62d70, 0x63030, 0x6303d, 0x630a0, 0x630fb, 0x6a4fe, 0x6a4ff, 0x6a673, + 0x6a67e, 0x6a8ce, 0x6a8cf, 0x6a8fc, 0x6a92e, 0x6a92f, 0x6a95f, 0x6a9de, 0x6a9df, + 0x6aade, 0x6aadf, 0x6aaf0, 0x6aaf1, 0x6abeb, 0x6fd3e, 0x6fd3f, 0x6fe63, 0x6fe68, + 0x6fe6a, 0x6fe6b, 0x6ff1a, 0x6ff1b, 0x6ff1f, 0x6ff20, 0x6ff3f, 0x6ff5b, 0x6ff5d, + 0x7003a, 0x7003b, 0x7003f, 0x70040, 0x7005f, 0x7007b, 0x7007d, 0x700a1, 0x700a7, + 0x700ab, 0x700b6, 0x700b7, 0x700bb, 0x700bf, 0x7037e, 0x70387, 0x70589, 0x7058a, + 0x705be, 0x705c0, 0x705c3, 0x705c6, 0x705f3, 0x705f4, 0x70609, 0x7060a, 0x7060c, + 0x7060d, 0x7061b, 0x7061e, 0x7061f, 0x706d4, 0x7085e, 0x70964, 0x70965, 0x70970, + 0x709fd, 0x70af0, 0x70df4, 0x70e4f, 0x70e5a, 0x70e5b, 0x70f14, 0x70f85, 0x70fd9, + 0x70fda, 0x710fb, 0x71400, 0x7166d, 0x7166e, 0x7169b, 0x7169c, 0x71735, 0x71736, + 0x71944, 0x71945, 0x71a1e, 0x71a1f, 0x71c7e, 0x71c7f, 0x71cd3, 0x7207d, 0x7207e, + 0x7208d, 0x7208e, 0x72329, 0x7232a, 0x727c5, 0x727c6, 0x729fc, 0x729fd, 0x72cfe, + 0x72cff, 0x72d70, 0x73030, 0x7303d, 0x730a0, 0x730fb, 0x7a4fe, 0x7a4ff, 0x7a673, + 0x7a67e, 0x7a8ce, 0x7a8cf, 0x7a8fc, 0x7a92e, 0x7a92f, 0x7a95f, 0x7a9de, 0x7a9df, + 0x7aade, 0x7aadf, 0x7aaf0, 0x7aaf1, 0x7abeb, 0x7fd3e, 0x7fd3f, 0x7fe63, 0x7fe68, + 0x7fe6a, 0x7fe6b, 0x7ff1a, 0x7ff1b, 0x7ff1f, 0x7ff20, 0x7ff3f, 0x7ff5b, 0x7ff5d, + 0x8003a, 0x8003b, 0x8003f, 0x80040, 0x8005f, 0x8007b, 0x8007d, 0x800a1, 0x800a7, + 0x800ab, 0x800b6, 0x800b7, 0x800bb, 0x800bf, 0x8037e, 0x80387, 0x80589, 0x8058a, + 0x805be, 0x805c0, 0x805c3, 0x805c6, 0x805f3, 0x805f4, 0x80609, 0x8060a, 0x8060c, + 0x8060d, 0x8061b, 0x8061e, 0x8061f, 0x806d4, 0x8085e, 0x80964, 0x80965, 0x80970, + 0x809fd, 0x80af0, 0x80df4, 0x80e4f, 0x80e5a, 0x80e5b, 0x80f14, 0x80f85, 0x80fd9, + 0x80fda, 0x810fb, 0x81400, 0x8166d, 0x8166e, 0x8169b, 0x8169c, 0x81735, 0x81736, + 0x81944, 0x81945, 0x81a1e, 0x81a1f, 0x81c7e, 0x81c7f, 0x81cd3, 0x8207d, 0x8207e, + 0x8208d, 0x8208e, 0x82329, 0x8232a, 0x827c5, 0x827c6, 0x829fc, 0x829fd, 0x82cfe, + 0x82cff, 0x82d70, 0x83030, 0x8303d, 0x830a0, 0x830fb, 0x8a4fe, 0x8a4ff, 0x8a673, + 0x8a67e, 0x8a8ce, 0x8a8cf, 0x8a8fc, 0x8a92e, 0x8a92f, 0x8a95f, 0x8a9de, 0x8a9df, + 0x8aade, 0x8aadf, 0x8aaf0, 0x8aaf1, 0x8abeb, 0x8fd3e, 0x8fd3f, 0x8fe63, 0x8fe68, + 0x8fe6a, 0x8fe6b, 0x8ff1a, 0x8ff1b, 0x8ff1f, 0x8ff20, 0x8ff3f, 0x8ff5b, 0x8ff5d, + 0x9003a, 0x9003b, 0x9003f, 0x90040, 0x9005f, 0x9007b, 0x9007d, 0x900a1, 0x900a7, + 0x900ab, 0x900b6, 0x900b7, 0x900bb, 0x900bf, 0x9037e, 0x90387, 0x90589, 0x9058a, + 0x905be, 0x905c0, 0x905c3, 0x905c6, 0x905f3, 0x905f4, 0x90609, 0x9060a, 0x9060c, + 0x9060d, 0x9061b, 0x9061e, 0x9061f, 0x906d4, 0x9085e, 0x90964, 0x90965, 0x90970, + 0x909fd, 0x90af0, 0x90df4, 0x90e4f, 0x90e5a, 0x90e5b, 0x90f14, 0x90f85, 0x90fd9, + 0x90fda, 0x910fb, 0x91400, 0x9166d, 0x9166e, 0x9169b, 0x9169c, 0x91735, 0x91736, + 0x91944, 0x91945, 0x91a1e, 0x91a1f, 0x91c7e, 0x91c7f, 0x91cd3, 0x9207d, 0x9207e, + 0x9208d, 0x9208e, 0x92329, 0x9232a, 0x927c5, 0x927c6, 0x929fc, 0x929fd, 0x92cfe, + 0x92cff, 0x92d70, 0x93030, 0x9303d, 0x930a0, 0x930fb, 0x9a4fe, 0x9a4ff, 0x9a673, + 0x9a67e, 0x9a8ce, 0x9a8cf, 0x9a8fc, 0x9a92e, 0x9a92f, 0x9a95f, 0x9a9de, 0x9a9df, + 0x9aade, 0x9aadf, 0x9aaf0, 0x9aaf1, 0x9abeb, 0x9fd3e, 0x9fd3f, 0x9fe63, 0x9fe68, + 0x9fe6a, 0x9fe6b, 0x9ff1a, 0x9ff1b, 0x9ff1f, 0x9ff20, 0x9ff3f, 0x9ff5b, 0x9ff5d, + 0xa003a, 0xa003b, 0xa003f, 0xa0040, 0xa005f, 0xa007b, 0xa007d, 0xa00a1, 0xa00a7, + 0xa00ab, 0xa00b6, 0xa00b7, 0xa00bb, 0xa00bf, 0xa037e, 0xa0387, 0xa0589, 0xa058a, + 0xa05be, 0xa05c0, 0xa05c3, 0xa05c6, 0xa05f3, 0xa05f4, 0xa0609, 0xa060a, 0xa060c, + 0xa060d, 0xa061b, 0xa061e, 0xa061f, 0xa06d4, 0xa085e, 0xa0964, 0xa0965, 0xa0970, + 0xa09fd, 0xa0af0, 0xa0df4, 0xa0e4f, 0xa0e5a, 0xa0e5b, 0xa0f14, 0xa0f85, 0xa0fd9, + 0xa0fda, 0xa10fb, 0xa1400, 0xa166d, 0xa166e, 0xa169b, 0xa169c, 0xa1735, 0xa1736, + 0xa1944, 0xa1945, 0xa1a1e, 0xa1a1f, 0xa1c7e, 0xa1c7f, 0xa1cd3, 0xa207d, 0xa207e, + 0xa208d, 0xa208e, 0xa2329, 0xa232a, 0xa27c5, 0xa27c6, 0xa29fc, 0xa29fd, 0xa2cfe, + 0xa2cff, 0xa2d70, 0xa3030, 0xa303d, 0xa30a0, 0xa30fb, 0xaa4fe, 0xaa4ff, 0xaa673, + 0xaa67e, 0xaa8ce, 0xaa8cf, 0xaa8fc, 0xaa92e, 0xaa92f, 0xaa95f, 0xaa9de, 0xaa9df, + 0xaaade, 0xaaadf, 0xaaaf0, 0xaaaf1, 0xaabeb, 0xafd3e, 0xafd3f, 0xafe63, 0xafe68, + 0xafe6a, 0xafe6b, 0xaff1a, 0xaff1b, 0xaff1f, 0xaff20, 0xaff3f, 0xaff5b, 0xaff5d, + 0xb003a, 0xb003b, 0xb003f, 0xb0040, 0xb005f, 0xb007b, 0xb007d, 0xb00a1, 0xb00a7, + 0xb00ab, 0xb00b6, 0xb00b7, 0xb00bb, 0xb00bf, 0xb037e, 0xb0387, 0xb0589, 0xb058a, + 0xb05be, 0xb05c0, 0xb05c3, 0xb05c6, 0xb05f3, 0xb05f4, 0xb0609, 0xb060a, 0xb060c, + 0xb060d, 0xb061b, 0xb061e, 0xb061f, 0xb06d4, 0xb085e, 0xb0964, 0xb0965, 0xb0970, + 0xb09fd, 0xb0af0, 0xb0df4, 0xb0e4f, 0xb0e5a, 0xb0e5b, 0xb0f14, 0xb0f85, 0xb0fd9, + 0xb0fda, 0xb10fb, 0xb1400, 0xb166d, 0xb166e, 0xb169b, 0xb169c, 0xb1735, 0xb1736, + 0xb1944, 0xb1945, 0xb1a1e, 0xb1a1f, 0xb1c7e, 0xb1c7f, 0xb1cd3, 0xb207d, 0xb207e, + 0xb208d, 0xb208e, 0xb2329, 0xb232a, 0xb27c5, 0xb27c6, 0xb29fc, 0xb29fd, 0xb2cfe, + 0xb2cff, 0xb2d70, 0xb3030, 0xb303d, 0xb30a0, 0xb30fb, 0xba4fe, 0xba4ff, 0xba673, + 0xba67e, 0xba8ce, 0xba8cf, 0xba8fc, 0xba92e, 0xba92f, 0xba95f, 0xba9de, 0xba9df, + 0xbaade, 0xbaadf, 0xbaaf0, 0xbaaf1, 0xbabeb, 0xbfd3e, 0xbfd3f, 0xbfe63, 0xbfe68, + 0xbfe6a, 0xbfe6b, 0xbff1a, 0xbff1b, 0xbff1f, 0xbff20, 0xbff3f, 0xbff5b, 0xbff5d, + 0xc003a, 0xc003b, 0xc003f, 0xc0040, 0xc005f, 0xc007b, 0xc007d, 0xc00a1, 0xc00a7, + 0xc00ab, 0xc00b6, 0xc00b7, 0xc00bb, 0xc00bf, 0xc037e, 0xc0387, 0xc0589, 0xc058a, + 0xc05be, 0xc05c0, 0xc05c3, 0xc05c6, 0xc05f3, 0xc05f4, 0xc0609, 0xc060a, 0xc060c, + 0xc060d, 0xc061b, 0xc061e, 0xc061f, 0xc06d4, 0xc085e, 0xc0964, 0xc0965, 0xc0970, + 0xc09fd, 0xc0af0, 0xc0df4, 0xc0e4f, 0xc0e5a, 0xc0e5b, 0xc0f14, 0xc0f85, 0xc0fd9, + 0xc0fda, 0xc10fb, 0xc1400, 0xc166d, 0xc166e, 0xc169b, 0xc169c, 0xc1735, 0xc1736, + 0xc1944, 0xc1945, 0xc1a1e, 0xc1a1f, 0xc1c7e, 0xc1c7f, 0xc1cd3, 0xc207d, 0xc207e, + 0xc208d, 0xc208e, 0xc2329, 0xc232a, 0xc27c5, 0xc27c6, 0xc29fc, 0xc29fd, 0xc2cfe, + 0xc2cff, 0xc2d70, 0xc3030, 0xc303d, 0xc30a0, 0xc30fb, 0xca4fe, 0xca4ff, 0xca673, + 0xca67e, 0xca8ce, 0xca8cf, 0xca8fc, 0xca92e, 0xca92f, 0xca95f, 0xca9de, 0xca9df, + 0xcaade, 0xcaadf, 0xcaaf0, 0xcaaf1, 0xcabeb, 0xcfd3e, 0xcfd3f, 0xcfe63, 0xcfe68, + 0xcfe6a, 0xcfe6b, 0xcff1a, 0xcff1b, 0xcff1f, 0xcff20, 0xcff3f, 0xcff5b, 0xcff5d, + 0xd003a, 0xd003b, 0xd003f, 0xd0040, 0xd005f, 0xd007b, 0xd007d, 0xd00a1, 0xd00a7, + 0xd00ab, 0xd00b6, 0xd00b7, 0xd00bb, 0xd00bf, 0xd037e, 0xd0387, 0xd0589, 0xd058a, + 0xd05be, 0xd05c0, 0xd05c3, 0xd05c6, 0xd05f3, 0xd05f4, 0xd0609, 0xd060a, 0xd060c, + 0xd060d, 0xd061b, 0xd061e, 0xd061f, 0xd06d4, 0xd085e, 0xd0964, 0xd0965, 0xd0970, + 0xd09fd, 0xd0af0, 0xd0df4, 0xd0e4f, 0xd0e5a, 0xd0e5b, 0xd0f14, 0xd0f85, 0xd0fd9, + 0xd0fda, 0xd10fb, 0xd1400, 0xd166d, 0xd166e, 0xd169b, 0xd169c, 0xd1735, 0xd1736, + 0xd1944, 0xd1945, 0xd1a1e, 0xd1a1f, 0xd1c7e, 0xd1c7f, 0xd1cd3, 0xd207d, 0xd207e, + 0xd208d, 0xd208e, 0xd2329, 0xd232a, 0xd27c5, 0xd27c6, 0xd29fc, 0xd29fd, 0xd2cfe, + 0xd2cff, 0xd2d70, 0xd3030, 0xd303d, 0xd30a0, 0xd30fb, 0xda4fe, 0xda4ff, 0xda673, + 0xda67e, 0xda8ce, 0xda8cf, 0xda8fc, 0xda92e, 0xda92f, 0xda95f, 0xda9de, 0xda9df, + 0xdaade, 0xdaadf, 0xdaaf0, 0xdaaf1, 0xdabeb, 0xdfd3e, 0xdfd3f, 0xdfe63, 0xdfe68, + 0xdfe6a, 0xdfe6b, 0xdff1a, 0xdff1b, 0xdff1f, 0xdff20, 0xdff3f, 0xdff5b, 0xdff5d, + 0xe003a, 0xe003b, 0xe003f, 0xe0040, 0xe005f, 0xe007b, 0xe007d, 0xe00a1, 0xe00a7, + 0xe00ab, 0xe00b6, 0xe00b7, 0xe00bb, 0xe00bf, 0xe037e, 0xe0387, 0xe0589, 0xe058a, + 0xe05be, 0xe05c0, 0xe05c3, 0xe05c6, 0xe05f3, 0xe05f4, 0xe0609, 0xe060a, 0xe060c, + 0xe060d, 0xe061b, 0xe061e, 0xe061f, 0xe06d4, 0xe085e, 0xe0964, 0xe0965, 0xe0970, + 0xe09fd, 0xe0af0, 0xe0df4, 0xe0e4f, 0xe0e5a, 0xe0e5b, 0xe0f14, 0xe0f85, 0xe0fd9, + 0xe0fda, 0xe10fb, 0xe1400, 0xe166d, 0xe166e, 0xe169b, 0xe169c, 0xe1735, 0xe1736, + 0xe1944, 0xe1945, 0xe1a1e, 0xe1a1f, 0xe1c7e, 0xe1c7f, 0xe1cd3, 0xe207d, 0xe207e, + 0xe208d, 0xe208e, 0xe2329, 0xe232a, 0xe27c5, 0xe27c6, 0xe29fc, 0xe29fd, 0xe2cfe, + 0xe2cff, 0xe2d70, 0xe3030, 0xe303d, 0xe30a0, 0xe30fb, 0xea4fe, 0xea4ff, 0xea673, + 0xea67e, 0xea8ce, 0xea8cf, 0xea8fc, 0xea92e, 0xea92f, 0xea95f, 0xea9de, 0xea9df, + 0xeaade, 0xeaadf, 0xeaaf0, 0xeaaf1, 0xeabeb, 0xefd3e, 0xefd3f, 0xefe63, 0xefe68, + 0xefe6a, 0xefe6b, 0xeff1a, 0xeff1b, 0xeff1f, 0xeff20, 0xeff3f, 0xeff5b, 0xeff5d, + 0xf003a, 0xf003b, 0xf003f, 0xf0040, 0xf005f, 0xf007b, 0xf007d, 0xf00a1, 0xf00a7, + 0xf00ab, 0xf00b6, 0xf00b7, 0xf00bb, 0xf00bf, 0xf037e, 0xf0387, 0xf0589, 0xf058a, + 0xf05be, 0xf05c0, 0xf05c3, 0xf05c6, 0xf05f3, 0xf05f4, 0xf0609, 0xf060a, 0xf060c, + 0xf060d, 0xf061b, 0xf061e, 0xf061f, 0xf06d4, 0xf085e, 0xf0964, 0xf0965, 0xf0970, + 0xf09fd, 0xf0af0, 0xf0df4, 0xf0e4f, 0xf0e5a, 0xf0e5b, 0xf0f14, 0xf0f85, 0xf0fd9, + 0xf0fda, 0xf10fb, 0xf1400, 0xf166d, 0xf166e, 0xf169b, 0xf169c, 0xf1735, 0xf1736, + 0xf1944, 0xf1945, 0xf1a1e, 0xf1a1f, 0xf1c7e, 0xf1c7f, 0xf1cd3, 0xf207d, 0xf207e, + 0xf208d, 0xf208e, 0xf2329, 0xf232a, 0xf27c5, 0xf27c6, 0xf29fc, 0xf29fd, 0xf2cfe, + 0xf2cff, 0xf2d70, 0xf3030, 0xf303d, 0xf30a0, 0xf30fb, 0xfa4fe, 0xfa4ff, 0xfa673, + 0xfa67e, 0xfa8ce, 0xfa8cf, 0xfa8fc, 0xfa92e, 0xfa92f, 0xfa95f, 0xfa9de, 0xfa9df, + 0xfaade, 0xfaadf, 0xfaaf0, 0xfaaf1, 0xfabeb, 0xffd3e, 0xffd3f, 0xffe63, 0xffe68, + 0xffe6a, 0xffe6b, 0xfff1a, 0xfff1b, 0xfff1f, 0xfff20, 0xfff3f, 0xfff5b, 0xfff5d, + 0x10003a, 0x10003b, 0x10003f, 0x100040, 0x10005f, 0x10007b, 0x10007d, 0x1000a1, 0x1000a7, + 0x1000ab, 0x1000b6, 0x1000b7, 0x1000bb, 0x1000bf, 0x10037e, 0x100387, 0x100589, 0x10058a, + 0x1005be, 0x1005c0, 0x1005c3, 0x1005c6, 0x1005f3, 0x1005f4, 0x100609, 0x10060a, 0x10060c, + 0x10060d, 0x10061b, 0x10061e, 0x10061f, 0x1006d4, 0x10085e, 0x100964, 0x100965, 0x100970, + 0x1009fd, 0x100af0, 0x100df4, 0x100e4f, 0x100e5a, 0x100e5b, 0x100f14, 0x100f85, 0x100fd9, + 0x100fda, 0x1010fb, 0x101400, 0x10166d, 0x10166e, 0x10169b, 0x10169c, 0x101735, 0x101736, + 0x101944, 0x101945, 0x101a1e, 0x101a1f, 0x101c7e, 0x101c7f, 0x101cd3, 0x10207d, 0x10207e, + 0x10208d, 0x10208e, 0x102329, 0x10232a, 0x1027c5, 0x1027c6, 0x1029fc, 0x1029fd, 0x102cfe, + 0x102cff, 0x102d70, 0x103030, 0x10303d, 0x1030a0, 0x1030fb, 0x10a4fe, 0x10a4ff, 0x10a673, + 0x10a67e, 0x10a8ce, 0x10a8cf, 0x10a8fc, 0x10a92e, 0x10a92f, 0x10a95f, 0x10a9de, 0x10a9df, + 0x10aade, 0x10aadf, 0x10aaf0, 0x10aaf1, 0x10abeb, 0x10fd3e, 0x10fd3f, 0x10fe63, 0x10fe68, + 0x10fe6a, 0x10fe6b, 0x10ff1a, 0x10ff1b, 0x10ff1f, 0x10ff20, 0x10ff3f, 0x10ff5b, 0x10ff5d #endif }; @@ -390,6 +2256,16 @@ static const chr punctCharTable[] = { static const crange spaceRangeTable[] = { {0x9, 0xd}, {0x2000, 0x200b} +#if TCL_UTF_MAX > 4 + ,{0x10009, 0x1000d}, {0x12000, 0x1200b}, {0x20009, 0x2000d}, {0x22000, 0x2200b}, + {0x30009, 0x3000d}, {0x32000, 0x3200b}, {0x40009, 0x4000d}, {0x42000, 0x4200b}, + {0x50009, 0x5000d}, {0x52000, 0x5200b}, {0x60009, 0x6000d}, {0x62000, 0x6200b}, + {0x70009, 0x7000d}, {0x72000, 0x7200b}, {0x80009, 0x8000d}, {0x82000, 0x8200b}, + {0x90009, 0x9000d}, {0x92000, 0x9200b}, {0xa0009, 0xa000d}, {0xa2000, 0xa200b}, + {0xb0009, 0xb000d}, {0xb2000, 0xb200b}, {0xc0009, 0xc000d}, {0xc2000, 0xc200b}, + {0xd0009, 0xd000d}, {0xd2000, 0xd200b}, {0xe0009, 0xe000d}, {0xe2000, 0xe200b}, + {0xf0009, 0xf000d}, {0xf2000, 0xf200b}, {0x100009, 0x10000d}, {0x102000, 0x10200b} +#endif }; #define NUM_SPACE_RANGE (sizeof(spaceRangeTable)/sizeof(crange)) @@ -397,6 +2273,30 @@ static const crange spaceRangeTable[] = { static const chr spaceCharTable[] = { 0x20, 0x85, 0xa0, 0x1680, 0x180e, 0x2028, 0x2029, 0x202f, 0x205f, 0x2060, 0x3000, 0xfeff +#if TCL_UTF_MAX > 4 + ,0x10020, 0x10085, 0x100a0, 0x11680, 0x1180e, 0x12028, 0x12029, 0x1202f, 0x1205f, + 0x12060, 0x13000, 0x1feff, 0x20020, 0x20085, 0x200a0, 0x21680, 0x2180e, 0x22028, + 0x22029, 0x2202f, 0x2205f, 0x22060, 0x23000, 0x2feff, 0x30020, 0x30085, 0x300a0, + 0x31680, 0x3180e, 0x32028, 0x32029, 0x3202f, 0x3205f, 0x32060, 0x33000, 0x3feff, + 0x40020, 0x40085, 0x400a0, 0x41680, 0x4180e, 0x42028, 0x42029, 0x4202f, 0x4205f, + 0x42060, 0x43000, 0x4feff, 0x50020, 0x50085, 0x500a0, 0x51680, 0x5180e, 0x52028, + 0x52029, 0x5202f, 0x5205f, 0x52060, 0x53000, 0x5feff, 0x60020, 0x60085, 0x600a0, + 0x61680, 0x6180e, 0x62028, 0x62029, 0x6202f, 0x6205f, 0x62060, 0x63000, 0x6feff, + 0x70020, 0x70085, 0x700a0, 0x71680, 0x7180e, 0x72028, 0x72029, 0x7202f, 0x7205f, + 0x72060, 0x73000, 0x7feff, 0x80020, 0x80085, 0x800a0, 0x81680, 0x8180e, 0x82028, + 0x82029, 0x8202f, 0x8205f, 0x82060, 0x83000, 0x8feff, 0x90020, 0x90085, 0x900a0, + 0x91680, 0x9180e, 0x92028, 0x92029, 0x9202f, 0x9205f, 0x92060, 0x93000, 0x9feff, + 0xa0020, 0xa0085, 0xa00a0, 0xa1680, 0xa180e, 0xa2028, 0xa2029, 0xa202f, 0xa205f, + 0xa2060, 0xa3000, 0xafeff, 0xb0020, 0xb0085, 0xb00a0, 0xb1680, 0xb180e, 0xb2028, + 0xb2029, 0xb202f, 0xb205f, 0xb2060, 0xb3000, 0xbfeff, 0xc0020, 0xc0085, 0xc00a0, + 0xc1680, 0xc180e, 0xc2028, 0xc2029, 0xc202f, 0xc205f, 0xc2060, 0xc3000, 0xcfeff, + 0xd0020, 0xd0085, 0xd00a0, 0xd1680, 0xd180e, 0xd2028, 0xd2029, 0xd202f, 0xd205f, + 0xd2060, 0xd3000, 0xdfeff, 0xe0020, 0xe0085, 0xe00a0, 0xe1680, 0xe180e, 0xe2028, + 0xe2029, 0xe202f, 0xe205f, 0xe2060, 0xe3000, 0xefeff, 0xf0020, 0xf0085, 0xf00a0, + 0xf1680, 0xf180e, 0xf2028, 0xf2029, 0xf202f, 0xf205f, 0xf2060, 0xf3000, 0xffeff, + 0x100020, 0x100085, 0x1000a0, 0x101680, 0x10180e, 0x102028, 0x102029, 0x10202f, 0x10205f, + 0x102060, 0x103000, 0x10feff +#endif }; #define NUM_SPACE_CHAR (sizeof(spaceCharTable)/sizeof(chr)) @@ -420,14 +2320,206 @@ static const crange lowerRangeTable[] = { {0xab30, 0xab5a}, {0xab60, 0xab65}, {0xab70, 0xabbf}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xff41, 0xff5a} #if TCL_UTF_MAX > 4 - ,{0x10428, 0x1044f}, {0x104d8, 0x104fb}, {0x10cc0, 0x10cf2}, {0x118c0, 0x118df}, - {0x1d41a, 0x1d433}, {0x1d44e, 0x1d454}, {0x1d456, 0x1d467}, {0x1d482, 0x1d49b}, - {0x1d4b6, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d4cf}, {0x1d4ea, 0x1d503}, - {0x1d51e, 0x1d537}, {0x1d552, 0x1d56b}, {0x1d586, 0x1d59f}, {0x1d5ba, 0x1d5d3}, - {0x1d5ee, 0x1d607}, {0x1d622, 0x1d63b}, {0x1d656, 0x1d66f}, {0x1d68a, 0x1d6a5}, - {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6e1}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, - {0x1d736, 0x1d74e}, {0x1d750, 0x1d755}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d78f}, - {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9}, {0x1e922, 0x1e943} + ,{0x10061, 0x1007a}, {0x100df, 0x100f6}, {0x100f8, 0x100ff}, {0x1017e, 0x10180}, + {0x10199, 0x1019b}, {0x101bd, 0x101bf}, {0x10233, 0x10239}, {0x1024f, 0x10293}, + {0x10295, 0x102af}, {0x1037b, 0x1037d}, {0x103ac, 0x103ce}, {0x103d5, 0x103d7}, + {0x103ef, 0x103f3}, {0x10430, 0x1045f}, {0x10561, 0x10587}, {0x113f8, 0x113fd}, + {0x11c80, 0x11c88}, {0x11d00, 0x11d2b}, {0x11d6b, 0x11d77}, {0x11d79, 0x11d9a}, + {0x11e95, 0x11e9d}, {0x11eff, 0x11f07}, {0x11f10, 0x11f15}, {0x11f20, 0x11f27}, + {0x11f30, 0x11f37}, {0x11f40, 0x11f45}, {0x11f50, 0x11f57}, {0x11f60, 0x11f67}, + {0x11f70, 0x11f7d}, {0x11f80, 0x11f87}, {0x11f90, 0x11f97}, {0x11fa0, 0x11fa7}, + {0x11fb0, 0x11fb4}, {0x11fc2, 0x11fc4}, {0x11fd0, 0x11fd3}, {0x11fe0, 0x11fe7}, + {0x11ff2, 0x11ff4}, {0x12146, 0x12149}, {0x12c30, 0x12c5e}, {0x12c76, 0x12c7b}, + {0x12d00, 0x12d25}, {0x1a72f, 0x1a731}, {0x1a771, 0x1a778}, {0x1a793, 0x1a795}, + {0x1ab30, 0x1ab5a}, {0x1ab60, 0x1ab65}, {0x1ab70, 0x1abbf}, {0x1fb00, 0x1fb06}, + {0x1fb13, 0x1fb17}, {0x1ff41, 0x1ff5a}, {0x20061, 0x2007a}, {0x200df, 0x200f6}, + {0x200f8, 0x200ff}, {0x2017e, 0x20180}, {0x20199, 0x2019b}, {0x201bd, 0x201bf}, + {0x20233, 0x20239}, {0x2024f, 0x20293}, {0x20295, 0x202af}, {0x2037b, 0x2037d}, + {0x203ac, 0x203ce}, {0x203d5, 0x203d7}, {0x203ef, 0x203f3}, {0x20430, 0x2045f}, + {0x20561, 0x20587}, {0x213f8, 0x213fd}, {0x21c80, 0x21c88}, {0x21d00, 0x21d2b}, + {0x21d6b, 0x21d77}, {0x21d79, 0x21d9a}, {0x21e95, 0x21e9d}, {0x21eff, 0x21f07}, + {0x21f10, 0x21f15}, {0x21f20, 0x21f27}, {0x21f30, 0x21f37}, {0x21f40, 0x21f45}, + {0x21f50, 0x21f57}, {0x21f60, 0x21f67}, {0x21f70, 0x21f7d}, {0x21f80, 0x21f87}, + {0x21f90, 0x21f97}, {0x21fa0, 0x21fa7}, {0x21fb0, 0x21fb4}, {0x21fc2, 0x21fc4}, + {0x21fd0, 0x21fd3}, {0x21fe0, 0x21fe7}, {0x21ff2, 0x21ff4}, {0x22146, 0x22149}, + {0x22c30, 0x22c5e}, {0x22c76, 0x22c7b}, {0x22d00, 0x22d25}, {0x2a72f, 0x2a731}, + {0x2a771, 0x2a778}, {0x2a793, 0x2a795}, {0x2ab30, 0x2ab5a}, {0x2ab60, 0x2ab65}, + {0x2ab70, 0x2abbf}, {0x2fb00, 0x2fb06}, {0x2fb13, 0x2fb17}, {0x2ff41, 0x2ff5a}, + {0x30061, 0x3007a}, {0x300df, 0x300f6}, {0x300f8, 0x300ff}, {0x3017e, 0x30180}, + {0x30199, 0x3019b}, {0x301bd, 0x301bf}, {0x30233, 0x30239}, {0x3024f, 0x30293}, + {0x30295, 0x302af}, {0x3037b, 0x3037d}, {0x303ac, 0x303ce}, {0x303d5, 0x303d7}, + {0x303ef, 0x303f3}, {0x30430, 0x3045f}, {0x30561, 0x30587}, {0x313f8, 0x313fd}, + {0x31c80, 0x31c88}, {0x31d00, 0x31d2b}, {0x31d6b, 0x31d77}, {0x31d79, 0x31d9a}, + {0x31e95, 0x31e9d}, {0x31eff, 0x31f07}, {0x31f10, 0x31f15}, {0x31f20, 0x31f27}, + {0x31f30, 0x31f37}, {0x31f40, 0x31f45}, {0x31f50, 0x31f57}, {0x31f60, 0x31f67}, + {0x31f70, 0x31f7d}, {0x31f80, 0x31f87}, {0x31f90, 0x31f97}, {0x31fa0, 0x31fa7}, + {0x31fb0, 0x31fb4}, {0x31fc2, 0x31fc4}, {0x31fd0, 0x31fd3}, {0x31fe0, 0x31fe7}, + {0x31ff2, 0x31ff4}, {0x32146, 0x32149}, {0x32c30, 0x32c5e}, {0x32c76, 0x32c7b}, + {0x32d00, 0x32d25}, {0x3a72f, 0x3a731}, {0x3a771, 0x3a778}, {0x3a793, 0x3a795}, + {0x3ab30, 0x3ab5a}, {0x3ab60, 0x3ab65}, {0x3ab70, 0x3abbf}, {0x3fb00, 0x3fb06}, + {0x3fb13, 0x3fb17}, {0x3ff41, 0x3ff5a}, {0x40061, 0x4007a}, {0x400df, 0x400f6}, + {0x400f8, 0x400ff}, {0x4017e, 0x40180}, {0x40199, 0x4019b}, {0x401bd, 0x401bf}, + {0x40233, 0x40239}, {0x4024f, 0x40293}, {0x40295, 0x402af}, {0x4037b, 0x4037d}, + {0x403ac, 0x403ce}, {0x403d5, 0x403d7}, {0x403ef, 0x403f3}, {0x40430, 0x4045f}, + {0x40561, 0x40587}, {0x413f8, 0x413fd}, {0x41c80, 0x41c88}, {0x41d00, 0x41d2b}, + {0x41d6b, 0x41d77}, {0x41d79, 0x41d9a}, {0x41e95, 0x41e9d}, {0x41eff, 0x41f07}, + {0x41f10, 0x41f15}, {0x41f20, 0x41f27}, {0x41f30, 0x41f37}, {0x41f40, 0x41f45}, + {0x41f50, 0x41f57}, {0x41f60, 0x41f67}, {0x41f70, 0x41f7d}, {0x41f80, 0x41f87}, + {0x41f90, 0x41f97}, {0x41fa0, 0x41fa7}, {0x41fb0, 0x41fb4}, {0x41fc2, 0x41fc4}, + {0x41fd0, 0x41fd3}, {0x41fe0, 0x41fe7}, {0x41ff2, 0x41ff4}, {0x42146, 0x42149}, + {0x42c30, 0x42c5e}, {0x42c76, 0x42c7b}, {0x42d00, 0x42d25}, {0x4a72f, 0x4a731}, + {0x4a771, 0x4a778}, {0x4a793, 0x4a795}, {0x4ab30, 0x4ab5a}, {0x4ab60, 0x4ab65}, + {0x4ab70, 0x4abbf}, {0x4fb00, 0x4fb06}, {0x4fb13, 0x4fb17}, {0x4ff41, 0x4ff5a}, + {0x50061, 0x5007a}, {0x500df, 0x500f6}, {0x500f8, 0x500ff}, {0x5017e, 0x50180}, + {0x50199, 0x5019b}, {0x501bd, 0x501bf}, {0x50233, 0x50239}, {0x5024f, 0x50293}, + {0x50295, 0x502af}, {0x5037b, 0x5037d}, {0x503ac, 0x503ce}, {0x503d5, 0x503d7}, + {0x503ef, 0x503f3}, {0x50430, 0x5045f}, {0x50561, 0x50587}, {0x513f8, 0x513fd}, + {0x51c80, 0x51c88}, {0x51d00, 0x51d2b}, {0x51d6b, 0x51d77}, {0x51d79, 0x51d9a}, + {0x51e95, 0x51e9d}, {0x51eff, 0x51f07}, {0x51f10, 0x51f15}, {0x51f20, 0x51f27}, + {0x51f30, 0x51f37}, {0x51f40, 0x51f45}, {0x51f50, 0x51f57}, {0x51f60, 0x51f67}, + {0x51f70, 0x51f7d}, {0x51f80, 0x51f87}, {0x51f90, 0x51f97}, {0x51fa0, 0x51fa7}, + {0x51fb0, 0x51fb4}, {0x51fc2, 0x51fc4}, {0x51fd0, 0x51fd3}, {0x51fe0, 0x51fe7}, + {0x51ff2, 0x51ff4}, {0x52146, 0x52149}, {0x52c30, 0x52c5e}, {0x52c76, 0x52c7b}, + {0x52d00, 0x52d25}, {0x5a72f, 0x5a731}, {0x5a771, 0x5a778}, {0x5a793, 0x5a795}, + {0x5ab30, 0x5ab5a}, {0x5ab60, 0x5ab65}, {0x5ab70, 0x5abbf}, {0x5fb00, 0x5fb06}, + {0x5fb13, 0x5fb17}, {0x5ff41, 0x5ff5a}, {0x60061, 0x6007a}, {0x600df, 0x600f6}, + {0x600f8, 0x600ff}, {0x6017e, 0x60180}, {0x60199, 0x6019b}, {0x601bd, 0x601bf}, + {0x60233, 0x60239}, {0x6024f, 0x60293}, {0x60295, 0x602af}, {0x6037b, 0x6037d}, + {0x603ac, 0x603ce}, {0x603d5, 0x603d7}, {0x603ef, 0x603f3}, {0x60430, 0x6045f}, + {0x60561, 0x60587}, {0x613f8, 0x613fd}, {0x61c80, 0x61c88}, {0x61d00, 0x61d2b}, + {0x61d6b, 0x61d77}, {0x61d79, 0x61d9a}, {0x61e95, 0x61e9d}, {0x61eff, 0x61f07}, + {0x61f10, 0x61f15}, {0x61f20, 0x61f27}, {0x61f30, 0x61f37}, {0x61f40, 0x61f45}, + {0x61f50, 0x61f57}, {0x61f60, 0x61f67}, {0x61f70, 0x61f7d}, {0x61f80, 0x61f87}, + {0x61f90, 0x61f97}, {0x61fa0, 0x61fa7}, {0x61fb0, 0x61fb4}, {0x61fc2, 0x61fc4}, + {0x61fd0, 0x61fd3}, {0x61fe0, 0x61fe7}, {0x61ff2, 0x61ff4}, {0x62146, 0x62149}, + {0x62c30, 0x62c5e}, {0x62c76, 0x62c7b}, {0x62d00, 0x62d25}, {0x6a72f, 0x6a731}, + {0x6a771, 0x6a778}, {0x6a793, 0x6a795}, {0x6ab30, 0x6ab5a}, {0x6ab60, 0x6ab65}, + {0x6ab70, 0x6abbf}, {0x6fb00, 0x6fb06}, {0x6fb13, 0x6fb17}, {0x6ff41, 0x6ff5a}, + {0x70061, 0x7007a}, {0x700df, 0x700f6}, {0x700f8, 0x700ff}, {0x7017e, 0x70180}, + {0x70199, 0x7019b}, {0x701bd, 0x701bf}, {0x70233, 0x70239}, {0x7024f, 0x70293}, + {0x70295, 0x702af}, {0x7037b, 0x7037d}, {0x703ac, 0x703ce}, {0x703d5, 0x703d7}, + {0x703ef, 0x703f3}, {0x70430, 0x7045f}, {0x70561, 0x70587}, {0x713f8, 0x713fd}, + {0x71c80, 0x71c88}, {0x71d00, 0x71d2b}, {0x71d6b, 0x71d77}, {0x71d79, 0x71d9a}, + {0x71e95, 0x71e9d}, {0x71eff, 0x71f07}, {0x71f10, 0x71f15}, {0x71f20, 0x71f27}, + {0x71f30, 0x71f37}, {0x71f40, 0x71f45}, {0x71f50, 0x71f57}, {0x71f60, 0x71f67}, + {0x71f70, 0x71f7d}, {0x71f80, 0x71f87}, {0x71f90, 0x71f97}, {0x71fa0, 0x71fa7}, + {0x71fb0, 0x71fb4}, {0x71fc2, 0x71fc4}, {0x71fd0, 0x71fd3}, {0x71fe0, 0x71fe7}, + {0x71ff2, 0x71ff4}, {0x72146, 0x72149}, {0x72c30, 0x72c5e}, {0x72c76, 0x72c7b}, + {0x72d00, 0x72d25}, {0x7a72f, 0x7a731}, {0x7a771, 0x7a778}, {0x7a793, 0x7a795}, + {0x7ab30, 0x7ab5a}, {0x7ab60, 0x7ab65}, {0x7ab70, 0x7abbf}, {0x7fb00, 0x7fb06}, + {0x7fb13, 0x7fb17}, {0x7ff41, 0x7ff5a}, {0x80061, 0x8007a}, {0x800df, 0x800f6}, + {0x800f8, 0x800ff}, {0x8017e, 0x80180}, {0x80199, 0x8019b}, {0x801bd, 0x801bf}, + {0x80233, 0x80239}, {0x8024f, 0x80293}, {0x80295, 0x802af}, {0x8037b, 0x8037d}, + {0x803ac, 0x803ce}, {0x803d5, 0x803d7}, {0x803ef, 0x803f3}, {0x80430, 0x8045f}, + {0x80561, 0x80587}, {0x813f8, 0x813fd}, {0x81c80, 0x81c88}, {0x81d00, 0x81d2b}, + {0x81d6b, 0x81d77}, {0x81d79, 0x81d9a}, {0x81e95, 0x81e9d}, {0x81eff, 0x81f07}, + {0x81f10, 0x81f15}, {0x81f20, 0x81f27}, {0x81f30, 0x81f37}, {0x81f40, 0x81f45}, + {0x81f50, 0x81f57}, {0x81f60, 0x81f67}, {0x81f70, 0x81f7d}, {0x81f80, 0x81f87}, + {0x81f90, 0x81f97}, {0x81fa0, 0x81fa7}, {0x81fb0, 0x81fb4}, {0x81fc2, 0x81fc4}, + {0x81fd0, 0x81fd3}, {0x81fe0, 0x81fe7}, {0x81ff2, 0x81ff4}, {0x82146, 0x82149}, + {0x82c30, 0x82c5e}, {0x82c76, 0x82c7b}, {0x82d00, 0x82d25}, {0x8a72f, 0x8a731}, + {0x8a771, 0x8a778}, {0x8a793, 0x8a795}, {0x8ab30, 0x8ab5a}, {0x8ab60, 0x8ab65}, + {0x8ab70, 0x8abbf}, {0x8fb00, 0x8fb06}, {0x8fb13, 0x8fb17}, {0x8ff41, 0x8ff5a}, + {0x90061, 0x9007a}, {0x900df, 0x900f6}, {0x900f8, 0x900ff}, {0x9017e, 0x90180}, + {0x90199, 0x9019b}, {0x901bd, 0x901bf}, {0x90233, 0x90239}, {0x9024f, 0x90293}, + {0x90295, 0x902af}, {0x9037b, 0x9037d}, {0x903ac, 0x903ce}, {0x903d5, 0x903d7}, + {0x903ef, 0x903f3}, {0x90430, 0x9045f}, {0x90561, 0x90587}, {0x913f8, 0x913fd}, + {0x91c80, 0x91c88}, {0x91d00, 0x91d2b}, {0x91d6b, 0x91d77}, {0x91d79, 0x91d9a}, + {0x91e95, 0x91e9d}, {0x91eff, 0x91f07}, {0x91f10, 0x91f15}, {0x91f20, 0x91f27}, + {0x91f30, 0x91f37}, {0x91f40, 0x91f45}, {0x91f50, 0x91f57}, {0x91f60, 0x91f67}, + {0x91f70, 0x91f7d}, {0x91f80, 0x91f87}, {0x91f90, 0x91f97}, {0x91fa0, 0x91fa7}, + {0x91fb0, 0x91fb4}, {0x91fc2, 0x91fc4}, {0x91fd0, 0x91fd3}, {0x91fe0, 0x91fe7}, + {0x91ff2, 0x91ff4}, {0x92146, 0x92149}, {0x92c30, 0x92c5e}, {0x92c76, 0x92c7b}, + {0x92d00, 0x92d25}, {0x9a72f, 0x9a731}, {0x9a771, 0x9a778}, {0x9a793, 0x9a795}, + {0x9ab30, 0x9ab5a}, {0x9ab60, 0x9ab65}, {0x9ab70, 0x9abbf}, {0x9fb00, 0x9fb06}, + {0x9fb13, 0x9fb17}, {0x9ff41, 0x9ff5a}, {0xa0061, 0xa007a}, {0xa00df, 0xa00f6}, + {0xa00f8, 0xa00ff}, {0xa017e, 0xa0180}, {0xa0199, 0xa019b}, {0xa01bd, 0xa01bf}, + {0xa0233, 0xa0239}, {0xa024f, 0xa0293}, {0xa0295, 0xa02af}, {0xa037b, 0xa037d}, + {0xa03ac, 0xa03ce}, {0xa03d5, 0xa03d7}, {0xa03ef, 0xa03f3}, {0xa0430, 0xa045f}, + {0xa0561, 0xa0587}, {0xa13f8, 0xa13fd}, {0xa1c80, 0xa1c88}, {0xa1d00, 0xa1d2b}, + {0xa1d6b, 0xa1d77}, {0xa1d79, 0xa1d9a}, {0xa1e95, 0xa1e9d}, {0xa1eff, 0xa1f07}, + {0xa1f10, 0xa1f15}, {0xa1f20, 0xa1f27}, {0xa1f30, 0xa1f37}, {0xa1f40, 0xa1f45}, + {0xa1f50, 0xa1f57}, {0xa1f60, 0xa1f67}, {0xa1f70, 0xa1f7d}, {0xa1f80, 0xa1f87}, + {0xa1f90, 0xa1f97}, {0xa1fa0, 0xa1fa7}, {0xa1fb0, 0xa1fb4}, {0xa1fc2, 0xa1fc4}, + {0xa1fd0, 0xa1fd3}, {0xa1fe0, 0xa1fe7}, {0xa1ff2, 0xa1ff4}, {0xa2146, 0xa2149}, + {0xa2c30, 0xa2c5e}, {0xa2c76, 0xa2c7b}, {0xa2d00, 0xa2d25}, {0xaa72f, 0xaa731}, + {0xaa771, 0xaa778}, {0xaa793, 0xaa795}, {0xaab30, 0xaab5a}, {0xaab60, 0xaab65}, + {0xaab70, 0xaabbf}, {0xafb00, 0xafb06}, {0xafb13, 0xafb17}, {0xaff41, 0xaff5a}, + {0xb0061, 0xb007a}, {0xb00df, 0xb00f6}, {0xb00f8, 0xb00ff}, {0xb017e, 0xb0180}, + {0xb0199, 0xb019b}, {0xb01bd, 0xb01bf}, {0xb0233, 0xb0239}, {0xb024f, 0xb0293}, + {0xb0295, 0xb02af}, {0xb037b, 0xb037d}, {0xb03ac, 0xb03ce}, {0xb03d5, 0xb03d7}, + {0xb03ef, 0xb03f3}, {0xb0430, 0xb045f}, {0xb0561, 0xb0587}, {0xb13f8, 0xb13fd}, + {0xb1c80, 0xb1c88}, {0xb1d00, 0xb1d2b}, {0xb1d6b, 0xb1d77}, {0xb1d79, 0xb1d9a}, + {0xb1e95, 0xb1e9d}, {0xb1eff, 0xb1f07}, {0xb1f10, 0xb1f15}, {0xb1f20, 0xb1f27}, + {0xb1f30, 0xb1f37}, {0xb1f40, 0xb1f45}, {0xb1f50, 0xb1f57}, {0xb1f60, 0xb1f67}, + {0xb1f70, 0xb1f7d}, {0xb1f80, 0xb1f87}, {0xb1f90, 0xb1f97}, {0xb1fa0, 0xb1fa7}, + {0xb1fb0, 0xb1fb4}, {0xb1fc2, 0xb1fc4}, {0xb1fd0, 0xb1fd3}, {0xb1fe0, 0xb1fe7}, + {0xb1ff2, 0xb1ff4}, {0xb2146, 0xb2149}, {0xb2c30, 0xb2c5e}, {0xb2c76, 0xb2c7b}, + {0xb2d00, 0xb2d25}, {0xba72f, 0xba731}, {0xba771, 0xba778}, {0xba793, 0xba795}, + {0xbab30, 0xbab5a}, {0xbab60, 0xbab65}, {0xbab70, 0xbabbf}, {0xbfb00, 0xbfb06}, + {0xbfb13, 0xbfb17}, {0xbff41, 0xbff5a}, {0xc0061, 0xc007a}, {0xc00df, 0xc00f6}, + {0xc00f8, 0xc00ff}, {0xc017e, 0xc0180}, {0xc0199, 0xc019b}, {0xc01bd, 0xc01bf}, + {0xc0233, 0xc0239}, {0xc024f, 0xc0293}, {0xc0295, 0xc02af}, {0xc037b, 0xc037d}, + {0xc03ac, 0xc03ce}, {0xc03d5, 0xc03d7}, {0xc03ef, 0xc03f3}, {0xc0430, 0xc045f}, + {0xc0561, 0xc0587}, {0xc13f8, 0xc13fd}, {0xc1c80, 0xc1c88}, {0xc1d00, 0xc1d2b}, + {0xc1d6b, 0xc1d77}, {0xc1d79, 0xc1d9a}, {0xc1e95, 0xc1e9d}, {0xc1eff, 0xc1f07}, + {0xc1f10, 0xc1f15}, {0xc1f20, 0xc1f27}, {0xc1f30, 0xc1f37}, {0xc1f40, 0xc1f45}, + {0xc1f50, 0xc1f57}, {0xc1f60, 0xc1f67}, {0xc1f70, 0xc1f7d}, {0xc1f80, 0xc1f87}, + {0xc1f90, 0xc1f97}, {0xc1fa0, 0xc1fa7}, {0xc1fb0, 0xc1fb4}, {0xc1fc2, 0xc1fc4}, + {0xc1fd0, 0xc1fd3}, {0xc1fe0, 0xc1fe7}, {0xc1ff2, 0xc1ff4}, {0xc2146, 0xc2149}, + {0xc2c30, 0xc2c5e}, {0xc2c76, 0xc2c7b}, {0xc2d00, 0xc2d25}, {0xca72f, 0xca731}, + {0xca771, 0xca778}, {0xca793, 0xca795}, {0xcab30, 0xcab5a}, {0xcab60, 0xcab65}, + {0xcab70, 0xcabbf}, {0xcfb00, 0xcfb06}, {0xcfb13, 0xcfb17}, {0xcff41, 0xcff5a}, + {0xd0061, 0xd007a}, {0xd00df, 0xd00f6}, {0xd00f8, 0xd00ff}, {0xd017e, 0xd0180}, + {0xd0199, 0xd019b}, {0xd01bd, 0xd01bf}, {0xd0233, 0xd0239}, {0xd024f, 0xd0293}, + {0xd0295, 0xd02af}, {0xd037b, 0xd037d}, {0xd03ac, 0xd03ce}, {0xd03d5, 0xd03d7}, + {0xd03ef, 0xd03f3}, {0xd0430, 0xd045f}, {0xd0561, 0xd0587}, {0xd13f8, 0xd13fd}, + {0xd1c80, 0xd1c88}, {0xd1d00, 0xd1d2b}, {0xd1d6b, 0xd1d77}, {0xd1d79, 0xd1d9a}, + {0xd1e95, 0xd1e9d}, {0xd1eff, 0xd1f07}, {0xd1f10, 0xd1f15}, {0xd1f20, 0xd1f27}, + {0xd1f30, 0xd1f37}, {0xd1f40, 0xd1f45}, {0xd1f50, 0xd1f57}, {0xd1f60, 0xd1f67}, + {0xd1f70, 0xd1f7d}, {0xd1f80, 0xd1f87}, {0xd1f90, 0xd1f97}, {0xd1fa0, 0xd1fa7}, + {0xd1fb0, 0xd1fb4}, {0xd1fc2, 0xd1fc4}, {0xd1fd0, 0xd1fd3}, {0xd1fe0, 0xd1fe7}, + {0xd1ff2, 0xd1ff4}, {0xd2146, 0xd2149}, {0xd2c30, 0xd2c5e}, {0xd2c76, 0xd2c7b}, + {0xd2d00, 0xd2d25}, {0xda72f, 0xda731}, {0xda771, 0xda778}, {0xda793, 0xda795}, + {0xdab30, 0xdab5a}, {0xdab60, 0xdab65}, {0xdab70, 0xdabbf}, {0xdfb00, 0xdfb06}, + {0xdfb13, 0xdfb17}, {0xdff41, 0xdff5a}, {0xe0061, 0xe007a}, {0xe00df, 0xe00f6}, + {0xe00f8, 0xe00ff}, {0xe017e, 0xe0180}, {0xe0199, 0xe019b}, {0xe01bd, 0xe01bf}, + {0xe0233, 0xe0239}, {0xe024f, 0xe0293}, {0xe0295, 0xe02af}, {0xe037b, 0xe037d}, + {0xe03ac, 0xe03ce}, {0xe03d5, 0xe03d7}, {0xe03ef, 0xe03f3}, {0xe0430, 0xe045f}, + {0xe0561, 0xe0587}, {0xe13f8, 0xe13fd}, {0xe1c80, 0xe1c88}, {0xe1d00, 0xe1d2b}, + {0xe1d6b, 0xe1d77}, {0xe1d79, 0xe1d9a}, {0xe1e95, 0xe1e9d}, {0xe1eff, 0xe1f07}, + {0xe1f10, 0xe1f15}, {0xe1f20, 0xe1f27}, {0xe1f30, 0xe1f37}, {0xe1f40, 0xe1f45}, + {0xe1f50, 0xe1f57}, {0xe1f60, 0xe1f67}, {0xe1f70, 0xe1f7d}, {0xe1f80, 0xe1f87}, + {0xe1f90, 0xe1f97}, {0xe1fa0, 0xe1fa7}, {0xe1fb0, 0xe1fb4}, {0xe1fc2, 0xe1fc4}, + {0xe1fd0, 0xe1fd3}, {0xe1fe0, 0xe1fe7}, {0xe1ff2, 0xe1ff4}, {0xe2146, 0xe2149}, + {0xe2c30, 0xe2c5e}, {0xe2c76, 0xe2c7b}, {0xe2d00, 0xe2d25}, {0xea72f, 0xea731}, + {0xea771, 0xea778}, {0xea793, 0xea795}, {0xeab30, 0xeab5a}, {0xeab60, 0xeab65}, + {0xeab70, 0xeabbf}, {0xefb00, 0xefb06}, {0xefb13, 0xefb17}, {0xeff41, 0xeff5a}, + {0xf0061, 0xf007a}, {0xf00df, 0xf00f6}, {0xf00f8, 0xf00ff}, {0xf017e, 0xf0180}, + {0xf0199, 0xf019b}, {0xf01bd, 0xf01bf}, {0xf0233, 0xf0239}, {0xf024f, 0xf0293}, + {0xf0295, 0xf02af}, {0xf037b, 0xf037d}, {0xf03ac, 0xf03ce}, {0xf03d5, 0xf03d7}, + {0xf03ef, 0xf03f3}, {0xf0430, 0xf045f}, {0xf0561, 0xf0587}, {0xf13f8, 0xf13fd}, + {0xf1c80, 0xf1c88}, {0xf1d00, 0xf1d2b}, {0xf1d6b, 0xf1d77}, {0xf1d79, 0xf1d9a}, + {0xf1e95, 0xf1e9d}, {0xf1eff, 0xf1f07}, {0xf1f10, 0xf1f15}, {0xf1f20, 0xf1f27}, + {0xf1f30, 0xf1f37}, {0xf1f40, 0xf1f45}, {0xf1f50, 0xf1f57}, {0xf1f60, 0xf1f67}, + {0xf1f70, 0xf1f7d}, {0xf1f80, 0xf1f87}, {0xf1f90, 0xf1f97}, {0xf1fa0, 0xf1fa7}, + {0xf1fb0, 0xf1fb4}, {0xf1fc2, 0xf1fc4}, {0xf1fd0, 0xf1fd3}, {0xf1fe0, 0xf1fe7}, + {0xf1ff2, 0xf1ff4}, {0xf2146, 0xf2149}, {0xf2c30, 0xf2c5e}, {0xf2c76, 0xf2c7b}, + {0xf2d00, 0xf2d25}, {0xfa72f, 0xfa731}, {0xfa771, 0xfa778}, {0xfa793, 0xfa795}, + {0xfab30, 0xfab5a}, {0xfab60, 0xfab65}, {0xfab70, 0xfabbf}, {0xffb00, 0xffb06}, + {0xffb13, 0xffb17}, {0xfff41, 0xfff5a}, {0x100061, 0x10007a}, {0x1000df, 0x1000f6}, + {0x1000f8, 0x1000ff}, {0x10017e, 0x100180}, {0x100199, 0x10019b}, {0x1001bd, 0x1001bf}, + {0x100233, 0x100239}, {0x10024f, 0x100293}, {0x100295, 0x1002af}, {0x10037b, 0x10037d}, + {0x1003ac, 0x1003ce}, {0x1003d5, 0x1003d7}, {0x1003ef, 0x1003f3}, {0x100430, 0x10045f}, + {0x100561, 0x100587}, {0x1013f8, 0x1013fd}, {0x101c80, 0x101c88}, {0x101d00, 0x101d2b}, + {0x101d6b, 0x101d77}, {0x101d79, 0x101d9a}, {0x101e95, 0x101e9d}, {0x101eff, 0x101f07}, + {0x101f10, 0x101f15}, {0x101f20, 0x101f27}, {0x101f30, 0x101f37}, {0x101f40, 0x101f45}, + {0x101f50, 0x101f57}, {0x101f60, 0x101f67}, {0x101f70, 0x101f7d}, {0x101f80, 0x101f87}, + {0x101f90, 0x101f97}, {0x101fa0, 0x101fa7}, {0x101fb0, 0x101fb4}, {0x101fc2, 0x101fc4}, + {0x101fd0, 0x101fd3}, {0x101fe0, 0x101fe7}, {0x101ff2, 0x101ff4}, {0x102146, 0x102149}, + {0x102c30, 0x102c5e}, {0x102c76, 0x102c7b}, {0x102d00, 0x102d25}, {0x10a72f, 0x10a731}, + {0x10a771, 0x10a778}, {0x10a793, 0x10a795}, {0x10ab30, 0x10ab5a}, {0x10ab60, 0x10ab65}, + {0x10ab70, 0x10abbf}, {0x10fb00, 0x10fb06}, {0x10fb13, 0x10fb17}, {0x10ff41, 0x10ff5a} #endif }; @@ -499,7 +2591,1020 @@ static const chr lowerCharTable[] = { 0xa799, 0xa79b, 0xa79d, 0xa79f, 0xa7a1, 0xa7a3, 0xa7a5, 0xa7a7, 0xa7a9, 0xa7b5, 0xa7b7, 0xa7fa #if TCL_UTF_MAX > 4 - ,0x1d4bb, 0x1d7cb + ,0x100b5, 0x10101, 0x10103, 0x10105, 0x10107, 0x10109, 0x1010b, 0x1010d, 0x1010f, + 0x10111, 0x10113, 0x10115, 0x10117, 0x10119, 0x1011b, 0x1011d, 0x1011f, 0x10121, + 0x10123, 0x10125, 0x10127, 0x10129, 0x1012b, 0x1012d, 0x1012f, 0x10131, 0x10133, + 0x10135, 0x10137, 0x10138, 0x1013a, 0x1013c, 0x1013e, 0x10140, 0x10142, 0x10144, + 0x10146, 0x10148, 0x10149, 0x1014b, 0x1014d, 0x1014f, 0x10151, 0x10153, 0x10155, + 0x10157, 0x10159, 0x1015b, 0x1015d, 0x1015f, 0x10161, 0x10163, 0x10165, 0x10167, + 0x10169, 0x1016b, 0x1016d, 0x1016f, 0x10171, 0x10173, 0x10175, 0x10177, 0x1017a, + 0x1017c, 0x10183, 0x10185, 0x10188, 0x1018c, 0x1018d, 0x10192, 0x10195, 0x1019e, + 0x101a1, 0x101a3, 0x101a5, 0x101a8, 0x101aa, 0x101ab, 0x101ad, 0x101b0, 0x101b4, + 0x101b6, 0x101b9, 0x101ba, 0x101c6, 0x101c9, 0x101cc, 0x101ce, 0x101d0, 0x101d2, + 0x101d4, 0x101d6, 0x101d8, 0x101da, 0x101dc, 0x101dd, 0x101df, 0x101e1, 0x101e3, + 0x101e5, 0x101e7, 0x101e9, 0x101eb, 0x101ed, 0x101ef, 0x101f0, 0x101f3, 0x101f5, + 0x101f9, 0x101fb, 0x101fd, 0x101ff, 0x10201, 0x10203, 0x10205, 0x10207, 0x10209, + 0x1020b, 0x1020d, 0x1020f, 0x10211, 0x10213, 0x10215, 0x10217, 0x10219, 0x1021b, + 0x1021d, 0x1021f, 0x10221, 0x10223, 0x10225, 0x10227, 0x10229, 0x1022b, 0x1022d, + 0x1022f, 0x10231, 0x1023c, 0x1023f, 0x10240, 0x10242, 0x10247, 0x10249, 0x1024b, + 0x1024d, 0x10371, 0x10373, 0x10377, 0x10390, 0x103d0, 0x103d1, 0x103d9, 0x103db, + 0x103dd, 0x103df, 0x103e1, 0x103e3, 0x103e5, 0x103e7, 0x103e9, 0x103eb, 0x103ed, + 0x103f5, 0x103f8, 0x103fb, 0x103fc, 0x10461, 0x10463, 0x10465, 0x10467, 0x10469, + 0x1046b, 0x1046d, 0x1046f, 0x10471, 0x10473, 0x10475, 0x10477, 0x10479, 0x1047b, + 0x1047d, 0x1047f, 0x10481, 0x1048b, 0x1048d, 0x1048f, 0x10491, 0x10493, 0x10495, + 0x10497, 0x10499, 0x1049b, 0x1049d, 0x1049f, 0x104a1, 0x104a3, 0x104a5, 0x104a7, + 0x104a9, 0x104ab, 0x104ad, 0x104af, 0x104b1, 0x104b3, 0x104b5, 0x104b7, 0x104b9, + 0x104bb, 0x104bd, 0x104bf, 0x104c2, 0x104c4, 0x104c6, 0x104c8, 0x104ca, 0x104cc, + 0x104ce, 0x104cf, 0x104d1, 0x104d3, 0x104d5, 0x104d7, 0x104d9, 0x104db, 0x104dd, + 0x104df, 0x104e1, 0x104e3, 0x104e5, 0x104e7, 0x104e9, 0x104eb, 0x104ed, 0x104ef, + 0x104f1, 0x104f3, 0x104f5, 0x104f7, 0x104f9, 0x104fb, 0x104fd, 0x104ff, 0x10501, + 0x10503, 0x10505, 0x10507, 0x10509, 0x1050b, 0x1050d, 0x1050f, 0x10511, 0x10513, + 0x10515, 0x10517, 0x10519, 0x1051b, 0x1051d, 0x1051f, 0x10521, 0x10523, 0x10525, + 0x10527, 0x10529, 0x1052b, 0x1052d, 0x1052f, 0x11e01, 0x11e03, 0x11e05, 0x11e07, + 0x11e09, 0x11e0b, 0x11e0d, 0x11e0f, 0x11e11, 0x11e13, 0x11e15, 0x11e17, 0x11e19, + 0x11e1b, 0x11e1d, 0x11e1f, 0x11e21, 0x11e23, 0x11e25, 0x11e27, 0x11e29, 0x11e2b, + 0x11e2d, 0x11e2f, 0x11e31, 0x11e33, 0x11e35, 0x11e37, 0x11e39, 0x11e3b, 0x11e3d, + 0x11e3f, 0x11e41, 0x11e43, 0x11e45, 0x11e47, 0x11e49, 0x11e4b, 0x11e4d, 0x11e4f, + 0x11e51, 0x11e53, 0x11e55, 0x11e57, 0x11e59, 0x11e5b, 0x11e5d, 0x11e5f, 0x11e61, + 0x11e63, 0x11e65, 0x11e67, 0x11e69, 0x11e6b, 0x11e6d, 0x11e6f, 0x11e71, 0x11e73, + 0x11e75, 0x11e77, 0x11e79, 0x11e7b, 0x11e7d, 0x11e7f, 0x11e81, 0x11e83, 0x11e85, + 0x11e87, 0x11e89, 0x11e8b, 0x11e8d, 0x11e8f, 0x11e91, 0x11e93, 0x11e9f, 0x11ea1, + 0x11ea3, 0x11ea5, 0x11ea7, 0x11ea9, 0x11eab, 0x11ead, 0x11eaf, 0x11eb1, 0x11eb3, + 0x11eb5, 0x11eb7, 0x11eb9, 0x11ebb, 0x11ebd, 0x11ebf, 0x11ec1, 0x11ec3, 0x11ec5, + 0x11ec7, 0x11ec9, 0x11ecb, 0x11ecd, 0x11ecf, 0x11ed1, 0x11ed3, 0x11ed5, 0x11ed7, + 0x11ed9, 0x11edb, 0x11edd, 0x11edf, 0x11ee1, 0x11ee3, 0x11ee5, 0x11ee7, 0x11ee9, + 0x11eeb, 0x11eed, 0x11eef, 0x11ef1, 0x11ef3, 0x11ef5, 0x11ef7, 0x11ef9, 0x11efb, + 0x11efd, 0x11fb6, 0x11fb7, 0x11fbe, 0x11fc6, 0x11fc7, 0x11fd6, 0x11fd7, 0x11ff6, + 0x11ff7, 0x1210a, 0x1210e, 0x1210f, 0x12113, 0x1212f, 0x12134, 0x12139, 0x1213c, + 0x1213d, 0x1214e, 0x12184, 0x12c61, 0x12c65, 0x12c66, 0x12c68, 0x12c6a, 0x12c6c, + 0x12c71, 0x12c73, 0x12c74, 0x12c81, 0x12c83, 0x12c85, 0x12c87, 0x12c89, 0x12c8b, + 0x12c8d, 0x12c8f, 0x12c91, 0x12c93, 0x12c95, 0x12c97, 0x12c99, 0x12c9b, 0x12c9d, + 0x12c9f, 0x12ca1, 0x12ca3, 0x12ca5, 0x12ca7, 0x12ca9, 0x12cab, 0x12cad, 0x12caf, + 0x12cb1, 0x12cb3, 0x12cb5, 0x12cb7, 0x12cb9, 0x12cbb, 0x12cbd, 0x12cbf, 0x12cc1, + 0x12cc3, 0x12cc5, 0x12cc7, 0x12cc9, 0x12ccb, 0x12ccd, 0x12ccf, 0x12cd1, 0x12cd3, + 0x12cd5, 0x12cd7, 0x12cd9, 0x12cdb, 0x12cdd, 0x12cdf, 0x12ce1, 0x12ce3, 0x12ce4, + 0x12cec, 0x12cee, 0x12cf3, 0x12d27, 0x12d2d, 0x1a641, 0x1a643, 0x1a645, 0x1a647, + 0x1a649, 0x1a64b, 0x1a64d, 0x1a64f, 0x1a651, 0x1a653, 0x1a655, 0x1a657, 0x1a659, + 0x1a65b, 0x1a65d, 0x1a65f, 0x1a661, 0x1a663, 0x1a665, 0x1a667, 0x1a669, 0x1a66b, + 0x1a66d, 0x1a681, 0x1a683, 0x1a685, 0x1a687, 0x1a689, 0x1a68b, 0x1a68d, 0x1a68f, + 0x1a691, 0x1a693, 0x1a695, 0x1a697, 0x1a699, 0x1a69b, 0x1a723, 0x1a725, 0x1a727, + 0x1a729, 0x1a72b, 0x1a72d, 0x1a733, 0x1a735, 0x1a737, 0x1a739, 0x1a73b, 0x1a73d, + 0x1a73f, 0x1a741, 0x1a743, 0x1a745, 0x1a747, 0x1a749, 0x1a74b, 0x1a74d, 0x1a74f, + 0x1a751, 0x1a753, 0x1a755, 0x1a757, 0x1a759, 0x1a75b, 0x1a75d, 0x1a75f, 0x1a761, + 0x1a763, 0x1a765, 0x1a767, 0x1a769, 0x1a76b, 0x1a76d, 0x1a76f, 0x1a77a, 0x1a77c, + 0x1a77f, 0x1a781, 0x1a783, 0x1a785, 0x1a787, 0x1a78c, 0x1a78e, 0x1a791, 0x1a797, + 0x1a799, 0x1a79b, 0x1a79d, 0x1a79f, 0x1a7a1, 0x1a7a3, 0x1a7a5, 0x1a7a7, 0x1a7a9, + 0x1a7b5, 0x1a7b7, 0x1a7fa, 0x200b5, 0x20101, 0x20103, 0x20105, 0x20107, 0x20109, + 0x2010b, 0x2010d, 0x2010f, 0x20111, 0x20113, 0x20115, 0x20117, 0x20119, 0x2011b, + 0x2011d, 0x2011f, 0x20121, 0x20123, 0x20125, 0x20127, 0x20129, 0x2012b, 0x2012d, + 0x2012f, 0x20131, 0x20133, 0x20135, 0x20137, 0x20138, 0x2013a, 0x2013c, 0x2013e, + 0x20140, 0x20142, 0x20144, 0x20146, 0x20148, 0x20149, 0x2014b, 0x2014d, 0x2014f, + 0x20151, 0x20153, 0x20155, 0x20157, 0x20159, 0x2015b, 0x2015d, 0x2015f, 0x20161, + 0x20163, 0x20165, 0x20167, 0x20169, 0x2016b, 0x2016d, 0x2016f, 0x20171, 0x20173, + 0x20175, 0x20177, 0x2017a, 0x2017c, 0x20183, 0x20185, 0x20188, 0x2018c, 0x2018d, + 0x20192, 0x20195, 0x2019e, 0x201a1, 0x201a3, 0x201a5, 0x201a8, 0x201aa, 0x201ab, + 0x201ad, 0x201b0, 0x201b4, 0x201b6, 0x201b9, 0x201ba, 0x201c6, 0x201c9, 0x201cc, + 0x201ce, 0x201d0, 0x201d2, 0x201d4, 0x201d6, 0x201d8, 0x201da, 0x201dc, 0x201dd, + 0x201df, 0x201e1, 0x201e3, 0x201e5, 0x201e7, 0x201e9, 0x201eb, 0x201ed, 0x201ef, + 0x201f0, 0x201f3, 0x201f5, 0x201f9, 0x201fb, 0x201fd, 0x201ff, 0x20201, 0x20203, + 0x20205, 0x20207, 0x20209, 0x2020b, 0x2020d, 0x2020f, 0x20211, 0x20213, 0x20215, + 0x20217, 0x20219, 0x2021b, 0x2021d, 0x2021f, 0x20221, 0x20223, 0x20225, 0x20227, + 0x20229, 0x2022b, 0x2022d, 0x2022f, 0x20231, 0x2023c, 0x2023f, 0x20240, 0x20242, + 0x20247, 0x20249, 0x2024b, 0x2024d, 0x20371, 0x20373, 0x20377, 0x20390, 0x203d0, + 0x203d1, 0x203d9, 0x203db, 0x203dd, 0x203df, 0x203e1, 0x203e3, 0x203e5, 0x203e7, + 0x203e9, 0x203eb, 0x203ed, 0x203f5, 0x203f8, 0x203fb, 0x203fc, 0x20461, 0x20463, + 0x20465, 0x20467, 0x20469, 0x2046b, 0x2046d, 0x2046f, 0x20471, 0x20473, 0x20475, + 0x20477, 0x20479, 0x2047b, 0x2047d, 0x2047f, 0x20481, 0x2048b, 0x2048d, 0x2048f, + 0x20491, 0x20493, 0x20495, 0x20497, 0x20499, 0x2049b, 0x2049d, 0x2049f, 0x204a1, + 0x204a3, 0x204a5, 0x204a7, 0x204a9, 0x204ab, 0x204ad, 0x204af, 0x204b1, 0x204b3, + 0x204b5, 0x204b7, 0x204b9, 0x204bb, 0x204bd, 0x204bf, 0x204c2, 0x204c4, 0x204c6, + 0x204c8, 0x204ca, 0x204cc, 0x204ce, 0x204cf, 0x204d1, 0x204d3, 0x204d5, 0x204d7, + 0x204d9, 0x204db, 0x204dd, 0x204df, 0x204e1, 0x204e3, 0x204e5, 0x204e7, 0x204e9, + 0x204eb, 0x204ed, 0x204ef, 0x204f1, 0x204f3, 0x204f5, 0x204f7, 0x204f9, 0x204fb, + 0x204fd, 0x204ff, 0x20501, 0x20503, 0x20505, 0x20507, 0x20509, 0x2050b, 0x2050d, + 0x2050f, 0x20511, 0x20513, 0x20515, 0x20517, 0x20519, 0x2051b, 0x2051d, 0x2051f, + 0x20521, 0x20523, 0x20525, 0x20527, 0x20529, 0x2052b, 0x2052d, 0x2052f, 0x21e01, + 0x21e03, 0x21e05, 0x21e07, 0x21e09, 0x21e0b, 0x21e0d, 0x21e0f, 0x21e11, 0x21e13, + 0x21e15, 0x21e17, 0x21e19, 0x21e1b, 0x21e1d, 0x21e1f, 0x21e21, 0x21e23, 0x21e25, + 0x21e27, 0x21e29, 0x21e2b, 0x21e2d, 0x21e2f, 0x21e31, 0x21e33, 0x21e35, 0x21e37, + 0x21e39, 0x21e3b, 0x21e3d, 0x21e3f, 0x21e41, 0x21e43, 0x21e45, 0x21e47, 0x21e49, + 0x21e4b, 0x21e4d, 0x21e4f, 0x21e51, 0x21e53, 0x21e55, 0x21e57, 0x21e59, 0x21e5b, + 0x21e5d, 0x21e5f, 0x21e61, 0x21e63, 0x21e65, 0x21e67, 0x21e69, 0x21e6b, 0x21e6d, + 0x21e6f, 0x21e71, 0x21e73, 0x21e75, 0x21e77, 0x21e79, 0x21e7b, 0x21e7d, 0x21e7f, + 0x21e81, 0x21e83, 0x21e85, 0x21e87, 0x21e89, 0x21e8b, 0x21e8d, 0x21e8f, 0x21e91, + 0x21e93, 0x21e9f, 0x21ea1, 0x21ea3, 0x21ea5, 0x21ea7, 0x21ea9, 0x21eab, 0x21ead, + 0x21eaf, 0x21eb1, 0x21eb3, 0x21eb5, 0x21eb7, 0x21eb9, 0x21ebb, 0x21ebd, 0x21ebf, + 0x21ec1, 0x21ec3, 0x21ec5, 0x21ec7, 0x21ec9, 0x21ecb, 0x21ecd, 0x21ecf, 0x21ed1, + 0x21ed3, 0x21ed5, 0x21ed7, 0x21ed9, 0x21edb, 0x21edd, 0x21edf, 0x21ee1, 0x21ee3, + 0x21ee5, 0x21ee7, 0x21ee9, 0x21eeb, 0x21eed, 0x21eef, 0x21ef1, 0x21ef3, 0x21ef5, + 0x21ef7, 0x21ef9, 0x21efb, 0x21efd, 0x21fb6, 0x21fb7, 0x21fbe, 0x21fc6, 0x21fc7, + 0x21fd6, 0x21fd7, 0x21ff6, 0x21ff7, 0x2210a, 0x2210e, 0x2210f, 0x22113, 0x2212f, + 0x22134, 0x22139, 0x2213c, 0x2213d, 0x2214e, 0x22184, 0x22c61, 0x22c65, 0x22c66, + 0x22c68, 0x22c6a, 0x22c6c, 0x22c71, 0x22c73, 0x22c74, 0x22c81, 0x22c83, 0x22c85, + 0x22c87, 0x22c89, 0x22c8b, 0x22c8d, 0x22c8f, 0x22c91, 0x22c93, 0x22c95, 0x22c97, + 0x22c99, 0x22c9b, 0x22c9d, 0x22c9f, 0x22ca1, 0x22ca3, 0x22ca5, 0x22ca7, 0x22ca9, + 0x22cab, 0x22cad, 0x22caf, 0x22cb1, 0x22cb3, 0x22cb5, 0x22cb7, 0x22cb9, 0x22cbb, + 0x22cbd, 0x22cbf, 0x22cc1, 0x22cc3, 0x22cc5, 0x22cc7, 0x22cc9, 0x22ccb, 0x22ccd, + 0x22ccf, 0x22cd1, 0x22cd3, 0x22cd5, 0x22cd7, 0x22cd9, 0x22cdb, 0x22cdd, 0x22cdf, + 0x22ce1, 0x22ce3, 0x22ce4, 0x22cec, 0x22cee, 0x22cf3, 0x22d27, 0x22d2d, 0x2a641, + 0x2a643, 0x2a645, 0x2a647, 0x2a649, 0x2a64b, 0x2a64d, 0x2a64f, 0x2a651, 0x2a653, + 0x2a655, 0x2a657, 0x2a659, 0x2a65b, 0x2a65d, 0x2a65f, 0x2a661, 0x2a663, 0x2a665, + 0x2a667, 0x2a669, 0x2a66b, 0x2a66d, 0x2a681, 0x2a683, 0x2a685, 0x2a687, 0x2a689, + 0x2a68b, 0x2a68d, 0x2a68f, 0x2a691, 0x2a693, 0x2a695, 0x2a697, 0x2a699, 0x2a69b, + 0x2a723, 0x2a725, 0x2a727, 0x2a729, 0x2a72b, 0x2a72d, 0x2a733, 0x2a735, 0x2a737, + 0x2a739, 0x2a73b, 0x2a73d, 0x2a73f, 0x2a741, 0x2a743, 0x2a745, 0x2a747, 0x2a749, + 0x2a74b, 0x2a74d, 0x2a74f, 0x2a751, 0x2a753, 0x2a755, 0x2a757, 0x2a759, 0x2a75b, + 0x2a75d, 0x2a75f, 0x2a761, 0x2a763, 0x2a765, 0x2a767, 0x2a769, 0x2a76b, 0x2a76d, + 0x2a76f, 0x2a77a, 0x2a77c, 0x2a77f, 0x2a781, 0x2a783, 0x2a785, 0x2a787, 0x2a78c, + 0x2a78e, 0x2a791, 0x2a797, 0x2a799, 0x2a79b, 0x2a79d, 0x2a79f, 0x2a7a1, 0x2a7a3, + 0x2a7a5, 0x2a7a7, 0x2a7a9, 0x2a7b5, 0x2a7b7, 0x2a7fa, 0x300b5, 0x30101, 0x30103, + 0x30105, 0x30107, 0x30109, 0x3010b, 0x3010d, 0x3010f, 0x30111, 0x30113, 0x30115, + 0x30117, 0x30119, 0x3011b, 0x3011d, 0x3011f, 0x30121, 0x30123, 0x30125, 0x30127, + 0x30129, 0x3012b, 0x3012d, 0x3012f, 0x30131, 0x30133, 0x30135, 0x30137, 0x30138, + 0x3013a, 0x3013c, 0x3013e, 0x30140, 0x30142, 0x30144, 0x30146, 0x30148, 0x30149, + 0x3014b, 0x3014d, 0x3014f, 0x30151, 0x30153, 0x30155, 0x30157, 0x30159, 0x3015b, + 0x3015d, 0x3015f, 0x30161, 0x30163, 0x30165, 0x30167, 0x30169, 0x3016b, 0x3016d, + 0x3016f, 0x30171, 0x30173, 0x30175, 0x30177, 0x3017a, 0x3017c, 0x30183, 0x30185, + 0x30188, 0x3018c, 0x3018d, 0x30192, 0x30195, 0x3019e, 0x301a1, 0x301a3, 0x301a5, + 0x301a8, 0x301aa, 0x301ab, 0x301ad, 0x301b0, 0x301b4, 0x301b6, 0x301b9, 0x301ba, + 0x301c6, 0x301c9, 0x301cc, 0x301ce, 0x301d0, 0x301d2, 0x301d4, 0x301d6, 0x301d8, + 0x301da, 0x301dc, 0x301dd, 0x301df, 0x301e1, 0x301e3, 0x301e5, 0x301e7, 0x301e9, + 0x301eb, 0x301ed, 0x301ef, 0x301f0, 0x301f3, 0x301f5, 0x301f9, 0x301fb, 0x301fd, + 0x301ff, 0x30201, 0x30203, 0x30205, 0x30207, 0x30209, 0x3020b, 0x3020d, 0x3020f, + 0x30211, 0x30213, 0x30215, 0x30217, 0x30219, 0x3021b, 0x3021d, 0x3021f, 0x30221, + 0x30223, 0x30225, 0x30227, 0x30229, 0x3022b, 0x3022d, 0x3022f, 0x30231, 0x3023c, + 0x3023f, 0x30240, 0x30242, 0x30247, 0x30249, 0x3024b, 0x3024d, 0x30371, 0x30373, + 0x30377, 0x30390, 0x303d0, 0x303d1, 0x303d9, 0x303db, 0x303dd, 0x303df, 0x303e1, + 0x303e3, 0x303e5, 0x303e7, 0x303e9, 0x303eb, 0x303ed, 0x303f5, 0x303f8, 0x303fb, + 0x303fc, 0x30461, 0x30463, 0x30465, 0x30467, 0x30469, 0x3046b, 0x3046d, 0x3046f, + 0x30471, 0x30473, 0x30475, 0x30477, 0x30479, 0x3047b, 0x3047d, 0x3047f, 0x30481, + 0x3048b, 0x3048d, 0x3048f, 0x30491, 0x30493, 0x30495, 0x30497, 0x30499, 0x3049b, + 0x3049d, 0x3049f, 0x304a1, 0x304a3, 0x304a5, 0x304a7, 0x304a9, 0x304ab, 0x304ad, + 0x304af, 0x304b1, 0x304b3, 0x304b5, 0x304b7, 0x304b9, 0x304bb, 0x304bd, 0x304bf, + 0x304c2, 0x304c4, 0x304c6, 0x304c8, 0x304ca, 0x304cc, 0x304ce, 0x304cf, 0x304d1, + 0x304d3, 0x304d5, 0x304d7, 0x304d9, 0x304db, 0x304dd, 0x304df, 0x304e1, 0x304e3, + 0x304e5, 0x304e7, 0x304e9, 0x304eb, 0x304ed, 0x304ef, 0x304f1, 0x304f3, 0x304f5, + 0x304f7, 0x304f9, 0x304fb, 0x304fd, 0x304ff, 0x30501, 0x30503, 0x30505, 0x30507, + 0x30509, 0x3050b, 0x3050d, 0x3050f, 0x30511, 0x30513, 0x30515, 0x30517, 0x30519, + 0x3051b, 0x3051d, 0x3051f, 0x30521, 0x30523, 0x30525, 0x30527, 0x30529, 0x3052b, + 0x3052d, 0x3052f, 0x31e01, 0x31e03, 0x31e05, 0x31e07, 0x31e09, 0x31e0b, 0x31e0d, + 0x31e0f, 0x31e11, 0x31e13, 0x31e15, 0x31e17, 0x31e19, 0x31e1b, 0x31e1d, 0x31e1f, + 0x31e21, 0x31e23, 0x31e25, 0x31e27, 0x31e29, 0x31e2b, 0x31e2d, 0x31e2f, 0x31e31, + 0x31e33, 0x31e35, 0x31e37, 0x31e39, 0x31e3b, 0x31e3d, 0x31e3f, 0x31e41, 0x31e43, + 0x31e45, 0x31e47, 0x31e49, 0x31e4b, 0x31e4d, 0x31e4f, 0x31e51, 0x31e53, 0x31e55, + 0x31e57, 0x31e59, 0x31e5b, 0x31e5d, 0x31e5f, 0x31e61, 0x31e63, 0x31e65, 0x31e67, + 0x31e69, 0x31e6b, 0x31e6d, 0x31e6f, 0x31e71, 0x31e73, 0x31e75, 0x31e77, 0x31e79, + 0x31e7b, 0x31e7d, 0x31e7f, 0x31e81, 0x31e83, 0x31e85, 0x31e87, 0x31e89, 0x31e8b, + 0x31e8d, 0x31e8f, 0x31e91, 0x31e93, 0x31e9f, 0x31ea1, 0x31ea3, 0x31ea5, 0x31ea7, + 0x31ea9, 0x31eab, 0x31ead, 0x31eaf, 0x31eb1, 0x31eb3, 0x31eb5, 0x31eb7, 0x31eb9, + 0x31ebb, 0x31ebd, 0x31ebf, 0x31ec1, 0x31ec3, 0x31ec5, 0x31ec7, 0x31ec9, 0x31ecb, + 0x31ecd, 0x31ecf, 0x31ed1, 0x31ed3, 0x31ed5, 0x31ed7, 0x31ed9, 0x31edb, 0x31edd, + 0x31edf, 0x31ee1, 0x31ee3, 0x31ee5, 0x31ee7, 0x31ee9, 0x31eeb, 0x31eed, 0x31eef, + 0x31ef1, 0x31ef3, 0x31ef5, 0x31ef7, 0x31ef9, 0x31efb, 0x31efd, 0x31fb6, 0x31fb7, + 0x31fbe, 0x31fc6, 0x31fc7, 0x31fd6, 0x31fd7, 0x31ff6, 0x31ff7, 0x3210a, 0x3210e, + 0x3210f, 0x32113, 0x3212f, 0x32134, 0x32139, 0x3213c, 0x3213d, 0x3214e, 0x32184, + 0x32c61, 0x32c65, 0x32c66, 0x32c68, 0x32c6a, 0x32c6c, 0x32c71, 0x32c73, 0x32c74, + 0x32c81, 0x32c83, 0x32c85, 0x32c87, 0x32c89, 0x32c8b, 0x32c8d, 0x32c8f, 0x32c91, + 0x32c93, 0x32c95, 0x32c97, 0x32c99, 0x32c9b, 0x32c9d, 0x32c9f, 0x32ca1, 0x32ca3, + 0x32ca5, 0x32ca7, 0x32ca9, 0x32cab, 0x32cad, 0x32caf, 0x32cb1, 0x32cb3, 0x32cb5, + 0x32cb7, 0x32cb9, 0x32cbb, 0x32cbd, 0x32cbf, 0x32cc1, 0x32cc3, 0x32cc5, 0x32cc7, + 0x32cc9, 0x32ccb, 0x32ccd, 0x32ccf, 0x32cd1, 0x32cd3, 0x32cd5, 0x32cd7, 0x32cd9, + 0x32cdb, 0x32cdd, 0x32cdf, 0x32ce1, 0x32ce3, 0x32ce4, 0x32cec, 0x32cee, 0x32cf3, + 0x32d27, 0x32d2d, 0x3a641, 0x3a643, 0x3a645, 0x3a647, 0x3a649, 0x3a64b, 0x3a64d, + 0x3a64f, 0x3a651, 0x3a653, 0x3a655, 0x3a657, 0x3a659, 0x3a65b, 0x3a65d, 0x3a65f, + 0x3a661, 0x3a663, 0x3a665, 0x3a667, 0x3a669, 0x3a66b, 0x3a66d, 0x3a681, 0x3a683, + 0x3a685, 0x3a687, 0x3a689, 0x3a68b, 0x3a68d, 0x3a68f, 0x3a691, 0x3a693, 0x3a695, + 0x3a697, 0x3a699, 0x3a69b, 0x3a723, 0x3a725, 0x3a727, 0x3a729, 0x3a72b, 0x3a72d, + 0x3a733, 0x3a735, 0x3a737, 0x3a739, 0x3a73b, 0x3a73d, 0x3a73f, 0x3a741, 0x3a743, + 0x3a745, 0x3a747, 0x3a749, 0x3a74b, 0x3a74d, 0x3a74f, 0x3a751, 0x3a753, 0x3a755, + 0x3a757, 0x3a759, 0x3a75b, 0x3a75d, 0x3a75f, 0x3a761, 0x3a763, 0x3a765, 0x3a767, + 0x3a769, 0x3a76b, 0x3a76d, 0x3a76f, 0x3a77a, 0x3a77c, 0x3a77f, 0x3a781, 0x3a783, + 0x3a785, 0x3a787, 0x3a78c, 0x3a78e, 0x3a791, 0x3a797, 0x3a799, 0x3a79b, 0x3a79d, + 0x3a79f, 0x3a7a1, 0x3a7a3, 0x3a7a5, 0x3a7a7, 0x3a7a9, 0x3a7b5, 0x3a7b7, 0x3a7fa, + 0x400b5, 0x40101, 0x40103, 0x40105, 0x40107, 0x40109, 0x4010b, 0x4010d, 0x4010f, + 0x40111, 0x40113, 0x40115, 0x40117, 0x40119, 0x4011b, 0x4011d, 0x4011f, 0x40121, + 0x40123, 0x40125, 0x40127, 0x40129, 0x4012b, 0x4012d, 0x4012f, 0x40131, 0x40133, + 0x40135, 0x40137, 0x40138, 0x4013a, 0x4013c, 0x4013e, 0x40140, 0x40142, 0x40144, + 0x40146, 0x40148, 0x40149, 0x4014b, 0x4014d, 0x4014f, 0x40151, 0x40153, 0x40155, + 0x40157, 0x40159, 0x4015b, 0x4015d, 0x4015f, 0x40161, 0x40163, 0x40165, 0x40167, + 0x40169, 0x4016b, 0x4016d, 0x4016f, 0x40171, 0x40173, 0x40175, 0x40177, 0x4017a, + 0x4017c, 0x40183, 0x40185, 0x40188, 0x4018c, 0x4018d, 0x40192, 0x40195, 0x4019e, + 0x401a1, 0x401a3, 0x401a5, 0x401a8, 0x401aa, 0x401ab, 0x401ad, 0x401b0, 0x401b4, + 0x401b6, 0x401b9, 0x401ba, 0x401c6, 0x401c9, 0x401cc, 0x401ce, 0x401d0, 0x401d2, + 0x401d4, 0x401d6, 0x401d8, 0x401da, 0x401dc, 0x401dd, 0x401df, 0x401e1, 0x401e3, + 0x401e5, 0x401e7, 0x401e9, 0x401eb, 0x401ed, 0x401ef, 0x401f0, 0x401f3, 0x401f5, + 0x401f9, 0x401fb, 0x401fd, 0x401ff, 0x40201, 0x40203, 0x40205, 0x40207, 0x40209, + 0x4020b, 0x4020d, 0x4020f, 0x40211, 0x40213, 0x40215, 0x40217, 0x40219, 0x4021b, + 0x4021d, 0x4021f, 0x40221, 0x40223, 0x40225, 0x40227, 0x40229, 0x4022b, 0x4022d, + 0x4022f, 0x40231, 0x4023c, 0x4023f, 0x40240, 0x40242, 0x40247, 0x40249, 0x4024b, + 0x4024d, 0x40371, 0x40373, 0x40377, 0x40390, 0x403d0, 0x403d1, 0x403d9, 0x403db, + 0x403dd, 0x403df, 0x403e1, 0x403e3, 0x403e5, 0x403e7, 0x403e9, 0x403eb, 0x403ed, + 0x403f5, 0x403f8, 0x403fb, 0x403fc, 0x40461, 0x40463, 0x40465, 0x40467, 0x40469, + 0x4046b, 0x4046d, 0x4046f, 0x40471, 0x40473, 0x40475, 0x40477, 0x40479, 0x4047b, + 0x4047d, 0x4047f, 0x40481, 0x4048b, 0x4048d, 0x4048f, 0x40491, 0x40493, 0x40495, + 0x40497, 0x40499, 0x4049b, 0x4049d, 0x4049f, 0x404a1, 0x404a3, 0x404a5, 0x404a7, + 0x404a9, 0x404ab, 0x404ad, 0x404af, 0x404b1, 0x404b3, 0x404b5, 0x404b7, 0x404b9, + 0x404bb, 0x404bd, 0x404bf, 0x404c2, 0x404c4, 0x404c6, 0x404c8, 0x404ca, 0x404cc, + 0x404ce, 0x404cf, 0x404d1, 0x404d3, 0x404d5, 0x404d7, 0x404d9, 0x404db, 0x404dd, + 0x404df, 0x404e1, 0x404e3, 0x404e5, 0x404e7, 0x404e9, 0x404eb, 0x404ed, 0x404ef, + 0x404f1, 0x404f3, 0x404f5, 0x404f7, 0x404f9, 0x404fb, 0x404fd, 0x404ff, 0x40501, + 0x40503, 0x40505, 0x40507, 0x40509, 0x4050b, 0x4050d, 0x4050f, 0x40511, 0x40513, + 0x40515, 0x40517, 0x40519, 0x4051b, 0x4051d, 0x4051f, 0x40521, 0x40523, 0x40525, + 0x40527, 0x40529, 0x4052b, 0x4052d, 0x4052f, 0x41e01, 0x41e03, 0x41e05, 0x41e07, + 0x41e09, 0x41e0b, 0x41e0d, 0x41e0f, 0x41e11, 0x41e13, 0x41e15, 0x41e17, 0x41e19, + 0x41e1b, 0x41e1d, 0x41e1f, 0x41e21, 0x41e23, 0x41e25, 0x41e27, 0x41e29, 0x41e2b, + 0x41e2d, 0x41e2f, 0x41e31, 0x41e33, 0x41e35, 0x41e37, 0x41e39, 0x41e3b, 0x41e3d, + 0x41e3f, 0x41e41, 0x41e43, 0x41e45, 0x41e47, 0x41e49, 0x41e4b, 0x41e4d, 0x41e4f, + 0x41e51, 0x41e53, 0x41e55, 0x41e57, 0x41e59, 0x41e5b, 0x41e5d, 0x41e5f, 0x41e61, + 0x41e63, 0x41e65, 0x41e67, 0x41e69, 0x41e6b, 0x41e6d, 0x41e6f, 0x41e71, 0x41e73, + 0x41e75, 0x41e77, 0x41e79, 0x41e7b, 0x41e7d, 0x41e7f, 0x41e81, 0x41e83, 0x41e85, + 0x41e87, 0x41e89, 0x41e8b, 0x41e8d, 0x41e8f, 0x41e91, 0x41e93, 0x41e9f, 0x41ea1, + 0x41ea3, 0x41ea5, 0x41ea7, 0x41ea9, 0x41eab, 0x41ead, 0x41eaf, 0x41eb1, 0x41eb3, + 0x41eb5, 0x41eb7, 0x41eb9, 0x41ebb, 0x41ebd, 0x41ebf, 0x41ec1, 0x41ec3, 0x41ec5, + 0x41ec7, 0x41ec9, 0x41ecb, 0x41ecd, 0x41ecf, 0x41ed1, 0x41ed3, 0x41ed5, 0x41ed7, + 0x41ed9, 0x41edb, 0x41edd, 0x41edf, 0x41ee1, 0x41ee3, 0x41ee5, 0x41ee7, 0x41ee9, + 0x41eeb, 0x41eed, 0x41eef, 0x41ef1, 0x41ef3, 0x41ef5, 0x41ef7, 0x41ef9, 0x41efb, + 0x41efd, 0x41fb6, 0x41fb7, 0x41fbe, 0x41fc6, 0x41fc7, 0x41fd6, 0x41fd7, 0x41ff6, + 0x41ff7, 0x4210a, 0x4210e, 0x4210f, 0x42113, 0x4212f, 0x42134, 0x42139, 0x4213c, + 0x4213d, 0x4214e, 0x42184, 0x42c61, 0x42c65, 0x42c66, 0x42c68, 0x42c6a, 0x42c6c, + 0x42c71, 0x42c73, 0x42c74, 0x42c81, 0x42c83, 0x42c85, 0x42c87, 0x42c89, 0x42c8b, + 0x42c8d, 0x42c8f, 0x42c91, 0x42c93, 0x42c95, 0x42c97, 0x42c99, 0x42c9b, 0x42c9d, + 0x42c9f, 0x42ca1, 0x42ca3, 0x42ca5, 0x42ca7, 0x42ca9, 0x42cab, 0x42cad, 0x42caf, + 0x42cb1, 0x42cb3, 0x42cb5, 0x42cb7, 0x42cb9, 0x42cbb, 0x42cbd, 0x42cbf, 0x42cc1, + 0x42cc3, 0x42cc5, 0x42cc7, 0x42cc9, 0x42ccb, 0x42ccd, 0x42ccf, 0x42cd1, 0x42cd3, + 0x42cd5, 0x42cd7, 0x42cd9, 0x42cdb, 0x42cdd, 0x42cdf, 0x42ce1, 0x42ce3, 0x42ce4, + 0x42cec, 0x42cee, 0x42cf3, 0x42d27, 0x42d2d, 0x4a641, 0x4a643, 0x4a645, 0x4a647, + 0x4a649, 0x4a64b, 0x4a64d, 0x4a64f, 0x4a651, 0x4a653, 0x4a655, 0x4a657, 0x4a659, + 0x4a65b, 0x4a65d, 0x4a65f, 0x4a661, 0x4a663, 0x4a665, 0x4a667, 0x4a669, 0x4a66b, + 0x4a66d, 0x4a681, 0x4a683, 0x4a685, 0x4a687, 0x4a689, 0x4a68b, 0x4a68d, 0x4a68f, + 0x4a691, 0x4a693, 0x4a695, 0x4a697, 0x4a699, 0x4a69b, 0x4a723, 0x4a725, 0x4a727, + 0x4a729, 0x4a72b, 0x4a72d, 0x4a733, 0x4a735, 0x4a737, 0x4a739, 0x4a73b, 0x4a73d, + 0x4a73f, 0x4a741, 0x4a743, 0x4a745, 0x4a747, 0x4a749, 0x4a74b, 0x4a74d, 0x4a74f, + 0x4a751, 0x4a753, 0x4a755, 0x4a757, 0x4a759, 0x4a75b, 0x4a75d, 0x4a75f, 0x4a761, + 0x4a763, 0x4a765, 0x4a767, 0x4a769, 0x4a76b, 0x4a76d, 0x4a76f, 0x4a77a, 0x4a77c, + 0x4a77f, 0x4a781, 0x4a783, 0x4a785, 0x4a787, 0x4a78c, 0x4a78e, 0x4a791, 0x4a797, + 0x4a799, 0x4a79b, 0x4a79d, 0x4a79f, 0x4a7a1, 0x4a7a3, 0x4a7a5, 0x4a7a7, 0x4a7a9, + 0x4a7b5, 0x4a7b7, 0x4a7fa, 0x500b5, 0x50101, 0x50103, 0x50105, 0x50107, 0x50109, + 0x5010b, 0x5010d, 0x5010f, 0x50111, 0x50113, 0x50115, 0x50117, 0x50119, 0x5011b, + 0x5011d, 0x5011f, 0x50121, 0x50123, 0x50125, 0x50127, 0x50129, 0x5012b, 0x5012d, + 0x5012f, 0x50131, 0x50133, 0x50135, 0x50137, 0x50138, 0x5013a, 0x5013c, 0x5013e, + 0x50140, 0x50142, 0x50144, 0x50146, 0x50148, 0x50149, 0x5014b, 0x5014d, 0x5014f, + 0x50151, 0x50153, 0x50155, 0x50157, 0x50159, 0x5015b, 0x5015d, 0x5015f, 0x50161, + 0x50163, 0x50165, 0x50167, 0x50169, 0x5016b, 0x5016d, 0x5016f, 0x50171, 0x50173, + 0x50175, 0x50177, 0x5017a, 0x5017c, 0x50183, 0x50185, 0x50188, 0x5018c, 0x5018d, + 0x50192, 0x50195, 0x5019e, 0x501a1, 0x501a3, 0x501a5, 0x501a8, 0x501aa, 0x501ab, + 0x501ad, 0x501b0, 0x501b4, 0x501b6, 0x501b9, 0x501ba, 0x501c6, 0x501c9, 0x501cc, + 0x501ce, 0x501d0, 0x501d2, 0x501d4, 0x501d6, 0x501d8, 0x501da, 0x501dc, 0x501dd, + 0x501df, 0x501e1, 0x501e3, 0x501e5, 0x501e7, 0x501e9, 0x501eb, 0x501ed, 0x501ef, + 0x501f0, 0x501f3, 0x501f5, 0x501f9, 0x501fb, 0x501fd, 0x501ff, 0x50201, 0x50203, + 0x50205, 0x50207, 0x50209, 0x5020b, 0x5020d, 0x5020f, 0x50211, 0x50213, 0x50215, + 0x50217, 0x50219, 0x5021b, 0x5021d, 0x5021f, 0x50221, 0x50223, 0x50225, 0x50227, + 0x50229, 0x5022b, 0x5022d, 0x5022f, 0x50231, 0x5023c, 0x5023f, 0x50240, 0x50242, + 0x50247, 0x50249, 0x5024b, 0x5024d, 0x50371, 0x50373, 0x50377, 0x50390, 0x503d0, + 0x503d1, 0x503d9, 0x503db, 0x503dd, 0x503df, 0x503e1, 0x503e3, 0x503e5, 0x503e7, + 0x503e9, 0x503eb, 0x503ed, 0x503f5, 0x503f8, 0x503fb, 0x503fc, 0x50461, 0x50463, + 0x50465, 0x50467, 0x50469, 0x5046b, 0x5046d, 0x5046f, 0x50471, 0x50473, 0x50475, + 0x50477, 0x50479, 0x5047b, 0x5047d, 0x5047f, 0x50481, 0x5048b, 0x5048d, 0x5048f, + 0x50491, 0x50493, 0x50495, 0x50497, 0x50499, 0x5049b, 0x5049d, 0x5049f, 0x504a1, + 0x504a3, 0x504a5, 0x504a7, 0x504a9, 0x504ab, 0x504ad, 0x504af, 0x504b1, 0x504b3, + 0x504b5, 0x504b7, 0x504b9, 0x504bb, 0x504bd, 0x504bf, 0x504c2, 0x504c4, 0x504c6, + 0x504c8, 0x504ca, 0x504cc, 0x504ce, 0x504cf, 0x504d1, 0x504d3, 0x504d5, 0x504d7, + 0x504d9, 0x504db, 0x504dd, 0x504df, 0x504e1, 0x504e3, 0x504e5, 0x504e7, 0x504e9, + 0x504eb, 0x504ed, 0x504ef, 0x504f1, 0x504f3, 0x504f5, 0x504f7, 0x504f9, 0x504fb, + 0x504fd, 0x504ff, 0x50501, 0x50503, 0x50505, 0x50507, 0x50509, 0x5050b, 0x5050d, + 0x5050f, 0x50511, 0x50513, 0x50515, 0x50517, 0x50519, 0x5051b, 0x5051d, 0x5051f, + 0x50521, 0x50523, 0x50525, 0x50527, 0x50529, 0x5052b, 0x5052d, 0x5052f, 0x51e01, + 0x51e03, 0x51e05, 0x51e07, 0x51e09, 0x51e0b, 0x51e0d, 0x51e0f, 0x51e11, 0x51e13, + 0x51e15, 0x51e17, 0x51e19, 0x51e1b, 0x51e1d, 0x51e1f, 0x51e21, 0x51e23, 0x51e25, + 0x51e27, 0x51e29, 0x51e2b, 0x51e2d, 0x51e2f, 0x51e31, 0x51e33, 0x51e35, 0x51e37, + 0x51e39, 0x51e3b, 0x51e3d, 0x51e3f, 0x51e41, 0x51e43, 0x51e45, 0x51e47, 0x51e49, + 0x51e4b, 0x51e4d, 0x51e4f, 0x51e51, 0x51e53, 0x51e55, 0x51e57, 0x51e59, 0x51e5b, + 0x51e5d, 0x51e5f, 0x51e61, 0x51e63, 0x51e65, 0x51e67, 0x51e69, 0x51e6b, 0x51e6d, + 0x51e6f, 0x51e71, 0x51e73, 0x51e75, 0x51e77, 0x51e79, 0x51e7b, 0x51e7d, 0x51e7f, + 0x51e81, 0x51e83, 0x51e85, 0x51e87, 0x51e89, 0x51e8b, 0x51e8d, 0x51e8f, 0x51e91, + 0x51e93, 0x51e9f, 0x51ea1, 0x51ea3, 0x51ea5, 0x51ea7, 0x51ea9, 0x51eab, 0x51ead, + 0x51eaf, 0x51eb1, 0x51eb3, 0x51eb5, 0x51eb7, 0x51eb9, 0x51ebb, 0x51ebd, 0x51ebf, + 0x51ec1, 0x51ec3, 0x51ec5, 0x51ec7, 0x51ec9, 0x51ecb, 0x51ecd, 0x51ecf, 0x51ed1, + 0x51ed3, 0x51ed5, 0x51ed7, 0x51ed9, 0x51edb, 0x51edd, 0x51edf, 0x51ee1, 0x51ee3, + 0x51ee5, 0x51ee7, 0x51ee9, 0x51eeb, 0x51eed, 0x51eef, 0x51ef1, 0x51ef3, 0x51ef5, + 0x51ef7, 0x51ef9, 0x51efb, 0x51efd, 0x51fb6, 0x51fb7, 0x51fbe, 0x51fc6, 0x51fc7, + 0x51fd6, 0x51fd7, 0x51ff6, 0x51ff7, 0x5210a, 0x5210e, 0x5210f, 0x52113, 0x5212f, + 0x52134, 0x52139, 0x5213c, 0x5213d, 0x5214e, 0x52184, 0x52c61, 0x52c65, 0x52c66, + 0x52c68, 0x52c6a, 0x52c6c, 0x52c71, 0x52c73, 0x52c74, 0x52c81, 0x52c83, 0x52c85, + 0x52c87, 0x52c89, 0x52c8b, 0x52c8d, 0x52c8f, 0x52c91, 0x52c93, 0x52c95, 0x52c97, + 0x52c99, 0x52c9b, 0x52c9d, 0x52c9f, 0x52ca1, 0x52ca3, 0x52ca5, 0x52ca7, 0x52ca9, + 0x52cab, 0x52cad, 0x52caf, 0x52cb1, 0x52cb3, 0x52cb5, 0x52cb7, 0x52cb9, 0x52cbb, + 0x52cbd, 0x52cbf, 0x52cc1, 0x52cc3, 0x52cc5, 0x52cc7, 0x52cc9, 0x52ccb, 0x52ccd, + 0x52ccf, 0x52cd1, 0x52cd3, 0x52cd5, 0x52cd7, 0x52cd9, 0x52cdb, 0x52cdd, 0x52cdf, + 0x52ce1, 0x52ce3, 0x52ce4, 0x52cec, 0x52cee, 0x52cf3, 0x52d27, 0x52d2d, 0x5a641, + 0x5a643, 0x5a645, 0x5a647, 0x5a649, 0x5a64b, 0x5a64d, 0x5a64f, 0x5a651, 0x5a653, + 0x5a655, 0x5a657, 0x5a659, 0x5a65b, 0x5a65d, 0x5a65f, 0x5a661, 0x5a663, 0x5a665, + 0x5a667, 0x5a669, 0x5a66b, 0x5a66d, 0x5a681, 0x5a683, 0x5a685, 0x5a687, 0x5a689, + 0x5a68b, 0x5a68d, 0x5a68f, 0x5a691, 0x5a693, 0x5a695, 0x5a697, 0x5a699, 0x5a69b, + 0x5a723, 0x5a725, 0x5a727, 0x5a729, 0x5a72b, 0x5a72d, 0x5a733, 0x5a735, 0x5a737, + 0x5a739, 0x5a73b, 0x5a73d, 0x5a73f, 0x5a741, 0x5a743, 0x5a745, 0x5a747, 0x5a749, + 0x5a74b, 0x5a74d, 0x5a74f, 0x5a751, 0x5a753, 0x5a755, 0x5a757, 0x5a759, 0x5a75b, + 0x5a75d, 0x5a75f, 0x5a761, 0x5a763, 0x5a765, 0x5a767, 0x5a769, 0x5a76b, 0x5a76d, + 0x5a76f, 0x5a77a, 0x5a77c, 0x5a77f, 0x5a781, 0x5a783, 0x5a785, 0x5a787, 0x5a78c, + 0x5a78e, 0x5a791, 0x5a797, 0x5a799, 0x5a79b, 0x5a79d, 0x5a79f, 0x5a7a1, 0x5a7a3, + 0x5a7a5, 0x5a7a7, 0x5a7a9, 0x5a7b5, 0x5a7b7, 0x5a7fa, 0x600b5, 0x60101, 0x60103, + 0x60105, 0x60107, 0x60109, 0x6010b, 0x6010d, 0x6010f, 0x60111, 0x60113, 0x60115, + 0x60117, 0x60119, 0x6011b, 0x6011d, 0x6011f, 0x60121, 0x60123, 0x60125, 0x60127, + 0x60129, 0x6012b, 0x6012d, 0x6012f, 0x60131, 0x60133, 0x60135, 0x60137, 0x60138, + 0x6013a, 0x6013c, 0x6013e, 0x60140, 0x60142, 0x60144, 0x60146, 0x60148, 0x60149, + 0x6014b, 0x6014d, 0x6014f, 0x60151, 0x60153, 0x60155, 0x60157, 0x60159, 0x6015b, + 0x6015d, 0x6015f, 0x60161, 0x60163, 0x60165, 0x60167, 0x60169, 0x6016b, 0x6016d, + 0x6016f, 0x60171, 0x60173, 0x60175, 0x60177, 0x6017a, 0x6017c, 0x60183, 0x60185, + 0x60188, 0x6018c, 0x6018d, 0x60192, 0x60195, 0x6019e, 0x601a1, 0x601a3, 0x601a5, + 0x601a8, 0x601aa, 0x601ab, 0x601ad, 0x601b0, 0x601b4, 0x601b6, 0x601b9, 0x601ba, + 0x601c6, 0x601c9, 0x601cc, 0x601ce, 0x601d0, 0x601d2, 0x601d4, 0x601d6, 0x601d8, + 0x601da, 0x601dc, 0x601dd, 0x601df, 0x601e1, 0x601e3, 0x601e5, 0x601e7, 0x601e9, + 0x601eb, 0x601ed, 0x601ef, 0x601f0, 0x601f3, 0x601f5, 0x601f9, 0x601fb, 0x601fd, + 0x601ff, 0x60201, 0x60203, 0x60205, 0x60207, 0x60209, 0x6020b, 0x6020d, 0x6020f, + 0x60211, 0x60213, 0x60215, 0x60217, 0x60219, 0x6021b, 0x6021d, 0x6021f, 0x60221, + 0x60223, 0x60225, 0x60227, 0x60229, 0x6022b, 0x6022d, 0x6022f, 0x60231, 0x6023c, + 0x6023f, 0x60240, 0x60242, 0x60247, 0x60249, 0x6024b, 0x6024d, 0x60371, 0x60373, + 0x60377, 0x60390, 0x603d0, 0x603d1, 0x603d9, 0x603db, 0x603dd, 0x603df, 0x603e1, + 0x603e3, 0x603e5, 0x603e7, 0x603e9, 0x603eb, 0x603ed, 0x603f5, 0x603f8, 0x603fb, + 0x603fc, 0x60461, 0x60463, 0x60465, 0x60467, 0x60469, 0x6046b, 0x6046d, 0x6046f, + 0x60471, 0x60473, 0x60475, 0x60477, 0x60479, 0x6047b, 0x6047d, 0x6047f, 0x60481, + 0x6048b, 0x6048d, 0x6048f, 0x60491, 0x60493, 0x60495, 0x60497, 0x60499, 0x6049b, + 0x6049d, 0x6049f, 0x604a1, 0x604a3, 0x604a5, 0x604a7, 0x604a9, 0x604ab, 0x604ad, + 0x604af, 0x604b1, 0x604b3, 0x604b5, 0x604b7, 0x604b9, 0x604bb, 0x604bd, 0x604bf, + 0x604c2, 0x604c4, 0x604c6, 0x604c8, 0x604ca, 0x604cc, 0x604ce, 0x604cf, 0x604d1, + 0x604d3, 0x604d5, 0x604d7, 0x604d9, 0x604db, 0x604dd, 0x604df, 0x604e1, 0x604e3, + 0x604e5, 0x604e7, 0x604e9, 0x604eb, 0x604ed, 0x604ef, 0x604f1, 0x604f3, 0x604f5, + 0x604f7, 0x604f9, 0x604fb, 0x604fd, 0x604ff, 0x60501, 0x60503, 0x60505, 0x60507, + 0x60509, 0x6050b, 0x6050d, 0x6050f, 0x60511, 0x60513, 0x60515, 0x60517, 0x60519, + 0x6051b, 0x6051d, 0x6051f, 0x60521, 0x60523, 0x60525, 0x60527, 0x60529, 0x6052b, + 0x6052d, 0x6052f, 0x61e01, 0x61e03, 0x61e05, 0x61e07, 0x61e09, 0x61e0b, 0x61e0d, + 0x61e0f, 0x61e11, 0x61e13, 0x61e15, 0x61e17, 0x61e19, 0x61e1b, 0x61e1d, 0x61e1f, + 0x61e21, 0x61e23, 0x61e25, 0x61e27, 0x61e29, 0x61e2b, 0x61e2d, 0x61e2f, 0x61e31, + 0x61e33, 0x61e35, 0x61e37, 0x61e39, 0x61e3b, 0x61e3d, 0x61e3f, 0x61e41, 0x61e43, + 0x61e45, 0x61e47, 0x61e49, 0x61e4b, 0x61e4d, 0x61e4f, 0x61e51, 0x61e53, 0x61e55, + 0x61e57, 0x61e59, 0x61e5b, 0x61e5d, 0x61e5f, 0x61e61, 0x61e63, 0x61e65, 0x61e67, + 0x61e69, 0x61e6b, 0x61e6d, 0x61e6f, 0x61e71, 0x61e73, 0x61e75, 0x61e77, 0x61e79, + 0x61e7b, 0x61e7d, 0x61e7f, 0x61e81, 0x61e83, 0x61e85, 0x61e87, 0x61e89, 0x61e8b, + 0x61e8d, 0x61e8f, 0x61e91, 0x61e93, 0x61e9f, 0x61ea1, 0x61ea3, 0x61ea5, 0x61ea7, + 0x61ea9, 0x61eab, 0x61ead, 0x61eaf, 0x61eb1, 0x61eb3, 0x61eb5, 0x61eb7, 0x61eb9, + 0x61ebb, 0x61ebd, 0x61ebf, 0x61ec1, 0x61ec3, 0x61ec5, 0x61ec7, 0x61ec9, 0x61ecb, + 0x61ecd, 0x61ecf, 0x61ed1, 0x61ed3, 0x61ed5, 0x61ed7, 0x61ed9, 0x61edb, 0x61edd, + 0x61edf, 0x61ee1, 0x61ee3, 0x61ee5, 0x61ee7, 0x61ee9, 0x61eeb, 0x61eed, 0x61eef, + 0x61ef1, 0x61ef3, 0x61ef5, 0x61ef7, 0x61ef9, 0x61efb, 0x61efd, 0x61fb6, 0x61fb7, + 0x61fbe, 0x61fc6, 0x61fc7, 0x61fd6, 0x61fd7, 0x61ff6, 0x61ff7, 0x6210a, 0x6210e, + 0x6210f, 0x62113, 0x6212f, 0x62134, 0x62139, 0x6213c, 0x6213d, 0x6214e, 0x62184, + 0x62c61, 0x62c65, 0x62c66, 0x62c68, 0x62c6a, 0x62c6c, 0x62c71, 0x62c73, 0x62c74, + 0x62c81, 0x62c83, 0x62c85, 0x62c87, 0x62c89, 0x62c8b, 0x62c8d, 0x62c8f, 0x62c91, + 0x62c93, 0x62c95, 0x62c97, 0x62c99, 0x62c9b, 0x62c9d, 0x62c9f, 0x62ca1, 0x62ca3, + 0x62ca5, 0x62ca7, 0x62ca9, 0x62cab, 0x62cad, 0x62caf, 0x62cb1, 0x62cb3, 0x62cb5, + 0x62cb7, 0x62cb9, 0x62cbb, 0x62cbd, 0x62cbf, 0x62cc1, 0x62cc3, 0x62cc5, 0x62cc7, + 0x62cc9, 0x62ccb, 0x62ccd, 0x62ccf, 0x62cd1, 0x62cd3, 0x62cd5, 0x62cd7, 0x62cd9, + 0x62cdb, 0x62cdd, 0x62cdf, 0x62ce1, 0x62ce3, 0x62ce4, 0x62cec, 0x62cee, 0x62cf3, + 0x62d27, 0x62d2d, 0x6a641, 0x6a643, 0x6a645, 0x6a647, 0x6a649, 0x6a64b, 0x6a64d, + 0x6a64f, 0x6a651, 0x6a653, 0x6a655, 0x6a657, 0x6a659, 0x6a65b, 0x6a65d, 0x6a65f, + 0x6a661, 0x6a663, 0x6a665, 0x6a667, 0x6a669, 0x6a66b, 0x6a66d, 0x6a681, 0x6a683, + 0x6a685, 0x6a687, 0x6a689, 0x6a68b, 0x6a68d, 0x6a68f, 0x6a691, 0x6a693, 0x6a695, + 0x6a697, 0x6a699, 0x6a69b, 0x6a723, 0x6a725, 0x6a727, 0x6a729, 0x6a72b, 0x6a72d, + 0x6a733, 0x6a735, 0x6a737, 0x6a739, 0x6a73b, 0x6a73d, 0x6a73f, 0x6a741, 0x6a743, + 0x6a745, 0x6a747, 0x6a749, 0x6a74b, 0x6a74d, 0x6a74f, 0x6a751, 0x6a753, 0x6a755, + 0x6a757, 0x6a759, 0x6a75b, 0x6a75d, 0x6a75f, 0x6a761, 0x6a763, 0x6a765, 0x6a767, + 0x6a769, 0x6a76b, 0x6a76d, 0x6a76f, 0x6a77a, 0x6a77c, 0x6a77f, 0x6a781, 0x6a783, + 0x6a785, 0x6a787, 0x6a78c, 0x6a78e, 0x6a791, 0x6a797, 0x6a799, 0x6a79b, 0x6a79d, + 0x6a79f, 0x6a7a1, 0x6a7a3, 0x6a7a5, 0x6a7a7, 0x6a7a9, 0x6a7b5, 0x6a7b7, 0x6a7fa, + 0x700b5, 0x70101, 0x70103, 0x70105, 0x70107, 0x70109, 0x7010b, 0x7010d, 0x7010f, + 0x70111, 0x70113, 0x70115, 0x70117, 0x70119, 0x7011b, 0x7011d, 0x7011f, 0x70121, + 0x70123, 0x70125, 0x70127, 0x70129, 0x7012b, 0x7012d, 0x7012f, 0x70131, 0x70133, + 0x70135, 0x70137, 0x70138, 0x7013a, 0x7013c, 0x7013e, 0x70140, 0x70142, 0x70144, + 0x70146, 0x70148, 0x70149, 0x7014b, 0x7014d, 0x7014f, 0x70151, 0x70153, 0x70155, + 0x70157, 0x70159, 0x7015b, 0x7015d, 0x7015f, 0x70161, 0x70163, 0x70165, 0x70167, + 0x70169, 0x7016b, 0x7016d, 0x7016f, 0x70171, 0x70173, 0x70175, 0x70177, 0x7017a, + 0x7017c, 0x70183, 0x70185, 0x70188, 0x7018c, 0x7018d, 0x70192, 0x70195, 0x7019e, + 0x701a1, 0x701a3, 0x701a5, 0x701a8, 0x701aa, 0x701ab, 0x701ad, 0x701b0, 0x701b4, + 0x701b6, 0x701b9, 0x701ba, 0x701c6, 0x701c9, 0x701cc, 0x701ce, 0x701d0, 0x701d2, + 0x701d4, 0x701d6, 0x701d8, 0x701da, 0x701dc, 0x701dd, 0x701df, 0x701e1, 0x701e3, + 0x701e5, 0x701e7, 0x701e9, 0x701eb, 0x701ed, 0x701ef, 0x701f0, 0x701f3, 0x701f5, + 0x701f9, 0x701fb, 0x701fd, 0x701ff, 0x70201, 0x70203, 0x70205, 0x70207, 0x70209, + 0x7020b, 0x7020d, 0x7020f, 0x70211, 0x70213, 0x70215, 0x70217, 0x70219, 0x7021b, + 0x7021d, 0x7021f, 0x70221, 0x70223, 0x70225, 0x70227, 0x70229, 0x7022b, 0x7022d, + 0x7022f, 0x70231, 0x7023c, 0x7023f, 0x70240, 0x70242, 0x70247, 0x70249, 0x7024b, + 0x7024d, 0x70371, 0x70373, 0x70377, 0x70390, 0x703d0, 0x703d1, 0x703d9, 0x703db, + 0x703dd, 0x703df, 0x703e1, 0x703e3, 0x703e5, 0x703e7, 0x703e9, 0x703eb, 0x703ed, + 0x703f5, 0x703f8, 0x703fb, 0x703fc, 0x70461, 0x70463, 0x70465, 0x70467, 0x70469, + 0x7046b, 0x7046d, 0x7046f, 0x70471, 0x70473, 0x70475, 0x70477, 0x70479, 0x7047b, + 0x7047d, 0x7047f, 0x70481, 0x7048b, 0x7048d, 0x7048f, 0x70491, 0x70493, 0x70495, + 0x70497, 0x70499, 0x7049b, 0x7049d, 0x7049f, 0x704a1, 0x704a3, 0x704a5, 0x704a7, + 0x704a9, 0x704ab, 0x704ad, 0x704af, 0x704b1, 0x704b3, 0x704b5, 0x704b7, 0x704b9, + 0x704bb, 0x704bd, 0x704bf, 0x704c2, 0x704c4, 0x704c6, 0x704c8, 0x704ca, 0x704cc, + 0x704ce, 0x704cf, 0x704d1, 0x704d3, 0x704d5, 0x704d7, 0x704d9, 0x704db, 0x704dd, + 0x704df, 0x704e1, 0x704e3, 0x704e5, 0x704e7, 0x704e9, 0x704eb, 0x704ed, 0x704ef, + 0x704f1, 0x704f3, 0x704f5, 0x704f7, 0x704f9, 0x704fb, 0x704fd, 0x704ff, 0x70501, + 0x70503, 0x70505, 0x70507, 0x70509, 0x7050b, 0x7050d, 0x7050f, 0x70511, 0x70513, + 0x70515, 0x70517, 0x70519, 0x7051b, 0x7051d, 0x7051f, 0x70521, 0x70523, 0x70525, + 0x70527, 0x70529, 0x7052b, 0x7052d, 0x7052f, 0x71e01, 0x71e03, 0x71e05, 0x71e07, + 0x71e09, 0x71e0b, 0x71e0d, 0x71e0f, 0x71e11, 0x71e13, 0x71e15, 0x71e17, 0x71e19, + 0x71e1b, 0x71e1d, 0x71e1f, 0x71e21, 0x71e23, 0x71e25, 0x71e27, 0x71e29, 0x71e2b, + 0x71e2d, 0x71e2f, 0x71e31, 0x71e33, 0x71e35, 0x71e37, 0x71e39, 0x71e3b, 0x71e3d, + 0x71e3f, 0x71e41, 0x71e43, 0x71e45, 0x71e47, 0x71e49, 0x71e4b, 0x71e4d, 0x71e4f, + 0x71e51, 0x71e53, 0x71e55, 0x71e57, 0x71e59, 0x71e5b, 0x71e5d, 0x71e5f, 0x71e61, + 0x71e63, 0x71e65, 0x71e67, 0x71e69, 0x71e6b, 0x71e6d, 0x71e6f, 0x71e71, 0x71e73, + 0x71e75, 0x71e77, 0x71e79, 0x71e7b, 0x71e7d, 0x71e7f, 0x71e81, 0x71e83, 0x71e85, + 0x71e87, 0x71e89, 0x71e8b, 0x71e8d, 0x71e8f, 0x71e91, 0x71e93, 0x71e9f, 0x71ea1, + 0x71ea3, 0x71ea5, 0x71ea7, 0x71ea9, 0x71eab, 0x71ead, 0x71eaf, 0x71eb1, 0x71eb3, + 0x71eb5, 0x71eb7, 0x71eb9, 0x71ebb, 0x71ebd, 0x71ebf, 0x71ec1, 0x71ec3, 0x71ec5, + 0x71ec7, 0x71ec9, 0x71ecb, 0x71ecd, 0x71ecf, 0x71ed1, 0x71ed3, 0x71ed5, 0x71ed7, + 0x71ed9, 0x71edb, 0x71edd, 0x71edf, 0x71ee1, 0x71ee3, 0x71ee5, 0x71ee7, 0x71ee9, + 0x71eeb, 0x71eed, 0x71eef, 0x71ef1, 0x71ef3, 0x71ef5, 0x71ef7, 0x71ef9, 0x71efb, + 0x71efd, 0x71fb6, 0x71fb7, 0x71fbe, 0x71fc6, 0x71fc7, 0x71fd6, 0x71fd7, 0x71ff6, + 0x71ff7, 0x7210a, 0x7210e, 0x7210f, 0x72113, 0x7212f, 0x72134, 0x72139, 0x7213c, + 0x7213d, 0x7214e, 0x72184, 0x72c61, 0x72c65, 0x72c66, 0x72c68, 0x72c6a, 0x72c6c, + 0x72c71, 0x72c73, 0x72c74, 0x72c81, 0x72c83, 0x72c85, 0x72c87, 0x72c89, 0x72c8b, + 0x72c8d, 0x72c8f, 0x72c91, 0x72c93, 0x72c95, 0x72c97, 0x72c99, 0x72c9b, 0x72c9d, + 0x72c9f, 0x72ca1, 0x72ca3, 0x72ca5, 0x72ca7, 0x72ca9, 0x72cab, 0x72cad, 0x72caf, + 0x72cb1, 0x72cb3, 0x72cb5, 0x72cb7, 0x72cb9, 0x72cbb, 0x72cbd, 0x72cbf, 0x72cc1, + 0x72cc3, 0x72cc5, 0x72cc7, 0x72cc9, 0x72ccb, 0x72ccd, 0x72ccf, 0x72cd1, 0x72cd3, + 0x72cd5, 0x72cd7, 0x72cd9, 0x72cdb, 0x72cdd, 0x72cdf, 0x72ce1, 0x72ce3, 0x72ce4, + 0x72cec, 0x72cee, 0x72cf3, 0x72d27, 0x72d2d, 0x7a641, 0x7a643, 0x7a645, 0x7a647, + 0x7a649, 0x7a64b, 0x7a64d, 0x7a64f, 0x7a651, 0x7a653, 0x7a655, 0x7a657, 0x7a659, + 0x7a65b, 0x7a65d, 0x7a65f, 0x7a661, 0x7a663, 0x7a665, 0x7a667, 0x7a669, 0x7a66b, + 0x7a66d, 0x7a681, 0x7a683, 0x7a685, 0x7a687, 0x7a689, 0x7a68b, 0x7a68d, 0x7a68f, + 0x7a691, 0x7a693, 0x7a695, 0x7a697, 0x7a699, 0x7a69b, 0x7a723, 0x7a725, 0x7a727, + 0x7a729, 0x7a72b, 0x7a72d, 0x7a733, 0x7a735, 0x7a737, 0x7a739, 0x7a73b, 0x7a73d, + 0x7a73f, 0x7a741, 0x7a743, 0x7a745, 0x7a747, 0x7a749, 0x7a74b, 0x7a74d, 0x7a74f, + 0x7a751, 0x7a753, 0x7a755, 0x7a757, 0x7a759, 0x7a75b, 0x7a75d, 0x7a75f, 0x7a761, + 0x7a763, 0x7a765, 0x7a767, 0x7a769, 0x7a76b, 0x7a76d, 0x7a76f, 0x7a77a, 0x7a77c, + 0x7a77f, 0x7a781, 0x7a783, 0x7a785, 0x7a787, 0x7a78c, 0x7a78e, 0x7a791, 0x7a797, + 0x7a799, 0x7a79b, 0x7a79d, 0x7a79f, 0x7a7a1, 0x7a7a3, 0x7a7a5, 0x7a7a7, 0x7a7a9, + 0x7a7b5, 0x7a7b7, 0x7a7fa, 0x800b5, 0x80101, 0x80103, 0x80105, 0x80107, 0x80109, + 0x8010b, 0x8010d, 0x8010f, 0x80111, 0x80113, 0x80115, 0x80117, 0x80119, 0x8011b, + 0x8011d, 0x8011f, 0x80121, 0x80123, 0x80125, 0x80127, 0x80129, 0x8012b, 0x8012d, + 0x8012f, 0x80131, 0x80133, 0x80135, 0x80137, 0x80138, 0x8013a, 0x8013c, 0x8013e, + 0x80140, 0x80142, 0x80144, 0x80146, 0x80148, 0x80149, 0x8014b, 0x8014d, 0x8014f, + 0x80151, 0x80153, 0x80155, 0x80157, 0x80159, 0x8015b, 0x8015d, 0x8015f, 0x80161, + 0x80163, 0x80165, 0x80167, 0x80169, 0x8016b, 0x8016d, 0x8016f, 0x80171, 0x80173, + 0x80175, 0x80177, 0x8017a, 0x8017c, 0x80183, 0x80185, 0x80188, 0x8018c, 0x8018d, + 0x80192, 0x80195, 0x8019e, 0x801a1, 0x801a3, 0x801a5, 0x801a8, 0x801aa, 0x801ab, + 0x801ad, 0x801b0, 0x801b4, 0x801b6, 0x801b9, 0x801ba, 0x801c6, 0x801c9, 0x801cc, + 0x801ce, 0x801d0, 0x801d2, 0x801d4, 0x801d6, 0x801d8, 0x801da, 0x801dc, 0x801dd, + 0x801df, 0x801e1, 0x801e3, 0x801e5, 0x801e7, 0x801e9, 0x801eb, 0x801ed, 0x801ef, + 0x801f0, 0x801f3, 0x801f5, 0x801f9, 0x801fb, 0x801fd, 0x801ff, 0x80201, 0x80203, + 0x80205, 0x80207, 0x80209, 0x8020b, 0x8020d, 0x8020f, 0x80211, 0x80213, 0x80215, + 0x80217, 0x80219, 0x8021b, 0x8021d, 0x8021f, 0x80221, 0x80223, 0x80225, 0x80227, + 0x80229, 0x8022b, 0x8022d, 0x8022f, 0x80231, 0x8023c, 0x8023f, 0x80240, 0x80242, + 0x80247, 0x80249, 0x8024b, 0x8024d, 0x80371, 0x80373, 0x80377, 0x80390, 0x803d0, + 0x803d1, 0x803d9, 0x803db, 0x803dd, 0x803df, 0x803e1, 0x803e3, 0x803e5, 0x803e7, + 0x803e9, 0x803eb, 0x803ed, 0x803f5, 0x803f8, 0x803fb, 0x803fc, 0x80461, 0x80463, + 0x80465, 0x80467, 0x80469, 0x8046b, 0x8046d, 0x8046f, 0x80471, 0x80473, 0x80475, + 0x80477, 0x80479, 0x8047b, 0x8047d, 0x8047f, 0x80481, 0x8048b, 0x8048d, 0x8048f, + 0x80491, 0x80493, 0x80495, 0x80497, 0x80499, 0x8049b, 0x8049d, 0x8049f, 0x804a1, + 0x804a3, 0x804a5, 0x804a7, 0x804a9, 0x804ab, 0x804ad, 0x804af, 0x804b1, 0x804b3, + 0x804b5, 0x804b7, 0x804b9, 0x804bb, 0x804bd, 0x804bf, 0x804c2, 0x804c4, 0x804c6, + 0x804c8, 0x804ca, 0x804cc, 0x804ce, 0x804cf, 0x804d1, 0x804d3, 0x804d5, 0x804d7, + 0x804d9, 0x804db, 0x804dd, 0x804df, 0x804e1, 0x804e3, 0x804e5, 0x804e7, 0x804e9, + 0x804eb, 0x804ed, 0x804ef, 0x804f1, 0x804f3, 0x804f5, 0x804f7, 0x804f9, 0x804fb, + 0x804fd, 0x804ff, 0x80501, 0x80503, 0x80505, 0x80507, 0x80509, 0x8050b, 0x8050d, + 0x8050f, 0x80511, 0x80513, 0x80515, 0x80517, 0x80519, 0x8051b, 0x8051d, 0x8051f, + 0x80521, 0x80523, 0x80525, 0x80527, 0x80529, 0x8052b, 0x8052d, 0x8052f, 0x81e01, + 0x81e03, 0x81e05, 0x81e07, 0x81e09, 0x81e0b, 0x81e0d, 0x81e0f, 0x81e11, 0x81e13, + 0x81e15, 0x81e17, 0x81e19, 0x81e1b, 0x81e1d, 0x81e1f, 0x81e21, 0x81e23, 0x81e25, + 0x81e27, 0x81e29, 0x81e2b, 0x81e2d, 0x81e2f, 0x81e31, 0x81e33, 0x81e35, 0x81e37, + 0x81e39, 0x81e3b, 0x81e3d, 0x81e3f, 0x81e41, 0x81e43, 0x81e45, 0x81e47, 0x81e49, + 0x81e4b, 0x81e4d, 0x81e4f, 0x81e51, 0x81e53, 0x81e55, 0x81e57, 0x81e59, 0x81e5b, + 0x81e5d, 0x81e5f, 0x81e61, 0x81e63, 0x81e65, 0x81e67, 0x81e69, 0x81e6b, 0x81e6d, + 0x81e6f, 0x81e71, 0x81e73, 0x81e75, 0x81e77, 0x81e79, 0x81e7b, 0x81e7d, 0x81e7f, + 0x81e81, 0x81e83, 0x81e85, 0x81e87, 0x81e89, 0x81e8b, 0x81e8d, 0x81e8f, 0x81e91, + 0x81e93, 0x81e9f, 0x81ea1, 0x81ea3, 0x81ea5, 0x81ea7, 0x81ea9, 0x81eab, 0x81ead, + 0x81eaf, 0x81eb1, 0x81eb3, 0x81eb5, 0x81eb7, 0x81eb9, 0x81ebb, 0x81ebd, 0x81ebf, + 0x81ec1, 0x81ec3, 0x81ec5, 0x81ec7, 0x81ec9, 0x81ecb, 0x81ecd, 0x81ecf, 0x81ed1, + 0x81ed3, 0x81ed5, 0x81ed7, 0x81ed9, 0x81edb, 0x81edd, 0x81edf, 0x81ee1, 0x81ee3, + 0x81ee5, 0x81ee7, 0x81ee9, 0x81eeb, 0x81eed, 0x81eef, 0x81ef1, 0x81ef3, 0x81ef5, + 0x81ef7, 0x81ef9, 0x81efb, 0x81efd, 0x81fb6, 0x81fb7, 0x81fbe, 0x81fc6, 0x81fc7, + 0x81fd6, 0x81fd7, 0x81ff6, 0x81ff7, 0x8210a, 0x8210e, 0x8210f, 0x82113, 0x8212f, + 0x82134, 0x82139, 0x8213c, 0x8213d, 0x8214e, 0x82184, 0x82c61, 0x82c65, 0x82c66, + 0x82c68, 0x82c6a, 0x82c6c, 0x82c71, 0x82c73, 0x82c74, 0x82c81, 0x82c83, 0x82c85, + 0x82c87, 0x82c89, 0x82c8b, 0x82c8d, 0x82c8f, 0x82c91, 0x82c93, 0x82c95, 0x82c97, + 0x82c99, 0x82c9b, 0x82c9d, 0x82c9f, 0x82ca1, 0x82ca3, 0x82ca5, 0x82ca7, 0x82ca9, + 0x82cab, 0x82cad, 0x82caf, 0x82cb1, 0x82cb3, 0x82cb5, 0x82cb7, 0x82cb9, 0x82cbb, + 0x82cbd, 0x82cbf, 0x82cc1, 0x82cc3, 0x82cc5, 0x82cc7, 0x82cc9, 0x82ccb, 0x82ccd, + 0x82ccf, 0x82cd1, 0x82cd3, 0x82cd5, 0x82cd7, 0x82cd9, 0x82cdb, 0x82cdd, 0x82cdf, + 0x82ce1, 0x82ce3, 0x82ce4, 0x82cec, 0x82cee, 0x82cf3, 0x82d27, 0x82d2d, 0x8a641, + 0x8a643, 0x8a645, 0x8a647, 0x8a649, 0x8a64b, 0x8a64d, 0x8a64f, 0x8a651, 0x8a653, + 0x8a655, 0x8a657, 0x8a659, 0x8a65b, 0x8a65d, 0x8a65f, 0x8a661, 0x8a663, 0x8a665, + 0x8a667, 0x8a669, 0x8a66b, 0x8a66d, 0x8a681, 0x8a683, 0x8a685, 0x8a687, 0x8a689, + 0x8a68b, 0x8a68d, 0x8a68f, 0x8a691, 0x8a693, 0x8a695, 0x8a697, 0x8a699, 0x8a69b, + 0x8a723, 0x8a725, 0x8a727, 0x8a729, 0x8a72b, 0x8a72d, 0x8a733, 0x8a735, 0x8a737, + 0x8a739, 0x8a73b, 0x8a73d, 0x8a73f, 0x8a741, 0x8a743, 0x8a745, 0x8a747, 0x8a749, + 0x8a74b, 0x8a74d, 0x8a74f, 0x8a751, 0x8a753, 0x8a755, 0x8a757, 0x8a759, 0x8a75b, + 0x8a75d, 0x8a75f, 0x8a761, 0x8a763, 0x8a765, 0x8a767, 0x8a769, 0x8a76b, 0x8a76d, + 0x8a76f, 0x8a77a, 0x8a77c, 0x8a77f, 0x8a781, 0x8a783, 0x8a785, 0x8a787, 0x8a78c, + 0x8a78e, 0x8a791, 0x8a797, 0x8a799, 0x8a79b, 0x8a79d, 0x8a79f, 0x8a7a1, 0x8a7a3, + 0x8a7a5, 0x8a7a7, 0x8a7a9, 0x8a7b5, 0x8a7b7, 0x8a7fa, 0x900b5, 0x90101, 0x90103, + 0x90105, 0x90107, 0x90109, 0x9010b, 0x9010d, 0x9010f, 0x90111, 0x90113, 0x90115, + 0x90117, 0x90119, 0x9011b, 0x9011d, 0x9011f, 0x90121, 0x90123, 0x90125, 0x90127, + 0x90129, 0x9012b, 0x9012d, 0x9012f, 0x90131, 0x90133, 0x90135, 0x90137, 0x90138, + 0x9013a, 0x9013c, 0x9013e, 0x90140, 0x90142, 0x90144, 0x90146, 0x90148, 0x90149, + 0x9014b, 0x9014d, 0x9014f, 0x90151, 0x90153, 0x90155, 0x90157, 0x90159, 0x9015b, + 0x9015d, 0x9015f, 0x90161, 0x90163, 0x90165, 0x90167, 0x90169, 0x9016b, 0x9016d, + 0x9016f, 0x90171, 0x90173, 0x90175, 0x90177, 0x9017a, 0x9017c, 0x90183, 0x90185, + 0x90188, 0x9018c, 0x9018d, 0x90192, 0x90195, 0x9019e, 0x901a1, 0x901a3, 0x901a5, + 0x901a8, 0x901aa, 0x901ab, 0x901ad, 0x901b0, 0x901b4, 0x901b6, 0x901b9, 0x901ba, + 0x901c6, 0x901c9, 0x901cc, 0x901ce, 0x901d0, 0x901d2, 0x901d4, 0x901d6, 0x901d8, + 0x901da, 0x901dc, 0x901dd, 0x901df, 0x901e1, 0x901e3, 0x901e5, 0x901e7, 0x901e9, + 0x901eb, 0x901ed, 0x901ef, 0x901f0, 0x901f3, 0x901f5, 0x901f9, 0x901fb, 0x901fd, + 0x901ff, 0x90201, 0x90203, 0x90205, 0x90207, 0x90209, 0x9020b, 0x9020d, 0x9020f, + 0x90211, 0x90213, 0x90215, 0x90217, 0x90219, 0x9021b, 0x9021d, 0x9021f, 0x90221, + 0x90223, 0x90225, 0x90227, 0x90229, 0x9022b, 0x9022d, 0x9022f, 0x90231, 0x9023c, + 0x9023f, 0x90240, 0x90242, 0x90247, 0x90249, 0x9024b, 0x9024d, 0x90371, 0x90373, + 0x90377, 0x90390, 0x903d0, 0x903d1, 0x903d9, 0x903db, 0x903dd, 0x903df, 0x903e1, + 0x903e3, 0x903e5, 0x903e7, 0x903e9, 0x903eb, 0x903ed, 0x903f5, 0x903f8, 0x903fb, + 0x903fc, 0x90461, 0x90463, 0x90465, 0x90467, 0x90469, 0x9046b, 0x9046d, 0x9046f, + 0x90471, 0x90473, 0x90475, 0x90477, 0x90479, 0x9047b, 0x9047d, 0x9047f, 0x90481, + 0x9048b, 0x9048d, 0x9048f, 0x90491, 0x90493, 0x90495, 0x90497, 0x90499, 0x9049b, + 0x9049d, 0x9049f, 0x904a1, 0x904a3, 0x904a5, 0x904a7, 0x904a9, 0x904ab, 0x904ad, + 0x904af, 0x904b1, 0x904b3, 0x904b5, 0x904b7, 0x904b9, 0x904bb, 0x904bd, 0x904bf, + 0x904c2, 0x904c4, 0x904c6, 0x904c8, 0x904ca, 0x904cc, 0x904ce, 0x904cf, 0x904d1, + 0x904d3, 0x904d5, 0x904d7, 0x904d9, 0x904db, 0x904dd, 0x904df, 0x904e1, 0x904e3, + 0x904e5, 0x904e7, 0x904e9, 0x904eb, 0x904ed, 0x904ef, 0x904f1, 0x904f3, 0x904f5, + 0x904f7, 0x904f9, 0x904fb, 0x904fd, 0x904ff, 0x90501, 0x90503, 0x90505, 0x90507, + 0x90509, 0x9050b, 0x9050d, 0x9050f, 0x90511, 0x90513, 0x90515, 0x90517, 0x90519, + 0x9051b, 0x9051d, 0x9051f, 0x90521, 0x90523, 0x90525, 0x90527, 0x90529, 0x9052b, + 0x9052d, 0x9052f, 0x91e01, 0x91e03, 0x91e05, 0x91e07, 0x91e09, 0x91e0b, 0x91e0d, + 0x91e0f, 0x91e11, 0x91e13, 0x91e15, 0x91e17, 0x91e19, 0x91e1b, 0x91e1d, 0x91e1f, + 0x91e21, 0x91e23, 0x91e25, 0x91e27, 0x91e29, 0x91e2b, 0x91e2d, 0x91e2f, 0x91e31, + 0x91e33, 0x91e35, 0x91e37, 0x91e39, 0x91e3b, 0x91e3d, 0x91e3f, 0x91e41, 0x91e43, + 0x91e45, 0x91e47, 0x91e49, 0x91e4b, 0x91e4d, 0x91e4f, 0x91e51, 0x91e53, 0x91e55, + 0x91e57, 0x91e59, 0x91e5b, 0x91e5d, 0x91e5f, 0x91e61, 0x91e63, 0x91e65, 0x91e67, + 0x91e69, 0x91e6b, 0x91e6d, 0x91e6f, 0x91e71, 0x91e73, 0x91e75, 0x91e77, 0x91e79, + 0x91e7b, 0x91e7d, 0x91e7f, 0x91e81, 0x91e83, 0x91e85, 0x91e87, 0x91e89, 0x91e8b, + 0x91e8d, 0x91e8f, 0x91e91, 0x91e93, 0x91e9f, 0x91ea1, 0x91ea3, 0x91ea5, 0x91ea7, + 0x91ea9, 0x91eab, 0x91ead, 0x91eaf, 0x91eb1, 0x91eb3, 0x91eb5, 0x91eb7, 0x91eb9, + 0x91ebb, 0x91ebd, 0x91ebf, 0x91ec1, 0x91ec3, 0x91ec5, 0x91ec7, 0x91ec9, 0x91ecb, + 0x91ecd, 0x91ecf, 0x91ed1, 0x91ed3, 0x91ed5, 0x91ed7, 0x91ed9, 0x91edb, 0x91edd, + 0x91edf, 0x91ee1, 0x91ee3, 0x91ee5, 0x91ee7, 0x91ee9, 0x91eeb, 0x91eed, 0x91eef, + 0x91ef1, 0x91ef3, 0x91ef5, 0x91ef7, 0x91ef9, 0x91efb, 0x91efd, 0x91fb6, 0x91fb7, + 0x91fbe, 0x91fc6, 0x91fc7, 0x91fd6, 0x91fd7, 0x91ff6, 0x91ff7, 0x9210a, 0x9210e, + 0x9210f, 0x92113, 0x9212f, 0x92134, 0x92139, 0x9213c, 0x9213d, 0x9214e, 0x92184, + 0x92c61, 0x92c65, 0x92c66, 0x92c68, 0x92c6a, 0x92c6c, 0x92c71, 0x92c73, 0x92c74, + 0x92c81, 0x92c83, 0x92c85, 0x92c87, 0x92c89, 0x92c8b, 0x92c8d, 0x92c8f, 0x92c91, + 0x92c93, 0x92c95, 0x92c97, 0x92c99, 0x92c9b, 0x92c9d, 0x92c9f, 0x92ca1, 0x92ca3, + 0x92ca5, 0x92ca7, 0x92ca9, 0x92cab, 0x92cad, 0x92caf, 0x92cb1, 0x92cb3, 0x92cb5, + 0x92cb7, 0x92cb9, 0x92cbb, 0x92cbd, 0x92cbf, 0x92cc1, 0x92cc3, 0x92cc5, 0x92cc7, + 0x92cc9, 0x92ccb, 0x92ccd, 0x92ccf, 0x92cd1, 0x92cd3, 0x92cd5, 0x92cd7, 0x92cd9, + 0x92cdb, 0x92cdd, 0x92cdf, 0x92ce1, 0x92ce3, 0x92ce4, 0x92cec, 0x92cee, 0x92cf3, + 0x92d27, 0x92d2d, 0x9a641, 0x9a643, 0x9a645, 0x9a647, 0x9a649, 0x9a64b, 0x9a64d, + 0x9a64f, 0x9a651, 0x9a653, 0x9a655, 0x9a657, 0x9a659, 0x9a65b, 0x9a65d, 0x9a65f, + 0x9a661, 0x9a663, 0x9a665, 0x9a667, 0x9a669, 0x9a66b, 0x9a66d, 0x9a681, 0x9a683, + 0x9a685, 0x9a687, 0x9a689, 0x9a68b, 0x9a68d, 0x9a68f, 0x9a691, 0x9a693, 0x9a695, + 0x9a697, 0x9a699, 0x9a69b, 0x9a723, 0x9a725, 0x9a727, 0x9a729, 0x9a72b, 0x9a72d, + 0x9a733, 0x9a735, 0x9a737, 0x9a739, 0x9a73b, 0x9a73d, 0x9a73f, 0x9a741, 0x9a743, + 0x9a745, 0x9a747, 0x9a749, 0x9a74b, 0x9a74d, 0x9a74f, 0x9a751, 0x9a753, 0x9a755, + 0x9a757, 0x9a759, 0x9a75b, 0x9a75d, 0x9a75f, 0x9a761, 0x9a763, 0x9a765, 0x9a767, + 0x9a769, 0x9a76b, 0x9a76d, 0x9a76f, 0x9a77a, 0x9a77c, 0x9a77f, 0x9a781, 0x9a783, + 0x9a785, 0x9a787, 0x9a78c, 0x9a78e, 0x9a791, 0x9a797, 0x9a799, 0x9a79b, 0x9a79d, + 0x9a79f, 0x9a7a1, 0x9a7a3, 0x9a7a5, 0x9a7a7, 0x9a7a9, 0x9a7b5, 0x9a7b7, 0x9a7fa, + 0xa00b5, 0xa0101, 0xa0103, 0xa0105, 0xa0107, 0xa0109, 0xa010b, 0xa010d, 0xa010f, + 0xa0111, 0xa0113, 0xa0115, 0xa0117, 0xa0119, 0xa011b, 0xa011d, 0xa011f, 0xa0121, + 0xa0123, 0xa0125, 0xa0127, 0xa0129, 0xa012b, 0xa012d, 0xa012f, 0xa0131, 0xa0133, + 0xa0135, 0xa0137, 0xa0138, 0xa013a, 0xa013c, 0xa013e, 0xa0140, 0xa0142, 0xa0144, + 0xa0146, 0xa0148, 0xa0149, 0xa014b, 0xa014d, 0xa014f, 0xa0151, 0xa0153, 0xa0155, + 0xa0157, 0xa0159, 0xa015b, 0xa015d, 0xa015f, 0xa0161, 0xa0163, 0xa0165, 0xa0167, + 0xa0169, 0xa016b, 0xa016d, 0xa016f, 0xa0171, 0xa0173, 0xa0175, 0xa0177, 0xa017a, + 0xa017c, 0xa0183, 0xa0185, 0xa0188, 0xa018c, 0xa018d, 0xa0192, 0xa0195, 0xa019e, + 0xa01a1, 0xa01a3, 0xa01a5, 0xa01a8, 0xa01aa, 0xa01ab, 0xa01ad, 0xa01b0, 0xa01b4, + 0xa01b6, 0xa01b9, 0xa01ba, 0xa01c6, 0xa01c9, 0xa01cc, 0xa01ce, 0xa01d0, 0xa01d2, + 0xa01d4, 0xa01d6, 0xa01d8, 0xa01da, 0xa01dc, 0xa01dd, 0xa01df, 0xa01e1, 0xa01e3, + 0xa01e5, 0xa01e7, 0xa01e9, 0xa01eb, 0xa01ed, 0xa01ef, 0xa01f0, 0xa01f3, 0xa01f5, + 0xa01f9, 0xa01fb, 0xa01fd, 0xa01ff, 0xa0201, 0xa0203, 0xa0205, 0xa0207, 0xa0209, + 0xa020b, 0xa020d, 0xa020f, 0xa0211, 0xa0213, 0xa0215, 0xa0217, 0xa0219, 0xa021b, + 0xa021d, 0xa021f, 0xa0221, 0xa0223, 0xa0225, 0xa0227, 0xa0229, 0xa022b, 0xa022d, + 0xa022f, 0xa0231, 0xa023c, 0xa023f, 0xa0240, 0xa0242, 0xa0247, 0xa0249, 0xa024b, + 0xa024d, 0xa0371, 0xa0373, 0xa0377, 0xa0390, 0xa03d0, 0xa03d1, 0xa03d9, 0xa03db, + 0xa03dd, 0xa03df, 0xa03e1, 0xa03e3, 0xa03e5, 0xa03e7, 0xa03e9, 0xa03eb, 0xa03ed, + 0xa03f5, 0xa03f8, 0xa03fb, 0xa03fc, 0xa0461, 0xa0463, 0xa0465, 0xa0467, 0xa0469, + 0xa046b, 0xa046d, 0xa046f, 0xa0471, 0xa0473, 0xa0475, 0xa0477, 0xa0479, 0xa047b, + 0xa047d, 0xa047f, 0xa0481, 0xa048b, 0xa048d, 0xa048f, 0xa0491, 0xa0493, 0xa0495, + 0xa0497, 0xa0499, 0xa049b, 0xa049d, 0xa049f, 0xa04a1, 0xa04a3, 0xa04a5, 0xa04a7, + 0xa04a9, 0xa04ab, 0xa04ad, 0xa04af, 0xa04b1, 0xa04b3, 0xa04b5, 0xa04b7, 0xa04b9, + 0xa04bb, 0xa04bd, 0xa04bf, 0xa04c2, 0xa04c4, 0xa04c6, 0xa04c8, 0xa04ca, 0xa04cc, + 0xa04ce, 0xa04cf, 0xa04d1, 0xa04d3, 0xa04d5, 0xa04d7, 0xa04d9, 0xa04db, 0xa04dd, + 0xa04df, 0xa04e1, 0xa04e3, 0xa04e5, 0xa04e7, 0xa04e9, 0xa04eb, 0xa04ed, 0xa04ef, + 0xa04f1, 0xa04f3, 0xa04f5, 0xa04f7, 0xa04f9, 0xa04fb, 0xa04fd, 0xa04ff, 0xa0501, + 0xa0503, 0xa0505, 0xa0507, 0xa0509, 0xa050b, 0xa050d, 0xa050f, 0xa0511, 0xa0513, + 0xa0515, 0xa0517, 0xa0519, 0xa051b, 0xa051d, 0xa051f, 0xa0521, 0xa0523, 0xa0525, + 0xa0527, 0xa0529, 0xa052b, 0xa052d, 0xa052f, 0xa1e01, 0xa1e03, 0xa1e05, 0xa1e07, + 0xa1e09, 0xa1e0b, 0xa1e0d, 0xa1e0f, 0xa1e11, 0xa1e13, 0xa1e15, 0xa1e17, 0xa1e19, + 0xa1e1b, 0xa1e1d, 0xa1e1f, 0xa1e21, 0xa1e23, 0xa1e25, 0xa1e27, 0xa1e29, 0xa1e2b, + 0xa1e2d, 0xa1e2f, 0xa1e31, 0xa1e33, 0xa1e35, 0xa1e37, 0xa1e39, 0xa1e3b, 0xa1e3d, + 0xa1e3f, 0xa1e41, 0xa1e43, 0xa1e45, 0xa1e47, 0xa1e49, 0xa1e4b, 0xa1e4d, 0xa1e4f, + 0xa1e51, 0xa1e53, 0xa1e55, 0xa1e57, 0xa1e59, 0xa1e5b, 0xa1e5d, 0xa1e5f, 0xa1e61, + 0xa1e63, 0xa1e65, 0xa1e67, 0xa1e69, 0xa1e6b, 0xa1e6d, 0xa1e6f, 0xa1e71, 0xa1e73, + 0xa1e75, 0xa1e77, 0xa1e79, 0xa1e7b, 0xa1e7d, 0xa1e7f, 0xa1e81, 0xa1e83, 0xa1e85, + 0xa1e87, 0xa1e89, 0xa1e8b, 0xa1e8d, 0xa1e8f, 0xa1e91, 0xa1e93, 0xa1e9f, 0xa1ea1, + 0xa1ea3, 0xa1ea5, 0xa1ea7, 0xa1ea9, 0xa1eab, 0xa1ead, 0xa1eaf, 0xa1eb1, 0xa1eb3, + 0xa1eb5, 0xa1eb7, 0xa1eb9, 0xa1ebb, 0xa1ebd, 0xa1ebf, 0xa1ec1, 0xa1ec3, 0xa1ec5, + 0xa1ec7, 0xa1ec9, 0xa1ecb, 0xa1ecd, 0xa1ecf, 0xa1ed1, 0xa1ed3, 0xa1ed5, 0xa1ed7, + 0xa1ed9, 0xa1edb, 0xa1edd, 0xa1edf, 0xa1ee1, 0xa1ee3, 0xa1ee5, 0xa1ee7, 0xa1ee9, + 0xa1eeb, 0xa1eed, 0xa1eef, 0xa1ef1, 0xa1ef3, 0xa1ef5, 0xa1ef7, 0xa1ef9, 0xa1efb, + 0xa1efd, 0xa1fb6, 0xa1fb7, 0xa1fbe, 0xa1fc6, 0xa1fc7, 0xa1fd6, 0xa1fd7, 0xa1ff6, + 0xa1ff7, 0xa210a, 0xa210e, 0xa210f, 0xa2113, 0xa212f, 0xa2134, 0xa2139, 0xa213c, + 0xa213d, 0xa214e, 0xa2184, 0xa2c61, 0xa2c65, 0xa2c66, 0xa2c68, 0xa2c6a, 0xa2c6c, + 0xa2c71, 0xa2c73, 0xa2c74, 0xa2c81, 0xa2c83, 0xa2c85, 0xa2c87, 0xa2c89, 0xa2c8b, + 0xa2c8d, 0xa2c8f, 0xa2c91, 0xa2c93, 0xa2c95, 0xa2c97, 0xa2c99, 0xa2c9b, 0xa2c9d, + 0xa2c9f, 0xa2ca1, 0xa2ca3, 0xa2ca5, 0xa2ca7, 0xa2ca9, 0xa2cab, 0xa2cad, 0xa2caf, + 0xa2cb1, 0xa2cb3, 0xa2cb5, 0xa2cb7, 0xa2cb9, 0xa2cbb, 0xa2cbd, 0xa2cbf, 0xa2cc1, + 0xa2cc3, 0xa2cc5, 0xa2cc7, 0xa2cc9, 0xa2ccb, 0xa2ccd, 0xa2ccf, 0xa2cd1, 0xa2cd3, + 0xa2cd5, 0xa2cd7, 0xa2cd9, 0xa2cdb, 0xa2cdd, 0xa2cdf, 0xa2ce1, 0xa2ce3, 0xa2ce4, + 0xa2cec, 0xa2cee, 0xa2cf3, 0xa2d27, 0xa2d2d, 0xaa641, 0xaa643, 0xaa645, 0xaa647, + 0xaa649, 0xaa64b, 0xaa64d, 0xaa64f, 0xaa651, 0xaa653, 0xaa655, 0xaa657, 0xaa659, + 0xaa65b, 0xaa65d, 0xaa65f, 0xaa661, 0xaa663, 0xaa665, 0xaa667, 0xaa669, 0xaa66b, + 0xaa66d, 0xaa681, 0xaa683, 0xaa685, 0xaa687, 0xaa689, 0xaa68b, 0xaa68d, 0xaa68f, + 0xaa691, 0xaa693, 0xaa695, 0xaa697, 0xaa699, 0xaa69b, 0xaa723, 0xaa725, 0xaa727, + 0xaa729, 0xaa72b, 0xaa72d, 0xaa733, 0xaa735, 0xaa737, 0xaa739, 0xaa73b, 0xaa73d, + 0xaa73f, 0xaa741, 0xaa743, 0xaa745, 0xaa747, 0xaa749, 0xaa74b, 0xaa74d, 0xaa74f, + 0xaa751, 0xaa753, 0xaa755, 0xaa757, 0xaa759, 0xaa75b, 0xaa75d, 0xaa75f, 0xaa761, + 0xaa763, 0xaa765, 0xaa767, 0xaa769, 0xaa76b, 0xaa76d, 0xaa76f, 0xaa77a, 0xaa77c, + 0xaa77f, 0xaa781, 0xaa783, 0xaa785, 0xaa787, 0xaa78c, 0xaa78e, 0xaa791, 0xaa797, + 0xaa799, 0xaa79b, 0xaa79d, 0xaa79f, 0xaa7a1, 0xaa7a3, 0xaa7a5, 0xaa7a7, 0xaa7a9, + 0xaa7b5, 0xaa7b7, 0xaa7fa, 0xb00b5, 0xb0101, 0xb0103, 0xb0105, 0xb0107, 0xb0109, + 0xb010b, 0xb010d, 0xb010f, 0xb0111, 0xb0113, 0xb0115, 0xb0117, 0xb0119, 0xb011b, + 0xb011d, 0xb011f, 0xb0121, 0xb0123, 0xb0125, 0xb0127, 0xb0129, 0xb012b, 0xb012d, + 0xb012f, 0xb0131, 0xb0133, 0xb0135, 0xb0137, 0xb0138, 0xb013a, 0xb013c, 0xb013e, + 0xb0140, 0xb0142, 0xb0144, 0xb0146, 0xb0148, 0xb0149, 0xb014b, 0xb014d, 0xb014f, + 0xb0151, 0xb0153, 0xb0155, 0xb0157, 0xb0159, 0xb015b, 0xb015d, 0xb015f, 0xb0161, + 0xb0163, 0xb0165, 0xb0167, 0xb0169, 0xb016b, 0xb016d, 0xb016f, 0xb0171, 0xb0173, + 0xb0175, 0xb0177, 0xb017a, 0xb017c, 0xb0183, 0xb0185, 0xb0188, 0xb018c, 0xb018d, + 0xb0192, 0xb0195, 0xb019e, 0xb01a1, 0xb01a3, 0xb01a5, 0xb01a8, 0xb01aa, 0xb01ab, + 0xb01ad, 0xb01b0, 0xb01b4, 0xb01b6, 0xb01b9, 0xb01ba, 0xb01c6, 0xb01c9, 0xb01cc, + 0xb01ce, 0xb01d0, 0xb01d2, 0xb01d4, 0xb01d6, 0xb01d8, 0xb01da, 0xb01dc, 0xb01dd, + 0xb01df, 0xb01e1, 0xb01e3, 0xb01e5, 0xb01e7, 0xb01e9, 0xb01eb, 0xb01ed, 0xb01ef, + 0xb01f0, 0xb01f3, 0xb01f5, 0xb01f9, 0xb01fb, 0xb01fd, 0xb01ff, 0xb0201, 0xb0203, + 0xb0205, 0xb0207, 0xb0209, 0xb020b, 0xb020d, 0xb020f, 0xb0211, 0xb0213, 0xb0215, + 0xb0217, 0xb0219, 0xb021b, 0xb021d, 0xb021f, 0xb0221, 0xb0223, 0xb0225, 0xb0227, + 0xb0229, 0xb022b, 0xb022d, 0xb022f, 0xb0231, 0xb023c, 0xb023f, 0xb0240, 0xb0242, + 0xb0247, 0xb0249, 0xb024b, 0xb024d, 0xb0371, 0xb0373, 0xb0377, 0xb0390, 0xb03d0, + 0xb03d1, 0xb03d9, 0xb03db, 0xb03dd, 0xb03df, 0xb03e1, 0xb03e3, 0xb03e5, 0xb03e7, + 0xb03e9, 0xb03eb, 0xb03ed, 0xb03f5, 0xb03f8, 0xb03fb, 0xb03fc, 0xb0461, 0xb0463, + 0xb0465, 0xb0467, 0xb0469, 0xb046b, 0xb046d, 0xb046f, 0xb0471, 0xb0473, 0xb0475, + 0xb0477, 0xb0479, 0xb047b, 0xb047d, 0xb047f, 0xb0481, 0xb048b, 0xb048d, 0xb048f, + 0xb0491, 0xb0493, 0xb0495, 0xb0497, 0xb0499, 0xb049b, 0xb049d, 0xb049f, 0xb04a1, + 0xb04a3, 0xb04a5, 0xb04a7, 0xb04a9, 0xb04ab, 0xb04ad, 0xb04af, 0xb04b1, 0xb04b3, + 0xb04b5, 0xb04b7, 0xb04b9, 0xb04bb, 0xb04bd, 0xb04bf, 0xb04c2, 0xb04c4, 0xb04c6, + 0xb04c8, 0xb04ca, 0xb04cc, 0xb04ce, 0xb04cf, 0xb04d1, 0xb04d3, 0xb04d5, 0xb04d7, + 0xb04d9, 0xb04db, 0xb04dd, 0xb04df, 0xb04e1, 0xb04e3, 0xb04e5, 0xb04e7, 0xb04e9, + 0xb04eb, 0xb04ed, 0xb04ef, 0xb04f1, 0xb04f3, 0xb04f5, 0xb04f7, 0xb04f9, 0xb04fb, + 0xb04fd, 0xb04ff, 0xb0501, 0xb0503, 0xb0505, 0xb0507, 0xb0509, 0xb050b, 0xb050d, + 0xb050f, 0xb0511, 0xb0513, 0xb0515, 0xb0517, 0xb0519, 0xb051b, 0xb051d, 0xb051f, + 0xb0521, 0xb0523, 0xb0525, 0xb0527, 0xb0529, 0xb052b, 0xb052d, 0xb052f, 0xb1e01, + 0xb1e03, 0xb1e05, 0xb1e07, 0xb1e09, 0xb1e0b, 0xb1e0d, 0xb1e0f, 0xb1e11, 0xb1e13, + 0xb1e15, 0xb1e17, 0xb1e19, 0xb1e1b, 0xb1e1d, 0xb1e1f, 0xb1e21, 0xb1e23, 0xb1e25, + 0xb1e27, 0xb1e29, 0xb1e2b, 0xb1e2d, 0xb1e2f, 0xb1e31, 0xb1e33, 0xb1e35, 0xb1e37, + 0xb1e39, 0xb1e3b, 0xb1e3d, 0xb1e3f, 0xb1e41, 0xb1e43, 0xb1e45, 0xb1e47, 0xb1e49, + 0xb1e4b, 0xb1e4d, 0xb1e4f, 0xb1e51, 0xb1e53, 0xb1e55, 0xb1e57, 0xb1e59, 0xb1e5b, + 0xb1e5d, 0xb1e5f, 0xb1e61, 0xb1e63, 0xb1e65, 0xb1e67, 0xb1e69, 0xb1e6b, 0xb1e6d, + 0xb1e6f, 0xb1e71, 0xb1e73, 0xb1e75, 0xb1e77, 0xb1e79, 0xb1e7b, 0xb1e7d, 0xb1e7f, + 0xb1e81, 0xb1e83, 0xb1e85, 0xb1e87, 0xb1e89, 0xb1e8b, 0xb1e8d, 0xb1e8f, 0xb1e91, + 0xb1e93, 0xb1e9f, 0xb1ea1, 0xb1ea3, 0xb1ea5, 0xb1ea7, 0xb1ea9, 0xb1eab, 0xb1ead, + 0xb1eaf, 0xb1eb1, 0xb1eb3, 0xb1eb5, 0xb1eb7, 0xb1eb9, 0xb1ebb, 0xb1ebd, 0xb1ebf, + 0xb1ec1, 0xb1ec3, 0xb1ec5, 0xb1ec7, 0xb1ec9, 0xb1ecb, 0xb1ecd, 0xb1ecf, 0xb1ed1, + 0xb1ed3, 0xb1ed5, 0xb1ed7, 0xb1ed9, 0xb1edb, 0xb1edd, 0xb1edf, 0xb1ee1, 0xb1ee3, + 0xb1ee5, 0xb1ee7, 0xb1ee9, 0xb1eeb, 0xb1eed, 0xb1eef, 0xb1ef1, 0xb1ef3, 0xb1ef5, + 0xb1ef7, 0xb1ef9, 0xb1efb, 0xb1efd, 0xb1fb6, 0xb1fb7, 0xb1fbe, 0xb1fc6, 0xb1fc7, + 0xb1fd6, 0xb1fd7, 0xb1ff6, 0xb1ff7, 0xb210a, 0xb210e, 0xb210f, 0xb2113, 0xb212f, + 0xb2134, 0xb2139, 0xb213c, 0xb213d, 0xb214e, 0xb2184, 0xb2c61, 0xb2c65, 0xb2c66, + 0xb2c68, 0xb2c6a, 0xb2c6c, 0xb2c71, 0xb2c73, 0xb2c74, 0xb2c81, 0xb2c83, 0xb2c85, + 0xb2c87, 0xb2c89, 0xb2c8b, 0xb2c8d, 0xb2c8f, 0xb2c91, 0xb2c93, 0xb2c95, 0xb2c97, + 0xb2c99, 0xb2c9b, 0xb2c9d, 0xb2c9f, 0xb2ca1, 0xb2ca3, 0xb2ca5, 0xb2ca7, 0xb2ca9, + 0xb2cab, 0xb2cad, 0xb2caf, 0xb2cb1, 0xb2cb3, 0xb2cb5, 0xb2cb7, 0xb2cb9, 0xb2cbb, + 0xb2cbd, 0xb2cbf, 0xb2cc1, 0xb2cc3, 0xb2cc5, 0xb2cc7, 0xb2cc9, 0xb2ccb, 0xb2ccd, + 0xb2ccf, 0xb2cd1, 0xb2cd3, 0xb2cd5, 0xb2cd7, 0xb2cd9, 0xb2cdb, 0xb2cdd, 0xb2cdf, + 0xb2ce1, 0xb2ce3, 0xb2ce4, 0xb2cec, 0xb2cee, 0xb2cf3, 0xb2d27, 0xb2d2d, 0xba641, + 0xba643, 0xba645, 0xba647, 0xba649, 0xba64b, 0xba64d, 0xba64f, 0xba651, 0xba653, + 0xba655, 0xba657, 0xba659, 0xba65b, 0xba65d, 0xba65f, 0xba661, 0xba663, 0xba665, + 0xba667, 0xba669, 0xba66b, 0xba66d, 0xba681, 0xba683, 0xba685, 0xba687, 0xba689, + 0xba68b, 0xba68d, 0xba68f, 0xba691, 0xba693, 0xba695, 0xba697, 0xba699, 0xba69b, + 0xba723, 0xba725, 0xba727, 0xba729, 0xba72b, 0xba72d, 0xba733, 0xba735, 0xba737, + 0xba739, 0xba73b, 0xba73d, 0xba73f, 0xba741, 0xba743, 0xba745, 0xba747, 0xba749, + 0xba74b, 0xba74d, 0xba74f, 0xba751, 0xba753, 0xba755, 0xba757, 0xba759, 0xba75b, + 0xba75d, 0xba75f, 0xba761, 0xba763, 0xba765, 0xba767, 0xba769, 0xba76b, 0xba76d, + 0xba76f, 0xba77a, 0xba77c, 0xba77f, 0xba781, 0xba783, 0xba785, 0xba787, 0xba78c, + 0xba78e, 0xba791, 0xba797, 0xba799, 0xba79b, 0xba79d, 0xba79f, 0xba7a1, 0xba7a3, + 0xba7a5, 0xba7a7, 0xba7a9, 0xba7b5, 0xba7b7, 0xba7fa, 0xc00b5, 0xc0101, 0xc0103, + 0xc0105, 0xc0107, 0xc0109, 0xc010b, 0xc010d, 0xc010f, 0xc0111, 0xc0113, 0xc0115, + 0xc0117, 0xc0119, 0xc011b, 0xc011d, 0xc011f, 0xc0121, 0xc0123, 0xc0125, 0xc0127, + 0xc0129, 0xc012b, 0xc012d, 0xc012f, 0xc0131, 0xc0133, 0xc0135, 0xc0137, 0xc0138, + 0xc013a, 0xc013c, 0xc013e, 0xc0140, 0xc0142, 0xc0144, 0xc0146, 0xc0148, 0xc0149, + 0xc014b, 0xc014d, 0xc014f, 0xc0151, 0xc0153, 0xc0155, 0xc0157, 0xc0159, 0xc015b, + 0xc015d, 0xc015f, 0xc0161, 0xc0163, 0xc0165, 0xc0167, 0xc0169, 0xc016b, 0xc016d, + 0xc016f, 0xc0171, 0xc0173, 0xc0175, 0xc0177, 0xc017a, 0xc017c, 0xc0183, 0xc0185, + 0xc0188, 0xc018c, 0xc018d, 0xc0192, 0xc0195, 0xc019e, 0xc01a1, 0xc01a3, 0xc01a5, + 0xc01a8, 0xc01aa, 0xc01ab, 0xc01ad, 0xc01b0, 0xc01b4, 0xc01b6, 0xc01b9, 0xc01ba, + 0xc01c6, 0xc01c9, 0xc01cc, 0xc01ce, 0xc01d0, 0xc01d2, 0xc01d4, 0xc01d6, 0xc01d8, + 0xc01da, 0xc01dc, 0xc01dd, 0xc01df, 0xc01e1, 0xc01e3, 0xc01e5, 0xc01e7, 0xc01e9, + 0xc01eb, 0xc01ed, 0xc01ef, 0xc01f0, 0xc01f3, 0xc01f5, 0xc01f9, 0xc01fb, 0xc01fd, + 0xc01ff, 0xc0201, 0xc0203, 0xc0205, 0xc0207, 0xc0209, 0xc020b, 0xc020d, 0xc020f, + 0xc0211, 0xc0213, 0xc0215, 0xc0217, 0xc0219, 0xc021b, 0xc021d, 0xc021f, 0xc0221, + 0xc0223, 0xc0225, 0xc0227, 0xc0229, 0xc022b, 0xc022d, 0xc022f, 0xc0231, 0xc023c, + 0xc023f, 0xc0240, 0xc0242, 0xc0247, 0xc0249, 0xc024b, 0xc024d, 0xc0371, 0xc0373, + 0xc0377, 0xc0390, 0xc03d0, 0xc03d1, 0xc03d9, 0xc03db, 0xc03dd, 0xc03df, 0xc03e1, + 0xc03e3, 0xc03e5, 0xc03e7, 0xc03e9, 0xc03eb, 0xc03ed, 0xc03f5, 0xc03f8, 0xc03fb, + 0xc03fc, 0xc0461, 0xc0463, 0xc0465, 0xc0467, 0xc0469, 0xc046b, 0xc046d, 0xc046f, + 0xc0471, 0xc0473, 0xc0475, 0xc0477, 0xc0479, 0xc047b, 0xc047d, 0xc047f, 0xc0481, + 0xc048b, 0xc048d, 0xc048f, 0xc0491, 0xc0493, 0xc0495, 0xc0497, 0xc0499, 0xc049b, + 0xc049d, 0xc049f, 0xc04a1, 0xc04a3, 0xc04a5, 0xc04a7, 0xc04a9, 0xc04ab, 0xc04ad, + 0xc04af, 0xc04b1, 0xc04b3, 0xc04b5, 0xc04b7, 0xc04b9, 0xc04bb, 0xc04bd, 0xc04bf, + 0xc04c2, 0xc04c4, 0xc04c6, 0xc04c8, 0xc04ca, 0xc04cc, 0xc04ce, 0xc04cf, 0xc04d1, + 0xc04d3, 0xc04d5, 0xc04d7, 0xc04d9, 0xc04db, 0xc04dd, 0xc04df, 0xc04e1, 0xc04e3, + 0xc04e5, 0xc04e7, 0xc04e9, 0xc04eb, 0xc04ed, 0xc04ef, 0xc04f1, 0xc04f3, 0xc04f5, + 0xc04f7, 0xc04f9, 0xc04fb, 0xc04fd, 0xc04ff, 0xc0501, 0xc0503, 0xc0505, 0xc0507, + 0xc0509, 0xc050b, 0xc050d, 0xc050f, 0xc0511, 0xc0513, 0xc0515, 0xc0517, 0xc0519, + 0xc051b, 0xc051d, 0xc051f, 0xc0521, 0xc0523, 0xc0525, 0xc0527, 0xc0529, 0xc052b, + 0xc052d, 0xc052f, 0xc1e01, 0xc1e03, 0xc1e05, 0xc1e07, 0xc1e09, 0xc1e0b, 0xc1e0d, + 0xc1e0f, 0xc1e11, 0xc1e13, 0xc1e15, 0xc1e17, 0xc1e19, 0xc1e1b, 0xc1e1d, 0xc1e1f, + 0xc1e21, 0xc1e23, 0xc1e25, 0xc1e27, 0xc1e29, 0xc1e2b, 0xc1e2d, 0xc1e2f, 0xc1e31, + 0xc1e33, 0xc1e35, 0xc1e37, 0xc1e39, 0xc1e3b, 0xc1e3d, 0xc1e3f, 0xc1e41, 0xc1e43, + 0xc1e45, 0xc1e47, 0xc1e49, 0xc1e4b, 0xc1e4d, 0xc1e4f, 0xc1e51, 0xc1e53, 0xc1e55, + 0xc1e57, 0xc1e59, 0xc1e5b, 0xc1e5d, 0xc1e5f, 0xc1e61, 0xc1e63, 0xc1e65, 0xc1e67, + 0xc1e69, 0xc1e6b, 0xc1e6d, 0xc1e6f, 0xc1e71, 0xc1e73, 0xc1e75, 0xc1e77, 0xc1e79, + 0xc1e7b, 0xc1e7d, 0xc1e7f, 0xc1e81, 0xc1e83, 0xc1e85, 0xc1e87, 0xc1e89, 0xc1e8b, + 0xc1e8d, 0xc1e8f, 0xc1e91, 0xc1e93, 0xc1e9f, 0xc1ea1, 0xc1ea3, 0xc1ea5, 0xc1ea7, + 0xc1ea9, 0xc1eab, 0xc1ead, 0xc1eaf, 0xc1eb1, 0xc1eb3, 0xc1eb5, 0xc1eb7, 0xc1eb9, + 0xc1ebb, 0xc1ebd, 0xc1ebf, 0xc1ec1, 0xc1ec3, 0xc1ec5, 0xc1ec7, 0xc1ec9, 0xc1ecb, + 0xc1ecd, 0xc1ecf, 0xc1ed1, 0xc1ed3, 0xc1ed5, 0xc1ed7, 0xc1ed9, 0xc1edb, 0xc1edd, + 0xc1edf, 0xc1ee1, 0xc1ee3, 0xc1ee5, 0xc1ee7, 0xc1ee9, 0xc1eeb, 0xc1eed, 0xc1eef, + 0xc1ef1, 0xc1ef3, 0xc1ef5, 0xc1ef7, 0xc1ef9, 0xc1efb, 0xc1efd, 0xc1fb6, 0xc1fb7, + 0xc1fbe, 0xc1fc6, 0xc1fc7, 0xc1fd6, 0xc1fd7, 0xc1ff6, 0xc1ff7, 0xc210a, 0xc210e, + 0xc210f, 0xc2113, 0xc212f, 0xc2134, 0xc2139, 0xc213c, 0xc213d, 0xc214e, 0xc2184, + 0xc2c61, 0xc2c65, 0xc2c66, 0xc2c68, 0xc2c6a, 0xc2c6c, 0xc2c71, 0xc2c73, 0xc2c74, + 0xc2c81, 0xc2c83, 0xc2c85, 0xc2c87, 0xc2c89, 0xc2c8b, 0xc2c8d, 0xc2c8f, 0xc2c91, + 0xc2c93, 0xc2c95, 0xc2c97, 0xc2c99, 0xc2c9b, 0xc2c9d, 0xc2c9f, 0xc2ca1, 0xc2ca3, + 0xc2ca5, 0xc2ca7, 0xc2ca9, 0xc2cab, 0xc2cad, 0xc2caf, 0xc2cb1, 0xc2cb3, 0xc2cb5, + 0xc2cb7, 0xc2cb9, 0xc2cbb, 0xc2cbd, 0xc2cbf, 0xc2cc1, 0xc2cc3, 0xc2cc5, 0xc2cc7, + 0xc2cc9, 0xc2ccb, 0xc2ccd, 0xc2ccf, 0xc2cd1, 0xc2cd3, 0xc2cd5, 0xc2cd7, 0xc2cd9, + 0xc2cdb, 0xc2cdd, 0xc2cdf, 0xc2ce1, 0xc2ce3, 0xc2ce4, 0xc2cec, 0xc2cee, 0xc2cf3, + 0xc2d27, 0xc2d2d, 0xca641, 0xca643, 0xca645, 0xca647, 0xca649, 0xca64b, 0xca64d, + 0xca64f, 0xca651, 0xca653, 0xca655, 0xca657, 0xca659, 0xca65b, 0xca65d, 0xca65f, + 0xca661, 0xca663, 0xca665, 0xca667, 0xca669, 0xca66b, 0xca66d, 0xca681, 0xca683, + 0xca685, 0xca687, 0xca689, 0xca68b, 0xca68d, 0xca68f, 0xca691, 0xca693, 0xca695, + 0xca697, 0xca699, 0xca69b, 0xca723, 0xca725, 0xca727, 0xca729, 0xca72b, 0xca72d, + 0xca733, 0xca735, 0xca737, 0xca739, 0xca73b, 0xca73d, 0xca73f, 0xca741, 0xca743, + 0xca745, 0xca747, 0xca749, 0xca74b, 0xca74d, 0xca74f, 0xca751, 0xca753, 0xca755, + 0xca757, 0xca759, 0xca75b, 0xca75d, 0xca75f, 0xca761, 0xca763, 0xca765, 0xca767, + 0xca769, 0xca76b, 0xca76d, 0xca76f, 0xca77a, 0xca77c, 0xca77f, 0xca781, 0xca783, + 0xca785, 0xca787, 0xca78c, 0xca78e, 0xca791, 0xca797, 0xca799, 0xca79b, 0xca79d, + 0xca79f, 0xca7a1, 0xca7a3, 0xca7a5, 0xca7a7, 0xca7a9, 0xca7b5, 0xca7b7, 0xca7fa, + 0xd00b5, 0xd0101, 0xd0103, 0xd0105, 0xd0107, 0xd0109, 0xd010b, 0xd010d, 0xd010f, + 0xd0111, 0xd0113, 0xd0115, 0xd0117, 0xd0119, 0xd011b, 0xd011d, 0xd011f, 0xd0121, + 0xd0123, 0xd0125, 0xd0127, 0xd0129, 0xd012b, 0xd012d, 0xd012f, 0xd0131, 0xd0133, + 0xd0135, 0xd0137, 0xd0138, 0xd013a, 0xd013c, 0xd013e, 0xd0140, 0xd0142, 0xd0144, + 0xd0146, 0xd0148, 0xd0149, 0xd014b, 0xd014d, 0xd014f, 0xd0151, 0xd0153, 0xd0155, + 0xd0157, 0xd0159, 0xd015b, 0xd015d, 0xd015f, 0xd0161, 0xd0163, 0xd0165, 0xd0167, + 0xd0169, 0xd016b, 0xd016d, 0xd016f, 0xd0171, 0xd0173, 0xd0175, 0xd0177, 0xd017a, + 0xd017c, 0xd0183, 0xd0185, 0xd0188, 0xd018c, 0xd018d, 0xd0192, 0xd0195, 0xd019e, + 0xd01a1, 0xd01a3, 0xd01a5, 0xd01a8, 0xd01aa, 0xd01ab, 0xd01ad, 0xd01b0, 0xd01b4, + 0xd01b6, 0xd01b9, 0xd01ba, 0xd01c6, 0xd01c9, 0xd01cc, 0xd01ce, 0xd01d0, 0xd01d2, + 0xd01d4, 0xd01d6, 0xd01d8, 0xd01da, 0xd01dc, 0xd01dd, 0xd01df, 0xd01e1, 0xd01e3, + 0xd01e5, 0xd01e7, 0xd01e9, 0xd01eb, 0xd01ed, 0xd01ef, 0xd01f0, 0xd01f3, 0xd01f5, + 0xd01f9, 0xd01fb, 0xd01fd, 0xd01ff, 0xd0201, 0xd0203, 0xd0205, 0xd0207, 0xd0209, + 0xd020b, 0xd020d, 0xd020f, 0xd0211, 0xd0213, 0xd0215, 0xd0217, 0xd0219, 0xd021b, + 0xd021d, 0xd021f, 0xd0221, 0xd0223, 0xd0225, 0xd0227, 0xd0229, 0xd022b, 0xd022d, + 0xd022f, 0xd0231, 0xd023c, 0xd023f, 0xd0240, 0xd0242, 0xd0247, 0xd0249, 0xd024b, + 0xd024d, 0xd0371, 0xd0373, 0xd0377, 0xd0390, 0xd03d0, 0xd03d1, 0xd03d9, 0xd03db, + 0xd03dd, 0xd03df, 0xd03e1, 0xd03e3, 0xd03e5, 0xd03e7, 0xd03e9, 0xd03eb, 0xd03ed, + 0xd03f5, 0xd03f8, 0xd03fb, 0xd03fc, 0xd0461, 0xd0463, 0xd0465, 0xd0467, 0xd0469, + 0xd046b, 0xd046d, 0xd046f, 0xd0471, 0xd0473, 0xd0475, 0xd0477, 0xd0479, 0xd047b, + 0xd047d, 0xd047f, 0xd0481, 0xd048b, 0xd048d, 0xd048f, 0xd0491, 0xd0493, 0xd0495, + 0xd0497, 0xd0499, 0xd049b, 0xd049d, 0xd049f, 0xd04a1, 0xd04a3, 0xd04a5, 0xd04a7, + 0xd04a9, 0xd04ab, 0xd04ad, 0xd04af, 0xd04b1, 0xd04b3, 0xd04b5, 0xd04b7, 0xd04b9, + 0xd04bb, 0xd04bd, 0xd04bf, 0xd04c2, 0xd04c4, 0xd04c6, 0xd04c8, 0xd04ca, 0xd04cc, + 0xd04ce, 0xd04cf, 0xd04d1, 0xd04d3, 0xd04d5, 0xd04d7, 0xd04d9, 0xd04db, 0xd04dd, + 0xd04df, 0xd04e1, 0xd04e3, 0xd04e5, 0xd04e7, 0xd04e9, 0xd04eb, 0xd04ed, 0xd04ef, + 0xd04f1, 0xd04f3, 0xd04f5, 0xd04f7, 0xd04f9, 0xd04fb, 0xd04fd, 0xd04ff, 0xd0501, + 0xd0503, 0xd0505, 0xd0507, 0xd0509, 0xd050b, 0xd050d, 0xd050f, 0xd0511, 0xd0513, + 0xd0515, 0xd0517, 0xd0519, 0xd051b, 0xd051d, 0xd051f, 0xd0521, 0xd0523, 0xd0525, + 0xd0527, 0xd0529, 0xd052b, 0xd052d, 0xd052f, 0xd1e01, 0xd1e03, 0xd1e05, 0xd1e07, + 0xd1e09, 0xd1e0b, 0xd1e0d, 0xd1e0f, 0xd1e11, 0xd1e13, 0xd1e15, 0xd1e17, 0xd1e19, + 0xd1e1b, 0xd1e1d, 0xd1e1f, 0xd1e21, 0xd1e23, 0xd1e25, 0xd1e27, 0xd1e29, 0xd1e2b, + 0xd1e2d, 0xd1e2f, 0xd1e31, 0xd1e33, 0xd1e35, 0xd1e37, 0xd1e39, 0xd1e3b, 0xd1e3d, + 0xd1e3f, 0xd1e41, 0xd1e43, 0xd1e45, 0xd1e47, 0xd1e49, 0xd1e4b, 0xd1e4d, 0xd1e4f, + 0xd1e51, 0xd1e53, 0xd1e55, 0xd1e57, 0xd1e59, 0xd1e5b, 0xd1e5d, 0xd1e5f, 0xd1e61, + 0xd1e63, 0xd1e65, 0xd1e67, 0xd1e69, 0xd1e6b, 0xd1e6d, 0xd1e6f, 0xd1e71, 0xd1e73, + 0xd1e75, 0xd1e77, 0xd1e79, 0xd1e7b, 0xd1e7d, 0xd1e7f, 0xd1e81, 0xd1e83, 0xd1e85, + 0xd1e87, 0xd1e89, 0xd1e8b, 0xd1e8d, 0xd1e8f, 0xd1e91, 0xd1e93, 0xd1e9f, 0xd1ea1, + 0xd1ea3, 0xd1ea5, 0xd1ea7, 0xd1ea9, 0xd1eab, 0xd1ead, 0xd1eaf, 0xd1eb1, 0xd1eb3, + 0xd1eb5, 0xd1eb7, 0xd1eb9, 0xd1ebb, 0xd1ebd, 0xd1ebf, 0xd1ec1, 0xd1ec3, 0xd1ec5, + 0xd1ec7, 0xd1ec9, 0xd1ecb, 0xd1ecd, 0xd1ecf, 0xd1ed1, 0xd1ed3, 0xd1ed5, 0xd1ed7, + 0xd1ed9, 0xd1edb, 0xd1edd, 0xd1edf, 0xd1ee1, 0xd1ee3, 0xd1ee5, 0xd1ee7, 0xd1ee9, + 0xd1eeb, 0xd1eed, 0xd1eef, 0xd1ef1, 0xd1ef3, 0xd1ef5, 0xd1ef7, 0xd1ef9, 0xd1efb, + 0xd1efd, 0xd1fb6, 0xd1fb7, 0xd1fbe, 0xd1fc6, 0xd1fc7, 0xd1fd6, 0xd1fd7, 0xd1ff6, + 0xd1ff7, 0xd210a, 0xd210e, 0xd210f, 0xd2113, 0xd212f, 0xd2134, 0xd2139, 0xd213c, + 0xd213d, 0xd214e, 0xd2184, 0xd2c61, 0xd2c65, 0xd2c66, 0xd2c68, 0xd2c6a, 0xd2c6c, + 0xd2c71, 0xd2c73, 0xd2c74, 0xd2c81, 0xd2c83, 0xd2c85, 0xd2c87, 0xd2c89, 0xd2c8b, + 0xd2c8d, 0xd2c8f, 0xd2c91, 0xd2c93, 0xd2c95, 0xd2c97, 0xd2c99, 0xd2c9b, 0xd2c9d, + 0xd2c9f, 0xd2ca1, 0xd2ca3, 0xd2ca5, 0xd2ca7, 0xd2ca9, 0xd2cab, 0xd2cad, 0xd2caf, + 0xd2cb1, 0xd2cb3, 0xd2cb5, 0xd2cb7, 0xd2cb9, 0xd2cbb, 0xd2cbd, 0xd2cbf, 0xd2cc1, + 0xd2cc3, 0xd2cc5, 0xd2cc7, 0xd2cc9, 0xd2ccb, 0xd2ccd, 0xd2ccf, 0xd2cd1, 0xd2cd3, + 0xd2cd5, 0xd2cd7, 0xd2cd9, 0xd2cdb, 0xd2cdd, 0xd2cdf, 0xd2ce1, 0xd2ce3, 0xd2ce4, + 0xd2cec, 0xd2cee, 0xd2cf3, 0xd2d27, 0xd2d2d, 0xda641, 0xda643, 0xda645, 0xda647, + 0xda649, 0xda64b, 0xda64d, 0xda64f, 0xda651, 0xda653, 0xda655, 0xda657, 0xda659, + 0xda65b, 0xda65d, 0xda65f, 0xda661, 0xda663, 0xda665, 0xda667, 0xda669, 0xda66b, + 0xda66d, 0xda681, 0xda683, 0xda685, 0xda687, 0xda689, 0xda68b, 0xda68d, 0xda68f, + 0xda691, 0xda693, 0xda695, 0xda697, 0xda699, 0xda69b, 0xda723, 0xda725, 0xda727, + 0xda729, 0xda72b, 0xda72d, 0xda733, 0xda735, 0xda737, 0xda739, 0xda73b, 0xda73d, + 0xda73f, 0xda741, 0xda743, 0xda745, 0xda747, 0xda749, 0xda74b, 0xda74d, 0xda74f, + 0xda751, 0xda753, 0xda755, 0xda757, 0xda759, 0xda75b, 0xda75d, 0xda75f, 0xda761, + 0xda763, 0xda765, 0xda767, 0xda769, 0xda76b, 0xda76d, 0xda76f, 0xda77a, 0xda77c, + 0xda77f, 0xda781, 0xda783, 0xda785, 0xda787, 0xda78c, 0xda78e, 0xda791, 0xda797, + 0xda799, 0xda79b, 0xda79d, 0xda79f, 0xda7a1, 0xda7a3, 0xda7a5, 0xda7a7, 0xda7a9, + 0xda7b5, 0xda7b7, 0xda7fa, 0xe00b5, 0xe0101, 0xe0103, 0xe0105, 0xe0107, 0xe0109, + 0xe010b, 0xe010d, 0xe010f, 0xe0111, 0xe0113, 0xe0115, 0xe0117, 0xe0119, 0xe011b, + 0xe011d, 0xe011f, 0xe0121, 0xe0123, 0xe0125, 0xe0127, 0xe0129, 0xe012b, 0xe012d, + 0xe012f, 0xe0131, 0xe0133, 0xe0135, 0xe0137, 0xe0138, 0xe013a, 0xe013c, 0xe013e, + 0xe0140, 0xe0142, 0xe0144, 0xe0146, 0xe0148, 0xe0149, 0xe014b, 0xe014d, 0xe014f, + 0xe0151, 0xe0153, 0xe0155, 0xe0157, 0xe0159, 0xe015b, 0xe015d, 0xe015f, 0xe0161, + 0xe0163, 0xe0165, 0xe0167, 0xe0169, 0xe016b, 0xe016d, 0xe016f, 0xe0171, 0xe0173, + 0xe0175, 0xe0177, 0xe017a, 0xe017c, 0xe0183, 0xe0185, 0xe0188, 0xe018c, 0xe018d, + 0xe0192, 0xe0195, 0xe019e, 0xe01a1, 0xe01a3, 0xe01a5, 0xe01a8, 0xe01aa, 0xe01ab, + 0xe01ad, 0xe01b0, 0xe01b4, 0xe01b6, 0xe01b9, 0xe01ba, 0xe01c6, 0xe01c9, 0xe01cc, + 0xe01ce, 0xe01d0, 0xe01d2, 0xe01d4, 0xe01d6, 0xe01d8, 0xe01da, 0xe01dc, 0xe01dd, + 0xe01df, 0xe01e1, 0xe01e3, 0xe01e5, 0xe01e7, 0xe01e9, 0xe01eb, 0xe01ed, 0xe01ef, + 0xe01f0, 0xe01f3, 0xe01f5, 0xe01f9, 0xe01fb, 0xe01fd, 0xe01ff, 0xe0201, 0xe0203, + 0xe0205, 0xe0207, 0xe0209, 0xe020b, 0xe020d, 0xe020f, 0xe0211, 0xe0213, 0xe0215, + 0xe0217, 0xe0219, 0xe021b, 0xe021d, 0xe021f, 0xe0221, 0xe0223, 0xe0225, 0xe0227, + 0xe0229, 0xe022b, 0xe022d, 0xe022f, 0xe0231, 0xe023c, 0xe023f, 0xe0240, 0xe0242, + 0xe0247, 0xe0249, 0xe024b, 0xe024d, 0xe0371, 0xe0373, 0xe0377, 0xe0390, 0xe03d0, + 0xe03d1, 0xe03d9, 0xe03db, 0xe03dd, 0xe03df, 0xe03e1, 0xe03e3, 0xe03e5, 0xe03e7, + 0xe03e9, 0xe03eb, 0xe03ed, 0xe03f5, 0xe03f8, 0xe03fb, 0xe03fc, 0xe0461, 0xe0463, + 0xe0465, 0xe0467, 0xe0469, 0xe046b, 0xe046d, 0xe046f, 0xe0471, 0xe0473, 0xe0475, + 0xe0477, 0xe0479, 0xe047b, 0xe047d, 0xe047f, 0xe0481, 0xe048b, 0xe048d, 0xe048f, + 0xe0491, 0xe0493, 0xe0495, 0xe0497, 0xe0499, 0xe049b, 0xe049d, 0xe049f, 0xe04a1, + 0xe04a3, 0xe04a5, 0xe04a7, 0xe04a9, 0xe04ab, 0xe04ad, 0xe04af, 0xe04b1, 0xe04b3, + 0xe04b5, 0xe04b7, 0xe04b9, 0xe04bb, 0xe04bd, 0xe04bf, 0xe04c2, 0xe04c4, 0xe04c6, + 0xe04c8, 0xe04ca, 0xe04cc, 0xe04ce, 0xe04cf, 0xe04d1, 0xe04d3, 0xe04d5, 0xe04d7, + 0xe04d9, 0xe04db, 0xe04dd, 0xe04df, 0xe04e1, 0xe04e3, 0xe04e5, 0xe04e7, 0xe04e9, + 0xe04eb, 0xe04ed, 0xe04ef, 0xe04f1, 0xe04f3, 0xe04f5, 0xe04f7, 0xe04f9, 0xe04fb, + 0xe04fd, 0xe04ff, 0xe0501, 0xe0503, 0xe0505, 0xe0507, 0xe0509, 0xe050b, 0xe050d, + 0xe050f, 0xe0511, 0xe0513, 0xe0515, 0xe0517, 0xe0519, 0xe051b, 0xe051d, 0xe051f, + 0xe0521, 0xe0523, 0xe0525, 0xe0527, 0xe0529, 0xe052b, 0xe052d, 0xe052f, 0xe1e01, + 0xe1e03, 0xe1e05, 0xe1e07, 0xe1e09, 0xe1e0b, 0xe1e0d, 0xe1e0f, 0xe1e11, 0xe1e13, + 0xe1e15, 0xe1e17, 0xe1e19, 0xe1e1b, 0xe1e1d, 0xe1e1f, 0xe1e21, 0xe1e23, 0xe1e25, + 0xe1e27, 0xe1e29, 0xe1e2b, 0xe1e2d, 0xe1e2f, 0xe1e31, 0xe1e33, 0xe1e35, 0xe1e37, + 0xe1e39, 0xe1e3b, 0xe1e3d, 0xe1e3f, 0xe1e41, 0xe1e43, 0xe1e45, 0xe1e47, 0xe1e49, + 0xe1e4b, 0xe1e4d, 0xe1e4f, 0xe1e51, 0xe1e53, 0xe1e55, 0xe1e57, 0xe1e59, 0xe1e5b, + 0xe1e5d, 0xe1e5f, 0xe1e61, 0xe1e63, 0xe1e65, 0xe1e67, 0xe1e69, 0xe1e6b, 0xe1e6d, + 0xe1e6f, 0xe1e71, 0xe1e73, 0xe1e75, 0xe1e77, 0xe1e79, 0xe1e7b, 0xe1e7d, 0xe1e7f, + 0xe1e81, 0xe1e83, 0xe1e85, 0xe1e87, 0xe1e89, 0xe1e8b, 0xe1e8d, 0xe1e8f, 0xe1e91, + 0xe1e93, 0xe1e9f, 0xe1ea1, 0xe1ea3, 0xe1ea5, 0xe1ea7, 0xe1ea9, 0xe1eab, 0xe1ead, + 0xe1eaf, 0xe1eb1, 0xe1eb3, 0xe1eb5, 0xe1eb7, 0xe1eb9, 0xe1ebb, 0xe1ebd, 0xe1ebf, + 0xe1ec1, 0xe1ec3, 0xe1ec5, 0xe1ec7, 0xe1ec9, 0xe1ecb, 0xe1ecd, 0xe1ecf, 0xe1ed1, + 0xe1ed3, 0xe1ed5, 0xe1ed7, 0xe1ed9, 0xe1edb, 0xe1edd, 0xe1edf, 0xe1ee1, 0xe1ee3, + 0xe1ee5, 0xe1ee7, 0xe1ee9, 0xe1eeb, 0xe1eed, 0xe1eef, 0xe1ef1, 0xe1ef3, 0xe1ef5, + 0xe1ef7, 0xe1ef9, 0xe1efb, 0xe1efd, 0xe1fb6, 0xe1fb7, 0xe1fbe, 0xe1fc6, 0xe1fc7, + 0xe1fd6, 0xe1fd7, 0xe1ff6, 0xe1ff7, 0xe210a, 0xe210e, 0xe210f, 0xe2113, 0xe212f, + 0xe2134, 0xe2139, 0xe213c, 0xe213d, 0xe214e, 0xe2184, 0xe2c61, 0xe2c65, 0xe2c66, + 0xe2c68, 0xe2c6a, 0xe2c6c, 0xe2c71, 0xe2c73, 0xe2c74, 0xe2c81, 0xe2c83, 0xe2c85, + 0xe2c87, 0xe2c89, 0xe2c8b, 0xe2c8d, 0xe2c8f, 0xe2c91, 0xe2c93, 0xe2c95, 0xe2c97, + 0xe2c99, 0xe2c9b, 0xe2c9d, 0xe2c9f, 0xe2ca1, 0xe2ca3, 0xe2ca5, 0xe2ca7, 0xe2ca9, + 0xe2cab, 0xe2cad, 0xe2caf, 0xe2cb1, 0xe2cb3, 0xe2cb5, 0xe2cb7, 0xe2cb9, 0xe2cbb, + 0xe2cbd, 0xe2cbf, 0xe2cc1, 0xe2cc3, 0xe2cc5, 0xe2cc7, 0xe2cc9, 0xe2ccb, 0xe2ccd, + 0xe2ccf, 0xe2cd1, 0xe2cd3, 0xe2cd5, 0xe2cd7, 0xe2cd9, 0xe2cdb, 0xe2cdd, 0xe2cdf, + 0xe2ce1, 0xe2ce3, 0xe2ce4, 0xe2cec, 0xe2cee, 0xe2cf3, 0xe2d27, 0xe2d2d, 0xea641, + 0xea643, 0xea645, 0xea647, 0xea649, 0xea64b, 0xea64d, 0xea64f, 0xea651, 0xea653, + 0xea655, 0xea657, 0xea659, 0xea65b, 0xea65d, 0xea65f, 0xea661, 0xea663, 0xea665, + 0xea667, 0xea669, 0xea66b, 0xea66d, 0xea681, 0xea683, 0xea685, 0xea687, 0xea689, + 0xea68b, 0xea68d, 0xea68f, 0xea691, 0xea693, 0xea695, 0xea697, 0xea699, 0xea69b, + 0xea723, 0xea725, 0xea727, 0xea729, 0xea72b, 0xea72d, 0xea733, 0xea735, 0xea737, + 0xea739, 0xea73b, 0xea73d, 0xea73f, 0xea741, 0xea743, 0xea745, 0xea747, 0xea749, + 0xea74b, 0xea74d, 0xea74f, 0xea751, 0xea753, 0xea755, 0xea757, 0xea759, 0xea75b, + 0xea75d, 0xea75f, 0xea761, 0xea763, 0xea765, 0xea767, 0xea769, 0xea76b, 0xea76d, + 0xea76f, 0xea77a, 0xea77c, 0xea77f, 0xea781, 0xea783, 0xea785, 0xea787, 0xea78c, + 0xea78e, 0xea791, 0xea797, 0xea799, 0xea79b, 0xea79d, 0xea79f, 0xea7a1, 0xea7a3, + 0xea7a5, 0xea7a7, 0xea7a9, 0xea7b5, 0xea7b7, 0xea7fa, 0xf00b5, 0xf0101, 0xf0103, + 0xf0105, 0xf0107, 0xf0109, 0xf010b, 0xf010d, 0xf010f, 0xf0111, 0xf0113, 0xf0115, + 0xf0117, 0xf0119, 0xf011b, 0xf011d, 0xf011f, 0xf0121, 0xf0123, 0xf0125, 0xf0127, + 0xf0129, 0xf012b, 0xf012d, 0xf012f, 0xf0131, 0xf0133, 0xf0135, 0xf0137, 0xf0138, + 0xf013a, 0xf013c, 0xf013e, 0xf0140, 0xf0142, 0xf0144, 0xf0146, 0xf0148, 0xf0149, + 0xf014b, 0xf014d, 0xf014f, 0xf0151, 0xf0153, 0xf0155, 0xf0157, 0xf0159, 0xf015b, + 0xf015d, 0xf015f, 0xf0161, 0xf0163, 0xf0165, 0xf0167, 0xf0169, 0xf016b, 0xf016d, + 0xf016f, 0xf0171, 0xf0173, 0xf0175, 0xf0177, 0xf017a, 0xf017c, 0xf0183, 0xf0185, + 0xf0188, 0xf018c, 0xf018d, 0xf0192, 0xf0195, 0xf019e, 0xf01a1, 0xf01a3, 0xf01a5, + 0xf01a8, 0xf01aa, 0xf01ab, 0xf01ad, 0xf01b0, 0xf01b4, 0xf01b6, 0xf01b9, 0xf01ba, + 0xf01c6, 0xf01c9, 0xf01cc, 0xf01ce, 0xf01d0, 0xf01d2, 0xf01d4, 0xf01d6, 0xf01d8, + 0xf01da, 0xf01dc, 0xf01dd, 0xf01df, 0xf01e1, 0xf01e3, 0xf01e5, 0xf01e7, 0xf01e9, + 0xf01eb, 0xf01ed, 0xf01ef, 0xf01f0, 0xf01f3, 0xf01f5, 0xf01f9, 0xf01fb, 0xf01fd, + 0xf01ff, 0xf0201, 0xf0203, 0xf0205, 0xf0207, 0xf0209, 0xf020b, 0xf020d, 0xf020f, + 0xf0211, 0xf0213, 0xf0215, 0xf0217, 0xf0219, 0xf021b, 0xf021d, 0xf021f, 0xf0221, + 0xf0223, 0xf0225, 0xf0227, 0xf0229, 0xf022b, 0xf022d, 0xf022f, 0xf0231, 0xf023c, + 0xf023f, 0xf0240, 0xf0242, 0xf0247, 0xf0249, 0xf024b, 0xf024d, 0xf0371, 0xf0373, + 0xf0377, 0xf0390, 0xf03d0, 0xf03d1, 0xf03d9, 0xf03db, 0xf03dd, 0xf03df, 0xf03e1, + 0xf03e3, 0xf03e5, 0xf03e7, 0xf03e9, 0xf03eb, 0xf03ed, 0xf03f5, 0xf03f8, 0xf03fb, + 0xf03fc, 0xf0461, 0xf0463, 0xf0465, 0xf0467, 0xf0469, 0xf046b, 0xf046d, 0xf046f, + 0xf0471, 0xf0473, 0xf0475, 0xf0477, 0xf0479, 0xf047b, 0xf047d, 0xf047f, 0xf0481, + 0xf048b, 0xf048d, 0xf048f, 0xf0491, 0xf0493, 0xf0495, 0xf0497, 0xf0499, 0xf049b, + 0xf049d, 0xf049f, 0xf04a1, 0xf04a3, 0xf04a5, 0xf04a7, 0xf04a9, 0xf04ab, 0xf04ad, + 0xf04af, 0xf04b1, 0xf04b3, 0xf04b5, 0xf04b7, 0xf04b9, 0xf04bb, 0xf04bd, 0xf04bf, + 0xf04c2, 0xf04c4, 0xf04c6, 0xf04c8, 0xf04ca, 0xf04cc, 0xf04ce, 0xf04cf, 0xf04d1, + 0xf04d3, 0xf04d5, 0xf04d7, 0xf04d9, 0xf04db, 0xf04dd, 0xf04df, 0xf04e1, 0xf04e3, + 0xf04e5, 0xf04e7, 0xf04e9, 0xf04eb, 0xf04ed, 0xf04ef, 0xf04f1, 0xf04f3, 0xf04f5, + 0xf04f7, 0xf04f9, 0xf04fb, 0xf04fd, 0xf04ff, 0xf0501, 0xf0503, 0xf0505, 0xf0507, + 0xf0509, 0xf050b, 0xf050d, 0xf050f, 0xf0511, 0xf0513, 0xf0515, 0xf0517, 0xf0519, + 0xf051b, 0xf051d, 0xf051f, 0xf0521, 0xf0523, 0xf0525, 0xf0527, 0xf0529, 0xf052b, + 0xf052d, 0xf052f, 0xf1e01, 0xf1e03, 0xf1e05, 0xf1e07, 0xf1e09, 0xf1e0b, 0xf1e0d, + 0xf1e0f, 0xf1e11, 0xf1e13, 0xf1e15, 0xf1e17, 0xf1e19, 0xf1e1b, 0xf1e1d, 0xf1e1f, + 0xf1e21, 0xf1e23, 0xf1e25, 0xf1e27, 0xf1e29, 0xf1e2b, 0xf1e2d, 0xf1e2f, 0xf1e31, + 0xf1e33, 0xf1e35, 0xf1e37, 0xf1e39, 0xf1e3b, 0xf1e3d, 0xf1e3f, 0xf1e41, 0xf1e43, + 0xf1e45, 0xf1e47, 0xf1e49, 0xf1e4b, 0xf1e4d, 0xf1e4f, 0xf1e51, 0xf1e53, 0xf1e55, + 0xf1e57, 0xf1e59, 0xf1e5b, 0xf1e5d, 0xf1e5f, 0xf1e61, 0xf1e63, 0xf1e65, 0xf1e67, + 0xf1e69, 0xf1e6b, 0xf1e6d, 0xf1e6f, 0xf1e71, 0xf1e73, 0xf1e75, 0xf1e77, 0xf1e79, + 0xf1e7b, 0xf1e7d, 0xf1e7f, 0xf1e81, 0xf1e83, 0xf1e85, 0xf1e87, 0xf1e89, 0xf1e8b, + 0xf1e8d, 0xf1e8f, 0xf1e91, 0xf1e93, 0xf1e9f, 0xf1ea1, 0xf1ea3, 0xf1ea5, 0xf1ea7, + 0xf1ea9, 0xf1eab, 0xf1ead, 0xf1eaf, 0xf1eb1, 0xf1eb3, 0xf1eb5, 0xf1eb7, 0xf1eb9, + 0xf1ebb, 0xf1ebd, 0xf1ebf, 0xf1ec1, 0xf1ec3, 0xf1ec5, 0xf1ec7, 0xf1ec9, 0xf1ecb, + 0xf1ecd, 0xf1ecf, 0xf1ed1, 0xf1ed3, 0xf1ed5, 0xf1ed7, 0xf1ed9, 0xf1edb, 0xf1edd, + 0xf1edf, 0xf1ee1, 0xf1ee3, 0xf1ee5, 0xf1ee7, 0xf1ee9, 0xf1eeb, 0xf1eed, 0xf1eef, + 0xf1ef1, 0xf1ef3, 0xf1ef5, 0xf1ef7, 0xf1ef9, 0xf1efb, 0xf1efd, 0xf1fb6, 0xf1fb7, + 0xf1fbe, 0xf1fc6, 0xf1fc7, 0xf1fd6, 0xf1fd7, 0xf1ff6, 0xf1ff7, 0xf210a, 0xf210e, + 0xf210f, 0xf2113, 0xf212f, 0xf2134, 0xf2139, 0xf213c, 0xf213d, 0xf214e, 0xf2184, + 0xf2c61, 0xf2c65, 0xf2c66, 0xf2c68, 0xf2c6a, 0xf2c6c, 0xf2c71, 0xf2c73, 0xf2c74, + 0xf2c81, 0xf2c83, 0xf2c85, 0xf2c87, 0xf2c89, 0xf2c8b, 0xf2c8d, 0xf2c8f, 0xf2c91, + 0xf2c93, 0xf2c95, 0xf2c97, 0xf2c99, 0xf2c9b, 0xf2c9d, 0xf2c9f, 0xf2ca1, 0xf2ca3, + 0xf2ca5, 0xf2ca7, 0xf2ca9, 0xf2cab, 0xf2cad, 0xf2caf, 0xf2cb1, 0xf2cb3, 0xf2cb5, + 0xf2cb7, 0xf2cb9, 0xf2cbb, 0xf2cbd, 0xf2cbf, 0xf2cc1, 0xf2cc3, 0xf2cc5, 0xf2cc7, + 0xf2cc9, 0xf2ccb, 0xf2ccd, 0xf2ccf, 0xf2cd1, 0xf2cd3, 0xf2cd5, 0xf2cd7, 0xf2cd9, + 0xf2cdb, 0xf2cdd, 0xf2cdf, 0xf2ce1, 0xf2ce3, 0xf2ce4, 0xf2cec, 0xf2cee, 0xf2cf3, + 0xf2d27, 0xf2d2d, 0xfa641, 0xfa643, 0xfa645, 0xfa647, 0xfa649, 0xfa64b, 0xfa64d, + 0xfa64f, 0xfa651, 0xfa653, 0xfa655, 0xfa657, 0xfa659, 0xfa65b, 0xfa65d, 0xfa65f, + 0xfa661, 0xfa663, 0xfa665, 0xfa667, 0xfa669, 0xfa66b, 0xfa66d, 0xfa681, 0xfa683, + 0xfa685, 0xfa687, 0xfa689, 0xfa68b, 0xfa68d, 0xfa68f, 0xfa691, 0xfa693, 0xfa695, + 0xfa697, 0xfa699, 0xfa69b, 0xfa723, 0xfa725, 0xfa727, 0xfa729, 0xfa72b, 0xfa72d, + 0xfa733, 0xfa735, 0xfa737, 0xfa739, 0xfa73b, 0xfa73d, 0xfa73f, 0xfa741, 0xfa743, + 0xfa745, 0xfa747, 0xfa749, 0xfa74b, 0xfa74d, 0xfa74f, 0xfa751, 0xfa753, 0xfa755, + 0xfa757, 0xfa759, 0xfa75b, 0xfa75d, 0xfa75f, 0xfa761, 0xfa763, 0xfa765, 0xfa767, + 0xfa769, 0xfa76b, 0xfa76d, 0xfa76f, 0xfa77a, 0xfa77c, 0xfa77f, 0xfa781, 0xfa783, + 0xfa785, 0xfa787, 0xfa78c, 0xfa78e, 0xfa791, 0xfa797, 0xfa799, 0xfa79b, 0xfa79d, + 0xfa79f, 0xfa7a1, 0xfa7a3, 0xfa7a5, 0xfa7a7, 0xfa7a9, 0xfa7b5, 0xfa7b7, 0xfa7fa, + 0x1000b5, 0x100101, 0x100103, 0x100105, 0x100107, 0x100109, 0x10010b, 0x10010d, 0x10010f, + 0x100111, 0x100113, 0x100115, 0x100117, 0x100119, 0x10011b, 0x10011d, 0x10011f, 0x100121, + 0x100123, 0x100125, 0x100127, 0x100129, 0x10012b, 0x10012d, 0x10012f, 0x100131, 0x100133, + 0x100135, 0x100137, 0x100138, 0x10013a, 0x10013c, 0x10013e, 0x100140, 0x100142, 0x100144, + 0x100146, 0x100148, 0x100149, 0x10014b, 0x10014d, 0x10014f, 0x100151, 0x100153, 0x100155, + 0x100157, 0x100159, 0x10015b, 0x10015d, 0x10015f, 0x100161, 0x100163, 0x100165, 0x100167, + 0x100169, 0x10016b, 0x10016d, 0x10016f, 0x100171, 0x100173, 0x100175, 0x100177, 0x10017a, + 0x10017c, 0x100183, 0x100185, 0x100188, 0x10018c, 0x10018d, 0x100192, 0x100195, 0x10019e, + 0x1001a1, 0x1001a3, 0x1001a5, 0x1001a8, 0x1001aa, 0x1001ab, 0x1001ad, 0x1001b0, 0x1001b4, + 0x1001b6, 0x1001b9, 0x1001ba, 0x1001c6, 0x1001c9, 0x1001cc, 0x1001ce, 0x1001d0, 0x1001d2, + 0x1001d4, 0x1001d6, 0x1001d8, 0x1001da, 0x1001dc, 0x1001dd, 0x1001df, 0x1001e1, 0x1001e3, + 0x1001e5, 0x1001e7, 0x1001e9, 0x1001eb, 0x1001ed, 0x1001ef, 0x1001f0, 0x1001f3, 0x1001f5, + 0x1001f9, 0x1001fb, 0x1001fd, 0x1001ff, 0x100201, 0x100203, 0x100205, 0x100207, 0x100209, + 0x10020b, 0x10020d, 0x10020f, 0x100211, 0x100213, 0x100215, 0x100217, 0x100219, 0x10021b, + 0x10021d, 0x10021f, 0x100221, 0x100223, 0x100225, 0x100227, 0x100229, 0x10022b, 0x10022d, + 0x10022f, 0x100231, 0x10023c, 0x10023f, 0x100240, 0x100242, 0x100247, 0x100249, 0x10024b, + 0x10024d, 0x100371, 0x100373, 0x100377, 0x100390, 0x1003d0, 0x1003d1, 0x1003d9, 0x1003db, + 0x1003dd, 0x1003df, 0x1003e1, 0x1003e3, 0x1003e5, 0x1003e7, 0x1003e9, 0x1003eb, 0x1003ed, + 0x1003f5, 0x1003f8, 0x1003fb, 0x1003fc, 0x100461, 0x100463, 0x100465, 0x100467, 0x100469, + 0x10046b, 0x10046d, 0x10046f, 0x100471, 0x100473, 0x100475, 0x100477, 0x100479, 0x10047b, + 0x10047d, 0x10047f, 0x100481, 0x10048b, 0x10048d, 0x10048f, 0x100491, 0x100493, 0x100495, + 0x100497, 0x100499, 0x10049b, 0x10049d, 0x10049f, 0x1004a1, 0x1004a3, 0x1004a5, 0x1004a7, + 0x1004a9, 0x1004ab, 0x1004ad, 0x1004af, 0x1004b1, 0x1004b3, 0x1004b5, 0x1004b7, 0x1004b9, + 0x1004bb, 0x1004bd, 0x1004bf, 0x1004c2, 0x1004c4, 0x1004c6, 0x1004c8, 0x1004ca, 0x1004cc, + 0x1004ce, 0x1004cf, 0x1004d1, 0x1004d3, 0x1004d5, 0x1004d7, 0x1004d9, 0x1004db, 0x1004dd, + 0x1004df, 0x1004e1, 0x1004e3, 0x1004e5, 0x1004e7, 0x1004e9, 0x1004eb, 0x1004ed, 0x1004ef, + 0x1004f1, 0x1004f3, 0x1004f5, 0x1004f7, 0x1004f9, 0x1004fb, 0x1004fd, 0x1004ff, 0x100501, + 0x100503, 0x100505, 0x100507, 0x100509, 0x10050b, 0x10050d, 0x10050f, 0x100511, 0x100513, + 0x100515, 0x100517, 0x100519, 0x10051b, 0x10051d, 0x10051f, 0x100521, 0x100523, 0x100525, + 0x100527, 0x100529, 0x10052b, 0x10052d, 0x10052f, 0x101e01, 0x101e03, 0x101e05, 0x101e07, + 0x101e09, 0x101e0b, 0x101e0d, 0x101e0f, 0x101e11, 0x101e13, 0x101e15, 0x101e17, 0x101e19, + 0x101e1b, 0x101e1d, 0x101e1f, 0x101e21, 0x101e23, 0x101e25, 0x101e27, 0x101e29, 0x101e2b, + 0x101e2d, 0x101e2f, 0x101e31, 0x101e33, 0x101e35, 0x101e37, 0x101e39, 0x101e3b, 0x101e3d, + 0x101e3f, 0x101e41, 0x101e43, 0x101e45, 0x101e47, 0x101e49, 0x101e4b, 0x101e4d, 0x101e4f, + 0x101e51, 0x101e53, 0x101e55, 0x101e57, 0x101e59, 0x101e5b, 0x101e5d, 0x101e5f, 0x101e61, + 0x101e63, 0x101e65, 0x101e67, 0x101e69, 0x101e6b, 0x101e6d, 0x101e6f, 0x101e71, 0x101e73, + 0x101e75, 0x101e77, 0x101e79, 0x101e7b, 0x101e7d, 0x101e7f, 0x101e81, 0x101e83, 0x101e85, + 0x101e87, 0x101e89, 0x101e8b, 0x101e8d, 0x101e8f, 0x101e91, 0x101e93, 0x101e9f, 0x101ea1, + 0x101ea3, 0x101ea5, 0x101ea7, 0x101ea9, 0x101eab, 0x101ead, 0x101eaf, 0x101eb1, 0x101eb3, + 0x101eb5, 0x101eb7, 0x101eb9, 0x101ebb, 0x101ebd, 0x101ebf, 0x101ec1, 0x101ec3, 0x101ec5, + 0x101ec7, 0x101ec9, 0x101ecb, 0x101ecd, 0x101ecf, 0x101ed1, 0x101ed3, 0x101ed5, 0x101ed7, + 0x101ed9, 0x101edb, 0x101edd, 0x101edf, 0x101ee1, 0x101ee3, 0x101ee5, 0x101ee7, 0x101ee9, + 0x101eeb, 0x101eed, 0x101eef, 0x101ef1, 0x101ef3, 0x101ef5, 0x101ef7, 0x101ef9, 0x101efb, + 0x101efd, 0x101fb6, 0x101fb7, 0x101fbe, 0x101fc6, 0x101fc7, 0x101fd6, 0x101fd7, 0x101ff6, + 0x101ff7, 0x10210a, 0x10210e, 0x10210f, 0x102113, 0x10212f, 0x102134, 0x102139, 0x10213c, + 0x10213d, 0x10214e, 0x102184, 0x102c61, 0x102c65, 0x102c66, 0x102c68, 0x102c6a, 0x102c6c, + 0x102c71, 0x102c73, 0x102c74, 0x102c81, 0x102c83, 0x102c85, 0x102c87, 0x102c89, 0x102c8b, + 0x102c8d, 0x102c8f, 0x102c91, 0x102c93, 0x102c95, 0x102c97, 0x102c99, 0x102c9b, 0x102c9d, + 0x102c9f, 0x102ca1, 0x102ca3, 0x102ca5, 0x102ca7, 0x102ca9, 0x102cab, 0x102cad, 0x102caf, + 0x102cb1, 0x102cb3, 0x102cb5, 0x102cb7, 0x102cb9, 0x102cbb, 0x102cbd, 0x102cbf, 0x102cc1, + 0x102cc3, 0x102cc5, 0x102cc7, 0x102cc9, 0x102ccb, 0x102ccd, 0x102ccf, 0x102cd1, 0x102cd3, + 0x102cd5, 0x102cd7, 0x102cd9, 0x102cdb, 0x102cdd, 0x102cdf, 0x102ce1, 0x102ce3, 0x102ce4, + 0x102cec, 0x102cee, 0x102cf3, 0x102d27, 0x102d2d, 0x10a641, 0x10a643, 0x10a645, 0x10a647, + 0x10a649, 0x10a64b, 0x10a64d, 0x10a64f, 0x10a651, 0x10a653, 0x10a655, 0x10a657, 0x10a659, + 0x10a65b, 0x10a65d, 0x10a65f, 0x10a661, 0x10a663, 0x10a665, 0x10a667, 0x10a669, 0x10a66b, + 0x10a66d, 0x10a681, 0x10a683, 0x10a685, 0x10a687, 0x10a689, 0x10a68b, 0x10a68d, 0x10a68f, + 0x10a691, 0x10a693, 0x10a695, 0x10a697, 0x10a699, 0x10a69b, 0x10a723, 0x10a725, 0x10a727, + 0x10a729, 0x10a72b, 0x10a72d, 0x10a733, 0x10a735, 0x10a737, 0x10a739, 0x10a73b, 0x10a73d, + 0x10a73f, 0x10a741, 0x10a743, 0x10a745, 0x10a747, 0x10a749, 0x10a74b, 0x10a74d, 0x10a74f, + 0x10a751, 0x10a753, 0x10a755, 0x10a757, 0x10a759, 0x10a75b, 0x10a75d, 0x10a75f, 0x10a761, + 0x10a763, 0x10a765, 0x10a767, 0x10a769, 0x10a76b, 0x10a76d, 0x10a76f, 0x10a77a, 0x10a77c, + 0x10a77f, 0x10a781, 0x10a783, 0x10a785, 0x10a787, 0x10a78c, 0x10a78e, 0x10a791, 0x10a797, + 0x10a799, 0x10a79b, 0x10a79d, 0x10a79f, 0x10a7a1, 0x10a7a3, 0x10a7a5, 0x10a7a7, 0x10a7a9, + 0x10a7b5, 0x10a7b7, 0x10a7fa #endif }; @@ -521,13 +3626,166 @@ static const crange upperRangeTable[] = { {0x2130, 0x2133}, {0x2c00, 0x2c2e}, {0x2c62, 0x2c64}, {0x2c6d, 0x2c70}, {0x2c7e, 0x2c80}, {0xa7aa, 0xa7ae}, {0xa7b0, 0xa7b4}, {0xff21, 0xff3a} #if TCL_UTF_MAX > 4 - ,{0x10400, 0x10427}, {0x104b0, 0x104d3}, {0x10c80, 0x10cb2}, {0x118a0, 0x118bf}, - {0x1d400, 0x1d419}, {0x1d434, 0x1d44d}, {0x1d468, 0x1d481}, {0x1d4a9, 0x1d4ac}, - {0x1d4ae, 0x1d4b5}, {0x1d4d0, 0x1d4e9}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, - {0x1d516, 0x1d51c}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, - {0x1d56c, 0x1d585}, {0x1d5a0, 0x1d5b9}, {0x1d5d4, 0x1d5ed}, {0x1d608, 0x1d621}, - {0x1d63c, 0x1d655}, {0x1d670, 0x1d689}, {0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, - {0x1d71c, 0x1d734}, {0x1d756, 0x1d76e}, {0x1d790, 0x1d7a8}, {0x1e900, 0x1e921} + ,{0x10041, 0x1005a}, {0x100c0, 0x100d6}, {0x100d8, 0x100de}, {0x10189, 0x1018b}, + {0x1018e, 0x10191}, {0x10196, 0x10198}, {0x101b1, 0x101b3}, {0x101f6, 0x101f8}, + {0x10243, 0x10246}, {0x10388, 0x1038a}, {0x10391, 0x103a1}, {0x103a3, 0x103ab}, + {0x103d2, 0x103d4}, {0x103fd, 0x1042f}, {0x10531, 0x10556}, {0x110a0, 0x110c5}, + {0x113a0, 0x113f5}, {0x11f08, 0x11f0f}, {0x11f18, 0x11f1d}, {0x11f28, 0x11f2f}, + {0x11f38, 0x11f3f}, {0x11f48, 0x11f4d}, {0x11f68, 0x11f6f}, {0x11fb8, 0x11fbb}, + {0x11fc8, 0x11fcb}, {0x11fd8, 0x11fdb}, {0x11fe8, 0x11fec}, {0x11ff8, 0x11ffb}, + {0x1210b, 0x1210d}, {0x12110, 0x12112}, {0x12119, 0x1211d}, {0x1212a, 0x1212d}, + {0x12130, 0x12133}, {0x12c00, 0x12c2e}, {0x12c62, 0x12c64}, {0x12c6d, 0x12c70}, + {0x12c7e, 0x12c80}, {0x1a7aa, 0x1a7ae}, {0x1a7b0, 0x1a7b4}, {0x1ff21, 0x1ff3a}, + {0x20041, 0x2005a}, {0x200c0, 0x200d6}, {0x200d8, 0x200de}, {0x20189, 0x2018b}, + {0x2018e, 0x20191}, {0x20196, 0x20198}, {0x201b1, 0x201b3}, {0x201f6, 0x201f8}, + {0x20243, 0x20246}, {0x20388, 0x2038a}, {0x20391, 0x203a1}, {0x203a3, 0x203ab}, + {0x203d2, 0x203d4}, {0x203fd, 0x2042f}, {0x20531, 0x20556}, {0x210a0, 0x210c5}, + {0x213a0, 0x213f5}, {0x21f08, 0x21f0f}, {0x21f18, 0x21f1d}, {0x21f28, 0x21f2f}, + {0x21f38, 0x21f3f}, {0x21f48, 0x21f4d}, {0x21f68, 0x21f6f}, {0x21fb8, 0x21fbb}, + {0x21fc8, 0x21fcb}, {0x21fd8, 0x21fdb}, {0x21fe8, 0x21fec}, {0x21ff8, 0x21ffb}, + {0x2210b, 0x2210d}, {0x22110, 0x22112}, {0x22119, 0x2211d}, {0x2212a, 0x2212d}, + {0x22130, 0x22133}, {0x22c00, 0x22c2e}, {0x22c62, 0x22c64}, {0x22c6d, 0x22c70}, + {0x22c7e, 0x22c80}, {0x2a7aa, 0x2a7ae}, {0x2a7b0, 0x2a7b4}, {0x2ff21, 0x2ff3a}, + {0x30041, 0x3005a}, {0x300c0, 0x300d6}, {0x300d8, 0x300de}, {0x30189, 0x3018b}, + {0x3018e, 0x30191}, {0x30196, 0x30198}, {0x301b1, 0x301b3}, {0x301f6, 0x301f8}, + {0x30243, 0x30246}, {0x30388, 0x3038a}, {0x30391, 0x303a1}, {0x303a3, 0x303ab}, + {0x303d2, 0x303d4}, {0x303fd, 0x3042f}, {0x30531, 0x30556}, {0x310a0, 0x310c5}, + {0x313a0, 0x313f5}, {0x31f08, 0x31f0f}, {0x31f18, 0x31f1d}, {0x31f28, 0x31f2f}, + {0x31f38, 0x31f3f}, {0x31f48, 0x31f4d}, {0x31f68, 0x31f6f}, {0x31fb8, 0x31fbb}, + {0x31fc8, 0x31fcb}, {0x31fd8, 0x31fdb}, {0x31fe8, 0x31fec}, {0x31ff8, 0x31ffb}, + {0x3210b, 0x3210d}, {0x32110, 0x32112}, {0x32119, 0x3211d}, {0x3212a, 0x3212d}, + {0x32130, 0x32133}, {0x32c00, 0x32c2e}, {0x32c62, 0x32c64}, {0x32c6d, 0x32c70}, + {0x32c7e, 0x32c80}, {0x3a7aa, 0x3a7ae}, {0x3a7b0, 0x3a7b4}, {0x3ff21, 0x3ff3a}, + {0x40041, 0x4005a}, {0x400c0, 0x400d6}, {0x400d8, 0x400de}, {0x40189, 0x4018b}, + {0x4018e, 0x40191}, {0x40196, 0x40198}, {0x401b1, 0x401b3}, {0x401f6, 0x401f8}, + {0x40243, 0x40246}, {0x40388, 0x4038a}, {0x40391, 0x403a1}, {0x403a3, 0x403ab}, + {0x403d2, 0x403d4}, {0x403fd, 0x4042f}, {0x40531, 0x40556}, {0x410a0, 0x410c5}, + {0x413a0, 0x413f5}, {0x41f08, 0x41f0f}, {0x41f18, 0x41f1d}, {0x41f28, 0x41f2f}, + {0x41f38, 0x41f3f}, {0x41f48, 0x41f4d}, {0x41f68, 0x41f6f}, {0x41fb8, 0x41fbb}, + {0x41fc8, 0x41fcb}, {0x41fd8, 0x41fdb}, {0x41fe8, 0x41fec}, {0x41ff8, 0x41ffb}, + {0x4210b, 0x4210d}, {0x42110, 0x42112}, {0x42119, 0x4211d}, {0x4212a, 0x4212d}, + {0x42130, 0x42133}, {0x42c00, 0x42c2e}, {0x42c62, 0x42c64}, {0x42c6d, 0x42c70}, + {0x42c7e, 0x42c80}, {0x4a7aa, 0x4a7ae}, {0x4a7b0, 0x4a7b4}, {0x4ff21, 0x4ff3a}, + {0x50041, 0x5005a}, {0x500c0, 0x500d6}, {0x500d8, 0x500de}, {0x50189, 0x5018b}, + {0x5018e, 0x50191}, {0x50196, 0x50198}, {0x501b1, 0x501b3}, {0x501f6, 0x501f8}, + {0x50243, 0x50246}, {0x50388, 0x5038a}, {0x50391, 0x503a1}, {0x503a3, 0x503ab}, + {0x503d2, 0x503d4}, {0x503fd, 0x5042f}, {0x50531, 0x50556}, {0x510a0, 0x510c5}, + {0x513a0, 0x513f5}, {0x51f08, 0x51f0f}, {0x51f18, 0x51f1d}, {0x51f28, 0x51f2f}, + {0x51f38, 0x51f3f}, {0x51f48, 0x51f4d}, {0x51f68, 0x51f6f}, {0x51fb8, 0x51fbb}, + {0x51fc8, 0x51fcb}, {0x51fd8, 0x51fdb}, {0x51fe8, 0x51fec}, {0x51ff8, 0x51ffb}, + {0x5210b, 0x5210d}, {0x52110, 0x52112}, {0x52119, 0x5211d}, {0x5212a, 0x5212d}, + {0x52130, 0x52133}, {0x52c00, 0x52c2e}, {0x52c62, 0x52c64}, {0x52c6d, 0x52c70}, + {0x52c7e, 0x52c80}, {0x5a7aa, 0x5a7ae}, {0x5a7b0, 0x5a7b4}, {0x5ff21, 0x5ff3a}, + {0x60041, 0x6005a}, {0x600c0, 0x600d6}, {0x600d8, 0x600de}, {0x60189, 0x6018b}, + {0x6018e, 0x60191}, {0x60196, 0x60198}, {0x601b1, 0x601b3}, {0x601f6, 0x601f8}, + {0x60243, 0x60246}, {0x60388, 0x6038a}, {0x60391, 0x603a1}, {0x603a3, 0x603ab}, + {0x603d2, 0x603d4}, {0x603fd, 0x6042f}, {0x60531, 0x60556}, {0x610a0, 0x610c5}, + {0x613a0, 0x613f5}, {0x61f08, 0x61f0f}, {0x61f18, 0x61f1d}, {0x61f28, 0x61f2f}, + {0x61f38, 0x61f3f}, {0x61f48, 0x61f4d}, {0x61f68, 0x61f6f}, {0x61fb8, 0x61fbb}, + {0x61fc8, 0x61fcb}, {0x61fd8, 0x61fdb}, {0x61fe8, 0x61fec}, {0x61ff8, 0x61ffb}, + {0x6210b, 0x6210d}, {0x62110, 0x62112}, {0x62119, 0x6211d}, {0x6212a, 0x6212d}, + {0x62130, 0x62133}, {0x62c00, 0x62c2e}, {0x62c62, 0x62c64}, {0x62c6d, 0x62c70}, + {0x62c7e, 0x62c80}, {0x6a7aa, 0x6a7ae}, {0x6a7b0, 0x6a7b4}, {0x6ff21, 0x6ff3a}, + {0x70041, 0x7005a}, {0x700c0, 0x700d6}, {0x700d8, 0x700de}, {0x70189, 0x7018b}, + {0x7018e, 0x70191}, {0x70196, 0x70198}, {0x701b1, 0x701b3}, {0x701f6, 0x701f8}, + {0x70243, 0x70246}, {0x70388, 0x7038a}, {0x70391, 0x703a1}, {0x703a3, 0x703ab}, + {0x703d2, 0x703d4}, {0x703fd, 0x7042f}, {0x70531, 0x70556}, {0x710a0, 0x710c5}, + {0x713a0, 0x713f5}, {0x71f08, 0x71f0f}, {0x71f18, 0x71f1d}, {0x71f28, 0x71f2f}, + {0x71f38, 0x71f3f}, {0x71f48, 0x71f4d}, {0x71f68, 0x71f6f}, {0x71fb8, 0x71fbb}, + {0x71fc8, 0x71fcb}, {0x71fd8, 0x71fdb}, {0x71fe8, 0x71fec}, {0x71ff8, 0x71ffb}, + {0x7210b, 0x7210d}, {0x72110, 0x72112}, {0x72119, 0x7211d}, {0x7212a, 0x7212d}, + {0x72130, 0x72133}, {0x72c00, 0x72c2e}, {0x72c62, 0x72c64}, {0x72c6d, 0x72c70}, + {0x72c7e, 0x72c80}, {0x7a7aa, 0x7a7ae}, {0x7a7b0, 0x7a7b4}, {0x7ff21, 0x7ff3a}, + {0x80041, 0x8005a}, {0x800c0, 0x800d6}, {0x800d8, 0x800de}, {0x80189, 0x8018b}, + {0x8018e, 0x80191}, {0x80196, 0x80198}, {0x801b1, 0x801b3}, {0x801f6, 0x801f8}, + {0x80243, 0x80246}, {0x80388, 0x8038a}, {0x80391, 0x803a1}, {0x803a3, 0x803ab}, + {0x803d2, 0x803d4}, {0x803fd, 0x8042f}, {0x80531, 0x80556}, {0x810a0, 0x810c5}, + {0x813a0, 0x813f5}, {0x81f08, 0x81f0f}, {0x81f18, 0x81f1d}, {0x81f28, 0x81f2f}, + {0x81f38, 0x81f3f}, {0x81f48, 0x81f4d}, {0x81f68, 0x81f6f}, {0x81fb8, 0x81fbb}, + {0x81fc8, 0x81fcb}, {0x81fd8, 0x81fdb}, {0x81fe8, 0x81fec}, {0x81ff8, 0x81ffb}, + {0x8210b, 0x8210d}, {0x82110, 0x82112}, {0x82119, 0x8211d}, {0x8212a, 0x8212d}, + {0x82130, 0x82133}, {0x82c00, 0x82c2e}, {0x82c62, 0x82c64}, {0x82c6d, 0x82c70}, + {0x82c7e, 0x82c80}, {0x8a7aa, 0x8a7ae}, {0x8a7b0, 0x8a7b4}, {0x8ff21, 0x8ff3a}, + {0x90041, 0x9005a}, {0x900c0, 0x900d6}, {0x900d8, 0x900de}, {0x90189, 0x9018b}, + {0x9018e, 0x90191}, {0x90196, 0x90198}, {0x901b1, 0x901b3}, {0x901f6, 0x901f8}, + {0x90243, 0x90246}, {0x90388, 0x9038a}, {0x90391, 0x903a1}, {0x903a3, 0x903ab}, + {0x903d2, 0x903d4}, {0x903fd, 0x9042f}, {0x90531, 0x90556}, {0x910a0, 0x910c5}, + {0x913a0, 0x913f5}, {0x91f08, 0x91f0f}, {0x91f18, 0x91f1d}, {0x91f28, 0x91f2f}, + {0x91f38, 0x91f3f}, {0x91f48, 0x91f4d}, {0x91f68, 0x91f6f}, {0x91fb8, 0x91fbb}, + {0x91fc8, 0x91fcb}, {0x91fd8, 0x91fdb}, {0x91fe8, 0x91fec}, {0x91ff8, 0x91ffb}, + {0x9210b, 0x9210d}, {0x92110, 0x92112}, {0x92119, 0x9211d}, {0x9212a, 0x9212d}, + {0x92130, 0x92133}, {0x92c00, 0x92c2e}, {0x92c62, 0x92c64}, {0x92c6d, 0x92c70}, + {0x92c7e, 0x92c80}, {0x9a7aa, 0x9a7ae}, {0x9a7b0, 0x9a7b4}, {0x9ff21, 0x9ff3a}, + {0xa0041, 0xa005a}, {0xa00c0, 0xa00d6}, {0xa00d8, 0xa00de}, {0xa0189, 0xa018b}, + {0xa018e, 0xa0191}, {0xa0196, 0xa0198}, {0xa01b1, 0xa01b3}, {0xa01f6, 0xa01f8}, + {0xa0243, 0xa0246}, {0xa0388, 0xa038a}, {0xa0391, 0xa03a1}, {0xa03a3, 0xa03ab}, + {0xa03d2, 0xa03d4}, {0xa03fd, 0xa042f}, {0xa0531, 0xa0556}, {0xa10a0, 0xa10c5}, + {0xa13a0, 0xa13f5}, {0xa1f08, 0xa1f0f}, {0xa1f18, 0xa1f1d}, {0xa1f28, 0xa1f2f}, + {0xa1f38, 0xa1f3f}, {0xa1f48, 0xa1f4d}, {0xa1f68, 0xa1f6f}, {0xa1fb8, 0xa1fbb}, + {0xa1fc8, 0xa1fcb}, {0xa1fd8, 0xa1fdb}, {0xa1fe8, 0xa1fec}, {0xa1ff8, 0xa1ffb}, + {0xa210b, 0xa210d}, {0xa2110, 0xa2112}, {0xa2119, 0xa211d}, {0xa212a, 0xa212d}, + {0xa2130, 0xa2133}, {0xa2c00, 0xa2c2e}, {0xa2c62, 0xa2c64}, {0xa2c6d, 0xa2c70}, + {0xa2c7e, 0xa2c80}, {0xaa7aa, 0xaa7ae}, {0xaa7b0, 0xaa7b4}, {0xaff21, 0xaff3a}, + {0xb0041, 0xb005a}, {0xb00c0, 0xb00d6}, {0xb00d8, 0xb00de}, {0xb0189, 0xb018b}, + {0xb018e, 0xb0191}, {0xb0196, 0xb0198}, {0xb01b1, 0xb01b3}, {0xb01f6, 0xb01f8}, + {0xb0243, 0xb0246}, {0xb0388, 0xb038a}, {0xb0391, 0xb03a1}, {0xb03a3, 0xb03ab}, + {0xb03d2, 0xb03d4}, {0xb03fd, 0xb042f}, {0xb0531, 0xb0556}, {0xb10a0, 0xb10c5}, + {0xb13a0, 0xb13f5}, {0xb1f08, 0xb1f0f}, {0xb1f18, 0xb1f1d}, {0xb1f28, 0xb1f2f}, + {0xb1f38, 0xb1f3f}, {0xb1f48, 0xb1f4d}, {0xb1f68, 0xb1f6f}, {0xb1fb8, 0xb1fbb}, + {0xb1fc8, 0xb1fcb}, {0xb1fd8, 0xb1fdb}, {0xb1fe8, 0xb1fec}, {0xb1ff8, 0xb1ffb}, + {0xb210b, 0xb210d}, {0xb2110, 0xb2112}, {0xb2119, 0xb211d}, {0xb212a, 0xb212d}, + {0xb2130, 0xb2133}, {0xb2c00, 0xb2c2e}, {0xb2c62, 0xb2c64}, {0xb2c6d, 0xb2c70}, + {0xb2c7e, 0xb2c80}, {0xba7aa, 0xba7ae}, {0xba7b0, 0xba7b4}, {0xbff21, 0xbff3a}, + {0xc0041, 0xc005a}, {0xc00c0, 0xc00d6}, {0xc00d8, 0xc00de}, {0xc0189, 0xc018b}, + {0xc018e, 0xc0191}, {0xc0196, 0xc0198}, {0xc01b1, 0xc01b3}, {0xc01f6, 0xc01f8}, + {0xc0243, 0xc0246}, {0xc0388, 0xc038a}, {0xc0391, 0xc03a1}, {0xc03a3, 0xc03ab}, + {0xc03d2, 0xc03d4}, {0xc03fd, 0xc042f}, {0xc0531, 0xc0556}, {0xc10a0, 0xc10c5}, + {0xc13a0, 0xc13f5}, {0xc1f08, 0xc1f0f}, {0xc1f18, 0xc1f1d}, {0xc1f28, 0xc1f2f}, + {0xc1f38, 0xc1f3f}, {0xc1f48, 0xc1f4d}, {0xc1f68, 0xc1f6f}, {0xc1fb8, 0xc1fbb}, + {0xc1fc8, 0xc1fcb}, {0xc1fd8, 0xc1fdb}, {0xc1fe8, 0xc1fec}, {0xc1ff8, 0xc1ffb}, + {0xc210b, 0xc210d}, {0xc2110, 0xc2112}, {0xc2119, 0xc211d}, {0xc212a, 0xc212d}, + {0xc2130, 0xc2133}, {0xc2c00, 0xc2c2e}, {0xc2c62, 0xc2c64}, {0xc2c6d, 0xc2c70}, + {0xc2c7e, 0xc2c80}, {0xca7aa, 0xca7ae}, {0xca7b0, 0xca7b4}, {0xcff21, 0xcff3a}, + {0xd0041, 0xd005a}, {0xd00c0, 0xd00d6}, {0xd00d8, 0xd00de}, {0xd0189, 0xd018b}, + {0xd018e, 0xd0191}, {0xd0196, 0xd0198}, {0xd01b1, 0xd01b3}, {0xd01f6, 0xd01f8}, + {0xd0243, 0xd0246}, {0xd0388, 0xd038a}, {0xd0391, 0xd03a1}, {0xd03a3, 0xd03ab}, + {0xd03d2, 0xd03d4}, {0xd03fd, 0xd042f}, {0xd0531, 0xd0556}, {0xd10a0, 0xd10c5}, + {0xd13a0, 0xd13f5}, {0xd1f08, 0xd1f0f}, {0xd1f18, 0xd1f1d}, {0xd1f28, 0xd1f2f}, + {0xd1f38, 0xd1f3f}, {0xd1f48, 0xd1f4d}, {0xd1f68, 0xd1f6f}, {0xd1fb8, 0xd1fbb}, + {0xd1fc8, 0xd1fcb}, {0xd1fd8, 0xd1fdb}, {0xd1fe8, 0xd1fec}, {0xd1ff8, 0xd1ffb}, + {0xd210b, 0xd210d}, {0xd2110, 0xd2112}, {0xd2119, 0xd211d}, {0xd212a, 0xd212d}, + {0xd2130, 0xd2133}, {0xd2c00, 0xd2c2e}, {0xd2c62, 0xd2c64}, {0xd2c6d, 0xd2c70}, + {0xd2c7e, 0xd2c80}, {0xda7aa, 0xda7ae}, {0xda7b0, 0xda7b4}, {0xdff21, 0xdff3a}, + {0xe0041, 0xe005a}, {0xe00c0, 0xe00d6}, {0xe00d8, 0xe00de}, {0xe0189, 0xe018b}, + {0xe018e, 0xe0191}, {0xe0196, 0xe0198}, {0xe01b1, 0xe01b3}, {0xe01f6, 0xe01f8}, + {0xe0243, 0xe0246}, {0xe0388, 0xe038a}, {0xe0391, 0xe03a1}, {0xe03a3, 0xe03ab}, + {0xe03d2, 0xe03d4}, {0xe03fd, 0xe042f}, {0xe0531, 0xe0556}, {0xe10a0, 0xe10c5}, + {0xe13a0, 0xe13f5}, {0xe1f08, 0xe1f0f}, {0xe1f18, 0xe1f1d}, {0xe1f28, 0xe1f2f}, + {0xe1f38, 0xe1f3f}, {0xe1f48, 0xe1f4d}, {0xe1f68, 0xe1f6f}, {0xe1fb8, 0xe1fbb}, + {0xe1fc8, 0xe1fcb}, {0xe1fd8, 0xe1fdb}, {0xe1fe8, 0xe1fec}, {0xe1ff8, 0xe1ffb}, + {0xe210b, 0xe210d}, {0xe2110, 0xe2112}, {0xe2119, 0xe211d}, {0xe212a, 0xe212d}, + {0xe2130, 0xe2133}, {0xe2c00, 0xe2c2e}, {0xe2c62, 0xe2c64}, {0xe2c6d, 0xe2c70}, + {0xe2c7e, 0xe2c80}, {0xea7aa, 0xea7ae}, {0xea7b0, 0xea7b4}, {0xeff21, 0xeff3a}, + {0xf0041, 0xf005a}, {0xf00c0, 0xf00d6}, {0xf00d8, 0xf00de}, {0xf0189, 0xf018b}, + {0xf018e, 0xf0191}, {0xf0196, 0xf0198}, {0xf01b1, 0xf01b3}, {0xf01f6, 0xf01f8}, + {0xf0243, 0xf0246}, {0xf0388, 0xf038a}, {0xf0391, 0xf03a1}, {0xf03a3, 0xf03ab}, + {0xf03d2, 0xf03d4}, {0xf03fd, 0xf042f}, {0xf0531, 0xf0556}, {0xf10a0, 0xf10c5}, + {0xf13a0, 0xf13f5}, {0xf1f08, 0xf1f0f}, {0xf1f18, 0xf1f1d}, {0xf1f28, 0xf1f2f}, + {0xf1f38, 0xf1f3f}, {0xf1f48, 0xf1f4d}, {0xf1f68, 0xf1f6f}, {0xf1fb8, 0xf1fbb}, + {0xf1fc8, 0xf1fcb}, {0xf1fd8, 0xf1fdb}, {0xf1fe8, 0xf1fec}, {0xf1ff8, 0xf1ffb}, + {0xf210b, 0xf210d}, {0xf2110, 0xf2112}, {0xf2119, 0xf211d}, {0xf212a, 0xf212d}, + {0xf2130, 0xf2133}, {0xf2c00, 0xf2c2e}, {0xf2c62, 0xf2c64}, {0xf2c6d, 0xf2c70}, + {0xf2c7e, 0xf2c80}, {0xfa7aa, 0xfa7ae}, {0xfa7b0, 0xfa7b4}, {0xfff21, 0xfff3a}, + {0x100041, 0x10005a}, {0x1000c0, 0x1000d6}, {0x1000d8, 0x1000de}, {0x100189, 0x10018b}, + {0x10018e, 0x100191}, {0x100196, 0x100198}, {0x1001b1, 0x1001b3}, {0x1001f6, 0x1001f8}, + {0x100243, 0x100246}, {0x100388, 0x10038a}, {0x100391, 0x1003a1}, {0x1003a3, 0x1003ab}, + {0x1003d2, 0x1003d4}, {0x1003fd, 0x10042f}, {0x100531, 0x100556}, {0x1010a0, 0x1010c5}, + {0x1013a0, 0x1013f5}, {0x101f08, 0x101f0f}, {0x101f18, 0x101f1d}, {0x101f28, 0x101f2f}, + {0x101f38, 0x101f3f}, {0x101f48, 0x101f4d}, {0x101f68, 0x101f6f}, {0x101fb8, 0x101fbb}, + {0x101fc8, 0x101fcb}, {0x101fd8, 0x101fdb}, {0x101fe8, 0x101fec}, {0x101ff8, 0x101ffb}, + {0x10210b, 0x10210d}, {0x102110, 0x102112}, {0x102119, 0x10211d}, {0x10212a, 0x10212d}, + {0x102130, 0x102133}, {0x102c00, 0x102c2e}, {0x102c62, 0x102c64}, {0x102c6d, 0x102c70}, + {0x102c7e, 0x102c80}, {0x10a7aa, 0x10a7ae}, {0x10a7b0, 0x10a7b4}, {0x10ff21, 0x10ff3a} #endif }; @@ -598,8 +3856,1014 @@ static const chr upperCharTable[] = { 0xa782, 0xa784, 0xa786, 0xa78b, 0xa78d, 0xa790, 0xa792, 0xa796, 0xa798, 0xa79a, 0xa79c, 0xa79e, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xa7b6 #if TCL_UTF_MAX > 4 - ,0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d504, 0x1d505, 0x1d538, - 0x1d539, 0x1d546, 0x1d7ca + ,0x10100, 0x10102, 0x10104, 0x10106, 0x10108, 0x1010a, 0x1010c, 0x1010e, 0x10110, + 0x10112, 0x10114, 0x10116, 0x10118, 0x1011a, 0x1011c, 0x1011e, 0x10120, 0x10122, + 0x10124, 0x10126, 0x10128, 0x1012a, 0x1012c, 0x1012e, 0x10130, 0x10132, 0x10134, + 0x10136, 0x10139, 0x1013b, 0x1013d, 0x1013f, 0x10141, 0x10143, 0x10145, 0x10147, + 0x1014a, 0x1014c, 0x1014e, 0x10150, 0x10152, 0x10154, 0x10156, 0x10158, 0x1015a, + 0x1015c, 0x1015e, 0x10160, 0x10162, 0x10164, 0x10166, 0x10168, 0x1016a, 0x1016c, + 0x1016e, 0x10170, 0x10172, 0x10174, 0x10176, 0x10178, 0x10179, 0x1017b, 0x1017d, + 0x10181, 0x10182, 0x10184, 0x10186, 0x10187, 0x10193, 0x10194, 0x1019c, 0x1019d, + 0x1019f, 0x101a0, 0x101a2, 0x101a4, 0x101a6, 0x101a7, 0x101a9, 0x101ac, 0x101ae, + 0x101af, 0x101b5, 0x101b7, 0x101b8, 0x101bc, 0x101c4, 0x101c7, 0x101ca, 0x101cd, + 0x101cf, 0x101d1, 0x101d3, 0x101d5, 0x101d7, 0x101d9, 0x101db, 0x101de, 0x101e0, + 0x101e2, 0x101e4, 0x101e6, 0x101e8, 0x101ea, 0x101ec, 0x101ee, 0x101f1, 0x101f4, + 0x101fa, 0x101fc, 0x101fe, 0x10200, 0x10202, 0x10204, 0x10206, 0x10208, 0x1020a, + 0x1020c, 0x1020e, 0x10210, 0x10212, 0x10214, 0x10216, 0x10218, 0x1021a, 0x1021c, + 0x1021e, 0x10220, 0x10222, 0x10224, 0x10226, 0x10228, 0x1022a, 0x1022c, 0x1022e, + 0x10230, 0x10232, 0x1023a, 0x1023b, 0x1023d, 0x1023e, 0x10241, 0x10248, 0x1024a, + 0x1024c, 0x1024e, 0x10370, 0x10372, 0x10376, 0x1037f, 0x10386, 0x1038c, 0x1038e, + 0x1038f, 0x103cf, 0x103d8, 0x103da, 0x103dc, 0x103de, 0x103e0, 0x103e2, 0x103e4, + 0x103e6, 0x103e8, 0x103ea, 0x103ec, 0x103ee, 0x103f4, 0x103f7, 0x103f9, 0x103fa, + 0x10460, 0x10462, 0x10464, 0x10466, 0x10468, 0x1046a, 0x1046c, 0x1046e, 0x10470, + 0x10472, 0x10474, 0x10476, 0x10478, 0x1047a, 0x1047c, 0x1047e, 0x10480, 0x1048a, + 0x1048c, 0x1048e, 0x10490, 0x10492, 0x10494, 0x10496, 0x10498, 0x1049a, 0x1049c, + 0x1049e, 0x104a0, 0x104a2, 0x104a4, 0x104a6, 0x104a8, 0x104aa, 0x104ac, 0x104ae, + 0x104b0, 0x104b2, 0x104b4, 0x104b6, 0x104b8, 0x104ba, 0x104bc, 0x104be, 0x104c0, + 0x104c1, 0x104c3, 0x104c5, 0x104c7, 0x104c9, 0x104cb, 0x104cd, 0x104d0, 0x104d2, + 0x104d4, 0x104d6, 0x104d8, 0x104da, 0x104dc, 0x104de, 0x104e0, 0x104e2, 0x104e4, + 0x104e6, 0x104e8, 0x104ea, 0x104ec, 0x104ee, 0x104f0, 0x104f2, 0x104f4, 0x104f6, + 0x104f8, 0x104fa, 0x104fc, 0x104fe, 0x10500, 0x10502, 0x10504, 0x10506, 0x10508, + 0x1050a, 0x1050c, 0x1050e, 0x10510, 0x10512, 0x10514, 0x10516, 0x10518, 0x1051a, + 0x1051c, 0x1051e, 0x10520, 0x10522, 0x10524, 0x10526, 0x10528, 0x1052a, 0x1052c, + 0x1052e, 0x110c7, 0x110cd, 0x11e00, 0x11e02, 0x11e04, 0x11e06, 0x11e08, 0x11e0a, + 0x11e0c, 0x11e0e, 0x11e10, 0x11e12, 0x11e14, 0x11e16, 0x11e18, 0x11e1a, 0x11e1c, + 0x11e1e, 0x11e20, 0x11e22, 0x11e24, 0x11e26, 0x11e28, 0x11e2a, 0x11e2c, 0x11e2e, + 0x11e30, 0x11e32, 0x11e34, 0x11e36, 0x11e38, 0x11e3a, 0x11e3c, 0x11e3e, 0x11e40, + 0x11e42, 0x11e44, 0x11e46, 0x11e48, 0x11e4a, 0x11e4c, 0x11e4e, 0x11e50, 0x11e52, + 0x11e54, 0x11e56, 0x11e58, 0x11e5a, 0x11e5c, 0x11e5e, 0x11e60, 0x11e62, 0x11e64, + 0x11e66, 0x11e68, 0x11e6a, 0x11e6c, 0x11e6e, 0x11e70, 0x11e72, 0x11e74, 0x11e76, + 0x11e78, 0x11e7a, 0x11e7c, 0x11e7e, 0x11e80, 0x11e82, 0x11e84, 0x11e86, 0x11e88, + 0x11e8a, 0x11e8c, 0x11e8e, 0x11e90, 0x11e92, 0x11e94, 0x11e9e, 0x11ea0, 0x11ea2, + 0x11ea4, 0x11ea6, 0x11ea8, 0x11eaa, 0x11eac, 0x11eae, 0x11eb0, 0x11eb2, 0x11eb4, + 0x11eb6, 0x11eb8, 0x11eba, 0x11ebc, 0x11ebe, 0x11ec0, 0x11ec2, 0x11ec4, 0x11ec6, + 0x11ec8, 0x11eca, 0x11ecc, 0x11ece, 0x11ed0, 0x11ed2, 0x11ed4, 0x11ed6, 0x11ed8, + 0x11eda, 0x11edc, 0x11ede, 0x11ee0, 0x11ee2, 0x11ee4, 0x11ee6, 0x11ee8, 0x11eea, + 0x11eec, 0x11eee, 0x11ef0, 0x11ef2, 0x11ef4, 0x11ef6, 0x11ef8, 0x11efa, 0x11efc, + 0x11efe, 0x11f59, 0x11f5b, 0x11f5d, 0x11f5f, 0x12102, 0x12107, 0x12115, 0x12124, + 0x12126, 0x12128, 0x1213e, 0x1213f, 0x12145, 0x12183, 0x12c60, 0x12c67, 0x12c69, + 0x12c6b, 0x12c72, 0x12c75, 0x12c82, 0x12c84, 0x12c86, 0x12c88, 0x12c8a, 0x12c8c, + 0x12c8e, 0x12c90, 0x12c92, 0x12c94, 0x12c96, 0x12c98, 0x12c9a, 0x12c9c, 0x12c9e, + 0x12ca0, 0x12ca2, 0x12ca4, 0x12ca6, 0x12ca8, 0x12caa, 0x12cac, 0x12cae, 0x12cb0, + 0x12cb2, 0x12cb4, 0x12cb6, 0x12cb8, 0x12cba, 0x12cbc, 0x12cbe, 0x12cc0, 0x12cc2, + 0x12cc4, 0x12cc6, 0x12cc8, 0x12cca, 0x12ccc, 0x12cce, 0x12cd0, 0x12cd2, 0x12cd4, + 0x12cd6, 0x12cd8, 0x12cda, 0x12cdc, 0x12cde, 0x12ce0, 0x12ce2, 0x12ceb, 0x12ced, + 0x12cf2, 0x1a640, 0x1a642, 0x1a644, 0x1a646, 0x1a648, 0x1a64a, 0x1a64c, 0x1a64e, + 0x1a650, 0x1a652, 0x1a654, 0x1a656, 0x1a658, 0x1a65a, 0x1a65c, 0x1a65e, 0x1a660, + 0x1a662, 0x1a664, 0x1a666, 0x1a668, 0x1a66a, 0x1a66c, 0x1a680, 0x1a682, 0x1a684, + 0x1a686, 0x1a688, 0x1a68a, 0x1a68c, 0x1a68e, 0x1a690, 0x1a692, 0x1a694, 0x1a696, + 0x1a698, 0x1a69a, 0x1a722, 0x1a724, 0x1a726, 0x1a728, 0x1a72a, 0x1a72c, 0x1a72e, + 0x1a732, 0x1a734, 0x1a736, 0x1a738, 0x1a73a, 0x1a73c, 0x1a73e, 0x1a740, 0x1a742, + 0x1a744, 0x1a746, 0x1a748, 0x1a74a, 0x1a74c, 0x1a74e, 0x1a750, 0x1a752, 0x1a754, + 0x1a756, 0x1a758, 0x1a75a, 0x1a75c, 0x1a75e, 0x1a760, 0x1a762, 0x1a764, 0x1a766, + 0x1a768, 0x1a76a, 0x1a76c, 0x1a76e, 0x1a779, 0x1a77b, 0x1a77d, 0x1a77e, 0x1a780, + 0x1a782, 0x1a784, 0x1a786, 0x1a78b, 0x1a78d, 0x1a790, 0x1a792, 0x1a796, 0x1a798, + 0x1a79a, 0x1a79c, 0x1a79e, 0x1a7a0, 0x1a7a2, 0x1a7a4, 0x1a7a6, 0x1a7a8, 0x1a7b6, + 0x20100, 0x20102, 0x20104, 0x20106, 0x20108, 0x2010a, 0x2010c, 0x2010e, 0x20110, + 0x20112, 0x20114, 0x20116, 0x20118, 0x2011a, 0x2011c, 0x2011e, 0x20120, 0x20122, + 0x20124, 0x20126, 0x20128, 0x2012a, 0x2012c, 0x2012e, 0x20130, 0x20132, 0x20134, + 0x20136, 0x20139, 0x2013b, 0x2013d, 0x2013f, 0x20141, 0x20143, 0x20145, 0x20147, + 0x2014a, 0x2014c, 0x2014e, 0x20150, 0x20152, 0x20154, 0x20156, 0x20158, 0x2015a, + 0x2015c, 0x2015e, 0x20160, 0x20162, 0x20164, 0x20166, 0x20168, 0x2016a, 0x2016c, + 0x2016e, 0x20170, 0x20172, 0x20174, 0x20176, 0x20178, 0x20179, 0x2017b, 0x2017d, + 0x20181, 0x20182, 0x20184, 0x20186, 0x20187, 0x20193, 0x20194, 0x2019c, 0x2019d, + 0x2019f, 0x201a0, 0x201a2, 0x201a4, 0x201a6, 0x201a7, 0x201a9, 0x201ac, 0x201ae, + 0x201af, 0x201b5, 0x201b7, 0x201b8, 0x201bc, 0x201c4, 0x201c7, 0x201ca, 0x201cd, + 0x201cf, 0x201d1, 0x201d3, 0x201d5, 0x201d7, 0x201d9, 0x201db, 0x201de, 0x201e0, + 0x201e2, 0x201e4, 0x201e6, 0x201e8, 0x201ea, 0x201ec, 0x201ee, 0x201f1, 0x201f4, + 0x201fa, 0x201fc, 0x201fe, 0x20200, 0x20202, 0x20204, 0x20206, 0x20208, 0x2020a, + 0x2020c, 0x2020e, 0x20210, 0x20212, 0x20214, 0x20216, 0x20218, 0x2021a, 0x2021c, + 0x2021e, 0x20220, 0x20222, 0x20224, 0x20226, 0x20228, 0x2022a, 0x2022c, 0x2022e, + 0x20230, 0x20232, 0x2023a, 0x2023b, 0x2023d, 0x2023e, 0x20241, 0x20248, 0x2024a, + 0x2024c, 0x2024e, 0x20370, 0x20372, 0x20376, 0x2037f, 0x20386, 0x2038c, 0x2038e, + 0x2038f, 0x203cf, 0x203d8, 0x203da, 0x203dc, 0x203de, 0x203e0, 0x203e2, 0x203e4, + 0x203e6, 0x203e8, 0x203ea, 0x203ec, 0x203ee, 0x203f4, 0x203f7, 0x203f9, 0x203fa, + 0x20460, 0x20462, 0x20464, 0x20466, 0x20468, 0x2046a, 0x2046c, 0x2046e, 0x20470, + 0x20472, 0x20474, 0x20476, 0x20478, 0x2047a, 0x2047c, 0x2047e, 0x20480, 0x2048a, + 0x2048c, 0x2048e, 0x20490, 0x20492, 0x20494, 0x20496, 0x20498, 0x2049a, 0x2049c, + 0x2049e, 0x204a0, 0x204a2, 0x204a4, 0x204a6, 0x204a8, 0x204aa, 0x204ac, 0x204ae, + 0x204b0, 0x204b2, 0x204b4, 0x204b6, 0x204b8, 0x204ba, 0x204bc, 0x204be, 0x204c0, + 0x204c1, 0x204c3, 0x204c5, 0x204c7, 0x204c9, 0x204cb, 0x204cd, 0x204d0, 0x204d2, + 0x204d4, 0x204d6, 0x204d8, 0x204da, 0x204dc, 0x204de, 0x204e0, 0x204e2, 0x204e4, + 0x204e6, 0x204e8, 0x204ea, 0x204ec, 0x204ee, 0x204f0, 0x204f2, 0x204f4, 0x204f6, + 0x204f8, 0x204fa, 0x204fc, 0x204fe, 0x20500, 0x20502, 0x20504, 0x20506, 0x20508, + 0x2050a, 0x2050c, 0x2050e, 0x20510, 0x20512, 0x20514, 0x20516, 0x20518, 0x2051a, + 0x2051c, 0x2051e, 0x20520, 0x20522, 0x20524, 0x20526, 0x20528, 0x2052a, 0x2052c, + 0x2052e, 0x210c7, 0x210cd, 0x21e00, 0x21e02, 0x21e04, 0x21e06, 0x21e08, 0x21e0a, + 0x21e0c, 0x21e0e, 0x21e10, 0x21e12, 0x21e14, 0x21e16, 0x21e18, 0x21e1a, 0x21e1c, + 0x21e1e, 0x21e20, 0x21e22, 0x21e24, 0x21e26, 0x21e28, 0x21e2a, 0x21e2c, 0x21e2e, + 0x21e30, 0x21e32, 0x21e34, 0x21e36, 0x21e38, 0x21e3a, 0x21e3c, 0x21e3e, 0x21e40, + 0x21e42, 0x21e44, 0x21e46, 0x21e48, 0x21e4a, 0x21e4c, 0x21e4e, 0x21e50, 0x21e52, + 0x21e54, 0x21e56, 0x21e58, 0x21e5a, 0x21e5c, 0x21e5e, 0x21e60, 0x21e62, 0x21e64, + 0x21e66, 0x21e68, 0x21e6a, 0x21e6c, 0x21e6e, 0x21e70, 0x21e72, 0x21e74, 0x21e76, + 0x21e78, 0x21e7a, 0x21e7c, 0x21e7e, 0x21e80, 0x21e82, 0x21e84, 0x21e86, 0x21e88, + 0x21e8a, 0x21e8c, 0x21e8e, 0x21e90, 0x21e92, 0x21e94, 0x21e9e, 0x21ea0, 0x21ea2, + 0x21ea4, 0x21ea6, 0x21ea8, 0x21eaa, 0x21eac, 0x21eae, 0x21eb0, 0x21eb2, 0x21eb4, + 0x21eb6, 0x21eb8, 0x21eba, 0x21ebc, 0x21ebe, 0x21ec0, 0x21ec2, 0x21ec4, 0x21ec6, + 0x21ec8, 0x21eca, 0x21ecc, 0x21ece, 0x21ed0, 0x21ed2, 0x21ed4, 0x21ed6, 0x21ed8, + 0x21eda, 0x21edc, 0x21ede, 0x21ee0, 0x21ee2, 0x21ee4, 0x21ee6, 0x21ee8, 0x21eea, + 0x21eec, 0x21eee, 0x21ef0, 0x21ef2, 0x21ef4, 0x21ef6, 0x21ef8, 0x21efa, 0x21efc, + 0x21efe, 0x21f59, 0x21f5b, 0x21f5d, 0x21f5f, 0x22102, 0x22107, 0x22115, 0x22124, + 0x22126, 0x22128, 0x2213e, 0x2213f, 0x22145, 0x22183, 0x22c60, 0x22c67, 0x22c69, + 0x22c6b, 0x22c72, 0x22c75, 0x22c82, 0x22c84, 0x22c86, 0x22c88, 0x22c8a, 0x22c8c, + 0x22c8e, 0x22c90, 0x22c92, 0x22c94, 0x22c96, 0x22c98, 0x22c9a, 0x22c9c, 0x22c9e, + 0x22ca0, 0x22ca2, 0x22ca4, 0x22ca6, 0x22ca8, 0x22caa, 0x22cac, 0x22cae, 0x22cb0, + 0x22cb2, 0x22cb4, 0x22cb6, 0x22cb8, 0x22cba, 0x22cbc, 0x22cbe, 0x22cc0, 0x22cc2, + 0x22cc4, 0x22cc6, 0x22cc8, 0x22cca, 0x22ccc, 0x22cce, 0x22cd0, 0x22cd2, 0x22cd4, + 0x22cd6, 0x22cd8, 0x22cda, 0x22cdc, 0x22cde, 0x22ce0, 0x22ce2, 0x22ceb, 0x22ced, + 0x22cf2, 0x2a640, 0x2a642, 0x2a644, 0x2a646, 0x2a648, 0x2a64a, 0x2a64c, 0x2a64e, + 0x2a650, 0x2a652, 0x2a654, 0x2a656, 0x2a658, 0x2a65a, 0x2a65c, 0x2a65e, 0x2a660, + 0x2a662, 0x2a664, 0x2a666, 0x2a668, 0x2a66a, 0x2a66c, 0x2a680, 0x2a682, 0x2a684, + 0x2a686, 0x2a688, 0x2a68a, 0x2a68c, 0x2a68e, 0x2a690, 0x2a692, 0x2a694, 0x2a696, + 0x2a698, 0x2a69a, 0x2a722, 0x2a724, 0x2a726, 0x2a728, 0x2a72a, 0x2a72c, 0x2a72e, + 0x2a732, 0x2a734, 0x2a736, 0x2a738, 0x2a73a, 0x2a73c, 0x2a73e, 0x2a740, 0x2a742, + 0x2a744, 0x2a746, 0x2a748, 0x2a74a, 0x2a74c, 0x2a74e, 0x2a750, 0x2a752, 0x2a754, + 0x2a756, 0x2a758, 0x2a75a, 0x2a75c, 0x2a75e, 0x2a760, 0x2a762, 0x2a764, 0x2a766, + 0x2a768, 0x2a76a, 0x2a76c, 0x2a76e, 0x2a779, 0x2a77b, 0x2a77d, 0x2a77e, 0x2a780, + 0x2a782, 0x2a784, 0x2a786, 0x2a78b, 0x2a78d, 0x2a790, 0x2a792, 0x2a796, 0x2a798, + 0x2a79a, 0x2a79c, 0x2a79e, 0x2a7a0, 0x2a7a2, 0x2a7a4, 0x2a7a6, 0x2a7a8, 0x2a7b6, + 0x30100, 0x30102, 0x30104, 0x30106, 0x30108, 0x3010a, 0x3010c, 0x3010e, 0x30110, + 0x30112, 0x30114, 0x30116, 0x30118, 0x3011a, 0x3011c, 0x3011e, 0x30120, 0x30122, + 0x30124, 0x30126, 0x30128, 0x3012a, 0x3012c, 0x3012e, 0x30130, 0x30132, 0x30134, + 0x30136, 0x30139, 0x3013b, 0x3013d, 0x3013f, 0x30141, 0x30143, 0x30145, 0x30147, + 0x3014a, 0x3014c, 0x3014e, 0x30150, 0x30152, 0x30154, 0x30156, 0x30158, 0x3015a, + 0x3015c, 0x3015e, 0x30160, 0x30162, 0x30164, 0x30166, 0x30168, 0x3016a, 0x3016c, + 0x3016e, 0x30170, 0x30172, 0x30174, 0x30176, 0x30178, 0x30179, 0x3017b, 0x3017d, + 0x30181, 0x30182, 0x30184, 0x30186, 0x30187, 0x30193, 0x30194, 0x3019c, 0x3019d, + 0x3019f, 0x301a0, 0x301a2, 0x301a4, 0x301a6, 0x301a7, 0x301a9, 0x301ac, 0x301ae, + 0x301af, 0x301b5, 0x301b7, 0x301b8, 0x301bc, 0x301c4, 0x301c7, 0x301ca, 0x301cd, + 0x301cf, 0x301d1, 0x301d3, 0x301d5, 0x301d7, 0x301d9, 0x301db, 0x301de, 0x301e0, + 0x301e2, 0x301e4, 0x301e6, 0x301e8, 0x301ea, 0x301ec, 0x301ee, 0x301f1, 0x301f4, + 0x301fa, 0x301fc, 0x301fe, 0x30200, 0x30202, 0x30204, 0x30206, 0x30208, 0x3020a, + 0x3020c, 0x3020e, 0x30210, 0x30212, 0x30214, 0x30216, 0x30218, 0x3021a, 0x3021c, + 0x3021e, 0x30220, 0x30222, 0x30224, 0x30226, 0x30228, 0x3022a, 0x3022c, 0x3022e, + 0x30230, 0x30232, 0x3023a, 0x3023b, 0x3023d, 0x3023e, 0x30241, 0x30248, 0x3024a, + 0x3024c, 0x3024e, 0x30370, 0x30372, 0x30376, 0x3037f, 0x30386, 0x3038c, 0x3038e, + 0x3038f, 0x303cf, 0x303d8, 0x303da, 0x303dc, 0x303de, 0x303e0, 0x303e2, 0x303e4, + 0x303e6, 0x303e8, 0x303ea, 0x303ec, 0x303ee, 0x303f4, 0x303f7, 0x303f9, 0x303fa, + 0x30460, 0x30462, 0x30464, 0x30466, 0x30468, 0x3046a, 0x3046c, 0x3046e, 0x30470, + 0x30472, 0x30474, 0x30476, 0x30478, 0x3047a, 0x3047c, 0x3047e, 0x30480, 0x3048a, + 0x3048c, 0x3048e, 0x30490, 0x30492, 0x30494, 0x30496, 0x30498, 0x3049a, 0x3049c, + 0x3049e, 0x304a0, 0x304a2, 0x304a4, 0x304a6, 0x304a8, 0x304aa, 0x304ac, 0x304ae, + 0x304b0, 0x304b2, 0x304b4, 0x304b6, 0x304b8, 0x304ba, 0x304bc, 0x304be, 0x304c0, + 0x304c1, 0x304c3, 0x304c5, 0x304c7, 0x304c9, 0x304cb, 0x304cd, 0x304d0, 0x304d2, + 0x304d4, 0x304d6, 0x304d8, 0x304da, 0x304dc, 0x304de, 0x304e0, 0x304e2, 0x304e4, + 0x304e6, 0x304e8, 0x304ea, 0x304ec, 0x304ee, 0x304f0, 0x304f2, 0x304f4, 0x304f6, + 0x304f8, 0x304fa, 0x304fc, 0x304fe, 0x30500, 0x30502, 0x30504, 0x30506, 0x30508, + 0x3050a, 0x3050c, 0x3050e, 0x30510, 0x30512, 0x30514, 0x30516, 0x30518, 0x3051a, + 0x3051c, 0x3051e, 0x30520, 0x30522, 0x30524, 0x30526, 0x30528, 0x3052a, 0x3052c, + 0x3052e, 0x310c7, 0x310cd, 0x31e00, 0x31e02, 0x31e04, 0x31e06, 0x31e08, 0x31e0a, + 0x31e0c, 0x31e0e, 0x31e10, 0x31e12, 0x31e14, 0x31e16, 0x31e18, 0x31e1a, 0x31e1c, + 0x31e1e, 0x31e20, 0x31e22, 0x31e24, 0x31e26, 0x31e28, 0x31e2a, 0x31e2c, 0x31e2e, + 0x31e30, 0x31e32, 0x31e34, 0x31e36, 0x31e38, 0x31e3a, 0x31e3c, 0x31e3e, 0x31e40, + 0x31e42, 0x31e44, 0x31e46, 0x31e48, 0x31e4a, 0x31e4c, 0x31e4e, 0x31e50, 0x31e52, + 0x31e54, 0x31e56, 0x31e58, 0x31e5a, 0x31e5c, 0x31e5e, 0x31e60, 0x31e62, 0x31e64, + 0x31e66, 0x31e68, 0x31e6a, 0x31e6c, 0x31e6e, 0x31e70, 0x31e72, 0x31e74, 0x31e76, + 0x31e78, 0x31e7a, 0x31e7c, 0x31e7e, 0x31e80, 0x31e82, 0x31e84, 0x31e86, 0x31e88, + 0x31e8a, 0x31e8c, 0x31e8e, 0x31e90, 0x31e92, 0x31e94, 0x31e9e, 0x31ea0, 0x31ea2, + 0x31ea4, 0x31ea6, 0x31ea8, 0x31eaa, 0x31eac, 0x31eae, 0x31eb0, 0x31eb2, 0x31eb4, + 0x31eb6, 0x31eb8, 0x31eba, 0x31ebc, 0x31ebe, 0x31ec0, 0x31ec2, 0x31ec4, 0x31ec6, + 0x31ec8, 0x31eca, 0x31ecc, 0x31ece, 0x31ed0, 0x31ed2, 0x31ed4, 0x31ed6, 0x31ed8, + 0x31eda, 0x31edc, 0x31ede, 0x31ee0, 0x31ee2, 0x31ee4, 0x31ee6, 0x31ee8, 0x31eea, + 0x31eec, 0x31eee, 0x31ef0, 0x31ef2, 0x31ef4, 0x31ef6, 0x31ef8, 0x31efa, 0x31efc, + 0x31efe, 0x31f59, 0x31f5b, 0x31f5d, 0x31f5f, 0x32102, 0x32107, 0x32115, 0x32124, + 0x32126, 0x32128, 0x3213e, 0x3213f, 0x32145, 0x32183, 0x32c60, 0x32c67, 0x32c69, + 0x32c6b, 0x32c72, 0x32c75, 0x32c82, 0x32c84, 0x32c86, 0x32c88, 0x32c8a, 0x32c8c, + 0x32c8e, 0x32c90, 0x32c92, 0x32c94, 0x32c96, 0x32c98, 0x32c9a, 0x32c9c, 0x32c9e, + 0x32ca0, 0x32ca2, 0x32ca4, 0x32ca6, 0x32ca8, 0x32caa, 0x32cac, 0x32cae, 0x32cb0, + 0x32cb2, 0x32cb4, 0x32cb6, 0x32cb8, 0x32cba, 0x32cbc, 0x32cbe, 0x32cc0, 0x32cc2, + 0x32cc4, 0x32cc6, 0x32cc8, 0x32cca, 0x32ccc, 0x32cce, 0x32cd0, 0x32cd2, 0x32cd4, + 0x32cd6, 0x32cd8, 0x32cda, 0x32cdc, 0x32cde, 0x32ce0, 0x32ce2, 0x32ceb, 0x32ced, + 0x32cf2, 0x3a640, 0x3a642, 0x3a644, 0x3a646, 0x3a648, 0x3a64a, 0x3a64c, 0x3a64e, + 0x3a650, 0x3a652, 0x3a654, 0x3a656, 0x3a658, 0x3a65a, 0x3a65c, 0x3a65e, 0x3a660, + 0x3a662, 0x3a664, 0x3a666, 0x3a668, 0x3a66a, 0x3a66c, 0x3a680, 0x3a682, 0x3a684, + 0x3a686, 0x3a688, 0x3a68a, 0x3a68c, 0x3a68e, 0x3a690, 0x3a692, 0x3a694, 0x3a696, + 0x3a698, 0x3a69a, 0x3a722, 0x3a724, 0x3a726, 0x3a728, 0x3a72a, 0x3a72c, 0x3a72e, + 0x3a732, 0x3a734, 0x3a736, 0x3a738, 0x3a73a, 0x3a73c, 0x3a73e, 0x3a740, 0x3a742, + 0x3a744, 0x3a746, 0x3a748, 0x3a74a, 0x3a74c, 0x3a74e, 0x3a750, 0x3a752, 0x3a754, + 0x3a756, 0x3a758, 0x3a75a, 0x3a75c, 0x3a75e, 0x3a760, 0x3a762, 0x3a764, 0x3a766, + 0x3a768, 0x3a76a, 0x3a76c, 0x3a76e, 0x3a779, 0x3a77b, 0x3a77d, 0x3a77e, 0x3a780, + 0x3a782, 0x3a784, 0x3a786, 0x3a78b, 0x3a78d, 0x3a790, 0x3a792, 0x3a796, 0x3a798, + 0x3a79a, 0x3a79c, 0x3a79e, 0x3a7a0, 0x3a7a2, 0x3a7a4, 0x3a7a6, 0x3a7a8, 0x3a7b6, + 0x40100, 0x40102, 0x40104, 0x40106, 0x40108, 0x4010a, 0x4010c, 0x4010e, 0x40110, + 0x40112, 0x40114, 0x40116, 0x40118, 0x4011a, 0x4011c, 0x4011e, 0x40120, 0x40122, + 0x40124, 0x40126, 0x40128, 0x4012a, 0x4012c, 0x4012e, 0x40130, 0x40132, 0x40134, + 0x40136, 0x40139, 0x4013b, 0x4013d, 0x4013f, 0x40141, 0x40143, 0x40145, 0x40147, + 0x4014a, 0x4014c, 0x4014e, 0x40150, 0x40152, 0x40154, 0x40156, 0x40158, 0x4015a, + 0x4015c, 0x4015e, 0x40160, 0x40162, 0x40164, 0x40166, 0x40168, 0x4016a, 0x4016c, + 0x4016e, 0x40170, 0x40172, 0x40174, 0x40176, 0x40178, 0x40179, 0x4017b, 0x4017d, + 0x40181, 0x40182, 0x40184, 0x40186, 0x40187, 0x40193, 0x40194, 0x4019c, 0x4019d, + 0x4019f, 0x401a0, 0x401a2, 0x401a4, 0x401a6, 0x401a7, 0x401a9, 0x401ac, 0x401ae, + 0x401af, 0x401b5, 0x401b7, 0x401b8, 0x401bc, 0x401c4, 0x401c7, 0x401ca, 0x401cd, + 0x401cf, 0x401d1, 0x401d3, 0x401d5, 0x401d7, 0x401d9, 0x401db, 0x401de, 0x401e0, + 0x401e2, 0x401e4, 0x401e6, 0x401e8, 0x401ea, 0x401ec, 0x401ee, 0x401f1, 0x401f4, + 0x401fa, 0x401fc, 0x401fe, 0x40200, 0x40202, 0x40204, 0x40206, 0x40208, 0x4020a, + 0x4020c, 0x4020e, 0x40210, 0x40212, 0x40214, 0x40216, 0x40218, 0x4021a, 0x4021c, + 0x4021e, 0x40220, 0x40222, 0x40224, 0x40226, 0x40228, 0x4022a, 0x4022c, 0x4022e, + 0x40230, 0x40232, 0x4023a, 0x4023b, 0x4023d, 0x4023e, 0x40241, 0x40248, 0x4024a, + 0x4024c, 0x4024e, 0x40370, 0x40372, 0x40376, 0x4037f, 0x40386, 0x4038c, 0x4038e, + 0x4038f, 0x403cf, 0x403d8, 0x403da, 0x403dc, 0x403de, 0x403e0, 0x403e2, 0x403e4, + 0x403e6, 0x403e8, 0x403ea, 0x403ec, 0x403ee, 0x403f4, 0x403f7, 0x403f9, 0x403fa, + 0x40460, 0x40462, 0x40464, 0x40466, 0x40468, 0x4046a, 0x4046c, 0x4046e, 0x40470, + 0x40472, 0x40474, 0x40476, 0x40478, 0x4047a, 0x4047c, 0x4047e, 0x40480, 0x4048a, + 0x4048c, 0x4048e, 0x40490, 0x40492, 0x40494, 0x40496, 0x40498, 0x4049a, 0x4049c, + 0x4049e, 0x404a0, 0x404a2, 0x404a4, 0x404a6, 0x404a8, 0x404aa, 0x404ac, 0x404ae, + 0x404b0, 0x404b2, 0x404b4, 0x404b6, 0x404b8, 0x404ba, 0x404bc, 0x404be, 0x404c0, + 0x404c1, 0x404c3, 0x404c5, 0x404c7, 0x404c9, 0x404cb, 0x404cd, 0x404d0, 0x404d2, + 0x404d4, 0x404d6, 0x404d8, 0x404da, 0x404dc, 0x404de, 0x404e0, 0x404e2, 0x404e4, + 0x404e6, 0x404e8, 0x404ea, 0x404ec, 0x404ee, 0x404f0, 0x404f2, 0x404f4, 0x404f6, + 0x404f8, 0x404fa, 0x404fc, 0x404fe, 0x40500, 0x40502, 0x40504, 0x40506, 0x40508, + 0x4050a, 0x4050c, 0x4050e, 0x40510, 0x40512, 0x40514, 0x40516, 0x40518, 0x4051a, + 0x4051c, 0x4051e, 0x40520, 0x40522, 0x40524, 0x40526, 0x40528, 0x4052a, 0x4052c, + 0x4052e, 0x410c7, 0x410cd, 0x41e00, 0x41e02, 0x41e04, 0x41e06, 0x41e08, 0x41e0a, + 0x41e0c, 0x41e0e, 0x41e10, 0x41e12, 0x41e14, 0x41e16, 0x41e18, 0x41e1a, 0x41e1c, + 0x41e1e, 0x41e20, 0x41e22, 0x41e24, 0x41e26, 0x41e28, 0x41e2a, 0x41e2c, 0x41e2e, + 0x41e30, 0x41e32, 0x41e34, 0x41e36, 0x41e38, 0x41e3a, 0x41e3c, 0x41e3e, 0x41e40, + 0x41e42, 0x41e44, 0x41e46, 0x41e48, 0x41e4a, 0x41e4c, 0x41e4e, 0x41e50, 0x41e52, + 0x41e54, 0x41e56, 0x41e58, 0x41e5a, 0x41e5c, 0x41e5e, 0x41e60, 0x41e62, 0x41e64, + 0x41e66, 0x41e68, 0x41e6a, 0x41e6c, 0x41e6e, 0x41e70, 0x41e72, 0x41e74, 0x41e76, + 0x41e78, 0x41e7a, 0x41e7c, 0x41e7e, 0x41e80, 0x41e82, 0x41e84, 0x41e86, 0x41e88, + 0x41e8a, 0x41e8c, 0x41e8e, 0x41e90, 0x41e92, 0x41e94, 0x41e9e, 0x41ea0, 0x41ea2, + 0x41ea4, 0x41ea6, 0x41ea8, 0x41eaa, 0x41eac, 0x41eae, 0x41eb0, 0x41eb2, 0x41eb4, + 0x41eb6, 0x41eb8, 0x41eba, 0x41ebc, 0x41ebe, 0x41ec0, 0x41ec2, 0x41ec4, 0x41ec6, + 0x41ec8, 0x41eca, 0x41ecc, 0x41ece, 0x41ed0, 0x41ed2, 0x41ed4, 0x41ed6, 0x41ed8, + 0x41eda, 0x41edc, 0x41ede, 0x41ee0, 0x41ee2, 0x41ee4, 0x41ee6, 0x41ee8, 0x41eea, + 0x41eec, 0x41eee, 0x41ef0, 0x41ef2, 0x41ef4, 0x41ef6, 0x41ef8, 0x41efa, 0x41efc, + 0x41efe, 0x41f59, 0x41f5b, 0x41f5d, 0x41f5f, 0x42102, 0x42107, 0x42115, 0x42124, + 0x42126, 0x42128, 0x4213e, 0x4213f, 0x42145, 0x42183, 0x42c60, 0x42c67, 0x42c69, + 0x42c6b, 0x42c72, 0x42c75, 0x42c82, 0x42c84, 0x42c86, 0x42c88, 0x42c8a, 0x42c8c, + 0x42c8e, 0x42c90, 0x42c92, 0x42c94, 0x42c96, 0x42c98, 0x42c9a, 0x42c9c, 0x42c9e, + 0x42ca0, 0x42ca2, 0x42ca4, 0x42ca6, 0x42ca8, 0x42caa, 0x42cac, 0x42cae, 0x42cb0, + 0x42cb2, 0x42cb4, 0x42cb6, 0x42cb8, 0x42cba, 0x42cbc, 0x42cbe, 0x42cc0, 0x42cc2, + 0x42cc4, 0x42cc6, 0x42cc8, 0x42cca, 0x42ccc, 0x42cce, 0x42cd0, 0x42cd2, 0x42cd4, + 0x42cd6, 0x42cd8, 0x42cda, 0x42cdc, 0x42cde, 0x42ce0, 0x42ce2, 0x42ceb, 0x42ced, + 0x42cf2, 0x4a640, 0x4a642, 0x4a644, 0x4a646, 0x4a648, 0x4a64a, 0x4a64c, 0x4a64e, + 0x4a650, 0x4a652, 0x4a654, 0x4a656, 0x4a658, 0x4a65a, 0x4a65c, 0x4a65e, 0x4a660, + 0x4a662, 0x4a664, 0x4a666, 0x4a668, 0x4a66a, 0x4a66c, 0x4a680, 0x4a682, 0x4a684, + 0x4a686, 0x4a688, 0x4a68a, 0x4a68c, 0x4a68e, 0x4a690, 0x4a692, 0x4a694, 0x4a696, + 0x4a698, 0x4a69a, 0x4a722, 0x4a724, 0x4a726, 0x4a728, 0x4a72a, 0x4a72c, 0x4a72e, + 0x4a732, 0x4a734, 0x4a736, 0x4a738, 0x4a73a, 0x4a73c, 0x4a73e, 0x4a740, 0x4a742, + 0x4a744, 0x4a746, 0x4a748, 0x4a74a, 0x4a74c, 0x4a74e, 0x4a750, 0x4a752, 0x4a754, + 0x4a756, 0x4a758, 0x4a75a, 0x4a75c, 0x4a75e, 0x4a760, 0x4a762, 0x4a764, 0x4a766, + 0x4a768, 0x4a76a, 0x4a76c, 0x4a76e, 0x4a779, 0x4a77b, 0x4a77d, 0x4a77e, 0x4a780, + 0x4a782, 0x4a784, 0x4a786, 0x4a78b, 0x4a78d, 0x4a790, 0x4a792, 0x4a796, 0x4a798, + 0x4a79a, 0x4a79c, 0x4a79e, 0x4a7a0, 0x4a7a2, 0x4a7a4, 0x4a7a6, 0x4a7a8, 0x4a7b6, + 0x50100, 0x50102, 0x50104, 0x50106, 0x50108, 0x5010a, 0x5010c, 0x5010e, 0x50110, + 0x50112, 0x50114, 0x50116, 0x50118, 0x5011a, 0x5011c, 0x5011e, 0x50120, 0x50122, + 0x50124, 0x50126, 0x50128, 0x5012a, 0x5012c, 0x5012e, 0x50130, 0x50132, 0x50134, + 0x50136, 0x50139, 0x5013b, 0x5013d, 0x5013f, 0x50141, 0x50143, 0x50145, 0x50147, + 0x5014a, 0x5014c, 0x5014e, 0x50150, 0x50152, 0x50154, 0x50156, 0x50158, 0x5015a, + 0x5015c, 0x5015e, 0x50160, 0x50162, 0x50164, 0x50166, 0x50168, 0x5016a, 0x5016c, + 0x5016e, 0x50170, 0x50172, 0x50174, 0x50176, 0x50178, 0x50179, 0x5017b, 0x5017d, + 0x50181, 0x50182, 0x50184, 0x50186, 0x50187, 0x50193, 0x50194, 0x5019c, 0x5019d, + 0x5019f, 0x501a0, 0x501a2, 0x501a4, 0x501a6, 0x501a7, 0x501a9, 0x501ac, 0x501ae, + 0x501af, 0x501b5, 0x501b7, 0x501b8, 0x501bc, 0x501c4, 0x501c7, 0x501ca, 0x501cd, + 0x501cf, 0x501d1, 0x501d3, 0x501d5, 0x501d7, 0x501d9, 0x501db, 0x501de, 0x501e0, + 0x501e2, 0x501e4, 0x501e6, 0x501e8, 0x501ea, 0x501ec, 0x501ee, 0x501f1, 0x501f4, + 0x501fa, 0x501fc, 0x501fe, 0x50200, 0x50202, 0x50204, 0x50206, 0x50208, 0x5020a, + 0x5020c, 0x5020e, 0x50210, 0x50212, 0x50214, 0x50216, 0x50218, 0x5021a, 0x5021c, + 0x5021e, 0x50220, 0x50222, 0x50224, 0x50226, 0x50228, 0x5022a, 0x5022c, 0x5022e, + 0x50230, 0x50232, 0x5023a, 0x5023b, 0x5023d, 0x5023e, 0x50241, 0x50248, 0x5024a, + 0x5024c, 0x5024e, 0x50370, 0x50372, 0x50376, 0x5037f, 0x50386, 0x5038c, 0x5038e, + 0x5038f, 0x503cf, 0x503d8, 0x503da, 0x503dc, 0x503de, 0x503e0, 0x503e2, 0x503e4, + 0x503e6, 0x503e8, 0x503ea, 0x503ec, 0x503ee, 0x503f4, 0x503f7, 0x503f9, 0x503fa, + 0x50460, 0x50462, 0x50464, 0x50466, 0x50468, 0x5046a, 0x5046c, 0x5046e, 0x50470, + 0x50472, 0x50474, 0x50476, 0x50478, 0x5047a, 0x5047c, 0x5047e, 0x50480, 0x5048a, + 0x5048c, 0x5048e, 0x50490, 0x50492, 0x50494, 0x50496, 0x50498, 0x5049a, 0x5049c, + 0x5049e, 0x504a0, 0x504a2, 0x504a4, 0x504a6, 0x504a8, 0x504aa, 0x504ac, 0x504ae, + 0x504b0, 0x504b2, 0x504b4, 0x504b6, 0x504b8, 0x504ba, 0x504bc, 0x504be, 0x504c0, + 0x504c1, 0x504c3, 0x504c5, 0x504c7, 0x504c9, 0x504cb, 0x504cd, 0x504d0, 0x504d2, + 0x504d4, 0x504d6, 0x504d8, 0x504da, 0x504dc, 0x504de, 0x504e0, 0x504e2, 0x504e4, + 0x504e6, 0x504e8, 0x504ea, 0x504ec, 0x504ee, 0x504f0, 0x504f2, 0x504f4, 0x504f6, + 0x504f8, 0x504fa, 0x504fc, 0x504fe, 0x50500, 0x50502, 0x50504, 0x50506, 0x50508, + 0x5050a, 0x5050c, 0x5050e, 0x50510, 0x50512, 0x50514, 0x50516, 0x50518, 0x5051a, + 0x5051c, 0x5051e, 0x50520, 0x50522, 0x50524, 0x50526, 0x50528, 0x5052a, 0x5052c, + 0x5052e, 0x510c7, 0x510cd, 0x51e00, 0x51e02, 0x51e04, 0x51e06, 0x51e08, 0x51e0a, + 0x51e0c, 0x51e0e, 0x51e10, 0x51e12, 0x51e14, 0x51e16, 0x51e18, 0x51e1a, 0x51e1c, + 0x51e1e, 0x51e20, 0x51e22, 0x51e24, 0x51e26, 0x51e28, 0x51e2a, 0x51e2c, 0x51e2e, + 0x51e30, 0x51e32, 0x51e34, 0x51e36, 0x51e38, 0x51e3a, 0x51e3c, 0x51e3e, 0x51e40, + 0x51e42, 0x51e44, 0x51e46, 0x51e48, 0x51e4a, 0x51e4c, 0x51e4e, 0x51e50, 0x51e52, + 0x51e54, 0x51e56, 0x51e58, 0x51e5a, 0x51e5c, 0x51e5e, 0x51e60, 0x51e62, 0x51e64, + 0x51e66, 0x51e68, 0x51e6a, 0x51e6c, 0x51e6e, 0x51e70, 0x51e72, 0x51e74, 0x51e76, + 0x51e78, 0x51e7a, 0x51e7c, 0x51e7e, 0x51e80, 0x51e82, 0x51e84, 0x51e86, 0x51e88, + 0x51e8a, 0x51e8c, 0x51e8e, 0x51e90, 0x51e92, 0x51e94, 0x51e9e, 0x51ea0, 0x51ea2, + 0x51ea4, 0x51ea6, 0x51ea8, 0x51eaa, 0x51eac, 0x51eae, 0x51eb0, 0x51eb2, 0x51eb4, + 0x51eb6, 0x51eb8, 0x51eba, 0x51ebc, 0x51ebe, 0x51ec0, 0x51ec2, 0x51ec4, 0x51ec6, + 0x51ec8, 0x51eca, 0x51ecc, 0x51ece, 0x51ed0, 0x51ed2, 0x51ed4, 0x51ed6, 0x51ed8, + 0x51eda, 0x51edc, 0x51ede, 0x51ee0, 0x51ee2, 0x51ee4, 0x51ee6, 0x51ee8, 0x51eea, + 0x51eec, 0x51eee, 0x51ef0, 0x51ef2, 0x51ef4, 0x51ef6, 0x51ef8, 0x51efa, 0x51efc, + 0x51efe, 0x51f59, 0x51f5b, 0x51f5d, 0x51f5f, 0x52102, 0x52107, 0x52115, 0x52124, + 0x52126, 0x52128, 0x5213e, 0x5213f, 0x52145, 0x52183, 0x52c60, 0x52c67, 0x52c69, + 0x52c6b, 0x52c72, 0x52c75, 0x52c82, 0x52c84, 0x52c86, 0x52c88, 0x52c8a, 0x52c8c, + 0x52c8e, 0x52c90, 0x52c92, 0x52c94, 0x52c96, 0x52c98, 0x52c9a, 0x52c9c, 0x52c9e, + 0x52ca0, 0x52ca2, 0x52ca4, 0x52ca6, 0x52ca8, 0x52caa, 0x52cac, 0x52cae, 0x52cb0, + 0x52cb2, 0x52cb4, 0x52cb6, 0x52cb8, 0x52cba, 0x52cbc, 0x52cbe, 0x52cc0, 0x52cc2, + 0x52cc4, 0x52cc6, 0x52cc8, 0x52cca, 0x52ccc, 0x52cce, 0x52cd0, 0x52cd2, 0x52cd4, + 0x52cd6, 0x52cd8, 0x52cda, 0x52cdc, 0x52cde, 0x52ce0, 0x52ce2, 0x52ceb, 0x52ced, + 0x52cf2, 0x5a640, 0x5a642, 0x5a644, 0x5a646, 0x5a648, 0x5a64a, 0x5a64c, 0x5a64e, + 0x5a650, 0x5a652, 0x5a654, 0x5a656, 0x5a658, 0x5a65a, 0x5a65c, 0x5a65e, 0x5a660, + 0x5a662, 0x5a664, 0x5a666, 0x5a668, 0x5a66a, 0x5a66c, 0x5a680, 0x5a682, 0x5a684, + 0x5a686, 0x5a688, 0x5a68a, 0x5a68c, 0x5a68e, 0x5a690, 0x5a692, 0x5a694, 0x5a696, + 0x5a698, 0x5a69a, 0x5a722, 0x5a724, 0x5a726, 0x5a728, 0x5a72a, 0x5a72c, 0x5a72e, + 0x5a732, 0x5a734, 0x5a736, 0x5a738, 0x5a73a, 0x5a73c, 0x5a73e, 0x5a740, 0x5a742, + 0x5a744, 0x5a746, 0x5a748, 0x5a74a, 0x5a74c, 0x5a74e, 0x5a750, 0x5a752, 0x5a754, + 0x5a756, 0x5a758, 0x5a75a, 0x5a75c, 0x5a75e, 0x5a760, 0x5a762, 0x5a764, 0x5a766, + 0x5a768, 0x5a76a, 0x5a76c, 0x5a76e, 0x5a779, 0x5a77b, 0x5a77d, 0x5a77e, 0x5a780, + 0x5a782, 0x5a784, 0x5a786, 0x5a78b, 0x5a78d, 0x5a790, 0x5a792, 0x5a796, 0x5a798, + 0x5a79a, 0x5a79c, 0x5a79e, 0x5a7a0, 0x5a7a2, 0x5a7a4, 0x5a7a6, 0x5a7a8, 0x5a7b6, + 0x60100, 0x60102, 0x60104, 0x60106, 0x60108, 0x6010a, 0x6010c, 0x6010e, 0x60110, + 0x60112, 0x60114, 0x60116, 0x60118, 0x6011a, 0x6011c, 0x6011e, 0x60120, 0x60122, + 0x60124, 0x60126, 0x60128, 0x6012a, 0x6012c, 0x6012e, 0x60130, 0x60132, 0x60134, + 0x60136, 0x60139, 0x6013b, 0x6013d, 0x6013f, 0x60141, 0x60143, 0x60145, 0x60147, + 0x6014a, 0x6014c, 0x6014e, 0x60150, 0x60152, 0x60154, 0x60156, 0x60158, 0x6015a, + 0x6015c, 0x6015e, 0x60160, 0x60162, 0x60164, 0x60166, 0x60168, 0x6016a, 0x6016c, + 0x6016e, 0x60170, 0x60172, 0x60174, 0x60176, 0x60178, 0x60179, 0x6017b, 0x6017d, + 0x60181, 0x60182, 0x60184, 0x60186, 0x60187, 0x60193, 0x60194, 0x6019c, 0x6019d, + 0x6019f, 0x601a0, 0x601a2, 0x601a4, 0x601a6, 0x601a7, 0x601a9, 0x601ac, 0x601ae, + 0x601af, 0x601b5, 0x601b7, 0x601b8, 0x601bc, 0x601c4, 0x601c7, 0x601ca, 0x601cd, + 0x601cf, 0x601d1, 0x601d3, 0x601d5, 0x601d7, 0x601d9, 0x601db, 0x601de, 0x601e0, + 0x601e2, 0x601e4, 0x601e6, 0x601e8, 0x601ea, 0x601ec, 0x601ee, 0x601f1, 0x601f4, + 0x601fa, 0x601fc, 0x601fe, 0x60200, 0x60202, 0x60204, 0x60206, 0x60208, 0x6020a, + 0x6020c, 0x6020e, 0x60210, 0x60212, 0x60214, 0x60216, 0x60218, 0x6021a, 0x6021c, + 0x6021e, 0x60220, 0x60222, 0x60224, 0x60226, 0x60228, 0x6022a, 0x6022c, 0x6022e, + 0x60230, 0x60232, 0x6023a, 0x6023b, 0x6023d, 0x6023e, 0x60241, 0x60248, 0x6024a, + 0x6024c, 0x6024e, 0x60370, 0x60372, 0x60376, 0x6037f, 0x60386, 0x6038c, 0x6038e, + 0x6038f, 0x603cf, 0x603d8, 0x603da, 0x603dc, 0x603de, 0x603e0, 0x603e2, 0x603e4, + 0x603e6, 0x603e8, 0x603ea, 0x603ec, 0x603ee, 0x603f4, 0x603f7, 0x603f9, 0x603fa, + 0x60460, 0x60462, 0x60464, 0x60466, 0x60468, 0x6046a, 0x6046c, 0x6046e, 0x60470, + 0x60472, 0x60474, 0x60476, 0x60478, 0x6047a, 0x6047c, 0x6047e, 0x60480, 0x6048a, + 0x6048c, 0x6048e, 0x60490, 0x60492, 0x60494, 0x60496, 0x60498, 0x6049a, 0x6049c, + 0x6049e, 0x604a0, 0x604a2, 0x604a4, 0x604a6, 0x604a8, 0x604aa, 0x604ac, 0x604ae, + 0x604b0, 0x604b2, 0x604b4, 0x604b6, 0x604b8, 0x604ba, 0x604bc, 0x604be, 0x604c0, + 0x604c1, 0x604c3, 0x604c5, 0x604c7, 0x604c9, 0x604cb, 0x604cd, 0x604d0, 0x604d2, + 0x604d4, 0x604d6, 0x604d8, 0x604da, 0x604dc, 0x604de, 0x604e0, 0x604e2, 0x604e4, + 0x604e6, 0x604e8, 0x604ea, 0x604ec, 0x604ee, 0x604f0, 0x604f2, 0x604f4, 0x604f6, + 0x604f8, 0x604fa, 0x604fc, 0x604fe, 0x60500, 0x60502, 0x60504, 0x60506, 0x60508, + 0x6050a, 0x6050c, 0x6050e, 0x60510, 0x60512, 0x60514, 0x60516, 0x60518, 0x6051a, + 0x6051c, 0x6051e, 0x60520, 0x60522, 0x60524, 0x60526, 0x60528, 0x6052a, 0x6052c, + 0x6052e, 0x610c7, 0x610cd, 0x61e00, 0x61e02, 0x61e04, 0x61e06, 0x61e08, 0x61e0a, + 0x61e0c, 0x61e0e, 0x61e10, 0x61e12, 0x61e14, 0x61e16, 0x61e18, 0x61e1a, 0x61e1c, + 0x61e1e, 0x61e20, 0x61e22, 0x61e24, 0x61e26, 0x61e28, 0x61e2a, 0x61e2c, 0x61e2e, + 0x61e30, 0x61e32, 0x61e34, 0x61e36, 0x61e38, 0x61e3a, 0x61e3c, 0x61e3e, 0x61e40, + 0x61e42, 0x61e44, 0x61e46, 0x61e48, 0x61e4a, 0x61e4c, 0x61e4e, 0x61e50, 0x61e52, + 0x61e54, 0x61e56, 0x61e58, 0x61e5a, 0x61e5c, 0x61e5e, 0x61e60, 0x61e62, 0x61e64, + 0x61e66, 0x61e68, 0x61e6a, 0x61e6c, 0x61e6e, 0x61e70, 0x61e72, 0x61e74, 0x61e76, + 0x61e78, 0x61e7a, 0x61e7c, 0x61e7e, 0x61e80, 0x61e82, 0x61e84, 0x61e86, 0x61e88, + 0x61e8a, 0x61e8c, 0x61e8e, 0x61e90, 0x61e92, 0x61e94, 0x61e9e, 0x61ea0, 0x61ea2, + 0x61ea4, 0x61ea6, 0x61ea8, 0x61eaa, 0x61eac, 0x61eae, 0x61eb0, 0x61eb2, 0x61eb4, + 0x61eb6, 0x61eb8, 0x61eba, 0x61ebc, 0x61ebe, 0x61ec0, 0x61ec2, 0x61ec4, 0x61ec6, + 0x61ec8, 0x61eca, 0x61ecc, 0x61ece, 0x61ed0, 0x61ed2, 0x61ed4, 0x61ed6, 0x61ed8, + 0x61eda, 0x61edc, 0x61ede, 0x61ee0, 0x61ee2, 0x61ee4, 0x61ee6, 0x61ee8, 0x61eea, + 0x61eec, 0x61eee, 0x61ef0, 0x61ef2, 0x61ef4, 0x61ef6, 0x61ef8, 0x61efa, 0x61efc, + 0x61efe, 0x61f59, 0x61f5b, 0x61f5d, 0x61f5f, 0x62102, 0x62107, 0x62115, 0x62124, + 0x62126, 0x62128, 0x6213e, 0x6213f, 0x62145, 0x62183, 0x62c60, 0x62c67, 0x62c69, + 0x62c6b, 0x62c72, 0x62c75, 0x62c82, 0x62c84, 0x62c86, 0x62c88, 0x62c8a, 0x62c8c, + 0x62c8e, 0x62c90, 0x62c92, 0x62c94, 0x62c96, 0x62c98, 0x62c9a, 0x62c9c, 0x62c9e, + 0x62ca0, 0x62ca2, 0x62ca4, 0x62ca6, 0x62ca8, 0x62caa, 0x62cac, 0x62cae, 0x62cb0, + 0x62cb2, 0x62cb4, 0x62cb6, 0x62cb8, 0x62cba, 0x62cbc, 0x62cbe, 0x62cc0, 0x62cc2, + 0x62cc4, 0x62cc6, 0x62cc8, 0x62cca, 0x62ccc, 0x62cce, 0x62cd0, 0x62cd2, 0x62cd4, + 0x62cd6, 0x62cd8, 0x62cda, 0x62cdc, 0x62cde, 0x62ce0, 0x62ce2, 0x62ceb, 0x62ced, + 0x62cf2, 0x6a640, 0x6a642, 0x6a644, 0x6a646, 0x6a648, 0x6a64a, 0x6a64c, 0x6a64e, + 0x6a650, 0x6a652, 0x6a654, 0x6a656, 0x6a658, 0x6a65a, 0x6a65c, 0x6a65e, 0x6a660, + 0x6a662, 0x6a664, 0x6a666, 0x6a668, 0x6a66a, 0x6a66c, 0x6a680, 0x6a682, 0x6a684, + 0x6a686, 0x6a688, 0x6a68a, 0x6a68c, 0x6a68e, 0x6a690, 0x6a692, 0x6a694, 0x6a696, + 0x6a698, 0x6a69a, 0x6a722, 0x6a724, 0x6a726, 0x6a728, 0x6a72a, 0x6a72c, 0x6a72e, + 0x6a732, 0x6a734, 0x6a736, 0x6a738, 0x6a73a, 0x6a73c, 0x6a73e, 0x6a740, 0x6a742, + 0x6a744, 0x6a746, 0x6a748, 0x6a74a, 0x6a74c, 0x6a74e, 0x6a750, 0x6a752, 0x6a754, + 0x6a756, 0x6a758, 0x6a75a, 0x6a75c, 0x6a75e, 0x6a760, 0x6a762, 0x6a764, 0x6a766, + 0x6a768, 0x6a76a, 0x6a76c, 0x6a76e, 0x6a779, 0x6a77b, 0x6a77d, 0x6a77e, 0x6a780, + 0x6a782, 0x6a784, 0x6a786, 0x6a78b, 0x6a78d, 0x6a790, 0x6a792, 0x6a796, 0x6a798, + 0x6a79a, 0x6a79c, 0x6a79e, 0x6a7a0, 0x6a7a2, 0x6a7a4, 0x6a7a6, 0x6a7a8, 0x6a7b6, + 0x70100, 0x70102, 0x70104, 0x70106, 0x70108, 0x7010a, 0x7010c, 0x7010e, 0x70110, + 0x70112, 0x70114, 0x70116, 0x70118, 0x7011a, 0x7011c, 0x7011e, 0x70120, 0x70122, + 0x70124, 0x70126, 0x70128, 0x7012a, 0x7012c, 0x7012e, 0x70130, 0x70132, 0x70134, + 0x70136, 0x70139, 0x7013b, 0x7013d, 0x7013f, 0x70141, 0x70143, 0x70145, 0x70147, + 0x7014a, 0x7014c, 0x7014e, 0x70150, 0x70152, 0x70154, 0x70156, 0x70158, 0x7015a, + 0x7015c, 0x7015e, 0x70160, 0x70162, 0x70164, 0x70166, 0x70168, 0x7016a, 0x7016c, + 0x7016e, 0x70170, 0x70172, 0x70174, 0x70176, 0x70178, 0x70179, 0x7017b, 0x7017d, + 0x70181, 0x70182, 0x70184, 0x70186, 0x70187, 0x70193, 0x70194, 0x7019c, 0x7019d, + 0x7019f, 0x701a0, 0x701a2, 0x701a4, 0x701a6, 0x701a7, 0x701a9, 0x701ac, 0x701ae, + 0x701af, 0x701b5, 0x701b7, 0x701b8, 0x701bc, 0x701c4, 0x701c7, 0x701ca, 0x701cd, + 0x701cf, 0x701d1, 0x701d3, 0x701d5, 0x701d7, 0x701d9, 0x701db, 0x701de, 0x701e0, + 0x701e2, 0x701e4, 0x701e6, 0x701e8, 0x701ea, 0x701ec, 0x701ee, 0x701f1, 0x701f4, + 0x701fa, 0x701fc, 0x701fe, 0x70200, 0x70202, 0x70204, 0x70206, 0x70208, 0x7020a, + 0x7020c, 0x7020e, 0x70210, 0x70212, 0x70214, 0x70216, 0x70218, 0x7021a, 0x7021c, + 0x7021e, 0x70220, 0x70222, 0x70224, 0x70226, 0x70228, 0x7022a, 0x7022c, 0x7022e, + 0x70230, 0x70232, 0x7023a, 0x7023b, 0x7023d, 0x7023e, 0x70241, 0x70248, 0x7024a, + 0x7024c, 0x7024e, 0x70370, 0x70372, 0x70376, 0x7037f, 0x70386, 0x7038c, 0x7038e, + 0x7038f, 0x703cf, 0x703d8, 0x703da, 0x703dc, 0x703de, 0x703e0, 0x703e2, 0x703e4, + 0x703e6, 0x703e8, 0x703ea, 0x703ec, 0x703ee, 0x703f4, 0x703f7, 0x703f9, 0x703fa, + 0x70460, 0x70462, 0x70464, 0x70466, 0x70468, 0x7046a, 0x7046c, 0x7046e, 0x70470, + 0x70472, 0x70474, 0x70476, 0x70478, 0x7047a, 0x7047c, 0x7047e, 0x70480, 0x7048a, + 0x7048c, 0x7048e, 0x70490, 0x70492, 0x70494, 0x70496, 0x70498, 0x7049a, 0x7049c, + 0x7049e, 0x704a0, 0x704a2, 0x704a4, 0x704a6, 0x704a8, 0x704aa, 0x704ac, 0x704ae, + 0x704b0, 0x704b2, 0x704b4, 0x704b6, 0x704b8, 0x704ba, 0x704bc, 0x704be, 0x704c0, + 0x704c1, 0x704c3, 0x704c5, 0x704c7, 0x704c9, 0x704cb, 0x704cd, 0x704d0, 0x704d2, + 0x704d4, 0x704d6, 0x704d8, 0x704da, 0x704dc, 0x704de, 0x704e0, 0x704e2, 0x704e4, + 0x704e6, 0x704e8, 0x704ea, 0x704ec, 0x704ee, 0x704f0, 0x704f2, 0x704f4, 0x704f6, + 0x704f8, 0x704fa, 0x704fc, 0x704fe, 0x70500, 0x70502, 0x70504, 0x70506, 0x70508, + 0x7050a, 0x7050c, 0x7050e, 0x70510, 0x70512, 0x70514, 0x70516, 0x70518, 0x7051a, + 0x7051c, 0x7051e, 0x70520, 0x70522, 0x70524, 0x70526, 0x70528, 0x7052a, 0x7052c, + 0x7052e, 0x710c7, 0x710cd, 0x71e00, 0x71e02, 0x71e04, 0x71e06, 0x71e08, 0x71e0a, + 0x71e0c, 0x71e0e, 0x71e10, 0x71e12, 0x71e14, 0x71e16, 0x71e18, 0x71e1a, 0x71e1c, + 0x71e1e, 0x71e20, 0x71e22, 0x71e24, 0x71e26, 0x71e28, 0x71e2a, 0x71e2c, 0x71e2e, + 0x71e30, 0x71e32, 0x71e34, 0x71e36, 0x71e38, 0x71e3a, 0x71e3c, 0x71e3e, 0x71e40, + 0x71e42, 0x71e44, 0x71e46, 0x71e48, 0x71e4a, 0x71e4c, 0x71e4e, 0x71e50, 0x71e52, + 0x71e54, 0x71e56, 0x71e58, 0x71e5a, 0x71e5c, 0x71e5e, 0x71e60, 0x71e62, 0x71e64, + 0x71e66, 0x71e68, 0x71e6a, 0x71e6c, 0x71e6e, 0x71e70, 0x71e72, 0x71e74, 0x71e76, + 0x71e78, 0x71e7a, 0x71e7c, 0x71e7e, 0x71e80, 0x71e82, 0x71e84, 0x71e86, 0x71e88, + 0x71e8a, 0x71e8c, 0x71e8e, 0x71e90, 0x71e92, 0x71e94, 0x71e9e, 0x71ea0, 0x71ea2, + 0x71ea4, 0x71ea6, 0x71ea8, 0x71eaa, 0x71eac, 0x71eae, 0x71eb0, 0x71eb2, 0x71eb4, + 0x71eb6, 0x71eb8, 0x71eba, 0x71ebc, 0x71ebe, 0x71ec0, 0x71ec2, 0x71ec4, 0x71ec6, + 0x71ec8, 0x71eca, 0x71ecc, 0x71ece, 0x71ed0, 0x71ed2, 0x71ed4, 0x71ed6, 0x71ed8, + 0x71eda, 0x71edc, 0x71ede, 0x71ee0, 0x71ee2, 0x71ee4, 0x71ee6, 0x71ee8, 0x71eea, + 0x71eec, 0x71eee, 0x71ef0, 0x71ef2, 0x71ef4, 0x71ef6, 0x71ef8, 0x71efa, 0x71efc, + 0x71efe, 0x71f59, 0x71f5b, 0x71f5d, 0x71f5f, 0x72102, 0x72107, 0x72115, 0x72124, + 0x72126, 0x72128, 0x7213e, 0x7213f, 0x72145, 0x72183, 0x72c60, 0x72c67, 0x72c69, + 0x72c6b, 0x72c72, 0x72c75, 0x72c82, 0x72c84, 0x72c86, 0x72c88, 0x72c8a, 0x72c8c, + 0x72c8e, 0x72c90, 0x72c92, 0x72c94, 0x72c96, 0x72c98, 0x72c9a, 0x72c9c, 0x72c9e, + 0x72ca0, 0x72ca2, 0x72ca4, 0x72ca6, 0x72ca8, 0x72caa, 0x72cac, 0x72cae, 0x72cb0, + 0x72cb2, 0x72cb4, 0x72cb6, 0x72cb8, 0x72cba, 0x72cbc, 0x72cbe, 0x72cc0, 0x72cc2, + 0x72cc4, 0x72cc6, 0x72cc8, 0x72cca, 0x72ccc, 0x72cce, 0x72cd0, 0x72cd2, 0x72cd4, + 0x72cd6, 0x72cd8, 0x72cda, 0x72cdc, 0x72cde, 0x72ce0, 0x72ce2, 0x72ceb, 0x72ced, + 0x72cf2, 0x7a640, 0x7a642, 0x7a644, 0x7a646, 0x7a648, 0x7a64a, 0x7a64c, 0x7a64e, + 0x7a650, 0x7a652, 0x7a654, 0x7a656, 0x7a658, 0x7a65a, 0x7a65c, 0x7a65e, 0x7a660, + 0x7a662, 0x7a664, 0x7a666, 0x7a668, 0x7a66a, 0x7a66c, 0x7a680, 0x7a682, 0x7a684, + 0x7a686, 0x7a688, 0x7a68a, 0x7a68c, 0x7a68e, 0x7a690, 0x7a692, 0x7a694, 0x7a696, + 0x7a698, 0x7a69a, 0x7a722, 0x7a724, 0x7a726, 0x7a728, 0x7a72a, 0x7a72c, 0x7a72e, + 0x7a732, 0x7a734, 0x7a736, 0x7a738, 0x7a73a, 0x7a73c, 0x7a73e, 0x7a740, 0x7a742, + 0x7a744, 0x7a746, 0x7a748, 0x7a74a, 0x7a74c, 0x7a74e, 0x7a750, 0x7a752, 0x7a754, + 0x7a756, 0x7a758, 0x7a75a, 0x7a75c, 0x7a75e, 0x7a760, 0x7a762, 0x7a764, 0x7a766, + 0x7a768, 0x7a76a, 0x7a76c, 0x7a76e, 0x7a779, 0x7a77b, 0x7a77d, 0x7a77e, 0x7a780, + 0x7a782, 0x7a784, 0x7a786, 0x7a78b, 0x7a78d, 0x7a790, 0x7a792, 0x7a796, 0x7a798, + 0x7a79a, 0x7a79c, 0x7a79e, 0x7a7a0, 0x7a7a2, 0x7a7a4, 0x7a7a6, 0x7a7a8, 0x7a7b6, + 0x80100, 0x80102, 0x80104, 0x80106, 0x80108, 0x8010a, 0x8010c, 0x8010e, 0x80110, + 0x80112, 0x80114, 0x80116, 0x80118, 0x8011a, 0x8011c, 0x8011e, 0x80120, 0x80122, + 0x80124, 0x80126, 0x80128, 0x8012a, 0x8012c, 0x8012e, 0x80130, 0x80132, 0x80134, + 0x80136, 0x80139, 0x8013b, 0x8013d, 0x8013f, 0x80141, 0x80143, 0x80145, 0x80147, + 0x8014a, 0x8014c, 0x8014e, 0x80150, 0x80152, 0x80154, 0x80156, 0x80158, 0x8015a, + 0x8015c, 0x8015e, 0x80160, 0x80162, 0x80164, 0x80166, 0x80168, 0x8016a, 0x8016c, + 0x8016e, 0x80170, 0x80172, 0x80174, 0x80176, 0x80178, 0x80179, 0x8017b, 0x8017d, + 0x80181, 0x80182, 0x80184, 0x80186, 0x80187, 0x80193, 0x80194, 0x8019c, 0x8019d, + 0x8019f, 0x801a0, 0x801a2, 0x801a4, 0x801a6, 0x801a7, 0x801a9, 0x801ac, 0x801ae, + 0x801af, 0x801b5, 0x801b7, 0x801b8, 0x801bc, 0x801c4, 0x801c7, 0x801ca, 0x801cd, + 0x801cf, 0x801d1, 0x801d3, 0x801d5, 0x801d7, 0x801d9, 0x801db, 0x801de, 0x801e0, + 0x801e2, 0x801e4, 0x801e6, 0x801e8, 0x801ea, 0x801ec, 0x801ee, 0x801f1, 0x801f4, + 0x801fa, 0x801fc, 0x801fe, 0x80200, 0x80202, 0x80204, 0x80206, 0x80208, 0x8020a, + 0x8020c, 0x8020e, 0x80210, 0x80212, 0x80214, 0x80216, 0x80218, 0x8021a, 0x8021c, + 0x8021e, 0x80220, 0x80222, 0x80224, 0x80226, 0x80228, 0x8022a, 0x8022c, 0x8022e, + 0x80230, 0x80232, 0x8023a, 0x8023b, 0x8023d, 0x8023e, 0x80241, 0x80248, 0x8024a, + 0x8024c, 0x8024e, 0x80370, 0x80372, 0x80376, 0x8037f, 0x80386, 0x8038c, 0x8038e, + 0x8038f, 0x803cf, 0x803d8, 0x803da, 0x803dc, 0x803de, 0x803e0, 0x803e2, 0x803e4, + 0x803e6, 0x803e8, 0x803ea, 0x803ec, 0x803ee, 0x803f4, 0x803f7, 0x803f9, 0x803fa, + 0x80460, 0x80462, 0x80464, 0x80466, 0x80468, 0x8046a, 0x8046c, 0x8046e, 0x80470, + 0x80472, 0x80474, 0x80476, 0x80478, 0x8047a, 0x8047c, 0x8047e, 0x80480, 0x8048a, + 0x8048c, 0x8048e, 0x80490, 0x80492, 0x80494, 0x80496, 0x80498, 0x8049a, 0x8049c, + 0x8049e, 0x804a0, 0x804a2, 0x804a4, 0x804a6, 0x804a8, 0x804aa, 0x804ac, 0x804ae, + 0x804b0, 0x804b2, 0x804b4, 0x804b6, 0x804b8, 0x804ba, 0x804bc, 0x804be, 0x804c0, + 0x804c1, 0x804c3, 0x804c5, 0x804c7, 0x804c9, 0x804cb, 0x804cd, 0x804d0, 0x804d2, + 0x804d4, 0x804d6, 0x804d8, 0x804da, 0x804dc, 0x804de, 0x804e0, 0x804e2, 0x804e4, + 0x804e6, 0x804e8, 0x804ea, 0x804ec, 0x804ee, 0x804f0, 0x804f2, 0x804f4, 0x804f6, + 0x804f8, 0x804fa, 0x804fc, 0x804fe, 0x80500, 0x80502, 0x80504, 0x80506, 0x80508, + 0x8050a, 0x8050c, 0x8050e, 0x80510, 0x80512, 0x80514, 0x80516, 0x80518, 0x8051a, + 0x8051c, 0x8051e, 0x80520, 0x80522, 0x80524, 0x80526, 0x80528, 0x8052a, 0x8052c, + 0x8052e, 0x810c7, 0x810cd, 0x81e00, 0x81e02, 0x81e04, 0x81e06, 0x81e08, 0x81e0a, + 0x81e0c, 0x81e0e, 0x81e10, 0x81e12, 0x81e14, 0x81e16, 0x81e18, 0x81e1a, 0x81e1c, + 0x81e1e, 0x81e20, 0x81e22, 0x81e24, 0x81e26, 0x81e28, 0x81e2a, 0x81e2c, 0x81e2e, + 0x81e30, 0x81e32, 0x81e34, 0x81e36, 0x81e38, 0x81e3a, 0x81e3c, 0x81e3e, 0x81e40, + 0x81e42, 0x81e44, 0x81e46, 0x81e48, 0x81e4a, 0x81e4c, 0x81e4e, 0x81e50, 0x81e52, + 0x81e54, 0x81e56, 0x81e58, 0x81e5a, 0x81e5c, 0x81e5e, 0x81e60, 0x81e62, 0x81e64, + 0x81e66, 0x81e68, 0x81e6a, 0x81e6c, 0x81e6e, 0x81e70, 0x81e72, 0x81e74, 0x81e76, + 0x81e78, 0x81e7a, 0x81e7c, 0x81e7e, 0x81e80, 0x81e82, 0x81e84, 0x81e86, 0x81e88, + 0x81e8a, 0x81e8c, 0x81e8e, 0x81e90, 0x81e92, 0x81e94, 0x81e9e, 0x81ea0, 0x81ea2, + 0x81ea4, 0x81ea6, 0x81ea8, 0x81eaa, 0x81eac, 0x81eae, 0x81eb0, 0x81eb2, 0x81eb4, + 0x81eb6, 0x81eb8, 0x81eba, 0x81ebc, 0x81ebe, 0x81ec0, 0x81ec2, 0x81ec4, 0x81ec6, + 0x81ec8, 0x81eca, 0x81ecc, 0x81ece, 0x81ed0, 0x81ed2, 0x81ed4, 0x81ed6, 0x81ed8, + 0x81eda, 0x81edc, 0x81ede, 0x81ee0, 0x81ee2, 0x81ee4, 0x81ee6, 0x81ee8, 0x81eea, + 0x81eec, 0x81eee, 0x81ef0, 0x81ef2, 0x81ef4, 0x81ef6, 0x81ef8, 0x81efa, 0x81efc, + 0x81efe, 0x81f59, 0x81f5b, 0x81f5d, 0x81f5f, 0x82102, 0x82107, 0x82115, 0x82124, + 0x82126, 0x82128, 0x8213e, 0x8213f, 0x82145, 0x82183, 0x82c60, 0x82c67, 0x82c69, + 0x82c6b, 0x82c72, 0x82c75, 0x82c82, 0x82c84, 0x82c86, 0x82c88, 0x82c8a, 0x82c8c, + 0x82c8e, 0x82c90, 0x82c92, 0x82c94, 0x82c96, 0x82c98, 0x82c9a, 0x82c9c, 0x82c9e, + 0x82ca0, 0x82ca2, 0x82ca4, 0x82ca6, 0x82ca8, 0x82caa, 0x82cac, 0x82cae, 0x82cb0, + 0x82cb2, 0x82cb4, 0x82cb6, 0x82cb8, 0x82cba, 0x82cbc, 0x82cbe, 0x82cc0, 0x82cc2, + 0x82cc4, 0x82cc6, 0x82cc8, 0x82cca, 0x82ccc, 0x82cce, 0x82cd0, 0x82cd2, 0x82cd4, + 0x82cd6, 0x82cd8, 0x82cda, 0x82cdc, 0x82cde, 0x82ce0, 0x82ce2, 0x82ceb, 0x82ced, + 0x82cf2, 0x8a640, 0x8a642, 0x8a644, 0x8a646, 0x8a648, 0x8a64a, 0x8a64c, 0x8a64e, + 0x8a650, 0x8a652, 0x8a654, 0x8a656, 0x8a658, 0x8a65a, 0x8a65c, 0x8a65e, 0x8a660, + 0x8a662, 0x8a664, 0x8a666, 0x8a668, 0x8a66a, 0x8a66c, 0x8a680, 0x8a682, 0x8a684, + 0x8a686, 0x8a688, 0x8a68a, 0x8a68c, 0x8a68e, 0x8a690, 0x8a692, 0x8a694, 0x8a696, + 0x8a698, 0x8a69a, 0x8a722, 0x8a724, 0x8a726, 0x8a728, 0x8a72a, 0x8a72c, 0x8a72e, + 0x8a732, 0x8a734, 0x8a736, 0x8a738, 0x8a73a, 0x8a73c, 0x8a73e, 0x8a740, 0x8a742, + 0x8a744, 0x8a746, 0x8a748, 0x8a74a, 0x8a74c, 0x8a74e, 0x8a750, 0x8a752, 0x8a754, + 0x8a756, 0x8a758, 0x8a75a, 0x8a75c, 0x8a75e, 0x8a760, 0x8a762, 0x8a764, 0x8a766, + 0x8a768, 0x8a76a, 0x8a76c, 0x8a76e, 0x8a779, 0x8a77b, 0x8a77d, 0x8a77e, 0x8a780, + 0x8a782, 0x8a784, 0x8a786, 0x8a78b, 0x8a78d, 0x8a790, 0x8a792, 0x8a796, 0x8a798, + 0x8a79a, 0x8a79c, 0x8a79e, 0x8a7a0, 0x8a7a2, 0x8a7a4, 0x8a7a6, 0x8a7a8, 0x8a7b6, + 0x90100, 0x90102, 0x90104, 0x90106, 0x90108, 0x9010a, 0x9010c, 0x9010e, 0x90110, + 0x90112, 0x90114, 0x90116, 0x90118, 0x9011a, 0x9011c, 0x9011e, 0x90120, 0x90122, + 0x90124, 0x90126, 0x90128, 0x9012a, 0x9012c, 0x9012e, 0x90130, 0x90132, 0x90134, + 0x90136, 0x90139, 0x9013b, 0x9013d, 0x9013f, 0x90141, 0x90143, 0x90145, 0x90147, + 0x9014a, 0x9014c, 0x9014e, 0x90150, 0x90152, 0x90154, 0x90156, 0x90158, 0x9015a, + 0x9015c, 0x9015e, 0x90160, 0x90162, 0x90164, 0x90166, 0x90168, 0x9016a, 0x9016c, + 0x9016e, 0x90170, 0x90172, 0x90174, 0x90176, 0x90178, 0x90179, 0x9017b, 0x9017d, + 0x90181, 0x90182, 0x90184, 0x90186, 0x90187, 0x90193, 0x90194, 0x9019c, 0x9019d, + 0x9019f, 0x901a0, 0x901a2, 0x901a4, 0x901a6, 0x901a7, 0x901a9, 0x901ac, 0x901ae, + 0x901af, 0x901b5, 0x901b7, 0x901b8, 0x901bc, 0x901c4, 0x901c7, 0x901ca, 0x901cd, + 0x901cf, 0x901d1, 0x901d3, 0x901d5, 0x901d7, 0x901d9, 0x901db, 0x901de, 0x901e0, + 0x901e2, 0x901e4, 0x901e6, 0x901e8, 0x901ea, 0x901ec, 0x901ee, 0x901f1, 0x901f4, + 0x901fa, 0x901fc, 0x901fe, 0x90200, 0x90202, 0x90204, 0x90206, 0x90208, 0x9020a, + 0x9020c, 0x9020e, 0x90210, 0x90212, 0x90214, 0x90216, 0x90218, 0x9021a, 0x9021c, + 0x9021e, 0x90220, 0x90222, 0x90224, 0x90226, 0x90228, 0x9022a, 0x9022c, 0x9022e, + 0x90230, 0x90232, 0x9023a, 0x9023b, 0x9023d, 0x9023e, 0x90241, 0x90248, 0x9024a, + 0x9024c, 0x9024e, 0x90370, 0x90372, 0x90376, 0x9037f, 0x90386, 0x9038c, 0x9038e, + 0x9038f, 0x903cf, 0x903d8, 0x903da, 0x903dc, 0x903de, 0x903e0, 0x903e2, 0x903e4, + 0x903e6, 0x903e8, 0x903ea, 0x903ec, 0x903ee, 0x903f4, 0x903f7, 0x903f9, 0x903fa, + 0x90460, 0x90462, 0x90464, 0x90466, 0x90468, 0x9046a, 0x9046c, 0x9046e, 0x90470, + 0x90472, 0x90474, 0x90476, 0x90478, 0x9047a, 0x9047c, 0x9047e, 0x90480, 0x9048a, + 0x9048c, 0x9048e, 0x90490, 0x90492, 0x90494, 0x90496, 0x90498, 0x9049a, 0x9049c, + 0x9049e, 0x904a0, 0x904a2, 0x904a4, 0x904a6, 0x904a8, 0x904aa, 0x904ac, 0x904ae, + 0x904b0, 0x904b2, 0x904b4, 0x904b6, 0x904b8, 0x904ba, 0x904bc, 0x904be, 0x904c0, + 0x904c1, 0x904c3, 0x904c5, 0x904c7, 0x904c9, 0x904cb, 0x904cd, 0x904d0, 0x904d2, + 0x904d4, 0x904d6, 0x904d8, 0x904da, 0x904dc, 0x904de, 0x904e0, 0x904e2, 0x904e4, + 0x904e6, 0x904e8, 0x904ea, 0x904ec, 0x904ee, 0x904f0, 0x904f2, 0x904f4, 0x904f6, + 0x904f8, 0x904fa, 0x904fc, 0x904fe, 0x90500, 0x90502, 0x90504, 0x90506, 0x90508, + 0x9050a, 0x9050c, 0x9050e, 0x90510, 0x90512, 0x90514, 0x90516, 0x90518, 0x9051a, + 0x9051c, 0x9051e, 0x90520, 0x90522, 0x90524, 0x90526, 0x90528, 0x9052a, 0x9052c, + 0x9052e, 0x910c7, 0x910cd, 0x91e00, 0x91e02, 0x91e04, 0x91e06, 0x91e08, 0x91e0a, + 0x91e0c, 0x91e0e, 0x91e10, 0x91e12, 0x91e14, 0x91e16, 0x91e18, 0x91e1a, 0x91e1c, + 0x91e1e, 0x91e20, 0x91e22, 0x91e24, 0x91e26, 0x91e28, 0x91e2a, 0x91e2c, 0x91e2e, + 0x91e30, 0x91e32, 0x91e34, 0x91e36, 0x91e38, 0x91e3a, 0x91e3c, 0x91e3e, 0x91e40, + 0x91e42, 0x91e44, 0x91e46, 0x91e48, 0x91e4a, 0x91e4c, 0x91e4e, 0x91e50, 0x91e52, + 0x91e54, 0x91e56, 0x91e58, 0x91e5a, 0x91e5c, 0x91e5e, 0x91e60, 0x91e62, 0x91e64, + 0x91e66, 0x91e68, 0x91e6a, 0x91e6c, 0x91e6e, 0x91e70, 0x91e72, 0x91e74, 0x91e76, + 0x91e78, 0x91e7a, 0x91e7c, 0x91e7e, 0x91e80, 0x91e82, 0x91e84, 0x91e86, 0x91e88, + 0x91e8a, 0x91e8c, 0x91e8e, 0x91e90, 0x91e92, 0x91e94, 0x91e9e, 0x91ea0, 0x91ea2, + 0x91ea4, 0x91ea6, 0x91ea8, 0x91eaa, 0x91eac, 0x91eae, 0x91eb0, 0x91eb2, 0x91eb4, + 0x91eb6, 0x91eb8, 0x91eba, 0x91ebc, 0x91ebe, 0x91ec0, 0x91ec2, 0x91ec4, 0x91ec6, + 0x91ec8, 0x91eca, 0x91ecc, 0x91ece, 0x91ed0, 0x91ed2, 0x91ed4, 0x91ed6, 0x91ed8, + 0x91eda, 0x91edc, 0x91ede, 0x91ee0, 0x91ee2, 0x91ee4, 0x91ee6, 0x91ee8, 0x91eea, + 0x91eec, 0x91eee, 0x91ef0, 0x91ef2, 0x91ef4, 0x91ef6, 0x91ef8, 0x91efa, 0x91efc, + 0x91efe, 0x91f59, 0x91f5b, 0x91f5d, 0x91f5f, 0x92102, 0x92107, 0x92115, 0x92124, + 0x92126, 0x92128, 0x9213e, 0x9213f, 0x92145, 0x92183, 0x92c60, 0x92c67, 0x92c69, + 0x92c6b, 0x92c72, 0x92c75, 0x92c82, 0x92c84, 0x92c86, 0x92c88, 0x92c8a, 0x92c8c, + 0x92c8e, 0x92c90, 0x92c92, 0x92c94, 0x92c96, 0x92c98, 0x92c9a, 0x92c9c, 0x92c9e, + 0x92ca0, 0x92ca2, 0x92ca4, 0x92ca6, 0x92ca8, 0x92caa, 0x92cac, 0x92cae, 0x92cb0, + 0x92cb2, 0x92cb4, 0x92cb6, 0x92cb8, 0x92cba, 0x92cbc, 0x92cbe, 0x92cc0, 0x92cc2, + 0x92cc4, 0x92cc6, 0x92cc8, 0x92cca, 0x92ccc, 0x92cce, 0x92cd0, 0x92cd2, 0x92cd4, + 0x92cd6, 0x92cd8, 0x92cda, 0x92cdc, 0x92cde, 0x92ce0, 0x92ce2, 0x92ceb, 0x92ced, + 0x92cf2, 0x9a640, 0x9a642, 0x9a644, 0x9a646, 0x9a648, 0x9a64a, 0x9a64c, 0x9a64e, + 0x9a650, 0x9a652, 0x9a654, 0x9a656, 0x9a658, 0x9a65a, 0x9a65c, 0x9a65e, 0x9a660, + 0x9a662, 0x9a664, 0x9a666, 0x9a668, 0x9a66a, 0x9a66c, 0x9a680, 0x9a682, 0x9a684, + 0x9a686, 0x9a688, 0x9a68a, 0x9a68c, 0x9a68e, 0x9a690, 0x9a692, 0x9a694, 0x9a696, + 0x9a698, 0x9a69a, 0x9a722, 0x9a724, 0x9a726, 0x9a728, 0x9a72a, 0x9a72c, 0x9a72e, + 0x9a732, 0x9a734, 0x9a736, 0x9a738, 0x9a73a, 0x9a73c, 0x9a73e, 0x9a740, 0x9a742, + 0x9a744, 0x9a746, 0x9a748, 0x9a74a, 0x9a74c, 0x9a74e, 0x9a750, 0x9a752, 0x9a754, + 0x9a756, 0x9a758, 0x9a75a, 0x9a75c, 0x9a75e, 0x9a760, 0x9a762, 0x9a764, 0x9a766, + 0x9a768, 0x9a76a, 0x9a76c, 0x9a76e, 0x9a779, 0x9a77b, 0x9a77d, 0x9a77e, 0x9a780, + 0x9a782, 0x9a784, 0x9a786, 0x9a78b, 0x9a78d, 0x9a790, 0x9a792, 0x9a796, 0x9a798, + 0x9a79a, 0x9a79c, 0x9a79e, 0x9a7a0, 0x9a7a2, 0x9a7a4, 0x9a7a6, 0x9a7a8, 0x9a7b6, + 0xa0100, 0xa0102, 0xa0104, 0xa0106, 0xa0108, 0xa010a, 0xa010c, 0xa010e, 0xa0110, + 0xa0112, 0xa0114, 0xa0116, 0xa0118, 0xa011a, 0xa011c, 0xa011e, 0xa0120, 0xa0122, + 0xa0124, 0xa0126, 0xa0128, 0xa012a, 0xa012c, 0xa012e, 0xa0130, 0xa0132, 0xa0134, + 0xa0136, 0xa0139, 0xa013b, 0xa013d, 0xa013f, 0xa0141, 0xa0143, 0xa0145, 0xa0147, + 0xa014a, 0xa014c, 0xa014e, 0xa0150, 0xa0152, 0xa0154, 0xa0156, 0xa0158, 0xa015a, + 0xa015c, 0xa015e, 0xa0160, 0xa0162, 0xa0164, 0xa0166, 0xa0168, 0xa016a, 0xa016c, + 0xa016e, 0xa0170, 0xa0172, 0xa0174, 0xa0176, 0xa0178, 0xa0179, 0xa017b, 0xa017d, + 0xa0181, 0xa0182, 0xa0184, 0xa0186, 0xa0187, 0xa0193, 0xa0194, 0xa019c, 0xa019d, + 0xa019f, 0xa01a0, 0xa01a2, 0xa01a4, 0xa01a6, 0xa01a7, 0xa01a9, 0xa01ac, 0xa01ae, + 0xa01af, 0xa01b5, 0xa01b7, 0xa01b8, 0xa01bc, 0xa01c4, 0xa01c7, 0xa01ca, 0xa01cd, + 0xa01cf, 0xa01d1, 0xa01d3, 0xa01d5, 0xa01d7, 0xa01d9, 0xa01db, 0xa01de, 0xa01e0, + 0xa01e2, 0xa01e4, 0xa01e6, 0xa01e8, 0xa01ea, 0xa01ec, 0xa01ee, 0xa01f1, 0xa01f4, + 0xa01fa, 0xa01fc, 0xa01fe, 0xa0200, 0xa0202, 0xa0204, 0xa0206, 0xa0208, 0xa020a, + 0xa020c, 0xa020e, 0xa0210, 0xa0212, 0xa0214, 0xa0216, 0xa0218, 0xa021a, 0xa021c, + 0xa021e, 0xa0220, 0xa0222, 0xa0224, 0xa0226, 0xa0228, 0xa022a, 0xa022c, 0xa022e, + 0xa0230, 0xa0232, 0xa023a, 0xa023b, 0xa023d, 0xa023e, 0xa0241, 0xa0248, 0xa024a, + 0xa024c, 0xa024e, 0xa0370, 0xa0372, 0xa0376, 0xa037f, 0xa0386, 0xa038c, 0xa038e, + 0xa038f, 0xa03cf, 0xa03d8, 0xa03da, 0xa03dc, 0xa03de, 0xa03e0, 0xa03e2, 0xa03e4, + 0xa03e6, 0xa03e8, 0xa03ea, 0xa03ec, 0xa03ee, 0xa03f4, 0xa03f7, 0xa03f9, 0xa03fa, + 0xa0460, 0xa0462, 0xa0464, 0xa0466, 0xa0468, 0xa046a, 0xa046c, 0xa046e, 0xa0470, + 0xa0472, 0xa0474, 0xa0476, 0xa0478, 0xa047a, 0xa047c, 0xa047e, 0xa0480, 0xa048a, + 0xa048c, 0xa048e, 0xa0490, 0xa0492, 0xa0494, 0xa0496, 0xa0498, 0xa049a, 0xa049c, + 0xa049e, 0xa04a0, 0xa04a2, 0xa04a4, 0xa04a6, 0xa04a8, 0xa04aa, 0xa04ac, 0xa04ae, + 0xa04b0, 0xa04b2, 0xa04b4, 0xa04b6, 0xa04b8, 0xa04ba, 0xa04bc, 0xa04be, 0xa04c0, + 0xa04c1, 0xa04c3, 0xa04c5, 0xa04c7, 0xa04c9, 0xa04cb, 0xa04cd, 0xa04d0, 0xa04d2, + 0xa04d4, 0xa04d6, 0xa04d8, 0xa04da, 0xa04dc, 0xa04de, 0xa04e0, 0xa04e2, 0xa04e4, + 0xa04e6, 0xa04e8, 0xa04ea, 0xa04ec, 0xa04ee, 0xa04f0, 0xa04f2, 0xa04f4, 0xa04f6, + 0xa04f8, 0xa04fa, 0xa04fc, 0xa04fe, 0xa0500, 0xa0502, 0xa0504, 0xa0506, 0xa0508, + 0xa050a, 0xa050c, 0xa050e, 0xa0510, 0xa0512, 0xa0514, 0xa0516, 0xa0518, 0xa051a, + 0xa051c, 0xa051e, 0xa0520, 0xa0522, 0xa0524, 0xa0526, 0xa0528, 0xa052a, 0xa052c, + 0xa052e, 0xa10c7, 0xa10cd, 0xa1e00, 0xa1e02, 0xa1e04, 0xa1e06, 0xa1e08, 0xa1e0a, + 0xa1e0c, 0xa1e0e, 0xa1e10, 0xa1e12, 0xa1e14, 0xa1e16, 0xa1e18, 0xa1e1a, 0xa1e1c, + 0xa1e1e, 0xa1e20, 0xa1e22, 0xa1e24, 0xa1e26, 0xa1e28, 0xa1e2a, 0xa1e2c, 0xa1e2e, + 0xa1e30, 0xa1e32, 0xa1e34, 0xa1e36, 0xa1e38, 0xa1e3a, 0xa1e3c, 0xa1e3e, 0xa1e40, + 0xa1e42, 0xa1e44, 0xa1e46, 0xa1e48, 0xa1e4a, 0xa1e4c, 0xa1e4e, 0xa1e50, 0xa1e52, + 0xa1e54, 0xa1e56, 0xa1e58, 0xa1e5a, 0xa1e5c, 0xa1e5e, 0xa1e60, 0xa1e62, 0xa1e64, + 0xa1e66, 0xa1e68, 0xa1e6a, 0xa1e6c, 0xa1e6e, 0xa1e70, 0xa1e72, 0xa1e74, 0xa1e76, + 0xa1e78, 0xa1e7a, 0xa1e7c, 0xa1e7e, 0xa1e80, 0xa1e82, 0xa1e84, 0xa1e86, 0xa1e88, + 0xa1e8a, 0xa1e8c, 0xa1e8e, 0xa1e90, 0xa1e92, 0xa1e94, 0xa1e9e, 0xa1ea0, 0xa1ea2, + 0xa1ea4, 0xa1ea6, 0xa1ea8, 0xa1eaa, 0xa1eac, 0xa1eae, 0xa1eb0, 0xa1eb2, 0xa1eb4, + 0xa1eb6, 0xa1eb8, 0xa1eba, 0xa1ebc, 0xa1ebe, 0xa1ec0, 0xa1ec2, 0xa1ec4, 0xa1ec6, + 0xa1ec8, 0xa1eca, 0xa1ecc, 0xa1ece, 0xa1ed0, 0xa1ed2, 0xa1ed4, 0xa1ed6, 0xa1ed8, + 0xa1eda, 0xa1edc, 0xa1ede, 0xa1ee0, 0xa1ee2, 0xa1ee4, 0xa1ee6, 0xa1ee8, 0xa1eea, + 0xa1eec, 0xa1eee, 0xa1ef0, 0xa1ef2, 0xa1ef4, 0xa1ef6, 0xa1ef8, 0xa1efa, 0xa1efc, + 0xa1efe, 0xa1f59, 0xa1f5b, 0xa1f5d, 0xa1f5f, 0xa2102, 0xa2107, 0xa2115, 0xa2124, + 0xa2126, 0xa2128, 0xa213e, 0xa213f, 0xa2145, 0xa2183, 0xa2c60, 0xa2c67, 0xa2c69, + 0xa2c6b, 0xa2c72, 0xa2c75, 0xa2c82, 0xa2c84, 0xa2c86, 0xa2c88, 0xa2c8a, 0xa2c8c, + 0xa2c8e, 0xa2c90, 0xa2c92, 0xa2c94, 0xa2c96, 0xa2c98, 0xa2c9a, 0xa2c9c, 0xa2c9e, + 0xa2ca0, 0xa2ca2, 0xa2ca4, 0xa2ca6, 0xa2ca8, 0xa2caa, 0xa2cac, 0xa2cae, 0xa2cb0, + 0xa2cb2, 0xa2cb4, 0xa2cb6, 0xa2cb8, 0xa2cba, 0xa2cbc, 0xa2cbe, 0xa2cc0, 0xa2cc2, + 0xa2cc4, 0xa2cc6, 0xa2cc8, 0xa2cca, 0xa2ccc, 0xa2cce, 0xa2cd0, 0xa2cd2, 0xa2cd4, + 0xa2cd6, 0xa2cd8, 0xa2cda, 0xa2cdc, 0xa2cde, 0xa2ce0, 0xa2ce2, 0xa2ceb, 0xa2ced, + 0xa2cf2, 0xaa640, 0xaa642, 0xaa644, 0xaa646, 0xaa648, 0xaa64a, 0xaa64c, 0xaa64e, + 0xaa650, 0xaa652, 0xaa654, 0xaa656, 0xaa658, 0xaa65a, 0xaa65c, 0xaa65e, 0xaa660, + 0xaa662, 0xaa664, 0xaa666, 0xaa668, 0xaa66a, 0xaa66c, 0xaa680, 0xaa682, 0xaa684, + 0xaa686, 0xaa688, 0xaa68a, 0xaa68c, 0xaa68e, 0xaa690, 0xaa692, 0xaa694, 0xaa696, + 0xaa698, 0xaa69a, 0xaa722, 0xaa724, 0xaa726, 0xaa728, 0xaa72a, 0xaa72c, 0xaa72e, + 0xaa732, 0xaa734, 0xaa736, 0xaa738, 0xaa73a, 0xaa73c, 0xaa73e, 0xaa740, 0xaa742, + 0xaa744, 0xaa746, 0xaa748, 0xaa74a, 0xaa74c, 0xaa74e, 0xaa750, 0xaa752, 0xaa754, + 0xaa756, 0xaa758, 0xaa75a, 0xaa75c, 0xaa75e, 0xaa760, 0xaa762, 0xaa764, 0xaa766, + 0xaa768, 0xaa76a, 0xaa76c, 0xaa76e, 0xaa779, 0xaa77b, 0xaa77d, 0xaa77e, 0xaa780, + 0xaa782, 0xaa784, 0xaa786, 0xaa78b, 0xaa78d, 0xaa790, 0xaa792, 0xaa796, 0xaa798, + 0xaa79a, 0xaa79c, 0xaa79e, 0xaa7a0, 0xaa7a2, 0xaa7a4, 0xaa7a6, 0xaa7a8, 0xaa7b6, + 0xb0100, 0xb0102, 0xb0104, 0xb0106, 0xb0108, 0xb010a, 0xb010c, 0xb010e, 0xb0110, + 0xb0112, 0xb0114, 0xb0116, 0xb0118, 0xb011a, 0xb011c, 0xb011e, 0xb0120, 0xb0122, + 0xb0124, 0xb0126, 0xb0128, 0xb012a, 0xb012c, 0xb012e, 0xb0130, 0xb0132, 0xb0134, + 0xb0136, 0xb0139, 0xb013b, 0xb013d, 0xb013f, 0xb0141, 0xb0143, 0xb0145, 0xb0147, + 0xb014a, 0xb014c, 0xb014e, 0xb0150, 0xb0152, 0xb0154, 0xb0156, 0xb0158, 0xb015a, + 0xb015c, 0xb015e, 0xb0160, 0xb0162, 0xb0164, 0xb0166, 0xb0168, 0xb016a, 0xb016c, + 0xb016e, 0xb0170, 0xb0172, 0xb0174, 0xb0176, 0xb0178, 0xb0179, 0xb017b, 0xb017d, + 0xb0181, 0xb0182, 0xb0184, 0xb0186, 0xb0187, 0xb0193, 0xb0194, 0xb019c, 0xb019d, + 0xb019f, 0xb01a0, 0xb01a2, 0xb01a4, 0xb01a6, 0xb01a7, 0xb01a9, 0xb01ac, 0xb01ae, + 0xb01af, 0xb01b5, 0xb01b7, 0xb01b8, 0xb01bc, 0xb01c4, 0xb01c7, 0xb01ca, 0xb01cd, + 0xb01cf, 0xb01d1, 0xb01d3, 0xb01d5, 0xb01d7, 0xb01d9, 0xb01db, 0xb01de, 0xb01e0, + 0xb01e2, 0xb01e4, 0xb01e6, 0xb01e8, 0xb01ea, 0xb01ec, 0xb01ee, 0xb01f1, 0xb01f4, + 0xb01fa, 0xb01fc, 0xb01fe, 0xb0200, 0xb0202, 0xb0204, 0xb0206, 0xb0208, 0xb020a, + 0xb020c, 0xb020e, 0xb0210, 0xb0212, 0xb0214, 0xb0216, 0xb0218, 0xb021a, 0xb021c, + 0xb021e, 0xb0220, 0xb0222, 0xb0224, 0xb0226, 0xb0228, 0xb022a, 0xb022c, 0xb022e, + 0xb0230, 0xb0232, 0xb023a, 0xb023b, 0xb023d, 0xb023e, 0xb0241, 0xb0248, 0xb024a, + 0xb024c, 0xb024e, 0xb0370, 0xb0372, 0xb0376, 0xb037f, 0xb0386, 0xb038c, 0xb038e, + 0xb038f, 0xb03cf, 0xb03d8, 0xb03da, 0xb03dc, 0xb03de, 0xb03e0, 0xb03e2, 0xb03e4, + 0xb03e6, 0xb03e8, 0xb03ea, 0xb03ec, 0xb03ee, 0xb03f4, 0xb03f7, 0xb03f9, 0xb03fa, + 0xb0460, 0xb0462, 0xb0464, 0xb0466, 0xb0468, 0xb046a, 0xb046c, 0xb046e, 0xb0470, + 0xb0472, 0xb0474, 0xb0476, 0xb0478, 0xb047a, 0xb047c, 0xb047e, 0xb0480, 0xb048a, + 0xb048c, 0xb048e, 0xb0490, 0xb0492, 0xb0494, 0xb0496, 0xb0498, 0xb049a, 0xb049c, + 0xb049e, 0xb04a0, 0xb04a2, 0xb04a4, 0xb04a6, 0xb04a8, 0xb04aa, 0xb04ac, 0xb04ae, + 0xb04b0, 0xb04b2, 0xb04b4, 0xb04b6, 0xb04b8, 0xb04ba, 0xb04bc, 0xb04be, 0xb04c0, + 0xb04c1, 0xb04c3, 0xb04c5, 0xb04c7, 0xb04c9, 0xb04cb, 0xb04cd, 0xb04d0, 0xb04d2, + 0xb04d4, 0xb04d6, 0xb04d8, 0xb04da, 0xb04dc, 0xb04de, 0xb04e0, 0xb04e2, 0xb04e4, + 0xb04e6, 0xb04e8, 0xb04ea, 0xb04ec, 0xb04ee, 0xb04f0, 0xb04f2, 0xb04f4, 0xb04f6, + 0xb04f8, 0xb04fa, 0xb04fc, 0xb04fe, 0xb0500, 0xb0502, 0xb0504, 0xb0506, 0xb0508, + 0xb050a, 0xb050c, 0xb050e, 0xb0510, 0xb0512, 0xb0514, 0xb0516, 0xb0518, 0xb051a, + 0xb051c, 0xb051e, 0xb0520, 0xb0522, 0xb0524, 0xb0526, 0xb0528, 0xb052a, 0xb052c, + 0xb052e, 0xb10c7, 0xb10cd, 0xb1e00, 0xb1e02, 0xb1e04, 0xb1e06, 0xb1e08, 0xb1e0a, + 0xb1e0c, 0xb1e0e, 0xb1e10, 0xb1e12, 0xb1e14, 0xb1e16, 0xb1e18, 0xb1e1a, 0xb1e1c, + 0xb1e1e, 0xb1e20, 0xb1e22, 0xb1e24, 0xb1e26, 0xb1e28, 0xb1e2a, 0xb1e2c, 0xb1e2e, + 0xb1e30, 0xb1e32, 0xb1e34, 0xb1e36, 0xb1e38, 0xb1e3a, 0xb1e3c, 0xb1e3e, 0xb1e40, + 0xb1e42, 0xb1e44, 0xb1e46, 0xb1e48, 0xb1e4a, 0xb1e4c, 0xb1e4e, 0xb1e50, 0xb1e52, + 0xb1e54, 0xb1e56, 0xb1e58, 0xb1e5a, 0xb1e5c, 0xb1e5e, 0xb1e60, 0xb1e62, 0xb1e64, + 0xb1e66, 0xb1e68, 0xb1e6a, 0xb1e6c, 0xb1e6e, 0xb1e70, 0xb1e72, 0xb1e74, 0xb1e76, + 0xb1e78, 0xb1e7a, 0xb1e7c, 0xb1e7e, 0xb1e80, 0xb1e82, 0xb1e84, 0xb1e86, 0xb1e88, + 0xb1e8a, 0xb1e8c, 0xb1e8e, 0xb1e90, 0xb1e92, 0xb1e94, 0xb1e9e, 0xb1ea0, 0xb1ea2, + 0xb1ea4, 0xb1ea6, 0xb1ea8, 0xb1eaa, 0xb1eac, 0xb1eae, 0xb1eb0, 0xb1eb2, 0xb1eb4, + 0xb1eb6, 0xb1eb8, 0xb1eba, 0xb1ebc, 0xb1ebe, 0xb1ec0, 0xb1ec2, 0xb1ec4, 0xb1ec6, + 0xb1ec8, 0xb1eca, 0xb1ecc, 0xb1ece, 0xb1ed0, 0xb1ed2, 0xb1ed4, 0xb1ed6, 0xb1ed8, + 0xb1eda, 0xb1edc, 0xb1ede, 0xb1ee0, 0xb1ee2, 0xb1ee4, 0xb1ee6, 0xb1ee8, 0xb1eea, + 0xb1eec, 0xb1eee, 0xb1ef0, 0xb1ef2, 0xb1ef4, 0xb1ef6, 0xb1ef8, 0xb1efa, 0xb1efc, + 0xb1efe, 0xb1f59, 0xb1f5b, 0xb1f5d, 0xb1f5f, 0xb2102, 0xb2107, 0xb2115, 0xb2124, + 0xb2126, 0xb2128, 0xb213e, 0xb213f, 0xb2145, 0xb2183, 0xb2c60, 0xb2c67, 0xb2c69, + 0xb2c6b, 0xb2c72, 0xb2c75, 0xb2c82, 0xb2c84, 0xb2c86, 0xb2c88, 0xb2c8a, 0xb2c8c, + 0xb2c8e, 0xb2c90, 0xb2c92, 0xb2c94, 0xb2c96, 0xb2c98, 0xb2c9a, 0xb2c9c, 0xb2c9e, + 0xb2ca0, 0xb2ca2, 0xb2ca4, 0xb2ca6, 0xb2ca8, 0xb2caa, 0xb2cac, 0xb2cae, 0xb2cb0, + 0xb2cb2, 0xb2cb4, 0xb2cb6, 0xb2cb8, 0xb2cba, 0xb2cbc, 0xb2cbe, 0xb2cc0, 0xb2cc2, + 0xb2cc4, 0xb2cc6, 0xb2cc8, 0xb2cca, 0xb2ccc, 0xb2cce, 0xb2cd0, 0xb2cd2, 0xb2cd4, + 0xb2cd6, 0xb2cd8, 0xb2cda, 0xb2cdc, 0xb2cde, 0xb2ce0, 0xb2ce2, 0xb2ceb, 0xb2ced, + 0xb2cf2, 0xba640, 0xba642, 0xba644, 0xba646, 0xba648, 0xba64a, 0xba64c, 0xba64e, + 0xba650, 0xba652, 0xba654, 0xba656, 0xba658, 0xba65a, 0xba65c, 0xba65e, 0xba660, + 0xba662, 0xba664, 0xba666, 0xba668, 0xba66a, 0xba66c, 0xba680, 0xba682, 0xba684, + 0xba686, 0xba688, 0xba68a, 0xba68c, 0xba68e, 0xba690, 0xba692, 0xba694, 0xba696, + 0xba698, 0xba69a, 0xba722, 0xba724, 0xba726, 0xba728, 0xba72a, 0xba72c, 0xba72e, + 0xba732, 0xba734, 0xba736, 0xba738, 0xba73a, 0xba73c, 0xba73e, 0xba740, 0xba742, + 0xba744, 0xba746, 0xba748, 0xba74a, 0xba74c, 0xba74e, 0xba750, 0xba752, 0xba754, + 0xba756, 0xba758, 0xba75a, 0xba75c, 0xba75e, 0xba760, 0xba762, 0xba764, 0xba766, + 0xba768, 0xba76a, 0xba76c, 0xba76e, 0xba779, 0xba77b, 0xba77d, 0xba77e, 0xba780, + 0xba782, 0xba784, 0xba786, 0xba78b, 0xba78d, 0xba790, 0xba792, 0xba796, 0xba798, + 0xba79a, 0xba79c, 0xba79e, 0xba7a0, 0xba7a2, 0xba7a4, 0xba7a6, 0xba7a8, 0xba7b6, + 0xc0100, 0xc0102, 0xc0104, 0xc0106, 0xc0108, 0xc010a, 0xc010c, 0xc010e, 0xc0110, + 0xc0112, 0xc0114, 0xc0116, 0xc0118, 0xc011a, 0xc011c, 0xc011e, 0xc0120, 0xc0122, + 0xc0124, 0xc0126, 0xc0128, 0xc012a, 0xc012c, 0xc012e, 0xc0130, 0xc0132, 0xc0134, + 0xc0136, 0xc0139, 0xc013b, 0xc013d, 0xc013f, 0xc0141, 0xc0143, 0xc0145, 0xc0147, + 0xc014a, 0xc014c, 0xc014e, 0xc0150, 0xc0152, 0xc0154, 0xc0156, 0xc0158, 0xc015a, + 0xc015c, 0xc015e, 0xc0160, 0xc0162, 0xc0164, 0xc0166, 0xc0168, 0xc016a, 0xc016c, + 0xc016e, 0xc0170, 0xc0172, 0xc0174, 0xc0176, 0xc0178, 0xc0179, 0xc017b, 0xc017d, + 0xc0181, 0xc0182, 0xc0184, 0xc0186, 0xc0187, 0xc0193, 0xc0194, 0xc019c, 0xc019d, + 0xc019f, 0xc01a0, 0xc01a2, 0xc01a4, 0xc01a6, 0xc01a7, 0xc01a9, 0xc01ac, 0xc01ae, + 0xc01af, 0xc01b5, 0xc01b7, 0xc01b8, 0xc01bc, 0xc01c4, 0xc01c7, 0xc01ca, 0xc01cd, + 0xc01cf, 0xc01d1, 0xc01d3, 0xc01d5, 0xc01d7, 0xc01d9, 0xc01db, 0xc01de, 0xc01e0, + 0xc01e2, 0xc01e4, 0xc01e6, 0xc01e8, 0xc01ea, 0xc01ec, 0xc01ee, 0xc01f1, 0xc01f4, + 0xc01fa, 0xc01fc, 0xc01fe, 0xc0200, 0xc0202, 0xc0204, 0xc0206, 0xc0208, 0xc020a, + 0xc020c, 0xc020e, 0xc0210, 0xc0212, 0xc0214, 0xc0216, 0xc0218, 0xc021a, 0xc021c, + 0xc021e, 0xc0220, 0xc0222, 0xc0224, 0xc0226, 0xc0228, 0xc022a, 0xc022c, 0xc022e, + 0xc0230, 0xc0232, 0xc023a, 0xc023b, 0xc023d, 0xc023e, 0xc0241, 0xc0248, 0xc024a, + 0xc024c, 0xc024e, 0xc0370, 0xc0372, 0xc0376, 0xc037f, 0xc0386, 0xc038c, 0xc038e, + 0xc038f, 0xc03cf, 0xc03d8, 0xc03da, 0xc03dc, 0xc03de, 0xc03e0, 0xc03e2, 0xc03e4, + 0xc03e6, 0xc03e8, 0xc03ea, 0xc03ec, 0xc03ee, 0xc03f4, 0xc03f7, 0xc03f9, 0xc03fa, + 0xc0460, 0xc0462, 0xc0464, 0xc0466, 0xc0468, 0xc046a, 0xc046c, 0xc046e, 0xc0470, + 0xc0472, 0xc0474, 0xc0476, 0xc0478, 0xc047a, 0xc047c, 0xc047e, 0xc0480, 0xc048a, + 0xc048c, 0xc048e, 0xc0490, 0xc0492, 0xc0494, 0xc0496, 0xc0498, 0xc049a, 0xc049c, + 0xc049e, 0xc04a0, 0xc04a2, 0xc04a4, 0xc04a6, 0xc04a8, 0xc04aa, 0xc04ac, 0xc04ae, + 0xc04b0, 0xc04b2, 0xc04b4, 0xc04b6, 0xc04b8, 0xc04ba, 0xc04bc, 0xc04be, 0xc04c0, + 0xc04c1, 0xc04c3, 0xc04c5, 0xc04c7, 0xc04c9, 0xc04cb, 0xc04cd, 0xc04d0, 0xc04d2, + 0xc04d4, 0xc04d6, 0xc04d8, 0xc04da, 0xc04dc, 0xc04de, 0xc04e0, 0xc04e2, 0xc04e4, + 0xc04e6, 0xc04e8, 0xc04ea, 0xc04ec, 0xc04ee, 0xc04f0, 0xc04f2, 0xc04f4, 0xc04f6, + 0xc04f8, 0xc04fa, 0xc04fc, 0xc04fe, 0xc0500, 0xc0502, 0xc0504, 0xc0506, 0xc0508, + 0xc050a, 0xc050c, 0xc050e, 0xc0510, 0xc0512, 0xc0514, 0xc0516, 0xc0518, 0xc051a, + 0xc051c, 0xc051e, 0xc0520, 0xc0522, 0xc0524, 0xc0526, 0xc0528, 0xc052a, 0xc052c, + 0xc052e, 0xc10c7, 0xc10cd, 0xc1e00, 0xc1e02, 0xc1e04, 0xc1e06, 0xc1e08, 0xc1e0a, + 0xc1e0c, 0xc1e0e, 0xc1e10, 0xc1e12, 0xc1e14, 0xc1e16, 0xc1e18, 0xc1e1a, 0xc1e1c, + 0xc1e1e, 0xc1e20, 0xc1e22, 0xc1e24, 0xc1e26, 0xc1e28, 0xc1e2a, 0xc1e2c, 0xc1e2e, + 0xc1e30, 0xc1e32, 0xc1e34, 0xc1e36, 0xc1e38, 0xc1e3a, 0xc1e3c, 0xc1e3e, 0xc1e40, + 0xc1e42, 0xc1e44, 0xc1e46, 0xc1e48, 0xc1e4a, 0xc1e4c, 0xc1e4e, 0xc1e50, 0xc1e52, + 0xc1e54, 0xc1e56, 0xc1e58, 0xc1e5a, 0xc1e5c, 0xc1e5e, 0xc1e60, 0xc1e62, 0xc1e64, + 0xc1e66, 0xc1e68, 0xc1e6a, 0xc1e6c, 0xc1e6e, 0xc1e70, 0xc1e72, 0xc1e74, 0xc1e76, + 0xc1e78, 0xc1e7a, 0xc1e7c, 0xc1e7e, 0xc1e80, 0xc1e82, 0xc1e84, 0xc1e86, 0xc1e88, + 0xc1e8a, 0xc1e8c, 0xc1e8e, 0xc1e90, 0xc1e92, 0xc1e94, 0xc1e9e, 0xc1ea0, 0xc1ea2, + 0xc1ea4, 0xc1ea6, 0xc1ea8, 0xc1eaa, 0xc1eac, 0xc1eae, 0xc1eb0, 0xc1eb2, 0xc1eb4, + 0xc1eb6, 0xc1eb8, 0xc1eba, 0xc1ebc, 0xc1ebe, 0xc1ec0, 0xc1ec2, 0xc1ec4, 0xc1ec6, + 0xc1ec8, 0xc1eca, 0xc1ecc, 0xc1ece, 0xc1ed0, 0xc1ed2, 0xc1ed4, 0xc1ed6, 0xc1ed8, + 0xc1eda, 0xc1edc, 0xc1ede, 0xc1ee0, 0xc1ee2, 0xc1ee4, 0xc1ee6, 0xc1ee8, 0xc1eea, + 0xc1eec, 0xc1eee, 0xc1ef0, 0xc1ef2, 0xc1ef4, 0xc1ef6, 0xc1ef8, 0xc1efa, 0xc1efc, + 0xc1efe, 0xc1f59, 0xc1f5b, 0xc1f5d, 0xc1f5f, 0xc2102, 0xc2107, 0xc2115, 0xc2124, + 0xc2126, 0xc2128, 0xc213e, 0xc213f, 0xc2145, 0xc2183, 0xc2c60, 0xc2c67, 0xc2c69, + 0xc2c6b, 0xc2c72, 0xc2c75, 0xc2c82, 0xc2c84, 0xc2c86, 0xc2c88, 0xc2c8a, 0xc2c8c, + 0xc2c8e, 0xc2c90, 0xc2c92, 0xc2c94, 0xc2c96, 0xc2c98, 0xc2c9a, 0xc2c9c, 0xc2c9e, + 0xc2ca0, 0xc2ca2, 0xc2ca4, 0xc2ca6, 0xc2ca8, 0xc2caa, 0xc2cac, 0xc2cae, 0xc2cb0, + 0xc2cb2, 0xc2cb4, 0xc2cb6, 0xc2cb8, 0xc2cba, 0xc2cbc, 0xc2cbe, 0xc2cc0, 0xc2cc2, + 0xc2cc4, 0xc2cc6, 0xc2cc8, 0xc2cca, 0xc2ccc, 0xc2cce, 0xc2cd0, 0xc2cd2, 0xc2cd4, + 0xc2cd6, 0xc2cd8, 0xc2cda, 0xc2cdc, 0xc2cde, 0xc2ce0, 0xc2ce2, 0xc2ceb, 0xc2ced, + 0xc2cf2, 0xca640, 0xca642, 0xca644, 0xca646, 0xca648, 0xca64a, 0xca64c, 0xca64e, + 0xca650, 0xca652, 0xca654, 0xca656, 0xca658, 0xca65a, 0xca65c, 0xca65e, 0xca660, + 0xca662, 0xca664, 0xca666, 0xca668, 0xca66a, 0xca66c, 0xca680, 0xca682, 0xca684, + 0xca686, 0xca688, 0xca68a, 0xca68c, 0xca68e, 0xca690, 0xca692, 0xca694, 0xca696, + 0xca698, 0xca69a, 0xca722, 0xca724, 0xca726, 0xca728, 0xca72a, 0xca72c, 0xca72e, + 0xca732, 0xca734, 0xca736, 0xca738, 0xca73a, 0xca73c, 0xca73e, 0xca740, 0xca742, + 0xca744, 0xca746, 0xca748, 0xca74a, 0xca74c, 0xca74e, 0xca750, 0xca752, 0xca754, + 0xca756, 0xca758, 0xca75a, 0xca75c, 0xca75e, 0xca760, 0xca762, 0xca764, 0xca766, + 0xca768, 0xca76a, 0xca76c, 0xca76e, 0xca779, 0xca77b, 0xca77d, 0xca77e, 0xca780, + 0xca782, 0xca784, 0xca786, 0xca78b, 0xca78d, 0xca790, 0xca792, 0xca796, 0xca798, + 0xca79a, 0xca79c, 0xca79e, 0xca7a0, 0xca7a2, 0xca7a4, 0xca7a6, 0xca7a8, 0xca7b6, + 0xd0100, 0xd0102, 0xd0104, 0xd0106, 0xd0108, 0xd010a, 0xd010c, 0xd010e, 0xd0110, + 0xd0112, 0xd0114, 0xd0116, 0xd0118, 0xd011a, 0xd011c, 0xd011e, 0xd0120, 0xd0122, + 0xd0124, 0xd0126, 0xd0128, 0xd012a, 0xd012c, 0xd012e, 0xd0130, 0xd0132, 0xd0134, + 0xd0136, 0xd0139, 0xd013b, 0xd013d, 0xd013f, 0xd0141, 0xd0143, 0xd0145, 0xd0147, + 0xd014a, 0xd014c, 0xd014e, 0xd0150, 0xd0152, 0xd0154, 0xd0156, 0xd0158, 0xd015a, + 0xd015c, 0xd015e, 0xd0160, 0xd0162, 0xd0164, 0xd0166, 0xd0168, 0xd016a, 0xd016c, + 0xd016e, 0xd0170, 0xd0172, 0xd0174, 0xd0176, 0xd0178, 0xd0179, 0xd017b, 0xd017d, + 0xd0181, 0xd0182, 0xd0184, 0xd0186, 0xd0187, 0xd0193, 0xd0194, 0xd019c, 0xd019d, + 0xd019f, 0xd01a0, 0xd01a2, 0xd01a4, 0xd01a6, 0xd01a7, 0xd01a9, 0xd01ac, 0xd01ae, + 0xd01af, 0xd01b5, 0xd01b7, 0xd01b8, 0xd01bc, 0xd01c4, 0xd01c7, 0xd01ca, 0xd01cd, + 0xd01cf, 0xd01d1, 0xd01d3, 0xd01d5, 0xd01d7, 0xd01d9, 0xd01db, 0xd01de, 0xd01e0, + 0xd01e2, 0xd01e4, 0xd01e6, 0xd01e8, 0xd01ea, 0xd01ec, 0xd01ee, 0xd01f1, 0xd01f4, + 0xd01fa, 0xd01fc, 0xd01fe, 0xd0200, 0xd0202, 0xd0204, 0xd0206, 0xd0208, 0xd020a, + 0xd020c, 0xd020e, 0xd0210, 0xd0212, 0xd0214, 0xd0216, 0xd0218, 0xd021a, 0xd021c, + 0xd021e, 0xd0220, 0xd0222, 0xd0224, 0xd0226, 0xd0228, 0xd022a, 0xd022c, 0xd022e, + 0xd0230, 0xd0232, 0xd023a, 0xd023b, 0xd023d, 0xd023e, 0xd0241, 0xd0248, 0xd024a, + 0xd024c, 0xd024e, 0xd0370, 0xd0372, 0xd0376, 0xd037f, 0xd0386, 0xd038c, 0xd038e, + 0xd038f, 0xd03cf, 0xd03d8, 0xd03da, 0xd03dc, 0xd03de, 0xd03e0, 0xd03e2, 0xd03e4, + 0xd03e6, 0xd03e8, 0xd03ea, 0xd03ec, 0xd03ee, 0xd03f4, 0xd03f7, 0xd03f9, 0xd03fa, + 0xd0460, 0xd0462, 0xd0464, 0xd0466, 0xd0468, 0xd046a, 0xd046c, 0xd046e, 0xd0470, + 0xd0472, 0xd0474, 0xd0476, 0xd0478, 0xd047a, 0xd047c, 0xd047e, 0xd0480, 0xd048a, + 0xd048c, 0xd048e, 0xd0490, 0xd0492, 0xd0494, 0xd0496, 0xd0498, 0xd049a, 0xd049c, + 0xd049e, 0xd04a0, 0xd04a2, 0xd04a4, 0xd04a6, 0xd04a8, 0xd04aa, 0xd04ac, 0xd04ae, + 0xd04b0, 0xd04b2, 0xd04b4, 0xd04b6, 0xd04b8, 0xd04ba, 0xd04bc, 0xd04be, 0xd04c0, + 0xd04c1, 0xd04c3, 0xd04c5, 0xd04c7, 0xd04c9, 0xd04cb, 0xd04cd, 0xd04d0, 0xd04d2, + 0xd04d4, 0xd04d6, 0xd04d8, 0xd04da, 0xd04dc, 0xd04de, 0xd04e0, 0xd04e2, 0xd04e4, + 0xd04e6, 0xd04e8, 0xd04ea, 0xd04ec, 0xd04ee, 0xd04f0, 0xd04f2, 0xd04f4, 0xd04f6, + 0xd04f8, 0xd04fa, 0xd04fc, 0xd04fe, 0xd0500, 0xd0502, 0xd0504, 0xd0506, 0xd0508, + 0xd050a, 0xd050c, 0xd050e, 0xd0510, 0xd0512, 0xd0514, 0xd0516, 0xd0518, 0xd051a, + 0xd051c, 0xd051e, 0xd0520, 0xd0522, 0xd0524, 0xd0526, 0xd0528, 0xd052a, 0xd052c, + 0xd052e, 0xd10c7, 0xd10cd, 0xd1e00, 0xd1e02, 0xd1e04, 0xd1e06, 0xd1e08, 0xd1e0a, + 0xd1e0c, 0xd1e0e, 0xd1e10, 0xd1e12, 0xd1e14, 0xd1e16, 0xd1e18, 0xd1e1a, 0xd1e1c, + 0xd1e1e, 0xd1e20, 0xd1e22, 0xd1e24, 0xd1e26, 0xd1e28, 0xd1e2a, 0xd1e2c, 0xd1e2e, + 0xd1e30, 0xd1e32, 0xd1e34, 0xd1e36, 0xd1e38, 0xd1e3a, 0xd1e3c, 0xd1e3e, 0xd1e40, + 0xd1e42, 0xd1e44, 0xd1e46, 0xd1e48, 0xd1e4a, 0xd1e4c, 0xd1e4e, 0xd1e50, 0xd1e52, + 0xd1e54, 0xd1e56, 0xd1e58, 0xd1e5a, 0xd1e5c, 0xd1e5e, 0xd1e60, 0xd1e62, 0xd1e64, + 0xd1e66, 0xd1e68, 0xd1e6a, 0xd1e6c, 0xd1e6e, 0xd1e70, 0xd1e72, 0xd1e74, 0xd1e76, + 0xd1e78, 0xd1e7a, 0xd1e7c, 0xd1e7e, 0xd1e80, 0xd1e82, 0xd1e84, 0xd1e86, 0xd1e88, + 0xd1e8a, 0xd1e8c, 0xd1e8e, 0xd1e90, 0xd1e92, 0xd1e94, 0xd1e9e, 0xd1ea0, 0xd1ea2, + 0xd1ea4, 0xd1ea6, 0xd1ea8, 0xd1eaa, 0xd1eac, 0xd1eae, 0xd1eb0, 0xd1eb2, 0xd1eb4, + 0xd1eb6, 0xd1eb8, 0xd1eba, 0xd1ebc, 0xd1ebe, 0xd1ec0, 0xd1ec2, 0xd1ec4, 0xd1ec6, + 0xd1ec8, 0xd1eca, 0xd1ecc, 0xd1ece, 0xd1ed0, 0xd1ed2, 0xd1ed4, 0xd1ed6, 0xd1ed8, + 0xd1eda, 0xd1edc, 0xd1ede, 0xd1ee0, 0xd1ee2, 0xd1ee4, 0xd1ee6, 0xd1ee8, 0xd1eea, + 0xd1eec, 0xd1eee, 0xd1ef0, 0xd1ef2, 0xd1ef4, 0xd1ef6, 0xd1ef8, 0xd1efa, 0xd1efc, + 0xd1efe, 0xd1f59, 0xd1f5b, 0xd1f5d, 0xd1f5f, 0xd2102, 0xd2107, 0xd2115, 0xd2124, + 0xd2126, 0xd2128, 0xd213e, 0xd213f, 0xd2145, 0xd2183, 0xd2c60, 0xd2c67, 0xd2c69, + 0xd2c6b, 0xd2c72, 0xd2c75, 0xd2c82, 0xd2c84, 0xd2c86, 0xd2c88, 0xd2c8a, 0xd2c8c, + 0xd2c8e, 0xd2c90, 0xd2c92, 0xd2c94, 0xd2c96, 0xd2c98, 0xd2c9a, 0xd2c9c, 0xd2c9e, + 0xd2ca0, 0xd2ca2, 0xd2ca4, 0xd2ca6, 0xd2ca8, 0xd2caa, 0xd2cac, 0xd2cae, 0xd2cb0, + 0xd2cb2, 0xd2cb4, 0xd2cb6, 0xd2cb8, 0xd2cba, 0xd2cbc, 0xd2cbe, 0xd2cc0, 0xd2cc2, + 0xd2cc4, 0xd2cc6, 0xd2cc8, 0xd2cca, 0xd2ccc, 0xd2cce, 0xd2cd0, 0xd2cd2, 0xd2cd4, + 0xd2cd6, 0xd2cd8, 0xd2cda, 0xd2cdc, 0xd2cde, 0xd2ce0, 0xd2ce2, 0xd2ceb, 0xd2ced, + 0xd2cf2, 0xda640, 0xda642, 0xda644, 0xda646, 0xda648, 0xda64a, 0xda64c, 0xda64e, + 0xda650, 0xda652, 0xda654, 0xda656, 0xda658, 0xda65a, 0xda65c, 0xda65e, 0xda660, + 0xda662, 0xda664, 0xda666, 0xda668, 0xda66a, 0xda66c, 0xda680, 0xda682, 0xda684, + 0xda686, 0xda688, 0xda68a, 0xda68c, 0xda68e, 0xda690, 0xda692, 0xda694, 0xda696, + 0xda698, 0xda69a, 0xda722, 0xda724, 0xda726, 0xda728, 0xda72a, 0xda72c, 0xda72e, + 0xda732, 0xda734, 0xda736, 0xda738, 0xda73a, 0xda73c, 0xda73e, 0xda740, 0xda742, + 0xda744, 0xda746, 0xda748, 0xda74a, 0xda74c, 0xda74e, 0xda750, 0xda752, 0xda754, + 0xda756, 0xda758, 0xda75a, 0xda75c, 0xda75e, 0xda760, 0xda762, 0xda764, 0xda766, + 0xda768, 0xda76a, 0xda76c, 0xda76e, 0xda779, 0xda77b, 0xda77d, 0xda77e, 0xda780, + 0xda782, 0xda784, 0xda786, 0xda78b, 0xda78d, 0xda790, 0xda792, 0xda796, 0xda798, + 0xda79a, 0xda79c, 0xda79e, 0xda7a0, 0xda7a2, 0xda7a4, 0xda7a6, 0xda7a8, 0xda7b6, + 0xe0100, 0xe0102, 0xe0104, 0xe0106, 0xe0108, 0xe010a, 0xe010c, 0xe010e, 0xe0110, + 0xe0112, 0xe0114, 0xe0116, 0xe0118, 0xe011a, 0xe011c, 0xe011e, 0xe0120, 0xe0122, + 0xe0124, 0xe0126, 0xe0128, 0xe012a, 0xe012c, 0xe012e, 0xe0130, 0xe0132, 0xe0134, + 0xe0136, 0xe0139, 0xe013b, 0xe013d, 0xe013f, 0xe0141, 0xe0143, 0xe0145, 0xe0147, + 0xe014a, 0xe014c, 0xe014e, 0xe0150, 0xe0152, 0xe0154, 0xe0156, 0xe0158, 0xe015a, + 0xe015c, 0xe015e, 0xe0160, 0xe0162, 0xe0164, 0xe0166, 0xe0168, 0xe016a, 0xe016c, + 0xe016e, 0xe0170, 0xe0172, 0xe0174, 0xe0176, 0xe0178, 0xe0179, 0xe017b, 0xe017d, + 0xe0181, 0xe0182, 0xe0184, 0xe0186, 0xe0187, 0xe0193, 0xe0194, 0xe019c, 0xe019d, + 0xe019f, 0xe01a0, 0xe01a2, 0xe01a4, 0xe01a6, 0xe01a7, 0xe01a9, 0xe01ac, 0xe01ae, + 0xe01af, 0xe01b5, 0xe01b7, 0xe01b8, 0xe01bc, 0xe01c4, 0xe01c7, 0xe01ca, 0xe01cd, + 0xe01cf, 0xe01d1, 0xe01d3, 0xe01d5, 0xe01d7, 0xe01d9, 0xe01db, 0xe01de, 0xe01e0, + 0xe01e2, 0xe01e4, 0xe01e6, 0xe01e8, 0xe01ea, 0xe01ec, 0xe01ee, 0xe01f1, 0xe01f4, + 0xe01fa, 0xe01fc, 0xe01fe, 0xe0200, 0xe0202, 0xe0204, 0xe0206, 0xe0208, 0xe020a, + 0xe020c, 0xe020e, 0xe0210, 0xe0212, 0xe0214, 0xe0216, 0xe0218, 0xe021a, 0xe021c, + 0xe021e, 0xe0220, 0xe0222, 0xe0224, 0xe0226, 0xe0228, 0xe022a, 0xe022c, 0xe022e, + 0xe0230, 0xe0232, 0xe023a, 0xe023b, 0xe023d, 0xe023e, 0xe0241, 0xe0248, 0xe024a, + 0xe024c, 0xe024e, 0xe0370, 0xe0372, 0xe0376, 0xe037f, 0xe0386, 0xe038c, 0xe038e, + 0xe038f, 0xe03cf, 0xe03d8, 0xe03da, 0xe03dc, 0xe03de, 0xe03e0, 0xe03e2, 0xe03e4, + 0xe03e6, 0xe03e8, 0xe03ea, 0xe03ec, 0xe03ee, 0xe03f4, 0xe03f7, 0xe03f9, 0xe03fa, + 0xe0460, 0xe0462, 0xe0464, 0xe0466, 0xe0468, 0xe046a, 0xe046c, 0xe046e, 0xe0470, + 0xe0472, 0xe0474, 0xe0476, 0xe0478, 0xe047a, 0xe047c, 0xe047e, 0xe0480, 0xe048a, + 0xe048c, 0xe048e, 0xe0490, 0xe0492, 0xe0494, 0xe0496, 0xe0498, 0xe049a, 0xe049c, + 0xe049e, 0xe04a0, 0xe04a2, 0xe04a4, 0xe04a6, 0xe04a8, 0xe04aa, 0xe04ac, 0xe04ae, + 0xe04b0, 0xe04b2, 0xe04b4, 0xe04b6, 0xe04b8, 0xe04ba, 0xe04bc, 0xe04be, 0xe04c0, + 0xe04c1, 0xe04c3, 0xe04c5, 0xe04c7, 0xe04c9, 0xe04cb, 0xe04cd, 0xe04d0, 0xe04d2, + 0xe04d4, 0xe04d6, 0xe04d8, 0xe04da, 0xe04dc, 0xe04de, 0xe04e0, 0xe04e2, 0xe04e4, + 0xe04e6, 0xe04e8, 0xe04ea, 0xe04ec, 0xe04ee, 0xe04f0, 0xe04f2, 0xe04f4, 0xe04f6, + 0xe04f8, 0xe04fa, 0xe04fc, 0xe04fe, 0xe0500, 0xe0502, 0xe0504, 0xe0506, 0xe0508, + 0xe050a, 0xe050c, 0xe050e, 0xe0510, 0xe0512, 0xe0514, 0xe0516, 0xe0518, 0xe051a, + 0xe051c, 0xe051e, 0xe0520, 0xe0522, 0xe0524, 0xe0526, 0xe0528, 0xe052a, 0xe052c, + 0xe052e, 0xe10c7, 0xe10cd, 0xe1e00, 0xe1e02, 0xe1e04, 0xe1e06, 0xe1e08, 0xe1e0a, + 0xe1e0c, 0xe1e0e, 0xe1e10, 0xe1e12, 0xe1e14, 0xe1e16, 0xe1e18, 0xe1e1a, 0xe1e1c, + 0xe1e1e, 0xe1e20, 0xe1e22, 0xe1e24, 0xe1e26, 0xe1e28, 0xe1e2a, 0xe1e2c, 0xe1e2e, + 0xe1e30, 0xe1e32, 0xe1e34, 0xe1e36, 0xe1e38, 0xe1e3a, 0xe1e3c, 0xe1e3e, 0xe1e40, + 0xe1e42, 0xe1e44, 0xe1e46, 0xe1e48, 0xe1e4a, 0xe1e4c, 0xe1e4e, 0xe1e50, 0xe1e52, + 0xe1e54, 0xe1e56, 0xe1e58, 0xe1e5a, 0xe1e5c, 0xe1e5e, 0xe1e60, 0xe1e62, 0xe1e64, + 0xe1e66, 0xe1e68, 0xe1e6a, 0xe1e6c, 0xe1e6e, 0xe1e70, 0xe1e72, 0xe1e74, 0xe1e76, + 0xe1e78, 0xe1e7a, 0xe1e7c, 0xe1e7e, 0xe1e80, 0xe1e82, 0xe1e84, 0xe1e86, 0xe1e88, + 0xe1e8a, 0xe1e8c, 0xe1e8e, 0xe1e90, 0xe1e92, 0xe1e94, 0xe1e9e, 0xe1ea0, 0xe1ea2, + 0xe1ea4, 0xe1ea6, 0xe1ea8, 0xe1eaa, 0xe1eac, 0xe1eae, 0xe1eb0, 0xe1eb2, 0xe1eb4, + 0xe1eb6, 0xe1eb8, 0xe1eba, 0xe1ebc, 0xe1ebe, 0xe1ec0, 0xe1ec2, 0xe1ec4, 0xe1ec6, + 0xe1ec8, 0xe1eca, 0xe1ecc, 0xe1ece, 0xe1ed0, 0xe1ed2, 0xe1ed4, 0xe1ed6, 0xe1ed8, + 0xe1eda, 0xe1edc, 0xe1ede, 0xe1ee0, 0xe1ee2, 0xe1ee4, 0xe1ee6, 0xe1ee8, 0xe1eea, + 0xe1eec, 0xe1eee, 0xe1ef0, 0xe1ef2, 0xe1ef4, 0xe1ef6, 0xe1ef8, 0xe1efa, 0xe1efc, + 0xe1efe, 0xe1f59, 0xe1f5b, 0xe1f5d, 0xe1f5f, 0xe2102, 0xe2107, 0xe2115, 0xe2124, + 0xe2126, 0xe2128, 0xe213e, 0xe213f, 0xe2145, 0xe2183, 0xe2c60, 0xe2c67, 0xe2c69, + 0xe2c6b, 0xe2c72, 0xe2c75, 0xe2c82, 0xe2c84, 0xe2c86, 0xe2c88, 0xe2c8a, 0xe2c8c, + 0xe2c8e, 0xe2c90, 0xe2c92, 0xe2c94, 0xe2c96, 0xe2c98, 0xe2c9a, 0xe2c9c, 0xe2c9e, + 0xe2ca0, 0xe2ca2, 0xe2ca4, 0xe2ca6, 0xe2ca8, 0xe2caa, 0xe2cac, 0xe2cae, 0xe2cb0, + 0xe2cb2, 0xe2cb4, 0xe2cb6, 0xe2cb8, 0xe2cba, 0xe2cbc, 0xe2cbe, 0xe2cc0, 0xe2cc2, + 0xe2cc4, 0xe2cc6, 0xe2cc8, 0xe2cca, 0xe2ccc, 0xe2cce, 0xe2cd0, 0xe2cd2, 0xe2cd4, + 0xe2cd6, 0xe2cd8, 0xe2cda, 0xe2cdc, 0xe2cde, 0xe2ce0, 0xe2ce2, 0xe2ceb, 0xe2ced, + 0xe2cf2, 0xea640, 0xea642, 0xea644, 0xea646, 0xea648, 0xea64a, 0xea64c, 0xea64e, + 0xea650, 0xea652, 0xea654, 0xea656, 0xea658, 0xea65a, 0xea65c, 0xea65e, 0xea660, + 0xea662, 0xea664, 0xea666, 0xea668, 0xea66a, 0xea66c, 0xea680, 0xea682, 0xea684, + 0xea686, 0xea688, 0xea68a, 0xea68c, 0xea68e, 0xea690, 0xea692, 0xea694, 0xea696, + 0xea698, 0xea69a, 0xea722, 0xea724, 0xea726, 0xea728, 0xea72a, 0xea72c, 0xea72e, + 0xea732, 0xea734, 0xea736, 0xea738, 0xea73a, 0xea73c, 0xea73e, 0xea740, 0xea742, + 0xea744, 0xea746, 0xea748, 0xea74a, 0xea74c, 0xea74e, 0xea750, 0xea752, 0xea754, + 0xea756, 0xea758, 0xea75a, 0xea75c, 0xea75e, 0xea760, 0xea762, 0xea764, 0xea766, + 0xea768, 0xea76a, 0xea76c, 0xea76e, 0xea779, 0xea77b, 0xea77d, 0xea77e, 0xea780, + 0xea782, 0xea784, 0xea786, 0xea78b, 0xea78d, 0xea790, 0xea792, 0xea796, 0xea798, + 0xea79a, 0xea79c, 0xea79e, 0xea7a0, 0xea7a2, 0xea7a4, 0xea7a6, 0xea7a8, 0xea7b6, + 0xf0100, 0xf0102, 0xf0104, 0xf0106, 0xf0108, 0xf010a, 0xf010c, 0xf010e, 0xf0110, + 0xf0112, 0xf0114, 0xf0116, 0xf0118, 0xf011a, 0xf011c, 0xf011e, 0xf0120, 0xf0122, + 0xf0124, 0xf0126, 0xf0128, 0xf012a, 0xf012c, 0xf012e, 0xf0130, 0xf0132, 0xf0134, + 0xf0136, 0xf0139, 0xf013b, 0xf013d, 0xf013f, 0xf0141, 0xf0143, 0xf0145, 0xf0147, + 0xf014a, 0xf014c, 0xf014e, 0xf0150, 0xf0152, 0xf0154, 0xf0156, 0xf0158, 0xf015a, + 0xf015c, 0xf015e, 0xf0160, 0xf0162, 0xf0164, 0xf0166, 0xf0168, 0xf016a, 0xf016c, + 0xf016e, 0xf0170, 0xf0172, 0xf0174, 0xf0176, 0xf0178, 0xf0179, 0xf017b, 0xf017d, + 0xf0181, 0xf0182, 0xf0184, 0xf0186, 0xf0187, 0xf0193, 0xf0194, 0xf019c, 0xf019d, + 0xf019f, 0xf01a0, 0xf01a2, 0xf01a4, 0xf01a6, 0xf01a7, 0xf01a9, 0xf01ac, 0xf01ae, + 0xf01af, 0xf01b5, 0xf01b7, 0xf01b8, 0xf01bc, 0xf01c4, 0xf01c7, 0xf01ca, 0xf01cd, + 0xf01cf, 0xf01d1, 0xf01d3, 0xf01d5, 0xf01d7, 0xf01d9, 0xf01db, 0xf01de, 0xf01e0, + 0xf01e2, 0xf01e4, 0xf01e6, 0xf01e8, 0xf01ea, 0xf01ec, 0xf01ee, 0xf01f1, 0xf01f4, + 0xf01fa, 0xf01fc, 0xf01fe, 0xf0200, 0xf0202, 0xf0204, 0xf0206, 0xf0208, 0xf020a, + 0xf020c, 0xf020e, 0xf0210, 0xf0212, 0xf0214, 0xf0216, 0xf0218, 0xf021a, 0xf021c, + 0xf021e, 0xf0220, 0xf0222, 0xf0224, 0xf0226, 0xf0228, 0xf022a, 0xf022c, 0xf022e, + 0xf0230, 0xf0232, 0xf023a, 0xf023b, 0xf023d, 0xf023e, 0xf0241, 0xf0248, 0xf024a, + 0xf024c, 0xf024e, 0xf0370, 0xf0372, 0xf0376, 0xf037f, 0xf0386, 0xf038c, 0xf038e, + 0xf038f, 0xf03cf, 0xf03d8, 0xf03da, 0xf03dc, 0xf03de, 0xf03e0, 0xf03e2, 0xf03e4, + 0xf03e6, 0xf03e8, 0xf03ea, 0xf03ec, 0xf03ee, 0xf03f4, 0xf03f7, 0xf03f9, 0xf03fa, + 0xf0460, 0xf0462, 0xf0464, 0xf0466, 0xf0468, 0xf046a, 0xf046c, 0xf046e, 0xf0470, + 0xf0472, 0xf0474, 0xf0476, 0xf0478, 0xf047a, 0xf047c, 0xf047e, 0xf0480, 0xf048a, + 0xf048c, 0xf048e, 0xf0490, 0xf0492, 0xf0494, 0xf0496, 0xf0498, 0xf049a, 0xf049c, + 0xf049e, 0xf04a0, 0xf04a2, 0xf04a4, 0xf04a6, 0xf04a8, 0xf04aa, 0xf04ac, 0xf04ae, + 0xf04b0, 0xf04b2, 0xf04b4, 0xf04b6, 0xf04b8, 0xf04ba, 0xf04bc, 0xf04be, 0xf04c0, + 0xf04c1, 0xf04c3, 0xf04c5, 0xf04c7, 0xf04c9, 0xf04cb, 0xf04cd, 0xf04d0, 0xf04d2, + 0xf04d4, 0xf04d6, 0xf04d8, 0xf04da, 0xf04dc, 0xf04de, 0xf04e0, 0xf04e2, 0xf04e4, + 0xf04e6, 0xf04e8, 0xf04ea, 0xf04ec, 0xf04ee, 0xf04f0, 0xf04f2, 0xf04f4, 0xf04f6, + 0xf04f8, 0xf04fa, 0xf04fc, 0xf04fe, 0xf0500, 0xf0502, 0xf0504, 0xf0506, 0xf0508, + 0xf050a, 0xf050c, 0xf050e, 0xf0510, 0xf0512, 0xf0514, 0xf0516, 0xf0518, 0xf051a, + 0xf051c, 0xf051e, 0xf0520, 0xf0522, 0xf0524, 0xf0526, 0xf0528, 0xf052a, 0xf052c, + 0xf052e, 0xf10c7, 0xf10cd, 0xf1e00, 0xf1e02, 0xf1e04, 0xf1e06, 0xf1e08, 0xf1e0a, + 0xf1e0c, 0xf1e0e, 0xf1e10, 0xf1e12, 0xf1e14, 0xf1e16, 0xf1e18, 0xf1e1a, 0xf1e1c, + 0xf1e1e, 0xf1e20, 0xf1e22, 0xf1e24, 0xf1e26, 0xf1e28, 0xf1e2a, 0xf1e2c, 0xf1e2e, + 0xf1e30, 0xf1e32, 0xf1e34, 0xf1e36, 0xf1e38, 0xf1e3a, 0xf1e3c, 0xf1e3e, 0xf1e40, + 0xf1e42, 0xf1e44, 0xf1e46, 0xf1e48, 0xf1e4a, 0xf1e4c, 0xf1e4e, 0xf1e50, 0xf1e52, + 0xf1e54, 0xf1e56, 0xf1e58, 0xf1e5a, 0xf1e5c, 0xf1e5e, 0xf1e60, 0xf1e62, 0xf1e64, + 0xf1e66, 0xf1e68, 0xf1e6a, 0xf1e6c, 0xf1e6e, 0xf1e70, 0xf1e72, 0xf1e74, 0xf1e76, + 0xf1e78, 0xf1e7a, 0xf1e7c, 0xf1e7e, 0xf1e80, 0xf1e82, 0xf1e84, 0xf1e86, 0xf1e88, + 0xf1e8a, 0xf1e8c, 0xf1e8e, 0xf1e90, 0xf1e92, 0xf1e94, 0xf1e9e, 0xf1ea0, 0xf1ea2, + 0xf1ea4, 0xf1ea6, 0xf1ea8, 0xf1eaa, 0xf1eac, 0xf1eae, 0xf1eb0, 0xf1eb2, 0xf1eb4, + 0xf1eb6, 0xf1eb8, 0xf1eba, 0xf1ebc, 0xf1ebe, 0xf1ec0, 0xf1ec2, 0xf1ec4, 0xf1ec6, + 0xf1ec8, 0xf1eca, 0xf1ecc, 0xf1ece, 0xf1ed0, 0xf1ed2, 0xf1ed4, 0xf1ed6, 0xf1ed8, + 0xf1eda, 0xf1edc, 0xf1ede, 0xf1ee0, 0xf1ee2, 0xf1ee4, 0xf1ee6, 0xf1ee8, 0xf1eea, + 0xf1eec, 0xf1eee, 0xf1ef0, 0xf1ef2, 0xf1ef4, 0xf1ef6, 0xf1ef8, 0xf1efa, 0xf1efc, + 0xf1efe, 0xf1f59, 0xf1f5b, 0xf1f5d, 0xf1f5f, 0xf2102, 0xf2107, 0xf2115, 0xf2124, + 0xf2126, 0xf2128, 0xf213e, 0xf213f, 0xf2145, 0xf2183, 0xf2c60, 0xf2c67, 0xf2c69, + 0xf2c6b, 0xf2c72, 0xf2c75, 0xf2c82, 0xf2c84, 0xf2c86, 0xf2c88, 0xf2c8a, 0xf2c8c, + 0xf2c8e, 0xf2c90, 0xf2c92, 0xf2c94, 0xf2c96, 0xf2c98, 0xf2c9a, 0xf2c9c, 0xf2c9e, + 0xf2ca0, 0xf2ca2, 0xf2ca4, 0xf2ca6, 0xf2ca8, 0xf2caa, 0xf2cac, 0xf2cae, 0xf2cb0, + 0xf2cb2, 0xf2cb4, 0xf2cb6, 0xf2cb8, 0xf2cba, 0xf2cbc, 0xf2cbe, 0xf2cc0, 0xf2cc2, + 0xf2cc4, 0xf2cc6, 0xf2cc8, 0xf2cca, 0xf2ccc, 0xf2cce, 0xf2cd0, 0xf2cd2, 0xf2cd4, + 0xf2cd6, 0xf2cd8, 0xf2cda, 0xf2cdc, 0xf2cde, 0xf2ce0, 0xf2ce2, 0xf2ceb, 0xf2ced, + 0xf2cf2, 0xfa640, 0xfa642, 0xfa644, 0xfa646, 0xfa648, 0xfa64a, 0xfa64c, 0xfa64e, + 0xfa650, 0xfa652, 0xfa654, 0xfa656, 0xfa658, 0xfa65a, 0xfa65c, 0xfa65e, 0xfa660, + 0xfa662, 0xfa664, 0xfa666, 0xfa668, 0xfa66a, 0xfa66c, 0xfa680, 0xfa682, 0xfa684, + 0xfa686, 0xfa688, 0xfa68a, 0xfa68c, 0xfa68e, 0xfa690, 0xfa692, 0xfa694, 0xfa696, + 0xfa698, 0xfa69a, 0xfa722, 0xfa724, 0xfa726, 0xfa728, 0xfa72a, 0xfa72c, 0xfa72e, + 0xfa732, 0xfa734, 0xfa736, 0xfa738, 0xfa73a, 0xfa73c, 0xfa73e, 0xfa740, 0xfa742, + 0xfa744, 0xfa746, 0xfa748, 0xfa74a, 0xfa74c, 0xfa74e, 0xfa750, 0xfa752, 0xfa754, + 0xfa756, 0xfa758, 0xfa75a, 0xfa75c, 0xfa75e, 0xfa760, 0xfa762, 0xfa764, 0xfa766, + 0xfa768, 0xfa76a, 0xfa76c, 0xfa76e, 0xfa779, 0xfa77b, 0xfa77d, 0xfa77e, 0xfa780, + 0xfa782, 0xfa784, 0xfa786, 0xfa78b, 0xfa78d, 0xfa790, 0xfa792, 0xfa796, 0xfa798, + 0xfa79a, 0xfa79c, 0xfa79e, 0xfa7a0, 0xfa7a2, 0xfa7a4, 0xfa7a6, 0xfa7a8, 0xfa7b6, + 0x100100, 0x100102, 0x100104, 0x100106, 0x100108, 0x10010a, 0x10010c, 0x10010e, 0x100110, + 0x100112, 0x100114, 0x100116, 0x100118, 0x10011a, 0x10011c, 0x10011e, 0x100120, 0x100122, + 0x100124, 0x100126, 0x100128, 0x10012a, 0x10012c, 0x10012e, 0x100130, 0x100132, 0x100134, + 0x100136, 0x100139, 0x10013b, 0x10013d, 0x10013f, 0x100141, 0x100143, 0x100145, 0x100147, + 0x10014a, 0x10014c, 0x10014e, 0x100150, 0x100152, 0x100154, 0x100156, 0x100158, 0x10015a, + 0x10015c, 0x10015e, 0x100160, 0x100162, 0x100164, 0x100166, 0x100168, 0x10016a, 0x10016c, + 0x10016e, 0x100170, 0x100172, 0x100174, 0x100176, 0x100178, 0x100179, 0x10017b, 0x10017d, + 0x100181, 0x100182, 0x100184, 0x100186, 0x100187, 0x100193, 0x100194, 0x10019c, 0x10019d, + 0x10019f, 0x1001a0, 0x1001a2, 0x1001a4, 0x1001a6, 0x1001a7, 0x1001a9, 0x1001ac, 0x1001ae, + 0x1001af, 0x1001b5, 0x1001b7, 0x1001b8, 0x1001bc, 0x1001c4, 0x1001c7, 0x1001ca, 0x1001cd, + 0x1001cf, 0x1001d1, 0x1001d3, 0x1001d5, 0x1001d7, 0x1001d9, 0x1001db, 0x1001de, 0x1001e0, + 0x1001e2, 0x1001e4, 0x1001e6, 0x1001e8, 0x1001ea, 0x1001ec, 0x1001ee, 0x1001f1, 0x1001f4, + 0x1001fa, 0x1001fc, 0x1001fe, 0x100200, 0x100202, 0x100204, 0x100206, 0x100208, 0x10020a, + 0x10020c, 0x10020e, 0x100210, 0x100212, 0x100214, 0x100216, 0x100218, 0x10021a, 0x10021c, + 0x10021e, 0x100220, 0x100222, 0x100224, 0x100226, 0x100228, 0x10022a, 0x10022c, 0x10022e, + 0x100230, 0x100232, 0x10023a, 0x10023b, 0x10023d, 0x10023e, 0x100241, 0x100248, 0x10024a, + 0x10024c, 0x10024e, 0x100370, 0x100372, 0x100376, 0x10037f, 0x100386, 0x10038c, 0x10038e, + 0x10038f, 0x1003cf, 0x1003d8, 0x1003da, 0x1003dc, 0x1003de, 0x1003e0, 0x1003e2, 0x1003e4, + 0x1003e6, 0x1003e8, 0x1003ea, 0x1003ec, 0x1003ee, 0x1003f4, 0x1003f7, 0x1003f9, 0x1003fa, + 0x100460, 0x100462, 0x100464, 0x100466, 0x100468, 0x10046a, 0x10046c, 0x10046e, 0x100470, + 0x100472, 0x100474, 0x100476, 0x100478, 0x10047a, 0x10047c, 0x10047e, 0x100480, 0x10048a, + 0x10048c, 0x10048e, 0x100490, 0x100492, 0x100494, 0x100496, 0x100498, 0x10049a, 0x10049c, + 0x10049e, 0x1004a0, 0x1004a2, 0x1004a4, 0x1004a6, 0x1004a8, 0x1004aa, 0x1004ac, 0x1004ae, + 0x1004b0, 0x1004b2, 0x1004b4, 0x1004b6, 0x1004b8, 0x1004ba, 0x1004bc, 0x1004be, 0x1004c0, + 0x1004c1, 0x1004c3, 0x1004c5, 0x1004c7, 0x1004c9, 0x1004cb, 0x1004cd, 0x1004d0, 0x1004d2, + 0x1004d4, 0x1004d6, 0x1004d8, 0x1004da, 0x1004dc, 0x1004de, 0x1004e0, 0x1004e2, 0x1004e4, + 0x1004e6, 0x1004e8, 0x1004ea, 0x1004ec, 0x1004ee, 0x1004f0, 0x1004f2, 0x1004f4, 0x1004f6, + 0x1004f8, 0x1004fa, 0x1004fc, 0x1004fe, 0x100500, 0x100502, 0x100504, 0x100506, 0x100508, + 0x10050a, 0x10050c, 0x10050e, 0x100510, 0x100512, 0x100514, 0x100516, 0x100518, 0x10051a, + 0x10051c, 0x10051e, 0x100520, 0x100522, 0x100524, 0x100526, 0x100528, 0x10052a, 0x10052c, + 0x10052e, 0x1010c7, 0x1010cd, 0x101e00, 0x101e02, 0x101e04, 0x101e06, 0x101e08, 0x101e0a, + 0x101e0c, 0x101e0e, 0x101e10, 0x101e12, 0x101e14, 0x101e16, 0x101e18, 0x101e1a, 0x101e1c, + 0x101e1e, 0x101e20, 0x101e22, 0x101e24, 0x101e26, 0x101e28, 0x101e2a, 0x101e2c, 0x101e2e, + 0x101e30, 0x101e32, 0x101e34, 0x101e36, 0x101e38, 0x101e3a, 0x101e3c, 0x101e3e, 0x101e40, + 0x101e42, 0x101e44, 0x101e46, 0x101e48, 0x101e4a, 0x101e4c, 0x101e4e, 0x101e50, 0x101e52, + 0x101e54, 0x101e56, 0x101e58, 0x101e5a, 0x101e5c, 0x101e5e, 0x101e60, 0x101e62, 0x101e64, + 0x101e66, 0x101e68, 0x101e6a, 0x101e6c, 0x101e6e, 0x101e70, 0x101e72, 0x101e74, 0x101e76, + 0x101e78, 0x101e7a, 0x101e7c, 0x101e7e, 0x101e80, 0x101e82, 0x101e84, 0x101e86, 0x101e88, + 0x101e8a, 0x101e8c, 0x101e8e, 0x101e90, 0x101e92, 0x101e94, 0x101e9e, 0x101ea0, 0x101ea2, + 0x101ea4, 0x101ea6, 0x101ea8, 0x101eaa, 0x101eac, 0x101eae, 0x101eb0, 0x101eb2, 0x101eb4, + 0x101eb6, 0x101eb8, 0x101eba, 0x101ebc, 0x101ebe, 0x101ec0, 0x101ec2, 0x101ec4, 0x101ec6, + 0x101ec8, 0x101eca, 0x101ecc, 0x101ece, 0x101ed0, 0x101ed2, 0x101ed4, 0x101ed6, 0x101ed8, + 0x101eda, 0x101edc, 0x101ede, 0x101ee0, 0x101ee2, 0x101ee4, 0x101ee6, 0x101ee8, 0x101eea, + 0x101eec, 0x101eee, 0x101ef0, 0x101ef2, 0x101ef4, 0x101ef6, 0x101ef8, 0x101efa, 0x101efc, + 0x101efe, 0x101f59, 0x101f5b, 0x101f5d, 0x101f5f, 0x102102, 0x102107, 0x102115, 0x102124, + 0x102126, 0x102128, 0x10213e, 0x10213f, 0x102145, 0x102183, 0x102c60, 0x102c67, 0x102c69, + 0x102c6b, 0x102c72, 0x102c75, 0x102c82, 0x102c84, 0x102c86, 0x102c88, 0x102c8a, 0x102c8c, + 0x102c8e, 0x102c90, 0x102c92, 0x102c94, 0x102c96, 0x102c98, 0x102c9a, 0x102c9c, 0x102c9e, + 0x102ca0, 0x102ca2, 0x102ca4, 0x102ca6, 0x102ca8, 0x102caa, 0x102cac, 0x102cae, 0x102cb0, + 0x102cb2, 0x102cb4, 0x102cb6, 0x102cb8, 0x102cba, 0x102cbc, 0x102cbe, 0x102cc0, 0x102cc2, + 0x102cc4, 0x102cc6, 0x102cc8, 0x102cca, 0x102ccc, 0x102cce, 0x102cd0, 0x102cd2, 0x102cd4, + 0x102cd6, 0x102cd8, 0x102cda, 0x102cdc, 0x102cde, 0x102ce0, 0x102ce2, 0x102ceb, 0x102ced, + 0x102cf2, 0x10a640, 0x10a642, 0x10a644, 0x10a646, 0x10a648, 0x10a64a, 0x10a64c, 0x10a64e, + 0x10a650, 0x10a652, 0x10a654, 0x10a656, 0x10a658, 0x10a65a, 0x10a65c, 0x10a65e, 0x10a660, + 0x10a662, 0x10a664, 0x10a666, 0x10a668, 0x10a66a, 0x10a66c, 0x10a680, 0x10a682, 0x10a684, + 0x10a686, 0x10a688, 0x10a68a, 0x10a68c, 0x10a68e, 0x10a690, 0x10a692, 0x10a694, 0x10a696, + 0x10a698, 0x10a69a, 0x10a722, 0x10a724, 0x10a726, 0x10a728, 0x10a72a, 0x10a72c, 0x10a72e, + 0x10a732, 0x10a734, 0x10a736, 0x10a738, 0x10a73a, 0x10a73c, 0x10a73e, 0x10a740, 0x10a742, + 0x10a744, 0x10a746, 0x10a748, 0x10a74a, 0x10a74c, 0x10a74e, 0x10a750, 0x10a752, 0x10a754, + 0x10a756, 0x10a758, 0x10a75a, 0x10a75c, 0x10a75e, 0x10a760, 0x10a762, 0x10a764, 0x10a766, + 0x10a768, 0x10a76a, 0x10a76c, 0x10a76e, 0x10a779, 0x10a77b, 0x10a77d, 0x10a77e, 0x10a780, + 0x10a782, 0x10a784, 0x10a786, 0x10a78b, 0x10a78d, 0x10a790, 0x10a792, 0x10a796, 0x10a798, + 0x10a79a, 0x10a79c, 0x10a79e, 0x10a7a0, 0x10a7a2, 0x10a7a4, 0x10a7a6, 0x10a7a8, 0x10a7b6 #endif }; @@ -615,63 +4879,63 @@ static const crange graphRangeTable[] = { {0x559, 0x55f}, {0x561, 0x587}, {0x58d, 0x58f}, {0x591, 0x5c7}, {0x5d0, 0x5ea}, {0x5f0, 0x5f4}, {0x606, 0x61b}, {0x61e, 0x6dc}, {0x6de, 0x70d}, {0x710, 0x74a}, {0x74d, 0x7b1}, {0x7c0, 0x7fa}, - {0x800, 0x82d}, {0x830, 0x83e}, {0x840, 0x85b}, {0x8a0, 0x8b4}, - {0x8b6, 0x8bd}, {0x8d4, 0x8e1}, {0x8e3, 0x983}, {0x985, 0x98c}, - {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, {0x9bc, 0x9c4}, - {0x9cb, 0x9ce}, {0x9df, 0x9e3}, {0x9e6, 0x9fb}, {0xa01, 0xa03}, - {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa3e, 0xa42}, - {0xa4b, 0xa4d}, {0xa59, 0xa5c}, {0xa66, 0xa75}, {0xa81, 0xa83}, - {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, {0xaaa, 0xab0}, - {0xab5, 0xab9}, {0xabc, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, - {0xae0, 0xae3}, {0xae6, 0xaf1}, {0xb01, 0xb03}, {0xb05, 0xb0c}, - {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb35, 0xb39}, {0xb3c, 0xb44}, - {0xb4b, 0xb4d}, {0xb5f, 0xb63}, {0xb66, 0xb77}, {0xb85, 0xb8a}, - {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xba8, 0xbaa}, {0xbae, 0xbb9}, - {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, {0xbca, 0xbcd}, {0xbe6, 0xbfa}, - {0xc00, 0xc03}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, - {0xc2a, 0xc39}, {0xc3d, 0xc44}, {0xc46, 0xc48}, {0xc4a, 0xc4d}, - {0xc58, 0xc5a}, {0xc60, 0xc63}, {0xc66, 0xc6f}, {0xc78, 0xc83}, - {0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, - {0xcb5, 0xcb9}, {0xcbc, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, - {0xce0, 0xce3}, {0xce6, 0xcef}, {0xd01, 0xd03}, {0xd05, 0xd0c}, - {0xd0e, 0xd10}, {0xd12, 0xd3a}, {0xd3d, 0xd44}, {0xd46, 0xd48}, - {0xd4a, 0xd4f}, {0xd54, 0xd63}, {0xd66, 0xd7f}, {0xd85, 0xd96}, - {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6}, {0xdcf, 0xdd4}, - {0xdd8, 0xddf}, {0xde6, 0xdef}, {0xdf2, 0xdf4}, {0xe01, 0xe3a}, - {0xe3f, 0xe5b}, {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, - {0xead, 0xeb9}, {0xebb, 0xebd}, {0xec0, 0xec4}, {0xec8, 0xecd}, - {0xed0, 0xed9}, {0xedc, 0xedf}, {0xf00, 0xf47}, {0xf49, 0xf6c}, - {0xf71, 0xf97}, {0xf99, 0xfbc}, {0xfbe, 0xfcc}, {0xfce, 0xfda}, - {0x1000, 0x10c5}, {0x10d0, 0x1248}, {0x124a, 0x124d}, {0x1250, 0x1256}, - {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12b0}, - {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, - {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, {0x135d, 0x137c}, - {0x1380, 0x1399}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, {0x1400, 0x167f}, - {0x1681, 0x169c}, {0x16a0, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1714}, - {0x1720, 0x1736}, {0x1740, 0x1753}, {0x1760, 0x176c}, {0x176e, 0x1770}, - {0x1780, 0x17dd}, {0x17e0, 0x17e9}, {0x17f0, 0x17f9}, {0x1800, 0x180d}, - {0x1810, 0x1819}, {0x1820, 0x1877}, {0x1880, 0x18aa}, {0x18b0, 0x18f5}, - {0x1900, 0x191e}, {0x1920, 0x192b}, {0x1930, 0x193b}, {0x1944, 0x196d}, - {0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9}, {0x19d0, 0x19da}, - {0x19de, 0x1a1b}, {0x1a1e, 0x1a5e}, {0x1a60, 0x1a7c}, {0x1a7f, 0x1a89}, - {0x1a90, 0x1a99}, {0x1aa0, 0x1aad}, {0x1ab0, 0x1abe}, {0x1b00, 0x1b4b}, - {0x1b50, 0x1b7c}, {0x1b80, 0x1bf3}, {0x1bfc, 0x1c37}, {0x1c3b, 0x1c49}, - {0x1c4d, 0x1c88}, {0x1cc0, 0x1cc7}, {0x1cd0, 0x1cf6}, {0x1d00, 0x1df5}, - {0x1dfb, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, - {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fc4}, - {0x1fc6, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fdd, 0x1fef}, {0x1ff2, 0x1ff4}, - {0x1ff6, 0x1ffe}, {0x2010, 0x2027}, {0x2030, 0x205e}, {0x2074, 0x208e}, - {0x2090, 0x209c}, {0x20a0, 0x20be}, {0x20d0, 0x20f0}, {0x2100, 0x218b}, - {0x2190, 0x23fe}, {0x2400, 0x2426}, {0x2440, 0x244a}, {0x2460, 0x2b73}, - {0x2b76, 0x2b95}, {0x2b98, 0x2bb9}, {0x2bbd, 0x2bc8}, {0x2bca, 0x2bd1}, + {0x800, 0x82d}, {0x830, 0x83e}, {0x840, 0x85b}, {0x860, 0x86a}, + {0x8a0, 0x8b4}, {0x8b6, 0x8bd}, {0x8d4, 0x8e1}, {0x8e3, 0x983}, + {0x985, 0x98c}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, + {0x9bc, 0x9c4}, {0x9cb, 0x9ce}, {0x9df, 0x9e3}, {0x9e6, 0x9fd}, + {0xa01, 0xa03}, {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, + {0xa3e, 0xa42}, {0xa4b, 0xa4d}, {0xa59, 0xa5c}, {0xa66, 0xa75}, + {0xa81, 0xa83}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, + {0xaaa, 0xab0}, {0xab5, 0xab9}, {0xabc, 0xac5}, {0xac7, 0xac9}, + {0xacb, 0xacd}, {0xae0, 0xae3}, {0xae6, 0xaf1}, {0xaf9, 0xaff}, + {0xb01, 0xb03}, {0xb05, 0xb0c}, {0xb13, 0xb28}, {0xb2a, 0xb30}, + {0xb35, 0xb39}, {0xb3c, 0xb44}, {0xb4b, 0xb4d}, {0xb5f, 0xb63}, + {0xb66, 0xb77}, {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95}, + {0xba8, 0xbaa}, {0xbae, 0xbb9}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, + {0xbca, 0xbcd}, {0xbe6, 0xbfa}, {0xc00, 0xc03}, {0xc05, 0xc0c}, + {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, {0xc3d, 0xc44}, + {0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc58, 0xc5a}, {0xc60, 0xc63}, + {0xc66, 0xc6f}, {0xc78, 0xc83}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, + {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xcbc, 0xcc4}, + {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xce0, 0xce3}, {0xce6, 0xcef}, + {0xd00, 0xd03}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd44}, + {0xd46, 0xd48}, {0xd4a, 0xd4f}, {0xd54, 0xd63}, {0xd66, 0xd7f}, + {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6}, + {0xdcf, 0xdd4}, {0xdd8, 0xddf}, {0xde6, 0xdef}, {0xdf2, 0xdf4}, + {0xe01, 0xe3a}, {0xe3f, 0xe5b}, {0xe94, 0xe97}, {0xe99, 0xe9f}, + {0xea1, 0xea3}, {0xead, 0xeb9}, {0xebb, 0xebd}, {0xec0, 0xec4}, + {0xec8, 0xecd}, {0xed0, 0xed9}, {0xedc, 0xedf}, {0xf00, 0xf47}, + {0xf49, 0xf6c}, {0xf71, 0xf97}, {0xf99, 0xfbc}, {0xfbe, 0xfcc}, + {0xfce, 0xfda}, {0x1000, 0x10c5}, {0x10d0, 0x1248}, {0x124a, 0x124d}, + {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, + {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5}, + {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, + {0x135d, 0x137c}, {0x1380, 0x1399}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, + {0x1400, 0x167f}, {0x1681, 0x169c}, {0x16a0, 0x16f8}, {0x1700, 0x170c}, + {0x170e, 0x1714}, {0x1720, 0x1736}, {0x1740, 0x1753}, {0x1760, 0x176c}, + {0x176e, 0x1770}, {0x1780, 0x17dd}, {0x17e0, 0x17e9}, {0x17f0, 0x17f9}, + {0x1800, 0x180d}, {0x1810, 0x1819}, {0x1820, 0x1877}, {0x1880, 0x18aa}, + {0x18b0, 0x18f5}, {0x1900, 0x191e}, {0x1920, 0x192b}, {0x1930, 0x193b}, + {0x1944, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9}, + {0x19d0, 0x19da}, {0x19de, 0x1a1b}, {0x1a1e, 0x1a5e}, {0x1a60, 0x1a7c}, + {0x1a7f, 0x1a89}, {0x1a90, 0x1a99}, {0x1aa0, 0x1aad}, {0x1ab0, 0x1abe}, + {0x1b00, 0x1b4b}, {0x1b50, 0x1b7c}, {0x1b80, 0x1bf3}, {0x1bfc, 0x1c37}, + {0x1c3b, 0x1c49}, {0x1c4d, 0x1c88}, {0x1cc0, 0x1cc7}, {0x1cd0, 0x1cf9}, + {0x1d00, 0x1df9}, {0x1dfb, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, + {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, + {0x1fb6, 0x1fc4}, {0x1fc6, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fdd, 0x1fef}, + {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffe}, {0x2010, 0x2027}, {0x2030, 0x205e}, + {0x2074, 0x208e}, {0x2090, 0x209c}, {0x20a0, 0x20bf}, {0x20d0, 0x20f0}, + {0x2100, 0x218b}, {0x2190, 0x2426}, {0x2440, 0x244a}, {0x2460, 0x2b73}, + {0x2b76, 0x2b95}, {0x2b98, 0x2bb9}, {0x2bbd, 0x2bc8}, {0x2bca, 0x2bd2}, {0x2bec, 0x2bef}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2cf3}, {0x2cf9, 0x2d25}, {0x2d30, 0x2d67}, {0x2d7f, 0x2d96}, {0x2da0, 0x2da6}, {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, - {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2de0, 0x2e44}, + {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2de0, 0x2e49}, {0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb}, - {0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff}, {0x3105, 0x312d}, + {0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff}, {0x3105, 0x312e}, {0x3131, 0x318e}, {0x3190, 0x31ba}, {0x31c0, 0x31e3}, {0x31f0, 0x321e}, - {0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fd5}, {0xa000, 0xa48c}, + {0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fea}, {0xa000, 0xa48c}, {0xa490, 0xa4c6}, {0xa4d0, 0xa62b}, {0xa640, 0xa6f7}, {0xa700, 0xa7ae}, {0xa7b0, 0xa7b7}, {0xa7f7, 0xa82b}, {0xa830, 0xa839}, {0xa840, 0xa877}, {0xa880, 0xa8c5}, {0xa8ce, 0xa8d9}, {0xa8e0, 0xa8fd}, {0xa900, 0xa953}, @@ -680,10 +4944,6 @@ static const crange graphRangeTable[] = { {0xaadb, 0xaaf6}, {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab65}, {0xab70, 0xabed}, {0xabf0, 0xabf9}, {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, - {0xdc00, 0xdc3e}, {0xdc40, 0xdc7e}, {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, - {0xdd00, 0xdd3e}, {0xdd40, 0xdd7e}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe}, - {0xde00, 0xde3e}, {0xde40, 0xde7e}, {0xde80, 0xdebe}, {0xdec0, 0xdefe}, - {0xdf00, 0xdf3e}, {0xdf40, 0xdf7e}, {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1d, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbc1}, {0xfbd3, 0xfd3f}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfd}, {0xfe00, 0xfe19}, @@ -691,61 +4951,1222 @@ static const crange graphRangeTable[] = { {0xfe76, 0xfefc}, {0xff01, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}, {0xffe0, 0xffe6}, {0xffe8, 0xffee} #if TCL_UTF_MAX > 4 - ,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d}, - {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10100, 0x10102}, {0x10107, 0x10133}, - {0x10137, 0x1018e}, {0x10190, 0x1019b}, {0x101d0, 0x101fd}, {0x10280, 0x1029c}, - {0x102a0, 0x102d0}, {0x102e0, 0x102fb}, {0x10300, 0x10323}, {0x10330, 0x1034a}, - {0x10350, 0x1037a}, {0x10380, 0x1039d}, {0x1039f, 0x103c3}, {0x103c8, 0x103d5}, - {0x10400, 0x1049d}, {0x104a0, 0x104a9}, {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, - {0x10500, 0x10527}, {0x10530, 0x10563}, {0x10600, 0x10736}, {0x10740, 0x10755}, - {0x10760, 0x10767}, {0x10800, 0x10805}, {0x1080a, 0x10835}, {0x1083f, 0x10855}, - {0x10857, 0x1089e}, {0x108a7, 0x108af}, {0x108e0, 0x108f2}, {0x108fb, 0x1091b}, - {0x1091f, 0x10939}, {0x10980, 0x109b7}, {0x109bc, 0x109cf}, {0x109d2, 0x10a03}, - {0x10a0c, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33}, {0x10a38, 0x10a3a}, - {0x10a3f, 0x10a47}, {0x10a50, 0x10a58}, {0x10a60, 0x10a9f}, {0x10ac0, 0x10ae6}, - {0x10aeb, 0x10af6}, {0x10b00, 0x10b35}, {0x10b39, 0x10b55}, {0x10b58, 0x10b72}, - {0x10b78, 0x10b91}, {0x10b99, 0x10b9c}, {0x10ba9, 0x10baf}, {0x10c00, 0x10c48}, - {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x10cfa, 0x10cff}, {0x10e60, 0x10e7e}, - {0x11000, 0x1104d}, {0x11052, 0x1106f}, {0x1107f, 0x110bc}, {0x110be, 0x110c1}, - {0x110d0, 0x110e8}, {0x110f0, 0x110f9}, {0x11100, 0x11134}, {0x11136, 0x11143}, - {0x11150, 0x11176}, {0x11180, 0x111cd}, {0x111d0, 0x111df}, {0x111e1, 0x111f4}, - {0x11200, 0x11211}, {0x11213, 0x1123e}, {0x11280, 0x11286}, {0x1128a, 0x1128d}, - {0x1128f, 0x1129d}, {0x1129f, 0x112a9}, {0x112b0, 0x112ea}, {0x112f0, 0x112f9}, - {0x11300, 0x11303}, {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, - {0x11335, 0x11339}, {0x1133c, 0x11344}, {0x1134b, 0x1134d}, {0x1135d, 0x11363}, - {0x11366, 0x1136c}, {0x11370, 0x11374}, {0x11400, 0x11459}, {0x11480, 0x114c7}, - {0x114d0, 0x114d9}, {0x11580, 0x115b5}, {0x115b8, 0x115dd}, {0x11600, 0x11644}, - {0x11650, 0x11659}, {0x11660, 0x1166c}, {0x11680, 0x116b7}, {0x116c0, 0x116c9}, - {0x11700, 0x11719}, {0x1171d, 0x1172b}, {0x11730, 0x1173f}, {0x118a0, 0x118f2}, - {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, {0x11c0a, 0x11c36}, {0x11c38, 0x11c45}, - {0x11c50, 0x11c6c}, {0x11c70, 0x11c8f}, {0x11c92, 0x11ca7}, {0x11ca9, 0x11cb6}, - {0x12000, 0x12399}, {0x12400, 0x1246e}, {0x12470, 0x12474}, {0x12480, 0x12543}, - {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e}, - {0x16a60, 0x16a69}, {0x16ad0, 0x16aed}, {0x16af0, 0x16af5}, {0x16b00, 0x16b45}, - {0x16b50, 0x16b59}, {0x16b5b, 0x16b61}, {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, - {0x16f00, 0x16f44}, {0x16f50, 0x16f7e}, {0x16f8f, 0x16f9f}, {0x17000, 0x187ec}, - {0x18800, 0x18af2}, {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, - {0x1bc90, 0x1bc99}, {0x1bc9c, 0x1bc9f}, {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, - {0x1d129, 0x1d172}, {0x1d17b, 0x1d1e8}, {0x1d200, 0x1d245}, {0x1d300, 0x1d356}, - {0x1d360, 0x1d371}, {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, - {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, - {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, - {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d7cb}, - {0x1d7ce, 0x1da8b}, {0x1da9b, 0x1da9f}, {0x1daa1, 0x1daaf}, {0x1e000, 0x1e006}, - {0x1e008, 0x1e018}, {0x1e01b, 0x1e021}, {0x1e026, 0x1e02a}, {0x1e800, 0x1e8c4}, - {0x1e8c7, 0x1e8d6}, {0x1e900, 0x1e94a}, {0x1e950, 0x1e959}, {0x1ee00, 0x1ee03}, - {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, - {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, - {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, - {0x1eeab, 0x1eebb}, {0x1f000, 0x1f02b}, {0x1f030, 0x1f093}, {0x1f0a0, 0x1f0ae}, - {0x1f0b1, 0x1f0bf}, {0x1f0c1, 0x1f0cf}, {0x1f0d1, 0x1f0f5}, {0x1f100, 0x1f10c}, - {0x1f110, 0x1f12e}, {0x1f130, 0x1f16b}, {0x1f170, 0x1f1ac}, {0x1f1e6, 0x1f202}, - {0x1f210, 0x1f23b}, {0x1f240, 0x1f248}, {0x1f300, 0x1f6d2}, {0x1f6e0, 0x1f6ec}, - {0x1f6f0, 0x1f6f6}, {0x1f700, 0x1f773}, {0x1f780, 0x1f7d4}, {0x1f800, 0x1f80b}, - {0x1f810, 0x1f847}, {0x1f850, 0x1f859}, {0x1f860, 0x1f887}, {0x1f890, 0x1f8ad}, - {0x1f910, 0x1f91e}, {0x1f920, 0x1f927}, {0x1f933, 0x1f93e}, {0x1f940, 0x1f94b}, - {0x1f950, 0x1f95e}, {0x1f980, 0x1f991}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, - {0x2b740, 0x2b81d}, {0x2b820, 0x2cea1}, {0x2f800, 0x2fa1d}, {0xe0100, 0xe01ef} + ,{0x10021, 0x1007e}, {0x100a1, 0x100ac}, {0x100ae, 0x10377}, {0x1037a, 0x1037f}, + {0x10384, 0x1038a}, {0x1038e, 0x103a1}, {0x103a3, 0x1052f}, {0x10531, 0x10556}, + {0x10559, 0x1055f}, {0x10561, 0x10587}, {0x1058d, 0x1058f}, {0x10591, 0x105c7}, + {0x105d0, 0x105ea}, {0x105f0, 0x105f4}, {0x10606, 0x1061b}, {0x1061e, 0x106dc}, + {0x106de, 0x1070d}, {0x10710, 0x1074a}, {0x1074d, 0x107b1}, {0x107c0, 0x107fa}, + {0x10800, 0x1082d}, {0x10830, 0x1083e}, {0x10840, 0x1085b}, {0x10860, 0x1086a}, + {0x108a0, 0x108b4}, {0x108b6, 0x108bd}, {0x108d4, 0x108e1}, {0x108e3, 0x10983}, + {0x10985, 0x1098c}, {0x10993, 0x109a8}, {0x109aa, 0x109b0}, {0x109b6, 0x109b9}, + {0x109bc, 0x109c4}, {0x109cb, 0x109ce}, {0x109df, 0x109e3}, {0x109e6, 0x109fd}, + {0x10a01, 0x10a03}, {0x10a05, 0x10a0a}, {0x10a13, 0x10a28}, {0x10a2a, 0x10a30}, + {0x10a3e, 0x10a42}, {0x10a4b, 0x10a4d}, {0x10a59, 0x10a5c}, {0x10a66, 0x10a75}, + {0x10a81, 0x10a83}, {0x10a85, 0x10a8d}, {0x10a8f, 0x10a91}, {0x10a93, 0x10aa8}, + {0x10aaa, 0x10ab0}, {0x10ab5, 0x10ab9}, {0x10abc, 0x10ac5}, {0x10ac7, 0x10ac9}, + {0x10acb, 0x10acd}, {0x10ae0, 0x10ae3}, {0x10ae6, 0x10af1}, {0x10af9, 0x10aff}, + {0x10b01, 0x10b03}, {0x10b05, 0x10b0c}, {0x10b13, 0x10b28}, {0x10b2a, 0x10b30}, + {0x10b35, 0x10b39}, {0x10b3c, 0x10b44}, {0x10b4b, 0x10b4d}, {0x10b5f, 0x10b63}, + {0x10b66, 0x10b77}, {0x10b85, 0x10b8a}, {0x10b8e, 0x10b90}, {0x10b92, 0x10b95}, + {0x10ba8, 0x10baa}, {0x10bae, 0x10bb9}, {0x10bbe, 0x10bc2}, {0x10bc6, 0x10bc8}, + {0x10bca, 0x10bcd}, {0x10be6, 0x10bfa}, {0x10c00, 0x10c03}, {0x10c05, 0x10c0c}, + {0x10c0e, 0x10c10}, {0x10c12, 0x10c28}, {0x10c2a, 0x10c39}, {0x10c3d, 0x10c44}, + {0x10c46, 0x10c48}, {0x10c4a, 0x10c4d}, {0x10c58, 0x10c5a}, {0x10c60, 0x10c63}, + {0x10c66, 0x10c6f}, {0x10c78, 0x10c83}, {0x10c85, 0x10c8c}, {0x10c8e, 0x10c90}, + {0x10c92, 0x10ca8}, {0x10caa, 0x10cb3}, {0x10cb5, 0x10cb9}, {0x10cbc, 0x10cc4}, + {0x10cc6, 0x10cc8}, {0x10cca, 0x10ccd}, {0x10ce0, 0x10ce3}, {0x10ce6, 0x10cef}, + {0x10d00, 0x10d03}, {0x10d05, 0x10d0c}, {0x10d0e, 0x10d10}, {0x10d12, 0x10d44}, + {0x10d46, 0x10d48}, {0x10d4a, 0x10d4f}, {0x10d54, 0x10d63}, {0x10d66, 0x10d7f}, + {0x10d85, 0x10d96}, {0x10d9a, 0x10db1}, {0x10db3, 0x10dbb}, {0x10dc0, 0x10dc6}, + {0x10dcf, 0x10dd4}, {0x10dd8, 0x10ddf}, {0x10de6, 0x10def}, {0x10df2, 0x10df4}, + {0x10e01, 0x10e3a}, {0x10e3f, 0x10e5b}, {0x10e94, 0x10e97}, {0x10e99, 0x10e9f}, + {0x10ea1, 0x10ea3}, {0x10ead, 0x10eb9}, {0x10ebb, 0x10ebd}, {0x10ec0, 0x10ec4}, + {0x10ec8, 0x10ecd}, {0x10ed0, 0x10ed9}, {0x10edc, 0x10edf}, {0x10f00, 0x10f47}, + {0x10f49, 0x10f6c}, {0x10f71, 0x10f97}, {0x10f99, 0x10fbc}, {0x10fbe, 0x10fcc}, + {0x10fce, 0x10fda}, {0x11000, 0x110c5}, {0x110d0, 0x11248}, {0x1124a, 0x1124d}, + {0x11250, 0x11256}, {0x1125a, 0x1125d}, {0x11260, 0x11288}, {0x1128a, 0x1128d}, + {0x11290, 0x112b0}, {0x112b2, 0x112b5}, {0x112b8, 0x112be}, {0x112c2, 0x112c5}, + {0x112c8, 0x112d6}, {0x112d8, 0x11310}, {0x11312, 0x11315}, {0x11318, 0x1135a}, + {0x1135d, 0x1137c}, {0x11380, 0x11399}, {0x113a0, 0x113f5}, {0x113f8, 0x113fd}, + {0x11400, 0x1167f}, {0x11681, 0x1169c}, {0x116a0, 0x116f8}, {0x11700, 0x1170c}, + {0x1170e, 0x11714}, {0x11720, 0x11736}, {0x11740, 0x11753}, {0x11760, 0x1176c}, + {0x1176e, 0x11770}, {0x11780, 0x117dd}, {0x117e0, 0x117e9}, {0x117f0, 0x117f9}, + {0x11800, 0x1180d}, {0x11810, 0x11819}, {0x11820, 0x11877}, {0x11880, 0x118aa}, + {0x118b0, 0x118f5}, {0x11900, 0x1191e}, {0x11920, 0x1192b}, {0x11930, 0x1193b}, + {0x11944, 0x1196d}, {0x11970, 0x11974}, {0x11980, 0x119ab}, {0x119b0, 0x119c9}, + {0x119d0, 0x119da}, {0x119de, 0x11a1b}, {0x11a1e, 0x11a5e}, {0x11a60, 0x11a7c}, + {0x11a7f, 0x11a89}, {0x11a90, 0x11a99}, {0x11aa0, 0x11aad}, {0x11ab0, 0x11abe}, + {0x11b00, 0x11b4b}, {0x11b50, 0x11b7c}, {0x11b80, 0x11bf3}, {0x11bfc, 0x11c37}, + {0x11c3b, 0x11c49}, {0x11c4d, 0x11c88}, {0x11cc0, 0x11cc7}, {0x11cd0, 0x11cf9}, + {0x11d00, 0x11df9}, {0x11dfb, 0x11f15}, {0x11f18, 0x11f1d}, {0x11f20, 0x11f45}, + {0x11f48, 0x11f4d}, {0x11f50, 0x11f57}, {0x11f5f, 0x11f7d}, {0x11f80, 0x11fb4}, + {0x11fb6, 0x11fc4}, {0x11fc6, 0x11fd3}, {0x11fd6, 0x11fdb}, {0x11fdd, 0x11fef}, + {0x11ff2, 0x11ff4}, {0x11ff6, 0x11ffe}, {0x12010, 0x12027}, {0x12030, 0x1205e}, + {0x12074, 0x1208e}, {0x12090, 0x1209c}, {0x120a0, 0x120bf}, {0x120d0, 0x120f0}, + {0x12100, 0x1218b}, {0x12190, 0x12426}, {0x12440, 0x1244a}, {0x12460, 0x12b73}, + {0x12b76, 0x12b95}, {0x12b98, 0x12bb9}, {0x12bbd, 0x12bc8}, {0x12bca, 0x12bd2}, + {0x12bec, 0x12bef}, {0x12c00, 0x12c2e}, {0x12c30, 0x12c5e}, {0x12c60, 0x12cf3}, + {0x12cf9, 0x12d25}, {0x12d30, 0x12d67}, {0x12d7f, 0x12d96}, {0x12da0, 0x12da6}, + {0x12da8, 0x12dae}, {0x12db0, 0x12db6}, {0x12db8, 0x12dbe}, {0x12dc0, 0x12dc6}, + {0x12dc8, 0x12dce}, {0x12dd0, 0x12dd6}, {0x12dd8, 0x12dde}, {0x12de0, 0x12e49}, + {0x12e80, 0x12e99}, {0x12e9b, 0x12ef3}, {0x12f00, 0x12fd5}, {0x12ff0, 0x12ffb}, + {0x13001, 0x1303f}, {0x13041, 0x13096}, {0x13099, 0x130ff}, {0x13105, 0x1312e}, + {0x13131, 0x1318e}, {0x13190, 0x131ba}, {0x131c0, 0x131e3}, {0x131f0, 0x1321e}, + {0x13220, 0x132fe}, {0x13300, 0x14db5}, {0x14dc0, 0x19fea}, {0x1a000, 0x1a48c}, + {0x1a490, 0x1a4c6}, {0x1a4d0, 0x1a62b}, {0x1a640, 0x1a6f7}, {0x1a700, 0x1a7ae}, + {0x1a7b0, 0x1a7b7}, {0x1a7f7, 0x1a82b}, {0x1a830, 0x1a839}, {0x1a840, 0x1a877}, + {0x1a880, 0x1a8c5}, {0x1a8ce, 0x1a8d9}, {0x1a8e0, 0x1a8fd}, {0x1a900, 0x1a953}, + {0x1a95f, 0x1a97c}, {0x1a980, 0x1a9cd}, {0x1a9cf, 0x1a9d9}, {0x1a9de, 0x1a9fe}, + {0x1aa00, 0x1aa36}, {0x1aa40, 0x1aa4d}, {0x1aa50, 0x1aa59}, {0x1aa5c, 0x1aac2}, + {0x1aadb, 0x1aaf6}, {0x1ab01, 0x1ab06}, {0x1ab09, 0x1ab0e}, {0x1ab11, 0x1ab16}, + {0x1ab20, 0x1ab26}, {0x1ab28, 0x1ab2e}, {0x1ab30, 0x1ab65}, {0x1ab70, 0x1abed}, + {0x1abf0, 0x1abf9}, {0x1ac00, 0x1d7a3}, {0x1d7b0, 0x1d7c6}, {0x1d7cb, 0x1d7fb}, + {0x1f900, 0x1fa6d}, {0x1fa70, 0x1fad9}, {0x1fb00, 0x1fb06}, {0x1fb13, 0x1fb17}, + {0x1fb1d, 0x1fb36}, {0x1fb38, 0x1fb3c}, {0x1fb46, 0x1fbc1}, {0x1fbd3, 0x1fd3f}, + {0x1fd50, 0x1fd8f}, {0x1fd92, 0x1fdc7}, {0x1fdf0, 0x1fdfd}, {0x1fe00, 0x1fe19}, + {0x1fe20, 0x1fe52}, {0x1fe54, 0x1fe66}, {0x1fe68, 0x1fe6b}, {0x1fe70, 0x1fe74}, + {0x1fe76, 0x1fefc}, {0x1ff01, 0x1ffbe}, {0x1ffc2, 0x1ffc7}, {0x1ffca, 0x1ffcf}, + {0x1ffd2, 0x1ffd7}, {0x1ffda, 0x1ffdc}, {0x1ffe0, 0x1ffe6}, {0x1ffe8, 0x1ffee}, + {0x20021, 0x2007e}, {0x200a1, 0x200ac}, {0x200ae, 0x20377}, {0x2037a, 0x2037f}, + {0x20384, 0x2038a}, {0x2038e, 0x203a1}, {0x203a3, 0x2052f}, {0x20531, 0x20556}, + {0x20559, 0x2055f}, {0x20561, 0x20587}, {0x2058d, 0x2058f}, {0x20591, 0x205c7}, + {0x205d0, 0x205ea}, {0x205f0, 0x205f4}, {0x20606, 0x2061b}, {0x2061e, 0x206dc}, + {0x206de, 0x2070d}, {0x20710, 0x2074a}, {0x2074d, 0x207b1}, {0x207c0, 0x207fa}, + {0x20800, 0x2082d}, {0x20830, 0x2083e}, {0x20840, 0x2085b}, {0x20860, 0x2086a}, + {0x208a0, 0x208b4}, {0x208b6, 0x208bd}, {0x208d4, 0x208e1}, {0x208e3, 0x20983}, + {0x20985, 0x2098c}, {0x20993, 0x209a8}, {0x209aa, 0x209b0}, {0x209b6, 0x209b9}, + {0x209bc, 0x209c4}, {0x209cb, 0x209ce}, {0x209df, 0x209e3}, {0x209e6, 0x209fd}, + {0x20a01, 0x20a03}, {0x20a05, 0x20a0a}, {0x20a13, 0x20a28}, {0x20a2a, 0x20a30}, + {0x20a3e, 0x20a42}, {0x20a4b, 0x20a4d}, {0x20a59, 0x20a5c}, {0x20a66, 0x20a75}, + {0x20a81, 0x20a83}, {0x20a85, 0x20a8d}, {0x20a8f, 0x20a91}, {0x20a93, 0x20aa8}, + {0x20aaa, 0x20ab0}, {0x20ab5, 0x20ab9}, {0x20abc, 0x20ac5}, {0x20ac7, 0x20ac9}, + {0x20acb, 0x20acd}, {0x20ae0, 0x20ae3}, {0x20ae6, 0x20af1}, {0x20af9, 0x20aff}, + {0x20b01, 0x20b03}, {0x20b05, 0x20b0c}, {0x20b13, 0x20b28}, {0x20b2a, 0x20b30}, + {0x20b35, 0x20b39}, {0x20b3c, 0x20b44}, {0x20b4b, 0x20b4d}, {0x20b5f, 0x20b63}, + {0x20b66, 0x20b77}, {0x20b85, 0x20b8a}, {0x20b8e, 0x20b90}, {0x20b92, 0x20b95}, + {0x20ba8, 0x20baa}, {0x20bae, 0x20bb9}, {0x20bbe, 0x20bc2}, {0x20bc6, 0x20bc8}, + {0x20bca, 0x20bcd}, {0x20be6, 0x20bfa}, {0x20c00, 0x20c03}, {0x20c05, 0x20c0c}, + {0x20c0e, 0x20c10}, {0x20c12, 0x20c28}, {0x20c2a, 0x20c39}, {0x20c3d, 0x20c44}, + {0x20c46, 0x20c48}, {0x20c4a, 0x20c4d}, {0x20c58, 0x20c5a}, {0x20c60, 0x20c63}, + {0x20c66, 0x20c6f}, {0x20c78, 0x20c83}, {0x20c85, 0x20c8c}, {0x20c8e, 0x20c90}, + {0x20c92, 0x20ca8}, {0x20caa, 0x20cb3}, {0x20cb5, 0x20cb9}, {0x20cbc, 0x20cc4}, + {0x20cc6, 0x20cc8}, {0x20cca, 0x20ccd}, {0x20ce0, 0x20ce3}, {0x20ce6, 0x20cef}, + {0x20d00, 0x20d03}, {0x20d05, 0x20d0c}, {0x20d0e, 0x20d10}, {0x20d12, 0x20d44}, + {0x20d46, 0x20d48}, {0x20d4a, 0x20d4f}, {0x20d54, 0x20d63}, {0x20d66, 0x20d7f}, + {0x20d85, 0x20d96}, {0x20d9a, 0x20db1}, {0x20db3, 0x20dbb}, {0x20dc0, 0x20dc6}, + {0x20dcf, 0x20dd4}, {0x20dd8, 0x20ddf}, {0x20de6, 0x20def}, {0x20df2, 0x20df4}, + {0x20e01, 0x20e3a}, {0x20e3f, 0x20e5b}, {0x20e94, 0x20e97}, {0x20e99, 0x20e9f}, + {0x20ea1, 0x20ea3}, {0x20ead, 0x20eb9}, {0x20ebb, 0x20ebd}, {0x20ec0, 0x20ec4}, + {0x20ec8, 0x20ecd}, {0x20ed0, 0x20ed9}, {0x20edc, 0x20edf}, {0x20f00, 0x20f47}, + {0x20f49, 0x20f6c}, {0x20f71, 0x20f97}, {0x20f99, 0x20fbc}, {0x20fbe, 0x20fcc}, + {0x20fce, 0x20fda}, {0x21000, 0x210c5}, {0x210d0, 0x21248}, {0x2124a, 0x2124d}, + {0x21250, 0x21256}, {0x2125a, 0x2125d}, {0x21260, 0x21288}, {0x2128a, 0x2128d}, + {0x21290, 0x212b0}, {0x212b2, 0x212b5}, {0x212b8, 0x212be}, {0x212c2, 0x212c5}, + {0x212c8, 0x212d6}, {0x212d8, 0x21310}, {0x21312, 0x21315}, {0x21318, 0x2135a}, + {0x2135d, 0x2137c}, {0x21380, 0x21399}, {0x213a0, 0x213f5}, {0x213f8, 0x213fd}, + {0x21400, 0x2167f}, {0x21681, 0x2169c}, {0x216a0, 0x216f8}, {0x21700, 0x2170c}, + {0x2170e, 0x21714}, {0x21720, 0x21736}, {0x21740, 0x21753}, {0x21760, 0x2176c}, + {0x2176e, 0x21770}, {0x21780, 0x217dd}, {0x217e0, 0x217e9}, {0x217f0, 0x217f9}, + {0x21800, 0x2180d}, {0x21810, 0x21819}, {0x21820, 0x21877}, {0x21880, 0x218aa}, + {0x218b0, 0x218f5}, {0x21900, 0x2191e}, {0x21920, 0x2192b}, {0x21930, 0x2193b}, + {0x21944, 0x2196d}, {0x21970, 0x21974}, {0x21980, 0x219ab}, {0x219b0, 0x219c9}, + {0x219d0, 0x219da}, {0x219de, 0x21a1b}, {0x21a1e, 0x21a5e}, {0x21a60, 0x21a7c}, + {0x21a7f, 0x21a89}, {0x21a90, 0x21a99}, {0x21aa0, 0x21aad}, {0x21ab0, 0x21abe}, + {0x21b00, 0x21b4b}, {0x21b50, 0x21b7c}, {0x21b80, 0x21bf3}, {0x21bfc, 0x21c37}, + {0x21c3b, 0x21c49}, {0x21c4d, 0x21c88}, {0x21cc0, 0x21cc7}, {0x21cd0, 0x21cf9}, + {0x21d00, 0x21df9}, {0x21dfb, 0x21f15}, {0x21f18, 0x21f1d}, {0x21f20, 0x21f45}, + {0x21f48, 0x21f4d}, {0x21f50, 0x21f57}, {0x21f5f, 0x21f7d}, {0x21f80, 0x21fb4}, + {0x21fb6, 0x21fc4}, {0x21fc6, 0x21fd3}, {0x21fd6, 0x21fdb}, {0x21fdd, 0x21fef}, + {0x21ff2, 0x21ff4}, {0x21ff6, 0x21ffe}, {0x22010, 0x22027}, {0x22030, 0x2205e}, + {0x22074, 0x2208e}, {0x22090, 0x2209c}, {0x220a0, 0x220bf}, {0x220d0, 0x220f0}, + {0x22100, 0x2218b}, {0x22190, 0x22426}, {0x22440, 0x2244a}, {0x22460, 0x22b73}, + {0x22b76, 0x22b95}, {0x22b98, 0x22bb9}, {0x22bbd, 0x22bc8}, {0x22bca, 0x22bd2}, + {0x22bec, 0x22bef}, {0x22c00, 0x22c2e}, {0x22c30, 0x22c5e}, {0x22c60, 0x22cf3}, + {0x22cf9, 0x22d25}, {0x22d30, 0x22d67}, {0x22d7f, 0x22d96}, {0x22da0, 0x22da6}, + {0x22da8, 0x22dae}, {0x22db0, 0x22db6}, {0x22db8, 0x22dbe}, {0x22dc0, 0x22dc6}, + {0x22dc8, 0x22dce}, {0x22dd0, 0x22dd6}, {0x22dd8, 0x22dde}, {0x22de0, 0x22e49}, + {0x22e80, 0x22e99}, {0x22e9b, 0x22ef3}, {0x22f00, 0x22fd5}, {0x22ff0, 0x22ffb}, + {0x23001, 0x2303f}, {0x23041, 0x23096}, {0x23099, 0x230ff}, {0x23105, 0x2312e}, + {0x23131, 0x2318e}, {0x23190, 0x231ba}, {0x231c0, 0x231e3}, {0x231f0, 0x2321e}, + {0x23220, 0x232fe}, {0x23300, 0x24db5}, {0x24dc0, 0x29fea}, {0x2a000, 0x2a48c}, + {0x2a490, 0x2a4c6}, {0x2a4d0, 0x2a62b}, {0x2a640, 0x2a6f7}, {0x2a700, 0x2a7ae}, + {0x2a7b0, 0x2a7b7}, {0x2a7f7, 0x2a82b}, {0x2a830, 0x2a839}, {0x2a840, 0x2a877}, + {0x2a880, 0x2a8c5}, {0x2a8ce, 0x2a8d9}, {0x2a8e0, 0x2a8fd}, {0x2a900, 0x2a953}, + {0x2a95f, 0x2a97c}, {0x2a980, 0x2a9cd}, {0x2a9cf, 0x2a9d9}, {0x2a9de, 0x2a9fe}, + {0x2aa00, 0x2aa36}, {0x2aa40, 0x2aa4d}, {0x2aa50, 0x2aa59}, {0x2aa5c, 0x2aac2}, + {0x2aadb, 0x2aaf6}, {0x2ab01, 0x2ab06}, {0x2ab09, 0x2ab0e}, {0x2ab11, 0x2ab16}, + {0x2ab20, 0x2ab26}, {0x2ab28, 0x2ab2e}, {0x2ab30, 0x2ab65}, {0x2ab70, 0x2abed}, + {0x2abf0, 0x2abf9}, {0x2ac00, 0x2d7a3}, {0x2d7b0, 0x2d7c6}, {0x2d7cb, 0x2d7fb}, + {0x2f900, 0x2fa6d}, {0x2fa70, 0x2fad9}, {0x2fb00, 0x2fb06}, {0x2fb13, 0x2fb17}, + {0x2fb1d, 0x2fb36}, {0x2fb38, 0x2fb3c}, {0x2fb46, 0x2fbc1}, {0x2fbd3, 0x2fd3f}, + {0x2fd50, 0x2fd8f}, {0x2fd92, 0x2fdc7}, {0x2fdf0, 0x2fdfd}, {0x2fe00, 0x2fe19}, + {0x2fe20, 0x2fe52}, {0x2fe54, 0x2fe66}, {0x2fe68, 0x2fe6b}, {0x2fe70, 0x2fe74}, + {0x2fe76, 0x2fefc}, {0x2ff01, 0x2ffbe}, {0x2ffc2, 0x2ffc7}, {0x2ffca, 0x2ffcf}, + {0x2ffd2, 0x2ffd7}, {0x2ffda, 0x2ffdc}, {0x2ffe0, 0x2ffe6}, {0x2ffe8, 0x2ffee}, + {0x30021, 0x3007e}, {0x300a1, 0x300ac}, {0x300ae, 0x30377}, {0x3037a, 0x3037f}, + {0x30384, 0x3038a}, {0x3038e, 0x303a1}, {0x303a3, 0x3052f}, {0x30531, 0x30556}, + {0x30559, 0x3055f}, {0x30561, 0x30587}, {0x3058d, 0x3058f}, {0x30591, 0x305c7}, + {0x305d0, 0x305ea}, {0x305f0, 0x305f4}, {0x30606, 0x3061b}, {0x3061e, 0x306dc}, + {0x306de, 0x3070d}, {0x30710, 0x3074a}, {0x3074d, 0x307b1}, {0x307c0, 0x307fa}, + {0x30800, 0x3082d}, {0x30830, 0x3083e}, {0x30840, 0x3085b}, {0x30860, 0x3086a}, + {0x308a0, 0x308b4}, {0x308b6, 0x308bd}, {0x308d4, 0x308e1}, {0x308e3, 0x30983}, + {0x30985, 0x3098c}, {0x30993, 0x309a8}, {0x309aa, 0x309b0}, {0x309b6, 0x309b9}, + {0x309bc, 0x309c4}, {0x309cb, 0x309ce}, {0x309df, 0x309e3}, {0x309e6, 0x309fd}, + {0x30a01, 0x30a03}, {0x30a05, 0x30a0a}, {0x30a13, 0x30a28}, {0x30a2a, 0x30a30}, + {0x30a3e, 0x30a42}, {0x30a4b, 0x30a4d}, {0x30a59, 0x30a5c}, {0x30a66, 0x30a75}, + {0x30a81, 0x30a83}, {0x30a85, 0x30a8d}, {0x30a8f, 0x30a91}, {0x30a93, 0x30aa8}, + {0x30aaa, 0x30ab0}, {0x30ab5, 0x30ab9}, {0x30abc, 0x30ac5}, {0x30ac7, 0x30ac9}, + {0x30acb, 0x30acd}, {0x30ae0, 0x30ae3}, {0x30ae6, 0x30af1}, {0x30af9, 0x30aff}, + {0x30b01, 0x30b03}, {0x30b05, 0x30b0c}, {0x30b13, 0x30b28}, {0x30b2a, 0x30b30}, + {0x30b35, 0x30b39}, {0x30b3c, 0x30b44}, {0x30b4b, 0x30b4d}, {0x30b5f, 0x30b63}, + {0x30b66, 0x30b77}, {0x30b85, 0x30b8a}, {0x30b8e, 0x30b90}, {0x30b92, 0x30b95}, + {0x30ba8, 0x30baa}, {0x30bae, 0x30bb9}, {0x30bbe, 0x30bc2}, {0x30bc6, 0x30bc8}, + {0x30bca, 0x30bcd}, {0x30be6, 0x30bfa}, {0x30c00, 0x30c03}, {0x30c05, 0x30c0c}, + {0x30c0e, 0x30c10}, {0x30c12, 0x30c28}, {0x30c2a, 0x30c39}, {0x30c3d, 0x30c44}, + {0x30c46, 0x30c48}, {0x30c4a, 0x30c4d}, {0x30c58, 0x30c5a}, {0x30c60, 0x30c63}, + {0x30c66, 0x30c6f}, {0x30c78, 0x30c83}, {0x30c85, 0x30c8c}, {0x30c8e, 0x30c90}, + {0x30c92, 0x30ca8}, {0x30caa, 0x30cb3}, {0x30cb5, 0x30cb9}, {0x30cbc, 0x30cc4}, + {0x30cc6, 0x30cc8}, {0x30cca, 0x30ccd}, {0x30ce0, 0x30ce3}, {0x30ce6, 0x30cef}, + {0x30d00, 0x30d03}, {0x30d05, 0x30d0c}, {0x30d0e, 0x30d10}, {0x30d12, 0x30d44}, + {0x30d46, 0x30d48}, {0x30d4a, 0x30d4f}, {0x30d54, 0x30d63}, {0x30d66, 0x30d7f}, + {0x30d85, 0x30d96}, {0x30d9a, 0x30db1}, {0x30db3, 0x30dbb}, {0x30dc0, 0x30dc6}, + {0x30dcf, 0x30dd4}, {0x30dd8, 0x30ddf}, {0x30de6, 0x30def}, {0x30df2, 0x30df4}, + {0x30e01, 0x30e3a}, {0x30e3f, 0x30e5b}, {0x30e94, 0x30e97}, {0x30e99, 0x30e9f}, + {0x30ea1, 0x30ea3}, {0x30ead, 0x30eb9}, {0x30ebb, 0x30ebd}, {0x30ec0, 0x30ec4}, + {0x30ec8, 0x30ecd}, {0x30ed0, 0x30ed9}, {0x30edc, 0x30edf}, {0x30f00, 0x30f47}, + {0x30f49, 0x30f6c}, {0x30f71, 0x30f97}, {0x30f99, 0x30fbc}, {0x30fbe, 0x30fcc}, + {0x30fce, 0x30fda}, {0x31000, 0x310c5}, {0x310d0, 0x31248}, {0x3124a, 0x3124d}, + {0x31250, 0x31256}, {0x3125a, 0x3125d}, {0x31260, 0x31288}, {0x3128a, 0x3128d}, + {0x31290, 0x312b0}, {0x312b2, 0x312b5}, {0x312b8, 0x312be}, {0x312c2, 0x312c5}, + {0x312c8, 0x312d6}, {0x312d8, 0x31310}, {0x31312, 0x31315}, {0x31318, 0x3135a}, + {0x3135d, 0x3137c}, {0x31380, 0x31399}, {0x313a0, 0x313f5}, {0x313f8, 0x313fd}, + {0x31400, 0x3167f}, {0x31681, 0x3169c}, {0x316a0, 0x316f8}, {0x31700, 0x3170c}, + {0x3170e, 0x31714}, {0x31720, 0x31736}, {0x31740, 0x31753}, {0x31760, 0x3176c}, + {0x3176e, 0x31770}, {0x31780, 0x317dd}, {0x317e0, 0x317e9}, {0x317f0, 0x317f9}, + {0x31800, 0x3180d}, {0x31810, 0x31819}, {0x31820, 0x31877}, {0x31880, 0x318aa}, + {0x318b0, 0x318f5}, {0x31900, 0x3191e}, {0x31920, 0x3192b}, {0x31930, 0x3193b}, + {0x31944, 0x3196d}, {0x31970, 0x31974}, {0x31980, 0x319ab}, {0x319b0, 0x319c9}, + {0x319d0, 0x319da}, {0x319de, 0x31a1b}, {0x31a1e, 0x31a5e}, {0x31a60, 0x31a7c}, + {0x31a7f, 0x31a89}, {0x31a90, 0x31a99}, {0x31aa0, 0x31aad}, {0x31ab0, 0x31abe}, + {0x31b00, 0x31b4b}, {0x31b50, 0x31b7c}, {0x31b80, 0x31bf3}, {0x31bfc, 0x31c37}, + {0x31c3b, 0x31c49}, {0x31c4d, 0x31c88}, {0x31cc0, 0x31cc7}, {0x31cd0, 0x31cf9}, + {0x31d00, 0x31df9}, {0x31dfb, 0x31f15}, {0x31f18, 0x31f1d}, {0x31f20, 0x31f45}, + {0x31f48, 0x31f4d}, {0x31f50, 0x31f57}, {0x31f5f, 0x31f7d}, {0x31f80, 0x31fb4}, + {0x31fb6, 0x31fc4}, {0x31fc6, 0x31fd3}, {0x31fd6, 0x31fdb}, {0x31fdd, 0x31fef}, + {0x31ff2, 0x31ff4}, {0x31ff6, 0x31ffe}, {0x32010, 0x32027}, {0x32030, 0x3205e}, + {0x32074, 0x3208e}, {0x32090, 0x3209c}, {0x320a0, 0x320bf}, {0x320d0, 0x320f0}, + {0x32100, 0x3218b}, {0x32190, 0x32426}, {0x32440, 0x3244a}, {0x32460, 0x32b73}, + {0x32b76, 0x32b95}, {0x32b98, 0x32bb9}, {0x32bbd, 0x32bc8}, {0x32bca, 0x32bd2}, + {0x32bec, 0x32bef}, {0x32c00, 0x32c2e}, {0x32c30, 0x32c5e}, {0x32c60, 0x32cf3}, + {0x32cf9, 0x32d25}, {0x32d30, 0x32d67}, {0x32d7f, 0x32d96}, {0x32da0, 0x32da6}, + {0x32da8, 0x32dae}, {0x32db0, 0x32db6}, {0x32db8, 0x32dbe}, {0x32dc0, 0x32dc6}, + {0x32dc8, 0x32dce}, {0x32dd0, 0x32dd6}, {0x32dd8, 0x32dde}, {0x32de0, 0x32e49}, + {0x32e80, 0x32e99}, {0x32e9b, 0x32ef3}, {0x32f00, 0x32fd5}, {0x32ff0, 0x32ffb}, + {0x33001, 0x3303f}, {0x33041, 0x33096}, {0x33099, 0x330ff}, {0x33105, 0x3312e}, + {0x33131, 0x3318e}, {0x33190, 0x331ba}, {0x331c0, 0x331e3}, {0x331f0, 0x3321e}, + {0x33220, 0x332fe}, {0x33300, 0x34db5}, {0x34dc0, 0x39fea}, {0x3a000, 0x3a48c}, + {0x3a490, 0x3a4c6}, {0x3a4d0, 0x3a62b}, {0x3a640, 0x3a6f7}, {0x3a700, 0x3a7ae}, + {0x3a7b0, 0x3a7b7}, {0x3a7f7, 0x3a82b}, {0x3a830, 0x3a839}, {0x3a840, 0x3a877}, + {0x3a880, 0x3a8c5}, {0x3a8ce, 0x3a8d9}, {0x3a8e0, 0x3a8fd}, {0x3a900, 0x3a953}, + {0x3a95f, 0x3a97c}, {0x3a980, 0x3a9cd}, {0x3a9cf, 0x3a9d9}, {0x3a9de, 0x3a9fe}, + {0x3aa00, 0x3aa36}, {0x3aa40, 0x3aa4d}, {0x3aa50, 0x3aa59}, {0x3aa5c, 0x3aac2}, + {0x3aadb, 0x3aaf6}, {0x3ab01, 0x3ab06}, {0x3ab09, 0x3ab0e}, {0x3ab11, 0x3ab16}, + {0x3ab20, 0x3ab26}, {0x3ab28, 0x3ab2e}, {0x3ab30, 0x3ab65}, {0x3ab70, 0x3abed}, + {0x3abf0, 0x3abf9}, {0x3ac00, 0x3d7a3}, {0x3d7b0, 0x3d7c6}, {0x3d7cb, 0x3d7fb}, + {0x3f900, 0x3fa6d}, {0x3fa70, 0x3fad9}, {0x3fb00, 0x3fb06}, {0x3fb13, 0x3fb17}, + {0x3fb1d, 0x3fb36}, {0x3fb38, 0x3fb3c}, {0x3fb46, 0x3fbc1}, {0x3fbd3, 0x3fd3f}, + {0x3fd50, 0x3fd8f}, {0x3fd92, 0x3fdc7}, {0x3fdf0, 0x3fdfd}, {0x3fe00, 0x3fe19}, + {0x3fe20, 0x3fe52}, {0x3fe54, 0x3fe66}, {0x3fe68, 0x3fe6b}, {0x3fe70, 0x3fe74}, + {0x3fe76, 0x3fefc}, {0x3ff01, 0x3ffbe}, {0x3ffc2, 0x3ffc7}, {0x3ffca, 0x3ffcf}, + {0x3ffd2, 0x3ffd7}, {0x3ffda, 0x3ffdc}, {0x3ffe0, 0x3ffe6}, {0x3ffe8, 0x3ffee}, + {0x40021, 0x4007e}, {0x400a1, 0x400ac}, {0x400ae, 0x40377}, {0x4037a, 0x4037f}, + {0x40384, 0x4038a}, {0x4038e, 0x403a1}, {0x403a3, 0x4052f}, {0x40531, 0x40556}, + {0x40559, 0x4055f}, {0x40561, 0x40587}, {0x4058d, 0x4058f}, {0x40591, 0x405c7}, + {0x405d0, 0x405ea}, {0x405f0, 0x405f4}, {0x40606, 0x4061b}, {0x4061e, 0x406dc}, + {0x406de, 0x4070d}, {0x40710, 0x4074a}, {0x4074d, 0x407b1}, {0x407c0, 0x407fa}, + {0x40800, 0x4082d}, {0x40830, 0x4083e}, {0x40840, 0x4085b}, {0x40860, 0x4086a}, + {0x408a0, 0x408b4}, {0x408b6, 0x408bd}, {0x408d4, 0x408e1}, {0x408e3, 0x40983}, + {0x40985, 0x4098c}, {0x40993, 0x409a8}, {0x409aa, 0x409b0}, {0x409b6, 0x409b9}, + {0x409bc, 0x409c4}, {0x409cb, 0x409ce}, {0x409df, 0x409e3}, {0x409e6, 0x409fd}, + {0x40a01, 0x40a03}, {0x40a05, 0x40a0a}, {0x40a13, 0x40a28}, {0x40a2a, 0x40a30}, + {0x40a3e, 0x40a42}, {0x40a4b, 0x40a4d}, {0x40a59, 0x40a5c}, {0x40a66, 0x40a75}, + {0x40a81, 0x40a83}, {0x40a85, 0x40a8d}, {0x40a8f, 0x40a91}, {0x40a93, 0x40aa8}, + {0x40aaa, 0x40ab0}, {0x40ab5, 0x40ab9}, {0x40abc, 0x40ac5}, {0x40ac7, 0x40ac9}, + {0x40acb, 0x40acd}, {0x40ae0, 0x40ae3}, {0x40ae6, 0x40af1}, {0x40af9, 0x40aff}, + {0x40b01, 0x40b03}, {0x40b05, 0x40b0c}, {0x40b13, 0x40b28}, {0x40b2a, 0x40b30}, + {0x40b35, 0x40b39}, {0x40b3c, 0x40b44}, {0x40b4b, 0x40b4d}, {0x40b5f, 0x40b63}, + {0x40b66, 0x40b77}, {0x40b85, 0x40b8a}, {0x40b8e, 0x40b90}, {0x40b92, 0x40b95}, + {0x40ba8, 0x40baa}, {0x40bae, 0x40bb9}, {0x40bbe, 0x40bc2}, {0x40bc6, 0x40bc8}, + {0x40bca, 0x40bcd}, {0x40be6, 0x40bfa}, {0x40c00, 0x40c03}, {0x40c05, 0x40c0c}, + {0x40c0e, 0x40c10}, {0x40c12, 0x40c28}, {0x40c2a, 0x40c39}, {0x40c3d, 0x40c44}, + {0x40c46, 0x40c48}, {0x40c4a, 0x40c4d}, {0x40c58, 0x40c5a}, {0x40c60, 0x40c63}, + {0x40c66, 0x40c6f}, {0x40c78, 0x40c83}, {0x40c85, 0x40c8c}, {0x40c8e, 0x40c90}, + {0x40c92, 0x40ca8}, {0x40caa, 0x40cb3}, {0x40cb5, 0x40cb9}, {0x40cbc, 0x40cc4}, + {0x40cc6, 0x40cc8}, {0x40cca, 0x40ccd}, {0x40ce0, 0x40ce3}, {0x40ce6, 0x40cef}, + {0x40d00, 0x40d03}, {0x40d05, 0x40d0c}, {0x40d0e, 0x40d10}, {0x40d12, 0x40d44}, + {0x40d46, 0x40d48}, {0x40d4a, 0x40d4f}, {0x40d54, 0x40d63}, {0x40d66, 0x40d7f}, + {0x40d85, 0x40d96}, {0x40d9a, 0x40db1}, {0x40db3, 0x40dbb}, {0x40dc0, 0x40dc6}, + {0x40dcf, 0x40dd4}, {0x40dd8, 0x40ddf}, {0x40de6, 0x40def}, {0x40df2, 0x40df4}, + {0x40e01, 0x40e3a}, {0x40e3f, 0x40e5b}, {0x40e94, 0x40e97}, {0x40e99, 0x40e9f}, + {0x40ea1, 0x40ea3}, {0x40ead, 0x40eb9}, {0x40ebb, 0x40ebd}, {0x40ec0, 0x40ec4}, + {0x40ec8, 0x40ecd}, {0x40ed0, 0x40ed9}, {0x40edc, 0x40edf}, {0x40f00, 0x40f47}, + {0x40f49, 0x40f6c}, {0x40f71, 0x40f97}, {0x40f99, 0x40fbc}, {0x40fbe, 0x40fcc}, + {0x40fce, 0x40fda}, {0x41000, 0x410c5}, {0x410d0, 0x41248}, {0x4124a, 0x4124d}, + {0x41250, 0x41256}, {0x4125a, 0x4125d}, {0x41260, 0x41288}, {0x4128a, 0x4128d}, + {0x41290, 0x412b0}, {0x412b2, 0x412b5}, {0x412b8, 0x412be}, {0x412c2, 0x412c5}, + {0x412c8, 0x412d6}, {0x412d8, 0x41310}, {0x41312, 0x41315}, {0x41318, 0x4135a}, + {0x4135d, 0x4137c}, {0x41380, 0x41399}, {0x413a0, 0x413f5}, {0x413f8, 0x413fd}, + {0x41400, 0x4167f}, {0x41681, 0x4169c}, {0x416a0, 0x416f8}, {0x41700, 0x4170c}, + {0x4170e, 0x41714}, {0x41720, 0x41736}, {0x41740, 0x41753}, {0x41760, 0x4176c}, + {0x4176e, 0x41770}, {0x41780, 0x417dd}, {0x417e0, 0x417e9}, {0x417f0, 0x417f9}, + {0x41800, 0x4180d}, {0x41810, 0x41819}, {0x41820, 0x41877}, {0x41880, 0x418aa}, + {0x418b0, 0x418f5}, {0x41900, 0x4191e}, {0x41920, 0x4192b}, {0x41930, 0x4193b}, + {0x41944, 0x4196d}, {0x41970, 0x41974}, {0x41980, 0x419ab}, {0x419b0, 0x419c9}, + {0x419d0, 0x419da}, {0x419de, 0x41a1b}, {0x41a1e, 0x41a5e}, {0x41a60, 0x41a7c}, + {0x41a7f, 0x41a89}, {0x41a90, 0x41a99}, {0x41aa0, 0x41aad}, {0x41ab0, 0x41abe}, + {0x41b00, 0x41b4b}, {0x41b50, 0x41b7c}, {0x41b80, 0x41bf3}, {0x41bfc, 0x41c37}, + {0x41c3b, 0x41c49}, {0x41c4d, 0x41c88}, {0x41cc0, 0x41cc7}, {0x41cd0, 0x41cf9}, + {0x41d00, 0x41df9}, {0x41dfb, 0x41f15}, {0x41f18, 0x41f1d}, {0x41f20, 0x41f45}, + {0x41f48, 0x41f4d}, {0x41f50, 0x41f57}, {0x41f5f, 0x41f7d}, {0x41f80, 0x41fb4}, + {0x41fb6, 0x41fc4}, {0x41fc6, 0x41fd3}, {0x41fd6, 0x41fdb}, {0x41fdd, 0x41fef}, + {0x41ff2, 0x41ff4}, {0x41ff6, 0x41ffe}, {0x42010, 0x42027}, {0x42030, 0x4205e}, + {0x42074, 0x4208e}, {0x42090, 0x4209c}, {0x420a0, 0x420bf}, {0x420d0, 0x420f0}, + {0x42100, 0x4218b}, {0x42190, 0x42426}, {0x42440, 0x4244a}, {0x42460, 0x42b73}, + {0x42b76, 0x42b95}, {0x42b98, 0x42bb9}, {0x42bbd, 0x42bc8}, {0x42bca, 0x42bd2}, + {0x42bec, 0x42bef}, {0x42c00, 0x42c2e}, {0x42c30, 0x42c5e}, {0x42c60, 0x42cf3}, + {0x42cf9, 0x42d25}, {0x42d30, 0x42d67}, {0x42d7f, 0x42d96}, {0x42da0, 0x42da6}, + {0x42da8, 0x42dae}, {0x42db0, 0x42db6}, {0x42db8, 0x42dbe}, {0x42dc0, 0x42dc6}, + {0x42dc8, 0x42dce}, {0x42dd0, 0x42dd6}, {0x42dd8, 0x42dde}, {0x42de0, 0x42e49}, + {0x42e80, 0x42e99}, {0x42e9b, 0x42ef3}, {0x42f00, 0x42fd5}, {0x42ff0, 0x42ffb}, + {0x43001, 0x4303f}, {0x43041, 0x43096}, {0x43099, 0x430ff}, {0x43105, 0x4312e}, + {0x43131, 0x4318e}, {0x43190, 0x431ba}, {0x431c0, 0x431e3}, {0x431f0, 0x4321e}, + {0x43220, 0x432fe}, {0x43300, 0x44db5}, {0x44dc0, 0x49fea}, {0x4a000, 0x4a48c}, + {0x4a490, 0x4a4c6}, {0x4a4d0, 0x4a62b}, {0x4a640, 0x4a6f7}, {0x4a700, 0x4a7ae}, + {0x4a7b0, 0x4a7b7}, {0x4a7f7, 0x4a82b}, {0x4a830, 0x4a839}, {0x4a840, 0x4a877}, + {0x4a880, 0x4a8c5}, {0x4a8ce, 0x4a8d9}, {0x4a8e0, 0x4a8fd}, {0x4a900, 0x4a953}, + {0x4a95f, 0x4a97c}, {0x4a980, 0x4a9cd}, {0x4a9cf, 0x4a9d9}, {0x4a9de, 0x4a9fe}, + {0x4aa00, 0x4aa36}, {0x4aa40, 0x4aa4d}, {0x4aa50, 0x4aa59}, {0x4aa5c, 0x4aac2}, + {0x4aadb, 0x4aaf6}, {0x4ab01, 0x4ab06}, {0x4ab09, 0x4ab0e}, {0x4ab11, 0x4ab16}, + {0x4ab20, 0x4ab26}, {0x4ab28, 0x4ab2e}, {0x4ab30, 0x4ab65}, {0x4ab70, 0x4abed}, + {0x4abf0, 0x4abf9}, {0x4ac00, 0x4d7a3}, {0x4d7b0, 0x4d7c6}, {0x4d7cb, 0x4d7fb}, + {0x4f900, 0x4fa6d}, {0x4fa70, 0x4fad9}, {0x4fb00, 0x4fb06}, {0x4fb13, 0x4fb17}, + {0x4fb1d, 0x4fb36}, {0x4fb38, 0x4fb3c}, {0x4fb46, 0x4fbc1}, {0x4fbd3, 0x4fd3f}, + {0x4fd50, 0x4fd8f}, {0x4fd92, 0x4fdc7}, {0x4fdf0, 0x4fdfd}, {0x4fe00, 0x4fe19}, + {0x4fe20, 0x4fe52}, {0x4fe54, 0x4fe66}, {0x4fe68, 0x4fe6b}, {0x4fe70, 0x4fe74}, + {0x4fe76, 0x4fefc}, {0x4ff01, 0x4ffbe}, {0x4ffc2, 0x4ffc7}, {0x4ffca, 0x4ffcf}, + {0x4ffd2, 0x4ffd7}, {0x4ffda, 0x4ffdc}, {0x4ffe0, 0x4ffe6}, {0x4ffe8, 0x4ffee}, + {0x50021, 0x5007e}, {0x500a1, 0x500ac}, {0x500ae, 0x50377}, {0x5037a, 0x5037f}, + {0x50384, 0x5038a}, {0x5038e, 0x503a1}, {0x503a3, 0x5052f}, {0x50531, 0x50556}, + {0x50559, 0x5055f}, {0x50561, 0x50587}, {0x5058d, 0x5058f}, {0x50591, 0x505c7}, + {0x505d0, 0x505ea}, {0x505f0, 0x505f4}, {0x50606, 0x5061b}, {0x5061e, 0x506dc}, + {0x506de, 0x5070d}, {0x50710, 0x5074a}, {0x5074d, 0x507b1}, {0x507c0, 0x507fa}, + {0x50800, 0x5082d}, {0x50830, 0x5083e}, {0x50840, 0x5085b}, {0x50860, 0x5086a}, + {0x508a0, 0x508b4}, {0x508b6, 0x508bd}, {0x508d4, 0x508e1}, {0x508e3, 0x50983}, + {0x50985, 0x5098c}, {0x50993, 0x509a8}, {0x509aa, 0x509b0}, {0x509b6, 0x509b9}, + {0x509bc, 0x509c4}, {0x509cb, 0x509ce}, {0x509df, 0x509e3}, {0x509e6, 0x509fd}, + {0x50a01, 0x50a03}, {0x50a05, 0x50a0a}, {0x50a13, 0x50a28}, {0x50a2a, 0x50a30}, + {0x50a3e, 0x50a42}, {0x50a4b, 0x50a4d}, {0x50a59, 0x50a5c}, {0x50a66, 0x50a75}, + {0x50a81, 0x50a83}, {0x50a85, 0x50a8d}, {0x50a8f, 0x50a91}, {0x50a93, 0x50aa8}, + {0x50aaa, 0x50ab0}, {0x50ab5, 0x50ab9}, {0x50abc, 0x50ac5}, {0x50ac7, 0x50ac9}, + {0x50acb, 0x50acd}, {0x50ae0, 0x50ae3}, {0x50ae6, 0x50af1}, {0x50af9, 0x50aff}, + {0x50b01, 0x50b03}, {0x50b05, 0x50b0c}, {0x50b13, 0x50b28}, {0x50b2a, 0x50b30}, + {0x50b35, 0x50b39}, {0x50b3c, 0x50b44}, {0x50b4b, 0x50b4d}, {0x50b5f, 0x50b63}, + {0x50b66, 0x50b77}, {0x50b85, 0x50b8a}, {0x50b8e, 0x50b90}, {0x50b92, 0x50b95}, + {0x50ba8, 0x50baa}, {0x50bae, 0x50bb9}, {0x50bbe, 0x50bc2}, {0x50bc6, 0x50bc8}, + {0x50bca, 0x50bcd}, {0x50be6, 0x50bfa}, {0x50c00, 0x50c03}, {0x50c05, 0x50c0c}, + {0x50c0e, 0x50c10}, {0x50c12, 0x50c28}, {0x50c2a, 0x50c39}, {0x50c3d, 0x50c44}, + {0x50c46, 0x50c48}, {0x50c4a, 0x50c4d}, {0x50c58, 0x50c5a}, {0x50c60, 0x50c63}, + {0x50c66, 0x50c6f}, {0x50c78, 0x50c83}, {0x50c85, 0x50c8c}, {0x50c8e, 0x50c90}, + {0x50c92, 0x50ca8}, {0x50caa, 0x50cb3}, {0x50cb5, 0x50cb9}, {0x50cbc, 0x50cc4}, + {0x50cc6, 0x50cc8}, {0x50cca, 0x50ccd}, {0x50ce0, 0x50ce3}, {0x50ce6, 0x50cef}, + {0x50d00, 0x50d03}, {0x50d05, 0x50d0c}, {0x50d0e, 0x50d10}, {0x50d12, 0x50d44}, + {0x50d46, 0x50d48}, {0x50d4a, 0x50d4f}, {0x50d54, 0x50d63}, {0x50d66, 0x50d7f}, + {0x50d85, 0x50d96}, {0x50d9a, 0x50db1}, {0x50db3, 0x50dbb}, {0x50dc0, 0x50dc6}, + {0x50dcf, 0x50dd4}, {0x50dd8, 0x50ddf}, {0x50de6, 0x50def}, {0x50df2, 0x50df4}, + {0x50e01, 0x50e3a}, {0x50e3f, 0x50e5b}, {0x50e94, 0x50e97}, {0x50e99, 0x50e9f}, + {0x50ea1, 0x50ea3}, {0x50ead, 0x50eb9}, {0x50ebb, 0x50ebd}, {0x50ec0, 0x50ec4}, + {0x50ec8, 0x50ecd}, {0x50ed0, 0x50ed9}, {0x50edc, 0x50edf}, {0x50f00, 0x50f47}, + {0x50f49, 0x50f6c}, {0x50f71, 0x50f97}, {0x50f99, 0x50fbc}, {0x50fbe, 0x50fcc}, + {0x50fce, 0x50fda}, {0x51000, 0x510c5}, {0x510d0, 0x51248}, {0x5124a, 0x5124d}, + {0x51250, 0x51256}, {0x5125a, 0x5125d}, {0x51260, 0x51288}, {0x5128a, 0x5128d}, + {0x51290, 0x512b0}, {0x512b2, 0x512b5}, {0x512b8, 0x512be}, {0x512c2, 0x512c5}, + {0x512c8, 0x512d6}, {0x512d8, 0x51310}, {0x51312, 0x51315}, {0x51318, 0x5135a}, + {0x5135d, 0x5137c}, {0x51380, 0x51399}, {0x513a0, 0x513f5}, {0x513f8, 0x513fd}, + {0x51400, 0x5167f}, {0x51681, 0x5169c}, {0x516a0, 0x516f8}, {0x51700, 0x5170c}, + {0x5170e, 0x51714}, {0x51720, 0x51736}, {0x51740, 0x51753}, {0x51760, 0x5176c}, + {0x5176e, 0x51770}, {0x51780, 0x517dd}, {0x517e0, 0x517e9}, {0x517f0, 0x517f9}, + {0x51800, 0x5180d}, {0x51810, 0x51819}, {0x51820, 0x51877}, {0x51880, 0x518aa}, + {0x518b0, 0x518f5}, {0x51900, 0x5191e}, {0x51920, 0x5192b}, {0x51930, 0x5193b}, + {0x51944, 0x5196d}, {0x51970, 0x51974}, {0x51980, 0x519ab}, {0x519b0, 0x519c9}, + {0x519d0, 0x519da}, {0x519de, 0x51a1b}, {0x51a1e, 0x51a5e}, {0x51a60, 0x51a7c}, + {0x51a7f, 0x51a89}, {0x51a90, 0x51a99}, {0x51aa0, 0x51aad}, {0x51ab0, 0x51abe}, + {0x51b00, 0x51b4b}, {0x51b50, 0x51b7c}, {0x51b80, 0x51bf3}, {0x51bfc, 0x51c37}, + {0x51c3b, 0x51c49}, {0x51c4d, 0x51c88}, {0x51cc0, 0x51cc7}, {0x51cd0, 0x51cf9}, + {0x51d00, 0x51df9}, {0x51dfb, 0x51f15}, {0x51f18, 0x51f1d}, {0x51f20, 0x51f45}, + {0x51f48, 0x51f4d}, {0x51f50, 0x51f57}, {0x51f5f, 0x51f7d}, {0x51f80, 0x51fb4}, + {0x51fb6, 0x51fc4}, {0x51fc6, 0x51fd3}, {0x51fd6, 0x51fdb}, {0x51fdd, 0x51fef}, + {0x51ff2, 0x51ff4}, {0x51ff6, 0x51ffe}, {0x52010, 0x52027}, {0x52030, 0x5205e}, + {0x52074, 0x5208e}, {0x52090, 0x5209c}, {0x520a0, 0x520bf}, {0x520d0, 0x520f0}, + {0x52100, 0x5218b}, {0x52190, 0x52426}, {0x52440, 0x5244a}, {0x52460, 0x52b73}, + {0x52b76, 0x52b95}, {0x52b98, 0x52bb9}, {0x52bbd, 0x52bc8}, {0x52bca, 0x52bd2}, + {0x52bec, 0x52bef}, {0x52c00, 0x52c2e}, {0x52c30, 0x52c5e}, {0x52c60, 0x52cf3}, + {0x52cf9, 0x52d25}, {0x52d30, 0x52d67}, {0x52d7f, 0x52d96}, {0x52da0, 0x52da6}, + {0x52da8, 0x52dae}, {0x52db0, 0x52db6}, {0x52db8, 0x52dbe}, {0x52dc0, 0x52dc6}, + {0x52dc8, 0x52dce}, {0x52dd0, 0x52dd6}, {0x52dd8, 0x52dde}, {0x52de0, 0x52e49}, + {0x52e80, 0x52e99}, {0x52e9b, 0x52ef3}, {0x52f00, 0x52fd5}, {0x52ff0, 0x52ffb}, + {0x53001, 0x5303f}, {0x53041, 0x53096}, {0x53099, 0x530ff}, {0x53105, 0x5312e}, + {0x53131, 0x5318e}, {0x53190, 0x531ba}, {0x531c0, 0x531e3}, {0x531f0, 0x5321e}, + {0x53220, 0x532fe}, {0x53300, 0x54db5}, {0x54dc0, 0x59fea}, {0x5a000, 0x5a48c}, + {0x5a490, 0x5a4c6}, {0x5a4d0, 0x5a62b}, {0x5a640, 0x5a6f7}, {0x5a700, 0x5a7ae}, + {0x5a7b0, 0x5a7b7}, {0x5a7f7, 0x5a82b}, {0x5a830, 0x5a839}, {0x5a840, 0x5a877}, + {0x5a880, 0x5a8c5}, {0x5a8ce, 0x5a8d9}, {0x5a8e0, 0x5a8fd}, {0x5a900, 0x5a953}, + {0x5a95f, 0x5a97c}, {0x5a980, 0x5a9cd}, {0x5a9cf, 0x5a9d9}, {0x5a9de, 0x5a9fe}, + {0x5aa00, 0x5aa36}, {0x5aa40, 0x5aa4d}, {0x5aa50, 0x5aa59}, {0x5aa5c, 0x5aac2}, + {0x5aadb, 0x5aaf6}, {0x5ab01, 0x5ab06}, {0x5ab09, 0x5ab0e}, {0x5ab11, 0x5ab16}, + {0x5ab20, 0x5ab26}, {0x5ab28, 0x5ab2e}, {0x5ab30, 0x5ab65}, {0x5ab70, 0x5abed}, + {0x5abf0, 0x5abf9}, {0x5ac00, 0x5d7a3}, {0x5d7b0, 0x5d7c6}, {0x5d7cb, 0x5d7fb}, + {0x5f900, 0x5fa6d}, {0x5fa70, 0x5fad9}, {0x5fb00, 0x5fb06}, {0x5fb13, 0x5fb17}, + {0x5fb1d, 0x5fb36}, {0x5fb38, 0x5fb3c}, {0x5fb46, 0x5fbc1}, {0x5fbd3, 0x5fd3f}, + {0x5fd50, 0x5fd8f}, {0x5fd92, 0x5fdc7}, {0x5fdf0, 0x5fdfd}, {0x5fe00, 0x5fe19}, + {0x5fe20, 0x5fe52}, {0x5fe54, 0x5fe66}, {0x5fe68, 0x5fe6b}, {0x5fe70, 0x5fe74}, + {0x5fe76, 0x5fefc}, {0x5ff01, 0x5ffbe}, {0x5ffc2, 0x5ffc7}, {0x5ffca, 0x5ffcf}, + {0x5ffd2, 0x5ffd7}, {0x5ffda, 0x5ffdc}, {0x5ffe0, 0x5ffe6}, {0x5ffe8, 0x5ffee}, + {0x60021, 0x6007e}, {0x600a1, 0x600ac}, {0x600ae, 0x60377}, {0x6037a, 0x6037f}, + {0x60384, 0x6038a}, {0x6038e, 0x603a1}, {0x603a3, 0x6052f}, {0x60531, 0x60556}, + {0x60559, 0x6055f}, {0x60561, 0x60587}, {0x6058d, 0x6058f}, {0x60591, 0x605c7}, + {0x605d0, 0x605ea}, {0x605f0, 0x605f4}, {0x60606, 0x6061b}, {0x6061e, 0x606dc}, + {0x606de, 0x6070d}, {0x60710, 0x6074a}, {0x6074d, 0x607b1}, {0x607c0, 0x607fa}, + {0x60800, 0x6082d}, {0x60830, 0x6083e}, {0x60840, 0x6085b}, {0x60860, 0x6086a}, + {0x608a0, 0x608b4}, {0x608b6, 0x608bd}, {0x608d4, 0x608e1}, {0x608e3, 0x60983}, + {0x60985, 0x6098c}, {0x60993, 0x609a8}, {0x609aa, 0x609b0}, {0x609b6, 0x609b9}, + {0x609bc, 0x609c4}, {0x609cb, 0x609ce}, {0x609df, 0x609e3}, {0x609e6, 0x609fd}, + {0x60a01, 0x60a03}, {0x60a05, 0x60a0a}, {0x60a13, 0x60a28}, {0x60a2a, 0x60a30}, + {0x60a3e, 0x60a42}, {0x60a4b, 0x60a4d}, {0x60a59, 0x60a5c}, {0x60a66, 0x60a75}, + {0x60a81, 0x60a83}, {0x60a85, 0x60a8d}, {0x60a8f, 0x60a91}, {0x60a93, 0x60aa8}, + {0x60aaa, 0x60ab0}, {0x60ab5, 0x60ab9}, {0x60abc, 0x60ac5}, {0x60ac7, 0x60ac9}, + {0x60acb, 0x60acd}, {0x60ae0, 0x60ae3}, {0x60ae6, 0x60af1}, {0x60af9, 0x60aff}, + {0x60b01, 0x60b03}, {0x60b05, 0x60b0c}, {0x60b13, 0x60b28}, {0x60b2a, 0x60b30}, + {0x60b35, 0x60b39}, {0x60b3c, 0x60b44}, {0x60b4b, 0x60b4d}, {0x60b5f, 0x60b63}, + {0x60b66, 0x60b77}, {0x60b85, 0x60b8a}, {0x60b8e, 0x60b90}, {0x60b92, 0x60b95}, + {0x60ba8, 0x60baa}, {0x60bae, 0x60bb9}, {0x60bbe, 0x60bc2}, {0x60bc6, 0x60bc8}, + {0x60bca, 0x60bcd}, {0x60be6, 0x60bfa}, {0x60c00, 0x60c03}, {0x60c05, 0x60c0c}, + {0x60c0e, 0x60c10}, {0x60c12, 0x60c28}, {0x60c2a, 0x60c39}, {0x60c3d, 0x60c44}, + {0x60c46, 0x60c48}, {0x60c4a, 0x60c4d}, {0x60c58, 0x60c5a}, {0x60c60, 0x60c63}, + {0x60c66, 0x60c6f}, {0x60c78, 0x60c83}, {0x60c85, 0x60c8c}, {0x60c8e, 0x60c90}, + {0x60c92, 0x60ca8}, {0x60caa, 0x60cb3}, {0x60cb5, 0x60cb9}, {0x60cbc, 0x60cc4}, + {0x60cc6, 0x60cc8}, {0x60cca, 0x60ccd}, {0x60ce0, 0x60ce3}, {0x60ce6, 0x60cef}, + {0x60d00, 0x60d03}, {0x60d05, 0x60d0c}, {0x60d0e, 0x60d10}, {0x60d12, 0x60d44}, + {0x60d46, 0x60d48}, {0x60d4a, 0x60d4f}, {0x60d54, 0x60d63}, {0x60d66, 0x60d7f}, + {0x60d85, 0x60d96}, {0x60d9a, 0x60db1}, {0x60db3, 0x60dbb}, {0x60dc0, 0x60dc6}, + {0x60dcf, 0x60dd4}, {0x60dd8, 0x60ddf}, {0x60de6, 0x60def}, {0x60df2, 0x60df4}, + {0x60e01, 0x60e3a}, {0x60e3f, 0x60e5b}, {0x60e94, 0x60e97}, {0x60e99, 0x60e9f}, + {0x60ea1, 0x60ea3}, {0x60ead, 0x60eb9}, {0x60ebb, 0x60ebd}, {0x60ec0, 0x60ec4}, + {0x60ec8, 0x60ecd}, {0x60ed0, 0x60ed9}, {0x60edc, 0x60edf}, {0x60f00, 0x60f47}, + {0x60f49, 0x60f6c}, {0x60f71, 0x60f97}, {0x60f99, 0x60fbc}, {0x60fbe, 0x60fcc}, + {0x60fce, 0x60fda}, {0x61000, 0x610c5}, {0x610d0, 0x61248}, {0x6124a, 0x6124d}, + {0x61250, 0x61256}, {0x6125a, 0x6125d}, {0x61260, 0x61288}, {0x6128a, 0x6128d}, + {0x61290, 0x612b0}, {0x612b2, 0x612b5}, {0x612b8, 0x612be}, {0x612c2, 0x612c5}, + {0x612c8, 0x612d6}, {0x612d8, 0x61310}, {0x61312, 0x61315}, {0x61318, 0x6135a}, + {0x6135d, 0x6137c}, {0x61380, 0x61399}, {0x613a0, 0x613f5}, {0x613f8, 0x613fd}, + {0x61400, 0x6167f}, {0x61681, 0x6169c}, {0x616a0, 0x616f8}, {0x61700, 0x6170c}, + {0x6170e, 0x61714}, {0x61720, 0x61736}, {0x61740, 0x61753}, {0x61760, 0x6176c}, + {0x6176e, 0x61770}, {0x61780, 0x617dd}, {0x617e0, 0x617e9}, {0x617f0, 0x617f9}, + {0x61800, 0x6180d}, {0x61810, 0x61819}, {0x61820, 0x61877}, {0x61880, 0x618aa}, + {0x618b0, 0x618f5}, {0x61900, 0x6191e}, {0x61920, 0x6192b}, {0x61930, 0x6193b}, + {0x61944, 0x6196d}, {0x61970, 0x61974}, {0x61980, 0x619ab}, {0x619b0, 0x619c9}, + {0x619d0, 0x619da}, {0x619de, 0x61a1b}, {0x61a1e, 0x61a5e}, {0x61a60, 0x61a7c}, + {0x61a7f, 0x61a89}, {0x61a90, 0x61a99}, {0x61aa0, 0x61aad}, {0x61ab0, 0x61abe}, + {0x61b00, 0x61b4b}, {0x61b50, 0x61b7c}, {0x61b80, 0x61bf3}, {0x61bfc, 0x61c37}, + {0x61c3b, 0x61c49}, {0x61c4d, 0x61c88}, {0x61cc0, 0x61cc7}, {0x61cd0, 0x61cf9}, + {0x61d00, 0x61df9}, {0x61dfb, 0x61f15}, {0x61f18, 0x61f1d}, {0x61f20, 0x61f45}, + {0x61f48, 0x61f4d}, {0x61f50, 0x61f57}, {0x61f5f, 0x61f7d}, {0x61f80, 0x61fb4}, + {0x61fb6, 0x61fc4}, {0x61fc6, 0x61fd3}, {0x61fd6, 0x61fdb}, {0x61fdd, 0x61fef}, + {0x61ff2, 0x61ff4}, {0x61ff6, 0x61ffe}, {0x62010, 0x62027}, {0x62030, 0x6205e}, + {0x62074, 0x6208e}, {0x62090, 0x6209c}, {0x620a0, 0x620bf}, {0x620d0, 0x620f0}, + {0x62100, 0x6218b}, {0x62190, 0x62426}, {0x62440, 0x6244a}, {0x62460, 0x62b73}, + {0x62b76, 0x62b95}, {0x62b98, 0x62bb9}, {0x62bbd, 0x62bc8}, {0x62bca, 0x62bd2}, + {0x62bec, 0x62bef}, {0x62c00, 0x62c2e}, {0x62c30, 0x62c5e}, {0x62c60, 0x62cf3}, + {0x62cf9, 0x62d25}, {0x62d30, 0x62d67}, {0x62d7f, 0x62d96}, {0x62da0, 0x62da6}, + {0x62da8, 0x62dae}, {0x62db0, 0x62db6}, {0x62db8, 0x62dbe}, {0x62dc0, 0x62dc6}, + {0x62dc8, 0x62dce}, {0x62dd0, 0x62dd6}, {0x62dd8, 0x62dde}, {0x62de0, 0x62e49}, + {0x62e80, 0x62e99}, {0x62e9b, 0x62ef3}, {0x62f00, 0x62fd5}, {0x62ff0, 0x62ffb}, + {0x63001, 0x6303f}, {0x63041, 0x63096}, {0x63099, 0x630ff}, {0x63105, 0x6312e}, + {0x63131, 0x6318e}, {0x63190, 0x631ba}, {0x631c0, 0x631e3}, {0x631f0, 0x6321e}, + {0x63220, 0x632fe}, {0x63300, 0x64db5}, {0x64dc0, 0x69fea}, {0x6a000, 0x6a48c}, + {0x6a490, 0x6a4c6}, {0x6a4d0, 0x6a62b}, {0x6a640, 0x6a6f7}, {0x6a700, 0x6a7ae}, + {0x6a7b0, 0x6a7b7}, {0x6a7f7, 0x6a82b}, {0x6a830, 0x6a839}, {0x6a840, 0x6a877}, + {0x6a880, 0x6a8c5}, {0x6a8ce, 0x6a8d9}, {0x6a8e0, 0x6a8fd}, {0x6a900, 0x6a953}, + {0x6a95f, 0x6a97c}, {0x6a980, 0x6a9cd}, {0x6a9cf, 0x6a9d9}, {0x6a9de, 0x6a9fe}, + {0x6aa00, 0x6aa36}, {0x6aa40, 0x6aa4d}, {0x6aa50, 0x6aa59}, {0x6aa5c, 0x6aac2}, + {0x6aadb, 0x6aaf6}, {0x6ab01, 0x6ab06}, {0x6ab09, 0x6ab0e}, {0x6ab11, 0x6ab16}, + {0x6ab20, 0x6ab26}, {0x6ab28, 0x6ab2e}, {0x6ab30, 0x6ab65}, {0x6ab70, 0x6abed}, + {0x6abf0, 0x6abf9}, {0x6ac00, 0x6d7a3}, {0x6d7b0, 0x6d7c6}, {0x6d7cb, 0x6d7fb}, + {0x6f900, 0x6fa6d}, {0x6fa70, 0x6fad9}, {0x6fb00, 0x6fb06}, {0x6fb13, 0x6fb17}, + {0x6fb1d, 0x6fb36}, {0x6fb38, 0x6fb3c}, {0x6fb46, 0x6fbc1}, {0x6fbd3, 0x6fd3f}, + {0x6fd50, 0x6fd8f}, {0x6fd92, 0x6fdc7}, {0x6fdf0, 0x6fdfd}, {0x6fe00, 0x6fe19}, + {0x6fe20, 0x6fe52}, {0x6fe54, 0x6fe66}, {0x6fe68, 0x6fe6b}, {0x6fe70, 0x6fe74}, + {0x6fe76, 0x6fefc}, {0x6ff01, 0x6ffbe}, {0x6ffc2, 0x6ffc7}, {0x6ffca, 0x6ffcf}, + {0x6ffd2, 0x6ffd7}, {0x6ffda, 0x6ffdc}, {0x6ffe0, 0x6ffe6}, {0x6ffe8, 0x6ffee}, + {0x70021, 0x7007e}, {0x700a1, 0x700ac}, {0x700ae, 0x70377}, {0x7037a, 0x7037f}, + {0x70384, 0x7038a}, {0x7038e, 0x703a1}, {0x703a3, 0x7052f}, {0x70531, 0x70556}, + {0x70559, 0x7055f}, {0x70561, 0x70587}, {0x7058d, 0x7058f}, {0x70591, 0x705c7}, + {0x705d0, 0x705ea}, {0x705f0, 0x705f4}, {0x70606, 0x7061b}, {0x7061e, 0x706dc}, + {0x706de, 0x7070d}, {0x70710, 0x7074a}, {0x7074d, 0x707b1}, {0x707c0, 0x707fa}, + {0x70800, 0x7082d}, {0x70830, 0x7083e}, {0x70840, 0x7085b}, {0x70860, 0x7086a}, + {0x708a0, 0x708b4}, {0x708b6, 0x708bd}, {0x708d4, 0x708e1}, {0x708e3, 0x70983}, + {0x70985, 0x7098c}, {0x70993, 0x709a8}, {0x709aa, 0x709b0}, {0x709b6, 0x709b9}, + {0x709bc, 0x709c4}, {0x709cb, 0x709ce}, {0x709df, 0x709e3}, {0x709e6, 0x709fd}, + {0x70a01, 0x70a03}, {0x70a05, 0x70a0a}, {0x70a13, 0x70a28}, {0x70a2a, 0x70a30}, + {0x70a3e, 0x70a42}, {0x70a4b, 0x70a4d}, {0x70a59, 0x70a5c}, {0x70a66, 0x70a75}, + {0x70a81, 0x70a83}, {0x70a85, 0x70a8d}, {0x70a8f, 0x70a91}, {0x70a93, 0x70aa8}, + {0x70aaa, 0x70ab0}, {0x70ab5, 0x70ab9}, {0x70abc, 0x70ac5}, {0x70ac7, 0x70ac9}, + {0x70acb, 0x70acd}, {0x70ae0, 0x70ae3}, {0x70ae6, 0x70af1}, {0x70af9, 0x70aff}, + {0x70b01, 0x70b03}, {0x70b05, 0x70b0c}, {0x70b13, 0x70b28}, {0x70b2a, 0x70b30}, + {0x70b35, 0x70b39}, {0x70b3c, 0x70b44}, {0x70b4b, 0x70b4d}, {0x70b5f, 0x70b63}, + {0x70b66, 0x70b77}, {0x70b85, 0x70b8a}, {0x70b8e, 0x70b90}, {0x70b92, 0x70b95}, + {0x70ba8, 0x70baa}, {0x70bae, 0x70bb9}, {0x70bbe, 0x70bc2}, {0x70bc6, 0x70bc8}, + {0x70bca, 0x70bcd}, {0x70be6, 0x70bfa}, {0x70c00, 0x70c03}, {0x70c05, 0x70c0c}, + {0x70c0e, 0x70c10}, {0x70c12, 0x70c28}, {0x70c2a, 0x70c39}, {0x70c3d, 0x70c44}, + {0x70c46, 0x70c48}, {0x70c4a, 0x70c4d}, {0x70c58, 0x70c5a}, {0x70c60, 0x70c63}, + {0x70c66, 0x70c6f}, {0x70c78, 0x70c83}, {0x70c85, 0x70c8c}, {0x70c8e, 0x70c90}, + {0x70c92, 0x70ca8}, {0x70caa, 0x70cb3}, {0x70cb5, 0x70cb9}, {0x70cbc, 0x70cc4}, + {0x70cc6, 0x70cc8}, {0x70cca, 0x70ccd}, {0x70ce0, 0x70ce3}, {0x70ce6, 0x70cef}, + {0x70d00, 0x70d03}, {0x70d05, 0x70d0c}, {0x70d0e, 0x70d10}, {0x70d12, 0x70d44}, + {0x70d46, 0x70d48}, {0x70d4a, 0x70d4f}, {0x70d54, 0x70d63}, {0x70d66, 0x70d7f}, + {0x70d85, 0x70d96}, {0x70d9a, 0x70db1}, {0x70db3, 0x70dbb}, {0x70dc0, 0x70dc6}, + {0x70dcf, 0x70dd4}, {0x70dd8, 0x70ddf}, {0x70de6, 0x70def}, {0x70df2, 0x70df4}, + {0x70e01, 0x70e3a}, {0x70e3f, 0x70e5b}, {0x70e94, 0x70e97}, {0x70e99, 0x70e9f}, + {0x70ea1, 0x70ea3}, {0x70ead, 0x70eb9}, {0x70ebb, 0x70ebd}, {0x70ec0, 0x70ec4}, + {0x70ec8, 0x70ecd}, {0x70ed0, 0x70ed9}, {0x70edc, 0x70edf}, {0x70f00, 0x70f47}, + {0x70f49, 0x70f6c}, {0x70f71, 0x70f97}, {0x70f99, 0x70fbc}, {0x70fbe, 0x70fcc}, + {0x70fce, 0x70fda}, {0x71000, 0x710c5}, {0x710d0, 0x71248}, {0x7124a, 0x7124d}, + {0x71250, 0x71256}, {0x7125a, 0x7125d}, {0x71260, 0x71288}, {0x7128a, 0x7128d}, + {0x71290, 0x712b0}, {0x712b2, 0x712b5}, {0x712b8, 0x712be}, {0x712c2, 0x712c5}, + {0x712c8, 0x712d6}, {0x712d8, 0x71310}, {0x71312, 0x71315}, {0x71318, 0x7135a}, + {0x7135d, 0x7137c}, {0x71380, 0x71399}, {0x713a0, 0x713f5}, {0x713f8, 0x713fd}, + {0x71400, 0x7167f}, {0x71681, 0x7169c}, {0x716a0, 0x716f8}, {0x71700, 0x7170c}, + {0x7170e, 0x71714}, {0x71720, 0x71736}, {0x71740, 0x71753}, {0x71760, 0x7176c}, + {0x7176e, 0x71770}, {0x71780, 0x717dd}, {0x717e0, 0x717e9}, {0x717f0, 0x717f9}, + {0x71800, 0x7180d}, {0x71810, 0x71819}, {0x71820, 0x71877}, {0x71880, 0x718aa}, + {0x718b0, 0x718f5}, {0x71900, 0x7191e}, {0x71920, 0x7192b}, {0x71930, 0x7193b}, + {0x71944, 0x7196d}, {0x71970, 0x71974}, {0x71980, 0x719ab}, {0x719b0, 0x719c9}, + {0x719d0, 0x719da}, {0x719de, 0x71a1b}, {0x71a1e, 0x71a5e}, {0x71a60, 0x71a7c}, + {0x71a7f, 0x71a89}, {0x71a90, 0x71a99}, {0x71aa0, 0x71aad}, {0x71ab0, 0x71abe}, + {0x71b00, 0x71b4b}, {0x71b50, 0x71b7c}, {0x71b80, 0x71bf3}, {0x71bfc, 0x71c37}, + {0x71c3b, 0x71c49}, {0x71c4d, 0x71c88}, {0x71cc0, 0x71cc7}, {0x71cd0, 0x71cf9}, + {0x71d00, 0x71df9}, {0x71dfb, 0x71f15}, {0x71f18, 0x71f1d}, {0x71f20, 0x71f45}, + {0x71f48, 0x71f4d}, {0x71f50, 0x71f57}, {0x71f5f, 0x71f7d}, {0x71f80, 0x71fb4}, + {0x71fb6, 0x71fc4}, {0x71fc6, 0x71fd3}, {0x71fd6, 0x71fdb}, {0x71fdd, 0x71fef}, + {0x71ff2, 0x71ff4}, {0x71ff6, 0x71ffe}, {0x72010, 0x72027}, {0x72030, 0x7205e}, + {0x72074, 0x7208e}, {0x72090, 0x7209c}, {0x720a0, 0x720bf}, {0x720d0, 0x720f0}, + {0x72100, 0x7218b}, {0x72190, 0x72426}, {0x72440, 0x7244a}, {0x72460, 0x72b73}, + {0x72b76, 0x72b95}, {0x72b98, 0x72bb9}, {0x72bbd, 0x72bc8}, {0x72bca, 0x72bd2}, + {0x72bec, 0x72bef}, {0x72c00, 0x72c2e}, {0x72c30, 0x72c5e}, {0x72c60, 0x72cf3}, + {0x72cf9, 0x72d25}, {0x72d30, 0x72d67}, {0x72d7f, 0x72d96}, {0x72da0, 0x72da6}, + {0x72da8, 0x72dae}, {0x72db0, 0x72db6}, {0x72db8, 0x72dbe}, {0x72dc0, 0x72dc6}, + {0x72dc8, 0x72dce}, {0x72dd0, 0x72dd6}, {0x72dd8, 0x72dde}, {0x72de0, 0x72e49}, + {0x72e80, 0x72e99}, {0x72e9b, 0x72ef3}, {0x72f00, 0x72fd5}, {0x72ff0, 0x72ffb}, + {0x73001, 0x7303f}, {0x73041, 0x73096}, {0x73099, 0x730ff}, {0x73105, 0x7312e}, + {0x73131, 0x7318e}, {0x73190, 0x731ba}, {0x731c0, 0x731e3}, {0x731f0, 0x7321e}, + {0x73220, 0x732fe}, {0x73300, 0x74db5}, {0x74dc0, 0x79fea}, {0x7a000, 0x7a48c}, + {0x7a490, 0x7a4c6}, {0x7a4d0, 0x7a62b}, {0x7a640, 0x7a6f7}, {0x7a700, 0x7a7ae}, + {0x7a7b0, 0x7a7b7}, {0x7a7f7, 0x7a82b}, {0x7a830, 0x7a839}, {0x7a840, 0x7a877}, + {0x7a880, 0x7a8c5}, {0x7a8ce, 0x7a8d9}, {0x7a8e0, 0x7a8fd}, {0x7a900, 0x7a953}, + {0x7a95f, 0x7a97c}, {0x7a980, 0x7a9cd}, {0x7a9cf, 0x7a9d9}, {0x7a9de, 0x7a9fe}, + {0x7aa00, 0x7aa36}, {0x7aa40, 0x7aa4d}, {0x7aa50, 0x7aa59}, {0x7aa5c, 0x7aac2}, + {0x7aadb, 0x7aaf6}, {0x7ab01, 0x7ab06}, {0x7ab09, 0x7ab0e}, {0x7ab11, 0x7ab16}, + {0x7ab20, 0x7ab26}, {0x7ab28, 0x7ab2e}, {0x7ab30, 0x7ab65}, {0x7ab70, 0x7abed}, + {0x7abf0, 0x7abf9}, {0x7ac00, 0x7d7a3}, {0x7d7b0, 0x7d7c6}, {0x7d7cb, 0x7d7fb}, + {0x7f900, 0x7fa6d}, {0x7fa70, 0x7fad9}, {0x7fb00, 0x7fb06}, {0x7fb13, 0x7fb17}, + {0x7fb1d, 0x7fb36}, {0x7fb38, 0x7fb3c}, {0x7fb46, 0x7fbc1}, {0x7fbd3, 0x7fd3f}, + {0x7fd50, 0x7fd8f}, {0x7fd92, 0x7fdc7}, {0x7fdf0, 0x7fdfd}, {0x7fe00, 0x7fe19}, + {0x7fe20, 0x7fe52}, {0x7fe54, 0x7fe66}, {0x7fe68, 0x7fe6b}, {0x7fe70, 0x7fe74}, + {0x7fe76, 0x7fefc}, {0x7ff01, 0x7ffbe}, {0x7ffc2, 0x7ffc7}, {0x7ffca, 0x7ffcf}, + {0x7ffd2, 0x7ffd7}, {0x7ffda, 0x7ffdc}, {0x7ffe0, 0x7ffe6}, {0x7ffe8, 0x7ffee}, + {0x80021, 0x8007e}, {0x800a1, 0x800ac}, {0x800ae, 0x80377}, {0x8037a, 0x8037f}, + {0x80384, 0x8038a}, {0x8038e, 0x803a1}, {0x803a3, 0x8052f}, {0x80531, 0x80556}, + {0x80559, 0x8055f}, {0x80561, 0x80587}, {0x8058d, 0x8058f}, {0x80591, 0x805c7}, + {0x805d0, 0x805ea}, {0x805f0, 0x805f4}, {0x80606, 0x8061b}, {0x8061e, 0x806dc}, + {0x806de, 0x8070d}, {0x80710, 0x8074a}, {0x8074d, 0x807b1}, {0x807c0, 0x807fa}, + {0x80800, 0x8082d}, {0x80830, 0x8083e}, {0x80840, 0x8085b}, {0x80860, 0x8086a}, + {0x808a0, 0x808b4}, {0x808b6, 0x808bd}, {0x808d4, 0x808e1}, {0x808e3, 0x80983}, + {0x80985, 0x8098c}, {0x80993, 0x809a8}, {0x809aa, 0x809b0}, {0x809b6, 0x809b9}, + {0x809bc, 0x809c4}, {0x809cb, 0x809ce}, {0x809df, 0x809e3}, {0x809e6, 0x809fd}, + {0x80a01, 0x80a03}, {0x80a05, 0x80a0a}, {0x80a13, 0x80a28}, {0x80a2a, 0x80a30}, + {0x80a3e, 0x80a42}, {0x80a4b, 0x80a4d}, {0x80a59, 0x80a5c}, {0x80a66, 0x80a75}, + {0x80a81, 0x80a83}, {0x80a85, 0x80a8d}, {0x80a8f, 0x80a91}, {0x80a93, 0x80aa8}, + {0x80aaa, 0x80ab0}, {0x80ab5, 0x80ab9}, {0x80abc, 0x80ac5}, {0x80ac7, 0x80ac9}, + {0x80acb, 0x80acd}, {0x80ae0, 0x80ae3}, {0x80ae6, 0x80af1}, {0x80af9, 0x80aff}, + {0x80b01, 0x80b03}, {0x80b05, 0x80b0c}, {0x80b13, 0x80b28}, {0x80b2a, 0x80b30}, + {0x80b35, 0x80b39}, {0x80b3c, 0x80b44}, {0x80b4b, 0x80b4d}, {0x80b5f, 0x80b63}, + {0x80b66, 0x80b77}, {0x80b85, 0x80b8a}, {0x80b8e, 0x80b90}, {0x80b92, 0x80b95}, + {0x80ba8, 0x80baa}, {0x80bae, 0x80bb9}, {0x80bbe, 0x80bc2}, {0x80bc6, 0x80bc8}, + {0x80bca, 0x80bcd}, {0x80be6, 0x80bfa}, {0x80c00, 0x80c03}, {0x80c05, 0x80c0c}, + {0x80c0e, 0x80c10}, {0x80c12, 0x80c28}, {0x80c2a, 0x80c39}, {0x80c3d, 0x80c44}, + {0x80c46, 0x80c48}, {0x80c4a, 0x80c4d}, {0x80c58, 0x80c5a}, {0x80c60, 0x80c63}, + {0x80c66, 0x80c6f}, {0x80c78, 0x80c83}, {0x80c85, 0x80c8c}, {0x80c8e, 0x80c90}, + {0x80c92, 0x80ca8}, {0x80caa, 0x80cb3}, {0x80cb5, 0x80cb9}, {0x80cbc, 0x80cc4}, + {0x80cc6, 0x80cc8}, {0x80cca, 0x80ccd}, {0x80ce0, 0x80ce3}, {0x80ce6, 0x80cef}, + {0x80d00, 0x80d03}, {0x80d05, 0x80d0c}, {0x80d0e, 0x80d10}, {0x80d12, 0x80d44}, + {0x80d46, 0x80d48}, {0x80d4a, 0x80d4f}, {0x80d54, 0x80d63}, {0x80d66, 0x80d7f}, + {0x80d85, 0x80d96}, {0x80d9a, 0x80db1}, {0x80db3, 0x80dbb}, {0x80dc0, 0x80dc6}, + {0x80dcf, 0x80dd4}, {0x80dd8, 0x80ddf}, {0x80de6, 0x80def}, {0x80df2, 0x80df4}, + {0x80e01, 0x80e3a}, {0x80e3f, 0x80e5b}, {0x80e94, 0x80e97}, {0x80e99, 0x80e9f}, + {0x80ea1, 0x80ea3}, {0x80ead, 0x80eb9}, {0x80ebb, 0x80ebd}, {0x80ec0, 0x80ec4}, + {0x80ec8, 0x80ecd}, {0x80ed0, 0x80ed9}, {0x80edc, 0x80edf}, {0x80f00, 0x80f47}, + {0x80f49, 0x80f6c}, {0x80f71, 0x80f97}, {0x80f99, 0x80fbc}, {0x80fbe, 0x80fcc}, + {0x80fce, 0x80fda}, {0x81000, 0x810c5}, {0x810d0, 0x81248}, {0x8124a, 0x8124d}, + {0x81250, 0x81256}, {0x8125a, 0x8125d}, {0x81260, 0x81288}, {0x8128a, 0x8128d}, + {0x81290, 0x812b0}, {0x812b2, 0x812b5}, {0x812b8, 0x812be}, {0x812c2, 0x812c5}, + {0x812c8, 0x812d6}, {0x812d8, 0x81310}, {0x81312, 0x81315}, {0x81318, 0x8135a}, + {0x8135d, 0x8137c}, {0x81380, 0x81399}, {0x813a0, 0x813f5}, {0x813f8, 0x813fd}, + {0x81400, 0x8167f}, {0x81681, 0x8169c}, {0x816a0, 0x816f8}, {0x81700, 0x8170c}, + {0x8170e, 0x81714}, {0x81720, 0x81736}, {0x81740, 0x81753}, {0x81760, 0x8176c}, + {0x8176e, 0x81770}, {0x81780, 0x817dd}, {0x817e0, 0x817e9}, {0x817f0, 0x817f9}, + {0x81800, 0x8180d}, {0x81810, 0x81819}, {0x81820, 0x81877}, {0x81880, 0x818aa}, + {0x818b0, 0x818f5}, {0x81900, 0x8191e}, {0x81920, 0x8192b}, {0x81930, 0x8193b}, + {0x81944, 0x8196d}, {0x81970, 0x81974}, {0x81980, 0x819ab}, {0x819b0, 0x819c9}, + {0x819d0, 0x819da}, {0x819de, 0x81a1b}, {0x81a1e, 0x81a5e}, {0x81a60, 0x81a7c}, + {0x81a7f, 0x81a89}, {0x81a90, 0x81a99}, {0x81aa0, 0x81aad}, {0x81ab0, 0x81abe}, + {0x81b00, 0x81b4b}, {0x81b50, 0x81b7c}, {0x81b80, 0x81bf3}, {0x81bfc, 0x81c37}, + {0x81c3b, 0x81c49}, {0x81c4d, 0x81c88}, {0x81cc0, 0x81cc7}, {0x81cd0, 0x81cf9}, + {0x81d00, 0x81df9}, {0x81dfb, 0x81f15}, {0x81f18, 0x81f1d}, {0x81f20, 0x81f45}, + {0x81f48, 0x81f4d}, {0x81f50, 0x81f57}, {0x81f5f, 0x81f7d}, {0x81f80, 0x81fb4}, + {0x81fb6, 0x81fc4}, {0x81fc6, 0x81fd3}, {0x81fd6, 0x81fdb}, {0x81fdd, 0x81fef}, + {0x81ff2, 0x81ff4}, {0x81ff6, 0x81ffe}, {0x82010, 0x82027}, {0x82030, 0x8205e}, + {0x82074, 0x8208e}, {0x82090, 0x8209c}, {0x820a0, 0x820bf}, {0x820d0, 0x820f0}, + {0x82100, 0x8218b}, {0x82190, 0x82426}, {0x82440, 0x8244a}, {0x82460, 0x82b73}, + {0x82b76, 0x82b95}, {0x82b98, 0x82bb9}, {0x82bbd, 0x82bc8}, {0x82bca, 0x82bd2}, + {0x82bec, 0x82bef}, {0x82c00, 0x82c2e}, {0x82c30, 0x82c5e}, {0x82c60, 0x82cf3}, + {0x82cf9, 0x82d25}, {0x82d30, 0x82d67}, {0x82d7f, 0x82d96}, {0x82da0, 0x82da6}, + {0x82da8, 0x82dae}, {0x82db0, 0x82db6}, {0x82db8, 0x82dbe}, {0x82dc0, 0x82dc6}, + {0x82dc8, 0x82dce}, {0x82dd0, 0x82dd6}, {0x82dd8, 0x82dde}, {0x82de0, 0x82e49}, + {0x82e80, 0x82e99}, {0x82e9b, 0x82ef3}, {0x82f00, 0x82fd5}, {0x82ff0, 0x82ffb}, + {0x83001, 0x8303f}, {0x83041, 0x83096}, {0x83099, 0x830ff}, {0x83105, 0x8312e}, + {0x83131, 0x8318e}, {0x83190, 0x831ba}, {0x831c0, 0x831e3}, {0x831f0, 0x8321e}, + {0x83220, 0x832fe}, {0x83300, 0x84db5}, {0x84dc0, 0x89fea}, {0x8a000, 0x8a48c}, + {0x8a490, 0x8a4c6}, {0x8a4d0, 0x8a62b}, {0x8a640, 0x8a6f7}, {0x8a700, 0x8a7ae}, + {0x8a7b0, 0x8a7b7}, {0x8a7f7, 0x8a82b}, {0x8a830, 0x8a839}, {0x8a840, 0x8a877}, + {0x8a880, 0x8a8c5}, {0x8a8ce, 0x8a8d9}, {0x8a8e0, 0x8a8fd}, {0x8a900, 0x8a953}, + {0x8a95f, 0x8a97c}, {0x8a980, 0x8a9cd}, {0x8a9cf, 0x8a9d9}, {0x8a9de, 0x8a9fe}, + {0x8aa00, 0x8aa36}, {0x8aa40, 0x8aa4d}, {0x8aa50, 0x8aa59}, {0x8aa5c, 0x8aac2}, + {0x8aadb, 0x8aaf6}, {0x8ab01, 0x8ab06}, {0x8ab09, 0x8ab0e}, {0x8ab11, 0x8ab16}, + {0x8ab20, 0x8ab26}, {0x8ab28, 0x8ab2e}, {0x8ab30, 0x8ab65}, {0x8ab70, 0x8abed}, + {0x8abf0, 0x8abf9}, {0x8ac00, 0x8d7a3}, {0x8d7b0, 0x8d7c6}, {0x8d7cb, 0x8d7fb}, + {0x8f900, 0x8fa6d}, {0x8fa70, 0x8fad9}, {0x8fb00, 0x8fb06}, {0x8fb13, 0x8fb17}, + {0x8fb1d, 0x8fb36}, {0x8fb38, 0x8fb3c}, {0x8fb46, 0x8fbc1}, {0x8fbd3, 0x8fd3f}, + {0x8fd50, 0x8fd8f}, {0x8fd92, 0x8fdc7}, {0x8fdf0, 0x8fdfd}, {0x8fe00, 0x8fe19}, + {0x8fe20, 0x8fe52}, {0x8fe54, 0x8fe66}, {0x8fe68, 0x8fe6b}, {0x8fe70, 0x8fe74}, + {0x8fe76, 0x8fefc}, {0x8ff01, 0x8ffbe}, {0x8ffc2, 0x8ffc7}, {0x8ffca, 0x8ffcf}, + {0x8ffd2, 0x8ffd7}, {0x8ffda, 0x8ffdc}, {0x8ffe0, 0x8ffe6}, {0x8ffe8, 0x8ffee}, + {0x90021, 0x9007e}, {0x900a1, 0x900ac}, {0x900ae, 0x90377}, {0x9037a, 0x9037f}, + {0x90384, 0x9038a}, {0x9038e, 0x903a1}, {0x903a3, 0x9052f}, {0x90531, 0x90556}, + {0x90559, 0x9055f}, {0x90561, 0x90587}, {0x9058d, 0x9058f}, {0x90591, 0x905c7}, + {0x905d0, 0x905ea}, {0x905f0, 0x905f4}, {0x90606, 0x9061b}, {0x9061e, 0x906dc}, + {0x906de, 0x9070d}, {0x90710, 0x9074a}, {0x9074d, 0x907b1}, {0x907c0, 0x907fa}, + {0x90800, 0x9082d}, {0x90830, 0x9083e}, {0x90840, 0x9085b}, {0x90860, 0x9086a}, + {0x908a0, 0x908b4}, {0x908b6, 0x908bd}, {0x908d4, 0x908e1}, {0x908e3, 0x90983}, + {0x90985, 0x9098c}, {0x90993, 0x909a8}, {0x909aa, 0x909b0}, {0x909b6, 0x909b9}, + {0x909bc, 0x909c4}, {0x909cb, 0x909ce}, {0x909df, 0x909e3}, {0x909e6, 0x909fd}, + {0x90a01, 0x90a03}, {0x90a05, 0x90a0a}, {0x90a13, 0x90a28}, {0x90a2a, 0x90a30}, + {0x90a3e, 0x90a42}, {0x90a4b, 0x90a4d}, {0x90a59, 0x90a5c}, {0x90a66, 0x90a75}, + {0x90a81, 0x90a83}, {0x90a85, 0x90a8d}, {0x90a8f, 0x90a91}, {0x90a93, 0x90aa8}, + {0x90aaa, 0x90ab0}, {0x90ab5, 0x90ab9}, {0x90abc, 0x90ac5}, {0x90ac7, 0x90ac9}, + {0x90acb, 0x90acd}, {0x90ae0, 0x90ae3}, {0x90ae6, 0x90af1}, {0x90af9, 0x90aff}, + {0x90b01, 0x90b03}, {0x90b05, 0x90b0c}, {0x90b13, 0x90b28}, {0x90b2a, 0x90b30}, + {0x90b35, 0x90b39}, {0x90b3c, 0x90b44}, {0x90b4b, 0x90b4d}, {0x90b5f, 0x90b63}, + {0x90b66, 0x90b77}, {0x90b85, 0x90b8a}, {0x90b8e, 0x90b90}, {0x90b92, 0x90b95}, + {0x90ba8, 0x90baa}, {0x90bae, 0x90bb9}, {0x90bbe, 0x90bc2}, {0x90bc6, 0x90bc8}, + {0x90bca, 0x90bcd}, {0x90be6, 0x90bfa}, {0x90c00, 0x90c03}, {0x90c05, 0x90c0c}, + {0x90c0e, 0x90c10}, {0x90c12, 0x90c28}, {0x90c2a, 0x90c39}, {0x90c3d, 0x90c44}, + {0x90c46, 0x90c48}, {0x90c4a, 0x90c4d}, {0x90c58, 0x90c5a}, {0x90c60, 0x90c63}, + {0x90c66, 0x90c6f}, {0x90c78, 0x90c83}, {0x90c85, 0x90c8c}, {0x90c8e, 0x90c90}, + {0x90c92, 0x90ca8}, {0x90caa, 0x90cb3}, {0x90cb5, 0x90cb9}, {0x90cbc, 0x90cc4}, + {0x90cc6, 0x90cc8}, {0x90cca, 0x90ccd}, {0x90ce0, 0x90ce3}, {0x90ce6, 0x90cef}, + {0x90d00, 0x90d03}, {0x90d05, 0x90d0c}, {0x90d0e, 0x90d10}, {0x90d12, 0x90d44}, + {0x90d46, 0x90d48}, {0x90d4a, 0x90d4f}, {0x90d54, 0x90d63}, {0x90d66, 0x90d7f}, + {0x90d85, 0x90d96}, {0x90d9a, 0x90db1}, {0x90db3, 0x90dbb}, {0x90dc0, 0x90dc6}, + {0x90dcf, 0x90dd4}, {0x90dd8, 0x90ddf}, {0x90de6, 0x90def}, {0x90df2, 0x90df4}, + {0x90e01, 0x90e3a}, {0x90e3f, 0x90e5b}, {0x90e94, 0x90e97}, {0x90e99, 0x90e9f}, + {0x90ea1, 0x90ea3}, {0x90ead, 0x90eb9}, {0x90ebb, 0x90ebd}, {0x90ec0, 0x90ec4}, + {0x90ec8, 0x90ecd}, {0x90ed0, 0x90ed9}, {0x90edc, 0x90edf}, {0x90f00, 0x90f47}, + {0x90f49, 0x90f6c}, {0x90f71, 0x90f97}, {0x90f99, 0x90fbc}, {0x90fbe, 0x90fcc}, + {0x90fce, 0x90fda}, {0x91000, 0x910c5}, {0x910d0, 0x91248}, {0x9124a, 0x9124d}, + {0x91250, 0x91256}, {0x9125a, 0x9125d}, {0x91260, 0x91288}, {0x9128a, 0x9128d}, + {0x91290, 0x912b0}, {0x912b2, 0x912b5}, {0x912b8, 0x912be}, {0x912c2, 0x912c5}, + {0x912c8, 0x912d6}, {0x912d8, 0x91310}, {0x91312, 0x91315}, {0x91318, 0x9135a}, + {0x9135d, 0x9137c}, {0x91380, 0x91399}, {0x913a0, 0x913f5}, {0x913f8, 0x913fd}, + {0x91400, 0x9167f}, {0x91681, 0x9169c}, {0x916a0, 0x916f8}, {0x91700, 0x9170c}, + {0x9170e, 0x91714}, {0x91720, 0x91736}, {0x91740, 0x91753}, {0x91760, 0x9176c}, + {0x9176e, 0x91770}, {0x91780, 0x917dd}, {0x917e0, 0x917e9}, {0x917f0, 0x917f9}, + {0x91800, 0x9180d}, {0x91810, 0x91819}, {0x91820, 0x91877}, {0x91880, 0x918aa}, + {0x918b0, 0x918f5}, {0x91900, 0x9191e}, {0x91920, 0x9192b}, {0x91930, 0x9193b}, + {0x91944, 0x9196d}, {0x91970, 0x91974}, {0x91980, 0x919ab}, {0x919b0, 0x919c9}, + {0x919d0, 0x919da}, {0x919de, 0x91a1b}, {0x91a1e, 0x91a5e}, {0x91a60, 0x91a7c}, + {0x91a7f, 0x91a89}, {0x91a90, 0x91a99}, {0x91aa0, 0x91aad}, {0x91ab0, 0x91abe}, + {0x91b00, 0x91b4b}, {0x91b50, 0x91b7c}, {0x91b80, 0x91bf3}, {0x91bfc, 0x91c37}, + {0x91c3b, 0x91c49}, {0x91c4d, 0x91c88}, {0x91cc0, 0x91cc7}, {0x91cd0, 0x91cf9}, + {0x91d00, 0x91df9}, {0x91dfb, 0x91f15}, {0x91f18, 0x91f1d}, {0x91f20, 0x91f45}, + {0x91f48, 0x91f4d}, {0x91f50, 0x91f57}, {0x91f5f, 0x91f7d}, {0x91f80, 0x91fb4}, + {0x91fb6, 0x91fc4}, {0x91fc6, 0x91fd3}, {0x91fd6, 0x91fdb}, {0x91fdd, 0x91fef}, + {0x91ff2, 0x91ff4}, {0x91ff6, 0x91ffe}, {0x92010, 0x92027}, {0x92030, 0x9205e}, + {0x92074, 0x9208e}, {0x92090, 0x9209c}, {0x920a0, 0x920bf}, {0x920d0, 0x920f0}, + {0x92100, 0x9218b}, {0x92190, 0x92426}, {0x92440, 0x9244a}, {0x92460, 0x92b73}, + {0x92b76, 0x92b95}, {0x92b98, 0x92bb9}, {0x92bbd, 0x92bc8}, {0x92bca, 0x92bd2}, + {0x92bec, 0x92bef}, {0x92c00, 0x92c2e}, {0x92c30, 0x92c5e}, {0x92c60, 0x92cf3}, + {0x92cf9, 0x92d25}, {0x92d30, 0x92d67}, {0x92d7f, 0x92d96}, {0x92da0, 0x92da6}, + {0x92da8, 0x92dae}, {0x92db0, 0x92db6}, {0x92db8, 0x92dbe}, {0x92dc0, 0x92dc6}, + {0x92dc8, 0x92dce}, {0x92dd0, 0x92dd6}, {0x92dd8, 0x92dde}, {0x92de0, 0x92e49}, + {0x92e80, 0x92e99}, {0x92e9b, 0x92ef3}, {0x92f00, 0x92fd5}, {0x92ff0, 0x92ffb}, + {0x93001, 0x9303f}, {0x93041, 0x93096}, {0x93099, 0x930ff}, {0x93105, 0x9312e}, + {0x93131, 0x9318e}, {0x93190, 0x931ba}, {0x931c0, 0x931e3}, {0x931f0, 0x9321e}, + {0x93220, 0x932fe}, {0x93300, 0x94db5}, {0x94dc0, 0x99fea}, {0x9a000, 0x9a48c}, + {0x9a490, 0x9a4c6}, {0x9a4d0, 0x9a62b}, {0x9a640, 0x9a6f7}, {0x9a700, 0x9a7ae}, + {0x9a7b0, 0x9a7b7}, {0x9a7f7, 0x9a82b}, {0x9a830, 0x9a839}, {0x9a840, 0x9a877}, + {0x9a880, 0x9a8c5}, {0x9a8ce, 0x9a8d9}, {0x9a8e0, 0x9a8fd}, {0x9a900, 0x9a953}, + {0x9a95f, 0x9a97c}, {0x9a980, 0x9a9cd}, {0x9a9cf, 0x9a9d9}, {0x9a9de, 0x9a9fe}, + {0x9aa00, 0x9aa36}, {0x9aa40, 0x9aa4d}, {0x9aa50, 0x9aa59}, {0x9aa5c, 0x9aac2}, + {0x9aadb, 0x9aaf6}, {0x9ab01, 0x9ab06}, {0x9ab09, 0x9ab0e}, {0x9ab11, 0x9ab16}, + {0x9ab20, 0x9ab26}, {0x9ab28, 0x9ab2e}, {0x9ab30, 0x9ab65}, {0x9ab70, 0x9abed}, + {0x9abf0, 0x9abf9}, {0x9ac00, 0x9d7a3}, {0x9d7b0, 0x9d7c6}, {0x9d7cb, 0x9d7fb}, + {0x9f900, 0x9fa6d}, {0x9fa70, 0x9fad9}, {0x9fb00, 0x9fb06}, {0x9fb13, 0x9fb17}, + {0x9fb1d, 0x9fb36}, {0x9fb38, 0x9fb3c}, {0x9fb46, 0x9fbc1}, {0x9fbd3, 0x9fd3f}, + {0x9fd50, 0x9fd8f}, {0x9fd92, 0x9fdc7}, {0x9fdf0, 0x9fdfd}, {0x9fe00, 0x9fe19}, + {0x9fe20, 0x9fe52}, {0x9fe54, 0x9fe66}, {0x9fe68, 0x9fe6b}, {0x9fe70, 0x9fe74}, + {0x9fe76, 0x9fefc}, {0x9ff01, 0x9ffbe}, {0x9ffc2, 0x9ffc7}, {0x9ffca, 0x9ffcf}, + {0x9ffd2, 0x9ffd7}, {0x9ffda, 0x9ffdc}, {0x9ffe0, 0x9ffe6}, {0x9ffe8, 0x9ffee}, + {0xa0021, 0xa007e}, {0xa00a1, 0xa00ac}, {0xa00ae, 0xa0377}, {0xa037a, 0xa037f}, + {0xa0384, 0xa038a}, {0xa038e, 0xa03a1}, {0xa03a3, 0xa052f}, {0xa0531, 0xa0556}, + {0xa0559, 0xa055f}, {0xa0561, 0xa0587}, {0xa058d, 0xa058f}, {0xa0591, 0xa05c7}, + {0xa05d0, 0xa05ea}, {0xa05f0, 0xa05f4}, {0xa0606, 0xa061b}, {0xa061e, 0xa06dc}, + {0xa06de, 0xa070d}, {0xa0710, 0xa074a}, {0xa074d, 0xa07b1}, {0xa07c0, 0xa07fa}, + {0xa0800, 0xa082d}, {0xa0830, 0xa083e}, {0xa0840, 0xa085b}, {0xa0860, 0xa086a}, + {0xa08a0, 0xa08b4}, {0xa08b6, 0xa08bd}, {0xa08d4, 0xa08e1}, {0xa08e3, 0xa0983}, + {0xa0985, 0xa098c}, {0xa0993, 0xa09a8}, {0xa09aa, 0xa09b0}, {0xa09b6, 0xa09b9}, + {0xa09bc, 0xa09c4}, {0xa09cb, 0xa09ce}, {0xa09df, 0xa09e3}, {0xa09e6, 0xa09fd}, + {0xa0a01, 0xa0a03}, {0xa0a05, 0xa0a0a}, {0xa0a13, 0xa0a28}, {0xa0a2a, 0xa0a30}, + {0xa0a3e, 0xa0a42}, {0xa0a4b, 0xa0a4d}, {0xa0a59, 0xa0a5c}, {0xa0a66, 0xa0a75}, + {0xa0a81, 0xa0a83}, {0xa0a85, 0xa0a8d}, {0xa0a8f, 0xa0a91}, {0xa0a93, 0xa0aa8}, + {0xa0aaa, 0xa0ab0}, {0xa0ab5, 0xa0ab9}, {0xa0abc, 0xa0ac5}, {0xa0ac7, 0xa0ac9}, + {0xa0acb, 0xa0acd}, {0xa0ae0, 0xa0ae3}, {0xa0ae6, 0xa0af1}, {0xa0af9, 0xa0aff}, + {0xa0b01, 0xa0b03}, {0xa0b05, 0xa0b0c}, {0xa0b13, 0xa0b28}, {0xa0b2a, 0xa0b30}, + {0xa0b35, 0xa0b39}, {0xa0b3c, 0xa0b44}, {0xa0b4b, 0xa0b4d}, {0xa0b5f, 0xa0b63}, + {0xa0b66, 0xa0b77}, {0xa0b85, 0xa0b8a}, {0xa0b8e, 0xa0b90}, {0xa0b92, 0xa0b95}, + {0xa0ba8, 0xa0baa}, {0xa0bae, 0xa0bb9}, {0xa0bbe, 0xa0bc2}, {0xa0bc6, 0xa0bc8}, + {0xa0bca, 0xa0bcd}, {0xa0be6, 0xa0bfa}, {0xa0c00, 0xa0c03}, {0xa0c05, 0xa0c0c}, + {0xa0c0e, 0xa0c10}, {0xa0c12, 0xa0c28}, {0xa0c2a, 0xa0c39}, {0xa0c3d, 0xa0c44}, + {0xa0c46, 0xa0c48}, {0xa0c4a, 0xa0c4d}, {0xa0c58, 0xa0c5a}, {0xa0c60, 0xa0c63}, + {0xa0c66, 0xa0c6f}, {0xa0c78, 0xa0c83}, {0xa0c85, 0xa0c8c}, {0xa0c8e, 0xa0c90}, + {0xa0c92, 0xa0ca8}, {0xa0caa, 0xa0cb3}, {0xa0cb5, 0xa0cb9}, {0xa0cbc, 0xa0cc4}, + {0xa0cc6, 0xa0cc8}, {0xa0cca, 0xa0ccd}, {0xa0ce0, 0xa0ce3}, {0xa0ce6, 0xa0cef}, + {0xa0d00, 0xa0d03}, {0xa0d05, 0xa0d0c}, {0xa0d0e, 0xa0d10}, {0xa0d12, 0xa0d44}, + {0xa0d46, 0xa0d48}, {0xa0d4a, 0xa0d4f}, {0xa0d54, 0xa0d63}, {0xa0d66, 0xa0d7f}, + {0xa0d85, 0xa0d96}, {0xa0d9a, 0xa0db1}, {0xa0db3, 0xa0dbb}, {0xa0dc0, 0xa0dc6}, + {0xa0dcf, 0xa0dd4}, {0xa0dd8, 0xa0ddf}, {0xa0de6, 0xa0def}, {0xa0df2, 0xa0df4}, + {0xa0e01, 0xa0e3a}, {0xa0e3f, 0xa0e5b}, {0xa0e94, 0xa0e97}, {0xa0e99, 0xa0e9f}, + {0xa0ea1, 0xa0ea3}, {0xa0ead, 0xa0eb9}, {0xa0ebb, 0xa0ebd}, {0xa0ec0, 0xa0ec4}, + {0xa0ec8, 0xa0ecd}, {0xa0ed0, 0xa0ed9}, {0xa0edc, 0xa0edf}, {0xa0f00, 0xa0f47}, + {0xa0f49, 0xa0f6c}, {0xa0f71, 0xa0f97}, {0xa0f99, 0xa0fbc}, {0xa0fbe, 0xa0fcc}, + {0xa0fce, 0xa0fda}, {0xa1000, 0xa10c5}, {0xa10d0, 0xa1248}, {0xa124a, 0xa124d}, + {0xa1250, 0xa1256}, {0xa125a, 0xa125d}, {0xa1260, 0xa1288}, {0xa128a, 0xa128d}, + {0xa1290, 0xa12b0}, {0xa12b2, 0xa12b5}, {0xa12b8, 0xa12be}, {0xa12c2, 0xa12c5}, + {0xa12c8, 0xa12d6}, {0xa12d8, 0xa1310}, {0xa1312, 0xa1315}, {0xa1318, 0xa135a}, + {0xa135d, 0xa137c}, {0xa1380, 0xa1399}, {0xa13a0, 0xa13f5}, {0xa13f8, 0xa13fd}, + {0xa1400, 0xa167f}, {0xa1681, 0xa169c}, {0xa16a0, 0xa16f8}, {0xa1700, 0xa170c}, + {0xa170e, 0xa1714}, {0xa1720, 0xa1736}, {0xa1740, 0xa1753}, {0xa1760, 0xa176c}, + {0xa176e, 0xa1770}, {0xa1780, 0xa17dd}, {0xa17e0, 0xa17e9}, {0xa17f0, 0xa17f9}, + {0xa1800, 0xa180d}, {0xa1810, 0xa1819}, {0xa1820, 0xa1877}, {0xa1880, 0xa18aa}, + {0xa18b0, 0xa18f5}, {0xa1900, 0xa191e}, {0xa1920, 0xa192b}, {0xa1930, 0xa193b}, + {0xa1944, 0xa196d}, {0xa1970, 0xa1974}, {0xa1980, 0xa19ab}, {0xa19b0, 0xa19c9}, + {0xa19d0, 0xa19da}, {0xa19de, 0xa1a1b}, {0xa1a1e, 0xa1a5e}, {0xa1a60, 0xa1a7c}, + {0xa1a7f, 0xa1a89}, {0xa1a90, 0xa1a99}, {0xa1aa0, 0xa1aad}, {0xa1ab0, 0xa1abe}, + {0xa1b00, 0xa1b4b}, {0xa1b50, 0xa1b7c}, {0xa1b80, 0xa1bf3}, {0xa1bfc, 0xa1c37}, + {0xa1c3b, 0xa1c49}, {0xa1c4d, 0xa1c88}, {0xa1cc0, 0xa1cc7}, {0xa1cd0, 0xa1cf9}, + {0xa1d00, 0xa1df9}, {0xa1dfb, 0xa1f15}, {0xa1f18, 0xa1f1d}, {0xa1f20, 0xa1f45}, + {0xa1f48, 0xa1f4d}, {0xa1f50, 0xa1f57}, {0xa1f5f, 0xa1f7d}, {0xa1f80, 0xa1fb4}, + {0xa1fb6, 0xa1fc4}, {0xa1fc6, 0xa1fd3}, {0xa1fd6, 0xa1fdb}, {0xa1fdd, 0xa1fef}, + {0xa1ff2, 0xa1ff4}, {0xa1ff6, 0xa1ffe}, {0xa2010, 0xa2027}, {0xa2030, 0xa205e}, + {0xa2074, 0xa208e}, {0xa2090, 0xa209c}, {0xa20a0, 0xa20bf}, {0xa20d0, 0xa20f0}, + {0xa2100, 0xa218b}, {0xa2190, 0xa2426}, {0xa2440, 0xa244a}, {0xa2460, 0xa2b73}, + {0xa2b76, 0xa2b95}, {0xa2b98, 0xa2bb9}, {0xa2bbd, 0xa2bc8}, {0xa2bca, 0xa2bd2}, + {0xa2bec, 0xa2bef}, {0xa2c00, 0xa2c2e}, {0xa2c30, 0xa2c5e}, {0xa2c60, 0xa2cf3}, + {0xa2cf9, 0xa2d25}, {0xa2d30, 0xa2d67}, {0xa2d7f, 0xa2d96}, {0xa2da0, 0xa2da6}, + {0xa2da8, 0xa2dae}, {0xa2db0, 0xa2db6}, {0xa2db8, 0xa2dbe}, {0xa2dc0, 0xa2dc6}, + {0xa2dc8, 0xa2dce}, {0xa2dd0, 0xa2dd6}, {0xa2dd8, 0xa2dde}, {0xa2de0, 0xa2e49}, + {0xa2e80, 0xa2e99}, {0xa2e9b, 0xa2ef3}, {0xa2f00, 0xa2fd5}, {0xa2ff0, 0xa2ffb}, + {0xa3001, 0xa303f}, {0xa3041, 0xa3096}, {0xa3099, 0xa30ff}, {0xa3105, 0xa312e}, + {0xa3131, 0xa318e}, {0xa3190, 0xa31ba}, {0xa31c0, 0xa31e3}, {0xa31f0, 0xa321e}, + {0xa3220, 0xa32fe}, {0xa3300, 0xa4db5}, {0xa4dc0, 0xa9fea}, {0xaa000, 0xaa48c}, + {0xaa490, 0xaa4c6}, {0xaa4d0, 0xaa62b}, {0xaa640, 0xaa6f7}, {0xaa700, 0xaa7ae}, + {0xaa7b0, 0xaa7b7}, {0xaa7f7, 0xaa82b}, {0xaa830, 0xaa839}, {0xaa840, 0xaa877}, + {0xaa880, 0xaa8c5}, {0xaa8ce, 0xaa8d9}, {0xaa8e0, 0xaa8fd}, {0xaa900, 0xaa953}, + {0xaa95f, 0xaa97c}, {0xaa980, 0xaa9cd}, {0xaa9cf, 0xaa9d9}, {0xaa9de, 0xaa9fe}, + {0xaaa00, 0xaaa36}, {0xaaa40, 0xaaa4d}, {0xaaa50, 0xaaa59}, {0xaaa5c, 0xaaac2}, + {0xaaadb, 0xaaaf6}, {0xaab01, 0xaab06}, {0xaab09, 0xaab0e}, {0xaab11, 0xaab16}, + {0xaab20, 0xaab26}, {0xaab28, 0xaab2e}, {0xaab30, 0xaab65}, {0xaab70, 0xaabed}, + {0xaabf0, 0xaabf9}, {0xaac00, 0xad7a3}, {0xad7b0, 0xad7c6}, {0xad7cb, 0xad7fb}, + {0xaf900, 0xafa6d}, {0xafa70, 0xafad9}, {0xafb00, 0xafb06}, {0xafb13, 0xafb17}, + {0xafb1d, 0xafb36}, {0xafb38, 0xafb3c}, {0xafb46, 0xafbc1}, {0xafbd3, 0xafd3f}, + {0xafd50, 0xafd8f}, {0xafd92, 0xafdc7}, {0xafdf0, 0xafdfd}, {0xafe00, 0xafe19}, + {0xafe20, 0xafe52}, {0xafe54, 0xafe66}, {0xafe68, 0xafe6b}, {0xafe70, 0xafe74}, + {0xafe76, 0xafefc}, {0xaff01, 0xaffbe}, {0xaffc2, 0xaffc7}, {0xaffca, 0xaffcf}, + {0xaffd2, 0xaffd7}, {0xaffda, 0xaffdc}, {0xaffe0, 0xaffe6}, {0xaffe8, 0xaffee}, + {0xb0021, 0xb007e}, {0xb00a1, 0xb00ac}, {0xb00ae, 0xb0377}, {0xb037a, 0xb037f}, + {0xb0384, 0xb038a}, {0xb038e, 0xb03a1}, {0xb03a3, 0xb052f}, {0xb0531, 0xb0556}, + {0xb0559, 0xb055f}, {0xb0561, 0xb0587}, {0xb058d, 0xb058f}, {0xb0591, 0xb05c7}, + {0xb05d0, 0xb05ea}, {0xb05f0, 0xb05f4}, {0xb0606, 0xb061b}, {0xb061e, 0xb06dc}, + {0xb06de, 0xb070d}, {0xb0710, 0xb074a}, {0xb074d, 0xb07b1}, {0xb07c0, 0xb07fa}, + {0xb0800, 0xb082d}, {0xb0830, 0xb083e}, {0xb0840, 0xb085b}, {0xb0860, 0xb086a}, + {0xb08a0, 0xb08b4}, {0xb08b6, 0xb08bd}, {0xb08d4, 0xb08e1}, {0xb08e3, 0xb0983}, + {0xb0985, 0xb098c}, {0xb0993, 0xb09a8}, {0xb09aa, 0xb09b0}, {0xb09b6, 0xb09b9}, + {0xb09bc, 0xb09c4}, {0xb09cb, 0xb09ce}, {0xb09df, 0xb09e3}, {0xb09e6, 0xb09fd}, + {0xb0a01, 0xb0a03}, {0xb0a05, 0xb0a0a}, {0xb0a13, 0xb0a28}, {0xb0a2a, 0xb0a30}, + {0xb0a3e, 0xb0a42}, {0xb0a4b, 0xb0a4d}, {0xb0a59, 0xb0a5c}, {0xb0a66, 0xb0a75}, + {0xb0a81, 0xb0a83}, {0xb0a85, 0xb0a8d}, {0xb0a8f, 0xb0a91}, {0xb0a93, 0xb0aa8}, + {0xb0aaa, 0xb0ab0}, {0xb0ab5, 0xb0ab9}, {0xb0abc, 0xb0ac5}, {0xb0ac7, 0xb0ac9}, + {0xb0acb, 0xb0acd}, {0xb0ae0, 0xb0ae3}, {0xb0ae6, 0xb0af1}, {0xb0af9, 0xb0aff}, + {0xb0b01, 0xb0b03}, {0xb0b05, 0xb0b0c}, {0xb0b13, 0xb0b28}, {0xb0b2a, 0xb0b30}, + {0xb0b35, 0xb0b39}, {0xb0b3c, 0xb0b44}, {0xb0b4b, 0xb0b4d}, {0xb0b5f, 0xb0b63}, + {0xb0b66, 0xb0b77}, {0xb0b85, 0xb0b8a}, {0xb0b8e, 0xb0b90}, {0xb0b92, 0xb0b95}, + {0xb0ba8, 0xb0baa}, {0xb0bae, 0xb0bb9}, {0xb0bbe, 0xb0bc2}, {0xb0bc6, 0xb0bc8}, + {0xb0bca, 0xb0bcd}, {0xb0be6, 0xb0bfa}, {0xb0c00, 0xb0c03}, {0xb0c05, 0xb0c0c}, + {0xb0c0e, 0xb0c10}, {0xb0c12, 0xb0c28}, {0xb0c2a, 0xb0c39}, {0xb0c3d, 0xb0c44}, + {0xb0c46, 0xb0c48}, {0xb0c4a, 0xb0c4d}, {0xb0c58, 0xb0c5a}, {0xb0c60, 0xb0c63}, + {0xb0c66, 0xb0c6f}, {0xb0c78, 0xb0c83}, {0xb0c85, 0xb0c8c}, {0xb0c8e, 0xb0c90}, + {0xb0c92, 0xb0ca8}, {0xb0caa, 0xb0cb3}, {0xb0cb5, 0xb0cb9}, {0xb0cbc, 0xb0cc4}, + {0xb0cc6, 0xb0cc8}, {0xb0cca, 0xb0ccd}, {0xb0ce0, 0xb0ce3}, {0xb0ce6, 0xb0cef}, + {0xb0d00, 0xb0d03}, {0xb0d05, 0xb0d0c}, {0xb0d0e, 0xb0d10}, {0xb0d12, 0xb0d44}, + {0xb0d46, 0xb0d48}, {0xb0d4a, 0xb0d4f}, {0xb0d54, 0xb0d63}, {0xb0d66, 0xb0d7f}, + {0xb0d85, 0xb0d96}, {0xb0d9a, 0xb0db1}, {0xb0db3, 0xb0dbb}, {0xb0dc0, 0xb0dc6}, + {0xb0dcf, 0xb0dd4}, {0xb0dd8, 0xb0ddf}, {0xb0de6, 0xb0def}, {0xb0df2, 0xb0df4}, + {0xb0e01, 0xb0e3a}, {0xb0e3f, 0xb0e5b}, {0xb0e94, 0xb0e97}, {0xb0e99, 0xb0e9f}, + {0xb0ea1, 0xb0ea3}, {0xb0ead, 0xb0eb9}, {0xb0ebb, 0xb0ebd}, {0xb0ec0, 0xb0ec4}, + {0xb0ec8, 0xb0ecd}, {0xb0ed0, 0xb0ed9}, {0xb0edc, 0xb0edf}, {0xb0f00, 0xb0f47}, + {0xb0f49, 0xb0f6c}, {0xb0f71, 0xb0f97}, {0xb0f99, 0xb0fbc}, {0xb0fbe, 0xb0fcc}, + {0xb0fce, 0xb0fda}, {0xb1000, 0xb10c5}, {0xb10d0, 0xb1248}, {0xb124a, 0xb124d}, + {0xb1250, 0xb1256}, {0xb125a, 0xb125d}, {0xb1260, 0xb1288}, {0xb128a, 0xb128d}, + {0xb1290, 0xb12b0}, {0xb12b2, 0xb12b5}, {0xb12b8, 0xb12be}, {0xb12c2, 0xb12c5}, + {0xb12c8, 0xb12d6}, {0xb12d8, 0xb1310}, {0xb1312, 0xb1315}, {0xb1318, 0xb135a}, + {0xb135d, 0xb137c}, {0xb1380, 0xb1399}, {0xb13a0, 0xb13f5}, {0xb13f8, 0xb13fd}, + {0xb1400, 0xb167f}, {0xb1681, 0xb169c}, {0xb16a0, 0xb16f8}, {0xb1700, 0xb170c}, + {0xb170e, 0xb1714}, {0xb1720, 0xb1736}, {0xb1740, 0xb1753}, {0xb1760, 0xb176c}, + {0xb176e, 0xb1770}, {0xb1780, 0xb17dd}, {0xb17e0, 0xb17e9}, {0xb17f0, 0xb17f9}, + {0xb1800, 0xb180d}, {0xb1810, 0xb1819}, {0xb1820, 0xb1877}, {0xb1880, 0xb18aa}, + {0xb18b0, 0xb18f5}, {0xb1900, 0xb191e}, {0xb1920, 0xb192b}, {0xb1930, 0xb193b}, + {0xb1944, 0xb196d}, {0xb1970, 0xb1974}, {0xb1980, 0xb19ab}, {0xb19b0, 0xb19c9}, + {0xb19d0, 0xb19da}, {0xb19de, 0xb1a1b}, {0xb1a1e, 0xb1a5e}, {0xb1a60, 0xb1a7c}, + {0xb1a7f, 0xb1a89}, {0xb1a90, 0xb1a99}, {0xb1aa0, 0xb1aad}, {0xb1ab0, 0xb1abe}, + {0xb1b00, 0xb1b4b}, {0xb1b50, 0xb1b7c}, {0xb1b80, 0xb1bf3}, {0xb1bfc, 0xb1c37}, + {0xb1c3b, 0xb1c49}, {0xb1c4d, 0xb1c88}, {0xb1cc0, 0xb1cc7}, {0xb1cd0, 0xb1cf9}, + {0xb1d00, 0xb1df9}, {0xb1dfb, 0xb1f15}, {0xb1f18, 0xb1f1d}, {0xb1f20, 0xb1f45}, + {0xb1f48, 0xb1f4d}, {0xb1f50, 0xb1f57}, {0xb1f5f, 0xb1f7d}, {0xb1f80, 0xb1fb4}, + {0xb1fb6, 0xb1fc4}, {0xb1fc6, 0xb1fd3}, {0xb1fd6, 0xb1fdb}, {0xb1fdd, 0xb1fef}, + {0xb1ff2, 0xb1ff4}, {0xb1ff6, 0xb1ffe}, {0xb2010, 0xb2027}, {0xb2030, 0xb205e}, + {0xb2074, 0xb208e}, {0xb2090, 0xb209c}, {0xb20a0, 0xb20bf}, {0xb20d0, 0xb20f0}, + {0xb2100, 0xb218b}, {0xb2190, 0xb2426}, {0xb2440, 0xb244a}, {0xb2460, 0xb2b73}, + {0xb2b76, 0xb2b95}, {0xb2b98, 0xb2bb9}, {0xb2bbd, 0xb2bc8}, {0xb2bca, 0xb2bd2}, + {0xb2bec, 0xb2bef}, {0xb2c00, 0xb2c2e}, {0xb2c30, 0xb2c5e}, {0xb2c60, 0xb2cf3}, + {0xb2cf9, 0xb2d25}, {0xb2d30, 0xb2d67}, {0xb2d7f, 0xb2d96}, {0xb2da0, 0xb2da6}, + {0xb2da8, 0xb2dae}, {0xb2db0, 0xb2db6}, {0xb2db8, 0xb2dbe}, {0xb2dc0, 0xb2dc6}, + {0xb2dc8, 0xb2dce}, {0xb2dd0, 0xb2dd6}, {0xb2dd8, 0xb2dde}, {0xb2de0, 0xb2e49}, + {0xb2e80, 0xb2e99}, {0xb2e9b, 0xb2ef3}, {0xb2f00, 0xb2fd5}, {0xb2ff0, 0xb2ffb}, + {0xb3001, 0xb303f}, {0xb3041, 0xb3096}, {0xb3099, 0xb30ff}, {0xb3105, 0xb312e}, + {0xb3131, 0xb318e}, {0xb3190, 0xb31ba}, {0xb31c0, 0xb31e3}, {0xb31f0, 0xb321e}, + {0xb3220, 0xb32fe}, {0xb3300, 0xb4db5}, {0xb4dc0, 0xb9fea}, {0xba000, 0xba48c}, + {0xba490, 0xba4c6}, {0xba4d0, 0xba62b}, {0xba640, 0xba6f7}, {0xba700, 0xba7ae}, + {0xba7b0, 0xba7b7}, {0xba7f7, 0xba82b}, {0xba830, 0xba839}, {0xba840, 0xba877}, + {0xba880, 0xba8c5}, {0xba8ce, 0xba8d9}, {0xba8e0, 0xba8fd}, {0xba900, 0xba953}, + {0xba95f, 0xba97c}, {0xba980, 0xba9cd}, {0xba9cf, 0xba9d9}, {0xba9de, 0xba9fe}, + {0xbaa00, 0xbaa36}, {0xbaa40, 0xbaa4d}, {0xbaa50, 0xbaa59}, {0xbaa5c, 0xbaac2}, + {0xbaadb, 0xbaaf6}, {0xbab01, 0xbab06}, {0xbab09, 0xbab0e}, {0xbab11, 0xbab16}, + {0xbab20, 0xbab26}, {0xbab28, 0xbab2e}, {0xbab30, 0xbab65}, {0xbab70, 0xbabed}, + {0xbabf0, 0xbabf9}, {0xbac00, 0xbd7a3}, {0xbd7b0, 0xbd7c6}, {0xbd7cb, 0xbd7fb}, + {0xbf900, 0xbfa6d}, {0xbfa70, 0xbfad9}, {0xbfb00, 0xbfb06}, {0xbfb13, 0xbfb17}, + {0xbfb1d, 0xbfb36}, {0xbfb38, 0xbfb3c}, {0xbfb46, 0xbfbc1}, {0xbfbd3, 0xbfd3f}, + {0xbfd50, 0xbfd8f}, {0xbfd92, 0xbfdc7}, {0xbfdf0, 0xbfdfd}, {0xbfe00, 0xbfe19}, + {0xbfe20, 0xbfe52}, {0xbfe54, 0xbfe66}, {0xbfe68, 0xbfe6b}, {0xbfe70, 0xbfe74}, + {0xbfe76, 0xbfefc}, {0xbff01, 0xbffbe}, {0xbffc2, 0xbffc7}, {0xbffca, 0xbffcf}, + {0xbffd2, 0xbffd7}, {0xbffda, 0xbffdc}, {0xbffe0, 0xbffe6}, {0xbffe8, 0xbffee}, + {0xc0021, 0xc007e}, {0xc00a1, 0xc00ac}, {0xc00ae, 0xc0377}, {0xc037a, 0xc037f}, + {0xc0384, 0xc038a}, {0xc038e, 0xc03a1}, {0xc03a3, 0xc052f}, {0xc0531, 0xc0556}, + {0xc0559, 0xc055f}, {0xc0561, 0xc0587}, {0xc058d, 0xc058f}, {0xc0591, 0xc05c7}, + {0xc05d0, 0xc05ea}, {0xc05f0, 0xc05f4}, {0xc0606, 0xc061b}, {0xc061e, 0xc06dc}, + {0xc06de, 0xc070d}, {0xc0710, 0xc074a}, {0xc074d, 0xc07b1}, {0xc07c0, 0xc07fa}, + {0xc0800, 0xc082d}, {0xc0830, 0xc083e}, {0xc0840, 0xc085b}, {0xc0860, 0xc086a}, + {0xc08a0, 0xc08b4}, {0xc08b6, 0xc08bd}, {0xc08d4, 0xc08e1}, {0xc08e3, 0xc0983}, + {0xc0985, 0xc098c}, {0xc0993, 0xc09a8}, {0xc09aa, 0xc09b0}, {0xc09b6, 0xc09b9}, + {0xc09bc, 0xc09c4}, {0xc09cb, 0xc09ce}, {0xc09df, 0xc09e3}, {0xc09e6, 0xc09fd}, + {0xc0a01, 0xc0a03}, {0xc0a05, 0xc0a0a}, {0xc0a13, 0xc0a28}, {0xc0a2a, 0xc0a30}, + {0xc0a3e, 0xc0a42}, {0xc0a4b, 0xc0a4d}, {0xc0a59, 0xc0a5c}, {0xc0a66, 0xc0a75}, + {0xc0a81, 0xc0a83}, {0xc0a85, 0xc0a8d}, {0xc0a8f, 0xc0a91}, {0xc0a93, 0xc0aa8}, + {0xc0aaa, 0xc0ab0}, {0xc0ab5, 0xc0ab9}, {0xc0abc, 0xc0ac5}, {0xc0ac7, 0xc0ac9}, + {0xc0acb, 0xc0acd}, {0xc0ae0, 0xc0ae3}, {0xc0ae6, 0xc0af1}, {0xc0af9, 0xc0aff}, + {0xc0b01, 0xc0b03}, {0xc0b05, 0xc0b0c}, {0xc0b13, 0xc0b28}, {0xc0b2a, 0xc0b30}, + {0xc0b35, 0xc0b39}, {0xc0b3c, 0xc0b44}, {0xc0b4b, 0xc0b4d}, {0xc0b5f, 0xc0b63}, + {0xc0b66, 0xc0b77}, {0xc0b85, 0xc0b8a}, {0xc0b8e, 0xc0b90}, {0xc0b92, 0xc0b95}, + {0xc0ba8, 0xc0baa}, {0xc0bae, 0xc0bb9}, {0xc0bbe, 0xc0bc2}, {0xc0bc6, 0xc0bc8}, + {0xc0bca, 0xc0bcd}, {0xc0be6, 0xc0bfa}, {0xc0c00, 0xc0c03}, {0xc0c05, 0xc0c0c}, + {0xc0c0e, 0xc0c10}, {0xc0c12, 0xc0c28}, {0xc0c2a, 0xc0c39}, {0xc0c3d, 0xc0c44}, + {0xc0c46, 0xc0c48}, {0xc0c4a, 0xc0c4d}, {0xc0c58, 0xc0c5a}, {0xc0c60, 0xc0c63}, + {0xc0c66, 0xc0c6f}, {0xc0c78, 0xc0c83}, {0xc0c85, 0xc0c8c}, {0xc0c8e, 0xc0c90}, + {0xc0c92, 0xc0ca8}, {0xc0caa, 0xc0cb3}, {0xc0cb5, 0xc0cb9}, {0xc0cbc, 0xc0cc4}, + {0xc0cc6, 0xc0cc8}, {0xc0cca, 0xc0ccd}, {0xc0ce0, 0xc0ce3}, {0xc0ce6, 0xc0cef}, + {0xc0d00, 0xc0d03}, {0xc0d05, 0xc0d0c}, {0xc0d0e, 0xc0d10}, {0xc0d12, 0xc0d44}, + {0xc0d46, 0xc0d48}, {0xc0d4a, 0xc0d4f}, {0xc0d54, 0xc0d63}, {0xc0d66, 0xc0d7f}, + {0xc0d85, 0xc0d96}, {0xc0d9a, 0xc0db1}, {0xc0db3, 0xc0dbb}, {0xc0dc0, 0xc0dc6}, + {0xc0dcf, 0xc0dd4}, {0xc0dd8, 0xc0ddf}, {0xc0de6, 0xc0def}, {0xc0df2, 0xc0df4}, + {0xc0e01, 0xc0e3a}, {0xc0e3f, 0xc0e5b}, {0xc0e94, 0xc0e97}, {0xc0e99, 0xc0e9f}, + {0xc0ea1, 0xc0ea3}, {0xc0ead, 0xc0eb9}, {0xc0ebb, 0xc0ebd}, {0xc0ec0, 0xc0ec4}, + {0xc0ec8, 0xc0ecd}, {0xc0ed0, 0xc0ed9}, {0xc0edc, 0xc0edf}, {0xc0f00, 0xc0f47}, + {0xc0f49, 0xc0f6c}, {0xc0f71, 0xc0f97}, {0xc0f99, 0xc0fbc}, {0xc0fbe, 0xc0fcc}, + {0xc0fce, 0xc0fda}, {0xc1000, 0xc10c5}, {0xc10d0, 0xc1248}, {0xc124a, 0xc124d}, + {0xc1250, 0xc1256}, {0xc125a, 0xc125d}, {0xc1260, 0xc1288}, {0xc128a, 0xc128d}, + {0xc1290, 0xc12b0}, {0xc12b2, 0xc12b5}, {0xc12b8, 0xc12be}, {0xc12c2, 0xc12c5}, + {0xc12c8, 0xc12d6}, {0xc12d8, 0xc1310}, {0xc1312, 0xc1315}, {0xc1318, 0xc135a}, + {0xc135d, 0xc137c}, {0xc1380, 0xc1399}, {0xc13a0, 0xc13f5}, {0xc13f8, 0xc13fd}, + {0xc1400, 0xc167f}, {0xc1681, 0xc169c}, {0xc16a0, 0xc16f8}, {0xc1700, 0xc170c}, + {0xc170e, 0xc1714}, {0xc1720, 0xc1736}, {0xc1740, 0xc1753}, {0xc1760, 0xc176c}, + {0xc176e, 0xc1770}, {0xc1780, 0xc17dd}, {0xc17e0, 0xc17e9}, {0xc17f0, 0xc17f9}, + {0xc1800, 0xc180d}, {0xc1810, 0xc1819}, {0xc1820, 0xc1877}, {0xc1880, 0xc18aa}, + {0xc18b0, 0xc18f5}, {0xc1900, 0xc191e}, {0xc1920, 0xc192b}, {0xc1930, 0xc193b}, + {0xc1944, 0xc196d}, {0xc1970, 0xc1974}, {0xc1980, 0xc19ab}, {0xc19b0, 0xc19c9}, + {0xc19d0, 0xc19da}, {0xc19de, 0xc1a1b}, {0xc1a1e, 0xc1a5e}, {0xc1a60, 0xc1a7c}, + {0xc1a7f, 0xc1a89}, {0xc1a90, 0xc1a99}, {0xc1aa0, 0xc1aad}, {0xc1ab0, 0xc1abe}, + {0xc1b00, 0xc1b4b}, {0xc1b50, 0xc1b7c}, {0xc1b80, 0xc1bf3}, {0xc1bfc, 0xc1c37}, + {0xc1c3b, 0xc1c49}, {0xc1c4d, 0xc1c88}, {0xc1cc0, 0xc1cc7}, {0xc1cd0, 0xc1cf9}, + {0xc1d00, 0xc1df9}, {0xc1dfb, 0xc1f15}, {0xc1f18, 0xc1f1d}, {0xc1f20, 0xc1f45}, + {0xc1f48, 0xc1f4d}, {0xc1f50, 0xc1f57}, {0xc1f5f, 0xc1f7d}, {0xc1f80, 0xc1fb4}, + {0xc1fb6, 0xc1fc4}, {0xc1fc6, 0xc1fd3}, {0xc1fd6, 0xc1fdb}, {0xc1fdd, 0xc1fef}, + {0xc1ff2, 0xc1ff4}, {0xc1ff6, 0xc1ffe}, {0xc2010, 0xc2027}, {0xc2030, 0xc205e}, + {0xc2074, 0xc208e}, {0xc2090, 0xc209c}, {0xc20a0, 0xc20bf}, {0xc20d0, 0xc20f0}, + {0xc2100, 0xc218b}, {0xc2190, 0xc2426}, {0xc2440, 0xc244a}, {0xc2460, 0xc2b73}, + {0xc2b76, 0xc2b95}, {0xc2b98, 0xc2bb9}, {0xc2bbd, 0xc2bc8}, {0xc2bca, 0xc2bd2}, + {0xc2bec, 0xc2bef}, {0xc2c00, 0xc2c2e}, {0xc2c30, 0xc2c5e}, {0xc2c60, 0xc2cf3}, + {0xc2cf9, 0xc2d25}, {0xc2d30, 0xc2d67}, {0xc2d7f, 0xc2d96}, {0xc2da0, 0xc2da6}, + {0xc2da8, 0xc2dae}, {0xc2db0, 0xc2db6}, {0xc2db8, 0xc2dbe}, {0xc2dc0, 0xc2dc6}, + {0xc2dc8, 0xc2dce}, {0xc2dd0, 0xc2dd6}, {0xc2dd8, 0xc2dde}, {0xc2de0, 0xc2e49}, + {0xc2e80, 0xc2e99}, {0xc2e9b, 0xc2ef3}, {0xc2f00, 0xc2fd5}, {0xc2ff0, 0xc2ffb}, + {0xc3001, 0xc303f}, {0xc3041, 0xc3096}, {0xc3099, 0xc30ff}, {0xc3105, 0xc312e}, + {0xc3131, 0xc318e}, {0xc3190, 0xc31ba}, {0xc31c0, 0xc31e3}, {0xc31f0, 0xc321e}, + {0xc3220, 0xc32fe}, {0xc3300, 0xc4db5}, {0xc4dc0, 0xc9fea}, {0xca000, 0xca48c}, + {0xca490, 0xca4c6}, {0xca4d0, 0xca62b}, {0xca640, 0xca6f7}, {0xca700, 0xca7ae}, + {0xca7b0, 0xca7b7}, {0xca7f7, 0xca82b}, {0xca830, 0xca839}, {0xca840, 0xca877}, + {0xca880, 0xca8c5}, {0xca8ce, 0xca8d9}, {0xca8e0, 0xca8fd}, {0xca900, 0xca953}, + {0xca95f, 0xca97c}, {0xca980, 0xca9cd}, {0xca9cf, 0xca9d9}, {0xca9de, 0xca9fe}, + {0xcaa00, 0xcaa36}, {0xcaa40, 0xcaa4d}, {0xcaa50, 0xcaa59}, {0xcaa5c, 0xcaac2}, + {0xcaadb, 0xcaaf6}, {0xcab01, 0xcab06}, {0xcab09, 0xcab0e}, {0xcab11, 0xcab16}, + {0xcab20, 0xcab26}, {0xcab28, 0xcab2e}, {0xcab30, 0xcab65}, {0xcab70, 0xcabed}, + {0xcabf0, 0xcabf9}, {0xcac00, 0xcd7a3}, {0xcd7b0, 0xcd7c6}, {0xcd7cb, 0xcd7fb}, + {0xcf900, 0xcfa6d}, {0xcfa70, 0xcfad9}, {0xcfb00, 0xcfb06}, {0xcfb13, 0xcfb17}, + {0xcfb1d, 0xcfb36}, {0xcfb38, 0xcfb3c}, {0xcfb46, 0xcfbc1}, {0xcfbd3, 0xcfd3f}, + {0xcfd50, 0xcfd8f}, {0xcfd92, 0xcfdc7}, {0xcfdf0, 0xcfdfd}, {0xcfe00, 0xcfe19}, + {0xcfe20, 0xcfe52}, {0xcfe54, 0xcfe66}, {0xcfe68, 0xcfe6b}, {0xcfe70, 0xcfe74}, + {0xcfe76, 0xcfefc}, {0xcff01, 0xcffbe}, {0xcffc2, 0xcffc7}, {0xcffca, 0xcffcf}, + {0xcffd2, 0xcffd7}, {0xcffda, 0xcffdc}, {0xcffe0, 0xcffe6}, {0xcffe8, 0xcffee}, + {0xd0021, 0xd007e}, {0xd00a1, 0xd00ac}, {0xd00ae, 0xd0377}, {0xd037a, 0xd037f}, + {0xd0384, 0xd038a}, {0xd038e, 0xd03a1}, {0xd03a3, 0xd052f}, {0xd0531, 0xd0556}, + {0xd0559, 0xd055f}, {0xd0561, 0xd0587}, {0xd058d, 0xd058f}, {0xd0591, 0xd05c7}, + {0xd05d0, 0xd05ea}, {0xd05f0, 0xd05f4}, {0xd0606, 0xd061b}, {0xd061e, 0xd06dc}, + {0xd06de, 0xd070d}, {0xd0710, 0xd074a}, {0xd074d, 0xd07b1}, {0xd07c0, 0xd07fa}, + {0xd0800, 0xd082d}, {0xd0830, 0xd083e}, {0xd0840, 0xd085b}, {0xd0860, 0xd086a}, + {0xd08a0, 0xd08b4}, {0xd08b6, 0xd08bd}, {0xd08d4, 0xd08e1}, {0xd08e3, 0xd0983}, + {0xd0985, 0xd098c}, {0xd0993, 0xd09a8}, {0xd09aa, 0xd09b0}, {0xd09b6, 0xd09b9}, + {0xd09bc, 0xd09c4}, {0xd09cb, 0xd09ce}, {0xd09df, 0xd09e3}, {0xd09e6, 0xd09fd}, + {0xd0a01, 0xd0a03}, {0xd0a05, 0xd0a0a}, {0xd0a13, 0xd0a28}, {0xd0a2a, 0xd0a30}, + {0xd0a3e, 0xd0a42}, {0xd0a4b, 0xd0a4d}, {0xd0a59, 0xd0a5c}, {0xd0a66, 0xd0a75}, + {0xd0a81, 0xd0a83}, {0xd0a85, 0xd0a8d}, {0xd0a8f, 0xd0a91}, {0xd0a93, 0xd0aa8}, + {0xd0aaa, 0xd0ab0}, {0xd0ab5, 0xd0ab9}, {0xd0abc, 0xd0ac5}, {0xd0ac7, 0xd0ac9}, + {0xd0acb, 0xd0acd}, {0xd0ae0, 0xd0ae3}, {0xd0ae6, 0xd0af1}, {0xd0af9, 0xd0aff}, + {0xd0b01, 0xd0b03}, {0xd0b05, 0xd0b0c}, {0xd0b13, 0xd0b28}, {0xd0b2a, 0xd0b30}, + {0xd0b35, 0xd0b39}, {0xd0b3c, 0xd0b44}, {0xd0b4b, 0xd0b4d}, {0xd0b5f, 0xd0b63}, + {0xd0b66, 0xd0b77}, {0xd0b85, 0xd0b8a}, {0xd0b8e, 0xd0b90}, {0xd0b92, 0xd0b95}, + {0xd0ba8, 0xd0baa}, {0xd0bae, 0xd0bb9}, {0xd0bbe, 0xd0bc2}, {0xd0bc6, 0xd0bc8}, + {0xd0bca, 0xd0bcd}, {0xd0be6, 0xd0bfa}, {0xd0c00, 0xd0c03}, {0xd0c05, 0xd0c0c}, + {0xd0c0e, 0xd0c10}, {0xd0c12, 0xd0c28}, {0xd0c2a, 0xd0c39}, {0xd0c3d, 0xd0c44}, + {0xd0c46, 0xd0c48}, {0xd0c4a, 0xd0c4d}, {0xd0c58, 0xd0c5a}, {0xd0c60, 0xd0c63}, + {0xd0c66, 0xd0c6f}, {0xd0c78, 0xd0c83}, {0xd0c85, 0xd0c8c}, {0xd0c8e, 0xd0c90}, + {0xd0c92, 0xd0ca8}, {0xd0caa, 0xd0cb3}, {0xd0cb5, 0xd0cb9}, {0xd0cbc, 0xd0cc4}, + {0xd0cc6, 0xd0cc8}, {0xd0cca, 0xd0ccd}, {0xd0ce0, 0xd0ce3}, {0xd0ce6, 0xd0cef}, + {0xd0d00, 0xd0d03}, {0xd0d05, 0xd0d0c}, {0xd0d0e, 0xd0d10}, {0xd0d12, 0xd0d44}, + {0xd0d46, 0xd0d48}, {0xd0d4a, 0xd0d4f}, {0xd0d54, 0xd0d63}, {0xd0d66, 0xd0d7f}, + {0xd0d85, 0xd0d96}, {0xd0d9a, 0xd0db1}, {0xd0db3, 0xd0dbb}, {0xd0dc0, 0xd0dc6}, + {0xd0dcf, 0xd0dd4}, {0xd0dd8, 0xd0ddf}, {0xd0de6, 0xd0def}, {0xd0df2, 0xd0df4}, + {0xd0e01, 0xd0e3a}, {0xd0e3f, 0xd0e5b}, {0xd0e94, 0xd0e97}, {0xd0e99, 0xd0e9f}, + {0xd0ea1, 0xd0ea3}, {0xd0ead, 0xd0eb9}, {0xd0ebb, 0xd0ebd}, {0xd0ec0, 0xd0ec4}, + {0xd0ec8, 0xd0ecd}, {0xd0ed0, 0xd0ed9}, {0xd0edc, 0xd0edf}, {0xd0f00, 0xd0f47}, + {0xd0f49, 0xd0f6c}, {0xd0f71, 0xd0f97}, {0xd0f99, 0xd0fbc}, {0xd0fbe, 0xd0fcc}, + {0xd0fce, 0xd0fda}, {0xd1000, 0xd10c5}, {0xd10d0, 0xd1248}, {0xd124a, 0xd124d}, + {0xd1250, 0xd1256}, {0xd125a, 0xd125d}, {0xd1260, 0xd1288}, {0xd128a, 0xd128d}, + {0xd1290, 0xd12b0}, {0xd12b2, 0xd12b5}, {0xd12b8, 0xd12be}, {0xd12c2, 0xd12c5}, + {0xd12c8, 0xd12d6}, {0xd12d8, 0xd1310}, {0xd1312, 0xd1315}, {0xd1318, 0xd135a}, + {0xd135d, 0xd137c}, {0xd1380, 0xd1399}, {0xd13a0, 0xd13f5}, {0xd13f8, 0xd13fd}, + {0xd1400, 0xd167f}, {0xd1681, 0xd169c}, {0xd16a0, 0xd16f8}, {0xd1700, 0xd170c}, + {0xd170e, 0xd1714}, {0xd1720, 0xd1736}, {0xd1740, 0xd1753}, {0xd1760, 0xd176c}, + {0xd176e, 0xd1770}, {0xd1780, 0xd17dd}, {0xd17e0, 0xd17e9}, {0xd17f0, 0xd17f9}, + {0xd1800, 0xd180d}, {0xd1810, 0xd1819}, {0xd1820, 0xd1877}, {0xd1880, 0xd18aa}, + {0xd18b0, 0xd18f5}, {0xd1900, 0xd191e}, {0xd1920, 0xd192b}, {0xd1930, 0xd193b}, + {0xd1944, 0xd196d}, {0xd1970, 0xd1974}, {0xd1980, 0xd19ab}, {0xd19b0, 0xd19c9}, + {0xd19d0, 0xd19da}, {0xd19de, 0xd1a1b}, {0xd1a1e, 0xd1a5e}, {0xd1a60, 0xd1a7c}, + {0xd1a7f, 0xd1a89}, {0xd1a90, 0xd1a99}, {0xd1aa0, 0xd1aad}, {0xd1ab0, 0xd1abe}, + {0xd1b00, 0xd1b4b}, {0xd1b50, 0xd1b7c}, {0xd1b80, 0xd1bf3}, {0xd1bfc, 0xd1c37}, + {0xd1c3b, 0xd1c49}, {0xd1c4d, 0xd1c88}, {0xd1cc0, 0xd1cc7}, {0xd1cd0, 0xd1cf9}, + {0xd1d00, 0xd1df9}, {0xd1dfb, 0xd1f15}, {0xd1f18, 0xd1f1d}, {0xd1f20, 0xd1f45}, + {0xd1f48, 0xd1f4d}, {0xd1f50, 0xd1f57}, {0xd1f5f, 0xd1f7d}, {0xd1f80, 0xd1fb4}, + {0xd1fb6, 0xd1fc4}, {0xd1fc6, 0xd1fd3}, {0xd1fd6, 0xd1fdb}, {0xd1fdd, 0xd1fef}, + {0xd1ff2, 0xd1ff4}, {0xd1ff6, 0xd1ffe}, {0xd2010, 0xd2027}, {0xd2030, 0xd205e}, + {0xd2074, 0xd208e}, {0xd2090, 0xd209c}, {0xd20a0, 0xd20bf}, {0xd20d0, 0xd20f0}, + {0xd2100, 0xd218b}, {0xd2190, 0xd2426}, {0xd2440, 0xd244a}, {0xd2460, 0xd2b73}, + {0xd2b76, 0xd2b95}, {0xd2b98, 0xd2bb9}, {0xd2bbd, 0xd2bc8}, {0xd2bca, 0xd2bd2}, + {0xd2bec, 0xd2bef}, {0xd2c00, 0xd2c2e}, {0xd2c30, 0xd2c5e}, {0xd2c60, 0xd2cf3}, + {0xd2cf9, 0xd2d25}, {0xd2d30, 0xd2d67}, {0xd2d7f, 0xd2d96}, {0xd2da0, 0xd2da6}, + {0xd2da8, 0xd2dae}, {0xd2db0, 0xd2db6}, {0xd2db8, 0xd2dbe}, {0xd2dc0, 0xd2dc6}, + {0xd2dc8, 0xd2dce}, {0xd2dd0, 0xd2dd6}, {0xd2dd8, 0xd2dde}, {0xd2de0, 0xd2e49}, + {0xd2e80, 0xd2e99}, {0xd2e9b, 0xd2ef3}, {0xd2f00, 0xd2fd5}, {0xd2ff0, 0xd2ffb}, + {0xd3001, 0xd303f}, {0xd3041, 0xd3096}, {0xd3099, 0xd30ff}, {0xd3105, 0xd312e}, + {0xd3131, 0xd318e}, {0xd3190, 0xd31ba}, {0xd31c0, 0xd31e3}, {0xd31f0, 0xd321e}, + {0xd3220, 0xd32fe}, {0xd3300, 0xd4db5}, {0xd4dc0, 0xd9fea}, {0xda000, 0xda48c}, + {0xda490, 0xda4c6}, {0xda4d0, 0xda62b}, {0xda640, 0xda6f7}, {0xda700, 0xda7ae}, + {0xda7b0, 0xda7b7}, {0xda7f7, 0xda82b}, {0xda830, 0xda839}, {0xda840, 0xda877}, + {0xda880, 0xda8c5}, {0xda8ce, 0xda8d9}, {0xda8e0, 0xda8fd}, {0xda900, 0xda953}, + {0xda95f, 0xda97c}, {0xda980, 0xda9cd}, {0xda9cf, 0xda9d9}, {0xda9de, 0xda9fe}, + {0xdaa00, 0xdaa36}, {0xdaa40, 0xdaa4d}, {0xdaa50, 0xdaa59}, {0xdaa5c, 0xdaac2}, + {0xdaadb, 0xdaaf6}, {0xdab01, 0xdab06}, {0xdab09, 0xdab0e}, {0xdab11, 0xdab16}, + {0xdab20, 0xdab26}, {0xdab28, 0xdab2e}, {0xdab30, 0xdab65}, {0xdab70, 0xdabed}, + {0xdabf0, 0xdabf9}, {0xdac00, 0xdd7a3}, {0xdd7b0, 0xdd7c6}, {0xdd7cb, 0xdd7fb}, + {0xdf900, 0xdfa6d}, {0xdfa70, 0xdfad9}, {0xdfb00, 0xdfb06}, {0xdfb13, 0xdfb17}, + {0xdfb1d, 0xdfb36}, {0xdfb38, 0xdfb3c}, {0xdfb46, 0xdfbc1}, {0xdfbd3, 0xdfd3f}, + {0xdfd50, 0xdfd8f}, {0xdfd92, 0xdfdc7}, {0xdfdf0, 0xdfdfd}, {0xdfe00, 0xdfe19}, + {0xdfe20, 0xdfe52}, {0xdfe54, 0xdfe66}, {0xdfe68, 0xdfe6b}, {0xdfe70, 0xdfe74}, + {0xdfe76, 0xdfefc}, {0xdff01, 0xdffbe}, {0xdffc2, 0xdffc7}, {0xdffca, 0xdffcf}, + {0xdffd2, 0xdffd7}, {0xdffda, 0xdffdc}, {0xdffe0, 0xdffe6}, {0xdffe8, 0xdffee}, + {0xe0021, 0xe007e}, {0xe00a1, 0xe00ac}, {0xe00ae, 0xe0377}, {0xe037a, 0xe037f}, + {0xe0384, 0xe038a}, {0xe038e, 0xe03a1}, {0xe03a3, 0xe052f}, {0xe0531, 0xe0556}, + {0xe0559, 0xe055f}, {0xe0561, 0xe0587}, {0xe058d, 0xe058f}, {0xe0591, 0xe05c7}, + {0xe05d0, 0xe05ea}, {0xe05f0, 0xe05f4}, {0xe0606, 0xe061b}, {0xe061e, 0xe06dc}, + {0xe06de, 0xe070d}, {0xe0710, 0xe074a}, {0xe074d, 0xe07b1}, {0xe07c0, 0xe07fa}, + {0xe0800, 0xe082d}, {0xe0830, 0xe083e}, {0xe0840, 0xe085b}, {0xe0860, 0xe086a}, + {0xe08a0, 0xe08b4}, {0xe08b6, 0xe08bd}, {0xe08d4, 0xe08e1}, {0xe08e3, 0xe0983}, + {0xe0985, 0xe098c}, {0xe0993, 0xe09a8}, {0xe09aa, 0xe09b0}, {0xe09b6, 0xe09b9}, + {0xe09bc, 0xe09c4}, {0xe09cb, 0xe09ce}, {0xe09df, 0xe09e3}, {0xe09e6, 0xe09fd}, + {0xe0a01, 0xe0a03}, {0xe0a05, 0xe0a0a}, {0xe0a13, 0xe0a28}, {0xe0a2a, 0xe0a30}, + {0xe0a3e, 0xe0a42}, {0xe0a4b, 0xe0a4d}, {0xe0a59, 0xe0a5c}, {0xe0a66, 0xe0a75}, + {0xe0a81, 0xe0a83}, {0xe0a85, 0xe0a8d}, {0xe0a8f, 0xe0a91}, {0xe0a93, 0xe0aa8}, + {0xe0aaa, 0xe0ab0}, {0xe0ab5, 0xe0ab9}, {0xe0abc, 0xe0ac5}, {0xe0ac7, 0xe0ac9}, + {0xe0acb, 0xe0acd}, {0xe0ae0, 0xe0ae3}, {0xe0ae6, 0xe0af1}, {0xe0af9, 0xe0aff}, + {0xe0b01, 0xe0b03}, {0xe0b05, 0xe0b0c}, {0xe0b13, 0xe0b28}, {0xe0b2a, 0xe0b30}, + {0xe0b35, 0xe0b39}, {0xe0b3c, 0xe0b44}, {0xe0b4b, 0xe0b4d}, {0xe0b5f, 0xe0b63}, + {0xe0b66, 0xe0b77}, {0xe0b85, 0xe0b8a}, {0xe0b8e, 0xe0b90}, {0xe0b92, 0xe0b95}, + {0xe0ba8, 0xe0baa}, {0xe0bae, 0xe0bb9}, {0xe0bbe, 0xe0bc2}, {0xe0bc6, 0xe0bc8}, + {0xe0bca, 0xe0bcd}, {0xe0be6, 0xe0bfa}, {0xe0c00, 0xe0c03}, {0xe0c05, 0xe0c0c}, + {0xe0c0e, 0xe0c10}, {0xe0c12, 0xe0c28}, {0xe0c2a, 0xe0c39}, {0xe0c3d, 0xe0c44}, + {0xe0c46, 0xe0c48}, {0xe0c4a, 0xe0c4d}, {0xe0c58, 0xe0c5a}, {0xe0c60, 0xe0c63}, + {0xe0c66, 0xe0c6f}, {0xe0c78, 0xe0c83}, {0xe0c85, 0xe0c8c}, {0xe0c8e, 0xe0c90}, + {0xe0c92, 0xe0ca8}, {0xe0caa, 0xe0cb3}, {0xe0cb5, 0xe0cb9}, {0xe0cbc, 0xe0cc4}, + {0xe0cc6, 0xe0cc8}, {0xe0cca, 0xe0ccd}, {0xe0ce0, 0xe0ce3}, {0xe0ce6, 0xe0cef}, + {0xe0d00, 0xe0d03}, {0xe0d05, 0xe0d0c}, {0xe0d0e, 0xe0d10}, {0xe0d12, 0xe0d44}, + {0xe0d46, 0xe0d48}, {0xe0d4a, 0xe0d4f}, {0xe0d54, 0xe0d63}, {0xe0d66, 0xe0d7f}, + {0xe0d85, 0xe0d96}, {0xe0d9a, 0xe0db1}, {0xe0db3, 0xe0dbb}, {0xe0dc0, 0xe0dc6}, + {0xe0dcf, 0xe0dd4}, {0xe0dd8, 0xe0ddf}, {0xe0de6, 0xe0def}, {0xe0df2, 0xe0df4}, + {0xe0e01, 0xe0e3a}, {0xe0e3f, 0xe0e5b}, {0xe0e94, 0xe0e97}, {0xe0e99, 0xe0e9f}, + {0xe0ea1, 0xe0ea3}, {0xe0ead, 0xe0eb9}, {0xe0ebb, 0xe0ebd}, {0xe0ec0, 0xe0ec4}, + {0xe0ec8, 0xe0ecd}, {0xe0ed0, 0xe0ed9}, {0xe0edc, 0xe0edf}, {0xe0f00, 0xe0f47}, + {0xe0f49, 0xe0f6c}, {0xe0f71, 0xe0f97}, {0xe0f99, 0xe0fbc}, {0xe0fbe, 0xe0fcc}, + {0xe0fce, 0xe0fda}, {0xe1000, 0xe10c5}, {0xe10d0, 0xe1248}, {0xe124a, 0xe124d}, + {0xe1250, 0xe1256}, {0xe125a, 0xe125d}, {0xe1260, 0xe1288}, {0xe128a, 0xe128d}, + {0xe1290, 0xe12b0}, {0xe12b2, 0xe12b5}, {0xe12b8, 0xe12be}, {0xe12c2, 0xe12c5}, + {0xe12c8, 0xe12d6}, {0xe12d8, 0xe1310}, {0xe1312, 0xe1315}, {0xe1318, 0xe135a}, + {0xe135d, 0xe137c}, {0xe1380, 0xe1399}, {0xe13a0, 0xe13f5}, {0xe13f8, 0xe13fd}, + {0xe1400, 0xe167f}, {0xe1681, 0xe169c}, {0xe16a0, 0xe16f8}, {0xe1700, 0xe170c}, + {0xe170e, 0xe1714}, {0xe1720, 0xe1736}, {0xe1740, 0xe1753}, {0xe1760, 0xe176c}, + {0xe176e, 0xe1770}, {0xe1780, 0xe17dd}, {0xe17e0, 0xe17e9}, {0xe17f0, 0xe17f9}, + {0xe1800, 0xe180d}, {0xe1810, 0xe1819}, {0xe1820, 0xe1877}, {0xe1880, 0xe18aa}, + {0xe18b0, 0xe18f5}, {0xe1900, 0xe191e}, {0xe1920, 0xe192b}, {0xe1930, 0xe193b}, + {0xe1944, 0xe196d}, {0xe1970, 0xe1974}, {0xe1980, 0xe19ab}, {0xe19b0, 0xe19c9}, + {0xe19d0, 0xe19da}, {0xe19de, 0xe1a1b}, {0xe1a1e, 0xe1a5e}, {0xe1a60, 0xe1a7c}, + {0xe1a7f, 0xe1a89}, {0xe1a90, 0xe1a99}, {0xe1aa0, 0xe1aad}, {0xe1ab0, 0xe1abe}, + {0xe1b00, 0xe1b4b}, {0xe1b50, 0xe1b7c}, {0xe1b80, 0xe1bf3}, {0xe1bfc, 0xe1c37}, + {0xe1c3b, 0xe1c49}, {0xe1c4d, 0xe1c88}, {0xe1cc0, 0xe1cc7}, {0xe1cd0, 0xe1cf9}, + {0xe1d00, 0xe1df9}, {0xe1dfb, 0xe1f15}, {0xe1f18, 0xe1f1d}, {0xe1f20, 0xe1f45}, + {0xe1f48, 0xe1f4d}, {0xe1f50, 0xe1f57}, {0xe1f5f, 0xe1f7d}, {0xe1f80, 0xe1fb4}, + {0xe1fb6, 0xe1fc4}, {0xe1fc6, 0xe1fd3}, {0xe1fd6, 0xe1fdb}, {0xe1fdd, 0xe1fef}, + {0xe1ff2, 0xe1ff4}, {0xe1ff6, 0xe1ffe}, {0xe2010, 0xe2027}, {0xe2030, 0xe205e}, + {0xe2074, 0xe208e}, {0xe2090, 0xe209c}, {0xe20a0, 0xe20bf}, {0xe20d0, 0xe20f0}, + {0xe2100, 0xe218b}, {0xe2190, 0xe2426}, {0xe2440, 0xe244a}, {0xe2460, 0xe2b73}, + {0xe2b76, 0xe2b95}, {0xe2b98, 0xe2bb9}, {0xe2bbd, 0xe2bc8}, {0xe2bca, 0xe2bd2}, + {0xe2bec, 0xe2bef}, {0xe2c00, 0xe2c2e}, {0xe2c30, 0xe2c5e}, {0xe2c60, 0xe2cf3}, + {0xe2cf9, 0xe2d25}, {0xe2d30, 0xe2d67}, {0xe2d7f, 0xe2d96}, {0xe2da0, 0xe2da6}, + {0xe2da8, 0xe2dae}, {0xe2db0, 0xe2db6}, {0xe2db8, 0xe2dbe}, {0xe2dc0, 0xe2dc6}, + {0xe2dc8, 0xe2dce}, {0xe2dd0, 0xe2dd6}, {0xe2dd8, 0xe2dde}, {0xe2de0, 0xe2e49}, + {0xe2e80, 0xe2e99}, {0xe2e9b, 0xe2ef3}, {0xe2f00, 0xe2fd5}, {0xe2ff0, 0xe2ffb}, + {0xe3001, 0xe303f}, {0xe3041, 0xe3096}, {0xe3099, 0xe30ff}, {0xe3105, 0xe312e}, + {0xe3131, 0xe318e}, {0xe3190, 0xe31ba}, {0xe31c0, 0xe31e3}, {0xe31f0, 0xe321e}, + {0xe3220, 0xe32fe}, {0xe3300, 0xe4db5}, {0xe4dc0, 0xe9fea}, {0xea000, 0xea48c}, + {0xea490, 0xea4c6}, {0xea4d0, 0xea62b}, {0xea640, 0xea6f7}, {0xea700, 0xea7ae}, + {0xea7b0, 0xea7b7}, {0xea7f7, 0xea82b}, {0xea830, 0xea839}, {0xea840, 0xea877}, + {0xea880, 0xea8c5}, {0xea8ce, 0xea8d9}, {0xea8e0, 0xea8fd}, {0xea900, 0xea953}, + {0xea95f, 0xea97c}, {0xea980, 0xea9cd}, {0xea9cf, 0xea9d9}, {0xea9de, 0xea9fe}, + {0xeaa00, 0xeaa36}, {0xeaa40, 0xeaa4d}, {0xeaa50, 0xeaa59}, {0xeaa5c, 0xeaac2}, + {0xeaadb, 0xeaaf6}, {0xeab01, 0xeab06}, {0xeab09, 0xeab0e}, {0xeab11, 0xeab16}, + {0xeab20, 0xeab26}, {0xeab28, 0xeab2e}, {0xeab30, 0xeab65}, {0xeab70, 0xeabed}, + {0xeabf0, 0xeabf9}, {0xeac00, 0xed7a3}, {0xed7b0, 0xed7c6}, {0xed7cb, 0xed7fb}, + {0xef900, 0xefa6d}, {0xefa70, 0xefad9}, {0xefb00, 0xefb06}, {0xefb13, 0xefb17}, + {0xefb1d, 0xefb36}, {0xefb38, 0xefb3c}, {0xefb46, 0xefbc1}, {0xefbd3, 0xefd3f}, + {0xefd50, 0xefd8f}, {0xefd92, 0xefdc7}, {0xefdf0, 0xefdfd}, {0xefe00, 0xefe19}, + {0xefe20, 0xefe52}, {0xefe54, 0xefe66}, {0xefe68, 0xefe6b}, {0xefe70, 0xefe74}, + {0xefe76, 0xefefc}, {0xeff01, 0xeffbe}, {0xeffc2, 0xeffc7}, {0xeffca, 0xeffcf}, + {0xeffd2, 0xeffd7}, {0xeffda, 0xeffdc}, {0xeffe0, 0xeffe6}, {0xeffe8, 0xeffee}, + {0xf0021, 0xf007e}, {0xf00a1, 0xf00ac}, {0xf00ae, 0xf0377}, {0xf037a, 0xf037f}, + {0xf0384, 0xf038a}, {0xf038e, 0xf03a1}, {0xf03a3, 0xf052f}, {0xf0531, 0xf0556}, + {0xf0559, 0xf055f}, {0xf0561, 0xf0587}, {0xf058d, 0xf058f}, {0xf0591, 0xf05c7}, + {0xf05d0, 0xf05ea}, {0xf05f0, 0xf05f4}, {0xf0606, 0xf061b}, {0xf061e, 0xf06dc}, + {0xf06de, 0xf070d}, {0xf0710, 0xf074a}, {0xf074d, 0xf07b1}, {0xf07c0, 0xf07fa}, + {0xf0800, 0xf082d}, {0xf0830, 0xf083e}, {0xf0840, 0xf085b}, {0xf0860, 0xf086a}, + {0xf08a0, 0xf08b4}, {0xf08b6, 0xf08bd}, {0xf08d4, 0xf08e1}, {0xf08e3, 0xf0983}, + {0xf0985, 0xf098c}, {0xf0993, 0xf09a8}, {0xf09aa, 0xf09b0}, {0xf09b6, 0xf09b9}, + {0xf09bc, 0xf09c4}, {0xf09cb, 0xf09ce}, {0xf09df, 0xf09e3}, {0xf09e6, 0xf09fd}, + {0xf0a01, 0xf0a03}, {0xf0a05, 0xf0a0a}, {0xf0a13, 0xf0a28}, {0xf0a2a, 0xf0a30}, + {0xf0a3e, 0xf0a42}, {0xf0a4b, 0xf0a4d}, {0xf0a59, 0xf0a5c}, {0xf0a66, 0xf0a75}, + {0xf0a81, 0xf0a83}, {0xf0a85, 0xf0a8d}, {0xf0a8f, 0xf0a91}, {0xf0a93, 0xf0aa8}, + {0xf0aaa, 0xf0ab0}, {0xf0ab5, 0xf0ab9}, {0xf0abc, 0xf0ac5}, {0xf0ac7, 0xf0ac9}, + {0xf0acb, 0xf0acd}, {0xf0ae0, 0xf0ae3}, {0xf0ae6, 0xf0af1}, {0xf0af9, 0xf0aff}, + {0xf0b01, 0xf0b03}, {0xf0b05, 0xf0b0c}, {0xf0b13, 0xf0b28}, {0xf0b2a, 0xf0b30}, + {0xf0b35, 0xf0b39}, {0xf0b3c, 0xf0b44}, {0xf0b4b, 0xf0b4d}, {0xf0b5f, 0xf0b63}, + {0xf0b66, 0xf0b77}, {0xf0b85, 0xf0b8a}, {0xf0b8e, 0xf0b90}, {0xf0b92, 0xf0b95}, + {0xf0ba8, 0xf0baa}, {0xf0bae, 0xf0bb9}, {0xf0bbe, 0xf0bc2}, {0xf0bc6, 0xf0bc8}, + {0xf0bca, 0xf0bcd}, {0xf0be6, 0xf0bfa}, {0xf0c00, 0xf0c03}, {0xf0c05, 0xf0c0c}, + {0xf0c0e, 0xf0c10}, {0xf0c12, 0xf0c28}, {0xf0c2a, 0xf0c39}, {0xf0c3d, 0xf0c44}, + {0xf0c46, 0xf0c48}, {0xf0c4a, 0xf0c4d}, {0xf0c58, 0xf0c5a}, {0xf0c60, 0xf0c63}, + {0xf0c66, 0xf0c6f}, {0xf0c78, 0xf0c83}, {0xf0c85, 0xf0c8c}, {0xf0c8e, 0xf0c90}, + {0xf0c92, 0xf0ca8}, {0xf0caa, 0xf0cb3}, {0xf0cb5, 0xf0cb9}, {0xf0cbc, 0xf0cc4}, + {0xf0cc6, 0xf0cc8}, {0xf0cca, 0xf0ccd}, {0xf0ce0, 0xf0ce3}, {0xf0ce6, 0xf0cef}, + {0xf0d00, 0xf0d03}, {0xf0d05, 0xf0d0c}, {0xf0d0e, 0xf0d10}, {0xf0d12, 0xf0d44}, + {0xf0d46, 0xf0d48}, {0xf0d4a, 0xf0d4f}, {0xf0d54, 0xf0d63}, {0xf0d66, 0xf0d7f}, + {0xf0d85, 0xf0d96}, {0xf0d9a, 0xf0db1}, {0xf0db3, 0xf0dbb}, {0xf0dc0, 0xf0dc6}, + {0xf0dcf, 0xf0dd4}, {0xf0dd8, 0xf0ddf}, {0xf0de6, 0xf0def}, {0xf0df2, 0xf0df4}, + {0xf0e01, 0xf0e3a}, {0xf0e3f, 0xf0e5b}, {0xf0e94, 0xf0e97}, {0xf0e99, 0xf0e9f}, + {0xf0ea1, 0xf0ea3}, {0xf0ead, 0xf0eb9}, {0xf0ebb, 0xf0ebd}, {0xf0ec0, 0xf0ec4}, + {0xf0ec8, 0xf0ecd}, {0xf0ed0, 0xf0ed9}, {0xf0edc, 0xf0edf}, {0xf0f00, 0xf0f47}, + {0xf0f49, 0xf0f6c}, {0xf0f71, 0xf0f97}, {0xf0f99, 0xf0fbc}, {0xf0fbe, 0xf0fcc}, + {0xf0fce, 0xf0fda}, {0xf1000, 0xf10c5}, {0xf10d0, 0xf1248}, {0xf124a, 0xf124d}, + {0xf1250, 0xf1256}, {0xf125a, 0xf125d}, {0xf1260, 0xf1288}, {0xf128a, 0xf128d}, + {0xf1290, 0xf12b0}, {0xf12b2, 0xf12b5}, {0xf12b8, 0xf12be}, {0xf12c2, 0xf12c5}, + {0xf12c8, 0xf12d6}, {0xf12d8, 0xf1310}, {0xf1312, 0xf1315}, {0xf1318, 0xf135a}, + {0xf135d, 0xf137c}, {0xf1380, 0xf1399}, {0xf13a0, 0xf13f5}, {0xf13f8, 0xf13fd}, + {0xf1400, 0xf167f}, {0xf1681, 0xf169c}, {0xf16a0, 0xf16f8}, {0xf1700, 0xf170c}, + {0xf170e, 0xf1714}, {0xf1720, 0xf1736}, {0xf1740, 0xf1753}, {0xf1760, 0xf176c}, + {0xf176e, 0xf1770}, {0xf1780, 0xf17dd}, {0xf17e0, 0xf17e9}, {0xf17f0, 0xf17f9}, + {0xf1800, 0xf180d}, {0xf1810, 0xf1819}, {0xf1820, 0xf1877}, {0xf1880, 0xf18aa}, + {0xf18b0, 0xf18f5}, {0xf1900, 0xf191e}, {0xf1920, 0xf192b}, {0xf1930, 0xf193b}, + {0xf1944, 0xf196d}, {0xf1970, 0xf1974}, {0xf1980, 0xf19ab}, {0xf19b0, 0xf19c9}, + {0xf19d0, 0xf19da}, {0xf19de, 0xf1a1b}, {0xf1a1e, 0xf1a5e}, {0xf1a60, 0xf1a7c}, + {0xf1a7f, 0xf1a89}, {0xf1a90, 0xf1a99}, {0xf1aa0, 0xf1aad}, {0xf1ab0, 0xf1abe}, + {0xf1b00, 0xf1b4b}, {0xf1b50, 0xf1b7c}, {0xf1b80, 0xf1bf3}, {0xf1bfc, 0xf1c37}, + {0xf1c3b, 0xf1c49}, {0xf1c4d, 0xf1c88}, {0xf1cc0, 0xf1cc7}, {0xf1cd0, 0xf1cf9}, + {0xf1d00, 0xf1df9}, {0xf1dfb, 0xf1f15}, {0xf1f18, 0xf1f1d}, {0xf1f20, 0xf1f45}, + {0xf1f48, 0xf1f4d}, {0xf1f50, 0xf1f57}, {0xf1f5f, 0xf1f7d}, {0xf1f80, 0xf1fb4}, + {0xf1fb6, 0xf1fc4}, {0xf1fc6, 0xf1fd3}, {0xf1fd6, 0xf1fdb}, {0xf1fdd, 0xf1fef}, + {0xf1ff2, 0xf1ff4}, {0xf1ff6, 0xf1ffe}, {0xf2010, 0xf2027}, {0xf2030, 0xf205e}, + {0xf2074, 0xf208e}, {0xf2090, 0xf209c}, {0xf20a0, 0xf20bf}, {0xf20d0, 0xf20f0}, + {0xf2100, 0xf218b}, {0xf2190, 0xf2426}, {0xf2440, 0xf244a}, {0xf2460, 0xf2b73}, + {0xf2b76, 0xf2b95}, {0xf2b98, 0xf2bb9}, {0xf2bbd, 0xf2bc8}, {0xf2bca, 0xf2bd2}, + {0xf2bec, 0xf2bef}, {0xf2c00, 0xf2c2e}, {0xf2c30, 0xf2c5e}, {0xf2c60, 0xf2cf3}, + {0xf2cf9, 0xf2d25}, {0xf2d30, 0xf2d67}, {0xf2d7f, 0xf2d96}, {0xf2da0, 0xf2da6}, + {0xf2da8, 0xf2dae}, {0xf2db0, 0xf2db6}, {0xf2db8, 0xf2dbe}, {0xf2dc0, 0xf2dc6}, + {0xf2dc8, 0xf2dce}, {0xf2dd0, 0xf2dd6}, {0xf2dd8, 0xf2dde}, {0xf2de0, 0xf2e49}, + {0xf2e80, 0xf2e99}, {0xf2e9b, 0xf2ef3}, {0xf2f00, 0xf2fd5}, {0xf2ff0, 0xf2ffb}, + {0xf3001, 0xf303f}, {0xf3041, 0xf3096}, {0xf3099, 0xf30ff}, {0xf3105, 0xf312e}, + {0xf3131, 0xf318e}, {0xf3190, 0xf31ba}, {0xf31c0, 0xf31e3}, {0xf31f0, 0xf321e}, + {0xf3220, 0xf32fe}, {0xf3300, 0xf4db5}, {0xf4dc0, 0xf9fea}, {0xfa000, 0xfa48c}, + {0xfa490, 0xfa4c6}, {0xfa4d0, 0xfa62b}, {0xfa640, 0xfa6f7}, {0xfa700, 0xfa7ae}, + {0xfa7b0, 0xfa7b7}, {0xfa7f7, 0xfa82b}, {0xfa830, 0xfa839}, {0xfa840, 0xfa877}, + {0xfa880, 0xfa8c5}, {0xfa8ce, 0xfa8d9}, {0xfa8e0, 0xfa8fd}, {0xfa900, 0xfa953}, + {0xfa95f, 0xfa97c}, {0xfa980, 0xfa9cd}, {0xfa9cf, 0xfa9d9}, {0xfa9de, 0xfa9fe}, + {0xfaa00, 0xfaa36}, {0xfaa40, 0xfaa4d}, {0xfaa50, 0xfaa59}, {0xfaa5c, 0xfaac2}, + {0xfaadb, 0xfaaf6}, {0xfab01, 0xfab06}, {0xfab09, 0xfab0e}, {0xfab11, 0xfab16}, + {0xfab20, 0xfab26}, {0xfab28, 0xfab2e}, {0xfab30, 0xfab65}, {0xfab70, 0xfabed}, + {0xfabf0, 0xfabf9}, {0xfac00, 0xfd7a3}, {0xfd7b0, 0xfd7c6}, {0xfd7cb, 0xfd7fb}, + {0xff900, 0xffa6d}, {0xffa70, 0xffad9}, {0xffb00, 0xffb06}, {0xffb13, 0xffb17}, + {0xffb1d, 0xffb36}, {0xffb38, 0xffb3c}, {0xffb46, 0xffbc1}, {0xffbd3, 0xffd3f}, + {0xffd50, 0xffd8f}, {0xffd92, 0xffdc7}, {0xffdf0, 0xffdfd}, {0xffe00, 0xffe19}, + {0xffe20, 0xffe52}, {0xffe54, 0xffe66}, {0xffe68, 0xffe6b}, {0xffe70, 0xffe74}, + {0xffe76, 0xffefc}, {0xfff01, 0xfffbe}, {0xfffc2, 0xfffc7}, {0xfffca, 0xfffcf}, + {0xfffd2, 0xfffd7}, {0xfffda, 0xfffdc}, {0xfffe0, 0xfffe6}, {0xfffe8, 0xfffee}, + {0x100021, 0x10007e}, {0x1000a1, 0x1000ac}, {0x1000ae, 0x100377}, {0x10037a, 0x10037f}, + {0x100384, 0x10038a}, {0x10038e, 0x1003a1}, {0x1003a3, 0x10052f}, {0x100531, 0x100556}, + {0x100559, 0x10055f}, {0x100561, 0x100587}, {0x10058d, 0x10058f}, {0x100591, 0x1005c7}, + {0x1005d0, 0x1005ea}, {0x1005f0, 0x1005f4}, {0x100606, 0x10061b}, {0x10061e, 0x1006dc}, + {0x1006de, 0x10070d}, {0x100710, 0x10074a}, {0x10074d, 0x1007b1}, {0x1007c0, 0x1007fa}, + {0x100800, 0x10082d}, {0x100830, 0x10083e}, {0x100840, 0x10085b}, {0x100860, 0x10086a}, + {0x1008a0, 0x1008b4}, {0x1008b6, 0x1008bd}, {0x1008d4, 0x1008e1}, {0x1008e3, 0x100983}, + {0x100985, 0x10098c}, {0x100993, 0x1009a8}, {0x1009aa, 0x1009b0}, {0x1009b6, 0x1009b9}, + {0x1009bc, 0x1009c4}, {0x1009cb, 0x1009ce}, {0x1009df, 0x1009e3}, {0x1009e6, 0x1009fd}, + {0x100a01, 0x100a03}, {0x100a05, 0x100a0a}, {0x100a13, 0x100a28}, {0x100a2a, 0x100a30}, + {0x100a3e, 0x100a42}, {0x100a4b, 0x100a4d}, {0x100a59, 0x100a5c}, {0x100a66, 0x100a75}, + {0x100a81, 0x100a83}, {0x100a85, 0x100a8d}, {0x100a8f, 0x100a91}, {0x100a93, 0x100aa8}, + {0x100aaa, 0x100ab0}, {0x100ab5, 0x100ab9}, {0x100abc, 0x100ac5}, {0x100ac7, 0x100ac9}, + {0x100acb, 0x100acd}, {0x100ae0, 0x100ae3}, {0x100ae6, 0x100af1}, {0x100af9, 0x100aff}, + {0x100b01, 0x100b03}, {0x100b05, 0x100b0c}, {0x100b13, 0x100b28}, {0x100b2a, 0x100b30}, + {0x100b35, 0x100b39}, {0x100b3c, 0x100b44}, {0x100b4b, 0x100b4d}, {0x100b5f, 0x100b63}, + {0x100b66, 0x100b77}, {0x100b85, 0x100b8a}, {0x100b8e, 0x100b90}, {0x100b92, 0x100b95}, + {0x100ba8, 0x100baa}, {0x100bae, 0x100bb9}, {0x100bbe, 0x100bc2}, {0x100bc6, 0x100bc8}, + {0x100bca, 0x100bcd}, {0x100be6, 0x100bfa}, {0x100c00, 0x100c03}, {0x100c05, 0x100c0c}, + {0x100c0e, 0x100c10}, {0x100c12, 0x100c28}, {0x100c2a, 0x100c39}, {0x100c3d, 0x100c44}, + {0x100c46, 0x100c48}, {0x100c4a, 0x100c4d}, {0x100c58, 0x100c5a}, {0x100c60, 0x100c63}, + {0x100c66, 0x100c6f}, {0x100c78, 0x100c83}, {0x100c85, 0x100c8c}, {0x100c8e, 0x100c90}, + {0x100c92, 0x100ca8}, {0x100caa, 0x100cb3}, {0x100cb5, 0x100cb9}, {0x100cbc, 0x100cc4}, + {0x100cc6, 0x100cc8}, {0x100cca, 0x100ccd}, {0x100ce0, 0x100ce3}, {0x100ce6, 0x100cef}, + {0x100d00, 0x100d03}, {0x100d05, 0x100d0c}, {0x100d0e, 0x100d10}, {0x100d12, 0x100d44}, + {0x100d46, 0x100d48}, {0x100d4a, 0x100d4f}, {0x100d54, 0x100d63}, {0x100d66, 0x100d7f}, + {0x100d85, 0x100d96}, {0x100d9a, 0x100db1}, {0x100db3, 0x100dbb}, {0x100dc0, 0x100dc6}, + {0x100dcf, 0x100dd4}, {0x100dd8, 0x100ddf}, {0x100de6, 0x100def}, {0x100df2, 0x100df4}, + {0x100e01, 0x100e3a}, {0x100e3f, 0x100e5b}, {0x100e94, 0x100e97}, {0x100e99, 0x100e9f}, + {0x100ea1, 0x100ea3}, {0x100ead, 0x100eb9}, {0x100ebb, 0x100ebd}, {0x100ec0, 0x100ec4}, + {0x100ec8, 0x100ecd}, {0x100ed0, 0x100ed9}, {0x100edc, 0x100edf}, {0x100f00, 0x100f47}, + {0x100f49, 0x100f6c}, {0x100f71, 0x100f97}, {0x100f99, 0x100fbc}, {0x100fbe, 0x100fcc}, + {0x100fce, 0x100fda}, {0x101000, 0x1010c5}, {0x1010d0, 0x101248}, {0x10124a, 0x10124d}, + {0x101250, 0x101256}, {0x10125a, 0x10125d}, {0x101260, 0x101288}, {0x10128a, 0x10128d}, + {0x101290, 0x1012b0}, {0x1012b2, 0x1012b5}, {0x1012b8, 0x1012be}, {0x1012c2, 0x1012c5}, + {0x1012c8, 0x1012d6}, {0x1012d8, 0x101310}, {0x101312, 0x101315}, {0x101318, 0x10135a}, + {0x10135d, 0x10137c}, {0x101380, 0x101399}, {0x1013a0, 0x1013f5}, {0x1013f8, 0x1013fd}, + {0x101400, 0x10167f}, {0x101681, 0x10169c}, {0x1016a0, 0x1016f8}, {0x101700, 0x10170c}, + {0x10170e, 0x101714}, {0x101720, 0x101736}, {0x101740, 0x101753}, {0x101760, 0x10176c}, + {0x10176e, 0x101770}, {0x101780, 0x1017dd}, {0x1017e0, 0x1017e9}, {0x1017f0, 0x1017f9}, + {0x101800, 0x10180d}, {0x101810, 0x101819}, {0x101820, 0x101877}, {0x101880, 0x1018aa}, + {0x1018b0, 0x1018f5}, {0x101900, 0x10191e}, {0x101920, 0x10192b}, {0x101930, 0x10193b}, + {0x101944, 0x10196d}, {0x101970, 0x101974}, {0x101980, 0x1019ab}, {0x1019b0, 0x1019c9}, + {0x1019d0, 0x1019da}, {0x1019de, 0x101a1b}, {0x101a1e, 0x101a5e}, {0x101a60, 0x101a7c}, + {0x101a7f, 0x101a89}, {0x101a90, 0x101a99}, {0x101aa0, 0x101aad}, {0x101ab0, 0x101abe}, + {0x101b00, 0x101b4b}, {0x101b50, 0x101b7c}, {0x101b80, 0x101bf3}, {0x101bfc, 0x101c37}, + {0x101c3b, 0x101c49}, {0x101c4d, 0x101c88}, {0x101cc0, 0x101cc7}, {0x101cd0, 0x101cf9}, + {0x101d00, 0x101df9}, {0x101dfb, 0x101f15}, {0x101f18, 0x101f1d}, {0x101f20, 0x101f45}, + {0x101f48, 0x101f4d}, {0x101f50, 0x101f57}, {0x101f5f, 0x101f7d}, {0x101f80, 0x101fb4}, + {0x101fb6, 0x101fc4}, {0x101fc6, 0x101fd3}, {0x101fd6, 0x101fdb}, {0x101fdd, 0x101fef}, + {0x101ff2, 0x101ff4}, {0x101ff6, 0x101ffe}, {0x102010, 0x102027}, {0x102030, 0x10205e}, + {0x102074, 0x10208e}, {0x102090, 0x10209c}, {0x1020a0, 0x1020bf}, {0x1020d0, 0x1020f0}, + {0x102100, 0x10218b}, {0x102190, 0x102426}, {0x102440, 0x10244a}, {0x102460, 0x102b73}, + {0x102b76, 0x102b95}, {0x102b98, 0x102bb9}, {0x102bbd, 0x102bc8}, {0x102bca, 0x102bd2}, + {0x102bec, 0x102bef}, {0x102c00, 0x102c2e}, {0x102c30, 0x102c5e}, {0x102c60, 0x102cf3}, + {0x102cf9, 0x102d25}, {0x102d30, 0x102d67}, {0x102d7f, 0x102d96}, {0x102da0, 0x102da6}, + {0x102da8, 0x102dae}, {0x102db0, 0x102db6}, {0x102db8, 0x102dbe}, {0x102dc0, 0x102dc6}, + {0x102dc8, 0x102dce}, {0x102dd0, 0x102dd6}, {0x102dd8, 0x102dde}, {0x102de0, 0x102e49}, + {0x102e80, 0x102e99}, {0x102e9b, 0x102ef3}, {0x102f00, 0x102fd5}, {0x102ff0, 0x102ffb}, + {0x103001, 0x10303f}, {0x103041, 0x103096}, {0x103099, 0x1030ff}, {0x103105, 0x10312e}, + {0x103131, 0x10318e}, {0x103190, 0x1031ba}, {0x1031c0, 0x1031e3}, {0x1031f0, 0x10321e}, + {0x103220, 0x1032fe}, {0x103300, 0x104db5}, {0x104dc0, 0x109fea}, {0x10a000, 0x10a48c}, + {0x10a490, 0x10a4c6}, {0x10a4d0, 0x10a62b}, {0x10a640, 0x10a6f7}, {0x10a700, 0x10a7ae}, + {0x10a7b0, 0x10a7b7}, {0x10a7f7, 0x10a82b}, {0x10a830, 0x10a839}, {0x10a840, 0x10a877}, + {0x10a880, 0x10a8c5}, {0x10a8ce, 0x10a8d9}, {0x10a8e0, 0x10a8fd}, {0x10a900, 0x10a953}, + {0x10a95f, 0x10a97c}, {0x10a980, 0x10a9cd}, {0x10a9cf, 0x10a9d9}, {0x10a9de, 0x10a9fe}, + {0x10aa00, 0x10aa36}, {0x10aa40, 0x10aa4d}, {0x10aa50, 0x10aa59}, {0x10aa5c, 0x10aac2}, + {0x10aadb, 0x10aaf6}, {0x10ab01, 0x10ab06}, {0x10ab09, 0x10ab0e}, {0x10ab11, 0x10ab16}, + {0x10ab20, 0x10ab26}, {0x10ab28, 0x10ab2e}, {0x10ab30, 0x10ab65}, {0x10ab70, 0x10abed}, + {0x10abf0, 0x10abf9}, {0x10ac00, 0x10d7a3}, {0x10d7b0, 0x10d7c6}, {0x10d7cb, 0x10d7fb}, + {0x10f900, 0x10fa6d}, {0x10fa70, 0x10fad9}, {0x10fb00, 0x10fb06}, {0x10fb13, 0x10fb17}, + {0x10fb1d, 0x10fb36}, {0x10fb38, 0x10fb3c}, {0x10fb46, 0x10fbc1}, {0x10fbd3, 0x10fd3f}, + {0x10fd50, 0x10fd8f}, {0x10fd92, 0x10fdc7}, {0x10fdf0, 0x10fdfd}, {0x10fe00, 0x10fe19}, + {0x10fe20, 0x10fe52}, {0x10fe54, 0x10fe66}, {0x10fe68, 0x10fe6b}, {0x10fe70, 0x10fe74}, + {0x10fe76, 0x10fefc}, {0x10ff01, 0x10ffbe}, {0x10ffc2, 0x10ffc7}, {0x10ffca, 0x10ffcf}, + {0x10ffd2, 0x10ffd7}, {0x10ffda, 0x10ffdc}, {0x10ffe0, 0x10ffe6}, {0x10ffe8, 0x10ffee} #endif }; @@ -755,23 +6176,186 @@ static const chr graphCharTable[] = { 0x38c, 0x589, 0x58a, 0x85e, 0x98f, 0x990, 0x9b2, 0x9c7, 0x9c8, 0x9d7, 0x9dc, 0x9dd, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36, 0xa38, 0xa39, 0xa3c, 0xa47, 0xa48, 0xa51, 0xa5e, 0xab2, 0xab3, - 0xad0, 0xaf9, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56, - 0xb57, 0xb5c, 0xb5d, 0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, - 0xb9f, 0xba3, 0xba4, 0xbd0, 0xbd7, 0xc55, 0xc56, 0xcd5, 0xcd6, - 0xcde, 0xcf1, 0xcf2, 0xd82, 0xd83, 0xdbd, 0xdca, 0xdd6, 0xe81, - 0xe82, 0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, - 0xeab, 0xec6, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x1772, 0x1773, 0x1940, - 0x1cf8, 0x1cf9, 0x1f59, 0x1f5b, 0x1f5d, 0x2070, 0x2071, 0x2d27, 0x2d2d, - 0x2d6f, 0x2d70, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc, 0xfffd + 0xad0, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56, 0xb57, + 0xb5c, 0xb5d, 0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, + 0xba3, 0xba4, 0xbd0, 0xbd7, 0xc55, 0xc56, 0xcd5, 0xcd6, 0xcde, + 0xcf1, 0xcf2, 0xd82, 0xd83, 0xdbd, 0xdca, 0xdd6, 0xe81, 0xe82, + 0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, + 0xec6, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x1772, 0x1773, 0x1940, 0x1f59, + 0x1f5b, 0x1f5d, 0x2070, 0x2071, 0x2d27, 0x2d2d, 0x2d6f, 0x2d70, 0xfb3e, + 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc, 0xfffd #if TCL_UTF_MAX > 4 - ,0x1003c, 0x1003d, 0x101a0, 0x1056f, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, - 0x108f5, 0x1093f, 0x10a05, 0x10a06, 0x11288, 0x1130f, 0x11310, 0x11332, 0x11333, - 0x11347, 0x11348, 0x11350, 0x11357, 0x1145b, 0x1145d, 0x118ff, 0x16a6e, 0x16a6f, - 0x16fe0, 0x1b000, 0x1b001, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, - 0x1d546, 0x1e023, 0x1e024, 0x1e95e, 0x1e95f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, - 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, - 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e, - 0x1eef0, 0x1eef1, 0x1f250, 0x1f251, 0x1f930, 0x1f9c0 + ,0x1038c, 0x10589, 0x1058a, 0x1085e, 0x1098f, 0x10990, 0x109b2, 0x109c7, 0x109c8, + 0x109d7, 0x109dc, 0x109dd, 0x10a0f, 0x10a10, 0x10a32, 0x10a33, 0x10a35, 0x10a36, + 0x10a38, 0x10a39, 0x10a3c, 0x10a47, 0x10a48, 0x10a51, 0x10a5e, 0x10ab2, 0x10ab3, + 0x10ad0, 0x10b0f, 0x10b10, 0x10b32, 0x10b33, 0x10b47, 0x10b48, 0x10b56, 0x10b57, + 0x10b5c, 0x10b5d, 0x10b82, 0x10b83, 0x10b99, 0x10b9a, 0x10b9c, 0x10b9e, 0x10b9f, + 0x10ba3, 0x10ba4, 0x10bd0, 0x10bd7, 0x10c55, 0x10c56, 0x10cd5, 0x10cd6, 0x10cde, + 0x10cf1, 0x10cf2, 0x10d82, 0x10d83, 0x10dbd, 0x10dca, 0x10dd6, 0x10e81, 0x10e82, + 0x10e84, 0x10e87, 0x10e88, 0x10e8a, 0x10e8d, 0x10ea5, 0x10ea7, 0x10eaa, 0x10eab, + 0x10ec6, 0x110c7, 0x110cd, 0x11258, 0x112c0, 0x11772, 0x11773, 0x11940, 0x11f59, + 0x11f5b, 0x11f5d, 0x12070, 0x12071, 0x12d27, 0x12d2d, 0x12d6f, 0x12d70, 0x1fb3e, + 0x1fb40, 0x1fb41, 0x1fb43, 0x1fb44, 0x1fffc, 0x1fffd, 0x2038c, 0x20589, 0x2058a, + 0x2085e, 0x2098f, 0x20990, 0x209b2, 0x209c7, 0x209c8, 0x209d7, 0x209dc, 0x209dd, + 0x20a0f, 0x20a10, 0x20a32, 0x20a33, 0x20a35, 0x20a36, 0x20a38, 0x20a39, 0x20a3c, + 0x20a47, 0x20a48, 0x20a51, 0x20a5e, 0x20ab2, 0x20ab3, 0x20ad0, 0x20b0f, 0x20b10, + 0x20b32, 0x20b33, 0x20b47, 0x20b48, 0x20b56, 0x20b57, 0x20b5c, 0x20b5d, 0x20b82, + 0x20b83, 0x20b99, 0x20b9a, 0x20b9c, 0x20b9e, 0x20b9f, 0x20ba3, 0x20ba4, 0x20bd0, + 0x20bd7, 0x20c55, 0x20c56, 0x20cd5, 0x20cd6, 0x20cde, 0x20cf1, 0x20cf2, 0x20d82, + 0x20d83, 0x20dbd, 0x20dca, 0x20dd6, 0x20e81, 0x20e82, 0x20e84, 0x20e87, 0x20e88, + 0x20e8a, 0x20e8d, 0x20ea5, 0x20ea7, 0x20eaa, 0x20eab, 0x20ec6, 0x210c7, 0x210cd, + 0x21258, 0x212c0, 0x21772, 0x21773, 0x21940, 0x21f59, 0x21f5b, 0x21f5d, 0x22070, + 0x22071, 0x22d27, 0x22d2d, 0x22d6f, 0x22d70, 0x2fb3e, 0x2fb40, 0x2fb41, 0x2fb43, + 0x2fb44, 0x2fffc, 0x2fffd, 0x3038c, 0x30589, 0x3058a, 0x3085e, 0x3098f, 0x30990, + 0x309b2, 0x309c7, 0x309c8, 0x309d7, 0x309dc, 0x309dd, 0x30a0f, 0x30a10, 0x30a32, + 0x30a33, 0x30a35, 0x30a36, 0x30a38, 0x30a39, 0x30a3c, 0x30a47, 0x30a48, 0x30a51, + 0x30a5e, 0x30ab2, 0x30ab3, 0x30ad0, 0x30b0f, 0x30b10, 0x30b32, 0x30b33, 0x30b47, + 0x30b48, 0x30b56, 0x30b57, 0x30b5c, 0x30b5d, 0x30b82, 0x30b83, 0x30b99, 0x30b9a, + 0x30b9c, 0x30b9e, 0x30b9f, 0x30ba3, 0x30ba4, 0x30bd0, 0x30bd7, 0x30c55, 0x30c56, + 0x30cd5, 0x30cd6, 0x30cde, 0x30cf1, 0x30cf2, 0x30d82, 0x30d83, 0x30dbd, 0x30dca, + 0x30dd6, 0x30e81, 0x30e82, 0x30e84, 0x30e87, 0x30e88, 0x30e8a, 0x30e8d, 0x30ea5, + 0x30ea7, 0x30eaa, 0x30eab, 0x30ec6, 0x310c7, 0x310cd, 0x31258, 0x312c0, 0x31772, + 0x31773, 0x31940, 0x31f59, 0x31f5b, 0x31f5d, 0x32070, 0x32071, 0x32d27, 0x32d2d, + 0x32d6f, 0x32d70, 0x3fb3e, 0x3fb40, 0x3fb41, 0x3fb43, 0x3fb44, 0x3fffc, 0x3fffd, + 0x4038c, 0x40589, 0x4058a, 0x4085e, 0x4098f, 0x40990, 0x409b2, 0x409c7, 0x409c8, + 0x409d7, 0x409dc, 0x409dd, 0x40a0f, 0x40a10, 0x40a32, 0x40a33, 0x40a35, 0x40a36, + 0x40a38, 0x40a39, 0x40a3c, 0x40a47, 0x40a48, 0x40a51, 0x40a5e, 0x40ab2, 0x40ab3, + 0x40ad0, 0x40b0f, 0x40b10, 0x40b32, 0x40b33, 0x40b47, 0x40b48, 0x40b56, 0x40b57, + 0x40b5c, 0x40b5d, 0x40b82, 0x40b83, 0x40b99, 0x40b9a, 0x40b9c, 0x40b9e, 0x40b9f, + 0x40ba3, 0x40ba4, 0x40bd0, 0x40bd7, 0x40c55, 0x40c56, 0x40cd5, 0x40cd6, 0x40cde, + 0x40cf1, 0x40cf2, 0x40d82, 0x40d83, 0x40dbd, 0x40dca, 0x40dd6, 0x40e81, 0x40e82, + 0x40e84, 0x40e87, 0x40e88, 0x40e8a, 0x40e8d, 0x40ea5, 0x40ea7, 0x40eaa, 0x40eab, + 0x40ec6, 0x410c7, 0x410cd, 0x41258, 0x412c0, 0x41772, 0x41773, 0x41940, 0x41f59, + 0x41f5b, 0x41f5d, 0x42070, 0x42071, 0x42d27, 0x42d2d, 0x42d6f, 0x42d70, 0x4fb3e, + 0x4fb40, 0x4fb41, 0x4fb43, 0x4fb44, 0x4fffc, 0x4fffd, 0x5038c, 0x50589, 0x5058a, + 0x5085e, 0x5098f, 0x50990, 0x509b2, 0x509c7, 0x509c8, 0x509d7, 0x509dc, 0x509dd, + 0x50a0f, 0x50a10, 0x50a32, 0x50a33, 0x50a35, 0x50a36, 0x50a38, 0x50a39, 0x50a3c, + 0x50a47, 0x50a48, 0x50a51, 0x50a5e, 0x50ab2, 0x50ab3, 0x50ad0, 0x50b0f, 0x50b10, + 0x50b32, 0x50b33, 0x50b47, 0x50b48, 0x50b56, 0x50b57, 0x50b5c, 0x50b5d, 0x50b82, + 0x50b83, 0x50b99, 0x50b9a, 0x50b9c, 0x50b9e, 0x50b9f, 0x50ba3, 0x50ba4, 0x50bd0, + 0x50bd7, 0x50c55, 0x50c56, 0x50cd5, 0x50cd6, 0x50cde, 0x50cf1, 0x50cf2, 0x50d82, + 0x50d83, 0x50dbd, 0x50dca, 0x50dd6, 0x50e81, 0x50e82, 0x50e84, 0x50e87, 0x50e88, + 0x50e8a, 0x50e8d, 0x50ea5, 0x50ea7, 0x50eaa, 0x50eab, 0x50ec6, 0x510c7, 0x510cd, + 0x51258, 0x512c0, 0x51772, 0x51773, 0x51940, 0x51f59, 0x51f5b, 0x51f5d, 0x52070, + 0x52071, 0x52d27, 0x52d2d, 0x52d6f, 0x52d70, 0x5fb3e, 0x5fb40, 0x5fb41, 0x5fb43, + 0x5fb44, 0x5fffc, 0x5fffd, 0x6038c, 0x60589, 0x6058a, 0x6085e, 0x6098f, 0x60990, + 0x609b2, 0x609c7, 0x609c8, 0x609d7, 0x609dc, 0x609dd, 0x60a0f, 0x60a10, 0x60a32, + 0x60a33, 0x60a35, 0x60a36, 0x60a38, 0x60a39, 0x60a3c, 0x60a47, 0x60a48, 0x60a51, + 0x60a5e, 0x60ab2, 0x60ab3, 0x60ad0, 0x60b0f, 0x60b10, 0x60b32, 0x60b33, 0x60b47, + 0x60b48, 0x60b56, 0x60b57, 0x60b5c, 0x60b5d, 0x60b82, 0x60b83, 0x60b99, 0x60b9a, + 0x60b9c, 0x60b9e, 0x60b9f, 0x60ba3, 0x60ba4, 0x60bd0, 0x60bd7, 0x60c55, 0x60c56, + 0x60cd5, 0x60cd6, 0x60cde, 0x60cf1, 0x60cf2, 0x60d82, 0x60d83, 0x60dbd, 0x60dca, + 0x60dd6, 0x60e81, 0x60e82, 0x60e84, 0x60e87, 0x60e88, 0x60e8a, 0x60e8d, 0x60ea5, + 0x60ea7, 0x60eaa, 0x60eab, 0x60ec6, 0x610c7, 0x610cd, 0x61258, 0x612c0, 0x61772, + 0x61773, 0x61940, 0x61f59, 0x61f5b, 0x61f5d, 0x62070, 0x62071, 0x62d27, 0x62d2d, + 0x62d6f, 0x62d70, 0x6fb3e, 0x6fb40, 0x6fb41, 0x6fb43, 0x6fb44, 0x6fffc, 0x6fffd, + 0x7038c, 0x70589, 0x7058a, 0x7085e, 0x7098f, 0x70990, 0x709b2, 0x709c7, 0x709c8, + 0x709d7, 0x709dc, 0x709dd, 0x70a0f, 0x70a10, 0x70a32, 0x70a33, 0x70a35, 0x70a36, + 0x70a38, 0x70a39, 0x70a3c, 0x70a47, 0x70a48, 0x70a51, 0x70a5e, 0x70ab2, 0x70ab3, + 0x70ad0, 0x70b0f, 0x70b10, 0x70b32, 0x70b33, 0x70b47, 0x70b48, 0x70b56, 0x70b57, + 0x70b5c, 0x70b5d, 0x70b82, 0x70b83, 0x70b99, 0x70b9a, 0x70b9c, 0x70b9e, 0x70b9f, + 0x70ba3, 0x70ba4, 0x70bd0, 0x70bd7, 0x70c55, 0x70c56, 0x70cd5, 0x70cd6, 0x70cde, + 0x70cf1, 0x70cf2, 0x70d82, 0x70d83, 0x70dbd, 0x70dca, 0x70dd6, 0x70e81, 0x70e82, + 0x70e84, 0x70e87, 0x70e88, 0x70e8a, 0x70e8d, 0x70ea5, 0x70ea7, 0x70eaa, 0x70eab, + 0x70ec6, 0x710c7, 0x710cd, 0x71258, 0x712c0, 0x71772, 0x71773, 0x71940, 0x71f59, + 0x71f5b, 0x71f5d, 0x72070, 0x72071, 0x72d27, 0x72d2d, 0x72d6f, 0x72d70, 0x7fb3e, + 0x7fb40, 0x7fb41, 0x7fb43, 0x7fb44, 0x7fffc, 0x7fffd, 0x8038c, 0x80589, 0x8058a, + 0x8085e, 0x8098f, 0x80990, 0x809b2, 0x809c7, 0x809c8, 0x809d7, 0x809dc, 0x809dd, + 0x80a0f, 0x80a10, 0x80a32, 0x80a33, 0x80a35, 0x80a36, 0x80a38, 0x80a39, 0x80a3c, + 0x80a47, 0x80a48, 0x80a51, 0x80a5e, 0x80ab2, 0x80ab3, 0x80ad0, 0x80b0f, 0x80b10, + 0x80b32, 0x80b33, 0x80b47, 0x80b48, 0x80b56, 0x80b57, 0x80b5c, 0x80b5d, 0x80b82, + 0x80b83, 0x80b99, 0x80b9a, 0x80b9c, 0x80b9e, 0x80b9f, 0x80ba3, 0x80ba4, 0x80bd0, + 0x80bd7, 0x80c55, 0x80c56, 0x80cd5, 0x80cd6, 0x80cde, 0x80cf1, 0x80cf2, 0x80d82, + 0x80d83, 0x80dbd, 0x80dca, 0x80dd6, 0x80e81, 0x80e82, 0x80e84, 0x80e87, 0x80e88, + 0x80e8a, 0x80e8d, 0x80ea5, 0x80ea7, 0x80eaa, 0x80eab, 0x80ec6, 0x810c7, 0x810cd, + 0x81258, 0x812c0, 0x81772, 0x81773, 0x81940, 0x81f59, 0x81f5b, 0x81f5d, 0x82070, + 0x82071, 0x82d27, 0x82d2d, 0x82d6f, 0x82d70, 0x8fb3e, 0x8fb40, 0x8fb41, 0x8fb43, + 0x8fb44, 0x8fffc, 0x8fffd, 0x9038c, 0x90589, 0x9058a, 0x9085e, 0x9098f, 0x90990, + 0x909b2, 0x909c7, 0x909c8, 0x909d7, 0x909dc, 0x909dd, 0x90a0f, 0x90a10, 0x90a32, + 0x90a33, 0x90a35, 0x90a36, 0x90a38, 0x90a39, 0x90a3c, 0x90a47, 0x90a48, 0x90a51, + 0x90a5e, 0x90ab2, 0x90ab3, 0x90ad0, 0x90b0f, 0x90b10, 0x90b32, 0x90b33, 0x90b47, + 0x90b48, 0x90b56, 0x90b57, 0x90b5c, 0x90b5d, 0x90b82, 0x90b83, 0x90b99, 0x90b9a, + 0x90b9c, 0x90b9e, 0x90b9f, 0x90ba3, 0x90ba4, 0x90bd0, 0x90bd7, 0x90c55, 0x90c56, + 0x90cd5, 0x90cd6, 0x90cde, 0x90cf1, 0x90cf2, 0x90d82, 0x90d83, 0x90dbd, 0x90dca, + 0x90dd6, 0x90e81, 0x90e82, 0x90e84, 0x90e87, 0x90e88, 0x90e8a, 0x90e8d, 0x90ea5, + 0x90ea7, 0x90eaa, 0x90eab, 0x90ec6, 0x910c7, 0x910cd, 0x91258, 0x912c0, 0x91772, + 0x91773, 0x91940, 0x91f59, 0x91f5b, 0x91f5d, 0x92070, 0x92071, 0x92d27, 0x92d2d, + 0x92d6f, 0x92d70, 0x9fb3e, 0x9fb40, 0x9fb41, 0x9fb43, 0x9fb44, 0x9fffc, 0x9fffd, + 0xa038c, 0xa0589, 0xa058a, 0xa085e, 0xa098f, 0xa0990, 0xa09b2, 0xa09c7, 0xa09c8, + 0xa09d7, 0xa09dc, 0xa09dd, 0xa0a0f, 0xa0a10, 0xa0a32, 0xa0a33, 0xa0a35, 0xa0a36, + 0xa0a38, 0xa0a39, 0xa0a3c, 0xa0a47, 0xa0a48, 0xa0a51, 0xa0a5e, 0xa0ab2, 0xa0ab3, + 0xa0ad0, 0xa0b0f, 0xa0b10, 0xa0b32, 0xa0b33, 0xa0b47, 0xa0b48, 0xa0b56, 0xa0b57, + 0xa0b5c, 0xa0b5d, 0xa0b82, 0xa0b83, 0xa0b99, 0xa0b9a, 0xa0b9c, 0xa0b9e, 0xa0b9f, + 0xa0ba3, 0xa0ba4, 0xa0bd0, 0xa0bd7, 0xa0c55, 0xa0c56, 0xa0cd5, 0xa0cd6, 0xa0cde, + 0xa0cf1, 0xa0cf2, 0xa0d82, 0xa0d83, 0xa0dbd, 0xa0dca, 0xa0dd6, 0xa0e81, 0xa0e82, + 0xa0e84, 0xa0e87, 0xa0e88, 0xa0e8a, 0xa0e8d, 0xa0ea5, 0xa0ea7, 0xa0eaa, 0xa0eab, + 0xa0ec6, 0xa10c7, 0xa10cd, 0xa1258, 0xa12c0, 0xa1772, 0xa1773, 0xa1940, 0xa1f59, + 0xa1f5b, 0xa1f5d, 0xa2070, 0xa2071, 0xa2d27, 0xa2d2d, 0xa2d6f, 0xa2d70, 0xafb3e, + 0xafb40, 0xafb41, 0xafb43, 0xafb44, 0xafffc, 0xafffd, 0xb038c, 0xb0589, 0xb058a, + 0xb085e, 0xb098f, 0xb0990, 0xb09b2, 0xb09c7, 0xb09c8, 0xb09d7, 0xb09dc, 0xb09dd, + 0xb0a0f, 0xb0a10, 0xb0a32, 0xb0a33, 0xb0a35, 0xb0a36, 0xb0a38, 0xb0a39, 0xb0a3c, + 0xb0a47, 0xb0a48, 0xb0a51, 0xb0a5e, 0xb0ab2, 0xb0ab3, 0xb0ad0, 0xb0b0f, 0xb0b10, + 0xb0b32, 0xb0b33, 0xb0b47, 0xb0b48, 0xb0b56, 0xb0b57, 0xb0b5c, 0xb0b5d, 0xb0b82, + 0xb0b83, 0xb0b99, 0xb0b9a, 0xb0b9c, 0xb0b9e, 0xb0b9f, 0xb0ba3, 0xb0ba4, 0xb0bd0, + 0xb0bd7, 0xb0c55, 0xb0c56, 0xb0cd5, 0xb0cd6, 0xb0cde, 0xb0cf1, 0xb0cf2, 0xb0d82, + 0xb0d83, 0xb0dbd, 0xb0dca, 0xb0dd6, 0xb0e81, 0xb0e82, 0xb0e84, 0xb0e87, 0xb0e88, + 0xb0e8a, 0xb0e8d, 0xb0ea5, 0xb0ea7, 0xb0eaa, 0xb0eab, 0xb0ec6, 0xb10c7, 0xb10cd, + 0xb1258, 0xb12c0, 0xb1772, 0xb1773, 0xb1940, 0xb1f59, 0xb1f5b, 0xb1f5d, 0xb2070, + 0xb2071, 0xb2d27, 0xb2d2d, 0xb2d6f, 0xb2d70, 0xbfb3e, 0xbfb40, 0xbfb41, 0xbfb43, + 0xbfb44, 0xbfffc, 0xbfffd, 0xc038c, 0xc0589, 0xc058a, 0xc085e, 0xc098f, 0xc0990, + 0xc09b2, 0xc09c7, 0xc09c8, 0xc09d7, 0xc09dc, 0xc09dd, 0xc0a0f, 0xc0a10, 0xc0a32, + 0xc0a33, 0xc0a35, 0xc0a36, 0xc0a38, 0xc0a39, 0xc0a3c, 0xc0a47, 0xc0a48, 0xc0a51, + 0xc0a5e, 0xc0ab2, 0xc0ab3, 0xc0ad0, 0xc0b0f, 0xc0b10, 0xc0b32, 0xc0b33, 0xc0b47, + 0xc0b48, 0xc0b56, 0xc0b57, 0xc0b5c, 0xc0b5d, 0xc0b82, 0xc0b83, 0xc0b99, 0xc0b9a, + 0xc0b9c, 0xc0b9e, 0xc0b9f, 0xc0ba3, 0xc0ba4, 0xc0bd0, 0xc0bd7, 0xc0c55, 0xc0c56, + 0xc0cd5, 0xc0cd6, 0xc0cde, 0xc0cf1, 0xc0cf2, 0xc0d82, 0xc0d83, 0xc0dbd, 0xc0dca, + 0xc0dd6, 0xc0e81, 0xc0e82, 0xc0e84, 0xc0e87, 0xc0e88, 0xc0e8a, 0xc0e8d, 0xc0ea5, + 0xc0ea7, 0xc0eaa, 0xc0eab, 0xc0ec6, 0xc10c7, 0xc10cd, 0xc1258, 0xc12c0, 0xc1772, + 0xc1773, 0xc1940, 0xc1f59, 0xc1f5b, 0xc1f5d, 0xc2070, 0xc2071, 0xc2d27, 0xc2d2d, + 0xc2d6f, 0xc2d70, 0xcfb3e, 0xcfb40, 0xcfb41, 0xcfb43, 0xcfb44, 0xcfffc, 0xcfffd, + 0xd038c, 0xd0589, 0xd058a, 0xd085e, 0xd098f, 0xd0990, 0xd09b2, 0xd09c7, 0xd09c8, + 0xd09d7, 0xd09dc, 0xd09dd, 0xd0a0f, 0xd0a10, 0xd0a32, 0xd0a33, 0xd0a35, 0xd0a36, + 0xd0a38, 0xd0a39, 0xd0a3c, 0xd0a47, 0xd0a48, 0xd0a51, 0xd0a5e, 0xd0ab2, 0xd0ab3, + 0xd0ad0, 0xd0b0f, 0xd0b10, 0xd0b32, 0xd0b33, 0xd0b47, 0xd0b48, 0xd0b56, 0xd0b57, + 0xd0b5c, 0xd0b5d, 0xd0b82, 0xd0b83, 0xd0b99, 0xd0b9a, 0xd0b9c, 0xd0b9e, 0xd0b9f, + 0xd0ba3, 0xd0ba4, 0xd0bd0, 0xd0bd7, 0xd0c55, 0xd0c56, 0xd0cd5, 0xd0cd6, 0xd0cde, + 0xd0cf1, 0xd0cf2, 0xd0d82, 0xd0d83, 0xd0dbd, 0xd0dca, 0xd0dd6, 0xd0e81, 0xd0e82, + 0xd0e84, 0xd0e87, 0xd0e88, 0xd0e8a, 0xd0e8d, 0xd0ea5, 0xd0ea7, 0xd0eaa, 0xd0eab, + 0xd0ec6, 0xd10c7, 0xd10cd, 0xd1258, 0xd12c0, 0xd1772, 0xd1773, 0xd1940, 0xd1f59, + 0xd1f5b, 0xd1f5d, 0xd2070, 0xd2071, 0xd2d27, 0xd2d2d, 0xd2d6f, 0xd2d70, 0xdfb3e, + 0xdfb40, 0xdfb41, 0xdfb43, 0xdfb44, 0xdfffc, 0xdfffd, 0xe038c, 0xe0589, 0xe058a, + 0xe085e, 0xe098f, 0xe0990, 0xe09b2, 0xe09c7, 0xe09c8, 0xe09d7, 0xe09dc, 0xe09dd, + 0xe0a0f, 0xe0a10, 0xe0a32, 0xe0a33, 0xe0a35, 0xe0a36, 0xe0a38, 0xe0a39, 0xe0a3c, + 0xe0a47, 0xe0a48, 0xe0a51, 0xe0a5e, 0xe0ab2, 0xe0ab3, 0xe0ad0, 0xe0b0f, 0xe0b10, + 0xe0b32, 0xe0b33, 0xe0b47, 0xe0b48, 0xe0b56, 0xe0b57, 0xe0b5c, 0xe0b5d, 0xe0b82, + 0xe0b83, 0xe0b99, 0xe0b9a, 0xe0b9c, 0xe0b9e, 0xe0b9f, 0xe0ba3, 0xe0ba4, 0xe0bd0, + 0xe0bd7, 0xe0c55, 0xe0c56, 0xe0cd5, 0xe0cd6, 0xe0cde, 0xe0cf1, 0xe0cf2, 0xe0d82, + 0xe0d83, 0xe0dbd, 0xe0dca, 0xe0dd6, 0xe0e81, 0xe0e82, 0xe0e84, 0xe0e87, 0xe0e88, + 0xe0e8a, 0xe0e8d, 0xe0ea5, 0xe0ea7, 0xe0eaa, 0xe0eab, 0xe0ec6, 0xe10c7, 0xe10cd, + 0xe1258, 0xe12c0, 0xe1772, 0xe1773, 0xe1940, 0xe1f59, 0xe1f5b, 0xe1f5d, 0xe2070, + 0xe2071, 0xe2d27, 0xe2d2d, 0xe2d6f, 0xe2d70, 0xefb3e, 0xefb40, 0xefb41, 0xefb43, + 0xefb44, 0xefffc, 0xefffd, 0xf038c, 0xf0589, 0xf058a, 0xf085e, 0xf098f, 0xf0990, + 0xf09b2, 0xf09c7, 0xf09c8, 0xf09d7, 0xf09dc, 0xf09dd, 0xf0a0f, 0xf0a10, 0xf0a32, + 0xf0a33, 0xf0a35, 0xf0a36, 0xf0a38, 0xf0a39, 0xf0a3c, 0xf0a47, 0xf0a48, 0xf0a51, + 0xf0a5e, 0xf0ab2, 0xf0ab3, 0xf0ad0, 0xf0b0f, 0xf0b10, 0xf0b32, 0xf0b33, 0xf0b47, + 0xf0b48, 0xf0b56, 0xf0b57, 0xf0b5c, 0xf0b5d, 0xf0b82, 0xf0b83, 0xf0b99, 0xf0b9a, + 0xf0b9c, 0xf0b9e, 0xf0b9f, 0xf0ba3, 0xf0ba4, 0xf0bd0, 0xf0bd7, 0xf0c55, 0xf0c56, + 0xf0cd5, 0xf0cd6, 0xf0cde, 0xf0cf1, 0xf0cf2, 0xf0d82, 0xf0d83, 0xf0dbd, 0xf0dca, + 0xf0dd6, 0xf0e81, 0xf0e82, 0xf0e84, 0xf0e87, 0xf0e88, 0xf0e8a, 0xf0e8d, 0xf0ea5, + 0xf0ea7, 0xf0eaa, 0xf0eab, 0xf0ec6, 0xf10c7, 0xf10cd, 0xf1258, 0xf12c0, 0xf1772, + 0xf1773, 0xf1940, 0xf1f59, 0xf1f5b, 0xf1f5d, 0xf2070, 0xf2071, 0xf2d27, 0xf2d2d, + 0xf2d6f, 0xf2d70, 0xffb3e, 0xffb40, 0xffb41, 0xffb43, 0xffb44, 0xffffc, 0xffffd, + 0x10038c, 0x100589, 0x10058a, 0x10085e, 0x10098f, 0x100990, 0x1009b2, 0x1009c7, 0x1009c8, + 0x1009d7, 0x1009dc, 0x1009dd, 0x100a0f, 0x100a10, 0x100a32, 0x100a33, 0x100a35, 0x100a36, + 0x100a38, 0x100a39, 0x100a3c, 0x100a47, 0x100a48, 0x100a51, 0x100a5e, 0x100ab2, 0x100ab3, + 0x100ad0, 0x100b0f, 0x100b10, 0x100b32, 0x100b33, 0x100b47, 0x100b48, 0x100b56, 0x100b57, + 0x100b5c, 0x100b5d, 0x100b82, 0x100b83, 0x100b99, 0x100b9a, 0x100b9c, 0x100b9e, 0x100b9f, + 0x100ba3, 0x100ba4, 0x100bd0, 0x100bd7, 0x100c55, 0x100c56, 0x100cd5, 0x100cd6, 0x100cde, + 0x100cf1, 0x100cf2, 0x100d82, 0x100d83, 0x100dbd, 0x100dca, 0x100dd6, 0x100e81, 0x100e82, + 0x100e84, 0x100e87, 0x100e88, 0x100e8a, 0x100e8d, 0x100ea5, 0x100ea7, 0x100eaa, 0x100eab, + 0x100ec6, 0x1010c7, 0x1010cd, 0x101258, 0x1012c0, 0x101772, 0x101773, 0x101940, 0x101f59, + 0x101f5b, 0x101f5d, 0x102070, 0x102071, 0x102d27, 0x102d2d, 0x102d6f, 0x102d70, 0x10fb3e, + 0x10fb40, 0x10fb41, 0x10fb43, 0x10fb44, 0x10fffc, 0x10fffd #endif }; diff --git a/generic/tclUniData.c b/generic/tclUniData.c index d8b317a..9f05230 100644 --- a/generic/tclUniData.c +++ b/generic/tclUniData.c @@ -29,36 +29,36 @@ static const unsigned short pageMap[] = { 832, 864, 896, 928, 960, 992, 224, 1024, 224, 1056, 224, 224, 1088, 1120, 1152, 1184, 1216, 1248, 1280, 1312, 1344, 1376, 1408, 1344, 1344, 1440, 1472, 1504, 1536, 1568, 1344, 1344, 1600, 1632, 1664, 1696, 1728, - 1760, 1792, 1792, 1824, 1856, 1888, 1920, 1952, 1984, 2016, 2048, 2080, - 2112, 2144, 2176, 2208, 2240, 2272, 2304, 2336, 2368, 2400, 2432, 2464, - 2496, 2528, 2560, 2592, 2624, 2656, 2688, 2720, 2752, 2784, 2816, 2848, - 2880, 2912, 2944, 2976, 3008, 3040, 3072, 3104, 3136, 3168, 3200, 3232, - 3264, 1792, 3296, 3328, 3360, 1792, 3392, 3424, 3456, 3488, 3520, 3552, - 3584, 1792, 1344, 3616, 3648, 3680, 3712, 3744, 3776, 3808, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 3840, 1344, 3872, 3904, - 3936, 1344, 3968, 1344, 4000, 4032, 4064, 4096, 4096, 4128, 4160, 1344, + 1760, 1792, 1824, 1856, 1888, 1920, 1952, 1984, 2016, 2048, 2080, 2112, + 2144, 2176, 2208, 2240, 2272, 2304, 2336, 2368, 2400, 2432, 2464, 2496, + 2528, 2560, 2592, 2624, 2656, 2688, 2720, 2752, 2784, 2816, 2848, 2880, + 2912, 2944, 2976, 3008, 3040, 3072, 3104, 3136, 3168, 3200, 3232, 3264, + 3296, 1824, 3328, 3360, 3392, 1824, 3424, 3456, 3488, 3520, 3552, 3584, + 3616, 1824, 1344, 3648, 3680, 3712, 3744, 3776, 3808, 3840, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 3872, 1344, 3904, 3936, + 3968, 1344, 4000, 1344, 4032, 4064, 4096, 4128, 4128, 4160, 4192, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 4192, 4224, 1344, 1344, 4256, 4288, 4320, - 4352, 4384, 1344, 4416, 4448, 4480, 4512, 1344, 4544, 4576, 4608, 4640, - 1344, 4672, 4704, 4736, 4768, 4800, 1344, 4832, 4864, 4896, 4928, 1344, - 4960, 4992, 5024, 5056, 1792, 1792, 5088, 5120, 5152, 5184, 5216, 5248, - 1344, 5280, 1344, 5312, 5344, 5376, 5408, 1792, 5440, 5472, 5504, 5536, - 5568, 5600, 5632, 5568, 704, 5664, 224, 224, 224, 224, 5696, 224, 224, - 224, 5728, 5760, 5792, 5824, 5856, 5888, 5920, 5952, 5984, 6016, 6048, - 6080, 6112, 6144, 6176, 6208, 6240, 6272, 6304, 6336, 6368, 6400, 6432, - 6464, 6496, 6496, 6496, 6496, 6496, 6496, 6496, 6496, 6528, 6560, 4896, - 6592, 6624, 6656, 6688, 6720, 4896, 6752, 6784, 6816, 6848, 6880, 6912, - 6944, 4896, 4896, 4896, 4896, 4896, 6976, 7008, 7040, 4896, 4896, 4896, - 7072, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 7104, 7136, 4896, 7168, - 7200, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 6496, 6496, 6496, - 6496, 7232, 6496, 7264, 7296, 6496, 6496, 6496, 6496, 6496, 6496, 6496, - 6496, 4896, 7328, 7360, 7392, 7424, 7456, 7488, 7520, 7552, 7584, 7616, - 7648, 224, 224, 224, 7680, 7712, 7744, 1344, 7776, 7808, 7840, 7840, - 704, 7872, 7904, 7936, 1792, 7968, 4896, 4896, 8000, 4896, 4896, 4896, - 4896, 4896, 4896, 8032, 8064, 8096, 8128, 3200, 1344, 8160, 4160, 1344, - 8192, 8224, 8256, 1344, 1344, 8288, 8320, 4896, 8352, 8384, 8416, 8448, - 4896, 8416, 8480, 4896, 8384, 4896, 4896, 4896, 4896, 4896, 4896, 4896, - 4896, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 4224, 4256, 1344, 1344, 4288, 4320, 4352, + 4384, 4416, 1344, 4448, 4480, 4512, 4544, 1344, 4576, 4608, 4640, 4672, + 1344, 4704, 4736, 4768, 4800, 4832, 1344, 4864, 4896, 4928, 4960, 1344, + 4992, 5024, 5056, 5088, 1824, 1824, 5120, 5152, 5184, 5216, 5248, 5280, + 1344, 5312, 1344, 5344, 5376, 5408, 5440, 1824, 5472, 5504, 5536, 5568, + 5600, 5632, 5664, 5600, 704, 5696, 224, 224, 224, 224, 5728, 224, 224, + 224, 5760, 5792, 5824, 5856, 5888, 5920, 5952, 5984, 6016, 6048, 6080, + 6112, 6144, 6176, 6208, 6240, 6272, 6304, 6336, 6368, 6400, 6432, 6464, + 6496, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6560, 6592, 4928, + 6624, 6656, 6688, 6720, 6752, 4928, 6784, 6816, 6848, 6880, 6912, 6944, + 6976, 4928, 4928, 4928, 4928, 4928, 7008, 7040, 7072, 4928, 4928, 4928, + 7104, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 7136, 7168, 4928, 7200, + 7232, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 6528, 6528, 6528, + 6528, 7264, 6528, 7296, 7328, 6528, 6528, 6528, 6528, 6528, 6528, 6528, + 6528, 4928, 7360, 7392, 7424, 7456, 7488, 7520, 7552, 7584, 7616, 7648, + 7680, 224, 224, 224, 7712, 7744, 7776, 1344, 7808, 7840, 7872, 7872, + 704, 7904, 7936, 7968, 1824, 8000, 4928, 4928, 8032, 4928, 4928, 4928, + 4928, 4928, 4928, 8064, 8096, 8128, 8160, 3232, 1344, 8192, 4192, 1344, + 8224, 8256, 8288, 1344, 1344, 8320, 8352, 4928, 8384, 8416, 8448, 8480, + 4928, 8448, 8512, 4928, 8416, 4928, 4928, 4928, 4928, 4928, 4928, 4928, + 4928, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -75,7 +75,7 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 4672, 4896, 4896, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 4704, 4928, 4928, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -129,17 +129,16 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 4672, - 1792, 8512, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1792, 8544, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 8544, 4896, 8576, 5376, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 8608, 8640, 224, 8672, 8704, 1344, 1344, 8736, 8768, 8800, 224, - 8832, 8864, 8896, 1792, 8928, 8960, 8992, 1344, 9024, 9056, 9088, 9120, - 9152, 1632, 9184, 9216, 9248, 1920, 9280, 9312, 9344, 1344, 9376, 9408, - 9440, 1344, 9472, 9504, 9536, 9568, 9600, 9632, 9664, 9696, 9696, 1344, - 9728, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 8576, 4928, 8608, 5408, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 8640, 8672, 224, 8704, 8736, 1344, 1344, 8768, 8800, 8832, 224, + 8864, 8896, 8928, 1824, 8960, 8992, 9024, 1344, 9056, 9088, 9120, 9152, + 9184, 1632, 9216, 9248, 9280, 1952, 9312, 9344, 9376, 1344, 9408, 9440, + 9472, 1344, 9504, 9536, 9568, 9600, 9632, 9664, 9696, 9728, 9728, 1344, + 9760, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -167,211 +166,216 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 9760, 9792, 9824, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 9792, 9824, 9856, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 9920, 1344, 1344, 9952, 1792, 9984, 10016, - 10048, 1344, 1344, 10080, 10112, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 10144, 10176, 1344, 10208, 1344, 10240, 10272, - 10304, 10336, 10368, 10400, 1344, 1344, 1344, 10432, 10464, 64, 10496, - 10528, 10560, 4704, 10592, 10624 + 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 9952, 1344, 1344, 9984, 1824, 10016, 10048, + 10080, 1344, 1344, 10112, 10144, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 10176, 10208, 1344, 10240, 1344, 10272, 10304, + 10336, 10368, 10400, 10432, 1344, 1344, 1344, 10464, 10496, 64, 10528, + 10560, 10592, 4736, 10624, 10656 #if TCL_UTF_MAX > 3 - ,10656, 10688, 10720, 1792, 1344, 1344, 1344, 8320, 10752, 10784, 10816, - 10848, 10880, 10912, 10944, 10976, 1792, 1792, 1792, 1792, 9248, 1344, - 11008, 11040, 1344, 11072, 11104, 11136, 11168, 1344, 11200, 1792, - 11232, 11264, 11296, 1344, 11328, 11360, 11392, 11424, 1344, 11456, - 1344, 11488, 1792, 1792, 1792, 1792, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 7808, 4672, 10240, 1792, 1792, 1792, 1792, - 11520, 11552, 11584, 11616, 4704, 11648, 1792, 11680, 11712, 11744, - 1792, 1792, 1344, 11776, 11808, 6816, 11840, 11872, 11904, 11936, 11968, - 1792, 12000, 12032, 1344, 12064, 12096, 12128, 12160, 12192, 1792, - 1792, 1344, 1344, 12224, 1792, 12256, 12288, 12320, 12352, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 12384, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 12416, - 12448, 12480, 12512, 5216, 12544, 12576, 12608, 12640, 12672, 12704, - 12736, 5216, 12768, 12800, 12832, 12864, 12896, 1792, 1792, 12928, - 12960, 12992, 13024, 13056, 2336, 13088, 13120, 1792, 1792, 1792, 1792, - 1344, 13152, 13184, 1792, 1344, 13216, 13248, 1792, 1792, 1792, 1792, - 1792, 1344, 13280, 13312, 1792, 1344, 13344, 13376, 13408, 1344, 13440, - 13472, 1792, 13504, 13536, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 13568, 13600, 13632, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 13664, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 13696, 13728, 13760, - 13792, 13824, 13856, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 9952, 1792, - 1792, 1792, 10816, 10816, 10816, 13888, 1344, 1344, 1344, 1344, 1344, - 1344, 13920, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 13952, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 13984, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 13664, 4704, 14016, 1792, 1792, 10176, 14048, 1344, - 14080, 14112, 14144, 14176, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 14208, - 14240, 14272, 1792, 1792, 14304, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 14336, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 14368, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 14400, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, 14432, 14464, 14496, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 4896, 4896, - 4896, 4896, 4896, 4896, 4896, 8032, 4896, 14528, 4896, 14560, 14592, - 14624, 4896, 14656, 4896, 4896, 14688, 1792, 1792, 1792, 1792, 1792, - 4896, 4896, 14720, 14752, 1792, 1792, 1792, 1792, 14784, 14816, 14848, - 14880, 14912, 14944, 14976, 15008, 15040, 15072, 15104, 15136, 15168, - 14784, 14816, 15200, 14880, 15232, 15264, 15296, 15008, 15328, 15360, - 15392, 15424, 15456, 15488, 15520, 15552, 15584, 15616, 15648, 4896, - 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, - 4896, 4896, 4896, 704, 15680, 704, 15712, 15744, 15776, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 15808, 15840, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, - 1344, 1344, 1344, 15872, 1792, 15904, 15936, 15968, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 16000, - 16032, 16064, 16096, 16128, 16160, 1792, 16192, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 4896, 16224, 4896, 4896, 8000, 16256, 16288, - 8032, 16320, 16352, 4896, 16224, 4896, 16384, 1792, 16416, 16448, 16480, - 16512, 1792, 1792, 1792, 1792, 1792, 4896, 4896, 4896, 4896, 4896, - 4896, 4896, 16544, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, - 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, - 4896, 4896, 16576, 16608, 4896, 4896, 4896, 8000, 4896, 4896, 16640, - 1792, 16224, 4896, 16672, 4896, 16704, 16736, 1792, 1792, 16768, 16800, - 16832, 1792, 16864, 1792, 10912, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, 1344, 1344, + ,10688, 10720, 10752, 1824, 1344, 1344, 1344, 8352, 10784, 10816, 10848, + 10880, 10912, 10944, 10976, 11008, 1824, 1824, 1824, 1824, 9280, 1344, + 11040, 11072, 1344, 11104, 11136, 11168, 11200, 1344, 11232, 1824, + 11264, 11296, 11328, 1344, 11360, 11392, 11424, 11456, 1344, 11488, + 1344, 11520, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 7840, 4704, 10272, 1824, 1824, 1824, 1824, + 11552, 11584, 11616, 11648, 4736, 11680, 1824, 11712, 11744, 11776, + 1824, 1824, 1344, 11808, 11840, 6848, 11872, 11904, 11936, 11968, 12000, + 1824, 12032, 12064, 1344, 12096, 12128, 12160, 12192, 12224, 1824, + 1824, 1344, 1344, 12256, 1824, 12288, 12320, 12352, 12384, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 12416, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 12448, + 12480, 12512, 12544, 5248, 12576, 12608, 12640, 12672, 12704, 12736, + 12768, 5248, 12800, 12832, 12864, 12896, 12928, 1824, 1824, 12960, + 12992, 13024, 13056, 13088, 2368, 13120, 13152, 1824, 1824, 1824, 1824, + 1344, 13184, 13216, 1824, 1344, 13248, 13280, 1824, 1824, 1824, 1824, + 1824, 1344, 13312, 13344, 1824, 1344, 13376, 13408, 13440, 1344, 13472, + 13504, 1824, 13536, 13568, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 13600, 13632, 13664, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 13696, 13728, 13760, 1344, 13792, 13824, 1344, + 13856, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 13888, 13920, + 13952, 13984, 14016, 14048, 1824, 1824, 14080, 14112, 14144, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 9984, 1824, 1824, 1824, 10848, 10848, 10848, 14176, 1344, 1344, 1344, + 1344, 1344, 1344, 14208, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 14240, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 14272, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 13856, 4736, 14304, 1824, 1824, 10208, + 14336, 1344, 14368, 14400, 14432, 14464, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, + 14496, 14528, 14560, 1824, 1824, 14592, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 14624, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 14656, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 4736, 1824, 1824, 10208, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 9856, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 14688, 14720, + 14752, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 4928, 4928, 4928, 4928, 4928, 4928, 4928, 8064, 4928, 14784, 4928, + 14816, 14848, 14880, 4928, 14912, 4928, 4928, 14944, 1824, 1824, 1824, + 1824, 1824, 4928, 4928, 14976, 15008, 1824, 1824, 1824, 1824, 15040, + 15072, 15104, 15136, 15168, 15200, 15232, 15264, 15296, 15328, 15360, + 15392, 15424, 15040, 15072, 15456, 15136, 15488, 15520, 15552, 15264, + 15584, 15616, 15648, 15680, 15712, 15744, 15776, 15808, 15840, 15872, + 15904, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, + 4928, 4928, 4928, 4928, 4928, 4928, 704, 15936, 704, 15968, 16000, + 16032, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 16064, 16096, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1344, 1344, 1344, 1344, 1344, 1344, 16128, 1824, 16160, 16192, + 16224, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 16256, 16288, 16320, 16352, 16384, 16416, 1824, 16448, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 4928, 16480, 4928, + 4928, 8032, 16512, 16544, 8064, 16576, 16608, 4928, 16480, 4928, 16640, + 1824, 16672, 16704, 16736, 16768, 16800, 1824, 1824, 1824, 1824, 4928, + 4928, 4928, 4928, 4928, 4928, 4928, 16832, 4928, 4928, 4928, 4928, + 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, + 4928, 4928, 4928, 4928, 4928, 4928, 16864, 16896, 4928, 4928, 4928, + 8032, 4928, 4928, 16864, 1824, 16480, 4928, 16928, 4928, 16960, 16992, + 1824, 1824, 16480, 8416, 17024, 17056, 17088, 1824, 17120, 6784, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -479,10 +483,10 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 7840, 1824, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 7808, 1792, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -490,11 +494,10 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 17152, 1344, 1344, 1344, 1344, 1344, 1344, 11360, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 16896, 1344, 1344, - 1344, 1344, 1344, 1344, 11328, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -506,39 +509,36 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 17184, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 14400, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 11328 + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 17216, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 11360 #endif /* TCL_UTF_MAX > 3 */ }; @@ -652,72 +652,74 @@ static const unsigned char groupMap[] = { 92, 92, 91, 92, 92, 92, 91, 92, 92, 92, 92, 92, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, - 92, 92, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, - 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 17, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 0, 0, 3, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 17, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 124, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 124, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 92, 124, 92, 15, 124, 124, 124, 92, 92, - 92, 92, 92, 92, 92, 92, 124, 124, 124, 124, 92, 124, 124, 15, 92, 92, - 92, 92, 92, 92, 92, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, - 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 3, 91, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 124, 0, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, + 124, 92, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, + 124, 124, 92, 124, 124, 15, 92, 92, 92, 92, 92, 92, 92, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 92, 92, 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 3, 91, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 0, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 0, 0, 0, + 15, 15, 15, 15, 0, 0, 92, 15, 124, 124, 124, 92, 92, 92, 92, 0, 0, + 124, 124, 0, 0, 124, 124, 92, 15, 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, + 0, 0, 15, 15, 0, 15, 15, 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 15, 15, 4, 4, 18, 18, 18, 18, 18, 18, 14, 4, 15, 3, 0, 0, 0, + 92, 92, 124, 0, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 15, 15, 0, 0, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, + 0, 15, 15, 0, 0, 92, 0, 124, 124, 124, 92, 92, 0, 0, 0, 0, 92, 92, + 0, 0, 92, 92, 92, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, + 0, 15, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 92, 92, 15, + 15, 15, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 124, 0, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, 15, 15, 0, 0, + 92, 15, 124, 124, 124, 92, 92, 92, 92, 92, 0, 92, 92, 124, 0, 124, + 124, 92, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, + 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 3, 4, 0, 0, 0, 0, 0, + 0, 0, 15, 92, 92, 92, 92, 92, 92, 0, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, - 15, 15, 15, 15, 15, 0, 15, 0, 0, 0, 15, 15, 15, 15, 0, 0, 92, 15, 124, - 124, 124, 92, 92, 92, 92, 0, 0, 124, 124, 0, 0, 124, 124, 92, 15, 0, - 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 15, 15, 0, 15, 15, 15, 92, 92, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 15, 15, 4, 4, 18, 18, 18, 18, 18, - 18, 14, 4, 0, 0, 0, 0, 0, 92, 92, 124, 0, 15, 15, 15, 15, 15, 15, 0, - 0, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, - 15, 15, 0, 15, 15, 0, 15, 15, 0, 15, 15, 0, 0, 92, 0, 124, 124, 124, - 92, 92, 0, 0, 0, 0, 92, 92, 0, 0, 92, 92, 92, 0, 0, 0, 92, 0, 0, 0, - 0, 0, 0, 0, 15, 15, 15, 15, 0, 15, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 92, 92, 15, 15, 15, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 92, 92, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, - 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, - 0, 15, 15, 15, 15, 15, 0, 0, 92, 15, 124, 124, 124, 92, 92, 92, 92, - 92, 0, 92, 92, 124, 0, 124, 124, 92, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 3, 4, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 92, 124, - 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, - 15, 15, 0, 0, 92, 15, 124, 92, 124, 92, 92, 92, 92, 0, 0, 124, 124, - 0, 0, 124, 124, 92, 0, 0, 0, 0, 0, 0, 0, 0, 92, 124, 0, 0, 0, 0, 15, - 15, 0, 15, 15, 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 14, - 15, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 15, 0, - 15, 15, 15, 15, 15, 15, 0, 0, 0, 15, 15, 15, 0, 15, 15, 15, 15, 0, - 0, 0, 15, 15, 0, 15, 0, 15, 15, 0, 0, 0, 15, 15, 0, 0, 0, 15, 15, 15, - 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, - 124, 124, 92, 124, 124, 0, 0, 0, 124, 124, 124, 0, 124, 124, 124, 92, - 0, 0, 15, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 14, 14, 14, 14, 14, - 14, 4, 14, 0, 0, 0, 0, 0, 92, 124, 124, 124, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 15, 92, - 92, 92, 124, 124, 124, 124, 0, 92, 92, 92, 0, 92, 92, 92, 92, 0, 0, - 0, 0, 0, 0, 0, 92, 92, 0, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, 92, 92, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, - 18, 18, 18, 18, 18, 14, 15, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 0, 0, 92, 15, 124, 92, - 124, 124, 124, 124, 124, 0, 92, 124, 124, 0, 124, 124, 92, 92, 0, 0, - 0, 0, 0, 0, 0, 124, 124, 0, 0, 0, 0, 0, 0, 0, 15, 0, 15, 15, 92, 92, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 15, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, 15, 15, 0, 0, 92, 15, + 124, 92, 124, 92, 92, 92, 92, 0, 0, 124, 124, 0, 0, 124, 124, 92, 0, + 0, 0, 0, 0, 0, 0, 0, 92, 124, 0, 0, 0, 0, 15, 15, 0, 15, 15, 15, 92, + 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 14, 15, 18, 18, 18, 18, 18, + 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 15, 0, 15, 15, 15, 15, 15, 15, + 0, 0, 0, 15, 15, 15, 0, 15, 15, 15, 15, 0, 0, 0, 15, 15, 0, 15, 0, + 15, 15, 0, 0, 0, 15, 15, 0, 0, 0, 15, 15, 15, 0, 0, 0, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 124, 124, 92, 124, + 124, 0, 0, 0, 124, 124, 124, 0, 124, 124, 124, 92, 0, 0, 15, 0, 0, + 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 14, 14, 14, 14, 14, 14, 4, 14, 0, + 0, 0, 0, 0, 92, 124, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 15, 92, 92, 92, 124, + 124, 124, 124, 0, 92, 92, 92, 0, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, + 0, 92, 92, 0, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, 92, 92, 0, 0, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, + 18, 18, 14, 15, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 0, 0, 92, 15, 124, 92, 124, + 124, 124, 124, 124, 0, 92, 124, 124, 0, 124, 124, 92, 92, 0, 0, 0, + 0, 0, 0, 0, 124, 124, 0, 0, 0, 0, 0, 0, 0, 15, 0, 15, 15, 92, 92, 0, + 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 92, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 124, 124, 124, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 15, 124, 124, 124, 92, 92, 92, 92, 0, 124, 124, 124, 0, 124, 124, 124, 92, 15, 14, 0, 0, 0, 0, 15, 15, 15, 124, 18, 18, 18, 18, 18, 18, 18, 15, 15, 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 18, 18, 18, 18, @@ -857,7 +859,7 @@ static const unsigned char groupMap[] = { 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 3, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 124, 92, 92, 92, 92, 92, 92, 92, 15, 15, 15, 15, 92, 15, 15, 15, 15, - 124, 124, 92, 15, 15, 0, 92, 92, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, + 124, 124, 92, 15, 15, 124, 92, 92, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, @@ -868,9 +870,9 @@ static const unsigned char groupMap[] = { 21, 21, 137, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 92, 92, 92, 92, 92, - 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 21, 21, 21, 21, 21, 138, 21, 21, 139, 21, 140, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 0, 92, 92, 92, 92, + 92, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, + 23, 24, 23, 24, 23, 24, 21, 21, 21, 21, 21, 138, 21, 21, 139, 21, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 0, 0, 141, 141, 141, 141, 141, 141, 0, 0, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, @@ -897,7 +899,7 @@ static const unsigned char groupMap[] = { 18, 18, 7, 7, 7, 5, 6, 91, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 7, 7, 7, 5, 6, 0, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 119, 119, 119, 119, 92, 119, 119, 119, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, @@ -930,7 +932,7 @@ static const unsigned char groupMap[] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 7, 7, 7, 7, 7, 7, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, @@ -971,9 +973,9 @@ static const unsigned char groupMap[] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 0, 123, 123, 123, 123, @@ -996,7 +998,7 @@ static const unsigned char groupMap[] = { 0, 3, 3, 16, 20, 16, 20, 3, 3, 3, 16, 20, 3, 16, 20, 3, 3, 3, 3, 3, 3, 3, 3, 3, 8, 3, 3, 8, 3, 16, 20, 3, 3, 16, 20, 5, 6, 5, 6, 5, 6, 5, 6, 3, 3, 3, 3, 3, 91, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 8, 8, 3, 3, - 3, 3, 8, 3, 5, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 3, 8, 3, 5, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, @@ -1014,7 +1016,7 @@ static const unsigned char groupMap[] = { 15, 15, 15, 15, 15, 3, 91, 91, 91, 15, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 14, 14, 18, 18, 18, 18, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, @@ -1173,245 +1175,269 @@ static const unsigned char groupMap[] = { 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 18, 18, 18, 18, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 127, 15, 15, 15, 15, 15, 15, 15, - 15, 127, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 127, 15, 15, 15, 15, 15, 15, + 15, 15, 127, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, 92, 92, 0, 0, 0, - 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 3, 15, 15, - 15, 15, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 3, 127, 127, 127, - 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 194, 194, 194, 194, 194, 194, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, 92, 92, 0, + 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 3, 15, 15, 15, 15, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 3, 127, + 127, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 195, 195, 195, 195, 195, 195, 195, 195, + 194, 194, 194, 194, 194, 194, 194, 194, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 195, 195, 195, 195, 195, 195, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 194, 194, 194, + 15, 15, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 0, 0, 0, 0, 195, 195, 195, 195, 195, 195, + 194, 194, 194, 194, 194, 194, 194, 0, 0, 0, 0, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, - 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 0, 0, 15, - 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 0, 0, 15, - 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 0, 3, 18, 18, 18, 18, 18, 18, 18, 18, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 14, 14, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, - 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 0, 0, 0, 0, 18, 18, 18, - 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 18, 18, 18, 18, 18, 18, 0, 0, 0, 3, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 3, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 0, 0, 0, 0, 18, 18, 15, 15, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 15, 92, 92, 92, 0, 92, 92, 0, 0, 0, 0, 0, 92, - 92, 92, 92, 15, 15, 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 0, 0, 0, 0, 92, 92, 92, 0, 0, 0, 0, 92, 18, 18, 18, - 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 18, 18, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 18, - 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 92, 92, 0, 0, 0, 0, 18, 18, 18, 18, 18, 3, 3, 3, - 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, - 3, 3, 3, 3, 3, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 18, 18, 18, 18, 18, 18, - 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 15, + 195, 195, 195, 195, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, + 15, 0, 0, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, + 0, 0, 0, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 3, 18, 18, 18, 18, 18, + 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 14, 18, 18, 18, 18, 18, 18, + 18, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 0, 0, + 0, 0, 18, 18, 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 18, 18, 18, 18, 18, 18, + 0, 0, 0, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 3, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 18, 18, 15, 15, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 15, 92, 92, 92, 0, 92, 92, + 0, 0, 0, 0, 0, 92, 92, 92, 92, 15, 15, 15, 15, 0, 15, 15, 15, 0, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 92, 92, 92, 0, 0, 0, + 0, 92, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 18, 18, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 0, 0, 0, 0, 18, 18, 18, + 18, 18, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 18, 18, + 18, 18, 18, 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, + 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 0, 0, 0, - 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, + 102, 102, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 0, 124, 92, 124, 15, 15, 15, 15, 15, 15, 15, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 124, 92, 124, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 3, 3, 3, + 3, 3, 3, 3, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, + 92, 124, 124, 92, 92, 3, 3, 17, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 92, 92, 92, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 3, 3, 3, 3, 3, 3, 3, 0, 0, - 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 92, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, 124, 124, 92, - 92, 3, 3, 17, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 92, 92, 92, 92, 92, 124, 92, 92, 92, 92, 92, 92, 92, 92, 0, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 92, 92, 92, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, 92, - 92, 124, 92, 92, 92, 92, 92, 92, 92, 92, 0, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, + 15, 92, 3, 3, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, 15, 15, 15, 15, 3, 3, + 3, 3, 3, 92, 92, 92, 3, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 15, 3, + 15, 3, 3, 3, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 3, 3, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 124, 124, + 92, 124, 92, 92, 3, 3, 3, 3, 3, 3, 92, 0, 15, 15, 15, 15, 15, 15, 15, + 0, 15, 0, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 3, 0, + 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 92, 92, 124, 124, 0, 15, + 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 124, 124, 124, 0, 0, 124, + 124, 0, 0, 124, 124, 124, 0, 0, 15, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, + 0, 0, 15, 15, 15, 15, 15, 124, 124, 0, 0, 92, 92, 92, 92, 92, 92, 92, + 0, 0, 0, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, 92, + 92, 92, 124, 92, 15, 15, 15, 15, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 0, 3, 0, 3, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 124, + 92, 124, 124, 124, 124, 92, 92, 124, 92, 92, 15, 15, 3, 15, 0, 0, 0, + 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, + 92, 92, 92, 92, 0, 0, 124, 124, 124, 124, 92, 92, 124, 92, 92, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 15, + 15, 15, 15, 92, 92, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, + 124, 124, 92, 124, 92, 92, 3, 3, 3, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 92, + 124, 124, 92, 92, 92, 92, 92, 92, 124, 92, 0, 0, 0, 0, 0, 0, 0, 0, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 124, 124, 15, 15, 15, 15, 3, 3, 3, 3, 3, 92, 92, - 92, 3, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 15, 3, 15, 3, 3, 3, 0, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 124, 124, 124, 92, 92, 92, 124, 124, 92, 124, 92, 92, 3, - 3, 3, 3, 3, 3, 92, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 0, 15, 15, - 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 3, 0, 0, 0, 0, 0, 0, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 124, 124, - 92, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 0, 0, 0, 0, 0, 0, 92, 92, 124, 124, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 92, 124, 124, 124, 124, 0, 0, 124, 124, 0, 0, 124, - 124, 124, 0, 0, 15, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 15, 15, 15, - 15, 15, 124, 124, 0, 0, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 92, 92, - 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, - 124, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, 92, 92, 92, 124, 92, - 15, 15, 15, 15, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 3, - 0, 3, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 124, 92, 124, 124, 124, - 124, 92, 92, 124, 92, 92, 15, 15, 3, 15, 0, 0, 0, 0, 0, 0, 0, 0, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, - 0, 0, 124, 124, 124, 124, 92, 92, 124, 92, 92, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 15, 15, 15, 15, 92, - 92, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, 92, 124, - 92, 92, 3, 3, 3, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 92, 124, 124, 92, 92, - 92, 92, 92, 92, 124, 92, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 92, 92, 92, 124, - 124, 92, 92, 92, 92, 124, 92, 92, 92, 92, 92, 0, 0, 0, 0, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 18, 18, 3, 3, 3, 14, 10, 10, 10, 10, 10, 10, 10, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 0, 0, 92, 92, 92, 124, 124, 92, 92, 92, 92, 124, 92, 92, 92, 92, 92, + 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 3, 3, 3, 14, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 15, 92, 92, 92, 92, 92, 92, 124, 124, 92, 92, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 92, 92, 92, 92, 92, 92, 124, 15, 92, 92, 92, 92, 3, + 3, 3, 3, 3, 3, 3, 3, 92, 0, 0, 0, 0, 0, 0, 0, 0, 15, 92, 92, 92, 92, + 92, 92, 124, 124, 92, 92, 92, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, + 15, 15, 15, 15, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 124, 92, 92, 3, 3, 3, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 124, 92, 92, 92, 92, 92, 92, 92, 0, 124, - 124, 124, 124, 92, 92, 124, 92, 15, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 18, 18, 18, 18, + 15, 15, 15, 15, 15, 15, 15, 124, 92, 92, 92, 92, 92, 92, 92, 0, 92, + 92, 92, 92, 92, 92, 124, 92, 15, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 0, 124, 92, 92, 92, 92, 92, 92, 92, 124, 92, 92, 124, 92, 92, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 92, 92, 92, 92, 92, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, - 92, 92, 92, 92, 3, 3, 3, 3, 3, 14, 14, 14, 14, 91, 91, 91, 91, 3, 14, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 18, - 18, 18, 18, 18, 18, 18, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, + 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 124, 124, 124, 124, 124, 124, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 92, 92, 92, 92, 92, 92, 0, 0, 0, 92, 0, 92, 92, 0, 92, + 92, 92, 92, 92, 92, 92, 15, 92, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 0, 3, 3, 3, 3, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 0, 0, 92, 92, 92, 92, 92, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 92, 92, 92, 92, 92, 92, 3, 3, 3, 3, 3, 14, 14, 14, 14, 91, 91, + 91, 91, 3, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 0, 18, 18, 18, 18, 18, 18, 18, 0, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, + 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, + 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, - 14, 92, 92, 3, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, - 14, 14, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 124, 124, 92, - 92, 92, 14, 14, 14, 124, 124, 124, 124, 124, 124, 17, 17, 17, 17, 17, - 17, 17, 17, 92, 92, 92, 92, 92, 92, 92, 92, 14, 14, 92, 92, 92, 92, - 92, 92, 92, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 92, - 92, 92, 92, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 92, 92, - 92, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 107, 107, 107, 107, 107, + 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, + 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 14, 92, 92, 3, 17, + 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 0, 0, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 124, 124, 92, 92, 92, 14, 14, 14, + 124, 124, 124, 124, 124, 124, 17, 17, 17, 17, 17, 17, 17, 17, 92, 92, + 92, 92, 92, 92, 92, 92, 14, 14, 92, 92, 92, 92, 92, 92, 92, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 92, 92, 92, 92, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 92, 92, 92, 14, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, + 21, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 0, 107, 107, 0, 0, 107, + 0, 0, 107, 107, 0, 0, 107, 107, 107, 107, 0, 107, 107, 107, 107, 107, + 107, 107, 107, 21, 21, 21, 21, 0, 21, 0, 21, 21, 21, 21, 21, 21, 21, + 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 107, 107, 0, 107, 107, 107, 107, 0, 0, 107, 107, 107, 107, + 107, 107, 107, 107, 0, 107, 107, 107, 107, 107, 107, 107, 0, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 107, 107, 0, 107, 107, 107, 107, 0, 107, + 107, 107, 107, 107, 0, 107, 0, 0, 0, 107, 107, 107, 107, 107, 107, + 107, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, - 21, 21, 21, 21, 21, 21, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, + 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 0, - 107, 107, 0, 0, 107, 0, 0, 107, 107, 0, 0, 107, 107, 107, 107, 0, 107, - 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 0, 21, 0, 21, 21, - 21, 21, 21, 21, 21, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 107, 107, 0, 107, 107, 107, 107, 0, 0, - 107, 107, 107, 107, 107, 107, 107, 107, 0, 107, 107, 107, 107, 107, - 107, 107, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 0, 107, 107, - 107, 107, 0, 107, 107, 107, 107, 107, 0, 107, 0, 0, 0, 107, 107, 107, - 107, 107, 107, 107, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, + 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 0, 0, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, + 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 0, 0, 107, + 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, @@ -1419,89 +1445,81 @@ static const unsigned char groupMap[] = { 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 7, - 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 7, 21, 21, 21, 21, 21, - 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 21, 0, 0, 9, 9, 9, 9, 9, 9, + 21, 21, 21, 21, 21, 21, 107, 21, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 92, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 14, 14, 14, 14, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 14, 14, 14, 14, 14, 14, 14, - 14, 92, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 92, - 14, 14, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 92, 92, 92, 92, 92, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, - 92, 92, 92, 92, 92, 92, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 0, 0, 92, 92, 92, 92, 92, 92, 92, 0, 92, - 92, 0, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 0, 0, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 92, 92, 14, 14, 14, 14, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 14, 14, 14, 14, 14, 14, 14, 14, 92, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 92, 14, 14, 3, + 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, + 92, 92, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, + 92, 92, 92, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 0, 0, 92, 92, 92, 92, 92, 92, 92, 0, 92, 92, 0, 92, + 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 15, 15, 15, 15, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 196, 196, + 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, - 196, 196, 196, 196, 196, 196, 196, 197, 197, 197, 197, 197, 197, 197, + 196, 196, 196, 196, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 92, - 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 0, 0, 0, 0, 3, 3, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 0, 15, 15, 0, 15, 0, 0, 15, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 15, 15, 15, 15, 0, 15, 0, 15, 0, 0, 0, 0, 0, 0, 15, - 0, 0, 0, 0, 15, 0, 15, 0, 15, 0, 15, 15, 15, 0, 15, 15, 0, 15, 0, 0, - 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 15, 0, 15, 0, 0, 15, 15, 15, - 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 0, 15, 15, 15, - 15, 0, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, - 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, - 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 92, 92, 92, 92, 92, + 92, 92, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 3, + 3, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, + 15, 0, 15, 0, 0, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 15, 0, 15, 0, 15, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 15, + 0, 15, 0, 15, 0, 15, 15, 15, 0, 15, 15, 0, 15, 0, 0, 15, 0, 15, 0, + 15, 0, 15, 0, 15, 0, 15, 15, 0, 15, 0, 0, 15, 15, 15, 15, 0, 15, 15, + 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 0, 15, 15, 15, 15, 0, 15, 0, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, + 15, 0, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, - 0, 0, 0, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 11, 11, 11, 11, 11, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, + 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 14, + 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, - 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 0, - 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 11, 11, 11, 11, 11, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, - 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, - 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, + 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, + 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, + 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0 #endif /* TCL_UTF_MAX > 3 */ }; -- cgit v0.12 From cf0cf6ad90055ae80f8ed7ec6b87d145d31cfcff Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 23 May 2017 16:00:29 +0000 Subject: [19a8c9399d] Plug mem leak in TIP 459 machinery. --- generic/tclPkg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 9ad3cb7..3b0554a 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -224,6 +224,7 @@ static void PkgFilesCleanupProc(ClientData clientData, entry = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&pkgFiles->table); + ckfree(pkgFiles); return; } -- cgit v0.12 From 5badb6535fd037244cae95a25e9790c7dae3c7c8 Mon Sep 17 00:00:00 2001 From: griffin Date: Sat, 27 May 2017 22:17:21 +0000 Subject: Implement proposed 0d decimal radix prefix to compliment 0x,0b,0o. --- doc/GetInt.3 | 7 +++++-- doc/expr.n | 2 +- generic/tclStrToD.c | 16 +++++++++++++++- tests/cmdIL.test | 4 ++-- tests/util.test | 18 ++++++++++++++++++ 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/doc/GetInt.3 b/doc/GetInt.3 index 5a3304a..8d7a4d0 100644 --- a/doc/GetInt.3 +++ b/doc/GetInt.3 @@ -56,6 +56,9 @@ followed by white space. If the first two characters of \fIsrc\fR after the optional white space and sign are .QW \fB0x\fR then \fIsrc\fR is expected to be in hexadecimal form; otherwise, +if the first such characters are +.QW \fB0d\fR +then \fIsrc\fR is expected to be in decimal form; otherwise, if the first such characters are .QW \fB0o\fR then \fIsrc\fR is expected to be in octal form; otherwise, @@ -65,8 +68,8 @@ then \fIsrc\fR is expected to be in binary form; otherwise, if the first such character is .QW \fB0\fR then \fIsrc\fR -is expected to be in octal form; otherwise, \fIsrc\fR is -expected to be in decimal form. +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 diff --git a/doc/expr.n b/doc/expr.n index cbb2395..3cd6d16 100644 --- a/doc/expr.n +++ b/doc/expr.n @@ -46,7 +46,7 @@ value is the form produced by the \fB%g\fR format specifier of Tcl's An expression consists of a combination of operands, operators, parentheses and commas, possibly with whitespace between any of these elements, which is ignored. -An integer operand may be specified in decimal, binary +An integer operand may be specified in decimal (the optional first two characters are \fB0d\fR), binary (the first two characters are \fB0b\fR), octal (the first two characters are \fB0o\fR), or hexadecimal (the first two characters are \fB0x\fR) form. For diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index c7fdc5a..cbdc3a0 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -482,7 +482,7 @@ TclParseNumber( { enum State { INITIAL, SIGNUM, ZERO, ZERO_X, - ZERO_O, ZERO_B, BINARY, + ZERO_O, ZERO_B, ZERO_D, BINARY, HEXADECIMAL, OCTAL, BAD_OCTAL, DECIMAL, LEADING_RADIX_POINT, FRACTION, EXPONENT_START, EXPONENT_SIGNUM, EXPONENT, @@ -664,6 +664,10 @@ TclParseNumber( state = ZERO_O; break; } + if (c == 'd' || c == 'D') { + state = ZERO_D; + break; + } #ifdef TCL_NO_DEPRECATED goto decimal; #endif @@ -880,6 +884,16 @@ TclParseNumber( state = BINARY; break; + case ZERO_D: + if (c == '0') { + numTrailZeros++; + } else if ( ! isdigit(UCHAR(c))) { + goto endgame; + } + state = DECIMAL; + flags |= TCL_PARSE_INTEGER_ONLY; + /* FALLTHROUGH */ + case DECIMAL: /* * Scanned an optional + or - followed by a string of decimal diff --git a/tests/cmdIL.test b/tests/cmdIL.test index 23a5f96..70ac6bb 100644 --- a/tests/cmdIL.test +++ b/tests/cmdIL.test @@ -219,8 +219,8 @@ test cmdIL-3.10 {SortCompare procedure, -integer option} -body { lsort -integer {3 q} } -returnCodes error -result {expected integer but got "q"} test cmdIL-3.11 {SortCompare procedure, -integer option} { - lsort -integer {35 21 0x20 30 0o23 100 8} -} {8 0o23 21 30 0x20 35 100} + lsort -integer {35 21 0x20 0d30 0o23 100 8} +} {8 0o23 21 0d30 0x20 35 100} test cmdIL-3.12 {SortCompare procedure, -real option} -body { lsort -real {6...4 3} } -returnCodes error -result {expected floating-point number but got "6...4"} diff --git a/tests/util.test b/tests/util.test index 22d120b..35fc642 100644 --- a/tests/util.test +++ b/tests/util.test @@ -553,6 +553,12 @@ test util-9.0.6 {TclGetIntForIndex} { test util-9.0.7 {TclGetIntForIndex} { string index abcd { 01 } } b +test util-9.0.8 {TclGetIntForIndex} { + string index abcd { 0d0 } +} a +test util-9.0.9 {TclGetIntForIndex} { + string index abcd { -0d0 } +} a test util-9.1.0 {TclGetIntForIndex} { string index abcd 3 } d @@ -565,6 +571,12 @@ test util-9.1.2 {TclGetIntForIndex} { test util-9.1.3 {TclGetIntForIndex} { string index abcdefghijk { 0xa } } k +test util-9.1.4 {TclGetIntForIndex} { + string index abcdefghijk 0d10 +} k +test util-9.1.5 {TclGetIntForIndex} { + string index abcdefghijk { 0d10 } +} k test util-9.2.0 {TclGetIntForIndex} { string index abcd end } d @@ -672,12 +684,18 @@ test util-9.30 {TclGetIntForIndex} -body { test util-9.31 {TclGetIntForIndex} -body { string index a 0x } -returnCodes error -match glob -result * +test util-9.31.1 {TclGetIntForIndex} -body { + string index a 0d +} -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.33.1 {TclGetIntForIndex} -body { + string index a 0d100000000000+0 +} -returnCodes error -match glob -result * test util-9.34 {TclGetIntForIndex} -body { string index a 1.0 } -returnCodes error -match glob -result * -- cgit v0.12 From 919fc5759927c4b114ccc7771b7bcf6193fb5b42 Mon Sep 17 00:00:00 2001 From: griffin Date: Sun, 28 May 2017 16:06:29 +0000 Subject: 0d in LinkVar --- generic/tclLink.c | 4 ++-- tests/link.test | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/generic/tclLink.c b/generic/tclLink.c index a39dfcd..7366acc 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -692,7 +692,7 @@ SetInvalidRealFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr) { /* * This function checks for integer representations, which are valid * when linking with C variables, but which are invalid in other - * contexts in Tcl. Handled are "+", "-", "", "0x", "0b" and "0o" + * contexts in Tcl. Handled are "+", "-", "", "0x", "0b", "0d" and "0o" * (upperand lowercase). See bug [39f6304c2e]. */ int @@ -701,7 +701,7 @@ GetInvalidIntFromObj(Tcl_Obj *objPtr, int *intPtr) const char *str = TclGetString(objPtr); if ((objPtr->length == 0) || - ((objPtr->length == 2) && (str[0] == '0') && strchr("xXbBoO", str[1]))) { + ((objPtr->length == 2) && (str[0] == '0') && strchr("xXbBoOdD", str[1]))) { *intPtr = 0; return TCL_OK; } else if ((objPtr->length == 1) && strchr("+-", str[0])) { diff --git a/tests/link.test b/tests/link.test index 6bff356..a12759d 100644 --- a/tests/link.test +++ b/tests/link.test @@ -173,6 +173,27 @@ test link-2.9 {writing C variables from Tcl} -constraints {testlink} -setup { set uwide 0 concat [testlink get] | $int $real $bool $string $wide $char $uchar $short $ushort $uint $long $ulong $float $uwide } -result {0 5000.0 0 0 0 0 0 0 0 0 0 0 -60.0 0 | 0 5000e 0 0 0 0 0 0 0 0 0 0 -60.00e+ 0} +test link-2.10 {writing C variables from Tcl} -constraints {testlink} -setup { + testlink delete +} -body { + testlink set 43 1.21 4 - 56785678 64 250 30000 60000 0xbaadbeef 12321 32123 3.25 1231231234 + testlink create 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + set int "0x" + set real "0b" + set bool 0 + set string "0" + set wide "0D" + set char "0X" + set uchar "0B" + set short "0D" + set ushort "0x" + set uint "0b" + set long "0d" + set ulong "0X" + set float "0B" + set uwide "0D" + concat [testlink get] | $int $real $bool $string $wide $char $uchar $short $ushort $uint $long $ulong $float $uwide +} -result {0 0.0 0 0 0 0 0 0 0 0 0 0 0.0 0 | 0x 0b 0 0 0D 0X 0B 0D 0x 0b 0d 0X 0B 0D} test link-3.1 {read-only variables} -constraints {testlink} -setup { testlink delete -- cgit v0.12 From e5726b43396ad7e3356c453ed8ae75c7349e6707 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 29 May 2017 13:10:30 +0000 Subject: Tcl_UtfToUniChar() -> TclUtfToUniChar() in various places: No change in functionality, just faster if ASCII only strings are involved. --- generic/tclBinary.c | 6 ++--- generic/tclCmdIL.c | 4 +-- generic/tclCompExpr.c | 4 +-- generic/tclEncoding.c | 4 +-- generic/tclLoad.c | 2 +- generic/tclParse.c | 4 +-- generic/tclScan.c | 66 +++++++++++++++++++++++++------------------------- generic/tclStringObj.c | 26 ++++++++++---------- win/tclWinPipe.c | 2 +- 9 files changed, 59 insertions(+), 59 deletions(-) diff --git a/generic/tclBinary.c b/generic/tclBinary.c index 2a4fd84..d0d9d5e 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -462,7 +462,7 @@ SetByteArrayFromAny( byteArrayPtr = ckalloc(BYTEARRAY_SIZE(length)); for (dst = byteArrayPtr->bytes; src < srcEnd; ) { - src += Tcl_UtfToUniChar(src, &ch); + src += TclUtfToUniChar(src, &ch); *dst++ = UCHAR(ch); } @@ -1213,7 +1213,7 @@ BinaryFormatCmd( Tcl_UniChar ch; char buf[TCL_UTF_MAX + 1]; - Tcl_UtfToUniChar(errorString, &ch); + TclUtfToUniChar(errorString, &ch); buf[Tcl_UniCharToUtf(ch, buf)] = '\0'; Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad field specifier \"%s\"", buf)); @@ -1583,7 +1583,7 @@ BinaryScanCmd( Tcl_UniChar ch; char buf[TCL_UTF_MAX + 1]; - Tcl_UtfToUniChar(errorString, &ch); + TclUtfToUniChar(errorString, &ch); buf[Tcl_UniCharToUtf(ch, buf)] = '\0'; Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad field specifier \"%s\"", buf)); diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 9fbb0ad..bcf4434 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -4415,8 +4415,8 @@ DictionaryCompare( */ if ((*left != '\0') && (*right != '\0')) { - left += Tcl_UtfToUniChar(left, &uniLeft); - right += Tcl_UtfToUniChar(right, &uniRight); + left += TclUtfToUniChar(left, &uniLeft); + right += TclUtfToUniChar(right, &uniRight); /* * Convert both chars to lower for the comparison, because diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 4390282..59eecf9 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -2064,13 +2064,13 @@ ParseLexeme( if (!TclIsBareword(*start) || *start == '_') { if (Tcl_UtfCharComplete(start, numBytes)) { - scanned = Tcl_UtfToUniChar(start, &ch); + scanned = TclUtfToUniChar(start, &ch); } else { char utfBytes[TCL_UTF_MAX]; memcpy(utfBytes, start, (size_t) numBytes); utfBytes[numBytes] = '\0'; - scanned = Tcl_UtfToUniChar(utfBytes, &ch); + scanned = TclUtfToUniChar(utfBytes, &ch); } *lexemePtr = INVALID; Tcl_DecrRefCount(literal); diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 6820faa..b4acb5f 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2344,7 +2344,7 @@ UtfToUtfProc( src += 2; } else if (!Tcl_UtfCharComplete(src, srcEnd - src)) { /* - * Always check before using Tcl_UtfToUniChar. Not doing can so + * Always check before using TclUtfToUniChar. Not doing can so * cause it run beyond the endof the buffer! If we happen such an * incomplete char its byts are made to represent themselves. */ @@ -2353,7 +2353,7 @@ UtfToUtfProc( src += 1; dst += Tcl_UniCharToUtf(ch, dst); } else { - src += Tcl_UtfToUniChar(src, &ch); + src += TclUtfToUniChar(src, &ch); dst += Tcl_UniCharToUtf(ch, dst); } } diff --git a/generic/tclLoad.c b/generic/tclLoad.c index 7c70e03..942e6b4 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -336,7 +336,7 @@ Tcl_LoadObjCmd( } #endif /* __CYGWIN__ */ for (p = pkgGuess; *p != 0; p += offset) { - offset = Tcl_UtfToUniChar(p, &ch); + offset = TclUtfToUniChar(p, &ch); if ((ch > 0x100) || !(isalpha(UCHAR(ch)) /* INTL: ISO only */ || (UCHAR(ch) == '_'))) { diff --git a/generic/tclParse.c b/generic/tclParse.c index ce87fb0..3ecf4a5 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -975,13 +975,13 @@ TclParseBackslash( */ if (Tcl_UtfCharComplete(p, numBytes - 1)) { - count = Tcl_UtfToUniChar(p, &unichar) + 1; /* +1 for '\' */ + count = TclUtfToUniChar(p, &unichar) + 1; /* +1 for '\' */ } else { char utfBytes[TCL_UTF_MAX]; memcpy(utfBytes, p, (size_t) (numBytes - 1)); utfBytes[numBytes - 1] = '\0'; - count = Tcl_UtfToUniChar(utfBytes, &unichar) + 1; + count = TclUtfToUniChar(utfBytes, &unichar) + 1; } result = unichar; break; diff --git a/generic/tclScan.c b/generic/tclScan.c index 3edb8be..17069eb 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -78,11 +78,11 @@ BuildCharSet( memset(cset, 0, sizeof(CharSet)); - offset = Tcl_UtfToUniChar(format, &ch); + offset = TclUtfToUniChar(format, &ch); if (ch == '^') { cset->exclude = 1; format += offset; - offset = Tcl_UtfToUniChar(format, &ch); + offset = TclUtfToUniChar(format, &ch); } end = format + offset; @@ -91,14 +91,14 @@ BuildCharSet( */ if (ch == ']') { - end += Tcl_UtfToUniChar(end, &ch); + end += TclUtfToUniChar(end, &ch); } nranges = 0; while (ch != ']') { if (ch == '-') { nranges++; } - end += Tcl_UtfToUniChar(end, &ch); + end += TclUtfToUniChar(end, &ch); } cset->chars = ckalloc(sizeof(Tcl_UniChar) * (end - format - 1)); @@ -113,11 +113,11 @@ BuildCharSet( */ cset->nchars = cset->nranges = 0; - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); start = ch; if (ch == ']' || ch == '-') { cset->chars[cset->nchars++] = ch; - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); } while (ch != ']') { if (*format == '-') { @@ -138,7 +138,7 @@ BuildCharSet( cset->chars[cset->nchars++] = start; cset->chars[cset->nchars++] = ch; } else { - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); /* * Check to see if the range is in reverse order. @@ -156,7 +156,7 @@ BuildCharSet( } else { cset->chars[cset->nchars++] = ch; } - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); } return format; } @@ -279,20 +279,20 @@ ValidateFormat( xpgSize = objIndex = gotXpg = gotSequential = 0; while (*format != '\0') { - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); flags = 0; if (ch != '%') { continue; } - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); if (ch == '%') { continue; } if (ch == '*') { flags |= SCAN_SUPPRESS; - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); goto xpgCheckDone; } @@ -308,7 +308,7 @@ ValidateFormat( goto notXpg; } format = end+1; - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); gotXpg = 1; if (gotSequential) { goto mixedXPG; @@ -347,7 +347,7 @@ ValidateFormat( if ((ch < 0x80) && isdigit(UCHAR(ch))) { /* INTL: "C" locale. */ value = strtoul(format-1, (char **) &format, 10); /* INTL: "C" locale. */ flags |= SCAN_WIDTH; - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); } /* @@ -359,13 +359,13 @@ ValidateFormat( if (*format == 'l') { flags |= SCAN_BIG; format += 1; - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); break; } case 'L': flags |= SCAN_LONGER; case 'h': - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); } if (!(flags & SCAN_SUPPRESS) && numVars && (objIndex >= numVars)) { @@ -434,24 +434,24 @@ ValidateFormat( if (*format == '\0') { goto badSet; } - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); if (ch == '^') { if (*format == '\0') { goto badSet; } - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); } if (ch == ']') { if (*format == '\0') { goto badSet; } - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); } while (ch != ']') { if (*format == '\0') { goto badSet; } - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); } break; badSet: @@ -630,7 +630,7 @@ Tcl_ScanObjCmd( nconversions = 0; while (*format != '\0') { int parseFlag = TCL_PARSE_NO_WHITESPACE; - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); flags = 0; @@ -639,13 +639,13 @@ Tcl_ScanObjCmd( */ if (Tcl_UniCharIsSpace(ch)) { - offset = Tcl_UtfToUniChar(string, &sch); + offset = TclUtfToUniChar(string, &sch); while (Tcl_UniCharIsSpace(sch)) { if (*string == '\0') { goto done; } string += offset; - offset = Tcl_UtfToUniChar(string, &sch); + offset = TclUtfToUniChar(string, &sch); } continue; } @@ -656,14 +656,14 @@ Tcl_ScanObjCmd( underflow = 1; goto done; } - string += Tcl_UtfToUniChar(string, &sch); + string += TclUtfToUniChar(string, &sch); if (ch != sch) { goto done; } continue; } - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); if (ch == '%') { goto literal; } @@ -675,13 +675,13 @@ Tcl_ScanObjCmd( if (ch == '*') { flags |= SCAN_SUPPRESS; - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); } else if ((ch < 0x80) && isdigit(UCHAR(ch))) { /* INTL: "C" locale. */ char *formatEnd; value = strtoul(format-1, &formatEnd, 10);/* INTL: "C" locale. */ if (*formatEnd == '$') { format = formatEnd+1; - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); objIndex = (int) value - 1; } } @@ -692,7 +692,7 @@ Tcl_ScanObjCmd( if ((ch < 0x80) && isdigit(UCHAR(ch))) { /* INTL: "C" locale. */ width = (int) strtoul(format-1, (char **) &format, 10);/* INTL: "C" locale. */ - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); } else { width = 0; } @@ -706,7 +706,7 @@ Tcl_ScanObjCmd( if (*format == 'l') { flags |= SCAN_BIG; format += 1; - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); break; } case 'L': @@ -715,7 +715,7 @@ Tcl_ScanObjCmd( * Fall through so we skip to the next character. */ case 'h': - format += Tcl_UtfToUniChar(format, &ch); + format += TclUtfToUniChar(format, &ch); } /* @@ -799,7 +799,7 @@ Tcl_ScanObjCmd( if (!(flags & SCAN_NOSKIP)) { while (*string != '\0') { - offset = Tcl_UtfToUniChar(string, &sch); + offset = TclUtfToUniChar(string, &sch); if (!Tcl_UniCharIsSpace(sch)) { break; } @@ -826,7 +826,7 @@ Tcl_ScanObjCmd( } end = string; while (*end != '\0') { - offset = Tcl_UtfToUniChar(end, &sch); + offset = TclUtfToUniChar(end, &sch); if (Tcl_UniCharIsSpace(sch)) { break; } @@ -854,7 +854,7 @@ Tcl_ScanObjCmd( format = BuildCharSet(&cset, format); while (*end != '\0') { - offset = Tcl_UtfToUniChar(end, &sch); + offset = TclUtfToUniChar(end, &sch); if (!CharInSet(&cset, (int)sch)) { break; } @@ -885,7 +885,7 @@ Tcl_ScanObjCmd( * Scan a single Unicode character. */ - string += Tcl_UtfToUniChar(string, &sch); + string += TclUtfToUniChar(string, &sch); if (!(flags & SCAN_SUPPRESS)) { objPtr = Tcl_NewIntObj((int)sch); Tcl_IncrRefCount(objPtr); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 4e19750..4a3b6f1 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1710,7 +1710,7 @@ Tcl_AppendFormatToObj( int newXpg, numChars, allocSegment = 0, segmentLimit, segmentNumBytes; Tcl_Obj *segment; Tcl_UniChar ch; - int step = Tcl_UtfToUniChar(format, &ch); + int step = TclUtfToUniChar(format, &ch); format += step; if (ch != '%') { @@ -1734,7 +1734,7 @@ Tcl_AppendFormatToObj( * Step 0. Handle special case of escaped format marker (i.e., %%). */ - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); if (ch == '%') { span = format; numBytes = step; @@ -1754,7 +1754,7 @@ Tcl_AppendFormatToObj( newXpg = 1; objIndex = position - 1; format = end + 1; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } } if (newXpg) { @@ -1805,7 +1805,7 @@ Tcl_AppendFormatToObj( } if (sawFlag) { format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } } while (sawFlag); @@ -1817,7 +1817,7 @@ Tcl_AppendFormatToObj( if (isdigit(UCHAR(ch))) { width = strtoul(format, &end, 10); format = end; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } else if (ch == '*') { if (objIndex >= objc - 1) { msg = badIndex[gotXpg]; @@ -1833,7 +1833,7 @@ Tcl_AppendFormatToObj( } objIndex++; format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } if (width > limit) { msg = overflow; @@ -1849,12 +1849,12 @@ Tcl_AppendFormatToObj( if (ch == '.') { gotPrecision = 1; format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } if (isdigit(UCHAR(ch))) { precision = strtoul(format, &end, 10); format = end; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } else if (ch == '*') { if (objIndex >= objc - 1) { msg = badIndex[gotXpg]; @@ -1875,7 +1875,7 @@ Tcl_AppendFormatToObj( } objIndex++; format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } /* @@ -1885,14 +1885,14 @@ Tcl_AppendFormatToObj( if (ch == 'h') { useShort = 1; format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } else if (ch == 'l') { format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); if (ch == 'l') { useBig = 1; format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); #ifndef TCL_WIDE_INT_IS_LONG } else { useWide = 1; @@ -2767,7 +2767,7 @@ TclStringObjReverse( * It's part of the contract for objPtr->bytes values. * Thus, we can skip calling Tcl_UtfCharComplete() here. */ - int bytesInChar = Tcl_UtfToUniChar(from, &ch); + int bytesInChar = TclUtfToUniChar(from, &ch); ReverseBytes((unsigned char *)to, (unsigned char *)from, bytesInChar); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 5246d53..fe0ed2d 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1482,7 +1482,7 @@ BuildCommandLine( Tcl_UniChar ch; for (start = arg; *start != '\0'; start += count) { - count = Tcl_UtfToUniChar(start, &ch); + count = TclUtfToUniChar(start, &ch); if (Tcl_UniCharIsSpace(ch)) { /* INTL: ISO space. */ quote = 1; break; -- cgit v0.12 From 9220ca224bafcb35a09f48838501d36ab69762e9 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 29 May 2017 19:36:31 +0000 Subject: fixed [a3fb3356b76ec4a853d1b86aadc08675f8bef359]: segfault by sorting of the large lists (firstly mistakenly introduced in [af40c6fb6940bab7]), additionally simplify done-points in Tcl_LsortObjCmd. --- generic/tclCmdIL.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index bcf4434..ba9e1cf 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -3657,7 +3657,7 @@ Tcl_LsortObjCmd( int sortMode = SORTMODE_ASCII; int group, groupSize, groupOffset, idx, allocatedIndexVector = 0; Tcl_Obj *resultPtr, *cmdPtr, **listObjPtrs, *listObj, *indexPtr; - SortElement *elementArray, *elementPtr; + SortElement *elementArray = NULL, *elementPtr; SortInfo sortInfo; /* Information about this sort that needs to * be passed to the comparison function. */ # define NUM_LISTS 30 @@ -3703,7 +3703,7 @@ Tcl_LsortObjCmd( if (Tcl_GetIndexFromObj(interp, objv[i], switches, "option", 0, &index) != TCL_OK) { sortInfo.resultCode = TCL_ERROR; - goto done2; + goto done; } switch ((enum Lsort_Switches) index) { case LSORT_ASCII: @@ -3716,7 +3716,7 @@ Tcl_LsortObjCmd( "by comparison command", -1)); Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL); sortInfo.resultCode = TCL_ERROR; - goto done2; + goto done; } sortInfo.sortMode = SORTMODE_COMMAND; cmdPtr = objv[i+1]; @@ -3741,12 +3741,12 @@ Tcl_LsortObjCmd( -1)); Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL); sortInfo.resultCode = TCL_ERROR; - goto done2; + goto done; } if (TclListObjGetElements(interp, objv[i+1], &indexc, &indexv) != TCL_OK) { sortInfo.resultCode = TCL_ERROR; - goto done2; + goto done; } /* @@ -3763,7 +3763,7 @@ Tcl_LsortObjCmd( Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (-index option item number %d)", j)); sortInfo.resultCode = TCL_ERROR; - goto done2; + goto done; } } indexPtr = objv[i+1]; @@ -3792,11 +3792,11 @@ Tcl_LsortObjCmd( "followed by stride length", -1)); Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL); sortInfo.resultCode = TCL_ERROR; - goto done2; + goto done; } if (Tcl_GetIntFromObj(interp, objv[i+1], &groupSize) != TCL_OK) { sortInfo.resultCode = TCL_ERROR; - goto done2; + goto done; } if (groupSize < 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -3804,7 +3804,7 @@ Tcl_LsortObjCmd( Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT", "BADSTRIDE", NULL); sortInfo.resultCode = TCL_ERROR; - goto done2; + goto done; } group = 1; i++; @@ -3859,7 +3859,7 @@ Tcl_LsortObjCmd( listObj = TclListObjCopy(interp, listObj); if (listObj == NULL) { sortInfo.resultCode = TCL_ERROR; - goto done2; + goto done; } /* @@ -3877,7 +3877,7 @@ Tcl_LsortObjCmd( Tcl_IncrRefCount(newObjPtr); TclDecrRefCount(newObjPtr); sortInfo.resultCode = TCL_ERROR; - goto done2; + goto done; } Tcl_ListObjAppendElement(interp, newCommandPtr, Tcl_NewObj()); sortInfo.compareCmdPtr = newCommandPtr; @@ -3970,7 +3970,7 @@ Tcl_LsortObjCmd( * begins sorting it into the sublists as it appears. */ - elementArray = TclStackAlloc(interp, length * sizeof(SortElement)); + elementArray = ckalloc(length * sizeof(SortElement)); for (i=0; i < length; i++){ idx = groupSize * i + groupOffset; @@ -3980,7 +3980,7 @@ Tcl_LsortObjCmd( */ indexPtr = SelectObjFromSublist(listObjPtrs[idx], &sortInfo); if (sortInfo.resultCode != TCL_OK) { - goto done1; + goto done; } } else { indexPtr = listObjPtrs[idx]; @@ -3997,7 +3997,7 @@ Tcl_LsortObjCmd( if (TclGetWideIntFromObj(sortInfo.interp, indexPtr, &a) != TCL_OK) { sortInfo.resultCode = TCL_ERROR; - goto done1; + goto done; } elementArray[i].collationKey.wideValue = a; } else if (sortMode == SORTMODE_REAL) { @@ -4006,7 +4006,7 @@ Tcl_LsortObjCmd( if (Tcl_GetDoubleFromObj(sortInfo.interp, indexPtr, &a) != TCL_OK) { sortInfo.resultCode = TCL_ERROR; - goto done1; + goto done; } elementArray[i].collationKey.doubleValue = a; } else { @@ -4093,19 +4093,18 @@ Tcl_LsortObjCmd( Tcl_SetObjResult(interp, resultPtr); } - done1: - TclStackFree(interp, elementArray); - done: if (sortMode == SORTMODE_COMMAND) { TclDecrRefCount(sortInfo.compareCmdPtr); TclDecrRefCount(listObj); sortInfo.compareCmdPtr = NULL; } - done2: if (allocatedIndexVector) { TclStackFree(interp, sortInfo.indexv); } + if (elementArray) { + ckfree(elementArray); + } return sortInfo.resultCode; } -- cgit v0.12 From ece8767c5cb0fc27a64b43df3c4558f14d3f5408 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 30 May 2017 08:46:12 +0000 Subject: small code review: resolves several warning on some compilers --- generic/tclClock.c | 6 +++--- generic/tclClockFmt.c | 8 ++++---- generic/tclDate.h | 2 +- generic/tclStrIdxTree.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index c980a27..0895bbb 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -606,7 +606,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) if (opts->localeObj == NULL) { Tcl_SetResult(opts->interp, - "locale not specified and no default locale set", TCL_STATIC); + (char*)"locale not specified and no default locale set", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "badOption", NULL); return NULL; } @@ -3080,7 +3080,7 @@ ClockParseFmtScnArgs( if ((saw & (1 << CLC_ARGS_GMT)) && (saw & (1 << CLC_ARGS_TIMEZONE))) { - Tcl_SetResult(interp, "cannot use -gmt and -timezone in same call", TCL_STATIC); + Tcl_SetResult(interp, (char*)"cannot use -gmt and -timezone in same call", TCL_STATIC); Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); return TCL_ERROR; } @@ -3335,7 +3335,7 @@ ClockScanObjCmd( /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ if (opts.localeObj != NULL) { Tcl_SetResult(interp, - "legacy [clock scan] does not support -locale", TCL_STATIC); + (char*)"legacy [clock scan] does not support -locale", TCL_STATIC); Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index d923ede..0ec8817 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -607,7 +607,7 @@ static void ClockFmtObj_UpdateString(objPtr) Tcl_Obj *objPtr; { - char *name = "UNKNOWN"; + const char *name = "UNKNOWN"; int len; ClockFmtScnStorage *fss = ObjClockFmtScn(objPtr); @@ -1450,7 +1450,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, val = 7; } if (val > 7) { - Tcl_SetResult(opts->interp, "day of week is greater than 7", + Tcl_SetResult(opts->interp, (char*)"day of week is greater than 7", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "badDayOfWeek", NULL); return TCL_ERROR; @@ -2400,14 +2400,14 @@ ClockScan( overflow: - Tcl_SetResult(opts->interp, "requested date too large to represent", + Tcl_SetResult(opts->interp, (char*)"requested date too large to represent", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL); goto done; not_match: - Tcl_SetResult(opts->interp, "input string does not match supplied format", + Tcl_SetResult(opts->interp, (char*)"input string does not match supplied format", TCL_STATIC); Tcl_SetErrorCode(opts->interp, "CLOCK", "badInputString", NULL); diff --git a/generic/tclDate.h b/generic/tclDate.h index e614f9d..abc231b 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -370,7 +370,7 @@ typedef struct ClockScanTokenMap { unsigned short int maxSize; unsigned short int offs; ClockScanTokenProc *parser; - void *data; + const void *data; } ClockScanTokenMap; typedef struct ClockScanToken { diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index 291e481..0045ea5 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -469,7 +469,7 @@ TclStrIdxTreeTestObjCmd( int optionIndex; if (objc < 2) { - Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + Tcl_SetResult(interp, (char*)"wrong # args", TCL_STATIC); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[1], options, @@ -481,7 +481,7 @@ TclStrIdxTreeTestObjCmd( switch (optionIndex) { case O_FINDEQUAL: if (objc < 4) { - Tcl_SetResult(interp, "wrong # args", TCL_STATIC); + Tcl_SetResult(interp, (char*)"wrong # args", TCL_STATIC); return TCL_ERROR; } cs = TclGetString(objv[2]); -- cgit v0.12 From 777941e35bfc3de3b0ec36322ddbd9953169ad2f Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 30 May 2017 16:41:48 +0000 Subject: [msgcat] revert changes of "msgcat" to previous state before clock-speedup, move this functionality to "clock.tcl"; additionally avoids the usage of catch (uses pair "dict exists/dict get" instead of). --- library/clock.tcl | 98 +++++++++++++++++++++++++++++++++--- library/msgcat/msgcat.tcl | 125 ++-------------------------------------------- tests/msgcat.test | 2 +- 3 files changed, 98 insertions(+), 127 deletions(-) diff --git a/library/clock.tcl b/library/clock.tcl index 94d2341..1f3c669 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -506,18 +506,103 @@ proc ::tcl::clock::Initialize {} { variable FormatProc; # Array mapping format group # and locale to the name of a procedure # that renders the given format + + variable mcLocales [dict create]; # Dictionary with loaded locales + variable mcMergedCat [dict create]; # Dictionary with merged locale catalogs } ::tcl::clock::Initialize #---------------------------------------------------------------------- -proc mcget {locale args} { - switch -- $locale system { - set locale [GetSystemLocale] +# mcget -- +# +# Return the merged translation catalog for the ::tcl::clock namespace +# Searching of catalog is similar to "msgcat::mc". +# +# Contrary to "msgcat::mc" may additionally load a package catalog +# on demand. +# +# Arguments: +# loc The locale used for translation. +# +# Results: +# Returns the dictionary object as whole catalog of the package/locale. +# +proc mcget {loc} { + variable mcMergedCat + switch -- $loc system { + set loc [GetSystemLocale] } current { - set locale [mclocale] + set loc [mclocale] + } + if {$loc eq {C}} { + set loclist [msgcat::PackagePreferences ::tcl::clock] + set loc [lindex $loclist 0] + } else { + set loc [string tolower $loc] + } + + # try to retrieve now if already available: + if {[dict exists $mcMergedCat $loc]} { + set mrgcat [dict get $mcMergedCat $loc] + return [dict smartref $mrgcat] + } + + # get locales list for given locale (de_de -> {de_de de {}}) + variable mcLocales + if {[dict exists $mcLocales $loc]} { + set loclist [dict get $mcLocales $loc] + } else { + # save current locale: + set prevloc [mclocale] + # lazy load catalog on demand (set it will load the catalog) + mcpackagelocale set $loc + set loclist [msgcat::GetPreferences $loc] + dict set $mcLocales $loc $loclist + # restore: + if {$prevloc ne $loc} { + mcpackagelocale set $prevloc + } + } + # get whole catalog: + mcMerge $loclist +} + +# mcMerge -- +# +# Merge message catalog dictionaries to one dictionary. +# +# Arguments: +# locales List of locales to merge. +# +# Results: +# Returns the (weak pointer) to merged dictionary of message catalog. +# +proc mcMerge {locales} { + variable mcMergedCat + if {[dict exists $mcMergedCat [set loc [lindex $locales 0]]]} { + set mrgcat [dict get $mcMergedCat $loc] + return [dict smartref $mrgcat] + } + # package msgcat currently does not provide possibility to get whole catalog: + upvar ::msgcat::Msgs Msgs + set ns ::tcl::clock + # Merge sequential locales (in reverse order, e. g. {} -> en -> en_en): + if {[llength $locales] > 1} { + set mrgcat [mcMerge [lrange $locales 1 end]] + if {[dict exists $Msgs $ns $loc]} { + set mrgcat [dict merge $mrgcat [dict get $Msgs $ns $loc]] + } + } else { + if {[dict exists $Msgs $ns $loc]} { + set mrgcat [dict get $Msgs $ns $loc] + } else { + set mrgcat [dict create] + } } - msgcat::mcget ::tcl::clock $locale {*}$args + dict set mcMergedCat $loc $mrgcat + # return smart reference (shared dict as object with exact one ref-counter) + return [dict smartref $mrgcat] } #---------------------------------------------------------------------- @@ -2004,13 +2089,14 @@ proc ::tcl::clock::ClearCaches {} { variable FormatProc variable LocaleFormats variable LocaleNumeralCache + variable mcMergedCat variable TimeZoneBad # tell backend - should invalidate: configure -clear # clear msgcat cache: - msgcat::ClearCaches ::tcl::clock + set mcMergedCat [dict create] foreach p [info procs [namespace current]::scanproc'*] { rename $p {} diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index f9f57db..928474d 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -225,65 +225,6 @@ proc msgcat::mc {src args} { } } -# msgcat::mcget -- -# -# Return the translation for the given string based on the given -# locale setting or the whole dictionary object of the package/locale. -# Searching of catalog is similar to "msgcat::mc". -# -# Contrary to "msgcat::mc" may additionally load a package catalog -# on demand. -# -# Arguments: -# ns The package namespace (as catalog selector). -# loc The locale used for translation. -# {src} The string to translate. -# {args} Args to pass to the format command -# -# Results: -# Returns the translated string. Propagates errors thrown by the -# format command. - -proc msgcat::mcget {ns loc args} { - if {$loc eq {C}} { - set loclist [PackagePreferences $ns] - set loc [lindex $loclist 0] - } else { - set loc [string tolower $loc] - variable PackageConfig - # get locales list for given locale (de_de -> {de_de de {}}) - if {[catch { - set loclist [dict get $PackageConfig locales $ns $loc] - }]} { - # lazy load catalog on demand - mcpackagelocale load $loc $ns - set loclist [dict get $PackageConfig locales $ns $loc] - } - } - if {![llength $args]} { - # get whole catalog: - return [msgcat::Merge $ns $loclist] - } - set src [lindex $args 0] - # search translation for each locale (regarding parent namespaces) - for {set nscur $ns} {$nscur != ""} {set nscur [namespace parent $nscur]} { - foreach loc $loclist { - set msgs [mcget $nscur $loc] - if {![catch { set val [dict get $msgs $src] }]} { - if {[llength $args] == 1} { - return $val - } - return [format $val {*}[lrange $args 1 end]] - } - } - } - # no translation : - if {[llength $args] == 1} { - return $src - } - return [format $src {*}[lrange $args 1 end]] -} - # msgcat::mcexists -- # # Check if a catalog item is set or if mc would invoke mcunknown. @@ -474,10 +415,6 @@ proc msgcat::mcloadedlocales {subcommand} { # items, if the former locale was the default locale. # Returns the normalized set locale. # The default locale is taken, if locale is not given. -# load -# Load a package locale without set it (lazy loading from mcget). -# Returns the normalized set locale. -# The default locale is taken, if locale is not given. # get # Get the locale valid for this package. # isset @@ -505,7 +442,7 @@ proc msgcat::mcloadedlocales {subcommand} { # Results: # Empty string, if not stated differently for the subcommand -proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} { +proc msgcat::mcpackagelocale {subcommand {locale ""}} { # todo: implement using an ensemble variable Loclist variable LoadedLocales @@ -525,9 +462,7 @@ proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} { } set locale [string tolower $locale] } - if {$ns eq ""} { - set ns [uplevel 1 {::namespace current}] - } + set ns [uplevel 1 {::namespace current}] switch -exact -- $subcommand { get { return [lindex [PackagePreferences $ns] 0] } @@ -535,7 +470,7 @@ proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} { loaded { return [PackageLocales $ns] } present { return [expr {$locale in [PackageLocales $ns]} ]} isset { return [dict exists $PackageConfig loclist $ns] } - set - load { # set a package locale or add a package locale + set { # set a package locale or add a package locale # Copy the default locale if no package locale set so far if {![dict exists $PackageConfig loclist $ns]} { @@ -545,21 +480,17 @@ proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} { # Check if changed set loclist [dict get $PackageConfig loclist $ns] - if {[llength [info level 0]] == 2 || $locale eq [lindex $loclist 0] } { + if {! [info exists locale] || $locale eq [lindex $loclist 0] } { return [lindex $loclist 0] } # Change loclist set loclist [GetPreferences $locale] set locale [lindex $loclist 0] - if {$subcommand eq {set}} { - # set loclist - dict set PackageConfig loclist $ns $loclist - } + dict set PackageConfig loclist $ns $loclist # load eventual missing locales set loadedLocales [dict get $PackageConfig loadedlocales $ns] - dict set PackageConfig locales $ns $locale $loclist if {$locale in $loadedLocales} { return $locale } set loadLocales [ListComplement $loadedLocales $loclist] dict set PackageConfig loadedlocales $ns\ @@ -590,7 +521,6 @@ proc msgcat::mcpackagelocale {subcommand {locale ""} {ns ""}} { [dict get $PackageConfig loadedlocales $ns] $LoadedLocales] dict unset PackageConfig loadedlocales $ns dict unset PackageConfig loclist $ns - dict unset PackageConfig locales $ns # unset keys not in global loaded locales if {[dict exists $Msgs $ns]} { @@ -917,47 +847,6 @@ proc msgcat::Load {ns locales {callbackonly 0}} { return $x } -# msgcat::Merge -- -# -# Merge message catalog dictionaries to one dictionary. -# -# Arguments: -# ns Namespace (equal package) to load the message catalog. -# locales List of locales to merge. -# -# Results: -# Returns the merged dictionary of message catalogs. -proc msgcat::Merge {ns locales} { - variable Merged - if {![catch { - set mrgcat [dict get $Merged $ns [set loc [lindex $locales 0]]] - }]} { - return $mrgcat - } - variable Msgs - # Merge sequential locales (in reverse order, e. g. {} -> en -> en_en): - if {[llength $locales] > 1} { - set mrgcat [msgcat::Merge $ns [lrange $locales 1 end]] - catch { - set mrgcat [dict merge $mrgcat [dict get $Msgs $ns $loc]] - } - } else { - if {[catch { - set mrgcat [dict get $Msgs $ns $loc] - }]} { - set mrgcat [dict create] - } - } - dict set Merged $ns $loc $mrgcat - # return smart reference (shared dict as object with exact one ref-counter) - return [dict smartref $mrgcat] -} - -proc msgcat::ClearCaches {ns} { - variable Merged - dict unset Merged $ns -} - # msgcat::Invoke -- # # Invoke a set of registered callbacks. @@ -1030,7 +919,6 @@ proc msgcat::Invoke {index arglist {ns ""} {resultname ""} {failerror 0}} { proc msgcat::mcset {locale src {dest ""}} { variable Msgs - variable Merged if {[llength [info level 0]] == 3} { ;# dest not specified set dest $src } @@ -1040,7 +928,6 @@ proc msgcat::mcset {locale src {dest ""}} { set locale [string tolower $locale] dict set Msgs $ns $locale $src $dest - dict unset Merged $ns return $dest } @@ -1080,7 +967,6 @@ proc msgcat::mcflset {src {dest ""}} { proc msgcat::mcmset {locale pairs} { variable Msgs - variable Merged set length [llength $pairs] if {$length % 2} { @@ -1094,7 +980,6 @@ proc msgcat::mcmset {locale pairs} { foreach {src dest} $pairs { dict set Msgs $ns $locale $src $dest } - dict unset Merged $ns return [expr {$length / 2}] } diff --git a/tests/msgcat.test b/tests/msgcat.test index 584e420..1c3ce58 100644 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -811,7 +811,7 @@ namespace eval ::msgcat::test { test msgcat-12.1 {mcpackagelocale no subcommand} -body { mcpackagelocale } -returnCodes 1\ - -result {wrong # args: should be "mcpackagelocale subcommand ?locale? ?ns?"} + -result {wrong # args: should be "mcpackagelocale subcommand ?locale?"} test msgcat-12.2 {mclpackagelocale wrong subcommand} -body { mcpackagelocale junk -- cgit v0.12 From 73b3bf53adc72f6c32efe40bccb4fbff9d0c4aeb Mon Sep 17 00:00:00 2001 From: stu Date: Wed, 31 May 2017 05:39:57 +0000 Subject: Fully remove SunOS-4* from tcl.m4. --- unix/configure | 7 ------- unix/tcl.m4 | 8 ++------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/unix/configure b/unix/configure index dfeb036..bef7c84 100755 --- a/unix/configure +++ b/unix/configure @@ -9971,13 +9971,6 @@ $as_echo "#define USE_FIONBIO 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: FIONBIO" >&5 $as_echo "FIONBIO" >&6; } ;; - SunOS-4*) - -$as_echo "#define USE_FIONBIO 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: FIONBIO" >&5 -$as_echo "FIONBIO" >&6; } - ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: O_NONBLOCK" >&5 $as_echo "O_NONBLOCK" >&6; } diff --git a/unix/tcl.m4 b/unix/tcl.m4 index e21cc20..2fc82e5 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -971,8 +971,8 @@ AC_DEFUN([SC_CONFIG_SYSTEM], [ # shared libraries. The value of the symbol defaults to # "${LIBS}" if all of the dependent libraries should # be specified when creating a shared library. If -# dependent libraries should not be specified (as on -# SunOS 4.x, where they cause the link to fail, or in +# dependent libraries should not be specified (as on some +# SunOS systems, where they cause the link to fail, or in # general if Tcl and Tk aren't themselves shared # libraries), then this symbol has an empty string # as its value. @@ -2222,10 +2222,6 @@ AC_DEFUN([SC_BLOCKING_STYLE], [ AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?]) AC_MSG_RESULT([FIONBIO]) ;; - SunOS-4*) - AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?]) - AC_MSG_RESULT([FIONBIO]) - ;; *) AC_MSG_RESULT([O_NONBLOCK]) ;; -- cgit v0.12 From c05da96a3570bf04aa35293399fdca615ff2e04e Mon Sep 17 00:00:00 2001 From: stu Date: Wed, 31 May 2017 06:10:46 +0000 Subject: Unbreak on OpenBSD, again. Put back the old SHLIB_VERSION doings. On OpenBSD, Tcl's libs will need the extra version numbers probably forever. There's no point to adding the extra knob. On OpenBSD, the extra version numbers are used for dependency tracking. The extra version numbers must be on linkable libs (code will be linked to them, they have a corresponding .h file). Loadable libs (no code will be linked to them, they don't have a corresponding .h file. Usually a Tcl extension) don't need the burden (OpenBSD has to track the libs' dependencies) of the extra version numbers. Libs that are loadable and linkable are treated as linkable. I hope that clears things up. --- unix/configure | 4 +--- unix/tcl.m4 | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/unix/configure b/unix/configure index bef7c84..a9132b57 100755 --- a/unix/configure +++ b/unix/configure @@ -5085,9 +5085,7 @@ fi PLAT_SRCS="" LDAIX_SRC="" if test "x${SHLIB_VERSION}" = x; then : - SHLIB_VERSION=".1.0" -else - SHLIB_VERSION=".${SHLIB_VERSION}" + SHLIB_VERSION="1.0" fi case $system in AIX-*) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 2fc82e5..45922e0 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1098,7 +1098,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ PLAT_OBJS="" PLAT_SRCS="" LDAIX_SRC="" - AS_IF([test "x${SHLIB_VERSION}" = x],[SHLIB_VERSION=".1.0"],[SHLIB_VERSION=".${SHLIB_VERSION}"]) + AS_IF([test "x${SHLIB_VERSION}" = x], [SHLIB_VERSION="1.0"]) case $system in AIX-*) AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [ -- cgit v0.12 From bbb13bf5770d18267ef18b9fc47a0e198916725d Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 31 May 2017 08:24:42 +0000 Subject: performance of INST_STR_CONCAT1: closes [716b427f76f8f97a8d9a06043903c53bb2b592c2]: minor optimization in simplest cases, fixed performance regression of TclStringCatObjv usage from [fc9ed1e751180816384d569101950c1f8c4582ad], optimizes patterns like "$v[unset v]", "$v[set v {}]" etc. --- generic/tclExecute.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index cfcdd26..2d1c07f 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2685,11 +2685,34 @@ TEBCresume( opnd = TclGetUInt1AtPtr(pc+1); + objv = &OBJ_AT_DEPTH(opnd-1); + /* minor optimization in simplest cases */ + switch (opnd) { + case 1: /* only one object */ + objResultPtr = *objv; + goto endINST_STR_CONCAT1; + case 2: /* two objects - check empty */ + if (objv[0]->bytes == &tclEmptyString) { + objResultPtr = objv[1]; + goto endINST_STR_CONCAT1; + } + else + if (objv[1]->bytes == &tclEmptyString) { + objResultPtr = objv[0]; + goto endINST_STR_CONCAT1; + } + break; + case 0: /* no objects - use new empty */ + TclNewObj(objResultPtr); + goto endINST_STR_CONCAT1; + } + /* do concat */ if (TCL_OK != TclStringCatObjv(interp, /* inPlace */ 1, - opnd, &OBJ_AT_DEPTH(opnd-1), &objResultPtr)) { + opnd, objv, &objResultPtr)) { TRACE_ERROR(interp); goto gotError; } + endINST_STR_CONCAT1: TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr); NEXT_INST_V(2, opnd, 1); -- cgit v0.12 From 60c071ed625b30818a7151b4e77272f8fe55edb3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 31 May 2017 08:31:10 +0000 Subject: Remove "timerate" functionality: this definitely needs a TIP. Also undo changes in library/reg/pkgIndex.tcl, which are unrelated to clock functionality --- generic/tclBasic.c | 1 - generic/tclCmdMZ.c | 348 +---------------------------------------------- generic/tclInt.h | 3 - library/reg/pkgIndex.tcl | 12 +- 4 files changed, 2 insertions(+), 362 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 4d392d0..0486383 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -285,7 +285,6 @@ static const CmdInfo builtInCmds[] = { {"source", Tcl_SourceObjCmd, NULL, TclNRSourceObjCmd, 0}, {"tell", Tcl_TellObjCmd, NULL, NULL, CMD_IS_SAFE}, {"time", Tcl_TimeObjCmd, NULL, NULL, CMD_IS_SAFE}, - {"timerate", Tcl_TimeRateObjCmd, NULL, NULL, CMD_IS_SAFE}, {"unload", Tcl_UnloadObjCmd, NULL, NULL, 0}, {"update", Tcl_UpdateObjCmd, NULL, NULL, CMD_IS_SAFE}, {"vwait", Tcl_VwaitObjCmd, NULL, NULL, CMD_IS_SAFE}, diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 8c2c026..885a0bc 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -17,7 +17,6 @@ */ #include "tclInt.h" -#include "tclCompile.h" #include "tclRegexp.h" #include "tclStringTrim.h" @@ -4147,7 +4146,7 @@ Tcl_TimeObjCmd( start = TclpGetWideClicks(); #endif while (i-- > 0) { - result = TclEvalObjEx(interp, objPtr, 0, NULL, 0); + result = Tcl_EvalObjEx(interp, objPtr, 0); if (result != TCL_OK) { return result; } @@ -4187,351 +4186,6 @@ Tcl_TimeObjCmd( /* *---------------------------------------------------------------------- * - * Tcl_TimeRateObjCmd -- - * - * This object-based procedure is invoked to process the "timerate" Tcl - * command. - * This is similar to command "time", except the execution limited by - * given time (in milliseconds) instead of repetition count. - * - * Example: - * timerate {after 5} 1000 ; # equivalent for `time {after 5} [expr 1000/5]` - * - * Results: - * A standard Tcl object result. - * - * Side effects: - * See the user documentation. - * - *---------------------------------------------------------------------- - */ - -int -Tcl_TimeRateObjCmd( - ClientData dummy, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ -{ - static - double measureOverhead = 0; /* global measure-overhead */ - double overhead = -1; /* given measure-overhead */ - register Tcl_Obj *objPtr; - register int result, i; - Tcl_Obj *calibrate = NULL, *direct = NULL; - Tcl_WideInt count = 0; /* Holds repetition count */ - Tcl_WideInt maxms = -0x7FFFFFFFFFFFFFFFL; - /* Maximal running time (in milliseconds) */ - Tcl_WideInt threshold = 1; /* Current threshold for check time (faster - * repeat count without time check) */ - Tcl_WideInt maxIterTm = 1; /* Max time of some iteration as max threshold - * additionally avoid divide to zero (never < 1) */ - register Tcl_WideInt start, middle, stop; -#ifndef TCL_WIDE_CLICKS - Tcl_Time now; -#endif - - static const char *const options[] = { - "-direct", "-overhead", "-calibrate", "--", NULL - }; - enum options { - TMRT_EV_DIRECT, TMRT_OVERHEAD, TMRT_CALIBRATE, TMRT_LAST - }; - - NRE_callback *rootPtr; - ByteCode *codePtr = NULL; - - for (i = 1; i < objc - 1; i++) { - int index; - if (Tcl_GetIndexFromObj(NULL, objv[i], options, "option", TCL_EXACT, - &index) != TCL_OK) { - break; - } - if (index == TMRT_LAST) { - i++; - break; - } - switch (index) { - case TMRT_EV_DIRECT: - direct = objv[i]; - break; - case TMRT_OVERHEAD: - if (++i >= objc - 1) { - goto usage; - } - if (Tcl_GetDoubleFromObj(interp, objv[i], &overhead) != TCL_OK) { - return TCL_ERROR; - } - break; - case TMRT_CALIBRATE: - calibrate = objv[i]; - break; - } - } - - if (i >= objc || i < objc-2) { -usage: - Tcl_WrongNumArgs(interp, 1, objv, "?-direct? ?-calibrate? ?-overhead double? command ?time?"); - return TCL_ERROR; - } - objPtr = objv[i++]; - if (i < objc) { - result = TclGetWideIntFromObj(interp, objv[i], &maxms); - if (result != TCL_OK) { - return result; - } - } - - /* if calibrate */ - if (calibrate) { - - /* if no time specified for the calibration */ - if (maxms == -0x7FFFFFFFFFFFFFFFL) { - Tcl_Obj *clobjv[6]; - Tcl_WideInt maxCalTime = 5000; - double lastMeasureOverhead = measureOverhead; - - clobjv[0] = objv[0]; - i = 1; - if (direct) { - clobjv[i++] = direct; - } - clobjv[i++] = objPtr; - - /* reset last measurement overhead */ - measureOverhead = (double)0; - - /* self-call with 100 milliseconds to warm-up, - * before entering the calibration cycle */ - TclNewLongObj(clobjv[i], 100); - Tcl_IncrRefCount(clobjv[i]); - result = Tcl_TimeRateObjCmd(dummy, interp, i+1, clobjv); - Tcl_DecrRefCount(clobjv[i]); - if (result != TCL_OK) { - return result; - } - - i--; - clobjv[i++] = calibrate; - clobjv[i++] = objPtr; - - /* set last measurement overhead to max */ - measureOverhead = (double)0x7FFFFFFFFFFFFFFFL; - - /* calibration cycle until it'll be preciser */ - maxms = -1000; - do { - lastMeasureOverhead = measureOverhead; - TclNewLongObj(clobjv[i], (int)maxms); - Tcl_IncrRefCount(clobjv[i]); - result = Tcl_TimeRateObjCmd(dummy, interp, i+1, clobjv); - Tcl_DecrRefCount(clobjv[i]); - if (result != TCL_OK) { - return result; - } - maxCalTime += maxms; - /* increase maxms for preciser calibration */ - maxms -= (-maxms / 4); - /* as long as new value more as 0.05% better */ - } while ( (measureOverhead >= lastMeasureOverhead - || measureOverhead / lastMeasureOverhead <= 0.9995) - && maxCalTime > 0 - ); - - return result; - } - if (maxms == 0) { - /* reset last measurement overhead */ - measureOverhead = 0; - Tcl_SetObjResult(interp, Tcl_NewLongObj(0)); - return TCL_OK; - } - - /* if time is negative - make current overhead more precise */ - if (maxms > 0) { - /* set last measurement overhead to max */ - measureOverhead = (double)0x7FFFFFFFFFFFFFFFL; - } else { - maxms = -maxms; - } - - } - - if (maxms == -0x7FFFFFFFFFFFFFFFL) { - maxms = 1000; - } - if (overhead == -1) { - overhead = measureOverhead; - } - - /* be sure that resetting of result will not smudge the further measurement */ - Tcl_ResetResult(interp); - - /* compile object */ - if (!direct) { - if (TclInterpReady(interp) != TCL_OK) { - return TCL_ERROR; - } - codePtr = TclCompileObj(interp, objPtr, NULL, 0); - TclPreserveByteCode(codePtr); - } - - /* get start and stop time */ -#ifdef TCL_WIDE_CLICKS - start = middle = TclpGetWideClicks(); - /* time to stop execution (in wide clicks) */ - stop = start + (maxms * 1000 / TclpWideClickInMicrosec()); -#else - Tcl_GetTime(&now); - start = now.sec; start *= 1000000; start += now.usec; - middle = start; - /* time to stop execution (in microsecs) */ - stop = start + maxms * 1000; -#endif - - /* start measurement */ - while (1) { - /* eval single iteration */ - count++; - - if (!direct) { - /* precompiled */ - rootPtr = TOP_CB(interp); - result = TclNRExecuteByteCode(interp, codePtr); - result = TclNRRunCallbacks(interp, result, rootPtr); - } else { - /* eval */ - result = TclEvalObjEx(interp, objPtr, 0, NULL, 0); - } - if (result != TCL_OK) { - goto done; - } - - /* don't check time up to threshold */ - if (--threshold > 0) continue; - - /* check stop time reached, estimate new threshold */ - #ifdef TCL_WIDE_CLICKS - middle = TclpGetWideClicks(); - #else - Tcl_GetTime(&now); - middle = now.sec; middle *= 1000000; middle += now.usec; - #endif - if (middle >= stop) { - break; - } - - /* don't calculate threshold by few iterations, because sometimes - * first iteration(s) can be too fast (cached, delayed clean up, etc) */ - if (count < 10) { - threshold = 1; continue; - } - - /* average iteration time in microsecs */ - threshold = (middle - start) / count; - if (threshold > maxIterTm) { - maxIterTm = threshold; - } - /* as relation between remaining time and time since last check */ - threshold = ((stop - middle) / maxIterTm) / 4; - if (threshold > 100000) { /* fix for too large threshold */ - threshold = 100000; - } - } - - { - Tcl_Obj *objarr[8], **objs = objarr; - Tcl_WideInt val; - const char *fmt; - - middle -= start; /* execution time in microsecs */ - - #ifdef TCL_WIDE_CLICKS - /* convert execution time in wide clicks to microsecs */ - middle *= TclpWideClickInMicrosec(); - #endif - - /* if not calibrate */ - if (!calibrate) { - /* minimize influence of measurement overhead */ - if (overhead > 0) { - /* estimate the time of overhead (microsecs) */ - Tcl_WideInt curOverhead = overhead * count; - if (middle > curOverhead) { - middle -= curOverhead; - } else { - middle = 1; - } - } - } else { - /* calibration - obtaining new measurement overhead */ - if (measureOverhead > (double)middle / count) { - measureOverhead = (double)middle / count; - } - objs[0] = Tcl_NewDoubleObj(measureOverhead); - TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#-overhead"); /* mics */ - objs += 2; - } - - val = middle / count; /* microsecs per iteration */ - if (val >= 1000000) { - objs[0] = Tcl_NewWideIntObj(val); - } else { - if (val < 10) { fmt = "%.6f"; } else - if (val < 100) { fmt = "%.4f"; } else - if (val < 1000) { fmt = "%.3f"; } else - if (val < 10000) { fmt = "%.2f"; } else - { fmt = "%.1f"; }; - objs[0] = Tcl_ObjPrintf(fmt, ((double)middle)/count); - } - - objs[2] = Tcl_NewWideIntObj(count); /* iterations */ - - /* calculate speed as rate (count) per sec */ - if (!middle) middle++; /* +1 ms, just to avoid divide by zero */ - if (count < (0x7FFFFFFFFFFFFFFFL / 1000000)) { - val = (count * 1000000) / middle; - if (val < 100000) { - if (val < 100) { fmt = "%.3f"; } else - if (val < 1000) { fmt = "%.2f"; } else - { fmt = "%.1f"; }; - objs[4] = Tcl_ObjPrintf(fmt, ((double)(count * 1000000)) / middle); - } else { - objs[4] = Tcl_NewWideIntObj(val); - } - } else { - objs[4] = Tcl_NewWideIntObj((count / middle) * 1000000); - } - - /* estimated net execution time (in millisecs) */ - if (!calibrate) { - objs[6] = Tcl_ObjPrintf("%.3f", (double)middle / 1000); - TclNewLiteralStringObj(objs[7], "nett-ms"); - } - - /* - * Construct the result as a list because many programs have always parsed - * as such (extracting the first element, typically). - */ - - TclNewLiteralStringObj(objs[1], "\xC2\xB5s/#"); /* mics/# */ - TclNewLiteralStringObj(objs[3], "#"); - TclNewLiteralStringObj(objs[5], "#/sec"); - Tcl_SetObjResult(interp, Tcl_NewListObj(8, objarr)); - } - -done: - - if (codePtr != NULL) { - TclReleaseByteCode(codePtr); - } - - return result; -} - -/* - *---------------------------------------------------------------------- - * * Tcl_TryObjCmd, TclNRTryObjCmd -- * * This procedure is invoked to process the "try" Tcl command. See the diff --git a/generic/tclInt.h b/generic/tclInt.h index 333a665..5bd4324 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3437,9 +3437,6 @@ MODULE_SCOPE int Tcl_ThrowObjCmd(ClientData dummy, Tcl_Interp *interp, MODULE_SCOPE int Tcl_TimeObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -MODULE_SCOPE int Tcl_TimeRateObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); MODULE_SCOPE int Tcl_TraceObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); diff --git a/library/reg/pkgIndex.tcl b/library/reg/pkgIndex.tcl index ab022ab..b1fe234 100755 --- a/library/reg/pkgIndex.tcl +++ b/library/reg/pkgIndex.tcl @@ -1,19 +1,9 @@ if {([info commands ::tcl::pkgconfig] eq "") - || ([info sharedlibextension] ne ".dll")} return + || ([info sharedlibextension] ne ".dll")} return if {[::tcl::pkgconfig get debug]} { - if {[info exists [file join $dir tclreg13g.dll]]} { package ifneeded registry 1.3.2 \ [list load [file join $dir tclreg13g.dll] registry] - } else { - package ifneeded registry 1.3.2 \ - [list load tclreg13g registry] - } } else { - if {[info exists [file join $dir tclreg13.dll]]} { package ifneeded registry 1.3.2 \ [list load [file join $dir tclreg13.dll] registry] - } else { - package ifneeded registry 1.3.2 \ - [list load tclreg13 registry] - } } -- cgit v0.12 From 4a9ae53836f768d0b615e5f98cedfb9dd5fbac7f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 31 May 2017 08:59:28 +0000 Subject: More code review, e.g. use Tcl_SetObjResult in stead of Tcl_SetResult, preventing a (char *) type case. No functional changes. --- generic/tclClock.c | 176 +++++++++++++++++------------------ generic/tclClockFmt.c | 239 ++++++++++++++++++++++++------------------------ generic/tclDate.c | 12 +-- generic/tclDate.h | 10 +- generic/tclEnsemble.c | 4 +- generic/tclEnv.c | 2 +- generic/tclGetDate.y | 2 +- generic/tclInt.h | 2 +- generic/tclStrIdxTree.c | 36 ++++---- generic/tclStrIdxTree.h | 8 +- library/clock.tcl | 16 ++-- library/init.tcl | 6 +- unix/tclUnixTime.c | 2 +- win/tclWinTime.c | 8 +- 14 files changed, 261 insertions(+), 262 deletions(-) diff --git a/generic/tclClock.c b/generic/tclClock.c index 0895bbb..95b3e36 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -96,8 +96,8 @@ static int ClockConvertlocaltoutcObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ClockGetDateFields(ClientData clientData, - Tcl_Interp *interp, TclDateFields *fields, +static int ClockGetDateFields(ClientData clientData, + Tcl_Interp *interp, TclDateFields *fields, Tcl_Obj *timezoneObj, int changeover); static int ClockGetdatefieldsObjCmd( ClientData clientData, Tcl_Interp *interp, @@ -130,7 +130,7 @@ static int ClockScanCommit( ClientData clientData, register DateInfo *info, register ClockFmtScnCmdArgs *opts); static int ClockFreeScan( - register DateInfo *info, + register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); static int ClockCalcRelTime( register DateInfo *info, ClockFmtScnCmdArgs *opts); @@ -267,10 +267,10 @@ TclClockInit( clientData = data; data->refCount++; } - cmdPtr = (Command *)Tcl_CreateObjCommand(interp, cmdName, + cmdPtr = (Command *)Tcl_CreateObjCommand(interp, cmdName, clockCmdPtr->objCmdProc, clientData, clockCmdPtr->clientData ? NULL : ClockDeleteCmdProc); - cmdPtr->compileProc = clockCmdPtr->compileProc ? + cmdPtr->compileProc = clockCmdPtr->compileProc ? clockCmdPtr->compileProc : TclCompileBasicMin0ArgCmd; } } @@ -386,7 +386,7 @@ NormTimezoneObj( { const char *tz; if ( timezoneObj == dataPtr->LastUnnormSetupTimeZone - && dataPtr->LastSetupTimeZone != NULL + && dataPtr->LastSetupTimeZone != NULL ) { return dataPtr->LastSetupTimeZone; } @@ -468,7 +468,7 @@ static inline Tcl_Obj * ClockGetCurrentLocale( ClockClientData *dataPtr, /* Client data containing literal pool */ Tcl_Interp *interp) /* Tcl interpreter */ -{ +{ if (Tcl_EvalObjv(interp, 1, &dataPtr->literals[LIT_GETCURRENTLOCALE], 0) != TCL_OK) { return NULL; } @@ -504,7 +504,7 @@ NormLocaleObj( { const char *loc; if ( localeObj == NULL || localeObj == dataPtr->CurrentLocale - || localeObj == dataPtr->literals[LIT_C] + || localeObj == dataPtr->literals[LIT_C] || localeObj == dataPtr->literals[LIT_CURRENT] ) { if (dataPtr->CurrentLocale == NULL) { @@ -555,8 +555,8 @@ NormLocaleObj( } *mcDictObj = dataPtr->CurrentLocaleDict; localeObj = dataPtr->CurrentLocale; - } - else + } + else if ( (localeObj->length == 6 /* system */ && strncasecmp(loc, Literals[LIT_SYSTEM], localeObj->length) == 0) @@ -565,8 +565,8 @@ NormLocaleObj( localeObj = ClockGetSystemLocale(dataPtr, interp); Tcl_SetObjRef(dataPtr->LastUsedLocale, localeObj); *mcDictObj = NULL; - } - else + } + else { *mcDictObj = NULL; } @@ -578,7 +578,7 @@ NormLocaleObj( * * ClockMCDict -- * - * Retrieves a localized storage dictionary object for the given + * Retrieves a localized storage dictionary object for the given * locale object. * * This corresponds with call `::tcl::clock::mcget locale`. @@ -600,13 +600,13 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) /* if locale was not yet used */ if ( !(opts->flags & CLF_LOCALE_USED) ) { - + opts->localeObj = NormLocaleObj(opts->clientData, opts->interp, opts->localeObj, &opts->mcDictObj); - + if (opts->localeObj == NULL) { - Tcl_SetResult(opts->interp, - (char*)"locale not specified and no default locale set", TCL_STATIC); + Tcl_SetObjResult(opts->interp, + Tcl_NewStringObj("locale not specified and no default locale set", -1)); Tcl_SetErrorCode(opts->interp, "CLOCK", "badOption", NULL); return NULL; } @@ -617,7 +617,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) int i; dataPtr->mcLiterals = ckalloc(MCLIT__END * sizeof(Tcl_Obj*)); for (i = 0; i < MCLIT__END; ++i) { - Tcl_InitObjRef(dataPtr->mcLiterals[i], + Tcl_InitObjRef(dataPtr->mcLiterals[i], Tcl_NewStringObj(MsgCtLiterals[i], -1)); } } @@ -672,7 +672,7 @@ ClockMCDict(ClockFmtScnCmdArgs *opts) MODULE_SCOPE Tcl_Obj * ClockMCGet( - ClockFmtScnCmdArgs *opts, + ClockFmtScnCmdArgs *opts, int mcKey) { ClockClientData *dataPtr = opts->clientData; @@ -685,7 +685,7 @@ ClockMCGet( return NULL; } - Tcl_DictObjGet(opts->interp, opts->mcDictObj, + Tcl_DictObjGet(opts->interp, opts->mcDictObj, dataPtr->mcLiterals[mcKey], &valObj); return valObj; /* or NULL in obscure case if Tcl_DictObjGet failed */ @@ -708,7 +708,7 @@ ClockMCGet( MODULE_SCOPE Tcl_Obj * ClockMCGetIdx( - ClockFmtScnCmdArgs *opts, + ClockFmtScnCmdArgs *opts, int mcKey) { ClockClientData *dataPtr = opts->clientData; @@ -725,8 +725,8 @@ ClockMCGetIdx( if (dataPtr->mcLitIdxs == NULL) { return NULL; } - - if (Tcl_DictObjGet(NULL, opts->mcDictObj, + + if (Tcl_DictObjGet(NULL, opts->mcDictObj, dataPtr->mcLitIdxs[mcKey], &valObj) != TCL_OK ) { return NULL; @@ -752,7 +752,7 @@ ClockMCGetIdx( MODULE_SCOPE int ClockMCSetIdx( - ClockFmtScnCmdArgs *opts, + ClockFmtScnCmdArgs *opts, int mcKey, Tcl_Obj *valObj) { ClockClientData *dataPtr = opts->clientData; @@ -768,12 +768,12 @@ ClockMCSetIdx( int i; dataPtr->mcLitIdxs = ckalloc(MCLIT__END * sizeof(Tcl_Obj*)); for (i = 0; i < MCLIT__END; ++i) { - Tcl_InitObjRef(dataPtr->mcLitIdxs[i], + Tcl_InitObjRef(dataPtr->mcLitIdxs[i], Tcl_NewStringObj(MsgCtLitIdxs[i], -1)); } } - return Tcl_DictObjPut(opts->interp, opts->mcDictObj, + return Tcl_DictObjPut(opts->interp, opts->mcDictObj, dataPtr->mcLitIdxs[mcKey], valObj); } @@ -804,7 +804,7 @@ ClockConfigureObjCmd( Tcl_Obj *const objv[]) /* Parameter vector */ { ClockClientData *dataPtr = clientData; - + static const char *const options[] = { "-system-tz", "-setup-tz", "-default-locale", "-clear", @@ -821,7 +821,7 @@ ClockConfigureObjCmd( int i; for (i = 1; i < objc; i++) { - if (Tcl_GetIndexFromObj(interp, objv[i++], options, + if (Tcl_GetIndexFromObj(interp, objv[i++], options, "option", 0, &optionIndex) != TCL_OK) { Tcl_SetErrorCode(interp, "CLOCK", "badOption", Tcl_GetString(objv[i-1]), NULL); @@ -838,8 +838,8 @@ ClockConfigureObjCmd( Tcl_UnsetObjRef(dataPtr->SystemSetupTZData); } dataPtr->LastTZEpoch = lastTZEpoch; - } - if (i+1 >= objc && dataPtr->SystemTimeZone != NULL + } + if (i+1 >= objc && dataPtr->SystemTimeZone != NULL && dataPtr->LastTZEpoch == lastTZEpoch) { Tcl_SetObjResult(interp, dataPtr->SystemTimeZone); } @@ -874,7 +874,7 @@ ClockConfigureObjCmd( Tcl_SetObjRef(dataPtr->AnySetupTimeZone, timezoneObj); Tcl_UnsetObjRef(dataPtr->AnySetupTZData); } - } + } break; } } @@ -906,7 +906,7 @@ ClockConfigureObjCmd( continue; } if (i+1 >= objc) { - Tcl_SetObjResult(interp, + Tcl_SetObjResult(interp, Tcl_NewIntObj(dataPtr->currentYearCentury)); } break; @@ -921,7 +921,7 @@ ClockConfigureObjCmd( continue; } if (i+1 >= objc) { - Tcl_SetObjResult(interp, + Tcl_SetObjResult(interp, Tcl_NewIntObj(dataPtr->yearOfCenturySwitch)); } break; @@ -978,7 +978,7 @@ ClockGetTZData( } out = &dataPtr->SystemSetupTZData; } - else + else if (timezoneObj == dataPtr->GMTSetupTimeZone) { if (dataPtr->GMTSetupTZData != NULL) { return dataPtr->GMTSetupTZData; @@ -1033,7 +1033,7 @@ ClockGetSystemTimeZone( Tcl_Obj **literals; /* if known (cached and same epoch) - return now */ - if (dataPtr->SystemTimeZone != NULL + if (dataPtr->SystemTimeZone != NULL && dataPtr->LastTZEpoch == TzsetGetEpoch()) { return dataPtr->SystemTimeZone; } @@ -1121,7 +1121,7 @@ ClockSetupTimeZone( *---------------------------------------------------------------------- */ -Tcl_Obj * +Tcl_Obj * ClockFormatNumericTimeZone(int z) { char sign = '+'; int h, m; @@ -1298,7 +1298,7 @@ ClockGetdatefieldsObjCmd( /* Extract fields */ - if (ClockGetDateFields(clientData, interp, &fields, objv[2], + if (ClockGetDateFields(clientData, interp, &fields, objv[2], changeover) != TCL_OK) { return TCL_ERROR; } @@ -1344,8 +1344,8 @@ ClockGetdatefieldsObjCmd( * * ClockGetDateFields -- * - * Converts given UTC time (seconds in a TclDateFields structure) - * to local time and determines the values that clock routines will + * Converts given UTC time (seconds in a TclDateFields structure) + * to local time and determines the values that clock routines will * use in scanning or formatting a date. * * Results: @@ -1704,7 +1704,7 @@ ConvertLocalToUTC( return TCL_ERROR; }; } else { - if (ConvertLocalToUTCUsingTable(interp, fields, rowc, rowv, + if (ConvertLocalToUTCUsingTable(interp, fields, rowc, rowv, dataPtr->Local2UTC.rangesVal) != TCL_OK) { return TCL_ERROR; }; @@ -1806,7 +1806,7 @@ ConvertLocalToUTCUsingTable( Tcl_WideInt backCompVal; /* check DST-hole interval contains UTC time */ TclGetWideIntFromObj(NULL, cellv[0], &backCompVal); - if ( fields->seconds >= backCompVal - fields->tzOffset + if ( fields->seconds >= backCompVal - fields->tzOffset && fields->seconds <= backCompVal + fields->tzOffset ) { row = LookupLastTransition(interp, fields->seconds, rowc, rowv); @@ -1817,7 +1817,7 @@ ConvertLocalToUTCUsingTable( } if (fields->localSeconds != fields->seconds + corrOffset) { Tcl_Panic("wrong local time %ld by LocalToUTC conversion," - " local time seems to be in between DST-hole", + " local time seems to be in between DST-hole", fields->localSeconds); /* correcting offset * / fields->tzOffset -= corrOffset; @@ -1943,8 +1943,8 @@ ConvertUTCToLocal( Tcl_Obj **rowv; /* Pointers to the rows */ /* fast phase-out for shared GMT-object (don't need to convert UTC 2 UTC) */ - if (timezoneObj == dataPtr->GMTSetupTimeZone - && dataPtr->GMTSetupTimeZone != NULL + if (timezoneObj == dataPtr->GMTSetupTimeZone + && dataPtr->GMTSetupTimeZone != NULL && dataPtr->GMTSetupTZData != NULL ) { fields->localSeconds = fields->seconds; @@ -2001,7 +2001,7 @@ ConvertUTCToLocal( return TCL_ERROR; } } else { - if (ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv, + if (ConvertUTCToLocalUsingTable(interp, fields, rowc, rowv, dataPtr->UTC2Local.rangesVal) != TCL_OK) { return TCL_ERROR; } @@ -2993,7 +2993,7 @@ static int ClockParseFmtScnArgs( register ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */ - TclDateFields *date, /* Extracted date-time corresponding base + TclDateFields *date, /* Extracted date-time corresponding base * (by scan or add) resp. clockval (by format) */ int objc, /* Parameter count */ Tcl_Obj *const objv[], /* Parameter vector */ @@ -3034,14 +3034,14 @@ ClockParseFmtScnArgs( } } /* get option */ - if (Tcl_GetIndexFromObj(interp, objv[i], options, + if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, &optionIndex) != TCL_OK) { goto badOption; } /* if already specified */ if (saw & (1 << optionIndex)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad option \"%s\": doubly present", + "bad option \"%s\": doubly present", TclGetString(objv[i])) ); goto badOption; @@ -3080,7 +3080,7 @@ ClockParseFmtScnArgs( if ((saw & (1 << CLC_ARGS_GMT)) && (saw & (1 << CLC_ARGS_TIMEZONE))) { - Tcl_SetResult(interp, (char*)"cannot use -gmt and -timezone in same call", TCL_STATIC); + Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot use -gmt and -timezone in same call", -1)); Tcl_SetErrorCode(interp, "CLOCK", "gmtWithTimezone", NULL); return TCL_ERROR; } @@ -3091,7 +3091,7 @@ ClockParseFmtScnArgs( /* If time zone not specified use system time zone */ if ( opts->timezoneObj == NULL - || TclGetString(opts->timezoneObj) == NULL + || TclGetString(opts->timezoneObj) == NULL || opts->timezoneObj->length == 0 ) { opts->timezoneObj = ClockGetSystemTimeZone(opts->clientData, interp); @@ -3178,7 +3178,7 @@ baseNow: return TCL_OK; -badOptionMsg: +badOptionMsg: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad option \"%s\": unexpected for command \"%s\"", @@ -3189,7 +3189,7 @@ badOption: Tcl_SetErrorCode(interp, "CLOCK", "badOption", i < objc ? Tcl_GetString(objv[i]) : NULL, NULL); - + return TCL_ERROR; } @@ -3201,7 +3201,7 @@ badOption: * * Formats a count of seconds since the Posix Epoch as a time of day. * - * The 'clock format' command formats times of day for output. Refer + * The 'clock format' command formats times of day for output. Refer * to the user documentation to see what it does. * * Results: @@ -3313,7 +3313,7 @@ ClockScanObjCmd( } ClockInitDateInfo(&yy); - + /* * Extract values for the keywords. */ @@ -3334,13 +3334,13 @@ ClockScanObjCmd( /* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now, it's not localized. */ if (opts.localeObj != NULL) { - Tcl_SetResult(interp, - (char*)"legacy [clock scan] does not support -locale", TCL_STATIC); + Tcl_SetObjResult(interp, + Tcl_NewStringObj("legacy [clock scan] does not support -locale", -1)); Tcl_SetErrorCode(interp, "CLOCK", "flagWithLegacyFormat", NULL); return TCL_ERROR; } ret = ClockFreeScan(&yy, objv[1], &opts); - } + } else { /* Use compiled version of Scan - */ @@ -3420,14 +3420,14 @@ ClockScanCommit( } if (info->flags & (CLF_ASSEMBLE_SECONDS|CLF_ASSEMBLE_JULIANDAY|CLF_LOCALSEC)) { - if (ConvertLocalToUTC(clientData, opts->interp, &yydate, opts->timezoneObj, + if (ConvertLocalToUTC(clientData, opts->interp, &yydate, opts->timezoneObj, GREGORIAN_CHANGE_DATE) != TCL_OK) { return TCL_ERROR; } } /* Increment UTC seconds with relative time */ - + yydate.seconds += yyRelSeconds; return TCL_OK; @@ -3452,8 +3452,8 @@ int ClockFreeScan( register DateInfo *info, /* Date fields used for parsing & converting - * simultaneously a yy-parse structure of the - * TclClockFreeScan */ + * simultaneously a yy-parse structure of the + * TclClockFreeScan */ Tcl_Obj *strObj, /* String containing the time to scan */ ClockFmtScnCmdArgs *opts) /* Command options */ { @@ -3466,15 +3466,15 @@ ClockFreeScan( * Parse the date. The parser will fill a structure "info" with date, * time, time zone, relative month/day/seconds, relative weekday, ordinal * month. - * Notice that many yy-defines point to values in the "info" or "date" - * structure, e. g. yySeconds -> info->date.secondOfDay or + * Notice that many yy-defines point to values in the "info" or "date" + * structure, e. g. yySeconds -> info->date.secondOfDay or * yySeconds -> info->date.month (same as yydate.month) */ yyInput = Tcl_GetString(strObj); if (TclClockFreeScan(interp, info) != TCL_OK) { Tcl_Obj *msg = Tcl_NewObj(); - Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"%s\": %s", + Tcl_AppendPrintfToObj(msg, "unable to convert date-time string \"%s\": %s", Tcl_GetString(strObj), TclGetString(Tcl_GetObjResult(interp))); Tcl_SetObjResult(interp, msg); goto done; @@ -3501,7 +3501,7 @@ ClockFreeScan( } /* - * If the caller supplied a time zone in the string, make it into a time + * If the caller supplied a time zone in the string, make it into a time * zone indicator of +-hhmm and setup this time zone. */ @@ -3524,8 +3524,8 @@ ClockFreeScan( info->flags |= CLF_ASSEMBLE_SECONDS; } - - /* + + /* * Assemble date, time, zone into seconds-from-epoch */ @@ -3538,8 +3538,8 @@ ClockFreeScan( yySeconds = ToSeconds(yyHour, yyMinutes, yySeconds, yyMeridian); info->flags |= CLF_ASSEMBLE_SECONDS; - } - else + } + else if ( (yyHaveDay && !yyHaveDate) || yyHaveOrdinalMonth || ( yyHaveRel @@ -3548,7 +3548,7 @@ ClockFreeScan( ) { yySeconds = 0; info->flags |= CLF_ASSEMBLE_SECONDS; - } + } else { yySeconds = yydate.localSeconds % SECONDS_PER_DAY; } @@ -3588,13 +3588,13 @@ ClockCalcRelTime( { /* * Because some calculations require in-between conversion of the - * julian day, we can repeat this processing multiple times + * julian day, we can repeat this processing multiple times */ repeat_rel: if (yyHaveRel) { - /* + /* * Relative conversion normally possible in UTC time only, because * of possible wrong local time increment if ignores in-between DST-hole. * (see test-cases clock-34.53, clock-34.54). @@ -3641,7 +3641,7 @@ repeat_rel: info->flags &= ~CLF_ASSEMBLE_JULIANDAY; } yydate.julianDay += yyRelDay; - + /* julianDay was changed, on demand (lazy) extract year, month, etc. again */ info->flags |= CLF_ASSEMBLE_DATE|CLF_ASSEMBLE_SECONDS; @@ -3652,12 +3652,12 @@ repeat_rel: * leave rest of the increment in yyRelSeconds to add it hereafter in UTC seconds */ if (yyRelSeconds) { int newSecs = yySeconds + yyRelSeconds; - + /* if seconds increment outside of current date, increment day */ if (newSecs / SECONDS_PER_DAY != yySeconds / SECONDS_PER_DAY) { - + yyRelDay += newSecs / SECONDS_PER_DAY; - yySeconds = 0; + yySeconds = 0; yyRelSeconds = newSecs % SECONDS_PER_DAY; goto repeat_rel; @@ -3738,7 +3738,7 @@ repeat_rel: * * Get offset in days for the number of week days corresponding the * given day of week (skipping Saturdays and Sundays). - * + * * * Results: * Returns a day increment adjusted the given weekdays @@ -3819,7 +3819,7 @@ ClockWeekdaysOffs( * Used to determine the Gregorian change date. * * Results: - * Returns a standard Tcl result with the given time adjusted + * Returns a standard Tcl result with the given time adjusted * by the given offset(s) in order. * * Notes: @@ -3870,7 +3870,7 @@ ClockAddObjCmd( } ClockInitDateInfo(&yy); - + /* * Extract values for the keywords. */ @@ -3883,7 +3883,7 @@ ClockAddObjCmd( } /* time together as seconds of the day */ - yySeconds = yydate.localSeconds % SECONDS_PER_DAY; + yySeconds = yydate.localSeconds % SECONDS_PER_DAY; /* seconds are in localSeconds (relative base date), so reset time here */ yyHour = 0; yyMinutes = 0; yyMeridian = MER24; @@ -3913,12 +3913,12 @@ ClockAddObjCmd( continue; } - /* if in-between conversion needed (already have relative date/time), - * correct date info, because the date may be changed, + /* if in-between conversion needed (already have relative date/time), + * correct date info, because the date may be changed, * so refresh it now */ if ( yyHaveRel - && ( unitIndex == CLC_ADD_WEEKDAYS + && ( unitIndex == CLC_ADD_WEEKDAYS /* some months can be shorter as another */ || yyRelMonth || yyRelDay /* day changed */ @@ -4050,13 +4050,13 @@ TzsetGetEpoch(void) static char* tzWas = INT2PTR(-1); /* Previous value of TZ, protected by * clockMutex. */ static long tzLastRefresh = 0; /* Used for latency before next refresh */ - static unsigned long tzWasEpoch = 0; /* Epoch, signals that TZ changed */ - static unsigned long tzEnvEpoch = 0; /* Last env epoch, for faster signaling, + static size_t tzWasEpoch = 0; /* Epoch, signals that TZ changed */ + static size_t tzEnvEpoch = 0; /* Last env epoch, for faster signaling, that TZ changed via TCL */ - + const char *tzIsNow; /* Current value of TZ */ - - /* + + /* * Prevent performance regression on some platforms by resolving of system time zone: * small latency for check whether environment was changed (once per second) * no latency if environment was chaned with tcl-env (compare both epoch values) diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c index 0ec8817..5de05d0 100644 --- a/generic/tclClockFmt.c +++ b/generic/tclClockFmt.c @@ -50,7 +50,7 @@ static void ClockFrmScnFinalize(ClientData clientData); * pre-validated within parsing routines) * * Results: - * Returns a standard Tcl result. + * Returns a standard Tcl result. * TCL_OK - by successful conversion, TCL_ERROR by (wide) int overflow * *---------------------------------------------------------------------- @@ -59,7 +59,7 @@ static void ClockFrmScnFinalize(ClientData clientData); static inline int _str2int( int *out, - register + register const char *p, const char *e, int sign) @@ -84,12 +84,12 @@ _str2int( } *out = val; return TCL_OK; -} +} static inline int _str2wideInt( Tcl_WideInt *out, - register + register const char *p, const char *e, int sign) @@ -289,13 +289,13 @@ _witoaw( /* * Global GC as LIFO for released scan/format object storages. - * + * * Used to holds last released CLOCK_FMT_SCN_STORAGE_GC_SIZE formats * (after last reference from Tcl-object will be removed). This is helpful * to avoid continuous (re)creation and compiling by some dynamically resp. * variable format objects, that could be often reused. - * - * As long as format storage is used resp. belongs to GC, it takes place in + * + * As long as format storage is used resp. belongs to GC, it takes place in * FmtScnHashTable also. */ @@ -326,7 +326,7 @@ static struct { */ static inline void -ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) +ClockFmtScnStorageGC_In(ClockFmtScnStorage *entry) { /* add new entry */ TclSpliceIn(entry, ClockFmtScnStorage_GC.stackPtr); @@ -382,7 +382,7 @@ ClockFmtScnStorage_GC_Out(ClockFmtScnStorage *entry) * Global format storage hash table of type ClockFmtScnStorageHashKeyType * (contains list of scan/format object storages, shared across all threads). * - * Used for fast searching by format string. + * Used for fast searching by format string. */ static Tcl_HashTable FmtScnHashTable; static int initialized = 0; @@ -422,7 +422,7 @@ ClockFmtScnStorageAllocProc( const char *string = (const char *) keyPtr; Tcl_HashEntry *hPtr; - unsigned int size, + unsigned int size, allocsize = sizeof(ClockFmtScnStorage) + sizeof(Tcl_HashEntry); allocsize += (size = strlen(string) + 1); @@ -455,7 +455,7 @@ ClockFmtScnStorageAllocProc( *---------------------------------------------------------------------- */ -static void +static void ClockFmtScnStorageFreeProc( Tcl_HashEntry *hPtr) { @@ -488,10 +488,10 @@ ClockFmtScnStorageFreeProc( *---------------------------------------------------------------------- */ -static void +static void ClockFmtScnStorageDelete(ClockFmtScnStorage *fss) { Tcl_HashEntry *hPtr = HashEntry4FmtScn(fss); - /* + /* * This will delete a hash entry and call "ckfree" for storage self, if * some additionally handling required, freeEntryProc can be used instead */ @@ -499,7 +499,7 @@ ClockFmtScnStorageDelete(ClockFmtScnStorage *fss) { } -/* +/* * Derivation of tclStringHashKeyType with another allocEntryProc */ @@ -567,10 +567,10 @@ ClockFmtObj_FreeInternalRep(objPtr) #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 /* don't remove it right now (may be reusable), just add to GC */ ClockFmtScnStorageGC_In(fss); - #else + #else /* remove storage (format representation) */ ClockFmtScnStorageDelete(fss); - #endif + #endif } Tcl_MutexUnlock(&ClockFmtMutex); } @@ -630,7 +630,7 @@ ClockFmtObj_UpdateString(objPtr) * Retrieves format key object used to search localized format. * * This is normally stored in second pointer of internal representation. - * If format object is not localizable, it is equal the given format + * If format object is not localizable, it is equal the given format * pointer (special case to fast fallback by not-localizable formats). * * Results: @@ -655,7 +655,7 @@ ClockFrmObjGetLocFmtKey( return NULL; } } - + keyObj = ObjLocFmtKey(objPtr); if (keyObj) { return keyObj; @@ -692,7 +692,7 @@ ClockFrmObjGetLocFmtKey( static ClockFmtScnStorage * FindOrCreateFmtScnStorage( - Tcl_Interp *interp, + Tcl_Interp *interp, Tcl_Obj *objPtr) { const char *strFmt = TclGetString(objPtr); @@ -720,7 +720,7 @@ FindOrCreateFmtScnStorage( /* get or create entry (and alocate storage) */ hPtr = Tcl_CreateHashEntry(&FmtScnHashTable, strFmt, &new); if (hPtr != NULL) { - + fss = FmtScn4HashEntry(hPtr); #if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0 @@ -772,7 +772,7 @@ Tcl_GetClockFrmScnFromObj( Tcl_Obj *objPtr) { ClockFmtScnStorage *fss; - + if (objPtr->typePtr != &ClockFmtObjType) { if (ClockFmtObj_SetFromAny(interp, objPtr) != TCL_OK) { return NULL; @@ -822,7 +822,7 @@ ClockLocalizeFormat( return opts->formatObj; } - /* prevents loss of key object if the format object (where key stored) + /* prevents loss of key object if the format object (where key stored) * becomes changed (loses its internal representation during evals) */ Tcl_IncrRefCount(keyObj); @@ -833,7 +833,7 @@ ClockLocalizeFormat( } /* try to find in cache within locale mc-catalog */ - if (Tcl_DictObjGet(NULL, opts->mcDictObj, + if (Tcl_DictObjGet(NULL, opts->mcDictObj, keyObj, &valObj) != TCL_OK) { goto done; } @@ -947,7 +947,7 @@ FindTokenBegin( static void DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, - DateInfo *info, ClockScanToken *tok, + DateInfo *info, ClockScanToken *tok, int *minLenPtr, int *maxLenPtr) { register int minLen = tok->map->minSize; @@ -973,7 +973,7 @@ DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, }; if (minLen < tok->map->minSize) { minLen = tok->map->minSize; - } + } if (minLen > maxLen) { maxLen = minLen; } @@ -1032,7 +1032,7 @@ DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, * * ObjListSearch -- * - * Find largest part of the input string from start regarding min and + * Find largest part of the input string from start regarding min and * max lengths in the given list (utf-8, case sensitive). * * Results: @@ -1044,9 +1044,9 @@ DetermineGreedySearchLen(ClockFmtScnCmdArgs *opts, *---------------------------------------------------------------------- */ -static inline int -ObjListSearch(ClockFmtScnCmdArgs *opts, - DateInfo *info, int *val, +static inline int +ObjListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, int *val, Tcl_Obj **lstv, int lstc, int minLen, int maxLen) { @@ -1091,9 +1091,9 @@ ObjListSearch(ClockFmtScnCmdArgs *opts, #if 0 /* currently unused */ -static int -LocaleListSearch(ClockFmtScnCmdArgs *opts, - DateInfo *info, int mcKey, int *val, +static int +LocaleListSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, int mcKey, int *val, int minLen, int maxLen) { Tcl_Obj **lstv; @@ -1139,7 +1139,7 @@ LocaleListSearch(ClockFmtScnCmdArgs *opts, static TclStrIdxTree * ClockMCGetListIdxTree( - ClockFmtScnCmdArgs *opts, + ClockFmtScnCmdArgs *opts, int mcKey) { TclStrIdxTree * idxTree; @@ -1166,7 +1166,7 @@ ClockMCGetListIdxTree( goto done; } - if (TclListObjGetElements(opts->interp, valObj, + if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { goto done; }; @@ -1196,8 +1196,8 @@ done: * Retrieves localized string indexed tree in the locale catalog for * multiple lists by literal indices mcKeys (and builds it on demand). * - * Searches localized index in locale catalog for mcKey, and if not - * yet exists, creates string indexed tree and stores it in the + * Searches localized index in locale catalog for mcKey, and if not + * yet exists, creates string indexed tree and stores it in the * locale catalog. * * Results: @@ -1211,8 +1211,8 @@ done: static TclStrIdxTree * ClockMCGetMultiListIdxTree( - ClockFmtScnCmdArgs *opts, - int mcKey, + ClockFmtScnCmdArgs *opts, + int mcKey, int *mcKeys) { TclStrIdxTree * idxTree; @@ -1241,7 +1241,7 @@ ClockMCGetMultiListIdxTree( goto done; } - if (TclListObjGetElements(opts->interp, valObj, + if (TclListObjGetElements(opts->interp, valObj, &lstc, &lstv) != TCL_OK) { goto done; }; @@ -1275,7 +1275,7 @@ done: * * Results: * TCL_OK - match found and the index stored in *val, - * TCL_RETURN - not matched or ambigous, + * TCL_RETURN - not matched or ambigous, * TCL_ERROR - in error case. * * Side effects: @@ -1285,15 +1285,15 @@ done: */ static inline int -ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, - DateInfo *info, TclStrIdxTree *idxTree, int *val, +ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, + DateInfo *info, TclStrIdxTree *idxTree, int *val, int minLen, int maxLen) { const char *f; TclStrIdx *foundItem; - f = TclStrIdxTreeSearch(NULL, &foundItem, idxTree, + f = TclStrIdxTreeSearch(NULL, &foundItem, idxTree, yyInput, yyInput + maxLen); - + if (f <= yyInput || (f - yyInput) < minLen) { /* not found */ return TCL_RETURN; @@ -1313,15 +1313,15 @@ ClockStrIdxTreeSearch(ClockFmtScnCmdArgs *opts, #if 0 /* currently unused */ -static int -StaticListSearch(ClockFmtScnCmdArgs *opts, +static int +StaticListSearch(ClockFmtScnCmdArgs *opts, DateInfo *info, const char **lst, int *val) { int len; const char **s = lst; while (*s != NULL) { len = strlen(*s); - if ( len <= info->dateEnd - yyInput + if ( len <= info->dateEnd - yyInput && strncasecmp(yyInput, *s, len) == 0 ) { *val = (s - lst); @@ -1339,7 +1339,7 @@ StaticListSearch(ClockFmtScnCmdArgs *opts, static inline const char * FindWordEnd( - ClockScanToken *tok, + ClockScanToken *tok, register const char * p, const char * end) { register const char *x = tok->tokWord.start; @@ -1358,7 +1358,7 @@ FindWordEnd( return pfnd; } -static int +static int ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { @@ -1371,7 +1371,7 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, "July", "August", "September", "October", "November", "December", /* abbr */ - "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL }; @@ -1408,7 +1408,7 @@ ClockScnToken_Month_Proc(ClockFmtScnCmdArgs *opts, } -static int +static int ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { @@ -1425,7 +1425,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, if ( curTok != 'a' && curTok != 'A' && ((minLen <= 1 && maxLen >= 1) || PTR2INT(tok->map->data)) ) { - + val = -1; if (PTR2INT(tok->map->data) == 0) { @@ -1450,8 +1450,7 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, val = 7; } if (val > 7) { - Tcl_SetResult(opts->interp, (char*)"day of week is greater than 7", - TCL_STATIC); + Tcl_SetObjResult(opts->interp, Tcl_NewStringObj("day of week is greater than 7", -1)); Tcl_SetErrorCode(opts->interp, "CLOCK", "badDayOfWeek", NULL); return TCL_ERROR; } @@ -1484,8 +1483,8 @@ ClockScnToken_DayOfWeek_Proc(ClockFmtScnCmdArgs *opts, } -static int -ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, +static int +ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { int ret, val; @@ -1504,7 +1503,7 @@ ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, ret = ObjListSearch(opts, info, &val, amPmObj, 2, minLen, maxLen); if (ret != TCL_OK) { - return ret; + return ret; } if (val == 0) { @@ -1516,8 +1515,8 @@ ClockScnToken_amPmInd_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } -static int -ClockScnToken_LocaleERA_Proc(ClockFmtScnCmdArgs *opts, +static int +ClockScnToken_LocaleERA_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { ClockClientData *dataPtr = opts->clientData; @@ -1542,7 +1541,7 @@ ClockScnToken_LocaleERA_Proc(ClockFmtScnCmdArgs *opts, ret = ObjListSearch(opts, info, &val, eraObj, 6, minLen, maxLen); if (ret != TCL_OK) { - return ret; + return ret; } if (val & 1) { @@ -1554,8 +1553,8 @@ ClockScnToken_LocaleERA_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } -static int -ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, +static int +ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { int ret, val; @@ -1583,8 +1582,8 @@ ClockScnToken_LocaleListMatcher_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } -static int -ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, +static int +ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { int minLen, maxLen; @@ -1598,7 +1597,7 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, if (*p == '+' || *p == '-') { /* max chars in numeric zone = "+00:00:00" */ #define MAX_ZONE_LEN 9 - char buf[MAX_ZONE_LEN + 1]; + char buf[MAX_ZONE_LEN + 1]; char *bp = buf; *bp++ = *p++; len++; if (maxLen > MAX_ZONE_LEN) @@ -1621,7 +1620,7 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, return TCL_RETURN; } #undef MAX_ZONE_LEN - + /* timezone */ tzObjStor = Tcl_NewStringObj(buf, bp-buf); } else { @@ -1629,7 +1628,7 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, if (maxLen > 4) maxLen = 4; while (len < maxLen) { - if ( (*p & 0x80) + if ( (*p & 0x80) || (!isalpha(UCHAR(*p)) && !isdigit(UCHAR(*p))) ) { /* INTL: ISO only. */ break; @@ -1650,7 +1649,7 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, /* try to apply new time zone */ Tcl_IncrRefCount(tzObjStor); - opts->timezoneObj = ClockSetupTimeZone(opts->clientData, opts->interp, + opts->timezoneObj = ClockSetupTimeZone(opts->clientData, opts->interp, tzObjStor); Tcl_DecrRefCount(tzObjStor); @@ -1663,8 +1662,8 @@ ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } -static int -ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, +static int +ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, DateInfo *info, ClockScanToken *tok) { int minLen, maxLen; @@ -1741,7 +1740,7 @@ ClockScnToken_StarDate_Proc(ClockFmtScnCmdArgs *opts, return TCL_OK; } -static const char *ScnSTokenMapIndex = +static const char *ScnSTokenMapIndex = "dmbyYHMSpJjCgGVazUsntQ"; static ClockScanTokenMap ScnSTokenMap[] = { /* %d %e */ @@ -1814,7 +1813,7 @@ static const char *ScnSTokenMapAliasIndex[2] = { "dmbbHHHpaaazU" }; -static const char *ScnETokenMapIndex = +static const char *ScnETokenMapIndex = "Eys"; static ClockScanTokenMap ScnETokenMap[] = { /* %EE */ @@ -1832,7 +1831,7 @@ static const char *ScnETokenMapAliasIndex[2] = { "" }; -static const char *ScnOTokenMapIndex = +static const char *ScnOTokenMapIndex = "dmyHMSu"; static ClockScanTokenMap ScnOTokenMap[] = { /* %Od %Oe */ @@ -1862,7 +1861,7 @@ static const char *ScnOTokenMapAliasIndex[2] = { "dHHHu" }; -static const char *ScnSpecTokenMapIndex = +static const char *ScnSpecTokenMapIndex = " "; static ClockScanTokenMap ScnSpecTokenMap[] = { {CTOKT_SPACE, 0, 0, 1, 1, 0, @@ -1870,7 +1869,7 @@ static ClockScanTokenMap ScnSpecTokenMap[] = { }; static ClockScanTokenMap ScnWordTokenMap = { - CTOKT_WORD, 0, 0, 1, 1, 0, + CTOKT_WORD, 0, 0, 1, 1, 0, NULL }; @@ -1937,7 +1936,7 @@ ClockGetOrParseScanFormat( /* estimate token count by % char and format length */ fss->scnTokC = EstimateTokenCount(p, e); - + fss->scnSpaceCount = 0; Tcl_MutexLock(&ClockFmtMutex); @@ -1959,7 +1958,7 @@ ClockGetOrParseScanFormat( /* try to find modifier: */ switch (*p) { case '%': - /* begin new word token - don't join with previous word token, + /* begin new word token - don't join with previous word token, * because current mapping should be "...%%..." -> "...%..." */ tok->map = &ScnWordTokenMap; tok->tokWord.start = p; @@ -1969,7 +1968,7 @@ ClockGetOrParseScanFormat( continue; break; case 'E': - scnMap = ScnETokenMap, + scnMap = ScnETokenMap, mapIndex = ScnETokenMapIndex, aliasIndex = ScnETokenMapAliasIndex; p++; @@ -2018,7 +2017,7 @@ ClockGetOrParseScanFormat( } /* increase space count used in format */ - if ( tok->map->type == CTOKT_CHAR + if ( tok->map->type == CTOKT_CHAR && isspace(UCHAR(*((char *)tok->map->data))) ) { fss->scnSpaceCount++; @@ -2161,13 +2160,13 @@ ClockScan( } info->dateStart = p = yyInput; info->dateEnd = end; - + /* parse string */ for (; tok->map != NULL; tok++) { map = tok->map; /* bypass spaces at begin of input before parsing each token */ - if ( !(opts->flags & CLF_STRICT) - && ( map->type != CTOKT_SPACE + if ( !(opts->flags & CLF_STRICT) + && ( map->type != CTOKT_SPACE && map->type != CTOKT_WORD && map->type != CTOKT_CHAR ) ) { @@ -2206,13 +2205,13 @@ ClockScan( if (map->offs) { p = yyInput; x = p + size; if (!(map->flags & (CLF_LOCALSEC|CLF_POSIXSEC))) { - if (_str2int((int *)(((char *)info) + map->offs), + if (_str2int((int *)(((char *)info) + map->offs), p, x, sign) != TCL_OK) { goto overflow; } p = x; } else { - if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), + if (_str2wideInt((Tcl_WideInt *)(((char *)info) + map->offs), p, x, sign) != TCL_OK) { goto overflow; } @@ -2297,8 +2296,8 @@ ClockScan( tok++; } - /* - * Invalidate result + /* + * Invalidate result */ /* seconds token (%s) take precedence over all other tokens */ @@ -2332,17 +2331,17 @@ ClockScan( } /* YearWeekDay below YearMonthDay */ - if ( (flags & CLF_ISO8601) + if ( (flags & CLF_ISO8601) && ( (flags & (CLF_YEAR|CLF_DAYOFYEAR)) == (CLF_YEAR|CLF_DAYOFYEAR) || (flags & (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH)) == (CLF_YEAR|CLF_DAYOFMONTH|CLF_MONTH) - ) + ) ) { /* yy precedence below yyyy */ if (!(flags & CLF_ISO8601CENTURY) && (flags & CLF_CENTURY)) { /* normally precedence of ISO is higher, but no century - so put it down */ flags &= ~CLF_ISO8601; - } - else + } + else /* yymmdd or yyddd over naked weekday */ if (!(flags & CLF_ISO8601YEAR)) { flags &= ~CLF_ISO8601; @@ -2400,15 +2399,15 @@ ClockScan( overflow: - Tcl_SetResult(opts->interp, (char*)"requested date too large to represent", - TCL_STATIC); + Tcl_SetObjResult(opts->interp, Tcl_NewStringObj("requested date too large to represent", + -1)); Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL); goto done; not_match: - Tcl_SetResult(opts->interp, (char*)"input string does not match supplied format", - TCL_STATIC); + Tcl_SetObjResult(opts->interp, Tcl_NewStringObj("input string does not match supplied format", + -1)); Tcl_SetErrorCode(opts->interp, "CLOCK", "badInputString", NULL); done: @@ -2423,7 +2422,7 @@ FrmResultAllocate( { int needed = dateFmt->output + len - dateFmt->resEnd; if (needed >= 0) { /* >= 0 - regards NTS zero */ - int newsize = dateFmt->resEnd - dateFmt->resMem + int newsize = dateFmt->resEnd - dateFmt->resMem + needed + MIN_FMT_RESULT_BLOCK_ALLOC; char *newRes = ckrealloc(dateFmt->resMem, newsize); if (newRes == NULL) { @@ -2499,9 +2498,9 @@ ClockFmtToken_StarDate_Proc( if (FrmResultAllocate(dateFmt, 30) != TCL_OK) { return TCL_ERROR; }; memcpy(dateFmt->output, "Stardate ", 9); dateFmt->output += 9; - dateFmt->output = _itoaw(dateFmt->output, + dateFmt->output = _itoaw(dateFmt->output, dateFmt->date.year - RODDENBERRY, '0', 2); - dateFmt->output = _itoaw(dateFmt->output, + dateFmt->output = _itoaw(dateFmt->output, fractYear, '0', 3); *dateFmt->output++ = '.'; /* be sure positive after decimal point (note: clock-value can be negative) */ @@ -2556,7 +2555,7 @@ ClockFmtToken_TimeZone_Proc( const char *s; int len; /* convert seconds to local seconds to obtain tzName object */ if (ConvertUTCToLocal(opts->clientData, opts->interp, - &dateFmt->date, opts->timezoneObj, + &dateFmt->date, opts->timezoneObj, GREGORIAN_CHANGE_DATE) != TCL_OK) { return TCL_ERROR; }; @@ -2616,7 +2615,7 @@ ClockFmtToken_LocaleERAYear_Proc( return TCL_ERROR; } if (rowc != 0) { - dateFmt->localeEra = LookupLastTransition(opts->interp, + dateFmt->localeEra = LookupLastTransition(opts->interp, dateFmt->date.localSeconds, rowc, rowv, NULL); } if (dateFmt->localeEra == NULL) { @@ -2629,11 +2628,11 @@ ClockFmtToken_LocaleERAYear_Proc( if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { return TCL_ERROR; }; if (*tok->tokWord.start == 'C') { /* %EC */ *val = dateFmt->date.year / 100; - dateFmt->output = _itoaw(dateFmt->output, + dateFmt->output = _itoaw(dateFmt->output, *val, '0', 2); } else { /* %Ey */ *val = dateFmt->date.year % 100; - dateFmt->output = _itoaw(dateFmt->output, + dateFmt->output = _itoaw(dateFmt->output, *val, '0', 2); } } else { @@ -2667,7 +2666,7 @@ ClockFmtToken_LocaleERAYear_Proc( } else { /* year as integer */ if (FrmResultAllocate(dateFmt, 11) != TCL_OK) { return TCL_ERROR; }; - dateFmt->output = _itoaw(dateFmt->output, + dateFmt->output = _itoaw(dateFmt->output, *val, '0', 2); return TCL_OK; } @@ -2682,7 +2681,7 @@ ClockFmtToken_LocaleERAYear_Proc( } -static const char *FmtSTokenMapIndex = +static const char *FmtSTokenMapIndex = "demNbByYCHMSIklpaAuwUVzgGjJsntQ"; static ClockFormatTokenMap FmtSTokenMap[] = { /* %d */ @@ -2712,15 +2711,15 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %S */ {CFMTT_INT, "0", 2, 0, 0, 60, TclOffset(DateFormat, date.secondOfDay), NULL}, /* %I */ - {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_HourAMPM_Proc, NULL}, /* %k */ {CFMTT_INT, " ", 2, 0, 3600, 24, TclOffset(DateFormat, date.secondOfDay), NULL}, /* %l */ - {CFMTT_INT, " ", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, " ", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_HourAMPM_Proc, NULL}, /* %p %P */ - {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_AMPM_Proc, NULL}, /* %a */ {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), @@ -2733,12 +2732,12 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %w */ {CFMTT_INT, " ", 1, 0, 0, 7, TclOffset(DateFormat, date.dayOfWeek), NULL}, /* %U %W */ - {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.dayOfYear), + {CFMTT_INT, "0", 2, CLFMT_CALC, 0, 0, TclOffset(DateFormat, date.dayOfYear), ClockFmtToken_WeekOfYear_Proc, NULL}, /* %V */ {CFMTT_INT, "0", 2, 0, 0, 0, TclOffset(DateFormat, date.iso8601Week), NULL}, /* %z %Z */ - {CFMTT_INT, NULL, 0, 0, 0, 0, 0, + {CFMTT_INT, NULL, 0, 0, 0, 0, 0, ClockFmtToken_TimeZone_Proc, NULL}, /* %g */ {CFMTT_INT, "0", 2, 0, 0, 100, TclOffset(DateFormat, date.iso8601Year), NULL}, @@ -2755,7 +2754,7 @@ static ClockFormatTokenMap FmtSTokenMap[] = { /* %t */ {CTOKT_CHAR, "\t", 0, 0, 0, 0, 0, NULL}, /* %Q */ - {CFMTT_INT, NULL, 0, 0, 0, 0, 0, + {CFMTT_INT, NULL, 0, 0, 0, 0, 0, ClockFmtToken_StarDate_Proc, NULL}, }; static const char *FmtSTokenMapAliasIndex[2] = { @@ -2763,11 +2762,11 @@ static const char *FmtSTokenMapAliasIndex[2] = { "bpUz" }; -static const char *FmtETokenMapIndex = +static const char *FmtETokenMapIndex = "Eys"; static ClockFormatTokenMap FmtETokenMap[] = { /* %EE */ - {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.era), + {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.era), ClockFmtToken_LocaleERA_Proc, NULL}, /* %Ey %EC */ {CFMTT_INT, NULL, 0, 0, 0, 0, TclOffset(DateFormat, date.year), @@ -2780,7 +2779,7 @@ static const char *FmtETokenMapAliasIndex[2] = { "y" }; -static const char *FmtOTokenMapIndex = +static const char *FmtOTokenMapIndex = "dmyHIMSuw"; static ClockFormatTokenMap FmtOTokenMap[] = { /* %Od %Oe */ @@ -2793,22 +2792,22 @@ static ClockFormatTokenMap FmtOTokenMap[] = { {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.year), NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %OH %Ok */ - {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 3600, 24, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 3600, 24, TclOffset(DateFormat, date.secondOfDay), NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %OI %Ol */ - {CFMTT_INT, NULL, 0, CLFMT_CALC | CLFMT_LOCALE_INDX, 0, 0, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, NULL, 0, CLFMT_CALC | CLFMT_LOCALE_INDX, 0, 0, TclOffset(DateFormat, date.secondOfDay), ClockFmtToken_HourAMPM_Proc, (void *)MCLIT_LOCALE_NUMERALS}, /* %OM */ - {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 60, 60, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 60, 60, TclOffset(DateFormat, date.secondOfDay), NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %OS */ - {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 60, TclOffset(DateFormat, date.secondOfDay), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 60, TclOffset(DateFormat, date.secondOfDay), NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %Ou */ {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 100, TclOffset(DateFormat, date.dayOfWeek), NULL, (void *)MCLIT_LOCALE_NUMERALS}, /* %Ow */ - {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), + {CFMTT_INT, NULL, 0, CLFMT_LOCALE_INDX, 0, 7, TclOffset(DateFormat, date.dayOfWeek), NULL, (void *)MCLIT_LOCALE_NUMERALS}, }; static const char *FmtOTokenMapAliasIndex[2] = { @@ -2866,7 +2865,7 @@ ClockGetOrParseFmtFormat( /* try to find modifier: */ switch (*p) { case '%': - /* begin new word token - don't join with previous word token, + /* begin new word token - don't join with previous word token, * because current mapping should be "...%%..." -> "...%..." */ tok->map = &FmtWordTokenMap; tok->tokWord.start = p; @@ -2876,7 +2875,7 @@ ClockGetOrParseFmtFormat( continue; break; case 'E': - fmtMap = FmtETokenMap, + fmtMap = FmtETokenMap, mapIndex = FmtETokenMapIndex, aliasIndex = FmtETokenMapAliasIndex; p++; @@ -2977,7 +2976,7 @@ ClockFormat( if (dateFmt->date.secondOfDay < 0) { dateFmt->date.secondOfDay += SECONDS_PER_DAY; } - + /* result container object */ dateFmt->resMem = ckalloc(MIN_FMT_RESULT_BLOCK_ALLOC); if (dateFmt->resMem == NULL) { diff --git a/generic/tclDate.c b/generic/tclDate.c index 64cb804..934fe5f 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -1,20 +1,20 @@ /* A Bison parser, made by GNU Bison 2.4.2. */ /* Skeleton implementation for Bison's Yacc-like parsers in C - + Copyright (C) 1984, 1989-1990, 2000-2006, 2009-2010 Free Software Foundation, Inc. - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -27,7 +27,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -2685,7 +2685,7 @@ TclClockFreeScan( /* * yyInput = stringToParse; - * + * * ClockInitDateInfo(info) should be executed to pre-init info; */ diff --git a/generic/tclDate.h b/generic/tclDate.h index abc231b..570a8e4 100644 --- a/generic/tclDate.h +++ b/generic/tclDate.h @@ -109,7 +109,7 @@ typedef enum ClockMsgCtLiteral { MCLIT__NIL, /* placeholder */ MCLIT_MONTHS_FULL, MCLIT_MONTHS_ABBREV, MCLIT_MONTHS_COMB, MCLIT_DAYS_OF_WEEK_FULL, MCLIT_DAYS_OF_WEEK_ABBREV, MCLIT_DAYS_OF_WEEK_COMB, - MCLIT_AM, MCLIT_PM, + MCLIT_AM, MCLIT_PM, MCLIT_LOCALE_ERAS, MCLIT_BCE, MCLIT_CE, MCLIT_BCE2, MCLIT_CE2, @@ -486,16 +486,16 @@ MODULE_SCOPE Tcl_Obj * ClockMCGet(ClockFmtScnCmdArgs *opts, int mcKey); MODULE_SCOPE Tcl_Obj * ClockMCGetIdx(ClockFmtScnCmdArgs *opts, int mcKey); -MODULE_SCOPE int ClockMCSetIdx(ClockFmtScnCmdArgs *opts, int mcKey, +MODULE_SCOPE int ClockMCSetIdx(ClockFmtScnCmdArgs *opts, int mcKey, Tcl_Obj *valObj); /* tclClockFmt.c module declarations */ -MODULE_SCOPE Tcl_Obj* +MODULE_SCOPE Tcl_Obj* ClockFrmObjGetLocFmtKey(Tcl_Interp *interp, Tcl_Obj *objPtr); -MODULE_SCOPE ClockFmtScnStorage * +MODULE_SCOPE ClockFmtScnStorage * Tcl_GetClockFrmScnFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr); MODULE_SCOPE Tcl_Obj * @@ -504,7 +504,7 @@ MODULE_SCOPE Tcl_Obj * MODULE_SCOPE int ClockScan(register DateInfo *info, Tcl_Obj *strObj, ClockFmtScnCmdArgs *opts); -MODULE_SCOPE int ClockFormat(register DateFormat *dateFmt, +MODULE_SCOPE int ClockFormat(register DateFormat *dateFmt, ClockFmtScnCmdArgs *opts); MODULE_SCOPE void ClockFrmScnClearCaches(void); diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 2480685..5b8deb6 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -328,7 +328,7 @@ TclNamespaceEnsembleCmd( } continue; case CRT_COMPILE: - if (Tcl_GetBooleanFromObj(interp, objv[1], + if (Tcl_GetBooleanFromObj(interp, objv[1], &ensCompFlag) != TCL_OK) { return TCL_ERROR; }; @@ -358,7 +358,7 @@ TclNamespaceEnsembleCmd( Tcl_SetEnsembleMappingDict(interp, token, mapObj); Tcl_SetEnsembleUnknownHandler(interp, token, unknownObj); Tcl_SetEnsembleParameterList(interp, token, paramObj); - /* + /* * Ensemble should be compiled if it has map (performance purposes) */ if (ensCompFlag > 0 && mapObj != NULL) { diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 0041a40..d05cc61 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -19,7 +19,7 @@ TCL_DECLARE_MUTEX(envMutex) /* To serialize access to environ. */ /* MODULE_SCOPE */ -unsigned long TclEnvEpoch = 0; /* Epoch of the tcl environment +size_t TclEnvEpoch = 0; /* Epoch of the tcl environment * (if changed with tcl-env). */ static struct { diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 6d6a0d0..b83644b 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -896,7 +896,7 @@ TclClockFreeScan( /* * yyInput = stringToParse; - * + * * ClockInitDateInfo(info) should be executed to pre-init info; */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 5bd4324..8edc518 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4875,7 +4875,7 @@ typedef struct NRE_callback { * Other externals. */ -MODULE_SCOPE unsigned long TclEnvEpoch; /* Epoch of the tcl environment +MODULE_SCOPE size_t TclEnvEpoch; /* Epoch of the tcl environment * (if changed with tcl-env). */ #endif /* _TCLINT */ diff --git a/generic/tclStrIdxTree.c b/generic/tclStrIdxTree.c index 0045ea5..557d575 100644 --- a/generic/tclStrIdxTree.c +++ b/generic/tclStrIdxTree.c @@ -1,7 +1,7 @@ /* * tclStrIdxTree.c -- * - * Contains the routines for managing string index tries in Tcl. + * Contains the routines for managing string index tries in Tcl. * * This code is back-ported from the tclSE engine, by Serg G. Brester. * @@ -12,11 +12,11 @@ * * ----------------------------------------------------------------------- * - * String index tries are prepaired structures used for fast greedy search of the string + * String index tries are prepaired structures used for fast greedy search of the string * (index) by unique string prefix as key. * * Index tree build for two lists together can be explained in the following datagram - * + * * Lists: * * {Januar Februar Maerz April Mai Juni Juli August September Oktober November Dezember} @@ -42,9 +42,9 @@ * i 5 * zb 12 * rz 3 * * ... - * + * * Thereby value 0 shows pure group items (corresponding ambigous matches). - * But the group may have a value if it contains only same values + * But the group may have a value if it contains only same values * (see for example group "f" above). * * StrIdxTree's are very fast, so: @@ -109,7 +109,7 @@ TclStrIdxTreeSearch( s = f; /* if match item, go deeper as long as possible */ if (offs >= item->length && item->childTree.firstPtr) { - /* save previuosly found item (if not ambigous) for + /* save previuosly found item (if not ambigous) for * possible fallback (few greedy match) */ if (item->value != NULL) { prevf = f; @@ -145,7 +145,7 @@ done: return start; } -MODULE_SCOPE void +MODULE_SCOPE void TclStrIdxTreeFree( TclStrIdx *tree) { @@ -157,13 +157,13 @@ TclStrIdxTreeFree( } t = tree, tree = tree->nextPtr; ckfree(t); - } + } } /* * Several bidirectional list primitives */ -inline void +inline void TclStrIdxTreeInsertBranch( TclStrIdxTree *parent, register TclStrIdx *item, @@ -282,7 +282,7 @@ TclStrIdxTreeBuildFromList( foundItem->length = lwrv[i]->length; continue; } - /* split tree (e. g. j->(jan,jun) + jul == j->(jan,ju->(jun,jul)) ) + /* split tree (e. g. j->(jan,jun) + jul == j->(jan,ju->(jun,jul)) ) * but don't split by fulfilled child of found item ( ii->iii->iiii ) */ if (foundItem->length != (f - s)) { /* first split found item (insert one between parent and found + new one) */ @@ -351,7 +351,7 @@ Tcl_ObjType StrIdxTreeObjType = { NULL /* setFromAnyProc */ }; -MODULE_SCOPE Tcl_Obj* +MODULE_SCOPE Tcl_Obj* TclStrIdxTreeNewObj() { Tcl_Obj *objPtr = Tcl_NewObj(); @@ -372,7 +372,7 @@ StrIdxTreeObj_DupIntRepProc(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) srcPtr = (Tcl_Obj*)srcPtr->internalRep.twoPtrValue.ptr1; } /* create smart pointer to it (ptr1 != NULL, ptr2 = NULL) */ - Tcl_InitObjRef(*((Tcl_Obj **)©Ptr->internalRep.twoPtrValue.ptr1), + Tcl_InitObjRef(*((Tcl_Obj **)©Ptr->internalRep.twoPtrValue.ptr1), srcPtr); copyPtr->internalRep.twoPtrValue.ptr2 = NULL; copyPtr->typePtr = &StrIdxTreeObjType; @@ -428,7 +428,7 @@ TclStrIdxTreeGetFromObj(Tcl_Obj *objPtr) { #if 0 /* currently unused, debug resp. test purposes only */ -void +void TclStrIdxTreePrint( Tcl_Interp *interp, TclStrIdx *tree, @@ -439,7 +439,7 @@ TclStrIdxTreePrint( Tcl_InitObjRef(obj[0], Tcl_NewStringObj("::puts", -1)); while (tree != NULL) { s = TclGetString(tree->key) + offs; - Tcl_InitObjRef(obj[1], Tcl_ObjPrintf("%*s%.*s\t:%d", + Tcl_InitObjRef(obj[1], Tcl_ObjPrintf("%*s%.*s\t:%d", offs, "", tree->length - offs, s, tree->value)); Tcl_PutsObjCmd(NULL, interp, 2, obj); Tcl_UnsetObjRef(obj[1]); @@ -469,10 +469,10 @@ TclStrIdxTreeTestObjCmd( int optionIndex; if (objc < 2) { - Tcl_SetResult(interp, (char*)"wrong # args", TCL_STATIC); + Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], options, + if (Tcl_GetIndexFromObj(interp, objv[1], options, "option", 0, &optionIndex) != TCL_OK) { Tcl_SetErrorCode(interp, "CLOCK", "badOption", Tcl_GetString(objv[1]), NULL); @@ -481,7 +481,7 @@ TclStrIdxTreeTestObjCmd( switch (optionIndex) { case O_FINDEQUAL: if (objc < 4) { - Tcl_SetResult(interp, (char*)"wrong # args", TCL_STATIC); + Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } cs = TclGetString(objv[2]); @@ -499,7 +499,7 @@ TclStrIdxTreeTestObjCmd( TclStrIdxTree idxTree = {NULL, NULL}; i = 1; while (++i < objc) { - if (TclListObjGetElements(interp, objv[i], + if (TclListObjGetElements(interp, objv[i], &lstc, &lstv) != TCL_OK) { return TCL_ERROR; }; diff --git a/generic/tclStrIdxTree.h b/generic/tclStrIdxTree.h index 9f26907..6ed5170 100644 --- a/generic/tclStrIdxTree.h +++ b/generic/tclStrIdxTree.h @@ -1,7 +1,7 @@ /* * tclStrIdxTree.h -- * - * Declarations of string index tries and other primitives currently + * Declarations of string index tries and other primitives currently * back-ported from tclSE. * * Copyright (c) 2016 Serg G. Brester (aka sebres) @@ -38,7 +38,7 @@ typedef struct TclStrIdx { * * TclUtfFindEqual, TclUtfFindEqualNC -- * - * Find largest part of string cs in string cin (case sensitive and not). + * Find largest part of string cs in string cin (case sensitive and not). * * Results: * Return position of UTF character in cs after last equal character. @@ -148,13 +148,13 @@ if (1) { \ MODULE_SCOPE const char* TclStrIdxTreeSearch(TclStrIdxTree **foundParent, - TclStrIdx **foundItem, TclStrIdxTree *tree, + TclStrIdx **foundItem, TclStrIdxTree *tree, const char *start, const char *end); MODULE_SCOPE int TclStrIdxTreeBuildFromList(TclStrIdxTree *idxTree, int lstc, Tcl_Obj **lstv, ClientData *values); -MODULE_SCOPE Tcl_Obj* +MODULE_SCOPE Tcl_Obj* TclStrIdxTreeNewObj(); MODULE_SCOPE TclStrIdxTree* diff --git a/library/clock.tcl b/library/clock.tcl index 1f3c669..471deff 100644 --- a/library/clock.tcl +++ b/library/clock.tcl @@ -519,7 +519,7 @@ proc ::tcl::clock::Initialize {} { # Return the merged translation catalog for the ::tcl::clock namespace # Searching of catalog is similar to "msgcat::mc". # -# Contrary to "msgcat::mc" may additionally load a package catalog +# Contrary to "msgcat::mc" may additionally load a package catalog # on demand. # # Arguments: @@ -826,7 +826,7 @@ proc ::tcl::clock::LoadWindowsDateTimeFormats { locale } { proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { variable LocaleFormats - + if { $fmtkey eq {} } { set fmtkey FMT_$format } if { [catch { set locfmt [dict get $LocaleFormats $locale $fmtkey] @@ -836,10 +836,10 @@ proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { if { [catch { set mlst [dict get $LocaleFormats $locale MLST] }] } { - + # message catalog dictionary: set mcd [mcget $locale] - + # Handle locale-dependent format groups by mapping them out of the format # string. Note that the order of the [string map] operations is # significant because later formats can refer to later ones; for example @@ -864,7 +864,7 @@ proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { dict set LocaleFormats $locale MLST $mlst } - # translate copy of format (don't use format object here, because otherwise + # translate copy of format (don't use format object here, because otherwise # it can lose its internal representation (string map - convert to unicode) set locfmt [string map $mlst [string range " $format" 1 end]] @@ -872,10 +872,10 @@ proc ::tcl::clock::LocalizeFormat { locale format {fmtkey {}} } { dict set LocaleFormats $locale $fmtkey $locfmt } - # Save original format as long as possible, because of internal + # Save original format as long as possible, because of internal # representation (performance). # Note that in this case such format will be never localized (also - # using another locales). To prevent this return a duplicate (but + # using another locales). To prevent this return a duplicate (but # it may be slower). if {$locfmt eq $format} { set locfmt $format @@ -934,7 +934,7 @@ proc ::tcl::clock::GetSystemTimeZone {} { if { [dict exists $TimeZoneBad $timezone] } { set timezone :localtime } - + # tell backend - current system timezone: configure -system-tz $timezone diff --git a/library/init.tcl b/library/init.tcl index de69730..e500e3d 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -157,7 +157,7 @@ if {[interp issafe]} { package unknown {::tcl::tm::UnknownHandler ::tclPkgUnknown} } else { # Default known auto_index (avoid loading auto index implicit after interp create): - + array set ::auto_index { ::tcl::tm::UnknownHandler {source [info library]/tm.tcl} ::tclPkgUnknown {source [info library]/package.tcl} @@ -431,7 +431,7 @@ proc auto_load {cmd {namespace {}}} { # workaround non canonical auto_index entries that might be around # from older auto_mkindex versions if {$cmd ni $nameList} {lappend nameList $cmd} - + # try to load (and create sub-cmd handler "_sub_load_cmd" for further usage): foreach name $nameList [set _sub_load_cmd { # via auto_index: @@ -461,7 +461,7 @@ proc auto_load {cmd {namespace {}}} { } } }] - + # load auto_index if possible: if {![info exists auto_path]} { return 0 diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 375e366..2a30386 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -248,7 +248,7 @@ TclpWideClicksToNanoseconds( * * TclpWideClickInMicrosec -- * - * This procedure return scale to convert click values from the + * This procedure return scale to convert click values from the * TclpGetWideClicks native resolution to microsecond resolution * and back. * diff --git a/win/tclWinTime.c b/win/tclWinTime.c index e1aff48..db05cad 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -252,7 +252,7 @@ TclpGetWideClicks(void) /* * The frequency of the performance counter is fixed at system boot and - * is consistent across all processors. Therefore, the frequency need + * is consistent across all processors. Therefore, the frequency need * only be queried upon application initialization. */ if (QueryPerformanceFrequency(&perfCounterFreq)) { @@ -263,7 +263,7 @@ TclpGetWideClicks(void) wideClick.perfCounter = 0; wideClick.microsecsScale = 1; } - + wideClick.initialized = 1; } if (wideClick.perfCounter) { @@ -284,7 +284,7 @@ TclpGetWideClicks(void) * * TclpWideClickInMicrosec -- * - * This procedure return scale to convert wide click values from the + * This procedure return scale to convert wide click values from the * TclpGetWideClicks native resolution to microsecond resolution * and back. * @@ -323,7 +323,7 @@ TclpWideClickInMicrosec(void) *---------------------------------------------------------------------- */ -Tcl_WideInt +Tcl_WideInt TclpGetMicroseconds(void) { Tcl_WideInt usecSincePosixEpoch; -- cgit v0.12 From fcd399d49aee6b08b44aa50882a78c8d104c5e59 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 31 May 2017 12:05:45 +0000 Subject: Fix [67aa9a207037ae67f9014b544c3db34fa732f2dc|67aa9a2070]: Security: Invalid UTF-8 can inject unexpected characters --- generic/tclUtf.c | 12 +++++++++--- tests/encoding.test | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 68119a4..fe47f0b 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -298,7 +298,9 @@ Tcl_UtfToUniChar( */ *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) | (src[1] & 0x3F)); - return 2; + if ((*chPtr == 0) || (*chPtr > 0x7f)) { + return 2; + } } /* @@ -313,7 +315,9 @@ Tcl_UtfToUniChar( *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12) | ((src[1] & 0x3F) << 6) | (src[2] & 0x3F)); - return 3; + if (*chPtr > 0x7ff) { + return 3; + } } /* @@ -330,7 +334,9 @@ Tcl_UtfToUniChar( *chPtr = (Tcl_UniChar) (((byte & 0x0E) << 18) | ((src[1] & 0x3F) << 12) | ((src[2] & 0x3F) << 6) | (src[3] & 0x3F)); - return 4; + if ((*chPtr <= 0x10ffff) && (*chPtr > 0xffff)) { + return 4; + } } /* diff --git a/tests/encoding.test b/tests/encoding.test index 0374e2d..1d8bae5 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -448,6 +448,31 @@ test encoding-24.3 {EscapeFreeProc on open channels} {stdio} { list $count [viewable $line] } [list 3 "\u4e4e\u4e5e\u4e5f (\\u4e4e\\u4e5e\\u4e5f)"] +test encoding-24.4 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc0\x80"] +} 1 +test encoding-24.5 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc0\x81"] +} 2 +test encoding-24.6 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc1\xbf"] +} 2 +test encoding-24.7 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc2\x80"] +} 1 +test encoding-24.8 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xe0\x80\x80"] +} 3 +test encoding-24.9 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xe0\x9f\xbf"] +} 3 +test encoding-24.10 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xe0\xa0\x80"] +} 1 +test encoding-24.10 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xef\xbf\xbf"] +} 1 + file delete [file join [temporaryDirectory] iso2022.txt] # -- cgit v0.12 From 3f0e8d6265db0d5853ab55de2ead9a045c678b6e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 31 May 2017 13:03:54 +0000 Subject: Fix [83a3d869722fab9caaae3b6728215fb2507a6f0d|83a3d86972]: tclEpollNotfy.c fails to compile on Linux 2.6.<22 due to unconditionally including Also re-generate regc_locale.c with Unicode 10 tables: previous generation went horribly wrong somehow... --- generic/regc_locale.c | 5889 ++----------------------------------------------- unix/tclEpollNotfy.c | 2 + 2 files changed, 158 insertions(+), 5733 deletions(-) diff --git a/generic/regc_locale.c b/generic/regc_locale.c index f0e8439..d781212 100644 --- a/generic/regc_locale.c +++ b/generic/regc_locale.c @@ -193,1053 +193,55 @@ static const crange alphaRangeTable[] = { {0xaab9, 0xaabd}, {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4}, {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab65}, {0xab70, 0xabe2}, - {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xf900, 0xfa6d}, + {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xdc00, 0xdc3e}, + {0xdc40, 0xdc7e}, {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, {0xdd00, 0xdd3e}, + {0xdd40, 0xdd7e}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe}, {0xde00, 0xde3e}, + {0xde40, 0xde7e}, {0xde80, 0xdebe}, {0xdec0, 0xdefe}, {0xdf00, 0xdf3e}, + {0xdf40, 0xdf7e}, {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, {0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc} #if TCL_UTF_MAX > 4 - ,{0x10041, 0x1005a}, {0x10061, 0x1007a}, {0x100c0, 0x100d6}, {0x100d8, 0x100f6}, - {0x100f8, 0x102c1}, {0x102c6, 0x102d1}, {0x102e0, 0x102e4}, {0x10370, 0x10374}, - {0x1037a, 0x1037d}, {0x10388, 0x1038a}, {0x1038e, 0x103a1}, {0x103a3, 0x103f5}, - {0x103f7, 0x10481}, {0x1048a, 0x1052f}, {0x10531, 0x10556}, {0x10561, 0x10587}, - {0x105d0, 0x105ea}, {0x105f0, 0x105f2}, {0x10620, 0x1064a}, {0x10671, 0x106d3}, - {0x106fa, 0x106fc}, {0x10712, 0x1072f}, {0x1074d, 0x107a5}, {0x107ca, 0x107ea}, - {0x10800, 0x10815}, {0x10840, 0x10858}, {0x10860, 0x1086a}, {0x108a0, 0x108b4}, - {0x108b6, 0x108bd}, {0x10904, 0x10939}, {0x10958, 0x10961}, {0x10971, 0x10980}, - {0x10985, 0x1098c}, {0x10993, 0x109a8}, {0x109aa, 0x109b0}, {0x109b6, 0x109b9}, - {0x109df, 0x109e1}, {0x10a05, 0x10a0a}, {0x10a13, 0x10a28}, {0x10a2a, 0x10a30}, - {0x10a59, 0x10a5c}, {0x10a72, 0x10a74}, {0x10a85, 0x10a8d}, {0x10a8f, 0x10a91}, - {0x10a93, 0x10aa8}, {0x10aaa, 0x10ab0}, {0x10ab5, 0x10ab9}, {0x10b05, 0x10b0c}, - {0x10b13, 0x10b28}, {0x10b2a, 0x10b30}, {0x10b35, 0x10b39}, {0x10b5f, 0x10b61}, - {0x10b85, 0x10b8a}, {0x10b8e, 0x10b90}, {0x10b92, 0x10b95}, {0x10ba8, 0x10baa}, - {0x10bae, 0x10bb9}, {0x10c05, 0x10c0c}, {0x10c0e, 0x10c10}, {0x10c12, 0x10c28}, - {0x10c2a, 0x10c39}, {0x10c58, 0x10c5a}, {0x10c85, 0x10c8c}, {0x10c8e, 0x10c90}, - {0x10c92, 0x10ca8}, {0x10caa, 0x10cb3}, {0x10cb5, 0x10cb9}, {0x10d05, 0x10d0c}, - {0x10d0e, 0x10d10}, {0x10d12, 0x10d3a}, {0x10d54, 0x10d56}, {0x10d5f, 0x10d61}, - {0x10d7a, 0x10d7f}, {0x10d85, 0x10d96}, {0x10d9a, 0x10db1}, {0x10db3, 0x10dbb}, - {0x10dc0, 0x10dc6}, {0x10e01, 0x10e30}, {0x10e40, 0x10e46}, {0x10e94, 0x10e97}, - {0x10e99, 0x10e9f}, {0x10ea1, 0x10ea3}, {0x10ead, 0x10eb0}, {0x10ec0, 0x10ec4}, - {0x10edc, 0x10edf}, {0x10f40, 0x10f47}, {0x10f49, 0x10f6c}, {0x10f88, 0x10f8c}, - {0x11000, 0x1102a}, {0x11050, 0x11055}, {0x1105a, 0x1105d}, {0x1106e, 0x11070}, - {0x11075, 0x11081}, {0x110a0, 0x110c5}, {0x110d0, 0x110fa}, {0x110fc, 0x11248}, - {0x1124a, 0x1124d}, {0x11250, 0x11256}, {0x1125a, 0x1125d}, {0x11260, 0x11288}, - {0x1128a, 0x1128d}, {0x11290, 0x112b0}, {0x112b2, 0x112b5}, {0x112b8, 0x112be}, - {0x112c2, 0x112c5}, {0x112c8, 0x112d6}, {0x112d8, 0x11310}, {0x11312, 0x11315}, - {0x11318, 0x1135a}, {0x11380, 0x1138f}, {0x113a0, 0x113f5}, {0x113f8, 0x113fd}, - {0x11401, 0x1166c}, {0x1166f, 0x1167f}, {0x11681, 0x1169a}, {0x116a0, 0x116ea}, - {0x116f1, 0x116f8}, {0x11700, 0x1170c}, {0x1170e, 0x11711}, {0x11720, 0x11731}, - {0x11740, 0x11751}, {0x11760, 0x1176c}, {0x1176e, 0x11770}, {0x11780, 0x117b3}, - {0x11820, 0x11877}, {0x11880, 0x11884}, {0x11887, 0x118a8}, {0x118b0, 0x118f5}, - {0x11900, 0x1191e}, {0x11950, 0x1196d}, {0x11970, 0x11974}, {0x11980, 0x119ab}, - {0x119b0, 0x119c9}, {0x11a00, 0x11a16}, {0x11a20, 0x11a54}, {0x11b05, 0x11b33}, - {0x11b45, 0x11b4b}, {0x11b83, 0x11ba0}, {0x11bba, 0x11be5}, {0x11c00, 0x11c23}, - {0x11c4d, 0x11c4f}, {0x11c5a, 0x11c7d}, {0x11c80, 0x11c88}, {0x11ce9, 0x11cec}, - {0x11cee, 0x11cf1}, {0x11d00, 0x11dbf}, {0x11e00, 0x11f15}, {0x11f18, 0x11f1d}, - {0x11f20, 0x11f45}, {0x11f48, 0x11f4d}, {0x11f50, 0x11f57}, {0x11f5f, 0x11f7d}, - {0x11f80, 0x11fb4}, {0x11fb6, 0x11fbc}, {0x11fc2, 0x11fc4}, {0x11fc6, 0x11fcc}, - {0x11fd0, 0x11fd3}, {0x11fd6, 0x11fdb}, {0x11fe0, 0x11fec}, {0x11ff2, 0x11ff4}, - {0x11ff6, 0x11ffc}, {0x12090, 0x1209c}, {0x1210a, 0x12113}, {0x12119, 0x1211d}, - {0x1212a, 0x1212d}, {0x1212f, 0x12139}, {0x1213c, 0x1213f}, {0x12145, 0x12149}, - {0x12c00, 0x12c2e}, {0x12c30, 0x12c5e}, {0x12c60, 0x12ce4}, {0x12ceb, 0x12cee}, - {0x12d00, 0x12d25}, {0x12d30, 0x12d67}, {0x12d80, 0x12d96}, {0x12da0, 0x12da6}, - {0x12da8, 0x12dae}, {0x12db0, 0x12db6}, {0x12db8, 0x12dbe}, {0x12dc0, 0x12dc6}, - {0x12dc8, 0x12dce}, {0x12dd0, 0x12dd6}, {0x12dd8, 0x12dde}, {0x13031, 0x13035}, - {0x13041, 0x13096}, {0x1309d, 0x1309f}, {0x130a1, 0x130fa}, {0x130fc, 0x130ff}, - {0x13105, 0x1312e}, {0x13131, 0x1318e}, {0x131a0, 0x131ba}, {0x131f0, 0x131ff}, - {0x13400, 0x14db5}, {0x14e00, 0x19fea}, {0x1a000, 0x1a48c}, {0x1a4d0, 0x1a4fd}, - {0x1a500, 0x1a60c}, {0x1a610, 0x1a61f}, {0x1a640, 0x1a66e}, {0x1a67f, 0x1a69d}, - {0x1a6a0, 0x1a6e5}, {0x1a717, 0x1a71f}, {0x1a722, 0x1a788}, {0x1a78b, 0x1a7ae}, - {0x1a7b0, 0x1a7b7}, {0x1a7f7, 0x1a801}, {0x1a803, 0x1a805}, {0x1a807, 0x1a80a}, - {0x1a80c, 0x1a822}, {0x1a840, 0x1a873}, {0x1a882, 0x1a8b3}, {0x1a8f2, 0x1a8f7}, - {0x1a90a, 0x1a925}, {0x1a930, 0x1a946}, {0x1a960, 0x1a97c}, {0x1a984, 0x1a9b2}, - {0x1a9e0, 0x1a9e4}, {0x1a9e6, 0x1a9ef}, {0x1a9fa, 0x1a9fe}, {0x1aa00, 0x1aa28}, - {0x1aa40, 0x1aa42}, {0x1aa44, 0x1aa4b}, {0x1aa60, 0x1aa76}, {0x1aa7e, 0x1aaaf}, - {0x1aab9, 0x1aabd}, {0x1aadb, 0x1aadd}, {0x1aae0, 0x1aaea}, {0x1aaf2, 0x1aaf4}, - {0x1ab01, 0x1ab06}, {0x1ab09, 0x1ab0e}, {0x1ab11, 0x1ab16}, {0x1ab20, 0x1ab26}, - {0x1ab28, 0x1ab2e}, {0x1ab30, 0x1ab5a}, {0x1ab5c, 0x1ab65}, {0x1ab70, 0x1abe2}, - {0x1ac00, 0x1d7a3}, {0x1d7b0, 0x1d7c6}, {0x1d7cb, 0x1d7fb}, {0x1f900, 0x1fa6d}, - {0x1fa70, 0x1fad9}, {0x1fb00, 0x1fb06}, {0x1fb13, 0x1fb17}, {0x1fb1f, 0x1fb28}, - {0x1fb2a, 0x1fb36}, {0x1fb38, 0x1fb3c}, {0x1fb46, 0x1fbb1}, {0x1fbd3, 0x1fd3d}, - {0x1fd50, 0x1fd8f}, {0x1fd92, 0x1fdc7}, {0x1fdf0, 0x1fdfb}, {0x1fe70, 0x1fe74}, - {0x1fe76, 0x1fefc}, {0x1ff21, 0x1ff3a}, {0x1ff41, 0x1ff5a}, {0x1ff66, 0x1ffbe}, - {0x1ffc2, 0x1ffc7}, {0x1ffca, 0x1ffcf}, {0x1ffd2, 0x1ffd7}, {0x1ffda, 0x1ffdc}, - {0x20041, 0x2005a}, {0x20061, 0x2007a}, {0x200c0, 0x200d6}, {0x200d8, 0x200f6}, - {0x200f8, 0x202c1}, {0x202c6, 0x202d1}, {0x202e0, 0x202e4}, {0x20370, 0x20374}, - {0x2037a, 0x2037d}, {0x20388, 0x2038a}, {0x2038e, 0x203a1}, {0x203a3, 0x203f5}, - {0x203f7, 0x20481}, {0x2048a, 0x2052f}, {0x20531, 0x20556}, {0x20561, 0x20587}, - {0x205d0, 0x205ea}, {0x205f0, 0x205f2}, {0x20620, 0x2064a}, {0x20671, 0x206d3}, - {0x206fa, 0x206fc}, {0x20712, 0x2072f}, {0x2074d, 0x207a5}, {0x207ca, 0x207ea}, - {0x20800, 0x20815}, {0x20840, 0x20858}, {0x20860, 0x2086a}, {0x208a0, 0x208b4}, - {0x208b6, 0x208bd}, {0x20904, 0x20939}, {0x20958, 0x20961}, {0x20971, 0x20980}, - {0x20985, 0x2098c}, {0x20993, 0x209a8}, {0x209aa, 0x209b0}, {0x209b6, 0x209b9}, - {0x209df, 0x209e1}, {0x20a05, 0x20a0a}, {0x20a13, 0x20a28}, {0x20a2a, 0x20a30}, - {0x20a59, 0x20a5c}, {0x20a72, 0x20a74}, {0x20a85, 0x20a8d}, {0x20a8f, 0x20a91}, - {0x20a93, 0x20aa8}, {0x20aaa, 0x20ab0}, {0x20ab5, 0x20ab9}, {0x20b05, 0x20b0c}, - {0x20b13, 0x20b28}, {0x20b2a, 0x20b30}, {0x20b35, 0x20b39}, {0x20b5f, 0x20b61}, - {0x20b85, 0x20b8a}, {0x20b8e, 0x20b90}, {0x20b92, 0x20b95}, {0x20ba8, 0x20baa}, - {0x20bae, 0x20bb9}, {0x20c05, 0x20c0c}, {0x20c0e, 0x20c10}, {0x20c12, 0x20c28}, - {0x20c2a, 0x20c39}, {0x20c58, 0x20c5a}, {0x20c85, 0x20c8c}, {0x20c8e, 0x20c90}, - {0x20c92, 0x20ca8}, {0x20caa, 0x20cb3}, {0x20cb5, 0x20cb9}, {0x20d05, 0x20d0c}, - {0x20d0e, 0x20d10}, {0x20d12, 0x20d3a}, {0x20d54, 0x20d56}, {0x20d5f, 0x20d61}, - {0x20d7a, 0x20d7f}, {0x20d85, 0x20d96}, {0x20d9a, 0x20db1}, {0x20db3, 0x20dbb}, - {0x20dc0, 0x20dc6}, {0x20e01, 0x20e30}, {0x20e40, 0x20e46}, {0x20e94, 0x20e97}, - {0x20e99, 0x20e9f}, {0x20ea1, 0x20ea3}, {0x20ead, 0x20eb0}, {0x20ec0, 0x20ec4}, - {0x20edc, 0x20edf}, {0x20f40, 0x20f47}, {0x20f49, 0x20f6c}, {0x20f88, 0x20f8c}, - {0x21000, 0x2102a}, {0x21050, 0x21055}, {0x2105a, 0x2105d}, {0x2106e, 0x21070}, - {0x21075, 0x21081}, {0x210a0, 0x210c5}, {0x210d0, 0x210fa}, {0x210fc, 0x21248}, - {0x2124a, 0x2124d}, {0x21250, 0x21256}, {0x2125a, 0x2125d}, {0x21260, 0x21288}, - {0x2128a, 0x2128d}, {0x21290, 0x212b0}, {0x212b2, 0x212b5}, {0x212b8, 0x212be}, - {0x212c2, 0x212c5}, {0x212c8, 0x212d6}, {0x212d8, 0x21310}, {0x21312, 0x21315}, - {0x21318, 0x2135a}, {0x21380, 0x2138f}, {0x213a0, 0x213f5}, {0x213f8, 0x213fd}, - {0x21401, 0x2166c}, {0x2166f, 0x2167f}, {0x21681, 0x2169a}, {0x216a0, 0x216ea}, - {0x216f1, 0x216f8}, {0x21700, 0x2170c}, {0x2170e, 0x21711}, {0x21720, 0x21731}, - {0x21740, 0x21751}, {0x21760, 0x2176c}, {0x2176e, 0x21770}, {0x21780, 0x217b3}, - {0x21820, 0x21877}, {0x21880, 0x21884}, {0x21887, 0x218a8}, {0x218b0, 0x218f5}, - {0x21900, 0x2191e}, {0x21950, 0x2196d}, {0x21970, 0x21974}, {0x21980, 0x219ab}, - {0x219b0, 0x219c9}, {0x21a00, 0x21a16}, {0x21a20, 0x21a54}, {0x21b05, 0x21b33}, - {0x21b45, 0x21b4b}, {0x21b83, 0x21ba0}, {0x21bba, 0x21be5}, {0x21c00, 0x21c23}, - {0x21c4d, 0x21c4f}, {0x21c5a, 0x21c7d}, {0x21c80, 0x21c88}, {0x21ce9, 0x21cec}, - {0x21cee, 0x21cf1}, {0x21d00, 0x21dbf}, {0x21e00, 0x21f15}, {0x21f18, 0x21f1d}, - {0x21f20, 0x21f45}, {0x21f48, 0x21f4d}, {0x21f50, 0x21f57}, {0x21f5f, 0x21f7d}, - {0x21f80, 0x21fb4}, {0x21fb6, 0x21fbc}, {0x21fc2, 0x21fc4}, {0x21fc6, 0x21fcc}, - {0x21fd0, 0x21fd3}, {0x21fd6, 0x21fdb}, {0x21fe0, 0x21fec}, {0x21ff2, 0x21ff4}, - {0x21ff6, 0x21ffc}, {0x22090, 0x2209c}, {0x2210a, 0x22113}, {0x22119, 0x2211d}, - {0x2212a, 0x2212d}, {0x2212f, 0x22139}, {0x2213c, 0x2213f}, {0x22145, 0x22149}, - {0x22c00, 0x22c2e}, {0x22c30, 0x22c5e}, {0x22c60, 0x22ce4}, {0x22ceb, 0x22cee}, - {0x22d00, 0x22d25}, {0x22d30, 0x22d67}, {0x22d80, 0x22d96}, {0x22da0, 0x22da6}, - {0x22da8, 0x22dae}, {0x22db0, 0x22db6}, {0x22db8, 0x22dbe}, {0x22dc0, 0x22dc6}, - {0x22dc8, 0x22dce}, {0x22dd0, 0x22dd6}, {0x22dd8, 0x22dde}, {0x23031, 0x23035}, - {0x23041, 0x23096}, {0x2309d, 0x2309f}, {0x230a1, 0x230fa}, {0x230fc, 0x230ff}, - {0x23105, 0x2312e}, {0x23131, 0x2318e}, {0x231a0, 0x231ba}, {0x231f0, 0x231ff}, - {0x23400, 0x24db5}, {0x24e00, 0x29fea}, {0x2a000, 0x2a48c}, {0x2a4d0, 0x2a4fd}, - {0x2a500, 0x2a60c}, {0x2a610, 0x2a61f}, {0x2a640, 0x2a66e}, {0x2a67f, 0x2a69d}, - {0x2a6a0, 0x2a6e5}, {0x2a717, 0x2a71f}, {0x2a722, 0x2a788}, {0x2a78b, 0x2a7ae}, - {0x2a7b0, 0x2a7b7}, {0x2a7f7, 0x2a801}, {0x2a803, 0x2a805}, {0x2a807, 0x2a80a}, - {0x2a80c, 0x2a822}, {0x2a840, 0x2a873}, {0x2a882, 0x2a8b3}, {0x2a8f2, 0x2a8f7}, - {0x2a90a, 0x2a925}, {0x2a930, 0x2a946}, {0x2a960, 0x2a97c}, {0x2a984, 0x2a9b2}, - {0x2a9e0, 0x2a9e4}, {0x2a9e6, 0x2a9ef}, {0x2a9fa, 0x2a9fe}, {0x2aa00, 0x2aa28}, - {0x2aa40, 0x2aa42}, {0x2aa44, 0x2aa4b}, {0x2aa60, 0x2aa76}, {0x2aa7e, 0x2aaaf}, - {0x2aab9, 0x2aabd}, {0x2aadb, 0x2aadd}, {0x2aae0, 0x2aaea}, {0x2aaf2, 0x2aaf4}, - {0x2ab01, 0x2ab06}, {0x2ab09, 0x2ab0e}, {0x2ab11, 0x2ab16}, {0x2ab20, 0x2ab26}, - {0x2ab28, 0x2ab2e}, {0x2ab30, 0x2ab5a}, {0x2ab5c, 0x2ab65}, {0x2ab70, 0x2abe2}, - {0x2ac00, 0x2d7a3}, {0x2d7b0, 0x2d7c6}, {0x2d7cb, 0x2d7fb}, {0x2f900, 0x2fa6d}, - {0x2fa70, 0x2fad9}, {0x2fb00, 0x2fb06}, {0x2fb13, 0x2fb17}, {0x2fb1f, 0x2fb28}, - {0x2fb2a, 0x2fb36}, {0x2fb38, 0x2fb3c}, {0x2fb46, 0x2fbb1}, {0x2fbd3, 0x2fd3d}, - {0x2fd50, 0x2fd8f}, {0x2fd92, 0x2fdc7}, {0x2fdf0, 0x2fdfb}, {0x2fe70, 0x2fe74}, - {0x2fe76, 0x2fefc}, {0x2ff21, 0x2ff3a}, {0x2ff41, 0x2ff5a}, {0x2ff66, 0x2ffbe}, - {0x2ffc2, 0x2ffc7}, {0x2ffca, 0x2ffcf}, {0x2ffd2, 0x2ffd7}, {0x2ffda, 0x2ffdc}, - {0x30041, 0x3005a}, {0x30061, 0x3007a}, {0x300c0, 0x300d6}, {0x300d8, 0x300f6}, - {0x300f8, 0x302c1}, {0x302c6, 0x302d1}, {0x302e0, 0x302e4}, {0x30370, 0x30374}, - {0x3037a, 0x3037d}, {0x30388, 0x3038a}, {0x3038e, 0x303a1}, {0x303a3, 0x303f5}, - {0x303f7, 0x30481}, {0x3048a, 0x3052f}, {0x30531, 0x30556}, {0x30561, 0x30587}, - {0x305d0, 0x305ea}, {0x305f0, 0x305f2}, {0x30620, 0x3064a}, {0x30671, 0x306d3}, - {0x306fa, 0x306fc}, {0x30712, 0x3072f}, {0x3074d, 0x307a5}, {0x307ca, 0x307ea}, - {0x30800, 0x30815}, {0x30840, 0x30858}, {0x30860, 0x3086a}, {0x308a0, 0x308b4}, - {0x308b6, 0x308bd}, {0x30904, 0x30939}, {0x30958, 0x30961}, {0x30971, 0x30980}, - {0x30985, 0x3098c}, {0x30993, 0x309a8}, {0x309aa, 0x309b0}, {0x309b6, 0x309b9}, - {0x309df, 0x309e1}, {0x30a05, 0x30a0a}, {0x30a13, 0x30a28}, {0x30a2a, 0x30a30}, - {0x30a59, 0x30a5c}, {0x30a72, 0x30a74}, {0x30a85, 0x30a8d}, {0x30a8f, 0x30a91}, - {0x30a93, 0x30aa8}, {0x30aaa, 0x30ab0}, {0x30ab5, 0x30ab9}, {0x30b05, 0x30b0c}, - {0x30b13, 0x30b28}, {0x30b2a, 0x30b30}, {0x30b35, 0x30b39}, {0x30b5f, 0x30b61}, - {0x30b85, 0x30b8a}, {0x30b8e, 0x30b90}, {0x30b92, 0x30b95}, {0x30ba8, 0x30baa}, - {0x30bae, 0x30bb9}, {0x30c05, 0x30c0c}, {0x30c0e, 0x30c10}, {0x30c12, 0x30c28}, - {0x30c2a, 0x30c39}, {0x30c58, 0x30c5a}, {0x30c85, 0x30c8c}, {0x30c8e, 0x30c90}, - {0x30c92, 0x30ca8}, {0x30caa, 0x30cb3}, {0x30cb5, 0x30cb9}, {0x30d05, 0x30d0c}, - {0x30d0e, 0x30d10}, {0x30d12, 0x30d3a}, {0x30d54, 0x30d56}, {0x30d5f, 0x30d61}, - {0x30d7a, 0x30d7f}, {0x30d85, 0x30d96}, {0x30d9a, 0x30db1}, {0x30db3, 0x30dbb}, - {0x30dc0, 0x30dc6}, {0x30e01, 0x30e30}, {0x30e40, 0x30e46}, {0x30e94, 0x30e97}, - {0x30e99, 0x30e9f}, {0x30ea1, 0x30ea3}, {0x30ead, 0x30eb0}, {0x30ec0, 0x30ec4}, - {0x30edc, 0x30edf}, {0x30f40, 0x30f47}, {0x30f49, 0x30f6c}, {0x30f88, 0x30f8c}, - {0x31000, 0x3102a}, {0x31050, 0x31055}, {0x3105a, 0x3105d}, {0x3106e, 0x31070}, - {0x31075, 0x31081}, {0x310a0, 0x310c5}, {0x310d0, 0x310fa}, {0x310fc, 0x31248}, - {0x3124a, 0x3124d}, {0x31250, 0x31256}, {0x3125a, 0x3125d}, {0x31260, 0x31288}, - {0x3128a, 0x3128d}, {0x31290, 0x312b0}, {0x312b2, 0x312b5}, {0x312b8, 0x312be}, - {0x312c2, 0x312c5}, {0x312c8, 0x312d6}, {0x312d8, 0x31310}, {0x31312, 0x31315}, - {0x31318, 0x3135a}, {0x31380, 0x3138f}, {0x313a0, 0x313f5}, {0x313f8, 0x313fd}, - {0x31401, 0x3166c}, {0x3166f, 0x3167f}, {0x31681, 0x3169a}, {0x316a0, 0x316ea}, - {0x316f1, 0x316f8}, {0x31700, 0x3170c}, {0x3170e, 0x31711}, {0x31720, 0x31731}, - {0x31740, 0x31751}, {0x31760, 0x3176c}, {0x3176e, 0x31770}, {0x31780, 0x317b3}, - {0x31820, 0x31877}, {0x31880, 0x31884}, {0x31887, 0x318a8}, {0x318b0, 0x318f5}, - {0x31900, 0x3191e}, {0x31950, 0x3196d}, {0x31970, 0x31974}, {0x31980, 0x319ab}, - {0x319b0, 0x319c9}, {0x31a00, 0x31a16}, {0x31a20, 0x31a54}, {0x31b05, 0x31b33}, - {0x31b45, 0x31b4b}, {0x31b83, 0x31ba0}, {0x31bba, 0x31be5}, {0x31c00, 0x31c23}, - {0x31c4d, 0x31c4f}, {0x31c5a, 0x31c7d}, {0x31c80, 0x31c88}, {0x31ce9, 0x31cec}, - {0x31cee, 0x31cf1}, {0x31d00, 0x31dbf}, {0x31e00, 0x31f15}, {0x31f18, 0x31f1d}, - {0x31f20, 0x31f45}, {0x31f48, 0x31f4d}, {0x31f50, 0x31f57}, {0x31f5f, 0x31f7d}, - {0x31f80, 0x31fb4}, {0x31fb6, 0x31fbc}, {0x31fc2, 0x31fc4}, {0x31fc6, 0x31fcc}, - {0x31fd0, 0x31fd3}, {0x31fd6, 0x31fdb}, {0x31fe0, 0x31fec}, {0x31ff2, 0x31ff4}, - {0x31ff6, 0x31ffc}, {0x32090, 0x3209c}, {0x3210a, 0x32113}, {0x32119, 0x3211d}, - {0x3212a, 0x3212d}, {0x3212f, 0x32139}, {0x3213c, 0x3213f}, {0x32145, 0x32149}, - {0x32c00, 0x32c2e}, {0x32c30, 0x32c5e}, {0x32c60, 0x32ce4}, {0x32ceb, 0x32cee}, - {0x32d00, 0x32d25}, {0x32d30, 0x32d67}, {0x32d80, 0x32d96}, {0x32da0, 0x32da6}, - {0x32da8, 0x32dae}, {0x32db0, 0x32db6}, {0x32db8, 0x32dbe}, {0x32dc0, 0x32dc6}, - {0x32dc8, 0x32dce}, {0x32dd0, 0x32dd6}, {0x32dd8, 0x32dde}, {0x33031, 0x33035}, - {0x33041, 0x33096}, {0x3309d, 0x3309f}, {0x330a1, 0x330fa}, {0x330fc, 0x330ff}, - {0x33105, 0x3312e}, {0x33131, 0x3318e}, {0x331a0, 0x331ba}, {0x331f0, 0x331ff}, - {0x33400, 0x34db5}, {0x34e00, 0x39fea}, {0x3a000, 0x3a48c}, {0x3a4d0, 0x3a4fd}, - {0x3a500, 0x3a60c}, {0x3a610, 0x3a61f}, {0x3a640, 0x3a66e}, {0x3a67f, 0x3a69d}, - {0x3a6a0, 0x3a6e5}, {0x3a717, 0x3a71f}, {0x3a722, 0x3a788}, {0x3a78b, 0x3a7ae}, - {0x3a7b0, 0x3a7b7}, {0x3a7f7, 0x3a801}, {0x3a803, 0x3a805}, {0x3a807, 0x3a80a}, - {0x3a80c, 0x3a822}, {0x3a840, 0x3a873}, {0x3a882, 0x3a8b3}, {0x3a8f2, 0x3a8f7}, - {0x3a90a, 0x3a925}, {0x3a930, 0x3a946}, {0x3a960, 0x3a97c}, {0x3a984, 0x3a9b2}, - {0x3a9e0, 0x3a9e4}, {0x3a9e6, 0x3a9ef}, {0x3a9fa, 0x3a9fe}, {0x3aa00, 0x3aa28}, - {0x3aa40, 0x3aa42}, {0x3aa44, 0x3aa4b}, {0x3aa60, 0x3aa76}, {0x3aa7e, 0x3aaaf}, - {0x3aab9, 0x3aabd}, {0x3aadb, 0x3aadd}, {0x3aae0, 0x3aaea}, {0x3aaf2, 0x3aaf4}, - {0x3ab01, 0x3ab06}, {0x3ab09, 0x3ab0e}, {0x3ab11, 0x3ab16}, {0x3ab20, 0x3ab26}, - {0x3ab28, 0x3ab2e}, {0x3ab30, 0x3ab5a}, {0x3ab5c, 0x3ab65}, {0x3ab70, 0x3abe2}, - {0x3ac00, 0x3d7a3}, {0x3d7b0, 0x3d7c6}, {0x3d7cb, 0x3d7fb}, {0x3f900, 0x3fa6d}, - {0x3fa70, 0x3fad9}, {0x3fb00, 0x3fb06}, {0x3fb13, 0x3fb17}, {0x3fb1f, 0x3fb28}, - {0x3fb2a, 0x3fb36}, {0x3fb38, 0x3fb3c}, {0x3fb46, 0x3fbb1}, {0x3fbd3, 0x3fd3d}, - {0x3fd50, 0x3fd8f}, {0x3fd92, 0x3fdc7}, {0x3fdf0, 0x3fdfb}, {0x3fe70, 0x3fe74}, - {0x3fe76, 0x3fefc}, {0x3ff21, 0x3ff3a}, {0x3ff41, 0x3ff5a}, {0x3ff66, 0x3ffbe}, - {0x3ffc2, 0x3ffc7}, {0x3ffca, 0x3ffcf}, {0x3ffd2, 0x3ffd7}, {0x3ffda, 0x3ffdc}, - {0x40041, 0x4005a}, {0x40061, 0x4007a}, {0x400c0, 0x400d6}, {0x400d8, 0x400f6}, - {0x400f8, 0x402c1}, {0x402c6, 0x402d1}, {0x402e0, 0x402e4}, {0x40370, 0x40374}, - {0x4037a, 0x4037d}, {0x40388, 0x4038a}, {0x4038e, 0x403a1}, {0x403a3, 0x403f5}, - {0x403f7, 0x40481}, {0x4048a, 0x4052f}, {0x40531, 0x40556}, {0x40561, 0x40587}, - {0x405d0, 0x405ea}, {0x405f0, 0x405f2}, {0x40620, 0x4064a}, {0x40671, 0x406d3}, - {0x406fa, 0x406fc}, {0x40712, 0x4072f}, {0x4074d, 0x407a5}, {0x407ca, 0x407ea}, - {0x40800, 0x40815}, {0x40840, 0x40858}, {0x40860, 0x4086a}, {0x408a0, 0x408b4}, - {0x408b6, 0x408bd}, {0x40904, 0x40939}, {0x40958, 0x40961}, {0x40971, 0x40980}, - {0x40985, 0x4098c}, {0x40993, 0x409a8}, {0x409aa, 0x409b0}, {0x409b6, 0x409b9}, - {0x409df, 0x409e1}, {0x40a05, 0x40a0a}, {0x40a13, 0x40a28}, {0x40a2a, 0x40a30}, - {0x40a59, 0x40a5c}, {0x40a72, 0x40a74}, {0x40a85, 0x40a8d}, {0x40a8f, 0x40a91}, - {0x40a93, 0x40aa8}, {0x40aaa, 0x40ab0}, {0x40ab5, 0x40ab9}, {0x40b05, 0x40b0c}, - {0x40b13, 0x40b28}, {0x40b2a, 0x40b30}, {0x40b35, 0x40b39}, {0x40b5f, 0x40b61}, - {0x40b85, 0x40b8a}, {0x40b8e, 0x40b90}, {0x40b92, 0x40b95}, {0x40ba8, 0x40baa}, - {0x40bae, 0x40bb9}, {0x40c05, 0x40c0c}, {0x40c0e, 0x40c10}, {0x40c12, 0x40c28}, - {0x40c2a, 0x40c39}, {0x40c58, 0x40c5a}, {0x40c85, 0x40c8c}, {0x40c8e, 0x40c90}, - {0x40c92, 0x40ca8}, {0x40caa, 0x40cb3}, {0x40cb5, 0x40cb9}, {0x40d05, 0x40d0c}, - {0x40d0e, 0x40d10}, {0x40d12, 0x40d3a}, {0x40d54, 0x40d56}, {0x40d5f, 0x40d61}, - {0x40d7a, 0x40d7f}, {0x40d85, 0x40d96}, {0x40d9a, 0x40db1}, {0x40db3, 0x40dbb}, - {0x40dc0, 0x40dc6}, {0x40e01, 0x40e30}, {0x40e40, 0x40e46}, {0x40e94, 0x40e97}, - {0x40e99, 0x40e9f}, {0x40ea1, 0x40ea3}, {0x40ead, 0x40eb0}, {0x40ec0, 0x40ec4}, - {0x40edc, 0x40edf}, {0x40f40, 0x40f47}, {0x40f49, 0x40f6c}, {0x40f88, 0x40f8c}, - {0x41000, 0x4102a}, {0x41050, 0x41055}, {0x4105a, 0x4105d}, {0x4106e, 0x41070}, - {0x41075, 0x41081}, {0x410a0, 0x410c5}, {0x410d0, 0x410fa}, {0x410fc, 0x41248}, - {0x4124a, 0x4124d}, {0x41250, 0x41256}, {0x4125a, 0x4125d}, {0x41260, 0x41288}, - {0x4128a, 0x4128d}, {0x41290, 0x412b0}, {0x412b2, 0x412b5}, {0x412b8, 0x412be}, - {0x412c2, 0x412c5}, {0x412c8, 0x412d6}, {0x412d8, 0x41310}, {0x41312, 0x41315}, - {0x41318, 0x4135a}, {0x41380, 0x4138f}, {0x413a0, 0x413f5}, {0x413f8, 0x413fd}, - {0x41401, 0x4166c}, {0x4166f, 0x4167f}, {0x41681, 0x4169a}, {0x416a0, 0x416ea}, - {0x416f1, 0x416f8}, {0x41700, 0x4170c}, {0x4170e, 0x41711}, {0x41720, 0x41731}, - {0x41740, 0x41751}, {0x41760, 0x4176c}, {0x4176e, 0x41770}, {0x41780, 0x417b3}, - {0x41820, 0x41877}, {0x41880, 0x41884}, {0x41887, 0x418a8}, {0x418b0, 0x418f5}, - {0x41900, 0x4191e}, {0x41950, 0x4196d}, {0x41970, 0x41974}, {0x41980, 0x419ab}, - {0x419b0, 0x419c9}, {0x41a00, 0x41a16}, {0x41a20, 0x41a54}, {0x41b05, 0x41b33}, - {0x41b45, 0x41b4b}, {0x41b83, 0x41ba0}, {0x41bba, 0x41be5}, {0x41c00, 0x41c23}, - {0x41c4d, 0x41c4f}, {0x41c5a, 0x41c7d}, {0x41c80, 0x41c88}, {0x41ce9, 0x41cec}, - {0x41cee, 0x41cf1}, {0x41d00, 0x41dbf}, {0x41e00, 0x41f15}, {0x41f18, 0x41f1d}, - {0x41f20, 0x41f45}, {0x41f48, 0x41f4d}, {0x41f50, 0x41f57}, {0x41f5f, 0x41f7d}, - {0x41f80, 0x41fb4}, {0x41fb6, 0x41fbc}, {0x41fc2, 0x41fc4}, {0x41fc6, 0x41fcc}, - {0x41fd0, 0x41fd3}, {0x41fd6, 0x41fdb}, {0x41fe0, 0x41fec}, {0x41ff2, 0x41ff4}, - {0x41ff6, 0x41ffc}, {0x42090, 0x4209c}, {0x4210a, 0x42113}, {0x42119, 0x4211d}, - {0x4212a, 0x4212d}, {0x4212f, 0x42139}, {0x4213c, 0x4213f}, {0x42145, 0x42149}, - {0x42c00, 0x42c2e}, {0x42c30, 0x42c5e}, {0x42c60, 0x42ce4}, {0x42ceb, 0x42cee}, - {0x42d00, 0x42d25}, {0x42d30, 0x42d67}, {0x42d80, 0x42d96}, {0x42da0, 0x42da6}, - {0x42da8, 0x42dae}, {0x42db0, 0x42db6}, {0x42db8, 0x42dbe}, {0x42dc0, 0x42dc6}, - {0x42dc8, 0x42dce}, {0x42dd0, 0x42dd6}, {0x42dd8, 0x42dde}, {0x43031, 0x43035}, - {0x43041, 0x43096}, {0x4309d, 0x4309f}, {0x430a1, 0x430fa}, {0x430fc, 0x430ff}, - {0x43105, 0x4312e}, {0x43131, 0x4318e}, {0x431a0, 0x431ba}, {0x431f0, 0x431ff}, - {0x43400, 0x44db5}, {0x44e00, 0x49fea}, {0x4a000, 0x4a48c}, {0x4a4d0, 0x4a4fd}, - {0x4a500, 0x4a60c}, {0x4a610, 0x4a61f}, {0x4a640, 0x4a66e}, {0x4a67f, 0x4a69d}, - {0x4a6a0, 0x4a6e5}, {0x4a717, 0x4a71f}, {0x4a722, 0x4a788}, {0x4a78b, 0x4a7ae}, - {0x4a7b0, 0x4a7b7}, {0x4a7f7, 0x4a801}, {0x4a803, 0x4a805}, {0x4a807, 0x4a80a}, - {0x4a80c, 0x4a822}, {0x4a840, 0x4a873}, {0x4a882, 0x4a8b3}, {0x4a8f2, 0x4a8f7}, - {0x4a90a, 0x4a925}, {0x4a930, 0x4a946}, {0x4a960, 0x4a97c}, {0x4a984, 0x4a9b2}, - {0x4a9e0, 0x4a9e4}, {0x4a9e6, 0x4a9ef}, {0x4a9fa, 0x4a9fe}, {0x4aa00, 0x4aa28}, - {0x4aa40, 0x4aa42}, {0x4aa44, 0x4aa4b}, {0x4aa60, 0x4aa76}, {0x4aa7e, 0x4aaaf}, - {0x4aab9, 0x4aabd}, {0x4aadb, 0x4aadd}, {0x4aae0, 0x4aaea}, {0x4aaf2, 0x4aaf4}, - {0x4ab01, 0x4ab06}, {0x4ab09, 0x4ab0e}, {0x4ab11, 0x4ab16}, {0x4ab20, 0x4ab26}, - {0x4ab28, 0x4ab2e}, {0x4ab30, 0x4ab5a}, {0x4ab5c, 0x4ab65}, {0x4ab70, 0x4abe2}, - {0x4ac00, 0x4d7a3}, {0x4d7b0, 0x4d7c6}, {0x4d7cb, 0x4d7fb}, {0x4f900, 0x4fa6d}, - {0x4fa70, 0x4fad9}, {0x4fb00, 0x4fb06}, {0x4fb13, 0x4fb17}, {0x4fb1f, 0x4fb28}, - {0x4fb2a, 0x4fb36}, {0x4fb38, 0x4fb3c}, {0x4fb46, 0x4fbb1}, {0x4fbd3, 0x4fd3d}, - {0x4fd50, 0x4fd8f}, {0x4fd92, 0x4fdc7}, {0x4fdf0, 0x4fdfb}, {0x4fe70, 0x4fe74}, - {0x4fe76, 0x4fefc}, {0x4ff21, 0x4ff3a}, {0x4ff41, 0x4ff5a}, {0x4ff66, 0x4ffbe}, - {0x4ffc2, 0x4ffc7}, {0x4ffca, 0x4ffcf}, {0x4ffd2, 0x4ffd7}, {0x4ffda, 0x4ffdc}, - {0x50041, 0x5005a}, {0x50061, 0x5007a}, {0x500c0, 0x500d6}, {0x500d8, 0x500f6}, - {0x500f8, 0x502c1}, {0x502c6, 0x502d1}, {0x502e0, 0x502e4}, {0x50370, 0x50374}, - {0x5037a, 0x5037d}, {0x50388, 0x5038a}, {0x5038e, 0x503a1}, {0x503a3, 0x503f5}, - {0x503f7, 0x50481}, {0x5048a, 0x5052f}, {0x50531, 0x50556}, {0x50561, 0x50587}, - {0x505d0, 0x505ea}, {0x505f0, 0x505f2}, {0x50620, 0x5064a}, {0x50671, 0x506d3}, - {0x506fa, 0x506fc}, {0x50712, 0x5072f}, {0x5074d, 0x507a5}, {0x507ca, 0x507ea}, - {0x50800, 0x50815}, {0x50840, 0x50858}, {0x50860, 0x5086a}, {0x508a0, 0x508b4}, - {0x508b6, 0x508bd}, {0x50904, 0x50939}, {0x50958, 0x50961}, {0x50971, 0x50980}, - {0x50985, 0x5098c}, {0x50993, 0x509a8}, {0x509aa, 0x509b0}, {0x509b6, 0x509b9}, - {0x509df, 0x509e1}, {0x50a05, 0x50a0a}, {0x50a13, 0x50a28}, {0x50a2a, 0x50a30}, - {0x50a59, 0x50a5c}, {0x50a72, 0x50a74}, {0x50a85, 0x50a8d}, {0x50a8f, 0x50a91}, - {0x50a93, 0x50aa8}, {0x50aaa, 0x50ab0}, {0x50ab5, 0x50ab9}, {0x50b05, 0x50b0c}, - {0x50b13, 0x50b28}, {0x50b2a, 0x50b30}, {0x50b35, 0x50b39}, {0x50b5f, 0x50b61}, - {0x50b85, 0x50b8a}, {0x50b8e, 0x50b90}, {0x50b92, 0x50b95}, {0x50ba8, 0x50baa}, - {0x50bae, 0x50bb9}, {0x50c05, 0x50c0c}, {0x50c0e, 0x50c10}, {0x50c12, 0x50c28}, - {0x50c2a, 0x50c39}, {0x50c58, 0x50c5a}, {0x50c85, 0x50c8c}, {0x50c8e, 0x50c90}, - {0x50c92, 0x50ca8}, {0x50caa, 0x50cb3}, {0x50cb5, 0x50cb9}, {0x50d05, 0x50d0c}, - {0x50d0e, 0x50d10}, {0x50d12, 0x50d3a}, {0x50d54, 0x50d56}, {0x50d5f, 0x50d61}, - {0x50d7a, 0x50d7f}, {0x50d85, 0x50d96}, {0x50d9a, 0x50db1}, {0x50db3, 0x50dbb}, - {0x50dc0, 0x50dc6}, {0x50e01, 0x50e30}, {0x50e40, 0x50e46}, {0x50e94, 0x50e97}, - {0x50e99, 0x50e9f}, {0x50ea1, 0x50ea3}, {0x50ead, 0x50eb0}, {0x50ec0, 0x50ec4}, - {0x50edc, 0x50edf}, {0x50f40, 0x50f47}, {0x50f49, 0x50f6c}, {0x50f88, 0x50f8c}, - {0x51000, 0x5102a}, {0x51050, 0x51055}, {0x5105a, 0x5105d}, {0x5106e, 0x51070}, - {0x51075, 0x51081}, {0x510a0, 0x510c5}, {0x510d0, 0x510fa}, {0x510fc, 0x51248}, - {0x5124a, 0x5124d}, {0x51250, 0x51256}, {0x5125a, 0x5125d}, {0x51260, 0x51288}, - {0x5128a, 0x5128d}, {0x51290, 0x512b0}, {0x512b2, 0x512b5}, {0x512b8, 0x512be}, - {0x512c2, 0x512c5}, {0x512c8, 0x512d6}, {0x512d8, 0x51310}, {0x51312, 0x51315}, - {0x51318, 0x5135a}, {0x51380, 0x5138f}, {0x513a0, 0x513f5}, {0x513f8, 0x513fd}, - {0x51401, 0x5166c}, {0x5166f, 0x5167f}, {0x51681, 0x5169a}, {0x516a0, 0x516ea}, - {0x516f1, 0x516f8}, {0x51700, 0x5170c}, {0x5170e, 0x51711}, {0x51720, 0x51731}, - {0x51740, 0x51751}, {0x51760, 0x5176c}, {0x5176e, 0x51770}, {0x51780, 0x517b3}, - {0x51820, 0x51877}, {0x51880, 0x51884}, {0x51887, 0x518a8}, {0x518b0, 0x518f5}, - {0x51900, 0x5191e}, {0x51950, 0x5196d}, {0x51970, 0x51974}, {0x51980, 0x519ab}, - {0x519b0, 0x519c9}, {0x51a00, 0x51a16}, {0x51a20, 0x51a54}, {0x51b05, 0x51b33}, - {0x51b45, 0x51b4b}, {0x51b83, 0x51ba0}, {0x51bba, 0x51be5}, {0x51c00, 0x51c23}, - {0x51c4d, 0x51c4f}, {0x51c5a, 0x51c7d}, {0x51c80, 0x51c88}, {0x51ce9, 0x51cec}, - {0x51cee, 0x51cf1}, {0x51d00, 0x51dbf}, {0x51e00, 0x51f15}, {0x51f18, 0x51f1d}, - {0x51f20, 0x51f45}, {0x51f48, 0x51f4d}, {0x51f50, 0x51f57}, {0x51f5f, 0x51f7d}, - {0x51f80, 0x51fb4}, {0x51fb6, 0x51fbc}, {0x51fc2, 0x51fc4}, {0x51fc6, 0x51fcc}, - {0x51fd0, 0x51fd3}, {0x51fd6, 0x51fdb}, {0x51fe0, 0x51fec}, {0x51ff2, 0x51ff4}, - {0x51ff6, 0x51ffc}, {0x52090, 0x5209c}, {0x5210a, 0x52113}, {0x52119, 0x5211d}, - {0x5212a, 0x5212d}, {0x5212f, 0x52139}, {0x5213c, 0x5213f}, {0x52145, 0x52149}, - {0x52c00, 0x52c2e}, {0x52c30, 0x52c5e}, {0x52c60, 0x52ce4}, {0x52ceb, 0x52cee}, - {0x52d00, 0x52d25}, {0x52d30, 0x52d67}, {0x52d80, 0x52d96}, {0x52da0, 0x52da6}, - {0x52da8, 0x52dae}, {0x52db0, 0x52db6}, {0x52db8, 0x52dbe}, {0x52dc0, 0x52dc6}, - {0x52dc8, 0x52dce}, {0x52dd0, 0x52dd6}, {0x52dd8, 0x52dde}, {0x53031, 0x53035}, - {0x53041, 0x53096}, {0x5309d, 0x5309f}, {0x530a1, 0x530fa}, {0x530fc, 0x530ff}, - {0x53105, 0x5312e}, {0x53131, 0x5318e}, {0x531a0, 0x531ba}, {0x531f0, 0x531ff}, - {0x53400, 0x54db5}, {0x54e00, 0x59fea}, {0x5a000, 0x5a48c}, {0x5a4d0, 0x5a4fd}, - {0x5a500, 0x5a60c}, {0x5a610, 0x5a61f}, {0x5a640, 0x5a66e}, {0x5a67f, 0x5a69d}, - {0x5a6a0, 0x5a6e5}, {0x5a717, 0x5a71f}, {0x5a722, 0x5a788}, {0x5a78b, 0x5a7ae}, - {0x5a7b0, 0x5a7b7}, {0x5a7f7, 0x5a801}, {0x5a803, 0x5a805}, {0x5a807, 0x5a80a}, - {0x5a80c, 0x5a822}, {0x5a840, 0x5a873}, {0x5a882, 0x5a8b3}, {0x5a8f2, 0x5a8f7}, - {0x5a90a, 0x5a925}, {0x5a930, 0x5a946}, {0x5a960, 0x5a97c}, {0x5a984, 0x5a9b2}, - {0x5a9e0, 0x5a9e4}, {0x5a9e6, 0x5a9ef}, {0x5a9fa, 0x5a9fe}, {0x5aa00, 0x5aa28}, - {0x5aa40, 0x5aa42}, {0x5aa44, 0x5aa4b}, {0x5aa60, 0x5aa76}, {0x5aa7e, 0x5aaaf}, - {0x5aab9, 0x5aabd}, {0x5aadb, 0x5aadd}, {0x5aae0, 0x5aaea}, {0x5aaf2, 0x5aaf4}, - {0x5ab01, 0x5ab06}, {0x5ab09, 0x5ab0e}, {0x5ab11, 0x5ab16}, {0x5ab20, 0x5ab26}, - {0x5ab28, 0x5ab2e}, {0x5ab30, 0x5ab5a}, {0x5ab5c, 0x5ab65}, {0x5ab70, 0x5abe2}, - {0x5ac00, 0x5d7a3}, {0x5d7b0, 0x5d7c6}, {0x5d7cb, 0x5d7fb}, {0x5f900, 0x5fa6d}, - {0x5fa70, 0x5fad9}, {0x5fb00, 0x5fb06}, {0x5fb13, 0x5fb17}, {0x5fb1f, 0x5fb28}, - {0x5fb2a, 0x5fb36}, {0x5fb38, 0x5fb3c}, {0x5fb46, 0x5fbb1}, {0x5fbd3, 0x5fd3d}, - {0x5fd50, 0x5fd8f}, {0x5fd92, 0x5fdc7}, {0x5fdf0, 0x5fdfb}, {0x5fe70, 0x5fe74}, - {0x5fe76, 0x5fefc}, {0x5ff21, 0x5ff3a}, {0x5ff41, 0x5ff5a}, {0x5ff66, 0x5ffbe}, - {0x5ffc2, 0x5ffc7}, {0x5ffca, 0x5ffcf}, {0x5ffd2, 0x5ffd7}, {0x5ffda, 0x5ffdc}, - {0x60041, 0x6005a}, {0x60061, 0x6007a}, {0x600c0, 0x600d6}, {0x600d8, 0x600f6}, - {0x600f8, 0x602c1}, {0x602c6, 0x602d1}, {0x602e0, 0x602e4}, {0x60370, 0x60374}, - {0x6037a, 0x6037d}, {0x60388, 0x6038a}, {0x6038e, 0x603a1}, {0x603a3, 0x603f5}, - {0x603f7, 0x60481}, {0x6048a, 0x6052f}, {0x60531, 0x60556}, {0x60561, 0x60587}, - {0x605d0, 0x605ea}, {0x605f0, 0x605f2}, {0x60620, 0x6064a}, {0x60671, 0x606d3}, - {0x606fa, 0x606fc}, {0x60712, 0x6072f}, {0x6074d, 0x607a5}, {0x607ca, 0x607ea}, - {0x60800, 0x60815}, {0x60840, 0x60858}, {0x60860, 0x6086a}, {0x608a0, 0x608b4}, - {0x608b6, 0x608bd}, {0x60904, 0x60939}, {0x60958, 0x60961}, {0x60971, 0x60980}, - {0x60985, 0x6098c}, {0x60993, 0x609a8}, {0x609aa, 0x609b0}, {0x609b6, 0x609b9}, - {0x609df, 0x609e1}, {0x60a05, 0x60a0a}, {0x60a13, 0x60a28}, {0x60a2a, 0x60a30}, - {0x60a59, 0x60a5c}, {0x60a72, 0x60a74}, {0x60a85, 0x60a8d}, {0x60a8f, 0x60a91}, - {0x60a93, 0x60aa8}, {0x60aaa, 0x60ab0}, {0x60ab5, 0x60ab9}, {0x60b05, 0x60b0c}, - {0x60b13, 0x60b28}, {0x60b2a, 0x60b30}, {0x60b35, 0x60b39}, {0x60b5f, 0x60b61}, - {0x60b85, 0x60b8a}, {0x60b8e, 0x60b90}, {0x60b92, 0x60b95}, {0x60ba8, 0x60baa}, - {0x60bae, 0x60bb9}, {0x60c05, 0x60c0c}, {0x60c0e, 0x60c10}, {0x60c12, 0x60c28}, - {0x60c2a, 0x60c39}, {0x60c58, 0x60c5a}, {0x60c85, 0x60c8c}, {0x60c8e, 0x60c90}, - {0x60c92, 0x60ca8}, {0x60caa, 0x60cb3}, {0x60cb5, 0x60cb9}, {0x60d05, 0x60d0c}, - {0x60d0e, 0x60d10}, {0x60d12, 0x60d3a}, {0x60d54, 0x60d56}, {0x60d5f, 0x60d61}, - {0x60d7a, 0x60d7f}, {0x60d85, 0x60d96}, {0x60d9a, 0x60db1}, {0x60db3, 0x60dbb}, - {0x60dc0, 0x60dc6}, {0x60e01, 0x60e30}, {0x60e40, 0x60e46}, {0x60e94, 0x60e97}, - {0x60e99, 0x60e9f}, {0x60ea1, 0x60ea3}, {0x60ead, 0x60eb0}, {0x60ec0, 0x60ec4}, - {0x60edc, 0x60edf}, {0x60f40, 0x60f47}, {0x60f49, 0x60f6c}, {0x60f88, 0x60f8c}, - {0x61000, 0x6102a}, {0x61050, 0x61055}, {0x6105a, 0x6105d}, {0x6106e, 0x61070}, - {0x61075, 0x61081}, {0x610a0, 0x610c5}, {0x610d0, 0x610fa}, {0x610fc, 0x61248}, - {0x6124a, 0x6124d}, {0x61250, 0x61256}, {0x6125a, 0x6125d}, {0x61260, 0x61288}, - {0x6128a, 0x6128d}, {0x61290, 0x612b0}, {0x612b2, 0x612b5}, {0x612b8, 0x612be}, - {0x612c2, 0x612c5}, {0x612c8, 0x612d6}, {0x612d8, 0x61310}, {0x61312, 0x61315}, - {0x61318, 0x6135a}, {0x61380, 0x6138f}, {0x613a0, 0x613f5}, {0x613f8, 0x613fd}, - {0x61401, 0x6166c}, {0x6166f, 0x6167f}, {0x61681, 0x6169a}, {0x616a0, 0x616ea}, - {0x616f1, 0x616f8}, {0x61700, 0x6170c}, {0x6170e, 0x61711}, {0x61720, 0x61731}, - {0x61740, 0x61751}, {0x61760, 0x6176c}, {0x6176e, 0x61770}, {0x61780, 0x617b3}, - {0x61820, 0x61877}, {0x61880, 0x61884}, {0x61887, 0x618a8}, {0x618b0, 0x618f5}, - {0x61900, 0x6191e}, {0x61950, 0x6196d}, {0x61970, 0x61974}, {0x61980, 0x619ab}, - {0x619b0, 0x619c9}, {0x61a00, 0x61a16}, {0x61a20, 0x61a54}, {0x61b05, 0x61b33}, - {0x61b45, 0x61b4b}, {0x61b83, 0x61ba0}, {0x61bba, 0x61be5}, {0x61c00, 0x61c23}, - {0x61c4d, 0x61c4f}, {0x61c5a, 0x61c7d}, {0x61c80, 0x61c88}, {0x61ce9, 0x61cec}, - {0x61cee, 0x61cf1}, {0x61d00, 0x61dbf}, {0x61e00, 0x61f15}, {0x61f18, 0x61f1d}, - {0x61f20, 0x61f45}, {0x61f48, 0x61f4d}, {0x61f50, 0x61f57}, {0x61f5f, 0x61f7d}, - {0x61f80, 0x61fb4}, {0x61fb6, 0x61fbc}, {0x61fc2, 0x61fc4}, {0x61fc6, 0x61fcc}, - {0x61fd0, 0x61fd3}, {0x61fd6, 0x61fdb}, {0x61fe0, 0x61fec}, {0x61ff2, 0x61ff4}, - {0x61ff6, 0x61ffc}, {0x62090, 0x6209c}, {0x6210a, 0x62113}, {0x62119, 0x6211d}, - {0x6212a, 0x6212d}, {0x6212f, 0x62139}, {0x6213c, 0x6213f}, {0x62145, 0x62149}, - {0x62c00, 0x62c2e}, {0x62c30, 0x62c5e}, {0x62c60, 0x62ce4}, {0x62ceb, 0x62cee}, - {0x62d00, 0x62d25}, {0x62d30, 0x62d67}, {0x62d80, 0x62d96}, {0x62da0, 0x62da6}, - {0x62da8, 0x62dae}, {0x62db0, 0x62db6}, {0x62db8, 0x62dbe}, {0x62dc0, 0x62dc6}, - {0x62dc8, 0x62dce}, {0x62dd0, 0x62dd6}, {0x62dd8, 0x62dde}, {0x63031, 0x63035}, - {0x63041, 0x63096}, {0x6309d, 0x6309f}, {0x630a1, 0x630fa}, {0x630fc, 0x630ff}, - {0x63105, 0x6312e}, {0x63131, 0x6318e}, {0x631a0, 0x631ba}, {0x631f0, 0x631ff}, - {0x63400, 0x64db5}, {0x64e00, 0x69fea}, {0x6a000, 0x6a48c}, {0x6a4d0, 0x6a4fd}, - {0x6a500, 0x6a60c}, {0x6a610, 0x6a61f}, {0x6a640, 0x6a66e}, {0x6a67f, 0x6a69d}, - {0x6a6a0, 0x6a6e5}, {0x6a717, 0x6a71f}, {0x6a722, 0x6a788}, {0x6a78b, 0x6a7ae}, - {0x6a7b0, 0x6a7b7}, {0x6a7f7, 0x6a801}, {0x6a803, 0x6a805}, {0x6a807, 0x6a80a}, - {0x6a80c, 0x6a822}, {0x6a840, 0x6a873}, {0x6a882, 0x6a8b3}, {0x6a8f2, 0x6a8f7}, - {0x6a90a, 0x6a925}, {0x6a930, 0x6a946}, {0x6a960, 0x6a97c}, {0x6a984, 0x6a9b2}, - {0x6a9e0, 0x6a9e4}, {0x6a9e6, 0x6a9ef}, {0x6a9fa, 0x6a9fe}, {0x6aa00, 0x6aa28}, - {0x6aa40, 0x6aa42}, {0x6aa44, 0x6aa4b}, {0x6aa60, 0x6aa76}, {0x6aa7e, 0x6aaaf}, - {0x6aab9, 0x6aabd}, {0x6aadb, 0x6aadd}, {0x6aae0, 0x6aaea}, {0x6aaf2, 0x6aaf4}, - {0x6ab01, 0x6ab06}, {0x6ab09, 0x6ab0e}, {0x6ab11, 0x6ab16}, {0x6ab20, 0x6ab26}, - {0x6ab28, 0x6ab2e}, {0x6ab30, 0x6ab5a}, {0x6ab5c, 0x6ab65}, {0x6ab70, 0x6abe2}, - {0x6ac00, 0x6d7a3}, {0x6d7b0, 0x6d7c6}, {0x6d7cb, 0x6d7fb}, {0x6f900, 0x6fa6d}, - {0x6fa70, 0x6fad9}, {0x6fb00, 0x6fb06}, {0x6fb13, 0x6fb17}, {0x6fb1f, 0x6fb28}, - {0x6fb2a, 0x6fb36}, {0x6fb38, 0x6fb3c}, {0x6fb46, 0x6fbb1}, {0x6fbd3, 0x6fd3d}, - {0x6fd50, 0x6fd8f}, {0x6fd92, 0x6fdc7}, {0x6fdf0, 0x6fdfb}, {0x6fe70, 0x6fe74}, - {0x6fe76, 0x6fefc}, {0x6ff21, 0x6ff3a}, {0x6ff41, 0x6ff5a}, {0x6ff66, 0x6ffbe}, - {0x6ffc2, 0x6ffc7}, {0x6ffca, 0x6ffcf}, {0x6ffd2, 0x6ffd7}, {0x6ffda, 0x6ffdc}, - {0x70041, 0x7005a}, {0x70061, 0x7007a}, {0x700c0, 0x700d6}, {0x700d8, 0x700f6}, - {0x700f8, 0x702c1}, {0x702c6, 0x702d1}, {0x702e0, 0x702e4}, {0x70370, 0x70374}, - {0x7037a, 0x7037d}, {0x70388, 0x7038a}, {0x7038e, 0x703a1}, {0x703a3, 0x703f5}, - {0x703f7, 0x70481}, {0x7048a, 0x7052f}, {0x70531, 0x70556}, {0x70561, 0x70587}, - {0x705d0, 0x705ea}, {0x705f0, 0x705f2}, {0x70620, 0x7064a}, {0x70671, 0x706d3}, - {0x706fa, 0x706fc}, {0x70712, 0x7072f}, {0x7074d, 0x707a5}, {0x707ca, 0x707ea}, - {0x70800, 0x70815}, {0x70840, 0x70858}, {0x70860, 0x7086a}, {0x708a0, 0x708b4}, - {0x708b6, 0x708bd}, {0x70904, 0x70939}, {0x70958, 0x70961}, {0x70971, 0x70980}, - {0x70985, 0x7098c}, {0x70993, 0x709a8}, {0x709aa, 0x709b0}, {0x709b6, 0x709b9}, - {0x709df, 0x709e1}, {0x70a05, 0x70a0a}, {0x70a13, 0x70a28}, {0x70a2a, 0x70a30}, - {0x70a59, 0x70a5c}, {0x70a72, 0x70a74}, {0x70a85, 0x70a8d}, {0x70a8f, 0x70a91}, - {0x70a93, 0x70aa8}, {0x70aaa, 0x70ab0}, {0x70ab5, 0x70ab9}, {0x70b05, 0x70b0c}, - {0x70b13, 0x70b28}, {0x70b2a, 0x70b30}, {0x70b35, 0x70b39}, {0x70b5f, 0x70b61}, - {0x70b85, 0x70b8a}, {0x70b8e, 0x70b90}, {0x70b92, 0x70b95}, {0x70ba8, 0x70baa}, - {0x70bae, 0x70bb9}, {0x70c05, 0x70c0c}, {0x70c0e, 0x70c10}, {0x70c12, 0x70c28}, - {0x70c2a, 0x70c39}, {0x70c58, 0x70c5a}, {0x70c85, 0x70c8c}, {0x70c8e, 0x70c90}, - {0x70c92, 0x70ca8}, {0x70caa, 0x70cb3}, {0x70cb5, 0x70cb9}, {0x70d05, 0x70d0c}, - {0x70d0e, 0x70d10}, {0x70d12, 0x70d3a}, {0x70d54, 0x70d56}, {0x70d5f, 0x70d61}, - {0x70d7a, 0x70d7f}, {0x70d85, 0x70d96}, {0x70d9a, 0x70db1}, {0x70db3, 0x70dbb}, - {0x70dc0, 0x70dc6}, {0x70e01, 0x70e30}, {0x70e40, 0x70e46}, {0x70e94, 0x70e97}, - {0x70e99, 0x70e9f}, {0x70ea1, 0x70ea3}, {0x70ead, 0x70eb0}, {0x70ec0, 0x70ec4}, - {0x70edc, 0x70edf}, {0x70f40, 0x70f47}, {0x70f49, 0x70f6c}, {0x70f88, 0x70f8c}, - {0x71000, 0x7102a}, {0x71050, 0x71055}, {0x7105a, 0x7105d}, {0x7106e, 0x71070}, - {0x71075, 0x71081}, {0x710a0, 0x710c5}, {0x710d0, 0x710fa}, {0x710fc, 0x71248}, - {0x7124a, 0x7124d}, {0x71250, 0x71256}, {0x7125a, 0x7125d}, {0x71260, 0x71288}, - {0x7128a, 0x7128d}, {0x71290, 0x712b0}, {0x712b2, 0x712b5}, {0x712b8, 0x712be}, - {0x712c2, 0x712c5}, {0x712c8, 0x712d6}, {0x712d8, 0x71310}, {0x71312, 0x71315}, - {0x71318, 0x7135a}, {0x71380, 0x7138f}, {0x713a0, 0x713f5}, {0x713f8, 0x713fd}, - {0x71401, 0x7166c}, {0x7166f, 0x7167f}, {0x71681, 0x7169a}, {0x716a0, 0x716ea}, - {0x716f1, 0x716f8}, {0x71700, 0x7170c}, {0x7170e, 0x71711}, {0x71720, 0x71731}, - {0x71740, 0x71751}, {0x71760, 0x7176c}, {0x7176e, 0x71770}, {0x71780, 0x717b3}, - {0x71820, 0x71877}, {0x71880, 0x71884}, {0x71887, 0x718a8}, {0x718b0, 0x718f5}, - {0x71900, 0x7191e}, {0x71950, 0x7196d}, {0x71970, 0x71974}, {0x71980, 0x719ab}, - {0x719b0, 0x719c9}, {0x71a00, 0x71a16}, {0x71a20, 0x71a54}, {0x71b05, 0x71b33}, - {0x71b45, 0x71b4b}, {0x71b83, 0x71ba0}, {0x71bba, 0x71be5}, {0x71c00, 0x71c23}, - {0x71c4d, 0x71c4f}, {0x71c5a, 0x71c7d}, {0x71c80, 0x71c88}, {0x71ce9, 0x71cec}, - {0x71cee, 0x71cf1}, {0x71d00, 0x71dbf}, {0x71e00, 0x71f15}, {0x71f18, 0x71f1d}, - {0x71f20, 0x71f45}, {0x71f48, 0x71f4d}, {0x71f50, 0x71f57}, {0x71f5f, 0x71f7d}, - {0x71f80, 0x71fb4}, {0x71fb6, 0x71fbc}, {0x71fc2, 0x71fc4}, {0x71fc6, 0x71fcc}, - {0x71fd0, 0x71fd3}, {0x71fd6, 0x71fdb}, {0x71fe0, 0x71fec}, {0x71ff2, 0x71ff4}, - {0x71ff6, 0x71ffc}, {0x72090, 0x7209c}, {0x7210a, 0x72113}, {0x72119, 0x7211d}, - {0x7212a, 0x7212d}, {0x7212f, 0x72139}, {0x7213c, 0x7213f}, {0x72145, 0x72149}, - {0x72c00, 0x72c2e}, {0x72c30, 0x72c5e}, {0x72c60, 0x72ce4}, {0x72ceb, 0x72cee}, - {0x72d00, 0x72d25}, {0x72d30, 0x72d67}, {0x72d80, 0x72d96}, {0x72da0, 0x72da6}, - {0x72da8, 0x72dae}, {0x72db0, 0x72db6}, {0x72db8, 0x72dbe}, {0x72dc0, 0x72dc6}, - {0x72dc8, 0x72dce}, {0x72dd0, 0x72dd6}, {0x72dd8, 0x72dde}, {0x73031, 0x73035}, - {0x73041, 0x73096}, {0x7309d, 0x7309f}, {0x730a1, 0x730fa}, {0x730fc, 0x730ff}, - {0x73105, 0x7312e}, {0x73131, 0x7318e}, {0x731a0, 0x731ba}, {0x731f0, 0x731ff}, - {0x73400, 0x74db5}, {0x74e00, 0x79fea}, {0x7a000, 0x7a48c}, {0x7a4d0, 0x7a4fd}, - {0x7a500, 0x7a60c}, {0x7a610, 0x7a61f}, {0x7a640, 0x7a66e}, {0x7a67f, 0x7a69d}, - {0x7a6a0, 0x7a6e5}, {0x7a717, 0x7a71f}, {0x7a722, 0x7a788}, {0x7a78b, 0x7a7ae}, - {0x7a7b0, 0x7a7b7}, {0x7a7f7, 0x7a801}, {0x7a803, 0x7a805}, {0x7a807, 0x7a80a}, - {0x7a80c, 0x7a822}, {0x7a840, 0x7a873}, {0x7a882, 0x7a8b3}, {0x7a8f2, 0x7a8f7}, - {0x7a90a, 0x7a925}, {0x7a930, 0x7a946}, {0x7a960, 0x7a97c}, {0x7a984, 0x7a9b2}, - {0x7a9e0, 0x7a9e4}, {0x7a9e6, 0x7a9ef}, {0x7a9fa, 0x7a9fe}, {0x7aa00, 0x7aa28}, - {0x7aa40, 0x7aa42}, {0x7aa44, 0x7aa4b}, {0x7aa60, 0x7aa76}, {0x7aa7e, 0x7aaaf}, - {0x7aab9, 0x7aabd}, {0x7aadb, 0x7aadd}, {0x7aae0, 0x7aaea}, {0x7aaf2, 0x7aaf4}, - {0x7ab01, 0x7ab06}, {0x7ab09, 0x7ab0e}, {0x7ab11, 0x7ab16}, {0x7ab20, 0x7ab26}, - {0x7ab28, 0x7ab2e}, {0x7ab30, 0x7ab5a}, {0x7ab5c, 0x7ab65}, {0x7ab70, 0x7abe2}, - {0x7ac00, 0x7d7a3}, {0x7d7b0, 0x7d7c6}, {0x7d7cb, 0x7d7fb}, {0x7f900, 0x7fa6d}, - {0x7fa70, 0x7fad9}, {0x7fb00, 0x7fb06}, {0x7fb13, 0x7fb17}, {0x7fb1f, 0x7fb28}, - {0x7fb2a, 0x7fb36}, {0x7fb38, 0x7fb3c}, {0x7fb46, 0x7fbb1}, {0x7fbd3, 0x7fd3d}, - {0x7fd50, 0x7fd8f}, {0x7fd92, 0x7fdc7}, {0x7fdf0, 0x7fdfb}, {0x7fe70, 0x7fe74}, - {0x7fe76, 0x7fefc}, {0x7ff21, 0x7ff3a}, {0x7ff41, 0x7ff5a}, {0x7ff66, 0x7ffbe}, - {0x7ffc2, 0x7ffc7}, {0x7ffca, 0x7ffcf}, {0x7ffd2, 0x7ffd7}, {0x7ffda, 0x7ffdc}, - {0x80041, 0x8005a}, {0x80061, 0x8007a}, {0x800c0, 0x800d6}, {0x800d8, 0x800f6}, - {0x800f8, 0x802c1}, {0x802c6, 0x802d1}, {0x802e0, 0x802e4}, {0x80370, 0x80374}, - {0x8037a, 0x8037d}, {0x80388, 0x8038a}, {0x8038e, 0x803a1}, {0x803a3, 0x803f5}, - {0x803f7, 0x80481}, {0x8048a, 0x8052f}, {0x80531, 0x80556}, {0x80561, 0x80587}, - {0x805d0, 0x805ea}, {0x805f0, 0x805f2}, {0x80620, 0x8064a}, {0x80671, 0x806d3}, - {0x806fa, 0x806fc}, {0x80712, 0x8072f}, {0x8074d, 0x807a5}, {0x807ca, 0x807ea}, - {0x80800, 0x80815}, {0x80840, 0x80858}, {0x80860, 0x8086a}, {0x808a0, 0x808b4}, - {0x808b6, 0x808bd}, {0x80904, 0x80939}, {0x80958, 0x80961}, {0x80971, 0x80980}, - {0x80985, 0x8098c}, {0x80993, 0x809a8}, {0x809aa, 0x809b0}, {0x809b6, 0x809b9}, - {0x809df, 0x809e1}, {0x80a05, 0x80a0a}, {0x80a13, 0x80a28}, {0x80a2a, 0x80a30}, - {0x80a59, 0x80a5c}, {0x80a72, 0x80a74}, {0x80a85, 0x80a8d}, {0x80a8f, 0x80a91}, - {0x80a93, 0x80aa8}, {0x80aaa, 0x80ab0}, {0x80ab5, 0x80ab9}, {0x80b05, 0x80b0c}, - {0x80b13, 0x80b28}, {0x80b2a, 0x80b30}, {0x80b35, 0x80b39}, {0x80b5f, 0x80b61}, - {0x80b85, 0x80b8a}, {0x80b8e, 0x80b90}, {0x80b92, 0x80b95}, {0x80ba8, 0x80baa}, - {0x80bae, 0x80bb9}, {0x80c05, 0x80c0c}, {0x80c0e, 0x80c10}, {0x80c12, 0x80c28}, - {0x80c2a, 0x80c39}, {0x80c58, 0x80c5a}, {0x80c85, 0x80c8c}, {0x80c8e, 0x80c90}, - {0x80c92, 0x80ca8}, {0x80caa, 0x80cb3}, {0x80cb5, 0x80cb9}, {0x80d05, 0x80d0c}, - {0x80d0e, 0x80d10}, {0x80d12, 0x80d3a}, {0x80d54, 0x80d56}, {0x80d5f, 0x80d61}, - {0x80d7a, 0x80d7f}, {0x80d85, 0x80d96}, {0x80d9a, 0x80db1}, {0x80db3, 0x80dbb}, - {0x80dc0, 0x80dc6}, {0x80e01, 0x80e30}, {0x80e40, 0x80e46}, {0x80e94, 0x80e97}, - {0x80e99, 0x80e9f}, {0x80ea1, 0x80ea3}, {0x80ead, 0x80eb0}, {0x80ec0, 0x80ec4}, - {0x80edc, 0x80edf}, {0x80f40, 0x80f47}, {0x80f49, 0x80f6c}, {0x80f88, 0x80f8c}, - {0x81000, 0x8102a}, {0x81050, 0x81055}, {0x8105a, 0x8105d}, {0x8106e, 0x81070}, - {0x81075, 0x81081}, {0x810a0, 0x810c5}, {0x810d0, 0x810fa}, {0x810fc, 0x81248}, - {0x8124a, 0x8124d}, {0x81250, 0x81256}, {0x8125a, 0x8125d}, {0x81260, 0x81288}, - {0x8128a, 0x8128d}, {0x81290, 0x812b0}, {0x812b2, 0x812b5}, {0x812b8, 0x812be}, - {0x812c2, 0x812c5}, {0x812c8, 0x812d6}, {0x812d8, 0x81310}, {0x81312, 0x81315}, - {0x81318, 0x8135a}, {0x81380, 0x8138f}, {0x813a0, 0x813f5}, {0x813f8, 0x813fd}, - {0x81401, 0x8166c}, {0x8166f, 0x8167f}, {0x81681, 0x8169a}, {0x816a0, 0x816ea}, - {0x816f1, 0x816f8}, {0x81700, 0x8170c}, {0x8170e, 0x81711}, {0x81720, 0x81731}, - {0x81740, 0x81751}, {0x81760, 0x8176c}, {0x8176e, 0x81770}, {0x81780, 0x817b3}, - {0x81820, 0x81877}, {0x81880, 0x81884}, {0x81887, 0x818a8}, {0x818b0, 0x818f5}, - {0x81900, 0x8191e}, {0x81950, 0x8196d}, {0x81970, 0x81974}, {0x81980, 0x819ab}, - {0x819b0, 0x819c9}, {0x81a00, 0x81a16}, {0x81a20, 0x81a54}, {0x81b05, 0x81b33}, - {0x81b45, 0x81b4b}, {0x81b83, 0x81ba0}, {0x81bba, 0x81be5}, {0x81c00, 0x81c23}, - {0x81c4d, 0x81c4f}, {0x81c5a, 0x81c7d}, {0x81c80, 0x81c88}, {0x81ce9, 0x81cec}, - {0x81cee, 0x81cf1}, {0x81d00, 0x81dbf}, {0x81e00, 0x81f15}, {0x81f18, 0x81f1d}, - {0x81f20, 0x81f45}, {0x81f48, 0x81f4d}, {0x81f50, 0x81f57}, {0x81f5f, 0x81f7d}, - {0x81f80, 0x81fb4}, {0x81fb6, 0x81fbc}, {0x81fc2, 0x81fc4}, {0x81fc6, 0x81fcc}, - {0x81fd0, 0x81fd3}, {0x81fd6, 0x81fdb}, {0x81fe0, 0x81fec}, {0x81ff2, 0x81ff4}, - {0x81ff6, 0x81ffc}, {0x82090, 0x8209c}, {0x8210a, 0x82113}, {0x82119, 0x8211d}, - {0x8212a, 0x8212d}, {0x8212f, 0x82139}, {0x8213c, 0x8213f}, {0x82145, 0x82149}, - {0x82c00, 0x82c2e}, {0x82c30, 0x82c5e}, {0x82c60, 0x82ce4}, {0x82ceb, 0x82cee}, - {0x82d00, 0x82d25}, {0x82d30, 0x82d67}, {0x82d80, 0x82d96}, {0x82da0, 0x82da6}, - {0x82da8, 0x82dae}, {0x82db0, 0x82db6}, {0x82db8, 0x82dbe}, {0x82dc0, 0x82dc6}, - {0x82dc8, 0x82dce}, {0x82dd0, 0x82dd6}, {0x82dd8, 0x82dde}, {0x83031, 0x83035}, - {0x83041, 0x83096}, {0x8309d, 0x8309f}, {0x830a1, 0x830fa}, {0x830fc, 0x830ff}, - {0x83105, 0x8312e}, {0x83131, 0x8318e}, {0x831a0, 0x831ba}, {0x831f0, 0x831ff}, - {0x83400, 0x84db5}, {0x84e00, 0x89fea}, {0x8a000, 0x8a48c}, {0x8a4d0, 0x8a4fd}, - {0x8a500, 0x8a60c}, {0x8a610, 0x8a61f}, {0x8a640, 0x8a66e}, {0x8a67f, 0x8a69d}, - {0x8a6a0, 0x8a6e5}, {0x8a717, 0x8a71f}, {0x8a722, 0x8a788}, {0x8a78b, 0x8a7ae}, - {0x8a7b0, 0x8a7b7}, {0x8a7f7, 0x8a801}, {0x8a803, 0x8a805}, {0x8a807, 0x8a80a}, - {0x8a80c, 0x8a822}, {0x8a840, 0x8a873}, {0x8a882, 0x8a8b3}, {0x8a8f2, 0x8a8f7}, - {0x8a90a, 0x8a925}, {0x8a930, 0x8a946}, {0x8a960, 0x8a97c}, {0x8a984, 0x8a9b2}, - {0x8a9e0, 0x8a9e4}, {0x8a9e6, 0x8a9ef}, {0x8a9fa, 0x8a9fe}, {0x8aa00, 0x8aa28}, - {0x8aa40, 0x8aa42}, {0x8aa44, 0x8aa4b}, {0x8aa60, 0x8aa76}, {0x8aa7e, 0x8aaaf}, - {0x8aab9, 0x8aabd}, {0x8aadb, 0x8aadd}, {0x8aae0, 0x8aaea}, {0x8aaf2, 0x8aaf4}, - {0x8ab01, 0x8ab06}, {0x8ab09, 0x8ab0e}, {0x8ab11, 0x8ab16}, {0x8ab20, 0x8ab26}, - {0x8ab28, 0x8ab2e}, {0x8ab30, 0x8ab5a}, {0x8ab5c, 0x8ab65}, {0x8ab70, 0x8abe2}, - {0x8ac00, 0x8d7a3}, {0x8d7b0, 0x8d7c6}, {0x8d7cb, 0x8d7fb}, {0x8f900, 0x8fa6d}, - {0x8fa70, 0x8fad9}, {0x8fb00, 0x8fb06}, {0x8fb13, 0x8fb17}, {0x8fb1f, 0x8fb28}, - {0x8fb2a, 0x8fb36}, {0x8fb38, 0x8fb3c}, {0x8fb46, 0x8fbb1}, {0x8fbd3, 0x8fd3d}, - {0x8fd50, 0x8fd8f}, {0x8fd92, 0x8fdc7}, {0x8fdf0, 0x8fdfb}, {0x8fe70, 0x8fe74}, - {0x8fe76, 0x8fefc}, {0x8ff21, 0x8ff3a}, {0x8ff41, 0x8ff5a}, {0x8ff66, 0x8ffbe}, - {0x8ffc2, 0x8ffc7}, {0x8ffca, 0x8ffcf}, {0x8ffd2, 0x8ffd7}, {0x8ffda, 0x8ffdc}, - {0x90041, 0x9005a}, {0x90061, 0x9007a}, {0x900c0, 0x900d6}, {0x900d8, 0x900f6}, - {0x900f8, 0x902c1}, {0x902c6, 0x902d1}, {0x902e0, 0x902e4}, {0x90370, 0x90374}, - {0x9037a, 0x9037d}, {0x90388, 0x9038a}, {0x9038e, 0x903a1}, {0x903a3, 0x903f5}, - {0x903f7, 0x90481}, {0x9048a, 0x9052f}, {0x90531, 0x90556}, {0x90561, 0x90587}, - {0x905d0, 0x905ea}, {0x905f0, 0x905f2}, {0x90620, 0x9064a}, {0x90671, 0x906d3}, - {0x906fa, 0x906fc}, {0x90712, 0x9072f}, {0x9074d, 0x907a5}, {0x907ca, 0x907ea}, - {0x90800, 0x90815}, {0x90840, 0x90858}, {0x90860, 0x9086a}, {0x908a0, 0x908b4}, - {0x908b6, 0x908bd}, {0x90904, 0x90939}, {0x90958, 0x90961}, {0x90971, 0x90980}, - {0x90985, 0x9098c}, {0x90993, 0x909a8}, {0x909aa, 0x909b0}, {0x909b6, 0x909b9}, - {0x909df, 0x909e1}, {0x90a05, 0x90a0a}, {0x90a13, 0x90a28}, {0x90a2a, 0x90a30}, - {0x90a59, 0x90a5c}, {0x90a72, 0x90a74}, {0x90a85, 0x90a8d}, {0x90a8f, 0x90a91}, - {0x90a93, 0x90aa8}, {0x90aaa, 0x90ab0}, {0x90ab5, 0x90ab9}, {0x90b05, 0x90b0c}, - {0x90b13, 0x90b28}, {0x90b2a, 0x90b30}, {0x90b35, 0x90b39}, {0x90b5f, 0x90b61}, - {0x90b85, 0x90b8a}, {0x90b8e, 0x90b90}, {0x90b92, 0x90b95}, {0x90ba8, 0x90baa}, - {0x90bae, 0x90bb9}, {0x90c05, 0x90c0c}, {0x90c0e, 0x90c10}, {0x90c12, 0x90c28}, - {0x90c2a, 0x90c39}, {0x90c58, 0x90c5a}, {0x90c85, 0x90c8c}, {0x90c8e, 0x90c90}, - {0x90c92, 0x90ca8}, {0x90caa, 0x90cb3}, {0x90cb5, 0x90cb9}, {0x90d05, 0x90d0c}, - {0x90d0e, 0x90d10}, {0x90d12, 0x90d3a}, {0x90d54, 0x90d56}, {0x90d5f, 0x90d61}, - {0x90d7a, 0x90d7f}, {0x90d85, 0x90d96}, {0x90d9a, 0x90db1}, {0x90db3, 0x90dbb}, - {0x90dc0, 0x90dc6}, {0x90e01, 0x90e30}, {0x90e40, 0x90e46}, {0x90e94, 0x90e97}, - {0x90e99, 0x90e9f}, {0x90ea1, 0x90ea3}, {0x90ead, 0x90eb0}, {0x90ec0, 0x90ec4}, - {0x90edc, 0x90edf}, {0x90f40, 0x90f47}, {0x90f49, 0x90f6c}, {0x90f88, 0x90f8c}, - {0x91000, 0x9102a}, {0x91050, 0x91055}, {0x9105a, 0x9105d}, {0x9106e, 0x91070}, - {0x91075, 0x91081}, {0x910a0, 0x910c5}, {0x910d0, 0x910fa}, {0x910fc, 0x91248}, - {0x9124a, 0x9124d}, {0x91250, 0x91256}, {0x9125a, 0x9125d}, {0x91260, 0x91288}, - {0x9128a, 0x9128d}, {0x91290, 0x912b0}, {0x912b2, 0x912b5}, {0x912b8, 0x912be}, - {0x912c2, 0x912c5}, {0x912c8, 0x912d6}, {0x912d8, 0x91310}, {0x91312, 0x91315}, - {0x91318, 0x9135a}, {0x91380, 0x9138f}, {0x913a0, 0x913f5}, {0x913f8, 0x913fd}, - {0x91401, 0x9166c}, {0x9166f, 0x9167f}, {0x91681, 0x9169a}, {0x916a0, 0x916ea}, - {0x916f1, 0x916f8}, {0x91700, 0x9170c}, {0x9170e, 0x91711}, {0x91720, 0x91731}, - {0x91740, 0x91751}, {0x91760, 0x9176c}, {0x9176e, 0x91770}, {0x91780, 0x917b3}, - {0x91820, 0x91877}, {0x91880, 0x91884}, {0x91887, 0x918a8}, {0x918b0, 0x918f5}, - {0x91900, 0x9191e}, {0x91950, 0x9196d}, {0x91970, 0x91974}, {0x91980, 0x919ab}, - {0x919b0, 0x919c9}, {0x91a00, 0x91a16}, {0x91a20, 0x91a54}, {0x91b05, 0x91b33}, - {0x91b45, 0x91b4b}, {0x91b83, 0x91ba0}, {0x91bba, 0x91be5}, {0x91c00, 0x91c23}, - {0x91c4d, 0x91c4f}, {0x91c5a, 0x91c7d}, {0x91c80, 0x91c88}, {0x91ce9, 0x91cec}, - {0x91cee, 0x91cf1}, {0x91d00, 0x91dbf}, {0x91e00, 0x91f15}, {0x91f18, 0x91f1d}, - {0x91f20, 0x91f45}, {0x91f48, 0x91f4d}, {0x91f50, 0x91f57}, {0x91f5f, 0x91f7d}, - {0x91f80, 0x91fb4}, {0x91fb6, 0x91fbc}, {0x91fc2, 0x91fc4}, {0x91fc6, 0x91fcc}, - {0x91fd0, 0x91fd3}, {0x91fd6, 0x91fdb}, {0x91fe0, 0x91fec}, {0x91ff2, 0x91ff4}, - {0x91ff6, 0x91ffc}, {0x92090, 0x9209c}, {0x9210a, 0x92113}, {0x92119, 0x9211d}, - {0x9212a, 0x9212d}, {0x9212f, 0x92139}, {0x9213c, 0x9213f}, {0x92145, 0x92149}, - {0x92c00, 0x92c2e}, {0x92c30, 0x92c5e}, {0x92c60, 0x92ce4}, {0x92ceb, 0x92cee}, - {0x92d00, 0x92d25}, {0x92d30, 0x92d67}, {0x92d80, 0x92d96}, {0x92da0, 0x92da6}, - {0x92da8, 0x92dae}, {0x92db0, 0x92db6}, {0x92db8, 0x92dbe}, {0x92dc0, 0x92dc6}, - {0x92dc8, 0x92dce}, {0x92dd0, 0x92dd6}, {0x92dd8, 0x92dde}, {0x93031, 0x93035}, - {0x93041, 0x93096}, {0x9309d, 0x9309f}, {0x930a1, 0x930fa}, {0x930fc, 0x930ff}, - {0x93105, 0x9312e}, {0x93131, 0x9318e}, {0x931a0, 0x931ba}, {0x931f0, 0x931ff}, - {0x93400, 0x94db5}, {0x94e00, 0x99fea}, {0x9a000, 0x9a48c}, {0x9a4d0, 0x9a4fd}, - {0x9a500, 0x9a60c}, {0x9a610, 0x9a61f}, {0x9a640, 0x9a66e}, {0x9a67f, 0x9a69d}, - {0x9a6a0, 0x9a6e5}, {0x9a717, 0x9a71f}, {0x9a722, 0x9a788}, {0x9a78b, 0x9a7ae}, - {0x9a7b0, 0x9a7b7}, {0x9a7f7, 0x9a801}, {0x9a803, 0x9a805}, {0x9a807, 0x9a80a}, - {0x9a80c, 0x9a822}, {0x9a840, 0x9a873}, {0x9a882, 0x9a8b3}, {0x9a8f2, 0x9a8f7}, - {0x9a90a, 0x9a925}, {0x9a930, 0x9a946}, {0x9a960, 0x9a97c}, {0x9a984, 0x9a9b2}, - {0x9a9e0, 0x9a9e4}, {0x9a9e6, 0x9a9ef}, {0x9a9fa, 0x9a9fe}, {0x9aa00, 0x9aa28}, - {0x9aa40, 0x9aa42}, {0x9aa44, 0x9aa4b}, {0x9aa60, 0x9aa76}, {0x9aa7e, 0x9aaaf}, - {0x9aab9, 0x9aabd}, {0x9aadb, 0x9aadd}, {0x9aae0, 0x9aaea}, {0x9aaf2, 0x9aaf4}, - {0x9ab01, 0x9ab06}, {0x9ab09, 0x9ab0e}, {0x9ab11, 0x9ab16}, {0x9ab20, 0x9ab26}, - {0x9ab28, 0x9ab2e}, {0x9ab30, 0x9ab5a}, {0x9ab5c, 0x9ab65}, {0x9ab70, 0x9abe2}, - {0x9ac00, 0x9d7a3}, {0x9d7b0, 0x9d7c6}, {0x9d7cb, 0x9d7fb}, {0x9f900, 0x9fa6d}, - {0x9fa70, 0x9fad9}, {0x9fb00, 0x9fb06}, {0x9fb13, 0x9fb17}, {0x9fb1f, 0x9fb28}, - {0x9fb2a, 0x9fb36}, {0x9fb38, 0x9fb3c}, {0x9fb46, 0x9fbb1}, {0x9fbd3, 0x9fd3d}, - {0x9fd50, 0x9fd8f}, {0x9fd92, 0x9fdc7}, {0x9fdf0, 0x9fdfb}, {0x9fe70, 0x9fe74}, - {0x9fe76, 0x9fefc}, {0x9ff21, 0x9ff3a}, {0x9ff41, 0x9ff5a}, {0x9ff66, 0x9ffbe}, - {0x9ffc2, 0x9ffc7}, {0x9ffca, 0x9ffcf}, {0x9ffd2, 0x9ffd7}, {0x9ffda, 0x9ffdc}, - {0xa0041, 0xa005a}, {0xa0061, 0xa007a}, {0xa00c0, 0xa00d6}, {0xa00d8, 0xa00f6}, - {0xa00f8, 0xa02c1}, {0xa02c6, 0xa02d1}, {0xa02e0, 0xa02e4}, {0xa0370, 0xa0374}, - {0xa037a, 0xa037d}, {0xa0388, 0xa038a}, {0xa038e, 0xa03a1}, {0xa03a3, 0xa03f5}, - {0xa03f7, 0xa0481}, {0xa048a, 0xa052f}, {0xa0531, 0xa0556}, {0xa0561, 0xa0587}, - {0xa05d0, 0xa05ea}, {0xa05f0, 0xa05f2}, {0xa0620, 0xa064a}, {0xa0671, 0xa06d3}, - {0xa06fa, 0xa06fc}, {0xa0712, 0xa072f}, {0xa074d, 0xa07a5}, {0xa07ca, 0xa07ea}, - {0xa0800, 0xa0815}, {0xa0840, 0xa0858}, {0xa0860, 0xa086a}, {0xa08a0, 0xa08b4}, - {0xa08b6, 0xa08bd}, {0xa0904, 0xa0939}, {0xa0958, 0xa0961}, {0xa0971, 0xa0980}, - {0xa0985, 0xa098c}, {0xa0993, 0xa09a8}, {0xa09aa, 0xa09b0}, {0xa09b6, 0xa09b9}, - {0xa09df, 0xa09e1}, {0xa0a05, 0xa0a0a}, {0xa0a13, 0xa0a28}, {0xa0a2a, 0xa0a30}, - {0xa0a59, 0xa0a5c}, {0xa0a72, 0xa0a74}, {0xa0a85, 0xa0a8d}, {0xa0a8f, 0xa0a91}, - {0xa0a93, 0xa0aa8}, {0xa0aaa, 0xa0ab0}, {0xa0ab5, 0xa0ab9}, {0xa0b05, 0xa0b0c}, - {0xa0b13, 0xa0b28}, {0xa0b2a, 0xa0b30}, {0xa0b35, 0xa0b39}, {0xa0b5f, 0xa0b61}, - {0xa0b85, 0xa0b8a}, {0xa0b8e, 0xa0b90}, {0xa0b92, 0xa0b95}, {0xa0ba8, 0xa0baa}, - {0xa0bae, 0xa0bb9}, {0xa0c05, 0xa0c0c}, {0xa0c0e, 0xa0c10}, {0xa0c12, 0xa0c28}, - {0xa0c2a, 0xa0c39}, {0xa0c58, 0xa0c5a}, {0xa0c85, 0xa0c8c}, {0xa0c8e, 0xa0c90}, - {0xa0c92, 0xa0ca8}, {0xa0caa, 0xa0cb3}, {0xa0cb5, 0xa0cb9}, {0xa0d05, 0xa0d0c}, - {0xa0d0e, 0xa0d10}, {0xa0d12, 0xa0d3a}, {0xa0d54, 0xa0d56}, {0xa0d5f, 0xa0d61}, - {0xa0d7a, 0xa0d7f}, {0xa0d85, 0xa0d96}, {0xa0d9a, 0xa0db1}, {0xa0db3, 0xa0dbb}, - {0xa0dc0, 0xa0dc6}, {0xa0e01, 0xa0e30}, {0xa0e40, 0xa0e46}, {0xa0e94, 0xa0e97}, - {0xa0e99, 0xa0e9f}, {0xa0ea1, 0xa0ea3}, {0xa0ead, 0xa0eb0}, {0xa0ec0, 0xa0ec4}, - {0xa0edc, 0xa0edf}, {0xa0f40, 0xa0f47}, {0xa0f49, 0xa0f6c}, {0xa0f88, 0xa0f8c}, - {0xa1000, 0xa102a}, {0xa1050, 0xa1055}, {0xa105a, 0xa105d}, {0xa106e, 0xa1070}, - {0xa1075, 0xa1081}, {0xa10a0, 0xa10c5}, {0xa10d0, 0xa10fa}, {0xa10fc, 0xa1248}, - {0xa124a, 0xa124d}, {0xa1250, 0xa1256}, {0xa125a, 0xa125d}, {0xa1260, 0xa1288}, - {0xa128a, 0xa128d}, {0xa1290, 0xa12b0}, {0xa12b2, 0xa12b5}, {0xa12b8, 0xa12be}, - {0xa12c2, 0xa12c5}, {0xa12c8, 0xa12d6}, {0xa12d8, 0xa1310}, {0xa1312, 0xa1315}, - {0xa1318, 0xa135a}, {0xa1380, 0xa138f}, {0xa13a0, 0xa13f5}, {0xa13f8, 0xa13fd}, - {0xa1401, 0xa166c}, {0xa166f, 0xa167f}, {0xa1681, 0xa169a}, {0xa16a0, 0xa16ea}, - {0xa16f1, 0xa16f8}, {0xa1700, 0xa170c}, {0xa170e, 0xa1711}, {0xa1720, 0xa1731}, - {0xa1740, 0xa1751}, {0xa1760, 0xa176c}, {0xa176e, 0xa1770}, {0xa1780, 0xa17b3}, - {0xa1820, 0xa1877}, {0xa1880, 0xa1884}, {0xa1887, 0xa18a8}, {0xa18b0, 0xa18f5}, - {0xa1900, 0xa191e}, {0xa1950, 0xa196d}, {0xa1970, 0xa1974}, {0xa1980, 0xa19ab}, - {0xa19b0, 0xa19c9}, {0xa1a00, 0xa1a16}, {0xa1a20, 0xa1a54}, {0xa1b05, 0xa1b33}, - {0xa1b45, 0xa1b4b}, {0xa1b83, 0xa1ba0}, {0xa1bba, 0xa1be5}, {0xa1c00, 0xa1c23}, - {0xa1c4d, 0xa1c4f}, {0xa1c5a, 0xa1c7d}, {0xa1c80, 0xa1c88}, {0xa1ce9, 0xa1cec}, - {0xa1cee, 0xa1cf1}, {0xa1d00, 0xa1dbf}, {0xa1e00, 0xa1f15}, {0xa1f18, 0xa1f1d}, - {0xa1f20, 0xa1f45}, {0xa1f48, 0xa1f4d}, {0xa1f50, 0xa1f57}, {0xa1f5f, 0xa1f7d}, - {0xa1f80, 0xa1fb4}, {0xa1fb6, 0xa1fbc}, {0xa1fc2, 0xa1fc4}, {0xa1fc6, 0xa1fcc}, - {0xa1fd0, 0xa1fd3}, {0xa1fd6, 0xa1fdb}, {0xa1fe0, 0xa1fec}, {0xa1ff2, 0xa1ff4}, - {0xa1ff6, 0xa1ffc}, {0xa2090, 0xa209c}, {0xa210a, 0xa2113}, {0xa2119, 0xa211d}, - {0xa212a, 0xa212d}, {0xa212f, 0xa2139}, {0xa213c, 0xa213f}, {0xa2145, 0xa2149}, - {0xa2c00, 0xa2c2e}, {0xa2c30, 0xa2c5e}, {0xa2c60, 0xa2ce4}, {0xa2ceb, 0xa2cee}, - {0xa2d00, 0xa2d25}, {0xa2d30, 0xa2d67}, {0xa2d80, 0xa2d96}, {0xa2da0, 0xa2da6}, - {0xa2da8, 0xa2dae}, {0xa2db0, 0xa2db6}, {0xa2db8, 0xa2dbe}, {0xa2dc0, 0xa2dc6}, - {0xa2dc8, 0xa2dce}, {0xa2dd0, 0xa2dd6}, {0xa2dd8, 0xa2dde}, {0xa3031, 0xa3035}, - {0xa3041, 0xa3096}, {0xa309d, 0xa309f}, {0xa30a1, 0xa30fa}, {0xa30fc, 0xa30ff}, - {0xa3105, 0xa312e}, {0xa3131, 0xa318e}, {0xa31a0, 0xa31ba}, {0xa31f0, 0xa31ff}, - {0xa3400, 0xa4db5}, {0xa4e00, 0xa9fea}, {0xaa000, 0xaa48c}, {0xaa4d0, 0xaa4fd}, - {0xaa500, 0xaa60c}, {0xaa610, 0xaa61f}, {0xaa640, 0xaa66e}, {0xaa67f, 0xaa69d}, - {0xaa6a0, 0xaa6e5}, {0xaa717, 0xaa71f}, {0xaa722, 0xaa788}, {0xaa78b, 0xaa7ae}, - {0xaa7b0, 0xaa7b7}, {0xaa7f7, 0xaa801}, {0xaa803, 0xaa805}, {0xaa807, 0xaa80a}, - {0xaa80c, 0xaa822}, {0xaa840, 0xaa873}, {0xaa882, 0xaa8b3}, {0xaa8f2, 0xaa8f7}, - {0xaa90a, 0xaa925}, {0xaa930, 0xaa946}, {0xaa960, 0xaa97c}, {0xaa984, 0xaa9b2}, - {0xaa9e0, 0xaa9e4}, {0xaa9e6, 0xaa9ef}, {0xaa9fa, 0xaa9fe}, {0xaaa00, 0xaaa28}, - {0xaaa40, 0xaaa42}, {0xaaa44, 0xaaa4b}, {0xaaa60, 0xaaa76}, {0xaaa7e, 0xaaaaf}, - {0xaaab9, 0xaaabd}, {0xaaadb, 0xaaadd}, {0xaaae0, 0xaaaea}, {0xaaaf2, 0xaaaf4}, - {0xaab01, 0xaab06}, {0xaab09, 0xaab0e}, {0xaab11, 0xaab16}, {0xaab20, 0xaab26}, - {0xaab28, 0xaab2e}, {0xaab30, 0xaab5a}, {0xaab5c, 0xaab65}, {0xaab70, 0xaabe2}, - {0xaac00, 0xad7a3}, {0xad7b0, 0xad7c6}, {0xad7cb, 0xad7fb}, {0xaf900, 0xafa6d}, - {0xafa70, 0xafad9}, {0xafb00, 0xafb06}, {0xafb13, 0xafb17}, {0xafb1f, 0xafb28}, - {0xafb2a, 0xafb36}, {0xafb38, 0xafb3c}, {0xafb46, 0xafbb1}, {0xafbd3, 0xafd3d}, - {0xafd50, 0xafd8f}, {0xafd92, 0xafdc7}, {0xafdf0, 0xafdfb}, {0xafe70, 0xafe74}, - {0xafe76, 0xafefc}, {0xaff21, 0xaff3a}, {0xaff41, 0xaff5a}, {0xaff66, 0xaffbe}, - {0xaffc2, 0xaffc7}, {0xaffca, 0xaffcf}, {0xaffd2, 0xaffd7}, {0xaffda, 0xaffdc}, - {0xb0041, 0xb005a}, {0xb0061, 0xb007a}, {0xb00c0, 0xb00d6}, {0xb00d8, 0xb00f6}, - {0xb00f8, 0xb02c1}, {0xb02c6, 0xb02d1}, {0xb02e0, 0xb02e4}, {0xb0370, 0xb0374}, - {0xb037a, 0xb037d}, {0xb0388, 0xb038a}, {0xb038e, 0xb03a1}, {0xb03a3, 0xb03f5}, - {0xb03f7, 0xb0481}, {0xb048a, 0xb052f}, {0xb0531, 0xb0556}, {0xb0561, 0xb0587}, - {0xb05d0, 0xb05ea}, {0xb05f0, 0xb05f2}, {0xb0620, 0xb064a}, {0xb0671, 0xb06d3}, - {0xb06fa, 0xb06fc}, {0xb0712, 0xb072f}, {0xb074d, 0xb07a5}, {0xb07ca, 0xb07ea}, - {0xb0800, 0xb0815}, {0xb0840, 0xb0858}, {0xb0860, 0xb086a}, {0xb08a0, 0xb08b4}, - {0xb08b6, 0xb08bd}, {0xb0904, 0xb0939}, {0xb0958, 0xb0961}, {0xb0971, 0xb0980}, - {0xb0985, 0xb098c}, {0xb0993, 0xb09a8}, {0xb09aa, 0xb09b0}, {0xb09b6, 0xb09b9}, - {0xb09df, 0xb09e1}, {0xb0a05, 0xb0a0a}, {0xb0a13, 0xb0a28}, {0xb0a2a, 0xb0a30}, - {0xb0a59, 0xb0a5c}, {0xb0a72, 0xb0a74}, {0xb0a85, 0xb0a8d}, {0xb0a8f, 0xb0a91}, - {0xb0a93, 0xb0aa8}, {0xb0aaa, 0xb0ab0}, {0xb0ab5, 0xb0ab9}, {0xb0b05, 0xb0b0c}, - {0xb0b13, 0xb0b28}, {0xb0b2a, 0xb0b30}, {0xb0b35, 0xb0b39}, {0xb0b5f, 0xb0b61}, - {0xb0b85, 0xb0b8a}, {0xb0b8e, 0xb0b90}, {0xb0b92, 0xb0b95}, {0xb0ba8, 0xb0baa}, - {0xb0bae, 0xb0bb9}, {0xb0c05, 0xb0c0c}, {0xb0c0e, 0xb0c10}, {0xb0c12, 0xb0c28}, - {0xb0c2a, 0xb0c39}, {0xb0c58, 0xb0c5a}, {0xb0c85, 0xb0c8c}, {0xb0c8e, 0xb0c90}, - {0xb0c92, 0xb0ca8}, {0xb0caa, 0xb0cb3}, {0xb0cb5, 0xb0cb9}, {0xb0d05, 0xb0d0c}, - {0xb0d0e, 0xb0d10}, {0xb0d12, 0xb0d3a}, {0xb0d54, 0xb0d56}, {0xb0d5f, 0xb0d61}, - {0xb0d7a, 0xb0d7f}, {0xb0d85, 0xb0d96}, {0xb0d9a, 0xb0db1}, {0xb0db3, 0xb0dbb}, - {0xb0dc0, 0xb0dc6}, {0xb0e01, 0xb0e30}, {0xb0e40, 0xb0e46}, {0xb0e94, 0xb0e97}, - {0xb0e99, 0xb0e9f}, {0xb0ea1, 0xb0ea3}, {0xb0ead, 0xb0eb0}, {0xb0ec0, 0xb0ec4}, - {0xb0edc, 0xb0edf}, {0xb0f40, 0xb0f47}, {0xb0f49, 0xb0f6c}, {0xb0f88, 0xb0f8c}, - {0xb1000, 0xb102a}, {0xb1050, 0xb1055}, {0xb105a, 0xb105d}, {0xb106e, 0xb1070}, - {0xb1075, 0xb1081}, {0xb10a0, 0xb10c5}, {0xb10d0, 0xb10fa}, {0xb10fc, 0xb1248}, - {0xb124a, 0xb124d}, {0xb1250, 0xb1256}, {0xb125a, 0xb125d}, {0xb1260, 0xb1288}, - {0xb128a, 0xb128d}, {0xb1290, 0xb12b0}, {0xb12b2, 0xb12b5}, {0xb12b8, 0xb12be}, - {0xb12c2, 0xb12c5}, {0xb12c8, 0xb12d6}, {0xb12d8, 0xb1310}, {0xb1312, 0xb1315}, - {0xb1318, 0xb135a}, {0xb1380, 0xb138f}, {0xb13a0, 0xb13f5}, {0xb13f8, 0xb13fd}, - {0xb1401, 0xb166c}, {0xb166f, 0xb167f}, {0xb1681, 0xb169a}, {0xb16a0, 0xb16ea}, - {0xb16f1, 0xb16f8}, {0xb1700, 0xb170c}, {0xb170e, 0xb1711}, {0xb1720, 0xb1731}, - {0xb1740, 0xb1751}, {0xb1760, 0xb176c}, {0xb176e, 0xb1770}, {0xb1780, 0xb17b3}, - {0xb1820, 0xb1877}, {0xb1880, 0xb1884}, {0xb1887, 0xb18a8}, {0xb18b0, 0xb18f5}, - {0xb1900, 0xb191e}, {0xb1950, 0xb196d}, {0xb1970, 0xb1974}, {0xb1980, 0xb19ab}, - {0xb19b0, 0xb19c9}, {0xb1a00, 0xb1a16}, {0xb1a20, 0xb1a54}, {0xb1b05, 0xb1b33}, - {0xb1b45, 0xb1b4b}, {0xb1b83, 0xb1ba0}, {0xb1bba, 0xb1be5}, {0xb1c00, 0xb1c23}, - {0xb1c4d, 0xb1c4f}, {0xb1c5a, 0xb1c7d}, {0xb1c80, 0xb1c88}, {0xb1ce9, 0xb1cec}, - {0xb1cee, 0xb1cf1}, {0xb1d00, 0xb1dbf}, {0xb1e00, 0xb1f15}, {0xb1f18, 0xb1f1d}, - {0xb1f20, 0xb1f45}, {0xb1f48, 0xb1f4d}, {0xb1f50, 0xb1f57}, {0xb1f5f, 0xb1f7d}, - {0xb1f80, 0xb1fb4}, {0xb1fb6, 0xb1fbc}, {0xb1fc2, 0xb1fc4}, {0xb1fc6, 0xb1fcc}, - {0xb1fd0, 0xb1fd3}, {0xb1fd6, 0xb1fdb}, {0xb1fe0, 0xb1fec}, {0xb1ff2, 0xb1ff4}, - {0xb1ff6, 0xb1ffc}, {0xb2090, 0xb209c}, {0xb210a, 0xb2113}, {0xb2119, 0xb211d}, - {0xb212a, 0xb212d}, {0xb212f, 0xb2139}, {0xb213c, 0xb213f}, {0xb2145, 0xb2149}, - {0xb2c00, 0xb2c2e}, {0xb2c30, 0xb2c5e}, {0xb2c60, 0xb2ce4}, {0xb2ceb, 0xb2cee}, - {0xb2d00, 0xb2d25}, {0xb2d30, 0xb2d67}, {0xb2d80, 0xb2d96}, {0xb2da0, 0xb2da6}, - {0xb2da8, 0xb2dae}, {0xb2db0, 0xb2db6}, {0xb2db8, 0xb2dbe}, {0xb2dc0, 0xb2dc6}, - {0xb2dc8, 0xb2dce}, {0xb2dd0, 0xb2dd6}, {0xb2dd8, 0xb2dde}, {0xb3031, 0xb3035}, - {0xb3041, 0xb3096}, {0xb309d, 0xb309f}, {0xb30a1, 0xb30fa}, {0xb30fc, 0xb30ff}, - {0xb3105, 0xb312e}, {0xb3131, 0xb318e}, {0xb31a0, 0xb31ba}, {0xb31f0, 0xb31ff}, - {0xb3400, 0xb4db5}, {0xb4e00, 0xb9fea}, {0xba000, 0xba48c}, {0xba4d0, 0xba4fd}, - {0xba500, 0xba60c}, {0xba610, 0xba61f}, {0xba640, 0xba66e}, {0xba67f, 0xba69d}, - {0xba6a0, 0xba6e5}, {0xba717, 0xba71f}, {0xba722, 0xba788}, {0xba78b, 0xba7ae}, - {0xba7b0, 0xba7b7}, {0xba7f7, 0xba801}, {0xba803, 0xba805}, {0xba807, 0xba80a}, - {0xba80c, 0xba822}, {0xba840, 0xba873}, {0xba882, 0xba8b3}, {0xba8f2, 0xba8f7}, - {0xba90a, 0xba925}, {0xba930, 0xba946}, {0xba960, 0xba97c}, {0xba984, 0xba9b2}, - {0xba9e0, 0xba9e4}, {0xba9e6, 0xba9ef}, {0xba9fa, 0xba9fe}, {0xbaa00, 0xbaa28}, - {0xbaa40, 0xbaa42}, {0xbaa44, 0xbaa4b}, {0xbaa60, 0xbaa76}, {0xbaa7e, 0xbaaaf}, - {0xbaab9, 0xbaabd}, {0xbaadb, 0xbaadd}, {0xbaae0, 0xbaaea}, {0xbaaf2, 0xbaaf4}, - {0xbab01, 0xbab06}, {0xbab09, 0xbab0e}, {0xbab11, 0xbab16}, {0xbab20, 0xbab26}, - {0xbab28, 0xbab2e}, {0xbab30, 0xbab5a}, {0xbab5c, 0xbab65}, {0xbab70, 0xbabe2}, - {0xbac00, 0xbd7a3}, {0xbd7b0, 0xbd7c6}, {0xbd7cb, 0xbd7fb}, {0xbf900, 0xbfa6d}, - {0xbfa70, 0xbfad9}, {0xbfb00, 0xbfb06}, {0xbfb13, 0xbfb17}, {0xbfb1f, 0xbfb28}, - {0xbfb2a, 0xbfb36}, {0xbfb38, 0xbfb3c}, {0xbfb46, 0xbfbb1}, {0xbfbd3, 0xbfd3d}, - {0xbfd50, 0xbfd8f}, {0xbfd92, 0xbfdc7}, {0xbfdf0, 0xbfdfb}, {0xbfe70, 0xbfe74}, - {0xbfe76, 0xbfefc}, {0xbff21, 0xbff3a}, {0xbff41, 0xbff5a}, {0xbff66, 0xbffbe}, - {0xbffc2, 0xbffc7}, {0xbffca, 0xbffcf}, {0xbffd2, 0xbffd7}, {0xbffda, 0xbffdc}, - {0xc0041, 0xc005a}, {0xc0061, 0xc007a}, {0xc00c0, 0xc00d6}, {0xc00d8, 0xc00f6}, - {0xc00f8, 0xc02c1}, {0xc02c6, 0xc02d1}, {0xc02e0, 0xc02e4}, {0xc0370, 0xc0374}, - {0xc037a, 0xc037d}, {0xc0388, 0xc038a}, {0xc038e, 0xc03a1}, {0xc03a3, 0xc03f5}, - {0xc03f7, 0xc0481}, {0xc048a, 0xc052f}, {0xc0531, 0xc0556}, {0xc0561, 0xc0587}, - {0xc05d0, 0xc05ea}, {0xc05f0, 0xc05f2}, {0xc0620, 0xc064a}, {0xc0671, 0xc06d3}, - {0xc06fa, 0xc06fc}, {0xc0712, 0xc072f}, {0xc074d, 0xc07a5}, {0xc07ca, 0xc07ea}, - {0xc0800, 0xc0815}, {0xc0840, 0xc0858}, {0xc0860, 0xc086a}, {0xc08a0, 0xc08b4}, - {0xc08b6, 0xc08bd}, {0xc0904, 0xc0939}, {0xc0958, 0xc0961}, {0xc0971, 0xc0980}, - {0xc0985, 0xc098c}, {0xc0993, 0xc09a8}, {0xc09aa, 0xc09b0}, {0xc09b6, 0xc09b9}, - {0xc09df, 0xc09e1}, {0xc0a05, 0xc0a0a}, {0xc0a13, 0xc0a28}, {0xc0a2a, 0xc0a30}, - {0xc0a59, 0xc0a5c}, {0xc0a72, 0xc0a74}, {0xc0a85, 0xc0a8d}, {0xc0a8f, 0xc0a91}, - {0xc0a93, 0xc0aa8}, {0xc0aaa, 0xc0ab0}, {0xc0ab5, 0xc0ab9}, {0xc0b05, 0xc0b0c}, - {0xc0b13, 0xc0b28}, {0xc0b2a, 0xc0b30}, {0xc0b35, 0xc0b39}, {0xc0b5f, 0xc0b61}, - {0xc0b85, 0xc0b8a}, {0xc0b8e, 0xc0b90}, {0xc0b92, 0xc0b95}, {0xc0ba8, 0xc0baa}, - {0xc0bae, 0xc0bb9}, {0xc0c05, 0xc0c0c}, {0xc0c0e, 0xc0c10}, {0xc0c12, 0xc0c28}, - {0xc0c2a, 0xc0c39}, {0xc0c58, 0xc0c5a}, {0xc0c85, 0xc0c8c}, {0xc0c8e, 0xc0c90}, - {0xc0c92, 0xc0ca8}, {0xc0caa, 0xc0cb3}, {0xc0cb5, 0xc0cb9}, {0xc0d05, 0xc0d0c}, - {0xc0d0e, 0xc0d10}, {0xc0d12, 0xc0d3a}, {0xc0d54, 0xc0d56}, {0xc0d5f, 0xc0d61}, - {0xc0d7a, 0xc0d7f}, {0xc0d85, 0xc0d96}, {0xc0d9a, 0xc0db1}, {0xc0db3, 0xc0dbb}, - {0xc0dc0, 0xc0dc6}, {0xc0e01, 0xc0e30}, {0xc0e40, 0xc0e46}, {0xc0e94, 0xc0e97}, - {0xc0e99, 0xc0e9f}, {0xc0ea1, 0xc0ea3}, {0xc0ead, 0xc0eb0}, {0xc0ec0, 0xc0ec4}, - {0xc0edc, 0xc0edf}, {0xc0f40, 0xc0f47}, {0xc0f49, 0xc0f6c}, {0xc0f88, 0xc0f8c}, - {0xc1000, 0xc102a}, {0xc1050, 0xc1055}, {0xc105a, 0xc105d}, {0xc106e, 0xc1070}, - {0xc1075, 0xc1081}, {0xc10a0, 0xc10c5}, {0xc10d0, 0xc10fa}, {0xc10fc, 0xc1248}, - {0xc124a, 0xc124d}, {0xc1250, 0xc1256}, {0xc125a, 0xc125d}, {0xc1260, 0xc1288}, - {0xc128a, 0xc128d}, {0xc1290, 0xc12b0}, {0xc12b2, 0xc12b5}, {0xc12b8, 0xc12be}, - {0xc12c2, 0xc12c5}, {0xc12c8, 0xc12d6}, {0xc12d8, 0xc1310}, {0xc1312, 0xc1315}, - {0xc1318, 0xc135a}, {0xc1380, 0xc138f}, {0xc13a0, 0xc13f5}, {0xc13f8, 0xc13fd}, - {0xc1401, 0xc166c}, {0xc166f, 0xc167f}, {0xc1681, 0xc169a}, {0xc16a0, 0xc16ea}, - {0xc16f1, 0xc16f8}, {0xc1700, 0xc170c}, {0xc170e, 0xc1711}, {0xc1720, 0xc1731}, - {0xc1740, 0xc1751}, {0xc1760, 0xc176c}, {0xc176e, 0xc1770}, {0xc1780, 0xc17b3}, - {0xc1820, 0xc1877}, {0xc1880, 0xc1884}, {0xc1887, 0xc18a8}, {0xc18b0, 0xc18f5}, - {0xc1900, 0xc191e}, {0xc1950, 0xc196d}, {0xc1970, 0xc1974}, {0xc1980, 0xc19ab}, - {0xc19b0, 0xc19c9}, {0xc1a00, 0xc1a16}, {0xc1a20, 0xc1a54}, {0xc1b05, 0xc1b33}, - {0xc1b45, 0xc1b4b}, {0xc1b83, 0xc1ba0}, {0xc1bba, 0xc1be5}, {0xc1c00, 0xc1c23}, - {0xc1c4d, 0xc1c4f}, {0xc1c5a, 0xc1c7d}, {0xc1c80, 0xc1c88}, {0xc1ce9, 0xc1cec}, - {0xc1cee, 0xc1cf1}, {0xc1d00, 0xc1dbf}, {0xc1e00, 0xc1f15}, {0xc1f18, 0xc1f1d}, - {0xc1f20, 0xc1f45}, {0xc1f48, 0xc1f4d}, {0xc1f50, 0xc1f57}, {0xc1f5f, 0xc1f7d}, - {0xc1f80, 0xc1fb4}, {0xc1fb6, 0xc1fbc}, {0xc1fc2, 0xc1fc4}, {0xc1fc6, 0xc1fcc}, - {0xc1fd0, 0xc1fd3}, {0xc1fd6, 0xc1fdb}, {0xc1fe0, 0xc1fec}, {0xc1ff2, 0xc1ff4}, - {0xc1ff6, 0xc1ffc}, {0xc2090, 0xc209c}, {0xc210a, 0xc2113}, {0xc2119, 0xc211d}, - {0xc212a, 0xc212d}, {0xc212f, 0xc2139}, {0xc213c, 0xc213f}, {0xc2145, 0xc2149}, - {0xc2c00, 0xc2c2e}, {0xc2c30, 0xc2c5e}, {0xc2c60, 0xc2ce4}, {0xc2ceb, 0xc2cee}, - {0xc2d00, 0xc2d25}, {0xc2d30, 0xc2d67}, {0xc2d80, 0xc2d96}, {0xc2da0, 0xc2da6}, - {0xc2da8, 0xc2dae}, {0xc2db0, 0xc2db6}, {0xc2db8, 0xc2dbe}, {0xc2dc0, 0xc2dc6}, - {0xc2dc8, 0xc2dce}, {0xc2dd0, 0xc2dd6}, {0xc2dd8, 0xc2dde}, {0xc3031, 0xc3035}, - {0xc3041, 0xc3096}, {0xc309d, 0xc309f}, {0xc30a1, 0xc30fa}, {0xc30fc, 0xc30ff}, - {0xc3105, 0xc312e}, {0xc3131, 0xc318e}, {0xc31a0, 0xc31ba}, {0xc31f0, 0xc31ff}, - {0xc3400, 0xc4db5}, {0xc4e00, 0xc9fea}, {0xca000, 0xca48c}, {0xca4d0, 0xca4fd}, - {0xca500, 0xca60c}, {0xca610, 0xca61f}, {0xca640, 0xca66e}, {0xca67f, 0xca69d}, - {0xca6a0, 0xca6e5}, {0xca717, 0xca71f}, {0xca722, 0xca788}, {0xca78b, 0xca7ae}, - {0xca7b0, 0xca7b7}, {0xca7f7, 0xca801}, {0xca803, 0xca805}, {0xca807, 0xca80a}, - {0xca80c, 0xca822}, {0xca840, 0xca873}, {0xca882, 0xca8b3}, {0xca8f2, 0xca8f7}, - {0xca90a, 0xca925}, {0xca930, 0xca946}, {0xca960, 0xca97c}, {0xca984, 0xca9b2}, - {0xca9e0, 0xca9e4}, {0xca9e6, 0xca9ef}, {0xca9fa, 0xca9fe}, {0xcaa00, 0xcaa28}, - {0xcaa40, 0xcaa42}, {0xcaa44, 0xcaa4b}, {0xcaa60, 0xcaa76}, {0xcaa7e, 0xcaaaf}, - {0xcaab9, 0xcaabd}, {0xcaadb, 0xcaadd}, {0xcaae0, 0xcaaea}, {0xcaaf2, 0xcaaf4}, - {0xcab01, 0xcab06}, {0xcab09, 0xcab0e}, {0xcab11, 0xcab16}, {0xcab20, 0xcab26}, - {0xcab28, 0xcab2e}, {0xcab30, 0xcab5a}, {0xcab5c, 0xcab65}, {0xcab70, 0xcabe2}, - {0xcac00, 0xcd7a3}, {0xcd7b0, 0xcd7c6}, {0xcd7cb, 0xcd7fb}, {0xcf900, 0xcfa6d}, - {0xcfa70, 0xcfad9}, {0xcfb00, 0xcfb06}, {0xcfb13, 0xcfb17}, {0xcfb1f, 0xcfb28}, - {0xcfb2a, 0xcfb36}, {0xcfb38, 0xcfb3c}, {0xcfb46, 0xcfbb1}, {0xcfbd3, 0xcfd3d}, - {0xcfd50, 0xcfd8f}, {0xcfd92, 0xcfdc7}, {0xcfdf0, 0xcfdfb}, {0xcfe70, 0xcfe74}, - {0xcfe76, 0xcfefc}, {0xcff21, 0xcff3a}, {0xcff41, 0xcff5a}, {0xcff66, 0xcffbe}, - {0xcffc2, 0xcffc7}, {0xcffca, 0xcffcf}, {0xcffd2, 0xcffd7}, {0xcffda, 0xcffdc}, - {0xd0041, 0xd005a}, {0xd0061, 0xd007a}, {0xd00c0, 0xd00d6}, {0xd00d8, 0xd00f6}, - {0xd00f8, 0xd02c1}, {0xd02c6, 0xd02d1}, {0xd02e0, 0xd02e4}, {0xd0370, 0xd0374}, - {0xd037a, 0xd037d}, {0xd0388, 0xd038a}, {0xd038e, 0xd03a1}, {0xd03a3, 0xd03f5}, - {0xd03f7, 0xd0481}, {0xd048a, 0xd052f}, {0xd0531, 0xd0556}, {0xd0561, 0xd0587}, - {0xd05d0, 0xd05ea}, {0xd05f0, 0xd05f2}, {0xd0620, 0xd064a}, {0xd0671, 0xd06d3}, - {0xd06fa, 0xd06fc}, {0xd0712, 0xd072f}, {0xd074d, 0xd07a5}, {0xd07ca, 0xd07ea}, - {0xd0800, 0xd0815}, {0xd0840, 0xd0858}, {0xd0860, 0xd086a}, {0xd08a0, 0xd08b4}, - {0xd08b6, 0xd08bd}, {0xd0904, 0xd0939}, {0xd0958, 0xd0961}, {0xd0971, 0xd0980}, - {0xd0985, 0xd098c}, {0xd0993, 0xd09a8}, {0xd09aa, 0xd09b0}, {0xd09b6, 0xd09b9}, - {0xd09df, 0xd09e1}, {0xd0a05, 0xd0a0a}, {0xd0a13, 0xd0a28}, {0xd0a2a, 0xd0a30}, - {0xd0a59, 0xd0a5c}, {0xd0a72, 0xd0a74}, {0xd0a85, 0xd0a8d}, {0xd0a8f, 0xd0a91}, - {0xd0a93, 0xd0aa8}, {0xd0aaa, 0xd0ab0}, {0xd0ab5, 0xd0ab9}, {0xd0b05, 0xd0b0c}, - {0xd0b13, 0xd0b28}, {0xd0b2a, 0xd0b30}, {0xd0b35, 0xd0b39}, {0xd0b5f, 0xd0b61}, - {0xd0b85, 0xd0b8a}, {0xd0b8e, 0xd0b90}, {0xd0b92, 0xd0b95}, {0xd0ba8, 0xd0baa}, - {0xd0bae, 0xd0bb9}, {0xd0c05, 0xd0c0c}, {0xd0c0e, 0xd0c10}, {0xd0c12, 0xd0c28}, - {0xd0c2a, 0xd0c39}, {0xd0c58, 0xd0c5a}, {0xd0c85, 0xd0c8c}, {0xd0c8e, 0xd0c90}, - {0xd0c92, 0xd0ca8}, {0xd0caa, 0xd0cb3}, {0xd0cb5, 0xd0cb9}, {0xd0d05, 0xd0d0c}, - {0xd0d0e, 0xd0d10}, {0xd0d12, 0xd0d3a}, {0xd0d54, 0xd0d56}, {0xd0d5f, 0xd0d61}, - {0xd0d7a, 0xd0d7f}, {0xd0d85, 0xd0d96}, {0xd0d9a, 0xd0db1}, {0xd0db3, 0xd0dbb}, - {0xd0dc0, 0xd0dc6}, {0xd0e01, 0xd0e30}, {0xd0e40, 0xd0e46}, {0xd0e94, 0xd0e97}, - {0xd0e99, 0xd0e9f}, {0xd0ea1, 0xd0ea3}, {0xd0ead, 0xd0eb0}, {0xd0ec0, 0xd0ec4}, - {0xd0edc, 0xd0edf}, {0xd0f40, 0xd0f47}, {0xd0f49, 0xd0f6c}, {0xd0f88, 0xd0f8c}, - {0xd1000, 0xd102a}, {0xd1050, 0xd1055}, {0xd105a, 0xd105d}, {0xd106e, 0xd1070}, - {0xd1075, 0xd1081}, {0xd10a0, 0xd10c5}, {0xd10d0, 0xd10fa}, {0xd10fc, 0xd1248}, - {0xd124a, 0xd124d}, {0xd1250, 0xd1256}, {0xd125a, 0xd125d}, {0xd1260, 0xd1288}, - {0xd128a, 0xd128d}, {0xd1290, 0xd12b0}, {0xd12b2, 0xd12b5}, {0xd12b8, 0xd12be}, - {0xd12c2, 0xd12c5}, {0xd12c8, 0xd12d6}, {0xd12d8, 0xd1310}, {0xd1312, 0xd1315}, - {0xd1318, 0xd135a}, {0xd1380, 0xd138f}, {0xd13a0, 0xd13f5}, {0xd13f8, 0xd13fd}, - {0xd1401, 0xd166c}, {0xd166f, 0xd167f}, {0xd1681, 0xd169a}, {0xd16a0, 0xd16ea}, - {0xd16f1, 0xd16f8}, {0xd1700, 0xd170c}, {0xd170e, 0xd1711}, {0xd1720, 0xd1731}, - {0xd1740, 0xd1751}, {0xd1760, 0xd176c}, {0xd176e, 0xd1770}, {0xd1780, 0xd17b3}, - {0xd1820, 0xd1877}, {0xd1880, 0xd1884}, {0xd1887, 0xd18a8}, {0xd18b0, 0xd18f5}, - {0xd1900, 0xd191e}, {0xd1950, 0xd196d}, {0xd1970, 0xd1974}, {0xd1980, 0xd19ab}, - {0xd19b0, 0xd19c9}, {0xd1a00, 0xd1a16}, {0xd1a20, 0xd1a54}, {0xd1b05, 0xd1b33}, - {0xd1b45, 0xd1b4b}, {0xd1b83, 0xd1ba0}, {0xd1bba, 0xd1be5}, {0xd1c00, 0xd1c23}, - {0xd1c4d, 0xd1c4f}, {0xd1c5a, 0xd1c7d}, {0xd1c80, 0xd1c88}, {0xd1ce9, 0xd1cec}, - {0xd1cee, 0xd1cf1}, {0xd1d00, 0xd1dbf}, {0xd1e00, 0xd1f15}, {0xd1f18, 0xd1f1d}, - {0xd1f20, 0xd1f45}, {0xd1f48, 0xd1f4d}, {0xd1f50, 0xd1f57}, {0xd1f5f, 0xd1f7d}, - {0xd1f80, 0xd1fb4}, {0xd1fb6, 0xd1fbc}, {0xd1fc2, 0xd1fc4}, {0xd1fc6, 0xd1fcc}, - {0xd1fd0, 0xd1fd3}, {0xd1fd6, 0xd1fdb}, {0xd1fe0, 0xd1fec}, {0xd1ff2, 0xd1ff4}, - {0xd1ff6, 0xd1ffc}, {0xd2090, 0xd209c}, {0xd210a, 0xd2113}, {0xd2119, 0xd211d}, - {0xd212a, 0xd212d}, {0xd212f, 0xd2139}, {0xd213c, 0xd213f}, {0xd2145, 0xd2149}, - {0xd2c00, 0xd2c2e}, {0xd2c30, 0xd2c5e}, {0xd2c60, 0xd2ce4}, {0xd2ceb, 0xd2cee}, - {0xd2d00, 0xd2d25}, {0xd2d30, 0xd2d67}, {0xd2d80, 0xd2d96}, {0xd2da0, 0xd2da6}, - {0xd2da8, 0xd2dae}, {0xd2db0, 0xd2db6}, {0xd2db8, 0xd2dbe}, {0xd2dc0, 0xd2dc6}, - {0xd2dc8, 0xd2dce}, {0xd2dd0, 0xd2dd6}, {0xd2dd8, 0xd2dde}, {0xd3031, 0xd3035}, - {0xd3041, 0xd3096}, {0xd309d, 0xd309f}, {0xd30a1, 0xd30fa}, {0xd30fc, 0xd30ff}, - {0xd3105, 0xd312e}, {0xd3131, 0xd318e}, {0xd31a0, 0xd31ba}, {0xd31f0, 0xd31ff}, - {0xd3400, 0xd4db5}, {0xd4e00, 0xd9fea}, {0xda000, 0xda48c}, {0xda4d0, 0xda4fd}, - {0xda500, 0xda60c}, {0xda610, 0xda61f}, {0xda640, 0xda66e}, {0xda67f, 0xda69d}, - {0xda6a0, 0xda6e5}, {0xda717, 0xda71f}, {0xda722, 0xda788}, {0xda78b, 0xda7ae}, - {0xda7b0, 0xda7b7}, {0xda7f7, 0xda801}, {0xda803, 0xda805}, {0xda807, 0xda80a}, - {0xda80c, 0xda822}, {0xda840, 0xda873}, {0xda882, 0xda8b3}, {0xda8f2, 0xda8f7}, - {0xda90a, 0xda925}, {0xda930, 0xda946}, {0xda960, 0xda97c}, {0xda984, 0xda9b2}, - {0xda9e0, 0xda9e4}, {0xda9e6, 0xda9ef}, {0xda9fa, 0xda9fe}, {0xdaa00, 0xdaa28}, - {0xdaa40, 0xdaa42}, {0xdaa44, 0xdaa4b}, {0xdaa60, 0xdaa76}, {0xdaa7e, 0xdaaaf}, - {0xdaab9, 0xdaabd}, {0xdaadb, 0xdaadd}, {0xdaae0, 0xdaaea}, {0xdaaf2, 0xdaaf4}, - {0xdab01, 0xdab06}, {0xdab09, 0xdab0e}, {0xdab11, 0xdab16}, {0xdab20, 0xdab26}, - {0xdab28, 0xdab2e}, {0xdab30, 0xdab5a}, {0xdab5c, 0xdab65}, {0xdab70, 0xdabe2}, - {0xdac00, 0xdd7a3}, {0xdd7b0, 0xdd7c6}, {0xdd7cb, 0xdd7fb}, {0xdf900, 0xdfa6d}, - {0xdfa70, 0xdfad9}, {0xdfb00, 0xdfb06}, {0xdfb13, 0xdfb17}, {0xdfb1f, 0xdfb28}, - {0xdfb2a, 0xdfb36}, {0xdfb38, 0xdfb3c}, {0xdfb46, 0xdfbb1}, {0xdfbd3, 0xdfd3d}, - {0xdfd50, 0xdfd8f}, {0xdfd92, 0xdfdc7}, {0xdfdf0, 0xdfdfb}, {0xdfe70, 0xdfe74}, - {0xdfe76, 0xdfefc}, {0xdff21, 0xdff3a}, {0xdff41, 0xdff5a}, {0xdff66, 0xdffbe}, - {0xdffc2, 0xdffc7}, {0xdffca, 0xdffcf}, {0xdffd2, 0xdffd7}, {0xdffda, 0xdffdc}, - {0xe0041, 0xe005a}, {0xe0061, 0xe007a}, {0xe00c0, 0xe00d6}, {0xe00d8, 0xe00f6}, - {0xe00f8, 0xe02c1}, {0xe02c6, 0xe02d1}, {0xe02e0, 0xe02e4}, {0xe0370, 0xe0374}, - {0xe037a, 0xe037d}, {0xe0388, 0xe038a}, {0xe038e, 0xe03a1}, {0xe03a3, 0xe03f5}, - {0xe03f7, 0xe0481}, {0xe048a, 0xe052f}, {0xe0531, 0xe0556}, {0xe0561, 0xe0587}, - {0xe05d0, 0xe05ea}, {0xe05f0, 0xe05f2}, {0xe0620, 0xe064a}, {0xe0671, 0xe06d3}, - {0xe06fa, 0xe06fc}, {0xe0712, 0xe072f}, {0xe074d, 0xe07a5}, {0xe07ca, 0xe07ea}, - {0xe0800, 0xe0815}, {0xe0840, 0xe0858}, {0xe0860, 0xe086a}, {0xe08a0, 0xe08b4}, - {0xe08b6, 0xe08bd}, {0xe0904, 0xe0939}, {0xe0958, 0xe0961}, {0xe0971, 0xe0980}, - {0xe0985, 0xe098c}, {0xe0993, 0xe09a8}, {0xe09aa, 0xe09b0}, {0xe09b6, 0xe09b9}, - {0xe09df, 0xe09e1}, {0xe0a05, 0xe0a0a}, {0xe0a13, 0xe0a28}, {0xe0a2a, 0xe0a30}, - {0xe0a59, 0xe0a5c}, {0xe0a72, 0xe0a74}, {0xe0a85, 0xe0a8d}, {0xe0a8f, 0xe0a91}, - {0xe0a93, 0xe0aa8}, {0xe0aaa, 0xe0ab0}, {0xe0ab5, 0xe0ab9}, {0xe0b05, 0xe0b0c}, - {0xe0b13, 0xe0b28}, {0xe0b2a, 0xe0b30}, {0xe0b35, 0xe0b39}, {0xe0b5f, 0xe0b61}, - {0xe0b85, 0xe0b8a}, {0xe0b8e, 0xe0b90}, {0xe0b92, 0xe0b95}, {0xe0ba8, 0xe0baa}, - {0xe0bae, 0xe0bb9}, {0xe0c05, 0xe0c0c}, {0xe0c0e, 0xe0c10}, {0xe0c12, 0xe0c28}, - {0xe0c2a, 0xe0c39}, {0xe0c58, 0xe0c5a}, {0xe0c85, 0xe0c8c}, {0xe0c8e, 0xe0c90}, - {0xe0c92, 0xe0ca8}, {0xe0caa, 0xe0cb3}, {0xe0cb5, 0xe0cb9}, {0xe0d05, 0xe0d0c}, - {0xe0d0e, 0xe0d10}, {0xe0d12, 0xe0d3a}, {0xe0d54, 0xe0d56}, {0xe0d5f, 0xe0d61}, - {0xe0d7a, 0xe0d7f}, {0xe0d85, 0xe0d96}, {0xe0d9a, 0xe0db1}, {0xe0db3, 0xe0dbb}, - {0xe0dc0, 0xe0dc6}, {0xe0e01, 0xe0e30}, {0xe0e40, 0xe0e46}, {0xe0e94, 0xe0e97}, - {0xe0e99, 0xe0e9f}, {0xe0ea1, 0xe0ea3}, {0xe0ead, 0xe0eb0}, {0xe0ec0, 0xe0ec4}, - {0xe0edc, 0xe0edf}, {0xe0f40, 0xe0f47}, {0xe0f49, 0xe0f6c}, {0xe0f88, 0xe0f8c}, - {0xe1000, 0xe102a}, {0xe1050, 0xe1055}, {0xe105a, 0xe105d}, {0xe106e, 0xe1070}, - {0xe1075, 0xe1081}, {0xe10a0, 0xe10c5}, {0xe10d0, 0xe10fa}, {0xe10fc, 0xe1248}, - {0xe124a, 0xe124d}, {0xe1250, 0xe1256}, {0xe125a, 0xe125d}, {0xe1260, 0xe1288}, - {0xe128a, 0xe128d}, {0xe1290, 0xe12b0}, {0xe12b2, 0xe12b5}, {0xe12b8, 0xe12be}, - {0xe12c2, 0xe12c5}, {0xe12c8, 0xe12d6}, {0xe12d8, 0xe1310}, {0xe1312, 0xe1315}, - {0xe1318, 0xe135a}, {0xe1380, 0xe138f}, {0xe13a0, 0xe13f5}, {0xe13f8, 0xe13fd}, - {0xe1401, 0xe166c}, {0xe166f, 0xe167f}, {0xe1681, 0xe169a}, {0xe16a0, 0xe16ea}, - {0xe16f1, 0xe16f8}, {0xe1700, 0xe170c}, {0xe170e, 0xe1711}, {0xe1720, 0xe1731}, - {0xe1740, 0xe1751}, {0xe1760, 0xe176c}, {0xe176e, 0xe1770}, {0xe1780, 0xe17b3}, - {0xe1820, 0xe1877}, {0xe1880, 0xe1884}, {0xe1887, 0xe18a8}, {0xe18b0, 0xe18f5}, - {0xe1900, 0xe191e}, {0xe1950, 0xe196d}, {0xe1970, 0xe1974}, {0xe1980, 0xe19ab}, - {0xe19b0, 0xe19c9}, {0xe1a00, 0xe1a16}, {0xe1a20, 0xe1a54}, {0xe1b05, 0xe1b33}, - {0xe1b45, 0xe1b4b}, {0xe1b83, 0xe1ba0}, {0xe1bba, 0xe1be5}, {0xe1c00, 0xe1c23}, - {0xe1c4d, 0xe1c4f}, {0xe1c5a, 0xe1c7d}, {0xe1c80, 0xe1c88}, {0xe1ce9, 0xe1cec}, - {0xe1cee, 0xe1cf1}, {0xe1d00, 0xe1dbf}, {0xe1e00, 0xe1f15}, {0xe1f18, 0xe1f1d}, - {0xe1f20, 0xe1f45}, {0xe1f48, 0xe1f4d}, {0xe1f50, 0xe1f57}, {0xe1f5f, 0xe1f7d}, - {0xe1f80, 0xe1fb4}, {0xe1fb6, 0xe1fbc}, {0xe1fc2, 0xe1fc4}, {0xe1fc6, 0xe1fcc}, - {0xe1fd0, 0xe1fd3}, {0xe1fd6, 0xe1fdb}, {0xe1fe0, 0xe1fec}, {0xe1ff2, 0xe1ff4}, - {0xe1ff6, 0xe1ffc}, {0xe2090, 0xe209c}, {0xe210a, 0xe2113}, {0xe2119, 0xe211d}, - {0xe212a, 0xe212d}, {0xe212f, 0xe2139}, {0xe213c, 0xe213f}, {0xe2145, 0xe2149}, - {0xe2c00, 0xe2c2e}, {0xe2c30, 0xe2c5e}, {0xe2c60, 0xe2ce4}, {0xe2ceb, 0xe2cee}, - {0xe2d00, 0xe2d25}, {0xe2d30, 0xe2d67}, {0xe2d80, 0xe2d96}, {0xe2da0, 0xe2da6}, - {0xe2da8, 0xe2dae}, {0xe2db0, 0xe2db6}, {0xe2db8, 0xe2dbe}, {0xe2dc0, 0xe2dc6}, - {0xe2dc8, 0xe2dce}, {0xe2dd0, 0xe2dd6}, {0xe2dd8, 0xe2dde}, {0xe3031, 0xe3035}, - {0xe3041, 0xe3096}, {0xe309d, 0xe309f}, {0xe30a1, 0xe30fa}, {0xe30fc, 0xe30ff}, - {0xe3105, 0xe312e}, {0xe3131, 0xe318e}, {0xe31a0, 0xe31ba}, {0xe31f0, 0xe31ff}, - {0xe3400, 0xe4db5}, {0xe4e00, 0xe9fea}, {0xea000, 0xea48c}, {0xea4d0, 0xea4fd}, - {0xea500, 0xea60c}, {0xea610, 0xea61f}, {0xea640, 0xea66e}, {0xea67f, 0xea69d}, - {0xea6a0, 0xea6e5}, {0xea717, 0xea71f}, {0xea722, 0xea788}, {0xea78b, 0xea7ae}, - {0xea7b0, 0xea7b7}, {0xea7f7, 0xea801}, {0xea803, 0xea805}, {0xea807, 0xea80a}, - {0xea80c, 0xea822}, {0xea840, 0xea873}, {0xea882, 0xea8b3}, {0xea8f2, 0xea8f7}, - {0xea90a, 0xea925}, {0xea930, 0xea946}, {0xea960, 0xea97c}, {0xea984, 0xea9b2}, - {0xea9e0, 0xea9e4}, {0xea9e6, 0xea9ef}, {0xea9fa, 0xea9fe}, {0xeaa00, 0xeaa28}, - {0xeaa40, 0xeaa42}, {0xeaa44, 0xeaa4b}, {0xeaa60, 0xeaa76}, {0xeaa7e, 0xeaaaf}, - {0xeaab9, 0xeaabd}, {0xeaadb, 0xeaadd}, {0xeaae0, 0xeaaea}, {0xeaaf2, 0xeaaf4}, - {0xeab01, 0xeab06}, {0xeab09, 0xeab0e}, {0xeab11, 0xeab16}, {0xeab20, 0xeab26}, - {0xeab28, 0xeab2e}, {0xeab30, 0xeab5a}, {0xeab5c, 0xeab65}, {0xeab70, 0xeabe2}, - {0xeac00, 0xed7a3}, {0xed7b0, 0xed7c6}, {0xed7cb, 0xed7fb}, {0xef900, 0xefa6d}, - {0xefa70, 0xefad9}, {0xefb00, 0xefb06}, {0xefb13, 0xefb17}, {0xefb1f, 0xefb28}, - {0xefb2a, 0xefb36}, {0xefb38, 0xefb3c}, {0xefb46, 0xefbb1}, {0xefbd3, 0xefd3d}, - {0xefd50, 0xefd8f}, {0xefd92, 0xefdc7}, {0xefdf0, 0xefdfb}, {0xefe70, 0xefe74}, - {0xefe76, 0xefefc}, {0xeff21, 0xeff3a}, {0xeff41, 0xeff5a}, {0xeff66, 0xeffbe}, - {0xeffc2, 0xeffc7}, {0xeffca, 0xeffcf}, {0xeffd2, 0xeffd7}, {0xeffda, 0xeffdc}, - {0xf0041, 0xf005a}, {0xf0061, 0xf007a}, {0xf00c0, 0xf00d6}, {0xf00d8, 0xf00f6}, - {0xf00f8, 0xf02c1}, {0xf02c6, 0xf02d1}, {0xf02e0, 0xf02e4}, {0xf0370, 0xf0374}, - {0xf037a, 0xf037d}, {0xf0388, 0xf038a}, {0xf038e, 0xf03a1}, {0xf03a3, 0xf03f5}, - {0xf03f7, 0xf0481}, {0xf048a, 0xf052f}, {0xf0531, 0xf0556}, {0xf0561, 0xf0587}, - {0xf05d0, 0xf05ea}, {0xf05f0, 0xf05f2}, {0xf0620, 0xf064a}, {0xf0671, 0xf06d3}, - {0xf06fa, 0xf06fc}, {0xf0712, 0xf072f}, {0xf074d, 0xf07a5}, {0xf07ca, 0xf07ea}, - {0xf0800, 0xf0815}, {0xf0840, 0xf0858}, {0xf0860, 0xf086a}, {0xf08a0, 0xf08b4}, - {0xf08b6, 0xf08bd}, {0xf0904, 0xf0939}, {0xf0958, 0xf0961}, {0xf0971, 0xf0980}, - {0xf0985, 0xf098c}, {0xf0993, 0xf09a8}, {0xf09aa, 0xf09b0}, {0xf09b6, 0xf09b9}, - {0xf09df, 0xf09e1}, {0xf0a05, 0xf0a0a}, {0xf0a13, 0xf0a28}, {0xf0a2a, 0xf0a30}, - {0xf0a59, 0xf0a5c}, {0xf0a72, 0xf0a74}, {0xf0a85, 0xf0a8d}, {0xf0a8f, 0xf0a91}, - {0xf0a93, 0xf0aa8}, {0xf0aaa, 0xf0ab0}, {0xf0ab5, 0xf0ab9}, {0xf0b05, 0xf0b0c}, - {0xf0b13, 0xf0b28}, {0xf0b2a, 0xf0b30}, {0xf0b35, 0xf0b39}, {0xf0b5f, 0xf0b61}, - {0xf0b85, 0xf0b8a}, {0xf0b8e, 0xf0b90}, {0xf0b92, 0xf0b95}, {0xf0ba8, 0xf0baa}, - {0xf0bae, 0xf0bb9}, {0xf0c05, 0xf0c0c}, {0xf0c0e, 0xf0c10}, {0xf0c12, 0xf0c28}, - {0xf0c2a, 0xf0c39}, {0xf0c58, 0xf0c5a}, {0xf0c85, 0xf0c8c}, {0xf0c8e, 0xf0c90}, - {0xf0c92, 0xf0ca8}, {0xf0caa, 0xf0cb3}, {0xf0cb5, 0xf0cb9}, {0xf0d05, 0xf0d0c}, - {0xf0d0e, 0xf0d10}, {0xf0d12, 0xf0d3a}, {0xf0d54, 0xf0d56}, {0xf0d5f, 0xf0d61}, - {0xf0d7a, 0xf0d7f}, {0xf0d85, 0xf0d96}, {0xf0d9a, 0xf0db1}, {0xf0db3, 0xf0dbb}, - {0xf0dc0, 0xf0dc6}, {0xf0e01, 0xf0e30}, {0xf0e40, 0xf0e46}, {0xf0e94, 0xf0e97}, - {0xf0e99, 0xf0e9f}, {0xf0ea1, 0xf0ea3}, {0xf0ead, 0xf0eb0}, {0xf0ec0, 0xf0ec4}, - {0xf0edc, 0xf0edf}, {0xf0f40, 0xf0f47}, {0xf0f49, 0xf0f6c}, {0xf0f88, 0xf0f8c}, - {0xf1000, 0xf102a}, {0xf1050, 0xf1055}, {0xf105a, 0xf105d}, {0xf106e, 0xf1070}, - {0xf1075, 0xf1081}, {0xf10a0, 0xf10c5}, {0xf10d0, 0xf10fa}, {0xf10fc, 0xf1248}, - {0xf124a, 0xf124d}, {0xf1250, 0xf1256}, {0xf125a, 0xf125d}, {0xf1260, 0xf1288}, - {0xf128a, 0xf128d}, {0xf1290, 0xf12b0}, {0xf12b2, 0xf12b5}, {0xf12b8, 0xf12be}, - {0xf12c2, 0xf12c5}, {0xf12c8, 0xf12d6}, {0xf12d8, 0xf1310}, {0xf1312, 0xf1315}, - {0xf1318, 0xf135a}, {0xf1380, 0xf138f}, {0xf13a0, 0xf13f5}, {0xf13f8, 0xf13fd}, - {0xf1401, 0xf166c}, {0xf166f, 0xf167f}, {0xf1681, 0xf169a}, {0xf16a0, 0xf16ea}, - {0xf16f1, 0xf16f8}, {0xf1700, 0xf170c}, {0xf170e, 0xf1711}, {0xf1720, 0xf1731}, - {0xf1740, 0xf1751}, {0xf1760, 0xf176c}, {0xf176e, 0xf1770}, {0xf1780, 0xf17b3}, - {0xf1820, 0xf1877}, {0xf1880, 0xf1884}, {0xf1887, 0xf18a8}, {0xf18b0, 0xf18f5}, - {0xf1900, 0xf191e}, {0xf1950, 0xf196d}, {0xf1970, 0xf1974}, {0xf1980, 0xf19ab}, - {0xf19b0, 0xf19c9}, {0xf1a00, 0xf1a16}, {0xf1a20, 0xf1a54}, {0xf1b05, 0xf1b33}, - {0xf1b45, 0xf1b4b}, {0xf1b83, 0xf1ba0}, {0xf1bba, 0xf1be5}, {0xf1c00, 0xf1c23}, - {0xf1c4d, 0xf1c4f}, {0xf1c5a, 0xf1c7d}, {0xf1c80, 0xf1c88}, {0xf1ce9, 0xf1cec}, - {0xf1cee, 0xf1cf1}, {0xf1d00, 0xf1dbf}, {0xf1e00, 0xf1f15}, {0xf1f18, 0xf1f1d}, - {0xf1f20, 0xf1f45}, {0xf1f48, 0xf1f4d}, {0xf1f50, 0xf1f57}, {0xf1f5f, 0xf1f7d}, - {0xf1f80, 0xf1fb4}, {0xf1fb6, 0xf1fbc}, {0xf1fc2, 0xf1fc4}, {0xf1fc6, 0xf1fcc}, - {0xf1fd0, 0xf1fd3}, {0xf1fd6, 0xf1fdb}, {0xf1fe0, 0xf1fec}, {0xf1ff2, 0xf1ff4}, - {0xf1ff6, 0xf1ffc}, {0xf2090, 0xf209c}, {0xf210a, 0xf2113}, {0xf2119, 0xf211d}, - {0xf212a, 0xf212d}, {0xf212f, 0xf2139}, {0xf213c, 0xf213f}, {0xf2145, 0xf2149}, - {0xf2c00, 0xf2c2e}, {0xf2c30, 0xf2c5e}, {0xf2c60, 0xf2ce4}, {0xf2ceb, 0xf2cee}, - {0xf2d00, 0xf2d25}, {0xf2d30, 0xf2d67}, {0xf2d80, 0xf2d96}, {0xf2da0, 0xf2da6}, - {0xf2da8, 0xf2dae}, {0xf2db0, 0xf2db6}, {0xf2db8, 0xf2dbe}, {0xf2dc0, 0xf2dc6}, - {0xf2dc8, 0xf2dce}, {0xf2dd0, 0xf2dd6}, {0xf2dd8, 0xf2dde}, {0xf3031, 0xf3035}, - {0xf3041, 0xf3096}, {0xf309d, 0xf309f}, {0xf30a1, 0xf30fa}, {0xf30fc, 0xf30ff}, - {0xf3105, 0xf312e}, {0xf3131, 0xf318e}, {0xf31a0, 0xf31ba}, {0xf31f0, 0xf31ff}, - {0xf3400, 0xf4db5}, {0xf4e00, 0xf9fea}, {0xfa000, 0xfa48c}, {0xfa4d0, 0xfa4fd}, - {0xfa500, 0xfa60c}, {0xfa610, 0xfa61f}, {0xfa640, 0xfa66e}, {0xfa67f, 0xfa69d}, - {0xfa6a0, 0xfa6e5}, {0xfa717, 0xfa71f}, {0xfa722, 0xfa788}, {0xfa78b, 0xfa7ae}, - {0xfa7b0, 0xfa7b7}, {0xfa7f7, 0xfa801}, {0xfa803, 0xfa805}, {0xfa807, 0xfa80a}, - {0xfa80c, 0xfa822}, {0xfa840, 0xfa873}, {0xfa882, 0xfa8b3}, {0xfa8f2, 0xfa8f7}, - {0xfa90a, 0xfa925}, {0xfa930, 0xfa946}, {0xfa960, 0xfa97c}, {0xfa984, 0xfa9b2}, - {0xfa9e0, 0xfa9e4}, {0xfa9e6, 0xfa9ef}, {0xfa9fa, 0xfa9fe}, {0xfaa00, 0xfaa28}, - {0xfaa40, 0xfaa42}, {0xfaa44, 0xfaa4b}, {0xfaa60, 0xfaa76}, {0xfaa7e, 0xfaaaf}, - {0xfaab9, 0xfaabd}, {0xfaadb, 0xfaadd}, {0xfaae0, 0xfaaea}, {0xfaaf2, 0xfaaf4}, - {0xfab01, 0xfab06}, {0xfab09, 0xfab0e}, {0xfab11, 0xfab16}, {0xfab20, 0xfab26}, - {0xfab28, 0xfab2e}, {0xfab30, 0xfab5a}, {0xfab5c, 0xfab65}, {0xfab70, 0xfabe2}, - {0xfac00, 0xfd7a3}, {0xfd7b0, 0xfd7c6}, {0xfd7cb, 0xfd7fb}, {0xff900, 0xffa6d}, - {0xffa70, 0xffad9}, {0xffb00, 0xffb06}, {0xffb13, 0xffb17}, {0xffb1f, 0xffb28}, - {0xffb2a, 0xffb36}, {0xffb38, 0xffb3c}, {0xffb46, 0xffbb1}, {0xffbd3, 0xffd3d}, - {0xffd50, 0xffd8f}, {0xffd92, 0xffdc7}, {0xffdf0, 0xffdfb}, {0xffe70, 0xffe74}, - {0xffe76, 0xffefc}, {0xfff21, 0xfff3a}, {0xfff41, 0xfff5a}, {0xfff66, 0xfffbe}, - {0xfffc2, 0xfffc7}, {0xfffca, 0xfffcf}, {0xfffd2, 0xfffd7}, {0xfffda, 0xfffdc}, - {0x100041, 0x10005a}, {0x100061, 0x10007a}, {0x1000c0, 0x1000d6}, {0x1000d8, 0x1000f6}, - {0x1000f8, 0x1002c1}, {0x1002c6, 0x1002d1}, {0x1002e0, 0x1002e4}, {0x100370, 0x100374}, - {0x10037a, 0x10037d}, {0x100388, 0x10038a}, {0x10038e, 0x1003a1}, {0x1003a3, 0x1003f5}, - {0x1003f7, 0x100481}, {0x10048a, 0x10052f}, {0x100531, 0x100556}, {0x100561, 0x100587}, - {0x1005d0, 0x1005ea}, {0x1005f0, 0x1005f2}, {0x100620, 0x10064a}, {0x100671, 0x1006d3}, - {0x1006fa, 0x1006fc}, {0x100712, 0x10072f}, {0x10074d, 0x1007a5}, {0x1007ca, 0x1007ea}, - {0x100800, 0x100815}, {0x100840, 0x100858}, {0x100860, 0x10086a}, {0x1008a0, 0x1008b4}, - {0x1008b6, 0x1008bd}, {0x100904, 0x100939}, {0x100958, 0x100961}, {0x100971, 0x100980}, - {0x100985, 0x10098c}, {0x100993, 0x1009a8}, {0x1009aa, 0x1009b0}, {0x1009b6, 0x1009b9}, - {0x1009df, 0x1009e1}, {0x100a05, 0x100a0a}, {0x100a13, 0x100a28}, {0x100a2a, 0x100a30}, - {0x100a59, 0x100a5c}, {0x100a72, 0x100a74}, {0x100a85, 0x100a8d}, {0x100a8f, 0x100a91}, - {0x100a93, 0x100aa8}, {0x100aaa, 0x100ab0}, {0x100ab5, 0x100ab9}, {0x100b05, 0x100b0c}, - {0x100b13, 0x100b28}, {0x100b2a, 0x100b30}, {0x100b35, 0x100b39}, {0x100b5f, 0x100b61}, - {0x100b85, 0x100b8a}, {0x100b8e, 0x100b90}, {0x100b92, 0x100b95}, {0x100ba8, 0x100baa}, - {0x100bae, 0x100bb9}, {0x100c05, 0x100c0c}, {0x100c0e, 0x100c10}, {0x100c12, 0x100c28}, - {0x100c2a, 0x100c39}, {0x100c58, 0x100c5a}, {0x100c85, 0x100c8c}, {0x100c8e, 0x100c90}, - {0x100c92, 0x100ca8}, {0x100caa, 0x100cb3}, {0x100cb5, 0x100cb9}, {0x100d05, 0x100d0c}, - {0x100d0e, 0x100d10}, {0x100d12, 0x100d3a}, {0x100d54, 0x100d56}, {0x100d5f, 0x100d61}, - {0x100d7a, 0x100d7f}, {0x100d85, 0x100d96}, {0x100d9a, 0x100db1}, {0x100db3, 0x100dbb}, - {0x100dc0, 0x100dc6}, {0x100e01, 0x100e30}, {0x100e40, 0x100e46}, {0x100e94, 0x100e97}, - {0x100e99, 0x100e9f}, {0x100ea1, 0x100ea3}, {0x100ead, 0x100eb0}, {0x100ec0, 0x100ec4}, - {0x100edc, 0x100edf}, {0x100f40, 0x100f47}, {0x100f49, 0x100f6c}, {0x100f88, 0x100f8c}, - {0x101000, 0x10102a}, {0x101050, 0x101055}, {0x10105a, 0x10105d}, {0x10106e, 0x101070}, - {0x101075, 0x101081}, {0x1010a0, 0x1010c5}, {0x1010d0, 0x1010fa}, {0x1010fc, 0x101248}, - {0x10124a, 0x10124d}, {0x101250, 0x101256}, {0x10125a, 0x10125d}, {0x101260, 0x101288}, - {0x10128a, 0x10128d}, {0x101290, 0x1012b0}, {0x1012b2, 0x1012b5}, {0x1012b8, 0x1012be}, - {0x1012c2, 0x1012c5}, {0x1012c8, 0x1012d6}, {0x1012d8, 0x101310}, {0x101312, 0x101315}, - {0x101318, 0x10135a}, {0x101380, 0x10138f}, {0x1013a0, 0x1013f5}, {0x1013f8, 0x1013fd}, - {0x101401, 0x10166c}, {0x10166f, 0x10167f}, {0x101681, 0x10169a}, {0x1016a0, 0x1016ea}, - {0x1016f1, 0x1016f8}, {0x101700, 0x10170c}, {0x10170e, 0x101711}, {0x101720, 0x101731}, - {0x101740, 0x101751}, {0x101760, 0x10176c}, {0x10176e, 0x101770}, {0x101780, 0x1017b3}, - {0x101820, 0x101877}, {0x101880, 0x101884}, {0x101887, 0x1018a8}, {0x1018b0, 0x1018f5}, - {0x101900, 0x10191e}, {0x101950, 0x10196d}, {0x101970, 0x101974}, {0x101980, 0x1019ab}, - {0x1019b0, 0x1019c9}, {0x101a00, 0x101a16}, {0x101a20, 0x101a54}, {0x101b05, 0x101b33}, - {0x101b45, 0x101b4b}, {0x101b83, 0x101ba0}, {0x101bba, 0x101be5}, {0x101c00, 0x101c23}, - {0x101c4d, 0x101c4f}, {0x101c5a, 0x101c7d}, {0x101c80, 0x101c88}, {0x101ce9, 0x101cec}, - {0x101cee, 0x101cf1}, {0x101d00, 0x101dbf}, {0x101e00, 0x101f15}, {0x101f18, 0x101f1d}, - {0x101f20, 0x101f45}, {0x101f48, 0x101f4d}, {0x101f50, 0x101f57}, {0x101f5f, 0x101f7d}, - {0x101f80, 0x101fb4}, {0x101fb6, 0x101fbc}, {0x101fc2, 0x101fc4}, {0x101fc6, 0x101fcc}, - {0x101fd0, 0x101fd3}, {0x101fd6, 0x101fdb}, {0x101fe0, 0x101fec}, {0x101ff2, 0x101ff4}, - {0x101ff6, 0x101ffc}, {0x102090, 0x10209c}, {0x10210a, 0x102113}, {0x102119, 0x10211d}, - {0x10212a, 0x10212d}, {0x10212f, 0x102139}, {0x10213c, 0x10213f}, {0x102145, 0x102149}, - {0x102c00, 0x102c2e}, {0x102c30, 0x102c5e}, {0x102c60, 0x102ce4}, {0x102ceb, 0x102cee}, - {0x102d00, 0x102d25}, {0x102d30, 0x102d67}, {0x102d80, 0x102d96}, {0x102da0, 0x102da6}, - {0x102da8, 0x102dae}, {0x102db0, 0x102db6}, {0x102db8, 0x102dbe}, {0x102dc0, 0x102dc6}, - {0x102dc8, 0x102dce}, {0x102dd0, 0x102dd6}, {0x102dd8, 0x102dde}, {0x103031, 0x103035}, - {0x103041, 0x103096}, {0x10309d, 0x10309f}, {0x1030a1, 0x1030fa}, {0x1030fc, 0x1030ff}, - {0x103105, 0x10312e}, {0x103131, 0x10318e}, {0x1031a0, 0x1031ba}, {0x1031f0, 0x1031ff}, - {0x103400, 0x104db5}, {0x104e00, 0x109fea}, {0x10a000, 0x10a48c}, {0x10a4d0, 0x10a4fd}, - {0x10a500, 0x10a60c}, {0x10a610, 0x10a61f}, {0x10a640, 0x10a66e}, {0x10a67f, 0x10a69d}, - {0x10a6a0, 0x10a6e5}, {0x10a717, 0x10a71f}, {0x10a722, 0x10a788}, {0x10a78b, 0x10a7ae}, - {0x10a7b0, 0x10a7b7}, {0x10a7f7, 0x10a801}, {0x10a803, 0x10a805}, {0x10a807, 0x10a80a}, - {0x10a80c, 0x10a822}, {0x10a840, 0x10a873}, {0x10a882, 0x10a8b3}, {0x10a8f2, 0x10a8f7}, - {0x10a90a, 0x10a925}, {0x10a930, 0x10a946}, {0x10a960, 0x10a97c}, {0x10a984, 0x10a9b2}, - {0x10a9e0, 0x10a9e4}, {0x10a9e6, 0x10a9ef}, {0x10a9fa, 0x10a9fe}, {0x10aa00, 0x10aa28}, - {0x10aa40, 0x10aa42}, {0x10aa44, 0x10aa4b}, {0x10aa60, 0x10aa76}, {0x10aa7e, 0x10aaaf}, - {0x10aab9, 0x10aabd}, {0x10aadb, 0x10aadd}, {0x10aae0, 0x10aaea}, {0x10aaf2, 0x10aaf4}, - {0x10ab01, 0x10ab06}, {0x10ab09, 0x10ab0e}, {0x10ab11, 0x10ab16}, {0x10ab20, 0x10ab26}, - {0x10ab28, 0x10ab2e}, {0x10ab30, 0x10ab5a}, {0x10ab5c, 0x10ab65}, {0x10ab70, 0x10abe2}, - {0x10ac00, 0x10d7a3}, {0x10d7b0, 0x10d7c6}, {0x10d7cb, 0x10d7fb}, {0x10f900, 0x10fa6d}, - {0x10fa70, 0x10fad9}, {0x10fb00, 0x10fb06}, {0x10fb13, 0x10fb17}, {0x10fb1f, 0x10fb28}, - {0x10fb2a, 0x10fb36}, {0x10fb38, 0x10fb3c}, {0x10fb46, 0x10fbb1}, {0x10fbd3, 0x10fd3d}, - {0x10fd50, 0x10fd8f}, {0x10fd92, 0x10fdc7}, {0x10fdf0, 0x10fdfb}, {0x10fe70, 0x10fe74}, - {0x10fe76, 0x10fefc}, {0x10ff21, 0x10ff3a}, {0x10ff41, 0x10ff5a}, {0x10ff66, 0x10ffbe}, - {0x10ffc2, 0x10ffc7}, {0x10ffca, 0x10ffcf}, {0x10ffd2, 0x10ffd7}, {0x10ffda, 0x10ffdc} + ,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d}, + {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10280, 0x1029c}, {0x102a0, 0x102d0}, + {0x10300, 0x1031f}, {0x1032d, 0x10340}, {0x10342, 0x10349}, {0x10350, 0x10375}, + {0x10380, 0x1039d}, {0x103a0, 0x103c3}, {0x103c8, 0x103cf}, {0x10400, 0x1049d}, + {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, {0x10500, 0x10527}, {0x10530, 0x10563}, + {0x10600, 0x10736}, {0x10740, 0x10755}, {0x10760, 0x10767}, {0x10800, 0x10805}, + {0x1080a, 0x10835}, {0x1083f, 0x10855}, {0x10860, 0x10876}, {0x10880, 0x1089e}, + {0x108e0, 0x108f2}, {0x10900, 0x10915}, {0x10920, 0x10939}, {0x10980, 0x109b7}, + {0x10a10, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33}, {0x10a60, 0x10a7c}, + {0x10a80, 0x10a9c}, {0x10ac0, 0x10ac7}, {0x10ac9, 0x10ae4}, {0x10b00, 0x10b35}, + {0x10b40, 0x10b55}, {0x10b60, 0x10b72}, {0x10b80, 0x10b91}, {0x10c00, 0x10c48}, + {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x11003, 0x11037}, {0x11083, 0x110af}, + {0x110d0, 0x110e8}, {0x11103, 0x11126}, {0x11150, 0x11172}, {0x11183, 0x111b2}, + {0x111c1, 0x111c4}, {0x11200, 0x11211}, {0x11213, 0x1122b}, {0x11280, 0x11286}, + {0x1128a, 0x1128d}, {0x1128f, 0x1129d}, {0x1129f, 0x112a8}, {0x112b0, 0x112de}, + {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339}, + {0x1135d, 0x11361}, {0x11400, 0x11434}, {0x11447, 0x1144a}, {0x11480, 0x114af}, + {0x11580, 0x115ae}, {0x115d8, 0x115db}, {0x11600, 0x1162f}, {0x11680, 0x116aa}, + {0x11700, 0x11719}, {0x118a0, 0x118df}, {0x11a0b, 0x11a32}, {0x11a5c, 0x11a83}, + {0x11a86, 0x11a89}, {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, {0x11c0a, 0x11c2e}, + {0x11c72, 0x11c8f}, {0x11d00, 0x11d06}, {0x11d0b, 0x11d30}, {0x12000, 0x12399}, + {0x12480, 0x12543}, {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, + {0x16a40, 0x16a5e}, {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f}, {0x16b40, 0x16b43}, + {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44}, {0x16f93, 0x16f9f}, + {0x17000, 0x187ec}, {0x18800, 0x18af2}, {0x1b000, 0x1b11e}, {0x1b170, 0x1b2fb}, + {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99}, + {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9}, + {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, + {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, + {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d6c0}, {0x1d6c2, 0x1d6da}, + {0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734}, {0x1d736, 0x1d74e}, + {0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8}, {0x1d7aa, 0x1d7c2}, + {0x1d7c4, 0x1d7cb}, {0x1e800, 0x1e8c4}, {0x1e900, 0x1e943}, {0x1ee00, 0x1ee03}, + {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, + {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, + {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, + {0x1eeab, 0x1eebb}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d}, + {0x2b820, 0x2cea1}, {0x2ceb0, 0x2ebe0}, {0x2f800, 0x2fa1d} #endif }; @@ -1265,294 +267,14 @@ static const chr alphaCharTable[] = { 0x303c, 0xa62a, 0xa62b, 0xa8fb, 0xa8fd, 0xa9cf, 0xaa7a, 0xaab1, 0xaab5, 0xaab6, 0xaac0, 0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44 #if TCL_UTF_MAX > 4 - ,0x100aa, 0x100b5, 0x100ba, 0x102ec, 0x102ee, 0x10376, 0x10377, 0x1037f, 0x10386, - 0x1038c, 0x10559, 0x1066e, 0x1066f, 0x106d5, 0x106e5, 0x106e6, 0x106ee, 0x106ef, - 0x106ff, 0x10710, 0x107b1, 0x107f4, 0x107f5, 0x107fa, 0x1081a, 0x10824, 0x10828, - 0x1093d, 0x10950, 0x1098f, 0x10990, 0x109b2, 0x109bd, 0x109ce, 0x109dc, 0x109dd, - 0x109f0, 0x109f1, 0x109fc, 0x10a0f, 0x10a10, 0x10a32, 0x10a33, 0x10a35, 0x10a36, - 0x10a38, 0x10a39, 0x10a5e, 0x10ab2, 0x10ab3, 0x10abd, 0x10ad0, 0x10ae0, 0x10ae1, - 0x10af9, 0x10b0f, 0x10b10, 0x10b32, 0x10b33, 0x10b3d, 0x10b5c, 0x10b5d, 0x10b71, - 0x10b83, 0x10b99, 0x10b9a, 0x10b9c, 0x10b9e, 0x10b9f, 0x10ba3, 0x10ba4, 0x10bd0, - 0x10c3d, 0x10c60, 0x10c61, 0x10c80, 0x10cbd, 0x10cde, 0x10ce0, 0x10ce1, 0x10cf1, - 0x10cf2, 0x10d3d, 0x10d4e, 0x10dbd, 0x10e32, 0x10e33, 0x10e81, 0x10e82, 0x10e84, - 0x10e87, 0x10e88, 0x10e8a, 0x10e8d, 0x10ea5, 0x10ea7, 0x10eaa, 0x10eab, 0x10eb2, - 0x10eb3, 0x10ebd, 0x10ec6, 0x10f00, 0x1103f, 0x11061, 0x11065, 0x11066, 0x1108e, - 0x110c7, 0x110cd, 0x11258, 0x112c0, 0x117d7, 0x117dc, 0x118aa, 0x11aa7, 0x11bae, - 0x11baf, 0x11cf5, 0x11cf6, 0x11f59, 0x11f5b, 0x11f5d, 0x11fbe, 0x12071, 0x1207f, - 0x12102, 0x12107, 0x12115, 0x12124, 0x12126, 0x12128, 0x1214e, 0x12183, 0x12184, - 0x12cf2, 0x12cf3, 0x12d27, 0x12d2d, 0x12d6f, 0x12e2f, 0x13005, 0x13006, 0x1303b, - 0x1303c, 0x1a62a, 0x1a62b, 0x1a8fb, 0x1a8fd, 0x1a9cf, 0x1aa7a, 0x1aab1, 0x1aab5, - 0x1aab6, 0x1aac0, 0x1aac2, 0x1fb1d, 0x1fb3e, 0x1fb40, 0x1fb41, 0x1fb43, 0x1fb44, - 0x200aa, 0x200b5, 0x200ba, 0x202ec, 0x202ee, 0x20376, 0x20377, 0x2037f, 0x20386, - 0x2038c, 0x20559, 0x2066e, 0x2066f, 0x206d5, 0x206e5, 0x206e6, 0x206ee, 0x206ef, - 0x206ff, 0x20710, 0x207b1, 0x207f4, 0x207f5, 0x207fa, 0x2081a, 0x20824, 0x20828, - 0x2093d, 0x20950, 0x2098f, 0x20990, 0x209b2, 0x209bd, 0x209ce, 0x209dc, 0x209dd, - 0x209f0, 0x209f1, 0x209fc, 0x20a0f, 0x20a10, 0x20a32, 0x20a33, 0x20a35, 0x20a36, - 0x20a38, 0x20a39, 0x20a5e, 0x20ab2, 0x20ab3, 0x20abd, 0x20ad0, 0x20ae0, 0x20ae1, - 0x20af9, 0x20b0f, 0x20b10, 0x20b32, 0x20b33, 0x20b3d, 0x20b5c, 0x20b5d, 0x20b71, - 0x20b83, 0x20b99, 0x20b9a, 0x20b9c, 0x20b9e, 0x20b9f, 0x20ba3, 0x20ba4, 0x20bd0, - 0x20c3d, 0x20c60, 0x20c61, 0x20c80, 0x20cbd, 0x20cde, 0x20ce0, 0x20ce1, 0x20cf1, - 0x20cf2, 0x20d3d, 0x20d4e, 0x20dbd, 0x20e32, 0x20e33, 0x20e81, 0x20e82, 0x20e84, - 0x20e87, 0x20e88, 0x20e8a, 0x20e8d, 0x20ea5, 0x20ea7, 0x20eaa, 0x20eab, 0x20eb2, - 0x20eb3, 0x20ebd, 0x20ec6, 0x20f00, 0x2103f, 0x21061, 0x21065, 0x21066, 0x2108e, - 0x210c7, 0x210cd, 0x21258, 0x212c0, 0x217d7, 0x217dc, 0x218aa, 0x21aa7, 0x21bae, - 0x21baf, 0x21cf5, 0x21cf6, 0x21f59, 0x21f5b, 0x21f5d, 0x21fbe, 0x22071, 0x2207f, - 0x22102, 0x22107, 0x22115, 0x22124, 0x22126, 0x22128, 0x2214e, 0x22183, 0x22184, - 0x22cf2, 0x22cf3, 0x22d27, 0x22d2d, 0x22d6f, 0x22e2f, 0x23005, 0x23006, 0x2303b, - 0x2303c, 0x2a62a, 0x2a62b, 0x2a8fb, 0x2a8fd, 0x2a9cf, 0x2aa7a, 0x2aab1, 0x2aab5, - 0x2aab6, 0x2aac0, 0x2aac2, 0x2fb1d, 0x2fb3e, 0x2fb40, 0x2fb41, 0x2fb43, 0x2fb44, - 0x300aa, 0x300b5, 0x300ba, 0x302ec, 0x302ee, 0x30376, 0x30377, 0x3037f, 0x30386, - 0x3038c, 0x30559, 0x3066e, 0x3066f, 0x306d5, 0x306e5, 0x306e6, 0x306ee, 0x306ef, - 0x306ff, 0x30710, 0x307b1, 0x307f4, 0x307f5, 0x307fa, 0x3081a, 0x30824, 0x30828, - 0x3093d, 0x30950, 0x3098f, 0x30990, 0x309b2, 0x309bd, 0x309ce, 0x309dc, 0x309dd, - 0x309f0, 0x309f1, 0x309fc, 0x30a0f, 0x30a10, 0x30a32, 0x30a33, 0x30a35, 0x30a36, - 0x30a38, 0x30a39, 0x30a5e, 0x30ab2, 0x30ab3, 0x30abd, 0x30ad0, 0x30ae0, 0x30ae1, - 0x30af9, 0x30b0f, 0x30b10, 0x30b32, 0x30b33, 0x30b3d, 0x30b5c, 0x30b5d, 0x30b71, - 0x30b83, 0x30b99, 0x30b9a, 0x30b9c, 0x30b9e, 0x30b9f, 0x30ba3, 0x30ba4, 0x30bd0, - 0x30c3d, 0x30c60, 0x30c61, 0x30c80, 0x30cbd, 0x30cde, 0x30ce0, 0x30ce1, 0x30cf1, - 0x30cf2, 0x30d3d, 0x30d4e, 0x30dbd, 0x30e32, 0x30e33, 0x30e81, 0x30e82, 0x30e84, - 0x30e87, 0x30e88, 0x30e8a, 0x30e8d, 0x30ea5, 0x30ea7, 0x30eaa, 0x30eab, 0x30eb2, - 0x30eb3, 0x30ebd, 0x30ec6, 0x30f00, 0x3103f, 0x31061, 0x31065, 0x31066, 0x3108e, - 0x310c7, 0x310cd, 0x31258, 0x312c0, 0x317d7, 0x317dc, 0x318aa, 0x31aa7, 0x31bae, - 0x31baf, 0x31cf5, 0x31cf6, 0x31f59, 0x31f5b, 0x31f5d, 0x31fbe, 0x32071, 0x3207f, - 0x32102, 0x32107, 0x32115, 0x32124, 0x32126, 0x32128, 0x3214e, 0x32183, 0x32184, - 0x32cf2, 0x32cf3, 0x32d27, 0x32d2d, 0x32d6f, 0x32e2f, 0x33005, 0x33006, 0x3303b, - 0x3303c, 0x3a62a, 0x3a62b, 0x3a8fb, 0x3a8fd, 0x3a9cf, 0x3aa7a, 0x3aab1, 0x3aab5, - 0x3aab6, 0x3aac0, 0x3aac2, 0x3fb1d, 0x3fb3e, 0x3fb40, 0x3fb41, 0x3fb43, 0x3fb44, - 0x400aa, 0x400b5, 0x400ba, 0x402ec, 0x402ee, 0x40376, 0x40377, 0x4037f, 0x40386, - 0x4038c, 0x40559, 0x4066e, 0x4066f, 0x406d5, 0x406e5, 0x406e6, 0x406ee, 0x406ef, - 0x406ff, 0x40710, 0x407b1, 0x407f4, 0x407f5, 0x407fa, 0x4081a, 0x40824, 0x40828, - 0x4093d, 0x40950, 0x4098f, 0x40990, 0x409b2, 0x409bd, 0x409ce, 0x409dc, 0x409dd, - 0x409f0, 0x409f1, 0x409fc, 0x40a0f, 0x40a10, 0x40a32, 0x40a33, 0x40a35, 0x40a36, - 0x40a38, 0x40a39, 0x40a5e, 0x40ab2, 0x40ab3, 0x40abd, 0x40ad0, 0x40ae0, 0x40ae1, - 0x40af9, 0x40b0f, 0x40b10, 0x40b32, 0x40b33, 0x40b3d, 0x40b5c, 0x40b5d, 0x40b71, - 0x40b83, 0x40b99, 0x40b9a, 0x40b9c, 0x40b9e, 0x40b9f, 0x40ba3, 0x40ba4, 0x40bd0, - 0x40c3d, 0x40c60, 0x40c61, 0x40c80, 0x40cbd, 0x40cde, 0x40ce0, 0x40ce1, 0x40cf1, - 0x40cf2, 0x40d3d, 0x40d4e, 0x40dbd, 0x40e32, 0x40e33, 0x40e81, 0x40e82, 0x40e84, - 0x40e87, 0x40e88, 0x40e8a, 0x40e8d, 0x40ea5, 0x40ea7, 0x40eaa, 0x40eab, 0x40eb2, - 0x40eb3, 0x40ebd, 0x40ec6, 0x40f00, 0x4103f, 0x41061, 0x41065, 0x41066, 0x4108e, - 0x410c7, 0x410cd, 0x41258, 0x412c0, 0x417d7, 0x417dc, 0x418aa, 0x41aa7, 0x41bae, - 0x41baf, 0x41cf5, 0x41cf6, 0x41f59, 0x41f5b, 0x41f5d, 0x41fbe, 0x42071, 0x4207f, - 0x42102, 0x42107, 0x42115, 0x42124, 0x42126, 0x42128, 0x4214e, 0x42183, 0x42184, - 0x42cf2, 0x42cf3, 0x42d27, 0x42d2d, 0x42d6f, 0x42e2f, 0x43005, 0x43006, 0x4303b, - 0x4303c, 0x4a62a, 0x4a62b, 0x4a8fb, 0x4a8fd, 0x4a9cf, 0x4aa7a, 0x4aab1, 0x4aab5, - 0x4aab6, 0x4aac0, 0x4aac2, 0x4fb1d, 0x4fb3e, 0x4fb40, 0x4fb41, 0x4fb43, 0x4fb44, - 0x500aa, 0x500b5, 0x500ba, 0x502ec, 0x502ee, 0x50376, 0x50377, 0x5037f, 0x50386, - 0x5038c, 0x50559, 0x5066e, 0x5066f, 0x506d5, 0x506e5, 0x506e6, 0x506ee, 0x506ef, - 0x506ff, 0x50710, 0x507b1, 0x507f4, 0x507f5, 0x507fa, 0x5081a, 0x50824, 0x50828, - 0x5093d, 0x50950, 0x5098f, 0x50990, 0x509b2, 0x509bd, 0x509ce, 0x509dc, 0x509dd, - 0x509f0, 0x509f1, 0x509fc, 0x50a0f, 0x50a10, 0x50a32, 0x50a33, 0x50a35, 0x50a36, - 0x50a38, 0x50a39, 0x50a5e, 0x50ab2, 0x50ab3, 0x50abd, 0x50ad0, 0x50ae0, 0x50ae1, - 0x50af9, 0x50b0f, 0x50b10, 0x50b32, 0x50b33, 0x50b3d, 0x50b5c, 0x50b5d, 0x50b71, - 0x50b83, 0x50b99, 0x50b9a, 0x50b9c, 0x50b9e, 0x50b9f, 0x50ba3, 0x50ba4, 0x50bd0, - 0x50c3d, 0x50c60, 0x50c61, 0x50c80, 0x50cbd, 0x50cde, 0x50ce0, 0x50ce1, 0x50cf1, - 0x50cf2, 0x50d3d, 0x50d4e, 0x50dbd, 0x50e32, 0x50e33, 0x50e81, 0x50e82, 0x50e84, - 0x50e87, 0x50e88, 0x50e8a, 0x50e8d, 0x50ea5, 0x50ea7, 0x50eaa, 0x50eab, 0x50eb2, - 0x50eb3, 0x50ebd, 0x50ec6, 0x50f00, 0x5103f, 0x51061, 0x51065, 0x51066, 0x5108e, - 0x510c7, 0x510cd, 0x51258, 0x512c0, 0x517d7, 0x517dc, 0x518aa, 0x51aa7, 0x51bae, - 0x51baf, 0x51cf5, 0x51cf6, 0x51f59, 0x51f5b, 0x51f5d, 0x51fbe, 0x52071, 0x5207f, - 0x52102, 0x52107, 0x52115, 0x52124, 0x52126, 0x52128, 0x5214e, 0x52183, 0x52184, - 0x52cf2, 0x52cf3, 0x52d27, 0x52d2d, 0x52d6f, 0x52e2f, 0x53005, 0x53006, 0x5303b, - 0x5303c, 0x5a62a, 0x5a62b, 0x5a8fb, 0x5a8fd, 0x5a9cf, 0x5aa7a, 0x5aab1, 0x5aab5, - 0x5aab6, 0x5aac0, 0x5aac2, 0x5fb1d, 0x5fb3e, 0x5fb40, 0x5fb41, 0x5fb43, 0x5fb44, - 0x600aa, 0x600b5, 0x600ba, 0x602ec, 0x602ee, 0x60376, 0x60377, 0x6037f, 0x60386, - 0x6038c, 0x60559, 0x6066e, 0x6066f, 0x606d5, 0x606e5, 0x606e6, 0x606ee, 0x606ef, - 0x606ff, 0x60710, 0x607b1, 0x607f4, 0x607f5, 0x607fa, 0x6081a, 0x60824, 0x60828, - 0x6093d, 0x60950, 0x6098f, 0x60990, 0x609b2, 0x609bd, 0x609ce, 0x609dc, 0x609dd, - 0x609f0, 0x609f1, 0x609fc, 0x60a0f, 0x60a10, 0x60a32, 0x60a33, 0x60a35, 0x60a36, - 0x60a38, 0x60a39, 0x60a5e, 0x60ab2, 0x60ab3, 0x60abd, 0x60ad0, 0x60ae0, 0x60ae1, - 0x60af9, 0x60b0f, 0x60b10, 0x60b32, 0x60b33, 0x60b3d, 0x60b5c, 0x60b5d, 0x60b71, - 0x60b83, 0x60b99, 0x60b9a, 0x60b9c, 0x60b9e, 0x60b9f, 0x60ba3, 0x60ba4, 0x60bd0, - 0x60c3d, 0x60c60, 0x60c61, 0x60c80, 0x60cbd, 0x60cde, 0x60ce0, 0x60ce1, 0x60cf1, - 0x60cf2, 0x60d3d, 0x60d4e, 0x60dbd, 0x60e32, 0x60e33, 0x60e81, 0x60e82, 0x60e84, - 0x60e87, 0x60e88, 0x60e8a, 0x60e8d, 0x60ea5, 0x60ea7, 0x60eaa, 0x60eab, 0x60eb2, - 0x60eb3, 0x60ebd, 0x60ec6, 0x60f00, 0x6103f, 0x61061, 0x61065, 0x61066, 0x6108e, - 0x610c7, 0x610cd, 0x61258, 0x612c0, 0x617d7, 0x617dc, 0x618aa, 0x61aa7, 0x61bae, - 0x61baf, 0x61cf5, 0x61cf6, 0x61f59, 0x61f5b, 0x61f5d, 0x61fbe, 0x62071, 0x6207f, - 0x62102, 0x62107, 0x62115, 0x62124, 0x62126, 0x62128, 0x6214e, 0x62183, 0x62184, - 0x62cf2, 0x62cf3, 0x62d27, 0x62d2d, 0x62d6f, 0x62e2f, 0x63005, 0x63006, 0x6303b, - 0x6303c, 0x6a62a, 0x6a62b, 0x6a8fb, 0x6a8fd, 0x6a9cf, 0x6aa7a, 0x6aab1, 0x6aab5, - 0x6aab6, 0x6aac0, 0x6aac2, 0x6fb1d, 0x6fb3e, 0x6fb40, 0x6fb41, 0x6fb43, 0x6fb44, - 0x700aa, 0x700b5, 0x700ba, 0x702ec, 0x702ee, 0x70376, 0x70377, 0x7037f, 0x70386, - 0x7038c, 0x70559, 0x7066e, 0x7066f, 0x706d5, 0x706e5, 0x706e6, 0x706ee, 0x706ef, - 0x706ff, 0x70710, 0x707b1, 0x707f4, 0x707f5, 0x707fa, 0x7081a, 0x70824, 0x70828, - 0x7093d, 0x70950, 0x7098f, 0x70990, 0x709b2, 0x709bd, 0x709ce, 0x709dc, 0x709dd, - 0x709f0, 0x709f1, 0x709fc, 0x70a0f, 0x70a10, 0x70a32, 0x70a33, 0x70a35, 0x70a36, - 0x70a38, 0x70a39, 0x70a5e, 0x70ab2, 0x70ab3, 0x70abd, 0x70ad0, 0x70ae0, 0x70ae1, - 0x70af9, 0x70b0f, 0x70b10, 0x70b32, 0x70b33, 0x70b3d, 0x70b5c, 0x70b5d, 0x70b71, - 0x70b83, 0x70b99, 0x70b9a, 0x70b9c, 0x70b9e, 0x70b9f, 0x70ba3, 0x70ba4, 0x70bd0, - 0x70c3d, 0x70c60, 0x70c61, 0x70c80, 0x70cbd, 0x70cde, 0x70ce0, 0x70ce1, 0x70cf1, - 0x70cf2, 0x70d3d, 0x70d4e, 0x70dbd, 0x70e32, 0x70e33, 0x70e81, 0x70e82, 0x70e84, - 0x70e87, 0x70e88, 0x70e8a, 0x70e8d, 0x70ea5, 0x70ea7, 0x70eaa, 0x70eab, 0x70eb2, - 0x70eb3, 0x70ebd, 0x70ec6, 0x70f00, 0x7103f, 0x71061, 0x71065, 0x71066, 0x7108e, - 0x710c7, 0x710cd, 0x71258, 0x712c0, 0x717d7, 0x717dc, 0x718aa, 0x71aa7, 0x71bae, - 0x71baf, 0x71cf5, 0x71cf6, 0x71f59, 0x71f5b, 0x71f5d, 0x71fbe, 0x72071, 0x7207f, - 0x72102, 0x72107, 0x72115, 0x72124, 0x72126, 0x72128, 0x7214e, 0x72183, 0x72184, - 0x72cf2, 0x72cf3, 0x72d27, 0x72d2d, 0x72d6f, 0x72e2f, 0x73005, 0x73006, 0x7303b, - 0x7303c, 0x7a62a, 0x7a62b, 0x7a8fb, 0x7a8fd, 0x7a9cf, 0x7aa7a, 0x7aab1, 0x7aab5, - 0x7aab6, 0x7aac0, 0x7aac2, 0x7fb1d, 0x7fb3e, 0x7fb40, 0x7fb41, 0x7fb43, 0x7fb44, - 0x800aa, 0x800b5, 0x800ba, 0x802ec, 0x802ee, 0x80376, 0x80377, 0x8037f, 0x80386, - 0x8038c, 0x80559, 0x8066e, 0x8066f, 0x806d5, 0x806e5, 0x806e6, 0x806ee, 0x806ef, - 0x806ff, 0x80710, 0x807b1, 0x807f4, 0x807f5, 0x807fa, 0x8081a, 0x80824, 0x80828, - 0x8093d, 0x80950, 0x8098f, 0x80990, 0x809b2, 0x809bd, 0x809ce, 0x809dc, 0x809dd, - 0x809f0, 0x809f1, 0x809fc, 0x80a0f, 0x80a10, 0x80a32, 0x80a33, 0x80a35, 0x80a36, - 0x80a38, 0x80a39, 0x80a5e, 0x80ab2, 0x80ab3, 0x80abd, 0x80ad0, 0x80ae0, 0x80ae1, - 0x80af9, 0x80b0f, 0x80b10, 0x80b32, 0x80b33, 0x80b3d, 0x80b5c, 0x80b5d, 0x80b71, - 0x80b83, 0x80b99, 0x80b9a, 0x80b9c, 0x80b9e, 0x80b9f, 0x80ba3, 0x80ba4, 0x80bd0, - 0x80c3d, 0x80c60, 0x80c61, 0x80c80, 0x80cbd, 0x80cde, 0x80ce0, 0x80ce1, 0x80cf1, - 0x80cf2, 0x80d3d, 0x80d4e, 0x80dbd, 0x80e32, 0x80e33, 0x80e81, 0x80e82, 0x80e84, - 0x80e87, 0x80e88, 0x80e8a, 0x80e8d, 0x80ea5, 0x80ea7, 0x80eaa, 0x80eab, 0x80eb2, - 0x80eb3, 0x80ebd, 0x80ec6, 0x80f00, 0x8103f, 0x81061, 0x81065, 0x81066, 0x8108e, - 0x810c7, 0x810cd, 0x81258, 0x812c0, 0x817d7, 0x817dc, 0x818aa, 0x81aa7, 0x81bae, - 0x81baf, 0x81cf5, 0x81cf6, 0x81f59, 0x81f5b, 0x81f5d, 0x81fbe, 0x82071, 0x8207f, - 0x82102, 0x82107, 0x82115, 0x82124, 0x82126, 0x82128, 0x8214e, 0x82183, 0x82184, - 0x82cf2, 0x82cf3, 0x82d27, 0x82d2d, 0x82d6f, 0x82e2f, 0x83005, 0x83006, 0x8303b, - 0x8303c, 0x8a62a, 0x8a62b, 0x8a8fb, 0x8a8fd, 0x8a9cf, 0x8aa7a, 0x8aab1, 0x8aab5, - 0x8aab6, 0x8aac0, 0x8aac2, 0x8fb1d, 0x8fb3e, 0x8fb40, 0x8fb41, 0x8fb43, 0x8fb44, - 0x900aa, 0x900b5, 0x900ba, 0x902ec, 0x902ee, 0x90376, 0x90377, 0x9037f, 0x90386, - 0x9038c, 0x90559, 0x9066e, 0x9066f, 0x906d5, 0x906e5, 0x906e6, 0x906ee, 0x906ef, - 0x906ff, 0x90710, 0x907b1, 0x907f4, 0x907f5, 0x907fa, 0x9081a, 0x90824, 0x90828, - 0x9093d, 0x90950, 0x9098f, 0x90990, 0x909b2, 0x909bd, 0x909ce, 0x909dc, 0x909dd, - 0x909f0, 0x909f1, 0x909fc, 0x90a0f, 0x90a10, 0x90a32, 0x90a33, 0x90a35, 0x90a36, - 0x90a38, 0x90a39, 0x90a5e, 0x90ab2, 0x90ab3, 0x90abd, 0x90ad0, 0x90ae0, 0x90ae1, - 0x90af9, 0x90b0f, 0x90b10, 0x90b32, 0x90b33, 0x90b3d, 0x90b5c, 0x90b5d, 0x90b71, - 0x90b83, 0x90b99, 0x90b9a, 0x90b9c, 0x90b9e, 0x90b9f, 0x90ba3, 0x90ba4, 0x90bd0, - 0x90c3d, 0x90c60, 0x90c61, 0x90c80, 0x90cbd, 0x90cde, 0x90ce0, 0x90ce1, 0x90cf1, - 0x90cf2, 0x90d3d, 0x90d4e, 0x90dbd, 0x90e32, 0x90e33, 0x90e81, 0x90e82, 0x90e84, - 0x90e87, 0x90e88, 0x90e8a, 0x90e8d, 0x90ea5, 0x90ea7, 0x90eaa, 0x90eab, 0x90eb2, - 0x90eb3, 0x90ebd, 0x90ec6, 0x90f00, 0x9103f, 0x91061, 0x91065, 0x91066, 0x9108e, - 0x910c7, 0x910cd, 0x91258, 0x912c0, 0x917d7, 0x917dc, 0x918aa, 0x91aa7, 0x91bae, - 0x91baf, 0x91cf5, 0x91cf6, 0x91f59, 0x91f5b, 0x91f5d, 0x91fbe, 0x92071, 0x9207f, - 0x92102, 0x92107, 0x92115, 0x92124, 0x92126, 0x92128, 0x9214e, 0x92183, 0x92184, - 0x92cf2, 0x92cf3, 0x92d27, 0x92d2d, 0x92d6f, 0x92e2f, 0x93005, 0x93006, 0x9303b, - 0x9303c, 0x9a62a, 0x9a62b, 0x9a8fb, 0x9a8fd, 0x9a9cf, 0x9aa7a, 0x9aab1, 0x9aab5, - 0x9aab6, 0x9aac0, 0x9aac2, 0x9fb1d, 0x9fb3e, 0x9fb40, 0x9fb41, 0x9fb43, 0x9fb44, - 0xa00aa, 0xa00b5, 0xa00ba, 0xa02ec, 0xa02ee, 0xa0376, 0xa0377, 0xa037f, 0xa0386, - 0xa038c, 0xa0559, 0xa066e, 0xa066f, 0xa06d5, 0xa06e5, 0xa06e6, 0xa06ee, 0xa06ef, - 0xa06ff, 0xa0710, 0xa07b1, 0xa07f4, 0xa07f5, 0xa07fa, 0xa081a, 0xa0824, 0xa0828, - 0xa093d, 0xa0950, 0xa098f, 0xa0990, 0xa09b2, 0xa09bd, 0xa09ce, 0xa09dc, 0xa09dd, - 0xa09f0, 0xa09f1, 0xa09fc, 0xa0a0f, 0xa0a10, 0xa0a32, 0xa0a33, 0xa0a35, 0xa0a36, - 0xa0a38, 0xa0a39, 0xa0a5e, 0xa0ab2, 0xa0ab3, 0xa0abd, 0xa0ad0, 0xa0ae0, 0xa0ae1, - 0xa0af9, 0xa0b0f, 0xa0b10, 0xa0b32, 0xa0b33, 0xa0b3d, 0xa0b5c, 0xa0b5d, 0xa0b71, - 0xa0b83, 0xa0b99, 0xa0b9a, 0xa0b9c, 0xa0b9e, 0xa0b9f, 0xa0ba3, 0xa0ba4, 0xa0bd0, - 0xa0c3d, 0xa0c60, 0xa0c61, 0xa0c80, 0xa0cbd, 0xa0cde, 0xa0ce0, 0xa0ce1, 0xa0cf1, - 0xa0cf2, 0xa0d3d, 0xa0d4e, 0xa0dbd, 0xa0e32, 0xa0e33, 0xa0e81, 0xa0e82, 0xa0e84, - 0xa0e87, 0xa0e88, 0xa0e8a, 0xa0e8d, 0xa0ea5, 0xa0ea7, 0xa0eaa, 0xa0eab, 0xa0eb2, - 0xa0eb3, 0xa0ebd, 0xa0ec6, 0xa0f00, 0xa103f, 0xa1061, 0xa1065, 0xa1066, 0xa108e, - 0xa10c7, 0xa10cd, 0xa1258, 0xa12c0, 0xa17d7, 0xa17dc, 0xa18aa, 0xa1aa7, 0xa1bae, - 0xa1baf, 0xa1cf5, 0xa1cf6, 0xa1f59, 0xa1f5b, 0xa1f5d, 0xa1fbe, 0xa2071, 0xa207f, - 0xa2102, 0xa2107, 0xa2115, 0xa2124, 0xa2126, 0xa2128, 0xa214e, 0xa2183, 0xa2184, - 0xa2cf2, 0xa2cf3, 0xa2d27, 0xa2d2d, 0xa2d6f, 0xa2e2f, 0xa3005, 0xa3006, 0xa303b, - 0xa303c, 0xaa62a, 0xaa62b, 0xaa8fb, 0xaa8fd, 0xaa9cf, 0xaaa7a, 0xaaab1, 0xaaab5, - 0xaaab6, 0xaaac0, 0xaaac2, 0xafb1d, 0xafb3e, 0xafb40, 0xafb41, 0xafb43, 0xafb44, - 0xb00aa, 0xb00b5, 0xb00ba, 0xb02ec, 0xb02ee, 0xb0376, 0xb0377, 0xb037f, 0xb0386, - 0xb038c, 0xb0559, 0xb066e, 0xb066f, 0xb06d5, 0xb06e5, 0xb06e6, 0xb06ee, 0xb06ef, - 0xb06ff, 0xb0710, 0xb07b1, 0xb07f4, 0xb07f5, 0xb07fa, 0xb081a, 0xb0824, 0xb0828, - 0xb093d, 0xb0950, 0xb098f, 0xb0990, 0xb09b2, 0xb09bd, 0xb09ce, 0xb09dc, 0xb09dd, - 0xb09f0, 0xb09f1, 0xb09fc, 0xb0a0f, 0xb0a10, 0xb0a32, 0xb0a33, 0xb0a35, 0xb0a36, - 0xb0a38, 0xb0a39, 0xb0a5e, 0xb0ab2, 0xb0ab3, 0xb0abd, 0xb0ad0, 0xb0ae0, 0xb0ae1, - 0xb0af9, 0xb0b0f, 0xb0b10, 0xb0b32, 0xb0b33, 0xb0b3d, 0xb0b5c, 0xb0b5d, 0xb0b71, - 0xb0b83, 0xb0b99, 0xb0b9a, 0xb0b9c, 0xb0b9e, 0xb0b9f, 0xb0ba3, 0xb0ba4, 0xb0bd0, - 0xb0c3d, 0xb0c60, 0xb0c61, 0xb0c80, 0xb0cbd, 0xb0cde, 0xb0ce0, 0xb0ce1, 0xb0cf1, - 0xb0cf2, 0xb0d3d, 0xb0d4e, 0xb0dbd, 0xb0e32, 0xb0e33, 0xb0e81, 0xb0e82, 0xb0e84, - 0xb0e87, 0xb0e88, 0xb0e8a, 0xb0e8d, 0xb0ea5, 0xb0ea7, 0xb0eaa, 0xb0eab, 0xb0eb2, - 0xb0eb3, 0xb0ebd, 0xb0ec6, 0xb0f00, 0xb103f, 0xb1061, 0xb1065, 0xb1066, 0xb108e, - 0xb10c7, 0xb10cd, 0xb1258, 0xb12c0, 0xb17d7, 0xb17dc, 0xb18aa, 0xb1aa7, 0xb1bae, - 0xb1baf, 0xb1cf5, 0xb1cf6, 0xb1f59, 0xb1f5b, 0xb1f5d, 0xb1fbe, 0xb2071, 0xb207f, - 0xb2102, 0xb2107, 0xb2115, 0xb2124, 0xb2126, 0xb2128, 0xb214e, 0xb2183, 0xb2184, - 0xb2cf2, 0xb2cf3, 0xb2d27, 0xb2d2d, 0xb2d6f, 0xb2e2f, 0xb3005, 0xb3006, 0xb303b, - 0xb303c, 0xba62a, 0xba62b, 0xba8fb, 0xba8fd, 0xba9cf, 0xbaa7a, 0xbaab1, 0xbaab5, - 0xbaab6, 0xbaac0, 0xbaac2, 0xbfb1d, 0xbfb3e, 0xbfb40, 0xbfb41, 0xbfb43, 0xbfb44, - 0xc00aa, 0xc00b5, 0xc00ba, 0xc02ec, 0xc02ee, 0xc0376, 0xc0377, 0xc037f, 0xc0386, - 0xc038c, 0xc0559, 0xc066e, 0xc066f, 0xc06d5, 0xc06e5, 0xc06e6, 0xc06ee, 0xc06ef, - 0xc06ff, 0xc0710, 0xc07b1, 0xc07f4, 0xc07f5, 0xc07fa, 0xc081a, 0xc0824, 0xc0828, - 0xc093d, 0xc0950, 0xc098f, 0xc0990, 0xc09b2, 0xc09bd, 0xc09ce, 0xc09dc, 0xc09dd, - 0xc09f0, 0xc09f1, 0xc09fc, 0xc0a0f, 0xc0a10, 0xc0a32, 0xc0a33, 0xc0a35, 0xc0a36, - 0xc0a38, 0xc0a39, 0xc0a5e, 0xc0ab2, 0xc0ab3, 0xc0abd, 0xc0ad0, 0xc0ae0, 0xc0ae1, - 0xc0af9, 0xc0b0f, 0xc0b10, 0xc0b32, 0xc0b33, 0xc0b3d, 0xc0b5c, 0xc0b5d, 0xc0b71, - 0xc0b83, 0xc0b99, 0xc0b9a, 0xc0b9c, 0xc0b9e, 0xc0b9f, 0xc0ba3, 0xc0ba4, 0xc0bd0, - 0xc0c3d, 0xc0c60, 0xc0c61, 0xc0c80, 0xc0cbd, 0xc0cde, 0xc0ce0, 0xc0ce1, 0xc0cf1, - 0xc0cf2, 0xc0d3d, 0xc0d4e, 0xc0dbd, 0xc0e32, 0xc0e33, 0xc0e81, 0xc0e82, 0xc0e84, - 0xc0e87, 0xc0e88, 0xc0e8a, 0xc0e8d, 0xc0ea5, 0xc0ea7, 0xc0eaa, 0xc0eab, 0xc0eb2, - 0xc0eb3, 0xc0ebd, 0xc0ec6, 0xc0f00, 0xc103f, 0xc1061, 0xc1065, 0xc1066, 0xc108e, - 0xc10c7, 0xc10cd, 0xc1258, 0xc12c0, 0xc17d7, 0xc17dc, 0xc18aa, 0xc1aa7, 0xc1bae, - 0xc1baf, 0xc1cf5, 0xc1cf6, 0xc1f59, 0xc1f5b, 0xc1f5d, 0xc1fbe, 0xc2071, 0xc207f, - 0xc2102, 0xc2107, 0xc2115, 0xc2124, 0xc2126, 0xc2128, 0xc214e, 0xc2183, 0xc2184, - 0xc2cf2, 0xc2cf3, 0xc2d27, 0xc2d2d, 0xc2d6f, 0xc2e2f, 0xc3005, 0xc3006, 0xc303b, - 0xc303c, 0xca62a, 0xca62b, 0xca8fb, 0xca8fd, 0xca9cf, 0xcaa7a, 0xcaab1, 0xcaab5, - 0xcaab6, 0xcaac0, 0xcaac2, 0xcfb1d, 0xcfb3e, 0xcfb40, 0xcfb41, 0xcfb43, 0xcfb44, - 0xd00aa, 0xd00b5, 0xd00ba, 0xd02ec, 0xd02ee, 0xd0376, 0xd0377, 0xd037f, 0xd0386, - 0xd038c, 0xd0559, 0xd066e, 0xd066f, 0xd06d5, 0xd06e5, 0xd06e6, 0xd06ee, 0xd06ef, - 0xd06ff, 0xd0710, 0xd07b1, 0xd07f4, 0xd07f5, 0xd07fa, 0xd081a, 0xd0824, 0xd0828, - 0xd093d, 0xd0950, 0xd098f, 0xd0990, 0xd09b2, 0xd09bd, 0xd09ce, 0xd09dc, 0xd09dd, - 0xd09f0, 0xd09f1, 0xd09fc, 0xd0a0f, 0xd0a10, 0xd0a32, 0xd0a33, 0xd0a35, 0xd0a36, - 0xd0a38, 0xd0a39, 0xd0a5e, 0xd0ab2, 0xd0ab3, 0xd0abd, 0xd0ad0, 0xd0ae0, 0xd0ae1, - 0xd0af9, 0xd0b0f, 0xd0b10, 0xd0b32, 0xd0b33, 0xd0b3d, 0xd0b5c, 0xd0b5d, 0xd0b71, - 0xd0b83, 0xd0b99, 0xd0b9a, 0xd0b9c, 0xd0b9e, 0xd0b9f, 0xd0ba3, 0xd0ba4, 0xd0bd0, - 0xd0c3d, 0xd0c60, 0xd0c61, 0xd0c80, 0xd0cbd, 0xd0cde, 0xd0ce0, 0xd0ce1, 0xd0cf1, - 0xd0cf2, 0xd0d3d, 0xd0d4e, 0xd0dbd, 0xd0e32, 0xd0e33, 0xd0e81, 0xd0e82, 0xd0e84, - 0xd0e87, 0xd0e88, 0xd0e8a, 0xd0e8d, 0xd0ea5, 0xd0ea7, 0xd0eaa, 0xd0eab, 0xd0eb2, - 0xd0eb3, 0xd0ebd, 0xd0ec6, 0xd0f00, 0xd103f, 0xd1061, 0xd1065, 0xd1066, 0xd108e, - 0xd10c7, 0xd10cd, 0xd1258, 0xd12c0, 0xd17d7, 0xd17dc, 0xd18aa, 0xd1aa7, 0xd1bae, - 0xd1baf, 0xd1cf5, 0xd1cf6, 0xd1f59, 0xd1f5b, 0xd1f5d, 0xd1fbe, 0xd2071, 0xd207f, - 0xd2102, 0xd2107, 0xd2115, 0xd2124, 0xd2126, 0xd2128, 0xd214e, 0xd2183, 0xd2184, - 0xd2cf2, 0xd2cf3, 0xd2d27, 0xd2d2d, 0xd2d6f, 0xd2e2f, 0xd3005, 0xd3006, 0xd303b, - 0xd303c, 0xda62a, 0xda62b, 0xda8fb, 0xda8fd, 0xda9cf, 0xdaa7a, 0xdaab1, 0xdaab5, - 0xdaab6, 0xdaac0, 0xdaac2, 0xdfb1d, 0xdfb3e, 0xdfb40, 0xdfb41, 0xdfb43, 0xdfb44, - 0xe00aa, 0xe00b5, 0xe00ba, 0xe02ec, 0xe02ee, 0xe0376, 0xe0377, 0xe037f, 0xe0386, - 0xe038c, 0xe0559, 0xe066e, 0xe066f, 0xe06d5, 0xe06e5, 0xe06e6, 0xe06ee, 0xe06ef, - 0xe06ff, 0xe0710, 0xe07b1, 0xe07f4, 0xe07f5, 0xe07fa, 0xe081a, 0xe0824, 0xe0828, - 0xe093d, 0xe0950, 0xe098f, 0xe0990, 0xe09b2, 0xe09bd, 0xe09ce, 0xe09dc, 0xe09dd, - 0xe09f0, 0xe09f1, 0xe09fc, 0xe0a0f, 0xe0a10, 0xe0a32, 0xe0a33, 0xe0a35, 0xe0a36, - 0xe0a38, 0xe0a39, 0xe0a5e, 0xe0ab2, 0xe0ab3, 0xe0abd, 0xe0ad0, 0xe0ae0, 0xe0ae1, - 0xe0af9, 0xe0b0f, 0xe0b10, 0xe0b32, 0xe0b33, 0xe0b3d, 0xe0b5c, 0xe0b5d, 0xe0b71, - 0xe0b83, 0xe0b99, 0xe0b9a, 0xe0b9c, 0xe0b9e, 0xe0b9f, 0xe0ba3, 0xe0ba4, 0xe0bd0, - 0xe0c3d, 0xe0c60, 0xe0c61, 0xe0c80, 0xe0cbd, 0xe0cde, 0xe0ce0, 0xe0ce1, 0xe0cf1, - 0xe0cf2, 0xe0d3d, 0xe0d4e, 0xe0dbd, 0xe0e32, 0xe0e33, 0xe0e81, 0xe0e82, 0xe0e84, - 0xe0e87, 0xe0e88, 0xe0e8a, 0xe0e8d, 0xe0ea5, 0xe0ea7, 0xe0eaa, 0xe0eab, 0xe0eb2, - 0xe0eb3, 0xe0ebd, 0xe0ec6, 0xe0f00, 0xe103f, 0xe1061, 0xe1065, 0xe1066, 0xe108e, - 0xe10c7, 0xe10cd, 0xe1258, 0xe12c0, 0xe17d7, 0xe17dc, 0xe18aa, 0xe1aa7, 0xe1bae, - 0xe1baf, 0xe1cf5, 0xe1cf6, 0xe1f59, 0xe1f5b, 0xe1f5d, 0xe1fbe, 0xe2071, 0xe207f, - 0xe2102, 0xe2107, 0xe2115, 0xe2124, 0xe2126, 0xe2128, 0xe214e, 0xe2183, 0xe2184, - 0xe2cf2, 0xe2cf3, 0xe2d27, 0xe2d2d, 0xe2d6f, 0xe2e2f, 0xe3005, 0xe3006, 0xe303b, - 0xe303c, 0xea62a, 0xea62b, 0xea8fb, 0xea8fd, 0xea9cf, 0xeaa7a, 0xeaab1, 0xeaab5, - 0xeaab6, 0xeaac0, 0xeaac2, 0xefb1d, 0xefb3e, 0xefb40, 0xefb41, 0xefb43, 0xefb44, - 0xf00aa, 0xf00b5, 0xf00ba, 0xf02ec, 0xf02ee, 0xf0376, 0xf0377, 0xf037f, 0xf0386, - 0xf038c, 0xf0559, 0xf066e, 0xf066f, 0xf06d5, 0xf06e5, 0xf06e6, 0xf06ee, 0xf06ef, - 0xf06ff, 0xf0710, 0xf07b1, 0xf07f4, 0xf07f5, 0xf07fa, 0xf081a, 0xf0824, 0xf0828, - 0xf093d, 0xf0950, 0xf098f, 0xf0990, 0xf09b2, 0xf09bd, 0xf09ce, 0xf09dc, 0xf09dd, - 0xf09f0, 0xf09f1, 0xf09fc, 0xf0a0f, 0xf0a10, 0xf0a32, 0xf0a33, 0xf0a35, 0xf0a36, - 0xf0a38, 0xf0a39, 0xf0a5e, 0xf0ab2, 0xf0ab3, 0xf0abd, 0xf0ad0, 0xf0ae0, 0xf0ae1, - 0xf0af9, 0xf0b0f, 0xf0b10, 0xf0b32, 0xf0b33, 0xf0b3d, 0xf0b5c, 0xf0b5d, 0xf0b71, - 0xf0b83, 0xf0b99, 0xf0b9a, 0xf0b9c, 0xf0b9e, 0xf0b9f, 0xf0ba3, 0xf0ba4, 0xf0bd0, - 0xf0c3d, 0xf0c60, 0xf0c61, 0xf0c80, 0xf0cbd, 0xf0cde, 0xf0ce0, 0xf0ce1, 0xf0cf1, - 0xf0cf2, 0xf0d3d, 0xf0d4e, 0xf0dbd, 0xf0e32, 0xf0e33, 0xf0e81, 0xf0e82, 0xf0e84, - 0xf0e87, 0xf0e88, 0xf0e8a, 0xf0e8d, 0xf0ea5, 0xf0ea7, 0xf0eaa, 0xf0eab, 0xf0eb2, - 0xf0eb3, 0xf0ebd, 0xf0ec6, 0xf0f00, 0xf103f, 0xf1061, 0xf1065, 0xf1066, 0xf108e, - 0xf10c7, 0xf10cd, 0xf1258, 0xf12c0, 0xf17d7, 0xf17dc, 0xf18aa, 0xf1aa7, 0xf1bae, - 0xf1baf, 0xf1cf5, 0xf1cf6, 0xf1f59, 0xf1f5b, 0xf1f5d, 0xf1fbe, 0xf2071, 0xf207f, - 0xf2102, 0xf2107, 0xf2115, 0xf2124, 0xf2126, 0xf2128, 0xf214e, 0xf2183, 0xf2184, - 0xf2cf2, 0xf2cf3, 0xf2d27, 0xf2d2d, 0xf2d6f, 0xf2e2f, 0xf3005, 0xf3006, 0xf303b, - 0xf303c, 0xfa62a, 0xfa62b, 0xfa8fb, 0xfa8fd, 0xfa9cf, 0xfaa7a, 0xfaab1, 0xfaab5, - 0xfaab6, 0xfaac0, 0xfaac2, 0xffb1d, 0xffb3e, 0xffb40, 0xffb41, 0xffb43, 0xffb44, - 0x1000aa, 0x1000b5, 0x1000ba, 0x1002ec, 0x1002ee, 0x100376, 0x100377, 0x10037f, 0x100386, - 0x10038c, 0x100559, 0x10066e, 0x10066f, 0x1006d5, 0x1006e5, 0x1006e6, 0x1006ee, 0x1006ef, - 0x1006ff, 0x100710, 0x1007b1, 0x1007f4, 0x1007f5, 0x1007fa, 0x10081a, 0x100824, 0x100828, - 0x10093d, 0x100950, 0x10098f, 0x100990, 0x1009b2, 0x1009bd, 0x1009ce, 0x1009dc, 0x1009dd, - 0x1009f0, 0x1009f1, 0x1009fc, 0x100a0f, 0x100a10, 0x100a32, 0x100a33, 0x100a35, 0x100a36, - 0x100a38, 0x100a39, 0x100a5e, 0x100ab2, 0x100ab3, 0x100abd, 0x100ad0, 0x100ae0, 0x100ae1, - 0x100af9, 0x100b0f, 0x100b10, 0x100b32, 0x100b33, 0x100b3d, 0x100b5c, 0x100b5d, 0x100b71, - 0x100b83, 0x100b99, 0x100b9a, 0x100b9c, 0x100b9e, 0x100b9f, 0x100ba3, 0x100ba4, 0x100bd0, - 0x100c3d, 0x100c60, 0x100c61, 0x100c80, 0x100cbd, 0x100cde, 0x100ce0, 0x100ce1, 0x100cf1, - 0x100cf2, 0x100d3d, 0x100d4e, 0x100dbd, 0x100e32, 0x100e33, 0x100e81, 0x100e82, 0x100e84, - 0x100e87, 0x100e88, 0x100e8a, 0x100e8d, 0x100ea5, 0x100ea7, 0x100eaa, 0x100eab, 0x100eb2, - 0x100eb3, 0x100ebd, 0x100ec6, 0x100f00, 0x10103f, 0x101061, 0x101065, 0x101066, 0x10108e, - 0x1010c7, 0x1010cd, 0x101258, 0x1012c0, 0x1017d7, 0x1017dc, 0x1018aa, 0x101aa7, 0x101bae, - 0x101baf, 0x101cf5, 0x101cf6, 0x101f59, 0x101f5b, 0x101f5d, 0x101fbe, 0x102071, 0x10207f, - 0x102102, 0x102107, 0x102115, 0x102124, 0x102126, 0x102128, 0x10214e, 0x102183, 0x102184, - 0x102cf2, 0x102cf3, 0x102d27, 0x102d2d, 0x102d6f, 0x102e2f, 0x103005, 0x103006, 0x10303b, - 0x10303c, 0x10a62a, 0x10a62b, 0x10a8fb, 0x10a8fd, 0x10a9cf, 0x10aa7a, 0x10aab1, 0x10aab5, - 0x10aab6, 0x10aac0, 0x10aac2, 0x10fb1d, 0x10fb3e, 0x10fb40, 0x10fb41, 0x10fb43, 0x10fb44 + ,0x1003c, 0x1003d, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, 0x108f5, 0x109be, + 0x109bf, 0x10a00, 0x11176, 0x111da, 0x111dc, 0x11288, 0x1130f, 0x11310, 0x11332, + 0x11333, 0x1133d, 0x11350, 0x114c4, 0x114c5, 0x114c7, 0x11644, 0x118ff, 0x11a00, + 0x11a3a, 0x11a50, 0x11c40, 0x11d08, 0x11d09, 0x11d46, 0x16f50, 0x16fe0, 0x16fe1, + 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22, + 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, + 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, + 0x1ee64, 0x1ee7e #endif }; @@ -1567,42 +289,8 @@ static const crange controlRangeTable[] = { {0x202a, 0x202e}, {0x2060, 0x2064}, {0x2066, 0x206f}, {0xe000, 0xf8ff}, {0xfff9, 0xfffb} #if TCL_UTF_MAX > 4 - ,{0x10000, 0x1001f}, {0x1007f, 0x1009f}, {0x10600, 0x10605}, {0x1200b, 0x1200f}, - {0x1202a, 0x1202e}, {0x12060, 0x12064}, {0x12066, 0x1206f}, {0x1e000, 0x1f8ff}, - {0x1fff9, 0x1fffb}, {0x20000, 0x2001f}, {0x2007f, 0x2009f}, {0x20600, 0x20605}, - {0x2200b, 0x2200f}, {0x2202a, 0x2202e}, {0x22060, 0x22064}, {0x22066, 0x2206f}, - {0x2e000, 0x2f8ff}, {0x2fff9, 0x2fffb}, {0x30000, 0x3001f}, {0x3007f, 0x3009f}, - {0x30600, 0x30605}, {0x3200b, 0x3200f}, {0x3202a, 0x3202e}, {0x32060, 0x32064}, - {0x32066, 0x3206f}, {0x3e000, 0x3f8ff}, {0x3fff9, 0x3fffb}, {0x40000, 0x4001f}, - {0x4007f, 0x4009f}, {0x40600, 0x40605}, {0x4200b, 0x4200f}, {0x4202a, 0x4202e}, - {0x42060, 0x42064}, {0x42066, 0x4206f}, {0x4e000, 0x4f8ff}, {0x4fff9, 0x4fffb}, - {0x50000, 0x5001f}, {0x5007f, 0x5009f}, {0x50600, 0x50605}, {0x5200b, 0x5200f}, - {0x5202a, 0x5202e}, {0x52060, 0x52064}, {0x52066, 0x5206f}, {0x5e000, 0x5f8ff}, - {0x5fff9, 0x5fffb}, {0x60000, 0x6001f}, {0x6007f, 0x6009f}, {0x60600, 0x60605}, - {0x6200b, 0x6200f}, {0x6202a, 0x6202e}, {0x62060, 0x62064}, {0x62066, 0x6206f}, - {0x6e000, 0x6f8ff}, {0x6fff9, 0x6fffb}, {0x70000, 0x7001f}, {0x7007f, 0x7009f}, - {0x70600, 0x70605}, {0x7200b, 0x7200f}, {0x7202a, 0x7202e}, {0x72060, 0x72064}, - {0x72066, 0x7206f}, {0x7e000, 0x7f8ff}, {0x7fff9, 0x7fffb}, {0x80000, 0x8001f}, - {0x8007f, 0x8009f}, {0x80600, 0x80605}, {0x8200b, 0x8200f}, {0x8202a, 0x8202e}, - {0x82060, 0x82064}, {0x82066, 0x8206f}, {0x8e000, 0x8f8ff}, {0x8fff9, 0x8fffb}, - {0x90000, 0x9001f}, {0x9007f, 0x9009f}, {0x90600, 0x90605}, {0x9200b, 0x9200f}, - {0x9202a, 0x9202e}, {0x92060, 0x92064}, {0x92066, 0x9206f}, {0x9e000, 0x9f8ff}, - {0x9fff9, 0x9fffb}, {0xa0000, 0xa001f}, {0xa007f, 0xa009f}, {0xa0600, 0xa0605}, - {0xa200b, 0xa200f}, {0xa202a, 0xa202e}, {0xa2060, 0xa2064}, {0xa2066, 0xa206f}, - {0xae000, 0xaf8ff}, {0xafff9, 0xafffb}, {0xb0000, 0xb001f}, {0xb007f, 0xb009f}, - {0xb0600, 0xb0605}, {0xb200b, 0xb200f}, {0xb202a, 0xb202e}, {0xb2060, 0xb2064}, - {0xb2066, 0xb206f}, {0xbe000, 0xbf8ff}, {0xbfff9, 0xbfffb}, {0xc0000, 0xc001f}, - {0xc007f, 0xc009f}, {0xc0600, 0xc0605}, {0xc200b, 0xc200f}, {0xc202a, 0xc202e}, - {0xc2060, 0xc2064}, {0xc2066, 0xc206f}, {0xce000, 0xcf8ff}, {0xcfff9, 0xcfffb}, - {0xd0000, 0xd001f}, {0xd007f, 0xd009f}, {0xd0600, 0xd0605}, {0xd200b, 0xd200f}, - {0xd202a, 0xd202e}, {0xd2060, 0xd2064}, {0xd2066, 0xd206f}, {0xde000, 0xdf8ff}, - {0xdfff9, 0xdfffb}, {0xe0000, 0xe001f}, {0xe007f, 0xe009f}, {0xe0600, 0xe0605}, - {0xe200b, 0xe200f}, {0xe202a, 0xe202e}, {0xe2060, 0xe2064}, {0xe2066, 0xe206f}, - {0xee000, 0xef8ff}, {0xefff9, 0xefffb}, {0xf0000, 0xf001f}, {0xf007f, 0xf009f}, - {0xf0600, 0xf0605}, {0xf200b, 0xf200f}, {0xf202a, 0xf202e}, {0xf2060, 0xf2064}, - {0xf2066, 0xf206f}, {0xfe000, 0xff8ff}, {0xffff9, 0xffffb}, {0x100000, 0x10001f}, - {0x10007f, 0x10009f}, {0x100600, 0x100605}, {0x10200b, 0x10200f}, {0x10202a, 0x10202e}, - {0x102060, 0x102064}, {0x102066, 0x10206f}, {0x10e000, 0x10f8ff}, {0x10fff9, 0x10fffb} + ,{0x1bca0, 0x1bca3}, {0x1d173, 0x1d17a}, {0xe0020, 0xe007f}, {0xf0000, 0xffffd}, + {0x100000, 0x10fffd} #endif }; @@ -1611,19 +299,7 @@ static const crange controlRangeTable[] = { static const chr controlCharTable[] = { 0xad, 0x61c, 0x6dd, 0x70f, 0x8e2, 0x180e, 0xfeff #if TCL_UTF_MAX > 4 - ,0x100ad, 0x1061c, 0x106dd, 0x1070f, 0x108e2, 0x1180e, 0x1feff, 0x200ad, 0x2061c, - 0x206dd, 0x2070f, 0x208e2, 0x2180e, 0x2feff, 0x300ad, 0x3061c, 0x306dd, 0x3070f, - 0x308e2, 0x3180e, 0x3feff, 0x400ad, 0x4061c, 0x406dd, 0x4070f, 0x408e2, 0x4180e, - 0x4feff, 0x500ad, 0x5061c, 0x506dd, 0x5070f, 0x508e2, 0x5180e, 0x5feff, 0x600ad, - 0x6061c, 0x606dd, 0x6070f, 0x608e2, 0x6180e, 0x6feff, 0x700ad, 0x7061c, 0x706dd, - 0x7070f, 0x708e2, 0x7180e, 0x7feff, 0x800ad, 0x8061c, 0x806dd, 0x8070f, 0x808e2, - 0x8180e, 0x8feff, 0x900ad, 0x9061c, 0x906dd, 0x9070f, 0x908e2, 0x9180e, 0x9feff, - 0xa00ad, 0xa061c, 0xa06dd, 0xa070f, 0xa08e2, 0xa180e, 0xafeff, 0xb00ad, 0xb061c, - 0xb06dd, 0xb070f, 0xb08e2, 0xb180e, 0xbfeff, 0xc00ad, 0xc061c, 0xc06dd, 0xc070f, - 0xc08e2, 0xc180e, 0xcfeff, 0xd00ad, 0xd061c, 0xd06dd, 0xd070f, 0xd08e2, 0xd180e, - 0xdfeff, 0xe00ad, 0xe061c, 0xe06dd, 0xe070f, 0xe08e2, 0xe180e, 0xefeff, 0xf00ad, - 0xf061c, 0xf06dd, 0xf070f, 0xf08e2, 0xf180e, 0xffeff, 0x1000ad, 0x10061c, 0x1006dd, - 0x10070f, 0x1008e2, 0x10180e, 0x10feff + ,0x110bd, 0xe0001 #endif }; @@ -1645,154 +321,11 @@ static const crange digitRangeTable[] = { {0xa9d0, 0xa9d9}, {0xa9f0, 0xa9f9}, {0xaa50, 0xaa59}, {0xabf0, 0xabf9}, {0xff10, 0xff19} #if TCL_UTF_MAX > 4 - ,{0x10030, 0x10039}, {0x10660, 0x10669}, {0x106f0, 0x106f9}, {0x107c0, 0x107c9}, - {0x10966, 0x1096f}, {0x109e6, 0x109ef}, {0x10a66, 0x10a6f}, {0x10ae6, 0x10aef}, - {0x10b66, 0x10b6f}, {0x10be6, 0x10bef}, {0x10c66, 0x10c6f}, {0x10ce6, 0x10cef}, - {0x10d66, 0x10d6f}, {0x10de6, 0x10def}, {0x10e50, 0x10e59}, {0x10ed0, 0x10ed9}, - {0x10f20, 0x10f29}, {0x11040, 0x11049}, {0x11090, 0x11099}, {0x117e0, 0x117e9}, - {0x11810, 0x11819}, {0x11946, 0x1194f}, {0x119d0, 0x119d9}, {0x11a80, 0x11a89}, - {0x11a90, 0x11a99}, {0x11b50, 0x11b59}, {0x11bb0, 0x11bb9}, {0x11c40, 0x11c49}, - {0x11c50, 0x11c59}, {0x1a620, 0x1a629}, {0x1a8d0, 0x1a8d9}, {0x1a900, 0x1a909}, - {0x1a9d0, 0x1a9d9}, {0x1a9f0, 0x1a9f9}, {0x1aa50, 0x1aa59}, {0x1abf0, 0x1abf9}, - {0x1ff10, 0x1ff19}, {0x20030, 0x20039}, {0x20660, 0x20669}, {0x206f0, 0x206f9}, - {0x207c0, 0x207c9}, {0x20966, 0x2096f}, {0x209e6, 0x209ef}, {0x20a66, 0x20a6f}, - {0x20ae6, 0x20aef}, {0x20b66, 0x20b6f}, {0x20be6, 0x20bef}, {0x20c66, 0x20c6f}, - {0x20ce6, 0x20cef}, {0x20d66, 0x20d6f}, {0x20de6, 0x20def}, {0x20e50, 0x20e59}, - {0x20ed0, 0x20ed9}, {0x20f20, 0x20f29}, {0x21040, 0x21049}, {0x21090, 0x21099}, - {0x217e0, 0x217e9}, {0x21810, 0x21819}, {0x21946, 0x2194f}, {0x219d0, 0x219d9}, - {0x21a80, 0x21a89}, {0x21a90, 0x21a99}, {0x21b50, 0x21b59}, {0x21bb0, 0x21bb9}, - {0x21c40, 0x21c49}, {0x21c50, 0x21c59}, {0x2a620, 0x2a629}, {0x2a8d0, 0x2a8d9}, - {0x2a900, 0x2a909}, {0x2a9d0, 0x2a9d9}, {0x2a9f0, 0x2a9f9}, {0x2aa50, 0x2aa59}, - {0x2abf0, 0x2abf9}, {0x2ff10, 0x2ff19}, {0x30030, 0x30039}, {0x30660, 0x30669}, - {0x306f0, 0x306f9}, {0x307c0, 0x307c9}, {0x30966, 0x3096f}, {0x309e6, 0x309ef}, - {0x30a66, 0x30a6f}, {0x30ae6, 0x30aef}, {0x30b66, 0x30b6f}, {0x30be6, 0x30bef}, - {0x30c66, 0x30c6f}, {0x30ce6, 0x30cef}, {0x30d66, 0x30d6f}, {0x30de6, 0x30def}, - {0x30e50, 0x30e59}, {0x30ed0, 0x30ed9}, {0x30f20, 0x30f29}, {0x31040, 0x31049}, - {0x31090, 0x31099}, {0x317e0, 0x317e9}, {0x31810, 0x31819}, {0x31946, 0x3194f}, - {0x319d0, 0x319d9}, {0x31a80, 0x31a89}, {0x31a90, 0x31a99}, {0x31b50, 0x31b59}, - {0x31bb0, 0x31bb9}, {0x31c40, 0x31c49}, {0x31c50, 0x31c59}, {0x3a620, 0x3a629}, - {0x3a8d0, 0x3a8d9}, {0x3a900, 0x3a909}, {0x3a9d0, 0x3a9d9}, {0x3a9f0, 0x3a9f9}, - {0x3aa50, 0x3aa59}, {0x3abf0, 0x3abf9}, {0x3ff10, 0x3ff19}, {0x40030, 0x40039}, - {0x40660, 0x40669}, {0x406f0, 0x406f9}, {0x407c0, 0x407c9}, {0x40966, 0x4096f}, - {0x409e6, 0x409ef}, {0x40a66, 0x40a6f}, {0x40ae6, 0x40aef}, {0x40b66, 0x40b6f}, - {0x40be6, 0x40bef}, {0x40c66, 0x40c6f}, {0x40ce6, 0x40cef}, {0x40d66, 0x40d6f}, - {0x40de6, 0x40def}, {0x40e50, 0x40e59}, {0x40ed0, 0x40ed9}, {0x40f20, 0x40f29}, - {0x41040, 0x41049}, {0x41090, 0x41099}, {0x417e0, 0x417e9}, {0x41810, 0x41819}, - {0x41946, 0x4194f}, {0x419d0, 0x419d9}, {0x41a80, 0x41a89}, {0x41a90, 0x41a99}, - {0x41b50, 0x41b59}, {0x41bb0, 0x41bb9}, {0x41c40, 0x41c49}, {0x41c50, 0x41c59}, - {0x4a620, 0x4a629}, {0x4a8d0, 0x4a8d9}, {0x4a900, 0x4a909}, {0x4a9d0, 0x4a9d9}, - {0x4a9f0, 0x4a9f9}, {0x4aa50, 0x4aa59}, {0x4abf0, 0x4abf9}, {0x4ff10, 0x4ff19}, - {0x50030, 0x50039}, {0x50660, 0x50669}, {0x506f0, 0x506f9}, {0x507c0, 0x507c9}, - {0x50966, 0x5096f}, {0x509e6, 0x509ef}, {0x50a66, 0x50a6f}, {0x50ae6, 0x50aef}, - {0x50b66, 0x50b6f}, {0x50be6, 0x50bef}, {0x50c66, 0x50c6f}, {0x50ce6, 0x50cef}, - {0x50d66, 0x50d6f}, {0x50de6, 0x50def}, {0x50e50, 0x50e59}, {0x50ed0, 0x50ed9}, - {0x50f20, 0x50f29}, {0x51040, 0x51049}, {0x51090, 0x51099}, {0x517e0, 0x517e9}, - {0x51810, 0x51819}, {0x51946, 0x5194f}, {0x519d0, 0x519d9}, {0x51a80, 0x51a89}, - {0x51a90, 0x51a99}, {0x51b50, 0x51b59}, {0x51bb0, 0x51bb9}, {0x51c40, 0x51c49}, - {0x51c50, 0x51c59}, {0x5a620, 0x5a629}, {0x5a8d0, 0x5a8d9}, {0x5a900, 0x5a909}, - {0x5a9d0, 0x5a9d9}, {0x5a9f0, 0x5a9f9}, {0x5aa50, 0x5aa59}, {0x5abf0, 0x5abf9}, - {0x5ff10, 0x5ff19}, {0x60030, 0x60039}, {0x60660, 0x60669}, {0x606f0, 0x606f9}, - {0x607c0, 0x607c9}, {0x60966, 0x6096f}, {0x609e6, 0x609ef}, {0x60a66, 0x60a6f}, - {0x60ae6, 0x60aef}, {0x60b66, 0x60b6f}, {0x60be6, 0x60bef}, {0x60c66, 0x60c6f}, - {0x60ce6, 0x60cef}, {0x60d66, 0x60d6f}, {0x60de6, 0x60def}, {0x60e50, 0x60e59}, - {0x60ed0, 0x60ed9}, {0x60f20, 0x60f29}, {0x61040, 0x61049}, {0x61090, 0x61099}, - {0x617e0, 0x617e9}, {0x61810, 0x61819}, {0x61946, 0x6194f}, {0x619d0, 0x619d9}, - {0x61a80, 0x61a89}, {0x61a90, 0x61a99}, {0x61b50, 0x61b59}, {0x61bb0, 0x61bb9}, - {0x61c40, 0x61c49}, {0x61c50, 0x61c59}, {0x6a620, 0x6a629}, {0x6a8d0, 0x6a8d9}, - {0x6a900, 0x6a909}, {0x6a9d0, 0x6a9d9}, {0x6a9f0, 0x6a9f9}, {0x6aa50, 0x6aa59}, - {0x6abf0, 0x6abf9}, {0x6ff10, 0x6ff19}, {0x70030, 0x70039}, {0x70660, 0x70669}, - {0x706f0, 0x706f9}, {0x707c0, 0x707c9}, {0x70966, 0x7096f}, {0x709e6, 0x709ef}, - {0x70a66, 0x70a6f}, {0x70ae6, 0x70aef}, {0x70b66, 0x70b6f}, {0x70be6, 0x70bef}, - {0x70c66, 0x70c6f}, {0x70ce6, 0x70cef}, {0x70d66, 0x70d6f}, {0x70de6, 0x70def}, - {0x70e50, 0x70e59}, {0x70ed0, 0x70ed9}, {0x70f20, 0x70f29}, {0x71040, 0x71049}, - {0x71090, 0x71099}, {0x717e0, 0x717e9}, {0x71810, 0x71819}, {0x71946, 0x7194f}, - {0x719d0, 0x719d9}, {0x71a80, 0x71a89}, {0x71a90, 0x71a99}, {0x71b50, 0x71b59}, - {0x71bb0, 0x71bb9}, {0x71c40, 0x71c49}, {0x71c50, 0x71c59}, {0x7a620, 0x7a629}, - {0x7a8d0, 0x7a8d9}, {0x7a900, 0x7a909}, {0x7a9d0, 0x7a9d9}, {0x7a9f0, 0x7a9f9}, - {0x7aa50, 0x7aa59}, {0x7abf0, 0x7abf9}, {0x7ff10, 0x7ff19}, {0x80030, 0x80039}, - {0x80660, 0x80669}, {0x806f0, 0x806f9}, {0x807c0, 0x807c9}, {0x80966, 0x8096f}, - {0x809e6, 0x809ef}, {0x80a66, 0x80a6f}, {0x80ae6, 0x80aef}, {0x80b66, 0x80b6f}, - {0x80be6, 0x80bef}, {0x80c66, 0x80c6f}, {0x80ce6, 0x80cef}, {0x80d66, 0x80d6f}, - {0x80de6, 0x80def}, {0x80e50, 0x80e59}, {0x80ed0, 0x80ed9}, {0x80f20, 0x80f29}, - {0x81040, 0x81049}, {0x81090, 0x81099}, {0x817e0, 0x817e9}, {0x81810, 0x81819}, - {0x81946, 0x8194f}, {0x819d0, 0x819d9}, {0x81a80, 0x81a89}, {0x81a90, 0x81a99}, - {0x81b50, 0x81b59}, {0x81bb0, 0x81bb9}, {0x81c40, 0x81c49}, {0x81c50, 0x81c59}, - {0x8a620, 0x8a629}, {0x8a8d0, 0x8a8d9}, {0x8a900, 0x8a909}, {0x8a9d0, 0x8a9d9}, - {0x8a9f0, 0x8a9f9}, {0x8aa50, 0x8aa59}, {0x8abf0, 0x8abf9}, {0x8ff10, 0x8ff19}, - {0x90030, 0x90039}, {0x90660, 0x90669}, {0x906f0, 0x906f9}, {0x907c0, 0x907c9}, - {0x90966, 0x9096f}, {0x909e6, 0x909ef}, {0x90a66, 0x90a6f}, {0x90ae6, 0x90aef}, - {0x90b66, 0x90b6f}, {0x90be6, 0x90bef}, {0x90c66, 0x90c6f}, {0x90ce6, 0x90cef}, - {0x90d66, 0x90d6f}, {0x90de6, 0x90def}, {0x90e50, 0x90e59}, {0x90ed0, 0x90ed9}, - {0x90f20, 0x90f29}, {0x91040, 0x91049}, {0x91090, 0x91099}, {0x917e0, 0x917e9}, - {0x91810, 0x91819}, {0x91946, 0x9194f}, {0x919d0, 0x919d9}, {0x91a80, 0x91a89}, - {0x91a90, 0x91a99}, {0x91b50, 0x91b59}, {0x91bb0, 0x91bb9}, {0x91c40, 0x91c49}, - {0x91c50, 0x91c59}, {0x9a620, 0x9a629}, {0x9a8d0, 0x9a8d9}, {0x9a900, 0x9a909}, - {0x9a9d0, 0x9a9d9}, {0x9a9f0, 0x9a9f9}, {0x9aa50, 0x9aa59}, {0x9abf0, 0x9abf9}, - {0x9ff10, 0x9ff19}, {0xa0030, 0xa0039}, {0xa0660, 0xa0669}, {0xa06f0, 0xa06f9}, - {0xa07c0, 0xa07c9}, {0xa0966, 0xa096f}, {0xa09e6, 0xa09ef}, {0xa0a66, 0xa0a6f}, - {0xa0ae6, 0xa0aef}, {0xa0b66, 0xa0b6f}, {0xa0be6, 0xa0bef}, {0xa0c66, 0xa0c6f}, - {0xa0ce6, 0xa0cef}, {0xa0d66, 0xa0d6f}, {0xa0de6, 0xa0def}, {0xa0e50, 0xa0e59}, - {0xa0ed0, 0xa0ed9}, {0xa0f20, 0xa0f29}, {0xa1040, 0xa1049}, {0xa1090, 0xa1099}, - {0xa17e0, 0xa17e9}, {0xa1810, 0xa1819}, {0xa1946, 0xa194f}, {0xa19d0, 0xa19d9}, - {0xa1a80, 0xa1a89}, {0xa1a90, 0xa1a99}, {0xa1b50, 0xa1b59}, {0xa1bb0, 0xa1bb9}, - {0xa1c40, 0xa1c49}, {0xa1c50, 0xa1c59}, {0xaa620, 0xaa629}, {0xaa8d0, 0xaa8d9}, - {0xaa900, 0xaa909}, {0xaa9d0, 0xaa9d9}, {0xaa9f0, 0xaa9f9}, {0xaaa50, 0xaaa59}, - {0xaabf0, 0xaabf9}, {0xaff10, 0xaff19}, {0xb0030, 0xb0039}, {0xb0660, 0xb0669}, - {0xb06f0, 0xb06f9}, {0xb07c0, 0xb07c9}, {0xb0966, 0xb096f}, {0xb09e6, 0xb09ef}, - {0xb0a66, 0xb0a6f}, {0xb0ae6, 0xb0aef}, {0xb0b66, 0xb0b6f}, {0xb0be6, 0xb0bef}, - {0xb0c66, 0xb0c6f}, {0xb0ce6, 0xb0cef}, {0xb0d66, 0xb0d6f}, {0xb0de6, 0xb0def}, - {0xb0e50, 0xb0e59}, {0xb0ed0, 0xb0ed9}, {0xb0f20, 0xb0f29}, {0xb1040, 0xb1049}, - {0xb1090, 0xb1099}, {0xb17e0, 0xb17e9}, {0xb1810, 0xb1819}, {0xb1946, 0xb194f}, - {0xb19d0, 0xb19d9}, {0xb1a80, 0xb1a89}, {0xb1a90, 0xb1a99}, {0xb1b50, 0xb1b59}, - {0xb1bb0, 0xb1bb9}, {0xb1c40, 0xb1c49}, {0xb1c50, 0xb1c59}, {0xba620, 0xba629}, - {0xba8d0, 0xba8d9}, {0xba900, 0xba909}, {0xba9d0, 0xba9d9}, {0xba9f0, 0xba9f9}, - {0xbaa50, 0xbaa59}, {0xbabf0, 0xbabf9}, {0xbff10, 0xbff19}, {0xc0030, 0xc0039}, - {0xc0660, 0xc0669}, {0xc06f0, 0xc06f9}, {0xc07c0, 0xc07c9}, {0xc0966, 0xc096f}, - {0xc09e6, 0xc09ef}, {0xc0a66, 0xc0a6f}, {0xc0ae6, 0xc0aef}, {0xc0b66, 0xc0b6f}, - {0xc0be6, 0xc0bef}, {0xc0c66, 0xc0c6f}, {0xc0ce6, 0xc0cef}, {0xc0d66, 0xc0d6f}, - {0xc0de6, 0xc0def}, {0xc0e50, 0xc0e59}, {0xc0ed0, 0xc0ed9}, {0xc0f20, 0xc0f29}, - {0xc1040, 0xc1049}, {0xc1090, 0xc1099}, {0xc17e0, 0xc17e9}, {0xc1810, 0xc1819}, - {0xc1946, 0xc194f}, {0xc19d0, 0xc19d9}, {0xc1a80, 0xc1a89}, {0xc1a90, 0xc1a99}, - {0xc1b50, 0xc1b59}, {0xc1bb0, 0xc1bb9}, {0xc1c40, 0xc1c49}, {0xc1c50, 0xc1c59}, - {0xca620, 0xca629}, {0xca8d0, 0xca8d9}, {0xca900, 0xca909}, {0xca9d0, 0xca9d9}, - {0xca9f0, 0xca9f9}, {0xcaa50, 0xcaa59}, {0xcabf0, 0xcabf9}, {0xcff10, 0xcff19}, - {0xd0030, 0xd0039}, {0xd0660, 0xd0669}, {0xd06f0, 0xd06f9}, {0xd07c0, 0xd07c9}, - {0xd0966, 0xd096f}, {0xd09e6, 0xd09ef}, {0xd0a66, 0xd0a6f}, {0xd0ae6, 0xd0aef}, - {0xd0b66, 0xd0b6f}, {0xd0be6, 0xd0bef}, {0xd0c66, 0xd0c6f}, {0xd0ce6, 0xd0cef}, - {0xd0d66, 0xd0d6f}, {0xd0de6, 0xd0def}, {0xd0e50, 0xd0e59}, {0xd0ed0, 0xd0ed9}, - {0xd0f20, 0xd0f29}, {0xd1040, 0xd1049}, {0xd1090, 0xd1099}, {0xd17e0, 0xd17e9}, - {0xd1810, 0xd1819}, {0xd1946, 0xd194f}, {0xd19d0, 0xd19d9}, {0xd1a80, 0xd1a89}, - {0xd1a90, 0xd1a99}, {0xd1b50, 0xd1b59}, {0xd1bb0, 0xd1bb9}, {0xd1c40, 0xd1c49}, - {0xd1c50, 0xd1c59}, {0xda620, 0xda629}, {0xda8d0, 0xda8d9}, {0xda900, 0xda909}, - {0xda9d0, 0xda9d9}, {0xda9f0, 0xda9f9}, {0xdaa50, 0xdaa59}, {0xdabf0, 0xdabf9}, - {0xdff10, 0xdff19}, {0xe0030, 0xe0039}, {0xe0660, 0xe0669}, {0xe06f0, 0xe06f9}, - {0xe07c0, 0xe07c9}, {0xe0966, 0xe096f}, {0xe09e6, 0xe09ef}, {0xe0a66, 0xe0a6f}, - {0xe0ae6, 0xe0aef}, {0xe0b66, 0xe0b6f}, {0xe0be6, 0xe0bef}, {0xe0c66, 0xe0c6f}, - {0xe0ce6, 0xe0cef}, {0xe0d66, 0xe0d6f}, {0xe0de6, 0xe0def}, {0xe0e50, 0xe0e59}, - {0xe0ed0, 0xe0ed9}, {0xe0f20, 0xe0f29}, {0xe1040, 0xe1049}, {0xe1090, 0xe1099}, - {0xe17e0, 0xe17e9}, {0xe1810, 0xe1819}, {0xe1946, 0xe194f}, {0xe19d0, 0xe19d9}, - {0xe1a80, 0xe1a89}, {0xe1a90, 0xe1a99}, {0xe1b50, 0xe1b59}, {0xe1bb0, 0xe1bb9}, - {0xe1c40, 0xe1c49}, {0xe1c50, 0xe1c59}, {0xea620, 0xea629}, {0xea8d0, 0xea8d9}, - {0xea900, 0xea909}, {0xea9d0, 0xea9d9}, {0xea9f0, 0xea9f9}, {0xeaa50, 0xeaa59}, - {0xeabf0, 0xeabf9}, {0xeff10, 0xeff19}, {0xf0030, 0xf0039}, {0xf0660, 0xf0669}, - {0xf06f0, 0xf06f9}, {0xf07c0, 0xf07c9}, {0xf0966, 0xf096f}, {0xf09e6, 0xf09ef}, - {0xf0a66, 0xf0a6f}, {0xf0ae6, 0xf0aef}, {0xf0b66, 0xf0b6f}, {0xf0be6, 0xf0bef}, - {0xf0c66, 0xf0c6f}, {0xf0ce6, 0xf0cef}, {0xf0d66, 0xf0d6f}, {0xf0de6, 0xf0def}, - {0xf0e50, 0xf0e59}, {0xf0ed0, 0xf0ed9}, {0xf0f20, 0xf0f29}, {0xf1040, 0xf1049}, - {0xf1090, 0xf1099}, {0xf17e0, 0xf17e9}, {0xf1810, 0xf1819}, {0xf1946, 0xf194f}, - {0xf19d0, 0xf19d9}, {0xf1a80, 0xf1a89}, {0xf1a90, 0xf1a99}, {0xf1b50, 0xf1b59}, - {0xf1bb0, 0xf1bb9}, {0xf1c40, 0xf1c49}, {0xf1c50, 0xf1c59}, {0xfa620, 0xfa629}, - {0xfa8d0, 0xfa8d9}, {0xfa900, 0xfa909}, {0xfa9d0, 0xfa9d9}, {0xfa9f0, 0xfa9f9}, - {0xfaa50, 0xfaa59}, {0xfabf0, 0xfabf9}, {0xfff10, 0xfff19}, {0x100030, 0x100039}, - {0x100660, 0x100669}, {0x1006f0, 0x1006f9}, {0x1007c0, 0x1007c9}, {0x100966, 0x10096f}, - {0x1009e6, 0x1009ef}, {0x100a66, 0x100a6f}, {0x100ae6, 0x100aef}, {0x100b66, 0x100b6f}, - {0x100be6, 0x100bef}, {0x100c66, 0x100c6f}, {0x100ce6, 0x100cef}, {0x100d66, 0x100d6f}, - {0x100de6, 0x100def}, {0x100e50, 0x100e59}, {0x100ed0, 0x100ed9}, {0x100f20, 0x100f29}, - {0x101040, 0x101049}, {0x101090, 0x101099}, {0x1017e0, 0x1017e9}, {0x101810, 0x101819}, - {0x101946, 0x10194f}, {0x1019d0, 0x1019d9}, {0x101a80, 0x101a89}, {0x101a90, 0x101a99}, - {0x101b50, 0x101b59}, {0x101bb0, 0x101bb9}, {0x101c40, 0x101c49}, {0x101c50, 0x101c59}, - {0x10a620, 0x10a629}, {0x10a8d0, 0x10a8d9}, {0x10a900, 0x10a909}, {0x10a9d0, 0x10a9d9}, - {0x10a9f0, 0x10a9f9}, {0x10aa50, 0x10aa59}, {0x10abf0, 0x10abf9}, {0x10ff10, 0x10ff19} + ,{0x104a0, 0x104a9}, {0x11066, 0x1106f}, {0x110f0, 0x110f9}, {0x11136, 0x1113f}, + {0x111d0, 0x111d9}, {0x112f0, 0x112f9}, {0x11450, 0x11459}, {0x114d0, 0x114d9}, + {0x11650, 0x11659}, {0x116c0, 0x116c9}, {0x11730, 0x11739}, {0x118e0, 0x118e9}, + {0x11c50, 0x11c59}, {0x11d50, 0x11d59}, {0x16a60, 0x16a69}, {0x16b50, 0x16b59}, + {0x1d7ce, 0x1d7ff}, {0x1e950, 0x1e959} #endif }; @@ -1822,218 +355,12 @@ static const crange punctRangeTable[] = { {0xff01, 0xff03}, {0xff05, 0xff0a}, {0xff0c, 0xff0f}, {0xff3b, 0xff3d}, {0xff5f, 0xff65} #if TCL_UTF_MAX > 4 - ,{0x10021, 0x10023}, {0x10025, 0x1002a}, {0x1002c, 0x1002f}, {0x1005b, 0x1005d}, - {0x1055a, 0x1055f}, {0x1066a, 0x1066d}, {0x10700, 0x1070d}, {0x107f7, 0x107f9}, - {0x10830, 0x1083e}, {0x10f04, 0x10f12}, {0x10f3a, 0x10f3d}, {0x10fd0, 0x10fd4}, - {0x1104a, 0x1104f}, {0x11360, 0x11368}, {0x116eb, 0x116ed}, {0x117d4, 0x117d6}, - {0x117d8, 0x117da}, {0x11800, 0x1180a}, {0x11aa0, 0x11aa6}, {0x11aa8, 0x11aad}, - {0x11b5a, 0x11b60}, {0x11bfc, 0x11bff}, {0x11c3b, 0x11c3f}, {0x11cc0, 0x11cc7}, - {0x12010, 0x12027}, {0x12030, 0x12043}, {0x12045, 0x12051}, {0x12053, 0x1205e}, - {0x12308, 0x1230b}, {0x12768, 0x12775}, {0x127e6, 0x127ef}, {0x12983, 0x12998}, - {0x129d8, 0x129db}, {0x12cf9, 0x12cfc}, {0x12e00, 0x12e2e}, {0x12e30, 0x12e49}, - {0x13001, 0x13003}, {0x13008, 0x13011}, {0x13014, 0x1301f}, {0x1a60d, 0x1a60f}, - {0x1a6f2, 0x1a6f7}, {0x1a874, 0x1a877}, {0x1a8f8, 0x1a8fa}, {0x1a9c1, 0x1a9cd}, - {0x1aa5c, 0x1aa5f}, {0x1fe10, 0x1fe19}, {0x1fe30, 0x1fe52}, {0x1fe54, 0x1fe61}, - {0x1ff01, 0x1ff03}, {0x1ff05, 0x1ff0a}, {0x1ff0c, 0x1ff0f}, {0x1ff3b, 0x1ff3d}, - {0x1ff5f, 0x1ff65}, {0x20021, 0x20023}, {0x20025, 0x2002a}, {0x2002c, 0x2002f}, - {0x2005b, 0x2005d}, {0x2055a, 0x2055f}, {0x2066a, 0x2066d}, {0x20700, 0x2070d}, - {0x207f7, 0x207f9}, {0x20830, 0x2083e}, {0x20f04, 0x20f12}, {0x20f3a, 0x20f3d}, - {0x20fd0, 0x20fd4}, {0x2104a, 0x2104f}, {0x21360, 0x21368}, {0x216eb, 0x216ed}, - {0x217d4, 0x217d6}, {0x217d8, 0x217da}, {0x21800, 0x2180a}, {0x21aa0, 0x21aa6}, - {0x21aa8, 0x21aad}, {0x21b5a, 0x21b60}, {0x21bfc, 0x21bff}, {0x21c3b, 0x21c3f}, - {0x21cc0, 0x21cc7}, {0x22010, 0x22027}, {0x22030, 0x22043}, {0x22045, 0x22051}, - {0x22053, 0x2205e}, {0x22308, 0x2230b}, {0x22768, 0x22775}, {0x227e6, 0x227ef}, - {0x22983, 0x22998}, {0x229d8, 0x229db}, {0x22cf9, 0x22cfc}, {0x22e00, 0x22e2e}, - {0x22e30, 0x22e49}, {0x23001, 0x23003}, {0x23008, 0x23011}, {0x23014, 0x2301f}, - {0x2a60d, 0x2a60f}, {0x2a6f2, 0x2a6f7}, {0x2a874, 0x2a877}, {0x2a8f8, 0x2a8fa}, - {0x2a9c1, 0x2a9cd}, {0x2aa5c, 0x2aa5f}, {0x2fe10, 0x2fe19}, {0x2fe30, 0x2fe52}, - {0x2fe54, 0x2fe61}, {0x2ff01, 0x2ff03}, {0x2ff05, 0x2ff0a}, {0x2ff0c, 0x2ff0f}, - {0x2ff3b, 0x2ff3d}, {0x2ff5f, 0x2ff65}, {0x30021, 0x30023}, {0x30025, 0x3002a}, - {0x3002c, 0x3002f}, {0x3005b, 0x3005d}, {0x3055a, 0x3055f}, {0x3066a, 0x3066d}, - {0x30700, 0x3070d}, {0x307f7, 0x307f9}, {0x30830, 0x3083e}, {0x30f04, 0x30f12}, - {0x30f3a, 0x30f3d}, {0x30fd0, 0x30fd4}, {0x3104a, 0x3104f}, {0x31360, 0x31368}, - {0x316eb, 0x316ed}, {0x317d4, 0x317d6}, {0x317d8, 0x317da}, {0x31800, 0x3180a}, - {0x31aa0, 0x31aa6}, {0x31aa8, 0x31aad}, {0x31b5a, 0x31b60}, {0x31bfc, 0x31bff}, - {0x31c3b, 0x31c3f}, {0x31cc0, 0x31cc7}, {0x32010, 0x32027}, {0x32030, 0x32043}, - {0x32045, 0x32051}, {0x32053, 0x3205e}, {0x32308, 0x3230b}, {0x32768, 0x32775}, - {0x327e6, 0x327ef}, {0x32983, 0x32998}, {0x329d8, 0x329db}, {0x32cf9, 0x32cfc}, - {0x32e00, 0x32e2e}, {0x32e30, 0x32e49}, {0x33001, 0x33003}, {0x33008, 0x33011}, - {0x33014, 0x3301f}, {0x3a60d, 0x3a60f}, {0x3a6f2, 0x3a6f7}, {0x3a874, 0x3a877}, - {0x3a8f8, 0x3a8fa}, {0x3a9c1, 0x3a9cd}, {0x3aa5c, 0x3aa5f}, {0x3fe10, 0x3fe19}, - {0x3fe30, 0x3fe52}, {0x3fe54, 0x3fe61}, {0x3ff01, 0x3ff03}, {0x3ff05, 0x3ff0a}, - {0x3ff0c, 0x3ff0f}, {0x3ff3b, 0x3ff3d}, {0x3ff5f, 0x3ff65}, {0x40021, 0x40023}, - {0x40025, 0x4002a}, {0x4002c, 0x4002f}, {0x4005b, 0x4005d}, {0x4055a, 0x4055f}, - {0x4066a, 0x4066d}, {0x40700, 0x4070d}, {0x407f7, 0x407f9}, {0x40830, 0x4083e}, - {0x40f04, 0x40f12}, {0x40f3a, 0x40f3d}, {0x40fd0, 0x40fd4}, {0x4104a, 0x4104f}, - {0x41360, 0x41368}, {0x416eb, 0x416ed}, {0x417d4, 0x417d6}, {0x417d8, 0x417da}, - {0x41800, 0x4180a}, {0x41aa0, 0x41aa6}, {0x41aa8, 0x41aad}, {0x41b5a, 0x41b60}, - {0x41bfc, 0x41bff}, {0x41c3b, 0x41c3f}, {0x41cc0, 0x41cc7}, {0x42010, 0x42027}, - {0x42030, 0x42043}, {0x42045, 0x42051}, {0x42053, 0x4205e}, {0x42308, 0x4230b}, - {0x42768, 0x42775}, {0x427e6, 0x427ef}, {0x42983, 0x42998}, {0x429d8, 0x429db}, - {0x42cf9, 0x42cfc}, {0x42e00, 0x42e2e}, {0x42e30, 0x42e49}, {0x43001, 0x43003}, - {0x43008, 0x43011}, {0x43014, 0x4301f}, {0x4a60d, 0x4a60f}, {0x4a6f2, 0x4a6f7}, - {0x4a874, 0x4a877}, {0x4a8f8, 0x4a8fa}, {0x4a9c1, 0x4a9cd}, {0x4aa5c, 0x4aa5f}, - {0x4fe10, 0x4fe19}, {0x4fe30, 0x4fe52}, {0x4fe54, 0x4fe61}, {0x4ff01, 0x4ff03}, - {0x4ff05, 0x4ff0a}, {0x4ff0c, 0x4ff0f}, {0x4ff3b, 0x4ff3d}, {0x4ff5f, 0x4ff65}, - {0x50021, 0x50023}, {0x50025, 0x5002a}, {0x5002c, 0x5002f}, {0x5005b, 0x5005d}, - {0x5055a, 0x5055f}, {0x5066a, 0x5066d}, {0x50700, 0x5070d}, {0x507f7, 0x507f9}, - {0x50830, 0x5083e}, {0x50f04, 0x50f12}, {0x50f3a, 0x50f3d}, {0x50fd0, 0x50fd4}, - {0x5104a, 0x5104f}, {0x51360, 0x51368}, {0x516eb, 0x516ed}, {0x517d4, 0x517d6}, - {0x517d8, 0x517da}, {0x51800, 0x5180a}, {0x51aa0, 0x51aa6}, {0x51aa8, 0x51aad}, - {0x51b5a, 0x51b60}, {0x51bfc, 0x51bff}, {0x51c3b, 0x51c3f}, {0x51cc0, 0x51cc7}, - {0x52010, 0x52027}, {0x52030, 0x52043}, {0x52045, 0x52051}, {0x52053, 0x5205e}, - {0x52308, 0x5230b}, {0x52768, 0x52775}, {0x527e6, 0x527ef}, {0x52983, 0x52998}, - {0x529d8, 0x529db}, {0x52cf9, 0x52cfc}, {0x52e00, 0x52e2e}, {0x52e30, 0x52e49}, - {0x53001, 0x53003}, {0x53008, 0x53011}, {0x53014, 0x5301f}, {0x5a60d, 0x5a60f}, - {0x5a6f2, 0x5a6f7}, {0x5a874, 0x5a877}, {0x5a8f8, 0x5a8fa}, {0x5a9c1, 0x5a9cd}, - {0x5aa5c, 0x5aa5f}, {0x5fe10, 0x5fe19}, {0x5fe30, 0x5fe52}, {0x5fe54, 0x5fe61}, - {0x5ff01, 0x5ff03}, {0x5ff05, 0x5ff0a}, {0x5ff0c, 0x5ff0f}, {0x5ff3b, 0x5ff3d}, - {0x5ff5f, 0x5ff65}, {0x60021, 0x60023}, {0x60025, 0x6002a}, {0x6002c, 0x6002f}, - {0x6005b, 0x6005d}, {0x6055a, 0x6055f}, {0x6066a, 0x6066d}, {0x60700, 0x6070d}, - {0x607f7, 0x607f9}, {0x60830, 0x6083e}, {0x60f04, 0x60f12}, {0x60f3a, 0x60f3d}, - {0x60fd0, 0x60fd4}, {0x6104a, 0x6104f}, {0x61360, 0x61368}, {0x616eb, 0x616ed}, - {0x617d4, 0x617d6}, {0x617d8, 0x617da}, {0x61800, 0x6180a}, {0x61aa0, 0x61aa6}, - {0x61aa8, 0x61aad}, {0x61b5a, 0x61b60}, {0x61bfc, 0x61bff}, {0x61c3b, 0x61c3f}, - {0x61cc0, 0x61cc7}, {0x62010, 0x62027}, {0x62030, 0x62043}, {0x62045, 0x62051}, - {0x62053, 0x6205e}, {0x62308, 0x6230b}, {0x62768, 0x62775}, {0x627e6, 0x627ef}, - {0x62983, 0x62998}, {0x629d8, 0x629db}, {0x62cf9, 0x62cfc}, {0x62e00, 0x62e2e}, - {0x62e30, 0x62e49}, {0x63001, 0x63003}, {0x63008, 0x63011}, {0x63014, 0x6301f}, - {0x6a60d, 0x6a60f}, {0x6a6f2, 0x6a6f7}, {0x6a874, 0x6a877}, {0x6a8f8, 0x6a8fa}, - {0x6a9c1, 0x6a9cd}, {0x6aa5c, 0x6aa5f}, {0x6fe10, 0x6fe19}, {0x6fe30, 0x6fe52}, - {0x6fe54, 0x6fe61}, {0x6ff01, 0x6ff03}, {0x6ff05, 0x6ff0a}, {0x6ff0c, 0x6ff0f}, - {0x6ff3b, 0x6ff3d}, {0x6ff5f, 0x6ff65}, {0x70021, 0x70023}, {0x70025, 0x7002a}, - {0x7002c, 0x7002f}, {0x7005b, 0x7005d}, {0x7055a, 0x7055f}, {0x7066a, 0x7066d}, - {0x70700, 0x7070d}, {0x707f7, 0x707f9}, {0x70830, 0x7083e}, {0x70f04, 0x70f12}, - {0x70f3a, 0x70f3d}, {0x70fd0, 0x70fd4}, {0x7104a, 0x7104f}, {0x71360, 0x71368}, - {0x716eb, 0x716ed}, {0x717d4, 0x717d6}, {0x717d8, 0x717da}, {0x71800, 0x7180a}, - {0x71aa0, 0x71aa6}, {0x71aa8, 0x71aad}, {0x71b5a, 0x71b60}, {0x71bfc, 0x71bff}, - {0x71c3b, 0x71c3f}, {0x71cc0, 0x71cc7}, {0x72010, 0x72027}, {0x72030, 0x72043}, - {0x72045, 0x72051}, {0x72053, 0x7205e}, {0x72308, 0x7230b}, {0x72768, 0x72775}, - {0x727e6, 0x727ef}, {0x72983, 0x72998}, {0x729d8, 0x729db}, {0x72cf9, 0x72cfc}, - {0x72e00, 0x72e2e}, {0x72e30, 0x72e49}, {0x73001, 0x73003}, {0x73008, 0x73011}, - {0x73014, 0x7301f}, {0x7a60d, 0x7a60f}, {0x7a6f2, 0x7a6f7}, {0x7a874, 0x7a877}, - {0x7a8f8, 0x7a8fa}, {0x7a9c1, 0x7a9cd}, {0x7aa5c, 0x7aa5f}, {0x7fe10, 0x7fe19}, - {0x7fe30, 0x7fe52}, {0x7fe54, 0x7fe61}, {0x7ff01, 0x7ff03}, {0x7ff05, 0x7ff0a}, - {0x7ff0c, 0x7ff0f}, {0x7ff3b, 0x7ff3d}, {0x7ff5f, 0x7ff65}, {0x80021, 0x80023}, - {0x80025, 0x8002a}, {0x8002c, 0x8002f}, {0x8005b, 0x8005d}, {0x8055a, 0x8055f}, - {0x8066a, 0x8066d}, {0x80700, 0x8070d}, {0x807f7, 0x807f9}, {0x80830, 0x8083e}, - {0x80f04, 0x80f12}, {0x80f3a, 0x80f3d}, {0x80fd0, 0x80fd4}, {0x8104a, 0x8104f}, - {0x81360, 0x81368}, {0x816eb, 0x816ed}, {0x817d4, 0x817d6}, {0x817d8, 0x817da}, - {0x81800, 0x8180a}, {0x81aa0, 0x81aa6}, {0x81aa8, 0x81aad}, {0x81b5a, 0x81b60}, - {0x81bfc, 0x81bff}, {0x81c3b, 0x81c3f}, {0x81cc0, 0x81cc7}, {0x82010, 0x82027}, - {0x82030, 0x82043}, {0x82045, 0x82051}, {0x82053, 0x8205e}, {0x82308, 0x8230b}, - {0x82768, 0x82775}, {0x827e6, 0x827ef}, {0x82983, 0x82998}, {0x829d8, 0x829db}, - {0x82cf9, 0x82cfc}, {0x82e00, 0x82e2e}, {0x82e30, 0x82e49}, {0x83001, 0x83003}, - {0x83008, 0x83011}, {0x83014, 0x8301f}, {0x8a60d, 0x8a60f}, {0x8a6f2, 0x8a6f7}, - {0x8a874, 0x8a877}, {0x8a8f8, 0x8a8fa}, {0x8a9c1, 0x8a9cd}, {0x8aa5c, 0x8aa5f}, - {0x8fe10, 0x8fe19}, {0x8fe30, 0x8fe52}, {0x8fe54, 0x8fe61}, {0x8ff01, 0x8ff03}, - {0x8ff05, 0x8ff0a}, {0x8ff0c, 0x8ff0f}, {0x8ff3b, 0x8ff3d}, {0x8ff5f, 0x8ff65}, - {0x90021, 0x90023}, {0x90025, 0x9002a}, {0x9002c, 0x9002f}, {0x9005b, 0x9005d}, - {0x9055a, 0x9055f}, {0x9066a, 0x9066d}, {0x90700, 0x9070d}, {0x907f7, 0x907f9}, - {0x90830, 0x9083e}, {0x90f04, 0x90f12}, {0x90f3a, 0x90f3d}, {0x90fd0, 0x90fd4}, - {0x9104a, 0x9104f}, {0x91360, 0x91368}, {0x916eb, 0x916ed}, {0x917d4, 0x917d6}, - {0x917d8, 0x917da}, {0x91800, 0x9180a}, {0x91aa0, 0x91aa6}, {0x91aa8, 0x91aad}, - {0x91b5a, 0x91b60}, {0x91bfc, 0x91bff}, {0x91c3b, 0x91c3f}, {0x91cc0, 0x91cc7}, - {0x92010, 0x92027}, {0x92030, 0x92043}, {0x92045, 0x92051}, {0x92053, 0x9205e}, - {0x92308, 0x9230b}, {0x92768, 0x92775}, {0x927e6, 0x927ef}, {0x92983, 0x92998}, - {0x929d8, 0x929db}, {0x92cf9, 0x92cfc}, {0x92e00, 0x92e2e}, {0x92e30, 0x92e49}, - {0x93001, 0x93003}, {0x93008, 0x93011}, {0x93014, 0x9301f}, {0x9a60d, 0x9a60f}, - {0x9a6f2, 0x9a6f7}, {0x9a874, 0x9a877}, {0x9a8f8, 0x9a8fa}, {0x9a9c1, 0x9a9cd}, - {0x9aa5c, 0x9aa5f}, {0x9fe10, 0x9fe19}, {0x9fe30, 0x9fe52}, {0x9fe54, 0x9fe61}, - {0x9ff01, 0x9ff03}, {0x9ff05, 0x9ff0a}, {0x9ff0c, 0x9ff0f}, {0x9ff3b, 0x9ff3d}, - {0x9ff5f, 0x9ff65}, {0xa0021, 0xa0023}, {0xa0025, 0xa002a}, {0xa002c, 0xa002f}, - {0xa005b, 0xa005d}, {0xa055a, 0xa055f}, {0xa066a, 0xa066d}, {0xa0700, 0xa070d}, - {0xa07f7, 0xa07f9}, {0xa0830, 0xa083e}, {0xa0f04, 0xa0f12}, {0xa0f3a, 0xa0f3d}, - {0xa0fd0, 0xa0fd4}, {0xa104a, 0xa104f}, {0xa1360, 0xa1368}, {0xa16eb, 0xa16ed}, - {0xa17d4, 0xa17d6}, {0xa17d8, 0xa17da}, {0xa1800, 0xa180a}, {0xa1aa0, 0xa1aa6}, - {0xa1aa8, 0xa1aad}, {0xa1b5a, 0xa1b60}, {0xa1bfc, 0xa1bff}, {0xa1c3b, 0xa1c3f}, - {0xa1cc0, 0xa1cc7}, {0xa2010, 0xa2027}, {0xa2030, 0xa2043}, {0xa2045, 0xa2051}, - {0xa2053, 0xa205e}, {0xa2308, 0xa230b}, {0xa2768, 0xa2775}, {0xa27e6, 0xa27ef}, - {0xa2983, 0xa2998}, {0xa29d8, 0xa29db}, {0xa2cf9, 0xa2cfc}, {0xa2e00, 0xa2e2e}, - {0xa2e30, 0xa2e49}, {0xa3001, 0xa3003}, {0xa3008, 0xa3011}, {0xa3014, 0xa301f}, - {0xaa60d, 0xaa60f}, {0xaa6f2, 0xaa6f7}, {0xaa874, 0xaa877}, {0xaa8f8, 0xaa8fa}, - {0xaa9c1, 0xaa9cd}, {0xaaa5c, 0xaaa5f}, {0xafe10, 0xafe19}, {0xafe30, 0xafe52}, - {0xafe54, 0xafe61}, {0xaff01, 0xaff03}, {0xaff05, 0xaff0a}, {0xaff0c, 0xaff0f}, - {0xaff3b, 0xaff3d}, {0xaff5f, 0xaff65}, {0xb0021, 0xb0023}, {0xb0025, 0xb002a}, - {0xb002c, 0xb002f}, {0xb005b, 0xb005d}, {0xb055a, 0xb055f}, {0xb066a, 0xb066d}, - {0xb0700, 0xb070d}, {0xb07f7, 0xb07f9}, {0xb0830, 0xb083e}, {0xb0f04, 0xb0f12}, - {0xb0f3a, 0xb0f3d}, {0xb0fd0, 0xb0fd4}, {0xb104a, 0xb104f}, {0xb1360, 0xb1368}, - {0xb16eb, 0xb16ed}, {0xb17d4, 0xb17d6}, {0xb17d8, 0xb17da}, {0xb1800, 0xb180a}, - {0xb1aa0, 0xb1aa6}, {0xb1aa8, 0xb1aad}, {0xb1b5a, 0xb1b60}, {0xb1bfc, 0xb1bff}, - {0xb1c3b, 0xb1c3f}, {0xb1cc0, 0xb1cc7}, {0xb2010, 0xb2027}, {0xb2030, 0xb2043}, - {0xb2045, 0xb2051}, {0xb2053, 0xb205e}, {0xb2308, 0xb230b}, {0xb2768, 0xb2775}, - {0xb27e6, 0xb27ef}, {0xb2983, 0xb2998}, {0xb29d8, 0xb29db}, {0xb2cf9, 0xb2cfc}, - {0xb2e00, 0xb2e2e}, {0xb2e30, 0xb2e49}, {0xb3001, 0xb3003}, {0xb3008, 0xb3011}, - {0xb3014, 0xb301f}, {0xba60d, 0xba60f}, {0xba6f2, 0xba6f7}, {0xba874, 0xba877}, - {0xba8f8, 0xba8fa}, {0xba9c1, 0xba9cd}, {0xbaa5c, 0xbaa5f}, {0xbfe10, 0xbfe19}, - {0xbfe30, 0xbfe52}, {0xbfe54, 0xbfe61}, {0xbff01, 0xbff03}, {0xbff05, 0xbff0a}, - {0xbff0c, 0xbff0f}, {0xbff3b, 0xbff3d}, {0xbff5f, 0xbff65}, {0xc0021, 0xc0023}, - {0xc0025, 0xc002a}, {0xc002c, 0xc002f}, {0xc005b, 0xc005d}, {0xc055a, 0xc055f}, - {0xc066a, 0xc066d}, {0xc0700, 0xc070d}, {0xc07f7, 0xc07f9}, {0xc0830, 0xc083e}, - {0xc0f04, 0xc0f12}, {0xc0f3a, 0xc0f3d}, {0xc0fd0, 0xc0fd4}, {0xc104a, 0xc104f}, - {0xc1360, 0xc1368}, {0xc16eb, 0xc16ed}, {0xc17d4, 0xc17d6}, {0xc17d8, 0xc17da}, - {0xc1800, 0xc180a}, {0xc1aa0, 0xc1aa6}, {0xc1aa8, 0xc1aad}, {0xc1b5a, 0xc1b60}, - {0xc1bfc, 0xc1bff}, {0xc1c3b, 0xc1c3f}, {0xc1cc0, 0xc1cc7}, {0xc2010, 0xc2027}, - {0xc2030, 0xc2043}, {0xc2045, 0xc2051}, {0xc2053, 0xc205e}, {0xc2308, 0xc230b}, - {0xc2768, 0xc2775}, {0xc27e6, 0xc27ef}, {0xc2983, 0xc2998}, {0xc29d8, 0xc29db}, - {0xc2cf9, 0xc2cfc}, {0xc2e00, 0xc2e2e}, {0xc2e30, 0xc2e49}, {0xc3001, 0xc3003}, - {0xc3008, 0xc3011}, {0xc3014, 0xc301f}, {0xca60d, 0xca60f}, {0xca6f2, 0xca6f7}, - {0xca874, 0xca877}, {0xca8f8, 0xca8fa}, {0xca9c1, 0xca9cd}, {0xcaa5c, 0xcaa5f}, - {0xcfe10, 0xcfe19}, {0xcfe30, 0xcfe52}, {0xcfe54, 0xcfe61}, {0xcff01, 0xcff03}, - {0xcff05, 0xcff0a}, {0xcff0c, 0xcff0f}, {0xcff3b, 0xcff3d}, {0xcff5f, 0xcff65}, - {0xd0021, 0xd0023}, {0xd0025, 0xd002a}, {0xd002c, 0xd002f}, {0xd005b, 0xd005d}, - {0xd055a, 0xd055f}, {0xd066a, 0xd066d}, {0xd0700, 0xd070d}, {0xd07f7, 0xd07f9}, - {0xd0830, 0xd083e}, {0xd0f04, 0xd0f12}, {0xd0f3a, 0xd0f3d}, {0xd0fd0, 0xd0fd4}, - {0xd104a, 0xd104f}, {0xd1360, 0xd1368}, {0xd16eb, 0xd16ed}, {0xd17d4, 0xd17d6}, - {0xd17d8, 0xd17da}, {0xd1800, 0xd180a}, {0xd1aa0, 0xd1aa6}, {0xd1aa8, 0xd1aad}, - {0xd1b5a, 0xd1b60}, {0xd1bfc, 0xd1bff}, {0xd1c3b, 0xd1c3f}, {0xd1cc0, 0xd1cc7}, - {0xd2010, 0xd2027}, {0xd2030, 0xd2043}, {0xd2045, 0xd2051}, {0xd2053, 0xd205e}, - {0xd2308, 0xd230b}, {0xd2768, 0xd2775}, {0xd27e6, 0xd27ef}, {0xd2983, 0xd2998}, - {0xd29d8, 0xd29db}, {0xd2cf9, 0xd2cfc}, {0xd2e00, 0xd2e2e}, {0xd2e30, 0xd2e49}, - {0xd3001, 0xd3003}, {0xd3008, 0xd3011}, {0xd3014, 0xd301f}, {0xda60d, 0xda60f}, - {0xda6f2, 0xda6f7}, {0xda874, 0xda877}, {0xda8f8, 0xda8fa}, {0xda9c1, 0xda9cd}, - {0xdaa5c, 0xdaa5f}, {0xdfe10, 0xdfe19}, {0xdfe30, 0xdfe52}, {0xdfe54, 0xdfe61}, - {0xdff01, 0xdff03}, {0xdff05, 0xdff0a}, {0xdff0c, 0xdff0f}, {0xdff3b, 0xdff3d}, - {0xdff5f, 0xdff65}, {0xe0021, 0xe0023}, {0xe0025, 0xe002a}, {0xe002c, 0xe002f}, - {0xe005b, 0xe005d}, {0xe055a, 0xe055f}, {0xe066a, 0xe066d}, {0xe0700, 0xe070d}, - {0xe07f7, 0xe07f9}, {0xe0830, 0xe083e}, {0xe0f04, 0xe0f12}, {0xe0f3a, 0xe0f3d}, - {0xe0fd0, 0xe0fd4}, {0xe104a, 0xe104f}, {0xe1360, 0xe1368}, {0xe16eb, 0xe16ed}, - {0xe17d4, 0xe17d6}, {0xe17d8, 0xe17da}, {0xe1800, 0xe180a}, {0xe1aa0, 0xe1aa6}, - {0xe1aa8, 0xe1aad}, {0xe1b5a, 0xe1b60}, {0xe1bfc, 0xe1bff}, {0xe1c3b, 0xe1c3f}, - {0xe1cc0, 0xe1cc7}, {0xe2010, 0xe2027}, {0xe2030, 0xe2043}, {0xe2045, 0xe2051}, - {0xe2053, 0xe205e}, {0xe2308, 0xe230b}, {0xe2768, 0xe2775}, {0xe27e6, 0xe27ef}, - {0xe2983, 0xe2998}, {0xe29d8, 0xe29db}, {0xe2cf9, 0xe2cfc}, {0xe2e00, 0xe2e2e}, - {0xe2e30, 0xe2e49}, {0xe3001, 0xe3003}, {0xe3008, 0xe3011}, {0xe3014, 0xe301f}, - {0xea60d, 0xea60f}, {0xea6f2, 0xea6f7}, {0xea874, 0xea877}, {0xea8f8, 0xea8fa}, - {0xea9c1, 0xea9cd}, {0xeaa5c, 0xeaa5f}, {0xefe10, 0xefe19}, {0xefe30, 0xefe52}, - {0xefe54, 0xefe61}, {0xeff01, 0xeff03}, {0xeff05, 0xeff0a}, {0xeff0c, 0xeff0f}, - {0xeff3b, 0xeff3d}, {0xeff5f, 0xeff65}, {0xf0021, 0xf0023}, {0xf0025, 0xf002a}, - {0xf002c, 0xf002f}, {0xf005b, 0xf005d}, {0xf055a, 0xf055f}, {0xf066a, 0xf066d}, - {0xf0700, 0xf070d}, {0xf07f7, 0xf07f9}, {0xf0830, 0xf083e}, {0xf0f04, 0xf0f12}, - {0xf0f3a, 0xf0f3d}, {0xf0fd0, 0xf0fd4}, {0xf104a, 0xf104f}, {0xf1360, 0xf1368}, - {0xf16eb, 0xf16ed}, {0xf17d4, 0xf17d6}, {0xf17d8, 0xf17da}, {0xf1800, 0xf180a}, - {0xf1aa0, 0xf1aa6}, {0xf1aa8, 0xf1aad}, {0xf1b5a, 0xf1b60}, {0xf1bfc, 0xf1bff}, - {0xf1c3b, 0xf1c3f}, {0xf1cc0, 0xf1cc7}, {0xf2010, 0xf2027}, {0xf2030, 0xf2043}, - {0xf2045, 0xf2051}, {0xf2053, 0xf205e}, {0xf2308, 0xf230b}, {0xf2768, 0xf2775}, - {0xf27e6, 0xf27ef}, {0xf2983, 0xf2998}, {0xf29d8, 0xf29db}, {0xf2cf9, 0xf2cfc}, - {0xf2e00, 0xf2e2e}, {0xf2e30, 0xf2e49}, {0xf3001, 0xf3003}, {0xf3008, 0xf3011}, - {0xf3014, 0xf301f}, {0xfa60d, 0xfa60f}, {0xfa6f2, 0xfa6f7}, {0xfa874, 0xfa877}, - {0xfa8f8, 0xfa8fa}, {0xfa9c1, 0xfa9cd}, {0xfaa5c, 0xfaa5f}, {0xffe10, 0xffe19}, - {0xffe30, 0xffe52}, {0xffe54, 0xffe61}, {0xfff01, 0xfff03}, {0xfff05, 0xfff0a}, - {0xfff0c, 0xfff0f}, {0xfff3b, 0xfff3d}, {0xfff5f, 0xfff65}, {0x100021, 0x100023}, - {0x100025, 0x10002a}, {0x10002c, 0x10002f}, {0x10005b, 0x10005d}, {0x10055a, 0x10055f}, - {0x10066a, 0x10066d}, {0x100700, 0x10070d}, {0x1007f7, 0x1007f9}, {0x100830, 0x10083e}, - {0x100f04, 0x100f12}, {0x100f3a, 0x100f3d}, {0x100fd0, 0x100fd4}, {0x10104a, 0x10104f}, - {0x101360, 0x101368}, {0x1016eb, 0x1016ed}, {0x1017d4, 0x1017d6}, {0x1017d8, 0x1017da}, - {0x101800, 0x10180a}, {0x101aa0, 0x101aa6}, {0x101aa8, 0x101aad}, {0x101b5a, 0x101b60}, - {0x101bfc, 0x101bff}, {0x101c3b, 0x101c3f}, {0x101cc0, 0x101cc7}, {0x102010, 0x102027}, - {0x102030, 0x102043}, {0x102045, 0x102051}, {0x102053, 0x10205e}, {0x102308, 0x10230b}, - {0x102768, 0x102775}, {0x1027e6, 0x1027ef}, {0x102983, 0x102998}, {0x1029d8, 0x1029db}, - {0x102cf9, 0x102cfc}, {0x102e00, 0x102e2e}, {0x102e30, 0x102e49}, {0x103001, 0x103003}, - {0x103008, 0x103011}, {0x103014, 0x10301f}, {0x10a60d, 0x10a60f}, {0x10a6f2, 0x10a6f7}, - {0x10a874, 0x10a877}, {0x10a8f8, 0x10a8fa}, {0x10a9c1, 0x10a9cd}, {0x10aa5c, 0x10aa5f}, - {0x10fe10, 0x10fe19}, {0x10fe30, 0x10fe52}, {0x10fe54, 0x10fe61}, {0x10ff01, 0x10ff03}, - {0x10ff05, 0x10ff0a}, {0x10ff0c, 0x10ff0f}, {0x10ff3b, 0x10ff3d}, {0x10ff5f, 0x10ff65} + ,{0x10100, 0x10102}, {0x10a50, 0x10a58}, {0x10af0, 0x10af6}, {0x10b39, 0x10b3f}, + {0x10b99, 0x10b9c}, {0x11047, 0x1104d}, {0x110be, 0x110c1}, {0x11140, 0x11143}, + {0x111c5, 0x111c9}, {0x111dd, 0x111df}, {0x11238, 0x1123d}, {0x1144b, 0x1144f}, + {0x115c1, 0x115d7}, {0x11641, 0x11643}, {0x11660, 0x1166c}, {0x1173c, 0x1173e}, + {0x11a3f, 0x11a46}, {0x11a9a, 0x11a9c}, {0x11a9e, 0x11aa2}, {0x11c41, 0x11c45}, + {0x12470, 0x12474}, {0x16b37, 0x16b3b}, {0x1da87, 0x1da8b} #endif }; @@ -2053,198 +380,9 @@ static const chr punctCharTable[] = { 0xaade, 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68, 0xfe6a, 0xfe6b, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d #if TCL_UTF_MAX > 4 - ,0x1003a, 0x1003b, 0x1003f, 0x10040, 0x1005f, 0x1007b, 0x1007d, 0x100a1, 0x100a7, - 0x100ab, 0x100b6, 0x100b7, 0x100bb, 0x100bf, 0x1037e, 0x10387, 0x10589, 0x1058a, - 0x105be, 0x105c0, 0x105c3, 0x105c6, 0x105f3, 0x105f4, 0x10609, 0x1060a, 0x1060c, - 0x1060d, 0x1061b, 0x1061e, 0x1061f, 0x106d4, 0x1085e, 0x10964, 0x10965, 0x10970, - 0x109fd, 0x10af0, 0x10df4, 0x10e4f, 0x10e5a, 0x10e5b, 0x10f14, 0x10f85, 0x10fd9, - 0x10fda, 0x110fb, 0x11400, 0x1166d, 0x1166e, 0x1169b, 0x1169c, 0x11735, 0x11736, - 0x11944, 0x11945, 0x11a1e, 0x11a1f, 0x11c7e, 0x11c7f, 0x11cd3, 0x1207d, 0x1207e, - 0x1208d, 0x1208e, 0x12329, 0x1232a, 0x127c5, 0x127c6, 0x129fc, 0x129fd, 0x12cfe, - 0x12cff, 0x12d70, 0x13030, 0x1303d, 0x130a0, 0x130fb, 0x1a4fe, 0x1a4ff, 0x1a673, - 0x1a67e, 0x1a8ce, 0x1a8cf, 0x1a8fc, 0x1a92e, 0x1a92f, 0x1a95f, 0x1a9de, 0x1a9df, - 0x1aade, 0x1aadf, 0x1aaf0, 0x1aaf1, 0x1abeb, 0x1fd3e, 0x1fd3f, 0x1fe63, 0x1fe68, - 0x1fe6a, 0x1fe6b, 0x1ff1a, 0x1ff1b, 0x1ff1f, 0x1ff20, 0x1ff3f, 0x1ff5b, 0x1ff5d, - 0x2003a, 0x2003b, 0x2003f, 0x20040, 0x2005f, 0x2007b, 0x2007d, 0x200a1, 0x200a7, - 0x200ab, 0x200b6, 0x200b7, 0x200bb, 0x200bf, 0x2037e, 0x20387, 0x20589, 0x2058a, - 0x205be, 0x205c0, 0x205c3, 0x205c6, 0x205f3, 0x205f4, 0x20609, 0x2060a, 0x2060c, - 0x2060d, 0x2061b, 0x2061e, 0x2061f, 0x206d4, 0x2085e, 0x20964, 0x20965, 0x20970, - 0x209fd, 0x20af0, 0x20df4, 0x20e4f, 0x20e5a, 0x20e5b, 0x20f14, 0x20f85, 0x20fd9, - 0x20fda, 0x210fb, 0x21400, 0x2166d, 0x2166e, 0x2169b, 0x2169c, 0x21735, 0x21736, - 0x21944, 0x21945, 0x21a1e, 0x21a1f, 0x21c7e, 0x21c7f, 0x21cd3, 0x2207d, 0x2207e, - 0x2208d, 0x2208e, 0x22329, 0x2232a, 0x227c5, 0x227c6, 0x229fc, 0x229fd, 0x22cfe, - 0x22cff, 0x22d70, 0x23030, 0x2303d, 0x230a0, 0x230fb, 0x2a4fe, 0x2a4ff, 0x2a673, - 0x2a67e, 0x2a8ce, 0x2a8cf, 0x2a8fc, 0x2a92e, 0x2a92f, 0x2a95f, 0x2a9de, 0x2a9df, - 0x2aade, 0x2aadf, 0x2aaf0, 0x2aaf1, 0x2abeb, 0x2fd3e, 0x2fd3f, 0x2fe63, 0x2fe68, - 0x2fe6a, 0x2fe6b, 0x2ff1a, 0x2ff1b, 0x2ff1f, 0x2ff20, 0x2ff3f, 0x2ff5b, 0x2ff5d, - 0x3003a, 0x3003b, 0x3003f, 0x30040, 0x3005f, 0x3007b, 0x3007d, 0x300a1, 0x300a7, - 0x300ab, 0x300b6, 0x300b7, 0x300bb, 0x300bf, 0x3037e, 0x30387, 0x30589, 0x3058a, - 0x305be, 0x305c0, 0x305c3, 0x305c6, 0x305f3, 0x305f4, 0x30609, 0x3060a, 0x3060c, - 0x3060d, 0x3061b, 0x3061e, 0x3061f, 0x306d4, 0x3085e, 0x30964, 0x30965, 0x30970, - 0x309fd, 0x30af0, 0x30df4, 0x30e4f, 0x30e5a, 0x30e5b, 0x30f14, 0x30f85, 0x30fd9, - 0x30fda, 0x310fb, 0x31400, 0x3166d, 0x3166e, 0x3169b, 0x3169c, 0x31735, 0x31736, - 0x31944, 0x31945, 0x31a1e, 0x31a1f, 0x31c7e, 0x31c7f, 0x31cd3, 0x3207d, 0x3207e, - 0x3208d, 0x3208e, 0x32329, 0x3232a, 0x327c5, 0x327c6, 0x329fc, 0x329fd, 0x32cfe, - 0x32cff, 0x32d70, 0x33030, 0x3303d, 0x330a0, 0x330fb, 0x3a4fe, 0x3a4ff, 0x3a673, - 0x3a67e, 0x3a8ce, 0x3a8cf, 0x3a8fc, 0x3a92e, 0x3a92f, 0x3a95f, 0x3a9de, 0x3a9df, - 0x3aade, 0x3aadf, 0x3aaf0, 0x3aaf1, 0x3abeb, 0x3fd3e, 0x3fd3f, 0x3fe63, 0x3fe68, - 0x3fe6a, 0x3fe6b, 0x3ff1a, 0x3ff1b, 0x3ff1f, 0x3ff20, 0x3ff3f, 0x3ff5b, 0x3ff5d, - 0x4003a, 0x4003b, 0x4003f, 0x40040, 0x4005f, 0x4007b, 0x4007d, 0x400a1, 0x400a7, - 0x400ab, 0x400b6, 0x400b7, 0x400bb, 0x400bf, 0x4037e, 0x40387, 0x40589, 0x4058a, - 0x405be, 0x405c0, 0x405c3, 0x405c6, 0x405f3, 0x405f4, 0x40609, 0x4060a, 0x4060c, - 0x4060d, 0x4061b, 0x4061e, 0x4061f, 0x406d4, 0x4085e, 0x40964, 0x40965, 0x40970, - 0x409fd, 0x40af0, 0x40df4, 0x40e4f, 0x40e5a, 0x40e5b, 0x40f14, 0x40f85, 0x40fd9, - 0x40fda, 0x410fb, 0x41400, 0x4166d, 0x4166e, 0x4169b, 0x4169c, 0x41735, 0x41736, - 0x41944, 0x41945, 0x41a1e, 0x41a1f, 0x41c7e, 0x41c7f, 0x41cd3, 0x4207d, 0x4207e, - 0x4208d, 0x4208e, 0x42329, 0x4232a, 0x427c5, 0x427c6, 0x429fc, 0x429fd, 0x42cfe, - 0x42cff, 0x42d70, 0x43030, 0x4303d, 0x430a0, 0x430fb, 0x4a4fe, 0x4a4ff, 0x4a673, - 0x4a67e, 0x4a8ce, 0x4a8cf, 0x4a8fc, 0x4a92e, 0x4a92f, 0x4a95f, 0x4a9de, 0x4a9df, - 0x4aade, 0x4aadf, 0x4aaf0, 0x4aaf1, 0x4abeb, 0x4fd3e, 0x4fd3f, 0x4fe63, 0x4fe68, - 0x4fe6a, 0x4fe6b, 0x4ff1a, 0x4ff1b, 0x4ff1f, 0x4ff20, 0x4ff3f, 0x4ff5b, 0x4ff5d, - 0x5003a, 0x5003b, 0x5003f, 0x50040, 0x5005f, 0x5007b, 0x5007d, 0x500a1, 0x500a7, - 0x500ab, 0x500b6, 0x500b7, 0x500bb, 0x500bf, 0x5037e, 0x50387, 0x50589, 0x5058a, - 0x505be, 0x505c0, 0x505c3, 0x505c6, 0x505f3, 0x505f4, 0x50609, 0x5060a, 0x5060c, - 0x5060d, 0x5061b, 0x5061e, 0x5061f, 0x506d4, 0x5085e, 0x50964, 0x50965, 0x50970, - 0x509fd, 0x50af0, 0x50df4, 0x50e4f, 0x50e5a, 0x50e5b, 0x50f14, 0x50f85, 0x50fd9, - 0x50fda, 0x510fb, 0x51400, 0x5166d, 0x5166e, 0x5169b, 0x5169c, 0x51735, 0x51736, - 0x51944, 0x51945, 0x51a1e, 0x51a1f, 0x51c7e, 0x51c7f, 0x51cd3, 0x5207d, 0x5207e, - 0x5208d, 0x5208e, 0x52329, 0x5232a, 0x527c5, 0x527c6, 0x529fc, 0x529fd, 0x52cfe, - 0x52cff, 0x52d70, 0x53030, 0x5303d, 0x530a0, 0x530fb, 0x5a4fe, 0x5a4ff, 0x5a673, - 0x5a67e, 0x5a8ce, 0x5a8cf, 0x5a8fc, 0x5a92e, 0x5a92f, 0x5a95f, 0x5a9de, 0x5a9df, - 0x5aade, 0x5aadf, 0x5aaf0, 0x5aaf1, 0x5abeb, 0x5fd3e, 0x5fd3f, 0x5fe63, 0x5fe68, - 0x5fe6a, 0x5fe6b, 0x5ff1a, 0x5ff1b, 0x5ff1f, 0x5ff20, 0x5ff3f, 0x5ff5b, 0x5ff5d, - 0x6003a, 0x6003b, 0x6003f, 0x60040, 0x6005f, 0x6007b, 0x6007d, 0x600a1, 0x600a7, - 0x600ab, 0x600b6, 0x600b7, 0x600bb, 0x600bf, 0x6037e, 0x60387, 0x60589, 0x6058a, - 0x605be, 0x605c0, 0x605c3, 0x605c6, 0x605f3, 0x605f4, 0x60609, 0x6060a, 0x6060c, - 0x6060d, 0x6061b, 0x6061e, 0x6061f, 0x606d4, 0x6085e, 0x60964, 0x60965, 0x60970, - 0x609fd, 0x60af0, 0x60df4, 0x60e4f, 0x60e5a, 0x60e5b, 0x60f14, 0x60f85, 0x60fd9, - 0x60fda, 0x610fb, 0x61400, 0x6166d, 0x6166e, 0x6169b, 0x6169c, 0x61735, 0x61736, - 0x61944, 0x61945, 0x61a1e, 0x61a1f, 0x61c7e, 0x61c7f, 0x61cd3, 0x6207d, 0x6207e, - 0x6208d, 0x6208e, 0x62329, 0x6232a, 0x627c5, 0x627c6, 0x629fc, 0x629fd, 0x62cfe, - 0x62cff, 0x62d70, 0x63030, 0x6303d, 0x630a0, 0x630fb, 0x6a4fe, 0x6a4ff, 0x6a673, - 0x6a67e, 0x6a8ce, 0x6a8cf, 0x6a8fc, 0x6a92e, 0x6a92f, 0x6a95f, 0x6a9de, 0x6a9df, - 0x6aade, 0x6aadf, 0x6aaf0, 0x6aaf1, 0x6abeb, 0x6fd3e, 0x6fd3f, 0x6fe63, 0x6fe68, - 0x6fe6a, 0x6fe6b, 0x6ff1a, 0x6ff1b, 0x6ff1f, 0x6ff20, 0x6ff3f, 0x6ff5b, 0x6ff5d, - 0x7003a, 0x7003b, 0x7003f, 0x70040, 0x7005f, 0x7007b, 0x7007d, 0x700a1, 0x700a7, - 0x700ab, 0x700b6, 0x700b7, 0x700bb, 0x700bf, 0x7037e, 0x70387, 0x70589, 0x7058a, - 0x705be, 0x705c0, 0x705c3, 0x705c6, 0x705f3, 0x705f4, 0x70609, 0x7060a, 0x7060c, - 0x7060d, 0x7061b, 0x7061e, 0x7061f, 0x706d4, 0x7085e, 0x70964, 0x70965, 0x70970, - 0x709fd, 0x70af0, 0x70df4, 0x70e4f, 0x70e5a, 0x70e5b, 0x70f14, 0x70f85, 0x70fd9, - 0x70fda, 0x710fb, 0x71400, 0x7166d, 0x7166e, 0x7169b, 0x7169c, 0x71735, 0x71736, - 0x71944, 0x71945, 0x71a1e, 0x71a1f, 0x71c7e, 0x71c7f, 0x71cd3, 0x7207d, 0x7207e, - 0x7208d, 0x7208e, 0x72329, 0x7232a, 0x727c5, 0x727c6, 0x729fc, 0x729fd, 0x72cfe, - 0x72cff, 0x72d70, 0x73030, 0x7303d, 0x730a0, 0x730fb, 0x7a4fe, 0x7a4ff, 0x7a673, - 0x7a67e, 0x7a8ce, 0x7a8cf, 0x7a8fc, 0x7a92e, 0x7a92f, 0x7a95f, 0x7a9de, 0x7a9df, - 0x7aade, 0x7aadf, 0x7aaf0, 0x7aaf1, 0x7abeb, 0x7fd3e, 0x7fd3f, 0x7fe63, 0x7fe68, - 0x7fe6a, 0x7fe6b, 0x7ff1a, 0x7ff1b, 0x7ff1f, 0x7ff20, 0x7ff3f, 0x7ff5b, 0x7ff5d, - 0x8003a, 0x8003b, 0x8003f, 0x80040, 0x8005f, 0x8007b, 0x8007d, 0x800a1, 0x800a7, - 0x800ab, 0x800b6, 0x800b7, 0x800bb, 0x800bf, 0x8037e, 0x80387, 0x80589, 0x8058a, - 0x805be, 0x805c0, 0x805c3, 0x805c6, 0x805f3, 0x805f4, 0x80609, 0x8060a, 0x8060c, - 0x8060d, 0x8061b, 0x8061e, 0x8061f, 0x806d4, 0x8085e, 0x80964, 0x80965, 0x80970, - 0x809fd, 0x80af0, 0x80df4, 0x80e4f, 0x80e5a, 0x80e5b, 0x80f14, 0x80f85, 0x80fd9, - 0x80fda, 0x810fb, 0x81400, 0x8166d, 0x8166e, 0x8169b, 0x8169c, 0x81735, 0x81736, - 0x81944, 0x81945, 0x81a1e, 0x81a1f, 0x81c7e, 0x81c7f, 0x81cd3, 0x8207d, 0x8207e, - 0x8208d, 0x8208e, 0x82329, 0x8232a, 0x827c5, 0x827c6, 0x829fc, 0x829fd, 0x82cfe, - 0x82cff, 0x82d70, 0x83030, 0x8303d, 0x830a0, 0x830fb, 0x8a4fe, 0x8a4ff, 0x8a673, - 0x8a67e, 0x8a8ce, 0x8a8cf, 0x8a8fc, 0x8a92e, 0x8a92f, 0x8a95f, 0x8a9de, 0x8a9df, - 0x8aade, 0x8aadf, 0x8aaf0, 0x8aaf1, 0x8abeb, 0x8fd3e, 0x8fd3f, 0x8fe63, 0x8fe68, - 0x8fe6a, 0x8fe6b, 0x8ff1a, 0x8ff1b, 0x8ff1f, 0x8ff20, 0x8ff3f, 0x8ff5b, 0x8ff5d, - 0x9003a, 0x9003b, 0x9003f, 0x90040, 0x9005f, 0x9007b, 0x9007d, 0x900a1, 0x900a7, - 0x900ab, 0x900b6, 0x900b7, 0x900bb, 0x900bf, 0x9037e, 0x90387, 0x90589, 0x9058a, - 0x905be, 0x905c0, 0x905c3, 0x905c6, 0x905f3, 0x905f4, 0x90609, 0x9060a, 0x9060c, - 0x9060d, 0x9061b, 0x9061e, 0x9061f, 0x906d4, 0x9085e, 0x90964, 0x90965, 0x90970, - 0x909fd, 0x90af0, 0x90df4, 0x90e4f, 0x90e5a, 0x90e5b, 0x90f14, 0x90f85, 0x90fd9, - 0x90fda, 0x910fb, 0x91400, 0x9166d, 0x9166e, 0x9169b, 0x9169c, 0x91735, 0x91736, - 0x91944, 0x91945, 0x91a1e, 0x91a1f, 0x91c7e, 0x91c7f, 0x91cd3, 0x9207d, 0x9207e, - 0x9208d, 0x9208e, 0x92329, 0x9232a, 0x927c5, 0x927c6, 0x929fc, 0x929fd, 0x92cfe, - 0x92cff, 0x92d70, 0x93030, 0x9303d, 0x930a0, 0x930fb, 0x9a4fe, 0x9a4ff, 0x9a673, - 0x9a67e, 0x9a8ce, 0x9a8cf, 0x9a8fc, 0x9a92e, 0x9a92f, 0x9a95f, 0x9a9de, 0x9a9df, - 0x9aade, 0x9aadf, 0x9aaf0, 0x9aaf1, 0x9abeb, 0x9fd3e, 0x9fd3f, 0x9fe63, 0x9fe68, - 0x9fe6a, 0x9fe6b, 0x9ff1a, 0x9ff1b, 0x9ff1f, 0x9ff20, 0x9ff3f, 0x9ff5b, 0x9ff5d, - 0xa003a, 0xa003b, 0xa003f, 0xa0040, 0xa005f, 0xa007b, 0xa007d, 0xa00a1, 0xa00a7, - 0xa00ab, 0xa00b6, 0xa00b7, 0xa00bb, 0xa00bf, 0xa037e, 0xa0387, 0xa0589, 0xa058a, - 0xa05be, 0xa05c0, 0xa05c3, 0xa05c6, 0xa05f3, 0xa05f4, 0xa0609, 0xa060a, 0xa060c, - 0xa060d, 0xa061b, 0xa061e, 0xa061f, 0xa06d4, 0xa085e, 0xa0964, 0xa0965, 0xa0970, - 0xa09fd, 0xa0af0, 0xa0df4, 0xa0e4f, 0xa0e5a, 0xa0e5b, 0xa0f14, 0xa0f85, 0xa0fd9, - 0xa0fda, 0xa10fb, 0xa1400, 0xa166d, 0xa166e, 0xa169b, 0xa169c, 0xa1735, 0xa1736, - 0xa1944, 0xa1945, 0xa1a1e, 0xa1a1f, 0xa1c7e, 0xa1c7f, 0xa1cd3, 0xa207d, 0xa207e, - 0xa208d, 0xa208e, 0xa2329, 0xa232a, 0xa27c5, 0xa27c6, 0xa29fc, 0xa29fd, 0xa2cfe, - 0xa2cff, 0xa2d70, 0xa3030, 0xa303d, 0xa30a0, 0xa30fb, 0xaa4fe, 0xaa4ff, 0xaa673, - 0xaa67e, 0xaa8ce, 0xaa8cf, 0xaa8fc, 0xaa92e, 0xaa92f, 0xaa95f, 0xaa9de, 0xaa9df, - 0xaaade, 0xaaadf, 0xaaaf0, 0xaaaf1, 0xaabeb, 0xafd3e, 0xafd3f, 0xafe63, 0xafe68, - 0xafe6a, 0xafe6b, 0xaff1a, 0xaff1b, 0xaff1f, 0xaff20, 0xaff3f, 0xaff5b, 0xaff5d, - 0xb003a, 0xb003b, 0xb003f, 0xb0040, 0xb005f, 0xb007b, 0xb007d, 0xb00a1, 0xb00a7, - 0xb00ab, 0xb00b6, 0xb00b7, 0xb00bb, 0xb00bf, 0xb037e, 0xb0387, 0xb0589, 0xb058a, - 0xb05be, 0xb05c0, 0xb05c3, 0xb05c6, 0xb05f3, 0xb05f4, 0xb0609, 0xb060a, 0xb060c, - 0xb060d, 0xb061b, 0xb061e, 0xb061f, 0xb06d4, 0xb085e, 0xb0964, 0xb0965, 0xb0970, - 0xb09fd, 0xb0af0, 0xb0df4, 0xb0e4f, 0xb0e5a, 0xb0e5b, 0xb0f14, 0xb0f85, 0xb0fd9, - 0xb0fda, 0xb10fb, 0xb1400, 0xb166d, 0xb166e, 0xb169b, 0xb169c, 0xb1735, 0xb1736, - 0xb1944, 0xb1945, 0xb1a1e, 0xb1a1f, 0xb1c7e, 0xb1c7f, 0xb1cd3, 0xb207d, 0xb207e, - 0xb208d, 0xb208e, 0xb2329, 0xb232a, 0xb27c5, 0xb27c6, 0xb29fc, 0xb29fd, 0xb2cfe, - 0xb2cff, 0xb2d70, 0xb3030, 0xb303d, 0xb30a0, 0xb30fb, 0xba4fe, 0xba4ff, 0xba673, - 0xba67e, 0xba8ce, 0xba8cf, 0xba8fc, 0xba92e, 0xba92f, 0xba95f, 0xba9de, 0xba9df, - 0xbaade, 0xbaadf, 0xbaaf0, 0xbaaf1, 0xbabeb, 0xbfd3e, 0xbfd3f, 0xbfe63, 0xbfe68, - 0xbfe6a, 0xbfe6b, 0xbff1a, 0xbff1b, 0xbff1f, 0xbff20, 0xbff3f, 0xbff5b, 0xbff5d, - 0xc003a, 0xc003b, 0xc003f, 0xc0040, 0xc005f, 0xc007b, 0xc007d, 0xc00a1, 0xc00a7, - 0xc00ab, 0xc00b6, 0xc00b7, 0xc00bb, 0xc00bf, 0xc037e, 0xc0387, 0xc0589, 0xc058a, - 0xc05be, 0xc05c0, 0xc05c3, 0xc05c6, 0xc05f3, 0xc05f4, 0xc0609, 0xc060a, 0xc060c, - 0xc060d, 0xc061b, 0xc061e, 0xc061f, 0xc06d4, 0xc085e, 0xc0964, 0xc0965, 0xc0970, - 0xc09fd, 0xc0af0, 0xc0df4, 0xc0e4f, 0xc0e5a, 0xc0e5b, 0xc0f14, 0xc0f85, 0xc0fd9, - 0xc0fda, 0xc10fb, 0xc1400, 0xc166d, 0xc166e, 0xc169b, 0xc169c, 0xc1735, 0xc1736, - 0xc1944, 0xc1945, 0xc1a1e, 0xc1a1f, 0xc1c7e, 0xc1c7f, 0xc1cd3, 0xc207d, 0xc207e, - 0xc208d, 0xc208e, 0xc2329, 0xc232a, 0xc27c5, 0xc27c6, 0xc29fc, 0xc29fd, 0xc2cfe, - 0xc2cff, 0xc2d70, 0xc3030, 0xc303d, 0xc30a0, 0xc30fb, 0xca4fe, 0xca4ff, 0xca673, - 0xca67e, 0xca8ce, 0xca8cf, 0xca8fc, 0xca92e, 0xca92f, 0xca95f, 0xca9de, 0xca9df, - 0xcaade, 0xcaadf, 0xcaaf0, 0xcaaf1, 0xcabeb, 0xcfd3e, 0xcfd3f, 0xcfe63, 0xcfe68, - 0xcfe6a, 0xcfe6b, 0xcff1a, 0xcff1b, 0xcff1f, 0xcff20, 0xcff3f, 0xcff5b, 0xcff5d, - 0xd003a, 0xd003b, 0xd003f, 0xd0040, 0xd005f, 0xd007b, 0xd007d, 0xd00a1, 0xd00a7, - 0xd00ab, 0xd00b6, 0xd00b7, 0xd00bb, 0xd00bf, 0xd037e, 0xd0387, 0xd0589, 0xd058a, - 0xd05be, 0xd05c0, 0xd05c3, 0xd05c6, 0xd05f3, 0xd05f4, 0xd0609, 0xd060a, 0xd060c, - 0xd060d, 0xd061b, 0xd061e, 0xd061f, 0xd06d4, 0xd085e, 0xd0964, 0xd0965, 0xd0970, - 0xd09fd, 0xd0af0, 0xd0df4, 0xd0e4f, 0xd0e5a, 0xd0e5b, 0xd0f14, 0xd0f85, 0xd0fd9, - 0xd0fda, 0xd10fb, 0xd1400, 0xd166d, 0xd166e, 0xd169b, 0xd169c, 0xd1735, 0xd1736, - 0xd1944, 0xd1945, 0xd1a1e, 0xd1a1f, 0xd1c7e, 0xd1c7f, 0xd1cd3, 0xd207d, 0xd207e, - 0xd208d, 0xd208e, 0xd2329, 0xd232a, 0xd27c5, 0xd27c6, 0xd29fc, 0xd29fd, 0xd2cfe, - 0xd2cff, 0xd2d70, 0xd3030, 0xd303d, 0xd30a0, 0xd30fb, 0xda4fe, 0xda4ff, 0xda673, - 0xda67e, 0xda8ce, 0xda8cf, 0xda8fc, 0xda92e, 0xda92f, 0xda95f, 0xda9de, 0xda9df, - 0xdaade, 0xdaadf, 0xdaaf0, 0xdaaf1, 0xdabeb, 0xdfd3e, 0xdfd3f, 0xdfe63, 0xdfe68, - 0xdfe6a, 0xdfe6b, 0xdff1a, 0xdff1b, 0xdff1f, 0xdff20, 0xdff3f, 0xdff5b, 0xdff5d, - 0xe003a, 0xe003b, 0xe003f, 0xe0040, 0xe005f, 0xe007b, 0xe007d, 0xe00a1, 0xe00a7, - 0xe00ab, 0xe00b6, 0xe00b7, 0xe00bb, 0xe00bf, 0xe037e, 0xe0387, 0xe0589, 0xe058a, - 0xe05be, 0xe05c0, 0xe05c3, 0xe05c6, 0xe05f3, 0xe05f4, 0xe0609, 0xe060a, 0xe060c, - 0xe060d, 0xe061b, 0xe061e, 0xe061f, 0xe06d4, 0xe085e, 0xe0964, 0xe0965, 0xe0970, - 0xe09fd, 0xe0af0, 0xe0df4, 0xe0e4f, 0xe0e5a, 0xe0e5b, 0xe0f14, 0xe0f85, 0xe0fd9, - 0xe0fda, 0xe10fb, 0xe1400, 0xe166d, 0xe166e, 0xe169b, 0xe169c, 0xe1735, 0xe1736, - 0xe1944, 0xe1945, 0xe1a1e, 0xe1a1f, 0xe1c7e, 0xe1c7f, 0xe1cd3, 0xe207d, 0xe207e, - 0xe208d, 0xe208e, 0xe2329, 0xe232a, 0xe27c5, 0xe27c6, 0xe29fc, 0xe29fd, 0xe2cfe, - 0xe2cff, 0xe2d70, 0xe3030, 0xe303d, 0xe30a0, 0xe30fb, 0xea4fe, 0xea4ff, 0xea673, - 0xea67e, 0xea8ce, 0xea8cf, 0xea8fc, 0xea92e, 0xea92f, 0xea95f, 0xea9de, 0xea9df, - 0xeaade, 0xeaadf, 0xeaaf0, 0xeaaf1, 0xeabeb, 0xefd3e, 0xefd3f, 0xefe63, 0xefe68, - 0xefe6a, 0xefe6b, 0xeff1a, 0xeff1b, 0xeff1f, 0xeff20, 0xeff3f, 0xeff5b, 0xeff5d, - 0xf003a, 0xf003b, 0xf003f, 0xf0040, 0xf005f, 0xf007b, 0xf007d, 0xf00a1, 0xf00a7, - 0xf00ab, 0xf00b6, 0xf00b7, 0xf00bb, 0xf00bf, 0xf037e, 0xf0387, 0xf0589, 0xf058a, - 0xf05be, 0xf05c0, 0xf05c3, 0xf05c6, 0xf05f3, 0xf05f4, 0xf0609, 0xf060a, 0xf060c, - 0xf060d, 0xf061b, 0xf061e, 0xf061f, 0xf06d4, 0xf085e, 0xf0964, 0xf0965, 0xf0970, - 0xf09fd, 0xf0af0, 0xf0df4, 0xf0e4f, 0xf0e5a, 0xf0e5b, 0xf0f14, 0xf0f85, 0xf0fd9, - 0xf0fda, 0xf10fb, 0xf1400, 0xf166d, 0xf166e, 0xf169b, 0xf169c, 0xf1735, 0xf1736, - 0xf1944, 0xf1945, 0xf1a1e, 0xf1a1f, 0xf1c7e, 0xf1c7f, 0xf1cd3, 0xf207d, 0xf207e, - 0xf208d, 0xf208e, 0xf2329, 0xf232a, 0xf27c5, 0xf27c6, 0xf29fc, 0xf29fd, 0xf2cfe, - 0xf2cff, 0xf2d70, 0xf3030, 0xf303d, 0xf30a0, 0xf30fb, 0xfa4fe, 0xfa4ff, 0xfa673, - 0xfa67e, 0xfa8ce, 0xfa8cf, 0xfa8fc, 0xfa92e, 0xfa92f, 0xfa95f, 0xfa9de, 0xfa9df, - 0xfaade, 0xfaadf, 0xfaaf0, 0xfaaf1, 0xfabeb, 0xffd3e, 0xffd3f, 0xffe63, 0xffe68, - 0xffe6a, 0xffe6b, 0xfff1a, 0xfff1b, 0xfff1f, 0xfff20, 0xfff3f, 0xfff5b, 0xfff5d, - 0x10003a, 0x10003b, 0x10003f, 0x100040, 0x10005f, 0x10007b, 0x10007d, 0x1000a1, 0x1000a7, - 0x1000ab, 0x1000b6, 0x1000b7, 0x1000bb, 0x1000bf, 0x10037e, 0x100387, 0x100589, 0x10058a, - 0x1005be, 0x1005c0, 0x1005c3, 0x1005c6, 0x1005f3, 0x1005f4, 0x100609, 0x10060a, 0x10060c, - 0x10060d, 0x10061b, 0x10061e, 0x10061f, 0x1006d4, 0x10085e, 0x100964, 0x100965, 0x100970, - 0x1009fd, 0x100af0, 0x100df4, 0x100e4f, 0x100e5a, 0x100e5b, 0x100f14, 0x100f85, 0x100fd9, - 0x100fda, 0x1010fb, 0x101400, 0x10166d, 0x10166e, 0x10169b, 0x10169c, 0x101735, 0x101736, - 0x101944, 0x101945, 0x101a1e, 0x101a1f, 0x101c7e, 0x101c7f, 0x101cd3, 0x10207d, 0x10207e, - 0x10208d, 0x10208e, 0x102329, 0x10232a, 0x1027c5, 0x1027c6, 0x1029fc, 0x1029fd, 0x102cfe, - 0x102cff, 0x102d70, 0x103030, 0x10303d, 0x1030a0, 0x1030fb, 0x10a4fe, 0x10a4ff, 0x10a673, - 0x10a67e, 0x10a8ce, 0x10a8cf, 0x10a8fc, 0x10a92e, 0x10a92f, 0x10a95f, 0x10a9de, 0x10a9df, - 0x10aade, 0x10aadf, 0x10aaf0, 0x10aaf1, 0x10abeb, 0x10fd3e, 0x10fd3f, 0x10fe63, 0x10fe68, - 0x10fe6a, 0x10fe6b, 0x10ff1a, 0x10ff1b, 0x10ff1f, 0x10ff20, 0x10ff3f, 0x10ff5b, 0x10ff5d + ,0x1039f, 0x103d0, 0x1056f, 0x10857, 0x1091f, 0x1093f, 0x10a7f, 0x110bb, 0x110bc, + 0x11174, 0x11175, 0x111cd, 0x111db, 0x112a9, 0x1145b, 0x1145d, 0x114c6, 0x11c70, + 0x11c71, 0x16a6e, 0x16a6f, 0x16af5, 0x16b44, 0x1bc9f, 0x1e95e, 0x1e95f #endif }; @@ -2256,16 +394,6 @@ static const chr punctCharTable[] = { static const crange spaceRangeTable[] = { {0x9, 0xd}, {0x2000, 0x200b} -#if TCL_UTF_MAX > 4 - ,{0x10009, 0x1000d}, {0x12000, 0x1200b}, {0x20009, 0x2000d}, {0x22000, 0x2200b}, - {0x30009, 0x3000d}, {0x32000, 0x3200b}, {0x40009, 0x4000d}, {0x42000, 0x4200b}, - {0x50009, 0x5000d}, {0x52000, 0x5200b}, {0x60009, 0x6000d}, {0x62000, 0x6200b}, - {0x70009, 0x7000d}, {0x72000, 0x7200b}, {0x80009, 0x8000d}, {0x82000, 0x8200b}, - {0x90009, 0x9000d}, {0x92000, 0x9200b}, {0xa0009, 0xa000d}, {0xa2000, 0xa200b}, - {0xb0009, 0xb000d}, {0xb2000, 0xb200b}, {0xc0009, 0xc000d}, {0xc2000, 0xc200b}, - {0xd0009, 0xd000d}, {0xd2000, 0xd200b}, {0xe0009, 0xe000d}, {0xe2000, 0xe200b}, - {0xf0009, 0xf000d}, {0xf2000, 0xf200b}, {0x100009, 0x10000d}, {0x102000, 0x10200b} -#endif }; #define NUM_SPACE_RANGE (sizeof(spaceRangeTable)/sizeof(crange)) @@ -2273,30 +401,6 @@ static const crange spaceRangeTable[] = { static const chr spaceCharTable[] = { 0x20, 0x85, 0xa0, 0x1680, 0x180e, 0x2028, 0x2029, 0x202f, 0x205f, 0x2060, 0x3000, 0xfeff -#if TCL_UTF_MAX > 4 - ,0x10020, 0x10085, 0x100a0, 0x11680, 0x1180e, 0x12028, 0x12029, 0x1202f, 0x1205f, - 0x12060, 0x13000, 0x1feff, 0x20020, 0x20085, 0x200a0, 0x21680, 0x2180e, 0x22028, - 0x22029, 0x2202f, 0x2205f, 0x22060, 0x23000, 0x2feff, 0x30020, 0x30085, 0x300a0, - 0x31680, 0x3180e, 0x32028, 0x32029, 0x3202f, 0x3205f, 0x32060, 0x33000, 0x3feff, - 0x40020, 0x40085, 0x400a0, 0x41680, 0x4180e, 0x42028, 0x42029, 0x4202f, 0x4205f, - 0x42060, 0x43000, 0x4feff, 0x50020, 0x50085, 0x500a0, 0x51680, 0x5180e, 0x52028, - 0x52029, 0x5202f, 0x5205f, 0x52060, 0x53000, 0x5feff, 0x60020, 0x60085, 0x600a0, - 0x61680, 0x6180e, 0x62028, 0x62029, 0x6202f, 0x6205f, 0x62060, 0x63000, 0x6feff, - 0x70020, 0x70085, 0x700a0, 0x71680, 0x7180e, 0x72028, 0x72029, 0x7202f, 0x7205f, - 0x72060, 0x73000, 0x7feff, 0x80020, 0x80085, 0x800a0, 0x81680, 0x8180e, 0x82028, - 0x82029, 0x8202f, 0x8205f, 0x82060, 0x83000, 0x8feff, 0x90020, 0x90085, 0x900a0, - 0x91680, 0x9180e, 0x92028, 0x92029, 0x9202f, 0x9205f, 0x92060, 0x93000, 0x9feff, - 0xa0020, 0xa0085, 0xa00a0, 0xa1680, 0xa180e, 0xa2028, 0xa2029, 0xa202f, 0xa205f, - 0xa2060, 0xa3000, 0xafeff, 0xb0020, 0xb0085, 0xb00a0, 0xb1680, 0xb180e, 0xb2028, - 0xb2029, 0xb202f, 0xb205f, 0xb2060, 0xb3000, 0xbfeff, 0xc0020, 0xc0085, 0xc00a0, - 0xc1680, 0xc180e, 0xc2028, 0xc2029, 0xc202f, 0xc205f, 0xc2060, 0xc3000, 0xcfeff, - 0xd0020, 0xd0085, 0xd00a0, 0xd1680, 0xd180e, 0xd2028, 0xd2029, 0xd202f, 0xd205f, - 0xd2060, 0xd3000, 0xdfeff, 0xe0020, 0xe0085, 0xe00a0, 0xe1680, 0xe180e, 0xe2028, - 0xe2029, 0xe202f, 0xe205f, 0xe2060, 0xe3000, 0xefeff, 0xf0020, 0xf0085, 0xf00a0, - 0xf1680, 0xf180e, 0xf2028, 0xf2029, 0xf202f, 0xf205f, 0xf2060, 0xf3000, 0xffeff, - 0x100020, 0x100085, 0x1000a0, 0x101680, 0x10180e, 0x102028, 0x102029, 0x10202f, 0x10205f, - 0x102060, 0x103000, 0x10feff -#endif }; #define NUM_SPACE_CHAR (sizeof(spaceCharTable)/sizeof(chr)) @@ -2320,206 +424,14 @@ static const crange lowerRangeTable[] = { {0xab30, 0xab5a}, {0xab60, 0xab65}, {0xab70, 0xabbf}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xff41, 0xff5a} #if TCL_UTF_MAX > 4 - ,{0x10061, 0x1007a}, {0x100df, 0x100f6}, {0x100f8, 0x100ff}, {0x1017e, 0x10180}, - {0x10199, 0x1019b}, {0x101bd, 0x101bf}, {0x10233, 0x10239}, {0x1024f, 0x10293}, - {0x10295, 0x102af}, {0x1037b, 0x1037d}, {0x103ac, 0x103ce}, {0x103d5, 0x103d7}, - {0x103ef, 0x103f3}, {0x10430, 0x1045f}, {0x10561, 0x10587}, {0x113f8, 0x113fd}, - {0x11c80, 0x11c88}, {0x11d00, 0x11d2b}, {0x11d6b, 0x11d77}, {0x11d79, 0x11d9a}, - {0x11e95, 0x11e9d}, {0x11eff, 0x11f07}, {0x11f10, 0x11f15}, {0x11f20, 0x11f27}, - {0x11f30, 0x11f37}, {0x11f40, 0x11f45}, {0x11f50, 0x11f57}, {0x11f60, 0x11f67}, - {0x11f70, 0x11f7d}, {0x11f80, 0x11f87}, {0x11f90, 0x11f97}, {0x11fa0, 0x11fa7}, - {0x11fb0, 0x11fb4}, {0x11fc2, 0x11fc4}, {0x11fd0, 0x11fd3}, {0x11fe0, 0x11fe7}, - {0x11ff2, 0x11ff4}, {0x12146, 0x12149}, {0x12c30, 0x12c5e}, {0x12c76, 0x12c7b}, - {0x12d00, 0x12d25}, {0x1a72f, 0x1a731}, {0x1a771, 0x1a778}, {0x1a793, 0x1a795}, - {0x1ab30, 0x1ab5a}, {0x1ab60, 0x1ab65}, {0x1ab70, 0x1abbf}, {0x1fb00, 0x1fb06}, - {0x1fb13, 0x1fb17}, {0x1ff41, 0x1ff5a}, {0x20061, 0x2007a}, {0x200df, 0x200f6}, - {0x200f8, 0x200ff}, {0x2017e, 0x20180}, {0x20199, 0x2019b}, {0x201bd, 0x201bf}, - {0x20233, 0x20239}, {0x2024f, 0x20293}, {0x20295, 0x202af}, {0x2037b, 0x2037d}, - {0x203ac, 0x203ce}, {0x203d5, 0x203d7}, {0x203ef, 0x203f3}, {0x20430, 0x2045f}, - {0x20561, 0x20587}, {0x213f8, 0x213fd}, {0x21c80, 0x21c88}, {0x21d00, 0x21d2b}, - {0x21d6b, 0x21d77}, {0x21d79, 0x21d9a}, {0x21e95, 0x21e9d}, {0x21eff, 0x21f07}, - {0x21f10, 0x21f15}, {0x21f20, 0x21f27}, {0x21f30, 0x21f37}, {0x21f40, 0x21f45}, - {0x21f50, 0x21f57}, {0x21f60, 0x21f67}, {0x21f70, 0x21f7d}, {0x21f80, 0x21f87}, - {0x21f90, 0x21f97}, {0x21fa0, 0x21fa7}, {0x21fb0, 0x21fb4}, {0x21fc2, 0x21fc4}, - {0x21fd0, 0x21fd3}, {0x21fe0, 0x21fe7}, {0x21ff2, 0x21ff4}, {0x22146, 0x22149}, - {0x22c30, 0x22c5e}, {0x22c76, 0x22c7b}, {0x22d00, 0x22d25}, {0x2a72f, 0x2a731}, - {0x2a771, 0x2a778}, {0x2a793, 0x2a795}, {0x2ab30, 0x2ab5a}, {0x2ab60, 0x2ab65}, - {0x2ab70, 0x2abbf}, {0x2fb00, 0x2fb06}, {0x2fb13, 0x2fb17}, {0x2ff41, 0x2ff5a}, - {0x30061, 0x3007a}, {0x300df, 0x300f6}, {0x300f8, 0x300ff}, {0x3017e, 0x30180}, - {0x30199, 0x3019b}, {0x301bd, 0x301bf}, {0x30233, 0x30239}, {0x3024f, 0x30293}, - {0x30295, 0x302af}, {0x3037b, 0x3037d}, {0x303ac, 0x303ce}, {0x303d5, 0x303d7}, - {0x303ef, 0x303f3}, {0x30430, 0x3045f}, {0x30561, 0x30587}, {0x313f8, 0x313fd}, - {0x31c80, 0x31c88}, {0x31d00, 0x31d2b}, {0x31d6b, 0x31d77}, {0x31d79, 0x31d9a}, - {0x31e95, 0x31e9d}, {0x31eff, 0x31f07}, {0x31f10, 0x31f15}, {0x31f20, 0x31f27}, - {0x31f30, 0x31f37}, {0x31f40, 0x31f45}, {0x31f50, 0x31f57}, {0x31f60, 0x31f67}, - {0x31f70, 0x31f7d}, {0x31f80, 0x31f87}, {0x31f90, 0x31f97}, {0x31fa0, 0x31fa7}, - {0x31fb0, 0x31fb4}, {0x31fc2, 0x31fc4}, {0x31fd0, 0x31fd3}, {0x31fe0, 0x31fe7}, - {0x31ff2, 0x31ff4}, {0x32146, 0x32149}, {0x32c30, 0x32c5e}, {0x32c76, 0x32c7b}, - {0x32d00, 0x32d25}, {0x3a72f, 0x3a731}, {0x3a771, 0x3a778}, {0x3a793, 0x3a795}, - {0x3ab30, 0x3ab5a}, {0x3ab60, 0x3ab65}, {0x3ab70, 0x3abbf}, {0x3fb00, 0x3fb06}, - {0x3fb13, 0x3fb17}, {0x3ff41, 0x3ff5a}, {0x40061, 0x4007a}, {0x400df, 0x400f6}, - {0x400f8, 0x400ff}, {0x4017e, 0x40180}, {0x40199, 0x4019b}, {0x401bd, 0x401bf}, - {0x40233, 0x40239}, {0x4024f, 0x40293}, {0x40295, 0x402af}, {0x4037b, 0x4037d}, - {0x403ac, 0x403ce}, {0x403d5, 0x403d7}, {0x403ef, 0x403f3}, {0x40430, 0x4045f}, - {0x40561, 0x40587}, {0x413f8, 0x413fd}, {0x41c80, 0x41c88}, {0x41d00, 0x41d2b}, - {0x41d6b, 0x41d77}, {0x41d79, 0x41d9a}, {0x41e95, 0x41e9d}, {0x41eff, 0x41f07}, - {0x41f10, 0x41f15}, {0x41f20, 0x41f27}, {0x41f30, 0x41f37}, {0x41f40, 0x41f45}, - {0x41f50, 0x41f57}, {0x41f60, 0x41f67}, {0x41f70, 0x41f7d}, {0x41f80, 0x41f87}, - {0x41f90, 0x41f97}, {0x41fa0, 0x41fa7}, {0x41fb0, 0x41fb4}, {0x41fc2, 0x41fc4}, - {0x41fd0, 0x41fd3}, {0x41fe0, 0x41fe7}, {0x41ff2, 0x41ff4}, {0x42146, 0x42149}, - {0x42c30, 0x42c5e}, {0x42c76, 0x42c7b}, {0x42d00, 0x42d25}, {0x4a72f, 0x4a731}, - {0x4a771, 0x4a778}, {0x4a793, 0x4a795}, {0x4ab30, 0x4ab5a}, {0x4ab60, 0x4ab65}, - {0x4ab70, 0x4abbf}, {0x4fb00, 0x4fb06}, {0x4fb13, 0x4fb17}, {0x4ff41, 0x4ff5a}, - {0x50061, 0x5007a}, {0x500df, 0x500f6}, {0x500f8, 0x500ff}, {0x5017e, 0x50180}, - {0x50199, 0x5019b}, {0x501bd, 0x501bf}, {0x50233, 0x50239}, {0x5024f, 0x50293}, - {0x50295, 0x502af}, {0x5037b, 0x5037d}, {0x503ac, 0x503ce}, {0x503d5, 0x503d7}, - {0x503ef, 0x503f3}, {0x50430, 0x5045f}, {0x50561, 0x50587}, {0x513f8, 0x513fd}, - {0x51c80, 0x51c88}, {0x51d00, 0x51d2b}, {0x51d6b, 0x51d77}, {0x51d79, 0x51d9a}, - {0x51e95, 0x51e9d}, {0x51eff, 0x51f07}, {0x51f10, 0x51f15}, {0x51f20, 0x51f27}, - {0x51f30, 0x51f37}, {0x51f40, 0x51f45}, {0x51f50, 0x51f57}, {0x51f60, 0x51f67}, - {0x51f70, 0x51f7d}, {0x51f80, 0x51f87}, {0x51f90, 0x51f97}, {0x51fa0, 0x51fa7}, - {0x51fb0, 0x51fb4}, {0x51fc2, 0x51fc4}, {0x51fd0, 0x51fd3}, {0x51fe0, 0x51fe7}, - {0x51ff2, 0x51ff4}, {0x52146, 0x52149}, {0x52c30, 0x52c5e}, {0x52c76, 0x52c7b}, - {0x52d00, 0x52d25}, {0x5a72f, 0x5a731}, {0x5a771, 0x5a778}, {0x5a793, 0x5a795}, - {0x5ab30, 0x5ab5a}, {0x5ab60, 0x5ab65}, {0x5ab70, 0x5abbf}, {0x5fb00, 0x5fb06}, - {0x5fb13, 0x5fb17}, {0x5ff41, 0x5ff5a}, {0x60061, 0x6007a}, {0x600df, 0x600f6}, - {0x600f8, 0x600ff}, {0x6017e, 0x60180}, {0x60199, 0x6019b}, {0x601bd, 0x601bf}, - {0x60233, 0x60239}, {0x6024f, 0x60293}, {0x60295, 0x602af}, {0x6037b, 0x6037d}, - {0x603ac, 0x603ce}, {0x603d5, 0x603d7}, {0x603ef, 0x603f3}, {0x60430, 0x6045f}, - {0x60561, 0x60587}, {0x613f8, 0x613fd}, {0x61c80, 0x61c88}, {0x61d00, 0x61d2b}, - {0x61d6b, 0x61d77}, {0x61d79, 0x61d9a}, {0x61e95, 0x61e9d}, {0x61eff, 0x61f07}, - {0x61f10, 0x61f15}, {0x61f20, 0x61f27}, {0x61f30, 0x61f37}, {0x61f40, 0x61f45}, - {0x61f50, 0x61f57}, {0x61f60, 0x61f67}, {0x61f70, 0x61f7d}, {0x61f80, 0x61f87}, - {0x61f90, 0x61f97}, {0x61fa0, 0x61fa7}, {0x61fb0, 0x61fb4}, {0x61fc2, 0x61fc4}, - {0x61fd0, 0x61fd3}, {0x61fe0, 0x61fe7}, {0x61ff2, 0x61ff4}, {0x62146, 0x62149}, - {0x62c30, 0x62c5e}, {0x62c76, 0x62c7b}, {0x62d00, 0x62d25}, {0x6a72f, 0x6a731}, - {0x6a771, 0x6a778}, {0x6a793, 0x6a795}, {0x6ab30, 0x6ab5a}, {0x6ab60, 0x6ab65}, - {0x6ab70, 0x6abbf}, {0x6fb00, 0x6fb06}, {0x6fb13, 0x6fb17}, {0x6ff41, 0x6ff5a}, - {0x70061, 0x7007a}, {0x700df, 0x700f6}, {0x700f8, 0x700ff}, {0x7017e, 0x70180}, - {0x70199, 0x7019b}, {0x701bd, 0x701bf}, {0x70233, 0x70239}, {0x7024f, 0x70293}, - {0x70295, 0x702af}, {0x7037b, 0x7037d}, {0x703ac, 0x703ce}, {0x703d5, 0x703d7}, - {0x703ef, 0x703f3}, {0x70430, 0x7045f}, {0x70561, 0x70587}, {0x713f8, 0x713fd}, - {0x71c80, 0x71c88}, {0x71d00, 0x71d2b}, {0x71d6b, 0x71d77}, {0x71d79, 0x71d9a}, - {0x71e95, 0x71e9d}, {0x71eff, 0x71f07}, {0x71f10, 0x71f15}, {0x71f20, 0x71f27}, - {0x71f30, 0x71f37}, {0x71f40, 0x71f45}, {0x71f50, 0x71f57}, {0x71f60, 0x71f67}, - {0x71f70, 0x71f7d}, {0x71f80, 0x71f87}, {0x71f90, 0x71f97}, {0x71fa0, 0x71fa7}, - {0x71fb0, 0x71fb4}, {0x71fc2, 0x71fc4}, {0x71fd0, 0x71fd3}, {0x71fe0, 0x71fe7}, - {0x71ff2, 0x71ff4}, {0x72146, 0x72149}, {0x72c30, 0x72c5e}, {0x72c76, 0x72c7b}, - {0x72d00, 0x72d25}, {0x7a72f, 0x7a731}, {0x7a771, 0x7a778}, {0x7a793, 0x7a795}, - {0x7ab30, 0x7ab5a}, {0x7ab60, 0x7ab65}, {0x7ab70, 0x7abbf}, {0x7fb00, 0x7fb06}, - {0x7fb13, 0x7fb17}, {0x7ff41, 0x7ff5a}, {0x80061, 0x8007a}, {0x800df, 0x800f6}, - {0x800f8, 0x800ff}, {0x8017e, 0x80180}, {0x80199, 0x8019b}, {0x801bd, 0x801bf}, - {0x80233, 0x80239}, {0x8024f, 0x80293}, {0x80295, 0x802af}, {0x8037b, 0x8037d}, - {0x803ac, 0x803ce}, {0x803d5, 0x803d7}, {0x803ef, 0x803f3}, {0x80430, 0x8045f}, - {0x80561, 0x80587}, {0x813f8, 0x813fd}, {0x81c80, 0x81c88}, {0x81d00, 0x81d2b}, - {0x81d6b, 0x81d77}, {0x81d79, 0x81d9a}, {0x81e95, 0x81e9d}, {0x81eff, 0x81f07}, - {0x81f10, 0x81f15}, {0x81f20, 0x81f27}, {0x81f30, 0x81f37}, {0x81f40, 0x81f45}, - {0x81f50, 0x81f57}, {0x81f60, 0x81f67}, {0x81f70, 0x81f7d}, {0x81f80, 0x81f87}, - {0x81f90, 0x81f97}, {0x81fa0, 0x81fa7}, {0x81fb0, 0x81fb4}, {0x81fc2, 0x81fc4}, - {0x81fd0, 0x81fd3}, {0x81fe0, 0x81fe7}, {0x81ff2, 0x81ff4}, {0x82146, 0x82149}, - {0x82c30, 0x82c5e}, {0x82c76, 0x82c7b}, {0x82d00, 0x82d25}, {0x8a72f, 0x8a731}, - {0x8a771, 0x8a778}, {0x8a793, 0x8a795}, {0x8ab30, 0x8ab5a}, {0x8ab60, 0x8ab65}, - {0x8ab70, 0x8abbf}, {0x8fb00, 0x8fb06}, {0x8fb13, 0x8fb17}, {0x8ff41, 0x8ff5a}, - {0x90061, 0x9007a}, {0x900df, 0x900f6}, {0x900f8, 0x900ff}, {0x9017e, 0x90180}, - {0x90199, 0x9019b}, {0x901bd, 0x901bf}, {0x90233, 0x90239}, {0x9024f, 0x90293}, - {0x90295, 0x902af}, {0x9037b, 0x9037d}, {0x903ac, 0x903ce}, {0x903d5, 0x903d7}, - {0x903ef, 0x903f3}, {0x90430, 0x9045f}, {0x90561, 0x90587}, {0x913f8, 0x913fd}, - {0x91c80, 0x91c88}, {0x91d00, 0x91d2b}, {0x91d6b, 0x91d77}, {0x91d79, 0x91d9a}, - {0x91e95, 0x91e9d}, {0x91eff, 0x91f07}, {0x91f10, 0x91f15}, {0x91f20, 0x91f27}, - {0x91f30, 0x91f37}, {0x91f40, 0x91f45}, {0x91f50, 0x91f57}, {0x91f60, 0x91f67}, - {0x91f70, 0x91f7d}, {0x91f80, 0x91f87}, {0x91f90, 0x91f97}, {0x91fa0, 0x91fa7}, - {0x91fb0, 0x91fb4}, {0x91fc2, 0x91fc4}, {0x91fd0, 0x91fd3}, {0x91fe0, 0x91fe7}, - {0x91ff2, 0x91ff4}, {0x92146, 0x92149}, {0x92c30, 0x92c5e}, {0x92c76, 0x92c7b}, - {0x92d00, 0x92d25}, {0x9a72f, 0x9a731}, {0x9a771, 0x9a778}, {0x9a793, 0x9a795}, - {0x9ab30, 0x9ab5a}, {0x9ab60, 0x9ab65}, {0x9ab70, 0x9abbf}, {0x9fb00, 0x9fb06}, - {0x9fb13, 0x9fb17}, {0x9ff41, 0x9ff5a}, {0xa0061, 0xa007a}, {0xa00df, 0xa00f6}, - {0xa00f8, 0xa00ff}, {0xa017e, 0xa0180}, {0xa0199, 0xa019b}, {0xa01bd, 0xa01bf}, - {0xa0233, 0xa0239}, {0xa024f, 0xa0293}, {0xa0295, 0xa02af}, {0xa037b, 0xa037d}, - {0xa03ac, 0xa03ce}, {0xa03d5, 0xa03d7}, {0xa03ef, 0xa03f3}, {0xa0430, 0xa045f}, - {0xa0561, 0xa0587}, {0xa13f8, 0xa13fd}, {0xa1c80, 0xa1c88}, {0xa1d00, 0xa1d2b}, - {0xa1d6b, 0xa1d77}, {0xa1d79, 0xa1d9a}, {0xa1e95, 0xa1e9d}, {0xa1eff, 0xa1f07}, - {0xa1f10, 0xa1f15}, {0xa1f20, 0xa1f27}, {0xa1f30, 0xa1f37}, {0xa1f40, 0xa1f45}, - {0xa1f50, 0xa1f57}, {0xa1f60, 0xa1f67}, {0xa1f70, 0xa1f7d}, {0xa1f80, 0xa1f87}, - {0xa1f90, 0xa1f97}, {0xa1fa0, 0xa1fa7}, {0xa1fb0, 0xa1fb4}, {0xa1fc2, 0xa1fc4}, - {0xa1fd0, 0xa1fd3}, {0xa1fe0, 0xa1fe7}, {0xa1ff2, 0xa1ff4}, {0xa2146, 0xa2149}, - {0xa2c30, 0xa2c5e}, {0xa2c76, 0xa2c7b}, {0xa2d00, 0xa2d25}, {0xaa72f, 0xaa731}, - {0xaa771, 0xaa778}, {0xaa793, 0xaa795}, {0xaab30, 0xaab5a}, {0xaab60, 0xaab65}, - {0xaab70, 0xaabbf}, {0xafb00, 0xafb06}, {0xafb13, 0xafb17}, {0xaff41, 0xaff5a}, - {0xb0061, 0xb007a}, {0xb00df, 0xb00f6}, {0xb00f8, 0xb00ff}, {0xb017e, 0xb0180}, - {0xb0199, 0xb019b}, {0xb01bd, 0xb01bf}, {0xb0233, 0xb0239}, {0xb024f, 0xb0293}, - {0xb0295, 0xb02af}, {0xb037b, 0xb037d}, {0xb03ac, 0xb03ce}, {0xb03d5, 0xb03d7}, - {0xb03ef, 0xb03f3}, {0xb0430, 0xb045f}, {0xb0561, 0xb0587}, {0xb13f8, 0xb13fd}, - {0xb1c80, 0xb1c88}, {0xb1d00, 0xb1d2b}, {0xb1d6b, 0xb1d77}, {0xb1d79, 0xb1d9a}, - {0xb1e95, 0xb1e9d}, {0xb1eff, 0xb1f07}, {0xb1f10, 0xb1f15}, {0xb1f20, 0xb1f27}, - {0xb1f30, 0xb1f37}, {0xb1f40, 0xb1f45}, {0xb1f50, 0xb1f57}, {0xb1f60, 0xb1f67}, - {0xb1f70, 0xb1f7d}, {0xb1f80, 0xb1f87}, {0xb1f90, 0xb1f97}, {0xb1fa0, 0xb1fa7}, - {0xb1fb0, 0xb1fb4}, {0xb1fc2, 0xb1fc4}, {0xb1fd0, 0xb1fd3}, {0xb1fe0, 0xb1fe7}, - {0xb1ff2, 0xb1ff4}, {0xb2146, 0xb2149}, {0xb2c30, 0xb2c5e}, {0xb2c76, 0xb2c7b}, - {0xb2d00, 0xb2d25}, {0xba72f, 0xba731}, {0xba771, 0xba778}, {0xba793, 0xba795}, - {0xbab30, 0xbab5a}, {0xbab60, 0xbab65}, {0xbab70, 0xbabbf}, {0xbfb00, 0xbfb06}, - {0xbfb13, 0xbfb17}, {0xbff41, 0xbff5a}, {0xc0061, 0xc007a}, {0xc00df, 0xc00f6}, - {0xc00f8, 0xc00ff}, {0xc017e, 0xc0180}, {0xc0199, 0xc019b}, {0xc01bd, 0xc01bf}, - {0xc0233, 0xc0239}, {0xc024f, 0xc0293}, {0xc0295, 0xc02af}, {0xc037b, 0xc037d}, - {0xc03ac, 0xc03ce}, {0xc03d5, 0xc03d7}, {0xc03ef, 0xc03f3}, {0xc0430, 0xc045f}, - {0xc0561, 0xc0587}, {0xc13f8, 0xc13fd}, {0xc1c80, 0xc1c88}, {0xc1d00, 0xc1d2b}, - {0xc1d6b, 0xc1d77}, {0xc1d79, 0xc1d9a}, {0xc1e95, 0xc1e9d}, {0xc1eff, 0xc1f07}, - {0xc1f10, 0xc1f15}, {0xc1f20, 0xc1f27}, {0xc1f30, 0xc1f37}, {0xc1f40, 0xc1f45}, - {0xc1f50, 0xc1f57}, {0xc1f60, 0xc1f67}, {0xc1f70, 0xc1f7d}, {0xc1f80, 0xc1f87}, - {0xc1f90, 0xc1f97}, {0xc1fa0, 0xc1fa7}, {0xc1fb0, 0xc1fb4}, {0xc1fc2, 0xc1fc4}, - {0xc1fd0, 0xc1fd3}, {0xc1fe0, 0xc1fe7}, {0xc1ff2, 0xc1ff4}, {0xc2146, 0xc2149}, - {0xc2c30, 0xc2c5e}, {0xc2c76, 0xc2c7b}, {0xc2d00, 0xc2d25}, {0xca72f, 0xca731}, - {0xca771, 0xca778}, {0xca793, 0xca795}, {0xcab30, 0xcab5a}, {0xcab60, 0xcab65}, - {0xcab70, 0xcabbf}, {0xcfb00, 0xcfb06}, {0xcfb13, 0xcfb17}, {0xcff41, 0xcff5a}, - {0xd0061, 0xd007a}, {0xd00df, 0xd00f6}, {0xd00f8, 0xd00ff}, {0xd017e, 0xd0180}, - {0xd0199, 0xd019b}, {0xd01bd, 0xd01bf}, {0xd0233, 0xd0239}, {0xd024f, 0xd0293}, - {0xd0295, 0xd02af}, {0xd037b, 0xd037d}, {0xd03ac, 0xd03ce}, {0xd03d5, 0xd03d7}, - {0xd03ef, 0xd03f3}, {0xd0430, 0xd045f}, {0xd0561, 0xd0587}, {0xd13f8, 0xd13fd}, - {0xd1c80, 0xd1c88}, {0xd1d00, 0xd1d2b}, {0xd1d6b, 0xd1d77}, {0xd1d79, 0xd1d9a}, - {0xd1e95, 0xd1e9d}, {0xd1eff, 0xd1f07}, {0xd1f10, 0xd1f15}, {0xd1f20, 0xd1f27}, - {0xd1f30, 0xd1f37}, {0xd1f40, 0xd1f45}, {0xd1f50, 0xd1f57}, {0xd1f60, 0xd1f67}, - {0xd1f70, 0xd1f7d}, {0xd1f80, 0xd1f87}, {0xd1f90, 0xd1f97}, {0xd1fa0, 0xd1fa7}, - {0xd1fb0, 0xd1fb4}, {0xd1fc2, 0xd1fc4}, {0xd1fd0, 0xd1fd3}, {0xd1fe0, 0xd1fe7}, - {0xd1ff2, 0xd1ff4}, {0xd2146, 0xd2149}, {0xd2c30, 0xd2c5e}, {0xd2c76, 0xd2c7b}, - {0xd2d00, 0xd2d25}, {0xda72f, 0xda731}, {0xda771, 0xda778}, {0xda793, 0xda795}, - {0xdab30, 0xdab5a}, {0xdab60, 0xdab65}, {0xdab70, 0xdabbf}, {0xdfb00, 0xdfb06}, - {0xdfb13, 0xdfb17}, {0xdff41, 0xdff5a}, {0xe0061, 0xe007a}, {0xe00df, 0xe00f6}, - {0xe00f8, 0xe00ff}, {0xe017e, 0xe0180}, {0xe0199, 0xe019b}, {0xe01bd, 0xe01bf}, - {0xe0233, 0xe0239}, {0xe024f, 0xe0293}, {0xe0295, 0xe02af}, {0xe037b, 0xe037d}, - {0xe03ac, 0xe03ce}, {0xe03d5, 0xe03d7}, {0xe03ef, 0xe03f3}, {0xe0430, 0xe045f}, - {0xe0561, 0xe0587}, {0xe13f8, 0xe13fd}, {0xe1c80, 0xe1c88}, {0xe1d00, 0xe1d2b}, - {0xe1d6b, 0xe1d77}, {0xe1d79, 0xe1d9a}, {0xe1e95, 0xe1e9d}, {0xe1eff, 0xe1f07}, - {0xe1f10, 0xe1f15}, {0xe1f20, 0xe1f27}, {0xe1f30, 0xe1f37}, {0xe1f40, 0xe1f45}, - {0xe1f50, 0xe1f57}, {0xe1f60, 0xe1f67}, {0xe1f70, 0xe1f7d}, {0xe1f80, 0xe1f87}, - {0xe1f90, 0xe1f97}, {0xe1fa0, 0xe1fa7}, {0xe1fb0, 0xe1fb4}, {0xe1fc2, 0xe1fc4}, - {0xe1fd0, 0xe1fd3}, {0xe1fe0, 0xe1fe7}, {0xe1ff2, 0xe1ff4}, {0xe2146, 0xe2149}, - {0xe2c30, 0xe2c5e}, {0xe2c76, 0xe2c7b}, {0xe2d00, 0xe2d25}, {0xea72f, 0xea731}, - {0xea771, 0xea778}, {0xea793, 0xea795}, {0xeab30, 0xeab5a}, {0xeab60, 0xeab65}, - {0xeab70, 0xeabbf}, {0xefb00, 0xefb06}, {0xefb13, 0xefb17}, {0xeff41, 0xeff5a}, - {0xf0061, 0xf007a}, {0xf00df, 0xf00f6}, {0xf00f8, 0xf00ff}, {0xf017e, 0xf0180}, - {0xf0199, 0xf019b}, {0xf01bd, 0xf01bf}, {0xf0233, 0xf0239}, {0xf024f, 0xf0293}, - {0xf0295, 0xf02af}, {0xf037b, 0xf037d}, {0xf03ac, 0xf03ce}, {0xf03d5, 0xf03d7}, - {0xf03ef, 0xf03f3}, {0xf0430, 0xf045f}, {0xf0561, 0xf0587}, {0xf13f8, 0xf13fd}, - {0xf1c80, 0xf1c88}, {0xf1d00, 0xf1d2b}, {0xf1d6b, 0xf1d77}, {0xf1d79, 0xf1d9a}, - {0xf1e95, 0xf1e9d}, {0xf1eff, 0xf1f07}, {0xf1f10, 0xf1f15}, {0xf1f20, 0xf1f27}, - {0xf1f30, 0xf1f37}, {0xf1f40, 0xf1f45}, {0xf1f50, 0xf1f57}, {0xf1f60, 0xf1f67}, - {0xf1f70, 0xf1f7d}, {0xf1f80, 0xf1f87}, {0xf1f90, 0xf1f97}, {0xf1fa0, 0xf1fa7}, - {0xf1fb0, 0xf1fb4}, {0xf1fc2, 0xf1fc4}, {0xf1fd0, 0xf1fd3}, {0xf1fe0, 0xf1fe7}, - {0xf1ff2, 0xf1ff4}, {0xf2146, 0xf2149}, {0xf2c30, 0xf2c5e}, {0xf2c76, 0xf2c7b}, - {0xf2d00, 0xf2d25}, {0xfa72f, 0xfa731}, {0xfa771, 0xfa778}, {0xfa793, 0xfa795}, - {0xfab30, 0xfab5a}, {0xfab60, 0xfab65}, {0xfab70, 0xfabbf}, {0xffb00, 0xffb06}, - {0xffb13, 0xffb17}, {0xfff41, 0xfff5a}, {0x100061, 0x10007a}, {0x1000df, 0x1000f6}, - {0x1000f8, 0x1000ff}, {0x10017e, 0x100180}, {0x100199, 0x10019b}, {0x1001bd, 0x1001bf}, - {0x100233, 0x100239}, {0x10024f, 0x100293}, {0x100295, 0x1002af}, {0x10037b, 0x10037d}, - {0x1003ac, 0x1003ce}, {0x1003d5, 0x1003d7}, {0x1003ef, 0x1003f3}, {0x100430, 0x10045f}, - {0x100561, 0x100587}, {0x1013f8, 0x1013fd}, {0x101c80, 0x101c88}, {0x101d00, 0x101d2b}, - {0x101d6b, 0x101d77}, {0x101d79, 0x101d9a}, {0x101e95, 0x101e9d}, {0x101eff, 0x101f07}, - {0x101f10, 0x101f15}, {0x101f20, 0x101f27}, {0x101f30, 0x101f37}, {0x101f40, 0x101f45}, - {0x101f50, 0x101f57}, {0x101f60, 0x101f67}, {0x101f70, 0x101f7d}, {0x101f80, 0x101f87}, - {0x101f90, 0x101f97}, {0x101fa0, 0x101fa7}, {0x101fb0, 0x101fb4}, {0x101fc2, 0x101fc4}, - {0x101fd0, 0x101fd3}, {0x101fe0, 0x101fe7}, {0x101ff2, 0x101ff4}, {0x102146, 0x102149}, - {0x102c30, 0x102c5e}, {0x102c76, 0x102c7b}, {0x102d00, 0x102d25}, {0x10a72f, 0x10a731}, - {0x10a771, 0x10a778}, {0x10a793, 0x10a795}, {0x10ab30, 0x10ab5a}, {0x10ab60, 0x10ab65}, - {0x10ab70, 0x10abbf}, {0x10fb00, 0x10fb06}, {0x10fb13, 0x10fb17}, {0x10ff41, 0x10ff5a} + ,{0x10428, 0x1044f}, {0x104d8, 0x104fb}, {0x10cc0, 0x10cf2}, {0x118c0, 0x118df}, + {0x1d41a, 0x1d433}, {0x1d44e, 0x1d454}, {0x1d456, 0x1d467}, {0x1d482, 0x1d49b}, + {0x1d4b6, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d4cf}, {0x1d4ea, 0x1d503}, + {0x1d51e, 0x1d537}, {0x1d552, 0x1d56b}, {0x1d586, 0x1d59f}, {0x1d5ba, 0x1d5d3}, + {0x1d5ee, 0x1d607}, {0x1d622, 0x1d63b}, {0x1d656, 0x1d66f}, {0x1d68a, 0x1d6a5}, + {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6e1}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d71b}, + {0x1d736, 0x1d74e}, {0x1d750, 0x1d755}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d78f}, + {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7c9}, {0x1e922, 0x1e943} #endif }; @@ -2591,1020 +503,7 @@ static const chr lowerCharTable[] = { 0xa799, 0xa79b, 0xa79d, 0xa79f, 0xa7a1, 0xa7a3, 0xa7a5, 0xa7a7, 0xa7a9, 0xa7b5, 0xa7b7, 0xa7fa #if TCL_UTF_MAX > 4 - ,0x100b5, 0x10101, 0x10103, 0x10105, 0x10107, 0x10109, 0x1010b, 0x1010d, 0x1010f, - 0x10111, 0x10113, 0x10115, 0x10117, 0x10119, 0x1011b, 0x1011d, 0x1011f, 0x10121, - 0x10123, 0x10125, 0x10127, 0x10129, 0x1012b, 0x1012d, 0x1012f, 0x10131, 0x10133, - 0x10135, 0x10137, 0x10138, 0x1013a, 0x1013c, 0x1013e, 0x10140, 0x10142, 0x10144, - 0x10146, 0x10148, 0x10149, 0x1014b, 0x1014d, 0x1014f, 0x10151, 0x10153, 0x10155, - 0x10157, 0x10159, 0x1015b, 0x1015d, 0x1015f, 0x10161, 0x10163, 0x10165, 0x10167, - 0x10169, 0x1016b, 0x1016d, 0x1016f, 0x10171, 0x10173, 0x10175, 0x10177, 0x1017a, - 0x1017c, 0x10183, 0x10185, 0x10188, 0x1018c, 0x1018d, 0x10192, 0x10195, 0x1019e, - 0x101a1, 0x101a3, 0x101a5, 0x101a8, 0x101aa, 0x101ab, 0x101ad, 0x101b0, 0x101b4, - 0x101b6, 0x101b9, 0x101ba, 0x101c6, 0x101c9, 0x101cc, 0x101ce, 0x101d0, 0x101d2, - 0x101d4, 0x101d6, 0x101d8, 0x101da, 0x101dc, 0x101dd, 0x101df, 0x101e1, 0x101e3, - 0x101e5, 0x101e7, 0x101e9, 0x101eb, 0x101ed, 0x101ef, 0x101f0, 0x101f3, 0x101f5, - 0x101f9, 0x101fb, 0x101fd, 0x101ff, 0x10201, 0x10203, 0x10205, 0x10207, 0x10209, - 0x1020b, 0x1020d, 0x1020f, 0x10211, 0x10213, 0x10215, 0x10217, 0x10219, 0x1021b, - 0x1021d, 0x1021f, 0x10221, 0x10223, 0x10225, 0x10227, 0x10229, 0x1022b, 0x1022d, - 0x1022f, 0x10231, 0x1023c, 0x1023f, 0x10240, 0x10242, 0x10247, 0x10249, 0x1024b, - 0x1024d, 0x10371, 0x10373, 0x10377, 0x10390, 0x103d0, 0x103d1, 0x103d9, 0x103db, - 0x103dd, 0x103df, 0x103e1, 0x103e3, 0x103e5, 0x103e7, 0x103e9, 0x103eb, 0x103ed, - 0x103f5, 0x103f8, 0x103fb, 0x103fc, 0x10461, 0x10463, 0x10465, 0x10467, 0x10469, - 0x1046b, 0x1046d, 0x1046f, 0x10471, 0x10473, 0x10475, 0x10477, 0x10479, 0x1047b, - 0x1047d, 0x1047f, 0x10481, 0x1048b, 0x1048d, 0x1048f, 0x10491, 0x10493, 0x10495, - 0x10497, 0x10499, 0x1049b, 0x1049d, 0x1049f, 0x104a1, 0x104a3, 0x104a5, 0x104a7, - 0x104a9, 0x104ab, 0x104ad, 0x104af, 0x104b1, 0x104b3, 0x104b5, 0x104b7, 0x104b9, - 0x104bb, 0x104bd, 0x104bf, 0x104c2, 0x104c4, 0x104c6, 0x104c8, 0x104ca, 0x104cc, - 0x104ce, 0x104cf, 0x104d1, 0x104d3, 0x104d5, 0x104d7, 0x104d9, 0x104db, 0x104dd, - 0x104df, 0x104e1, 0x104e3, 0x104e5, 0x104e7, 0x104e9, 0x104eb, 0x104ed, 0x104ef, - 0x104f1, 0x104f3, 0x104f5, 0x104f7, 0x104f9, 0x104fb, 0x104fd, 0x104ff, 0x10501, - 0x10503, 0x10505, 0x10507, 0x10509, 0x1050b, 0x1050d, 0x1050f, 0x10511, 0x10513, - 0x10515, 0x10517, 0x10519, 0x1051b, 0x1051d, 0x1051f, 0x10521, 0x10523, 0x10525, - 0x10527, 0x10529, 0x1052b, 0x1052d, 0x1052f, 0x11e01, 0x11e03, 0x11e05, 0x11e07, - 0x11e09, 0x11e0b, 0x11e0d, 0x11e0f, 0x11e11, 0x11e13, 0x11e15, 0x11e17, 0x11e19, - 0x11e1b, 0x11e1d, 0x11e1f, 0x11e21, 0x11e23, 0x11e25, 0x11e27, 0x11e29, 0x11e2b, - 0x11e2d, 0x11e2f, 0x11e31, 0x11e33, 0x11e35, 0x11e37, 0x11e39, 0x11e3b, 0x11e3d, - 0x11e3f, 0x11e41, 0x11e43, 0x11e45, 0x11e47, 0x11e49, 0x11e4b, 0x11e4d, 0x11e4f, - 0x11e51, 0x11e53, 0x11e55, 0x11e57, 0x11e59, 0x11e5b, 0x11e5d, 0x11e5f, 0x11e61, - 0x11e63, 0x11e65, 0x11e67, 0x11e69, 0x11e6b, 0x11e6d, 0x11e6f, 0x11e71, 0x11e73, - 0x11e75, 0x11e77, 0x11e79, 0x11e7b, 0x11e7d, 0x11e7f, 0x11e81, 0x11e83, 0x11e85, - 0x11e87, 0x11e89, 0x11e8b, 0x11e8d, 0x11e8f, 0x11e91, 0x11e93, 0x11e9f, 0x11ea1, - 0x11ea3, 0x11ea5, 0x11ea7, 0x11ea9, 0x11eab, 0x11ead, 0x11eaf, 0x11eb1, 0x11eb3, - 0x11eb5, 0x11eb7, 0x11eb9, 0x11ebb, 0x11ebd, 0x11ebf, 0x11ec1, 0x11ec3, 0x11ec5, - 0x11ec7, 0x11ec9, 0x11ecb, 0x11ecd, 0x11ecf, 0x11ed1, 0x11ed3, 0x11ed5, 0x11ed7, - 0x11ed9, 0x11edb, 0x11edd, 0x11edf, 0x11ee1, 0x11ee3, 0x11ee5, 0x11ee7, 0x11ee9, - 0x11eeb, 0x11eed, 0x11eef, 0x11ef1, 0x11ef3, 0x11ef5, 0x11ef7, 0x11ef9, 0x11efb, - 0x11efd, 0x11fb6, 0x11fb7, 0x11fbe, 0x11fc6, 0x11fc7, 0x11fd6, 0x11fd7, 0x11ff6, - 0x11ff7, 0x1210a, 0x1210e, 0x1210f, 0x12113, 0x1212f, 0x12134, 0x12139, 0x1213c, - 0x1213d, 0x1214e, 0x12184, 0x12c61, 0x12c65, 0x12c66, 0x12c68, 0x12c6a, 0x12c6c, - 0x12c71, 0x12c73, 0x12c74, 0x12c81, 0x12c83, 0x12c85, 0x12c87, 0x12c89, 0x12c8b, - 0x12c8d, 0x12c8f, 0x12c91, 0x12c93, 0x12c95, 0x12c97, 0x12c99, 0x12c9b, 0x12c9d, - 0x12c9f, 0x12ca1, 0x12ca3, 0x12ca5, 0x12ca7, 0x12ca9, 0x12cab, 0x12cad, 0x12caf, - 0x12cb1, 0x12cb3, 0x12cb5, 0x12cb7, 0x12cb9, 0x12cbb, 0x12cbd, 0x12cbf, 0x12cc1, - 0x12cc3, 0x12cc5, 0x12cc7, 0x12cc9, 0x12ccb, 0x12ccd, 0x12ccf, 0x12cd1, 0x12cd3, - 0x12cd5, 0x12cd7, 0x12cd9, 0x12cdb, 0x12cdd, 0x12cdf, 0x12ce1, 0x12ce3, 0x12ce4, - 0x12cec, 0x12cee, 0x12cf3, 0x12d27, 0x12d2d, 0x1a641, 0x1a643, 0x1a645, 0x1a647, - 0x1a649, 0x1a64b, 0x1a64d, 0x1a64f, 0x1a651, 0x1a653, 0x1a655, 0x1a657, 0x1a659, - 0x1a65b, 0x1a65d, 0x1a65f, 0x1a661, 0x1a663, 0x1a665, 0x1a667, 0x1a669, 0x1a66b, - 0x1a66d, 0x1a681, 0x1a683, 0x1a685, 0x1a687, 0x1a689, 0x1a68b, 0x1a68d, 0x1a68f, - 0x1a691, 0x1a693, 0x1a695, 0x1a697, 0x1a699, 0x1a69b, 0x1a723, 0x1a725, 0x1a727, - 0x1a729, 0x1a72b, 0x1a72d, 0x1a733, 0x1a735, 0x1a737, 0x1a739, 0x1a73b, 0x1a73d, - 0x1a73f, 0x1a741, 0x1a743, 0x1a745, 0x1a747, 0x1a749, 0x1a74b, 0x1a74d, 0x1a74f, - 0x1a751, 0x1a753, 0x1a755, 0x1a757, 0x1a759, 0x1a75b, 0x1a75d, 0x1a75f, 0x1a761, - 0x1a763, 0x1a765, 0x1a767, 0x1a769, 0x1a76b, 0x1a76d, 0x1a76f, 0x1a77a, 0x1a77c, - 0x1a77f, 0x1a781, 0x1a783, 0x1a785, 0x1a787, 0x1a78c, 0x1a78e, 0x1a791, 0x1a797, - 0x1a799, 0x1a79b, 0x1a79d, 0x1a79f, 0x1a7a1, 0x1a7a3, 0x1a7a5, 0x1a7a7, 0x1a7a9, - 0x1a7b5, 0x1a7b7, 0x1a7fa, 0x200b5, 0x20101, 0x20103, 0x20105, 0x20107, 0x20109, - 0x2010b, 0x2010d, 0x2010f, 0x20111, 0x20113, 0x20115, 0x20117, 0x20119, 0x2011b, - 0x2011d, 0x2011f, 0x20121, 0x20123, 0x20125, 0x20127, 0x20129, 0x2012b, 0x2012d, - 0x2012f, 0x20131, 0x20133, 0x20135, 0x20137, 0x20138, 0x2013a, 0x2013c, 0x2013e, - 0x20140, 0x20142, 0x20144, 0x20146, 0x20148, 0x20149, 0x2014b, 0x2014d, 0x2014f, - 0x20151, 0x20153, 0x20155, 0x20157, 0x20159, 0x2015b, 0x2015d, 0x2015f, 0x20161, - 0x20163, 0x20165, 0x20167, 0x20169, 0x2016b, 0x2016d, 0x2016f, 0x20171, 0x20173, - 0x20175, 0x20177, 0x2017a, 0x2017c, 0x20183, 0x20185, 0x20188, 0x2018c, 0x2018d, - 0x20192, 0x20195, 0x2019e, 0x201a1, 0x201a3, 0x201a5, 0x201a8, 0x201aa, 0x201ab, - 0x201ad, 0x201b0, 0x201b4, 0x201b6, 0x201b9, 0x201ba, 0x201c6, 0x201c9, 0x201cc, - 0x201ce, 0x201d0, 0x201d2, 0x201d4, 0x201d6, 0x201d8, 0x201da, 0x201dc, 0x201dd, - 0x201df, 0x201e1, 0x201e3, 0x201e5, 0x201e7, 0x201e9, 0x201eb, 0x201ed, 0x201ef, - 0x201f0, 0x201f3, 0x201f5, 0x201f9, 0x201fb, 0x201fd, 0x201ff, 0x20201, 0x20203, - 0x20205, 0x20207, 0x20209, 0x2020b, 0x2020d, 0x2020f, 0x20211, 0x20213, 0x20215, - 0x20217, 0x20219, 0x2021b, 0x2021d, 0x2021f, 0x20221, 0x20223, 0x20225, 0x20227, - 0x20229, 0x2022b, 0x2022d, 0x2022f, 0x20231, 0x2023c, 0x2023f, 0x20240, 0x20242, - 0x20247, 0x20249, 0x2024b, 0x2024d, 0x20371, 0x20373, 0x20377, 0x20390, 0x203d0, - 0x203d1, 0x203d9, 0x203db, 0x203dd, 0x203df, 0x203e1, 0x203e3, 0x203e5, 0x203e7, - 0x203e9, 0x203eb, 0x203ed, 0x203f5, 0x203f8, 0x203fb, 0x203fc, 0x20461, 0x20463, - 0x20465, 0x20467, 0x20469, 0x2046b, 0x2046d, 0x2046f, 0x20471, 0x20473, 0x20475, - 0x20477, 0x20479, 0x2047b, 0x2047d, 0x2047f, 0x20481, 0x2048b, 0x2048d, 0x2048f, - 0x20491, 0x20493, 0x20495, 0x20497, 0x20499, 0x2049b, 0x2049d, 0x2049f, 0x204a1, - 0x204a3, 0x204a5, 0x204a7, 0x204a9, 0x204ab, 0x204ad, 0x204af, 0x204b1, 0x204b3, - 0x204b5, 0x204b7, 0x204b9, 0x204bb, 0x204bd, 0x204bf, 0x204c2, 0x204c4, 0x204c6, - 0x204c8, 0x204ca, 0x204cc, 0x204ce, 0x204cf, 0x204d1, 0x204d3, 0x204d5, 0x204d7, - 0x204d9, 0x204db, 0x204dd, 0x204df, 0x204e1, 0x204e3, 0x204e5, 0x204e7, 0x204e9, - 0x204eb, 0x204ed, 0x204ef, 0x204f1, 0x204f3, 0x204f5, 0x204f7, 0x204f9, 0x204fb, - 0x204fd, 0x204ff, 0x20501, 0x20503, 0x20505, 0x20507, 0x20509, 0x2050b, 0x2050d, - 0x2050f, 0x20511, 0x20513, 0x20515, 0x20517, 0x20519, 0x2051b, 0x2051d, 0x2051f, - 0x20521, 0x20523, 0x20525, 0x20527, 0x20529, 0x2052b, 0x2052d, 0x2052f, 0x21e01, - 0x21e03, 0x21e05, 0x21e07, 0x21e09, 0x21e0b, 0x21e0d, 0x21e0f, 0x21e11, 0x21e13, - 0x21e15, 0x21e17, 0x21e19, 0x21e1b, 0x21e1d, 0x21e1f, 0x21e21, 0x21e23, 0x21e25, - 0x21e27, 0x21e29, 0x21e2b, 0x21e2d, 0x21e2f, 0x21e31, 0x21e33, 0x21e35, 0x21e37, - 0x21e39, 0x21e3b, 0x21e3d, 0x21e3f, 0x21e41, 0x21e43, 0x21e45, 0x21e47, 0x21e49, - 0x21e4b, 0x21e4d, 0x21e4f, 0x21e51, 0x21e53, 0x21e55, 0x21e57, 0x21e59, 0x21e5b, - 0x21e5d, 0x21e5f, 0x21e61, 0x21e63, 0x21e65, 0x21e67, 0x21e69, 0x21e6b, 0x21e6d, - 0x21e6f, 0x21e71, 0x21e73, 0x21e75, 0x21e77, 0x21e79, 0x21e7b, 0x21e7d, 0x21e7f, - 0x21e81, 0x21e83, 0x21e85, 0x21e87, 0x21e89, 0x21e8b, 0x21e8d, 0x21e8f, 0x21e91, - 0x21e93, 0x21e9f, 0x21ea1, 0x21ea3, 0x21ea5, 0x21ea7, 0x21ea9, 0x21eab, 0x21ead, - 0x21eaf, 0x21eb1, 0x21eb3, 0x21eb5, 0x21eb7, 0x21eb9, 0x21ebb, 0x21ebd, 0x21ebf, - 0x21ec1, 0x21ec3, 0x21ec5, 0x21ec7, 0x21ec9, 0x21ecb, 0x21ecd, 0x21ecf, 0x21ed1, - 0x21ed3, 0x21ed5, 0x21ed7, 0x21ed9, 0x21edb, 0x21edd, 0x21edf, 0x21ee1, 0x21ee3, - 0x21ee5, 0x21ee7, 0x21ee9, 0x21eeb, 0x21eed, 0x21eef, 0x21ef1, 0x21ef3, 0x21ef5, - 0x21ef7, 0x21ef9, 0x21efb, 0x21efd, 0x21fb6, 0x21fb7, 0x21fbe, 0x21fc6, 0x21fc7, - 0x21fd6, 0x21fd7, 0x21ff6, 0x21ff7, 0x2210a, 0x2210e, 0x2210f, 0x22113, 0x2212f, - 0x22134, 0x22139, 0x2213c, 0x2213d, 0x2214e, 0x22184, 0x22c61, 0x22c65, 0x22c66, - 0x22c68, 0x22c6a, 0x22c6c, 0x22c71, 0x22c73, 0x22c74, 0x22c81, 0x22c83, 0x22c85, - 0x22c87, 0x22c89, 0x22c8b, 0x22c8d, 0x22c8f, 0x22c91, 0x22c93, 0x22c95, 0x22c97, - 0x22c99, 0x22c9b, 0x22c9d, 0x22c9f, 0x22ca1, 0x22ca3, 0x22ca5, 0x22ca7, 0x22ca9, - 0x22cab, 0x22cad, 0x22caf, 0x22cb1, 0x22cb3, 0x22cb5, 0x22cb7, 0x22cb9, 0x22cbb, - 0x22cbd, 0x22cbf, 0x22cc1, 0x22cc3, 0x22cc5, 0x22cc7, 0x22cc9, 0x22ccb, 0x22ccd, - 0x22ccf, 0x22cd1, 0x22cd3, 0x22cd5, 0x22cd7, 0x22cd9, 0x22cdb, 0x22cdd, 0x22cdf, - 0x22ce1, 0x22ce3, 0x22ce4, 0x22cec, 0x22cee, 0x22cf3, 0x22d27, 0x22d2d, 0x2a641, - 0x2a643, 0x2a645, 0x2a647, 0x2a649, 0x2a64b, 0x2a64d, 0x2a64f, 0x2a651, 0x2a653, - 0x2a655, 0x2a657, 0x2a659, 0x2a65b, 0x2a65d, 0x2a65f, 0x2a661, 0x2a663, 0x2a665, - 0x2a667, 0x2a669, 0x2a66b, 0x2a66d, 0x2a681, 0x2a683, 0x2a685, 0x2a687, 0x2a689, - 0x2a68b, 0x2a68d, 0x2a68f, 0x2a691, 0x2a693, 0x2a695, 0x2a697, 0x2a699, 0x2a69b, - 0x2a723, 0x2a725, 0x2a727, 0x2a729, 0x2a72b, 0x2a72d, 0x2a733, 0x2a735, 0x2a737, - 0x2a739, 0x2a73b, 0x2a73d, 0x2a73f, 0x2a741, 0x2a743, 0x2a745, 0x2a747, 0x2a749, - 0x2a74b, 0x2a74d, 0x2a74f, 0x2a751, 0x2a753, 0x2a755, 0x2a757, 0x2a759, 0x2a75b, - 0x2a75d, 0x2a75f, 0x2a761, 0x2a763, 0x2a765, 0x2a767, 0x2a769, 0x2a76b, 0x2a76d, - 0x2a76f, 0x2a77a, 0x2a77c, 0x2a77f, 0x2a781, 0x2a783, 0x2a785, 0x2a787, 0x2a78c, - 0x2a78e, 0x2a791, 0x2a797, 0x2a799, 0x2a79b, 0x2a79d, 0x2a79f, 0x2a7a1, 0x2a7a3, - 0x2a7a5, 0x2a7a7, 0x2a7a9, 0x2a7b5, 0x2a7b7, 0x2a7fa, 0x300b5, 0x30101, 0x30103, - 0x30105, 0x30107, 0x30109, 0x3010b, 0x3010d, 0x3010f, 0x30111, 0x30113, 0x30115, - 0x30117, 0x30119, 0x3011b, 0x3011d, 0x3011f, 0x30121, 0x30123, 0x30125, 0x30127, - 0x30129, 0x3012b, 0x3012d, 0x3012f, 0x30131, 0x30133, 0x30135, 0x30137, 0x30138, - 0x3013a, 0x3013c, 0x3013e, 0x30140, 0x30142, 0x30144, 0x30146, 0x30148, 0x30149, - 0x3014b, 0x3014d, 0x3014f, 0x30151, 0x30153, 0x30155, 0x30157, 0x30159, 0x3015b, - 0x3015d, 0x3015f, 0x30161, 0x30163, 0x30165, 0x30167, 0x30169, 0x3016b, 0x3016d, - 0x3016f, 0x30171, 0x30173, 0x30175, 0x30177, 0x3017a, 0x3017c, 0x30183, 0x30185, - 0x30188, 0x3018c, 0x3018d, 0x30192, 0x30195, 0x3019e, 0x301a1, 0x301a3, 0x301a5, - 0x301a8, 0x301aa, 0x301ab, 0x301ad, 0x301b0, 0x301b4, 0x301b6, 0x301b9, 0x301ba, - 0x301c6, 0x301c9, 0x301cc, 0x301ce, 0x301d0, 0x301d2, 0x301d4, 0x301d6, 0x301d8, - 0x301da, 0x301dc, 0x301dd, 0x301df, 0x301e1, 0x301e3, 0x301e5, 0x301e7, 0x301e9, - 0x301eb, 0x301ed, 0x301ef, 0x301f0, 0x301f3, 0x301f5, 0x301f9, 0x301fb, 0x301fd, - 0x301ff, 0x30201, 0x30203, 0x30205, 0x30207, 0x30209, 0x3020b, 0x3020d, 0x3020f, - 0x30211, 0x30213, 0x30215, 0x30217, 0x30219, 0x3021b, 0x3021d, 0x3021f, 0x30221, - 0x30223, 0x30225, 0x30227, 0x30229, 0x3022b, 0x3022d, 0x3022f, 0x30231, 0x3023c, - 0x3023f, 0x30240, 0x30242, 0x30247, 0x30249, 0x3024b, 0x3024d, 0x30371, 0x30373, - 0x30377, 0x30390, 0x303d0, 0x303d1, 0x303d9, 0x303db, 0x303dd, 0x303df, 0x303e1, - 0x303e3, 0x303e5, 0x303e7, 0x303e9, 0x303eb, 0x303ed, 0x303f5, 0x303f8, 0x303fb, - 0x303fc, 0x30461, 0x30463, 0x30465, 0x30467, 0x30469, 0x3046b, 0x3046d, 0x3046f, - 0x30471, 0x30473, 0x30475, 0x30477, 0x30479, 0x3047b, 0x3047d, 0x3047f, 0x30481, - 0x3048b, 0x3048d, 0x3048f, 0x30491, 0x30493, 0x30495, 0x30497, 0x30499, 0x3049b, - 0x3049d, 0x3049f, 0x304a1, 0x304a3, 0x304a5, 0x304a7, 0x304a9, 0x304ab, 0x304ad, - 0x304af, 0x304b1, 0x304b3, 0x304b5, 0x304b7, 0x304b9, 0x304bb, 0x304bd, 0x304bf, - 0x304c2, 0x304c4, 0x304c6, 0x304c8, 0x304ca, 0x304cc, 0x304ce, 0x304cf, 0x304d1, - 0x304d3, 0x304d5, 0x304d7, 0x304d9, 0x304db, 0x304dd, 0x304df, 0x304e1, 0x304e3, - 0x304e5, 0x304e7, 0x304e9, 0x304eb, 0x304ed, 0x304ef, 0x304f1, 0x304f3, 0x304f5, - 0x304f7, 0x304f9, 0x304fb, 0x304fd, 0x304ff, 0x30501, 0x30503, 0x30505, 0x30507, - 0x30509, 0x3050b, 0x3050d, 0x3050f, 0x30511, 0x30513, 0x30515, 0x30517, 0x30519, - 0x3051b, 0x3051d, 0x3051f, 0x30521, 0x30523, 0x30525, 0x30527, 0x30529, 0x3052b, - 0x3052d, 0x3052f, 0x31e01, 0x31e03, 0x31e05, 0x31e07, 0x31e09, 0x31e0b, 0x31e0d, - 0x31e0f, 0x31e11, 0x31e13, 0x31e15, 0x31e17, 0x31e19, 0x31e1b, 0x31e1d, 0x31e1f, - 0x31e21, 0x31e23, 0x31e25, 0x31e27, 0x31e29, 0x31e2b, 0x31e2d, 0x31e2f, 0x31e31, - 0x31e33, 0x31e35, 0x31e37, 0x31e39, 0x31e3b, 0x31e3d, 0x31e3f, 0x31e41, 0x31e43, - 0x31e45, 0x31e47, 0x31e49, 0x31e4b, 0x31e4d, 0x31e4f, 0x31e51, 0x31e53, 0x31e55, - 0x31e57, 0x31e59, 0x31e5b, 0x31e5d, 0x31e5f, 0x31e61, 0x31e63, 0x31e65, 0x31e67, - 0x31e69, 0x31e6b, 0x31e6d, 0x31e6f, 0x31e71, 0x31e73, 0x31e75, 0x31e77, 0x31e79, - 0x31e7b, 0x31e7d, 0x31e7f, 0x31e81, 0x31e83, 0x31e85, 0x31e87, 0x31e89, 0x31e8b, - 0x31e8d, 0x31e8f, 0x31e91, 0x31e93, 0x31e9f, 0x31ea1, 0x31ea3, 0x31ea5, 0x31ea7, - 0x31ea9, 0x31eab, 0x31ead, 0x31eaf, 0x31eb1, 0x31eb3, 0x31eb5, 0x31eb7, 0x31eb9, - 0x31ebb, 0x31ebd, 0x31ebf, 0x31ec1, 0x31ec3, 0x31ec5, 0x31ec7, 0x31ec9, 0x31ecb, - 0x31ecd, 0x31ecf, 0x31ed1, 0x31ed3, 0x31ed5, 0x31ed7, 0x31ed9, 0x31edb, 0x31edd, - 0x31edf, 0x31ee1, 0x31ee3, 0x31ee5, 0x31ee7, 0x31ee9, 0x31eeb, 0x31eed, 0x31eef, - 0x31ef1, 0x31ef3, 0x31ef5, 0x31ef7, 0x31ef9, 0x31efb, 0x31efd, 0x31fb6, 0x31fb7, - 0x31fbe, 0x31fc6, 0x31fc7, 0x31fd6, 0x31fd7, 0x31ff6, 0x31ff7, 0x3210a, 0x3210e, - 0x3210f, 0x32113, 0x3212f, 0x32134, 0x32139, 0x3213c, 0x3213d, 0x3214e, 0x32184, - 0x32c61, 0x32c65, 0x32c66, 0x32c68, 0x32c6a, 0x32c6c, 0x32c71, 0x32c73, 0x32c74, - 0x32c81, 0x32c83, 0x32c85, 0x32c87, 0x32c89, 0x32c8b, 0x32c8d, 0x32c8f, 0x32c91, - 0x32c93, 0x32c95, 0x32c97, 0x32c99, 0x32c9b, 0x32c9d, 0x32c9f, 0x32ca1, 0x32ca3, - 0x32ca5, 0x32ca7, 0x32ca9, 0x32cab, 0x32cad, 0x32caf, 0x32cb1, 0x32cb3, 0x32cb5, - 0x32cb7, 0x32cb9, 0x32cbb, 0x32cbd, 0x32cbf, 0x32cc1, 0x32cc3, 0x32cc5, 0x32cc7, - 0x32cc9, 0x32ccb, 0x32ccd, 0x32ccf, 0x32cd1, 0x32cd3, 0x32cd5, 0x32cd7, 0x32cd9, - 0x32cdb, 0x32cdd, 0x32cdf, 0x32ce1, 0x32ce3, 0x32ce4, 0x32cec, 0x32cee, 0x32cf3, - 0x32d27, 0x32d2d, 0x3a641, 0x3a643, 0x3a645, 0x3a647, 0x3a649, 0x3a64b, 0x3a64d, - 0x3a64f, 0x3a651, 0x3a653, 0x3a655, 0x3a657, 0x3a659, 0x3a65b, 0x3a65d, 0x3a65f, - 0x3a661, 0x3a663, 0x3a665, 0x3a667, 0x3a669, 0x3a66b, 0x3a66d, 0x3a681, 0x3a683, - 0x3a685, 0x3a687, 0x3a689, 0x3a68b, 0x3a68d, 0x3a68f, 0x3a691, 0x3a693, 0x3a695, - 0x3a697, 0x3a699, 0x3a69b, 0x3a723, 0x3a725, 0x3a727, 0x3a729, 0x3a72b, 0x3a72d, - 0x3a733, 0x3a735, 0x3a737, 0x3a739, 0x3a73b, 0x3a73d, 0x3a73f, 0x3a741, 0x3a743, - 0x3a745, 0x3a747, 0x3a749, 0x3a74b, 0x3a74d, 0x3a74f, 0x3a751, 0x3a753, 0x3a755, - 0x3a757, 0x3a759, 0x3a75b, 0x3a75d, 0x3a75f, 0x3a761, 0x3a763, 0x3a765, 0x3a767, - 0x3a769, 0x3a76b, 0x3a76d, 0x3a76f, 0x3a77a, 0x3a77c, 0x3a77f, 0x3a781, 0x3a783, - 0x3a785, 0x3a787, 0x3a78c, 0x3a78e, 0x3a791, 0x3a797, 0x3a799, 0x3a79b, 0x3a79d, - 0x3a79f, 0x3a7a1, 0x3a7a3, 0x3a7a5, 0x3a7a7, 0x3a7a9, 0x3a7b5, 0x3a7b7, 0x3a7fa, - 0x400b5, 0x40101, 0x40103, 0x40105, 0x40107, 0x40109, 0x4010b, 0x4010d, 0x4010f, - 0x40111, 0x40113, 0x40115, 0x40117, 0x40119, 0x4011b, 0x4011d, 0x4011f, 0x40121, - 0x40123, 0x40125, 0x40127, 0x40129, 0x4012b, 0x4012d, 0x4012f, 0x40131, 0x40133, - 0x40135, 0x40137, 0x40138, 0x4013a, 0x4013c, 0x4013e, 0x40140, 0x40142, 0x40144, - 0x40146, 0x40148, 0x40149, 0x4014b, 0x4014d, 0x4014f, 0x40151, 0x40153, 0x40155, - 0x40157, 0x40159, 0x4015b, 0x4015d, 0x4015f, 0x40161, 0x40163, 0x40165, 0x40167, - 0x40169, 0x4016b, 0x4016d, 0x4016f, 0x40171, 0x40173, 0x40175, 0x40177, 0x4017a, - 0x4017c, 0x40183, 0x40185, 0x40188, 0x4018c, 0x4018d, 0x40192, 0x40195, 0x4019e, - 0x401a1, 0x401a3, 0x401a5, 0x401a8, 0x401aa, 0x401ab, 0x401ad, 0x401b0, 0x401b4, - 0x401b6, 0x401b9, 0x401ba, 0x401c6, 0x401c9, 0x401cc, 0x401ce, 0x401d0, 0x401d2, - 0x401d4, 0x401d6, 0x401d8, 0x401da, 0x401dc, 0x401dd, 0x401df, 0x401e1, 0x401e3, - 0x401e5, 0x401e7, 0x401e9, 0x401eb, 0x401ed, 0x401ef, 0x401f0, 0x401f3, 0x401f5, - 0x401f9, 0x401fb, 0x401fd, 0x401ff, 0x40201, 0x40203, 0x40205, 0x40207, 0x40209, - 0x4020b, 0x4020d, 0x4020f, 0x40211, 0x40213, 0x40215, 0x40217, 0x40219, 0x4021b, - 0x4021d, 0x4021f, 0x40221, 0x40223, 0x40225, 0x40227, 0x40229, 0x4022b, 0x4022d, - 0x4022f, 0x40231, 0x4023c, 0x4023f, 0x40240, 0x40242, 0x40247, 0x40249, 0x4024b, - 0x4024d, 0x40371, 0x40373, 0x40377, 0x40390, 0x403d0, 0x403d1, 0x403d9, 0x403db, - 0x403dd, 0x403df, 0x403e1, 0x403e3, 0x403e5, 0x403e7, 0x403e9, 0x403eb, 0x403ed, - 0x403f5, 0x403f8, 0x403fb, 0x403fc, 0x40461, 0x40463, 0x40465, 0x40467, 0x40469, - 0x4046b, 0x4046d, 0x4046f, 0x40471, 0x40473, 0x40475, 0x40477, 0x40479, 0x4047b, - 0x4047d, 0x4047f, 0x40481, 0x4048b, 0x4048d, 0x4048f, 0x40491, 0x40493, 0x40495, - 0x40497, 0x40499, 0x4049b, 0x4049d, 0x4049f, 0x404a1, 0x404a3, 0x404a5, 0x404a7, - 0x404a9, 0x404ab, 0x404ad, 0x404af, 0x404b1, 0x404b3, 0x404b5, 0x404b7, 0x404b9, - 0x404bb, 0x404bd, 0x404bf, 0x404c2, 0x404c4, 0x404c6, 0x404c8, 0x404ca, 0x404cc, - 0x404ce, 0x404cf, 0x404d1, 0x404d3, 0x404d5, 0x404d7, 0x404d9, 0x404db, 0x404dd, - 0x404df, 0x404e1, 0x404e3, 0x404e5, 0x404e7, 0x404e9, 0x404eb, 0x404ed, 0x404ef, - 0x404f1, 0x404f3, 0x404f5, 0x404f7, 0x404f9, 0x404fb, 0x404fd, 0x404ff, 0x40501, - 0x40503, 0x40505, 0x40507, 0x40509, 0x4050b, 0x4050d, 0x4050f, 0x40511, 0x40513, - 0x40515, 0x40517, 0x40519, 0x4051b, 0x4051d, 0x4051f, 0x40521, 0x40523, 0x40525, - 0x40527, 0x40529, 0x4052b, 0x4052d, 0x4052f, 0x41e01, 0x41e03, 0x41e05, 0x41e07, - 0x41e09, 0x41e0b, 0x41e0d, 0x41e0f, 0x41e11, 0x41e13, 0x41e15, 0x41e17, 0x41e19, - 0x41e1b, 0x41e1d, 0x41e1f, 0x41e21, 0x41e23, 0x41e25, 0x41e27, 0x41e29, 0x41e2b, - 0x41e2d, 0x41e2f, 0x41e31, 0x41e33, 0x41e35, 0x41e37, 0x41e39, 0x41e3b, 0x41e3d, - 0x41e3f, 0x41e41, 0x41e43, 0x41e45, 0x41e47, 0x41e49, 0x41e4b, 0x41e4d, 0x41e4f, - 0x41e51, 0x41e53, 0x41e55, 0x41e57, 0x41e59, 0x41e5b, 0x41e5d, 0x41e5f, 0x41e61, - 0x41e63, 0x41e65, 0x41e67, 0x41e69, 0x41e6b, 0x41e6d, 0x41e6f, 0x41e71, 0x41e73, - 0x41e75, 0x41e77, 0x41e79, 0x41e7b, 0x41e7d, 0x41e7f, 0x41e81, 0x41e83, 0x41e85, - 0x41e87, 0x41e89, 0x41e8b, 0x41e8d, 0x41e8f, 0x41e91, 0x41e93, 0x41e9f, 0x41ea1, - 0x41ea3, 0x41ea5, 0x41ea7, 0x41ea9, 0x41eab, 0x41ead, 0x41eaf, 0x41eb1, 0x41eb3, - 0x41eb5, 0x41eb7, 0x41eb9, 0x41ebb, 0x41ebd, 0x41ebf, 0x41ec1, 0x41ec3, 0x41ec5, - 0x41ec7, 0x41ec9, 0x41ecb, 0x41ecd, 0x41ecf, 0x41ed1, 0x41ed3, 0x41ed5, 0x41ed7, - 0x41ed9, 0x41edb, 0x41edd, 0x41edf, 0x41ee1, 0x41ee3, 0x41ee5, 0x41ee7, 0x41ee9, - 0x41eeb, 0x41eed, 0x41eef, 0x41ef1, 0x41ef3, 0x41ef5, 0x41ef7, 0x41ef9, 0x41efb, - 0x41efd, 0x41fb6, 0x41fb7, 0x41fbe, 0x41fc6, 0x41fc7, 0x41fd6, 0x41fd7, 0x41ff6, - 0x41ff7, 0x4210a, 0x4210e, 0x4210f, 0x42113, 0x4212f, 0x42134, 0x42139, 0x4213c, - 0x4213d, 0x4214e, 0x42184, 0x42c61, 0x42c65, 0x42c66, 0x42c68, 0x42c6a, 0x42c6c, - 0x42c71, 0x42c73, 0x42c74, 0x42c81, 0x42c83, 0x42c85, 0x42c87, 0x42c89, 0x42c8b, - 0x42c8d, 0x42c8f, 0x42c91, 0x42c93, 0x42c95, 0x42c97, 0x42c99, 0x42c9b, 0x42c9d, - 0x42c9f, 0x42ca1, 0x42ca3, 0x42ca5, 0x42ca7, 0x42ca9, 0x42cab, 0x42cad, 0x42caf, - 0x42cb1, 0x42cb3, 0x42cb5, 0x42cb7, 0x42cb9, 0x42cbb, 0x42cbd, 0x42cbf, 0x42cc1, - 0x42cc3, 0x42cc5, 0x42cc7, 0x42cc9, 0x42ccb, 0x42ccd, 0x42ccf, 0x42cd1, 0x42cd3, - 0x42cd5, 0x42cd7, 0x42cd9, 0x42cdb, 0x42cdd, 0x42cdf, 0x42ce1, 0x42ce3, 0x42ce4, - 0x42cec, 0x42cee, 0x42cf3, 0x42d27, 0x42d2d, 0x4a641, 0x4a643, 0x4a645, 0x4a647, - 0x4a649, 0x4a64b, 0x4a64d, 0x4a64f, 0x4a651, 0x4a653, 0x4a655, 0x4a657, 0x4a659, - 0x4a65b, 0x4a65d, 0x4a65f, 0x4a661, 0x4a663, 0x4a665, 0x4a667, 0x4a669, 0x4a66b, - 0x4a66d, 0x4a681, 0x4a683, 0x4a685, 0x4a687, 0x4a689, 0x4a68b, 0x4a68d, 0x4a68f, - 0x4a691, 0x4a693, 0x4a695, 0x4a697, 0x4a699, 0x4a69b, 0x4a723, 0x4a725, 0x4a727, - 0x4a729, 0x4a72b, 0x4a72d, 0x4a733, 0x4a735, 0x4a737, 0x4a739, 0x4a73b, 0x4a73d, - 0x4a73f, 0x4a741, 0x4a743, 0x4a745, 0x4a747, 0x4a749, 0x4a74b, 0x4a74d, 0x4a74f, - 0x4a751, 0x4a753, 0x4a755, 0x4a757, 0x4a759, 0x4a75b, 0x4a75d, 0x4a75f, 0x4a761, - 0x4a763, 0x4a765, 0x4a767, 0x4a769, 0x4a76b, 0x4a76d, 0x4a76f, 0x4a77a, 0x4a77c, - 0x4a77f, 0x4a781, 0x4a783, 0x4a785, 0x4a787, 0x4a78c, 0x4a78e, 0x4a791, 0x4a797, - 0x4a799, 0x4a79b, 0x4a79d, 0x4a79f, 0x4a7a1, 0x4a7a3, 0x4a7a5, 0x4a7a7, 0x4a7a9, - 0x4a7b5, 0x4a7b7, 0x4a7fa, 0x500b5, 0x50101, 0x50103, 0x50105, 0x50107, 0x50109, - 0x5010b, 0x5010d, 0x5010f, 0x50111, 0x50113, 0x50115, 0x50117, 0x50119, 0x5011b, - 0x5011d, 0x5011f, 0x50121, 0x50123, 0x50125, 0x50127, 0x50129, 0x5012b, 0x5012d, - 0x5012f, 0x50131, 0x50133, 0x50135, 0x50137, 0x50138, 0x5013a, 0x5013c, 0x5013e, - 0x50140, 0x50142, 0x50144, 0x50146, 0x50148, 0x50149, 0x5014b, 0x5014d, 0x5014f, - 0x50151, 0x50153, 0x50155, 0x50157, 0x50159, 0x5015b, 0x5015d, 0x5015f, 0x50161, - 0x50163, 0x50165, 0x50167, 0x50169, 0x5016b, 0x5016d, 0x5016f, 0x50171, 0x50173, - 0x50175, 0x50177, 0x5017a, 0x5017c, 0x50183, 0x50185, 0x50188, 0x5018c, 0x5018d, - 0x50192, 0x50195, 0x5019e, 0x501a1, 0x501a3, 0x501a5, 0x501a8, 0x501aa, 0x501ab, - 0x501ad, 0x501b0, 0x501b4, 0x501b6, 0x501b9, 0x501ba, 0x501c6, 0x501c9, 0x501cc, - 0x501ce, 0x501d0, 0x501d2, 0x501d4, 0x501d6, 0x501d8, 0x501da, 0x501dc, 0x501dd, - 0x501df, 0x501e1, 0x501e3, 0x501e5, 0x501e7, 0x501e9, 0x501eb, 0x501ed, 0x501ef, - 0x501f0, 0x501f3, 0x501f5, 0x501f9, 0x501fb, 0x501fd, 0x501ff, 0x50201, 0x50203, - 0x50205, 0x50207, 0x50209, 0x5020b, 0x5020d, 0x5020f, 0x50211, 0x50213, 0x50215, - 0x50217, 0x50219, 0x5021b, 0x5021d, 0x5021f, 0x50221, 0x50223, 0x50225, 0x50227, - 0x50229, 0x5022b, 0x5022d, 0x5022f, 0x50231, 0x5023c, 0x5023f, 0x50240, 0x50242, - 0x50247, 0x50249, 0x5024b, 0x5024d, 0x50371, 0x50373, 0x50377, 0x50390, 0x503d0, - 0x503d1, 0x503d9, 0x503db, 0x503dd, 0x503df, 0x503e1, 0x503e3, 0x503e5, 0x503e7, - 0x503e9, 0x503eb, 0x503ed, 0x503f5, 0x503f8, 0x503fb, 0x503fc, 0x50461, 0x50463, - 0x50465, 0x50467, 0x50469, 0x5046b, 0x5046d, 0x5046f, 0x50471, 0x50473, 0x50475, - 0x50477, 0x50479, 0x5047b, 0x5047d, 0x5047f, 0x50481, 0x5048b, 0x5048d, 0x5048f, - 0x50491, 0x50493, 0x50495, 0x50497, 0x50499, 0x5049b, 0x5049d, 0x5049f, 0x504a1, - 0x504a3, 0x504a5, 0x504a7, 0x504a9, 0x504ab, 0x504ad, 0x504af, 0x504b1, 0x504b3, - 0x504b5, 0x504b7, 0x504b9, 0x504bb, 0x504bd, 0x504bf, 0x504c2, 0x504c4, 0x504c6, - 0x504c8, 0x504ca, 0x504cc, 0x504ce, 0x504cf, 0x504d1, 0x504d3, 0x504d5, 0x504d7, - 0x504d9, 0x504db, 0x504dd, 0x504df, 0x504e1, 0x504e3, 0x504e5, 0x504e7, 0x504e9, - 0x504eb, 0x504ed, 0x504ef, 0x504f1, 0x504f3, 0x504f5, 0x504f7, 0x504f9, 0x504fb, - 0x504fd, 0x504ff, 0x50501, 0x50503, 0x50505, 0x50507, 0x50509, 0x5050b, 0x5050d, - 0x5050f, 0x50511, 0x50513, 0x50515, 0x50517, 0x50519, 0x5051b, 0x5051d, 0x5051f, - 0x50521, 0x50523, 0x50525, 0x50527, 0x50529, 0x5052b, 0x5052d, 0x5052f, 0x51e01, - 0x51e03, 0x51e05, 0x51e07, 0x51e09, 0x51e0b, 0x51e0d, 0x51e0f, 0x51e11, 0x51e13, - 0x51e15, 0x51e17, 0x51e19, 0x51e1b, 0x51e1d, 0x51e1f, 0x51e21, 0x51e23, 0x51e25, - 0x51e27, 0x51e29, 0x51e2b, 0x51e2d, 0x51e2f, 0x51e31, 0x51e33, 0x51e35, 0x51e37, - 0x51e39, 0x51e3b, 0x51e3d, 0x51e3f, 0x51e41, 0x51e43, 0x51e45, 0x51e47, 0x51e49, - 0x51e4b, 0x51e4d, 0x51e4f, 0x51e51, 0x51e53, 0x51e55, 0x51e57, 0x51e59, 0x51e5b, - 0x51e5d, 0x51e5f, 0x51e61, 0x51e63, 0x51e65, 0x51e67, 0x51e69, 0x51e6b, 0x51e6d, - 0x51e6f, 0x51e71, 0x51e73, 0x51e75, 0x51e77, 0x51e79, 0x51e7b, 0x51e7d, 0x51e7f, - 0x51e81, 0x51e83, 0x51e85, 0x51e87, 0x51e89, 0x51e8b, 0x51e8d, 0x51e8f, 0x51e91, - 0x51e93, 0x51e9f, 0x51ea1, 0x51ea3, 0x51ea5, 0x51ea7, 0x51ea9, 0x51eab, 0x51ead, - 0x51eaf, 0x51eb1, 0x51eb3, 0x51eb5, 0x51eb7, 0x51eb9, 0x51ebb, 0x51ebd, 0x51ebf, - 0x51ec1, 0x51ec3, 0x51ec5, 0x51ec7, 0x51ec9, 0x51ecb, 0x51ecd, 0x51ecf, 0x51ed1, - 0x51ed3, 0x51ed5, 0x51ed7, 0x51ed9, 0x51edb, 0x51edd, 0x51edf, 0x51ee1, 0x51ee3, - 0x51ee5, 0x51ee7, 0x51ee9, 0x51eeb, 0x51eed, 0x51eef, 0x51ef1, 0x51ef3, 0x51ef5, - 0x51ef7, 0x51ef9, 0x51efb, 0x51efd, 0x51fb6, 0x51fb7, 0x51fbe, 0x51fc6, 0x51fc7, - 0x51fd6, 0x51fd7, 0x51ff6, 0x51ff7, 0x5210a, 0x5210e, 0x5210f, 0x52113, 0x5212f, - 0x52134, 0x52139, 0x5213c, 0x5213d, 0x5214e, 0x52184, 0x52c61, 0x52c65, 0x52c66, - 0x52c68, 0x52c6a, 0x52c6c, 0x52c71, 0x52c73, 0x52c74, 0x52c81, 0x52c83, 0x52c85, - 0x52c87, 0x52c89, 0x52c8b, 0x52c8d, 0x52c8f, 0x52c91, 0x52c93, 0x52c95, 0x52c97, - 0x52c99, 0x52c9b, 0x52c9d, 0x52c9f, 0x52ca1, 0x52ca3, 0x52ca5, 0x52ca7, 0x52ca9, - 0x52cab, 0x52cad, 0x52caf, 0x52cb1, 0x52cb3, 0x52cb5, 0x52cb7, 0x52cb9, 0x52cbb, - 0x52cbd, 0x52cbf, 0x52cc1, 0x52cc3, 0x52cc5, 0x52cc7, 0x52cc9, 0x52ccb, 0x52ccd, - 0x52ccf, 0x52cd1, 0x52cd3, 0x52cd5, 0x52cd7, 0x52cd9, 0x52cdb, 0x52cdd, 0x52cdf, - 0x52ce1, 0x52ce3, 0x52ce4, 0x52cec, 0x52cee, 0x52cf3, 0x52d27, 0x52d2d, 0x5a641, - 0x5a643, 0x5a645, 0x5a647, 0x5a649, 0x5a64b, 0x5a64d, 0x5a64f, 0x5a651, 0x5a653, - 0x5a655, 0x5a657, 0x5a659, 0x5a65b, 0x5a65d, 0x5a65f, 0x5a661, 0x5a663, 0x5a665, - 0x5a667, 0x5a669, 0x5a66b, 0x5a66d, 0x5a681, 0x5a683, 0x5a685, 0x5a687, 0x5a689, - 0x5a68b, 0x5a68d, 0x5a68f, 0x5a691, 0x5a693, 0x5a695, 0x5a697, 0x5a699, 0x5a69b, - 0x5a723, 0x5a725, 0x5a727, 0x5a729, 0x5a72b, 0x5a72d, 0x5a733, 0x5a735, 0x5a737, - 0x5a739, 0x5a73b, 0x5a73d, 0x5a73f, 0x5a741, 0x5a743, 0x5a745, 0x5a747, 0x5a749, - 0x5a74b, 0x5a74d, 0x5a74f, 0x5a751, 0x5a753, 0x5a755, 0x5a757, 0x5a759, 0x5a75b, - 0x5a75d, 0x5a75f, 0x5a761, 0x5a763, 0x5a765, 0x5a767, 0x5a769, 0x5a76b, 0x5a76d, - 0x5a76f, 0x5a77a, 0x5a77c, 0x5a77f, 0x5a781, 0x5a783, 0x5a785, 0x5a787, 0x5a78c, - 0x5a78e, 0x5a791, 0x5a797, 0x5a799, 0x5a79b, 0x5a79d, 0x5a79f, 0x5a7a1, 0x5a7a3, - 0x5a7a5, 0x5a7a7, 0x5a7a9, 0x5a7b5, 0x5a7b7, 0x5a7fa, 0x600b5, 0x60101, 0x60103, - 0x60105, 0x60107, 0x60109, 0x6010b, 0x6010d, 0x6010f, 0x60111, 0x60113, 0x60115, - 0x60117, 0x60119, 0x6011b, 0x6011d, 0x6011f, 0x60121, 0x60123, 0x60125, 0x60127, - 0x60129, 0x6012b, 0x6012d, 0x6012f, 0x60131, 0x60133, 0x60135, 0x60137, 0x60138, - 0x6013a, 0x6013c, 0x6013e, 0x60140, 0x60142, 0x60144, 0x60146, 0x60148, 0x60149, - 0x6014b, 0x6014d, 0x6014f, 0x60151, 0x60153, 0x60155, 0x60157, 0x60159, 0x6015b, - 0x6015d, 0x6015f, 0x60161, 0x60163, 0x60165, 0x60167, 0x60169, 0x6016b, 0x6016d, - 0x6016f, 0x60171, 0x60173, 0x60175, 0x60177, 0x6017a, 0x6017c, 0x60183, 0x60185, - 0x60188, 0x6018c, 0x6018d, 0x60192, 0x60195, 0x6019e, 0x601a1, 0x601a3, 0x601a5, - 0x601a8, 0x601aa, 0x601ab, 0x601ad, 0x601b0, 0x601b4, 0x601b6, 0x601b9, 0x601ba, - 0x601c6, 0x601c9, 0x601cc, 0x601ce, 0x601d0, 0x601d2, 0x601d4, 0x601d6, 0x601d8, - 0x601da, 0x601dc, 0x601dd, 0x601df, 0x601e1, 0x601e3, 0x601e5, 0x601e7, 0x601e9, - 0x601eb, 0x601ed, 0x601ef, 0x601f0, 0x601f3, 0x601f5, 0x601f9, 0x601fb, 0x601fd, - 0x601ff, 0x60201, 0x60203, 0x60205, 0x60207, 0x60209, 0x6020b, 0x6020d, 0x6020f, - 0x60211, 0x60213, 0x60215, 0x60217, 0x60219, 0x6021b, 0x6021d, 0x6021f, 0x60221, - 0x60223, 0x60225, 0x60227, 0x60229, 0x6022b, 0x6022d, 0x6022f, 0x60231, 0x6023c, - 0x6023f, 0x60240, 0x60242, 0x60247, 0x60249, 0x6024b, 0x6024d, 0x60371, 0x60373, - 0x60377, 0x60390, 0x603d0, 0x603d1, 0x603d9, 0x603db, 0x603dd, 0x603df, 0x603e1, - 0x603e3, 0x603e5, 0x603e7, 0x603e9, 0x603eb, 0x603ed, 0x603f5, 0x603f8, 0x603fb, - 0x603fc, 0x60461, 0x60463, 0x60465, 0x60467, 0x60469, 0x6046b, 0x6046d, 0x6046f, - 0x60471, 0x60473, 0x60475, 0x60477, 0x60479, 0x6047b, 0x6047d, 0x6047f, 0x60481, - 0x6048b, 0x6048d, 0x6048f, 0x60491, 0x60493, 0x60495, 0x60497, 0x60499, 0x6049b, - 0x6049d, 0x6049f, 0x604a1, 0x604a3, 0x604a5, 0x604a7, 0x604a9, 0x604ab, 0x604ad, - 0x604af, 0x604b1, 0x604b3, 0x604b5, 0x604b7, 0x604b9, 0x604bb, 0x604bd, 0x604bf, - 0x604c2, 0x604c4, 0x604c6, 0x604c8, 0x604ca, 0x604cc, 0x604ce, 0x604cf, 0x604d1, - 0x604d3, 0x604d5, 0x604d7, 0x604d9, 0x604db, 0x604dd, 0x604df, 0x604e1, 0x604e3, - 0x604e5, 0x604e7, 0x604e9, 0x604eb, 0x604ed, 0x604ef, 0x604f1, 0x604f3, 0x604f5, - 0x604f7, 0x604f9, 0x604fb, 0x604fd, 0x604ff, 0x60501, 0x60503, 0x60505, 0x60507, - 0x60509, 0x6050b, 0x6050d, 0x6050f, 0x60511, 0x60513, 0x60515, 0x60517, 0x60519, - 0x6051b, 0x6051d, 0x6051f, 0x60521, 0x60523, 0x60525, 0x60527, 0x60529, 0x6052b, - 0x6052d, 0x6052f, 0x61e01, 0x61e03, 0x61e05, 0x61e07, 0x61e09, 0x61e0b, 0x61e0d, - 0x61e0f, 0x61e11, 0x61e13, 0x61e15, 0x61e17, 0x61e19, 0x61e1b, 0x61e1d, 0x61e1f, - 0x61e21, 0x61e23, 0x61e25, 0x61e27, 0x61e29, 0x61e2b, 0x61e2d, 0x61e2f, 0x61e31, - 0x61e33, 0x61e35, 0x61e37, 0x61e39, 0x61e3b, 0x61e3d, 0x61e3f, 0x61e41, 0x61e43, - 0x61e45, 0x61e47, 0x61e49, 0x61e4b, 0x61e4d, 0x61e4f, 0x61e51, 0x61e53, 0x61e55, - 0x61e57, 0x61e59, 0x61e5b, 0x61e5d, 0x61e5f, 0x61e61, 0x61e63, 0x61e65, 0x61e67, - 0x61e69, 0x61e6b, 0x61e6d, 0x61e6f, 0x61e71, 0x61e73, 0x61e75, 0x61e77, 0x61e79, - 0x61e7b, 0x61e7d, 0x61e7f, 0x61e81, 0x61e83, 0x61e85, 0x61e87, 0x61e89, 0x61e8b, - 0x61e8d, 0x61e8f, 0x61e91, 0x61e93, 0x61e9f, 0x61ea1, 0x61ea3, 0x61ea5, 0x61ea7, - 0x61ea9, 0x61eab, 0x61ead, 0x61eaf, 0x61eb1, 0x61eb3, 0x61eb5, 0x61eb7, 0x61eb9, - 0x61ebb, 0x61ebd, 0x61ebf, 0x61ec1, 0x61ec3, 0x61ec5, 0x61ec7, 0x61ec9, 0x61ecb, - 0x61ecd, 0x61ecf, 0x61ed1, 0x61ed3, 0x61ed5, 0x61ed7, 0x61ed9, 0x61edb, 0x61edd, - 0x61edf, 0x61ee1, 0x61ee3, 0x61ee5, 0x61ee7, 0x61ee9, 0x61eeb, 0x61eed, 0x61eef, - 0x61ef1, 0x61ef3, 0x61ef5, 0x61ef7, 0x61ef9, 0x61efb, 0x61efd, 0x61fb6, 0x61fb7, - 0x61fbe, 0x61fc6, 0x61fc7, 0x61fd6, 0x61fd7, 0x61ff6, 0x61ff7, 0x6210a, 0x6210e, - 0x6210f, 0x62113, 0x6212f, 0x62134, 0x62139, 0x6213c, 0x6213d, 0x6214e, 0x62184, - 0x62c61, 0x62c65, 0x62c66, 0x62c68, 0x62c6a, 0x62c6c, 0x62c71, 0x62c73, 0x62c74, - 0x62c81, 0x62c83, 0x62c85, 0x62c87, 0x62c89, 0x62c8b, 0x62c8d, 0x62c8f, 0x62c91, - 0x62c93, 0x62c95, 0x62c97, 0x62c99, 0x62c9b, 0x62c9d, 0x62c9f, 0x62ca1, 0x62ca3, - 0x62ca5, 0x62ca7, 0x62ca9, 0x62cab, 0x62cad, 0x62caf, 0x62cb1, 0x62cb3, 0x62cb5, - 0x62cb7, 0x62cb9, 0x62cbb, 0x62cbd, 0x62cbf, 0x62cc1, 0x62cc3, 0x62cc5, 0x62cc7, - 0x62cc9, 0x62ccb, 0x62ccd, 0x62ccf, 0x62cd1, 0x62cd3, 0x62cd5, 0x62cd7, 0x62cd9, - 0x62cdb, 0x62cdd, 0x62cdf, 0x62ce1, 0x62ce3, 0x62ce4, 0x62cec, 0x62cee, 0x62cf3, - 0x62d27, 0x62d2d, 0x6a641, 0x6a643, 0x6a645, 0x6a647, 0x6a649, 0x6a64b, 0x6a64d, - 0x6a64f, 0x6a651, 0x6a653, 0x6a655, 0x6a657, 0x6a659, 0x6a65b, 0x6a65d, 0x6a65f, - 0x6a661, 0x6a663, 0x6a665, 0x6a667, 0x6a669, 0x6a66b, 0x6a66d, 0x6a681, 0x6a683, - 0x6a685, 0x6a687, 0x6a689, 0x6a68b, 0x6a68d, 0x6a68f, 0x6a691, 0x6a693, 0x6a695, - 0x6a697, 0x6a699, 0x6a69b, 0x6a723, 0x6a725, 0x6a727, 0x6a729, 0x6a72b, 0x6a72d, - 0x6a733, 0x6a735, 0x6a737, 0x6a739, 0x6a73b, 0x6a73d, 0x6a73f, 0x6a741, 0x6a743, - 0x6a745, 0x6a747, 0x6a749, 0x6a74b, 0x6a74d, 0x6a74f, 0x6a751, 0x6a753, 0x6a755, - 0x6a757, 0x6a759, 0x6a75b, 0x6a75d, 0x6a75f, 0x6a761, 0x6a763, 0x6a765, 0x6a767, - 0x6a769, 0x6a76b, 0x6a76d, 0x6a76f, 0x6a77a, 0x6a77c, 0x6a77f, 0x6a781, 0x6a783, - 0x6a785, 0x6a787, 0x6a78c, 0x6a78e, 0x6a791, 0x6a797, 0x6a799, 0x6a79b, 0x6a79d, - 0x6a79f, 0x6a7a1, 0x6a7a3, 0x6a7a5, 0x6a7a7, 0x6a7a9, 0x6a7b5, 0x6a7b7, 0x6a7fa, - 0x700b5, 0x70101, 0x70103, 0x70105, 0x70107, 0x70109, 0x7010b, 0x7010d, 0x7010f, - 0x70111, 0x70113, 0x70115, 0x70117, 0x70119, 0x7011b, 0x7011d, 0x7011f, 0x70121, - 0x70123, 0x70125, 0x70127, 0x70129, 0x7012b, 0x7012d, 0x7012f, 0x70131, 0x70133, - 0x70135, 0x70137, 0x70138, 0x7013a, 0x7013c, 0x7013e, 0x70140, 0x70142, 0x70144, - 0x70146, 0x70148, 0x70149, 0x7014b, 0x7014d, 0x7014f, 0x70151, 0x70153, 0x70155, - 0x70157, 0x70159, 0x7015b, 0x7015d, 0x7015f, 0x70161, 0x70163, 0x70165, 0x70167, - 0x70169, 0x7016b, 0x7016d, 0x7016f, 0x70171, 0x70173, 0x70175, 0x70177, 0x7017a, - 0x7017c, 0x70183, 0x70185, 0x70188, 0x7018c, 0x7018d, 0x70192, 0x70195, 0x7019e, - 0x701a1, 0x701a3, 0x701a5, 0x701a8, 0x701aa, 0x701ab, 0x701ad, 0x701b0, 0x701b4, - 0x701b6, 0x701b9, 0x701ba, 0x701c6, 0x701c9, 0x701cc, 0x701ce, 0x701d0, 0x701d2, - 0x701d4, 0x701d6, 0x701d8, 0x701da, 0x701dc, 0x701dd, 0x701df, 0x701e1, 0x701e3, - 0x701e5, 0x701e7, 0x701e9, 0x701eb, 0x701ed, 0x701ef, 0x701f0, 0x701f3, 0x701f5, - 0x701f9, 0x701fb, 0x701fd, 0x701ff, 0x70201, 0x70203, 0x70205, 0x70207, 0x70209, - 0x7020b, 0x7020d, 0x7020f, 0x70211, 0x70213, 0x70215, 0x70217, 0x70219, 0x7021b, - 0x7021d, 0x7021f, 0x70221, 0x70223, 0x70225, 0x70227, 0x70229, 0x7022b, 0x7022d, - 0x7022f, 0x70231, 0x7023c, 0x7023f, 0x70240, 0x70242, 0x70247, 0x70249, 0x7024b, - 0x7024d, 0x70371, 0x70373, 0x70377, 0x70390, 0x703d0, 0x703d1, 0x703d9, 0x703db, - 0x703dd, 0x703df, 0x703e1, 0x703e3, 0x703e5, 0x703e7, 0x703e9, 0x703eb, 0x703ed, - 0x703f5, 0x703f8, 0x703fb, 0x703fc, 0x70461, 0x70463, 0x70465, 0x70467, 0x70469, - 0x7046b, 0x7046d, 0x7046f, 0x70471, 0x70473, 0x70475, 0x70477, 0x70479, 0x7047b, - 0x7047d, 0x7047f, 0x70481, 0x7048b, 0x7048d, 0x7048f, 0x70491, 0x70493, 0x70495, - 0x70497, 0x70499, 0x7049b, 0x7049d, 0x7049f, 0x704a1, 0x704a3, 0x704a5, 0x704a7, - 0x704a9, 0x704ab, 0x704ad, 0x704af, 0x704b1, 0x704b3, 0x704b5, 0x704b7, 0x704b9, - 0x704bb, 0x704bd, 0x704bf, 0x704c2, 0x704c4, 0x704c6, 0x704c8, 0x704ca, 0x704cc, - 0x704ce, 0x704cf, 0x704d1, 0x704d3, 0x704d5, 0x704d7, 0x704d9, 0x704db, 0x704dd, - 0x704df, 0x704e1, 0x704e3, 0x704e5, 0x704e7, 0x704e9, 0x704eb, 0x704ed, 0x704ef, - 0x704f1, 0x704f3, 0x704f5, 0x704f7, 0x704f9, 0x704fb, 0x704fd, 0x704ff, 0x70501, - 0x70503, 0x70505, 0x70507, 0x70509, 0x7050b, 0x7050d, 0x7050f, 0x70511, 0x70513, - 0x70515, 0x70517, 0x70519, 0x7051b, 0x7051d, 0x7051f, 0x70521, 0x70523, 0x70525, - 0x70527, 0x70529, 0x7052b, 0x7052d, 0x7052f, 0x71e01, 0x71e03, 0x71e05, 0x71e07, - 0x71e09, 0x71e0b, 0x71e0d, 0x71e0f, 0x71e11, 0x71e13, 0x71e15, 0x71e17, 0x71e19, - 0x71e1b, 0x71e1d, 0x71e1f, 0x71e21, 0x71e23, 0x71e25, 0x71e27, 0x71e29, 0x71e2b, - 0x71e2d, 0x71e2f, 0x71e31, 0x71e33, 0x71e35, 0x71e37, 0x71e39, 0x71e3b, 0x71e3d, - 0x71e3f, 0x71e41, 0x71e43, 0x71e45, 0x71e47, 0x71e49, 0x71e4b, 0x71e4d, 0x71e4f, - 0x71e51, 0x71e53, 0x71e55, 0x71e57, 0x71e59, 0x71e5b, 0x71e5d, 0x71e5f, 0x71e61, - 0x71e63, 0x71e65, 0x71e67, 0x71e69, 0x71e6b, 0x71e6d, 0x71e6f, 0x71e71, 0x71e73, - 0x71e75, 0x71e77, 0x71e79, 0x71e7b, 0x71e7d, 0x71e7f, 0x71e81, 0x71e83, 0x71e85, - 0x71e87, 0x71e89, 0x71e8b, 0x71e8d, 0x71e8f, 0x71e91, 0x71e93, 0x71e9f, 0x71ea1, - 0x71ea3, 0x71ea5, 0x71ea7, 0x71ea9, 0x71eab, 0x71ead, 0x71eaf, 0x71eb1, 0x71eb3, - 0x71eb5, 0x71eb7, 0x71eb9, 0x71ebb, 0x71ebd, 0x71ebf, 0x71ec1, 0x71ec3, 0x71ec5, - 0x71ec7, 0x71ec9, 0x71ecb, 0x71ecd, 0x71ecf, 0x71ed1, 0x71ed3, 0x71ed5, 0x71ed7, - 0x71ed9, 0x71edb, 0x71edd, 0x71edf, 0x71ee1, 0x71ee3, 0x71ee5, 0x71ee7, 0x71ee9, - 0x71eeb, 0x71eed, 0x71eef, 0x71ef1, 0x71ef3, 0x71ef5, 0x71ef7, 0x71ef9, 0x71efb, - 0x71efd, 0x71fb6, 0x71fb7, 0x71fbe, 0x71fc6, 0x71fc7, 0x71fd6, 0x71fd7, 0x71ff6, - 0x71ff7, 0x7210a, 0x7210e, 0x7210f, 0x72113, 0x7212f, 0x72134, 0x72139, 0x7213c, - 0x7213d, 0x7214e, 0x72184, 0x72c61, 0x72c65, 0x72c66, 0x72c68, 0x72c6a, 0x72c6c, - 0x72c71, 0x72c73, 0x72c74, 0x72c81, 0x72c83, 0x72c85, 0x72c87, 0x72c89, 0x72c8b, - 0x72c8d, 0x72c8f, 0x72c91, 0x72c93, 0x72c95, 0x72c97, 0x72c99, 0x72c9b, 0x72c9d, - 0x72c9f, 0x72ca1, 0x72ca3, 0x72ca5, 0x72ca7, 0x72ca9, 0x72cab, 0x72cad, 0x72caf, - 0x72cb1, 0x72cb3, 0x72cb5, 0x72cb7, 0x72cb9, 0x72cbb, 0x72cbd, 0x72cbf, 0x72cc1, - 0x72cc3, 0x72cc5, 0x72cc7, 0x72cc9, 0x72ccb, 0x72ccd, 0x72ccf, 0x72cd1, 0x72cd3, - 0x72cd5, 0x72cd7, 0x72cd9, 0x72cdb, 0x72cdd, 0x72cdf, 0x72ce1, 0x72ce3, 0x72ce4, - 0x72cec, 0x72cee, 0x72cf3, 0x72d27, 0x72d2d, 0x7a641, 0x7a643, 0x7a645, 0x7a647, - 0x7a649, 0x7a64b, 0x7a64d, 0x7a64f, 0x7a651, 0x7a653, 0x7a655, 0x7a657, 0x7a659, - 0x7a65b, 0x7a65d, 0x7a65f, 0x7a661, 0x7a663, 0x7a665, 0x7a667, 0x7a669, 0x7a66b, - 0x7a66d, 0x7a681, 0x7a683, 0x7a685, 0x7a687, 0x7a689, 0x7a68b, 0x7a68d, 0x7a68f, - 0x7a691, 0x7a693, 0x7a695, 0x7a697, 0x7a699, 0x7a69b, 0x7a723, 0x7a725, 0x7a727, - 0x7a729, 0x7a72b, 0x7a72d, 0x7a733, 0x7a735, 0x7a737, 0x7a739, 0x7a73b, 0x7a73d, - 0x7a73f, 0x7a741, 0x7a743, 0x7a745, 0x7a747, 0x7a749, 0x7a74b, 0x7a74d, 0x7a74f, - 0x7a751, 0x7a753, 0x7a755, 0x7a757, 0x7a759, 0x7a75b, 0x7a75d, 0x7a75f, 0x7a761, - 0x7a763, 0x7a765, 0x7a767, 0x7a769, 0x7a76b, 0x7a76d, 0x7a76f, 0x7a77a, 0x7a77c, - 0x7a77f, 0x7a781, 0x7a783, 0x7a785, 0x7a787, 0x7a78c, 0x7a78e, 0x7a791, 0x7a797, - 0x7a799, 0x7a79b, 0x7a79d, 0x7a79f, 0x7a7a1, 0x7a7a3, 0x7a7a5, 0x7a7a7, 0x7a7a9, - 0x7a7b5, 0x7a7b7, 0x7a7fa, 0x800b5, 0x80101, 0x80103, 0x80105, 0x80107, 0x80109, - 0x8010b, 0x8010d, 0x8010f, 0x80111, 0x80113, 0x80115, 0x80117, 0x80119, 0x8011b, - 0x8011d, 0x8011f, 0x80121, 0x80123, 0x80125, 0x80127, 0x80129, 0x8012b, 0x8012d, - 0x8012f, 0x80131, 0x80133, 0x80135, 0x80137, 0x80138, 0x8013a, 0x8013c, 0x8013e, - 0x80140, 0x80142, 0x80144, 0x80146, 0x80148, 0x80149, 0x8014b, 0x8014d, 0x8014f, - 0x80151, 0x80153, 0x80155, 0x80157, 0x80159, 0x8015b, 0x8015d, 0x8015f, 0x80161, - 0x80163, 0x80165, 0x80167, 0x80169, 0x8016b, 0x8016d, 0x8016f, 0x80171, 0x80173, - 0x80175, 0x80177, 0x8017a, 0x8017c, 0x80183, 0x80185, 0x80188, 0x8018c, 0x8018d, - 0x80192, 0x80195, 0x8019e, 0x801a1, 0x801a3, 0x801a5, 0x801a8, 0x801aa, 0x801ab, - 0x801ad, 0x801b0, 0x801b4, 0x801b6, 0x801b9, 0x801ba, 0x801c6, 0x801c9, 0x801cc, - 0x801ce, 0x801d0, 0x801d2, 0x801d4, 0x801d6, 0x801d8, 0x801da, 0x801dc, 0x801dd, - 0x801df, 0x801e1, 0x801e3, 0x801e5, 0x801e7, 0x801e9, 0x801eb, 0x801ed, 0x801ef, - 0x801f0, 0x801f3, 0x801f5, 0x801f9, 0x801fb, 0x801fd, 0x801ff, 0x80201, 0x80203, - 0x80205, 0x80207, 0x80209, 0x8020b, 0x8020d, 0x8020f, 0x80211, 0x80213, 0x80215, - 0x80217, 0x80219, 0x8021b, 0x8021d, 0x8021f, 0x80221, 0x80223, 0x80225, 0x80227, - 0x80229, 0x8022b, 0x8022d, 0x8022f, 0x80231, 0x8023c, 0x8023f, 0x80240, 0x80242, - 0x80247, 0x80249, 0x8024b, 0x8024d, 0x80371, 0x80373, 0x80377, 0x80390, 0x803d0, - 0x803d1, 0x803d9, 0x803db, 0x803dd, 0x803df, 0x803e1, 0x803e3, 0x803e5, 0x803e7, - 0x803e9, 0x803eb, 0x803ed, 0x803f5, 0x803f8, 0x803fb, 0x803fc, 0x80461, 0x80463, - 0x80465, 0x80467, 0x80469, 0x8046b, 0x8046d, 0x8046f, 0x80471, 0x80473, 0x80475, - 0x80477, 0x80479, 0x8047b, 0x8047d, 0x8047f, 0x80481, 0x8048b, 0x8048d, 0x8048f, - 0x80491, 0x80493, 0x80495, 0x80497, 0x80499, 0x8049b, 0x8049d, 0x8049f, 0x804a1, - 0x804a3, 0x804a5, 0x804a7, 0x804a9, 0x804ab, 0x804ad, 0x804af, 0x804b1, 0x804b3, - 0x804b5, 0x804b7, 0x804b9, 0x804bb, 0x804bd, 0x804bf, 0x804c2, 0x804c4, 0x804c6, - 0x804c8, 0x804ca, 0x804cc, 0x804ce, 0x804cf, 0x804d1, 0x804d3, 0x804d5, 0x804d7, - 0x804d9, 0x804db, 0x804dd, 0x804df, 0x804e1, 0x804e3, 0x804e5, 0x804e7, 0x804e9, - 0x804eb, 0x804ed, 0x804ef, 0x804f1, 0x804f3, 0x804f5, 0x804f7, 0x804f9, 0x804fb, - 0x804fd, 0x804ff, 0x80501, 0x80503, 0x80505, 0x80507, 0x80509, 0x8050b, 0x8050d, - 0x8050f, 0x80511, 0x80513, 0x80515, 0x80517, 0x80519, 0x8051b, 0x8051d, 0x8051f, - 0x80521, 0x80523, 0x80525, 0x80527, 0x80529, 0x8052b, 0x8052d, 0x8052f, 0x81e01, - 0x81e03, 0x81e05, 0x81e07, 0x81e09, 0x81e0b, 0x81e0d, 0x81e0f, 0x81e11, 0x81e13, - 0x81e15, 0x81e17, 0x81e19, 0x81e1b, 0x81e1d, 0x81e1f, 0x81e21, 0x81e23, 0x81e25, - 0x81e27, 0x81e29, 0x81e2b, 0x81e2d, 0x81e2f, 0x81e31, 0x81e33, 0x81e35, 0x81e37, - 0x81e39, 0x81e3b, 0x81e3d, 0x81e3f, 0x81e41, 0x81e43, 0x81e45, 0x81e47, 0x81e49, - 0x81e4b, 0x81e4d, 0x81e4f, 0x81e51, 0x81e53, 0x81e55, 0x81e57, 0x81e59, 0x81e5b, - 0x81e5d, 0x81e5f, 0x81e61, 0x81e63, 0x81e65, 0x81e67, 0x81e69, 0x81e6b, 0x81e6d, - 0x81e6f, 0x81e71, 0x81e73, 0x81e75, 0x81e77, 0x81e79, 0x81e7b, 0x81e7d, 0x81e7f, - 0x81e81, 0x81e83, 0x81e85, 0x81e87, 0x81e89, 0x81e8b, 0x81e8d, 0x81e8f, 0x81e91, - 0x81e93, 0x81e9f, 0x81ea1, 0x81ea3, 0x81ea5, 0x81ea7, 0x81ea9, 0x81eab, 0x81ead, - 0x81eaf, 0x81eb1, 0x81eb3, 0x81eb5, 0x81eb7, 0x81eb9, 0x81ebb, 0x81ebd, 0x81ebf, - 0x81ec1, 0x81ec3, 0x81ec5, 0x81ec7, 0x81ec9, 0x81ecb, 0x81ecd, 0x81ecf, 0x81ed1, - 0x81ed3, 0x81ed5, 0x81ed7, 0x81ed9, 0x81edb, 0x81edd, 0x81edf, 0x81ee1, 0x81ee3, - 0x81ee5, 0x81ee7, 0x81ee9, 0x81eeb, 0x81eed, 0x81eef, 0x81ef1, 0x81ef3, 0x81ef5, - 0x81ef7, 0x81ef9, 0x81efb, 0x81efd, 0x81fb6, 0x81fb7, 0x81fbe, 0x81fc6, 0x81fc7, - 0x81fd6, 0x81fd7, 0x81ff6, 0x81ff7, 0x8210a, 0x8210e, 0x8210f, 0x82113, 0x8212f, - 0x82134, 0x82139, 0x8213c, 0x8213d, 0x8214e, 0x82184, 0x82c61, 0x82c65, 0x82c66, - 0x82c68, 0x82c6a, 0x82c6c, 0x82c71, 0x82c73, 0x82c74, 0x82c81, 0x82c83, 0x82c85, - 0x82c87, 0x82c89, 0x82c8b, 0x82c8d, 0x82c8f, 0x82c91, 0x82c93, 0x82c95, 0x82c97, - 0x82c99, 0x82c9b, 0x82c9d, 0x82c9f, 0x82ca1, 0x82ca3, 0x82ca5, 0x82ca7, 0x82ca9, - 0x82cab, 0x82cad, 0x82caf, 0x82cb1, 0x82cb3, 0x82cb5, 0x82cb7, 0x82cb9, 0x82cbb, - 0x82cbd, 0x82cbf, 0x82cc1, 0x82cc3, 0x82cc5, 0x82cc7, 0x82cc9, 0x82ccb, 0x82ccd, - 0x82ccf, 0x82cd1, 0x82cd3, 0x82cd5, 0x82cd7, 0x82cd9, 0x82cdb, 0x82cdd, 0x82cdf, - 0x82ce1, 0x82ce3, 0x82ce4, 0x82cec, 0x82cee, 0x82cf3, 0x82d27, 0x82d2d, 0x8a641, - 0x8a643, 0x8a645, 0x8a647, 0x8a649, 0x8a64b, 0x8a64d, 0x8a64f, 0x8a651, 0x8a653, - 0x8a655, 0x8a657, 0x8a659, 0x8a65b, 0x8a65d, 0x8a65f, 0x8a661, 0x8a663, 0x8a665, - 0x8a667, 0x8a669, 0x8a66b, 0x8a66d, 0x8a681, 0x8a683, 0x8a685, 0x8a687, 0x8a689, - 0x8a68b, 0x8a68d, 0x8a68f, 0x8a691, 0x8a693, 0x8a695, 0x8a697, 0x8a699, 0x8a69b, - 0x8a723, 0x8a725, 0x8a727, 0x8a729, 0x8a72b, 0x8a72d, 0x8a733, 0x8a735, 0x8a737, - 0x8a739, 0x8a73b, 0x8a73d, 0x8a73f, 0x8a741, 0x8a743, 0x8a745, 0x8a747, 0x8a749, - 0x8a74b, 0x8a74d, 0x8a74f, 0x8a751, 0x8a753, 0x8a755, 0x8a757, 0x8a759, 0x8a75b, - 0x8a75d, 0x8a75f, 0x8a761, 0x8a763, 0x8a765, 0x8a767, 0x8a769, 0x8a76b, 0x8a76d, - 0x8a76f, 0x8a77a, 0x8a77c, 0x8a77f, 0x8a781, 0x8a783, 0x8a785, 0x8a787, 0x8a78c, - 0x8a78e, 0x8a791, 0x8a797, 0x8a799, 0x8a79b, 0x8a79d, 0x8a79f, 0x8a7a1, 0x8a7a3, - 0x8a7a5, 0x8a7a7, 0x8a7a9, 0x8a7b5, 0x8a7b7, 0x8a7fa, 0x900b5, 0x90101, 0x90103, - 0x90105, 0x90107, 0x90109, 0x9010b, 0x9010d, 0x9010f, 0x90111, 0x90113, 0x90115, - 0x90117, 0x90119, 0x9011b, 0x9011d, 0x9011f, 0x90121, 0x90123, 0x90125, 0x90127, - 0x90129, 0x9012b, 0x9012d, 0x9012f, 0x90131, 0x90133, 0x90135, 0x90137, 0x90138, - 0x9013a, 0x9013c, 0x9013e, 0x90140, 0x90142, 0x90144, 0x90146, 0x90148, 0x90149, - 0x9014b, 0x9014d, 0x9014f, 0x90151, 0x90153, 0x90155, 0x90157, 0x90159, 0x9015b, - 0x9015d, 0x9015f, 0x90161, 0x90163, 0x90165, 0x90167, 0x90169, 0x9016b, 0x9016d, - 0x9016f, 0x90171, 0x90173, 0x90175, 0x90177, 0x9017a, 0x9017c, 0x90183, 0x90185, - 0x90188, 0x9018c, 0x9018d, 0x90192, 0x90195, 0x9019e, 0x901a1, 0x901a3, 0x901a5, - 0x901a8, 0x901aa, 0x901ab, 0x901ad, 0x901b0, 0x901b4, 0x901b6, 0x901b9, 0x901ba, - 0x901c6, 0x901c9, 0x901cc, 0x901ce, 0x901d0, 0x901d2, 0x901d4, 0x901d6, 0x901d8, - 0x901da, 0x901dc, 0x901dd, 0x901df, 0x901e1, 0x901e3, 0x901e5, 0x901e7, 0x901e9, - 0x901eb, 0x901ed, 0x901ef, 0x901f0, 0x901f3, 0x901f5, 0x901f9, 0x901fb, 0x901fd, - 0x901ff, 0x90201, 0x90203, 0x90205, 0x90207, 0x90209, 0x9020b, 0x9020d, 0x9020f, - 0x90211, 0x90213, 0x90215, 0x90217, 0x90219, 0x9021b, 0x9021d, 0x9021f, 0x90221, - 0x90223, 0x90225, 0x90227, 0x90229, 0x9022b, 0x9022d, 0x9022f, 0x90231, 0x9023c, - 0x9023f, 0x90240, 0x90242, 0x90247, 0x90249, 0x9024b, 0x9024d, 0x90371, 0x90373, - 0x90377, 0x90390, 0x903d0, 0x903d1, 0x903d9, 0x903db, 0x903dd, 0x903df, 0x903e1, - 0x903e3, 0x903e5, 0x903e7, 0x903e9, 0x903eb, 0x903ed, 0x903f5, 0x903f8, 0x903fb, - 0x903fc, 0x90461, 0x90463, 0x90465, 0x90467, 0x90469, 0x9046b, 0x9046d, 0x9046f, - 0x90471, 0x90473, 0x90475, 0x90477, 0x90479, 0x9047b, 0x9047d, 0x9047f, 0x90481, - 0x9048b, 0x9048d, 0x9048f, 0x90491, 0x90493, 0x90495, 0x90497, 0x90499, 0x9049b, - 0x9049d, 0x9049f, 0x904a1, 0x904a3, 0x904a5, 0x904a7, 0x904a9, 0x904ab, 0x904ad, - 0x904af, 0x904b1, 0x904b3, 0x904b5, 0x904b7, 0x904b9, 0x904bb, 0x904bd, 0x904bf, - 0x904c2, 0x904c4, 0x904c6, 0x904c8, 0x904ca, 0x904cc, 0x904ce, 0x904cf, 0x904d1, - 0x904d3, 0x904d5, 0x904d7, 0x904d9, 0x904db, 0x904dd, 0x904df, 0x904e1, 0x904e3, - 0x904e5, 0x904e7, 0x904e9, 0x904eb, 0x904ed, 0x904ef, 0x904f1, 0x904f3, 0x904f5, - 0x904f7, 0x904f9, 0x904fb, 0x904fd, 0x904ff, 0x90501, 0x90503, 0x90505, 0x90507, - 0x90509, 0x9050b, 0x9050d, 0x9050f, 0x90511, 0x90513, 0x90515, 0x90517, 0x90519, - 0x9051b, 0x9051d, 0x9051f, 0x90521, 0x90523, 0x90525, 0x90527, 0x90529, 0x9052b, - 0x9052d, 0x9052f, 0x91e01, 0x91e03, 0x91e05, 0x91e07, 0x91e09, 0x91e0b, 0x91e0d, - 0x91e0f, 0x91e11, 0x91e13, 0x91e15, 0x91e17, 0x91e19, 0x91e1b, 0x91e1d, 0x91e1f, - 0x91e21, 0x91e23, 0x91e25, 0x91e27, 0x91e29, 0x91e2b, 0x91e2d, 0x91e2f, 0x91e31, - 0x91e33, 0x91e35, 0x91e37, 0x91e39, 0x91e3b, 0x91e3d, 0x91e3f, 0x91e41, 0x91e43, - 0x91e45, 0x91e47, 0x91e49, 0x91e4b, 0x91e4d, 0x91e4f, 0x91e51, 0x91e53, 0x91e55, - 0x91e57, 0x91e59, 0x91e5b, 0x91e5d, 0x91e5f, 0x91e61, 0x91e63, 0x91e65, 0x91e67, - 0x91e69, 0x91e6b, 0x91e6d, 0x91e6f, 0x91e71, 0x91e73, 0x91e75, 0x91e77, 0x91e79, - 0x91e7b, 0x91e7d, 0x91e7f, 0x91e81, 0x91e83, 0x91e85, 0x91e87, 0x91e89, 0x91e8b, - 0x91e8d, 0x91e8f, 0x91e91, 0x91e93, 0x91e9f, 0x91ea1, 0x91ea3, 0x91ea5, 0x91ea7, - 0x91ea9, 0x91eab, 0x91ead, 0x91eaf, 0x91eb1, 0x91eb3, 0x91eb5, 0x91eb7, 0x91eb9, - 0x91ebb, 0x91ebd, 0x91ebf, 0x91ec1, 0x91ec3, 0x91ec5, 0x91ec7, 0x91ec9, 0x91ecb, - 0x91ecd, 0x91ecf, 0x91ed1, 0x91ed3, 0x91ed5, 0x91ed7, 0x91ed9, 0x91edb, 0x91edd, - 0x91edf, 0x91ee1, 0x91ee3, 0x91ee5, 0x91ee7, 0x91ee9, 0x91eeb, 0x91eed, 0x91eef, - 0x91ef1, 0x91ef3, 0x91ef5, 0x91ef7, 0x91ef9, 0x91efb, 0x91efd, 0x91fb6, 0x91fb7, - 0x91fbe, 0x91fc6, 0x91fc7, 0x91fd6, 0x91fd7, 0x91ff6, 0x91ff7, 0x9210a, 0x9210e, - 0x9210f, 0x92113, 0x9212f, 0x92134, 0x92139, 0x9213c, 0x9213d, 0x9214e, 0x92184, - 0x92c61, 0x92c65, 0x92c66, 0x92c68, 0x92c6a, 0x92c6c, 0x92c71, 0x92c73, 0x92c74, - 0x92c81, 0x92c83, 0x92c85, 0x92c87, 0x92c89, 0x92c8b, 0x92c8d, 0x92c8f, 0x92c91, - 0x92c93, 0x92c95, 0x92c97, 0x92c99, 0x92c9b, 0x92c9d, 0x92c9f, 0x92ca1, 0x92ca3, - 0x92ca5, 0x92ca7, 0x92ca9, 0x92cab, 0x92cad, 0x92caf, 0x92cb1, 0x92cb3, 0x92cb5, - 0x92cb7, 0x92cb9, 0x92cbb, 0x92cbd, 0x92cbf, 0x92cc1, 0x92cc3, 0x92cc5, 0x92cc7, - 0x92cc9, 0x92ccb, 0x92ccd, 0x92ccf, 0x92cd1, 0x92cd3, 0x92cd5, 0x92cd7, 0x92cd9, - 0x92cdb, 0x92cdd, 0x92cdf, 0x92ce1, 0x92ce3, 0x92ce4, 0x92cec, 0x92cee, 0x92cf3, - 0x92d27, 0x92d2d, 0x9a641, 0x9a643, 0x9a645, 0x9a647, 0x9a649, 0x9a64b, 0x9a64d, - 0x9a64f, 0x9a651, 0x9a653, 0x9a655, 0x9a657, 0x9a659, 0x9a65b, 0x9a65d, 0x9a65f, - 0x9a661, 0x9a663, 0x9a665, 0x9a667, 0x9a669, 0x9a66b, 0x9a66d, 0x9a681, 0x9a683, - 0x9a685, 0x9a687, 0x9a689, 0x9a68b, 0x9a68d, 0x9a68f, 0x9a691, 0x9a693, 0x9a695, - 0x9a697, 0x9a699, 0x9a69b, 0x9a723, 0x9a725, 0x9a727, 0x9a729, 0x9a72b, 0x9a72d, - 0x9a733, 0x9a735, 0x9a737, 0x9a739, 0x9a73b, 0x9a73d, 0x9a73f, 0x9a741, 0x9a743, - 0x9a745, 0x9a747, 0x9a749, 0x9a74b, 0x9a74d, 0x9a74f, 0x9a751, 0x9a753, 0x9a755, - 0x9a757, 0x9a759, 0x9a75b, 0x9a75d, 0x9a75f, 0x9a761, 0x9a763, 0x9a765, 0x9a767, - 0x9a769, 0x9a76b, 0x9a76d, 0x9a76f, 0x9a77a, 0x9a77c, 0x9a77f, 0x9a781, 0x9a783, - 0x9a785, 0x9a787, 0x9a78c, 0x9a78e, 0x9a791, 0x9a797, 0x9a799, 0x9a79b, 0x9a79d, - 0x9a79f, 0x9a7a1, 0x9a7a3, 0x9a7a5, 0x9a7a7, 0x9a7a9, 0x9a7b5, 0x9a7b7, 0x9a7fa, - 0xa00b5, 0xa0101, 0xa0103, 0xa0105, 0xa0107, 0xa0109, 0xa010b, 0xa010d, 0xa010f, - 0xa0111, 0xa0113, 0xa0115, 0xa0117, 0xa0119, 0xa011b, 0xa011d, 0xa011f, 0xa0121, - 0xa0123, 0xa0125, 0xa0127, 0xa0129, 0xa012b, 0xa012d, 0xa012f, 0xa0131, 0xa0133, - 0xa0135, 0xa0137, 0xa0138, 0xa013a, 0xa013c, 0xa013e, 0xa0140, 0xa0142, 0xa0144, - 0xa0146, 0xa0148, 0xa0149, 0xa014b, 0xa014d, 0xa014f, 0xa0151, 0xa0153, 0xa0155, - 0xa0157, 0xa0159, 0xa015b, 0xa015d, 0xa015f, 0xa0161, 0xa0163, 0xa0165, 0xa0167, - 0xa0169, 0xa016b, 0xa016d, 0xa016f, 0xa0171, 0xa0173, 0xa0175, 0xa0177, 0xa017a, - 0xa017c, 0xa0183, 0xa0185, 0xa0188, 0xa018c, 0xa018d, 0xa0192, 0xa0195, 0xa019e, - 0xa01a1, 0xa01a3, 0xa01a5, 0xa01a8, 0xa01aa, 0xa01ab, 0xa01ad, 0xa01b0, 0xa01b4, - 0xa01b6, 0xa01b9, 0xa01ba, 0xa01c6, 0xa01c9, 0xa01cc, 0xa01ce, 0xa01d0, 0xa01d2, - 0xa01d4, 0xa01d6, 0xa01d8, 0xa01da, 0xa01dc, 0xa01dd, 0xa01df, 0xa01e1, 0xa01e3, - 0xa01e5, 0xa01e7, 0xa01e9, 0xa01eb, 0xa01ed, 0xa01ef, 0xa01f0, 0xa01f3, 0xa01f5, - 0xa01f9, 0xa01fb, 0xa01fd, 0xa01ff, 0xa0201, 0xa0203, 0xa0205, 0xa0207, 0xa0209, - 0xa020b, 0xa020d, 0xa020f, 0xa0211, 0xa0213, 0xa0215, 0xa0217, 0xa0219, 0xa021b, - 0xa021d, 0xa021f, 0xa0221, 0xa0223, 0xa0225, 0xa0227, 0xa0229, 0xa022b, 0xa022d, - 0xa022f, 0xa0231, 0xa023c, 0xa023f, 0xa0240, 0xa0242, 0xa0247, 0xa0249, 0xa024b, - 0xa024d, 0xa0371, 0xa0373, 0xa0377, 0xa0390, 0xa03d0, 0xa03d1, 0xa03d9, 0xa03db, - 0xa03dd, 0xa03df, 0xa03e1, 0xa03e3, 0xa03e5, 0xa03e7, 0xa03e9, 0xa03eb, 0xa03ed, - 0xa03f5, 0xa03f8, 0xa03fb, 0xa03fc, 0xa0461, 0xa0463, 0xa0465, 0xa0467, 0xa0469, - 0xa046b, 0xa046d, 0xa046f, 0xa0471, 0xa0473, 0xa0475, 0xa0477, 0xa0479, 0xa047b, - 0xa047d, 0xa047f, 0xa0481, 0xa048b, 0xa048d, 0xa048f, 0xa0491, 0xa0493, 0xa0495, - 0xa0497, 0xa0499, 0xa049b, 0xa049d, 0xa049f, 0xa04a1, 0xa04a3, 0xa04a5, 0xa04a7, - 0xa04a9, 0xa04ab, 0xa04ad, 0xa04af, 0xa04b1, 0xa04b3, 0xa04b5, 0xa04b7, 0xa04b9, - 0xa04bb, 0xa04bd, 0xa04bf, 0xa04c2, 0xa04c4, 0xa04c6, 0xa04c8, 0xa04ca, 0xa04cc, - 0xa04ce, 0xa04cf, 0xa04d1, 0xa04d3, 0xa04d5, 0xa04d7, 0xa04d9, 0xa04db, 0xa04dd, - 0xa04df, 0xa04e1, 0xa04e3, 0xa04e5, 0xa04e7, 0xa04e9, 0xa04eb, 0xa04ed, 0xa04ef, - 0xa04f1, 0xa04f3, 0xa04f5, 0xa04f7, 0xa04f9, 0xa04fb, 0xa04fd, 0xa04ff, 0xa0501, - 0xa0503, 0xa0505, 0xa0507, 0xa0509, 0xa050b, 0xa050d, 0xa050f, 0xa0511, 0xa0513, - 0xa0515, 0xa0517, 0xa0519, 0xa051b, 0xa051d, 0xa051f, 0xa0521, 0xa0523, 0xa0525, - 0xa0527, 0xa0529, 0xa052b, 0xa052d, 0xa052f, 0xa1e01, 0xa1e03, 0xa1e05, 0xa1e07, - 0xa1e09, 0xa1e0b, 0xa1e0d, 0xa1e0f, 0xa1e11, 0xa1e13, 0xa1e15, 0xa1e17, 0xa1e19, - 0xa1e1b, 0xa1e1d, 0xa1e1f, 0xa1e21, 0xa1e23, 0xa1e25, 0xa1e27, 0xa1e29, 0xa1e2b, - 0xa1e2d, 0xa1e2f, 0xa1e31, 0xa1e33, 0xa1e35, 0xa1e37, 0xa1e39, 0xa1e3b, 0xa1e3d, - 0xa1e3f, 0xa1e41, 0xa1e43, 0xa1e45, 0xa1e47, 0xa1e49, 0xa1e4b, 0xa1e4d, 0xa1e4f, - 0xa1e51, 0xa1e53, 0xa1e55, 0xa1e57, 0xa1e59, 0xa1e5b, 0xa1e5d, 0xa1e5f, 0xa1e61, - 0xa1e63, 0xa1e65, 0xa1e67, 0xa1e69, 0xa1e6b, 0xa1e6d, 0xa1e6f, 0xa1e71, 0xa1e73, - 0xa1e75, 0xa1e77, 0xa1e79, 0xa1e7b, 0xa1e7d, 0xa1e7f, 0xa1e81, 0xa1e83, 0xa1e85, - 0xa1e87, 0xa1e89, 0xa1e8b, 0xa1e8d, 0xa1e8f, 0xa1e91, 0xa1e93, 0xa1e9f, 0xa1ea1, - 0xa1ea3, 0xa1ea5, 0xa1ea7, 0xa1ea9, 0xa1eab, 0xa1ead, 0xa1eaf, 0xa1eb1, 0xa1eb3, - 0xa1eb5, 0xa1eb7, 0xa1eb9, 0xa1ebb, 0xa1ebd, 0xa1ebf, 0xa1ec1, 0xa1ec3, 0xa1ec5, - 0xa1ec7, 0xa1ec9, 0xa1ecb, 0xa1ecd, 0xa1ecf, 0xa1ed1, 0xa1ed3, 0xa1ed5, 0xa1ed7, - 0xa1ed9, 0xa1edb, 0xa1edd, 0xa1edf, 0xa1ee1, 0xa1ee3, 0xa1ee5, 0xa1ee7, 0xa1ee9, - 0xa1eeb, 0xa1eed, 0xa1eef, 0xa1ef1, 0xa1ef3, 0xa1ef5, 0xa1ef7, 0xa1ef9, 0xa1efb, - 0xa1efd, 0xa1fb6, 0xa1fb7, 0xa1fbe, 0xa1fc6, 0xa1fc7, 0xa1fd6, 0xa1fd7, 0xa1ff6, - 0xa1ff7, 0xa210a, 0xa210e, 0xa210f, 0xa2113, 0xa212f, 0xa2134, 0xa2139, 0xa213c, - 0xa213d, 0xa214e, 0xa2184, 0xa2c61, 0xa2c65, 0xa2c66, 0xa2c68, 0xa2c6a, 0xa2c6c, - 0xa2c71, 0xa2c73, 0xa2c74, 0xa2c81, 0xa2c83, 0xa2c85, 0xa2c87, 0xa2c89, 0xa2c8b, - 0xa2c8d, 0xa2c8f, 0xa2c91, 0xa2c93, 0xa2c95, 0xa2c97, 0xa2c99, 0xa2c9b, 0xa2c9d, - 0xa2c9f, 0xa2ca1, 0xa2ca3, 0xa2ca5, 0xa2ca7, 0xa2ca9, 0xa2cab, 0xa2cad, 0xa2caf, - 0xa2cb1, 0xa2cb3, 0xa2cb5, 0xa2cb7, 0xa2cb9, 0xa2cbb, 0xa2cbd, 0xa2cbf, 0xa2cc1, - 0xa2cc3, 0xa2cc5, 0xa2cc7, 0xa2cc9, 0xa2ccb, 0xa2ccd, 0xa2ccf, 0xa2cd1, 0xa2cd3, - 0xa2cd5, 0xa2cd7, 0xa2cd9, 0xa2cdb, 0xa2cdd, 0xa2cdf, 0xa2ce1, 0xa2ce3, 0xa2ce4, - 0xa2cec, 0xa2cee, 0xa2cf3, 0xa2d27, 0xa2d2d, 0xaa641, 0xaa643, 0xaa645, 0xaa647, - 0xaa649, 0xaa64b, 0xaa64d, 0xaa64f, 0xaa651, 0xaa653, 0xaa655, 0xaa657, 0xaa659, - 0xaa65b, 0xaa65d, 0xaa65f, 0xaa661, 0xaa663, 0xaa665, 0xaa667, 0xaa669, 0xaa66b, - 0xaa66d, 0xaa681, 0xaa683, 0xaa685, 0xaa687, 0xaa689, 0xaa68b, 0xaa68d, 0xaa68f, - 0xaa691, 0xaa693, 0xaa695, 0xaa697, 0xaa699, 0xaa69b, 0xaa723, 0xaa725, 0xaa727, - 0xaa729, 0xaa72b, 0xaa72d, 0xaa733, 0xaa735, 0xaa737, 0xaa739, 0xaa73b, 0xaa73d, - 0xaa73f, 0xaa741, 0xaa743, 0xaa745, 0xaa747, 0xaa749, 0xaa74b, 0xaa74d, 0xaa74f, - 0xaa751, 0xaa753, 0xaa755, 0xaa757, 0xaa759, 0xaa75b, 0xaa75d, 0xaa75f, 0xaa761, - 0xaa763, 0xaa765, 0xaa767, 0xaa769, 0xaa76b, 0xaa76d, 0xaa76f, 0xaa77a, 0xaa77c, - 0xaa77f, 0xaa781, 0xaa783, 0xaa785, 0xaa787, 0xaa78c, 0xaa78e, 0xaa791, 0xaa797, - 0xaa799, 0xaa79b, 0xaa79d, 0xaa79f, 0xaa7a1, 0xaa7a3, 0xaa7a5, 0xaa7a7, 0xaa7a9, - 0xaa7b5, 0xaa7b7, 0xaa7fa, 0xb00b5, 0xb0101, 0xb0103, 0xb0105, 0xb0107, 0xb0109, - 0xb010b, 0xb010d, 0xb010f, 0xb0111, 0xb0113, 0xb0115, 0xb0117, 0xb0119, 0xb011b, - 0xb011d, 0xb011f, 0xb0121, 0xb0123, 0xb0125, 0xb0127, 0xb0129, 0xb012b, 0xb012d, - 0xb012f, 0xb0131, 0xb0133, 0xb0135, 0xb0137, 0xb0138, 0xb013a, 0xb013c, 0xb013e, - 0xb0140, 0xb0142, 0xb0144, 0xb0146, 0xb0148, 0xb0149, 0xb014b, 0xb014d, 0xb014f, - 0xb0151, 0xb0153, 0xb0155, 0xb0157, 0xb0159, 0xb015b, 0xb015d, 0xb015f, 0xb0161, - 0xb0163, 0xb0165, 0xb0167, 0xb0169, 0xb016b, 0xb016d, 0xb016f, 0xb0171, 0xb0173, - 0xb0175, 0xb0177, 0xb017a, 0xb017c, 0xb0183, 0xb0185, 0xb0188, 0xb018c, 0xb018d, - 0xb0192, 0xb0195, 0xb019e, 0xb01a1, 0xb01a3, 0xb01a5, 0xb01a8, 0xb01aa, 0xb01ab, - 0xb01ad, 0xb01b0, 0xb01b4, 0xb01b6, 0xb01b9, 0xb01ba, 0xb01c6, 0xb01c9, 0xb01cc, - 0xb01ce, 0xb01d0, 0xb01d2, 0xb01d4, 0xb01d6, 0xb01d8, 0xb01da, 0xb01dc, 0xb01dd, - 0xb01df, 0xb01e1, 0xb01e3, 0xb01e5, 0xb01e7, 0xb01e9, 0xb01eb, 0xb01ed, 0xb01ef, - 0xb01f0, 0xb01f3, 0xb01f5, 0xb01f9, 0xb01fb, 0xb01fd, 0xb01ff, 0xb0201, 0xb0203, - 0xb0205, 0xb0207, 0xb0209, 0xb020b, 0xb020d, 0xb020f, 0xb0211, 0xb0213, 0xb0215, - 0xb0217, 0xb0219, 0xb021b, 0xb021d, 0xb021f, 0xb0221, 0xb0223, 0xb0225, 0xb0227, - 0xb0229, 0xb022b, 0xb022d, 0xb022f, 0xb0231, 0xb023c, 0xb023f, 0xb0240, 0xb0242, - 0xb0247, 0xb0249, 0xb024b, 0xb024d, 0xb0371, 0xb0373, 0xb0377, 0xb0390, 0xb03d0, - 0xb03d1, 0xb03d9, 0xb03db, 0xb03dd, 0xb03df, 0xb03e1, 0xb03e3, 0xb03e5, 0xb03e7, - 0xb03e9, 0xb03eb, 0xb03ed, 0xb03f5, 0xb03f8, 0xb03fb, 0xb03fc, 0xb0461, 0xb0463, - 0xb0465, 0xb0467, 0xb0469, 0xb046b, 0xb046d, 0xb046f, 0xb0471, 0xb0473, 0xb0475, - 0xb0477, 0xb0479, 0xb047b, 0xb047d, 0xb047f, 0xb0481, 0xb048b, 0xb048d, 0xb048f, - 0xb0491, 0xb0493, 0xb0495, 0xb0497, 0xb0499, 0xb049b, 0xb049d, 0xb049f, 0xb04a1, - 0xb04a3, 0xb04a5, 0xb04a7, 0xb04a9, 0xb04ab, 0xb04ad, 0xb04af, 0xb04b1, 0xb04b3, - 0xb04b5, 0xb04b7, 0xb04b9, 0xb04bb, 0xb04bd, 0xb04bf, 0xb04c2, 0xb04c4, 0xb04c6, - 0xb04c8, 0xb04ca, 0xb04cc, 0xb04ce, 0xb04cf, 0xb04d1, 0xb04d3, 0xb04d5, 0xb04d7, - 0xb04d9, 0xb04db, 0xb04dd, 0xb04df, 0xb04e1, 0xb04e3, 0xb04e5, 0xb04e7, 0xb04e9, - 0xb04eb, 0xb04ed, 0xb04ef, 0xb04f1, 0xb04f3, 0xb04f5, 0xb04f7, 0xb04f9, 0xb04fb, - 0xb04fd, 0xb04ff, 0xb0501, 0xb0503, 0xb0505, 0xb0507, 0xb0509, 0xb050b, 0xb050d, - 0xb050f, 0xb0511, 0xb0513, 0xb0515, 0xb0517, 0xb0519, 0xb051b, 0xb051d, 0xb051f, - 0xb0521, 0xb0523, 0xb0525, 0xb0527, 0xb0529, 0xb052b, 0xb052d, 0xb052f, 0xb1e01, - 0xb1e03, 0xb1e05, 0xb1e07, 0xb1e09, 0xb1e0b, 0xb1e0d, 0xb1e0f, 0xb1e11, 0xb1e13, - 0xb1e15, 0xb1e17, 0xb1e19, 0xb1e1b, 0xb1e1d, 0xb1e1f, 0xb1e21, 0xb1e23, 0xb1e25, - 0xb1e27, 0xb1e29, 0xb1e2b, 0xb1e2d, 0xb1e2f, 0xb1e31, 0xb1e33, 0xb1e35, 0xb1e37, - 0xb1e39, 0xb1e3b, 0xb1e3d, 0xb1e3f, 0xb1e41, 0xb1e43, 0xb1e45, 0xb1e47, 0xb1e49, - 0xb1e4b, 0xb1e4d, 0xb1e4f, 0xb1e51, 0xb1e53, 0xb1e55, 0xb1e57, 0xb1e59, 0xb1e5b, - 0xb1e5d, 0xb1e5f, 0xb1e61, 0xb1e63, 0xb1e65, 0xb1e67, 0xb1e69, 0xb1e6b, 0xb1e6d, - 0xb1e6f, 0xb1e71, 0xb1e73, 0xb1e75, 0xb1e77, 0xb1e79, 0xb1e7b, 0xb1e7d, 0xb1e7f, - 0xb1e81, 0xb1e83, 0xb1e85, 0xb1e87, 0xb1e89, 0xb1e8b, 0xb1e8d, 0xb1e8f, 0xb1e91, - 0xb1e93, 0xb1e9f, 0xb1ea1, 0xb1ea3, 0xb1ea5, 0xb1ea7, 0xb1ea9, 0xb1eab, 0xb1ead, - 0xb1eaf, 0xb1eb1, 0xb1eb3, 0xb1eb5, 0xb1eb7, 0xb1eb9, 0xb1ebb, 0xb1ebd, 0xb1ebf, - 0xb1ec1, 0xb1ec3, 0xb1ec5, 0xb1ec7, 0xb1ec9, 0xb1ecb, 0xb1ecd, 0xb1ecf, 0xb1ed1, - 0xb1ed3, 0xb1ed5, 0xb1ed7, 0xb1ed9, 0xb1edb, 0xb1edd, 0xb1edf, 0xb1ee1, 0xb1ee3, - 0xb1ee5, 0xb1ee7, 0xb1ee9, 0xb1eeb, 0xb1eed, 0xb1eef, 0xb1ef1, 0xb1ef3, 0xb1ef5, - 0xb1ef7, 0xb1ef9, 0xb1efb, 0xb1efd, 0xb1fb6, 0xb1fb7, 0xb1fbe, 0xb1fc6, 0xb1fc7, - 0xb1fd6, 0xb1fd7, 0xb1ff6, 0xb1ff7, 0xb210a, 0xb210e, 0xb210f, 0xb2113, 0xb212f, - 0xb2134, 0xb2139, 0xb213c, 0xb213d, 0xb214e, 0xb2184, 0xb2c61, 0xb2c65, 0xb2c66, - 0xb2c68, 0xb2c6a, 0xb2c6c, 0xb2c71, 0xb2c73, 0xb2c74, 0xb2c81, 0xb2c83, 0xb2c85, - 0xb2c87, 0xb2c89, 0xb2c8b, 0xb2c8d, 0xb2c8f, 0xb2c91, 0xb2c93, 0xb2c95, 0xb2c97, - 0xb2c99, 0xb2c9b, 0xb2c9d, 0xb2c9f, 0xb2ca1, 0xb2ca3, 0xb2ca5, 0xb2ca7, 0xb2ca9, - 0xb2cab, 0xb2cad, 0xb2caf, 0xb2cb1, 0xb2cb3, 0xb2cb5, 0xb2cb7, 0xb2cb9, 0xb2cbb, - 0xb2cbd, 0xb2cbf, 0xb2cc1, 0xb2cc3, 0xb2cc5, 0xb2cc7, 0xb2cc9, 0xb2ccb, 0xb2ccd, - 0xb2ccf, 0xb2cd1, 0xb2cd3, 0xb2cd5, 0xb2cd7, 0xb2cd9, 0xb2cdb, 0xb2cdd, 0xb2cdf, - 0xb2ce1, 0xb2ce3, 0xb2ce4, 0xb2cec, 0xb2cee, 0xb2cf3, 0xb2d27, 0xb2d2d, 0xba641, - 0xba643, 0xba645, 0xba647, 0xba649, 0xba64b, 0xba64d, 0xba64f, 0xba651, 0xba653, - 0xba655, 0xba657, 0xba659, 0xba65b, 0xba65d, 0xba65f, 0xba661, 0xba663, 0xba665, - 0xba667, 0xba669, 0xba66b, 0xba66d, 0xba681, 0xba683, 0xba685, 0xba687, 0xba689, - 0xba68b, 0xba68d, 0xba68f, 0xba691, 0xba693, 0xba695, 0xba697, 0xba699, 0xba69b, - 0xba723, 0xba725, 0xba727, 0xba729, 0xba72b, 0xba72d, 0xba733, 0xba735, 0xba737, - 0xba739, 0xba73b, 0xba73d, 0xba73f, 0xba741, 0xba743, 0xba745, 0xba747, 0xba749, - 0xba74b, 0xba74d, 0xba74f, 0xba751, 0xba753, 0xba755, 0xba757, 0xba759, 0xba75b, - 0xba75d, 0xba75f, 0xba761, 0xba763, 0xba765, 0xba767, 0xba769, 0xba76b, 0xba76d, - 0xba76f, 0xba77a, 0xba77c, 0xba77f, 0xba781, 0xba783, 0xba785, 0xba787, 0xba78c, - 0xba78e, 0xba791, 0xba797, 0xba799, 0xba79b, 0xba79d, 0xba79f, 0xba7a1, 0xba7a3, - 0xba7a5, 0xba7a7, 0xba7a9, 0xba7b5, 0xba7b7, 0xba7fa, 0xc00b5, 0xc0101, 0xc0103, - 0xc0105, 0xc0107, 0xc0109, 0xc010b, 0xc010d, 0xc010f, 0xc0111, 0xc0113, 0xc0115, - 0xc0117, 0xc0119, 0xc011b, 0xc011d, 0xc011f, 0xc0121, 0xc0123, 0xc0125, 0xc0127, - 0xc0129, 0xc012b, 0xc012d, 0xc012f, 0xc0131, 0xc0133, 0xc0135, 0xc0137, 0xc0138, - 0xc013a, 0xc013c, 0xc013e, 0xc0140, 0xc0142, 0xc0144, 0xc0146, 0xc0148, 0xc0149, - 0xc014b, 0xc014d, 0xc014f, 0xc0151, 0xc0153, 0xc0155, 0xc0157, 0xc0159, 0xc015b, - 0xc015d, 0xc015f, 0xc0161, 0xc0163, 0xc0165, 0xc0167, 0xc0169, 0xc016b, 0xc016d, - 0xc016f, 0xc0171, 0xc0173, 0xc0175, 0xc0177, 0xc017a, 0xc017c, 0xc0183, 0xc0185, - 0xc0188, 0xc018c, 0xc018d, 0xc0192, 0xc0195, 0xc019e, 0xc01a1, 0xc01a3, 0xc01a5, - 0xc01a8, 0xc01aa, 0xc01ab, 0xc01ad, 0xc01b0, 0xc01b4, 0xc01b6, 0xc01b9, 0xc01ba, - 0xc01c6, 0xc01c9, 0xc01cc, 0xc01ce, 0xc01d0, 0xc01d2, 0xc01d4, 0xc01d6, 0xc01d8, - 0xc01da, 0xc01dc, 0xc01dd, 0xc01df, 0xc01e1, 0xc01e3, 0xc01e5, 0xc01e7, 0xc01e9, - 0xc01eb, 0xc01ed, 0xc01ef, 0xc01f0, 0xc01f3, 0xc01f5, 0xc01f9, 0xc01fb, 0xc01fd, - 0xc01ff, 0xc0201, 0xc0203, 0xc0205, 0xc0207, 0xc0209, 0xc020b, 0xc020d, 0xc020f, - 0xc0211, 0xc0213, 0xc0215, 0xc0217, 0xc0219, 0xc021b, 0xc021d, 0xc021f, 0xc0221, - 0xc0223, 0xc0225, 0xc0227, 0xc0229, 0xc022b, 0xc022d, 0xc022f, 0xc0231, 0xc023c, - 0xc023f, 0xc0240, 0xc0242, 0xc0247, 0xc0249, 0xc024b, 0xc024d, 0xc0371, 0xc0373, - 0xc0377, 0xc0390, 0xc03d0, 0xc03d1, 0xc03d9, 0xc03db, 0xc03dd, 0xc03df, 0xc03e1, - 0xc03e3, 0xc03e5, 0xc03e7, 0xc03e9, 0xc03eb, 0xc03ed, 0xc03f5, 0xc03f8, 0xc03fb, - 0xc03fc, 0xc0461, 0xc0463, 0xc0465, 0xc0467, 0xc0469, 0xc046b, 0xc046d, 0xc046f, - 0xc0471, 0xc0473, 0xc0475, 0xc0477, 0xc0479, 0xc047b, 0xc047d, 0xc047f, 0xc0481, - 0xc048b, 0xc048d, 0xc048f, 0xc0491, 0xc0493, 0xc0495, 0xc0497, 0xc0499, 0xc049b, - 0xc049d, 0xc049f, 0xc04a1, 0xc04a3, 0xc04a5, 0xc04a7, 0xc04a9, 0xc04ab, 0xc04ad, - 0xc04af, 0xc04b1, 0xc04b3, 0xc04b5, 0xc04b7, 0xc04b9, 0xc04bb, 0xc04bd, 0xc04bf, - 0xc04c2, 0xc04c4, 0xc04c6, 0xc04c8, 0xc04ca, 0xc04cc, 0xc04ce, 0xc04cf, 0xc04d1, - 0xc04d3, 0xc04d5, 0xc04d7, 0xc04d9, 0xc04db, 0xc04dd, 0xc04df, 0xc04e1, 0xc04e3, - 0xc04e5, 0xc04e7, 0xc04e9, 0xc04eb, 0xc04ed, 0xc04ef, 0xc04f1, 0xc04f3, 0xc04f5, - 0xc04f7, 0xc04f9, 0xc04fb, 0xc04fd, 0xc04ff, 0xc0501, 0xc0503, 0xc0505, 0xc0507, - 0xc0509, 0xc050b, 0xc050d, 0xc050f, 0xc0511, 0xc0513, 0xc0515, 0xc0517, 0xc0519, - 0xc051b, 0xc051d, 0xc051f, 0xc0521, 0xc0523, 0xc0525, 0xc0527, 0xc0529, 0xc052b, - 0xc052d, 0xc052f, 0xc1e01, 0xc1e03, 0xc1e05, 0xc1e07, 0xc1e09, 0xc1e0b, 0xc1e0d, - 0xc1e0f, 0xc1e11, 0xc1e13, 0xc1e15, 0xc1e17, 0xc1e19, 0xc1e1b, 0xc1e1d, 0xc1e1f, - 0xc1e21, 0xc1e23, 0xc1e25, 0xc1e27, 0xc1e29, 0xc1e2b, 0xc1e2d, 0xc1e2f, 0xc1e31, - 0xc1e33, 0xc1e35, 0xc1e37, 0xc1e39, 0xc1e3b, 0xc1e3d, 0xc1e3f, 0xc1e41, 0xc1e43, - 0xc1e45, 0xc1e47, 0xc1e49, 0xc1e4b, 0xc1e4d, 0xc1e4f, 0xc1e51, 0xc1e53, 0xc1e55, - 0xc1e57, 0xc1e59, 0xc1e5b, 0xc1e5d, 0xc1e5f, 0xc1e61, 0xc1e63, 0xc1e65, 0xc1e67, - 0xc1e69, 0xc1e6b, 0xc1e6d, 0xc1e6f, 0xc1e71, 0xc1e73, 0xc1e75, 0xc1e77, 0xc1e79, - 0xc1e7b, 0xc1e7d, 0xc1e7f, 0xc1e81, 0xc1e83, 0xc1e85, 0xc1e87, 0xc1e89, 0xc1e8b, - 0xc1e8d, 0xc1e8f, 0xc1e91, 0xc1e93, 0xc1e9f, 0xc1ea1, 0xc1ea3, 0xc1ea5, 0xc1ea7, - 0xc1ea9, 0xc1eab, 0xc1ead, 0xc1eaf, 0xc1eb1, 0xc1eb3, 0xc1eb5, 0xc1eb7, 0xc1eb9, - 0xc1ebb, 0xc1ebd, 0xc1ebf, 0xc1ec1, 0xc1ec3, 0xc1ec5, 0xc1ec7, 0xc1ec9, 0xc1ecb, - 0xc1ecd, 0xc1ecf, 0xc1ed1, 0xc1ed3, 0xc1ed5, 0xc1ed7, 0xc1ed9, 0xc1edb, 0xc1edd, - 0xc1edf, 0xc1ee1, 0xc1ee3, 0xc1ee5, 0xc1ee7, 0xc1ee9, 0xc1eeb, 0xc1eed, 0xc1eef, - 0xc1ef1, 0xc1ef3, 0xc1ef5, 0xc1ef7, 0xc1ef9, 0xc1efb, 0xc1efd, 0xc1fb6, 0xc1fb7, - 0xc1fbe, 0xc1fc6, 0xc1fc7, 0xc1fd6, 0xc1fd7, 0xc1ff6, 0xc1ff7, 0xc210a, 0xc210e, - 0xc210f, 0xc2113, 0xc212f, 0xc2134, 0xc2139, 0xc213c, 0xc213d, 0xc214e, 0xc2184, - 0xc2c61, 0xc2c65, 0xc2c66, 0xc2c68, 0xc2c6a, 0xc2c6c, 0xc2c71, 0xc2c73, 0xc2c74, - 0xc2c81, 0xc2c83, 0xc2c85, 0xc2c87, 0xc2c89, 0xc2c8b, 0xc2c8d, 0xc2c8f, 0xc2c91, - 0xc2c93, 0xc2c95, 0xc2c97, 0xc2c99, 0xc2c9b, 0xc2c9d, 0xc2c9f, 0xc2ca1, 0xc2ca3, - 0xc2ca5, 0xc2ca7, 0xc2ca9, 0xc2cab, 0xc2cad, 0xc2caf, 0xc2cb1, 0xc2cb3, 0xc2cb5, - 0xc2cb7, 0xc2cb9, 0xc2cbb, 0xc2cbd, 0xc2cbf, 0xc2cc1, 0xc2cc3, 0xc2cc5, 0xc2cc7, - 0xc2cc9, 0xc2ccb, 0xc2ccd, 0xc2ccf, 0xc2cd1, 0xc2cd3, 0xc2cd5, 0xc2cd7, 0xc2cd9, - 0xc2cdb, 0xc2cdd, 0xc2cdf, 0xc2ce1, 0xc2ce3, 0xc2ce4, 0xc2cec, 0xc2cee, 0xc2cf3, - 0xc2d27, 0xc2d2d, 0xca641, 0xca643, 0xca645, 0xca647, 0xca649, 0xca64b, 0xca64d, - 0xca64f, 0xca651, 0xca653, 0xca655, 0xca657, 0xca659, 0xca65b, 0xca65d, 0xca65f, - 0xca661, 0xca663, 0xca665, 0xca667, 0xca669, 0xca66b, 0xca66d, 0xca681, 0xca683, - 0xca685, 0xca687, 0xca689, 0xca68b, 0xca68d, 0xca68f, 0xca691, 0xca693, 0xca695, - 0xca697, 0xca699, 0xca69b, 0xca723, 0xca725, 0xca727, 0xca729, 0xca72b, 0xca72d, - 0xca733, 0xca735, 0xca737, 0xca739, 0xca73b, 0xca73d, 0xca73f, 0xca741, 0xca743, - 0xca745, 0xca747, 0xca749, 0xca74b, 0xca74d, 0xca74f, 0xca751, 0xca753, 0xca755, - 0xca757, 0xca759, 0xca75b, 0xca75d, 0xca75f, 0xca761, 0xca763, 0xca765, 0xca767, - 0xca769, 0xca76b, 0xca76d, 0xca76f, 0xca77a, 0xca77c, 0xca77f, 0xca781, 0xca783, - 0xca785, 0xca787, 0xca78c, 0xca78e, 0xca791, 0xca797, 0xca799, 0xca79b, 0xca79d, - 0xca79f, 0xca7a1, 0xca7a3, 0xca7a5, 0xca7a7, 0xca7a9, 0xca7b5, 0xca7b7, 0xca7fa, - 0xd00b5, 0xd0101, 0xd0103, 0xd0105, 0xd0107, 0xd0109, 0xd010b, 0xd010d, 0xd010f, - 0xd0111, 0xd0113, 0xd0115, 0xd0117, 0xd0119, 0xd011b, 0xd011d, 0xd011f, 0xd0121, - 0xd0123, 0xd0125, 0xd0127, 0xd0129, 0xd012b, 0xd012d, 0xd012f, 0xd0131, 0xd0133, - 0xd0135, 0xd0137, 0xd0138, 0xd013a, 0xd013c, 0xd013e, 0xd0140, 0xd0142, 0xd0144, - 0xd0146, 0xd0148, 0xd0149, 0xd014b, 0xd014d, 0xd014f, 0xd0151, 0xd0153, 0xd0155, - 0xd0157, 0xd0159, 0xd015b, 0xd015d, 0xd015f, 0xd0161, 0xd0163, 0xd0165, 0xd0167, - 0xd0169, 0xd016b, 0xd016d, 0xd016f, 0xd0171, 0xd0173, 0xd0175, 0xd0177, 0xd017a, - 0xd017c, 0xd0183, 0xd0185, 0xd0188, 0xd018c, 0xd018d, 0xd0192, 0xd0195, 0xd019e, - 0xd01a1, 0xd01a3, 0xd01a5, 0xd01a8, 0xd01aa, 0xd01ab, 0xd01ad, 0xd01b0, 0xd01b4, - 0xd01b6, 0xd01b9, 0xd01ba, 0xd01c6, 0xd01c9, 0xd01cc, 0xd01ce, 0xd01d0, 0xd01d2, - 0xd01d4, 0xd01d6, 0xd01d8, 0xd01da, 0xd01dc, 0xd01dd, 0xd01df, 0xd01e1, 0xd01e3, - 0xd01e5, 0xd01e7, 0xd01e9, 0xd01eb, 0xd01ed, 0xd01ef, 0xd01f0, 0xd01f3, 0xd01f5, - 0xd01f9, 0xd01fb, 0xd01fd, 0xd01ff, 0xd0201, 0xd0203, 0xd0205, 0xd0207, 0xd0209, - 0xd020b, 0xd020d, 0xd020f, 0xd0211, 0xd0213, 0xd0215, 0xd0217, 0xd0219, 0xd021b, - 0xd021d, 0xd021f, 0xd0221, 0xd0223, 0xd0225, 0xd0227, 0xd0229, 0xd022b, 0xd022d, - 0xd022f, 0xd0231, 0xd023c, 0xd023f, 0xd0240, 0xd0242, 0xd0247, 0xd0249, 0xd024b, - 0xd024d, 0xd0371, 0xd0373, 0xd0377, 0xd0390, 0xd03d0, 0xd03d1, 0xd03d9, 0xd03db, - 0xd03dd, 0xd03df, 0xd03e1, 0xd03e3, 0xd03e5, 0xd03e7, 0xd03e9, 0xd03eb, 0xd03ed, - 0xd03f5, 0xd03f8, 0xd03fb, 0xd03fc, 0xd0461, 0xd0463, 0xd0465, 0xd0467, 0xd0469, - 0xd046b, 0xd046d, 0xd046f, 0xd0471, 0xd0473, 0xd0475, 0xd0477, 0xd0479, 0xd047b, - 0xd047d, 0xd047f, 0xd0481, 0xd048b, 0xd048d, 0xd048f, 0xd0491, 0xd0493, 0xd0495, - 0xd0497, 0xd0499, 0xd049b, 0xd049d, 0xd049f, 0xd04a1, 0xd04a3, 0xd04a5, 0xd04a7, - 0xd04a9, 0xd04ab, 0xd04ad, 0xd04af, 0xd04b1, 0xd04b3, 0xd04b5, 0xd04b7, 0xd04b9, - 0xd04bb, 0xd04bd, 0xd04bf, 0xd04c2, 0xd04c4, 0xd04c6, 0xd04c8, 0xd04ca, 0xd04cc, - 0xd04ce, 0xd04cf, 0xd04d1, 0xd04d3, 0xd04d5, 0xd04d7, 0xd04d9, 0xd04db, 0xd04dd, - 0xd04df, 0xd04e1, 0xd04e3, 0xd04e5, 0xd04e7, 0xd04e9, 0xd04eb, 0xd04ed, 0xd04ef, - 0xd04f1, 0xd04f3, 0xd04f5, 0xd04f7, 0xd04f9, 0xd04fb, 0xd04fd, 0xd04ff, 0xd0501, - 0xd0503, 0xd0505, 0xd0507, 0xd0509, 0xd050b, 0xd050d, 0xd050f, 0xd0511, 0xd0513, - 0xd0515, 0xd0517, 0xd0519, 0xd051b, 0xd051d, 0xd051f, 0xd0521, 0xd0523, 0xd0525, - 0xd0527, 0xd0529, 0xd052b, 0xd052d, 0xd052f, 0xd1e01, 0xd1e03, 0xd1e05, 0xd1e07, - 0xd1e09, 0xd1e0b, 0xd1e0d, 0xd1e0f, 0xd1e11, 0xd1e13, 0xd1e15, 0xd1e17, 0xd1e19, - 0xd1e1b, 0xd1e1d, 0xd1e1f, 0xd1e21, 0xd1e23, 0xd1e25, 0xd1e27, 0xd1e29, 0xd1e2b, - 0xd1e2d, 0xd1e2f, 0xd1e31, 0xd1e33, 0xd1e35, 0xd1e37, 0xd1e39, 0xd1e3b, 0xd1e3d, - 0xd1e3f, 0xd1e41, 0xd1e43, 0xd1e45, 0xd1e47, 0xd1e49, 0xd1e4b, 0xd1e4d, 0xd1e4f, - 0xd1e51, 0xd1e53, 0xd1e55, 0xd1e57, 0xd1e59, 0xd1e5b, 0xd1e5d, 0xd1e5f, 0xd1e61, - 0xd1e63, 0xd1e65, 0xd1e67, 0xd1e69, 0xd1e6b, 0xd1e6d, 0xd1e6f, 0xd1e71, 0xd1e73, - 0xd1e75, 0xd1e77, 0xd1e79, 0xd1e7b, 0xd1e7d, 0xd1e7f, 0xd1e81, 0xd1e83, 0xd1e85, - 0xd1e87, 0xd1e89, 0xd1e8b, 0xd1e8d, 0xd1e8f, 0xd1e91, 0xd1e93, 0xd1e9f, 0xd1ea1, - 0xd1ea3, 0xd1ea5, 0xd1ea7, 0xd1ea9, 0xd1eab, 0xd1ead, 0xd1eaf, 0xd1eb1, 0xd1eb3, - 0xd1eb5, 0xd1eb7, 0xd1eb9, 0xd1ebb, 0xd1ebd, 0xd1ebf, 0xd1ec1, 0xd1ec3, 0xd1ec5, - 0xd1ec7, 0xd1ec9, 0xd1ecb, 0xd1ecd, 0xd1ecf, 0xd1ed1, 0xd1ed3, 0xd1ed5, 0xd1ed7, - 0xd1ed9, 0xd1edb, 0xd1edd, 0xd1edf, 0xd1ee1, 0xd1ee3, 0xd1ee5, 0xd1ee7, 0xd1ee9, - 0xd1eeb, 0xd1eed, 0xd1eef, 0xd1ef1, 0xd1ef3, 0xd1ef5, 0xd1ef7, 0xd1ef9, 0xd1efb, - 0xd1efd, 0xd1fb6, 0xd1fb7, 0xd1fbe, 0xd1fc6, 0xd1fc7, 0xd1fd6, 0xd1fd7, 0xd1ff6, - 0xd1ff7, 0xd210a, 0xd210e, 0xd210f, 0xd2113, 0xd212f, 0xd2134, 0xd2139, 0xd213c, - 0xd213d, 0xd214e, 0xd2184, 0xd2c61, 0xd2c65, 0xd2c66, 0xd2c68, 0xd2c6a, 0xd2c6c, - 0xd2c71, 0xd2c73, 0xd2c74, 0xd2c81, 0xd2c83, 0xd2c85, 0xd2c87, 0xd2c89, 0xd2c8b, - 0xd2c8d, 0xd2c8f, 0xd2c91, 0xd2c93, 0xd2c95, 0xd2c97, 0xd2c99, 0xd2c9b, 0xd2c9d, - 0xd2c9f, 0xd2ca1, 0xd2ca3, 0xd2ca5, 0xd2ca7, 0xd2ca9, 0xd2cab, 0xd2cad, 0xd2caf, - 0xd2cb1, 0xd2cb3, 0xd2cb5, 0xd2cb7, 0xd2cb9, 0xd2cbb, 0xd2cbd, 0xd2cbf, 0xd2cc1, - 0xd2cc3, 0xd2cc5, 0xd2cc7, 0xd2cc9, 0xd2ccb, 0xd2ccd, 0xd2ccf, 0xd2cd1, 0xd2cd3, - 0xd2cd5, 0xd2cd7, 0xd2cd9, 0xd2cdb, 0xd2cdd, 0xd2cdf, 0xd2ce1, 0xd2ce3, 0xd2ce4, - 0xd2cec, 0xd2cee, 0xd2cf3, 0xd2d27, 0xd2d2d, 0xda641, 0xda643, 0xda645, 0xda647, - 0xda649, 0xda64b, 0xda64d, 0xda64f, 0xda651, 0xda653, 0xda655, 0xda657, 0xda659, - 0xda65b, 0xda65d, 0xda65f, 0xda661, 0xda663, 0xda665, 0xda667, 0xda669, 0xda66b, - 0xda66d, 0xda681, 0xda683, 0xda685, 0xda687, 0xda689, 0xda68b, 0xda68d, 0xda68f, - 0xda691, 0xda693, 0xda695, 0xda697, 0xda699, 0xda69b, 0xda723, 0xda725, 0xda727, - 0xda729, 0xda72b, 0xda72d, 0xda733, 0xda735, 0xda737, 0xda739, 0xda73b, 0xda73d, - 0xda73f, 0xda741, 0xda743, 0xda745, 0xda747, 0xda749, 0xda74b, 0xda74d, 0xda74f, - 0xda751, 0xda753, 0xda755, 0xda757, 0xda759, 0xda75b, 0xda75d, 0xda75f, 0xda761, - 0xda763, 0xda765, 0xda767, 0xda769, 0xda76b, 0xda76d, 0xda76f, 0xda77a, 0xda77c, - 0xda77f, 0xda781, 0xda783, 0xda785, 0xda787, 0xda78c, 0xda78e, 0xda791, 0xda797, - 0xda799, 0xda79b, 0xda79d, 0xda79f, 0xda7a1, 0xda7a3, 0xda7a5, 0xda7a7, 0xda7a9, - 0xda7b5, 0xda7b7, 0xda7fa, 0xe00b5, 0xe0101, 0xe0103, 0xe0105, 0xe0107, 0xe0109, - 0xe010b, 0xe010d, 0xe010f, 0xe0111, 0xe0113, 0xe0115, 0xe0117, 0xe0119, 0xe011b, - 0xe011d, 0xe011f, 0xe0121, 0xe0123, 0xe0125, 0xe0127, 0xe0129, 0xe012b, 0xe012d, - 0xe012f, 0xe0131, 0xe0133, 0xe0135, 0xe0137, 0xe0138, 0xe013a, 0xe013c, 0xe013e, - 0xe0140, 0xe0142, 0xe0144, 0xe0146, 0xe0148, 0xe0149, 0xe014b, 0xe014d, 0xe014f, - 0xe0151, 0xe0153, 0xe0155, 0xe0157, 0xe0159, 0xe015b, 0xe015d, 0xe015f, 0xe0161, - 0xe0163, 0xe0165, 0xe0167, 0xe0169, 0xe016b, 0xe016d, 0xe016f, 0xe0171, 0xe0173, - 0xe0175, 0xe0177, 0xe017a, 0xe017c, 0xe0183, 0xe0185, 0xe0188, 0xe018c, 0xe018d, - 0xe0192, 0xe0195, 0xe019e, 0xe01a1, 0xe01a3, 0xe01a5, 0xe01a8, 0xe01aa, 0xe01ab, - 0xe01ad, 0xe01b0, 0xe01b4, 0xe01b6, 0xe01b9, 0xe01ba, 0xe01c6, 0xe01c9, 0xe01cc, - 0xe01ce, 0xe01d0, 0xe01d2, 0xe01d4, 0xe01d6, 0xe01d8, 0xe01da, 0xe01dc, 0xe01dd, - 0xe01df, 0xe01e1, 0xe01e3, 0xe01e5, 0xe01e7, 0xe01e9, 0xe01eb, 0xe01ed, 0xe01ef, - 0xe01f0, 0xe01f3, 0xe01f5, 0xe01f9, 0xe01fb, 0xe01fd, 0xe01ff, 0xe0201, 0xe0203, - 0xe0205, 0xe0207, 0xe0209, 0xe020b, 0xe020d, 0xe020f, 0xe0211, 0xe0213, 0xe0215, - 0xe0217, 0xe0219, 0xe021b, 0xe021d, 0xe021f, 0xe0221, 0xe0223, 0xe0225, 0xe0227, - 0xe0229, 0xe022b, 0xe022d, 0xe022f, 0xe0231, 0xe023c, 0xe023f, 0xe0240, 0xe0242, - 0xe0247, 0xe0249, 0xe024b, 0xe024d, 0xe0371, 0xe0373, 0xe0377, 0xe0390, 0xe03d0, - 0xe03d1, 0xe03d9, 0xe03db, 0xe03dd, 0xe03df, 0xe03e1, 0xe03e3, 0xe03e5, 0xe03e7, - 0xe03e9, 0xe03eb, 0xe03ed, 0xe03f5, 0xe03f8, 0xe03fb, 0xe03fc, 0xe0461, 0xe0463, - 0xe0465, 0xe0467, 0xe0469, 0xe046b, 0xe046d, 0xe046f, 0xe0471, 0xe0473, 0xe0475, - 0xe0477, 0xe0479, 0xe047b, 0xe047d, 0xe047f, 0xe0481, 0xe048b, 0xe048d, 0xe048f, - 0xe0491, 0xe0493, 0xe0495, 0xe0497, 0xe0499, 0xe049b, 0xe049d, 0xe049f, 0xe04a1, - 0xe04a3, 0xe04a5, 0xe04a7, 0xe04a9, 0xe04ab, 0xe04ad, 0xe04af, 0xe04b1, 0xe04b3, - 0xe04b5, 0xe04b7, 0xe04b9, 0xe04bb, 0xe04bd, 0xe04bf, 0xe04c2, 0xe04c4, 0xe04c6, - 0xe04c8, 0xe04ca, 0xe04cc, 0xe04ce, 0xe04cf, 0xe04d1, 0xe04d3, 0xe04d5, 0xe04d7, - 0xe04d9, 0xe04db, 0xe04dd, 0xe04df, 0xe04e1, 0xe04e3, 0xe04e5, 0xe04e7, 0xe04e9, - 0xe04eb, 0xe04ed, 0xe04ef, 0xe04f1, 0xe04f3, 0xe04f5, 0xe04f7, 0xe04f9, 0xe04fb, - 0xe04fd, 0xe04ff, 0xe0501, 0xe0503, 0xe0505, 0xe0507, 0xe0509, 0xe050b, 0xe050d, - 0xe050f, 0xe0511, 0xe0513, 0xe0515, 0xe0517, 0xe0519, 0xe051b, 0xe051d, 0xe051f, - 0xe0521, 0xe0523, 0xe0525, 0xe0527, 0xe0529, 0xe052b, 0xe052d, 0xe052f, 0xe1e01, - 0xe1e03, 0xe1e05, 0xe1e07, 0xe1e09, 0xe1e0b, 0xe1e0d, 0xe1e0f, 0xe1e11, 0xe1e13, - 0xe1e15, 0xe1e17, 0xe1e19, 0xe1e1b, 0xe1e1d, 0xe1e1f, 0xe1e21, 0xe1e23, 0xe1e25, - 0xe1e27, 0xe1e29, 0xe1e2b, 0xe1e2d, 0xe1e2f, 0xe1e31, 0xe1e33, 0xe1e35, 0xe1e37, - 0xe1e39, 0xe1e3b, 0xe1e3d, 0xe1e3f, 0xe1e41, 0xe1e43, 0xe1e45, 0xe1e47, 0xe1e49, - 0xe1e4b, 0xe1e4d, 0xe1e4f, 0xe1e51, 0xe1e53, 0xe1e55, 0xe1e57, 0xe1e59, 0xe1e5b, - 0xe1e5d, 0xe1e5f, 0xe1e61, 0xe1e63, 0xe1e65, 0xe1e67, 0xe1e69, 0xe1e6b, 0xe1e6d, - 0xe1e6f, 0xe1e71, 0xe1e73, 0xe1e75, 0xe1e77, 0xe1e79, 0xe1e7b, 0xe1e7d, 0xe1e7f, - 0xe1e81, 0xe1e83, 0xe1e85, 0xe1e87, 0xe1e89, 0xe1e8b, 0xe1e8d, 0xe1e8f, 0xe1e91, - 0xe1e93, 0xe1e9f, 0xe1ea1, 0xe1ea3, 0xe1ea5, 0xe1ea7, 0xe1ea9, 0xe1eab, 0xe1ead, - 0xe1eaf, 0xe1eb1, 0xe1eb3, 0xe1eb5, 0xe1eb7, 0xe1eb9, 0xe1ebb, 0xe1ebd, 0xe1ebf, - 0xe1ec1, 0xe1ec3, 0xe1ec5, 0xe1ec7, 0xe1ec9, 0xe1ecb, 0xe1ecd, 0xe1ecf, 0xe1ed1, - 0xe1ed3, 0xe1ed5, 0xe1ed7, 0xe1ed9, 0xe1edb, 0xe1edd, 0xe1edf, 0xe1ee1, 0xe1ee3, - 0xe1ee5, 0xe1ee7, 0xe1ee9, 0xe1eeb, 0xe1eed, 0xe1eef, 0xe1ef1, 0xe1ef3, 0xe1ef5, - 0xe1ef7, 0xe1ef9, 0xe1efb, 0xe1efd, 0xe1fb6, 0xe1fb7, 0xe1fbe, 0xe1fc6, 0xe1fc7, - 0xe1fd6, 0xe1fd7, 0xe1ff6, 0xe1ff7, 0xe210a, 0xe210e, 0xe210f, 0xe2113, 0xe212f, - 0xe2134, 0xe2139, 0xe213c, 0xe213d, 0xe214e, 0xe2184, 0xe2c61, 0xe2c65, 0xe2c66, - 0xe2c68, 0xe2c6a, 0xe2c6c, 0xe2c71, 0xe2c73, 0xe2c74, 0xe2c81, 0xe2c83, 0xe2c85, - 0xe2c87, 0xe2c89, 0xe2c8b, 0xe2c8d, 0xe2c8f, 0xe2c91, 0xe2c93, 0xe2c95, 0xe2c97, - 0xe2c99, 0xe2c9b, 0xe2c9d, 0xe2c9f, 0xe2ca1, 0xe2ca3, 0xe2ca5, 0xe2ca7, 0xe2ca9, - 0xe2cab, 0xe2cad, 0xe2caf, 0xe2cb1, 0xe2cb3, 0xe2cb5, 0xe2cb7, 0xe2cb9, 0xe2cbb, - 0xe2cbd, 0xe2cbf, 0xe2cc1, 0xe2cc3, 0xe2cc5, 0xe2cc7, 0xe2cc9, 0xe2ccb, 0xe2ccd, - 0xe2ccf, 0xe2cd1, 0xe2cd3, 0xe2cd5, 0xe2cd7, 0xe2cd9, 0xe2cdb, 0xe2cdd, 0xe2cdf, - 0xe2ce1, 0xe2ce3, 0xe2ce4, 0xe2cec, 0xe2cee, 0xe2cf3, 0xe2d27, 0xe2d2d, 0xea641, - 0xea643, 0xea645, 0xea647, 0xea649, 0xea64b, 0xea64d, 0xea64f, 0xea651, 0xea653, - 0xea655, 0xea657, 0xea659, 0xea65b, 0xea65d, 0xea65f, 0xea661, 0xea663, 0xea665, - 0xea667, 0xea669, 0xea66b, 0xea66d, 0xea681, 0xea683, 0xea685, 0xea687, 0xea689, - 0xea68b, 0xea68d, 0xea68f, 0xea691, 0xea693, 0xea695, 0xea697, 0xea699, 0xea69b, - 0xea723, 0xea725, 0xea727, 0xea729, 0xea72b, 0xea72d, 0xea733, 0xea735, 0xea737, - 0xea739, 0xea73b, 0xea73d, 0xea73f, 0xea741, 0xea743, 0xea745, 0xea747, 0xea749, - 0xea74b, 0xea74d, 0xea74f, 0xea751, 0xea753, 0xea755, 0xea757, 0xea759, 0xea75b, - 0xea75d, 0xea75f, 0xea761, 0xea763, 0xea765, 0xea767, 0xea769, 0xea76b, 0xea76d, - 0xea76f, 0xea77a, 0xea77c, 0xea77f, 0xea781, 0xea783, 0xea785, 0xea787, 0xea78c, - 0xea78e, 0xea791, 0xea797, 0xea799, 0xea79b, 0xea79d, 0xea79f, 0xea7a1, 0xea7a3, - 0xea7a5, 0xea7a7, 0xea7a9, 0xea7b5, 0xea7b7, 0xea7fa, 0xf00b5, 0xf0101, 0xf0103, - 0xf0105, 0xf0107, 0xf0109, 0xf010b, 0xf010d, 0xf010f, 0xf0111, 0xf0113, 0xf0115, - 0xf0117, 0xf0119, 0xf011b, 0xf011d, 0xf011f, 0xf0121, 0xf0123, 0xf0125, 0xf0127, - 0xf0129, 0xf012b, 0xf012d, 0xf012f, 0xf0131, 0xf0133, 0xf0135, 0xf0137, 0xf0138, - 0xf013a, 0xf013c, 0xf013e, 0xf0140, 0xf0142, 0xf0144, 0xf0146, 0xf0148, 0xf0149, - 0xf014b, 0xf014d, 0xf014f, 0xf0151, 0xf0153, 0xf0155, 0xf0157, 0xf0159, 0xf015b, - 0xf015d, 0xf015f, 0xf0161, 0xf0163, 0xf0165, 0xf0167, 0xf0169, 0xf016b, 0xf016d, - 0xf016f, 0xf0171, 0xf0173, 0xf0175, 0xf0177, 0xf017a, 0xf017c, 0xf0183, 0xf0185, - 0xf0188, 0xf018c, 0xf018d, 0xf0192, 0xf0195, 0xf019e, 0xf01a1, 0xf01a3, 0xf01a5, - 0xf01a8, 0xf01aa, 0xf01ab, 0xf01ad, 0xf01b0, 0xf01b4, 0xf01b6, 0xf01b9, 0xf01ba, - 0xf01c6, 0xf01c9, 0xf01cc, 0xf01ce, 0xf01d0, 0xf01d2, 0xf01d4, 0xf01d6, 0xf01d8, - 0xf01da, 0xf01dc, 0xf01dd, 0xf01df, 0xf01e1, 0xf01e3, 0xf01e5, 0xf01e7, 0xf01e9, - 0xf01eb, 0xf01ed, 0xf01ef, 0xf01f0, 0xf01f3, 0xf01f5, 0xf01f9, 0xf01fb, 0xf01fd, - 0xf01ff, 0xf0201, 0xf0203, 0xf0205, 0xf0207, 0xf0209, 0xf020b, 0xf020d, 0xf020f, - 0xf0211, 0xf0213, 0xf0215, 0xf0217, 0xf0219, 0xf021b, 0xf021d, 0xf021f, 0xf0221, - 0xf0223, 0xf0225, 0xf0227, 0xf0229, 0xf022b, 0xf022d, 0xf022f, 0xf0231, 0xf023c, - 0xf023f, 0xf0240, 0xf0242, 0xf0247, 0xf0249, 0xf024b, 0xf024d, 0xf0371, 0xf0373, - 0xf0377, 0xf0390, 0xf03d0, 0xf03d1, 0xf03d9, 0xf03db, 0xf03dd, 0xf03df, 0xf03e1, - 0xf03e3, 0xf03e5, 0xf03e7, 0xf03e9, 0xf03eb, 0xf03ed, 0xf03f5, 0xf03f8, 0xf03fb, - 0xf03fc, 0xf0461, 0xf0463, 0xf0465, 0xf0467, 0xf0469, 0xf046b, 0xf046d, 0xf046f, - 0xf0471, 0xf0473, 0xf0475, 0xf0477, 0xf0479, 0xf047b, 0xf047d, 0xf047f, 0xf0481, - 0xf048b, 0xf048d, 0xf048f, 0xf0491, 0xf0493, 0xf0495, 0xf0497, 0xf0499, 0xf049b, - 0xf049d, 0xf049f, 0xf04a1, 0xf04a3, 0xf04a5, 0xf04a7, 0xf04a9, 0xf04ab, 0xf04ad, - 0xf04af, 0xf04b1, 0xf04b3, 0xf04b5, 0xf04b7, 0xf04b9, 0xf04bb, 0xf04bd, 0xf04bf, - 0xf04c2, 0xf04c4, 0xf04c6, 0xf04c8, 0xf04ca, 0xf04cc, 0xf04ce, 0xf04cf, 0xf04d1, - 0xf04d3, 0xf04d5, 0xf04d7, 0xf04d9, 0xf04db, 0xf04dd, 0xf04df, 0xf04e1, 0xf04e3, - 0xf04e5, 0xf04e7, 0xf04e9, 0xf04eb, 0xf04ed, 0xf04ef, 0xf04f1, 0xf04f3, 0xf04f5, - 0xf04f7, 0xf04f9, 0xf04fb, 0xf04fd, 0xf04ff, 0xf0501, 0xf0503, 0xf0505, 0xf0507, - 0xf0509, 0xf050b, 0xf050d, 0xf050f, 0xf0511, 0xf0513, 0xf0515, 0xf0517, 0xf0519, - 0xf051b, 0xf051d, 0xf051f, 0xf0521, 0xf0523, 0xf0525, 0xf0527, 0xf0529, 0xf052b, - 0xf052d, 0xf052f, 0xf1e01, 0xf1e03, 0xf1e05, 0xf1e07, 0xf1e09, 0xf1e0b, 0xf1e0d, - 0xf1e0f, 0xf1e11, 0xf1e13, 0xf1e15, 0xf1e17, 0xf1e19, 0xf1e1b, 0xf1e1d, 0xf1e1f, - 0xf1e21, 0xf1e23, 0xf1e25, 0xf1e27, 0xf1e29, 0xf1e2b, 0xf1e2d, 0xf1e2f, 0xf1e31, - 0xf1e33, 0xf1e35, 0xf1e37, 0xf1e39, 0xf1e3b, 0xf1e3d, 0xf1e3f, 0xf1e41, 0xf1e43, - 0xf1e45, 0xf1e47, 0xf1e49, 0xf1e4b, 0xf1e4d, 0xf1e4f, 0xf1e51, 0xf1e53, 0xf1e55, - 0xf1e57, 0xf1e59, 0xf1e5b, 0xf1e5d, 0xf1e5f, 0xf1e61, 0xf1e63, 0xf1e65, 0xf1e67, - 0xf1e69, 0xf1e6b, 0xf1e6d, 0xf1e6f, 0xf1e71, 0xf1e73, 0xf1e75, 0xf1e77, 0xf1e79, - 0xf1e7b, 0xf1e7d, 0xf1e7f, 0xf1e81, 0xf1e83, 0xf1e85, 0xf1e87, 0xf1e89, 0xf1e8b, - 0xf1e8d, 0xf1e8f, 0xf1e91, 0xf1e93, 0xf1e9f, 0xf1ea1, 0xf1ea3, 0xf1ea5, 0xf1ea7, - 0xf1ea9, 0xf1eab, 0xf1ead, 0xf1eaf, 0xf1eb1, 0xf1eb3, 0xf1eb5, 0xf1eb7, 0xf1eb9, - 0xf1ebb, 0xf1ebd, 0xf1ebf, 0xf1ec1, 0xf1ec3, 0xf1ec5, 0xf1ec7, 0xf1ec9, 0xf1ecb, - 0xf1ecd, 0xf1ecf, 0xf1ed1, 0xf1ed3, 0xf1ed5, 0xf1ed7, 0xf1ed9, 0xf1edb, 0xf1edd, - 0xf1edf, 0xf1ee1, 0xf1ee3, 0xf1ee5, 0xf1ee7, 0xf1ee9, 0xf1eeb, 0xf1eed, 0xf1eef, - 0xf1ef1, 0xf1ef3, 0xf1ef5, 0xf1ef7, 0xf1ef9, 0xf1efb, 0xf1efd, 0xf1fb6, 0xf1fb7, - 0xf1fbe, 0xf1fc6, 0xf1fc7, 0xf1fd6, 0xf1fd7, 0xf1ff6, 0xf1ff7, 0xf210a, 0xf210e, - 0xf210f, 0xf2113, 0xf212f, 0xf2134, 0xf2139, 0xf213c, 0xf213d, 0xf214e, 0xf2184, - 0xf2c61, 0xf2c65, 0xf2c66, 0xf2c68, 0xf2c6a, 0xf2c6c, 0xf2c71, 0xf2c73, 0xf2c74, - 0xf2c81, 0xf2c83, 0xf2c85, 0xf2c87, 0xf2c89, 0xf2c8b, 0xf2c8d, 0xf2c8f, 0xf2c91, - 0xf2c93, 0xf2c95, 0xf2c97, 0xf2c99, 0xf2c9b, 0xf2c9d, 0xf2c9f, 0xf2ca1, 0xf2ca3, - 0xf2ca5, 0xf2ca7, 0xf2ca9, 0xf2cab, 0xf2cad, 0xf2caf, 0xf2cb1, 0xf2cb3, 0xf2cb5, - 0xf2cb7, 0xf2cb9, 0xf2cbb, 0xf2cbd, 0xf2cbf, 0xf2cc1, 0xf2cc3, 0xf2cc5, 0xf2cc7, - 0xf2cc9, 0xf2ccb, 0xf2ccd, 0xf2ccf, 0xf2cd1, 0xf2cd3, 0xf2cd5, 0xf2cd7, 0xf2cd9, - 0xf2cdb, 0xf2cdd, 0xf2cdf, 0xf2ce1, 0xf2ce3, 0xf2ce4, 0xf2cec, 0xf2cee, 0xf2cf3, - 0xf2d27, 0xf2d2d, 0xfa641, 0xfa643, 0xfa645, 0xfa647, 0xfa649, 0xfa64b, 0xfa64d, - 0xfa64f, 0xfa651, 0xfa653, 0xfa655, 0xfa657, 0xfa659, 0xfa65b, 0xfa65d, 0xfa65f, - 0xfa661, 0xfa663, 0xfa665, 0xfa667, 0xfa669, 0xfa66b, 0xfa66d, 0xfa681, 0xfa683, - 0xfa685, 0xfa687, 0xfa689, 0xfa68b, 0xfa68d, 0xfa68f, 0xfa691, 0xfa693, 0xfa695, - 0xfa697, 0xfa699, 0xfa69b, 0xfa723, 0xfa725, 0xfa727, 0xfa729, 0xfa72b, 0xfa72d, - 0xfa733, 0xfa735, 0xfa737, 0xfa739, 0xfa73b, 0xfa73d, 0xfa73f, 0xfa741, 0xfa743, - 0xfa745, 0xfa747, 0xfa749, 0xfa74b, 0xfa74d, 0xfa74f, 0xfa751, 0xfa753, 0xfa755, - 0xfa757, 0xfa759, 0xfa75b, 0xfa75d, 0xfa75f, 0xfa761, 0xfa763, 0xfa765, 0xfa767, - 0xfa769, 0xfa76b, 0xfa76d, 0xfa76f, 0xfa77a, 0xfa77c, 0xfa77f, 0xfa781, 0xfa783, - 0xfa785, 0xfa787, 0xfa78c, 0xfa78e, 0xfa791, 0xfa797, 0xfa799, 0xfa79b, 0xfa79d, - 0xfa79f, 0xfa7a1, 0xfa7a3, 0xfa7a5, 0xfa7a7, 0xfa7a9, 0xfa7b5, 0xfa7b7, 0xfa7fa, - 0x1000b5, 0x100101, 0x100103, 0x100105, 0x100107, 0x100109, 0x10010b, 0x10010d, 0x10010f, - 0x100111, 0x100113, 0x100115, 0x100117, 0x100119, 0x10011b, 0x10011d, 0x10011f, 0x100121, - 0x100123, 0x100125, 0x100127, 0x100129, 0x10012b, 0x10012d, 0x10012f, 0x100131, 0x100133, - 0x100135, 0x100137, 0x100138, 0x10013a, 0x10013c, 0x10013e, 0x100140, 0x100142, 0x100144, - 0x100146, 0x100148, 0x100149, 0x10014b, 0x10014d, 0x10014f, 0x100151, 0x100153, 0x100155, - 0x100157, 0x100159, 0x10015b, 0x10015d, 0x10015f, 0x100161, 0x100163, 0x100165, 0x100167, - 0x100169, 0x10016b, 0x10016d, 0x10016f, 0x100171, 0x100173, 0x100175, 0x100177, 0x10017a, - 0x10017c, 0x100183, 0x100185, 0x100188, 0x10018c, 0x10018d, 0x100192, 0x100195, 0x10019e, - 0x1001a1, 0x1001a3, 0x1001a5, 0x1001a8, 0x1001aa, 0x1001ab, 0x1001ad, 0x1001b0, 0x1001b4, - 0x1001b6, 0x1001b9, 0x1001ba, 0x1001c6, 0x1001c9, 0x1001cc, 0x1001ce, 0x1001d0, 0x1001d2, - 0x1001d4, 0x1001d6, 0x1001d8, 0x1001da, 0x1001dc, 0x1001dd, 0x1001df, 0x1001e1, 0x1001e3, - 0x1001e5, 0x1001e7, 0x1001e9, 0x1001eb, 0x1001ed, 0x1001ef, 0x1001f0, 0x1001f3, 0x1001f5, - 0x1001f9, 0x1001fb, 0x1001fd, 0x1001ff, 0x100201, 0x100203, 0x100205, 0x100207, 0x100209, - 0x10020b, 0x10020d, 0x10020f, 0x100211, 0x100213, 0x100215, 0x100217, 0x100219, 0x10021b, - 0x10021d, 0x10021f, 0x100221, 0x100223, 0x100225, 0x100227, 0x100229, 0x10022b, 0x10022d, - 0x10022f, 0x100231, 0x10023c, 0x10023f, 0x100240, 0x100242, 0x100247, 0x100249, 0x10024b, - 0x10024d, 0x100371, 0x100373, 0x100377, 0x100390, 0x1003d0, 0x1003d1, 0x1003d9, 0x1003db, - 0x1003dd, 0x1003df, 0x1003e1, 0x1003e3, 0x1003e5, 0x1003e7, 0x1003e9, 0x1003eb, 0x1003ed, - 0x1003f5, 0x1003f8, 0x1003fb, 0x1003fc, 0x100461, 0x100463, 0x100465, 0x100467, 0x100469, - 0x10046b, 0x10046d, 0x10046f, 0x100471, 0x100473, 0x100475, 0x100477, 0x100479, 0x10047b, - 0x10047d, 0x10047f, 0x100481, 0x10048b, 0x10048d, 0x10048f, 0x100491, 0x100493, 0x100495, - 0x100497, 0x100499, 0x10049b, 0x10049d, 0x10049f, 0x1004a1, 0x1004a3, 0x1004a5, 0x1004a7, - 0x1004a9, 0x1004ab, 0x1004ad, 0x1004af, 0x1004b1, 0x1004b3, 0x1004b5, 0x1004b7, 0x1004b9, - 0x1004bb, 0x1004bd, 0x1004bf, 0x1004c2, 0x1004c4, 0x1004c6, 0x1004c8, 0x1004ca, 0x1004cc, - 0x1004ce, 0x1004cf, 0x1004d1, 0x1004d3, 0x1004d5, 0x1004d7, 0x1004d9, 0x1004db, 0x1004dd, - 0x1004df, 0x1004e1, 0x1004e3, 0x1004e5, 0x1004e7, 0x1004e9, 0x1004eb, 0x1004ed, 0x1004ef, - 0x1004f1, 0x1004f3, 0x1004f5, 0x1004f7, 0x1004f9, 0x1004fb, 0x1004fd, 0x1004ff, 0x100501, - 0x100503, 0x100505, 0x100507, 0x100509, 0x10050b, 0x10050d, 0x10050f, 0x100511, 0x100513, - 0x100515, 0x100517, 0x100519, 0x10051b, 0x10051d, 0x10051f, 0x100521, 0x100523, 0x100525, - 0x100527, 0x100529, 0x10052b, 0x10052d, 0x10052f, 0x101e01, 0x101e03, 0x101e05, 0x101e07, - 0x101e09, 0x101e0b, 0x101e0d, 0x101e0f, 0x101e11, 0x101e13, 0x101e15, 0x101e17, 0x101e19, - 0x101e1b, 0x101e1d, 0x101e1f, 0x101e21, 0x101e23, 0x101e25, 0x101e27, 0x101e29, 0x101e2b, - 0x101e2d, 0x101e2f, 0x101e31, 0x101e33, 0x101e35, 0x101e37, 0x101e39, 0x101e3b, 0x101e3d, - 0x101e3f, 0x101e41, 0x101e43, 0x101e45, 0x101e47, 0x101e49, 0x101e4b, 0x101e4d, 0x101e4f, - 0x101e51, 0x101e53, 0x101e55, 0x101e57, 0x101e59, 0x101e5b, 0x101e5d, 0x101e5f, 0x101e61, - 0x101e63, 0x101e65, 0x101e67, 0x101e69, 0x101e6b, 0x101e6d, 0x101e6f, 0x101e71, 0x101e73, - 0x101e75, 0x101e77, 0x101e79, 0x101e7b, 0x101e7d, 0x101e7f, 0x101e81, 0x101e83, 0x101e85, - 0x101e87, 0x101e89, 0x101e8b, 0x101e8d, 0x101e8f, 0x101e91, 0x101e93, 0x101e9f, 0x101ea1, - 0x101ea3, 0x101ea5, 0x101ea7, 0x101ea9, 0x101eab, 0x101ead, 0x101eaf, 0x101eb1, 0x101eb3, - 0x101eb5, 0x101eb7, 0x101eb9, 0x101ebb, 0x101ebd, 0x101ebf, 0x101ec1, 0x101ec3, 0x101ec5, - 0x101ec7, 0x101ec9, 0x101ecb, 0x101ecd, 0x101ecf, 0x101ed1, 0x101ed3, 0x101ed5, 0x101ed7, - 0x101ed9, 0x101edb, 0x101edd, 0x101edf, 0x101ee1, 0x101ee3, 0x101ee5, 0x101ee7, 0x101ee9, - 0x101eeb, 0x101eed, 0x101eef, 0x101ef1, 0x101ef3, 0x101ef5, 0x101ef7, 0x101ef9, 0x101efb, - 0x101efd, 0x101fb6, 0x101fb7, 0x101fbe, 0x101fc6, 0x101fc7, 0x101fd6, 0x101fd7, 0x101ff6, - 0x101ff7, 0x10210a, 0x10210e, 0x10210f, 0x102113, 0x10212f, 0x102134, 0x102139, 0x10213c, - 0x10213d, 0x10214e, 0x102184, 0x102c61, 0x102c65, 0x102c66, 0x102c68, 0x102c6a, 0x102c6c, - 0x102c71, 0x102c73, 0x102c74, 0x102c81, 0x102c83, 0x102c85, 0x102c87, 0x102c89, 0x102c8b, - 0x102c8d, 0x102c8f, 0x102c91, 0x102c93, 0x102c95, 0x102c97, 0x102c99, 0x102c9b, 0x102c9d, - 0x102c9f, 0x102ca1, 0x102ca3, 0x102ca5, 0x102ca7, 0x102ca9, 0x102cab, 0x102cad, 0x102caf, - 0x102cb1, 0x102cb3, 0x102cb5, 0x102cb7, 0x102cb9, 0x102cbb, 0x102cbd, 0x102cbf, 0x102cc1, - 0x102cc3, 0x102cc5, 0x102cc7, 0x102cc9, 0x102ccb, 0x102ccd, 0x102ccf, 0x102cd1, 0x102cd3, - 0x102cd5, 0x102cd7, 0x102cd9, 0x102cdb, 0x102cdd, 0x102cdf, 0x102ce1, 0x102ce3, 0x102ce4, - 0x102cec, 0x102cee, 0x102cf3, 0x102d27, 0x102d2d, 0x10a641, 0x10a643, 0x10a645, 0x10a647, - 0x10a649, 0x10a64b, 0x10a64d, 0x10a64f, 0x10a651, 0x10a653, 0x10a655, 0x10a657, 0x10a659, - 0x10a65b, 0x10a65d, 0x10a65f, 0x10a661, 0x10a663, 0x10a665, 0x10a667, 0x10a669, 0x10a66b, - 0x10a66d, 0x10a681, 0x10a683, 0x10a685, 0x10a687, 0x10a689, 0x10a68b, 0x10a68d, 0x10a68f, - 0x10a691, 0x10a693, 0x10a695, 0x10a697, 0x10a699, 0x10a69b, 0x10a723, 0x10a725, 0x10a727, - 0x10a729, 0x10a72b, 0x10a72d, 0x10a733, 0x10a735, 0x10a737, 0x10a739, 0x10a73b, 0x10a73d, - 0x10a73f, 0x10a741, 0x10a743, 0x10a745, 0x10a747, 0x10a749, 0x10a74b, 0x10a74d, 0x10a74f, - 0x10a751, 0x10a753, 0x10a755, 0x10a757, 0x10a759, 0x10a75b, 0x10a75d, 0x10a75f, 0x10a761, - 0x10a763, 0x10a765, 0x10a767, 0x10a769, 0x10a76b, 0x10a76d, 0x10a76f, 0x10a77a, 0x10a77c, - 0x10a77f, 0x10a781, 0x10a783, 0x10a785, 0x10a787, 0x10a78c, 0x10a78e, 0x10a791, 0x10a797, - 0x10a799, 0x10a79b, 0x10a79d, 0x10a79f, 0x10a7a1, 0x10a7a3, 0x10a7a5, 0x10a7a7, 0x10a7a9, - 0x10a7b5, 0x10a7b7, 0x10a7fa + ,0x1d4bb, 0x1d7cb #endif }; @@ -3626,166 +525,13 @@ static const crange upperRangeTable[] = { {0x2130, 0x2133}, {0x2c00, 0x2c2e}, {0x2c62, 0x2c64}, {0x2c6d, 0x2c70}, {0x2c7e, 0x2c80}, {0xa7aa, 0xa7ae}, {0xa7b0, 0xa7b4}, {0xff21, 0xff3a} #if TCL_UTF_MAX > 4 - ,{0x10041, 0x1005a}, {0x100c0, 0x100d6}, {0x100d8, 0x100de}, {0x10189, 0x1018b}, - {0x1018e, 0x10191}, {0x10196, 0x10198}, {0x101b1, 0x101b3}, {0x101f6, 0x101f8}, - {0x10243, 0x10246}, {0x10388, 0x1038a}, {0x10391, 0x103a1}, {0x103a3, 0x103ab}, - {0x103d2, 0x103d4}, {0x103fd, 0x1042f}, {0x10531, 0x10556}, {0x110a0, 0x110c5}, - {0x113a0, 0x113f5}, {0x11f08, 0x11f0f}, {0x11f18, 0x11f1d}, {0x11f28, 0x11f2f}, - {0x11f38, 0x11f3f}, {0x11f48, 0x11f4d}, {0x11f68, 0x11f6f}, {0x11fb8, 0x11fbb}, - {0x11fc8, 0x11fcb}, {0x11fd8, 0x11fdb}, {0x11fe8, 0x11fec}, {0x11ff8, 0x11ffb}, - {0x1210b, 0x1210d}, {0x12110, 0x12112}, {0x12119, 0x1211d}, {0x1212a, 0x1212d}, - {0x12130, 0x12133}, {0x12c00, 0x12c2e}, {0x12c62, 0x12c64}, {0x12c6d, 0x12c70}, - {0x12c7e, 0x12c80}, {0x1a7aa, 0x1a7ae}, {0x1a7b0, 0x1a7b4}, {0x1ff21, 0x1ff3a}, - {0x20041, 0x2005a}, {0x200c0, 0x200d6}, {0x200d8, 0x200de}, {0x20189, 0x2018b}, - {0x2018e, 0x20191}, {0x20196, 0x20198}, {0x201b1, 0x201b3}, {0x201f6, 0x201f8}, - {0x20243, 0x20246}, {0x20388, 0x2038a}, {0x20391, 0x203a1}, {0x203a3, 0x203ab}, - {0x203d2, 0x203d4}, {0x203fd, 0x2042f}, {0x20531, 0x20556}, {0x210a0, 0x210c5}, - {0x213a0, 0x213f5}, {0x21f08, 0x21f0f}, {0x21f18, 0x21f1d}, {0x21f28, 0x21f2f}, - {0x21f38, 0x21f3f}, {0x21f48, 0x21f4d}, {0x21f68, 0x21f6f}, {0x21fb8, 0x21fbb}, - {0x21fc8, 0x21fcb}, {0x21fd8, 0x21fdb}, {0x21fe8, 0x21fec}, {0x21ff8, 0x21ffb}, - {0x2210b, 0x2210d}, {0x22110, 0x22112}, {0x22119, 0x2211d}, {0x2212a, 0x2212d}, - {0x22130, 0x22133}, {0x22c00, 0x22c2e}, {0x22c62, 0x22c64}, {0x22c6d, 0x22c70}, - {0x22c7e, 0x22c80}, {0x2a7aa, 0x2a7ae}, {0x2a7b0, 0x2a7b4}, {0x2ff21, 0x2ff3a}, - {0x30041, 0x3005a}, {0x300c0, 0x300d6}, {0x300d8, 0x300de}, {0x30189, 0x3018b}, - {0x3018e, 0x30191}, {0x30196, 0x30198}, {0x301b1, 0x301b3}, {0x301f6, 0x301f8}, - {0x30243, 0x30246}, {0x30388, 0x3038a}, {0x30391, 0x303a1}, {0x303a3, 0x303ab}, - {0x303d2, 0x303d4}, {0x303fd, 0x3042f}, {0x30531, 0x30556}, {0x310a0, 0x310c5}, - {0x313a0, 0x313f5}, {0x31f08, 0x31f0f}, {0x31f18, 0x31f1d}, {0x31f28, 0x31f2f}, - {0x31f38, 0x31f3f}, {0x31f48, 0x31f4d}, {0x31f68, 0x31f6f}, {0x31fb8, 0x31fbb}, - {0x31fc8, 0x31fcb}, {0x31fd8, 0x31fdb}, {0x31fe8, 0x31fec}, {0x31ff8, 0x31ffb}, - {0x3210b, 0x3210d}, {0x32110, 0x32112}, {0x32119, 0x3211d}, {0x3212a, 0x3212d}, - {0x32130, 0x32133}, {0x32c00, 0x32c2e}, {0x32c62, 0x32c64}, {0x32c6d, 0x32c70}, - {0x32c7e, 0x32c80}, {0x3a7aa, 0x3a7ae}, {0x3a7b0, 0x3a7b4}, {0x3ff21, 0x3ff3a}, - {0x40041, 0x4005a}, {0x400c0, 0x400d6}, {0x400d8, 0x400de}, {0x40189, 0x4018b}, - {0x4018e, 0x40191}, {0x40196, 0x40198}, {0x401b1, 0x401b3}, {0x401f6, 0x401f8}, - {0x40243, 0x40246}, {0x40388, 0x4038a}, {0x40391, 0x403a1}, {0x403a3, 0x403ab}, - {0x403d2, 0x403d4}, {0x403fd, 0x4042f}, {0x40531, 0x40556}, {0x410a0, 0x410c5}, - {0x413a0, 0x413f5}, {0x41f08, 0x41f0f}, {0x41f18, 0x41f1d}, {0x41f28, 0x41f2f}, - {0x41f38, 0x41f3f}, {0x41f48, 0x41f4d}, {0x41f68, 0x41f6f}, {0x41fb8, 0x41fbb}, - {0x41fc8, 0x41fcb}, {0x41fd8, 0x41fdb}, {0x41fe8, 0x41fec}, {0x41ff8, 0x41ffb}, - {0x4210b, 0x4210d}, {0x42110, 0x42112}, {0x42119, 0x4211d}, {0x4212a, 0x4212d}, - {0x42130, 0x42133}, {0x42c00, 0x42c2e}, {0x42c62, 0x42c64}, {0x42c6d, 0x42c70}, - {0x42c7e, 0x42c80}, {0x4a7aa, 0x4a7ae}, {0x4a7b0, 0x4a7b4}, {0x4ff21, 0x4ff3a}, - {0x50041, 0x5005a}, {0x500c0, 0x500d6}, {0x500d8, 0x500de}, {0x50189, 0x5018b}, - {0x5018e, 0x50191}, {0x50196, 0x50198}, {0x501b1, 0x501b3}, {0x501f6, 0x501f8}, - {0x50243, 0x50246}, {0x50388, 0x5038a}, {0x50391, 0x503a1}, {0x503a3, 0x503ab}, - {0x503d2, 0x503d4}, {0x503fd, 0x5042f}, {0x50531, 0x50556}, {0x510a0, 0x510c5}, - {0x513a0, 0x513f5}, {0x51f08, 0x51f0f}, {0x51f18, 0x51f1d}, {0x51f28, 0x51f2f}, - {0x51f38, 0x51f3f}, {0x51f48, 0x51f4d}, {0x51f68, 0x51f6f}, {0x51fb8, 0x51fbb}, - {0x51fc8, 0x51fcb}, {0x51fd8, 0x51fdb}, {0x51fe8, 0x51fec}, {0x51ff8, 0x51ffb}, - {0x5210b, 0x5210d}, {0x52110, 0x52112}, {0x52119, 0x5211d}, {0x5212a, 0x5212d}, - {0x52130, 0x52133}, {0x52c00, 0x52c2e}, {0x52c62, 0x52c64}, {0x52c6d, 0x52c70}, - {0x52c7e, 0x52c80}, {0x5a7aa, 0x5a7ae}, {0x5a7b0, 0x5a7b4}, {0x5ff21, 0x5ff3a}, - {0x60041, 0x6005a}, {0x600c0, 0x600d6}, {0x600d8, 0x600de}, {0x60189, 0x6018b}, - {0x6018e, 0x60191}, {0x60196, 0x60198}, {0x601b1, 0x601b3}, {0x601f6, 0x601f8}, - {0x60243, 0x60246}, {0x60388, 0x6038a}, {0x60391, 0x603a1}, {0x603a3, 0x603ab}, - {0x603d2, 0x603d4}, {0x603fd, 0x6042f}, {0x60531, 0x60556}, {0x610a0, 0x610c5}, - {0x613a0, 0x613f5}, {0x61f08, 0x61f0f}, {0x61f18, 0x61f1d}, {0x61f28, 0x61f2f}, - {0x61f38, 0x61f3f}, {0x61f48, 0x61f4d}, {0x61f68, 0x61f6f}, {0x61fb8, 0x61fbb}, - {0x61fc8, 0x61fcb}, {0x61fd8, 0x61fdb}, {0x61fe8, 0x61fec}, {0x61ff8, 0x61ffb}, - {0x6210b, 0x6210d}, {0x62110, 0x62112}, {0x62119, 0x6211d}, {0x6212a, 0x6212d}, - {0x62130, 0x62133}, {0x62c00, 0x62c2e}, {0x62c62, 0x62c64}, {0x62c6d, 0x62c70}, - {0x62c7e, 0x62c80}, {0x6a7aa, 0x6a7ae}, {0x6a7b0, 0x6a7b4}, {0x6ff21, 0x6ff3a}, - {0x70041, 0x7005a}, {0x700c0, 0x700d6}, {0x700d8, 0x700de}, {0x70189, 0x7018b}, - {0x7018e, 0x70191}, {0x70196, 0x70198}, {0x701b1, 0x701b3}, {0x701f6, 0x701f8}, - {0x70243, 0x70246}, {0x70388, 0x7038a}, {0x70391, 0x703a1}, {0x703a3, 0x703ab}, - {0x703d2, 0x703d4}, {0x703fd, 0x7042f}, {0x70531, 0x70556}, {0x710a0, 0x710c5}, - {0x713a0, 0x713f5}, {0x71f08, 0x71f0f}, {0x71f18, 0x71f1d}, {0x71f28, 0x71f2f}, - {0x71f38, 0x71f3f}, {0x71f48, 0x71f4d}, {0x71f68, 0x71f6f}, {0x71fb8, 0x71fbb}, - {0x71fc8, 0x71fcb}, {0x71fd8, 0x71fdb}, {0x71fe8, 0x71fec}, {0x71ff8, 0x71ffb}, - {0x7210b, 0x7210d}, {0x72110, 0x72112}, {0x72119, 0x7211d}, {0x7212a, 0x7212d}, - {0x72130, 0x72133}, {0x72c00, 0x72c2e}, {0x72c62, 0x72c64}, {0x72c6d, 0x72c70}, - {0x72c7e, 0x72c80}, {0x7a7aa, 0x7a7ae}, {0x7a7b0, 0x7a7b4}, {0x7ff21, 0x7ff3a}, - {0x80041, 0x8005a}, {0x800c0, 0x800d6}, {0x800d8, 0x800de}, {0x80189, 0x8018b}, - {0x8018e, 0x80191}, {0x80196, 0x80198}, {0x801b1, 0x801b3}, {0x801f6, 0x801f8}, - {0x80243, 0x80246}, {0x80388, 0x8038a}, {0x80391, 0x803a1}, {0x803a3, 0x803ab}, - {0x803d2, 0x803d4}, {0x803fd, 0x8042f}, {0x80531, 0x80556}, {0x810a0, 0x810c5}, - {0x813a0, 0x813f5}, {0x81f08, 0x81f0f}, {0x81f18, 0x81f1d}, {0x81f28, 0x81f2f}, - {0x81f38, 0x81f3f}, {0x81f48, 0x81f4d}, {0x81f68, 0x81f6f}, {0x81fb8, 0x81fbb}, - {0x81fc8, 0x81fcb}, {0x81fd8, 0x81fdb}, {0x81fe8, 0x81fec}, {0x81ff8, 0x81ffb}, - {0x8210b, 0x8210d}, {0x82110, 0x82112}, {0x82119, 0x8211d}, {0x8212a, 0x8212d}, - {0x82130, 0x82133}, {0x82c00, 0x82c2e}, {0x82c62, 0x82c64}, {0x82c6d, 0x82c70}, - {0x82c7e, 0x82c80}, {0x8a7aa, 0x8a7ae}, {0x8a7b0, 0x8a7b4}, {0x8ff21, 0x8ff3a}, - {0x90041, 0x9005a}, {0x900c0, 0x900d6}, {0x900d8, 0x900de}, {0x90189, 0x9018b}, - {0x9018e, 0x90191}, {0x90196, 0x90198}, {0x901b1, 0x901b3}, {0x901f6, 0x901f8}, - {0x90243, 0x90246}, {0x90388, 0x9038a}, {0x90391, 0x903a1}, {0x903a3, 0x903ab}, - {0x903d2, 0x903d4}, {0x903fd, 0x9042f}, {0x90531, 0x90556}, {0x910a0, 0x910c5}, - {0x913a0, 0x913f5}, {0x91f08, 0x91f0f}, {0x91f18, 0x91f1d}, {0x91f28, 0x91f2f}, - {0x91f38, 0x91f3f}, {0x91f48, 0x91f4d}, {0x91f68, 0x91f6f}, {0x91fb8, 0x91fbb}, - {0x91fc8, 0x91fcb}, {0x91fd8, 0x91fdb}, {0x91fe8, 0x91fec}, {0x91ff8, 0x91ffb}, - {0x9210b, 0x9210d}, {0x92110, 0x92112}, {0x92119, 0x9211d}, {0x9212a, 0x9212d}, - {0x92130, 0x92133}, {0x92c00, 0x92c2e}, {0x92c62, 0x92c64}, {0x92c6d, 0x92c70}, - {0x92c7e, 0x92c80}, {0x9a7aa, 0x9a7ae}, {0x9a7b0, 0x9a7b4}, {0x9ff21, 0x9ff3a}, - {0xa0041, 0xa005a}, {0xa00c0, 0xa00d6}, {0xa00d8, 0xa00de}, {0xa0189, 0xa018b}, - {0xa018e, 0xa0191}, {0xa0196, 0xa0198}, {0xa01b1, 0xa01b3}, {0xa01f6, 0xa01f8}, - {0xa0243, 0xa0246}, {0xa0388, 0xa038a}, {0xa0391, 0xa03a1}, {0xa03a3, 0xa03ab}, - {0xa03d2, 0xa03d4}, {0xa03fd, 0xa042f}, {0xa0531, 0xa0556}, {0xa10a0, 0xa10c5}, - {0xa13a0, 0xa13f5}, {0xa1f08, 0xa1f0f}, {0xa1f18, 0xa1f1d}, {0xa1f28, 0xa1f2f}, - {0xa1f38, 0xa1f3f}, {0xa1f48, 0xa1f4d}, {0xa1f68, 0xa1f6f}, {0xa1fb8, 0xa1fbb}, - {0xa1fc8, 0xa1fcb}, {0xa1fd8, 0xa1fdb}, {0xa1fe8, 0xa1fec}, {0xa1ff8, 0xa1ffb}, - {0xa210b, 0xa210d}, {0xa2110, 0xa2112}, {0xa2119, 0xa211d}, {0xa212a, 0xa212d}, - {0xa2130, 0xa2133}, {0xa2c00, 0xa2c2e}, {0xa2c62, 0xa2c64}, {0xa2c6d, 0xa2c70}, - {0xa2c7e, 0xa2c80}, {0xaa7aa, 0xaa7ae}, {0xaa7b0, 0xaa7b4}, {0xaff21, 0xaff3a}, - {0xb0041, 0xb005a}, {0xb00c0, 0xb00d6}, {0xb00d8, 0xb00de}, {0xb0189, 0xb018b}, - {0xb018e, 0xb0191}, {0xb0196, 0xb0198}, {0xb01b1, 0xb01b3}, {0xb01f6, 0xb01f8}, - {0xb0243, 0xb0246}, {0xb0388, 0xb038a}, {0xb0391, 0xb03a1}, {0xb03a3, 0xb03ab}, - {0xb03d2, 0xb03d4}, {0xb03fd, 0xb042f}, {0xb0531, 0xb0556}, {0xb10a0, 0xb10c5}, - {0xb13a0, 0xb13f5}, {0xb1f08, 0xb1f0f}, {0xb1f18, 0xb1f1d}, {0xb1f28, 0xb1f2f}, - {0xb1f38, 0xb1f3f}, {0xb1f48, 0xb1f4d}, {0xb1f68, 0xb1f6f}, {0xb1fb8, 0xb1fbb}, - {0xb1fc8, 0xb1fcb}, {0xb1fd8, 0xb1fdb}, {0xb1fe8, 0xb1fec}, {0xb1ff8, 0xb1ffb}, - {0xb210b, 0xb210d}, {0xb2110, 0xb2112}, {0xb2119, 0xb211d}, {0xb212a, 0xb212d}, - {0xb2130, 0xb2133}, {0xb2c00, 0xb2c2e}, {0xb2c62, 0xb2c64}, {0xb2c6d, 0xb2c70}, - {0xb2c7e, 0xb2c80}, {0xba7aa, 0xba7ae}, {0xba7b0, 0xba7b4}, {0xbff21, 0xbff3a}, - {0xc0041, 0xc005a}, {0xc00c0, 0xc00d6}, {0xc00d8, 0xc00de}, {0xc0189, 0xc018b}, - {0xc018e, 0xc0191}, {0xc0196, 0xc0198}, {0xc01b1, 0xc01b3}, {0xc01f6, 0xc01f8}, - {0xc0243, 0xc0246}, {0xc0388, 0xc038a}, {0xc0391, 0xc03a1}, {0xc03a3, 0xc03ab}, - {0xc03d2, 0xc03d4}, {0xc03fd, 0xc042f}, {0xc0531, 0xc0556}, {0xc10a0, 0xc10c5}, - {0xc13a0, 0xc13f5}, {0xc1f08, 0xc1f0f}, {0xc1f18, 0xc1f1d}, {0xc1f28, 0xc1f2f}, - {0xc1f38, 0xc1f3f}, {0xc1f48, 0xc1f4d}, {0xc1f68, 0xc1f6f}, {0xc1fb8, 0xc1fbb}, - {0xc1fc8, 0xc1fcb}, {0xc1fd8, 0xc1fdb}, {0xc1fe8, 0xc1fec}, {0xc1ff8, 0xc1ffb}, - {0xc210b, 0xc210d}, {0xc2110, 0xc2112}, {0xc2119, 0xc211d}, {0xc212a, 0xc212d}, - {0xc2130, 0xc2133}, {0xc2c00, 0xc2c2e}, {0xc2c62, 0xc2c64}, {0xc2c6d, 0xc2c70}, - {0xc2c7e, 0xc2c80}, {0xca7aa, 0xca7ae}, {0xca7b0, 0xca7b4}, {0xcff21, 0xcff3a}, - {0xd0041, 0xd005a}, {0xd00c0, 0xd00d6}, {0xd00d8, 0xd00de}, {0xd0189, 0xd018b}, - {0xd018e, 0xd0191}, {0xd0196, 0xd0198}, {0xd01b1, 0xd01b3}, {0xd01f6, 0xd01f8}, - {0xd0243, 0xd0246}, {0xd0388, 0xd038a}, {0xd0391, 0xd03a1}, {0xd03a3, 0xd03ab}, - {0xd03d2, 0xd03d4}, {0xd03fd, 0xd042f}, {0xd0531, 0xd0556}, {0xd10a0, 0xd10c5}, - {0xd13a0, 0xd13f5}, {0xd1f08, 0xd1f0f}, {0xd1f18, 0xd1f1d}, {0xd1f28, 0xd1f2f}, - {0xd1f38, 0xd1f3f}, {0xd1f48, 0xd1f4d}, {0xd1f68, 0xd1f6f}, {0xd1fb8, 0xd1fbb}, - {0xd1fc8, 0xd1fcb}, {0xd1fd8, 0xd1fdb}, {0xd1fe8, 0xd1fec}, {0xd1ff8, 0xd1ffb}, - {0xd210b, 0xd210d}, {0xd2110, 0xd2112}, {0xd2119, 0xd211d}, {0xd212a, 0xd212d}, - {0xd2130, 0xd2133}, {0xd2c00, 0xd2c2e}, {0xd2c62, 0xd2c64}, {0xd2c6d, 0xd2c70}, - {0xd2c7e, 0xd2c80}, {0xda7aa, 0xda7ae}, {0xda7b0, 0xda7b4}, {0xdff21, 0xdff3a}, - {0xe0041, 0xe005a}, {0xe00c0, 0xe00d6}, {0xe00d8, 0xe00de}, {0xe0189, 0xe018b}, - {0xe018e, 0xe0191}, {0xe0196, 0xe0198}, {0xe01b1, 0xe01b3}, {0xe01f6, 0xe01f8}, - {0xe0243, 0xe0246}, {0xe0388, 0xe038a}, {0xe0391, 0xe03a1}, {0xe03a3, 0xe03ab}, - {0xe03d2, 0xe03d4}, {0xe03fd, 0xe042f}, {0xe0531, 0xe0556}, {0xe10a0, 0xe10c5}, - {0xe13a0, 0xe13f5}, {0xe1f08, 0xe1f0f}, {0xe1f18, 0xe1f1d}, {0xe1f28, 0xe1f2f}, - {0xe1f38, 0xe1f3f}, {0xe1f48, 0xe1f4d}, {0xe1f68, 0xe1f6f}, {0xe1fb8, 0xe1fbb}, - {0xe1fc8, 0xe1fcb}, {0xe1fd8, 0xe1fdb}, {0xe1fe8, 0xe1fec}, {0xe1ff8, 0xe1ffb}, - {0xe210b, 0xe210d}, {0xe2110, 0xe2112}, {0xe2119, 0xe211d}, {0xe212a, 0xe212d}, - {0xe2130, 0xe2133}, {0xe2c00, 0xe2c2e}, {0xe2c62, 0xe2c64}, {0xe2c6d, 0xe2c70}, - {0xe2c7e, 0xe2c80}, {0xea7aa, 0xea7ae}, {0xea7b0, 0xea7b4}, {0xeff21, 0xeff3a}, - {0xf0041, 0xf005a}, {0xf00c0, 0xf00d6}, {0xf00d8, 0xf00de}, {0xf0189, 0xf018b}, - {0xf018e, 0xf0191}, {0xf0196, 0xf0198}, {0xf01b1, 0xf01b3}, {0xf01f6, 0xf01f8}, - {0xf0243, 0xf0246}, {0xf0388, 0xf038a}, {0xf0391, 0xf03a1}, {0xf03a3, 0xf03ab}, - {0xf03d2, 0xf03d4}, {0xf03fd, 0xf042f}, {0xf0531, 0xf0556}, {0xf10a0, 0xf10c5}, - {0xf13a0, 0xf13f5}, {0xf1f08, 0xf1f0f}, {0xf1f18, 0xf1f1d}, {0xf1f28, 0xf1f2f}, - {0xf1f38, 0xf1f3f}, {0xf1f48, 0xf1f4d}, {0xf1f68, 0xf1f6f}, {0xf1fb8, 0xf1fbb}, - {0xf1fc8, 0xf1fcb}, {0xf1fd8, 0xf1fdb}, {0xf1fe8, 0xf1fec}, {0xf1ff8, 0xf1ffb}, - {0xf210b, 0xf210d}, {0xf2110, 0xf2112}, {0xf2119, 0xf211d}, {0xf212a, 0xf212d}, - {0xf2130, 0xf2133}, {0xf2c00, 0xf2c2e}, {0xf2c62, 0xf2c64}, {0xf2c6d, 0xf2c70}, - {0xf2c7e, 0xf2c80}, {0xfa7aa, 0xfa7ae}, {0xfa7b0, 0xfa7b4}, {0xfff21, 0xfff3a}, - {0x100041, 0x10005a}, {0x1000c0, 0x1000d6}, {0x1000d8, 0x1000de}, {0x100189, 0x10018b}, - {0x10018e, 0x100191}, {0x100196, 0x100198}, {0x1001b1, 0x1001b3}, {0x1001f6, 0x1001f8}, - {0x100243, 0x100246}, {0x100388, 0x10038a}, {0x100391, 0x1003a1}, {0x1003a3, 0x1003ab}, - {0x1003d2, 0x1003d4}, {0x1003fd, 0x10042f}, {0x100531, 0x100556}, {0x1010a0, 0x1010c5}, - {0x1013a0, 0x1013f5}, {0x101f08, 0x101f0f}, {0x101f18, 0x101f1d}, {0x101f28, 0x101f2f}, - {0x101f38, 0x101f3f}, {0x101f48, 0x101f4d}, {0x101f68, 0x101f6f}, {0x101fb8, 0x101fbb}, - {0x101fc8, 0x101fcb}, {0x101fd8, 0x101fdb}, {0x101fe8, 0x101fec}, {0x101ff8, 0x101ffb}, - {0x10210b, 0x10210d}, {0x102110, 0x102112}, {0x102119, 0x10211d}, {0x10212a, 0x10212d}, - {0x102130, 0x102133}, {0x102c00, 0x102c2e}, {0x102c62, 0x102c64}, {0x102c6d, 0x102c70}, - {0x102c7e, 0x102c80}, {0x10a7aa, 0x10a7ae}, {0x10a7b0, 0x10a7b4}, {0x10ff21, 0x10ff3a} + ,{0x10400, 0x10427}, {0x104b0, 0x104d3}, {0x10c80, 0x10cb2}, {0x118a0, 0x118bf}, + {0x1d400, 0x1d419}, {0x1d434, 0x1d44d}, {0x1d468, 0x1d481}, {0x1d4a9, 0x1d4ac}, + {0x1d4ae, 0x1d4b5}, {0x1d4d0, 0x1d4e9}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, + {0x1d516, 0x1d51c}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, + {0x1d56c, 0x1d585}, {0x1d5a0, 0x1d5b9}, {0x1d5d4, 0x1d5ed}, {0x1d608, 0x1d621}, + {0x1d63c, 0x1d655}, {0x1d670, 0x1d689}, {0x1d6a8, 0x1d6c0}, {0x1d6e2, 0x1d6fa}, + {0x1d71c, 0x1d734}, {0x1d756, 0x1d76e}, {0x1d790, 0x1d7a8}, {0x1e900, 0x1e921} #endif }; @@ -3856,1014 +602,8 @@ static const chr upperCharTable[] = { 0xa782, 0xa784, 0xa786, 0xa78b, 0xa78d, 0xa790, 0xa792, 0xa796, 0xa798, 0xa79a, 0xa79c, 0xa79e, 0xa7a0, 0xa7a2, 0xa7a4, 0xa7a6, 0xa7a8, 0xa7b6 #if TCL_UTF_MAX > 4 - ,0x10100, 0x10102, 0x10104, 0x10106, 0x10108, 0x1010a, 0x1010c, 0x1010e, 0x10110, - 0x10112, 0x10114, 0x10116, 0x10118, 0x1011a, 0x1011c, 0x1011e, 0x10120, 0x10122, - 0x10124, 0x10126, 0x10128, 0x1012a, 0x1012c, 0x1012e, 0x10130, 0x10132, 0x10134, - 0x10136, 0x10139, 0x1013b, 0x1013d, 0x1013f, 0x10141, 0x10143, 0x10145, 0x10147, - 0x1014a, 0x1014c, 0x1014e, 0x10150, 0x10152, 0x10154, 0x10156, 0x10158, 0x1015a, - 0x1015c, 0x1015e, 0x10160, 0x10162, 0x10164, 0x10166, 0x10168, 0x1016a, 0x1016c, - 0x1016e, 0x10170, 0x10172, 0x10174, 0x10176, 0x10178, 0x10179, 0x1017b, 0x1017d, - 0x10181, 0x10182, 0x10184, 0x10186, 0x10187, 0x10193, 0x10194, 0x1019c, 0x1019d, - 0x1019f, 0x101a0, 0x101a2, 0x101a4, 0x101a6, 0x101a7, 0x101a9, 0x101ac, 0x101ae, - 0x101af, 0x101b5, 0x101b7, 0x101b8, 0x101bc, 0x101c4, 0x101c7, 0x101ca, 0x101cd, - 0x101cf, 0x101d1, 0x101d3, 0x101d5, 0x101d7, 0x101d9, 0x101db, 0x101de, 0x101e0, - 0x101e2, 0x101e4, 0x101e6, 0x101e8, 0x101ea, 0x101ec, 0x101ee, 0x101f1, 0x101f4, - 0x101fa, 0x101fc, 0x101fe, 0x10200, 0x10202, 0x10204, 0x10206, 0x10208, 0x1020a, - 0x1020c, 0x1020e, 0x10210, 0x10212, 0x10214, 0x10216, 0x10218, 0x1021a, 0x1021c, - 0x1021e, 0x10220, 0x10222, 0x10224, 0x10226, 0x10228, 0x1022a, 0x1022c, 0x1022e, - 0x10230, 0x10232, 0x1023a, 0x1023b, 0x1023d, 0x1023e, 0x10241, 0x10248, 0x1024a, - 0x1024c, 0x1024e, 0x10370, 0x10372, 0x10376, 0x1037f, 0x10386, 0x1038c, 0x1038e, - 0x1038f, 0x103cf, 0x103d8, 0x103da, 0x103dc, 0x103de, 0x103e0, 0x103e2, 0x103e4, - 0x103e6, 0x103e8, 0x103ea, 0x103ec, 0x103ee, 0x103f4, 0x103f7, 0x103f9, 0x103fa, - 0x10460, 0x10462, 0x10464, 0x10466, 0x10468, 0x1046a, 0x1046c, 0x1046e, 0x10470, - 0x10472, 0x10474, 0x10476, 0x10478, 0x1047a, 0x1047c, 0x1047e, 0x10480, 0x1048a, - 0x1048c, 0x1048e, 0x10490, 0x10492, 0x10494, 0x10496, 0x10498, 0x1049a, 0x1049c, - 0x1049e, 0x104a0, 0x104a2, 0x104a4, 0x104a6, 0x104a8, 0x104aa, 0x104ac, 0x104ae, - 0x104b0, 0x104b2, 0x104b4, 0x104b6, 0x104b8, 0x104ba, 0x104bc, 0x104be, 0x104c0, - 0x104c1, 0x104c3, 0x104c5, 0x104c7, 0x104c9, 0x104cb, 0x104cd, 0x104d0, 0x104d2, - 0x104d4, 0x104d6, 0x104d8, 0x104da, 0x104dc, 0x104de, 0x104e0, 0x104e2, 0x104e4, - 0x104e6, 0x104e8, 0x104ea, 0x104ec, 0x104ee, 0x104f0, 0x104f2, 0x104f4, 0x104f6, - 0x104f8, 0x104fa, 0x104fc, 0x104fe, 0x10500, 0x10502, 0x10504, 0x10506, 0x10508, - 0x1050a, 0x1050c, 0x1050e, 0x10510, 0x10512, 0x10514, 0x10516, 0x10518, 0x1051a, - 0x1051c, 0x1051e, 0x10520, 0x10522, 0x10524, 0x10526, 0x10528, 0x1052a, 0x1052c, - 0x1052e, 0x110c7, 0x110cd, 0x11e00, 0x11e02, 0x11e04, 0x11e06, 0x11e08, 0x11e0a, - 0x11e0c, 0x11e0e, 0x11e10, 0x11e12, 0x11e14, 0x11e16, 0x11e18, 0x11e1a, 0x11e1c, - 0x11e1e, 0x11e20, 0x11e22, 0x11e24, 0x11e26, 0x11e28, 0x11e2a, 0x11e2c, 0x11e2e, - 0x11e30, 0x11e32, 0x11e34, 0x11e36, 0x11e38, 0x11e3a, 0x11e3c, 0x11e3e, 0x11e40, - 0x11e42, 0x11e44, 0x11e46, 0x11e48, 0x11e4a, 0x11e4c, 0x11e4e, 0x11e50, 0x11e52, - 0x11e54, 0x11e56, 0x11e58, 0x11e5a, 0x11e5c, 0x11e5e, 0x11e60, 0x11e62, 0x11e64, - 0x11e66, 0x11e68, 0x11e6a, 0x11e6c, 0x11e6e, 0x11e70, 0x11e72, 0x11e74, 0x11e76, - 0x11e78, 0x11e7a, 0x11e7c, 0x11e7e, 0x11e80, 0x11e82, 0x11e84, 0x11e86, 0x11e88, - 0x11e8a, 0x11e8c, 0x11e8e, 0x11e90, 0x11e92, 0x11e94, 0x11e9e, 0x11ea0, 0x11ea2, - 0x11ea4, 0x11ea6, 0x11ea8, 0x11eaa, 0x11eac, 0x11eae, 0x11eb0, 0x11eb2, 0x11eb4, - 0x11eb6, 0x11eb8, 0x11eba, 0x11ebc, 0x11ebe, 0x11ec0, 0x11ec2, 0x11ec4, 0x11ec6, - 0x11ec8, 0x11eca, 0x11ecc, 0x11ece, 0x11ed0, 0x11ed2, 0x11ed4, 0x11ed6, 0x11ed8, - 0x11eda, 0x11edc, 0x11ede, 0x11ee0, 0x11ee2, 0x11ee4, 0x11ee6, 0x11ee8, 0x11eea, - 0x11eec, 0x11eee, 0x11ef0, 0x11ef2, 0x11ef4, 0x11ef6, 0x11ef8, 0x11efa, 0x11efc, - 0x11efe, 0x11f59, 0x11f5b, 0x11f5d, 0x11f5f, 0x12102, 0x12107, 0x12115, 0x12124, - 0x12126, 0x12128, 0x1213e, 0x1213f, 0x12145, 0x12183, 0x12c60, 0x12c67, 0x12c69, - 0x12c6b, 0x12c72, 0x12c75, 0x12c82, 0x12c84, 0x12c86, 0x12c88, 0x12c8a, 0x12c8c, - 0x12c8e, 0x12c90, 0x12c92, 0x12c94, 0x12c96, 0x12c98, 0x12c9a, 0x12c9c, 0x12c9e, - 0x12ca0, 0x12ca2, 0x12ca4, 0x12ca6, 0x12ca8, 0x12caa, 0x12cac, 0x12cae, 0x12cb0, - 0x12cb2, 0x12cb4, 0x12cb6, 0x12cb8, 0x12cba, 0x12cbc, 0x12cbe, 0x12cc0, 0x12cc2, - 0x12cc4, 0x12cc6, 0x12cc8, 0x12cca, 0x12ccc, 0x12cce, 0x12cd0, 0x12cd2, 0x12cd4, - 0x12cd6, 0x12cd8, 0x12cda, 0x12cdc, 0x12cde, 0x12ce0, 0x12ce2, 0x12ceb, 0x12ced, - 0x12cf2, 0x1a640, 0x1a642, 0x1a644, 0x1a646, 0x1a648, 0x1a64a, 0x1a64c, 0x1a64e, - 0x1a650, 0x1a652, 0x1a654, 0x1a656, 0x1a658, 0x1a65a, 0x1a65c, 0x1a65e, 0x1a660, - 0x1a662, 0x1a664, 0x1a666, 0x1a668, 0x1a66a, 0x1a66c, 0x1a680, 0x1a682, 0x1a684, - 0x1a686, 0x1a688, 0x1a68a, 0x1a68c, 0x1a68e, 0x1a690, 0x1a692, 0x1a694, 0x1a696, - 0x1a698, 0x1a69a, 0x1a722, 0x1a724, 0x1a726, 0x1a728, 0x1a72a, 0x1a72c, 0x1a72e, - 0x1a732, 0x1a734, 0x1a736, 0x1a738, 0x1a73a, 0x1a73c, 0x1a73e, 0x1a740, 0x1a742, - 0x1a744, 0x1a746, 0x1a748, 0x1a74a, 0x1a74c, 0x1a74e, 0x1a750, 0x1a752, 0x1a754, - 0x1a756, 0x1a758, 0x1a75a, 0x1a75c, 0x1a75e, 0x1a760, 0x1a762, 0x1a764, 0x1a766, - 0x1a768, 0x1a76a, 0x1a76c, 0x1a76e, 0x1a779, 0x1a77b, 0x1a77d, 0x1a77e, 0x1a780, - 0x1a782, 0x1a784, 0x1a786, 0x1a78b, 0x1a78d, 0x1a790, 0x1a792, 0x1a796, 0x1a798, - 0x1a79a, 0x1a79c, 0x1a79e, 0x1a7a0, 0x1a7a2, 0x1a7a4, 0x1a7a6, 0x1a7a8, 0x1a7b6, - 0x20100, 0x20102, 0x20104, 0x20106, 0x20108, 0x2010a, 0x2010c, 0x2010e, 0x20110, - 0x20112, 0x20114, 0x20116, 0x20118, 0x2011a, 0x2011c, 0x2011e, 0x20120, 0x20122, - 0x20124, 0x20126, 0x20128, 0x2012a, 0x2012c, 0x2012e, 0x20130, 0x20132, 0x20134, - 0x20136, 0x20139, 0x2013b, 0x2013d, 0x2013f, 0x20141, 0x20143, 0x20145, 0x20147, - 0x2014a, 0x2014c, 0x2014e, 0x20150, 0x20152, 0x20154, 0x20156, 0x20158, 0x2015a, - 0x2015c, 0x2015e, 0x20160, 0x20162, 0x20164, 0x20166, 0x20168, 0x2016a, 0x2016c, - 0x2016e, 0x20170, 0x20172, 0x20174, 0x20176, 0x20178, 0x20179, 0x2017b, 0x2017d, - 0x20181, 0x20182, 0x20184, 0x20186, 0x20187, 0x20193, 0x20194, 0x2019c, 0x2019d, - 0x2019f, 0x201a0, 0x201a2, 0x201a4, 0x201a6, 0x201a7, 0x201a9, 0x201ac, 0x201ae, - 0x201af, 0x201b5, 0x201b7, 0x201b8, 0x201bc, 0x201c4, 0x201c7, 0x201ca, 0x201cd, - 0x201cf, 0x201d1, 0x201d3, 0x201d5, 0x201d7, 0x201d9, 0x201db, 0x201de, 0x201e0, - 0x201e2, 0x201e4, 0x201e6, 0x201e8, 0x201ea, 0x201ec, 0x201ee, 0x201f1, 0x201f4, - 0x201fa, 0x201fc, 0x201fe, 0x20200, 0x20202, 0x20204, 0x20206, 0x20208, 0x2020a, - 0x2020c, 0x2020e, 0x20210, 0x20212, 0x20214, 0x20216, 0x20218, 0x2021a, 0x2021c, - 0x2021e, 0x20220, 0x20222, 0x20224, 0x20226, 0x20228, 0x2022a, 0x2022c, 0x2022e, - 0x20230, 0x20232, 0x2023a, 0x2023b, 0x2023d, 0x2023e, 0x20241, 0x20248, 0x2024a, - 0x2024c, 0x2024e, 0x20370, 0x20372, 0x20376, 0x2037f, 0x20386, 0x2038c, 0x2038e, - 0x2038f, 0x203cf, 0x203d8, 0x203da, 0x203dc, 0x203de, 0x203e0, 0x203e2, 0x203e4, - 0x203e6, 0x203e8, 0x203ea, 0x203ec, 0x203ee, 0x203f4, 0x203f7, 0x203f9, 0x203fa, - 0x20460, 0x20462, 0x20464, 0x20466, 0x20468, 0x2046a, 0x2046c, 0x2046e, 0x20470, - 0x20472, 0x20474, 0x20476, 0x20478, 0x2047a, 0x2047c, 0x2047e, 0x20480, 0x2048a, - 0x2048c, 0x2048e, 0x20490, 0x20492, 0x20494, 0x20496, 0x20498, 0x2049a, 0x2049c, - 0x2049e, 0x204a0, 0x204a2, 0x204a4, 0x204a6, 0x204a8, 0x204aa, 0x204ac, 0x204ae, - 0x204b0, 0x204b2, 0x204b4, 0x204b6, 0x204b8, 0x204ba, 0x204bc, 0x204be, 0x204c0, - 0x204c1, 0x204c3, 0x204c5, 0x204c7, 0x204c9, 0x204cb, 0x204cd, 0x204d0, 0x204d2, - 0x204d4, 0x204d6, 0x204d8, 0x204da, 0x204dc, 0x204de, 0x204e0, 0x204e2, 0x204e4, - 0x204e6, 0x204e8, 0x204ea, 0x204ec, 0x204ee, 0x204f0, 0x204f2, 0x204f4, 0x204f6, - 0x204f8, 0x204fa, 0x204fc, 0x204fe, 0x20500, 0x20502, 0x20504, 0x20506, 0x20508, - 0x2050a, 0x2050c, 0x2050e, 0x20510, 0x20512, 0x20514, 0x20516, 0x20518, 0x2051a, - 0x2051c, 0x2051e, 0x20520, 0x20522, 0x20524, 0x20526, 0x20528, 0x2052a, 0x2052c, - 0x2052e, 0x210c7, 0x210cd, 0x21e00, 0x21e02, 0x21e04, 0x21e06, 0x21e08, 0x21e0a, - 0x21e0c, 0x21e0e, 0x21e10, 0x21e12, 0x21e14, 0x21e16, 0x21e18, 0x21e1a, 0x21e1c, - 0x21e1e, 0x21e20, 0x21e22, 0x21e24, 0x21e26, 0x21e28, 0x21e2a, 0x21e2c, 0x21e2e, - 0x21e30, 0x21e32, 0x21e34, 0x21e36, 0x21e38, 0x21e3a, 0x21e3c, 0x21e3e, 0x21e40, - 0x21e42, 0x21e44, 0x21e46, 0x21e48, 0x21e4a, 0x21e4c, 0x21e4e, 0x21e50, 0x21e52, - 0x21e54, 0x21e56, 0x21e58, 0x21e5a, 0x21e5c, 0x21e5e, 0x21e60, 0x21e62, 0x21e64, - 0x21e66, 0x21e68, 0x21e6a, 0x21e6c, 0x21e6e, 0x21e70, 0x21e72, 0x21e74, 0x21e76, - 0x21e78, 0x21e7a, 0x21e7c, 0x21e7e, 0x21e80, 0x21e82, 0x21e84, 0x21e86, 0x21e88, - 0x21e8a, 0x21e8c, 0x21e8e, 0x21e90, 0x21e92, 0x21e94, 0x21e9e, 0x21ea0, 0x21ea2, - 0x21ea4, 0x21ea6, 0x21ea8, 0x21eaa, 0x21eac, 0x21eae, 0x21eb0, 0x21eb2, 0x21eb4, - 0x21eb6, 0x21eb8, 0x21eba, 0x21ebc, 0x21ebe, 0x21ec0, 0x21ec2, 0x21ec4, 0x21ec6, - 0x21ec8, 0x21eca, 0x21ecc, 0x21ece, 0x21ed0, 0x21ed2, 0x21ed4, 0x21ed6, 0x21ed8, - 0x21eda, 0x21edc, 0x21ede, 0x21ee0, 0x21ee2, 0x21ee4, 0x21ee6, 0x21ee8, 0x21eea, - 0x21eec, 0x21eee, 0x21ef0, 0x21ef2, 0x21ef4, 0x21ef6, 0x21ef8, 0x21efa, 0x21efc, - 0x21efe, 0x21f59, 0x21f5b, 0x21f5d, 0x21f5f, 0x22102, 0x22107, 0x22115, 0x22124, - 0x22126, 0x22128, 0x2213e, 0x2213f, 0x22145, 0x22183, 0x22c60, 0x22c67, 0x22c69, - 0x22c6b, 0x22c72, 0x22c75, 0x22c82, 0x22c84, 0x22c86, 0x22c88, 0x22c8a, 0x22c8c, - 0x22c8e, 0x22c90, 0x22c92, 0x22c94, 0x22c96, 0x22c98, 0x22c9a, 0x22c9c, 0x22c9e, - 0x22ca0, 0x22ca2, 0x22ca4, 0x22ca6, 0x22ca8, 0x22caa, 0x22cac, 0x22cae, 0x22cb0, - 0x22cb2, 0x22cb4, 0x22cb6, 0x22cb8, 0x22cba, 0x22cbc, 0x22cbe, 0x22cc0, 0x22cc2, - 0x22cc4, 0x22cc6, 0x22cc8, 0x22cca, 0x22ccc, 0x22cce, 0x22cd0, 0x22cd2, 0x22cd4, - 0x22cd6, 0x22cd8, 0x22cda, 0x22cdc, 0x22cde, 0x22ce0, 0x22ce2, 0x22ceb, 0x22ced, - 0x22cf2, 0x2a640, 0x2a642, 0x2a644, 0x2a646, 0x2a648, 0x2a64a, 0x2a64c, 0x2a64e, - 0x2a650, 0x2a652, 0x2a654, 0x2a656, 0x2a658, 0x2a65a, 0x2a65c, 0x2a65e, 0x2a660, - 0x2a662, 0x2a664, 0x2a666, 0x2a668, 0x2a66a, 0x2a66c, 0x2a680, 0x2a682, 0x2a684, - 0x2a686, 0x2a688, 0x2a68a, 0x2a68c, 0x2a68e, 0x2a690, 0x2a692, 0x2a694, 0x2a696, - 0x2a698, 0x2a69a, 0x2a722, 0x2a724, 0x2a726, 0x2a728, 0x2a72a, 0x2a72c, 0x2a72e, - 0x2a732, 0x2a734, 0x2a736, 0x2a738, 0x2a73a, 0x2a73c, 0x2a73e, 0x2a740, 0x2a742, - 0x2a744, 0x2a746, 0x2a748, 0x2a74a, 0x2a74c, 0x2a74e, 0x2a750, 0x2a752, 0x2a754, - 0x2a756, 0x2a758, 0x2a75a, 0x2a75c, 0x2a75e, 0x2a760, 0x2a762, 0x2a764, 0x2a766, - 0x2a768, 0x2a76a, 0x2a76c, 0x2a76e, 0x2a779, 0x2a77b, 0x2a77d, 0x2a77e, 0x2a780, - 0x2a782, 0x2a784, 0x2a786, 0x2a78b, 0x2a78d, 0x2a790, 0x2a792, 0x2a796, 0x2a798, - 0x2a79a, 0x2a79c, 0x2a79e, 0x2a7a0, 0x2a7a2, 0x2a7a4, 0x2a7a6, 0x2a7a8, 0x2a7b6, - 0x30100, 0x30102, 0x30104, 0x30106, 0x30108, 0x3010a, 0x3010c, 0x3010e, 0x30110, - 0x30112, 0x30114, 0x30116, 0x30118, 0x3011a, 0x3011c, 0x3011e, 0x30120, 0x30122, - 0x30124, 0x30126, 0x30128, 0x3012a, 0x3012c, 0x3012e, 0x30130, 0x30132, 0x30134, - 0x30136, 0x30139, 0x3013b, 0x3013d, 0x3013f, 0x30141, 0x30143, 0x30145, 0x30147, - 0x3014a, 0x3014c, 0x3014e, 0x30150, 0x30152, 0x30154, 0x30156, 0x30158, 0x3015a, - 0x3015c, 0x3015e, 0x30160, 0x30162, 0x30164, 0x30166, 0x30168, 0x3016a, 0x3016c, - 0x3016e, 0x30170, 0x30172, 0x30174, 0x30176, 0x30178, 0x30179, 0x3017b, 0x3017d, - 0x30181, 0x30182, 0x30184, 0x30186, 0x30187, 0x30193, 0x30194, 0x3019c, 0x3019d, - 0x3019f, 0x301a0, 0x301a2, 0x301a4, 0x301a6, 0x301a7, 0x301a9, 0x301ac, 0x301ae, - 0x301af, 0x301b5, 0x301b7, 0x301b8, 0x301bc, 0x301c4, 0x301c7, 0x301ca, 0x301cd, - 0x301cf, 0x301d1, 0x301d3, 0x301d5, 0x301d7, 0x301d9, 0x301db, 0x301de, 0x301e0, - 0x301e2, 0x301e4, 0x301e6, 0x301e8, 0x301ea, 0x301ec, 0x301ee, 0x301f1, 0x301f4, - 0x301fa, 0x301fc, 0x301fe, 0x30200, 0x30202, 0x30204, 0x30206, 0x30208, 0x3020a, - 0x3020c, 0x3020e, 0x30210, 0x30212, 0x30214, 0x30216, 0x30218, 0x3021a, 0x3021c, - 0x3021e, 0x30220, 0x30222, 0x30224, 0x30226, 0x30228, 0x3022a, 0x3022c, 0x3022e, - 0x30230, 0x30232, 0x3023a, 0x3023b, 0x3023d, 0x3023e, 0x30241, 0x30248, 0x3024a, - 0x3024c, 0x3024e, 0x30370, 0x30372, 0x30376, 0x3037f, 0x30386, 0x3038c, 0x3038e, - 0x3038f, 0x303cf, 0x303d8, 0x303da, 0x303dc, 0x303de, 0x303e0, 0x303e2, 0x303e4, - 0x303e6, 0x303e8, 0x303ea, 0x303ec, 0x303ee, 0x303f4, 0x303f7, 0x303f9, 0x303fa, - 0x30460, 0x30462, 0x30464, 0x30466, 0x30468, 0x3046a, 0x3046c, 0x3046e, 0x30470, - 0x30472, 0x30474, 0x30476, 0x30478, 0x3047a, 0x3047c, 0x3047e, 0x30480, 0x3048a, - 0x3048c, 0x3048e, 0x30490, 0x30492, 0x30494, 0x30496, 0x30498, 0x3049a, 0x3049c, - 0x3049e, 0x304a0, 0x304a2, 0x304a4, 0x304a6, 0x304a8, 0x304aa, 0x304ac, 0x304ae, - 0x304b0, 0x304b2, 0x304b4, 0x304b6, 0x304b8, 0x304ba, 0x304bc, 0x304be, 0x304c0, - 0x304c1, 0x304c3, 0x304c5, 0x304c7, 0x304c9, 0x304cb, 0x304cd, 0x304d0, 0x304d2, - 0x304d4, 0x304d6, 0x304d8, 0x304da, 0x304dc, 0x304de, 0x304e0, 0x304e2, 0x304e4, - 0x304e6, 0x304e8, 0x304ea, 0x304ec, 0x304ee, 0x304f0, 0x304f2, 0x304f4, 0x304f6, - 0x304f8, 0x304fa, 0x304fc, 0x304fe, 0x30500, 0x30502, 0x30504, 0x30506, 0x30508, - 0x3050a, 0x3050c, 0x3050e, 0x30510, 0x30512, 0x30514, 0x30516, 0x30518, 0x3051a, - 0x3051c, 0x3051e, 0x30520, 0x30522, 0x30524, 0x30526, 0x30528, 0x3052a, 0x3052c, - 0x3052e, 0x310c7, 0x310cd, 0x31e00, 0x31e02, 0x31e04, 0x31e06, 0x31e08, 0x31e0a, - 0x31e0c, 0x31e0e, 0x31e10, 0x31e12, 0x31e14, 0x31e16, 0x31e18, 0x31e1a, 0x31e1c, - 0x31e1e, 0x31e20, 0x31e22, 0x31e24, 0x31e26, 0x31e28, 0x31e2a, 0x31e2c, 0x31e2e, - 0x31e30, 0x31e32, 0x31e34, 0x31e36, 0x31e38, 0x31e3a, 0x31e3c, 0x31e3e, 0x31e40, - 0x31e42, 0x31e44, 0x31e46, 0x31e48, 0x31e4a, 0x31e4c, 0x31e4e, 0x31e50, 0x31e52, - 0x31e54, 0x31e56, 0x31e58, 0x31e5a, 0x31e5c, 0x31e5e, 0x31e60, 0x31e62, 0x31e64, - 0x31e66, 0x31e68, 0x31e6a, 0x31e6c, 0x31e6e, 0x31e70, 0x31e72, 0x31e74, 0x31e76, - 0x31e78, 0x31e7a, 0x31e7c, 0x31e7e, 0x31e80, 0x31e82, 0x31e84, 0x31e86, 0x31e88, - 0x31e8a, 0x31e8c, 0x31e8e, 0x31e90, 0x31e92, 0x31e94, 0x31e9e, 0x31ea0, 0x31ea2, - 0x31ea4, 0x31ea6, 0x31ea8, 0x31eaa, 0x31eac, 0x31eae, 0x31eb0, 0x31eb2, 0x31eb4, - 0x31eb6, 0x31eb8, 0x31eba, 0x31ebc, 0x31ebe, 0x31ec0, 0x31ec2, 0x31ec4, 0x31ec6, - 0x31ec8, 0x31eca, 0x31ecc, 0x31ece, 0x31ed0, 0x31ed2, 0x31ed4, 0x31ed6, 0x31ed8, - 0x31eda, 0x31edc, 0x31ede, 0x31ee0, 0x31ee2, 0x31ee4, 0x31ee6, 0x31ee8, 0x31eea, - 0x31eec, 0x31eee, 0x31ef0, 0x31ef2, 0x31ef4, 0x31ef6, 0x31ef8, 0x31efa, 0x31efc, - 0x31efe, 0x31f59, 0x31f5b, 0x31f5d, 0x31f5f, 0x32102, 0x32107, 0x32115, 0x32124, - 0x32126, 0x32128, 0x3213e, 0x3213f, 0x32145, 0x32183, 0x32c60, 0x32c67, 0x32c69, - 0x32c6b, 0x32c72, 0x32c75, 0x32c82, 0x32c84, 0x32c86, 0x32c88, 0x32c8a, 0x32c8c, - 0x32c8e, 0x32c90, 0x32c92, 0x32c94, 0x32c96, 0x32c98, 0x32c9a, 0x32c9c, 0x32c9e, - 0x32ca0, 0x32ca2, 0x32ca4, 0x32ca6, 0x32ca8, 0x32caa, 0x32cac, 0x32cae, 0x32cb0, - 0x32cb2, 0x32cb4, 0x32cb6, 0x32cb8, 0x32cba, 0x32cbc, 0x32cbe, 0x32cc0, 0x32cc2, - 0x32cc4, 0x32cc6, 0x32cc8, 0x32cca, 0x32ccc, 0x32cce, 0x32cd0, 0x32cd2, 0x32cd4, - 0x32cd6, 0x32cd8, 0x32cda, 0x32cdc, 0x32cde, 0x32ce0, 0x32ce2, 0x32ceb, 0x32ced, - 0x32cf2, 0x3a640, 0x3a642, 0x3a644, 0x3a646, 0x3a648, 0x3a64a, 0x3a64c, 0x3a64e, - 0x3a650, 0x3a652, 0x3a654, 0x3a656, 0x3a658, 0x3a65a, 0x3a65c, 0x3a65e, 0x3a660, - 0x3a662, 0x3a664, 0x3a666, 0x3a668, 0x3a66a, 0x3a66c, 0x3a680, 0x3a682, 0x3a684, - 0x3a686, 0x3a688, 0x3a68a, 0x3a68c, 0x3a68e, 0x3a690, 0x3a692, 0x3a694, 0x3a696, - 0x3a698, 0x3a69a, 0x3a722, 0x3a724, 0x3a726, 0x3a728, 0x3a72a, 0x3a72c, 0x3a72e, - 0x3a732, 0x3a734, 0x3a736, 0x3a738, 0x3a73a, 0x3a73c, 0x3a73e, 0x3a740, 0x3a742, - 0x3a744, 0x3a746, 0x3a748, 0x3a74a, 0x3a74c, 0x3a74e, 0x3a750, 0x3a752, 0x3a754, - 0x3a756, 0x3a758, 0x3a75a, 0x3a75c, 0x3a75e, 0x3a760, 0x3a762, 0x3a764, 0x3a766, - 0x3a768, 0x3a76a, 0x3a76c, 0x3a76e, 0x3a779, 0x3a77b, 0x3a77d, 0x3a77e, 0x3a780, - 0x3a782, 0x3a784, 0x3a786, 0x3a78b, 0x3a78d, 0x3a790, 0x3a792, 0x3a796, 0x3a798, - 0x3a79a, 0x3a79c, 0x3a79e, 0x3a7a0, 0x3a7a2, 0x3a7a4, 0x3a7a6, 0x3a7a8, 0x3a7b6, - 0x40100, 0x40102, 0x40104, 0x40106, 0x40108, 0x4010a, 0x4010c, 0x4010e, 0x40110, - 0x40112, 0x40114, 0x40116, 0x40118, 0x4011a, 0x4011c, 0x4011e, 0x40120, 0x40122, - 0x40124, 0x40126, 0x40128, 0x4012a, 0x4012c, 0x4012e, 0x40130, 0x40132, 0x40134, - 0x40136, 0x40139, 0x4013b, 0x4013d, 0x4013f, 0x40141, 0x40143, 0x40145, 0x40147, - 0x4014a, 0x4014c, 0x4014e, 0x40150, 0x40152, 0x40154, 0x40156, 0x40158, 0x4015a, - 0x4015c, 0x4015e, 0x40160, 0x40162, 0x40164, 0x40166, 0x40168, 0x4016a, 0x4016c, - 0x4016e, 0x40170, 0x40172, 0x40174, 0x40176, 0x40178, 0x40179, 0x4017b, 0x4017d, - 0x40181, 0x40182, 0x40184, 0x40186, 0x40187, 0x40193, 0x40194, 0x4019c, 0x4019d, - 0x4019f, 0x401a0, 0x401a2, 0x401a4, 0x401a6, 0x401a7, 0x401a9, 0x401ac, 0x401ae, - 0x401af, 0x401b5, 0x401b7, 0x401b8, 0x401bc, 0x401c4, 0x401c7, 0x401ca, 0x401cd, - 0x401cf, 0x401d1, 0x401d3, 0x401d5, 0x401d7, 0x401d9, 0x401db, 0x401de, 0x401e0, - 0x401e2, 0x401e4, 0x401e6, 0x401e8, 0x401ea, 0x401ec, 0x401ee, 0x401f1, 0x401f4, - 0x401fa, 0x401fc, 0x401fe, 0x40200, 0x40202, 0x40204, 0x40206, 0x40208, 0x4020a, - 0x4020c, 0x4020e, 0x40210, 0x40212, 0x40214, 0x40216, 0x40218, 0x4021a, 0x4021c, - 0x4021e, 0x40220, 0x40222, 0x40224, 0x40226, 0x40228, 0x4022a, 0x4022c, 0x4022e, - 0x40230, 0x40232, 0x4023a, 0x4023b, 0x4023d, 0x4023e, 0x40241, 0x40248, 0x4024a, - 0x4024c, 0x4024e, 0x40370, 0x40372, 0x40376, 0x4037f, 0x40386, 0x4038c, 0x4038e, - 0x4038f, 0x403cf, 0x403d8, 0x403da, 0x403dc, 0x403de, 0x403e0, 0x403e2, 0x403e4, - 0x403e6, 0x403e8, 0x403ea, 0x403ec, 0x403ee, 0x403f4, 0x403f7, 0x403f9, 0x403fa, - 0x40460, 0x40462, 0x40464, 0x40466, 0x40468, 0x4046a, 0x4046c, 0x4046e, 0x40470, - 0x40472, 0x40474, 0x40476, 0x40478, 0x4047a, 0x4047c, 0x4047e, 0x40480, 0x4048a, - 0x4048c, 0x4048e, 0x40490, 0x40492, 0x40494, 0x40496, 0x40498, 0x4049a, 0x4049c, - 0x4049e, 0x404a0, 0x404a2, 0x404a4, 0x404a6, 0x404a8, 0x404aa, 0x404ac, 0x404ae, - 0x404b0, 0x404b2, 0x404b4, 0x404b6, 0x404b8, 0x404ba, 0x404bc, 0x404be, 0x404c0, - 0x404c1, 0x404c3, 0x404c5, 0x404c7, 0x404c9, 0x404cb, 0x404cd, 0x404d0, 0x404d2, - 0x404d4, 0x404d6, 0x404d8, 0x404da, 0x404dc, 0x404de, 0x404e0, 0x404e2, 0x404e4, - 0x404e6, 0x404e8, 0x404ea, 0x404ec, 0x404ee, 0x404f0, 0x404f2, 0x404f4, 0x404f6, - 0x404f8, 0x404fa, 0x404fc, 0x404fe, 0x40500, 0x40502, 0x40504, 0x40506, 0x40508, - 0x4050a, 0x4050c, 0x4050e, 0x40510, 0x40512, 0x40514, 0x40516, 0x40518, 0x4051a, - 0x4051c, 0x4051e, 0x40520, 0x40522, 0x40524, 0x40526, 0x40528, 0x4052a, 0x4052c, - 0x4052e, 0x410c7, 0x410cd, 0x41e00, 0x41e02, 0x41e04, 0x41e06, 0x41e08, 0x41e0a, - 0x41e0c, 0x41e0e, 0x41e10, 0x41e12, 0x41e14, 0x41e16, 0x41e18, 0x41e1a, 0x41e1c, - 0x41e1e, 0x41e20, 0x41e22, 0x41e24, 0x41e26, 0x41e28, 0x41e2a, 0x41e2c, 0x41e2e, - 0x41e30, 0x41e32, 0x41e34, 0x41e36, 0x41e38, 0x41e3a, 0x41e3c, 0x41e3e, 0x41e40, - 0x41e42, 0x41e44, 0x41e46, 0x41e48, 0x41e4a, 0x41e4c, 0x41e4e, 0x41e50, 0x41e52, - 0x41e54, 0x41e56, 0x41e58, 0x41e5a, 0x41e5c, 0x41e5e, 0x41e60, 0x41e62, 0x41e64, - 0x41e66, 0x41e68, 0x41e6a, 0x41e6c, 0x41e6e, 0x41e70, 0x41e72, 0x41e74, 0x41e76, - 0x41e78, 0x41e7a, 0x41e7c, 0x41e7e, 0x41e80, 0x41e82, 0x41e84, 0x41e86, 0x41e88, - 0x41e8a, 0x41e8c, 0x41e8e, 0x41e90, 0x41e92, 0x41e94, 0x41e9e, 0x41ea0, 0x41ea2, - 0x41ea4, 0x41ea6, 0x41ea8, 0x41eaa, 0x41eac, 0x41eae, 0x41eb0, 0x41eb2, 0x41eb4, - 0x41eb6, 0x41eb8, 0x41eba, 0x41ebc, 0x41ebe, 0x41ec0, 0x41ec2, 0x41ec4, 0x41ec6, - 0x41ec8, 0x41eca, 0x41ecc, 0x41ece, 0x41ed0, 0x41ed2, 0x41ed4, 0x41ed6, 0x41ed8, - 0x41eda, 0x41edc, 0x41ede, 0x41ee0, 0x41ee2, 0x41ee4, 0x41ee6, 0x41ee8, 0x41eea, - 0x41eec, 0x41eee, 0x41ef0, 0x41ef2, 0x41ef4, 0x41ef6, 0x41ef8, 0x41efa, 0x41efc, - 0x41efe, 0x41f59, 0x41f5b, 0x41f5d, 0x41f5f, 0x42102, 0x42107, 0x42115, 0x42124, - 0x42126, 0x42128, 0x4213e, 0x4213f, 0x42145, 0x42183, 0x42c60, 0x42c67, 0x42c69, - 0x42c6b, 0x42c72, 0x42c75, 0x42c82, 0x42c84, 0x42c86, 0x42c88, 0x42c8a, 0x42c8c, - 0x42c8e, 0x42c90, 0x42c92, 0x42c94, 0x42c96, 0x42c98, 0x42c9a, 0x42c9c, 0x42c9e, - 0x42ca0, 0x42ca2, 0x42ca4, 0x42ca6, 0x42ca8, 0x42caa, 0x42cac, 0x42cae, 0x42cb0, - 0x42cb2, 0x42cb4, 0x42cb6, 0x42cb8, 0x42cba, 0x42cbc, 0x42cbe, 0x42cc0, 0x42cc2, - 0x42cc4, 0x42cc6, 0x42cc8, 0x42cca, 0x42ccc, 0x42cce, 0x42cd0, 0x42cd2, 0x42cd4, - 0x42cd6, 0x42cd8, 0x42cda, 0x42cdc, 0x42cde, 0x42ce0, 0x42ce2, 0x42ceb, 0x42ced, - 0x42cf2, 0x4a640, 0x4a642, 0x4a644, 0x4a646, 0x4a648, 0x4a64a, 0x4a64c, 0x4a64e, - 0x4a650, 0x4a652, 0x4a654, 0x4a656, 0x4a658, 0x4a65a, 0x4a65c, 0x4a65e, 0x4a660, - 0x4a662, 0x4a664, 0x4a666, 0x4a668, 0x4a66a, 0x4a66c, 0x4a680, 0x4a682, 0x4a684, - 0x4a686, 0x4a688, 0x4a68a, 0x4a68c, 0x4a68e, 0x4a690, 0x4a692, 0x4a694, 0x4a696, - 0x4a698, 0x4a69a, 0x4a722, 0x4a724, 0x4a726, 0x4a728, 0x4a72a, 0x4a72c, 0x4a72e, - 0x4a732, 0x4a734, 0x4a736, 0x4a738, 0x4a73a, 0x4a73c, 0x4a73e, 0x4a740, 0x4a742, - 0x4a744, 0x4a746, 0x4a748, 0x4a74a, 0x4a74c, 0x4a74e, 0x4a750, 0x4a752, 0x4a754, - 0x4a756, 0x4a758, 0x4a75a, 0x4a75c, 0x4a75e, 0x4a760, 0x4a762, 0x4a764, 0x4a766, - 0x4a768, 0x4a76a, 0x4a76c, 0x4a76e, 0x4a779, 0x4a77b, 0x4a77d, 0x4a77e, 0x4a780, - 0x4a782, 0x4a784, 0x4a786, 0x4a78b, 0x4a78d, 0x4a790, 0x4a792, 0x4a796, 0x4a798, - 0x4a79a, 0x4a79c, 0x4a79e, 0x4a7a0, 0x4a7a2, 0x4a7a4, 0x4a7a6, 0x4a7a8, 0x4a7b6, - 0x50100, 0x50102, 0x50104, 0x50106, 0x50108, 0x5010a, 0x5010c, 0x5010e, 0x50110, - 0x50112, 0x50114, 0x50116, 0x50118, 0x5011a, 0x5011c, 0x5011e, 0x50120, 0x50122, - 0x50124, 0x50126, 0x50128, 0x5012a, 0x5012c, 0x5012e, 0x50130, 0x50132, 0x50134, - 0x50136, 0x50139, 0x5013b, 0x5013d, 0x5013f, 0x50141, 0x50143, 0x50145, 0x50147, - 0x5014a, 0x5014c, 0x5014e, 0x50150, 0x50152, 0x50154, 0x50156, 0x50158, 0x5015a, - 0x5015c, 0x5015e, 0x50160, 0x50162, 0x50164, 0x50166, 0x50168, 0x5016a, 0x5016c, - 0x5016e, 0x50170, 0x50172, 0x50174, 0x50176, 0x50178, 0x50179, 0x5017b, 0x5017d, - 0x50181, 0x50182, 0x50184, 0x50186, 0x50187, 0x50193, 0x50194, 0x5019c, 0x5019d, - 0x5019f, 0x501a0, 0x501a2, 0x501a4, 0x501a6, 0x501a7, 0x501a9, 0x501ac, 0x501ae, - 0x501af, 0x501b5, 0x501b7, 0x501b8, 0x501bc, 0x501c4, 0x501c7, 0x501ca, 0x501cd, - 0x501cf, 0x501d1, 0x501d3, 0x501d5, 0x501d7, 0x501d9, 0x501db, 0x501de, 0x501e0, - 0x501e2, 0x501e4, 0x501e6, 0x501e8, 0x501ea, 0x501ec, 0x501ee, 0x501f1, 0x501f4, - 0x501fa, 0x501fc, 0x501fe, 0x50200, 0x50202, 0x50204, 0x50206, 0x50208, 0x5020a, - 0x5020c, 0x5020e, 0x50210, 0x50212, 0x50214, 0x50216, 0x50218, 0x5021a, 0x5021c, - 0x5021e, 0x50220, 0x50222, 0x50224, 0x50226, 0x50228, 0x5022a, 0x5022c, 0x5022e, - 0x50230, 0x50232, 0x5023a, 0x5023b, 0x5023d, 0x5023e, 0x50241, 0x50248, 0x5024a, - 0x5024c, 0x5024e, 0x50370, 0x50372, 0x50376, 0x5037f, 0x50386, 0x5038c, 0x5038e, - 0x5038f, 0x503cf, 0x503d8, 0x503da, 0x503dc, 0x503de, 0x503e0, 0x503e2, 0x503e4, - 0x503e6, 0x503e8, 0x503ea, 0x503ec, 0x503ee, 0x503f4, 0x503f7, 0x503f9, 0x503fa, - 0x50460, 0x50462, 0x50464, 0x50466, 0x50468, 0x5046a, 0x5046c, 0x5046e, 0x50470, - 0x50472, 0x50474, 0x50476, 0x50478, 0x5047a, 0x5047c, 0x5047e, 0x50480, 0x5048a, - 0x5048c, 0x5048e, 0x50490, 0x50492, 0x50494, 0x50496, 0x50498, 0x5049a, 0x5049c, - 0x5049e, 0x504a0, 0x504a2, 0x504a4, 0x504a6, 0x504a8, 0x504aa, 0x504ac, 0x504ae, - 0x504b0, 0x504b2, 0x504b4, 0x504b6, 0x504b8, 0x504ba, 0x504bc, 0x504be, 0x504c0, - 0x504c1, 0x504c3, 0x504c5, 0x504c7, 0x504c9, 0x504cb, 0x504cd, 0x504d0, 0x504d2, - 0x504d4, 0x504d6, 0x504d8, 0x504da, 0x504dc, 0x504de, 0x504e0, 0x504e2, 0x504e4, - 0x504e6, 0x504e8, 0x504ea, 0x504ec, 0x504ee, 0x504f0, 0x504f2, 0x504f4, 0x504f6, - 0x504f8, 0x504fa, 0x504fc, 0x504fe, 0x50500, 0x50502, 0x50504, 0x50506, 0x50508, - 0x5050a, 0x5050c, 0x5050e, 0x50510, 0x50512, 0x50514, 0x50516, 0x50518, 0x5051a, - 0x5051c, 0x5051e, 0x50520, 0x50522, 0x50524, 0x50526, 0x50528, 0x5052a, 0x5052c, - 0x5052e, 0x510c7, 0x510cd, 0x51e00, 0x51e02, 0x51e04, 0x51e06, 0x51e08, 0x51e0a, - 0x51e0c, 0x51e0e, 0x51e10, 0x51e12, 0x51e14, 0x51e16, 0x51e18, 0x51e1a, 0x51e1c, - 0x51e1e, 0x51e20, 0x51e22, 0x51e24, 0x51e26, 0x51e28, 0x51e2a, 0x51e2c, 0x51e2e, - 0x51e30, 0x51e32, 0x51e34, 0x51e36, 0x51e38, 0x51e3a, 0x51e3c, 0x51e3e, 0x51e40, - 0x51e42, 0x51e44, 0x51e46, 0x51e48, 0x51e4a, 0x51e4c, 0x51e4e, 0x51e50, 0x51e52, - 0x51e54, 0x51e56, 0x51e58, 0x51e5a, 0x51e5c, 0x51e5e, 0x51e60, 0x51e62, 0x51e64, - 0x51e66, 0x51e68, 0x51e6a, 0x51e6c, 0x51e6e, 0x51e70, 0x51e72, 0x51e74, 0x51e76, - 0x51e78, 0x51e7a, 0x51e7c, 0x51e7e, 0x51e80, 0x51e82, 0x51e84, 0x51e86, 0x51e88, - 0x51e8a, 0x51e8c, 0x51e8e, 0x51e90, 0x51e92, 0x51e94, 0x51e9e, 0x51ea0, 0x51ea2, - 0x51ea4, 0x51ea6, 0x51ea8, 0x51eaa, 0x51eac, 0x51eae, 0x51eb0, 0x51eb2, 0x51eb4, - 0x51eb6, 0x51eb8, 0x51eba, 0x51ebc, 0x51ebe, 0x51ec0, 0x51ec2, 0x51ec4, 0x51ec6, - 0x51ec8, 0x51eca, 0x51ecc, 0x51ece, 0x51ed0, 0x51ed2, 0x51ed4, 0x51ed6, 0x51ed8, - 0x51eda, 0x51edc, 0x51ede, 0x51ee0, 0x51ee2, 0x51ee4, 0x51ee6, 0x51ee8, 0x51eea, - 0x51eec, 0x51eee, 0x51ef0, 0x51ef2, 0x51ef4, 0x51ef6, 0x51ef8, 0x51efa, 0x51efc, - 0x51efe, 0x51f59, 0x51f5b, 0x51f5d, 0x51f5f, 0x52102, 0x52107, 0x52115, 0x52124, - 0x52126, 0x52128, 0x5213e, 0x5213f, 0x52145, 0x52183, 0x52c60, 0x52c67, 0x52c69, - 0x52c6b, 0x52c72, 0x52c75, 0x52c82, 0x52c84, 0x52c86, 0x52c88, 0x52c8a, 0x52c8c, - 0x52c8e, 0x52c90, 0x52c92, 0x52c94, 0x52c96, 0x52c98, 0x52c9a, 0x52c9c, 0x52c9e, - 0x52ca0, 0x52ca2, 0x52ca4, 0x52ca6, 0x52ca8, 0x52caa, 0x52cac, 0x52cae, 0x52cb0, - 0x52cb2, 0x52cb4, 0x52cb6, 0x52cb8, 0x52cba, 0x52cbc, 0x52cbe, 0x52cc0, 0x52cc2, - 0x52cc4, 0x52cc6, 0x52cc8, 0x52cca, 0x52ccc, 0x52cce, 0x52cd0, 0x52cd2, 0x52cd4, - 0x52cd6, 0x52cd8, 0x52cda, 0x52cdc, 0x52cde, 0x52ce0, 0x52ce2, 0x52ceb, 0x52ced, - 0x52cf2, 0x5a640, 0x5a642, 0x5a644, 0x5a646, 0x5a648, 0x5a64a, 0x5a64c, 0x5a64e, - 0x5a650, 0x5a652, 0x5a654, 0x5a656, 0x5a658, 0x5a65a, 0x5a65c, 0x5a65e, 0x5a660, - 0x5a662, 0x5a664, 0x5a666, 0x5a668, 0x5a66a, 0x5a66c, 0x5a680, 0x5a682, 0x5a684, - 0x5a686, 0x5a688, 0x5a68a, 0x5a68c, 0x5a68e, 0x5a690, 0x5a692, 0x5a694, 0x5a696, - 0x5a698, 0x5a69a, 0x5a722, 0x5a724, 0x5a726, 0x5a728, 0x5a72a, 0x5a72c, 0x5a72e, - 0x5a732, 0x5a734, 0x5a736, 0x5a738, 0x5a73a, 0x5a73c, 0x5a73e, 0x5a740, 0x5a742, - 0x5a744, 0x5a746, 0x5a748, 0x5a74a, 0x5a74c, 0x5a74e, 0x5a750, 0x5a752, 0x5a754, - 0x5a756, 0x5a758, 0x5a75a, 0x5a75c, 0x5a75e, 0x5a760, 0x5a762, 0x5a764, 0x5a766, - 0x5a768, 0x5a76a, 0x5a76c, 0x5a76e, 0x5a779, 0x5a77b, 0x5a77d, 0x5a77e, 0x5a780, - 0x5a782, 0x5a784, 0x5a786, 0x5a78b, 0x5a78d, 0x5a790, 0x5a792, 0x5a796, 0x5a798, - 0x5a79a, 0x5a79c, 0x5a79e, 0x5a7a0, 0x5a7a2, 0x5a7a4, 0x5a7a6, 0x5a7a8, 0x5a7b6, - 0x60100, 0x60102, 0x60104, 0x60106, 0x60108, 0x6010a, 0x6010c, 0x6010e, 0x60110, - 0x60112, 0x60114, 0x60116, 0x60118, 0x6011a, 0x6011c, 0x6011e, 0x60120, 0x60122, - 0x60124, 0x60126, 0x60128, 0x6012a, 0x6012c, 0x6012e, 0x60130, 0x60132, 0x60134, - 0x60136, 0x60139, 0x6013b, 0x6013d, 0x6013f, 0x60141, 0x60143, 0x60145, 0x60147, - 0x6014a, 0x6014c, 0x6014e, 0x60150, 0x60152, 0x60154, 0x60156, 0x60158, 0x6015a, - 0x6015c, 0x6015e, 0x60160, 0x60162, 0x60164, 0x60166, 0x60168, 0x6016a, 0x6016c, - 0x6016e, 0x60170, 0x60172, 0x60174, 0x60176, 0x60178, 0x60179, 0x6017b, 0x6017d, - 0x60181, 0x60182, 0x60184, 0x60186, 0x60187, 0x60193, 0x60194, 0x6019c, 0x6019d, - 0x6019f, 0x601a0, 0x601a2, 0x601a4, 0x601a6, 0x601a7, 0x601a9, 0x601ac, 0x601ae, - 0x601af, 0x601b5, 0x601b7, 0x601b8, 0x601bc, 0x601c4, 0x601c7, 0x601ca, 0x601cd, - 0x601cf, 0x601d1, 0x601d3, 0x601d5, 0x601d7, 0x601d9, 0x601db, 0x601de, 0x601e0, - 0x601e2, 0x601e4, 0x601e6, 0x601e8, 0x601ea, 0x601ec, 0x601ee, 0x601f1, 0x601f4, - 0x601fa, 0x601fc, 0x601fe, 0x60200, 0x60202, 0x60204, 0x60206, 0x60208, 0x6020a, - 0x6020c, 0x6020e, 0x60210, 0x60212, 0x60214, 0x60216, 0x60218, 0x6021a, 0x6021c, - 0x6021e, 0x60220, 0x60222, 0x60224, 0x60226, 0x60228, 0x6022a, 0x6022c, 0x6022e, - 0x60230, 0x60232, 0x6023a, 0x6023b, 0x6023d, 0x6023e, 0x60241, 0x60248, 0x6024a, - 0x6024c, 0x6024e, 0x60370, 0x60372, 0x60376, 0x6037f, 0x60386, 0x6038c, 0x6038e, - 0x6038f, 0x603cf, 0x603d8, 0x603da, 0x603dc, 0x603de, 0x603e0, 0x603e2, 0x603e4, - 0x603e6, 0x603e8, 0x603ea, 0x603ec, 0x603ee, 0x603f4, 0x603f7, 0x603f9, 0x603fa, - 0x60460, 0x60462, 0x60464, 0x60466, 0x60468, 0x6046a, 0x6046c, 0x6046e, 0x60470, - 0x60472, 0x60474, 0x60476, 0x60478, 0x6047a, 0x6047c, 0x6047e, 0x60480, 0x6048a, - 0x6048c, 0x6048e, 0x60490, 0x60492, 0x60494, 0x60496, 0x60498, 0x6049a, 0x6049c, - 0x6049e, 0x604a0, 0x604a2, 0x604a4, 0x604a6, 0x604a8, 0x604aa, 0x604ac, 0x604ae, - 0x604b0, 0x604b2, 0x604b4, 0x604b6, 0x604b8, 0x604ba, 0x604bc, 0x604be, 0x604c0, - 0x604c1, 0x604c3, 0x604c5, 0x604c7, 0x604c9, 0x604cb, 0x604cd, 0x604d0, 0x604d2, - 0x604d4, 0x604d6, 0x604d8, 0x604da, 0x604dc, 0x604de, 0x604e0, 0x604e2, 0x604e4, - 0x604e6, 0x604e8, 0x604ea, 0x604ec, 0x604ee, 0x604f0, 0x604f2, 0x604f4, 0x604f6, - 0x604f8, 0x604fa, 0x604fc, 0x604fe, 0x60500, 0x60502, 0x60504, 0x60506, 0x60508, - 0x6050a, 0x6050c, 0x6050e, 0x60510, 0x60512, 0x60514, 0x60516, 0x60518, 0x6051a, - 0x6051c, 0x6051e, 0x60520, 0x60522, 0x60524, 0x60526, 0x60528, 0x6052a, 0x6052c, - 0x6052e, 0x610c7, 0x610cd, 0x61e00, 0x61e02, 0x61e04, 0x61e06, 0x61e08, 0x61e0a, - 0x61e0c, 0x61e0e, 0x61e10, 0x61e12, 0x61e14, 0x61e16, 0x61e18, 0x61e1a, 0x61e1c, - 0x61e1e, 0x61e20, 0x61e22, 0x61e24, 0x61e26, 0x61e28, 0x61e2a, 0x61e2c, 0x61e2e, - 0x61e30, 0x61e32, 0x61e34, 0x61e36, 0x61e38, 0x61e3a, 0x61e3c, 0x61e3e, 0x61e40, - 0x61e42, 0x61e44, 0x61e46, 0x61e48, 0x61e4a, 0x61e4c, 0x61e4e, 0x61e50, 0x61e52, - 0x61e54, 0x61e56, 0x61e58, 0x61e5a, 0x61e5c, 0x61e5e, 0x61e60, 0x61e62, 0x61e64, - 0x61e66, 0x61e68, 0x61e6a, 0x61e6c, 0x61e6e, 0x61e70, 0x61e72, 0x61e74, 0x61e76, - 0x61e78, 0x61e7a, 0x61e7c, 0x61e7e, 0x61e80, 0x61e82, 0x61e84, 0x61e86, 0x61e88, - 0x61e8a, 0x61e8c, 0x61e8e, 0x61e90, 0x61e92, 0x61e94, 0x61e9e, 0x61ea0, 0x61ea2, - 0x61ea4, 0x61ea6, 0x61ea8, 0x61eaa, 0x61eac, 0x61eae, 0x61eb0, 0x61eb2, 0x61eb4, - 0x61eb6, 0x61eb8, 0x61eba, 0x61ebc, 0x61ebe, 0x61ec0, 0x61ec2, 0x61ec4, 0x61ec6, - 0x61ec8, 0x61eca, 0x61ecc, 0x61ece, 0x61ed0, 0x61ed2, 0x61ed4, 0x61ed6, 0x61ed8, - 0x61eda, 0x61edc, 0x61ede, 0x61ee0, 0x61ee2, 0x61ee4, 0x61ee6, 0x61ee8, 0x61eea, - 0x61eec, 0x61eee, 0x61ef0, 0x61ef2, 0x61ef4, 0x61ef6, 0x61ef8, 0x61efa, 0x61efc, - 0x61efe, 0x61f59, 0x61f5b, 0x61f5d, 0x61f5f, 0x62102, 0x62107, 0x62115, 0x62124, - 0x62126, 0x62128, 0x6213e, 0x6213f, 0x62145, 0x62183, 0x62c60, 0x62c67, 0x62c69, - 0x62c6b, 0x62c72, 0x62c75, 0x62c82, 0x62c84, 0x62c86, 0x62c88, 0x62c8a, 0x62c8c, - 0x62c8e, 0x62c90, 0x62c92, 0x62c94, 0x62c96, 0x62c98, 0x62c9a, 0x62c9c, 0x62c9e, - 0x62ca0, 0x62ca2, 0x62ca4, 0x62ca6, 0x62ca8, 0x62caa, 0x62cac, 0x62cae, 0x62cb0, - 0x62cb2, 0x62cb4, 0x62cb6, 0x62cb8, 0x62cba, 0x62cbc, 0x62cbe, 0x62cc0, 0x62cc2, - 0x62cc4, 0x62cc6, 0x62cc8, 0x62cca, 0x62ccc, 0x62cce, 0x62cd0, 0x62cd2, 0x62cd4, - 0x62cd6, 0x62cd8, 0x62cda, 0x62cdc, 0x62cde, 0x62ce0, 0x62ce2, 0x62ceb, 0x62ced, - 0x62cf2, 0x6a640, 0x6a642, 0x6a644, 0x6a646, 0x6a648, 0x6a64a, 0x6a64c, 0x6a64e, - 0x6a650, 0x6a652, 0x6a654, 0x6a656, 0x6a658, 0x6a65a, 0x6a65c, 0x6a65e, 0x6a660, - 0x6a662, 0x6a664, 0x6a666, 0x6a668, 0x6a66a, 0x6a66c, 0x6a680, 0x6a682, 0x6a684, - 0x6a686, 0x6a688, 0x6a68a, 0x6a68c, 0x6a68e, 0x6a690, 0x6a692, 0x6a694, 0x6a696, - 0x6a698, 0x6a69a, 0x6a722, 0x6a724, 0x6a726, 0x6a728, 0x6a72a, 0x6a72c, 0x6a72e, - 0x6a732, 0x6a734, 0x6a736, 0x6a738, 0x6a73a, 0x6a73c, 0x6a73e, 0x6a740, 0x6a742, - 0x6a744, 0x6a746, 0x6a748, 0x6a74a, 0x6a74c, 0x6a74e, 0x6a750, 0x6a752, 0x6a754, - 0x6a756, 0x6a758, 0x6a75a, 0x6a75c, 0x6a75e, 0x6a760, 0x6a762, 0x6a764, 0x6a766, - 0x6a768, 0x6a76a, 0x6a76c, 0x6a76e, 0x6a779, 0x6a77b, 0x6a77d, 0x6a77e, 0x6a780, - 0x6a782, 0x6a784, 0x6a786, 0x6a78b, 0x6a78d, 0x6a790, 0x6a792, 0x6a796, 0x6a798, - 0x6a79a, 0x6a79c, 0x6a79e, 0x6a7a0, 0x6a7a2, 0x6a7a4, 0x6a7a6, 0x6a7a8, 0x6a7b6, - 0x70100, 0x70102, 0x70104, 0x70106, 0x70108, 0x7010a, 0x7010c, 0x7010e, 0x70110, - 0x70112, 0x70114, 0x70116, 0x70118, 0x7011a, 0x7011c, 0x7011e, 0x70120, 0x70122, - 0x70124, 0x70126, 0x70128, 0x7012a, 0x7012c, 0x7012e, 0x70130, 0x70132, 0x70134, - 0x70136, 0x70139, 0x7013b, 0x7013d, 0x7013f, 0x70141, 0x70143, 0x70145, 0x70147, - 0x7014a, 0x7014c, 0x7014e, 0x70150, 0x70152, 0x70154, 0x70156, 0x70158, 0x7015a, - 0x7015c, 0x7015e, 0x70160, 0x70162, 0x70164, 0x70166, 0x70168, 0x7016a, 0x7016c, - 0x7016e, 0x70170, 0x70172, 0x70174, 0x70176, 0x70178, 0x70179, 0x7017b, 0x7017d, - 0x70181, 0x70182, 0x70184, 0x70186, 0x70187, 0x70193, 0x70194, 0x7019c, 0x7019d, - 0x7019f, 0x701a0, 0x701a2, 0x701a4, 0x701a6, 0x701a7, 0x701a9, 0x701ac, 0x701ae, - 0x701af, 0x701b5, 0x701b7, 0x701b8, 0x701bc, 0x701c4, 0x701c7, 0x701ca, 0x701cd, - 0x701cf, 0x701d1, 0x701d3, 0x701d5, 0x701d7, 0x701d9, 0x701db, 0x701de, 0x701e0, - 0x701e2, 0x701e4, 0x701e6, 0x701e8, 0x701ea, 0x701ec, 0x701ee, 0x701f1, 0x701f4, - 0x701fa, 0x701fc, 0x701fe, 0x70200, 0x70202, 0x70204, 0x70206, 0x70208, 0x7020a, - 0x7020c, 0x7020e, 0x70210, 0x70212, 0x70214, 0x70216, 0x70218, 0x7021a, 0x7021c, - 0x7021e, 0x70220, 0x70222, 0x70224, 0x70226, 0x70228, 0x7022a, 0x7022c, 0x7022e, - 0x70230, 0x70232, 0x7023a, 0x7023b, 0x7023d, 0x7023e, 0x70241, 0x70248, 0x7024a, - 0x7024c, 0x7024e, 0x70370, 0x70372, 0x70376, 0x7037f, 0x70386, 0x7038c, 0x7038e, - 0x7038f, 0x703cf, 0x703d8, 0x703da, 0x703dc, 0x703de, 0x703e0, 0x703e2, 0x703e4, - 0x703e6, 0x703e8, 0x703ea, 0x703ec, 0x703ee, 0x703f4, 0x703f7, 0x703f9, 0x703fa, - 0x70460, 0x70462, 0x70464, 0x70466, 0x70468, 0x7046a, 0x7046c, 0x7046e, 0x70470, - 0x70472, 0x70474, 0x70476, 0x70478, 0x7047a, 0x7047c, 0x7047e, 0x70480, 0x7048a, - 0x7048c, 0x7048e, 0x70490, 0x70492, 0x70494, 0x70496, 0x70498, 0x7049a, 0x7049c, - 0x7049e, 0x704a0, 0x704a2, 0x704a4, 0x704a6, 0x704a8, 0x704aa, 0x704ac, 0x704ae, - 0x704b0, 0x704b2, 0x704b4, 0x704b6, 0x704b8, 0x704ba, 0x704bc, 0x704be, 0x704c0, - 0x704c1, 0x704c3, 0x704c5, 0x704c7, 0x704c9, 0x704cb, 0x704cd, 0x704d0, 0x704d2, - 0x704d4, 0x704d6, 0x704d8, 0x704da, 0x704dc, 0x704de, 0x704e0, 0x704e2, 0x704e4, - 0x704e6, 0x704e8, 0x704ea, 0x704ec, 0x704ee, 0x704f0, 0x704f2, 0x704f4, 0x704f6, - 0x704f8, 0x704fa, 0x704fc, 0x704fe, 0x70500, 0x70502, 0x70504, 0x70506, 0x70508, - 0x7050a, 0x7050c, 0x7050e, 0x70510, 0x70512, 0x70514, 0x70516, 0x70518, 0x7051a, - 0x7051c, 0x7051e, 0x70520, 0x70522, 0x70524, 0x70526, 0x70528, 0x7052a, 0x7052c, - 0x7052e, 0x710c7, 0x710cd, 0x71e00, 0x71e02, 0x71e04, 0x71e06, 0x71e08, 0x71e0a, - 0x71e0c, 0x71e0e, 0x71e10, 0x71e12, 0x71e14, 0x71e16, 0x71e18, 0x71e1a, 0x71e1c, - 0x71e1e, 0x71e20, 0x71e22, 0x71e24, 0x71e26, 0x71e28, 0x71e2a, 0x71e2c, 0x71e2e, - 0x71e30, 0x71e32, 0x71e34, 0x71e36, 0x71e38, 0x71e3a, 0x71e3c, 0x71e3e, 0x71e40, - 0x71e42, 0x71e44, 0x71e46, 0x71e48, 0x71e4a, 0x71e4c, 0x71e4e, 0x71e50, 0x71e52, - 0x71e54, 0x71e56, 0x71e58, 0x71e5a, 0x71e5c, 0x71e5e, 0x71e60, 0x71e62, 0x71e64, - 0x71e66, 0x71e68, 0x71e6a, 0x71e6c, 0x71e6e, 0x71e70, 0x71e72, 0x71e74, 0x71e76, - 0x71e78, 0x71e7a, 0x71e7c, 0x71e7e, 0x71e80, 0x71e82, 0x71e84, 0x71e86, 0x71e88, - 0x71e8a, 0x71e8c, 0x71e8e, 0x71e90, 0x71e92, 0x71e94, 0x71e9e, 0x71ea0, 0x71ea2, - 0x71ea4, 0x71ea6, 0x71ea8, 0x71eaa, 0x71eac, 0x71eae, 0x71eb0, 0x71eb2, 0x71eb4, - 0x71eb6, 0x71eb8, 0x71eba, 0x71ebc, 0x71ebe, 0x71ec0, 0x71ec2, 0x71ec4, 0x71ec6, - 0x71ec8, 0x71eca, 0x71ecc, 0x71ece, 0x71ed0, 0x71ed2, 0x71ed4, 0x71ed6, 0x71ed8, - 0x71eda, 0x71edc, 0x71ede, 0x71ee0, 0x71ee2, 0x71ee4, 0x71ee6, 0x71ee8, 0x71eea, - 0x71eec, 0x71eee, 0x71ef0, 0x71ef2, 0x71ef4, 0x71ef6, 0x71ef8, 0x71efa, 0x71efc, - 0x71efe, 0x71f59, 0x71f5b, 0x71f5d, 0x71f5f, 0x72102, 0x72107, 0x72115, 0x72124, - 0x72126, 0x72128, 0x7213e, 0x7213f, 0x72145, 0x72183, 0x72c60, 0x72c67, 0x72c69, - 0x72c6b, 0x72c72, 0x72c75, 0x72c82, 0x72c84, 0x72c86, 0x72c88, 0x72c8a, 0x72c8c, - 0x72c8e, 0x72c90, 0x72c92, 0x72c94, 0x72c96, 0x72c98, 0x72c9a, 0x72c9c, 0x72c9e, - 0x72ca0, 0x72ca2, 0x72ca4, 0x72ca6, 0x72ca8, 0x72caa, 0x72cac, 0x72cae, 0x72cb0, - 0x72cb2, 0x72cb4, 0x72cb6, 0x72cb8, 0x72cba, 0x72cbc, 0x72cbe, 0x72cc0, 0x72cc2, - 0x72cc4, 0x72cc6, 0x72cc8, 0x72cca, 0x72ccc, 0x72cce, 0x72cd0, 0x72cd2, 0x72cd4, - 0x72cd6, 0x72cd8, 0x72cda, 0x72cdc, 0x72cde, 0x72ce0, 0x72ce2, 0x72ceb, 0x72ced, - 0x72cf2, 0x7a640, 0x7a642, 0x7a644, 0x7a646, 0x7a648, 0x7a64a, 0x7a64c, 0x7a64e, - 0x7a650, 0x7a652, 0x7a654, 0x7a656, 0x7a658, 0x7a65a, 0x7a65c, 0x7a65e, 0x7a660, - 0x7a662, 0x7a664, 0x7a666, 0x7a668, 0x7a66a, 0x7a66c, 0x7a680, 0x7a682, 0x7a684, - 0x7a686, 0x7a688, 0x7a68a, 0x7a68c, 0x7a68e, 0x7a690, 0x7a692, 0x7a694, 0x7a696, - 0x7a698, 0x7a69a, 0x7a722, 0x7a724, 0x7a726, 0x7a728, 0x7a72a, 0x7a72c, 0x7a72e, - 0x7a732, 0x7a734, 0x7a736, 0x7a738, 0x7a73a, 0x7a73c, 0x7a73e, 0x7a740, 0x7a742, - 0x7a744, 0x7a746, 0x7a748, 0x7a74a, 0x7a74c, 0x7a74e, 0x7a750, 0x7a752, 0x7a754, - 0x7a756, 0x7a758, 0x7a75a, 0x7a75c, 0x7a75e, 0x7a760, 0x7a762, 0x7a764, 0x7a766, - 0x7a768, 0x7a76a, 0x7a76c, 0x7a76e, 0x7a779, 0x7a77b, 0x7a77d, 0x7a77e, 0x7a780, - 0x7a782, 0x7a784, 0x7a786, 0x7a78b, 0x7a78d, 0x7a790, 0x7a792, 0x7a796, 0x7a798, - 0x7a79a, 0x7a79c, 0x7a79e, 0x7a7a0, 0x7a7a2, 0x7a7a4, 0x7a7a6, 0x7a7a8, 0x7a7b6, - 0x80100, 0x80102, 0x80104, 0x80106, 0x80108, 0x8010a, 0x8010c, 0x8010e, 0x80110, - 0x80112, 0x80114, 0x80116, 0x80118, 0x8011a, 0x8011c, 0x8011e, 0x80120, 0x80122, - 0x80124, 0x80126, 0x80128, 0x8012a, 0x8012c, 0x8012e, 0x80130, 0x80132, 0x80134, - 0x80136, 0x80139, 0x8013b, 0x8013d, 0x8013f, 0x80141, 0x80143, 0x80145, 0x80147, - 0x8014a, 0x8014c, 0x8014e, 0x80150, 0x80152, 0x80154, 0x80156, 0x80158, 0x8015a, - 0x8015c, 0x8015e, 0x80160, 0x80162, 0x80164, 0x80166, 0x80168, 0x8016a, 0x8016c, - 0x8016e, 0x80170, 0x80172, 0x80174, 0x80176, 0x80178, 0x80179, 0x8017b, 0x8017d, - 0x80181, 0x80182, 0x80184, 0x80186, 0x80187, 0x80193, 0x80194, 0x8019c, 0x8019d, - 0x8019f, 0x801a0, 0x801a2, 0x801a4, 0x801a6, 0x801a7, 0x801a9, 0x801ac, 0x801ae, - 0x801af, 0x801b5, 0x801b7, 0x801b8, 0x801bc, 0x801c4, 0x801c7, 0x801ca, 0x801cd, - 0x801cf, 0x801d1, 0x801d3, 0x801d5, 0x801d7, 0x801d9, 0x801db, 0x801de, 0x801e0, - 0x801e2, 0x801e4, 0x801e6, 0x801e8, 0x801ea, 0x801ec, 0x801ee, 0x801f1, 0x801f4, - 0x801fa, 0x801fc, 0x801fe, 0x80200, 0x80202, 0x80204, 0x80206, 0x80208, 0x8020a, - 0x8020c, 0x8020e, 0x80210, 0x80212, 0x80214, 0x80216, 0x80218, 0x8021a, 0x8021c, - 0x8021e, 0x80220, 0x80222, 0x80224, 0x80226, 0x80228, 0x8022a, 0x8022c, 0x8022e, - 0x80230, 0x80232, 0x8023a, 0x8023b, 0x8023d, 0x8023e, 0x80241, 0x80248, 0x8024a, - 0x8024c, 0x8024e, 0x80370, 0x80372, 0x80376, 0x8037f, 0x80386, 0x8038c, 0x8038e, - 0x8038f, 0x803cf, 0x803d8, 0x803da, 0x803dc, 0x803de, 0x803e0, 0x803e2, 0x803e4, - 0x803e6, 0x803e8, 0x803ea, 0x803ec, 0x803ee, 0x803f4, 0x803f7, 0x803f9, 0x803fa, - 0x80460, 0x80462, 0x80464, 0x80466, 0x80468, 0x8046a, 0x8046c, 0x8046e, 0x80470, - 0x80472, 0x80474, 0x80476, 0x80478, 0x8047a, 0x8047c, 0x8047e, 0x80480, 0x8048a, - 0x8048c, 0x8048e, 0x80490, 0x80492, 0x80494, 0x80496, 0x80498, 0x8049a, 0x8049c, - 0x8049e, 0x804a0, 0x804a2, 0x804a4, 0x804a6, 0x804a8, 0x804aa, 0x804ac, 0x804ae, - 0x804b0, 0x804b2, 0x804b4, 0x804b6, 0x804b8, 0x804ba, 0x804bc, 0x804be, 0x804c0, - 0x804c1, 0x804c3, 0x804c5, 0x804c7, 0x804c9, 0x804cb, 0x804cd, 0x804d0, 0x804d2, - 0x804d4, 0x804d6, 0x804d8, 0x804da, 0x804dc, 0x804de, 0x804e0, 0x804e2, 0x804e4, - 0x804e6, 0x804e8, 0x804ea, 0x804ec, 0x804ee, 0x804f0, 0x804f2, 0x804f4, 0x804f6, - 0x804f8, 0x804fa, 0x804fc, 0x804fe, 0x80500, 0x80502, 0x80504, 0x80506, 0x80508, - 0x8050a, 0x8050c, 0x8050e, 0x80510, 0x80512, 0x80514, 0x80516, 0x80518, 0x8051a, - 0x8051c, 0x8051e, 0x80520, 0x80522, 0x80524, 0x80526, 0x80528, 0x8052a, 0x8052c, - 0x8052e, 0x810c7, 0x810cd, 0x81e00, 0x81e02, 0x81e04, 0x81e06, 0x81e08, 0x81e0a, - 0x81e0c, 0x81e0e, 0x81e10, 0x81e12, 0x81e14, 0x81e16, 0x81e18, 0x81e1a, 0x81e1c, - 0x81e1e, 0x81e20, 0x81e22, 0x81e24, 0x81e26, 0x81e28, 0x81e2a, 0x81e2c, 0x81e2e, - 0x81e30, 0x81e32, 0x81e34, 0x81e36, 0x81e38, 0x81e3a, 0x81e3c, 0x81e3e, 0x81e40, - 0x81e42, 0x81e44, 0x81e46, 0x81e48, 0x81e4a, 0x81e4c, 0x81e4e, 0x81e50, 0x81e52, - 0x81e54, 0x81e56, 0x81e58, 0x81e5a, 0x81e5c, 0x81e5e, 0x81e60, 0x81e62, 0x81e64, - 0x81e66, 0x81e68, 0x81e6a, 0x81e6c, 0x81e6e, 0x81e70, 0x81e72, 0x81e74, 0x81e76, - 0x81e78, 0x81e7a, 0x81e7c, 0x81e7e, 0x81e80, 0x81e82, 0x81e84, 0x81e86, 0x81e88, - 0x81e8a, 0x81e8c, 0x81e8e, 0x81e90, 0x81e92, 0x81e94, 0x81e9e, 0x81ea0, 0x81ea2, - 0x81ea4, 0x81ea6, 0x81ea8, 0x81eaa, 0x81eac, 0x81eae, 0x81eb0, 0x81eb2, 0x81eb4, - 0x81eb6, 0x81eb8, 0x81eba, 0x81ebc, 0x81ebe, 0x81ec0, 0x81ec2, 0x81ec4, 0x81ec6, - 0x81ec8, 0x81eca, 0x81ecc, 0x81ece, 0x81ed0, 0x81ed2, 0x81ed4, 0x81ed6, 0x81ed8, - 0x81eda, 0x81edc, 0x81ede, 0x81ee0, 0x81ee2, 0x81ee4, 0x81ee6, 0x81ee8, 0x81eea, - 0x81eec, 0x81eee, 0x81ef0, 0x81ef2, 0x81ef4, 0x81ef6, 0x81ef8, 0x81efa, 0x81efc, - 0x81efe, 0x81f59, 0x81f5b, 0x81f5d, 0x81f5f, 0x82102, 0x82107, 0x82115, 0x82124, - 0x82126, 0x82128, 0x8213e, 0x8213f, 0x82145, 0x82183, 0x82c60, 0x82c67, 0x82c69, - 0x82c6b, 0x82c72, 0x82c75, 0x82c82, 0x82c84, 0x82c86, 0x82c88, 0x82c8a, 0x82c8c, - 0x82c8e, 0x82c90, 0x82c92, 0x82c94, 0x82c96, 0x82c98, 0x82c9a, 0x82c9c, 0x82c9e, - 0x82ca0, 0x82ca2, 0x82ca4, 0x82ca6, 0x82ca8, 0x82caa, 0x82cac, 0x82cae, 0x82cb0, - 0x82cb2, 0x82cb4, 0x82cb6, 0x82cb8, 0x82cba, 0x82cbc, 0x82cbe, 0x82cc0, 0x82cc2, - 0x82cc4, 0x82cc6, 0x82cc8, 0x82cca, 0x82ccc, 0x82cce, 0x82cd0, 0x82cd2, 0x82cd4, - 0x82cd6, 0x82cd8, 0x82cda, 0x82cdc, 0x82cde, 0x82ce0, 0x82ce2, 0x82ceb, 0x82ced, - 0x82cf2, 0x8a640, 0x8a642, 0x8a644, 0x8a646, 0x8a648, 0x8a64a, 0x8a64c, 0x8a64e, - 0x8a650, 0x8a652, 0x8a654, 0x8a656, 0x8a658, 0x8a65a, 0x8a65c, 0x8a65e, 0x8a660, - 0x8a662, 0x8a664, 0x8a666, 0x8a668, 0x8a66a, 0x8a66c, 0x8a680, 0x8a682, 0x8a684, - 0x8a686, 0x8a688, 0x8a68a, 0x8a68c, 0x8a68e, 0x8a690, 0x8a692, 0x8a694, 0x8a696, - 0x8a698, 0x8a69a, 0x8a722, 0x8a724, 0x8a726, 0x8a728, 0x8a72a, 0x8a72c, 0x8a72e, - 0x8a732, 0x8a734, 0x8a736, 0x8a738, 0x8a73a, 0x8a73c, 0x8a73e, 0x8a740, 0x8a742, - 0x8a744, 0x8a746, 0x8a748, 0x8a74a, 0x8a74c, 0x8a74e, 0x8a750, 0x8a752, 0x8a754, - 0x8a756, 0x8a758, 0x8a75a, 0x8a75c, 0x8a75e, 0x8a760, 0x8a762, 0x8a764, 0x8a766, - 0x8a768, 0x8a76a, 0x8a76c, 0x8a76e, 0x8a779, 0x8a77b, 0x8a77d, 0x8a77e, 0x8a780, - 0x8a782, 0x8a784, 0x8a786, 0x8a78b, 0x8a78d, 0x8a790, 0x8a792, 0x8a796, 0x8a798, - 0x8a79a, 0x8a79c, 0x8a79e, 0x8a7a0, 0x8a7a2, 0x8a7a4, 0x8a7a6, 0x8a7a8, 0x8a7b6, - 0x90100, 0x90102, 0x90104, 0x90106, 0x90108, 0x9010a, 0x9010c, 0x9010e, 0x90110, - 0x90112, 0x90114, 0x90116, 0x90118, 0x9011a, 0x9011c, 0x9011e, 0x90120, 0x90122, - 0x90124, 0x90126, 0x90128, 0x9012a, 0x9012c, 0x9012e, 0x90130, 0x90132, 0x90134, - 0x90136, 0x90139, 0x9013b, 0x9013d, 0x9013f, 0x90141, 0x90143, 0x90145, 0x90147, - 0x9014a, 0x9014c, 0x9014e, 0x90150, 0x90152, 0x90154, 0x90156, 0x90158, 0x9015a, - 0x9015c, 0x9015e, 0x90160, 0x90162, 0x90164, 0x90166, 0x90168, 0x9016a, 0x9016c, - 0x9016e, 0x90170, 0x90172, 0x90174, 0x90176, 0x90178, 0x90179, 0x9017b, 0x9017d, - 0x90181, 0x90182, 0x90184, 0x90186, 0x90187, 0x90193, 0x90194, 0x9019c, 0x9019d, - 0x9019f, 0x901a0, 0x901a2, 0x901a4, 0x901a6, 0x901a7, 0x901a9, 0x901ac, 0x901ae, - 0x901af, 0x901b5, 0x901b7, 0x901b8, 0x901bc, 0x901c4, 0x901c7, 0x901ca, 0x901cd, - 0x901cf, 0x901d1, 0x901d3, 0x901d5, 0x901d7, 0x901d9, 0x901db, 0x901de, 0x901e0, - 0x901e2, 0x901e4, 0x901e6, 0x901e8, 0x901ea, 0x901ec, 0x901ee, 0x901f1, 0x901f4, - 0x901fa, 0x901fc, 0x901fe, 0x90200, 0x90202, 0x90204, 0x90206, 0x90208, 0x9020a, - 0x9020c, 0x9020e, 0x90210, 0x90212, 0x90214, 0x90216, 0x90218, 0x9021a, 0x9021c, - 0x9021e, 0x90220, 0x90222, 0x90224, 0x90226, 0x90228, 0x9022a, 0x9022c, 0x9022e, - 0x90230, 0x90232, 0x9023a, 0x9023b, 0x9023d, 0x9023e, 0x90241, 0x90248, 0x9024a, - 0x9024c, 0x9024e, 0x90370, 0x90372, 0x90376, 0x9037f, 0x90386, 0x9038c, 0x9038e, - 0x9038f, 0x903cf, 0x903d8, 0x903da, 0x903dc, 0x903de, 0x903e0, 0x903e2, 0x903e4, - 0x903e6, 0x903e8, 0x903ea, 0x903ec, 0x903ee, 0x903f4, 0x903f7, 0x903f9, 0x903fa, - 0x90460, 0x90462, 0x90464, 0x90466, 0x90468, 0x9046a, 0x9046c, 0x9046e, 0x90470, - 0x90472, 0x90474, 0x90476, 0x90478, 0x9047a, 0x9047c, 0x9047e, 0x90480, 0x9048a, - 0x9048c, 0x9048e, 0x90490, 0x90492, 0x90494, 0x90496, 0x90498, 0x9049a, 0x9049c, - 0x9049e, 0x904a0, 0x904a2, 0x904a4, 0x904a6, 0x904a8, 0x904aa, 0x904ac, 0x904ae, - 0x904b0, 0x904b2, 0x904b4, 0x904b6, 0x904b8, 0x904ba, 0x904bc, 0x904be, 0x904c0, - 0x904c1, 0x904c3, 0x904c5, 0x904c7, 0x904c9, 0x904cb, 0x904cd, 0x904d0, 0x904d2, - 0x904d4, 0x904d6, 0x904d8, 0x904da, 0x904dc, 0x904de, 0x904e0, 0x904e2, 0x904e4, - 0x904e6, 0x904e8, 0x904ea, 0x904ec, 0x904ee, 0x904f0, 0x904f2, 0x904f4, 0x904f6, - 0x904f8, 0x904fa, 0x904fc, 0x904fe, 0x90500, 0x90502, 0x90504, 0x90506, 0x90508, - 0x9050a, 0x9050c, 0x9050e, 0x90510, 0x90512, 0x90514, 0x90516, 0x90518, 0x9051a, - 0x9051c, 0x9051e, 0x90520, 0x90522, 0x90524, 0x90526, 0x90528, 0x9052a, 0x9052c, - 0x9052e, 0x910c7, 0x910cd, 0x91e00, 0x91e02, 0x91e04, 0x91e06, 0x91e08, 0x91e0a, - 0x91e0c, 0x91e0e, 0x91e10, 0x91e12, 0x91e14, 0x91e16, 0x91e18, 0x91e1a, 0x91e1c, - 0x91e1e, 0x91e20, 0x91e22, 0x91e24, 0x91e26, 0x91e28, 0x91e2a, 0x91e2c, 0x91e2e, - 0x91e30, 0x91e32, 0x91e34, 0x91e36, 0x91e38, 0x91e3a, 0x91e3c, 0x91e3e, 0x91e40, - 0x91e42, 0x91e44, 0x91e46, 0x91e48, 0x91e4a, 0x91e4c, 0x91e4e, 0x91e50, 0x91e52, - 0x91e54, 0x91e56, 0x91e58, 0x91e5a, 0x91e5c, 0x91e5e, 0x91e60, 0x91e62, 0x91e64, - 0x91e66, 0x91e68, 0x91e6a, 0x91e6c, 0x91e6e, 0x91e70, 0x91e72, 0x91e74, 0x91e76, - 0x91e78, 0x91e7a, 0x91e7c, 0x91e7e, 0x91e80, 0x91e82, 0x91e84, 0x91e86, 0x91e88, - 0x91e8a, 0x91e8c, 0x91e8e, 0x91e90, 0x91e92, 0x91e94, 0x91e9e, 0x91ea0, 0x91ea2, - 0x91ea4, 0x91ea6, 0x91ea8, 0x91eaa, 0x91eac, 0x91eae, 0x91eb0, 0x91eb2, 0x91eb4, - 0x91eb6, 0x91eb8, 0x91eba, 0x91ebc, 0x91ebe, 0x91ec0, 0x91ec2, 0x91ec4, 0x91ec6, - 0x91ec8, 0x91eca, 0x91ecc, 0x91ece, 0x91ed0, 0x91ed2, 0x91ed4, 0x91ed6, 0x91ed8, - 0x91eda, 0x91edc, 0x91ede, 0x91ee0, 0x91ee2, 0x91ee4, 0x91ee6, 0x91ee8, 0x91eea, - 0x91eec, 0x91eee, 0x91ef0, 0x91ef2, 0x91ef4, 0x91ef6, 0x91ef8, 0x91efa, 0x91efc, - 0x91efe, 0x91f59, 0x91f5b, 0x91f5d, 0x91f5f, 0x92102, 0x92107, 0x92115, 0x92124, - 0x92126, 0x92128, 0x9213e, 0x9213f, 0x92145, 0x92183, 0x92c60, 0x92c67, 0x92c69, - 0x92c6b, 0x92c72, 0x92c75, 0x92c82, 0x92c84, 0x92c86, 0x92c88, 0x92c8a, 0x92c8c, - 0x92c8e, 0x92c90, 0x92c92, 0x92c94, 0x92c96, 0x92c98, 0x92c9a, 0x92c9c, 0x92c9e, - 0x92ca0, 0x92ca2, 0x92ca4, 0x92ca6, 0x92ca8, 0x92caa, 0x92cac, 0x92cae, 0x92cb0, - 0x92cb2, 0x92cb4, 0x92cb6, 0x92cb8, 0x92cba, 0x92cbc, 0x92cbe, 0x92cc0, 0x92cc2, - 0x92cc4, 0x92cc6, 0x92cc8, 0x92cca, 0x92ccc, 0x92cce, 0x92cd0, 0x92cd2, 0x92cd4, - 0x92cd6, 0x92cd8, 0x92cda, 0x92cdc, 0x92cde, 0x92ce0, 0x92ce2, 0x92ceb, 0x92ced, - 0x92cf2, 0x9a640, 0x9a642, 0x9a644, 0x9a646, 0x9a648, 0x9a64a, 0x9a64c, 0x9a64e, - 0x9a650, 0x9a652, 0x9a654, 0x9a656, 0x9a658, 0x9a65a, 0x9a65c, 0x9a65e, 0x9a660, - 0x9a662, 0x9a664, 0x9a666, 0x9a668, 0x9a66a, 0x9a66c, 0x9a680, 0x9a682, 0x9a684, - 0x9a686, 0x9a688, 0x9a68a, 0x9a68c, 0x9a68e, 0x9a690, 0x9a692, 0x9a694, 0x9a696, - 0x9a698, 0x9a69a, 0x9a722, 0x9a724, 0x9a726, 0x9a728, 0x9a72a, 0x9a72c, 0x9a72e, - 0x9a732, 0x9a734, 0x9a736, 0x9a738, 0x9a73a, 0x9a73c, 0x9a73e, 0x9a740, 0x9a742, - 0x9a744, 0x9a746, 0x9a748, 0x9a74a, 0x9a74c, 0x9a74e, 0x9a750, 0x9a752, 0x9a754, - 0x9a756, 0x9a758, 0x9a75a, 0x9a75c, 0x9a75e, 0x9a760, 0x9a762, 0x9a764, 0x9a766, - 0x9a768, 0x9a76a, 0x9a76c, 0x9a76e, 0x9a779, 0x9a77b, 0x9a77d, 0x9a77e, 0x9a780, - 0x9a782, 0x9a784, 0x9a786, 0x9a78b, 0x9a78d, 0x9a790, 0x9a792, 0x9a796, 0x9a798, - 0x9a79a, 0x9a79c, 0x9a79e, 0x9a7a0, 0x9a7a2, 0x9a7a4, 0x9a7a6, 0x9a7a8, 0x9a7b6, - 0xa0100, 0xa0102, 0xa0104, 0xa0106, 0xa0108, 0xa010a, 0xa010c, 0xa010e, 0xa0110, - 0xa0112, 0xa0114, 0xa0116, 0xa0118, 0xa011a, 0xa011c, 0xa011e, 0xa0120, 0xa0122, - 0xa0124, 0xa0126, 0xa0128, 0xa012a, 0xa012c, 0xa012e, 0xa0130, 0xa0132, 0xa0134, - 0xa0136, 0xa0139, 0xa013b, 0xa013d, 0xa013f, 0xa0141, 0xa0143, 0xa0145, 0xa0147, - 0xa014a, 0xa014c, 0xa014e, 0xa0150, 0xa0152, 0xa0154, 0xa0156, 0xa0158, 0xa015a, - 0xa015c, 0xa015e, 0xa0160, 0xa0162, 0xa0164, 0xa0166, 0xa0168, 0xa016a, 0xa016c, - 0xa016e, 0xa0170, 0xa0172, 0xa0174, 0xa0176, 0xa0178, 0xa0179, 0xa017b, 0xa017d, - 0xa0181, 0xa0182, 0xa0184, 0xa0186, 0xa0187, 0xa0193, 0xa0194, 0xa019c, 0xa019d, - 0xa019f, 0xa01a0, 0xa01a2, 0xa01a4, 0xa01a6, 0xa01a7, 0xa01a9, 0xa01ac, 0xa01ae, - 0xa01af, 0xa01b5, 0xa01b7, 0xa01b8, 0xa01bc, 0xa01c4, 0xa01c7, 0xa01ca, 0xa01cd, - 0xa01cf, 0xa01d1, 0xa01d3, 0xa01d5, 0xa01d7, 0xa01d9, 0xa01db, 0xa01de, 0xa01e0, - 0xa01e2, 0xa01e4, 0xa01e6, 0xa01e8, 0xa01ea, 0xa01ec, 0xa01ee, 0xa01f1, 0xa01f4, - 0xa01fa, 0xa01fc, 0xa01fe, 0xa0200, 0xa0202, 0xa0204, 0xa0206, 0xa0208, 0xa020a, - 0xa020c, 0xa020e, 0xa0210, 0xa0212, 0xa0214, 0xa0216, 0xa0218, 0xa021a, 0xa021c, - 0xa021e, 0xa0220, 0xa0222, 0xa0224, 0xa0226, 0xa0228, 0xa022a, 0xa022c, 0xa022e, - 0xa0230, 0xa0232, 0xa023a, 0xa023b, 0xa023d, 0xa023e, 0xa0241, 0xa0248, 0xa024a, - 0xa024c, 0xa024e, 0xa0370, 0xa0372, 0xa0376, 0xa037f, 0xa0386, 0xa038c, 0xa038e, - 0xa038f, 0xa03cf, 0xa03d8, 0xa03da, 0xa03dc, 0xa03de, 0xa03e0, 0xa03e2, 0xa03e4, - 0xa03e6, 0xa03e8, 0xa03ea, 0xa03ec, 0xa03ee, 0xa03f4, 0xa03f7, 0xa03f9, 0xa03fa, - 0xa0460, 0xa0462, 0xa0464, 0xa0466, 0xa0468, 0xa046a, 0xa046c, 0xa046e, 0xa0470, - 0xa0472, 0xa0474, 0xa0476, 0xa0478, 0xa047a, 0xa047c, 0xa047e, 0xa0480, 0xa048a, - 0xa048c, 0xa048e, 0xa0490, 0xa0492, 0xa0494, 0xa0496, 0xa0498, 0xa049a, 0xa049c, - 0xa049e, 0xa04a0, 0xa04a2, 0xa04a4, 0xa04a6, 0xa04a8, 0xa04aa, 0xa04ac, 0xa04ae, - 0xa04b0, 0xa04b2, 0xa04b4, 0xa04b6, 0xa04b8, 0xa04ba, 0xa04bc, 0xa04be, 0xa04c0, - 0xa04c1, 0xa04c3, 0xa04c5, 0xa04c7, 0xa04c9, 0xa04cb, 0xa04cd, 0xa04d0, 0xa04d2, - 0xa04d4, 0xa04d6, 0xa04d8, 0xa04da, 0xa04dc, 0xa04de, 0xa04e0, 0xa04e2, 0xa04e4, - 0xa04e6, 0xa04e8, 0xa04ea, 0xa04ec, 0xa04ee, 0xa04f0, 0xa04f2, 0xa04f4, 0xa04f6, - 0xa04f8, 0xa04fa, 0xa04fc, 0xa04fe, 0xa0500, 0xa0502, 0xa0504, 0xa0506, 0xa0508, - 0xa050a, 0xa050c, 0xa050e, 0xa0510, 0xa0512, 0xa0514, 0xa0516, 0xa0518, 0xa051a, - 0xa051c, 0xa051e, 0xa0520, 0xa0522, 0xa0524, 0xa0526, 0xa0528, 0xa052a, 0xa052c, - 0xa052e, 0xa10c7, 0xa10cd, 0xa1e00, 0xa1e02, 0xa1e04, 0xa1e06, 0xa1e08, 0xa1e0a, - 0xa1e0c, 0xa1e0e, 0xa1e10, 0xa1e12, 0xa1e14, 0xa1e16, 0xa1e18, 0xa1e1a, 0xa1e1c, - 0xa1e1e, 0xa1e20, 0xa1e22, 0xa1e24, 0xa1e26, 0xa1e28, 0xa1e2a, 0xa1e2c, 0xa1e2e, - 0xa1e30, 0xa1e32, 0xa1e34, 0xa1e36, 0xa1e38, 0xa1e3a, 0xa1e3c, 0xa1e3e, 0xa1e40, - 0xa1e42, 0xa1e44, 0xa1e46, 0xa1e48, 0xa1e4a, 0xa1e4c, 0xa1e4e, 0xa1e50, 0xa1e52, - 0xa1e54, 0xa1e56, 0xa1e58, 0xa1e5a, 0xa1e5c, 0xa1e5e, 0xa1e60, 0xa1e62, 0xa1e64, - 0xa1e66, 0xa1e68, 0xa1e6a, 0xa1e6c, 0xa1e6e, 0xa1e70, 0xa1e72, 0xa1e74, 0xa1e76, - 0xa1e78, 0xa1e7a, 0xa1e7c, 0xa1e7e, 0xa1e80, 0xa1e82, 0xa1e84, 0xa1e86, 0xa1e88, - 0xa1e8a, 0xa1e8c, 0xa1e8e, 0xa1e90, 0xa1e92, 0xa1e94, 0xa1e9e, 0xa1ea0, 0xa1ea2, - 0xa1ea4, 0xa1ea6, 0xa1ea8, 0xa1eaa, 0xa1eac, 0xa1eae, 0xa1eb0, 0xa1eb2, 0xa1eb4, - 0xa1eb6, 0xa1eb8, 0xa1eba, 0xa1ebc, 0xa1ebe, 0xa1ec0, 0xa1ec2, 0xa1ec4, 0xa1ec6, - 0xa1ec8, 0xa1eca, 0xa1ecc, 0xa1ece, 0xa1ed0, 0xa1ed2, 0xa1ed4, 0xa1ed6, 0xa1ed8, - 0xa1eda, 0xa1edc, 0xa1ede, 0xa1ee0, 0xa1ee2, 0xa1ee4, 0xa1ee6, 0xa1ee8, 0xa1eea, - 0xa1eec, 0xa1eee, 0xa1ef0, 0xa1ef2, 0xa1ef4, 0xa1ef6, 0xa1ef8, 0xa1efa, 0xa1efc, - 0xa1efe, 0xa1f59, 0xa1f5b, 0xa1f5d, 0xa1f5f, 0xa2102, 0xa2107, 0xa2115, 0xa2124, - 0xa2126, 0xa2128, 0xa213e, 0xa213f, 0xa2145, 0xa2183, 0xa2c60, 0xa2c67, 0xa2c69, - 0xa2c6b, 0xa2c72, 0xa2c75, 0xa2c82, 0xa2c84, 0xa2c86, 0xa2c88, 0xa2c8a, 0xa2c8c, - 0xa2c8e, 0xa2c90, 0xa2c92, 0xa2c94, 0xa2c96, 0xa2c98, 0xa2c9a, 0xa2c9c, 0xa2c9e, - 0xa2ca0, 0xa2ca2, 0xa2ca4, 0xa2ca6, 0xa2ca8, 0xa2caa, 0xa2cac, 0xa2cae, 0xa2cb0, - 0xa2cb2, 0xa2cb4, 0xa2cb6, 0xa2cb8, 0xa2cba, 0xa2cbc, 0xa2cbe, 0xa2cc0, 0xa2cc2, - 0xa2cc4, 0xa2cc6, 0xa2cc8, 0xa2cca, 0xa2ccc, 0xa2cce, 0xa2cd0, 0xa2cd2, 0xa2cd4, - 0xa2cd6, 0xa2cd8, 0xa2cda, 0xa2cdc, 0xa2cde, 0xa2ce0, 0xa2ce2, 0xa2ceb, 0xa2ced, - 0xa2cf2, 0xaa640, 0xaa642, 0xaa644, 0xaa646, 0xaa648, 0xaa64a, 0xaa64c, 0xaa64e, - 0xaa650, 0xaa652, 0xaa654, 0xaa656, 0xaa658, 0xaa65a, 0xaa65c, 0xaa65e, 0xaa660, - 0xaa662, 0xaa664, 0xaa666, 0xaa668, 0xaa66a, 0xaa66c, 0xaa680, 0xaa682, 0xaa684, - 0xaa686, 0xaa688, 0xaa68a, 0xaa68c, 0xaa68e, 0xaa690, 0xaa692, 0xaa694, 0xaa696, - 0xaa698, 0xaa69a, 0xaa722, 0xaa724, 0xaa726, 0xaa728, 0xaa72a, 0xaa72c, 0xaa72e, - 0xaa732, 0xaa734, 0xaa736, 0xaa738, 0xaa73a, 0xaa73c, 0xaa73e, 0xaa740, 0xaa742, - 0xaa744, 0xaa746, 0xaa748, 0xaa74a, 0xaa74c, 0xaa74e, 0xaa750, 0xaa752, 0xaa754, - 0xaa756, 0xaa758, 0xaa75a, 0xaa75c, 0xaa75e, 0xaa760, 0xaa762, 0xaa764, 0xaa766, - 0xaa768, 0xaa76a, 0xaa76c, 0xaa76e, 0xaa779, 0xaa77b, 0xaa77d, 0xaa77e, 0xaa780, - 0xaa782, 0xaa784, 0xaa786, 0xaa78b, 0xaa78d, 0xaa790, 0xaa792, 0xaa796, 0xaa798, - 0xaa79a, 0xaa79c, 0xaa79e, 0xaa7a0, 0xaa7a2, 0xaa7a4, 0xaa7a6, 0xaa7a8, 0xaa7b6, - 0xb0100, 0xb0102, 0xb0104, 0xb0106, 0xb0108, 0xb010a, 0xb010c, 0xb010e, 0xb0110, - 0xb0112, 0xb0114, 0xb0116, 0xb0118, 0xb011a, 0xb011c, 0xb011e, 0xb0120, 0xb0122, - 0xb0124, 0xb0126, 0xb0128, 0xb012a, 0xb012c, 0xb012e, 0xb0130, 0xb0132, 0xb0134, - 0xb0136, 0xb0139, 0xb013b, 0xb013d, 0xb013f, 0xb0141, 0xb0143, 0xb0145, 0xb0147, - 0xb014a, 0xb014c, 0xb014e, 0xb0150, 0xb0152, 0xb0154, 0xb0156, 0xb0158, 0xb015a, - 0xb015c, 0xb015e, 0xb0160, 0xb0162, 0xb0164, 0xb0166, 0xb0168, 0xb016a, 0xb016c, - 0xb016e, 0xb0170, 0xb0172, 0xb0174, 0xb0176, 0xb0178, 0xb0179, 0xb017b, 0xb017d, - 0xb0181, 0xb0182, 0xb0184, 0xb0186, 0xb0187, 0xb0193, 0xb0194, 0xb019c, 0xb019d, - 0xb019f, 0xb01a0, 0xb01a2, 0xb01a4, 0xb01a6, 0xb01a7, 0xb01a9, 0xb01ac, 0xb01ae, - 0xb01af, 0xb01b5, 0xb01b7, 0xb01b8, 0xb01bc, 0xb01c4, 0xb01c7, 0xb01ca, 0xb01cd, - 0xb01cf, 0xb01d1, 0xb01d3, 0xb01d5, 0xb01d7, 0xb01d9, 0xb01db, 0xb01de, 0xb01e0, - 0xb01e2, 0xb01e4, 0xb01e6, 0xb01e8, 0xb01ea, 0xb01ec, 0xb01ee, 0xb01f1, 0xb01f4, - 0xb01fa, 0xb01fc, 0xb01fe, 0xb0200, 0xb0202, 0xb0204, 0xb0206, 0xb0208, 0xb020a, - 0xb020c, 0xb020e, 0xb0210, 0xb0212, 0xb0214, 0xb0216, 0xb0218, 0xb021a, 0xb021c, - 0xb021e, 0xb0220, 0xb0222, 0xb0224, 0xb0226, 0xb0228, 0xb022a, 0xb022c, 0xb022e, - 0xb0230, 0xb0232, 0xb023a, 0xb023b, 0xb023d, 0xb023e, 0xb0241, 0xb0248, 0xb024a, - 0xb024c, 0xb024e, 0xb0370, 0xb0372, 0xb0376, 0xb037f, 0xb0386, 0xb038c, 0xb038e, - 0xb038f, 0xb03cf, 0xb03d8, 0xb03da, 0xb03dc, 0xb03de, 0xb03e0, 0xb03e2, 0xb03e4, - 0xb03e6, 0xb03e8, 0xb03ea, 0xb03ec, 0xb03ee, 0xb03f4, 0xb03f7, 0xb03f9, 0xb03fa, - 0xb0460, 0xb0462, 0xb0464, 0xb0466, 0xb0468, 0xb046a, 0xb046c, 0xb046e, 0xb0470, - 0xb0472, 0xb0474, 0xb0476, 0xb0478, 0xb047a, 0xb047c, 0xb047e, 0xb0480, 0xb048a, - 0xb048c, 0xb048e, 0xb0490, 0xb0492, 0xb0494, 0xb0496, 0xb0498, 0xb049a, 0xb049c, - 0xb049e, 0xb04a0, 0xb04a2, 0xb04a4, 0xb04a6, 0xb04a8, 0xb04aa, 0xb04ac, 0xb04ae, - 0xb04b0, 0xb04b2, 0xb04b4, 0xb04b6, 0xb04b8, 0xb04ba, 0xb04bc, 0xb04be, 0xb04c0, - 0xb04c1, 0xb04c3, 0xb04c5, 0xb04c7, 0xb04c9, 0xb04cb, 0xb04cd, 0xb04d0, 0xb04d2, - 0xb04d4, 0xb04d6, 0xb04d8, 0xb04da, 0xb04dc, 0xb04de, 0xb04e0, 0xb04e2, 0xb04e4, - 0xb04e6, 0xb04e8, 0xb04ea, 0xb04ec, 0xb04ee, 0xb04f0, 0xb04f2, 0xb04f4, 0xb04f6, - 0xb04f8, 0xb04fa, 0xb04fc, 0xb04fe, 0xb0500, 0xb0502, 0xb0504, 0xb0506, 0xb0508, - 0xb050a, 0xb050c, 0xb050e, 0xb0510, 0xb0512, 0xb0514, 0xb0516, 0xb0518, 0xb051a, - 0xb051c, 0xb051e, 0xb0520, 0xb0522, 0xb0524, 0xb0526, 0xb0528, 0xb052a, 0xb052c, - 0xb052e, 0xb10c7, 0xb10cd, 0xb1e00, 0xb1e02, 0xb1e04, 0xb1e06, 0xb1e08, 0xb1e0a, - 0xb1e0c, 0xb1e0e, 0xb1e10, 0xb1e12, 0xb1e14, 0xb1e16, 0xb1e18, 0xb1e1a, 0xb1e1c, - 0xb1e1e, 0xb1e20, 0xb1e22, 0xb1e24, 0xb1e26, 0xb1e28, 0xb1e2a, 0xb1e2c, 0xb1e2e, - 0xb1e30, 0xb1e32, 0xb1e34, 0xb1e36, 0xb1e38, 0xb1e3a, 0xb1e3c, 0xb1e3e, 0xb1e40, - 0xb1e42, 0xb1e44, 0xb1e46, 0xb1e48, 0xb1e4a, 0xb1e4c, 0xb1e4e, 0xb1e50, 0xb1e52, - 0xb1e54, 0xb1e56, 0xb1e58, 0xb1e5a, 0xb1e5c, 0xb1e5e, 0xb1e60, 0xb1e62, 0xb1e64, - 0xb1e66, 0xb1e68, 0xb1e6a, 0xb1e6c, 0xb1e6e, 0xb1e70, 0xb1e72, 0xb1e74, 0xb1e76, - 0xb1e78, 0xb1e7a, 0xb1e7c, 0xb1e7e, 0xb1e80, 0xb1e82, 0xb1e84, 0xb1e86, 0xb1e88, - 0xb1e8a, 0xb1e8c, 0xb1e8e, 0xb1e90, 0xb1e92, 0xb1e94, 0xb1e9e, 0xb1ea0, 0xb1ea2, - 0xb1ea4, 0xb1ea6, 0xb1ea8, 0xb1eaa, 0xb1eac, 0xb1eae, 0xb1eb0, 0xb1eb2, 0xb1eb4, - 0xb1eb6, 0xb1eb8, 0xb1eba, 0xb1ebc, 0xb1ebe, 0xb1ec0, 0xb1ec2, 0xb1ec4, 0xb1ec6, - 0xb1ec8, 0xb1eca, 0xb1ecc, 0xb1ece, 0xb1ed0, 0xb1ed2, 0xb1ed4, 0xb1ed6, 0xb1ed8, - 0xb1eda, 0xb1edc, 0xb1ede, 0xb1ee0, 0xb1ee2, 0xb1ee4, 0xb1ee6, 0xb1ee8, 0xb1eea, - 0xb1eec, 0xb1eee, 0xb1ef0, 0xb1ef2, 0xb1ef4, 0xb1ef6, 0xb1ef8, 0xb1efa, 0xb1efc, - 0xb1efe, 0xb1f59, 0xb1f5b, 0xb1f5d, 0xb1f5f, 0xb2102, 0xb2107, 0xb2115, 0xb2124, - 0xb2126, 0xb2128, 0xb213e, 0xb213f, 0xb2145, 0xb2183, 0xb2c60, 0xb2c67, 0xb2c69, - 0xb2c6b, 0xb2c72, 0xb2c75, 0xb2c82, 0xb2c84, 0xb2c86, 0xb2c88, 0xb2c8a, 0xb2c8c, - 0xb2c8e, 0xb2c90, 0xb2c92, 0xb2c94, 0xb2c96, 0xb2c98, 0xb2c9a, 0xb2c9c, 0xb2c9e, - 0xb2ca0, 0xb2ca2, 0xb2ca4, 0xb2ca6, 0xb2ca8, 0xb2caa, 0xb2cac, 0xb2cae, 0xb2cb0, - 0xb2cb2, 0xb2cb4, 0xb2cb6, 0xb2cb8, 0xb2cba, 0xb2cbc, 0xb2cbe, 0xb2cc0, 0xb2cc2, - 0xb2cc4, 0xb2cc6, 0xb2cc8, 0xb2cca, 0xb2ccc, 0xb2cce, 0xb2cd0, 0xb2cd2, 0xb2cd4, - 0xb2cd6, 0xb2cd8, 0xb2cda, 0xb2cdc, 0xb2cde, 0xb2ce0, 0xb2ce2, 0xb2ceb, 0xb2ced, - 0xb2cf2, 0xba640, 0xba642, 0xba644, 0xba646, 0xba648, 0xba64a, 0xba64c, 0xba64e, - 0xba650, 0xba652, 0xba654, 0xba656, 0xba658, 0xba65a, 0xba65c, 0xba65e, 0xba660, - 0xba662, 0xba664, 0xba666, 0xba668, 0xba66a, 0xba66c, 0xba680, 0xba682, 0xba684, - 0xba686, 0xba688, 0xba68a, 0xba68c, 0xba68e, 0xba690, 0xba692, 0xba694, 0xba696, - 0xba698, 0xba69a, 0xba722, 0xba724, 0xba726, 0xba728, 0xba72a, 0xba72c, 0xba72e, - 0xba732, 0xba734, 0xba736, 0xba738, 0xba73a, 0xba73c, 0xba73e, 0xba740, 0xba742, - 0xba744, 0xba746, 0xba748, 0xba74a, 0xba74c, 0xba74e, 0xba750, 0xba752, 0xba754, - 0xba756, 0xba758, 0xba75a, 0xba75c, 0xba75e, 0xba760, 0xba762, 0xba764, 0xba766, - 0xba768, 0xba76a, 0xba76c, 0xba76e, 0xba779, 0xba77b, 0xba77d, 0xba77e, 0xba780, - 0xba782, 0xba784, 0xba786, 0xba78b, 0xba78d, 0xba790, 0xba792, 0xba796, 0xba798, - 0xba79a, 0xba79c, 0xba79e, 0xba7a0, 0xba7a2, 0xba7a4, 0xba7a6, 0xba7a8, 0xba7b6, - 0xc0100, 0xc0102, 0xc0104, 0xc0106, 0xc0108, 0xc010a, 0xc010c, 0xc010e, 0xc0110, - 0xc0112, 0xc0114, 0xc0116, 0xc0118, 0xc011a, 0xc011c, 0xc011e, 0xc0120, 0xc0122, - 0xc0124, 0xc0126, 0xc0128, 0xc012a, 0xc012c, 0xc012e, 0xc0130, 0xc0132, 0xc0134, - 0xc0136, 0xc0139, 0xc013b, 0xc013d, 0xc013f, 0xc0141, 0xc0143, 0xc0145, 0xc0147, - 0xc014a, 0xc014c, 0xc014e, 0xc0150, 0xc0152, 0xc0154, 0xc0156, 0xc0158, 0xc015a, - 0xc015c, 0xc015e, 0xc0160, 0xc0162, 0xc0164, 0xc0166, 0xc0168, 0xc016a, 0xc016c, - 0xc016e, 0xc0170, 0xc0172, 0xc0174, 0xc0176, 0xc0178, 0xc0179, 0xc017b, 0xc017d, - 0xc0181, 0xc0182, 0xc0184, 0xc0186, 0xc0187, 0xc0193, 0xc0194, 0xc019c, 0xc019d, - 0xc019f, 0xc01a0, 0xc01a2, 0xc01a4, 0xc01a6, 0xc01a7, 0xc01a9, 0xc01ac, 0xc01ae, - 0xc01af, 0xc01b5, 0xc01b7, 0xc01b8, 0xc01bc, 0xc01c4, 0xc01c7, 0xc01ca, 0xc01cd, - 0xc01cf, 0xc01d1, 0xc01d3, 0xc01d5, 0xc01d7, 0xc01d9, 0xc01db, 0xc01de, 0xc01e0, - 0xc01e2, 0xc01e4, 0xc01e6, 0xc01e8, 0xc01ea, 0xc01ec, 0xc01ee, 0xc01f1, 0xc01f4, - 0xc01fa, 0xc01fc, 0xc01fe, 0xc0200, 0xc0202, 0xc0204, 0xc0206, 0xc0208, 0xc020a, - 0xc020c, 0xc020e, 0xc0210, 0xc0212, 0xc0214, 0xc0216, 0xc0218, 0xc021a, 0xc021c, - 0xc021e, 0xc0220, 0xc0222, 0xc0224, 0xc0226, 0xc0228, 0xc022a, 0xc022c, 0xc022e, - 0xc0230, 0xc0232, 0xc023a, 0xc023b, 0xc023d, 0xc023e, 0xc0241, 0xc0248, 0xc024a, - 0xc024c, 0xc024e, 0xc0370, 0xc0372, 0xc0376, 0xc037f, 0xc0386, 0xc038c, 0xc038e, - 0xc038f, 0xc03cf, 0xc03d8, 0xc03da, 0xc03dc, 0xc03de, 0xc03e0, 0xc03e2, 0xc03e4, - 0xc03e6, 0xc03e8, 0xc03ea, 0xc03ec, 0xc03ee, 0xc03f4, 0xc03f7, 0xc03f9, 0xc03fa, - 0xc0460, 0xc0462, 0xc0464, 0xc0466, 0xc0468, 0xc046a, 0xc046c, 0xc046e, 0xc0470, - 0xc0472, 0xc0474, 0xc0476, 0xc0478, 0xc047a, 0xc047c, 0xc047e, 0xc0480, 0xc048a, - 0xc048c, 0xc048e, 0xc0490, 0xc0492, 0xc0494, 0xc0496, 0xc0498, 0xc049a, 0xc049c, - 0xc049e, 0xc04a0, 0xc04a2, 0xc04a4, 0xc04a6, 0xc04a8, 0xc04aa, 0xc04ac, 0xc04ae, - 0xc04b0, 0xc04b2, 0xc04b4, 0xc04b6, 0xc04b8, 0xc04ba, 0xc04bc, 0xc04be, 0xc04c0, - 0xc04c1, 0xc04c3, 0xc04c5, 0xc04c7, 0xc04c9, 0xc04cb, 0xc04cd, 0xc04d0, 0xc04d2, - 0xc04d4, 0xc04d6, 0xc04d8, 0xc04da, 0xc04dc, 0xc04de, 0xc04e0, 0xc04e2, 0xc04e4, - 0xc04e6, 0xc04e8, 0xc04ea, 0xc04ec, 0xc04ee, 0xc04f0, 0xc04f2, 0xc04f4, 0xc04f6, - 0xc04f8, 0xc04fa, 0xc04fc, 0xc04fe, 0xc0500, 0xc0502, 0xc0504, 0xc0506, 0xc0508, - 0xc050a, 0xc050c, 0xc050e, 0xc0510, 0xc0512, 0xc0514, 0xc0516, 0xc0518, 0xc051a, - 0xc051c, 0xc051e, 0xc0520, 0xc0522, 0xc0524, 0xc0526, 0xc0528, 0xc052a, 0xc052c, - 0xc052e, 0xc10c7, 0xc10cd, 0xc1e00, 0xc1e02, 0xc1e04, 0xc1e06, 0xc1e08, 0xc1e0a, - 0xc1e0c, 0xc1e0e, 0xc1e10, 0xc1e12, 0xc1e14, 0xc1e16, 0xc1e18, 0xc1e1a, 0xc1e1c, - 0xc1e1e, 0xc1e20, 0xc1e22, 0xc1e24, 0xc1e26, 0xc1e28, 0xc1e2a, 0xc1e2c, 0xc1e2e, - 0xc1e30, 0xc1e32, 0xc1e34, 0xc1e36, 0xc1e38, 0xc1e3a, 0xc1e3c, 0xc1e3e, 0xc1e40, - 0xc1e42, 0xc1e44, 0xc1e46, 0xc1e48, 0xc1e4a, 0xc1e4c, 0xc1e4e, 0xc1e50, 0xc1e52, - 0xc1e54, 0xc1e56, 0xc1e58, 0xc1e5a, 0xc1e5c, 0xc1e5e, 0xc1e60, 0xc1e62, 0xc1e64, - 0xc1e66, 0xc1e68, 0xc1e6a, 0xc1e6c, 0xc1e6e, 0xc1e70, 0xc1e72, 0xc1e74, 0xc1e76, - 0xc1e78, 0xc1e7a, 0xc1e7c, 0xc1e7e, 0xc1e80, 0xc1e82, 0xc1e84, 0xc1e86, 0xc1e88, - 0xc1e8a, 0xc1e8c, 0xc1e8e, 0xc1e90, 0xc1e92, 0xc1e94, 0xc1e9e, 0xc1ea0, 0xc1ea2, - 0xc1ea4, 0xc1ea6, 0xc1ea8, 0xc1eaa, 0xc1eac, 0xc1eae, 0xc1eb0, 0xc1eb2, 0xc1eb4, - 0xc1eb6, 0xc1eb8, 0xc1eba, 0xc1ebc, 0xc1ebe, 0xc1ec0, 0xc1ec2, 0xc1ec4, 0xc1ec6, - 0xc1ec8, 0xc1eca, 0xc1ecc, 0xc1ece, 0xc1ed0, 0xc1ed2, 0xc1ed4, 0xc1ed6, 0xc1ed8, - 0xc1eda, 0xc1edc, 0xc1ede, 0xc1ee0, 0xc1ee2, 0xc1ee4, 0xc1ee6, 0xc1ee8, 0xc1eea, - 0xc1eec, 0xc1eee, 0xc1ef0, 0xc1ef2, 0xc1ef4, 0xc1ef6, 0xc1ef8, 0xc1efa, 0xc1efc, - 0xc1efe, 0xc1f59, 0xc1f5b, 0xc1f5d, 0xc1f5f, 0xc2102, 0xc2107, 0xc2115, 0xc2124, - 0xc2126, 0xc2128, 0xc213e, 0xc213f, 0xc2145, 0xc2183, 0xc2c60, 0xc2c67, 0xc2c69, - 0xc2c6b, 0xc2c72, 0xc2c75, 0xc2c82, 0xc2c84, 0xc2c86, 0xc2c88, 0xc2c8a, 0xc2c8c, - 0xc2c8e, 0xc2c90, 0xc2c92, 0xc2c94, 0xc2c96, 0xc2c98, 0xc2c9a, 0xc2c9c, 0xc2c9e, - 0xc2ca0, 0xc2ca2, 0xc2ca4, 0xc2ca6, 0xc2ca8, 0xc2caa, 0xc2cac, 0xc2cae, 0xc2cb0, - 0xc2cb2, 0xc2cb4, 0xc2cb6, 0xc2cb8, 0xc2cba, 0xc2cbc, 0xc2cbe, 0xc2cc0, 0xc2cc2, - 0xc2cc4, 0xc2cc6, 0xc2cc8, 0xc2cca, 0xc2ccc, 0xc2cce, 0xc2cd0, 0xc2cd2, 0xc2cd4, - 0xc2cd6, 0xc2cd8, 0xc2cda, 0xc2cdc, 0xc2cde, 0xc2ce0, 0xc2ce2, 0xc2ceb, 0xc2ced, - 0xc2cf2, 0xca640, 0xca642, 0xca644, 0xca646, 0xca648, 0xca64a, 0xca64c, 0xca64e, - 0xca650, 0xca652, 0xca654, 0xca656, 0xca658, 0xca65a, 0xca65c, 0xca65e, 0xca660, - 0xca662, 0xca664, 0xca666, 0xca668, 0xca66a, 0xca66c, 0xca680, 0xca682, 0xca684, - 0xca686, 0xca688, 0xca68a, 0xca68c, 0xca68e, 0xca690, 0xca692, 0xca694, 0xca696, - 0xca698, 0xca69a, 0xca722, 0xca724, 0xca726, 0xca728, 0xca72a, 0xca72c, 0xca72e, - 0xca732, 0xca734, 0xca736, 0xca738, 0xca73a, 0xca73c, 0xca73e, 0xca740, 0xca742, - 0xca744, 0xca746, 0xca748, 0xca74a, 0xca74c, 0xca74e, 0xca750, 0xca752, 0xca754, - 0xca756, 0xca758, 0xca75a, 0xca75c, 0xca75e, 0xca760, 0xca762, 0xca764, 0xca766, - 0xca768, 0xca76a, 0xca76c, 0xca76e, 0xca779, 0xca77b, 0xca77d, 0xca77e, 0xca780, - 0xca782, 0xca784, 0xca786, 0xca78b, 0xca78d, 0xca790, 0xca792, 0xca796, 0xca798, - 0xca79a, 0xca79c, 0xca79e, 0xca7a0, 0xca7a2, 0xca7a4, 0xca7a6, 0xca7a8, 0xca7b6, - 0xd0100, 0xd0102, 0xd0104, 0xd0106, 0xd0108, 0xd010a, 0xd010c, 0xd010e, 0xd0110, - 0xd0112, 0xd0114, 0xd0116, 0xd0118, 0xd011a, 0xd011c, 0xd011e, 0xd0120, 0xd0122, - 0xd0124, 0xd0126, 0xd0128, 0xd012a, 0xd012c, 0xd012e, 0xd0130, 0xd0132, 0xd0134, - 0xd0136, 0xd0139, 0xd013b, 0xd013d, 0xd013f, 0xd0141, 0xd0143, 0xd0145, 0xd0147, - 0xd014a, 0xd014c, 0xd014e, 0xd0150, 0xd0152, 0xd0154, 0xd0156, 0xd0158, 0xd015a, - 0xd015c, 0xd015e, 0xd0160, 0xd0162, 0xd0164, 0xd0166, 0xd0168, 0xd016a, 0xd016c, - 0xd016e, 0xd0170, 0xd0172, 0xd0174, 0xd0176, 0xd0178, 0xd0179, 0xd017b, 0xd017d, - 0xd0181, 0xd0182, 0xd0184, 0xd0186, 0xd0187, 0xd0193, 0xd0194, 0xd019c, 0xd019d, - 0xd019f, 0xd01a0, 0xd01a2, 0xd01a4, 0xd01a6, 0xd01a7, 0xd01a9, 0xd01ac, 0xd01ae, - 0xd01af, 0xd01b5, 0xd01b7, 0xd01b8, 0xd01bc, 0xd01c4, 0xd01c7, 0xd01ca, 0xd01cd, - 0xd01cf, 0xd01d1, 0xd01d3, 0xd01d5, 0xd01d7, 0xd01d9, 0xd01db, 0xd01de, 0xd01e0, - 0xd01e2, 0xd01e4, 0xd01e6, 0xd01e8, 0xd01ea, 0xd01ec, 0xd01ee, 0xd01f1, 0xd01f4, - 0xd01fa, 0xd01fc, 0xd01fe, 0xd0200, 0xd0202, 0xd0204, 0xd0206, 0xd0208, 0xd020a, - 0xd020c, 0xd020e, 0xd0210, 0xd0212, 0xd0214, 0xd0216, 0xd0218, 0xd021a, 0xd021c, - 0xd021e, 0xd0220, 0xd0222, 0xd0224, 0xd0226, 0xd0228, 0xd022a, 0xd022c, 0xd022e, - 0xd0230, 0xd0232, 0xd023a, 0xd023b, 0xd023d, 0xd023e, 0xd0241, 0xd0248, 0xd024a, - 0xd024c, 0xd024e, 0xd0370, 0xd0372, 0xd0376, 0xd037f, 0xd0386, 0xd038c, 0xd038e, - 0xd038f, 0xd03cf, 0xd03d8, 0xd03da, 0xd03dc, 0xd03de, 0xd03e0, 0xd03e2, 0xd03e4, - 0xd03e6, 0xd03e8, 0xd03ea, 0xd03ec, 0xd03ee, 0xd03f4, 0xd03f7, 0xd03f9, 0xd03fa, - 0xd0460, 0xd0462, 0xd0464, 0xd0466, 0xd0468, 0xd046a, 0xd046c, 0xd046e, 0xd0470, - 0xd0472, 0xd0474, 0xd0476, 0xd0478, 0xd047a, 0xd047c, 0xd047e, 0xd0480, 0xd048a, - 0xd048c, 0xd048e, 0xd0490, 0xd0492, 0xd0494, 0xd0496, 0xd0498, 0xd049a, 0xd049c, - 0xd049e, 0xd04a0, 0xd04a2, 0xd04a4, 0xd04a6, 0xd04a8, 0xd04aa, 0xd04ac, 0xd04ae, - 0xd04b0, 0xd04b2, 0xd04b4, 0xd04b6, 0xd04b8, 0xd04ba, 0xd04bc, 0xd04be, 0xd04c0, - 0xd04c1, 0xd04c3, 0xd04c5, 0xd04c7, 0xd04c9, 0xd04cb, 0xd04cd, 0xd04d0, 0xd04d2, - 0xd04d4, 0xd04d6, 0xd04d8, 0xd04da, 0xd04dc, 0xd04de, 0xd04e0, 0xd04e2, 0xd04e4, - 0xd04e6, 0xd04e8, 0xd04ea, 0xd04ec, 0xd04ee, 0xd04f0, 0xd04f2, 0xd04f4, 0xd04f6, - 0xd04f8, 0xd04fa, 0xd04fc, 0xd04fe, 0xd0500, 0xd0502, 0xd0504, 0xd0506, 0xd0508, - 0xd050a, 0xd050c, 0xd050e, 0xd0510, 0xd0512, 0xd0514, 0xd0516, 0xd0518, 0xd051a, - 0xd051c, 0xd051e, 0xd0520, 0xd0522, 0xd0524, 0xd0526, 0xd0528, 0xd052a, 0xd052c, - 0xd052e, 0xd10c7, 0xd10cd, 0xd1e00, 0xd1e02, 0xd1e04, 0xd1e06, 0xd1e08, 0xd1e0a, - 0xd1e0c, 0xd1e0e, 0xd1e10, 0xd1e12, 0xd1e14, 0xd1e16, 0xd1e18, 0xd1e1a, 0xd1e1c, - 0xd1e1e, 0xd1e20, 0xd1e22, 0xd1e24, 0xd1e26, 0xd1e28, 0xd1e2a, 0xd1e2c, 0xd1e2e, - 0xd1e30, 0xd1e32, 0xd1e34, 0xd1e36, 0xd1e38, 0xd1e3a, 0xd1e3c, 0xd1e3e, 0xd1e40, - 0xd1e42, 0xd1e44, 0xd1e46, 0xd1e48, 0xd1e4a, 0xd1e4c, 0xd1e4e, 0xd1e50, 0xd1e52, - 0xd1e54, 0xd1e56, 0xd1e58, 0xd1e5a, 0xd1e5c, 0xd1e5e, 0xd1e60, 0xd1e62, 0xd1e64, - 0xd1e66, 0xd1e68, 0xd1e6a, 0xd1e6c, 0xd1e6e, 0xd1e70, 0xd1e72, 0xd1e74, 0xd1e76, - 0xd1e78, 0xd1e7a, 0xd1e7c, 0xd1e7e, 0xd1e80, 0xd1e82, 0xd1e84, 0xd1e86, 0xd1e88, - 0xd1e8a, 0xd1e8c, 0xd1e8e, 0xd1e90, 0xd1e92, 0xd1e94, 0xd1e9e, 0xd1ea0, 0xd1ea2, - 0xd1ea4, 0xd1ea6, 0xd1ea8, 0xd1eaa, 0xd1eac, 0xd1eae, 0xd1eb0, 0xd1eb2, 0xd1eb4, - 0xd1eb6, 0xd1eb8, 0xd1eba, 0xd1ebc, 0xd1ebe, 0xd1ec0, 0xd1ec2, 0xd1ec4, 0xd1ec6, - 0xd1ec8, 0xd1eca, 0xd1ecc, 0xd1ece, 0xd1ed0, 0xd1ed2, 0xd1ed4, 0xd1ed6, 0xd1ed8, - 0xd1eda, 0xd1edc, 0xd1ede, 0xd1ee0, 0xd1ee2, 0xd1ee4, 0xd1ee6, 0xd1ee8, 0xd1eea, - 0xd1eec, 0xd1eee, 0xd1ef0, 0xd1ef2, 0xd1ef4, 0xd1ef6, 0xd1ef8, 0xd1efa, 0xd1efc, - 0xd1efe, 0xd1f59, 0xd1f5b, 0xd1f5d, 0xd1f5f, 0xd2102, 0xd2107, 0xd2115, 0xd2124, - 0xd2126, 0xd2128, 0xd213e, 0xd213f, 0xd2145, 0xd2183, 0xd2c60, 0xd2c67, 0xd2c69, - 0xd2c6b, 0xd2c72, 0xd2c75, 0xd2c82, 0xd2c84, 0xd2c86, 0xd2c88, 0xd2c8a, 0xd2c8c, - 0xd2c8e, 0xd2c90, 0xd2c92, 0xd2c94, 0xd2c96, 0xd2c98, 0xd2c9a, 0xd2c9c, 0xd2c9e, - 0xd2ca0, 0xd2ca2, 0xd2ca4, 0xd2ca6, 0xd2ca8, 0xd2caa, 0xd2cac, 0xd2cae, 0xd2cb0, - 0xd2cb2, 0xd2cb4, 0xd2cb6, 0xd2cb8, 0xd2cba, 0xd2cbc, 0xd2cbe, 0xd2cc0, 0xd2cc2, - 0xd2cc4, 0xd2cc6, 0xd2cc8, 0xd2cca, 0xd2ccc, 0xd2cce, 0xd2cd0, 0xd2cd2, 0xd2cd4, - 0xd2cd6, 0xd2cd8, 0xd2cda, 0xd2cdc, 0xd2cde, 0xd2ce0, 0xd2ce2, 0xd2ceb, 0xd2ced, - 0xd2cf2, 0xda640, 0xda642, 0xda644, 0xda646, 0xda648, 0xda64a, 0xda64c, 0xda64e, - 0xda650, 0xda652, 0xda654, 0xda656, 0xda658, 0xda65a, 0xda65c, 0xda65e, 0xda660, - 0xda662, 0xda664, 0xda666, 0xda668, 0xda66a, 0xda66c, 0xda680, 0xda682, 0xda684, - 0xda686, 0xda688, 0xda68a, 0xda68c, 0xda68e, 0xda690, 0xda692, 0xda694, 0xda696, - 0xda698, 0xda69a, 0xda722, 0xda724, 0xda726, 0xda728, 0xda72a, 0xda72c, 0xda72e, - 0xda732, 0xda734, 0xda736, 0xda738, 0xda73a, 0xda73c, 0xda73e, 0xda740, 0xda742, - 0xda744, 0xda746, 0xda748, 0xda74a, 0xda74c, 0xda74e, 0xda750, 0xda752, 0xda754, - 0xda756, 0xda758, 0xda75a, 0xda75c, 0xda75e, 0xda760, 0xda762, 0xda764, 0xda766, - 0xda768, 0xda76a, 0xda76c, 0xda76e, 0xda779, 0xda77b, 0xda77d, 0xda77e, 0xda780, - 0xda782, 0xda784, 0xda786, 0xda78b, 0xda78d, 0xda790, 0xda792, 0xda796, 0xda798, - 0xda79a, 0xda79c, 0xda79e, 0xda7a0, 0xda7a2, 0xda7a4, 0xda7a6, 0xda7a8, 0xda7b6, - 0xe0100, 0xe0102, 0xe0104, 0xe0106, 0xe0108, 0xe010a, 0xe010c, 0xe010e, 0xe0110, - 0xe0112, 0xe0114, 0xe0116, 0xe0118, 0xe011a, 0xe011c, 0xe011e, 0xe0120, 0xe0122, - 0xe0124, 0xe0126, 0xe0128, 0xe012a, 0xe012c, 0xe012e, 0xe0130, 0xe0132, 0xe0134, - 0xe0136, 0xe0139, 0xe013b, 0xe013d, 0xe013f, 0xe0141, 0xe0143, 0xe0145, 0xe0147, - 0xe014a, 0xe014c, 0xe014e, 0xe0150, 0xe0152, 0xe0154, 0xe0156, 0xe0158, 0xe015a, - 0xe015c, 0xe015e, 0xe0160, 0xe0162, 0xe0164, 0xe0166, 0xe0168, 0xe016a, 0xe016c, - 0xe016e, 0xe0170, 0xe0172, 0xe0174, 0xe0176, 0xe0178, 0xe0179, 0xe017b, 0xe017d, - 0xe0181, 0xe0182, 0xe0184, 0xe0186, 0xe0187, 0xe0193, 0xe0194, 0xe019c, 0xe019d, - 0xe019f, 0xe01a0, 0xe01a2, 0xe01a4, 0xe01a6, 0xe01a7, 0xe01a9, 0xe01ac, 0xe01ae, - 0xe01af, 0xe01b5, 0xe01b7, 0xe01b8, 0xe01bc, 0xe01c4, 0xe01c7, 0xe01ca, 0xe01cd, - 0xe01cf, 0xe01d1, 0xe01d3, 0xe01d5, 0xe01d7, 0xe01d9, 0xe01db, 0xe01de, 0xe01e0, - 0xe01e2, 0xe01e4, 0xe01e6, 0xe01e8, 0xe01ea, 0xe01ec, 0xe01ee, 0xe01f1, 0xe01f4, - 0xe01fa, 0xe01fc, 0xe01fe, 0xe0200, 0xe0202, 0xe0204, 0xe0206, 0xe0208, 0xe020a, - 0xe020c, 0xe020e, 0xe0210, 0xe0212, 0xe0214, 0xe0216, 0xe0218, 0xe021a, 0xe021c, - 0xe021e, 0xe0220, 0xe0222, 0xe0224, 0xe0226, 0xe0228, 0xe022a, 0xe022c, 0xe022e, - 0xe0230, 0xe0232, 0xe023a, 0xe023b, 0xe023d, 0xe023e, 0xe0241, 0xe0248, 0xe024a, - 0xe024c, 0xe024e, 0xe0370, 0xe0372, 0xe0376, 0xe037f, 0xe0386, 0xe038c, 0xe038e, - 0xe038f, 0xe03cf, 0xe03d8, 0xe03da, 0xe03dc, 0xe03de, 0xe03e0, 0xe03e2, 0xe03e4, - 0xe03e6, 0xe03e8, 0xe03ea, 0xe03ec, 0xe03ee, 0xe03f4, 0xe03f7, 0xe03f9, 0xe03fa, - 0xe0460, 0xe0462, 0xe0464, 0xe0466, 0xe0468, 0xe046a, 0xe046c, 0xe046e, 0xe0470, - 0xe0472, 0xe0474, 0xe0476, 0xe0478, 0xe047a, 0xe047c, 0xe047e, 0xe0480, 0xe048a, - 0xe048c, 0xe048e, 0xe0490, 0xe0492, 0xe0494, 0xe0496, 0xe0498, 0xe049a, 0xe049c, - 0xe049e, 0xe04a0, 0xe04a2, 0xe04a4, 0xe04a6, 0xe04a8, 0xe04aa, 0xe04ac, 0xe04ae, - 0xe04b0, 0xe04b2, 0xe04b4, 0xe04b6, 0xe04b8, 0xe04ba, 0xe04bc, 0xe04be, 0xe04c0, - 0xe04c1, 0xe04c3, 0xe04c5, 0xe04c7, 0xe04c9, 0xe04cb, 0xe04cd, 0xe04d0, 0xe04d2, - 0xe04d4, 0xe04d6, 0xe04d8, 0xe04da, 0xe04dc, 0xe04de, 0xe04e0, 0xe04e2, 0xe04e4, - 0xe04e6, 0xe04e8, 0xe04ea, 0xe04ec, 0xe04ee, 0xe04f0, 0xe04f2, 0xe04f4, 0xe04f6, - 0xe04f8, 0xe04fa, 0xe04fc, 0xe04fe, 0xe0500, 0xe0502, 0xe0504, 0xe0506, 0xe0508, - 0xe050a, 0xe050c, 0xe050e, 0xe0510, 0xe0512, 0xe0514, 0xe0516, 0xe0518, 0xe051a, - 0xe051c, 0xe051e, 0xe0520, 0xe0522, 0xe0524, 0xe0526, 0xe0528, 0xe052a, 0xe052c, - 0xe052e, 0xe10c7, 0xe10cd, 0xe1e00, 0xe1e02, 0xe1e04, 0xe1e06, 0xe1e08, 0xe1e0a, - 0xe1e0c, 0xe1e0e, 0xe1e10, 0xe1e12, 0xe1e14, 0xe1e16, 0xe1e18, 0xe1e1a, 0xe1e1c, - 0xe1e1e, 0xe1e20, 0xe1e22, 0xe1e24, 0xe1e26, 0xe1e28, 0xe1e2a, 0xe1e2c, 0xe1e2e, - 0xe1e30, 0xe1e32, 0xe1e34, 0xe1e36, 0xe1e38, 0xe1e3a, 0xe1e3c, 0xe1e3e, 0xe1e40, - 0xe1e42, 0xe1e44, 0xe1e46, 0xe1e48, 0xe1e4a, 0xe1e4c, 0xe1e4e, 0xe1e50, 0xe1e52, - 0xe1e54, 0xe1e56, 0xe1e58, 0xe1e5a, 0xe1e5c, 0xe1e5e, 0xe1e60, 0xe1e62, 0xe1e64, - 0xe1e66, 0xe1e68, 0xe1e6a, 0xe1e6c, 0xe1e6e, 0xe1e70, 0xe1e72, 0xe1e74, 0xe1e76, - 0xe1e78, 0xe1e7a, 0xe1e7c, 0xe1e7e, 0xe1e80, 0xe1e82, 0xe1e84, 0xe1e86, 0xe1e88, - 0xe1e8a, 0xe1e8c, 0xe1e8e, 0xe1e90, 0xe1e92, 0xe1e94, 0xe1e9e, 0xe1ea0, 0xe1ea2, - 0xe1ea4, 0xe1ea6, 0xe1ea8, 0xe1eaa, 0xe1eac, 0xe1eae, 0xe1eb0, 0xe1eb2, 0xe1eb4, - 0xe1eb6, 0xe1eb8, 0xe1eba, 0xe1ebc, 0xe1ebe, 0xe1ec0, 0xe1ec2, 0xe1ec4, 0xe1ec6, - 0xe1ec8, 0xe1eca, 0xe1ecc, 0xe1ece, 0xe1ed0, 0xe1ed2, 0xe1ed4, 0xe1ed6, 0xe1ed8, - 0xe1eda, 0xe1edc, 0xe1ede, 0xe1ee0, 0xe1ee2, 0xe1ee4, 0xe1ee6, 0xe1ee8, 0xe1eea, - 0xe1eec, 0xe1eee, 0xe1ef0, 0xe1ef2, 0xe1ef4, 0xe1ef6, 0xe1ef8, 0xe1efa, 0xe1efc, - 0xe1efe, 0xe1f59, 0xe1f5b, 0xe1f5d, 0xe1f5f, 0xe2102, 0xe2107, 0xe2115, 0xe2124, - 0xe2126, 0xe2128, 0xe213e, 0xe213f, 0xe2145, 0xe2183, 0xe2c60, 0xe2c67, 0xe2c69, - 0xe2c6b, 0xe2c72, 0xe2c75, 0xe2c82, 0xe2c84, 0xe2c86, 0xe2c88, 0xe2c8a, 0xe2c8c, - 0xe2c8e, 0xe2c90, 0xe2c92, 0xe2c94, 0xe2c96, 0xe2c98, 0xe2c9a, 0xe2c9c, 0xe2c9e, - 0xe2ca0, 0xe2ca2, 0xe2ca4, 0xe2ca6, 0xe2ca8, 0xe2caa, 0xe2cac, 0xe2cae, 0xe2cb0, - 0xe2cb2, 0xe2cb4, 0xe2cb6, 0xe2cb8, 0xe2cba, 0xe2cbc, 0xe2cbe, 0xe2cc0, 0xe2cc2, - 0xe2cc4, 0xe2cc6, 0xe2cc8, 0xe2cca, 0xe2ccc, 0xe2cce, 0xe2cd0, 0xe2cd2, 0xe2cd4, - 0xe2cd6, 0xe2cd8, 0xe2cda, 0xe2cdc, 0xe2cde, 0xe2ce0, 0xe2ce2, 0xe2ceb, 0xe2ced, - 0xe2cf2, 0xea640, 0xea642, 0xea644, 0xea646, 0xea648, 0xea64a, 0xea64c, 0xea64e, - 0xea650, 0xea652, 0xea654, 0xea656, 0xea658, 0xea65a, 0xea65c, 0xea65e, 0xea660, - 0xea662, 0xea664, 0xea666, 0xea668, 0xea66a, 0xea66c, 0xea680, 0xea682, 0xea684, - 0xea686, 0xea688, 0xea68a, 0xea68c, 0xea68e, 0xea690, 0xea692, 0xea694, 0xea696, - 0xea698, 0xea69a, 0xea722, 0xea724, 0xea726, 0xea728, 0xea72a, 0xea72c, 0xea72e, - 0xea732, 0xea734, 0xea736, 0xea738, 0xea73a, 0xea73c, 0xea73e, 0xea740, 0xea742, - 0xea744, 0xea746, 0xea748, 0xea74a, 0xea74c, 0xea74e, 0xea750, 0xea752, 0xea754, - 0xea756, 0xea758, 0xea75a, 0xea75c, 0xea75e, 0xea760, 0xea762, 0xea764, 0xea766, - 0xea768, 0xea76a, 0xea76c, 0xea76e, 0xea779, 0xea77b, 0xea77d, 0xea77e, 0xea780, - 0xea782, 0xea784, 0xea786, 0xea78b, 0xea78d, 0xea790, 0xea792, 0xea796, 0xea798, - 0xea79a, 0xea79c, 0xea79e, 0xea7a0, 0xea7a2, 0xea7a4, 0xea7a6, 0xea7a8, 0xea7b6, - 0xf0100, 0xf0102, 0xf0104, 0xf0106, 0xf0108, 0xf010a, 0xf010c, 0xf010e, 0xf0110, - 0xf0112, 0xf0114, 0xf0116, 0xf0118, 0xf011a, 0xf011c, 0xf011e, 0xf0120, 0xf0122, - 0xf0124, 0xf0126, 0xf0128, 0xf012a, 0xf012c, 0xf012e, 0xf0130, 0xf0132, 0xf0134, - 0xf0136, 0xf0139, 0xf013b, 0xf013d, 0xf013f, 0xf0141, 0xf0143, 0xf0145, 0xf0147, - 0xf014a, 0xf014c, 0xf014e, 0xf0150, 0xf0152, 0xf0154, 0xf0156, 0xf0158, 0xf015a, - 0xf015c, 0xf015e, 0xf0160, 0xf0162, 0xf0164, 0xf0166, 0xf0168, 0xf016a, 0xf016c, - 0xf016e, 0xf0170, 0xf0172, 0xf0174, 0xf0176, 0xf0178, 0xf0179, 0xf017b, 0xf017d, - 0xf0181, 0xf0182, 0xf0184, 0xf0186, 0xf0187, 0xf0193, 0xf0194, 0xf019c, 0xf019d, - 0xf019f, 0xf01a0, 0xf01a2, 0xf01a4, 0xf01a6, 0xf01a7, 0xf01a9, 0xf01ac, 0xf01ae, - 0xf01af, 0xf01b5, 0xf01b7, 0xf01b8, 0xf01bc, 0xf01c4, 0xf01c7, 0xf01ca, 0xf01cd, - 0xf01cf, 0xf01d1, 0xf01d3, 0xf01d5, 0xf01d7, 0xf01d9, 0xf01db, 0xf01de, 0xf01e0, - 0xf01e2, 0xf01e4, 0xf01e6, 0xf01e8, 0xf01ea, 0xf01ec, 0xf01ee, 0xf01f1, 0xf01f4, - 0xf01fa, 0xf01fc, 0xf01fe, 0xf0200, 0xf0202, 0xf0204, 0xf0206, 0xf0208, 0xf020a, - 0xf020c, 0xf020e, 0xf0210, 0xf0212, 0xf0214, 0xf0216, 0xf0218, 0xf021a, 0xf021c, - 0xf021e, 0xf0220, 0xf0222, 0xf0224, 0xf0226, 0xf0228, 0xf022a, 0xf022c, 0xf022e, - 0xf0230, 0xf0232, 0xf023a, 0xf023b, 0xf023d, 0xf023e, 0xf0241, 0xf0248, 0xf024a, - 0xf024c, 0xf024e, 0xf0370, 0xf0372, 0xf0376, 0xf037f, 0xf0386, 0xf038c, 0xf038e, - 0xf038f, 0xf03cf, 0xf03d8, 0xf03da, 0xf03dc, 0xf03de, 0xf03e0, 0xf03e2, 0xf03e4, - 0xf03e6, 0xf03e8, 0xf03ea, 0xf03ec, 0xf03ee, 0xf03f4, 0xf03f7, 0xf03f9, 0xf03fa, - 0xf0460, 0xf0462, 0xf0464, 0xf0466, 0xf0468, 0xf046a, 0xf046c, 0xf046e, 0xf0470, - 0xf0472, 0xf0474, 0xf0476, 0xf0478, 0xf047a, 0xf047c, 0xf047e, 0xf0480, 0xf048a, - 0xf048c, 0xf048e, 0xf0490, 0xf0492, 0xf0494, 0xf0496, 0xf0498, 0xf049a, 0xf049c, - 0xf049e, 0xf04a0, 0xf04a2, 0xf04a4, 0xf04a6, 0xf04a8, 0xf04aa, 0xf04ac, 0xf04ae, - 0xf04b0, 0xf04b2, 0xf04b4, 0xf04b6, 0xf04b8, 0xf04ba, 0xf04bc, 0xf04be, 0xf04c0, - 0xf04c1, 0xf04c3, 0xf04c5, 0xf04c7, 0xf04c9, 0xf04cb, 0xf04cd, 0xf04d0, 0xf04d2, - 0xf04d4, 0xf04d6, 0xf04d8, 0xf04da, 0xf04dc, 0xf04de, 0xf04e0, 0xf04e2, 0xf04e4, - 0xf04e6, 0xf04e8, 0xf04ea, 0xf04ec, 0xf04ee, 0xf04f0, 0xf04f2, 0xf04f4, 0xf04f6, - 0xf04f8, 0xf04fa, 0xf04fc, 0xf04fe, 0xf0500, 0xf0502, 0xf0504, 0xf0506, 0xf0508, - 0xf050a, 0xf050c, 0xf050e, 0xf0510, 0xf0512, 0xf0514, 0xf0516, 0xf0518, 0xf051a, - 0xf051c, 0xf051e, 0xf0520, 0xf0522, 0xf0524, 0xf0526, 0xf0528, 0xf052a, 0xf052c, - 0xf052e, 0xf10c7, 0xf10cd, 0xf1e00, 0xf1e02, 0xf1e04, 0xf1e06, 0xf1e08, 0xf1e0a, - 0xf1e0c, 0xf1e0e, 0xf1e10, 0xf1e12, 0xf1e14, 0xf1e16, 0xf1e18, 0xf1e1a, 0xf1e1c, - 0xf1e1e, 0xf1e20, 0xf1e22, 0xf1e24, 0xf1e26, 0xf1e28, 0xf1e2a, 0xf1e2c, 0xf1e2e, - 0xf1e30, 0xf1e32, 0xf1e34, 0xf1e36, 0xf1e38, 0xf1e3a, 0xf1e3c, 0xf1e3e, 0xf1e40, - 0xf1e42, 0xf1e44, 0xf1e46, 0xf1e48, 0xf1e4a, 0xf1e4c, 0xf1e4e, 0xf1e50, 0xf1e52, - 0xf1e54, 0xf1e56, 0xf1e58, 0xf1e5a, 0xf1e5c, 0xf1e5e, 0xf1e60, 0xf1e62, 0xf1e64, - 0xf1e66, 0xf1e68, 0xf1e6a, 0xf1e6c, 0xf1e6e, 0xf1e70, 0xf1e72, 0xf1e74, 0xf1e76, - 0xf1e78, 0xf1e7a, 0xf1e7c, 0xf1e7e, 0xf1e80, 0xf1e82, 0xf1e84, 0xf1e86, 0xf1e88, - 0xf1e8a, 0xf1e8c, 0xf1e8e, 0xf1e90, 0xf1e92, 0xf1e94, 0xf1e9e, 0xf1ea0, 0xf1ea2, - 0xf1ea4, 0xf1ea6, 0xf1ea8, 0xf1eaa, 0xf1eac, 0xf1eae, 0xf1eb0, 0xf1eb2, 0xf1eb4, - 0xf1eb6, 0xf1eb8, 0xf1eba, 0xf1ebc, 0xf1ebe, 0xf1ec0, 0xf1ec2, 0xf1ec4, 0xf1ec6, - 0xf1ec8, 0xf1eca, 0xf1ecc, 0xf1ece, 0xf1ed0, 0xf1ed2, 0xf1ed4, 0xf1ed6, 0xf1ed8, - 0xf1eda, 0xf1edc, 0xf1ede, 0xf1ee0, 0xf1ee2, 0xf1ee4, 0xf1ee6, 0xf1ee8, 0xf1eea, - 0xf1eec, 0xf1eee, 0xf1ef0, 0xf1ef2, 0xf1ef4, 0xf1ef6, 0xf1ef8, 0xf1efa, 0xf1efc, - 0xf1efe, 0xf1f59, 0xf1f5b, 0xf1f5d, 0xf1f5f, 0xf2102, 0xf2107, 0xf2115, 0xf2124, - 0xf2126, 0xf2128, 0xf213e, 0xf213f, 0xf2145, 0xf2183, 0xf2c60, 0xf2c67, 0xf2c69, - 0xf2c6b, 0xf2c72, 0xf2c75, 0xf2c82, 0xf2c84, 0xf2c86, 0xf2c88, 0xf2c8a, 0xf2c8c, - 0xf2c8e, 0xf2c90, 0xf2c92, 0xf2c94, 0xf2c96, 0xf2c98, 0xf2c9a, 0xf2c9c, 0xf2c9e, - 0xf2ca0, 0xf2ca2, 0xf2ca4, 0xf2ca6, 0xf2ca8, 0xf2caa, 0xf2cac, 0xf2cae, 0xf2cb0, - 0xf2cb2, 0xf2cb4, 0xf2cb6, 0xf2cb8, 0xf2cba, 0xf2cbc, 0xf2cbe, 0xf2cc0, 0xf2cc2, - 0xf2cc4, 0xf2cc6, 0xf2cc8, 0xf2cca, 0xf2ccc, 0xf2cce, 0xf2cd0, 0xf2cd2, 0xf2cd4, - 0xf2cd6, 0xf2cd8, 0xf2cda, 0xf2cdc, 0xf2cde, 0xf2ce0, 0xf2ce2, 0xf2ceb, 0xf2ced, - 0xf2cf2, 0xfa640, 0xfa642, 0xfa644, 0xfa646, 0xfa648, 0xfa64a, 0xfa64c, 0xfa64e, - 0xfa650, 0xfa652, 0xfa654, 0xfa656, 0xfa658, 0xfa65a, 0xfa65c, 0xfa65e, 0xfa660, - 0xfa662, 0xfa664, 0xfa666, 0xfa668, 0xfa66a, 0xfa66c, 0xfa680, 0xfa682, 0xfa684, - 0xfa686, 0xfa688, 0xfa68a, 0xfa68c, 0xfa68e, 0xfa690, 0xfa692, 0xfa694, 0xfa696, - 0xfa698, 0xfa69a, 0xfa722, 0xfa724, 0xfa726, 0xfa728, 0xfa72a, 0xfa72c, 0xfa72e, - 0xfa732, 0xfa734, 0xfa736, 0xfa738, 0xfa73a, 0xfa73c, 0xfa73e, 0xfa740, 0xfa742, - 0xfa744, 0xfa746, 0xfa748, 0xfa74a, 0xfa74c, 0xfa74e, 0xfa750, 0xfa752, 0xfa754, - 0xfa756, 0xfa758, 0xfa75a, 0xfa75c, 0xfa75e, 0xfa760, 0xfa762, 0xfa764, 0xfa766, - 0xfa768, 0xfa76a, 0xfa76c, 0xfa76e, 0xfa779, 0xfa77b, 0xfa77d, 0xfa77e, 0xfa780, - 0xfa782, 0xfa784, 0xfa786, 0xfa78b, 0xfa78d, 0xfa790, 0xfa792, 0xfa796, 0xfa798, - 0xfa79a, 0xfa79c, 0xfa79e, 0xfa7a0, 0xfa7a2, 0xfa7a4, 0xfa7a6, 0xfa7a8, 0xfa7b6, - 0x100100, 0x100102, 0x100104, 0x100106, 0x100108, 0x10010a, 0x10010c, 0x10010e, 0x100110, - 0x100112, 0x100114, 0x100116, 0x100118, 0x10011a, 0x10011c, 0x10011e, 0x100120, 0x100122, - 0x100124, 0x100126, 0x100128, 0x10012a, 0x10012c, 0x10012e, 0x100130, 0x100132, 0x100134, - 0x100136, 0x100139, 0x10013b, 0x10013d, 0x10013f, 0x100141, 0x100143, 0x100145, 0x100147, - 0x10014a, 0x10014c, 0x10014e, 0x100150, 0x100152, 0x100154, 0x100156, 0x100158, 0x10015a, - 0x10015c, 0x10015e, 0x100160, 0x100162, 0x100164, 0x100166, 0x100168, 0x10016a, 0x10016c, - 0x10016e, 0x100170, 0x100172, 0x100174, 0x100176, 0x100178, 0x100179, 0x10017b, 0x10017d, - 0x100181, 0x100182, 0x100184, 0x100186, 0x100187, 0x100193, 0x100194, 0x10019c, 0x10019d, - 0x10019f, 0x1001a0, 0x1001a2, 0x1001a4, 0x1001a6, 0x1001a7, 0x1001a9, 0x1001ac, 0x1001ae, - 0x1001af, 0x1001b5, 0x1001b7, 0x1001b8, 0x1001bc, 0x1001c4, 0x1001c7, 0x1001ca, 0x1001cd, - 0x1001cf, 0x1001d1, 0x1001d3, 0x1001d5, 0x1001d7, 0x1001d9, 0x1001db, 0x1001de, 0x1001e0, - 0x1001e2, 0x1001e4, 0x1001e6, 0x1001e8, 0x1001ea, 0x1001ec, 0x1001ee, 0x1001f1, 0x1001f4, - 0x1001fa, 0x1001fc, 0x1001fe, 0x100200, 0x100202, 0x100204, 0x100206, 0x100208, 0x10020a, - 0x10020c, 0x10020e, 0x100210, 0x100212, 0x100214, 0x100216, 0x100218, 0x10021a, 0x10021c, - 0x10021e, 0x100220, 0x100222, 0x100224, 0x100226, 0x100228, 0x10022a, 0x10022c, 0x10022e, - 0x100230, 0x100232, 0x10023a, 0x10023b, 0x10023d, 0x10023e, 0x100241, 0x100248, 0x10024a, - 0x10024c, 0x10024e, 0x100370, 0x100372, 0x100376, 0x10037f, 0x100386, 0x10038c, 0x10038e, - 0x10038f, 0x1003cf, 0x1003d8, 0x1003da, 0x1003dc, 0x1003de, 0x1003e0, 0x1003e2, 0x1003e4, - 0x1003e6, 0x1003e8, 0x1003ea, 0x1003ec, 0x1003ee, 0x1003f4, 0x1003f7, 0x1003f9, 0x1003fa, - 0x100460, 0x100462, 0x100464, 0x100466, 0x100468, 0x10046a, 0x10046c, 0x10046e, 0x100470, - 0x100472, 0x100474, 0x100476, 0x100478, 0x10047a, 0x10047c, 0x10047e, 0x100480, 0x10048a, - 0x10048c, 0x10048e, 0x100490, 0x100492, 0x100494, 0x100496, 0x100498, 0x10049a, 0x10049c, - 0x10049e, 0x1004a0, 0x1004a2, 0x1004a4, 0x1004a6, 0x1004a8, 0x1004aa, 0x1004ac, 0x1004ae, - 0x1004b0, 0x1004b2, 0x1004b4, 0x1004b6, 0x1004b8, 0x1004ba, 0x1004bc, 0x1004be, 0x1004c0, - 0x1004c1, 0x1004c3, 0x1004c5, 0x1004c7, 0x1004c9, 0x1004cb, 0x1004cd, 0x1004d0, 0x1004d2, - 0x1004d4, 0x1004d6, 0x1004d8, 0x1004da, 0x1004dc, 0x1004de, 0x1004e0, 0x1004e2, 0x1004e4, - 0x1004e6, 0x1004e8, 0x1004ea, 0x1004ec, 0x1004ee, 0x1004f0, 0x1004f2, 0x1004f4, 0x1004f6, - 0x1004f8, 0x1004fa, 0x1004fc, 0x1004fe, 0x100500, 0x100502, 0x100504, 0x100506, 0x100508, - 0x10050a, 0x10050c, 0x10050e, 0x100510, 0x100512, 0x100514, 0x100516, 0x100518, 0x10051a, - 0x10051c, 0x10051e, 0x100520, 0x100522, 0x100524, 0x100526, 0x100528, 0x10052a, 0x10052c, - 0x10052e, 0x1010c7, 0x1010cd, 0x101e00, 0x101e02, 0x101e04, 0x101e06, 0x101e08, 0x101e0a, - 0x101e0c, 0x101e0e, 0x101e10, 0x101e12, 0x101e14, 0x101e16, 0x101e18, 0x101e1a, 0x101e1c, - 0x101e1e, 0x101e20, 0x101e22, 0x101e24, 0x101e26, 0x101e28, 0x101e2a, 0x101e2c, 0x101e2e, - 0x101e30, 0x101e32, 0x101e34, 0x101e36, 0x101e38, 0x101e3a, 0x101e3c, 0x101e3e, 0x101e40, - 0x101e42, 0x101e44, 0x101e46, 0x101e48, 0x101e4a, 0x101e4c, 0x101e4e, 0x101e50, 0x101e52, - 0x101e54, 0x101e56, 0x101e58, 0x101e5a, 0x101e5c, 0x101e5e, 0x101e60, 0x101e62, 0x101e64, - 0x101e66, 0x101e68, 0x101e6a, 0x101e6c, 0x101e6e, 0x101e70, 0x101e72, 0x101e74, 0x101e76, - 0x101e78, 0x101e7a, 0x101e7c, 0x101e7e, 0x101e80, 0x101e82, 0x101e84, 0x101e86, 0x101e88, - 0x101e8a, 0x101e8c, 0x101e8e, 0x101e90, 0x101e92, 0x101e94, 0x101e9e, 0x101ea0, 0x101ea2, - 0x101ea4, 0x101ea6, 0x101ea8, 0x101eaa, 0x101eac, 0x101eae, 0x101eb0, 0x101eb2, 0x101eb4, - 0x101eb6, 0x101eb8, 0x101eba, 0x101ebc, 0x101ebe, 0x101ec0, 0x101ec2, 0x101ec4, 0x101ec6, - 0x101ec8, 0x101eca, 0x101ecc, 0x101ece, 0x101ed0, 0x101ed2, 0x101ed4, 0x101ed6, 0x101ed8, - 0x101eda, 0x101edc, 0x101ede, 0x101ee0, 0x101ee2, 0x101ee4, 0x101ee6, 0x101ee8, 0x101eea, - 0x101eec, 0x101eee, 0x101ef0, 0x101ef2, 0x101ef4, 0x101ef6, 0x101ef8, 0x101efa, 0x101efc, - 0x101efe, 0x101f59, 0x101f5b, 0x101f5d, 0x101f5f, 0x102102, 0x102107, 0x102115, 0x102124, - 0x102126, 0x102128, 0x10213e, 0x10213f, 0x102145, 0x102183, 0x102c60, 0x102c67, 0x102c69, - 0x102c6b, 0x102c72, 0x102c75, 0x102c82, 0x102c84, 0x102c86, 0x102c88, 0x102c8a, 0x102c8c, - 0x102c8e, 0x102c90, 0x102c92, 0x102c94, 0x102c96, 0x102c98, 0x102c9a, 0x102c9c, 0x102c9e, - 0x102ca0, 0x102ca2, 0x102ca4, 0x102ca6, 0x102ca8, 0x102caa, 0x102cac, 0x102cae, 0x102cb0, - 0x102cb2, 0x102cb4, 0x102cb6, 0x102cb8, 0x102cba, 0x102cbc, 0x102cbe, 0x102cc0, 0x102cc2, - 0x102cc4, 0x102cc6, 0x102cc8, 0x102cca, 0x102ccc, 0x102cce, 0x102cd0, 0x102cd2, 0x102cd4, - 0x102cd6, 0x102cd8, 0x102cda, 0x102cdc, 0x102cde, 0x102ce0, 0x102ce2, 0x102ceb, 0x102ced, - 0x102cf2, 0x10a640, 0x10a642, 0x10a644, 0x10a646, 0x10a648, 0x10a64a, 0x10a64c, 0x10a64e, - 0x10a650, 0x10a652, 0x10a654, 0x10a656, 0x10a658, 0x10a65a, 0x10a65c, 0x10a65e, 0x10a660, - 0x10a662, 0x10a664, 0x10a666, 0x10a668, 0x10a66a, 0x10a66c, 0x10a680, 0x10a682, 0x10a684, - 0x10a686, 0x10a688, 0x10a68a, 0x10a68c, 0x10a68e, 0x10a690, 0x10a692, 0x10a694, 0x10a696, - 0x10a698, 0x10a69a, 0x10a722, 0x10a724, 0x10a726, 0x10a728, 0x10a72a, 0x10a72c, 0x10a72e, - 0x10a732, 0x10a734, 0x10a736, 0x10a738, 0x10a73a, 0x10a73c, 0x10a73e, 0x10a740, 0x10a742, - 0x10a744, 0x10a746, 0x10a748, 0x10a74a, 0x10a74c, 0x10a74e, 0x10a750, 0x10a752, 0x10a754, - 0x10a756, 0x10a758, 0x10a75a, 0x10a75c, 0x10a75e, 0x10a760, 0x10a762, 0x10a764, 0x10a766, - 0x10a768, 0x10a76a, 0x10a76c, 0x10a76e, 0x10a779, 0x10a77b, 0x10a77d, 0x10a77e, 0x10a780, - 0x10a782, 0x10a784, 0x10a786, 0x10a78b, 0x10a78d, 0x10a790, 0x10a792, 0x10a796, 0x10a798, - 0x10a79a, 0x10a79c, 0x10a79e, 0x10a7a0, 0x10a7a2, 0x10a7a4, 0x10a7a6, 0x10a7a8, 0x10a7b6 + ,0x1d49c, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d504, 0x1d505, 0x1d538, + 0x1d539, 0x1d546, 0x1d7ca #endif }; @@ -4944,6 +684,10 @@ static const crange graphRangeTable[] = { {0xaadb, 0xaaf6}, {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab65}, {0xab70, 0xabed}, {0xabf0, 0xabf9}, {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, + {0xdc00, 0xdc3e}, {0xdc40, 0xdc7e}, {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, + {0xdd00, 0xdd3e}, {0xdd40, 0xdd7e}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe}, + {0xde00, 0xde3e}, {0xde40, 0xde7e}, {0xde80, 0xdebe}, {0xdec0, 0xdefe}, + {0xdf00, 0xdf3e}, {0xdf40, 0xdf7e}, {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1d, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbc1}, {0xfbd3, 0xfd3f}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfd}, {0xfe00, 0xfe19}, @@ -4951,1222 +695,64 @@ static const crange graphRangeTable[] = { {0xfe76, 0xfefc}, {0xff01, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}, {0xffe0, 0xffe6}, {0xffe8, 0xffee} #if TCL_UTF_MAX > 4 - ,{0x10021, 0x1007e}, {0x100a1, 0x100ac}, {0x100ae, 0x10377}, {0x1037a, 0x1037f}, - {0x10384, 0x1038a}, {0x1038e, 0x103a1}, {0x103a3, 0x1052f}, {0x10531, 0x10556}, - {0x10559, 0x1055f}, {0x10561, 0x10587}, {0x1058d, 0x1058f}, {0x10591, 0x105c7}, - {0x105d0, 0x105ea}, {0x105f0, 0x105f4}, {0x10606, 0x1061b}, {0x1061e, 0x106dc}, - {0x106de, 0x1070d}, {0x10710, 0x1074a}, {0x1074d, 0x107b1}, {0x107c0, 0x107fa}, - {0x10800, 0x1082d}, {0x10830, 0x1083e}, {0x10840, 0x1085b}, {0x10860, 0x1086a}, - {0x108a0, 0x108b4}, {0x108b6, 0x108bd}, {0x108d4, 0x108e1}, {0x108e3, 0x10983}, - {0x10985, 0x1098c}, {0x10993, 0x109a8}, {0x109aa, 0x109b0}, {0x109b6, 0x109b9}, - {0x109bc, 0x109c4}, {0x109cb, 0x109ce}, {0x109df, 0x109e3}, {0x109e6, 0x109fd}, - {0x10a01, 0x10a03}, {0x10a05, 0x10a0a}, {0x10a13, 0x10a28}, {0x10a2a, 0x10a30}, - {0x10a3e, 0x10a42}, {0x10a4b, 0x10a4d}, {0x10a59, 0x10a5c}, {0x10a66, 0x10a75}, - {0x10a81, 0x10a83}, {0x10a85, 0x10a8d}, {0x10a8f, 0x10a91}, {0x10a93, 0x10aa8}, - {0x10aaa, 0x10ab0}, {0x10ab5, 0x10ab9}, {0x10abc, 0x10ac5}, {0x10ac7, 0x10ac9}, - {0x10acb, 0x10acd}, {0x10ae0, 0x10ae3}, {0x10ae6, 0x10af1}, {0x10af9, 0x10aff}, - {0x10b01, 0x10b03}, {0x10b05, 0x10b0c}, {0x10b13, 0x10b28}, {0x10b2a, 0x10b30}, - {0x10b35, 0x10b39}, {0x10b3c, 0x10b44}, {0x10b4b, 0x10b4d}, {0x10b5f, 0x10b63}, - {0x10b66, 0x10b77}, {0x10b85, 0x10b8a}, {0x10b8e, 0x10b90}, {0x10b92, 0x10b95}, - {0x10ba8, 0x10baa}, {0x10bae, 0x10bb9}, {0x10bbe, 0x10bc2}, {0x10bc6, 0x10bc8}, - {0x10bca, 0x10bcd}, {0x10be6, 0x10bfa}, {0x10c00, 0x10c03}, {0x10c05, 0x10c0c}, - {0x10c0e, 0x10c10}, {0x10c12, 0x10c28}, {0x10c2a, 0x10c39}, {0x10c3d, 0x10c44}, - {0x10c46, 0x10c48}, {0x10c4a, 0x10c4d}, {0x10c58, 0x10c5a}, {0x10c60, 0x10c63}, - {0x10c66, 0x10c6f}, {0x10c78, 0x10c83}, {0x10c85, 0x10c8c}, {0x10c8e, 0x10c90}, - {0x10c92, 0x10ca8}, {0x10caa, 0x10cb3}, {0x10cb5, 0x10cb9}, {0x10cbc, 0x10cc4}, - {0x10cc6, 0x10cc8}, {0x10cca, 0x10ccd}, {0x10ce0, 0x10ce3}, {0x10ce6, 0x10cef}, - {0x10d00, 0x10d03}, {0x10d05, 0x10d0c}, {0x10d0e, 0x10d10}, {0x10d12, 0x10d44}, - {0x10d46, 0x10d48}, {0x10d4a, 0x10d4f}, {0x10d54, 0x10d63}, {0x10d66, 0x10d7f}, - {0x10d85, 0x10d96}, {0x10d9a, 0x10db1}, {0x10db3, 0x10dbb}, {0x10dc0, 0x10dc6}, - {0x10dcf, 0x10dd4}, {0x10dd8, 0x10ddf}, {0x10de6, 0x10def}, {0x10df2, 0x10df4}, - {0x10e01, 0x10e3a}, {0x10e3f, 0x10e5b}, {0x10e94, 0x10e97}, {0x10e99, 0x10e9f}, - {0x10ea1, 0x10ea3}, {0x10ead, 0x10eb9}, {0x10ebb, 0x10ebd}, {0x10ec0, 0x10ec4}, - {0x10ec8, 0x10ecd}, {0x10ed0, 0x10ed9}, {0x10edc, 0x10edf}, {0x10f00, 0x10f47}, - {0x10f49, 0x10f6c}, {0x10f71, 0x10f97}, {0x10f99, 0x10fbc}, {0x10fbe, 0x10fcc}, - {0x10fce, 0x10fda}, {0x11000, 0x110c5}, {0x110d0, 0x11248}, {0x1124a, 0x1124d}, - {0x11250, 0x11256}, {0x1125a, 0x1125d}, {0x11260, 0x11288}, {0x1128a, 0x1128d}, - {0x11290, 0x112b0}, {0x112b2, 0x112b5}, {0x112b8, 0x112be}, {0x112c2, 0x112c5}, - {0x112c8, 0x112d6}, {0x112d8, 0x11310}, {0x11312, 0x11315}, {0x11318, 0x1135a}, - {0x1135d, 0x1137c}, {0x11380, 0x11399}, {0x113a0, 0x113f5}, {0x113f8, 0x113fd}, - {0x11400, 0x1167f}, {0x11681, 0x1169c}, {0x116a0, 0x116f8}, {0x11700, 0x1170c}, - {0x1170e, 0x11714}, {0x11720, 0x11736}, {0x11740, 0x11753}, {0x11760, 0x1176c}, - {0x1176e, 0x11770}, {0x11780, 0x117dd}, {0x117e0, 0x117e9}, {0x117f0, 0x117f9}, - {0x11800, 0x1180d}, {0x11810, 0x11819}, {0x11820, 0x11877}, {0x11880, 0x118aa}, - {0x118b0, 0x118f5}, {0x11900, 0x1191e}, {0x11920, 0x1192b}, {0x11930, 0x1193b}, - {0x11944, 0x1196d}, {0x11970, 0x11974}, {0x11980, 0x119ab}, {0x119b0, 0x119c9}, - {0x119d0, 0x119da}, {0x119de, 0x11a1b}, {0x11a1e, 0x11a5e}, {0x11a60, 0x11a7c}, - {0x11a7f, 0x11a89}, {0x11a90, 0x11a99}, {0x11aa0, 0x11aad}, {0x11ab0, 0x11abe}, - {0x11b00, 0x11b4b}, {0x11b50, 0x11b7c}, {0x11b80, 0x11bf3}, {0x11bfc, 0x11c37}, - {0x11c3b, 0x11c49}, {0x11c4d, 0x11c88}, {0x11cc0, 0x11cc7}, {0x11cd0, 0x11cf9}, - {0x11d00, 0x11df9}, {0x11dfb, 0x11f15}, {0x11f18, 0x11f1d}, {0x11f20, 0x11f45}, - {0x11f48, 0x11f4d}, {0x11f50, 0x11f57}, {0x11f5f, 0x11f7d}, {0x11f80, 0x11fb4}, - {0x11fb6, 0x11fc4}, {0x11fc6, 0x11fd3}, {0x11fd6, 0x11fdb}, {0x11fdd, 0x11fef}, - {0x11ff2, 0x11ff4}, {0x11ff6, 0x11ffe}, {0x12010, 0x12027}, {0x12030, 0x1205e}, - {0x12074, 0x1208e}, {0x12090, 0x1209c}, {0x120a0, 0x120bf}, {0x120d0, 0x120f0}, - {0x12100, 0x1218b}, {0x12190, 0x12426}, {0x12440, 0x1244a}, {0x12460, 0x12b73}, - {0x12b76, 0x12b95}, {0x12b98, 0x12bb9}, {0x12bbd, 0x12bc8}, {0x12bca, 0x12bd2}, - {0x12bec, 0x12bef}, {0x12c00, 0x12c2e}, {0x12c30, 0x12c5e}, {0x12c60, 0x12cf3}, - {0x12cf9, 0x12d25}, {0x12d30, 0x12d67}, {0x12d7f, 0x12d96}, {0x12da0, 0x12da6}, - {0x12da8, 0x12dae}, {0x12db0, 0x12db6}, {0x12db8, 0x12dbe}, {0x12dc0, 0x12dc6}, - {0x12dc8, 0x12dce}, {0x12dd0, 0x12dd6}, {0x12dd8, 0x12dde}, {0x12de0, 0x12e49}, - {0x12e80, 0x12e99}, {0x12e9b, 0x12ef3}, {0x12f00, 0x12fd5}, {0x12ff0, 0x12ffb}, - {0x13001, 0x1303f}, {0x13041, 0x13096}, {0x13099, 0x130ff}, {0x13105, 0x1312e}, - {0x13131, 0x1318e}, {0x13190, 0x131ba}, {0x131c0, 0x131e3}, {0x131f0, 0x1321e}, - {0x13220, 0x132fe}, {0x13300, 0x14db5}, {0x14dc0, 0x19fea}, {0x1a000, 0x1a48c}, - {0x1a490, 0x1a4c6}, {0x1a4d0, 0x1a62b}, {0x1a640, 0x1a6f7}, {0x1a700, 0x1a7ae}, - {0x1a7b0, 0x1a7b7}, {0x1a7f7, 0x1a82b}, {0x1a830, 0x1a839}, {0x1a840, 0x1a877}, - {0x1a880, 0x1a8c5}, {0x1a8ce, 0x1a8d9}, {0x1a8e0, 0x1a8fd}, {0x1a900, 0x1a953}, - {0x1a95f, 0x1a97c}, {0x1a980, 0x1a9cd}, {0x1a9cf, 0x1a9d9}, {0x1a9de, 0x1a9fe}, - {0x1aa00, 0x1aa36}, {0x1aa40, 0x1aa4d}, {0x1aa50, 0x1aa59}, {0x1aa5c, 0x1aac2}, - {0x1aadb, 0x1aaf6}, {0x1ab01, 0x1ab06}, {0x1ab09, 0x1ab0e}, {0x1ab11, 0x1ab16}, - {0x1ab20, 0x1ab26}, {0x1ab28, 0x1ab2e}, {0x1ab30, 0x1ab65}, {0x1ab70, 0x1abed}, - {0x1abf0, 0x1abf9}, {0x1ac00, 0x1d7a3}, {0x1d7b0, 0x1d7c6}, {0x1d7cb, 0x1d7fb}, - {0x1f900, 0x1fa6d}, {0x1fa70, 0x1fad9}, {0x1fb00, 0x1fb06}, {0x1fb13, 0x1fb17}, - {0x1fb1d, 0x1fb36}, {0x1fb38, 0x1fb3c}, {0x1fb46, 0x1fbc1}, {0x1fbd3, 0x1fd3f}, - {0x1fd50, 0x1fd8f}, {0x1fd92, 0x1fdc7}, {0x1fdf0, 0x1fdfd}, {0x1fe00, 0x1fe19}, - {0x1fe20, 0x1fe52}, {0x1fe54, 0x1fe66}, {0x1fe68, 0x1fe6b}, {0x1fe70, 0x1fe74}, - {0x1fe76, 0x1fefc}, {0x1ff01, 0x1ffbe}, {0x1ffc2, 0x1ffc7}, {0x1ffca, 0x1ffcf}, - {0x1ffd2, 0x1ffd7}, {0x1ffda, 0x1ffdc}, {0x1ffe0, 0x1ffe6}, {0x1ffe8, 0x1ffee}, - {0x20021, 0x2007e}, {0x200a1, 0x200ac}, {0x200ae, 0x20377}, {0x2037a, 0x2037f}, - {0x20384, 0x2038a}, {0x2038e, 0x203a1}, {0x203a3, 0x2052f}, {0x20531, 0x20556}, - {0x20559, 0x2055f}, {0x20561, 0x20587}, {0x2058d, 0x2058f}, {0x20591, 0x205c7}, - {0x205d0, 0x205ea}, {0x205f0, 0x205f4}, {0x20606, 0x2061b}, {0x2061e, 0x206dc}, - {0x206de, 0x2070d}, {0x20710, 0x2074a}, {0x2074d, 0x207b1}, {0x207c0, 0x207fa}, - {0x20800, 0x2082d}, {0x20830, 0x2083e}, {0x20840, 0x2085b}, {0x20860, 0x2086a}, - {0x208a0, 0x208b4}, {0x208b6, 0x208bd}, {0x208d4, 0x208e1}, {0x208e3, 0x20983}, - {0x20985, 0x2098c}, {0x20993, 0x209a8}, {0x209aa, 0x209b0}, {0x209b6, 0x209b9}, - {0x209bc, 0x209c4}, {0x209cb, 0x209ce}, {0x209df, 0x209e3}, {0x209e6, 0x209fd}, - {0x20a01, 0x20a03}, {0x20a05, 0x20a0a}, {0x20a13, 0x20a28}, {0x20a2a, 0x20a30}, - {0x20a3e, 0x20a42}, {0x20a4b, 0x20a4d}, {0x20a59, 0x20a5c}, {0x20a66, 0x20a75}, - {0x20a81, 0x20a83}, {0x20a85, 0x20a8d}, {0x20a8f, 0x20a91}, {0x20a93, 0x20aa8}, - {0x20aaa, 0x20ab0}, {0x20ab5, 0x20ab9}, {0x20abc, 0x20ac5}, {0x20ac7, 0x20ac9}, - {0x20acb, 0x20acd}, {0x20ae0, 0x20ae3}, {0x20ae6, 0x20af1}, {0x20af9, 0x20aff}, - {0x20b01, 0x20b03}, {0x20b05, 0x20b0c}, {0x20b13, 0x20b28}, {0x20b2a, 0x20b30}, - {0x20b35, 0x20b39}, {0x20b3c, 0x20b44}, {0x20b4b, 0x20b4d}, {0x20b5f, 0x20b63}, - {0x20b66, 0x20b77}, {0x20b85, 0x20b8a}, {0x20b8e, 0x20b90}, {0x20b92, 0x20b95}, - {0x20ba8, 0x20baa}, {0x20bae, 0x20bb9}, {0x20bbe, 0x20bc2}, {0x20bc6, 0x20bc8}, - {0x20bca, 0x20bcd}, {0x20be6, 0x20bfa}, {0x20c00, 0x20c03}, {0x20c05, 0x20c0c}, - {0x20c0e, 0x20c10}, {0x20c12, 0x20c28}, {0x20c2a, 0x20c39}, {0x20c3d, 0x20c44}, - {0x20c46, 0x20c48}, {0x20c4a, 0x20c4d}, {0x20c58, 0x20c5a}, {0x20c60, 0x20c63}, - {0x20c66, 0x20c6f}, {0x20c78, 0x20c83}, {0x20c85, 0x20c8c}, {0x20c8e, 0x20c90}, - {0x20c92, 0x20ca8}, {0x20caa, 0x20cb3}, {0x20cb5, 0x20cb9}, {0x20cbc, 0x20cc4}, - {0x20cc6, 0x20cc8}, {0x20cca, 0x20ccd}, {0x20ce0, 0x20ce3}, {0x20ce6, 0x20cef}, - {0x20d00, 0x20d03}, {0x20d05, 0x20d0c}, {0x20d0e, 0x20d10}, {0x20d12, 0x20d44}, - {0x20d46, 0x20d48}, {0x20d4a, 0x20d4f}, {0x20d54, 0x20d63}, {0x20d66, 0x20d7f}, - {0x20d85, 0x20d96}, {0x20d9a, 0x20db1}, {0x20db3, 0x20dbb}, {0x20dc0, 0x20dc6}, - {0x20dcf, 0x20dd4}, {0x20dd8, 0x20ddf}, {0x20de6, 0x20def}, {0x20df2, 0x20df4}, - {0x20e01, 0x20e3a}, {0x20e3f, 0x20e5b}, {0x20e94, 0x20e97}, {0x20e99, 0x20e9f}, - {0x20ea1, 0x20ea3}, {0x20ead, 0x20eb9}, {0x20ebb, 0x20ebd}, {0x20ec0, 0x20ec4}, - {0x20ec8, 0x20ecd}, {0x20ed0, 0x20ed9}, {0x20edc, 0x20edf}, {0x20f00, 0x20f47}, - {0x20f49, 0x20f6c}, {0x20f71, 0x20f97}, {0x20f99, 0x20fbc}, {0x20fbe, 0x20fcc}, - {0x20fce, 0x20fda}, {0x21000, 0x210c5}, {0x210d0, 0x21248}, {0x2124a, 0x2124d}, - {0x21250, 0x21256}, {0x2125a, 0x2125d}, {0x21260, 0x21288}, {0x2128a, 0x2128d}, - {0x21290, 0x212b0}, {0x212b2, 0x212b5}, {0x212b8, 0x212be}, {0x212c2, 0x212c5}, - {0x212c8, 0x212d6}, {0x212d8, 0x21310}, {0x21312, 0x21315}, {0x21318, 0x2135a}, - {0x2135d, 0x2137c}, {0x21380, 0x21399}, {0x213a0, 0x213f5}, {0x213f8, 0x213fd}, - {0x21400, 0x2167f}, {0x21681, 0x2169c}, {0x216a0, 0x216f8}, {0x21700, 0x2170c}, - {0x2170e, 0x21714}, {0x21720, 0x21736}, {0x21740, 0x21753}, {0x21760, 0x2176c}, - {0x2176e, 0x21770}, {0x21780, 0x217dd}, {0x217e0, 0x217e9}, {0x217f0, 0x217f9}, - {0x21800, 0x2180d}, {0x21810, 0x21819}, {0x21820, 0x21877}, {0x21880, 0x218aa}, - {0x218b0, 0x218f5}, {0x21900, 0x2191e}, {0x21920, 0x2192b}, {0x21930, 0x2193b}, - {0x21944, 0x2196d}, {0x21970, 0x21974}, {0x21980, 0x219ab}, {0x219b0, 0x219c9}, - {0x219d0, 0x219da}, {0x219de, 0x21a1b}, {0x21a1e, 0x21a5e}, {0x21a60, 0x21a7c}, - {0x21a7f, 0x21a89}, {0x21a90, 0x21a99}, {0x21aa0, 0x21aad}, {0x21ab0, 0x21abe}, - {0x21b00, 0x21b4b}, {0x21b50, 0x21b7c}, {0x21b80, 0x21bf3}, {0x21bfc, 0x21c37}, - {0x21c3b, 0x21c49}, {0x21c4d, 0x21c88}, {0x21cc0, 0x21cc7}, {0x21cd0, 0x21cf9}, - {0x21d00, 0x21df9}, {0x21dfb, 0x21f15}, {0x21f18, 0x21f1d}, {0x21f20, 0x21f45}, - {0x21f48, 0x21f4d}, {0x21f50, 0x21f57}, {0x21f5f, 0x21f7d}, {0x21f80, 0x21fb4}, - {0x21fb6, 0x21fc4}, {0x21fc6, 0x21fd3}, {0x21fd6, 0x21fdb}, {0x21fdd, 0x21fef}, - {0x21ff2, 0x21ff4}, {0x21ff6, 0x21ffe}, {0x22010, 0x22027}, {0x22030, 0x2205e}, - {0x22074, 0x2208e}, {0x22090, 0x2209c}, {0x220a0, 0x220bf}, {0x220d0, 0x220f0}, - {0x22100, 0x2218b}, {0x22190, 0x22426}, {0x22440, 0x2244a}, {0x22460, 0x22b73}, - {0x22b76, 0x22b95}, {0x22b98, 0x22bb9}, {0x22bbd, 0x22bc8}, {0x22bca, 0x22bd2}, - {0x22bec, 0x22bef}, {0x22c00, 0x22c2e}, {0x22c30, 0x22c5e}, {0x22c60, 0x22cf3}, - {0x22cf9, 0x22d25}, {0x22d30, 0x22d67}, {0x22d7f, 0x22d96}, {0x22da0, 0x22da6}, - {0x22da8, 0x22dae}, {0x22db0, 0x22db6}, {0x22db8, 0x22dbe}, {0x22dc0, 0x22dc6}, - {0x22dc8, 0x22dce}, {0x22dd0, 0x22dd6}, {0x22dd8, 0x22dde}, {0x22de0, 0x22e49}, - {0x22e80, 0x22e99}, {0x22e9b, 0x22ef3}, {0x22f00, 0x22fd5}, {0x22ff0, 0x22ffb}, - {0x23001, 0x2303f}, {0x23041, 0x23096}, {0x23099, 0x230ff}, {0x23105, 0x2312e}, - {0x23131, 0x2318e}, {0x23190, 0x231ba}, {0x231c0, 0x231e3}, {0x231f0, 0x2321e}, - {0x23220, 0x232fe}, {0x23300, 0x24db5}, {0x24dc0, 0x29fea}, {0x2a000, 0x2a48c}, - {0x2a490, 0x2a4c6}, {0x2a4d0, 0x2a62b}, {0x2a640, 0x2a6f7}, {0x2a700, 0x2a7ae}, - {0x2a7b0, 0x2a7b7}, {0x2a7f7, 0x2a82b}, {0x2a830, 0x2a839}, {0x2a840, 0x2a877}, - {0x2a880, 0x2a8c5}, {0x2a8ce, 0x2a8d9}, {0x2a8e0, 0x2a8fd}, {0x2a900, 0x2a953}, - {0x2a95f, 0x2a97c}, {0x2a980, 0x2a9cd}, {0x2a9cf, 0x2a9d9}, {0x2a9de, 0x2a9fe}, - {0x2aa00, 0x2aa36}, {0x2aa40, 0x2aa4d}, {0x2aa50, 0x2aa59}, {0x2aa5c, 0x2aac2}, - {0x2aadb, 0x2aaf6}, {0x2ab01, 0x2ab06}, {0x2ab09, 0x2ab0e}, {0x2ab11, 0x2ab16}, - {0x2ab20, 0x2ab26}, {0x2ab28, 0x2ab2e}, {0x2ab30, 0x2ab65}, {0x2ab70, 0x2abed}, - {0x2abf0, 0x2abf9}, {0x2ac00, 0x2d7a3}, {0x2d7b0, 0x2d7c6}, {0x2d7cb, 0x2d7fb}, - {0x2f900, 0x2fa6d}, {0x2fa70, 0x2fad9}, {0x2fb00, 0x2fb06}, {0x2fb13, 0x2fb17}, - {0x2fb1d, 0x2fb36}, {0x2fb38, 0x2fb3c}, {0x2fb46, 0x2fbc1}, {0x2fbd3, 0x2fd3f}, - {0x2fd50, 0x2fd8f}, {0x2fd92, 0x2fdc7}, {0x2fdf0, 0x2fdfd}, {0x2fe00, 0x2fe19}, - {0x2fe20, 0x2fe52}, {0x2fe54, 0x2fe66}, {0x2fe68, 0x2fe6b}, {0x2fe70, 0x2fe74}, - {0x2fe76, 0x2fefc}, {0x2ff01, 0x2ffbe}, {0x2ffc2, 0x2ffc7}, {0x2ffca, 0x2ffcf}, - {0x2ffd2, 0x2ffd7}, {0x2ffda, 0x2ffdc}, {0x2ffe0, 0x2ffe6}, {0x2ffe8, 0x2ffee}, - {0x30021, 0x3007e}, {0x300a1, 0x300ac}, {0x300ae, 0x30377}, {0x3037a, 0x3037f}, - {0x30384, 0x3038a}, {0x3038e, 0x303a1}, {0x303a3, 0x3052f}, {0x30531, 0x30556}, - {0x30559, 0x3055f}, {0x30561, 0x30587}, {0x3058d, 0x3058f}, {0x30591, 0x305c7}, - {0x305d0, 0x305ea}, {0x305f0, 0x305f4}, {0x30606, 0x3061b}, {0x3061e, 0x306dc}, - {0x306de, 0x3070d}, {0x30710, 0x3074a}, {0x3074d, 0x307b1}, {0x307c0, 0x307fa}, - {0x30800, 0x3082d}, {0x30830, 0x3083e}, {0x30840, 0x3085b}, {0x30860, 0x3086a}, - {0x308a0, 0x308b4}, {0x308b6, 0x308bd}, {0x308d4, 0x308e1}, {0x308e3, 0x30983}, - {0x30985, 0x3098c}, {0x30993, 0x309a8}, {0x309aa, 0x309b0}, {0x309b6, 0x309b9}, - {0x309bc, 0x309c4}, {0x309cb, 0x309ce}, {0x309df, 0x309e3}, {0x309e6, 0x309fd}, - {0x30a01, 0x30a03}, {0x30a05, 0x30a0a}, {0x30a13, 0x30a28}, {0x30a2a, 0x30a30}, - {0x30a3e, 0x30a42}, {0x30a4b, 0x30a4d}, {0x30a59, 0x30a5c}, {0x30a66, 0x30a75}, - {0x30a81, 0x30a83}, {0x30a85, 0x30a8d}, {0x30a8f, 0x30a91}, {0x30a93, 0x30aa8}, - {0x30aaa, 0x30ab0}, {0x30ab5, 0x30ab9}, {0x30abc, 0x30ac5}, {0x30ac7, 0x30ac9}, - {0x30acb, 0x30acd}, {0x30ae0, 0x30ae3}, {0x30ae6, 0x30af1}, {0x30af9, 0x30aff}, - {0x30b01, 0x30b03}, {0x30b05, 0x30b0c}, {0x30b13, 0x30b28}, {0x30b2a, 0x30b30}, - {0x30b35, 0x30b39}, {0x30b3c, 0x30b44}, {0x30b4b, 0x30b4d}, {0x30b5f, 0x30b63}, - {0x30b66, 0x30b77}, {0x30b85, 0x30b8a}, {0x30b8e, 0x30b90}, {0x30b92, 0x30b95}, - {0x30ba8, 0x30baa}, {0x30bae, 0x30bb9}, {0x30bbe, 0x30bc2}, {0x30bc6, 0x30bc8}, - {0x30bca, 0x30bcd}, {0x30be6, 0x30bfa}, {0x30c00, 0x30c03}, {0x30c05, 0x30c0c}, - {0x30c0e, 0x30c10}, {0x30c12, 0x30c28}, {0x30c2a, 0x30c39}, {0x30c3d, 0x30c44}, - {0x30c46, 0x30c48}, {0x30c4a, 0x30c4d}, {0x30c58, 0x30c5a}, {0x30c60, 0x30c63}, - {0x30c66, 0x30c6f}, {0x30c78, 0x30c83}, {0x30c85, 0x30c8c}, {0x30c8e, 0x30c90}, - {0x30c92, 0x30ca8}, {0x30caa, 0x30cb3}, {0x30cb5, 0x30cb9}, {0x30cbc, 0x30cc4}, - {0x30cc6, 0x30cc8}, {0x30cca, 0x30ccd}, {0x30ce0, 0x30ce3}, {0x30ce6, 0x30cef}, - {0x30d00, 0x30d03}, {0x30d05, 0x30d0c}, {0x30d0e, 0x30d10}, {0x30d12, 0x30d44}, - {0x30d46, 0x30d48}, {0x30d4a, 0x30d4f}, {0x30d54, 0x30d63}, {0x30d66, 0x30d7f}, - {0x30d85, 0x30d96}, {0x30d9a, 0x30db1}, {0x30db3, 0x30dbb}, {0x30dc0, 0x30dc6}, - {0x30dcf, 0x30dd4}, {0x30dd8, 0x30ddf}, {0x30de6, 0x30def}, {0x30df2, 0x30df4}, - {0x30e01, 0x30e3a}, {0x30e3f, 0x30e5b}, {0x30e94, 0x30e97}, {0x30e99, 0x30e9f}, - {0x30ea1, 0x30ea3}, {0x30ead, 0x30eb9}, {0x30ebb, 0x30ebd}, {0x30ec0, 0x30ec4}, - {0x30ec8, 0x30ecd}, {0x30ed0, 0x30ed9}, {0x30edc, 0x30edf}, {0x30f00, 0x30f47}, - {0x30f49, 0x30f6c}, {0x30f71, 0x30f97}, {0x30f99, 0x30fbc}, {0x30fbe, 0x30fcc}, - {0x30fce, 0x30fda}, {0x31000, 0x310c5}, {0x310d0, 0x31248}, {0x3124a, 0x3124d}, - {0x31250, 0x31256}, {0x3125a, 0x3125d}, {0x31260, 0x31288}, {0x3128a, 0x3128d}, - {0x31290, 0x312b0}, {0x312b2, 0x312b5}, {0x312b8, 0x312be}, {0x312c2, 0x312c5}, - {0x312c8, 0x312d6}, {0x312d8, 0x31310}, {0x31312, 0x31315}, {0x31318, 0x3135a}, - {0x3135d, 0x3137c}, {0x31380, 0x31399}, {0x313a0, 0x313f5}, {0x313f8, 0x313fd}, - {0x31400, 0x3167f}, {0x31681, 0x3169c}, {0x316a0, 0x316f8}, {0x31700, 0x3170c}, - {0x3170e, 0x31714}, {0x31720, 0x31736}, {0x31740, 0x31753}, {0x31760, 0x3176c}, - {0x3176e, 0x31770}, {0x31780, 0x317dd}, {0x317e0, 0x317e9}, {0x317f0, 0x317f9}, - {0x31800, 0x3180d}, {0x31810, 0x31819}, {0x31820, 0x31877}, {0x31880, 0x318aa}, - {0x318b0, 0x318f5}, {0x31900, 0x3191e}, {0x31920, 0x3192b}, {0x31930, 0x3193b}, - {0x31944, 0x3196d}, {0x31970, 0x31974}, {0x31980, 0x319ab}, {0x319b0, 0x319c9}, - {0x319d0, 0x319da}, {0x319de, 0x31a1b}, {0x31a1e, 0x31a5e}, {0x31a60, 0x31a7c}, - {0x31a7f, 0x31a89}, {0x31a90, 0x31a99}, {0x31aa0, 0x31aad}, {0x31ab0, 0x31abe}, - {0x31b00, 0x31b4b}, {0x31b50, 0x31b7c}, {0x31b80, 0x31bf3}, {0x31bfc, 0x31c37}, - {0x31c3b, 0x31c49}, {0x31c4d, 0x31c88}, {0x31cc0, 0x31cc7}, {0x31cd0, 0x31cf9}, - {0x31d00, 0x31df9}, {0x31dfb, 0x31f15}, {0x31f18, 0x31f1d}, {0x31f20, 0x31f45}, - {0x31f48, 0x31f4d}, {0x31f50, 0x31f57}, {0x31f5f, 0x31f7d}, {0x31f80, 0x31fb4}, - {0x31fb6, 0x31fc4}, {0x31fc6, 0x31fd3}, {0x31fd6, 0x31fdb}, {0x31fdd, 0x31fef}, - {0x31ff2, 0x31ff4}, {0x31ff6, 0x31ffe}, {0x32010, 0x32027}, {0x32030, 0x3205e}, - {0x32074, 0x3208e}, {0x32090, 0x3209c}, {0x320a0, 0x320bf}, {0x320d0, 0x320f0}, - {0x32100, 0x3218b}, {0x32190, 0x32426}, {0x32440, 0x3244a}, {0x32460, 0x32b73}, - {0x32b76, 0x32b95}, {0x32b98, 0x32bb9}, {0x32bbd, 0x32bc8}, {0x32bca, 0x32bd2}, - {0x32bec, 0x32bef}, {0x32c00, 0x32c2e}, {0x32c30, 0x32c5e}, {0x32c60, 0x32cf3}, - {0x32cf9, 0x32d25}, {0x32d30, 0x32d67}, {0x32d7f, 0x32d96}, {0x32da0, 0x32da6}, - {0x32da8, 0x32dae}, {0x32db0, 0x32db6}, {0x32db8, 0x32dbe}, {0x32dc0, 0x32dc6}, - {0x32dc8, 0x32dce}, {0x32dd0, 0x32dd6}, {0x32dd8, 0x32dde}, {0x32de0, 0x32e49}, - {0x32e80, 0x32e99}, {0x32e9b, 0x32ef3}, {0x32f00, 0x32fd5}, {0x32ff0, 0x32ffb}, - {0x33001, 0x3303f}, {0x33041, 0x33096}, {0x33099, 0x330ff}, {0x33105, 0x3312e}, - {0x33131, 0x3318e}, {0x33190, 0x331ba}, {0x331c0, 0x331e3}, {0x331f0, 0x3321e}, - {0x33220, 0x332fe}, {0x33300, 0x34db5}, {0x34dc0, 0x39fea}, {0x3a000, 0x3a48c}, - {0x3a490, 0x3a4c6}, {0x3a4d0, 0x3a62b}, {0x3a640, 0x3a6f7}, {0x3a700, 0x3a7ae}, - {0x3a7b0, 0x3a7b7}, {0x3a7f7, 0x3a82b}, {0x3a830, 0x3a839}, {0x3a840, 0x3a877}, - {0x3a880, 0x3a8c5}, {0x3a8ce, 0x3a8d9}, {0x3a8e0, 0x3a8fd}, {0x3a900, 0x3a953}, - {0x3a95f, 0x3a97c}, {0x3a980, 0x3a9cd}, {0x3a9cf, 0x3a9d9}, {0x3a9de, 0x3a9fe}, - {0x3aa00, 0x3aa36}, {0x3aa40, 0x3aa4d}, {0x3aa50, 0x3aa59}, {0x3aa5c, 0x3aac2}, - {0x3aadb, 0x3aaf6}, {0x3ab01, 0x3ab06}, {0x3ab09, 0x3ab0e}, {0x3ab11, 0x3ab16}, - {0x3ab20, 0x3ab26}, {0x3ab28, 0x3ab2e}, {0x3ab30, 0x3ab65}, {0x3ab70, 0x3abed}, - {0x3abf0, 0x3abf9}, {0x3ac00, 0x3d7a3}, {0x3d7b0, 0x3d7c6}, {0x3d7cb, 0x3d7fb}, - {0x3f900, 0x3fa6d}, {0x3fa70, 0x3fad9}, {0x3fb00, 0x3fb06}, {0x3fb13, 0x3fb17}, - {0x3fb1d, 0x3fb36}, {0x3fb38, 0x3fb3c}, {0x3fb46, 0x3fbc1}, {0x3fbd3, 0x3fd3f}, - {0x3fd50, 0x3fd8f}, {0x3fd92, 0x3fdc7}, {0x3fdf0, 0x3fdfd}, {0x3fe00, 0x3fe19}, - {0x3fe20, 0x3fe52}, {0x3fe54, 0x3fe66}, {0x3fe68, 0x3fe6b}, {0x3fe70, 0x3fe74}, - {0x3fe76, 0x3fefc}, {0x3ff01, 0x3ffbe}, {0x3ffc2, 0x3ffc7}, {0x3ffca, 0x3ffcf}, - {0x3ffd2, 0x3ffd7}, {0x3ffda, 0x3ffdc}, {0x3ffe0, 0x3ffe6}, {0x3ffe8, 0x3ffee}, - {0x40021, 0x4007e}, {0x400a1, 0x400ac}, {0x400ae, 0x40377}, {0x4037a, 0x4037f}, - {0x40384, 0x4038a}, {0x4038e, 0x403a1}, {0x403a3, 0x4052f}, {0x40531, 0x40556}, - {0x40559, 0x4055f}, {0x40561, 0x40587}, {0x4058d, 0x4058f}, {0x40591, 0x405c7}, - {0x405d0, 0x405ea}, {0x405f0, 0x405f4}, {0x40606, 0x4061b}, {0x4061e, 0x406dc}, - {0x406de, 0x4070d}, {0x40710, 0x4074a}, {0x4074d, 0x407b1}, {0x407c0, 0x407fa}, - {0x40800, 0x4082d}, {0x40830, 0x4083e}, {0x40840, 0x4085b}, {0x40860, 0x4086a}, - {0x408a0, 0x408b4}, {0x408b6, 0x408bd}, {0x408d4, 0x408e1}, {0x408e3, 0x40983}, - {0x40985, 0x4098c}, {0x40993, 0x409a8}, {0x409aa, 0x409b0}, {0x409b6, 0x409b9}, - {0x409bc, 0x409c4}, {0x409cb, 0x409ce}, {0x409df, 0x409e3}, {0x409e6, 0x409fd}, - {0x40a01, 0x40a03}, {0x40a05, 0x40a0a}, {0x40a13, 0x40a28}, {0x40a2a, 0x40a30}, - {0x40a3e, 0x40a42}, {0x40a4b, 0x40a4d}, {0x40a59, 0x40a5c}, {0x40a66, 0x40a75}, - {0x40a81, 0x40a83}, {0x40a85, 0x40a8d}, {0x40a8f, 0x40a91}, {0x40a93, 0x40aa8}, - {0x40aaa, 0x40ab0}, {0x40ab5, 0x40ab9}, {0x40abc, 0x40ac5}, {0x40ac7, 0x40ac9}, - {0x40acb, 0x40acd}, {0x40ae0, 0x40ae3}, {0x40ae6, 0x40af1}, {0x40af9, 0x40aff}, - {0x40b01, 0x40b03}, {0x40b05, 0x40b0c}, {0x40b13, 0x40b28}, {0x40b2a, 0x40b30}, - {0x40b35, 0x40b39}, {0x40b3c, 0x40b44}, {0x40b4b, 0x40b4d}, {0x40b5f, 0x40b63}, - {0x40b66, 0x40b77}, {0x40b85, 0x40b8a}, {0x40b8e, 0x40b90}, {0x40b92, 0x40b95}, - {0x40ba8, 0x40baa}, {0x40bae, 0x40bb9}, {0x40bbe, 0x40bc2}, {0x40bc6, 0x40bc8}, - {0x40bca, 0x40bcd}, {0x40be6, 0x40bfa}, {0x40c00, 0x40c03}, {0x40c05, 0x40c0c}, - {0x40c0e, 0x40c10}, {0x40c12, 0x40c28}, {0x40c2a, 0x40c39}, {0x40c3d, 0x40c44}, - {0x40c46, 0x40c48}, {0x40c4a, 0x40c4d}, {0x40c58, 0x40c5a}, {0x40c60, 0x40c63}, - {0x40c66, 0x40c6f}, {0x40c78, 0x40c83}, {0x40c85, 0x40c8c}, {0x40c8e, 0x40c90}, - {0x40c92, 0x40ca8}, {0x40caa, 0x40cb3}, {0x40cb5, 0x40cb9}, {0x40cbc, 0x40cc4}, - {0x40cc6, 0x40cc8}, {0x40cca, 0x40ccd}, {0x40ce0, 0x40ce3}, {0x40ce6, 0x40cef}, - {0x40d00, 0x40d03}, {0x40d05, 0x40d0c}, {0x40d0e, 0x40d10}, {0x40d12, 0x40d44}, - {0x40d46, 0x40d48}, {0x40d4a, 0x40d4f}, {0x40d54, 0x40d63}, {0x40d66, 0x40d7f}, - {0x40d85, 0x40d96}, {0x40d9a, 0x40db1}, {0x40db3, 0x40dbb}, {0x40dc0, 0x40dc6}, - {0x40dcf, 0x40dd4}, {0x40dd8, 0x40ddf}, {0x40de6, 0x40def}, {0x40df2, 0x40df4}, - {0x40e01, 0x40e3a}, {0x40e3f, 0x40e5b}, {0x40e94, 0x40e97}, {0x40e99, 0x40e9f}, - {0x40ea1, 0x40ea3}, {0x40ead, 0x40eb9}, {0x40ebb, 0x40ebd}, {0x40ec0, 0x40ec4}, - {0x40ec8, 0x40ecd}, {0x40ed0, 0x40ed9}, {0x40edc, 0x40edf}, {0x40f00, 0x40f47}, - {0x40f49, 0x40f6c}, {0x40f71, 0x40f97}, {0x40f99, 0x40fbc}, {0x40fbe, 0x40fcc}, - {0x40fce, 0x40fda}, {0x41000, 0x410c5}, {0x410d0, 0x41248}, {0x4124a, 0x4124d}, - {0x41250, 0x41256}, {0x4125a, 0x4125d}, {0x41260, 0x41288}, {0x4128a, 0x4128d}, - {0x41290, 0x412b0}, {0x412b2, 0x412b5}, {0x412b8, 0x412be}, {0x412c2, 0x412c5}, - {0x412c8, 0x412d6}, {0x412d8, 0x41310}, {0x41312, 0x41315}, {0x41318, 0x4135a}, - {0x4135d, 0x4137c}, {0x41380, 0x41399}, {0x413a0, 0x413f5}, {0x413f8, 0x413fd}, - {0x41400, 0x4167f}, {0x41681, 0x4169c}, {0x416a0, 0x416f8}, {0x41700, 0x4170c}, - {0x4170e, 0x41714}, {0x41720, 0x41736}, {0x41740, 0x41753}, {0x41760, 0x4176c}, - {0x4176e, 0x41770}, {0x41780, 0x417dd}, {0x417e0, 0x417e9}, {0x417f0, 0x417f9}, - {0x41800, 0x4180d}, {0x41810, 0x41819}, {0x41820, 0x41877}, {0x41880, 0x418aa}, - {0x418b0, 0x418f5}, {0x41900, 0x4191e}, {0x41920, 0x4192b}, {0x41930, 0x4193b}, - {0x41944, 0x4196d}, {0x41970, 0x41974}, {0x41980, 0x419ab}, {0x419b0, 0x419c9}, - {0x419d0, 0x419da}, {0x419de, 0x41a1b}, {0x41a1e, 0x41a5e}, {0x41a60, 0x41a7c}, - {0x41a7f, 0x41a89}, {0x41a90, 0x41a99}, {0x41aa0, 0x41aad}, {0x41ab0, 0x41abe}, - {0x41b00, 0x41b4b}, {0x41b50, 0x41b7c}, {0x41b80, 0x41bf3}, {0x41bfc, 0x41c37}, - {0x41c3b, 0x41c49}, {0x41c4d, 0x41c88}, {0x41cc0, 0x41cc7}, {0x41cd0, 0x41cf9}, - {0x41d00, 0x41df9}, {0x41dfb, 0x41f15}, {0x41f18, 0x41f1d}, {0x41f20, 0x41f45}, - {0x41f48, 0x41f4d}, {0x41f50, 0x41f57}, {0x41f5f, 0x41f7d}, {0x41f80, 0x41fb4}, - {0x41fb6, 0x41fc4}, {0x41fc6, 0x41fd3}, {0x41fd6, 0x41fdb}, {0x41fdd, 0x41fef}, - {0x41ff2, 0x41ff4}, {0x41ff6, 0x41ffe}, {0x42010, 0x42027}, {0x42030, 0x4205e}, - {0x42074, 0x4208e}, {0x42090, 0x4209c}, {0x420a0, 0x420bf}, {0x420d0, 0x420f0}, - {0x42100, 0x4218b}, {0x42190, 0x42426}, {0x42440, 0x4244a}, {0x42460, 0x42b73}, - {0x42b76, 0x42b95}, {0x42b98, 0x42bb9}, {0x42bbd, 0x42bc8}, {0x42bca, 0x42bd2}, - {0x42bec, 0x42bef}, {0x42c00, 0x42c2e}, {0x42c30, 0x42c5e}, {0x42c60, 0x42cf3}, - {0x42cf9, 0x42d25}, {0x42d30, 0x42d67}, {0x42d7f, 0x42d96}, {0x42da0, 0x42da6}, - {0x42da8, 0x42dae}, {0x42db0, 0x42db6}, {0x42db8, 0x42dbe}, {0x42dc0, 0x42dc6}, - {0x42dc8, 0x42dce}, {0x42dd0, 0x42dd6}, {0x42dd8, 0x42dde}, {0x42de0, 0x42e49}, - {0x42e80, 0x42e99}, {0x42e9b, 0x42ef3}, {0x42f00, 0x42fd5}, {0x42ff0, 0x42ffb}, - {0x43001, 0x4303f}, {0x43041, 0x43096}, {0x43099, 0x430ff}, {0x43105, 0x4312e}, - {0x43131, 0x4318e}, {0x43190, 0x431ba}, {0x431c0, 0x431e3}, {0x431f0, 0x4321e}, - {0x43220, 0x432fe}, {0x43300, 0x44db5}, {0x44dc0, 0x49fea}, {0x4a000, 0x4a48c}, - {0x4a490, 0x4a4c6}, {0x4a4d0, 0x4a62b}, {0x4a640, 0x4a6f7}, {0x4a700, 0x4a7ae}, - {0x4a7b0, 0x4a7b7}, {0x4a7f7, 0x4a82b}, {0x4a830, 0x4a839}, {0x4a840, 0x4a877}, - {0x4a880, 0x4a8c5}, {0x4a8ce, 0x4a8d9}, {0x4a8e0, 0x4a8fd}, {0x4a900, 0x4a953}, - {0x4a95f, 0x4a97c}, {0x4a980, 0x4a9cd}, {0x4a9cf, 0x4a9d9}, {0x4a9de, 0x4a9fe}, - {0x4aa00, 0x4aa36}, {0x4aa40, 0x4aa4d}, {0x4aa50, 0x4aa59}, {0x4aa5c, 0x4aac2}, - {0x4aadb, 0x4aaf6}, {0x4ab01, 0x4ab06}, {0x4ab09, 0x4ab0e}, {0x4ab11, 0x4ab16}, - {0x4ab20, 0x4ab26}, {0x4ab28, 0x4ab2e}, {0x4ab30, 0x4ab65}, {0x4ab70, 0x4abed}, - {0x4abf0, 0x4abf9}, {0x4ac00, 0x4d7a3}, {0x4d7b0, 0x4d7c6}, {0x4d7cb, 0x4d7fb}, - {0x4f900, 0x4fa6d}, {0x4fa70, 0x4fad9}, {0x4fb00, 0x4fb06}, {0x4fb13, 0x4fb17}, - {0x4fb1d, 0x4fb36}, {0x4fb38, 0x4fb3c}, {0x4fb46, 0x4fbc1}, {0x4fbd3, 0x4fd3f}, - {0x4fd50, 0x4fd8f}, {0x4fd92, 0x4fdc7}, {0x4fdf0, 0x4fdfd}, {0x4fe00, 0x4fe19}, - {0x4fe20, 0x4fe52}, {0x4fe54, 0x4fe66}, {0x4fe68, 0x4fe6b}, {0x4fe70, 0x4fe74}, - {0x4fe76, 0x4fefc}, {0x4ff01, 0x4ffbe}, {0x4ffc2, 0x4ffc7}, {0x4ffca, 0x4ffcf}, - {0x4ffd2, 0x4ffd7}, {0x4ffda, 0x4ffdc}, {0x4ffe0, 0x4ffe6}, {0x4ffe8, 0x4ffee}, - {0x50021, 0x5007e}, {0x500a1, 0x500ac}, {0x500ae, 0x50377}, {0x5037a, 0x5037f}, - {0x50384, 0x5038a}, {0x5038e, 0x503a1}, {0x503a3, 0x5052f}, {0x50531, 0x50556}, - {0x50559, 0x5055f}, {0x50561, 0x50587}, {0x5058d, 0x5058f}, {0x50591, 0x505c7}, - {0x505d0, 0x505ea}, {0x505f0, 0x505f4}, {0x50606, 0x5061b}, {0x5061e, 0x506dc}, - {0x506de, 0x5070d}, {0x50710, 0x5074a}, {0x5074d, 0x507b1}, {0x507c0, 0x507fa}, - {0x50800, 0x5082d}, {0x50830, 0x5083e}, {0x50840, 0x5085b}, {0x50860, 0x5086a}, - {0x508a0, 0x508b4}, {0x508b6, 0x508bd}, {0x508d4, 0x508e1}, {0x508e3, 0x50983}, - {0x50985, 0x5098c}, {0x50993, 0x509a8}, {0x509aa, 0x509b0}, {0x509b6, 0x509b9}, - {0x509bc, 0x509c4}, {0x509cb, 0x509ce}, {0x509df, 0x509e3}, {0x509e6, 0x509fd}, - {0x50a01, 0x50a03}, {0x50a05, 0x50a0a}, {0x50a13, 0x50a28}, {0x50a2a, 0x50a30}, - {0x50a3e, 0x50a42}, {0x50a4b, 0x50a4d}, {0x50a59, 0x50a5c}, {0x50a66, 0x50a75}, - {0x50a81, 0x50a83}, {0x50a85, 0x50a8d}, {0x50a8f, 0x50a91}, {0x50a93, 0x50aa8}, - {0x50aaa, 0x50ab0}, {0x50ab5, 0x50ab9}, {0x50abc, 0x50ac5}, {0x50ac7, 0x50ac9}, - {0x50acb, 0x50acd}, {0x50ae0, 0x50ae3}, {0x50ae6, 0x50af1}, {0x50af9, 0x50aff}, - {0x50b01, 0x50b03}, {0x50b05, 0x50b0c}, {0x50b13, 0x50b28}, {0x50b2a, 0x50b30}, - {0x50b35, 0x50b39}, {0x50b3c, 0x50b44}, {0x50b4b, 0x50b4d}, {0x50b5f, 0x50b63}, - {0x50b66, 0x50b77}, {0x50b85, 0x50b8a}, {0x50b8e, 0x50b90}, {0x50b92, 0x50b95}, - {0x50ba8, 0x50baa}, {0x50bae, 0x50bb9}, {0x50bbe, 0x50bc2}, {0x50bc6, 0x50bc8}, - {0x50bca, 0x50bcd}, {0x50be6, 0x50bfa}, {0x50c00, 0x50c03}, {0x50c05, 0x50c0c}, - {0x50c0e, 0x50c10}, {0x50c12, 0x50c28}, {0x50c2a, 0x50c39}, {0x50c3d, 0x50c44}, - {0x50c46, 0x50c48}, {0x50c4a, 0x50c4d}, {0x50c58, 0x50c5a}, {0x50c60, 0x50c63}, - {0x50c66, 0x50c6f}, {0x50c78, 0x50c83}, {0x50c85, 0x50c8c}, {0x50c8e, 0x50c90}, - {0x50c92, 0x50ca8}, {0x50caa, 0x50cb3}, {0x50cb5, 0x50cb9}, {0x50cbc, 0x50cc4}, - {0x50cc6, 0x50cc8}, {0x50cca, 0x50ccd}, {0x50ce0, 0x50ce3}, {0x50ce6, 0x50cef}, - {0x50d00, 0x50d03}, {0x50d05, 0x50d0c}, {0x50d0e, 0x50d10}, {0x50d12, 0x50d44}, - {0x50d46, 0x50d48}, {0x50d4a, 0x50d4f}, {0x50d54, 0x50d63}, {0x50d66, 0x50d7f}, - {0x50d85, 0x50d96}, {0x50d9a, 0x50db1}, {0x50db3, 0x50dbb}, {0x50dc0, 0x50dc6}, - {0x50dcf, 0x50dd4}, {0x50dd8, 0x50ddf}, {0x50de6, 0x50def}, {0x50df2, 0x50df4}, - {0x50e01, 0x50e3a}, {0x50e3f, 0x50e5b}, {0x50e94, 0x50e97}, {0x50e99, 0x50e9f}, - {0x50ea1, 0x50ea3}, {0x50ead, 0x50eb9}, {0x50ebb, 0x50ebd}, {0x50ec0, 0x50ec4}, - {0x50ec8, 0x50ecd}, {0x50ed0, 0x50ed9}, {0x50edc, 0x50edf}, {0x50f00, 0x50f47}, - {0x50f49, 0x50f6c}, {0x50f71, 0x50f97}, {0x50f99, 0x50fbc}, {0x50fbe, 0x50fcc}, - {0x50fce, 0x50fda}, {0x51000, 0x510c5}, {0x510d0, 0x51248}, {0x5124a, 0x5124d}, - {0x51250, 0x51256}, {0x5125a, 0x5125d}, {0x51260, 0x51288}, {0x5128a, 0x5128d}, - {0x51290, 0x512b0}, {0x512b2, 0x512b5}, {0x512b8, 0x512be}, {0x512c2, 0x512c5}, - {0x512c8, 0x512d6}, {0x512d8, 0x51310}, {0x51312, 0x51315}, {0x51318, 0x5135a}, - {0x5135d, 0x5137c}, {0x51380, 0x51399}, {0x513a0, 0x513f5}, {0x513f8, 0x513fd}, - {0x51400, 0x5167f}, {0x51681, 0x5169c}, {0x516a0, 0x516f8}, {0x51700, 0x5170c}, - {0x5170e, 0x51714}, {0x51720, 0x51736}, {0x51740, 0x51753}, {0x51760, 0x5176c}, - {0x5176e, 0x51770}, {0x51780, 0x517dd}, {0x517e0, 0x517e9}, {0x517f0, 0x517f9}, - {0x51800, 0x5180d}, {0x51810, 0x51819}, {0x51820, 0x51877}, {0x51880, 0x518aa}, - {0x518b0, 0x518f5}, {0x51900, 0x5191e}, {0x51920, 0x5192b}, {0x51930, 0x5193b}, - {0x51944, 0x5196d}, {0x51970, 0x51974}, {0x51980, 0x519ab}, {0x519b0, 0x519c9}, - {0x519d0, 0x519da}, {0x519de, 0x51a1b}, {0x51a1e, 0x51a5e}, {0x51a60, 0x51a7c}, - {0x51a7f, 0x51a89}, {0x51a90, 0x51a99}, {0x51aa0, 0x51aad}, {0x51ab0, 0x51abe}, - {0x51b00, 0x51b4b}, {0x51b50, 0x51b7c}, {0x51b80, 0x51bf3}, {0x51bfc, 0x51c37}, - {0x51c3b, 0x51c49}, {0x51c4d, 0x51c88}, {0x51cc0, 0x51cc7}, {0x51cd0, 0x51cf9}, - {0x51d00, 0x51df9}, {0x51dfb, 0x51f15}, {0x51f18, 0x51f1d}, {0x51f20, 0x51f45}, - {0x51f48, 0x51f4d}, {0x51f50, 0x51f57}, {0x51f5f, 0x51f7d}, {0x51f80, 0x51fb4}, - {0x51fb6, 0x51fc4}, {0x51fc6, 0x51fd3}, {0x51fd6, 0x51fdb}, {0x51fdd, 0x51fef}, - {0x51ff2, 0x51ff4}, {0x51ff6, 0x51ffe}, {0x52010, 0x52027}, {0x52030, 0x5205e}, - {0x52074, 0x5208e}, {0x52090, 0x5209c}, {0x520a0, 0x520bf}, {0x520d0, 0x520f0}, - {0x52100, 0x5218b}, {0x52190, 0x52426}, {0x52440, 0x5244a}, {0x52460, 0x52b73}, - {0x52b76, 0x52b95}, {0x52b98, 0x52bb9}, {0x52bbd, 0x52bc8}, {0x52bca, 0x52bd2}, - {0x52bec, 0x52bef}, {0x52c00, 0x52c2e}, {0x52c30, 0x52c5e}, {0x52c60, 0x52cf3}, - {0x52cf9, 0x52d25}, {0x52d30, 0x52d67}, {0x52d7f, 0x52d96}, {0x52da0, 0x52da6}, - {0x52da8, 0x52dae}, {0x52db0, 0x52db6}, {0x52db8, 0x52dbe}, {0x52dc0, 0x52dc6}, - {0x52dc8, 0x52dce}, {0x52dd0, 0x52dd6}, {0x52dd8, 0x52dde}, {0x52de0, 0x52e49}, - {0x52e80, 0x52e99}, {0x52e9b, 0x52ef3}, {0x52f00, 0x52fd5}, {0x52ff0, 0x52ffb}, - {0x53001, 0x5303f}, {0x53041, 0x53096}, {0x53099, 0x530ff}, {0x53105, 0x5312e}, - {0x53131, 0x5318e}, {0x53190, 0x531ba}, {0x531c0, 0x531e3}, {0x531f0, 0x5321e}, - {0x53220, 0x532fe}, {0x53300, 0x54db5}, {0x54dc0, 0x59fea}, {0x5a000, 0x5a48c}, - {0x5a490, 0x5a4c6}, {0x5a4d0, 0x5a62b}, {0x5a640, 0x5a6f7}, {0x5a700, 0x5a7ae}, - {0x5a7b0, 0x5a7b7}, {0x5a7f7, 0x5a82b}, {0x5a830, 0x5a839}, {0x5a840, 0x5a877}, - {0x5a880, 0x5a8c5}, {0x5a8ce, 0x5a8d9}, {0x5a8e0, 0x5a8fd}, {0x5a900, 0x5a953}, - {0x5a95f, 0x5a97c}, {0x5a980, 0x5a9cd}, {0x5a9cf, 0x5a9d9}, {0x5a9de, 0x5a9fe}, - {0x5aa00, 0x5aa36}, {0x5aa40, 0x5aa4d}, {0x5aa50, 0x5aa59}, {0x5aa5c, 0x5aac2}, - {0x5aadb, 0x5aaf6}, {0x5ab01, 0x5ab06}, {0x5ab09, 0x5ab0e}, {0x5ab11, 0x5ab16}, - {0x5ab20, 0x5ab26}, {0x5ab28, 0x5ab2e}, {0x5ab30, 0x5ab65}, {0x5ab70, 0x5abed}, - {0x5abf0, 0x5abf9}, {0x5ac00, 0x5d7a3}, {0x5d7b0, 0x5d7c6}, {0x5d7cb, 0x5d7fb}, - {0x5f900, 0x5fa6d}, {0x5fa70, 0x5fad9}, {0x5fb00, 0x5fb06}, {0x5fb13, 0x5fb17}, - {0x5fb1d, 0x5fb36}, {0x5fb38, 0x5fb3c}, {0x5fb46, 0x5fbc1}, {0x5fbd3, 0x5fd3f}, - {0x5fd50, 0x5fd8f}, {0x5fd92, 0x5fdc7}, {0x5fdf0, 0x5fdfd}, {0x5fe00, 0x5fe19}, - {0x5fe20, 0x5fe52}, {0x5fe54, 0x5fe66}, {0x5fe68, 0x5fe6b}, {0x5fe70, 0x5fe74}, - {0x5fe76, 0x5fefc}, {0x5ff01, 0x5ffbe}, {0x5ffc2, 0x5ffc7}, {0x5ffca, 0x5ffcf}, - {0x5ffd2, 0x5ffd7}, {0x5ffda, 0x5ffdc}, {0x5ffe0, 0x5ffe6}, {0x5ffe8, 0x5ffee}, - {0x60021, 0x6007e}, {0x600a1, 0x600ac}, {0x600ae, 0x60377}, {0x6037a, 0x6037f}, - {0x60384, 0x6038a}, {0x6038e, 0x603a1}, {0x603a3, 0x6052f}, {0x60531, 0x60556}, - {0x60559, 0x6055f}, {0x60561, 0x60587}, {0x6058d, 0x6058f}, {0x60591, 0x605c7}, - {0x605d0, 0x605ea}, {0x605f0, 0x605f4}, {0x60606, 0x6061b}, {0x6061e, 0x606dc}, - {0x606de, 0x6070d}, {0x60710, 0x6074a}, {0x6074d, 0x607b1}, {0x607c0, 0x607fa}, - {0x60800, 0x6082d}, {0x60830, 0x6083e}, {0x60840, 0x6085b}, {0x60860, 0x6086a}, - {0x608a0, 0x608b4}, {0x608b6, 0x608bd}, {0x608d4, 0x608e1}, {0x608e3, 0x60983}, - {0x60985, 0x6098c}, {0x60993, 0x609a8}, {0x609aa, 0x609b0}, {0x609b6, 0x609b9}, - {0x609bc, 0x609c4}, {0x609cb, 0x609ce}, {0x609df, 0x609e3}, {0x609e6, 0x609fd}, - {0x60a01, 0x60a03}, {0x60a05, 0x60a0a}, {0x60a13, 0x60a28}, {0x60a2a, 0x60a30}, - {0x60a3e, 0x60a42}, {0x60a4b, 0x60a4d}, {0x60a59, 0x60a5c}, {0x60a66, 0x60a75}, - {0x60a81, 0x60a83}, {0x60a85, 0x60a8d}, {0x60a8f, 0x60a91}, {0x60a93, 0x60aa8}, - {0x60aaa, 0x60ab0}, {0x60ab5, 0x60ab9}, {0x60abc, 0x60ac5}, {0x60ac7, 0x60ac9}, - {0x60acb, 0x60acd}, {0x60ae0, 0x60ae3}, {0x60ae6, 0x60af1}, {0x60af9, 0x60aff}, - {0x60b01, 0x60b03}, {0x60b05, 0x60b0c}, {0x60b13, 0x60b28}, {0x60b2a, 0x60b30}, - {0x60b35, 0x60b39}, {0x60b3c, 0x60b44}, {0x60b4b, 0x60b4d}, {0x60b5f, 0x60b63}, - {0x60b66, 0x60b77}, {0x60b85, 0x60b8a}, {0x60b8e, 0x60b90}, {0x60b92, 0x60b95}, - {0x60ba8, 0x60baa}, {0x60bae, 0x60bb9}, {0x60bbe, 0x60bc2}, {0x60bc6, 0x60bc8}, - {0x60bca, 0x60bcd}, {0x60be6, 0x60bfa}, {0x60c00, 0x60c03}, {0x60c05, 0x60c0c}, - {0x60c0e, 0x60c10}, {0x60c12, 0x60c28}, {0x60c2a, 0x60c39}, {0x60c3d, 0x60c44}, - {0x60c46, 0x60c48}, {0x60c4a, 0x60c4d}, {0x60c58, 0x60c5a}, {0x60c60, 0x60c63}, - {0x60c66, 0x60c6f}, {0x60c78, 0x60c83}, {0x60c85, 0x60c8c}, {0x60c8e, 0x60c90}, - {0x60c92, 0x60ca8}, {0x60caa, 0x60cb3}, {0x60cb5, 0x60cb9}, {0x60cbc, 0x60cc4}, - {0x60cc6, 0x60cc8}, {0x60cca, 0x60ccd}, {0x60ce0, 0x60ce3}, {0x60ce6, 0x60cef}, - {0x60d00, 0x60d03}, {0x60d05, 0x60d0c}, {0x60d0e, 0x60d10}, {0x60d12, 0x60d44}, - {0x60d46, 0x60d48}, {0x60d4a, 0x60d4f}, {0x60d54, 0x60d63}, {0x60d66, 0x60d7f}, - {0x60d85, 0x60d96}, {0x60d9a, 0x60db1}, {0x60db3, 0x60dbb}, {0x60dc0, 0x60dc6}, - {0x60dcf, 0x60dd4}, {0x60dd8, 0x60ddf}, {0x60de6, 0x60def}, {0x60df2, 0x60df4}, - {0x60e01, 0x60e3a}, {0x60e3f, 0x60e5b}, {0x60e94, 0x60e97}, {0x60e99, 0x60e9f}, - {0x60ea1, 0x60ea3}, {0x60ead, 0x60eb9}, {0x60ebb, 0x60ebd}, {0x60ec0, 0x60ec4}, - {0x60ec8, 0x60ecd}, {0x60ed0, 0x60ed9}, {0x60edc, 0x60edf}, {0x60f00, 0x60f47}, - {0x60f49, 0x60f6c}, {0x60f71, 0x60f97}, {0x60f99, 0x60fbc}, {0x60fbe, 0x60fcc}, - {0x60fce, 0x60fda}, {0x61000, 0x610c5}, {0x610d0, 0x61248}, {0x6124a, 0x6124d}, - {0x61250, 0x61256}, {0x6125a, 0x6125d}, {0x61260, 0x61288}, {0x6128a, 0x6128d}, - {0x61290, 0x612b0}, {0x612b2, 0x612b5}, {0x612b8, 0x612be}, {0x612c2, 0x612c5}, - {0x612c8, 0x612d6}, {0x612d8, 0x61310}, {0x61312, 0x61315}, {0x61318, 0x6135a}, - {0x6135d, 0x6137c}, {0x61380, 0x61399}, {0x613a0, 0x613f5}, {0x613f8, 0x613fd}, - {0x61400, 0x6167f}, {0x61681, 0x6169c}, {0x616a0, 0x616f8}, {0x61700, 0x6170c}, - {0x6170e, 0x61714}, {0x61720, 0x61736}, {0x61740, 0x61753}, {0x61760, 0x6176c}, - {0x6176e, 0x61770}, {0x61780, 0x617dd}, {0x617e0, 0x617e9}, {0x617f0, 0x617f9}, - {0x61800, 0x6180d}, {0x61810, 0x61819}, {0x61820, 0x61877}, {0x61880, 0x618aa}, - {0x618b0, 0x618f5}, {0x61900, 0x6191e}, {0x61920, 0x6192b}, {0x61930, 0x6193b}, - {0x61944, 0x6196d}, {0x61970, 0x61974}, {0x61980, 0x619ab}, {0x619b0, 0x619c9}, - {0x619d0, 0x619da}, {0x619de, 0x61a1b}, {0x61a1e, 0x61a5e}, {0x61a60, 0x61a7c}, - {0x61a7f, 0x61a89}, {0x61a90, 0x61a99}, {0x61aa0, 0x61aad}, {0x61ab0, 0x61abe}, - {0x61b00, 0x61b4b}, {0x61b50, 0x61b7c}, {0x61b80, 0x61bf3}, {0x61bfc, 0x61c37}, - {0x61c3b, 0x61c49}, {0x61c4d, 0x61c88}, {0x61cc0, 0x61cc7}, {0x61cd0, 0x61cf9}, - {0x61d00, 0x61df9}, {0x61dfb, 0x61f15}, {0x61f18, 0x61f1d}, {0x61f20, 0x61f45}, - {0x61f48, 0x61f4d}, {0x61f50, 0x61f57}, {0x61f5f, 0x61f7d}, {0x61f80, 0x61fb4}, - {0x61fb6, 0x61fc4}, {0x61fc6, 0x61fd3}, {0x61fd6, 0x61fdb}, {0x61fdd, 0x61fef}, - {0x61ff2, 0x61ff4}, {0x61ff6, 0x61ffe}, {0x62010, 0x62027}, {0x62030, 0x6205e}, - {0x62074, 0x6208e}, {0x62090, 0x6209c}, {0x620a0, 0x620bf}, {0x620d0, 0x620f0}, - {0x62100, 0x6218b}, {0x62190, 0x62426}, {0x62440, 0x6244a}, {0x62460, 0x62b73}, - {0x62b76, 0x62b95}, {0x62b98, 0x62bb9}, {0x62bbd, 0x62bc8}, {0x62bca, 0x62bd2}, - {0x62bec, 0x62bef}, {0x62c00, 0x62c2e}, {0x62c30, 0x62c5e}, {0x62c60, 0x62cf3}, - {0x62cf9, 0x62d25}, {0x62d30, 0x62d67}, {0x62d7f, 0x62d96}, {0x62da0, 0x62da6}, - {0x62da8, 0x62dae}, {0x62db0, 0x62db6}, {0x62db8, 0x62dbe}, {0x62dc0, 0x62dc6}, - {0x62dc8, 0x62dce}, {0x62dd0, 0x62dd6}, {0x62dd8, 0x62dde}, {0x62de0, 0x62e49}, - {0x62e80, 0x62e99}, {0x62e9b, 0x62ef3}, {0x62f00, 0x62fd5}, {0x62ff0, 0x62ffb}, - {0x63001, 0x6303f}, {0x63041, 0x63096}, {0x63099, 0x630ff}, {0x63105, 0x6312e}, - {0x63131, 0x6318e}, {0x63190, 0x631ba}, {0x631c0, 0x631e3}, {0x631f0, 0x6321e}, - {0x63220, 0x632fe}, {0x63300, 0x64db5}, {0x64dc0, 0x69fea}, {0x6a000, 0x6a48c}, - {0x6a490, 0x6a4c6}, {0x6a4d0, 0x6a62b}, {0x6a640, 0x6a6f7}, {0x6a700, 0x6a7ae}, - {0x6a7b0, 0x6a7b7}, {0x6a7f7, 0x6a82b}, {0x6a830, 0x6a839}, {0x6a840, 0x6a877}, - {0x6a880, 0x6a8c5}, {0x6a8ce, 0x6a8d9}, {0x6a8e0, 0x6a8fd}, {0x6a900, 0x6a953}, - {0x6a95f, 0x6a97c}, {0x6a980, 0x6a9cd}, {0x6a9cf, 0x6a9d9}, {0x6a9de, 0x6a9fe}, - {0x6aa00, 0x6aa36}, {0x6aa40, 0x6aa4d}, {0x6aa50, 0x6aa59}, {0x6aa5c, 0x6aac2}, - {0x6aadb, 0x6aaf6}, {0x6ab01, 0x6ab06}, {0x6ab09, 0x6ab0e}, {0x6ab11, 0x6ab16}, - {0x6ab20, 0x6ab26}, {0x6ab28, 0x6ab2e}, {0x6ab30, 0x6ab65}, {0x6ab70, 0x6abed}, - {0x6abf0, 0x6abf9}, {0x6ac00, 0x6d7a3}, {0x6d7b0, 0x6d7c6}, {0x6d7cb, 0x6d7fb}, - {0x6f900, 0x6fa6d}, {0x6fa70, 0x6fad9}, {0x6fb00, 0x6fb06}, {0x6fb13, 0x6fb17}, - {0x6fb1d, 0x6fb36}, {0x6fb38, 0x6fb3c}, {0x6fb46, 0x6fbc1}, {0x6fbd3, 0x6fd3f}, - {0x6fd50, 0x6fd8f}, {0x6fd92, 0x6fdc7}, {0x6fdf0, 0x6fdfd}, {0x6fe00, 0x6fe19}, - {0x6fe20, 0x6fe52}, {0x6fe54, 0x6fe66}, {0x6fe68, 0x6fe6b}, {0x6fe70, 0x6fe74}, - {0x6fe76, 0x6fefc}, {0x6ff01, 0x6ffbe}, {0x6ffc2, 0x6ffc7}, {0x6ffca, 0x6ffcf}, - {0x6ffd2, 0x6ffd7}, {0x6ffda, 0x6ffdc}, {0x6ffe0, 0x6ffe6}, {0x6ffe8, 0x6ffee}, - {0x70021, 0x7007e}, {0x700a1, 0x700ac}, {0x700ae, 0x70377}, {0x7037a, 0x7037f}, - {0x70384, 0x7038a}, {0x7038e, 0x703a1}, {0x703a3, 0x7052f}, {0x70531, 0x70556}, - {0x70559, 0x7055f}, {0x70561, 0x70587}, {0x7058d, 0x7058f}, {0x70591, 0x705c7}, - {0x705d0, 0x705ea}, {0x705f0, 0x705f4}, {0x70606, 0x7061b}, {0x7061e, 0x706dc}, - {0x706de, 0x7070d}, {0x70710, 0x7074a}, {0x7074d, 0x707b1}, {0x707c0, 0x707fa}, - {0x70800, 0x7082d}, {0x70830, 0x7083e}, {0x70840, 0x7085b}, {0x70860, 0x7086a}, - {0x708a0, 0x708b4}, {0x708b6, 0x708bd}, {0x708d4, 0x708e1}, {0x708e3, 0x70983}, - {0x70985, 0x7098c}, {0x70993, 0x709a8}, {0x709aa, 0x709b0}, {0x709b6, 0x709b9}, - {0x709bc, 0x709c4}, {0x709cb, 0x709ce}, {0x709df, 0x709e3}, {0x709e6, 0x709fd}, - {0x70a01, 0x70a03}, {0x70a05, 0x70a0a}, {0x70a13, 0x70a28}, {0x70a2a, 0x70a30}, - {0x70a3e, 0x70a42}, {0x70a4b, 0x70a4d}, {0x70a59, 0x70a5c}, {0x70a66, 0x70a75}, - {0x70a81, 0x70a83}, {0x70a85, 0x70a8d}, {0x70a8f, 0x70a91}, {0x70a93, 0x70aa8}, - {0x70aaa, 0x70ab0}, {0x70ab5, 0x70ab9}, {0x70abc, 0x70ac5}, {0x70ac7, 0x70ac9}, - {0x70acb, 0x70acd}, {0x70ae0, 0x70ae3}, {0x70ae6, 0x70af1}, {0x70af9, 0x70aff}, - {0x70b01, 0x70b03}, {0x70b05, 0x70b0c}, {0x70b13, 0x70b28}, {0x70b2a, 0x70b30}, - {0x70b35, 0x70b39}, {0x70b3c, 0x70b44}, {0x70b4b, 0x70b4d}, {0x70b5f, 0x70b63}, - {0x70b66, 0x70b77}, {0x70b85, 0x70b8a}, {0x70b8e, 0x70b90}, {0x70b92, 0x70b95}, - {0x70ba8, 0x70baa}, {0x70bae, 0x70bb9}, {0x70bbe, 0x70bc2}, {0x70bc6, 0x70bc8}, - {0x70bca, 0x70bcd}, {0x70be6, 0x70bfa}, {0x70c00, 0x70c03}, {0x70c05, 0x70c0c}, - {0x70c0e, 0x70c10}, {0x70c12, 0x70c28}, {0x70c2a, 0x70c39}, {0x70c3d, 0x70c44}, - {0x70c46, 0x70c48}, {0x70c4a, 0x70c4d}, {0x70c58, 0x70c5a}, {0x70c60, 0x70c63}, - {0x70c66, 0x70c6f}, {0x70c78, 0x70c83}, {0x70c85, 0x70c8c}, {0x70c8e, 0x70c90}, - {0x70c92, 0x70ca8}, {0x70caa, 0x70cb3}, {0x70cb5, 0x70cb9}, {0x70cbc, 0x70cc4}, - {0x70cc6, 0x70cc8}, {0x70cca, 0x70ccd}, {0x70ce0, 0x70ce3}, {0x70ce6, 0x70cef}, - {0x70d00, 0x70d03}, {0x70d05, 0x70d0c}, {0x70d0e, 0x70d10}, {0x70d12, 0x70d44}, - {0x70d46, 0x70d48}, {0x70d4a, 0x70d4f}, {0x70d54, 0x70d63}, {0x70d66, 0x70d7f}, - {0x70d85, 0x70d96}, {0x70d9a, 0x70db1}, {0x70db3, 0x70dbb}, {0x70dc0, 0x70dc6}, - {0x70dcf, 0x70dd4}, {0x70dd8, 0x70ddf}, {0x70de6, 0x70def}, {0x70df2, 0x70df4}, - {0x70e01, 0x70e3a}, {0x70e3f, 0x70e5b}, {0x70e94, 0x70e97}, {0x70e99, 0x70e9f}, - {0x70ea1, 0x70ea3}, {0x70ead, 0x70eb9}, {0x70ebb, 0x70ebd}, {0x70ec0, 0x70ec4}, - {0x70ec8, 0x70ecd}, {0x70ed0, 0x70ed9}, {0x70edc, 0x70edf}, {0x70f00, 0x70f47}, - {0x70f49, 0x70f6c}, {0x70f71, 0x70f97}, {0x70f99, 0x70fbc}, {0x70fbe, 0x70fcc}, - {0x70fce, 0x70fda}, {0x71000, 0x710c5}, {0x710d0, 0x71248}, {0x7124a, 0x7124d}, - {0x71250, 0x71256}, {0x7125a, 0x7125d}, {0x71260, 0x71288}, {0x7128a, 0x7128d}, - {0x71290, 0x712b0}, {0x712b2, 0x712b5}, {0x712b8, 0x712be}, {0x712c2, 0x712c5}, - {0x712c8, 0x712d6}, {0x712d8, 0x71310}, {0x71312, 0x71315}, {0x71318, 0x7135a}, - {0x7135d, 0x7137c}, {0x71380, 0x71399}, {0x713a0, 0x713f5}, {0x713f8, 0x713fd}, - {0x71400, 0x7167f}, {0x71681, 0x7169c}, {0x716a0, 0x716f8}, {0x71700, 0x7170c}, - {0x7170e, 0x71714}, {0x71720, 0x71736}, {0x71740, 0x71753}, {0x71760, 0x7176c}, - {0x7176e, 0x71770}, {0x71780, 0x717dd}, {0x717e0, 0x717e9}, {0x717f0, 0x717f9}, - {0x71800, 0x7180d}, {0x71810, 0x71819}, {0x71820, 0x71877}, {0x71880, 0x718aa}, - {0x718b0, 0x718f5}, {0x71900, 0x7191e}, {0x71920, 0x7192b}, {0x71930, 0x7193b}, - {0x71944, 0x7196d}, {0x71970, 0x71974}, {0x71980, 0x719ab}, {0x719b0, 0x719c9}, - {0x719d0, 0x719da}, {0x719de, 0x71a1b}, {0x71a1e, 0x71a5e}, {0x71a60, 0x71a7c}, - {0x71a7f, 0x71a89}, {0x71a90, 0x71a99}, {0x71aa0, 0x71aad}, {0x71ab0, 0x71abe}, - {0x71b00, 0x71b4b}, {0x71b50, 0x71b7c}, {0x71b80, 0x71bf3}, {0x71bfc, 0x71c37}, - {0x71c3b, 0x71c49}, {0x71c4d, 0x71c88}, {0x71cc0, 0x71cc7}, {0x71cd0, 0x71cf9}, - {0x71d00, 0x71df9}, {0x71dfb, 0x71f15}, {0x71f18, 0x71f1d}, {0x71f20, 0x71f45}, - {0x71f48, 0x71f4d}, {0x71f50, 0x71f57}, {0x71f5f, 0x71f7d}, {0x71f80, 0x71fb4}, - {0x71fb6, 0x71fc4}, {0x71fc6, 0x71fd3}, {0x71fd6, 0x71fdb}, {0x71fdd, 0x71fef}, - {0x71ff2, 0x71ff4}, {0x71ff6, 0x71ffe}, {0x72010, 0x72027}, {0x72030, 0x7205e}, - {0x72074, 0x7208e}, {0x72090, 0x7209c}, {0x720a0, 0x720bf}, {0x720d0, 0x720f0}, - {0x72100, 0x7218b}, {0x72190, 0x72426}, {0x72440, 0x7244a}, {0x72460, 0x72b73}, - {0x72b76, 0x72b95}, {0x72b98, 0x72bb9}, {0x72bbd, 0x72bc8}, {0x72bca, 0x72bd2}, - {0x72bec, 0x72bef}, {0x72c00, 0x72c2e}, {0x72c30, 0x72c5e}, {0x72c60, 0x72cf3}, - {0x72cf9, 0x72d25}, {0x72d30, 0x72d67}, {0x72d7f, 0x72d96}, {0x72da0, 0x72da6}, - {0x72da8, 0x72dae}, {0x72db0, 0x72db6}, {0x72db8, 0x72dbe}, {0x72dc0, 0x72dc6}, - {0x72dc8, 0x72dce}, {0x72dd0, 0x72dd6}, {0x72dd8, 0x72dde}, {0x72de0, 0x72e49}, - {0x72e80, 0x72e99}, {0x72e9b, 0x72ef3}, {0x72f00, 0x72fd5}, {0x72ff0, 0x72ffb}, - {0x73001, 0x7303f}, {0x73041, 0x73096}, {0x73099, 0x730ff}, {0x73105, 0x7312e}, - {0x73131, 0x7318e}, {0x73190, 0x731ba}, {0x731c0, 0x731e3}, {0x731f0, 0x7321e}, - {0x73220, 0x732fe}, {0x73300, 0x74db5}, {0x74dc0, 0x79fea}, {0x7a000, 0x7a48c}, - {0x7a490, 0x7a4c6}, {0x7a4d0, 0x7a62b}, {0x7a640, 0x7a6f7}, {0x7a700, 0x7a7ae}, - {0x7a7b0, 0x7a7b7}, {0x7a7f7, 0x7a82b}, {0x7a830, 0x7a839}, {0x7a840, 0x7a877}, - {0x7a880, 0x7a8c5}, {0x7a8ce, 0x7a8d9}, {0x7a8e0, 0x7a8fd}, {0x7a900, 0x7a953}, - {0x7a95f, 0x7a97c}, {0x7a980, 0x7a9cd}, {0x7a9cf, 0x7a9d9}, {0x7a9de, 0x7a9fe}, - {0x7aa00, 0x7aa36}, {0x7aa40, 0x7aa4d}, {0x7aa50, 0x7aa59}, {0x7aa5c, 0x7aac2}, - {0x7aadb, 0x7aaf6}, {0x7ab01, 0x7ab06}, {0x7ab09, 0x7ab0e}, {0x7ab11, 0x7ab16}, - {0x7ab20, 0x7ab26}, {0x7ab28, 0x7ab2e}, {0x7ab30, 0x7ab65}, {0x7ab70, 0x7abed}, - {0x7abf0, 0x7abf9}, {0x7ac00, 0x7d7a3}, {0x7d7b0, 0x7d7c6}, {0x7d7cb, 0x7d7fb}, - {0x7f900, 0x7fa6d}, {0x7fa70, 0x7fad9}, {0x7fb00, 0x7fb06}, {0x7fb13, 0x7fb17}, - {0x7fb1d, 0x7fb36}, {0x7fb38, 0x7fb3c}, {0x7fb46, 0x7fbc1}, {0x7fbd3, 0x7fd3f}, - {0x7fd50, 0x7fd8f}, {0x7fd92, 0x7fdc7}, {0x7fdf0, 0x7fdfd}, {0x7fe00, 0x7fe19}, - {0x7fe20, 0x7fe52}, {0x7fe54, 0x7fe66}, {0x7fe68, 0x7fe6b}, {0x7fe70, 0x7fe74}, - {0x7fe76, 0x7fefc}, {0x7ff01, 0x7ffbe}, {0x7ffc2, 0x7ffc7}, {0x7ffca, 0x7ffcf}, - {0x7ffd2, 0x7ffd7}, {0x7ffda, 0x7ffdc}, {0x7ffe0, 0x7ffe6}, {0x7ffe8, 0x7ffee}, - {0x80021, 0x8007e}, {0x800a1, 0x800ac}, {0x800ae, 0x80377}, {0x8037a, 0x8037f}, - {0x80384, 0x8038a}, {0x8038e, 0x803a1}, {0x803a3, 0x8052f}, {0x80531, 0x80556}, - {0x80559, 0x8055f}, {0x80561, 0x80587}, {0x8058d, 0x8058f}, {0x80591, 0x805c7}, - {0x805d0, 0x805ea}, {0x805f0, 0x805f4}, {0x80606, 0x8061b}, {0x8061e, 0x806dc}, - {0x806de, 0x8070d}, {0x80710, 0x8074a}, {0x8074d, 0x807b1}, {0x807c0, 0x807fa}, - {0x80800, 0x8082d}, {0x80830, 0x8083e}, {0x80840, 0x8085b}, {0x80860, 0x8086a}, - {0x808a0, 0x808b4}, {0x808b6, 0x808bd}, {0x808d4, 0x808e1}, {0x808e3, 0x80983}, - {0x80985, 0x8098c}, {0x80993, 0x809a8}, {0x809aa, 0x809b0}, {0x809b6, 0x809b9}, - {0x809bc, 0x809c4}, {0x809cb, 0x809ce}, {0x809df, 0x809e3}, {0x809e6, 0x809fd}, - {0x80a01, 0x80a03}, {0x80a05, 0x80a0a}, {0x80a13, 0x80a28}, {0x80a2a, 0x80a30}, - {0x80a3e, 0x80a42}, {0x80a4b, 0x80a4d}, {0x80a59, 0x80a5c}, {0x80a66, 0x80a75}, - {0x80a81, 0x80a83}, {0x80a85, 0x80a8d}, {0x80a8f, 0x80a91}, {0x80a93, 0x80aa8}, - {0x80aaa, 0x80ab0}, {0x80ab5, 0x80ab9}, {0x80abc, 0x80ac5}, {0x80ac7, 0x80ac9}, - {0x80acb, 0x80acd}, {0x80ae0, 0x80ae3}, {0x80ae6, 0x80af1}, {0x80af9, 0x80aff}, - {0x80b01, 0x80b03}, {0x80b05, 0x80b0c}, {0x80b13, 0x80b28}, {0x80b2a, 0x80b30}, - {0x80b35, 0x80b39}, {0x80b3c, 0x80b44}, {0x80b4b, 0x80b4d}, {0x80b5f, 0x80b63}, - {0x80b66, 0x80b77}, {0x80b85, 0x80b8a}, {0x80b8e, 0x80b90}, {0x80b92, 0x80b95}, - {0x80ba8, 0x80baa}, {0x80bae, 0x80bb9}, {0x80bbe, 0x80bc2}, {0x80bc6, 0x80bc8}, - {0x80bca, 0x80bcd}, {0x80be6, 0x80bfa}, {0x80c00, 0x80c03}, {0x80c05, 0x80c0c}, - {0x80c0e, 0x80c10}, {0x80c12, 0x80c28}, {0x80c2a, 0x80c39}, {0x80c3d, 0x80c44}, - {0x80c46, 0x80c48}, {0x80c4a, 0x80c4d}, {0x80c58, 0x80c5a}, {0x80c60, 0x80c63}, - {0x80c66, 0x80c6f}, {0x80c78, 0x80c83}, {0x80c85, 0x80c8c}, {0x80c8e, 0x80c90}, - {0x80c92, 0x80ca8}, {0x80caa, 0x80cb3}, {0x80cb5, 0x80cb9}, {0x80cbc, 0x80cc4}, - {0x80cc6, 0x80cc8}, {0x80cca, 0x80ccd}, {0x80ce0, 0x80ce3}, {0x80ce6, 0x80cef}, - {0x80d00, 0x80d03}, {0x80d05, 0x80d0c}, {0x80d0e, 0x80d10}, {0x80d12, 0x80d44}, - {0x80d46, 0x80d48}, {0x80d4a, 0x80d4f}, {0x80d54, 0x80d63}, {0x80d66, 0x80d7f}, - {0x80d85, 0x80d96}, {0x80d9a, 0x80db1}, {0x80db3, 0x80dbb}, {0x80dc0, 0x80dc6}, - {0x80dcf, 0x80dd4}, {0x80dd8, 0x80ddf}, {0x80de6, 0x80def}, {0x80df2, 0x80df4}, - {0x80e01, 0x80e3a}, {0x80e3f, 0x80e5b}, {0x80e94, 0x80e97}, {0x80e99, 0x80e9f}, - {0x80ea1, 0x80ea3}, {0x80ead, 0x80eb9}, {0x80ebb, 0x80ebd}, {0x80ec0, 0x80ec4}, - {0x80ec8, 0x80ecd}, {0x80ed0, 0x80ed9}, {0x80edc, 0x80edf}, {0x80f00, 0x80f47}, - {0x80f49, 0x80f6c}, {0x80f71, 0x80f97}, {0x80f99, 0x80fbc}, {0x80fbe, 0x80fcc}, - {0x80fce, 0x80fda}, {0x81000, 0x810c5}, {0x810d0, 0x81248}, {0x8124a, 0x8124d}, - {0x81250, 0x81256}, {0x8125a, 0x8125d}, {0x81260, 0x81288}, {0x8128a, 0x8128d}, - {0x81290, 0x812b0}, {0x812b2, 0x812b5}, {0x812b8, 0x812be}, {0x812c2, 0x812c5}, - {0x812c8, 0x812d6}, {0x812d8, 0x81310}, {0x81312, 0x81315}, {0x81318, 0x8135a}, - {0x8135d, 0x8137c}, {0x81380, 0x81399}, {0x813a0, 0x813f5}, {0x813f8, 0x813fd}, - {0x81400, 0x8167f}, {0x81681, 0x8169c}, {0x816a0, 0x816f8}, {0x81700, 0x8170c}, - {0x8170e, 0x81714}, {0x81720, 0x81736}, {0x81740, 0x81753}, {0x81760, 0x8176c}, - {0x8176e, 0x81770}, {0x81780, 0x817dd}, {0x817e0, 0x817e9}, {0x817f0, 0x817f9}, - {0x81800, 0x8180d}, {0x81810, 0x81819}, {0x81820, 0x81877}, {0x81880, 0x818aa}, - {0x818b0, 0x818f5}, {0x81900, 0x8191e}, {0x81920, 0x8192b}, {0x81930, 0x8193b}, - {0x81944, 0x8196d}, {0x81970, 0x81974}, {0x81980, 0x819ab}, {0x819b0, 0x819c9}, - {0x819d0, 0x819da}, {0x819de, 0x81a1b}, {0x81a1e, 0x81a5e}, {0x81a60, 0x81a7c}, - {0x81a7f, 0x81a89}, {0x81a90, 0x81a99}, {0x81aa0, 0x81aad}, {0x81ab0, 0x81abe}, - {0x81b00, 0x81b4b}, {0x81b50, 0x81b7c}, {0x81b80, 0x81bf3}, {0x81bfc, 0x81c37}, - {0x81c3b, 0x81c49}, {0x81c4d, 0x81c88}, {0x81cc0, 0x81cc7}, {0x81cd0, 0x81cf9}, - {0x81d00, 0x81df9}, {0x81dfb, 0x81f15}, {0x81f18, 0x81f1d}, {0x81f20, 0x81f45}, - {0x81f48, 0x81f4d}, {0x81f50, 0x81f57}, {0x81f5f, 0x81f7d}, {0x81f80, 0x81fb4}, - {0x81fb6, 0x81fc4}, {0x81fc6, 0x81fd3}, {0x81fd6, 0x81fdb}, {0x81fdd, 0x81fef}, - {0x81ff2, 0x81ff4}, {0x81ff6, 0x81ffe}, {0x82010, 0x82027}, {0x82030, 0x8205e}, - {0x82074, 0x8208e}, {0x82090, 0x8209c}, {0x820a0, 0x820bf}, {0x820d0, 0x820f0}, - {0x82100, 0x8218b}, {0x82190, 0x82426}, {0x82440, 0x8244a}, {0x82460, 0x82b73}, - {0x82b76, 0x82b95}, {0x82b98, 0x82bb9}, {0x82bbd, 0x82bc8}, {0x82bca, 0x82bd2}, - {0x82bec, 0x82bef}, {0x82c00, 0x82c2e}, {0x82c30, 0x82c5e}, {0x82c60, 0x82cf3}, - {0x82cf9, 0x82d25}, {0x82d30, 0x82d67}, {0x82d7f, 0x82d96}, {0x82da0, 0x82da6}, - {0x82da8, 0x82dae}, {0x82db0, 0x82db6}, {0x82db8, 0x82dbe}, {0x82dc0, 0x82dc6}, - {0x82dc8, 0x82dce}, {0x82dd0, 0x82dd6}, {0x82dd8, 0x82dde}, {0x82de0, 0x82e49}, - {0x82e80, 0x82e99}, {0x82e9b, 0x82ef3}, {0x82f00, 0x82fd5}, {0x82ff0, 0x82ffb}, - {0x83001, 0x8303f}, {0x83041, 0x83096}, {0x83099, 0x830ff}, {0x83105, 0x8312e}, - {0x83131, 0x8318e}, {0x83190, 0x831ba}, {0x831c0, 0x831e3}, {0x831f0, 0x8321e}, - {0x83220, 0x832fe}, {0x83300, 0x84db5}, {0x84dc0, 0x89fea}, {0x8a000, 0x8a48c}, - {0x8a490, 0x8a4c6}, {0x8a4d0, 0x8a62b}, {0x8a640, 0x8a6f7}, {0x8a700, 0x8a7ae}, - {0x8a7b0, 0x8a7b7}, {0x8a7f7, 0x8a82b}, {0x8a830, 0x8a839}, {0x8a840, 0x8a877}, - {0x8a880, 0x8a8c5}, {0x8a8ce, 0x8a8d9}, {0x8a8e0, 0x8a8fd}, {0x8a900, 0x8a953}, - {0x8a95f, 0x8a97c}, {0x8a980, 0x8a9cd}, {0x8a9cf, 0x8a9d9}, {0x8a9de, 0x8a9fe}, - {0x8aa00, 0x8aa36}, {0x8aa40, 0x8aa4d}, {0x8aa50, 0x8aa59}, {0x8aa5c, 0x8aac2}, - {0x8aadb, 0x8aaf6}, {0x8ab01, 0x8ab06}, {0x8ab09, 0x8ab0e}, {0x8ab11, 0x8ab16}, - {0x8ab20, 0x8ab26}, {0x8ab28, 0x8ab2e}, {0x8ab30, 0x8ab65}, {0x8ab70, 0x8abed}, - {0x8abf0, 0x8abf9}, {0x8ac00, 0x8d7a3}, {0x8d7b0, 0x8d7c6}, {0x8d7cb, 0x8d7fb}, - {0x8f900, 0x8fa6d}, {0x8fa70, 0x8fad9}, {0x8fb00, 0x8fb06}, {0x8fb13, 0x8fb17}, - {0x8fb1d, 0x8fb36}, {0x8fb38, 0x8fb3c}, {0x8fb46, 0x8fbc1}, {0x8fbd3, 0x8fd3f}, - {0x8fd50, 0x8fd8f}, {0x8fd92, 0x8fdc7}, {0x8fdf0, 0x8fdfd}, {0x8fe00, 0x8fe19}, - {0x8fe20, 0x8fe52}, {0x8fe54, 0x8fe66}, {0x8fe68, 0x8fe6b}, {0x8fe70, 0x8fe74}, - {0x8fe76, 0x8fefc}, {0x8ff01, 0x8ffbe}, {0x8ffc2, 0x8ffc7}, {0x8ffca, 0x8ffcf}, - {0x8ffd2, 0x8ffd7}, {0x8ffda, 0x8ffdc}, {0x8ffe0, 0x8ffe6}, {0x8ffe8, 0x8ffee}, - {0x90021, 0x9007e}, {0x900a1, 0x900ac}, {0x900ae, 0x90377}, {0x9037a, 0x9037f}, - {0x90384, 0x9038a}, {0x9038e, 0x903a1}, {0x903a3, 0x9052f}, {0x90531, 0x90556}, - {0x90559, 0x9055f}, {0x90561, 0x90587}, {0x9058d, 0x9058f}, {0x90591, 0x905c7}, - {0x905d0, 0x905ea}, {0x905f0, 0x905f4}, {0x90606, 0x9061b}, {0x9061e, 0x906dc}, - {0x906de, 0x9070d}, {0x90710, 0x9074a}, {0x9074d, 0x907b1}, {0x907c0, 0x907fa}, - {0x90800, 0x9082d}, {0x90830, 0x9083e}, {0x90840, 0x9085b}, {0x90860, 0x9086a}, - {0x908a0, 0x908b4}, {0x908b6, 0x908bd}, {0x908d4, 0x908e1}, {0x908e3, 0x90983}, - {0x90985, 0x9098c}, {0x90993, 0x909a8}, {0x909aa, 0x909b0}, {0x909b6, 0x909b9}, - {0x909bc, 0x909c4}, {0x909cb, 0x909ce}, {0x909df, 0x909e3}, {0x909e6, 0x909fd}, - {0x90a01, 0x90a03}, {0x90a05, 0x90a0a}, {0x90a13, 0x90a28}, {0x90a2a, 0x90a30}, - {0x90a3e, 0x90a42}, {0x90a4b, 0x90a4d}, {0x90a59, 0x90a5c}, {0x90a66, 0x90a75}, - {0x90a81, 0x90a83}, {0x90a85, 0x90a8d}, {0x90a8f, 0x90a91}, {0x90a93, 0x90aa8}, - {0x90aaa, 0x90ab0}, {0x90ab5, 0x90ab9}, {0x90abc, 0x90ac5}, {0x90ac7, 0x90ac9}, - {0x90acb, 0x90acd}, {0x90ae0, 0x90ae3}, {0x90ae6, 0x90af1}, {0x90af9, 0x90aff}, - {0x90b01, 0x90b03}, {0x90b05, 0x90b0c}, {0x90b13, 0x90b28}, {0x90b2a, 0x90b30}, - {0x90b35, 0x90b39}, {0x90b3c, 0x90b44}, {0x90b4b, 0x90b4d}, {0x90b5f, 0x90b63}, - {0x90b66, 0x90b77}, {0x90b85, 0x90b8a}, {0x90b8e, 0x90b90}, {0x90b92, 0x90b95}, - {0x90ba8, 0x90baa}, {0x90bae, 0x90bb9}, {0x90bbe, 0x90bc2}, {0x90bc6, 0x90bc8}, - {0x90bca, 0x90bcd}, {0x90be6, 0x90bfa}, {0x90c00, 0x90c03}, {0x90c05, 0x90c0c}, - {0x90c0e, 0x90c10}, {0x90c12, 0x90c28}, {0x90c2a, 0x90c39}, {0x90c3d, 0x90c44}, - {0x90c46, 0x90c48}, {0x90c4a, 0x90c4d}, {0x90c58, 0x90c5a}, {0x90c60, 0x90c63}, - {0x90c66, 0x90c6f}, {0x90c78, 0x90c83}, {0x90c85, 0x90c8c}, {0x90c8e, 0x90c90}, - {0x90c92, 0x90ca8}, {0x90caa, 0x90cb3}, {0x90cb5, 0x90cb9}, {0x90cbc, 0x90cc4}, - {0x90cc6, 0x90cc8}, {0x90cca, 0x90ccd}, {0x90ce0, 0x90ce3}, {0x90ce6, 0x90cef}, - {0x90d00, 0x90d03}, {0x90d05, 0x90d0c}, {0x90d0e, 0x90d10}, {0x90d12, 0x90d44}, - {0x90d46, 0x90d48}, {0x90d4a, 0x90d4f}, {0x90d54, 0x90d63}, {0x90d66, 0x90d7f}, - {0x90d85, 0x90d96}, {0x90d9a, 0x90db1}, {0x90db3, 0x90dbb}, {0x90dc0, 0x90dc6}, - {0x90dcf, 0x90dd4}, {0x90dd8, 0x90ddf}, {0x90de6, 0x90def}, {0x90df2, 0x90df4}, - {0x90e01, 0x90e3a}, {0x90e3f, 0x90e5b}, {0x90e94, 0x90e97}, {0x90e99, 0x90e9f}, - {0x90ea1, 0x90ea3}, {0x90ead, 0x90eb9}, {0x90ebb, 0x90ebd}, {0x90ec0, 0x90ec4}, - {0x90ec8, 0x90ecd}, {0x90ed0, 0x90ed9}, {0x90edc, 0x90edf}, {0x90f00, 0x90f47}, - {0x90f49, 0x90f6c}, {0x90f71, 0x90f97}, {0x90f99, 0x90fbc}, {0x90fbe, 0x90fcc}, - {0x90fce, 0x90fda}, {0x91000, 0x910c5}, {0x910d0, 0x91248}, {0x9124a, 0x9124d}, - {0x91250, 0x91256}, {0x9125a, 0x9125d}, {0x91260, 0x91288}, {0x9128a, 0x9128d}, - {0x91290, 0x912b0}, {0x912b2, 0x912b5}, {0x912b8, 0x912be}, {0x912c2, 0x912c5}, - {0x912c8, 0x912d6}, {0x912d8, 0x91310}, {0x91312, 0x91315}, {0x91318, 0x9135a}, - {0x9135d, 0x9137c}, {0x91380, 0x91399}, {0x913a0, 0x913f5}, {0x913f8, 0x913fd}, - {0x91400, 0x9167f}, {0x91681, 0x9169c}, {0x916a0, 0x916f8}, {0x91700, 0x9170c}, - {0x9170e, 0x91714}, {0x91720, 0x91736}, {0x91740, 0x91753}, {0x91760, 0x9176c}, - {0x9176e, 0x91770}, {0x91780, 0x917dd}, {0x917e0, 0x917e9}, {0x917f0, 0x917f9}, - {0x91800, 0x9180d}, {0x91810, 0x91819}, {0x91820, 0x91877}, {0x91880, 0x918aa}, - {0x918b0, 0x918f5}, {0x91900, 0x9191e}, {0x91920, 0x9192b}, {0x91930, 0x9193b}, - {0x91944, 0x9196d}, {0x91970, 0x91974}, {0x91980, 0x919ab}, {0x919b0, 0x919c9}, - {0x919d0, 0x919da}, {0x919de, 0x91a1b}, {0x91a1e, 0x91a5e}, {0x91a60, 0x91a7c}, - {0x91a7f, 0x91a89}, {0x91a90, 0x91a99}, {0x91aa0, 0x91aad}, {0x91ab0, 0x91abe}, - {0x91b00, 0x91b4b}, {0x91b50, 0x91b7c}, {0x91b80, 0x91bf3}, {0x91bfc, 0x91c37}, - {0x91c3b, 0x91c49}, {0x91c4d, 0x91c88}, {0x91cc0, 0x91cc7}, {0x91cd0, 0x91cf9}, - {0x91d00, 0x91df9}, {0x91dfb, 0x91f15}, {0x91f18, 0x91f1d}, {0x91f20, 0x91f45}, - {0x91f48, 0x91f4d}, {0x91f50, 0x91f57}, {0x91f5f, 0x91f7d}, {0x91f80, 0x91fb4}, - {0x91fb6, 0x91fc4}, {0x91fc6, 0x91fd3}, {0x91fd6, 0x91fdb}, {0x91fdd, 0x91fef}, - {0x91ff2, 0x91ff4}, {0x91ff6, 0x91ffe}, {0x92010, 0x92027}, {0x92030, 0x9205e}, - {0x92074, 0x9208e}, {0x92090, 0x9209c}, {0x920a0, 0x920bf}, {0x920d0, 0x920f0}, - {0x92100, 0x9218b}, {0x92190, 0x92426}, {0x92440, 0x9244a}, {0x92460, 0x92b73}, - {0x92b76, 0x92b95}, {0x92b98, 0x92bb9}, {0x92bbd, 0x92bc8}, {0x92bca, 0x92bd2}, - {0x92bec, 0x92bef}, {0x92c00, 0x92c2e}, {0x92c30, 0x92c5e}, {0x92c60, 0x92cf3}, - {0x92cf9, 0x92d25}, {0x92d30, 0x92d67}, {0x92d7f, 0x92d96}, {0x92da0, 0x92da6}, - {0x92da8, 0x92dae}, {0x92db0, 0x92db6}, {0x92db8, 0x92dbe}, {0x92dc0, 0x92dc6}, - {0x92dc8, 0x92dce}, {0x92dd0, 0x92dd6}, {0x92dd8, 0x92dde}, {0x92de0, 0x92e49}, - {0x92e80, 0x92e99}, {0x92e9b, 0x92ef3}, {0x92f00, 0x92fd5}, {0x92ff0, 0x92ffb}, - {0x93001, 0x9303f}, {0x93041, 0x93096}, {0x93099, 0x930ff}, {0x93105, 0x9312e}, - {0x93131, 0x9318e}, {0x93190, 0x931ba}, {0x931c0, 0x931e3}, {0x931f0, 0x9321e}, - {0x93220, 0x932fe}, {0x93300, 0x94db5}, {0x94dc0, 0x99fea}, {0x9a000, 0x9a48c}, - {0x9a490, 0x9a4c6}, {0x9a4d0, 0x9a62b}, {0x9a640, 0x9a6f7}, {0x9a700, 0x9a7ae}, - {0x9a7b0, 0x9a7b7}, {0x9a7f7, 0x9a82b}, {0x9a830, 0x9a839}, {0x9a840, 0x9a877}, - {0x9a880, 0x9a8c5}, {0x9a8ce, 0x9a8d9}, {0x9a8e0, 0x9a8fd}, {0x9a900, 0x9a953}, - {0x9a95f, 0x9a97c}, {0x9a980, 0x9a9cd}, {0x9a9cf, 0x9a9d9}, {0x9a9de, 0x9a9fe}, - {0x9aa00, 0x9aa36}, {0x9aa40, 0x9aa4d}, {0x9aa50, 0x9aa59}, {0x9aa5c, 0x9aac2}, - {0x9aadb, 0x9aaf6}, {0x9ab01, 0x9ab06}, {0x9ab09, 0x9ab0e}, {0x9ab11, 0x9ab16}, - {0x9ab20, 0x9ab26}, {0x9ab28, 0x9ab2e}, {0x9ab30, 0x9ab65}, {0x9ab70, 0x9abed}, - {0x9abf0, 0x9abf9}, {0x9ac00, 0x9d7a3}, {0x9d7b0, 0x9d7c6}, {0x9d7cb, 0x9d7fb}, - {0x9f900, 0x9fa6d}, {0x9fa70, 0x9fad9}, {0x9fb00, 0x9fb06}, {0x9fb13, 0x9fb17}, - {0x9fb1d, 0x9fb36}, {0x9fb38, 0x9fb3c}, {0x9fb46, 0x9fbc1}, {0x9fbd3, 0x9fd3f}, - {0x9fd50, 0x9fd8f}, {0x9fd92, 0x9fdc7}, {0x9fdf0, 0x9fdfd}, {0x9fe00, 0x9fe19}, - {0x9fe20, 0x9fe52}, {0x9fe54, 0x9fe66}, {0x9fe68, 0x9fe6b}, {0x9fe70, 0x9fe74}, - {0x9fe76, 0x9fefc}, {0x9ff01, 0x9ffbe}, {0x9ffc2, 0x9ffc7}, {0x9ffca, 0x9ffcf}, - {0x9ffd2, 0x9ffd7}, {0x9ffda, 0x9ffdc}, {0x9ffe0, 0x9ffe6}, {0x9ffe8, 0x9ffee}, - {0xa0021, 0xa007e}, {0xa00a1, 0xa00ac}, {0xa00ae, 0xa0377}, {0xa037a, 0xa037f}, - {0xa0384, 0xa038a}, {0xa038e, 0xa03a1}, {0xa03a3, 0xa052f}, {0xa0531, 0xa0556}, - {0xa0559, 0xa055f}, {0xa0561, 0xa0587}, {0xa058d, 0xa058f}, {0xa0591, 0xa05c7}, - {0xa05d0, 0xa05ea}, {0xa05f0, 0xa05f4}, {0xa0606, 0xa061b}, {0xa061e, 0xa06dc}, - {0xa06de, 0xa070d}, {0xa0710, 0xa074a}, {0xa074d, 0xa07b1}, {0xa07c0, 0xa07fa}, - {0xa0800, 0xa082d}, {0xa0830, 0xa083e}, {0xa0840, 0xa085b}, {0xa0860, 0xa086a}, - {0xa08a0, 0xa08b4}, {0xa08b6, 0xa08bd}, {0xa08d4, 0xa08e1}, {0xa08e3, 0xa0983}, - {0xa0985, 0xa098c}, {0xa0993, 0xa09a8}, {0xa09aa, 0xa09b0}, {0xa09b6, 0xa09b9}, - {0xa09bc, 0xa09c4}, {0xa09cb, 0xa09ce}, {0xa09df, 0xa09e3}, {0xa09e6, 0xa09fd}, - {0xa0a01, 0xa0a03}, {0xa0a05, 0xa0a0a}, {0xa0a13, 0xa0a28}, {0xa0a2a, 0xa0a30}, - {0xa0a3e, 0xa0a42}, {0xa0a4b, 0xa0a4d}, {0xa0a59, 0xa0a5c}, {0xa0a66, 0xa0a75}, - {0xa0a81, 0xa0a83}, {0xa0a85, 0xa0a8d}, {0xa0a8f, 0xa0a91}, {0xa0a93, 0xa0aa8}, - {0xa0aaa, 0xa0ab0}, {0xa0ab5, 0xa0ab9}, {0xa0abc, 0xa0ac5}, {0xa0ac7, 0xa0ac9}, - {0xa0acb, 0xa0acd}, {0xa0ae0, 0xa0ae3}, {0xa0ae6, 0xa0af1}, {0xa0af9, 0xa0aff}, - {0xa0b01, 0xa0b03}, {0xa0b05, 0xa0b0c}, {0xa0b13, 0xa0b28}, {0xa0b2a, 0xa0b30}, - {0xa0b35, 0xa0b39}, {0xa0b3c, 0xa0b44}, {0xa0b4b, 0xa0b4d}, {0xa0b5f, 0xa0b63}, - {0xa0b66, 0xa0b77}, {0xa0b85, 0xa0b8a}, {0xa0b8e, 0xa0b90}, {0xa0b92, 0xa0b95}, - {0xa0ba8, 0xa0baa}, {0xa0bae, 0xa0bb9}, {0xa0bbe, 0xa0bc2}, {0xa0bc6, 0xa0bc8}, - {0xa0bca, 0xa0bcd}, {0xa0be6, 0xa0bfa}, {0xa0c00, 0xa0c03}, {0xa0c05, 0xa0c0c}, - {0xa0c0e, 0xa0c10}, {0xa0c12, 0xa0c28}, {0xa0c2a, 0xa0c39}, {0xa0c3d, 0xa0c44}, - {0xa0c46, 0xa0c48}, {0xa0c4a, 0xa0c4d}, {0xa0c58, 0xa0c5a}, {0xa0c60, 0xa0c63}, - {0xa0c66, 0xa0c6f}, {0xa0c78, 0xa0c83}, {0xa0c85, 0xa0c8c}, {0xa0c8e, 0xa0c90}, - {0xa0c92, 0xa0ca8}, {0xa0caa, 0xa0cb3}, {0xa0cb5, 0xa0cb9}, {0xa0cbc, 0xa0cc4}, - {0xa0cc6, 0xa0cc8}, {0xa0cca, 0xa0ccd}, {0xa0ce0, 0xa0ce3}, {0xa0ce6, 0xa0cef}, - {0xa0d00, 0xa0d03}, {0xa0d05, 0xa0d0c}, {0xa0d0e, 0xa0d10}, {0xa0d12, 0xa0d44}, - {0xa0d46, 0xa0d48}, {0xa0d4a, 0xa0d4f}, {0xa0d54, 0xa0d63}, {0xa0d66, 0xa0d7f}, - {0xa0d85, 0xa0d96}, {0xa0d9a, 0xa0db1}, {0xa0db3, 0xa0dbb}, {0xa0dc0, 0xa0dc6}, - {0xa0dcf, 0xa0dd4}, {0xa0dd8, 0xa0ddf}, {0xa0de6, 0xa0def}, {0xa0df2, 0xa0df4}, - {0xa0e01, 0xa0e3a}, {0xa0e3f, 0xa0e5b}, {0xa0e94, 0xa0e97}, {0xa0e99, 0xa0e9f}, - {0xa0ea1, 0xa0ea3}, {0xa0ead, 0xa0eb9}, {0xa0ebb, 0xa0ebd}, {0xa0ec0, 0xa0ec4}, - {0xa0ec8, 0xa0ecd}, {0xa0ed0, 0xa0ed9}, {0xa0edc, 0xa0edf}, {0xa0f00, 0xa0f47}, - {0xa0f49, 0xa0f6c}, {0xa0f71, 0xa0f97}, {0xa0f99, 0xa0fbc}, {0xa0fbe, 0xa0fcc}, - {0xa0fce, 0xa0fda}, {0xa1000, 0xa10c5}, {0xa10d0, 0xa1248}, {0xa124a, 0xa124d}, - {0xa1250, 0xa1256}, {0xa125a, 0xa125d}, {0xa1260, 0xa1288}, {0xa128a, 0xa128d}, - {0xa1290, 0xa12b0}, {0xa12b2, 0xa12b5}, {0xa12b8, 0xa12be}, {0xa12c2, 0xa12c5}, - {0xa12c8, 0xa12d6}, {0xa12d8, 0xa1310}, {0xa1312, 0xa1315}, {0xa1318, 0xa135a}, - {0xa135d, 0xa137c}, {0xa1380, 0xa1399}, {0xa13a0, 0xa13f5}, {0xa13f8, 0xa13fd}, - {0xa1400, 0xa167f}, {0xa1681, 0xa169c}, {0xa16a0, 0xa16f8}, {0xa1700, 0xa170c}, - {0xa170e, 0xa1714}, {0xa1720, 0xa1736}, {0xa1740, 0xa1753}, {0xa1760, 0xa176c}, - {0xa176e, 0xa1770}, {0xa1780, 0xa17dd}, {0xa17e0, 0xa17e9}, {0xa17f0, 0xa17f9}, - {0xa1800, 0xa180d}, {0xa1810, 0xa1819}, {0xa1820, 0xa1877}, {0xa1880, 0xa18aa}, - {0xa18b0, 0xa18f5}, {0xa1900, 0xa191e}, {0xa1920, 0xa192b}, {0xa1930, 0xa193b}, - {0xa1944, 0xa196d}, {0xa1970, 0xa1974}, {0xa1980, 0xa19ab}, {0xa19b0, 0xa19c9}, - {0xa19d0, 0xa19da}, {0xa19de, 0xa1a1b}, {0xa1a1e, 0xa1a5e}, {0xa1a60, 0xa1a7c}, - {0xa1a7f, 0xa1a89}, {0xa1a90, 0xa1a99}, {0xa1aa0, 0xa1aad}, {0xa1ab0, 0xa1abe}, - {0xa1b00, 0xa1b4b}, {0xa1b50, 0xa1b7c}, {0xa1b80, 0xa1bf3}, {0xa1bfc, 0xa1c37}, - {0xa1c3b, 0xa1c49}, {0xa1c4d, 0xa1c88}, {0xa1cc0, 0xa1cc7}, {0xa1cd0, 0xa1cf9}, - {0xa1d00, 0xa1df9}, {0xa1dfb, 0xa1f15}, {0xa1f18, 0xa1f1d}, {0xa1f20, 0xa1f45}, - {0xa1f48, 0xa1f4d}, {0xa1f50, 0xa1f57}, {0xa1f5f, 0xa1f7d}, {0xa1f80, 0xa1fb4}, - {0xa1fb6, 0xa1fc4}, {0xa1fc6, 0xa1fd3}, {0xa1fd6, 0xa1fdb}, {0xa1fdd, 0xa1fef}, - {0xa1ff2, 0xa1ff4}, {0xa1ff6, 0xa1ffe}, {0xa2010, 0xa2027}, {0xa2030, 0xa205e}, - {0xa2074, 0xa208e}, {0xa2090, 0xa209c}, {0xa20a0, 0xa20bf}, {0xa20d0, 0xa20f0}, - {0xa2100, 0xa218b}, {0xa2190, 0xa2426}, {0xa2440, 0xa244a}, {0xa2460, 0xa2b73}, - {0xa2b76, 0xa2b95}, {0xa2b98, 0xa2bb9}, {0xa2bbd, 0xa2bc8}, {0xa2bca, 0xa2bd2}, - {0xa2bec, 0xa2bef}, {0xa2c00, 0xa2c2e}, {0xa2c30, 0xa2c5e}, {0xa2c60, 0xa2cf3}, - {0xa2cf9, 0xa2d25}, {0xa2d30, 0xa2d67}, {0xa2d7f, 0xa2d96}, {0xa2da0, 0xa2da6}, - {0xa2da8, 0xa2dae}, {0xa2db0, 0xa2db6}, {0xa2db8, 0xa2dbe}, {0xa2dc0, 0xa2dc6}, - {0xa2dc8, 0xa2dce}, {0xa2dd0, 0xa2dd6}, {0xa2dd8, 0xa2dde}, {0xa2de0, 0xa2e49}, - {0xa2e80, 0xa2e99}, {0xa2e9b, 0xa2ef3}, {0xa2f00, 0xa2fd5}, {0xa2ff0, 0xa2ffb}, - {0xa3001, 0xa303f}, {0xa3041, 0xa3096}, {0xa3099, 0xa30ff}, {0xa3105, 0xa312e}, - {0xa3131, 0xa318e}, {0xa3190, 0xa31ba}, {0xa31c0, 0xa31e3}, {0xa31f0, 0xa321e}, - {0xa3220, 0xa32fe}, {0xa3300, 0xa4db5}, {0xa4dc0, 0xa9fea}, {0xaa000, 0xaa48c}, - {0xaa490, 0xaa4c6}, {0xaa4d0, 0xaa62b}, {0xaa640, 0xaa6f7}, {0xaa700, 0xaa7ae}, - {0xaa7b0, 0xaa7b7}, {0xaa7f7, 0xaa82b}, {0xaa830, 0xaa839}, {0xaa840, 0xaa877}, - {0xaa880, 0xaa8c5}, {0xaa8ce, 0xaa8d9}, {0xaa8e0, 0xaa8fd}, {0xaa900, 0xaa953}, - {0xaa95f, 0xaa97c}, {0xaa980, 0xaa9cd}, {0xaa9cf, 0xaa9d9}, {0xaa9de, 0xaa9fe}, - {0xaaa00, 0xaaa36}, {0xaaa40, 0xaaa4d}, {0xaaa50, 0xaaa59}, {0xaaa5c, 0xaaac2}, - {0xaaadb, 0xaaaf6}, {0xaab01, 0xaab06}, {0xaab09, 0xaab0e}, {0xaab11, 0xaab16}, - {0xaab20, 0xaab26}, {0xaab28, 0xaab2e}, {0xaab30, 0xaab65}, {0xaab70, 0xaabed}, - {0xaabf0, 0xaabf9}, {0xaac00, 0xad7a3}, {0xad7b0, 0xad7c6}, {0xad7cb, 0xad7fb}, - {0xaf900, 0xafa6d}, {0xafa70, 0xafad9}, {0xafb00, 0xafb06}, {0xafb13, 0xafb17}, - {0xafb1d, 0xafb36}, {0xafb38, 0xafb3c}, {0xafb46, 0xafbc1}, {0xafbd3, 0xafd3f}, - {0xafd50, 0xafd8f}, {0xafd92, 0xafdc7}, {0xafdf0, 0xafdfd}, {0xafe00, 0xafe19}, - {0xafe20, 0xafe52}, {0xafe54, 0xafe66}, {0xafe68, 0xafe6b}, {0xafe70, 0xafe74}, - {0xafe76, 0xafefc}, {0xaff01, 0xaffbe}, {0xaffc2, 0xaffc7}, {0xaffca, 0xaffcf}, - {0xaffd2, 0xaffd7}, {0xaffda, 0xaffdc}, {0xaffe0, 0xaffe6}, {0xaffe8, 0xaffee}, - {0xb0021, 0xb007e}, {0xb00a1, 0xb00ac}, {0xb00ae, 0xb0377}, {0xb037a, 0xb037f}, - {0xb0384, 0xb038a}, {0xb038e, 0xb03a1}, {0xb03a3, 0xb052f}, {0xb0531, 0xb0556}, - {0xb0559, 0xb055f}, {0xb0561, 0xb0587}, {0xb058d, 0xb058f}, {0xb0591, 0xb05c7}, - {0xb05d0, 0xb05ea}, {0xb05f0, 0xb05f4}, {0xb0606, 0xb061b}, {0xb061e, 0xb06dc}, - {0xb06de, 0xb070d}, {0xb0710, 0xb074a}, {0xb074d, 0xb07b1}, {0xb07c0, 0xb07fa}, - {0xb0800, 0xb082d}, {0xb0830, 0xb083e}, {0xb0840, 0xb085b}, {0xb0860, 0xb086a}, - {0xb08a0, 0xb08b4}, {0xb08b6, 0xb08bd}, {0xb08d4, 0xb08e1}, {0xb08e3, 0xb0983}, - {0xb0985, 0xb098c}, {0xb0993, 0xb09a8}, {0xb09aa, 0xb09b0}, {0xb09b6, 0xb09b9}, - {0xb09bc, 0xb09c4}, {0xb09cb, 0xb09ce}, {0xb09df, 0xb09e3}, {0xb09e6, 0xb09fd}, - {0xb0a01, 0xb0a03}, {0xb0a05, 0xb0a0a}, {0xb0a13, 0xb0a28}, {0xb0a2a, 0xb0a30}, - {0xb0a3e, 0xb0a42}, {0xb0a4b, 0xb0a4d}, {0xb0a59, 0xb0a5c}, {0xb0a66, 0xb0a75}, - {0xb0a81, 0xb0a83}, {0xb0a85, 0xb0a8d}, {0xb0a8f, 0xb0a91}, {0xb0a93, 0xb0aa8}, - {0xb0aaa, 0xb0ab0}, {0xb0ab5, 0xb0ab9}, {0xb0abc, 0xb0ac5}, {0xb0ac7, 0xb0ac9}, - {0xb0acb, 0xb0acd}, {0xb0ae0, 0xb0ae3}, {0xb0ae6, 0xb0af1}, {0xb0af9, 0xb0aff}, - {0xb0b01, 0xb0b03}, {0xb0b05, 0xb0b0c}, {0xb0b13, 0xb0b28}, {0xb0b2a, 0xb0b30}, - {0xb0b35, 0xb0b39}, {0xb0b3c, 0xb0b44}, {0xb0b4b, 0xb0b4d}, {0xb0b5f, 0xb0b63}, - {0xb0b66, 0xb0b77}, {0xb0b85, 0xb0b8a}, {0xb0b8e, 0xb0b90}, {0xb0b92, 0xb0b95}, - {0xb0ba8, 0xb0baa}, {0xb0bae, 0xb0bb9}, {0xb0bbe, 0xb0bc2}, {0xb0bc6, 0xb0bc8}, - {0xb0bca, 0xb0bcd}, {0xb0be6, 0xb0bfa}, {0xb0c00, 0xb0c03}, {0xb0c05, 0xb0c0c}, - {0xb0c0e, 0xb0c10}, {0xb0c12, 0xb0c28}, {0xb0c2a, 0xb0c39}, {0xb0c3d, 0xb0c44}, - {0xb0c46, 0xb0c48}, {0xb0c4a, 0xb0c4d}, {0xb0c58, 0xb0c5a}, {0xb0c60, 0xb0c63}, - {0xb0c66, 0xb0c6f}, {0xb0c78, 0xb0c83}, {0xb0c85, 0xb0c8c}, {0xb0c8e, 0xb0c90}, - {0xb0c92, 0xb0ca8}, {0xb0caa, 0xb0cb3}, {0xb0cb5, 0xb0cb9}, {0xb0cbc, 0xb0cc4}, - {0xb0cc6, 0xb0cc8}, {0xb0cca, 0xb0ccd}, {0xb0ce0, 0xb0ce3}, {0xb0ce6, 0xb0cef}, - {0xb0d00, 0xb0d03}, {0xb0d05, 0xb0d0c}, {0xb0d0e, 0xb0d10}, {0xb0d12, 0xb0d44}, - {0xb0d46, 0xb0d48}, {0xb0d4a, 0xb0d4f}, {0xb0d54, 0xb0d63}, {0xb0d66, 0xb0d7f}, - {0xb0d85, 0xb0d96}, {0xb0d9a, 0xb0db1}, {0xb0db3, 0xb0dbb}, {0xb0dc0, 0xb0dc6}, - {0xb0dcf, 0xb0dd4}, {0xb0dd8, 0xb0ddf}, {0xb0de6, 0xb0def}, {0xb0df2, 0xb0df4}, - {0xb0e01, 0xb0e3a}, {0xb0e3f, 0xb0e5b}, {0xb0e94, 0xb0e97}, {0xb0e99, 0xb0e9f}, - {0xb0ea1, 0xb0ea3}, {0xb0ead, 0xb0eb9}, {0xb0ebb, 0xb0ebd}, {0xb0ec0, 0xb0ec4}, - {0xb0ec8, 0xb0ecd}, {0xb0ed0, 0xb0ed9}, {0xb0edc, 0xb0edf}, {0xb0f00, 0xb0f47}, - {0xb0f49, 0xb0f6c}, {0xb0f71, 0xb0f97}, {0xb0f99, 0xb0fbc}, {0xb0fbe, 0xb0fcc}, - {0xb0fce, 0xb0fda}, {0xb1000, 0xb10c5}, {0xb10d0, 0xb1248}, {0xb124a, 0xb124d}, - {0xb1250, 0xb1256}, {0xb125a, 0xb125d}, {0xb1260, 0xb1288}, {0xb128a, 0xb128d}, - {0xb1290, 0xb12b0}, {0xb12b2, 0xb12b5}, {0xb12b8, 0xb12be}, {0xb12c2, 0xb12c5}, - {0xb12c8, 0xb12d6}, {0xb12d8, 0xb1310}, {0xb1312, 0xb1315}, {0xb1318, 0xb135a}, - {0xb135d, 0xb137c}, {0xb1380, 0xb1399}, {0xb13a0, 0xb13f5}, {0xb13f8, 0xb13fd}, - {0xb1400, 0xb167f}, {0xb1681, 0xb169c}, {0xb16a0, 0xb16f8}, {0xb1700, 0xb170c}, - {0xb170e, 0xb1714}, {0xb1720, 0xb1736}, {0xb1740, 0xb1753}, {0xb1760, 0xb176c}, - {0xb176e, 0xb1770}, {0xb1780, 0xb17dd}, {0xb17e0, 0xb17e9}, {0xb17f0, 0xb17f9}, - {0xb1800, 0xb180d}, {0xb1810, 0xb1819}, {0xb1820, 0xb1877}, {0xb1880, 0xb18aa}, - {0xb18b0, 0xb18f5}, {0xb1900, 0xb191e}, {0xb1920, 0xb192b}, {0xb1930, 0xb193b}, - {0xb1944, 0xb196d}, {0xb1970, 0xb1974}, {0xb1980, 0xb19ab}, {0xb19b0, 0xb19c9}, - {0xb19d0, 0xb19da}, {0xb19de, 0xb1a1b}, {0xb1a1e, 0xb1a5e}, {0xb1a60, 0xb1a7c}, - {0xb1a7f, 0xb1a89}, {0xb1a90, 0xb1a99}, {0xb1aa0, 0xb1aad}, {0xb1ab0, 0xb1abe}, - {0xb1b00, 0xb1b4b}, {0xb1b50, 0xb1b7c}, {0xb1b80, 0xb1bf3}, {0xb1bfc, 0xb1c37}, - {0xb1c3b, 0xb1c49}, {0xb1c4d, 0xb1c88}, {0xb1cc0, 0xb1cc7}, {0xb1cd0, 0xb1cf9}, - {0xb1d00, 0xb1df9}, {0xb1dfb, 0xb1f15}, {0xb1f18, 0xb1f1d}, {0xb1f20, 0xb1f45}, - {0xb1f48, 0xb1f4d}, {0xb1f50, 0xb1f57}, {0xb1f5f, 0xb1f7d}, {0xb1f80, 0xb1fb4}, - {0xb1fb6, 0xb1fc4}, {0xb1fc6, 0xb1fd3}, {0xb1fd6, 0xb1fdb}, {0xb1fdd, 0xb1fef}, - {0xb1ff2, 0xb1ff4}, {0xb1ff6, 0xb1ffe}, {0xb2010, 0xb2027}, {0xb2030, 0xb205e}, - {0xb2074, 0xb208e}, {0xb2090, 0xb209c}, {0xb20a0, 0xb20bf}, {0xb20d0, 0xb20f0}, - {0xb2100, 0xb218b}, {0xb2190, 0xb2426}, {0xb2440, 0xb244a}, {0xb2460, 0xb2b73}, - {0xb2b76, 0xb2b95}, {0xb2b98, 0xb2bb9}, {0xb2bbd, 0xb2bc8}, {0xb2bca, 0xb2bd2}, - {0xb2bec, 0xb2bef}, {0xb2c00, 0xb2c2e}, {0xb2c30, 0xb2c5e}, {0xb2c60, 0xb2cf3}, - {0xb2cf9, 0xb2d25}, {0xb2d30, 0xb2d67}, {0xb2d7f, 0xb2d96}, {0xb2da0, 0xb2da6}, - {0xb2da8, 0xb2dae}, {0xb2db0, 0xb2db6}, {0xb2db8, 0xb2dbe}, {0xb2dc0, 0xb2dc6}, - {0xb2dc8, 0xb2dce}, {0xb2dd0, 0xb2dd6}, {0xb2dd8, 0xb2dde}, {0xb2de0, 0xb2e49}, - {0xb2e80, 0xb2e99}, {0xb2e9b, 0xb2ef3}, {0xb2f00, 0xb2fd5}, {0xb2ff0, 0xb2ffb}, - {0xb3001, 0xb303f}, {0xb3041, 0xb3096}, {0xb3099, 0xb30ff}, {0xb3105, 0xb312e}, - {0xb3131, 0xb318e}, {0xb3190, 0xb31ba}, {0xb31c0, 0xb31e3}, {0xb31f0, 0xb321e}, - {0xb3220, 0xb32fe}, {0xb3300, 0xb4db5}, {0xb4dc0, 0xb9fea}, {0xba000, 0xba48c}, - {0xba490, 0xba4c6}, {0xba4d0, 0xba62b}, {0xba640, 0xba6f7}, {0xba700, 0xba7ae}, - {0xba7b0, 0xba7b7}, {0xba7f7, 0xba82b}, {0xba830, 0xba839}, {0xba840, 0xba877}, - {0xba880, 0xba8c5}, {0xba8ce, 0xba8d9}, {0xba8e0, 0xba8fd}, {0xba900, 0xba953}, - {0xba95f, 0xba97c}, {0xba980, 0xba9cd}, {0xba9cf, 0xba9d9}, {0xba9de, 0xba9fe}, - {0xbaa00, 0xbaa36}, {0xbaa40, 0xbaa4d}, {0xbaa50, 0xbaa59}, {0xbaa5c, 0xbaac2}, - {0xbaadb, 0xbaaf6}, {0xbab01, 0xbab06}, {0xbab09, 0xbab0e}, {0xbab11, 0xbab16}, - {0xbab20, 0xbab26}, {0xbab28, 0xbab2e}, {0xbab30, 0xbab65}, {0xbab70, 0xbabed}, - {0xbabf0, 0xbabf9}, {0xbac00, 0xbd7a3}, {0xbd7b0, 0xbd7c6}, {0xbd7cb, 0xbd7fb}, - {0xbf900, 0xbfa6d}, {0xbfa70, 0xbfad9}, {0xbfb00, 0xbfb06}, {0xbfb13, 0xbfb17}, - {0xbfb1d, 0xbfb36}, {0xbfb38, 0xbfb3c}, {0xbfb46, 0xbfbc1}, {0xbfbd3, 0xbfd3f}, - {0xbfd50, 0xbfd8f}, {0xbfd92, 0xbfdc7}, {0xbfdf0, 0xbfdfd}, {0xbfe00, 0xbfe19}, - {0xbfe20, 0xbfe52}, {0xbfe54, 0xbfe66}, {0xbfe68, 0xbfe6b}, {0xbfe70, 0xbfe74}, - {0xbfe76, 0xbfefc}, {0xbff01, 0xbffbe}, {0xbffc2, 0xbffc7}, {0xbffca, 0xbffcf}, - {0xbffd2, 0xbffd7}, {0xbffda, 0xbffdc}, {0xbffe0, 0xbffe6}, {0xbffe8, 0xbffee}, - {0xc0021, 0xc007e}, {0xc00a1, 0xc00ac}, {0xc00ae, 0xc0377}, {0xc037a, 0xc037f}, - {0xc0384, 0xc038a}, {0xc038e, 0xc03a1}, {0xc03a3, 0xc052f}, {0xc0531, 0xc0556}, - {0xc0559, 0xc055f}, {0xc0561, 0xc0587}, {0xc058d, 0xc058f}, {0xc0591, 0xc05c7}, - {0xc05d0, 0xc05ea}, {0xc05f0, 0xc05f4}, {0xc0606, 0xc061b}, {0xc061e, 0xc06dc}, - {0xc06de, 0xc070d}, {0xc0710, 0xc074a}, {0xc074d, 0xc07b1}, {0xc07c0, 0xc07fa}, - {0xc0800, 0xc082d}, {0xc0830, 0xc083e}, {0xc0840, 0xc085b}, {0xc0860, 0xc086a}, - {0xc08a0, 0xc08b4}, {0xc08b6, 0xc08bd}, {0xc08d4, 0xc08e1}, {0xc08e3, 0xc0983}, - {0xc0985, 0xc098c}, {0xc0993, 0xc09a8}, {0xc09aa, 0xc09b0}, {0xc09b6, 0xc09b9}, - {0xc09bc, 0xc09c4}, {0xc09cb, 0xc09ce}, {0xc09df, 0xc09e3}, {0xc09e6, 0xc09fd}, - {0xc0a01, 0xc0a03}, {0xc0a05, 0xc0a0a}, {0xc0a13, 0xc0a28}, {0xc0a2a, 0xc0a30}, - {0xc0a3e, 0xc0a42}, {0xc0a4b, 0xc0a4d}, {0xc0a59, 0xc0a5c}, {0xc0a66, 0xc0a75}, - {0xc0a81, 0xc0a83}, {0xc0a85, 0xc0a8d}, {0xc0a8f, 0xc0a91}, {0xc0a93, 0xc0aa8}, - {0xc0aaa, 0xc0ab0}, {0xc0ab5, 0xc0ab9}, {0xc0abc, 0xc0ac5}, {0xc0ac7, 0xc0ac9}, - {0xc0acb, 0xc0acd}, {0xc0ae0, 0xc0ae3}, {0xc0ae6, 0xc0af1}, {0xc0af9, 0xc0aff}, - {0xc0b01, 0xc0b03}, {0xc0b05, 0xc0b0c}, {0xc0b13, 0xc0b28}, {0xc0b2a, 0xc0b30}, - {0xc0b35, 0xc0b39}, {0xc0b3c, 0xc0b44}, {0xc0b4b, 0xc0b4d}, {0xc0b5f, 0xc0b63}, - {0xc0b66, 0xc0b77}, {0xc0b85, 0xc0b8a}, {0xc0b8e, 0xc0b90}, {0xc0b92, 0xc0b95}, - {0xc0ba8, 0xc0baa}, {0xc0bae, 0xc0bb9}, {0xc0bbe, 0xc0bc2}, {0xc0bc6, 0xc0bc8}, - {0xc0bca, 0xc0bcd}, {0xc0be6, 0xc0bfa}, {0xc0c00, 0xc0c03}, {0xc0c05, 0xc0c0c}, - {0xc0c0e, 0xc0c10}, {0xc0c12, 0xc0c28}, {0xc0c2a, 0xc0c39}, {0xc0c3d, 0xc0c44}, - {0xc0c46, 0xc0c48}, {0xc0c4a, 0xc0c4d}, {0xc0c58, 0xc0c5a}, {0xc0c60, 0xc0c63}, - {0xc0c66, 0xc0c6f}, {0xc0c78, 0xc0c83}, {0xc0c85, 0xc0c8c}, {0xc0c8e, 0xc0c90}, - {0xc0c92, 0xc0ca8}, {0xc0caa, 0xc0cb3}, {0xc0cb5, 0xc0cb9}, {0xc0cbc, 0xc0cc4}, - {0xc0cc6, 0xc0cc8}, {0xc0cca, 0xc0ccd}, {0xc0ce0, 0xc0ce3}, {0xc0ce6, 0xc0cef}, - {0xc0d00, 0xc0d03}, {0xc0d05, 0xc0d0c}, {0xc0d0e, 0xc0d10}, {0xc0d12, 0xc0d44}, - {0xc0d46, 0xc0d48}, {0xc0d4a, 0xc0d4f}, {0xc0d54, 0xc0d63}, {0xc0d66, 0xc0d7f}, - {0xc0d85, 0xc0d96}, {0xc0d9a, 0xc0db1}, {0xc0db3, 0xc0dbb}, {0xc0dc0, 0xc0dc6}, - {0xc0dcf, 0xc0dd4}, {0xc0dd8, 0xc0ddf}, {0xc0de6, 0xc0def}, {0xc0df2, 0xc0df4}, - {0xc0e01, 0xc0e3a}, {0xc0e3f, 0xc0e5b}, {0xc0e94, 0xc0e97}, {0xc0e99, 0xc0e9f}, - {0xc0ea1, 0xc0ea3}, {0xc0ead, 0xc0eb9}, {0xc0ebb, 0xc0ebd}, {0xc0ec0, 0xc0ec4}, - {0xc0ec8, 0xc0ecd}, {0xc0ed0, 0xc0ed9}, {0xc0edc, 0xc0edf}, {0xc0f00, 0xc0f47}, - {0xc0f49, 0xc0f6c}, {0xc0f71, 0xc0f97}, {0xc0f99, 0xc0fbc}, {0xc0fbe, 0xc0fcc}, - {0xc0fce, 0xc0fda}, {0xc1000, 0xc10c5}, {0xc10d0, 0xc1248}, {0xc124a, 0xc124d}, - {0xc1250, 0xc1256}, {0xc125a, 0xc125d}, {0xc1260, 0xc1288}, {0xc128a, 0xc128d}, - {0xc1290, 0xc12b0}, {0xc12b2, 0xc12b5}, {0xc12b8, 0xc12be}, {0xc12c2, 0xc12c5}, - {0xc12c8, 0xc12d6}, {0xc12d8, 0xc1310}, {0xc1312, 0xc1315}, {0xc1318, 0xc135a}, - {0xc135d, 0xc137c}, {0xc1380, 0xc1399}, {0xc13a0, 0xc13f5}, {0xc13f8, 0xc13fd}, - {0xc1400, 0xc167f}, {0xc1681, 0xc169c}, {0xc16a0, 0xc16f8}, {0xc1700, 0xc170c}, - {0xc170e, 0xc1714}, {0xc1720, 0xc1736}, {0xc1740, 0xc1753}, {0xc1760, 0xc176c}, - {0xc176e, 0xc1770}, {0xc1780, 0xc17dd}, {0xc17e0, 0xc17e9}, {0xc17f0, 0xc17f9}, - {0xc1800, 0xc180d}, {0xc1810, 0xc1819}, {0xc1820, 0xc1877}, {0xc1880, 0xc18aa}, - {0xc18b0, 0xc18f5}, {0xc1900, 0xc191e}, {0xc1920, 0xc192b}, {0xc1930, 0xc193b}, - {0xc1944, 0xc196d}, {0xc1970, 0xc1974}, {0xc1980, 0xc19ab}, {0xc19b0, 0xc19c9}, - {0xc19d0, 0xc19da}, {0xc19de, 0xc1a1b}, {0xc1a1e, 0xc1a5e}, {0xc1a60, 0xc1a7c}, - {0xc1a7f, 0xc1a89}, {0xc1a90, 0xc1a99}, {0xc1aa0, 0xc1aad}, {0xc1ab0, 0xc1abe}, - {0xc1b00, 0xc1b4b}, {0xc1b50, 0xc1b7c}, {0xc1b80, 0xc1bf3}, {0xc1bfc, 0xc1c37}, - {0xc1c3b, 0xc1c49}, {0xc1c4d, 0xc1c88}, {0xc1cc0, 0xc1cc7}, {0xc1cd0, 0xc1cf9}, - {0xc1d00, 0xc1df9}, {0xc1dfb, 0xc1f15}, {0xc1f18, 0xc1f1d}, {0xc1f20, 0xc1f45}, - {0xc1f48, 0xc1f4d}, {0xc1f50, 0xc1f57}, {0xc1f5f, 0xc1f7d}, {0xc1f80, 0xc1fb4}, - {0xc1fb6, 0xc1fc4}, {0xc1fc6, 0xc1fd3}, {0xc1fd6, 0xc1fdb}, {0xc1fdd, 0xc1fef}, - {0xc1ff2, 0xc1ff4}, {0xc1ff6, 0xc1ffe}, {0xc2010, 0xc2027}, {0xc2030, 0xc205e}, - {0xc2074, 0xc208e}, {0xc2090, 0xc209c}, {0xc20a0, 0xc20bf}, {0xc20d0, 0xc20f0}, - {0xc2100, 0xc218b}, {0xc2190, 0xc2426}, {0xc2440, 0xc244a}, {0xc2460, 0xc2b73}, - {0xc2b76, 0xc2b95}, {0xc2b98, 0xc2bb9}, {0xc2bbd, 0xc2bc8}, {0xc2bca, 0xc2bd2}, - {0xc2bec, 0xc2bef}, {0xc2c00, 0xc2c2e}, {0xc2c30, 0xc2c5e}, {0xc2c60, 0xc2cf3}, - {0xc2cf9, 0xc2d25}, {0xc2d30, 0xc2d67}, {0xc2d7f, 0xc2d96}, {0xc2da0, 0xc2da6}, - {0xc2da8, 0xc2dae}, {0xc2db0, 0xc2db6}, {0xc2db8, 0xc2dbe}, {0xc2dc0, 0xc2dc6}, - {0xc2dc8, 0xc2dce}, {0xc2dd0, 0xc2dd6}, {0xc2dd8, 0xc2dde}, {0xc2de0, 0xc2e49}, - {0xc2e80, 0xc2e99}, {0xc2e9b, 0xc2ef3}, {0xc2f00, 0xc2fd5}, {0xc2ff0, 0xc2ffb}, - {0xc3001, 0xc303f}, {0xc3041, 0xc3096}, {0xc3099, 0xc30ff}, {0xc3105, 0xc312e}, - {0xc3131, 0xc318e}, {0xc3190, 0xc31ba}, {0xc31c0, 0xc31e3}, {0xc31f0, 0xc321e}, - {0xc3220, 0xc32fe}, {0xc3300, 0xc4db5}, {0xc4dc0, 0xc9fea}, {0xca000, 0xca48c}, - {0xca490, 0xca4c6}, {0xca4d0, 0xca62b}, {0xca640, 0xca6f7}, {0xca700, 0xca7ae}, - {0xca7b0, 0xca7b7}, {0xca7f7, 0xca82b}, {0xca830, 0xca839}, {0xca840, 0xca877}, - {0xca880, 0xca8c5}, {0xca8ce, 0xca8d9}, {0xca8e0, 0xca8fd}, {0xca900, 0xca953}, - {0xca95f, 0xca97c}, {0xca980, 0xca9cd}, {0xca9cf, 0xca9d9}, {0xca9de, 0xca9fe}, - {0xcaa00, 0xcaa36}, {0xcaa40, 0xcaa4d}, {0xcaa50, 0xcaa59}, {0xcaa5c, 0xcaac2}, - {0xcaadb, 0xcaaf6}, {0xcab01, 0xcab06}, {0xcab09, 0xcab0e}, {0xcab11, 0xcab16}, - {0xcab20, 0xcab26}, {0xcab28, 0xcab2e}, {0xcab30, 0xcab65}, {0xcab70, 0xcabed}, - {0xcabf0, 0xcabf9}, {0xcac00, 0xcd7a3}, {0xcd7b0, 0xcd7c6}, {0xcd7cb, 0xcd7fb}, - {0xcf900, 0xcfa6d}, {0xcfa70, 0xcfad9}, {0xcfb00, 0xcfb06}, {0xcfb13, 0xcfb17}, - {0xcfb1d, 0xcfb36}, {0xcfb38, 0xcfb3c}, {0xcfb46, 0xcfbc1}, {0xcfbd3, 0xcfd3f}, - {0xcfd50, 0xcfd8f}, {0xcfd92, 0xcfdc7}, {0xcfdf0, 0xcfdfd}, {0xcfe00, 0xcfe19}, - {0xcfe20, 0xcfe52}, {0xcfe54, 0xcfe66}, {0xcfe68, 0xcfe6b}, {0xcfe70, 0xcfe74}, - {0xcfe76, 0xcfefc}, {0xcff01, 0xcffbe}, {0xcffc2, 0xcffc7}, {0xcffca, 0xcffcf}, - {0xcffd2, 0xcffd7}, {0xcffda, 0xcffdc}, {0xcffe0, 0xcffe6}, {0xcffe8, 0xcffee}, - {0xd0021, 0xd007e}, {0xd00a1, 0xd00ac}, {0xd00ae, 0xd0377}, {0xd037a, 0xd037f}, - {0xd0384, 0xd038a}, {0xd038e, 0xd03a1}, {0xd03a3, 0xd052f}, {0xd0531, 0xd0556}, - {0xd0559, 0xd055f}, {0xd0561, 0xd0587}, {0xd058d, 0xd058f}, {0xd0591, 0xd05c7}, - {0xd05d0, 0xd05ea}, {0xd05f0, 0xd05f4}, {0xd0606, 0xd061b}, {0xd061e, 0xd06dc}, - {0xd06de, 0xd070d}, {0xd0710, 0xd074a}, {0xd074d, 0xd07b1}, {0xd07c0, 0xd07fa}, - {0xd0800, 0xd082d}, {0xd0830, 0xd083e}, {0xd0840, 0xd085b}, {0xd0860, 0xd086a}, - {0xd08a0, 0xd08b4}, {0xd08b6, 0xd08bd}, {0xd08d4, 0xd08e1}, {0xd08e3, 0xd0983}, - {0xd0985, 0xd098c}, {0xd0993, 0xd09a8}, {0xd09aa, 0xd09b0}, {0xd09b6, 0xd09b9}, - {0xd09bc, 0xd09c4}, {0xd09cb, 0xd09ce}, {0xd09df, 0xd09e3}, {0xd09e6, 0xd09fd}, - {0xd0a01, 0xd0a03}, {0xd0a05, 0xd0a0a}, {0xd0a13, 0xd0a28}, {0xd0a2a, 0xd0a30}, - {0xd0a3e, 0xd0a42}, {0xd0a4b, 0xd0a4d}, {0xd0a59, 0xd0a5c}, {0xd0a66, 0xd0a75}, - {0xd0a81, 0xd0a83}, {0xd0a85, 0xd0a8d}, {0xd0a8f, 0xd0a91}, {0xd0a93, 0xd0aa8}, - {0xd0aaa, 0xd0ab0}, {0xd0ab5, 0xd0ab9}, {0xd0abc, 0xd0ac5}, {0xd0ac7, 0xd0ac9}, - {0xd0acb, 0xd0acd}, {0xd0ae0, 0xd0ae3}, {0xd0ae6, 0xd0af1}, {0xd0af9, 0xd0aff}, - {0xd0b01, 0xd0b03}, {0xd0b05, 0xd0b0c}, {0xd0b13, 0xd0b28}, {0xd0b2a, 0xd0b30}, - {0xd0b35, 0xd0b39}, {0xd0b3c, 0xd0b44}, {0xd0b4b, 0xd0b4d}, {0xd0b5f, 0xd0b63}, - {0xd0b66, 0xd0b77}, {0xd0b85, 0xd0b8a}, {0xd0b8e, 0xd0b90}, {0xd0b92, 0xd0b95}, - {0xd0ba8, 0xd0baa}, {0xd0bae, 0xd0bb9}, {0xd0bbe, 0xd0bc2}, {0xd0bc6, 0xd0bc8}, - {0xd0bca, 0xd0bcd}, {0xd0be6, 0xd0bfa}, {0xd0c00, 0xd0c03}, {0xd0c05, 0xd0c0c}, - {0xd0c0e, 0xd0c10}, {0xd0c12, 0xd0c28}, {0xd0c2a, 0xd0c39}, {0xd0c3d, 0xd0c44}, - {0xd0c46, 0xd0c48}, {0xd0c4a, 0xd0c4d}, {0xd0c58, 0xd0c5a}, {0xd0c60, 0xd0c63}, - {0xd0c66, 0xd0c6f}, {0xd0c78, 0xd0c83}, {0xd0c85, 0xd0c8c}, {0xd0c8e, 0xd0c90}, - {0xd0c92, 0xd0ca8}, {0xd0caa, 0xd0cb3}, {0xd0cb5, 0xd0cb9}, {0xd0cbc, 0xd0cc4}, - {0xd0cc6, 0xd0cc8}, {0xd0cca, 0xd0ccd}, {0xd0ce0, 0xd0ce3}, {0xd0ce6, 0xd0cef}, - {0xd0d00, 0xd0d03}, {0xd0d05, 0xd0d0c}, {0xd0d0e, 0xd0d10}, {0xd0d12, 0xd0d44}, - {0xd0d46, 0xd0d48}, {0xd0d4a, 0xd0d4f}, {0xd0d54, 0xd0d63}, {0xd0d66, 0xd0d7f}, - {0xd0d85, 0xd0d96}, {0xd0d9a, 0xd0db1}, {0xd0db3, 0xd0dbb}, {0xd0dc0, 0xd0dc6}, - {0xd0dcf, 0xd0dd4}, {0xd0dd8, 0xd0ddf}, {0xd0de6, 0xd0def}, {0xd0df2, 0xd0df4}, - {0xd0e01, 0xd0e3a}, {0xd0e3f, 0xd0e5b}, {0xd0e94, 0xd0e97}, {0xd0e99, 0xd0e9f}, - {0xd0ea1, 0xd0ea3}, {0xd0ead, 0xd0eb9}, {0xd0ebb, 0xd0ebd}, {0xd0ec0, 0xd0ec4}, - {0xd0ec8, 0xd0ecd}, {0xd0ed0, 0xd0ed9}, {0xd0edc, 0xd0edf}, {0xd0f00, 0xd0f47}, - {0xd0f49, 0xd0f6c}, {0xd0f71, 0xd0f97}, {0xd0f99, 0xd0fbc}, {0xd0fbe, 0xd0fcc}, - {0xd0fce, 0xd0fda}, {0xd1000, 0xd10c5}, {0xd10d0, 0xd1248}, {0xd124a, 0xd124d}, - {0xd1250, 0xd1256}, {0xd125a, 0xd125d}, {0xd1260, 0xd1288}, {0xd128a, 0xd128d}, - {0xd1290, 0xd12b0}, {0xd12b2, 0xd12b5}, {0xd12b8, 0xd12be}, {0xd12c2, 0xd12c5}, - {0xd12c8, 0xd12d6}, {0xd12d8, 0xd1310}, {0xd1312, 0xd1315}, {0xd1318, 0xd135a}, - {0xd135d, 0xd137c}, {0xd1380, 0xd1399}, {0xd13a0, 0xd13f5}, {0xd13f8, 0xd13fd}, - {0xd1400, 0xd167f}, {0xd1681, 0xd169c}, {0xd16a0, 0xd16f8}, {0xd1700, 0xd170c}, - {0xd170e, 0xd1714}, {0xd1720, 0xd1736}, {0xd1740, 0xd1753}, {0xd1760, 0xd176c}, - {0xd176e, 0xd1770}, {0xd1780, 0xd17dd}, {0xd17e0, 0xd17e9}, {0xd17f0, 0xd17f9}, - {0xd1800, 0xd180d}, {0xd1810, 0xd1819}, {0xd1820, 0xd1877}, {0xd1880, 0xd18aa}, - {0xd18b0, 0xd18f5}, {0xd1900, 0xd191e}, {0xd1920, 0xd192b}, {0xd1930, 0xd193b}, - {0xd1944, 0xd196d}, {0xd1970, 0xd1974}, {0xd1980, 0xd19ab}, {0xd19b0, 0xd19c9}, - {0xd19d0, 0xd19da}, {0xd19de, 0xd1a1b}, {0xd1a1e, 0xd1a5e}, {0xd1a60, 0xd1a7c}, - {0xd1a7f, 0xd1a89}, {0xd1a90, 0xd1a99}, {0xd1aa0, 0xd1aad}, {0xd1ab0, 0xd1abe}, - {0xd1b00, 0xd1b4b}, {0xd1b50, 0xd1b7c}, {0xd1b80, 0xd1bf3}, {0xd1bfc, 0xd1c37}, - {0xd1c3b, 0xd1c49}, {0xd1c4d, 0xd1c88}, {0xd1cc0, 0xd1cc7}, {0xd1cd0, 0xd1cf9}, - {0xd1d00, 0xd1df9}, {0xd1dfb, 0xd1f15}, {0xd1f18, 0xd1f1d}, {0xd1f20, 0xd1f45}, - {0xd1f48, 0xd1f4d}, {0xd1f50, 0xd1f57}, {0xd1f5f, 0xd1f7d}, {0xd1f80, 0xd1fb4}, - {0xd1fb6, 0xd1fc4}, {0xd1fc6, 0xd1fd3}, {0xd1fd6, 0xd1fdb}, {0xd1fdd, 0xd1fef}, - {0xd1ff2, 0xd1ff4}, {0xd1ff6, 0xd1ffe}, {0xd2010, 0xd2027}, {0xd2030, 0xd205e}, - {0xd2074, 0xd208e}, {0xd2090, 0xd209c}, {0xd20a0, 0xd20bf}, {0xd20d0, 0xd20f0}, - {0xd2100, 0xd218b}, {0xd2190, 0xd2426}, {0xd2440, 0xd244a}, {0xd2460, 0xd2b73}, - {0xd2b76, 0xd2b95}, {0xd2b98, 0xd2bb9}, {0xd2bbd, 0xd2bc8}, {0xd2bca, 0xd2bd2}, - {0xd2bec, 0xd2bef}, {0xd2c00, 0xd2c2e}, {0xd2c30, 0xd2c5e}, {0xd2c60, 0xd2cf3}, - {0xd2cf9, 0xd2d25}, {0xd2d30, 0xd2d67}, {0xd2d7f, 0xd2d96}, {0xd2da0, 0xd2da6}, - {0xd2da8, 0xd2dae}, {0xd2db0, 0xd2db6}, {0xd2db8, 0xd2dbe}, {0xd2dc0, 0xd2dc6}, - {0xd2dc8, 0xd2dce}, {0xd2dd0, 0xd2dd6}, {0xd2dd8, 0xd2dde}, {0xd2de0, 0xd2e49}, - {0xd2e80, 0xd2e99}, {0xd2e9b, 0xd2ef3}, {0xd2f00, 0xd2fd5}, {0xd2ff0, 0xd2ffb}, - {0xd3001, 0xd303f}, {0xd3041, 0xd3096}, {0xd3099, 0xd30ff}, {0xd3105, 0xd312e}, - {0xd3131, 0xd318e}, {0xd3190, 0xd31ba}, {0xd31c0, 0xd31e3}, {0xd31f0, 0xd321e}, - {0xd3220, 0xd32fe}, {0xd3300, 0xd4db5}, {0xd4dc0, 0xd9fea}, {0xda000, 0xda48c}, - {0xda490, 0xda4c6}, {0xda4d0, 0xda62b}, {0xda640, 0xda6f7}, {0xda700, 0xda7ae}, - {0xda7b0, 0xda7b7}, {0xda7f7, 0xda82b}, {0xda830, 0xda839}, {0xda840, 0xda877}, - {0xda880, 0xda8c5}, {0xda8ce, 0xda8d9}, {0xda8e0, 0xda8fd}, {0xda900, 0xda953}, - {0xda95f, 0xda97c}, {0xda980, 0xda9cd}, {0xda9cf, 0xda9d9}, {0xda9de, 0xda9fe}, - {0xdaa00, 0xdaa36}, {0xdaa40, 0xdaa4d}, {0xdaa50, 0xdaa59}, {0xdaa5c, 0xdaac2}, - {0xdaadb, 0xdaaf6}, {0xdab01, 0xdab06}, {0xdab09, 0xdab0e}, {0xdab11, 0xdab16}, - {0xdab20, 0xdab26}, {0xdab28, 0xdab2e}, {0xdab30, 0xdab65}, {0xdab70, 0xdabed}, - {0xdabf0, 0xdabf9}, {0xdac00, 0xdd7a3}, {0xdd7b0, 0xdd7c6}, {0xdd7cb, 0xdd7fb}, - {0xdf900, 0xdfa6d}, {0xdfa70, 0xdfad9}, {0xdfb00, 0xdfb06}, {0xdfb13, 0xdfb17}, - {0xdfb1d, 0xdfb36}, {0xdfb38, 0xdfb3c}, {0xdfb46, 0xdfbc1}, {0xdfbd3, 0xdfd3f}, - {0xdfd50, 0xdfd8f}, {0xdfd92, 0xdfdc7}, {0xdfdf0, 0xdfdfd}, {0xdfe00, 0xdfe19}, - {0xdfe20, 0xdfe52}, {0xdfe54, 0xdfe66}, {0xdfe68, 0xdfe6b}, {0xdfe70, 0xdfe74}, - {0xdfe76, 0xdfefc}, {0xdff01, 0xdffbe}, {0xdffc2, 0xdffc7}, {0xdffca, 0xdffcf}, - {0xdffd2, 0xdffd7}, {0xdffda, 0xdffdc}, {0xdffe0, 0xdffe6}, {0xdffe8, 0xdffee}, - {0xe0021, 0xe007e}, {0xe00a1, 0xe00ac}, {0xe00ae, 0xe0377}, {0xe037a, 0xe037f}, - {0xe0384, 0xe038a}, {0xe038e, 0xe03a1}, {0xe03a3, 0xe052f}, {0xe0531, 0xe0556}, - {0xe0559, 0xe055f}, {0xe0561, 0xe0587}, {0xe058d, 0xe058f}, {0xe0591, 0xe05c7}, - {0xe05d0, 0xe05ea}, {0xe05f0, 0xe05f4}, {0xe0606, 0xe061b}, {0xe061e, 0xe06dc}, - {0xe06de, 0xe070d}, {0xe0710, 0xe074a}, {0xe074d, 0xe07b1}, {0xe07c0, 0xe07fa}, - {0xe0800, 0xe082d}, {0xe0830, 0xe083e}, {0xe0840, 0xe085b}, {0xe0860, 0xe086a}, - {0xe08a0, 0xe08b4}, {0xe08b6, 0xe08bd}, {0xe08d4, 0xe08e1}, {0xe08e3, 0xe0983}, - {0xe0985, 0xe098c}, {0xe0993, 0xe09a8}, {0xe09aa, 0xe09b0}, {0xe09b6, 0xe09b9}, - {0xe09bc, 0xe09c4}, {0xe09cb, 0xe09ce}, {0xe09df, 0xe09e3}, {0xe09e6, 0xe09fd}, - {0xe0a01, 0xe0a03}, {0xe0a05, 0xe0a0a}, {0xe0a13, 0xe0a28}, {0xe0a2a, 0xe0a30}, - {0xe0a3e, 0xe0a42}, {0xe0a4b, 0xe0a4d}, {0xe0a59, 0xe0a5c}, {0xe0a66, 0xe0a75}, - {0xe0a81, 0xe0a83}, {0xe0a85, 0xe0a8d}, {0xe0a8f, 0xe0a91}, {0xe0a93, 0xe0aa8}, - {0xe0aaa, 0xe0ab0}, {0xe0ab5, 0xe0ab9}, {0xe0abc, 0xe0ac5}, {0xe0ac7, 0xe0ac9}, - {0xe0acb, 0xe0acd}, {0xe0ae0, 0xe0ae3}, {0xe0ae6, 0xe0af1}, {0xe0af9, 0xe0aff}, - {0xe0b01, 0xe0b03}, {0xe0b05, 0xe0b0c}, {0xe0b13, 0xe0b28}, {0xe0b2a, 0xe0b30}, - {0xe0b35, 0xe0b39}, {0xe0b3c, 0xe0b44}, {0xe0b4b, 0xe0b4d}, {0xe0b5f, 0xe0b63}, - {0xe0b66, 0xe0b77}, {0xe0b85, 0xe0b8a}, {0xe0b8e, 0xe0b90}, {0xe0b92, 0xe0b95}, - {0xe0ba8, 0xe0baa}, {0xe0bae, 0xe0bb9}, {0xe0bbe, 0xe0bc2}, {0xe0bc6, 0xe0bc8}, - {0xe0bca, 0xe0bcd}, {0xe0be6, 0xe0bfa}, {0xe0c00, 0xe0c03}, {0xe0c05, 0xe0c0c}, - {0xe0c0e, 0xe0c10}, {0xe0c12, 0xe0c28}, {0xe0c2a, 0xe0c39}, {0xe0c3d, 0xe0c44}, - {0xe0c46, 0xe0c48}, {0xe0c4a, 0xe0c4d}, {0xe0c58, 0xe0c5a}, {0xe0c60, 0xe0c63}, - {0xe0c66, 0xe0c6f}, {0xe0c78, 0xe0c83}, {0xe0c85, 0xe0c8c}, {0xe0c8e, 0xe0c90}, - {0xe0c92, 0xe0ca8}, {0xe0caa, 0xe0cb3}, {0xe0cb5, 0xe0cb9}, {0xe0cbc, 0xe0cc4}, - {0xe0cc6, 0xe0cc8}, {0xe0cca, 0xe0ccd}, {0xe0ce0, 0xe0ce3}, {0xe0ce6, 0xe0cef}, - {0xe0d00, 0xe0d03}, {0xe0d05, 0xe0d0c}, {0xe0d0e, 0xe0d10}, {0xe0d12, 0xe0d44}, - {0xe0d46, 0xe0d48}, {0xe0d4a, 0xe0d4f}, {0xe0d54, 0xe0d63}, {0xe0d66, 0xe0d7f}, - {0xe0d85, 0xe0d96}, {0xe0d9a, 0xe0db1}, {0xe0db3, 0xe0dbb}, {0xe0dc0, 0xe0dc6}, - {0xe0dcf, 0xe0dd4}, {0xe0dd8, 0xe0ddf}, {0xe0de6, 0xe0def}, {0xe0df2, 0xe0df4}, - {0xe0e01, 0xe0e3a}, {0xe0e3f, 0xe0e5b}, {0xe0e94, 0xe0e97}, {0xe0e99, 0xe0e9f}, - {0xe0ea1, 0xe0ea3}, {0xe0ead, 0xe0eb9}, {0xe0ebb, 0xe0ebd}, {0xe0ec0, 0xe0ec4}, - {0xe0ec8, 0xe0ecd}, {0xe0ed0, 0xe0ed9}, {0xe0edc, 0xe0edf}, {0xe0f00, 0xe0f47}, - {0xe0f49, 0xe0f6c}, {0xe0f71, 0xe0f97}, {0xe0f99, 0xe0fbc}, {0xe0fbe, 0xe0fcc}, - {0xe0fce, 0xe0fda}, {0xe1000, 0xe10c5}, {0xe10d0, 0xe1248}, {0xe124a, 0xe124d}, - {0xe1250, 0xe1256}, {0xe125a, 0xe125d}, {0xe1260, 0xe1288}, {0xe128a, 0xe128d}, - {0xe1290, 0xe12b0}, {0xe12b2, 0xe12b5}, {0xe12b8, 0xe12be}, {0xe12c2, 0xe12c5}, - {0xe12c8, 0xe12d6}, {0xe12d8, 0xe1310}, {0xe1312, 0xe1315}, {0xe1318, 0xe135a}, - {0xe135d, 0xe137c}, {0xe1380, 0xe1399}, {0xe13a0, 0xe13f5}, {0xe13f8, 0xe13fd}, - {0xe1400, 0xe167f}, {0xe1681, 0xe169c}, {0xe16a0, 0xe16f8}, {0xe1700, 0xe170c}, - {0xe170e, 0xe1714}, {0xe1720, 0xe1736}, {0xe1740, 0xe1753}, {0xe1760, 0xe176c}, - {0xe176e, 0xe1770}, {0xe1780, 0xe17dd}, {0xe17e0, 0xe17e9}, {0xe17f0, 0xe17f9}, - {0xe1800, 0xe180d}, {0xe1810, 0xe1819}, {0xe1820, 0xe1877}, {0xe1880, 0xe18aa}, - {0xe18b0, 0xe18f5}, {0xe1900, 0xe191e}, {0xe1920, 0xe192b}, {0xe1930, 0xe193b}, - {0xe1944, 0xe196d}, {0xe1970, 0xe1974}, {0xe1980, 0xe19ab}, {0xe19b0, 0xe19c9}, - {0xe19d0, 0xe19da}, {0xe19de, 0xe1a1b}, {0xe1a1e, 0xe1a5e}, {0xe1a60, 0xe1a7c}, - {0xe1a7f, 0xe1a89}, {0xe1a90, 0xe1a99}, {0xe1aa0, 0xe1aad}, {0xe1ab0, 0xe1abe}, - {0xe1b00, 0xe1b4b}, {0xe1b50, 0xe1b7c}, {0xe1b80, 0xe1bf3}, {0xe1bfc, 0xe1c37}, - {0xe1c3b, 0xe1c49}, {0xe1c4d, 0xe1c88}, {0xe1cc0, 0xe1cc7}, {0xe1cd0, 0xe1cf9}, - {0xe1d00, 0xe1df9}, {0xe1dfb, 0xe1f15}, {0xe1f18, 0xe1f1d}, {0xe1f20, 0xe1f45}, - {0xe1f48, 0xe1f4d}, {0xe1f50, 0xe1f57}, {0xe1f5f, 0xe1f7d}, {0xe1f80, 0xe1fb4}, - {0xe1fb6, 0xe1fc4}, {0xe1fc6, 0xe1fd3}, {0xe1fd6, 0xe1fdb}, {0xe1fdd, 0xe1fef}, - {0xe1ff2, 0xe1ff4}, {0xe1ff6, 0xe1ffe}, {0xe2010, 0xe2027}, {0xe2030, 0xe205e}, - {0xe2074, 0xe208e}, {0xe2090, 0xe209c}, {0xe20a0, 0xe20bf}, {0xe20d0, 0xe20f0}, - {0xe2100, 0xe218b}, {0xe2190, 0xe2426}, {0xe2440, 0xe244a}, {0xe2460, 0xe2b73}, - {0xe2b76, 0xe2b95}, {0xe2b98, 0xe2bb9}, {0xe2bbd, 0xe2bc8}, {0xe2bca, 0xe2bd2}, - {0xe2bec, 0xe2bef}, {0xe2c00, 0xe2c2e}, {0xe2c30, 0xe2c5e}, {0xe2c60, 0xe2cf3}, - {0xe2cf9, 0xe2d25}, {0xe2d30, 0xe2d67}, {0xe2d7f, 0xe2d96}, {0xe2da0, 0xe2da6}, - {0xe2da8, 0xe2dae}, {0xe2db0, 0xe2db6}, {0xe2db8, 0xe2dbe}, {0xe2dc0, 0xe2dc6}, - {0xe2dc8, 0xe2dce}, {0xe2dd0, 0xe2dd6}, {0xe2dd8, 0xe2dde}, {0xe2de0, 0xe2e49}, - {0xe2e80, 0xe2e99}, {0xe2e9b, 0xe2ef3}, {0xe2f00, 0xe2fd5}, {0xe2ff0, 0xe2ffb}, - {0xe3001, 0xe303f}, {0xe3041, 0xe3096}, {0xe3099, 0xe30ff}, {0xe3105, 0xe312e}, - {0xe3131, 0xe318e}, {0xe3190, 0xe31ba}, {0xe31c0, 0xe31e3}, {0xe31f0, 0xe321e}, - {0xe3220, 0xe32fe}, {0xe3300, 0xe4db5}, {0xe4dc0, 0xe9fea}, {0xea000, 0xea48c}, - {0xea490, 0xea4c6}, {0xea4d0, 0xea62b}, {0xea640, 0xea6f7}, {0xea700, 0xea7ae}, - {0xea7b0, 0xea7b7}, {0xea7f7, 0xea82b}, {0xea830, 0xea839}, {0xea840, 0xea877}, - {0xea880, 0xea8c5}, {0xea8ce, 0xea8d9}, {0xea8e0, 0xea8fd}, {0xea900, 0xea953}, - {0xea95f, 0xea97c}, {0xea980, 0xea9cd}, {0xea9cf, 0xea9d9}, {0xea9de, 0xea9fe}, - {0xeaa00, 0xeaa36}, {0xeaa40, 0xeaa4d}, {0xeaa50, 0xeaa59}, {0xeaa5c, 0xeaac2}, - {0xeaadb, 0xeaaf6}, {0xeab01, 0xeab06}, {0xeab09, 0xeab0e}, {0xeab11, 0xeab16}, - {0xeab20, 0xeab26}, {0xeab28, 0xeab2e}, {0xeab30, 0xeab65}, {0xeab70, 0xeabed}, - {0xeabf0, 0xeabf9}, {0xeac00, 0xed7a3}, {0xed7b0, 0xed7c6}, {0xed7cb, 0xed7fb}, - {0xef900, 0xefa6d}, {0xefa70, 0xefad9}, {0xefb00, 0xefb06}, {0xefb13, 0xefb17}, - {0xefb1d, 0xefb36}, {0xefb38, 0xefb3c}, {0xefb46, 0xefbc1}, {0xefbd3, 0xefd3f}, - {0xefd50, 0xefd8f}, {0xefd92, 0xefdc7}, {0xefdf0, 0xefdfd}, {0xefe00, 0xefe19}, - {0xefe20, 0xefe52}, {0xefe54, 0xefe66}, {0xefe68, 0xefe6b}, {0xefe70, 0xefe74}, - {0xefe76, 0xefefc}, {0xeff01, 0xeffbe}, {0xeffc2, 0xeffc7}, {0xeffca, 0xeffcf}, - {0xeffd2, 0xeffd7}, {0xeffda, 0xeffdc}, {0xeffe0, 0xeffe6}, {0xeffe8, 0xeffee}, - {0xf0021, 0xf007e}, {0xf00a1, 0xf00ac}, {0xf00ae, 0xf0377}, {0xf037a, 0xf037f}, - {0xf0384, 0xf038a}, {0xf038e, 0xf03a1}, {0xf03a3, 0xf052f}, {0xf0531, 0xf0556}, - {0xf0559, 0xf055f}, {0xf0561, 0xf0587}, {0xf058d, 0xf058f}, {0xf0591, 0xf05c7}, - {0xf05d0, 0xf05ea}, {0xf05f0, 0xf05f4}, {0xf0606, 0xf061b}, {0xf061e, 0xf06dc}, - {0xf06de, 0xf070d}, {0xf0710, 0xf074a}, {0xf074d, 0xf07b1}, {0xf07c0, 0xf07fa}, - {0xf0800, 0xf082d}, {0xf0830, 0xf083e}, {0xf0840, 0xf085b}, {0xf0860, 0xf086a}, - {0xf08a0, 0xf08b4}, {0xf08b6, 0xf08bd}, {0xf08d4, 0xf08e1}, {0xf08e3, 0xf0983}, - {0xf0985, 0xf098c}, {0xf0993, 0xf09a8}, {0xf09aa, 0xf09b0}, {0xf09b6, 0xf09b9}, - {0xf09bc, 0xf09c4}, {0xf09cb, 0xf09ce}, {0xf09df, 0xf09e3}, {0xf09e6, 0xf09fd}, - {0xf0a01, 0xf0a03}, {0xf0a05, 0xf0a0a}, {0xf0a13, 0xf0a28}, {0xf0a2a, 0xf0a30}, - {0xf0a3e, 0xf0a42}, {0xf0a4b, 0xf0a4d}, {0xf0a59, 0xf0a5c}, {0xf0a66, 0xf0a75}, - {0xf0a81, 0xf0a83}, {0xf0a85, 0xf0a8d}, {0xf0a8f, 0xf0a91}, {0xf0a93, 0xf0aa8}, - {0xf0aaa, 0xf0ab0}, {0xf0ab5, 0xf0ab9}, {0xf0abc, 0xf0ac5}, {0xf0ac7, 0xf0ac9}, - {0xf0acb, 0xf0acd}, {0xf0ae0, 0xf0ae3}, {0xf0ae6, 0xf0af1}, {0xf0af9, 0xf0aff}, - {0xf0b01, 0xf0b03}, {0xf0b05, 0xf0b0c}, {0xf0b13, 0xf0b28}, {0xf0b2a, 0xf0b30}, - {0xf0b35, 0xf0b39}, {0xf0b3c, 0xf0b44}, {0xf0b4b, 0xf0b4d}, {0xf0b5f, 0xf0b63}, - {0xf0b66, 0xf0b77}, {0xf0b85, 0xf0b8a}, {0xf0b8e, 0xf0b90}, {0xf0b92, 0xf0b95}, - {0xf0ba8, 0xf0baa}, {0xf0bae, 0xf0bb9}, {0xf0bbe, 0xf0bc2}, {0xf0bc6, 0xf0bc8}, - {0xf0bca, 0xf0bcd}, {0xf0be6, 0xf0bfa}, {0xf0c00, 0xf0c03}, {0xf0c05, 0xf0c0c}, - {0xf0c0e, 0xf0c10}, {0xf0c12, 0xf0c28}, {0xf0c2a, 0xf0c39}, {0xf0c3d, 0xf0c44}, - {0xf0c46, 0xf0c48}, {0xf0c4a, 0xf0c4d}, {0xf0c58, 0xf0c5a}, {0xf0c60, 0xf0c63}, - {0xf0c66, 0xf0c6f}, {0xf0c78, 0xf0c83}, {0xf0c85, 0xf0c8c}, {0xf0c8e, 0xf0c90}, - {0xf0c92, 0xf0ca8}, {0xf0caa, 0xf0cb3}, {0xf0cb5, 0xf0cb9}, {0xf0cbc, 0xf0cc4}, - {0xf0cc6, 0xf0cc8}, {0xf0cca, 0xf0ccd}, {0xf0ce0, 0xf0ce3}, {0xf0ce6, 0xf0cef}, - {0xf0d00, 0xf0d03}, {0xf0d05, 0xf0d0c}, {0xf0d0e, 0xf0d10}, {0xf0d12, 0xf0d44}, - {0xf0d46, 0xf0d48}, {0xf0d4a, 0xf0d4f}, {0xf0d54, 0xf0d63}, {0xf0d66, 0xf0d7f}, - {0xf0d85, 0xf0d96}, {0xf0d9a, 0xf0db1}, {0xf0db3, 0xf0dbb}, {0xf0dc0, 0xf0dc6}, - {0xf0dcf, 0xf0dd4}, {0xf0dd8, 0xf0ddf}, {0xf0de6, 0xf0def}, {0xf0df2, 0xf0df4}, - {0xf0e01, 0xf0e3a}, {0xf0e3f, 0xf0e5b}, {0xf0e94, 0xf0e97}, {0xf0e99, 0xf0e9f}, - {0xf0ea1, 0xf0ea3}, {0xf0ead, 0xf0eb9}, {0xf0ebb, 0xf0ebd}, {0xf0ec0, 0xf0ec4}, - {0xf0ec8, 0xf0ecd}, {0xf0ed0, 0xf0ed9}, {0xf0edc, 0xf0edf}, {0xf0f00, 0xf0f47}, - {0xf0f49, 0xf0f6c}, {0xf0f71, 0xf0f97}, {0xf0f99, 0xf0fbc}, {0xf0fbe, 0xf0fcc}, - {0xf0fce, 0xf0fda}, {0xf1000, 0xf10c5}, {0xf10d0, 0xf1248}, {0xf124a, 0xf124d}, - {0xf1250, 0xf1256}, {0xf125a, 0xf125d}, {0xf1260, 0xf1288}, {0xf128a, 0xf128d}, - {0xf1290, 0xf12b0}, {0xf12b2, 0xf12b5}, {0xf12b8, 0xf12be}, {0xf12c2, 0xf12c5}, - {0xf12c8, 0xf12d6}, {0xf12d8, 0xf1310}, {0xf1312, 0xf1315}, {0xf1318, 0xf135a}, - {0xf135d, 0xf137c}, {0xf1380, 0xf1399}, {0xf13a0, 0xf13f5}, {0xf13f8, 0xf13fd}, - {0xf1400, 0xf167f}, {0xf1681, 0xf169c}, {0xf16a0, 0xf16f8}, {0xf1700, 0xf170c}, - {0xf170e, 0xf1714}, {0xf1720, 0xf1736}, {0xf1740, 0xf1753}, {0xf1760, 0xf176c}, - {0xf176e, 0xf1770}, {0xf1780, 0xf17dd}, {0xf17e0, 0xf17e9}, {0xf17f0, 0xf17f9}, - {0xf1800, 0xf180d}, {0xf1810, 0xf1819}, {0xf1820, 0xf1877}, {0xf1880, 0xf18aa}, - {0xf18b0, 0xf18f5}, {0xf1900, 0xf191e}, {0xf1920, 0xf192b}, {0xf1930, 0xf193b}, - {0xf1944, 0xf196d}, {0xf1970, 0xf1974}, {0xf1980, 0xf19ab}, {0xf19b0, 0xf19c9}, - {0xf19d0, 0xf19da}, {0xf19de, 0xf1a1b}, {0xf1a1e, 0xf1a5e}, {0xf1a60, 0xf1a7c}, - {0xf1a7f, 0xf1a89}, {0xf1a90, 0xf1a99}, {0xf1aa0, 0xf1aad}, {0xf1ab0, 0xf1abe}, - {0xf1b00, 0xf1b4b}, {0xf1b50, 0xf1b7c}, {0xf1b80, 0xf1bf3}, {0xf1bfc, 0xf1c37}, - {0xf1c3b, 0xf1c49}, {0xf1c4d, 0xf1c88}, {0xf1cc0, 0xf1cc7}, {0xf1cd0, 0xf1cf9}, - {0xf1d00, 0xf1df9}, {0xf1dfb, 0xf1f15}, {0xf1f18, 0xf1f1d}, {0xf1f20, 0xf1f45}, - {0xf1f48, 0xf1f4d}, {0xf1f50, 0xf1f57}, {0xf1f5f, 0xf1f7d}, {0xf1f80, 0xf1fb4}, - {0xf1fb6, 0xf1fc4}, {0xf1fc6, 0xf1fd3}, {0xf1fd6, 0xf1fdb}, {0xf1fdd, 0xf1fef}, - {0xf1ff2, 0xf1ff4}, {0xf1ff6, 0xf1ffe}, {0xf2010, 0xf2027}, {0xf2030, 0xf205e}, - {0xf2074, 0xf208e}, {0xf2090, 0xf209c}, {0xf20a0, 0xf20bf}, {0xf20d0, 0xf20f0}, - {0xf2100, 0xf218b}, {0xf2190, 0xf2426}, {0xf2440, 0xf244a}, {0xf2460, 0xf2b73}, - {0xf2b76, 0xf2b95}, {0xf2b98, 0xf2bb9}, {0xf2bbd, 0xf2bc8}, {0xf2bca, 0xf2bd2}, - {0xf2bec, 0xf2bef}, {0xf2c00, 0xf2c2e}, {0xf2c30, 0xf2c5e}, {0xf2c60, 0xf2cf3}, - {0xf2cf9, 0xf2d25}, {0xf2d30, 0xf2d67}, {0xf2d7f, 0xf2d96}, {0xf2da0, 0xf2da6}, - {0xf2da8, 0xf2dae}, {0xf2db0, 0xf2db6}, {0xf2db8, 0xf2dbe}, {0xf2dc0, 0xf2dc6}, - {0xf2dc8, 0xf2dce}, {0xf2dd0, 0xf2dd6}, {0xf2dd8, 0xf2dde}, {0xf2de0, 0xf2e49}, - {0xf2e80, 0xf2e99}, {0xf2e9b, 0xf2ef3}, {0xf2f00, 0xf2fd5}, {0xf2ff0, 0xf2ffb}, - {0xf3001, 0xf303f}, {0xf3041, 0xf3096}, {0xf3099, 0xf30ff}, {0xf3105, 0xf312e}, - {0xf3131, 0xf318e}, {0xf3190, 0xf31ba}, {0xf31c0, 0xf31e3}, {0xf31f0, 0xf321e}, - {0xf3220, 0xf32fe}, {0xf3300, 0xf4db5}, {0xf4dc0, 0xf9fea}, {0xfa000, 0xfa48c}, - {0xfa490, 0xfa4c6}, {0xfa4d0, 0xfa62b}, {0xfa640, 0xfa6f7}, {0xfa700, 0xfa7ae}, - {0xfa7b0, 0xfa7b7}, {0xfa7f7, 0xfa82b}, {0xfa830, 0xfa839}, {0xfa840, 0xfa877}, - {0xfa880, 0xfa8c5}, {0xfa8ce, 0xfa8d9}, {0xfa8e0, 0xfa8fd}, {0xfa900, 0xfa953}, - {0xfa95f, 0xfa97c}, {0xfa980, 0xfa9cd}, {0xfa9cf, 0xfa9d9}, {0xfa9de, 0xfa9fe}, - {0xfaa00, 0xfaa36}, {0xfaa40, 0xfaa4d}, {0xfaa50, 0xfaa59}, {0xfaa5c, 0xfaac2}, - {0xfaadb, 0xfaaf6}, {0xfab01, 0xfab06}, {0xfab09, 0xfab0e}, {0xfab11, 0xfab16}, - {0xfab20, 0xfab26}, {0xfab28, 0xfab2e}, {0xfab30, 0xfab65}, {0xfab70, 0xfabed}, - {0xfabf0, 0xfabf9}, {0xfac00, 0xfd7a3}, {0xfd7b0, 0xfd7c6}, {0xfd7cb, 0xfd7fb}, - {0xff900, 0xffa6d}, {0xffa70, 0xffad9}, {0xffb00, 0xffb06}, {0xffb13, 0xffb17}, - {0xffb1d, 0xffb36}, {0xffb38, 0xffb3c}, {0xffb46, 0xffbc1}, {0xffbd3, 0xffd3f}, - {0xffd50, 0xffd8f}, {0xffd92, 0xffdc7}, {0xffdf0, 0xffdfd}, {0xffe00, 0xffe19}, - {0xffe20, 0xffe52}, {0xffe54, 0xffe66}, {0xffe68, 0xffe6b}, {0xffe70, 0xffe74}, - {0xffe76, 0xffefc}, {0xfff01, 0xfffbe}, {0xfffc2, 0xfffc7}, {0xfffca, 0xfffcf}, - {0xfffd2, 0xfffd7}, {0xfffda, 0xfffdc}, {0xfffe0, 0xfffe6}, {0xfffe8, 0xfffee}, - {0x100021, 0x10007e}, {0x1000a1, 0x1000ac}, {0x1000ae, 0x100377}, {0x10037a, 0x10037f}, - {0x100384, 0x10038a}, {0x10038e, 0x1003a1}, {0x1003a3, 0x10052f}, {0x100531, 0x100556}, - {0x100559, 0x10055f}, {0x100561, 0x100587}, {0x10058d, 0x10058f}, {0x100591, 0x1005c7}, - {0x1005d0, 0x1005ea}, {0x1005f0, 0x1005f4}, {0x100606, 0x10061b}, {0x10061e, 0x1006dc}, - {0x1006de, 0x10070d}, {0x100710, 0x10074a}, {0x10074d, 0x1007b1}, {0x1007c0, 0x1007fa}, - {0x100800, 0x10082d}, {0x100830, 0x10083e}, {0x100840, 0x10085b}, {0x100860, 0x10086a}, - {0x1008a0, 0x1008b4}, {0x1008b6, 0x1008bd}, {0x1008d4, 0x1008e1}, {0x1008e3, 0x100983}, - {0x100985, 0x10098c}, {0x100993, 0x1009a8}, {0x1009aa, 0x1009b0}, {0x1009b6, 0x1009b9}, - {0x1009bc, 0x1009c4}, {0x1009cb, 0x1009ce}, {0x1009df, 0x1009e3}, {0x1009e6, 0x1009fd}, - {0x100a01, 0x100a03}, {0x100a05, 0x100a0a}, {0x100a13, 0x100a28}, {0x100a2a, 0x100a30}, - {0x100a3e, 0x100a42}, {0x100a4b, 0x100a4d}, {0x100a59, 0x100a5c}, {0x100a66, 0x100a75}, - {0x100a81, 0x100a83}, {0x100a85, 0x100a8d}, {0x100a8f, 0x100a91}, {0x100a93, 0x100aa8}, - {0x100aaa, 0x100ab0}, {0x100ab5, 0x100ab9}, {0x100abc, 0x100ac5}, {0x100ac7, 0x100ac9}, - {0x100acb, 0x100acd}, {0x100ae0, 0x100ae3}, {0x100ae6, 0x100af1}, {0x100af9, 0x100aff}, - {0x100b01, 0x100b03}, {0x100b05, 0x100b0c}, {0x100b13, 0x100b28}, {0x100b2a, 0x100b30}, - {0x100b35, 0x100b39}, {0x100b3c, 0x100b44}, {0x100b4b, 0x100b4d}, {0x100b5f, 0x100b63}, - {0x100b66, 0x100b77}, {0x100b85, 0x100b8a}, {0x100b8e, 0x100b90}, {0x100b92, 0x100b95}, - {0x100ba8, 0x100baa}, {0x100bae, 0x100bb9}, {0x100bbe, 0x100bc2}, {0x100bc6, 0x100bc8}, - {0x100bca, 0x100bcd}, {0x100be6, 0x100bfa}, {0x100c00, 0x100c03}, {0x100c05, 0x100c0c}, - {0x100c0e, 0x100c10}, {0x100c12, 0x100c28}, {0x100c2a, 0x100c39}, {0x100c3d, 0x100c44}, - {0x100c46, 0x100c48}, {0x100c4a, 0x100c4d}, {0x100c58, 0x100c5a}, {0x100c60, 0x100c63}, - {0x100c66, 0x100c6f}, {0x100c78, 0x100c83}, {0x100c85, 0x100c8c}, {0x100c8e, 0x100c90}, - {0x100c92, 0x100ca8}, {0x100caa, 0x100cb3}, {0x100cb5, 0x100cb9}, {0x100cbc, 0x100cc4}, - {0x100cc6, 0x100cc8}, {0x100cca, 0x100ccd}, {0x100ce0, 0x100ce3}, {0x100ce6, 0x100cef}, - {0x100d00, 0x100d03}, {0x100d05, 0x100d0c}, {0x100d0e, 0x100d10}, {0x100d12, 0x100d44}, - {0x100d46, 0x100d48}, {0x100d4a, 0x100d4f}, {0x100d54, 0x100d63}, {0x100d66, 0x100d7f}, - {0x100d85, 0x100d96}, {0x100d9a, 0x100db1}, {0x100db3, 0x100dbb}, {0x100dc0, 0x100dc6}, - {0x100dcf, 0x100dd4}, {0x100dd8, 0x100ddf}, {0x100de6, 0x100def}, {0x100df2, 0x100df4}, - {0x100e01, 0x100e3a}, {0x100e3f, 0x100e5b}, {0x100e94, 0x100e97}, {0x100e99, 0x100e9f}, - {0x100ea1, 0x100ea3}, {0x100ead, 0x100eb9}, {0x100ebb, 0x100ebd}, {0x100ec0, 0x100ec4}, - {0x100ec8, 0x100ecd}, {0x100ed0, 0x100ed9}, {0x100edc, 0x100edf}, {0x100f00, 0x100f47}, - {0x100f49, 0x100f6c}, {0x100f71, 0x100f97}, {0x100f99, 0x100fbc}, {0x100fbe, 0x100fcc}, - {0x100fce, 0x100fda}, {0x101000, 0x1010c5}, {0x1010d0, 0x101248}, {0x10124a, 0x10124d}, - {0x101250, 0x101256}, {0x10125a, 0x10125d}, {0x101260, 0x101288}, {0x10128a, 0x10128d}, - {0x101290, 0x1012b0}, {0x1012b2, 0x1012b5}, {0x1012b8, 0x1012be}, {0x1012c2, 0x1012c5}, - {0x1012c8, 0x1012d6}, {0x1012d8, 0x101310}, {0x101312, 0x101315}, {0x101318, 0x10135a}, - {0x10135d, 0x10137c}, {0x101380, 0x101399}, {0x1013a0, 0x1013f5}, {0x1013f8, 0x1013fd}, - {0x101400, 0x10167f}, {0x101681, 0x10169c}, {0x1016a0, 0x1016f8}, {0x101700, 0x10170c}, - {0x10170e, 0x101714}, {0x101720, 0x101736}, {0x101740, 0x101753}, {0x101760, 0x10176c}, - {0x10176e, 0x101770}, {0x101780, 0x1017dd}, {0x1017e0, 0x1017e9}, {0x1017f0, 0x1017f9}, - {0x101800, 0x10180d}, {0x101810, 0x101819}, {0x101820, 0x101877}, {0x101880, 0x1018aa}, - {0x1018b0, 0x1018f5}, {0x101900, 0x10191e}, {0x101920, 0x10192b}, {0x101930, 0x10193b}, - {0x101944, 0x10196d}, {0x101970, 0x101974}, {0x101980, 0x1019ab}, {0x1019b0, 0x1019c9}, - {0x1019d0, 0x1019da}, {0x1019de, 0x101a1b}, {0x101a1e, 0x101a5e}, {0x101a60, 0x101a7c}, - {0x101a7f, 0x101a89}, {0x101a90, 0x101a99}, {0x101aa0, 0x101aad}, {0x101ab0, 0x101abe}, - {0x101b00, 0x101b4b}, {0x101b50, 0x101b7c}, {0x101b80, 0x101bf3}, {0x101bfc, 0x101c37}, - {0x101c3b, 0x101c49}, {0x101c4d, 0x101c88}, {0x101cc0, 0x101cc7}, {0x101cd0, 0x101cf9}, - {0x101d00, 0x101df9}, {0x101dfb, 0x101f15}, {0x101f18, 0x101f1d}, {0x101f20, 0x101f45}, - {0x101f48, 0x101f4d}, {0x101f50, 0x101f57}, {0x101f5f, 0x101f7d}, {0x101f80, 0x101fb4}, - {0x101fb6, 0x101fc4}, {0x101fc6, 0x101fd3}, {0x101fd6, 0x101fdb}, {0x101fdd, 0x101fef}, - {0x101ff2, 0x101ff4}, {0x101ff6, 0x101ffe}, {0x102010, 0x102027}, {0x102030, 0x10205e}, - {0x102074, 0x10208e}, {0x102090, 0x10209c}, {0x1020a0, 0x1020bf}, {0x1020d0, 0x1020f0}, - {0x102100, 0x10218b}, {0x102190, 0x102426}, {0x102440, 0x10244a}, {0x102460, 0x102b73}, - {0x102b76, 0x102b95}, {0x102b98, 0x102bb9}, {0x102bbd, 0x102bc8}, {0x102bca, 0x102bd2}, - {0x102bec, 0x102bef}, {0x102c00, 0x102c2e}, {0x102c30, 0x102c5e}, {0x102c60, 0x102cf3}, - {0x102cf9, 0x102d25}, {0x102d30, 0x102d67}, {0x102d7f, 0x102d96}, {0x102da0, 0x102da6}, - {0x102da8, 0x102dae}, {0x102db0, 0x102db6}, {0x102db8, 0x102dbe}, {0x102dc0, 0x102dc6}, - {0x102dc8, 0x102dce}, {0x102dd0, 0x102dd6}, {0x102dd8, 0x102dde}, {0x102de0, 0x102e49}, - {0x102e80, 0x102e99}, {0x102e9b, 0x102ef3}, {0x102f00, 0x102fd5}, {0x102ff0, 0x102ffb}, - {0x103001, 0x10303f}, {0x103041, 0x103096}, {0x103099, 0x1030ff}, {0x103105, 0x10312e}, - {0x103131, 0x10318e}, {0x103190, 0x1031ba}, {0x1031c0, 0x1031e3}, {0x1031f0, 0x10321e}, - {0x103220, 0x1032fe}, {0x103300, 0x104db5}, {0x104dc0, 0x109fea}, {0x10a000, 0x10a48c}, - {0x10a490, 0x10a4c6}, {0x10a4d0, 0x10a62b}, {0x10a640, 0x10a6f7}, {0x10a700, 0x10a7ae}, - {0x10a7b0, 0x10a7b7}, {0x10a7f7, 0x10a82b}, {0x10a830, 0x10a839}, {0x10a840, 0x10a877}, - {0x10a880, 0x10a8c5}, {0x10a8ce, 0x10a8d9}, {0x10a8e0, 0x10a8fd}, {0x10a900, 0x10a953}, - {0x10a95f, 0x10a97c}, {0x10a980, 0x10a9cd}, {0x10a9cf, 0x10a9d9}, {0x10a9de, 0x10a9fe}, - {0x10aa00, 0x10aa36}, {0x10aa40, 0x10aa4d}, {0x10aa50, 0x10aa59}, {0x10aa5c, 0x10aac2}, - {0x10aadb, 0x10aaf6}, {0x10ab01, 0x10ab06}, {0x10ab09, 0x10ab0e}, {0x10ab11, 0x10ab16}, - {0x10ab20, 0x10ab26}, {0x10ab28, 0x10ab2e}, {0x10ab30, 0x10ab65}, {0x10ab70, 0x10abed}, - {0x10abf0, 0x10abf9}, {0x10ac00, 0x10d7a3}, {0x10d7b0, 0x10d7c6}, {0x10d7cb, 0x10d7fb}, - {0x10f900, 0x10fa6d}, {0x10fa70, 0x10fad9}, {0x10fb00, 0x10fb06}, {0x10fb13, 0x10fb17}, - {0x10fb1d, 0x10fb36}, {0x10fb38, 0x10fb3c}, {0x10fb46, 0x10fbc1}, {0x10fbd3, 0x10fd3f}, - {0x10fd50, 0x10fd8f}, {0x10fd92, 0x10fdc7}, {0x10fdf0, 0x10fdfd}, {0x10fe00, 0x10fe19}, - {0x10fe20, 0x10fe52}, {0x10fe54, 0x10fe66}, {0x10fe68, 0x10fe6b}, {0x10fe70, 0x10fe74}, - {0x10fe76, 0x10fefc}, {0x10ff01, 0x10ffbe}, {0x10ffc2, 0x10ffc7}, {0x10ffca, 0x10ffcf}, - {0x10ffd2, 0x10ffd7}, {0x10ffda, 0x10ffdc}, {0x10ffe0, 0x10ffe6}, {0x10ffe8, 0x10ffee} + ,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d}, + {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10100, 0x10102}, {0x10107, 0x10133}, + {0x10137, 0x1018e}, {0x10190, 0x1019b}, {0x101d0, 0x101fd}, {0x10280, 0x1029c}, + {0x102a0, 0x102d0}, {0x102e0, 0x102fb}, {0x10300, 0x10323}, {0x1032d, 0x1034a}, + {0x10350, 0x1037a}, {0x10380, 0x1039d}, {0x1039f, 0x103c3}, {0x103c8, 0x103d5}, + {0x10400, 0x1049d}, {0x104a0, 0x104a9}, {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, + {0x10500, 0x10527}, {0x10530, 0x10563}, {0x10600, 0x10736}, {0x10740, 0x10755}, + {0x10760, 0x10767}, {0x10800, 0x10805}, {0x1080a, 0x10835}, {0x1083f, 0x10855}, + {0x10857, 0x1089e}, {0x108a7, 0x108af}, {0x108e0, 0x108f2}, {0x108fb, 0x1091b}, + {0x1091f, 0x10939}, {0x10980, 0x109b7}, {0x109bc, 0x109cf}, {0x109d2, 0x10a03}, + {0x10a0c, 0x10a13}, {0x10a15, 0x10a17}, {0x10a19, 0x10a33}, {0x10a38, 0x10a3a}, + {0x10a3f, 0x10a47}, {0x10a50, 0x10a58}, {0x10a60, 0x10a9f}, {0x10ac0, 0x10ae6}, + {0x10aeb, 0x10af6}, {0x10b00, 0x10b35}, {0x10b39, 0x10b55}, {0x10b58, 0x10b72}, + {0x10b78, 0x10b91}, {0x10b99, 0x10b9c}, {0x10ba9, 0x10baf}, {0x10c00, 0x10c48}, + {0x10c80, 0x10cb2}, {0x10cc0, 0x10cf2}, {0x10cfa, 0x10cff}, {0x10e60, 0x10e7e}, + {0x11000, 0x1104d}, {0x11052, 0x1106f}, {0x1107f, 0x110bc}, {0x110be, 0x110c1}, + {0x110d0, 0x110e8}, {0x110f0, 0x110f9}, {0x11100, 0x11134}, {0x11136, 0x11143}, + {0x11150, 0x11176}, {0x11180, 0x111cd}, {0x111d0, 0x111df}, {0x111e1, 0x111f4}, + {0x11200, 0x11211}, {0x11213, 0x1123e}, {0x11280, 0x11286}, {0x1128a, 0x1128d}, + {0x1128f, 0x1129d}, {0x1129f, 0x112a9}, {0x112b0, 0x112ea}, {0x112f0, 0x112f9}, + {0x11300, 0x11303}, {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, + {0x11335, 0x11339}, {0x1133c, 0x11344}, {0x1134b, 0x1134d}, {0x1135d, 0x11363}, + {0x11366, 0x1136c}, {0x11370, 0x11374}, {0x11400, 0x11459}, {0x11480, 0x114c7}, + {0x114d0, 0x114d9}, {0x11580, 0x115b5}, {0x115b8, 0x115dd}, {0x11600, 0x11644}, + {0x11650, 0x11659}, {0x11660, 0x1166c}, {0x11680, 0x116b7}, {0x116c0, 0x116c9}, + {0x11700, 0x11719}, {0x1171d, 0x1172b}, {0x11730, 0x1173f}, {0x118a0, 0x118f2}, + {0x11a00, 0x11a47}, {0x11a50, 0x11a83}, {0x11a86, 0x11a9c}, {0x11a9e, 0x11aa2}, + {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, {0x11c0a, 0x11c36}, {0x11c38, 0x11c45}, + {0x11c50, 0x11c6c}, {0x11c70, 0x11c8f}, {0x11c92, 0x11ca7}, {0x11ca9, 0x11cb6}, + {0x11d00, 0x11d06}, {0x11d0b, 0x11d36}, {0x11d3f, 0x11d47}, {0x11d50, 0x11d59}, + {0x12000, 0x12399}, {0x12400, 0x1246e}, {0x12470, 0x12474}, {0x12480, 0x12543}, + {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e}, + {0x16a60, 0x16a69}, {0x16ad0, 0x16aed}, {0x16af0, 0x16af5}, {0x16b00, 0x16b45}, + {0x16b50, 0x16b59}, {0x16b5b, 0x16b61}, {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, + {0x16f00, 0x16f44}, {0x16f50, 0x16f7e}, {0x16f8f, 0x16f9f}, {0x17000, 0x187ec}, + {0x18800, 0x18af2}, {0x1b000, 0x1b11e}, {0x1b170, 0x1b2fb}, {0x1bc00, 0x1bc6a}, + {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99}, {0x1bc9c, 0x1bc9f}, + {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d129, 0x1d172}, {0x1d17b, 0x1d1e8}, + {0x1d200, 0x1d245}, {0x1d300, 0x1d356}, {0x1d360, 0x1d371}, {0x1d400, 0x1d454}, + {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, + {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, + {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, + {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d7cb}, {0x1d7ce, 0x1da8b}, {0x1da9b, 0x1da9f}, + {0x1daa1, 0x1daaf}, {0x1e000, 0x1e006}, {0x1e008, 0x1e018}, {0x1e01b, 0x1e021}, + {0x1e026, 0x1e02a}, {0x1e800, 0x1e8c4}, {0x1e8c7, 0x1e8d6}, {0x1e900, 0x1e94a}, + {0x1e950, 0x1e959}, {0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, + {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, + {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, + {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb}, {0x1f000, 0x1f02b}, + {0x1f030, 0x1f093}, {0x1f0a0, 0x1f0ae}, {0x1f0b1, 0x1f0bf}, {0x1f0c1, 0x1f0cf}, + {0x1f0d1, 0x1f0f5}, {0x1f100, 0x1f10c}, {0x1f110, 0x1f12e}, {0x1f130, 0x1f16b}, + {0x1f170, 0x1f1ac}, {0x1f1e6, 0x1f202}, {0x1f210, 0x1f23b}, {0x1f240, 0x1f248}, + {0x1f260, 0x1f265}, {0x1f300, 0x1f6d4}, {0x1f6e0, 0x1f6ec}, {0x1f6f0, 0x1f6f8}, + {0x1f700, 0x1f773}, {0x1f780, 0x1f7d4}, {0x1f800, 0x1f80b}, {0x1f810, 0x1f847}, + {0x1f850, 0x1f859}, {0x1f860, 0x1f887}, {0x1f890, 0x1f8ad}, {0x1f900, 0x1f90b}, + {0x1f910, 0x1f93e}, {0x1f940, 0x1f94c}, {0x1f950, 0x1f96b}, {0x1f980, 0x1f997}, + {0x1f9d0, 0x1f9e6}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d}, + {0x2b820, 0x2cea1}, {0x2ceb0, 0x2ebe0}, {0x2f800, 0x2fa1d}, {0xe0100, 0xe01ef} #endif }; @@ -6185,177 +771,14 @@ static const chr graphCharTable[] = { 0x1f5b, 0x1f5d, 0x2070, 0x2071, 0x2d27, 0x2d2d, 0x2d6f, 0x2d70, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc, 0xfffd #if TCL_UTF_MAX > 4 - ,0x1038c, 0x10589, 0x1058a, 0x1085e, 0x1098f, 0x10990, 0x109b2, 0x109c7, 0x109c8, - 0x109d7, 0x109dc, 0x109dd, 0x10a0f, 0x10a10, 0x10a32, 0x10a33, 0x10a35, 0x10a36, - 0x10a38, 0x10a39, 0x10a3c, 0x10a47, 0x10a48, 0x10a51, 0x10a5e, 0x10ab2, 0x10ab3, - 0x10ad0, 0x10b0f, 0x10b10, 0x10b32, 0x10b33, 0x10b47, 0x10b48, 0x10b56, 0x10b57, - 0x10b5c, 0x10b5d, 0x10b82, 0x10b83, 0x10b99, 0x10b9a, 0x10b9c, 0x10b9e, 0x10b9f, - 0x10ba3, 0x10ba4, 0x10bd0, 0x10bd7, 0x10c55, 0x10c56, 0x10cd5, 0x10cd6, 0x10cde, - 0x10cf1, 0x10cf2, 0x10d82, 0x10d83, 0x10dbd, 0x10dca, 0x10dd6, 0x10e81, 0x10e82, - 0x10e84, 0x10e87, 0x10e88, 0x10e8a, 0x10e8d, 0x10ea5, 0x10ea7, 0x10eaa, 0x10eab, - 0x10ec6, 0x110c7, 0x110cd, 0x11258, 0x112c0, 0x11772, 0x11773, 0x11940, 0x11f59, - 0x11f5b, 0x11f5d, 0x12070, 0x12071, 0x12d27, 0x12d2d, 0x12d6f, 0x12d70, 0x1fb3e, - 0x1fb40, 0x1fb41, 0x1fb43, 0x1fb44, 0x1fffc, 0x1fffd, 0x2038c, 0x20589, 0x2058a, - 0x2085e, 0x2098f, 0x20990, 0x209b2, 0x209c7, 0x209c8, 0x209d7, 0x209dc, 0x209dd, - 0x20a0f, 0x20a10, 0x20a32, 0x20a33, 0x20a35, 0x20a36, 0x20a38, 0x20a39, 0x20a3c, - 0x20a47, 0x20a48, 0x20a51, 0x20a5e, 0x20ab2, 0x20ab3, 0x20ad0, 0x20b0f, 0x20b10, - 0x20b32, 0x20b33, 0x20b47, 0x20b48, 0x20b56, 0x20b57, 0x20b5c, 0x20b5d, 0x20b82, - 0x20b83, 0x20b99, 0x20b9a, 0x20b9c, 0x20b9e, 0x20b9f, 0x20ba3, 0x20ba4, 0x20bd0, - 0x20bd7, 0x20c55, 0x20c56, 0x20cd5, 0x20cd6, 0x20cde, 0x20cf1, 0x20cf2, 0x20d82, - 0x20d83, 0x20dbd, 0x20dca, 0x20dd6, 0x20e81, 0x20e82, 0x20e84, 0x20e87, 0x20e88, - 0x20e8a, 0x20e8d, 0x20ea5, 0x20ea7, 0x20eaa, 0x20eab, 0x20ec6, 0x210c7, 0x210cd, - 0x21258, 0x212c0, 0x21772, 0x21773, 0x21940, 0x21f59, 0x21f5b, 0x21f5d, 0x22070, - 0x22071, 0x22d27, 0x22d2d, 0x22d6f, 0x22d70, 0x2fb3e, 0x2fb40, 0x2fb41, 0x2fb43, - 0x2fb44, 0x2fffc, 0x2fffd, 0x3038c, 0x30589, 0x3058a, 0x3085e, 0x3098f, 0x30990, - 0x309b2, 0x309c7, 0x309c8, 0x309d7, 0x309dc, 0x309dd, 0x30a0f, 0x30a10, 0x30a32, - 0x30a33, 0x30a35, 0x30a36, 0x30a38, 0x30a39, 0x30a3c, 0x30a47, 0x30a48, 0x30a51, - 0x30a5e, 0x30ab2, 0x30ab3, 0x30ad0, 0x30b0f, 0x30b10, 0x30b32, 0x30b33, 0x30b47, - 0x30b48, 0x30b56, 0x30b57, 0x30b5c, 0x30b5d, 0x30b82, 0x30b83, 0x30b99, 0x30b9a, - 0x30b9c, 0x30b9e, 0x30b9f, 0x30ba3, 0x30ba4, 0x30bd0, 0x30bd7, 0x30c55, 0x30c56, - 0x30cd5, 0x30cd6, 0x30cde, 0x30cf1, 0x30cf2, 0x30d82, 0x30d83, 0x30dbd, 0x30dca, - 0x30dd6, 0x30e81, 0x30e82, 0x30e84, 0x30e87, 0x30e88, 0x30e8a, 0x30e8d, 0x30ea5, - 0x30ea7, 0x30eaa, 0x30eab, 0x30ec6, 0x310c7, 0x310cd, 0x31258, 0x312c0, 0x31772, - 0x31773, 0x31940, 0x31f59, 0x31f5b, 0x31f5d, 0x32070, 0x32071, 0x32d27, 0x32d2d, - 0x32d6f, 0x32d70, 0x3fb3e, 0x3fb40, 0x3fb41, 0x3fb43, 0x3fb44, 0x3fffc, 0x3fffd, - 0x4038c, 0x40589, 0x4058a, 0x4085e, 0x4098f, 0x40990, 0x409b2, 0x409c7, 0x409c8, - 0x409d7, 0x409dc, 0x409dd, 0x40a0f, 0x40a10, 0x40a32, 0x40a33, 0x40a35, 0x40a36, - 0x40a38, 0x40a39, 0x40a3c, 0x40a47, 0x40a48, 0x40a51, 0x40a5e, 0x40ab2, 0x40ab3, - 0x40ad0, 0x40b0f, 0x40b10, 0x40b32, 0x40b33, 0x40b47, 0x40b48, 0x40b56, 0x40b57, - 0x40b5c, 0x40b5d, 0x40b82, 0x40b83, 0x40b99, 0x40b9a, 0x40b9c, 0x40b9e, 0x40b9f, - 0x40ba3, 0x40ba4, 0x40bd0, 0x40bd7, 0x40c55, 0x40c56, 0x40cd5, 0x40cd6, 0x40cde, - 0x40cf1, 0x40cf2, 0x40d82, 0x40d83, 0x40dbd, 0x40dca, 0x40dd6, 0x40e81, 0x40e82, - 0x40e84, 0x40e87, 0x40e88, 0x40e8a, 0x40e8d, 0x40ea5, 0x40ea7, 0x40eaa, 0x40eab, - 0x40ec6, 0x410c7, 0x410cd, 0x41258, 0x412c0, 0x41772, 0x41773, 0x41940, 0x41f59, - 0x41f5b, 0x41f5d, 0x42070, 0x42071, 0x42d27, 0x42d2d, 0x42d6f, 0x42d70, 0x4fb3e, - 0x4fb40, 0x4fb41, 0x4fb43, 0x4fb44, 0x4fffc, 0x4fffd, 0x5038c, 0x50589, 0x5058a, - 0x5085e, 0x5098f, 0x50990, 0x509b2, 0x509c7, 0x509c8, 0x509d7, 0x509dc, 0x509dd, - 0x50a0f, 0x50a10, 0x50a32, 0x50a33, 0x50a35, 0x50a36, 0x50a38, 0x50a39, 0x50a3c, - 0x50a47, 0x50a48, 0x50a51, 0x50a5e, 0x50ab2, 0x50ab3, 0x50ad0, 0x50b0f, 0x50b10, - 0x50b32, 0x50b33, 0x50b47, 0x50b48, 0x50b56, 0x50b57, 0x50b5c, 0x50b5d, 0x50b82, - 0x50b83, 0x50b99, 0x50b9a, 0x50b9c, 0x50b9e, 0x50b9f, 0x50ba3, 0x50ba4, 0x50bd0, - 0x50bd7, 0x50c55, 0x50c56, 0x50cd5, 0x50cd6, 0x50cde, 0x50cf1, 0x50cf2, 0x50d82, - 0x50d83, 0x50dbd, 0x50dca, 0x50dd6, 0x50e81, 0x50e82, 0x50e84, 0x50e87, 0x50e88, - 0x50e8a, 0x50e8d, 0x50ea5, 0x50ea7, 0x50eaa, 0x50eab, 0x50ec6, 0x510c7, 0x510cd, - 0x51258, 0x512c0, 0x51772, 0x51773, 0x51940, 0x51f59, 0x51f5b, 0x51f5d, 0x52070, - 0x52071, 0x52d27, 0x52d2d, 0x52d6f, 0x52d70, 0x5fb3e, 0x5fb40, 0x5fb41, 0x5fb43, - 0x5fb44, 0x5fffc, 0x5fffd, 0x6038c, 0x60589, 0x6058a, 0x6085e, 0x6098f, 0x60990, - 0x609b2, 0x609c7, 0x609c8, 0x609d7, 0x609dc, 0x609dd, 0x60a0f, 0x60a10, 0x60a32, - 0x60a33, 0x60a35, 0x60a36, 0x60a38, 0x60a39, 0x60a3c, 0x60a47, 0x60a48, 0x60a51, - 0x60a5e, 0x60ab2, 0x60ab3, 0x60ad0, 0x60b0f, 0x60b10, 0x60b32, 0x60b33, 0x60b47, - 0x60b48, 0x60b56, 0x60b57, 0x60b5c, 0x60b5d, 0x60b82, 0x60b83, 0x60b99, 0x60b9a, - 0x60b9c, 0x60b9e, 0x60b9f, 0x60ba3, 0x60ba4, 0x60bd0, 0x60bd7, 0x60c55, 0x60c56, - 0x60cd5, 0x60cd6, 0x60cde, 0x60cf1, 0x60cf2, 0x60d82, 0x60d83, 0x60dbd, 0x60dca, - 0x60dd6, 0x60e81, 0x60e82, 0x60e84, 0x60e87, 0x60e88, 0x60e8a, 0x60e8d, 0x60ea5, - 0x60ea7, 0x60eaa, 0x60eab, 0x60ec6, 0x610c7, 0x610cd, 0x61258, 0x612c0, 0x61772, - 0x61773, 0x61940, 0x61f59, 0x61f5b, 0x61f5d, 0x62070, 0x62071, 0x62d27, 0x62d2d, - 0x62d6f, 0x62d70, 0x6fb3e, 0x6fb40, 0x6fb41, 0x6fb43, 0x6fb44, 0x6fffc, 0x6fffd, - 0x7038c, 0x70589, 0x7058a, 0x7085e, 0x7098f, 0x70990, 0x709b2, 0x709c7, 0x709c8, - 0x709d7, 0x709dc, 0x709dd, 0x70a0f, 0x70a10, 0x70a32, 0x70a33, 0x70a35, 0x70a36, - 0x70a38, 0x70a39, 0x70a3c, 0x70a47, 0x70a48, 0x70a51, 0x70a5e, 0x70ab2, 0x70ab3, - 0x70ad0, 0x70b0f, 0x70b10, 0x70b32, 0x70b33, 0x70b47, 0x70b48, 0x70b56, 0x70b57, - 0x70b5c, 0x70b5d, 0x70b82, 0x70b83, 0x70b99, 0x70b9a, 0x70b9c, 0x70b9e, 0x70b9f, - 0x70ba3, 0x70ba4, 0x70bd0, 0x70bd7, 0x70c55, 0x70c56, 0x70cd5, 0x70cd6, 0x70cde, - 0x70cf1, 0x70cf2, 0x70d82, 0x70d83, 0x70dbd, 0x70dca, 0x70dd6, 0x70e81, 0x70e82, - 0x70e84, 0x70e87, 0x70e88, 0x70e8a, 0x70e8d, 0x70ea5, 0x70ea7, 0x70eaa, 0x70eab, - 0x70ec6, 0x710c7, 0x710cd, 0x71258, 0x712c0, 0x71772, 0x71773, 0x71940, 0x71f59, - 0x71f5b, 0x71f5d, 0x72070, 0x72071, 0x72d27, 0x72d2d, 0x72d6f, 0x72d70, 0x7fb3e, - 0x7fb40, 0x7fb41, 0x7fb43, 0x7fb44, 0x7fffc, 0x7fffd, 0x8038c, 0x80589, 0x8058a, - 0x8085e, 0x8098f, 0x80990, 0x809b2, 0x809c7, 0x809c8, 0x809d7, 0x809dc, 0x809dd, - 0x80a0f, 0x80a10, 0x80a32, 0x80a33, 0x80a35, 0x80a36, 0x80a38, 0x80a39, 0x80a3c, - 0x80a47, 0x80a48, 0x80a51, 0x80a5e, 0x80ab2, 0x80ab3, 0x80ad0, 0x80b0f, 0x80b10, - 0x80b32, 0x80b33, 0x80b47, 0x80b48, 0x80b56, 0x80b57, 0x80b5c, 0x80b5d, 0x80b82, - 0x80b83, 0x80b99, 0x80b9a, 0x80b9c, 0x80b9e, 0x80b9f, 0x80ba3, 0x80ba4, 0x80bd0, - 0x80bd7, 0x80c55, 0x80c56, 0x80cd5, 0x80cd6, 0x80cde, 0x80cf1, 0x80cf2, 0x80d82, - 0x80d83, 0x80dbd, 0x80dca, 0x80dd6, 0x80e81, 0x80e82, 0x80e84, 0x80e87, 0x80e88, - 0x80e8a, 0x80e8d, 0x80ea5, 0x80ea7, 0x80eaa, 0x80eab, 0x80ec6, 0x810c7, 0x810cd, - 0x81258, 0x812c0, 0x81772, 0x81773, 0x81940, 0x81f59, 0x81f5b, 0x81f5d, 0x82070, - 0x82071, 0x82d27, 0x82d2d, 0x82d6f, 0x82d70, 0x8fb3e, 0x8fb40, 0x8fb41, 0x8fb43, - 0x8fb44, 0x8fffc, 0x8fffd, 0x9038c, 0x90589, 0x9058a, 0x9085e, 0x9098f, 0x90990, - 0x909b2, 0x909c7, 0x909c8, 0x909d7, 0x909dc, 0x909dd, 0x90a0f, 0x90a10, 0x90a32, - 0x90a33, 0x90a35, 0x90a36, 0x90a38, 0x90a39, 0x90a3c, 0x90a47, 0x90a48, 0x90a51, - 0x90a5e, 0x90ab2, 0x90ab3, 0x90ad0, 0x90b0f, 0x90b10, 0x90b32, 0x90b33, 0x90b47, - 0x90b48, 0x90b56, 0x90b57, 0x90b5c, 0x90b5d, 0x90b82, 0x90b83, 0x90b99, 0x90b9a, - 0x90b9c, 0x90b9e, 0x90b9f, 0x90ba3, 0x90ba4, 0x90bd0, 0x90bd7, 0x90c55, 0x90c56, - 0x90cd5, 0x90cd6, 0x90cde, 0x90cf1, 0x90cf2, 0x90d82, 0x90d83, 0x90dbd, 0x90dca, - 0x90dd6, 0x90e81, 0x90e82, 0x90e84, 0x90e87, 0x90e88, 0x90e8a, 0x90e8d, 0x90ea5, - 0x90ea7, 0x90eaa, 0x90eab, 0x90ec6, 0x910c7, 0x910cd, 0x91258, 0x912c0, 0x91772, - 0x91773, 0x91940, 0x91f59, 0x91f5b, 0x91f5d, 0x92070, 0x92071, 0x92d27, 0x92d2d, - 0x92d6f, 0x92d70, 0x9fb3e, 0x9fb40, 0x9fb41, 0x9fb43, 0x9fb44, 0x9fffc, 0x9fffd, - 0xa038c, 0xa0589, 0xa058a, 0xa085e, 0xa098f, 0xa0990, 0xa09b2, 0xa09c7, 0xa09c8, - 0xa09d7, 0xa09dc, 0xa09dd, 0xa0a0f, 0xa0a10, 0xa0a32, 0xa0a33, 0xa0a35, 0xa0a36, - 0xa0a38, 0xa0a39, 0xa0a3c, 0xa0a47, 0xa0a48, 0xa0a51, 0xa0a5e, 0xa0ab2, 0xa0ab3, - 0xa0ad0, 0xa0b0f, 0xa0b10, 0xa0b32, 0xa0b33, 0xa0b47, 0xa0b48, 0xa0b56, 0xa0b57, - 0xa0b5c, 0xa0b5d, 0xa0b82, 0xa0b83, 0xa0b99, 0xa0b9a, 0xa0b9c, 0xa0b9e, 0xa0b9f, - 0xa0ba3, 0xa0ba4, 0xa0bd0, 0xa0bd7, 0xa0c55, 0xa0c56, 0xa0cd5, 0xa0cd6, 0xa0cde, - 0xa0cf1, 0xa0cf2, 0xa0d82, 0xa0d83, 0xa0dbd, 0xa0dca, 0xa0dd6, 0xa0e81, 0xa0e82, - 0xa0e84, 0xa0e87, 0xa0e88, 0xa0e8a, 0xa0e8d, 0xa0ea5, 0xa0ea7, 0xa0eaa, 0xa0eab, - 0xa0ec6, 0xa10c7, 0xa10cd, 0xa1258, 0xa12c0, 0xa1772, 0xa1773, 0xa1940, 0xa1f59, - 0xa1f5b, 0xa1f5d, 0xa2070, 0xa2071, 0xa2d27, 0xa2d2d, 0xa2d6f, 0xa2d70, 0xafb3e, - 0xafb40, 0xafb41, 0xafb43, 0xafb44, 0xafffc, 0xafffd, 0xb038c, 0xb0589, 0xb058a, - 0xb085e, 0xb098f, 0xb0990, 0xb09b2, 0xb09c7, 0xb09c8, 0xb09d7, 0xb09dc, 0xb09dd, - 0xb0a0f, 0xb0a10, 0xb0a32, 0xb0a33, 0xb0a35, 0xb0a36, 0xb0a38, 0xb0a39, 0xb0a3c, - 0xb0a47, 0xb0a48, 0xb0a51, 0xb0a5e, 0xb0ab2, 0xb0ab3, 0xb0ad0, 0xb0b0f, 0xb0b10, - 0xb0b32, 0xb0b33, 0xb0b47, 0xb0b48, 0xb0b56, 0xb0b57, 0xb0b5c, 0xb0b5d, 0xb0b82, - 0xb0b83, 0xb0b99, 0xb0b9a, 0xb0b9c, 0xb0b9e, 0xb0b9f, 0xb0ba3, 0xb0ba4, 0xb0bd0, - 0xb0bd7, 0xb0c55, 0xb0c56, 0xb0cd5, 0xb0cd6, 0xb0cde, 0xb0cf1, 0xb0cf2, 0xb0d82, - 0xb0d83, 0xb0dbd, 0xb0dca, 0xb0dd6, 0xb0e81, 0xb0e82, 0xb0e84, 0xb0e87, 0xb0e88, - 0xb0e8a, 0xb0e8d, 0xb0ea5, 0xb0ea7, 0xb0eaa, 0xb0eab, 0xb0ec6, 0xb10c7, 0xb10cd, - 0xb1258, 0xb12c0, 0xb1772, 0xb1773, 0xb1940, 0xb1f59, 0xb1f5b, 0xb1f5d, 0xb2070, - 0xb2071, 0xb2d27, 0xb2d2d, 0xb2d6f, 0xb2d70, 0xbfb3e, 0xbfb40, 0xbfb41, 0xbfb43, - 0xbfb44, 0xbfffc, 0xbfffd, 0xc038c, 0xc0589, 0xc058a, 0xc085e, 0xc098f, 0xc0990, - 0xc09b2, 0xc09c7, 0xc09c8, 0xc09d7, 0xc09dc, 0xc09dd, 0xc0a0f, 0xc0a10, 0xc0a32, - 0xc0a33, 0xc0a35, 0xc0a36, 0xc0a38, 0xc0a39, 0xc0a3c, 0xc0a47, 0xc0a48, 0xc0a51, - 0xc0a5e, 0xc0ab2, 0xc0ab3, 0xc0ad0, 0xc0b0f, 0xc0b10, 0xc0b32, 0xc0b33, 0xc0b47, - 0xc0b48, 0xc0b56, 0xc0b57, 0xc0b5c, 0xc0b5d, 0xc0b82, 0xc0b83, 0xc0b99, 0xc0b9a, - 0xc0b9c, 0xc0b9e, 0xc0b9f, 0xc0ba3, 0xc0ba4, 0xc0bd0, 0xc0bd7, 0xc0c55, 0xc0c56, - 0xc0cd5, 0xc0cd6, 0xc0cde, 0xc0cf1, 0xc0cf2, 0xc0d82, 0xc0d83, 0xc0dbd, 0xc0dca, - 0xc0dd6, 0xc0e81, 0xc0e82, 0xc0e84, 0xc0e87, 0xc0e88, 0xc0e8a, 0xc0e8d, 0xc0ea5, - 0xc0ea7, 0xc0eaa, 0xc0eab, 0xc0ec6, 0xc10c7, 0xc10cd, 0xc1258, 0xc12c0, 0xc1772, - 0xc1773, 0xc1940, 0xc1f59, 0xc1f5b, 0xc1f5d, 0xc2070, 0xc2071, 0xc2d27, 0xc2d2d, - 0xc2d6f, 0xc2d70, 0xcfb3e, 0xcfb40, 0xcfb41, 0xcfb43, 0xcfb44, 0xcfffc, 0xcfffd, - 0xd038c, 0xd0589, 0xd058a, 0xd085e, 0xd098f, 0xd0990, 0xd09b2, 0xd09c7, 0xd09c8, - 0xd09d7, 0xd09dc, 0xd09dd, 0xd0a0f, 0xd0a10, 0xd0a32, 0xd0a33, 0xd0a35, 0xd0a36, - 0xd0a38, 0xd0a39, 0xd0a3c, 0xd0a47, 0xd0a48, 0xd0a51, 0xd0a5e, 0xd0ab2, 0xd0ab3, - 0xd0ad0, 0xd0b0f, 0xd0b10, 0xd0b32, 0xd0b33, 0xd0b47, 0xd0b48, 0xd0b56, 0xd0b57, - 0xd0b5c, 0xd0b5d, 0xd0b82, 0xd0b83, 0xd0b99, 0xd0b9a, 0xd0b9c, 0xd0b9e, 0xd0b9f, - 0xd0ba3, 0xd0ba4, 0xd0bd0, 0xd0bd7, 0xd0c55, 0xd0c56, 0xd0cd5, 0xd0cd6, 0xd0cde, - 0xd0cf1, 0xd0cf2, 0xd0d82, 0xd0d83, 0xd0dbd, 0xd0dca, 0xd0dd6, 0xd0e81, 0xd0e82, - 0xd0e84, 0xd0e87, 0xd0e88, 0xd0e8a, 0xd0e8d, 0xd0ea5, 0xd0ea7, 0xd0eaa, 0xd0eab, - 0xd0ec6, 0xd10c7, 0xd10cd, 0xd1258, 0xd12c0, 0xd1772, 0xd1773, 0xd1940, 0xd1f59, - 0xd1f5b, 0xd1f5d, 0xd2070, 0xd2071, 0xd2d27, 0xd2d2d, 0xd2d6f, 0xd2d70, 0xdfb3e, - 0xdfb40, 0xdfb41, 0xdfb43, 0xdfb44, 0xdfffc, 0xdfffd, 0xe038c, 0xe0589, 0xe058a, - 0xe085e, 0xe098f, 0xe0990, 0xe09b2, 0xe09c7, 0xe09c8, 0xe09d7, 0xe09dc, 0xe09dd, - 0xe0a0f, 0xe0a10, 0xe0a32, 0xe0a33, 0xe0a35, 0xe0a36, 0xe0a38, 0xe0a39, 0xe0a3c, - 0xe0a47, 0xe0a48, 0xe0a51, 0xe0a5e, 0xe0ab2, 0xe0ab3, 0xe0ad0, 0xe0b0f, 0xe0b10, - 0xe0b32, 0xe0b33, 0xe0b47, 0xe0b48, 0xe0b56, 0xe0b57, 0xe0b5c, 0xe0b5d, 0xe0b82, - 0xe0b83, 0xe0b99, 0xe0b9a, 0xe0b9c, 0xe0b9e, 0xe0b9f, 0xe0ba3, 0xe0ba4, 0xe0bd0, - 0xe0bd7, 0xe0c55, 0xe0c56, 0xe0cd5, 0xe0cd6, 0xe0cde, 0xe0cf1, 0xe0cf2, 0xe0d82, - 0xe0d83, 0xe0dbd, 0xe0dca, 0xe0dd6, 0xe0e81, 0xe0e82, 0xe0e84, 0xe0e87, 0xe0e88, - 0xe0e8a, 0xe0e8d, 0xe0ea5, 0xe0ea7, 0xe0eaa, 0xe0eab, 0xe0ec6, 0xe10c7, 0xe10cd, - 0xe1258, 0xe12c0, 0xe1772, 0xe1773, 0xe1940, 0xe1f59, 0xe1f5b, 0xe1f5d, 0xe2070, - 0xe2071, 0xe2d27, 0xe2d2d, 0xe2d6f, 0xe2d70, 0xefb3e, 0xefb40, 0xefb41, 0xefb43, - 0xefb44, 0xefffc, 0xefffd, 0xf038c, 0xf0589, 0xf058a, 0xf085e, 0xf098f, 0xf0990, - 0xf09b2, 0xf09c7, 0xf09c8, 0xf09d7, 0xf09dc, 0xf09dd, 0xf0a0f, 0xf0a10, 0xf0a32, - 0xf0a33, 0xf0a35, 0xf0a36, 0xf0a38, 0xf0a39, 0xf0a3c, 0xf0a47, 0xf0a48, 0xf0a51, - 0xf0a5e, 0xf0ab2, 0xf0ab3, 0xf0ad0, 0xf0b0f, 0xf0b10, 0xf0b32, 0xf0b33, 0xf0b47, - 0xf0b48, 0xf0b56, 0xf0b57, 0xf0b5c, 0xf0b5d, 0xf0b82, 0xf0b83, 0xf0b99, 0xf0b9a, - 0xf0b9c, 0xf0b9e, 0xf0b9f, 0xf0ba3, 0xf0ba4, 0xf0bd0, 0xf0bd7, 0xf0c55, 0xf0c56, - 0xf0cd5, 0xf0cd6, 0xf0cde, 0xf0cf1, 0xf0cf2, 0xf0d82, 0xf0d83, 0xf0dbd, 0xf0dca, - 0xf0dd6, 0xf0e81, 0xf0e82, 0xf0e84, 0xf0e87, 0xf0e88, 0xf0e8a, 0xf0e8d, 0xf0ea5, - 0xf0ea7, 0xf0eaa, 0xf0eab, 0xf0ec6, 0xf10c7, 0xf10cd, 0xf1258, 0xf12c0, 0xf1772, - 0xf1773, 0xf1940, 0xf1f59, 0xf1f5b, 0xf1f5d, 0xf2070, 0xf2071, 0xf2d27, 0xf2d2d, - 0xf2d6f, 0xf2d70, 0xffb3e, 0xffb40, 0xffb41, 0xffb43, 0xffb44, 0xffffc, 0xffffd, - 0x10038c, 0x100589, 0x10058a, 0x10085e, 0x10098f, 0x100990, 0x1009b2, 0x1009c7, 0x1009c8, - 0x1009d7, 0x1009dc, 0x1009dd, 0x100a0f, 0x100a10, 0x100a32, 0x100a33, 0x100a35, 0x100a36, - 0x100a38, 0x100a39, 0x100a3c, 0x100a47, 0x100a48, 0x100a51, 0x100a5e, 0x100ab2, 0x100ab3, - 0x100ad0, 0x100b0f, 0x100b10, 0x100b32, 0x100b33, 0x100b47, 0x100b48, 0x100b56, 0x100b57, - 0x100b5c, 0x100b5d, 0x100b82, 0x100b83, 0x100b99, 0x100b9a, 0x100b9c, 0x100b9e, 0x100b9f, - 0x100ba3, 0x100ba4, 0x100bd0, 0x100bd7, 0x100c55, 0x100c56, 0x100cd5, 0x100cd6, 0x100cde, - 0x100cf1, 0x100cf2, 0x100d82, 0x100d83, 0x100dbd, 0x100dca, 0x100dd6, 0x100e81, 0x100e82, - 0x100e84, 0x100e87, 0x100e88, 0x100e8a, 0x100e8d, 0x100ea5, 0x100ea7, 0x100eaa, 0x100eab, - 0x100ec6, 0x1010c7, 0x1010cd, 0x101258, 0x1012c0, 0x101772, 0x101773, 0x101940, 0x101f59, - 0x101f5b, 0x101f5d, 0x102070, 0x102071, 0x102d27, 0x102d2d, 0x102d6f, 0x102d70, 0x10fb3e, - 0x10fb40, 0x10fb41, 0x10fb43, 0x10fb44, 0x10fffc, 0x10fffd + ,0x1003c, 0x1003d, 0x101a0, 0x1056f, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, + 0x108f5, 0x1093f, 0x10a05, 0x10a06, 0x11288, 0x1130f, 0x11310, 0x11332, 0x11333, + 0x11347, 0x11348, 0x11350, 0x11357, 0x1145b, 0x1145d, 0x118ff, 0x11d08, 0x11d09, + 0x11d3a, 0x11d3c, 0x11d3d, 0x16a6e, 0x16a6f, 0x16fe0, 0x16fe1, 0x1d49e, 0x1d49f, + 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1e023, 0x1e024, 0x1e95e, 0x1e95f, + 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, + 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, + 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e, 0x1eef0, 0x1eef1, 0x1f250, 0x1f251, 0x1f9c0 #endif }; diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 5ed5d5d..088f314 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -21,7 +21,9 @@ #include #include #include +#ifdef HAVE_EVENTFD #include +#endif /* HAVE_EVENTFD */ #include #include -- cgit v0.12 From c688e0737c069a7a0eb18ae41dbea80d5645032d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 2 Jun 2017 08:17:26 +0000 Subject: Fix [67aa9a207037ae67f9014b544c3db34fa732f2dc|67aa9a2070]: Security: Invalid UTF-8 can inject unexpected characters --- generic/tclUtf.c | 12 +++++++++--- tests/encoding.test | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 68119a4..fe47f0b 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -298,7 +298,9 @@ Tcl_UtfToUniChar( */ *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) | (src[1] & 0x3F)); - return 2; + if ((*chPtr == 0) || (*chPtr > 0x7f)) { + return 2; + } } /* @@ -313,7 +315,9 @@ Tcl_UtfToUniChar( *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12) | ((src[1] & 0x3F) << 6) | (src[2] & 0x3F)); - return 3; + if (*chPtr > 0x7ff) { + return 3; + } } /* @@ -330,7 +334,9 @@ Tcl_UtfToUniChar( *chPtr = (Tcl_UniChar) (((byte & 0x0E) << 18) | ((src[1] & 0x3F) << 12) | ((src[2] & 0x3F) << 6) | (src[3] & 0x3F)); - return 4; + if ((*chPtr <= 0x10ffff) && (*chPtr > 0xffff)) { + return 4; + } } /* diff --git a/tests/encoding.test b/tests/encoding.test index 0374e2d..1d8bae5 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -448,6 +448,31 @@ test encoding-24.3 {EscapeFreeProc on open channels} {stdio} { list $count [viewable $line] } [list 3 "\u4e4e\u4e5e\u4e5f (\\u4e4e\\u4e5e\\u4e5f)"] +test encoding-24.4 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc0\x80"] +} 1 +test encoding-24.5 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc0\x81"] +} 2 +test encoding-24.6 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc1\xbf"] +} 2 +test encoding-24.7 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc2\x80"] +} 1 +test encoding-24.8 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xe0\x80\x80"] +} 3 +test encoding-24.9 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xe0\x9f\xbf"] +} 3 +test encoding-24.10 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xe0\xa0\x80"] +} 1 +test encoding-24.10 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xef\xbf\xbf"] +} 1 + file delete [file join [temporaryDirectory] iso2022.txt] # -- cgit v0.12 From 901f58f13be249bb5c70ece3be76324576d5b494 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 2 Jun 2017 10:34:45 +0000 Subject: Change refCount field in DictObj from int to size_t. Cherry-picked from "sebres-8-6-clock-speedup-cr1" branch. --- generic/tclDictObj.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 428173d..87fb333 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -142,7 +142,7 @@ typedef struct Dict { * the entries in the order that they are * created. */ int epoch; /* Epoch counter */ - int refcount; /* Reference counter (see above) */ + size_t refCount; /* Reference counter (see above) */ Tcl_Obj *chain; /* Linked list used for invalidating the * string representations of updated nested * dictionaries. */ @@ -392,7 +392,7 @@ DupDictInternalRep( newDict->epoch = 0; newDict->chain = NULL; - newDict->refcount = 1; + newDict->refCount = 1; /* * Store in the object. @@ -427,8 +427,7 @@ FreeDictInternalRep( { Dict *dict = DICT(dictPtr); - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } dictPtr->typePtr = NULL; @@ -713,7 +712,7 @@ SetDictFromAny( TclFreeIntRep(objPtr); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(objPtr) = dict; objPtr->internalRep.twoPtrValue.ptr2 = NULL; objPtr->typePtr = &tclDictType; @@ -1117,7 +1116,7 @@ Tcl_DictObjFirst( searchPtr->dictionaryPtr = (Tcl_Dict) dict; searchPtr->epoch = dict->epoch; searchPtr->next = cPtr->nextPtr; - dict->refcount++; + dict->refCount++; if (keyPtrPtr != NULL) { *keyPtrPtr = Tcl_GetHashKey(&dict->table, &cPtr->entry); } @@ -1231,8 +1230,7 @@ Tcl_DictObjDone( if (searchPtr->epoch != -1) { searchPtr->epoch = -1; dict = (Dict *) searchPtr->dictionaryPtr; - dict->refcount--; - if (dict->refcount <= 0) { + if (dict->refCount-- <= 1) { DeleteDict(dict); } } @@ -1384,7 +1382,7 @@ Tcl_NewDictObj(void) InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; @@ -1434,7 +1432,7 @@ Tcl_DbNewDictObj( InitChainTable(dict); dict->epoch = 0; dict->chain = NULL; - dict->refcount = 1; + dict->refCount = 1; DICT(dictPtr) = dict; dictPtr->internalRep.twoPtrValue.ptr2 = NULL; dictPtr->typePtr = &tclDictType; -- cgit v0.12 From 5c4bb0f4e9e073df2b65f086dd9660cd344dcb26 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 5 Jun 2017 17:57:33 +0000 Subject: Revert performance optimization as first step to providing a refactored one. --- generic/tclExecute.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 30ef536..cfcdd26 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2685,34 +2685,11 @@ TEBCresume( opnd = TclGetUInt1AtPtr(pc+1); - objv = &OBJ_AT_DEPTH(opnd-1); - /* minor optimization in simplest cases */ - switch (opnd) { - case 1: /* only one object */ - objResultPtr = *objv; - goto endINST_STR_CONCAT1; - case 2: /* two objects - check empty */ - if (objv[0]->bytes == &tclEmptyString) { - objResultPtr = objv[1]; - goto endINST_STR_CONCAT1; - } - else - if (objv[1]->bytes == &tclEmptyString) { - objResultPtr = objv[0]; - goto endINST_STR_CONCAT1; - } - break; - case 0: /* no objects - use new empty */ - TclNewObj(objResultPtr); - goto endINST_STR_CONCAT1; - } - /* do concat */ if (TCL_OK != TclStringCatObjv(interp, /* inPlace */ 1, - opnd, objv, &objResultPtr)) { + opnd, &OBJ_AT_DEPTH(opnd-1), &objResultPtr)) { TRACE_ERROR(interp); goto gotError; } - endINST_STR_CONCAT1: TRACE_WITH_OBJ(("%u => ", opnd), objResultPtr); NEXT_INST_V(2, opnd, 1); -- cgit v0.12 From cb68061d12f2680e86ea13986fd98eabbe706537 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 5 Jun 2017 20:03:19 +0000 Subject: Optimize TclStringCatObjv() for case when only one argument is non-empty. --- generic/tclStringObj.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 3478cbb..a4c242a 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2848,7 +2848,7 @@ TclStringCatObjv( Tcl_Obj **objPtrPtr) { Tcl_Obj *objPtr, *objResultPtr, * const *ov; - int oc, length = 0, binary = 1, first = 0; + int oc, length = 0, binary = 1, first = 0, last = 0; int allowUniChar = 1, requestUniChar = 0; /* assert (objc >= 2) */ @@ -2904,8 +2904,11 @@ TclStringCatObjv( int numBytes; Tcl_GetByteArrayFromObj(objPtr, &numBytes); /* PANIC? */ - if (length == 0) { - first = objc - oc - 1; + if (numBytes) { + last = objc - oc - 1; + if (length == 0) { + first = last; + } } length += numBytes; } @@ -2920,8 +2923,11 @@ TclStringCatObjv( int numChars; Tcl_GetUnicodeFromObj(objPtr, &numChars); /* PANIC? */ - if (length == 0) { - first = objc - oc - 1; + if (numChars) { + last = objc - oc - 1; + if (length == 0) { + first = last; + } } length += numChars; } @@ -2935,8 +2941,11 @@ TclStringCatObjv( objPtr = *ov++; Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ - if ((length == 0) && numBytes) { - first = objc - oc - 1; + if (numBytes) { + last = objc - oc - 1; + if (length == 0) { + first = last; + } } length += numBytes; } @@ -2956,8 +2965,13 @@ TclStringCatObjv( *objPtrPtr = objv[0]; return TCL_OK; } + if (last == first) { + /* Only one non-empty value; return it */ + *objPtrPtr = objv[first]; + return TCL_OK; + } - objv += first; objc -= first; + objv += first; objc = (last - first + 1); if (binary) { /* Efficiently produce a pure byte array result */ -- cgit v0.12 From 3d8a0152affb0feac24a3e9b6272e7c2badb050f Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 6 Jun 2017 08:34:00 +0000 Subject: small code review: don't need to check length if unchanged + the same case if 0 length --- generic/tclStringObj.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index a4c242a..c1c15f2 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2897,7 +2897,7 @@ TclStringCatObjv( if (binary) { /* Result will be pure byte array. Pre-size it */ ov = objv; oc = objc; - while (oc-- && (length >= 0)) { + while (oc--) { objPtr = *ov++; if (objPtr->bytes == NULL) { @@ -2909,14 +2909,16 @@ TclStringCatObjv( if (length == 0) { first = last; } + if ((length += numBytes) < 0) { + break; /* overflow */ + } } - length += numBytes; } } } else if (allowUniChar && requestUniChar) { /* Result will be pure Tcl_UniChar array. Pre-size it. */ ov = objv; oc = objc; - while (oc-- && (length >= 0)) { + while (oc--) { objPtr = *ov++; if ((objPtr->bytes == NULL) || (objPtr->length)) { @@ -2929,13 +2931,15 @@ TclStringCatObjv( first = last; } } - length += numChars; + if ((length += numChars) < 0) { + break; /* overflow */ + } } } } else { /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; - while (oc-- && (length >= 0)) { + while (oc--) { int numBytes; objPtr = *ov++; @@ -2946,11 +2950,19 @@ TclStringCatObjv( if (length == 0) { first = last; } + if ((length += numBytes) < 0) { + break; /* overflow */ + } } - length += numBytes; } } + if (last == first || length == 0) { + /* Only one non-empty value or zero length; return first */ + *objPtrPtr = objv[first]; + return TCL_OK; + } + if (length < 0) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -2960,17 +2972,6 @@ TclStringCatObjv( return TCL_ERROR; } - if (length == 0) { - /* Total length of zero means every value has length zero */ - *objPtrPtr = objv[0]; - return TCL_OK; - } - if (last == first) { - /* Only one non-empty value; return it */ - *objPtrPtr = objv[first]; - return TCL_OK; - } - objv += first; objc = (last - first + 1); if (binary) { -- cgit v0.12 From 7edce7686e817824758808dfba651a68c00558dd Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 6 Jun 2017 09:01:18 +0000 Subject: amend to [eac4656f1e8cf793] (moved to scope where numChars != 0 in Unicode case) --- generic/tclStringObj.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index c1c15f2..6332e9f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2930,9 +2930,9 @@ TclStringCatObjv( if (length == 0) { first = last; } - } - if ((length += numChars) < 0) { - break; /* overflow */ + if ((length += numChars) < 0) { + break; /* overflow */ + } } } } -- cgit v0.12 From 617e92d7b4b71479c4854f19bae7473a7af8b7c7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 6 Jun 2017 09:02:28 +0000 Subject: [67aa9a2070] Tcl_UtfToUniChar returns single byte for invalid UTF-8 input as documented. --- generic/tclUtf.c | 127 +++++++++++++++++++++------------------------------- tests/encoding.test | 25 +++++++++++ 2 files changed, 77 insertions(+), 75 deletions(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index e5497a4..3937141 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -73,16 +73,7 @@ static CONST unsigned char totalBytes[256] = { #else 1,1,1,1,1,1,1,1, #endif -#if TCL_UTF_MAX > 4 - 5,5,5,5, -#else - 1,1,1,1, -#endif -#if TCL_UTF_MAX > 5 - 6,6,6,6 -#else - 1,1,1,1 -#endif + 1,1,1,1,1,1,1,1 }; /* @@ -111,25 +102,16 @@ INLINE static int UtfCount( int ch) /* The Tcl_UniChar whose size is returned. */ { - if ((ch > 0) && (ch < UNICODE_SELF)) { + if ((unsigned)(ch - 1) < (UNICODE_SELF - 1)) { return 1; } if (ch <= 0x7FF) { return 2; } - if (ch <= 0xFFFF) { - return 3; - } #if TCL_UTF_MAX > 3 - if (ch <= 0x1FFFFF) { + if (((unsigned)(ch - 0x10000) <= 0xFFFFF)) { return 4; } - if (ch <= 0x3FFFFFF) { - return 5; - } - if (ch <= 0x7FFFFFFF) { - return 6; - } #endif return 3; } @@ -161,7 +143,7 @@ Tcl_UniCharToUtf( * large enough to hold the UTF-8 character * (at most TCL_UTF_MAX bytes). */ { - if ((ch > 0) && (ch < UNICODE_SELF)) { + if ((unsigned)(ch - 1) < (UNICODE_SELF - 1)) { buf[0] = (char) ch; return 1; } @@ -172,43 +154,43 @@ Tcl_UniCharToUtf( 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 == 4 + if ((ch & 0xF800) == 0xD800) { + if (ch & 0x0400) { + /* Low surrogate */ + buf[3] = (char) ((ch | 0x80) & 0xBF); + buf[2] |= (char) (((ch >> 6) | 0x80) & 0x8F); + return 4; + } else { + /* High surrogate */ + ch += 0x40; + buf[2] = (char) (((ch << 4) | 0x80) & 0xB0); + buf[1] = (char) (((ch >> 2) | 0x80) & 0xBF); + buf[0] = (char) (((ch >> 8) | 0xF0) & 0xF7); + return 0; + } + } +#endif + goto three; } #if TCL_UTF_MAX > 3 - if (ch <= 0x1FFFFF) { + if (ch <= 0x10FFFF) { 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; +three: + buf[2] = (char) ((ch | 0x80) & 0xBF); + buf[1] = (char) (((ch >> 6) | 0x80) & 0xBF); + buf[0] = (char) ((ch >> 12) | 0xE0); + return 3; } /* @@ -316,16 +298,15 @@ Tcl_UtfToUniChar( */ *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) | (src[1] & 0x3F)); - return 2; + if ((unsigned)(*chPtr - 1) >= (UNICODE_SELF - 1)) { + 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)) { /* @@ -334,38 +315,34 @@ Tcl_UtfToUniChar( *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12) | ((src[1] & 0x3F) << 6) | (src[2] & 0x3F)); - return 3; + if (*chPtr > 0x7ff) { + 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 - { - 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; + else if (byte < 0xF8) { + if (((src[1] & 0xC0) == 0x80) && ((src[2] & 0xC0) == 0x80) && ((src[3] & 0xC0) == 0x80)) { + /* + * Four-byte-character lead byte followed by three trail bytes. + */ + + *chPtr = (Tcl_UniChar) (((byte & 0x07) << 18) | ((src[1] & 0x3F) << 12) + | ((src[2] & 0x3F) << 6) | (src[3] & 0x3F)); + if ((unsigned)(*chPtr - 0x10000) <= 0xFFFFF) { + return 4; + } } + + /* + * A four-byte-character lead-byte not followed by two trail-bytes + * represents itself. + */ } #endif @@ -1038,7 +1015,7 @@ Tcl_UtfNcmp( /* * Cannot use 'memcmp(cs, ct, n);' as byte representation of \u0000 (the - * pair of bytes 0xc0,0x80) is larger than byte representation of \u0001 + * pair of bytes 0xC0,0x80) is larger than byte representation of \u0001 * (the byte 0x01.) */ @@ -1555,7 +1532,7 @@ Tcl_UniCharIsSpace( if (((Tcl_UniChar) ch) < ((Tcl_UniChar) 0x80)) { return TclIsSpaceProc((char) ch); - } else if ((Tcl_UniChar) ch == 0x180e || (Tcl_UniChar) ch == 0x202f) { + } else if ((Tcl_UniChar) ch == 0x180E || (Tcl_UniChar) ch == 0x202F) { return 1; } else { return ((SPACE_BITS >> GetCategory(ch)) & 1); diff --git a/tests/encoding.test b/tests/encoding.test index aa50360..85deb33 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -439,6 +439,31 @@ test encoding-24.3 {EscapeFreeProc on open channels} {stdio} { list $count [viewable $line] } [list 3 "\u4e4e\u4e5e\u4e5f (\\u4e4e\\u4e5e\\u4e5f)"] +test encoding-24.4 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc0\x80"] +} 1 +test encoding-24.5 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc0\x81"] +} 2 +test encoding-24.6 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc1\xbf"] +} 2 +test encoding-24.7 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xc2\x80"] +} 1 +test encoding-24.8 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xe0\x80\x80"] +} 3 +test encoding-24.9 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xe0\x9f\xbf"] +} 3 +test encoding-24.10 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xe0\xa0\x80"] +} 1 +test encoding-24.11 {Parse valid or invalid utf-8} { + string length [encoding convertfrom utf-8 "\xef\xbf\xbf"] +} 1 + file delete [file join [temporaryDirectory] iso2022.txt] # -- cgit v0.12 From 615771f0b6f577cc8f23a668314bdf5cd8309a59 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 6 Jun 2017 09:25:00 +0000 Subject: makes TclStringCatObjv safe accepting objc = 0 (or 1), then fast exits with new object / first; check-cycles rewritten to be still more faster. --- generic/tclStringObj.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 6332e9f..b78394e 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2851,7 +2851,11 @@ TclStringCatObjv( int oc, length = 0, binary = 1, first = 0, last = 0; int allowUniChar = 1, requestUniChar = 0; - /* assert (objc >= 2) */ + if (objc <= 1) { + /* Only one or no objects; return first or empty */ + *objPtrPtr = objc ? objv[0] : Tcl_NewObj(); + return TCL_OK; + } /* * Analyze to determine what representation result should be. @@ -2861,7 +2865,7 @@ TclStringCatObjv( */ ov = objv, oc = objc; - while (oc-- && (binary || allowUniChar)) { + do { objPtr = *ov++; if (objPtr->bytes) { @@ -2892,12 +2896,12 @@ TclStringCatObjv( } } } - } + } while (--oc && (binary || allowUniChar)); if (binary) { /* Result will be pure byte array. Pre-size it */ ov = objv; oc = objc; - while (oc--) { + do { objPtr = *ov++; if (objPtr->bytes == NULL) { @@ -2905,7 +2909,7 @@ TclStringCatObjv( Tcl_GetByteArrayFromObj(objPtr, &numBytes); /* PANIC? */ if (numBytes) { - last = objc - oc - 1; + last = objc - oc; if (length == 0) { first = last; } @@ -2914,11 +2918,11 @@ TclStringCatObjv( } } } - } + } while (--oc); } else if (allowUniChar && requestUniChar) { /* Result will be pure Tcl_UniChar array. Pre-size it. */ ov = objv; oc = objc; - while (oc--) { + do { objPtr = *ov++; if ((objPtr->bytes == NULL) || (objPtr->length)) { @@ -2926,7 +2930,7 @@ TclStringCatObjv( Tcl_GetUnicodeFromObj(objPtr, &numChars); /* PANIC? */ if (numChars) { - last = objc - oc - 1; + last = objc - oc; if (length == 0) { first = last; } @@ -2935,18 +2939,18 @@ TclStringCatObjv( } } } - } + } while (--oc); } else { /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; - while (oc--) { + do { int numBytes; objPtr = *ov++; Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ if (numBytes) { - last = objc - oc - 1; + last = objc - oc; if (length == 0) { first = last; } @@ -2954,7 +2958,7 @@ TclStringCatObjv( break; /* overflow */ } } - } + } while (--oc); } if (last == first || length == 0) { -- cgit v0.12 From b0146fbd504c02b6561813c75835ac8333f22805 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Jun 2017 12:56:37 +0000 Subject: A few more tweaks to streamline and clarify. --- generic/tclStringObj.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index b78394e..aae52ba 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2851,12 +2851,16 @@ TclStringCatObjv( int oc, length = 0, binary = 1, first = 0, last = 0; int allowUniChar = 1, requestUniChar = 0; + /* assert ( objc >= 0 ) */ + if (objc <= 1) { /* Only one or no objects; return first or empty */ *objPtrPtr = objc ? objv[0] : Tcl_NewObj(); return TCL_OK; } + /* assert ( objc >= 2 ) */ + /* * Analyze to determine what representation result should be. * GOALS: Avoid shimmering & string rep generation. @@ -2914,7 +2918,7 @@ TclStringCatObjv( first = last; } if ((length += numBytes) < 0) { - break; /* overflow */ + goto overflow; } } } @@ -2935,7 +2939,7 @@ TclStringCatObjv( first = last; } if ((length += numChars) < 0) { - break; /* overflow */ + goto overflow; } } } @@ -2955,27 +2959,19 @@ TclStringCatObjv( first = last; } if ((length += numBytes) < 0) { - break; /* overflow */ + goto overflow; } } } while (--oc); } - if (last == first || length == 0) { + if (last == first /*|| length == 0 */) { /* Only one non-empty value or zero length; return first */ + /* NOTE: (length == 0) implies (last == first) */ *objPtrPtr = objv[first]; return TCL_OK; } - if (length < 0) { - if (interp) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "max size for a Tcl value (%d bytes) exceeded", INT_MAX)); - Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); - } - return TCL_ERROR; - } - objv += first; objc = (last - first + 1); if (binary) { @@ -3106,6 +3102,14 @@ TclStringCatObjv( } *objPtrPtr = objResultPtr; return TCL_OK; + + overflow: + if (interp) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "max size for a Tcl value (%d bytes) exceeded", INT_MAX)); + Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); + } + return TCL_ERROR; } /* -- cgit v0.12 From 0aa0da515cfab250658ae8010baea869bb889595 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 6 Jun 2017 14:33:16 +0000 Subject: Add more test-cases for UTF-8 parser, including test-cases for TCL_UTF_MAX=4 or TCL_UTF_MAX=6 --- tests/encoding.test | 20 +++++++++++++------- tests/string.test | 18 +++++++++++------- tests/utf.test | 38 ++++++++++++++++++++++++++++++++------ 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/tests/encoding.test b/tests/encoding.test index a359f76..5b3c3e1 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -34,6 +34,7 @@ proc runtests {} { # Some tests require the testencoding command testConstraint testencoding [llength [info commands testencoding]] +testConstraint fullutf [expr {[format %c 0x010000] != "\ufffd"}] testConstraint exec [llength [info commands exec]] testConstraint testgetdefenc [llength [info commands testgetdefenc]] @@ -73,7 +74,7 @@ test encoding-2.2 {Tcl_FreeEncoding: refcount != 0} -setup { } -constraints {testencoding} -body { encoding system shiftjis ;# incr ref count encoding dirs [list [pwd]] - set x [encoding convertto shiftjis \u4e4e] ;# old one found + set x [encoding convertto shiftjis \u4e4e] ;# old one found encoding system identity llength shiftjis ;# Shimmer away any cache of Tcl_Encoding lappend x [catch {encoding convertto shiftjis \u4e4e} msg] $msg @@ -182,7 +183,7 @@ test encoding-8.1 {Tcl_ExternalToUtf} { puts -nonewline $f "ab\x8c\xc1g" close $f set f [open [file join [temporaryDirectory] dummy] r] - fconfigure $f -translation binary -encoding shiftjis + fconfigure $f -translation binary -encoding shiftjis set x [read $f] close $f file delete [file join [temporaryDirectory] dummy] @@ -265,7 +266,7 @@ test encoding-11.6 {LoadEncodingFile: invalid file} -constraints {testencoding} makeDirectory tmp makeDirectory [file join tmp encoding] set f [open [file join tmp encoding splat.enc] w] - fconfigure $f -translation binary + fconfigure $f -translation binary puts $f "abcdefghijklmnop" close $f encoding convertto splat \u4e4e @@ -286,11 +287,11 @@ test encoding-12.1 {LoadTableEncoding: normal encoding} { append x [encoding convertfrom iso8859-3 \xd5] } "\xd5?\u120" test encoding-12.2 {LoadTableEncoding: single-byte encoding} { - set x [encoding convertto iso8859-3 ab\u0120g] + set x [encoding convertto iso8859-3 ab\u0120g] append x [encoding convertfrom iso8859-3 ab\xd5g] } "ab\xd5gab\u120g" test encoding-12.3 {LoadTableEncoding: multi-byte encoding} { - set x [encoding convertto shiftjis ab\u4e4eg] + set x [encoding convertto shiftjis ab\u4e4eg] append x [encoding convertfrom shiftjis ab\x8c\xc1g] } "ab\x8c\xc1gab\u4e4eg" test encoding-12.4 {LoadTableEncoding: double-byte encoding} { @@ -332,9 +333,14 @@ test encoding-16.1 {UnicodeToUtfProc} { set val [encoding convertfrom unicode NN] list $val [format %x [scan $val %c]] } "\u4e4e 4e4e" +test encoding-16.2 {UnicodeToUtfProc} -constraints fullutf -body { + set val [encoding convertfrom unicode "\xd8\xd8\xdc\xdc"] + list $val [format %x [scan $val %c]] +} -result "\U460dc 460dc" -test encoding-17.1 {UtfToUnicodeProc} { -} {} +test encoding-17.1 {UtfToUnicodeProc} -constraints fullutf -body { + encoding convertto unicode "\U460dc" +} -result "\xd8\xd8\xdc\xdc" test encoding-18.1 {TableToUtfProc} { } {} diff --git a/tests/string.test b/tests/string.test index 3611753..cc65e67 100644 --- a/tests/string.test +++ b/tests/string.test @@ -219,7 +219,7 @@ test string-4.14 {string first, negative start index} { } 1 test string-4.15 {string first, ability to two-byte encoded utf-8 chars} { # Test for a bug in Tcl 8.3 where test for all-single-byte-encoded - # strings was incorrect, leading to an index returned by [string first] + # strings was incorrect, leading to an index returned by [string first] # which pointed past the end of the string. set uchar \u057e ;# character with two-byte encoding in utf-8 string first % %#$uchar$uchar#$uchar$uchar#% 3 @@ -419,7 +419,7 @@ test string-6.37 {string is double, false on int overflow} -setup { } -result {1 priorValue} # string-6.38 removed, underflow on input is no longer an error. test string-6.39 {string is double, false} { - # This test is non-portable because IRIX thinks + # 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 # @@ -576,12 +576,12 @@ test string-6.85 {string is control} { } 0 test string-6.86 {string is graph} { ## graph is any print char, except space - list [string is gra -fail var "0123abc!@#\$\u0100 "] $var -} {0 12} + list [string is gra -fail var "0123abc!@#\$\u0100\UE0100\UE01EF "] $var +} {0 14} test string-6.87 {string is print} { ## basically any printable char - list [string is print -fail var "0123abc!@#\$\u0100 \u0010"] $var -} {0 13} + list [string is print -fail var "0123abc!@#\$\u0100 \UE0100\UE01EF\u0010"] $var +} {0 15} test string-6.88 {string is punct} { ## any graph char that isn't alnum list [string is punct -fail var "_!@#\u00beq0"] $var @@ -901,6 +901,10 @@ test string-10.20 {string map, dictionaries don't 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] } {XY XY 2 XY} +test string-10.20.1 {string map, dictionaries don't alter map ordering} { + set map {a X b Y a Z} + list [string map [dict create a X b Y a Z] aaa] [string map $map aaa] [dict size $map] [string map $map aaa] +} {ZZZ XXX 2 XXX} test string-10.21 {string map, ABR checks} { string map {longstring foob} long } long @@ -1833,7 +1837,7 @@ proc MemStress {args} { set res {} foreach body $args { set end 0 - for {set i 0} {$i < 5} {incr i} { + for {set i 0} {$i < 5} {incr i} { proc MemStress_Body {} $body uplevel 1 MemStress_Body rename MemStress_Body {} diff --git a/tests/utf.test b/tests/utf.test index a03dd6c..28981d6 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -20,6 +20,9 @@ testConstraint testbytestring [llength [info commands testbytestring]] catch {unset x} +# Some tests require support for 4-byte UTF-8 sequences +testConstraint fullutf [expr {[format %c 0x010000] != "\ufffd"}] + test utf-1.1 {Tcl_UniCharToUtf: 1 byte sequences} testbytestring { expr {"\x01" eq [testbytestring "\x01"]} } 1 @@ -38,6 +41,9 @@ test utf-1.5 {Tcl_UniCharToUtf: overflowed Tcl_UniChar} testbytestring { test utf-1.6 {Tcl_UniCharToUtf: negative Tcl_UniChar} testbytestring { expr {[format %c -1] eq [testbytestring "\xef\xbf\xbd"]} } 1 +test utf-1.7 {Tcl_UniCharToUtf: 4 byte sequences} -constraints {fullutf testbytestring} -body { + expr {"\U014e4e" eq [testbytestring "\xf0\x94\xb9\x8e"]} +} -result 1 test utf-2.1 {Tcl_UtfToUniChar: low ascii} { string length "abc" @@ -60,9 +66,21 @@ test utf-2.6 {Tcl_UtfToUniChar: lead (3-byte) followed by 1 trail} testbytestrin test utf-2.7 {Tcl_UtfToUniChar: lead (3-byte) followed by 2 trail} testbytestring { string length [testbytestring "\xE4\xb9\x8e"] } {1} -test utf-2.8 {Tcl_UtfToUniChar: longer UTF sequences not supported} testbytestring { - string length [testbytestring "\xF4\xA2\xA2\xA2"] +test utf-2.8 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {fullutf testbytestring} -body { + string length [testbytestring "\xF0\x90\x80\x80"] +} -result {1} +test utf-2.9 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {fullutf testbytestring} -body { + string length [testbytestring "\xF4\x8F\xBF\xBF"] +} -result {1} +test utf-2.10 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail, underflow} testbytestring { + string length [testbytestring "\xF0\x8F\xBF\xBF"] +} {4} +test utf-2.11 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail, overflow} testbytestring { + string length [testbytestring "\xF4\x90\x80\x80"] } {4} +test utf-2.12 {Tcl_UtfToUniChar: longer UTF sequences not supported} testbytestring { + string length [testbytestring "\xF8\xA2\xA2\xA2\xA2"] +} {5} test utf-3.1 {Tcl_UtfCharComplete} { } {} @@ -195,8 +213,16 @@ bsCheck \Ua1 161 bsCheck \U4e21 20001 bsCheck \U004e21 20001 bsCheck \U00004e21 20001 -bsCheck \U00110000 65533 -bsCheck \Uffffffff 65533 +bsCheck \U0000004e21 78 +if {[testConstraint fullutf]} { + bsCheck \U00110000 69632 + bsCheck \U01100000 69632 + bsCheck \U11000000 69632 + bsCheck \U0010FFFF 1114111 + bsCheck \U010FFFF0 1114111 + bsCheck \U10FFFF00 1114111 + bsCheck \UFFFFFFFF 1048575 +} test utf-11.1 {Tcl_UtfToUpper} { string toupper {} @@ -264,8 +290,8 @@ test utf-16.1 {Tcl_UniCharToLower, negative delta} { string tolower aA } aa test utf-16.2 {Tcl_UniCharToLower, positive delta} { - string tolower \u0178\u00ff\uA78D\u01c5 -} \u00ff\u00ff\u0265\u01c6 + string tolower \u0178\u00ff\uA78D\u01c5\U10400 +} \u00ff\u00ff\u0265\u01c6\U10428 test utf-17.1 {Tcl_UniCharToLower, no delta} { string tolower ! -- cgit v0.12 From 4cf238f3c3fd4ef9aed542f0f5f55a4dff225cd9 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 6 Jun 2017 17:51:12 +0000 Subject: Expose some of the core variable access APIs. (Cherrypick from [b4dfc30083]) --- generic/tclDictObj.c | 6 +- generic/tclExecute.c | 45 +++++---- generic/tclInt.decls | 26 +++++ generic/tclInt.h | 13 +-- generic/tclIntDecls.h | 37 +++++++ generic/tclStubInit.c | 5 + generic/tclVar.c | 275 +++++++++++++++++++++++++++++++++++++++++++++----- 7 files changed, 349 insertions(+), 58 deletions(-) diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 87fb333..d15255f 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -3535,7 +3535,7 @@ TclDictWithFinish( * If the dictionary variable doesn't exist, drop everything silently. */ - dictPtr = TclPtrGetVar(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, + dictPtr = TclPtrGetVarIdx(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, TCL_LEAVE_ERR_MSG, index); if (dictPtr == NULL) { return TCL_OK; @@ -3618,8 +3618,8 @@ TclDictWithFinish( * Write back the outermost dictionary to the variable. */ - if (TclPtrSetVar(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, dictPtr, - TCL_LEAVE_ERR_MSG, index) == NULL) { + if (TclPtrSetVarIdx(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, + dictPtr, TCL_LEAVE_ERR_MSG, index) == NULL) { if (allocdict) { TclDecrRefCount(dictPtr); } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 6499cf8..761a23e 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -3321,7 +3321,7 @@ TEBCresume( */ DECACHE_STACK_INFO(); - objResultPtr = TclPtrGetVar(interp, varPtr, arrayPtr, + objResultPtr = TclPtrGetVarIdx(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, TCL_LEAVE_ERR_MSG, opnd); CACHE_STACK_INFO(); if (!objResultPtr) { @@ -3568,7 +3568,7 @@ TEBCresume( doCallPtrSetVar: DECACHE_STACK_INFO(); - objResultPtr = TclPtrSetVar(interp, varPtr, arrayPtr, + objResultPtr = TclPtrSetVarIdx(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, valuePtr, storeFlags, opnd); CACHE_STACK_INFO(); if (!objResultPtr) { @@ -3704,7 +3704,7 @@ TEBCresume( VarHashRefCount(arrayPtr)++; } DECACHE_STACK_INFO(); - objResultPtr = TclPtrGetVar(interp, varPtr, arrayPtr, + objResultPtr = TclPtrGetVarIdx(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, TCL_LEAVE_ERR_MSG, opnd); CACHE_STACK_INFO(); if (TclIsVarInHash(varPtr)) { @@ -3733,7 +3733,7 @@ TEBCresume( } } DECACHE_STACK_INFO(); - objResultPtr = TclPtrSetVar(interp, varPtr, arrayPtr, part1Ptr, + objResultPtr = TclPtrSetVarIdx(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, objResultPtr, TCL_LEAVE_ERR_MSG, opnd); CACHE_STACK_INFO(); if (!objResultPtr) { @@ -3997,7 +3997,7 @@ TEBCresume( Tcl_DecrRefCount(incrPtr); } else { DECACHE_STACK_INFO(); - objResultPtr = TclPtrIncrObjVar(interp, varPtr, arrayPtr, + objResultPtr = TclPtrIncrObjVarIdx(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, incrPtr, TCL_LEAVE_ERR_MSG, opnd); CACHE_STACK_INFO(); Tcl_DecrRefCount(incrPtr); @@ -4152,7 +4152,7 @@ TEBCresume( slowUnsetScalar: DECACHE_STACK_INFO(); - if (TclPtrUnsetVar(interp, varPtr, NULL, NULL, NULL, flags, + if (TclPtrUnsetVarIdx(interp, varPtr, NULL, NULL, NULL, flags, opnd) != TCL_OK && flags) { goto errorInUnset; } @@ -4204,7 +4204,7 @@ TEBCresume( if (flags & TCL_LEAVE_ERR_MSG) { goto errorInUnset; } - } else if (TclPtrUnsetVar(interp, varPtr, arrayPtr, NULL, part2Ptr, + } else if (TclPtrUnsetVarIdx(interp, varPtr, arrayPtr, NULL, part2Ptr, flags, opnd) != TCL_OK && (flags & TCL_LEAVE_ERR_MSG)) { goto errorInUnset; } @@ -4261,7 +4261,7 @@ TEBCresume( varPtr->value.objPtr = NULL; } else { DECACHE_STACK_INFO(); - TclPtrUnsetVar(interp, varPtr, NULL, NULL, NULL, 0, opnd); + TclPtrUnsetVarIdx(interp, varPtr, NULL, NULL, NULL, 0, opnd); CACHE_STACK_INFO(); } NEXT_INST_F(5, 0, 0); @@ -4477,7 +4477,7 @@ TEBCresume( if (TclIsVarInHash(otherPtr)) { VarHashRefCount(otherPtr)++; } - } else if (TclPtrObjMakeUpvar(interp, otherPtr, NULL, 0, + } else if (TclPtrObjMakeUpvarIdx(interp, otherPtr, NULL, 0, opnd) != TCL_OK) { TRACE_ERROR(interp); goto gotError; @@ -6938,7 +6938,7 @@ TEBCresume( } } else { DECACHE_STACK_INFO(); - if (TclPtrSetVar(interp, varPtr, NULL, NULL, NULL, + if (TclPtrSetVarIdx(interp, varPtr, NULL, NULL, NULL, valuePtr, TCL_LEAVE_ERR_MSG, varIndex)==NULL){ CACHE_STACK_INFO(); TRACE_APPEND(( @@ -7109,7 +7109,7 @@ TEBCresume( } } else { DECACHE_STACK_INFO(); - if (TclPtrSetVar(interp, varPtr, NULL, NULL, NULL, + if (TclPtrSetVarIdx(interp, varPtr, NULL, NULL, NULL, valuePtr, TCL_LEAVE_ERR_MSG, varIndex)==NULL){ CACHE_STACK_INFO(); TRACE_APPEND(("ERROR init. index temp %d: %.30s", @@ -7332,7 +7332,8 @@ TEBCresume( dictPtr = varPtr->value.objPtr; } else { DECACHE_STACK_INFO(); - dictPtr = TclPtrGetVar(interp, varPtr, NULL,NULL,NULL, 0, opnd2); + dictPtr = TclPtrGetVarIdx(interp, varPtr, NULL, NULL, NULL, 0, + opnd2); CACHE_STACK_INFO(); } if (dictPtr == NULL) { @@ -7406,7 +7407,7 @@ TEBCresume( } else { Tcl_IncrRefCount(dictPtr); DECACHE_STACK_INFO(); - objResultPtr = TclPtrSetVar(interp, varPtr, NULL, NULL, NULL, + objResultPtr = TclPtrSetVarIdx(interp, varPtr, NULL, NULL, NULL, dictPtr, TCL_LEAVE_ERR_MSG, opnd2); CACHE_STACK_INFO(); TclDecrRefCount(dictPtr); @@ -7435,7 +7436,8 @@ TEBCresume( dictPtr = varPtr->value.objPtr; } else { DECACHE_STACK_INFO(); - dictPtr = TclPtrGetVar(interp, varPtr, NULL, NULL, NULL, 0, opnd); + dictPtr = TclPtrGetVarIdx(interp, varPtr, NULL, NULL, NULL, 0, + opnd); CACHE_STACK_INFO(); } if (dictPtr == NULL) { @@ -7544,7 +7546,7 @@ TEBCresume( } else { Tcl_IncrRefCount(dictPtr); DECACHE_STACK_INFO(); - objResultPtr = TclPtrSetVar(interp, varPtr, NULL, NULL, NULL, + objResultPtr = TclPtrSetVarIdx(interp, varPtr, NULL, NULL, NULL, dictPtr, TCL_LEAVE_ERR_MSG, opnd); CACHE_STACK_INFO(); TclDecrRefCount(dictPtr); @@ -7638,7 +7640,7 @@ TEBCresume( dictPtr = varPtr->value.objPtr; } else { DECACHE_STACK_INFO(); - dictPtr = TclPtrGetVar(interp, varPtr, NULL, NULL, NULL, + dictPtr = TclPtrGetVarIdx(interp, varPtr, NULL, NULL, NULL, TCL_LEAVE_ERR_MSG, opnd); CACHE_STACK_INFO(); if (dictPtr == NULL) { @@ -7671,7 +7673,7 @@ TEBCresume( TclObjUnsetVar2(interp, localName(iPtr->varFramePtr, duiPtr->varIndices[i]), NULL, 0); - } else if (TclPtrSetVar(interp, varPtr, NULL, NULL, NULL, + } else if (TclPtrSetVarIdx(interp, varPtr, NULL, NULL, NULL, valuePtr, TCL_LEAVE_ERR_MSG, duiPtr->varIndices[i]) == NULL) { CACHE_STACK_INFO(); @@ -7698,7 +7700,8 @@ TEBCresume( dictPtr = varPtr->value.objPtr; } else { DECACHE_STACK_INFO(); - dictPtr = TclPtrGetVar(interp, varPtr, NULL, NULL, NULL, 0, opnd); + dictPtr = TclPtrGetVarIdx(interp, varPtr, NULL, NULL, NULL, 0, + opnd); CACHE_STACK_INFO(); } if (dictPtr == NULL) { @@ -7728,8 +7731,8 @@ TEBCresume( valuePtr = var2Ptr->value.objPtr; } else { DECACHE_STACK_INFO(); - valuePtr = TclPtrGetVar(interp, var2Ptr, NULL, NULL, NULL, 0, - duiPtr->varIndices[i]); + valuePtr = TclPtrGetVarIdx(interp, var2Ptr, NULL, NULL, NULL, + 0, duiPtr->varIndices[i]); CACHE_STACK_INFO(); } if (valuePtr == NULL) { @@ -7747,7 +7750,7 @@ TEBCresume( varPtr->value.objPtr = dictPtr; } else { DECACHE_STACK_INFO(); - objResultPtr = TclPtrSetVar(interp, varPtr, NULL, NULL, NULL, + objResultPtr = TclPtrSetVarIdx(interp, varPtr, NULL, NULL, NULL, dictPtr, TCL_LEAVE_ERR_MSG, opnd); CACHE_STACK_INFO(); if (objResultPtr == NULL) { diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 4e7e422..2a3d2a0 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -1011,6 +1011,32 @@ declare 251 { int TclRegisterLiteral(void *envPtr, char *bytes, int length, int flags) } + +# Exporting of the internal API to variables. + +declare 252 { + Tcl_Obj *TclPtrGetVar(Tcl_Interp *interp, Tcl_Var varPtr, + Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, + const int flags) +} +declare 253 { + Tcl_Obj *TclPtrSetVar(Tcl_Interp *interp, Tcl_Var varPtr, + Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, + Tcl_Obj *newValuePtr, const int flags) +} +declare 254 { + Tcl_Obj *TclPtrIncrObjVar(Tcl_Interp *interp, Tcl_Var varPtr, + Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, + Tcl_Obj *incrPtr, const int flags) +} +declare 255 { + int TclPtrObjMakeUpvar(Tcl_Interp *interp, Tcl_Var otherPtr, + Tcl_Obj *myNamePtr, int myFlags) +} +declare 256 { + int TclPtrUnsetVar(Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, + Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags) +} ############################################################################## diff --git a/generic/tclInt.h b/generic/tclInt.h index 7b582c0..ed867d8 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3935,20 +3935,21 @@ MODULE_SCOPE Var * TclLookupArrayElement(Tcl_Interp *interp, const int flags, const char *msg, const int createPart1, const int createPart2, Var *arrayPtr, int index); -MODULE_SCOPE Tcl_Obj * TclPtrGetVar(Tcl_Interp *interp, +MODULE_SCOPE Tcl_Obj * TclPtrGetVarIdx(Tcl_Interp *interp, Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags, int index); -MODULE_SCOPE Tcl_Obj * TclPtrSetVar(Tcl_Interp *interp, +MODULE_SCOPE Tcl_Obj * TclPtrSetVarIdx(Tcl_Interp *interp, Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, const int flags, int index); -MODULE_SCOPE Tcl_Obj * TclPtrIncrObjVar(Tcl_Interp *interp, +MODULE_SCOPE Tcl_Obj * TclPtrIncrObjVarIdx(Tcl_Interp *interp, Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr, const int flags, int index); -MODULE_SCOPE int TclPtrObjMakeUpvar(Tcl_Interp *interp, Var *otherPtr, - Tcl_Obj *myNamePtr, int myFlags, int index); -MODULE_SCOPE int TclPtrUnsetVar(Tcl_Interp *interp, Var *varPtr, +MODULE_SCOPE int TclPtrObjMakeUpvarIdx(Tcl_Interp *interp, + Var *otherPtr, Tcl_Obj *myNamePtr, int myFlags, + int index); +MODULE_SCOPE int TclPtrUnsetVarIdx(Tcl_Interp *interp, Var *varPtr, Var *arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags, int index); diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index f95f999..eda90b4 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -617,6 +617,28 @@ EXTERN void TclSetSlaveCancelFlags(Tcl_Interp *interp, int flags, /* 251 */ EXTERN int TclRegisterLiteral(void *envPtr, char *bytes, int length, int flags); +/* 252 */ +EXTERN Tcl_Obj * TclPtrGetVar(Tcl_Interp *interp, Tcl_Var varPtr, + Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, + Tcl_Obj *part2Ptr, const int flags); +/* 253 */ +EXTERN Tcl_Obj * TclPtrSetVar(Tcl_Interp *interp, Tcl_Var varPtr, + Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, + Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, + const int flags); +/* 254 */ +EXTERN Tcl_Obj * TclPtrIncrObjVar(Tcl_Interp *interp, Tcl_Var varPtr, + Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, + Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr, + const int flags); +/* 255 */ +EXTERN int TclPtrObjMakeUpvar(Tcl_Interp *interp, + Tcl_Var otherPtr, Tcl_Obj *myNamePtr, + int myFlags); +/* 256 */ +EXTERN int TclPtrUnsetVar(Tcl_Interp *interp, Tcl_Var varPtr, + Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, + Tcl_Obj *part2Ptr, const int flags); typedef struct TclIntStubs { int magic; @@ -874,6 +896,11 @@ typedef struct TclIntStubs { char * (*tclDoubleDigits) (double dv, int ndigits, int flags, int *decpt, int *signum, char **endPtr); /* 249 */ void (*tclSetSlaveCancelFlags) (Tcl_Interp *interp, int flags, int force); /* 250 */ int (*tclRegisterLiteral) (void *envPtr, char *bytes, int length, int flags); /* 251 */ + Tcl_Obj * (*tclPtrGetVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags); /* 252 */ + Tcl_Obj * (*tclPtrSetVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, const int flags); /* 253 */ + Tcl_Obj * (*tclPtrIncrObjVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *incrPtr, const int flags); /* 254 */ + int (*tclPtrObjMakeUpvar) (Tcl_Interp *interp, Tcl_Var otherPtr, Tcl_Obj *myNamePtr, int myFlags); /* 255 */ + int (*tclPtrUnsetVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags); /* 256 */ } TclIntStubs; extern const TclIntStubs *tclIntStubsPtr; @@ -1305,6 +1332,16 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclSetSlaveCancelFlags) /* 250 */ #define TclRegisterLiteral \ (tclIntStubsPtr->tclRegisterLiteral) /* 251 */ +#define TclPtrGetVar \ + (tclIntStubsPtr->tclPtrGetVar) /* 252 */ +#define TclPtrSetVar \ + (tclIntStubsPtr->tclPtrSetVar) /* 253 */ +#define TclPtrIncrObjVar \ + (tclIntStubsPtr->tclPtrIncrObjVar) /* 254 */ +#define TclPtrObjMakeUpvar \ + (tclIntStubsPtr->tclPtrObjMakeUpvar) /* 255 */ +#define TclPtrUnsetVar \ + (tclIntStubsPtr->tclPtrUnsetVar) /* 256 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 5b7a1cd..b185f04 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -560,6 +560,11 @@ static const TclIntStubs tclIntStubs = { TclDoubleDigits, /* 249 */ TclSetSlaveCancelFlags, /* 250 */ TclRegisterLiteral, /* 251 */ + TclPtrGetVar, /* 252 */ + TclPtrSetVar, /* 253 */ + TclPtrIncrObjVar, /* 254 */ + TclPtrObjMakeUpvar, /* 255 */ + TclPtrUnsetVar, /* 256 */ }; static const TclIntPlatStubs tclIntPlatStubs = { diff --git a/generic/tclVar.c b/generic/tclVar.c index 30e2f9b..3dd6790 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -1309,7 +1309,7 @@ Tcl_ObjGetVar2( return NULL; } - return TclPtrGetVar(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, + return TclPtrGetVarIdx(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, flags, -1); } @@ -1339,6 +1339,52 @@ Tcl_Obj * TclPtrGetVar( Tcl_Interp *interp, /* Command interpreter in which variable is to * be looked up. */ + Tcl_Var varPtr, /* The variable to be read.*/ + Tcl_Var arrayPtr, /* NULL for scalar variables, pointer to the + * containing array otherwise. */ + Tcl_Obj *part1Ptr, /* Name of an array (if part2 is non-NULL) or + * the name of a variable. */ + Tcl_Obj *part2Ptr, /* 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. */ +{ + if (varPtr == NULL) { + Tcl_Panic("varPtr must not be NULL"); + } + if (part1Ptr == NULL) { + Tcl_Panic("part1Ptr must not be NULL"); + } + return TclPtrGetVarIdx(interp, (Var *) varPtr, (Var *) arrayPtr, + part1Ptr, part2Ptr, flags, -1); +} + +/* + *---------------------------------------------------------------------- + * + * TclPtrGetVarIdx -- + * + * Return the value of a Tcl variable as a Tcl object, given the pointers + * to the variable's (and possibly containing array's) VAR structure. + * + * Results: + * The return value points to the current object value of the variable + * given by varPtr. If the specified variable doesn't exist, or if there + * is a clash in array usage, then NULL is returned and a message will be + * left in the interpreter's result if the TCL_LEAVE_ERR_MSG flag is set. + * + * Side effects: + * The ref count for the returned object is _not_ incremented to reflect + * the returned reference; if you want to keep a reference to the object + * you must increment its ref count yourself. + * + *---------------------------------------------------------------------- + */ + +Tcl_Obj * +TclPtrGetVarIdx( + Tcl_Interp *interp, /* Command interpreter in which variable is to + * be looked up. */ register Var *varPtr, /* The variable to be read.*/ Var *arrayPtr, /* NULL for scalar variables, pointer to the * containing array otherwise. */ @@ -1678,7 +1724,7 @@ Tcl_ObjSetVar2( return NULL; } - return TclPtrSetVar(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, + return TclPtrSetVarIdx(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, newValuePtr, flags, -1); } @@ -1711,6 +1757,60 @@ Tcl_Obj * TclPtrSetVar( Tcl_Interp *interp, /* Command interpreter in which variable is to * be looked up. */ + Tcl_Var varPtr, /* Reference to the variable to set. */ + Tcl_Var arrayPtr, /* Reference to the array containing the + * variable, or NULL if the variable is a + * scalar. */ + Tcl_Obj *part1Ptr, /* Name of an array (if part2 is non-NULL) or + * the name of a variable. */ + Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element + * in the array part1. */ + Tcl_Obj *newValuePtr, /* New value for variable. */ + const int flags) /* OR-ed combination of TCL_GLOBAL_ONLY, and + * TCL_LEAVE_ERR_MSG bits. */ +{ + if (varPtr == NULL) { + Tcl_Panic("varPtr must not be NULL"); + } + if (part1Ptr == NULL) { + Tcl_Panic("part1Ptr must not be NULL"); + } + if (newValuePtr == NULL) { + Tcl_Panic("newValuePtr must not be NULL"); + } + return TclPtrSetVarIdx(interp, (Var *) varPtr, (Var *) arrayPtr, + part1Ptr, part2Ptr, newValuePtr, flags, -1); +} + +/* + *---------------------------------------------------------------------- + * + * TclPtrSetVarIdx -- + * + * This function is the same as Tcl_SetVar2Ex above, except that it + * requires pointers to the variable's Var structs in addition to the + * variable names. + * + * Results: + * Returns a pointer to the Tcl_Obj holding the new value of the + * variable. If the write operation was disallowed because an array was + * expected but not found (or vice versa), then NULL is returned; if the + * TCL_LEAVE_ERR_MSG flag is set, then an explanatory message will be + * left in the interpreter's result. Note that the returned object may + * not be the same one referenced by newValuePtr; this is because + * variable traces may modify the variable's value. + * + * Side effects: + * The value of the given variable is set. If either the array or the + * entry didn't exist then a new variable is created. + * + *---------------------------------------------------------------------- + */ + +Tcl_Obj * +TclPtrSetVarIdx( + Tcl_Interp *interp, /* Command interpreter in which variable is to + * be looked up. */ register Var *varPtr, /* Reference to the variable to set. */ Var *arrayPtr, /* Reference to the array containing the * variable, or NULL if the variable is a @@ -1953,7 +2053,7 @@ TclIncrObjVar2( "\n (reading value of variable to increment)"); return NULL; } - return TclPtrIncrObjVar(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, + return TclPtrIncrObjVarIdx(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, incrPtr, flags, -1); } @@ -1986,6 +2086,62 @@ Tcl_Obj * TclPtrIncrObjVar( Tcl_Interp *interp, /* Command interpreter in which variable is to * be found. */ + Tcl_Var varPtr, /* Reference to the variable to set. */ + Tcl_Var arrayPtr, /* Reference to the array containing the + * variable, or NULL if the variable is a + * scalar. */ + Tcl_Obj *part1Ptr, /* Points to an object holding the name of an + * array (if part2 is non-NULL) or the name of + * a variable. */ + Tcl_Obj *part2Ptr, /* If non-null, points to an object holding + * the name of an element in the array + * part1Ptr. */ + Tcl_Obj *incrPtr, /* Increment value. */ +/* TODO: Which of these flag values really make sense? */ + const int flags) /* Various flags that tell how to incr value: + * any of TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, + * TCL_APPEND_VALUE, TCL_LIST_ELEMENT, + * TCL_LEAVE_ERR_MSG. */ +{ + if (varPtr == NULL) { + Tcl_Panic("varPtr must not be NULL"); + } + if (part1Ptr == NULL) { + Tcl_Panic("part1Ptr must not be NULL"); + } + return TclPtrIncrObjVarIdx(interp, (Var *) varPtr, (Var *) arrayPtr, + part1Ptr, part2Ptr, incrPtr, flags, -1); +} + +/* + *---------------------------------------------------------------------- + * + * TclPtrIncrObjVarIdx -- + * + * Given the pointers to a variable and possible containing array, + * increment the Tcl object value of the variable by a Tcl_Obj increment. + * + * Results: + * Returns a pointer to the Tcl_Obj holding the new value of the + * variable. If the specified variable doesn't exist, or there is a clash + * in array usage, or an error occurs while executing variable traces, + * then NULL is returned and a message will be left in the interpreter's + * result. + * + * Side effects: + * The value of the given variable is incremented by the specified + * amount. If either the array or the entry didn't exist then a new + * variable is created. The ref count for the returned object is _not_ + * incremented to reflect the returned reference; if you want to keep a + * reference to the object you must increment its ref count yourself. + * + *---------------------------------------------------------------------- + */ + +Tcl_Obj * +TclPtrIncrObjVarIdx( + Tcl_Interp *interp, /* Command interpreter in which variable is to + * be found. */ Var *varPtr, /* Reference to the variable to set. */ Var *arrayPtr, /* Reference to the array containing the * variable, or NULL if the variable is a @@ -2011,8 +2167,8 @@ TclPtrIncrObjVar( if (TclIsVarInHash(varPtr)) { VarHashRefCount(varPtr)++; } - varValuePtr = TclPtrGetVar(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, - flags, index); + varValuePtr = TclPtrGetVarIdx(interp, varPtr, arrayPtr, part1Ptr, + part2Ptr, flags, index); if (TclIsVarInHash(varPtr)) { VarHashRefCount(varPtr)--; } @@ -2024,8 +2180,8 @@ TclPtrIncrObjVar( varValuePtr = Tcl_DuplicateObj(varValuePtr); if (TCL_OK == TclIncrObj(interp, varValuePtr, incrPtr)) { - return TclPtrSetVar(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, - varValuePtr, flags, index); + return TclPtrSetVarIdx(interp, varPtr, arrayPtr, part1Ptr, + part2Ptr, varValuePtr, flags, index); } else { Tcl_DecrRefCount(varValuePtr); return NULL; @@ -2041,8 +2197,8 @@ TclPtrIncrObjVar( * is the way to make that happen. */ - return TclPtrSetVar(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, - varValuePtr, flags, index); + return TclPtrSetVarIdx(interp, varPtr, arrayPtr, part1Ptr, + part2Ptr, varValuePtr, flags, index); } else { return NULL; } @@ -2189,8 +2345,8 @@ TclObjUnsetVar2( return TCL_ERROR; } - return TclPtrUnsetVar(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, flags, - -1); + return TclPtrUnsetVarIdx(interp, varPtr, arrayPtr, part1Ptr, part2Ptr, + flags, -1); } /* @@ -2219,6 +2375,53 @@ int TclPtrUnsetVar( Tcl_Interp *interp, /* Command interpreter in which varName is to * be looked up. */ + Tcl_Var varPtr, /* The variable to be unset. */ + Tcl_Var arrayPtr, /* NULL for scalar variables, pointer to the + * containing array otherwise. */ + Tcl_Obj *part1Ptr, /* Name of an array (if part2 is non-NULL) or + * the name of a variable. */ + Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element + * in the array part1. */ + const int flags) /* OR-ed combination of any of + * TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY, + * TCL_LEAVE_ERR_MSG. */ +{ + if (varPtr == NULL) { + Tcl_Panic("varPtr must not be NULL"); + } + if (part1Ptr == NULL) { + Tcl_Panic("part1Ptr must not be NULL"); + } + return TclPtrUnsetVarIdx(interp, (Var *) varPtr, (Var *) arrayPtr, + part1Ptr, part2Ptr, flags, -1); +} + +/* + *---------------------------------------------------------------------- + * + * TclPtrUnsetVarIdx -- + * + * Delete a variable, given the pointers to the variable's (and possibly + * containing array's) VAR structure. + * + * Results: + * Returns TCL_OK if the variable was successfully deleted, TCL_ERROR if + * the variable can't be unset. In the event of an error, if the + * TCL_LEAVE_ERR_MSG flag is set then an error message is left in the + * interp's result. + * + * Side effects: + * If varPtr and arrayPtr indicate a local or global variable in interp, + * it is deleted. If varPtr is an array reference and part2Ptr is NULL, + * then the whole array is deleted. + * + *---------------------------------------------------------------------- + */ + +int +TclPtrUnsetVarIdx( + Tcl_Interp *interp, /* Command interpreter in which varName is to + * be looked up. */ register Var *varPtr, /* The variable to be unset. */ Var *arrayPtr, /* NULL for scalar variables, pointer to the * containing array otherwise. */ @@ -2566,11 +2769,11 @@ Tcl_AppendObjCmd( /* * Note that we do not need to increase the refCount of the Var * pointers: should a trace delete the variable, the return value - * of TclPtrSetVar will be NULL or emptyObjPtr, and we will not + * of TclPtrSetVarIdx will be NULL or emptyObjPtr, and we will not * access the variable again. */ - varValuePtr = TclPtrSetVar(interp, varPtr, arrayPtr, objv[1], + varValuePtr = TclPtrSetVarIdx(interp, varPtr, arrayPtr, objv[1], NULL, objv[i], TCL_APPEND_VALUE|TCL_LEAVE_ERR_MSG, -1); if ((varValuePtr == NULL) || (varValuePtr == ((Interp *) interp)->emptyObjPtr)) { @@ -2650,7 +2853,7 @@ Tcl_LappendObjCmd( createdNewObj = 0; /* - * Protect the variable pointers around the TclPtrGetVar call + * Protect the variable pointers around the TclPtrGetVarIdx call * to insure that they remain valid even if the variable was undefined * and unused. */ @@ -2666,7 +2869,7 @@ Tcl_LappendObjCmd( if (arrayPtr && TclIsVarInHash(arrayPtr)) { VarHashRefCount(arrayPtr)++; } - varValuePtr = TclPtrGetVar(interp, varPtr, arrayPtr, objv[1], NULL, + varValuePtr = TclPtrGetVarIdx(interp, varPtr, arrayPtr, objv[1], NULL, TCL_LEAVE_ERR_MSG, -1); if (TclIsVarInHash(varPtr)) { VarHashRefCount(varPtr)--; @@ -2707,7 +2910,7 @@ Tcl_LappendObjCmd( * and we didn't create the variable. */ - newValuePtr = TclPtrSetVar(interp, varPtr, arrayPtr, objv[1], NULL, + newValuePtr = TclPtrSetVarIdx(interp, varPtr, arrayPtr, objv[1], NULL, varValuePtr, TCL_LEAVE_ERR_MSG, -1); if (newValuePtr == NULL) { return TCL_ERROR; @@ -2808,7 +3011,7 @@ TclArraySet( keyPtr, TCL_LEAVE_ERR_MSG, "set", 1, 1, varPtr, -1); if ((elemVarPtr == NULL) || - (TclPtrSetVar(interp, elemVarPtr, varPtr, arrayNameObj, + (TclPtrSetVarIdx(interp, elemVarPtr, varPtr, arrayNameObj, keyPtr, valuePtr, TCL_LEAVE_ERR_MSG, -1) == NULL)) { Tcl_DictObjDone(&search); return TCL_ERROR; @@ -2841,8 +3044,8 @@ TclArraySet( /* * We needn't worry about traces invalidating arrayPtr: should that be - * the case, TclPtrSetVar will return NULL so that we break out of the - * loop and return an error. + * the case, TclPtrSetVarIdx will return NULL so that we break out of + * the loop and return an error. */ copyListObj = TclListObjCopy(NULL, arrayElemObj); @@ -2851,7 +3054,7 @@ TclArraySet( elemPtrs[i], TCL_LEAVE_ERR_MSG, "set", 1, 1, varPtr, -1); if ((elemVarPtr == NULL) || - (TclPtrSetVar(interp, elemVarPtr, varPtr, arrayNameObj, + (TclPtrSetVarIdx(interp, elemVarPtr, varPtr, arrayNameObj, elemPtrs[i],elemPtrs[i+1],TCL_LEAVE_ERR_MSG,-1) == NULL)){ result = TCL_ERROR; break; @@ -4078,8 +4281,8 @@ ArrayUnsetCmd( if (!varPtr2 || TclIsVarUndefined(varPtr2)) { return TCL_OK; } - return TclPtrUnsetVar(interp, varPtr2, varPtr, varNameObj, patternObj, - unsetFlags, -1); + return TclPtrUnsetVarIdx(interp, varPtr2, varPtr, varNameObj, + patternObj, unsetFlags, -1); } /* @@ -4127,7 +4330,7 @@ ArrayUnsetCmd( nameObj = VarHashGetKey(varPtr2); if (Tcl_StringMatch(TclGetString(nameObj), pattern) - && TclPtrUnsetVar(interp, varPtr2, varPtr, varNameObj, + && TclPtrUnsetVarIdx(interp, varPtr2, varPtr, varNameObj, nameObj, unsetFlags, -1) != TCL_OK) { /* * If we incremented a refcount, we must decrement it here as we @@ -4274,7 +4477,7 @@ ObjMakeUpvar( } } - return TclPtrObjMakeUpvar(interp, otherPtr, myNamePtr, myFlags, index); + return TclPtrObjMakeUpvarIdx(interp, otherPtr, myNamePtr, myFlags, index); } /* @@ -4316,17 +4519,32 @@ TclPtrMakeUpvar( myNamePtr = Tcl_NewStringObj(myName, -1); Tcl_IncrRefCount(myNamePtr); } - result = TclPtrObjMakeUpvar(interp, otherPtr, myNamePtr, myFlags, index); + result = TclPtrObjMakeUpvarIdx(interp, otherPtr, myNamePtr, myFlags, + index); if (myNamePtr) { Tcl_DecrRefCount(myNamePtr); } return result; } +int +TclPtrObjMakeUpvar( + Tcl_Interp *interp, /* Interpreter containing variables. Used for + * error messages, too. */ + Tcl_Var otherPtr, /* Pointer to the variable being linked-to. */ + Tcl_Obj *myNamePtr, /* Name of variable which will refer to + * otherP1/otherP2. Must be a scalar. */ + int myFlags) /* 0, TCL_GLOBAL_ONLY or TCL_NAMESPACE_ONLY: + * indicates scope of myName. */ +{ + return TclPtrObjMakeUpvarIdx(interp, (Var *) otherPtr, myNamePtr, myFlags, + -1); +} + /* Callers must Incr myNamePtr if they plan to Decr it. */ int -TclPtrObjMakeUpvar( +TclPtrObjMakeUpvarIdx( Tcl_Interp *interp, /* Interpreter containing variables. Used for * error messages, too. */ Var *otherPtr, /* Pointer to the variable being linked-to. */ @@ -4793,8 +5011,9 @@ Tcl_VariableObjCmd( */ if (i+1 < objc) { /* A value was specified. */ - varValuePtr = TclPtrSetVar(interp, varPtr, arrayPtr, varNamePtr, - NULL, objv[i+1], TCL_NAMESPACE_ONLY|TCL_LEAVE_ERR_MSG,-1); + varValuePtr = TclPtrSetVarIdx(interp, varPtr, arrayPtr, + varNamePtr, NULL, objv[i+1], + (TCL_NAMESPACE_ONLY | TCL_LEAVE_ERR_MSG), -1); if (varValuePtr == NULL) { return TCL_ERROR; } -- cgit v0.12 From 73a3dfdeeabb1a43c73101b4b6a9826f83866b32 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 7 Jun 2017 15:18:38 +0000 Subject: Tcl_GetWideIntFromObj() -> TclGetWideIntFromObj(), and minor other simplifications/optimizations. No functional change. --- generic/tclBasic.c | 10 +++---- generic/tclClock.c | 29 ++++++++---------- generic/tclCmdMZ.c | 2 +- macosx/tclMacOSXFCmd.c | 2 +- tests/clock.test | 80 +++++++++++++++++++++++++------------------------- 5 files changed, 60 insertions(+), 63 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 0486383..14d67f6 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3543,7 +3543,7 @@ OldMathFuncProc( args[k].type = TCL_INT; break; } - if (Tcl_GetWideIntFromObj(interp, valuePtr, &args[k].wideValue) + if (TclGetWideIntFromObj(interp, valuePtr, &args[k].wideValue) == TCL_OK) { args[k].type = TCL_WIDE_INT; break; @@ -3569,7 +3569,7 @@ OldMathFuncProc( return TCL_ERROR; } valuePtr = Tcl_GetObjResult(interp); - Tcl_GetWideIntFromObj(NULL, valuePtr, &args[k].wideValue); + TclGetWideIntFromObj(NULL, valuePtr, &args[k].wideValue); Tcl_ResetResult(interp); break; } @@ -7174,7 +7174,7 @@ ExprIsqrtFunc( } break; default: - if (Tcl_GetWideIntFromObj(interp, objv[1], &w) != TCL_OK) { + if (TclGetWideIntFromObj(interp, objv[1], &w) != TCL_OK) { return TCL_ERROR; } if (w < 0) { @@ -7617,7 +7617,7 @@ ExprWideFunc( return TCL_ERROR; } objPtr = Tcl_GetObjResult(interp); - if (Tcl_GetWideIntFromObj(NULL, objPtr, &wResult) != TCL_OK) { + if (TclGetWideIntFromObj(NULL, objPtr, &wResult) != TCL_OK) { /* * Truncate the bignum; keep only bits in wide int range. */ @@ -7628,7 +7628,7 @@ ExprWideFunc( mp_mod_2d(&big, (int) CHAR_BIT * sizeof(Tcl_WideInt), &big); objPtr = Tcl_NewBignumObj(&big); Tcl_IncrRefCount(objPtr); - Tcl_GetWideIntFromObj(NULL, objPtr, &wResult); + TclGetWideIntFromObj(NULL, objPtr, &wResult); Tcl_DecrRefCount(objPtr); } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(wResult)); diff --git a/generic/tclClock.c b/generic/tclClock.c index 02b2845..bbfc83b 100644 --- a/generic/tclClock.c +++ b/generic/tclClock.c @@ -91,8 +91,8 @@ static const char *const literals[] = { * Structure containing the client data for [clock] */ -typedef struct ClockClientData { - int refCount; /* Number of live references. */ +typedef struct { + size_t refCount; /* Number of live references. */ Tcl_Obj **literals; /* Pool of object literals. */ } ClockClientData; @@ -363,7 +363,7 @@ ClockConvertlocaltoutcObjCmd( "found in dictionary", -1)); return TCL_ERROR; } - if ((Tcl_GetWideIntFromObj(interp, secondsObj, + if ((TclGetWideIntFromObj(interp, secondsObj, &fields.localSeconds) != TCL_OK) || (TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK) || ConvertLocalToUTC(interp, &fields, objv[2], changeover)) { @@ -442,7 +442,7 @@ ClockGetdatefieldsObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "seconds tzdata changeover"); return TCL_ERROR; } - if (Tcl_GetWideIntFromObj(interp, objv[1], &fields.seconds) != TCL_OK + if (TclGetWideIntFromObj(interp, objv[1], &fields.seconds) != TCL_OK || TclGetIntFromObj(interp, objv[3], &changeover) != TCL_OK) { return TCL_ERROR; } @@ -1148,7 +1148,7 @@ LookupLastTransition( */ if (Tcl_ListObjIndex(interp, rowv[0], 0, &compObj) != TCL_OK - || Tcl_GetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { + || TclGetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { return NULL; } @@ -1171,7 +1171,7 @@ LookupLastTransition( int m = (l + u + 1) / 2; if (Tcl_ListObjIndex(interp, rowv[m], 0, &compObj) != TCL_OK || - Tcl_GetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { + TclGetWideIntFromObj(interp, compObj, &compVal) != TCL_OK) { return NULL; } if (tick >= compVal) { @@ -1521,9 +1521,9 @@ GetJulianDayFromEraYearMonthDay( * See above bug for details. The casts are necessary. */ if (ym1 >= 0) - ym1o4 = ym1 / 4; + ym1o4 = ym1 / 4; else { - ym1o4 = - (int) (((unsigned int) -ym1) / 4); + ym1o4 = - (int) (((unsigned int) -ym1) / 4); } #endif if (ym1 % 4 < 0) { @@ -1578,12 +1578,10 @@ static int IsGregorianLeapYear( TclDateFields *fields) /* Date to test */ { - int year; + int year = fields->year; if (fields->era == BCE) { - year = 1 - fields->year; - } else { - year = fields->year; + year = 1 - year; } if (year%4 != 0) { return 0; @@ -1694,7 +1692,7 @@ ThreadSafeLocalTime( * Get a thread-local buffer to hold the returned time. */ - struct tm *tmPtr = Tcl_GetThreadData(&tmKey, (int) sizeof(struct tm)); + struct tm *tmPtr = Tcl_GetThreadData(&tmKey, sizeof(struct tm)); #ifdef HAVE_LOCALTIME_R localtime_r(timePtr, tmPtr); #else @@ -1950,7 +1948,7 @@ ClockParseformatargsObjCmd( * Check options. */ - if (Tcl_GetWideIntFromObj(interp, objv[1], &clockVal) != TCL_OK) { + if (TclGetWideIntFromObj(interp, objv[1], &clockVal) != TCL_OK) { return TCL_ERROR; } if ((saw & (1 << CLOCK_FORMAT_GMT)) @@ -2074,8 +2072,7 @@ ClockDeleteCmdProc( ClockClientData *data = clientData; int i; - data->refCount--; - if (data->refCount == 0) { + if (data->refCount-- <= 1) { for (i = 0; i < LIT__END; ++i) { Tcl_DecrRefCount(data->literals[i]); } diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 885a0bc..3f79ca4 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1646,7 +1646,7 @@ StringIsCmd( } break; case STR_IS_WIDE: - if (TCL_OK == Tcl_GetWideIntFromObj(NULL, objPtr, &w)) { + if (TCL_OK == TclGetWideIntFromObj(NULL, objPtr, &w)) { break; } diff --git a/macosx/tclMacOSXFCmd.c b/macosx/tclMacOSXFCmd.c index 8ecfd0b..f34b280 100644 --- a/macosx/tclMacOSXFCmd.c +++ b/macosx/tclMacOSXFCmd.c @@ -319,7 +319,7 @@ TclMacOSXSetFileAttribute( } else { Tcl_WideInt newRsrcForkSize; - if (Tcl_GetWideIntFromObj(interp, attributePtr, + if (TclGetWideIntFromObj(interp, attributePtr, &newRsrcForkSize) != TCL_OK) { return TCL_ERROR; } diff --git a/tests/clock.test b/tests/clock.test index 4e44348..b1afa39 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -35,9 +35,9 @@ testConstraint y2038 \ # TEST PLAN # clock-1: -# [clock format] - tests of bad and empty arguments +# [clock format] - tests of bad and empty arguments # -# clock-2 +# clock-2 # formatting of year, month and day of month # # clock-3 @@ -195,7 +195,7 @@ namespace eval ::tcl::clock { l li lii liii liv lv lvi lvii lviii lix lx lxi lxii lxiii lxiv lxv lxvi lxvii lxviii lxix lxx lxxi lxxii lxxiii lxxiv lxxv lxxvi lxxvii lxxviii lxxix - lxxx lxxxi lxxxii lxxxiii lxxxiv lxxxv lxxxvi lxxxvii lxxxviii + lxxx lxxxi lxxxii lxxxiii lxxxiv lxxxv lxxxvi lxxxvii lxxxviii lxxxix xc xci xcii xciii xciv xcv xcvi xcvii xcviii xcix c @@ -271,7 +271,7 @@ test clock-1.3 "clock format - empty val" { test clock-1.4 "clock format - bad flag" {*}{ -body { list [catch {clock format 0 -oops badflag} msg] $msg $::errorCode - } + } -match glob -result {1 {bad option "-oops": must be -format, -gmt, -locale, or -timezone} {CLOCK badOption -oops}} } @@ -35221,7 +35221,7 @@ test clock-30.25 {clock add seconds at DST conversion} { test clock-31.1 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35244,7 +35244,7 @@ test clock-31.1 {system locale} \ test clock-31.2 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35267,7 +35267,7 @@ test clock-31.2 {system locale} \ test clock-31.3 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35290,7 +35290,7 @@ test clock-31.3 {system locale} \ test clock-31.4 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35327,7 +35327,7 @@ test clock-31.4 {system locale} \ test clock-31.5 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35364,7 +35364,7 @@ test clock-31.5 {system locale} \ test clock-31.6 {system locale} \ -constraints win \ - -setup { + -setup { namespace eval ::tcl::clock { namespace import -force ::testClock::registry } @@ -35434,7 +35434,7 @@ test clock-32.1 {scan/format across the Gregorian change} { } set problems } {} - + # Legacy tests # clock clicks @@ -35468,7 +35468,7 @@ test clock-33.5 {clock clicks tests, millisecond timing test} { # 60 msecs seems to be the max time slice under Windows 95/98 expr { ($end > $start) && (($end - $start) <= 60) ? - "ok" : + "ok" : "test should have taken 0-60 ms, actually took [expr $end - $start]"} } {ok} test clock-33.5a {clock tests, millisecond timing test} { @@ -35480,7 +35480,7 @@ test clock-33.5a {clock tests, millisecond timing test} { # 60 msecs seems to be the max time slice under Windows 95/98 expr { ($end > $start) && (($end - $start) <= 60) ? - "ok" : + "ok" : "test should have taken 0-60 ms, actually took [expr $end - $start]"} } {ok} test clock-33.6 {clock clicks, milli with too much abbreviation} { @@ -35804,31 +35804,31 @@ test clock-34.47 {ago with multiple relative units} { } 180000 test clock-34.48 {more than one ToD} {*}{ - -body {clock scan {10:00 11:00}} + -body {clock scan {10:00 11:00}} -returnCodes error -result {unable to convert date-time string "10:00 11:00": more than one time of day in string} } test clock-34.49 {more than one date} {*}{ - -body {clock scan {1/1/2001 2/2/2002}} + -body {clock scan {1/1/2001 2/2/2002}} -returnCodes error -result {unable to convert date-time string "1/1/2001 2/2/2002": more than one date in string} } test clock-34.50 {more than one time zone} {*}{ - -body {clock scan {10:00 EST CST}} + -body {clock scan {10:00 EST CST}} -returnCodes error -result {unable to convert date-time string "10:00 EST CST": more than one time zone in string} } test clock-34.51 {more than one weekday} {*}{ - -body {clock scan {Monday Tuesday}} + -body {clock scan {Monday Tuesday}} -returnCodes error -result {unable to convert date-time string "Monday Tuesday": more than one weekday in string} } test clock-34.52 {more than one ordinal month} {*}{ - -body {clock scan {next January next March}} + -body {clock scan {next January next March}} -returnCodes error -result {unable to convert date-time string "next January next March": more than one ordinal month in string} } @@ -35924,7 +35924,7 @@ test clock-38.2 {make sure TZ is not cached after unset} \ } } \ -result 1 - + test clock-39.1 {regression - synonym timezones} { clock format 0 -format {%H:%M:%S} -timezone :US/Eastern @@ -35996,7 +35996,7 @@ test clock-44.1 {regression test - time zone name containing hyphen } \ } } \ -result {12:34:56-0500} - + test clock-45.1 {regression test - time zone containing only two digits} \ -body { clock scan 1985-04-12T10:15:30+04 -format %Y-%m-%dT%H:%M:%S%Z @@ -36041,7 +36041,7 @@ test clock-48.1 {Bug 1185933: 'i' destroyed by clock init} -setup { test clock-49.1 {regression test - localtime with negative arg (Bug 1237907)} \ -body { - list [catch { + list [catch { clock format -86400 -timezone :localtime -format %Y } result] $result } \ @@ -36280,7 +36280,7 @@ test clock-56.1 {use of zoneinfo, version 1} {*}{ } -result {2004-01-01 00:00:00 MST} } - + test clock-56.2 {use of zoneinfo, version 2} {*}{ -setup { clock format [clock seconds] @@ -36330,7 +36330,7 @@ test clock-56.2 {use of zoneinfo, version 2} {*}{ removeFile PhoenixTwo $tzdir2 removeDirectory Test $tzdir removeDirectory zoneinfo - } + } -body { clock format 1072940400 -timezone :Test/PhoenixTwo \ -format {%Y-%m-%d %H:%M:%S %Z} @@ -36540,7 +36540,7 @@ test clock-56.3 {use of zoneinfo, version 2, Y2038 compliance} {*}{ removeFile TijuanaTwo $tzdir2 removeDirectory Test $tzdir removeDirectory zoneinfo - } + } -body { clock format 2224738800 -timezone :Test/TijuanaTwo \ -format {%Y-%m-%d %H:%M:%S %Z} @@ -36692,7 +36692,7 @@ test clock-56.4 {Bug 3470928} {*}{ removeFile Windhoek $tzdir2 removeDirectory Test $tzdir removeDirectory zoneinfo - } + } -result {Sun Jan 08 22:30:06 WAST 2012} } @@ -36703,7 +36703,7 @@ test clock-57.1 {clock scan - abbreviated options} { test clock-58.1 {clock l10n - Japanese localisation} {*}{ -setup { proc backslashify { string } { - + set retval {} foreach char [split $string {}] { scan $char %c ccode @@ -36809,52 +36809,52 @@ test clock-59.1 {military time zones} { test clock-60.1 {case insensitive weekday names} { clock scan "2000-W01 monday" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] test clock-60.2 {case insensitive weekday names} { clock scan "2000-W01 Monday" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] test clock-60.3 {case insensitive weekday names} { clock scan "2000-W01 MONDAY" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"] test clock-60.4 {case insensitive weekday names} { clock scan "2000-W01 friday" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] test clock-60.5 {case insensitive weekday names} { clock scan "2000-W01 Friday" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] test clock-60.6 {case insensitive weekday names} { clock scan "2000-W01 FRIDAY" -gmt true -format "%G-W%V %a" -} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] +} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"] test clock-60.7 {case insensitive month names} { clock scan "1 january 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] test clock-60.8 {case insensitive month names} { clock scan "1 January 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] test clock-60.9 {case insensitive month names} { clock scan "1 JANUARY 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"] test clock-60.10 {case insensitive month names} { clock scan "1 december 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] test clock-60.11 {case insensitive month names} { clock scan "1 December 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] test clock-60.12 {case insensitive month names} { clock scan "1 DECEMBER 2000" -gmt true -format "%d %b %Y" -} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] +} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"] test clock-61.1 {overflow of a wide integer on output} {*}{ -body { clock format 0x8000000000000000 -format %s -gmt true - } + } -result {integer value too large to represent} -returnCodes error } test clock-61.2 {overflow of a wide integer on output} {*}{ -body { clock format -0x8000000000000001 -format %s -gmt true - } + } -result {integer value too large to represent} -returnCodes error } -- cgit v0.12 From 16f3f234e8500f5f71e4d9321689a8bdf9efc809 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 8 Jun 2017 08:26:58 +0000 Subject: Better UTF-8 surrogate handling, only functional when TCL_UTF_MAX>3 --- generic/tclBinary.c | 6 ++--- generic/tclCmdIL.c | 2 +- generic/tclCmdMZ.c | 10 ++++---- generic/tclCompExpr.c | 2 +- generic/tclEncoding.c | 20 +++++++-------- generic/tclLoad.c | 2 +- generic/tclParse.c | 2 +- generic/tclScan.c | 2 +- generic/tclStringObj.c | 4 +-- generic/tclUtf.c | 68 ++++++++++++++++++++++++++++++++++++-------------- generic/tclUtil.c | 2 +- win/tclWinPipe.c | 2 +- 12 files changed, 76 insertions(+), 46 deletions(-) diff --git a/generic/tclBinary.c b/generic/tclBinary.c index d0d9d5e..bb918f2 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -454,7 +454,7 @@ SetByteArrayFromAny( const char *src, *srcEnd; unsigned char *dst; ByteArray *byteArrayPtr; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; if (objPtr->typePtr != &tclByteArrayType) { src = TclGetStringFromObj(objPtr, &length); @@ -1210,7 +1210,7 @@ BinaryFormatCmd( badField: { - Tcl_UniChar ch; + Tcl_UniChar ch = 0; char buf[TCL_UTF_MAX + 1]; TclUtfToUniChar(errorString, &ch); @@ -1580,7 +1580,7 @@ BinaryScanCmd( badField: { - Tcl_UniChar ch; + Tcl_UniChar ch = 0; char buf[TCL_UTF_MAX + 1]; TclUtfToUniChar(errorString, &ch); diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index ba9e1cf..e3c5f10 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -4345,7 +4345,7 @@ static int DictionaryCompare( const char *left, const char *right) /* The strings to compare. */ { - Tcl_UniChar uniLeft, uniRight, uniLeftLower, uniRightLower; + Tcl_UniChar uniLeft = 0, uniRight = 0, uniLeftLower, uniRightLower; int diff, zeros; int secondaryDiff = 0; diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 3f79ca4..7010495 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1037,7 +1037,7 @@ Tcl_SplitObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tcl_UniChar ch; + Tcl_UniChar ch = 0; int len; const char *splitChars; const char *stringPtr; @@ -1122,7 +1122,7 @@ Tcl_SplitObjCmd( } else { const char *element, *p, *splitEnd; int splitLen; - Tcl_UniChar splitChar; + Tcl_UniChar splitChar = 0; /* * Normal case: split on any of a given set of characters. Discard @@ -1451,7 +1451,7 @@ StringIsCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { const char *string1, *end, *stop; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; int (*chcomp)(int) = NULL; /* The UniChar comparison function. */ int i, failat = 0, result = 1, strict = 0, index, length1, length2; Tcl_Obj *objPtr, *failVarObj = NULL; @@ -2436,7 +2436,7 @@ StringStartCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tcl_UniChar ch; + Tcl_UniChar ch = 0; const char *p, *string; int cur, index, length, numChars; @@ -2497,7 +2497,7 @@ StringEndCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tcl_UniChar ch; + Tcl_UniChar ch = 0; const char *p, *end, *string; int cur, index, length, numChars; diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c index 59eecf9..9c7ab8d 100644 --- a/generic/tclCompExpr.c +++ b/generic/tclCompExpr.c @@ -1885,7 +1885,7 @@ ParseLexeme( { const char *end; int scanned; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; Tcl_Obj *literal = NULL; unsigned char byte; diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index b4acb5f..8450128 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2296,7 +2296,7 @@ UtfToUtfProc( const char *srcStart, *srcEnd, *srcClose; const char *dstStart, *dstEnd; int result, numChars, charLimit = INT_MAX; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; result = TCL_OK; @@ -2345,8 +2345,8 @@ UtfToUtfProc( } else if (!Tcl_UtfCharComplete(src, srcEnd - src)) { /* * Always check before using TclUtfToUniChar. Not doing can so - * cause it run beyond the endof the buffer! If we happen such an - * incomplete char its byts are made to represent themselves. + * cause it run beyond the end of the buffer! If we happen such an + * incomplete char its bytes are made to represent themselves. */ ch = (unsigned char) *src; @@ -2410,7 +2410,7 @@ UnicodeToUtfProc( const char *srcStart, *srcEnd; const char *dstEnd, *dstStart; int result, numChars, charLimit = INT_MAX; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; if (flags & TCL_ENCODING_CHAR_LIMIT) { charLimit = *dstCharsPtr; @@ -2500,7 +2500,7 @@ UtfToUnicodeProc( { const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd; int result, numChars; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; srcStart = src; srcEnd = src + srcLen; @@ -2610,7 +2610,7 @@ TableToUtfProc( const char *srcStart, *srcEnd; const char *dstEnd, *dstStart, *prefixBytes; int result, byte, numChars, charLimit = INT_MAX; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; const unsigned short *const *toUnicode; const unsigned short *pageZero; TableEncodingData *dataPtr = clientData; @@ -2722,7 +2722,7 @@ TableFromUtfProc( { const char *srcStart, *srcEnd, *srcClose; const char *dstStart, *dstEnd, *prefixBytes; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; int result, len, word, numChars; TableEncodingData *dataPtr = clientData; const unsigned short *const *fromUnicode; @@ -2856,7 +2856,7 @@ Iso88591ToUtfProc( result = TCL_OK; for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) { - Tcl_UniChar ch; + Tcl_UniChar ch = 0; if (dst > dstEnd) { result = TCL_CONVERT_NOSPACE; @@ -2942,7 +2942,7 @@ Iso88591FromUtfProc( dstEnd = dst + dstLen - 1; for (numChars = 0; src < srcEnd; numChars++) { - Tcl_UniChar ch; + Tcl_UniChar ch = 0; int len; if ((src > srcClose) && (!Tcl_UtfCharComplete(src, srcEnd - src))) { @@ -3329,7 +3329,7 @@ EscapeFromUtfProc( for (numChars = 0; src < srcEnd; numChars++) { unsigned len; int word; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; if ((src > srcClose) && (!Tcl_UtfCharComplete(src, srcEnd - src))) { /* diff --git a/generic/tclLoad.c b/generic/tclLoad.c index 942e6b4..f1bd248 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -130,7 +130,7 @@ Tcl_LoadObjCmd( Tcl_PackageInitProc *initProc; const char *p, *fullFileName, *packageName; Tcl_LoadHandle loadHandle; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; unsigned len; int index, flags = 0; Tcl_Obj *const *savedobjv = objv; diff --git a/generic/tclParse.c b/generic/tclParse.c index 3ecf4a5..f2cf322 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -841,7 +841,7 @@ TclParseBackslash( * written there. */ { register const char *p = src+1; - Tcl_UniChar unichar; + Tcl_UniChar unichar = 0; int result; int count; char buf[TCL_UTF_MAX]; diff --git a/generic/tclScan.c b/generic/tclScan.c index 17069eb..7a6a8a2 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -257,7 +257,7 @@ ValidateFormat( { int gotXpg, gotSequential, value, i, flags; char *end; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; int objIndex, xpgSize, nspace = numVars; int *nassign = TclStackAlloc(interp, nspace * sizeof(int)); char buf[TCL_UTF_MAX+1]; diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 4a3b6f1..0cafffb 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1709,7 +1709,7 @@ Tcl_AppendFormatToObj( #endif int newXpg, numChars, allocSegment = 0, segmentLimit, segmentNumBytes; Tcl_Obj *segment; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; int step = TclUtfToUniChar(format, &ch); format += step; @@ -2693,7 +2693,7 @@ TclStringObjReverse( Tcl_Obj *objPtr) { String *stringPtr; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; if (TclIsPureByteArray(objPtr)) { int numBytes; diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 52b4291..db941e2 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -134,7 +134,7 @@ UtfCount( *--------------------------------------------------------------------------- */ -INLINE int +int Tcl_UniCharToUtf( int ch, /* The Tcl_UniChar to be stored in the * buffer. */ @@ -259,6 +259,15 @@ Tcl_UniCharToUtfDString( * Tcl_UtfCharComplete() before calling this routine to ensure that * enough bytes remain in the string. * + * If TCL_UTF_MAX == 4, special handling of Surrogate pairs is done: + * For any UTF-8 string containing a character outside of the BMP, the + * first call to this function will fill *chPtr with the high surrogate + * and generate a return value of 0. Calling Tcl_UtfToUniChar again + * will produce the low surrogate and a return value of 4. Because *chPtr + * is used to remember whether the high surrogate is already produced, it + * is recommended to initialize the variable it points to as 0 before + * the first call to Tcl_UtfToUniChar is done. + * * Results: * *chPtr is filled with the Tcl_UniChar, and the return value is the * number of bytes from the UTF-8 string that were consumed. @@ -278,7 +287,7 @@ Tcl_UtfToUniChar( register int byte; /* - * Unroll 1 to 3 byte UTF-8 sequences, use loop to handle longer ones. + * Unroll 1 to 3 (or 4) byte UTF-8 sequences. */ byte = *((unsigned char *) src); @@ -331,12 +340,30 @@ Tcl_UtfToUniChar( /* * Four-byte-character lead byte followed by three trail bytes. */ - +#if TCL_UTF_MAX == 4 + Tcl_UniChar surrogate; + + byte = (((byte & 0x07) << 18) | ((src[1] & 0x3F) << 12) + | ((src[2] & 0x3F) << 6) | (src[3] & 0x3F)) - 0x10000; + surrogate = (Tcl_UniChar) (0xD800 + (byte >> 10)); + if (byte & 0x100000) { + /* out of range, < 0x10000 or > 0x10ffff */ + } else if (*chPtr != surrogate) { + /* produce high surrogate, but don't advance source pointer */ + *chPtr = surrogate; + return 0; + } else { + /* produce low surrogate, and advance source pointer */ + *chPtr = (Tcl_UniChar) (0xDC00 | (byte & 0x3FF)); + return 4; + } +#else *chPtr = (Tcl_UniChar) (((byte & 0x07) << 18) | ((src[1] & 0x3F) << 12) | ((src[2] & 0x3F) << 6) | (src[3] & 0x3F)); if ((unsigned)(*chPtr - 0x10000) <= 0xFFFFF) { return 4; } +#endif } /* @@ -377,7 +404,7 @@ Tcl_UtfToUniCharDString( * appended to this previously initialized * DString. */ { - Tcl_UniChar *w, *wString; + Tcl_UniChar ch, *w, *wString; const char *p, *end; int oldLength; @@ -399,8 +426,8 @@ Tcl_UtfToUniCharDString( w = wString; end = src + length; for (p = src; p < end; ) { - p += TclUtfToUniChar(p, w); - w++; + p += TclUtfToUniChar(p, &ch); + *w++ = ch; } *w = '\0'; Tcl_DStringSetLength(dsPtr, @@ -434,9 +461,8 @@ Tcl_UtfCharComplete( * a complete UTF-8 character. */ int length) /* Length of above string in bytes. */ { - int ch; + int ch = *((unsigned char *) src); - ch = *((unsigned char *) src); return length >= totalBytes[ch]; } @@ -464,8 +490,7 @@ Tcl_NumUtfChars( int length) /* The length of the string in bytes, or -1 * for strlen(string). */ { - Tcl_UniChar ch; - register Tcl_UniChar *chPtr = &ch; + Tcl_UniChar ch = 0; register int i; /* @@ -478,7 +503,7 @@ Tcl_NumUtfChars( i = 0; if (length < 0) { while (*src != '\0') { - src += TclUtfToUniChar(src, chPtr); + src += TclUtfToUniChar(src, &ch); i++; } } else { @@ -489,7 +514,7 @@ Tcl_NumUtfChars( length--; src++; } else { - n = Tcl_UtfToUniChar(src, chPtr); + n = Tcl_UtfToUniChar(src, &ch); length -= n; src += n; } @@ -524,7 +549,7 @@ Tcl_UtfFindFirst( int ch) /* The Tcl_UniChar to search for. */ { int len; - Tcl_UniChar find; + Tcl_UniChar find = 0; while (1) { len = TclUtfToUniChar(src, &find); @@ -563,7 +588,7 @@ Tcl_UtfFindLast( int ch) /* The Tcl_UniChar to search for. */ { int len; - Tcl_UniChar find; + Tcl_UniChar find = 0; const char *last; last = NULL; @@ -603,9 +628,15 @@ const char * Tcl_UtfNext( const char *src) /* The current location in the string. */ { - Tcl_UniChar ch; + Tcl_UniChar ch = 0; + int len = TclUtfToUniChar(src, &ch); - return src + TclUtfToUniChar(src, &ch); +#if TCL_UTF_MAX == 4 + if (len == 0) { + len = TclUtfToUniChar(src, &ch); + } +#endif + return src + len; } /* @@ -638,8 +669,7 @@ Tcl_UtfPrev( const char *look; int i, byte; - src--; - look = src; + look = --src; for (i = 0; i < TCL_UTF_MAX; i++) { if (look < start) { if (src < start) { @@ -712,7 +742,7 @@ Tcl_UtfAtIndex( register const char *src, /* The UTF-8 string. */ register int index) /* The position of the desired character. */ { - Tcl_UniChar ch; + Tcl_UniChar ch = 0; while (index > 0) { index--; diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 553593c..0eddb00 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1646,7 +1646,7 @@ Tcl_Backslash( * src, unless NULL. */ { char buf[TCL_UTF_MAX]; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; Tcl_UtfBackslash(src, readPtr, buf); TclUtfToUniChar(buf, &ch); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index fe0ed2d..4b372a5 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1479,7 +1479,7 @@ BuildCommandLine( quote = 1; } else { int count; - Tcl_UniChar ch; + Tcl_UniChar ch = 0; for (start = arg; *start != '\0'; start += count) { count = TclUtfToUniChar(start, &ch); -- cgit v0.12 From 9562ecd7fa7b25bf6e8e37f5977c81336fd46c06 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 8 Jun 2017 11:48:13 +0000 Subject: tclUtil.c: Use TclUtfToUniChar() in stead of handling ASCII characters separately: This macro already does that. Add new test-case for Tcl_NumUtfChars(), for a knownBug still to be fixed. --- generic/tclTest.c | 2 +- generic/tclUtil.c | 47 ++++++++++++----------------------------------- tests/utf.test | 11 +++++++---- 3 files changed, 20 insertions(+), 40 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index f2dbfc9..e8539e8 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -6672,7 +6672,7 @@ TestNumUtfCharsCmd( int len = -1; if (objc > 2) { - (void) Tcl_GetStringFromObj(objv[1], &len); + (void) Tcl_GetIntFromObj(interp, objv[2], &len); } len = Tcl_NumUtfChars(Tcl_GetString(objv[1]), len); Tcl_SetObjResult(interp, Tcl_NewIntObj(len)); diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 553593c..3fdf54b 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2162,14 +2162,9 @@ Tcl_StringCaseMatch( * This is a special case optimization for single-byte utf. */ - if (UCHAR(*pattern) < 0x80) { - ch2 = (Tcl_UniChar) - (nocase ? tolower(UCHAR(*pattern)) : UCHAR(*pattern)); - } else { - Tcl_UtfToUniChar(pattern, &ch2); - if (nocase) { - ch2 = Tcl_UniCharToLower(ch2); - } + TclUtfToUniChar(pattern, &ch2); + if (nocase) { + ch2 = Tcl_UniCharToLower(ch2); } while (1) { @@ -2235,44 +2230,26 @@ Tcl_StringCaseMatch( 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); - } + str += TclUtfToUniChar(str, &ch1); + if (nocase) { + ch1 = Tcl_UniCharToLower(ch1); } while (1) { if ((*pattern == ']') || (*pattern == '\0')) { return 0; } - if (UCHAR(*pattern) < 0x80) { - startChar = (Tcl_UniChar) (nocase - ? tolower(UCHAR(*pattern)) : UCHAR(*pattern)); - pattern++; - } else { - pattern += Tcl_UtfToUniChar(pattern, &startChar); - if (nocase) { - startChar = Tcl_UniCharToLower(startChar); - } + pattern += TclUtfToUniChar(pattern, &startChar); + if (nocase) { + startChar = Tcl_UniCharToLower(startChar); } if (*pattern == '-') { pattern++; if (*pattern == '\0') { return 0; } - if (UCHAR(*pattern) < 0x80) { - endChar = (Tcl_UniChar) (nocase - ? tolower(UCHAR(*pattern)) : UCHAR(*pattern)); - pattern++; - } else { - pattern += Tcl_UtfToUniChar(pattern, &endChar); - if (nocase) { - endChar = Tcl_UniCharToLower(endChar); - } + pattern += TclUtfToUniChar(pattern, &endChar); + if (nocase) { + endChar = Tcl_UniCharToLower(endChar); } if (((startChar <= ch1) && (ch1 <= endChar)) || ((endChar <= ch1) && (ch1 <= startChar))) { diff --git a/tests/utf.test b/tests/utf.test index 28981d6..f677438 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -99,17 +99,20 @@ test utf-4.4 {Tcl_NumUtfChars: #u0000} {testnumutfchars testbytestring} { testnumutfchars [testbytestring "\xC0\x80"] } {1} test utf-4.5 {Tcl_NumUtfChars: zero length, calc len} testnumutfchars { - testnumutfchars "" 1 + testnumutfchars "" 0 } {0} test utf-4.6 {Tcl_NumUtfChars: length 1, calc len} {testnumutfchars testbytestring} { - testnumutfchars [testbytestring "\xC2\xA2"] 1 + testnumutfchars [testbytestring "\xC2\xA2"] 2 } {1} test utf-4.7 {Tcl_NumUtfChars: long string, calc len} {testnumutfchars testbytestring} { - testnumutfchars [testbytestring "abc\xC2\xA2\xe4\xb9\x8e\uA2\u4e4e"] 1 + testnumutfchars [testbytestring "abc\xC2\xA2\xe4\xb9\x8e\uA2\u4e4e"] 10 } {7} test utf-4.8 {Tcl_NumUtfChars: #u0000, calc len} {testnumutfchars testbytestring} { - testnumutfchars [testbytestring "\xC0\x80"] 1 + testnumutfchars [testbytestring "\xC0\x80"] 2 } {1} +test utf-4.9 {Tcl_NumUtfChars: #u20AC, calc len, incomplete} {knownBug testnumutfchars testbytestring} { + testnumutfchars [testbytestring "\xE2\x82\xAC"] 2 +} {2} test utf-5.1 {Tcl_UtfFindFirsts} { } {} -- cgit v0.12 From c2e241f3cd55724eab1119f8bc9719d6306df7f5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 8 Jun 2017 12:34:08 +0000 Subject: Fix [2738427]: Tcl_NumUtfChars(...) no overflow check. --- generic/tclUtf.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 3937141..a405367 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -464,7 +464,6 @@ Tcl_NumUtfChars( * for strlen(string). */ { Tcl_UniChar ch; - register Tcl_UniChar *chPtr = &ch; register int i; /* @@ -477,23 +476,25 @@ Tcl_NumUtfChars( i = 0; if (length < 0) { while (*src != '\0') { - src += TclUtfToUniChar(src, chPtr); + src += TclUtfToUniChar(src, &ch); i++; } + if (i < 0) i = INT_MAX; /* Bug [2738427] */ } else { - register int n; - - while (length > 0) { - if (UCHAR(*src) < 0xC0) { - length--; - src++; - } else { - n = Tcl_UtfToUniChar(src, chPtr); - length -= n; - src += n; - } + register const char *endPtr = src + length - TCL_UTF_MAX; + + while (src < endPtr) { + src += TclUtfToUniChar(src, &ch); i++; } + endPtr += TCL_UTF_MAX; + while ((src < endPtr) && Tcl_UtfCharComplete(src, endPtr - src)) { + src += TclUtfToUniChar(src, &ch); + i++; + } + if (src < endPtr) { + i += endPtr - src; + } } return i; } -- cgit v0.12 From 23ab25afdce1ddd24415298abf6e9a729f2a4588 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 8 Jun 2017 12:50:00 +0000 Subject: Revert part of [95d096e0378b460c6c5168bb55bb2ca8b2fd799e|95d096e037]: Missed the fact that tolower() was optimized for the ASCII case as well, so this was a mistake! --- generic/tclUtil.c | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 3fdf54b..553593c 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2162,9 +2162,14 @@ Tcl_StringCaseMatch( * This is a special case optimization for single-byte utf. */ - TclUtfToUniChar(pattern, &ch2); - if (nocase) { - ch2 = Tcl_UniCharToLower(ch2); + if (UCHAR(*pattern) < 0x80) { + ch2 = (Tcl_UniChar) + (nocase ? tolower(UCHAR(*pattern)) : UCHAR(*pattern)); + } else { + Tcl_UtfToUniChar(pattern, &ch2); + if (nocase) { + ch2 = Tcl_UniCharToLower(ch2); + } } while (1) { @@ -2230,26 +2235,44 @@ Tcl_StringCaseMatch( Tcl_UniChar startChar, endChar; pattern++; - str += TclUtfToUniChar(str, &ch1); - if (nocase) { - ch1 = Tcl_UniCharToLower(ch1); + 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; } - pattern += TclUtfToUniChar(pattern, &startChar); - if (nocase) { - startChar = Tcl_UniCharToLower(startChar); + if (UCHAR(*pattern) < 0x80) { + startChar = (Tcl_UniChar) (nocase + ? tolower(UCHAR(*pattern)) : UCHAR(*pattern)); + pattern++; + } else { + pattern += Tcl_UtfToUniChar(pattern, &startChar); + if (nocase) { + startChar = Tcl_UniCharToLower(startChar); + } } if (*pattern == '-') { pattern++; if (*pattern == '\0') { return 0; } - pattern += TclUtfToUniChar(pattern, &endChar); - if (nocase) { - endChar = Tcl_UniCharToLower(endChar); + if (UCHAR(*pattern) < 0x80) { + endChar = (Tcl_UniChar) (nocase + ? tolower(UCHAR(*pattern)) : UCHAR(*pattern)); + pattern++; + } else { + pattern += Tcl_UtfToUniChar(pattern, &endChar); + if (nocase) { + endChar = Tcl_UniCharToLower(endChar); + } } if (((startChar <= ch1) && (ch1 <= endChar)) || ((endChar <= ch1) && (ch1 <= startChar))) { -- cgit v0.12 From b796f3dee76ec3094af593f2ac16b321c4bdb720 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 16:44:51 +0000 Subject: When possible delay string rep generation until necessary. --- generic/tclStringObj.c | 56 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index aae52ba..be71109 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2847,7 +2847,7 @@ TclStringCatObjv( Tcl_Obj * const objv[], Tcl_Obj **objPtrPtr) { - Tcl_Obj *objPtr, *objResultPtr, * const *ov; + Tcl_Obj *objPtr, *objResultPtr, * const *ov, *pendingPtr = NULL; int oc, length = 0, binary = 1, first = 0, last = 0; int allowUniChar = 1, requestUniChar = 0; @@ -2952,14 +2952,37 @@ TclStringCatObjv( objPtr = *ov++; - Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ - if (numBytes) { + if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { + /* No string rep; Take the chance we can avoid making it */ + last = objc - oc; - if (length == 0) { - first = last; - } - if ((length += numBytes) < 0) { - goto overflow; + first = last; + pendingPtr = objPtr; + } else { + + Tcl_GetStringFromObj(objPtr, &numBytes);/* PANIC? */ + if (numBytes) { + last = objc - oc; + if (length == 0) { + if (pendingPtr) { + int pendingNumBytes; + + Tcl_GetStringFromObj(pendingPtr, &pendingNumBytes); /* PANIC? */ + if (pendingNumBytes) { + if ((length += pendingNumBytes) < 0) { + goto overflow; + } + } else { + first = last; + } + pendingPtr = NULL; + } else { + first = last; + } + } + if ((length += numBytes) < 0) { + goto overflow; + } } } } while (--oc); @@ -3056,13 +3079,18 @@ TclStringCatObjv( } else { /* Efficiently concatenate string reps */ char *dst; + int start; if (inPlace && !Tcl_IsShared(*objv)) { - int start; - objResultPtr = *objv++; objc--; Tcl_GetStringFromObj(objResultPtr, &start); + if (pendingPtr) { + /* assert ( pendingPtr == objResultPtr ) */ + if ((length += start) < 0) { + goto overflow; + } + } if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -3075,8 +3103,16 @@ TclStringCatObjv( dst = Tcl_GetString(objResultPtr) + start; if (length > start) { TclFreeIntRep(objResultPtr); + } else { + /* Can't happen ? */ } } else { + if (pendingPtr) { + Tcl_GetStringFromObj(pendingPtr, &start); + if ((length += start) < 0) { + goto overflow; + } + } objResultPtr = Tcl_NewObj(); /* PANIC? */ if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { -- cgit v0.12 From c3483863885b717816b97ace4638bdbd508fe6f6 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 19:35:05 +0000 Subject: Tests for string rep generation suppression --- tests/string.test | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/string.test b/tests/string.test index fa7f8fb..9c43f29 100644 --- a/tests/string.test +++ b/tests/string.test @@ -1994,6 +1994,36 @@ test string-29.4 {string cat, many args} { set r2 [string compare $xx [eval "string cat $vvs"]] list $r1 $r2 } {0 0} +test string-29.5 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat [list x] [list]] +} -match glob -result {*no string representation} +test string-29.6 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat [list] [list x]] +} -match glob -result {*no string representation} +test string-29.7 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat [list x] [list] [list]] +} -match glob -result {*no string representation} +test string-29.8 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat [list] [list x] [list]] +} -match glob -result {*no string representation} +test string-29.9 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat [list] [list] [list x]] +} -match glob -result {*no string representation} +test string-29.10 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat [list x] [list x]] +} -match glob -result {*, string representation "xx"} +test string-29.11 {string cat, efficiency} -body { + tcl::unsupported::representation \ + [string cat [list x] [encoding convertto utf-8 {}]] +} -match glob -result {*no string representation} +test string-29.12 {string cat, efficiency} -body { + tcl::unsupported::representation \ + [string cat [encoding convertto utf-8 {}] [list x]] +} -match glob -result {*, string representation "x"} +test string-29.13 {string cat, efficiency} -body { + tcl::unsupported::representation [string cat \ + [encoding convertto utf-8 {}] [encoding convertto utf-8 {}] [list x]] +} -match glob -result {*, string representation "x"} -- cgit v0.12 From 7673d614a9fe445baae517d64bb8a751970024c9 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 20:31:47 +0000 Subject: pendingPtr == NULL implies (last == first) implies early out --- generic/tclStringObj.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index be71109..847182d 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2847,7 +2847,7 @@ TclStringCatObjv( Tcl_Obj * const objv[], Tcl_Obj **objPtrPtr) { - Tcl_Obj *objPtr, *objResultPtr, * const *ov, *pendingPtr = NULL; + Tcl_Obj *objPtr, *objResultPtr, * const *ov; int oc, length = 0, binary = 1, first = 0, last = 0; int allowUniChar = 1, requestUniChar = 0; @@ -2945,6 +2945,8 @@ TclStringCatObjv( } } while (--oc); } else { + Tcl_Obj *pendingPtr = NULL; + /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; do { @@ -2975,7 +2977,6 @@ TclStringCatObjv( } else { first = last; } - pendingPtr = NULL; } else { first = last; } @@ -3085,12 +3086,6 @@ TclStringCatObjv( objResultPtr = *objv++; objc--; Tcl_GetStringFromObj(objResultPtr, &start); - if (pendingPtr) { - /* assert ( pendingPtr == objResultPtr ) */ - if ((length += start) < 0) { - goto overflow; - } - } if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -3107,12 +3102,6 @@ TclStringCatObjv( /* Can't happen ? */ } } else { - if (pendingPtr) { - Tcl_GetStringFromObj(pendingPtr, &start); - if ((length += start) < 0) { - goto overflow; - } - } objResultPtr = Tcl_NewObj(); /* PANIC? */ if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { -- cgit v0.12 From 36d9205d974a58b5030d7c1b1ddfb27ff04d7f7c Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 20:40:45 +0000 Subject: More streamlining. --- generic/tclStringObj.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 847182d..c4d07e0 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2967,17 +2967,9 @@ TclStringCatObjv( last = objc - oc; if (length == 0) { if (pendingPtr) { - int pendingNumBytes; - - Tcl_GetStringFromObj(pendingPtr, &pendingNumBytes); /* PANIC? */ - if (pendingNumBytes) { - if ((length += pendingNumBytes) < 0) { - goto overflow; - } - } else { - first = last; - } - } else { + Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ + } + if (length == 0) { first = last; } } @@ -3080,9 +3072,10 @@ TclStringCatObjv( } else { /* Efficiently concatenate string reps */ char *dst; - int start; if (inPlace && !Tcl_IsShared(*objv)) { + int start; + objResultPtr = *objv++; objc--; Tcl_GetStringFromObj(objResultPtr, &start); -- cgit v0.12 From de1c1f0f476262cad9b20a69be5d8c15fd3a9be6 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 20:57:06 +0000 Subject: More streamlining --- generic/tclStringObj.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index c4d07e0..31a6b26 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2962,20 +2962,20 @@ TclStringCatObjv( pendingPtr = objPtr; } else { - Tcl_GetStringFromObj(objPtr, &numBytes);/* PANIC? */ - if (numBytes) { - last = objc - oc; - if (length == 0) { - if (pendingPtr) { - Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ - } - if (length == 0) { - first = last; - } - } - if ((length += numBytes) < 0) { - goto overflow; - } + Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ + if (numBytes == 0) { + continue; + } + last = objc - oc; + if (pendingPtr) { + Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ + pendingPtr = NULL; + } + if (length == 0) { + first = last; + } + if ((length += numBytes) < 0) { + goto overflow; } } } while (--oc); -- cgit v0.12 From cc72d116bdbf58771070b191dc48c28de07462b1 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 21:05:22 +0000 Subject: Modernize overflow checks. --- generic/tclStringObj.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 31a6b26..43f8016 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2916,10 +2916,10 @@ TclStringCatObjv( last = objc - oc; if (length == 0) { first = last; - } - if ((length += numBytes) < 0) { + } else if (numBytes > INT_MAX - length) { goto overflow; } + length += numBytes; } } } while (--oc); @@ -2937,10 +2937,10 @@ TclStringCatObjv( last = objc - oc; if (length == 0) { first = last; - } - if ((length += numChars) < 0) { + } else if (numChars > INT_MAX - length) { goto overflow; } + length += numChars; } } } while (--oc); @@ -2973,10 +2973,10 @@ TclStringCatObjv( } if (length == 0) { first = last; - } - if ((length += numBytes) < 0) { + } else if (numBytes > INT_MAX - length) { goto overflow; } + length += numBytes; } } while (--oc); } -- cgit v0.12 From 4b81f6ff43bff6569658b4b34f03c40ca72b4df7 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 8 Jun 2017 21:10:01 +0000 Subject: Don't test the impossible. --- generic/tclStringObj.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 43f8016..aa99545 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3089,11 +3089,9 @@ TclStringCatObjv( return TCL_ERROR; } dst = Tcl_GetString(objResultPtr) + start; - if (length > start) { - TclFreeIntRep(objResultPtr); - } else { - /* Can't happen ? */ - } + + /* assert ( length > start ) */ + TclFreeIntRep(objResultPtr); } else { objResultPtr = Tcl_NewObj(); /* PANIC? */ if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { -- cgit v0.12 From 2712a556fb87afc34f52a435a6b39ad81aa20a16 Mon Sep 17 00:00:00 2001 From: griffin Date: Mon, 12 Jun 2017 14:04:29 +0000 Subject: Add support of 0d in the format %# conversion flag. Add tests for same. --- doc/format.n | 16 +++++++++------- generic/tclStringObj.c | 4 ++++ tests/format.test | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/doc/format.n b/doc/format.n index ba044f2..a386464 100644 --- a/doc/format.n +++ b/doc/format.n @@ -83,14 +83,16 @@ Specifies that the number should be padded on the left with zeroes instead of spaces. .TP 10 \fB#\fR -Requests an alternate output form. For \fBo\fR and \fBO\fR -conversions it guarantees that the first digit is always \fB0\fR. -For \fBx\fR or \fBX\fR conversions, \fB0x\fR or \fB0X\fR (respectively) -will be added to the beginning of the result unless it is zero. +Requests an alternate output form. For \fBo\fR and \fBO\fR +conversions it guarantees that the first digit is always \fB0\fR. +For \fBx\fR or \fBX\fR conversions, \fB0x\fR or \fB0X\fR (respectively) +will be added to the beginning of the result unless it is zero. For \fBb\fR conversions, \fB0b\fR -will be added to the beginning of the result unless it is zero. -For all floating-point conversions (\fBe\fR, \fBE\fR, \fBf\fR, -\fBg\fR, and \fBG\fR) it guarantees that the result always +will be added to the beginning of the result unless it is zero. +For \fBd\fR conversions, \fB0d\fR will be added to the beginning +of the result unless it is zero. +For all floating-point conversions (\fBe\fR, \fBE\fR, \fBf\fR, +\fBg\fR, and \fBG\fR) it guarantees that the result always has a decimal point. For \fBg\fR and \fBG\fR conversions it specifies that trailing zeroes should not be removed. diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 7c898b7..3a6e60e 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2039,6 +2039,10 @@ Tcl_AppendFormatToObj( Tcl_AppendToObj(segment, "0b", 2); segmentLimit -= 2; break; + case 'd': + Tcl_AppendToObj(segment, "0d", 2); + segmentLimit -= 2; + break; } } diff --git a/tests/format.test b/tests/format.test index 722ad21..577365b 100644 --- a/tests/format.test +++ b/tests/format.test @@ -79,6 +79,25 @@ test format-1.11.1 {integer formatting} longIs64bit { test format-1.12 {integer formatting} { format "%b %#b %#b %llb" 5 0 5 [expr {2**100}] } {101 0b0 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} +test format-1.13 {integer formatting} longIs32bit { + format "%#d %#d %#d %#d %#d" 0 6 34 16923 -12 -1 +} {0d0 0d6 0d34 0d16923 -0d12} +test format-1.13.1 {integer formatting} longIs64bit { + format "%#d %#d %#d %#d %#d" 0 6 34 16923 -12 -1 +} {0d0 0d6 0d34 0d16923 -0d12} +test format-1.14 {integer formatting} longIs32bit { + format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 +} { 0d0 0d6 0d34 0d16923 -0d12} +test format-1.14.1 {integer formatting} longIs64bit { + format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 +} { 0d0 0d6 0d34 0d16923 -0d12} +test format-1.15 {integer formatting} longIs32bit { + format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 +} {0d0 0d6 0d34 0d16923 -0d12 } +test format-1.15.1 {integer formatting} longIs64bit { + format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 +} {0d0 0d6 0d34 0d16923 -0d12 } + test format-2.1 {string formatting} { format "%s %s %c %s" abcd {This is a very long test string.} 120 x -- cgit v0.12 From ad34457a54e73f30298e2452226cf979662ef8a8 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 13 Jun 2017 11:10:11 +0000 Subject: Add tests and docs. --- doc/define.n | 15 ++++++++ tests/oo.test | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) diff --git a/doc/define.n b/doc/define.n index 7599ec0..1692c94 100644 --- a/doc/define.n +++ b/doc/define.n @@ -142,6 +142,8 @@ be afterwards. \fBself\fI subcommand arg ...\fR .TP \fBself\fI script\fR +.TP +\fBself\fR . This command is equivalent to calling \fBoo::objdefine\fR on the class being defined (see \fBCONFIGURING OBJECTS\fR below for a description of the @@ -151,6 +153,13 @@ and .QW "\fBoo::define \fIcls \fBself \fIsubcommand ...\fR" operates identically to .QW "\fBoo::objdefine \fIcls subcommand ...\fR" . +.RS +.PP +.VS TIP470 +If no arguments at all are used, this gives the name of the class currently +being configured. +.VE TIP470 +.RE .TP \fBsuperclass\fR ?\fI\-slotOperation\fR? ?\fIclassName ...\fR? .VS @@ -265,6 +274,12 @@ not previously refer to a method in that object. Does not affect the classes that the object is an instance of. Does not change the export status of the method; if it was exported before, it will be afterwards. .TP +\fBself \fR +. +.VS TIP470 +This gives the name of the object currently being configured. +.VE TIP470 +.TP \fBunexport\fI name \fR?\fIname ...\fR? . This arranges for each of the named methods, \fIname\fR, to be not exported diff --git a/tests/oo.test b/tests/oo.test index e03911b..ae36f87 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -3766,6 +3766,113 @@ test oo-35.4 {Bug 593baa032c: mixins list teardown} { namespace eval [info object namespace D] [list [namespace which B] destroy] } {} +test oo-36.1 {TIP #470: introspection within oo::define} { + oo::define oo::object self +} ::oo::object +test oo-36.2 {TIP #470: introspection within oo::define} -setup { + oo::class create Cls +} -body { + oo::define Cls self +} -cleanup { + Cls destroy +} -result ::Cls +test oo-36.3 {TIP #470: introspection within oo::define} -setup { + oo::class create Super + set result uncalled +} -body { + oo::class create Sub { + superclass Super + ::set ::result [self] + } + return $result +} -cleanup { + Super destroy +} -result ::Sub +test oo-36.4 {TIP #470: introspection within oo::define} -setup { + oo::class create Super + set result uncalled +} -body { + oo::class create Sub { + superclass Super + ::set ::result [self {}] + } + return $result +} -cleanup { + Super destroy +} -result {} +test oo-36.5 {TIP #470: introspection within oo::define} -setup { + oo::class create Super + set result uncalled +} -body { + oo::class create Sub { + superclass Super + ::set ::result [self self] + } +} -cleanup { + Super destroy +} -result ::Sub +test oo-36.6 {TIP #470: introspection within oo::objdefine} -setup { + oo::class create Cls + set result uncalled +} -body { + Cls create obj + oo::objdefine obj { + ::set ::result [self] + } +} -cleanup { + Cls destroy +} -result ::obj +test oo-36.7 {TIP #470: introspection within oo::objdefine} -setup { + oo::class create Cls +} -body { + Cls create obj + oo::objdefine obj { + self + } +} -cleanup { + Cls destroy +} -result ::obj +test oo-36.8 {TIP #470: introspection within oo::objdefine} -setup { + oo::class create Cls +} -body { + Cls create obj + oo::objdefine obj { + self anything + } +} -returnCodes error -cleanup { + Cls destroy +} -result {wrong # args: should be "self"} +test oo-36.9 {TIP #470: introspection within oo::define} -setup { + oo::class create Cls + set result uncalled +} -body { + proc oo::define::testself {} { + global result + set result [list [catch {self} msg] $msg \ + [catch {uplevel 1 self} msg] $msg] + return + } + list [oo::define Cls testself] $result +} -cleanup { + Cls destroy + catch {rename oo::define::testself {}} +} -result {{} {1 {this command may only be called from within the context of an ::oo::define or ::oo::objdefine command} 0 ::Cls}} +test oo-36.10 {TIP #470: introspection within oo::define} -setup { + oo::class create Cls + set result uncalled +} -body { + proc oo::objdefine::testself {} { + global result + set result [list [catch {self} msg] $msg \ + [catch {uplevel 1 self} msg] $msg] + return + } + Cls create obj + list [oo::objdefine obj testself] $result +} -cleanup { + Cls destroy + catch {rename oo::objdefine::testself {}} +} -result {{} {1 {this command may only be called from within the context of an ::oo::define or ::oo::objdefine command} 0 ::obj}} cleanupTests return -- cgit v0.12 From cf30ba443c8cdaf39b5b960d78894955dc71beed Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 14 Jun 2017 10:04:05 +0000 Subject: Little variation on Brian's proposal: Only prefix decimal number with '0d' when that's necessary for correct interpretation of the number when parsed back again. --- doc/format.n | 5 +++-- generic/tclStringObj.c | 8 ++++++-- tests/format.test | 21 +++++++++------------ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/doc/format.n b/doc/format.n index 4eb566d..1df255e 100644 --- a/doc/format.n +++ b/doc/format.n @@ -89,8 +89,9 @@ For \fBx\fR or \fBX\fR conversions, \fB0x\fR or \fB0X\fR (respectively) will be added to the beginning of the result unless it is zero. For \fBb\fR conversions, \fB0b\fR will be added to the beginning of the result unless it is zero. -For \fBd\fR conversions, \fB0d\fR will be added to the beginning -of the result unless it is zero. +For \fBd\fR conversions, \fB0d\fR there is no effect unless +the \fB0\fR specifier is used as well: In that case, \fB0d\fR or +\fB0D\fR (respectively) will be added to the beginning. For all floating-point conversions (\fBe\fR, \fBE\fR, \fBf\fR, \fBg\fR, and \fBG\fR) it guarantees that the result always has a decimal point. diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index b84470b..5ce7d18 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2037,8 +2037,12 @@ Tcl_AppendFormatToObj( segmentLimit -= 2; break; case 'd': - Tcl_AppendToObj(segment, "0d", 2); - segmentLimit -= 2; +#if TCL_MAJOR_VERSION < 9 + if (gotZero) { + Tcl_AppendToObj(segment, "0d", 2); + segmentLimit -= 2; + } +#endif break; } } diff --git a/tests/format.test b/tests/format.test index 8842315..3fd72be 100644 --- a/tests/format.test +++ b/tests/format.test @@ -78,24 +78,21 @@ test format-1.11.1 {integer formatting} longIs64bit { test format-1.12 {integer formatting} { format "%b %#b %#b %llb" 5 0 5 [expr {2**100}] } {101 0b0 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} -test format-1.13 {integer formatting} longIs32bit { +test format-1.13 {integer formatting} { format "%#d %#d %#d %#d %#d" 0 6 34 16923 -12 -1 -} {0d0 0d6 0d34 0d16923 -0d12} -test format-1.13.1 {integer formatting} longIs64bit { - format "%#d %#d %#d %#d %#d" 0 6 34 16923 -12 -1 -} {0d0 0d6 0d34 0d16923 -0d12} +} {0 6 34 16923 -12} test format-1.14 {integer formatting} longIs32bit { - format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 -} { 0d0 0d6 0d34 0d16923 -0d12} + format "%#05d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 +} {0d000 6 34 16923 -12} test format-1.14.1 {integer formatting} longIs64bit { - format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 -} { 0d0 0d6 0d34 0d16923 -0d12} + format "%#05d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 +} {0d000 6 34 16923 -12} test format-1.15 {integer formatting} longIs32bit { - format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 -} {0d0 0d6 0d34 0d16923 -0d12 } + format "%-#05d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 +} {0d000 6 34 16923 -12 } test format-1.15.1 {integer formatting} longIs64bit { format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 -} {0d0 0d6 0d34 0d16923 -0d12 } +} {0d000 6 34 16923 -12 } test format-2.1 {string formatting} { -- cgit v0.12 From d453cdacec7e2a1f623fda752e0b4bf163d33ed9 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 14 Jun 2017 21:42:38 +0000 Subject: [f2336c116b] Move pragmas to make gcc happy; it is pickier than clang. --- unix/tclUnixSock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 2353f94..c0df035 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -730,6 +730,8 @@ TcpClose2Proc( */ #ifndef NEED_FAKE_RFC2553 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" static inline int IPv6AddressNeedsNumericRendering( struct in6_addr addr) @@ -743,16 +745,14 @@ IPv6AddressNeedsNumericRendering( * at least some versions of OSX. */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-aliasing" if (!IN6_IS_ADDR_V4MAPPED(&addr)) { -#pragma GCC diagnostic pop return 0; } return (addr.s6_addr[12] == 0 && addr.s6_addr[13] == 0 && addr.s6_addr[14] == 0 && addr.s6_addr[15] == 0); } +#pragma GCC diagnostic pop #endif /* NEED_FAKE_RFC2553 */ static void -- cgit v0.12 From 107760e1da69bea9909836bbca15050447991311 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 14 Jun 2017 21:49:08 +0000 Subject: [9c058c5803e30d02] Correction to cross linking in dict(n)'s SEE ALSO section. --- doc/dict.n | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/dict.n b/doc/dict.n index fecad85..cd7e94c 100644 --- a/doc/dict.n +++ b/doc/dict.n @@ -437,7 +437,7 @@ puts $foo # prints: \fIa b foo {a b} bar 2 baz 3\fR .CE .SH "SEE ALSO" -append(n), array(n), foreach(n), mapeach(n), incr(n), list(n), lappend(n), set(n) +append(n), array(n), foreach(n), incr(n), list(n), lappend(n), lmap(n), set(n) .SH KEYWORDS dictionary, create, update, lookup, iterate, filter, map '\" Local Variables: -- cgit v0.12 From 0f0ca3d9323a2e8dd54a6a0e11a0f9fc5467cfd8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 15 Jun 2017 09:13:51 +0000 Subject: Make panic in TclParseNumber() work when IEEE_FLOATING_POINT is not defined. --- generic/tclStrToD.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 67b6482..2091928 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -1183,9 +1183,9 @@ TclParseNumber( case sNA: case sNANPAREN: case sNANHEX: +#endif Tcl_Panic("TclParseNumber: bad acceptState %d parsing '%s'", acceptState, bytes); -#endif case BINARY: shift = numTrailZeros; if (!significandOverflow && significandWide != 0 && -- cgit v0.12 From 6123ba004cf246d014231b6030560c8b9cae3934 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 11:47:46 +0000 Subject: Better define the meaning of "first" and "last". --- generic/tclStringObj.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index aa99545..0a38836 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2848,8 +2848,10 @@ TclStringCatObjv( Tcl_Obj **objPtrPtr) { Tcl_Obj *objPtr, *objResultPtr, * const *ov; - int oc, length = 0, binary = 1, first = 0, last = 0; + int oc, length = 0, binary = 1; int allowUniChar = 1, requestUniChar = 0; + int first = objc - 1; /* Index of first value possibly not empty */ + int last = 0; /* Index of last value possibly not empty */ /* assert ( objc >= 0 ) */ @@ -2981,9 +2983,9 @@ TclStringCatObjv( } while (--oc); } - if (last == first /*|| length == 0 */) { + if (last <= first /*|| length == 0 */) { /* Only one non-empty value or zero length; return first */ - /* NOTE: (length == 0) implies (last == first) */ + /* NOTE: (length == 0) implies (last <= first) */ *objPtrPtr = objv[first]; return TCL_OK; } -- cgit v0.12 From 9ddb31d52221fb3db41becc2bd840658338f73e6 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 12:56:03 +0000 Subject: Extend cases where string rep generation can be prevented. --- generic/tclStringObj.c | 16 ++++++++++++++++ tests/string.test | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 0a38836..261e01f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2966,9 +2966,25 @@ TclStringCatObjv( Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ if (numBytes == 0) { + if (pendingPtr && pendingPtr->bytes) { + /* + * Generating string rep of objPtr also + * generated string rep of pendingPtr. + */ + if (pendingPtr->length) { + /* Can this happen? */ + goto foo; + } else { + /* string-29.14 */ + first = objc - 1; + last = 0; + pendingPtr = NULL; + } + } continue; } last = objc - oc; +foo: if (pendingPtr) { Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ pendingPtr = NULL; diff --git a/tests/string.test b/tests/string.test index 9c43f29..7b02928 100644 --- a/tests/string.test +++ b/tests/string.test @@ -2024,6 +2024,21 @@ test string-29.13 {string cat, efficiency} -body { tcl::unsupported::representation [string cat \ [encoding convertto utf-8 {}] [encoding convertto utf-8 {}] [list x]] } -match glob -result {*, string representation "x"} +test string-29.14 {string cat, efficiency} -setup { + set e [encoding convertto utf-8 {}] +} -cleanup { + unset e +} -body { + tcl::unsupported::representation [string cat $e $e [list x]] +} -match glob -result {*no string representation} +test string-29.15 {string cat, efficiency} -setup { + set e [encoding convertto utf-8 {}] + set f [encoding convertto utf-8 {}] +} -cleanup { + unset e f +} -body { + tcl::unsupported::representation [string cat $e $f $e $f [list x]] +} -match glob -result {*no string representation} -- cgit v0.12 From aca86a46ffe59bb150f404efaf410cadc401a6f1 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 14:43:16 +0000 Subject: Rework the logic. Equivalent function. --- generic/tclStringObj.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 261e01f..587ba76 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2965,32 +2965,22 @@ TclStringCatObjv( } else { Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ - if (numBytes == 0) { - if (pendingPtr && pendingPtr->bytes) { - /* - * Generating string rep of objPtr also - * generated string rep of pendingPtr. - */ - if (pendingPtr->length) { - /* Can this happen? */ - goto foo; - } else { - /* string-29.14 */ - first = objc - 1; - last = 0; - pendingPtr = NULL; - } - } + if (numBytes) { + last = objc - oc; + } else if (pendingPtr == NULL || pendingPtr->bytes == NULL) { continue; } - last = objc - oc; -foo: if (pendingPtr) { Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ pendingPtr = NULL; } if (length == 0) { - first = last; + if (numBytes) { + first = last; + } else { + first = objc - 1; + last = 0; + } } else if (numBytes > INT_MAX - length) { goto overflow; } -- cgit v0.12 From e1b4ae0798c13600df17340c7c8bc049ad335e18 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 14:46:56 +0000 Subject: Use local variables. --- generic/tclStringObj.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 587ba76..8155711 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2847,7 +2847,7 @@ TclStringCatObjv( Tcl_Obj * const objv[], Tcl_Obj **objPtrPtr) { - Tcl_Obj *objPtr, *objResultPtr, * const *ov; + Tcl_Obj *objResultPtr, * const *ov; int oc, length = 0, binary = 1; int allowUniChar = 1, requestUniChar = 0; int first = objc - 1; /* Index of first value possibly not empty */ @@ -2872,7 +2872,7 @@ TclStringCatObjv( ov = objv, oc = objc; do { - objPtr = *ov++; + Tcl_Obj *objPtr = *ov++; if (objPtr->bytes) { /* Value has a string rep. */ @@ -2908,7 +2908,7 @@ TclStringCatObjv( /* Result will be pure byte array. Pre-size it */ ov = objv; oc = objc; do { - objPtr = *ov++; + Tcl_Obj *objPtr = *ov++; if (objPtr->bytes == NULL) { int numBytes; @@ -2929,7 +2929,7 @@ TclStringCatObjv( /* Result will be pure Tcl_UniChar array. Pre-size it. */ ov = objv; oc = objc; do { - objPtr = *ov++; + Tcl_Obj *objPtr = *ov++; if ((objPtr->bytes == NULL) || (objPtr->length)) { int numChars; @@ -2954,7 +2954,7 @@ TclStringCatObjv( do { int numBytes; - objPtr = *ov++; + Tcl_Obj *objPtr = *ov++; if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { /* No string rep; Take the chance we can avoid making it */ -- cgit v0.12 From b3bda726c14c1beb8bd4e5340aa4fb68af4116f0 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 15:51:12 +0000 Subject: Factor out and simplify loop scanning leading known empty values. --- generic/tclStringObj.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 8155711..870696e 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2952,6 +2952,26 @@ TclStringCatObjv( /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; do { + /* assert ( pendingPtr == NULL ) */ + /* assert ( length == 0 ) */ + + Tcl_Obj *objPtr = *ov++; + + if (objPtr->bytes == NULL) { + /* No string rep; Take the chance we can avoid making it */ + pendingPtr = objPtr; + } else { + Tcl_GetStringFromObj(objPtr, &length); /* PANIC? */ + } + } while (--oc && (length == 0) && (pendingPtr == NULL)); + + if (oc) { + + /* assert ( length > 0 || pendingPtr != NULL ) */ + + first = last = objc - oc - 1; + + do { int numBytes; Tcl_Obj *objPtr = *ov++; @@ -2987,6 +3007,7 @@ TclStringCatObjv( length += numBytes; } } while (--oc); + } } if (last <= first /*|| length == 0 */) { -- cgit v0.12 From 17711009b61fdbb4a568a630b7b71a035795fdde Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 16:07:48 +0000 Subject: Split loop into two cases for further simplification. --- generic/tclStringObj.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 870696e..be686cf 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2965,11 +2965,52 @@ TclStringCatObjv( } } while (--oc && (length == 0) && (pendingPtr == NULL)); + first = last = objc - oc - 1; + + while (oc && (length == 0)) { + int numBytes; + Tcl_Obj *objPtr = *ov++; + + /* assert ( pendingPtr != NULL ) <-- aiming for */ + + if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { + /* No string rep; Take the chance we can avoid making it */ + + last = objc - oc; + first = last; + pendingPtr = objPtr; + } else { + + Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ + if (numBytes) { + last = objc - oc; + } else if (pendingPtr == NULL || pendingPtr->bytes == NULL) { + --oc; + continue; + } + if (pendingPtr) { + Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ + pendingPtr = NULL; + } + if (length == 0) { + if (numBytes) { + first = last; + } else { + first = objc - 1; + last = 0; + } + } else if (numBytes > INT_MAX - length) { + goto overflow; + } + length += numBytes; + } + --oc; + } + if (oc) { - /* assert ( length > 0 || pendingPtr != NULL ) */ + /* assert ( length > 0 ) */ - first = last = objc - oc - 1; do { int numBytes; -- cgit v0.12 From 3923106cf72e37db80a261151293cbe16ebd9773 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 16:23:22 +0000 Subject: Simplify the final loop when we know we're generating strings for all. --- generic/tclStringObj.c | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index be686cf..51d6c13 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3007,48 +3007,22 @@ TclStringCatObjv( --oc; } - if (oc) { - - /* assert ( length > 0 ) */ - - - do { + while (oc) { int numBytes; - Tcl_Obj *objPtr = *ov++; - if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { - /* No string rep; Take the chance we can avoid making it */ + /* assert ( length > 0 && pendingPtr == NULL ) */ + Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ + if (numBytes) { last = objc - oc; - first = last; - pendingPtr = objPtr; - } else { - - Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ - if (numBytes) { - last = objc - oc; - } else if (pendingPtr == NULL || pendingPtr->bytes == NULL) { - continue; - } - if (pendingPtr) { - Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ - pendingPtr = NULL; - } - if (length == 0) { - if (numBytes) { - first = last; - } else { - first = objc - 1; - last = 0; - } - } else if (numBytes > INT_MAX - length) { + if (numBytes > INT_MAX - length) { goto overflow; } length += numBytes; } - } while (--oc); - } + --oc; + } } if (last <= first /*|| length == 0 */) { -- cgit v0.12 From 73f548527aa3d3852c86c86fba701c277e43e40f Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 16 Jun 2017 19:54:57 +0000 Subject: Another reworking, now with comments. --- generic/tclStringObj.c | 79 +++++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 51d6c13..41dad65 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2947,65 +2947,72 @@ TclStringCatObjv( } } while (--oc); } else { - Tcl_Obj *pendingPtr = NULL; - /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; do { - /* assert ( pendingPtr == NULL ) */ - /* assert ( length == 0 ) */ + Tcl_Obj *pendingPtr = NULL; - Tcl_Obj *objPtr = *ov++; + /* + * Loop until a possibly non-empty value is reached. + * Keep string rep generation pending when possible. + */ - if (objPtr->bytes == NULL) { - /* No string rep; Take the chance we can avoid making it */ - pendingPtr = objPtr; - } else { - Tcl_GetStringFromObj(objPtr, &length); /* PANIC? */ - } - } while (--oc && (length == 0) && (pendingPtr == NULL)); + do { + /* assert ( pendingPtr == NULL ) */ + /* assert ( length == 0 ) */ - first = last = objc - oc - 1; + Tcl_Obj *objPtr = *ov++; - while (oc && (length == 0)) { - int numBytes; - Tcl_Obj *objPtr = *ov++; + if (objPtr->bytes == NULL) { + /* No string rep; Take the chance we can avoid making it */ + pendingPtr = objPtr; + } else { + Tcl_GetStringFromObj(objPtr, &length); /* PANIC? */ + } + } while (--oc && (length == 0) && (pendingPtr == NULL)); + + /* + * Either we found a possibly non-empty value, and we + * remember this index as the first and last such value so + * far seen, or (oc == 0) and all values are known empty, + * so first = last = objc - 1 signals the right quick return. + */ - /* assert ( pendingPtr != NULL ) <-- aiming for */ + first = last = objc - oc - 1; - if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { - /* No string rep; Take the chance we can avoid making it */ + if (oc && (length == 0)) { + int numBytes; - last = objc - oc; - first = last; - pendingPtr = objPtr; - } else { + /* assert ( pendingPtr != NULL ) */ + + /* + * There's a pending value followed by more values. + * Loop over remaining values generating strings until + * a non-empty value is found, or the pending value gets + * its string generated. + */ + + do { + Tcl_Obj *objPtr = *ov++; + Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ + } while (--oc && numBytes == 0 && pendingPtr->bytes == NULL); - Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */ if (numBytes) { - last = objc - oc; - } else if (pendingPtr == NULL || pendingPtr->bytes == NULL) { - --oc; - continue; + last = objc -oc -1; } - if (pendingPtr) { - Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */ - pendingPtr = NULL; + if (oc || numBytes) { + Tcl_GetStringFromObj(pendingPtr, &length); } if (length == 0) { if (numBytes) { first = last; - } else { - first = objc - 1; - last = 0; } } else if (numBytes > INT_MAX - length) { goto overflow; } length += numBytes; } - --oc; - } + } while (oc && (length == 0)); while (oc) { int numBytes; -- cgit v0.12 From c488b70a470394ba33b4be54a944d95e4ce27b6c Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 18 Jun 2017 14:01:00 +0000 Subject: Factor out chunk of non-obvious code in the guts of [oo::define] into one place. --- generic/tclOODefineCmds.c | 200 +++++++++++++++++----------------------------- 1 file changed, 74 insertions(+), 126 deletions(-) diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index 8747ff5..e953dc0 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -47,8 +47,11 @@ struct DeclaredSlot { static inline void BumpGlobalEpoch(Tcl_Interp *interp, Class *classPtr); static Tcl_Command FindCommand(Tcl_Interp *interp, Tcl_Obj *stringObj, Tcl_Namespace *const namespacePtr); -static void GenerateErrorInfo(Tcl_Interp *interp, Object *oPtr, +static inline void GenerateErrorInfo(Tcl_Interp *interp, Object *oPtr, Tcl_Obj *savedNameObj, const char *typeOfSubject); +static inline int MagicDefinitionInvoke(Tcl_Interp *interp, + Tcl_Namespace *nsPtr, int cmdIndex, + int objc, Tcl_Obj *const *objv); static inline Class * GetClassInOuterContext(Tcl_Interp *interp, Tcl_Obj *className, const char *errMsg); static inline int InitDefineContext(Tcl_Interp *interp, @@ -755,7 +758,7 @@ GetClassInOuterContext( * ---------------------------------------------------------------------- */ -static void +static inline void GenerateErrorInfo( Tcl_Interp *interp, /* Where to store the error info trace. */ Object *oPtr, /* What object (or class) was being configured @@ -787,6 +790,69 @@ GenerateErrorInfo( /* * ---------------------------------------------------------------------- * + * MagicDefinitionInvoke -- + * Part of the implementation of the "oo::define" and "oo::objdefine" + * commands that is used to implement the more-than-one-argument case, + * applying ensemble-like tricks with dispatch so that error messages are + * clearer. Doesn't handle the management of the stack frame. + * + * ---------------------------------------------------------------------- + */ + +static inline int +MagicDefinitionInvoke( + Tcl_Interp *interp, + Tcl_Namespace *nsPtr, + int cmdIndex, + int objc, + Tcl_Obj *const *objv) +{ + Tcl_Obj *objPtr, *obj2Ptr, **objs; + Tcl_Command cmd; + int isRoot, dummy, result, offset = cmdIndex + 1; + + /* + * More than one argument: fire them through the ensemble processing + * engine so that everything appears to be good and proper in error + * messages. Note that we cannot just concatenate and send through + * Tcl_EvalObjEx, as that doesn't do ensemble processing, and we cannot go + * through Tcl_EvalObjv without the extra work to pre-find the command, as + * that finds command names in the wrong namespace at the moment. Ugly! + */ + + isRoot = TclInitRewriteEnsemble(interp, offset, 1, objv); + + /* + * Build the list of arguments using a Tcl_Obj as a workspace. See + * comments above for why these contortions are necessary. + */ + + objPtr = Tcl_NewObj(); + obj2Ptr = Tcl_NewObj(); + cmd = FindCommand(interp, objv[cmdIndex], nsPtr); + if (cmd == NULL) { + /* punt this case! */ + Tcl_AppendObjToObj(obj2Ptr, objv[cmdIndex]); + } else { + Tcl_GetCommandFullName(interp, cmd, obj2Ptr); + } + Tcl_ListObjAppendElement(NULL, objPtr, obj2Ptr); + /* TODO: overflow? */ + Tcl_ListObjReplace(NULL, objPtr, 1, 0, objc-offset, objv+offset); + Tcl_ListObjGetElements(NULL, objPtr, &dummy, &objs); + + result = Tcl_EvalObjv(interp, objc-cmdIndex, objs, TCL_EVAL_INVOKE); + if (isRoot) { + TclResetRewriteEnsemble(interp, 1); + } + Tcl_DecrRefCount(objPtr); + + return result; +} + +/* + * ---------------------------------------------------------------------- + * * TclOODefineObjCmd -- * Implementation of the "oo::define" command. Works by effectively doing * the same as 'namespace eval', but with extra magic applied so that the @@ -805,8 +871,8 @@ TclOODefineObjCmd( Tcl_Obj *const *objv) { Foundation *fPtr = TclOOGetFoundation(interp); - int result; Object *oPtr; + int result; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "className arg ?arg ...?"); @@ -846,46 +912,7 @@ TclOODefineObjCmd( } TclDecrRefCount(objNameObj); } else { - Tcl_Obj *objPtr, *obj2Ptr, **objs; - Tcl_Command cmd; - int isRoot, dummy; - - /* - * More than one argument: fire them through the ensemble processing - * engine so that everything appears to be good and proper in error - * messages. Note that we cannot just concatenate and send through - * Tcl_EvalObjEx, as that doesn't do ensemble processing, and we - * cannot go through Tcl_EvalObjv without the extra work to pre-find - * the command, as that finds command names in the wrong namespace at - * the moment. Ugly! - */ - - isRoot = TclInitRewriteEnsemble(interp, 3, 1, objv); - - /* - * Build the list of arguments using a Tcl_Obj as a workspace. See - * comments above for why these contortions are necessary. - */ - - objPtr = Tcl_NewObj(); - obj2Ptr = Tcl_NewObj(); - cmd = FindCommand(interp, objv[2], fPtr->defineNs); - if (cmd == NULL) { - /* punt this case! */ - Tcl_AppendObjToObj(obj2Ptr, objv[2]); - } else { - Tcl_GetCommandFullName(interp, cmd, obj2Ptr); - } - Tcl_ListObjAppendElement(NULL, objPtr, obj2Ptr); - /* TODO: overflow? */ - Tcl_ListObjReplace(NULL, objPtr, 1, 0, objc-3, objv+3); - Tcl_ListObjGetElements(NULL, objPtr, &dummy, &objs); - - result = Tcl_EvalObjv(interp, objc-2, objs, TCL_EVAL_INVOKE); - if (isRoot) { - TclResetRewriteEnsemble(interp, 1); - } - Tcl_DecrRefCount(objPtr); + result = MagicDefinitionInvoke(interp, fPtr->defineNs, 2, objc, objv); } DelRef(oPtr); @@ -918,8 +945,8 @@ TclOOObjDefObjCmd( Tcl_Obj *const *objv) { Foundation *fPtr = TclOOGetFoundation(interp); - int isRoot, result; Object *oPtr; + int result; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "objectName arg ?arg ...?"); @@ -952,47 +979,7 @@ TclOOObjDefObjCmd( } TclDecrRefCount(objNameObj); } else { - Tcl_Obj *objPtr, *obj2Ptr, **objs; - Tcl_Command cmd; - int dummy; - - /* - * More than one argument: fire them through the ensemble processing - * engine so that everything appears to be good and proper in error - * messages. Note that we cannot just concatenate and send through - * Tcl_EvalObjEx, as that doesn't do ensemble processing, and we - * cannot go through Tcl_EvalObjv without the extra work to pre-find - * the command, as that finds command names in the wrong namespace at - * the moment. Ugly! - */ - - isRoot = TclInitRewriteEnsemble(interp, 3, 1, objv); - - /* - * Build the list of arguments using a Tcl_Obj as a workspace. See - * comments above for why these contortions are necessary. - */ - - objPtr = Tcl_NewObj(); - obj2Ptr = Tcl_NewObj(); - cmd = FindCommand(interp, objv[2], fPtr->objdefNs); - if (cmd == NULL) { - /* punt this case! */ - Tcl_AppendObjToObj(obj2Ptr, objv[2]); - } else { - Tcl_GetCommandFullName(interp, cmd, obj2Ptr); - } - Tcl_ListObjAppendElement(NULL, objPtr, obj2Ptr); - /* TODO: overflow? */ - Tcl_ListObjReplace(NULL, objPtr, 1, 0, objc-3, objv+3); - Tcl_ListObjGetElements(NULL, objPtr, &dummy, &objs); - - result = Tcl_EvalObjv(interp, objc-2, objs, TCL_EVAL_INVOKE); - - if (isRoot) { - TclResetRewriteEnsemble(interp, 1); - } - Tcl_DecrRefCount(objPtr); + result = MagicDefinitionInvoke(interp, fPtr->objdefNs, 2, objc, objv); } DelRef(oPtr); @@ -1025,8 +1012,8 @@ TclOODefineSelfObjCmd( Tcl_Obj *const *objv) { Foundation *fPtr = TclOOGetFoundation(interp); - int result; Object *oPtr; + int result; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "arg ?arg ...?"); @@ -1059,46 +1046,7 @@ TclOODefineSelfObjCmd( } TclDecrRefCount(objNameObj); } else { - Tcl_Obj *objPtr, *obj2Ptr, **objs; - Tcl_Command cmd; - int isRoot, dummy; - - /* - * More than one argument: fire them through the ensemble processing - * engine so that everything appears to be good and proper in error - * messages. Note that we cannot just concatenate and send through - * Tcl_EvalObjEx, as that doesn't do ensemble processing, and we - * cannot go through Tcl_EvalObjv without the extra work to pre-find - * the command, as that finds command names in the wrong namespace at - * the moment. Ugly! - */ - - isRoot = TclInitRewriteEnsemble(interp, 2, 1, objv); - - /* - * Build the list of arguments using a Tcl_Obj as a workspace. See - * comments above for why these contortions are necessary. - */ - - objPtr = Tcl_NewObj(); - obj2Ptr = Tcl_NewObj(); - cmd = FindCommand(interp, objv[1], fPtr->objdefNs); - if (cmd == NULL) { - /* punt this case! */ - Tcl_AppendObjToObj(obj2Ptr, objv[1]); - } else { - Tcl_GetCommandFullName(interp, cmd, obj2Ptr); - } - Tcl_ListObjAppendElement(NULL, objPtr, obj2Ptr); - /* TODO: overflow? */ - Tcl_ListObjReplace(NULL, objPtr, 1, 0, objc-2, objv+2); - Tcl_ListObjGetElements(NULL, objPtr, &dummy, &objs); - - result = Tcl_EvalObjv(interp, objc-1, objs, TCL_EVAL_INVOKE); - if (isRoot) { - TclResetRewriteEnsemble(interp, 1); - } - Tcl_DecrRefCount(objPtr); + result = MagicDefinitionInvoke(interp, fPtr->objdefNs, 1, objc, objv); } DelRef(oPtr); -- cgit v0.12 From 45175dd2641f3979ab0e3a6b5b527a9cf5bab902 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 22 Jun 2017 08:15:13 +0000 Subject: Add test-cases, testing the legacy behavior of "format %#d" --- doc/GetInt.3 | 2 +- tests/format.test | 19 +++++++++++++++++++ tests/util.test | 6 +++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/doc/GetInt.3 b/doc/GetInt.3 index 3e7204c..5a3304a 100644 --- a/doc/GetInt.3 +++ b/doc/GetInt.3 @@ -4,7 +4,7 @@ '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" +'\" .TH Tcl_GetInt 3 "" Tcl "Tcl Library Procedures" .so man.macros .BS diff --git a/tests/format.test b/tests/format.test index 9afedd9..2795ac2 100644 --- a/tests/format.test +++ b/tests/format.test @@ -78,6 +78,25 @@ test format-1.11.1 {integer formatting} longIs64bit { test format-1.12 {integer formatting} { format "%b %#b %#b %llb" 5 0 5 [expr {2**100}] } {101 0b0 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} +test format-1.13 {integer formatting} longIs32bit { + format "%#d %#d %#d %#d %#d" 0 6 34 16923 -12 -1 +} {0 6 34 16923 -12} +test format-1.13.1 {integer formatting} longIs64bit { + format "%#d %#d %#d %#d %#d" 0 6 34 16923 -12 -1 +} {0 6 34 16923 -12} +test format-1.14 {integer formatting} longIs32bit { + format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 +} { 0 6 34 16923 -12} +test format-1.14.1 {integer formatting} longIs64bit { + format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 +} { 0 6 34 16923 -12} +test format-1.15 {integer formatting} longIs32bit { + format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 +} {0 6 34 16923 -12 } +test format-1.15.1 {integer formatting} longIs64bit { + format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 +} {0 6 34 16923 -12 } + test format-2.1 {string formatting} { format "%s %s %c %s" abcd {This is a very long test string.} 120 x diff --git a/tests/util.test b/tests/util.test index 7782f35..2ac11bf 100644 --- a/tests/util.test +++ b/tests/util.test @@ -208,7 +208,7 @@ test util-4.6 {Tcl_ConcatObj - utf-8 sequence with "whitespace" char} { } \xe0 test util-4.7 {Tcl_ConcatObj - refCount safety} testconcatobj { # Check for Bug #1447328 (actually, bugs in its original "fix"). One of the - # symptoms was Bug #2055782. + # symptoms was Bug #2055782. testconcatobj } {} @@ -566,7 +566,7 @@ test util-9.1.3 {TclGetIntForIndex} { } k test util-9.2.0 {TclGetIntForIndex} { string index abcd end -} d +} d test util-9.2.1 {TclGetIntForIndex} -body { string index abcd { end} } -returnCodes error -match glob -result * @@ -4007,7 +4007,7 @@ test util-17.1 {bankers' rounding [Bug 3349507]} {ieeeFloatingPoint} { } set r } [list {*}{ - 0x43fffffffffffffc 0xc3fffffffffffffc + 0x43fffffffffffffc 0xc3fffffffffffffc 0x43fffffffffffffc 0xc3fffffffffffffc 0x43fffffffffffffd 0xc3fffffffffffffd 0x43fffffffffffffe 0xc3fffffffffffffe -- cgit v0.12 From d39c33303f33ae3e5b8a27c34661a9b0aed9e2f3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 22 Jun 2017 08:58:14 +0000 Subject: Upgrade all internal character tables to Unicode 10 --- generic/regc_locale.c | 411 +++++++++-------- generic/tclUniData.c | 1232 +++++++++++++++++++++++++------------------------ 2 files changed, 836 insertions(+), 807 deletions(-) diff --git a/generic/regc_locale.c b/generic/regc_locale.c index 6444b55..32adee8 100644 --- a/generic/regc_locale.c +++ b/generic/regc_locale.c @@ -140,73 +140,73 @@ static const crange alphaRangeTable[] = { {0x3f7, 0x481}, {0x48a, 0x52f}, {0x531, 0x556}, {0x561, 0x587}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x620, 0x64a}, {0x671, 0x6d3}, {0x6fa, 0x6fc}, {0x712, 0x72f}, {0x74d, 0x7a5}, {0x7ca, 0x7ea}, - {0x800, 0x815}, {0x840, 0x858}, {0x8a0, 0x8b4}, {0x8b6, 0x8bd}, - {0x904, 0x939}, {0x958, 0x961}, {0x971, 0x980}, {0x985, 0x98c}, - {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, {0x9df, 0x9e1}, - {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa59, 0xa5c}, - {0xa72, 0xa74}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, - {0xaaa, 0xab0}, {0xab5, 0xab9}, {0xb05, 0xb0c}, {0xb13, 0xb28}, - {0xb2a, 0xb30}, {0xb35, 0xb39}, {0xb5f, 0xb61}, {0xb85, 0xb8a}, - {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xba8, 0xbaa}, {0xbae, 0xbb9}, - {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, - {0xc58, 0xc5a}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, - {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, - {0xd12, 0xd3a}, {0xd54, 0xd56}, {0xd5f, 0xd61}, {0xd7a, 0xd7f}, - {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6}, - {0xe01, 0xe30}, {0xe40, 0xe46}, {0xe94, 0xe97}, {0xe99, 0xe9f}, - {0xea1, 0xea3}, {0xead, 0xeb0}, {0xec0, 0xec4}, {0xedc, 0xedf}, - {0xf40, 0xf47}, {0xf49, 0xf6c}, {0xf88, 0xf8c}, {0x1000, 0x102a}, - {0x1050, 0x1055}, {0x105a, 0x105d}, {0x106e, 0x1070}, {0x1075, 0x1081}, - {0x10a0, 0x10c5}, {0x10d0, 0x10fa}, {0x10fc, 0x1248}, {0x124a, 0x124d}, - {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, - {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5}, - {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, - {0x1380, 0x138f}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, {0x1401, 0x166c}, - {0x166f, 0x167f}, {0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x16f1, 0x16f8}, - {0x1700, 0x170c}, {0x170e, 0x1711}, {0x1720, 0x1731}, {0x1740, 0x1751}, - {0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17b3}, {0x1820, 0x1877}, - {0x1880, 0x1884}, {0x1887, 0x18a8}, {0x18b0, 0x18f5}, {0x1900, 0x191e}, - {0x1950, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9}, - {0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1b05, 0x1b33}, {0x1b45, 0x1b4b}, - {0x1b83, 0x1ba0}, {0x1bba, 0x1be5}, {0x1c00, 0x1c23}, {0x1c4d, 0x1c4f}, - {0x1c5a, 0x1c7d}, {0x1c80, 0x1c88}, {0x1ce9, 0x1cec}, {0x1cee, 0x1cf1}, - {0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, - {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, - {0x1fb6, 0x1fbc}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, - {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, - {0x2090, 0x209c}, {0x210a, 0x2113}, {0x2119, 0x211d}, {0x212a, 0x212d}, - {0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149}, {0x2c00, 0x2c2e}, - {0x2c30, 0x2c5e}, {0x2c60, 0x2ce4}, {0x2ceb, 0x2cee}, {0x2d00, 0x2d25}, - {0x2d30, 0x2d67}, {0x2d80, 0x2d96}, {0x2da0, 0x2da6}, {0x2da8, 0x2dae}, - {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, {0x2dc8, 0x2dce}, - {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x3031, 0x3035}, {0x3041, 0x3096}, - {0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff}, {0x3105, 0x312d}, - {0x3131, 0x318e}, {0x31a0, 0x31ba}, {0x31f0, 0x31ff}, {0x3400, 0x4db5}, - {0x4e00, 0x9fd5}, {0xa000, 0xa48c}, {0xa4d0, 0xa4fd}, {0xa500, 0xa60c}, - {0xa610, 0xa61f}, {0xa640, 0xa66e}, {0xa67f, 0xa69d}, {0xa6a0, 0xa6e5}, - {0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa7ae}, {0xa7b0, 0xa7b7}, - {0xa7f7, 0xa801}, {0xa803, 0xa805}, {0xa807, 0xa80a}, {0xa80c, 0xa822}, - {0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7}, {0xa90a, 0xa925}, - {0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2}, {0xa9e0, 0xa9e4}, - {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, {0xaa00, 0xaa28}, {0xaa40, 0xaa42}, - {0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7e, 0xaaaf}, {0xaab9, 0xaabd}, - {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4}, {0xab01, 0xab06}, - {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e}, - {0xab30, 0xab5a}, {0xab5c, 0xab65}, {0xab70, 0xabe2}, {0xac00, 0xd7a3}, - {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xdc00, 0xdc3e}, {0xdc40, 0xdc7e}, - {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, {0xdd00, 0xdd3e}, {0xdd40, 0xdd7e}, - {0xdd80, 0xddbe}, {0xddc0, 0xddfe}, {0xde00, 0xde3e}, {0xde40, 0xde7e}, - {0xde80, 0xdebe}, {0xdec0, 0xdefe}, {0xdf00, 0xdf3e}, {0xdf40, 0xdf7e}, - {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, - {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, - {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f}, - {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, {0xfe76, 0xfefc}, - {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, {0xffc2, 0xffc7}, - {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc} + {0x800, 0x815}, {0x840, 0x858}, {0x860, 0x86a}, {0x8a0, 0x8b4}, + {0x8b6, 0x8bd}, {0x904, 0x939}, {0x958, 0x961}, {0x971, 0x980}, + {0x985, 0x98c}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, + {0x9df, 0x9e1}, {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, + {0xa59, 0xa5c}, {0xa72, 0xa74}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, + {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab5, 0xab9}, {0xb05, 0xb0c}, + {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb35, 0xb39}, {0xb5f, 0xb61}, + {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xba8, 0xbaa}, + {0xbae, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, + {0xc2a, 0xc39}, {0xc58, 0xc5a}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, + {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xd05, 0xd0c}, + {0xd0e, 0xd10}, {0xd12, 0xd3a}, {0xd54, 0xd56}, {0xd5f, 0xd61}, + {0xd7a, 0xd7f}, {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, + {0xdc0, 0xdc6}, {0xe01, 0xe30}, {0xe40, 0xe46}, {0xe94, 0xe97}, + {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xead, 0xeb0}, {0xec0, 0xec4}, + {0xedc, 0xedf}, {0xf40, 0xf47}, {0xf49, 0xf6c}, {0xf88, 0xf8c}, + {0x1000, 0x102a}, {0x1050, 0x1055}, {0x105a, 0x105d}, {0x106e, 0x1070}, + {0x1075, 0x1081}, {0x10a0, 0x10c5}, {0x10d0, 0x10fa}, {0x10fc, 0x1248}, + {0x124a, 0x124d}, {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, + {0x128a, 0x128d}, {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, + {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, + {0x1318, 0x135a}, {0x1380, 0x138f}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, + {0x1401, 0x166c}, {0x166f, 0x167f}, {0x1681, 0x169a}, {0x16a0, 0x16ea}, + {0x16f1, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1711}, {0x1720, 0x1731}, + {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17b3}, + {0x1820, 0x1877}, {0x1880, 0x1884}, {0x1887, 0x18a8}, {0x18b0, 0x18f5}, + {0x1900, 0x191e}, {0x1950, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab}, + {0x19b0, 0x19c9}, {0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1b05, 0x1b33}, + {0x1b45, 0x1b4b}, {0x1b83, 0x1ba0}, {0x1bba, 0x1be5}, {0x1c00, 0x1c23}, + {0x1c4d, 0x1c4f}, {0x1c5a, 0x1c7d}, {0x1c80, 0x1c88}, {0x1ce9, 0x1cec}, + {0x1cee, 0x1cf1}, {0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d}, + {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, + {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, + {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, + {0x1ff6, 0x1ffc}, {0x2090, 0x209c}, {0x210a, 0x2113}, {0x2119, 0x211d}, + {0x212a, 0x212d}, {0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149}, + {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2ce4}, {0x2ceb, 0x2cee}, + {0x2d00, 0x2d25}, {0x2d30, 0x2d67}, {0x2d80, 0x2d96}, {0x2da0, 0x2da6}, + {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, + {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x3031, 0x3035}, + {0x3041, 0x3096}, {0x309d, 0x309f}, {0x30a1, 0x30fa}, {0x30fc, 0x30ff}, + {0x3105, 0x312e}, {0x3131, 0x318e}, {0x31a0, 0x31ba}, {0x31f0, 0x31ff}, + {0x3400, 0x4db5}, {0x4e00, 0x9fea}, {0xa000, 0xa48c}, {0xa4d0, 0xa4fd}, + {0xa500, 0xa60c}, {0xa610, 0xa61f}, {0xa640, 0xa66e}, {0xa67f, 0xa69d}, + {0xa6a0, 0xa6e5}, {0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa7ae}, + {0xa7b0, 0xa7b7}, {0xa7f7, 0xa801}, {0xa803, 0xa805}, {0xa807, 0xa80a}, + {0xa80c, 0xa822}, {0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7}, + {0xa90a, 0xa925}, {0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2}, + {0xa9e0, 0xa9e4}, {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, {0xaa00, 0xaa28}, + {0xaa40, 0xaa42}, {0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7e, 0xaaaf}, + {0xaab9, 0xaabd}, {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4}, + {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, {0xab20, 0xab26}, + {0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab65}, {0xab70, 0xabe2}, + {0xac00, 0xd7a3}, {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xdc00, 0xdc3e}, + {0xdc40, 0xdc7e}, {0xdc80, 0xdcbe}, {0xdcc0, 0xdcfe}, {0xdd00, 0xdd3e}, + {0xdd40, 0xdd7e}, {0xdd80, 0xddbe}, {0xddc0, 0xddfe}, {0xde00, 0xde3e}, + {0xde40, 0xde7e}, {0xde80, 0xdebe}, {0xdec0, 0xdefe}, {0xdf00, 0xdf3e}, + {0xdf40, 0xdf7e}, {0xdf80, 0xdfbe}, {0xdfc0, 0xdffe}, {0xf900, 0xfa6d}, + {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1f, 0xfb28}, + {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, + {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, + {0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, + {0xffc2, 0xffc7}, {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc} #if TCL_UTF_MAX > 4 ,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d}, {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10280, 0x1029c}, {0x102a0, 0x102d0}, - {0x10300, 0x1031f}, {0x10330, 0x10340}, {0x10342, 0x10349}, {0x10350, 0x10375}, + {0x10300, 0x1031f}, {0x1032d, 0x10340}, {0x10342, 0x10349}, {0x10350, 0x10375}, {0x10380, 0x1039d}, {0x103a0, 0x103c3}, {0x103c8, 0x103cf}, {0x10400, 0x1049d}, {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, {0x10500, 0x10527}, {0x10530, 0x10563}, {0x10600, 0x10736}, {0x10740, 0x10755}, {0x10760, 0x10767}, {0x10800, 0x10805}, @@ -222,24 +222,26 @@ static const crange alphaRangeTable[] = { {0x11305, 0x1130c}, {0x11313, 0x11328}, {0x1132a, 0x11330}, {0x11335, 0x11339}, {0x1135d, 0x11361}, {0x11400, 0x11434}, {0x11447, 0x1144a}, {0x11480, 0x114af}, {0x11580, 0x115ae}, {0x115d8, 0x115db}, {0x11600, 0x1162f}, {0x11680, 0x116aa}, - {0x11700, 0x11719}, {0x118a0, 0x118df}, {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, - {0x11c0a, 0x11c2e}, {0x11c72, 0x11c8f}, {0x12000, 0x12399}, {0x12480, 0x12543}, - {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e}, - {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f}, {0x16b40, 0x16b43}, {0x16b63, 0x16b77}, - {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44}, {0x16f93, 0x16f9f}, {0x17000, 0x187ec}, - {0x18800, 0x18af2}, {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, - {0x1bc90, 0x1bc99}, {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, - {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, - {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, - {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d6c0}, - {0x1d6c2, 0x1d6da}, {0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734}, - {0x1d736, 0x1d74e}, {0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8}, - {0x1d7aa, 0x1d7c2}, {0x1d7c4, 0x1d7cb}, {0x1e800, 0x1e8c4}, {0x1e900, 0x1e943}, - {0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, - {0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, - {0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, - {0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, - {0x2b740, 0x2b81d}, {0x2b820, 0x2cea1}, {0x2f800, 0x2fa1d} + {0x11700, 0x11719}, {0x118a0, 0x118df}, {0x11a0b, 0x11a32}, {0x11a5c, 0x11a83}, + {0x11a86, 0x11a89}, {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, {0x11c0a, 0x11c2e}, + {0x11c72, 0x11c8f}, {0x11d00, 0x11d06}, {0x11d0b, 0x11d30}, {0x12000, 0x12399}, + {0x12480, 0x12543}, {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, + {0x16a40, 0x16a5e}, {0x16ad0, 0x16aed}, {0x16b00, 0x16b2f}, {0x16b40, 0x16b43}, + {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44}, {0x16f93, 0x16f9f}, + {0x17000, 0x187ec}, {0x18800, 0x18af2}, {0x1b000, 0x1b11e}, {0x1b170, 0x1b2fb}, + {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99}, + {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9}, + {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, + {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, + {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d6c0}, {0x1d6c2, 0x1d6da}, + {0x1d6dc, 0x1d6fa}, {0x1d6fc, 0x1d714}, {0x1d716, 0x1d734}, {0x1d736, 0x1d74e}, + {0x1d750, 0x1d76e}, {0x1d770, 0x1d788}, {0x1d78a, 0x1d7a8}, {0x1d7aa, 0x1d7c2}, + {0x1d7c4, 0x1d7cb}, {0x1e800, 0x1e8c4}, {0x1e900, 0x1e943}, {0x1ee00, 0x1ee03}, + {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, + {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, + {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, + {0x1eeab, 0x1eebb}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d}, + {0x2b820, 0x2cea1}, {0x2ceb0, 0x2ebe0}, {0x2f800, 0x2fa1d} #endif }; @@ -250,28 +252,29 @@ static const chr alphaCharTable[] = { 0x38c, 0x559, 0x66e, 0x66f, 0x6d5, 0x6e5, 0x6e6, 0x6ee, 0x6ef, 0x6ff, 0x710, 0x7b1, 0x7f4, 0x7f5, 0x7fa, 0x81a, 0x824, 0x828, 0x93d, 0x950, 0x98f, 0x990, 0x9b2, 0x9bd, 0x9ce, 0x9dc, 0x9dd, - 0x9f0, 0x9f1, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36, 0xa38, - 0xa39, 0xa5e, 0xab2, 0xab3, 0xabd, 0xad0, 0xae0, 0xae1, 0xaf9, - 0xb0f, 0xb10, 0xb32, 0xb33, 0xb3d, 0xb5c, 0xb5d, 0xb71, 0xb83, - 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4, 0xbd0, 0xc3d, - 0xc60, 0xc61, 0xc80, 0xcbd, 0xcde, 0xce0, 0xce1, 0xcf1, 0xcf2, - 0xd3d, 0xd4e, 0xdbd, 0xe32, 0xe33, 0xe81, 0xe82, 0xe84, 0xe87, - 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, 0xeb2, 0xeb3, - 0xebd, 0xec6, 0xf00, 0x103f, 0x1061, 0x1065, 0x1066, 0x108e, 0x10c7, - 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1bae, 0x1baf, - 0x1cf5, 0x1cf6, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071, 0x207f, 0x2102, - 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2183, 0x2184, 0x2cf2, - 0x2cf3, 0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3005, 0x3006, 0x303b, 0x303c, - 0xa62a, 0xa62b, 0xa8fb, 0xa8fd, 0xa9cf, 0xaa7a, 0xaab1, 0xaab5, 0xaab6, - 0xaac0, 0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44 + 0x9f0, 0x9f1, 0x9fc, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36, + 0xa38, 0xa39, 0xa5e, 0xab2, 0xab3, 0xabd, 0xad0, 0xae0, 0xae1, + 0xaf9, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb3d, 0xb5c, 0xb5d, 0xb71, + 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, 0xba3, 0xba4, 0xbd0, + 0xc3d, 0xc60, 0xc61, 0xc80, 0xcbd, 0xcde, 0xce0, 0xce1, 0xcf1, + 0xcf2, 0xd3d, 0xd4e, 0xdbd, 0xe32, 0xe33, 0xe81, 0xe82, 0xe84, + 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, 0xeb2, + 0xeb3, 0xebd, 0xec6, 0xf00, 0x103f, 0x1061, 0x1065, 0x1066, 0x108e, + 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1bae, + 0x1baf, 0x1cf5, 0x1cf6, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071, 0x207f, + 0x2102, 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2183, 0x2184, + 0x2cf2, 0x2cf3, 0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3005, 0x3006, 0x303b, + 0x303c, 0xa62a, 0xa62b, 0xa8fb, 0xa8fd, 0xa9cf, 0xaa7a, 0xaab1, 0xaab5, + 0xaab6, 0xaac0, 0xaac2, 0xfb1d, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44 #if TCL_UTF_MAX > 4 ,0x1003c, 0x1003d, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, 0x108f5, 0x109be, 0x109bf, 0x10a00, 0x11176, 0x111da, 0x111dc, 0x11288, 0x1130f, 0x11310, 0x11332, - 0x11333, 0x1133d, 0x11350, 0x114c4, 0x114c5, 0x114c7, 0x11644, 0x118ff, 0x11c40, - 0x16f50, 0x16fe0, 0x1b000, 0x1b001, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, - 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, - 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, - 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e + 0x11333, 0x1133d, 0x11350, 0x114c4, 0x114c5, 0x114c7, 0x11644, 0x118ff, 0x11a00, + 0x11a3a, 0x11a50, 0x11c40, 0x11d08, 0x11d09, 0x11d46, 0x16f50, 0x16fe0, 0x16fe1, + 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1ee21, 0x1ee22, + 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, + 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, + 0x1ee64, 0x1ee7e #endif }; @@ -321,8 +324,8 @@ static const crange digitRangeTable[] = { ,{0x104a0, 0x104a9}, {0x11066, 0x1106f}, {0x110f0, 0x110f9}, {0x11136, 0x1113f}, {0x111d0, 0x111d9}, {0x112f0, 0x112f9}, {0x11450, 0x11459}, {0x114d0, 0x114d9}, {0x11650, 0x11659}, {0x116c0, 0x116c9}, {0x11730, 0x11739}, {0x118e0, 0x118e9}, - {0x11c50, 0x11c59}, {0x16a60, 0x16a69}, {0x16b50, 0x16b59}, {0x1d7ce, 0x1d7ff}, - {0x1e950, 0x1e959} + {0x11c50, 0x11c59}, {0x11d50, 0x11d59}, {0x16a60, 0x16a69}, {0x16b50, 0x16b59}, + {0x1d7ce, 0x1d7ff}, {0x1e950, 0x1e959} #endif }; @@ -345,7 +348,7 @@ static const crange punctRangeTable[] = { {0x1b5a, 0x1b60}, {0x1bfc, 0x1bff}, {0x1c3b, 0x1c3f}, {0x1cc0, 0x1cc7}, {0x2010, 0x2027}, {0x2030, 0x2043}, {0x2045, 0x2051}, {0x2053, 0x205e}, {0x2308, 0x230b}, {0x2768, 0x2775}, {0x27e6, 0x27ef}, {0x2983, 0x2998}, - {0x29d8, 0x29db}, {0x2cf9, 0x2cfc}, {0x2e00, 0x2e2e}, {0x2e30, 0x2e44}, + {0x29d8, 0x29db}, {0x2cf9, 0x2cfc}, {0x2e00, 0x2e2e}, {0x2e30, 0x2e49}, {0x3001, 0x3003}, {0x3008, 0x3011}, {0x3014, 0x301f}, {0xa60d, 0xa60f}, {0xa6f2, 0xa6f7}, {0xa874, 0xa877}, {0xa8f8, 0xa8fa}, {0xa9c1, 0xa9cd}, {0xaa5c, 0xaa5f}, {0xfe10, 0xfe19}, {0xfe30, 0xfe52}, {0xfe54, 0xfe61}, @@ -356,7 +359,8 @@ static const crange punctRangeTable[] = { {0x10b99, 0x10b9c}, {0x11047, 0x1104d}, {0x110be, 0x110c1}, {0x11140, 0x11143}, {0x111c5, 0x111c9}, {0x111dd, 0x111df}, {0x11238, 0x1123d}, {0x1144b, 0x1144f}, {0x115c1, 0x115d7}, {0x11641, 0x11643}, {0x11660, 0x1166c}, {0x1173c, 0x1173e}, - {0x11c41, 0x11c45}, {0x12470, 0x12474}, {0x16b37, 0x16b3b}, {0x1da87, 0x1da8b} + {0x11a3f, 0x11a46}, {0x11a9a, 0x11a9c}, {0x11a9e, 0x11aa2}, {0x11c41, 0x11c45}, + {0x12470, 0x12474}, {0x16b37, 0x16b3b}, {0x1da87, 0x1da8b} #endif }; @@ -367,14 +371,14 @@ static const chr punctCharTable[] = { 0xab, 0xb6, 0xb7, 0xbb, 0xbf, 0x37e, 0x387, 0x589, 0x58a, 0x5be, 0x5c0, 0x5c3, 0x5c6, 0x5f3, 0x5f4, 0x609, 0x60a, 0x60c, 0x60d, 0x61b, 0x61e, 0x61f, 0x6d4, 0x85e, 0x964, 0x965, 0x970, - 0xaf0, 0xdf4, 0xe4f, 0xe5a, 0xe5b, 0xf14, 0xf85, 0xfd9, 0xfda, - 0x10fb, 0x1400, 0x166d, 0x166e, 0x169b, 0x169c, 0x1735, 0x1736, 0x1944, - 0x1945, 0x1a1e, 0x1a1f, 0x1c7e, 0x1c7f, 0x1cd3, 0x207d, 0x207e, 0x208d, - 0x208e, 0x2329, 0x232a, 0x27c5, 0x27c6, 0x29fc, 0x29fd, 0x2cfe, 0x2cff, - 0x2d70, 0x3030, 0x303d, 0x30a0, 0x30fb, 0xa4fe, 0xa4ff, 0xa673, 0xa67e, - 0xa8ce, 0xa8cf, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa9de, 0xa9df, 0xaade, - 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68, 0xfe6a, - 0xfe6b, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d + 0x9fd, 0xaf0, 0xdf4, 0xe4f, 0xe5a, 0xe5b, 0xf14, 0xf85, 0xfd9, + 0xfda, 0x10fb, 0x1400, 0x166d, 0x166e, 0x169b, 0x169c, 0x1735, 0x1736, + 0x1944, 0x1945, 0x1a1e, 0x1a1f, 0x1c7e, 0x1c7f, 0x1cd3, 0x207d, 0x207e, + 0x208d, 0x208e, 0x2329, 0x232a, 0x27c5, 0x27c6, 0x29fc, 0x29fd, 0x2cfe, + 0x2cff, 0x2d70, 0x3030, 0x303d, 0x30a0, 0x30fb, 0xa4fe, 0xa4ff, 0xa673, + 0xa67e, 0xa8ce, 0xa8cf, 0xa8fc, 0xa92e, 0xa92f, 0xa95f, 0xa9de, 0xa9df, + 0xaade, 0xaadf, 0xaaf0, 0xaaf1, 0xabeb, 0xfd3e, 0xfd3f, 0xfe63, 0xfe68, + 0xfe6a, 0xfe6b, 0xff1a, 0xff1b, 0xff1f, 0xff20, 0xff3f, 0xff5b, 0xff5d #if TCL_UTF_MAX > 4 ,0x1039f, 0x103d0, 0x1056f, 0x10857, 0x1091f, 0x1093f, 0x10a7f, 0x110bb, 0x110bc, 0x11174, 0x11175, 0x111cd, 0x111db, 0x112a9, 0x1145b, 0x1145d, 0x114c6, 0x11c70, @@ -615,63 +619,63 @@ static const crange graphRangeTable[] = { {0x559, 0x55f}, {0x561, 0x587}, {0x58d, 0x58f}, {0x591, 0x5c7}, {0x5d0, 0x5ea}, {0x5f0, 0x5f4}, {0x606, 0x61b}, {0x61e, 0x6dc}, {0x6de, 0x70d}, {0x710, 0x74a}, {0x74d, 0x7b1}, {0x7c0, 0x7fa}, - {0x800, 0x82d}, {0x830, 0x83e}, {0x840, 0x85b}, {0x8a0, 0x8b4}, - {0x8b6, 0x8bd}, {0x8d4, 0x8e1}, {0x8e3, 0x983}, {0x985, 0x98c}, - {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, {0x9bc, 0x9c4}, - {0x9cb, 0x9ce}, {0x9df, 0x9e3}, {0x9e6, 0x9fb}, {0xa01, 0xa03}, - {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa3e, 0xa42}, - {0xa4b, 0xa4d}, {0xa59, 0xa5c}, {0xa66, 0xa75}, {0xa81, 0xa83}, - {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, {0xaaa, 0xab0}, - {0xab5, 0xab9}, {0xabc, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, - {0xae0, 0xae3}, {0xae6, 0xaf1}, {0xb01, 0xb03}, {0xb05, 0xb0c}, - {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb35, 0xb39}, {0xb3c, 0xb44}, - {0xb4b, 0xb4d}, {0xb5f, 0xb63}, {0xb66, 0xb77}, {0xb85, 0xb8a}, - {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xba8, 0xbaa}, {0xbae, 0xbb9}, - {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, {0xbca, 0xbcd}, {0xbe6, 0xbfa}, - {0xc00, 0xc03}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, - {0xc2a, 0xc39}, {0xc3d, 0xc44}, {0xc46, 0xc48}, {0xc4a, 0xc4d}, - {0xc58, 0xc5a}, {0xc60, 0xc63}, {0xc66, 0xc6f}, {0xc78, 0xc83}, - {0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, - {0xcb5, 0xcb9}, {0xcbc, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, - {0xce0, 0xce3}, {0xce6, 0xcef}, {0xd01, 0xd03}, {0xd05, 0xd0c}, - {0xd0e, 0xd10}, {0xd12, 0xd3a}, {0xd3d, 0xd44}, {0xd46, 0xd48}, - {0xd4a, 0xd4f}, {0xd54, 0xd63}, {0xd66, 0xd7f}, {0xd85, 0xd96}, - {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6}, {0xdcf, 0xdd4}, - {0xdd8, 0xddf}, {0xde6, 0xdef}, {0xdf2, 0xdf4}, {0xe01, 0xe3a}, - {0xe3f, 0xe5b}, {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, - {0xead, 0xeb9}, {0xebb, 0xebd}, {0xec0, 0xec4}, {0xec8, 0xecd}, - {0xed0, 0xed9}, {0xedc, 0xedf}, {0xf00, 0xf47}, {0xf49, 0xf6c}, - {0xf71, 0xf97}, {0xf99, 0xfbc}, {0xfbe, 0xfcc}, {0xfce, 0xfda}, - {0x1000, 0x10c5}, {0x10d0, 0x1248}, {0x124a, 0x124d}, {0x1250, 0x1256}, - {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12b0}, - {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, - {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, {0x135d, 0x137c}, - {0x1380, 0x1399}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, {0x1400, 0x167f}, - {0x1681, 0x169c}, {0x16a0, 0x16f8}, {0x1700, 0x170c}, {0x170e, 0x1714}, - {0x1720, 0x1736}, {0x1740, 0x1753}, {0x1760, 0x176c}, {0x176e, 0x1770}, - {0x1780, 0x17dd}, {0x17e0, 0x17e9}, {0x17f0, 0x17f9}, {0x1800, 0x180d}, - {0x1810, 0x1819}, {0x1820, 0x1877}, {0x1880, 0x18aa}, {0x18b0, 0x18f5}, - {0x1900, 0x191e}, {0x1920, 0x192b}, {0x1930, 0x193b}, {0x1944, 0x196d}, - {0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9}, {0x19d0, 0x19da}, - {0x19de, 0x1a1b}, {0x1a1e, 0x1a5e}, {0x1a60, 0x1a7c}, {0x1a7f, 0x1a89}, - {0x1a90, 0x1a99}, {0x1aa0, 0x1aad}, {0x1ab0, 0x1abe}, {0x1b00, 0x1b4b}, - {0x1b50, 0x1b7c}, {0x1b80, 0x1bf3}, {0x1bfc, 0x1c37}, {0x1c3b, 0x1c49}, - {0x1c4d, 0x1c88}, {0x1cc0, 0x1cc7}, {0x1cd0, 0x1cf6}, {0x1d00, 0x1df5}, - {0x1dfb, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, - {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fc4}, - {0x1fc6, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fdd, 0x1fef}, {0x1ff2, 0x1ff4}, - {0x1ff6, 0x1ffe}, {0x2010, 0x2027}, {0x2030, 0x205e}, {0x2074, 0x208e}, - {0x2090, 0x209c}, {0x20a0, 0x20be}, {0x20d0, 0x20f0}, {0x2100, 0x218b}, - {0x2190, 0x23fe}, {0x2400, 0x2426}, {0x2440, 0x244a}, {0x2460, 0x2b73}, - {0x2b76, 0x2b95}, {0x2b98, 0x2bb9}, {0x2bbd, 0x2bc8}, {0x2bca, 0x2bd1}, + {0x800, 0x82d}, {0x830, 0x83e}, {0x840, 0x85b}, {0x860, 0x86a}, + {0x8a0, 0x8b4}, {0x8b6, 0x8bd}, {0x8d4, 0x8e1}, {0x8e3, 0x983}, + {0x985, 0x98c}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b6, 0x9b9}, + {0x9bc, 0x9c4}, {0x9cb, 0x9ce}, {0x9df, 0x9e3}, {0x9e6, 0x9fd}, + {0xa01, 0xa03}, {0xa05, 0xa0a}, {0xa13, 0xa28}, {0xa2a, 0xa30}, + {0xa3e, 0xa42}, {0xa4b, 0xa4d}, {0xa59, 0xa5c}, {0xa66, 0xa75}, + {0xa81, 0xa83}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, + {0xaaa, 0xab0}, {0xab5, 0xab9}, {0xabc, 0xac5}, {0xac7, 0xac9}, + {0xacb, 0xacd}, {0xae0, 0xae3}, {0xae6, 0xaf1}, {0xaf9, 0xaff}, + {0xb01, 0xb03}, {0xb05, 0xb0c}, {0xb13, 0xb28}, {0xb2a, 0xb30}, + {0xb35, 0xb39}, {0xb3c, 0xb44}, {0xb4b, 0xb4d}, {0xb5f, 0xb63}, + {0xb66, 0xb77}, {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95}, + {0xba8, 0xbaa}, {0xbae, 0xbb9}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, + {0xbca, 0xbcd}, {0xbe6, 0xbfa}, {0xc00, 0xc03}, {0xc05, 0xc0c}, + {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, {0xc3d, 0xc44}, + {0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc58, 0xc5a}, {0xc60, 0xc63}, + {0xc66, 0xc6f}, {0xc78, 0xc83}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, + {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xcbc, 0xcc4}, + {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xce0, 0xce3}, {0xce6, 0xcef}, + {0xd00, 0xd03}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd44}, + {0xd46, 0xd48}, {0xd4a, 0xd4f}, {0xd54, 0xd63}, {0xd66, 0xd7f}, + {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdc0, 0xdc6}, + {0xdcf, 0xdd4}, {0xdd8, 0xddf}, {0xde6, 0xdef}, {0xdf2, 0xdf4}, + {0xe01, 0xe3a}, {0xe3f, 0xe5b}, {0xe94, 0xe97}, {0xe99, 0xe9f}, + {0xea1, 0xea3}, {0xead, 0xeb9}, {0xebb, 0xebd}, {0xec0, 0xec4}, + {0xec8, 0xecd}, {0xed0, 0xed9}, {0xedc, 0xedf}, {0xf00, 0xf47}, + {0xf49, 0xf6c}, {0xf71, 0xf97}, {0xf99, 0xfbc}, {0xfbe, 0xfcc}, + {0xfce, 0xfda}, {0x1000, 0x10c5}, {0x10d0, 0x1248}, {0x124a, 0x124d}, + {0x1250, 0x1256}, {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, + {0x1290, 0x12b0}, {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c2, 0x12c5}, + {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, + {0x135d, 0x137c}, {0x1380, 0x1399}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, + {0x1400, 0x167f}, {0x1681, 0x169c}, {0x16a0, 0x16f8}, {0x1700, 0x170c}, + {0x170e, 0x1714}, {0x1720, 0x1736}, {0x1740, 0x1753}, {0x1760, 0x176c}, + {0x176e, 0x1770}, {0x1780, 0x17dd}, {0x17e0, 0x17e9}, {0x17f0, 0x17f9}, + {0x1800, 0x180d}, {0x1810, 0x1819}, {0x1820, 0x1877}, {0x1880, 0x18aa}, + {0x18b0, 0x18f5}, {0x1900, 0x191e}, {0x1920, 0x192b}, {0x1930, 0x193b}, + {0x1944, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab}, {0x19b0, 0x19c9}, + {0x19d0, 0x19da}, {0x19de, 0x1a1b}, {0x1a1e, 0x1a5e}, {0x1a60, 0x1a7c}, + {0x1a7f, 0x1a89}, {0x1a90, 0x1a99}, {0x1aa0, 0x1aad}, {0x1ab0, 0x1abe}, + {0x1b00, 0x1b4b}, {0x1b50, 0x1b7c}, {0x1b80, 0x1bf3}, {0x1bfc, 0x1c37}, + {0x1c3b, 0x1c49}, {0x1c4d, 0x1c88}, {0x1cc0, 0x1cc7}, {0x1cd0, 0x1cf9}, + {0x1d00, 0x1df9}, {0x1dfb, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, + {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, + {0x1fb6, 0x1fc4}, {0x1fc6, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fdd, 0x1fef}, + {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffe}, {0x2010, 0x2027}, {0x2030, 0x205e}, + {0x2074, 0x208e}, {0x2090, 0x209c}, {0x20a0, 0x20bf}, {0x20d0, 0x20f0}, + {0x2100, 0x218b}, {0x2190, 0x2426}, {0x2440, 0x244a}, {0x2460, 0x2b73}, + {0x2b76, 0x2b95}, {0x2b98, 0x2bb9}, {0x2bbd, 0x2bc8}, {0x2bca, 0x2bd2}, {0x2bec, 0x2bef}, {0x2c00, 0x2c2e}, {0x2c30, 0x2c5e}, {0x2c60, 0x2cf3}, {0x2cf9, 0x2d25}, {0x2d30, 0x2d67}, {0x2d7f, 0x2d96}, {0x2da0, 0x2da6}, {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, - {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2de0, 0x2e44}, + {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2de0, 0x2e49}, {0x2e80, 0x2e99}, {0x2e9b, 0x2ef3}, {0x2f00, 0x2fd5}, {0x2ff0, 0x2ffb}, - {0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff}, {0x3105, 0x312d}, + {0x3001, 0x303f}, {0x3041, 0x3096}, {0x3099, 0x30ff}, {0x3105, 0x312e}, {0x3131, 0x318e}, {0x3190, 0x31ba}, {0x31c0, 0x31e3}, {0x31f0, 0x321e}, - {0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fd5}, {0xa000, 0xa48c}, + {0x3220, 0x32fe}, {0x3300, 0x4db5}, {0x4dc0, 0x9fea}, {0xa000, 0xa48c}, {0xa490, 0xa4c6}, {0xa4d0, 0xa62b}, {0xa640, 0xa6f7}, {0xa700, 0xa7ae}, {0xa7b0, 0xa7b7}, {0xa7f7, 0xa82b}, {0xa830, 0xa839}, {0xa840, 0xa877}, {0xa880, 0xa8c5}, {0xa8ce, 0xa8d9}, {0xa8e0, 0xa8fd}, {0xa900, 0xa953}, @@ -694,7 +698,7 @@ static const crange graphRangeTable[] = { ,{0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003f, 0x1004d}, {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10100, 0x10102}, {0x10107, 0x10133}, {0x10137, 0x1018e}, {0x10190, 0x1019b}, {0x101d0, 0x101fd}, {0x10280, 0x1029c}, - {0x102a0, 0x102d0}, {0x102e0, 0x102fb}, {0x10300, 0x10323}, {0x10330, 0x1034a}, + {0x102a0, 0x102d0}, {0x102e0, 0x102fb}, {0x10300, 0x10323}, {0x1032d, 0x1034a}, {0x10350, 0x1037a}, {0x10380, 0x1039d}, {0x1039f, 0x103c3}, {0x103c8, 0x103d5}, {0x10400, 0x1049d}, {0x104a0, 0x104a9}, {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, {0x10500, 0x10527}, {0x10530, 0x10563}, {0x10600, 0x10736}, {0x10740, 0x10755}, @@ -717,35 +721,38 @@ static const crange graphRangeTable[] = { {0x114d0, 0x114d9}, {0x11580, 0x115b5}, {0x115b8, 0x115dd}, {0x11600, 0x11644}, {0x11650, 0x11659}, {0x11660, 0x1166c}, {0x11680, 0x116b7}, {0x116c0, 0x116c9}, {0x11700, 0x11719}, {0x1171d, 0x1172b}, {0x11730, 0x1173f}, {0x118a0, 0x118f2}, + {0x11a00, 0x11a47}, {0x11a50, 0x11a83}, {0x11a86, 0x11a9c}, {0x11a9e, 0x11aa2}, {0x11ac0, 0x11af8}, {0x11c00, 0x11c08}, {0x11c0a, 0x11c36}, {0x11c38, 0x11c45}, {0x11c50, 0x11c6c}, {0x11c70, 0x11c8f}, {0x11c92, 0x11ca7}, {0x11ca9, 0x11cb6}, + {0x11d00, 0x11d06}, {0x11d0b, 0x11d36}, {0x11d3f, 0x11d47}, {0x11d50, 0x11d59}, {0x12000, 0x12399}, {0x12400, 0x1246e}, {0x12470, 0x12474}, {0x12480, 0x12543}, {0x13000, 0x1342e}, {0x14400, 0x14646}, {0x16800, 0x16a38}, {0x16a40, 0x16a5e}, {0x16a60, 0x16a69}, {0x16ad0, 0x16aed}, {0x16af0, 0x16af5}, {0x16b00, 0x16b45}, {0x16b50, 0x16b59}, {0x16b5b, 0x16b61}, {0x16b63, 0x16b77}, {0x16b7d, 0x16b8f}, {0x16f00, 0x16f44}, {0x16f50, 0x16f7e}, {0x16f8f, 0x16f9f}, {0x17000, 0x187ec}, - {0x18800, 0x18af2}, {0x1bc00, 0x1bc6a}, {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, - {0x1bc90, 0x1bc99}, {0x1bc9c, 0x1bc9f}, {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, - {0x1d129, 0x1d172}, {0x1d17b, 0x1d1e8}, {0x1d200, 0x1d245}, {0x1d300, 0x1d356}, - {0x1d360, 0x1d371}, {0x1d400, 0x1d454}, {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, - {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, - {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, - {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d7cb}, - {0x1d7ce, 0x1da8b}, {0x1da9b, 0x1da9f}, {0x1daa1, 0x1daaf}, {0x1e000, 0x1e006}, - {0x1e008, 0x1e018}, {0x1e01b, 0x1e021}, {0x1e026, 0x1e02a}, {0x1e800, 0x1e8c4}, - {0x1e8c7, 0x1e8d6}, {0x1e900, 0x1e94a}, {0x1e950, 0x1e959}, {0x1ee00, 0x1ee03}, - {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, - {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, - {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, - {0x1eeab, 0x1eebb}, {0x1f000, 0x1f02b}, {0x1f030, 0x1f093}, {0x1f0a0, 0x1f0ae}, - {0x1f0b1, 0x1f0bf}, {0x1f0c1, 0x1f0cf}, {0x1f0d1, 0x1f0f5}, {0x1f100, 0x1f10c}, - {0x1f110, 0x1f12e}, {0x1f130, 0x1f16b}, {0x1f170, 0x1f1ac}, {0x1f1e6, 0x1f202}, - {0x1f210, 0x1f23b}, {0x1f240, 0x1f248}, {0x1f300, 0x1f6d2}, {0x1f6e0, 0x1f6ec}, - {0x1f6f0, 0x1f6f6}, {0x1f700, 0x1f773}, {0x1f780, 0x1f7d4}, {0x1f800, 0x1f80b}, - {0x1f810, 0x1f847}, {0x1f850, 0x1f859}, {0x1f860, 0x1f887}, {0x1f890, 0x1f8ad}, - {0x1f910, 0x1f91e}, {0x1f920, 0x1f927}, {0x1f933, 0x1f93e}, {0x1f940, 0x1f94b}, - {0x1f950, 0x1f95e}, {0x1f980, 0x1f991}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, - {0x2b740, 0x2b81d}, {0x2b820, 0x2cea1}, {0x2f800, 0x2fa1d}, {0xe0100, 0xe01ef} + {0x18800, 0x18af2}, {0x1b000, 0x1b11e}, {0x1b170, 0x1b2fb}, {0x1bc00, 0x1bc6a}, + {0x1bc70, 0x1bc7c}, {0x1bc80, 0x1bc88}, {0x1bc90, 0x1bc99}, {0x1bc9c, 0x1bc9f}, + {0x1d000, 0x1d0f5}, {0x1d100, 0x1d126}, {0x1d129, 0x1d172}, {0x1d17b, 0x1d1e8}, + {0x1d200, 0x1d245}, {0x1d300, 0x1d356}, {0x1d360, 0x1d371}, {0x1d400, 0x1d454}, + {0x1d456, 0x1d49c}, {0x1d4a9, 0x1d4ac}, {0x1d4ae, 0x1d4b9}, {0x1d4bd, 0x1d4c3}, + {0x1d4c5, 0x1d505}, {0x1d507, 0x1d50a}, {0x1d50d, 0x1d514}, {0x1d516, 0x1d51c}, + {0x1d51e, 0x1d539}, {0x1d53b, 0x1d53e}, {0x1d540, 0x1d544}, {0x1d54a, 0x1d550}, + {0x1d552, 0x1d6a5}, {0x1d6a8, 0x1d7cb}, {0x1d7ce, 0x1da8b}, {0x1da9b, 0x1da9f}, + {0x1daa1, 0x1daaf}, {0x1e000, 0x1e006}, {0x1e008, 0x1e018}, {0x1e01b, 0x1e021}, + {0x1e026, 0x1e02a}, {0x1e800, 0x1e8c4}, {0x1e8c7, 0x1e8d6}, {0x1e900, 0x1e94a}, + {0x1e950, 0x1e959}, {0x1ee00, 0x1ee03}, {0x1ee05, 0x1ee1f}, {0x1ee29, 0x1ee32}, + {0x1ee34, 0x1ee37}, {0x1ee4d, 0x1ee4f}, {0x1ee67, 0x1ee6a}, {0x1ee6c, 0x1ee72}, + {0x1ee74, 0x1ee77}, {0x1ee79, 0x1ee7c}, {0x1ee80, 0x1ee89}, {0x1ee8b, 0x1ee9b}, + {0x1eea1, 0x1eea3}, {0x1eea5, 0x1eea9}, {0x1eeab, 0x1eebb}, {0x1f000, 0x1f02b}, + {0x1f030, 0x1f093}, {0x1f0a0, 0x1f0ae}, {0x1f0b1, 0x1f0bf}, {0x1f0c1, 0x1f0cf}, + {0x1f0d1, 0x1f0f5}, {0x1f100, 0x1f10c}, {0x1f110, 0x1f12e}, {0x1f130, 0x1f16b}, + {0x1f170, 0x1f1ac}, {0x1f1e6, 0x1f202}, {0x1f210, 0x1f23b}, {0x1f240, 0x1f248}, + {0x1f260, 0x1f265}, {0x1f300, 0x1f6d4}, {0x1f6e0, 0x1f6ec}, {0x1f6f0, 0x1f6f8}, + {0x1f700, 0x1f773}, {0x1f780, 0x1f7d4}, {0x1f800, 0x1f80b}, {0x1f810, 0x1f847}, + {0x1f850, 0x1f859}, {0x1f860, 0x1f887}, {0x1f890, 0x1f8ad}, {0x1f900, 0x1f90b}, + {0x1f910, 0x1f93e}, {0x1f940, 0x1f94c}, {0x1f950, 0x1f96b}, {0x1f980, 0x1f997}, + {0x1f9d0, 0x1f9e6}, {0x20000, 0x2a6d6}, {0x2a700, 0x2b734}, {0x2b740, 0x2b81d}, + {0x2b820, 0x2cea1}, {0x2ceb0, 0x2ebe0}, {0x2f800, 0x2fa1d}, {0xe0100, 0xe01ef} #endif }; @@ -755,23 +762,23 @@ static const chr graphCharTable[] = { 0x38c, 0x589, 0x58a, 0x85e, 0x98f, 0x990, 0x9b2, 0x9c7, 0x9c8, 0x9d7, 0x9dc, 0x9dd, 0xa0f, 0xa10, 0xa32, 0xa33, 0xa35, 0xa36, 0xa38, 0xa39, 0xa3c, 0xa47, 0xa48, 0xa51, 0xa5e, 0xab2, 0xab3, - 0xad0, 0xaf9, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56, - 0xb57, 0xb5c, 0xb5d, 0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, - 0xb9f, 0xba3, 0xba4, 0xbd0, 0xbd7, 0xc55, 0xc56, 0xcd5, 0xcd6, - 0xcde, 0xcf1, 0xcf2, 0xd82, 0xd83, 0xdbd, 0xdca, 0xdd6, 0xe81, - 0xe82, 0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, - 0xeab, 0xec6, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x1772, 0x1773, 0x1940, - 0x1cf8, 0x1cf9, 0x1f59, 0x1f5b, 0x1f5d, 0x2070, 0x2071, 0x2d27, 0x2d2d, - 0x2d6f, 0x2d70, 0xfb3e, 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc, 0xfffd + 0xad0, 0xb0f, 0xb10, 0xb32, 0xb33, 0xb47, 0xb48, 0xb56, 0xb57, + 0xb5c, 0xb5d, 0xb82, 0xb83, 0xb99, 0xb9a, 0xb9c, 0xb9e, 0xb9f, + 0xba3, 0xba4, 0xbd0, 0xbd7, 0xc55, 0xc56, 0xcd5, 0xcd6, 0xcde, + 0xcf1, 0xcf2, 0xd82, 0xd83, 0xdbd, 0xdca, 0xdd6, 0xe81, 0xe82, + 0xe84, 0xe87, 0xe88, 0xe8a, 0xe8d, 0xea5, 0xea7, 0xeaa, 0xeab, + 0xec6, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x1772, 0x1773, 0x1940, 0x1f59, + 0x1f5b, 0x1f5d, 0x2070, 0x2071, 0x2d27, 0x2d2d, 0x2d6f, 0x2d70, 0xfb3e, + 0xfb40, 0xfb41, 0xfb43, 0xfb44, 0xfffc, 0xfffd #if TCL_UTF_MAX > 4 ,0x1003c, 0x1003d, 0x101a0, 0x1056f, 0x10808, 0x10837, 0x10838, 0x1083c, 0x108f4, 0x108f5, 0x1093f, 0x10a05, 0x10a06, 0x11288, 0x1130f, 0x11310, 0x11332, 0x11333, - 0x11347, 0x11348, 0x11350, 0x11357, 0x1145b, 0x1145d, 0x118ff, 0x16a6e, 0x16a6f, - 0x16fe0, 0x1b000, 0x1b001, 0x1d49e, 0x1d49f, 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, - 0x1d546, 0x1e023, 0x1e024, 0x1e95e, 0x1e95f, 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, - 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, - 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e, - 0x1eef0, 0x1eef1, 0x1f250, 0x1f251, 0x1f930, 0x1f9c0 + 0x11347, 0x11348, 0x11350, 0x11357, 0x1145b, 0x1145d, 0x118ff, 0x11d08, 0x11d09, + 0x11d3a, 0x11d3c, 0x11d3d, 0x16a6e, 0x16a6f, 0x16fe0, 0x16fe1, 0x1d49e, 0x1d49f, + 0x1d4a2, 0x1d4a5, 0x1d4a6, 0x1d4bb, 0x1d546, 0x1e023, 0x1e024, 0x1e95e, 0x1e95f, + 0x1ee21, 0x1ee22, 0x1ee24, 0x1ee27, 0x1ee39, 0x1ee3b, 0x1ee42, 0x1ee47, 0x1ee49, + 0x1ee4b, 0x1ee51, 0x1ee52, 0x1ee54, 0x1ee57, 0x1ee59, 0x1ee5b, 0x1ee5d, 0x1ee5f, + 0x1ee61, 0x1ee62, 0x1ee64, 0x1ee7e, 0x1eef0, 0x1eef1, 0x1f250, 0x1f251, 0x1f9c0 #endif }; diff --git a/generic/tclUniData.c b/generic/tclUniData.c index 20fab8c..9f05230 100644 --- a/generic/tclUniData.c +++ b/generic/tclUniData.c @@ -29,36 +29,36 @@ static const unsigned short pageMap[] = { 832, 864, 896, 928, 960, 992, 224, 1024, 224, 1056, 224, 224, 1088, 1120, 1152, 1184, 1216, 1248, 1280, 1312, 1344, 1376, 1408, 1344, 1344, 1440, 1472, 1504, 1536, 1568, 1344, 1344, 1600, 1632, 1664, 1696, 1728, - 1760, 1792, 1792, 1824, 1856, 1888, 1920, 1952, 1984, 2016, 2048, 2080, - 2112, 2144, 2176, 2208, 2240, 2272, 2304, 2336, 2368, 2400, 2432, 2464, - 2496, 2528, 2560, 2592, 2624, 2656, 2688, 2720, 2752, 2784, 2816, 2848, - 2880, 2912, 2944, 2976, 3008, 3040, 3072, 3104, 3136, 3168, 3200, 3232, - 3264, 1792, 3296, 3328, 3360, 1792, 3392, 3424, 3456, 3488, 3520, 3552, - 3584, 1792, 1344, 3616, 3648, 3680, 3712, 3744, 3776, 3808, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 3840, 1344, 3872, 3904, - 3936, 1344, 3968, 1344, 4000, 4032, 4064, 4096, 4096, 4128, 4160, 1344, + 1760, 1792, 1824, 1856, 1888, 1920, 1952, 1984, 2016, 2048, 2080, 2112, + 2144, 2176, 2208, 2240, 2272, 2304, 2336, 2368, 2400, 2432, 2464, 2496, + 2528, 2560, 2592, 2624, 2656, 2688, 2720, 2752, 2784, 2816, 2848, 2880, + 2912, 2944, 2976, 3008, 3040, 3072, 3104, 3136, 3168, 3200, 3232, 3264, + 3296, 1824, 3328, 3360, 3392, 1824, 3424, 3456, 3488, 3520, 3552, 3584, + 3616, 1824, 1344, 3648, 3680, 3712, 3744, 3776, 3808, 3840, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 3872, 1344, 3904, 3936, + 3968, 1344, 4000, 1344, 4032, 4064, 4096, 4128, 4128, 4160, 4192, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 4192, 4224, 1344, 1344, 4256, 4288, 4320, - 4352, 4384, 1344, 4416, 4448, 4480, 4512, 1344, 4544, 4576, 4608, 4640, - 1344, 4672, 4704, 4736, 4768, 4800, 1344, 4832, 4864, 4896, 4928, 1344, - 4960, 4992, 5024, 5056, 1792, 1792, 5088, 5120, 5152, 5184, 5216, 5248, - 1344, 5280, 1344, 5312, 5344, 5376, 5408, 1792, 5440, 5472, 5504, 5536, - 5568, 5600, 5632, 5568, 704, 5664, 224, 224, 224, 224, 5696, 224, 224, - 224, 5728, 5760, 5792, 5824, 5856, 5888, 5920, 5952, 5984, 6016, 6048, - 6080, 6112, 6144, 6176, 6208, 6240, 6272, 6304, 6336, 6368, 6400, 6432, - 6464, 6496, 6496, 6496, 6496, 6496, 6496, 6496, 6496, 6528, 6560, 4896, - 6592, 6624, 6656, 6688, 6720, 4896, 6752, 6784, 6816, 6848, 6880, 6912, - 6944, 4896, 4896, 4896, 4896, 4896, 6976, 7008, 7040, 4896, 4896, 4896, - 7072, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 7104, 7136, 4896, 7168, - 7200, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 6496, 6496, 6496, - 6496, 7232, 6496, 7264, 7296, 6496, 6496, 6496, 6496, 6496, 6496, 6496, - 6496, 4896, 7328, 7360, 7392, 7424, 7456, 7488, 7520, 7552, 7584, 7616, - 7648, 224, 224, 224, 7680, 7712, 7744, 1344, 7776, 7808, 7840, 7840, - 704, 7872, 7904, 7936, 1792, 7968, 4896, 4896, 8000, 4896, 4896, 4896, - 4896, 4896, 4896, 8032, 8064, 8096, 8128, 3200, 1344, 8160, 4160, 1344, - 8192, 8224, 8256, 1344, 1344, 8288, 8320, 4896, 8352, 8384, 8416, 8448, - 4896, 8416, 8480, 4896, 8384, 4896, 4896, 4896, 4896, 4896, 4896, 4896, - 4896, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 4224, 4256, 1344, 1344, 4288, 4320, 4352, + 4384, 4416, 1344, 4448, 4480, 4512, 4544, 1344, 4576, 4608, 4640, 4672, + 1344, 4704, 4736, 4768, 4800, 4832, 1344, 4864, 4896, 4928, 4960, 1344, + 4992, 5024, 5056, 5088, 1824, 1824, 5120, 5152, 5184, 5216, 5248, 5280, + 1344, 5312, 1344, 5344, 5376, 5408, 5440, 1824, 5472, 5504, 5536, 5568, + 5600, 5632, 5664, 5600, 704, 5696, 224, 224, 224, 224, 5728, 224, 224, + 224, 5760, 5792, 5824, 5856, 5888, 5920, 5952, 5984, 6016, 6048, 6080, + 6112, 6144, 6176, 6208, 6240, 6272, 6304, 6336, 6368, 6400, 6432, 6464, + 6496, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6528, 6560, 6592, 4928, + 6624, 6656, 6688, 6720, 6752, 4928, 6784, 6816, 6848, 6880, 6912, 6944, + 6976, 4928, 4928, 4928, 4928, 4928, 7008, 7040, 7072, 4928, 4928, 4928, + 7104, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 7136, 7168, 4928, 7200, + 7232, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 6528, 6528, 6528, + 6528, 7264, 6528, 7296, 7328, 6528, 6528, 6528, 6528, 6528, 6528, 6528, + 6528, 4928, 7360, 7392, 7424, 7456, 7488, 7520, 7552, 7584, 7616, 7648, + 7680, 224, 224, 224, 7712, 7744, 7776, 1344, 7808, 7840, 7872, 7872, + 704, 7904, 7936, 7968, 1824, 8000, 4928, 4928, 8032, 4928, 4928, 4928, + 4928, 4928, 4928, 8064, 8096, 8128, 8160, 3232, 1344, 8192, 4192, 1344, + 8224, 8256, 8288, 1344, 1344, 8320, 8352, 4928, 8384, 8416, 8448, 8480, + 4928, 8448, 8512, 4928, 8416, 4928, 4928, 4928, 4928, 4928, 4928, 4928, + 4928, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -75,7 +75,7 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 4672, 4896, 4896, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 4704, 4928, 4928, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -129,17 +129,16 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 4672, - 1792, 8512, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1792, 8544, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 8544, 4896, 8576, 5376, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 8608, 8640, 224, 8672, 8704, 1344, 1344, 8736, 8768, 8800, 224, - 8832, 8864, 8896, 1792, 8928, 8960, 8992, 1344, 9024, 9056, 9088, 9120, - 9152, 1632, 9184, 9216, 9248, 1920, 9280, 9312, 9344, 1344, 9376, 9408, - 9440, 1344, 9472, 9504, 9536, 9568, 9600, 9632, 9664, 9696, 9696, 1344, - 9728, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 8576, 4928, 8608, 5408, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 8640, 8672, 224, 8704, 8736, 1344, 1344, 8768, 8800, 8832, 224, + 8864, 8896, 8928, 1824, 8960, 8992, 9024, 1344, 9056, 9088, 9120, 9152, + 9184, 1632, 9216, 9248, 9280, 1952, 9312, 9344, 9376, 1344, 9408, 9440, + 9472, 1344, 9504, 9536, 9568, 9600, 9632, 9664, 9696, 9728, 9728, 1344, + 9760, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -167,211 +166,217 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 9760, 9792, 9824, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, - 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9856, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 9792, 9824, 9856, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, - 9888, 9888, 9888, 9888, 9888, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 9920, 1344, 1344, 9952, 1792, 9984, 10016, - 10048, 1344, 1344, 10080, 10112, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 10144, 10176, 1344, 10208, 1344, 10240, 10272, - 10304, 10336, 10368, 10400, 1344, 1344, 1344, 10432, 10464, 64, 10496, - 10528, 10560, 4704, 10592, 10624 + 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9888, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, 9920, + 9920, 9920, 9920, 9920, 9920, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 9952, 1344, 1344, 9984, 1824, 10016, 10048, + 10080, 1344, 1344, 10112, 10144, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 10176, 10208, 1344, 10240, 1344, 10272, 10304, + 10336, 10368, 10400, 10432, 1344, 1344, 1344, 10464, 10496, 64, 10528, + 10560, 10592, 4736, 10624, 10656 #if TCL_UTF_MAX > 3 - ,10656, 10688, 10720, 1792, 1344, 1344, 1344, 8320, 10752, 10784, 10816, - 10848, 10880, 10912, 10944, 10976, 1792, 1792, 1792, 1792, 9248, 1344, - 11008, 11040, 1344, 11072, 11104, 11136, 11168, 1344, 11200, 1792, - 11232, 11264, 11296, 1344, 11328, 11360, 11392, 11424, 1344, 11456, - 1344, 11488, 1792, 1792, 1792, 1792, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 7808, 4672, 10240, 1792, 1792, 1792, 1792, - 11520, 11552, 11584, 11616, 4704, 11648, 1792, 11680, 11712, 11744, - 1792, 1792, 1344, 11776, 11808, 6816, 11840, 11872, 11904, 11936, 11968, - 1792, 12000, 12032, 1344, 12064, 12096, 12128, 12160, 12192, 1792, - 1792, 1344, 1344, 12224, 1792, 12256, 12288, 12320, 12352, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 12384, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 12416, - 12448, 12480, 12512, 5216, 12544, 12576, 12608, 12640, 12672, 12704, - 12736, 5216, 12768, 12800, 12832, 12864, 12896, 1792, 1792, 12928, - 12960, 12992, 13024, 13056, 2336, 13088, 13120, 1792, 1792, 1792, 1792, - 1344, 13152, 13184, 1792, 1344, 13216, 13248, 1792, 1792, 1792, 1792, - 1792, 1344, 13280, 13312, 1792, 1344, 13344, 13376, 13408, 1344, 13440, - 13472, 1792, 13504, 13536, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 13568, 13600, 13632, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 13664, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 13696, 13728, 13760, - 13792, 13824, 13856, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 9952, 1792, - 1792, 1792, 10816, 10816, 10816, 13888, 1344, 1344, 1344, 1344, 1344, - 1344, 13920, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 13952, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 13984, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 13664, 4704, 14016, 1792, 1792, 10176, 14048, 1344, - 14080, 14112, 14144, 14176, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 14208, - 14240, 14272, 1792, 1792, 14304, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 14336, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 14368, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 14400, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, 14432, 14464, 14496, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 4896, 4896, - 4896, 4896, 4896, 4896, 4896, 8032, 4896, 14528, 4896, 14560, 14592, - 14624, 4896, 14656, 4896, 4896, 14688, 1792, 1792, 1792, 1792, 1792, - 4896, 4896, 14720, 14752, 1792, 1792, 1792, 1792, 14784, 14816, 14848, - 14880, 14912, 14944, 14976, 15008, 15040, 15072, 15104, 15136, 15168, - 14784, 14816, 15200, 14880, 15232, 15264, 15296, 15008, 15328, 15360, - 15392, 15424, 15456, 15488, 15520, 15552, 15584, 15616, 15648, 4896, - 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, - 4896, 4896, 4896, 704, 15680, 704, 15712, 15744, 15776, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 15808, 15840, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, - 1344, 1344, 1344, 15872, 1792, 15904, 15936, 15968, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 16000, - 16032, 16064, 16096, 16128, 16160, 1792, 16192, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 4896, 16224, 4896, 4896, 8000, 16256, 16288, - 8032, 16320, 16352, 4896, 16224, 4896, 16384, 1792, 16416, 16448, 16480, - 16512, 1792, 1792, 1792, 1792, 1792, 4896, 4896, 4896, 4896, 4896, - 4896, 4896, 16544, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, - 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, 4896, - 4896, 4896, 16576, 16608, 4896, 4896, 4896, 8000, 4896, 4896, 16640, - 1792, 16224, 4896, 16672, 4896, 16704, 16736, 1792, 1792, 16768, 16800, - 16832, 1792, 16864, 1792, 10912, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1344, 1344, 1344, 1344, 1344, + ,10688, 10720, 10752, 1824, 1344, 1344, 1344, 8352, 10784, 10816, 10848, + 10880, 10912, 10944, 10976, 11008, 1824, 1824, 1824, 1824, 9280, 1344, + 11040, 11072, 1344, 11104, 11136, 11168, 11200, 1344, 11232, 1824, + 11264, 11296, 11328, 1344, 11360, 11392, 11424, 11456, 1344, 11488, + 1344, 11520, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 7840, 4704, 10272, 1824, 1824, 1824, 1824, + 11552, 11584, 11616, 11648, 4736, 11680, 1824, 11712, 11744, 11776, + 1824, 1824, 1344, 11808, 11840, 6848, 11872, 11904, 11936, 11968, 12000, + 1824, 12032, 12064, 1344, 12096, 12128, 12160, 12192, 12224, 1824, + 1824, 1344, 1344, 12256, 1824, 12288, 12320, 12352, 12384, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 12416, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 12448, + 12480, 12512, 12544, 5248, 12576, 12608, 12640, 12672, 12704, 12736, + 12768, 5248, 12800, 12832, 12864, 12896, 12928, 1824, 1824, 12960, + 12992, 13024, 13056, 13088, 2368, 13120, 13152, 1824, 1824, 1824, 1824, + 1344, 13184, 13216, 1824, 1344, 13248, 13280, 1824, 1824, 1824, 1824, + 1824, 1344, 13312, 13344, 1824, 1344, 13376, 13408, 13440, 1344, 13472, + 13504, 1824, 13536, 13568, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 13600, 13632, 13664, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 13696, 13728, 13760, 1344, 13792, 13824, 1344, + 13856, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 13888, 13920, + 13952, 13984, 14016, 14048, 1824, 1824, 14080, 14112, 14144, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 9984, 1824, 1824, 1824, 10848, 10848, 10848, 14176, 1344, 1344, 1344, + 1344, 1344, 1344, 14208, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 14240, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 14272, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 13856, 4736, 14304, 1824, 1824, 10208, + 14336, 1344, 14368, 14400, 14432, 14464, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, + 14496, 14528, 14560, 1824, 1824, 14592, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 14624, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 14656, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 4736, 1824, 1824, 10208, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 9856, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 14688, 14720, + 14752, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 4928, 4928, 4928, 4928, 4928, 4928, 4928, 8064, 4928, 14784, 4928, + 14816, 14848, 14880, 4928, 14912, 4928, 4928, 14944, 1824, 1824, 1824, + 1824, 1824, 4928, 4928, 14976, 15008, 1824, 1824, 1824, 1824, 15040, + 15072, 15104, 15136, 15168, 15200, 15232, 15264, 15296, 15328, 15360, + 15392, 15424, 15040, 15072, 15456, 15136, 15488, 15520, 15552, 15264, + 15584, 15616, 15648, 15680, 15712, 15744, 15776, 15808, 15840, 15872, + 15904, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, + 4928, 4928, 4928, 4928, 4928, 4928, 704, 15936, 704, 15968, 16000, + 16032, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 16064, 16096, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1344, 1344, 1344, 1344, 1344, 1344, 16128, 1824, 16160, 16192, + 16224, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 16256, 16288, 16320, 16352, 16384, 16416, 1824, 16448, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 4928, 16480, 4928, + 4928, 8032, 16512, 16544, 8064, 16576, 16608, 4928, 16480, 4928, 16640, + 1824, 16672, 16704, 16736, 16768, 16800, 1824, 1824, 1824, 1824, 4928, + 4928, 4928, 4928, 4928, 4928, 4928, 16832, 4928, 4928, 4928, 4928, + 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, 4928, + 4928, 4928, 4928, 4928, 4928, 4928, 16864, 16896, 4928, 4928, 4928, + 8032, 4928, 4928, 16864, 1824, 16480, 4928, 16928, 4928, 16960, 16992, + 1824, 1824, 16480, 8416, 17024, 17056, 17088, 1824, 17120, 6784, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -478,23 +483,22 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 7840, 1824, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 7808, 1792, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 17152, 1344, 1344, 1344, 1344, 1344, 1344, 11360, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 16896, 1344, 1344, - 1344, 1344, 1344, 1344, 11328, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, @@ -505,40 +509,36 @@ static const unsigned short pageMap[] = { 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 17184, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 14400, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, 1792, - 1792, 1792, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, - 1344, 1344, 1344, 1344, 1344, 1344, 11328 + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 17216, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, 1824, + 1824, 1824, 1824, 1824, 1824, 1824, 1344, 1344, 1344, 1344, 1344, 1344, + 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 11360 #endif /* TCL_UTF_MAX > 3 */ }; @@ -652,72 +652,74 @@ static const unsigned char groupMap[] = { 92, 92, 91, 92, 92, 92, 91, 92, 92, 92, 92, 92, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, - 92, 92, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, - 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 17, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 0, 0, 3, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 17, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 124, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 124, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 92, 124, 92, 15, 124, 124, 124, 92, 92, - 92, 92, 92, 92, 92, 92, 124, 124, 124, 124, 92, 124, 124, 15, 92, 92, - 92, 92, 92, 92, 92, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, - 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 3, 91, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 124, 0, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, + 124, 92, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, + 124, 124, 92, 124, 124, 15, 92, 92, 92, 92, 92, 92, 92, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 92, 92, 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 3, 91, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 0, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 0, 0, 0, + 15, 15, 15, 15, 0, 0, 92, 15, 124, 124, 124, 92, 92, 92, 92, 0, 0, + 124, 124, 0, 0, 124, 124, 92, 15, 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, + 0, 0, 15, 15, 0, 15, 15, 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 15, 15, 4, 4, 18, 18, 18, 18, 18, 18, 14, 4, 15, 3, 0, 0, 0, + 92, 92, 124, 0, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 15, 15, 0, 0, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, + 0, 15, 15, 0, 0, 92, 0, 124, 124, 124, 92, 92, 0, 0, 0, 0, 92, 92, + 0, 0, 92, 92, 92, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, + 0, 15, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 92, 92, 15, + 15, 15, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 124, 0, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, 15, 15, 0, 0, + 92, 15, 124, 124, 124, 92, 92, 92, 92, 92, 0, 92, 92, 124, 0, 124, + 124, 92, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, + 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 3, 4, 0, 0, 0, 0, 0, + 0, 0, 15, 92, 92, 92, 92, 92, 92, 0, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, - 15, 15, 15, 15, 15, 0, 15, 0, 0, 0, 15, 15, 15, 15, 0, 0, 92, 15, 124, - 124, 124, 92, 92, 92, 92, 0, 0, 124, 124, 0, 0, 124, 124, 92, 15, 0, - 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 15, 15, 0, 15, 15, 15, 92, 92, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 15, 15, 4, 4, 18, 18, 18, 18, 18, - 18, 14, 4, 0, 0, 0, 0, 0, 92, 92, 124, 0, 15, 15, 15, 15, 15, 15, 0, - 0, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, - 15, 15, 0, 15, 15, 0, 15, 15, 0, 15, 15, 0, 0, 92, 0, 124, 124, 124, - 92, 92, 0, 0, 0, 0, 92, 92, 0, 0, 92, 92, 92, 0, 0, 0, 92, 0, 0, 0, - 0, 0, 0, 0, 15, 15, 15, 15, 0, 15, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 92, 92, 15, 15, 15, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 92, 92, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, - 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, - 0, 15, 15, 15, 15, 15, 0, 0, 92, 15, 124, 124, 124, 92, 92, 92, 92, - 92, 0, 92, 92, 124, 0, 124, 124, 92, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 3, 4, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 92, 124, - 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, - 15, 15, 0, 0, 92, 15, 124, 92, 124, 92, 92, 92, 92, 0, 0, 124, 124, - 0, 0, 124, 124, 92, 0, 0, 0, 0, 0, 0, 0, 0, 92, 124, 0, 0, 0, 0, 15, - 15, 0, 15, 15, 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 14, - 15, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 15, 0, - 15, 15, 15, 15, 15, 15, 0, 0, 0, 15, 15, 15, 0, 15, 15, 15, 15, 0, - 0, 0, 15, 15, 0, 15, 0, 15, 15, 0, 0, 0, 15, 15, 0, 0, 0, 15, 15, 15, - 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, - 124, 124, 92, 124, 124, 0, 0, 0, 124, 124, 124, 0, 124, 124, 124, 92, - 0, 0, 15, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 14, 14, 14, 14, 14, - 14, 4, 14, 0, 0, 0, 0, 0, 92, 124, 124, 124, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 15, 92, - 92, 92, 124, 124, 124, 124, 0, 92, 92, 92, 0, 92, 92, 92, 92, 0, 0, - 0, 0, 0, 0, 0, 92, 92, 0, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, 92, 92, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, - 18, 18, 18, 18, 18, 14, 15, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 0, 0, 92, 15, 124, 92, - 124, 124, 124, 124, 124, 0, 92, 124, 124, 0, 124, 124, 92, 92, 0, 0, - 0, 0, 0, 0, 0, 124, 124, 0, 0, 0, 0, 0, 0, 0, 15, 0, 15, 15, 92, 92, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 15, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, 15, 15, 0, 0, 92, 15, + 124, 92, 124, 92, 92, 92, 92, 0, 0, 124, 124, 0, 0, 124, 124, 92, 0, + 0, 0, 0, 0, 0, 0, 0, 92, 124, 0, 0, 0, 0, 15, 15, 0, 15, 15, 15, 92, + 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 14, 15, 18, 18, 18, 18, 18, + 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 15, 0, 15, 15, 15, 15, 15, 15, + 0, 0, 0, 15, 15, 15, 0, 15, 15, 15, 15, 0, 0, 0, 15, 15, 0, 15, 0, + 15, 15, 0, 0, 0, 15, 15, 0, 0, 0, 15, 15, 15, 0, 0, 0, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 124, 124, 92, 124, + 124, 0, 0, 0, 124, 124, 124, 0, 124, 124, 124, 92, 0, 0, 15, 0, 0, + 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 14, 14, 14, 14, 14, 14, 4, 14, 0, + 0, 0, 0, 0, 92, 124, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 15, 92, 92, 92, 124, + 124, 124, 124, 0, 92, 92, 92, 0, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, + 0, 92, 92, 0, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, 92, 92, 0, 0, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, + 18, 18, 14, 15, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 0, 0, 92, 15, 124, 92, 124, + 124, 124, 124, 124, 0, 92, 124, 124, 0, 124, 124, 92, 92, 0, 0, 0, + 0, 0, 0, 0, 124, 124, 0, 0, 0, 0, 0, 0, 0, 15, 0, 15, 15, 92, 92, 0, + 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 92, 92, 124, 124, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 124, 124, 124, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 15, 124, 124, 124, 92, 92, 92, 92, 0, 124, 124, 124, 0, 124, 124, 124, 92, 15, 14, 0, 0, 0, 0, 15, 15, 15, 124, 18, 18, 18, 18, 18, 18, 18, 15, 15, 15, 92, 92, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 18, 18, 18, 18, @@ -857,7 +859,7 @@ static const unsigned char groupMap[] = { 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 3, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 124, 92, 92, 92, 92, 92, 92, 92, 15, 15, 15, 15, 92, 15, 15, 15, 15, - 124, 124, 92, 15, 15, 0, 92, 92, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, + 124, 124, 92, 15, 15, 124, 92, 92, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, @@ -868,9 +870,9 @@ static const unsigned char groupMap[] = { 21, 21, 137, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 92, 92, 92, 92, 92, - 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 21, 21, 21, 21, 21, 138, 21, 21, 139, 21, 140, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 0, 92, 92, 92, 92, + 92, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, + 23, 24, 23, 24, 23, 24, 21, 21, 21, 21, 21, 138, 21, 21, 139, 21, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 0, 0, 141, 141, 141, 141, 141, 141, 0, 0, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, @@ -897,7 +899,7 @@ static const unsigned char groupMap[] = { 18, 18, 7, 7, 7, 5, 6, 91, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 7, 7, 7, 5, 6, 0, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 119, 119, 119, 119, 92, 119, 119, 119, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, @@ -930,7 +932,7 @@ static const unsigned char groupMap[] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 7, 7, 7, 7, 7, 7, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, @@ -971,9 +973,9 @@ static const unsigned char groupMap[] = { 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 0, 123, 123, 123, 123, @@ -996,7 +998,7 @@ static const unsigned char groupMap[] = { 0, 3, 3, 16, 20, 16, 20, 3, 3, 3, 16, 20, 3, 16, 20, 3, 3, 3, 3, 3, 3, 3, 3, 3, 8, 3, 3, 8, 3, 16, 20, 3, 3, 16, 20, 5, 6, 5, 6, 5, 6, 5, 6, 3, 3, 3, 3, 3, 91, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 8, 8, 3, 3, - 3, 3, 8, 3, 5, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 3, 8, 3, 5, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, @@ -1014,7 +1016,7 @@ static const unsigned char groupMap[] = { 15, 15, 15, 15, 15, 3, 91, 91, 91, 15, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 14, 14, 18, 18, 18, 18, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, @@ -1173,245 +1175,269 @@ static const unsigned char groupMap[] = { 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 18, 18, 18, 18, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 127, 15, 15, 15, 15, 15, 15, 15, - 15, 127, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 127, 15, 15, 15, 15, 15, 15, + 15, 15, 127, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, 92, 92, 0, 0, 0, - 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 3, 15, 15, - 15, 15, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 3, 127, 127, 127, - 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 194, 194, 194, 194, 194, 194, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, 92, 92, 0, + 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 3, 15, 15, 15, 15, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 3, 127, + 127, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 194, 195, 195, 195, 195, 195, 195, 195, 195, + 194, 194, 194, 194, 194, 194, 194, 194, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 195, 195, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 195, 195, 195, 195, 195, 195, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 194, 194, 194, + 15, 15, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, - 194, 194, 194, 194, 194, 0, 0, 0, 0, 195, 195, 195, 195, 195, 195, + 194, 194, 194, 194, 194, 194, 194, 0, 0, 0, 0, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, - 195, 195, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, - 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 0, 0, 15, - 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 0, 0, 15, - 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 0, 3, 18, 18, 18, 18, 18, 18, 18, 18, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 14, 14, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, - 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 0, 0, 0, 0, 18, 18, 18, - 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 18, 18, 18, 18, 18, 18, 0, 0, 0, 3, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 3, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 0, 0, 0, 0, 18, 18, 15, 15, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 15, 92, 92, 92, 0, 92, 92, 0, 0, 0, 0, 0, 92, - 92, 92, 92, 15, 15, 15, 15, 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 0, 0, 0, 0, 92, 92, 92, 0, 0, 0, 0, 92, 18, 18, 18, - 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 18, 18, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 18, - 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 92, 92, 0, 0, 0, 0, 18, 18, 18, 18, 18, 3, 3, 3, - 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, - 3, 3, 3, 3, 3, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 18, 18, 18, 18, 18, 18, - 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 15, + 195, 195, 195, 195, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, + 15, 0, 0, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, + 0, 0, 0, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 3, 18, 18, 18, 18, 18, + 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 14, 14, 18, 18, 18, 18, 18, 18, + 18, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 0, 0, + 0, 0, 18, 18, 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 18, 18, 18, 18, 18, 18, + 0, 0, 0, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 3, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 18, 18, 15, 15, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 15, 92, 92, 92, 0, 92, 92, + 0, 0, 0, 0, 0, 92, 92, 92, 92, 15, 15, 15, 15, 0, 15, 15, 15, 0, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 92, 92, 92, 0, 0, 0, + 0, 92, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 18, 18, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 14, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 0, 0, 0, 0, 18, 18, 18, + 18, 18, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 18, 18, + 18, 18, 18, 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, + 18, 18, 18, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, + 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 0, 0, 0, - 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, + 102, 102, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 0, 124, 92, 124, 15, 15, 15, 15, 15, 15, 15, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 124, 92, 124, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 3, 3, 3, 3, 3, 3, 3, 0, 0, - 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 92, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, 124, 124, 92, - 92, 3, 3, 17, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 3, 3, 3, + 3, 3, 3, 3, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, + 92, 124, 124, 92, 92, 3, 3, 17, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 92, 92, 92, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 92, 92, 92, 15, 15, 15, 15, 15, 15, + 92, 92, 92, 92, 92, 124, 92, 92, 92, 92, 92, 92, 92, 92, 0, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, 92, - 92, 124, 92, 92, 92, 92, 92, 92, 92, 92, 0, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 3, 3, 15, + 15, 92, 3, 3, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, 15, 15, 15, 15, 3, 3, + 3, 3, 3, 92, 92, 92, 3, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 15, 3, + 15, 3, 3, 3, 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 124, 124, + 92, 124, 92, 92, 3, 3, 3, 3, 3, 3, 92, 0, 15, 15, 15, 15, 15, 15, 15, + 0, 15, 0, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 3, 0, + 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 92, 92, 124, 124, 0, 15, + 15, 15, 15, 15, 15, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 124, 124, 124, 0, 0, 124, + 124, 0, 0, 124, 124, 124, 0, 0, 15, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, + 0, 0, 15, 15, 15, 15, 15, 124, 124, 0, 0, 92, 92, 92, 92, 92, 92, 92, + 0, 0, 0, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, 92, + 92, 92, 124, 92, 15, 15, 15, 15, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 0, 3, 0, 3, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 124, + 92, 124, 124, 124, 124, 92, 92, 124, 92, 92, 15, 15, 3, 15, 0, 0, 0, + 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, + 92, 92, 92, 92, 0, 0, 124, 124, 124, 124, 92, 92, 124, 92, 92, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 15, + 15, 15, 15, 92, 92, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, + 124, 124, 92, 124, 92, 92, 3, 3, 3, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 92, + 124, 124, 92, 92, 92, 92, 92, 92, 124, 92, 0, 0, 0, 0, 0, 0, 0, 0, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 124, 124, 15, 15, 15, 15, 3, 3, 3, 3, 3, 92, 92, - 92, 3, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 15, 3, 15, 3, 3, 3, 0, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 124, 124, 124, 92, 92, 92, 124, 124, 92, 124, 92, 92, 3, - 3, 3, 3, 3, 3, 92, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 0, 15, 15, - 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 3, 0, 0, 0, 0, 0, 0, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 124, 124, - 92, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 0, 0, 0, 0, 0, 0, 92, 92, 124, 124, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 92, 124, 124, 124, 124, 0, 0, 124, 124, 0, 0, 124, - 124, 124, 0, 0, 15, 0, 0, 0, 0, 0, 0, 124, 0, 0, 0, 0, 0, 15, 15, 15, - 15, 15, 124, 124, 0, 0, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 92, 92, - 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, - 124, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, 92, 92, 92, 124, 92, - 15, 15, 15, 15, 3, 3, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 3, - 0, 3, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 124, 92, 124, 124, 124, - 124, 92, 92, 124, 92, 92, 15, 15, 3, 15, 0, 0, 0, 0, 0, 0, 0, 0, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 124, 124, 124, 92, 92, 92, 92, - 0, 0, 124, 124, 124, 124, 92, 92, 124, 92, 92, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 15, 15, 15, 15, 92, - 92, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 124, 124, 124, 92, 92, 92, 92, 92, 92, 92, 92, 124, 124, 92, 124, - 92, 92, 3, 3, 3, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 124, 92, 124, 124, 92, 92, - 92, 92, 92, 92, 124, 92, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 92, 92, 92, 124, - 124, 92, 92, 92, 92, 124, 92, 92, 92, 92, 92, 0, 0, 0, 0, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 18, 18, 3, 3, 3, 14, 10, 10, 10, 10, 10, 10, 10, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 0, 0, 92, 92, 92, 124, 124, 92, 92, 92, 92, 124, 92, 92, 92, 92, 92, + 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 3, 3, 3, 14, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 15, 92, 92, 92, 92, 92, 92, 124, 124, 92, 92, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 92, 92, 92, 92, 92, 92, 124, 15, 92, 92, 92, 92, 3, + 3, 3, 3, 3, 3, 3, 3, 92, 0, 0, 0, 0, 0, 0, 0, 0, 15, 92, 92, 92, 92, + 92, 92, 124, 124, 92, 92, 92, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, + 15, 15, 15, 15, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 124, 92, 92, 3, 3, 3, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 124, 92, 92, 92, 92, 92, 92, 92, 0, 124, - 124, 124, 124, 92, 92, 124, 92, 15, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 18, 18, 18, 18, + 15, 15, 15, 15, 15, 15, 15, 124, 92, 92, 92, 92, 92, 92, 92, 0, 92, + 92, 92, 92, 92, 92, 124, 92, 15, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 3, 3, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 0, 124, 92, 92, 92, 92, 92, 92, 92, 124, 92, 92, 124, 92, 92, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 127, 127, 127, 127, 127, 127, - 127, 127, 127, 127, 127, 127, 0, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 92, 92, 92, 92, 92, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 92, 92, - 92, 92, 92, 92, 3, 3, 3, 3, 3, 14, 14, 14, 14, 91, 91, 91, 91, 3, 14, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 18, - 18, 18, 18, 18, 18, 18, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, + 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 124, 124, 124, 124, 124, 124, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 92, 92, 92, 92, 92, 92, 0, 0, 0, 92, 0, 92, 92, 0, 92, + 92, 92, 92, 92, 92, 92, 15, 92, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 127, 127, 127, 127, 127, 127, 127, + 127, 127, 127, 127, 127, 127, 127, 127, 0, 3, 3, 3, 3, 3, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 0, 0, 92, 92, 92, 92, 92, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 92, 92, 92, 92, 92, 92, 92, 3, 3, 3, 3, 3, 14, 14, 14, 14, 91, 91, + 91, 91, 3, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 0, 18, 18, 18, 18, 18, 18, 18, 0, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, + 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, + 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 124, 124, 124, 124, + 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, - 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, 91, 91, 91, - 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, - 14, 92, 92, 3, 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, - 14, 14, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 124, 124, 92, - 92, 92, 14, 14, 14, 124, 124, 124, 124, 124, 124, 17, 17, 17, 17, 17, - 17, 17, 17, 92, 92, 92, 92, 92, 92, 92, 92, 14, 14, 92, 92, 92, 92, - 92, 92, 92, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 92, - 92, 92, 92, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 92, 92, - 92, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 107, 107, 107, 107, 107, + 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 0, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, + 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 14, 92, 92, 3, 17, + 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 0, 0, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 124, 124, 92, 92, 92, 14, 14, 14, + 124, 124, 124, 124, 124, 124, 17, 17, 17, 17, 17, 17, 17, 17, 92, 92, + 92, 92, 92, 92, 92, 92, 14, 14, 92, 92, 92, 92, 92, 92, 92, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 92, 92, 92, 92, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 92, 92, 92, 14, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, + 21, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 0, 107, 107, 0, 0, 107, + 0, 0, 107, 107, 0, 0, 107, 107, 107, 107, 0, 107, 107, 107, 107, 107, + 107, 107, 107, 21, 21, 21, 21, 0, 21, 0, 21, 21, 21, 21, 21, 21, 21, + 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 107, 107, 0, 107, 107, 107, 107, 0, 0, 107, 107, 107, 107, + 107, 107, 107, 107, 0, 107, 107, 107, 107, 107, 107, 107, 0, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 107, 107, 0, 107, 107, 107, 107, 0, 107, + 107, 107, 107, 107, 0, 107, 0, 0, 0, 107, 107, 107, 107, 107, 107, + 107, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, - 21, 21, 21, 21, 21, 21, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, + 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 0, - 107, 107, 0, 0, 107, 0, 0, 107, 107, 0, 0, 107, 107, 107, 107, 0, 107, - 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 0, 21, 0, 21, 21, - 21, 21, 21, 21, 21, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 107, 107, 0, 107, 107, 107, 107, 0, 0, - 107, 107, 107, 107, 107, 107, 107, 107, 0, 107, 107, 107, 107, 107, - 107, 107, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 0, 107, 107, - 107, 107, 0, 107, 107, 107, 107, 107, 0, 107, 0, 0, 0, 107, 107, 107, - 107, 107, 107, 107, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, + 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 0, 0, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, + 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, + 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 107, 107, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 21, 21, 21, 21, 21, 21, 0, 0, 107, + 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, @@ -1419,89 +1445,81 @@ static const unsigned char groupMap[] = { 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 7, - 21, 21, 21, 21, 21, 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 7, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 7, 21, 21, 21, 21, 21, - 21, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 7, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 7, 21, 21, 21, 21, 21, 21, 107, 21, 0, 0, 9, 9, 9, 9, 9, 9, + 21, 21, 21, 21, 21, 21, 107, 21, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 92, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 14, 14, 14, 14, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 14, 14, 14, 14, 14, 14, 14, - 14, 92, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 92, - 14, 14, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 92, 92, 92, 92, 92, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, - 92, 92, 92, 92, 92, 92, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92, 92, 92, 92, 0, 0, 92, 92, 92, 92, 92, 92, 92, 0, 92, - 92, 0, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 0, 0, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 92, 92, 14, 14, 14, 14, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 14, 14, 14, 14, 14, 14, 14, 14, 92, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 92, 14, 14, 3, + 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, + 92, 92, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 92, 92, 92, + 92, 92, 92, 0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 0, 0, 92, 92, 92, 92, 92, 92, 92, 0, 92, 92, 0, 92, + 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 15, 15, 15, 15, 15, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 92, 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, - 196, 196, 196, 196, 196, 196, 196, 197, 197, 197, 197, 197, 197, 197, + 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 196, 196, 196, 196, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 92, - 92, 92, 92, 92, 92, 92, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 0, 0, 0, 0, 3, 3, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 0, 15, 15, 0, 15, 0, 0, 15, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 0, 15, 15, 15, 15, 0, 15, 0, 15, 0, 0, 0, 0, 0, 0, 15, - 0, 0, 0, 0, 15, 0, 15, 0, 15, 0, 15, 15, 15, 0, 15, 15, 0, 15, 0, 0, - 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 15, 0, 15, 0, 0, 15, 15, 15, - 15, 0, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 0, 15, 15, 15, - 15, 0, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, - 0, 15, 15, 15, 0, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, - 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, 92, 92, 92, 92, 92, + 92, 92, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 3, + 3, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, + 15, 0, 15, 0, 0, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, + 15, 15, 15, 15, 0, 15, 0, 15, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 15, + 0, 15, 0, 15, 0, 15, 15, 15, 0, 15, 15, 0, 15, 0, 0, 15, 0, 15, 0, + 15, 0, 15, 0, 15, 0, 15, 15, 0, 15, 0, 0, 15, 15, 15, 15, 0, 15, 15, + 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 0, 15, 15, 15, 15, 0, 15, 0, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 15, 15, + 15, 0, 15, 15, 15, 15, 15, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, - 0, 0, 0, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 11, 11, 11, 11, 11, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, + 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 14, + 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, - 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 0, - 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 11, 11, 11, 11, 11, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, - 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, - 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, + 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, + 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, + 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, + 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, + 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0 #endif /* TCL_UTF_MAX > 3 */ }; @@ -1607,4 +1625,8 @@ enum { * Unicode character tables. */ -#define GetUniCharInfo(ch) (groups[groupMap[pageMap[((ch) & 0xffff) >> OFFSET_BITS] | ((ch) & ((1 << OFFSET_BITS)-1))]]) +#if TCL_UTF_MAX > 3 +# define GetUniCharInfo(ch) (groups[groupMap[pageMap[((ch) & 0x1fffff) >> OFFSET_BITS] | ((ch) & ((1 << OFFSET_BITS)-1))]]) +#else +# define GetUniCharInfo(ch) (groups[groupMap[pageMap[((ch) & 0xffff) >> OFFSET_BITS] | ((ch) & ((1 << OFFSET_BITS)-1))]]) +#endif -- cgit v0.12 From 6352a079124110f7712740ffa535a741e7f8474c Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 22 Jun 2017 21:55:45 +0000 Subject: Rebase for final implementation work --- doc/copy.n | 21 +++++++++++++++------ generic/tclOOBasic.c | 32 +++++++++++++++++++++++++++----- tests/oo.test | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 11 deletions(-) diff --git a/doc/copy.n b/doc/copy.n index 100d564..8149397 100644 --- a/doc/copy.n +++ b/doc/copy.n @@ -14,7 +14,7 @@ oo::copy \- create copies of objects and classes .nf package require TclOO -\fBoo::copy\fI sourceObject \fR?\fItargetObject\fR? +\fBoo::copy\fI sourceObject \fR?\fItargetObject\fR? ?\fItargetNamespace\fR? .fi .BE .SH DESCRIPTION @@ -22,11 +22,20 @@ package require TclOO The \fBoo::copy\fR command creates a copy of an object or class. It takes the name of the object or class to be copied, \fIsourceObject\fR, and optionally the name of the object or class to create, \fItargetObject\fR, which will be -resolved relative to the current namespace if not an absolute qualified name. -If \fItargetObject\fR is omitted, a new name is chosen. The copied object will -be of the same class as the source object, and will have all its per-object -methods copied. If it is a class, it will also have all the class methods in -the class copied, but it will not have any of its instances copied. +resolved relative to the current namespace if not an absolute qualified name +and +.VS TIP473 +\fItargetNamespace\fR which is the name of the namespace where the object is +going to be created in. +If either \fItargetObject\fR or \fItargetNamespace\fR is omitted or is given +as the empty string, a new name is chosen. Names, unless specified, are +chosen with the same algorithm used by the \fBnew\fR method of +\fBoo::class\fR. +.VE TIP473 +The copied object will be of the same class as the source object, and will have +all its per-object methods copied. If it is a class, it will also have all the +class methods in the class copied, but it will not have any of its instances +copied. .PP .VS After the \fItargetObject\fR has been created and all definitions of its diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index 8cb80e5..b2c06a7 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -1183,8 +1183,9 @@ TclOOCopyObjectCmd( { Tcl_Object oPtr, o2Ptr; - if (objc < 2 || objc > 3) { - Tcl_WrongNumArgs(interp, 1, objv, "sourceName ?targetName?"); + if (objc < 2 || objc > 4) { + Tcl_WrongNumArgs(interp, 1, objv, + "sourceName ?targetName? ?targetNamespace?"); return TCL_ERROR; } @@ -1204,12 +1205,14 @@ TclOOCopyObjectCmd( if (objc == 2) { o2Ptr = Tcl_CopyObjectInstance(interp, oPtr, NULL, NULL); } else { - const char *name; + const char *name, *namespaceName; Tcl_DString buffer; name = TclGetString(objv[2]); Tcl_DStringInit(&buffer); - if (name[0]!=':' || name[1]!=':') { + if (name[0] == '\0') { + name = NULL; + } else if (name[0]!=':' || name[1]!=':') { Interp *iPtr = (Interp *) interp; if (iPtr->varFramePtr != NULL) { @@ -1220,7 +1223,26 @@ TclOOCopyObjectCmd( Tcl_DStringAppend(&buffer, name, -1); name = Tcl_DStringValue(&buffer); } - o2Ptr = Tcl_CopyObjectInstance(interp, oPtr, name, NULL); + + /* + * Choose a unique namespace name if the user didn't supply one. + */ + + namespaceName = NULL; + if (objc == 4) { + namespaceName = TclGetString(objv[3]); + + if (namespaceName[0] == '\0') { + namespaceName = NULL; + } else if (Tcl_FindNamespace(interp, namespaceName, NULL, + 0) != NULL) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "%s refers to an existing namespace", namespaceName)); + return TCL_ERROR; + } + } + + o2Ptr = Tcl_CopyObjectInstance(interp, oPtr, name, namespaceName); Tcl_DStringFree(&buffer); } diff --git a/tests/oo.test b/tests/oo.test index cb37a76..5eaa8bf 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -2013,6 +2013,41 @@ test oo-15.10 {variable binding must not bleed through oo::copy} -setup { } -cleanup { FooClass destroy } -result {foo bar grill bar} +test oo-15.11 {OO: object cloning} -returnCodes error -body { + oo::copy +} -result {wrong # args: should be "oo::copy sourceName ?targetName? ?targetNamespace?"} +test oo-15.12 {OO: object cloning with target NS} -setup { + oo::class create Super + oo::class create Cls {superclass Super} +} -body { + namespace eval ::existing {} + oo::copy Cls {} ::existing +} -returnCodes error -cleanup { + Super destroy + catch {namespace delete ::existing} +} -result {::existing refers to an existing namespace} +test oo-15.13 {OO: object cloning with target NS} -setup { + oo::class create Super + oo::class create Cls {superclass Super} +} -body { + list [namespace exist ::dupens] [oo::copy Cls Cls2 ::dupens] [namespace exist ::dupens] +} -cleanup { + Super destroy +} -result {0 ::Cls2 1} +test oo-15.14 {OO: object cloning with target NS} -setup { + oo::class create Cls {export eval} + set result {} +} -body { + Cls create obj + obj eval { + proc test-15.14 {} {} + } + lappend result [info commands ::dupens::t*] + oo::copy obj obj2 ::dupens + lappend result [info commands ::dupens::t*] +} -cleanup { + Cls destroy +} -result {{} ::dupens::test-15.14} test oo-16.1 {OO: object introspection} -body { info object -- cgit v0.12 From dd54301fb6500d258b6182c666abce1007e6b0d4 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 22 Jun 2017 22:00:39 +0000 Subject: Documentation correction; issue pointed out by DGP. --- doc/copy.n | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/copy.n b/doc/copy.n index 8149397..789a76c 100644 --- a/doc/copy.n +++ b/doc/copy.n @@ -25,8 +25,9 @@ the name of the object or class to create, \fItargetObject\fR, which will be resolved relative to the current namespace if not an absolute qualified name and .VS TIP473 -\fItargetNamespace\fR which is the name of the namespace where the object is -going to be created in. +\fItargetNamespace\fR which is the name of the namespace that will hold the +internal state of the object (\fBmy\fR command, etc.); it \fImust not\fR +refer to an existing namespace. If either \fItargetObject\fR or \fItargetNamespace\fR is omitted or is given as the empty string, a new name is chosen. Names, unless specified, are chosen with the same algorithm used by the \fBnew\fR method of -- cgit v0.12 From a9c238476a0aa2d6f10765f010b99944d3a7a9c3 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 22 Jun 2017 22:54:32 +0000 Subject: Add [regsub -command] case that wasn't actively tested for. --- tests/regexp.test | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/regexp.test b/tests/regexp.test index 2686526..7367af7 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -1184,6 +1184,10 @@ test regexp-27.10 {regsub -command error cases} -returnCodes error -body { test regexp-27.11 {regsub -command error cases} -returnCodes error -body { regsub -command . abc {} } -result {command prefix must be a list of at least one element} +test regexp-27.12 {regsub -command representation smash} { + set s {list (.+)} + regsub -command $s {list list} $s +} {(.+) {list list} list} # cleanup ::tcltest::cleanupTests -- cgit v0.12 From 70d12096d5549c1f98c154834b51d64a6a88b14b Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 23 Jun 2017 12:28:57 +0000 Subject: Repair compiler warning about uninitialized value. --- generic/tclCmdMZ.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 2c6b7bb..ad3ee8e 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -487,11 +487,10 @@ Tcl_RegsubObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int idx, result, cflags, all, wlen, wsublen, numMatches, offset; - int start, end, subStart, subEnd, match, command, numParts, numArgs; + int start, end, subStart, subEnd, match, command, numParts; Tcl_RegExp regExpr; Tcl_RegExpInfo info; Tcl_Obj *resultPtr, *subPtr, *objPtr, *startIndex = NULL; - Tcl_Obj **args = NULL, **parts; Tcl_UniChar ch, *wsrc, *wfirstChar, *wstring, *wsubspec, *wend; static const char *const options[] = { @@ -773,12 +772,13 @@ Tcl_RegsubObjCmd( */ if (command) { - if (args == NULL) { - Tcl_ListObjGetElements(interp, subPtr, &numParts, &parts); - numArgs = numParts + info.nsubs + 1; - args = ckalloc(sizeof(Tcl_Obj*) * numArgs); - memcpy(args, parts, sizeof(Tcl_Obj*) * numParts); - } + Tcl_Obj **args = NULL, **parts; + int numArgs; + + Tcl_ListObjGetElements(interp, subPtr, &numParts, &parts); + numArgs = numParts + info.nsubs + 1; + args = ckalloc(sizeof(Tcl_Obj*) * numArgs); + memcpy(args, parts, sizeof(Tcl_Obj*) * numParts); for (idx = 0 ; idx <= info.nsubs ; idx++) { subStart = info.matches[idx].start; @@ -807,6 +807,7 @@ Tcl_RegsubObjCmd( for (idx = 0 ; idx <= info.nsubs ; idx++) { TclDecrRefCount(args[idx + numParts]); } + ckfree(args); if (result != TCL_OK) { if (result == TCL_ERROR) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( @@ -975,9 +976,6 @@ Tcl_RegsubObjCmd( if (subPtr && (objv[2] == objv[0])) { Tcl_DecrRefCount(subPtr); } - if (args) { - ckfree(args); - } if (resultPtr) { Tcl_DecrRefCount(resultPtr); } -- cgit v0.12 From ba387de8cd303673f81a5e5870c91f830786a147 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 23 Jun 2017 12:39:13 +0000 Subject: repair broken tests --- tests/format.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/format.test b/tests/format.test index 577365b..1c20d0f 100644 --- a/tests/format.test +++ b/tests/format.test @@ -90,13 +90,13 @@ test format-1.14 {integer formatting} longIs32bit { } { 0d0 0d6 0d34 0d16923 -0d12} test format-1.14.1 {integer formatting} longIs64bit { format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 -} { 0d0 0d6 0d34 0d16923 -0d12} +} { 0d0 0d6 0d34 0d16923 -0d12} test format-1.15 {integer formatting} longIs32bit { format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 } {0d0 0d6 0d34 0d16923 -0d12 } test format-1.15.1 {integer formatting} longIs64bit { format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 -} {0d0 0d6 0d34 0d16923 -0d12 } +} {0d0 0d6 0d34 0d16923 -0d12 } test format-2.1 {string formatting} { -- cgit v0.12 From 5d68b7ef564929c5e9cf6b2af3bd12ec9db81cd2 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 23 Jun 2017 13:09:23 +0000 Subject: Rewrite the documentation of [regsub -command] so it's not quite such a mess. --- doc/regsub.n | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/doc/regsub.n b/doc/regsub.n index 23bbff9..29c118a 100644 --- a/doc/regsub.n +++ b/doc/regsub.n @@ -70,18 +70,20 @@ from the corresponding match. .TP \fB\-command\fR .VS 8.7 -Changes the handling of the substitution string so that it no longer treats +Changes the handling of \fIsubSpec\fR so that it is not treated +as a template for a substitution string and the substrings .QW & and -.QW \e -as special characters, but instead uses them as a non-empty list of words. -Each time a substitution is processed, another complete Tcl word is appended -to that list for each substitution value (the first such argument represents -the overall matched substring, the subsequent arguments will be one per -capturing sub-RE, much as are returned from \fBregexp\fR \fB\-inline\fR) and -the overall list is then evaluated as a Tcl command call. If the command -finishes successfully, the result of command call is substituted into the -resulting string. +.QW \e\fIn\fR +no longer have special meaning. Instead \fIsubSpec\fR must be a +command prefix, that is, a non-empty list. The substring of \fIstring\fR +that matches \fIexp\fR, and then each substring that matches each +capturing sub-RE within \fIexp\fR are appended as additional elements +to that list. (The items appended to the list are much like what +\fBregexp\fR \fB-inline\fR would return). The completed list is then +evaluated as a Tcl command, and the result of that command is the +substitution string. Any error or exception from command evaluation +becomes an error or exception from the \fBregsub\fR command. .RS .PP If \fB\-all\fR is not also given, the command callback will be invoked at most -- cgit v0.12 From 400f9d27f5859d3f81bba4b5f1bd52e436d52275 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 23 Jun 2017 13:11:37 +0000 Subject: typo fix --- generic/tclCmdMZ.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ad3ee8e..83382a7 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -800,7 +800,7 @@ Tcl_RegsubObjCmd( * because Tcl_EvalObjv is "hairy monster" in terms of refcount * handling, being able to optionally add references to any of its * argument words. We'll drop the local refs immediately - * afterwarsds; subPtr is handled in the main exit stanza. + * afterwards; subPtr is handled in the main exit stanza. */ result = Tcl_EvalObjv(interp, numArgs, args, 0); -- cgit v0.12 From 2bd7095b873e14982c860118b27caeeb0af6085e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 23 Jun 2017 15:04:44 +0000 Subject: No longer split tests for longIs32bit/longIs64bit, since the results should be identical --- tests/format.test | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tests/format.test b/tests/format.test index 1c20d0f..094b7b3 100644 --- a/tests/format.test +++ b/tests/format.test @@ -79,22 +79,13 @@ test format-1.11.1 {integer formatting} longIs64bit { test format-1.12 {integer formatting} { format "%b %#b %#b %llb" 5 0 5 [expr {2**100}] } {101 0b0 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} -test format-1.13 {integer formatting} longIs32bit { +test format-1.13 {integer formatting} { format "%#d %#d %#d %#d %#d" 0 6 34 16923 -12 -1 } {0d0 0d6 0d34 0d16923 -0d12} -test format-1.13.1 {integer formatting} longIs64bit { - format "%#d %#d %#d %#d %#d" 0 6 34 16923 -12 -1 -} {0d0 0d6 0d34 0d16923 -0d12} -test format-1.14 {integer formatting} longIs32bit { - format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 -} { 0d0 0d6 0d34 0d16923 -0d12} -test format-1.14.1 {integer formatting} longIs64bit { +test format-1.14 {integer formatting} { format "%#5d %#20d %#20d %#20d %#20d" 0 6 34 16923 -12 -1 } { 0d0 0d6 0d34 0d16923 -0d12} -test format-1.15 {integer formatting} longIs32bit { - format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 -} {0d0 0d6 0d34 0d16923 -0d12 } -test format-1.15.1 {integer formatting} longIs64bit { +test format-1.15 {integer formatting} { format "%-#5d %-#20d %-#20d %-#20d %-#20d" 0 6 34 16923 -12 -1 } {0d0 0d6 0d34 0d16923 -0d12 } -- cgit v0.12 From f4615ea1664f3bc4ce0b8aab2afa51334548fb98 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 26 Jun 2017 17:30:15 +0000 Subject: Test demonstrating autoloader fragility. --- tests/init.test | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/init.test b/tests/init.test index 41b8624..3a5197a 100644 --- a/tests/init.test +++ b/tests/init.test @@ -168,6 +168,16 @@ foreach arg [subst -nocommands -novariables { incr count } +test init-4.$count {[Bug 46f801ed5a]} -setup { + auto_reset + array set auto_index {demo {proc demo {} {tailcall error foo}}} +} -body { + demo +} -cleanup { + array unset auto_index demo + rename demo {} +} -match glob -result * + test init-5.0 {return options passed through ::unknown} -setup { catch {rename xxx {}} set ::auto_index(::xxx) {proc ::xxx {} { -- cgit v0.12 From 7a8a4b15c48a224618c4ff60841bec04b0bb684c Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 26 Jun 2017 19:17:12 +0000 Subject: Try to make good stack trace. Fallback to making not-so-good stack trace. Stop failing altogether. Test in test suite, not program fragility. --- library/init.tcl | 50 ++++++++++++++++++++++++++++---------------------- tests/init.test | 2 +- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/library/init.tcl b/library/init.tcl index a202054..6173b86 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -284,14 +284,9 @@ proc unknown args { } append cinfo ... } - append cinfo "\"\n (\"uplevel\" body line 1)" - append cinfo "\n invoked from within" - append cinfo "\n\"uplevel 1 \$args\"" - # - # Try each possible form of the stack trace - # and trim the extra contribution from the matching case - # - set expect "$msg\n while executing\n\"$cinfo" + set tail "\n (\"uplevel\" body line 1)\n invoked\ + from within\n\"uplevel 1 \$args\"" + set expect "$msg\n while executing\n\"$cinfo\"$tail" if {$errInfo eq $expect} { # # The stack has only the eval from the expanded command @@ -305,21 +300,32 @@ proc unknown args { # Stack trace is nested, trim off just the contribution # from the extra "eval" of $args due to the "catch" above. # - set expect "\n invoked from within\n\"$cinfo" - set exlen [string length $expect] - set eilen [string length $errInfo] - set i [expr {$eilen - $exlen - 1}] - set einfo [string range $errInfo 0 $i] - # - # For now verify that $errInfo consists of what we are about - # to return plus what we expected to trim off. - # - if {$errInfo ne "$einfo$expect"} { - error "Tcl bug: unexpected stack trace in \"unknown\"" {} \ - [list CORE UNKNOWN BADTRACE $einfo $expect $errInfo] + set last [string last $tail $errInfo] + if {$last + [string length $tail] != [string length $errInfo]} { + # Very likely cannot happen + return -options $opts $msg } - return -code error -errorcode $errCode \ - -errorinfo $einfo $msg + set errInfo [string range $errInfo 0 $last-1] + set tail "\"$cinfo\"" + set last [string last $tail $errInfo] + if {$last + [string length $tail] != [string length $errInfo]} { + return -code error -errorcode $errCode \ + -errorinfo $errInfo $msg + } + set errInfo [string range $errInfo 0 $last-1] + set tail "\n invoked from within\n" + set last [string last $tail $errInfo] + if {$last + [string length $tail] == [string length $errInfo]} { + return -code error -errorcode $errCode \ + -errorinfo [string range $errInfo 0 $last-1] $msg + } + set tail "\n while executing\n" + set last [string last $tail $errInfo] + if {$last + [string length $tail] == [string length $errInfo]} { + return -code error -errorcode $errCode \ + -errorinfo [string range $errInfo 0 $last-1] $msg + } + return -options $opts $msg } else { dict incr opts -level return -options $opts $msg diff --git a/tests/init.test b/tests/init.test index 3a5197a..639389f 100644 --- a/tests/init.test +++ b/tests/init.test @@ -176,7 +176,7 @@ test init-4.$count {[Bug 46f801ed5a]} -setup { } -cleanup { array unset auto_index demo rename demo {} -} -match glob -result * +} -returnCodes error -result foo test init-5.0 {return options passed through ::unknown} -setup { catch {rename xxx {}} -- cgit v0.12 From f242dd36bd7e44e4832fc43082c9b608573020bb Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 26 Jun 2017 19:37:34 +0000 Subject: Bump to TclOO 1.1.0 --- generic/tclOO.h | 2 +- unix/tclooConfig.sh | 2 +- win/tclooConfig.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclOO.h b/generic/tclOO.h index 46f01fb..32afbf1 100644 --- a/generic/tclOO.h +++ b/generic/tclOO.h @@ -24,7 +24,7 @@ * win/tclooConfig.sh */ -#define TCLOO_VERSION "1.0.5" +#define TCLOO_VERSION "1.1.0" #define TCLOO_PATCHLEVEL TCLOO_VERSION #include "tcl.h" diff --git a/unix/tclooConfig.sh b/unix/tclooConfig.sh index ee10b81..2279542 100644 --- a/unix/tclooConfig.sh +++ b/unix/tclooConfig.sh @@ -16,4 +16,4 @@ TCLOO_STUB_LIB_SPEC="" TCLOO_INCLUDE_SPEC="" TCLOO_PRIVATE_INCLUDE_SPEC="" TCLOO_CFLAGS="" -TCLOO_VERSION=1.0.4 +TCLOO_VERSION=1.1.0 diff --git a/win/tclooConfig.sh b/win/tclooConfig.sh index ee10b81..2279542 100644 --- a/win/tclooConfig.sh +++ b/win/tclooConfig.sh @@ -16,4 +16,4 @@ TCLOO_STUB_LIB_SPEC="" TCLOO_INCLUDE_SPEC="" TCLOO_PRIVATE_INCLUDE_SPEC="" TCLOO_CFLAGS="" -TCLOO_VERSION=1.0.4 +TCLOO_VERSION=1.1.0 -- cgit v0.12 From 5314bbe0efeebd5113df7a914be41177f1bbebe7 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 26 Jun 2017 19:56:37 +0000 Subject: update changes --- changes | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/changes b/changes index 359f8b8..f662059 100644 --- a/changes +++ b/changes @@ -8783,4 +8783,11 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-06-08 (bug)[2738427] Tcl_NumUtfChars() corner case utf-4.9 (nijtmans) +2017-06-22 (update) Update Unicode data to 10.0 (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-06-22 (TIP 473) Let [oo::copy] specify target namespace (fellows) + +2017-06-26 (bug)[46f801] Repair autoloader fragility (porter) + --- Released 8.6.7, ????, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 875f1b248d30947b159ed0463dd75e8f035298f8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 27 Jun 2017 10:13:34 +0000 Subject: Implement "format %o" as prefixing with "0o" in stead of "0" (Kevin Kenny's suggestion). Seems ready to be TIPed (just some more testing) --- generic/tclStringObj.c | 26 ++++++++++++++++++-------- library/clock.tcl | 0 tests/format.test | 26 +++++++++++++------------- tests/io.test | 2 +- 4 files changed, 32 insertions(+), 22 deletions(-) mode change 100644 => 100755 library/clock.tcl diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 3b3e211..e2a15f4 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1963,10 +1963,13 @@ Tcl_AppendFormatToObj( } #endif if (useBig) { + int cmpResult; if (Tcl_GetBignumFromObj(interp, segment, &big) != TCL_OK) { goto error; } - isNegative = (mp_cmp_d(&big, 0) == MP_LT); + cmpResult = mp_cmp_d(&big, 0); + isNegative = (cmpResult == MP_LT); + if (cmpResult == MP_EQ) gotHash = 0; #ifndef TCL_WIDE_INT_IS_LONG } else if (useWide) { if (Tcl_GetWideIntFromObj(NULL, segment, &w) != TCL_OK) { @@ -1982,6 +1985,7 @@ Tcl_AppendFormatToObj( Tcl_DecrRefCount(objPtr); } isNegative = (w < (Tcl_WideInt) 0); + if (w == (Tcl_WideInt) 0) gotHash = 0; #endif } else if (TclGetLongFromObj(NULL, segment, &l) != TCL_OK) { if (Tcl_GetWideIntFromObj(NULL, segment, &w) != TCL_OK) { @@ -2001,14 +2005,18 @@ Tcl_AppendFormatToObj( if (useShort) { s = (short) l; isNegative = (s < (short) 0); + if (s == (short) 0) gotHash = 0; } else { isNegative = (l < (long) 0); + if (l == (long) 0) gotHash = 0; } } else if (useShort) { s = (short) l; isNegative = (s < (short) 0); + if (s == (short) 0) gotHash = 0; } else { isNegative = (l < (long) 0); + if (l == (long) 0) gotHash = 0; } segment = Tcl_NewObj(); @@ -2025,9 +2033,8 @@ Tcl_AppendFormatToObj( if (gotHash || (ch == 'p')) { switch (ch) { case 'o': - Tcl_AppendToObj(segment, "0", 1); - segmentLimit -= 1; - precision--; + Tcl_AppendToObj(segment, "0o", 2); + segmentLimit -= 2; break; case 'p': case 'x': @@ -2184,7 +2191,7 @@ Tcl_AppendFormatToObj( * Need to be sure zero becomes "0", not "". */ - if ((numDigits == 0) && !((ch == 'o') && gotHash)) { + if (numDigits == 0) { numDigits = 1; } pure = Tcl_NewObj(); @@ -2204,7 +2211,11 @@ Tcl_AppendFormatToObj( } digitOffset = (int) (bits % base); if (digitOffset > 9) { - bytes[numDigits] = 'a' + digitOffset - 10; + if (ch == 'X') { + bytes[numDigits] = 'A' + digitOffset - 10; + } else { + bytes[numDigits] = 'a' + digitOffset - 10; + } } else { bytes[numDigits] = '0' + digitOffset; } @@ -2328,8 +2339,7 @@ Tcl_AppendFormatToObj( switch (ch) { case 'E': - case 'G': - case 'X': { + case 'G': { Tcl_SetObjLength(segment, Tcl_UtfToUpper(TclGetString(segment))); } } diff --git a/library/clock.tcl b/library/clock.tcl old mode 100644 new mode 100755 diff --git a/tests/format.test b/tests/format.test index 9d75c58..4d312db 100644 --- a/tests/format.test +++ b/tests/format.test @@ -28,7 +28,7 @@ test format-1.1 {integer formatting} { } { 34 16923 -12 -1} test format-1.2 {integer formatting} { format "%4d %4d %4d %4d %d %#x %#X" 6 34 16923 -12 -1 14 12 -} { 6 34 16923 -12 -1 0xe 0XC} +} { 6 34 16923 -12 -1 0xe 0xC} test format-1.3 {integer formatting} longIs32bit { format "%4u %4u %4u %4u %d %#o" 6 34 16923 -12 -1 0 } { 6 34 16923 4294967284 -1 0} @@ -54,40 +54,40 @@ test format-1.7.1 {integer formatting} longIs64bit { } { 6 22 421b fffffffffffffff4} test format-1.8 {integer formatting} longIs32bit { format "%#x %#x %#X %#X %#x" 0 6 34 16923 -12 -1 -} {0x0 0x6 0X22 0X421B 0xfffffff4} +} {0 0x6 0x22 0x421B 0xfffffff4} test format-1.8.1 {integer formatting} longIs64bit { format "%#x %#x %#X %#X %#x" 0 6 34 16923 -12 -1 -} {0x0 0x6 0X22 0X421B 0xfffffffffffffff4} +} {0 0x6 0x22 0x421B 0xfffffffffffffff4} test format-1.9 {integer formatting} longIs32bit { format "%#5x %#20x %#20x %#20x %#20x" 0 6 34 16923 -12 -1 -} { 0x0 0x6 0x22 0x421b 0xfffffff4} +} { 0 0x6 0x22 0x421b 0xfffffff4} test format-1.9.1 {integer formatting} longIs64bit { format "%#5x %#20x %#20x %#20x %#20x" 0 6 34 16923 -12 -1 -} { 0x0 0x6 0x22 0x421b 0xfffffffffffffff4} +} { 0 0x6 0x22 0x421b 0xfffffffffffffff4} test format-1.10 {integer formatting} longIs32bit { format "%-#5x %-#20x %-#20x %-#20x %-#20x" 0 6 34 16923 -12 -1 -} {0x0 0x6 0x22 0x421b 0xfffffff4 } +} {0 0x6 0x22 0x421b 0xfffffff4 } test format-1.10.1 {integer formatting} longIs64bit { format "%-#5x %-#20x %-#20x %-#20x %-#20x" 0 6 34 16923 -12 -1 -} {0x0 0x6 0x22 0x421b 0xfffffffffffffff4 } +} {0 0x6 0x22 0x421b 0xfffffffffffffff4 } test format-1.11 {integer formatting} longIs32bit { format "%-#5o %-#20o %#-20o %#-20o %#-20o" 0 6 34 16923 -12 -1 -} {0 06 042 041033 037777777764 } +} {0 0o6 0o42 0o41033 0o37777777764 } test format-1.11.1 {integer formatting} longIs64bit { format "%-#5o %-#20o %#-20o %#-20o %#-20o" 0 6 34 16923 -12 -1 -} {0 06 042 041033 01777777777777777777764} +} {0 0o6 0o42 0o41033 0o1777777777777777777764} test format-1.12 {integer formatting} { format "%b %#b %#b %llb" 5 0 5 [expr {2**100}] -} {101 0b0 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} +} {101 0 0b101 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000} test format-1.13 {integer formatting} { format "%#0d %#0d %#0d %#0d %#0d" 0 6 34 16923 -12 -1 -} {0d0 0d6 0d34 0d16923 -0d12} +} {0 0d6 0d34 0d16923 -0d12} test format-1.14 {integer formatting} { format "%#05d %#020d %#020d %#020d %#020d" 0 6 34 16923 -12 -1 -} {0d000 0d000000000000000006 0d000000000000000034 0d000000000000016923 -0d00000000000000012} +} {00000 0d000000000000000006 0d000000000000000034 0d000000000000016923 -0d00000000000000012} test format-1.15 {integer formatting} { format "%-#05d %-#020d %-#020d %-#020d %-#020d" 0 6 34 16923 -12 -1 -} {0d000 0d000000000000000006 0d000000000000000034 0d000000000000016923 -0d00000000000000012} +} {00000 0d000000000000000006 0d000000000000000034 0d000000000000016923 -0d00000000000000012} test format-2.1 {string formatting} { diff --git a/tests/io.test b/tests/io.test index 3fc370d..fb04a5b 100644 --- a/tests/io.test +++ b/tests/io.test @@ -5638,7 +5638,7 @@ test io-40.2 {POSIX open access modes: CREAT} {unix} { file delete $path(test3) set f [open $path(test3) {WRONLY CREAT} 0o600] file stat $path(test3) stats - set x [format "0o%o" [expr $stats(mode)&0o777]] + set x [format "%#o" [expr $stats(mode)&0o777]] puts $f "line 1" close $f set f [open $path(test3) r] -- cgit v0.12 From 4401a58b2a11919b4b98ff792f925bf967ffb232 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 28 Jun 2017 11:02:19 +0000 Subject: Implement %a and %A for floating point numbers --- generic/tclStringObj.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 43c8f6c..6457eb3 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2263,6 +2263,8 @@ Tcl_AppendFormatToObj( break; } + case 'a': + case 'A': case 'e': case 'E': case 'f': @@ -2343,9 +2345,12 @@ Tcl_AppendFormatToObj( } switch (ch) { - case 'E': - case 'G': { - Tcl_SetObjLength(segment, Tcl_UtfToUpper(TclGetString(segment))); + case 'A': { + char *p = TclGetString(segment); + p[1] = 'x'; + p = strchr(p, 'P'); + if (p) *p = 'p'; + break; } } -- cgit v0.12 From 89f68844556da7cab344bb0b7c2c9101579d30ed Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 28 Jun 2017 13:32:16 +0000 Subject: Eliminate use of (expensive) Tcl_UtfToUpper() from "format": Just generate the expected uppercase characters right away from the start. No change in functionality, just code optimization. --- generic/tclStringObj.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 4a3b6f1..c84b500 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2027,8 +2027,11 @@ Tcl_AppendFormatToObj( segmentLimit -= 1; precision--; break; - case 'x': case 'X': + Tcl_AppendToObj(segment, "0X", 2); + segmentLimit -= 2; + break; + case 'x': Tcl_AppendToObj(segment, "0x", 2); segmentLimit -= 2; break; @@ -2192,7 +2195,11 @@ Tcl_AppendFormatToObj( } digitOffset = (int) (bits % base); if (digitOffset > 9) { - bytes[numDigits] = 'a' + digitOffset - 10; + if (ch == 'X') { + bytes[numDigits] = 'A' + digitOffset - 10; + } else { + bytes[numDigits] = 'a' + digitOffset - 10; + } } else { bytes[numDigits] = '0' + digitOffset; } @@ -2314,14 +2321,6 @@ Tcl_AppendFormatToObj( goto error; } - switch (ch) { - case 'E': - case 'G': - case 'X': { - Tcl_SetObjLength(segment, Tcl_UtfToUpper(TclGetString(segment))); - } - } - if (width>0 && numChars<0) { numChars = Tcl_GetCharLength(segment); } -- cgit v0.12 From d0996f34029620a4e4469b9b70427b6694cd83e6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 3 Jul 2017 08:27:42 +0000 Subject: 'inline static' -> 'static inline' and 'INLINE' -> 'inline', for consistancy. --- generic/tclStrToD.c | 52 ++++++++++++++++++++++++++-------------------------- generic/tclUtf.c | 4 ++-- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 2091928..5d601e4 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -1973,7 +1973,7 @@ RefineApproximation( *---------------------------------------------------------------------- */ -inline static void +static inline void MulPow5( mp_int *base, /* Number to multiply. */ unsigned n, /* Power of 5 to multiply by. */ @@ -2018,7 +2018,7 @@ MulPow5( *---------------------------------------------------------------------- */ -inline static int +static inline int NormalizeRightward( Tcl_WideUInt *wPtr) /* INOUT: Number to shift. */ { @@ -2109,7 +2109,7 @@ RequiredPrecision( *---------------------------------------------------------------------- */ -inline static void +static inline void DoubleToExpAndSig( double dv, /* Number to convert. */ Tcl_WideUInt *significand, /* OUTPUT: Significand of the number. */ @@ -2157,7 +2157,7 @@ DoubleToExpAndSig( *---------------------------------------------------------------------- */ -inline static void +static inline void TakeAbsoluteValue( Double *d, /* Number to replace with absolute value. */ int *sign) /* Place to put the signum. */ @@ -2188,7 +2188,7 @@ TakeAbsoluteValue( *---------------------------------------------------------------------- */ -inline static char * +static inline char * FormatInfAndNaN( Double *d, /* Exceptional number to format. */ int *decpt, /* Decimal point to set to a bogus value. */ @@ -2230,7 +2230,7 @@ FormatInfAndNaN( *---------------------------------------------------------------------- */ -inline static char * +static inline char * FormatZero( int *decpt, /* Location of the decimal point. */ char **endPtr) /* Pointer to the end of the formatted data */ @@ -2260,7 +2260,7 @@ FormatZero( *---------------------------------------------------------------------- */ -inline static int +static inline int ApproximateLog10( Tcl_WideUInt bw, /* Integer significand of the number. */ int be, /* Power of two to scale bw. */ @@ -2308,7 +2308,7 @@ ApproximateLog10( *---------------------------------------------------------------------- */ -inline static int +static inline int BetterLog10( double d, /* Original number to format. */ int k, /* Characteristic(Log base 10) of the @@ -2351,7 +2351,7 @@ BetterLog10( *---------------------------------------------------------------------- */ -inline static void +static inline void ComputeScale( int be, /* Exponent part of number: d = bw * 2**be. */ int k, /* Characteristic of log10(number). */ @@ -2414,7 +2414,7 @@ ComputeScale( *---------------------------------------------------------------------- */ -inline static void +static inline void SetPrecisionLimits( int convType, /* Type of conversion: TCL_DD_SHORTEST, * TCL_DD_STEELE0, TCL_DD_E_FMT, @@ -2475,7 +2475,7 @@ SetPrecisionLimits( *---------------------------------------------------------------------- */ -inline static char * +static inline char * BumpUp( char *s, /* Cursor pointing one past the end of the * string. */ @@ -2509,7 +2509,7 @@ BumpUp( *---------------------------------------------------------------------- */ -inline static int +static inline int AdjustRange( double *dPtr, /* INOUT: Number to adjust. */ int k) /* IN: floor(log10(d)) */ @@ -2582,7 +2582,7 @@ AdjustRange( *---------------------------------------------------------------------- */ -inline static char * +static inline char * ShorteningQuickFormat( double d, /* Number to convert. */ int k, /* floor(log10(d)) */ @@ -2657,7 +2657,7 @@ ShorteningQuickFormat( *---------------------------------------------------------------------- */ -inline static char * +static inline char * StrictQuickFormat( double d, /* Number to convert. */ int k, /* floor(log10(d)) */ @@ -2731,7 +2731,7 @@ StrictQuickFormat( *---------------------------------------------------------------------- */ -inline static char * +static inline char * QuickConversion( double e, /* Number to format. */ int k, /* floor(log10(d)), approximately. */ @@ -2836,7 +2836,7 @@ QuickConversion( *---------------------------------------------------------------------- */ -inline static void +static inline void CastOutPowersOf2( int *b2, /* Power of 2 to multiply the significand. */ int *m2, /* Power of 2 to multiply 1/2 ulp. */ @@ -2880,7 +2880,7 @@ CastOutPowersOf2( *---------------------------------------------------------------------- */ -inline static char * +static inline char * ShorteningInt64Conversion( Double *dPtr, /* Original number to convert. */ int convType, /* Type of conversion (shortest, Steele, @@ -3049,7 +3049,7 @@ ShorteningInt64Conversion( *---------------------------------------------------------------------- */ -inline static char * +static inline char * StrictInt64Conversion( Double *dPtr, /* Original number to convert. */ int convType, /* Type of conversion (shortest, Steele, @@ -3155,7 +3155,7 @@ StrictInt64Conversion( *---------------------------------------------------------------------- */ -inline static int +static inline int ShouldBankerRoundUpPowD( mp_int *b, /* Numerator of the fraction. */ int sd, /* Denominator is 2**(sd*DIGIT_BIT). */ @@ -3193,7 +3193,7 @@ ShouldBankerRoundUpPowD( *---------------------------------------------------------------------- */ -inline static int +static inline int ShouldBankerRoundUpToNextPowD( mp_int *b, /* Numerator of the fraction. */ mp_int *m, /* Numerator of the rounding tolerance. */ @@ -3256,7 +3256,7 @@ ShouldBankerRoundUpToNextPowD( *---------------------------------------------------------------------- */ -inline static char * +static inline char * ShorteningBignumConversionPowD( Double *dPtr, /* Original number to convert. */ int convType, /* Type of conversion (shortest, Steele, @@ -3449,7 +3449,7 @@ ShorteningBignumConversionPowD( *---------------------------------------------------------------------- */ -inline static char * +static inline char * StrictBignumConversionPowD( Double *dPtr, /* Original number to convert. */ int convType, /* Type of conversion (shortest, Steele, @@ -3565,7 +3565,7 @@ StrictBignumConversionPowD( *---------------------------------------------------------------------- */ -inline static int +static inline int ShouldBankerRoundUp( mp_int *twor, /* 2x the remainder from thd division that * produced the last digit. */ @@ -3600,7 +3600,7 @@ ShouldBankerRoundUp( *---------------------------------------------------------------------- */ -inline static int +static inline int ShouldBankerRoundUpToNext( mp_int *b, /* Remainder from the division that produced * the last digit. */ @@ -3654,7 +3654,7 @@ ShouldBankerRoundUpToNext( *---------------------------------------------------------------------- */ -inline static char * +static inline char * ShorteningBignumConversion( Double *dPtr, /* Original number being converted. */ int convType, /* Conversion type. */ @@ -3870,7 +3870,7 @@ ShorteningBignumConversion( *---------------------------------------------------------------------- */ -inline static char * +static inline char * StrictBignumConversion( Double *dPtr, /* Original number being converted. */ int convType, /* Conversion type. */ diff --git a/generic/tclUtf.c b/generic/tclUtf.c index b13ad75..b8b867c 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -98,7 +98,7 @@ static int UtfCount(int ch); *--------------------------------------------------------------------------- */ -INLINE static int +static inline int UtfCount( int ch) /* The Tcl_UniChar whose size is returned. */ { @@ -134,7 +134,7 @@ UtfCount( *--------------------------------------------------------------------------- */ -INLINE int +int Tcl_UniCharToUtf( int ch, /* The Tcl_UniChar to be stored in the * buffer. */ -- cgit v0.12 From 692ea37c40875fdf3db99108dcbd34a4de9d0c22 Mon Sep 17 00:00:00 2001 From: sebres Date: Mon, 3 Jul 2017 09:15:23 +0000 Subject: tclPathObj: fixed TclJoinPath (backported from 8.6) - usage of released object and object leakage. closes [adb198c256df8c4192838cc3c1112fb2821314e9] --- generic/tclPathObj.c | 154 +++++++++++++++++++++++---------------------------- 1 file changed, 70 insertions(+), 84 deletions(-) diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 88e49b5..a306853 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -821,50 +821,47 @@ GetExtension( *--------------------------------------------------------------------------- */ +Tcl_Obj * TclJoinPath(int elements, Tcl_Obj * const objv[]); + Tcl_Obj * Tcl_FSJoinPath( Tcl_Obj *listObj, /* Path elements to join, may have a zero * reference count. */ int elements) /* Number of elements to use (-1 = all) */ { - Tcl_Obj *res; - int i; - Tcl_Filesystem *fsPtr = NULL; + Tcl_Obj *copy, *res; + int objc; + Tcl_Obj **objv; - if (elements < 0) { - if (Tcl_ListObjLength(NULL, listObj, &elements) != TCL_OK) { - return NULL; - } - } else { - /* - * Just make sure it is a valid list. - */ - - int listTest; - - if (Tcl_ListObjLength(NULL, listObj, &listTest) != TCL_OK) { - return NULL; - } - - /* - * Correct this if it is too large, otherwise we will waste our time - * joining null elements to the path. - */ - - if (elements > listTest) { - elements = listTest; - } + if (Tcl_ListObjLength(NULL, listObj, &objc) != TCL_OK) { + return NULL; } - res = NULL; + elements = ((elements >= 0) && (elements <= objc)) ? elements : objc; + copy = TclListObjCopy(NULL, listObj); + Tcl_ListObjGetElements(NULL, listObj, &objc, &objv); + res = TclJoinPath(elements, objv); + Tcl_DecrRefCount(copy); + return res; +} + +Tcl_Obj * +TclJoinPath( + int elements, + Tcl_Obj * const objv[]) +{ + Tcl_Obj *res = NULL; /* Resulting path object (container of join) */ + Tcl_Obj *elt; /* Path part (result if returns part of path) */ + int i; + Tcl_Filesystem *fsPtr = NULL; for (i = 0; i < elements; i++) { - Tcl_Obj *elt, *driveName = NULL; int driveNameLength, strEltLen, length; Tcl_PathType type; char *strElt, *ptr; - - Tcl_ListObjIndex(NULL, listObj, i, &elt); + Tcl_Obj *driveName = NULL; + + elt = objv[i]; /* * This is a special case where we can be much more efficient, where @@ -873,19 +870,23 @@ Tcl_FSJoinPath( * object which can be normalized more efficiently. Currently we only * use the special case when we have exactly two elements, but we * could expand that in the future. + * + * Bugfix [a47641a0]. TclNewFSPathObj requires first argument + * to be an absolute path. Added a check for that elt is absolute. */ - if ((i == (elements-2)) && (i == 0) && (elt->typePtr == &tclFsPathType) - && !(elt->bytes != NULL && (elt->bytes[0] == '\0'))) { - Tcl_Obj *tail; + if ((i == (elements-2)) && (i == 0) + && (elt->typePtr == &tclFsPathType) + && !((elt->bytes != NULL) && (elt->bytes[0] == '\0')) + && TclGetPathType(elt, NULL, NULL, NULL) == TCL_PATH_ABSOLUTE) { + Tcl_Obj *tailObj = objv[i+1]; - Tcl_ListObjIndex(NULL, listObj, i+1, &tail); - type = TclGetPathType(tail, NULL, NULL, NULL); + type = TclGetPathType(tailObj, NULL, NULL, NULL); if (type == TCL_PATH_RELATIVE) { const char *str; int len; - str = Tcl_GetStringFromObj(tail, &len); + str = Tcl_GetStringFromObj(tailObj, &len); if (len == 0) { /* * This happens if we try to handle the root volume '/'. @@ -893,10 +894,7 @@ Tcl_FSJoinPath( * the base itself is just fine! */ - if (res != NULL) { - TclDecrRefCount(res); - } - return elt; + goto partReturn; /* return elt; */ } /* @@ -917,20 +915,20 @@ Tcl_FSJoinPath( */ if ((tclPlatform != TCL_PLATFORM_WINDOWS) - || (strchr(Tcl_GetString(elt), '\\') == NULL)) { - if (res != NULL) { - TclDecrRefCount(res); - } - + || (strchr(Tcl_GetString(elt), '\\') == NULL) + ) { if (PATHFLAGS(elt)) { - return TclNewFSPathObj(elt, str, len); + elt = TclNewFSPathObj(elt, str, len); + goto partReturn; /* return elt; */ } if (TCL_PATH_ABSOLUTE != Tcl_FSGetPathType(elt)) { - return TclNewFSPathObj(elt, str, len); + elt = TclNewFSPathObj(elt, str, len); + goto partReturn; /* return elt; */ } (void) Tcl_FSGetNormalizedPath(NULL, elt); if (elt == PATHOBJ(elt)->normPathPtr) { - return TclNewFSPathObj(elt, str, len); + elt = TclNewFSPathObj(elt, str, len); + goto partReturn; /* return elt; */ } } } @@ -940,19 +938,15 @@ Tcl_FSJoinPath( * more general code below handle things. */ } else if (tclPlatform == TCL_PLATFORM_UNIX) { - if (res != NULL) { - TclDecrRefCount(res); - } - return tail; + elt = tailObj; + goto partReturn; /* return elt; */ } else { - const char *str = TclGetString(tail); + const char *str = TclGetString(tailObj); if (tclPlatform == TCL_PLATFORM_WINDOWS) { if (strchr(str, '\\') == NULL) { - if (res != NULL) { - TclDecrRefCount(res); - } - return tail; + elt = tailObj; + goto partReturn; /* return elt; */ } } } @@ -1031,16 +1025,12 @@ Tcl_FSJoinPath( } ptr++; } - if (res != NULL) { - TclDecrRefCount(res); - } - /* - * This element is just what we want to return already - no - * further manipulation is requred. + * This element is just what we want to return already; no further + * manipulation is requred. */ - return elt; + goto partReturn; /* return elt; */ } /* @@ -1051,10 +1041,8 @@ Tcl_FSJoinPath( noQuickReturn: if (res == NULL) { res = Tcl_NewObj(); - ptr = Tcl_GetStringFromObj(res, &length); - } else { - ptr = Tcl_GetStringFromObj(res, &length); } + ptr = Tcl_GetStringFromObj(res, &length); /* * Strip off any './' before a tilde, unless this is the beginning of @@ -1083,10 +1071,11 @@ Tcl_FSJoinPath( int needsSep = 0; if (fsPtr->filesystemSeparatorProc != NULL) { - Tcl_Obj *sep = (*fsPtr->filesystemSeparatorProc)(res); + Tcl_Obj *sep = fsPtr->filesystemSeparatorProc(res); if (sep != NULL) { separator = TclGetString(sep)[0]; + TclDecrRefCount(sep); } /* Safety check in case the VFS driver caused sharing */ if (Tcl_IsShared(res)) { @@ -1126,6 +1115,12 @@ Tcl_FSJoinPath( res = Tcl_NewObj(); } return res; + +partReturn: + if (res != NULL) { + TclDecrRefCount(res); + } + return elt; } /* @@ -2516,27 +2511,18 @@ SetFsPathFromAny( } TclDecrRefCount(parts); } else { - /* - * Simple case. "rest" is relative path. Just join it. The - * "rest" object will be freed when Tcl_FSJoinToPath returns - * (unless something else claims a refCount on it). - */ - - Tcl_Obj *joined; - Tcl_Obj *rest = Tcl_NewStringObj(name+split+1, -1); + Tcl_Obj *pair[2]; - Tcl_IncrRefCount(transPtr); - joined = Tcl_FSJoinToPath(transPtr, 1, &rest); - TclDecrRefCount(transPtr); - transPtr = joined; + pair[0] = transPtr; + pair[1] = Tcl_NewStringObj(name+split+1, -1); + transPtr = TclJoinPath(2, pair); + TclDecrRefCount(pair[0]); + TclDecrRefCount(pair[1]); } } Tcl_DStringFree(&temp); } else { - /* Bug 3479689: protect 0-refcount pathPth from getting freed */ - pathPtr->refCount++; - transPtr = Tcl_FSJoinToPath(pathPtr, 0, NULL); - pathPtr->refCount--; + transPtr = TclJoinPath(1, &pathPtr); } /* -- cgit v0.12 From bcb9c345212df9ab3ea814522a43090b856bd1e9 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 6 Jul 2017 15:46:58 +0000 Subject: Alternative fix for memleaks in fs path join machinery. --- generic/tclPathObj.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 31ed68e..f8015b2 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -13,6 +13,7 @@ #include "tclInt.h" #include "tclFileSystem.h" +#include /* * Prototypes for functions defined later in this file. @@ -849,11 +850,17 @@ TclJoinPath( int elements, Tcl_Obj * const objv[]) { - Tcl_Obj *res; + Tcl_Obj *res = NULL; int i; const Tcl_Filesystem *fsPtr = NULL; - res = NULL; + assert ( elements >= 0 ); + + if (elements == 0) { + return Tcl_NewObj(); + } + + assert ( elements > 0 ); for (i = 0; i < elements; i++) { int driveNameLength, strEltLen, length; @@ -893,9 +900,7 @@ TclJoinPath( * the base itself is just fine! */ - if (res != NULL) { - TclDecrRefCount(res); - } + assert ( res == NULL ); return elt; } @@ -918,9 +923,8 @@ TclJoinPath( if ((tclPlatform != TCL_PLATFORM_WINDOWS) || (strchr(Tcl_GetString(elt), '\\') == NULL)) { - if (res != NULL) { - TclDecrRefCount(res); - } + + assert ( res == NULL ); if (PATHFLAGS(elt)) { return TclNewFSPathObj(elt, str, len); @@ -940,18 +944,14 @@ TclJoinPath( * more general code below handle things. */ } else if (tclPlatform == TCL_PLATFORM_UNIX) { - if (res != NULL) { - TclDecrRefCount(res); - } + assert ( res == NULL ); return tailObj; } else { const char *str = TclGetString(tailObj); if (tclPlatform == TCL_PLATFORM_WINDOWS) { if (strchr(str, '\\') == NULL) { - if (res != NULL) { - TclDecrRefCount(res); - } + assert ( res == NULL ); return tailObj; } } @@ -1087,6 +1087,7 @@ TclJoinPath( if (sep != NULL) { separator = TclGetString(sep)[0]; + Tcl_DecrRefCount(sep); } /* Safety check in case the VFS driver caused sharing */ if (Tcl_IsShared(res)) { @@ -1122,9 +1123,7 @@ TclJoinPath( Tcl_SetObjLength(res, length); } } - if (res == NULL) { - res = Tcl_NewObj(); - } + assert ( res != NULL ); return res; } -- cgit v0.12 From 515f0f32c030f9972c6c518746e99ecadfb0291f Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 6 Jul 2017 16:00:46 +0000 Subject: Pull out of the loop a block of code that can only run in first iteration. --- generic/tclPathObj.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index f8015b2..8ee4869 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -862,12 +862,8 @@ TclJoinPath( assert ( elements > 0 ); - for (i = 0; i < elements; i++) { - int driveNameLength, strEltLen, length; - Tcl_PathType type; - char *strElt, *ptr; - Tcl_Obj *driveName = NULL; - Tcl_Obj *elt = objv[i]; + if (elements == 2) { + Tcl_Obj *elt = objv[0]; /* * This is a special case where we can be much more efficient, where @@ -876,18 +872,17 @@ TclJoinPath( * object which can be normalized more efficiently. Currently we only * use the special case when we have exactly two elements, but we * could expand that in the future. - * - * Bugfix [a47641a0]. TclNewFSPathObj requires first argument - * to be an absolute path. Added a check for that elt is absolute. + * + * Bugfix [a47641a0]. TclNewFSPathObj requires first argument + * to be an absolute path. Added a check for that elt is absolute. */ - if ((i == (elements-2)) && (i == 0) - && (elt->typePtr == &tclFsPathType) + if ((elt->typePtr == &tclFsPathType) && !((elt->bytes != NULL) && (elt->bytes[0] == '\0')) && TclGetPathType(elt, NULL, NULL, NULL) == TCL_PATH_ABSOLUTE) { - Tcl_Obj *tailObj = objv[i+1]; + Tcl_Obj *tailObj = objv[1]; + Tcl_PathType type = TclGetPathType(tailObj, NULL, NULL, NULL); - type = TclGetPathType(tailObj, NULL, NULL, NULL); if (type == TCL_PATH_RELATIVE) { const char *str; int len; @@ -900,7 +895,6 @@ TclJoinPath( * the base itself is just fine! */ - assert ( res == NULL ); return elt; } @@ -924,8 +918,6 @@ TclJoinPath( if ((tclPlatform != TCL_PLATFORM_WINDOWS) || (strchr(Tcl_GetString(elt), '\\') == NULL)) { - assert ( res == NULL ); - if (PATHFLAGS(elt)) { return TclNewFSPathObj(elt, str, len); } @@ -944,19 +936,28 @@ TclJoinPath( * more general code below handle things. */ } else if (tclPlatform == TCL_PLATFORM_UNIX) { - assert ( res == NULL ); return tailObj; } else { const char *str = TclGetString(tailObj); if (tclPlatform == TCL_PLATFORM_WINDOWS) { if (strchr(str, '\\') == NULL) { - assert ( res == NULL ); return tailObj; } } } } + } + + assert ( res == NULL ); + + for (i = 0; i < elements; i++) { + int driveNameLength, strEltLen, length; + Tcl_PathType type; + char *strElt, *ptr; + Tcl_Obj *driveName = NULL; + Tcl_Obj *elt = objv[i]; + strElt = Tcl_GetStringFromObj(elt, &strEltLen); driveNameLength = 0; type = TclGetPathType(elt, &fsPtr, &driveNameLength, &driveName); -- cgit v0.12 From b1243f260322f2203d5c5e140b7c9f89cf847851 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 13 Jul 2017 15:03:27 +0000 Subject: Fix [293344d4f3]: Regression in SQLite test-suite. Long-standing bug in implementation of TclUtfToUniChar() macro. --- generic/tclInt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 6113f23..25bec6a 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3670,7 +3670,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, CONST char *file, #define TclUtfToUniChar(str, chPtr) \ ((((unsigned char) *(str)) < 0xC0) ? \ - ((*(chPtr) = (Tcl_UniChar) *(str)), 1) \ + ((*(chPtr) = (unsigned char) *(str)), 1) \ : Tcl_UtfToUniChar(str, chPtr)) /* -- cgit v0.12 From cee94b0658268c47f3a5185a951a7ea6555595ac Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 17 Jul 2017 08:01:11 +0000 Subject: Fix [fb2208172c671f29d60e9ac928d9ded45d01d8b8|fb2208172c]: tclIndex varies across builds from auto_mkindex --- library/auto.tcl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/auto.tcl b/library/auto.tcl index ec680de..6cb09b6 100644 --- a/library/auto.tcl +++ b/library/auto.tcl @@ -211,7 +211,7 @@ proc auto_mkindex {dir args} { } auto_mkindex_parser::init - foreach file [glob -- {*}$args] { + foreach file [lsort [glob -- {*}$args]] { if {[catch {auto_mkindex_parser::mkindex $file} msg opts] == 0} { append index $msg } else { @@ -244,7 +244,7 @@ proc auto_mkindex_old {dir args} { if {[llength $args] == 0} { set args *.tcl } - foreach file [glob -- {*}$args] { + foreach file [lsort [glob -- {*}$args]] { set f "" set error [catch { set f [open $file] -- cgit v0.12 From 816674cdb7e93ae44e59f525b3bbe9dd377bfb1b Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 1 Aug 2017 16:05:13 +0000 Subject: update changes --- changes | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/changes b/changes index f662059..ba780e8 100644 --- a/changes +++ b/changes @@ -8790,4 +8790,8 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-06-26 (bug)[46f801] Repair autoloader fragility (porter) ---- Released 8.6.7, ????, 2017 --- http://core.tcl.tk/tcl/ for details +2017-07-06 (bug)[adb198] Plug memleak in TclJoinPath (sebres,porter) + +2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans) + +--- Released 8.6.7, August 4, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 72396a1929d28c0d4eedf4a08a33c634a93a5172 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 2 Aug 2017 23:38:20 +0000 Subject: Fix weird hangs in macOS Sierra on some networks. Name resolution timeouts not what we want to test in the http package. --- tests/http.test | 29 ++++++++++++++++++----------- tests/httpd | 9 ++++++++- tests/httpold.test | 17 ++++++++++++----- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/tests/http.test b/tests/http.test index e8f78e3..c2d2fe8 100644 --- a/tests/http.test +++ b/tests/http.test @@ -36,6 +36,13 @@ proc bgerror {args} { puts stderr $errorInfo } +if {$::tcl_platform(os) eq "Darwin"} { + # Name resolution often a problem on OSX; not focus of HTTP package anyway + set HOST localhost +} else { + set HOST [info hostname] +} + set port 8010 set bindata "This is binary data\x0d\x0amore\x0dmore\x0amore\x00null" catch {unset data} @@ -118,8 +125,8 @@ test http-3.1 {http::geturl} -returnCodes error -body { test http-3.2 {http::geturl} -returnCodes error -body { http::geturl http:junk } -result {Unsupported URL: http:junk} -set url //[info hostname]:$port -set badurl //[info hostname]:[expr $port+1] +set url //${::HOST}:$port +set badurl //${::HOST}:[expr $port+1] test http-3.3 {http::geturl} -body { set token [http::geturl $url] http::data $token @@ -130,13 +137,13 @@ test http-3.3 {http::geturl} -body {

GET /

" set tail /a/b/c -set url //[info hostname]:$port/a/b/c -set fullurl HTTP://user:pass@[info hostname]:$port/a/b/c -set binurl //[info hostname]:$port/binary -set xmlurl //[info hostname]:$port/xml -set posturl //[info hostname]:$port/post -set badposturl //[info hostname]:$port/droppost -set authorityurl //[info hostname]:$port +set url //${::HOST}:$port/a/b/c +set fullurl HTTP://user:pass@${::HOST}:$port/a/b/c +set binurl //${::HOST}:$port/binary +set xmlurl //${::HOST}:$port/xml +set posturl //${::HOST}:$port/post +set badposturl //${::HOST}:$port/droppost +set authorityurl //${::HOST}:$port set ipv6url http://\[::1\]:$port/ test http-3.4 {http::geturl} -body { set token [http::geturl $url] @@ -149,7 +156,7 @@ test http-3.4 {http::geturl} -body { " proc selfproxy {host} { global port - return [list [info hostname] $port] + return [list ${::HOST} $port] } test http-3.5 {http::geturl} -body { http::config -proxyfilter selfproxy @@ -620,7 +627,7 @@ test http-5.5 {http::formatQuery} { } {name1=~bwelch&name2=%A1%A2%A2} test http-6.1 {http::ProxyRequired} -body { - http::config -proxyhost [info hostname] -proxyport $port + http::config -proxyhost ${::HOST} -proxyport $port set token [http::geturl $url] http::wait $token upvar #0 $token data diff --git a/tests/httpd b/tests/httpd index 8753912..16e0382 100644 --- a/tests/httpd +++ b/tests/httpd @@ -10,6 +10,13 @@ #set httpLog 1 +if {$::tcl_platform(os) eq "Darwin"} { + # Name resolution often a problem on OSX; not focus of HTTP package anyway + set HOST localhost +} else { + set HOST [info hostname] +} + proc httpd_init {{port 8015}} { socket -server httpdAccept $port } @@ -168,7 +175,7 @@ proc httpdRespond { sock } { switch -glob -- $data(url) { *binary* { - set html "$bindata[info hostname]:$port$data(url)" + set html "$bindata${::HOST}:$port$data(url)" set type application/octet-stream } *xml* { diff --git a/tests/httpold.test b/tests/httpold.test index 5995bed..e63bcda 100644 --- a/tests/httpold.test +++ b/tests/httpold.test @@ -33,6 +33,13 @@ if {[catch {package require http 1.0}]} { } } +if {$::tcl_platform(os) eq "Darwin"} { + # Name resolution often a problem on OSX; not focus of HTTP package anyway + set HOST localhost +} else { + set HOST [info hostname] +} + set bindata "This is binary data\x0d\x0amore\x0dmore\x0amore\x00null" catch {unset data} @@ -85,7 +92,7 @@ test httpold-3.2 {http_get} { set err } {Unsupported URL: http:junk} -set url [info hostname]:$port +set url ${::HOST}:$port test httpold-3.3 {http_get} { set token [http_get $url] http_data $token @@ -95,8 +102,8 @@ test httpold-3.3 {http_get} { " set tail /a/b/c -set url [info hostname]:$port/a/b/c -set binurl [info hostname]:$port/binary +set url ${::HOST}:$port/a/b/c +set binurl ${::HOST}:$port/binary test httpold-3.4 {http_get} { set token [http_get $url] @@ -108,7 +115,7 @@ test httpold-3.4 {http_get} { proc selfproxy {host} { global port - return [list [info hostname] $port] + return [list ${::HOST} $port] } test httpold-3.5 {http_get} { http_config -proxyfilter selfproxy @@ -273,7 +280,7 @@ test httpold-5.3 {http_formatQuery} { test httpold-6.1 {httpProxyRequired} { update - http_config -proxyhost [info hostname] -proxyport $port + http_config -proxyhost ${::HOST} -proxyport $port set token [http_get $url] http_wait $token http_config -proxyhost {} -proxyport {} -- cgit v0.12 From 735ca3d3a8dcc3e70c02259043f55853c0ac909c Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 3 Aug 2017 14:39:59 +0000 Subject: Improved test http-4.16. --- tests/http.test | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/http.test b/tests/http.test index c2d2fe8..5a00cd5 100644 --- a/tests/http.test +++ b/tests/http.test @@ -599,14 +599,20 @@ test http-4.15 {http::Event} -body { } -cleanup { catch {http::cleanup $token} } -returnCodes 1 -match glob -result "couldn't open socket*" -test http-4.16 {Leak with Close vs Keepalive (bug [6ca52aec14]} -body { +test http-4.16 {Leak with Close vs Keepalive (bug [6ca52aec14]} -setup { + proc list-difference {l1 l2} { + lmap item $l2 {if {$item in $l1} continue; set item} + } +} -body { set before [chan names] set token [http::geturl $url -headers {X-Connection keep-alive}] http::cleanup $token update - set after [chan names] - expr {$before eq $after} -} -result 1 + # Compute what channels have been unexpectedly leaked past cleanup + list-difference $before [chan names] +} -cleanup { + rename list-difference {} +} -result {} test http-5.1 {http::formatQuery} { http::formatQuery name1 value1 name2 "value two" -- cgit v0.12 From 664774bec4189d84722d2e34193bee298a883264 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 7 Aug 2017 01:16:39 +0000 Subject: [5bfe3de008]: Modify [source] to set input EOF character but not output EOF character. This avoids having ^Z being appended to the sourced file when it is an always-writable [tcl::chan::variable] in a custom VFS. Tested by adding this same change as a patch to Tcl 8.6.6 in KitCreator because that seems to be the easiest way to get custom VFS capability exposed as script commands. Original problem introduced by [03cdfc3a86] 2000-05-11 00:16:52. --- generic/tclIOUtil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index ea407ab..2c389c6 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -1764,7 +1764,7 @@ Tcl_FSEvalFileEx( * this cross-platform to allow for scripted documents. [Bug: 2040] */ - Tcl_SetChannelOption(interp, chan, "-eofchar", "\32"); + Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}"); /* * If the encoding is specified, set it for the channel. Else don't touch @@ -1899,7 +1899,7 @@ TclNREvalFile( * this cross-platform to allow for scripted documents. [Bug: 2040] */ - Tcl_SetChannelOption(interp, chan, "-eofchar", "\32"); + Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}"); /* * If the encoding is specified, set it for the channel. Else don't touch -- cgit v0.12 From ac8ddf5d4a977a1478ab350831d4f8b69e7e6815 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 8 Aug 2017 16:42:05 +0000 Subject: Cherrypick [527d354828] --- generic/tclIOUtil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index e00b9ac..41e218f 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -1762,7 +1762,7 @@ Tcl_FSEvalFileEx( * this cross-platform to allow for scripted documents. [Bug: 2040] */ - Tcl_SetChannelOption(interp, chan, "-eofchar", "\32"); + Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}"); /* * If the encoding is specified, set it for the channel. Else don't touch @@ -1896,7 +1896,7 @@ TclNREvalFile( * this cross-platform to allow for scripted documents. [Bug: 2040] */ - Tcl_SetChannelOption(interp, chan, "-eofchar", "\32"); + Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}"); /* * If the encoding is specified, set it for the channel. Else don't touch -- cgit v0.12 From df9ea61fbf40259ce8a70adecc6b7fc7f005bccf Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 8 Aug 2017 16:45:47 +0000 Subject: Cherrypick [527d354828] --- generic/tclIOUtil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index e1c5709..6465931 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -1805,7 +1805,7 @@ Tcl_FSEvalFileEx( * this cross-platform to allow for scripted documents. [Bug: 2040] */ - Tcl_SetChannelOption(interp, chan, "-eofchar", "\32"); + Tcl_SetChannelOption(interp, chan, "-eofchar", "\32 {}"); /* * If the encoding is specified, set it for the channel. Else don't touch -- cgit v0.12 From 3a07a6d26f93710a5646437820805ecf6f31a4a3 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 9 Aug 2017 14:41:19 +0000 Subject: bump release date --- changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes b/changes index ba780e8..f98eafc 100644 --- a/changes +++ b/changes @@ -8794,4 +8794,4 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans) ---- Released 8.6.7, August 4, 2017 --- http://core.tcl.tk/tcl/ for details +--- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From c2982f8f62f8b7e7faf9e500f53dca8941299548 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 13:28:48 +0000 Subject: Silence compiler warning in --disable-threads build --- generic/tclIORChan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c index f476a1a..e862761 100644 --- a/generic/tclIORChan.c +++ b/generic/tclIORChan.c @@ -41,6 +41,8 @@ static void ReflectWatch(ClientData clientData, int mask); static int ReflectBlock(ClientData clientData, int mode); #ifdef TCL_THREADS static void ReflectThread(ClientData clientData, int action); +static int ReflectEventRun(Tcl_Event *ev, int flags); +static int ReflectEventDelete(Tcl_Event *ev, ClientData cd); #endif static Tcl_WideInt ReflectSeekWide(ClientData clientData, Tcl_WideInt offset, int mode, int *errorCodePtr); @@ -748,6 +750,7 @@ TclChanCreateObjCmd( *---------------------------------------------------------------------- */ +#ifdef TCL_THREADS typedef struct ReflectEvent { Tcl_Event header; ReflectedChannel *rcPtr; @@ -791,6 +794,7 @@ ReflectEventDelete( } return 1; } +#endif int TclChanPostEventObjCmd( -- cgit v0.12 From 4056a4dc4bbe87b4b26e7d049093363a9926eddf Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 14:29:11 +0000 Subject: Release candidate branch for Tcl 8.7a1. --- README | 2 +- generic/tcl.h | 4 ++-- library/init.tcl | 2 +- unix/configure | 2 +- unix/configure.ac | 2 +- win/configure | 2 +- win/configure.ac | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README b/README index aab0db5..59de34d 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ README: Tcl - This is the Tcl 8.7a0 source distribution. + This is the Tcl 8.7a1 source distribution. http://sourceforge.net/projects/tcl/files/Tcl/ You can get any source release of Tcl from the URL above. diff --git a/generic/tcl.h b/generic/tcl.h index 6fa26f9..2e9d60a 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -55,10 +55,10 @@ extern "C" { #define TCL_MAJOR_VERSION 8 #define TCL_MINOR_VERSION 7 #define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE -#define TCL_RELEASE_SERIAL 0 +#define TCL_RELEASE_SERIAL 1 #define TCL_VERSION "8.7" -#define TCL_PATCH_LEVEL "8.7a0" +#define TCL_PATCH_LEVEL "8.7a1" #if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED) /* diff --git a/library/init.tcl b/library/init.tcl index ece1e44..b6e6e8b 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -16,7 +16,7 @@ if {[info commands package] == ""} { error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]" } -package require -exact Tcl 8.7a0 +package require -exact Tcl 8.7a1 # Compute the auto path to use in this interpreter. # The values on the path come from several locations: diff --git a/unix/configure b/unix/configure index a9132b57..0b22a43 100755 --- a/unix/configure +++ b/unix/configure @@ -2325,7 +2325,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a0" +TCL_PATCH_LEVEL="a1" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/configure.ac b/unix/configure.ac index b43da6d..d7aa50f 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -25,7 +25,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a0" +TCL_PATCH_LEVEL="a1" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/win/configure b/win/configure index d0431cb..a47ff23 100755 --- a/win/configure +++ b/win/configure @@ -2102,7 +2102,7 @@ SHELL=/bin/sh TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a0" +TCL_PATCH_LEVEL="a1" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 diff --git a/win/configure.ac b/win/configure.ac index 2821bc3..e32dadc 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -14,7 +14,7 @@ SHELL=/bin/sh TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a0" +TCL_PATCH_LEVEL="a1" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 -- cgit v0.12 From aedd652645c9955f187e0781742cb1d779143b7a Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 14:56:23 +0000 Subject: Bring changes up to the 8.6.7 release. --- changes | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/changes b/changes index 1e24269..f98eafc 100644 --- a/changes +++ b/changes @@ -8624,3 +8624,174 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2016-02-22 (bug)[9b4702] [info exists env(missing)] kills trace (nijtmans) --- Released 8.6.5, February 29, 2016 --- http://core.tcl.tk/tcl/ for details + +2016-03-01 (bug)[803042] mem leak due to reference cycle (porter) + +2016-03-08 (bug)[bbc304] reflected watch race condition (porter) + +2016-03-17 (bug)[fadc99] compile-5.3 (rodriguez,porter) + +2016-03-17 (enhancement)[1a25fd] compile [variable ${ns}::v] (porter) + +2016-03-20 (bug)[1af8de] crash in compiled [string replace] (harder,fellows) + +2016-03-21 (bug)[d30718] segv in notifier finalize (hirofumi,nijtmans) + +2016-03-23 (enhancement)[7d0db7] parallel make (yarda,nijtmans) + +2016-03-23 [f12535] enable test bindings customization (vogel,nijtmans) + +2016-04-04 (bug)[47ac84] compiled [lreplace] fixes (aspect,ferrieux,fellows) + *** POTENTIAL INCOMPATIBILITY *** + +2016-04-08 (bug)[866368] RE \w includes 'Punctuation Connector' (nijtmans) + +2016-04-08 (bug)[2538f3] Win crash Tcl_OpenTcpServer() (griffin) + +2016-04-10 [07d13d] Restore TclBlend support lost in 8.6.1 (buratti) + +2016-05-13 (bug)[3154ea] Mem corruption in assembler exceptions (tkob,kenny) + +2016-05-13 (bug) registry package support any Unicode env (nijtmans) +=> registry 1.3.2 + +2016-05-21 (bug)[f7d4e] [namespace delete] performance (fellows) + +2016-06-02 (TIP 447) execution time verbosity option (cerutti) +=> tcltest 2.4.0 + +2016-06-16 (bug)[16828b] crash due to [vwait] trace undo fail (dah,porter) + +2016-06-16 (enhancement)[4b61af] good [info frame] from more cases (beric) + +2016-06-21 (bug)[c383eb] crash in [glob -path a] (oehlmann,porter) + +2016-06-21 (update) Update Unicode data to 9.0 (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2016-06-22 (bug)[16896d] Tcl_DString tolerate append to self. (dah,porter) + +2016-06-23 (bug)[d55322] crash in [dict update] (yorick,fellows) + +2016-06-27 (bug)[dd260a] crash in [chan configure -dictionary] (madden,aspect) + +2016-07-02 (bug)[f961d7] usage message with parameters with spaces (porter) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-02 (enhancement)[09fabc] Sort order of -relateddir (lanam) + +2016-07-07 (bug)[5d7ca0] Win: [file executable] for .cmd and .ps1 (nadkarni) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-08 (bug)[a47641] [file normalize] & Windows junctions (nadkarni) + +2016-07-09 [ae61a6] [file] handling of Win hardcoded names (CON) (nadkarni) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-09 [3613671] [file owned] (more) useful on Win (nadkarni) + +2016-07-09 (bug)[1493a4] [namespace upvar] use of resolvers (beric,fellows) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-10 (bug)[da340d] integer division in clock math (nadkarni) + +2016-07-20 tzdata updated to Olson's tzdata2016f (venkat) + +--- Released 8.6.6, July 27, 2016 --- http://core.tcl.tk/tcl/ for details + +2016-09-07 (bug)[c09edf] Bad caching with custom resolver (neumann,nijtmans) + +2016-09-07 (bug)[4dbdd9] Memleak in test var-8.3 (mr_calvin,porter) + +2016-10-03 (bug)[2bf561] Allow empty command as alias target (yorick,nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2016-10-04 (bug)[4d5ae7] Crash in async connects host no address (gahr,fellows) + +2016-10-08 (bug)[838e99] treat application/xml as text (gahr,fellows) +=> http 2.8.10 + +2016-10-11 (bug)[3cc1d9] Thread finalization crash in zippy (neumann) + +2016-10-12 (bug)[be003d] Fix [scan 0x1 %b], [scan 0x1 %o] (porter) + +2016-10-14 (bug)[eb6b68] Fix stringComp-14.5 (porter) + +2016-10-30 (bug)[b26e38] Fix zlib-7.8 (fellows) + +2016-10-30 (bug)[1ae129] Fix memleak in [history] destruction (fellows) + +2016-11-04 (feature) Provisional Tcl 9 support in msgcat and tcltest (nijtmans) +=> msgcat 1.6.1 +=> tcltest 2.4.1 + +2016-11-04 (bug)[824752] Crash in Tcl_ListObjReplace() (gahr,porter) + +2016-11-11 (bug)[79614f] invalidate VFS mounts on sytem encoding change (yorick) + +2016-11-14 OSX: End panic() as legacy support macro; system conflicts (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2016-11-15 (bug) TclOO fix stops crash mixing Itcl and snit (fellows) + +2016-11-17 (update) Reconcile libtommath updates; purge unused files (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-01-09 (bug)[b87ad7] Repair drifts in timer clock (sebres) + +2017-01-17 (update) => zlib 1.2.11 (nijtmans) + +2017-01-31 (bug)[39f630] Revise Tcl_LinkVar to tolerate some prefixes (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-02-01 (bug)[d0f7ba] Improper NAN optimization. expr-22.1[01] (aspect) + +2017-02-26 (bug)[25842c] zlib stream finalization (aspect) + +2017-03-07 (deprecate) Remove unmaintained makefile.bc file (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-03-14 (enhancement) [clock] and [encoding] are now ensembles (kenny) + +2017-03-15 (enhancement) several [clock] subcommands bytecoded (kenny) + +2017-03-23 tzdata updated to Olson's tzdata2017b (jima) + +2017-03-29 (bug)[900cb0] Fix OO unexport introspection (napier) + +2017-04-12 (bug)[42202b] Nesting imbalance in coro injection (nadkarni,sebres) + +2017-04-18 (bug)[bc4322] http package support for safe interps (nash,nijtmans) + +2017-04-28 (bug)[f34cf8] [file join a //b] => /b (neumann,porter) + +2017-05-01 (bug)[8bd13f] Windows threads and pipes (sebres,nijtmans) + +2017-05-01 (bug)[f9fe90] [file join //a b] EIAS violation (aspect,porter) + +2017-05-04 (bug) Make test filesystem-1.52 pass on Windows (nijtmans) + +2017-05-05 (bug)[601522] [binary] field spec overflow -> segfault (porter) + +2017-05-08 (bug)[6ca52a] http memleak handling keep-alive (aspect,nijtmans) +=> http 2.8.11 + +2017-05-29 (bug)[a3fb33] crash in [lsort] on long lists (sebres) + +2017-06-05 (bug)[67aa9a] Tcl_UtfToUniChar() revised handling invalid UTF-8 (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-06-08 (bug)[2738427] Tcl_NumUtfChars() corner case utf-4.9 (nijtmans) + +2017-06-22 (update) Update Unicode data to 10.0 (nijtmans) + *** POTENTIAL INCOMPATIBILITY *** + +2017-06-22 (TIP 473) Let [oo::copy] specify target namespace (fellows) + +2017-06-26 (bug)[46f801] Repair autoloader fragility (porter) + +2017-07-06 (bug)[adb198] Plug memleak in TclJoinPath (sebres,porter) + +2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans) + +--- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 8ccd8d10efecf3891466ee0df15700557ee170aa Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 17:03:53 +0000 Subject: Backport [array names -regexp] should support backrefs --- generic/tclRegexp.c | 15 +++++++++++---- tests/set-old.test | 7 +++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index ea25d4b..cfe6388 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -502,10 +502,17 @@ Tcl_RegExpMatchObj( { Tcl_RegExp re; - re = Tcl_GetRegExpFromObj(interp, patternObj, - TCL_REG_ADVANCED | TCL_REG_NOSUB); - if (re == NULL) { - return -1; + /* + * For performance reasons, first try compiling the RE without support for + * subexpressions. On failure, try again without TCL_REG_NOSUB in case the + * RE has backreferences in it. Closely related to [Bug 1366683]. If this + * still fails, an error message will be left in the interpreter. + */ + + if (!(re = Tcl_GetRegExpFromObj(interp, patternObj, + TCL_REG_ADVANCED | TCL_REG_NOSUB)) + && !(re = Tcl_GetRegExpFromObj(interp, patternObj, TCL_REG_ADVANCED))) { + return -1; } return Tcl_RegExpExecObj(interp, re, textObj, 0 /* offset */, 0 /* nmatches */, 0 /* flags */); diff --git a/tests/set-old.test b/tests/set-old.test index 1c68f91..6138ed8 100644 --- a/tests/set-old.test +++ b/tests/set-old.test @@ -652,6 +652,13 @@ test set-old-8.52 {array command, array names -regexp on regexp pattern} { set a(11) 1 list [catch {lsort [array names a -regexp ^1]} msg] $msg } {0 {1*2 11 12}} +test set-old-8.52.1 {array command, array names -regexp, backrefs} { + catch {unset a} + set a(1*2) 1 + set a(12) 1 + set a(11) 1 + list [catch {lsort [array names a -regexp {^(.)\1}]} msg] $msg +} {0 11} test set-old-8.53 {array command, array names -regexp} { catch {unset a} set a(-glob) 1 -- cgit v0.12 From 0079285837943ef6dba9184388378b2e3987a0d8 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 17:34:31 +0000 Subject: Update outdated comment. --- generic/tclPkg.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 3b0554a..eb4dc9b 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -331,8 +331,8 @@ Tcl_PkgRequireEx( * * Second, how does this work? If we reach this point, then the global * variable tclEmptyStringRep has the value NULL. Compare that with - * the definition of tclEmptyStringRep near the top of the file - * generic/tclObj.c. It clearly should not have the value NULL; it + * the definition of tclEmptyStringRep near the top of this file. + * It clearly should not have the value NULL; it * should point to the char tclEmptyString. If we see it having the * value NULL, then somehow we are seeing a Tcl library that isn't * completely initialized, and that's an indicator for the error @@ -348,18 +348,11 @@ Tcl_PkgRequireEx( * After all, two Tcl libraries can't be a good thing!) * * Trouble is that's going to be tricky. We're now using a Tcl library - * that's not fully initialized. In particular, it doesn't have a - * proper value for tclEmptyStringRep. The Tcl_Obj system heavily - * depends on the value of tclEmptyStringRep and all of Tcl depends - * (increasingly) on the Tcl_Obj system, we need to correct that flaw - * before making the calls to set the interpreter result to the error - * message. That's the only flaw corrected; other problems with - * initialization of the Tcl library are not remedied, so be very - * careful about adding any other calls here without checking how they - * behave when initialization is incomplete. + * that's not fully initialized. Functions in it may not work + * reliably, so be very careful about adding any other calls here + * without checking how they behave when initialization is incomplete. */ - tclEmptyStringRep = &tclEmptyString; Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Cannot load package \"%s\" in standalone executable:" " This package is not compiled with stub support", name)); -- cgit v0.12 From ad9bc7297d7fbdfb62825ee3d15a4197d45e3581 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 10 Aug 2017 19:14:15 +0000 Subject: Add 8.7 -only changes to the changes file. --- changes | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/changes b/changes index f98eafc..7b035fb 100644 --- a/changes +++ b/changes @@ -8795,3 +8795,44 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans) --- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details + +2016-03-17 (bug)[0b8c38] socket accept callbacks always in global ns (porter) + *** POTENTIAL INCOMPATIBILITY *** + +2016-07-01 Hack accommodations for legacy Itcl 3 disabled (porter) + +2016-07-12 Make TCL_HASH_TYPE build-time configurable (nijtmans) + +2016-07-19 (bug)[0363f0] Partial array search ID reform (porter) + +2016-07-19 (feature removed) Tcl_ObjType "array search" unregistered (porter) + *** POTENTIAL INCOMPATIBILITY for Tcl_GetObjType("array search") *** + +2016-10-04 Server socket on port 0 chooses port supporting IPv4 * IPv6 (max) + +2016-11-25 [array named -regexp] supports backrefs (goth) + +2017-01-04 (TIP 456) New routine Tcl_OpenTcpServerEx() (limeboy) + +2017-01-04 (TIP 459) New subcommand [package files] (nijtmans) + +2017-01-16 threaded allocator initialization repair (vasiljevic,nijtmans) + +2017-01-30 Add to Win shell builtins: assoc ftype move (ashok) + +2017-03-31 TCL_MEM_DEBUG facilities better support 64-bit memory (nijtmans) + +2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans) + +2017-05-18 (TIP 458) New epoll or kqueue notifiers are default (alborboz) + +2017-05-31 Purge build support for SunOS-4.* (stu) + +2017-06-22 (TIP 463) New option [regsub ... -command ...] (fellows) + +2017-06-22 (TIP 470) Tcl_GetDefineContextObject();[oo::define [self]] (fellows) +=> TclOO 1.2.0 + +2017-06-23 (TIP 472) Support 0d as prefix of decimal numbers (iyer,griffin) + +--- Released 8.7a1, August ??, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 89ce4defb5b763401e065965a4ac97af98fd778f Mon Sep 17 00:00:00 2001 From: andy Date: Sat, 12 Aug 2017 19:45:04 +0000 Subject: Correct longstanding typo in continue man page --- doc/continue.n | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/continue.n b/doc/continue.n index 92ff3b4..5eca861 100644 --- a/doc/continue.n +++ b/doc/continue.n @@ -23,7 +23,7 @@ exception to occur. The exception causes the current script to be aborted out to the innermost containing loop command, which then continues with the next iteration of the loop. -Catch exceptions are also handled in a few other situations, such +Continue exceptions are also handled in a few other situations, such as the \fBcatch\fR command and the outermost scripts of procedure bodies. .SH EXAMPLE -- cgit v0.12 From 89fcfadbbf83d652f1b96cc79c64785b55dba97b Mon Sep 17 00:00:00 2001 From: Joe Mistachkin Date: Sun, 13 Aug 2017 22:05:25 +0000 Subject: Support cross-compiling Tcl for 'Win32 on ARM' using Visual Studio. --- generic/tclPanic.c | 2 +- win/makefile.vc | 11 +++++++++-- win/tclWin32Dll.c | 4 ++-- win/tclWinFile.c | 2 +- win/tclWinSock.c | 3 +-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/generic/tclPanic.c b/generic/tclPanic.c index b032449..b03ad41 100644 --- a/generic/tclPanic.c +++ b/generic/tclPanic.c @@ -111,7 +111,7 @@ Tcl_PanicVA( __builtin_trap(); # elif defined(_WIN64) __debugbreak(); -# elif defined(_MSC_VER) +# elif defined(_MSC_VER) && defined (_M_IX86) _asm {int 3} # else DebugBreak(); diff --git a/win/makefile.vc b/win/makefile.vc index ada08cc..40de392 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -121,7 +121,7 @@ the build instructions. # nodep = Turns off compatibility macros to ensure the core # isn't being built with deprecated functions. # -# MACHINE=(ALPHA|AMD64|IA64|IX86) +# MACHINE=(ARM|AMD64|IA64|IX86) # Set the machine type used for the compiler, linker, and # resource compiler. This hook is needed to tell the tools # when alternate platforms are requested. IX86 is the default @@ -484,9 +484,16 @@ cdebug = -Zi -Od $(DEBUGFLAGS) cdebug = -Zi -WX $(DEBUGFLAGS) !endif +### Common compiler options that are architecture specific +!if "$(MACHINE)" == "ARM" +carch = -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE +!else +carch = +!endif + ### Declarations common to all compiler options cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE -cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ +cflags = -nologo -c $(COMPILERFLAGS) $(carch) $(cwarn) -Fp$(TMP_DIR)^\ !if $(MSVCRT) !if $(DEBUG) && !$(UNCHECKED) diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 688fa8d..84c7a97 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -29,7 +29,7 @@ static int platformId; /* Running under NT, or 95/98? */ * VC++ 5.x has no 'cpuid' assembler instruction, so we must emulate it */ -#if defined(_MSC_VER) && (_MSC_VER <= 1100) +#if defined(_MSC_VER) && (_MSC_VER <= 1100) && defined (_M_IX86) #define cpuid __asm __emit 0fh __asm __emit 0a2h #endif @@ -735,7 +735,7 @@ TclWinCPUID( __cpuid(regsPtr, index); status = TCL_OK; -# else +# elif defined (_M_IX86) /* * Define a structure in the stack frame to hold the registers. */ diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 6662327..7586af1 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -828,7 +828,7 @@ tclWinDebugPanic( __builtin_trap(); #elif defined(_WIN64) __debugbreak(); -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && defined (_M_IX86) _asm {int 3} #else DebugBreak(); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index da2e60a..3799d98 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -1426,8 +1426,7 @@ TcpGetOptionProc( flags |= NI_NUMERICHOST; } } else if (sockname.sa.sa_family == AF_INET6) { - if ((IN6_ARE_ADDR_EQUAL(&sockname.sa6.sin6_addr, - &in6addr_any)) || + if (IN6_IS_ADDR_UNSPECIFIED(&sockname.sa6.sin6_addr) || (IN6_IS_ADDR_V4MAPPED(&sockname.sa6.sin6_addr) && sockname.sa6.sin6_addr.s6_addr[12] == 0 && sockname.sa6.sin6_addr.s6_addr[13] == 0 -- cgit v0.12 From e513ec3916cba76725b5fe3f2e4f5d24f449f853 Mon Sep 17 00:00:00 2001 From: Joe Mistachkin Date: Sun, 13 Aug 2017 22:15:30 +0000 Subject: Always define '_USING_V110_SDK71_', in case targeting the pre-Windows 8.x SDKs. --- win/rules.vc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/rules.vc b/win/rules.vc index 4a3ae26..979fb14 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -159,7 +159,7 @@ DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 DEBUGFLAGS = $(DEBUGFLAGS) -GZ !endif -COMPILERFLAGS =-W3 /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING +COMPILERFLAGS =-W3 -DUNICODE -D_UNICODE -D_USING_V110_SDK71_ -D_ATL_XP_TARGETING # In v13 -GL and -YX are incompatible. !if [nmakehlp -c -YX] -- cgit v0.12 From a50a381b04b28ae816afcf275f5ca42c30633604 Mon Sep 17 00:00:00 2001 From: Joe Mistachkin Date: Sun, 13 Aug 2017 22:31:19 +0000 Subject: The 'clean' target should delete the generated 'nmhlp-out.txt' file as well. --- win/makefile.vc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/win/makefile.vc b/win/makefile.vc index 40de392..e0d8d9d 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -1229,6 +1229,8 @@ clean: clean-pkgs @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj @echo Cleaning $(WINDIR)\nmakehlp.exe ... @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe + @echo Cleaning $(WINDIR)\nmhlp-out.txt ... + @if exist $(WINDIR)\nmhlp-out.txt del $(WINDIR)\nmhlp-out.txt @echo Cleaning $(WINDIR)\_junk.pch ... @if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch @echo Cleaning $(WINDIR)\vercl.x ... -- cgit v0.12 From 277f101d7f3257acf31bc529b97cde31d3179761 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 14 Aug 2017 15:33:03 +0000 Subject: [f2336c116b] Move pragmas to make gcc happy; it is pickier than clang. --- unix/tclUnixSock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index b9b6b53..2f1a78e 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -700,6 +700,8 @@ TcpClose2Proc( */ #ifndef NEED_FAKE_RFC2553 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstrict-aliasing" static inline int IPv6AddressNeedsNumericRendering( struct in6_addr addr) @@ -713,16 +715,14 @@ IPv6AddressNeedsNumericRendering( * at least some versions of OSX. */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstrict-aliasing" if (!IN6_IS_ADDR_V4MAPPED(&addr)) { -#pragma GCC diagnostic pop return 0; } return (addr.s6_addr[12] == 0 && addr.s6_addr[13] == 0 && addr.s6_addr[14] == 0 && addr.s6_addr[15] == 0); } +#pragma GCC diagnostic pop #endif /* NEED_FAKE_RFC2553 */ static void -- cgit v0.12 From c86a23de04031e905caf60b8b28dfeed64b8ba5f Mon Sep 17 00:00:00 2001 From: "f.bonnet" Date: Thu, 17 Aug 2017 13:02:27 +0000 Subject: Basic scaffolding for tcl::process --- generic/tclBasic.c | 1 + generic/tclInt.h | 1 + generic/tclProcess.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/process.test | 21 +++++++ unix/Makefile.in | 6 +- win/Makefile.in | 1 + win/buildall.vc.bat | 4 +- win/makefile.vc | 1 + win/tcl.dsp | 4 ++ 9 files changed, 212 insertions(+), 2 deletions(-) create mode 100644 generic/tclProcess.c create mode 100644 tests/process.test diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 8e816a5..b4821ef 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -813,6 +813,7 @@ Tcl_CreateInterp(void) TclInitNamespaceCmd(interp); TclInitStringCmd(interp); TclInitPrefixCmd(interp); + TclInitProcessCmd(interp); /* * Register "clock" subcommands. These *do* go through diff --git a/generic/tclInt.h b/generic/tclInt.h index 1fbc541..ce6cc1c 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3414,6 +3414,7 @@ MODULE_SCOPE int Tcl_PidObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE Tcl_Command TclInitPrefixCmd(Tcl_Interp *interp); +MODULE_SCOPE Tcl_Command TclInitProcessCmd(Tcl_Interp *interp); MODULE_SCOPE int Tcl_PutsObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); diff --git a/generic/tclProcess.c b/generic/tclProcess.c new file mode 100644 index 0000000..3fcdacd --- /dev/null +++ b/generic/tclProcess.c @@ -0,0 +1,175 @@ +/* + * tclProcess.c -- + * + * This file implements the "tcl::process" ensemble for subprocess + * management as defined by TIP #462. + * + * Copyright (c) 2017 Frederic Bonnet. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + + #include "tclInt.h" + + /* + * Prototypes for functions defined later in this file: + */ + +static int ProcessListObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +static int ProcessStatusObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +static int ProcessPurgeObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +static int ProcessAutopurgeObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); + +/*---------------------------------------------------------------------- + * + * ProcessListObjCmd -- + * + * This function implements the 'tcl::process list' Tcl command. + * Refer to the user documentation for details on what it does. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None.TODO + * + *---------------------------------------------------------------------- + */ + + static int + ProcessListObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ + { + /* TODO */ + return TCL_ERROR; + } + +/*---------------------------------------------------------------------- + * + * ProcessStatusObjCmd -- + * + * This function implements the 'tcl::process status' Tcl command. + * Refer to the user documentation for details on what it does. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None.TODO + * + *---------------------------------------------------------------------- + */ + + static int + ProcessStatusObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ + { + /* TODO */ + return TCL_ERROR; + } + +/*---------------------------------------------------------------------- + * + * ProcessPurgeObjCmd -- + * + * This function implements the 'tcl::process purge' Tcl command. + * Refer to the user documentation for details on what it does. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None.TODO + * + *---------------------------------------------------------------------- + */ + + static int + ProcessPurgeObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ + { + /* TODO */ + return TCL_ERROR; + } + +/*---------------------------------------------------------------------- + * + * ProcessAutopurgeObjCmd -- + * + * This function implements the 'tcl::process autopurge' Tcl command. + * Refer to the user documentation for details on what it does. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None.TODO + * + *---------------------------------------------------------------------- + */ + + static int + ProcessAutopurgeObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ + { + /* TODO */ + return TCL_ERROR; + } + +/* + *---------------------------------------------------------------------- + * + * TclInitProcessCmd -- + * + * This procedure creates the "tcl::process" Tcl command. See the user + * documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + Tcl_Command + TclInitProcessCmd( + Tcl_Interp *interp) /* Current interpreter. */ + { + static const EnsembleImplMap processImplMap[] = { + {"list", ProcessListObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 1}, + {"status", ProcessStatusObjCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 1}, + {"purge", ProcessPurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1}, + {"autopurge", ProcessAutopurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1}, + {NULL, NULL, NULL, NULL, NULL, 0} + }; + Tcl_Command processCmd; + + processCmd = TclMakeEnsemble(interp, "::tcl::process", processImplMap); + Tcl_Export(interp, Tcl_FindNamespace(interp, "::tcl", NULL, 0), + "process", 0); + return processCmd; + } + \ No newline at end of file diff --git a/tests/process.test b/tests/process.test new file mode 100644 index 0000000..f3275c8 --- /dev/null +++ b/tests/process.test @@ -0,0 +1,21 @@ +# process.test -- +# +# This file contains a collection of tests for the tcl::process ensemble. +# Sourcing this file into Tcl runs the tests and generates output for +# errors. No output means no errors were found. +# +# Copyright (c) 2017 Frederic Bonnet +# See the file "license.terms" for information on usage and redistribution of +# this file, and for a DISCLAIMER OF ALL WARRANTIES. + +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest 2 + namespace import -force ::tcltest::* +} + +test process-1.1 {tcl::process command basic syntax} -returnCodes error -body { + tcl::process +} -result {wrong # args: should be "tcl::process subcommand ?arg ...?"} +test process-1.2 {tcl::process command basic syntax} -returnCodes error -body { + tcl::process ? +} -match glob -result {unknown or ambiguous subcommand "?": must be autopurge, list, purge, or status} diff --git a/unix/Makefile.in b/unix/Makefile.in index c4f6136..25aa003 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -303,7 +303,7 @@ GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \ tclLiteral.o tclLoad.o tclMain.o tclNamesp.o tclNotify.o \ tclObj.o tclOptimize.o tclPanic.o tclParse.o tclPathObj.o tclPipe.o \ tclPkg.o tclPkgConfig.o tclPosixStr.o \ - tclPreserve.o tclProc.o tclRegexp.o \ + tclPreserve.o tclProc.o tclProcess.o tclRegexp.o \ tclResolve.o tclResult.o tclScan.o tclStringObj.o \ tclStrToD.o tclThread.o \ tclThreadAlloc.o tclThreadJoin.o tclThreadStorage.o tclStubInit.o \ @@ -444,6 +444,7 @@ GENERIC_SRCS = \ $(GENERIC_DIR)/tclPosixStr.c \ $(GENERIC_DIR)/tclPreserve.c \ $(GENERIC_DIR)/tclProc.c \ + $(GENERIC_DIR)/tclProcess.c \ $(GENERIC_DIR)/tclRegexp.c \ $(GENERIC_DIR)/tclResolve.c \ $(GENERIC_DIR)/tclResult.c \ @@ -1286,6 +1287,9 @@ tclPreserve.o: $(GENERIC_DIR)/tclPreserve.c tclProc.o: $(GENERIC_DIR)/tclProc.c $(COMPILEHDR) $(NREHDR) $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclProc.c +tclProcess.o: $(GENERIC_DIR)/tclProcess.c + $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclProcess.c + tclRegexp.o: $(GENERIC_DIR)/tclRegexp.c $(TCLREHDRS) $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclRegexp.c diff --git a/win/Makefile.in b/win/Makefile.in index e967ef3..ad8db34 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -285,6 +285,7 @@ GENERIC_OBJS = \ tclPosixStr.$(OBJEXT) \ tclPreserve.$(OBJEXT) \ tclProc.$(OBJEXT) \ + tclProcess.$(OBJEXT) \ tclRegexp.$(OBJEXT) \ tclResolve.$(OBJEXT) \ tclResult.$(OBJEXT) \ diff --git a/win/buildall.vc.bat b/win/buildall.vc.bat index deb9e39..cb136be 100644 --- a/win/buildall.vc.bat +++ b/win/buildall.vc.bat @@ -38,7 +38,9 @@ if defined WINDOWSSDKDIR (goto :startBuilding) :: might not be correct. You should call it yourself prior to running :: this batchfile. :: -call "C:\Program Files\Microsoft Developer Studio\vc98\bin\vcvars32.bat" +REM call "C:\Program Files\Microsoft Developer Studio\vc98\bin\vcvars32.bat" +set "VSCMD_START_DIR=%CD%" +call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" if errorlevel 1 (goto no_vcvars) :startBuilding diff --git a/win/makefile.vc b/win/makefile.vc index d6de5e1..bdc8511 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -327,6 +327,7 @@ COREOBJS = \ $(TMP_DIR)\tclPosixStr.obj \ $(TMP_DIR)\tclPreserve.obj \ $(TMP_DIR)\tclProc.obj \ + $(TMP_DIR)\tclProcess.obj \ $(TMP_DIR)\tclRegexp.obj \ $(TMP_DIR)\tclResolve.obj \ $(TMP_DIR)\tclResult.obj \ diff --git a/win/tcl.dsp b/win/tcl.dsp index 48eae9d..e3873a3 100644 --- a/win/tcl.dsp +++ b/win/tcl.dsp @@ -1268,6 +1268,10 @@ SOURCE=..\generic\tclProc.c # End Source File # Begin Source File +SOURCE=..\generic\tclProcess.c +# End Source File +# Begin Source File + SOURCE=..\generic\tclRegexp.c # End Source File # Begin Source File -- cgit v0.12 From 0b8e964f45cff8228e6e64598b7f7f80060aa345 Mon Sep 17 00:00:00 2001 From: "f.bonnet" Date: Thu, 17 Aug 2017 13:03:48 +0000 Subject: Fixed line endings --- generic/tclProcess.c | 348 +++++++++++++++++++++++++-------------------------- tests/process.test | 42 +++---- 2 files changed, 195 insertions(+), 195 deletions(-) diff --git a/generic/tclProcess.c b/generic/tclProcess.c index 3fcdacd..516d0d7 100644 --- a/generic/tclProcess.c +++ b/generic/tclProcess.c @@ -1,175 +1,175 @@ -/* - * tclProcess.c -- - * - * This file implements the "tcl::process" ensemble for subprocess - * management as defined by TIP #462. - * - * Copyright (c) 2017 Frederic Bonnet. - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ - - #include "tclInt.h" - - /* - * Prototypes for functions defined later in this file: - */ - -static int ProcessListObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int ProcessStatusObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int ProcessPurgeObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int ProcessAutopurgeObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); - -/*---------------------------------------------------------------------- - * - * ProcessListObjCmd -- - * - * This function implements the 'tcl::process list' Tcl command. - * Refer to the user documentation for details on what it does. - * - * Results: - * Returns a standard Tcl result. - * - * Side effects: - * None.TODO - * - *---------------------------------------------------------------------- - */ - - static int - ProcessListObjCmd( - ClientData clientData, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ - { - /* TODO */ - return TCL_ERROR; - } - -/*---------------------------------------------------------------------- - * - * ProcessStatusObjCmd -- - * - * This function implements the 'tcl::process status' Tcl command. - * Refer to the user documentation for details on what it does. - * - * Results: - * Returns a standard Tcl result. - * - * Side effects: - * None.TODO - * - *---------------------------------------------------------------------- - */ - - static int - ProcessStatusObjCmd( - ClientData clientData, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ - { - /* TODO */ - return TCL_ERROR; - } - -/*---------------------------------------------------------------------- - * - * ProcessPurgeObjCmd -- - * - * This function implements the 'tcl::process purge' Tcl command. - * Refer to the user documentation for details on what it does. - * - * Results: - * Returns a standard Tcl result. - * - * Side effects: - * None.TODO - * - *---------------------------------------------------------------------- - */ - - static int - ProcessPurgeObjCmd( - ClientData clientData, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ - { - /* TODO */ - return TCL_ERROR; - } - -/*---------------------------------------------------------------------- - * - * ProcessAutopurgeObjCmd -- - * - * This function implements the 'tcl::process autopurge' Tcl command. - * Refer to the user documentation for details on what it does. - * - * Results: - * Returns a standard Tcl result. - * - * Side effects: - * None.TODO - * - *---------------------------------------------------------------------- - */ - - static int - ProcessAutopurgeObjCmd( - ClientData clientData, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ - { - /* TODO */ - return TCL_ERROR; - } - -/* - *---------------------------------------------------------------------- - * - * TclInitProcessCmd -- - * - * This procedure creates the "tcl::process" Tcl command. See the user - * documentation for details on what it does. - * - * Results: - * A standard Tcl result. - * - * Side effects: - * See the user documentation. - * - *---------------------------------------------------------------------- - */ - - Tcl_Command - TclInitProcessCmd( - Tcl_Interp *interp) /* Current interpreter. */ - { - static const EnsembleImplMap processImplMap[] = { - {"list", ProcessListObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 1}, - {"status", ProcessStatusObjCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 1}, - {"purge", ProcessPurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1}, - {"autopurge", ProcessAutopurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1}, - {NULL, NULL, NULL, NULL, NULL, 0} - }; - Tcl_Command processCmd; - - processCmd = TclMakeEnsemble(interp, "::tcl::process", processImplMap); - Tcl_Export(interp, Tcl_FindNamespace(interp, "::tcl", NULL, 0), - "process", 0); - return processCmd; - } +/* + * tclProcess.c -- + * + * This file implements the "tcl::process" ensemble for subprocess + * management as defined by TIP #462. + * + * Copyright (c) 2017 Frederic Bonnet. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + + #include "tclInt.h" + + /* + * Prototypes for functions defined later in this file: + */ + +static int ProcessListObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +static int ProcessStatusObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +static int ProcessPurgeObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +static int ProcessAutopurgeObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); + +/*---------------------------------------------------------------------- + * + * ProcessListObjCmd -- + * + * This function implements the 'tcl::process list' Tcl command. + * Refer to the user documentation for details on what it does. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None.TODO + * + *---------------------------------------------------------------------- + */ + + static int + ProcessListObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ + { + /* TODO */ + return TCL_ERROR; + } + +/*---------------------------------------------------------------------- + * + * ProcessStatusObjCmd -- + * + * This function implements the 'tcl::process status' Tcl command. + * Refer to the user documentation for details on what it does. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None.TODO + * + *---------------------------------------------------------------------- + */ + + static int + ProcessStatusObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ + { + /* TODO */ + return TCL_ERROR; + } + +/*---------------------------------------------------------------------- + * + * ProcessPurgeObjCmd -- + * + * This function implements the 'tcl::process purge' Tcl command. + * Refer to the user documentation for details on what it does. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None.TODO + * + *---------------------------------------------------------------------- + */ + + static int + ProcessPurgeObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ + { + /* TODO */ + return TCL_ERROR; + } + +/*---------------------------------------------------------------------- + * + * ProcessAutopurgeObjCmd -- + * + * This function implements the 'tcl::process autopurge' Tcl command. + * Refer to the user documentation for details on what it does. + * + * Results: + * Returns a standard Tcl result. + * + * Side effects: + * None.TODO + * + *---------------------------------------------------------------------- + */ + + static int + ProcessAutopurgeObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ + { + /* TODO */ + return TCL_ERROR; + } + +/* + *---------------------------------------------------------------------- + * + * TclInitProcessCmd -- + * + * This procedure creates the "tcl::process" Tcl command. See the user + * documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * See the user documentation. + * + *---------------------------------------------------------------------- + */ + + Tcl_Command + TclInitProcessCmd( + Tcl_Interp *interp) /* Current interpreter. */ + { + static const EnsembleImplMap processImplMap[] = { + {"list", ProcessListObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 1}, + {"status", ProcessStatusObjCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 1}, + {"purge", ProcessPurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1}, + {"autopurge", ProcessAutopurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1}, + {NULL, NULL, NULL, NULL, NULL, 0} + }; + Tcl_Command processCmd; + + processCmd = TclMakeEnsemble(interp, "::tcl::process", processImplMap); + Tcl_Export(interp, Tcl_FindNamespace(interp, "::tcl", NULL, 0), + "process", 0); + return processCmd; + } \ No newline at end of file diff --git a/tests/process.test b/tests/process.test index f3275c8..cef3adc 100644 --- a/tests/process.test +++ b/tests/process.test @@ -1,21 +1,21 @@ -# process.test -- -# -# This file contains a collection of tests for the tcl::process ensemble. -# Sourcing this file into Tcl runs the tests and generates output for -# errors. No output means no errors were found. -# -# Copyright (c) 2017 Frederic Bonnet -# See the file "license.terms" for information on usage and redistribution of -# this file, and for a DISCLAIMER OF ALL WARRANTIES. - -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest 2 - namespace import -force ::tcltest::* -} - -test process-1.1 {tcl::process command basic syntax} -returnCodes error -body { - tcl::process -} -result {wrong # args: should be "tcl::process subcommand ?arg ...?"} -test process-1.2 {tcl::process command basic syntax} -returnCodes error -body { - tcl::process ? -} -match glob -result {unknown or ambiguous subcommand "?": must be autopurge, list, purge, or status} +# process.test -- +# +# This file contains a collection of tests for the tcl::process ensemble. +# Sourcing this file into Tcl runs the tests and generates output for +# errors. No output means no errors were found. +# +# Copyright (c) 2017 Frederic Bonnet +# See the file "license.terms" for information on usage and redistribution of +# this file, and for a DISCLAIMER OF ALL WARRANTIES. + +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest 2 + namespace import -force ::tcltest::* +} + +test process-1.1 {tcl::process command basic syntax} -returnCodes error -body { + tcl::process +} -result {wrong # args: should be "tcl::process subcommand ?arg ...?"} +test process-1.2 {tcl::process command basic syntax} -returnCodes error -body { + tcl::process ? +} -match glob -result {unknown or ambiguous subcommand "?": must be autopurge, list, purge, or status} -- cgit v0.12 From 13d9910fd618b60dd7ea07505a0318fe06581469 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 17 Aug 2017 21:52:42 +0000 Subject: '#if' -> '#ifdef' in tclUnixPort.h. Suggested by Gustaf Neumann. Reduces the number of gcc warnings, when compiling Tcl with -Wundef. Harmless. --- unix/tclUnixPort.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 2728957..ba56089 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -125,11 +125,11 @@ typedef off_t Tcl_SeekOffset; # include #endif #include -#if TIME_WITH_SYS_TIME +#ifdef TIME_WITH_SYS_TIME # include # include #else -#if HAVE_SYS_TIME_H +#ifdef HAVE_SYS_TIME_H # include #else # include @@ -138,11 +138,11 @@ typedef off_t Tcl_SeekOffset; #ifndef NO_SYS_WAIT_H # include #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H # include #endif #include -#if HAVE_STDINT_H +#ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H -- cgit v0.12 From 5aaef06572dc90a7a493d187959fe9829da27fbb Mon Sep 17 00:00:00 2001 From: "f.bonnet" Date: Fri, 18 Aug 2017 07:51:01 +0000 Subject: Added [tcl::process autopurge] flag management with TclProcessGetAutopurge/TclProcessSetAutopurge companion functions. --- generic/tclInt.h | 9 ++- generic/tclProcess.c | 176 +++++++++++++++++++++++++++++++++++++-------------- tests/process.test | 10 +++ 3 files changed, 148 insertions(+), 47 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index ce6cc1c..a602e6c 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3414,7 +3414,6 @@ MODULE_SCOPE int Tcl_PidObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE Tcl_Command TclInitPrefixCmd(Tcl_Interp *interp); -MODULE_SCOPE Tcl_Command TclInitProcessCmd(Tcl_Interp *interp); MODULE_SCOPE int Tcl_PutsObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -4023,6 +4022,14 @@ MODULE_SCOPE TCL_HASH_TYPE TclHashObjKey(Tcl_HashTable *tablePtr, void *keyPtr); MODULE_SCOPE int TclFullFinalizationRequested(void); /* + * TIP #462. + */ + +MODULE_SCOPE Tcl_Command TclInitProcessCmd(Tcl_Interp *interp); +MODULE_SCOPE int TclProcessGetAutopurge(void); +MODULE_SCOPE void TclProcessSetAutopurge(int flag); + +/* *---------------------------------------------------------------- * Macros used by the Tcl core to create and release Tcl objects. * TclNewObj(objPtr) creates a new object denoting an empty string. diff --git a/generic/tclProcess.c b/generic/tclProcess.c index 516d0d7..23ba4de 100644 --- a/generic/tclProcess.c +++ b/generic/tclProcess.c @@ -10,7 +10,9 @@ * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ - #include "tclInt.h" +#include "tclInt.h" + +static int autopurge = 1; /* Autopurge flag. */ /* * Prototypes for functions defined later in this file: @@ -45,13 +47,18 @@ static int ProcessAutopurgeObjCmd(ClientData clientData, *---------------------------------------------------------------------- */ - static int - ProcessListObjCmd( - ClientData clientData, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ - { +static int +ProcessListObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ +{ + if (objc != 1) { + Tcl_WrongNumArgs(interp, 1, objv, NULL); + return TCL_ERROR; + } + /* TODO */ return TCL_ERROR; } @@ -72,13 +79,18 @@ static int ProcessAutopurgeObjCmd(ClientData clientData, *---------------------------------------------------------------------- */ - static int - ProcessStatusObjCmd( - ClientData clientData, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ - { +static int +ProcessStatusObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ +{ + if (objc < 1) { + Tcl_WrongNumArgs(interp, 1, objv, "?switches? ?pids?"); + return TCL_ERROR; + } + /* TODO */ return TCL_ERROR; } @@ -99,13 +111,18 @@ static int ProcessAutopurgeObjCmd(ClientData clientData, *---------------------------------------------------------------------- */ - static int - ProcessPurgeObjCmd( - ClientData clientData, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ - { +static int +ProcessPurgeObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ +{ + if (objc != 1 && objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "?pids?"); + return TCL_ERROR; + } + /* TODO */ return TCL_ERROR; } @@ -126,17 +143,40 @@ static int ProcessAutopurgeObjCmd(ClientData clientData, *---------------------------------------------------------------------- */ - static int - ProcessAutopurgeObjCmd( - ClientData clientData, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ - Tcl_Obj *const objv[]) /* Argument objects. */ +static int +ProcessAutopurgeObjCmd( + ClientData clientData, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - /* TODO */ - return TCL_ERROR; - } - + if (objc != 1 && objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "?flag?"); + return TCL_ERROR; + } + + if (objc == 2) { + /* + * Set given value. + */ + + int flag; + int result = Tcl_GetBooleanFromObj(interp, objv[1], &flag); + if (result != TCL_OK) { + return result; + } + + TclProcessSetAutopurge(flag); + } + + /* + * Return current value. + */ + + Tcl_SetObjResult(interp, Tcl_NewBooleanObj(TclProcessGetAutopurge())); + return TCL_OK; +} + /* *---------------------------------------------------------------------- * @@ -154,22 +194,66 @@ static int ProcessAutopurgeObjCmd(ClientData clientData, *---------------------------------------------------------------------- */ - Tcl_Command - TclInitProcessCmd( - Tcl_Interp *interp) /* Current interpreter. */ - { - static const EnsembleImplMap processImplMap[] = { +Tcl_Command +TclInitProcessCmd( + Tcl_Interp *interp) /* Current interpreter. */ +{ + static const EnsembleImplMap processImplMap[] = { {"list", ProcessListObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 1}, {"status", ProcessStatusObjCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 1}, {"purge", ProcessPurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1}, {"autopurge", ProcessAutopurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1}, {NULL, NULL, NULL, NULL, NULL, 0} - }; - Tcl_Command processCmd; - - processCmd = TclMakeEnsemble(interp, "::tcl::process", processImplMap); - Tcl_Export(interp, Tcl_FindNamespace(interp, "::tcl", NULL, 0), - "process", 0); - return processCmd; - } - \ No newline at end of file + }; + Tcl_Command processCmd; + + processCmd = TclMakeEnsemble(interp, "::tcl::process", processImplMap); + Tcl_Export(interp, Tcl_FindNamespace(interp, "::tcl", NULL, 0), + "process", 0); + return processCmd; +} + +/* + *---------------------------------------------------------------------- + * + * TclProcessGetAutopurge -- + * + * This function queries the value of the autopurge flag. + * + * Results: + * The current boolean value of the autopurge flag. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TclProcessGetAutopurge(void) +{ + return autopurge; +} + +/* + *---------------------------------------------------------------------- + * + * TclProcessSetAutopurge -- + * + * This function sets the value of the autopurge flag. + * + * Results: + * None. + * + * Side effects: + * Sets the autopurge static variable. + * + *---------------------------------------------------------------------- + */ + +void +TclProcessSetAutopurge( + int flag) /* New value for autopurge. */ +{ + autopurge = !!flag; +} diff --git a/tests/process.test b/tests/process.test index cef3adc..fb3a5e2 100644 --- a/tests/process.test +++ b/tests/process.test @@ -19,3 +19,13 @@ test process-1.1 {tcl::process command basic syntax} -returnCodes error -body { test process-1.2 {tcl::process command basic syntax} -returnCodes error -body { tcl::process ? } -match glob -result {unknown or ambiguous subcommand "?": must be autopurge, list, purge, or status} + +test process-2.1 {tcl::process autopurge get} {tcl::process autopurge} {1} +test process-2.2 {tcl::process autopurge set true} { + tcl::process autopurge true + tcl::process autopurge +} {1} +test process-2.3 {tcl::process autopurge set false} { + tcl::process autopurge false + tcl::process autopurge +} {0} -- cgit v0.12 From 03470df2ff2414f1912a85772cd6f558196ca8bc Mon Sep 17 00:00:00 2001 From: "f.bonnet" Date: Fri, 18 Aug 2017 12:49:08 +0000 Subject: Completed [tcl::process autopurge] semantics and added [tcl::process purge] implementation along with the necessary internal functions TclpGetChildPid/TclReapPids --- generic/tclInt.h | 2 ++ generic/tclIntPlatDecls.h | 2 ++ generic/tclPipe.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++- generic/tclProcess.c | 45 +++++++++++++++++++++++++++++++++--- unix/tclUnixPipe.c | 4 +++- win/tclWinPipe.c | 42 ++++++++++++++++++++++++++++++++- 6 files changed, 148 insertions(+), 6 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index a602e6c..3e99f91 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4028,6 +4028,8 @@ MODULE_SCOPE int TclFullFinalizationRequested(void); MODULE_SCOPE Tcl_Command TclInitProcessCmd(Tcl_Interp *interp); MODULE_SCOPE int TclProcessGetAutopurge(void); MODULE_SCOPE void TclProcessSetAutopurge(int flag); +MODULE_SCOPE void TclReapPids(int numPids, Tcl_Pid *pidPtr); +MODULE_SCOPE Tcl_Pid TclpGetChildPid(int id); /* *---------------------------------------------------------------- diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 494d6f1..4770747 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -562,6 +562,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; #else # undef TclpGetPid # define TclpGetPid(pid) ((unsigned long) (pid)) +# undef TclpGetChildPid +# define TclpGetChildPid(id) ((Tcl_Pid) (id)) #endif #endif /* _TCLINTPLATDECLS */ diff --git a/generic/tclPipe.c b/generic/tclPipe.c index d6cd188..c98ee7e 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -247,6 +247,61 @@ Tcl_ReapDetachedProcs(void) /* *---------------------------------------------------------------------- * + * TclReapPids -- + * + * This function is similar to Tcl_ReapDetachedProcs but works on a + * subset of processes. + * + * Results: + * None. + * + * Side effects: + * Processes are waited on, so that they can be reaped by the system. + * + *---------------------------------------------------------------------- + */ + +void +TclReapPids( + int numPids, /* Number of pids to detach: gives size of + * array pointed to by pidPtr. */ + Tcl_Pid *pidPtr) /* Array of pids to detach. */ +{ + register Detached *detPtr; + Detached *nextPtr, *prevPtr; + int status; + Tcl_Pid pid; + int i; + + Tcl_MutexLock(&pipeMutex); + for (detPtr = detList, prevPtr = NULL; detPtr != NULL; ) { + pid = 0; + for (i = 0; i < numPids; i++) { + if (detPtr->pid == pidPtr[i]) { + pid = Tcl_WaitPid(detPtr->pid, &status, WNOHANG); + break; + } + } + if ((pid == 0) || ((pid == (Tcl_Pid) -1) && (errno != ECHILD))) { + prevPtr = detPtr; + detPtr = detPtr->nextPtr; + continue; + } + nextPtr = detPtr->nextPtr; + if (prevPtr == NULL) { + detList = detPtr->nextPtr; + } else { + prevPtr->nextPtr = detPtr->nextPtr; + } + ckfree(detPtr); + detPtr = nextPtr; + } + Tcl_MutexUnlock(&pipeMutex); +} + +/* + *---------------------------------------------------------------------- + * * TclCleanupChildren -- * * This is a utility function used to wait for child processes to exit, @@ -854,7 +909,9 @@ TclCreatePipeline( * arguments between the "|" characters. */ - Tcl_ReapDetachedProcs(); + if (TclProcessGetAutopurge()) { + Tcl_ReapDetachedProcs(); + } pidPtr = ckalloc(cmdCount * sizeof(Tcl_Pid)); curInFile = inputFile; diff --git a/generic/tclProcess.c b/generic/tclProcess.c index 23ba4de..2557067 100644 --- a/generic/tclProcess.c +++ b/generic/tclProcess.c @@ -123,8 +123,47 @@ ProcessPurgeObjCmd( return TCL_ERROR; } - /* TODO */ - return TCL_ERROR; + if (objc == 1) { + /* + * Purge all detached processes. + */ + + Tcl_ReapDetachedProcs(); + } else { + int result; + int numPids; + Tcl_Obj **pidObjs; + Tcl_Pid *pids; + int id; + int i; + + /* + * Get pids from argument. + */ + + result = Tcl_ListObjGetElements(interp, objv[1], &numPids, &pidObjs); + if (result != TCL_OK) { + return result; + } + pids = (Tcl_Pid *) TclStackAlloc(interp, numPids * sizeof(Tcl_Pid)); + for (i = 0; i < numPids; i++) { + result = Tcl_GetIntFromObj(interp, pidObjs[i], (int *) &id); + if (result != TCL_OK) { + TclStackFree(interp, (void *) pids); + return result; + } + pids[i] = TclpGetChildPid(id); + } + + /* + * Purge only provided processes. + */ + + TclReapPids(numPids, pids); + TclStackFree(interp, (void *) pids); + } + + return TCL_OK; } /*---------------------------------------------------------------------- @@ -138,7 +177,7 @@ ProcessPurgeObjCmd( * Returns a standard Tcl result. * * Side effects: - * None.TODO + * Alters detached process handling by Tcl_ReapDetachedProcs(). * *---------------------------------------------------------------------- */ diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index be7b4eb..3d8e680 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -986,7 +986,9 @@ PipeClose2Proc( */ Tcl_DetachPids(pipePtr->numPids, pipePtr->pidPtr); - Tcl_ReapDetachedProcs(); + if (TclProcessGetAutopurge()) { + Tcl_ReapDetachedProcs(); + } if (pipePtr->errorFile) { TclpCloseFile(pipePtr->errorFile); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 4666deb..6dd2173 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -884,6 +884,44 @@ TclpGetPid( Tcl_MutexUnlock(&pipeMutex); return (unsigned long) -1; } + +/* + *-------------------------------------------------------------------------- + * + * TclpGetChildPid -- + * + * Given a process id of a child process, return the HANDLE for that + * child process. + * + * Results: + * Returns the HANDLE for the child process. If the id was not known + * by Tcl, either because the id was not created by Tcl or the child + * process has already been reaped, NULL is returned. + * + * Side effects: + * None. + * + *-------------------------------------------------------------------------- + */ + +Tcl_Pid +TclpGetChildPid( + int id) /* The process id of the child process. */ +{ + ProcInfo *infoPtr; + + PipeInit(); + + Tcl_MutexLock(&pipeMutex); + for (infoPtr = procList; infoPtr != NULL; infoPtr = infoPtr->nextPtr) { + if (infoPtr->dwProcessId == (DWORD) id) { + Tcl_MutexUnlock(&pipeMutex); + return (Tcl_Pid) infoPtr->hProcess; + } + } + Tcl_MutexUnlock(&pipeMutex); + return (Tcl_Pid) NULL; +} /* *---------------------------------------------------------------------- @@ -1991,7 +2029,9 @@ PipeClose2Proc( */ Tcl_DetachPids(pipePtr->numPids, pipePtr->pidPtr); - Tcl_ReapDetachedProcs(); + if (TclProcessGetAutopurge()) { + Tcl_ReapDetachedProcs(); + } if (pipePtr->errorFile) { if (TclpCloseFile(pipePtr->errorFile) != 0) { -- cgit v0.12 From 5210283d105dd5baf07880dce96c9382c690321f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 22 Aug 2017 12:12:11 +0000 Subject: Fix [d2612a2fa193196787aab33bb57f69b1eef9e30c|d2612a2fa1]: Build breaks because of gcc error. Only use "#pragma GCC diagnostic" if the compiler supports this. Also re-format tclUnixSock.c without further functional changes. --- unix/tclLoadDyld.c | 2 + unix/tclUnixSock.c | 293 +++++++++++++++++++++++++++++++---------------------- 2 files changed, 172 insertions(+), 123 deletions(-) diff --git a/unix/tclLoadDyld.c b/unix/tclLoadDyld.c index 8b7dc58..e998bf9 100644 --- a/unix/tclLoadDyld.c +++ b/unix/tclLoadDyld.c @@ -48,7 +48,9 @@ #endif /* TCL_DYLD_USE_DLFCN */ #if TCL_DYLD_USE_NSMODULE || defined(TCL_LOAD_FROM_MEMORY) +#if defined (__clang__) || ((__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) #pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif #include #include #include diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 2f1a78e..e418ff0 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -19,6 +19,7 @@ #define SET_BITS(var, bits) ((var) |= (bits)) #define CLEAR_BITS(var, bits) ((var) &= ~(bits)) +#define GOT_BITS(var, bits) (((var) & (bits)) != 0) /* "sock" + a pointer in hex + \0 */ #define SOCK_CHAN_LENGTH (4 + sizeof(void *) * 2 + 1) @@ -117,8 +118,7 @@ struct TcpState { * Static routines for this file: */ -static int TcpConnect(Tcl_Interp *interp, - TcpState *state); +static int TcpConnect(Tcl_Interp *interp, TcpState *state); static void TcpAccept(ClientData data, int mask); static int TcpBlockModeProc(ClientData data, int mode); static int TcpCloseProc(ClientData instanceData, @@ -173,21 +173,24 @@ static ProcessGlobalValue hostName = #if 0 /* printf debugging */ -void printaddrinfo(struct addrinfo *addrlist, char *prefix) +void +printaddrinfo( + struct addrinfo *addrlist, + char *prefix) { char host[NI_MAXHOST], port[NI_MAXSERV]; struct addrinfo *ai; + for (ai = addrlist; ai != NULL; ai = ai->ai_next) { getnameinfo(ai->ai_addr, ai->ai_addrlen, - host, sizeof(host), - port, sizeof(port), - NI_NUMERICHOST|NI_NUMERICSERV); + host, sizeof(host), port, sizeof(port), + NI_NUMERICHOST|NI_NUMERICSERV); fprintf(stderr,"%s: %s:%s\n", prefix, host, port); } } #endif /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * InitializeHostName -- * @@ -197,7 +200,7 @@ void printaddrinfo(struct addrinfo *addrlist, char *prefix) * Results: * None. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ static void @@ -271,12 +274,12 @@ InitializeHostName( *encodingPtr = Tcl_GetEncoding(NULL, NULL); *lengthPtr = strlen(native); - *valuePtr = ckalloc((*lengthPtr) + 1); - memcpy(*valuePtr, native, (size_t)(*lengthPtr)+1); + *valuePtr = ckalloc(*lengthPtr + 1); + memcpy(*valuePtr, native, (size_t)(*lengthPtr) + 1); } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * Tcl_GetHostName -- * @@ -290,7 +293,7 @@ InitializeHostName( * Side effects: * Caches the name to return for future calls. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ const char * @@ -300,7 +303,7 @@ Tcl_GetHostName(void) } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TclpHasSockets -- * @@ -312,7 +315,7 @@ Tcl_GetHostName(void) * Side effects: * None. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ int @@ -323,7 +326,7 @@ TclpHasSockets( } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TclpFinalizeSockets -- * @@ -335,7 +338,7 @@ TclpHasSockets( * Side effects: * None. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ void @@ -345,7 +348,7 @@ TclpFinalizeSockets(void) } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TcpBlockModeProc -- * @@ -358,7 +361,7 @@ TclpFinalizeSockets(void) * Side effects: * Sets the device into blocking or nonblocking mode. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ /* ARGSUSED */ @@ -376,7 +379,7 @@ TcpBlockModeProc( } else { SET_BITS(statePtr->flags, TCP_NONBLOCKING); } - if (statePtr->flags & TCP_ASYNC_CONNECT) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { statePtr->cachedBlocking = mode; return 0; } @@ -387,33 +390,32 @@ TcpBlockModeProc( } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * WaitForConnect -- * - * Check the state of an async connect process. If a connection - * attempt terminated, process it, which may finalize it or may - * start the next attempt. If a connect error occures, it is saved - * in statePtr->connectError to be reported by 'fconfigure -error'. + * Check the state of an async connect process. If a connection attempt + * terminated, process it, which may finalize it or may start the next + * attempt. If a connect error occures, it is saved in + * statePtr->connectError to be reported by 'fconfigure -error'. * * There are two modes of operation, defined by errorCodePtr: - * * non-NULL: Called by explicite read/write command. block if + * * non-NULL: Called by explicite read/write command. Blocks if the * socket is blocking. * May return two error codes: * * EWOULDBLOCK: if connect is still in progress - * * ENOTCONN: if connect failed. This would be the error - * message of a rect or sendto syscall so this is - * emulated here. - * * NULL: Called by a backround operation. Do not block and - * don't return any error code. + * * ENOTCONN: if connect failed. This would be the error message + * of a rect or sendto syscall so this is emulated here. + * * NULL: Called by a backround operation. Do not block and do not + * return any error code. * * Results: - * 0 if the connection has completed, -1 if still in progress - * or there is an error. + * 0 if the connection has completed, -1 if still in progress or there is + * an error. * * Side effects: - * Processes socket events off the system queue. - * May process asynchroneous connect. + * Processes socket events off the system queue. May process + * asynchroneous connects. * *---------------------------------------------------------------------- */ @@ -426,11 +428,11 @@ WaitForConnect( int timeout; /* - * Check if an async connect failed already and error reporting is demanded, - * return the error ENOTCONN + * Check if an async connect failed already and error reporting is + * demanded, return the error ENOTCONN */ - if (errorCodePtr != NULL && (statePtr->flags & TCP_ASYNC_FAILED)) { + if (errorCodePtr != NULL && GOT_BITS(statePtr->flags, TCP_ASYNC_FAILED)) { *errorCodePtr = ENOTCONN; return -1; } @@ -439,26 +441,29 @@ WaitForConnect( * Check if an async connect is running. If not return ok */ - if (!(statePtr->flags & TCP_ASYNC_PENDING)) { + if (!GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { return 0; } - if (errorCodePtr == NULL || (statePtr->flags & TCP_NONBLOCKING)) { + if (errorCodePtr == NULL || GOT_BITS(statePtr->flags, TCP_NONBLOCKING)) { timeout = 0; } else { timeout = -1; } do { if (TclUnixWaitForFile(statePtr->fds.fd, - TCL_WRITABLE | TCL_EXCEPTION, timeout) != 0) { + TCL_WRITABLE | TCL_EXCEPTION, timeout) != 0) { TcpConnect(NULL, statePtr); } - /* Do this only once in the nonblocking case and repeat it until the - * socket is final when blocking */ - } while (timeout == -1 && statePtr->flags & TCP_ASYNC_CONNECT); + + /* + * Do this only once in the nonblocking case and repeat it until the + * socket is final when blocking. + */ + } while (timeout == -1 && GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)); if (errorCodePtr != NULL) { - if (statePtr->flags & TCP_ASYNC_PENDING) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { *errorCodePtr = EAGAIN; return -1; } else if (statePtr->connectError != 0) { @@ -615,7 +620,8 @@ TcpCloseProc( fds = statePtr->fds.next; while (fds != NULL) { TcpFdList *next = fds->next; - ckfree(fds); + + ckfree(fds); fds = next; } if (statePtr->addrlist != NULL) { @@ -685,10 +691,9 @@ TcpClose2Proc( * * TcpHostPortList -- * - * This function is called by the -gethostname and -getpeername - * switches of TcpGetOptionProc() to add three list elements - * with the textual representation of the given address to the - * given DString. + * This function is called by the -gethostname and -getpeername switches + * of TcpGetOptionProc() to add three list elements with the textual + * representation of the given address to the given DString. * * Results: * None. @@ -700,8 +705,10 @@ TcpClose2Proc( */ #ifndef NEED_FAKE_RFC2553 +#if defined (__clang__) || ((__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif static inline int IPv6AddressNeedsNumericRendering( struct in6_addr addr) @@ -722,7 +729,9 @@ IPv6AddressNeedsNumericRendering( return (addr.s6_addr[12] == 0 && addr.s6_addr[13] == 0 && addr.s6_addr[14] == 0 && addr.s6_addr[15] == 0); } +#if defined (__clang__) || ((__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) #pragma GCC diagnostic pop +#endif #endif /* NEED_FAKE_RFC2553 */ static void @@ -736,14 +745,15 @@ TcpHostPortList( char host[NI_MAXHOST], nhost[NI_MAXHOST], nport[NI_MAXSERV]; int flags = 0; - getnameinfo(&addr.sa, salen, - nhost, sizeof(nhost), nport, sizeof(nport), - NI_NUMERICHOST | NI_NUMERICSERV); + getnameinfo(&addr.sa, salen, nhost, sizeof(nhost), nport, sizeof(nport), + NI_NUMERICHOST | NI_NUMERICSERV); Tcl_DStringAppendElement(dsPtr, nhost); + /* - * We don't want to resolve INADDR_ANY and sin6addr_any; they - * can sometimes cause problems (and never have a name). + * We don't want to resolve INADDR_ANY and sin6addr_any; they can + * sometimes cause problems (and never have a name). */ + if (addr.sa.sa_family == AF_INET) { if (addr.sa4.sin_addr.s_addr == INADDR_ANY) { flags |= NI_NUMERICHOST; @@ -755,15 +765,27 @@ TcpHostPortList( } #endif /* NEED_FAKE_RFC2553 */ } - /* Check if reverse DNS has been switched off globally */ - if (interp != NULL && Tcl_GetVar(interp, SUPPRESS_RDNS_VAR, 0) != NULL) { + + /* + * Check if reverse DNS has been switched off globally. + */ + + if (interp != NULL && + Tcl_GetVar2(interp, SUPPRESS_RDNS_VAR, NULL, 0) != NULL) { flags |= NI_NUMERICHOST; } - if (getnameinfo(&addr.sa, salen, host, sizeof(host), NULL, 0, flags) == 0) { - /* Reverse mapping worked */ + if (getnameinfo(&addr.sa, salen, host, sizeof(host), NULL, 0, + flags) == 0) { + /* + * Reverse mapping worked. + */ + Tcl_DStringAppendElement(dsPtr, host); } else { - /* Reverse mappong failed - use the numeric rep once more */ + /* + * Reverse mapping failed - use the numeric rep once more. + */ + Tcl_DStringAppendElement(dsPtr, nhost); } Tcl_DStringAppendElement(dsPtr, nport); @@ -813,16 +835,20 @@ TcpGetOptionProc( (strncmp(optionName, "-error", len) == 0)) { socklen_t optlen = sizeof(int); - if (statePtr->flags & TCP_ASYNC_CONNECT) { - /* Suppress errors as long as we are not done */ + if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { + /* + * Suppress errors as long as we are not done. + */ + errno = 0; } else if (statePtr->connectError != 0) { errno = statePtr->connectError; statePtr->connectError = 0; } else { int err; - getsockopt(statePtr->fds.fd, SOL_SOCKET, SO_ERROR, - (char *) &err, &optlen); + + getsockopt(statePtr->fds.fd, SOL_SOCKET, SO_ERROR, (char *) &err, + &optlen); errno = err; } if (errno != 0) { @@ -833,9 +859,8 @@ TcpGetOptionProc( if ((len > 1) && (optionName[1] == 'c') && (strncmp(optionName, "-connecting", len) == 0)) { - Tcl_DStringAppend(dsPtr, - (statePtr->flags & TCP_ASYNC_CONNECT) ? "1" : "0", -1); + GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT) ? "1" : "0", -1); return TCL_OK; } @@ -844,10 +869,11 @@ TcpGetOptionProc( address peername; socklen_t size = sizeof(peername); - if ( (statePtr->flags & TCP_ASYNC_CONNECT) ) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { /* * In async connect output an empty string */ + if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-peername"); Tcl_DStringAppendElement(dsPtr, ""); @@ -858,6 +884,7 @@ TcpGetOptionProc( /* * Peername fetch succeeded - output list */ + if (len == 0) { Tcl_DStringAppendElement(dsPtr, "-peername"); Tcl_DStringStartSublist(dsPtr); @@ -897,11 +924,12 @@ TcpGetOptionProc( Tcl_DStringAppendElement(dsPtr, "-sockname"); Tcl_DStringStartSublist(dsPtr); } - if ( (statePtr->flags & TCP_ASYNC_CONNECT) ) { + if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) { /* * In async connect output an empty string */ - found = 1; + + found = 1; } else { for (fds = &statePtr->fds; fds != NULL; fds = fds->next) { size = sizeof(sockname); @@ -926,14 +954,15 @@ TcpGetOptionProc( } if (len > 0) { - return Tcl_BadChannelOption(interp, optionName, "connecting peername sockname"); + return Tcl_BadChannelOption(interp, optionName, + "connecting peername sockname"); } return TCL_OK; } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TcpWatchProc -- * @@ -946,7 +975,7 @@ TcpGetOptionProc( * Sets up the notifier so that a future event on the channel will be * seen by Tcl. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ static void @@ -959,17 +988,17 @@ WrapNotify( if (newmask == 0) { /* - * There was no overlap between the states the channel is - * interested in notifications for, and the states that are - * reported present on the file descriptor by select(). The - * only way that can happen is when the channel is interested - * in a writable condition, and only a readable state is reported - * present (see TcpWatchProc() below). In that case, signal back - * to the caller the writable state, which is really an error - * condition. As an extra check on that assumption, check for - * a non-zero value of errno before reporting an artificial + * There was no overlap between the states the channel is interested + * in notifications for, and the states that are reported present on + * the file descriptor by select(). The only way that can happen is + * when the channel is interested in a writable condition, and only a + * readable state is reported present (see TcpWatchProc() below). In + * that case, signal back to the caller the writable state, which is + * really an error condition. As an extra check on that assumption, + * check for a non-zero value of errno before reporting an artificial * writable state. */ + if (errno == 0) { return; } @@ -993,33 +1022,36 @@ TcpWatchProc( * be readable or writable at the Tcl level. This keeps Tcl scripts * from interfering with the -accept behavior (bug #3394732). */ + return; } - if (statePtr->flags & TCP_ASYNC_PENDING) { - /* Async sockets use a FileHandler internally while connecting, so we - * need to cache this request until the connection has succeeded. */ + if (GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING)) { + /* + * Async sockets use a FileHandler internally while connecting, so we + * need to cache this request until the connection has succeeded. + */ + statePtr->filehandlers = mask; } else if (mask) { /* - * Whether it is a bug or feature or otherwise, it is a fact - * of life that on at least some Linux kernels select() fails - * to report that a socket file descriptor is writable when - * the other end of the socket is closed. This is in contrast - * to the guarantees Tcl makes that its channels become - * writable and fire writable events on an error conditon. - * This has caused a leak of file descriptors in a state of + * Whether it is a bug or feature or otherwise, it is a fact of life + * that on at least some Linux kernels select() fails to report that a + * socket file descriptor is writable when the other end of the socket + * is closed. This is in contrast to the guarantees Tcl makes that + * its channels become writable and fire writable events on an error + * conditon. This has caused a leak of file descriptors in a state of * background flushing. See Tcl ticket 1758a0b603. * - * As a workaround, when our caller indicates an interest in - * writable notifications, we must tell the notifier built - * around select() that we are interested in the readable state - * of the file descriptor as well, as that is the only reliable - * means to get notified of error conditions. Then it is the - * task of WrapNotify() above to untangle the meaning of these - * channel states and report the chan events as best it can. - * We save a copy of the mask passed in to assist with that. + * As a workaround, when our caller indicates an interest in writable + * notifications, we must tell the notifier built around select() that + * we are interested in the readable state of the file descriptor as + * well, as that is the only reliable means to get notified of error + * conditions. Then it is the task of WrapNotify() above to untangle + * the meaning of these channel states and report the chan events as + * best it can. We save a copy of the mask passed in to assist with + * that. */ statePtr->interest = mask; @@ -1031,7 +1063,7 @@ TcpWatchProc( } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TcpGetHandleProc -- * @@ -1045,7 +1077,7 @@ TcpWatchProc( * Side effects: * None. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ /* ARGSUSED */ @@ -1062,16 +1094,17 @@ TcpGetHandleProc( } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TcpAsyncCallback -- * - * Called by the event handler that TcpConnect sets up - * internally for [socket -async] to get notified when the - * asyncronous connection attempt has succeeded or failed. + * Called by the event handler that TcpConnect sets up internally for + * [socket -async] to get notified when the asyncronous connection + * attempt has succeeded or failed. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ + static void TcpAsyncCallback( ClientData clientData, /* The socket state. */ @@ -1083,7 +1116,7 @@ TcpAsyncCallback( } /* - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- * * TcpConnect -- * @@ -1109,7 +1142,7 @@ TcpAsyncCallback( * return and the loops resume as if they had never been interrupted. * For syncronously connecting sockets, the loops work the usual way. * - *---------------------------------------------------------------------- + * ---------------------------------------------------------------------- */ static int @@ -1118,9 +1151,9 @@ TcpConnect( TcpState *statePtr) { socklen_t optlen; - int async_callback = statePtr->flags & TCP_ASYNC_PENDING; + int async_callback = GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING); int ret = -1, error = EHOSTUNREACH; - int async = statePtr->flags & TCP_ASYNC_CONNECT; + int async = GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT); if (async_callback) { goto reenter; @@ -1128,8 +1161,8 @@ TcpConnect( for (statePtr->addr = statePtr->addrlist; statePtr->addr != NULL; statePtr->addr = statePtr->addr->ai_next) { - - for (statePtr->myaddr = statePtr->myaddrlist; statePtr->myaddr != NULL; + for (statePtr->myaddr = statePtr->myaddrlist; + statePtr->myaddr != NULL; statePtr->myaddr = statePtr->myaddr->ai_next) { int reuseaddr = 1; @@ -1153,7 +1186,8 @@ TcpConnect( errno = 0; } - statePtr->fds.fd = socket(statePtr->addr->ai_family, SOCK_STREAM, 0); + statePtr->fds.fd = socket(statePtr->addr->ai_family, SOCK_STREAM, + 0); if (statePtr->fds.fd < 0) { continue; } @@ -1172,14 +1206,18 @@ TcpConnect( TclSockMinimumBuffers(INT2PTR(statePtr->fds.fd), SOCKET_BUFSIZE); if (async) { - ret = TclUnixSetBlockingMode(statePtr->fds.fd,TCL_MODE_NONBLOCKING); + ret = TclUnixSetBlockingMode(statePtr->fds.fd, + TCL_MODE_NONBLOCKING); if (ret < 0) { continue; } } - /* Gotta reset the error variable here, before we use it for the - * first time in this iteration. */ + /* + * Must reset the error variable here, before we use it for the + * first time in this iteration. + */ + error = 0; (void) setsockopt(statePtr->fds.fd, SOL_SOCKET, SO_REUSEADDR, @@ -1200,10 +1238,13 @@ TcpConnect( ret = connect(statePtr->fds.fd, statePtr->addr->ai_addr, statePtr->addr->ai_addrlen); - if (ret < 0) error = errno; + if (ret < 0) { + error = errno; + } if (ret < 0 && errno == EINPROGRESS) { Tcl_CreateFileHandler(statePtr->fds.fd, - TCL_WRITABLE|TCL_EXCEPTION, TcpAsyncCallback, statePtr); + TCL_WRITABLE | TCL_EXCEPTION, TcpAsyncCallback, + statePtr); errno = EWOULDBLOCK; SET_BITS(statePtr->flags, TCP_ASYNC_PENDING); return TCL_OK; @@ -1231,7 +1272,7 @@ TcpConnect( } } -out: + out: statePtr->connectError = error; CLEAR_BITS(statePtr->flags, TCP_ASYNC_CONNECT); if (async_callback) { @@ -1329,6 +1370,7 @@ Tcl_OpenTcpClient( /* * Allocate a new TcpState for this socket. */ + statePtr = ckalloc(sizeof(TcpState)); memset(statePtr, 0, sizeof(TcpState)); statePtr->flags = async ? TCP_ASYNC_CONNECT : 0; @@ -1340,6 +1382,7 @@ Tcl_OpenTcpClient( /* * Create a new client socket and wrap it in a channel. */ + if (TcpConnect(interp, statePtr) != TCL_OK) { TcpCloseProc(statePtr, NULL); return NULL; @@ -1347,8 +1390,8 @@ Tcl_OpenTcpClient( sprintf(channelName, SOCK_TEMPLATE, (long) statePtr); - statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, statePtr, - (TCL_READABLE | TCL_WRITABLE)); + statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName, + statePtr, TCL_READABLE | TCL_WRITABLE); if (Tcl_SetChannelOption(interp, statePtr->channel, "-translation", "auto crlf") == TCL_ERROR) { Tcl_Close(NULL, statePtr->channel); @@ -1377,7 +1420,8 @@ Tcl_Channel Tcl_MakeTcpClientChannel( ClientData sock) /* The socket to wrap up into a channel. */ { - return (Tcl_Channel) TclpMakeTcpClientChannelMode(sock, (TCL_READABLE | TCL_WRITABLE)); + return (Tcl_Channel) TclpMakeTcpClientChannelMode(sock, + TCL_READABLE | TCL_WRITABLE); } /* @@ -1516,7 +1560,10 @@ Tcl_OpenTcpServer( } #ifdef IPV6_V6ONLY - /* Missing on: Solaris 2.8 */ + /* + * Missing on: Solaris 2.8 + */ + if (addrPtr->ai_family == AF_INET6) { int v6only = 1; @@ -1662,7 +1709,7 @@ TcpAccept( sprintf(channelName, SOCK_TEMPLATE, (long) newSockState); newSockState->channel = Tcl_CreateChannel(&tcpChannelType, channelName, - newSockState, (TCL_READABLE | TCL_WRITABLE)); + newSockState, TCL_READABLE | TCL_WRITABLE); Tcl_SetChannelOption(NULL, newSockState->channel, "-translation", "auto crlf"); -- cgit v0.12 From 8dd2373a08bd2ec8d5796041d0f8945d24a811c1 Mon Sep 17 00:00:00 2001 From: "f.bonnet" Date: Wed, 23 Aug 2017 18:31:56 +0000 Subject: Refactoring and preliminary implementation of tcl::process (list|status) --- generic/tclInt.h | 6 +- generic/tclIntPlatDecls.h | 2 - generic/tclPipe.c | 65 +------ generic/tclProcess.c | 455 ++++++++++++++++++++++++++++++++++++++-------- unix/tclUnixPipe.c | 4 +- win/tclWinPipe.c | 42 +---- 6 files changed, 383 insertions(+), 191 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 3e99f91..dcdf2f6 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4026,10 +4026,8 @@ MODULE_SCOPE int TclFullFinalizationRequested(void); */ MODULE_SCOPE Tcl_Command TclInitProcessCmd(Tcl_Interp *interp); -MODULE_SCOPE int TclProcessGetAutopurge(void); -MODULE_SCOPE void TclProcessSetAutopurge(int flag); -MODULE_SCOPE void TclReapPids(int numPids, Tcl_Pid *pidPtr); -MODULE_SCOPE Tcl_Pid TclpGetChildPid(int id); +MODULE_SCOPE void TclProcessDetach(Tcl_Pid pid); +MODULE_SCOPE int TclProcessStatus(Tcl_Pid pid, int options); /* *---------------------------------------------------------------- diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 4770747..494d6f1 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -562,8 +562,6 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; #else # undef TclpGetPid # define TclpGetPid(pid) ((unsigned long) (pid)) -# undef TclpGetChildPid -# define TclpGetChildPid(id) ((Tcl_Pid) (id)) #endif #endif /* _TCLINTPLATDECLS */ diff --git a/generic/tclPipe.c b/generic/tclPipe.c index c98ee7e..e7c419d 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -192,6 +192,7 @@ Tcl_DetachPids( detPtr->pid = pidPtr[i]; detPtr->nextPtr = detList; detList = detPtr; + TclProcessDetach(pidPtr[i]); } Tcl_MutexUnlock(&pipeMutex); @@ -221,13 +222,10 @@ Tcl_ReapDetachedProcs(void) { register Detached *detPtr; Detached *nextPtr, *prevPtr; - int status; - Tcl_Pid pid; Tcl_MutexLock(&pipeMutex); for (detPtr = detList, prevPtr = NULL; detPtr != NULL; ) { - pid = Tcl_WaitPid(detPtr->pid, &status, WNOHANG); - if ((pid == 0) || ((pid == (Tcl_Pid) -1) && (errno != ECHILD))) { + if (!TclProcessStatus(detPtr->pid, WNOHANG)) { prevPtr = detPtr; detPtr = detPtr->nextPtr; continue; @@ -247,61 +245,6 @@ Tcl_ReapDetachedProcs(void) /* *---------------------------------------------------------------------- * - * TclReapPids -- - * - * This function is similar to Tcl_ReapDetachedProcs but works on a - * subset of processes. - * - * Results: - * None. - * - * Side effects: - * Processes are waited on, so that they can be reaped by the system. - * - *---------------------------------------------------------------------- - */ - -void -TclReapPids( - int numPids, /* Number of pids to detach: gives size of - * array pointed to by pidPtr. */ - Tcl_Pid *pidPtr) /* Array of pids to detach. */ -{ - register Detached *detPtr; - Detached *nextPtr, *prevPtr; - int status; - Tcl_Pid pid; - int i; - - Tcl_MutexLock(&pipeMutex); - for (detPtr = detList, prevPtr = NULL; detPtr != NULL; ) { - pid = 0; - for (i = 0; i < numPids; i++) { - if (detPtr->pid == pidPtr[i]) { - pid = Tcl_WaitPid(detPtr->pid, &status, WNOHANG); - break; - } - } - if ((pid == 0) || ((pid == (Tcl_Pid) -1) && (errno != ECHILD))) { - prevPtr = detPtr; - detPtr = detPtr->nextPtr; - continue; - } - nextPtr = detPtr->nextPtr; - if (prevPtr == NULL) { - detList = detPtr->nextPtr; - } else { - prevPtr->nextPtr = detPtr->nextPtr; - } - ckfree(detPtr); - detPtr = nextPtr; - } - Tcl_MutexUnlock(&pipeMutex); -} - -/* - *---------------------------------------------------------------------- - * * TclCleanupChildren -- * * This is a utility function used to wait for child processes to exit, @@ -909,9 +852,7 @@ TclCreatePipeline( * arguments between the "|" characters. */ - if (TclProcessGetAutopurge()) { - Tcl_ReapDetachedProcs(); - } + Tcl_ReapDetachedProcs(); pidPtr = ckalloc(cmdCount * sizeof(Tcl_Pid)); curInFile = inputFile; diff --git a/generic/tclProcess.c b/generic/tclProcess.c index 2557067..733b1d7 100644 --- a/generic/tclProcess.c +++ b/generic/tclProcess.c @@ -12,22 +12,45 @@ #include "tclInt.h" +/* + * Autopurge flag. Process-global because of the way Tcl manages child + * processes (see tclPipe.c). + */ + static int autopurge = 1; /* Autopurge flag. */ +/* + * Hash table that keeps track of all child process statuses. Keys are the + * child process ids, values are (ProcessInfo *). + */ + +typedef struct ProcessInfo { + Tcl_Pid pid; /*FRED TODO*/ + int resolvedPid; /*FRED TODO unused?*/ + Tcl_Obj *status; /*FRED TODO*/ + +} ProcessInfo; +static Tcl_HashTable statusTable; +static int statusTableInitialized = 0; /* 0 means not yet initialized. */ +TCL_DECLARE_MUTEX(statusMutex) + /* * Prototypes for functions defined later in this file: */ -static int ProcessListObjCmd(ClientData clientData, +static int GetProcessStatus(Tcl_Pid pid, int resolvedPid, + int options, Tcl_Obj **statusPtr); +static int PurgeProcessStatus(Tcl_HashEntry *entry); +static int ProcessListObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ProcessStatusObjCmd(ClientData clientData, +static int ProcessStatusObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ProcessPurgeObjCmd(ClientData clientData, +static int ProcessPurgeObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ProcessAutopurgeObjCmd(ClientData clientData, +static int ProcessAutopurgeObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -42,7 +65,7 @@ static int ProcessAutopurgeObjCmd(ClientData clientData, * Returns a standard Tcl result. * * Side effects: - * None.TODO + * None.FRED TODO * *---------------------------------------------------------------------- */ @@ -50,18 +73,36 @@ static int ProcessAutopurgeObjCmd(ClientData clientData, static int ProcessListObjCmd( ClientData clientData, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ + Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + Tcl_Obj *result; + Tcl_HashEntry *entry; + Tcl_HashSearch search; + ProcessInfo *info; + if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } - /* TODO */ - return TCL_ERROR; - } + /* + * Return the list of all chid process ids. + */ + + result = Tcl_NewListObj(0, NULL); + Tcl_MutexLock(&statusMutex); + for (entry = Tcl_FirstHashEntry(&statusTable, &search); entry != NULL; + entry = Tcl_NextHashEntry(&search)) { + info = (ProcessInfo *) Tcl_GetHashValue(entry); + Tcl_ListObjAppendElement(interp, result, + Tcl_NewIntObj(info->resolvedPid)); + } + Tcl_MutexUnlock(&statusMutex); + Tcl_SetObjResult(interp, result); + return TCL_OK; +} /*---------------------------------------------------------------------- * @@ -74,7 +115,7 @@ ProcessListObjCmd( * Returns a standard Tcl result. * * Side effects: - * None.TODO + * None.FRED TODO * *---------------------------------------------------------------------- */ @@ -82,18 +123,61 @@ ProcessListObjCmd( static int ProcessStatusObjCmd( ClientData clientData, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ + Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + Tcl_Obj *result; + int options; + Tcl_HashEntry *entry; + Tcl_HashSearch search; + ProcessInfo *info; + if (objc < 1) { Tcl_WrongNumArgs(interp, 1, objv, "?switches? ?pids?"); return TCL_ERROR; } - /* TODO */ - return TCL_ERROR; - } + /* FRED TODO switches */ + options = WNOHANG; + + /* + * Return the list of all chid process statuses. + */ + + result = Tcl_NewDictObj(); + Tcl_MutexLock(&statusMutex); + for (entry = Tcl_FirstHashEntry(&statusTable, &search); entry != NULL; + entry = Tcl_NextHashEntry(&search)) { + info = (ProcessInfo *) Tcl_GetHashValue(entry); + if (autopurge) { + if (GetProcessStatus(info->pid, info->resolvedPid, options, + NULL)) { + /* + * Purge. + */ + + PurgeProcessStatus(entry); + Tcl_DeleteHashEntry(entry); + continue; + } + } else if (!info->status) { + /* + * Update status. + */ + + if (GetProcessStatus(info->pid, info->resolvedPid, options, + &info->status)) { + Tcl_IncrRefCount(info->status); + } + } + Tcl_DictObjPut(interp, result, Tcl_NewIntObj(info->resolvedPid), + info->status ? info->status : Tcl_NewObj()); + } + Tcl_MutexUnlock(&statusMutex); + Tcl_SetObjResult(interp, result); + return TCL_OK; +} /*---------------------------------------------------------------------- * @@ -106,7 +190,7 @@ ProcessStatusObjCmd( * Returns a standard Tcl result. * * Side effects: - * None.TODO + * None.FRED TODO * *---------------------------------------------------------------------- */ @@ -114,57 +198,65 @@ ProcessStatusObjCmd( static int ProcessPurgeObjCmd( ClientData clientData, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ + Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + Tcl_HashEntry *entry; + Tcl_HashSearch search; + int numPids; + Tcl_Obj **pidObjs; + int result; + int i; + int pid; + if (objc != 1 && objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "?pids?"); return TCL_ERROR; } +//FRED TODO update status list first. + if (objc == 1) { /* - * Purge all detached processes. + * Purge all terminated processes. */ - - Tcl_ReapDetachedProcs(); - } else { - int result; - int numPids; - Tcl_Obj **pidObjs; - Tcl_Pid *pids; - int id; - int i; + Tcl_MutexLock(&statusMutex); + for (entry = Tcl_FirstHashEntry(&statusTable, &search); entry != NULL; + entry = Tcl_NextHashEntry(&search)) { + if (PurgeProcessStatus(entry)) { + Tcl_DeleteHashEntry(entry); + } + } + Tcl_MutexUnlock(&statusMutex); + } else { /* - * Get pids from argument. + * Purge only provided processes. */ result = Tcl_ListObjGetElements(interp, objv[1], &numPids, &pidObjs); if (result != TCL_OK) { return result; } - pids = (Tcl_Pid *) TclStackAlloc(interp, numPids * sizeof(Tcl_Pid)); + Tcl_MutexLock(&statusMutex); for (i = 0; i < numPids; i++) { - result = Tcl_GetIntFromObj(interp, pidObjs[i], (int *) &id); + result = Tcl_GetIntFromObj(interp, pidObjs[i], (int *) &pid); if (result != TCL_OK) { - TclStackFree(interp, (void *) pids); + Tcl_MutexUnlock(&statusMutex); return result; } - pids[i] = TclpGetChildPid(id); - } - /* - * Purge only provided processes. - */ - - TclReapPids(numPids, pids); - TclStackFree(interp, (void *) pids); + entry = Tcl_FindHashEntry(&statusTable, INT2PTR(pid)); + if (entry && PurgeProcessStatus(entry)) { + Tcl_DeleteHashEntry(entry); + } + } + Tcl_MutexUnlock(&statusMutex); } return TCL_OK; - } +} /*---------------------------------------------------------------------- * @@ -185,10 +277,10 @@ ProcessPurgeObjCmd( static int ProcessAutopurgeObjCmd( ClientData clientData, /* Not used. */ - Tcl_Interp *interp, /* Current interpreter. */ + Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ - { +{ if (objc != 1 && objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "?flag?"); return TCL_ERROR; @@ -205,14 +297,14 @@ ProcessAutopurgeObjCmd( return result; } - TclProcessSetAutopurge(flag); + autopurge = !!flag; } /* * Return current value. */ - Tcl_SetObjResult(interp, Tcl_NewBooleanObj(TclProcessGetAutopurge())); + Tcl_SetObjResult(interp, Tcl_NewBooleanObj(autopurge)); return TCL_OK; } @@ -246,53 +338,258 @@ TclInitProcessCmd( }; Tcl_Command processCmd; + if (statusTableInitialized == 0) { + Tcl_MutexLock(&statusMutex); + if (statusTableInitialized == 0) { + Tcl_InitHashTable(&statusTable, TCL_ONE_WORD_KEYS); + statusTableInitialized = 1; + } + Tcl_MutexUnlock(&statusMutex); + } + processCmd = TclMakeEnsemble(interp, "::tcl::process", processImplMap); Tcl_Export(interp, Tcl_FindNamespace(interp, "::tcl", NULL, 0), "process", 0); return processCmd; } -/* - *---------------------------------------------------------------------- - * - * TclProcessGetAutopurge -- - * - * This function queries the value of the autopurge flag. - * - * Results: - * The current boolean value of the autopurge flag. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ +/* FRED TODO */ +void +TclProcessDetach( + Tcl_Pid pid) +{ + int resolvedPid; + Tcl_HashEntry *entry; + int isNew; + ProcessInfo *info; + + resolvedPid = TclpGetPid(pid); + Tcl_MutexLock(&statusMutex); + entry = Tcl_CreateHashEntry(&statusTable, INT2PTR(resolvedPid), &isNew); + if (!isNew) { + /* + * Pid was reused, free old status and reuse structure. + */ + + info = (ProcessInfo *) Tcl_GetHashValue(entry); + if (info->status) { + Tcl_DecrRefCount(info->status); + } + } else { + /* + * Allocate new info structure. + */ + info = (ProcessInfo *) ckalloc(sizeof(ProcessInfo)); + Tcl_SetHashValue(entry, info); + } + + /* + * Initialize with an empty status. + */ + + info->pid = pid; + info->resolvedPid = resolvedPid; + info->status = NULL; + + Tcl_MutexUnlock(&statusMutex); +} + +/* FRED TODO */ int -TclProcessGetAutopurge(void) +TclProcessStatus( + Tcl_Pid pid, + int options) { - return autopurge; + int resolvedPid; + Tcl_HashEntry *entry; + ProcessInfo *info; + Tcl_Obj *status; + int isNew; + + /* + * We need to get the resolved pid before we wait on it as the windows + * implementation of Tcl_WaitPid deletes the information such that any + * following calls to TclpGetPid fail. + */ + + resolvedPid = TclpGetPid(pid); + + if (!GetProcessStatus(pid, resolvedPid, options, + (autopurge ? NULL /* unused */: &status))) { + /* + * Process still alive, or non child-related error. + */ + + return 0; + } + + if (autopurge) { + /* + * Child terminated, purge. + */ + + Tcl_MutexLock(&statusMutex); + entry = Tcl_FindHashEntry(&statusTable, INT2PTR(resolvedPid)); + if (entry) { + PurgeProcessStatus(entry); + Tcl_DeleteHashEntry(entry); + } + Tcl_MutexUnlock(&statusMutex); + + return 1; + } + + /* + * Store process status. + */ + + Tcl_MutexLock(&statusMutex); + entry = Tcl_CreateHashEntry(&statusTable, INT2PTR(resolvedPid), &isNew); + if (!isNew) { + info = (ProcessInfo *) Tcl_GetHashValue(entry); + if (info->status) { + /* + * Free old status object. + */ + + Tcl_DecrRefCount(info->status); + } + } else { + /* + * Allocate new info structure. + */ + + info = (ProcessInfo *) ckalloc(sizeof(ProcessInfo)); + info->pid = pid; + info->resolvedPid = resolvedPid; + Tcl_SetHashValue(entry, info); + } + + info->status = status; + Tcl_IncrRefCount(status); + Tcl_MutexUnlock(&statusMutex); + + return 1; } -/* - *---------------------------------------------------------------------- - * - * TclProcessSetAutopurge -- - * - * This function sets the value of the autopurge flag. - * - * Results: - * None. - * - * Side effects: - * Sets the autopurge static variable. - * - *---------------------------------------------------------------------- - */ +/* FRED TODO */ +int +GetProcessStatus( + Tcl_Pid pid, + int resolvedPid, + int options, + Tcl_Obj **statusPtr) +{ + int waitStatus; + Tcl_Obj *statusCodes[5]; + const char *msg; -void -TclProcessSetAutopurge( - int flag) /* New value for autopurge. */ + pid = Tcl_WaitPid(pid, &waitStatus, options); + if ((pid == 0) || ((pid == (Tcl_Pid) -1) && (errno != ECHILD))) { + /* + * Process still alive, or non child-related error. + */ + + return 0; + } + + if (!statusPtr) { + return 1; + } + + /* + * Get process status. + */ + + if (pid == (Tcl_Pid) -1) { + /* + * POSIX errName msg + */ + + statusCodes[0] = Tcl_NewStringObj("POSIX", -1); + statusCodes[1] = Tcl_NewStringObj(Tcl_ErrnoId(), -1); + msg = Tcl_ErrnoMsg(errno); + if (errno == ECHILD) { + /* + * This changeup in message suggested by Mark Diekhans to + * remind people that ECHILD errors can occur on some + * systems if SIGCHLD isn't in its default state. + */ + + msg = "child process lost (is SIGCHLD ignored or trapped?)"; + } + statusCodes[2] = Tcl_NewStringObj(msg, -1); + *statusPtr = Tcl_NewListObj(3, statusCodes); + } else if (WIFEXITED(waitStatus)) { + /* + * CHILDSTATUS pid code + * + * Child exited with a non-zero exit status. + */ + + statusCodes[0] = Tcl_NewStringObj("CHILDSTATUS", -1); + statusCodes[1] = Tcl_NewIntObj(resolvedPid); + statusCodes[2] = Tcl_NewIntObj(WEXITSTATUS(waitStatus)); + *statusPtr = Tcl_NewListObj(3, statusCodes); + } else if (WIFSIGNALED(waitStatus)) { + /* + * CHILDKILLED pid sigName msg + * + * Child killed because of a signal + */ + + statusCodes[0] = Tcl_NewStringObj("CHILDKILLED", -1); + statusCodes[1] = Tcl_NewIntObj(resolvedPid); + statusCodes[2] = Tcl_NewStringObj(Tcl_SignalId(WTERMSIG(waitStatus)), -1); + statusCodes[3] = Tcl_NewStringObj(Tcl_SignalMsg(WTERMSIG(waitStatus)), -1); + *statusPtr = Tcl_NewListObj(4, statusCodes); + } else if (WIFSTOPPED(waitStatus)) { + /* + * CHILDSUSP pid sigName msg + * + * Child suspended because of a signal + */ + + statusCodes[0] = Tcl_NewStringObj("CHILDSUSP", -1); + statusCodes[1] = Tcl_NewIntObj(resolvedPid); + statusCodes[2] = Tcl_NewStringObj(Tcl_SignalId(WSTOPSIG(waitStatus)), -1); + statusCodes[3] = Tcl_NewStringObj(Tcl_SignalMsg(WSTOPSIG(waitStatus)), -1); + *statusPtr = Tcl_NewListObj(4, statusCodes); + } else { + /* + * TCL OPERATION EXEC ODDWAITRESULT + * + * Child wait status didn't make sense. + */ + + statusCodes[0] = Tcl_NewStringObj("TCL", -1); + statusCodes[1] = Tcl_NewStringObj("OPERATION", -1); + statusCodes[2] = Tcl_NewStringObj("EXEC", -1); + statusCodes[3] = Tcl_NewStringObj("ODDWAITRESULT", -1); + statusCodes[4] = Tcl_NewIntObj(resolvedPid); + *statusPtr = Tcl_NewListObj(5, statusCodes); + } + + return 1; +} + +/* FRED TODO */ +int +PurgeProcessStatus( + Tcl_HashEntry *entry) { - autopurge = !!flag; + ProcessInfo *info; + + info = (ProcessInfo *) Tcl_GetHashValue(entry); + if (info->status) { + /* + * Process has ended, purge. + */ + + Tcl_DecrRefCount(info->status); + return 1; + } + + return 0; } diff --git a/unix/tclUnixPipe.c b/unix/tclUnixPipe.c index 3d8e680..be7b4eb 100644 --- a/unix/tclUnixPipe.c +++ b/unix/tclUnixPipe.c @@ -986,9 +986,7 @@ PipeClose2Proc( */ Tcl_DetachPids(pipePtr->numPids, pipePtr->pidPtr); - if (TclProcessGetAutopurge()) { - Tcl_ReapDetachedProcs(); - } + Tcl_ReapDetachedProcs(); if (pipePtr->errorFile) { TclpCloseFile(pipePtr->errorFile); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 6dd2173..4666deb 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -884,44 +884,6 @@ TclpGetPid( Tcl_MutexUnlock(&pipeMutex); return (unsigned long) -1; } - -/* - *-------------------------------------------------------------------------- - * - * TclpGetChildPid -- - * - * Given a process id of a child process, return the HANDLE for that - * child process. - * - * Results: - * Returns the HANDLE for the child process. If the id was not known - * by Tcl, either because the id was not created by Tcl or the child - * process has already been reaped, NULL is returned. - * - * Side effects: - * None. - * - *-------------------------------------------------------------------------- - */ - -Tcl_Pid -TclpGetChildPid( - int id) /* The process id of the child process. */ -{ - ProcInfo *infoPtr; - - PipeInit(); - - Tcl_MutexLock(&pipeMutex); - for (infoPtr = procList; infoPtr != NULL; infoPtr = infoPtr->nextPtr) { - if (infoPtr->dwProcessId == (DWORD) id) { - Tcl_MutexUnlock(&pipeMutex); - return (Tcl_Pid) infoPtr->hProcess; - } - } - Tcl_MutexUnlock(&pipeMutex); - return (Tcl_Pid) NULL; -} /* *---------------------------------------------------------------------- @@ -2029,9 +1991,7 @@ PipeClose2Proc( */ Tcl_DetachPids(pipePtr->numPids, pipePtr->pidPtr); - if (TclProcessGetAutopurge()) { - Tcl_ReapDetachedProcs(); - } + Tcl_ReapDetachedProcs(); if (pipePtr->errorFile) { if (TclpCloseFile(pipePtr->errorFile) != 0) { -- cgit v0.12 From 57aa77515aae5d66471140213b35e4ff50972b0e Mon Sep 17 00:00:00 2001 From: "f.bonnet" Date: Wed, 23 Aug 2017 19:51:02 +0000 Subject: Added switches and pid list support to tcl::process status --- generic/tclProcess.c | 159 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 119 insertions(+), 40 deletions(-) diff --git a/generic/tclProcess.c b/generic/tclProcess.c index 733b1d7..99bb7e1 100644 --- a/generic/tclProcess.c +++ b/generic/tclProcess.c @@ -77,7 +77,7 @@ ProcessListObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tcl_Obj *result; + Tcl_Obj *list; Tcl_HashEntry *entry; Tcl_HashSearch search; ProcessInfo *info; @@ -91,16 +91,16 @@ ProcessListObjCmd( * Return the list of all chid process ids. */ - result = Tcl_NewListObj(0, NULL); + list = Tcl_NewListObj(0, NULL); Tcl_MutexLock(&statusMutex); for (entry = Tcl_FirstHashEntry(&statusTable, &search); entry != NULL; entry = Tcl_NextHashEntry(&search)) { info = (ProcessInfo *) Tcl_GetHashValue(entry); - Tcl_ListObjAppendElement(interp, result, + Tcl_ListObjAppendElement(interp, list, Tcl_NewIntObj(info->resolvedPid)); } Tcl_MutexUnlock(&statusMutex); - Tcl_SetObjResult(interp, result); + Tcl_SetObjResult(interp, list); return TCL_OK; } @@ -127,55 +127,136 @@ ProcessStatusObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tcl_Obj *result; - int options; + Tcl_Obj *dict; + int index, options = WNOHANG; Tcl_HashEntry *entry; Tcl_HashSearch search; ProcessInfo *info; + int numPids; + Tcl_Obj **pidObjs; + int result; + int i; + int pid; + Tcl_Obj *const *savedobjv = objv; + static const char *const switches[] = { + "-wait", "--", NULL + }; + enum switches { + STATUS_WAIT, STATUS_LAST + }; - if (objc < 1) { - Tcl_WrongNumArgs(interp, 1, objv, "?switches? ?pids?"); + while (objc > 1) { + if (TclGetString(objv[1])[0] != '-') { + break; + } + if (Tcl_GetIndexFromObj(interp, objv[1], switches, "switches", 0, + &index) != TCL_OK) { + return TCL_ERROR; + } + ++objv; --objc; + if (STATUS_WAIT == (enum switches) index) { + options = 0; + } else { + break; + } + } + + if (objc != 1 && objc != 2) { + Tcl_WrongNumArgs(interp, 1, savedobjv, "?switches? ?pids?"); return TCL_ERROR; } - /* FRED TODO switches */ - options = WNOHANG; + if (objc == 1) { + /* + * Return the list of all child process statuses. + */ - /* - * Return the list of all chid process statuses. - */ + dict = Tcl_NewDictObj(); + Tcl_MutexLock(&statusMutex); + for (entry = Tcl_FirstHashEntry(&statusTable, &search); entry != NULL; + entry = Tcl_NextHashEntry(&search)) { + info = (ProcessInfo *) Tcl_GetHashValue(entry); + if (autopurge) { + if (GetProcessStatus(info->pid, info->resolvedPid, options, + NULL)) { + /* + * Purge. + */ + + PurgeProcessStatus(entry); + Tcl_DeleteHashEntry(entry); + continue; + } + } else if (!info->status) { + /* + * Update status. + */ + + if (GetProcessStatus(info->pid, info->resolvedPid, options, + &info->status)) { + Tcl_IncrRefCount(info->status); + } + } + Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), + info->status ? info->status : Tcl_NewObj()); + } + Tcl_MutexUnlock(&statusMutex); + } else { + /* + * Only return statuses of provided processes. + */ + + result = Tcl_ListObjGetElements(interp, objv[1], &numPids, &pidObjs); + if (result != TCL_OK) { + return result; + } + dict = Tcl_NewDictObj(); + Tcl_MutexLock(&statusMutex); + for (i = 0; i < numPids; i++) { + result = Tcl_GetIntFromObj(interp, pidObjs[i], (int *) &pid); + if (result != TCL_OK) { + Tcl_MutexUnlock(&statusMutex); + Tcl_DecrRefCount(dict); + return result; + } - result = Tcl_NewDictObj(); - Tcl_MutexLock(&statusMutex); - for (entry = Tcl_FirstHashEntry(&statusTable, &search); entry != NULL; - entry = Tcl_NextHashEntry(&search)) { - info = (ProcessInfo *) Tcl_GetHashValue(entry); - if (autopurge) { - if (GetProcessStatus(info->pid, info->resolvedPid, options, - NULL)) { + entry = Tcl_FindHashEntry(&statusTable, INT2PTR(pid)); + if (!entry) { /* - * Purge. + * Skip unknown process. */ - - PurgeProcessStatus(entry); - Tcl_DeleteHashEntry(entry); + continue; } - } else if (!info->status) { - /* - * Update status. - */ - - if (GetProcessStatus(info->pid, info->resolvedPid, options, - &info->status)) { - Tcl_IncrRefCount(info->status); - } + + info = (ProcessInfo *) Tcl_GetHashValue(entry); + if (autopurge) { + if (GetProcessStatus(info->pid, info->resolvedPid, options, + NULL)) { + /* + * Purge. + */ + + PurgeProcessStatus(entry); + Tcl_DeleteHashEntry(entry); + continue; + } + } else if (!info->status) { + /* + * Update status. + */ + + if (GetProcessStatus(info->pid, info->resolvedPid, options, + &info->status)) { + Tcl_IncrRefCount(info->status); + } + } + Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), + info->status ? info->status : Tcl_NewObj()); } - Tcl_DictObjPut(interp, result, Tcl_NewIntObj(info->resolvedPid), - info->status ? info->status : Tcl_NewObj()); + Tcl_MutexUnlock(&statusMutex); } - Tcl_MutexUnlock(&statusMutex); - Tcl_SetObjResult(interp, result); + Tcl_SetObjResult(interp, dict); return TCL_OK; } @@ -215,8 +296,6 @@ ProcessPurgeObjCmd( return TCL_ERROR; } -//FRED TODO update status list first. - if (objc == 1) { /* * Purge all terminated processes. -- cgit v0.12 From 2e9194366ab14876eaf9f689fe0808fc68477701 Mon Sep 17 00:00:00 2001 From: ferrieux Date: Thu, 24 Aug 2017 16:56:51 +0000 Subject: Fix [b50fb214] : add to 2>> the same O_APPEND that was added to >> back in 2005. --- generic/tclPipe.c | 8 +++++++- tests/exec.test | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/generic/tclPipe.c b/generic/tclPipe.c index d6cd188..b679ec4 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -668,7 +668,13 @@ TclCreatePipeline( if (*p == '>') { p++; atOK = 0; - flags = O_WRONLY | O_CREAT; + + /* + * Note that the O_APPEND flag only has an effect on POSIX + * platforms. On Windows, we just have to carry on regardless. + */ + + flags = O_WRONLY | O_CREAT | O_APPEND; } if (errorClose != 0) { errorClose = 0; diff --git a/tests/exec.test b/tests/exec.test index 2a4b31e..dffd960 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -671,8 +671,12 @@ test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix} -setup { exec /bin/sh -c \ {for a in 1 2 3; do sleep 1; echo $a; done} >>$tmpfile & exec /bin/sh -c \ + {for a in 4 5 6; do sleep 1; echo $a >&2; done} 2>>$tmpfile & + exec /bin/sh -c \ {for a in a b c; do sleep 1; echo $a; done} >>$tmpfile & - # The above two shell invokations take about 3 seconds to finish, so allow + exec /bin/sh -c \ + {for a in d e f; do sleep 1; echo $a >&2; done} 2>>$tmpfile & + # The above four shell invokations take about 3 seconds to finish, so allow # 5s (in case the machine is busy) after 5000 # Check that no bytes have got lost through mixups with overlapping @@ -681,7 +685,7 @@ test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix} -setup { file size $tmpfile } -cleanup { removeFile $tmpfile -} -result 14 +} -result 26 # Tests to ensure batch files and .CMD (Bug 9ece99d58b) # can be executed on Windows -- cgit v0.12 From 43c89a019c37b43637956e0b21b5788f784b1972 Mon Sep 17 00:00:00 2001 From: "f.bonnet" Date: Sun, 27 Aug 2017 11:05:45 +0000 Subject: Refactoring to support all processes and not just detached ones. --- generic/tclInt.h | 15 +- generic/tclPipe.c | 75 ++----- generic/tclProcess.c | 625 +++++++++++++++++++++++++++++---------------------- 3 files changed, 391 insertions(+), 324 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index dcdf2f6..c7a0a0d 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4025,9 +4025,20 @@ MODULE_SCOPE int TclFullFinalizationRequested(void); * TIP #462. */ +typedef enum TclProcessWaitStatus { + TCL_PROCESS_ERROR = -1, + TCL_PROCESS_UNCHANGED = 0, + TCL_PROCESS_EXITED = 1, + TCL_PROCESS_SIGNALED = 2, + TCL_PROCESS_STOPPED = 3, + TCL_PROCESS_UNKNOWN_STATUS = 4 +} TclProcessWaitStatus; + MODULE_SCOPE Tcl_Command TclInitProcessCmd(Tcl_Interp *interp); -MODULE_SCOPE void TclProcessDetach(Tcl_Pid pid); -MODULE_SCOPE int TclProcessStatus(Tcl_Pid pid, int options); +MODULE_SCOPE void TclProcessCreated(Tcl_Pid pid); +MODULE_SCOPE TclProcessWaitStatus TclProcessWait(Tcl_Pid pid, int options, + int *codePtr, Tcl_Obj **msgObjPtr, + Tcl_Obj **errorObjPtr); /* *---------------------------------------------------------------- diff --git a/generic/tclPipe.c b/generic/tclPipe.c index e7c419d..d20d8eb 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -192,7 +192,6 @@ Tcl_DetachPids( detPtr->pid = pidPtr[i]; detPtr->nextPtr = detList; detList = detPtr; - TclProcessDetach(pidPtr[i]); } Tcl_MutexUnlock(&pipeMutex); @@ -222,10 +221,13 @@ Tcl_ReapDetachedProcs(void) { register Detached *detPtr; Detached *nextPtr, *prevPtr; + int status, code; Tcl_MutexLock(&pipeMutex); for (detPtr = detList, prevPtr = NULL; detPtr != NULL; ) { - if (!TclProcessStatus(detPtr->pid, WNOHANG)) { + status = TclProcessWait(detPtr->pid, WNOHANG, &code, NULL, NULL); + if (status == TCL_PROCESS_UNCHANGED || (status == TCL_PROCESS_ERROR + && code != ECHILD)) { prevPtr = detPtr; detPtr = detPtr->nextPtr; continue; @@ -275,37 +277,18 @@ TclCleanupChildren( { int result = TCL_OK; int i, abnormalExit, anyErrorInfo; - Tcl_Pid pid; - int waitStatus; - const char *msg; - unsigned long resolvedPid; + TclProcessWaitStatus waitStatus; + int code; + Tcl_Obj *msg, *error; abnormalExit = 0; for (i = 0; i < numPids; i++) { - /* - * We need to get the resolved pid before we wait on it as the windows - * implementation of Tcl_WaitPid deletes the information such that any - * following calls to TclpGetPid fail. - */ - - resolvedPid = TclpGetPid(pidPtr[i]); - pid = Tcl_WaitPid(pidPtr[i], &waitStatus, 0); - if (pid == (Tcl_Pid) -1) { + waitStatus = TclProcessWait(pidPtr[i], 0, &code, &msg, &error); + if (waitStatus == TCL_PROCESS_ERROR) { result = TCL_ERROR; if (interp != NULL) { - msg = Tcl_PosixError(interp); - if (errno == ECHILD) { - /* - * This changeup in message suggested by Mark Diekhans to - * remind people that ECHILD errors can occur on some - * systems if SIGCHLD isn't in its default state. - */ - - msg = - "child process lost (is SIGCHLD ignored or trapped?)"; - } - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "error waiting for process to exit: %s", msg)); + Tcl_SetObjErrorCode(interp, error); + Tcl_SetObjResult(interp, msg); } continue; } @@ -317,38 +300,17 @@ TclCleanupChildren( * removed). */ - if (!WIFEXITED(waitStatus) || (WEXITSTATUS(waitStatus) != 0)) { - char msg1[TCL_INTEGER_SPACE], msg2[TCL_INTEGER_SPACE]; - + if (waitStatus != TCL_PROCESS_EXITED || code != 0) { result = TCL_ERROR; - sprintf(msg1, "%lu", resolvedPid); - if (WIFEXITED(waitStatus)) { + if (waitStatus == TCL_PROCESS_EXITED) { if (interp != NULL) { - sprintf(msg2, "%u", WEXITSTATUS(waitStatus)); - Tcl_SetErrorCode(interp, "CHILDSTATUS", msg1, msg2, NULL); + Tcl_SetObjErrorCode(interp, error); + Tcl_DecrRefCount(msg); } abnormalExit = 1; } else if (interp != NULL) { - const char *p; - - if (WIFSIGNALED(waitStatus)) { - p = Tcl_SignalMsg(WTERMSIG(waitStatus)); - Tcl_SetErrorCode(interp, "CHILDKILLED", msg1, - Tcl_SignalId(WTERMSIG(waitStatus)), p, NULL); - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "child killed: %s\n", p)); - } else if (WIFSTOPPED(waitStatus)) { - p = Tcl_SignalMsg(WSTOPSIG(waitStatus)); - Tcl_SetErrorCode(interp, "CHILDSUSP", msg1, - Tcl_SignalId(WSTOPSIG(waitStatus)), p, NULL); - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "child suspended: %s\n", p)); - } else { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "child wait status didn't make sense\n", -1)); - Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC", - "ODDWAITRESULT", msg1, NULL); - } + Tcl_SetObjErrorCode(interp, error); + Tcl_SetObjResult(interp, msg); } } } @@ -380,7 +342,7 @@ TclCleanupChildren( Tcl_PosixError(interp))); } else if (count > 0) { anyErrorInfo = 1; - Tcl_SetObjResult(interp, objPtr); + Tcl_SetObjResult(interp, objPtr); result = TCL_ERROR; } else { Tcl_DecrRefCount(objPtr); @@ -928,6 +890,7 @@ TclCreatePipeline( pidPtr[numPids] = pid; numPids++; + TclProcessCreated(pid); /* * Close off our copies of file descriptors that were set up for this diff --git a/generic/tclProcess.c b/generic/tclProcess.c index 99bb7e1..87fc8bb 100644 --- a/generic/tclProcess.c +++ b/generic/tclProcess.c @@ -20,27 +20,36 @@ static int autopurge = 1; /* Autopurge flag. */ /* - * Hash table that keeps track of all child process statuses. Keys are the - * child process ids, values are (ProcessInfo *). + * Hash tables that keeps track of all child process statuses. Keys are the + * child process ids and resolved pids, values are (ProcessInfo *). */ typedef struct ProcessInfo { Tcl_Pid pid; /*FRED TODO*/ - int resolvedPid; /*FRED TODO unused?*/ - Tcl_Obj *status; /*FRED TODO*/ - + int resolvedPid; /*FRED TODO*/ + int purge; /*FRED TODO*/ + TclProcessWaitStatus status; + int code; /*FRED TODO*/ + Tcl_Obj *msg; /*FRED TODO*/ + Tcl_Obj *error; /*FRED TODO*/ } ProcessInfo; -static Tcl_HashTable statusTable; -static int statusTableInitialized = 0; /* 0 means not yet initialized. */ -TCL_DECLARE_MUTEX(statusMutex) +static Tcl_HashTable infoTablePerPid; +static Tcl_HashTable infoTablePerResolvedPid; +static int infoTablesInitialized = 0; /* 0 means not yet initialized. */ +TCL_DECLARE_MUTEX(infoTablesMutex) /* * Prototypes for functions defined later in this file: */ -static int GetProcessStatus(Tcl_Pid pid, int resolvedPid, - int options, Tcl_Obj **statusPtr); -static int PurgeProcessStatus(Tcl_HashEntry *entry); +static void InitProcessInfo(ProcessInfo *info, Tcl_Pid pid, + int resolvedPid); +static void FreeProcessInfo(ProcessInfo *info, int preserveObjs); +static int RefreshProcessInfo(ProcessInfo *info, int options); +static int WaitProcessStatus(Tcl_Pid pid, int resolvedPid, + int options, int *codePtr, Tcl_Obj **msgPtr, + Tcl_Obj **errorObjPtr); +static Tcl_Obj * BuildProcessStatusObj(ProcessInfo *info); static int ProcessListObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -54,6 +63,231 @@ static int ProcessAutopurgeObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +/* FRED TODO */ +void +InitProcessInfo( + ProcessInfo *info, + Tcl_Pid pid, + int resolvedPid) +{ + info->pid = pid; + info->resolvedPid = resolvedPid; + info->purge = 0; + info->status = TCL_PROCESS_UNCHANGED; + info->code = 0; + info->msg = NULL; + info->error = NULL; +} + +/* FRED TODO */ +void +FreeProcessInfo( + ProcessInfo *info, + int preserveObjs) +{ + if (!preserveObjs) { + if (info->msg) { + Tcl_DecrRefCount(info->msg); + } + if (info->error) { + Tcl_DecrRefCount(info->error); + } + } + ckfree(info); +} + +/* FRED TODO */ +int +RefreshProcessInfo( + ProcessInfo *info, + int options +) +{ + if (info->status == TCL_PROCESS_UNCHANGED) { + /* + * Refresh & store status. + */ + + info->status = WaitProcessStatus(info->pid, info->resolvedPid, + options, &info->code, &info->msg, &info->error); + if (info->msg) Tcl_IncrRefCount(info->msg); + if (info->error) Tcl_IncrRefCount(info->error); + return (info->status != TCL_PROCESS_UNCHANGED); + } else { + return 0; + } +} + +/* FRED TODO */ +int +WaitProcessStatus( + Tcl_Pid pid, + int resolvedPid, + int options, + int *codePtr, + Tcl_Obj **msgObjPtr, + Tcl_Obj **errorObjPtr) +{ + int waitStatus; + Tcl_Obj *errorStrings[5]; + const char *msg; + + pid = Tcl_WaitPid(pid, &waitStatus, options); + if ((pid == 0)) { + /* + * No change. + */ + + return TCL_PROCESS_UNCHANGED; + } + + /* + * Get process status. + */ + + if (pid == (Tcl_Pid) -1) { + /* + * POSIX errName msg + */ + + msg = Tcl_ErrnoMsg(errno); + if (errno == ECHILD) { + /* + * This changeup in message suggested by Mark Diekhans to + * remind people that ECHILD errors can occur on some + * systems if SIGCHLD isn't in its default state. + */ + + msg = "child process lost (is SIGCHLD ignored or trapped?)"; + } + if (codePtr) *codePtr = errno; + if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf( + "error waiting for process to exit: %s", msg); + if (errorObjPtr) { + errorStrings[0] = Tcl_NewStringObj("POSIX", -1); + errorStrings[1] = Tcl_NewStringObj(Tcl_ErrnoId(), -1); + errorStrings[2] = Tcl_NewStringObj(msg, -1); + *errorObjPtr = Tcl_NewListObj(3, errorStrings); + } + return TCL_PROCESS_ERROR; + } else if (WIFEXITED(waitStatus)) { + if (codePtr) *codePtr = WEXITSTATUS(waitStatus); + if (!WEXITSTATUS(waitStatus)) { + /* + * Normal exit. + */ + + if (msgObjPtr) *msgObjPtr = NULL; + if (errorObjPtr) *errorObjPtr = NULL; + } else { + /* + * CHILDSTATUS pid code + * + * Child exited with a non-zero exit status. + */ + + if (msgObjPtr) *msgObjPtr = Tcl_NewStringObj( + "child process exited abnormally", -1); + if (errorObjPtr) { + errorStrings[0] = Tcl_NewStringObj("CHILDSTATUS", -1); + errorStrings[1] = Tcl_NewIntObj(resolvedPid); + errorStrings[2] = Tcl_NewIntObj(WEXITSTATUS(waitStatus)); + *errorObjPtr = Tcl_NewListObj(3, errorStrings); + } + } + return TCL_PROCESS_EXITED; + } else if (WIFSIGNALED(waitStatus)) { + /* + * CHILDKILLED pid sigName msg + * + * Child killed because of a signal. + */ + + msg = Tcl_SignalMsg(WTERMSIG(waitStatus)); + if (codePtr) *codePtr = WTERMSIG(waitStatus); + if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf( + "child killed: %s", msg); + if (errorObjPtr) { + errorStrings[0] = Tcl_NewStringObj("CHILDKILLED", -1); + errorStrings[1] = Tcl_NewIntObj(resolvedPid); + errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WTERMSIG(waitStatus)), -1); + errorStrings[3] = Tcl_NewStringObj(msg, -1); + *errorObjPtr = Tcl_NewListObj(4, errorStrings); + } + return TCL_PROCESS_SIGNALED; + } else if (WIFSTOPPED(waitStatus)) { + /* + * CHILDSUSP pid sigName msg + * + * Child suspended because of a signal. + */ + + msg = Tcl_SignalMsg(WSTOPSIG(waitStatus)); + if (codePtr) *codePtr = WSTOPSIG(waitStatus); + if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf( + "child suspended: %s", msg); + if (errorObjPtr) { + errorStrings[0] = Tcl_NewStringObj("CHILDSUSP", -1); + errorStrings[1] = Tcl_NewIntObj(resolvedPid); + errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WSTOPSIG(waitStatus)), -1); + errorStrings[3] = Tcl_NewStringObj(msg, -1); + *errorObjPtr = Tcl_NewListObj(4, errorStrings); + } + return TCL_PROCESS_STOPPED; + } else { + /* + * TCL OPERATION EXEC ODDWAITRESULT + * + * Child wait status didn't make sense. + */ + + if (codePtr) *codePtr = waitStatus; + if (msgObjPtr) *msgObjPtr = Tcl_NewStringObj( + "child wait status didn't make sense\n", -1); + if (errorObjPtr) { + errorStrings[0] = Tcl_NewStringObj("TCL", -1); + errorStrings[1] = Tcl_NewStringObj("OPERATION", -1); + errorStrings[2] = Tcl_NewStringObj("EXEC", -1); + errorStrings[3] = Tcl_NewStringObj("ODDWAITRESULT", -1); + errorStrings[4] = Tcl_NewIntObj(resolvedPid); + *errorObjPtr = Tcl_NewListObj(5, errorStrings); + } + return TCL_PROCESS_UNKNOWN_STATUS; + } +} + +/* FRED TODO */ +Tcl_Obj * +BuildProcessStatusObj( + ProcessInfo *info) +{ + Tcl_Obj *resultObjs[3]; + + if (info->status == TCL_PROCESS_UNCHANGED) { + /* + * Process still running, return empty obj. + */ + + return Tcl_NewObj(); + } + if (info->status == TCL_PROCESS_EXITED && info->code == 0) { + /* + * Normal exit, return TCL_OK. + */ + + return Tcl_NewIntObj(TCL_OK); + } + + /* + * Abnormal exit, return {TCL_ERROR msg error} + */ + + resultObjs[0] = Tcl_NewIntObj(TCL_ERROR); + resultObjs[1] = info->msg; + resultObjs[2] = info->error; + return Tcl_NewListObj(3, resultObjs); +} + /*---------------------------------------------------------------------- * * ProcessListObjCmd -- @@ -92,14 +326,14 @@ ProcessListObjCmd( */ list = Tcl_NewListObj(0, NULL); - Tcl_MutexLock(&statusMutex); - for (entry = Tcl_FirstHashEntry(&statusTable, &search); entry != NULL; - entry = Tcl_NextHashEntry(&search)) { + Tcl_MutexLock(&infoTablesMutex); + for (entry = Tcl_FirstHashEntry(&infoTablePerResolvedPid, &search); + entry != NULL; entry = Tcl_NextHashEntry(&search)) { info = (ProcessInfo *) Tcl_GetHashValue(entry); Tcl_ListObjAppendElement(interp, list, Tcl_NewIntObj(info->resolvedPid)); } - Tcl_MutexUnlock(&statusMutex); + Tcl_MutexUnlock(&infoTablesMutex); Tcl_SetObjResult(interp, list); return TCL_OK; } @@ -172,35 +406,17 @@ ProcessStatusObjCmd( */ dict = Tcl_NewDictObj(); - Tcl_MutexLock(&statusMutex); - for (entry = Tcl_FirstHashEntry(&statusTable, &search); entry != NULL; - entry = Tcl_NextHashEntry(&search)) { + Tcl_MutexLock(&infoTablesMutex); + for (entry = Tcl_FirstHashEntry(&infoTablePerResolvedPid, &search); + entry != NULL; entry = Tcl_NextHashEntry(&search)) { info = (ProcessInfo *) Tcl_GetHashValue(entry); - if (autopurge) { - if (GetProcessStatus(info->pid, info->resolvedPid, options, - NULL)) { - /* - * Purge. - */ - - PurgeProcessStatus(entry); - Tcl_DeleteHashEntry(entry); - continue; - } - } else if (!info->status) { - /* - * Update status. - */ + RefreshProcessInfo(info, options); + // TODO purge etc. - if (GetProcessStatus(info->pid, info->resolvedPid, options, - &info->status)) { - Tcl_IncrRefCount(info->status); - } - } - Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), - info->status ? info->status : Tcl_NewObj()); + Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), + BuildProcessStatusObj(info)); } - Tcl_MutexUnlock(&statusMutex); + Tcl_MutexUnlock(&infoTablesMutex); } else { /* * Only return statuses of provided processes. @@ -211,16 +427,16 @@ ProcessStatusObjCmd( return result; } dict = Tcl_NewDictObj(); - Tcl_MutexLock(&statusMutex); + Tcl_MutexLock(&infoTablesMutex); for (i = 0; i < numPids; i++) { result = Tcl_GetIntFromObj(interp, pidObjs[i], (int *) &pid); if (result != TCL_OK) { - Tcl_MutexUnlock(&statusMutex); + Tcl_MutexUnlock(&infoTablesMutex); Tcl_DecrRefCount(dict); return result; } - entry = Tcl_FindHashEntry(&statusTable, INT2PTR(pid)); + entry = Tcl_FindHashEntry(&infoTablePerResolvedPid, INT2PTR(pid)); if (!entry) { /* * Skip unknown process. @@ -230,31 +446,14 @@ ProcessStatusObjCmd( } info = (ProcessInfo *) Tcl_GetHashValue(entry); - if (autopurge) { - if (GetProcessStatus(info->pid, info->resolvedPid, options, - NULL)) { - /* - * Purge. - */ - - PurgeProcessStatus(entry); - Tcl_DeleteHashEntry(entry); - continue; - } - } else if (!info->status) { - /* - * Update status. - */ + RefreshProcessInfo(info, options); - if (GetProcessStatus(info->pid, info->resolvedPid, options, - &info->status)) { - Tcl_IncrRefCount(info->status); - } - } - Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), - info->status ? info->status : Tcl_NewObj()); + // TODO purge etc. + + Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), + BuildProcessStatusObj(info)); } - Tcl_MutexUnlock(&statusMutex); + Tcl_MutexUnlock(&infoTablesMutex); } Tcl_SetObjResult(interp, dict); return TCL_OK; @@ -285,6 +484,7 @@ ProcessPurgeObjCmd( { Tcl_HashEntry *entry; Tcl_HashSearch search; + ProcessInfo *info; int numPids; Tcl_Obj **pidObjs; int result; @@ -301,14 +501,16 @@ ProcessPurgeObjCmd( * Purge all terminated processes. */ - Tcl_MutexLock(&statusMutex); - for (entry = Tcl_FirstHashEntry(&statusTable, &search); entry != NULL; + Tcl_MutexLock(&infoTablesMutex); + for (entry = Tcl_FirstHashEntry(&infoTablePerPid, &search); entry != NULL; entry = Tcl_NextHashEntry(&search)) { - if (PurgeProcessStatus(entry)) { + info = (ProcessInfo *) Tcl_GetHashValue(entry); + if (info->status != TCL_PROCESS_UNCHANGED) { Tcl_DeleteHashEntry(entry); + FreeProcessInfo(info, 0); } } - Tcl_MutexUnlock(&statusMutex); + Tcl_MutexUnlock(&infoTablesMutex); } else { /* * Purge only provided processes. @@ -318,20 +520,24 @@ ProcessPurgeObjCmd( if (result != TCL_OK) { return result; } - Tcl_MutexLock(&statusMutex); + Tcl_MutexLock(&infoTablesMutex); for (i = 0; i < numPids; i++) { result = Tcl_GetIntFromObj(interp, pidObjs[i], (int *) &pid); if (result != TCL_OK) { - Tcl_MutexUnlock(&statusMutex); + Tcl_MutexUnlock(&infoTablesMutex); return result; } - entry = Tcl_FindHashEntry(&statusTable, INT2PTR(pid)); - if (entry && PurgeProcessStatus(entry)) { - Tcl_DeleteHashEntry(entry); + entry = Tcl_FindHashEntry(&infoTablePerPid, INT2PTR(pid)); + if (entry) { + info = (ProcessInfo *) Tcl_GetHashValue(entry); + if (info->status != TCL_PROCESS_UNCHANGED) { + Tcl_DeleteHashEntry(entry); + FreeProcessInfo(info, 0); + } } } - Tcl_MutexUnlock(&statusMutex); + Tcl_MutexUnlock(&infoTablesMutex); } return TCL_OK; @@ -417,13 +623,14 @@ TclInitProcessCmd( }; Tcl_Command processCmd; - if (statusTableInitialized == 0) { - Tcl_MutexLock(&statusMutex); - if (statusTableInitialized == 0) { - Tcl_InitHashTable(&statusTable, TCL_ONE_WORD_KEYS); - statusTableInitialized = 1; + if (infoTablesInitialized == 0) { + Tcl_MutexLock(&infoTablesMutex); + if (infoTablesInitialized == 0) { + Tcl_InitHashTable(&infoTablePerPid, TCL_ONE_WORD_KEYS); + Tcl_InitHashTable(&infoTablePerResolvedPid, TCL_ONE_WORD_KEYS); + infoTablesInitialized = 1; } - Tcl_MutexUnlock(&statusMutex); + Tcl_MutexUnlock(&infoTablesMutex); } processCmd = TclMakeEnsemble(interp, "::tcl::process", processImplMap); @@ -434,7 +641,7 @@ TclInitProcessCmd( /* FRED TODO */ void -TclProcessDetach( +TclProcessCreated( Tcl_Pid pid) { int resolvedPid; @@ -442,233 +649,119 @@ TclProcessDetach( int isNew; ProcessInfo *info; + /* + * Get resolved pid first. + */ + resolvedPid = TclpGetPid(pid); - Tcl_MutexLock(&statusMutex); - entry = Tcl_CreateHashEntry(&statusTable, INT2PTR(resolvedPid), &isNew); + + Tcl_MutexLock(&infoTablesMutex); + + /* + * Create entry in pid table. + */ + + entry = Tcl_CreateHashEntry(&infoTablePerPid, pid, &isNew); if (!isNew) { /* - * Pid was reused, free old status and reuse structure. + * Pid was reused, free old info and reuse structure. */ info = (ProcessInfo *) Tcl_GetHashValue(entry); - if (info->status) { - Tcl_DecrRefCount(info->status); - } - } else { - /* - * Allocate new info structure. - */ - - info = (ProcessInfo *) ckalloc(sizeof(ProcessInfo)); - Tcl_SetHashValue(entry, info); + FreeProcessInfo(info, 0); } - + /* - * Initialize with an empty status. + * Allocate and initialize info structure. */ - info->pid = pid; - info->resolvedPid = resolvedPid; - info->status = NULL; + info = (ProcessInfo *) ckalloc(sizeof(ProcessInfo)); + InitProcessInfo(info, pid, resolvedPid); + + /* + * Add entry to tables. + */ - Tcl_MutexUnlock(&statusMutex); + Tcl_SetHashValue(entry, info); + entry = Tcl_CreateHashEntry(&infoTablePerResolvedPid, INT2PTR(resolvedPid), &isNew); + Tcl_SetHashValue(entry, info); + + Tcl_MutexUnlock(&infoTablesMutex); } + /* FRED TODO */ -int -TclProcessStatus( +TclProcessWaitStatus +TclProcessWait( Tcl_Pid pid, - int options) + int options, + int *codePtr, + Tcl_Obj **msgObjPtr, + Tcl_Obj **errorObjPtr) { - int resolvedPid; Tcl_HashEntry *entry; ProcessInfo *info; - Tcl_Obj *status; - int isNew; - + int result; + /* - * We need to get the resolved pid before we wait on it as the windows - * implementation of Tcl_WaitPid deletes the information such that any - * following calls to TclpGetPid fail. + * First search for pid in table. */ - resolvedPid = TclpGetPid(pid); - - if (!GetProcessStatus(pid, resolvedPid, options, - (autopurge ? NULL /* unused */: &status))) { + entry = Tcl_FindHashEntry(&infoTablePerPid, pid); + if (!entry) { /* - * Process still alive, or non child-related error. + * Unknown process, just call WaitProcessStatus and return. */ - return 0; - } - - if (autopurge) { - /* - * Child terminated, purge. - */ - - Tcl_MutexLock(&statusMutex); - entry = Tcl_FindHashEntry(&statusTable, INT2PTR(resolvedPid)); - if (entry) { - PurgeProcessStatus(entry); - Tcl_DeleteHashEntry(entry); - } - Tcl_MutexUnlock(&statusMutex); - - return 1; + return WaitProcessStatus(pid, TclpGetPid(pid), options, codePtr, + msgObjPtr, errorObjPtr); } - /* - * Store process status. - */ - - Tcl_MutexLock(&statusMutex); - entry = Tcl_CreateHashEntry(&statusTable, INT2PTR(resolvedPid), &isNew); - if (!isNew) { - info = (ProcessInfo *) Tcl_GetHashValue(entry); - if (info->status) { - /* - * Free old status object. - */ - - Tcl_DecrRefCount(info->status); - } - } else { + info = (ProcessInfo *) Tcl_GetHashValue(entry); + if (info->purge) { /* - * Allocate new info structure. + * Process has completed but TclProcessWait has already been called, + * so report no change. */ - - info = (ProcessInfo *) ckalloc(sizeof(ProcessInfo)); - info->pid = pid; - info->resolvedPid = resolvedPid; - Tcl_SetHashValue(entry, info); + + return TCL_PROCESS_UNCHANGED; } - info->status = status; - Tcl_IncrRefCount(status); - Tcl_MutexUnlock(&statusMutex); - - return 1; -} - -/* FRED TODO */ -int -GetProcessStatus( - Tcl_Pid pid, - int resolvedPid, - int options, - Tcl_Obj **statusPtr) -{ - int waitStatus; - Tcl_Obj *statusCodes[5]; - const char *msg; - - pid = Tcl_WaitPid(pid, &waitStatus, options); - if ((pid == 0) || ((pid == (Tcl_Pid) -1) && (errno != ECHILD))) { + RefreshProcessInfo(info, options); + if (info->status == TCL_PROCESS_UNCHANGED) { /* - * Process still alive, or non child-related error. + * No change, stop there. */ - return 0; - } - - if (!statusPtr) { - return 1; + return TCL_PROCESS_UNCHANGED; } /* - * Get process status. + * Set return values. */ - if (pid == (Tcl_Pid) -1) { - /* - * POSIX errName msg - */ + result = info->status; + if (codePtr) *codePtr = info->code; + if (msgObjPtr) *msgObjPtr = info->msg; + if (errorObjPtr) *errorObjPtr = info->error; - statusCodes[0] = Tcl_NewStringObj("POSIX", -1); - statusCodes[1] = Tcl_NewStringObj(Tcl_ErrnoId(), -1); - msg = Tcl_ErrnoMsg(errno); - if (errno == ECHILD) { - /* - * This changeup in message suggested by Mark Diekhans to - * remind people that ECHILD errors can occur on some - * systems if SIGCHLD isn't in its default state. - */ - - msg = "child process lost (is SIGCHLD ignored or trapped?)"; - } - statusCodes[2] = Tcl_NewStringObj(msg, -1); - *statusPtr = Tcl_NewListObj(3, statusCodes); - } else if (WIFEXITED(waitStatus)) { - /* - * CHILDSTATUS pid code - * - * Child exited with a non-zero exit status. - */ - - statusCodes[0] = Tcl_NewStringObj("CHILDSTATUS", -1); - statusCodes[1] = Tcl_NewIntObj(resolvedPid); - statusCodes[2] = Tcl_NewIntObj(WEXITSTATUS(waitStatus)); - *statusPtr = Tcl_NewListObj(3, statusCodes); - } else if (WIFSIGNALED(waitStatus)) { - /* - * CHILDKILLED pid sigName msg - * - * Child killed because of a signal - */ - - statusCodes[0] = Tcl_NewStringObj("CHILDKILLED", -1); - statusCodes[1] = Tcl_NewIntObj(resolvedPid); - statusCodes[2] = Tcl_NewStringObj(Tcl_SignalId(WTERMSIG(waitStatus)), -1); - statusCodes[3] = Tcl_NewStringObj(Tcl_SignalMsg(WTERMSIG(waitStatus)), -1); - *statusPtr = Tcl_NewListObj(4, statusCodes); - } else if (WIFSTOPPED(waitStatus)) { + if (autopurge) { /* - * CHILDSUSP pid sigName msg - * - * Child suspended because of a signal + * Purge now. */ - statusCodes[0] = Tcl_NewStringObj("CHILDSUSP", -1); - statusCodes[1] = Tcl_NewIntObj(resolvedPid); - statusCodes[2] = Tcl_NewStringObj(Tcl_SignalId(WSTOPSIG(waitStatus)), -1); - statusCodes[3] = Tcl_NewStringObj(Tcl_SignalMsg(WSTOPSIG(waitStatus)), -1); - *statusPtr = Tcl_NewListObj(4, statusCodes); + Tcl_DeleteHashEntry(entry); + entry = Tcl_FindHashEntry(&infoTablePerResolvedPid, + INT2PTR(info->resolvedPid)); + Tcl_DeleteHashEntry(entry); + FreeProcessInfo(info, 1); } else { /* - * TCL OPERATION EXEC ODDWAITRESULT - * - * Child wait status didn't make sense. - */ - - statusCodes[0] = Tcl_NewStringObj("TCL", -1); - statusCodes[1] = Tcl_NewStringObj("OPERATION", -1); - statusCodes[2] = Tcl_NewStringObj("EXEC", -1); - statusCodes[3] = Tcl_NewStringObj("ODDWAITRESULT", -1); - statusCodes[4] = Tcl_NewIntObj(resolvedPid); - *statusPtr = Tcl_NewListObj(5, statusCodes); - } - - return 1; -} - -/* FRED TODO */ -int -PurgeProcessStatus( - Tcl_HashEntry *entry) -{ - ProcessInfo *info; - - info = (ProcessInfo *) Tcl_GetHashValue(entry); - if (info->status) { - /* - * Process has ended, purge. + * Eventually purge. Subsequent calls will return + * TCL_PROCESS_UNCHANGED. */ - Tcl_DecrRefCount(info->status); - return 1; + info->purge = 1; } - - return 0; + return result; } -- cgit v0.12 From 935e991786520c81b01c7c2992568703d3d0746f Mon Sep 17 00:00:00 2001 From: "f.bonnet" Date: Sun, 27 Aug 2017 15:24:22 +0000 Subject: On Windows, Tcl_Pids now map to dwProcessId instead of hProcess because the system reuses handles of recently terminated processes. --- win/tclWinPipe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 4666deb..ce132d1 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -876,7 +876,7 @@ TclpGetPid( Tcl_MutexLock(&pipeMutex); for (infoPtr = procList; infoPtr != NULL; infoPtr = infoPtr->nextPtr) { - if (infoPtr->hProcess == (HANDLE) pid) { + if (infoPtr->dwProcessId == (DWORD) pid) { Tcl_MutexUnlock(&pipeMutex); return infoPtr->dwProcessId; } @@ -1187,7 +1187,7 @@ TclpCreateProcess( WaitForInputIdle(procInfo.hProcess, 5000); CloseHandle(procInfo.hThread); - *pidPtr = (Tcl_Pid) procInfo.hProcess; + *pidPtr = (Tcl_Pid) procInfo.dwProcessId; if (*pidPtr != 0) { TclWinAddProcess(procInfo.hProcess, procInfo.dwProcessId); } @@ -2458,7 +2458,7 @@ Tcl_WaitPid( prevPtrPtr = &procList; for (infoPtr = procList; infoPtr != NULL; prevPtrPtr = &infoPtr->nextPtr, infoPtr = infoPtr->nextPtr) { - if (infoPtr->hProcess == (HANDLE) pid) { + if (infoPtr->dwProcessId == (DWORD) pid) { *prevPtrPtr = infoPtr->nextPtr; break; } -- cgit v0.12 From 68b53cfb2571faea3e86f728b3a07222ea9143d0 Mon Sep 17 00:00:00 2001 From: "f.bonnet" Date: Sun, 27 Aug 2017 15:25:57 +0000 Subject: Fixed reference counting issue with objects returned by WaitProcessStatus --- generic/tclInt.h | 17 +++++--- generic/tclPipe.c | 5 ++- generic/tclProcess.c | 110 ++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 93 insertions(+), 39 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index c7a0a0d..32b0d8a 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4025,13 +4025,18 @@ MODULE_SCOPE int TclFullFinalizationRequested(void); * TIP #462. */ +/* + * The following enum values give the status of a spawned process. + */ + typedef enum TclProcessWaitStatus { - TCL_PROCESS_ERROR = -1, - TCL_PROCESS_UNCHANGED = 0, - TCL_PROCESS_EXITED = 1, - TCL_PROCESS_SIGNALED = 2, - TCL_PROCESS_STOPPED = 3, - TCL_PROCESS_UNKNOWN_STATUS = 4 + TCL_PROCESS_ERROR = -1, /* Error waiting for process to exit */ + TCL_PROCESS_UNCHANGED = 0, /* No change since the last call. */ + TCL_PROCESS_EXITED = 1, /* Process has exited. */ + TCL_PROCESS_SIGNALED = 2, /* Child killed because of a signal. */ + TCL_PROCESS_STOPPED = 3, /* Child suspended because of a signal. */ + TCL_PROCESS_UNKNOWN_STATUS = 4 + /* Child wait status didn't make sense. */ } TclProcessWaitStatus; MODULE_SCOPE Tcl_Command TclInitProcessCmd(Tcl_Interp *interp); diff --git a/generic/tclPipe.c b/generic/tclPipe.c index d20d8eb..fa5c55d 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -290,6 +290,8 @@ TclCleanupChildren( Tcl_SetObjErrorCode(interp, error); Tcl_SetObjResult(interp, msg); } + Tcl_DecrRefCount(error); + Tcl_DecrRefCount(msg); continue; } @@ -305,7 +307,6 @@ TclCleanupChildren( if (waitStatus == TCL_PROCESS_EXITED) { if (interp != NULL) { Tcl_SetObjErrorCode(interp, error); - Tcl_DecrRefCount(msg); } abnormalExit = 1; } else if (interp != NULL) { @@ -313,6 +314,8 @@ TclCleanupChildren( Tcl_SetObjResult(interp, msg); } } + Tcl_DecrRefCount(error); + Tcl_DecrRefCount(msg); } /* diff --git a/generic/tclProcess.c b/generic/tclProcess.c index 87fc8bb..bd3467b 100644 --- a/generic/tclProcess.c +++ b/generic/tclProcess.c @@ -44,7 +44,7 @@ TCL_DECLARE_MUTEX(infoTablesMutex) static void InitProcessInfo(ProcessInfo *info, Tcl_Pid pid, int resolvedPid); -static void FreeProcessInfo(ProcessInfo *info, int preserveObjs); +static void FreeProcessInfo(ProcessInfo *info); static int RefreshProcessInfo(ProcessInfo *info, int options); static int WaitProcessStatus(Tcl_Pid pid, int resolvedPid, int options, int *codePtr, Tcl_Obj **msgPtr, @@ -82,16 +82,13 @@ InitProcessInfo( /* FRED TODO */ void FreeProcessInfo( - ProcessInfo *info, - int preserveObjs) + ProcessInfo *info) { - if (!preserveObjs) { - if (info->msg) { - Tcl_DecrRefCount(info->msg); - } - if (info->error) { - Tcl_DecrRefCount(info->error); - } + if (info->msg) { + Tcl_DecrRefCount(info->msg); + } + if (info->error) { + Tcl_DecrRefCount(info->error); } ckfree(info); } @@ -402,7 +399,7 @@ ProcessStatusObjCmd( if (objc == 1) { /* - * Return the list of all child process statuses. + * Return a dict with all child process statuses. */ dict = Tcl_NewDictObj(); @@ -411,10 +408,24 @@ ProcessStatusObjCmd( entry != NULL; entry = Tcl_NextHashEntry(&search)) { info = (ProcessInfo *) Tcl_GetHashValue(entry); RefreshProcessInfo(info, options); - // TODO purge etc. - Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), - BuildProcessStatusObj(info)); + if (info->purge && autopurge) { + /* + * Purge entry. + */ + + Tcl_DeleteHashEntry(entry); + entry = Tcl_FindHashEntry(&infoTablePerPid, info->pid); + Tcl_DeleteHashEntry(entry); + FreeProcessInfo(info); + } else { + /* + * Add to result. + */ + + Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), + BuildProcessStatusObj(info)); + } } Tcl_MutexUnlock(&infoTablesMutex); } else { @@ -448,10 +459,23 @@ ProcessStatusObjCmd( info = (ProcessInfo *) Tcl_GetHashValue(entry); RefreshProcessInfo(info, options); - // TODO purge etc. + if (info->purge && autopurge) { + /* + * Purge entry. + */ + + Tcl_DeleteHashEntry(entry); + entry = Tcl_FindHashEntry(&infoTablePerPid, info->pid); + Tcl_DeleteHashEntry(entry); + FreeProcessInfo(info); + } else { + /* + * Add to result. + */ - Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), - BuildProcessStatusObj(info)); + Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), + BuildProcessStatusObj(info)); + } } Tcl_MutexUnlock(&infoTablesMutex); } @@ -496,18 +520,26 @@ ProcessPurgeObjCmd( return TCL_ERROR; } + /* + * First reap detached procs so that their purge flag is up-to-date. + */ + + Tcl_ReapDetachedProcs(); + if (objc == 1) { /* * Purge all terminated processes. */ Tcl_MutexLock(&infoTablesMutex); - for (entry = Tcl_FirstHashEntry(&infoTablePerPid, &search); entry != NULL; - entry = Tcl_NextHashEntry(&search)) { + for (entry = Tcl_FirstHashEntry(&infoTablePerResolvedPid, &search); + entry != NULL; entry = Tcl_NextHashEntry(&search)) { info = (ProcessInfo *) Tcl_GetHashValue(entry); - if (info->status != TCL_PROCESS_UNCHANGED) { + if (info->purge) { + Tcl_DeleteHashEntry(entry); + entry = Tcl_FindHashEntry(&infoTablePerPid, info->pid); Tcl_DeleteHashEntry(entry); - FreeProcessInfo(info, 0); + FreeProcessInfo(info); } } Tcl_MutexUnlock(&infoTablesMutex); @@ -528,13 +560,21 @@ ProcessPurgeObjCmd( return result; } - entry = Tcl_FindHashEntry(&infoTablePerPid, INT2PTR(pid)); - if (entry) { - info = (ProcessInfo *) Tcl_GetHashValue(entry); - if (info->status != TCL_PROCESS_UNCHANGED) { - Tcl_DeleteHashEntry(entry); - FreeProcessInfo(info, 0); - } + entry = Tcl_FindHashEntry(&infoTablePerResolvedPid, INT2PTR(pid)); + if (!entry) { + /* + * Skip unknown process. + */ + + continue; + } + + info = (ProcessInfo *) Tcl_GetHashValue(entry); + if (info->purge) { + Tcl_DeleteHashEntry(entry); + entry = Tcl_FindHashEntry(&infoTablePerPid, info->pid); + Tcl_DeleteHashEntry(entry); + FreeProcessInfo(info); } } Tcl_MutexUnlock(&infoTablesMutex); @@ -668,7 +708,7 @@ TclProcessCreated( */ info = (ProcessInfo *) Tcl_GetHashValue(entry); - FreeProcessInfo(info, 0); + FreeProcessInfo(info); } /* @@ -683,7 +723,8 @@ TclProcessCreated( */ Tcl_SetHashValue(entry, info); - entry = Tcl_CreateHashEntry(&infoTablePerResolvedPid, INT2PTR(resolvedPid), &isNew); + entry = Tcl_CreateHashEntry(&infoTablePerResolvedPid, INT2PTR(resolvedPid), + &isNew); Tcl_SetHashValue(entry, info); Tcl_MutexUnlock(&infoTablesMutex); @@ -713,8 +754,11 @@ TclProcessWait( * Unknown process, just call WaitProcessStatus and return. */ - return WaitProcessStatus(pid, TclpGetPid(pid), options, codePtr, + result = WaitProcessStatus(pid, TclpGetPid(pid), options, codePtr, msgObjPtr, errorObjPtr); + if (msgObjPtr && *msgObjPtr) Tcl_IncrRefCount(*msgObjPtr); + if (errorObjPtr && *errorObjPtr) Tcl_IncrRefCount(*errorObjPtr); + return result; } info = (ProcessInfo *) Tcl_GetHashValue(entry); @@ -744,6 +788,8 @@ TclProcessWait( if (codePtr) *codePtr = info->code; if (msgObjPtr) *msgObjPtr = info->msg; if (errorObjPtr) *errorObjPtr = info->error; + if (msgObjPtr && *msgObjPtr) Tcl_IncrRefCount(*msgObjPtr); + if (errorObjPtr && *errorObjPtr) Tcl_IncrRefCount(*errorObjPtr); if (autopurge) { /* @@ -754,7 +800,7 @@ TclProcessWait( entry = Tcl_FindHashEntry(&infoTablePerResolvedPid, INT2PTR(info->resolvedPid)); Tcl_DeleteHashEntry(entry); - FreeProcessInfo(info, 1); + FreeProcessInfo(info); } else { /* * Eventually purge. Subsequent calls will return -- cgit v0.12 From 0a8718312d30c1e90db63395404caa10c890d9a4 Mon Sep 17 00:00:00 2001 From: "f.bonnet" Date: Sun, 27 Aug 2017 21:25:14 +0000 Subject: Comments and formatting --- generic/tclPipe.c | 2 +- generic/tclProcess.c | 923 +++++++++++++++++++++++++++++---------------------- 2 files changed, 532 insertions(+), 393 deletions(-) diff --git a/generic/tclPipe.c b/generic/tclPipe.c index fa5c55d..bc760b6 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -345,7 +345,7 @@ TclCleanupChildren( Tcl_PosixError(interp))); } else if (count > 0) { anyErrorInfo = 1; - Tcl_SetObjResult(interp, objPtr); + Tcl_SetObjResult(interp, objPtr); result = TCL_ERROR; } else { Tcl_DecrRefCount(objPtr); diff --git a/generic/tclProcess.c b/generic/tclProcess.c index bd3467b..8d98a23 100644 --- a/generic/tclProcess.c +++ b/generic/tclProcess.c @@ -2,7 +2,7 @@ * tclProcess.c -- * * This file implements the "tcl::process" ensemble for subprocess - * management as defined by TIP #462. + * management as defined by TIP #462. * * Copyright (c) 2017 Frederic Bonnet. * @@ -17,7 +17,7 @@ * processes (see tclPipe.c). */ -static int autopurge = 1; /* Autopurge flag. */ +static int autopurge = 1; /* Autopurge flag. */ /* * Hash tables that keeps track of all child process statuses. Keys are the @@ -25,13 +25,14 @@ static int autopurge = 1; /* Autopurge flag. */ */ typedef struct ProcessInfo { - Tcl_Pid pid; /*FRED TODO*/ - int resolvedPid; /*FRED TODO*/ - int purge; /*FRED TODO*/ - TclProcessWaitStatus status; - int code; /*FRED TODO*/ - Tcl_Obj *msg; /*FRED TODO*/ - Tcl_Obj *error; /*FRED TODO*/ + Tcl_Pid pid; /* Process id. */ + int resolvedPid; /* Resolved process id. */ + int purge; /* Purge eventualy. */ + TclProcessWaitStatus status;/* Process status. */ + int code; /* Error code, exit status or signal + number. */ + Tcl_Obj *msg; /* Error message. */ + Tcl_Obj *error; /* Error code. */ } ProcessInfo; static Tcl_HashTable infoTablePerPid; static Tcl_HashTable infoTablePerResolvedPid; @@ -42,33 +43,48 @@ TCL_DECLARE_MUTEX(infoTablesMutex) * Prototypes for functions defined later in this file: */ -static void InitProcessInfo(ProcessInfo *info, Tcl_Pid pid, - int resolvedPid); -static void FreeProcessInfo(ProcessInfo *info); -static int RefreshProcessInfo(ProcessInfo *info, int options); -static int WaitProcessStatus(Tcl_Pid pid, int resolvedPid, +static void InitProcessInfo(ProcessInfo *info, Tcl_Pid pid, + int resolvedPid); +static void FreeProcessInfo(ProcessInfo *info); +static int RefreshProcessInfo(ProcessInfo *info, int options); +static TclProcessWaitStatus WaitProcessStatus(Tcl_Pid pid, int resolvedPid, int options, int *codePtr, Tcl_Obj **msgPtr, - Tcl_Obj **errorObjPtr); -static Tcl_Obj * BuildProcessStatusObj(ProcessInfo *info); -static int ProcessListObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int ProcessStatusObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int ProcessPurgeObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); -static int ProcessAutopurgeObjCmd(ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *const objv[]); - -/* FRED TODO */ + Tcl_Obj **errorObjPtr); +static Tcl_Obj * BuildProcessStatusObj(ProcessInfo *info); +static int ProcessListObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +static int ProcessStatusObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +static int ProcessPurgeObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +static int ProcessAutopurgeObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); + +/* + *---------------------------------------------------------------------- + * + * InitProcessInfo -- + * + * Initializes the ProcessInfo structure. + * + * Results: + * None. + * + * Side effects: + * Memory written. + * + *---------------------------------------------------------------------- + */ + void InitProcessInfo( - ProcessInfo *info, - Tcl_Pid pid, - int resolvedPid) + ProcessInfo *info, /* Structure to initialize. */ + Tcl_Pid pid, /* Process id. */ + int resolvedPid) /* Resolved process id. */ { info->pid = pid; info->resolvedPid = resolvedPid; @@ -79,51 +95,115 @@ InitProcessInfo( info->error = NULL; } -/* FRED TODO */ +/* + *---------------------------------------------------------------------- + * + * FreeProcessInfo -- + * + * Free the ProcessInfo structure. + * + * Results: + * None. + * + * Side effects: + * Memory deallocated, Tcl_Obj refcount decreased. + * + *---------------------------------------------------------------------- + */ + void FreeProcessInfo( - ProcessInfo *info) + ProcessInfo *info) /* Structure to free. */ { + /* + * Free stored Tcl_Objs. + */ + if (info->msg) { - Tcl_DecrRefCount(info->msg); + Tcl_DecrRefCount(info->msg); } if (info->error) { - Tcl_DecrRefCount(info->error); + Tcl_DecrRefCount(info->error); } + + /* + * Free allocated structure. + */ + ckfree(info); } -/* FRED TODO */ +/* + *---------------------------------------------------------------------- + * + * RefreshProcessInfo -- + * + * Refresh process info. + * + * Results: + * Nonzero if state changed, else zero. + * + * Side effects: + * May call WaitProcessStatus, which can block if WNOHANG option is set. + * + *---------------------------------------------------------------------- + */ + int RefreshProcessInfo( - ProcessInfo *info, - int options + ProcessInfo *info, /* Structure to refresh. */ + int options /* Options passed to WaitProcessStatus. */ ) { if (info->status == TCL_PROCESS_UNCHANGED) { - /* - * Refresh & store status. - */ - - info->status = WaitProcessStatus(info->pid, info->resolvedPid, - options, &info->code, &info->msg, &info->error); - if (info->msg) Tcl_IncrRefCount(info->msg); - if (info->error) Tcl_IncrRefCount(info->error); - return (info->status != TCL_PROCESS_UNCHANGED); + /* + * Refresh & store status. + */ + + info->status = WaitProcessStatus(info->pid, info->resolvedPid, + options, &info->code, &info->msg, &info->error); + if (info->msg) Tcl_IncrRefCount(info->msg); + if (info->error) Tcl_IncrRefCount(info->error); + return (info->status != TCL_PROCESS_UNCHANGED); } else { - return 0; + /* + * No change. + */ + + return 0; } } -/* FRED TODO */ -int +/* + *---------------------------------------------------------------------- + * + * WaitProcessStatus -- + * + * Wait for process status to change. + * + * Results: + * TclProcessWaitStatus enum value. + * + * Side effects: + * May call WaitProcessStatus, which can block if WNOHANG option is set. + * + *---------------------------------------------------------------------- + */ + +TclProcessWaitStatus WaitProcessStatus( - Tcl_Pid pid, - int resolvedPid, - int options, - int *codePtr, - Tcl_Obj **msgObjPtr, - Tcl_Obj **errorObjPtr) + Tcl_Pid pid, /* Process id. */ + int resolvedPid, /* Resolved process id. */ + int options, /* Options passed to Tcl_WaitPid. */ + int *codePtr, /* If non-NULL, will receive either: + * - 0 for normal exit. + * - errno in case of error. + * - non-zero exit code for abormal exit. + * - signal number if killed or suspended. + * - Tcl_WaitPid status in all other cases. + */ + Tcl_Obj **msgObjPtr, /* If non-NULL, will receive error message. */ + Tcl_Obj **errorObjPtr) /* If non-NULL, will receive error code. */ { int waitStatus; Tcl_Obj *errorStrings[5]; @@ -131,11 +211,11 @@ WaitProcessStatus( pid = Tcl_WaitPid(pid, &waitStatus, options); if ((pid == 0)) { - /* - * No change. - */ - - return TCL_PROCESS_UNCHANGED; + /* + * No change. + */ + + return TCL_PROCESS_UNCHANGED; } /* @@ -143,117 +223,136 @@ WaitProcessStatus( */ if (pid == (Tcl_Pid) -1) { - /* - * POSIX errName msg - */ - - msg = Tcl_ErrnoMsg(errno); - if (errno == ECHILD) { - /* - * This changeup in message suggested by Mark Diekhans to - * remind people that ECHILD errors can occur on some - * systems if SIGCHLD isn't in its default state. - */ - - msg = "child process lost (is SIGCHLD ignored or trapped?)"; - } - if (codePtr) *codePtr = errno; - if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf( - "error waiting for process to exit: %s", msg); - if (errorObjPtr) { - errorStrings[0] = Tcl_NewStringObj("POSIX", -1); - errorStrings[1] = Tcl_NewStringObj(Tcl_ErrnoId(), -1); - errorStrings[2] = Tcl_NewStringObj(msg, -1); - *errorObjPtr = Tcl_NewListObj(3, errorStrings); - } - return TCL_PROCESS_ERROR; + /* + * POSIX errName msg + */ + + msg = Tcl_ErrnoMsg(errno); + if (errno == ECHILD) { + /* + * This changeup in message suggested by Mark Diekhans to + * remind people that ECHILD errors can occur on some + * systems if SIGCHLD isn't in its default state. + */ + + msg = "child process lost (is SIGCHLD ignored or trapped?)"; + } + if (codePtr) *codePtr = errno; + if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf( + "error waiting for process to exit: %s", msg); + if (errorObjPtr) { + errorStrings[0] = Tcl_NewStringObj("POSIX", -1); + errorStrings[1] = Tcl_NewStringObj(Tcl_ErrnoId(), -1); + errorStrings[2] = Tcl_NewStringObj(msg, -1); + *errorObjPtr = Tcl_NewListObj(3, errorStrings); + } + return TCL_PROCESS_ERROR; } else if (WIFEXITED(waitStatus)) { - if (codePtr) *codePtr = WEXITSTATUS(waitStatus); - if (!WEXITSTATUS(waitStatus)) { - /* - * Normal exit. - */ - - if (msgObjPtr) *msgObjPtr = NULL; - if (errorObjPtr) *errorObjPtr = NULL; - } else { - /* - * CHILDSTATUS pid code - * - * Child exited with a non-zero exit status. - */ - - if (msgObjPtr) *msgObjPtr = Tcl_NewStringObj( - "child process exited abnormally", -1); - if (errorObjPtr) { - errorStrings[0] = Tcl_NewStringObj("CHILDSTATUS", -1); - errorStrings[1] = Tcl_NewIntObj(resolvedPid); - errorStrings[2] = Tcl_NewIntObj(WEXITSTATUS(waitStatus)); - *errorObjPtr = Tcl_NewListObj(3, errorStrings); - } - } - return TCL_PROCESS_EXITED; + if (codePtr) *codePtr = WEXITSTATUS(waitStatus); + if (!WEXITSTATUS(waitStatus)) { + /* + * Normal exit. + */ + + if (msgObjPtr) *msgObjPtr = NULL; + if (errorObjPtr) *errorObjPtr = NULL; + } else { + /* + * CHILDSTATUS pid code + * + * Child exited with a non-zero exit status. + */ + + if (msgObjPtr) *msgObjPtr = Tcl_NewStringObj( + "child process exited abnormally", -1); + if (errorObjPtr) { + errorStrings[0] = Tcl_NewStringObj("CHILDSTATUS", -1); + errorStrings[1] = Tcl_NewIntObj(resolvedPid); + errorStrings[2] = Tcl_NewIntObj(WEXITSTATUS(waitStatus)); + *errorObjPtr = Tcl_NewListObj(3, errorStrings); + } + } + return TCL_PROCESS_EXITED; } else if (WIFSIGNALED(waitStatus)) { - /* - * CHILDKILLED pid sigName msg - * - * Child killed because of a signal. - */ - - msg = Tcl_SignalMsg(WTERMSIG(waitStatus)); - if (codePtr) *codePtr = WTERMSIG(waitStatus); - if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf( - "child killed: %s", msg); - if (errorObjPtr) { - errorStrings[0] = Tcl_NewStringObj("CHILDKILLED", -1); - errorStrings[1] = Tcl_NewIntObj(resolvedPid); - errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WTERMSIG(waitStatus)), -1); - errorStrings[3] = Tcl_NewStringObj(msg, -1); - *errorObjPtr = Tcl_NewListObj(4, errorStrings); - } - return TCL_PROCESS_SIGNALED; + /* + * CHILDKILLED pid sigName msg + * + * Child killed because of a signal. + */ + + msg = Tcl_SignalMsg(WTERMSIG(waitStatus)); + if (codePtr) *codePtr = WTERMSIG(waitStatus); + if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf( + "child killed: %s", msg); + if (errorObjPtr) { + errorStrings[0] = Tcl_NewStringObj("CHILDKILLED", -1); + errorStrings[1] = Tcl_NewIntObj(resolvedPid); + errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WTERMSIG(waitStatus)), -1); + errorStrings[3] = Tcl_NewStringObj(msg, -1); + *errorObjPtr = Tcl_NewListObj(4, errorStrings); + } + return TCL_PROCESS_SIGNALED; } else if (WIFSTOPPED(waitStatus)) { - /* - * CHILDSUSP pid sigName msg - * - * Child suspended because of a signal. - */ - - msg = Tcl_SignalMsg(WSTOPSIG(waitStatus)); - if (codePtr) *codePtr = WSTOPSIG(waitStatus); - if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf( - "child suspended: %s", msg); - if (errorObjPtr) { - errorStrings[0] = Tcl_NewStringObj("CHILDSUSP", -1); - errorStrings[1] = Tcl_NewIntObj(resolvedPid); - errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WSTOPSIG(waitStatus)), -1); - errorStrings[3] = Tcl_NewStringObj(msg, -1); - *errorObjPtr = Tcl_NewListObj(4, errorStrings); - } - return TCL_PROCESS_STOPPED; + /* + * CHILDSUSP pid sigName msg + * + * Child suspended because of a signal. + */ + + msg = Tcl_SignalMsg(WSTOPSIG(waitStatus)); + if (codePtr) *codePtr = WSTOPSIG(waitStatus); + if (msgObjPtr) *msgObjPtr = Tcl_ObjPrintf( + "child suspended: %s", msg); + if (errorObjPtr) { + errorStrings[0] = Tcl_NewStringObj("CHILDSUSP", -1); + errorStrings[1] = Tcl_NewIntObj(resolvedPid); + errorStrings[2] = Tcl_NewStringObj(Tcl_SignalId(WSTOPSIG(waitStatus)), -1); + errorStrings[3] = Tcl_NewStringObj(msg, -1); + *errorObjPtr = Tcl_NewListObj(4, errorStrings); + } + return TCL_PROCESS_STOPPED; } else { - /* - * TCL OPERATION EXEC ODDWAITRESULT - * - * Child wait status didn't make sense. - */ - - if (codePtr) *codePtr = waitStatus; - if (msgObjPtr) *msgObjPtr = Tcl_NewStringObj( - "child wait status didn't make sense\n", -1); - if (errorObjPtr) { - errorStrings[0] = Tcl_NewStringObj("TCL", -1); - errorStrings[1] = Tcl_NewStringObj("OPERATION", -1); - errorStrings[2] = Tcl_NewStringObj("EXEC", -1); - errorStrings[3] = Tcl_NewStringObj("ODDWAITRESULT", -1); - errorStrings[4] = Tcl_NewIntObj(resolvedPid); - *errorObjPtr = Tcl_NewListObj(5, errorStrings); - } - return TCL_PROCESS_UNKNOWN_STATUS; + /* + * TCL OPERATION EXEC ODDWAITRESULT + * + * Child wait status didn't make sense. + */ + + if (codePtr) *codePtr = waitStatus; + if (msgObjPtr) *msgObjPtr = Tcl_NewStringObj( + "child wait status didn't make sense\n", -1); + if (errorObjPtr) { + errorStrings[0] = Tcl_NewStringObj("TCL", -1); + errorStrings[1] = Tcl_NewStringObj("OPERATION", -1); + errorStrings[2] = Tcl_NewStringObj("EXEC", -1); + errorStrings[3] = Tcl_NewStringObj("ODDWAITRESULT", -1); + errorStrings[4] = Tcl_NewIntObj(resolvedPid); + *errorObjPtr = Tcl_NewListObj(5, errorStrings); + } + return TCL_PROCESS_UNKNOWN_STATUS; } } -/* FRED TODO */ + +/* + *---------------------------------------------------------------------- + * + * BuildProcessStatusObj -- + * + * Build a list object with process status. The first element is always + * a standard Tcl return value, which can be either TCL_OK or TCL_ERROR. + * In the latter case, the second element is the error message and the + * third element is a Tcl error code (see tclvars). + * + * Results: + * A list object. + * + * Side effects: + * Tcl_Objs are created. + * + *---------------------------------------------------------------------- + */ + Tcl_Obj * BuildProcessStatusObj( ProcessInfo *info) @@ -261,18 +360,18 @@ BuildProcessStatusObj( Tcl_Obj *resultObjs[3]; if (info->status == TCL_PROCESS_UNCHANGED) { - /* - * Process still running, return empty obj. - */ + /* + * Process still running, return empty obj. + */ - return Tcl_NewObj(); + return Tcl_NewObj(); } if (info->status == TCL_PROCESS_EXITED && info->code == 0) { - /* - * Normal exit, return TCL_OK. - */ - - return Tcl_NewIntObj(TCL_OK); + /* + * Normal exit, return TCL_OK. + */ + + return Tcl_NewIntObj(TCL_OK); } /* @@ -290,13 +389,13 @@ BuildProcessStatusObj( * ProcessListObjCmd -- * * This function implements the 'tcl::process list' Tcl command. - * Refer to the user documentation for details on what it does. + * Refer to the user documentation for details on what it does. * * Results: * Returns a standard Tcl result. * * Side effects: - * None.FRED TODO + * Access to the internal structures is protected by infoTablesMutex. * *---------------------------------------------------------------------- */ @@ -325,10 +424,10 @@ ProcessListObjCmd( list = Tcl_NewListObj(0, NULL); Tcl_MutexLock(&infoTablesMutex); for (entry = Tcl_FirstHashEntry(&infoTablePerResolvedPid, &search); - entry != NULL; entry = Tcl_NextHashEntry(&search)) { - info = (ProcessInfo *) Tcl_GetHashValue(entry); - Tcl_ListObjAppendElement(interp, list, - Tcl_NewIntObj(info->resolvedPid)); + entry != NULL; entry = Tcl_NextHashEntry(&search)) { + info = (ProcessInfo *) Tcl_GetHashValue(entry); + Tcl_ListObjAppendElement(interp, list, + Tcl_NewIntObj(info->resolvedPid)); } Tcl_MutexUnlock(&infoTablesMutex); Tcl_SetObjResult(interp, list); @@ -340,13 +439,14 @@ ProcessListObjCmd( * ProcessStatusObjCmd -- * * This function implements the 'tcl::process status' Tcl command. - * Refer to the user documentation for details on what it does. + * Refer to the user documentation for details on what it does. * * Results: * Returns a standard Tcl result. * * Side effects: - * None.FRED TODO + * Access to the internal structures is protected by infoTablesMutex. + * Calls RefreshProcessInfo, which can block if -wait switch is given. * *---------------------------------------------------------------------- */ @@ -375,7 +475,7 @@ ProcessStatusObjCmd( enum switches { STATUS_WAIT, STATUS_LAST }; - + while (objc > 1) { if (TclGetString(objv[1])[0] != '-') { break; @@ -391,93 +491,93 @@ ProcessStatusObjCmd( break; } } - + if (objc != 1 && objc != 2) { Tcl_WrongNumArgs(interp, 1, savedobjv, "?switches? ?pids?"); return TCL_ERROR; } if (objc == 1) { - /* - * Return a dict with all child process statuses. - */ - - dict = Tcl_NewDictObj(); - Tcl_MutexLock(&infoTablesMutex); - for (entry = Tcl_FirstHashEntry(&infoTablePerResolvedPid, &search); - entry != NULL; entry = Tcl_NextHashEntry(&search)) { - info = (ProcessInfo *) Tcl_GetHashValue(entry); - RefreshProcessInfo(info, options); - - if (info->purge && autopurge) { - /* - * Purge entry. - */ - - Tcl_DeleteHashEntry(entry); - entry = Tcl_FindHashEntry(&infoTablePerPid, info->pid); - Tcl_DeleteHashEntry(entry); - FreeProcessInfo(info); - } else { - /* - * Add to result. - */ - - Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), - BuildProcessStatusObj(info)); - } - } - Tcl_MutexUnlock(&infoTablesMutex); + /* + * Return a dict with all child process statuses. + */ + + dict = Tcl_NewDictObj(); + Tcl_MutexLock(&infoTablesMutex); + for (entry = Tcl_FirstHashEntry(&infoTablePerResolvedPid, &search); + entry != NULL; entry = Tcl_NextHashEntry(&search)) { + info = (ProcessInfo *) Tcl_GetHashValue(entry); + RefreshProcessInfo(info, options); + + if (info->purge && autopurge) { + /* + * Purge entry. + */ + + Tcl_DeleteHashEntry(entry); + entry = Tcl_FindHashEntry(&infoTablePerPid, info->pid); + Tcl_DeleteHashEntry(entry); + FreeProcessInfo(info); + } else { + /* + * Add to result. + */ + + Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), + BuildProcessStatusObj(info)); + } + } + Tcl_MutexUnlock(&infoTablesMutex); } else { - /* - * Only return statuses of provided processes. - */ - - result = Tcl_ListObjGetElements(interp, objv[1], &numPids, &pidObjs); - if (result != TCL_OK) { - return result; - } - dict = Tcl_NewDictObj(); - Tcl_MutexLock(&infoTablesMutex); - for (i = 0; i < numPids; i++) { - result = Tcl_GetIntFromObj(interp, pidObjs[i], (int *) &pid); - if (result != TCL_OK) { - Tcl_MutexUnlock(&infoTablesMutex); - Tcl_DecrRefCount(dict); - return result; - } - - entry = Tcl_FindHashEntry(&infoTablePerResolvedPid, INT2PTR(pid)); - if (!entry) { - /* - * Skip unknown process. - */ - - continue; - } - - info = (ProcessInfo *) Tcl_GetHashValue(entry); - RefreshProcessInfo(info, options); - - if (info->purge && autopurge) { - /* - * Purge entry. - */ - - Tcl_DeleteHashEntry(entry); - entry = Tcl_FindHashEntry(&infoTablePerPid, info->pid); - Tcl_DeleteHashEntry(entry); - FreeProcessInfo(info); - } else { - /* - * Add to result. - */ - - Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), - BuildProcessStatusObj(info)); - } - } - Tcl_MutexUnlock(&infoTablesMutex); + /* + * Only return statuses of provided processes. + */ + + result = Tcl_ListObjGetElements(interp, objv[1], &numPids, &pidObjs); + if (result != TCL_OK) { + return result; + } + dict = Tcl_NewDictObj(); + Tcl_MutexLock(&infoTablesMutex); + for (i = 0; i < numPids; i++) { + result = Tcl_GetIntFromObj(interp, pidObjs[i], (int *) &pid); + if (result != TCL_OK) { + Tcl_MutexUnlock(&infoTablesMutex); + Tcl_DecrRefCount(dict); + return result; + } + + entry = Tcl_FindHashEntry(&infoTablePerResolvedPid, INT2PTR(pid)); + if (!entry) { + /* + * Skip unknown process. + */ + + continue; + } + + info = (ProcessInfo *) Tcl_GetHashValue(entry); + RefreshProcessInfo(info, options); + + if (info->purge && autopurge) { + /* + * Purge entry. + */ + + Tcl_DeleteHashEntry(entry); + entry = Tcl_FindHashEntry(&infoTablePerPid, info->pid); + Tcl_DeleteHashEntry(entry); + FreeProcessInfo(info); + } else { + /* + * Add to result. + */ + + Tcl_DictObjPut(interp, dict, Tcl_NewIntObj(info->resolvedPid), + BuildProcessStatusObj(info)); + } + } + Tcl_MutexUnlock(&infoTablesMutex); } Tcl_SetObjResult(interp, dict); return TCL_OK; @@ -488,13 +588,13 @@ ProcessStatusObjCmd( * ProcessPurgeObjCmd -- * * This function implements the 'tcl::process purge' Tcl command. - * Refer to the user documentation for details on what it does. + * Refer to the user documentation for details on what it does. * * Results: * Returns a standard Tcl result. * * Side effects: - * None.FRED TODO + * Frees all ProcessInfo structures with their purge flag set. * *---------------------------------------------------------------------- */ @@ -525,61 +625,61 @@ ProcessPurgeObjCmd( */ Tcl_ReapDetachedProcs(); - + if (objc == 1) { - /* - * Purge all terminated processes. - */ - - Tcl_MutexLock(&infoTablesMutex); - for (entry = Tcl_FirstHashEntry(&infoTablePerResolvedPid, &search); - entry != NULL; entry = Tcl_NextHashEntry(&search)) { - info = (ProcessInfo *) Tcl_GetHashValue(entry); - if (info->purge) { - Tcl_DeleteHashEntry(entry); - entry = Tcl_FindHashEntry(&infoTablePerPid, info->pid); - Tcl_DeleteHashEntry(entry); - FreeProcessInfo(info); - } - } - Tcl_MutexUnlock(&infoTablesMutex); + /* + * Purge all terminated processes. + */ + + Tcl_MutexLock(&infoTablesMutex); + for (entry = Tcl_FirstHashEntry(&infoTablePerResolvedPid, &search); + entry != NULL; entry = Tcl_NextHashEntry(&search)) { + info = (ProcessInfo *) Tcl_GetHashValue(entry); + if (info->purge) { + Tcl_DeleteHashEntry(entry); + entry = Tcl_FindHashEntry(&infoTablePerPid, info->pid); + Tcl_DeleteHashEntry(entry); + FreeProcessInfo(info); + } + } + Tcl_MutexUnlock(&infoTablesMutex); } else { - /* - * Purge only provided processes. - */ - - result = Tcl_ListObjGetElements(interp, objv[1], &numPids, &pidObjs); - if (result != TCL_OK) { - return result; - } - Tcl_MutexLock(&infoTablesMutex); - for (i = 0; i < numPids; i++) { - result = Tcl_GetIntFromObj(interp, pidObjs[i], (int *) &pid); - if (result != TCL_OK) { - Tcl_MutexUnlock(&infoTablesMutex); - return result; - } - - entry = Tcl_FindHashEntry(&infoTablePerResolvedPid, INT2PTR(pid)); - if (!entry) { - /* - * Skip unknown process. - */ - - continue; - } - - info = (ProcessInfo *) Tcl_GetHashValue(entry); - if (info->purge) { - Tcl_DeleteHashEntry(entry); - entry = Tcl_FindHashEntry(&infoTablePerPid, info->pid); - Tcl_DeleteHashEntry(entry); - FreeProcessInfo(info); - } - } - Tcl_MutexUnlock(&infoTablesMutex); + /* + * Purge only provided processes. + */ + + result = Tcl_ListObjGetElements(interp, objv[1], &numPids, &pidObjs); + if (result != TCL_OK) { + return result; + } + Tcl_MutexLock(&infoTablesMutex); + for (i = 0; i < numPids; i++) { + result = Tcl_GetIntFromObj(interp, pidObjs[i], (int *) &pid); + if (result != TCL_OK) { + Tcl_MutexUnlock(&infoTablesMutex); + return result; + } + + entry = Tcl_FindHashEntry(&infoTablePerResolvedPid, INT2PTR(pid)); + if (!entry) { + /* + * Skip unknown process. + */ + + continue; + } + + info = (ProcessInfo *) Tcl_GetHashValue(entry); + if (info->purge) { + Tcl_DeleteHashEntry(entry); + entry = Tcl_FindHashEntry(&infoTablePerPid, info->pid); + Tcl_DeleteHashEntry(entry); + FreeProcessInfo(info); + } + } + Tcl_MutexUnlock(&infoTablesMutex); } - + return TCL_OK; } @@ -588,7 +688,7 @@ ProcessPurgeObjCmd( * ProcessAutopurgeObjCmd -- * * This function implements the 'tcl::process autopurge' Tcl command. - * Refer to the user documentation for details on what it does. + * Refer to the user documentation for details on what it does. * * Results: * Returns a standard Tcl result. @@ -612,17 +712,17 @@ ProcessAutopurgeObjCmd( } if (objc == 2) { - /* - * Set given value. - */ - - int flag; - int result = Tcl_GetBooleanFromObj(interp, objv[1], &flag); - if (result != TCL_OK) { - return result; - } - - autopurge = !!flag; + /* + * Set given value. + */ + + int flag; + int result = Tcl_GetBooleanFromObj(interp, objv[1], &flag); + if (result != TCL_OK) { + return result; + } + + autopurge = !!flag; } /* @@ -655,11 +755,11 @@ TclInitProcessCmd( Tcl_Interp *interp) /* Current interpreter. */ { static const EnsembleImplMap processImplMap[] = { - {"list", ProcessListObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 1}, - {"status", ProcessStatusObjCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 1}, - {"purge", ProcessPurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1}, - {"autopurge", ProcessAutopurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1}, - {NULL, NULL, NULL, NULL, NULL, 0} + {"list", ProcessListObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 1}, + {"status", ProcessStatusObjCmd, TclCompileBasicMin0ArgCmd, NULL, NULL, 1}, + {"purge", ProcessPurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1}, + {"autopurge", ProcessAutopurgeObjCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 1}, + {NULL, NULL, NULL, NULL, NULL, 0} }; Tcl_Command processCmd; @@ -672,20 +772,35 @@ TclInitProcessCmd( } Tcl_MutexUnlock(&infoTablesMutex); } - + processCmd = TclMakeEnsemble(interp, "::tcl::process", processImplMap); Tcl_Export(interp, Tcl_FindNamespace(interp, "::tcl", NULL, 0), - "process", 0); + "process", 0); return processCmd; } -/* FRED TODO */ +/* + *---------------------------------------------------------------------- + * + * TclProcessCreated -- + * + * Called when a child process has been created by Tcl. + * + * Results: + * None. + * + * Side effects: + * Internal structures are updated with a new ProcessInfo. + * + *---------------------------------------------------------------------- + */ + void TclProcessCreated( - Tcl_Pid pid) + Tcl_Pid pid) /* Process id. */ { int resolvedPid; - Tcl_HashEntry *entry; + Tcl_HashEntry *entry, *entry2; int isNew; ProcessInfo *info; @@ -694,7 +809,7 @@ TclProcessCreated( */ resolvedPid = TclpGetPid(pid); - + Tcl_MutexLock(&infoTablesMutex); /* @@ -703,12 +818,15 @@ TclProcessCreated( entry = Tcl_CreateHashEntry(&infoTablePerPid, pid, &isNew); if (!isNew) { - /* - * Pid was reused, free old info and reuse structure. - */ - - info = (ProcessInfo *) Tcl_GetHashValue(entry); - FreeProcessInfo(info); + /* + * Pid was reused, free old info and reuse structure. + */ + + info = (ProcessInfo *) Tcl_GetHashValue(entry); + entry2 = Tcl_FindHashEntry(&infoTablePerResolvedPid, + INT2PTR(resolvedPid)); + if (entry2) Tcl_DeleteHashEntry(entry2); + FreeProcessInfo(info); } /* @@ -717,32 +835,53 @@ TclProcessCreated( info = (ProcessInfo *) ckalloc(sizeof(ProcessInfo)); InitProcessInfo(info, pid, resolvedPid); - + /* * Add entry to tables. */ Tcl_SetHashValue(entry, info); entry = Tcl_CreateHashEntry(&infoTablePerResolvedPid, INT2PTR(resolvedPid), - &isNew); + &isNew); Tcl_SetHashValue(entry, info); - + Tcl_MutexUnlock(&infoTablesMutex); } +/* + *---------------------------------------------------------------------- + * + * TclProcessWait -- + * + * Wait for process status to change. + * + * Results: + * TclProcessWaitStatus enum value. + * + * Side effects: + * Completed process info structures are purged immediately (autopurge on) + * or eventually (autopurge off). + * + *---------------------------------------------------------------------- + */ -/* FRED TODO */ TclProcessWaitStatus TclProcessWait( - Tcl_Pid pid, - int options, - int *codePtr, - Tcl_Obj **msgObjPtr, - Tcl_Obj **errorObjPtr) + Tcl_Pid pid, /* Process id. */ + int options, /* Options passed to WaitProcessStatus. */ + int *codePtr, /* If non-NULL, will receive either: + * - 0 for normal exit. + * - errno in case of error. + * - non-zero exit code for abormal exit. + * - signal number if killed or suspended. + * - Tcl_WaitPid status in all other cases. + */ + Tcl_Obj **msgObjPtr, /* If non-NULL, will receive error message. */ + Tcl_Obj **errorObjPtr) /* If non-NULL, will receive error code. */ { Tcl_HashEntry *entry; ProcessInfo *info; - int result; + TclProcessWaitStatus result; /* * First search for pid in table. @@ -750,34 +889,34 @@ TclProcessWait( entry = Tcl_FindHashEntry(&infoTablePerPid, pid); if (!entry) { - /* - * Unknown process, just call WaitProcessStatus and return. - */ - - result = WaitProcessStatus(pid, TclpGetPid(pid), options, codePtr, - msgObjPtr, errorObjPtr); - if (msgObjPtr && *msgObjPtr) Tcl_IncrRefCount(*msgObjPtr); - if (errorObjPtr && *errorObjPtr) Tcl_IncrRefCount(*errorObjPtr); - return result; + /* + * Unknown process, just call WaitProcessStatus and return. + */ + + result = WaitProcessStatus(pid, TclpGetPid(pid), options, codePtr, + msgObjPtr, errorObjPtr); + if (msgObjPtr && *msgObjPtr) Tcl_IncrRefCount(*msgObjPtr); + if (errorObjPtr && *errorObjPtr) Tcl_IncrRefCount(*errorObjPtr); + return result; } info = (ProcessInfo *) Tcl_GetHashValue(entry); if (info->purge) { - /* - * Process has completed but TclProcessWait has already been called, - * so report no change. - */ - - return TCL_PROCESS_UNCHANGED; + /* + * Process has completed but TclProcessWait has already been called, + * so report no change. + */ + + return TCL_PROCESS_UNCHANGED; } RefreshProcessInfo(info, options); if (info->status == TCL_PROCESS_UNCHANGED) { - /* - * No change, stop there. - */ - - return TCL_PROCESS_UNCHANGED; + /* + * No change, stop there. + */ + + return TCL_PROCESS_UNCHANGED; } /* @@ -792,22 +931,22 @@ TclProcessWait( if (errorObjPtr && *errorObjPtr) Tcl_IncrRefCount(*errorObjPtr); if (autopurge) { - /* - * Purge now. - */ - - Tcl_DeleteHashEntry(entry); - entry = Tcl_FindHashEntry(&infoTablePerResolvedPid, - INT2PTR(info->resolvedPid)); - Tcl_DeleteHashEntry(entry); - FreeProcessInfo(info); + /* + * Purge now. + */ + + Tcl_DeleteHashEntry(entry); + entry = Tcl_FindHashEntry(&infoTablePerResolvedPid, + INT2PTR(info->resolvedPid)); + Tcl_DeleteHashEntry(entry); + FreeProcessInfo(info); } else { - /* - * Eventually purge. Subsequent calls will return - * TCL_PROCESS_UNCHANGED. - */ + /* + * Eventually purge. Subsequent calls will return + * TCL_PROCESS_UNCHANGED. + */ - info->purge = 1; + info->purge = 1; } return result; } -- cgit v0.12 From a95a7dd26567d637348ca4f69331f10e549f7ff8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 Aug 2017 09:24:29 +0000 Subject: (cherry-pick): Fix [b50fb21410dababca95baa122964b2e312cb9d8a|b50fb214] : exec redirection to append stdout and stderr to the same file --- generic/tclPipe.c | 8 +++++++- tests/exec.test | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/generic/tclPipe.c b/generic/tclPipe.c index 83fb818..2ecc5a6 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -668,7 +668,13 @@ TclCreatePipeline( if (*p == '>') { p++; atOK = 0; - flags = O_WRONLY | O_CREAT; + + /* + * Note that the O_APPEND flag only has an effect on POSIX + * platforms. On Windows, we just have to carry on regardless. + */ + + flags = O_WRONLY | O_CREAT | O_APPEND; } if (errorClose != 0) { errorClose = 0; diff --git a/tests/exec.test b/tests/exec.test index 38927d3..5f3a0cb 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -671,8 +671,12 @@ test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix} -setup { exec /bin/sh -c \ {for a in 1 2 3; do sleep 1; echo $a; done} >>$tmpfile & exec /bin/sh -c \ + {for a in 4 5 6; do sleep 1; echo $a >&2; done} 2>>$tmpfile & + exec /bin/sh -c \ {for a in a b c; do sleep 1; echo $a; done} >>$tmpfile & - # The above two shell invokations take about 3 seconds to finish, so allow + exec /bin/sh -c \ + {for a in d e f; do sleep 1; echo $a >&2; done} 2>>$tmpfile & + # The above four shell invokations take about 3 seconds to finish, so allow # 5s (in case the machine is busy) after 5000 # Check that no bytes have got lost through mixups with overlapping @@ -681,7 +685,7 @@ test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix} -setup { file size $tmpfile } -cleanup { removeFile $tmpfile -} -result 14 +} -result 26 # Tests to ensure batch files and .CMD (Bug 9ece99d58b) # can be executed on Windows -- cgit v0.12 From 92265d56a363a605b8a68d54cf49aa9a11448a1f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 Aug 2017 19:52:35 +0000 Subject: libtommath 1.0.1 rc 2 --- libtommath/bn_error.c | 6 ++-- libtommath/bn_fast_mp_invmod.c | 6 ++-- libtommath/bn_fast_mp_montgomery_reduce.c | 6 ++-- libtommath/bn_fast_s_mp_mul_digs.c | 6 ++-- libtommath/bn_fast_s_mp_mul_high_digs.c | 6 ++-- libtommath/bn_fast_s_mp_sqr.c | 6 ++-- libtommath/bn_mp_2expt.c | 6 ++-- libtommath/bn_mp_abs.c | 6 ++-- libtommath/bn_mp_add.c | 6 ++-- libtommath/bn_mp_add_d.c | 12 +++---- libtommath/bn_mp_addmod.c | 6 ++-- libtommath/bn_mp_and.c | 6 ++-- libtommath/bn_mp_clamp.c | 6 ++-- libtommath/bn_mp_clear.c | 6 ++-- libtommath/bn_mp_clear_multi.c | 6 ++-- libtommath/bn_mp_cmp.c | 6 ++-- libtommath/bn_mp_cmp_d.c | 6 ++-- libtommath/bn_mp_cmp_mag.c | 6 ++-- libtommath/bn_mp_cnt_lsb.c | 6 ++-- libtommath/bn_mp_copy.c | 6 ++-- libtommath/bn_mp_count_bits.c | 6 ++-- libtommath/bn_mp_div.c | 6 ++-- libtommath/bn_mp_div_2.c | 6 ++-- libtommath/bn_mp_div_2d.c | 25 ++++--------- libtommath/bn_mp_div_3.c | 6 ++-- libtommath/bn_mp_div_d.c | 6 ++-- libtommath/bn_mp_dr_is_modulus.c | 6 ++-- libtommath/bn_mp_dr_reduce.c | 6 ++-- libtommath/bn_mp_dr_setup.c | 6 ++-- libtommath/bn_mp_exch.c | 6 ++-- libtommath/bn_mp_export.c | 16 ++++----- libtommath/bn_mp_expt_d.c | 6 ++-- libtommath/bn_mp_expt_d_ex.c | 6 ++-- libtommath/bn_mp_exptmod.c | 6 ++-- libtommath/bn_mp_exptmod_fast.c | 20 +++++------ libtommath/bn_mp_exteuclid.c | 45 ++++++++++++------------ libtommath/bn_mp_fread.c | 8 +++-- libtommath/bn_mp_fwrite.c | 8 +++-- libtommath/bn_mp_gcd.c | 6 ++-- libtommath/bn_mp_get_int.c | 6 ++-- libtommath/bn_mp_grow.c | 6 ++-- libtommath/bn_mp_import.c | 16 ++++----- libtommath/bn_mp_init.c | 6 ++-- libtommath/bn_mp_init_copy.c | 13 ++++--- libtommath/bn_mp_init_multi.c | 9 ++--- libtommath/bn_mp_init_set.c | 6 ++-- libtommath/bn_mp_init_set_int.c | 6 ++-- libtommath/bn_mp_init_size.c | 6 ++-- libtommath/bn_mp_invmod.c | 8 ++--- libtommath/bn_mp_invmod_slow.c | 6 ++-- libtommath/bn_mp_is_square.c | 6 ++-- libtommath/bn_mp_jacobi.c | 6 ++-- libtommath/bn_mp_karatsuba_mul.c | 6 ++-- libtommath/bn_mp_karatsuba_sqr.c | 6 ++-- libtommath/bn_mp_lcm.c | 6 ++-- libtommath/bn_mp_lshd.c | 6 ++-- libtommath/bn_mp_mod.c | 8 ++--- libtommath/bn_mp_mod_2d.c | 6 ++-- libtommath/bn_mp_mod_d.c | 6 ++-- libtommath/bn_mp_montgomery_calc_normalization.c | 6 ++-- libtommath/bn_mp_montgomery_reduce.c | 6 ++-- libtommath/bn_mp_montgomery_setup.c | 6 ++-- libtommath/bn_mp_mul.c | 6 ++-- libtommath/bn_mp_mul_2.c | 6 ++-- libtommath/bn_mp_mul_2d.c | 6 ++-- libtommath/bn_mp_mul_d.c | 6 ++-- libtommath/bn_mp_mulmod.c | 8 ++--- libtommath/bn_mp_n_root.c | 6 ++-- libtommath/bn_mp_n_root_ex.c | 6 ++-- libtommath/bn_mp_neg.c | 6 ++-- libtommath/bn_mp_or.c | 6 ++-- libtommath/bn_mp_prime_fermat.c | 6 ++-- libtommath/bn_mp_prime_is_divisible.c | 6 ++-- libtommath/bn_mp_prime_is_prime.c | 6 ++-- libtommath/bn_mp_prime_miller_rabin.c | 6 ++-- libtommath/bn_mp_prime_next_prime.c | 6 ++-- libtommath/bn_mp_prime_rabin_miller_trials.c | 6 ++-- libtommath/bn_mp_prime_random_ex.c | 6 ++-- libtommath/bn_mp_radix_size.c | 6 ++-- libtommath/bn_mp_radix_smap.c | 6 ++-- libtommath/bn_mp_rand.c | 35 +++++++++++++++--- libtommath/bn_mp_read_radix.c | 6 ++-- libtommath/bn_mp_read_signed_bin.c | 6 ++-- libtommath/bn_mp_read_unsigned_bin.c | 6 ++-- libtommath/bn_mp_reduce.c | 6 ++-- libtommath/bn_mp_reduce_2k.c | 6 ++-- libtommath/bn_mp_reduce_2k_l.c | 6 ++-- libtommath/bn_mp_reduce_2k_setup.c | 6 ++-- libtommath/bn_mp_reduce_2k_setup_l.c | 6 ++-- libtommath/bn_mp_reduce_is_2k.c | 6 ++-- libtommath/bn_mp_reduce_is_2k_l.c | 6 ++-- libtommath/bn_mp_reduce_setup.c | 6 ++-- libtommath/bn_mp_rshd.c | 6 ++-- libtommath/bn_mp_set.c | 6 ++-- libtommath/bn_mp_set_int.c | 6 ++-- libtommath/bn_mp_set_long.c | 6 ++-- libtommath/bn_mp_set_long_long.c | 6 ++-- libtommath/bn_mp_shrink.c | 6 ++-- libtommath/bn_mp_signed_bin_size.c | 6 ++-- libtommath/bn_mp_sqr.c | 6 ++-- libtommath/bn_mp_sqrmod.c | 6 ++-- libtommath/bn_mp_sqrt.c | 6 ++-- libtommath/bn_mp_sub.c | 6 ++-- libtommath/bn_mp_sub_d.c | 6 ++-- libtommath/bn_mp_submod.c | 6 ++-- libtommath/bn_mp_to_signed_bin.c | 6 ++-- libtommath/bn_mp_to_signed_bin_n.c | 6 ++-- libtommath/bn_mp_to_unsigned_bin.c | 6 ++-- libtommath/bn_mp_to_unsigned_bin_n.c | 6 ++-- libtommath/bn_mp_toom_mul.c | 6 ++-- libtommath/bn_mp_toom_sqr.c | 6 ++-- libtommath/bn_mp_toradix.c | 6 ++-- libtommath/bn_mp_toradix_n.c | 6 ++-- libtommath/bn_mp_unsigned_bin_size.c | 6 ++-- libtommath/bn_mp_xor.c | 6 ++-- libtommath/bn_mp_zero.c | 6 ++-- libtommath/bn_prime_tab.c | 6 ++-- libtommath/bn_reverse.c | 6 ++-- libtommath/bn_s_mp_add.c | 6 ++-- libtommath/bn_s_mp_exptmod.c | 6 ++-- libtommath/bn_s_mp_mul_digs.c | 6 ++-- libtommath/bn_s_mp_mul_high_digs.c | 6 ++-- libtommath/bn_s_mp_sqr.c | 6 ++-- libtommath/bn_s_mp_sub.c | 6 ++-- libtommath/bncore.c | 6 ++-- libtommath/tommath.h | 35 ++++++++---------- libtommath/tommath_class.h | 12 +++---- libtommath/tommath_private.h | 14 +++++--- libtommath/tommath_superclass.h | 6 ++-- 129 files changed, 492 insertions(+), 472 deletions(-) diff --git a/libtommath/bn_error.c b/libtommath/bn_error.c index 3abf1a7..397f834 100644 --- a/libtommath/bn_error.c +++ b/libtommath/bn_error.c @@ -42,6 +42,6 @@ const char *mp_error_to_string(int code) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c index aa41098..fa31853 100644 --- a/libtommath/bn_fast_mp_invmod.c +++ b/libtommath/bn_fast_mp_invmod.c @@ -143,6 +143,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index a63839d..d13452d 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -167,6 +167,6 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index acd13b4..18bea3f 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -102,6 +102,6 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c index b96cf60..8fd5117 100644 --- a/libtommath/bn_fast_s_mp_mul_high_digs.c +++ b/libtommath/bn_fast_s_mp_mul_high_digs.c @@ -93,6 +93,6 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index 775c76f..293c54a 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -109,6 +109,6 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_2expt.c b/libtommath/bn_mp_2expt.c index 2845814..eb5e664 100644 --- a/libtommath/bn_mp_2expt.c +++ b/libtommath/bn_mp_2expt.c @@ -43,6 +43,6 @@ mp_2expt (mp_int * a, int b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index cc9c3db..16662c0 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -38,6 +38,6 @@ mp_abs (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index 236fc75..0d91d24 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -48,6 +48,6 @@ int mp_add (mp_int * a, mp_int * b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index 4d4e1df..6b9dbef 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -49,9 +49,6 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) /* old number of used digits in c */ oldused = c->used; - /* sign always positive */ - c->sign = MP_ZPOS; - /* source alias */ tmpa = a->dp; @@ -96,6 +93,9 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) ix = 1; } + /* sign always positive */ + c->sign = MP_ZPOS; + /* now zero to oldused */ while (ix++ < oldused) { *tmpc++ = 0; @@ -107,6 +107,6 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index 825c928..800e10a 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -36,6 +36,6 @@ mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 3b6b03e..6a18639 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -52,6 +52,6 @@ mp_and (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_clamp.c b/libtommath/bn_mp_clamp.c index d4fb70d..b392c10 100644 --- a/libtommath/bn_mp_clamp.c +++ b/libtommath/bn_mp_clamp.c @@ -39,6 +39,6 @@ mp_clamp (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_clear.c b/libtommath/bn_mp_clear.c index 17ef9d5..bf0873a 100644 --- a/libtommath/bn_mp_clear.c +++ b/libtommath/bn_mp_clear.c @@ -39,6 +39,6 @@ mp_clear (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_clear_multi.c b/libtommath/bn_mp_clear_multi.c index 441a200..e659cf8 100644 --- a/libtommath/bn_mp_clear_multi.c +++ b/libtommath/bn_mp_clear_multi.c @@ -29,6 +29,6 @@ void mp_clear_multi(mp_int *mp, ...) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index 74a98fe..6266a7e 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -38,6 +38,6 @@ mp_cmp (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c index 28a53ce..a1cdaa1 100644 --- a/libtommath/bn_mp_cmp_d.c +++ b/libtommath/bn_mp_cmp_d.c @@ -39,6 +39,6 @@ int mp_cmp_d(mp_int * a, mp_digit b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c index f72830f..b3839f0 100644 --- a/libtommath/bn_mp_cmp_mag.c +++ b/libtommath/bn_mp_cmp_mag.c @@ -50,6 +50,6 @@ int mp_cmp_mag (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_cnt_lsb.c b/libtommath/bn_mp_cnt_lsb.c index 9d7eef8..42d2219 100644 --- a/libtommath/bn_mp_cnt_lsb.c +++ b/libtommath/bn_mp_cnt_lsb.c @@ -48,6 +48,6 @@ int mp_cnt_lsb(mp_int *a) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index 69e9464..6f2ee59 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -63,6 +63,6 @@ mp_copy (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index 74b59b6..e2db126 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -40,6 +40,6 @@ mp_count_bits (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 3ca5d7f..81d30eb 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -290,6 +290,6 @@ LBL_Q:mp_clear (&q); #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index d2a213f..2004da7 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -63,6 +63,6 @@ int mp_div_2(mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c index 5b9fb48..a5b8494 100644 --- a/libtommath/bn_mp_div_2d.c +++ b/libtommath/bn_mp_div_2d.c @@ -20,8 +20,6 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) { mp_digit D, r, rr; int x, res; - mp_int t; - /* if the shift count is <= 0 then we do no work */ if (b <= 0) { @@ -32,24 +30,19 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) return res; } - if ((res = mp_init (&t)) != MP_OKAY) { + /* copy */ + if ((res = mp_copy (a, c)) != MP_OKAY) { return res; } + /* 'a' should not be used after here - it might be the same as d */ /* get the remainder */ if (d != NULL) { - if ((res = mp_mod_2d (a, b, &t)) != MP_OKAY) { - mp_clear (&t); + if ((res = mp_mod_2d (a, b, d)) != MP_OKAY) { return res; } } - /* copy */ - if ((res = mp_copy (a, c)) != MP_OKAY) { - mp_clear (&t); - return res; - } - /* shift by as many digits in the bit count */ if (b >= (int)DIGIT_BIT) { mp_rshd (c, b / DIGIT_BIT); @@ -84,14 +77,10 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) } } mp_clamp (c); - if (d != NULL) { - mp_exch (&t, d); - } - mp_clear (&t); return MP_OKAY; } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index c2b76fb..6c79332 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -74,6 +74,6 @@ mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index 4df1d36..aab298a 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -110,6 +110,6 @@ int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c index 599d929..d4dbec6 100644 --- a/libtommath/bn_mp_dr_is_modulus.c +++ b/libtommath/bn_mp_dr_is_modulus.c @@ -38,6 +38,6 @@ int mp_dr_is_modulus(mp_int *a) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c index 2273c79..2005f3c 100644 --- a/libtommath/bn_mp_dr_reduce.c +++ b/libtommath/bn_mp_dr_reduce.c @@ -91,6 +91,6 @@ top: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c index 1bccb2b..7f60c67 100644 --- a/libtommath/bn_mp_dr_setup.c +++ b/libtommath/bn_mp_dr_setup.c @@ -27,6 +27,6 @@ void mp_dr_setup(mp_int *a, mp_digit *d) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_exch.c b/libtommath/bn_mp_exch.c index 634193b..8dd5180 100644 --- a/libtommath/bn_mp_exch.c +++ b/libtommath/bn_mp_exch.c @@ -29,6 +29,6 @@ mp_exch (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index ac4c2f9..6477dd9 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -31,12 +31,12 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, } if (endian == 0) { - union { - unsigned int i; - char c[4]; + union { + unsigned int i; + char c[4]; } lint; - lint.i = 0x01020304; - + lint.i = 0x01020304; + endian = (lint.c[0] == 4) ? -1 : 1; } @@ -83,6 +83,6 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index 61c5a1d..0a4b90b 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -23,6 +23,6 @@ int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index 649d224..3bef24a 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -78,6 +78,6 @@ int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c index 0973e44..697ef52 100644 --- a/libtommath/bn_mp_exptmod.c +++ b/libtommath/bn_mp_exptmod.c @@ -107,6 +107,6 @@ int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 8d280bd..312305e 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -67,13 +67,13 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode /* init M array */ /* init first cell */ - if ((err = mp_init(&M[1])) != MP_OKAY) { + if ((err = mp_init_size(&M[1], P->alloc)) != MP_OKAY) { return err; } /* now init the second half of the array */ for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - if ((err = mp_init(&M[x])) != MP_OKAY) { + if ((err = mp_init_size(&M[x], P->alloc)) != MP_OKAY) { for (y = 1<<(winsize-1); y < x; y++) { mp_clear (&M[y]); } @@ -133,7 +133,7 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode } /* setup result */ - if ((err = mp_init (&res)) != MP_OKAY) { + if ((err = mp_init_size (&res, P->alloc)) != MP_OKAY) { goto LBL_M; } @@ -150,15 +150,15 @@ int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode if ((err = mp_montgomery_calc_normalization (&res, P)) != MP_OKAY) { goto LBL_RES; } -#else - err = MP_VAL; - goto LBL_RES; -#endif /* now set M[1] to G * R mod m */ if ((err = mp_mulmod (G, &res, P, &M[1])) != MP_OKAY) { goto LBL_RES; } +#else + err = MP_VAL; + goto LBL_RES; +#endif } else { mp_set(&res, 1); if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) { @@ -316,6 +316,6 @@ LBL_M: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index fbbd92c..f941385 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -29,41 +29,41 @@ int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) /* initialize, (u1,u2,u3) = (1,0,a) */ mp_set(&u1, 1); - if ((err = mp_copy(a, &u3)) != MP_OKAY) { goto _ERR; } + if ((err = mp_copy(a, &u3)) != MP_OKAY) { goto LBL_ERR; } /* initialize, (v1,v2,v3) = (0,1,b) */ mp_set(&v2, 1); - if ((err = mp_copy(b, &v3)) != MP_OKAY) { goto _ERR; } + if ((err = mp_copy(b, &v3)) != MP_OKAY) { goto LBL_ERR; } /* loop while v3 != 0 */ while (mp_iszero(&v3) == MP_NO) { /* q = u3/v3 */ - if ((err = mp_div(&u3, &v3, &q, NULL)) != MP_OKAY) { goto _ERR; } + if ((err = mp_div(&u3, &v3, &q, NULL)) != MP_OKAY) { goto LBL_ERR; } /* (t1,t2,t3) = (u1,u2,u3) - (v1,v2,v3)q */ - if ((err = mp_mul(&v1, &q, &tmp)) != MP_OKAY) { goto _ERR; } - if ((err = mp_sub(&u1, &tmp, &t1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_mul(&v2, &q, &tmp)) != MP_OKAY) { goto _ERR; } - if ((err = mp_sub(&u2, &tmp, &t2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_mul(&v3, &q, &tmp)) != MP_OKAY) { goto _ERR; } - if ((err = mp_sub(&u3, &tmp, &t3)) != MP_OKAY) { goto _ERR; } + if ((err = mp_mul(&v1, &q, &tmp)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_sub(&u1, &tmp, &t1)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_mul(&v2, &q, &tmp)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_sub(&u2, &tmp, &t2)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_mul(&v3, &q, &tmp)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_sub(&u3, &tmp, &t3)) != MP_OKAY) { goto LBL_ERR; } /* (u1,u2,u3) = (v1,v2,v3) */ - if ((err = mp_copy(&v1, &u1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&v2, &u2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&v3, &u3)) != MP_OKAY) { goto _ERR; } + if ((err = mp_copy(&v1, &u1)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_copy(&v2, &u2)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_copy(&v3, &u3)) != MP_OKAY) { goto LBL_ERR; } /* (v1,v2,v3) = (t1,t2,t3) */ - if ((err = mp_copy(&t1, &v1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&t2, &v2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&t3, &v3)) != MP_OKAY) { goto _ERR; } + if ((err = mp_copy(&t1, &v1)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_copy(&t2, &v2)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_copy(&t3, &v3)) != MP_OKAY) { goto LBL_ERR; } } /* make sure U3 >= 0 */ if (u3.sign == MP_NEG) { - if ((err = mp_neg(&u1, &u1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_neg(&u2, &u2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_neg(&u3, &u3)) != MP_OKAY) { goto _ERR; } + if ((err = mp_neg(&u1, &u1)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_neg(&u2, &u2)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_neg(&u3, &u3)) != MP_OKAY) { goto LBL_ERR; } } /* copy result out */ @@ -72,11 +72,12 @@ int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) if (U3 != NULL) { mp_exch(U3, &u3); } err = MP_OKAY; -_ERR: mp_clear_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL); +LBL_ERR: + mp_clear_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL); return err; } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_fread.c b/libtommath/bn_mp_fread.c index a4fa8c9..6792437 100644 --- a/libtommath/bn_mp_fread.c +++ b/libtommath/bn_mp_fread.c @@ -15,6 +15,7 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ +#ifndef LTM_NO_FILE /* read a bigint from a file stream in ASCII */ int mp_fread(mp_int *a, int radix, FILE *stream) { @@ -59,9 +60,10 @@ int mp_fread(mp_int *a, int radix, FILE *stream) return MP_OKAY; } +#endif #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c index 90f1fc5..44812d5 100644 --- a/libtommath/bn_mp_fwrite.c +++ b/libtommath/bn_mp_fwrite.c @@ -15,6 +15,7 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ +#ifndef LTM_NO_FILE int mp_fwrite(mp_int *a, int radix, FILE *stream) { char *buf; @@ -44,9 +45,10 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream) XFREE (buf); return MP_OKAY; } +#endif #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index 16acfd9..fdefc1b 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -100,6 +100,6 @@ LBL_U:mp_clear (&v); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index 99fb850..4d8ecd2 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -40,6 +40,6 @@ unsigned long mp_get_int(mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_grow.c b/libtommath/bn_mp_grow.c index cbdcfed..7fbc5a2 100644 --- a/libtommath/bn_mp_grow.c +++ b/libtommath/bn_mp_grow.c @@ -52,6 +52,6 @@ int mp_grow (mp_int * a, int size) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_import.c b/libtommath/bn_mp_import.c index dd4b8e6..c615a84 100644 --- a/libtommath/bn_mp_import.c +++ b/libtommath/bn_mp_import.c @@ -27,12 +27,12 @@ int mp_import(mp_int* rop, size_t count, int order, size_t size, mp_zero(rop); if (endian == 0) { - union { - unsigned int i; - char c[4]; + union { + unsigned int i; + char c[4]; } lint; - lint.i = 0x01020304; - + lint.i = 0x01020304; + endian = (lint.c[0] == 4) ? -1 : 1; } @@ -68,6 +68,6 @@ int mp_import(mp_int* rop, size_t count, int order, size_t size, #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_init.c b/libtommath/bn_mp_init.c index 7a57730..8a26f09 100644 --- a/libtommath/bn_mp_init.c +++ b/libtommath/bn_mp_init.c @@ -41,6 +41,6 @@ int mp_init (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_init_copy.c b/libtommath/bn_mp_init_copy.c index 9e15f36..ab0e130 100644 --- a/libtommath/bn_mp_init_copy.c +++ b/libtommath/bn_mp_init_copy.c @@ -23,10 +23,15 @@ int mp_init_copy (mp_int * a, mp_int * b) if ((res = mp_init_size (a, b->used)) != MP_OKAY) { return res; } - return mp_copy (b, a); + + if((res = mp_copy (b, a)) != MP_OKAY) { + mp_clear(a); + } + + return res; } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_init_multi.c b/libtommath/bn_mp_init_multi.c index 52220a3..78ed62d 100644 --- a/libtommath/bn_mp_init_multi.c +++ b/libtommath/bn_mp_init_multi.c @@ -31,9 +31,6 @@ int mp_init_multi(mp_int *mp, ...) */ va_list clean_args; - /* end the current list */ - va_end(args); - /* now start cleaning up */ cur_arg = mp; va_start(clean_args, mp); @@ -54,6 +51,6 @@ int mp_init_multi(mp_int *mp, ...) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_init_set.c b/libtommath/bn_mp_init_set.c index c337e50..0b5cf36 100644 --- a/libtommath/bn_mp_init_set.c +++ b/libtommath/bn_mp_init_set.c @@ -27,6 +27,6 @@ int mp_init_set (mp_int * a, mp_digit b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_init_set_int.c b/libtommath/bn_mp_init_set_int.c index c88f14e..a9bf232 100644 --- a/libtommath/bn_mp_init_set_int.c +++ b/libtommath/bn_mp_init_set_int.c @@ -26,6 +26,6 @@ int mp_init_set_int (mp_int * a, unsigned long b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_init_size.c b/libtommath/bn_mp_init_size.c index e1d1b51..44b875f 100644 --- a/libtommath/bn_mp_init_size.c +++ b/libtommath/bn_mp_init_size.c @@ -43,6 +43,6 @@ int mp_init_size (mp_int * a, int size) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index 44951e5..c374fd2 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -25,7 +25,7 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c) #ifdef BN_FAST_MP_INVMOD_C /* if the modulus is odd we can use a faster routine instead */ - if (mp_isodd (b) == MP_YES) { + if ((mp_isodd(b) == MP_YES) && (mp_cmp_d(b, 1) != MP_EQ)) { return fast_mp_invmod (a, b, c); } #endif @@ -38,6 +38,6 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c index a21f947..879e971 100644 --- a/libtommath/bn_mp_invmod_slow.c +++ b/libtommath/bn_mp_invmod_slow.c @@ -170,6 +170,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 9f065ef..15e632e 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -104,6 +104,6 @@ ERR:mp_clear(&t); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c index 3c114e3..4e6c474 100644 --- a/libtommath/bn_mp_jacobi.c +++ b/libtommath/bn_mp_jacobi.c @@ -112,6 +112,6 @@ LBL_A1:mp_clear (&a1); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index d65e37e..307a0d9 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -162,6 +162,6 @@ ERR: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c index 739840d..3993cd9 100644 --- a/libtommath/bn_mp_karatsuba_sqr.c +++ b/libtommath/bn_mp_karatsuba_sqr.c @@ -116,6 +116,6 @@ ERR: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_lcm.c b/libtommath/bn_mp_lcm.c index 3bff571..b6a0ec1 100644 --- a/libtommath/bn_mp_lcm.c +++ b/libtommath/bn_mp_lcm.c @@ -55,6 +55,6 @@ LBL_T: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_lshd.c b/libtommath/bn_mp_lshd.c index f6f800f..b6cb111 100644 --- a/libtommath/bn_mp_lshd.c +++ b/libtommath/bn_mp_lshd.c @@ -62,6 +62,6 @@ int mp_lshd (mp_int * a, int b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index b67467d..0c9bc3e 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -22,7 +22,7 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c) mp_int t; int res; - if ((res = mp_init (&t)) != MP_OKAY) { + if ((res = mp_init_size (&t, b->used)) != MP_OKAY) { return res; } @@ -43,6 +43,6 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 926f810..1f2c47c 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -50,6 +50,6 @@ mp_mod_2d (mp_int * a, int b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index d8722f0..4553cba 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -22,6 +22,6 @@ mp_mod_d (mp_int * a, mp_digit b, mp_digit * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index ea87cbd..2b11749 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -54,6 +54,6 @@ int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index af2cc58..d3746a6 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -113,6 +113,6 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index 264a2bd..c71d362 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -54,6 +54,6 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index ea53d5e..d81f68b 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -62,6 +62,6 @@ int mp_mul (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index 9c72c7f..20fb9d6 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -77,6 +77,6 @@ int mp_mul_2(mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c index 9967e46..b5d3cae 100644 --- a/libtommath/bn_mp_mul_2d.c +++ b/libtommath/bn_mp_mul_2d.c @@ -80,6 +80,6 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index e77da5d..c0c24cd 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -74,6 +74,6 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c index 5ea88ef..375674f 100644 --- a/libtommath/bn_mp_mulmod.c +++ b/libtommath/bn_mp_mulmod.c @@ -21,7 +21,7 @@ int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) int res; mp_int t; - if ((res = mp_init (&t)) != MP_OKAY) { + if ((res = mp_init_size (&t, c->used)) != MP_OKAY) { return res; } @@ -35,6 +35,6 @@ int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c index a14ee67..b7a4817 100644 --- a/libtommath/bn_mp_n_root.c +++ b/libtommath/bn_mp_n_root.c @@ -25,6 +25,6 @@ int mp_n_root (mp_int * a, mp_digit b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_n_root_ex.c b/libtommath/bn_mp_n_root_ex.c index 79d1dfb..c163c1d 100644 --- a/libtommath/bn_mp_n_root_ex.c +++ b/libtommath/bn_mp_n_root_ex.c @@ -127,6 +127,6 @@ LBL_T1:mp_clear (&t1); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c index ea32e46..b8a014a 100644 --- a/libtommath/bn_mp_neg.c +++ b/libtommath/bn_mp_neg.c @@ -35,6 +35,6 @@ int mp_neg (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index b7f2e4f..fc303d2 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -45,6 +45,6 @@ int mp_or (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c index 9dc9e85..1b1300c 100644 --- a/libtommath/bn_mp_prime_fermat.c +++ b/libtommath/bn_mp_prime_fermat.c @@ -57,6 +57,6 @@ LBL_T:mp_clear (&t); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c index 5854f08..b97390e 100644 --- a/libtommath/bn_mp_prime_is_divisible.c +++ b/libtommath/bn_mp_prime_is_divisible.c @@ -45,6 +45,6 @@ int mp_prime_is_divisible (mp_int * a, int *result) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c index be5ebe4..4a36047 100644 --- a/libtommath/bn_mp_prime_is_prime.c +++ b/libtommath/bn_mp_prime_is_prime.c @@ -78,6 +78,6 @@ LBL_B:mp_clear (&b); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c index 7b5c8d2..569d78a 100644 --- a/libtommath/bn_mp_prime_miller_rabin.c +++ b/libtommath/bn_mp_prime_miller_rabin.c @@ -98,6 +98,6 @@ LBL_N1:mp_clear (&n1); } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_next_prime.c b/libtommath/bn_mp_prime_next_prime.c index 9951dc3..c0b7895 100644 --- a/libtommath/bn_mp_prime_next_prime.c +++ b/libtommath/bn_mp_prime_next_prime.c @@ -165,6 +165,6 @@ LBL_ERR: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_rabin_miller_trials.c b/libtommath/bn_mp_prime_rabin_miller_trials.c index bca4229..ad954cc 100644 --- a/libtommath/bn_mp_prime_rabin_miller_trials.c +++ b/libtommath/bn_mp_prime_rabin_miller_trials.c @@ -47,6 +47,6 @@ int mp_prime_rabin_miller_trials(int size) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_prime_random_ex.c b/libtommath/bn_mp_prime_random_ex.c index 1efc4fc..655e8ae 100644 --- a/libtommath/bn_mp_prime_random_ex.c +++ b/libtommath/bn_mp_prime_random_ex.c @@ -119,6 +119,6 @@ error: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c index e5d7772..e9cb55a 100644 --- a/libtommath/bn_mp_radix_size.c +++ b/libtommath/bn_mp_radix_size.c @@ -73,6 +73,6 @@ int mp_radix_size (mp_int * a, int radix, int *size) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_radix_smap.c b/libtommath/bn_mp_radix_smap.c index d1c75ad..425e0e6 100644 --- a/libtommath/bn_mp_radix_smap.c +++ b/libtommath/bn_mp_radix_smap.c @@ -19,6 +19,6 @@ const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c index 4c9610d..7c8f106 100644 --- a/libtommath/bn_mp_rand.c +++ b/libtommath/bn_mp_rand.c @@ -15,7 +15,32 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ +#if MP_GEN_RANDOM_MAX == 0xffffffff + #define MP_GEN_RANDOM_SHIFT 32 +#elif MP_GEN_RANDOM_MAX == 32767 + /* SHRT_MAX */ + #define MP_GEN_RANDOM_SHIFT 15 +#elif MP_GEN_RANDOM_MAX == 2147483647 + /* INT_MAX */ + #define MP_GEN_RANDOM_SHIFT 31 +#elif !defined(MP_GEN_RANDOM_SHIFT) +#error Thou shalt define their own valid MP_GEN_RANDOM_SHIFT +#endif + /* makes a pseudo-random int of a given size */ +static mp_digit s_gen_random(void) +{ + mp_digit d = 0, msk = 0; + do { + d <<= MP_GEN_RANDOM_SHIFT; + d |= ((mp_digit) MP_GEN_RANDOM()); + msk <<= MP_GEN_RANDOM_SHIFT; + msk |= (MP_MASK & MP_GEN_RANDOM_MAX); + } while ((MP_MASK & msk) != MP_MASK); + d &= MP_MASK; + return d; +} + int mp_rand (mp_int * a, int digits) { @@ -29,7 +54,7 @@ mp_rand (mp_int * a, int digits) /* first place a random non-zero digit */ do { - d = ((mp_digit) abs (MP_GEN_RANDOM())) & MP_MASK; + d = s_gen_random(); } while (d == 0); if ((res = mp_add_d (a, d, a)) != MP_OKAY) { @@ -41,7 +66,7 @@ mp_rand (mp_int * a, int digits) return res; } - if ((res = mp_add_d (a, ((mp_digit) abs (MP_GEN_RANDOM())), a)) != MP_OKAY) { + if ((res = mp_add_d (a, s_gen_random(), a)) != MP_OKAY) { return res; } } @@ -50,6 +75,6 @@ mp_rand (mp_int * a, int digits) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index 5c9eb5e..6f2cc04 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -80,6 +80,6 @@ int mp_read_radix (mp_int * a, const char *str, int radix) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_read_signed_bin.c b/libtommath/bn_mp_read_signed_bin.c index a4d4760..1448d21 100644 --- a/libtommath/bn_mp_read_signed_bin.c +++ b/libtommath/bn_mp_read_signed_bin.c @@ -36,6 +36,6 @@ int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_read_unsigned_bin.c b/libtommath/bn_mp_read_unsigned_bin.c index e8e5df8..b2e399d 100644 --- a/libtommath/bn_mp_read_unsigned_bin.c +++ b/libtommath/bn_mp_read_unsigned_bin.c @@ -50,6 +50,6 @@ int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c index e2c3a58..c15b54e 100644 --- a/libtommath/bn_mp_reduce.c +++ b/libtommath/bn_mp_reduce.c @@ -95,6 +95,6 @@ CLEANUP: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k.c b/libtommath/bn_mp_reduce_2k.c index 2876a75..daea5e7 100644 --- a/libtommath/bn_mp_reduce_2k.c +++ b/libtommath/bn_mp_reduce_2k.c @@ -58,6 +58,6 @@ ERR: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k_l.c b/libtommath/bn_mp_reduce_2k_l.c index 3225214..d6c2aa4 100644 --- a/libtommath/bn_mp_reduce_2k_l.c +++ b/libtommath/bn_mp_reduce_2k_l.c @@ -59,6 +59,6 @@ ERR: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c index 545051e..f4650b4 100644 --- a/libtommath/bn_mp_reduce_2k_setup.c +++ b/libtommath/bn_mp_reduce_2k_setup.c @@ -42,6 +42,6 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c index 59132dd..7945d6a 100644 --- a/libtommath/bn_mp_reduce_2k_setup_l.c +++ b/libtommath/bn_mp_reduce_2k_setup_l.c @@ -39,6 +39,6 @@ ERR: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c index 784947b..e68d704 100644 --- a/libtommath/bn_mp_reduce_is_2k.c +++ b/libtommath/bn_mp_reduce_is_2k.c @@ -47,6 +47,6 @@ int mp_reduce_is_2k(mp_int *a) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index c193f39..5426352 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -39,6 +39,6 @@ int mp_reduce_is_2k_l(mp_int *a) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c index f97eed5..d3ed42f 100644 --- a/libtommath/bn_mp_reduce_setup.c +++ b/libtommath/bn_mp_reduce_setup.c @@ -29,6 +29,6 @@ int mp_reduce_setup (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_rshd.c b/libtommath/bn_mp_rshd.c index 77b0f6c..6ea4f2f 100644 --- a/libtommath/bn_mp_rshd.c +++ b/libtommath/bn_mp_rshd.c @@ -67,6 +67,6 @@ void mp_rshd (mp_int * a, int b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_set.c b/libtommath/bn_mp_set.c index cac48ea..c10850d 100644 --- a/libtommath/bn_mp_set.c +++ b/libtommath/bn_mp_set.c @@ -24,6 +24,6 @@ void mp_set (mp_int * a, mp_digit b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_set_int.c b/libtommath/bn_mp_set_int.c index 5aa59d5..3e9ae87 100644 --- a/libtommath/bn_mp_set_int.c +++ b/libtommath/bn_mp_set_int.c @@ -43,6 +43,6 @@ int mp_set_int (mp_int * a, unsigned long b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_set_long.c b/libtommath/bn_mp_set_long.c index 281fce7..680781b 100644 --- a/libtommath/bn_mp_set_long.c +++ b/libtommath/bn_mp_set_long.c @@ -19,6 +19,6 @@ MP_SET_XLONG(mp_set_long, unsigned long) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_set_long_long.c b/libtommath/bn_mp_set_long_long.c index 3c4b01a..7fde01a 100644 --- a/libtommath/bn_mp_set_long_long.c +++ b/libtommath/bn_mp_set_long_long.c @@ -19,6 +19,6 @@ MP_SET_XLONG(mp_set_long_long, unsigned long long) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_shrink.c b/libtommath/bn_mp_shrink.c index 1ad2ede..ef71874 100644 --- a/libtommath/bn_mp_shrink.c +++ b/libtommath/bn_mp_shrink.c @@ -36,6 +36,6 @@ int mp_shrink (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c index 0e760a6..261f036 100644 --- a/libtommath/bn_mp_signed_bin_size.c +++ b/libtommath/bn_mp_signed_bin_size.c @@ -22,6 +22,6 @@ int mp_signed_bin_size (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index ad2099b..e0c2e85 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -55,6 +55,6 @@ mp_sqr (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index 2f9463d..25ca55e 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -36,6 +36,6 @@ mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index 4a52f5e..77078e8 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -76,6 +76,6 @@ E2: mp_clear(&t1); #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index 0d616c2..cf7d58e 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -54,6 +54,6 @@ mp_sub (mp_int * a, mp_int * b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index f5a932f..482de39 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -88,6 +88,6 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index 87e0889..f6098b3 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -37,6 +37,6 @@ mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c index e9289ea..077b0bf 100644 --- a/libtommath/bn_mp_to_signed_bin.c +++ b/libtommath/bn_mp_to_signed_bin.c @@ -28,6 +28,6 @@ int mp_to_signed_bin (mp_int * a, unsigned char *b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c index d4fe6e6..2edb8e0 100644 --- a/libtommath/bn_mp_to_signed_bin_n.c +++ b/libtommath/bn_mp_to_signed_bin_n.c @@ -26,6 +26,6 @@ int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c index d3ef46f..203bf75 100644 --- a/libtommath/bn_mp_to_unsigned_bin.c +++ b/libtommath/bn_mp_to_unsigned_bin.c @@ -43,6 +43,6 @@ int mp_to_unsigned_bin (mp_int * a, unsigned char *b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c index 2da13cc..d28d7f4 100644 --- a/libtommath/bn_mp_to_unsigned_bin_n.c +++ b/libtommath/bn_mp_to_unsigned_bin_n.c @@ -26,6 +26,6 @@ int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index 4731f8f..dc4f0a9 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -281,6 +281,6 @@ ERR: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 69b69d4..06a568e 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -223,6 +223,6 @@ ERR: #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index f04352d..5bd9165 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -70,6 +70,6 @@ int mp_toradix (mp_int * a, char *str, int radix) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index 19b61d7..d1587a3 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -83,6 +83,6 @@ int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c index 0312625..e81cd82 100644 --- a/libtommath/bn_mp_unsigned_bin_size.c +++ b/libtommath/bn_mp_unsigned_bin_size.c @@ -23,6 +23,6 @@ int mp_unsigned_bin_size (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index 3c2ba9e..1fc8bdf 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -46,6 +46,6 @@ mp_xor (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_mp_zero.c b/libtommath/bn_mp_zero.c index 21365ed..f607ce6 100644 --- a/libtommath/bn_mp_zero.c +++ b/libtommath/bn_mp_zero.c @@ -31,6 +31,6 @@ void mp_zero (mp_int * a) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_prime_tab.c b/libtommath/bn_prime_tab.c index ae727a4..4354a48 100644 --- a/libtommath/bn_prime_tab.c +++ b/libtommath/bn_prime_tab.c @@ -56,6 +56,6 @@ const mp_digit ltm_prime_tab[] = { }; #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_reverse.c b/libtommath/bn_reverse.c index fc6eb2d..9811a81 100644 --- a/libtommath/bn_reverse.c +++ b/libtommath/bn_reverse.c @@ -34,6 +34,6 @@ bn_reverse (unsigned char *s, int len) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index c2ad649..5d886e7 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -104,6 +104,6 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index 63e1b1e..617b56c 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -247,6 +247,6 @@ LBL_M: } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index bd8553d..cf2f50c 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -85,6 +85,6 @@ int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 153cea44..1d5b2f0 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -76,6 +76,6 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index 68c95bc..b85f1b8 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -79,6 +79,6 @@ int s_mp_sqr (mp_int * a, mp_int * b) } #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index c0ea556..ac3f785 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -84,6 +84,6 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c) #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/bncore.c b/libtommath/bncore.c index 9552714..8bd4681 100644 --- a/libtommath/bncore.c +++ b/libtommath/bncore.c @@ -31,6 +31,6 @@ int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsub TOOM_SQR_CUTOFF = 400; #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 4c66e15..0a065f6 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -27,7 +27,12 @@ extern "C" { #endif /* detect 64-bit mode if possible */ -#if defined(__x86_64__) +#if defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || \ + defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || \ + defined(__s390x__) || defined(__arch64__) || defined(__aarch64__) || \ + defined(__sparcv9) || defined(__sparc_v9__) || defined(__sparc64__) || \ + defined(__ia64) || defined(__ia64__) || defined(__itanium__) || defined(_M_IA64) || \ + defined(__LP64__) || defined(_LP64) || defined(__64BIT__) #if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) #define MP_64BIT #endif @@ -57,11 +62,6 @@ extern "C" { #endif #elif defined(MP_64BIT) /* for GCC only on supported platforms */ -#ifndef CRYPT - typedef unsigned long long ulong64; - typedef signed long long long64; -#endif - typedef uint64_t mp_digit; #if defined(_WIN32) typedef unsigned __int128 mp_word; @@ -78,11 +78,6 @@ extern "C" { /* this is the default case, 28-bit digits */ /* this is to make porting into LibTomCrypt easier :-) */ -#ifndef CRYPT - typedef unsigned long long ulong64; - typedef signed long long long64; -#endif - typedef uint32_t mp_digit; typedef uint64_t mp_word; @@ -104,16 +99,16 @@ extern "C" { typedef mp_digit mp_min_u32; #endif -/* platforms that can use a better rand function */ +/* use arc4random on platforms that support it */ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) - #define MP_USE_ALT_RAND 1 + #define MP_GEN_RANDOM() arc4random() + #define MP_GEN_RANDOM_MAX 0xffffffff #endif -/* use arc4random on platforms that support it */ -#ifdef MP_USE_ALT_RAND - #define MP_GEN_RANDOM() arc4random() -#else +/* use rand() as fall-back if there's no better rand function */ +#ifndef MP_GEN_RANDOM #define MP_GEN_RANDOM() rand() + #define MP_GEN_RANDOM_MAX RAND_MAX #endif #define MP_DIGIT_BIT DIGIT_BIT @@ -570,6 +565,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream); #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/tommath_class.h b/libtommath/tommath_class.h index 2085521..e860613 100644 --- a/libtommath/tommath_class.h +++ b/libtommath/tommath_class.h @@ -282,12 +282,9 @@ #if defined(BN_MP_DIV_2D_C) #define BN_MP_COPY_C #define BN_MP_ZERO_C - #define BN_MP_INIT_C #define BN_MP_MOD_2D_C - #define BN_MP_CLEAR_C #define BN_MP_RSHD_C #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C #endif #if defined(BN_MP_DIV_3_C) @@ -359,7 +356,7 @@ #if defined(BN_MP_EXPTMOD_FAST_C) #define BN_MP_COUNT_BITS_C - #define BN_MP_INIT_C + #define BN_MP_INIT_SIZE_C #define BN_MP_CLEAR_C #define BN_MP_MONTGOMERY_SETUP_C #define BN_FAST_MP_MONTGOMERY_REDUCE_C @@ -441,6 +438,7 @@ #if defined(BN_MP_INIT_COPY_C) #define BN_MP_INIT_SIZE_C #define BN_MP_COPY_C + #define BN_MP_CLEAR_C #endif #if defined(BN_MP_INIT_MULTI_C) @@ -466,6 +464,7 @@ #if defined(BN_MP_INVMOD_C) #define BN_MP_ISZERO_C #define BN_MP_ISODD_C + #define BN_MP_CMP_D_C #define BN_FAST_MP_INVMOD_C #define BN_MP_INVMOD_SLOW_C #endif @@ -500,6 +499,7 @@ #endif #if defined(BN_MP_JACOBI_C) + #define BN_MP_ISNEG_C #define BN_MP_CMP_D_C #define BN_MP_ISZERO_C #define BN_MP_INIT_COPY_C @@ -546,7 +546,7 @@ #endif #if defined(BN_MP_MOD_C) - #define BN_MP_INIT_C + #define BN_MP_INIT_SIZE_C #define BN_MP_DIV_C #define BN_MP_CLEAR_C #define BN_MP_ISZERO_C @@ -610,7 +610,7 @@ #endif #if defined(BN_MP_MULMOD_C) - #define BN_MP_INIT_C + #define BN_MP_INIT_SIZE_C #define BN_MP_MUL_C #define BN_MP_CLEAR_C #define BN_MP_MOD_C diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index bc7cd35..407ebd5 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -18,9 +18,13 @@ #include #include -#define MIN(x,y) (((x) < (y)) ? (x) : (y)) +#ifndef MIN + #define MIN(x,y) (((x) < (y)) ? (x) : (y)) +#endif -#define MAX(x,y) (((x) > (y)) ? (x) : (y)) +#ifndef MAX + #define MAX(x,y) (((x) > (y)) ? (x) : (y)) +#endif #ifdef __cplusplus extern "C" { @@ -114,6 +118,6 @@ int func_name (mp_int * a, type b) \ #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ diff --git a/libtommath/tommath_superclass.h b/libtommath/tommath_superclass.h index 1b26841..8f6ef03 100644 --- a/libtommath/tommath_superclass.h +++ b/libtommath/tommath_superclass.h @@ -71,6 +71,6 @@ #endif -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ +/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ +/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ +/* commit time: 2017-08-29 10:48:46 +0200 */ -- cgit v0.12 From 1ef0babc38bf484a63c5bdcb56bed55f2df1bbab Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 Aug 2017 19:55:52 +0000 Subject: Fix eol-style (fossil warning: mixed line endings) --- libtommath/bn_mp_export.c | 10 +++++----- libtommath/bn_mp_import.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index 6477dd9..58d71d5 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -31,12 +31,12 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, } if (endian == 0) { - union { - unsigned int i; - char c[4]; + union { + unsigned int i; + char c[4]; } lint; - lint.i = 0x01020304; - + lint.i = 0x01020304; + endian = (lint.c[0] == 4) ? -1 : 1; } diff --git a/libtommath/bn_mp_import.c b/libtommath/bn_mp_import.c index c615a84..d9248fd 100644 --- a/libtommath/bn_mp_import.c +++ b/libtommath/bn_mp_import.c @@ -27,12 +27,12 @@ int mp_import(mp_int* rop, size_t count, int order, size_t size, mp_zero(rop); if (endian == 0) { - union { - unsigned int i; - char c[4]; + union { + unsigned int i; + char c[4]; } lint; - lint.i = 0x01020304; - + lint.i = 0x01020304; + endian = (lint.c[0] == 4) ? -1 : 1; } -- cgit v0.12 From 2d65cb751401d640fd8a1d1aebc90f96c9bb8019 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 Aug 2017 20:39:15 +0000 Subject: libtommath 1.0.1 --- libtommath/bn_error.c | 6 +++--- libtommath/bn_fast_mp_invmod.c | 6 +++--- libtommath/bn_fast_mp_montgomery_reduce.c | 6 +++--- libtommath/bn_fast_s_mp_mul_digs.c | 6 +++--- libtommath/bn_fast_s_mp_mul_high_digs.c | 6 +++--- libtommath/bn_fast_s_mp_sqr.c | 6 +++--- libtommath/bn_mp_2expt.c | 6 +++--- libtommath/bn_mp_abs.c | 6 +++--- libtommath/bn_mp_add.c | 6 +++--- libtommath/bn_mp_add_d.c | 6 +++--- libtommath/bn_mp_addmod.c | 6 +++--- libtommath/bn_mp_and.c | 6 +++--- libtommath/bn_mp_clamp.c | 6 +++--- libtommath/bn_mp_clear.c | 6 +++--- libtommath/bn_mp_clear_multi.c | 6 +++--- libtommath/bn_mp_cmp.c | 6 +++--- libtommath/bn_mp_cmp_d.c | 6 +++--- libtommath/bn_mp_cmp_mag.c | 6 +++--- libtommath/bn_mp_cnt_lsb.c | 6 +++--- libtommath/bn_mp_copy.c | 6 +++--- libtommath/bn_mp_count_bits.c | 6 +++--- libtommath/bn_mp_div.c | 6 +++--- libtommath/bn_mp_div_2.c | 6 +++--- libtommath/bn_mp_div_2d.c | 6 +++--- libtommath/bn_mp_div_3.c | 6 +++--- libtommath/bn_mp_div_d.c | 6 +++--- libtommath/bn_mp_dr_is_modulus.c | 6 +++--- libtommath/bn_mp_dr_reduce.c | 6 +++--- libtommath/bn_mp_dr_setup.c | 6 +++--- libtommath/bn_mp_exch.c | 6 +++--- libtommath/bn_mp_export.c | 6 +++--- libtommath/bn_mp_expt_d.c | 6 +++--- libtommath/bn_mp_expt_d_ex.c | 6 +++--- libtommath/bn_mp_exptmod.c | 6 +++--- libtommath/bn_mp_exptmod_fast.c | 6 +++--- libtommath/bn_mp_exteuclid.c | 6 +++--- libtommath/bn_mp_fread.c | 6 +++--- libtommath/bn_mp_fwrite.c | 6 +++--- libtommath/bn_mp_gcd.c | 6 +++--- libtommath/bn_mp_get_int.c | 6 +++--- libtommath/bn_mp_grow.c | 6 +++--- libtommath/bn_mp_import.c | 6 +++--- libtommath/bn_mp_init.c | 6 +++--- libtommath/bn_mp_init_copy.c | 6 +++--- libtommath/bn_mp_init_multi.c | 6 +++--- libtommath/bn_mp_init_set.c | 6 +++--- libtommath/bn_mp_init_set_int.c | 6 +++--- libtommath/bn_mp_init_size.c | 6 +++--- libtommath/bn_mp_invmod.c | 6 +++--- libtommath/bn_mp_invmod_slow.c | 6 +++--- libtommath/bn_mp_is_square.c | 6 +++--- libtommath/bn_mp_jacobi.c | 6 +++--- libtommath/bn_mp_karatsuba_mul.c | 6 +++--- libtommath/bn_mp_karatsuba_sqr.c | 6 +++--- libtommath/bn_mp_lcm.c | 6 +++--- libtommath/bn_mp_lshd.c | 6 +++--- libtommath/bn_mp_mod.c | 6 +++--- libtommath/bn_mp_mod_2d.c | 6 +++--- libtommath/bn_mp_mod_d.c | 6 +++--- libtommath/bn_mp_montgomery_calc_normalization.c | 6 +++--- libtommath/bn_mp_montgomery_reduce.c | 6 +++--- libtommath/bn_mp_montgomery_setup.c | 6 +++--- libtommath/bn_mp_mul.c | 6 +++--- libtommath/bn_mp_mul_2.c | 6 +++--- libtommath/bn_mp_mul_2d.c | 6 +++--- libtommath/bn_mp_mul_d.c | 6 +++--- libtommath/bn_mp_mulmod.c | 6 +++--- libtommath/bn_mp_n_root.c | 6 +++--- libtommath/bn_mp_n_root_ex.c | 6 +++--- libtommath/bn_mp_neg.c | 6 +++--- libtommath/bn_mp_or.c | 6 +++--- libtommath/bn_mp_prime_fermat.c | 6 +++--- libtommath/bn_mp_prime_is_divisible.c | 6 +++--- libtommath/bn_mp_prime_is_prime.c | 6 +++--- libtommath/bn_mp_prime_miller_rabin.c | 6 +++--- libtommath/bn_mp_prime_next_prime.c | 6 +++--- libtommath/bn_mp_prime_rabin_miller_trials.c | 6 +++--- libtommath/bn_mp_prime_random_ex.c | 6 +++--- libtommath/bn_mp_radix_size.c | 6 +++--- libtommath/bn_mp_radix_smap.c | 6 +++--- libtommath/bn_mp_rand.c | 6 +++--- libtommath/bn_mp_read_radix.c | 6 +++--- libtommath/bn_mp_read_signed_bin.c | 6 +++--- libtommath/bn_mp_read_unsigned_bin.c | 6 +++--- libtommath/bn_mp_reduce.c | 6 +++--- libtommath/bn_mp_reduce_2k.c | 6 +++--- libtommath/bn_mp_reduce_2k_l.c | 6 +++--- libtommath/bn_mp_reduce_2k_setup.c | 6 +++--- libtommath/bn_mp_reduce_2k_setup_l.c | 6 +++--- libtommath/bn_mp_reduce_is_2k.c | 6 +++--- libtommath/bn_mp_reduce_is_2k_l.c | 6 +++--- libtommath/bn_mp_reduce_setup.c | 6 +++--- libtommath/bn_mp_rshd.c | 6 +++--- libtommath/bn_mp_set.c | 6 +++--- libtommath/bn_mp_set_int.c | 6 +++--- libtommath/bn_mp_set_long.c | 6 +++--- libtommath/bn_mp_set_long_long.c | 6 +++--- libtommath/bn_mp_shrink.c | 6 +++--- libtommath/bn_mp_signed_bin_size.c | 6 +++--- libtommath/bn_mp_sqr.c | 6 +++--- libtommath/bn_mp_sqrmod.c | 6 +++--- libtommath/bn_mp_sqrt.c | 6 +++--- libtommath/bn_mp_sub.c | 6 +++--- libtommath/bn_mp_sub_d.c | 6 +++--- libtommath/bn_mp_submod.c | 6 +++--- libtommath/bn_mp_to_signed_bin.c | 6 +++--- libtommath/bn_mp_to_signed_bin_n.c | 6 +++--- libtommath/bn_mp_to_unsigned_bin.c | 6 +++--- libtommath/bn_mp_to_unsigned_bin_n.c | 6 +++--- libtommath/bn_mp_toom_mul.c | 6 +++--- libtommath/bn_mp_toom_sqr.c | 6 +++--- libtommath/bn_mp_toradix.c | 6 +++--- libtommath/bn_mp_toradix_n.c | 6 +++--- libtommath/bn_mp_unsigned_bin_size.c | 6 +++--- libtommath/bn_mp_xor.c | 6 +++--- libtommath/bn_mp_zero.c | 6 +++--- libtommath/bn_prime_tab.c | 6 +++--- libtommath/bn_reverse.c | 6 +++--- libtommath/bn_s_mp_add.c | 6 +++--- libtommath/bn_s_mp_exptmod.c | 6 +++--- libtommath/bn_s_mp_mul_digs.c | 6 +++--- libtommath/bn_s_mp_mul_high_digs.c | 6 +++--- libtommath/bn_s_mp_sqr.c | 6 +++--- libtommath/bn_s_mp_sub.c | 6 +++--- libtommath/bncore.c | 6 +++--- libtommath/tommath.h | 6 +++--- libtommath/tommath_private.h | 6 +++--- libtommath/tommath_superclass.h | 6 +++--- 128 files changed, 384 insertions(+), 384 deletions(-) diff --git a/libtommath/bn_error.c b/libtommath/bn_error.c index 397f834..380f46a 100644 --- a/libtommath/bn_error.c +++ b/libtommath/bn_error.c @@ -42,6 +42,6 @@ const char *mp_error_to_string(int code) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c index fa31853..c1d6271 100644 --- a/libtommath/bn_fast_mp_invmod.c +++ b/libtommath/bn_fast_mp_invmod.c @@ -143,6 +143,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index d13452d..4d74630 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -167,6 +167,6 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index 18bea3f..59cfa38 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -102,6 +102,6 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c index 8fd5117..16f056c 100644 --- a/libtommath/bn_fast_s_mp_mul_high_digs.c +++ b/libtommath/bn_fast_s_mp_mul_high_digs.c @@ -93,6 +93,6 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index 293c54a..8fa8958 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -109,6 +109,6 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_2expt.c b/libtommath/bn_mp_2expt.c index eb5e664..36915bb 100644 --- a/libtommath/bn_mp_2expt.c +++ b/libtommath/bn_mp_2expt.c @@ -43,6 +43,6 @@ mp_2expt (mp_int * a, int b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index 16662c0..f3ec518 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -38,6 +38,6 @@ mp_abs (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index 0d91d24..2487aba 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -48,6 +48,6 @@ int mp_add (mp_int * a, mp_int * b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index 6b9dbef..b7c8ea8 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -107,6 +107,6 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index 800e10a..706e739 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -36,6 +36,6 @@ mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 6a18639..46c41a2 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -52,6 +52,6 @@ mp_and (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_clamp.c b/libtommath/bn_mp_clamp.c index b392c10..149f1a8 100644 --- a/libtommath/bn_mp_clamp.c +++ b/libtommath/bn_mp_clamp.c @@ -39,6 +39,6 @@ mp_clamp (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_clear.c b/libtommath/bn_mp_clear.c index bf0873a..37ce1e1 100644 --- a/libtommath/bn_mp_clear.c +++ b/libtommath/bn_mp_clear.c @@ -39,6 +39,6 @@ mp_clear (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_clear_multi.c b/libtommath/bn_mp_clear_multi.c index e659cf8..583b1da 100644 --- a/libtommath/bn_mp_clear_multi.c +++ b/libtommath/bn_mp_clear_multi.c @@ -29,6 +29,6 @@ void mp_clear_multi(mp_int *mp, ...) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index 6266a7e..538ba34 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -38,6 +38,6 @@ mp_cmp (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c index a1cdaa1..e66b1e4 100644 --- a/libtommath/bn_mp_cmp_d.c +++ b/libtommath/bn_mp_cmp_d.c @@ -39,6 +39,6 @@ int mp_cmp_d(mp_int * a, mp_digit b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c index b3839f0..d46a1be 100644 --- a/libtommath/bn_mp_cmp_mag.c +++ b/libtommath/bn_mp_cmp_mag.c @@ -50,6 +50,6 @@ int mp_cmp_mag (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_cnt_lsb.c b/libtommath/bn_mp_cnt_lsb.c index 42d2219..1cf6159 100644 --- a/libtommath/bn_mp_cnt_lsb.c +++ b/libtommath/bn_mp_cnt_lsb.c @@ -48,6 +48,6 @@ int mp_cnt_lsb(mp_int *a) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index 6f2ee59..1ba7381 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -63,6 +63,6 @@ mp_copy (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index e2db126..bd12a87 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -40,6 +40,6 @@ mp_count_bits (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 81d30eb..73f8779 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -290,6 +290,6 @@ LBL_Q:mp_clear (&q); #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index 2004da7..a428869 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -63,6 +63,6 @@ int mp_div_2(mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c index a5b8494..b8e27ba 100644 --- a/libtommath/bn_mp_div_2d.c +++ b/libtommath/bn_mp_div_2d.c @@ -81,6 +81,6 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index 6c79332..b716b22 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -74,6 +74,6 @@ mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index aab298a..a2022ad 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -110,6 +110,6 @@ int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c index d4dbec6..f6d39c1 100644 --- a/libtommath/bn_mp_dr_is_modulus.c +++ b/libtommath/bn_mp_dr_is_modulus.c @@ -38,6 +38,6 @@ int mp_dr_is_modulus(mp_int *a) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c index 2005f3c..920b52e 100644 --- a/libtommath/bn_mp_dr_reduce.c +++ b/libtommath/bn_mp_dr_reduce.c @@ -91,6 +91,6 @@ top: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c index 7f60c67..3aac30f 100644 --- a/libtommath/bn_mp_dr_setup.c +++ b/libtommath/bn_mp_dr_setup.c @@ -27,6 +27,6 @@ void mp_dr_setup(mp_int *a, mp_digit *d) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_exch.c b/libtommath/bn_mp_exch.c index 8dd5180..5b5b359 100644 --- a/libtommath/bn_mp_exch.c +++ b/libtommath/bn_mp_exch.c @@ -29,6 +29,6 @@ mp_exch (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index 58d71d5..2e71a27 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -83,6 +83,6 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index 0a4b90b..d5ca456 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -23,6 +23,6 @@ int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index 3bef24a..dced5a1 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -78,6 +78,6 @@ int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c index 697ef52..0998ce7 100644 --- a/libtommath/bn_mp_exptmod.c +++ b/libtommath/bn_mp_exptmod.c @@ -107,6 +107,6 @@ int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 312305e..3322544 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -316,6 +316,6 @@ LBL_M: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index f941385..d9951ec 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -78,6 +78,6 @@ LBL_ERR: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_fread.c b/libtommath/bn_mp_fread.c index 6792437..4e38c6f 100644 --- a/libtommath/bn_mp_fread.c +++ b/libtommath/bn_mp_fread.c @@ -64,6 +64,6 @@ int mp_fread(mp_int *a, int radix, FILE *stream) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c index 44812d5..daa15db 100644 --- a/libtommath/bn_mp_fwrite.c +++ b/libtommath/bn_mp_fwrite.c @@ -49,6 +49,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index fdefc1b..40e7034 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -100,6 +100,6 @@ LBL_U:mp_clear (&v); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index 4d8ecd2..f99ffb2 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -40,6 +40,6 @@ unsigned long mp_get_int(mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_grow.c b/libtommath/bn_mp_grow.c index 7fbc5a2..3d47822 100644 --- a/libtommath/bn_mp_grow.c +++ b/libtommath/bn_mp_grow.c @@ -52,6 +52,6 @@ int mp_grow (mp_int * a, int size) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_import.c b/libtommath/bn_mp_import.c index d9248fd..22e2342 100644 --- a/libtommath/bn_mp_import.c +++ b/libtommath/bn_mp_import.c @@ -68,6 +68,6 @@ int mp_import(mp_int* rop, size_t count, int order, size_t size, #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_init.c b/libtommath/bn_mp_init.c index 8a26f09..0f628df 100644 --- a/libtommath/bn_mp_init.c +++ b/libtommath/bn_mp_init.c @@ -41,6 +41,6 @@ int mp_init (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_init_copy.c b/libtommath/bn_mp_init_copy.c index ab0e130..c918d46 100644 --- a/libtommath/bn_mp_init_copy.c +++ b/libtommath/bn_mp_init_copy.c @@ -32,6 +32,6 @@ int mp_init_copy (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_init_multi.c b/libtommath/bn_mp_init_multi.c index 78ed62d..c121188 100644 --- a/libtommath/bn_mp_init_multi.c +++ b/libtommath/bn_mp_init_multi.c @@ -51,6 +51,6 @@ int mp_init_multi(mp_int *mp, ...) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_init_set.c b/libtommath/bn_mp_init_set.c index 0b5cf36..24dc8bb 100644 --- a/libtommath/bn_mp_init_set.c +++ b/libtommath/bn_mp_init_set.c @@ -27,6 +27,6 @@ int mp_init_set (mp_int * a, mp_digit b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_init_set_int.c b/libtommath/bn_mp_init_set_int.c index a9bf232..5a75e3e 100644 --- a/libtommath/bn_mp_init_set_int.c +++ b/libtommath/bn_mp_init_set_int.c @@ -26,6 +26,6 @@ int mp_init_set_int (mp_int * a, unsigned long b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_init_size.c b/libtommath/bn_mp_init_size.c index 44b875f..4e30a2b 100644 --- a/libtommath/bn_mp_init_size.c +++ b/libtommath/bn_mp_init_size.c @@ -43,6 +43,6 @@ int mp_init_size (mp_int * a, int size) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index c374fd2..75763ab 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -38,6 +38,6 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c index 879e971..cb7233d 100644 --- a/libtommath/bn_mp_invmod_slow.c +++ b/libtommath/bn_mp_invmod_slow.c @@ -170,6 +170,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 15e632e..56d19c0 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -104,6 +104,6 @@ ERR:mp_clear(&t); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c index 4e6c474..8d147e0 100644 --- a/libtommath/bn_mp_jacobi.c +++ b/libtommath/bn_mp_jacobi.c @@ -112,6 +112,6 @@ LBL_A1:mp_clear (&a1); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index 307a0d9..31ed2e3 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -162,6 +162,6 @@ ERR: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c index 3993cd9..33a2bee 100644 --- a/libtommath/bn_mp_karatsuba_sqr.c +++ b/libtommath/bn_mp_karatsuba_sqr.c @@ -116,6 +116,6 @@ ERR: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_lcm.c b/libtommath/bn_mp_lcm.c index b6a0ec1..d4bb1b6 100644 --- a/libtommath/bn_mp_lcm.c +++ b/libtommath/bn_mp_lcm.c @@ -55,6 +55,6 @@ LBL_T: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_lshd.c b/libtommath/bn_mp_lshd.c index b6cb111..e4f9abc 100644 --- a/libtommath/bn_mp_lshd.c +++ b/libtommath/bn_mp_lshd.c @@ -62,6 +62,6 @@ int mp_lshd (mp_int * a, int b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index 0c9bc3e..0bc9530 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -43,6 +43,6 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 1f2c47c..472aa58 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -50,6 +50,6 @@ mp_mod_2d (mp_int * a, int b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index 4553cba..6fbc2c3 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -22,6 +22,6 @@ mp_mod_d (mp_int * a, mp_digit b, mp_digit * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index 2b11749..3e66d3f 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -54,6 +54,6 @@ int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index d3746a6..b64c80a 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -113,6 +113,6 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index c71d362..b15bafd 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -54,6 +54,6 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index d81f68b..3819c0a 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -62,6 +62,6 @@ int mp_mul (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index 20fb9d6..eba1450 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -77,6 +77,6 @@ int mp_mul_2(mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c index b5d3cae..798a1da 100644 --- a/libtommath/bn_mp_mul_2d.c +++ b/libtommath/bn_mp_mul_2d.c @@ -80,6 +80,6 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index c0c24cd..fa918da 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -74,6 +74,6 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c index 375674f..3c7e41b 100644 --- a/libtommath/bn_mp_mulmod.c +++ b/libtommath/bn_mp_mulmod.c @@ -35,6 +35,6 @@ int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c index b7a4817..f8f9d13 100644 --- a/libtommath/bn_mp_n_root.c +++ b/libtommath/bn_mp_n_root.c @@ -25,6 +25,6 @@ int mp_n_root (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_n_root_ex.c b/libtommath/bn_mp_n_root_ex.c index c163c1d..28d6b18 100644 --- a/libtommath/bn_mp_n_root_ex.c +++ b/libtommath/bn_mp_n_root_ex.c @@ -127,6 +127,6 @@ LBL_T1:mp_clear (&t1); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c index b8a014a..f488b57 100644 --- a/libtommath/bn_mp_neg.c +++ b/libtommath/bn_mp_neg.c @@ -35,6 +35,6 @@ int mp_neg (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index fc303d2..aee9734 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -45,6 +45,6 @@ int mp_or (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c index 1b1300c..5b992b5 100644 --- a/libtommath/bn_mp_prime_fermat.c +++ b/libtommath/bn_mp_prime_fermat.c @@ -57,6 +57,6 @@ LBL_T:mp_clear (&t); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c index b97390e..f97498f 100644 --- a/libtommath/bn_mp_prime_is_divisible.c +++ b/libtommath/bn_mp_prime_is_divisible.c @@ -45,6 +45,6 @@ int mp_prime_is_divisible (mp_int * a, int *result) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c index 4a36047..29571ba 100644 --- a/libtommath/bn_mp_prime_is_prime.c +++ b/libtommath/bn_mp_prime_is_prime.c @@ -78,6 +78,6 @@ LBL_B:mp_clear (&b); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c index 569d78a..b168f01 100644 --- a/libtommath/bn_mp_prime_miller_rabin.c +++ b/libtommath/bn_mp_prime_miller_rabin.c @@ -98,6 +98,6 @@ LBL_N1:mp_clear (&n1); } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_next_prime.c b/libtommath/bn_mp_prime_next_prime.c index c0b7895..6515b1c 100644 --- a/libtommath/bn_mp_prime_next_prime.c +++ b/libtommath/bn_mp_prime_next_prime.c @@ -165,6 +165,6 @@ LBL_ERR: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_rabin_miller_trials.c b/libtommath/bn_mp_prime_rabin_miller_trials.c index ad954cc..c98de6e 100644 --- a/libtommath/bn_mp_prime_rabin_miller_trials.c +++ b/libtommath/bn_mp_prime_rabin_miller_trials.c @@ -47,6 +47,6 @@ int mp_prime_rabin_miller_trials(int size) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_prime_random_ex.c b/libtommath/bn_mp_prime_random_ex.c index 655e8ae..04a7cf7 100644 --- a/libtommath/bn_mp_prime_random_ex.c +++ b/libtommath/bn_mp_prime_random_ex.c @@ -119,6 +119,6 @@ error: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c index e9cb55a..4a58e41 100644 --- a/libtommath/bn_mp_radix_size.c +++ b/libtommath/bn_mp_radix_size.c @@ -73,6 +73,6 @@ int mp_radix_size (mp_int * a, int radix, int *size) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_radix_smap.c b/libtommath/bn_mp_radix_smap.c index 425e0e6..e351146 100644 --- a/libtommath/bn_mp_radix_smap.c +++ b/libtommath/bn_mp_radix_smap.c @@ -19,6 +19,6 @@ const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c index 7c8f106..d5967c2 100644 --- a/libtommath/bn_mp_rand.c +++ b/libtommath/bn_mp_rand.c @@ -75,6 +75,6 @@ mp_rand (mp_int * a, int digits) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index 6f2cc04..03384e3 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -80,6 +80,6 @@ int mp_read_radix (mp_int * a, const char *str, int radix) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_read_signed_bin.c b/libtommath/bn_mp_read_signed_bin.c index 1448d21..a034fbd 100644 --- a/libtommath/bn_mp_read_signed_bin.c +++ b/libtommath/bn_mp_read_signed_bin.c @@ -36,6 +36,6 @@ int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_read_unsigned_bin.c b/libtommath/bn_mp_read_unsigned_bin.c index b2e399d..27af256 100644 --- a/libtommath/bn_mp_read_unsigned_bin.c +++ b/libtommath/bn_mp_read_unsigned_bin.c @@ -50,6 +50,6 @@ int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c index c15b54e..a87fc30 100644 --- a/libtommath/bn_mp_reduce.c +++ b/libtommath/bn_mp_reduce.c @@ -95,6 +95,6 @@ CLEANUP: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k.c b/libtommath/bn_mp_reduce_2k.c index daea5e7..4f13b07 100644 --- a/libtommath/bn_mp_reduce_2k.c +++ b/libtommath/bn_mp_reduce_2k.c @@ -58,6 +58,6 @@ ERR: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k_l.c b/libtommath/bn_mp_reduce_2k_l.c index d6c2aa4..b41677a 100644 --- a/libtommath/bn_mp_reduce_2k_l.c +++ b/libtommath/bn_mp_reduce_2k_l.c @@ -59,6 +59,6 @@ ERR: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c index f4650b4..a0c507f 100644 --- a/libtommath/bn_mp_reduce_2k_setup.c +++ b/libtommath/bn_mp_reduce_2k_setup.c @@ -42,6 +42,6 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c index 7945d6a..7083533 100644 --- a/libtommath/bn_mp_reduce_2k_setup_l.c +++ b/libtommath/bn_mp_reduce_2k_setup_l.c @@ -39,6 +39,6 @@ ERR: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c index e68d704..2e61839 100644 --- a/libtommath/bn_mp_reduce_is_2k.c +++ b/libtommath/bn_mp_reduce_is_2k.c @@ -47,6 +47,6 @@ int mp_reduce_is_2k(mp_int *a) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index 5426352..65ae46e 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -39,6 +39,6 @@ int mp_reduce_is_2k_l(mp_int *a) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c index d3ed42f..ffddbce 100644 --- a/libtommath/bn_mp_reduce_setup.c +++ b/libtommath/bn_mp_reduce_setup.c @@ -29,6 +29,6 @@ int mp_reduce_setup (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_rshd.c b/libtommath/bn_mp_rshd.c index 6ea4f2f..f412d93 100644 --- a/libtommath/bn_mp_rshd.c +++ b/libtommath/bn_mp_rshd.c @@ -67,6 +67,6 @@ void mp_rshd (mp_int * a, int b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_set.c b/libtommath/bn_mp_set.c index c10850d..8eec001 100644 --- a/libtommath/bn_mp_set.c +++ b/libtommath/bn_mp_set.c @@ -24,6 +24,6 @@ void mp_set (mp_int * a, mp_digit b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_set_int.c b/libtommath/bn_mp_set_int.c index 3e9ae87..f456a3a 100644 --- a/libtommath/bn_mp_set_int.c +++ b/libtommath/bn_mp_set_int.c @@ -43,6 +43,6 @@ int mp_set_int (mp_int * a, unsigned long b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_set_long.c b/libtommath/bn_mp_set_long.c index 680781b..fbf9f82 100644 --- a/libtommath/bn_mp_set_long.c +++ b/libtommath/bn_mp_set_long.c @@ -19,6 +19,6 @@ MP_SET_XLONG(mp_set_long, unsigned long) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_set_long_long.c b/libtommath/bn_mp_set_long_long.c index 7fde01a..0a688c8 100644 --- a/libtommath/bn_mp_set_long_long.c +++ b/libtommath/bn_mp_set_long_long.c @@ -19,6 +19,6 @@ MP_SET_XLONG(mp_set_long_long, unsigned long long) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_shrink.c b/libtommath/bn_mp_shrink.c index ef71874..9422a54 100644 --- a/libtommath/bn_mp_shrink.c +++ b/libtommath/bn_mp_shrink.c @@ -36,6 +36,6 @@ int mp_shrink (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c index 261f036..bb63407 100644 --- a/libtommath/bn_mp_signed_bin_size.c +++ b/libtommath/bn_mp_signed_bin_size.c @@ -22,6 +22,6 @@ int mp_signed_bin_size (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index e0c2e85..299308d 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -55,6 +55,6 @@ mp_sqr (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index 25ca55e..05ea9e0 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -36,6 +36,6 @@ mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index 77078e8..72d98f0 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -76,6 +76,6 @@ E2: mp_clear(&t1); #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index cf7d58e..67da8da 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -54,6 +54,6 @@ mp_sub (mp_int * a, mp_int * b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index 482de39..a4e1b1c 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -88,6 +88,6 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index f6098b3..ec7885c 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -37,6 +37,6 @@ mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c index 077b0bf..109d8f7 100644 --- a/libtommath/bn_mp_to_signed_bin.c +++ b/libtommath/bn_mp_to_signed_bin.c @@ -28,6 +28,6 @@ int mp_to_signed_bin (mp_int * a, unsigned char *b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c index 2edb8e0..bcbdf79 100644 --- a/libtommath/bn_mp_to_signed_bin_n.c +++ b/libtommath/bn_mp_to_signed_bin_n.c @@ -26,6 +26,6 @@ int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c index 203bf75..0ac9887 100644 --- a/libtommath/bn_mp_to_unsigned_bin.c +++ b/libtommath/bn_mp_to_unsigned_bin.c @@ -43,6 +43,6 @@ int mp_to_unsigned_bin (mp_int * a, unsigned char *b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c index d28d7f4..19fe1e4 100644 --- a/libtommath/bn_mp_to_unsigned_bin_n.c +++ b/libtommath/bn_mp_to_unsigned_bin_n.c @@ -26,6 +26,6 @@ int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index dc4f0a9..9a347fa 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -281,6 +281,6 @@ ERR: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 06a568e..327a85f 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -223,6 +223,6 @@ ERR: #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index 5bd9165..baf0e3b 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -70,6 +70,6 @@ int mp_toradix (mp_int * a, char *str, int radix) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index d1587a3..881cb52 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -83,6 +83,6 @@ int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c index e81cd82..74f6ed0 100644 --- a/libtommath/bn_mp_unsigned_bin_size.c +++ b/libtommath/bn_mp_unsigned_bin_size.c @@ -23,6 +23,6 @@ int mp_unsigned_bin_size (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index 1fc8bdf..9c83126 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -46,6 +46,6 @@ mp_xor (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_mp_zero.c b/libtommath/bn_mp_zero.c index f607ce6..a76c2a9 100644 --- a/libtommath/bn_mp_zero.c +++ b/libtommath/bn_mp_zero.c @@ -31,6 +31,6 @@ void mp_zero (mp_int * a) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_prime_tab.c b/libtommath/bn_prime_tab.c index 4354a48..77535c7 100644 --- a/libtommath/bn_prime_tab.c +++ b/libtommath/bn_prime_tab.c @@ -56,6 +56,6 @@ const mp_digit ltm_prime_tab[] = { }; #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_reverse.c b/libtommath/bn_reverse.c index 9811a81..9c00f2b 100644 --- a/libtommath/bn_reverse.c +++ b/libtommath/bn_reverse.c @@ -34,6 +34,6 @@ bn_reverse (unsigned char *s, int len) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 5d886e7..2069d88 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -104,6 +104,6 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index 617b56c..8b10003 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -247,6 +247,6 @@ LBL_M: } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index cf2f50c..41bca7b 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -85,6 +85,6 @@ int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 1d5b2f0..7e18680 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -76,6 +76,6 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index b85f1b8..3bcc7c9 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -79,6 +79,6 @@ int s_mp_sqr (mp_int * a, mp_int * b) } #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index ac3f785..260a95f 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -84,6 +84,6 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c) #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/bncore.c b/libtommath/bncore.c index 8bd4681..b07c629 100644 --- a/libtommath/bncore.c +++ b/libtommath/bncore.c @@ -31,6 +31,6 @@ int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsub TOOM_SQR_CUTOFF = 400; #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 0a065f6..4547488 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -565,6 +565,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream); #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 407ebd5..4c5389c 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -118,6 +118,6 @@ int func_name (mp_int * a, type b) \ #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ diff --git a/libtommath/tommath_superclass.h b/libtommath/tommath_superclass.h index 8f6ef03..2489a07 100644 --- a/libtommath/tommath_superclass.h +++ b/libtommath/tommath_superclass.h @@ -71,6 +71,6 @@ #endif -/* ref: HEAD -> release/1.0.1, tag: v1.0.1-rc2 */ -/* git commit: e8c27ba7df0efb90708029115c94d681dfa7812f */ -/* commit time: 2017-08-29 10:48:46 +0200 */ +/* ref: tag: v1.0.1, master */ +/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ +/* commit time: 2017-08-29 22:27:36 +0200 */ -- cgit v0.12 From 97d25d790293019ab4bbb60c7973037f9d815e25 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 29 Aug 2017 21:16:54 +0000 Subject: Forgot a few files from libtommath 1.0.1 --- libtommath/callgraph.txt | 21404 +++++++++++++++++++++---------------------- libtommath/changes.txt | 18 +- libtommath/makefile | 124 +- libtommath/makefile.shared | 25 +- 4 files changed, 10698 insertions(+), 10873 deletions(-) diff --git a/libtommath/callgraph.txt b/libtommath/callgraph.txt index e98a910..52007c0 100644 --- a/libtommath/callgraph.txt +++ b/libtommath/callgraph.txt @@ -1,139 +1,156 @@ -BN_MP_KARATSUBA_MUL_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C +BNCORE_C + + +BN_ERROR_C + + +BN_FAST_MP_INVMOD_C ++--->BN_MP_INIT_MULTI_C +| +--->BN_MP_INIT_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_MOD_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C +| | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C | | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_CLAMP_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_CLAMP_C -+--->BN_S_MP_ADD_C -| +--->BN_MP_GROW_C ++--->BN_MP_CMP_C +| +--->BN_MP_CMP_MAG_C ++--->BN_MP_CMP_D_C +--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C | +--->BN_MP_CMP_MAG_C | +--->BN_S_MP_SUB_C | | +--->BN_MP_GROW_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -+--->BN_MP_CLEAR_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_CLEAR_C -BN_MP_ZERO_C +BN_FAST_MP_MONTGOMERY_REDUCE_C ++--->BN_MP_GROW_C ++--->BN_MP_RSHD_C +| +--->BN_MP_ZERO_C ++--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C -BN_MP_SET_C -+--->BN_MP_ZERO_C +BN_FAST_S_MP_MUL_DIGS_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C -BN_MP_TO_SIGNED_BIN_C -+--->BN_MP_TO_UNSIGNED_BIN_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C +BN_FAST_S_MP_MUL_HIGH_DIGS_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C -BN_S_MP_SUB_C +BN_FAST_S_MP_SQR_C +--->BN_MP_GROW_C +--->BN_MP_CLAMP_C -BN_MP_JACOBI_C -+--->BN_MP_CMP_D_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C +BN_MP_2EXPT_C ++--->BN_MP_ZERO_C ++--->BN_MP_GROW_C + + +BN_MP_ABS_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C + + +BN_MP_ADDMOD_C ++--->BN_MP_INIT_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C | | +--->BN_MP_GROW_C -+--->BN_MP_CNT_LSB_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C | | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C +--->BN_MP_MOD_C +| +--->BN_MP_INIT_SIZE_C | +--->BN_MP_DIV_C | | +--->BN_MP_CMP_MAG_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C | | +--->BN_MP_ZERO_C | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C | | +--->BN_MP_SET_C | | +--->BN_MP_COUNT_BITS_C | | +--->BN_MP_ABS_C @@ -150,17 +167,14 @@ BN_MP_JACOBI_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_COPY_C | | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_RSHD_C @@ -169,701 +183,934 @@ BN_MP_JACOBI_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C | +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C -BN_MP_INIT_COPY_C -+--->BN_MP_INIT_SIZE_C -+--->BN_MP_COPY_C +BN_MP_ADD_C ++--->BN_S_MP_ADD_C | +--->BN_MP_GROW_C - - -BN_MP_ABS_C -+--->BN_MP_COPY_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C | +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C -BN_MP_RADIX_SMAP_C - - -BN_MP_EXCH_C +BN_MP_ADD_D_C ++--->BN_MP_GROW_C ++--->BN_MP_SUB_D_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLAMP_C -BN_MP_EXPORT_C +BN_MP_AND_C +--->BN_MP_INIT_COPY_C | +--->BN_MP_INIT_SIZE_C | +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_CLAMP_C | +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C +--->BN_MP_CLEAR_C -BN_MP_TO_UNSIGNED_BIN_N_C -+--->BN_MP_UNSIGNED_BIN_SIZE_C -| +--->BN_MP_COUNT_BITS_C -+--->BN_MP_TO_UNSIGNED_BIN_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C +BN_MP_CLAMP_C -BN_MP_TO_SIGNED_BIN_N_C -+--->BN_MP_SIGNED_BIN_SIZE_C -| +--->BN_MP_UNSIGNED_BIN_SIZE_C -| | +--->BN_MP_COUNT_BITS_C -+--->BN_MP_TO_SIGNED_BIN_C -| +--->BN_MP_TO_UNSIGNED_BIN_C -| | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C +BN_MP_CLEAR_C -BN_MP_LCM_C +BN_MP_CLEAR_MULTI_C ++--->BN_MP_CLEAR_C + + +BN_MP_CMP_C ++--->BN_MP_CMP_MAG_C + + +BN_MP_CMP_D_C + + +BN_MP_CMP_MAG_C + + +BN_MP_CNT_LSB_C + + +BN_MP_COPY_C ++--->BN_MP_GROW_C + + +BN_MP_COUNT_BITS_C + + +BN_MP_DIV_2D_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_ZERO_C ++--->BN_MP_MOD_2D_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_RSHD_C ++--->BN_MP_CLAMP_C + + +BN_MP_DIV_2_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C + + +BN_MP_DIV_3_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C + + +BN_MP_DIV_C ++--->BN_MP_CMP_MAG_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_ZERO_C +--->BN_MP_INIT_MULTI_C | +--->BN_MP_INIT_C | +--->BN_MP_CLEAR_C -+--->BN_MP_GCD_C -| +--->BN_MP_ABS_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_CNT_LSB_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C ++--->BN_MP_SET_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_ABS_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C | | +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_MP_EXCH_C | +--->BN_S_MP_SUB_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_CMP_MAG_C -+--->BN_MP_DIV_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_SET_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_ABS_C -| +--->BN_MP_MUL_2D_C +| +--->BN_S_MP_SUB_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_MOD_2D_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_CLEAR_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_INIT_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C ++--->BN_MP_RSHD_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_DIV_D_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_3_C | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_SIZE_C | +--->BN_MP_INIT_C -| +--->BN_MP_INIT_COPY_C -| +--->BN_MP_LSHD_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C + + +BN_MP_DR_IS_MODULUS_C + + +BN_MP_DR_REDUCE_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C + + +BN_MP_DR_SETUP_C + + +BN_MP_EXCH_C + + +BN_MP_EXPORT_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_MUL_D_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C | | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C ++--->BN_MP_CLEAR_C + + +BN_MP_EXPTMOD_C ++--->BN_MP_INIT_C ++--->BN_MP_INVMOD_C +| +--->BN_MP_CMP_D_C +| +--->BN_FAST_MP_INVMOD_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_ABS_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C +| | +--->BN_MP_CMP_C +| | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_INVMOD_SLOW_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_C | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_ABS_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_DIV_2_C | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_CMP_MAG_C | | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C - - -BN_MP_CMP_MAG_C - - -BN_MP_PRIME_RABIN_MILLER_TRIALS_C - - -BN_MP_MUL_2D_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_GROW_C -+--->BN_MP_LSHD_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -+--->BN_MP_CLAMP_C - - -BN_MP_MUL_C -+--->BN_MP_TOOM_MUL_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C ++--->BN_MP_ABS_C | +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_2_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C ++--->BN_MP_CLEAR_MULTI_C ++--->BN_MP_REDUCE_IS_2K_L_C ++--->BN_S_MP_EXPTMOD_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_REDUCE_SETUP_C +| | +--->BN_MP_2EXPT_C +| | | +--->BN_MP_ZERO_C | | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_3_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_KARATSUBA_MUL_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ADD_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C +| +--->BN_MP_REDUCE_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C | | +--->BN_MP_RSHD_C | | | +--->BN_MP_ZERO_C -| +--->BN_MP_CLEAR_C -+--->BN_FAST_S_MP_MUL_DIGS_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_S_MP_MUL_DIGS_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C - - -BN_MP_SQR_C -+--->BN_MP_TOOM_SQR_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_2_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_D_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | | +--->BN_MP_CMP_MAG_C | | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C +| +--->BN_MP_REDUCE_2K_SETUP_L_C +| | +--->BN_MP_2EXPT_C +| | | +--->BN_MP_ZERO_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C | | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_3_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_KARATSUBA_SQR_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C +| +--->BN_MP_REDUCE_2K_L_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C | | | +--->BN_MP_ZERO_C -| +--->BN_MP_ADD_C -| | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_CLEAR_C -+--->BN_FAST_S_MP_SQR_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_S_MP_SQR_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C - - -BN_MP_INIT_C - - -BN_MP_2EXPT_C -+--->BN_MP_ZERO_C -+--->BN_MP_GROW_C - - -BN_MP_SIGNED_BIN_SIZE_C -+--->BN_MP_UNSIGNED_BIN_SIZE_C -| +--->BN_MP_COUNT_BITS_C - - -BN_MP_OR_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_MOD_C -+--->BN_MP_INIT_C -+--->BN_MP_DIV_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_SET_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_ABS_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_ADD_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C | | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C | | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_MOD_2D_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_COPY_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C -+--->BN_MP_EXCH_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C - - -BN_MP_DIV_C -+--->BN_MP_CMP_MAG_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_ZERO_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_SET_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_ABS_C -+--->BN_MP_MUL_2D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SUB_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_INIT_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_INIT_C -+--->BN_MP_INIT_COPY_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -+--->BN_MP_RSHD_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C - - -BN_MP_INIT_SET_C -+--->BN_MP_INIT_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C - - -BN_MP_PRIME_IS_PRIME_C -+--->BN_MP_CMP_D_C -+--->BN_MP_PRIME_IS_DIVISIBLE_C -| +--->BN_MP_MOD_D_C -| | +--->BN_MP_DIV_D_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_DIV_2D_C +| +--->BN_MP_SQR_C +| | +--->BN_MP_TOOM_SQR_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_C -| | | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_KARATSUBA_SQR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SQR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_DIV_3_C | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_C | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_PRIME_MILLER_RABIN_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_EXCH_C ++--->BN_MP_DR_IS_MODULUS_C ++--->BN_MP_REDUCE_IS_2K_C +| +--->BN_MP_REDUCE_2K_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C -| +--->BN_MP_SUB_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_D_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CNT_LSB_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C +| | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_COUNT_BITS_C ++--->BN_MP_EXPTMOD_FAST_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_MONTGOMERY_SETUP_C +| +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | +--->BN_MP_GROW_C | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_EXPTMOD_C -| | +--->BN_MP_INVMOD_C -| | | +--->BN_FAST_MP_INVMOD_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COUNT_BITS_C -| | | | | | +--->BN_MP_ABS_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| +--->BN_MP_MONTGOMERY_REDUCE_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| +--->BN_MP_DR_SETUP_C +| +--->BN_MP_DR_REDUCE_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| +--->BN_MP_REDUCE_2K_SETUP_C +| | +--->BN_MP_2EXPT_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_REDUCE_2K_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | +--->BN_MP_2EXPT_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_MULMOD_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -871,9 +1118,7 @@ BN_MP_PRIME_IS_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -881,326 +1126,159 @@ BN_MP_PRIME_IS_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_INVMOD_SLOW_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COUNT_BITS_C -| | | | | | +--->BN_MP_ABS_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_ABS_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_REDUCE_IS_2K_L_C -| | +--->BN_S_MP_EXPTMOD_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_REDUCE_SETUP_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_2K_SETUP_L_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_2K_L_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_SQR_C +| | +--->BN_MP_TOOM_SQR_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -1208,188 +1286,7 @@ BN_MP_PRIME_IS_PRIME_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SQR_C -| | | | +--->BN_MP_TOOM_SQR_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_FAST_S_MP_SQR_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DR_IS_MODULUS_C -| | +--->BN_MP_REDUCE_IS_2K_C -| | | +--->BN_MP_REDUCE_2K_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -1397,41 +1294,58 @@ BN_MP_PRIME_IS_PRIME_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_EXPTMOD_FAST_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_MONTGOMERY_SETUP_C -| | | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_DIV_2_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_KARATSUBA_SQR_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_ADD_C | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_DR_SETUP_C -| | | +--->BN_MP_DR_REDUCE_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SQR_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_REDUCE_2K_SETUP_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_2K_C -| | | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -1439,423 +1353,453 @@ BN_MP_PRIME_IS_PRIME_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C | | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MULMOD_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| +--->BN_MP_EXCH_C + + +BN_MP_EXPTMOD_FAST_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLEAR_C ++--->BN_MP_MONTGOMERY_SETUP_C ++--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C ++--->BN_MP_MONTGOMERY_REDUCE_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C ++--->BN_MP_DR_SETUP_C ++--->BN_MP_DR_REDUCE_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C ++--->BN_MP_REDUCE_2K_SETUP_C +| +--->BN_MP_INIT_C +| +--->BN_MP_2EXPT_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_GROW_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_REDUCE_2K_C +| +--->BN_MP_INIT_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| +--->BN_MP_2EXPT_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_2_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_MULMOD_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_INIT_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SQR_C -| | | | +--->BN_MP_TOOM_SQR_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| +--->BN_MP_CMP_C -| | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_SQRMOD_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_COPY_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_INIT_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_ABS_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_MOD_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_SQR_C +| +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_KARATSUBA_SQR_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C ++--->BN_MP_EXCH_C + + +BN_MP_EXPT_D_C ++--->BN_MP_EXPT_D_EX_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_ABS_C -| | | | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C +| | | +--->BN_MP_SUB_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -1863,316 +1807,224 @@ BN_MP_PRIME_IS_PRIME_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C - - -BN_FAST_S_MP_SQR_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_MP_UNSIGNED_BIN_SIZE_C -+--->BN_MP_COUNT_BITS_C - - -BN_MP_INIT_SIZE_C -+--->BN_MP_INIT_C - - -BN_FAST_S_MP_MUL_DIGS_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_MP_REDUCE_IS_2K_L_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_SQR_C +| | +--->BN_MP_TOOM_SQR_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_KARATSUBA_SQR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SQR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C -BN_MP_REDUCE_IS_2K_C -+--->BN_MP_REDUCE_2K_C -| +--->BN_MP_INIT_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C +BN_MP_EXPT_D_EX_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C | | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_MUL_DIGS_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_COUNT_BITS_C - - -BN_MP_SUB_C -+--->BN_S_MP_ADD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C - - -BN_MP_REDUCE_2K_SETUP_C -+--->BN_MP_INIT_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_2EXPT_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_GROW_C -+--->BN_MP_CLEAR_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C - - -BN_MP_DIV_2D_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_ZERO_C -+--->BN_MP_INIT_C -+--->BN_MP_MOD_2D_C -| +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +--->BN_MP_CLEAR_C -+--->BN_MP_RSHD_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C - - -BN_MP_DR_REDUCE_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C - - -BN_MP_SQRT_C -+--->BN_MP_N_ROOT_C -| +--->BN_MP_N_ROOT_EX_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_SET_C ++--->BN_MP_SQR_C +| +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_EXPT_D_EX_C -| | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_SQR_C -| | | | +--->BN_MP_TOOM_SQR_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_FAST_S_MP_SQR_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C | | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C @@ -2181,74 +2033,62 @@ BN_MP_SQRT_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_ABS_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_CMP_C -| | | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_SUB_D_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_ZERO_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C +| | +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_KARATSUBA_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| +--->BN_FAST_S_MP_SQR_C | | +--->BN_MP_GROW_C -+--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C + + +BN_MP_EXTEUCLID_C ++--->BN_MP_INIT_MULTI_C +| +--->BN_MP_INIT_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C +--->BN_MP_DIV_C | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_SET_C +| +--->BN_MP_ZERO_C | +--->BN_MP_COUNT_BITS_C | +--->BN_MP_ABS_C | +--->BN_MP_MUL_2D_C | | +--->BN_MP_GROW_C | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C | +--->BN_MP_CMP_C | +--->BN_MP_SUB_C @@ -2268,49 +2108,30 @@ BN_MP_SQRT_C | +--->BN_MP_DIV_2D_C | | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C | +--->BN_MP_EXCH_C | +--->BN_MP_CLEAR_MULTI_C | | +--->BN_MP_CLEAR_C | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_INIT_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_CLEAR_C | +--->BN_MP_LSHD_C | | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| +--->BN_MP_RSHD_C | +--->BN_MP_MUL_D_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C | +--->BN_MP_CLAMP_C | +--->BN_MP_CLEAR_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_MULMOD_C -+--->BN_MP_INIT_C +--->BN_MP_MUL_C | +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C | | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C | | +--->BN_MP_RSHD_C | | | +--->BN_MP_ZERO_C | | +--->BN_MP_MUL_2_C @@ -2343,6 +2164,7 @@ BN_MP_MULMOD_C | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C @@ -2352,6 +2174,7 @@ BN_MP_MULMOD_C | | | +--->BN_MP_CLEAR_C | +--->BN_MP_KARATSUBA_MUL_C | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C | | +--->BN_MP_CLAMP_C | | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C @@ -2371,84 +2194,205 @@ BN_MP_MULMOD_C | | +--->BN_MP_CLAMP_C | +--->BN_S_MP_MUL_DIGS_C | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C | | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C | | +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C -+--->BN_MP_MOD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_NEG_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_CLEAR_C + + +BN_MP_FREAD_C ++--->BN_MP_ZERO_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_SUB_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_D_C + + +BN_MP_FWRITE_C ++--->BN_MP_RADIX_SIZE_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_DIV_D_C +| | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_ZERO_C | | | +--->BN_MP_MOD_2D_C | | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_TORADIX_C +| +--->BN_MP_INIT_COPY_C | | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C +| | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_DIV_D_C +| | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C -BN_MP_INVMOD_C -+--->BN_FAST_MP_INVMOD_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_CLEAR_C +BN_MP_GCD_C ++--->BN_MP_ABS_C | +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CNT_LSB_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_MP_EXCH_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_RSHD_C | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_ABS_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_GET_INT_C + + +BN_MP_GET_LONG_C + + +BN_MP_GET_LONG_LONG_C + + +BN_MP_GROW_C + + +BN_MP_IMPORT_C ++--->BN_MP_ZERO_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLAMP_C + + +BN_MP_INIT_C + + +BN_MP_INIT_COPY_C ++--->BN_MP_INIT_SIZE_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_CLEAR_C + + +BN_MP_INIT_MULTI_C ++--->BN_MP_INIT_C ++--->BN_MP_CLEAR_C + + +BN_MP_INIT_SET_C ++--->BN_MP_INIT_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C + + +BN_MP_INIT_SET_INT_C ++--->BN_MP_INIT_C ++--->BN_MP_SET_INT_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C + + +BN_MP_INIT_SIZE_C ++--->BN_MP_INIT_C + + +BN_MP_INVMOD_C ++--->BN_MP_CMP_D_C ++--->BN_FAST_MP_INVMOD_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_ABS_C | | | +--->BN_MP_MUL_2D_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_LSHD_C @@ -2472,15 +2416,14 @@ BN_MP_INVMOD_C | | | +--->BN_MP_DIV_2D_C | | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_MULTI_C | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_LSHD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_RSHD_C @@ -2515,7 +2458,6 @@ BN_MP_INVMOD_C | | | +--->BN_MP_CLAMP_C | +--->BN_MP_CMP_C | | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_CMP_D_C | +--->BN_MP_ADD_C | | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C @@ -2532,7 +2474,8 @@ BN_MP_INVMOD_C | | +--->BN_MP_INIT_C | | +--->BN_MP_CLEAR_C | +--->BN_MP_MOD_C -| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C | | +--->BN_MP_DIV_C | | | +--->BN_MP_CMP_MAG_C | | | +--->BN_MP_COPY_C @@ -2564,15 +2507,14 @@ BN_MP_INVMOD_C | | | +--->BN_MP_DIV_2D_C | | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_MULTI_C | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_LSHD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_RSHD_C @@ -2617,264 +2559,363 @@ BN_MP_INVMOD_C | | | +--->BN_MP_CLAMP_C | +--->BN_MP_CMP_C | | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_CMP_D_C | +--->BN_MP_CMP_MAG_C | +--->BN_MP_EXCH_C | +--->BN_MP_CLEAR_MULTI_C | | +--->BN_MP_CLEAR_C -BN_MP_PRIME_MILLER_RABIN_C -+--->BN_MP_CMP_D_C -+--->BN_MP_INIT_COPY_C +BN_MP_INVMOD_SLOW_C ++--->BN_MP_INIT_MULTI_C +| +--->BN_MP_INIT_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_MOD_C | +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_SUB_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_ADD_D_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C | +--->BN_MP_CLAMP_C -+--->BN_MP_CNT_LSB_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C | | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C | | +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_C +| +--->BN_MP_CMP_MAG_C ++--->BN_MP_CMP_D_C ++--->BN_MP_CMP_MAG_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_MULTI_C | +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_EXPTMOD_C -| +--->BN_MP_INVMOD_C -| | +--->BN_FAST_MP_INVMOD_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C + + +BN_MP_IS_SQUARE_C ++--->BN_MP_MOD_D_C +| +--->BN_MP_DIV_D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_SET_INT_C +| +--->BN_MP_INIT_C +| +--->BN_MP_SET_INT_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2D_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_MOD_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C ++--->BN_MP_GET_INT_C ++--->BN_MP_SQRT_C +| +--->BN_MP_N_ROOT_C +| | +--->BN_MP_N_ROOT_EX_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_EXPT_D_EX_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_MUL_2D_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_MUL_D_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INVMOD_SLOW_C -| | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_SQR_C +| | | | | +--->BN_MP_TOOM_SQR_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_MUL_2D_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_MUL_D_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_ABS_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_REDUCE_IS_2K_L_C -| +--->BN_S_MP_EXPTMOD_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_REDUCE_SETUP_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_FAST_S_MP_SQR_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SQR_C +| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_MUL_C | | | | +--->BN_MP_TOOM_MUL_C | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C | | | | | +--->BN_MP_MOD_2D_C | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_MUL_2_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_ADD_C @@ -2907,8 +2948,11 @@ BN_MP_PRIME_MILLER_RABIN_C | | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_KARATSUBA_MUL_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C @@ -2922,6 +2966,9 @@ BN_MP_PRIME_MILLER_RABIN_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -2929,28 +2976,7 @@ BN_MP_PRIME_MILLER_RABIN_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_SUB_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C @@ -2959,333 +2985,144 @@ BN_MP_PRIME_MILLER_RABIN_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_SETUP_L_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_L_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_MUL_D_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MOD_C | | | +--->BN_MP_DIV_C | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_ABS_C | | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_CMP_C | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_SUB_D_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_ADD_D_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DR_IS_MODULUS_C -| +--->BN_MP_REDUCE_IS_2K_C -| | +--->BN_MP_REDUCE_2K_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_MUL_D_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_EXPTMOD_FAST_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_MONTGOMERY_SETUP_C -| | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_MONTGOMERY_REDUCE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_DR_SETUP_C -| | +--->BN_MP_DR_REDUCE_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_REDUCE_2K_SETUP_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C +| +--->BN_MP_DIV_2_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_SQR_C +| +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_C -| | | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C @@ -3293,734 +3130,575 @@ BN_MP_PRIME_MILLER_RABIN_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SET_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_KARATSUBA_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C | | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_CMP_MAG_C ++--->BN_MP_CLEAR_C + + +BN_MP_JACOBI_C ++--->BN_MP_CMP_D_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CNT_LSB_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MOD_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MULMOD_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C | | +--->BN_MP_EXCH_C -+--->BN_MP_CMP_C -| +--->BN_MP_CMP_MAG_C -+--->BN_MP_SQRMOD_C -| +--->BN_MP_SQR_C -| | +--->BN_MP_TOOM_SQR_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_KARATSUBA_MUL_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_KARATSUBA_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SQR_C +| | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_ABS_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLAMP_C ++--->BN_S_MP_ADD_C +| +--->BN_MP_GROW_C ++--->BN_MP_ADD_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C ++--->BN_MP_CLEAR_C + + +BN_MP_KARATSUBA_SQR_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLAMP_C ++--->BN_MP_SQR_C +| +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_GROW_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_S_MP_ADD_C +| +--->BN_MP_GROW_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C ++--->BN_MP_ADD_C +| +--->BN_MP_CMP_MAG_C +--->BN_MP_CLEAR_C -BN_MP_READ_UNSIGNED_BIN_C -+--->BN_MP_GROW_C -+--->BN_MP_ZERO_C -+--->BN_MP_MUL_2D_C -| +--->BN_MP_COPY_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLAMP_C - - -BN_MP_N_ROOT_C -+--->BN_MP_N_ROOT_EX_C +BN_MP_LCM_C ++--->BN_MP_INIT_MULTI_C | +--->BN_MP_INIT_C -| +--->BN_MP_SET_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_GCD_C +| +--->BN_MP_ABS_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CNT_LSB_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_MP_EXCH_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CMP_MAG_C ++--->BN_MP_DIV_C | +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| +--->BN_MP_EXPT_D_EX_C -| | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_SET_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_ABS_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_INIT_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_CLEAR_MULTI_C | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C | | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ZERO_C | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CMP_C -| | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_SUB_D_C +| +--->BN_FAST_S_MP_MUL_DIGS_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_D_C -| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_MULTI_C | +--->BN_MP_CLEAR_C -BN_MP_EXPT_D_EX_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C +BN_MP_LSHD_C ++--->BN_MP_GROW_C ++--->BN_MP_RSHD_C +| +--->BN_MP_ZERO_C + + +BN_MP_MOD_2D_C ++--->BN_MP_ZERO_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C + + +BN_MP_MOD_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_DIV_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_SET_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_ABS_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C ++--->BN_MP_EXCH_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C + + +BN_MP_MOD_D_C ++--->BN_MP_DIV_D_C | +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_3_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C + + +BN_MP_MONTGOMERY_CALC_NORMALIZATION_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_2EXPT_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_GROW_C +--->BN_MP_SET_C | +--->BN_MP_ZERO_C ++--->BN_MP_MUL_2_C +| +--->BN_MP_GROW_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C + + +BN_MP_MONTGOMERY_REDUCE_C ++--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C ++--->BN_MP_RSHD_C +| +--->BN_MP_ZERO_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C + + +BN_MP_MONTGOMERY_SETUP_C + + +BN_MP_MULMOD_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C +--->BN_MP_MUL_C | +--->BN_MP_TOOM_MUL_C | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLEAR_C | | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_ZERO_C @@ -4060,7 +3738,6 @@ BN_MP_EXPT_D_EX_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C @@ -4069,7 +3746,6 @@ BN_MP_EXPT_D_EX_C | | +--->BN_MP_CLEAR_MULTI_C | | | +--->BN_MP_CLEAR_C | +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C | | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C @@ -4088,99 +3764,325 @@ BN_MP_EXPT_D_EX_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C | +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C | | +--->BN_MP_CLEAR_C +--->BN_MP_CLEAR_C -+--->BN_MP_SQR_C -| +--->BN_MP_TOOM_SQR_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C ++--->BN_MP_MOD_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C +| | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C | | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_KARATSUBA_SQR_C -| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C | | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C | | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| +--->BN_FAST_S_MP_SQR_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLAMP_C -BN_MP_EXPT_D_C -+--->BN_MP_EXPT_D_EX_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C +BN_MP_MUL_2D_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_GROW_C ++--->BN_MP_LSHD_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C ++--->BN_MP_CLAMP_C + + +BN_MP_MUL_2_C ++--->BN_MP_GROW_C + + +BN_MP_MUL_C ++--->BN_MP_TOOM_MUL_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_ZERO_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| +--->BN_MP_SET_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C | | +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C +| +--->BN_MP_MUL_2_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_2_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_3_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_KARATSUBA_MUL_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ADD_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| +--->BN_MP_CLEAR_C ++--->BN_FAST_S_MP_MUL_DIGS_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_S_MP_MUL_DIGS_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C + + +BN_MP_MUL_D_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C + + +BN_MP_NEG_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C + + +BN_MP_N_ROOT_C ++--->BN_MP_N_ROOT_EX_C +| +--->BN_MP_INIT_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_EXPT_D_EX_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_ZERO_C | | | +--->BN_MP_MUL_2_C @@ -4244,34 +4146,169 @@ BN_MP_EXPT_D_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_SQR_C -| | +--->BN_MP_TOOM_SQR_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CMP_C +| | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_SUB_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C + + +BN_MP_N_ROOT_EX_C ++--->BN_MP_INIT_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_EXPT_D_EX_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_SQR_C +| | +--->BN_MP_TOOM_SQR_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -4312,451 +4349,534 @@ BN_MP_EXPT_D_C | | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C - - -BN_MP_XOR_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_REDUCE_SETUP_C -+--->BN_MP_2EXPT_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_GROW_C -+--->BN_MP_DIV_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_SET_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_ABS_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C +| | +--->BN_MP_MUL_2D_C | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_MOD_2D_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_INIT_C -| +--->BN_MP_INIT_COPY_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_ABS_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_CLEAR_C | +--->BN_MP_LSHD_C | | +--->BN_MP_GROW_C | | +--->BN_MP_RSHD_C | +--->BN_MP_RSHD_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C | +--->BN_MP_CLAMP_C | +--->BN_MP_CLEAR_C - - -BN_MP_RSHD_C -+--->BN_MP_ZERO_C - - -BN_MP_NEG_C -+--->BN_MP_COPY_C ++--->BN_MP_CMP_C +| +--->BN_MP_CMP_MAG_C ++--->BN_MP_SUB_D_C | +--->BN_MP_GROW_C +| +--->BN_MP_ADD_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C -BN_MP_SHRINK_C +BN_MP_OR_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C -BN_MP_PRIME_RANDOM_EX_C -+--->BN_MP_READ_UNSIGNED_BIN_C -| +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_PRIME_IS_PRIME_C -| +--->BN_MP_CMP_D_C -| +--->BN_MP_PRIME_IS_DIVISIBLE_C -| | +--->BN_MP_MOD_D_C -| | | +--->BN_MP_DIV_D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_INIT_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C +BN_MP_PRIME_FERMAT_C ++--->BN_MP_CMP_D_C ++--->BN_MP_INIT_C ++--->BN_MP_EXPTMOD_C +| +--->BN_MP_INVMOD_C +| | +--->BN_FAST_MP_INVMOD_C +| | | +--->BN_MP_INIT_MULTI_C | | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_C -| +--->BN_MP_SET_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_PRIME_MILLER_RABIN_C -| | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_SUB_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CNT_LSB_C -| | +--->BN_MP_DIV_2D_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXPTMOD_C -| | | +--->BN_MP_INVMOD_C -| | | | +--->BN_FAST_MP_INVMOD_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_COPY_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_MOD_C -| | | | | | +--->BN_MP_DIV_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COUNT_BITS_C -| | | | | | | +--->BN_MP_ABS_C -| | | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_C -| | | | | | | +--->BN_MP_SUB_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | | +--->BN_MP_CLEAR_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_MUL_D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C | | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2D_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_CLEAR_MULTI_C | | | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_INVMOD_SLOW_C -| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_INIT_COPY_C | | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_MOD_C -| | | | | | +--->BN_MP_DIV_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COUNT_BITS_C -| | | | | | | +--->BN_MP_ABS_C -| | | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_C -| | | | | | | +--->BN_MP_SUB_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | | +--->BN_MP_CLEAR_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_MUL_D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INVMOD_SLOW_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C +| | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_DIV_2D_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_CLEAR_MULTI_C | | | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_ABS_C -| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_INIT_COPY_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_REDUCE_IS_2K_L_C -| | | +--->BN_S_MP_EXPTMOD_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_REDUCE_SETUP_C -| | | | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_ABS_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_REDUCE_IS_2K_L_C +| +--->BN_S_MP_EXPTMOD_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_REDUCE_SETUP_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_C +| | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_REDUCE_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_C -| | | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | | | +--->BN_MP_COPY_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_MUL_2_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_SUB_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_DIV_2_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_MUL_D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_DIV_3_C -| | | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C | | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_SETUP_L_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_L_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C | | | | | +--->BN_MP_MOD_2D_C | | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_SUB_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C @@ -4764,9 +4884,7 @@ BN_MP_PRIME_RANDOM_EX_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C @@ -4774,318 +4892,179 @@ BN_MP_PRIME_RANDOM_EX_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_REDUCE_2K_SETUP_L_C -| | | | | +--->BN_MP_2EXPT_C -| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_REDUCE_2K_L_C -| | | | | +--->BN_MP_MUL_C -| | | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | | | +--->BN_MP_COPY_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_MUL_2_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_SUB_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_DIV_2_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_MUL_D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_DIV_3_C -| | | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_DIV_3_C | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_SQR_C -| | | | | +--->BN_MP_TOOM_SQR_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_FAST_S_MP_SQR_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SQR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_RSHD_C | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_DR_IS_MODULUS_C -| | | +--->BN_MP_REDUCE_IS_2K_C -| | | | +--->BN_MP_REDUCE_2K_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_EXPTMOD_FAST_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_MONTGOMERY_SETUP_C -| | | | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_MONTGOMERY_REDUCE_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_DR_SETUP_C -| | | | +--->BN_MP_DR_REDUCE_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_REDUCE_2K_SETUP_C -| | | | | +--->BN_MP_2EXPT_C -| | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_REDUCE_2K_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -5093,423 +5072,332 @@ BN_MP_PRIME_RANDOM_EX_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | | | | +--->BN_MP_2EXPT_C -| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_EXCH_C +| +--->BN_MP_DR_IS_MODULUS_C +| +--->BN_MP_REDUCE_IS_2K_C +| | +--->BN_MP_REDUCE_2K_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_EXPTMOD_FAST_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_MONTGOMERY_SETUP_C +| | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_DR_SETUP_C +| | +--->BN_MP_DR_REDUCE_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_REDUCE_2K_SETUP_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MULMOD_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MULMOD_C -| | | | | +--->BN_MP_MUL_C -| | | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | | | +--->BN_MP_COPY_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_MUL_2_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_SUB_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_DIV_2_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_MUL_D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_DIV_3_C -| | | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_MOD_C -| | | | | | +--->BN_MP_DIV_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_C -| | | | | | | +--->BN_MP_SUB_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_ADD_C -| | | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_MUL_D_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_SQR_C -| | | | | +--->BN_MP_TOOM_SQR_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_2D_C +| | | | | | +--->BN_MP_MOD_2D_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_FAST_S_MP_SQR_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_INIT_COPY_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SQR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_CMP_C -| | | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_SQRMOD_C -| | | +--->BN_MP_SQR_C -| | | | +--->BN_MP_TOOM_SQR_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_FAST_S_MP_SQR_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -5517,2686 +5405,941 @@ BN_MP_PRIME_RANDOM_EX_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_SUB_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_ADD_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_2_C -| +--->BN_MP_GROW_C -+--->BN_MP_ADD_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C - - -BN_MP_CMP_D_C - - -BN_MP_DR_IS_MODULUS_C - - -BN_MP_IMPORT_C -+--->BN_MP_ZERO_C -+--->BN_MP_MUL_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLAMP_C - - -BN_MP_COUNT_BITS_C - - -BN_MP_FREAD_C -+--->BN_MP_ZERO_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_ADD_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_SUB_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_D_C - - -BN_MP_REDUCE_2K_L_C -+--->BN_MP_INIT_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_SQR_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SQR_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_EXCH_C ++--->BN_MP_CMP_C +| +--->BN_MP_CMP_MAG_C ++--->BN_MP_CLEAR_C + + +BN_MP_PRIME_IS_DIVISIBLE_C ++--->BN_MP_MOD_D_C +| +--->BN_MP_DIV_D_C +| | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C | | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C | | +--->BN_MP_CLEAR_C -+--->BN_S_MP_ADD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C -BN_MP_AND_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_SQRMOD_C -+--->BN_MP_INIT_C -+--->BN_MP_SQR_C -| +--->BN_MP_TOOM_SQR_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C +BN_MP_PRIME_IS_PRIME_C ++--->BN_MP_CMP_D_C ++--->BN_MP_PRIME_IS_DIVISIBLE_C +| +--->BN_MP_MOD_D_C +| | +--->BN_MP_DIV_D_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_INIT_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_PRIME_MILLER_RABIN_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_KARATSUBA_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C | | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_SQR_C +| +--->BN_MP_SUB_D_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C -+--->BN_MP_MOD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_D_C | | | +--->BN_MP_CLAMP_C - - -BN_MP_DIV_D_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_INIT_C -| +--->BN_MP_MOD_2D_C | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_DIV_3_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_INIT_MULTI_C -+--->BN_MP_INIT_C -+--->BN_MP_CLEAR_C - - -BN_S_MP_EXPTMOD_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_INIT_C -+--->BN_MP_CLEAR_C -+--->BN_MP_REDUCE_SETUP_C -| +--->BN_MP_2EXPT_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_CNT_LSB_C +| +--->BN_MP_DIV_2D_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C | | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C | | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_CLAMP_C -+--->BN_MP_REDUCE_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C +| +--->BN_MP_EXPTMOD_C +| | +--->BN_MP_INVMOD_C +| | | +--->BN_FAST_MP_INVMOD_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COUNT_BITS_C +| | | | | | +--->BN_MP_ABS_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C | | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| +--->BN_S_MP_MUL_HIGH_DIGS_C -| | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_D_C -| +--->BN_MP_SET_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_C -| | +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_REDUCE_2K_SETUP_L_C -| +--->BN_MP_2EXPT_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_GROW_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_REDUCE_2K_L_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_INVMOD_SLOW_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COUNT_BITS_C +| | | | | | +--->BN_MP_ABS_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_DIV_2_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_ABS_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_REDUCE_IS_2K_L_C +| | +--->BN_S_MP_EXPTMOD_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_REDUCE_SETUP_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_REDUCE_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C +| | | +--->BN_MP_REDUCE_2K_SETUP_L_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_REDUCE_2K_L_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_MOD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_SQR_C +| | | | +--->BN_MP_TOOM_SQR_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_FAST_S_MP_SQR_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SQR_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_DR_IS_MODULUS_C +| | +--->BN_MP_REDUCE_IS_2K_C +| | | +--->BN_MP_REDUCE_2K_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_EXPTMOD_FAST_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_MONTGOMERY_SETUP_C +| | | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_MONTGOMERY_REDUCE_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_DR_SETUP_C +| | | +--->BN_MP_DR_REDUCE_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_SQR_C -| +--->BN_MP_TOOM_SQR_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_KARATSUBA_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| +--->BN_FAST_S_MP_SQR_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_EXCH_C - - -BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_2EXPT_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_GROW_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_MUL_2_C -| +--->BN_MP_GROW_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C - - -BN_MP_MONTGOMERY_SETUP_C - - -BN_FAST_MP_INVMOD_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_MOD_C -| +--->BN_MP_INIT_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_C -| +--->BN_MP_CMP_MAG_C -+--->BN_MP_CMP_D_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C - - -BN_MP_TO_UNSIGNED_BIN_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_CLEAR_MULTI_C -+--->BN_MP_CLEAR_C - - -BNCORE_C - - -BN_MP_TORADIX_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_DIV_D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DIV_3_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C - - -BN_MP_EXPTMOD_FAST_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_INIT_C -+--->BN_MP_CLEAR_C -+--->BN_MP_MONTGOMERY_SETUP_C -+--->BN_FAST_MP_MONTGOMERY_REDUCE_C -| +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -+--->BN_MP_MONTGOMERY_REDUCE_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -+--->BN_MP_DR_SETUP_C -+--->BN_MP_DR_REDUCE_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -+--->BN_MP_REDUCE_2K_SETUP_C -| +--->BN_MP_2EXPT_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_GROW_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_REDUCE_2K_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_MUL_D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| +--->BN_MP_2EXPT_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_SET_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_2_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_MULMOD_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_ABS_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_MOD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_SQR_C -| +--->BN_MP_TOOM_SQR_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_KARATSUBA_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| +--->BN_FAST_S_MP_SQR_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -+--->BN_MP_EXCH_C - - -BN_MP_MUL_D_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_MP_SET_LONG_LONG_C - - -BN_MP_DIV_2_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_ERROR_C - - -BN_MP_RAND_C -+--->BN_MP_ZERO_C -+--->BN_MP_ADD_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_SUB_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C - - -BN_S_MP_SQR_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_CMP_C -+--->BN_MP_CMP_MAG_C - - -BN_MP_N_ROOT_EX_C -+--->BN_MP_INIT_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_EXPT_D_EX_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_SQR_C -| | +--->BN_MP_TOOM_SQR_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_KARATSUBA_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | +--->BN_FAST_S_MP_SQR_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_ABS_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_COPY_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_CMP_C -| +--->BN_MP_CMP_MAG_C -+--->BN_MP_SUB_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_ADD_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_PRIME_IS_DIVISIBLE_C -+--->BN_MP_MOD_D_C -| +--->BN_MP_DIV_D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C - - -BN_MP_INIT_SET_INT_C -+--->BN_MP_INIT_C -+--->BN_MP_SET_INT_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C - - -BN_MP_DIV_3_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C - - -BN_MP_MONTGOMERY_REDUCE_C -+--->BN_FAST_MP_MONTGOMERY_REDUCE_C -| +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C -+--->BN_MP_RSHD_C -| +--->BN_MP_ZERO_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C - - -BN_MP_INVMOD_SLOW_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_MOD_C -| +--->BN_MP_INIT_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_C -| +--->BN_MP_CMP_MAG_C -+--->BN_MP_CMP_D_C -+--->BN_MP_CMP_MAG_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C - - -BN_S_MP_ADD_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_MP_READ_SIGNED_BIN_C -+--->BN_MP_READ_UNSIGNED_BIN_C -| +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C - - -BN_MP_MOD_D_C -+--->BN_MP_DIV_D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DIV_3_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C - - -BN_MP_SQRTMOD_PRIME_C -+--->BN_MP_CMP_D_C -+--->BN_MP_ZERO_C -+--->BN_MP_JACOBI_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_CNT_LSB_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_ABS_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_MOD_D_C -| +--->BN_MP_DIV_D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_ADD_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_SUB_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_EXPTMOD_C -| +--->BN_MP_INIT_C -| +--->BN_MP_INVMOD_C -| | +--->BN_FAST_MP_INVMOD_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2D_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_COPY_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INVMOD_SLOW_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2D_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_COPY_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_ABS_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_REDUCE_IS_2K_L_C -| +--->BN_S_MP_EXPTMOD_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_REDUCE_SETUP_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_C -| | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_SETUP_L_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_L_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_REDUCE_2K_SETUP_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DR_IS_MODULUS_C -| +--->BN_MP_REDUCE_IS_2K_C -| | +--->BN_MP_REDUCE_2K_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_EXPTMOD_FAST_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_MONTGOMERY_SETUP_C -| | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_MONTGOMERY_REDUCE_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_DR_SETUP_C -| | +--->BN_MP_DR_REDUCE_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_REDUCE_2K_SETUP_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_COPY_C +| | | +--->BN_MP_REDUCE_2K_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MULMOD_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MULMOD_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_MUL_2D_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_MUL_D_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_S_MP_MUL_DIGS_C | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_DIV_C | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_MOD_C | | | | +--->BN_MP_DIV_C | | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C | | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C @@ -8217,15 +6360,7 @@ BN_MP_SQRTMOD_PRIME_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2D_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_COPY_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C @@ -8243,545 +6378,328 @@ BN_MP_SQRTMOD_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SQR_C +| | | | +--->BN_MP_TOOM_SQR_C +| | | | | +--->BN_MP_INIT_MULTI_C | | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_SQR_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_FAST_S_MP_SQR_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_S_MP_SQR_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_SUB_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_SET_INT_C -| +--->BN_MP_MUL_2D_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_SQRMOD_C -| +--->BN_MP_INIT_C -| +--->BN_MP_SQR_C -| | +--->BN_MP_TOOM_SQR_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_MUL_DIGS_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_KARATSUBA_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_FAST_S_MP_SQR_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_ABS_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C +| +--->BN_MP_CMP_C +| | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_SQRMOD_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -+--->BN_MP_MULMOD_C -| +--->BN_MP_INIT_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_FAST_S_MP_SQR_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C +| | | +--->BN_S_MP_SQR_C | | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_C | | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C +| | | +--->BN_MP_DIV_C | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_ABS_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_ABS_C +| | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C | | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -+--->BN_MP_SET_C -+--->BN_MP_CLEAR_MULTI_C | +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C -BN_FAST_S_MP_MUL_HIGH_DIGS_C -+--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_REVERSE_C - - -BN_MP_PRIME_NEXT_PRIME_C +BN_MP_PRIME_MILLER_RABIN_C +--->BN_MP_CMP_D_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_SUB_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_ADD_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MOD_D_C -| +--->BN_MP_DIV_D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_C -+--->BN_MP_ADD_D_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_SUB_D_C | +--->BN_MP_GROW_C +| +--->BN_MP_ADD_D_C +| | +--->BN_MP_CLAMP_C | +--->BN_MP_CLAMP_C -+--->BN_MP_PRIME_MILLER_RABIN_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_CNT_LSB_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C ++--->BN_MP_CNT_LSB_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_EXPTMOD_C -| | +--->BN_MP_INVMOD_C -| | | +--->BN_FAST_MP_INVMOD_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COUNT_BITS_C -| | | | | | +--->BN_MP_ABS_C -| | | | | | +--->BN_MP_MUL_2D_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_EXPTMOD_C +| +--->BN_MP_INVMOD_C +| | +--->BN_FAST_MP_INVMOD_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -8789,237 +6707,429 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INVMOD_SLOW_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_INVMOD_SLOW_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_MOD_C -| | | | | +--->BN_MP_DIV_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COUNT_BITS_C -| | | | | | +--->BN_MP_ABS_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | | +--->BN_MP_RSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_ABS_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_REDUCE_IS_2K_L_C +| +--->BN_S_MP_EXPTMOD_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_REDUCE_SETUP_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_ABS_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_REDUCE_IS_2K_L_C -| | +--->BN_S_MP_EXPTMOD_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_REDUCE_SETUP_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_MUL_2_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C +| | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_COPY_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_SETUP_L_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_L_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C | | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C | | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C | | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C @@ -9028,8 +7138,52 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C @@ -9038,94 +7192,190 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_2K_SETUP_L_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_2K_L_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_EXCH_C +| +--->BN_MP_DR_IS_MODULUS_C +| +--->BN_MP_REDUCE_IS_2K_C +| | +--->BN_MP_REDUCE_2K_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_EXPTMOD_FAST_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_MONTGOMERY_SETUP_C +| | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_DR_SETUP_C +| | +--->BN_MP_DR_REDUCE_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_REDUCE_2K_SETUP_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SET_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MULMOD_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_3_C | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_MOD_C | | | | +--->BN_MP_DIV_C | | | | | +--->BN_MP_CMP_MAG_C @@ -9133,6 +7383,7 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_SET_C | | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C @@ -9154,7 +7405,6 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C @@ -9172,142 +7422,203 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SQR_C -| | | | +--->BN_MP_TOOM_SQR_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_FAST_S_MP_SQR_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_3_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_3_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DR_IS_MODULUS_C -| | +--->BN_MP_REDUCE_IS_2K_C -| | | +--->BN_MP_REDUCE_2K_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_EXCH_C ++--->BN_MP_CMP_C +| +--->BN_MP_CMP_MAG_C ++--->BN_MP_SQRMOD_C +| +--->BN_MP_SQR_C +| | +--->BN_MP_TOOM_SQR_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C @@ -9315,134 +7626,241 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_EXPTMOD_FAST_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_MONTGOMERY_SETUP_C -| | | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_DIV_2_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_MONTGOMERY_REDUCE_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_KARATSUBA_SQR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_ADD_C | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_DR_SETUP_C -| | | +--->BN_MP_DR_REDUCE_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SQR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_ABS_C +| | | +--->BN_MP_MUL_2D_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_REDUCE_2K_SETUP_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_REDUCE_2K_C -| | | | +--->BN_MP_MUL_D_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | | | +--->BN_MP_2EXPT_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_PRIME_NEXT_PRIME_C ++--->BN_MP_CMP_D_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_SUB_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_ADD_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MOD_D_C +| +--->BN_MP_DIV_D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_PRIME_MILLER_RABIN_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CNT_LSB_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXPTMOD_C +| | +--->BN_MP_INVMOD_C +| | | +--->BN_FAST_MP_INVMOD_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MULMOD_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_COPY_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COUNT_BITS_C +| | | | | | +--->BN_MP_ABS_C +| | | | | | +--->BN_MP_MUL_2D_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C | | | | | | | +--->BN_S_MP_ADD_C | | | | | | | | +--->BN_MP_GROW_C | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C | | | | | | | +--->BN_S_MP_SUB_C | | | | | | | | +--->BN_MP_GROW_C | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_MP_ADD_C | | | | | | | +--->BN_S_MP_ADD_C | | | | | | | | +--->BN_MP_GROW_C | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C | | | | | | | +--->BN_S_MP_SUB_C | | | | | | | | +--->BN_MP_GROW_C | | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_MUL_D_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_INVMOD_SLOW_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_DIV_C | | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_COUNT_BITS_C +| | | | | | +--->BN_MP_ABS_C | | | | | | +--->BN_MP_MUL_2D_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_LSHD_C @@ -9464,7 +7882,8 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | | | | +--->BN_MP_GROW_C | | | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | +--->BN_MP_CLEAR_C | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_RSHD_C @@ -9473,6 +7892,8 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_CLEAR_C | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C @@ -9482,45 +7903,20 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -9528,154 +7924,150 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_ABS_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SQR_C -| | | | +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_REDUCE_IS_2K_L_C +| | +--->BN_S_MP_EXPTMOD_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_REDUCE_SETUP_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C +| | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_FAST_S_MP_SQR_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SQR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_REDUCE_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_MUL_2D_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_MUL_D_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_S_MP_MUL_DIGS_C | | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C +| | | | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C | | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| +--->BN_MP_CMP_C -| | +--->BN_MP_CMP_MAG_C -| +--->BN_MP_SQRMOD_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C | | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -9683,7 +8075,9 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C @@ -9691,519 +8085,699 @@ BN_MP_PRIME_NEXT_PRIME_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_REDUCE_2K_SETUP_L_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_REDUCE_2K_L_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_FAST_S_MP_SQR_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_C | | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_ABS_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SQR_C +| | | | +--->BN_MP_TOOM_SQR_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C - - -BN_MP_TOOM_MUL_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_MOD_2D_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_RSHD_C -| +--->BN_MP_ZERO_C -+--->BN_MP_MUL_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_MUL_2_C -| +--->BN_MP_GROW_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_2D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_3_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C - - -BN_MP_CNT_LSB_C - - -BN_MP_CLAMP_C - - -BN_MP_SUB_D_C -+--->BN_MP_GROW_C -+--->BN_MP_ADD_D_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLAMP_C - - -BN_MP_ADD_C -+--->BN_S_MP_ADD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C - - -BN_MP_REDUCE_2K_C -+--->BN_MP_INIT_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_S_MP_ADD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C - - -BN_MP_REDUCE_C -+--->BN_MP_REDUCE_SETUP_C -| +--->BN_MP_2EXPT_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_FAST_S_MP_SQR_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SQR_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_DR_IS_MODULUS_C +| | +--->BN_MP_REDUCE_IS_2K_C +| | | +--->BN_MP_REDUCE_2K_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_EXPTMOD_FAST_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_MONTGOMERY_SETUP_C +| | | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_MONTGOMERY_REDUCE_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_DR_SETUP_C +| | | +--->BN_MP_DR_REDUCE_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_RSHD_C -| +--->BN_MP_ZERO_C -+--->BN_MP_MUL_C -| +--->BN_MP_TOOM_MUL_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_REDUCE_2K_SETUP_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_REDUCE_2K_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | | | +--->BN_MP_2EXPT_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MULMOD_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_KARATSUBA_MUL_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_MUL_DIGS_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_S_MP_MUL_HIGH_DIGS_C -| +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MOD_2D_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_S_MP_MUL_DIGS_C -| +--->BN_FAST_S_MP_MUL_DIGS_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_D_C -+--->BN_MP_SET_C -| +--->BN_MP_ZERO_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_CMP_C -| +--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C - - -BN_MP_EXPTMOD_C -+--->BN_MP_INIT_C -+--->BN_MP_INVMOD_C -| +--->BN_FAST_MP_INVMOD_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_ABS_C -| | | | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_SQR_C +| | | | +--->BN_MP_TOOM_SQR_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_FAST_S_MP_SQR_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SQR_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_EXCH_C +| +--->BN_MP_CMP_C +| | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_SQRMOD_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_MUL_2D_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_CMP_D_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_FAST_S_MP_SQR_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_INVMOD_SLOW_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CLEAR_C | | +--->BN_MP_MOD_C +| | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_DIV_C | | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_INIT_MULTI_C | | | | +--->BN_MP_COUNT_BITS_C | | | | +--->BN_MP_ABS_C | | | | +--->BN_MP_MUL_2D_C @@ -10211,7 +8785,6 @@ BN_MP_EXPTMOD_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C | | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C @@ -10226,18 +8799,8 @@ BN_MP_EXPTMOD_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C | | | | +--->BN_MP_EXCH_C | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_RSHD_C @@ -10246,755 +8809,1273 @@ BN_MP_EXPTMOD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_CMP_D_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C -+--->BN_MP_ABS_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_CLEAR_MULTI_C -+--->BN_MP_REDUCE_IS_2K_L_C -+--->BN_S_MP_EXPTMOD_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_REDUCE_SETUP_C -| | +--->BN_MP_2EXPT_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C | | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C + + +BN_MP_PRIME_RABIN_MILLER_TRIALS_C + + +BN_MP_PRIME_RANDOM_EX_C ++--->BN_MP_READ_UNSIGNED_BIN_C +| +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_COPY_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_PRIME_IS_PRIME_C +| +--->BN_MP_CMP_D_C +| +--->BN_MP_PRIME_IS_DIVISIBLE_C +| | +--->BN_MP_MOD_D_C +| | | +--->BN_MP_DIV_D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_INIT_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_INIT_C | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_PRIME_MILLER_RABIN_C +| | +--->BN_MP_INIT_COPY_C | | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SUB_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_D_C | | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_REDUCE_C -| | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CNT_LSB_C +| | +--->BN_MP_DIV_2D_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXPTMOD_C +| | | +--->BN_MP_INVMOD_C +| | | | +--->BN_FAST_MP_INVMOD_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C | | | | | +--->BN_MP_COPY_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MOD_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_DIV_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COUNT_BITS_C +| | | | | | | +--->BN_MP_ABS_C +| | | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_C +| | | | | | | +--->BN_MP_SUB_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | | +--->BN_MP_CLEAR_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_MUL_D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_INVMOD_SLOW_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_MOD_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_DIV_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_COUNT_BITS_C +| | | | | | | +--->BN_MP_ABS_C +| | | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_C +| | | | | | | +--->BN_MP_SUB_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | | | +--->BN_MP_CLEAR_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_MUL_D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_DIV_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_ABS_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_REDUCE_IS_2K_L_C +| | | +--->BN_S_MP_EXPTMOD_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_REDUCE_SETUP_C +| | | | | +--->BN_MP_2EXPT_C +| | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_REDUCE_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_C +| | | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | | | +--->BN_MP_COPY_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_MUL_2_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_SUB_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_DIV_2_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_MUL_D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_DIV_3_C +| | | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_D_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_REDUCE_2K_SETUP_L_C -| | +--->BN_MP_2EXPT_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_REDUCE_2K_L_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_REDUCE_2K_SETUP_L_C +| | | | | +--->BN_MP_2EXPT_C +| | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_SET_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_SQR_C -| | +--->BN_MP_TOOM_SQR_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_KARATSUBA_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | +--->BN_FAST_S_MP_SQR_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SQR_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_REDUCE_2K_L_C +| | | | | +--->BN_MP_MUL_C +| | | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | | | +--->BN_MP_COPY_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_MUL_2_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_SUB_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_DIV_2_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_MUL_D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_DIV_3_C +| | | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| +--->BN_MP_SET_C -| | +--->BN_MP_ZERO_C -| +--->BN_MP_EXCH_C -+--->BN_MP_DR_IS_MODULUS_C -+--->BN_MP_REDUCE_IS_2K_C -| +--->BN_MP_REDUCE_2K_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_COUNT_BITS_C -+--->BN_MP_EXPTMOD_FAST_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_MONTGOMERY_SETUP_C -| +--->BN_FAST_MP_MONTGOMERY_REDUCE_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| +--->BN_MP_MONTGOMERY_REDUCE_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| +--->BN_MP_DR_SETUP_C -| +--->BN_MP_DR_REDUCE_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| +--->BN_MP_REDUCE_2K_SETUP_C -| | +--->BN_MP_2EXPT_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_REDUCE_2K_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | +--->BN_MP_2EXPT_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_MULMOD_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_SQR_C +| | | | | +--->BN_MP_TOOM_SQR_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_FAST_S_MP_SQR_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SQR_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_DR_IS_MODULUS_C +| | | +--->BN_MP_REDUCE_IS_2K_C +| | | | +--->BN_MP_REDUCE_2K_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_EXPTMOD_FAST_C +| | | | +--->BN_MP_COUNT_BITS_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_MONTGOMERY_SETUP_C +| | | | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_MONTGOMERY_REDUCE_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_DR_SETUP_C +| | | | +--->BN_MP_DR_REDUCE_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_REDUCE_2K_SETUP_C +| | | | | +--->BN_MP_2EXPT_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_REDUCE_2K_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | | | | +--->BN_MP_2EXPT_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MULMOD_C +| | | | | +--->BN_MP_MUL_C +| | | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | | | +--->BN_MP_COPY_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_MUL_2_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_SUB_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_DIV_2_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_MUL_D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_DIV_3_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_MOD_C +| | | | | | +--->BN_MP_DIV_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_MP_COPY_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_C +| | | | | | | +--->BN_MP_SUB_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_ADD_C +| | | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_MUL_D_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MOD_C +| | | | | +--->BN_MP_DIV_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_SQR_C +| | | | | +--->BN_MP_TOOM_SQR_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_SQR_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_FAST_S_MP_SQR_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_S_MP_SQR_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_MUL_C +| | | | | +--->BN_MP_TOOM_MUL_C +| | | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_MUL_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_SUB_C +| | | | | | | +--->BN_S_MP_ADD_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_MUL_D_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_DIV_3_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_ADD_C +| | | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | | +--->BN_S_MP_SUB_C +| | | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_CMP_C +| | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_SQRMOD_C +| | | +--->BN_MP_SQR_C +| | | | +--->BN_MP_TOOM_SQR_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_C | | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_KARATSUBA_SQR_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_FAST_S_MP_SQR_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C +| | | | +--->BN_S_MP_SQR_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C | | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_SET_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_SUB_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_ADD_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_2_C +| +--->BN_MP_GROW_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C + + +BN_MP_RADIX_SIZE_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_DIV_D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_DIV_2D_C | | +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_C -| | +--->BN_MP_DIV_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_COPY_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_3_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C + + +BN_MP_RADIX_SMAP_C + + +BN_MP_RAND_C ++--->BN_MP_ZERO_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_SUB_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C + + +BN_MP_READ_RADIX_C ++--->BN_MP_ZERO_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_SUB_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C + + +BN_MP_READ_SIGNED_BIN_C ++--->BN_MP_READ_UNSIGNED_BIN_C +| +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_COPY_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_MUL_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C + + +BN_MP_READ_UNSIGNED_BIN_C ++--->BN_MP_GROW_C ++--->BN_MP_ZERO_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_COPY_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLAMP_C + + +BN_MP_REDUCE_2K_C ++--->BN_MP_INIT_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_S_MP_ADD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_REDUCE_2K_L_C ++--->BN_MP_INIT_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C @@ -11003,223 +10084,167 @@ BN_MP_EXPTMOD_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_SQR_C -| | +--->BN_MP_TOOM_SQR_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_KARATSUBA_SQR_C -| | | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SQR_C +| | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C -| +--->BN_MP_MUL_C -| | +--->BN_MP_TOOM_MUL_C -| | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_2D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_3_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | +--->BN_MP_KARATSUBA_MUL_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_MUL_DIGS_C -| | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| +--->BN_MP_EXCH_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_S_MP_ADD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C -BN_MP_LSHD_C -+--->BN_MP_GROW_C -+--->BN_MP_RSHD_C +BN_MP_REDUCE_2K_SETUP_C ++--->BN_MP_INIT_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_2EXPT_C | +--->BN_MP_ZERO_C - - -BN_MP_ADD_D_C -+--->BN_MP_GROW_C -+--->BN_MP_SUB_D_C +| +--->BN_MP_GROW_C ++--->BN_MP_CLEAR_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C | +--->BN_MP_CLAMP_C -+--->BN_MP_CLAMP_C - - -BN_MP_GET_LONG_C - - -BN_MP_GET_LONG_LONG_C -BN_MP_CLEAR_C - - -BN_MP_EXTEUCLID_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_SET_C +BN_MP_REDUCE_2K_SETUP_L_C ++--->BN_MP_INIT_C ++--->BN_MP_2EXPT_C | +--->BN_MP_ZERO_C -+--->BN_MP_COPY_C | +--->BN_MP_GROW_C -+--->BN_MP_DIV_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_ABS_C -| +--->BN_MP_MUL_2D_C ++--->BN_MP_COUNT_BITS_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_REDUCE_C ++--->BN_MP_REDUCE_SETUP_C +| +--->BN_MP_2EXPT_C +| | +--->BN_MP_ZERO_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_C -| +--->BN_MP_SUB_C -| | +--->BN_S_MP_ADD_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_INIT_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_MULTI_C | | +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_COPY_C | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_INIT_C -| +--->BN_MP_INIT_COPY_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_MUL_D_C +| +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C | +--->BN_MP_CLEAR_C ++--->BN_MP_RSHD_C +| +--->BN_MP_ZERO_C +--->BN_MP_MUL_C | +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C | | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_MUL_2_C | | | +--->BN_MP_GROW_C | | +--->BN_MP_ADD_C @@ -11250,7 +10275,6 @@ BN_MP_EXTEUCLID_C | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C @@ -11260,7 +10284,6 @@ BN_MP_EXTEUCLID_C | | | +--->BN_MP_CLEAR_C | +--->BN_MP_KARATSUBA_MUL_C | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C | | +--->BN_MP_CLAMP_C | | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C @@ -11272,18 +10295,39 @@ BN_MP_EXTEUCLID_C | | | +--->BN_MP_GROW_C | | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C | | +--->BN_MP_CLEAR_C | +--->BN_FAST_S_MP_MUL_DIGS_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C | +--->BN_S_MP_MUL_DIGS_C | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C | | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C | | +--->BN_MP_CLEAR_C ++--->BN_S_MP_MUL_HIGH_DIGS_C +| +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MOD_2D_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_S_MP_MUL_DIGS_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C +--->BN_MP_SUB_C | +--->BN_S_MP_ADD_C | | +--->BN_MP_GROW_C @@ -11292,230 +10336,232 @@ BN_MP_EXTEUCLID_C | +--->BN_S_MP_SUB_C | | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -+--->BN_MP_NEG_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C - - -BN_MP_TORADIX_N_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_DIV_D_C -| +--->BN_MP_COPY_C ++--->BN_MP_CMP_D_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C | | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_2D_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DIV_3_C -| | +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C ++--->BN_MP_CMP_C +| +--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C +--->BN_MP_CLEAR_C -BN_MP_RADIX_SIZE_C -+--->BN_MP_COUNT_BITS_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_DIV_D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C +BN_MP_REDUCE_IS_2K_C ++--->BN_MP_REDUCE_2K_C +| +--->BN_MP_INIT_C +| +--->BN_MP_COUNT_BITS_C | +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C | | +--->BN_MP_ZERO_C | | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C | | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DIV_3_C -| | +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C | +--->BN_MP_CLEAR_C -+--->BN_MP_CLEAR_C ++--->BN_MP_COUNT_BITS_C -BN_S_MP_MUL_HIGH_DIGS_C -+--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C +BN_MP_REDUCE_IS_2K_L_C -BN_MP_SET_INT_C -+--->BN_MP_ZERO_C -+--->BN_MP_MUL_2D_C +BN_MP_REDUCE_SETUP_C ++--->BN_MP_2EXPT_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_GROW_C ++--->BN_MP_DIV_C +| +--->BN_MP_CMP_MAG_C | +--->BN_MP_COPY_C | | +--->BN_MP_GROW_C -| +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLAMP_C - - -BN_MP_DR_SETUP_C - - -BN_MP_MUL_2_C -+--->BN_MP_GROW_C - - -BN_MP_FWRITE_C -+--->BN_MP_RADIX_SIZE_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_SET_C | +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_D_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_ABS_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_TORADIX_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C -| +--->BN_MP_DIV_D_C -| | +--->BN_MP_COPY_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_MOD_2D_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_RSHD_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_INIT_C +| +--->BN_MP_INIT_COPY_C | | +--->BN_MP_CLEAR_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C | +--->BN_MP_CLEAR_C -BN_MP_GROW_C +BN_MP_RSHD_C ++--->BN_MP_ZERO_C -BN_MP_READ_RADIX_C +BN_MP_SET_C +--->BN_MP_ZERO_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_ADD_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_SUB_D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLAMP_C -BN_S_MP_MUL_DIGS_C -+--->BN_FAST_S_MP_MUL_DIGS_C +BN_MP_SET_INT_C ++--->BN_MP_ZERO_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C | +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_RSHD_C | +--->BN_MP_CLAMP_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C +--->BN_MP_CLAMP_C -+--->BN_MP_EXCH_C -+--->BN_MP_CLEAR_C -BN_PRIME_TAB_C +BN_MP_SET_LONG_C -BN_MP_IS_SQUARE_C -+--->BN_MP_MOD_D_C -| +--->BN_MP_DIV_D_C +BN_MP_SET_LONG_LONG_C + + +BN_MP_SHRINK_C + + +BN_MP_SIGNED_BIN_SIZE_C ++--->BN_MP_UNSIGNED_BIN_SIZE_C +| +--->BN_MP_COUNT_BITS_C + + +BN_MP_SQRMOD_C ++--->BN_MP_INIT_C ++--->BN_MP_SQR_C +| +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2D_C +| | +--->BN_MP_RSHD_C | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_MOD_2D_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C | | +--->BN_MP_DIV_3_C | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_KARATSUBA_SQR_C | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_INIT_SET_INT_C -| +--->BN_MP_INIT_C -| +--->BN_MP_SET_INT_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_ADD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C +--->BN_MP_MOD_C -| +--->BN_MP_INIT_C +| +--->BN_MP_INIT_SIZE_C | +--->BN_MP_DIV_C | | +--->BN_MP_CMP_MAG_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C | | +--->BN_MP_ZERO_C | | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C | | +--->BN_MP_SET_C | | +--->BN_MP_COUNT_BITS_C | | +--->BN_MP_ABS_C @@ -11542,14 +10588,10 @@ BN_MP_IS_SQUARE_C | | +--->BN_MP_DIV_2D_C | | | +--->BN_MP_MOD_2D_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_RSHD_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C | | +--->BN_MP_EXCH_C | | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_INIT_COPY_C | | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C @@ -11559,8 +10601,6 @@ BN_MP_IS_SQUARE_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C | +--->BN_MP_EXCH_C | +--->BN_MP_ADD_C | | +--->BN_S_MP_ADD_C @@ -11570,161 +10610,463 @@ BN_MP_IS_SQUARE_C | | +--->BN_S_MP_SUB_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -+--->BN_MP_GET_INT_C -+--->BN_MP_SQRT_C -| +--->BN_MP_N_ROOT_C -| | +--->BN_MP_N_ROOT_EX_C -| | | +--->BN_MP_INIT_C + + +BN_MP_SQRTMOD_PRIME_C ++--->BN_MP_CMP_D_C ++--->BN_MP_ZERO_C ++--->BN_MP_JACOBI_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_CNT_LSB_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_ABS_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CLEAR_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_INIT_MULTI_C +| +--->BN_MP_INIT_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_MOD_D_C +| +--->BN_MP_DIV_D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_SUB_D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_EXPTMOD_C +| +--->BN_MP_INIT_C +| +--->BN_MP_INVMOD_C +| | +--->BN_FAST_MP_INVMOD_C | | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_EXPT_D_EX_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_MUL_C -| | | | | +--->BN_MP_TOOM_MUL_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_DIV_2D_C +| | | | | | +--->BN_MP_MOD_2D_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | | +--->BN_MP_CLEAR_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_INIT_COPY_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_INVMOD_SLOW_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_COUNT_BITS_C +| | | | | +--->BN_MP_ABS_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | | +--->BN_MP_RSHD_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2D_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_MULTI_C | | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_COPY_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_SQR_C -| | | | | +--->BN_MP_TOOM_SQR_C -| | | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_ABS_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_REDUCE_IS_2K_L_C +| +--->BN_S_MP_EXPTMOD_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_REDUCE_SETUP_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_MUL_2_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_SUB_C -| | | | | | | +--->BN_S_MP_ADD_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | | +--->BN_S_MP_SUB_C -| | | | | | | | +--->BN_MP_GROW_C -| | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_C +| | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_COPY_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_LSHD_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_DIV_3_C -| | | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_KARATSUBA_SQR_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_ADD_C -| | | | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_FAST_S_MP_SQR_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SQR_C +| | | | | +--->BN_MP_DIV_3_C | | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C | | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_SETUP_L_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_L_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_MUL_C | | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C | | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_MUL_2_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_ADD_C @@ -11743,829 +11085,898 @@ BN_MP_IS_SQUARE_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_SET_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_DIV_3_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_COUNT_BITS_C -| | | | +--->BN_MP_ABS_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_MOD_2D_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_ADD_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C | | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_SUB_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C +| | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_SET_C | | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLEAR_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| +--->BN_MP_DIV_2_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_SQR_C -| +--->BN_MP_TOOM_SQR_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C +| +--->BN_MP_DR_IS_MODULUS_C +| +--->BN_MP_REDUCE_IS_2K_C +| | +--->BN_MP_REDUCE_2K_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_MUL_D_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_3_C -| | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_EXPTMOD_FAST_C +| | +--->BN_MP_COUNT_BITS_C | | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C +| | +--->BN_MP_MONTGOMERY_SETUP_C +| | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_SQR_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_CMP_MAG_C -+--->BN_MP_CLEAR_C - - -BN_MP_COPY_C -+--->BN_MP_GROW_C - - -BN_MP_TOOM_SQR_C -+--->BN_MP_INIT_MULTI_C -| +--->BN_MP_INIT_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_MOD_2D_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_RSHD_C -| +--->BN_MP_ZERO_C -+--->BN_MP_SQR_C -| +--->BN_MP_KARATSUBA_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_S_MP_SUB_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_MONTGOMERY_REDUCE_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_DR_SETUP_C +| | +--->BN_MP_DR_REDUCE_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_SQR_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_INIT_SIZE_C -| | | +--->BN_MP_INIT_C -| | +--->BN_MP_CLAMP_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_MP_MUL_2_C -| +--->BN_MP_GROW_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_2_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_2D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_D_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_DIV_3_C -| +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_CLEAR_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -+--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_CLEAR_C - - -BN_MP_KARATSUBA_SQR_C -+--->BN_MP_INIT_SIZE_C -| +--->BN_MP_INIT_C -+--->BN_MP_CLAMP_C -+--->BN_MP_SQR_C -| +--->BN_MP_TOOM_SQR_C -| | +--->BN_MP_INIT_MULTI_C -| | | +--->BN_MP_INIT_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_MOD_2D_C -| | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_COPY_C +| | | +--->BN_S_MP_SUB_C +| | +--->BN_MP_REDUCE_2K_SETUP_C +| | | +--->BN_MP_2EXPT_C | | | | +--->BN_MP_GROW_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MUL_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_REDUCE_2K_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | +--->BN_MP_SUB_C -| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +| | | +--->BN_MP_2EXPT_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_MUL_2_C | | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_2_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MULMOD_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_COPY_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_MOD_C +| | | | +--->BN_MP_DIV_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_MP_COPY_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_SET_C +| | | | | +--->BN_MP_MUL_2D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C +| | | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_C +| | | | | +--->BN_MP_SUB_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_S_MP_ADD_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_DIV_2D_C +| | | | | | +--->BN_MP_MOD_2D_C +| | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_INIT_COPY_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_MUL_D_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_MOD_C +| | | +--->BN_MP_DIV_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_MP_COPY_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2D_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_CLEAR_MULTI_C -| | | +--->BN_MP_CLEAR_C -| +--->BN_FAST_S_MP_SQR_C -| | +--->BN_MP_GROW_C -| +--->BN_S_MP_SQR_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_C -+--->BN_S_MP_ADD_C -| +--->BN_MP_GROW_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -+--->BN_MP_LSHD_C -| +--->BN_MP_GROW_C -| +--->BN_MP_RSHD_C -| | +--->BN_MP_ZERO_C -+--->BN_MP_ADD_C -| +--->BN_MP_CMP_MAG_C -+--->BN_MP_CLEAR_C - - -BN_MP_GCD_C -+--->BN_MP_ABS_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_INIT_COPY_C -| +--->BN_MP_INIT_SIZE_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -+--->BN_MP_CNT_LSB_C -+--->BN_MP_DIV_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_ZERO_C -| +--->BN_MP_MOD_2D_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_RSHD_C -| +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -+--->BN_MP_CMP_MAG_C -+--->BN_MP_EXCH_C -+--->BN_S_MP_SUB_C -| +--->BN_MP_GROW_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_MUL_2D_C -| +--->BN_MP_COPY_C -| | +--->BN_MP_GROW_C -| +--->BN_MP_GROW_C -| +--->BN_MP_LSHD_C -| | +--->BN_MP_RSHD_C -| | | +--->BN_MP_ZERO_C -| +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C - - -BN_MP_MOD_2D_C -+--->BN_MP_ZERO_C -+--->BN_MP_COPY_C -| +--->BN_MP_GROW_C -+--->BN_MP_CLAMP_C - - -BN_FAST_MP_MONTGOMERY_REDUCE_C -+--->BN_MP_GROW_C -+--->BN_MP_RSHD_C -| +--->BN_MP_ZERO_C -+--->BN_MP_CLAMP_C -+--->BN_MP_CMP_MAG_C -+--->BN_S_MP_SUB_C - - -BN_MP_SUBMOD_C -+--->BN_MP_INIT_C -+--->BN_MP_SUB_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C -+--->BN_MP_MOD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_LSHD_C +| | +--->BN_MP_SQR_C +| | | +--->BN_MP_TOOM_SQR_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_ADD_C -| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_FAST_S_MP_SQR_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SUB_C +| | | +--->BN_S_MP_SQR_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_KARATSUBA_MUL_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C +| | | +--->BN_S_MP_MUL_DIGS_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C -| | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_EXCH_C | | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C -| | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_SUB_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_SET_INT_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C | | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C | | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C -| +--->BN_MP_ADD_C -| | +--->BN_S_MP_ADD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_S_MP_SUB_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C - - -BN_MP_GET_INT_C - - -BN_MP_SET_LONG_C - - -BN_MP_ADDMOD_C -+--->BN_MP_INIT_C -+--->BN_MP_ADD_C -| +--->BN_S_MP_ADD_C -| | +--->BN_MP_GROW_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_CMP_MAG_C -| +--->BN_S_MP_SUB_C -| | +--->BN_MP_GROW_C | | +--->BN_MP_CLAMP_C -+--->BN_MP_CLEAR_C -+--->BN_MP_MOD_C -| +--->BN_MP_DIV_C -| | +--->BN_MP_CMP_MAG_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| | +--->BN_MP_ZERO_C -| | +--->BN_MP_INIT_MULTI_C -| | +--->BN_MP_SET_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_ABS_C -| | +--->BN_MP_MUL_2D_C -| | | +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_SQRMOD_C +| +--->BN_MP_INIT_C +| +--->BN_MP_SQR_C +| | +--->BN_MP_TOOM_SQR_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | | +--->BN_MP_CLEAR_C | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_KARATSUBA_SQR_C +| | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CMP_C -| | +--->BN_MP_SUB_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_DIV_2D_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_FAST_S_MP_SQR_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SQR_C +| | | +--->BN_MP_INIT_SIZE_C | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_EXCH_C -| | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_MOD_C | | +--->BN_MP_INIT_SIZE_C -| | +--->BN_MP_INIT_COPY_C -| | +--->BN_MP_LSHD_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | +--->BN_MP_RSHD_C -| | +--->BN_MP_MUL_D_C -| | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_CLAMP_C -| +--->BN_MP_EXCH_C - - -BN_MP_PRIME_FERMAT_C -+--->BN_MP_CMP_D_C -+--->BN_MP_INIT_C -+--->BN_MP_EXPTMOD_C -| +--->BN_MP_INVMOD_C -| | +--->BN_FAST_MP_INVMOD_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_COPY_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_SET_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_ABS_C +| | | +--->BN_MP_MUL_2D_C | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2D_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_COPY_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C ++--->BN_MP_MULMOD_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_C +| +--->BN_MP_CLEAR_C +| +--->BN_MP_MOD_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_ABS_C +| | | +--->BN_MP_MUL_2D_C | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C | | | +--->BN_MP_SUB_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_EXCH_C | | | +--->BN_MP_CLEAR_MULTI_C +| | | +--->BN_MP_INIT_C +| | | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C ++--->BN_MP_SET_C ++--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_CLEAR_C + + +BN_MP_SQRT_C ++--->BN_MP_N_ROOT_C +| +--->BN_MP_N_ROOT_EX_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_SET_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_EXPT_D_EX_C +| | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLEAR_C -| | +--->BN_MP_INVMOD_SLOW_C -| | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_COUNT_BITS_C -| | | | | +--->BN_MP_ABS_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_MUL_C +| | | | +--->BN_MP_TOOM_MUL_C +| | | | | +--->BN_MP_INIT_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_MOD_2D_C +| | | | | | +--->BN_MP_ZERO_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_MUL_2_C +| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_ADD_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_SUB_C | | | | | | +--->BN_S_MP_ADD_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C +| | | | | | +--->BN_MP_CMP_MAG_C | | | | | | +--->BN_S_MP_SUB_C | | | | | | | +--->BN_MP_GROW_C | | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2D_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_CLEAR_MULTI_C -| | | | | | +--->BN_MP_CLEAR_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_COPY_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_DIV_2_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_CLEAR_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_MUL_2D_C | | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_MUL_D_C | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_COPY_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_DIV_2_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SUB_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_CLEAR_MULTI_C -| | | | +--->BN_MP_CLEAR_C -| +--->BN_MP_CLEAR_C -| +--->BN_MP_ABS_C -| | +--->BN_MP_COPY_C -| | | +--->BN_MP_GROW_C -| +--->BN_MP_CLEAR_MULTI_C -| +--->BN_MP_REDUCE_IS_2K_L_C -| +--->BN_S_MP_EXPTMOD_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_REDUCE_SETUP_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_DIV_3_C +| | | | | | +--->BN_MP_INIT_SIZE_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_EXCH_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | | | +--->BN_S_MP_SUB_C +| | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C +| | | | | +--->BN_MP_LSHD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_FAST_S_MP_MUL_DIGS_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_C -| | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_SQR_C +| | | | +--->BN_MP_TOOM_SQR_C | | | | | +--->BN_MP_INIT_MULTI_C | | | | | +--->BN_MP_MOD_2D_C | | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C | | | | | +--->BN_MP_MUL_2_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_ADD_C @@ -12600,606 +12011,763 @@ BN_MP_PRIME_FERMAT_C | | | | | | +--->BN_MP_EXCH_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C +| | | | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_KARATSUBA_SQR_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_S_MP_ADD_C | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_S_MP_SUB_C | | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_LSHD_C | | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | | | +--->BN_MP_RSHD_C +| | | | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_ADD_C +| | | | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_FAST_S_MP_SQR_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C +| | | | +--->BN_S_MP_SQR_C | | | | | +--->BN_MP_INIT_SIZE_C | | | | | +--->BN_MP_CLAMP_C | | | | | +--->BN_MP_EXCH_C -| | | +--->BN_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | +--->BN_MP_MUL_C +| | | +--->BN_MP_TOOM_MUL_C +| | | | +--->BN_MP_INIT_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_ZERO_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_MUL_2_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_SUB_C +| | | | | +--->BN_S_MP_ADD_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_2_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_2D_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_MUL_D_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_DIV_3_C +| | | | | +--->BN_MP_INIT_SIZE_C +| | | | | +--->BN_MP_CLAMP_C +| | | | | +--->BN_MP_EXCH_C +| | | | | +--->BN_MP_CLEAR_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLEAR_MULTI_C +| | | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_KARATSUBA_MUL_C | | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_MOD_2D_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_COPY_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_ADD_C +| | | | | +--->BN_MP_CMP_MAG_C +| | | | | +--->BN_S_MP_SUB_C +| | | | | | +--->BN_MP_GROW_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_RSHD_C +| | | | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C | | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_SUB_C +| | | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_INIT_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_COUNT_BITS_C +| | | +--->BN_MP_ABS_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_C +| | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_DIV_2D_C +| | | | +--->BN_MP_MOD_2D_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_COPY_C +| | | | +--->BN_MP_CLEAR_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_CMP_C +| | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_SUB_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_ZERO_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_RSHD_C ++--->BN_MP_DIV_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_SET_C +| +--->BN_MP_COUNT_BITS_C +| +--->BN_MP_ABS_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C + + +BN_MP_SQR_C ++--->BN_MP_TOOM_SQR_C +| +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_INIT_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_2_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_2_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_2D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_D_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_3_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_KARATSUBA_SQR_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| +--->BN_MP_ADD_C +| | +--->BN_MP_CMP_MAG_C +| +--->BN_MP_CLEAR_C ++--->BN_FAST_S_MP_SQR_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_S_MP_SQR_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C + + +BN_MP_SUBMOD_C ++--->BN_MP_INIT_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C ++--->BN_MP_MOD_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_COUNT_BITS_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C | | | +--->BN_MP_LSHD_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_SETUP_L_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_L_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C + + +BN_MP_SUB_C ++--->BN_S_MP_ADD_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CMP_MAG_C ++--->BN_S_MP_SUB_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C + + +BN_MP_SUB_D_C ++--->BN_MP_GROW_C ++--->BN_MP_ADD_D_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLAMP_C + + +BN_MP_TOOM_MUL_C ++--->BN_MP_INIT_MULTI_C +| +--->BN_MP_INIT_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_MOD_2D_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_RSHD_C +| +--->BN_MP_ZERO_C ++--->BN_MP_MUL_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C | | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_SET_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_ADD_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_MUL_2_C +| +--->BN_MP_GROW_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_3_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C ++--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_CLEAR_C + + +BN_MP_TOOM_SQR_C ++--->BN_MP_INIT_MULTI_C +| +--->BN_MP_INIT_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_MOD_2D_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_RSHD_C +| +--->BN_MP_ZERO_C ++--->BN_MP_SQR_C +| +--->BN_MP_KARATSUBA_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_CLEAR_C +| +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_INIT_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C ++--->BN_MP_MUL_2_C +| +--->BN_MP_GROW_C ++--->BN_MP_ADD_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_SUB_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_2_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_2D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_LSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_MUL_D_C +| +--->BN_MP_GROW_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_DIV_3_C +| +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_LSHD_C +| +--->BN_MP_GROW_C ++--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_CLEAR_C + + +BN_MP_TORADIX_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_DIV_D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_3_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C + + +BN_MP_TORADIX_N_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_DIV_D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_DIV_3_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLEAR_C + + +BN_MP_TO_SIGNED_BIN_C ++--->BN_MP_TO_UNSIGNED_BIN_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C + + +BN_MP_TO_SIGNED_BIN_N_C ++--->BN_MP_SIGNED_BIN_SIZE_C +| +--->BN_MP_UNSIGNED_BIN_SIZE_C +| | +--->BN_MP_COUNT_BITS_C ++--->BN_MP_TO_SIGNED_BIN_C +| +--->BN_MP_TO_UNSIGNED_BIN_C +| | +--->BN_MP_INIT_COPY_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_CLEAR_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_COPY_C | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_SET_C | | | +--->BN_MP_ZERO_C -| | +--->BN_MP_EXCH_C -| +--->BN_MP_DR_IS_MODULUS_C -| +--->BN_MP_REDUCE_IS_2K_C -| | +--->BN_MP_REDUCE_2K_C -| | | +--->BN_MP_COUNT_BITS_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLEAR_C + + +BN_MP_TO_UNSIGNED_BIN_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_DIV_2D_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ZERO_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_RSHD_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_CLEAR_C + + +BN_MP_TO_UNSIGNED_BIN_N_C ++--->BN_MP_UNSIGNED_BIN_SIZE_C +| +--->BN_MP_COUNT_BITS_C ++--->BN_MP_TO_UNSIGNED_BIN_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CLEAR_C + + +BN_MP_UNSIGNED_BIN_SIZE_C ++--->BN_MP_COUNT_BITS_C + + +BN_MP_XOR_C ++--->BN_MP_INIT_COPY_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_COPY_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_CLEAR_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C + + +BN_MP_ZERO_C + + +BN_PRIME_TAB_C + + +BN_REVERSE_C + + +BN_S_MP_ADD_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C + + +BN_S_MP_EXPTMOD_C ++--->BN_MP_COUNT_BITS_C ++--->BN_MP_INIT_C ++--->BN_MP_CLEAR_C ++--->BN_MP_REDUCE_SETUP_C +| +--->BN_MP_2EXPT_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C | | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_D_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C | | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C | | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_COUNT_BITS_C -| +--->BN_MP_EXPTMOD_FAST_C -| | +--->BN_MP_COUNT_BITS_C -| | +--->BN_MP_MONTGOMERY_SETUP_C -| | +--->BN_FAST_MP_MONTGOMERY_REDUCE_C -| | | +--->BN_MP_GROW_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_MONTGOMERY_REDUCE_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_LSHD_C | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CLAMP_C | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_DR_SETUP_C -| | +--->BN_MP_DR_REDUCE_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C | | | +--->BN_MP_GROW_C | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | +--->BN_MP_REDUCE_2K_SETUP_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_REDUCE_2K_C -| | | +--->BN_MP_DIV_2D_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MUL_D_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_ADD_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -| | | +--->BN_MP_2EXPT_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_SET_C -| | | | +--->BN_MP_ZERO_C -| | | +--->BN_MP_MUL_2_C -| | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_S_MP_SUB_C -| | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_MULMOD_C -| | | +--->BN_MP_MUL_C -| | | | +--->BN_MP_TOOM_MUL_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | | +--->BN_MP_COPY_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_MUL_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_3_C -| | | | | | +--->BN_MP_INIT_SIZE_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_KARATSUBA_MUL_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_MP_CMP_MAG_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_FAST_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_MUL_DIGS_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | +--->BN_MP_MOD_C -| | | | +--->BN_MP_DIV_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_MP_COPY_C -| | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_INIT_MULTI_C -| | | | | +--->BN_MP_SET_C -| | | | | +--->BN_MP_MUL_2D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_LSHD_C -| | | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_C -| | | | | +--->BN_MP_SUB_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_ADD_C -| | | | | | +--->BN_S_MP_ADD_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_S_MP_SUB_C -| | | | | | | +--->BN_MP_GROW_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_DIV_2D_C -| | | | | | +--->BN_MP_MOD_2D_C -| | | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_EXCH_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_INIT_COPY_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_MUL_D_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | +--->BN_MP_SET_C -| | | +--->BN_MP_ZERO_C -| | +--->BN_MP_MOD_C -| | | +--->BN_MP_DIV_C -| | | | +--->BN_MP_CMP_MAG_C -| | | | +--->BN_MP_COPY_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_CMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2D_C -| | | | | +--->BN_MP_MOD_2D_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_INIT_SIZE_C -| | | | +--->BN_MP_INIT_COPY_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_RSHD_C -| | | | +--->BN_MP_MUL_D_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_REDUCE_C +| +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| +--->BN_MP_RSHD_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C | | | +--->BN_MP_ADD_C | | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C @@ -13208,149 +12776,413 @@ BN_MP_PRIME_FERMAT_C | | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C +| | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CLAMP_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| +--->BN_S_MP_MUL_HIGH_DIGS_C +| | +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| +--->BN_FAST_S_MP_MUL_HIGH_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MOD_2D_C +| | +--->BN_MP_ZERO_C | | +--->BN_MP_COPY_C | | | +--->BN_MP_GROW_C -| | +--->BN_MP_SQR_C -| | | +--->BN_MP_TOOM_SQR_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| +--->BN_MP_SUB_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_D_C +| +--->BN_MP_SET_C +| | +--->BN_MP_ZERO_C +| +--->BN_MP_LSHD_C +| | +--->BN_MP_GROW_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_C +| | +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_REDUCE_2K_SETUP_L_C +| +--->BN_MP_2EXPT_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_GROW_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_REDUCE_2K_L_C +| +--->BN_MP_DIV_2D_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_MUL_C +| | +--->BN_MP_TOOM_MUL_C +| | | +--->BN_MP_INIT_MULTI_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_ZERO_C +| | | | +--->BN_MP_COPY_C | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_COPY_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_MUL_2_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C | | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_SUB_C +| | | | +--->BN_S_MP_ADD_C | | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_DIV_2_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_2D_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_SQR_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_MUL_D_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_DIV_3_C | | | | +--->BN_MP_INIT_SIZE_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | +--->BN_FAST_S_MP_SQR_C +| | | | +--->BN_MP_EXCH_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_KARATSUBA_MUL_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_ADD_C +| | | | +--->BN_MP_CMP_MAG_C +| | | | +--->BN_S_MP_SUB_C +| | | | | +--->BN_MP_GROW_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_RSHD_C +| | | | | +--->BN_MP_ZERO_C +| | +--->BN_FAST_S_MP_MUL_DIGS_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_MUL_DIGS_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| +--->BN_S_MP_ADD_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_CMP_MAG_C +| +--->BN_S_MP_SUB_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C ++--->BN_MP_MOD_C +| +--->BN_MP_INIT_SIZE_C +| +--->BN_MP_DIV_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_MP_COPY_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ZERO_C +| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_SET_C +| | +--->BN_MP_ABS_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2D_C +| | | +--->BN_MP_MOD_2D_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_RSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C +| | +--->BN_MP_CLEAR_MULTI_C +| | +--->BN_MP_INIT_COPY_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | +--->BN_MP_RSHD_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CLAMP_C +| +--->BN_MP_EXCH_C +| +--->BN_MP_ADD_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_CMP_MAG_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C ++--->BN_MP_COPY_C +| +--->BN_MP_GROW_C ++--->BN_MP_SQR_C +| +--->BN_MP_TOOM_SQR_C +| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_SQR_C -| | | | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C -| | +--->BN_MP_MUL_C -| | | +--->BN_MP_TOOM_MUL_C -| | | | +--->BN_MP_INIT_MULTI_C -| | | | +--->BN_MP_MOD_2D_C -| | | | | +--->BN_MP_ZERO_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_RSHD_C -| | | | | +--->BN_MP_ZERO_C -| | | | +--->BN_MP_MUL_2_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_SUB_C -| | | | | +--->BN_S_MP_ADD_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_2_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_2D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_MUL_D_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_DIV_3_C -| | | | | +--->BN_MP_INIT_SIZE_C -| | | | | +--->BN_MP_CLAMP_C -| | | | | +--->BN_MP_EXCH_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | +--->BN_MP_KARATSUBA_MUL_C -| | | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_S_MP_ADD_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_ADD_C -| | | | | +--->BN_MP_CMP_MAG_C -| | | | | +--->BN_S_MP_SUB_C -| | | | | | +--->BN_MP_GROW_C -| | | | +--->BN_S_MP_SUB_C -| | | | | +--->BN_MP_GROW_C -| | | | +--->BN_MP_LSHD_C -| | | | | +--->BN_MP_GROW_C -| | | | | +--->BN_MP_RSHD_C -| | | | | | +--->BN_MP_ZERO_C -| | | +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_KARATSUBA_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| +--->BN_FAST_S_MP_SQR_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_SQR_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_MP_EXCH_C ++--->BN_MP_MUL_C +| +--->BN_MP_TOOM_MUL_C +| | +--->BN_MP_INIT_MULTI_C +| | +--->BN_MP_MOD_2D_C +| | | +--->BN_MP_ZERO_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_RSHD_C +| | | +--->BN_MP_ZERO_C +| | +--->BN_MP_MUL_2_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_S_MP_ADD_C | | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | +--->BN_S_MP_MUL_DIGS_C -| | | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C | | | | +--->BN_MP_CLAMP_C -| | | | +--->BN_MP_EXCH_C +| | +--->BN_MP_SUB_C +| | | +--->BN_S_MP_ADD_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_2_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_2D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_LSHD_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_MUL_D_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_CLAMP_C +| | +--->BN_MP_DIV_3_C +| | | +--->BN_MP_INIT_SIZE_C +| | | +--->BN_MP_CLAMP_C +| | | +--->BN_MP_EXCH_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_CLEAR_MULTI_C +| +--->BN_MP_KARATSUBA_MUL_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C +| | +--->BN_S_MP_ADD_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_ADD_C +| | | +--->BN_MP_CMP_MAG_C +| | | +--->BN_S_MP_SUB_C +| | | | +--->BN_MP_GROW_C +| | +--->BN_S_MP_SUB_C +| | | +--->BN_MP_GROW_C +| | +--->BN_MP_LSHD_C +| | | +--->BN_MP_GROW_C +| | | +--->BN_MP_RSHD_C +| | | | +--->BN_MP_ZERO_C +| +--->BN_FAST_S_MP_MUL_DIGS_C +| | +--->BN_MP_GROW_C +| | +--->BN_MP_CLAMP_C +| +--->BN_S_MP_MUL_DIGS_C +| | +--->BN_MP_INIT_SIZE_C +| | +--->BN_MP_CLAMP_C | | +--->BN_MP_EXCH_C -+--->BN_MP_CMP_C -| +--->BN_MP_CMP_MAG_C -+--->BN_MP_CLEAR_C ++--->BN_MP_SET_C +| +--->BN_MP_ZERO_C ++--->BN_MP_EXCH_C -BN_MP_REDUCE_2K_SETUP_L_C -+--->BN_MP_INIT_C -+--->BN_MP_2EXPT_C -| +--->BN_MP_ZERO_C +BN_S_MP_MUL_DIGS_C ++--->BN_FAST_S_MP_MUL_DIGS_C | +--->BN_MP_GROW_C -+--->BN_MP_COUNT_BITS_C -+--->BN_S_MP_SUB_C +| +--->BN_MP_CLAMP_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C + + +BN_S_MP_MUL_HIGH_DIGS_C ++--->BN_FAST_S_MP_MUL_HIGH_DIGS_C | +--->BN_MP_GROW_C | +--->BN_MP_CLAMP_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C ++--->BN_MP_CLEAR_C + + +BN_S_MP_SQR_C ++--->BN_MP_INIT_SIZE_C +| +--->BN_MP_INIT_C ++--->BN_MP_CLAMP_C ++--->BN_MP_EXCH_C +--->BN_MP_CLEAR_C +BN_S_MP_SUB_C ++--->BN_MP_GROW_C ++--->BN_MP_CLAMP_C + + diff --git a/libtommath/changes.txt b/libtommath/changes.txt index d70d589..3379f71 100644 --- a/libtommath/changes.txt +++ b/libtommath/changes.txt @@ -1,6 +1,20 @@ +XXX, 2017 +v1.0.1 + -- Dmitry Kovalenko provided fixes to mp_add_d() and mp_init_copy() + -- Matt Johnston contributed some improvements to mp_div_2d(), + mp_exptmod_fast(), mp_mod() and mp_mulmod() + -- Julien Nabet provided a fix to the error handling in mp_init_multi() + -- Ben Gardner provided a fix regarding usage of reserved keywords + -- Fixed mp_rand() to fill the correct number of bits + -- Fixed mp_invmod() + -- Use the same 64-bit detection code as in libtomcrypt + -- Correct usage of DESTDIR, PREFIX, etc. when installing the library + -- Francois Perrad updated all the perl scripts to an actual perl version + + Feb 5th, 2016 -v1.0.0 - -- Bump to 1.0.0 +v1.0 + -- Bump to 1.0 -- Dirkjan Bussink provided a faster version of mp_expt_d() -- Moritz Lenz contributed a fix to mp_mod() and provided mp_get_long() and mp_set_long() diff --git a/libtommath/makefile b/libtommath/makefile index f90971c..fdd2435 100644 --- a/libtommath/makefile +++ b/libtommath/makefile @@ -8,12 +8,6 @@ else silent=@ endif -%.o: %.c -ifneq ($V,1) - @echo " * ${CC} $@" -endif - ${silent} ${CC} -c ${CFLAGS} $^ -o $@ - #default files to install ifndef LIBNAME LIBNAME=libtommath.a @@ -21,7 +15,13 @@ endif coverage: LIBNAME:=-Wl,--whole-archive $(LIBNAME) -Wl,--no-whole-archive -include makefile.include +include makefile_include.mk + +%.o: %.c +ifneq ($V,1) + @echo " * ${CC} $@" +endif + ${silent} ${CC} -c ${CFLAGS} $< -o $@ LCOV_ARGS=--directory . @@ -53,6 +53,8 @@ bn_s_mp_sqr.o bn_s_mp_sub.o #END_INS +$(OBJECTS): $(HEADERS) + $(LIBNAME): $(OBJECTS) $(AR) $(ARFLAGS) $@ $(OBJECTS) $(RANLIB) $@ @@ -86,6 +88,10 @@ install: $(LIBNAME) install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH) install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH) +uninstall: + rm $(DESTDIR)$(LIBPATH)/$(LIBNAME) + rm $(HEADERS_PUB:%=$(DESTDIR)$(INCPATH)/%) + test: $(LIBNAME) demo/demo.o $(CC) $(CFLAGS) demo/demo.o $(LIBNAME) $(LFLAGS) -o test @@ -96,94 +102,50 @@ test_standalone: $(LIBNAME) demo/demo.o mtest: cd mtest ; $(CC) $(CFLAGS) -O0 mtest.c $(LFLAGS) -o mtest +travis_mtest: test mtest + @ for i in `seq 1 10` ; do sleep 500 && echo alive; done & + ./mtest/mtest 666666 | ./test > test.log + timing: $(LIBNAME) $(CC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME) $(LFLAGS) -o ltmtest -coveralls: coverage - cpp-coveralls - -# makes the LTM book DVI file, requires tetex, perl and makeindex [part of tetex I think] -docdvi: tommath.src - cd pics ; MAKE=${MAKE} ${MAKE} - echo "hello" > tommath.ind - perl booker.pl - latex tommath > /dev/null - latex tommath > /dev/null - makeindex tommath - latex tommath > /dev/null - -# poster, makes the single page PDF poster -poster: poster.tex - cp poster.tex poster.bak - touch --reference=poster.tex poster.bak - (printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y poster.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > poster-deterministic.tex - printf "%s\n" "\pdfinfo{" >> poster-deterministic.tex - printf "%s\n" " /CreationDate (\fixedpdfdate)" >> poster-deterministic.tex - printf "%s\n}\n" " /ModDate (\fixedpdfdate)" >> poster-deterministic.tex - cat poster.tex >> poster-deterministic.tex - mv poster-deterministic.tex poster.tex - touch --reference=poster.bak poster.tex - pdflatex poster - sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' poster.pdf - mv poster.bak poster.tex - rm -f poster.aux poster.log poster.out - -# makes the LTM book PDF file, requires tetex, cleans up the LaTeX temp files -docs: docdvi - dvipdf tommath - rm -f tommath.log tommath.aux tommath.dvi tommath.idx tommath.toc tommath.lof tommath.ind tommath.ilg - cd pics ; MAKE=${MAKE} ${MAKE} clean - -#LTM user manual -mandvi: bn.tex - cp bn.tex bn.bak - touch --reference=bn.tex bn.bak - (printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y bn.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > bn-deterministic.tex - printf "%s\n" "\pdfinfo{" >> bn-deterministic.tex - printf "%s\n" " /CreationDate (\fixedpdfdate)" >> bn-deterministic.tex - printf "%s\n}\n" " /ModDate (\fixedpdfdate)" >> bn-deterministic.tex - cat bn.tex >> bn-deterministic.tex - mv bn-deterministic.tex bn.tex - touch --reference=bn.bak bn.tex - echo "hello" > bn.ind - latex bn > /dev/null - latex bn > /dev/null - makeindex bn - latex bn > /dev/null - -#LTM user manual [pdf] -manual: mandvi - pdflatex bn >/dev/null - sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' bn.pdf - mv bn.bak bn.tex - rm -f bn.aux bn.dvi bn.log bn.idx bn.lof bn.out bn.toc +# You have to create a file .coveralls.yml with the content "repo_token: " +# in the base folder to be able to submit to coveralls +coveralls: lcov + coveralls-lcov + +docdvi poster docs mandvi manual: + $(MAKE) -C doc/ $@ V=$(V) pretty: perl pretty.build -#\zipup the project (take that!) -no_oops: clean - cd .. ; cvs commit - echo Scanning for scratch/dirty files - find . -type f | grep -v CVS | xargs -n 1 bash mess.sh - .PHONY: pre_gen pre_gen: perl gen.pl sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c rm mpi.c -zipup: - rm -rf ../libtommath-$(VERSION) \ - && rm -f ../ltm-$(VERSION).zip ../ltm-$(VERSION).zip.asc ../ltm-$(VERSION).tar.xz ../ltm-$(VERSION).tar.xz.asc - git archive HEAD --prefix=libtommath-$(VERSION)/ > ../libtommath-$(VERSION).tar - cd .. ; tar xf libtommath-$(VERSION).tar - MAKE=${MAKE} ${MAKE} -C ../libtommath-$(VERSION) clean manual poster docs - tar -c ../libtommath-$(VERSION)/* | xz -9 > ../ltm-$(VERSION).tar.xz - find ../libtommath-$(VERSION)/ -type f -exec unix2dos -q {} \; - cd .. ; zip -9r ltm-$(VERSION).zip libtommath-$(VERSION) - gpg -b -a ../ltm-$(VERSION).tar.xz && gpg -b -a ../ltm-$(VERSION).zip +zipup: clean pre_gen new_file manual poster docs + @# Update the index, so diff-index won't fail in case the pdf has been created. + @# As the pdf creation modifies the tex files, git sometimes detects the + @# modified files, but misses that it's put back to its original version. + @git update-index --refresh + @git diff-index --quiet HEAD -- || ( echo "FAILURE: uncommited changes or not a git" && exit 1 ) + rm -rf libtommath-$(VERSION) ltm-$(VERSION).* + @# files/dirs excluded from "git archive" are defined in .gitattributes + git archive --format=tar --prefix=libtommath-$(VERSION)/ HEAD | tar x + mkdir -p libtommath-$(VERSION)/doc + cp doc/bn.pdf doc/tommath.pdf doc/poster.pdf libtommath-$(VERSION)/doc/ + tar -c libtommath-$(VERSION)/ | xz -6e -c - > ltm-$(VERSION).tar.xz + zip -9rq ltm-$(VERSION).zip libtommath-$(VERSION) + rm -rf libtommath-$(VERSION) + gpg -b -a ltm-$(VERSION).tar.xz + gpg -b -a ltm-$(VERSION).zip new_file: bash updatemakes.sh perl dep.pl + +perlcritic: + perlcritic *.pl diff --git a/libtommath/makefile.shared b/libtommath/makefile.shared index 559720e..67213a2 100644 --- a/libtommath/makefile.shared +++ b/libtommath/makefile.shared @@ -7,9 +7,16 @@ ifndef LIBNAME LIBNAME=libtommath.la endif -include makefile.include +include makefile_include.mk -LT ?= libtool + +ifndef LT + ifeq ($(PLATFORM), Darwin) + LT:=glibtool + else + LT:=libtool + endif +endif LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC) LCOV_ARGS=--directory .libs --directory . @@ -47,14 +54,24 @@ objs: $(OBJECTS) .c.o: $(LTCOMPILE) $(CFLAGS) $(LDFLAGS) -o $@ -c $< +LOBJECTS = $(OBJECTS:.o=.lo) + $(LIBNAME): $(OBJECTS) - $(LT) --mode=link --tag=CC $(CC) $(LDFLAGS) *.lo -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_SO) + $(LT) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LOBJECTS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_SO) install: $(LIBNAME) install -d $(DESTDIR)$(LIBPATH) install -d $(DESTDIR)$(INCPATH) - $(LT) --mode=install install -c $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME) + $(LT) --mode=install install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME) install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH) + sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION_PC),' libtommath.pc.in > libtommath.pc + install -d $(DESTDIR)$(LIBPATH)/pkgconfig + install -m 644 libtommath.pc $(DESTDIR)$(LIBPATH)/pkgconfig/ + +uninstall: + $(LT) --mode=uninstall rm $(DESTDIR)$(LIBPATH)/$(LIBNAME) + rm $(HEADERS_PUB:%=$(DESTDIR)$(INCPATH)/%) + rm $(DESTDIR)$(LIBPATH)/pkgconfig/libtommath.pc test: $(LIBNAME) demo/demo.o $(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o -- cgit v0.12 From 07bcf919d67411b26009a3e03fb41edfe9a75bc1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 30 Aug 2017 11:20:19 +0000 Subject: Cherry-pick [https://github.com/libtom/libtommath/commit/a0a86c696a7182f8be4b10bb79a1c5c971dc9561]: Merge branch 'tcl-fixes' into develop Remove many files, which are not used in Tcl. Modify "changelog.txt", with real release-date of 1.0.1 version --- libtommath/bn.ilg | 6 - libtommath/bn.ind | 88 - libtommath/bn.pdf | Bin 383770 -> 0 bytes libtommath/bn.tex | 1913 ------ libtommath/bn_mp_read_radix.c | 8 +- libtommath/booker.pl | 267 - libtommath/changes.txt | 2 +- libtommath/demo/demo.c | 986 ---- libtommath/demo/timing.c | 339 -- libtommath/dep.pl | 123 - libtommath/etc/2kprime.1 | 2 - libtommath/etc/2kprime.c | 84 - libtommath/etc/drprime.c | 64 - libtommath/etc/drprimes.28 | 25 - libtommath/etc/drprimes.txt | 9 - libtommath/etc/makefile | 50 - libtommath/etc/makefile.icc | 67 - libtommath/etc/makefile.msvc | 23 - libtommath/etc/mersenne.c | 144 - libtommath/etc/mont.c | 50 - libtommath/etc/pprime.c | 400 -- libtommath/etc/prime.1024 | 414 -- libtommath/etc/prime.512 | 205 - libtommath/etc/timer.asm | 37 - libtommath/etc/tune.c | 145 - libtommath/filter.pl | 34 - libtommath/gen.pl | 19 - libtommath/genlist.sh | 8 - libtommath/libtommath.dsp | 572 -- libtommath/libtommath_VS2005.sln | 20 - libtommath/libtommath_VS2005.vcproj | 2847 --------- libtommath/libtommath_VS2008.sln | 20 - libtommath/libtommath_VS2008.vcproj | 2813 --------- libtommath/logs/README | 13 - libtommath/logs/add.log | 16 - libtommath/logs/addsub.png | Bin 6254 -> 0 bytes libtommath/logs/expt.log | 7 - libtommath/logs/expt.png | Bin 6605 -> 0 bytes libtommath/logs/expt_2k.log | 5 - libtommath/logs/expt_2kl.log | 4 - libtommath/logs/expt_dr.log | 7 - libtommath/logs/graphs.dem | 17 - libtommath/logs/index.html | 27 - libtommath/logs/invmod.log | 0 libtommath/logs/invmod.png | Bin 4918 -> 0 bytes libtommath/logs/mult.log | 84 - libtommath/logs/mult.png | Bin 6770 -> 0 bytes libtommath/logs/mult_kara.log | 84 - libtommath/logs/sqr.log | 84 - libtommath/logs/sqr_kara.log | 84 - libtommath/logs/sub.log | 16 - libtommath/makefile_include.mk | 117 + libtommath/mess.sh | 4 - libtommath/mtest/logtab.h | 24 - libtommath/mtest/mpi-config.h | 90 - libtommath/mtest/mpi-types.h | 20 - libtommath/mtest/mpi.c | 3985 ------------- libtommath/mtest/mpi.h | 231 - libtommath/mtest/mtest.c | 374 -- libtommath/parsenames.pl | 25 - libtommath/pics/design_process.sxd | Bin 6950 -> 0 bytes libtommath/pics/design_process.tif | Bin 79042 -> 0 bytes libtommath/pics/expt_state.sxd | Bin 6869 -> 0 bytes libtommath/pics/expt_state.tif | Bin 87542 -> 0 bytes libtommath/pics/makefile | 35 - libtommath/pics/primality.tif | Bin 85514 -> 0 bytes libtommath/pics/radix.sxd | Bin 6181 -> 0 bytes libtommath/pics/sliding_window.sxd | Bin 6787 -> 0 bytes libtommath/pics/sliding_window.tif | Bin 53880 -> 0 bytes libtommath/poster.out | 0 libtommath/poster.pdf | Bin 73388 -> 0 bytes libtommath/poster.tex | 35 - libtommath/pre_gen/mpi.c | 9524 ------------------------------ libtommath/pretty.build | 66 - libtommath/testme.sh | 174 - libtommath/tombc/grammar.txt | 35 - libtommath/tommath.h | 2 +- libtommath/tommath.out | 139 - libtommath/tommath.pdf | Bin 1526291 -> 0 bytes libtommath/tommath.src | 6339 -------------------- libtommath/tommath.tex | 10816 ---------------------------------- 81 files changed, 126 insertions(+), 44141 deletions(-) delete mode 100644 libtommath/bn.ilg delete mode 100644 libtommath/bn.ind delete mode 100644 libtommath/bn.pdf delete mode 100644 libtommath/bn.tex delete mode 100644 libtommath/booker.pl delete mode 100644 libtommath/demo/demo.c delete mode 100644 libtommath/demo/timing.c delete mode 100644 libtommath/dep.pl delete mode 100644 libtommath/etc/2kprime.1 delete mode 100644 libtommath/etc/2kprime.c delete mode 100644 libtommath/etc/drprime.c delete mode 100644 libtommath/etc/drprimes.28 delete mode 100644 libtommath/etc/drprimes.txt delete mode 100644 libtommath/etc/makefile delete mode 100644 libtommath/etc/makefile.icc delete mode 100644 libtommath/etc/makefile.msvc delete mode 100644 libtommath/etc/mersenne.c delete mode 100644 libtommath/etc/mont.c delete mode 100644 libtommath/etc/pprime.c delete mode 100644 libtommath/etc/prime.1024 delete mode 100644 libtommath/etc/prime.512 delete mode 100644 libtommath/etc/timer.asm delete mode 100644 libtommath/etc/tune.c delete mode 100755 libtommath/filter.pl delete mode 100644 libtommath/gen.pl delete mode 100755 libtommath/genlist.sh delete mode 100644 libtommath/libtommath.dsp delete mode 100644 libtommath/libtommath_VS2005.sln delete mode 100644 libtommath/libtommath_VS2005.vcproj delete mode 100644 libtommath/libtommath_VS2008.sln delete mode 100644 libtommath/libtommath_VS2008.vcproj delete mode 100644 libtommath/logs/README delete mode 100644 libtommath/logs/add.log delete mode 100644 libtommath/logs/addsub.png delete mode 100644 libtommath/logs/expt.log delete mode 100644 libtommath/logs/expt.png delete mode 100644 libtommath/logs/expt_2k.log delete mode 100644 libtommath/logs/expt_2kl.log delete mode 100644 libtommath/logs/expt_dr.log delete mode 100644 libtommath/logs/graphs.dem delete mode 100644 libtommath/logs/index.html delete mode 100644 libtommath/logs/invmod.log delete mode 100644 libtommath/logs/invmod.png delete mode 100644 libtommath/logs/mult.log delete mode 100644 libtommath/logs/mult.png delete mode 100644 libtommath/logs/mult_kara.log delete mode 100644 libtommath/logs/sqr.log delete mode 100644 libtommath/logs/sqr_kara.log delete mode 100644 libtommath/logs/sub.log create mode 100644 libtommath/makefile_include.mk delete mode 100644 libtommath/mess.sh delete mode 100644 libtommath/mtest/logtab.h delete mode 100644 libtommath/mtest/mpi-config.h delete mode 100644 libtommath/mtest/mpi-types.h delete mode 100644 libtommath/mtest/mpi.c delete mode 100644 libtommath/mtest/mpi.h delete mode 100644 libtommath/mtest/mtest.c delete mode 100755 libtommath/parsenames.pl delete mode 100644 libtommath/pics/design_process.sxd delete mode 100644 libtommath/pics/design_process.tif delete mode 100644 libtommath/pics/expt_state.sxd delete mode 100644 libtommath/pics/expt_state.tif delete mode 100644 libtommath/pics/makefile delete mode 100644 libtommath/pics/primality.tif delete mode 100644 libtommath/pics/radix.sxd delete mode 100644 libtommath/pics/sliding_window.sxd delete mode 100644 libtommath/pics/sliding_window.tif delete mode 100644 libtommath/poster.out delete mode 100644 libtommath/poster.pdf delete mode 100644 libtommath/poster.tex delete mode 100644 libtommath/pre_gen/mpi.c delete mode 100644 libtommath/pretty.build delete mode 100755 libtommath/testme.sh delete mode 100644 libtommath/tombc/grammar.txt delete mode 100644 libtommath/tommath.out delete mode 100644 libtommath/tommath.pdf delete mode 100644 libtommath/tommath.src delete mode 100644 libtommath/tommath.tex diff --git a/libtommath/bn.ilg b/libtommath/bn.ilg deleted file mode 100644 index 2a14624..0000000 --- a/libtommath/bn.ilg +++ /dev/null @@ -1,6 +0,0 @@ -This is makeindex, version 2.15 [TeX Live 2013] (kpathsea + Thai support). -Scanning input file bn.idx....done (85 entries accepted, 0 rejected). -Sorting entries....done (554 comparisons). -Generating output file bn.ind....done (88 lines written, 0 warnings). -Output written in bn.ind. -Transcript written in bn.ilg. diff --git a/libtommath/bn.ind b/libtommath/bn.ind deleted file mode 100644 index 01cff1a..0000000 --- a/libtommath/bn.ind +++ /dev/null @@ -1,88 +0,0 @@ -\begin{theindex} - - \item mp\_add, \hyperpage{24} - \item mp\_add\_d, \hyperpage{44} - \item mp\_and, \hyperpage{24} - \item mp\_clear, \hyperpage{9} - \item mp\_clear\_multi, \hyperpage{10} - \item mp\_cmp, \hyperpage{19} - \item mp\_cmp\_d, \hyperpage{20} - \item mp\_cmp\_mag, \hyperpage{18} - \item mp\_div, \hyperpage{24} - \item mp\_div\_2, \hyperpage{22} - \item mp\_div\_2d, \hyperpage{23} - \item mp\_div\_d, \hyperpage{44} - \item mp\_dr\_reduce, \hyperpage{33} - \item mp\_dr\_setup, \hyperpage{33} - \item MP\_EQ, \hyperpage{18} - \item mp\_error\_to\_string, \hyperpage{7} - \item mp\_expt\_d, \hyperpage{35} - \item mp\_expt\_d\_ex, \hyperpage{35} - \item mp\_exptmod, \hyperpage{35} - \item mp\_exteuclid, \hyperpage{43} - \item mp\_gcd, \hyperpage{43} - \item mp\_get\_int, \hyperpage{16} - \item mp\_get\_long, \hyperpage{17} - \item mp\_get\_long\_long, \hyperpage{17} - \item mp\_grow, \hyperpage{13} - \item MP\_GT, \hyperpage{18} - \item mp\_init, \hyperpage{8} - \item mp\_init\_copy, \hyperpage{10} - \item mp\_init\_multi, \hyperpage{10} - \item mp\_init\_set, \hyperpage{17} - \item mp\_init\_set\_int, \hyperpage{17} - \item mp\_init\_size, \hyperpage{11} - \item mp\_int, \hyperpage{8} - \item mp\_invmod, \hyperpage{44} - \item mp\_jacobi, \hyperpage{43} - \item mp\_lcm, \hyperpage{43} - \item mp\_lshd, \hyperpage{23} - \item MP\_LT, \hyperpage{18} - \item MP\_MEM, \hyperpage{7} - \item mp\_mod, \hyperpage{29} - \item mp\_mod\_d, \hyperpage{44} - \item mp\_montgomery\_calc\_normalization, \hyperpage{31} - \item mp\_montgomery\_reduce, \hyperpage{31} - \item mp\_montgomery\_setup, \hyperpage{31} - \item mp\_mul, \hyperpage{25} - \item mp\_mul\_2, \hyperpage{22} - \item mp\_mul\_2d, \hyperpage{23} - \item mp\_mul\_d, \hyperpage{44} - \item mp\_n\_root, \hyperpage{36} - \item mp\_neg, \hyperpage{24} - \item MP\_NO, \hyperpage{7} - \item MP\_OKAY, \hyperpage{7} - \item mp\_or, \hyperpage{24} - \item mp\_prime\_fermat, \hyperpage{37} - \item mp\_prime\_is\_divisible, \hyperpage{37} - \item mp\_prime\_is\_prime, \hyperpage{38} - \item mp\_prime\_miller\_rabin, \hyperpage{37} - \item mp\_prime\_next\_prime, \hyperpage{38} - \item mp\_prime\_rabin\_miller\_trials, \hyperpage{38} - \item mp\_prime\_random, \hyperpage{38} - \item mp\_prime\_random\_ex, \hyperpage{39} - \item mp\_radix\_size, \hyperpage{41} - \item mp\_read\_radix, \hyperpage{41} - \item mp\_read\_unsigned\_bin, \hyperpage{42} - \item mp\_reduce, \hyperpage{30} - \item mp\_reduce\_2k, \hyperpage{34} - \item mp\_reduce\_2k\_setup, \hyperpage{34} - \item mp\_reduce\_setup, \hyperpage{29} - \item mp\_rshd, \hyperpage{23} - \item mp\_set, \hyperpage{15} - \item mp\_set\_int, \hyperpage{16} - \item mp\_set\_long, \hyperpage{17} - \item mp\_set\_long\_long, \hyperpage{17} - \item mp\_shrink, \hyperpage{12} - \item mp\_sqr, \hyperpage{26} - \item mp\_sqrtmod\_prime, \hyperpage{44} - \item mp\_sub, \hyperpage{24} - \item mp\_sub\_d, \hyperpage{44} - \item mp\_to\_unsigned\_bin, \hyperpage{42} - \item mp\_toradix, \hyperpage{41} - \item mp\_unsigned\_bin\_size, \hyperpage{41} - \item MP\_VAL, \hyperpage{7} - \item mp\_xor, \hyperpage{24} - \item MP\_YES, \hyperpage{7} - -\end{theindex} diff --git a/libtommath/bn.pdf b/libtommath/bn.pdf deleted file mode 100644 index a1f40ef..0000000 Binary files a/libtommath/bn.pdf and /dev/null differ diff --git a/libtommath/bn.tex b/libtommath/bn.tex deleted file mode 100644 index d975471..0000000 --- a/libtommath/bn.tex +++ /dev/null @@ -1,1913 +0,0 @@ -\documentclass[synpaper]{book} -\usepackage{hyperref} -\usepackage{makeidx} -\usepackage{amssymb} -\usepackage{color} -\usepackage{alltt} -\usepackage{graphicx} -\usepackage{layout} -\def\union{\cup} -\def\intersect{\cap} -\def\getsrandom{\stackrel{\rm R}{\gets}} -\def\cross{\times} -\def\cat{\hspace{0.5em} \| \hspace{0.5em}} -\def\catn{$\|$} -\def\divides{\hspace{0.3em} | \hspace{0.3em}} -\def\nequiv{\not\equiv} -\def\approx{\raisebox{0.2ex}{\mbox{\small $\sim$}}} -\def\lcm{{\rm lcm}} -\def\gcd{{\rm gcd}} -\def\log{{\rm log}} -\def\ord{{\rm ord}} -\def\abs{{\mathit abs}} -\def\rep{{\mathit rep}} -\def\mod{{\mathit\ mod\ }} -\renewcommand{\pmod}[1]{\ ({\rm mod\ }{#1})} -\newcommand{\floor}[1]{\left\lfloor{#1}\right\rfloor} -\newcommand{\ceil}[1]{\left\lceil{#1}\right\rceil} -\def\Or{{\rm\ or\ }} -\def\And{{\rm\ and\ }} -\def\iff{\hspace{1em}\Longleftrightarrow\hspace{1em}} -\def\implies{\Rightarrow} -\def\undefined{{\rm ``undefined"}} -\def\Proof{\vspace{1ex}\noindent {\bf Proof:}\hspace{1em}} -\let\oldphi\phi -\def\phi{\varphi} -\def\Pr{{\rm Pr}} -\newcommand{\str}[1]{{\mathbf{#1}}} -\def\F{{\mathbb F}} -\def\N{{\mathbb N}} -\def\Z{{\mathbb Z}} -\def\R{{\mathbb R}} -\def\C{{\mathbb C}} -\def\Q{{\mathbb Q}} -\definecolor{DGray}{gray}{0.5} -\newcommand{\emailaddr}[1]{\mbox{$<${#1}$>$}} -\def\twiddle{\raisebox{0.3ex}{\mbox{\tiny $\sim$}}} -\def\gap{\vspace{0.5ex}} -\makeindex -\begin{document} -\frontmatter -\pagestyle{empty} -\title{LibTomMath User Manual \\ v1.0.0} -\author{Tom St Denis \\ tstdenis82@gmail.com} -\maketitle -This text, the library and the accompanying textbook are all hereby placed in the public domain. This book has been -formatted for B5 [176x250] paper using the \LaTeX{} {\em book} macro package. - -\vspace{10cm} - -\begin{flushright}Open Source. Open Academia. Open Minds. - -\mbox{ } - -Tom St Denis, - -Ontario, Canada -\end{flushright} - -\tableofcontents -\listoffigures -\mainmatter -\pagestyle{headings} -\chapter{Introduction} -\section{What is LibTomMath?} -LibTomMath is a library of source code which provides a series of efficient and carefully written functions for manipulating -large integer numbers. It was written in portable ISO C source code so that it will build on any platform with a conforming -C compiler. - -In a nutshell the library was written from scratch with verbose comments to help instruct computer science students how -to implement ``bignum'' math. However, the resulting code has proven to be very useful. It has been used by numerous -universities, commercial and open source software developers. It has been used on a variety of platforms ranging from -Linux and Windows based x86 to ARM based Gameboys and PPC based MacOS machines. - -\section{License} -As of the v0.25 the library source code has been placed in the public domain with every new release. As of the v0.28 -release the textbook ``Implementing Multiple Precision Arithmetic'' has been placed in the public domain with every new -release as well. This textbook is meant to compliment the project by providing a more solid walkthrough of the development -algorithms used in the library. - -Since both\footnote{Note that the MPI files under mtest/ are copyrighted by Michael Fromberger. They are not required to use LibTomMath.} are in the -public domain everyone is entitled to do with them as they see fit. - -\section{Building LibTomMath} - -LibTomMath is meant to be very ``GCC friendly'' as it comes with a makefile well suited for GCC. However, the library will -also build in MSVC, Borland C out of the box. For any other ISO C compiler a makefile will have to be made by the end -developer. - -\subsection{Static Libraries} -To build as a static library for GCC issue the following -\begin{alltt} -make -\end{alltt} - -command. This will build the library and archive the object files in ``libtommath.a''. Now you link against -that and include ``tommath.h'' within your programs. Alternatively to build with MSVC issue the following -\begin{alltt} -nmake -f makefile.msvc -\end{alltt} - -This will build the library and archive the object files in ``tommath.lib''. This has been tested with MSVC -version 6.00 with service pack 5. - -\subsection{Shared Libraries} -To build as a shared library for GCC issue the following -\begin{alltt} -make -f makefile.shared -\end{alltt} -This requires the ``libtool'' package (common on most Linux/BSD systems). It will build LibTomMath as both shared -and static then install (by default) into /usr/lib as well as install the header files in /usr/include. The shared -library (resource) will be called ``libtommath.la'' while the static library called ``libtommath.a''. Generally -you use libtool to link your application against the shared object. - -There is limited support for making a ``DLL'' in windows via the ``makefile.cygwin\_dll'' makefile. It requires -Cygwin to work with since it requires the auto-export/import functionality. The resulting DLL and import library -``libtommath.dll.a'' can be used to link LibTomMath dynamically to any Windows program using Cygwin. - -\subsection{Testing} -To build the library and the test harness type - -\begin{alltt} -make test -\end{alltt} - -This will build the library, ``test'' and ``mtest/mtest''. The ``test'' program will accept test vectors and verify the -results. ``mtest/mtest'' will generate test vectors using the MPI library by Michael Fromberger\footnote{A copy of MPI -is included in the package}. Simply pipe mtest into test using - -\begin{alltt} -mtest/mtest | test -\end{alltt} - -If you do not have a ``/dev/urandom'' style RNG source you will have to write your own PRNG and simply pipe that into -mtest. For example, if your PRNG program is called ``myprng'' simply invoke - -\begin{alltt} -myprng | mtest/mtest | test -\end{alltt} - -This will output a row of numbers that are increasing. Each column is a different test (such as addition, multiplication, etc) -that is being performed. The numbers represent how many times the test was invoked. If an error is detected the program -will exit with a dump of the relevent numbers it was working with. - -\section{Build Configuration} -LibTomMath can configured at build time in three phases we shall call ``depends'', ``tweaks'' and ``trims''. -Each phase changes how the library is built and they are applied one after another respectively. - -To make the system more powerful you can tweak the build process. Classes are defined in the file -``tommath\_superclass.h''. By default, the symbol ``LTM\_ALL'' shall be defined which simply -instructs the system to build all of the functions. This is how LibTomMath used to be packaged. This will give you -access to every function LibTomMath offers. - -However, there are cases where such a build is not optional. For instance, you want to perform RSA operations. You -don't need the vast majority of the library to perform these operations. Aside from LTM\_ALL there is -another pre--defined class ``SC\_RSA\_1'' which works in conjunction with the RSA from LibTomCrypt. Additional -classes can be defined base on the need of the user. - -\subsection{Build Depends} -In the file tommath\_class.h you will see a large list of C ``defines'' followed by a series of ``ifdefs'' -which further define symbols. All of the symbols (technically they're macros $\ldots$) represent a given C source -file. For instance, BN\_MP\_ADD\_C represents the file ``bn\_mp\_add.c''. When a define has been enabled the -function in the respective file will be compiled and linked into the library. Accordingly when the define -is absent the file will not be compiled and not contribute any size to the library. - -You will also note that the header tommath\_class.h is actually recursively included (it includes itself twice). -This is to help resolve as many dependencies as possible. In the last pass the symbol LTM\_LAST will be defined. -This is useful for ``trims''. - -\subsection{Build Tweaks} -A tweak is an algorithm ``alternative''. For example, to provide tradeoffs (usually between size and space). -They can be enabled at any pass of the configuration phase. - -\begin{small} -\begin{center} -\begin{tabular}{|l|l|} -\hline \textbf{Define} & \textbf{Purpose} \\ -\hline BN\_MP\_DIV\_SMALL & Enables a slower, smaller and equally \\ - & functional mp\_div() function \\ -\hline -\end{tabular} -\end{center} -\end{small} - -\subsection{Build Trims} -A trim is a manner of removing functionality from a function that is not required. For instance, to perform -RSA cryptography you only require exponentiation with odd moduli so even moduli support can be safely removed. -Build trims are meant to be defined on the last pass of the configuration which means they are to be defined -only if LTM\_LAST has been defined. - -\subsubsection{Moduli Related} -\begin{small} -\begin{center} -\begin{tabular}{|l|l|} -\hline \textbf{Restriction} & \textbf{Undefine} \\ -\hline Exponentiation with odd moduli only & BN\_S\_MP\_EXPTMOD\_C \\ - & BN\_MP\_REDUCE\_C \\ - & BN\_MP\_REDUCE\_SETUP\_C \\ - & BN\_S\_MP\_MUL\_HIGH\_DIGS\_C \\ - & BN\_FAST\_S\_MP\_MUL\_HIGH\_DIGS\_C \\ -\hline Exponentiation with random odd moduli & (The above plus the following) \\ - & BN\_MP\_REDUCE\_2K\_C \\ - & BN\_MP\_REDUCE\_2K\_SETUP\_C \\ - & BN\_MP\_REDUCE\_IS\_2K\_C \\ - & BN\_MP\_DR\_IS\_MODULUS\_C \\ - & BN\_MP\_DR\_REDUCE\_C \\ - & BN\_MP\_DR\_SETUP\_C \\ -\hline Modular inverse odd moduli only & BN\_MP\_INVMOD\_SLOW\_C \\ -\hline Modular inverse (both, smaller/slower) & BN\_FAST\_MP\_INVMOD\_C \\ -\hline -\end{tabular} -\end{center} -\end{small} - -\subsubsection{Operand Size Related} -\begin{small} -\begin{center} -\begin{tabular}{|l|l|} -\hline \textbf{Restriction} & \textbf{Undefine} \\ -\hline Moduli $\le 2560$ bits & BN\_MP\_MONTGOMERY\_REDUCE\_C \\ - & BN\_S\_MP\_MUL\_DIGS\_C \\ - & BN\_S\_MP\_MUL\_HIGH\_DIGS\_C \\ - & BN\_S\_MP\_SQR\_C \\ -\hline Polynomial Schmolynomial & BN\_MP\_KARATSUBA\_MUL\_C \\ - & BN\_MP\_KARATSUBA\_SQR\_C \\ - & BN\_MP\_TOOM\_MUL\_C \\ - & BN\_MP\_TOOM\_SQR\_C \\ - -\hline -\end{tabular} -\end{center} -\end{small} - - -\section{Purpose of LibTomMath} -Unlike GNU MP (GMP) Library, LIP, OpenSSL or various other commercial kits (Miracl), LibTomMath was not written with -bleeding edge performance in mind. First and foremost LibTomMath was written to be entirely open. Not only is the -source code public domain (unlike various other GPL/etc licensed code), not only is the code freely downloadable but the -source code is also accessible for computer science students attempting to learn ``BigNum'' or multiple precision -arithmetic techniques. - -LibTomMath was written to be an instructive collection of source code. This is why there are many comments, only one -function per source file and often I use a ``middle-road'' approach where I don't cut corners for an extra 2\% speed -increase. - -Source code alone cannot really teach how the algorithms work which is why I also wrote a textbook that accompanies -the library (beat that!). - -So you may be thinking ``should I use LibTomMath?'' and the answer is a definite maybe. Let me tabulate what I think -are the pros and cons of LibTomMath by comparing it to the math routines from GnuPG\footnote{GnuPG v1.2.3 versus LibTomMath v0.28}. - -\newpage\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|l|c|c|l|} -\hline \textbf{Criteria} & \textbf{Pro} & \textbf{Con} & \textbf{Notes} \\ -\hline Few lines of code per file & X & & GnuPG $ = 300.9$, LibTomMath $ = 71.97$ \\ -\hline Commented function prototypes & X && GnuPG function names are cryptic. \\ -\hline Speed && X & LibTomMath is slower. \\ -\hline Totally free & X & & GPL has unfavourable restrictions.\\ -\hline Large function base & X & & GnuPG is barebones. \\ -\hline Five modular reduction algorithms & X & & Faster modular exponentiation for a variety of moduli. \\ -\hline Portable & X & & GnuPG requires configuration to build. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{LibTomMath Valuation} -\end{figure} - -It may seem odd to compare LibTomMath to GnuPG since the math in GnuPG is only a small portion of the entire application. -However, LibTomMath was written with cryptography in mind. It provides essentially all of the functions a cryptosystem -would require when working with large integers. - -So it may feel tempting to just rip the math code out of GnuPG (or GnuMP where it was taken from originally) in your -own application but I think there are reasons not to. While LibTomMath is slower than libraries such as GnuMP it is -not normally significantly slower. On x86 machines the difference is normally a factor of two when performing modular -exponentiations. It depends largely on the processor, compiler and the moduli being used. - -Essentially the only time you wouldn't use LibTomMath is when blazing speed is the primary concern. However, -on the other side of the coin LibTomMath offers you a totally free (public domain) well structured math library -that is very flexible, complete and performs well in resource contrained environments. Fast RSA for example can -be performed with as little as 8KB of ram for data (again depending on build options). - -\chapter{Getting Started with LibTomMath} -\section{Building Programs} -In order to use LibTomMath you must include ``tommath.h'' and link against the appropriate library file (typically -libtommath.a). There is no library initialization required and the entire library is thread safe. - -\section{Return Codes} -There are three possible return codes a function may return. - -\index{MP\_OKAY}\index{MP\_YES}\index{MP\_NO}\index{MP\_VAL}\index{MP\_MEM} -\begin{figure}[here!] -\begin{center} -\begin{small} -\begin{tabular}{|l|l|} -\hline \textbf{Code} & \textbf{Meaning} \\ -\hline MP\_OKAY & The function succeeded. \\ -\hline MP\_VAL & The function input was invalid. \\ -\hline MP\_MEM & Heap memory exhausted. \\ -\hline &\\ -\hline MP\_YES & Response is yes. \\ -\hline MP\_NO & Response is no. \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Return Codes} -\end{figure} - -The last two codes listed are not actually ``return'ed'' by a function. They are placed in an integer (the caller must -provide the address of an integer it can store to) which the caller can access. To convert one of the three return codes -to a string use the following function. - -\index{mp\_error\_to\_string} -\begin{alltt} -char *mp_error_to_string(int code); -\end{alltt} - -This will return a pointer to a string which describes the given error code. It will not work for the return codes -MP\_YES and MP\_NO. - -\section{Data Types} -The basic ``multiple precision integer'' type is known as the ``mp\_int'' within LibTomMath. This data type is used to -organize all of the data required to manipulate the integer it represents. Within LibTomMath it has been prototyped -as the following. - -\index{mp\_int} -\begin{alltt} -typedef struct \{ - int used, alloc, sign; - mp_digit *dp; -\} mp_int; -\end{alltt} - -Where ``mp\_digit'' is a data type that represents individual digits of the integer. By default, an mp\_digit is the -ISO C ``unsigned long'' data type and each digit is $28-$bits long. The mp\_digit type can be configured to suit other -platforms by defining the appropriate macros. - -All LTM functions that use the mp\_int type will expect a pointer to mp\_int structure. You must allocate memory to -hold the structure itself by yourself (whether off stack or heap it doesn't matter). The very first thing that must be -done to use an mp\_int is that it must be initialized. - -\section{Function Organization} - -The arithmetic functions of the library are all organized to have the same style prototype. That is source operands -are passed on the left and the destination is on the right. For instance, - -\begin{alltt} -mp_add(&a, &b, &c); /* c = a + b */ -mp_mul(&a, &a, &c); /* c = a * a */ -mp_div(&a, &b, &c, &d); /* c = [a/b], d = a mod b */ -\end{alltt} - -Another feature of the way the functions have been implemented is that source operands can be destination operands as well. -For instance, - -\begin{alltt} -mp_add(&a, &b, &b); /* b = a + b */ -mp_div(&a, &b, &a, &c); /* a = [a/b], c = a mod b */ -\end{alltt} - -This allows operands to be re-used which can make programming simpler. - -\section{Initialization} -\subsection{Single Initialization} -A single mp\_int can be initialized with the ``mp\_init'' function. - -\index{mp\_init} -\begin{alltt} -int mp_init (mp_int * a); -\end{alltt} - -This function expects a pointer to an mp\_int structure and will initialize the members of the structure so the mp\_int -represents the default integer which is zero. If the functions returns MP\_OKAY then the mp\_int is ready to be used -by the other LibTomMath functions. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use the number */ - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\subsection{Single Free} -When you are finished with an mp\_int it is ideal to return the heap it used back to the system. The following function -provides this functionality. - -\index{mp\_clear} -\begin{alltt} -void mp_clear (mp_int * a); -\end{alltt} - -The function expects a pointer to a previously initialized mp\_int structure and frees the heap it uses. It sets the -pointer\footnote{The ``dp'' member.} within the mp\_int to \textbf{NULL} which is used to prevent double free situations. -Is is legal to call mp\_clear() twice on the same mp\_int in a row. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use the number */ - - /* We're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\subsection{Multiple Initializations} -Certain algorithms require more than one large integer. In these instances it is ideal to initialize all of the mp\_int -variables in an ``all or nothing'' fashion. That is, they are either all initialized successfully or they are all -not initialized. - -The mp\_init\_multi() function provides this functionality. - -\index{mp\_init\_multi} \index{mp\_clear\_multi} -\begin{alltt} -int mp_init_multi(mp_int *mp, ...); -\end{alltt} - -It accepts a \textbf{NULL} terminated list of pointers to mp\_int structures. It will attempt to initialize them all -at once. If the function returns MP\_OKAY then all of the mp\_int variables are ready to use, otherwise none of them -are available for use. A complementary mp\_clear\_multi() function allows multiple mp\_int variables to be free'd -from the heap at the same time. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int num1, num2, num3; - int result; - - if ((result = mp_init_multi(&num1, - &num2, - &num3, NULL)) != MP\_OKAY) \{ - printf("Error initializing the numbers. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use the numbers */ - - /* We're done with them. */ - mp_clear_multi(&num1, &num2, &num3, NULL); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\subsection{Other Initializers} -To initialized and make a copy of an mp\_int the mp\_init\_copy() function has been provided. - -\index{mp\_init\_copy} -\begin{alltt} -int mp_init_copy (mp_int * a, mp_int * b); -\end{alltt} - -This function will initialize $a$ and make it a copy of $b$ if all goes well. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int num1, num2; - int result; - - /* initialize and do work on num1 ... */ - - /* We want a copy of num1 in num2 now */ - if ((result = mp_init_copy(&num2, &num1)) != MP_OKAY) \{ - printf("Error initializing the copy. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* now num2 is ready and contains a copy of num1 */ - - /* We're done with them. */ - mp_clear_multi(&num1, &num2, NULL); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -Another less common initializer is mp\_init\_size() which allows the user to initialize an mp\_int with a given -default number of digits. By default, all initializers allocate \textbf{MP\_PREC} digits. This function lets -you override this behaviour. - -\index{mp\_init\_size} -\begin{alltt} -int mp_init_size (mp_int * a, int size); -\end{alltt} - -The $size$ parameter must be greater than zero. If the function succeeds the mp\_int $a$ will be initialized -to have $size$ digits (which are all initially zero). - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - /* we need a 60-digit number */ - if ((result = mp_init_size(&number, 60)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use the number */ - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\section{Maintenance Functions} - -\subsection{Reducing Memory Usage} -When an mp\_int is in a state where it won't be changed again\footnote{A Diffie-Hellman modulus for instance.} excess -digits can be removed to return memory to the heap with the mp\_shrink() function. - -\index{mp\_shrink} -\begin{alltt} -int mp_shrink (mp_int * a); -\end{alltt} - -This will remove excess digits of the mp\_int $a$. If the operation fails the mp\_int should be intact without the -excess digits being removed. Note that you can use a shrunk mp\_int in further computations, however, such operations -will require heap operations which can be slow. It is not ideal to shrink mp\_int variables that you will further -modify in the system (unless you are seriously low on memory). - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use the number [e.g. pre-computation] */ - - /* We're done with it for now. */ - if ((result = mp_shrink(&number)) != MP_OKAY) \{ - printf("Error shrinking the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use it .... */ - - - /* we're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\subsection{Adding additional digits} - -Within the mp\_int structure are two parameters which control the limitations of the array of digits that represent -the integer the mp\_int is meant to equal. The \textit{used} parameter dictates how many digits are significant, that is, -contribute to the value of the mp\_int. The \textit{alloc} parameter dictates how many digits are currently available in -the array. If you need to perform an operation that requires more digits you will have to mp\_grow() the mp\_int to -your desired size. - -\index{mp\_grow} -\begin{alltt} -int mp_grow (mp_int * a, int size); -\end{alltt} - -This will grow the array of digits of $a$ to $size$. If the \textit{alloc} parameter is already bigger than -$size$ the function will not do anything. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* use the number */ - - /* We need to add 20 digits to the number */ - if ((result = mp_grow(&number, number.alloc + 20)) != MP_OKAY) \{ - printf("Error growing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - - /* use the number */ - - /* we're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\chapter{Basic Operations} -\section{Small Constants} -Setting mp\_ints to small constants is a relatively common operation. To accomodate these instances there are two -small constant assignment functions. The first function is used to set a single digit constant while the second sets -an ISO C style ``unsigned long'' constant. The reason for both functions is efficiency. Setting a single digit is quick but the -domain of a digit can change (it's always at least $0 \ldots 127$). - -\subsection{Single Digit} - -Setting a single digit can be accomplished with the following function. - -\index{mp\_set} -\begin{alltt} -void mp_set (mp_int * a, mp_digit b); -\end{alltt} - -This will zero the contents of $a$ and make it represent an integer equal to the value of $b$. Note that this -function has a return type of \textbf{void}. It cannot cause an error so it is safe to assume the function -succeeded. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the number to 5 */ - mp_set(&number, 5); - - /* we're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -\subsection{Long Constants} - -To set a constant that is the size of an ISO C ``unsigned long'' and larger than a single digit the following function -can be used. - -\index{mp\_set\_int} -\begin{alltt} -int mp_set_int (mp_int * a, unsigned long b); -\end{alltt} - -This will assign the value of the 32-bit variable $b$ to the mp\_int $a$. Unlike mp\_set() this function will always -accept a 32-bit input regardless of the size of a single digit. However, since the value may span several digits -this function can fail if it runs out of heap memory. - -To get the ``unsigned long'' copy of an mp\_int the following function can be used. - -\index{mp\_get\_int} -\begin{alltt} -unsigned long mp_get_int (mp_int * a); -\end{alltt} - -This will return the 32 least significant bits of the mp\_int $a$. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the number to 654321 (note this is bigger than 127) */ - if ((result = mp_set_int(&number, 654321)) != MP_OKAY) \{ - printf("Error setting the value of the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - printf("number == \%lu", mp_get_int(&number)); - - /* we're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -This should output the following if the program succeeds. - -\begin{alltt} -number == 654321 -\end{alltt} - -\subsection{Long Constants - platform dependant} - -\index{mp\_set\_long} -\begin{alltt} -int mp_set_long (mp_int * a, unsigned long b); -\end{alltt} - -This will assign the value of the platform-dependant sized variable $b$ to the mp\_int $a$. - -To get the ``unsigned long'' copy of an mp\_int the following function can be used. - -\index{mp\_get\_long} -\begin{alltt} -unsigned long mp_get_long (mp_int * a); -\end{alltt} - -This will return the least significant bits of the mp\_int $a$ that fit into an ``unsigned long''. - -\subsection{Long Long Constants} - -\index{mp\_set\_long\_long} -\begin{alltt} -int mp_set_long_long (mp_int * a, unsigned long long b); -\end{alltt} - -This will assign the value of the 64-bit variable $b$ to the mp\_int $a$. - -To get the ``unsigned long long'' copy of an mp\_int the following function can be used. - -\index{mp\_get\_long\_long} -\begin{alltt} -unsigned long long mp_get_long_long (mp_int * a); -\end{alltt} - -This will return the 64 least significant bits of the mp\_int $a$. - -\subsection{Initialize and Setting Constants} -To both initialize and set small constants the following two functions are available. -\index{mp\_init\_set} \index{mp\_init\_set\_int} -\begin{alltt} -int mp_init_set (mp_int * a, mp_digit b); -int mp_init_set_int (mp_int * a, unsigned long b); -\end{alltt} - -Both functions work like the previous counterparts except they first mp\_init $a$ before setting the values. - -\begin{alltt} -int main(void) -\{ - mp_int number1, number2; - int result; - - /* initialize and set a single digit */ - if ((result = mp_init_set(&number1, 100)) != MP_OKAY) \{ - printf("Error setting number1: \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* initialize and set a long */ - if ((result = mp_init_set_int(&number2, 1023)) != MP_OKAY) \{ - printf("Error setting number2: \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* display */ - printf("Number1, Number2 == \%lu, \%lu", - mp_get_int(&number1), mp_get_int(&number2)); - - /* clear */ - mp_clear_multi(&number1, &number2, NULL); - - return EXIT_SUCCESS; -\} -\end{alltt} - -If this program succeeds it shall output. -\begin{alltt} -Number1, Number2 == 100, 1023 -\end{alltt} - -\section{Comparisons} - -Comparisons in LibTomMath are always performed in a ``left to right'' fashion. There are three possible return codes -for any comparison. - -\index{MP\_GT} \index{MP\_EQ} \index{MP\_LT} -\begin{figure}[here] -\begin{center} -\begin{tabular}{|c|c|} -\hline \textbf{Result Code} & \textbf{Meaning} \\ -\hline MP\_GT & $a > b$ \\ -\hline MP\_EQ & $a = b$ \\ -\hline MP\_LT & $a < b$ \\ -\hline -\end{tabular} -\end{center} -\caption{Comparison Codes for $a, b$} -\label{fig:CMP} -\end{figure} - -In figure \ref{fig:CMP} two integers $a$ and $b$ are being compared. In this case $a$ is said to be ``to the left'' of -$b$. - -\subsection{Unsigned comparison} - -An unsigned comparison considers only the digits themselves and not the associated \textit{sign} flag of the -mp\_int structures. This is analogous to an absolute comparison. The function mp\_cmp\_mag() will compare two -mp\_int variables based on their digits only. - -\index{mp\_cmp\_mag} -\begin{alltt} -int mp_cmp_mag(mp_int * a, mp_int * b); -\end{alltt} -This will compare $a$ to $b$ placing $a$ to the left of $b$. This function cannot fail and will return one of the -three compare codes listed in figure \ref{fig:CMP}. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number1, number2; - int result; - - if ((result = mp_init_multi(&number1, &number2, NULL)) != MP_OKAY) \{ - printf("Error initializing the numbers. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the number1 to 5 */ - mp_set(&number1, 5); - - /* set the number2 to -6 */ - mp_set(&number2, 6); - if ((result = mp_neg(&number2, &number2)) != MP_OKAY) \{ - printf("Error negating number2. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - switch(mp_cmp_mag(&number1, &number2)) \{ - case MP_GT: printf("|number1| > |number2|"); break; - case MP_EQ: printf("|number1| = |number2|"); break; - case MP_LT: printf("|number1| < |number2|"); break; - \} - - /* we're done with it. */ - mp_clear_multi(&number1, &number2, NULL); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -If this program\footnote{This function uses the mp\_neg() function which is discussed in section \ref{sec:NEG}.} completes -successfully it should print the following. - -\begin{alltt} -|number1| < |number2| -\end{alltt} - -This is because $\vert -6 \vert = 6$ and obviously $5 < 6$. - -\subsection{Signed comparison} - -To compare two mp\_int variables based on their signed value the mp\_cmp() function is provided. - -\index{mp\_cmp} -\begin{alltt} -int mp_cmp(mp_int * a, mp_int * b); -\end{alltt} - -This will compare $a$ to the left of $b$. It will first compare the signs of the two mp\_int variables. If they -differ it will return immediately based on their signs. If the signs are equal then it will compare the digits -individually. This function will return one of the compare conditions codes listed in figure \ref{fig:CMP}. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number1, number2; - int result; - - if ((result = mp_init_multi(&number1, &number2, NULL)) != MP_OKAY) \{ - printf("Error initializing the numbers. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the number1 to 5 */ - mp_set(&number1, 5); - - /* set the number2 to -6 */ - mp_set(&number2, 6); - if ((result = mp_neg(&number2, &number2)) != MP_OKAY) \{ - printf("Error negating number2. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - switch(mp_cmp(&number1, &number2)) \{ - case MP_GT: printf("number1 > number2"); break; - case MP_EQ: printf("number1 = number2"); break; - case MP_LT: printf("number1 < number2"); break; - \} - - /* we're done with it. */ - mp_clear_multi(&number1, &number2, NULL); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -If this program\footnote{This function uses the mp\_neg() function which is discussed in section \ref{sec:NEG}.} completes -successfully it should print the following. - -\begin{alltt} -number1 > number2 -\end{alltt} - -\subsection{Single Digit} - -To compare a single digit against an mp\_int the following function has been provided. - -\index{mp\_cmp\_d} -\begin{alltt} -int mp_cmp_d(mp_int * a, mp_digit b); -\end{alltt} - -This will compare $a$ to the left of $b$ using a signed comparison. Note that it will always treat $b$ as -positive. This function is rather handy when you have to compare against small values such as $1$ (which often -comes up in cryptography). The function cannot fail and will return one of the tree compare condition codes -listed in figure \ref{fig:CMP}. - - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the number to 5 */ - mp_set(&number, 5); - - switch(mp_cmp_d(&number, 7)) \{ - case MP_GT: printf("number > 7"); break; - case MP_EQ: printf("number = 7"); break; - case MP_LT: printf("number < 7"); break; - \} - - /* we're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -If this program functions properly it will print out the following. - -\begin{alltt} -number < 7 -\end{alltt} - -\section{Logical Operations} - -Logical operations are operations that can be performed either with simple shifts or boolean operators such as -AND, XOR and OR directly. These operations are very quick. - -\subsection{Multiplication by two} - -Multiplications and divisions by any power of two can be performed with quick logical shifts either left or -right depending on the operation. - -When multiplying or dividing by two a special case routine can be used which are as follows. -\index{mp\_mul\_2} \index{mp\_div\_2} -\begin{alltt} -int mp_mul_2(mp_int * a, mp_int * b); -int mp_div_2(mp_int * a, mp_int * b); -\end{alltt} - -The former will assign twice $a$ to $b$ while the latter will assign half $a$ to $b$. These functions are fast -since the shift counts and maskes are hardcoded into the routines. - -\begin{small} \begin{alltt} -int main(void) -\{ - mp_int number; - int result; - - if ((result = mp_init(&number)) != MP_OKAY) \{ - printf("Error initializing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the number to 5 */ - mp_set(&number, 5); - - /* multiply by two */ - if ((result = mp\_mul\_2(&number, &number)) != MP_OKAY) \{ - printf("Error multiplying the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - switch(mp_cmp_d(&number, 7)) \{ - case MP_GT: printf("2*number > 7"); break; - case MP_EQ: printf("2*number = 7"); break; - case MP_LT: printf("2*number < 7"); break; - \} - - /* now divide by two */ - if ((result = mp\_div\_2(&number, &number)) != MP_OKAY) \{ - printf("Error dividing the number. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - switch(mp_cmp_d(&number, 7)) \{ - case MP_GT: printf("2*number/2 > 7"); break; - case MP_EQ: printf("2*number/2 = 7"); break; - case MP_LT: printf("2*number/2 < 7"); break; - \} - - /* we're done with it. */ - mp_clear(&number); - - return EXIT_SUCCESS; -\} -\end{alltt} \end{small} - -If this program is successful it will print out the following text. - -\begin{alltt} -2*number > 7 -2*number/2 < 7 -\end{alltt} - -Since $10 > 7$ and $5 < 7$. - -To multiply by a power of two the following function can be used. - -\index{mp\_mul\_2d} -\begin{alltt} -int mp_mul_2d(mp_int * a, int b, mp_int * c); -\end{alltt} - -This will multiply $a$ by $2^b$ and store the result in ``c''. If the value of $b$ is less than or equal to -zero the function will copy $a$ to ``c'' without performing any further actions. The multiplication itself -is implemented as a right-shift operation of $a$ by $b$ bits. - -To divide by a power of two use the following. - -\index{mp\_div\_2d} -\begin{alltt} -int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d); -\end{alltt} -Which will divide $a$ by $2^b$, store the quotient in ``c'' and the remainder in ``d'. If $b \le 0$ then the -function simply copies $a$ over to ``c'' and zeroes $d$. The variable $d$ may be passed as a \textbf{NULL} -value to signal that the remainder is not desired. The division itself is implemented as a left-shift -operation of $a$ by $b$ bits. - -\subsection{Polynomial Basis Operations} - -Strictly speaking the organization of the integers within the mp\_int structures is what is known as a -``polynomial basis''. This simply means a field element is stored by divisions of a radix. For example, if -$f(x) = \sum_{i=0}^{k} y_ix^k$ for any vector $\vec y$ then the array of digits in $\vec y$ are said to be -the polynomial basis representation of $z$ if $f(\beta) = z$ for a given radix $\beta$. - -To multiply by the polynomial $g(x) = x$ all you have todo is shift the digits of the basis left one place. The -following function provides this operation. - -\index{mp\_lshd} -\begin{alltt} -int mp_lshd (mp_int * a, int b); -\end{alltt} - -This will multiply $a$ in place by $x^b$ which is equivalent to shifting the digits left $b$ places and inserting zeroes -in the least significant digits. Similarly to divide by a power of $x$ the following function is provided. - -\index{mp\_rshd} -\begin{alltt} -void mp_rshd (mp_int * a, int b) -\end{alltt} -This will divide $a$ in place by $x^b$ and discard the remainder. This function cannot fail as it performs the operations -in place and no new digits are required to complete it. - -\subsection{AND, OR and XOR Operations} - -While AND, OR and XOR operations are not typical ``bignum functions'' they can be useful in several instances. The -three functions are prototyped as follows. - -\index{mp\_or} \index{mp\_and} \index{mp\_xor} -\begin{alltt} -int mp_or (mp_int * a, mp_int * b, mp_int * c); -int mp_and (mp_int * a, mp_int * b, mp_int * c); -int mp_xor (mp_int * a, mp_int * b, mp_int * c); -\end{alltt} - -Which compute $c = a \odot b$ where $\odot$ is one of OR, AND or XOR. - -\section{Addition and Subtraction} - -To compute an addition or subtraction the following two functions can be used. - -\index{mp\_add} \index{mp\_sub} -\begin{alltt} -int mp_add (mp_int * a, mp_int * b, mp_int * c); -int mp_sub (mp_int * a, mp_int * b, mp_int * c) -\end{alltt} - -Which perform $c = a \odot b$ where $\odot$ is one of signed addition or subtraction. The operations are fully sign -aware. - -\section{Sign Manipulation} -\subsection{Negation} -\label{sec:NEG} -Simple integer negation can be performed with the following. - -\index{mp\_neg} -\begin{alltt} -int mp_neg (mp_int * a, mp_int * b); -\end{alltt} - -Which assigns $-a$ to $b$. - -\subsection{Absolute} -Simple integer absolutes can be performed with the following. - -\index{mp\_neg} -\begin{alltt} -int mp_abs (mp_int * a, mp_int * b); -\end{alltt} - -Which assigns $\vert a \vert$ to $b$. - -\section{Integer Division and Remainder} -To perform a complete and general integer division with remainder use the following function. - -\index{mp\_div} -\begin{alltt} -int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d); -\end{alltt} - -This divides $a$ by $b$ and stores the quotient in $c$ and $d$. The signed quotient is computed such that -$bc + d = a$. Note that either of $c$ or $d$ can be set to \textbf{NULL} if their value is not required. If -$b$ is zero the function returns \textbf{MP\_VAL}. - - -\chapter{Multiplication and Squaring} -\section{Multiplication} -A full signed integer multiplication can be performed with the following. -\index{mp\_mul} -\begin{alltt} -int mp_mul (mp_int * a, mp_int * b, mp_int * c); -\end{alltt} -Which assigns the full signed product $ab$ to $c$. This function actually breaks into one of four cases which are -specific multiplication routines optimized for given parameters. First there are the Toom-Cook multiplications which -should only be used with very large inputs. This is followed by the Karatsuba multiplications which are for moderate -sized inputs. Then followed by the Comba and baseline multipliers. - -Fortunately for the developer you don't really need to know this unless you really want to fine tune the system. mp\_mul() -will determine on its own\footnote{Some tweaking may be required.} what routine to use automatically when it is called. - -\begin{alltt} -int main(void) -\{ - mp_int number1, number2; - int result; - - /* Initialize the numbers */ - if ((result = mp_init_multi(&number1, - &number2, NULL)) != MP_OKAY) \{ - printf("Error initializing the numbers. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* set the terms */ - if ((result = mp_set_int(&number, 257)) != MP_OKAY) \{ - printf("Error setting number1. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - if ((result = mp_set_int(&number2, 1023)) != MP_OKAY) \{ - printf("Error setting number2. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* multiply them */ - if ((result = mp_mul(&number1, &number2, - &number1)) != MP_OKAY) \{ - printf("Error multiplying terms. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* display */ - printf("number1 * number2 == \%lu", mp_get_int(&number1)); - - /* free terms and return */ - mp_clear_multi(&number1, &number2, NULL); - - return EXIT_SUCCESS; -\} -\end{alltt} - -If this program succeeds it shall output the following. - -\begin{alltt} -number1 * number2 == 262911 -\end{alltt} - -\section{Squaring} -Since squaring can be performed faster than multiplication it is performed it's own function instead of just using -mp\_mul(). - -\index{mp\_sqr} -\begin{alltt} -int mp_sqr (mp_int * a, mp_int * b); -\end{alltt} - -Will square $a$ and store it in $b$. Like the case of multiplication there are four different squaring -algorithms all which can be called from mp\_sqr(). It is ideal to use mp\_sqr over mp\_mul when squaring terms because -of the speed difference. - -\section{Tuning Polynomial Basis Routines} - -Both of the Toom-Cook and Karatsuba multiplication algorithms are faster than the traditional $O(n^2)$ approach that -the Comba and baseline algorithms use. At $O(n^{1.464973})$ and $O(n^{1.584962})$ running times respectively they require -considerably less work. For example, a 10000-digit multiplication would take roughly 724,000 single precision -multiplications with Toom-Cook or 100,000,000 single precision multiplications with the standard Comba (a factor -of 138). - -So why not always use Karatsuba or Toom-Cook? The simple answer is that they have so much overhead that they're not -actually faster than Comba until you hit distinct ``cutoff'' points. For Karatsuba with the default configuration, -GCC 3.3.1 and an Athlon XP processor the cutoff point is roughly 110 digits (about 70 for the Intel P4). That is, at -110 digits Karatsuba and Comba multiplications just about break even and for 110+ digits Karatsuba is faster. - -Toom-Cook has incredible overhead and is probably only useful for very large inputs. So far no known cutoff points -exist and for the most part I just set the cutoff points very high to make sure they're not called. - -A demo program in the ``etc/'' directory of the project called ``tune.c'' can be used to find the cutoff points. This -can be built with GCC as follows - -\begin{alltt} -make XXX -\end{alltt} -Where ``XXX'' is one of the following entries from the table \ref{fig:tuning}. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|l|l|} -\hline \textbf{Value of XXX} & \textbf{Meaning} \\ -\hline tune & Builds portable tuning application \\ -\hline tune86 & Builds x86 (pentium and up) program for COFF \\ -\hline tune86c & Builds x86 program for Cygwin \\ -\hline tune86l & Builds x86 program for Linux (ELF format) \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Build Names for Tuning Programs} -\label{fig:tuning} -\end{figure} - -When the program is running it will output a series of measurements for different cutoff points. It will first find -good Karatsuba squaring and multiplication points. Then it proceeds to find Toom-Cook points. Note that the Toom-Cook -tuning takes a very long time as the cutoff points are likely to be very high. - -\chapter{Modular Reduction} - -Modular reduction is process of taking the remainder of one quantity divided by another. Expressed -as (\ref{eqn:mod}) the modular reduction is equivalent to the remainder of $b$ divided by $c$. - -\begin{equation} -a \equiv b \mbox{ (mod }c\mbox{)} -\label{eqn:mod} -\end{equation} - -Of particular interest to cryptography are reductions where $b$ is limited to the range $0 \le b < c^2$ since particularly -fast reduction algorithms can be written for the limited range. - -Note that one of the four optimized reduction algorithms are automatically chosen in the modular exponentiation -algorithm mp\_exptmod when an appropriate modulus is detected. - -\section{Straight Division} -In order to effect an arbitrary modular reduction the following algorithm is provided. - -\index{mp\_mod} -\begin{alltt} -int mp_mod(mp_int *a, mp_int *b, mp_int *c); -\end{alltt} - -This reduces $a$ modulo $b$ and stores the result in $c$. The sign of $c$ shall agree with the sign -of $b$. This algorithm accepts an input $a$ of any range and is not limited by $0 \le a < b^2$. - -\section{Barrett Reduction} - -Barrett reduction is a generic optimized reduction algorithm that requires pre--computation to achieve -a decent speedup over straight division. First a $\mu$ value must be precomputed with the following function. - -\index{mp\_reduce\_setup} -\begin{alltt} -int mp_reduce_setup(mp_int *a, mp_int *b); -\end{alltt} - -Given a modulus in $b$ this produces the required $\mu$ value in $a$. For any given modulus this only has to -be computed once. Modular reduction can now be performed with the following. - -\index{mp\_reduce} -\begin{alltt} -int mp_reduce(mp_int *a, mp_int *b, mp_int *c); -\end{alltt} - -This will reduce $a$ in place modulo $b$ with the precomputed $\mu$ value in $c$. $a$ must be in the range -$0 \le a < b^2$. - -\begin{alltt} -int main(void) -\{ - mp_int a, b, c, mu; - int result; - - /* initialize a,b to desired values, mp_init mu, - * c and set c to 1...we want to compute a^3 mod b - */ - - /* get mu value */ - if ((result = mp_reduce_setup(&mu, b)) != MP_OKAY) \{ - printf("Error getting mu. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* square a to get c = a^2 */ - if ((result = mp_sqr(&a, &c)) != MP_OKAY) \{ - printf("Error squaring. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* now reduce `c' modulo b */ - if ((result = mp_reduce(&c, &b, &mu)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* multiply a to get c = a^3 */ - if ((result = mp_mul(&a, &c, &c)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* now reduce `c' modulo b */ - if ((result = mp_reduce(&c, &b, &mu)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* c now equals a^3 mod b */ - - return EXIT_SUCCESS; -\} -\end{alltt} - -This program will calculate $a^3 \mbox{ mod }b$ if all the functions succeed. - -\section{Montgomery Reduction} - -Montgomery is a specialized reduction algorithm for any odd moduli. Like Barrett reduction a pre--computation -step is required. This is accomplished with the following. - -\index{mp\_montgomery\_setup} -\begin{alltt} -int mp_montgomery_setup(mp_int *a, mp_digit *mp); -\end{alltt} - -For the given odd moduli $a$ the precomputation value is placed in $mp$. The reduction is computed with the -following. - -\index{mp\_montgomery\_reduce} -\begin{alltt} -int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); -\end{alltt} -This reduces $a$ in place modulo $m$ with the pre--computed value $mp$. $a$ must be in the range -$0 \le a < b^2$. - -Montgomery reduction is faster than Barrett reduction for moduli smaller than the ``comba'' limit. With the default -setup for instance, the limit is $127$ digits ($3556$--bits). Note that this function is not limited to -$127$ digits just that it falls back to a baseline algorithm after that point. - -An important observation is that this reduction does not return $a \mbox{ mod }m$ but $aR^{-1} \mbox{ mod }m$ -where $R = \beta^n$, $n$ is the n number of digits in $m$ and $\beta$ is radix used (default is $2^{28}$). - -To quickly calculate $R$ the following function was provided. - -\index{mp\_montgomery\_calc\_normalization} -\begin{alltt} -int mp_montgomery_calc_normalization(mp_int *a, mp_int *b); -\end{alltt} -Which calculates $a = R$ for the odd moduli $b$ without using multiplication or division. - -The normal modus operandi for Montgomery reductions is to normalize the integers before entering the system. For -example, to calculate $a^3 \mbox { mod }b$ using Montgomery reduction the value of $a$ can be normalized by -multiplying it by $R$. Consider the following code snippet. - -\begin{alltt} -int main(void) -\{ - mp_int a, b, c, R; - mp_digit mp; - int result; - - /* initialize a,b to desired values, - * mp_init R, c and set c to 1.... - */ - - /* get normalization */ - if ((result = mp_montgomery_calc_normalization(&R, b)) != MP_OKAY) \{ - printf("Error getting norm. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* get mp value */ - if ((result = mp_montgomery_setup(&c, &mp)) != MP_OKAY) \{ - printf("Error setting up montgomery. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* normalize `a' so now a is equal to aR */ - if ((result = mp_mulmod(&a, &R, &b, &a)) != MP_OKAY) \{ - printf("Error computing aR. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* square a to get c = a^2R^2 */ - if ((result = mp_sqr(&a, &c)) != MP_OKAY) \{ - printf("Error squaring. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* now reduce `c' back down to c = a^2R^2 * R^-1 == a^2R */ - if ((result = mp_montgomery_reduce(&c, &b, mp)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* multiply a to get c = a^3R^2 */ - if ((result = mp_mul(&a, &c, &c)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* now reduce `c' back down to c = a^3R^2 * R^-1 == a^3R */ - if ((result = mp_montgomery_reduce(&c, &b, mp)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* now reduce (again) `c' back down to c = a^3R * R^-1 == a^3 */ - if ((result = mp_montgomery_reduce(&c, &b, mp)) != MP_OKAY) \{ - printf("Error reducing. \%s", - mp_error_to_string(result)); - return EXIT_FAILURE; - \} - - /* c now equals a^3 mod b */ - - return EXIT_SUCCESS; -\} -\end{alltt} - -This particular example does not look too efficient but it demonstrates the point of the algorithm. By -normalizing the inputs the reduced results are always of the form $aR$ for some variable $a$. This allows -a single final reduction to correct for the normalization and the fast reduction used within the algorithm. - -For more details consider examining the file \textit{bn\_mp\_exptmod\_fast.c}. - -\section{Restricted Dimminished Radix} - -``Dimminished Radix'' reduction refers to reduction with respect to moduli that are ameniable to simple -digit shifting and small multiplications. In this case the ``restricted'' variant refers to moduli of the -form $\beta^k - p$ for some $k \ge 0$ and $0 < p < \beta$ where $\beta$ is the radix (default to $2^{28}$). - -As in the case of Montgomery reduction there is a pre--computation phase required for a given modulus. - -\index{mp\_dr\_setup} -\begin{alltt} -void mp_dr_setup(mp_int *a, mp_digit *d); -\end{alltt} - -This computes the value required for the modulus $a$ and stores it in $d$. This function cannot fail -and does not return any error codes. After the pre--computation a reduction can be performed with the -following. - -\index{mp\_dr\_reduce} -\begin{alltt} -int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp); -\end{alltt} - -This reduces $a$ in place modulo $b$ with the pre--computed value $mp$. $b$ must be of a restricted -dimminished radix form and $a$ must be in the range $0 \le a < b^2$. Dimminished radix reductions are -much faster than both Barrett and Montgomery reductions as they have a much lower asymtotic running time. - -Since the moduli are restricted this algorithm is not particularly useful for something like Rabin, RSA or -BBS cryptographic purposes. This reduction algorithm is useful for Diffie-Hellman and ECC where fixed -primes are acceptable. - -Note that unlike Montgomery reduction there is no normalization process. The result of this function is -equal to the correct residue. - -\section{Unrestricted Dimminshed Radix} - -Unrestricted reductions work much like the restricted counterparts except in this case the moduli is of the -form $2^k - p$ for $0 < p < \beta$. In this sense the unrestricted reductions are more flexible as they -can be applied to a wider range of numbers. - -\index{mp\_reduce\_2k\_setup} -\begin{alltt} -int mp_reduce_2k_setup(mp_int *a, mp_digit *d); -\end{alltt} - -This will compute the required $d$ value for the given moduli $a$. - -\index{mp\_reduce\_2k} -\begin{alltt} -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d); -\end{alltt} - -This will reduce $a$ in place modulo $n$ with the pre--computed value $d$. From my experience this routine is -slower than mp\_dr\_reduce but faster for most moduli sizes than the Montgomery reduction. - -\chapter{Exponentiation} -\section{Single Digit Exponentiation} -\index{mp\_expt\_d\_ex} -\begin{alltt} -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) -\end{alltt} -This function computes $c = a^b$. - -With parameter \textit{fast} set to $0$ the old version of the algorithm is used, -when \textit{fast} is $1$, a faster but not statically timed version of the algorithm is used. - -The old version uses a simple binary left-to-right algorithm. -It is faster than repeated multiplications by $a$ for all values of $b$ greater than three. - -The new version uses a binary right-to-left algorithm. - -The difference between the old and the new version is that the old version always -executes $DIGIT\_BIT$ iterations. The new algorithm executes only $n$ iterations -where $n$ is equal to the position of the highest bit that is set in $b$. - -\index{mp\_expt\_d} -\begin{alltt} -int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) -\end{alltt} -mp\_expt\_d(a, b, c) is a wrapper function to mp\_expt\_d\_ex(a, b, c, 0). - -\section{Modular Exponentiation} -\index{mp\_exptmod} -\begin{alltt} -int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) -\end{alltt} -This computes $Y \equiv G^X \mbox{ (mod }P\mbox{)}$ using a variable width sliding window algorithm. This function -will automatically detect the fastest modular reduction technique to use during the operation. For negative values of -$X$ the operation is performed as $Y \equiv (G^{-1} \mbox{ mod }P)^{\vert X \vert} \mbox{ (mod }P\mbox{)}$ provided that -$gcd(G, P) = 1$. - -This function is actually a shell around the two internal exponentiation functions. This routine will automatically -detect when Barrett, Montgomery, Restricted and Unrestricted Dimminished Radix based exponentiation can be used. Generally -moduli of the a ``restricted dimminished radix'' form lead to the fastest modular exponentiations. Followed by Montgomery -and the other two algorithms. - -\section{Root Finding} -\index{mp\_n\_root} -\begin{alltt} -int mp_n_root (mp_int * a, mp_digit b, mp_int * c) -\end{alltt} -This computes $c = a^{1/b}$ such that $c^b \le a$ and $(c+1)^b > a$. The implementation of this function is not -ideal for values of $b$ greater than three. It will work but become very slow. So unless you are working with very small -numbers (less than 1000 bits) I'd avoid $b > 3$ situations. Will return a positive root only for even roots and return -a root with the sign of the input for odd roots. For example, performing $4^{1/2}$ will return $2$ whereas $(-8)^{1/3}$ -will return $-2$. - -This algorithm uses the ``Newton Approximation'' method and will converge on the correct root fairly quickly. Since -the algorithm requires raising $a$ to the power of $b$ it is not ideal to attempt to find roots for large -values of $b$. If particularly large roots are required then a factor method could be used instead. For example, -$a^{1/16}$ is equivalent to $\left (a^{1/4} \right)^{1/4}$ or simply -$\left ( \left ( \left ( a^{1/2} \right )^{1/2} \right )^{1/2} \right )^{1/2}$ - -\chapter{Prime Numbers} -\section{Trial Division} -\index{mp\_prime\_is\_divisible} -\begin{alltt} -int mp_prime_is_divisible (mp_int * a, int *result) -\end{alltt} -This will attempt to evenly divide $a$ by a list of primes\footnote{Default is the first 256 primes.} and store the -outcome in ``result''. That is if $result = 0$ then $a$ is not divisible by the primes, otherwise it is. Note that -if the function does not return \textbf{MP\_OKAY} the value in ``result'' should be considered undefined\footnote{Currently -the default is to set it to zero first.}. - -\section{Fermat Test} -\index{mp\_prime\_fermat} -\begin{alltt} -int mp_prime_fermat (mp_int * a, mp_int * b, int *result) -\end{alltt} -Performs a Fermat primality test to the base $b$. That is it computes $b^a \mbox{ mod }a$ and tests whether the value is -equal to $b$ or not. If the values are equal then $a$ is probably prime and $result$ is set to one. Otherwise $result$ -is set to zero. - -\section{Miller-Rabin Test} -\index{mp\_prime\_miller\_rabin} -\begin{alltt} -int mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result) -\end{alltt} -Performs a Miller-Rabin test to the base $b$ of $a$. This test is much stronger than the Fermat test and is very hard to -fool (besides with Carmichael numbers). If $a$ passes the test (therefore is probably prime) $result$ is set to one. -Otherwise $result$ is set to zero. - -Note that is suggested that you use the Miller-Rabin test instead of the Fermat test since all of the failures of -Miller-Rabin are a subset of the failures of the Fermat test. - -\subsection{Required Number of Tests} -Generally to ensure a number is very likely to be prime you have to perform the Miller-Rabin with at least a half-dozen -or so unique bases. However, it has been proven that the probability of failure goes down as the size of the input goes up. -This is why a simple function has been provided to help out. - -\index{mp\_prime\_rabin\_miller\_trials} -\begin{alltt} -int mp_prime_rabin_miller_trials(int size) -\end{alltt} -This returns the number of trials required for a $2^{-96}$ (or lower) probability of failure for a given ``size'' expressed -in bits. This comes in handy specially since larger numbers are slower to test. For example, a 512-bit number would -require ten tests whereas a 1024-bit number would only require four tests. - -You should always still perform a trial division before a Miller-Rabin test though. - -\section{Primality Testing} -\index{mp\_prime\_is\_prime} -\begin{alltt} -int mp_prime_is_prime (mp_int * a, int t, int *result) -\end{alltt} -This will perform a trial division followed by $t$ rounds of Miller-Rabin tests on $a$ and store the result in $result$. -If $a$ passes all of the tests $result$ is set to one, otherwise it is set to zero. Note that $t$ is bounded by -$1 \le t < PRIME\_SIZE$ where $PRIME\_SIZE$ is the number of primes in the prime number table (by default this is $256$). - -\section{Next Prime} -\index{mp\_prime\_next\_prime} -\begin{alltt} -int mp_prime_next_prime(mp_int *a, int t, int bbs_style) -\end{alltt} -This finds the next prime after $a$ that passes mp\_prime\_is\_prime() with $t$ tests. Set $bbs\_style$ to one if you -want only the next prime congruent to $3 \mbox{ mod } 4$, otherwise set it to zero to find any next prime. - -\section{Random Primes} -\index{mp\_prime\_random} -\begin{alltt} -int mp_prime_random(mp_int *a, int t, int size, int bbs, - ltm_prime_callback cb, void *dat) -\end{alltt} -This will find a prime greater than $256^{size}$ which can be ``bbs\_style'' or not depending on $bbs$ and must pass -$t$ rounds of tests. The ``ltm\_prime\_callback'' is a typedef for - -\begin{alltt} -typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat); -\end{alltt} - -Which is a function that must read $len$ bytes (and return the amount stored) into $dst$. The $dat$ variable is simply -copied from the original input. It can be used to pass RNG context data to the callback. The function -mp\_prime\_random() is more suitable for generating primes which must be secret (as in the case of RSA) since there -is no skew on the least significant bits. - -\textit{Note:} As of v0.30 of the LibTomMath library this function has been deprecated. It is still available -but users are encouraged to use the new mp\_prime\_random\_ex() function instead. - -\subsection{Extended Generation} -\index{mp\_prime\_random\_ex} -\begin{alltt} -int mp_prime_random_ex(mp_int *a, int t, - int size, int flags, - ltm_prime_callback cb, void *dat); -\end{alltt} -This will generate a prime in $a$ using $t$ tests of the primality testing algorithms. The variable $size$ -specifies the bit length of the prime desired. The variable $flags$ specifies one of several options available -(see fig. \ref{fig:primeopts}) which can be OR'ed together. The callback parameters are used as in -mp\_prime\_random(). - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|r|l|} -\hline \textbf{Flag} & \textbf{Meaning} \\ -\hline LTM\_PRIME\_BBS & Make the prime congruent to $3$ modulo $4$ \\ -\hline LTM\_PRIME\_SAFE & Make a prime $p$ such that $(p - 1)/2$ is also prime. \\ - & This option implies LTM\_PRIME\_BBS as well. \\ -\hline LTM\_PRIME\_2MSB\_OFF & Makes sure that the bit adjacent to the most significant bit \\ - & Is forced to zero. \\ -\hline LTM\_PRIME\_2MSB\_ON & Makes sure that the bit adjacent to the most significant bit \\ - & Is forced to one. \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Primality Generation Options} -\label{fig:primeopts} -\end{figure} - -\chapter{Input and Output} -\section{ASCII Conversions} -\subsection{To ASCII} -\index{mp\_toradix} -\begin{alltt} -int mp_toradix (mp_int * a, char *str, int radix); -\end{alltt} -This still store $a$ in ``str'' as a base-``radix'' string of ASCII chars. This function appends a NUL character -to terminate the string. Valid values of ``radix'' line in the range $[2, 64]$. To determine the size (exact) required -by the conversion before storing any data use the following function. - -\index{mp\_radix\_size} -\begin{alltt} -int mp_radix_size (mp_int * a, int radix, int *size) -\end{alltt} -This stores in ``size'' the number of characters (including space for the NUL terminator) required. Upon error this -function returns an error code and ``size'' will be zero. - -\subsection{From ASCII} -\index{mp\_read\_radix} -\begin{alltt} -int mp_read_radix (mp_int * a, char *str, int radix); -\end{alltt} -This will read the base-``radix'' NUL terminated string from ``str'' into $a$. It will stop reading when it reads a -character it does not recognize (which happens to include th NUL char... imagine that...). A single leading $-$ sign -can be used to denote a negative number. - -\section{Binary Conversions} - -Converting an mp\_int to and from binary is another keen idea. - -\index{mp\_unsigned\_bin\_size} -\begin{alltt} -int mp_unsigned_bin_size(mp_int *a); -\end{alltt} - -This will return the number of bytes (octets) required to store the unsigned copy of the integer $a$. - -\index{mp\_to\_unsigned\_bin} -\begin{alltt} -int mp_to_unsigned_bin(mp_int *a, unsigned char *b); -\end{alltt} -This will store $a$ into the buffer $b$ in big--endian format. Fortunately this is exactly what DER (or is it ASN?) -requires. It does not store the sign of the integer. - -\index{mp\_read\_unsigned\_bin} -\begin{alltt} -int mp_read_unsigned_bin(mp_int *a, unsigned char *b, int c); -\end{alltt} -This will read in an unsigned big--endian array of bytes (octets) from $b$ of length $c$ into $a$. The resulting -integer $a$ will always be positive. - -For those who acknowledge the existence of negative numbers (heretic!) there are ``signed'' versions of the -previous functions. - -\begin{alltt} -int mp_signed_bin_size(mp_int *a); -int mp_read_signed_bin(mp_int *a, unsigned char *b, int c); -int mp_to_signed_bin(mp_int *a, unsigned char *b); -\end{alltt} -They operate essentially the same as the unsigned copies except they prefix the data with zero or non--zero -byte depending on the sign. If the sign is zpos (e.g. not negative) the prefix is zero, otherwise the prefix -is non--zero. - -\chapter{Algebraic Functions} -\section{Extended Euclidean Algorithm} -\index{mp\_exteuclid} -\begin{alltt} -int mp_exteuclid(mp_int *a, mp_int *b, - mp_int *U1, mp_int *U2, mp_int *U3); -\end{alltt} - -This finds the triple U1/U2/U3 using the Extended Euclidean algorithm such that the following equation holds. - -\begin{equation} -a \cdot U1 + b \cdot U2 = U3 -\end{equation} - -Any of the U1/U2/U3 paramters can be set to \textbf{NULL} if they are not desired. - -\section{Greatest Common Divisor} -\index{mp\_gcd} -\begin{alltt} -int mp_gcd (mp_int * a, mp_int * b, mp_int * c) -\end{alltt} -This will compute the greatest common divisor of $a$ and $b$ and store it in $c$. - -\section{Least Common Multiple} -\index{mp\_lcm} -\begin{alltt} -int mp_lcm (mp_int * a, mp_int * b, mp_int * c) -\end{alltt} -This will compute the least common multiple of $a$ and $b$ and store it in $c$. - -\section{Jacobi Symbol} -\index{mp\_jacobi} -\begin{alltt} -int mp_jacobi (mp_int * a, mp_int * p, int *c) -\end{alltt} -This will compute the Jacobi symbol for $a$ with respect to $p$. If $p$ is prime this essentially computes the Legendre -symbol. The result is stored in $c$ and can take on one of three values $\lbrace -1, 0, 1 \rbrace$. If $p$ is prime -then the result will be $-1$ when $a$ is not a quadratic residue modulo $p$. The result will be $0$ if $a$ divides $p$ -and the result will be $1$ if $a$ is a quadratic residue modulo $p$. - -\section{Modular square root} -\index{mp\_sqrtmod\_prime} -\begin{alltt} -int mp_sqrtmod_prime(mp_int *n, mp_int *p, mp_int *r) -\end{alltt} - -This will solve the modular equatioon $r^2 = n \mod p$ where $p$ is a prime number greater than 2 (odd prime). -The result is returned in the third argument $r$, the function returns \textbf{MP\_OKAY} on success, -other return values indicate failure. - -The implementation is split for two different cases: - -1. if $p \mod 4 == 3$ we apply \href{http://cacr.uwaterloo.ca/hac/}{Handbook of Applied Cryptography algorithm 3.36} and compute $r$ directly as -$r = n^{(p+1)/4} \mod p$ - -2. otherwise we use \href{https://en.wikipedia.org/wiki/Tonelli-Shanks_algorithm}{Tonelli-Shanks algorithm} - -The function does not check the primality of parameter $p$ thus it is up to the caller to assure that this parameter -is a prime number. When $p$ is a composite the function behaviour is undefined, it may even return a false-positive -\textbf{MP\_OKAY}. - -\section{Modular Inverse} -\index{mp\_invmod} -\begin{alltt} -int mp_invmod (mp_int * a, mp_int * b, mp_int * c) -\end{alltt} -Computes the multiplicative inverse of $a$ modulo $b$ and stores the result in $c$ such that $ac \equiv 1 \mbox{ (mod }b\mbox{)}$. - -\section{Single Digit Functions} - -For those using small numbers (\textit{snicker snicker}) there are several ``helper'' functions - -\index{mp\_add\_d} \index{mp\_sub\_d} \index{mp\_mul\_d} \index{mp\_div\_d} \index{mp\_mod\_d} -\begin{alltt} -int mp_add_d(mp_int *a, mp_digit b, mp_int *c); -int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); -int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); -int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d); -int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); -\end{alltt} - -These work like the full mp\_int capable variants except the second parameter $b$ is a mp\_digit. These -functions fairly handy if you have to work with relatively small numbers since you will not have to allocate -an entire mp\_int to store a number like $1$ or $2$. - -\input{bn.ind} - -\end{document} diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index 03384e3..a4d1c8a 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -71,7 +71,13 @@ int mp_read_radix (mp_int * a, const char *str, int radix) } ++str; } - + + /* if an illegal character was found, fail. */ + if (!(*str == '\0' || *str == '\r' || *str == '\n')) { + mp_zero(a); + return MP_VAL; + } + /* set the sign only if a != 0 */ if (mp_iszero(a) != MP_YES) { a->sign = neg; diff --git a/libtommath/booker.pl b/libtommath/booker.pl deleted file mode 100644 index c2abae6..0000000 --- a/libtommath/booker.pl +++ /dev/null @@ -1,267 +0,0 @@ -#!/bin/perl -# -#Used to prepare the book "tommath.src" for LaTeX by pre-processing it into a .tex file -# -#Essentially you write the "tommath.src" as normal LaTex except where you want code snippets you put -# -#EXAM,file -# -#This preprocessor will then open "file" and insert it as a verbatim copy. -# -#Tom St Denis - -#get graphics type -if (shift =~ /PDF/) { - $graph = ""; -} else { - $graph = ".ps"; -} - -open(IN,"tommath.tex") or die "Can't open destination file"; - -print "Scanning for sections\n"; -$chapter = $section = $subsection = 0; -$x = 0; -while () { - print "."; - if (!(++$x % 80)) { print "\n"; } - #update the headings - if (~($_ =~ /\*/)) { - if ($_ =~ /\\chapter\{.+}/) { - ++$chapter; - $section = $subsection = 0; - } elsif ($_ =~ /\\section\{.+}/) { - ++$section; - $subsection = 0; - } elsif ($_ =~ /\\subsection\{.+}/) { - ++$subsection; - } - } - - if ($_ =~ m/MARK/) { - @m = split(",",$_); - chomp(@m[1]); - $index1{@m[1]} = $chapter; - $index2{@m[1]} = $section; - $index3{@m[1]} = $subsection; - } -} -close(IN); - -open(IN,") { - ++$readline; - ++$srcline; - - if ($_ =~ m/MARK/) { - } elsif ($_ =~ m/EXAM/ || $_ =~ m/LIST/) { - if ($_ =~ m/EXAM/) { - $skipheader = 1; - } else { - $skipheader = 0; - } - - # EXAM,file - chomp($_); - @m = split(",",$_); - open(SRC,"<$m[1]") or die "Error:$srcline:Can't open source file $m[1]"; - - print "$srcline:Inserting $m[1]:"; - - $line = 0; - $tmp = $m[1]; - $tmp =~ s/_/"\\_"/ge; - print OUT "\\vspace{+3mm}\\begin{small}\n\\hspace{-5.1mm}{\\bf File}: $tmp\n\\vspace{-3mm}\n\\begin{alltt}\n"; - $wroteline += 5; - - if ($skipheader == 1) { - # scan till next end of comment, e.g. skip license - while () { - $text[$line++] = $_; - last if ($_ =~ /libtom\.org/); - } - ; - } - - $inline = 0; - while () { - next if ($_ =~ /\$Source/); - next if ($_ =~ /\$Revision/); - next if ($_ =~ /\$Date/); - $text[$line++] = $_; - ++$inline; - chomp($_); - $_ =~ s/\t/" "/ge; - $_ =~ s/{/"^{"/ge; - $_ =~ s/}/"^}"/ge; - $_ =~ s/\\/'\symbol{92}'/ge; - $_ =~ s/\^/"\\"/ge; - - printf OUT ("%03d ", $line); - for ($x = 0; $x < length($_); $x++) { - print OUT chr(vec($_, $x, 8)); - if ($x == 75) { - print OUT "\n "; - ++$wroteline; - } - } - print OUT "\n"; - ++$wroteline; - } - $totlines = $line; - print OUT "\\end{alltt}\n\\end{small}\n"; - close(SRC); - print "$inline lines\n"; - $wroteline += 2; - } elsif ($_ =~ m/@\d+,.+@/) { - # line contains [number,text] - # e.g. @14,for (ix = 0)@ - $txt = $_; - while ($txt =~ m/@\d+,.+@/) { - @m = split("@",$txt); # splits into text, one, two - @parms = split(",",$m[1]); # splits one,two into two elements - - # now search from $parms[0] down for $parms[1] - $found1 = 0; - $found2 = 0; - for ($i = $parms[0]; $i < $totlines && $found1 == 0; $i++) { - if ($text[$i] =~ m/\Q$parms[1]\E/) { - $foundline1 = $i + 1; - $found1 = 1; - } - } - - # now search backwards - for ($i = $parms[0] - 1; $i >= 0 && $found2 == 0; $i--) { - if ($text[$i] =~ m/\Q$parms[1]\E/) { - $foundline2 = $i + 1; - $found2 = 1; - } - } - - # now use the closest match or the first if tied - if ($found1 == 1 && $found2 == 0) { - $found = 1; - $foundline = $foundline1; - } elsif ($found1 == 0 && $found2 == 1) { - $found = 1; - $foundline = $foundline2; - } elsif ($found1 == 1 && $found2 == 1) { - $found = 1; - if (($foundline1 - $parms[0]) <= ($parms[0] - $foundline2)) { - $foundline = $foundline1; - } else { - $foundline = $foundline2; - } - } else { - $found = 0; - } - - # if found replace - if ($found == 1) { - $delta = $parms[0] - $foundline; - print "Found replacement tag for \"$parms[1]\" on line $srcline which refers to line $foundline (delta $delta)\n"; - $_ =~ s/@\Q$m[1]\E@/$foundline/; - } else { - print "ERROR: The tag \"$parms[1]\" on line $srcline was not found in the most recently parsed source!\n"; - } - - # remake the rest of the line - $cnt = @m; - $txt = ""; - for ($i = 2; $i < $cnt; $i++) { - $txt = $txt . $m[$i] . "@"; - } - } - print OUT $_; - ++$wroteline; - } elsif ($_ =~ /~.+~/) { - # line contains a ~text~ pair used to refer to indexing :-) - $txt = $_; - while ($txt =~ /~.+~/) { - @m = split("~", $txt); - - # word is the second position - $word = @m[1]; - $a = $index1{$word}; - $b = $index2{$word}; - $c = $index3{$word}; - - # if chapter (a) is zero it wasn't found - if ($a == 0) { - print "ERROR: the tag \"$word\" on line $srcline was not found previously marked.\n"; - } else { - # format the tag as x, x.y or x.y.z depending on the values - $str = $a; - $str = $str . ".$b" if ($b != 0); - $str = $str . ".$c" if ($c != 0); - - if ($b == 0 && $c == 0) { - # its a chapter - if ($a <= 10) { - if ($a == 1) { - $str = "chapter one"; - } elsif ($a == 2) { - $str = "chapter two"; - } elsif ($a == 3) { - $str = "chapter three"; - } elsif ($a == 4) { - $str = "chapter four"; - } elsif ($a == 5) { - $str = "chapter five"; - } elsif ($a == 6) { - $str = "chapter six"; - } elsif ($a == 7) { - $str = "chapter seven"; - } elsif ($a == 8) { - $str = "chapter eight"; - } elsif ($a == 9) { - $str = "chapter nine"; - } elsif ($a == 10) { - $str = "chapter ten"; - } - } else { - $str = "chapter " . $str; - } - } else { - $str = "section " . $str if ($b != 0 && $c == 0); - $str = "sub-section " . $str if ($b != 0 && $c != 0); - } - - #substitute - $_ =~ s/~\Q$word\E~/$str/; - - print "Found replacement tag for marker \"$word\" on line $srcline which refers to $str\n"; - } - - # remake rest of the line - $cnt = @m; - $txt = ""; - for ($i = 2; $i < $cnt; $i++) { - $txt = $txt . $m[$i] . "~"; - } - } - print OUT $_; - ++$wroteline; - } elsif ($_ =~ m/FIGU/) { - # FIGU,file,caption - chomp($_); - @m = split(",", $_); - print OUT "\\begin{center}\n\\begin{figure}[here]\n\\includegraphics{pics/$m[1]$graph}\n"; - print OUT "\\caption{$m[2]}\n\\label{pic:$m[1]}\n\\end{figure}\n\\end{center}\n"; - $wroteline += 4; - } else { - print OUT $_; - ++$wroteline; - } -} -print "Read $readline lines, wrote $wroteline lines\n"; - -close (OUT); -close (IN); - -system('perl -pli -e "s/\s*$//" tommath.tex'); diff --git a/libtommath/changes.txt b/libtommath/changes.txt index 3379f71..51da801 100644 --- a/libtommath/changes.txt +++ b/libtommath/changes.txt @@ -1,4 +1,4 @@ -XXX, 2017 +Aug 29th, 2017 v1.0.1 -- Dmitry Kovalenko provided fixes to mp_add_d() and mp_init_copy() -- Matt Johnston contributed some improvements to mp_div_2d(), diff --git a/libtommath/demo/demo.c b/libtommath/demo/demo.c deleted file mode 100644 index b46b7f8..0000000 --- a/libtommath/demo/demo.c +++ /dev/null @@ -1,986 +0,0 @@ -#include -#include - -#ifdef IOWNANATHLON -#include -#define SLEEP sleep(4) -#else -#define SLEEP -#endif - -/* - * Configuration - */ -#ifndef LTM_DEMO_TEST_VS_MTEST -#define LTM_DEMO_TEST_VS_MTEST 1 -#endif - -#ifndef LTM_DEMO_TEST_REDUCE_2K_L -/* This test takes a moment so we disable it by default, but it can be: - * 0 to disable testing - * 1 to make the test with P = 2^1024 - 0x2A434 B9FDEC95 D8F9D550 FFFFFFFF FFFFFFFF - * 2 to make the test with P = 2^2048 - 0x1 00000000 00000000 00000000 00000000 4945DDBF 8EA2A91D 5776399B B83E188F - */ -#define LTM_DEMO_TEST_REDUCE_2K_L 0 -#endif - -#ifdef LTM_DEMO_REAL_RAND -#define LTM_DEMO_RAND_SEED time(NULL) -#else -#define LTM_DEMO_RAND_SEED 23 -#endif - -#include "tommath.h" - -void ndraw(mp_int * a, char *name) -{ - char buf[16000]; - - printf("%s: ", name); - mp_toradix(a, buf, 10); - printf("%s\n", buf); - mp_toradix(a, buf, 16); - printf("0x%s\n", buf); -} - -#if LTM_DEMO_TEST_VS_MTEST -static void draw(mp_int * a) -{ - ndraw(a, ""); -} -#endif - - -unsigned long lfsr = 0xAAAAAAAAUL; - -int lbit(void) -{ - if (lfsr & 0x80000000UL) { - lfsr = ((lfsr << 1) ^ 0x8000001BUL) & 0xFFFFFFFFUL; - return 1; - } else { - lfsr <<= 1; - return 0; - } -} - -#if defined(LTM_DEMO_REAL_RAND) && !defined(_WIN32) -static FILE* fd_urandom; -#endif -int myrng(unsigned char *dst, int len, void *dat) -{ - int x; - (void)dat; -#if defined(LTM_DEMO_REAL_RAND) - if (!fd_urandom) { -#if !defined(_WIN32) - fprintf(stderr, "\nno /dev/urandom\n"); -#endif - } - else { - return fread(dst, 1, len, fd_urandom); - } -#endif - for (x = 0; x < len; ) { - unsigned int r = (unsigned int)rand(); - do { - dst[x++] = r & 0xFF; - r >>= 8; - } while((r != 0) && (x < len)); - } - return len; -} - -#if LTM_DEMO_TEST_VS_MTEST != 0 -static void _panic(int l) -{ - fprintf(stderr, "\n%d: fgets failed\n", l); - exit(EXIT_FAILURE); -} -#endif - -mp_int a, b, c, d, e, f; - -static void _cleanup(void) -{ - mp_clear_multi(&a, &b, &c, &d, &e, &f, NULL); - printf("\n"); - -#ifdef LTM_DEMO_REAL_RAND - if(fd_urandom) - fclose(fd_urandom); -#endif -} -struct mp_sqrtmod_prime_st { - unsigned long p; - unsigned long n; - mp_digit r; -}; -struct mp_sqrtmod_prime_st sqrtmod_prime[] = { - { 5, 14, 3 }, - { 7, 9, 4 }, - { 113, 2, 62 } -}; -struct mp_jacobi_st { - unsigned long n; - int c[16]; -}; -struct mp_jacobi_st jacobi[] = { - { 3, { 1, -1, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0, 1, -1, 0, 1 } }, - { 5, { 0, 1, -1, -1, 1, 0, 1, -1, -1, 1, 0, 1, -1, -1, 1, 0 } }, - { 7, { 1, -1, 1, -1, -1, 0, 1, 1, -1, 1, -1, -1, 0, 1, 1, -1 } }, - { 9, { -1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1 } }, -}; - -char cmd[4096], buf[4096]; -int main(void) -{ - unsigned rr; - int cnt, ix; -#if LTM_DEMO_TEST_VS_MTEST - unsigned long expt_n, add_n, sub_n, mul_n, div_n, sqr_n, mul2d_n, div2d_n, - gcd_n, lcm_n, inv_n, div2_n, mul2_n, add_d_n, sub_d_n; - char* ret; -#else - unsigned long s, t; - unsigned long long q, r; - mp_digit mp; - int i, n, err, should; -#endif - - if (mp_init_multi(&a, &b, &c, &d, &e, &f, NULL)!= MP_OKAY) - return EXIT_FAILURE; - - atexit(_cleanup); - -#if defined(LTM_DEMO_REAL_RAND) - if (!fd_urandom) { - fd_urandom = fopen("/dev/urandom", "r"); - if (!fd_urandom) { -#if !defined(_WIN32) - fprintf(stderr, "\ncould not open /dev/urandom\n"); -#endif - } - } -#endif - srand(LTM_DEMO_RAND_SEED); - -#ifdef MP_8BIT - printf("Digit size 8 Bit \n"); -#endif -#ifdef MP_16BIT - printf("Digit size 16 Bit \n"); -#endif -#ifdef MP_32BIT - printf("Digit size 32 Bit \n"); -#endif -#ifdef MP_64BIT - printf("Digit size 64 Bit \n"); -#endif - printf("Size of mp_digit: %u\n", (unsigned int)sizeof(mp_digit)); - printf("Size of mp_word: %u\n", (unsigned int)sizeof(mp_word)); - printf("DIGIT_BIT: %d\n", DIGIT_BIT); - printf("MP_PREC: %d\n", MP_PREC); - -#if LTM_DEMO_TEST_VS_MTEST == 0 - // trivial stuff - mp_set_int(&a, 5); - mp_neg(&a, &b); - if (mp_cmp(&a, &b) != MP_GT) { - return EXIT_FAILURE; - } - if (mp_cmp(&b, &a) != MP_LT) { - return EXIT_FAILURE; - } - mp_neg(&a, &a); - if (mp_cmp(&b, &a) != MP_EQ) { - return EXIT_FAILURE; - } - mp_abs(&a, &b); - if (mp_isneg(&b) != MP_NO) { - return EXIT_FAILURE; - } - mp_add_d(&a, 1, &b); - mp_add_d(&a, 6, &b); - - - mp_set_int(&a, 0); - mp_set_int(&b, 1); - if ((err = mp_jacobi(&a, &b, &i)) != MP_OKAY) { - printf("Failed executing mp_jacobi(0 | 1) %s.\n", mp_error_to_string(err)); - return EXIT_FAILURE; - } - if (i != 1) { - printf("Failed trivial mp_jacobi(0 | 1) %d != 1\n", i); - return EXIT_FAILURE; - } - for (cnt = 0; cnt < (int)(sizeof(jacobi)/sizeof(jacobi[0])); ++cnt) { - mp_set_int(&b, jacobi[cnt].n); - /* only test positive values of a */ - for (n = -5; n <= 10; ++n) { - mp_set_int(&a, abs(n)); - should = MP_OKAY; - if (n < 0) { - mp_neg(&a, &a); - /* Until #44 is fixed the negative a's must fail */ - should = MP_VAL; - } - if ((err = mp_jacobi(&a, &b, &i)) != should) { - printf("Failed executing mp_jacobi(%d | %lu) %s.\n", n, jacobi[cnt].n, mp_error_to_string(err)); - return EXIT_FAILURE; - } - if (err == MP_OKAY && i != jacobi[cnt].c[n + 5]) { - printf("Failed trivial mp_jacobi(%d | %lu) %d != %d\n", n, jacobi[cnt].n, i, jacobi[cnt].c[n + 5]); - return EXIT_FAILURE; - } - } - } - - // test mp_get_int - printf("\n\nTesting: mp_get_int"); - for (i = 0; i < 1000; ++i) { - t = ((unsigned long) rand () * rand () + 1) & 0xFFFFFFFF; - mp_set_int (&a, t); - if (t != mp_get_int (&a)) { - printf ("\nmp_get_int() bad result!"); - return EXIT_FAILURE; - } - } - mp_set_int(&a, 0); - if (mp_get_int(&a) != 0) { - printf("\nmp_get_int() bad result!"); - return EXIT_FAILURE; - } - mp_set_int(&a, 0xffffffff); - if (mp_get_int(&a) != 0xffffffff) { - printf("\nmp_get_int() bad result!"); - return EXIT_FAILURE; - } - - printf("\n\nTesting: mp_get_long\n"); - for (i = 0; i < (int)(sizeof(unsigned long)*CHAR_BIT) - 1; ++i) { - t = (1ULL << (i+1)) - 1; - if (!t) - t = -1; - printf(" t = 0x%lx i = %d\r", t, i); - do { - if (mp_set_long(&a, t) != MP_OKAY) { - printf("\nmp_set_long() error!"); - return EXIT_FAILURE; - } - s = mp_get_long(&a); - if (s != t) { - printf("\nmp_get_long() bad result! 0x%lx != 0x%lx", s, t); - return EXIT_FAILURE; - } - t <<= 1; - } while(t); - } - - printf("\n\nTesting: mp_get_long_long\n"); - for (i = 0; i < (int)(sizeof(unsigned long long)*CHAR_BIT) - 1; ++i) { - r = (1ULL << (i+1)) - 1; - if (!r) - r = -1; - printf(" r = 0x%llx i = %d\r", r, i); - do { - if (mp_set_long_long(&a, r) != MP_OKAY) { - printf("\nmp_set_long_long() error!"); - return EXIT_FAILURE; - } - q = mp_get_long_long(&a); - if (q != r) { - printf("\nmp_get_long_long() bad result! 0x%llx != 0x%llx", q, r); - return EXIT_FAILURE; - } - r <<= 1; - } while(r); - } - - // test mp_sqrt - printf("\n\nTesting: mp_sqrt\n"); - for (i = 0; i < 1000; ++i) { - printf ("%6d\r", i); - fflush (stdout); - n = (rand () & 15) + 1; - mp_rand (&a, n); - if (mp_sqrt (&a, &b) != MP_OKAY) { - printf ("\nmp_sqrt() error!"); - return EXIT_FAILURE; - } - mp_n_root_ex (&a, 2, &c, 0); - mp_n_root_ex (&a, 2, &d, 1); - if (mp_cmp_mag (&c, &d) != MP_EQ) { - printf ("\nmp_n_root_ex() bad result!"); - return EXIT_FAILURE; - } - if (mp_cmp_mag (&b, &c) != MP_EQ) { - printf ("mp_sqrt() bad result!\n"); - return EXIT_FAILURE; - } - } - - printf("\n\nTesting: mp_is_square\n"); - for (i = 0; i < 1000; ++i) { - printf ("%6d\r", i); - fflush (stdout); - - /* test mp_is_square false negatives */ - n = (rand () & 7) + 1; - mp_rand (&a, n); - mp_sqr (&a, &a); - if (mp_is_square (&a, &n) != MP_OKAY) { - printf ("\nfn:mp_is_square() error!"); - return EXIT_FAILURE; - } - if (n == 0) { - printf ("\nfn:mp_is_square() bad result!"); - return EXIT_FAILURE; - } - - /* test for false positives */ - mp_add_d (&a, 1, &a); - if (mp_is_square (&a, &n) != MP_OKAY) { - printf ("\nfp:mp_is_square() error!"); - return EXIT_FAILURE; - } - if (n == 1) { - printf ("\nfp:mp_is_square() bad result!"); - return EXIT_FAILURE; - } - - } - printf("\n\n"); - - // r^2 = n (mod p) - for (i = 0; i < (int)(sizeof(sqrtmod_prime)/sizeof(sqrtmod_prime[0])); ++i) { - mp_set_int(&a, sqrtmod_prime[i].p); - mp_set_int(&b, sqrtmod_prime[i].n); - if (mp_sqrtmod_prime(&b, &a, &c) != MP_OKAY) { - printf("Failed executing %d. mp_sqrtmod_prime\n", (i+1)); - return EXIT_FAILURE; - } - if (mp_cmp_d(&c, sqrtmod_prime[i].r) != MP_EQ) { - printf("Failed %d. trivial mp_sqrtmod_prime\n", (i+1)); - ndraw(&c, "r"); - return EXIT_FAILURE; - } - } - - /* test for size */ - for (ix = 10; ix < 128; ix++) { - printf ("Testing (not safe-prime): %9d bits \r", ix); - fflush (stdout); - err = mp_prime_random_ex (&a, 8, ix, - (rand () & 1) ? 0 : LTM_PRIME_2MSB_ON, myrng, - NULL); - if (err != MP_OKAY) { - printf ("failed with err code %d\n", err); - return EXIT_FAILURE; - } - if (mp_count_bits (&a) != ix) { - printf ("Prime is %d not %d bits!!!\n", mp_count_bits (&a), ix); - return EXIT_FAILURE; - } - } - printf("\n"); - - for (ix = 16; ix < 128; ix++) { - printf ("Testing ( safe-prime): %9d bits \r", ix); - fflush (stdout); - err = mp_prime_random_ex ( - &a, 8, ix, ((rand () & 1) ? 0 : LTM_PRIME_2MSB_ON) | LTM_PRIME_SAFE, - myrng, NULL); - if (err != MP_OKAY) { - printf ("failed with err code %d\n", err); - return EXIT_FAILURE; - } - if (mp_count_bits (&a) != ix) { - printf ("Prime is %d not %d bits!!!\n", mp_count_bits (&a), ix); - return EXIT_FAILURE; - } - /* let's see if it's really a safe prime */ - mp_sub_d (&a, 1, &a); - mp_div_2 (&a, &a); - mp_prime_is_prime (&a, 8, &cnt); - if (cnt != MP_YES) { - printf ("sub is not prime!\n"); - return EXIT_FAILURE; - } - } - - printf("\n\n"); - - // test montgomery - printf("Testing: montgomery...\n"); - for (i = 1; i <= 10; i++) { - if (i == 10) - i = 1000; - printf(" digit size: %2d\r", i); - fflush(stdout); - for (n = 0; n < 1000; n++) { - mp_rand(&a, i); - a.dp[0] |= 1; - - // let's see if R is right - mp_montgomery_calc_normalization(&b, &a); - mp_montgomery_setup(&a, &mp); - - // now test a random reduction - for (ix = 0; ix < 100; ix++) { - mp_rand(&c, 1 + abs(rand()) % (2*i)); - mp_copy(&c, &d); - mp_copy(&c, &e); - - mp_mod(&d, &a, &d); - mp_montgomery_reduce(&c, &a, mp); - mp_mulmod(&c, &b, &a, &c); - - if (mp_cmp(&c, &d) != MP_EQ) { -printf("d = e mod a, c = e MOD a\n"); -mp_todecimal(&a, buf); printf("a = %s\n", buf); -mp_todecimal(&e, buf); printf("e = %s\n", buf); -mp_todecimal(&d, buf); printf("d = %s\n", buf); -mp_todecimal(&c, buf); printf("c = %s\n", buf); -printf("compare no compare!\n"); return EXIT_FAILURE; } - /* only one big montgomery reduction */ - if (i > 10) - { - n = 1000; - ix = 100; - } - } - } - } - - printf("\n\n"); - - mp_read_radix(&a, "123456", 10); - mp_toradix_n(&a, buf, 10, 3); - printf("a == %s\n", buf); - mp_toradix_n(&a, buf, 10, 4); - printf("a == %s\n", buf); - mp_toradix_n(&a, buf, 10, 30); - printf("a == %s\n", buf); - - -#if 0 - for (;;) { - fgets(buf, sizeof(buf), stdin); - mp_read_radix(&a, buf, 10); - mp_prime_next_prime(&a, 5, 1); - mp_toradix(&a, buf, 10); - printf("%s, %lu\n", buf, a.dp[0] & 3); - } -#endif - - /* test mp_cnt_lsb */ - printf("\n\nTesting: mp_cnt_lsb"); - mp_set(&a, 1); - for (ix = 0; ix < 1024; ix++) { - if (mp_cnt_lsb (&a) != ix) { - printf ("Failed at %d, %d\n", ix, mp_cnt_lsb (&a)); - return EXIT_FAILURE; - } - mp_mul_2 (&a, &a); - } - -/* test mp_reduce_2k */ - printf("\n\nTesting: mp_reduce_2k\n"); - for (cnt = 3; cnt <= 128; ++cnt) { - mp_digit tmp; - - mp_2expt (&a, cnt); - mp_sub_d (&a, 2, &a); /* a = 2**cnt - 2 */ - - printf ("\r %4d bits", cnt); - printf ("(%d)", mp_reduce_is_2k (&a)); - mp_reduce_2k_setup (&a, &tmp); - printf ("(%lu)", (unsigned long) tmp); - for (ix = 0; ix < 1000; ix++) { - if (!(ix & 127)) { - printf ("."); - fflush (stdout); - } - mp_rand (&b, (cnt / DIGIT_BIT + 1) * 2); - mp_copy (&c, &b); - mp_mod (&c, &a, &c); - mp_reduce_2k (&b, &a, 2); - if (mp_cmp (&c, &b)) { - printf ("FAILED\n"); - return EXIT_FAILURE; - } - } - } - -/* test mp_div_3 */ - printf("\n\nTesting: mp_div_3...\n"); - mp_set(&d, 3); - for (cnt = 0; cnt < 10000;) { - mp_digit r2; - - if (!(++cnt & 127)) - { - printf("%9d\r", cnt); - fflush(stdout); - } - mp_rand(&a, abs(rand()) % 128 + 1); - mp_div(&a, &d, &b, &e); - mp_div_3(&a, &c, &r2); - - if (mp_cmp(&b, &c) || mp_cmp_d(&e, r2)) { - printf("\nmp_div_3 => Failure\n"); - } - } - printf("\nPassed div_3 testing"); - -/* test the DR reduction */ - printf("\n\nTesting: mp_dr_reduce...\n"); - for (cnt = 2; cnt < 32; cnt++) { - printf ("\r%d digit modulus", cnt); - mp_grow (&a, cnt); - mp_zero (&a); - for (ix = 1; ix < cnt; ix++) { - a.dp[ix] = MP_MASK; - } - a.used = cnt; - a.dp[0] = 3; - - mp_rand (&b, cnt - 1); - mp_copy (&b, &c); - - rr = 0; - do { - if (!(rr & 127)) { - printf ("."); - fflush (stdout); - } - mp_sqr (&b, &b); - mp_add_d (&b, 1, &b); - mp_copy (&b, &c); - - mp_mod (&b, &a, &b); - mp_dr_setup(&a, &mp), - mp_dr_reduce (&c, &a, mp); - - if (mp_cmp (&b, &c) != MP_EQ) { - printf ("Failed on trial %u\n", rr); - return EXIT_FAILURE; - } - } while (++rr < 500); - printf (" passed"); - fflush (stdout); - } - -#if LTM_DEMO_TEST_REDUCE_2K_L -/* test the mp_reduce_2k_l code */ -#if LTM_DEMO_TEST_REDUCE_2K_L == 1 -/* first load P with 2^1024 - 0x2A434 B9FDEC95 D8F9D550 FFFFFFFF FFFFFFFF */ - mp_2expt(&a, 1024); - mp_read_radix(&b, "2A434B9FDEC95D8F9D550FFFFFFFFFFFFFFFF", 16); - mp_sub(&a, &b, &a); -#elif LTM_DEMO_TEST_REDUCE_2K_L == 2 -/* p = 2^2048 - 0x1 00000000 00000000 00000000 00000000 4945DDBF 8EA2A91D 5776399B B83E188F */ - mp_2expt(&a, 2048); - mp_read_radix(&b, - "1000000000000000000000000000000004945DDBF8EA2A91D5776399BB83E188F", - 16); - mp_sub(&a, &b, &a); -#else -#error oops -#endif - - mp_todecimal(&a, buf); - printf("\n\np==%s\n", buf); -/* now mp_reduce_is_2k_l() should return */ - if (mp_reduce_is_2k_l(&a) != 1) { - printf("mp_reduce_is_2k_l() return 0, should be 1\n"); - return EXIT_FAILURE; - } - mp_reduce_2k_setup_l(&a, &d); - /* now do a million square+1 to see if it varies */ - mp_rand(&b, 64); - mp_mod(&b, &a, &b); - mp_copy(&b, &c); - printf("Testing: mp_reduce_2k_l..."); - fflush(stdout); - for (cnt = 0; cnt < (int)(1UL << 20); cnt++) { - mp_sqr(&b, &b); - mp_add_d(&b, 1, &b); - mp_reduce_2k_l(&b, &a, &d); - mp_sqr(&c, &c); - mp_add_d(&c, 1, &c); - mp_mod(&c, &a, &c); - if (mp_cmp(&b, &c) != MP_EQ) { - printf("mp_reduce_2k_l() failed at step %d\n", cnt); - mp_tohex(&b, buf); - printf("b == %s\n", buf); - mp_tohex(&c, buf); - printf("c == %s\n", buf); - return EXIT_FAILURE; - } - } - printf("...Passed\n"); -#endif /* LTM_DEMO_TEST_REDUCE_2K_L */ - -#else - - div2_n = mul2_n = inv_n = expt_n = lcm_n = gcd_n = add_n = - sub_n = mul_n = div_n = sqr_n = mul2d_n = div2d_n = cnt = add_d_n = - sub_d_n = 0; - - /* force KARA and TOOM to enable despite cutoffs */ - KARATSUBA_SQR_CUTOFF = KARATSUBA_MUL_CUTOFF = 8; - TOOM_SQR_CUTOFF = TOOM_MUL_CUTOFF = 16; - - for (;;) { - /* randomly clear and re-init one variable, this has the affect of triming the alloc space */ - switch (abs(rand()) % 7) { - case 0: - mp_clear(&a); - mp_init(&a); - break; - case 1: - mp_clear(&b); - mp_init(&b); - break; - case 2: - mp_clear(&c); - mp_init(&c); - break; - case 3: - mp_clear(&d); - mp_init(&d); - break; - case 4: - mp_clear(&e); - mp_init(&e); - break; - case 5: - mp_clear(&f); - mp_init(&f); - break; - case 6: - break; /* don't clear any */ - } - - - printf - ("%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu/%4lu ", - add_n, sub_n, mul_n, div_n, sqr_n, mul2d_n, div2d_n, gcd_n, lcm_n, - expt_n, inv_n, div2_n, mul2_n, add_d_n, sub_d_n); - ret=fgets(cmd, 4095, stdin); if(!ret){_panic(__LINE__);} - cmd[strlen(cmd) - 1] = 0; - printf("%-6s ]\r", cmd); - fflush(stdout); - if (!strcmp(cmd, "mul2d")) { - ++mul2d_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - sscanf(buf, "%d", &rr); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - - mp_mul_2d(&a, rr, &a); - a.sign = b.sign; - if (mp_cmp(&a, &b) != MP_EQ) { - printf("mul2d failed, rr == %d\n", rr); - draw(&a); - draw(&b); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "div2d")) { - ++div2d_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - sscanf(buf, "%d", &rr); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - - mp_div_2d(&a, rr, &a, &e); - a.sign = b.sign; - if (a.used == b.used && a.used == 0) { - a.sign = b.sign = MP_ZPOS; - } - if (mp_cmp(&a, &b) != MP_EQ) { - printf("div2d failed, rr == %d\n", rr); - draw(&a); - draw(&b); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "add")) { - ++add_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - mp_copy(&a, &d); - mp_add(&d, &b, &d); - if (mp_cmp(&c, &d) != MP_EQ) { - printf("add %lu failure!\n", add_n); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - - /* test the sign/unsigned storage functions */ - - rr = mp_signed_bin_size(&c); - mp_to_signed_bin(&c, (unsigned char *) cmd); - memset(cmd + rr, rand() & 255, sizeof(cmd) - rr); - mp_read_signed_bin(&d, (unsigned char *) cmd, rr); - if (mp_cmp(&c, &d) != MP_EQ) { - printf("mp_signed_bin failure!\n"); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - - - rr = mp_unsigned_bin_size(&c); - mp_to_unsigned_bin(&c, (unsigned char *) cmd); - memset(cmd + rr, rand() & 255, sizeof(cmd) - rr); - mp_read_unsigned_bin(&d, (unsigned char *) cmd, rr); - if (mp_cmp_mag(&c, &d) != MP_EQ) { - printf("mp_unsigned_bin failure!\n"); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - - } else if (!strcmp(cmd, "sub")) { - ++sub_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - mp_copy(&a, &d); - mp_sub(&d, &b, &d); - if (mp_cmp(&c, &d) != MP_EQ) { - printf("sub %lu failure!\n", sub_n); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "mul")) { - ++mul_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - mp_copy(&a, &d); - mp_mul(&d, &b, &d); - if (mp_cmp(&c, &d) != MP_EQ) { - printf("mul %lu failure!\n", mul_n); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "div")) { - ++div_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&d, buf, 64); - - mp_div(&a, &b, &e, &f); - if (mp_cmp(&c, &e) != MP_EQ || mp_cmp(&d, &f) != MP_EQ) { - printf("div %lu %d, %d, failure!\n", div_n, mp_cmp(&c, &e), - mp_cmp(&d, &f)); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - draw(&e); - draw(&f); - return EXIT_FAILURE; - } - - } else if (!strcmp(cmd, "sqr")) { - ++sqr_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - mp_copy(&a, &c); - mp_sqr(&c, &c); - if (mp_cmp(&b, &c) != MP_EQ) { - printf("sqr %lu failure!\n", sqr_n); - draw(&a); - draw(&b); - draw(&c); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "gcd")) { - ++gcd_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - mp_copy(&a, &d); - mp_gcd(&d, &b, &d); - d.sign = c.sign; - if (mp_cmp(&c, &d) != MP_EQ) { - printf("gcd %lu failure!\n", gcd_n); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "lcm")) { - ++lcm_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - mp_copy(&a, &d); - mp_lcm(&d, &b, &d); - d.sign = c.sign; - if (mp_cmp(&c, &d) != MP_EQ) { - printf("lcm %lu failure!\n", lcm_n); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "expt")) { - ++expt_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&d, buf, 64); - mp_copy(&a, &e); - mp_exptmod(&e, &b, &c, &e); - if (mp_cmp(&d, &e) != MP_EQ) { - printf("expt %lu failure!\n", expt_n); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - draw(&e); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "invmod")) { - ++inv_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&c, buf, 64); - mp_invmod(&a, &b, &d); - mp_mulmod(&d, &a, &b, &e); - if (mp_cmp_d(&e, 1) != MP_EQ) { - printf("inv [wrong value from MPI?!] failure\n"); - draw(&a); - draw(&b); - draw(&c); - draw(&d); - draw(&e); - mp_gcd(&a, &b, &e); - draw(&e); - return EXIT_FAILURE; - } - - } else if (!strcmp(cmd, "div2")) { - ++div2_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - mp_div_2(&a, &c); - if (mp_cmp(&c, &b) != MP_EQ) { - printf("div_2 %lu failure\n", div2_n); - draw(&a); - draw(&b); - draw(&c); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "mul2")) { - ++mul2_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - mp_mul_2(&a, &c); - if (mp_cmp(&c, &b) != MP_EQ) { - printf("mul_2 %lu failure\n", mul2_n); - draw(&a); - draw(&b); - draw(&c); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "add_d")) { - ++add_d_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - sscanf(buf, "%d", &ix); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - mp_add_d(&a, ix, &c); - if (mp_cmp(&b, &c) != MP_EQ) { - printf("add_d %lu failure\n", add_d_n); - draw(&a); - draw(&b); - draw(&c); - printf("d == %d\n", ix); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "sub_d")) { - ++sub_d_n; - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&a, buf, 64); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - sscanf(buf, "%d", &ix); - ret=fgets(buf, 4095, stdin); if(!ret){_panic(__LINE__);} - mp_read_radix(&b, buf, 64); - mp_sub_d(&a, ix, &c); - if (mp_cmp(&b, &c) != MP_EQ) { - printf("sub_d %lu failure\n", sub_d_n); - draw(&a); - draw(&b); - draw(&c); - printf("d == %d\n", ix); - return EXIT_FAILURE; - } - } else if (!strcmp(cmd, "exit")) { - printf("\nokay, exiting now\n"); - break; - } - } -#endif - return 0; -} - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/demo/timing.c b/libtommath/demo/timing.c deleted file mode 100644 index 1bd8489..0000000 --- a/libtommath/demo/timing.c +++ /dev/null @@ -1,339 +0,0 @@ -#include -#include -#include - -ulong64 _tt; - -#ifdef IOWNANATHLON -#include -#define SLEEP sleep(4) -#else -#define SLEEP -#endif - -#ifdef LTM_TIMING_REAL_RAND -#define LTM_TIMING_RAND_SEED time(NULL) -#else -#define LTM_TIMING_RAND_SEED 23 -#endif - - -void ndraw(mp_int * a, char *name) -{ - char buf[4096]; - - printf("%s: ", name); - mp_toradix(a, buf, 64); - printf("%s\n", buf); -} - -static void draw(mp_int * a) -{ - ndraw(a, ""); -} - - -unsigned long lfsr = 0xAAAAAAAAUL; - -int lbit(void) -{ - if (lfsr & 0x80000000UL) { - lfsr = ((lfsr << 1) ^ 0x8000001BUL) & 0xFFFFFFFFUL; - return 1; - } else { - lfsr <<= 1; - return 0; - } -} - -/* RDTSC from Scott Duplichan */ -static ulong64 TIMFUNC(void) -{ -#if defined __GNUC__ -#if defined(__i386__) || defined(__x86_64__) - /* version from http://www.mcs.anl.gov/~kazutomo/rdtsc.html - * the old code always got a warning issued by gcc, clang did not complain... - */ - unsigned hi, lo; - __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); - return ((ulong64)lo)|( ((ulong64)hi)<<32); -#else /* gcc-IA64 version */ - unsigned long result; - __asm__ __volatile__("mov %0=ar.itc":"=r"(result)::"memory"); - - while (__builtin_expect((int) result == -1, 0)) - __asm__ __volatile__("mov %0=ar.itc":"=r"(result)::"memory"); - - return result; -#endif - - // Microsoft and Intel Windows compilers -#elif defined _M_IX86 - __asm rdtsc -#elif defined _M_AMD64 - return __rdtsc(); -#elif defined _M_IA64 -#if defined __INTEL_COMPILER -#include -#endif - return __getReg(3116); -#else -#error need rdtsc function for this build -#endif -} - -#define DO(x) x; x; -//#define DO4(x) DO2(x); DO2(x); -//#define DO8(x) DO4(x); DO4(x); -//#define DO(x) DO8(x); DO8(x); - -#ifdef TIMING_NO_LOGS -#define FOPEN(a, b) NULL -#define FPRINTF(a,b,c,d) -#define FFLUSH(a) -#define FCLOSE(a) (void)(a) -#else -#define FOPEN(a,b) fopen(a,b) -#define FPRINTF(a,b,c,d) fprintf(a,b,c,d) -#define FFLUSH(a) fflush(a) -#define FCLOSE(a) fclose(a) -#endif - -int main(void) -{ - ulong64 tt, gg, CLK_PER_SEC; - FILE *log, *logb, *logc, *logd; - mp_int a, b, c, d, e, f; - int n, cnt, ix, old_kara_m, old_kara_s, old_toom_m, old_toom_s; - unsigned rr; - - mp_init(&a); - mp_init(&b); - mp_init(&c); - mp_init(&d); - mp_init(&e); - mp_init(&f); - - srand(LTM_TIMING_RAND_SEED); - - - CLK_PER_SEC = TIMFUNC(); - sleep(1); - CLK_PER_SEC = TIMFUNC() - CLK_PER_SEC; - - printf("CLK_PER_SEC == %llu\n", CLK_PER_SEC); - log = FOPEN("logs/add.log", "w"); - for (cnt = 8; cnt <= 128; cnt += 8) { - SLEEP; - mp_rand(&a, cnt); - mp_rand(&b, cnt); - rr = 0; - tt = -1; - do { - gg = TIMFUNC(); - DO(mp_add(&a, &b, &c)); - gg = (TIMFUNC() - gg) >> 1; - if (tt > gg) - tt = gg; - } while (++rr < 100000); - printf("Adding\t\t%4d-bit => %9llu/sec, %9llu cycles\n", - mp_count_bits(&a), CLK_PER_SEC / tt, tt); - FPRINTF(log, "%d %9llu\n", cnt * DIGIT_BIT, tt); - FFLUSH(log); - } - FCLOSE(log); - - log = FOPEN("logs/sub.log", "w"); - for (cnt = 8; cnt <= 128; cnt += 8) { - SLEEP; - mp_rand(&a, cnt); - mp_rand(&b, cnt); - rr = 0; - tt = -1; - do { - gg = TIMFUNC(); - DO(mp_sub(&a, &b, &c)); - gg = (TIMFUNC() - gg) >> 1; - if (tt > gg) - tt = gg; - } while (++rr < 100000); - - printf("Subtracting\t\t%4d-bit => %9llu/sec, %9llu cycles\n", - mp_count_bits(&a), CLK_PER_SEC / tt, tt); - FPRINTF(log, "%d %9llu\n", cnt * DIGIT_BIT, tt); - FFLUSH(log); - } - FCLOSE(log); - - /* do mult/square twice, first without karatsuba and second with */ - old_kara_m = KARATSUBA_MUL_CUTOFF; - old_kara_s = KARATSUBA_SQR_CUTOFF; - /* currently toom-cook cut-off is too high to kick in, so we just use the karatsuba values */ - old_toom_m = old_kara_m; - old_toom_s = old_kara_m; - for (ix = 0; ix < 3; ix++) { - printf("With%s Karatsuba, With%s Toom\n", (ix == 0) ? "out" : "", (ix == 1) ? "out" : ""); - - KARATSUBA_MUL_CUTOFF = (ix == 1) ? old_kara_m : 9999; - KARATSUBA_SQR_CUTOFF = (ix == 1) ? old_kara_s : 9999; - TOOM_MUL_CUTOFF = (ix == 2) ? old_toom_m : 9999; - TOOM_SQR_CUTOFF = (ix == 2) ? old_toom_s : 9999; - - log = FOPEN((ix == 0) ? "logs/mult.log" : (ix == 1) ? "logs/mult_kara.log" : "logs/mult_toom.log", "w"); - for (cnt = 4; cnt <= 10240 / DIGIT_BIT; cnt += 2) { - SLEEP; - mp_rand(&a, cnt); - mp_rand(&b, cnt); - rr = 0; - tt = -1; - do { - gg = TIMFUNC(); - DO(mp_mul(&a, &b, &c)); - gg = (TIMFUNC() - gg) >> 1; - if (tt > gg) - tt = gg; - } while (++rr < 100); - printf("Multiplying\t%4d-bit => %9llu/sec, %9llu cycles\n", - mp_count_bits(&a), CLK_PER_SEC / tt, tt); - FPRINTF(log, "%d %9llu\n", mp_count_bits(&a), tt); - FFLUSH(log); - } - FCLOSE(log); - - log = FOPEN((ix == 0) ? "logs/sqr.log" : (ix == 1) ? "logs/sqr_kara.log" : "logs/sqr_toom.log", "w"); - for (cnt = 4; cnt <= 10240 / DIGIT_BIT; cnt += 2) { - SLEEP; - mp_rand(&a, cnt); - rr = 0; - tt = -1; - do { - gg = TIMFUNC(); - DO(mp_sqr(&a, &b)); - gg = (TIMFUNC() - gg) >> 1; - if (tt > gg) - tt = gg; - } while (++rr < 100); - printf("Squaring\t%4d-bit => %9llu/sec, %9llu cycles\n", - mp_count_bits(&a), CLK_PER_SEC / tt, tt); - FPRINTF(log, "%d %9llu\n", mp_count_bits(&a), tt); - FFLUSH(log); - } - FCLOSE(log); - - } - - { - char *primes[] = { - /* 2K large moduli */ - "179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586239334100047359817950870678242457666208137217", - "32317006071311007300714876688669951960444102669715484032130345427524655138867890893197201411522913463688717960921898019494119559150490921095088152386448283120630877367300996091750197750389652106796057638384067568276792218642619756161838094338476170470581645852036305042887575891541065808607552399123930385521914333389668342420684974786564569494856176035326322058077805659331026192708460314150258592864177116725943603718461857357598351152301645904403697613233287231227125684710820209725157101726931323469678542580656697935045997268352998638099733077152121140120031150424541696791951097529546801429027668869927491725169", - "1044388881413152506691752710716624382579964249047383780384233483283953907971557456848826811934997558340890106714439262837987573438185793607263236087851365277945956976543709998340361590134383718314428070011855946226376318839397712745672334684344586617496807908705803704071284048740118609114467977783598029006686938976881787785946905630190260940599579453432823469303026696443059025015972399867714215541693835559885291486318237914434496734087811872639496475100189041349008417061675093668333850551032972088269550769983616369411933015213796825837188091833656751221318492846368125550225998300412344784862595674492194617023806505913245610825731835380087608622102834270197698202313169017678006675195485079921636419370285375124784014907159135459982790513399611551794271106831134090584272884279791554849782954323534517065223269061394905987693002122963395687782878948440616007412945674919823050571642377154816321380631045902916136926708342856440730447899971901781465763473223850267253059899795996090799469201774624817718449867455659250178329070473119433165550807568221846571746373296884912819520317457002440926616910874148385078411929804522981857338977648103126085902995208257421855249796721729039744118165938433694823325696642096892124547425283", - /* 2K moduli mersenne primes */ - "6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151", - "531137992816767098689588206552468627329593117727031923199444138200403559860852242739162502265229285668889329486246501015346579337652707239409519978766587351943831270835393219031728127", - "10407932194664399081925240327364085538615262247266704805319112350403608059673360298012239441732324184842421613954281007791383566248323464908139906605677320762924129509389220345773183349661583550472959420547689811211693677147548478866962501384438260291732348885311160828538416585028255604666224831890918801847068222203140521026698435488732958028878050869736186900714720710555703168729087", - "1475979915214180235084898622737381736312066145333169775147771216478570297878078949377407337049389289382748507531496480477281264838760259191814463365330269540496961201113430156902396093989090226259326935025281409614983499388222831448598601834318536230923772641390209490231836446899608210795482963763094236630945410832793769905399982457186322944729636418890623372171723742105636440368218459649632948538696905872650486914434637457507280441823676813517852099348660847172579408422316678097670224011990280170474894487426924742108823536808485072502240519452587542875349976558572670229633962575212637477897785501552646522609988869914013540483809865681250419497686697771007", - "259117086013202627776246767922441530941818887553125427303974923161874019266586362086201209516800483406550695241733194177441689509238807017410377709597512042313066624082916353517952311186154862265604547691127595848775610568757931191017711408826252153849035830401185072116424747461823031471398340229288074545677907941037288235820705892351068433882986888616658650280927692080339605869308790500409503709875902119018371991620994002568935113136548829739112656797303241986517250116412703509705427773477972349821676443446668383119322540099648994051790241624056519054483690809616061625743042361721863339415852426431208737266591962061753535748892894599629195183082621860853400937932839420261866586142503251450773096274235376822938649407127700846077124211823080804139298087057504713825264571448379371125032081826126566649084251699453951887789613650248405739378594599444335231188280123660406262468609212150349937584782292237144339628858485938215738821232393687046160677362909315071", - "190797007524439073807468042969529173669356994749940177394741882673528979787005053706368049835514900244303495954950709725762186311224148828811920216904542206960744666169364221195289538436845390250168663932838805192055137154390912666527533007309292687539092257043362517857366624699975402375462954490293259233303137330643531556539739921926201438606439020075174723029056838272505051571967594608350063404495977660656269020823960825567012344189908927956646011998057988548630107637380993519826582389781888135705408653045219655801758081251164080554609057468028203308718724654081055323215860189611391296030471108443146745671967766308925858547271507311563765171008318248647110097614890313562856541784154881743146033909602737947385055355960331855614540900081456378659068370317267696980001187750995491090350108417050917991562167972281070161305972518044872048331306383715094854938415738549894606070722584737978176686422134354526989443028353644037187375385397838259511833166416134323695660367676897722287918773420968982326089026150031515424165462111337527431154890666327374921446276833564519776797633875503548665093914556482031482248883127023777039667707976559857333357013727342079099064400455741830654320379350833236245819348824064783585692924881021978332974949906122664421376034687815350484991", - - /* DR moduli */ - "14059105607947488696282932836518693308967803494693489478439861164411992439598399594747002144074658928593502845729752797260025831423419686528151609940203368612079", - "101745825697019260773923519755878567461315282017759829107608914364075275235254395622580447400994175578963163918967182013639660669771108475957692810857098847138903161308502419410142185759152435680068435915159402496058513611411688900243039", - "736335108039604595805923406147184530889923370574768772191969612422073040099331944991573923112581267542507986451953227192970402893063850485730703075899286013451337291468249027691733891486704001513279827771740183629161065194874727962517148100775228363421083691764065477590823919364012917984605619526140821797602431", - "38564998830736521417281865696453025806593491967131023221754800625044118265468851210705360385717536794615180260494208076605798671660719333199513807806252394423283413430106003596332513246682903994829528690198205120921557533726473585751382193953592127439965050261476810842071573684505878854588706623484573925925903505747545471088867712185004135201289273405614415899438276535626346098904241020877974002916168099951885406379295536200413493190419727789712076165162175783", - "542189391331696172661670440619180536749994166415993334151601745392193484590296600979602378676624808129613777993466242203025054573692562689251250471628358318743978285860720148446448885701001277560572526947619392551574490839286458454994488665744991822837769918095117129546414124448777033941223565831420390846864429504774477949153794689948747680362212954278693335653935890352619041936727463717926744868338358149568368643403037768649616778526013610493696186055899318268339432671541328195724261329606699831016666359440874843103020666106568222401047720269951530296879490444224546654729111504346660859907296364097126834834235287147", - "1487259134814709264092032648525971038895865645148901180585340454985524155135260217788758027400478312256339496385275012465661575576202252063145698732079880294664220579764848767704076761853197216563262660046602703973050798218246170835962005598561669706844469447435461092542265792444947706769615695252256130901271870341005768912974433684521436211263358097522726462083917939091760026658925757076733484173202927141441492573799914240222628795405623953109131594523623353044898339481494120112723445689647986475279242446083151413667587008191682564376412347964146113898565886683139407005941383669325997475076910488086663256335689181157957571445067490187939553165903773554290260531009121879044170766615232300936675369451260747671432073394867530820527479172464106442450727640226503746586340279816318821395210726268291535648506190714616083163403189943334431056876038286530365757187367147446004855912033137386225053275419626102417236133948503", - "1095121115716677802856811290392395128588168592409109494900178008967955253005183831872715423151551999734857184538199864469605657805519106717529655044054833197687459782636297255219742994736751541815269727940751860670268774903340296040006114013971309257028332849679096824800250742691718610670812374272414086863715763724622797509437062518082383056050144624962776302147890521249477060215148275163688301275847155316042279405557632639366066847442861422164832655874655824221577849928863023018366835675399949740429332468186340518172487073360822220449055340582568461568645259954873303616953776393853174845132081121976327462740354930744487429617202585015510744298530101547706821590188733515880733527449780963163909830077616357506845523215289297624086914545378511082534229620116563260168494523906566709418166011112754529766183554579321224940951177394088465596712620076240067370589036924024728375076210477267488679008016579588696191194060127319035195370137160936882402244399699172017835144537488486396906144217720028992863941288217185353914991583400421682751000603596655790990815525126154394344641336397793791497068253936771017031980867706707490224041075826337383538651825493679503771934836094655802776331664261631740148281763487765852746577808019633679", - - /* generic unrestricted moduli */ - "17933601194860113372237070562165128350027320072176844226673287945873370751245439587792371960615073855669274087805055507977323024886880985062002853331424203", - "2893527720709661239493896562339544088620375736490408468011883030469939904368086092336458298221245707898933583190713188177399401852627749210994595974791782790253946539043962213027074922559572312141181787434278708783207966459019479487", - "347743159439876626079252796797422223177535447388206607607181663903045907591201940478223621722118173270898487582987137708656414344685816179420855160986340457973820182883508387588163122354089264395604796675278966117567294812714812796820596564876450716066283126720010859041484786529056457896367683122960411136319", - "47266428956356393164697365098120418976400602706072312735924071745438532218237979333351774907308168340693326687317443721193266215155735814510792148768576498491199122744351399489453533553203833318691678263241941706256996197460424029012419012634671862283532342656309677173602509498417976091509154360039893165037637034737020327399910409885798185771003505320583967737293415979917317338985837385734747478364242020380416892056650841470869294527543597349250299539682430605173321029026555546832473048600327036845781970289288898317888427517364945316709081173840186150794397479045034008257793436817683392375274635794835245695887", - "436463808505957768574894870394349739623346440601945961161254440072143298152040105676491048248110146278752857839930515766167441407021501229924721335644557342265864606569000117714935185566842453630868849121480179691838399545644365571106757731317371758557990781880691336695584799313313687287468894148823761785582982549586183756806449017542622267874275103877481475534991201849912222670102069951687572917937634467778042874315463238062009202992087620963771759666448266532858079402669920025224220613419441069718482837399612644978839925207109870840278194042158748845445131729137117098529028886770063736487420613144045836803985635654192482395882603511950547826439092832800532152534003936926017612446606135655146445620623395788978726744728503058670046885876251527122350275750995227", - "11424167473351836398078306042624362277956429440521137061889702611766348760692206243140413411077394583180726863277012016602279290144126785129569474909173584789822341986742719230331946072730319555984484911716797058875905400999504305877245849119687509023232790273637466821052576859232452982061831009770786031785669030271542286603956118755585683996118896215213488875253101894663403069677745948305893849505434201763745232895780711972432011344857521691017896316861403206449421332243658855453435784006517202894181640562433575390821384210960117518650374602256601091379644034244332285065935413233557998331562749140202965844219336298970011513882564935538704289446968322281451907487362046511461221329799897350993370560697505809686438782036235372137015731304779072430260986460269894522159103008260495503005267165927542949439526272736586626709581721032189532726389643625590680105784844246152702670169304203783072275089194754889511973916207", - "1214855636816562637502584060163403830270705000634713483015101384881871978446801224798536155406895823305035467591632531067547890948695117172076954220727075688048751022421198712032848890056357845974246560748347918630050853933697792254955890439720297560693579400297062396904306270145886830719309296352765295712183040773146419022875165382778007040109957609739589875590885701126197906063620133954893216612678838507540777138437797705602453719559017633986486649523611975865005712371194067612263330335590526176087004421363598470302731349138773205901447704682181517904064735636518462452242791676541725292378925568296858010151852326316777511935037531017413910506921922450666933202278489024521263798482237150056835746454842662048692127173834433089016107854491097456725016327709663199738238442164843147132789153725513257167915555162094970853584447993125488607696008169807374736711297007473812256272245489405898470297178738029484459690836250560495461579533254473316340608217876781986188705928270735695752830825527963838355419762516246028680280988020401914551825487349990306976304093109384451438813251211051597392127491464898797406789175453067960072008590614886532333015881171367104445044718144312416815712216611576221546455968770801413440778423979", - NULL - }; - log = FOPEN("logs/expt.log", "w"); - logb = FOPEN("logs/expt_dr.log", "w"); - logc = FOPEN("logs/expt_2k.log", "w"); - logd = FOPEN("logs/expt_2kl.log", "w"); - for (n = 0; primes[n]; n++) { - SLEEP; - mp_read_radix(&a, primes[n], 10); - mp_zero(&b); - for (rr = 0; rr < (unsigned) mp_count_bits(&a); rr++) { - mp_mul_2(&b, &b); - b.dp[0] |= lbit(); - b.used += 1; - } - mp_sub_d(&a, 1, &c); - mp_mod(&b, &c, &b); - mp_set(&c, 3); - rr = 0; - tt = -1; - do { - gg = TIMFUNC(); - DO(mp_exptmod(&c, &b, &a, &d)); - gg = (TIMFUNC() - gg) >> 1; - if (tt > gg) - tt = gg; - } while (++rr < 10); - mp_sub_d(&a, 1, &e); - mp_sub(&e, &b, &b); - mp_exptmod(&c, &b, &a, &e); /* c^(p-1-b) mod a */ - mp_mulmod(&e, &d, &a, &d); /* c^b * c^(p-1-b) == c^p-1 == 1 */ - if (mp_cmp_d(&d, 1)) { - printf("Different (%d)!!!\n", mp_count_bits(&a)); - draw(&d); - exit(0); - } - printf("Exponentiating\t%4d-bit => %9llu/sec, %9llu cycles\n", - mp_count_bits(&a), CLK_PER_SEC / tt, tt); - FPRINTF(n < 4 ? logd : (n < 9) ? logc : (n < 16) ? logb : log, - "%d %9llu\n", mp_count_bits(&a), tt); - } - } - FCLOSE(log); - FCLOSE(logb); - FCLOSE(logc); - FCLOSE(logd); - - log = FOPEN("logs/invmod.log", "w"); - for (cnt = 4; cnt <= 32; cnt += 4) { - SLEEP; - mp_rand(&a, cnt); - mp_rand(&b, cnt); - - do { - mp_add_d(&b, 1, &b); - mp_gcd(&a, &b, &c); - } while (mp_cmp_d(&c, 1) != MP_EQ); - - rr = 0; - tt = -1; - do { - gg = TIMFUNC(); - DO(mp_invmod(&b, &a, &c)); - gg = (TIMFUNC() - gg) >> 1; - if (tt > gg) - tt = gg; - } while (++rr < 1000); - mp_mulmod(&b, &c, &a, &d); - if (mp_cmp_d(&d, 1) != MP_EQ) { - printf("Failed to invert\n"); - return 0; - } - printf("Inverting mod\t%4d-bit => %9llu/sec, %9llu cycles\n", - mp_count_bits(&a), CLK_PER_SEC / tt, tt); - FPRINTF(log, "%d %9llu\n", cnt * DIGIT_BIT, tt); - } - FCLOSE(log); - - return 0; -} - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/dep.pl b/libtommath/dep.pl deleted file mode 100644 index 0a5d19a..0000000 --- a/libtommath/dep.pl +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/perl -# -# Walk through source, add labels and make classes -# -#use strict; - -my %deplist; - -#open class file and write preamble -open(CLASS, ">tommath_class.h") or die "Couldn't open tommath_class.h for writing\n"; -print CLASS "#if !(defined(LTM1) && defined(LTM2) && defined(LTM3))\n#if defined(LTM2)\n#define LTM3\n#endif\n#if defined(LTM1)\n#define LTM2\n#endif\n#define LTM1\n\n#if defined(LTM_ALL)\n"; - -foreach my $filename (glob "bn*.c") { - my $define = $filename; - -print "Processing $filename\n"; - - # convert filename to upper case so we can use it as a define - $define =~ tr/[a-z]/[A-Z]/; - $define =~ tr/\./_/; - print CLASS "#define $define\n"; - - # now copy text and apply #ifdef as required - my $apply = 0; - open(SRC, "<$filename"); - open(OUT, ">tmp"); - - # first line will be the #ifdef - my $line = ; - if ($line =~ /include/) { - print OUT $line; - } else { - print OUT "#include \n#ifdef $define\n$line"; - $apply = 1; - } - while () { - if (!($_ =~ /tommath\.h/)) { - print OUT $_; - } - } - if ($apply == 1) { - print OUT "#endif\n"; - } - close SRC; - close OUT; - - unlink($filename); - rename("tmp", $filename); -} -print CLASS "#endif\n\n"; - -# now do classes - -foreach my $filename (glob "bn*.c") { - open(SRC, "<$filename") or die "Can't open source file!\n"; - - # convert filename to upper case so we can use it as a define - $filename =~ tr/[a-z]/[A-Z]/; - $filename =~ tr/\./_/; - - print CLASS "#if defined($filename)\n"; - my $list = $filename; - - # scan for mp_* and make classes - while () { - my $line = $_; - while ($line =~ m/(fast_)*(s_)*mp\_[a-z_0-9]*/) { - $line = $'; - # now $& is the match, we want to skip over LTM keywords like - # mp_int, mp_word, mp_digit - if (!($& eq "mp_digit") && !($& eq "mp_word") && !($& eq "mp_int") && !($& eq "mp_min_u32")) { - my $a = $&; - $a =~ tr/[a-z]/[A-Z]/; - $a = "BN_" . $a . "_C"; - if (!($list =~ /$a/)) { - print CLASS " #define $a\n"; - } - $list = $list . "," . $a; - } - } - } - @deplist{$filename} = $list; - - print CLASS "#endif\n\n"; - close SRC; -} - -print CLASS "#ifdef LTM3\n#define LTM_LAST\n#endif\n#include \n#include \n#else\n#define LTM_LAST\n#endif\n"; -close CLASS; - -#now let's make a cool call graph... - -open(OUT,">callgraph.txt"); -$indent = 0; -foreach (keys %deplist) { - $list = ""; - draw_func(@deplist{$_}); - print OUT "\n\n"; -} -close(OUT); - -sub draw_func() -{ - my @funcs = split(",", $_[0]); - if ($list =~ /@funcs[0]/) { - return; - } else { - $list = $list . @funcs[0]; - } - if ($indent == 0) { } - elsif ($indent >= 1) { print OUT "| " x ($indent - 1) . "+--->"; } - print OUT @funcs[0] . "\n"; - shift @funcs; - my $temp = $list; - foreach my $i (@funcs) { - ++$indent; - draw_func(@deplist{$i}); - --$indent; - } - $list = $temp; -} - - diff --git a/libtommath/etc/2kprime.1 b/libtommath/etc/2kprime.1 deleted file mode 100644 index c41ded1..0000000 --- a/libtommath/etc/2kprime.1 +++ /dev/null @@ -1,2 +0,0 @@ -256-bits (k = 36113) = 115792089237316195423570985008687907853269984665640564039457584007913129603823 -512-bits (k = 38117) = 13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006045979 diff --git a/libtommath/etc/2kprime.c b/libtommath/etc/2kprime.c deleted file mode 100644 index 9450283..0000000 --- a/libtommath/etc/2kprime.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Makes safe primes of a 2k nature */ -#include -#include - -int sizes[] = {256, 512, 768, 1024, 1536, 2048, 3072, 4096}; - -int main(void) -{ - char buf[2000]; - int x, y; - mp_int q, p; - FILE *out; - clock_t t1; - mp_digit z; - - mp_init_multi(&q, &p, NULL); - - out = fopen("2kprime.1", "w"); - for (x = 0; x < (int)(sizeof(sizes) / sizeof(sizes[0])); x++) { - top: - mp_2expt(&q, sizes[x]); - mp_add_d(&q, 3, &q); - z = -3; - - t1 = clock(); - for(;;) { - mp_sub_d(&q, 4, &q); - z += 4; - - if (z > MP_MASK) { - printf("No primes of size %d found\n", sizes[x]); - break; - } - - if (clock() - t1 > CLOCKS_PER_SEC) { - printf("."); fflush(stdout); -// sleep((clock() - t1 + CLOCKS_PER_SEC/2)/CLOCKS_PER_SEC); - t1 = clock(); - } - - /* quick test on q */ - mp_prime_is_prime(&q, 1, &y); - if (y == 0) { - continue; - } - - /* find (q-1)/2 */ - mp_sub_d(&q, 1, &p); - mp_div_2(&p, &p); - mp_prime_is_prime(&p, 3, &y); - if (y == 0) { - continue; - } - - /* test on q */ - mp_prime_is_prime(&q, 3, &y); - if (y == 0) { - continue; - } - - break; - } - - if (y == 0) { - ++sizes[x]; - goto top; - } - - mp_toradix(&q, buf, 10); - printf("\n\n%d-bits (k = %lu) = %s\n", sizes[x], z, buf); - fprintf(out, "%d-bits (k = %lu) = %s\n", sizes[x], z, buf); fflush(out); - } - - return 0; -} - - - - - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/etc/drprime.c b/libtommath/etc/drprime.c deleted file mode 100644 index c7d253f..0000000 --- a/libtommath/etc/drprime.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Makes safe primes of a DR nature */ -#include - -int sizes[] = { 1+256/DIGIT_BIT, 1+512/DIGIT_BIT, 1+768/DIGIT_BIT, 1+1024/DIGIT_BIT, 1+2048/DIGIT_BIT, 1+4096/DIGIT_BIT }; -int main(void) -{ - int res, x, y; - char buf[4096]; - FILE *out; - mp_int a, b; - - mp_init(&a); - mp_init(&b); - - out = fopen("drprimes.txt", "w"); - for (x = 0; x < (int)(sizeof(sizes)/sizeof(sizes[0])); x++) { - top: - printf("Seeking a %d-bit safe prime\n", sizes[x] * DIGIT_BIT); - mp_grow(&a, sizes[x]); - mp_zero(&a); - for (y = 1; y < sizes[x]; y++) { - a.dp[y] = MP_MASK; - } - - /* make a DR modulus */ - a.dp[0] = -1; - a.used = sizes[x]; - - /* now loop */ - res = 0; - for (;;) { - a.dp[0] += 4; - if (a.dp[0] >= MP_MASK) break; - mp_prime_is_prime(&a, 1, &res); - if (res == 0) continue; - printf("."); fflush(stdout); - mp_sub_d(&a, 1, &b); - mp_div_2(&b, &b); - mp_prime_is_prime(&b, 3, &res); - if (res == 0) continue; - mp_prime_is_prime(&a, 3, &res); - if (res == 1) break; - } - - if (res != 1) { - printf("Error not DR modulus\n"); sizes[x] += 1; goto top; - } else { - mp_toradix(&a, buf, 10); - printf("\n\np == %s\n\n", buf); - fprintf(out, "%d-bit prime:\np == %s\n\n", mp_count_bits(&a), buf); fflush(out); - } - } - fclose(out); - - mp_clear(&a); - mp_clear(&b); - - return 0; -} - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/etc/drprimes.28 b/libtommath/etc/drprimes.28 deleted file mode 100644 index 9d438ad..0000000 --- a/libtommath/etc/drprimes.28 +++ /dev/null @@ -1,25 +0,0 @@ -DR safe primes for 28-bit digits. - -224-bit prime: -p == 26959946667150639794667015087019630673637144422540572481103341844143 - -532-bit prime: -p == 14059105607947488696282932836518693308967803494693489478439861164411992439598399594747002144074658928593502845729752797260025831423419686528151609940203368691747 - -784-bit prime: -p == 101745825697019260773923519755878567461315282017759829107608914364075275235254395622580447400994175578963163918967182013639660669771108475957692810857098847138903161308502419410142185759152435680068435915159402496058513611411688900243039 - -1036-bit prime: -p == 736335108039604595805923406147184530889923370574768772191969612422073040099331944991573923112581267542507986451953227192970402893063850485730703075899286013451337291468249027691733891486704001513279827771740183629161065194874727962517148100775228363421083691764065477590823919364012917984605619526140821798437127 - -1540-bit prime: -p == 38564998830736521417281865696453025806593491967131023221754800625044118265468851210705360385717536794615180260494208076605798671660719333199513807806252394423283413430106003596332513246682903994829528690198205120921557533726473585751382193953592127439965050261476810842071573684505878854588706623484573925925903505747545471088867712185004135201289273405614415899438276535626346098904241020877974002916168099951885406379295536200413493190419727789712076165162175783 - -2072-bit prime: -p == 542189391331696172661670440619180536749994166415993334151601745392193484590296600979602378676624808129613777993466242203025054573692562689251250471628358318743978285860720148446448885701001277560572526947619392551574490839286458454994488665744991822837769918095117129546414124448777033941223565831420390846864429504774477949153794689948747680362212954278693335653935890352619041936727463717926744868338358149568368643403037768649616778526013610493696186055899318268339432671541328195724261329606699831016666359440874843103020666106568222401047720269951530296879490444224546654729111504346660859907296364097126834834235287147 - -3080-bit prime: -p == 1487259134814709264092032648525971038895865645148901180585340454985524155135260217788758027400478312256339496385275012465661575576202252063145698732079880294664220579764848767704076761853197216563262660046602703973050798218246170835962005598561669706844469447435461092542265792444947706769615695252256130901271870341005768912974433684521436211263358097522726462083917939091760026658925757076733484173202927141441492573799914240222628795405623953109131594523623353044898339481494120112723445689647986475279242446083151413667587008191682564376412347964146113898565886683139407005941383669325997475076910488086663256335689181157957571445067490187939553165903773554290260531009121879044170766615232300936675369451260747671432073394867530820527479172464106442450727640226503746586340279816318821395210726268291535648506190714616083163403189943334431056876038286530365757187367147446004855912033137386225053275419626102417236133948503 - -4116-bit prime: -p == 1095121115716677802856811290392395128588168592409109494900178008967955253005183831872715423151551999734857184538199864469605657805519106717529655044054833197687459782636297255219742994736751541815269727940751860670268774903340296040006114013971309257028332849679096824800250742691718610670812374272414086863715763724622797509437062518082383056050144624962776302147890521249477060215148275163688301275847155316042279405557632639366066847442861422164832655874655824221577849928863023018366835675399949740429332468186340518172487073360822220449055340582568461568645259954873303616953776393853174845132081121976327462740354930744487429617202585015510744298530101547706821590188733515880733527449780963163909830077616357506845523215289297624086914545378511082534229620116563260168494523906566709418166011112754529766183554579321224940951177394088465596712620076240067370589036924024728375076210477267488679008016579588696191194060127319035195370137160936882402244399699172017835144537488486396906144217720028992863941288217185353914991583400421682751000603596655790990815525126154394344641336397793791497068253936771017031980867706707490224041075826337383538651825493679503771934836094655802776331664261631740148281763487765852746577808019633679 diff --git a/libtommath/etc/drprimes.txt b/libtommath/etc/drprimes.txt deleted file mode 100644 index 7c97f67..0000000 --- a/libtommath/etc/drprimes.txt +++ /dev/null @@ -1,9 +0,0 @@ -300-bit prime: -p == 2037035976334486086268445688409378161051468393665936250636140449354381298610415201576637819 - -540-bit prime: -p == 3599131035634557106248430806148785487095757694641533306480604458089470064537190296255232548883112685719936728506816716098566612844395439751206810991770626477344739 - -780-bit prime: -p == 6359114106063703798370219984742410466332205126109989319225557147754704702203399726411277962562135973685197744935448875852478791860694279747355800678568677946181447581781401213133886609947027230004277244697462656003655947791725966271167 - diff --git a/libtommath/etc/makefile b/libtommath/etc/makefile deleted file mode 100644 index 99154d8..0000000 --- a/libtommath/etc/makefile +++ /dev/null @@ -1,50 +0,0 @@ -CFLAGS += -Wall -W -Wshadow -O3 -fomit-frame-pointer -funroll-loops -I../ - -# default lib name (requires install with root) -# LIBNAME=-ltommath - -# libname when you can't install the lib with install -LIBNAME=../libtommath.a - -#provable primes -pprime: pprime.o - $(CC) pprime.o $(LIBNAME) -o pprime - -# portable [well requires clock()] tuning app -tune: tune.o - $(CC) tune.o $(LIBNAME) -o tune - -# same app but using RDTSC for higher precision [requires 80586+], coff based gcc installs [e.g. ming, cygwin, djgpp] -tune86: tune.c - nasm -f coff timer.asm - $(CC) -DX86_TIMER $(CFLAGS) tune.c timer.o $(LIBNAME) -o tune86 - -# for cygwin -tune86c: tune.c - nasm -f gnuwin32 timer.asm - $(CC) -DX86_TIMER $(CFLAGS) tune.c timer.o $(LIBNAME) -o tune86 - -#make tune86 for linux or any ELF format -tune86l: tune.c - nasm -f elf -DUSE_ELF timer.asm - $(CC) -DX86_TIMER $(CFLAGS) tune.c timer.o $(LIBNAME) -o tune86l - -# spits out mersenne primes -mersenne: mersenne.o - $(CC) mersenne.o $(LIBNAME) -o mersenne - -# fines DR safe primes for the given config -drprime: drprime.o - $(CC) drprime.o $(LIBNAME) -o drprime - -# fines 2k safe primes for the given config -2kprime: 2kprime.o - $(CC) 2kprime.o $(LIBNAME) -o 2kprime - -mont: mont.o - $(CC) mont.o $(LIBNAME) -o mont - - -clean: - rm -f *.log *.o *.obj *.exe pprime tune mersenne drprime tune86 tune86l mont 2kprime pprime.dat \ - *.da *.dyn *.dpi *~ diff --git a/libtommath/etc/makefile.icc b/libtommath/etc/makefile.icc deleted file mode 100644 index 8a1ffff..0000000 --- a/libtommath/etc/makefile.icc +++ /dev/null @@ -1,67 +0,0 @@ -CC = icc - -CFLAGS += -I../ - -# optimize for SPEED -# -# -mcpu= can be pentium, pentiumpro (covers PII through PIII) or pentium4 -# -ax? specifies make code specifically for ? but compatible with IA-32 -# -x? specifies compile solely for ? [not specifically IA-32 compatible] -# -# where ? is -# K - PIII -# W - first P4 [Williamette] -# N - P4 Northwood -# P - P4 Prescott -# B - Blend of P4 and PM [mobile] -# -# Default to just generic max opts -CFLAGS += -O3 -xP -ip - -# default lib name (requires install with root) -# LIBNAME=-ltommath - -# libname when you can't install the lib with install -LIBNAME=../libtommath.a - -#provable primes -pprime: pprime.o - $(CC) pprime.o $(LIBNAME) -o pprime - -# portable [well requires clock()] tuning app -tune: tune.o - $(CC) tune.o $(LIBNAME) -o tune - -# same app but using RDTSC for higher precision [requires 80586+], coff based gcc installs [e.g. ming, cygwin, djgpp] -tune86: tune.c - nasm -f coff timer.asm - $(CC) -DX86_TIMER $(CFLAGS) tune.c timer.o $(LIBNAME) -o tune86 - -# for cygwin -tune86c: tune.c - nasm -f gnuwin32 timer.asm - $(CC) -DX86_TIMER $(CFLAGS) tune.c timer.o $(LIBNAME) -o tune86 - -#make tune86 for linux or any ELF format -tune86l: tune.c - nasm -f elf -DUSE_ELF timer.asm - $(CC) -DX86_TIMER $(CFLAGS) tune.c timer.o $(LIBNAME) -o tune86l - -# spits out mersenne primes -mersenne: mersenne.o - $(CC) mersenne.o $(LIBNAME) -o mersenne - -# fines DR safe primes for the given config -drprime: drprime.o - $(CC) drprime.o $(LIBNAME) -o drprime - -# fines 2k safe primes for the given config -2kprime: 2kprime.o - $(CC) 2kprime.o $(LIBNAME) -o 2kprime - -mont: mont.o - $(CC) mont.o $(LIBNAME) -o mont - - -clean: - rm -f *.log *.o *.obj *.exe pprime tune mersenne drprime tune86 tune86l mont 2kprime pprime.dat *.il diff --git a/libtommath/etc/makefile.msvc b/libtommath/etc/makefile.msvc deleted file mode 100644 index 2833372..0000000 --- a/libtommath/etc/makefile.msvc +++ /dev/null @@ -1,23 +0,0 @@ -#MSVC Makefile -# -#Tom St Denis - -CFLAGS = /I../ /Ox /DWIN32 /W3 - -pprime: pprime.obj - cl pprime.obj ../tommath.lib - -mersenne: mersenne.obj - cl mersenne.obj ../tommath.lib - -tune: tune.obj - cl tune.obj ../tommath.lib - -mont: mont.obj - cl mont.obj ../tommath.lib - -drprime: drprime.obj - cl drprime.obj ../tommath.lib - -2kprime: 2kprime.obj - cl 2kprime.obj ../tommath.lib diff --git a/libtommath/etc/mersenne.c b/libtommath/etc/mersenne.c deleted file mode 100644 index ae6725a..0000000 --- a/libtommath/etc/mersenne.c +++ /dev/null @@ -1,144 +0,0 @@ -/* Finds Mersenne primes using the Lucas-Lehmer test - * - * Tom St Denis, tomstdenis@gmail.com - */ -#include -#include - -int -is_mersenne (long s, int *pp) -{ - mp_int n, u; - int res, k; - - *pp = 0; - - if ((res = mp_init (&n)) != MP_OKAY) { - return res; - } - - if ((res = mp_init (&u)) != MP_OKAY) { - goto LBL_N; - } - - /* n = 2^s - 1 */ - if ((res = mp_2expt(&n, s)) != MP_OKAY) { - goto LBL_MU; - } - if ((res = mp_sub_d (&n, 1, &n)) != MP_OKAY) { - goto LBL_MU; - } - - /* set u=4 */ - mp_set (&u, 4); - - /* for k=1 to s-2 do */ - for (k = 1; k <= s - 2; k++) { - /* u = u^2 - 2 mod n */ - if ((res = mp_sqr (&u, &u)) != MP_OKAY) { - goto LBL_MU; - } - if ((res = mp_sub_d (&u, 2, &u)) != MP_OKAY) { - goto LBL_MU; - } - - /* make sure u is positive */ - while (u.sign == MP_NEG) { - if ((res = mp_add (&u, &n, &u)) != MP_OKAY) { - goto LBL_MU; - } - } - - /* reduce */ - if ((res = mp_reduce_2k (&u, &n, 1)) != MP_OKAY) { - goto LBL_MU; - } - } - - /* if u == 0 then its prime */ - if (mp_iszero (&u) == 1) { - mp_prime_is_prime(&n, 8, pp); - if (*pp != 1) printf("FAILURE\n"); - } - - res = MP_OKAY; -LBL_MU:mp_clear (&u); -LBL_N:mp_clear (&n); - return res; -} - -/* square root of a long < 65536 */ -long -i_sqrt (long x) -{ - long x1, x2; - - x2 = 16; - do { - x1 = x2; - x2 = x1 - ((x1 * x1) - x) / (2 * x1); - } while (x1 != x2); - - if (x1 * x1 > x) { - --x1; - } - - return x1; -} - -/* is the long prime by brute force */ -int -isprime (long k) -{ - long y, z; - - y = i_sqrt (k); - for (z = 2; z <= y; z++) { - if ((k % z) == 0) - return 0; - } - return 1; -} - - -int -main (void) -{ - int pp; - long k; - clock_t tt; - - k = 3; - - for (;;) { - /* start time */ - tt = clock (); - - /* test if 2^k - 1 is prime */ - if (is_mersenne (k, &pp) != MP_OKAY) { - printf ("Whoa error\n"); - return -1; - } - - if (pp == 1) { - /* count time */ - tt = clock () - tt; - - /* display if prime */ - printf ("2^%-5ld - 1 is prime, test took %ld ticks\n", k, tt); - } - - /* goto next odd exponent */ - k += 2; - - /* but make sure its prime */ - while (isprime (k) == 0) { - k += 2; - } - } - return 0; -} - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/etc/mont.c b/libtommath/etc/mont.c deleted file mode 100644 index 45cf3fd..0000000 --- a/libtommath/etc/mont.c +++ /dev/null @@ -1,50 +0,0 @@ -/* tests the montgomery routines */ -#include - -int main(void) -{ - mp_int modulus, R, p, pp; - mp_digit mp; - long x, y; - - srand(time(NULL)); - mp_init_multi(&modulus, &R, &p, &pp, NULL); - - /* loop through various sizes */ - for (x = 4; x < 256; x++) { - printf("DIGITS == %3ld...", x); fflush(stdout); - - /* make up the odd modulus */ - mp_rand(&modulus, x); - modulus.dp[0] |= 1; - - /* now find the R value */ - mp_montgomery_calc_normalization(&R, &modulus); - mp_montgomery_setup(&modulus, &mp); - - /* now run through a bunch tests */ - for (y = 0; y < 1000; y++) { - mp_rand(&p, x/2); /* p = random */ - mp_mul(&p, &R, &pp); /* pp = R * p */ - mp_montgomery_reduce(&pp, &modulus, mp); - - /* should be equal to p */ - if (mp_cmp(&pp, &p) != MP_EQ) { - printf("FAILURE!\n"); - exit(-1); - } - } - printf("PASSED\n"); - } - - return 0; -} - - - - - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/etc/pprime.c b/libtommath/etc/pprime.c deleted file mode 100644 index 9f94423..0000000 --- a/libtommath/etc/pprime.c +++ /dev/null @@ -1,400 +0,0 @@ -/* Generates provable primes - * - * See http://gmail.com:8080/papers/pp.pdf for more info. - * - * Tom St Denis, tomstdenis@gmail.com, http://tom.gmail.com - */ -#include -#include "tommath.h" - -int n_prime; -FILE *primes; - -/* fast square root */ -static mp_digit -i_sqrt (mp_word x) -{ - mp_word x1, x2; - - x2 = x; - do { - x1 = x2; - x2 = x1 - ((x1 * x1) - x) / (2 * x1); - } while (x1 != x2); - - if (x1 * x1 > x) { - --x1; - } - - return x1; -} - - -/* generates a prime digit */ -static void gen_prime (void) -{ - mp_digit r, x, y, next; - FILE *out; - - out = fopen("pprime.dat", "wb"); - - /* write first set of primes */ - r = 3; fwrite(&r, 1, sizeof(mp_digit), out); - r = 5; fwrite(&r, 1, sizeof(mp_digit), out); - r = 7; fwrite(&r, 1, sizeof(mp_digit), out); - r = 11; fwrite(&r, 1, sizeof(mp_digit), out); - r = 13; fwrite(&r, 1, sizeof(mp_digit), out); - r = 17; fwrite(&r, 1, sizeof(mp_digit), out); - r = 19; fwrite(&r, 1, sizeof(mp_digit), out); - r = 23; fwrite(&r, 1, sizeof(mp_digit), out); - r = 29; fwrite(&r, 1, sizeof(mp_digit), out); - r = 31; fwrite(&r, 1, sizeof(mp_digit), out); - - /* get square root, since if 'r' is composite its factors must be < than this */ - y = i_sqrt (r); - next = (y + 1) * (y + 1); - - for (;;) { - do { - r += 2; /* next candidate */ - r &= MP_MASK; - if (r < 31) break; - - /* update sqrt ? */ - if (next <= r) { - ++y; - next = (y + 1) * (y + 1); - } - - /* loop if divisible by 3,5,7,11,13,17,19,23,29 */ - if ((r % 3) == 0) { - x = 0; - continue; - } - if ((r % 5) == 0) { - x = 0; - continue; - } - if ((r % 7) == 0) { - x = 0; - continue; - } - if ((r % 11) == 0) { - x = 0; - continue; - } - if ((r % 13) == 0) { - x = 0; - continue; - } - if ((r % 17) == 0) { - x = 0; - continue; - } - if ((r % 19) == 0) { - x = 0; - continue; - } - if ((r % 23) == 0) { - x = 0; - continue; - } - if ((r % 29) == 0) { - x = 0; - continue; - } - - /* now check if r is divisible by x + k={1,7,11,13,17,19,23,29} */ - for (x = 30; x <= y; x += 30) { - if ((r % (x + 1)) == 0) { - x = 0; - break; - } - if ((r % (x + 7)) == 0) { - x = 0; - break; - } - if ((r % (x + 11)) == 0) { - x = 0; - break; - } - if ((r % (x + 13)) == 0) { - x = 0; - break; - } - if ((r % (x + 17)) == 0) { - x = 0; - break; - } - if ((r % (x + 19)) == 0) { - x = 0; - break; - } - if ((r % (x + 23)) == 0) { - x = 0; - break; - } - if ((r % (x + 29)) == 0) { - x = 0; - break; - } - } - } while (x == 0); - if (r > 31) { fwrite(&r, 1, sizeof(mp_digit), out); printf("%9d\r", r); fflush(stdout); } - if (r < 31) break; - } - - fclose(out); -} - -void load_tab(void) -{ - primes = fopen("pprime.dat", "rb"); - if (primes == NULL) { - gen_prime(); - primes = fopen("pprime.dat", "rb"); - } - fseek(primes, 0, SEEK_END); - n_prime = ftell(primes) / sizeof(mp_digit); -} - -mp_digit prime_digit(void) -{ - int n; - mp_digit d; - - n = abs(rand()) % n_prime; - fseek(primes, n * sizeof(mp_digit), SEEK_SET); - fread(&d, 1, sizeof(mp_digit), primes); - return d; -} - - -/* makes a prime of at least k bits */ -int -pprime (int k, int li, mp_int * p, mp_int * q) -{ - mp_int a, b, c, n, x, y, z, v; - int res, ii; - static const mp_digit bases[] = { 2, 3, 5, 7, 11, 13, 17, 19 }; - - /* single digit ? */ - if (k <= (int) DIGIT_BIT) { - mp_set (p, prime_digit ()); - return MP_OKAY; - } - - if ((res = mp_init (&c)) != MP_OKAY) { - return res; - } - - if ((res = mp_init (&v)) != MP_OKAY) { - goto LBL_C; - } - - /* product of first 50 primes */ - if ((res = - mp_read_radix (&v, - "19078266889580195013601891820992757757219839668357012055907516904309700014933909014729740190", - 10)) != MP_OKAY) { - goto LBL_V; - } - - if ((res = mp_init (&a)) != MP_OKAY) { - goto LBL_V; - } - - /* set the prime */ - mp_set (&a, prime_digit ()); - - if ((res = mp_init (&b)) != MP_OKAY) { - goto LBL_A; - } - - if ((res = mp_init (&n)) != MP_OKAY) { - goto LBL_B; - } - - if ((res = mp_init (&x)) != MP_OKAY) { - goto LBL_N; - } - - if ((res = mp_init (&y)) != MP_OKAY) { - goto LBL_X; - } - - if ((res = mp_init (&z)) != MP_OKAY) { - goto LBL_Y; - } - - /* now loop making the single digit */ - while (mp_count_bits (&a) < k) { - fprintf (stderr, "prime has %4d bits left\r", k - mp_count_bits (&a)); - fflush (stderr); - top: - mp_set (&b, prime_digit ()); - - /* now compute z = a * b * 2 */ - if ((res = mp_mul (&a, &b, &z)) != MP_OKAY) { /* z = a * b */ - goto LBL_Z; - } - - if ((res = mp_copy (&z, &c)) != MP_OKAY) { /* c = a * b */ - goto LBL_Z; - } - - if ((res = mp_mul_2 (&z, &z)) != MP_OKAY) { /* z = 2 * a * b */ - goto LBL_Z; - } - - /* n = z + 1 */ - if ((res = mp_add_d (&z, 1, &n)) != MP_OKAY) { /* n = z + 1 */ - goto LBL_Z; - } - - /* check (n, v) == 1 */ - if ((res = mp_gcd (&n, &v, &y)) != MP_OKAY) { /* y = (n, v) */ - goto LBL_Z; - } - - if (mp_cmp_d (&y, 1) != MP_EQ) - goto top; - - /* now try base x=bases[ii] */ - for (ii = 0; ii < li; ii++) { - mp_set (&x, bases[ii]); - - /* compute x^a mod n */ - if ((res = mp_exptmod (&x, &a, &n, &y)) != MP_OKAY) { /* y = x^a mod n */ - goto LBL_Z; - } - - /* if y == 1 loop */ - if (mp_cmp_d (&y, 1) == MP_EQ) - continue; - - /* now x^2a mod n */ - if ((res = mp_sqrmod (&y, &n, &y)) != MP_OKAY) { /* y = x^2a mod n */ - goto LBL_Z; - } - - if (mp_cmp_d (&y, 1) == MP_EQ) - continue; - - /* compute x^b mod n */ - if ((res = mp_exptmod (&x, &b, &n, &y)) != MP_OKAY) { /* y = x^b mod n */ - goto LBL_Z; - } - - /* if y == 1 loop */ - if (mp_cmp_d (&y, 1) == MP_EQ) - continue; - - /* now x^2b mod n */ - if ((res = mp_sqrmod (&y, &n, &y)) != MP_OKAY) { /* y = x^2b mod n */ - goto LBL_Z; - } - - if (mp_cmp_d (&y, 1) == MP_EQ) - continue; - - /* compute x^c mod n == x^ab mod n */ - if ((res = mp_exptmod (&x, &c, &n, &y)) != MP_OKAY) { /* y = x^ab mod n */ - goto LBL_Z; - } - - /* if y == 1 loop */ - if (mp_cmp_d (&y, 1) == MP_EQ) - continue; - - /* now compute (x^c mod n)^2 */ - if ((res = mp_sqrmod (&y, &n, &y)) != MP_OKAY) { /* y = x^2ab mod n */ - goto LBL_Z; - } - - /* y should be 1 */ - if (mp_cmp_d (&y, 1) != MP_EQ) - continue; - break; - } - - /* no bases worked? */ - if (ii == li) - goto top; - -{ - char buf[4096]; - - mp_toradix(&n, buf, 10); - printf("Certificate of primality for:\n%s\n\n", buf); - mp_toradix(&a, buf, 10); - printf("A == \n%s\n\n", buf); - mp_toradix(&b, buf, 10); - printf("B == \n%s\n\nG == %d\n", buf, bases[ii]); - printf("----------------------------------------------------------------\n"); -} - - /* a = n */ - mp_copy (&n, &a); - } - - /* get q to be the order of the large prime subgroup */ - mp_sub_d (&n, 1, q); - mp_div_2 (q, q); - mp_div (q, &b, q, NULL); - - mp_exch (&n, p); - - res = MP_OKAY; -LBL_Z:mp_clear (&z); -LBL_Y:mp_clear (&y); -LBL_X:mp_clear (&x); -LBL_N:mp_clear (&n); -LBL_B:mp_clear (&b); -LBL_A:mp_clear (&a); -LBL_V:mp_clear (&v); -LBL_C:mp_clear (&c); - return res; -} - - -int -main (void) -{ - mp_int p, q; - char buf[4096]; - int k, li; - clock_t t1; - - srand (time (NULL)); - load_tab(); - - printf ("Enter # of bits: \n"); - fgets (buf, sizeof (buf), stdin); - sscanf (buf, "%d", &k); - - printf ("Enter number of bases to try (1 to 8):\n"); - fgets (buf, sizeof (buf), stdin); - sscanf (buf, "%d", &li); - - - mp_init (&p); - mp_init (&q); - - t1 = clock (); - pprime (k, li, &p, &q); - t1 = clock () - t1; - - printf ("\n\nTook %ld ticks, %d bits\n", t1, mp_count_bits (&p)); - - mp_toradix (&p, buf, 10); - printf ("P == %s\n", buf); - mp_toradix (&q, buf, 10); - printf ("Q == %s\n", buf); - - return 0; -} - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/etc/prime.1024 b/libtommath/etc/prime.1024 deleted file mode 100644 index 5636e2d..0000000 --- a/libtommath/etc/prime.1024 +++ /dev/null @@ -1,414 +0,0 @@ -Enter # of bits: -Enter number of bases to try (1 to 8): -Certificate of primality for: -36360080703173363 - -A == -89963569 - -B == -202082249 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -4851595597739856136987139 - -A == -36360080703173363 - -B == -66715963 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -19550639734462621430325731591027 - -A == -4851595597739856136987139 - -B == -2014867 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -10409036141344317165691858509923818734539 - -A == -19550639734462621430325731591027 - -B == -266207047 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1049829549988285012736475602118094726647504414203 - -A == -10409036141344317165691858509923818734539 - -B == -50428759 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -77194737385528288387712399596835459931920358844586615003 - -A == -1049829549988285012736475602118094726647504414203 - -B == -36765367 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -35663756695365208574443215955488689578374232732893628896541201763 - -A == -77194737385528288387712399596835459931920358844586615003 - -B == -230998627 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -16711831463502165169495622246023119698415848120292671294127567620396469803 - -A == -35663756695365208574443215955488689578374232732893628896541201763 - -B == -234297127 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -6163534781560285962890718925972249753147470953579266394395432475622345597103528739 - -A == -16711831463502165169495622246023119698415848120292671294127567620396469803 - -B == -184406323 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -814258256205243497704094951432575867360065658372158511036259934640748088306764553488803787 - -A == -6163534781560285962890718925972249753147470953579266394395432475622345597103528739 - -B == -66054487 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -176469695533271657902814176811660357049007467856432383037590673407330246967781451723764079581998187 - -A == -814258256205243497704094951432575867360065658372158511036259934640748088306764553488803787 - -B == -108362239 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -44924492859445516541759485198544012102424796403707253610035148063863073596051272171194806669756971406400419 - -A == -176469695533271657902814176811660357049007467856432383037590673407330246967781451723764079581998187 - -B == -127286707 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -20600996927219343383225424320134474929609459588323857796871086845924186191561749519858600696159932468024710985371059 - -A == -44924492859445516541759485198544012102424796403707253610035148063863073596051272171194806669756971406400419 - -B == -229284691 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -6295696427695493110141186605837397185848992307978456138112526915330347715236378041486547994708748840844217371233735072572979 - -A == -20600996927219343383225424320134474929609459588323857796871086845924186191561749519858600696159932468024710985371059 - -B == -152800771 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -3104984078042317488749073016454213579257792635142218294052134804187631661145261015102617582090263808696699966840735333252107678792123 - -A == -6295696427695493110141186605837397185848992307978456138112526915330347715236378041486547994708748840844217371233735072572979 - -B == -246595759 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -26405175827665701256325699315126705508919255051121452292124404943796947287968603975320562847910946802396632302209435206627913466015741799499 - -A == -3104984078042317488749073016454213579257792635142218294052134804187631661145261015102617582090263808696699966840735333252107678792123 - -B == -4252063 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -11122146237908413610034600609460545703591095894418599759742741406628055069007082998134905595800236452010905900391505454890446585211975124558601770163 - -A == -26405175827665701256325699315126705508919255051121452292124404943796947287968603975320562847910946802396632302209435206627913466015741799499 - -B == -210605419 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1649861642047798890580354082088712649911849362201343649289384923147797960364736011515757482030049342943790127685185806092659832129486307035500638595572396187 - -A == -11122146237908413610034600609460545703591095894418599759742741406628055069007082998134905595800236452010905900391505454890446585211975124558601770163 - -B == -74170111 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -857983367126266717607389719637086684134462613006415859877666235955788392464081914127715967940968197765042399904117392707518175220864852816390004264107201177394565363 - -A == -1649861642047798890580354082088712649911849362201343649289384923147797960364736011515757482030049342943790127685185806092659832129486307035500638595572396187 - -B == -260016763 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -175995909353623703257072120479340610010337144085688850745292031336724691277374210929188442230237711063783727092685448718515661641054886101716698390145283196296702450566161283 - -A == -857983367126266717607389719637086684134462613006415859877666235955788392464081914127715967940968197765042399904117392707518175220864852816390004264107201177394565363 - -B == -102563707 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -48486002551155667224487059713350447239190772068092630563272168418880661006593537218144160068395218642353495339720640699721703003648144463556291315694787862009052641640656933232794283 - -A == -175995909353623703257072120479340610010337144085688850745292031336724691277374210929188442230237711063783727092685448718515661641054886101716698390145283196296702450566161283 - -B == -137747527 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -13156468011529105025061495011938518171328604045212410096476697450506055664012861932372156505805788068791146986282263016790631108386790291275939575123375304599622623328517354163964228279867403 - -A == -48486002551155667224487059713350447239190772068092630563272168418880661006593537218144160068395218642353495339720640699721703003648144463556291315694787862009052641640656933232794283 - -B == -135672847 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -6355194692790533601105154341731997464407930009404822926832136060319955058388106456084549316415200519472481147942263916585428906582726749131479465958107142228236909665306781538860053107680830113869123 - -A == -13156468011529105025061495011938518171328604045212410096476697450506055664012861932372156505805788068791146986282263016790631108386790291275939575123375304599622623328517354163964228279867403 - -B == -241523587 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -3157116676535430302794438027544146642863331358530722860333745617571010460905857862561870488000265751138954271040017454405707755458702044884023184574412221802502351503929935224995314581932097706874819348858083 - -A == -6355194692790533601105154341731997464407930009404822926832136060319955058388106456084549316415200519472481147942263916585428906582726749131479465958107142228236909665306781538860053107680830113869123 - -B == -248388667 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -390533129219992506725320633489467713907837370444962163378727819939092929448752905310115311180032249230394348337568973177802874166228132778126338883671958897238722734394783244237133367055422297736215754829839364158067 - -A == -3157116676535430302794438027544146642863331358530722860333745617571010460905857862561870488000265751138954271040017454405707755458702044884023184574412221802502351503929935224995314581932097706874819348858083 - -B == -61849651 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -48583654555070224891047847050732516652910250240135992225139515777200432486685999462997073444468380434359929499498804723793106565291183220444221080449740542884172281158126259373095216435009661050109711341419005972852770440739 - -A == -390533129219992506725320633489467713907837370444962163378727819939092929448752905310115311180032249230394348337568973177802874166228132778126338883671958897238722734394783244237133367055422297736215754829839364158067 - -B == -62201707 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -25733035251905120039135866524384525138869748427727001128764704499071378939227862068500633813538831598776578372709963673670934388213622433800015759585470542686333039614931682098922935087822950084908715298627996115185849260703525317419 - -A == -48583654555070224891047847050732516652910250240135992225139515777200432486685999462997073444468380434359929499498804723793106565291183220444221080449740542884172281158126259373095216435009661050109711341419005972852770440739 - -B == -264832231 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -2804594464939948901906623499531073917980499195397462605359913717827014360538186518540781517129548650937632008683280555602633122170458773895504894807182664540529077836857897972175530148107545939211339044386106111633510166695386323426241809387 - -A == -25733035251905120039135866524384525138869748427727001128764704499071378939227862068500633813538831598776578372709963673670934388213622433800015759585470542686333039614931682098922935087822950084908715298627996115185849260703525317419 - -B == -54494047 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -738136612083433720096707308165797114449914259256979340471077690416567237592465306112484843530074782721390528773594351482384711900456440808251196845265132086486672447136822046628407467459921823150600138073268385534588238548865012638209515923513516547 - -A == -2804594464939948901906623499531073917980499195397462605359913717827014360538186518540781517129548650937632008683280555602633122170458773895504894807182664540529077836857897972175530148107545939211339044386106111633510166695386323426241809387 - -B == -131594179 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -392847529056126766528615419937165193421166694172790666626558750047057558168124866940509180171236517681470100877687445134633784815352076138790217228749332398026714192707447855731679485746120589851992221508292976900578299504461333767437280988393026452846013683 - -A == -738136612083433720096707308165797114449914259256979340471077690416567237592465306112484843530074782721390528773594351482384711900456440808251196845265132086486672447136822046628407467459921823150600138073268385534588238548865012638209515923513516547 - -B == -266107603 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -168459393231883505975876919268398655632763956627405508859662408056221544310200546265681845397346956580604208064328814319465940958080244889692368602591598503944015835190587740756859842792554282496742843600573336023639256008687581291233481455395123454655488735304365627 - -A == -392847529056126766528615419937165193421166694172790666626558750047057558168124866940509180171236517681470100877687445134633784815352076138790217228749332398026714192707447855731679485746120589851992221508292976900578299504461333767437280988393026452846013683 - -B == -214408111 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -14865774288636941404884923981945833072113667565310054952177860608355263252462409554658728941191929400198053290113492910272458441655458514080123870132092365833472436407455910185221474386718838138135065780840839893113912689594815485706154461164071775481134379794909690501684643 - -A == -168459393231883505975876919268398655632763956627405508859662408056221544310200546265681845397346956580604208064328814319465940958080244889692368602591598503944015835190587740756859842792554282496742843600573336023639256008687581291233481455395123454655488735304365627 - -B == -44122723 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1213301773203241614897109856134894783021668292000023984098824423682568173639394290886185366993108292039068940333907505157813934962357206131450244004178619265868614859794316361031904412926604138893775068853175215502104744339658944443630407632290152772487455298652998368296998719996019 - -A == -14865774288636941404884923981945833072113667565310054952177860608355263252462409554658728941191929400198053290113492910272458441655458514080123870132092365833472436407455910185221474386718838138135065780840839893113912689594815485706154461164071775481134379794909690501684643 - -B == -40808563 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -186935245989515158127969129347464851990429060640910951266513740972248428651109062997368144722015290092846666943896556191257222521203647606911446635194198213436423080005867489516421559330500722264446765608763224572386410155413161172707802334865729654109050873820610813855041667633843601286843 - -A == -1213301773203241614897109856134894783021668292000023984098824423682568173639394290886185366993108292039068940333907505157813934962357206131450244004178619265868614859794316361031904412926604138893775068853175215502104744339658944443630407632290152772487455298652998368296998719996019 - -B == -77035759 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -83142661079751490510739960019112406284111408348732592580459037404394946037094409915127399165633756159385609671956087845517678367844901424617866988187132480585966721962585586730693443536100138246516868613250009028187662080828012497191775172228832247706080044971423654632146928165751885302331924491683 - -A == -186935245989515158127969129347464851990429060640910951266513740972248428651109062997368144722015290092846666943896556191257222521203647606911446635194198213436423080005867489516421559330500722264446765608763224572386410155413161172707802334865729654109050873820610813855041667633843601286843 - -B == -222383587 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -3892354773803809855317742245039794448230625839512638747643814927766738642436392673485997449586432241626440927010641564064764336402368634186618250134234189066179771240232458249806850838490410473462391401438160528157981942499581634732706904411807195259620779379274017704050790865030808501633772117217899534443 - -A == -83142661079751490510739960019112406284111408348732592580459037404394946037094409915127399165633756159385609671956087845517678367844901424617866988187132480585966721962585586730693443536100138246516868613250009028187662080828012497191775172228832247706080044971423654632146928165751885302331924491683 - -B == -23407687 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1663606652988091811284014366560171522582683318514519379924950390627250155440313691226744227787921928894551755219495501365555370027257568506349958010457682898612082048959464465369892842603765280317696116552850664773291371490339084156052244256635115997453399761029567033971998617303988376172539172702246575225837054723 - -A == -3892354773803809855317742245039794448230625839512638747643814927766738642436392673485997449586432241626440927010641564064764336402368634186618250134234189066179771240232458249806850838490410473462391401438160528157981942499581634732706904411807195259620779379274017704050790865030808501633772117217899534443 - -B == -213701827 - -G == 2 ----------------------------------------------------------------- - - -Took 33057 ticks, 1048 bits -P == 1663606652988091811284014366560171522582683318514519379924950390627250155440313691226744227787921928894551755219495501365555370027257568506349958010457682898612082048959464465369892842603765280317696116552850664773291371490339084156052244256635115997453399761029567033971998617303988376172539172702246575225837054723 -Q == 3892354773803809855317742245039794448230625839512638747643814927766738642436392673485997449586432241626440927010641564064764336402368634186618250134234189066179771240232458249806850838490410473462391401438160528157981942499581634732706904411807195259620779379274017704050790865030808501633772117217899534443 diff --git a/libtommath/etc/prime.512 b/libtommath/etc/prime.512 deleted file mode 100644 index cb6ec30..0000000 --- a/libtommath/etc/prime.512 +++ /dev/null @@ -1,205 +0,0 @@ -Enter # of bits: -Enter number of bases to try (1 to 8): -Certificate of primality for: -85933926807634727 - -A == -253758023 - -B == -169322581 - -G == 5 ----------------------------------------------------------------- -Certificate of primality for: -23930198825086241462113799 - -A == -85933926807634727 - -B == -139236037 - -G == 11 ----------------------------------------------------------------- -Certificate of primality for: -6401844647261612602378676572510019 - -A == -23930198825086241462113799 - -B == -133760791 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -269731366027728777712034888684015329354259 - -A == -6401844647261612602378676572510019 - -B == -21066691 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -37942338209025571690075025099189467992329684223707 - -A == -269731366027728777712034888684015329354259 - -B == -70333567 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -15306904714258982484473490774101705363308327436988160248323 - -A == -37942338209025571690075025099189467992329684223707 - -B == -201712723 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1616744757018513392810355191503853040357155275733333124624513530099 - -A == -15306904714258982484473490774101705363308327436988160248323 - -B == -52810963 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -464222094814208047161771036072622485188658077940154689939306386289983787983 - -A == -1616744757018513392810355191503853040357155275733333124624513530099 - -B == -143566909 - -G == 5 ----------------------------------------------------------------- -Certificate of primality for: -187429931674053784626487560729643601208757374994177258429930699354770049369025096447 - -A == -464222094814208047161771036072622485188658077940154689939306386289983787983 - -B == -201875281 - -G == 5 ----------------------------------------------------------------- -Certificate of primality for: -100579220846502621074093727119851331775052664444339632682598589456666938521976625305832917563 - -A == -187429931674053784626487560729643601208757374994177258429930699354770049369025096447 - -B == -268311523 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1173616081309758475197022137833792133815753368965945885089720153370737965497134878651384030219765163 - -A == -100579220846502621074093727119851331775052664444339632682598589456666938521976625305832917563 - -B == -5834287 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -191456913489905913185935197655672585713573070349044195411728114905691721186574907738081340754373032735283623 - -A == -1173616081309758475197022137833792133815753368965945885089720153370737965497134878651384030219765163 - -B == -81567097 - -G == 5 ----------------------------------------------------------------- -Certificate of primality for: -57856530489201750164178576399448868489243874083056587683743345599898489554401618943240901541005080049321706789987519 - -A == -191456913489905913185935197655672585713573070349044195411728114905691721186574907738081340754373032735283623 - -B == -151095433 - -G == 7 ----------------------------------------------------------------- -Certificate of primality for: -13790529750452576698109671710773784949185621244122040804792403407272729038377767162233653248852099545134831722512085881814803 - -A == -57856530489201750164178576399448868489243874083056587683743345599898489554401618943240901541005080049321706789987519 - -B == -119178679 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -7075985989000817742677547821106534174334812111605018857703825637170140040509067704269696198231266351631132464035671858077052876058979 - -A == -13790529750452576698109671710773784949185621244122040804792403407272729038377767162233653248852099545134831722512085881814803 - -B == -256552363 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -1227273006232588072907488910282307435921226646895131225407452056677899411162892829564455154080310937471747140942360789623819327234258162420463 - -A == -7075985989000817742677547821106534174334812111605018857703825637170140040509067704269696198231266351631132464035671858077052876058979 - -B == -86720989 - -G == 5 ----------------------------------------------------------------- -Certificate of primality for: -446764896913554613686067036908702877942872355053329937790398156069936255759889884246832779737114032666318220500106499161852193765380831330106375235763 - -A == -1227273006232588072907488910282307435921226646895131225407452056677899411162892829564455154080310937471747140942360789623819327234258162420463 - -B == -182015287 - -G == 2 ----------------------------------------------------------------- -Certificate of primality for: -5290203010849586596974953717018896543907195901082056939587768479377028575911127944611236020459652034082251335583308070846379514569838984811187823420951275243 - -A == -446764896913554613686067036908702877942872355053329937790398156069936255759889884246832779737114032666318220500106499161852193765380831330106375235763 - -B == -5920567 - -G == 2 ----------------------------------------------------------------- - - -Took 3454 ticks, 521 bits -P == 5290203010849586596974953717018896543907195901082056939587768479377028575911127944611236020459652034082251335583308070846379514569838984811187823420951275243 -Q == 446764896913554613686067036908702877942872355053329937790398156069936255759889884246832779737114032666318220500106499161852193765380831330106375235763 diff --git a/libtommath/etc/timer.asm b/libtommath/etc/timer.asm deleted file mode 100644 index 326a947..0000000 --- a/libtommath/etc/timer.asm +++ /dev/null @@ -1,37 +0,0 @@ -; x86 timer in NASM -; -; Tom St Denis, tomstdenis@iahu.ca -[bits 32] -[section .data] -time dd 0, 0 - -[section .text] - -%ifdef USE_ELF -[global t_start] -t_start: -%else -[global _t_start] -_t_start: -%endif - push edx - push eax - rdtsc - mov [time+0],edx - mov [time+4],eax - pop eax - pop edx - ret - -%ifdef USE_ELF -[global t_read] -t_read: -%else -[global _t_read] -_t_read: -%endif - rdtsc - sub eax,[time+4] - sbb edx,[time+0] - ret - \ No newline at end of file diff --git a/libtommath/etc/tune.c b/libtommath/etc/tune.c deleted file mode 100644 index c2ac998..0000000 --- a/libtommath/etc/tune.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Tune the Karatsuba parameters - * - * Tom St Denis, tomstdenis@gmail.com - */ -#include -#include - -/* how many times todo each size mult. Depends on your computer. For slow computers - * this can be low like 5 or 10. For fast [re: Athlon] should be 25 - 50 or so - */ -#define TIMES (1UL<<14UL) - -#ifndef X86_TIMER - -/* RDTSC from Scott Duplichan */ -static ulong64 TIMFUNC (void) - { - #if defined __GNUC__ - #if defined(__i386__) || defined(__x86_64__) - /* version from http://www.mcs.anl.gov/~kazutomo/rdtsc.html - * the old code always got a warning issued by gcc, clang did not complain... - */ - unsigned hi, lo; - __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); - return ((ulong64)lo)|( ((ulong64)hi)<<32); - #else /* gcc-IA64 version */ - unsigned long result; - __asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory"); - while (__builtin_expect ((int) result == -1, 0)) - __asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory"); - return result; - #endif - - // Microsoft and Intel Windows compilers - #elif defined _M_IX86 - __asm rdtsc - #elif defined _M_AMD64 - return __rdtsc (); - #elif defined _M_IA64 - #if defined __INTEL_COMPILER - #include - #endif - return __getReg (3116); - #else - #error need rdtsc function for this build - #endif - } - - -/* generic ISO C timer */ -ulong64 LBL_T; -void t_start(void) { LBL_T = TIMFUNC(); } -ulong64 t_read(void) { return TIMFUNC() - LBL_T; } - -#else -extern void t_start(void); -extern ulong64 t_read(void); -#endif - -ulong64 time_mult(int size, int s) -{ - unsigned long x; - mp_int a, b, c; - ulong64 t1; - - mp_init (&a); - mp_init (&b); - mp_init (&c); - - mp_rand (&a, size); - mp_rand (&b, size); - - if (s == 1) { - KARATSUBA_MUL_CUTOFF = size; - } else { - KARATSUBA_MUL_CUTOFF = 100000; - } - - t_start(); - for (x = 0; x < TIMES; x++) { - mp_mul(&a,&b,&c); - } - t1 = t_read(); - mp_clear (&a); - mp_clear (&b); - mp_clear (&c); - return t1; -} - -ulong64 time_sqr(int size, int s) -{ - unsigned long x; - mp_int a, b; - ulong64 t1; - - mp_init (&a); - mp_init (&b); - - mp_rand (&a, size); - - if (s == 1) { - KARATSUBA_SQR_CUTOFF = size; - } else { - KARATSUBA_SQR_CUTOFF = 100000; - } - - t_start(); - for (x = 0; x < TIMES; x++) { - mp_sqr(&a,&b); - } - t1 = t_read(); - mp_clear (&a); - mp_clear (&b); - return t1; -} - -int -main (void) -{ - ulong64 t1, t2; - int x, y; - - for (x = 8; ; x += 2) { - t1 = time_mult(x, 0); - t2 = time_mult(x, 1); - printf("%d: %9llu %9llu, %9llu\n", x, t1, t2, t2 - t1); - if (t2 < t1) break; - } - y = x; - - for (x = 8; ; x += 2) { - t1 = time_sqr(x, 0); - t2 = time_sqr(x, 1); - printf("%d: %9llu %9llu, %9llu\n", x, t1, t2, t2 - t1); - if (t2 < t1) break; - } - printf("KARATSUBA_MUL_CUTOFF = %d\n", y); - printf("KARATSUBA_SQR_CUTOFF = %d\n", x); - - return 0; -} - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/filter.pl b/libtommath/filter.pl deleted file mode 100755 index a8a50c7..0000000 --- a/libtommath/filter.pl +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/perl - -# we want to filter every between START_INS and END_INS out and then insert crap from another file (this is fun) - -$dst = shift; -$ins = shift; - -open(SRC,"<$dst"); -open(INS,"<$ins"); -open(TMP,">tmp.delme"); - -$l = 0; -while () { - if ($_ =~ /START_INS/) { - print TMP $_; - $l = 1; - while () { - print TMP $_; - } - close INS; - } elsif ($_ =~ /END_INS/) { - print TMP $_; - $l = 0; - } elsif ($l == 0) { - print TMP $_; - } -} - -close TMP; -close SRC; - -# $Source$ -# $Revision$ -# $Date$ diff --git a/libtommath/gen.pl b/libtommath/gen.pl deleted file mode 100644 index 57f65ac..0000000 --- a/libtommath/gen.pl +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/perl -w -# -# Generates a "single file" you can use to quickly -# add the whole source without any makefile troubles -# -use strict; - -open( OUT, ">mpi.c" ) or die "Couldn't open mpi.c for writing: $!"; -foreach my $filename (glob "bn*.c") { - open( SRC, "<$filename" ) or die "Couldn't open $filename for reading: $!"; - print OUT "/* Start: $filename */\n"; - print OUT while ; - print OUT "\n/* End: $filename */\n\n"; - close SRC or die "Error closing $filename after reading: $!"; -} -print OUT "\n/* EOF */\n"; -close OUT or die "Error closing mpi.c after writing: $!"; - -system('perl -pli -e "s/\s*$//" mpi.c'); diff --git a/libtommath/genlist.sh b/libtommath/genlist.sh deleted file mode 100755 index 1f53b66..0000000 --- a/libtommath/genlist.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -export a=`find . -maxdepth 1 -type f -name '*.c' | sort | sed -e 'sE\./EE' | sed -e 's/\.c/\.o/' | xargs` -perl ./parsenames.pl OBJECTS "$a" - -# $Source$ -# $Revision$ -# $Date$ diff --git a/libtommath/libtommath.dsp b/libtommath/libtommath.dsp deleted file mode 100644 index 71ac243..0000000 --- a/libtommath/libtommath.dsp +++ /dev/null @@ -1,572 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libtommath" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=libtommath - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "libtommath.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libtommath.mak" CFG="libtommath - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libtommath - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "libtommath - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "libtommath" -# PROP Scc_LocalPath "." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libtommath - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"Release\tommath.lib" - -!ELSEIF "$(CFG)" == "libtommath - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"Debug\tommath.lib" - -!ENDIF - -# Begin Target - -# Name "libtommath - Win32 Release" -# Name "libtommath - Win32 Debug" -# Begin Source File - -SOURCE=.\bn_error.c -# End Source File -# Begin Source File - -SOURCE=.\bn_fast_mp_invmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_fast_mp_montgomery_reduce.c -# End Source File -# Begin Source File - -SOURCE=.\bn_fast_s_mp_mul_digs.c -# End Source File -# Begin Source File - -SOURCE=.\bn_fast_s_mp_mul_high_digs.c -# End Source File -# Begin Source File - -SOURCE=.\bn_fast_s_mp_sqr.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_2expt.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_abs.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_add.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_add_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_addmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_and.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_clamp.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_clear.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_clear_multi.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_cmp.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_cmp_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_cmp_mag.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_cnt_lsb.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_copy.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_count_bits.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_div.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_div_2.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_div_2d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_div_3.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_div_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_dr_is_modulus.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_dr_reduce.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_dr_setup.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_exch.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_expt_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_exptmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_exptmod_fast.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_exteuclid.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_fread.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_fwrite.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_gcd.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_get_int.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_grow.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_init.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_init_copy.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_init_multi.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_init_set.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_init_set_int.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_init_size.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_invmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_invmod_slow.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_is_square.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_jacobi.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_karatsuba_mul.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_karatsuba_sqr.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_lcm.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_lshd.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mod_2d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mod_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_montgomery_calc_normalization.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_montgomery_reduce.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_montgomery_setup.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mul.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mul_2.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mul_2d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mul_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_mulmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_n_root.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_neg.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_or.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_fermat.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_is_divisible.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_is_prime.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_miller_rabin.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_next_prime.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_rabin_miller_trials.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_prime_random_ex.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_radix_size.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_radix_smap.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_rand.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_read_radix.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_read_signed_bin.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_read_unsigned_bin.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_2k.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_2k_l.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_2k_setup.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_2k_setup_l.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_is_2k.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_is_2k_l.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_reduce_setup.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_rshd.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_set.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_set_int.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_shrink.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_signed_bin_size.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_sqr.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_sqrmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_sqrt.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_sub.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_sub_d.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_submod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_to_signed_bin.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_to_signed_bin_n.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_to_unsigned_bin.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_to_unsigned_bin_n.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_toom_mul.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_toom_sqr.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_toradix.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_toradix_n.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_unsigned_bin_size.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_xor.c -# End Source File -# Begin Source File - -SOURCE=.\bn_mp_zero.c -# End Source File -# Begin Source File - -SOURCE=.\bn_prime_tab.c -# End Source File -# Begin Source File - -SOURCE=.\bn_reverse.c -# End Source File -# Begin Source File - -SOURCE=.\bn_s_mp_add.c -# End Source File -# Begin Source File - -SOURCE=.\bn_s_mp_exptmod.c -# End Source File -# Begin Source File - -SOURCE=.\bn_s_mp_mul_digs.c -# End Source File -# Begin Source File - -SOURCE=.\bn_s_mp_mul_high_digs.c -# End Source File -# Begin Source File - -SOURCE=.\bn_s_mp_sqr.c -# End Source File -# Begin Source File - -SOURCE=.\bn_s_mp_sub.c -# End Source File -# Begin Source File - -SOURCE=.\bncore.c -# End Source File -# Begin Source File - -SOURCE=.\tommath.h -# End Source File -# Begin Source File - -SOURCE=.\tommath_class.h -# End Source File -# Begin Source File - -SOURCE=.\tommath_superclass.h -# End Source File -# End Target -# End Project diff --git a/libtommath/libtommath_VS2005.sln b/libtommath/libtommath_VS2005.sln deleted file mode 100644 index 21bc915..0000000 --- a/libtommath/libtommath_VS2005.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtommath", "libtommath_VS2005.vcproj", "{0272C9B2-D68B-4F24-B32D-C1FD552F7E51}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Debug|Win32.ActiveCfg = Debug|Win32 - {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Debug|Win32.Build.0 = Debug|Win32 - {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Release|Win32.ActiveCfg = Release|Win32 - {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/libtommath/libtommath_VS2005.vcproj b/libtommath/libtommath_VS2005.vcproj deleted file mode 100644 index e92c7be..0000000 --- a/libtommath/libtommath_VS2005.vcproj +++ /dev/null @@ -1,2847 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libtommath/libtommath_VS2008.sln b/libtommath/libtommath_VS2008.sln deleted file mode 100644 index 1327ccf..0000000 --- a/libtommath/libtommath_VS2008.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtommath", "libtommath_VS2008.vcproj", "{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Debug|Win32.ActiveCfg = Debug|Win32 - {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Debug|Win32.Build.0 = Debug|Win32 - {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Release|Win32.ActiveCfg = Release|Win32 - {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/libtommath/libtommath_VS2008.vcproj b/libtommath/libtommath_VS2008.vcproj deleted file mode 100644 index 7503d22..0000000 --- a/libtommath/libtommath_VS2008.vcproj +++ /dev/null @@ -1,2813 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libtommath/logs/README b/libtommath/logs/README deleted file mode 100644 index 965e7c8..0000000 --- a/libtommath/logs/README +++ /dev/null @@ -1,13 +0,0 @@ -To use the pretty graphs you have to first build/run the ltmtest from the root directory of the package. -Todo this type - -make timing ; ltmtest - -in the root. It will run for a while [about ten minutes on most PCs] and produce a series of .log files in logs/. - -After doing that run "gnuplot graphs.dem" to make the PNGs. If you managed todo that all so far just open index.html to view -them all :-) - -Have fun - -Tom \ No newline at end of file diff --git a/libtommath/logs/add.log b/libtommath/logs/add.log deleted file mode 100644 index 43503ac..0000000 --- a/libtommath/logs/add.log +++ /dev/null @@ -1,16 +0,0 @@ -480 87 -960 111 -1440 135 -1920 159 -2400 200 -2880 224 -3360 248 -3840 272 -4320 296 -4800 320 -5280 344 -5760 368 -6240 392 -6720 416 -7200 440 -7680 464 diff --git a/libtommath/logs/addsub.png b/libtommath/logs/addsub.png deleted file mode 100644 index a5679ac..0000000 Binary files a/libtommath/logs/addsub.png and /dev/null differ diff --git a/libtommath/logs/expt.log b/libtommath/logs/expt.log deleted file mode 100644 index 70932ab..0000000 --- a/libtommath/logs/expt.log +++ /dev/null @@ -1,7 +0,0 @@ -513 1435869 -769 3544970 -1025 7791638 -2049 46902238 -2561 85334899 -3073 141451412 -4097 308770310 diff --git a/libtommath/logs/expt.png b/libtommath/logs/expt.png deleted file mode 100644 index 9ee8bb7..0000000 Binary files a/libtommath/logs/expt.png and /dev/null differ diff --git a/libtommath/logs/expt_2k.log b/libtommath/logs/expt_2k.log deleted file mode 100644 index 97d325f..0000000 --- a/libtommath/logs/expt_2k.log +++ /dev/null @@ -1,5 +0,0 @@ -607 2109225 -1279 10148314 -2203 34126877 -3217 82716424 -4253 161569606 diff --git a/libtommath/logs/expt_2kl.log b/libtommath/logs/expt_2kl.log deleted file mode 100644 index d9ad4be..0000000 --- a/libtommath/logs/expt_2kl.log +++ /dev/null @@ -1,4 +0,0 @@ -1024 7705271 -2048 34286851 -4096 165207491 -521 1618631 diff --git a/libtommath/logs/expt_dr.log b/libtommath/logs/expt_dr.log deleted file mode 100644 index c6bbe07..0000000 --- a/libtommath/logs/expt_dr.log +++ /dev/null @@ -1,7 +0,0 @@ -532 1928550 -784 3763908 -1036 7564221 -1540 16566059 -2072 32283784 -3080 79851565 -4116 157843530 diff --git a/libtommath/logs/graphs.dem b/libtommath/logs/graphs.dem deleted file mode 100644 index dfaf613..0000000 --- a/libtommath/logs/graphs.dem +++ /dev/null @@ -1,17 +0,0 @@ -set terminal png -set size 1.75 -set ylabel "Cycles per Operation" -set xlabel "Operand size (bits)" - -set output "addsub.png" -plot 'add.log' smooth bezier title "Addition", 'sub.log' smooth bezier title "Subtraction" - -set output "mult.png" -plot 'sqr.log' smooth bezier title "Squaring (without Karatsuba)", 'sqr_kara.log' smooth bezier title "Squaring (Karatsuba)", 'mult.log' smooth bezier title "Multiplication (without Karatsuba)", 'mult_kara.log' smooth bezier title "Multiplication (Karatsuba)" - -set output "expt.png" -plot 'expt.log' smooth bezier title "Exptmod (Montgomery)", 'expt_dr.log' smooth bezier title "Exptmod (Dimminished Radix)", 'expt_2k.log' smooth bezier title "Exptmod (2k Reduction)" - -set output "invmod.png" -plot 'invmod.log' smooth bezier title "Modular Inverse" - diff --git a/libtommath/logs/index.html b/libtommath/logs/index.html deleted file mode 100644 index 4b68c25..0000000 --- a/libtommath/logs/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - -LibTomMath Log Plots - - - -

Addition and Subtraction

-
-
- -

Multipliers

-
-
- -

Exptmod

-
-
- -

Modular Inverse

-
-
- - - -/* $Source: /cvs/libtom/libtommath/logs/index.html,v $ */ -/* $Revision: 1.2 $ */ -/* $Date: 2005/05/05 14:38:47 $ */ diff --git a/libtommath/logs/invmod.log b/libtommath/logs/invmod.log deleted file mode 100644 index e69de29..0000000 diff --git a/libtommath/logs/invmod.png b/libtommath/logs/invmod.png deleted file mode 100644 index 0a8a4ad..0000000 Binary files a/libtommath/logs/invmod.png and /dev/null differ diff --git a/libtommath/logs/mult.log b/libtommath/logs/mult.log deleted file mode 100644 index 33563fc..0000000 --- a/libtommath/logs/mult.log +++ /dev/null @@ -1,84 +0,0 @@ -271 555 -390 855 -508 1161 -631 1605 -749 2117 -871 2687 -991 3329 -1108 4084 -1231 4786 -1351 5624 -1470 6392 -1586 7364 -1710 8218 -1830 9255 -1951 10217 -2067 11461 -2191 12463 -2308 13677 -2430 14800 -2551 16232 -2671 17460 -2791 18899 -2902 20247 -3028 21902 -3151 23240 -3267 24927 -3391 26441 -3511 28277 -3631 29838 -3749 31751 -3869 33673 -3989 35431 -4111 37518 -4231 39426 -4349 41504 -4471 43567 -4591 45786 -4711 47876 -4831 50299 -4951 52427 -5071 54785 -5189 57241 -5307 59730 -5431 62194 -5551 64761 -5670 67322 -5789 70073 -5907 72663 -6030 75437 -6151 78242 -6268 81202 -6389 83948 -6509 86985 -6631 89903 -6747 93184 -6869 96044 -6991 99286 -7109 102395 -7229 105917 -7351 108940 -7470 112490 -7589 115702 -7711 119508 -7831 122632 -7951 126410 -8071 129808 -8190 133895 -8311 137146 -8431 141218 -8549 144732 -8667 149131 -8790 152462 -8911 156754 -9030 160479 -9149 165138 -9271 168601 -9391 173185 -9511 176988 -9627 181976 -9751 185539 -9870 190388 -9991 194335 -10110 199605 -10228 203298 diff --git a/libtommath/logs/mult.png b/libtommath/logs/mult.png deleted file mode 100644 index 4f7a4ee..0000000 Binary files a/libtommath/logs/mult.png and /dev/null differ diff --git a/libtommath/logs/mult_kara.log b/libtommath/logs/mult_kara.log deleted file mode 100644 index 7136c79..0000000 --- a/libtommath/logs/mult_kara.log +++ /dev/null @@ -1,84 +0,0 @@ -271 560 -391 870 -511 1159 -631 1605 -750 2111 -871 2737 -991 3361 -1111 4054 -1231 4778 -1351 5600 -1471 6404 -1591 7323 -1710 8255 -1831 9239 -1948 10257 -2070 11397 -2190 12531 -2308 13665 -2429 14870 -2550 16175 -2671 17539 -2787 18879 -2911 20350 -3031 21807 -3150 23415 -3270 24897 -3388 26567 -3511 28205 -3627 30076 -3751 31744 -3869 33657 -3991 35425 -4111 37522 -4229 39363 -4351 41503 -4470 43491 -4590 45827 -4711 47795 -4828 50166 -4951 52318 -5070 54911 -5191 57036 -5308 58237 -5431 60248 -5551 62678 -5671 64786 -5791 67294 -5908 69343 -6031 71607 -6151 74166 -6271 76590 -6391 78734 -6511 81175 -6631 83742 -6750 86403 -6868 88873 -6990 91150 -7110 94211 -7228 96922 -7351 99445 -7469 102216 -7589 104968 -7711 108113 -7827 110758 -7950 113714 -8071 116511 -8186 119643 -8310 122679 -8425 125581 -8551 128715 -8669 131778 -8788 135116 -8910 138138 -9031 141628 -9148 144754 -9268 148367 -9391 151551 -9511 155033 -9631 158652 -9751 162125 -9871 165248 -9988 168627 -10111 172427 -10231 176412 diff --git a/libtommath/logs/sqr.log b/libtommath/logs/sqr.log deleted file mode 100644 index cd29fc5..0000000 --- a/libtommath/logs/sqr.log +++ /dev/null @@ -1,84 +0,0 @@ -265 562 -389 882 -509 1207 -631 1572 -750 1990 -859 2433 -991 2894 -1109 3555 -1230 4228 -1350 5018 -1471 5805 -1591 6579 -1709 7415 -1829 8329 -1949 9225 -2071 10139 -2188 11239 -2309 12178 -2431 13212 -2551 14294 -2671 15551 -2791 16512 -2911 17718 -3030 18876 -3150 20259 -3270 21374 -3391 22650 -3511 23948 -3631 25493 -3750 26756 -3870 28225 -3989 29705 -4110 31409 -4230 32834 -4351 34327 -4471 35818 -4591 37636 -4711 39228 -4830 40868 -4949 42393 -5070 44541 -5191 46269 -5310 48162 -5429 49728 -5548 51985 -5671 53948 -5791 55885 -5910 57584 -6031 60082 -6150 62239 -6270 64309 -6390 66014 -6511 68766 -6631 71012 -6750 73172 -6871 74952 -6991 77909 -7111 80371 -7231 82666 -7351 84531 -7469 87698 -7589 90318 -7711 225384 -7830 232428 -7950 240009 -8070 246522 -8190 253662 -8310 260961 -8431 269253 -8549 275743 -8671 283769 -8789 290811 -8911 300034 -9030 306873 -9149 315085 -9270 323944 -9390 332390 -9508 337519 -9631 348986 -9749 356904 -9871 367013 -9989 373831 -10108 381033 -10230 393475 diff --git a/libtommath/logs/sqr_kara.log b/libtommath/logs/sqr_kara.log deleted file mode 100644 index 06355a7..0000000 --- a/libtommath/logs/sqr_kara.log +++ /dev/null @@ -1,84 +0,0 @@ -271 560 -388 878 -511 1179 -629 1625 -751 1988 -871 2423 -989 2896 -1111 3561 -1231 4209 -1350 5015 -1470 5804 -1591 6556 -1709 7420 -1831 8263 -1951 9173 -2070 10153 -2191 11229 -2310 12167 -2431 13211 -2550 14309 -2671 15524 -2788 16525 -2910 17712 -3028 18822 -3148 20220 -3271 21343 -3391 22652 -3511 23944 -3630 25485 -3750 26778 -3868 28201 -3990 29653 -4111 31393 -4225 32841 -4350 34328 -4471 35786 -4590 37652 -4711 39245 -4830 40876 -4951 42433 -5068 44547 -5191 46321 -5311 48140 -5430 49727 -5550 52034 -5671 53954 -5791 55921 -5908 57597 -6031 60084 -6148 62226 -6270 64295 -6390 66045 -6511 68779 -6629 71003 -6751 73169 -6871 74992 -6991 77895 -7110 80376 -7231 82628 -7351 84468 -7470 87664 -7591 90284 -7711 91352 -7828 93995 -7950 96276 -8071 98691 -8190 101256 -8308 103631 -8431 105222 -8550 108343 -8671 110281 -8787 112764 -8911 115397 -9031 117690 -9151 120266 -9271 122715 -9391 124624 -9510 127937 -9630 130313 -9750 132914 -9871 136129 -9991 138517 -10108 141525 -10231 144225 diff --git a/libtommath/logs/sub.log b/libtommath/logs/sub.log deleted file mode 100644 index 9f84fa2..0000000 --- a/libtommath/logs/sub.log +++ /dev/null @@ -1,16 +0,0 @@ -480 94 -960 116 -1440 140 -1920 164 -2400 205 -2880 229 -3360 253 -3840 277 -4320 299 -4800 321 -5280 345 -5760 371 -6240 395 -6720 419 -7200 441 -7680 465 diff --git a/libtommath/makefile_include.mk b/libtommath/makefile_include.mk new file mode 100644 index 0000000..3a599e8 --- /dev/null +++ b/libtommath/makefile_include.mk @@ -0,0 +1,117 @@ +# +# Include makefile for libtommath +# + +#version of library +VERSION=1.0.1 +VERSION_PC=1.0.1 +VERSION_SO=1:1 + +PLATFORM := $(shell uname | sed -e 's/_.*//') + +# default make target +default: ${LIBNAME} + +# Compiler and Linker Names +ifndef CROSS_COMPILE + CROSS_COMPILE= +endif + +ifeq ($(CC),cc) + CC = $(CROSS_COMPILE)gcc +endif +LD=$(CROSS_COMPILE)ld +AR=$(CROSS_COMPILE)ar +RANLIB=$(CROSS_COMPILE)ranlib + +ifndef MAKE + MAKE=make +endif + +CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow + +ifndef NO_ADDTL_WARNINGS +# additional warnings +CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align +CFLAGS += -Wstrict-prototypes -Wpointer-arith +endif + +ifdef COMPILE_DEBUG +#debug +CFLAGS += -g3 +else + +ifdef COMPILE_SIZE +#for size +CFLAGS += -Os +else + +ifndef IGNORE_SPEED +#for speed +CFLAGS += -O3 -funroll-loops + +#x86 optimizations [should be valid for any GCC install though] +CFLAGS += -fomit-frame-pointer +endif + +endif # COMPILE_SIZE +endif # COMPILE_DEBUG + +ifneq ($(findstring clang,$(CC)),) +CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header +endif +ifeq ($(PLATFORM), Darwin) +CFLAGS += -Wno-nullability-completeness +endif + +# adjust coverage set +ifneq ($(filter $(shell arch), i386 i686 x86_64 amd64 ia64),) + COVERAGE = test_standalone timing + COVERAGE_APP = ./test && ./ltmtest +else + COVERAGE = test_standalone + COVERAGE_APP = ./test +endif + +HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h +HEADERS=tommath_private.h $(HEADERS_PUB) + +test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0 + +#LIBPATH The directory for libtommath to be installed to. +#INCPATH The directory to install the header files for libtommath. +#DATAPATH The directory to install the pdf docs. +DESTDIR ?= +PREFIX ?= /usr/local +LIBPATH ?= $(PREFIX)/lib +INCPATH ?= $(PREFIX)/include +DATAPATH ?= $(PREFIX)/share/doc/libtommath/pdf + +#make the code coverage of the library +# +coverage: CFLAGS += -fprofile-arcs -ftest-coverage -DTIMING_NO_LOGS +coverage: LFLAGS += -lgcov +coverage: LDFLAGS += -lgcov + +coverage: $(COVERAGE) + $(COVERAGE_APP) + +lcov: coverage + rm -f coverage.info + lcov --capture --no-external --no-recursion $(LCOV_ARGS) --output-file coverage.info -q + genhtml coverage.info --output-directory coverage -q + +# target that removes all coverage output +cleancov-clean: + rm -f `find . -type f -name "*.info" | xargs` + rm -rf coverage/ + +# cleans everything - coverage output and standard 'clean' +cleancov: cleancov-clean clean + +clean: + rm -f *.gcda *.gcno *.gcov *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \ + *.idx *.toc *.log *.aux *.dvi *.lof *.ind *.ilg *.ps *.log *.s mpi.c *.da *.dyn *.dpi tommath.tex `find . -type f | grep [~] | xargs` *.lo *.la + rm -rf .libs/ + ${MAKE} -C etc/ clean MAKE=${MAKE} + ${MAKE} -C doc/ clean MAKE=${MAKE} diff --git a/libtommath/mess.sh b/libtommath/mess.sh deleted file mode 100644 index bf639ce..0000000 --- a/libtommath/mess.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -if cvs log $1 >/dev/null 2>/dev/null; then exit 0; else echo "$1 shouldn't be here" ; exit 1; fi - - diff --git a/libtommath/mtest/logtab.h b/libtommath/mtest/logtab.h deleted file mode 100644 index 751111e..0000000 --- a/libtommath/mtest/logtab.h +++ /dev/null @@ -1,24 +0,0 @@ -const float s_logv_2[] = { - 0.000000000, 0.000000000, 1.000000000, 0.630929754, /* 0 1 2 3 */ - 0.500000000, 0.430676558, 0.386852807, 0.356207187, /* 4 5 6 7 */ - 0.333333333, 0.315464877, 0.301029996, 0.289064826, /* 8 9 10 11 */ - 0.278942946, 0.270238154, 0.262649535, 0.255958025, /* 12 13 14 15 */ - 0.250000000, 0.244650542, 0.239812467, 0.235408913, /* 16 17 18 19 */ - 0.231378213, 0.227670249, 0.224243824, 0.221064729, /* 20 21 22 23 */ - 0.218104292, 0.215338279, 0.212746054, 0.210309918, /* 24 25 26 27 */ - 0.208014598, 0.205846832, 0.203795047, 0.201849087, /* 28 29 30 31 */ - 0.200000000, 0.198239863, 0.196561632, 0.194959022, /* 32 33 34 35 */ - 0.193426404, 0.191958720, 0.190551412, 0.189200360, /* 36 37 38 39 */ - 0.187901825, 0.186652411, 0.185449023, 0.184288833, /* 40 41 42 43 */ - 0.183169251, 0.182087900, 0.181042597, 0.180031327, /* 44 45 46 47 */ - 0.179052232, 0.178103594, 0.177183820, 0.176291434, /* 48 49 50 51 */ - 0.175425064, 0.174583430, 0.173765343, 0.172969690, /* 52 53 54 55 */ - 0.172195434, 0.171441601, 0.170707280, 0.169991616, /* 56 57 58 59 */ - 0.169293808, 0.168613099, 0.167948779, 0.167300179, /* 60 61 62 63 */ - 0.166666667 -}; - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/mtest/mpi-config.h b/libtommath/mtest/mpi-config.h deleted file mode 100644 index fc2a885..0000000 --- a/libtommath/mtest/mpi-config.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Default configuration for MPI library */ -/* $Id$ */ - -#ifndef MPI_CONFIG_H_ -#define MPI_CONFIG_H_ - -/* - For boolean options, - 0 = no - 1 = yes - - Other options are documented individually. - - */ - -#ifndef MP_IOFUNC -#define MP_IOFUNC 0 /* include mp_print() ? */ -#endif - -#ifndef MP_MODARITH -#define MP_MODARITH 1 /* include modular arithmetic ? */ -#endif - -#ifndef MP_NUMTH -#define MP_NUMTH 1 /* include number theoretic functions? */ -#endif - -#ifndef MP_LOGTAB -#define MP_LOGTAB 1 /* use table of logs instead of log()? */ -#endif - -#ifndef MP_MEMSET -#define MP_MEMSET 1 /* use memset() to zero buffers? */ -#endif - -#ifndef MP_MEMCPY -#define MP_MEMCPY 1 /* use memcpy() to copy buffers? */ -#endif - -#ifndef MP_CRYPTO -#define MP_CRYPTO 1 /* erase memory on free? */ -#endif - -#ifndef MP_ARGCHK -/* - 0 = no parameter checks - 1 = runtime checks, continue execution and return an error to caller - 2 = assertions; dump core on parameter errors - */ -#define MP_ARGCHK 2 /* how to check input arguments */ -#endif - -#ifndef MP_DEBUG -#define MP_DEBUG 0 /* print diagnostic output? */ -#endif - -#ifndef MP_DEFPREC -#define MP_DEFPREC 64 /* default precision, in digits */ -#endif - -#ifndef MP_MACRO -#define MP_MACRO 1 /* use macros for frequent calls? */ -#endif - -#ifndef MP_SQUARE -#define MP_SQUARE 1 /* use separate squaring code? */ -#endif - -#ifndef MP_PTAB_SIZE -/* - When building mpprime.c, we build in a table of small prime - values to use for primality testing. The more you include, - the more space they take up. See primes.c for the possible - values (currently 16, 32, 64, 128, 256, and 6542) - */ -#define MP_PTAB_SIZE 128 /* how many built-in primes? */ -#endif - -#ifndef MP_COMPAT_MACROS -#define MP_COMPAT_MACROS 1 /* define compatibility macros? */ -#endif - -#endif /* ifndef MPI_CONFIG_H_ */ - - -/* crc==3287762869, version==2, Sat Feb 02 06:43:53 2002 */ - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/mtest/mpi-types.h b/libtommath/mtest/mpi-types.h deleted file mode 100644 index f99d7ee..0000000 --- a/libtommath/mtest/mpi-types.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Type definitions generated by 'types.pl' */ -typedef char mp_sign; -typedef unsigned short mp_digit; /* 2 byte type */ -typedef unsigned int mp_word; /* 4 byte type */ -typedef unsigned int mp_size; -typedef int mp_err; - -#define MP_DIGIT_BIT (CHAR_BIT*sizeof(mp_digit)) -#define MP_DIGIT_MAX USHRT_MAX -#define MP_WORD_BIT (CHAR_BIT*sizeof(mp_word)) -#define MP_WORD_MAX UINT_MAX - -#define MP_DIGIT_SIZE 2 -#define DIGIT_FMT "%04X" -#define RADIX (MP_DIGIT_MAX+1) - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/mtest/mpi.c b/libtommath/mtest/mpi.c deleted file mode 100644 index 48dbe27..0000000 --- a/libtommath/mtest/mpi.c +++ /dev/null @@ -1,3985 +0,0 @@ -/* - mpi.c - - by Michael J. Fromberger - Copyright (C) 1998 Michael J. Fromberger, All Rights Reserved - - Arbitrary precision integer arithmetic library - - $Id$ - */ - -#include "mpi.h" -#include -#include -#include - -#if MP_DEBUG -#include - -#define DIAG(T,V) {fprintf(stderr,T);mp_print(V,stderr);fputc('\n',stderr);} -#else -#define DIAG(T,V) -#endif - -/* - If MP_LOGTAB is not defined, use the math library to compute the - logarithms on the fly. Otherwise, use the static table below. - Pick which works best for your system. - */ -#if MP_LOGTAB - -/* {{{ s_logv_2[] - log table for 2 in various bases */ - -/* - A table of the logs of 2 for various bases (the 0 and 1 entries of - this table are meaningless and should not be referenced). - - This table is used to compute output lengths for the mp_toradix() - function. Since a number n in radix r takes up about log_r(n) - digits, we estimate the output size by taking the least integer - greater than log_r(n), where: - - log_r(n) = log_2(n) * log_r(2) - - This table, therefore, is a table of log_r(2) for 2 <= r <= 36, - which are the output bases supported. - */ - -#include "logtab.h" - -/* }}} */ -#define LOG_V_2(R) s_logv_2[(R)] - -#else - -#include -#define LOG_V_2(R) (log(2.0)/log(R)) - -#endif - -/* Default precision for newly created mp_int's */ -static unsigned int s_mp_defprec = MP_DEFPREC; - -/* {{{ Digit arithmetic macros */ - -/* - When adding and multiplying digits, the results can be larger than - can be contained in an mp_digit. Thus, an mp_word is used. These - macros mask off the upper and lower digits of the mp_word (the - mp_word may be more than 2 mp_digits wide, but we only concern - ourselves with the low-order 2 mp_digits) - - If your mp_word DOES have more than 2 mp_digits, you need to - uncomment the first line, and comment out the second. - */ - -/* #define CARRYOUT(W) (((W)>>DIGIT_BIT)&MP_DIGIT_MAX) */ -#define CARRYOUT(W) ((W)>>DIGIT_BIT) -#define ACCUM(W) ((W)&MP_DIGIT_MAX) - -/* }}} */ - -/* {{{ Comparison constants */ - -#define MP_LT -1 -#define MP_EQ 0 -#define MP_GT 1 - -/* }}} */ - -/* {{{ Constant strings */ - -/* Constant strings returned by mp_strerror() */ -static const char *mp_err_string[] = { - "unknown result code", /* say what? */ - "boolean true", /* MP_OKAY, MP_YES */ - "boolean false", /* MP_NO */ - "out of memory", /* MP_MEM */ - "argument out of range", /* MP_RANGE */ - "invalid input parameter", /* MP_BADARG */ - "result is undefined" /* MP_UNDEF */ -}; - -/* Value to digit maps for radix conversion */ - -/* s_dmap_1 - standard digits and letters */ -static const char *s_dmap_1 = - "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; - -#if 0 -/* s_dmap_2 - base64 ordering for digits */ -static const char *s_dmap_2 = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -#endif - -/* }}} */ - -/* {{{ Static function declarations */ - -/* - If MP_MACRO is false, these will be defined as actual functions; - otherwise, suitable macro definitions will be used. This works - around the fact that ANSI C89 doesn't support an 'inline' keyword - (although I hear C9x will ... about bloody time). At present, the - macro definitions are identical to the function bodies, but they'll - expand in place, instead of generating a function call. - - I chose these particular functions to be made into macros because - some profiling showed they are called a lot on a typical workload, - and yet they are primarily housekeeping. - */ -#if MP_MACRO == 0 - void s_mp_setz(mp_digit *dp, mp_size count); /* zero digits */ - void s_mp_copy(mp_digit *sp, mp_digit *dp, mp_size count); /* copy */ - void *s_mp_alloc(size_t nb, size_t ni); /* general allocator */ - void s_mp_free(void *ptr); /* general free function */ -#else - - /* Even if these are defined as macros, we need to respect the settings - of the MP_MEMSET and MP_MEMCPY configuration options... - */ - #if MP_MEMSET == 0 - #define s_mp_setz(dp, count) \ - {int ix;for(ix=0;ix<(count);ix++)(dp)[ix]=0;} - #else - #define s_mp_setz(dp, count) memset(dp, 0, (count) * sizeof(mp_digit)) - #endif /* MP_MEMSET */ - - #if MP_MEMCPY == 0 - #define s_mp_copy(sp, dp, count) \ - {int ix;for(ix=0;ix<(count);ix++)(dp)[ix]=(sp)[ix];} - #else - #define s_mp_copy(sp, dp, count) memcpy(dp, sp, (count) * sizeof(mp_digit)) - #endif /* MP_MEMCPY */ - - #define s_mp_alloc(nb, ni) calloc(nb, ni) - #define s_mp_free(ptr) {if(ptr) free(ptr);} -#endif /* MP_MACRO */ - -mp_err s_mp_grow(mp_int *mp, mp_size min); /* increase allocated size */ -mp_err s_mp_pad(mp_int *mp, mp_size min); /* left pad with zeroes */ - -void s_mp_clamp(mp_int *mp); /* clip leading zeroes */ - -void s_mp_exch(mp_int *a, mp_int *b); /* swap a and b in place */ - -mp_err s_mp_lshd(mp_int *mp, mp_size p); /* left-shift by p digits */ -void s_mp_rshd(mp_int *mp, mp_size p); /* right-shift by p digits */ -void s_mp_div_2d(mp_int *mp, mp_digit d); /* divide by 2^d in place */ -void s_mp_mod_2d(mp_int *mp, mp_digit d); /* modulo 2^d in place */ -mp_err s_mp_mul_2d(mp_int *mp, mp_digit d); /* multiply by 2^d in place*/ -void s_mp_div_2(mp_int *mp); /* divide by 2 in place */ -mp_err s_mp_mul_2(mp_int *mp); /* multiply by 2 in place */ -mp_digit s_mp_norm(mp_int *a, mp_int *b); /* normalize for division */ -mp_err s_mp_add_d(mp_int *mp, mp_digit d); /* unsigned digit addition */ -mp_err s_mp_sub_d(mp_int *mp, mp_digit d); /* unsigned digit subtract */ -mp_err s_mp_mul_d(mp_int *mp, mp_digit d); /* unsigned digit multiply */ -mp_err s_mp_div_d(mp_int *mp, mp_digit d, mp_digit *r); - /* unsigned digit divide */ -mp_err s_mp_reduce(mp_int *x, mp_int *m, mp_int *mu); - /* Barrett reduction */ -mp_err s_mp_add(mp_int *a, mp_int *b); /* magnitude addition */ -mp_err s_mp_sub(mp_int *a, mp_int *b); /* magnitude subtract */ -mp_err s_mp_mul(mp_int *a, mp_int *b); /* magnitude multiply */ -#if 0 -void s_mp_kmul(mp_digit *a, mp_digit *b, mp_digit *out, mp_size len); - /* multiply buffers in place */ -#endif -#if MP_SQUARE -mp_err s_mp_sqr(mp_int *a); /* magnitude square */ -#else -#define s_mp_sqr(a) s_mp_mul(a, a) -#endif -mp_err s_mp_div(mp_int *a, mp_int *b); /* magnitude divide */ -mp_err s_mp_2expt(mp_int *a, mp_digit k); /* a = 2^k */ -int s_mp_cmp(mp_int *a, mp_int *b); /* magnitude comparison */ -int s_mp_cmp_d(mp_int *a, mp_digit d); /* magnitude digit compare */ -int s_mp_ispow2(mp_int *v); /* is v a power of 2? */ -int s_mp_ispow2d(mp_digit d); /* is d a power of 2? */ - -int s_mp_tovalue(char ch, int r); /* convert ch to value */ -char s_mp_todigit(int val, int r, int low); /* convert val to digit */ -int s_mp_outlen(int bits, int r); /* output length in bytes */ - -/* }}} */ - -/* {{{ Default precision manipulation */ - -unsigned int mp_get_prec(void) -{ - return s_mp_defprec; - -} /* end mp_get_prec() */ - -void mp_set_prec(unsigned int prec) -{ - if(prec == 0) - s_mp_defprec = MP_DEFPREC; - else - s_mp_defprec = prec; - -} /* end mp_set_prec() */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ mp_init(mp) */ - -/* - mp_init(mp) - - Initialize a new zero-valued mp_int. Returns MP_OKAY if successful, - MP_MEM if memory could not be allocated for the structure. - */ - -mp_err mp_init(mp_int *mp) -{ - return mp_init_size(mp, s_mp_defprec); - -} /* end mp_init() */ - -/* }}} */ - -/* {{{ mp_init_array(mp[], count) */ - -mp_err mp_init_array(mp_int mp[], int count) -{ - mp_err res; - int pos; - - ARGCHK(mp !=NULL && count > 0, MP_BADARG); - - for(pos = 0; pos < count; ++pos) { - if((res = mp_init(&mp[pos])) != MP_OKAY) - goto CLEANUP; - } - - return MP_OKAY; - - CLEANUP: - while(--pos >= 0) - mp_clear(&mp[pos]); - - return res; - -} /* end mp_init_array() */ - -/* }}} */ - -/* {{{ mp_init_size(mp, prec) */ - -/* - mp_init_size(mp, prec) - - Initialize a new zero-valued mp_int with at least the given - precision; returns MP_OKAY if successful, or MP_MEM if memory could - not be allocated for the structure. - */ - -mp_err mp_init_size(mp_int *mp, mp_size prec) -{ - ARGCHK(mp != NULL && prec > 0, MP_BADARG); - - if((DIGITS(mp) = s_mp_alloc(prec, sizeof(mp_digit))) == NULL) - return MP_MEM; - - SIGN(mp) = MP_ZPOS; - USED(mp) = 1; - ALLOC(mp) = prec; - - return MP_OKAY; - -} /* end mp_init_size() */ - -/* }}} */ - -/* {{{ mp_init_copy(mp, from) */ - -/* - mp_init_copy(mp, from) - - Initialize mp as an exact copy of from. Returns MP_OKAY if - successful, MP_MEM if memory could not be allocated for the new - structure. - */ - -mp_err mp_init_copy(mp_int *mp, mp_int *from) -{ - ARGCHK(mp != NULL && from != NULL, MP_BADARG); - - if(mp == from) - return MP_OKAY; - - if((DIGITS(mp) = s_mp_alloc(USED(from), sizeof(mp_digit))) == NULL) - return MP_MEM; - - s_mp_copy(DIGITS(from), DIGITS(mp), USED(from)); - USED(mp) = USED(from); - ALLOC(mp) = USED(from); - SIGN(mp) = SIGN(from); - - return MP_OKAY; - -} /* end mp_init_copy() */ - -/* }}} */ - -/* {{{ mp_copy(from, to) */ - -/* - mp_copy(from, to) - - Copies the mp_int 'from' to the mp_int 'to'. It is presumed that - 'to' has already been initialized (if not, use mp_init_copy() - instead). If 'from' and 'to' are identical, nothing happens. - */ - -mp_err mp_copy(mp_int *from, mp_int *to) -{ - ARGCHK(from != NULL && to != NULL, MP_BADARG); - - if(from == to) - return MP_OKAY; - - { /* copy */ - mp_digit *tmp; - - /* - If the allocated buffer in 'to' already has enough space to hold - all the used digits of 'from', we'll re-use it to avoid hitting - the memory allocater more than necessary; otherwise, we'd have - to grow anyway, so we just allocate a hunk and make the copy as - usual - */ - if(ALLOC(to) >= USED(from)) { - s_mp_setz(DIGITS(to) + USED(from), ALLOC(to) - USED(from)); - s_mp_copy(DIGITS(from), DIGITS(to), USED(from)); - - } else { - if((tmp = s_mp_alloc(USED(from), sizeof(mp_digit))) == NULL) - return MP_MEM; - - s_mp_copy(DIGITS(from), tmp, USED(from)); - - if(DIGITS(to) != NULL) { -#if MP_CRYPTO - s_mp_setz(DIGITS(to), ALLOC(to)); -#endif - s_mp_free(DIGITS(to)); - } - - DIGITS(to) = tmp; - ALLOC(to) = USED(from); - } - - /* Copy the precision and sign from the original */ - USED(to) = USED(from); - SIGN(to) = SIGN(from); - } /* end copy */ - - return MP_OKAY; - -} /* end mp_copy() */ - -/* }}} */ - -/* {{{ mp_exch(mp1, mp2) */ - -/* - mp_exch(mp1, mp2) - - Exchange mp1 and mp2 without allocating any intermediate memory - (well, unless you count the stack space needed for this call and the - locals it creates...). This cannot fail. - */ - -void mp_exch(mp_int *mp1, mp_int *mp2) -{ -#if MP_ARGCHK == 2 - assert(mp1 != NULL && mp2 != NULL); -#else - if(mp1 == NULL || mp2 == NULL) - return; -#endif - - s_mp_exch(mp1, mp2); - -} /* end mp_exch() */ - -/* }}} */ - -/* {{{ mp_clear(mp) */ - -/* - mp_clear(mp) - - Release the storage used by an mp_int, and void its fields so that - if someone calls mp_clear() again for the same int later, we won't - get tollchocked. - */ - -void mp_clear(mp_int *mp) -{ - if(mp == NULL) - return; - - if(DIGITS(mp) != NULL) { -#if MP_CRYPTO - s_mp_setz(DIGITS(mp), ALLOC(mp)); -#endif - s_mp_free(DIGITS(mp)); - DIGITS(mp) = NULL; - } - - USED(mp) = 0; - ALLOC(mp) = 0; - -} /* end mp_clear() */ - -/* }}} */ - -/* {{{ mp_clear_array(mp[], count) */ - -void mp_clear_array(mp_int mp[], int count) -{ - ARGCHK(mp != NULL && count > 0, MP_BADARG); - - while(--count >= 0) - mp_clear(&mp[count]); - -} /* end mp_clear_array() */ - -/* }}} */ - -/* {{{ mp_zero(mp) */ - -/* - mp_zero(mp) - - Set mp to zero. Does not change the allocated size of the structure, - and therefore cannot fail (except on a bad argument, which we ignore) - */ -void mp_zero(mp_int *mp) -{ - if(mp == NULL) - return; - - s_mp_setz(DIGITS(mp), ALLOC(mp)); - USED(mp) = 1; - SIGN(mp) = MP_ZPOS; - -} /* end mp_zero() */ - -/* }}} */ - -/* {{{ mp_set(mp, d) */ - -void mp_set(mp_int *mp, mp_digit d) -{ - if(mp == NULL) - return; - - mp_zero(mp); - DIGIT(mp, 0) = d; - -} /* end mp_set() */ - -/* }}} */ - -/* {{{ mp_set_int(mp, z) */ - -mp_err mp_set_int(mp_int *mp, long z) -{ - int ix; - unsigned long v = abs(z); - mp_err res; - - ARGCHK(mp != NULL, MP_BADARG); - - mp_zero(mp); - if(z == 0) - return MP_OKAY; /* shortcut for zero */ - - for(ix = sizeof(long) - 1; ix >= 0; ix--) { - - if((res = s_mp_mul_2d(mp, CHAR_BIT)) != MP_OKAY) - return res; - - res = s_mp_add_d(mp, - (mp_digit)((v >> (ix * CHAR_BIT)) & UCHAR_MAX)); - if(res != MP_OKAY) - return res; - - } - - if(z < 0) - SIGN(mp) = MP_NEG; - - return MP_OKAY; - -} /* end mp_set_int() */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ Digit arithmetic */ - -/* {{{ mp_add_d(a, d, b) */ - -/* - mp_add_d(a, d, b) - - Compute the sum b = a + d, for a single digit d. Respects the sign of - its primary addend (single digits are unsigned anyway). - */ - -mp_err mp_add_d(mp_int *a, mp_digit d, mp_int *b) -{ - mp_err res = MP_OKAY; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if((res = mp_copy(a, b)) != MP_OKAY) - return res; - - if(SIGN(b) == MP_ZPOS) { - res = s_mp_add_d(b, d); - } else if(s_mp_cmp_d(b, d) >= 0) { - res = s_mp_sub_d(b, d); - } else { - SIGN(b) = MP_ZPOS; - - DIGIT(b, 0) = d - DIGIT(b, 0); - } - - return res; - -} /* end mp_add_d() */ - -/* }}} */ - -/* {{{ mp_sub_d(a, d, b) */ - -/* - mp_sub_d(a, d, b) - - Compute the difference b = a - d, for a single digit d. Respects the - sign of its subtrahend (single digits are unsigned anyway). - */ - -mp_err mp_sub_d(mp_int *a, mp_digit d, mp_int *b) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if((res = mp_copy(a, b)) != MP_OKAY) - return res; - - if(SIGN(b) == MP_NEG) { - if((res = s_mp_add_d(b, d)) != MP_OKAY) - return res; - - } else if(s_mp_cmp_d(b, d) >= 0) { - if((res = s_mp_sub_d(b, d)) != MP_OKAY) - return res; - - } else { - mp_neg(b, b); - - DIGIT(b, 0) = d - DIGIT(b, 0); - SIGN(b) = MP_NEG; - } - - if(s_mp_cmp_d(b, 0) == 0) - SIGN(b) = MP_ZPOS; - - return MP_OKAY; - -} /* end mp_sub_d() */ - -/* }}} */ - -/* {{{ mp_mul_d(a, d, b) */ - -/* - mp_mul_d(a, d, b) - - Compute the product b = a * d, for a single digit d. Respects the sign - of its multiplicand (single digits are unsigned anyway) - */ - -mp_err mp_mul_d(mp_int *a, mp_digit d, mp_int *b) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if(d == 0) { - mp_zero(b); - return MP_OKAY; - } - - if((res = mp_copy(a, b)) != MP_OKAY) - return res; - - res = s_mp_mul_d(b, d); - - return res; - -} /* end mp_mul_d() */ - -/* }}} */ - -/* {{{ mp_mul_2(a, c) */ - -mp_err mp_mul_2(mp_int *a, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && c != NULL, MP_BADARG); - - if((res = mp_copy(a, c)) != MP_OKAY) - return res; - - return s_mp_mul_2(c); - -} /* end mp_mul_2() */ - -/* }}} */ - -/* {{{ mp_div_d(a, d, q, r) */ - -/* - mp_div_d(a, d, q, r) - - Compute the quotient q = a / d and remainder r = a mod d, for a - single digit d. Respects the sign of its divisor (single digits are - unsigned anyway). - */ - -mp_err mp_div_d(mp_int *a, mp_digit d, mp_int *q, mp_digit *r) -{ - mp_err res; - mp_digit rem; - int pow; - - ARGCHK(a != NULL, MP_BADARG); - - if(d == 0) - return MP_RANGE; - - /* Shortcut for powers of two ... */ - if((pow = s_mp_ispow2d(d)) >= 0) { - mp_digit mask; - - mask = (1 << pow) - 1; - rem = DIGIT(a, 0) & mask; - - if(q) { - mp_copy(a, q); - s_mp_div_2d(q, pow); - } - - if(r) - *r = rem; - - return MP_OKAY; - } - - /* - If the quotient is actually going to be returned, we'll try to - avoid hitting the memory allocator by copying the dividend into it - and doing the division there. This can't be any _worse_ than - always copying, and will sometimes be better (since it won't make - another copy) - - If it's not going to be returned, we need to allocate a temporary - to hold the quotient, which will just be discarded. - */ - if(q) { - if((res = mp_copy(a, q)) != MP_OKAY) - return res; - - res = s_mp_div_d(q, d, &rem); - if(s_mp_cmp_d(q, 0) == MP_EQ) - SIGN(q) = MP_ZPOS; - - } else { - mp_int qp; - - if((res = mp_init_copy(&qp, a)) != MP_OKAY) - return res; - - res = s_mp_div_d(&qp, d, &rem); - if(s_mp_cmp_d(&qp, 0) == 0) - SIGN(&qp) = MP_ZPOS; - - mp_clear(&qp); - } - - if(r) - *r = rem; - - return res; - -} /* end mp_div_d() */ - -/* }}} */ - -/* {{{ mp_div_2(a, c) */ - -/* - mp_div_2(a, c) - - Compute c = a / 2, disregarding the remainder. - */ - -mp_err mp_div_2(mp_int *a, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && c != NULL, MP_BADARG); - - if((res = mp_copy(a, c)) != MP_OKAY) - return res; - - s_mp_div_2(c); - - return MP_OKAY; - -} /* end mp_div_2() */ - -/* }}} */ - -/* {{{ mp_expt_d(a, d, b) */ - -mp_err mp_expt_d(mp_int *a, mp_digit d, mp_int *c) -{ - mp_int s, x; - mp_err res; - - ARGCHK(a != NULL && c != NULL, MP_BADARG); - - if((res = mp_init(&s)) != MP_OKAY) - return res; - if((res = mp_init_copy(&x, a)) != MP_OKAY) - goto X; - - DIGIT(&s, 0) = 1; - - while(d != 0) { - if(d & 1) { - if((res = s_mp_mul(&s, &x)) != MP_OKAY) - goto CLEANUP; - } - - d >>= 1; - - if((res = s_mp_sqr(&x)) != MP_OKAY) - goto CLEANUP; - } - - s_mp_exch(&s, c); - -CLEANUP: - mp_clear(&x); -X: - mp_clear(&s); - - return res; - -} /* end mp_expt_d() */ - -/* }}} */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ Full arithmetic */ - -/* {{{ mp_abs(a, b) */ - -/* - mp_abs(a, b) - - Compute b = |a|. 'a' and 'b' may be identical. - */ - -mp_err mp_abs(mp_int *a, mp_int *b) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if((res = mp_copy(a, b)) != MP_OKAY) - return res; - - SIGN(b) = MP_ZPOS; - - return MP_OKAY; - -} /* end mp_abs() */ - -/* }}} */ - -/* {{{ mp_neg(a, b) */ - -/* - mp_neg(a, b) - - Compute b = -a. 'a' and 'b' may be identical. - */ - -mp_err mp_neg(mp_int *a, mp_int *b) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if((res = mp_copy(a, b)) != MP_OKAY) - return res; - - if(s_mp_cmp_d(b, 0) == MP_EQ) - SIGN(b) = MP_ZPOS; - else - SIGN(b) = (SIGN(b) == MP_NEG) ? MP_ZPOS : MP_NEG; - - return MP_OKAY; - -} /* end mp_neg() */ - -/* }}} */ - -/* {{{ mp_add(a, b, c) */ - -/* - mp_add(a, b, c) - - Compute c = a + b. All parameters may be identical. - */ - -mp_err mp_add(mp_int *a, mp_int *b, mp_int *c) -{ - mp_err res; - int cmp; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - if(SIGN(a) == SIGN(b)) { /* same sign: add values, keep sign */ - - /* Commutativity of addition lets us do this in either order, - so we avoid having to use a temporary even if the result - is supposed to replace the output - */ - if(c == b) { - if((res = s_mp_add(c, a)) != MP_OKAY) - return res; - } else { - if(c != a && (res = mp_copy(a, c)) != MP_OKAY) - return res; - - if((res = s_mp_add(c, b)) != MP_OKAY) - return res; - } - - } else if((cmp = s_mp_cmp(a, b)) > 0) { /* different sign: a > b */ - - /* If the output is going to be clobbered, we will use a temporary - variable; otherwise, we'll do it without touching the memory - allocator at all, if possible - */ - if(c == b) { - mp_int tmp; - - if((res = mp_init_copy(&tmp, a)) != MP_OKAY) - return res; - if((res = s_mp_sub(&tmp, b)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - - s_mp_exch(&tmp, c); - mp_clear(&tmp); - - } else { - - if(c != a && (res = mp_copy(a, c)) != MP_OKAY) - return res; - if((res = s_mp_sub(c, b)) != MP_OKAY) - return res; - - } - - } else if(cmp == 0) { /* different sign, a == b */ - - mp_zero(c); - return MP_OKAY; - - } else { /* different sign: a < b */ - - /* See above... */ - if(c == a) { - mp_int tmp; - - if((res = mp_init_copy(&tmp, b)) != MP_OKAY) - return res; - if((res = s_mp_sub(&tmp, a)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - - s_mp_exch(&tmp, c); - mp_clear(&tmp); - - } else { - - if(c != b && (res = mp_copy(b, c)) != MP_OKAY) - return res; - if((res = s_mp_sub(c, a)) != MP_OKAY) - return res; - - } - } - - if(USED(c) == 1 && DIGIT(c, 0) == 0) - SIGN(c) = MP_ZPOS; - - return MP_OKAY; - -} /* end mp_add() */ - -/* }}} */ - -/* {{{ mp_sub(a, b, c) */ - -/* - mp_sub(a, b, c) - - Compute c = a - b. All parameters may be identical. - */ - -mp_err mp_sub(mp_int *a, mp_int *b, mp_int *c) -{ - mp_err res; - int cmp; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - if(SIGN(a) != SIGN(b)) { - if(c == a) { - if((res = s_mp_add(c, b)) != MP_OKAY) - return res; - } else { - if(c != b && ((res = mp_copy(b, c)) != MP_OKAY)) - return res; - if((res = s_mp_add(c, a)) != MP_OKAY) - return res; - SIGN(c) = SIGN(a); - } - - } else if((cmp = s_mp_cmp(a, b)) > 0) { /* Same sign, a > b */ - if(c == b) { - mp_int tmp; - - if((res = mp_init_copy(&tmp, a)) != MP_OKAY) - return res; - if((res = s_mp_sub(&tmp, b)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - s_mp_exch(&tmp, c); - mp_clear(&tmp); - - } else { - if(c != a && ((res = mp_copy(a, c)) != MP_OKAY)) - return res; - - if((res = s_mp_sub(c, b)) != MP_OKAY) - return res; - } - - } else if(cmp == 0) { /* Same sign, equal magnitude */ - mp_zero(c); - return MP_OKAY; - - } else { /* Same sign, b > a */ - if(c == a) { - mp_int tmp; - - if((res = mp_init_copy(&tmp, b)) != MP_OKAY) - return res; - - if((res = s_mp_sub(&tmp, a)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - s_mp_exch(&tmp, c); - mp_clear(&tmp); - - } else { - if(c != b && ((res = mp_copy(b, c)) != MP_OKAY)) - return res; - - if((res = s_mp_sub(c, a)) != MP_OKAY) - return res; - } - - SIGN(c) = !SIGN(b); - } - - if(USED(c) == 1 && DIGIT(c, 0) == 0) - SIGN(c) = MP_ZPOS; - - return MP_OKAY; - -} /* end mp_sub() */ - -/* }}} */ - -/* {{{ mp_mul(a, b, c) */ - -/* - mp_mul(a, b, c) - - Compute c = a * b. All parameters may be identical. - */ - -mp_err mp_mul(mp_int *a, mp_int *b, mp_int *c) -{ - mp_err res; - mp_sign sgn; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - sgn = (SIGN(a) == SIGN(b)) ? MP_ZPOS : MP_NEG; - - if(c == b) { - if((res = s_mp_mul(c, a)) != MP_OKAY) - return res; - - } else { - if((res = mp_copy(a, c)) != MP_OKAY) - return res; - - if((res = s_mp_mul(c, b)) != MP_OKAY) - return res; - } - - if(sgn == MP_ZPOS || s_mp_cmp_d(c, 0) == MP_EQ) - SIGN(c) = MP_ZPOS; - else - SIGN(c) = sgn; - - return MP_OKAY; - -} /* end mp_mul() */ - -/* }}} */ - -/* {{{ mp_mul_2d(a, d, c) */ - -/* - mp_mul_2d(a, d, c) - - Compute c = a * 2^d. a may be the same as c. - */ - -mp_err mp_mul_2d(mp_int *a, mp_digit d, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && c != NULL, MP_BADARG); - - if((res = mp_copy(a, c)) != MP_OKAY) - return res; - - if(d == 0) - return MP_OKAY; - - return s_mp_mul_2d(c, d); - -} /* end mp_mul() */ - -/* }}} */ - -/* {{{ mp_sqr(a, b) */ - -#if MP_SQUARE -mp_err mp_sqr(mp_int *a, mp_int *b) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if((res = mp_copy(a, b)) != MP_OKAY) - return res; - - if((res = s_mp_sqr(b)) != MP_OKAY) - return res; - - SIGN(b) = MP_ZPOS; - - return MP_OKAY; - -} /* end mp_sqr() */ -#endif - -/* }}} */ - -/* {{{ mp_div(a, b, q, r) */ - -/* - mp_div(a, b, q, r) - - Compute q = a / b and r = a mod b. Input parameters may be re-used - as output parameters. If q or r is NULL, that portion of the - computation will be discarded (although it will still be computed) - - Pay no attention to the hacker behind the curtain. - */ - -mp_err mp_div(mp_int *a, mp_int *b, mp_int *q, mp_int *r) -{ - mp_err res; - mp_int qtmp, rtmp; - int cmp; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - if(mp_cmp_z(b) == MP_EQ) - return MP_RANGE; - - /* If a <= b, we can compute the solution without division, and - avoid any memory allocation - */ - if((cmp = s_mp_cmp(a, b)) < 0) { - if(r) { - if((res = mp_copy(a, r)) != MP_OKAY) - return res; - } - - if(q) - mp_zero(q); - - return MP_OKAY; - - } else if(cmp == 0) { - - /* Set quotient to 1, with appropriate sign */ - if(q) { - int qneg = (SIGN(a) != SIGN(b)); - - mp_set(q, 1); - if(qneg) - SIGN(q) = MP_NEG; - } - - if(r) - mp_zero(r); - - return MP_OKAY; - } - - /* If we get here, it means we actually have to do some division */ - - /* Set up some temporaries... */ - if((res = mp_init_copy(&qtmp, a)) != MP_OKAY) - return res; - if((res = mp_init_copy(&rtmp, b)) != MP_OKAY) - goto CLEANUP; - - if((res = s_mp_div(&qtmp, &rtmp)) != MP_OKAY) - goto CLEANUP; - - /* Compute the signs for the output */ - SIGN(&rtmp) = SIGN(a); /* Sr = Sa */ - if(SIGN(a) == SIGN(b)) - SIGN(&qtmp) = MP_ZPOS; /* Sq = MP_ZPOS if Sa = Sb */ - else - SIGN(&qtmp) = MP_NEG; /* Sq = MP_NEG if Sa != Sb */ - - if(s_mp_cmp_d(&qtmp, 0) == MP_EQ) - SIGN(&qtmp) = MP_ZPOS; - if(s_mp_cmp_d(&rtmp, 0) == MP_EQ) - SIGN(&rtmp) = MP_ZPOS; - - /* Copy output, if it is needed */ - if(q) - s_mp_exch(&qtmp, q); - - if(r) - s_mp_exch(&rtmp, r); - -CLEANUP: - mp_clear(&rtmp); - mp_clear(&qtmp); - - return res; - -} /* end mp_div() */ - -/* }}} */ - -/* {{{ mp_div_2d(a, d, q, r) */ - -mp_err mp_div_2d(mp_int *a, mp_digit d, mp_int *q, mp_int *r) -{ - mp_err res; - - ARGCHK(a != NULL, MP_BADARG); - - if(q) { - if((res = mp_copy(a, q)) != MP_OKAY) - return res; - - s_mp_div_2d(q, d); - } - - if(r) { - if((res = mp_copy(a, r)) != MP_OKAY) - return res; - - s_mp_mod_2d(r, d); - } - - return MP_OKAY; - -} /* end mp_div_2d() */ - -/* }}} */ - -/* {{{ mp_expt(a, b, c) */ - -/* - mp_expt(a, b, c) - - Compute c = a ** b, that is, raise a to the b power. Uses a - standard iterative square-and-multiply technique. - */ - -mp_err mp_expt(mp_int *a, mp_int *b, mp_int *c) -{ - mp_int s, x; - mp_err res; - mp_digit d; - unsigned int bit, dig; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - if(mp_cmp_z(b) < 0) - return MP_RANGE; - - if((res = mp_init(&s)) != MP_OKAY) - return res; - - mp_set(&s, 1); - - if((res = mp_init_copy(&x, a)) != MP_OKAY) - goto X; - - /* Loop over low-order digits in ascending order */ - for(dig = 0; dig < (USED(b) - 1); dig++) { - d = DIGIT(b, dig); - - /* Loop over bits of each non-maximal digit */ - for(bit = 0; bit < DIGIT_BIT; bit++) { - if(d & 1) { - if((res = s_mp_mul(&s, &x)) != MP_OKAY) - goto CLEANUP; - } - - d >>= 1; - - if((res = s_mp_sqr(&x)) != MP_OKAY) - goto CLEANUP; - } - } - - /* Consider now the last digit... */ - d = DIGIT(b, dig); - - while(d) { - if(d & 1) { - if((res = s_mp_mul(&s, &x)) != MP_OKAY) - goto CLEANUP; - } - - d >>= 1; - - if((res = s_mp_sqr(&x)) != MP_OKAY) - goto CLEANUP; - } - - if(mp_iseven(b)) - SIGN(&s) = SIGN(a); - - res = mp_copy(&s, c); - -CLEANUP: - mp_clear(&x); -X: - mp_clear(&s); - - return res; - -} /* end mp_expt() */ - -/* }}} */ - -/* {{{ mp_2expt(a, k) */ - -/* Compute a = 2^k */ - -mp_err mp_2expt(mp_int *a, mp_digit k) -{ - ARGCHK(a != NULL, MP_BADARG); - - return s_mp_2expt(a, k); - -} /* end mp_2expt() */ - -/* }}} */ - -/* {{{ mp_mod(a, m, c) */ - -/* - mp_mod(a, m, c) - - Compute c = a (mod m). Result will always be 0 <= c < m. - */ - -mp_err mp_mod(mp_int *a, mp_int *m, mp_int *c) -{ - mp_err res; - int mag; - - ARGCHK(a != NULL && m != NULL && c != NULL, MP_BADARG); - - if(SIGN(m) == MP_NEG) - return MP_RANGE; - - /* - If |a| > m, we need to divide to get the remainder and take the - absolute value. - - If |a| < m, we don't need to do any division, just copy and adjust - the sign (if a is negative). - - If |a| == m, we can simply set the result to zero. - - This order is intended to minimize the average path length of the - comparison chain on common workloads -- the most frequent cases are - that |a| != m, so we do those first. - */ - if((mag = s_mp_cmp(a, m)) > 0) { - if((res = mp_div(a, m, NULL, c)) != MP_OKAY) - return res; - - if(SIGN(c) == MP_NEG) { - if((res = mp_add(c, m, c)) != MP_OKAY) - return res; - } - - } else if(mag < 0) { - if((res = mp_copy(a, c)) != MP_OKAY) - return res; - - if(mp_cmp_z(a) < 0) { - if((res = mp_add(c, m, c)) != MP_OKAY) - return res; - - } - - } else { - mp_zero(c); - - } - - return MP_OKAY; - -} /* end mp_mod() */ - -/* }}} */ - -/* {{{ mp_mod_d(a, d, c) */ - -/* - mp_mod_d(a, d, c) - - Compute c = a (mod d). Result will always be 0 <= c < d - */ -mp_err mp_mod_d(mp_int *a, mp_digit d, mp_digit *c) -{ - mp_err res; - mp_digit rem; - - ARGCHK(a != NULL && c != NULL, MP_BADARG); - - if(s_mp_cmp_d(a, d) > 0) { - if((res = mp_div_d(a, d, NULL, &rem)) != MP_OKAY) - return res; - - } else { - if(SIGN(a) == MP_NEG) - rem = d - DIGIT(a, 0); - else - rem = DIGIT(a, 0); - } - - if(c) - *c = rem; - - return MP_OKAY; - -} /* end mp_mod_d() */ - -/* }}} */ - -/* {{{ mp_sqrt(a, b) */ - -/* - mp_sqrt(a, b) - - Compute the integer square root of a, and store the result in b. - Uses an integer-arithmetic version of Newton's iterative linear - approximation technique to determine this value; the result has the - following two properties: - - b^2 <= a - (b+1)^2 >= a - - It is a range error to pass a negative value. - */ -mp_err mp_sqrt(mp_int *a, mp_int *b) -{ - mp_int x, t; - mp_err res; - - ARGCHK(a != NULL && b != NULL, MP_BADARG); - - /* Cannot take square root of a negative value */ - if(SIGN(a) == MP_NEG) - return MP_RANGE; - - /* Special cases for zero and one, trivial */ - if(mp_cmp_d(a, 0) == MP_EQ || mp_cmp_d(a, 1) == MP_EQ) - return mp_copy(a, b); - - /* Initialize the temporaries we'll use below */ - if((res = mp_init_size(&t, USED(a))) != MP_OKAY) - return res; - - /* Compute an initial guess for the iteration as a itself */ - if((res = mp_init_copy(&x, a)) != MP_OKAY) - goto X; - -s_mp_rshd(&x, (USED(&x)/2)+1); -mp_add_d(&x, 1, &x); - - for(;;) { - /* t = (x * x) - a */ - mp_copy(&x, &t); /* can't fail, t is big enough for original x */ - if((res = mp_sqr(&t, &t)) != MP_OKAY || - (res = mp_sub(&t, a, &t)) != MP_OKAY) - goto CLEANUP; - - /* t = t / 2x */ - s_mp_mul_2(&x); - if((res = mp_div(&t, &x, &t, NULL)) != MP_OKAY) - goto CLEANUP; - s_mp_div_2(&x); - - /* Terminate the loop, if the quotient is zero */ - if(mp_cmp_z(&t) == MP_EQ) - break; - - /* x = x - t */ - if((res = mp_sub(&x, &t, &x)) != MP_OKAY) - goto CLEANUP; - - } - - /* Copy result to output parameter */ - mp_sub_d(&x, 1, &x); - s_mp_exch(&x, b); - - CLEANUP: - mp_clear(&x); - X: - mp_clear(&t); - - return res; - -} /* end mp_sqrt() */ - -/* }}} */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ Modular arithmetic */ - -#if MP_MODARITH -/* {{{ mp_addmod(a, b, m, c) */ - -/* - mp_addmod(a, b, m, c) - - Compute c = (a + b) mod m - */ - -mp_err mp_addmod(mp_int *a, mp_int *b, mp_int *m, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL && m != NULL && c != NULL, MP_BADARG); - - if((res = mp_add(a, b, c)) != MP_OKAY) - return res; - if((res = mp_mod(c, m, c)) != MP_OKAY) - return res; - - return MP_OKAY; - -} - -/* }}} */ - -/* {{{ mp_submod(a, b, m, c) */ - -/* - mp_submod(a, b, m, c) - - Compute c = (a - b) mod m - */ - -mp_err mp_submod(mp_int *a, mp_int *b, mp_int *m, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL && m != NULL && c != NULL, MP_BADARG); - - if((res = mp_sub(a, b, c)) != MP_OKAY) - return res; - if((res = mp_mod(c, m, c)) != MP_OKAY) - return res; - - return MP_OKAY; - -} - -/* }}} */ - -/* {{{ mp_mulmod(a, b, m, c) */ - -/* - mp_mulmod(a, b, m, c) - - Compute c = (a * b) mod m - */ - -mp_err mp_mulmod(mp_int *a, mp_int *b, mp_int *m, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && b != NULL && m != NULL && c != NULL, MP_BADARG); - - if((res = mp_mul(a, b, c)) != MP_OKAY) - return res; - if((res = mp_mod(c, m, c)) != MP_OKAY) - return res; - - return MP_OKAY; - -} - -/* }}} */ - -/* {{{ mp_sqrmod(a, m, c) */ - -#if MP_SQUARE -mp_err mp_sqrmod(mp_int *a, mp_int *m, mp_int *c) -{ - mp_err res; - - ARGCHK(a != NULL && m != NULL && c != NULL, MP_BADARG); - - if((res = mp_sqr(a, c)) != MP_OKAY) - return res; - if((res = mp_mod(c, m, c)) != MP_OKAY) - return res; - - return MP_OKAY; - -} /* end mp_sqrmod() */ -#endif - -/* }}} */ - -/* {{{ mp_exptmod(a, b, m, c) */ - -/* - mp_exptmod(a, b, m, c) - - Compute c = (a ** b) mod m. Uses a standard square-and-multiply - method with modular reductions at each step. (This is basically the - same code as mp_expt(), except for the addition of the reductions) - - The modular reductions are done using Barrett's algorithm (see - s_mp_reduce() below for details) - */ - -mp_err mp_exptmod(mp_int *a, mp_int *b, mp_int *m, mp_int *c) -{ - mp_int s, x, mu; - mp_err res; - mp_digit d, *db = DIGITS(b); - mp_size ub = USED(b); - unsigned int bit, dig; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - if(mp_cmp_z(b) < 0 || mp_cmp_z(m) <= 0) - return MP_RANGE; - - if((res = mp_init(&s)) != MP_OKAY) - return res; - if((res = mp_init_copy(&x, a)) != MP_OKAY) - goto X; - if((res = mp_mod(&x, m, &x)) != MP_OKAY || - (res = mp_init(&mu)) != MP_OKAY) - goto MU; - - mp_set(&s, 1); - - /* mu = b^2k / m */ - s_mp_add_d(&mu, 1); - s_mp_lshd(&mu, 2 * USED(m)); - if((res = mp_div(&mu, m, &mu, NULL)) != MP_OKAY) - goto CLEANUP; - - /* Loop over digits of b in ascending order, except highest order */ - for(dig = 0; dig < (ub - 1); dig++) { - d = *db++; - - /* Loop over the bits of the lower-order digits */ - for(bit = 0; bit < DIGIT_BIT; bit++) { - if(d & 1) { - if((res = s_mp_mul(&s, &x)) != MP_OKAY) - goto CLEANUP; - if((res = s_mp_reduce(&s, m, &mu)) != MP_OKAY) - goto CLEANUP; - } - - d >>= 1; - - if((res = s_mp_sqr(&x)) != MP_OKAY) - goto CLEANUP; - if((res = s_mp_reduce(&x, m, &mu)) != MP_OKAY) - goto CLEANUP; - } - } - - /* Now do the last digit... */ - d = *db; - - while(d) { - if(d & 1) { - if((res = s_mp_mul(&s, &x)) != MP_OKAY) - goto CLEANUP; - if((res = s_mp_reduce(&s, m, &mu)) != MP_OKAY) - goto CLEANUP; - } - - d >>= 1; - - if((res = s_mp_sqr(&x)) != MP_OKAY) - goto CLEANUP; - if((res = s_mp_reduce(&x, m, &mu)) != MP_OKAY) - goto CLEANUP; - } - - s_mp_exch(&s, c); - - CLEANUP: - mp_clear(&mu); - MU: - mp_clear(&x); - X: - mp_clear(&s); - - return res; - -} /* end mp_exptmod() */ - -/* }}} */ - -/* {{{ mp_exptmod_d(a, d, m, c) */ - -mp_err mp_exptmod_d(mp_int *a, mp_digit d, mp_int *m, mp_int *c) -{ - mp_int s, x; - mp_err res; - - ARGCHK(a != NULL && c != NULL, MP_BADARG); - - if((res = mp_init(&s)) != MP_OKAY) - return res; - if((res = mp_init_copy(&x, a)) != MP_OKAY) - goto X; - - mp_set(&s, 1); - - while(d != 0) { - if(d & 1) { - if((res = s_mp_mul(&s, &x)) != MP_OKAY || - (res = mp_mod(&s, m, &s)) != MP_OKAY) - goto CLEANUP; - } - - d /= 2; - - if((res = s_mp_sqr(&x)) != MP_OKAY || - (res = mp_mod(&x, m, &x)) != MP_OKAY) - goto CLEANUP; - } - - s_mp_exch(&s, c); - -CLEANUP: - mp_clear(&x); -X: - mp_clear(&s); - - return res; - -} /* end mp_exptmod_d() */ - -/* }}} */ -#endif /* if MP_MODARITH */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ Comparison functions */ - -/* {{{ mp_cmp_z(a) */ - -/* - mp_cmp_z(a) - - Compare a <=> 0. Returns <0 if a<0, 0 if a=0, >0 if a>0. - */ - -int mp_cmp_z(mp_int *a) -{ - if(SIGN(a) == MP_NEG) - return MP_LT; - else if(USED(a) == 1 && DIGIT(a, 0) == 0) - return MP_EQ; - else - return MP_GT; - -} /* end mp_cmp_z() */ - -/* }}} */ - -/* {{{ mp_cmp_d(a, d) */ - -/* - mp_cmp_d(a, d) - - Compare a <=> d. Returns <0 if a0 if a>d - */ - -int mp_cmp_d(mp_int *a, mp_digit d) -{ - ARGCHK(a != NULL, MP_EQ); - - if(SIGN(a) == MP_NEG) - return MP_LT; - - return s_mp_cmp_d(a, d); - -} /* end mp_cmp_d() */ - -/* }}} */ - -/* {{{ mp_cmp(a, b) */ - -int mp_cmp(mp_int *a, mp_int *b) -{ - ARGCHK(a != NULL && b != NULL, MP_EQ); - - if(SIGN(a) == SIGN(b)) { - int mag; - - if((mag = s_mp_cmp(a, b)) == MP_EQ) - return MP_EQ; - - if(SIGN(a) == MP_ZPOS) - return mag; - else - return -mag; - - } else if(SIGN(a) == MP_ZPOS) { - return MP_GT; - } else { - return MP_LT; - } - -} /* end mp_cmp() */ - -/* }}} */ - -/* {{{ mp_cmp_mag(a, b) */ - -/* - mp_cmp_mag(a, b) - - Compares |a| <=> |b|, and returns an appropriate comparison result - */ - -int mp_cmp_mag(mp_int *a, mp_int *b) -{ - ARGCHK(a != NULL && b != NULL, MP_EQ); - - return s_mp_cmp(a, b); - -} /* end mp_cmp_mag() */ - -/* }}} */ - -/* {{{ mp_cmp_int(a, z) */ - -/* - This just converts z to an mp_int, and uses the existing comparison - routines. This is sort of inefficient, but it's not clear to me how - frequently this wil get used anyway. For small positive constants, - you can always use mp_cmp_d(), and for zero, there is mp_cmp_z(). - */ -int mp_cmp_int(mp_int *a, long z) -{ - mp_int tmp; - int out; - - ARGCHK(a != NULL, MP_EQ); - - mp_init(&tmp); mp_set_int(&tmp, z); - out = mp_cmp(a, &tmp); - mp_clear(&tmp); - - return out; - -} /* end mp_cmp_int() */ - -/* }}} */ - -/* {{{ mp_isodd(a) */ - -/* - mp_isodd(a) - - Returns a true (non-zero) value if a is odd, false (zero) otherwise. - */ -int mp_isodd(mp_int *a) -{ - ARGCHK(a != NULL, 0); - - return (DIGIT(a, 0) & 1); - -} /* end mp_isodd() */ - -/* }}} */ - -/* {{{ mp_iseven(a) */ - -int mp_iseven(mp_int *a) -{ - return !mp_isodd(a); - -} /* end mp_iseven() */ - -/* }}} */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ Number theoretic functions */ - -#if MP_NUMTH -/* {{{ mp_gcd(a, b, c) */ - -/* - Like the old mp_gcd() function, except computes the GCD using the - binary algorithm due to Josef Stein in 1961 (via Knuth). - */ -mp_err mp_gcd(mp_int *a, mp_int *b, mp_int *c) -{ - mp_err res; - mp_int u, v, t; - mp_size k = 0; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - if(mp_cmp_z(a) == MP_EQ && mp_cmp_z(b) == MP_EQ) - return MP_RANGE; - if(mp_cmp_z(a) == MP_EQ) { - return mp_copy(b, c); - } else if(mp_cmp_z(b) == MP_EQ) { - return mp_copy(a, c); - } - - if((res = mp_init(&t)) != MP_OKAY) - return res; - if((res = mp_init_copy(&u, a)) != MP_OKAY) - goto U; - if((res = mp_init_copy(&v, b)) != MP_OKAY) - goto V; - - SIGN(&u) = MP_ZPOS; - SIGN(&v) = MP_ZPOS; - - /* Divide out common factors of 2 until at least 1 of a, b is even */ - while(mp_iseven(&u) && mp_iseven(&v)) { - s_mp_div_2(&u); - s_mp_div_2(&v); - ++k; - } - - /* Initialize t */ - if(mp_isodd(&u)) { - if((res = mp_copy(&v, &t)) != MP_OKAY) - goto CLEANUP; - - /* t = -v */ - if(SIGN(&v) == MP_ZPOS) - SIGN(&t) = MP_NEG; - else - SIGN(&t) = MP_ZPOS; - - } else { - if((res = mp_copy(&u, &t)) != MP_OKAY) - goto CLEANUP; - - } - - for(;;) { - while(mp_iseven(&t)) { - s_mp_div_2(&t); - } - - if(mp_cmp_z(&t) == MP_GT) { - if((res = mp_copy(&t, &u)) != MP_OKAY) - goto CLEANUP; - - } else { - if((res = mp_copy(&t, &v)) != MP_OKAY) - goto CLEANUP; - - /* v = -t */ - if(SIGN(&t) == MP_ZPOS) - SIGN(&v) = MP_NEG; - else - SIGN(&v) = MP_ZPOS; - } - - if((res = mp_sub(&u, &v, &t)) != MP_OKAY) - goto CLEANUP; - - if(s_mp_cmp_d(&t, 0) == MP_EQ) - break; - } - - s_mp_2expt(&v, k); /* v = 2^k */ - res = mp_mul(&u, &v, c); /* c = u * v */ - - CLEANUP: - mp_clear(&v); - V: - mp_clear(&u); - U: - mp_clear(&t); - - return res; - -} /* end mp_bgcd() */ - -/* }}} */ - -/* {{{ mp_lcm(a, b, c) */ - -/* We compute the least common multiple using the rule: - - ab = [a, b](a, b) - - ... by computing the product, and dividing out the gcd. - */ - -mp_err mp_lcm(mp_int *a, mp_int *b, mp_int *c) -{ - mp_int gcd, prod; - mp_err res; - - ARGCHK(a != NULL && b != NULL && c != NULL, MP_BADARG); - - /* Set up temporaries */ - if((res = mp_init(&gcd)) != MP_OKAY) - return res; - if((res = mp_init(&prod)) != MP_OKAY) - goto GCD; - - if((res = mp_mul(a, b, &prod)) != MP_OKAY) - goto CLEANUP; - if((res = mp_gcd(a, b, &gcd)) != MP_OKAY) - goto CLEANUP; - - res = mp_div(&prod, &gcd, c, NULL); - - CLEANUP: - mp_clear(&prod); - GCD: - mp_clear(&gcd); - - return res; - -} /* end mp_lcm() */ - -/* }}} */ - -/* {{{ mp_xgcd(a, b, g, x, y) */ - -/* - mp_xgcd(a, b, g, x, y) - - Compute g = (a, b) and values x and y satisfying Bezout's identity - (that is, ax + by = g). This uses the extended binary GCD algorithm - based on the Stein algorithm used for mp_gcd() - */ - -mp_err mp_xgcd(mp_int *a, mp_int *b, mp_int *g, mp_int *x, mp_int *y) -{ - mp_int gx, xc, yc, u, v, A, B, C, D; - mp_int *clean[9]; - mp_err res; - int last = -1; - - if(mp_cmp_z(b) == 0) - return MP_RANGE; - - /* Initialize all these variables we need */ - if((res = mp_init(&u)) != MP_OKAY) goto CLEANUP; - clean[++last] = &u; - if((res = mp_init(&v)) != MP_OKAY) goto CLEANUP; - clean[++last] = &v; - if((res = mp_init(&gx)) != MP_OKAY) goto CLEANUP; - clean[++last] = &gx; - if((res = mp_init(&A)) != MP_OKAY) goto CLEANUP; - clean[++last] = &A; - if((res = mp_init(&B)) != MP_OKAY) goto CLEANUP; - clean[++last] = &B; - if((res = mp_init(&C)) != MP_OKAY) goto CLEANUP; - clean[++last] = &C; - if((res = mp_init(&D)) != MP_OKAY) goto CLEANUP; - clean[++last] = &D; - if((res = mp_init_copy(&xc, a)) != MP_OKAY) goto CLEANUP; - clean[++last] = &xc; - mp_abs(&xc, &xc); - if((res = mp_init_copy(&yc, b)) != MP_OKAY) goto CLEANUP; - clean[++last] = &yc; - mp_abs(&yc, &yc); - - mp_set(&gx, 1); - - /* Divide by two until at least one of them is even */ - while(mp_iseven(&xc) && mp_iseven(&yc)) { - s_mp_div_2(&xc); - s_mp_div_2(&yc); - if((res = s_mp_mul_2(&gx)) != MP_OKAY) - goto CLEANUP; - } - - mp_copy(&xc, &u); - mp_copy(&yc, &v); - mp_set(&A, 1); mp_set(&D, 1); - - /* Loop through binary GCD algorithm */ - for(;;) { - while(mp_iseven(&u)) { - s_mp_div_2(&u); - - if(mp_iseven(&A) && mp_iseven(&B)) { - s_mp_div_2(&A); s_mp_div_2(&B); - } else { - if((res = mp_add(&A, &yc, &A)) != MP_OKAY) goto CLEANUP; - s_mp_div_2(&A); - if((res = mp_sub(&B, &xc, &B)) != MP_OKAY) goto CLEANUP; - s_mp_div_2(&B); - } - } - - while(mp_iseven(&v)) { - s_mp_div_2(&v); - - if(mp_iseven(&C) && mp_iseven(&D)) { - s_mp_div_2(&C); s_mp_div_2(&D); - } else { - if((res = mp_add(&C, &yc, &C)) != MP_OKAY) goto CLEANUP; - s_mp_div_2(&C); - if((res = mp_sub(&D, &xc, &D)) != MP_OKAY) goto CLEANUP; - s_mp_div_2(&D); - } - } - - if(mp_cmp(&u, &v) >= 0) { - if((res = mp_sub(&u, &v, &u)) != MP_OKAY) goto CLEANUP; - if((res = mp_sub(&A, &C, &A)) != MP_OKAY) goto CLEANUP; - if((res = mp_sub(&B, &D, &B)) != MP_OKAY) goto CLEANUP; - - } else { - if((res = mp_sub(&v, &u, &v)) != MP_OKAY) goto CLEANUP; - if((res = mp_sub(&C, &A, &C)) != MP_OKAY) goto CLEANUP; - if((res = mp_sub(&D, &B, &D)) != MP_OKAY) goto CLEANUP; - - } - - /* If we're done, copy results to output */ - if(mp_cmp_z(&u) == 0) { - if(x) - if((res = mp_copy(&C, x)) != MP_OKAY) goto CLEANUP; - - if(y) - if((res = mp_copy(&D, y)) != MP_OKAY) goto CLEANUP; - - if(g) - if((res = mp_mul(&gx, &v, g)) != MP_OKAY) goto CLEANUP; - - break; - } - } - - CLEANUP: - while(last >= 0) - mp_clear(clean[last--]); - - return res; - -} /* end mp_xgcd() */ - -/* }}} */ - -/* {{{ mp_invmod(a, m, c) */ - -/* - mp_invmod(a, m, c) - - Compute c = a^-1 (mod m), if there is an inverse for a (mod m). - This is equivalent to the question of whether (a, m) = 1. If not, - MP_UNDEF is returned, and there is no inverse. - */ - -mp_err mp_invmod(mp_int *a, mp_int *m, mp_int *c) -{ - mp_int g, x; - mp_err res; - - ARGCHK(a && m && c, MP_BADARG); - - if(mp_cmp_z(a) == 0 || mp_cmp_z(m) == 0) - return MP_RANGE; - - if((res = mp_init(&g)) != MP_OKAY) - return res; - if((res = mp_init(&x)) != MP_OKAY) - goto X; - - if((res = mp_xgcd(a, m, &g, &x, NULL)) != MP_OKAY) - goto CLEANUP; - - if(mp_cmp_d(&g, 1) != MP_EQ) { - res = MP_UNDEF; - goto CLEANUP; - } - - res = mp_mod(&x, m, c); - SIGN(c) = SIGN(a); - -CLEANUP: - mp_clear(&x); -X: - mp_clear(&g); - - return res; - -} /* end mp_invmod() */ - -/* }}} */ -#endif /* if MP_NUMTH */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ mp_print(mp, ofp) */ - -#if MP_IOFUNC -/* - mp_print(mp, ofp) - - Print a textual representation of the given mp_int on the output - stream 'ofp'. Output is generated using the internal radix. - */ - -void mp_print(mp_int *mp, FILE *ofp) -{ - int ix; - - if(mp == NULL || ofp == NULL) - return; - - fputc((SIGN(mp) == MP_NEG) ? '-' : '+', ofp); - - for(ix = USED(mp) - 1; ix >= 0; ix--) { - fprintf(ofp, DIGIT_FMT, DIGIT(mp, ix)); - } - -} /* end mp_print() */ - -#endif /* if MP_IOFUNC */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* {{{ More I/O Functions */ - -/* {{{ mp_read_signed_bin(mp, str, len) */ - -/* - mp_read_signed_bin(mp, str, len) - - Read in a raw value (base 256) into the given mp_int - */ - -mp_err mp_read_signed_bin(mp_int *mp, unsigned char *str, int len) -{ - mp_err res; - - ARGCHK(mp != NULL && str != NULL && len > 0, MP_BADARG); - - if((res = mp_read_unsigned_bin(mp, str + 1, len - 1)) == MP_OKAY) { - /* Get sign from first byte */ - if(str[0]) - SIGN(mp) = MP_NEG; - else - SIGN(mp) = MP_ZPOS; - } - - return res; - -} /* end mp_read_signed_bin() */ - -/* }}} */ - -/* {{{ mp_signed_bin_size(mp) */ - -int mp_signed_bin_size(mp_int *mp) -{ - ARGCHK(mp != NULL, 0); - - return mp_unsigned_bin_size(mp) + 1; - -} /* end mp_signed_bin_size() */ - -/* }}} */ - -/* {{{ mp_to_signed_bin(mp, str) */ - -mp_err mp_to_signed_bin(mp_int *mp, unsigned char *str) -{ - ARGCHK(mp != NULL && str != NULL, MP_BADARG); - - /* Caller responsible for allocating enough memory (use mp_raw_size(mp)) */ - str[0] = (char)SIGN(mp); - - return mp_to_unsigned_bin(mp, str + 1); - -} /* end mp_to_signed_bin() */ - -/* }}} */ - -/* {{{ mp_read_unsigned_bin(mp, str, len) */ - -/* - mp_read_unsigned_bin(mp, str, len) - - Read in an unsigned value (base 256) into the given mp_int - */ - -mp_err mp_read_unsigned_bin(mp_int *mp, unsigned char *str, int len) -{ - int ix; - mp_err res; - - ARGCHK(mp != NULL && str != NULL && len > 0, MP_BADARG); - - mp_zero(mp); - - for(ix = 0; ix < len; ix++) { - if((res = s_mp_mul_2d(mp, CHAR_BIT)) != MP_OKAY) - return res; - - if((res = mp_add_d(mp, str[ix], mp)) != MP_OKAY) - return res; - } - - return MP_OKAY; - -} /* end mp_read_unsigned_bin() */ - -/* }}} */ - -/* {{{ mp_unsigned_bin_size(mp) */ - -int mp_unsigned_bin_size(mp_int *mp) -{ - mp_digit topdig; - int count; - - ARGCHK(mp != NULL, 0); - - /* Special case for the value zero */ - if(USED(mp) == 1 && DIGIT(mp, 0) == 0) - return 1; - - count = (USED(mp) - 1) * sizeof(mp_digit); - topdig = DIGIT(mp, USED(mp) - 1); - - while(topdig != 0) { - ++count; - topdig >>= CHAR_BIT; - } - - return count; - -} /* end mp_unsigned_bin_size() */ - -/* }}} */ - -/* {{{ mp_to_unsigned_bin(mp, str) */ - -mp_err mp_to_unsigned_bin(mp_int *mp, unsigned char *str) -{ - mp_digit *dp, *end, d; - unsigned char *spos; - - ARGCHK(mp != NULL && str != NULL, MP_BADARG); - - dp = DIGITS(mp); - end = dp + USED(mp) - 1; - spos = str; - - /* Special case for zero, quick test */ - if(dp == end && *dp == 0) { - *str = '\0'; - return MP_OKAY; - } - - /* Generate digits in reverse order */ - while(dp < end) { - unsigned int ix; - - d = *dp; - for(ix = 0; ix < sizeof(mp_digit); ++ix) { - *spos = d & UCHAR_MAX; - d >>= CHAR_BIT; - ++spos; - } - - ++dp; - } - - /* Now handle last digit specially, high order zeroes are not written */ - d = *end; - while(d != 0) { - *spos = d & UCHAR_MAX; - d >>= CHAR_BIT; - ++spos; - } - - /* Reverse everything to get digits in the correct order */ - while(--spos > str) { - unsigned char t = *str; - *str = *spos; - *spos = t; - - ++str; - } - - return MP_OKAY; - -} /* end mp_to_unsigned_bin() */ - -/* }}} */ - -/* {{{ mp_count_bits(mp) */ - -int mp_count_bits(mp_int *mp) -{ - int len; - mp_digit d; - - ARGCHK(mp != NULL, MP_BADARG); - - len = DIGIT_BIT * (USED(mp) - 1); - d = DIGIT(mp, USED(mp) - 1); - - while(d != 0) { - ++len; - d >>= 1; - } - - return len; - -} /* end mp_count_bits() */ - -/* }}} */ - -/* {{{ mp_read_radix(mp, str, radix) */ - -/* - mp_read_radix(mp, str, radix) - - Read an integer from the given string, and set mp to the resulting - value. The input is presumed to be in base 10. Leading non-digit - characters are ignored, and the function reads until a non-digit - character or the end of the string. - */ - -mp_err mp_read_radix(mp_int *mp, unsigned char *str, int radix) -{ - int ix = 0, val = 0; - mp_err res; - mp_sign sig = MP_ZPOS; - - ARGCHK(mp != NULL && str != NULL && radix >= 2 && radix <= MAX_RADIX, - MP_BADARG); - - mp_zero(mp); - - /* Skip leading non-digit characters until a digit or '-' or '+' */ - while(str[ix] && - (s_mp_tovalue(str[ix], radix) < 0) && - str[ix] != '-' && - str[ix] != '+') { - ++ix; - } - - if(str[ix] == '-') { - sig = MP_NEG; - ++ix; - } else if(str[ix] == '+') { - sig = MP_ZPOS; /* this is the default anyway... */ - ++ix; - } - - while((val = s_mp_tovalue(str[ix], radix)) >= 0) { - if((res = s_mp_mul_d(mp, radix)) != MP_OKAY) - return res; - if((res = s_mp_add_d(mp, val)) != MP_OKAY) - return res; - ++ix; - } - - if(s_mp_cmp_d(mp, 0) == MP_EQ) - SIGN(mp) = MP_ZPOS; - else - SIGN(mp) = sig; - - return MP_OKAY; - -} /* end mp_read_radix() */ - -/* }}} */ - -/* {{{ mp_radix_size(mp, radix) */ - -int mp_radix_size(mp_int *mp, int radix) -{ - int len; - ARGCHK(mp != NULL, 0); - - len = s_mp_outlen(mp_count_bits(mp), radix) + 1; /* for NUL terminator */ - - if(mp_cmp_z(mp) < 0) - ++len; /* for sign */ - - return len; - -} /* end mp_radix_size() */ - -/* }}} */ - -/* {{{ mp_value_radix_size(num, qty, radix) */ - -/* num = number of digits - qty = number of bits per digit - radix = target base - - Return the number of digits in the specified radix that would be - needed to express 'num' digits of 'qty' bits each. - */ -int mp_value_radix_size(int num, int qty, int radix) -{ - ARGCHK(num >= 0 && qty > 0 && radix >= 2 && radix <= MAX_RADIX, 0); - - return s_mp_outlen(num * qty, radix); - -} /* end mp_value_radix_size() */ - -/* }}} */ - -/* {{{ mp_toradix(mp, str, radix) */ - -mp_err mp_toradix(mp_int *mp, char *str, int radix) -{ - int ix, pos = 0; - - ARGCHK(mp != NULL && str != NULL, MP_BADARG); - ARGCHK(radix > 1 && radix <= MAX_RADIX, MP_RANGE); - - if(mp_cmp_z(mp) == MP_EQ) { - str[0] = '0'; - str[1] = '\0'; - } else { - mp_err res; - mp_int tmp; - mp_sign sgn; - mp_digit rem, rdx = (mp_digit)radix; - char ch; - - if((res = mp_init_copy(&tmp, mp)) != MP_OKAY) - return res; - - /* Save sign for later, and take absolute value */ - sgn = SIGN(&tmp); SIGN(&tmp) = MP_ZPOS; - - /* Generate output digits in reverse order */ - while(mp_cmp_z(&tmp) != 0) { - if((res = s_mp_div_d(&tmp, rdx, &rem)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - - /* Generate digits, use capital letters */ - ch = s_mp_todigit(rem, radix, 0); - - str[pos++] = ch; - } - - /* Add - sign if original value was negative */ - if(sgn == MP_NEG) - str[pos++] = '-'; - - /* Add trailing NUL to end the string */ - str[pos--] = '\0'; - - /* Reverse the digits and sign indicator */ - ix = 0; - while(ix < pos) { - char _tmp = str[ix]; - - str[ix] = str[pos]; - str[pos] = _tmp; - ++ix; - --pos; - } - - mp_clear(&tmp); - } - - return MP_OKAY; - -} /* end mp_toradix() */ - -/* }}} */ - -/* {{{ mp_char2value(ch, r) */ - -int mp_char2value(char ch, int r) -{ - return s_mp_tovalue(ch, r); - -} /* end mp_tovalue() */ - -/* }}} */ - -/* }}} */ - -/* {{{ mp_strerror(ec) */ - -/* - mp_strerror(ec) - - Return a string describing the meaning of error code 'ec'. The - string returned is allocated in static memory, so the caller should - not attempt to modify or free the memory associated with this - string. - */ -const char *mp_strerror(mp_err ec) -{ - int aec = (ec < 0) ? -ec : ec; - - /* Code values are negative, so the senses of these comparisons - are accurate */ - if(ec < MP_LAST_CODE || ec > MP_OKAY) { - return mp_err_string[0]; /* unknown error code */ - } else { - return mp_err_string[aec + 1]; - } - -} /* end mp_strerror() */ - -/* }}} */ - -/*========================================================================*/ -/*------------------------------------------------------------------------*/ -/* Static function definitions (internal use only) */ - -/* {{{ Memory management */ - -/* {{{ s_mp_grow(mp, min) */ - -/* Make sure there are at least 'min' digits allocated to mp */ -mp_err s_mp_grow(mp_int *mp, mp_size min) -{ - if(min > ALLOC(mp)) { - mp_digit *tmp; - - /* Set min to next nearest default precision block size */ - min = ((min + (s_mp_defprec - 1)) / s_mp_defprec) * s_mp_defprec; - - if((tmp = s_mp_alloc(min, sizeof(mp_digit))) == NULL) - return MP_MEM; - - s_mp_copy(DIGITS(mp), tmp, USED(mp)); - -#if MP_CRYPTO - s_mp_setz(DIGITS(mp), ALLOC(mp)); -#endif - s_mp_free(DIGITS(mp)); - DIGITS(mp) = tmp; - ALLOC(mp) = min; - } - - return MP_OKAY; - -} /* end s_mp_grow() */ - -/* }}} */ - -/* {{{ s_mp_pad(mp, min) */ - -/* Make sure the used size of mp is at least 'min', growing if needed */ -mp_err s_mp_pad(mp_int *mp, mp_size min) -{ - if(min > USED(mp)) { - mp_err res; - - /* Make sure there is room to increase precision */ - if(min > ALLOC(mp) && (res = s_mp_grow(mp, min)) != MP_OKAY) - return res; - - /* Increase precision; should already be 0-filled */ - USED(mp) = min; - } - - return MP_OKAY; - -} /* end s_mp_pad() */ - -/* }}} */ - -/* {{{ s_mp_setz(dp, count) */ - -#if MP_MACRO == 0 -/* Set 'count' digits pointed to by dp to be zeroes */ -void s_mp_setz(mp_digit *dp, mp_size count) -{ -#if MP_MEMSET == 0 - int ix; - - for(ix = 0; ix < count; ix++) - dp[ix] = 0; -#else - memset(dp, 0, count * sizeof(mp_digit)); -#endif - -} /* end s_mp_setz() */ -#endif - -/* }}} */ - -/* {{{ s_mp_copy(sp, dp, count) */ - -#if MP_MACRO == 0 -/* Copy 'count' digits from sp to dp */ -void s_mp_copy(mp_digit *sp, mp_digit *dp, mp_size count) -{ -#if MP_MEMCPY == 0 - int ix; - - for(ix = 0; ix < count; ix++) - dp[ix] = sp[ix]; -#else - memcpy(dp, sp, count * sizeof(mp_digit)); -#endif - -} /* end s_mp_copy() */ -#endif - -/* }}} */ - -/* {{{ s_mp_alloc(nb, ni) */ - -#if MP_MACRO == 0 -/* Allocate ni records of nb bytes each, and return a pointer to that */ -void *s_mp_alloc(size_t nb, size_t ni) -{ - return calloc(nb, ni); - -} /* end s_mp_alloc() */ -#endif - -/* }}} */ - -/* {{{ s_mp_free(ptr) */ - -#if MP_MACRO == 0 -/* Free the memory pointed to by ptr */ -void s_mp_free(void *ptr) -{ - if(ptr) - free(ptr); - -} /* end s_mp_free() */ -#endif - -/* }}} */ - -/* {{{ s_mp_clamp(mp) */ - -/* Remove leading zeroes from the given value */ -void s_mp_clamp(mp_int *mp) -{ - mp_size du = USED(mp); - mp_digit *zp = DIGITS(mp) + du - 1; - - while(du > 1 && !*zp--) - --du; - - USED(mp) = du; - -} /* end s_mp_clamp() */ - - -/* }}} */ - -/* {{{ s_mp_exch(a, b) */ - -/* Exchange the data for a and b; (b, a) = (a, b) */ -void s_mp_exch(mp_int *a, mp_int *b) -{ - mp_int tmp; - - tmp = *a; - *a = *b; - *b = tmp; - -} /* end s_mp_exch() */ - -/* }}} */ - -/* }}} */ - -/* {{{ Arithmetic helpers */ - -/* {{{ s_mp_lshd(mp, p) */ - -/* - Shift mp leftward by p digits, growing if needed, and zero-filling - the in-shifted digits at the right end. This is a convenient - alternative to multiplication by powers of the radix - */ - -mp_err s_mp_lshd(mp_int *mp, mp_size p) -{ - mp_err res; - mp_size pos; - mp_digit *dp; - int ix; - - if(p == 0) - return MP_OKAY; - - if((res = s_mp_pad(mp, USED(mp) + p)) != MP_OKAY) - return res; - - pos = USED(mp) - 1; - dp = DIGITS(mp); - - /* Shift all the significant figures over as needed */ - for(ix = pos - p; ix >= 0; ix--) - dp[ix + p] = dp[ix]; - - /* Fill the bottom digits with zeroes */ - for(ix = 0; (unsigned)ix < p; ix++) - dp[ix] = 0; - - return MP_OKAY; - -} /* end s_mp_lshd() */ - -/* }}} */ - -/* {{{ s_mp_rshd(mp, p) */ - -/* - Shift mp rightward by p digits. Maintains the invariant that - digits above the precision are all zero. Digits shifted off the - end are lost. Cannot fail. - */ - -void s_mp_rshd(mp_int *mp, mp_size p) -{ - mp_size ix; - mp_digit *dp; - - if(p == 0) - return; - - /* Shortcut when all digits are to be shifted off */ - if(p >= USED(mp)) { - s_mp_setz(DIGITS(mp), ALLOC(mp)); - USED(mp) = 1; - SIGN(mp) = MP_ZPOS; - return; - } - - /* Shift all the significant figures over as needed */ - dp = DIGITS(mp); - for(ix = p; ix < USED(mp); ix++) - dp[ix - p] = dp[ix]; - - /* Fill the top digits with zeroes */ - ix -= p; - while(ix < USED(mp)) - dp[ix++] = 0; - - /* Strip off any leading zeroes */ - s_mp_clamp(mp); - -} /* end s_mp_rshd() */ - -/* }}} */ - -/* {{{ s_mp_div_2(mp) */ - -/* Divide by two -- take advantage of radix properties to do it fast */ -void s_mp_div_2(mp_int *mp) -{ - s_mp_div_2d(mp, 1); - -} /* end s_mp_div_2() */ - -/* }}} */ - -/* {{{ s_mp_mul_2(mp) */ - -mp_err s_mp_mul_2(mp_int *mp) -{ - unsigned int ix; - mp_digit kin = 0, kout, *dp = DIGITS(mp); - mp_err res; - - /* Shift digits leftward by 1 bit */ - for(ix = 0; ix < USED(mp); ix++) { - kout = (dp[ix] >> (DIGIT_BIT - 1)) & 1; - dp[ix] = (dp[ix] << 1) | kin; - - kin = kout; - } - - /* Deal with rollover from last digit */ - if(kin) { - if(ix >= ALLOC(mp)) { - if((res = s_mp_grow(mp, ALLOC(mp) + 1)) != MP_OKAY) - return res; - dp = DIGITS(mp); - } - - dp[ix] = kin; - USED(mp) += 1; - } - - return MP_OKAY; - -} /* end s_mp_mul_2() */ - -/* }}} */ - -/* {{{ s_mp_mod_2d(mp, d) */ - -/* - Remainder the integer by 2^d, where d is a number of bits. This - amounts to a bitwise AND of the value, and does not require the full - division code - */ -void s_mp_mod_2d(mp_int *mp, mp_digit d) -{ - unsigned int ndig = (d / DIGIT_BIT), nbit = (d % DIGIT_BIT); - unsigned int ix; - mp_digit dmask, *dp = DIGITS(mp); - - if(ndig >= USED(mp)) - return; - - /* Flush all the bits above 2^d in its digit */ - dmask = (1 << nbit) - 1; - dp[ndig] &= dmask; - - /* Flush all digits above the one with 2^d in it */ - for(ix = ndig + 1; ix < USED(mp); ix++) - dp[ix] = 0; - - s_mp_clamp(mp); - -} /* end s_mp_mod_2d() */ - -/* }}} */ - -/* {{{ s_mp_mul_2d(mp, d) */ - -/* - Multiply by the integer 2^d, where d is a number of bits. This - amounts to a bitwise shift of the value, and does not require the - full multiplication code. - */ -mp_err s_mp_mul_2d(mp_int *mp, mp_digit d) -{ - mp_err res; - mp_digit save, next, mask, *dp; - mp_size used; - unsigned int ix; - - if((res = s_mp_lshd(mp, d / DIGIT_BIT)) != MP_OKAY) - return res; - - dp = DIGITS(mp); used = USED(mp); - d %= DIGIT_BIT; - - mask = (1 << d) - 1; - - /* If the shift requires another digit, make sure we've got one to - work with */ - if((dp[used - 1] >> (DIGIT_BIT - d)) & mask) { - if((res = s_mp_grow(mp, used + 1)) != MP_OKAY) - return res; - dp = DIGITS(mp); - } - - /* Do the shifting... */ - save = 0; - for(ix = 0; ix < used; ix++) { - next = (dp[ix] >> (DIGIT_BIT - d)) & mask; - dp[ix] = (dp[ix] << d) | save; - save = next; - } - - /* If, at this point, we have a nonzero carryout into the next - digit, we'll increase the size by one digit, and store it... - */ - if(save) { - dp[used] = save; - USED(mp) += 1; - } - - s_mp_clamp(mp); - return MP_OKAY; - -} /* end s_mp_mul_2d() */ - -/* }}} */ - -/* {{{ s_mp_div_2d(mp, d) */ - -/* - Divide the integer by 2^d, where d is a number of bits. This - amounts to a bitwise shift of the value, and does not require the - full division code (used in Barrett reduction, see below) - */ -void s_mp_div_2d(mp_int *mp, mp_digit d) -{ - int ix; - mp_digit save, next, mask, *dp = DIGITS(mp); - - s_mp_rshd(mp, d / DIGIT_BIT); - d %= DIGIT_BIT; - - mask = (1 << d) - 1; - - save = 0; - for(ix = USED(mp) - 1; ix >= 0; ix--) { - next = dp[ix] & mask; - dp[ix] = (dp[ix] >> d) | (save << (DIGIT_BIT - d)); - save = next; - } - - s_mp_clamp(mp); - -} /* end s_mp_div_2d() */ - -/* }}} */ - -/* {{{ s_mp_norm(a, b) */ - -/* - s_mp_norm(a, b) - - Normalize a and b for division, where b is the divisor. In order - that we might make good guesses for quotient digits, we want the - leading digit of b to be at least half the radix, which we - accomplish by multiplying a and b by a constant. This constant is - returned (so that it can be divided back out of the remainder at the - end of the division process). - - We multiply by the smallest power of 2 that gives us a leading digit - at least half the radix. By choosing a power of 2, we simplify the - multiplication and division steps to simple shifts. - */ -mp_digit s_mp_norm(mp_int *a, mp_int *b) -{ - mp_digit t, d = 0; - - t = DIGIT(b, USED(b) - 1); - while(t < (RADIX / 2)) { - t <<= 1; - ++d; - } - - if(d != 0) { - s_mp_mul_2d(a, d); - s_mp_mul_2d(b, d); - } - - return d; - -} /* end s_mp_norm() */ - -/* }}} */ - -/* }}} */ - -/* {{{ Primitive digit arithmetic */ - -/* {{{ s_mp_add_d(mp, d) */ - -/* Add d to |mp| in place */ -mp_err s_mp_add_d(mp_int *mp, mp_digit d) /* unsigned digit addition */ -{ - mp_word w, k = 0; - mp_size ix = 1, used = USED(mp); - mp_digit *dp = DIGITS(mp); - - w = dp[0] + d; - dp[0] = ACCUM(w); - k = CARRYOUT(w); - - while(ix < used && k) { - w = dp[ix] + k; - dp[ix] = ACCUM(w); - k = CARRYOUT(w); - ++ix; - } - - if(k != 0) { - mp_err res; - - if((res = s_mp_pad(mp, USED(mp) + 1)) != MP_OKAY) - return res; - - DIGIT(mp, ix) = k; - } - - return MP_OKAY; - -} /* end s_mp_add_d() */ - -/* }}} */ - -/* {{{ s_mp_sub_d(mp, d) */ - -/* Subtract d from |mp| in place, assumes |mp| > d */ -mp_err s_mp_sub_d(mp_int *mp, mp_digit d) /* unsigned digit subtract */ -{ - mp_word w, b = 0; - mp_size ix = 1, used = USED(mp); - mp_digit *dp = DIGITS(mp); - - /* Compute initial subtraction */ - w = (RADIX + dp[0]) - d; - b = CARRYOUT(w) ? 0 : 1; - dp[0] = ACCUM(w); - - /* Propagate borrows leftward */ - while(b && ix < used) { - w = (RADIX + dp[ix]) - b; - b = CARRYOUT(w) ? 0 : 1; - dp[ix] = ACCUM(w); - ++ix; - } - - /* Remove leading zeroes */ - s_mp_clamp(mp); - - /* If we have a borrow out, it's a violation of the input invariant */ - if(b) - return MP_RANGE; - else - return MP_OKAY; - -} /* end s_mp_sub_d() */ - -/* }}} */ - -/* {{{ s_mp_mul_d(a, d) */ - -/* Compute a = a * d, single digit multiplication */ -mp_err s_mp_mul_d(mp_int *a, mp_digit d) -{ - mp_word w, k = 0; - mp_size ix, max; - mp_err res; - mp_digit *dp = DIGITS(a); - - /* - Single-digit multiplication will increase the precision of the - output by at most one digit. However, we can detect when this - will happen -- if the high-order digit of a, times d, gives a - two-digit result, then the precision of the result will increase; - otherwise it won't. We use this fact to avoid calling s_mp_pad() - unless absolutely necessary. - */ - max = USED(a); - w = dp[max - 1] * d; - if(CARRYOUT(w) != 0) { - if((res = s_mp_pad(a, max + 1)) != MP_OKAY) - return res; - dp = DIGITS(a); - } - - for(ix = 0; ix < max; ix++) { - w = (dp[ix] * d) + k; - dp[ix] = ACCUM(w); - k = CARRYOUT(w); - } - - /* If there is a precision increase, take care of it here; the above - test guarantees we have enough storage to do this safely. - */ - if(k) { - dp[max] = k; - USED(a) = max + 1; - } - - s_mp_clamp(a); - - return MP_OKAY; - -} /* end s_mp_mul_d() */ - -/* }}} */ - -/* {{{ s_mp_div_d(mp, d, r) */ - -/* - s_mp_div_d(mp, d, r) - - Compute the quotient mp = mp / d and remainder r = mp mod d, for a - single digit d. If r is null, the remainder will be discarded. - */ - -mp_err s_mp_div_d(mp_int *mp, mp_digit d, mp_digit *r) -{ - mp_word w = 0, t; - mp_int quot; - mp_err res; - mp_digit *dp = DIGITS(mp), *qp; - int ix; - - if(d == 0) - return MP_RANGE; - - /* Make room for the quotient */ - if((res = mp_init_size(", USED(mp))) != MP_OKAY) - return res; - - USED(") = USED(mp); /* so clamping will work below */ - qp = DIGITS("); - - /* Divide without subtraction */ - for(ix = USED(mp) - 1; ix >= 0; ix--) { - w = (w << DIGIT_BIT) | dp[ix]; - - if(w >= d) { - t = w / d; - w = w % d; - } else { - t = 0; - } - - qp[ix] = t; - } - - /* Deliver the remainder, if desired */ - if(r) - *r = w; - - s_mp_clamp("); - mp_exch(", mp); - mp_clear("); - - return MP_OKAY; - -} /* end s_mp_div_d() */ - -/* }}} */ - -/* }}} */ - -/* {{{ Primitive full arithmetic */ - -/* {{{ s_mp_add(a, b) */ - -/* Compute a = |a| + |b| */ -mp_err s_mp_add(mp_int *a, mp_int *b) /* magnitude addition */ -{ - mp_word w = 0; - mp_digit *pa, *pb; - mp_size ix, used = USED(b); - mp_err res; - - /* Make sure a has enough precision for the output value */ - if((used > USED(a)) && (res = s_mp_pad(a, used)) != MP_OKAY) - return res; - - /* - Add up all digits up to the precision of b. If b had initially - the same precision as a, or greater, we took care of it by the - padding step above, so there is no problem. If b had initially - less precision, we'll have to make sure the carry out is duly - propagated upward among the higher-order digits of the sum. - */ - pa = DIGITS(a); - pb = DIGITS(b); - for(ix = 0; ix < used; ++ix) { - w += *pa + *pb++; - *pa++ = ACCUM(w); - w = CARRYOUT(w); - } - - /* If we run out of 'b' digits before we're actually done, make - sure the carries get propagated upward... - */ - used = USED(a); - while(w && ix < used) { - w += *pa; - *pa++ = ACCUM(w); - w = CARRYOUT(w); - ++ix; - } - - /* If there's an overall carry out, increase precision and include - it. We could have done this initially, but why touch the memory - allocator unless we're sure we have to? - */ - if(w) { - if((res = s_mp_pad(a, used + 1)) != MP_OKAY) - return res; - - DIGIT(a, ix) = w; /* pa may not be valid after s_mp_pad() call */ - } - - return MP_OKAY; - -} /* end s_mp_add() */ - -/* }}} */ - -/* {{{ s_mp_sub(a, b) */ - -/* Compute a = |a| - |b|, assumes |a| >= |b| */ -mp_err s_mp_sub(mp_int *a, mp_int *b) /* magnitude subtract */ -{ - mp_word w = 0; - mp_digit *pa, *pb; - mp_size ix, used = USED(b); - - /* - Subtract and propagate borrow. Up to the precision of b, this - accounts for the digits of b; after that, we just make sure the - carries get to the right place. This saves having to pad b out to - the precision of a just to make the loops work right... - */ - pa = DIGITS(a); - pb = DIGITS(b); - - for(ix = 0; ix < used; ++ix) { - w = (RADIX + *pa) - w - *pb++; - *pa++ = ACCUM(w); - w = CARRYOUT(w) ? 0 : 1; - } - - used = USED(a); - while(ix < used) { - w = RADIX + *pa - w; - *pa++ = ACCUM(w); - w = CARRYOUT(w) ? 0 : 1; - ++ix; - } - - /* Clobber any leading zeroes we created */ - s_mp_clamp(a); - - /* - If there was a borrow out, then |b| > |a| in violation - of our input invariant. We've already done the work, - but we'll at least complain about it... - */ - if(w) - return MP_RANGE; - else - return MP_OKAY; - -} /* end s_mp_sub() */ - -/* }}} */ - -mp_err s_mp_reduce(mp_int *x, mp_int *m, mp_int *mu) -{ - mp_int q; - mp_err res; - mp_size um = USED(m); - - if((res = mp_init_copy(&q, x)) != MP_OKAY) - return res; - - s_mp_rshd(&q, um - 1); /* q1 = x / b^(k-1) */ - s_mp_mul(&q, mu); /* q2 = q1 * mu */ - s_mp_rshd(&q, um + 1); /* q3 = q2 / b^(k+1) */ - - /* x = x mod b^(k+1), quick (no division) */ - s_mp_mod_2d(x, (mp_digit)(DIGIT_BIT * (um + 1))); - - /* q = q * m mod b^(k+1), quick (no division), uses the short multiplier */ -#ifndef SHRT_MUL - s_mp_mul(&q, m); - s_mp_mod_2d(&q, (mp_digit)(DIGIT_BIT * (um + 1))); -#else - s_mp_mul_dig(&q, m, um + 1); -#endif - - /* x = x - q */ - if((res = mp_sub(x, &q, x)) != MP_OKAY) - goto CLEANUP; - - /* If x < 0, add b^(k+1) to it */ - if(mp_cmp_z(x) < 0) { - mp_set(&q, 1); - if((res = s_mp_lshd(&q, um + 1)) != MP_OKAY) - goto CLEANUP; - if((res = mp_add(x, &q, x)) != MP_OKAY) - goto CLEANUP; - } - - /* Back off if it's too big */ - while(mp_cmp(x, m) >= 0) { - if((res = s_mp_sub(x, m)) != MP_OKAY) - break; - } - - CLEANUP: - mp_clear(&q); - - return res; - -} /* end s_mp_reduce() */ - - - -/* {{{ s_mp_mul(a, b) */ - -/* Compute a = |a| * |b| */ -mp_err s_mp_mul(mp_int *a, mp_int *b) -{ - mp_word w, k = 0; - mp_int tmp; - mp_err res; - mp_size ix, jx, ua = USED(a), ub = USED(b); - mp_digit *pa, *pb, *pt, *pbt; - - if((res = mp_init_size(&tmp, ua + ub)) != MP_OKAY) - return res; - - /* This has the effect of left-padding with zeroes... */ - USED(&tmp) = ua + ub; - - /* We're going to need the base value each iteration */ - pbt = DIGITS(&tmp); - - /* Outer loop: Digits of b */ - - pb = DIGITS(b); - for(ix = 0; ix < ub; ++ix, ++pb) { - if(*pb == 0) - continue; - - /* Inner product: Digits of a */ - pa = DIGITS(a); - for(jx = 0; jx < ua; ++jx, ++pa) { - pt = pbt + ix + jx; - w = *pb * *pa + k + *pt; - *pt = ACCUM(w); - k = CARRYOUT(w); - } - - pbt[ix + jx] = k; - k = 0; - } - - s_mp_clamp(&tmp); - s_mp_exch(&tmp, a); - - mp_clear(&tmp); - - return MP_OKAY; - -} /* end s_mp_mul() */ - -/* }}} */ - -/* {{{ s_mp_kmul(a, b, out, len) */ - -#if 0 -void s_mp_kmul(mp_digit *a, mp_digit *b, mp_digit *out, mp_size len) -{ - mp_word w, k = 0; - mp_size ix, jx; - mp_digit *pa, *pt; - - for(ix = 0; ix < len; ++ix, ++b) { - if(*b == 0) - continue; - - pa = a; - for(jx = 0; jx < len; ++jx, ++pa) { - pt = out + ix + jx; - w = *b * *pa + k + *pt; - *pt = ACCUM(w); - k = CARRYOUT(w); - } - - out[ix + jx] = k; - k = 0; - } - -} /* end s_mp_kmul() */ -#endif - -/* }}} */ - -/* {{{ s_mp_sqr(a) */ - -/* - Computes the square of a, in place. This can be done more - efficiently than a general multiplication, because many of the - computation steps are redundant when squaring. The inner product - step is a bit more complicated, but we save a fair number of - iterations of the multiplication loop. - */ -#if MP_SQUARE -mp_err s_mp_sqr(mp_int *a) -{ - mp_word w, k = 0; - mp_int tmp; - mp_err res; - mp_size ix, jx, kx, used = USED(a); - mp_digit *pa1, *pa2, *pt, *pbt; - - if((res = mp_init_size(&tmp, 2 * used)) != MP_OKAY) - return res; - - /* Left-pad with zeroes */ - USED(&tmp) = 2 * used; - - /* We need the base value each time through the loop */ - pbt = DIGITS(&tmp); - - pa1 = DIGITS(a); - for(ix = 0; ix < used; ++ix, ++pa1) { - if(*pa1 == 0) - continue; - - w = DIGIT(&tmp, ix + ix) + (*pa1 * *pa1); - - pbt[ix + ix] = ACCUM(w); - k = CARRYOUT(w); - - /* - The inner product is computed as: - - (C, S) = t[i,j] + 2 a[i] a[j] + C - - This can overflow what can be represented in an mp_word, and - since C arithmetic does not provide any way to check for - overflow, we have to check explicitly for overflow conditions - before they happen. - */ - for(jx = ix + 1, pa2 = DIGITS(a) + jx; jx < used; ++jx, ++pa2) { - mp_word u = 0, v; - - /* Store this in a temporary to avoid indirections later */ - pt = pbt + ix + jx; - - /* Compute the multiplicative step */ - w = *pa1 * *pa2; - - /* If w is more than half MP_WORD_MAX, the doubling will - overflow, and we need to record a carry out into the next - word */ - u = (w >> (MP_WORD_BIT - 1)) & 1; - - /* Double what we've got, overflow will be ignored as defined - for C arithmetic (we've already noted if it is to occur) - */ - w *= 2; - - /* Compute the additive step */ - v = *pt + k; - - /* If we do not already have an overflow carry, check to see - if the addition will cause one, and set the carry out if so - */ - u |= ((MP_WORD_MAX - v) < w); - - /* Add in the rest, again ignoring overflow */ - w += v; - - /* Set the i,j digit of the output */ - *pt = ACCUM(w); - - /* Save carry information for the next iteration of the loop. - This is why k must be an mp_word, instead of an mp_digit */ - k = CARRYOUT(w) | (u << DIGIT_BIT); - - } /* for(jx ...) */ - - /* Set the last digit in the cycle and reset the carry */ - k = DIGIT(&tmp, ix + jx) + k; - pbt[ix + jx] = ACCUM(k); - k = CARRYOUT(k); - - /* If we are carrying out, propagate the carry to the next digit - in the output. This may cascade, so we have to be somewhat - circumspect -- but we will have enough precision in the output - that we won't overflow - */ - kx = 1; - while(k) { - k = pbt[ix + jx + kx] + 1; - pbt[ix + jx + kx] = ACCUM(k); - k = CARRYOUT(k); - ++kx; - } - } /* for(ix ...) */ - - s_mp_clamp(&tmp); - s_mp_exch(&tmp, a); - - mp_clear(&tmp); - - return MP_OKAY; - -} /* end s_mp_sqr() */ -#endif - -/* }}} */ - -/* {{{ s_mp_div(a, b) */ - -/* - s_mp_div(a, b) - - Compute a = a / b and b = a mod b. Assumes b > a. - */ - -mp_err s_mp_div(mp_int *a, mp_int *b) -{ - mp_int quot, rem, t; - mp_word q; - mp_err res; - mp_digit d; - int ix; - - if(mp_cmp_z(b) == 0) - return MP_RANGE; - - /* Shortcut if b is power of two */ - if((ix = s_mp_ispow2(b)) >= 0) { - mp_copy(a, b); /* need this for remainder */ - s_mp_div_2d(a, (mp_digit)ix); - s_mp_mod_2d(b, (mp_digit)ix); - - return MP_OKAY; - } - - /* Allocate space to store the quotient */ - if((res = mp_init_size(", USED(a))) != MP_OKAY) - return res; - - /* A working temporary for division */ - if((res = mp_init_size(&t, USED(a))) != MP_OKAY) - goto T; - - /* Allocate space for the remainder */ - if((res = mp_init_size(&rem, USED(a))) != MP_OKAY) - goto REM; - - /* Normalize to optimize guessing */ - d = s_mp_norm(a, b); - - /* Perform the division itself...woo! */ - ix = USED(a) - 1; - - while(ix >= 0) { - /* Find a partial substring of a which is at least b */ - while(s_mp_cmp(&rem, b) < 0 && ix >= 0) { - if((res = s_mp_lshd(&rem, 1)) != MP_OKAY) - goto CLEANUP; - - if((res = s_mp_lshd(", 1)) != MP_OKAY) - goto CLEANUP; - - DIGIT(&rem, 0) = DIGIT(a, ix); - s_mp_clamp(&rem); - --ix; - } - - /* If we didn't find one, we're finished dividing */ - if(s_mp_cmp(&rem, b) < 0) - break; - - /* Compute a guess for the next quotient digit */ - q = DIGIT(&rem, USED(&rem) - 1); - if(q <= DIGIT(b, USED(b) - 1) && USED(&rem) > 1) - q = (q << DIGIT_BIT) | DIGIT(&rem, USED(&rem) - 2); - - q /= DIGIT(b, USED(b) - 1); - - /* The guess can be as much as RADIX + 1 */ - if(q >= RADIX) - q = RADIX - 1; - - /* See what that multiplies out to */ - mp_copy(b, &t); - if((res = s_mp_mul_d(&t, q)) != MP_OKAY) - goto CLEANUP; - - /* - If it's too big, back it off. We should not have to do this - more than once, or, in rare cases, twice. Knuth describes a - method by which this could be reduced to a maximum of once, but - I didn't implement that here. - */ - while(s_mp_cmp(&t, &rem) > 0) { - --q; - s_mp_sub(&t, b); - } - - /* At this point, q should be the right next digit */ - if((res = s_mp_sub(&rem, &t)) != MP_OKAY) - goto CLEANUP; - - /* - Include the digit in the quotient. We allocated enough memory - for any quotient we could ever possibly get, so we should not - have to check for failures here - */ - DIGIT(", 0) = q; - } - - /* Denormalize remainder */ - if(d != 0) - s_mp_div_2d(&rem, d); - - s_mp_clamp("); - s_mp_clamp(&rem); - - /* Copy quotient back to output */ - s_mp_exch(", a); - - /* Copy remainder back to output */ - s_mp_exch(&rem, b); - -CLEANUP: - mp_clear(&rem); -REM: - mp_clear(&t); -T: - mp_clear("); - - return res; - -} /* end s_mp_div() */ - -/* }}} */ - -/* {{{ s_mp_2expt(a, k) */ - -mp_err s_mp_2expt(mp_int *a, mp_digit k) -{ - mp_err res; - mp_size dig, bit; - - dig = k / DIGIT_BIT; - bit = k % DIGIT_BIT; - - mp_zero(a); - if((res = s_mp_pad(a, dig + 1)) != MP_OKAY) - return res; - - DIGIT(a, dig) |= (1 << bit); - - return MP_OKAY; - -} /* end s_mp_2expt() */ - -/* }}} */ - - -/* }}} */ - -/* }}} */ - -/* {{{ Primitive comparisons */ - -/* {{{ s_mp_cmp(a, b) */ - -/* Compare |a| <=> |b|, return 0 if equal, <0 if a0 if a>b */ -int s_mp_cmp(mp_int *a, mp_int *b) -{ - mp_size ua = USED(a), ub = USED(b); - - if(ua > ub) - return MP_GT; - else if(ua < ub) - return MP_LT; - else { - int ix = ua - 1; - mp_digit *ap = DIGITS(a) + ix, *bp = DIGITS(b) + ix; - - while(ix >= 0) { - if(*ap > *bp) - return MP_GT; - else if(*ap < *bp) - return MP_LT; - - --ap; --bp; --ix; - } - - return MP_EQ; - } - -} /* end s_mp_cmp() */ - -/* }}} */ - -/* {{{ s_mp_cmp_d(a, d) */ - -/* Compare |a| <=> d, return 0 if equal, <0 if a0 if a>d */ -int s_mp_cmp_d(mp_int *a, mp_digit d) -{ - mp_size ua = USED(a); - mp_digit *ap = DIGITS(a); - - if(ua > 1) - return MP_GT; - - if(*ap < d) - return MP_LT; - else if(*ap > d) - return MP_GT; - else - return MP_EQ; - -} /* end s_mp_cmp_d() */ - -/* }}} */ - -/* {{{ s_mp_ispow2(v) */ - -/* - Returns -1 if the value is not a power of two; otherwise, it returns - k such that v = 2^k, i.e. lg(v). - */ -int s_mp_ispow2(mp_int *v) -{ - mp_digit d, *dp; - mp_size uv = USED(v); - int extra = 0, ix; - - d = DIGIT(v, uv - 1); /* most significant digit of v */ - - while(d && ((d & 1) == 0)) { - d >>= 1; - ++extra; - } - - if(d == 1) { - ix = uv - 2; - dp = DIGITS(v) + ix; - - while(ix >= 0) { - if(*dp) - return -1; /* not a power of two */ - - --dp; --ix; - } - - return ((uv - 1) * DIGIT_BIT) + extra; - } - - return -1; - -} /* end s_mp_ispow2() */ - -/* }}} */ - -/* {{{ s_mp_ispow2d(d) */ - -int s_mp_ispow2d(mp_digit d) -{ - int pow = 0; - - while((d & 1) == 0) { - ++pow; d >>= 1; - } - - if(d == 1) - return pow; - - return -1; - -} /* end s_mp_ispow2d() */ - -/* }}} */ - -/* }}} */ - -/* {{{ Primitive I/O helpers */ - -/* {{{ s_mp_tovalue(ch, r) */ - -/* - Convert the given character to its digit value, in the given radix. - If the given character is not understood in the given radix, -1 is - returned. Otherwise the digit's numeric value is returned. - - The results will be odd if you use a radix < 2 or > 62, you are - expected to know what you're up to. - */ -int s_mp_tovalue(char ch, int r) -{ - int val, xch; - - if(r > 36) - xch = ch; - else - xch = toupper(ch); - - if(isdigit(xch)) - val = xch - '0'; - else if(isupper(xch)) - val = xch - 'A' + 10; - else if(islower(xch)) - val = xch - 'a' + 36; - else if(xch == '+') - val = 62; - else if(xch == '/') - val = 63; - else - return -1; - - if(val < 0 || val >= r) - return -1; - - return val; - -} /* end s_mp_tovalue() */ - -/* }}} */ - -/* {{{ s_mp_todigit(val, r, low) */ - -/* - Convert val to a radix-r digit, if possible. If val is out of range - for r, returns zero. Otherwise, returns an ASCII character denoting - the value in the given radix. - - The results may be odd if you use a radix < 2 or > 64, you are - expected to know what you're doing. - */ - -char s_mp_todigit(int val, int r, int low) -{ - char ch; - - if(val < 0 || val >= r) - return 0; - - ch = s_dmap_1[val]; - - if(r <= 36 && low) - ch = tolower(ch); - - return ch; - -} /* end s_mp_todigit() */ - -/* }}} */ - -/* {{{ s_mp_outlen(bits, radix) */ - -/* - Return an estimate for how long a string is needed to hold a radix - r representation of a number with 'bits' significant bits. - - Does not include space for a sign or a NUL terminator. - */ -int s_mp_outlen(int bits, int r) -{ - return (int)((double)bits * LOG_V_2(r)); - -} /* end s_mp_outlen() */ - -/* }}} */ - -/* }}} */ - -/*------------------------------------------------------------------------*/ -/* HERE THERE BE DRAGONS */ -/* crc==4242132123, version==2, Sat Feb 02 06:43:52 2002 */ - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/mtest/mpi.h b/libtommath/mtest/mpi.h deleted file mode 100644 index 5accb52..0000000 --- a/libtommath/mtest/mpi.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - mpi.h - - by Michael J. Fromberger - Copyright (C) 1998 Michael J. Fromberger, All Rights Reserved - - Arbitrary precision integer arithmetic library - - $Id$ - */ - -#ifndef _H_MPI_ -#define _H_MPI_ - -#include "mpi-config.h" - -#define MP_LT -1 -#define MP_EQ 0 -#define MP_GT 1 - -#if MP_DEBUG -#undef MP_IOFUNC -#define MP_IOFUNC 1 -#endif - -#if MP_IOFUNC -#include -#include -#endif - -#include - -#define MP_NEG 1 -#define MP_ZPOS 0 - -/* Included for compatibility... */ -#define NEG MP_NEG -#define ZPOS MP_ZPOS - -#define MP_OKAY 0 /* no error, all is well */ -#define MP_YES 0 /* yes (boolean result) */ -#define MP_NO -1 /* no (boolean result) */ -#define MP_MEM -2 /* out of memory */ -#define MP_RANGE -3 /* argument out of range */ -#define MP_BADARG -4 /* invalid parameter */ -#define MP_UNDEF -5 /* answer is undefined */ -#define MP_LAST_CODE MP_UNDEF - -#include "mpi-types.h" - -/* Included for compatibility... */ -#define DIGIT_BIT MP_DIGIT_BIT -#define DIGIT_MAX MP_DIGIT_MAX - -/* Macros for accessing the mp_int internals */ -#define SIGN(MP) ((MP)->sign) -#define USED(MP) ((MP)->used) -#define ALLOC(MP) ((MP)->alloc) -#define DIGITS(MP) ((MP)->dp) -#define DIGIT(MP,N) (MP)->dp[(N)] - -#if MP_ARGCHK == 1 -#define ARGCHK(X,Y) {if(!(X)){return (Y);}} -#elif MP_ARGCHK == 2 -#include -#define ARGCHK(X,Y) assert(X) -#else -#define ARGCHK(X,Y) /* */ -#endif - -/* This defines the maximum I/O base (minimum is 2) */ -#define MAX_RADIX 64 - -typedef struct { - mp_sign sign; /* sign of this quantity */ - mp_size alloc; /* how many digits allocated */ - mp_size used; /* how many digits used */ - mp_digit *dp; /* the digits themselves */ -} mp_int; - -/*------------------------------------------------------------------------*/ -/* Default precision */ - -unsigned int mp_get_prec(void); -void mp_set_prec(unsigned int prec); - -/*------------------------------------------------------------------------*/ -/* Memory management */ - -mp_err mp_init(mp_int *mp); -mp_err mp_init_array(mp_int mp[], int count); -mp_err mp_init_size(mp_int *mp, mp_size prec); -mp_err mp_init_copy(mp_int *mp, mp_int *from); -mp_err mp_copy(mp_int *from, mp_int *to); -void mp_exch(mp_int *mp1, mp_int *mp2); -void mp_clear(mp_int *mp); -void mp_clear_array(mp_int mp[], int count); -void mp_zero(mp_int *mp); -void mp_set(mp_int *mp, mp_digit d); -mp_err mp_set_int(mp_int *mp, long z); -mp_err mp_shrink(mp_int *a); - - -/*------------------------------------------------------------------------*/ -/* Single digit arithmetic */ - -mp_err mp_add_d(mp_int *a, mp_digit d, mp_int *b); -mp_err mp_sub_d(mp_int *a, mp_digit d, mp_int *b); -mp_err mp_mul_d(mp_int *a, mp_digit d, mp_int *b); -mp_err mp_mul_2(mp_int *a, mp_int *c); -mp_err mp_div_d(mp_int *a, mp_digit d, mp_int *q, mp_digit *r); -mp_err mp_div_2(mp_int *a, mp_int *c); -mp_err mp_expt_d(mp_int *a, mp_digit d, mp_int *c); - -/*------------------------------------------------------------------------*/ -/* Sign manipulations */ - -mp_err mp_abs(mp_int *a, mp_int *b); -mp_err mp_neg(mp_int *a, mp_int *b); - -/*------------------------------------------------------------------------*/ -/* Full arithmetic */ - -mp_err mp_add(mp_int *a, mp_int *b, mp_int *c); -mp_err mp_sub(mp_int *a, mp_int *b, mp_int *c); -mp_err mp_mul(mp_int *a, mp_int *b, mp_int *c); -mp_err mp_mul_2d(mp_int *a, mp_digit d, mp_int *c); -#if MP_SQUARE -mp_err mp_sqr(mp_int *a, mp_int *b); -#else -#define mp_sqr(a, b) mp_mul(a, a, b) -#endif -mp_err mp_div(mp_int *a, mp_int *b, mp_int *q, mp_int *r); -mp_err mp_div_2d(mp_int *a, mp_digit d, mp_int *q, mp_int *r); -mp_err mp_expt(mp_int *a, mp_int *b, mp_int *c); -mp_err mp_2expt(mp_int *a, mp_digit k); -mp_err mp_sqrt(mp_int *a, mp_int *b); - -/*------------------------------------------------------------------------*/ -/* Modular arithmetic */ - -#if MP_MODARITH -mp_err mp_mod(mp_int *a, mp_int *m, mp_int *c); -mp_err mp_mod_d(mp_int *a, mp_digit d, mp_digit *c); -mp_err mp_addmod(mp_int *a, mp_int *b, mp_int *m, mp_int *c); -mp_err mp_submod(mp_int *a, mp_int *b, mp_int *m, mp_int *c); -mp_err mp_mulmod(mp_int *a, mp_int *b, mp_int *m, mp_int *c); -#if MP_SQUARE -mp_err mp_sqrmod(mp_int *a, mp_int *m, mp_int *c); -#else -#define mp_sqrmod(a, m, c) mp_mulmod(a, a, m, c) -#endif -mp_err mp_exptmod(mp_int *a, mp_int *b, mp_int *m, mp_int *c); -mp_err mp_exptmod_d(mp_int *a, mp_digit d, mp_int *m, mp_int *c); -#endif /* MP_MODARITH */ - -/*------------------------------------------------------------------------*/ -/* Comparisons */ - -int mp_cmp_z(mp_int *a); -int mp_cmp_d(mp_int *a, mp_digit d); -int mp_cmp(mp_int *a, mp_int *b); -int mp_cmp_mag(mp_int *a, mp_int *b); -int mp_cmp_int(mp_int *a, long z); -int mp_isodd(mp_int *a); -int mp_iseven(mp_int *a); - -/*------------------------------------------------------------------------*/ -/* Number theoretic */ - -#if MP_NUMTH -mp_err mp_gcd(mp_int *a, mp_int *b, mp_int *c); -mp_err mp_lcm(mp_int *a, mp_int *b, mp_int *c); -mp_err mp_xgcd(mp_int *a, mp_int *b, mp_int *g, mp_int *x, mp_int *y); -mp_err mp_invmod(mp_int *a, mp_int *m, mp_int *c); -#endif /* end MP_NUMTH */ - -/*------------------------------------------------------------------------*/ -/* Input and output */ - -#if MP_IOFUNC -void mp_print(mp_int *mp, FILE *ofp); -#endif /* end MP_IOFUNC */ - -/*------------------------------------------------------------------------*/ -/* Base conversion */ - -#define BITS 1 -#define BYTES CHAR_BIT - -mp_err mp_read_signed_bin(mp_int *mp, unsigned char *str, int len); -int mp_signed_bin_size(mp_int *mp); -mp_err mp_to_signed_bin(mp_int *mp, unsigned char *str); - -mp_err mp_read_unsigned_bin(mp_int *mp, unsigned char *str, int len); -int mp_unsigned_bin_size(mp_int *mp); -mp_err mp_to_unsigned_bin(mp_int *mp, unsigned char *str); - -int mp_count_bits(mp_int *mp); - -#if MP_COMPAT_MACROS -#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)) -#endif - -mp_err mp_read_radix(mp_int *mp, unsigned char *str, int radix); -int mp_radix_size(mp_int *mp, int radix); -int mp_value_radix_size(int num, int qty, int radix); -mp_err mp_toradix(mp_int *mp, char *str, int radix); - -int mp_char2value(char ch, int r); - -#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) - -/*------------------------------------------------------------------------*/ -/* Error strings */ - -const char *mp_strerror(mp_err ec); - -#endif /* end _H_MPI_ */ - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/mtest/mtest.c b/libtommath/mtest/mtest.c deleted file mode 100644 index 56b5a90..0000000 --- a/libtommath/mtest/mtest.c +++ /dev/null @@ -1,374 +0,0 @@ -/* makes a bignum test harness with NUM tests per operation - * - * the output is made in the following format [one parameter per line] - -operation -operand1 -operand2 -[... operandN] -result1 -result2 -[... resultN] - -So for example "a * b mod n" would be - -mulmod -a -b -n -a*b mod n - -e.g. if a=3, b=4 n=11 then - -mulmod -3 -4 -11 -1 - - */ - -#ifdef MP_8BIT -#define THE_MASK 127 -#else -#define THE_MASK 32767 -#endif - -#include -#include -#include -#include "mpi.c" - -#ifdef LTM_MTEST_REAL_RAND -#define getRandChar() fgetc(rng) -FILE *rng; -#else -#define getRandChar() (rand()&0xFF) -#endif - -void rand_num(mp_int *a) -{ - int size; - unsigned char buf[2048]; - size_t sz; - - size = 1 + ((getRandChar()<<8) + getRandChar()) % 101; - buf[0] = (getRandChar()&1)?1:0; -#ifdef LTM_MTEST_REAL_RAND - sz = fread(buf+1, 1, size, rng); -#else - sz = 1; - while (sz < (unsigned)size) { - buf[sz] = getRandChar(); - ++sz; - } -#endif - if (sz != (unsigned)size) { - fprintf(stderr, "\nWarning: fread failed\n\n"); - } - while (buf[1] == 0) buf[1] = getRandChar(); - mp_read_raw(a, buf, 1+size); -} - -void rand_num2(mp_int *a) -{ - int size; - unsigned char buf[2048]; - size_t sz; - - size = 10 + ((getRandChar()<<8) + getRandChar()) % 101; - buf[0] = (getRandChar()&1)?1:0; -#ifdef LTM_MTEST_REAL_RAND - sz = fread(buf+1, 1, size, rng); -#else - sz = 1; - while (sz < (unsigned)size) { - buf[sz] = getRandChar(); - ++sz; - } -#endif - if (sz != (unsigned)size) { - fprintf(stderr, "\nWarning: fread failed\n\n"); - } - while (buf[1] == 0) buf[1] = getRandChar(); - mp_read_raw(a, buf, 1+size); -} - -#define mp_to64(a, b) mp_toradix(a, b, 64) - -int main(int argc, char *argv[]) -{ - int n, tmp; - long long max; - mp_int a, b, c, d, e; -#ifdef MTEST_NO_FULLSPEED - clock_t t1; -#endif - char buf[4096]; - - mp_init(&a); - mp_init(&b); - mp_init(&c); - mp_init(&d); - mp_init(&e); - - if (argc > 1) { - max = strtol(argv[1], NULL, 0); - if (max < 0) { - if (max > -64) { - max = (1 << -(max)) + 1; - } else { - max = 1; - } - } else if (max == 0) { - max = 1; - } - } - else { - max = 0; - } - - - /* initial (2^n - 1)^2 testing, makes sure the comba multiplier works [it has the new carry code] */ -/* - mp_set(&a, 1); - for (n = 1; n < 8192; n++) { - mp_mul(&a, &a, &c); - printf("mul\n"); - mp_to64(&a, buf); - printf("%s\n%s\n", buf, buf); - mp_to64(&c, buf); - printf("%s\n", buf); - - mp_add_d(&a, 1, &a); - mp_mul_2(&a, &a); - mp_sub_d(&a, 1, &a); - } -*/ - -#ifdef LTM_MTEST_REAL_RAND - rng = fopen("/dev/urandom", "rb"); - if (rng == NULL) { - rng = fopen("/dev/random", "rb"); - if (rng == NULL) { - fprintf(stderr, "\nWarning: stdin used as random source\n\n"); - rng = stdin; - } - } -#else - srand(23); -#endif - -#ifdef MTEST_NO_FULLSPEED - t1 = clock(); -#endif - for (;;) { -#ifdef MTEST_NO_FULLSPEED - if (clock() - t1 > CLOCKS_PER_SEC) { - sleep(2); - t1 = clock(); - } -#endif - n = getRandChar() % 15; - - if (max != 0) { - --max; - if (max == 0) - n = 255; - } - - if (n == 0) { - /* add tests */ - rand_num(&a); - rand_num(&b); - mp_add(&a, &b, &c); - printf("add\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - } else if (n == 1) { - /* sub tests */ - rand_num(&a); - rand_num(&b); - mp_sub(&a, &b, &c); - printf("sub\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - } else if (n == 2) { - /* mul tests */ - rand_num(&a); - rand_num(&b); - mp_mul(&a, &b, &c); - printf("mul\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - } else if (n == 3) { - /* div tests */ - rand_num(&a); - rand_num(&b); - mp_div(&a, &b, &c, &d); - printf("div\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - mp_to64(&d, buf); - printf("%s\n", buf); - } else if (n == 4) { - /* sqr tests */ - rand_num(&a); - mp_sqr(&a, &b); - printf("sqr\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 5) { - /* mul_2d test */ - rand_num(&a); - mp_copy(&a, &b); - n = getRandChar() & 63; - mp_mul_2d(&b, n, &b); - mp_to64(&a, buf); - printf("mul2d\n"); - printf("%s\n", buf); - printf("%d\n", n); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 6) { - /* div_2d test */ - rand_num(&a); - mp_copy(&a, &b); - n = getRandChar() & 63; - mp_div_2d(&b, n, &b, NULL); - mp_to64(&a, buf); - printf("div2d\n"); - printf("%s\n", buf); - printf("%d\n", n); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 7) { - /* gcd test */ - rand_num(&a); - rand_num(&b); - a.sign = MP_ZPOS; - b.sign = MP_ZPOS; - mp_gcd(&a, &b, &c); - printf("gcd\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - } else if (n == 8) { - /* lcm test */ - rand_num(&a); - rand_num(&b); - a.sign = MP_ZPOS; - b.sign = MP_ZPOS; - mp_lcm(&a, &b, &c); - printf("lcm\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - } else if (n == 9) { - /* exptmod test */ - rand_num2(&a); - rand_num2(&b); - rand_num2(&c); -// if (c.dp[0]&1) mp_add_d(&c, 1, &c); - a.sign = b.sign = c.sign = 0; - mp_exptmod(&a, &b, &c, &d); - printf("expt\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - mp_to64(&d, buf); - printf("%s\n", buf); - } else if (n == 10) { - /* invmod test */ - rand_num2(&a); - rand_num2(&b); - b.sign = MP_ZPOS; - a.sign = MP_ZPOS; - mp_gcd(&a, &b, &c); - if (mp_cmp_d(&c, 1) != 0) continue; - if (mp_cmp_d(&b, 1) == 0) continue; - mp_invmod(&a, &b, &c); - printf("invmod\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - mp_to64(&c, buf); - printf("%s\n", buf); - } else if (n == 11) { - rand_num(&a); - mp_mul_2(&a, &a); - mp_div_2(&a, &b); - printf("div2\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 12) { - rand_num2(&a); - mp_mul_2(&a, &b); - printf("mul2\n"); - mp_to64(&a, buf); - printf("%s\n", buf); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 13) { - rand_num2(&a); - tmp = abs(rand()) & THE_MASK; - mp_add_d(&a, tmp, &b); - printf("add_d\n"); - mp_to64(&a, buf); - printf("%s\n%d\n", buf, tmp); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 14) { - rand_num2(&a); - tmp = abs(rand()) & THE_MASK; - mp_sub_d(&a, tmp, &b); - printf("sub_d\n"); - mp_to64(&a, buf); - printf("%s\n%d\n", buf, tmp); - mp_to64(&b, buf); - printf("%s\n", buf); - } else if (n == 255) { - printf("exit\n"); - break; - } - - } -#ifdef LTM_MTEST_REAL_RAND - fclose(rng); -#endif - return 0; -} - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ diff --git a/libtommath/parsenames.pl b/libtommath/parsenames.pl deleted file mode 100755 index cc57673..0000000 --- a/libtommath/parsenames.pl +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/perl -# -# Splits the list of files and outputs for makefile type files -# wrapped at 80 chars -# -# Tom St Denis -@a = split(" ", $ARGV[1]); -$b = "$ARGV[0]="; -$len = length($b); -print $b; -foreach my $obj (@a) { - $len = $len + length($obj); - $obj =~ s/\*/\$/; - if ($len > 100) { - printf "\\\n"; - $len = length($obj); - } - print "$obj "; -} - -print "\n\n"; - -# $Source$ -# $Revision$ -# $Date$ diff --git a/libtommath/pics/design_process.sxd b/libtommath/pics/design_process.sxd deleted file mode 100644 index 7414dbb..0000000 Binary files a/libtommath/pics/design_process.sxd and /dev/null differ diff --git a/libtommath/pics/design_process.tif b/libtommath/pics/design_process.tif deleted file mode 100644 index 4a0c012..0000000 Binary files a/libtommath/pics/design_process.tif and /dev/null differ diff --git a/libtommath/pics/expt_state.sxd b/libtommath/pics/expt_state.sxd deleted file mode 100644 index 6518404..0000000 Binary files a/libtommath/pics/expt_state.sxd and /dev/null differ diff --git a/libtommath/pics/expt_state.tif b/libtommath/pics/expt_state.tif deleted file mode 100644 index cb06e8e..0000000 Binary files a/libtommath/pics/expt_state.tif and /dev/null differ diff --git a/libtommath/pics/makefile b/libtommath/pics/makefile deleted file mode 100644 index 3ecb02f..0000000 --- a/libtommath/pics/makefile +++ /dev/null @@ -1,35 +0,0 @@ -# makes the images... yeah - -default: pses - -design_process.ps: design_process.tif - tiff2ps -s -e design_process.tif > design_process.ps - -sliding_window.ps: sliding_window.tif - tiff2ps -s -e sliding_window.tif > sliding_window.ps - -expt_state.ps: expt_state.tif - tiff2ps -s -e expt_state.tif > expt_state.ps - -primality.ps: primality.tif - tiff2ps -s -e primality.tif > primality.ps - -design_process.pdf: design_process.ps - epstopdf design_process.ps - -sliding_window.pdf: sliding_window.ps - epstopdf sliding_window.ps - -expt_state.pdf: expt_state.ps - epstopdf expt_state.ps - -primality.pdf: primality.ps - epstopdf primality.ps - - -pses: sliding_window.ps expt_state.ps primality.ps design_process.ps -pdfes: sliding_window.pdf expt_state.pdf primality.pdf design_process.pdf - -clean: - rm -rf *.ps *.pdf .xvpics - \ No newline at end of file diff --git a/libtommath/pics/primality.tif b/libtommath/pics/primality.tif deleted file mode 100644 index 76d6be3..0000000 Binary files a/libtommath/pics/primality.tif and /dev/null differ diff --git a/libtommath/pics/radix.sxd b/libtommath/pics/radix.sxd deleted file mode 100644 index b9eb9a0..0000000 Binary files a/libtommath/pics/radix.sxd and /dev/null differ diff --git a/libtommath/pics/sliding_window.sxd b/libtommath/pics/sliding_window.sxd deleted file mode 100644 index 91e7c0d..0000000 Binary files a/libtommath/pics/sliding_window.sxd and /dev/null differ diff --git a/libtommath/pics/sliding_window.tif b/libtommath/pics/sliding_window.tif deleted file mode 100644 index bb4cb96..0000000 Binary files a/libtommath/pics/sliding_window.tif and /dev/null differ diff --git a/libtommath/poster.out b/libtommath/poster.out deleted file mode 100644 index e69de29..0000000 diff --git a/libtommath/poster.pdf b/libtommath/poster.pdf deleted file mode 100644 index f212c3e..0000000 Binary files a/libtommath/poster.pdf and /dev/null differ diff --git a/libtommath/poster.tex b/libtommath/poster.tex deleted file mode 100644 index e7388f4..0000000 --- a/libtommath/poster.tex +++ /dev/null @@ -1,35 +0,0 @@ -\documentclass[landscape,11pt]{article} -\usepackage{amsmath, amssymb} -\usepackage{hyperref} -\begin{document} -\hspace*{-3in} -\begin{tabular}{llllll} -$c = a + b$ & {\tt mp\_add(\&a, \&b, \&c)} & $b = 2a$ & {\tt mp\_mul\_2(\&a, \&b)} & \\ -$c = a - b$ & {\tt mp\_sub(\&a, \&b, \&c)} & $b = a/2$ & {\tt mp\_div\_2(\&a, \&b)} & \\ -$c = ab $ & {\tt mp\_mul(\&a, \&b, \&c)} & $c = 2^ba$ & {\tt mp\_mul\_2d(\&a, b, \&c)} \\ -$b = a^2 $ & {\tt mp\_sqr(\&a, \&b)} & $c = a/2^b, d = a \mod 2^b$ & {\tt mp\_div\_2d(\&a, b, \&c, \&d)} \\ -$c = \lfloor a/b \rfloor, d = a \mod b$ & {\tt mp\_div(\&a, \&b, \&c, \&d)} & $c = a \mod 2^b $ & {\tt mp\_mod\_2d(\&a, b, \&c)} \\ - && \\ -$a = b $ & {\tt mp\_set\_int(\&a, b)} & $c = a \vee b$ & {\tt mp\_or(\&a, \&b, \&c)} \\ -$b = a $ & {\tt mp\_copy(\&a, \&b)} & $c = a \wedge b$ & {\tt mp\_and(\&a, \&b, \&c)} \\ - && $c = a \oplus b$ & {\tt mp\_xor(\&a, \&b, \&c)} \\ - & \\ -$b = -a $ & {\tt mp\_neg(\&a, \&b)} & $d = a + b \mod c$ & {\tt mp\_addmod(\&a, \&b, \&c, \&d)} \\ -$b = |a| $ & {\tt mp\_abs(\&a, \&b)} & $d = a - b \mod c$ & {\tt mp\_submod(\&a, \&b, \&c, \&d)} \\ - && $d = ab \mod c$ & {\tt mp\_mulmod(\&a, \&b, \&c, \&d)} \\ -Compare $a$ and $b$ & {\tt mp\_cmp(\&a, \&b)} & $c = a^2 \mod b$ & {\tt mp\_sqrmod(\&a, \&b, \&c)} \\ -Is Zero? & {\tt mp\_iszero(\&a)} & $c = a^{-1} \mod b$ & {\tt mp\_invmod(\&a, \&b, \&c)} \\ -Is Even? & {\tt mp\_iseven(\&a)} & $d = a^b \mod c$ & {\tt mp\_exptmod(\&a, \&b, \&c, \&d)} \\ -Is Odd ? & {\tt mp\_isodd(\&a)} \\ -&\\ -$\vert \vert a \vert \vert$ & {\tt mp\_unsigned\_bin\_size(\&a)} & $res$ = 1 if $a$ prime to $t$ rounds? & {\tt mp\_prime\_is\_prime(\&a, t, \&res)} \\ -$buf \leftarrow a$ & {\tt mp\_to\_unsigned\_bin(\&a, buf)} & Next prime after $a$ to $t$ rounds. & {\tt mp\_prime\_next\_prime(\&a, t, bbs\_style)} \\ -$a \leftarrow buf[0..len-1]$ & {\tt mp\_read\_unsigned\_bin(\&a, buf, len)} \\ -&\\ -$b = \sqrt{a}$ & {\tt mp\_sqrt(\&a, \&b)} & $c = \mbox{gcd}(a, b)$ & {\tt mp\_gcd(\&a, \&b, \&c)} \\ -$c = a^{1/b}$ & {\tt mp\_n\_root(\&a, b, \&c)} & $c = \mbox{lcm}(a, b)$ & {\tt mp\_lcm(\&a, \&b, \&c)} \\ -&\\ -Greater Than & MP\_GT & Equal To & MP\_EQ \\ -Less Than & MP\_LT & Bits per digit & DIGIT\_BIT \\ -\end{tabular} -\end{document} diff --git a/libtommath/pre_gen/mpi.c b/libtommath/pre_gen/mpi.c deleted file mode 100644 index 0d55d73..0000000 --- a/libtommath/pre_gen/mpi.c +++ /dev/null @@ -1,9524 +0,0 @@ -/* Start: bn_error.c */ -#include -#ifdef BN_ERROR_C -/* 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@gmail.com, http://libtom.org - */ - -static const struct { - int code; - char *msg; -} msgs[] = { - { MP_OKAY, "Successful" }, - { MP_MEM, "Out of heap" }, - { MP_VAL, "Value out of range" } -}; - -/* return a char * string for a given code */ -char *mp_error_to_string(int code) -{ - int x; - - /* scan the lookup table for the given message */ - for (x = 0; x < (int)(sizeof(msgs) / sizeof(msgs[0])); x++) { - if (msgs[x].code == code) { - return msgs[x].msg; - } - } - - /* generic reply for invalid code */ - return "Invalid error code"; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_error.c */ - -/* Start: bn_fast_mp_invmod.c */ -#include -#ifdef BN_FAST_MP_INVMOD_C -/* 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@gmail.com, http://libtom.org - */ - -/* computes the modular inverse via binary extended euclidean algorithm, - * that is c = 1/a mod b - * - * Based on slow invmod except this is optimized for the case where b is - * odd as per HAC Note 14.64 on pp. 610 - */ -int fast_mp_invmod (mp_int * a, mp_int * b, mp_int * c) -{ - mp_int x, y, u, v, B, D; - int res, neg; - - /* 2. [modified] b must be odd */ - if (mp_iseven (b) == 1) { - return MP_VAL; - } - - /* init all our temps */ - if ((res = mp_init_multi(&x, &y, &u, &v, &B, &D, NULL)) != MP_OKAY) { - return res; - } - - /* x == modulus, y == value to invert */ - if ((res = mp_copy (b, &x)) != MP_OKAY) { - goto LBL_ERR; - } - - /* we need y = |a| */ - if ((res = mp_mod (a, b, &y)) != MP_OKAY) { - goto LBL_ERR; - } - - /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */ - if ((res = mp_copy (&x, &u)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_copy (&y, &v)) != MP_OKAY) { - goto LBL_ERR; - } - mp_set (&D, 1); - -top: - /* 4. while u is even do */ - while (mp_iseven (&u) == 1) { - /* 4.1 u = u/2 */ - if ((res = mp_div_2 (&u, &u)) != MP_OKAY) { - goto LBL_ERR; - } - /* 4.2 if B is odd then */ - if (mp_isodd (&B) == 1) { - if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } - /* B = B/2 */ - if ((res = mp_div_2 (&B, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* 5. while v is even do */ - while (mp_iseven (&v) == 1) { - /* 5.1 v = v/2 */ - if ((res = mp_div_2 (&v, &v)) != MP_OKAY) { - goto LBL_ERR; - } - /* 5.2 if D is odd then */ - if (mp_isodd (&D) == 1) { - /* D = (D-x)/2 */ - if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - /* D = D/2 */ - if ((res = mp_div_2 (&D, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* 6. if u >= v then */ - if (mp_cmp (&u, &v) != MP_LT) { - /* u = u - v, B = B - D */ - if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) { - goto LBL_ERR; - } - - if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } else { - /* v - v - u, D = D - B */ - if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) { - goto LBL_ERR; - } - - if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* if not zero goto step 4 */ - if (mp_iszero (&u) == 0) { - goto top; - } - - /* now a = C, b = D, gcd == g*v */ - - /* if v != 1 then there is no inverse */ - if (mp_cmp_d (&v, 1) != MP_EQ) { - res = MP_VAL; - goto LBL_ERR; - } - - /* b is now the inverse */ - neg = a->sign; - while (D.sign == MP_NEG) { - if ((res = mp_add (&D, b, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - mp_exch (&D, c); - c->sign = neg; - res = MP_OKAY; - -LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_fast_mp_invmod.c */ - -/* Start: bn_fast_mp_montgomery_reduce.c */ -#include -#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C -/* 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@gmail.com, http://libtom.org - */ - -/* computes xR**-1 == x (mod N) via Montgomery Reduction - * - * This is an optimized implementation of montgomery_reduce - * which uses the comba method to quickly calculate the columns of the - * reduction. - * - * Based on Algorithm 14.32 on pp.601 of HAC. -*/ -int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) -{ - int ix, res, olduse; - mp_word W[MP_WARRAY]; - - /* get old used count */ - olduse = x->used; - - /* grow a as required */ - if (x->alloc < n->used + 1) { - if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) { - return res; - } - } - - /* first we have to get the digits of the input into - * an array of double precision words W[...] - */ - { - register mp_word *_W; - register mp_digit *tmpx; - - /* alias for the W[] array */ - _W = W; - - /* alias for the digits of x*/ - tmpx = x->dp; - - /* copy the digits of a into W[0..a->used-1] */ - for (ix = 0; ix < x->used; ix++) { - *_W++ = *tmpx++; - } - - /* zero the high words of W[a->used..m->used*2] */ - for (; ix < n->used * 2 + 1; ix++) { - *_W++ = 0; - } - } - - /* now we proceed to zero successive digits - * from the least significant upwards - */ - for (ix = 0; ix < n->used; ix++) { - /* mu = ai * m' mod b - * - * We avoid a double precision multiplication (which isn't required) - * by casting the value down to a mp_digit. Note this requires - * that W[ix-1] have the carry cleared (see after the inner loop) - */ - register mp_digit mu; - mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK); - - /* a = a + mu * m * b**i - * - * This is computed in place and on the fly. The multiplication - * by b**i is handled by offseting which columns the results - * are added to. - * - * Note the comba method normally doesn't handle carries in the - * inner loop In this case we fix the carry from the previous - * column since the Montgomery reduction requires digits of the - * result (so far) [see above] to work. This is - * handled by fixing up one carry after the inner loop. The - * carry fixups are done in order so after these loops the - * first m->used words of W[] have the carries fixed - */ - { - register int iy; - register mp_digit *tmpn; - register mp_word *_W; - - /* alias for the digits of the modulus */ - tmpn = n->dp; - - /* Alias for the columns set by an offset of ix */ - _W = W + ix; - - /* inner loop */ - for (iy = 0; iy < n->used; iy++) { - *_W++ += ((mp_word)mu) * ((mp_word)*tmpn++); - } - } - - /* now fix carry for next digit, W[ix+1] */ - W[ix + 1] += W[ix] >> ((mp_word) DIGIT_BIT); - } - - /* now we have to propagate the carries and - * shift the words downward [all those least - * significant digits we zeroed]. - */ - { - register mp_digit *tmpx; - register mp_word *_W, *_W1; - - /* nox fix rest of carries */ - - /* alias for current word */ - _W1 = W + ix; - - /* alias for next word, where the carry goes */ - _W = W + ++ix; - - for (; ix <= n->used * 2 + 1; ix++) { - *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT); - } - - /* copy out, A = A/b**n - * - * The result is A/b**n but instead of converting from an - * array of mp_word to mp_digit than calling mp_rshd - * we just copy them in the right order - */ - - /* alias for destination word */ - tmpx = x->dp; - - /* alias for shifted double precision result */ - _W = W + n->used; - - for (ix = 0; ix < n->used + 1; ix++) { - *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK)); - } - - /* zero oldused digits, if the input a was larger than - * m->used+1 we'll have to clear the digits - */ - for (; ix < olduse; ix++) { - *tmpx++ = 0; - } - } - - /* set the max used and clamp */ - x->used = n->used + 1; - mp_clamp (x); - - /* if A >= m then A = A - m */ - if (mp_cmp_mag (x, n) != MP_LT) { - return s_mp_sub (x, n, x); - } - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_fast_mp_montgomery_reduce.c */ - -/* Start: bn_fast_s_mp_mul_digs.c */ -#include -#ifdef BN_FAST_S_MP_MUL_DIGS_C -/* 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@gmail.com, http://libtom.org - */ - -/* Fast (comba) multiplier - * - * This is the fast column-array [comba] multiplier. It is - * designed to compute the columns of the product first - * then handle the carries afterwards. This has the effect - * of making the nested loops that compute the columns very - * simple and schedulable on super-scalar processors. - * - * This has been modified to produce a variable number of - * digits of output so if say only a half-product is required - * you don't have to compute the upper half (a feature - * required for fast Barrett reduction). - * - * Based on Algorithm 14.12 on pp.595 of HAC. - * - */ -int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) -{ - int olduse, res, pa, ix, iz; - mp_digit W[MP_WARRAY]; - register mp_word _W; - - /* grow the destination as required */ - if (c->alloc < digs) { - if ((res = mp_grow (c, digs)) != MP_OKAY) { - return res; - } - } - - /* number of output digits to produce */ - pa = MIN(digs, a->used + b->used); - - /* clear the carry */ - _W = 0; - for (ix = 0; ix < pa; ix++) { - int tx, ty; - int iy; - mp_digit *tmpx, *tmpy; - - /* get offsets into the two bignums */ - ty = MIN(b->used-1, ix); - tx = ix - ty; - - /* setup temp aliases */ - tmpx = a->dp + tx; - tmpy = b->dp + ty; - - /* this is the number of times the loop will iterrate, essentially - while (tx++ < a->used && ty-- >= 0) { ... } - */ - iy = MIN(a->used-tx, ty+1); - - /* execute loop */ - for (iz = 0; iz < iy; ++iz) { - _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--); - - } - - /* store term */ - W[ix] = ((mp_digit)_W) & MP_MASK; - - /* make next carry */ - _W = _W >> ((mp_word)DIGIT_BIT); - } - - /* setup dest */ - olduse = c->used; - c->used = pa; - - { - register mp_digit *tmpc; - tmpc = c->dp; - for (ix = 0; ix < pa+1; ix++) { - /* now extract the previous digit [below the carry] */ - *tmpc++ = W[ix]; - } - - /* clear unused digits [that existed in the old copy of c] */ - for (; ix < olduse; ix++) { - *tmpc++ = 0; - } - } - mp_clamp (c); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_fast_s_mp_mul_digs.c */ - -/* Start: bn_fast_s_mp_mul_high_digs.c */ -#include -#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C -/* 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@gmail.com, http://libtom.org - */ - -/* this is a modified version of fast_s_mul_digs that only produces - * output digits *above* digs. See the comments for fast_s_mul_digs - * to see how it works. - * - * This is used in the Barrett reduction since for one of the multiplications - * only the higher digits were needed. This essentially halves the work. - * - * Based on Algorithm 14.12 on pp.595 of HAC. - */ -int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) -{ - int olduse, res, pa, ix, iz; - mp_digit W[MP_WARRAY]; - mp_word _W; - - /* grow the destination as required */ - pa = a->used + b->used; - if (c->alloc < pa) { - if ((res = mp_grow (c, pa)) != MP_OKAY) { - return res; - } - } - - /* number of output digits to produce */ - pa = a->used + b->used; - _W = 0; - for (ix = digs; ix < pa; ix++) { - int tx, ty, iy; - mp_digit *tmpx, *tmpy; - - /* get offsets into the two bignums */ - ty = MIN(b->used-1, ix); - tx = ix - ty; - - /* setup temp aliases */ - tmpx = a->dp + tx; - tmpy = b->dp + ty; - - /* this is the number of times the loop will iterrate, essentially its - while (tx++ < a->used && ty-- >= 0) { ... } - */ - iy = MIN(a->used-tx, ty+1); - - /* execute loop */ - for (iz = 0; iz < iy; iz++) { - _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--); - } - - /* store term */ - W[ix] = ((mp_digit)_W) & MP_MASK; - - /* make next carry */ - _W = _W >> ((mp_word)DIGIT_BIT); - } - - /* setup dest */ - olduse = c->used; - c->used = pa; - - { - register mp_digit *tmpc; - - tmpc = c->dp + digs; - for (ix = digs; ix < pa; ix++) { - /* now extract the previous digit [below the carry] */ - *tmpc++ = W[ix]; - } - - /* clear unused digits [that existed in the old copy of c] */ - for (; ix < olduse; ix++) { - *tmpc++ = 0; - } - } - mp_clamp (c); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_fast_s_mp_mul_high_digs.c */ - -/* Start: bn_fast_s_mp_sqr.c */ -#include -#ifdef BN_FAST_S_MP_SQR_C -/* 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@gmail.com, http://libtom.org - */ - -/* the jist of squaring... - * you do like mult except the offset of the tmpx [one that - * starts closer to zero] can't equal the offset of tmpy. - * So basically you set up iy like before then you min it with - * (ty-tx) so that it never happens. You double all those - * you add in the inner loop - -After that loop you do the squares and add them in. -*/ - -int fast_s_mp_sqr (mp_int * a, mp_int * b) -{ - int olduse, res, pa, ix, iz; - mp_digit W[MP_WARRAY], *tmpx; - mp_word W1; - - /* grow the destination as required */ - pa = a->used + a->used; - if (b->alloc < pa) { - if ((res = mp_grow (b, pa)) != MP_OKAY) { - return res; - } - } - - /* number of output digits to produce */ - W1 = 0; - for (ix = 0; ix < pa; ix++) { - int tx, ty, iy; - mp_word _W; - mp_digit *tmpy; - - /* clear counter */ - _W = 0; - - /* get offsets into the two bignums */ - ty = MIN(a->used-1, ix); - tx = ix - ty; - - /* setup temp aliases */ - tmpx = a->dp + tx; - tmpy = a->dp + ty; - - /* this is the number of times the loop will iterrate, essentially - while (tx++ < a->used && ty-- >= 0) { ... } - */ - iy = MIN(a->used-tx, ty+1); - - /* now for squaring tx can never equal ty - * we halve the distance since they approach at a rate of 2x - * and we have to round because odd cases need to be executed - */ - iy = MIN(iy, (ty-tx+1)>>1); - - /* execute loop */ - for (iz = 0; iz < iy; iz++) { - _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--); - } - - /* double the inner product and add carry */ - _W = _W + _W + W1; - - /* even columns have the square term in them */ - if ((ix&1) == 0) { - _W += ((mp_word)a->dp[ix>>1])*((mp_word)a->dp[ix>>1]); - } - - /* store it */ - W[ix] = (mp_digit)(_W & MP_MASK); - - /* make next carry */ - W1 = _W >> ((mp_word)DIGIT_BIT); - } - - /* setup dest */ - olduse = b->used; - b->used = a->used+a->used; - - { - mp_digit *tmpb; - tmpb = b->dp; - for (ix = 0; ix < pa; ix++) { - *tmpb++ = W[ix] & MP_MASK; - } - - /* clear unused digits [that existed in the old copy of c] */ - for (; ix < olduse; ix++) { - *tmpb++ = 0; - } - } - mp_clamp (b); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_fast_s_mp_sqr.c */ - -/* Start: bn_mp_2expt.c */ -#include -#ifdef BN_MP_2EXPT_C -/* 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@gmail.com, http://libtom.org - */ - -/* computes a = 2**b - * - * Simple algorithm which zeroes the int, grows it then just sets one bit - * as required. - */ -int -mp_2expt (mp_int * a, int b) -{ - int res; - - /* zero a as per default */ - mp_zero (a); - - /* grow a to accomodate the single bit */ - if ((res = mp_grow (a, b / DIGIT_BIT + 1)) != MP_OKAY) { - return res; - } - - /* set the used count of where the bit will go */ - a->used = b / DIGIT_BIT + 1; - - /* put the single bit in its place */ - a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT); - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_2expt.c */ - -/* Start: bn_mp_abs.c */ -#include -#ifdef BN_MP_ABS_C -/* 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@gmail.com, http://libtom.org - */ - -/* b = |a| - * - * Simple function copies the input and fixes the sign to positive - */ -int -mp_abs (mp_int * a, mp_int * b) -{ - int res; - - /* copy a to b */ - if (a != b) { - if ((res = mp_copy (a, b)) != MP_OKAY) { - return res; - } - } - - /* force the sign of b to positive */ - b->sign = MP_ZPOS; - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_abs.c */ - -/* Start: bn_mp_add.c */ -#include -#ifdef BN_MP_ADD_C -/* 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@gmail.com, http://libtom.org - */ - -/* high level addition (handles signs) */ -int mp_add (mp_int * a, mp_int * b, mp_int * c) -{ - int sa, sb, res; - - /* get sign of both inputs */ - sa = a->sign; - sb = b->sign; - - /* handle two cases, not four */ - if (sa == sb) { - /* both positive or both negative */ - /* add their magnitudes, copy the sign */ - c->sign = sa; - res = s_mp_add (a, b, c); - } else { - /* one positive, the other negative */ - /* subtract the one with the greater magnitude from */ - /* the one of the lesser magnitude. The result gets */ - /* the sign of the one with the greater magnitude. */ - if (mp_cmp_mag (a, b) == MP_LT) { - c->sign = sb; - res = s_mp_sub (b, a, c); - } else { - c->sign = sa; - res = s_mp_sub (a, b, c); - } - } - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_add.c */ - -/* Start: bn_mp_add_d.c */ -#include -#ifdef BN_MP_ADD_D_C -/* 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@gmail.com, http://libtom.org - */ - -/* single digit addition */ -int -mp_add_d (mp_int * a, mp_digit b, mp_int * c) -{ - int res, ix, oldused; - mp_digit *tmpa, *tmpc, mu; - - /* grow c as required */ - if (c->alloc < a->used + 1) { - if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { - return res; - } - } - - /* if a is negative and |a| >= b, call c = |a| - b */ - if (a->sign == MP_NEG && (a->used > 1 || a->dp[0] >= b)) { - /* temporarily fix sign of a */ - a->sign = MP_ZPOS; - - /* c = |a| - b */ - res = mp_sub_d(a, b, c); - - /* fix sign */ - a->sign = c->sign = MP_NEG; - - /* clamp */ - mp_clamp(c); - - return res; - } - - /* old number of used digits in c */ - oldused = c->used; - - /* sign always positive */ - c->sign = MP_ZPOS; - - /* source alias */ - tmpa = a->dp; - - /* destination alias */ - tmpc = c->dp; - - /* if a is positive */ - if (a->sign == MP_ZPOS) { - /* add digit, after this we're propagating - * the carry. - */ - *tmpc = *tmpa++ + b; - mu = *tmpc >> DIGIT_BIT; - *tmpc++ &= MP_MASK; - - /* now handle rest of the digits */ - for (ix = 1; ix < a->used; ix++) { - *tmpc = *tmpa++ + mu; - mu = *tmpc >> DIGIT_BIT; - *tmpc++ &= MP_MASK; - } - /* set final carry */ - ix++; - *tmpc++ = mu; - - /* setup size */ - c->used = a->used + 1; - } else { - /* a was negative and |a| < b */ - c->used = 1; - - /* the result is a single digit */ - if (a->used == 1) { - *tmpc++ = b - a->dp[0]; - } else { - *tmpc++ = b; - } - - /* setup count so the clearing of oldused - * can fall through correctly - */ - ix = 1; - } - - /* now zero to oldused */ - while (ix++ < oldused) { - *tmpc++ = 0; - } - mp_clamp(c); - - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_add_d.c */ - -/* Start: bn_mp_addmod.c */ -#include -#ifdef BN_MP_ADDMOD_C -/* 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@gmail.com, http://libtom.org - */ - -/* d = a + b (mod c) */ -int -mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) -{ - int res; - mp_int t; - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - if ((res = mp_add (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, c, d); - mp_clear (&t); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_addmod.c */ - -/* Start: bn_mp_and.c */ -#include -#ifdef BN_MP_AND_C -/* 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@gmail.com, http://libtom.org - */ - -/* AND two ints together */ -int -mp_and (mp_int * a, mp_int * b, mp_int * c) -{ - int res, ix, px; - mp_int t, *x; - - if (a->used > b->used) { - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - px = b->used; - x = b; - } else { - if ((res = mp_init_copy (&t, b)) != MP_OKAY) { - return res; - } - px = a->used; - x = a; - } - - for (ix = 0; ix < px; ix++) { - t.dp[ix] &= x->dp[ix]; - } - - /* zero digits above the last from the smallest mp_int */ - for (; ix < t.used; ix++) { - t.dp[ix] = 0; - } - - mp_clamp (&t); - mp_exch (c, &t); - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_and.c */ - -/* Start: bn_mp_clamp.c */ -#include -#ifdef BN_MP_CLAMP_C -/* 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@gmail.com, http://libtom.org - */ - -/* trim unused digits - * - * This is used to ensure that leading zero digits are - * trimed and the leading "used" digit will be non-zero - * Typically very fast. Also fixes the sign if there - * are no more leading digits - */ -void -mp_clamp (mp_int * a) -{ - /* decrease used while the most significant digit is - * zero. - */ - while (a->used > 0 && a->dp[a->used - 1] == 0) { - --(a->used); - } - - /* reset the sign flag if used == 0 */ - if (a->used == 0) { - a->sign = MP_ZPOS; - } -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_clamp.c */ - -/* Start: bn_mp_clear.c */ -#include -#ifdef BN_MP_CLEAR_C -/* 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@gmail.com, http://libtom.org - */ - -/* clear one (frees) */ -void -mp_clear (mp_int * a) -{ - int i; - - /* only do anything if a hasn't been freed previously */ - if (a->dp != NULL) { - /* first zero the digits */ - for (i = 0; i < a->used; i++) { - a->dp[i] = 0; - } - - /* free ram */ - XFREE(a->dp); - - /* reset members to make debugging easier */ - a->dp = NULL; - a->alloc = a->used = 0; - a->sign = MP_ZPOS; - } -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_clear.c */ - -/* Start: bn_mp_clear_multi.c */ -#include -#ifdef BN_MP_CLEAR_MULTI_C -/* 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@gmail.com, http://libtom.org - */ -#include - -void mp_clear_multi(mp_int *mp, ...) -{ - mp_int* next_mp = mp; - va_list args; - va_start(args, mp); - while (next_mp != NULL) { - mp_clear(next_mp); - next_mp = va_arg(args, mp_int*); - } - va_end(args); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_clear_multi.c */ - -/* Start: bn_mp_cmp.c */ -#include -#ifdef BN_MP_CMP_C -/* 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@gmail.com, http://libtom.org - */ - -/* compare two ints (signed)*/ -int -mp_cmp (mp_int * a, mp_int * b) -{ - /* compare based on sign */ - if (a->sign != b->sign) { - if (a->sign == MP_NEG) { - return MP_LT; - } else { - return MP_GT; - } - } - - /* compare digits */ - if (a->sign == MP_NEG) { - /* if negative compare opposite direction */ - return mp_cmp_mag(b, a); - } else { - return mp_cmp_mag(a, b); - } -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_cmp.c */ - -/* Start: bn_mp_cmp_d.c */ -#include -#ifdef BN_MP_CMP_D_C -/* 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@gmail.com, http://libtom.org - */ - -/* compare a digit */ -int mp_cmp_d(mp_int * a, mp_digit b) -{ - /* compare based on sign */ - if (a->sign == MP_NEG) { - return MP_LT; - } - - /* compare based on magnitude */ - if (a->used > 1) { - return MP_GT; - } - - /* compare the only digit of a to b */ - if (a->dp[0] > b) { - return MP_GT; - } else if (a->dp[0] < b) { - return MP_LT; - } else { - return MP_EQ; - } -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_cmp_d.c */ - -/* Start: bn_mp_cmp_mag.c */ -#include -#ifdef BN_MP_CMP_MAG_C -/* 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@gmail.com, http://libtom.org - */ - -/* compare maginitude of two ints (unsigned) */ -int mp_cmp_mag (mp_int * a, mp_int * b) -{ - int n; - mp_digit *tmpa, *tmpb; - - /* compare based on # of non-zero digits */ - if (a->used > b->used) { - return MP_GT; - } - - if (a->used < b->used) { - return MP_LT; - } - - /* alias for a */ - tmpa = a->dp + (a->used - 1); - - /* alias for b */ - tmpb = b->dp + (a->used - 1); - - /* compare based on digits */ - for (n = 0; n < a->used; ++n, --tmpa, --tmpb) { - if (*tmpa > *tmpb) { - return MP_GT; - } - - if (*tmpa < *tmpb) { - return MP_LT; - } - } - return MP_EQ; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_cmp_mag.c */ - -/* Start: bn_mp_cnt_lsb.c */ -#include -#ifdef BN_MP_CNT_LSB_C -/* 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@gmail.com, http://libtom.org - */ - -static const int lnz[16] = { - 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 -}; - -/* Counts the number of lsbs which are zero before the first zero bit */ -int mp_cnt_lsb(mp_int *a) -{ - int x; - mp_digit q, qq; - - /* easy out */ - if (mp_iszero(a) == 1) { - return 0; - } - - /* scan lower digits until non-zero */ - for (x = 0; x < a->used && a->dp[x] == 0; x++); - q = a->dp[x]; - x *= DIGIT_BIT; - - /* now scan this digit until a 1 is found */ - if ((q & 1) == 0) { - do { - qq = q & 15; - x += lnz[qq]; - q >>= 4; - } while (qq == 0); - } - return x; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_cnt_lsb.c */ - -/* Start: bn_mp_copy.c */ -#include -#ifdef BN_MP_COPY_C -/* 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@gmail.com, http://libtom.org - */ - -/* copy, b = a */ -int -mp_copy (mp_int * a, mp_int * b) -{ - int res, n; - - /* if dst == src do nothing */ - if (a == b) { - return MP_OKAY; - } - - /* grow dest */ - if (b->alloc < a->used) { - if ((res = mp_grow (b, a->used)) != MP_OKAY) { - return res; - } - } - - /* zero b and copy the parameters over */ - { - register mp_digit *tmpa, *tmpb; - - /* pointer aliases */ - - /* source */ - tmpa = a->dp; - - /* destination */ - tmpb = b->dp; - - /* copy all the digits */ - for (n = 0; n < a->used; n++) { - *tmpb++ = *tmpa++; - } - - /* clear high digits */ - for (; n < b->used; n++) { - *tmpb++ = 0; - } - } - - /* copy used count and sign */ - b->used = a->used; - b->sign = a->sign; - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_copy.c */ - -/* Start: bn_mp_count_bits.c */ -#include -#ifdef BN_MP_COUNT_BITS_C -/* 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@gmail.com, http://libtom.org - */ - -/* returns the number of bits in an int */ -int -mp_count_bits (mp_int * a) -{ - int r; - mp_digit q; - - /* shortcut */ - if (a->used == 0) { - return 0; - } - - /* get number of digits and add that */ - r = (a->used - 1) * DIGIT_BIT; - - /* take the last digit and count the bits in it */ - q = a->dp[a->used - 1]; - while (q > ((mp_digit) 0)) { - ++r; - q >>= ((mp_digit) 1); - } - return r; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_count_bits.c */ - -/* Start: bn_mp_div.c */ -#include -#ifdef BN_MP_DIV_C -/* 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@gmail.com, http://libtom.org - */ - -#ifdef BN_MP_DIV_SMALL - -/* slower bit-bang division... also smaller */ -int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d) -{ - mp_int ta, tb, tq, q; - int res, n, n2; - - /* is divisor zero ? */ - if (mp_iszero (b) == 1) { - return MP_VAL; - } - - /* if a < b then q=0, r = a */ - if (mp_cmp_mag (a, b) == MP_LT) { - if (d != NULL) { - res = mp_copy (a, d); - } else { - res = MP_OKAY; - } - if (c != NULL) { - mp_zero (c); - } - return res; - } - - /* init our temps */ - if ((res = mp_init_multi(&ta, &tb, &tq, &q, NULL) != MP_OKAY)) { - return res; - } - - - mp_set(&tq, 1); - n = mp_count_bits(a) - mp_count_bits(b); - if (((res = mp_abs(a, &ta)) != MP_OKAY) || - ((res = mp_abs(b, &tb)) != MP_OKAY) || - ((res = mp_mul_2d(&tb, n, &tb)) != MP_OKAY) || - ((res = mp_mul_2d(&tq, n, &tq)) != MP_OKAY)) { - goto LBL_ERR; - } - - while (n-- >= 0) { - if (mp_cmp(&tb, &ta) != MP_GT) { - if (((res = mp_sub(&ta, &tb, &ta)) != MP_OKAY) || - ((res = mp_add(&q, &tq, &q)) != MP_OKAY)) { - goto LBL_ERR; - } - } - if (((res = mp_div_2d(&tb, 1, &tb, NULL)) != MP_OKAY) || - ((res = mp_div_2d(&tq, 1, &tq, NULL)) != MP_OKAY)) { - goto LBL_ERR; - } - } - - /* now q == quotient and ta == remainder */ - n = a->sign; - n2 = (a->sign == b->sign ? MP_ZPOS : MP_NEG); - if (c != NULL) { - mp_exch(c, &q); - c->sign = (mp_iszero(c) == MP_YES) ? MP_ZPOS : n2; - } - if (d != NULL) { - mp_exch(d, &ta); - d->sign = (mp_iszero(d) == MP_YES) ? MP_ZPOS : n; - } -LBL_ERR: - mp_clear_multi(&ta, &tb, &tq, &q, NULL); - return res; -} - -#else - -/* integer signed division. - * c*b + d == a [e.g. a/b, c=quotient, d=remainder] - * HAC pp.598 Algorithm 14.20 - * - * Note that the description in HAC is horribly - * incomplete. For example, it doesn't consider - * the case where digits are removed from 'x' in - * the inner loop. It also doesn't consider the - * case that y has fewer than three digits, etc.. - * - * The overall algorithm is as described as - * 14.20 from HAC but fixed to treat these cases. -*/ -int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) -{ - mp_int q, x, y, t1, t2; - int res, n, t, i, norm, neg; - - /* is divisor zero ? */ - if (mp_iszero (b) == 1) { - return MP_VAL; - } - - /* if a < b then q=0, r = a */ - if (mp_cmp_mag (a, b) == MP_LT) { - if (d != NULL) { - res = mp_copy (a, d); - } else { - res = MP_OKAY; - } - if (c != NULL) { - mp_zero (c); - } - return res; - } - - if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) { - return res; - } - q.used = a->used + 2; - - if ((res = mp_init (&t1)) != MP_OKAY) { - goto LBL_Q; - } - - if ((res = mp_init (&t2)) != MP_OKAY) { - goto LBL_T1; - } - - if ((res = mp_init_copy (&x, a)) != MP_OKAY) { - goto LBL_T2; - } - - if ((res = mp_init_copy (&y, b)) != MP_OKAY) { - goto LBL_X; - } - - /* fix the sign */ - neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; - x.sign = y.sign = MP_ZPOS; - - /* normalize both x and y, ensure that y >= b/2, [b == 2**DIGIT_BIT] */ - norm = mp_count_bits(&y) % DIGIT_BIT; - if (norm < (int)(DIGIT_BIT-1)) { - norm = (DIGIT_BIT-1) - norm; - if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) { - goto LBL_Y; - } - if ((res = mp_mul_2d (&y, norm, &y)) != MP_OKAY) { - goto LBL_Y; - } - } else { - norm = 0; - } - - /* note hac does 0 based, so if used==5 then its 0,1,2,3,4, e.g. use 4 */ - n = x.used - 1; - t = y.used - 1; - - /* while (x >= y*b**n-t) do { q[n-t] += 1; x -= y*b**{n-t} } */ - if ((res = mp_lshd (&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */ - goto LBL_Y; - } - - while (mp_cmp (&x, &y) != MP_LT) { - ++(q.dp[n - t]); - if ((res = mp_sub (&x, &y, &x)) != MP_OKAY) { - goto LBL_Y; - } - } - - /* reset y by shifting it back down */ - mp_rshd (&y, n - t); - - /* step 3. for i from n down to (t + 1) */ - for (i = n; i >= (t + 1); i--) { - if (i > x.used) { - continue; - } - - /* step 3.1 if xi == yt then set q{i-t-1} to b-1, - * otherwise set q{i-t-1} to (xi*b + x{i-1})/yt */ - if (x.dp[i] == y.dp[t]) { - q.dp[i - t - 1] = ((((mp_digit)1) << DIGIT_BIT) - 1); - } else { - mp_word tmp; - tmp = ((mp_word) x.dp[i]) << ((mp_word) DIGIT_BIT); - tmp |= ((mp_word) x.dp[i - 1]); - tmp /= ((mp_word) y.dp[t]); - if (tmp > (mp_word) MP_MASK) - tmp = MP_MASK; - q.dp[i - t - 1] = (mp_digit) (tmp & (mp_word) (MP_MASK)); - } - - /* while (q{i-t-1} * (yt * b + y{t-1})) > - xi * b**2 + xi-1 * b + xi-2 - - do q{i-t-1} -= 1; - */ - q.dp[i - t - 1] = (q.dp[i - t - 1] + 1) & MP_MASK; - do { - q.dp[i - t - 1] = (q.dp[i - t - 1] - 1) & MP_MASK; - - /* find left hand */ - mp_zero (&t1); - t1.dp[0] = (t - 1 < 0) ? 0 : y.dp[t - 1]; - t1.dp[1] = y.dp[t]; - t1.used = 2; - if ((res = mp_mul_d (&t1, q.dp[i - t - 1], &t1)) != MP_OKAY) { - goto LBL_Y; - } - - /* find right hand */ - t2.dp[0] = (i - 2 < 0) ? 0 : x.dp[i - 2]; - t2.dp[1] = (i - 1 < 0) ? 0 : x.dp[i - 1]; - t2.dp[2] = x.dp[i]; - t2.used = 3; - } while (mp_cmp_mag(&t1, &t2) == MP_GT); - - /* step 3.3 x = x - q{i-t-1} * y * b**{i-t-1} */ - if ((res = mp_mul_d (&y, q.dp[i - t - 1], &t1)) != MP_OKAY) { - goto LBL_Y; - } - - if ((res = mp_lshd (&t1, i - t - 1)) != MP_OKAY) { - goto LBL_Y; - } - - if ((res = mp_sub (&x, &t1, &x)) != MP_OKAY) { - goto LBL_Y; - } - - /* if x < 0 then { x = x + y*b**{i-t-1}; q{i-t-1} -= 1; } */ - if (x.sign == MP_NEG) { - if ((res = mp_copy (&y, &t1)) != MP_OKAY) { - goto LBL_Y; - } - if ((res = mp_lshd (&t1, i - t - 1)) != MP_OKAY) { - goto LBL_Y; - } - if ((res = mp_add (&x, &t1, &x)) != MP_OKAY) { - goto LBL_Y; - } - - q.dp[i - t - 1] = (q.dp[i - t - 1] - 1UL) & MP_MASK; - } - } - - /* now q is the quotient and x is the remainder - * [which we have to normalize] - */ - - /* get sign before writing to c */ - x.sign = x.used == 0 ? MP_ZPOS : a->sign; - - if (c != NULL) { - mp_clamp (&q); - mp_exch (&q, c); - c->sign = neg; - } - - if (d != NULL) { - mp_div_2d (&x, norm, &x, NULL); - mp_exch (&x, d); - } - - res = MP_OKAY; - -LBL_Y:mp_clear (&y); -LBL_X:mp_clear (&x); -LBL_T2:mp_clear (&t2); -LBL_T1:mp_clear (&t1); -LBL_Q:mp_clear (&q); - return res; -} - -#endif - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_div.c */ - -/* Start: bn_mp_div_2.c */ -#include -#ifdef BN_MP_DIV_2_C -/* 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@gmail.com, http://libtom.org - */ - -/* b = a/2 */ -int mp_div_2(mp_int * a, mp_int * b) -{ - int x, res, oldused; - - /* copy */ - if (b->alloc < a->used) { - if ((res = mp_grow (b, a->used)) != MP_OKAY) { - return res; - } - } - - oldused = b->used; - b->used = a->used; - { - register mp_digit r, rr, *tmpa, *tmpb; - - /* source alias */ - tmpa = a->dp + b->used - 1; - - /* dest alias */ - tmpb = b->dp + b->used - 1; - - /* carry */ - r = 0; - for (x = b->used - 1; x >= 0; x--) { - /* get the carry for the next iteration */ - rr = *tmpa & 1; - - /* shift the current digit, add in carry and store */ - *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1)); - - /* forward carry to next iteration */ - r = rr; - } - - /* zero excess digits */ - tmpb = b->dp + b->used; - for (x = b->used; x < oldused; x++) { - *tmpb++ = 0; - } - } - b->sign = a->sign; - mp_clamp (b); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_div_2.c */ - -/* Start: bn_mp_div_2d.c */ -#include -#ifdef BN_MP_DIV_2D_C -/* 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@gmail.com, http://libtom.org - */ - -/* shift right by a certain bit count (store quotient in c, optional remainder in d) */ -int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) -{ - mp_digit D, r, rr; - int x, res; - mp_int t; - - - /* if the shift count is <= 0 then we do no work */ - if (b <= 0) { - res = mp_copy (a, c); - if (d != NULL) { - mp_zero (d); - } - return res; - } - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - /* get the remainder */ - if (d != NULL) { - if ((res = mp_mod_2d (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - } - - /* copy */ - if ((res = mp_copy (a, c)) != MP_OKAY) { - mp_clear (&t); - return res; - } - - /* shift by as many digits in the bit count */ - if (b >= (int)DIGIT_BIT) { - mp_rshd (c, b / DIGIT_BIT); - } - - /* shift any bit count < DIGIT_BIT */ - D = (mp_digit) (b % DIGIT_BIT); - if (D != 0) { - register mp_digit *tmpc, mask, shift; - - /* mask */ - mask = (((mp_digit)1) << D) - 1; - - /* shift for lsb */ - shift = DIGIT_BIT - D; - - /* alias */ - tmpc = c->dp + (c->used - 1); - - /* carry */ - r = 0; - for (x = c->used - 1; x >= 0; x--) { - /* get the lower bits of this word in a temp */ - rr = *tmpc & mask; - - /* shift the current word and mix in the carry bits from the previous word */ - *tmpc = (*tmpc >> D) | (r << shift); - --tmpc; - - /* set the carry to the carry bits of the current word found above */ - r = rr; - } - } - mp_clamp (c); - if (d != NULL) { - mp_exch (&t, d); - } - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_div_2d.c */ - -/* Start: bn_mp_div_3.c */ -#include -#ifdef BN_MP_DIV_3_C -/* 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@gmail.com, http://libtom.org - */ - -/* divide by three (based on routine from MPI and the GMP manual) */ -int -mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) -{ - mp_int q; - mp_word w, t; - mp_digit b; - int res, ix; - - /* b = 2**DIGIT_BIT / 3 */ - b = (((mp_word)1) << ((mp_word)DIGIT_BIT)) / ((mp_word)3); - - if ((res = mp_init_size(&q, a->used)) != MP_OKAY) { - return res; - } - - q.used = a->used; - q.sign = a->sign; - w = 0; - for (ix = a->used - 1; ix >= 0; ix--) { - w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); - - if (w >= 3) { - /* multiply w by [1/3] */ - t = (w * ((mp_word)b)) >> ((mp_word)DIGIT_BIT); - - /* now subtract 3 * [w/3] from w, to get the remainder */ - w -= t+t+t; - - /* fixup the remainder as required since - * the optimization is not exact. - */ - while (w >= 3) { - t += 1; - w -= 3; - } - } else { - t = 0; - } - q.dp[ix] = (mp_digit)t; - } - - /* [optional] store the remainder */ - if (d != NULL) { - *d = (mp_digit)w; - } - - /* [optional] store the quotient */ - if (c != NULL) { - mp_clamp(&q); - mp_exch(&q, c); - } - mp_clear(&q); - - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_div_3.c */ - -/* Start: bn_mp_div_d.c */ -#include -#ifdef BN_MP_DIV_D_C -/* 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@gmail.com, http://libtom.org - */ - -static int s_is_power_of_two(mp_digit b, int *p) -{ - int x; - - /* fast return if no power of two */ - if ((b==0) || (b & (b-1))) { - return 0; - } - - for (x = 0; x < DIGIT_BIT; x++) { - if (b == (((mp_digit)1)<dp[0] & ((((mp_digit)1)<used)) != MP_OKAY) { - return res; - } - - q.used = a->used; - q.sign = a->sign; - w = 0; - for (ix = a->used - 1; ix >= 0; ix--) { - w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); - - if (w >= b) { - t = (mp_digit)(w / b); - w -= ((mp_word)t) * ((mp_word)b); - } else { - t = 0; - } - q.dp[ix] = (mp_digit)t; - } - - if (d != NULL) { - *d = (mp_digit)w; - } - - if (c != NULL) { - mp_clamp(&q); - mp_exch(&q, c); - } - mp_clear(&q); - - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_div_d.c */ - -/* Start: bn_mp_dr_is_modulus.c */ -#include -#ifdef BN_MP_DR_IS_MODULUS_C -/* 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@gmail.com, http://libtom.org - */ - -/* determines if a number is a valid DR modulus */ -int mp_dr_is_modulus(mp_int *a) -{ - int ix; - - /* must be at least two digits */ - if (a->used < 2) { - return 0; - } - - /* must be of the form b**k - a [a <= b] so all - * but the first digit must be equal to -1 (mod b). - */ - for (ix = 1; ix < a->used; ix++) { - if (a->dp[ix] != MP_MASK) { - return 0; - } - } - return 1; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_dr_is_modulus.c */ - -/* Start: bn_mp_dr_reduce.c */ -#include -#ifdef BN_MP_DR_REDUCE_C -/* 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@gmail.com, http://libtom.org - */ - -/* reduce "x" in place modulo "n" using the Diminished Radix algorithm. - * - * Based on algorithm from the paper - * - * "Generating Efficient Primes for Discrete Log Cryptosystems" - * Chae Hoon Lim, Pil Joong Lee, - * POSTECH Information Research Laboratories - * - * The modulus must be of a special format [see manual] - * - * Has been modified to use algorithm 7.10 from the LTM book instead - * - * Input x must be in the range 0 <= x <= (n-1)**2 - */ -int -mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k) -{ - int err, i, m; - mp_word r; - mp_digit mu, *tmpx1, *tmpx2; - - /* m = digits in modulus */ - m = n->used; - - /* ensure that "x" has at least 2m digits */ - if (x->alloc < m + m) { - if ((err = mp_grow (x, m + m)) != MP_OKAY) { - return err; - } - } - -/* top of loop, this is where the code resumes if - * another reduction pass is required. - */ -top: - /* aliases for digits */ - /* alias for lower half of x */ - tmpx1 = x->dp; - - /* alias for upper half of x, or x/B**m */ - tmpx2 = x->dp + m; - - /* set carry to zero */ - mu = 0; - - /* compute (x mod B**m) + k * [x/B**m] inline and inplace */ - for (i = 0; i < m; i++) { - r = ((mp_word)*tmpx2++) * ((mp_word)k) + *tmpx1 + mu; - *tmpx1++ = (mp_digit)(r & MP_MASK); - mu = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); - } - - /* set final carry */ - *tmpx1++ = mu; - - /* zero words above m */ - for (i = m + 1; i < x->used; i++) { - *tmpx1++ = 0; - } - - /* clamp, sub and return */ - mp_clamp (x); - - /* if x >= n then subtract and reduce again - * Each successive "recursion" makes the input smaller and smaller. - */ - if (mp_cmp_mag (x, n) != MP_LT) { - s_mp_sub(x, n, x); - goto top; - } - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_dr_reduce.c */ - -/* Start: bn_mp_dr_setup.c */ -#include -#ifdef BN_MP_DR_SETUP_C -/* 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@gmail.com, http://libtom.org - */ - -/* determines the setup value */ -void mp_dr_setup(mp_int *a, mp_digit *d) -{ - /* the casts are required if DIGIT_BIT is one less than - * the number of bits in a mp_digit [e.g. DIGIT_BIT==31] - */ - *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - - ((mp_word)a->dp[0])); -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_dr_setup.c */ - -/* Start: bn_mp_exch.c */ -#include -#ifdef BN_MP_EXCH_C -/* 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@gmail.com, http://libtom.org - */ - -/* swap the elements of two integers, for cases where you can't simply swap the - * mp_int pointers around - */ -void -mp_exch (mp_int * a, mp_int * b) -{ - mp_int t; - - t = *a; - *a = *b; - *b = t; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_exch.c */ - -/* Start: bn_mp_expt_d.c */ -#include -#ifdef BN_MP_EXPT_D_C -/* 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@gmail.com, http://libtom.org - */ - -/* calculate c = a**b using a square-multiply algorithm */ -int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) -{ - int res, x; - mp_int g; - - if ((res = mp_init_copy (&g, a)) != MP_OKAY) { - return res; - } - - /* set initial result */ - mp_set (c, 1); - - for (x = 0; x < (int) DIGIT_BIT; x++) { - /* square */ - if ((res = mp_sqr (c, c)) != MP_OKAY) { - mp_clear (&g); - return res; - } - - /* if the bit is set multiply */ - if ((b & (mp_digit) (((mp_digit)1) << (DIGIT_BIT - 1))) != 0) { - if ((res = mp_mul (c, &g, c)) != MP_OKAY) { - mp_clear (&g); - return res; - } - } - - /* shift to next bit */ - b <<= 1; - } - - mp_clear (&g); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_expt_d.c */ - -/* Start: bn_mp_exptmod.c */ -#include -#ifdef BN_MP_EXPTMOD_C -/* 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@gmail.com, http://libtom.org - */ - - -/* this is a shell function that calls either the normal or Montgomery - * exptmod functions. Originally the call to the montgomery code was - * embedded in the normal function but that wasted alot of stack space - * for nothing (since 99% of the time the Montgomery code would be called) - */ -int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) -{ - int dr; - - /* modulus P must be positive */ - if (P->sign == MP_NEG) { - return MP_VAL; - } - - /* if exponent X is negative we have to recurse */ - if (X->sign == MP_NEG) { -#ifdef BN_MP_INVMOD_C - mp_int tmpG, tmpX; - int err; - - /* first compute 1/G mod P */ - if ((err = mp_init(&tmpG)) != MP_OKAY) { - return err; - } - if ((err = mp_invmod(G, P, &tmpG)) != MP_OKAY) { - mp_clear(&tmpG); - return err; - } - - /* now get |X| */ - if ((err = mp_init(&tmpX)) != MP_OKAY) { - mp_clear(&tmpG); - return err; - } - if ((err = mp_abs(X, &tmpX)) != MP_OKAY) { - mp_clear_multi(&tmpG, &tmpX, NULL); - return err; - } - - /* and now compute (1/G)**|X| instead of G**X [X < 0] */ - err = mp_exptmod(&tmpG, &tmpX, P, Y); - mp_clear_multi(&tmpG, &tmpX, NULL); - return err; -#else - /* no invmod */ - return MP_VAL; -#endif - } - -/* modified diminished radix reduction */ -#if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C) && defined(BN_S_MP_EXPTMOD_C) - if (mp_reduce_is_2k_l(P) == MP_YES) { - return s_mp_exptmod(G, X, P, Y, 1); - } -#endif - -#ifdef BN_MP_DR_IS_MODULUS_C - /* is it a DR modulus? */ - dr = mp_dr_is_modulus(P); -#else - /* default to no */ - dr = 0; -#endif - -#ifdef BN_MP_REDUCE_IS_2K_C - /* if not, is it a unrestricted DR modulus? */ - if (dr == 0) { - dr = mp_reduce_is_2k(P) << 1; - } -#endif - - /* if the modulus is odd or dr != 0 use the montgomery method */ -#ifdef BN_MP_EXPTMOD_FAST_C - if (mp_isodd (P) == 1 || dr != 0) { - return mp_exptmod_fast (G, X, P, Y, dr); - } else { -#endif -#ifdef BN_S_MP_EXPTMOD_C - /* otherwise use the generic Barrett reduction technique */ - return s_mp_exptmod (G, X, P, Y, 0); -#else - /* no exptmod for evens */ - return MP_VAL; -#endif -#ifdef BN_MP_EXPTMOD_FAST_C - } -#endif -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_exptmod.c */ - -/* Start: bn_mp_exptmod_fast.c */ -#include -#ifdef BN_MP_EXPTMOD_FAST_C -/* 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@gmail.com, http://libtom.org - */ - -/* computes Y == G**X mod P, HAC pp.616, Algorithm 14.85 - * - * Uses a left-to-right k-ary sliding window to compute the modular exponentiation. - * The value of k changes based on the size of the exponent. - * - * Uses Montgomery or Diminished Radix reduction [whichever appropriate] - */ - -#ifdef MP_LOW_MEM - #define TAB_SIZE 32 -#else - #define TAB_SIZE 256 -#endif - -int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode) -{ - mp_int M[TAB_SIZE], res; - mp_digit buf, mp; - int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; - - /* use a pointer to the reduction algorithm. This allows us to use - * one of many reduction algorithms without modding the guts of - * the code with if statements everywhere. - */ - int (*redux)(mp_int*,mp_int*,mp_digit); - - /* find window size */ - x = mp_count_bits (X); - if (x <= 7) { - winsize = 2; - } else if (x <= 36) { - winsize = 3; - } else if (x <= 140) { - winsize = 4; - } else if (x <= 450) { - winsize = 5; - } else if (x <= 1303) { - winsize = 6; - } else if (x <= 3529) { - winsize = 7; - } else { - winsize = 8; - } - -#ifdef MP_LOW_MEM - if (winsize > 5) { - winsize = 5; - } -#endif - - /* init M array */ - /* init first cell */ - if ((err = mp_init(&M[1])) != MP_OKAY) { - return err; - } - - /* now init the second half of the array */ - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - if ((err = mp_init(&M[x])) != MP_OKAY) { - for (y = 1<<(winsize-1); y < x; y++) { - mp_clear (&M[y]); - } - mp_clear(&M[1]); - return err; - } - } - - /* determine and setup reduction code */ - if (redmode == 0) { -#ifdef BN_MP_MONTGOMERY_SETUP_C - /* now setup montgomery */ - if ((err = mp_montgomery_setup (P, &mp)) != MP_OKAY) { - goto LBL_M; - } -#else - err = MP_VAL; - goto LBL_M; -#endif - - /* automatically pick the comba one if available (saves quite a few calls/ifs) */ -#ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C - if (((P->used * 2 + 1) < MP_WARRAY) && - P->used < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { - redux = fast_mp_montgomery_reduce; - } else -#endif - { -#ifdef BN_MP_MONTGOMERY_REDUCE_C - /* use slower baseline Montgomery method */ - redux = mp_montgomery_reduce; -#else - err = MP_VAL; - goto LBL_M; -#endif - } - } else if (redmode == 1) { -#if defined(BN_MP_DR_SETUP_C) && defined(BN_MP_DR_REDUCE_C) - /* setup DR reduction for moduli of the form B**k - b */ - mp_dr_setup(P, &mp); - redux = mp_dr_reduce; -#else - err = MP_VAL; - goto LBL_M; -#endif - } else { -#if defined(BN_MP_REDUCE_2K_SETUP_C) && defined(BN_MP_REDUCE_2K_C) - /* setup DR reduction for moduli of the form 2**k - b */ - if ((err = mp_reduce_2k_setup(P, &mp)) != MP_OKAY) { - goto LBL_M; - } - redux = mp_reduce_2k; -#else - err = MP_VAL; - goto LBL_M; -#endif - } - - /* setup result */ - if ((err = mp_init (&res)) != MP_OKAY) { - goto LBL_M; - } - - /* create M table - * - - * - * The first half of the table is not computed though accept for M[0] and M[1] - */ - - if (redmode == 0) { -#ifdef BN_MP_MONTGOMERY_CALC_NORMALIZATION_C - /* now we need R mod m */ - if ((err = mp_montgomery_calc_normalization (&res, P)) != MP_OKAY) { - goto LBL_RES; - } -#else - err = MP_VAL; - goto LBL_RES; -#endif - - /* now set M[1] to G * R mod m */ - if ((err = mp_mulmod (G, &res, P, &M[1])) != MP_OKAY) { - goto LBL_RES; - } - } else { - mp_set(&res, 1); - if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) { - goto LBL_RES; - } - } - - /* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */ - if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_RES; - } - - for (x = 0; x < (winsize - 1); x++) { - if ((err = mp_sqr (&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) { - goto LBL_RES; - } - } - - /* create upper table */ - for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { - if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&M[x], P, mp)) != MP_OKAY) { - goto LBL_RES; - } - } - - /* set initial mode and bit cnt */ - mode = 0; - bitcnt = 1; - buf = 0; - digidx = X->used - 1; - bitcpy = 0; - bitbuf = 0; - - for (;;) { - /* grab next digit as required */ - if (--bitcnt == 0) { - /* if digidx == -1 we are out of digits so break */ - if (digidx == -1) { - break; - } - /* read next digit and reset bitcnt */ - buf = X->dp[digidx--]; - bitcnt = (int)DIGIT_BIT; - } - - /* grab the next msb from the exponent */ - y = (mp_digit)(buf >> (DIGIT_BIT - 1)) & 1; - buf <<= (mp_digit)1; - - /* if the bit is zero and mode == 0 then we ignore it - * These represent the leading zero bits before the first 1 bit - * in the exponent. Technically this opt is not required but it - * does lower the # of trivial squaring/reductions used - */ - if (mode == 0 && y == 0) { - continue; - } - - /* if the bit is zero and mode == 1 then we square */ - if (mode == 1 && y == 0) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - continue; - } - - /* else we add it to the window */ - bitbuf |= (y << (winsize - ++bitcpy)); - mode = 2; - - if (bitcpy == winsize) { - /* ok window is filled so square as required and multiply */ - /* square first */ - for (x = 0; x < winsize; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - } - - /* then multiply */ - if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - - /* empty window and reset */ - bitcpy = 0; - bitbuf = 0; - mode = 1; - } - } - - /* if bits remain then square/multiply */ - if (mode == 2 && bitcpy > 0) { - /* square then multiply if the bit is set */ - for (x = 0; x < bitcpy; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - - /* get next bit of the window */ - bitbuf <<= 1; - if ((bitbuf & (1 << winsize)) != 0) { - /* then multiply */ - if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - } - } - } - - if (redmode == 0) { - /* fixup result if Montgomery reduction is used - * recall that any value in a Montgomery system is - * actually multiplied by R mod n. So we have - * to reduce one more time to cancel out the factor - * of R. - */ - if ((err = redux(&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - } - - /* swap res with Y */ - mp_exch (&res, Y); - err = MP_OKAY; -LBL_RES:mp_clear (&res); -LBL_M: - mp_clear(&M[1]); - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - mp_clear (&M[x]); - } - return err; -} -#endif - - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_exptmod_fast.c */ - -/* Start: bn_mp_exteuclid.c */ -#include -#ifdef BN_MP_EXTEUCLID_C -/* 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@gmail.com, http://libtom.org - */ - -/* Extended euclidean algorithm of (a, b) produces - a*u1 + b*u2 = u3 - */ -int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) -{ - mp_int u1,u2,u3,v1,v2,v3,t1,t2,t3,q,tmp; - int err; - - if ((err = mp_init_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL)) != MP_OKAY) { - return err; - } - - /* initialize, (u1,u2,u3) = (1,0,a) */ - mp_set(&u1, 1); - if ((err = mp_copy(a, &u3)) != MP_OKAY) { goto _ERR; } - - /* initialize, (v1,v2,v3) = (0,1,b) */ - mp_set(&v2, 1); - if ((err = mp_copy(b, &v3)) != MP_OKAY) { goto _ERR; } - - /* loop while v3 != 0 */ - while (mp_iszero(&v3) == MP_NO) { - /* q = u3/v3 */ - if ((err = mp_div(&u3, &v3, &q, NULL)) != MP_OKAY) { goto _ERR; } - - /* (t1,t2,t3) = (u1,u2,u3) - (v1,v2,v3)q */ - if ((err = mp_mul(&v1, &q, &tmp)) != MP_OKAY) { goto _ERR; } - if ((err = mp_sub(&u1, &tmp, &t1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_mul(&v2, &q, &tmp)) != MP_OKAY) { goto _ERR; } - if ((err = mp_sub(&u2, &tmp, &t2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_mul(&v3, &q, &tmp)) != MP_OKAY) { goto _ERR; } - if ((err = mp_sub(&u3, &tmp, &t3)) != MP_OKAY) { goto _ERR; } - - /* (u1,u2,u3) = (v1,v2,v3) */ - if ((err = mp_copy(&v1, &u1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&v2, &u2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&v3, &u3)) != MP_OKAY) { goto _ERR; } - - /* (v1,v2,v3) = (t1,t2,t3) */ - if ((err = mp_copy(&t1, &v1)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&t2, &v2)) != MP_OKAY) { goto _ERR; } - if ((err = mp_copy(&t3, &v3)) != MP_OKAY) { goto _ERR; } - } - - /* make sure U3 >= 0 */ - if (u3.sign == MP_NEG) { - mp_neg(&u1, &u1); - mp_neg(&u2, &u2); - mp_neg(&u3, &u3); - } - - /* copy result out */ - if (U1 != NULL) { mp_exch(U1, &u1); } - if (U2 != NULL) { mp_exch(U2, &u2); } - if (U3 != NULL) { mp_exch(U3, &u3); } - - err = MP_OKAY; -_ERR: mp_clear_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL); - return err; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_exteuclid.c */ - -/* Start: bn_mp_fread.c */ -#include -#ifdef BN_MP_FREAD_C -/* 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@gmail.com, http://libtom.org - */ - -/* read a bigint from a file stream in ASCII */ -int mp_fread(mp_int *a, int radix, FILE *stream) -{ - int err, ch, neg, y; - - /* clear a */ - mp_zero(a); - - /* if first digit is - then set negative */ - ch = fgetc(stream); - if (ch == '-') { - neg = MP_NEG; - ch = fgetc(stream); - } else { - neg = MP_ZPOS; - } - - for (;;) { - /* find y in the radix map */ - for (y = 0; y < radix; y++) { - if (mp_s_rmap[y] == ch) { - break; - } - } - if (y == radix) { - break; - } - - /* shift up and add */ - if ((err = mp_mul_d(a, radix, a)) != MP_OKAY) { - return err; - } - if ((err = mp_add_d(a, y, a)) != MP_OKAY) { - return err; - } - - ch = fgetc(stream); - } - if (mp_cmp_d(a, 0) != MP_EQ) { - a->sign = neg; - } - - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_fread.c */ - -/* Start: bn_mp_fwrite.c */ -#include -#ifdef BN_MP_FWRITE_C -/* 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@gmail.com, http://libtom.org - */ - -int mp_fwrite(mp_int *a, int radix, FILE *stream) -{ - char *buf; - int err, len, x; - - if ((err = mp_radix_size(a, radix, &len)) != MP_OKAY) { - return err; - } - - buf = OPT_CAST(char) XMALLOC (len); - if (buf == NULL) { - return MP_MEM; - } - - if ((err = mp_toradix(a, buf, radix)) != MP_OKAY) { - XFREE (buf); - return err; - } - - for (x = 0; x < len; x++) { - if (fputc(buf[x], stream) == EOF) { - XFREE (buf); - return MP_VAL; - } - } - - XFREE (buf); - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_fwrite.c */ - -/* Start: bn_mp_gcd.c */ -#include -#ifdef BN_MP_GCD_C -/* 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@gmail.com, http://libtom.org - */ - -/* Greatest Common Divisor using the binary method */ -int mp_gcd (mp_int * a, mp_int * b, mp_int * c) -{ - mp_int u, v; - int k, u_lsb, v_lsb, res; - - /* either zero than gcd is the largest */ - if (mp_iszero (a) == MP_YES) { - return mp_abs (b, c); - } - if (mp_iszero (b) == MP_YES) { - return mp_abs (a, c); - } - - /* get copies of a and b we can modify */ - if ((res = mp_init_copy (&u, a)) != MP_OKAY) { - return res; - } - - if ((res = mp_init_copy (&v, b)) != MP_OKAY) { - goto LBL_U; - } - - /* must be positive for the remainder of the algorithm */ - u.sign = v.sign = MP_ZPOS; - - /* B1. Find the common power of two for u and v */ - u_lsb = mp_cnt_lsb(&u); - v_lsb = mp_cnt_lsb(&v); - k = MIN(u_lsb, v_lsb); - - if (k > 0) { - /* divide the power of two out */ - if ((res = mp_div_2d(&u, k, &u, NULL)) != MP_OKAY) { - goto LBL_V; - } - - if ((res = mp_div_2d(&v, k, &v, NULL)) != MP_OKAY) { - goto LBL_V; - } - } - - /* divide any remaining factors of two out */ - if (u_lsb != k) { - if ((res = mp_div_2d(&u, u_lsb - k, &u, NULL)) != MP_OKAY) { - goto LBL_V; - } - } - - if (v_lsb != k) { - if ((res = mp_div_2d(&v, v_lsb - k, &v, NULL)) != MP_OKAY) { - goto LBL_V; - } - } - - while (mp_iszero(&v) == 0) { - /* make sure v is the largest */ - if (mp_cmp_mag(&u, &v) == MP_GT) { - /* swap u and v to make sure v is >= u */ - mp_exch(&u, &v); - } - - /* subtract smallest from largest */ - if ((res = s_mp_sub(&v, &u, &v)) != MP_OKAY) { - goto LBL_V; - } - - /* Divide out all factors of two */ - if ((res = mp_div_2d(&v, mp_cnt_lsb(&v), &v, NULL)) != MP_OKAY) { - goto LBL_V; - } - } - - /* multiply by 2**k which we divided out at the beginning */ - if ((res = mp_mul_2d (&u, k, c)) != MP_OKAY) { - goto LBL_V; - } - c->sign = MP_ZPOS; - res = MP_OKAY; -LBL_V:mp_clear (&u); -LBL_U:mp_clear (&v); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_gcd.c */ - -/* Start: bn_mp_get_int.c */ -#include -#ifdef BN_MP_GET_INT_C -/* 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@gmail.com, http://libtom.org - */ - -/* get the lower 32-bits of an mp_int */ -unsigned long mp_get_int(mp_int * a) -{ - int i; - unsigned long res; - - if (a->used == 0) { - return 0; - } - - /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)((sizeof(unsigned long)*CHAR_BIT+DIGIT_BIT-1)/DIGIT_BIT))-1; - - /* get most significant digit of result */ - res = DIGIT(a,i); - - while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); - } - - /* force result to 32-bits always so it is consistent on non 32-bit platforms */ - return res & 0xFFFFFFFFUL; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_get_int.c */ - -/* Start: bn_mp_grow.c */ -#include -#ifdef BN_MP_GROW_C -/* 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@gmail.com, http://libtom.org - */ - -/* grow as required */ -int mp_grow (mp_int * a, int size) -{ - int i; - mp_digit *tmp; - - /* if the alloc size is smaller alloc more ram */ - if (a->alloc < size) { - /* ensure there are always at least MP_PREC digits extra on top */ - size += (MP_PREC * 2) - (size % MP_PREC); - - /* reallocate the array a->dp - * - * We store the return in a temporary variable - * in case the operation failed we don't want - * to overwrite the dp member of a. - */ - tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * size); - if (tmp == NULL) { - /* reallocation failed but "a" is still valid [can be freed] */ - return MP_MEM; - } - - /* reallocation succeeded so set a->dp */ - a->dp = tmp; - - /* zero excess digits */ - i = a->alloc; - a->alloc = size; - for (; i < a->alloc; i++) { - a->dp[i] = 0; - } - } - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_grow.c */ - -/* Start: bn_mp_init.c */ -#include -#ifdef BN_MP_INIT_C -/* 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@gmail.com, http://libtom.org - */ - -/* init a new mp_int */ -int mp_init (mp_int * a) -{ - int i; - - /* allocate memory required and clear it */ - a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * MP_PREC); - if (a->dp == NULL) { - return MP_MEM; - } - - /* set the digits to zero */ - for (i = 0; i < MP_PREC; i++) { - a->dp[i] = 0; - } - - /* set the used to zero, allocated digits to the default precision - * and sign to positive */ - a->used = 0; - a->alloc = MP_PREC; - a->sign = MP_ZPOS; - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_init.c */ - -/* Start: bn_mp_init_copy.c */ -#include -#ifdef BN_MP_INIT_COPY_C -/* 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@gmail.com, http://libtom.org - */ - -/* creates "a" then copies b into it */ -int mp_init_copy (mp_int * a, mp_int * b) -{ - int res; - - if ((res = mp_init (a)) != MP_OKAY) { - return res; - } - return mp_copy (b, a); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_init_copy.c */ - -/* Start: bn_mp_init_multi.c */ -#include -#ifdef BN_MP_INIT_MULTI_C -/* 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@gmail.com, http://libtom.org - */ -#include - -int mp_init_multi(mp_int *mp, ...) -{ - mp_err res = MP_OKAY; /* Assume ok until proven otherwise */ - int n = 0; /* Number of ok inits */ - mp_int* cur_arg = mp; - va_list args; - - va_start(args, mp); /* init args to next argument from caller */ - while (cur_arg != NULL) { - if (mp_init(cur_arg) != MP_OKAY) { - /* Oops - error! Back-track and mp_clear what we already - succeeded in init-ing, then return error. - */ - va_list clean_args; - - /* end the current list */ - va_end(args); - - /* now start cleaning up */ - cur_arg = mp; - va_start(clean_args, mp); - while (n--) { - mp_clear(cur_arg); - cur_arg = va_arg(clean_args, mp_int*); - } - va_end(clean_args); - res = MP_MEM; - break; - } - n++; - cur_arg = va_arg(args, mp_int*); - } - va_end(args); - return res; /* Assumed ok, if error flagged above. */ -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_init_multi.c */ - -/* Start: bn_mp_init_set.c */ -#include -#ifdef BN_MP_INIT_SET_C -/* 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@gmail.com, http://libtom.org - */ - -/* initialize and set a digit */ -int mp_init_set (mp_int * a, mp_digit b) -{ - int err; - if ((err = mp_init(a)) != MP_OKAY) { - return err; - } - mp_set(a, b); - return err; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_init_set.c */ - -/* Start: bn_mp_init_set_int.c */ -#include -#ifdef BN_MP_INIT_SET_INT_C -/* 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@gmail.com, http://libtom.org - */ - -/* initialize and set a digit */ -int mp_init_set_int (mp_int * a, unsigned long b) -{ - int err; - if ((err = mp_init(a)) != MP_OKAY) { - return err; - } - return mp_set_int(a, b); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_init_set_int.c */ - -/* Start: bn_mp_init_size.c */ -#include -#ifdef BN_MP_INIT_SIZE_C -/* 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@gmail.com, http://libtom.org - */ - -/* init an mp_init for a given size */ -int mp_init_size (mp_int * a, int size) -{ - int x; - - /* pad size so there are always extra digits */ - size += (MP_PREC * 2) - (size % MP_PREC); - - /* alloc mem */ - a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * size); - if (a->dp == NULL) { - return MP_MEM; - } - - /* set the members */ - a->used = 0; - a->alloc = size; - a->sign = MP_ZPOS; - - /* zero the digits */ - for (x = 0; x < size; x++) { - a->dp[x] = 0; - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_init_size.c */ - -/* Start: bn_mp_invmod.c */ -#include -#ifdef BN_MP_INVMOD_C -/* 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@gmail.com, http://libtom.org - */ - -/* hac 14.61, pp608 */ -int mp_invmod (mp_int * a, mp_int * b, mp_int * c) -{ - /* b cannot be negative */ - if (b->sign == MP_NEG || mp_iszero(b) == 1) { - return MP_VAL; - } - -#ifdef BN_FAST_MP_INVMOD_C - /* if the modulus is odd we can use a faster routine instead */ - if (mp_isodd (b) == 1) { - return fast_mp_invmod (a, b, c); - } -#endif - -#ifdef BN_MP_INVMOD_SLOW_C - return mp_invmod_slow(a, b, c); -#endif - - return MP_VAL; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_invmod.c */ - -/* Start: bn_mp_invmod_slow.c */ -#include -#ifdef BN_MP_INVMOD_SLOW_C -/* 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@gmail.com, http://libtom.org - */ - -/* hac 14.61, pp608 */ -int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c) -{ - mp_int x, y, u, v, A, B, C, D; - int res; - - /* b cannot be negative */ - if (b->sign == MP_NEG || mp_iszero(b) == 1) { - return MP_VAL; - } - - /* init temps */ - if ((res = mp_init_multi(&x, &y, &u, &v, - &A, &B, &C, &D, NULL)) != MP_OKAY) { - return res; - } - - /* x = a, y = b */ - if ((res = mp_mod(a, b, &x)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_copy (b, &y)) != MP_OKAY) { - goto LBL_ERR; - } - - /* 2. [modified] if x,y are both even then return an error! */ - if (mp_iseven (&x) == 1 && mp_iseven (&y) == 1) { - res = MP_VAL; - goto LBL_ERR; - } - - /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */ - if ((res = mp_copy (&x, &u)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_copy (&y, &v)) != MP_OKAY) { - goto LBL_ERR; - } - mp_set (&A, 1); - mp_set (&D, 1); - -top: - /* 4. while u is even do */ - while (mp_iseven (&u) == 1) { - /* 4.1 u = u/2 */ - if ((res = mp_div_2 (&u, &u)) != MP_OKAY) { - goto LBL_ERR; - } - /* 4.2 if A or B is odd then */ - if (mp_isodd (&A) == 1 || mp_isodd (&B) == 1) { - /* A = (A+y)/2, B = (B-x)/2 */ - if ((res = mp_add (&A, &y, &A)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } - /* A = A/2, B = B/2 */ - if ((res = mp_div_2 (&A, &A)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_div_2 (&B, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* 5. while v is even do */ - while (mp_iseven (&v) == 1) { - /* 5.1 v = v/2 */ - if ((res = mp_div_2 (&v, &v)) != MP_OKAY) { - goto LBL_ERR; - } - /* 5.2 if C or D is odd then */ - if (mp_isodd (&C) == 1 || mp_isodd (&D) == 1) { - /* C = (C+y)/2, D = (D-x)/2 */ - if ((res = mp_add (&C, &y, &C)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - /* C = C/2, D = D/2 */ - if ((res = mp_div_2 (&C, &C)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_div_2 (&D, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* 6. if u >= v then */ - if (mp_cmp (&u, &v) != MP_LT) { - /* u = u - v, A = A - C, B = B - D */ - if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) { - goto LBL_ERR; - } - - if ((res = mp_sub (&A, &C, &A)) != MP_OKAY) { - goto LBL_ERR; - } - - if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } else { - /* v - v - u, C = C - A, D = D - B */ - if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) { - goto LBL_ERR; - } - - if ((res = mp_sub (&C, &A, &C)) != MP_OKAY) { - goto LBL_ERR; - } - - if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* if not zero goto step 4 */ - if (mp_iszero (&u) == 0) - goto top; - - /* now a = C, b = D, gcd == g*v */ - - /* if v != 1 then there is no inverse */ - if (mp_cmp_d (&v, 1) != MP_EQ) { - res = MP_VAL; - goto LBL_ERR; - } - - /* if its too low */ - while (mp_cmp_d(&C, 0) == MP_LT) { - if ((res = mp_add(&C, b, &C)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* too big */ - while (mp_cmp_mag(&C, b) != MP_LT) { - if ((res = mp_sub(&C, b, &C)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* C is now the inverse */ - mp_exch (&C, c); - res = MP_OKAY; -LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_invmod_slow.c */ - -/* Start: bn_mp_is_square.c */ -#include -#ifdef BN_MP_IS_SQUARE_C -/* 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@gmail.com, http://libtom.org - */ - -/* Check if remainders are possible squares - fast exclude non-squares */ -static const char rem_128[128] = { - 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 -}; - -static const char rem_105[105] = { - 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, - 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 -}; - -/* Store non-zero to ret if arg is square, and zero if not */ -int mp_is_square(mp_int *arg,int *ret) -{ - int res; - mp_digit c; - mp_int t; - unsigned long r; - - /* Default to Non-square :) */ - *ret = MP_NO; - - if (arg->sign == MP_NEG) { - return MP_VAL; - } - - /* digits used? (TSD) */ - if (arg->used == 0) { - return MP_OKAY; - } - - /* First check mod 128 (suppose that DIGIT_BIT is at least 7) */ - if (rem_128[127 & DIGIT(arg,0)] == 1) { - return MP_OKAY; - } - - /* Next check mod 105 (3*5*7) */ - if ((res = mp_mod_d(arg,105,&c)) != MP_OKAY) { - return res; - } - if (rem_105[c] == 1) { - return MP_OKAY; - } - - - if ((res = mp_init_set_int(&t,11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { - return res; - } - if ((res = mp_mod(arg,&t,&t)) != MP_OKAY) { - goto ERR; - } - r = mp_get_int(&t); - /* Check for other prime modules, note it's not an ERROR but we must - * free "t" so the easiest way is to goto ERR. We know that res - * is already equal to MP_OKAY from the mp_mod call - */ - if ( (1L<<(r%11)) & 0x5C4L ) goto ERR; - if ( (1L<<(r%13)) & 0x9E4L ) goto ERR; - if ( (1L<<(r%17)) & 0x5CE8L ) goto ERR; - if ( (1L<<(r%19)) & 0x4F50CL ) goto ERR; - if ( (1L<<(r%23)) & 0x7ACCA0L ) goto ERR; - if ( (1L<<(r%29)) & 0xC2EDD0CL ) goto ERR; - if ( (1L<<(r%31)) & 0x6DE2B848L ) goto ERR; - - /* Final check - is sqr(sqrt(arg)) == arg ? */ - if ((res = mp_sqrt(arg,&t)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sqr(&t,&t)) != MP_OKAY) { - goto ERR; - } - - *ret = (mp_cmp_mag(&t,arg) == MP_EQ) ? MP_YES : MP_NO; -ERR:mp_clear(&t); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_is_square.c */ - -/* Start: bn_mp_jacobi.c */ -#include -#ifdef BN_MP_JACOBI_C -/* 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@gmail.com, http://libtom.org - */ - -/* computes the jacobi c = (a | n) (or Legendre if n is prime) - * HAC pp. 73 Algorithm 2.149 - */ -int mp_jacobi (mp_int * a, mp_int * p, int *c) -{ - mp_int a1, p1; - int k, s, r, res; - mp_digit residue; - - /* if p <= 0 return MP_VAL */ - if (mp_cmp_d(p, 0) != MP_GT) { - return MP_VAL; - } - - /* step 1. if a == 0, return 0 */ - if (mp_iszero (a) == 1) { - *c = 0; - return MP_OKAY; - } - - /* step 2. if a == 1, return 1 */ - if (mp_cmp_d (a, 1) == MP_EQ) { - *c = 1; - return MP_OKAY; - } - - /* default */ - s = 0; - - /* step 3. write a = a1 * 2**k */ - if ((res = mp_init_copy (&a1, a)) != MP_OKAY) { - return res; - } - - if ((res = mp_init (&p1)) != MP_OKAY) { - goto LBL_A1; - } - - /* divide out larger power of two */ - k = mp_cnt_lsb(&a1); - if ((res = mp_div_2d(&a1, k, &a1, NULL)) != MP_OKAY) { - goto LBL_P1; - } - - /* step 4. if e is even set s=1 */ - if ((k & 1) == 0) { - s = 1; - } else { - /* else set s=1 if p = 1/7 (mod 8) or s=-1 if p = 3/5 (mod 8) */ - residue = p->dp[0] & 7; - - if (residue == 1 || residue == 7) { - s = 1; - } else if (residue == 3 || residue == 5) { - s = -1; - } - } - - /* step 5. if p == 3 (mod 4) *and* a1 == 3 (mod 4) then s = -s */ - if ( ((p->dp[0] & 3) == 3) && ((a1.dp[0] & 3) == 3)) { - s = -s; - } - - /* if a1 == 1 we're done */ - if (mp_cmp_d (&a1, 1) == MP_EQ) { - *c = s; - } else { - /* n1 = n mod a1 */ - if ((res = mp_mod (p, &a1, &p1)) != MP_OKAY) { - goto LBL_P1; - } - if ((res = mp_jacobi (&p1, &a1, &r)) != MP_OKAY) { - goto LBL_P1; - } - *c = s * r; - } - - /* done */ - res = MP_OKAY; -LBL_P1:mp_clear (&p1); -LBL_A1:mp_clear (&a1); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_jacobi.c */ - -/* Start: bn_mp_karatsuba_mul.c */ -#include -#ifdef BN_MP_KARATSUBA_MUL_C -/* 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@gmail.com, http://libtom.org - */ - -/* c = |a| * |b| using Karatsuba Multiplication using - * three half size multiplications - * - * Let B represent the radix [e.g. 2**DIGIT_BIT] and - * let n represent half of the number of digits in - * the min(a,b) - * - * a = a1 * B**n + a0 - * b = b1 * B**n + b0 - * - * Then, a * b => - a1b1 * B**2n + ((a1 + a0)(b1 + b0) - (a0b0 + a1b1)) * B + a0b0 - * - * Note that a1b1 and a0b0 are used twice and only need to be - * computed once. So in total three half size (half # of - * digit) multiplications are performed, a0b0, a1b1 and - * (a1+b1)(a0+b0) - * - * Note that a multiplication of half the digits requires - * 1/4th the number of single precision multiplications so in - * total after one call 25% of the single precision multiplications - * are saved. Note also that the call to mp_mul can end up back - * in this function if the a0, a1, b0, or b1 are above the threshold. - * This is known as divide-and-conquer and leads to the famous - * O(N**lg(3)) or O(N**1.584) work which is asymptopically lower than - * the standard O(N**2) that the baseline/comba methods use. - * Generally though the overhead of this method doesn't pay off - * until a certain size (N ~ 80) is reached. - */ -int mp_karatsuba_mul (mp_int * a, mp_int * b, mp_int * c) -{ - mp_int x0, x1, y0, y1, t1, x0y0, x1y1; - int B, err; - - /* default the return code to an error */ - err = MP_MEM; - - /* min # of digits */ - B = MIN (a->used, b->used); - - /* now divide in two */ - B = B >> 1; - - /* init copy all the temps */ - if (mp_init_size (&x0, B) != MP_OKAY) - goto ERR; - if (mp_init_size (&x1, a->used - B) != MP_OKAY) - goto X0; - if (mp_init_size (&y0, B) != MP_OKAY) - goto X1; - if (mp_init_size (&y1, b->used - B) != MP_OKAY) - goto Y0; - - /* init temps */ - if (mp_init_size (&t1, B * 2) != MP_OKAY) - goto Y1; - if (mp_init_size (&x0y0, B * 2) != MP_OKAY) - goto T1; - if (mp_init_size (&x1y1, B * 2) != MP_OKAY) - goto X0Y0; - - /* now shift the digits */ - x0.used = y0.used = B; - x1.used = a->used - B; - y1.used = b->used - B; - - { - register int x; - register mp_digit *tmpa, *tmpb, *tmpx, *tmpy; - - /* we copy the digits directly instead of using higher level functions - * since we also need to shift the digits - */ - tmpa = a->dp; - tmpb = b->dp; - - tmpx = x0.dp; - tmpy = y0.dp; - for (x = 0; x < B; x++) { - *tmpx++ = *tmpa++; - *tmpy++ = *tmpb++; - } - - tmpx = x1.dp; - for (x = B; x < a->used; x++) { - *tmpx++ = *tmpa++; - } - - tmpy = y1.dp; - for (x = B; x < b->used; x++) { - *tmpy++ = *tmpb++; - } - } - - /* only need to clamp the lower words since by definition the - * upper words x1/y1 must have a known number of digits - */ - mp_clamp (&x0); - mp_clamp (&y0); - - /* now calc the products x0y0 and x1y1 */ - /* after this x0 is no longer required, free temp [x0==t2]! */ - if (mp_mul (&x0, &y0, &x0y0) != MP_OKAY) - goto X1Y1; /* x0y0 = x0*y0 */ - if (mp_mul (&x1, &y1, &x1y1) != MP_OKAY) - goto X1Y1; /* x1y1 = x1*y1 */ - - /* now calc x1+x0 and y1+y0 */ - if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) - goto X1Y1; /* t1 = x1 - x0 */ - if (s_mp_add (&y1, &y0, &x0) != MP_OKAY) - goto X1Y1; /* t2 = y1 - y0 */ - if (mp_mul (&t1, &x0, &t1) != MP_OKAY) - goto X1Y1; /* t1 = (x1 + x0) * (y1 + y0) */ - - /* add x0y0 */ - if (mp_add (&x0y0, &x1y1, &x0) != MP_OKAY) - goto X1Y1; /* t2 = x0y0 + x1y1 */ - if (s_mp_sub (&t1, &x0, &t1) != MP_OKAY) - goto X1Y1; /* t1 = (x1+x0)*(y1+y0) - (x1y1 + x0y0) */ - - /* shift by B */ - if (mp_lshd (&t1, B) != MP_OKAY) - goto X1Y1; /* t1 = (x0y0 + x1y1 - (x1-x0)*(y1-y0))< -#ifdef BN_MP_KARATSUBA_SQR_C -/* 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@gmail.com, http://libtom.org - */ - -/* Karatsuba squaring, computes b = a*a using three - * half size squarings - * - * See comments of karatsuba_mul for details. It - * is essentially the same algorithm but merely - * tuned to perform recursive squarings. - */ -int mp_karatsuba_sqr (mp_int * a, mp_int * b) -{ - mp_int x0, x1, t1, t2, x0x0, x1x1; - int B, err; - - err = MP_MEM; - - /* min # of digits */ - B = a->used; - - /* now divide in two */ - B = B >> 1; - - /* init copy all the temps */ - if (mp_init_size (&x0, B) != MP_OKAY) - goto ERR; - if (mp_init_size (&x1, a->used - B) != MP_OKAY) - goto X0; - - /* init temps */ - if (mp_init_size (&t1, a->used * 2) != MP_OKAY) - goto X1; - if (mp_init_size (&t2, a->used * 2) != MP_OKAY) - goto T1; - if (mp_init_size (&x0x0, B * 2) != MP_OKAY) - goto T2; - if (mp_init_size (&x1x1, (a->used - B) * 2) != MP_OKAY) - goto X0X0; - - { - register int x; - register mp_digit *dst, *src; - - src = a->dp; - - /* now shift the digits */ - dst = x0.dp; - for (x = 0; x < B; x++) { - *dst++ = *src++; - } - - dst = x1.dp; - for (x = B; x < a->used; x++) { - *dst++ = *src++; - } - } - - x0.used = B; - x1.used = a->used - B; - - mp_clamp (&x0); - - /* now calc the products x0*x0 and x1*x1 */ - if (mp_sqr (&x0, &x0x0) != MP_OKAY) - goto X1X1; /* x0x0 = x0*x0 */ - if (mp_sqr (&x1, &x1x1) != MP_OKAY) - goto X1X1; /* x1x1 = x1*x1 */ - - /* now calc (x1+x0)**2 */ - if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) - goto X1X1; /* t1 = x1 - x0 */ - if (mp_sqr (&t1, &t1) != MP_OKAY) - goto X1X1; /* t1 = (x1 - x0) * (x1 - x0) */ - - /* add x0y0 */ - if (s_mp_add (&x0x0, &x1x1, &t2) != MP_OKAY) - goto X1X1; /* t2 = x0x0 + x1x1 */ - if (s_mp_sub (&t1, &t2, &t1) != MP_OKAY) - goto X1X1; /* t1 = (x1+x0)**2 - (x0x0 + x1x1) */ - - /* shift by B */ - if (mp_lshd (&t1, B) != MP_OKAY) - goto X1X1; /* t1 = (x0x0 + x1x1 - (x1-x0)*(x1-x0))< -#ifdef BN_MP_LCM_C -/* 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@gmail.com, http://libtom.org - */ - -/* computes least common multiple as |a*b|/(a, b) */ -int mp_lcm (mp_int * a, mp_int * b, mp_int * c) -{ - int res; - mp_int t1, t2; - - - if ((res = mp_init_multi (&t1, &t2, NULL)) != MP_OKAY) { - return res; - } - - /* t1 = get the GCD of the two inputs */ - if ((res = mp_gcd (a, b, &t1)) != MP_OKAY) { - goto LBL_T; - } - - /* divide the smallest by the GCD */ - if (mp_cmp_mag(a, b) == MP_LT) { - /* store quotient in t2 such that t2 * b is the LCM */ - if ((res = mp_div(a, &t1, &t2, NULL)) != MP_OKAY) { - goto LBL_T; - } - res = mp_mul(b, &t2, c); - } else { - /* store quotient in t2 such that t2 * a is the LCM */ - if ((res = mp_div(b, &t1, &t2, NULL)) != MP_OKAY) { - goto LBL_T; - } - res = mp_mul(a, &t2, c); - } - - /* fix the sign to positive */ - c->sign = MP_ZPOS; - -LBL_T: - mp_clear_multi (&t1, &t2, NULL); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_lcm.c */ - -/* Start: bn_mp_lshd.c */ -#include -#ifdef BN_MP_LSHD_C -/* 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@gmail.com, http://libtom.org - */ - -/* shift left a certain amount of digits */ -int mp_lshd (mp_int * a, int b) -{ - int x, res; - - /* if its less than zero return */ - if (b <= 0) { - return MP_OKAY; - } - - /* grow to fit the new digits */ - if (a->alloc < a->used + b) { - if ((res = mp_grow (a, a->used + b)) != MP_OKAY) { - return res; - } - } - - { - register mp_digit *top, *bottom; - - /* increment the used by the shift amount then copy upwards */ - a->used += b; - - /* top */ - top = a->dp + a->used - 1; - - /* base */ - bottom = a->dp + a->used - 1 - b; - - /* much like mp_rshd this is implemented using a sliding window - * except the window goes the otherway around. Copying from - * the bottom to the top. see bn_mp_rshd.c for more info. - */ - for (x = a->used - 1; x >= b; x--) { - *top-- = *bottom--; - } - - /* zero the lower digits */ - top = a->dp; - for (x = 0; x < b; x++) { - *top++ = 0; - } - } - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_lshd.c */ - -/* Start: bn_mp_mod.c */ -#include -#ifdef BN_MP_MOD_C -/* 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@gmail.com, http://libtom.org - */ - -/* c = a mod b, 0 <= c < b */ -int -mp_mod (mp_int * a, mp_int * b, mp_int * c) -{ - mp_int t; - int res; - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - if ((res = mp_div (a, b, NULL, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - - if (t.sign != b->sign) { - res = mp_add (b, &t, c); - } else { - res = MP_OKAY; - mp_exch (&t, c); - } - - mp_clear (&t); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mod.c */ - -/* Start: bn_mp_mod_2d.c */ -#include -#ifdef BN_MP_MOD_2D_C -/* 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@gmail.com, http://libtom.org - */ - -/* calc a value mod 2**b */ -int -mp_mod_2d (mp_int * a, int b, mp_int * c) -{ - int x, res; - - /* if b is <= 0 then zero the int */ - if (b <= 0) { - mp_zero (c); - return MP_OKAY; - } - - /* if the modulus is larger than the value than return */ - if (b >= (int) (a->used * DIGIT_BIT)) { - res = mp_copy (a, c); - return res; - } - - /* copy */ - if ((res = mp_copy (a, c)) != MP_OKAY) { - return res; - } - - /* zero digits above the last digit of the modulus */ - for (x = (b / DIGIT_BIT) + ((b % DIGIT_BIT) == 0 ? 0 : 1); x < c->used; x++) { - c->dp[x] = 0; - } - /* clear the digit that is not completely outside/inside the modulus */ - c->dp[b / DIGIT_BIT] &= - (mp_digit) ((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digit) 1)); - mp_clamp (c); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mod_2d.c */ - -/* Start: bn_mp_mod_d.c */ -#include -#ifdef BN_MP_MOD_D_C -/* 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@gmail.com, http://libtom.org - */ - -int -mp_mod_d (mp_int * a, mp_digit b, mp_digit * c) -{ - return mp_div_d(a, b, NULL, c); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mod_d.c */ - -/* Start: bn_mp_montgomery_calc_normalization.c */ -#include -#ifdef BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -/* 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@gmail.com, http://libtom.org - */ - -/* - * shifts with subtractions when the result is greater than b. - * - * The method is slightly modified to shift B unconditionally upto just under - * the leading bit of b. This saves alot of multiple precision shifting. - */ -int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) -{ - int x, bits, res; - - /* how many bits of last digit does b use */ - bits = mp_count_bits (b) % DIGIT_BIT; - - if (b->used > 1) { - if ((res = mp_2expt (a, (b->used - 1) * DIGIT_BIT + bits - 1)) != MP_OKAY) { - return res; - } - } else { - mp_set(a, 1); - bits = 1; - } - - - /* now compute C = A * B mod b */ - for (x = bits - 1; x < (int)DIGIT_BIT; x++) { - if ((res = mp_mul_2 (a, a)) != MP_OKAY) { - return res; - } - if (mp_cmp_mag (a, b) != MP_LT) { - if ((res = s_mp_sub (a, b, a)) != MP_OKAY) { - return res; - } - } - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_montgomery_calc_normalization.c */ - -/* Start: bn_mp_montgomery_reduce.c */ -#include -#ifdef BN_MP_MONTGOMERY_REDUCE_C -/* 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@gmail.com, http://libtom.org - */ - -/* computes xR**-1 == x (mod N) via Montgomery Reduction */ -int -mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) -{ - int ix, res, digs; - mp_digit mu; - - /* can the fast reduction [comba] method be used? - * - * Note that unlike in mul you're safely allowed *less* - * than the available columns [255 per default] since carries - * are fixed up in the inner loop. - */ - digs = n->used * 2 + 1; - if ((digs < MP_WARRAY) && - n->used < - (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { - return fast_mp_montgomery_reduce (x, n, rho); - } - - /* grow the input as required */ - if (x->alloc < digs) { - if ((res = mp_grow (x, digs)) != MP_OKAY) { - return res; - } - } - x->used = digs; - - for (ix = 0; ix < n->used; ix++) { - /* mu = ai * rho mod b - * - * The value of rho must be precalculated via - * montgomery_setup() such that - * it equals -1/n0 mod b this allows the - * following inner loop to reduce the - * input one digit at a time - */ - mu = (mp_digit) (((mp_word)x->dp[ix]) * ((mp_word)rho) & MP_MASK); - - /* a = a + mu * m * b**i */ - { - register int iy; - register mp_digit *tmpn, *tmpx, u; - register mp_word r; - - /* alias for digits of the modulus */ - tmpn = n->dp; - - /* alias for the digits of x [the input] */ - tmpx = x->dp + ix; - - /* set the carry to zero */ - u = 0; - - /* Multiply and add in place */ - for (iy = 0; iy < n->used; iy++) { - /* compute product and sum */ - r = ((mp_word)mu) * ((mp_word)*tmpn++) + - ((mp_word) u) + ((mp_word) * tmpx); - - /* get carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - - /* fix digit */ - *tmpx++ = (mp_digit)(r & ((mp_word) MP_MASK)); - } - /* At this point the ix'th digit of x should be zero */ - - - /* propagate carries upwards as required*/ - while (u) { - *tmpx += u; - u = *tmpx >> DIGIT_BIT; - *tmpx++ &= MP_MASK; - } - } - } - - /* at this point the n.used'th least - * significant digits of x are all zero - * which means we can shift x to the - * right by n.used digits and the - * residue is unchanged. - */ - - /* x = x/b**n.used */ - mp_clamp(x); - mp_rshd (x, n->used); - - /* if x >= n then x = x - n */ - if (mp_cmp_mag (x, n) != MP_LT) { - return s_mp_sub (x, n, x); - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_montgomery_reduce.c */ - -/* Start: bn_mp_montgomery_setup.c */ -#include -#ifdef BN_MP_MONTGOMERY_SETUP_C -/* 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@gmail.com, http://libtom.org - */ - -/* setups the montgomery reduction stuff */ -int -mp_montgomery_setup (mp_int * n, mp_digit * rho) -{ - mp_digit x, b; - -/* fast inversion mod 2**k - * - * Based on the fact that - * - * XA = 1 (mod 2**n) => (X(2-XA)) A = 1 (mod 2**2n) - * => 2*X*A - X*X*A*A = 1 - * => 2*(1) - (1) = 1 - */ - b = n->dp[0]; - - if ((b & 1) == 0) { - return MP_VAL; - } - - x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */ - x *= 2 - b * x; /* here x*a==1 mod 2**8 */ -#if !defined(MP_8BIT) - x *= 2 - b * x; /* here x*a==1 mod 2**16 */ -#endif -#if defined(MP_64BIT) || !(defined(MP_8BIT) || defined(MP_16BIT)) - x *= 2 - b * x; /* here x*a==1 mod 2**32 */ -#endif -#ifdef MP_64BIT - x *= 2 - b * x; /* here x*a==1 mod 2**64 */ -#endif - - /* rho = -1/m mod b */ - *rho = (unsigned long)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK; - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_montgomery_setup.c */ - -/* Start: bn_mp_mul.c */ -#include -#ifdef BN_MP_MUL_C -/* 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@gmail.com, http://libtom.org - */ - -/* high level multiplication (handles sign) */ -int mp_mul (mp_int * a, mp_int * b, mp_int * c) -{ - int res, neg; - neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; - - /* use Toom-Cook? */ -#ifdef BN_MP_TOOM_MUL_C - if (MIN (a->used, b->used) >= TOOM_MUL_CUTOFF) { - res = mp_toom_mul(a, b, c); - } else -#endif -#ifdef BN_MP_KARATSUBA_MUL_C - /* use Karatsuba? */ - if (MIN (a->used, b->used) >= KARATSUBA_MUL_CUTOFF) { - res = mp_karatsuba_mul (a, b, c); - } else -#endif - { - /* can we use the fast multiplier? - * - * The fast multiplier can be used if the output will - * have less than MP_WARRAY digits and the number of - * digits won't affect carry propagation - */ - int digs = a->used + b->used + 1; - -#ifdef BN_FAST_S_MP_MUL_DIGS_C - if ((digs < MP_WARRAY) && - MIN(a->used, b->used) <= - (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { - res = fast_s_mp_mul_digs (a, b, c, digs); - } else -#endif -#ifdef BN_S_MP_MUL_DIGS_C - res = s_mp_mul (a, b, c); /* uses s_mp_mul_digs */ -#else - res = MP_VAL; -#endif - - } - c->sign = (c->used > 0) ? neg : MP_ZPOS; - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mul.c */ - -/* Start: bn_mp_mul_2.c */ -#include -#ifdef BN_MP_MUL_2_C -/* 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@gmail.com, http://libtom.org - */ - -/* b = a*2 */ -int mp_mul_2(mp_int * a, mp_int * b) -{ - int x, res, oldused; - - /* grow to accomodate result */ - if (b->alloc < a->used + 1) { - if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) { - return res; - } - } - - oldused = b->used; - b->used = a->used; - - { - register mp_digit r, rr, *tmpa, *tmpb; - - /* alias for source */ - tmpa = a->dp; - - /* alias for dest */ - tmpb = b->dp; - - /* carry */ - r = 0; - for (x = 0; x < a->used; x++) { - - /* get what will be the *next* carry bit from the - * MSB of the current digit - */ - rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1)); - - /* now shift up this digit, add in the carry [from the previous] */ - *tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK; - - /* copy the carry that would be from the source - * digit into the next iteration - */ - r = rr; - } - - /* new leading digit? */ - if (r != 0) { - /* add a MSB which is always 1 at this point */ - *tmpb = 1; - ++(b->used); - } - - /* now zero any excess digits on the destination - * that we didn't write to - */ - tmpb = b->dp + b->used; - for (x = b->used; x < oldused; x++) { - *tmpb++ = 0; - } - } - b->sign = a->sign; - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mul_2.c */ - -/* Start: bn_mp_mul_2d.c */ -#include -#ifdef BN_MP_MUL_2D_C -/* 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@gmail.com, http://libtom.org - */ - -/* shift left by a certain bit count */ -int mp_mul_2d (mp_int * a, int b, mp_int * c) -{ - mp_digit d; - int res; - - /* copy */ - if (a != c) { - if ((res = mp_copy (a, c)) != MP_OKAY) { - return res; - } - } - - if (c->alloc < (int)(c->used + b/DIGIT_BIT + 1)) { - if ((res = mp_grow (c, c->used + b / DIGIT_BIT + 1)) != MP_OKAY) { - return res; - } - } - - /* shift by as many digits in the bit count */ - if (b >= (int)DIGIT_BIT) { - if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) { - return res; - } - } - - /* shift any bit count < DIGIT_BIT */ - d = (mp_digit) (b % DIGIT_BIT); - if (d != 0) { - register mp_digit *tmpc, shift, mask, r, rr; - register int x; - - /* bitmask for carries */ - mask = (((mp_digit)1) << d) - 1; - - /* shift for msbs */ - shift = DIGIT_BIT - d; - - /* alias */ - tmpc = c->dp; - - /* carry */ - r = 0; - for (x = 0; x < c->used; x++) { - /* get the higher bits of the current word */ - rr = (*tmpc >> shift) & mask; - - /* shift the current word and OR in the carry */ - *tmpc = ((*tmpc << d) | r) & MP_MASK; - ++tmpc; - - /* set the carry to the carry bits of the current word */ - r = rr; - } - - /* set final carry */ - if (r != 0) { - c->dp[(c->used)++] = r; - } - } - mp_clamp (c); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mul_2d.c */ - -/* Start: bn_mp_mul_d.c */ -#include -#ifdef BN_MP_MUL_D_C -/* 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@gmail.com, http://libtom.org - */ - -/* multiply by a digit */ -int -mp_mul_d (mp_int * a, mp_digit b, mp_int * c) -{ - mp_digit u, *tmpa, *tmpc; - mp_word r; - int ix, res, olduse; - - /* make sure c is big enough to hold a*b */ - if (c->alloc < a->used + 1) { - if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) { - return res; - } - } - - /* get the original destinations used count */ - olduse = c->used; - - /* set the sign */ - c->sign = a->sign; - - /* alias for a->dp [source] */ - tmpa = a->dp; - - /* alias for c->dp [dest] */ - tmpc = c->dp; - - /* zero carry */ - u = 0; - - /* compute columns */ - for (ix = 0; ix < a->used; ix++) { - /* compute product and carry sum for this term */ - r = ((mp_word) u) + ((mp_word)*tmpa++) * ((mp_word)b); - - /* mask off higher bits to get a single digit */ - *tmpc++ = (mp_digit) (r & ((mp_word) MP_MASK)); - - /* send carry into next iteration */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } - - /* store final carry [if any] and increment ix offset */ - *tmpc++ = u; - ++ix; - - /* now zero digits above the top */ - while (ix++ < olduse) { - *tmpc++ = 0; - } - - /* set used count */ - c->used = a->used + 1; - mp_clamp(c); - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mul_d.c */ - -/* Start: bn_mp_mulmod.c */ -#include -#ifdef BN_MP_MULMOD_C -/* 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@gmail.com, http://libtom.org - */ - -/* d = a * b (mod c) */ -int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) -{ - int res; - mp_int t; - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - if ((res = mp_mul (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, c, d); - mp_clear (&t); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_mulmod.c */ - -/* Start: bn_mp_n_root.c */ -#include -#ifdef BN_MP_N_ROOT_C -/* 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@gmail.com, http://libtom.org - */ - -/* find the n'th root of an integer - * - * Result found such that (c)**b <= a and (c+1)**b > a - * - * This algorithm uses Newton's approximation - * x[i+1] = x[i] - f(x[i])/f'(x[i]) - * which will find the root in log(N) time where - * each step involves a fair bit. This is not meant to - * find huge roots [square and cube, etc]. - */ -int mp_n_root (mp_int * a, mp_digit b, mp_int * c) -{ - mp_int t1, t2, t3; - int res, neg; - - /* input must be positive if b is even */ - if ((b & 1) == 0 && a->sign == MP_NEG) { - return MP_VAL; - } - - if ((res = mp_init (&t1)) != MP_OKAY) { - return res; - } - - if ((res = mp_init (&t2)) != MP_OKAY) { - goto LBL_T1; - } - - if ((res = mp_init (&t3)) != MP_OKAY) { - goto LBL_T2; - } - - /* if a is negative fudge the sign but keep track */ - neg = a->sign; - a->sign = MP_ZPOS; - - /* t2 = 2 */ - mp_set (&t2, 2); - - do { - /* t1 = t2 */ - if ((res = mp_copy (&t2, &t1)) != MP_OKAY) { - goto LBL_T3; - } - - /* t2 = t1 - ((t1**b - a) / (b * t1**(b-1))) */ - - /* t3 = t1**(b-1) */ - if ((res = mp_expt_d (&t1, b - 1, &t3)) != MP_OKAY) { - goto LBL_T3; - } - - /* numerator */ - /* t2 = t1**b */ - if ((res = mp_mul (&t3, &t1, &t2)) != MP_OKAY) { - goto LBL_T3; - } - - /* t2 = t1**b - a */ - if ((res = mp_sub (&t2, a, &t2)) != MP_OKAY) { - goto LBL_T3; - } - - /* denominator */ - /* t3 = t1**(b-1) * b */ - if ((res = mp_mul_d (&t3, b, &t3)) != MP_OKAY) { - goto LBL_T3; - } - - /* t3 = (t1**b - a)/(b * t1**(b-1)) */ - if ((res = mp_div (&t2, &t3, &t3, NULL)) != MP_OKAY) { - goto LBL_T3; - } - - if ((res = mp_sub (&t1, &t3, &t2)) != MP_OKAY) { - goto LBL_T3; - } - } while (mp_cmp (&t1, &t2) != MP_EQ); - - /* result can be off by a few so check */ - for (;;) { - if ((res = mp_expt_d (&t1, b, &t2)) != MP_OKAY) { - goto LBL_T3; - } - - if (mp_cmp (&t2, a) == MP_GT) { - if ((res = mp_sub_d (&t1, 1, &t1)) != MP_OKAY) { - goto LBL_T3; - } - } else { - break; - } - } - - /* reset the sign of a first */ - a->sign = neg; - - /* set the result */ - mp_exch (&t1, c); - - /* set the sign of the result */ - c->sign = neg; - - res = MP_OKAY; - -LBL_T3:mp_clear (&t3); -LBL_T2:mp_clear (&t2); -LBL_T1:mp_clear (&t1); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_n_root.c */ - -/* Start: bn_mp_neg.c */ -#include -#ifdef BN_MP_NEG_C -/* 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@gmail.com, http://libtom.org - */ - -/* b = -a */ -int mp_neg (mp_int * a, mp_int * b) -{ - int res; - if (a != b) { - if ((res = mp_copy (a, b)) != MP_OKAY) { - return res; - } - } - - if (mp_iszero(b) != MP_YES) { - b->sign = (a->sign == MP_ZPOS) ? MP_NEG : MP_ZPOS; - } else { - b->sign = MP_ZPOS; - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_neg.c */ - -/* Start: bn_mp_or.c */ -#include -#ifdef BN_MP_OR_C -/* 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@gmail.com, http://libtom.org - */ - -/* OR two ints together */ -int mp_or (mp_int * a, mp_int * b, mp_int * c) -{ - int res, ix, px; - mp_int t, *x; - - if (a->used > b->used) { - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - px = b->used; - x = b; - } else { - if ((res = mp_init_copy (&t, b)) != MP_OKAY) { - return res; - } - px = a->used; - x = a; - } - - for (ix = 0; ix < px; ix++) { - t.dp[ix] |= x->dp[ix]; - } - mp_clamp (&t); - mp_exch (c, &t); - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_or.c */ - -/* Start: bn_mp_prime_fermat.c */ -#include -#ifdef BN_MP_PRIME_FERMAT_C -/* 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@gmail.com, http://libtom.org - */ - -/* performs one Fermat test. - * - * If "a" were prime then b**a == b (mod a) since the order of - * the multiplicative sub-group would be phi(a) = a-1. That means - * it would be the same as b**(a mod (a-1)) == b**1 == b (mod a). - * - * Sets result to 1 if the congruence holds, or zero otherwise. - */ -int mp_prime_fermat (mp_int * a, mp_int * b, int *result) -{ - mp_int t; - int err; - - /* default to composite */ - *result = MP_NO; - - /* ensure b > 1 */ - if (mp_cmp_d(b, 1) != MP_GT) { - return MP_VAL; - } - - /* init t */ - if ((err = mp_init (&t)) != MP_OKAY) { - return err; - } - - /* compute t = b**a mod a */ - if ((err = mp_exptmod (b, a, a, &t)) != MP_OKAY) { - goto LBL_T; - } - - /* is it equal to b? */ - if (mp_cmp (&t, b) == MP_EQ) { - *result = MP_YES; - } - - err = MP_OKAY; -LBL_T:mp_clear (&t); - return err; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_prime_fermat.c */ - -/* Start: bn_mp_prime_is_divisible.c */ -#include -#ifdef BN_MP_PRIME_IS_DIVISIBLE_C -/* 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@gmail.com, http://libtom.org - */ - -/* determines if an integers is divisible by one - * of the first PRIME_SIZE primes or not - * - * sets result to 0 if not, 1 if yes - */ -int mp_prime_is_divisible (mp_int * a, int *result) -{ - int err, ix; - mp_digit res; - - /* default to not */ - *result = MP_NO; - - for (ix = 0; ix < PRIME_SIZE; ix++) { - /* what is a mod LBL_prime_tab[ix] */ - if ((err = mp_mod_d (a, ltm_prime_tab[ix], &res)) != MP_OKAY) { - return err; - } - - /* is the residue zero? */ - if (res == 0) { - *result = MP_YES; - return MP_OKAY; - } - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_prime_is_divisible.c */ - -/* Start: bn_mp_prime_is_prime.c */ -#include -#ifdef BN_MP_PRIME_IS_PRIME_C -/* 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@gmail.com, http://libtom.org - */ - -/* performs a variable number of rounds of Miller-Rabin - * - * Probability of error after t rounds is no more than - - * - * Sets result to 1 if probably prime, 0 otherwise - */ -int mp_prime_is_prime (mp_int * a, int t, int *result) -{ - mp_int b; - int ix, err, res; - - /* default to no */ - *result = MP_NO; - - /* valid value of t? */ - if (t <= 0 || t > PRIME_SIZE) { - return MP_VAL; - } - - /* is the input equal to one of the primes in the table? */ - for (ix = 0; ix < PRIME_SIZE; ix++) { - if (mp_cmp_d(a, ltm_prime_tab[ix]) == MP_EQ) { - *result = 1; - return MP_OKAY; - } - } - - /* first perform trial division */ - if ((err = mp_prime_is_divisible (a, &res)) != MP_OKAY) { - return err; - } - - /* return if it was trivially divisible */ - if (res == MP_YES) { - return MP_OKAY; - } - - /* now perform the miller-rabin rounds */ - if ((err = mp_init (&b)) != MP_OKAY) { - return err; - } - - for (ix = 0; ix < t; ix++) { - /* set the prime */ - mp_set (&b, ltm_prime_tab[ix]); - - if ((err = mp_prime_miller_rabin (a, &b, &res)) != MP_OKAY) { - goto LBL_B; - } - - if (res == MP_NO) { - goto LBL_B; - } - } - - /* passed the test */ - *result = MP_YES; -LBL_B:mp_clear (&b); - return err; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_prime_is_prime.c */ - -/* Start: bn_mp_prime_miller_rabin.c */ -#include -#ifdef BN_MP_PRIME_MILLER_RABIN_C -/* 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@gmail.com, http://libtom.org - */ - -/* Miller-Rabin test of "a" to the base of "b" as described in - * HAC pp. 139 Algorithm 4.24 - * - * Sets result to 0 if definitely composite or 1 if probably prime. - * Randomly the chance of error is no more than 1/4 and often - * very much lower. - */ -int mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result) -{ - mp_int n1, y, r; - int s, j, err; - - /* default */ - *result = MP_NO; - - /* ensure b > 1 */ - if (mp_cmp_d(b, 1) != MP_GT) { - return MP_VAL; - } - - /* get n1 = a - 1 */ - if ((err = mp_init_copy (&n1, a)) != MP_OKAY) { - return err; - } - if ((err = mp_sub_d (&n1, 1, &n1)) != MP_OKAY) { - goto LBL_N1; - } - - /* set 2**s * r = n1 */ - if ((err = mp_init_copy (&r, &n1)) != MP_OKAY) { - goto LBL_N1; - } - - /* count the number of least significant bits - * which are zero - */ - s = mp_cnt_lsb(&r); - - /* now divide n - 1 by 2**s */ - if ((err = mp_div_2d (&r, s, &r, NULL)) != MP_OKAY) { - goto LBL_R; - } - - /* compute y = b**r mod a */ - if ((err = mp_init (&y)) != MP_OKAY) { - goto LBL_R; - } - if ((err = mp_exptmod (b, &r, a, &y)) != MP_OKAY) { - goto LBL_Y; - } - - /* if y != 1 and y != n1 do */ - if (mp_cmp_d (&y, 1) != MP_EQ && mp_cmp (&y, &n1) != MP_EQ) { - j = 1; - /* while j <= s-1 and y != n1 */ - while ((j <= (s - 1)) && mp_cmp (&y, &n1) != MP_EQ) { - if ((err = mp_sqrmod (&y, a, &y)) != MP_OKAY) { - goto LBL_Y; - } - - /* if y == 1 then composite */ - if (mp_cmp_d (&y, 1) == MP_EQ) { - goto LBL_Y; - } - - ++j; - } - - /* if y != n1 then composite */ - if (mp_cmp (&y, &n1) != MP_EQ) { - goto LBL_Y; - } - } - - /* probably prime now */ - *result = MP_YES; -LBL_Y:mp_clear (&y); -LBL_R:mp_clear (&r); -LBL_N1:mp_clear (&n1); - return err; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_prime_miller_rabin.c */ - -/* Start: bn_mp_prime_next_prime.c */ -#include -#ifdef BN_MP_PRIME_NEXT_PRIME_C -/* 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@gmail.com, http://libtom.org - */ - -/* 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 - */ -int mp_prime_next_prime(mp_int *a, int t, int bbs_style) -{ - int err, res, x, y; - mp_digit res_tab[PRIME_SIZE], step, kstep; - mp_int b; - - /* ensure t is valid */ - if (t <= 0 || t > PRIME_SIZE) { - return MP_VAL; - } - - /* force positive */ - a->sign = MP_ZPOS; - - /* simple algo if a is less than the largest prime in the table */ - if (mp_cmp_d(a, ltm_prime_tab[PRIME_SIZE-1]) == MP_LT) { - /* find which prime it is bigger than */ - for (x = PRIME_SIZE - 2; x >= 0; x--) { - if (mp_cmp_d(a, ltm_prime_tab[x]) != MP_LT) { - if (bbs_style == 1) { - /* ok we found a prime smaller or - * equal [so the next is larger] - * - * however, the prime must be - * congruent to 3 mod 4 - */ - if ((ltm_prime_tab[x + 1] & 3) != 3) { - /* scan upwards for a prime congruent to 3 mod 4 */ - for (y = x + 1; y < PRIME_SIZE; y++) { - if ((ltm_prime_tab[y] & 3) == 3) { - mp_set(a, ltm_prime_tab[y]); - return MP_OKAY; - } - } - } - } else { - mp_set(a, ltm_prime_tab[x + 1]); - return MP_OKAY; - } - } - } - /* at this point a maybe 1 */ - if (mp_cmp_d(a, 1) == MP_EQ) { - mp_set(a, 2); - return MP_OKAY; - } - /* fall through to the sieve */ - } - - /* generate a prime congruent to 3 mod 4 or 1/3 mod 4? */ - if (bbs_style == 1) { - kstep = 4; - } else { - kstep = 2; - } - - /* at this point we will use a combination of a sieve and Miller-Rabin */ - - if (bbs_style == 1) { - /* if a mod 4 != 3 subtract the correct value to make it so */ - if ((a->dp[0] & 3) != 3) { - if ((err = mp_sub_d(a, (a->dp[0] & 3) + 1, a)) != MP_OKAY) { return err; }; - } - } else { - if (mp_iseven(a) == 1) { - /* force odd */ - if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) { - return err; - } - } - } - - /* generate the restable */ - for (x = 1; x < PRIME_SIZE; x++) { - if ((err = mp_mod_d(a, ltm_prime_tab[x], res_tab + x)) != MP_OKAY) { - return err; - } - } - - /* init temp used for Miller-Rabin Testing */ - if ((err = mp_init(&b)) != MP_OKAY) { - return err; - } - - for (;;) { - /* skip to the next non-trivially divisible candidate */ - step = 0; - do { - /* y == 1 if any residue was zero [e.g. cannot be prime] */ - y = 0; - - /* increase step to next candidate */ - step += kstep; - - /* compute the new residue without using division */ - for (x = 1; x < PRIME_SIZE; x++) { - /* add the step to each residue */ - res_tab[x] += kstep; - - /* subtract the modulus [instead of using division] */ - if (res_tab[x] >= ltm_prime_tab[x]) { - res_tab[x] -= ltm_prime_tab[x]; - } - - /* set flag if zero */ - if (res_tab[x] == 0) { - y = 1; - } - } - } while (y == 1 && step < ((((mp_digit)1)<= ((((mp_digit)1)< -#ifdef BN_MP_PRIME_RABIN_MILLER_TRIALS_C -/* 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@gmail.com, http://libtom.org - */ - - -static const struct { - int k, t; -} sizes[] = { -{ 128, 28 }, -{ 256, 16 }, -{ 384, 10 }, -{ 512, 7 }, -{ 640, 6 }, -{ 768, 5 }, -{ 896, 4 }, -{ 1024, 4 } -}; - -/* returns # of RM trials required for a given bit size */ -int mp_prime_rabin_miller_trials(int size) -{ - int x; - - for (x = 0; x < (int)(sizeof(sizes)/(sizeof(sizes[0]))); x++) { - if (sizes[x].k == size) { - return sizes[x].t; - } else if (sizes[x].k > size) { - return (x == 0) ? sizes[0].t : sizes[x - 1].t; - } - } - return sizes[x-1].t + 1; -} - - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_prime_rabin_miller_trials.c */ - -/* Start: bn_mp_prime_random_ex.c */ -#include -#ifdef BN_MP_PRIME_RANDOM_EX_C -/* 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@gmail.com, http://libtom.org - */ - -/* 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 - * - */ - -/* This is possibly the mother of all prime generation functions, muahahahahaha! */ -int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat) -{ - unsigned char *tmp, maskAND, maskOR_msb, maskOR_lsb; - int res, err, bsize, maskOR_msb_offset; - - /* sanity check the input */ - if (size <= 1 || t <= 0) { - return MP_VAL; - } - - /* LTM_PRIME_SAFE implies LTM_PRIME_BBS */ - if (flags & LTM_PRIME_SAFE) { - flags |= LTM_PRIME_BBS; - } - - /* calc the byte size */ - bsize = (size>>3) + ((size&7)?1:0); - - /* we need a buffer of bsize bytes */ - tmp = OPT_CAST(unsigned char) XMALLOC(bsize); - if (tmp == NULL) { - return MP_MEM; - } - - /* calc the maskAND value for the MSbyte*/ - maskAND = ((size&7) == 0) ? 0xFF : (0xFF >> (8 - (size & 7))); - - /* calc the maskOR_msb */ - maskOR_msb = 0; - maskOR_msb_offset = ((size & 7) == 1) ? 1 : 0; - if (flags & LTM_PRIME_2MSB_ON) { - maskOR_msb |= 0x80 >> ((9 - size) & 7); - } - - /* get the maskOR_lsb */ - maskOR_lsb = 1; - if (flags & LTM_PRIME_BBS) { - maskOR_lsb |= 3; - } - - do { - /* read the bytes */ - if (cb(tmp, bsize, dat) != bsize) { - err = MP_VAL; - goto error; - } - - /* work over the MSbyte */ - tmp[0] &= maskAND; - tmp[0] |= 1 << ((size - 1) & 7); - - /* mix in the maskORs */ - tmp[maskOR_msb_offset] |= maskOR_msb; - tmp[bsize-1] |= maskOR_lsb; - - /* read it in */ - if ((err = mp_read_unsigned_bin(a, tmp, bsize)) != MP_OKAY) { goto error; } - - /* is it prime? */ - if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { goto error; } - if (res == MP_NO) { - continue; - } - - if (flags & LTM_PRIME_SAFE) { - /* see if (a-1)/2 is prime */ - if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) { goto error; } - if ((err = mp_div_2(a, a)) != MP_OKAY) { goto error; } - - /* is it prime? */ - if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { goto error; } - } - } while (res == MP_NO); - - if (flags & LTM_PRIME_SAFE) { - /* restore a to the original value */ - if ((err = mp_mul_2(a, a)) != MP_OKAY) { goto error; } - if ((err = mp_add_d(a, 1, a)) != MP_OKAY) { goto error; } - } - - err = MP_OKAY; -error: - XFREE(tmp); - return err; -} - - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_prime_random_ex.c */ - -/* Start: bn_mp_radix_size.c */ -#include -#ifdef BN_MP_RADIX_SIZE_C -/* 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@gmail.com, http://libtom.org - */ - -/* returns size of ASCII reprensentation */ -int mp_radix_size (mp_int * a, int radix, int *size) -{ - int res, digs; - mp_int t; - mp_digit d; - - *size = 0; - - /* special case for binary */ - if (radix == 2) { - *size = mp_count_bits (a) + (a->sign == MP_NEG ? 1 : 0) + 1; - return MP_OKAY; - } - - /* make sure the radix is in range */ - if (radix < 2 || radix > 64) { - return MP_VAL; - } - - if (mp_iszero(a) == MP_YES) { - *size = 2; - return MP_OKAY; - } - - /* digs is the digit count */ - digs = 0; - - /* if it's negative add one for the sign */ - if (a->sign == MP_NEG) { - ++digs; - } - - /* init a copy of the input */ - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - - /* force temp to positive */ - t.sign = MP_ZPOS; - - /* fetch out all of the digits */ - while (mp_iszero (&t) == MP_NO) { - if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { - mp_clear (&t); - return res; - } - ++digs; - } - mp_clear (&t); - - /* return digs + 1, the 1 is for the NULL byte that would be required. */ - *size = digs + 1; - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_radix_size.c */ - -/* Start: bn_mp_radix_smap.c */ -#include -#ifdef BN_MP_RADIX_SMAP_C -/* 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@gmail.com, http://libtom.org - */ - -/* chars used in radix conversions */ -const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_radix_smap.c */ - -/* Start: bn_mp_rand.c */ -#include -#ifdef BN_MP_RAND_C -/* 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@gmail.com, http://libtom.org - */ - -/* makes a pseudo-random int of a given size */ -int -mp_rand (mp_int * a, int digits) -{ - int res; - mp_digit d; - - mp_zero (a); - if (digits <= 0) { - return MP_OKAY; - } - - /* first place a random non-zero digit */ - do { - d = ((mp_digit) abs (rand ())) & MP_MASK; - } while (d == 0); - - if ((res = mp_add_d (a, d, a)) != MP_OKAY) { - return res; - } - - while (--digits > 0) { - if ((res = mp_lshd (a, 1)) != MP_OKAY) { - return res; - } - - if ((res = mp_add_d (a, ((mp_digit) abs (rand ())), a)) != MP_OKAY) { - return res; - } - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_rand.c */ - -/* Start: bn_mp_read_radix.c */ -#include -#ifdef BN_MP_READ_RADIX_C -/* 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@gmail.com, http://libtom.org - */ - -/* read a string [ASCII] in a given radix */ -int mp_read_radix (mp_int * a, const char *str, int radix) -{ - int y, res, neg; - char ch; - - /* zero the digit bignum */ - mp_zero(a); - - /* make sure the radix is ok */ - if (radix < 2 || radix > 64) { - return MP_VAL; - } - - /* if the leading digit is a - * minus set the sign to negative. - */ - if (*str == '-') { - ++str; - neg = MP_NEG; - } else { - neg = MP_ZPOS; - } - - /* set the integer to the default of zero */ - mp_zero (a); - - /* process each digit of the string */ - while (*str) { - /* if the radix < 36 the conversion is case insensitive - * this allows numbers like 1AB and 1ab to represent the same value - * [e.g. in hex] - */ - ch = (char) ((radix < 36) ? toupper ((int)*str) : *str); - for (y = 0; y < 64; y++) { - if (ch == mp_s_rmap[y]) { - break; - } - } - - /* if the char was found in the map - * and is less than the given radix add it - * to the number, otherwise exit the loop. - */ - if (y < radix) { - if ((res = mp_mul_d (a, (mp_digit) radix, a)) != MP_OKAY) { - return res; - } - if ((res = mp_add_d (a, (mp_digit) y, a)) != MP_OKAY) { - return res; - } - } else { - break; - } - ++str; - } - - /* set the sign only if a != 0 */ - if (mp_iszero(a) != 1) { - a->sign = neg; - } - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_read_radix.c */ - -/* Start: bn_mp_read_signed_bin.c */ -#include -#ifdef BN_MP_READ_SIGNED_BIN_C -/* 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@gmail.com, http://libtom.org - */ - -/* read signed bin, big endian, first byte is 0==positive or 1==negative */ -int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c) -{ - int res; - - /* read magnitude */ - if ((res = mp_read_unsigned_bin (a, b + 1, c - 1)) != MP_OKAY) { - return res; - } - - /* first byte is 0 for positive, non-zero for negative */ - if (b[0] == 0) { - a->sign = MP_ZPOS; - } else { - a->sign = MP_NEG; - } - - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_read_signed_bin.c */ - -/* Start: bn_mp_read_unsigned_bin.c */ -#include -#ifdef BN_MP_READ_UNSIGNED_BIN_C -/* 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@gmail.com, http://libtom.org - */ - -/* reads a unsigned char array, assumes the msb is stored first [big endian] */ -int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c) -{ - int res; - - /* make sure there are at least two digits */ - if (a->alloc < 2) { - if ((res = mp_grow(a, 2)) != MP_OKAY) { - return res; - } - } - - /* zero the int */ - mp_zero (a); - - /* read the bytes in */ - while (c-- > 0) { - if ((res = mp_mul_2d (a, 8, a)) != MP_OKAY) { - return res; - } - -#ifndef MP_8BIT - a->dp[0] |= *b++; - a->used += 1; -#else - a->dp[0] = (*b & MP_MASK); - a->dp[1] |= ((*b++ >> 7U) & 1); - a->used += 2; -#endif - } - mp_clamp (a); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_read_unsigned_bin.c */ - -/* Start: bn_mp_reduce.c */ -#include -#ifdef BN_MP_REDUCE_C -/* 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@gmail.com, http://libtom.org - */ - -/* reduces x mod m, assumes 0 < x < m**2, mu is - * precomputed via mp_reduce_setup. - * From HAC pp.604 Algorithm 14.42 - */ -int mp_reduce (mp_int * x, mp_int * m, mp_int * mu) -{ - mp_int q; - int res, um = m->used; - - /* q = x */ - if ((res = mp_init_copy (&q, x)) != MP_OKAY) { - return res; - } - - /* q1 = x / b**(k-1) */ - mp_rshd (&q, um - 1); - - /* according to HAC this optimization is ok */ - if (((unsigned long) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) { - if ((res = mp_mul (&q, mu, &q)) != MP_OKAY) { - goto CLEANUP; - } - } else { -#ifdef BN_S_MP_MUL_HIGH_DIGS_C - if ((res = s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) { - goto CLEANUP; - } -#elif defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C) - if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) { - goto CLEANUP; - } -#else - { - res = MP_VAL; - goto CLEANUP; - } -#endif - } - - /* q3 = q2 / b**(k+1) */ - mp_rshd (&q, um + 1); - - /* x = x mod b**(k+1), quick (no division) */ - if ((res = mp_mod_2d (x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) { - goto CLEANUP; - } - - /* q = q * m mod b**(k+1), quick (no division) */ - if ((res = s_mp_mul_digs (&q, m, &q, um + 1)) != MP_OKAY) { - goto CLEANUP; - } - - /* x = x - q */ - if ((res = mp_sub (x, &q, x)) != MP_OKAY) { - goto CLEANUP; - } - - /* If x < 0, add b**(k+1) to it */ - if (mp_cmp_d (x, 0) == MP_LT) { - mp_set (&q, 1); - if ((res = mp_lshd (&q, um + 1)) != MP_OKAY) - goto CLEANUP; - if ((res = mp_add (x, &q, x)) != MP_OKAY) - goto CLEANUP; - } - - /* Back off if it's too big */ - while (mp_cmp (x, m) != MP_LT) { - if ((res = s_mp_sub (x, m, x)) != MP_OKAY) { - goto CLEANUP; - } - } - -CLEANUP: - mp_clear (&q); - - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce.c */ - -/* Start: bn_mp_reduce_2k.c */ -#include -#ifdef BN_MP_REDUCE_2K_C -/* 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@gmail.com, http://libtom.org - */ - -/* reduces a modulo n where n is of the form 2**p - d */ -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d) -{ - mp_int q; - int p, res; - - if ((res = mp_init(&q)) != MP_OKAY) { - return res; - } - - p = mp_count_bits(n); -top: - /* q = a/2**p, a = a mod 2**p */ - if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) { - goto ERR; - } - - if (d != 1) { - /* q = q * d */ - if ((res = mp_mul_d(&q, d, &q)) != MP_OKAY) { - goto ERR; - } - } - - /* a = a + q */ - if ((res = s_mp_add(a, &q, a)) != MP_OKAY) { - goto ERR; - } - - if (mp_cmp_mag(a, n) != MP_LT) { - s_mp_sub(a, n, a); - goto top; - } - -ERR: - mp_clear(&q); - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_2k.c */ - -/* Start: bn_mp_reduce_2k_l.c */ -#include -#ifdef BN_MP_REDUCE_2K_L_C -/* 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@gmail.com, http://libtom.org - */ - -/* reduces a modulo n where n is of the form 2**p - d - This differs from reduce_2k since "d" can be larger - than a single digit. -*/ -int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d) -{ - mp_int q; - int p, res; - - if ((res = mp_init(&q)) != MP_OKAY) { - return res; - } - - p = mp_count_bits(n); -top: - /* q = a/2**p, a = a mod 2**p */ - if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) { - goto ERR; - } - - /* q = q * d */ - if ((res = mp_mul(&q, d, &q)) != MP_OKAY) { - goto ERR; - } - - /* a = a + q */ - if ((res = s_mp_add(a, &q, a)) != MP_OKAY) { - goto ERR; - } - - if (mp_cmp_mag(a, n) != MP_LT) { - s_mp_sub(a, n, a); - goto top; - } - -ERR: - mp_clear(&q); - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_2k_l.c */ - -/* Start: bn_mp_reduce_2k_setup.c */ -#include -#ifdef BN_MP_REDUCE_2K_SETUP_C -/* 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@gmail.com, http://libtom.org - */ - -/* determines the setup value */ -int mp_reduce_2k_setup(mp_int *a, mp_digit *d) -{ - int res, p; - mp_int tmp; - - if ((res = mp_init(&tmp)) != MP_OKAY) { - return res; - } - - p = mp_count_bits(a); - if ((res = mp_2expt(&tmp, p)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - - if ((res = s_mp_sub(&tmp, a, &tmp)) != MP_OKAY) { - mp_clear(&tmp); - return res; - } - - *d = tmp.dp[0]; - mp_clear(&tmp); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_2k_setup.c */ - -/* Start: bn_mp_reduce_2k_setup_l.c */ -#include -#ifdef BN_MP_REDUCE_2K_SETUP_L_C -/* 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@gmail.com, http://libtom.org - */ - -/* determines the setup value */ -int mp_reduce_2k_setup_l(mp_int *a, mp_int *d) -{ - int res; - mp_int tmp; - - if ((res = mp_init(&tmp)) != MP_OKAY) { - return res; - } - - if ((res = mp_2expt(&tmp, mp_count_bits(a))) != MP_OKAY) { - goto ERR; - } - - if ((res = s_mp_sub(&tmp, a, d)) != MP_OKAY) { - goto ERR; - } - -ERR: - mp_clear(&tmp); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_2k_setup_l.c */ - -/* Start: bn_mp_reduce_is_2k.c */ -#include -#ifdef BN_MP_REDUCE_IS_2K_C -/* 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@gmail.com, http://libtom.org - */ - -/* determines if mp_reduce_2k can be used */ -int mp_reduce_is_2k(mp_int *a) -{ - int ix, iy, iw; - mp_digit iz; - - if (a->used == 0) { - return MP_NO; - } else if (a->used == 1) { - return MP_YES; - } else if (a->used > 1) { - iy = mp_count_bits(a); - iz = 1; - iw = 1; - - /* Test every bit from the second digit up, must be 1 */ - for (ix = DIGIT_BIT; ix < iy; ix++) { - if ((a->dp[iw] & iz) == 0) { - return MP_NO; - } - iz <<= 1; - if (iz > (mp_digit)MP_MASK) { - ++iw; - iz = 1; - } - } - } - return MP_YES; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_is_2k.c */ - -/* Start: bn_mp_reduce_is_2k_l.c */ -#include -#ifdef BN_MP_REDUCE_IS_2K_L_C -/* 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@gmail.com, http://libtom.org - */ - -/* determines if reduce_2k_l can be used */ -int mp_reduce_is_2k_l(mp_int *a) -{ - int ix, iy; - - if (a->used == 0) { - return MP_NO; - } else if (a->used == 1) { - return MP_YES; - } else if (a->used > 1) { - /* if more than half of the digits are -1 we're sold */ - for (iy = ix = 0; ix < a->used; ix++) { - if (a->dp[ix] == MP_MASK) { - ++iy; - } - } - return (iy >= (a->used/2)) ? MP_YES : MP_NO; - - } - return MP_NO; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_is_2k_l.c */ - -/* Start: bn_mp_reduce_setup.c */ -#include -#ifdef BN_MP_REDUCE_SETUP_C -/* 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@gmail.com, http://libtom.org - */ - -/* pre-calculate the value required for Barrett reduction - * For a given modulus "b" it calulates the value required in "a" - */ -int mp_reduce_setup (mp_int * a, mp_int * b) -{ - int res; - - if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) { - return res; - } - return mp_div (a, b, a, NULL); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_reduce_setup.c */ - -/* Start: bn_mp_rshd.c */ -#include -#ifdef BN_MP_RSHD_C -/* 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@gmail.com, http://libtom.org - */ - -/* shift right a certain amount of digits */ -void mp_rshd (mp_int * a, int b) -{ - int x; - - /* if b <= 0 then ignore it */ - if (b <= 0) { - return; - } - - /* if b > used then simply zero it and return */ - if (a->used <= b) { - mp_zero (a); - return; - } - - { - register mp_digit *bottom, *top; - - /* shift the digits down */ - - /* bottom */ - bottom = a->dp; - - /* top [offset into digits] */ - top = a->dp + b; - - /* this is implemented as a sliding window where - * the window is b-digits long and digits from - * the top of the window are copied to the bottom - * - * e.g. - - b-2 | b-1 | b0 | b1 | b2 | ... | bb | ----> - /\ | ----> - \-------------------/ ----> - */ - for (x = 0; x < (a->used - b); x++) { - *bottom++ = *top++; - } - - /* zero the top digits */ - for (; x < a->used; x++) { - *bottom++ = 0; - } - } - - /* remove excess digits */ - a->used -= b; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_rshd.c */ - -/* Start: bn_mp_set.c */ -#include -#ifdef BN_MP_SET_C -/* 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@gmail.com, http://libtom.org - */ - -/* set to a digit */ -void mp_set (mp_int * a, mp_digit b) -{ - mp_zero (a); - a->dp[0] = b & MP_MASK; - a->used = (a->dp[0] != 0) ? 1 : 0; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_set.c */ - -/* Start: bn_mp_set_int.c */ -#include -#ifdef BN_MP_SET_INT_C -/* 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@gmail.com, http://libtom.org - */ - -/* set a 32-bit const */ -int mp_set_int (mp_int * a, unsigned long b) -{ - int x, res; - - mp_zero (a); - - /* set four bits at a time */ - for (x = 0; x < 8; x++) { - /* shift the number up four bits */ - if ((res = mp_mul_2d (a, 4, a)) != MP_OKAY) { - return res; - } - - /* OR in the top four bits of the source */ - a->dp[0] |= (b >> 28) & 15; - - /* shift the source up to the next four bits */ - b <<= 4; - - /* ensure that digits are not clamped off */ - a->used += 1; - } - mp_clamp (a); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_set_int.c */ - -/* Start: bn_mp_shrink.c */ -#include -#ifdef BN_MP_SHRINK_C -/* 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@gmail.com, http://libtom.org - */ - -/* shrink a bignum */ -int mp_shrink (mp_int * a) -{ - mp_digit *tmp; - int used = 1; - - if(a->used > 0) - used = a->used; - - if (a->alloc != used) { - if ((tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * used)) == NULL) { - return MP_MEM; - } - a->dp = tmp; - a->alloc = used; - } - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_shrink.c */ - -/* Start: bn_mp_signed_bin_size.c */ -#include -#ifdef BN_MP_SIGNED_BIN_SIZE_C -/* 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@gmail.com, http://libtom.org - */ - -/* get the size for an signed equivalent */ -int mp_signed_bin_size (mp_int * a) -{ - return 1 + mp_unsigned_bin_size (a); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_signed_bin_size.c */ - -/* Start: bn_mp_sqr.c */ -#include -#ifdef BN_MP_SQR_C -/* 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@gmail.com, http://libtom.org - */ - -/* computes b = a*a */ -int -mp_sqr (mp_int * a, mp_int * b) -{ - int res; - -#ifdef BN_MP_TOOM_SQR_C - /* use Toom-Cook? */ - if (a->used >= TOOM_SQR_CUTOFF) { - res = mp_toom_sqr(a, b); - /* Karatsuba? */ - } else -#endif -#ifdef BN_MP_KARATSUBA_SQR_C -if (a->used >= KARATSUBA_SQR_CUTOFF) { - res = mp_karatsuba_sqr (a, b); - } else -#endif - { -#ifdef BN_FAST_S_MP_SQR_C - /* can we use the fast comba multiplier? */ - if ((a->used * 2 + 1) < MP_WARRAY && - a->used < - (1 << (sizeof(mp_word) * CHAR_BIT - 2*DIGIT_BIT - 1))) { - res = fast_s_mp_sqr (a, b); - } else -#endif -#ifdef BN_S_MP_SQR_C - res = s_mp_sqr (a, b); -#else - res = MP_VAL; -#endif - } - b->sign = MP_ZPOS; - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_sqr.c */ - -/* Start: bn_mp_sqrmod.c */ -#include -#ifdef BN_MP_SQRMOD_C -/* 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@gmail.com, http://libtom.org - */ - -/* c = a * a (mod b) */ -int -mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) -{ - int res; - mp_int t; - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - if ((res = mp_sqr (a, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, b, c); - mp_clear (&t); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_sqrmod.c */ - -/* Start: bn_mp_sqrt.c */ -#include -#ifdef BN_MP_SQRT_C -/* 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@gmail.com, http://libtom.org - */ - -/* this function is less generic than mp_n_root, simpler and faster */ -int mp_sqrt(mp_int *arg, mp_int *ret) -{ - int res; - mp_int t1,t2; - - /* must be positive */ - if (arg->sign == MP_NEG) { - return MP_VAL; - } - - /* easy out */ - if (mp_iszero(arg) == MP_YES) { - mp_zero(ret); - return MP_OKAY; - } - - if ((res = mp_init_copy(&t1, arg)) != MP_OKAY) { - return res; - } - - if ((res = mp_init(&t2)) != MP_OKAY) { - goto E2; - } - - /* First approx. (not very bad for large arg) */ - mp_rshd (&t1,t1.used/2); - - /* t1 > 0 */ - if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) { - goto E1; - } - if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) { - goto E1; - } - if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) { - goto E1; - } - /* And now t1 > sqrt(arg) */ - do { - if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) { - goto E1; - } - if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) { - goto E1; - } - if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) { - goto E1; - } - /* t1 >= sqrt(arg) >= t2 at this point */ - } while (mp_cmp_mag(&t1,&t2) == MP_GT); - - mp_exch(&t1,ret); - -E1: mp_clear(&t2); -E2: mp_clear(&t1); - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_sqrt.c */ - -/* Start: bn_mp_sub.c */ -#include -#ifdef BN_MP_SUB_C -/* 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@gmail.com, http://libtom.org - */ - -/* high level subtraction (handles signs) */ -int -mp_sub (mp_int * a, mp_int * b, mp_int * c) -{ - int sa, sb, res; - - sa = a->sign; - sb = b->sign; - - if (sa != sb) { - /* subtract a negative from a positive, OR */ - /* subtract a positive from a negative. */ - /* In either case, ADD their magnitudes, */ - /* and use the sign of the first number. */ - c->sign = sa; - res = s_mp_add (a, b, c); - } else { - /* subtract a positive from a positive, OR */ - /* subtract a negative from a negative. */ - /* First, take the difference between their */ - /* magnitudes, then... */ - if (mp_cmp_mag (a, b) != MP_LT) { - /* Copy the sign from the first */ - c->sign = sa; - /* The first has a larger or equal magnitude */ - res = s_mp_sub (a, b, c); - } else { - /* The result has the *opposite* sign from */ - /* the first number. */ - c->sign = (sa == MP_ZPOS) ? MP_NEG : MP_ZPOS; - /* The second has a larger magnitude */ - res = s_mp_sub (b, a, c); - } - } - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_sub.c */ - -/* Start: bn_mp_sub_d.c */ -#include -#ifdef BN_MP_SUB_D_C -/* 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@gmail.com, http://libtom.org - */ - -/* single digit subtraction */ -int -mp_sub_d (mp_int * a, mp_digit b, mp_int * c) -{ - mp_digit *tmpa, *tmpc, mu; - int res, ix, oldused; - - /* grow c as required */ - if (c->alloc < a->used + 1) { - if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { - return res; - } - } - - /* if a is negative just do an unsigned - * addition [with fudged signs] - */ - if (a->sign == MP_NEG) { - a->sign = MP_ZPOS; - res = mp_add_d(a, b, c); - a->sign = c->sign = MP_NEG; - - /* clamp */ - mp_clamp(c); - - return res; - } - - /* setup regs */ - oldused = c->used; - tmpa = a->dp; - tmpc = c->dp; - - /* if a <= b simply fix the single digit */ - if ((a->used == 1 && a->dp[0] <= b) || a->used == 0) { - if (a->used == 1) { - *tmpc++ = b - *tmpa; - } else { - *tmpc++ = b; - } - ix = 1; - - /* negative/1digit */ - c->sign = MP_NEG; - c->used = 1; - } else { - /* positive/size */ - c->sign = MP_ZPOS; - c->used = a->used; - - /* subtract first digit */ - *tmpc = *tmpa++ - b; - mu = *tmpc >> (sizeof(mp_digit) * CHAR_BIT - 1); - *tmpc++ &= MP_MASK; - - /* handle rest of the digits */ - for (ix = 1; ix < a->used; ix++) { - *tmpc = *tmpa++ - mu; - mu = *tmpc >> (sizeof(mp_digit) * CHAR_BIT - 1); - *tmpc++ &= MP_MASK; - } - } - - /* zero excess digits */ - while (ix++ < oldused) { - *tmpc++ = 0; - } - mp_clamp(c); - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_sub_d.c */ - -/* Start: bn_mp_submod.c */ -#include -#ifdef BN_MP_SUBMOD_C -/* 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@gmail.com, http://libtom.org - */ - -/* d = a - b (mod c) */ -int -mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) -{ - int res; - mp_int t; - - - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } - - if ((res = mp_sub (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, c, d); - mp_clear (&t); - return res; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_submod.c */ - -/* Start: bn_mp_to_signed_bin.c */ -#include -#ifdef BN_MP_TO_SIGNED_BIN_C -/* 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@gmail.com, http://libtom.org - */ - -/* store in signed [big endian] format */ -int mp_to_signed_bin (mp_int * a, unsigned char *b) -{ - int res; - - if ((res = mp_to_unsigned_bin (a, b + 1)) != MP_OKAY) { - return res; - } - b[0] = (unsigned char) ((a->sign == MP_ZPOS) ? 0 : 1); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_to_signed_bin.c */ - -/* Start: bn_mp_to_signed_bin_n.c */ -#include -#ifdef BN_MP_TO_SIGNED_BIN_N_C -/* 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@gmail.com, http://libtom.org - */ - -/* store in signed [big endian] format */ -int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) -{ - if (*outlen < (unsigned long)mp_signed_bin_size(a)) { - return MP_VAL; - } - *outlen = mp_signed_bin_size(a); - return mp_to_signed_bin(a, b); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_to_signed_bin_n.c */ - -/* Start: bn_mp_to_unsigned_bin.c */ -#include -#ifdef BN_MP_TO_UNSIGNED_BIN_C -/* 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@gmail.com, http://libtom.org - */ - -/* store in unsigned [big endian] format */ -int mp_to_unsigned_bin (mp_int * a, unsigned char *b) -{ - int x, res; - mp_int t; - - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - - x = 0; - while (mp_iszero (&t) == 0) { -#ifndef MP_8BIT - b[x++] = (unsigned char) (t.dp[0] & 255); -#else - b[x++] = (unsigned char) (t.dp[0] | ((t.dp[1] & 0x01) << 7)); -#endif - if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) { - mp_clear (&t); - return res; - } - } - bn_reverse (b, x); - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_to_unsigned_bin.c */ - -/* Start: bn_mp_to_unsigned_bin_n.c */ -#include -#ifdef BN_MP_TO_UNSIGNED_BIN_N_C -/* 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@gmail.com, http://libtom.org - */ - -/* store in unsigned [big endian] format */ -int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) -{ - if (*outlen < (unsigned long)mp_unsigned_bin_size(a)) { - return MP_VAL; - } - *outlen = mp_unsigned_bin_size(a); - return mp_to_unsigned_bin(a, b); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_to_unsigned_bin_n.c */ - -/* Start: bn_mp_toom_mul.c */ -#include -#ifdef BN_MP_TOOM_MUL_C -/* 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@gmail.com, http://libtom.org - */ - -/* multiplication using the Toom-Cook 3-way algorithm - * - * Much more complicated than Karatsuba but has a lower - * asymptotic running time of O(N**1.464). This algorithm is - * only particularly useful on VERY large inputs - * (we're talking 1000s of digits here...). -*/ -int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c) -{ - mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2; - int res, B; - - /* init temps */ - if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, - &a0, &a1, &a2, &b0, &b1, - &b2, &tmp1, &tmp2, NULL)) != MP_OKAY) { - return res; - } - - /* B */ - B = MIN(a->used, b->used) / 3; - - /* a = a2 * B**2 + a1 * B + a0 */ - if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_copy(a, &a1)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a1, B); - mp_mod_2d(&a1, DIGIT_BIT * B, &a1); - - if ((res = mp_copy(a, &a2)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a2, B*2); - - /* b = b2 * B**2 + b1 * B + b0 */ - if ((res = mp_mod_2d(b, DIGIT_BIT * B, &b0)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_copy(b, &b1)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&b1, B); - mp_mod_2d(&b1, DIGIT_BIT * B, &b1); - - if ((res = mp_copy(b, &b2)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&b2, B*2); - - /* w0 = a0*b0 */ - if ((res = mp_mul(&a0, &b0, &w0)) != MP_OKAY) { - goto ERR; - } - - /* w4 = a2 * b2 */ - if ((res = mp_mul(&a2, &b2, &w4)) != MP_OKAY) { - goto ERR; - } - - /* w1 = (a2 + 2(a1 + 2a0))(b2 + 2(b1 + 2b0)) */ - if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_mul_2(&b0, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b2, &tmp2)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_mul(&tmp1, &tmp2, &w1)) != MP_OKAY) { - goto ERR; - } - - /* w3 = (a0 + 2(a1 + 2a2))(b0 + 2(b1 + 2b2)) */ - if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_mul_2(&b2, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_mul(&tmp1, &tmp2, &w3)) != MP_OKAY) { - goto ERR; - } - - - /* w2 = (a2 + a1 + a0)(b2 + b1 + b0) */ - if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&b2, &b1, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul(&tmp1, &tmp2, &w2)) != MP_OKAY) { - goto ERR; - } - - /* now solve the matrix - - 0 0 0 0 1 - 1 2 4 8 16 - 1 1 1 1 1 - 16 8 4 2 1 - 1 0 0 0 0 - - using 12 subtractions, 4 shifts, - 2 small divisions and 1 small multiplication - */ - - /* r1 - r4 */ - if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r0 */ - if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/2 */ - if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3/2 */ - if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { - goto ERR; - } - /* r2 - r0 - r4 */ - if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1 - 8r0 */ - if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - 8r4 */ - if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { - goto ERR; - } - /* 3r2 - r1 - r3 */ - if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/3 */ - if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { - goto ERR; - } - /* r3/3 */ - if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { - goto ERR; - } - - /* at this point shift W[n] by B*n */ - if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_add(&w0, &w1, c)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, c, c)) != MP_OKAY) { - goto ERR; - } - -ERR: - mp_clear_multi(&w0, &w1, &w2, &w3, &w4, - &a0, &a1, &a2, &b0, &b1, - &b2, &tmp1, &tmp2, NULL); - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_toom_mul.c */ - -/* Start: bn_mp_toom_sqr.c */ -#include -#ifdef BN_MP_TOOM_SQR_C -/* 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@gmail.com, http://libtom.org - */ - -/* squaring using Toom-Cook 3-way algorithm */ -int -mp_toom_sqr(mp_int *a, mp_int *b) -{ - mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; - int res, B; - - /* init temps */ - if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL)) != MP_OKAY) { - return res; - } - - /* B */ - B = a->used / 3; - - /* a = a2 * B**2 + a1 * B + a0 */ - if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_copy(a, &a1)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a1, B); - mp_mod_2d(&a1, DIGIT_BIT * B, &a1); - - if ((res = mp_copy(a, &a2)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a2, B*2); - - /* w0 = a0*a0 */ - if ((res = mp_sqr(&a0, &w0)) != MP_OKAY) { - goto ERR; - } - - /* w4 = a2 * a2 */ - if ((res = mp_sqr(&a2, &w4)) != MP_OKAY) { - goto ERR; - } - - /* w1 = (a2 + 2(a1 + 2a0))**2 */ - if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_sqr(&tmp1, &w1)) != MP_OKAY) { - goto ERR; - } - - /* w3 = (a0 + 2(a1 + 2a2))**2 */ - if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_sqr(&tmp1, &w3)) != MP_OKAY) { - goto ERR; - } - - - /* w2 = (a2 + a1 + a0)**2 */ - if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sqr(&tmp1, &w2)) != MP_OKAY) { - goto ERR; - } - - /* now solve the matrix - - 0 0 0 0 1 - 1 2 4 8 16 - 1 1 1 1 1 - 16 8 4 2 1 - 1 0 0 0 0 - - using 12 subtractions, 4 shifts, 2 small divisions and 1 small multiplication. - */ - - /* r1 - r4 */ - if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r0 */ - if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/2 */ - if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3/2 */ - if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { - goto ERR; - } - /* r2 - r0 - r4 */ - if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1 - 8r0 */ - if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - 8r4 */ - if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { - goto ERR; - } - /* 3r2 - r1 - r3 */ - if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/3 */ - if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { - goto ERR; - } - /* r3/3 */ - if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { - goto ERR; - } - - /* at this point shift W[n] by B*n */ - if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_add(&w0, &w1, b)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, b, b)) != MP_OKAY) { - goto ERR; - } - -ERR: - mp_clear_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL); - return res; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_toom_sqr.c */ - -/* Start: bn_mp_toradix.c */ -#include -#ifdef BN_MP_TORADIX_C -/* 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@gmail.com, http://libtom.org - */ - -/* stores a bignum as a ASCII string in a given radix (2..64) */ -int mp_toradix (mp_int * a, char *str, int radix) -{ - int res, digs; - mp_int t; - mp_digit d; - char *_s = str; - - /* check range of the radix */ - if (radix < 2 || radix > 64) { - return MP_VAL; - } - - /* quick out if its zero */ - if (mp_iszero(a) == 1) { - *str++ = '0'; - *str = '\0'; - return MP_OKAY; - } - - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - - /* if it is negative output a - */ - if (t.sign == MP_NEG) { - ++_s; - *str++ = '-'; - t.sign = MP_ZPOS; - } - - digs = 0; - while (mp_iszero (&t) == 0) { - if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { - mp_clear (&t); - return res; - } - *str++ = mp_s_rmap[d]; - ++digs; - } - - /* reverse the digits of the string. In this case _s points - * to the first digit [exluding the sign] of the number] - */ - bn_reverse ((unsigned char *)_s, digs); - - /* append a NULL so the string is properly terminated */ - *str = '\0'; - - mp_clear (&t); - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_toradix.c */ - -/* Start: bn_mp_toradix_n.c */ -#include -#ifdef BN_MP_TORADIX_N_C -/* 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@gmail.com, http://libtom.org - */ - -/* stores a bignum as a ASCII string in a given radix (2..64) - * - * Stores upto maxlen-1 chars and always a NULL byte - */ -int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) -{ - int res, digs; - mp_int t; - mp_digit d; - char *_s = str; - - /* check range of the maxlen, radix */ - if (maxlen < 2 || radix < 2 || radix > 64) { - return MP_VAL; - } - - /* quick out if its zero */ - if (mp_iszero(a) == MP_YES) { - *str++ = '0'; - *str = '\0'; - return MP_OKAY; - } - - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - - /* if it is negative output a - */ - if (t.sign == MP_NEG) { - /* we have to reverse our digits later... but not the - sign!! */ - ++_s; - - /* store the flag and mark the number as positive */ - *str++ = '-'; - t.sign = MP_ZPOS; - - /* subtract a char */ - --maxlen; - } - - digs = 0; - while (mp_iszero (&t) == 0) { - if (--maxlen < 1) { - /* no more room */ - break; - } - if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { - mp_clear (&t); - return res; - } - *str++ = mp_s_rmap[d]; - ++digs; - } - - /* reverse the digits of the string. In this case _s points - * to the first digit [exluding the sign] of the number - */ - bn_reverse ((unsigned char *)_s, digs); - - /* append a NULL so the string is properly terminated */ - *str = '\0'; - - mp_clear (&t); - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_toradix_n.c */ - -/* Start: bn_mp_unsigned_bin_size.c */ -#include -#ifdef BN_MP_UNSIGNED_BIN_SIZE_C -/* 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@gmail.com, http://libtom.org - */ - -/* get the size for an unsigned equivalent */ -int mp_unsigned_bin_size (mp_int * a) -{ - int size = mp_count_bits (a); - return (size / 8 + ((size & 7) != 0 ? 1 : 0)); -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_unsigned_bin_size.c */ - -/* Start: bn_mp_xor.c */ -#include -#ifdef BN_MP_XOR_C -/* 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@gmail.com, http://libtom.org - */ - -/* XOR two ints together */ -int -mp_xor (mp_int * a, mp_int * b, mp_int * c) -{ - int res, ix, px; - mp_int t, *x; - - if (a->used > b->used) { - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - px = b->used; - x = b; - } else { - if ((res = mp_init_copy (&t, b)) != MP_OKAY) { - return res; - } - px = a->used; - x = a; - } - - for (ix = 0; ix < px; ix++) { - t.dp[ix] ^= x->dp[ix]; - } - mp_clamp (&t); - mp_exch (c, &t); - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_xor.c */ - -/* Start: bn_mp_zero.c */ -#include -#ifdef BN_MP_ZERO_C -/* 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@gmail.com, http://libtom.org - */ - -/* set to zero */ -void mp_zero (mp_int * a) -{ - int n; - mp_digit *tmp; - - a->sign = MP_ZPOS; - a->used = 0; - - tmp = a->dp; - for (n = 0; n < a->alloc; n++) { - *tmp++ = 0; - } -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_mp_zero.c */ - -/* Start: bn_prime_tab.c */ -#include -#ifdef BN_PRIME_TAB_C -/* 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@gmail.com, http://libtom.org - */ -const mp_digit ltm_prime_tab[] = { - 0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013, - 0x0017, 0x001D, 0x001F, 0x0025, 0x0029, 0x002B, 0x002F, 0x0035, - 0x003B, 0x003D, 0x0043, 0x0047, 0x0049, 0x004F, 0x0053, 0x0059, - 0x0061, 0x0065, 0x0067, 0x006B, 0x006D, 0x0071, 0x007F, -#ifndef MP_8BIT - 0x0083, - 0x0089, 0x008B, 0x0095, 0x0097, 0x009D, 0x00A3, 0x00A7, 0x00AD, - 0x00B3, 0x00B5, 0x00BF, 0x00C1, 0x00C5, 0x00C7, 0x00D3, 0x00DF, - 0x00E3, 0x00E5, 0x00E9, 0x00EF, 0x00F1, 0x00FB, 0x0101, 0x0107, - 0x010D, 0x010F, 0x0115, 0x0119, 0x011B, 0x0125, 0x0133, 0x0137, - - 0x0139, 0x013D, 0x014B, 0x0151, 0x015B, 0x015D, 0x0161, 0x0167, - 0x016F, 0x0175, 0x017B, 0x017F, 0x0185, 0x018D, 0x0191, 0x0199, - 0x01A3, 0x01A5, 0x01AF, 0x01B1, 0x01B7, 0x01BB, 0x01C1, 0x01C9, - 0x01CD, 0x01CF, 0x01D3, 0x01DF, 0x01E7, 0x01EB, 0x01F3, 0x01F7, - 0x01FD, 0x0209, 0x020B, 0x021D, 0x0223, 0x022D, 0x0233, 0x0239, - 0x023B, 0x0241, 0x024B, 0x0251, 0x0257, 0x0259, 0x025F, 0x0265, - 0x0269, 0x026B, 0x0277, 0x0281, 0x0283, 0x0287, 0x028D, 0x0293, - 0x0295, 0x02A1, 0x02A5, 0x02AB, 0x02B3, 0x02BD, 0x02C5, 0x02CF, - - 0x02D7, 0x02DD, 0x02E3, 0x02E7, 0x02EF, 0x02F5, 0x02F9, 0x0301, - 0x0305, 0x0313, 0x031D, 0x0329, 0x032B, 0x0335, 0x0337, 0x033B, - 0x033D, 0x0347, 0x0355, 0x0359, 0x035B, 0x035F, 0x036D, 0x0371, - 0x0373, 0x0377, 0x038B, 0x038F, 0x0397, 0x03A1, 0x03A9, 0x03AD, - 0x03B3, 0x03B9, 0x03C7, 0x03CB, 0x03D1, 0x03D7, 0x03DF, 0x03E5, - 0x03F1, 0x03F5, 0x03FB, 0x03FD, 0x0407, 0x0409, 0x040F, 0x0419, - 0x041B, 0x0425, 0x0427, 0x042D, 0x043F, 0x0443, 0x0445, 0x0449, - 0x044F, 0x0455, 0x045D, 0x0463, 0x0469, 0x047F, 0x0481, 0x048B, - - 0x0493, 0x049D, 0x04A3, 0x04A9, 0x04B1, 0x04BD, 0x04C1, 0x04C7, - 0x04CD, 0x04CF, 0x04D5, 0x04E1, 0x04EB, 0x04FD, 0x04FF, 0x0503, - 0x0509, 0x050B, 0x0511, 0x0515, 0x0517, 0x051B, 0x0527, 0x0529, - 0x052F, 0x0551, 0x0557, 0x055D, 0x0565, 0x0577, 0x0581, 0x058F, - 0x0593, 0x0595, 0x0599, 0x059F, 0x05A7, 0x05AB, 0x05AD, 0x05B3, - 0x05BF, 0x05C9, 0x05CB, 0x05CF, 0x05D1, 0x05D5, 0x05DB, 0x05E7, - 0x05F3, 0x05FB, 0x0607, 0x060D, 0x0611, 0x0617, 0x061F, 0x0623, - 0x062B, 0x062F, 0x063D, 0x0641, 0x0647, 0x0649, 0x064D, 0x0653 -#endif -}; -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_prime_tab.c */ - -/* Start: bn_reverse.c */ -#include -#ifdef BN_REVERSE_C -/* 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@gmail.com, http://libtom.org - */ - -/* reverse an array, used for radix code */ -void -bn_reverse (unsigned char *s, int len) -{ - int ix, iy; - unsigned char t; - - ix = 0; - iy = len - 1; - while (ix < iy) { - t = s[ix]; - s[ix] = s[iy]; - s[iy] = t; - ++ix; - --iy; - } -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_reverse.c */ - -/* Start: bn_s_mp_add.c */ -#include -#ifdef BN_S_MP_ADD_C -/* 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@gmail.com, http://libtom.org - */ - -/* low level addition, based on HAC pp.594, Algorithm 14.7 */ -int -s_mp_add (mp_int * a, mp_int * b, mp_int * c) -{ - mp_int *x; - int olduse, res, min, max; - - /* find sizes, we let |a| <= |b| which means we have to sort - * them. "x" will point to the input with the most digits - */ - if (a->used > b->used) { - min = b->used; - max = a->used; - x = a; - } else { - min = a->used; - max = b->used; - x = b; - } - - /* init result */ - if (c->alloc < max + 1) { - if ((res = mp_grow (c, max + 1)) != MP_OKAY) { - return res; - } - } - - /* get old used digit count and set new one */ - olduse = c->used; - c->used = max + 1; - - { - register mp_digit u, *tmpa, *tmpb, *tmpc; - register int i; - - /* alias for digit pointers */ - - /* first input */ - tmpa = a->dp; - - /* second input */ - tmpb = b->dp; - - /* destination */ - tmpc = c->dp; - - /* zero the carry */ - u = 0; - for (i = 0; i < min; i++) { - /* Compute the sum at one digit, T[i] = A[i] + B[i] + U */ - *tmpc = *tmpa++ + *tmpb++ + u; - - /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)DIGIT_BIT); - - /* take away carry bit from T[i] */ - *tmpc++ &= MP_MASK; - } - - /* now copy higher words if any, that is in A+B - * if A or B has more digits add those in - */ - if (min != max) { - for (; i < max; i++) { - /* T[i] = X[i] + U */ - *tmpc = x->dp[i] + u; - - /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)DIGIT_BIT); - - /* take away carry bit from T[i] */ - *tmpc++ &= MP_MASK; - } - } - - /* add carry */ - *tmpc++ = u; - - /* clear digits above oldused */ - for (i = c->used; i < olduse; i++) { - *tmpc++ = 0; - } - } - - mp_clamp (c); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_s_mp_add.c */ - -/* Start: bn_s_mp_exptmod.c */ -#include -#ifdef BN_S_MP_EXPTMOD_C -/* 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@gmail.com, http://libtom.org - */ -#ifdef MP_LOW_MEM - #define TAB_SIZE 32 -#else - #define TAB_SIZE 256 -#endif - -int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode) -{ - mp_int M[TAB_SIZE], res, mu; - mp_digit buf; - int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; - int (*redux)(mp_int*,mp_int*,mp_int*); - - /* find window size */ - x = mp_count_bits (X); - if (x <= 7) { - winsize = 2; - } else if (x <= 36) { - winsize = 3; - } else if (x <= 140) { - winsize = 4; - } else if (x <= 450) { - winsize = 5; - } else if (x <= 1303) { - winsize = 6; - } else if (x <= 3529) { - winsize = 7; - } else { - winsize = 8; - } - -#ifdef MP_LOW_MEM - if (winsize > 5) { - winsize = 5; - } -#endif - - /* init M array */ - /* init first cell */ - if ((err = mp_init(&M[1])) != MP_OKAY) { - return err; - } - - /* now init the second half of the array */ - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - if ((err = mp_init(&M[x])) != MP_OKAY) { - for (y = 1<<(winsize-1); y < x; y++) { - mp_clear (&M[y]); - } - mp_clear(&M[1]); - return err; - } - } - - /* create mu, used for Barrett reduction */ - if ((err = mp_init (&mu)) != MP_OKAY) { - goto LBL_M; - } - - if (redmode == 0) { - if ((err = mp_reduce_setup (&mu, P)) != MP_OKAY) { - goto LBL_MU; - } - redux = mp_reduce; - } else { - if ((err = mp_reduce_2k_setup_l (P, &mu)) != MP_OKAY) { - goto LBL_MU; - } - redux = mp_reduce_2k_l; - } - - /* create M table - * - * The M table contains powers of the base, - * e.g. M[x] = G**x mod P - * - * The first half of the table is not - * computed though accept for M[0] and M[1] - */ - if ((err = mp_mod (G, P, &M[1])) != MP_OKAY) { - goto LBL_MU; - } - - /* compute the value at M[1<<(winsize-1)] by squaring - * M[1] (winsize-1) times - */ - if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_MU; - } - - for (x = 0; x < (winsize - 1); x++) { - /* square it */ - if ((err = mp_sqr (&M[1 << (winsize - 1)], - &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_MU; - } - - /* reduce modulo P */ - if ((err = redux (&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) { - goto LBL_MU; - } - } - - /* create upper table, that is M[x] = M[x-1] * M[1] (mod P) - * for x = (2**(winsize - 1) + 1) to (2**winsize - 1) - */ - for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { - if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) { - goto LBL_MU; - } - if ((err = redux (&M[x], P, &mu)) != MP_OKAY) { - goto LBL_MU; - } - } - - /* setup result */ - if ((err = mp_init (&res)) != MP_OKAY) { - goto LBL_MU; - } - mp_set (&res, 1); - - /* set initial mode and bit cnt */ - mode = 0; - bitcnt = 1; - buf = 0; - digidx = X->used - 1; - bitcpy = 0; - bitbuf = 0; - - for (;;) { - /* grab next digit as required */ - if (--bitcnt == 0) { - /* if digidx == -1 we are out of digits */ - if (digidx == -1) { - break; - } - /* read next digit and reset the bitcnt */ - buf = X->dp[digidx--]; - bitcnt = (int) DIGIT_BIT; - } - - /* grab the next msb from the exponent */ - y = (buf >> (mp_digit)(DIGIT_BIT - 1)) & 1; - buf <<= (mp_digit)1; - - /* if the bit is zero and mode == 0 then we ignore it - * These represent the leading zero bits before the first 1 bit - * in the exponent. Technically this opt is not required but it - * does lower the # of trivial squaring/reductions used - */ - if (mode == 0 && y == 0) { - continue; - } - - /* if the bit is zero and mode == 1 then we square */ - if (mode == 1 && y == 0) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } - continue; - } - - /* else we add it to the window */ - bitbuf |= (y << (winsize - ++bitcpy)); - mode = 2; - - if (bitcpy == winsize) { - /* ok window is filled so square as required and multiply */ - /* square first */ - for (x = 0; x < winsize; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } - } - - /* then multiply */ - if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } - - /* empty window and reset */ - bitcpy = 0; - bitbuf = 0; - mode = 1; - } - } - - /* if bits remain then square/multiply */ - if (mode == 2 && bitcpy > 0) { - /* square then multiply if the bit is set */ - for (x = 0; x < bitcpy; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } - - bitbuf <<= 1; - if ((bitbuf & (1 << winsize)) != 0) { - /* then multiply */ - if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } - } - } - } - - mp_exch (&res, Y); - err = MP_OKAY; -LBL_RES:mp_clear (&res); -LBL_MU:mp_clear (&mu); -LBL_M: - mp_clear(&M[1]); - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - mp_clear (&M[x]); - } - return err; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_s_mp_exptmod.c */ - -/* Start: bn_s_mp_mul_digs.c */ -#include -#ifdef BN_S_MP_MUL_DIGS_C -/* 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@gmail.com, http://libtom.org - */ - -/* multiplies |a| * |b| and only computes upto digs digits of result - * HAC pp. 595, Algorithm 14.12 Modified so you can control how - * many digits of output are created. - */ -int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) -{ - mp_int t; - int res, pa, pb, ix, iy; - mp_digit u; - mp_word r; - mp_digit tmpx, *tmpt, *tmpy; - - /* can we use the fast multiplier? */ - if (((digs) < MP_WARRAY) && - MIN (a->used, b->used) < - (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { - return fast_s_mp_mul_digs (a, b, c, digs); - } - - if ((res = mp_init_size (&t, digs)) != MP_OKAY) { - return res; - } - t.used = digs; - - /* compute the digits of the product directly */ - pa = a->used; - for (ix = 0; ix < pa; ix++) { - /* set the carry to zero */ - u = 0; - - /* limit ourselves to making digs digits of output */ - pb = MIN (b->used, digs - ix); - - /* setup some aliases */ - /* copy of the digit from a used within the nested loop */ - tmpx = a->dp[ix]; - - /* an alias for the destination shifted ix places */ - tmpt = t.dp + ix; - - /* an alias for the digits of b */ - tmpy = b->dp; - - /* compute the columns of the output and propagate the carry */ - for (iy = 0; iy < pb; iy++) { - /* compute the column as a mp_word */ - r = ((mp_word)*tmpt) + - ((mp_word)tmpx) * ((mp_word)*tmpy++) + - ((mp_word) u); - - /* the new column is the lower part of the result */ - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); - - /* get the carry word from the result */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } - /* set carry if it is placed below digs */ - if (ix + iy < digs) { - *tmpt = u; - } - } - - mp_clamp (&t); - mp_exch (&t, c); - - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_s_mp_mul_digs.c */ - -/* Start: bn_s_mp_mul_high_digs.c */ -#include -#ifdef BN_S_MP_MUL_HIGH_DIGS_C -/* 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@gmail.com, http://libtom.org - */ - -/* multiplies |a| * |b| and does not compute the lower digs digits - * [meant to get the higher part of the product] - */ -int -s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) -{ - mp_int t; - int res, pa, pb, ix, iy; - mp_digit u; - mp_word r; - mp_digit tmpx, *tmpt, *tmpy; - - /* can we use the fast multiplier? */ -#ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C - if (((a->used + b->used + 1) < MP_WARRAY) - && MIN (a->used, b->used) < (1 << ((CHAR_BIT * sizeof (mp_word)) - (2 * DIGIT_BIT)))) { - return fast_s_mp_mul_high_digs (a, b, c, digs); - } -#endif - - if ((res = mp_init_size (&t, a->used + b->used + 1)) != MP_OKAY) { - return res; - } - t.used = a->used + b->used + 1; - - pa = a->used; - pb = b->used; - for (ix = 0; ix < pa; ix++) { - /* clear the carry */ - u = 0; - - /* left hand side of A[ix] * B[iy] */ - tmpx = a->dp[ix]; - - /* alias to the address of where the digits will be stored */ - tmpt = &(t.dp[digs]); - - /* alias for where to read the right hand side from */ - tmpy = b->dp + (digs - ix); - - for (iy = digs - ix; iy < pb; iy++) { - /* calculate the double precision result */ - r = ((mp_word)*tmpt) + - ((mp_word)tmpx) * ((mp_word)*tmpy++) + - ((mp_word) u); - - /* get the lower part */ - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); - - /* carry the carry */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } - *tmpt = u; - } - mp_clamp (&t); - mp_exch (&t, c); - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_s_mp_mul_high_digs.c */ - -/* Start: bn_s_mp_sqr.c */ -#include -#ifdef BN_S_MP_SQR_C -/* 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@gmail.com, http://libtom.org - */ - -/* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */ -int s_mp_sqr (mp_int * a, mp_int * b) -{ - mp_int t; - int res, ix, iy, pa; - mp_word r; - mp_digit u, tmpx, *tmpt; - - pa = a->used; - if ((res = mp_init_size (&t, 2*pa + 1)) != MP_OKAY) { - return res; - } - - /* default used is maximum possible size */ - t.used = 2*pa + 1; - - for (ix = 0; ix < pa; ix++) { - /* first calculate the digit at 2*ix */ - /* calculate double precision result */ - r = ((mp_word) t.dp[2*ix]) + - ((mp_word)a->dp[ix])*((mp_word)a->dp[ix]); - - /* store lower part in result */ - t.dp[ix+ix] = (mp_digit) (r & ((mp_word) MP_MASK)); - - /* get the carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - - /* left hand side of A[ix] * A[iy] */ - tmpx = a->dp[ix]; - - /* alias for where to store the results */ - tmpt = t.dp + (2*ix + 1); - - for (iy = ix + 1; iy < pa; iy++) { - /* first calculate the product */ - r = ((mp_word)tmpx) * ((mp_word)a->dp[iy]); - - /* now calculate the double precision result, note we use - * addition instead of *2 since it's easier to optimize - */ - r = ((mp_word) *tmpt) + r + r + ((mp_word) u); - - /* store lower part */ - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); - - /* get carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - } - /* propagate upwards */ - while (u != ((mp_digit) 0)) { - r = ((mp_word) *tmpt) + ((mp_word) u); - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - } - } - - mp_clamp (&t); - mp_exch (&t, b); - mp_clear (&t); - return MP_OKAY; -} -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_s_mp_sqr.c */ - -/* Start: bn_s_mp_sub.c */ -#include -#ifdef BN_S_MP_SUB_C -/* 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@gmail.com, http://libtom.org - */ - -/* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ -int -s_mp_sub (mp_int * a, mp_int * b, mp_int * c) -{ - int olduse, res, min, max; - - /* find sizes */ - min = b->used; - max = a->used; - - /* init result */ - if (c->alloc < max) { - if ((res = mp_grow (c, max)) != MP_OKAY) { - return res; - } - } - olduse = c->used; - c->used = max; - - { - register mp_digit u, *tmpa, *tmpb, *tmpc; - register int i; - - /* alias for digit pointers */ - tmpa = a->dp; - tmpb = b->dp; - tmpc = c->dp; - - /* set carry to zero */ - u = 0; - for (i = 0; i < min; i++) { - /* T[i] = A[i] - B[i] - U */ - *tmpc = *tmpa++ - *tmpb++ - u; - - /* U = carry bit of T[i] - * Note this saves performing an AND operation since - * if a carry does occur it will propagate all the way to the - * MSB. As a result a single shift is enough to get the carry - */ - u = *tmpc >> ((mp_digit)(CHAR_BIT * sizeof (mp_digit) - 1)); - - /* Clear carry from T[i] */ - *tmpc++ &= MP_MASK; - } - - /* now copy higher words if any, e.g. if A has more digits than B */ - for (; i < max; i++) { - /* T[i] = A[i] - U */ - *tmpc = *tmpa++ - u; - - /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)(CHAR_BIT * sizeof (mp_digit) - 1)); - - /* Clear carry from T[i] */ - *tmpc++ &= MP_MASK; - } - - /* clear digits above used (since we may not have grown result above) */ - for (i = c->used; i < olduse; i++) { - *tmpc++ = 0; - } - } - - mp_clamp (c); - return MP_OKAY; -} - -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bn_s_mp_sub.c */ - -/* Start: bncore.c */ -#include -#ifdef BNCORE_C -/* 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@gmail.com, http://libtom.org - */ - -/* Known optimal configurations - - CPU /Compiler /MUL CUTOFF/SQR CUTOFF -------------------------------------------------------------- - Intel P4 Northwood /GCC v3.4.1 / 88/ 128/LTM 0.32 ;-) - AMD Athlon64 /GCC v3.4.4 / 80/ 120/LTM 0.35 - -*/ - -int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsuba multiplication is used. */ - KARATSUBA_SQR_CUTOFF = 120, /* Min. number of digits before Karatsuba squaring is used. */ - - TOOM_MUL_CUTOFF = 350, /* no optimal values of these are known yet so set em high */ - TOOM_SQR_CUTOFF = 400; -#endif - -/* $Source$ */ -/* $Revision$ */ -/* $Date$ */ - -/* End: bncore.c */ - - -/* EOF */ diff --git a/libtommath/pretty.build b/libtommath/pretty.build deleted file mode 100644 index a708b8a..0000000 --- a/libtommath/pretty.build +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/perl -w -# -# Cute little builder for perl -# Total waste of development time... -# -# This will build all the object files and then the archive .a file -# requires GCC, GNU make and a sense of humour. -# -# Tom St Denis -use strict; - -my $count = 0; -my $starttime = time; -my $rate = 0; -print "Scanning for source files...\n"; -foreach my $filename (glob "*.c") { - ++$count; -} -print "Source files to build: $count\nBuilding...\n"; -my $i = 0; -my $lines = 0; -my $filesbuilt = 0; -foreach my $filename (glob "*.c") { - printf("Building %3.2f%%, ", (++$i/$count)*100.0); - if ($i % 4 == 0) { print "/, "; } - if ($i % 4 == 1) { print "-, "; } - if ($i % 4 == 2) { print "\\, "; } - if ($i % 4 == 3) { print "|, "; } - if ($rate > 0) { - my $tleft = ($count - $i) / $rate; - my $tsec = $tleft%60; - my $tmin = ($tleft/60)%60; - my $thour = ($tleft/3600)%60; - printf("%2d:%02d:%02d left, ", $thour, $tmin, $tsec); - } - my $cnt = ($i/$count)*30.0; - my $x = 0; - print "["; - for (; $x < $cnt; $x++) { print "#"; } - for (; $x < 30; $x++) { print " "; } - print "]\r"; - my $tmp = $filename; - $tmp =~ s/\.c/".o"/ge; - if (open(SRC, "<$tmp")) { - close SRC; - } else { - !system("make $tmp > /dev/null 2>/dev/null") or die "\nERROR: Failed to make $tmp!!!\n"; - open( SRC, "<$filename" ) or die "Couldn't open $filename for reading: $!"; - ++$lines while (); - close SRC or die "Error closing $filename after reading: $!"; - ++$filesbuilt; - } - - # update timer - if (time != $starttime) { - my $delay = time - $starttime; - $rate = $i/$delay; - } -} - -# finish building the library -printf("\nFinished building source (%d seconds, %3.2f files per second).\n", time - $starttime, $rate); -print "Compiled approximately $filesbuilt files and $lines lines of code.\n"; -print "Doing final make (building archive...)\n"; -!system("make > /dev/null 2>/dev/null") or die "\nERROR: Failed to perform last make command!!!\n"; -print "done.\n"; \ No newline at end of file diff --git a/libtommath/testme.sh b/libtommath/testme.sh deleted file mode 100755 index 6324525..0000000 --- a/libtommath/testme.sh +++ /dev/null @@ -1,174 +0,0 @@ -#!/bin/bash -# -# return values of this script are: -# 0 success -# 128 a test failed -# >0 the number of timed-out tests - -set -e - -if [ -f /proc/cpuinfo ] -then - MAKE_JOBS=$(( ($(cat /proc/cpuinfo | grep -E '^processor[[:space:]]*:' | tail -n -1 | cut -d':' -f2) + 1) * 2 + 1 )) -else - MAKE_JOBS=8 -fi - -ret=0 -TEST_CFLAGS="" - -_help() -{ - echo "Usage options for $(basename $0) [--with-cc=arg [other options]]" - echo - echo "Executing this script without any parameter will only run the default configuration" - echo "that has automatically been determined for the architecture you're running." - echo - echo " --with-cc=* The compiler(s) to use for the tests" - echo " This is an option that will be iterated." - echo - echo "To be able to specify options a compiler has to be given." - echo "All options will be tested with all MP_xBIT configurations." - echo - echo " --with-{m64,m32,mx32} The architecture(s) to build and test for," - echo " e.g. --with-mx32." - echo " This is an option that will be iterated, multiple selections are possible." - echo " The mx32 architecture is not supported by clang and will not be executed." - echo - echo " --cflags=* Give an option to the compiler," - echo " e.g. --cflags=-g" - echo " This is an option that will always be passed as parameter to CC." - echo - echo " --make-option=* Give an option to make," - echo " e.g. --make-option=\"-f makefile.shared\"" - echo " This is an option that will always be passed as parameter to make." - echo - echo "Godmode:" - echo - echo " --all Choose all architectures and gcc and clang as compilers" - echo - echo " --help This message" - exit 0 -} - -_die() -{ - echo "error $2 while $1" - if [ "$2" != "124" ] - then - exit 128 - else - echo "assuming timeout while running test - continue" - ret=$(( $ret + 1 )) - fi -} - -_runtest() -{ - echo -ne " Compile $1 $2" - make clean > /dev/null - CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS test_standalone $MAKE_OPTIONS > /dev/null 2>test_errors.txt - echo -e "\rRun test $1 $2" - timeout --foreground 90 ./test > test_$(echo ${1}${2} | tr ' ' '_').txt || _die "running tests" $? -} - -_banner() -{ - echo "uname="$(uname -a) - [[ "$#" != "0" ]] && (echo $1=$($1 -dumpversion)) || true -} - -_exit() -{ - if [ "$ret" == "0" ] - then - echo "Tests successful" - else - echo "$ret tests timed out" - fi - - exit $ret -} - -ARCHFLAGS="" -COMPILERS="" -CFLAGS="" - -while [ $# -gt 0 ]; -do - case $1 in - "--with-m64" | "--with-m32" | "--with-mx32") - ARCHFLAGS="$ARCHFLAGS ${1:6}" - ;; - --with-cc=*) - COMPILERS="$COMPILERS ${1#*=}" - ;; - --cflags=*) - CFLAGS="$CFLAGS ${1#*=}" - ;; - --make-option=*) - MAKE_OPTIONS="$MAKE_OPTIONS ${1#*=}" - ;; - --all) - COMPILERS="gcc clang" - ARCHFLAGS="-m64 -m32 -mx32" - ;; - --help) - _help - ;; - esac - shift -done - -# default to gcc if nothing is given -if [[ "$COMPILERS" == "" ]] -then - _banner gcc - _runtest "gcc" "" - _exit -fi - -archflags=( $ARCHFLAGS ) -compilers=( $COMPILERS ) - -# choosing a compiler without specifying an architecture will use the default architecture -if [ "${#archflags[@]}" == "0" ] -then - archflags[0]=" " -fi - -_banner - -for i in "${compilers[@]}" -do - if [ -z "$(which $i)" ] - then - echo "Skipped compiler $i, file not found" - continue - fi - compiler_version=$(echo "$i="$($i -dumpversion)) - if [ "$compiler_version" == "clang=4.2.1" ] - then - # one of my versions of clang complains about some stuff in stdio.h and stdarg.h ... - TEST_CFLAGS="-Wno-typedef-redefinition" - else - TEST_CFLAGS="" - fi - echo $compiler_version - - for a in "${archflags[@]}" - do - if [[ $(expr "$i" : "clang") && "$a" == "-mx32" ]] - then - echo "clang -mx32 tests skipped" - continue - fi - - _runtest "$i $a" "" - _runtest "$i $a" "-DMP_8BIT" - _runtest "$i $a" "-DMP_16BIT" - _runtest "$i $a" "-DMP_32BIT" - done -done - -_exit diff --git a/libtommath/tombc/grammar.txt b/libtommath/tombc/grammar.txt deleted file mode 100644 index a780e75..0000000 --- a/libtommath/tombc/grammar.txt +++ /dev/null @@ -1,35 +0,0 @@ -program := program statement | statement | empty -statement := { statement } | - identifier = numexpression; | - identifier[numexpression] = numexpression; | - function(expressionlist); | - for (identifer = numexpression; numexpression; identifier = numexpression) { statement } | - while (numexpression) { statement } | - if (numexpresion) { statement } elif | - break; | - continue; - -elif := else statement | empty -function := abs | countbits | exptmod | jacobi | print | isprime | nextprime | issquare | readinteger | exit -expressionlist := expressionlist, expression | expression - -// LR(1) !!!? -expression := string | numexpression -numexpression := cmpexpr && cmpexpr | cmpexpr \|\| cmpexpr | cmpexpr -cmpexpr := boolexpr < boolexpr | boolexpr > boolexpr | boolexpr == boolexpr | - boolexpr <= boolexpr | boolexpr >= boolexpr | boolexpr -boolexpr := shiftexpr & shiftexpr | shiftexpr ^ shiftexpr | shiftexpr \| shiftexpr | shiftexpr -shiftexpr := addsubexpr << addsubexpr | addsubexpr >> addsubexpr | addsubexpr -addsubexpr := mulexpr + mulexpr | mulexpr - mulexpr | mulexpr -mulexpr := expr * expr | expr / expr | expr % expr | expr -expr := -nexpr | nexpr -nexpr := integer | identifier | ( numexpression ) | identifier[numexpression] - -identifier := identifer digits | identifier alpha | alpha -alpha := a ... z | A ... Z -integer := hexnumber | digits -hexnumber := 0xhexdigits -hexdigits := hexdigits hexdigit | hexdigit -hexdigit := 0 ... 9 | a ... f | A ... F -digits := digits digit | digit -digit := 0 ... 9 diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 4547488..fc6b409 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -203,7 +203,7 @@ 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] & 1u) == 0u)) ? MP_YES : MP_NO) +#define mp_iseven(a) ((((a)->used == 0) || (((a)->dp[0] & 1u) == 0u)) ? MP_YES : MP_NO) #define mp_isodd(a) ((((a)->used > 0) && (((a)->dp[0] & 1u) == 1u)) ? MP_YES : MP_NO) #define mp_isneg(a) (((a)->sign != MP_ZPOS) ? MP_YES : MP_NO) diff --git a/libtommath/tommath.out b/libtommath/tommath.out deleted file mode 100644 index de4aada..0000000 --- a/libtommath/tommath.out +++ /dev/null @@ -1,139 +0,0 @@ -\BOOKMARK [0][-]{chapter.1}{Introduction}{}% 1 -\BOOKMARK [1][-]{section.1.1}{Multiple Precision Arithmetic}{chapter.1}% 2 -\BOOKMARK [2][-]{subsection.1.1.1}{What is Multiple Precision Arithmetic?}{section.1.1}% 3 -\BOOKMARK [2][-]{subsection.1.1.2}{The Need for Multiple Precision Arithmetic}{section.1.1}% 4 -\BOOKMARK [2][-]{subsection.1.1.3}{Benefits of Multiple Precision Arithmetic}{section.1.1}% 5 -\BOOKMARK [1][-]{section.1.2}{Purpose of This Text}{chapter.1}% 6 -\BOOKMARK [1][-]{section.1.3}{Discussion and Notation}{chapter.1}% 7 -\BOOKMARK [2][-]{subsection.1.3.1}{Notation}{section.1.3}% 8 -\BOOKMARK [2][-]{subsection.1.3.2}{Precision Notation}{section.1.3}% 9 -\BOOKMARK [2][-]{subsection.1.3.3}{Algorithm Inputs and Outputs}{section.1.3}% 10 -\BOOKMARK [2][-]{subsection.1.3.4}{Mathematical Expressions}{section.1.3}% 11 -\BOOKMARK [2][-]{subsection.1.3.5}{Work Effort}{section.1.3}% 12 -\BOOKMARK [1][-]{section.1.4}{Exercises}{chapter.1}% 13 -\BOOKMARK [1][-]{section.1.5}{Introduction to LibTomMath}{chapter.1}% 14 -\BOOKMARK [2][-]{subsection.1.5.1}{What is LibTomMath?}{section.1.5}% 15 -\BOOKMARK [2][-]{subsection.1.5.2}{Goals of LibTomMath}{section.1.5}% 16 -\BOOKMARK [1][-]{section.1.6}{Choice of LibTomMath}{chapter.1}% 17 -\BOOKMARK [2][-]{subsection.1.6.1}{Code Base}{section.1.6}% 18 -\BOOKMARK [2][-]{subsection.1.6.2}{API Simplicity}{section.1.6}% 19 -\BOOKMARK [2][-]{subsection.1.6.3}{Optimizations}{section.1.6}% 20 -\BOOKMARK [2][-]{subsection.1.6.4}{Portability and Stability}{section.1.6}% 21 -\BOOKMARK [2][-]{subsection.1.6.5}{Choice}{section.1.6}% 22 -\BOOKMARK [0][-]{chapter.2}{Getting Started}{}% 23 -\BOOKMARK [1][-]{section.2.1}{Library Basics}{chapter.2}% 24 -\BOOKMARK [1][-]{section.2.2}{What is a Multiple Precision Integer?}{chapter.2}% 25 -\BOOKMARK [2][-]{subsection.2.2.1}{The mp\137int Structure}{section.2.2}% 26 -\BOOKMARK [1][-]{section.2.3}{Argument Passing}{chapter.2}% 27 -\BOOKMARK [1][-]{section.2.4}{Return Values}{chapter.2}% 28 -\BOOKMARK [1][-]{section.2.5}{Initialization and Clearing}{chapter.2}% 29 -\BOOKMARK [2][-]{subsection.2.5.1}{Initializing an mp\137int}{section.2.5}% 30 -\BOOKMARK [2][-]{subsection.2.5.2}{Clearing an mp\137int}{section.2.5}% 31 -\BOOKMARK [1][-]{section.2.6}{Maintenance Algorithms}{chapter.2}% 32 -\BOOKMARK [2][-]{subsection.2.6.1}{Augmenting an mp\137int's Precision}{section.2.6}% 33 -\BOOKMARK [2][-]{subsection.2.6.2}{Initializing Variable Precision mp\137ints}{section.2.6}% 34 -\BOOKMARK [2][-]{subsection.2.6.3}{Multiple Integer Initializations and Clearings}{section.2.6}% 35 -\BOOKMARK [2][-]{subsection.2.6.4}{Clamping Excess Digits}{section.2.6}% 36 -\BOOKMARK [0][-]{chapter.3}{Basic Operations}{}% 37 -\BOOKMARK [1][-]{section.3.1}{Introduction}{chapter.3}% 38 -\BOOKMARK [1][-]{section.3.2}{Assigning Values to mp\137int Structures}{chapter.3}% 39 -\BOOKMARK [2][-]{subsection.3.2.1}{Copying an mp\137int}{section.3.2}% 40 -\BOOKMARK [2][-]{subsection.3.2.2}{Creating a Clone}{section.3.2}% 41 -\BOOKMARK [1][-]{section.3.3}{Zeroing an Integer}{chapter.3}% 42 -\BOOKMARK [1][-]{section.3.4}{Sign Manipulation}{chapter.3}% 43 -\BOOKMARK [2][-]{subsection.3.4.1}{Absolute Value}{section.3.4}% 44 -\BOOKMARK [2][-]{subsection.3.4.2}{Integer Negation}{section.3.4}% 45 -\BOOKMARK [1][-]{section.3.5}{Small Constants}{chapter.3}% 46 -\BOOKMARK [2][-]{subsection.3.5.1}{Setting Small Constants}{section.3.5}% 47 -\BOOKMARK [2][-]{subsection.3.5.2}{Setting Large Constants}{section.3.5}% 48 -\BOOKMARK [1][-]{section.3.6}{Comparisons}{chapter.3}% 49 -\BOOKMARK [2][-]{subsection.3.6.1}{Unsigned Comparisions}{section.3.6}% 50 -\BOOKMARK [2][-]{subsection.3.6.2}{Signed Comparisons}{section.3.6}% 51 -\BOOKMARK [0][-]{chapter.4}{Basic Arithmetic}{}% 52 -\BOOKMARK [1][-]{section.4.1}{Introduction}{chapter.4}% 53 -\BOOKMARK [1][-]{section.4.2}{Addition and Subtraction}{chapter.4}% 54 -\BOOKMARK [2][-]{subsection.4.2.1}{Low Level Addition}{section.4.2}% 55 -\BOOKMARK [2][-]{subsection.4.2.2}{Low Level Subtraction}{section.4.2}% 56 -\BOOKMARK [2][-]{subsection.4.2.3}{High Level Addition}{section.4.2}% 57 -\BOOKMARK [2][-]{subsection.4.2.4}{High Level Subtraction}{section.4.2}% 58 -\BOOKMARK [1][-]{section.4.3}{Bit and Digit Shifting}{chapter.4}% 59 -\BOOKMARK [2][-]{subsection.4.3.1}{Multiplication by Two}{section.4.3}% 60 -\BOOKMARK [2][-]{subsection.4.3.2}{Division by Two}{section.4.3}% 61 -\BOOKMARK [1][-]{section.4.4}{Polynomial Basis Operations}{chapter.4}% 62 -\BOOKMARK [2][-]{subsection.4.4.1}{Multiplication by x}{section.4.4}% 63 -\BOOKMARK [2][-]{subsection.4.4.2}{Division by x}{section.4.4}% 64 -\BOOKMARK [1][-]{section.4.5}{Powers of Two}{chapter.4}% 65 -\BOOKMARK [2][-]{subsection.4.5.1}{Multiplication by Power of Two}{section.4.5}% 66 -\BOOKMARK [2][-]{subsection.4.5.2}{Division by Power of Two}{section.4.5}% 67 -\BOOKMARK [2][-]{subsection.4.5.3}{Remainder of Division by Power of Two}{section.4.5}% 68 -\BOOKMARK [0][-]{chapter.5}{Multiplication and Squaring}{}% 69 -\BOOKMARK [1][-]{section.5.1}{The Multipliers}{chapter.5}% 70 -\BOOKMARK [1][-]{section.5.2}{Multiplication}{chapter.5}% 71 -\BOOKMARK [2][-]{subsection.5.2.1}{The Baseline Multiplication}{section.5.2}% 72 -\BOOKMARK [2][-]{subsection.5.2.2}{Faster Multiplication by the ``Comba'' Method}{section.5.2}% 73 -\BOOKMARK [2][-]{subsection.5.2.3}{Polynomial Basis Multiplication}{section.5.2}% 74 -\BOOKMARK [2][-]{subsection.5.2.4}{Karatsuba Multiplication}{section.5.2}% 75 -\BOOKMARK [2][-]{subsection.5.2.5}{Toom-Cook 3-Way Multiplication}{section.5.2}% 76 -\BOOKMARK [2][-]{subsection.5.2.6}{Signed Multiplication}{section.5.2}% 77 -\BOOKMARK [1][-]{section.5.3}{Squaring}{chapter.5}% 78 -\BOOKMARK [2][-]{subsection.5.3.1}{The Baseline Squaring Algorithm}{section.5.3}% 79 -\BOOKMARK [2][-]{subsection.5.3.2}{Faster Squaring by the ``Comba'' Method}{section.5.3}% 80 -\BOOKMARK [2][-]{subsection.5.3.3}{Polynomial Basis Squaring}{section.5.3}% 81 -\BOOKMARK [2][-]{subsection.5.3.4}{Karatsuba Squaring}{section.5.3}% 82 -\BOOKMARK [2][-]{subsection.5.3.5}{Toom-Cook Squaring}{section.5.3}% 83 -\BOOKMARK [2][-]{subsection.5.3.6}{High Level Squaring}{section.5.3}% 84 -\BOOKMARK [0][-]{chapter.6}{Modular Reduction}{}% 85 -\BOOKMARK [1][-]{section.6.1}{Basics of Modular Reduction}{chapter.6}% 86 -\BOOKMARK [1][-]{section.6.2}{The Barrett Reduction}{chapter.6}% 87 -\BOOKMARK [2][-]{subsection.6.2.1}{Fixed Point Arithmetic}{section.6.2}% 88 -\BOOKMARK [2][-]{subsection.6.2.2}{Choosing a Radix Point}{section.6.2}% 89 -\BOOKMARK [2][-]{subsection.6.2.3}{Trimming the Quotient}{section.6.2}% 90 -\BOOKMARK [2][-]{subsection.6.2.4}{Trimming the Residue}{section.6.2}% 91 -\BOOKMARK [2][-]{subsection.6.2.5}{The Barrett Algorithm}{section.6.2}% 92 -\BOOKMARK [2][-]{subsection.6.2.6}{The Barrett Setup Algorithm}{section.6.2}% 93 -\BOOKMARK [1][-]{section.6.3}{The Montgomery Reduction}{chapter.6}% 94 -\BOOKMARK [2][-]{subsection.6.3.1}{Digit Based Montgomery Reduction}{section.6.3}% 95 -\BOOKMARK [2][-]{subsection.6.3.2}{Baseline Montgomery Reduction}{section.6.3}% 96 -\BOOKMARK [2][-]{subsection.6.3.3}{Faster ``Comba'' Montgomery Reduction}{section.6.3}% 97 -\BOOKMARK [2][-]{subsection.6.3.4}{Montgomery Setup}{section.6.3}% 98 -\BOOKMARK [1][-]{section.6.4}{The Diminished Radix Algorithm}{chapter.6}% 99 -\BOOKMARK [2][-]{subsection.6.4.1}{Choice of Moduli}{section.6.4}% 100 -\BOOKMARK [2][-]{subsection.6.4.2}{Choice of k}{section.6.4}% 101 -\BOOKMARK [2][-]{subsection.6.4.3}{Restricted Diminished Radix Reduction}{section.6.4}% 102 -\BOOKMARK [2][-]{subsection.6.4.4}{Unrestricted Diminished Radix Reduction}{section.6.4}% 103 -\BOOKMARK [1][-]{section.6.5}{Algorithm Comparison}{chapter.6}% 104 -\BOOKMARK [0][-]{chapter.7}{Exponentiation}{}% 105 -\BOOKMARK [1][-]{section.7.1}{Exponentiation Basics}{chapter.7}% 106 -\BOOKMARK [2][-]{subsection.7.1.1}{Single Digit Exponentiation}{section.7.1}% 107 -\BOOKMARK [1][-]{section.7.2}{k-ary Exponentiation}{chapter.7}% 108 -\BOOKMARK [2][-]{subsection.7.2.1}{Optimal Values of k}{section.7.2}% 109 -\BOOKMARK [2][-]{subsection.7.2.2}{Sliding-Window Exponentiation}{section.7.2}% 110 -\BOOKMARK [1][-]{section.7.3}{Modular Exponentiation}{chapter.7}% 111 -\BOOKMARK [2][-]{subsection.7.3.1}{Barrett Modular Exponentiation}{section.7.3}% 112 -\BOOKMARK [1][-]{section.7.4}{Quick Power of Two}{chapter.7}% 113 -\BOOKMARK [0][-]{chapter.8}{Higher Level Algorithms}{}% 114 -\BOOKMARK [1][-]{section.8.1}{Integer Division with Remainder}{chapter.8}% 115 -\BOOKMARK [2][-]{subsection.8.1.1}{Quotient Estimation}{section.8.1}% 116 -\BOOKMARK [2][-]{subsection.8.1.2}{Normalized Integers}{section.8.1}% 117 -\BOOKMARK [2][-]{subsection.8.1.3}{Radix- Division with Remainder}{section.8.1}% 118 -\BOOKMARK [1][-]{section.8.2}{Single Digit Helpers}{chapter.8}% 119 -\BOOKMARK [2][-]{subsection.8.2.1}{Single Digit Addition and Subtraction}{section.8.2}% 120 -\BOOKMARK [2][-]{subsection.8.2.2}{Single Digit Multiplication}{section.8.2}% 121 -\BOOKMARK [2][-]{subsection.8.2.3}{Single Digit Division}{section.8.2}% 122 -\BOOKMARK [2][-]{subsection.8.2.4}{Single Digit Root Extraction}{section.8.2}% 123 -\BOOKMARK [1][-]{section.8.3}{Random Number Generation}{chapter.8}% 124 -\BOOKMARK [1][-]{section.8.4}{Formatted Representations}{chapter.8}% 125 -\BOOKMARK [2][-]{subsection.8.4.1}{Reading Radix-n Input}{section.8.4}% 126 -\BOOKMARK [2][-]{subsection.8.4.2}{Generating Radix-n Output}{section.8.4}% 127 -\BOOKMARK [0][-]{chapter.9}{Number Theoretic Algorithms}{}% 128 -\BOOKMARK [1][-]{section.9.1}{Greatest Common Divisor}{chapter.9}% 129 -\BOOKMARK [2][-]{subsection.9.1.1}{Complete Greatest Common Divisor}{section.9.1}% 130 -\BOOKMARK [1][-]{section.9.2}{Least Common Multiple}{chapter.9}% 131 -\BOOKMARK [1][-]{section.9.3}{Jacobi Symbol Computation}{chapter.9}% 132 -\BOOKMARK [2][-]{subsection.9.3.1}{Jacobi Symbol}{section.9.3}% 133 -\BOOKMARK [1][-]{section.9.4}{Modular Inverse}{chapter.9}% 134 -\BOOKMARK [2][-]{subsection.9.4.1}{General Case}{section.9.4}% 135 -\BOOKMARK [1][-]{section.9.5}{Primality Tests}{chapter.9}% 136 -\BOOKMARK [2][-]{subsection.9.5.1}{Trial Division}{section.9.5}% 137 -\BOOKMARK [2][-]{subsection.9.5.2}{The Fermat Test}{section.9.5}% 138 -\BOOKMARK [2][-]{subsection.9.5.3}{The Miller-Rabin Test}{section.9.5}% 139 diff --git a/libtommath/tommath.pdf b/libtommath/tommath.pdf deleted file mode 100644 index 6a6787e..0000000 Binary files a/libtommath/tommath.pdf and /dev/null differ diff --git a/libtommath/tommath.src b/libtommath/tommath.src deleted file mode 100644 index 768ed10..0000000 --- a/libtommath/tommath.src +++ /dev/null @@ -1,6339 +0,0 @@ -\documentclass[b5paper]{book} -\usepackage{hyperref} -\usepackage{makeidx} -\usepackage{amssymb} -\usepackage{color} -\usepackage{alltt} -\usepackage{graphicx} -\usepackage{layout} -\def\union{\cup} -\def\intersect{\cap} -\def\getsrandom{\stackrel{\rm R}{\gets}} -\def\cross{\times} -\def\cat{\hspace{0.5em} \| \hspace{0.5em}} -\def\catn{$\|$} -\def\divides{\hspace{0.3em} | \hspace{0.3em}} -\def\nequiv{\not\equiv} -\def\approx{\raisebox{0.2ex}{\mbox{\small $\sim$}}} -\def\lcm{{\rm lcm}} -\def\gcd{{\rm gcd}} -\def\log{{\rm log}} -\def\ord{{\rm ord}} -\def\abs{{\mathit abs}} -\def\rep{{\mathit rep}} -\def\mod{{\mathit\ mod\ }} -\renewcommand{\pmod}[1]{\ ({\rm mod\ }{#1})} -\newcommand{\floor}[1]{\left\lfloor{#1}\right\rfloor} -\newcommand{\ceil}[1]{\left\lceil{#1}\right\rceil} -\def\Or{{\rm\ or\ }} -\def\And{{\rm\ and\ }} -\def\iff{\hspace{1em}\Longleftrightarrow\hspace{1em}} -\def\implies{\Rightarrow} -\def\undefined{{\rm ``undefined"}} -\def\Proof{\vspace{1ex}\noindent {\bf Proof:}\hspace{1em}} -\let\oldphi\phi -\def\phi{\varphi} -\def\Pr{{\rm Pr}} -\newcommand{\str}[1]{{\mathbf{#1}}} -\def\F{{\mathbb F}} -\def\N{{\mathbb N}} -\def\Z{{\mathbb Z}} -\def\R{{\mathbb R}} -\def\C{{\mathbb C}} -\def\Q{{\mathbb Q}} -\definecolor{DGray}{gray}{0.5} -\newcommand{\emailaddr}[1]{\mbox{$<${#1}$>$}} -\def\twiddle{\raisebox{0.3ex}{\mbox{\tiny $\sim$}}} -\def\gap{\vspace{0.5ex}} -\makeindex -\begin{document} -\frontmatter -\pagestyle{empty} -\title{Multi--Precision Math} -\author{\mbox{ -%\begin{small} -\begin{tabular}{c} -Tom St Denis \\ -Algonquin College \\ -\\ -Mads Rasmussen \\ -Open Communications Security \\ -\\ -Greg Rose \\ -QUALCOMM Australia \\ -\end{tabular} -%\end{small} -} -} -\maketitle -This text has been placed in the public domain. This text corresponds to the v0.39 release of the -LibTomMath project. - -This text is formatted to the international B5 paper size of 176mm wide by 250mm tall using the \LaTeX{} -{\em book} macro package and the Perl {\em booker} package. - -\tableofcontents -\listoffigures -\chapter*{Prefaces} -When I tell people about my LibTom projects and that I release them as public domain they are often puzzled. -They ask why I did it and especially why I continue to work on them for free. The best I can explain it is ``Because I can.'' -Which seems odd and perhaps too terse for adult conversation. I often qualify it with ``I am able, I am willing.'' which -perhaps explains it better. I am the first to admit there is not anything that special with what I have done. Perhaps -others can see that too and then we would have a society to be proud of. My LibTom projects are what I am doing to give -back to society in the form of tools and knowledge that can help others in their endeavours. - -I started writing this book because it was the most logical task to further my goal of open academia. The LibTomMath source -code itself was written to be easy to follow and learn from. There are times, however, where pure C source code does not -explain the algorithms properly. Hence this book. The book literally starts with the foundation of the library and works -itself outwards to the more complicated algorithms. The use of both pseudo--code and verbatim source code provides a duality -of ``theory'' and ``practice'' that the computer science students of the world shall appreciate. I never deviate too far -from relatively straightforward algebra and I hope that this book can be a valuable learning asset. - -This book and indeed much of the LibTom projects would not exist in their current form if it was not for a plethora -of kind people donating their time, resources and kind words to help support my work. Writing a text of significant -length (along with the source code) is a tiresome and lengthy process. Currently the LibTom project is four years old, -comprises of literally thousands of users and over 100,000 lines of source code, TeX and other material. People like Mads and Greg -were there at the beginning to encourage me to work well. It is amazing how timely validation from others can boost morale to -continue the project. Definitely my parents were there for me by providing room and board during the many months of work in 2003. - -To my many friends whom I have met through the years I thank you for the good times and the words of encouragement. I hope I -honour your kind gestures with this project. - -Open Source. Open Academia. Open Minds. - -\begin{flushright} Tom St Denis \end{flushright} - -\newpage -I found the opportunity to work with Tom appealing for several reasons, not only could I broaden my own horizons, but also -contribute to educate others facing the problem of having to handle big number mathematical calculations. - -This book is Tom's child and he has been caring and fostering the project ever since the beginning with a clear mind of -how he wanted the project to turn out. I have helped by proofreading the text and we have had several discussions about -the layout and language used. - -I hold a masters degree in cryptography from the University of Southern Denmark and have always been interested in the -practical aspects of cryptography. - -Having worked in the security consultancy business for several years in S\~{a}o Paulo, Brazil, I have been in touch with a -great deal of work in which multiple precision mathematics was needed. Understanding the possibilities for speeding up -multiple precision calculations is often very important since we deal with outdated machine architecture where modular -reductions, for example, become painfully slow. - -This text is for people who stop and wonder when first examining algorithms such as RSA for the first time and asks -themselves, ``You tell me this is only secure for large numbers, fine; but how do you implement these numbers?'' - -\begin{flushright} -Mads Rasmussen - -S\~{a}o Paulo - SP - -Brazil -\end{flushright} - -\newpage -It's all because I broke my leg. That just happened to be at about the same time that Tom asked for someone to review the section of the book about -Karatsuba multiplication. I was laid up, alone and immobile, and thought ``Why not?'' I vaguely knew what Karatsuba multiplication was, but not -really, so I thought I could help, learn, and stop myself from watching daytime cable TV, all at once. - -At the time of writing this, I've still not met Tom or Mads in meatspace. I've been following Tom's progress since his first splash on the -sci.crypt Usenet news group. I watched him go from a clueless newbie, to the cryptographic equivalent of a reformed smoker, to a real -contributor to the field, over a period of about two years. I've been impressed with his obvious intelligence, and astounded by his productivity. -Of course, he's young enough to be my own child, so he doesn't have my problems with staying awake. - -When I reviewed that single section of the book, in its very earliest form, I was very pleasantly surprised. So I decided to collaborate more fully, -and at least review all of it, and perhaps write some bits too. There's still a long way to go with it, and I have watched a number of close -friends go through the mill of publication, so I think that the way to go is longer than Tom thinks it is. Nevertheless, it's a good effort, -and I'm pleased to be involved with it. - -\begin{flushright} -Greg Rose, Sydney, Australia, June 2003. -\end{flushright} - -\mainmatter -\pagestyle{headings} -\chapter{Introduction} -\section{Multiple Precision Arithmetic} - -\subsection{What is Multiple Precision Arithmetic?} -When we think of long-hand arithmetic such as addition or multiplication we rarely consider the fact that we instinctively -raise or lower the precision of the numbers we are dealing with. For example, in decimal we almost immediate can -reason that $7$ times $6$ is $42$. However, $42$ has two digits of precision as opposed to one digit we started with. -Further multiplications of say $3$ result in a larger precision result $126$. In these few examples we have multiple -precisions for the numbers we are working with. Despite the various levels of precision a single subset\footnote{With the occasional optimization.} - of algorithms can be designed to accomodate them. - -By way of comparison a fixed or single precision operation would lose precision on various operations. For example, in -the decimal system with fixed precision $6 \cdot 7 = 2$. - -Essentially at the heart of computer based multiple precision arithmetic are the same long-hand algorithms taught in -schools to manually add, subtract, multiply and divide. - -\subsection{The Need for Multiple Precision Arithmetic} -The most prevalent need for multiple precision arithmetic, often referred to as ``bignum'' math, is within the implementation -of public-key cryptography algorithms. Algorithms such as RSA \cite{RSAREF} and Diffie-Hellman \cite{DHREF} require -integers of significant magnitude to resist known cryptanalytic attacks. For example, at the time of this writing a -typical RSA modulus would be at least greater than $10^{309}$. However, modern programming languages such as ISO C \cite{ISOC} and -Java \cite{JAVA} only provide instrinsic support for integers which are relatively small and single precision. - -\begin{figure}[!here] -\begin{center} -\begin{tabular}{|r|c|} -\hline \textbf{Data Type} & \textbf{Range} \\ -\hline char & $-128 \ldots 127$ \\ -\hline short & $-32768 \ldots 32767$ \\ -\hline long & $-2147483648 \ldots 2147483647$ \\ -\hline long long & $-9223372036854775808 \ldots 9223372036854775807$ \\ -\hline -\end{tabular} -\end{center} -\caption{Typical Data Types for the C Programming Language} -\label{fig:ISOC} -\end{figure} - -The largest data type guaranteed to be provided by the ISO C programming -language\footnote{As per the ISO C standard. However, each compiler vendor is allowed to augment the precision as they -see fit.} can only represent values up to $10^{19}$ as shown in figure \ref{fig:ISOC}. On its own the C language is -insufficient to accomodate the magnitude required for the problem at hand. An RSA modulus of magnitude $10^{19}$ could be -trivially factored\footnote{A Pollard-Rho factoring would take only $2^{16}$ time.} on the average desktop computer, -rendering any protocol based on the algorithm insecure. Multiple precision algorithms solve this very problem by -extending the range of representable integers while using single precision data types. - -Most advancements in fast multiple precision arithmetic stem from the need for faster and more efficient cryptographic -primitives. Faster modular reduction and exponentiation algorithms such as Barrett's algorithm, which have appeared in -various cryptographic journals, can render algorithms such as RSA and Diffie-Hellman more efficient. In fact, several -major companies such as RSA Security, Certicom and Entrust have built entire product lines on the implementation and -deployment of efficient algorithms. - -However, cryptography is not the only field of study that can benefit from fast multiple precision integer routines. -Another auxiliary use of multiple precision integers is high precision floating point data types. -The basic IEEE \cite{IEEE} standard floating point type is made up of an integer mantissa $q$, an exponent $e$ and a sign bit $s$. -Numbers are given in the form $n = q \cdot b^e \cdot -1^s$ where $b = 2$ is the most common base for IEEE. Since IEEE -floating point is meant to be implemented in hardware the precision of the mantissa is often fairly small -(\textit{23, 48 and 64 bits}). The mantissa is merely an integer and a multiple precision integer could be used to create -a mantissa of much larger precision than hardware alone can efficiently support. This approach could be useful where -scientific applications must minimize the total output error over long calculations. - -Yet another use for large integers is within arithmetic on polynomials of large characteristic (i.e. $GF(p)[x]$ for large $p$). -In fact the library discussed within this text has already been used to form a polynomial basis library\footnote{See \url{http://poly.libtomcrypt.org} for more details.}. - -\subsection{Benefits of Multiple Precision Arithmetic} -\index{precision} -The benefit of multiple precision representations over single or fixed precision representations is that -no precision is lost while representing the result of an operation which requires excess precision. For example, -the product of two $n$-bit integers requires at least $2n$ bits of precision to be represented faithfully. A multiple -precision algorithm would augment the precision of the destination to accomodate the result while a single precision system -would truncate excess bits to maintain a fixed level of precision. - -It is possible to implement algorithms which require large integers with fixed precision algorithms. For example, elliptic -curve cryptography (\textit{ECC}) is often implemented on smartcards by fixing the precision of the integers to the maximum -size the system will ever need. Such an approach can lead to vastly simpler algorithms which can accomodate the -integers required even if the host platform cannot natively accomodate them\footnote{For example, the average smartcard -processor has an 8 bit accumulator.}. However, as efficient as such an approach may be, the resulting source code is not -normally very flexible. It cannot, at runtime, accomodate inputs of higher magnitude than the designer anticipated. - -Multiple precision algorithms have the most overhead of any style of arithmetic. For the the most part the -overhead can be kept to a minimum with careful planning, but overall, it is not well suited for most memory starved -platforms. However, multiple precision algorithms do offer the most flexibility in terms of the magnitude of the -inputs. That is, the same algorithms based on multiple precision integers can accomodate any reasonable size input -without the designer's explicit forethought. This leads to lower cost of ownership for the code as it only has to -be written and tested once. - -\section{Purpose of This Text} -The purpose of this text is to instruct the reader regarding how to implement efficient multiple precision algorithms. -That is to not only explain a limited subset of the core theory behind the algorithms but also the various ``house keeping'' -elements that are neglected by authors of other texts on the subject. Several well reknowned texts \cite{TAOCPV2,HAC} -give considerably detailed explanations of the theoretical aspects of algorithms and often very little information -regarding the practical implementation aspects. - -In most cases how an algorithm is explained and how it is actually implemented are two very different concepts. For -example, the Handbook of Applied Cryptography (\textit{HAC}), algorithm 14.7 on page 594, gives a relatively simple -algorithm for performing multiple precision integer addition. However, the description lacks any discussion concerning -the fact that the two integer inputs may be of differing magnitudes. As a result the implementation is not as simple -as the text would lead people to believe. Similarly the division routine (\textit{algorithm 14.20, pp. 598}) does not -discuss how to handle sign or handle the dividend's decreasing magnitude in the main loop (\textit{step \#3}). - -Both texts also do not discuss several key optimal algorithms required such as ``Comba'' and Karatsuba multipliers -and fast modular inversion, which we consider practical oversights. These optimal algorithms are vital to achieve -any form of useful performance in non-trivial applications. - -To solve this problem the focus of this text is on the practical aspects of implementing a multiple precision integer -package. As a case study the ``LibTomMath''\footnote{Available at \url{http://math.libtomcrypt.com}} package is used -to demonstrate algorithms with real implementations\footnote{In the ISO C programming language.} that have been field -tested and work very well. The LibTomMath library is freely available on the Internet for all uses and this text -discusses a very large portion of the inner workings of the library. - -The algorithms that are presented will always include at least one ``pseudo-code'' description followed -by the actual C source code that implements the algorithm. The pseudo-code can be used to implement the same -algorithm in other programming languages as the reader sees fit. - -This text shall also serve as a walkthrough of the creation of multiple precision algorithms from scratch. Showing -the reader how the algorithms fit together as well as where to start on various taskings. - -\section{Discussion and Notation} -\subsection{Notation} -A multiple precision integer of $n$-digits shall be denoted as $x = (x_{n-1}, \ldots, x_1, x_0)_{ \beta }$ and represent -the integer $x \equiv \sum_{i=0}^{n-1} x_i\beta^i$. The elements of the array $x$ are said to be the radix $\beta$ digits -of the integer. For example, $x = (1,2,3)_{10}$ would represent the integer -$1\cdot 10^2 + 2\cdot10^1 + 3\cdot10^0 = 123$. - -\index{mp\_int} -The term ``mp\_int'' shall refer to a composite structure which contains the digits of the integer it represents, as well -as auxilary data required to manipulate the data. These additional members are discussed further in section -\ref{sec:MPINT}. For the purposes of this text a ``multiple precision integer'' and an ``mp\_int'' are assumed to be -synonymous. When an algorithm is specified to accept an mp\_int variable it is assumed the various auxliary data members -are present as well. An expression of the type \textit{variablename.item} implies that it should evaluate to the -member named ``item'' of the variable. For example, a string of characters may have a member ``length'' which would -evaluate to the number of characters in the string. If the string $a$ equals ``hello'' then it follows that -$a.length = 5$. - -For certain discussions more generic algorithms are presented to help the reader understand the final algorithm used -to solve a given problem. When an algorithm is described as accepting an integer input it is assumed the input is -a plain integer with no additional multiple-precision members. That is, algorithms that use integers as opposed to -mp\_ints as inputs do not concern themselves with the housekeeping operations required such as memory management. These -algorithms will be used to establish the relevant theory which will subsequently be used to describe a multiple -precision algorithm to solve the same problem. - -\subsection{Precision Notation} -The variable $\beta$ represents the radix of a single digit of a multiple precision integer and -must be of the form $q^p$ for $q, p \in \Z^+$. A single precision variable must be able to represent integers in -the range $0 \le x < q \beta$ while a double precision variable must be able to represent integers in the range -$0 \le x < q \beta^2$. The extra radix-$q$ factor allows additions and subtractions to proceed without truncation of the -carry. Since all modern computers are binary, it is assumed that $q$ is two. - -\index{mp\_digit} \index{mp\_word} -Within the source code that will be presented for each algorithm, the data type \textbf{mp\_digit} will represent -a single precision integer type, while, the data type \textbf{mp\_word} will represent a double precision integer type. In -several algorithms (notably the Comba routines) temporary results will be stored in arrays of double precision mp\_words. -For the purposes of this text $x_j$ will refer to the $j$'th digit of a single precision array and $\hat x_j$ will refer to -the $j$'th digit of a double precision array. Whenever an expression is to be assigned to a double precision -variable it is assumed that all single precision variables are promoted to double precision during the evaluation. -Expressions that are assigned to a single precision variable are truncated to fit within the precision of a single -precision data type. - -For example, if $\beta = 10^2$ a single precision data type may represent a value in the -range $0 \le x < 10^3$, while a double precision data type may represent a value in the range $0 \le x < 10^5$. Let -$a = 23$ and $b = 49$ represent two single precision variables. The single precision product shall be written -as $c \leftarrow a \cdot b$ while the double precision product shall be written as $\hat c \leftarrow a \cdot b$. -In this particular case, $\hat c = 1127$ and $c = 127$. The most significant digit of the product would not fit -in a single precision data type and as a result $c \ne \hat c$. - -\subsection{Algorithm Inputs and Outputs} -Within the algorithm descriptions all variables are assumed to be scalars of either single or double precision -as indicated. The only exception to this rule is when variables have been indicated to be of type mp\_int. This -distinction is important as scalars are often used as array indicies and various other counters. - -\subsection{Mathematical Expressions} -The $\lfloor \mbox{ } \rfloor$ brackets imply an expression truncated to an integer not greater than the expression -itself. For example, $\lfloor 5.7 \rfloor = 5$. Similarly the $\lceil \mbox{ } \rceil$ brackets imply an expression -rounded to an integer not less than the expression itself. For example, $\lceil 5.1 \rceil = 6$. Typically when -the $/$ division symbol is used the intention is to perform an integer division with truncation. For example, -$5/2 = 2$ which will often be written as $\lfloor 5/2 \rfloor = 2$ for clarity. When an expression is written as a -fraction a real value division is implied, for example ${5 \over 2} = 2.5$. - -The norm of a multiple precision integer, for example $\vert \vert x \vert \vert$, will be used to represent the number of digits in the representation -of the integer. For example, $\vert \vert 123 \vert \vert = 3$ and $\vert \vert 79452 \vert \vert = 5$. - -\subsection{Work Effort} -\index{big-Oh} -To measure the efficiency of the specified algorithms, a modified big-Oh notation is used. In this system all -single precision operations are considered to have the same cost\footnote{Except where explicitly noted.}. -That is a single precision addition, multiplication and division are assumed to take the same time to -complete. While this is generally not true in practice, it will simplify the discussions considerably. - -Some algorithms have slight advantages over others which is why some constants will not be removed in -the notation. For example, a normal baseline multiplication (section \ref{sec:basemult}) requires $O(n^2)$ work while a -baseline squaring (section \ref{sec:basesquare}) requires $O({{n^2 + n}\over 2})$ work. In standard big-Oh notation these -would both be said to be equivalent to $O(n^2)$. However, -in the context of the this text this is not the case as the magnitude of the inputs will typically be rather small. As a -result small constant factors in the work effort will make an observable difference in algorithm efficiency. - -All of the algorithms presented in this text have a polynomial time work level. That is, of the form -$O(n^k)$ for $n, k \in \Z^{+}$. This will help make useful comparisons in terms of the speed of the algorithms and how -various optimizations will help pay off in the long run. - -\section{Exercises} -Within the more advanced chapters a section will be set aside to give the reader some challenging exercises related to -the discussion at hand. These exercises are not designed to be prize winning problems, but instead to be thought -provoking. Wherever possible the problems are forward minded, stating problems that will be answered in subsequent -chapters. The reader is encouraged to finish the exercises as they appear to get a better understanding of the -subject material. - -That being said, the problems are designed to affirm knowledge of a particular subject matter. Students in particular -are encouraged to verify they can answer the problems correctly before moving on. - -Similar to the exercises of \cite[pp. ix]{TAOCPV2} these exercises are given a scoring system based on the difficulty of -the problem. However, unlike \cite{TAOCPV2} the problems do not get nearly as hard. The scoring of these -exercises ranges from one (the easiest) to five (the hardest). The following table sumarizes the -scoring system used. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|c|l|} -\hline $\left [ 1 \right ]$ & An easy problem that should only take the reader a manner of \\ - & minutes to solve. Usually does not involve much computer time \\ - & to solve. \\ -\hline $\left [ 2 \right ]$ & An easy problem that involves a marginal amount of computer \\ - & time usage. Usually requires a program to be written to \\ - & solve the problem. \\ -\hline $\left [ 3 \right ]$ & A moderately hard problem that requires a non-trivial amount \\ - & of work. Usually involves trivial research and development of \\ - & new theory from the perspective of a student. \\ -\hline $\left [ 4 \right ]$ & A moderately hard problem that involves a non-trivial amount \\ - & of work and research, the solution to which will demonstrate \\ - & a higher mastery of the subject matter. \\ -\hline $\left [ 5 \right ]$ & A hard problem that involves concepts that are difficult for a \\ - & novice to solve. Solutions to these problems will demonstrate a \\ - & complete mastery of the given subject. \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Exercise Scoring System} -\end{figure} - -Problems at the first level are meant to be simple questions that the reader can answer quickly without programming a solution or -devising new theory. These problems are quick tests to see if the material is understood. Problems at the second level -are also designed to be easy but will require a program or algorithm to be implemented to arrive at the answer. These -two levels are essentially entry level questions. - -Problems at the third level are meant to be a bit more difficult than the first two levels. The answer is often -fairly obvious but arriving at an exacting solution requires some thought and skill. These problems will almost always -involve devising a new algorithm or implementing a variation of another algorithm previously presented. Readers who can -answer these questions will feel comfortable with the concepts behind the topic at hand. - -Problems at the fourth level are meant to be similar to those of the level three questions except they will require -additional research to be completed. The reader will most likely not know the answer right away, nor will the text provide -the exact details of the answer until a subsequent chapter. - -Problems at the fifth level are meant to be the hardest -problems relative to all the other problems in the chapter. People who can correctly answer fifth level problems have a -mastery of the subject matter at hand. - -Often problems will be tied together. The purpose of this is to start a chain of thought that will be discussed in future chapters. The reader -is encouraged to answer the follow-up problems and try to draw the relevance of problems. - -\section{Introduction to LibTomMath} - -\subsection{What is LibTomMath?} -LibTomMath is a free and open source multiple precision integer library written entirely in portable ISO C. By portable it -is meant that the library does not contain any code that is computer platform dependent or otherwise problematic to use on -any given platform. - -The library has been successfully tested under numerous operating systems including Unix\footnote{All of these -trademarks belong to their respective rightful owners.}, MacOS, Windows, Linux, PalmOS and on standalone hardware such -as the Gameboy Advance. The library is designed to contain enough functionality to be able to develop applications such -as public key cryptosystems and still maintain a relatively small footprint. - -\subsection{Goals of LibTomMath} - -Libraries which obtain the most efficiency are rarely written in a high level programming language such as C. However, -even though this library is written entirely in ISO C, considerable care has been taken to optimize the algorithm implementations within the -library. Specifically the code has been written to work well with the GNU C Compiler (\textit{GCC}) on both x86 and ARM -processors. Wherever possible, highly efficient algorithms, such as Karatsuba multiplication, sliding window -exponentiation and Montgomery reduction have been provided to make the library more efficient. - -Even with the nearly optimal and specialized algorithms that have been included the Application Programing Interface -(\textit{API}) has been kept as simple as possible. Often generic place holder routines will make use of specialized -algorithms automatically without the developer's specific attention. One such example is the generic multiplication -algorithm \textbf{mp\_mul()} which will automatically use Toom--Cook, Karatsuba, Comba or baseline multiplication -based on the magnitude of the inputs and the configuration of the library. - -Making LibTomMath as efficient as possible is not the only goal of the LibTomMath project. Ideally the library should -be source compatible with another popular library which makes it more attractive for developers to use. In this case the -MPI library was used as a API template for all the basic functions. MPI was chosen because it is another library that fits -in the same niche as LibTomMath. Even though LibTomMath uses MPI as the template for the function names and argument -passing conventions, it has been written from scratch by Tom St Denis. - -The project is also meant to act as a learning tool for students, the logic being that no easy-to-follow ``bignum'' -library exists which can be used to teach computer science students how to perform fast and reliable multiple precision -integer arithmetic. To this end the source code has been given quite a few comments and algorithm discussion points. - -\section{Choice of LibTomMath} -LibTomMath was chosen as the case study of this text not only because the author of both projects is one and the same but -for more worthy reasons. Other libraries such as GMP \cite{GMP}, MPI \cite{MPI}, LIP \cite{LIP} and OpenSSL -\cite{OPENSSL} have multiple precision integer arithmetic routines but would not be ideal for this text for -reasons that will be explained in the following sub-sections. - -\subsection{Code Base} -The LibTomMath code base is all portable ISO C source code. This means that there are no platform dependent conditional -segments of code littered throughout the source. This clean and uncluttered approach to the library means that a -developer can more readily discern the true intent of a given section of source code without trying to keep track of -what conditional code will be used. - -The code base of LibTomMath is well organized. Each function is in its own separate source code file -which allows the reader to find a given function very quickly. On average there are $76$ lines of code per source -file which makes the source very easily to follow. By comparison MPI and LIP are single file projects making code tracing -very hard. GMP has many conditional code segments which also hinder tracing. - -When compiled with GCC for the x86 processor and optimized for speed the entire library is approximately $100$KiB\footnote{The notation ``KiB'' means $2^{10}$ octets, similarly ``MiB'' means $2^{20}$ octets.} - which is fairly small compared to GMP (over $250$KiB). LibTomMath is slightly larger than MPI (which compiles to about -$50$KiB) but LibTomMath is also much faster and more complete than MPI. - -\subsection{API Simplicity} -LibTomMath is designed after the MPI library and shares the API design. Quite often programs that use MPI will build -with LibTomMath without change. The function names correlate directly to the action they perform. Almost all of the -functions share the same parameter passing convention. The learning curve is fairly shallow with the API provided -which is an extremely valuable benefit for the student and developer alike. - -The LIP library is an example of a library with an API that is awkward to work with. LIP uses function names that are often ``compressed'' to -illegible short hand. LibTomMath does not share this characteristic. - -The GMP library also does not return error codes. Instead it uses a POSIX.1 \cite{POSIX1} signal system where errors -are signaled to the host application. This happens to be the fastest approach but definitely not the most versatile. In -effect a math error (i.e. invalid input, heap error, etc) can cause a program to stop functioning which is definitely -undersireable in many situations. - -\subsection{Optimizations} -While LibTomMath is certainly not the fastest library (GMP often beats LibTomMath by a factor of two) it does -feature a set of optimal algorithms for tasks such as modular reduction, exponentiation, multiplication and squaring. GMP -and LIP also feature such optimizations while MPI only uses baseline algorithms with no optimizations. GMP lacks a few -of the additional modular reduction optimizations that LibTomMath features\footnote{At the time of this writing GMP -only had Barrett and Montgomery modular reduction algorithms.}. - -LibTomMath is almost always an order of magnitude faster than the MPI library at computationally expensive tasks such as modular -exponentiation. In the grand scheme of ``bignum'' libraries LibTomMath is faster than the average library and usually -slower than the best libraries such as GMP and OpenSSL by only a small factor. - -\subsection{Portability and Stability} -LibTomMath will build ``out of the box'' on any platform equipped with a modern version of the GNU C Compiler -(\textit{GCC}). This means that without changes the library will build without configuration or setting up any -variables. LIP and MPI will build ``out of the box'' as well but have numerous known bugs. Most notably the author of -MPI has recently stopped working on his library and LIP has long since been discontinued. - -GMP requires a configuration script to run and will not build out of the box. GMP and LibTomMath are still in active -development and are very stable across a variety of platforms. - -\subsection{Choice} -LibTomMath is a relatively compact, well documented, highly optimized and portable library which seems only natural for -the case study of this text. Various source files from the LibTomMath project will be included within the text. However, -the reader is encouraged to download their own copy of the library to actually be able to work with the library. - -\chapter{Getting Started} -\section{Library Basics} -The trick to writing any useful library of source code is to build a solid foundation and work outwards from it. First, -a problem along with allowable solution parameters should be identified and analyzed. In this particular case the -inability to accomodate multiple precision integers is the problem. Futhermore, the solution must be written -as portable source code that is reasonably efficient across several different computer platforms. - -After a foundation is formed the remainder of the library can be designed and implemented in a hierarchical fashion. -That is, to implement the lowest level dependencies first and work towards the most abstract functions last. For example, -before implementing a modular exponentiation algorithm one would implement a modular reduction algorithm. -By building outwards from a base foundation instead of using a parallel design methodology the resulting project is -highly modular. Being highly modular is a desirable property of any project as it often means the resulting product -has a small footprint and updates are easy to perform. - -Usually when I start a project I will begin with the header files. I define the data types I think I will need and -prototype the initial functions that are not dependent on other functions (within the library). After I -implement these base functions I prototype more dependent functions and implement them. The process repeats until -I implement all of the functions I require. For example, in the case of LibTomMath I implemented functions such as -mp\_init() well before I implemented mp\_mul() and even further before I implemented mp\_exptmod(). As an example as to -why this design works note that the Karatsuba and Toom-Cook multipliers were written \textit{after} the -dependent function mp\_exptmod() was written. Adding the new multiplication algorithms did not require changes to the -mp\_exptmod() function itself and lowered the total cost of ownership (\textit{so to speak}) and of development -for new algorithms. This methodology allows new algorithms to be tested in a complete framework with relative ease. - -FIGU,design_process,Design Flow of the First Few Original LibTomMath Functions. - -Only after the majority of the functions were in place did I pursue a less hierarchical approach to auditing and optimizing -the source code. For example, one day I may audit the multipliers and the next day the polynomial basis functions. - -It only makes sense to begin the text with the preliminary data types and support algorithms required as well. -This chapter discusses the core algorithms of the library which are the dependents for every other algorithm. - -\section{What is a Multiple Precision Integer?} -Recall that most programming languages, in particular ISO C \cite{ISOC}, only have fixed precision data types that on their own cannot -be used to represent values larger than their precision will allow. The purpose of multiple precision algorithms is -to use fixed precision data types to create and manipulate multiple precision integers which may represent values -that are very large. - -As a well known analogy, school children are taught how to form numbers larger than nine by prepending more radix ten digits. In the decimal system -the largest single digit value is $9$. However, by concatenating digits together larger numbers may be represented. Newly prepended digits -(\textit{to the left}) are said to be in a different power of ten column. That is, the number $123$ can be described as having a $1$ in the hundreds -column, $2$ in the tens column and $3$ in the ones column. Or more formally $123 = 1 \cdot 10^2 + 2 \cdot 10^1 + 3 \cdot 10^0$. Computer based -multiple precision arithmetic is essentially the same concept. Larger integers are represented by adjoining fixed -precision computer words with the exception that a different radix is used. - -What most people probably do not think about explicitly are the various other attributes that describe a multiple precision -integer. For example, the integer $154_{10}$ has two immediately obvious properties. First, the integer is positive, -that is the sign of this particular integer is positive as opposed to negative. Second, the integer has three digits in -its representation. There is an additional property that the integer posesses that does not concern pencil-and-paper -arithmetic. The third property is how many digits placeholders are available to hold the integer. - -The human analogy of this third property is ensuring there is enough space on the paper to write the integer. For example, -if one starts writing a large number too far to the right on a piece of paper they will have to erase it and move left. -Similarly, computer algorithms must maintain strict control over memory usage to ensure that the digits of an integer -will not exceed the allowed boundaries. These three properties make up what is known as a multiple precision -integer or mp\_int for short. - -\subsection{The mp\_int Structure} -\label{sec:MPINT} -The mp\_int structure is the ISO C based manifestation of what represents a multiple precision integer. The ISO C standard does not provide for -any such data type but it does provide for making composite data types known as structures. The following is the structure definition -used within LibTomMath. - -\index{mp\_int} -\begin{figure}[here] -\begin{center} -\begin{small} -%\begin{verbatim} -\begin{tabular}{|l|} -\hline -typedef struct \{ \\ -\hspace{3mm}int used, alloc, sign;\\ -\hspace{3mm}mp\_digit *dp;\\ -\} \textbf{mp\_int}; \\ -\hline -\end{tabular} -%\end{verbatim} -\end{small} -\caption{The mp\_int Structure} -\label{fig:mpint} -\end{center} -\end{figure} - -The mp\_int structure (fig. \ref{fig:mpint}) can be broken down as follows. - -\begin{enumerate} -\item The \textbf{used} parameter denotes how many digits of the array \textbf{dp} contain the digits used to represent -a given integer. The \textbf{used} count must be positive (or zero) and may not exceed the \textbf{alloc} count. - -\item The \textbf{alloc} parameter denotes how -many digits are available in the array to use by functions before it has to increase in size. When the \textbf{used} count -of a result would exceed the \textbf{alloc} count all of the algorithms will automatically increase the size of the -array to accommodate the precision of the result. - -\item The pointer \textbf{dp} points to a dynamically allocated array of digits that represent the given multiple -precision integer. It is padded with $(\textbf{alloc} - \textbf{used})$ zero digits. The array is maintained in a least -significant digit order. As a pencil and paper analogy the array is organized such that the right most digits are stored -first starting at the location indexed by zero\footnote{In C all arrays begin at zero.} in the array. For example, -if \textbf{dp} contains $\lbrace a, b, c, \ldots \rbrace$ where \textbf{dp}$_0 = a$, \textbf{dp}$_1 = b$, \textbf{dp}$_2 = c$, $\ldots$ then -it would represent the integer $a + b\beta + c\beta^2 + \ldots$ - -\index{MP\_ZPOS} \index{MP\_NEG} -\item The \textbf{sign} parameter denotes the sign as either zero/positive (\textbf{MP\_ZPOS}) or negative (\textbf{MP\_NEG}). -\end{enumerate} - -\subsubsection{Valid mp\_int Structures} -Several rules are placed on the state of an mp\_int structure and are assumed to be followed for reasons of efficiency. -The only exceptions are when the structure is passed to initialization functions such as mp\_init() and mp\_init\_copy(). - -\begin{enumerate} -\item The value of \textbf{alloc} may not be less than one. That is \textbf{dp} always points to a previously allocated -array of digits. -\item The value of \textbf{used} may not exceed \textbf{alloc} and must be greater than or equal to zero. -\item The value of \textbf{used} implies the digit at index $(used - 1)$ of the \textbf{dp} array is non-zero. That is, -leading zero digits in the most significant positions must be trimmed. - \begin{enumerate} - \item Digits in the \textbf{dp} array at and above the \textbf{used} location must be zero. - \end{enumerate} -\item The value of \textbf{sign} must be \textbf{MP\_ZPOS} if \textbf{used} is zero; -this represents the mp\_int value of zero. -\end{enumerate} - -\section{Argument Passing} -A convention of argument passing must be adopted early on in the development of any library. Making the function -prototypes consistent will help eliminate many headaches in the future as the library grows to significant complexity. -In LibTomMath the multiple precision integer functions accept parameters from left to right as pointers to mp\_int -structures. That means that the source (input) operands are placed on the left and the destination (output) on the right. -Consider the following examples. - -\begin{verbatim} - mp_mul(&a, &b, &c); /* c = a * b */ - mp_add(&a, &b, &a); /* a = a + b */ - mp_sqr(&a, &b); /* b = a * a */ -\end{verbatim} - -The left to right order is a fairly natural way to implement the functions since it lets the developer read aloud the -functions and make sense of them. For example, the first function would read ``multiply a and b and store in c''. - -Certain libraries (\textit{LIP by Lenstra for instance}) accept parameters the other way around, to mimic the order -of assignment expressions. That is, the destination (output) is on the left and arguments (inputs) are on the right. In -truth, it is entirely a matter of preference. In the case of LibTomMath the convention from the MPI library has been -adopted. - -Another very useful design consideration, provided for in LibTomMath, is whether to allow argument sources to also be a -destination. For example, the second example (\textit{mp\_add}) adds $a$ to $b$ and stores in $a$. This is an important -feature to implement since it allows the calling functions to cut down on the number of variables it must maintain. -However, to implement this feature specific care has to be given to ensure the destination is not modified before the -source is fully read. - -\section{Return Values} -A well implemented application, no matter what its purpose, should trap as many runtime errors as possible and return them -to the caller. By catching runtime errors a library can be guaranteed to prevent undefined behaviour. However, the end -developer can still manage to cause a library to crash. For example, by passing an invalid pointer an application may -fault by dereferencing memory not owned by the application. - -In the case of LibTomMath the only errors that are checked for are related to inappropriate inputs (division by zero for -instance) and memory allocation errors. It will not check that the mp\_int passed to any function is valid nor -will it check pointers for validity. Any function that can cause a runtime error will return an error code as an -\textbf{int} data type with one of the following values (fig \ref{fig:errcodes}). - -\index{MP\_OKAY} \index{MP\_VAL} \index{MP\_MEM} -\begin{figure}[here] -\begin{center} -\begin{tabular}{|l|l|} -\hline \textbf{Value} & \textbf{Meaning} \\ -\hline \textbf{MP\_OKAY} & The function was successful \\ -\hline \textbf{MP\_VAL} & One of the input value(s) was invalid \\ -\hline \textbf{MP\_MEM} & The function ran out of heap memory \\ -\hline -\end{tabular} -\end{center} -\caption{LibTomMath Error Codes} -\label{fig:errcodes} -\end{figure} - -When an error is detected within a function it should free any memory it allocated, often during the initialization of -temporary mp\_ints, and return as soon as possible. The goal is to leave the system in the same state it was when the -function was called. Error checking with this style of API is fairly simple. - -\begin{verbatim} - int err; - if ((err = mp_add(&a, &b, &c)) != MP_OKAY) { - printf("Error: %s\n", mp_error_to_string(err)); - exit(EXIT_FAILURE); - } -\end{verbatim} - -The GMP \cite{GMP} library uses C style \textit{signals} to flag errors which is of questionable use. Not all errors are fatal -and it was not deemed ideal by the author of LibTomMath to force developers to have signal handlers for such cases. - -\section{Initialization and Clearing} -The logical starting point when actually writing multiple precision integer functions is the initialization and -clearing of the mp\_int structures. These two algorithms will be used by the majority of the higher level algorithms. - -Given the basic mp\_int structure an initialization routine must first allocate memory to hold the digits of -the integer. Often it is optimal to allocate a sufficiently large pre-set number of digits even though -the initial integer will represent zero. If only a single digit were allocated quite a few subsequent re-allocations -would occur when operations are performed on the integers. There is a tradeoff between how many default digits to allocate -and how many re-allocations are tolerable. Obviously allocating an excessive amount of digits initially will waste -memory and become unmanageable. - -If the memory for the digits has been successfully allocated then the rest of the members of the structure must -be initialized. Since the initial state of an mp\_int is to represent the zero integer, the allocated digits must be set -to zero. The \textbf{used} count set to zero and \textbf{sign} set to \textbf{MP\_ZPOS}. - -\subsection{Initializing an mp\_int} -An mp\_int is said to be initialized if it is set to a valid, preferably default, state such that all of the members of the -structure are set to valid values. The mp\_init algorithm will perform such an action. - -\index{mp\_init} -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Allocate memory and initialize $a$ to a known valid mp\_int state. \\ -\hline \\ -1. Allocate memory for \textbf{MP\_PREC} digits. \\ -2. If the allocation failed return(\textit{MP\_MEM}) \\ -3. for $n$ from $0$ to $MP\_PREC - 1$ do \\ -\hspace{3mm}3.1 $a_n \leftarrow 0$\\ -4. $a.sign \leftarrow MP\_ZPOS$\\ -5. $a.used \leftarrow 0$\\ -6. $a.alloc \leftarrow MP\_PREC$\\ -7. Return(\textit{MP\_OKAY})\\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_init} -\end{figure} - -\textbf{Algorithm mp\_init.} -The purpose of this function is to initialize an mp\_int structure so that the rest of the library can properly -manipulte it. It is assumed that the input may not have had any of its members previously initialized which is certainly -a valid assumption if the input resides on the stack. - -Before any of the members such as \textbf{sign}, \textbf{used} or \textbf{alloc} are initialized the memory for -the digits is allocated. If this fails the function returns before setting any of the other members. The \textbf{MP\_PREC} -name represents a constant\footnote{Defined in the ``tommath.h'' header file within LibTomMath.} -used to dictate the minimum precision of newly initialized mp\_int integers. Ideally, it is at least equal to the smallest -precision number you'll be working with. - -Allocating a block of digits at first instead of a single digit has the benefit of lowering the number of usually slow -heap operations later functions will have to perform in the future. If \textbf{MP\_PREC} is set correctly the slack -memory and the number of heap operations will be trivial. - -Once the allocation has been made the digits have to be set to zero as well as the \textbf{used}, \textbf{sign} and -\textbf{alloc} members initialized. This ensures that the mp\_int will always represent the default state of zero regardless -of the original condition of the input. - -\textbf{Remark.} -This function introduces the idiosyncrasy that all iterative loops, commonly initiated with the ``for'' keyword, iterate incrementally -when the ``to'' keyword is placed between two expressions. For example, ``for $a$ from $b$ to $c$ do'' means that -a subsequent expression (or body of expressions) are to be evaluated upto $c - b$ times so long as $b \le c$. In each -iteration the variable $a$ is substituted for a new integer that lies inclusively between $b$ and $c$. If $b > c$ occured -the loop would not iterate. By contrast if the ``downto'' keyword were used in place of ``to'' the loop would iterate -decrementally. - -EXAM,bn_mp_init.c - -One immediate observation of this initializtion function is that it does not return a pointer to a mp\_int structure. It -is assumed that the caller has already allocated memory for the mp\_int structure, typically on the application stack. The -call to mp\_init() is used only to initialize the members of the structure to a known default state. - -Here we see (line @23,XMALLOC@) the memory allocation is performed first. This allows us to exit cleanly and quickly -if there is an error. If the allocation fails the routine will return \textbf{MP\_MEM} to the caller to indicate there -was a memory error. The function XMALLOC is what actually allocates the memory. Technically XMALLOC is not a function -but a macro defined in ``tommath.h``. By default, XMALLOC will evaluate to malloc() which is the C library's built--in -memory allocation routine. - -In order to assure the mp\_int is in a known state the digits must be set to zero. On most platforms this could have been -accomplished by using calloc() instead of malloc(). However, to correctly initialize a integer type to a given value in a -portable fashion you have to actually assign the value. The for loop (line @28,for@) performs this required -operation. - -After the memory has been successfully initialized the remainder of the members are initialized -(lines @29,used@ through @31,sign@) to their respective default states. At this point the algorithm has succeeded and -a success code is returned to the calling function. If this function returns \textbf{MP\_OKAY} it is safe to assume the -mp\_int structure has been properly initialized and is safe to use with other functions within the library. - -\subsection{Clearing an mp\_int} -When an mp\_int is no longer required by the application, the memory that has been allocated for its digits must be -returned to the application's memory pool with the mp\_clear algorithm. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_clear}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. The memory for $a$ shall be deallocated. \\ -\hline \\ -1. If $a$ has been previously freed then return(\textit{MP\_OKAY}). \\ -2. for $n$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}2.1 $a_n \leftarrow 0$ \\ -3. Free the memory allocated for the digits of $a$. \\ -4. $a.used \leftarrow 0$ \\ -5. $a.alloc \leftarrow 0$ \\ -6. $a.sign \leftarrow MP\_ZPOS$ \\ -7. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_clear} -\end{figure} - -\textbf{Algorithm mp\_clear.} -This algorithm accomplishes two goals. First, it clears the digits and the other mp\_int members. This ensures that -if a developer accidentally re-uses a cleared structure it is less likely to cause problems. The second goal -is to free the allocated memory. - -The logic behind the algorithm is extended by marking cleared mp\_int structures so that subsequent calls to this -algorithm will not try to free the memory multiple times. Cleared mp\_ints are detectable by having a pre-defined invalid -digit pointer \textbf{dp} setting. - -Once an mp\_int has been cleared the mp\_int structure is no longer in a valid state for any other algorithm -with the exception of algorithms mp\_init, mp\_init\_copy, mp\_init\_size and mp\_clear. - -EXAM,bn_mp_clear.c - -The algorithm only operates on the mp\_int if it hasn't been previously cleared. The if statement (line @23,a->dp != NULL@) -checks to see if the \textbf{dp} member is not \textbf{NULL}. If the mp\_int is a valid mp\_int then \textbf{dp} cannot be -\textbf{NULL} in which case the if statement will evaluate to true. - -The digits of the mp\_int are cleared by the for loop (line @25,for@) which assigns a zero to every digit. Similar to mp\_init() -the digits are assigned zero instead of using block memory operations (such as memset()) since this is more portable. - -The digits are deallocated off the heap via the XFREE macro. Similar to XMALLOC the XFREE macro actually evaluates to -a standard C library function. In this case the free() function. Since free() only deallocates the memory the pointer -still has to be reset to \textbf{NULL} manually (line @33,NULL@). - -Now that the digits have been cleared and deallocated the other members are set to their final values (lines @34,= 0@ and @35,ZPOS@). - -\section{Maintenance Algorithms} - -The previous sections describes how to initialize and clear an mp\_int structure. To further support operations -that are to be performed on mp\_int structures (such as addition and multiplication) the dependent algorithms must be -able to augment the precision of an mp\_int and -initialize mp\_ints with differing initial conditions. - -These algorithms complete the set of low level algorithms required to work with mp\_int structures in the higher level -algorithms such as addition, multiplication and modular exponentiation. - -\subsection{Augmenting an mp\_int's Precision} -When storing a value in an mp\_int structure, a sufficient number of digits must be available to accomodate the entire -result of an operation without loss of precision. Quite often the size of the array given by the \textbf{alloc} member -is large enough to simply increase the \textbf{used} digit count. However, when the size of the array is too small it -must be re-sized appropriately to accomodate the result. The mp\_grow algorithm will provide this functionality. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_grow}. \\ -\textbf{Input}. An mp\_int $a$ and an integer $b$. \\ -\textbf{Output}. $a$ is expanded to accomodate $b$ digits. \\ -\hline \\ -1. if $a.alloc \ge b$ then return(\textit{MP\_OKAY}) \\ -2. $u \leftarrow b\mbox{ (mod }MP\_PREC\mbox{)}$ \\ -3. $v \leftarrow b + 2 \cdot MP\_PREC - u$ \\ -4. Re-allocate the array of digits $a$ to size $v$ \\ -5. If the allocation failed then return(\textit{MP\_MEM}). \\ -6. for n from a.alloc to $v - 1$ do \\ -\hspace{+3mm}6.1 $a_n \leftarrow 0$ \\ -7. $a.alloc \leftarrow v$ \\ -8. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_grow} -\end{figure} - -\textbf{Algorithm mp\_grow.} -It is ideal to prevent re-allocations from being performed if they are not required (step one). This is useful to -prevent mp\_ints from growing excessively in code that erroneously calls mp\_grow. - -The requested digit count is padded up to next multiple of \textbf{MP\_PREC} plus an additional \textbf{MP\_PREC} (steps two and three). -This helps prevent many trivial reallocations that would grow an mp\_int by trivially small values. - -It is assumed that the reallocation (step four) leaves the lower $a.alloc$ digits of the mp\_int intact. This is much -akin to how the \textit{realloc} function from the standard C library works. Since the newly allocated digits are -assumed to contain undefined values they are initially set to zero. - -EXAM,bn_mp_grow.c - -A quick optimization is to first determine if a memory re-allocation is required at all. The if statement (line @24,alloc@) checks -if the \textbf{alloc} member of the mp\_int is smaller than the requested digit count. If the count is not larger than \textbf{alloc} -the function skips the re-allocation part thus saving time. - -When a re-allocation is performed it is turned into an optimal request to save time in the future. The requested digit count is -padded upwards to 2nd multiple of \textbf{MP\_PREC} larger than \textbf{alloc} (line @25, size@). The XREALLOC function is used -to re-allocate the memory. As per the other functions XREALLOC is actually a macro which evaluates to realloc by default. The realloc -function leaves the base of the allocation intact which means the first \textbf{alloc} digits of the mp\_int are the same as before -the re-allocation. All that is left is to clear the newly allocated digits and return. - -Note that the re-allocation result is actually stored in a temporary pointer $tmp$. This is to allow this function to return -an error with a valid pointer. Earlier releases of the library stored the result of XREALLOC into the mp\_int $a$. That would -result in a memory leak if XREALLOC ever failed. - -\subsection{Initializing Variable Precision mp\_ints} -Occasionally the number of digits required will be known in advance of an initialization, based on, for example, the size -of input mp\_ints to a given algorithm. The purpose of algorithm mp\_init\_size is similar to mp\_init except that it -will allocate \textit{at least} a specified number of digits. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init\_size}. \\ -\textbf{Input}. An mp\_int $a$ and the requested number of digits $b$. \\ -\textbf{Output}. $a$ is initialized to hold at least $b$ digits. \\ -\hline \\ -1. $u \leftarrow b \mbox{ (mod }MP\_PREC\mbox{)}$ \\ -2. $v \leftarrow b + 2 \cdot MP\_PREC - u$ \\ -3. Allocate $v$ digits. \\ -4. for $n$ from $0$ to $v - 1$ do \\ -\hspace{3mm}4.1 $a_n \leftarrow 0$ \\ -5. $a.sign \leftarrow MP\_ZPOS$\\ -6. $a.used \leftarrow 0$\\ -7. $a.alloc \leftarrow v$\\ -8. Return(\textit{MP\_OKAY})\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_init\_size} -\end{figure} - -\textbf{Algorithm mp\_init\_size.} -This algorithm will initialize an mp\_int structure $a$ like algorithm mp\_init with the exception that the number of -digits allocated can be controlled by the second input argument $b$. The input size is padded upwards so it is a -multiple of \textbf{MP\_PREC} plus an additional \textbf{MP\_PREC} digits. This padding is used to prevent trivial -allocations from becoming a bottleneck in the rest of the algorithms. - -Like algorithm mp\_init, the mp\_int structure is initialized to a default state representing the integer zero. This -particular algorithm is useful if it is known ahead of time the approximate size of the input. If the approximation is -correct no further memory re-allocations are required to work with the mp\_int. - -EXAM,bn_mp_init_size.c - -The number of digits $b$ requested is padded (line @22,MP_PREC@) by first augmenting it to the next multiple of -\textbf{MP\_PREC} and then adding \textbf{MP\_PREC} to the result. If the memory can be successfully allocated the -mp\_int is placed in a default state representing the integer zero. Otherwise, the error code \textbf{MP\_MEM} will be -returned (line @27,return@). - -The digits are allocated with the malloc() function (line @27,XMALLOC@) and set to zero afterwards (line @38,for@). The -\textbf{used} count is set to zero, the \textbf{alloc} count set to the padded digit count and the \textbf{sign} flag set -to \textbf{MP\_ZPOS} to achieve a default valid mp\_int state (lines @29,used@, @30,alloc@ and @31,sign@). If the function -returns succesfully then it is correct to assume that the mp\_int structure is in a valid state for the remainder of the -functions to work with. - -\subsection{Multiple Integer Initializations and Clearings} -Occasionally a function will require a series of mp\_int data types to be made available simultaneously. -The purpose of algorithm mp\_init\_multi is to initialize a variable length array of mp\_int structures in a single -statement. It is essentially a shortcut to multiple initializations. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init\_multi}. \\ -\textbf{Input}. Variable length array $V_k$ of mp\_int variables of length $k$. \\ -\textbf{Output}. The array is initialized such that each mp\_int of $V_k$ is ready to use. \\ -\hline \\ -1. for $n$ from 0 to $k - 1$ do \\ -\hspace{+3mm}1.1. Initialize the mp\_int $V_n$ (\textit{mp\_init}) \\ -\hspace{+3mm}1.2. If initialization failed then do \\ -\hspace{+6mm}1.2.1. for $j$ from $0$ to $n$ do \\ -\hspace{+9mm}1.2.1.1. Free the mp\_int $V_j$ (\textit{mp\_clear}) \\ -\hspace{+6mm}1.2.2. Return(\textit{MP\_MEM}) \\ -2. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_init\_multi} -\end{figure} - -\textbf{Algorithm mp\_init\_multi.} -The algorithm will initialize the array of mp\_int variables one at a time. If a runtime error has been detected -(\textit{step 1.2}) all of the previously initialized variables are cleared. The goal is an ``all or nothing'' -initialization which allows for quick recovery from runtime errors. - -EXAM,bn_mp_init_multi.c - -This function intializes a variable length list of mp\_int structure pointers. However, instead of having the mp\_int -structures in an actual C array they are simply passed as arguments to the function. This function makes use of the -``...'' argument syntax of the C programming language. The list is terminated with a final \textbf{NULL} argument -appended on the right. - -The function uses the ``stdarg.h'' \textit{va} functions to step portably through the arguments to the function. A count -$n$ of succesfully initialized mp\_int structures is maintained (line @47,n++@) such that if a failure does occur, -the algorithm can backtrack and free the previously initialized structures (lines @27,if@ to @46,}@). - - -\subsection{Clamping Excess Digits} -When a function anticipates a result will be $n$ digits it is simpler to assume this is true within the body of -the function instead of checking during the computation. For example, a multiplication of a $i$ digit number by a -$j$ digit produces a result of at most $i + j$ digits. It is entirely possible that the result is $i + j - 1$ -though, with no final carry into the last position. However, suppose the destination had to be first expanded -(\textit{via mp\_grow}) to accomodate $i + j - 1$ digits than further expanded to accomodate the final carry. -That would be a considerable waste of time since heap operations are relatively slow. - -The ideal solution is to always assume the result is $i + j$ and fix up the \textbf{used} count after the function -terminates. This way a single heap operation (\textit{at most}) is required. However, if the result was not checked -there would be an excess high order zero digit. - -For example, suppose the product of two integers was $x_n = (0x_{n-1}x_{n-2}...x_0)_{\beta}$. The leading zero digit -will not contribute to the precision of the result. In fact, through subsequent operations more leading zero digits would -accumulate to the point the size of the integer would be prohibitive. As a result even though the precision is very -low the representation is excessively large. - -The mp\_clamp algorithm is designed to solve this very problem. It will trim high-order zeros by decrementing the -\textbf{used} count until a non-zero most significant digit is found. Also in this system, zero is considered to be a -positive number which means that if the \textbf{used} count is decremented to zero, the sign must be set to -\textbf{MP\_ZPOS}. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_clamp}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Any excess leading zero digits of $a$ are removed \\ -\hline \\ -1. while $a.used > 0$ and $a_{a.used - 1} = 0$ do \\ -\hspace{+3mm}1.1 $a.used \leftarrow a.used - 1$ \\ -2. if $a.used = 0$ then do \\ -\hspace{+3mm}2.1 $a.sign \leftarrow MP\_ZPOS$ \\ -\hline \\ -\end{tabular} -\end{center} -\caption{Algorithm mp\_clamp} -\end{figure} - -\textbf{Algorithm mp\_clamp.} -As can be expected this algorithm is very simple. The loop on step one is expected to iterate only once or twice at -the most. For example, this will happen in cases where there is not a carry to fill the last position. Step two fixes the sign for -when all of the digits are zero to ensure that the mp\_int is valid at all times. - -EXAM,bn_mp_clamp.c - -Note on line @27,while@ how to test for the \textbf{used} count is made on the left of the \&\& operator. In the C programming -language the terms to \&\& are evaluated left to right with a boolean short-circuit if any condition fails. This is -important since if the \textbf{used} is zero the test on the right would fetch below the array. That is obviously -undesirable. The parenthesis on line @28,a->used@ is used to make sure the \textbf{used} count is decremented and not -the pointer ``a''. - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 1 \right ]$ & Discuss the relevance of the \textbf{used} member of the mp\_int structure. \\ - & \\ -$\left [ 1 \right ]$ & Discuss the consequences of not using padding when performing allocations. \\ - & \\ -$\left [ 2 \right ]$ & Estimate an ideal value for \textbf{MP\_PREC} when performing 1024-bit RSA \\ - & encryption when $\beta = 2^{28}$. \\ - & \\ -$\left [ 1 \right ]$ & Discuss the relevance of the algorithm mp\_clamp. What does it prevent? \\ - & \\ -$\left [ 1 \right ]$ & Give an example of when the algorithm mp\_init\_copy might be useful. \\ - & \\ -\end{tabular} - - -%%% -% CHAPTER FOUR -%%% - -\chapter{Basic Operations} - -\section{Introduction} -In the previous chapter a series of low level algorithms were established that dealt with initializing and maintaining -mp\_int structures. This chapter will discuss another set of seemingly non-algebraic algorithms which will form the low -level basis of the entire library. While these algorithm are relatively trivial it is important to understand how they -work before proceeding since these algorithms will be used almost intrinsically in the following chapters. - -The algorithms in this chapter deal primarily with more ``programmer'' related tasks such as creating copies of -mp\_int structures, assigning small values to mp\_int structures and comparisons of the values mp\_int structures -represent. - -\section{Assigning Values to mp\_int Structures} -\subsection{Copying an mp\_int} -Assigning the value that a given mp\_int structure represents to another mp\_int structure shall be known as making -a copy for the purposes of this text. The copy of the mp\_int will be a separate entity that represents the same -value as the mp\_int it was copied from. The mp\_copy algorithm provides this functionality. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_copy}. \\ -\textbf{Input}. An mp\_int $a$ and $b$. \\ -\textbf{Output}. Store a copy of $a$ in $b$. \\ -\hline \\ -1. If $b.alloc < a.used$ then grow $b$ to $a.used$ digits. (\textit{mp\_grow}) \\ -2. for $n$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}2.1 $b_{n} \leftarrow a_{n}$ \\ -3. for $n$ from $a.used$ to $b.used - 1$ do \\ -\hspace{3mm}3.1 $b_{n} \leftarrow 0$ \\ -4. $b.used \leftarrow a.used$ \\ -5. $b.sign \leftarrow a.sign$ \\ -6. return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_copy} -\end{figure} - -\textbf{Algorithm mp\_copy.} -This algorithm copies the mp\_int $a$ such that upon succesful termination of the algorithm the mp\_int $b$ will -represent the same integer as the mp\_int $a$. The mp\_int $b$ shall be a complete and distinct copy of the -mp\_int $a$ meaing that the mp\_int $a$ can be modified and it shall not affect the value of the mp\_int $b$. - -If $b$ does not have enough room for the digits of $a$ it must first have its precision augmented via the mp\_grow -algorithm. The digits of $a$ are copied over the digits of $b$ and any excess digits of $b$ are set to zero (step two -and three). The \textbf{used} and \textbf{sign} members of $a$ are finally copied over the respective members of -$b$. - -\textbf{Remark.} This algorithm also introduces a new idiosyncrasy that will be used throughout the rest of the -text. The error return codes of other algorithms are not explicitly checked in the pseudo-code presented. For example, in -step one of the mp\_copy algorithm the return of mp\_grow is not explicitly checked to ensure it succeeded. Text space is -limited so it is assumed that if a algorithm fails it will clear all temporarily allocated mp\_ints and return -the error code itself. However, the C code presented will demonstrate all of the error handling logic required to -implement the pseudo-code. - -EXAM,bn_mp_copy.c - -Occasionally a dependent algorithm may copy an mp\_int effectively into itself such as when the input and output -mp\_int structures passed to a function are one and the same. For this case it is optimal to return immediately without -copying digits (line @24,a == b@). - -The mp\_int $b$ must have enough digits to accomodate the used digits of the mp\_int $a$. If $b.alloc$ is less than -$a.used$ the algorithm mp\_grow is used to augment the precision of $b$ (lines @29,alloc@ to @33,}@). In order to -simplify the inner loop that copies the digits from $a$ to $b$, two aliases $tmpa$ and $tmpb$ point directly at the digits -of the mp\_ints $a$ and $b$ respectively. These aliases (lines @42,tmpa@ and @45,tmpb@) allow the compiler to access the digits without first dereferencing the -mp\_int pointers and then subsequently the pointer to the digits. - -After the aliases are established the digits from $a$ are copied into $b$ (lines @48,for@ to @50,}@) and then the excess -digits of $b$ are set to zero (lines @53,for@ to @55,}@). Both ``for'' loops make use of the pointer aliases and in -fact the alias for $b$ is carried through into the second ``for'' loop to clear the excess digits. This optimization -allows the alias to stay in a machine register fairly easy between the two loops. - -\textbf{Remarks.} The use of pointer aliases is an implementation methodology first introduced in this function that will -be used considerably in other functions. Technically, a pointer alias is simply a short hand alias used to lower the -number of pointer dereferencing operations required to access data. For example, a for loop may resemble - -\begin{alltt} -for (x = 0; x < 100; x++) \{ - a->num[4]->dp[x] = 0; -\} -\end{alltt} - -This could be re-written using aliases as - -\begin{alltt} -mp_digit *tmpa; -a = a->num[4]->dp; -for (x = 0; x < 100; x++) \{ - *a++ = 0; -\} -\end{alltt} - -In this case an alias is used to access the -array of digits within an mp\_int structure directly. It may seem that a pointer alias is strictly not required -as a compiler may optimize out the redundant pointer operations. However, there are two dominant reasons to use aliases. - -The first reason is that most compilers will not effectively optimize pointer arithmetic. For example, some optimizations -may work for the Microsoft Visual C++ compiler (MSVC) and not for the GNU C Compiler (GCC). Also some optimizations may -work for GCC and not MSVC. As such it is ideal to find a common ground for as many compilers as possible. Pointer -aliases optimize the code considerably before the compiler even reads the source code which means the end compiled code -stands a better chance of being faster. - -The second reason is that pointer aliases often can make an algorithm simpler to read. Consider the first ``for'' -loop of the function mp\_copy() re-written to not use pointer aliases. - -\begin{alltt} - /* copy all the digits */ - for (n = 0; n < a->used; n++) \{ - b->dp[n] = a->dp[n]; - \} -\end{alltt} - -Whether this code is harder to read depends strongly on the individual. However, it is quantifiably slightly more -complicated as there are four variables within the statement instead of just two. - -\subsubsection{Nested Statements} -Another commonly used technique in the source routines is that certain sections of code are nested. This is used in -particular with the pointer aliases to highlight code phases. For example, a Comba multiplier (discussed in chapter six) -will typically have three different phases. First the temporaries are initialized, then the columns calculated and -finally the carries are propagated. In this example the middle column production phase will typically be nested as it -uses temporary variables and aliases the most. - -The nesting also simplies the source code as variables that are nested are only valid for their scope. As a result -the various temporary variables required do not propagate into other sections of code. - - -\subsection{Creating a Clone} -Another common operation is to make a local temporary copy of an mp\_int argument. To initialize an mp\_int -and then copy another existing mp\_int into the newly intialized mp\_int will be known as creating a clone. This is -useful within functions that need to modify an argument but do not wish to actually modify the original copy. The -mp\_init\_copy algorithm has been designed to help perform this task. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init\_copy}. \\ -\textbf{Input}. An mp\_int $a$ and $b$\\ -\textbf{Output}. $a$ is initialized to be a copy of $b$. \\ -\hline \\ -1. Init $a$. (\textit{mp\_init}) \\ -2. Copy $b$ to $a$. (\textit{mp\_copy}) \\ -3. Return the status of the copy operation. \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_init\_copy} -\end{figure} - -\textbf{Algorithm mp\_init\_copy.} -This algorithm will initialize an mp\_int variable and copy another previously initialized mp\_int variable into it. As -such this algorithm will perform two operations in one step. - -EXAM,bn_mp_init_copy.c - -This will initialize \textbf{a} and make it a verbatim copy of the contents of \textbf{b}. Note that -\textbf{a} will have its own memory allocated which means that \textbf{b} may be cleared after the call -and \textbf{a} will be left intact. - -\section{Zeroing an Integer} -Reseting an mp\_int to the default state is a common step in many algorithms. The mp\_zero algorithm will be the algorithm used to -perform this task. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_zero}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Zero the contents of $a$ \\ -\hline \\ -1. $a.used \leftarrow 0$ \\ -2. $a.sign \leftarrow$ MP\_ZPOS \\ -3. for $n$ from 0 to $a.alloc - 1$ do \\ -\hspace{3mm}3.1 $a_n \leftarrow 0$ \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_zero} -\end{figure} - -\textbf{Algorithm mp\_zero.} -This algorithm simply resets a mp\_int to the default state. - -EXAM,bn_mp_zero.c - -After the function is completed, all of the digits are zeroed, the \textbf{used} count is zeroed and the -\textbf{sign} variable is set to \textbf{MP\_ZPOS}. - -\section{Sign Manipulation} -\subsection{Absolute Value} -With the mp\_int representation of an integer, calculating the absolute value is trivial. The mp\_abs algorithm will compute -the absolute value of an mp\_int. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_abs}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Computes $b = \vert a \vert$ \\ -\hline \\ -1. Copy $a$ to $b$. (\textit{mp\_copy}) \\ -2. If the copy failed return(\textit{MP\_MEM}). \\ -3. $b.sign \leftarrow MP\_ZPOS$ \\ -4. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_abs} -\end{figure} - -\textbf{Algorithm mp\_abs.} -This algorithm computes the absolute of an mp\_int input. First it copies $a$ over $b$. This is an example of an -algorithm where the check in mp\_copy that determines if the source and destination are equal proves useful. This allows, -for instance, the developer to pass the same mp\_int as the source and destination to this function without addition -logic to handle it. - -EXAM,bn_mp_abs.c - -This fairly trivial algorithm first eliminates non--required duplications (line @27,a != b@) and then sets the -\textbf{sign} flag to \textbf{MP\_ZPOS}. - -\subsection{Integer Negation} -With the mp\_int representation of an integer, calculating the negation is also trivial. The mp\_neg algorithm will compute -the negative of an mp\_int input. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_neg}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Computes $b = -a$ \\ -\hline \\ -1. Copy $a$ to $b$. (\textit{mp\_copy}) \\ -2. If the copy failed return(\textit{MP\_MEM}). \\ -3. If $a.used = 0$ then return(\textit{MP\_OKAY}). \\ -4. If $a.sign = MP\_ZPOS$ then do \\ -\hspace{3mm}4.1 $b.sign = MP\_NEG$. \\ -5. else do \\ -\hspace{3mm}5.1 $b.sign = MP\_ZPOS$. \\ -6. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_neg} -\end{figure} - -\textbf{Algorithm mp\_neg.} -This algorithm computes the negation of an input. First it copies $a$ over $b$. If $a$ has no used digits then -the algorithm returns immediately. Otherwise it flips the sign flag and stores the result in $b$. Note that if -$a$ had no digits then it must be positive by definition. Had step three been omitted then the algorithm would return -zero as negative. - -EXAM,bn_mp_neg.c - -Like mp\_abs() this function avoids non--required duplications (line @21,a != b@) and then sets the sign. We -have to make sure that only non--zero values get a \textbf{sign} of \textbf{MP\_NEG}. If the mp\_int is zero -than the \textbf{sign} is hard--coded to \textbf{MP\_ZPOS}. - -\section{Small Constants} -\subsection{Setting Small Constants} -Often a mp\_int must be set to a relatively small value such as $1$ or $2$. For these cases the mp\_set algorithm is useful. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_set}. \\ -\textbf{Input}. An mp\_int $a$ and a digit $b$ \\ -\textbf{Output}. Make $a$ equivalent to $b$ \\ -\hline \\ -1. Zero $a$ (\textit{mp\_zero}). \\ -2. $a_0 \leftarrow b \mbox{ (mod }\beta\mbox{)}$ \\ -3. $a.used \leftarrow \left \lbrace \begin{array}{ll} - 1 & \mbox{if }a_0 > 0 \\ - 0 & \mbox{if }a_0 = 0 - \end{array} \right .$ \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_set} -\end{figure} - -\textbf{Algorithm mp\_set.} -This algorithm sets a mp\_int to a small single digit value. Step number 1 ensures that the integer is reset to the default state. The -single digit is set (\textit{modulo $\beta$}) and the \textbf{used} count is adjusted accordingly. - -EXAM,bn_mp_set.c - -First we zero (line @21,mp_zero@) the mp\_int to make sure that the other members are initialized for a -small positive constant. mp\_zero() ensures that the \textbf{sign} is positive and the \textbf{used} count -is zero. Next we set the digit and reduce it modulo $\beta$ (line @22,MP_MASK@). After this step we have to -check if the resulting digit is zero or not. If it is not then we set the \textbf{used} count to one, otherwise -to zero. - -We can quickly reduce modulo $\beta$ since it is of the form $2^k$ and a quick binary AND operation with -$2^k - 1$ will perform the same operation. - -One important limitation of this function is that it will only set one digit. The size of a digit is not fixed, meaning source that uses -this function should take that into account. Only trivially small constants can be set using this function. - -\subsection{Setting Large Constants} -To overcome the limitations of the mp\_set algorithm the mp\_set\_int algorithm is ideal. It accepts a ``long'' -data type as input and will always treat it as a 32-bit integer. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_set\_int}. \\ -\textbf{Input}. An mp\_int $a$ and a ``long'' integer $b$ \\ -\textbf{Output}. Make $a$ equivalent to $b$ \\ -\hline \\ -1. Zero $a$ (\textit{mp\_zero}) \\ -2. for $n$ from 0 to 7 do \\ -\hspace{3mm}2.1 $a \leftarrow a \cdot 16$ (\textit{mp\_mul2d}) \\ -\hspace{3mm}2.2 $u \leftarrow \lfloor b / 2^{4(7 - n)} \rfloor \mbox{ (mod }16\mbox{)}$\\ -\hspace{3mm}2.3 $a_0 \leftarrow a_0 + u$ \\ -\hspace{3mm}2.4 $a.used \leftarrow a.used + 1$ \\ -3. Clamp excess used digits (\textit{mp\_clamp}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_set\_int} -\end{figure} - -\textbf{Algorithm mp\_set\_int.} -The algorithm performs eight iterations of a simple loop where in each iteration four bits from the source are added to the -mp\_int. Step 2.1 will multiply the current result by sixteen making room for four more bits in the less significant positions. In step 2.2 the -next four bits from the source are extracted and are added to the mp\_int. The \textbf{used} digit count is -incremented to reflect the addition. The \textbf{used} digit counter is incremented since if any of the leading digits were zero the mp\_int would have -zero digits used and the newly added four bits would be ignored. - -Excess zero digits are trimmed in steps 2.1 and 3 by using higher level algorithms mp\_mul2d and mp\_clamp. - -EXAM,bn_mp_set_int.c - -This function sets four bits of the number at a time to handle all practical \textbf{DIGIT\_BIT} sizes. The weird -addition on line @38,a->used@ ensures that the newly added in bits are added to the number of digits. While it may not -seem obvious as to why the digit counter does not grow exceedingly large it is because of the shift on line @27,mp_mul_2d@ -as well as the call to mp\_clamp() on line @40,mp_clamp@. Both functions will clamp excess leading digits which keeps -the number of used digits low. - -\section{Comparisons} -\subsection{Unsigned Comparisions} -Comparing a multiple precision integer is performed with the exact same algorithm used to compare two decimal numbers. For example, -to compare $1,234$ to $1,264$ the digits are extracted by their positions. That is we compare $1 \cdot 10^3 + 2 \cdot 10^2 + 3 \cdot 10^1 + 4 \cdot 10^0$ -to $1 \cdot 10^3 + 2 \cdot 10^2 + 6 \cdot 10^1 + 4 \cdot 10^0$ by comparing single digits at a time starting with the highest magnitude -positions. If any leading digit of one integer is greater than a digit in the same position of another integer then obviously it must be greater. - -The first comparision routine that will be developed is the unsigned magnitude compare which will perform a comparison based on the digits of two -mp\_int variables alone. It will ignore the sign of the two inputs. Such a function is useful when an absolute comparison is required or if the -signs are known to agree in advance. - -To facilitate working with the results of the comparison functions three constants are required. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{|r|l|} -\hline \textbf{Constant} & \textbf{Meaning} \\ -\hline \textbf{MP\_GT} & Greater Than \\ -\hline \textbf{MP\_EQ} & Equal To \\ -\hline \textbf{MP\_LT} & Less Than \\ -\hline -\end{tabular} -\end{center} -\caption{Comparison Return Codes} -\end{figure} - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_cmp\_mag}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$. \\ -\textbf{Output}. Unsigned comparison results ($a$ to the left of $b$). \\ -\hline \\ -1. If $a.used > b.used$ then return(\textit{MP\_GT}) \\ -2. If $a.used < b.used$ then return(\textit{MP\_LT}) \\ -3. for n from $a.used - 1$ to 0 do \\ -\hspace{+3mm}3.1 if $a_n > b_n$ then return(\textit{MP\_GT}) \\ -\hspace{+3mm}3.2 if $a_n < b_n$ then return(\textit{MP\_LT}) \\ -4. Return(\textit{MP\_EQ}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_cmp\_mag} -\end{figure} - -\textbf{Algorithm mp\_cmp\_mag.} -By saying ``$a$ to the left of $b$'' it is meant that the comparison is with respect to $a$, that is if $a$ is greater than $b$ it will return -\textbf{MP\_GT} and similar with respect to when $a = b$ and $a < b$. The first two steps compare the number of digits used in both $a$ and $b$. -Obviously if the digit counts differ there would be an imaginary zero digit in the smaller number where the leading digit of the larger number is. -If both have the same number of digits than the actual digits themselves must be compared starting at the leading digit. - -By step three both inputs must have the same number of digits so its safe to start from either $a.used - 1$ or $b.used - 1$ and count down to -the zero'th digit. If after all of the digits have been compared, no difference is found, the algorithm returns \textbf{MP\_EQ}. - -EXAM,bn_mp_cmp_mag.c - -The two if statements (lines @24,if@ and @28,if@) compare the number of digits in the two inputs. These two are -performed before all of the digits are compared since it is a very cheap test to perform and can potentially save -considerable time. The implementation given is also not valid without those two statements. $b.alloc$ may be -smaller than $a.used$, meaning that undefined values will be read from $b$ past the end of the array of digits. - - - -\subsection{Signed Comparisons} -Comparing with sign considerations is also fairly critical in several routines (\textit{division for example}). Based on an unsigned magnitude -comparison a trivial signed comparison algorithm can be written. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_cmp}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. Signed Comparison Results ($a$ to the left of $b$) \\ -\hline \\ -1. if $a.sign = MP\_NEG$ and $b.sign = MP\_ZPOS$ then return(\textit{MP\_LT}) \\ -2. if $a.sign = MP\_ZPOS$ and $b.sign = MP\_NEG$ then return(\textit{MP\_GT}) \\ -3. if $a.sign = MP\_NEG$ then \\ -\hspace{+3mm}3.1 Return the unsigned comparison of $b$ and $a$ (\textit{mp\_cmp\_mag}) \\ -4 Otherwise \\ -\hspace{+3mm}4.1 Return the unsigned comparison of $a$ and $b$ \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_cmp} -\end{figure} - -\textbf{Algorithm mp\_cmp.} -The first two steps compare the signs of the two inputs. If the signs do not agree then it can return right away with the appropriate -comparison code. When the signs are equal the digits of the inputs must be compared to determine the correct result. In step -three the unsigned comparision flips the order of the arguments since they are both negative. For instance, if $-a > -b$ then -$\vert a \vert < \vert b \vert$. Step number four will compare the two when they are both positive. - -EXAM,bn_mp_cmp.c - -The two if statements (lines @22,if@ and @26,if@) perform the initial sign comparison. If the signs are not the equal then which ever -has the positive sign is larger. The inputs are compared (line @30,if@) based on magnitudes. If the signs were both -negative then the unsigned comparison is performed in the opposite direction (line @31,mp_cmp_mag@). Otherwise, the signs are assumed to -be both positive and a forward direction unsigned comparison is performed. - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 2 \right ]$ & Modify algorithm mp\_set\_int to accept as input a variable length array of bits. \\ - & \\ -$\left [ 3 \right ]$ & Give the probability that algorithm mp\_cmp\_mag will have to compare $k$ digits \\ - & of two random digits (of equal magnitude) before a difference is found. \\ - & \\ -$\left [ 1 \right ]$ & Suggest a simple method to speed up the implementation of mp\_cmp\_mag based \\ - & on the observations made in the previous problem. \\ - & -\end{tabular} - -\chapter{Basic Arithmetic} -\section{Introduction} -At this point algorithms for initialization, clearing, zeroing, copying, comparing and setting small constants have been -established. The next logical set of algorithms to develop are addition, subtraction and digit shifting algorithms. These -algorithms make use of the lower level algorithms and are the cruicial building block for the multiplication algorithms. It is very important -that these algorithms are highly optimized. On their own they are simple $O(n)$ algorithms but they can be called from higher level algorithms -which easily places them at $O(n^2)$ or even $O(n^3)$ work levels. - -MARK,SHIFTS -All of the algorithms within this chapter make use of the logical bit shift operations denoted by $<<$ and $>>$ for left and right -logical shifts respectively. A logical shift is analogous to sliding the decimal point of radix-10 representations. For example, the real -number $0.9345$ is equivalent to $93.45\%$ which is found by sliding the the decimal two places to the right (\textit{multiplying by $\beta^2 = 10^2$}). -Algebraically a binary logical shift is equivalent to a division or multiplication by a power of two. -For example, $a << k = a \cdot 2^k$ while $a >> k = \lfloor a/2^k \rfloor$. - -One significant difference between a logical shift and the way decimals are shifted is that digits below the zero'th position are removed -from the number. For example, consider $1101_2 >> 1$ using decimal notation this would produce $110.1_2$. However, with a logical shift the -result is $110_2$. - -\section{Addition and Subtraction} -In common twos complement fixed precision arithmetic negative numbers are easily represented by subtraction from the modulus. For example, with 32-bit integers -$a - b\mbox{ (mod }2^{32}\mbox{)}$ is the same as $a + (2^{32} - b) \mbox{ (mod }2^{32}\mbox{)}$ since $2^{32} \equiv 0 \mbox{ (mod }2^{32}\mbox{)}$. -As a result subtraction can be performed with a trivial series of logical operations and an addition. - -However, in multiple precision arithmetic negative numbers are not represented in the same way. Instead a sign flag is used to keep track of the -sign of the integer. As a result signed addition and subtraction are actually implemented as conditional usage of lower level addition or -subtraction algorithms with the sign fixed up appropriately. - -The lower level algorithms will add or subtract integers without regard to the sign flag. That is they will add or subtract the magnitude of -the integers respectively. - -\subsection{Low Level Addition} -An unsigned addition of multiple precision integers is performed with the same long-hand algorithm used to add decimal numbers. That is to add the -trailing digits first and propagate the resulting carry upwards. Since this is a lower level algorithm the name will have a ``s\_'' prefix. -Historically that convention stems from the MPI library where ``s\_'' stood for static functions that were hidden from the developer entirely. - -\newpage -\begin{figure}[!here] -\begin{center} -\begin{small} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_add}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. The unsigned addition $c = \vert a \vert + \vert b \vert$. \\ -\hline \\ -1. if $a.used > b.used$ then \\ -\hspace{+3mm}1.1 $min \leftarrow b.used$ \\ -\hspace{+3mm}1.2 $max \leftarrow a.used$ \\ -\hspace{+3mm}1.3 $x \leftarrow a$ \\ -2. else \\ -\hspace{+3mm}2.1 $min \leftarrow a.used$ \\ -\hspace{+3mm}2.2 $max \leftarrow b.used$ \\ -\hspace{+3mm}2.3 $x \leftarrow b$ \\ -3. If $c.alloc < max + 1$ then grow $c$ to hold at least $max + 1$ digits (\textit{mp\_grow}) \\ -4. $oldused \leftarrow c.used$ \\ -5. $c.used \leftarrow max + 1$ \\ -6. $u \leftarrow 0$ \\ -7. for $n$ from $0$ to $min - 1$ do \\ -\hspace{+3mm}7.1 $c_n \leftarrow a_n + b_n + u$ \\ -\hspace{+3mm}7.2 $u \leftarrow c_n >> lg(\beta)$ \\ -\hspace{+3mm}7.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -8. if $min \ne max$ then do \\ -\hspace{+3mm}8.1 for $n$ from $min$ to $max - 1$ do \\ -\hspace{+6mm}8.1.1 $c_n \leftarrow x_n + u$ \\ -\hspace{+6mm}8.1.2 $u \leftarrow c_n >> lg(\beta)$ \\ -\hspace{+6mm}8.1.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -9. $c_{max} \leftarrow u$ \\ -10. if $olduse > max$ then \\ -\hspace{+3mm}10.1 for $n$ from $max + 1$ to $oldused - 1$ do \\ -\hspace{+6mm}10.1.1 $c_n \leftarrow 0$ \\ -11. Clamp excess digits in $c$. (\textit{mp\_clamp}) \\ -12. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Algorithm s\_mp\_add} -\end{figure} - -\textbf{Algorithm s\_mp\_add.} -This algorithm is loosely based on algorithm 14.7 of HAC \cite[pp. 594]{HAC} but has been extended to allow the inputs to have different magnitudes. -Coincidentally the description of algorithm A in Knuth \cite[pp. 266]{TAOCPV2} shares the same deficiency as the algorithm from \cite{HAC}. Even the -MIX pseudo machine code presented by Knuth \cite[pp. 266-267]{TAOCPV2} is incapable of handling inputs which are of different magnitudes. - -The first thing that has to be accomplished is to sort out which of the two inputs is the largest. The addition logic -will simply add all of the smallest input to the largest input and store that first part of the result in the -destination. Then it will apply a simpler addition loop to excess digits of the larger input. - -The first two steps will handle sorting the inputs such that $min$ and $max$ hold the digit counts of the two -inputs. The variable $x$ will be an mp\_int alias for the largest input or the second input $b$ if they have the -same number of digits. After the inputs are sorted the destination $c$ is grown as required to accomodate the sum -of the two inputs. The original \textbf{used} count of $c$ is copied and set to the new used count. - -At this point the first addition loop will go through as many digit positions that both inputs have. The carry -variable $\mu$ is set to zero outside the loop. Inside the loop an ``addition'' step requires three statements to produce -one digit of the summand. First -two digits from $a$ and $b$ are added together along with the carry $\mu$. The carry of this step is extracted and stored -in $\mu$ and finally the digit of the result $c_n$ is truncated within the range $0 \le c_n < \beta$. - -Now all of the digit positions that both inputs have in common have been exhausted. If $min \ne max$ then $x$ is an alias -for one of the inputs that has more digits. A simplified addition loop is then used to essentially copy the remaining digits -and the carry to the destination. - -The final carry is stored in $c_{max}$ and digits above $max$ upto $oldused$ are zeroed which completes the addition. - - -EXAM,bn_s_mp_add.c - -We first sort (lines @27,if@ to @35,}@) the inputs based on magnitude and determine the $min$ and $max$ variables. -Note that $x$ is a pointer to an mp\_int assigned to the largest input, in effect it is a local alias. Next we -grow the destination (@37,init@ to @42,}@) ensure that it can accomodate the result of the addition. - -Similar to the implementation of mp\_copy this function uses the braced code and local aliases coding style. The three aliases that are on -lines @56,tmpa@, @59,tmpb@ and @62,tmpc@ represent the two inputs and destination variables respectively. These aliases are used to ensure the -compiler does not have to dereference $a$, $b$ or $c$ (respectively) to access the digits of the respective mp\_int. - -The initial carry $u$ will be cleared (line @65,u = 0@), note that $u$ is of type mp\_digit which ensures type -compatibility within the implementation. The initial addition (line @66,for@ to @75,}@) adds digits from -both inputs until the smallest input runs out of digits. Similarly the conditional addition loop -(line @81,for@ to @90,}@) adds the remaining digits from the larger of the two inputs. The addition is finished -with the final carry being stored in $tmpc$ (line @94,tmpc++@). Note the ``++'' operator within the same expression. -After line @94,tmpc++@, $tmpc$ will point to the $c.used$'th digit of the mp\_int $c$. This is useful -for the next loop (line @97,for@ to @99,}@) which set any old upper digits to zero. - -\subsection{Low Level Subtraction} -The low level unsigned subtraction algorithm is very similar to the low level unsigned addition algorithm. The principle difference is that the -unsigned subtraction algorithm requires the result to be positive. That is when computing $a - b$ the condition $\vert a \vert \ge \vert b\vert$ must -be met for this algorithm to function properly. Keep in mind this low level algorithm is not meant to be used in higher level algorithms directly. -This algorithm as will be shown can be used to create functional signed addition and subtraction algorithms. - -MARK,GAMMA - -For this algorithm a new variable is required to make the description simpler. Recall from section 1.3.1 that a mp\_digit must be able to represent -the range $0 \le x < 2\beta$ for the algorithms to work correctly. However, it is allowable that a mp\_digit represent a larger range of values. For -this algorithm we will assume that the variable $\gamma$ represents the number of bits available in a -mp\_digit (\textit{this implies $2^{\gamma} > \beta$}). - -For example, the default for LibTomMath is to use a ``unsigned long'' for the mp\_digit ``type'' while $\beta = 2^{28}$. In ISO C an ``unsigned long'' -data type must be able to represent $0 \le x < 2^{32}$ meaning that in this case $\gamma \ge 32$. - -\newpage\begin{figure}[!here] -\begin{center} -\begin{small} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_sub}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ ($\vert a \vert \ge \vert b \vert$) \\ -\textbf{Output}. The unsigned subtraction $c = \vert a \vert - \vert b \vert$. \\ -\hline \\ -1. $min \leftarrow b.used$ \\ -2. $max \leftarrow a.used$ \\ -3. If $c.alloc < max$ then grow $c$ to hold at least $max$ digits. (\textit{mp\_grow}) \\ -4. $oldused \leftarrow c.used$ \\ -5. $c.used \leftarrow max$ \\ -6. $u \leftarrow 0$ \\ -7. for $n$ from $0$ to $min - 1$ do \\ -\hspace{3mm}7.1 $c_n \leftarrow a_n - b_n - u$ \\ -\hspace{3mm}7.2 $u \leftarrow c_n >> (\gamma - 1)$ \\ -\hspace{3mm}7.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -8. if $min < max$ then do \\ -\hspace{3mm}8.1 for $n$ from $min$ to $max - 1$ do \\ -\hspace{6mm}8.1.1 $c_n \leftarrow a_n - u$ \\ -\hspace{6mm}8.1.2 $u \leftarrow c_n >> (\gamma - 1)$ \\ -\hspace{6mm}8.1.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -9. if $oldused > max$ then do \\ -\hspace{3mm}9.1 for $n$ from $max$ to $oldused - 1$ do \\ -\hspace{6mm}9.1.1 $c_n \leftarrow 0$ \\ -10. Clamp excess digits of $c$. (\textit{mp\_clamp}). \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Algorithm s\_mp\_sub} -\end{figure} - -\textbf{Algorithm s\_mp\_sub.} -This algorithm performs the unsigned subtraction of two mp\_int variables under the restriction that the result must be positive. That is when -passing variables $a$ and $b$ the condition that $\vert a \vert \ge \vert b \vert$ must be met for the algorithm to function correctly. This -algorithm is loosely based on algorithm 14.9 \cite[pp. 595]{HAC} and is similar to algorithm S in \cite[pp. 267]{TAOCPV2} as well. As was the case -of the algorithm s\_mp\_add both other references lack discussion concerning various practical details such as when the inputs differ in magnitude. - -The initial sorting of the inputs is trivial in this algorithm since $a$ is guaranteed to have at least the same magnitude of $b$. Steps 1 and 2 -set the $min$ and $max$ variables. Unlike the addition routine there is guaranteed to be no carry which means that the final result can be at -most $max$ digits in length as opposed to $max + 1$. Similar to the addition algorithm the \textbf{used} count of $c$ is copied locally and -set to the maximal count for the operation. - -The subtraction loop that begins on step seven is essentially the same as the addition loop of algorithm s\_mp\_add except single precision -subtraction is used instead. Note the use of the $\gamma$ variable to extract the carry (\textit{also known as the borrow}) within the subtraction -loops. Under the assumption that two's complement single precision arithmetic is used this will successfully extract the desired carry. - -For example, consider subtracting $0101_2$ from $0100_2$ where $\gamma = 4$ and $\beta = 2$. The least significant bit will force a carry upwards to -the third bit which will be set to zero after the borrow. After the very first bit has been subtracted $4 - 1 \equiv 0011_2$ will remain, When the -third bit of $0101_2$ is subtracted from the result it will cause another carry. In this case though the carry will be forced to propagate all the -way to the most significant bit. - -Recall that $\beta < 2^{\gamma}$. This means that if a carry does occur just before the $lg(\beta)$'th bit it will propagate all the way to the most -significant bit. Thus, the high order bits of the mp\_digit that are not part of the actual digit will either be all zero, or all one. All that -is needed is a single zero or one bit for the carry. Therefore a single logical shift right by $\gamma - 1$ positions is sufficient to extract the -carry. This method of carry extraction may seem awkward but the reason for it becomes apparent when the implementation is discussed. - -If $b$ has a smaller magnitude than $a$ then step 9 will force the carry and copy operation to propagate through the larger input $a$ into $c$. Step -10 will ensure that any leading digits of $c$ above the $max$'th position are zeroed. - -EXAM,bn_s_mp_sub.c - -Like low level addition we ``sort'' the inputs. Except in this case the sorting is hardcoded -(lines @24,min@ and @25,max@). In reality the $min$ and $max$ variables are only aliases and are only -used to make the source code easier to read. Again the pointer alias optimization is used -within this algorithm. The aliases $tmpa$, $tmpb$ and $tmpc$ are initialized -(lines @42,tmpa@, @43,tmpb@ and @44,tmpc@) for $a$, $b$ and $c$ respectively. - -The first subtraction loop (lines @47,u = 0@ through @61,}@) subtract digits from both inputs until the smaller of -the two inputs has been exhausted. As remarked earlier there is an implementation reason for using the ``awkward'' -method of extracting the carry (line @57, >>@). The traditional method for extracting the carry would be to shift -by $lg(\beta)$ positions and logically AND the least significant bit. The AND operation is required because all of -the bits above the $\lg(\beta)$'th bit will be set to one after a carry occurs from subtraction. This carry -extraction requires two relatively cheap operations to extract the carry. The other method is to simply shift the -most significant bit to the least significant bit thus extracting the carry with a single cheap operation. This -optimization only works on twos compliment machines which is a safe assumption to make. - -If $a$ has a larger magnitude than $b$ an additional loop (lines @64,for@ through @73,}@) is required to propagate -the carry through $a$ and copy the result to $c$. - -\subsection{High Level Addition} -Now that both lower level addition and subtraction algorithms have been established an effective high level signed addition algorithm can be -established. This high level addition algorithm will be what other algorithms and developers will use to perform addition of mp\_int data -types. - -Recall from section 5.2 that an mp\_int represents an integer with an unsigned mantissa (\textit{the array of digits}) and a \textbf{sign} -flag. A high level addition is actually performed as a series of eight separate cases which can be optimized down to three unique cases. - -\begin{figure}[!here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_add}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. The signed addition $c = a + b$. \\ -\hline \\ -1. if $a.sign = b.sign$ then do \\ -\hspace{3mm}1.1 $c.sign \leftarrow a.sign$ \\ -\hspace{3mm}1.2 $c \leftarrow \vert a \vert + \vert b \vert$ (\textit{s\_mp\_add})\\ -2. else do \\ -\hspace{3mm}2.1 if $\vert a \vert < \vert b \vert$ then do (\textit{mp\_cmp\_mag}) \\ -\hspace{6mm}2.1.1 $c.sign \leftarrow b.sign$ \\ -\hspace{6mm}2.1.2 $c \leftarrow \vert b \vert - \vert a \vert$ (\textit{s\_mp\_sub}) \\ -\hspace{3mm}2.2 else do \\ -\hspace{6mm}2.2.1 $c.sign \leftarrow a.sign$ \\ -\hspace{6mm}2.2.2 $c \leftarrow \vert a \vert - \vert b \vert$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_add} -\end{figure} - -\textbf{Algorithm mp\_add.} -This algorithm performs the signed addition of two mp\_int variables. There is no reference algorithm to draw upon from -either \cite{TAOCPV2} or \cite{HAC} since they both only provide unsigned operations. The algorithm is fairly -straightforward but restricted since subtraction can only produce positive results. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|c|c|c|c|} -\hline \textbf{Sign of $a$} & \textbf{Sign of $b$} & \textbf{$\vert a \vert > \vert b \vert $} & \textbf{Unsigned Operation} & \textbf{Result Sign Flag} \\ -\hline $+$ & $+$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $+$ & $+$ & No & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $-$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $-$ & No & $c = a + b$ & $a.sign$ \\ -\hline &&&&\\ - -\hline $+$ & $-$ & No & $c = b - a$ & $b.sign$ \\ -\hline $-$ & $+$ & No & $c = b - a$ & $b.sign$ \\ - -\hline &&&&\\ - -\hline $+$ & $-$ & Yes & $c = a - b$ & $a.sign$ \\ -\hline $-$ & $+$ & Yes & $c = a - b$ & $a.sign$ \\ - -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Addition Guide Chart} -\label{fig:AddChart} -\end{figure} - -Figure~\ref{fig:AddChart} lists all of the eight possible input combinations and is sorted to show that only three -specific cases need to be handled. The return code of the unsigned operations at step 1.2, 2.1.2 and 2.2.2 are -forwarded to step three to check for errors. This simplifies the description of the algorithm considerably and best -follows how the implementation actually was achieved. - -Also note how the \textbf{sign} is set before the unsigned addition or subtraction is performed. Recall from the descriptions of algorithms -s\_mp\_add and s\_mp\_sub that the mp\_clamp function is used at the end to trim excess digits. The mp\_clamp algorithm will set the \textbf{sign} -to \textbf{MP\_ZPOS} when the \textbf{used} digit count reaches zero. - -For example, consider performing $-a + a$ with algorithm mp\_add. By the description of the algorithm the sign is set to \textbf{MP\_NEG} which would -produce a result of $-0$. However, since the sign is set first then the unsigned addition is performed the subsequent usage of algorithm mp\_clamp -within algorithm s\_mp\_add will force $-0$ to become $0$. - -EXAM,bn_mp_add.c - -The source code follows the algorithm fairly closely. The most notable new source code addition is the usage of the $res$ integer variable which -is used to pass result of the unsigned operations forward. Unlike in the algorithm, the variable $res$ is merely returned as is without -explicitly checking it and returning the constant \textbf{MP\_OKAY}. The observation is this algorithm will succeed or fail only if the lower -level functions do so. Returning their return code is sufficient. - -\subsection{High Level Subtraction} -The high level signed subtraction algorithm is essentially the same as the high level signed addition algorithm. - -\newpage\begin{figure}[!here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_sub}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. The signed subtraction $c = a - b$. \\ -\hline \\ -1. if $a.sign \ne b.sign$ then do \\ -\hspace{3mm}1.1 $c.sign \leftarrow a.sign$ \\ -\hspace{3mm}1.2 $c \leftarrow \vert a \vert + \vert b \vert$ (\textit{s\_mp\_add}) \\ -2. else do \\ -\hspace{3mm}2.1 if $\vert a \vert \ge \vert b \vert$ then do (\textit{mp\_cmp\_mag}) \\ -\hspace{6mm}2.1.1 $c.sign \leftarrow a.sign$ \\ -\hspace{6mm}2.1.2 $c \leftarrow \vert a \vert - \vert b \vert$ (\textit{s\_mp\_sub}) \\ -\hspace{3mm}2.2 else do \\ -\hspace{6mm}2.2.1 $c.sign \leftarrow \left \lbrace \begin{array}{ll} - MP\_ZPOS & \mbox{if }a.sign = MP\_NEG \\ - MP\_NEG & \mbox{otherwise} \\ - \end{array} \right .$ \\ -\hspace{6mm}2.2.2 $c \leftarrow \vert b \vert - \vert a \vert$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_sub} -\end{figure} - -\textbf{Algorithm mp\_sub.} -This algorithm performs the signed subtraction of two inputs. Similar to algorithm mp\_add there is no reference in either \cite{TAOCPV2} or -\cite{HAC}. Also this algorithm is restricted by algorithm s\_mp\_sub. Chart \ref{fig:SubChart} lists the eight possible inputs and -the operations required. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{|c|c|c|c|c|} -\hline \textbf{Sign of $a$} & \textbf{Sign of $b$} & \textbf{$\vert a \vert \ge \vert b \vert $} & \textbf{Unsigned Operation} & \textbf{Result Sign Flag} \\ -\hline $+$ & $-$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $+$ & $-$ & No & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $+$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $+$ & No & $c = a + b$ & $a.sign$ \\ -\hline &&&& \\ -\hline $+$ & $+$ & Yes & $c = a - b$ & $a.sign$ \\ -\hline $-$ & $-$ & Yes & $c = a - b$ & $a.sign$ \\ -\hline &&&& \\ -\hline $+$ & $+$ & No & $c = b - a$ & $\mbox{opposite of }a.sign$ \\ -\hline $-$ & $-$ & No & $c = b - a$ & $\mbox{opposite of }a.sign$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Subtraction Guide Chart} -\label{fig:SubChart} -\end{figure} - -Similar to the case of algorithm mp\_add the \textbf{sign} is set first before the unsigned addition or subtraction. That is to prevent the -algorithm from producing $-a - -a = -0$ as a result. - -EXAM,bn_mp_sub.c - -Much like the implementation of algorithm mp\_add the variable $res$ is used to catch the return code of the unsigned addition or subtraction operations -and forward it to the end of the function. On line @38, != MP_LT@ the ``not equal to'' \textbf{MP\_LT} expression is used to emulate a -``greater than or equal to'' comparison. - -\section{Bit and Digit Shifting} -MARK,POLY -It is quite common to think of a multiple precision integer as a polynomial in $x$, that is $y = f(\beta)$ where $f(x) = \sum_{i=0}^{n-1} a_i x^i$. -This notation arises within discussion of Montgomery and Diminished Radix Reduction as well as Karatsuba multiplication and squaring. - -In order to facilitate operations on polynomials in $x$ as above a series of simple ``digit'' algorithms have to be established. That is to shift -the digits left or right as well to shift individual bits of the digits left and right. It is important to note that not all ``shift'' operations -are on radix-$\beta$ digits. - -\subsection{Multiplication by Two} - -In a binary system where the radix is a power of two multiplication by two not only arises often in other algorithms it is a fairly efficient -operation to perform. A single precision logical shift left is sufficient to multiply a single digit by two. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul\_2}. \\ -\textbf{Input}. One mp\_int $a$ \\ -\textbf{Output}. $b = 2a$. \\ -\hline \\ -1. If $b.alloc < a.used + 1$ then grow $b$ to hold $a.used + 1$ digits. (\textit{mp\_grow}) \\ -2. $oldused \leftarrow b.used$ \\ -3. $b.used \leftarrow a.used$ \\ -4. $r \leftarrow 0$ \\ -5. for $n$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}5.1 $rr \leftarrow a_n >> (lg(\beta) - 1)$ \\ -\hspace{3mm}5.2 $b_n \leftarrow (a_n << 1) + r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}5.3 $r \leftarrow rr$ \\ -6. If $r \ne 0$ then do \\ -\hspace{3mm}6.1 $b_{n + 1} \leftarrow r$ \\ -\hspace{3mm}6.2 $b.used \leftarrow b.used + 1$ \\ -7. If $b.used < oldused - 1$ then do \\ -\hspace{3mm}7.1 for $n$ from $b.used$ to $oldused - 1$ do \\ -\hspace{6mm}7.1.1 $b_n \leftarrow 0$ \\ -8. $b.sign \leftarrow a.sign$ \\ -9. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul\_2} -\end{figure} - -\textbf{Algorithm mp\_mul\_2.} -This algorithm will quickly multiply a mp\_int by two provided $\beta$ is a power of two. Neither \cite{TAOCPV2} nor \cite{HAC} describe such -an algorithm despite the fact it arises often in other algorithms. The algorithm is setup much like the lower level algorithm s\_mp\_add since -it is for all intents and purposes equivalent to the operation $b = \vert a \vert + \vert a \vert$. - -Step 1 and 2 grow the input as required to accomodate the maximum number of \textbf{used} digits in the result. The initial \textbf{used} count -is set to $a.used$ at step 4. Only if there is a final carry will the \textbf{used} count require adjustment. - -Step 6 is an optimization implementation of the addition loop for this specific case. That is since the two values being added together -are the same there is no need to perform two reads from the digits of $a$. Step 6.1 performs a single precision shift on the current digit $a_n$ to -obtain what will be the carry for the next iteration. Step 6.2 calculates the $n$'th digit of the result as single precision shift of $a_n$ plus -the previous carry. Recall from ~SHIFTS~ that $a_n << 1$ is equivalent to $a_n \cdot 2$. An iteration of the addition loop is finished with -forwarding the carry to the next iteration. - -Step 7 takes care of any final carry by setting the $a.used$'th digit of the result to the carry and augmenting the \textbf{used} count of $b$. -Step 8 clears any leading digits of $b$ in case it originally had a larger magnitude than $a$. - -EXAM,bn_mp_mul_2.c - -This implementation is essentially an optimized implementation of s\_mp\_add for the case of doubling an input. The only noteworthy difference -is the use of the logical shift operator on line @52,<<@ to perform a single precision doubling. - -\subsection{Division by Two} -A division by two can just as easily be accomplished with a logical shift right as multiplication by two can be with a logical shift left. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div\_2}. \\ -\textbf{Input}. One mp\_int $a$ \\ -\textbf{Output}. $b = a/2$. \\ -\hline \\ -1. If $b.alloc < a.used$ then grow $b$ to hold $a.used$ digits. (\textit{mp\_grow}) \\ -2. If the reallocation failed return(\textit{MP\_MEM}). \\ -3. $oldused \leftarrow b.used$ \\ -4. $b.used \leftarrow a.used$ \\ -5. $r \leftarrow 0$ \\ -6. for $n$ from $b.used - 1$ to $0$ do \\ -\hspace{3mm}6.1 $rr \leftarrow a_n \mbox{ (mod }2\mbox{)}$\\ -\hspace{3mm}6.2 $b_n \leftarrow (a_n >> 1) + (r << (lg(\beta) - 1)) \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}6.3 $r \leftarrow rr$ \\ -7. If $b.used < oldused - 1$ then do \\ -\hspace{3mm}7.1 for $n$ from $b.used$ to $oldused - 1$ do \\ -\hspace{6mm}7.1.1 $b_n \leftarrow 0$ \\ -8. $b.sign \leftarrow a.sign$ \\ -9. Clamp excess digits of $b$. (\textit{mp\_clamp}) \\ -10. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div\_2} -\end{figure} - -\textbf{Algorithm mp\_div\_2.} -This algorithm will divide an mp\_int by two using logical shifts to the right. Like mp\_mul\_2 it uses a modified low level addition -core as the basis of the algorithm. Unlike mp\_mul\_2 the shift operations work from the leading digit to the trailing digit. The algorithm -could be written to work from the trailing digit to the leading digit however, it would have to stop one short of $a.used - 1$ digits to prevent -reading past the end of the array of digits. - -Essentially the loop at step 6 is similar to that of mp\_mul\_2 except the logical shifts go in the opposite direction and the carry is at the -least significant bit not the most significant bit. - -EXAM,bn_mp_div_2.c - -\section{Polynomial Basis Operations} -Recall from ~POLY~ that any integer can be represented as a polynomial in $x$ as $y = f(\beta)$. Such a representation is also known as -the polynomial basis \cite[pp. 48]{ROSE}. Given such a notation a multiplication or division by $x$ amounts to shifting whole digits a single -place. The need for such operations arises in several other higher level algorithms such as Barrett and Montgomery reduction, integer -division and Karatsuba multiplication. - -Converting from an array of digits to polynomial basis is very simple. Consider the integer $y \equiv (a_2, a_1, a_0)_{\beta}$ and recall that -$y = \sum_{i=0}^{2} a_i \beta^i$. Simply replace $\beta$ with $x$ and the expression is in polynomial basis. For example, $f(x) = 8x + 9$ is the -polynomial basis representation for $89$ using radix ten. That is, $f(10) = 8(10) + 9 = 89$. - -\subsection{Multiplication by $x$} - -Given a polynomial in $x$ such as $f(x) = a_n x^n + a_{n-1} x^{n-1} + ... + a_0$ multiplying by $x$ amounts to shifting the coefficients up one -degree. In this case $f(x) \cdot x = a_n x^{n+1} + a_{n-1} x^n + ... + a_0 x$. From a scalar basis point of view multiplying by $x$ is equivalent to -multiplying by the integer $\beta$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_lshd}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $a \leftarrow a \cdot \beta^b$ (equivalent to multiplication by $x^b$). \\ -\hline \\ -1. If $b \le 0$ then return(\textit{MP\_OKAY}). \\ -2. If $a.alloc < a.used + b$ then grow $a$ to at least $a.used + b$ digits. (\textit{mp\_grow}). \\ -3. If the reallocation failed return(\textit{MP\_MEM}). \\ -4. $a.used \leftarrow a.used + b$ \\ -5. $i \leftarrow a.used - 1$ \\ -6. $j \leftarrow a.used - 1 - b$ \\ -7. for $n$ from $a.used - 1$ to $b$ do \\ -\hspace{3mm}7.1 $a_{i} \leftarrow a_{j}$ \\ -\hspace{3mm}7.2 $i \leftarrow i - 1$ \\ -\hspace{3mm}7.3 $j \leftarrow j - 1$ \\ -8. for $n$ from 0 to $b - 1$ do \\ -\hspace{3mm}8.1 $a_n \leftarrow 0$ \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_lshd} -\end{figure} - -\textbf{Algorithm mp\_lshd.} -This algorithm multiplies an mp\_int by the $b$'th power of $x$. This is equivalent to multiplying by $\beta^b$. The algorithm differs -from the other algorithms presented so far as it performs the operation in place instead storing the result in a separate location. The -motivation behind this change is due to the way this function is typically used. Algorithms such as mp\_add store the result in an optionally -different third mp\_int because the original inputs are often still required. Algorithm mp\_lshd (\textit{and similarly algorithm mp\_rshd}) is -typically used on values where the original value is no longer required. The algorithm will return success immediately if -$b \le 0$ since the rest of algorithm is only valid when $b > 0$. - -First the destination $a$ is grown as required to accomodate the result. The counters $i$ and $j$ are used to form a \textit{sliding window} over -the digits of $a$ of length $b$. The head of the sliding window is at $i$ (\textit{the leading digit}) and the tail at $j$ (\textit{the trailing digit}). -The loop on step 7 copies the digit from the tail to the head. In each iteration the window is moved down one digit. The last loop on -step 8 sets the lower $b$ digits to zero. - -\newpage -FIGU,sliding_window,Sliding Window Movement - -EXAM,bn_mp_lshd.c - -The if statement (line @24,if@) ensures that the $b$ variable is greater than zero since we do not interpret negative -shift counts properly. The \textbf{used} count is incremented by $b$ before the copy loop begins. This elminates -the need for an additional variable in the for loop. The variable $top$ (line @42,top@) is an alias -for the leading digit while $bottom$ (line @45,bottom@) is an alias for the trailing edge. The aliases form a -window of exactly $b$ digits over the input. - -\subsection{Division by $x$} - -Division by powers of $x$ is easily achieved by shifting the digits right and removing any that will end up to the right of the zero'th digit. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_rshd}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $a \leftarrow a / \beta^b$ (Divide by $x^b$). \\ -\hline \\ -1. If $b \le 0$ then return. \\ -2. If $a.used \le b$ then do \\ -\hspace{3mm}2.1 Zero $a$. (\textit{mp\_zero}). \\ -\hspace{3mm}2.2 Return. \\ -3. $i \leftarrow 0$ \\ -4. $j \leftarrow b$ \\ -5. for $n$ from 0 to $a.used - b - 1$ do \\ -\hspace{3mm}5.1 $a_i \leftarrow a_j$ \\ -\hspace{3mm}5.2 $i \leftarrow i + 1$ \\ -\hspace{3mm}5.3 $j \leftarrow j + 1$ \\ -6. for $n$ from $a.used - b$ to $a.used - 1$ do \\ -\hspace{3mm}6.1 $a_n \leftarrow 0$ \\ -7. $a.used \leftarrow a.used - b$ \\ -8. Return. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_rshd} -\end{figure} - -\textbf{Algorithm mp\_rshd.} -This algorithm divides the input in place by the $b$'th power of $x$. It is analogous to dividing by a $\beta^b$ but much quicker since -it does not require single precision division. This algorithm does not actually return an error code as it cannot fail. - -If the input $b$ is less than one the algorithm quickly returns without performing any work. If the \textbf{used} count is less than or equal -to the shift count $b$ then it will simply zero the input and return. - -After the trivial cases of inputs have been handled the sliding window is setup. Much like the case of algorithm mp\_lshd a sliding window that -is $b$ digits wide is used to copy the digits. Unlike mp\_lshd the window slides in the opposite direction from the trailing to the leading digit. -Also the digits are copied from the leading to the trailing edge. - -Once the window copy is complete the upper digits must be zeroed and the \textbf{used} count decremented. - -EXAM,bn_mp_rshd.c - -The only noteworthy element of this routine is the lack of a return type since it cannot fail. Like mp\_lshd() we -form a sliding window except we copy in the other direction. After the window (line @59,for (;@) we then zero -the upper digits of the input to make sure the result is correct. - -\section{Powers of Two} - -Now that algorithms for moving single bits as well as whole digits exist algorithms for moving the ``in between'' distances are required. For -example, to quickly multiply by $2^k$ for any $k$ without using a full multiplier algorithm would prove useful. Instead of performing single -shifts $k$ times to achieve a multiplication by $2^{\pm k}$ a mixture of whole digit shifting and partial digit shifting is employed. - -\subsection{Multiplication by Power of Two} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul\_2d}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $c \leftarrow a \cdot 2^b$. \\ -\hline \\ -1. $c \leftarrow a$. (\textit{mp\_copy}) \\ -2. If $c.alloc < c.used + \lfloor b / lg(\beta) \rfloor + 2$ then grow $c$ accordingly. \\ -3. If the reallocation failed return(\textit{MP\_MEM}). \\ -4. If $b \ge lg(\beta)$ then \\ -\hspace{3mm}4.1 $c \leftarrow c \cdot \beta^{\lfloor b / lg(\beta) \rfloor}$ (\textit{mp\_lshd}). \\ -\hspace{3mm}4.2 If step 4.1 failed return(\textit{MP\_MEM}). \\ -5. $d \leftarrow b \mbox{ (mod }lg(\beta)\mbox{)}$ \\ -6. If $d \ne 0$ then do \\ -\hspace{3mm}6.1 $mask \leftarrow 2^d$ \\ -\hspace{3mm}6.2 $r \leftarrow 0$ \\ -\hspace{3mm}6.3 for $n$ from $0$ to $c.used - 1$ do \\ -\hspace{6mm}6.3.1 $rr \leftarrow c_n >> (lg(\beta) - d) \mbox{ (mod }mask\mbox{)}$ \\ -\hspace{6mm}6.3.2 $c_n \leftarrow (c_n << d) + r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}6.3.3 $r \leftarrow rr$ \\ -\hspace{3mm}6.4 If $r > 0$ then do \\ -\hspace{6mm}6.4.1 $c_{c.used} \leftarrow r$ \\ -\hspace{6mm}6.4.2 $c.used \leftarrow c.used + 1$ \\ -7. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul\_2d} -\end{figure} - -\textbf{Algorithm mp\_mul\_2d.} -This algorithm multiplies $a$ by $2^b$ and stores the result in $c$. The algorithm uses algorithm mp\_lshd and a derivative of algorithm mp\_mul\_2 to -quickly compute the product. - -First the algorithm will multiply $a$ by $x^{\lfloor b / lg(\beta) \rfloor}$ which will ensure that the remainder multiplicand is less than -$\beta$. For example, if $b = 37$ and $\beta = 2^{28}$ then this step will multiply by $x$ leaving a multiplication by $2^{37 - 28} = 2^{9}$ -left. - -After the digits have been shifted appropriately at most $lg(\beta) - 1$ shifts are left to perform. Step 5 calculates the number of remaining shifts -required. If it is non-zero a modified shift loop is used to calculate the remaining product. -Essentially the loop is a generic version of algorithm mp\_mul\_2 designed to handle any shift count in the range $1 \le x < lg(\beta)$. The $mask$ -variable is used to extract the upper $d$ bits to form the carry for the next iteration. - -This algorithm is loosely measured as a $O(2n)$ algorithm which means that if the input is $n$-digits that it takes $2n$ ``time'' to -complete. It is possible to optimize this algorithm down to a $O(n)$ algorithm at a cost of making the algorithm slightly harder to follow. - -EXAM,bn_mp_mul_2d.c - -The shifting is performed in--place which means the first step (line @24,a != c@) is to copy the input to the -destination. We avoid calling mp\_copy() by making sure the mp\_ints are different. The destination then -has to be grown (line @31,grow@) to accomodate the result. - -If the shift count $b$ is larger than $lg(\beta)$ then a call to mp\_lshd() is used to handle all of the multiples -of $lg(\beta)$. Leaving only a remaining shift of $lg(\beta) - 1$ or fewer bits left. Inside the actual shift -loop (lines @45,if@ to @76,}@) we make use of pre--computed values $shift$ and $mask$. These are used to -extract the carry bit(s) to pass into the next iteration of the loop. The $r$ and $rr$ variables form a -chain between consecutive iterations to propagate the carry. - -\subsection{Division by Power of Two} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div\_2d}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $c \leftarrow \lfloor a / 2^b \rfloor, d \leftarrow a \mbox{ (mod }2^b\mbox{)}$. \\ -\hline \\ -1. If $b \le 0$ then do \\ -\hspace{3mm}1.1 $c \leftarrow a$ (\textit{mp\_copy}) \\ -\hspace{3mm}1.2 $d \leftarrow 0$ (\textit{mp\_zero}) \\ -\hspace{3mm}1.3 Return(\textit{MP\_OKAY}). \\ -2. $c \leftarrow a$ \\ -3. $d \leftarrow a \mbox{ (mod }2^b\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -4. If $b \ge lg(\beta)$ then do \\ -\hspace{3mm}4.1 $c \leftarrow \lfloor c/\beta^{\lfloor b/lg(\beta) \rfloor} \rfloor$ (\textit{mp\_rshd}). \\ -5. $k \leftarrow b \mbox{ (mod }lg(\beta)\mbox{)}$ \\ -6. If $k \ne 0$ then do \\ -\hspace{3mm}6.1 $mask \leftarrow 2^k$ \\ -\hspace{3mm}6.2 $r \leftarrow 0$ \\ -\hspace{3mm}6.3 for $n$ from $c.used - 1$ to $0$ do \\ -\hspace{6mm}6.3.1 $rr \leftarrow c_n \mbox{ (mod }mask\mbox{)}$ \\ -\hspace{6mm}6.3.2 $c_n \leftarrow (c_n >> k) + (r << (lg(\beta) - k))$ \\ -\hspace{6mm}6.3.3 $r \leftarrow rr$ \\ -7. Clamp excess digits of $c$. (\textit{mp\_clamp}) \\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div\_2d} -\end{figure} - -\textbf{Algorithm mp\_div\_2d.} -This algorithm will divide an input $a$ by $2^b$ and produce the quotient and remainder. The algorithm is designed much like algorithm -mp\_mul\_2d by first using whole digit shifts then single precision shifts. This algorithm will also produce the remainder of the division -by using algorithm mp\_mod\_2d. - -EXAM,bn_mp_div_2d.c - -The implementation of algorithm mp\_div\_2d is slightly different than the algorithm specifies. The remainder $d$ may be optionally -ignored by passing \textbf{NULL} as the pointer to the mp\_int variable. The temporary mp\_int variable $t$ is used to hold the -result of the remainder operation until the end. This allows $d$ and $a$ to represent the same mp\_int without modifying $a$ before -the quotient is obtained. - -The remainder of the source code is essentially the same as the source code for mp\_mul\_2d. The only significant difference is -the direction of the shifts. - -\subsection{Remainder of Division by Power of Two} - -The last algorithm in the series of polynomial basis power of two algorithms is calculating the remainder of division by $2^b$. This -algorithm benefits from the fact that in twos complement arithmetic $a \mbox{ (mod }2^b\mbox{)}$ is the same as $a$ AND $2^b - 1$. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mod\_2d}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $c \leftarrow a \mbox{ (mod }2^b\mbox{)}$. \\ -\hline \\ -1. If $b \le 0$ then do \\ -\hspace{3mm}1.1 $c \leftarrow 0$ (\textit{mp\_zero}) \\ -\hspace{3mm}1.2 Return(\textit{MP\_OKAY}). \\ -2. If $b > a.used \cdot lg(\beta)$ then do \\ -\hspace{3mm}2.1 $c \leftarrow a$ (\textit{mp\_copy}) \\ -\hspace{3mm}2.2 Return the result of step 2.1. \\ -3. $c \leftarrow a$ \\ -4. If step 3 failed return(\textit{MP\_MEM}). \\ -5. for $n$ from $\lceil b / lg(\beta) \rceil$ to $c.used$ do \\ -\hspace{3mm}5.1 $c_n \leftarrow 0$ \\ -6. $k \leftarrow b \mbox{ (mod }lg(\beta)\mbox{)}$ \\ -7. $c_{\lfloor b / lg(\beta) \rfloor} \leftarrow c_{\lfloor b / lg(\beta) \rfloor} \mbox{ (mod }2^{k}\mbox{)}$. \\ -8. Clamp excess digits of $c$. (\textit{mp\_clamp}) \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mod\_2d} -\end{figure} - -\textbf{Algorithm mp\_mod\_2d.} -This algorithm will quickly calculate the value of $a \mbox{ (mod }2^b\mbox{)}$. First if $b$ is less than or equal to zero the -result is set to zero. If $b$ is greater than the number of bits in $a$ then it simply copies $a$ to $c$ and returns. Otherwise, $a$ -is copied to $b$, leading digits are removed and the remaining leading digit is trimed to the exact bit count. - -EXAM,bn_mp_mod_2d.c - -We first avoid cases of $b \le 0$ by simply mp\_zero()'ing the destination in such cases. Next if $2^b$ is larger -than the input we just mp\_copy() the input and return right away. After this point we know we must actually -perform some work to produce the remainder. - -Recalling that reducing modulo $2^k$ and a binary ``and'' with $2^k - 1$ are numerically equivalent we can quickly reduce -the number. First we zero any digits above the last digit in $2^b$ (line @41,for@). Next we reduce the -leading digit of both (line @45,&=@) and then mp\_clamp(). - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 3 \right ] $ & Devise an algorithm that performs $a \cdot 2^b$ for generic values of $b$ \\ - & in $O(n)$ time. \\ - &\\ -$\left [ 3 \right ] $ & Devise an efficient algorithm to multiply by small low hamming \\ - & weight values such as $3$, $5$ and $9$. Extend it to handle all values \\ - & upto $64$ with a hamming weight less than three. \\ - &\\ -$\left [ 2 \right ] $ & Modify the preceding algorithm to handle values of the form \\ - & $2^k - 1$ as well. \\ - &\\ -$\left [ 3 \right ] $ & Using only algorithms mp\_mul\_2, mp\_div\_2 and mp\_add create an \\ - & algorithm to multiply two integers in roughly $O(2n^2)$ time for \\ - & any $n$-bit input. Note that the time of addition is ignored in the \\ - & calculation. \\ - & \\ -$\left [ 5 \right ] $ & Improve the previous algorithm to have a working time of at most \\ - & $O \left (2^{(k-1)}n + \left ({2n^2 \over k} \right ) \right )$ for an appropriate choice of $k$. Again ignore \\ - & the cost of addition. \\ - & \\ -$\left [ 2 \right ] $ & Devise a chart to find optimal values of $k$ for the previous problem \\ - & for $n = 64 \ldots 1024$ in steps of $64$. \\ - & \\ -$\left [ 2 \right ] $ & Using only algorithms mp\_abs and mp\_sub devise another method for \\ - & calculating the result of a signed comparison. \\ - & -\end{tabular} - -\chapter{Multiplication and Squaring} -\section{The Multipliers} -For most number theoretic problems including certain public key cryptographic algorithms, the ``multipliers'' form the most important subset of -algorithms of any multiple precision integer package. The set of multiplier algorithms include integer multiplication, squaring and modular reduction -where in each of the algorithms single precision multiplication is the dominant operation performed. This chapter will discuss integer multiplication -and squaring, leaving modular reductions for the subsequent chapter. - -The importance of the multiplier algorithms is for the most part driven by the fact that certain popular public key algorithms are based on modular -exponentiation, that is computing $d \equiv a^b \mbox{ (mod }c\mbox{)}$ for some arbitrary choice of $a$, $b$, $c$ and $d$. During a modular -exponentiation the majority\footnote{Roughly speaking a modular exponentiation will spend about 40\% of the time performing modular reductions, -35\% of the time performing squaring and 25\% of the time performing multiplications.} of the processor time is spent performing single precision -multiplications. - -For centuries general purpose multiplication has required a lengthly $O(n^2)$ process, whereby each digit of one multiplicand has to be multiplied -against every digit of the other multiplicand. Traditional long-hand multiplication is based on this process; while the techniques can differ the -overall algorithm used is essentially the same. Only ``recently'' have faster algorithms been studied. First Karatsuba multiplication was discovered in -1962. This algorithm can multiply two numbers with considerably fewer single precision multiplications when compared to the long-hand approach. -This technique led to the discovery of polynomial basis algorithms (\textit{good reference?}) and subquently Fourier Transform based solutions. - -\section{Multiplication} -\subsection{The Baseline Multiplication} -\label{sec:basemult} -\index{baseline multiplication} -Computing the product of two integers in software can be achieved using a trivial adaptation of the standard $O(n^2)$ long-hand multiplication -algorithm that school children are taught. The algorithm is considered an $O(n^2)$ algorithm since for two $n$-digit inputs $n^2$ single precision -multiplications are required. More specifically for a $m$ and $n$ digit input $m \cdot n$ single precision multiplications are required. To -simplify most discussions, it will be assumed that the inputs have comparable number of digits. - -The ``baseline multiplication'' algorithm is designed to act as the ``catch-all'' algorithm, only to be used when the faster algorithms cannot be -used. This algorithm does not use any particularly interesting optimizations and should ideally be avoided if possible. One important -facet of this algorithm, is that it has been modified to only produce a certain amount of output digits as resolution. The importance of this -modification will become evident during the discussion of Barrett modular reduction. Recall that for a $n$ and $m$ digit input the product -will be at most $n + m$ digits. Therefore, this algorithm can be reduced to a full multiplier by having it produce $n + m$ digits of the product. - -Recall from ~GAMMA~ the definition of $\gamma$ as the number of bits in the type \textbf{mp\_digit}. We shall now extend the variable set to -include $\alpha$ which shall represent the number of bits in the type \textbf{mp\_word}. This implies that $2^{\alpha} > 2 \cdot \beta^2$. The -constant $\delta = 2^{\alpha - 2lg(\beta)}$ will represent the maximal weight of any column in a product (\textit{see ~COMBA~ for more information}). - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_mul\_digs}. \\ -\textbf{Input}. mp\_int $a$, mp\_int $b$ and an integer $digs$ \\ -\textbf{Output}. $c \leftarrow \vert a \vert \cdot \vert b \vert \mbox{ (mod }\beta^{digs}\mbox{)}$. \\ -\hline \\ -1. If min$(a.used, b.used) < \delta$ then do \\ -\hspace{3mm}1.1 Calculate $c = \vert a \vert \cdot \vert b \vert$ by the Comba method (\textit{see algorithm~\ref{fig:COMBAMULT}}). \\ -\hspace{3mm}1.2 Return the result of step 1.1 \\ -\\ -Allocate and initialize a temporary mp\_int. \\ -2. Init $t$ to be of size $digs$ \\ -3. If step 2 failed return(\textit{MP\_MEM}). \\ -4. $t.used \leftarrow digs$ \\ -\\ -Compute the product. \\ -5. for $ix$ from $0$ to $a.used - 1$ do \\ -\hspace{3mm}5.1 $u \leftarrow 0$ \\ -\hspace{3mm}5.2 $pb \leftarrow \mbox{min}(b.used, digs - ix)$ \\ -\hspace{3mm}5.3 If $pb < 1$ then goto step 6. \\ -\hspace{3mm}5.4 for $iy$ from $0$ to $pb - 1$ do \\ -\hspace{6mm}5.4.1 $\hat r \leftarrow t_{iy + ix} + a_{ix} \cdot b_{iy} + u$ \\ -\hspace{6mm}5.4.2 $t_{iy + ix} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}5.4.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}5.5 if $ix + pb < digs$ then do \\ -\hspace{6mm}5.5.1 $t_{ix + pb} \leftarrow u$ \\ -6. Clamp excess digits of $t$. \\ -7. Swap $c$ with $t$ \\ -8. Clear $t$ \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_mul\_digs} -\end{figure} - -\textbf{Algorithm s\_mp\_mul\_digs.} -This algorithm computes the unsigned product of two inputs $a$ and $b$, limited to an output precision of $digs$ digits. While it may seem -a bit awkward to modify the function from its simple $O(n^2)$ description, the usefulness of partial multipliers will arise in a subsequent -algorithm. The algorithm is loosely based on algorithm 14.12 from \cite[pp. 595]{HAC} and is similar to Algorithm M of Knuth \cite[pp. 268]{TAOCPV2}. -Algorithm s\_mp\_mul\_digs differs from these cited references since it can produce a variable output precision regardless of the precision of the -inputs. - -The first thing this algorithm checks for is whether a Comba multiplier can be used instead. If the minimum digit count of either -input is less than $\delta$, then the Comba method may be used instead. After the Comba method is ruled out, the baseline algorithm begins. A -temporary mp\_int variable $t$ is used to hold the intermediate result of the product. This allows the algorithm to be used to -compute products when either $a = c$ or $b = c$ without overwriting the inputs. - -All of step 5 is the infamous $O(n^2)$ multiplication loop slightly modified to only produce upto $digs$ digits of output. The $pb$ variable -is given the count of digits to read from $b$ inside the nested loop. If $pb \le 1$ then no more output digits can be produced and the algorithm -will exit the loop. The best way to think of the loops are as a series of $pb \times 1$ multiplications. That is, in each pass of the -innermost loop $a_{ix}$ is multiplied against $b$ and the result is added (\textit{with an appropriate shift}) to $t$. - -For example, consider multiplying $576$ by $241$. That is equivalent to computing $10^0(1)(576) + 10^1(4)(576) + 10^2(2)(576)$ which is best -visualized in the following table. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{|c|c|c|c|c|c|l|} -\hline && & 5 & 7 & 6 & \\ -\hline $\times$&& & 2 & 4 & 1 & \\ -\hline &&&&&&\\ - && & 5 & 7 & 6 & $10^0(1)(576)$ \\ - &2 & 3 & 6 & 1 & 6 & $10^1(4)(576) + 10^0(1)(576)$ \\ - 1 & 3 & 8 & 8 & 1 & 6 & $10^2(2)(576) + 10^1(4)(576) + 10^0(1)(576)$ \\ -\hline -\end{tabular} -\end{center} -\caption{Long-Hand Multiplication Diagram} -\end{figure} - -Each row of the product is added to the result after being shifted to the left (\textit{multiplied by a power of the radix}) by the appropriate -count. That is in pass $ix$ of the inner loop the product is added starting at the $ix$'th digit of the reult. - -Step 5.4.1 introduces the hat symbol (\textit{e.g. $\hat r$}) which represents a double precision variable. The multiplication on that step -is assumed to be a double wide output single precision multiplication. That is, two single precision variables are multiplied to produce a -double precision result. The step is somewhat optimized from a long-hand multiplication algorithm because the carry from the addition in step -5.4.1 is propagated through the nested loop. If the carry was not propagated immediately it would overflow the single precision digit -$t_{ix+iy}$ and the result would be lost. - -At step 5.5 the nested loop is finished and any carry that was left over should be forwarded. The carry does not have to be added to the $ix+pb$'th -digit since that digit is assumed to be zero at this point. However, if $ix + pb \ge digs$ the carry is not set as it would make the result -exceed the precision requested. - -EXAM,bn_s_mp_mul_digs.c - -First we determine (line @30,if@) if the Comba method can be used first since it's faster. The conditions for -sing the Comba routine are that min$(a.used, b.used) < \delta$ and the number of digits of output is less than -\textbf{MP\_WARRAY}. This new constant is used to control the stack usage in the Comba routines. By default it is -set to $\delta$ but can be reduced when memory is at a premium. - -If we cannot use the Comba method we proceed to setup the baseline routine. We allocate the the destination mp\_int -$t$ (line @36,init@) to the exact size of the output to avoid further re--allocations. At this point we now -begin the $O(n^2)$ loop. - -This implementation of multiplication has the caveat that it can be trimmed to only produce a variable number of -digits as output. In each iteration of the outer loop the $pb$ variable is set (line @48,MIN@) to the maximum -number of inner loop iterations. - -Inside the inner loop we calculate $\hat r$ as the mp\_word product of the two mp\_digits and the addition of the -carry from the previous iteration. A particularly important observation is that most modern optimizing -C compilers (GCC for instance) can recognize that a $N \times N \rightarrow 2N$ multiplication is all that -is required for the product. In x86 terms for example, this means using the MUL instruction. - -Each digit of the product is stored in turn (line @68,tmpt@) and the carry propagated (line @71,>>@) to the -next iteration. - -\subsection{Faster Multiplication by the ``Comba'' Method} -MARK,COMBA - -One of the huge drawbacks of the ``baseline'' algorithms is that at the $O(n^2)$ level the carry must be -computed and propagated upwards. This makes the nested loop very sequential and hard to unroll and implement -in parallel. The ``Comba'' \cite{COMBA} method is named after little known (\textit{in cryptographic venues}) Paul G. -Comba who described a method of implementing fast multipliers that do not require nested carry fixup operations. As an -interesting aside it seems that Paul Barrett describes a similar technique in his 1986 paper \cite{BARRETT} written -five years before. - -At the heart of the Comba technique is once again the long-hand algorithm. Except in this case a slight -twist is placed on how the columns of the result are produced. In the standard long-hand algorithm rows of products -are produced then added together to form the final result. In the baseline algorithm the columns are added together -after each iteration to get the result instantaneously. - -In the Comba algorithm the columns of the result are produced entirely independently of each other. That is at -the $O(n^2)$ level a simple multiplication and addition step is performed. The carries of the columns are propagated -after the nested loop to reduce the amount of work requiored. Succintly the first step of the algorithm is to compute -the product vector $\vec x$ as follows. - -\begin{equation} -\vec x_n = \sum_{i+j = n} a_ib_j, \forall n \in \lbrace 0, 1, 2, \ldots, i + j \rbrace -\end{equation} - -Where $\vec x_n$ is the $n'th$ column of the output vector. Consider the following example which computes the vector $\vec x$ for the multiplication -of $576$ and $241$. - -\newpage\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|c|c|c|c|c|} - \hline & & 5 & 7 & 6 & First Input\\ - \hline $\times$ & & 2 & 4 & 1 & Second Input\\ -\hline & & $1 \cdot 5 = 5$ & $1 \cdot 7 = 7$ & $1 \cdot 6 = 6$ & First pass \\ - & $4 \cdot 5 = 20$ & $4 \cdot 7+5=33$ & $4 \cdot 6+7=31$ & 6 & Second pass \\ - $2 \cdot 5 = 10$ & $2 \cdot 7 + 20 = 34$ & $2 \cdot 6+33=45$ & 31 & 6 & Third pass \\ -\hline 10 & 34 & 45 & 31 & 6 & Final Result \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Comba Multiplication Diagram} -\end{figure} - -At this point the vector $x = \left < 10, 34, 45, 31, 6 \right >$ is the result of the first step of the Comba multipler. -Now the columns must be fixed by propagating the carry upwards. The resultant vector will have one extra dimension over the input vector which is -congruent to adding a leading zero digit. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Comba Fixup}. \\ -\textbf{Input}. Vector $\vec x$ of dimension $k$ \\ -\textbf{Output}. Vector $\vec x$ such that the carries have been propagated. \\ -\hline \\ -1. for $n$ from $0$ to $k - 1$ do \\ -\hspace{3mm}1.1 $\vec x_{n+1} \leftarrow \vec x_{n+1} + \lfloor \vec x_{n}/\beta \rfloor$ \\ -\hspace{3mm}1.2 $\vec x_{n} \leftarrow \vec x_{n} \mbox{ (mod }\beta\mbox{)}$ \\ -2. Return($\vec x$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Comba Fixup} -\end{figure} - -With that algorithm and $k = 5$ and $\beta = 10$ the following vector is produced $\vec x= \left < 1, 3, 8, 8, 1, 6 \right >$. In this case -$241 \cdot 576$ is in fact $138816$ and the procedure succeeded. If the algorithm is correct and as will be demonstrated shortly more -efficient than the baseline algorithm why not simply always use this algorithm? - -\subsubsection{Column Weight.} -At the nested $O(n^2)$ level the Comba method adds the product of two single precision variables to each column of the output -independently. A serious obstacle is if the carry is lost, due to lack of precision before the algorithm has a chance to fix -the carries. For example, in the multiplication of two three-digit numbers the third column of output will be the sum of -three single precision multiplications. If the precision of the accumulator for the output digits is less then $3 \cdot (\beta - 1)^2$ then -an overflow can occur and the carry information will be lost. For any $m$ and $n$ digit inputs the maximum weight of any column is -min$(m, n)$ which is fairly obvious. - -The maximum number of terms in any column of a product is known as the ``column weight'' and strictly governs when the algorithm can be used. Recall -from earlier that a double precision type has $\alpha$ bits of resolution and a single precision digit has $lg(\beta)$ bits of precision. Given these -two quantities we must not violate the following - -\begin{equation} -k \cdot \left (\beta - 1 \right )^2 < 2^{\alpha} -\end{equation} - -Which reduces to - -\begin{equation} -k \cdot \left ( \beta^2 - 2\beta + 1 \right ) < 2^{\alpha} -\end{equation} - -Let $\rho = lg(\beta)$ represent the number of bits in a single precision digit. By further re-arrangement of the equation the final solution is -found. - -\begin{equation} -k < {{2^{\alpha}} \over {\left (2^{2\rho} - 2^{\rho + 1} + 1 \right )}} -\end{equation} - -The defaults for LibTomMath are $\beta = 2^{28}$ and $\alpha = 2^{64}$ which means that $k$ is bounded by $k < 257$. In this configuration -the smaller input may not have more than $256$ digits if the Comba method is to be used. This is quite satisfactory for most applications since -$256$ digits would allow for numbers in the range of $0 \le x < 2^{7168}$ which, is much larger than most public key cryptographic algorithms require. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{fast\_s\_mp\_mul\_digs}. \\ -\textbf{Input}. mp\_int $a$, mp\_int $b$ and an integer $digs$ \\ -\textbf{Output}. $c \leftarrow \vert a \vert \cdot \vert b \vert \mbox{ (mod }\beta^{digs}\mbox{)}$. \\ -\hline \\ -Place an array of \textbf{MP\_WARRAY} single precision digits named $W$ on the stack. \\ -1. If $c.alloc < digs$ then grow $c$ to $digs$ digits. (\textit{mp\_grow}) \\ -2. If step 1 failed return(\textit{MP\_MEM}).\\ -\\ -3. $pa \leftarrow \mbox{MIN}(digs, a.used + b.used)$ \\ -\\ -4. $\_ \hat W \leftarrow 0$ \\ -5. for $ix$ from 0 to $pa - 1$ do \\ -\hspace{3mm}5.1 $ty \leftarrow \mbox{MIN}(b.used - 1, ix)$ \\ -\hspace{3mm}5.2 $tx \leftarrow ix - ty$ \\ -\hspace{3mm}5.3 $iy \leftarrow \mbox{MIN}(a.used - tx, ty + 1)$ \\ -\hspace{3mm}5.4 for $iz$ from 0 to $iy - 1$ do \\ -\hspace{6mm}5.4.1 $\_ \hat W \leftarrow \_ \hat W + a_{tx+iy}b_{ty-iy}$ \\ -\hspace{3mm}5.5 $W_{ix} \leftarrow \_ \hat W (\mbox{mod }\beta)$\\ -\hspace{3mm}5.6 $\_ \hat W \leftarrow \lfloor \_ \hat W / \beta \rfloor$ \\ -\\ -6. $oldused \leftarrow c.used$ \\ -7. $c.used \leftarrow digs$ \\ -8. for $ix$ from $0$ to $pa$ do \\ -\hspace{3mm}8.1 $c_{ix} \leftarrow W_{ix}$ \\ -9. for $ix$ from $pa + 1$ to $oldused - 1$ do \\ -\hspace{3mm}9.1 $c_{ix} \leftarrow 0$ \\ -\\ -10. Clamp $c$. \\ -11. Return MP\_OKAY. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm fast\_s\_mp\_mul\_digs} -\label{fig:COMBAMULT} -\end{figure} - -\textbf{Algorithm fast\_s\_mp\_mul\_digs.} -This algorithm performs the unsigned multiplication of $a$ and $b$ using the Comba method limited to $digs$ digits of precision. - -The outer loop of this algorithm is more complicated than that of the baseline multiplier. This is because on the inside of the -loop we want to produce one column per pass. This allows the accumulator $\_ \hat W$ to be placed in CPU registers and -reduce the memory bandwidth to two \textbf{mp\_digit} reads per iteration. - -The $ty$ variable is set to the minimum count of $ix$ or the number of digits in $b$. That way if $a$ has more digits than -$b$ this will be limited to $b.used - 1$. The $tx$ variable is set to the to the distance past $b.used$ the variable -$ix$ is. This is used for the immediately subsequent statement where we find $iy$. - -The variable $iy$ is the minimum digits we can read from either $a$ or $b$ before running out. Computing one column at a time -means we have to scan one integer upwards and the other downwards. $a$ starts at $tx$ and $b$ starts at $ty$. In each -pass we are producing the $ix$'th output column and we note that $tx + ty = ix$. As we move $tx$ upwards we have to -move $ty$ downards so the equality remains valid. The $iy$ variable is the number of iterations until -$tx \ge a.used$ or $ty < 0$ occurs. - -After every inner pass we store the lower half of the accumulator into $W_{ix}$ and then propagate the carry of the accumulator -into the next round by dividing $\_ \hat W$ by $\beta$. - -To measure the benefits of the Comba method over the baseline method consider the number of operations that are required. If the -cost in terms of time of a multiply and addition is $p$ and the cost of a carry propagation is $q$ then a baseline multiplication would require -$O \left ((p + q)n^2 \right )$ time to multiply two $n$-digit numbers. The Comba method requires only $O(pn^2 + qn)$ time, however in practice, -the speed increase is actually much more. With $O(n)$ space the algorithm can be reduced to $O(pn + qn)$ time by implementing the $n$ multiply -and addition operations in the nested loop in parallel. - -EXAM,bn_fast_s_mp_mul_digs.c - -As per the pseudo--code we first calculate $pa$ (line @47,MIN@) as the number of digits to output. Next we begin the outer loop -to produce the individual columns of the product. We use the two aliases $tmpx$ and $tmpy$ (lines @61,tmpx@, @62,tmpy@) to point -inside the two multiplicands quickly. - -The inner loop (lines @70,for@ to @72,}@) of this implementation is where the tradeoff come into play. Originally this comba -implementation was ``row--major'' which means it adds to each of the columns in each pass. After the outer loop it would then fix -the carries. This was very fast except it had an annoying drawback. You had to read a mp\_word and two mp\_digits and write -one mp\_word per iteration. On processors such as the Athlon XP and P4 this did not matter much since the cache bandwidth -is very high and it can keep the ALU fed with data. It did, however, matter on older and embedded cpus where cache is often -slower and also often doesn't exist. This new algorithm only performs two reads per iteration under the assumption that the -compiler has aliased $\_ \hat W$ to a CPU register. - -After the inner loop we store the current accumulator in $W$ and shift $\_ \hat W$ (lines @75,W[ix]@, @78,>>@) to forward it as -a carry for the next pass. After the outer loop we use the final carry (line @82,W[ix]@) as the last digit of the product. - -\subsection{Polynomial Basis Multiplication} -To break the $O(n^2)$ barrier in multiplication requires a completely different look at integer multiplication. In the following algorithms -the use of polynomial basis representation for two integers $a$ and $b$ as $f(x) = \sum_{i=0}^{n} a_i x^i$ and -$g(x) = \sum_{i=0}^{n} b_i x^i$ respectively, is required. In this system both $f(x)$ and $g(x)$ have $n + 1$ terms and are of the $n$'th degree. - -The product $a \cdot b \equiv f(x)g(x)$ is the polynomial $W(x) = \sum_{i=0}^{2n} w_i x^i$. The coefficients $w_i$ will -directly yield the desired product when $\beta$ is substituted for $x$. The direct solution to solve for the $2n + 1$ coefficients -requires $O(n^2)$ time and would in practice be slower than the Comba technique. - -However, numerical analysis theory indicates that only $2n + 1$ distinct points in $W(x)$ are required to determine the values of the $2n + 1$ unknown -coefficients. This means by finding $\zeta_y = W(y)$ for $2n + 1$ small values of $y$ the coefficients of $W(x)$ can be found with -Gaussian elimination. This technique is also occasionally refered to as the \textit{interpolation technique} (\textit{references please...}) since in -effect an interpolation based on $2n + 1$ points will yield a polynomial equivalent to $W(x)$. - -The coefficients of the polynomial $W(x)$ are unknown which makes finding $W(y)$ for any value of $y$ impossible. However, since -$W(x) = f(x)g(x)$ the equivalent $\zeta_y = f(y) g(y)$ can be used in its place. The benefit of this technique stems from the -fact that $f(y)$ and $g(y)$ are much smaller than either $a$ or $b$ respectively. As a result finding the $2n + 1$ relations required -by multiplying $f(y)g(y)$ involves multiplying integers that are much smaller than either of the inputs. - -When picking points to gather relations there are always three obvious points to choose, $y = 0, 1$ and $ \infty$. The $\zeta_0$ term -is simply the product $W(0) = w_0 = a_0 \cdot b_0$. The $\zeta_1$ term is the product -$W(1) = \left (\sum_{i = 0}^{n} a_i \right ) \left (\sum_{i = 0}^{n} b_i \right )$. The third point $\zeta_{\infty}$ is less obvious but rather -simple to explain. The $2n + 1$'th coefficient of $W(x)$ is numerically equivalent to the most significant column in an integer multiplication. -The point at $\infty$ is used symbolically to represent the most significant column, that is $W(\infty) = w_{2n} = a_nb_n$. Note that the -points at $y = 0$ and $\infty$ yield the coefficients $w_0$ and $w_{2n}$ directly. - -If more points are required they should be of small values and powers of two such as $2^q$ and the related \textit{mirror points} -$\left (2^q \right )^{2n} \cdot \zeta_{2^{-q}}$ for small values of $q$. The term ``mirror point'' stems from the fact that -$\left (2^q \right )^{2n} \cdot \zeta_{2^{-q}}$ can be calculated in the exact opposite fashion as $\zeta_{2^q}$. For -example, when $n = 2$ and $q = 1$ then following two equations are equivalent to the point $\zeta_{2}$ and its mirror. - -\begin{eqnarray} -\zeta_{2} = f(2)g(2) = (4a_2 + 2a_1 + a_0)(4b_2 + 2b_1 + b_0) \nonumber \\ -16 \cdot \zeta_{1 \over 2} = 4f({1\over 2}) \cdot 4g({1 \over 2}) = (a_2 + 2a_1 + 4a_0)(b_2 + 2b_1 + 4b_0) -\end{eqnarray} - -Using such points will allow the values of $f(y)$ and $g(y)$ to be independently calculated using only left shifts. For example, when $n = 2$ the -polynomial $f(2^q)$ is equal to $2^q((2^qa_2) + a_1) + a_0$. This technique of polynomial representation is known as Horner's method. - -As a general rule of the algorithm when the inputs are split into $n$ parts each there are $2n - 1$ multiplications. Each multiplication is of -multiplicands that have $n$ times fewer digits than the inputs. The asymptotic running time of this algorithm is -$O \left ( k^{lg_n(2n - 1)} \right )$ for $k$ digit inputs (\textit{assuming they have the same number of digits}). Figure~\ref{fig:exponent} -summarizes the exponents for various values of $n$. - -\begin{figure} -\begin{center} -\begin{tabular}{|c|c|c|} -\hline \textbf{Split into $n$ Parts} & \textbf{Exponent} & \textbf{Notes}\\ -\hline $2$ & $1.584962501$ & This is Karatsuba Multiplication. \\ -\hline $3$ & $1.464973520$ & This is Toom-Cook Multiplication. \\ -\hline $4$ & $1.403677461$ &\\ -\hline $5$ & $1.365212389$ &\\ -\hline $10$ & $1.278753601$ &\\ -\hline $100$ & $1.149426538$ &\\ -\hline $1000$ & $1.100270931$ &\\ -\hline $10000$ & $1.075252070$ &\\ -\hline -\end{tabular} -\end{center} -\caption{Asymptotic Running Time of Polynomial Basis Multiplication} -\label{fig:exponent} -\end{figure} - -At first it may seem like a good idea to choose $n = 1000$ since the exponent is approximately $1.1$. However, the overhead -of solving for the 2001 terms of $W(x)$ will certainly consume any savings the algorithm could offer for all but exceedingly large -numbers. - -\subsubsection{Cutoff Point} -The polynomial basis multiplication algorithms all require fewer single precision multiplications than a straight Comba approach. However, -the algorithms incur an overhead (\textit{at the $O(n)$ work level}) since they require a system of equations to be solved. This makes the -polynomial basis approach more costly to use with small inputs. - -Let $m$ represent the number of digits in the multiplicands (\textit{assume both multiplicands have the same number of digits}). There exists a -point $y$ such that when $m < y$ the polynomial basis algorithms are more costly than Comba, when $m = y$ they are roughly the same cost and -when $m > y$ the Comba methods are slower than the polynomial basis algorithms. - -The exact location of $y$ depends on several key architectural elements of the computer platform in question. - -\begin{enumerate} -\item The ratio of clock cycles for single precision multiplication versus other simpler operations such as addition, shifting, etc. For example -on the AMD Athlon the ratio is roughly $17 : 1$ while on the Intel P4 it is $29 : 1$. The higher the ratio in favour of multiplication the lower -the cutoff point $y$ will be. - -\item The complexity of the linear system of equations (\textit{for the coefficients of $W(x)$}) is. Generally speaking as the number of splits -grows the complexity grows substantially. Ideally solving the system will only involve addition, subtraction and shifting of integers. This -directly reflects on the ratio previous mentioned. - -\item To a lesser extent memory bandwidth and function call overheads. Provided the values are in the processor cache this is less of an -influence over the cutoff point. - -\end{enumerate} - -A clean cutoff point separation occurs when a point $y$ is found such that all of the cutoff point conditions are met. For example, if the point -is too low then there will be values of $m$ such that $m > y$ and the Comba method is still faster. Finding the cutoff points is fairly simple when -a high resolution timer is available. - -\subsection{Karatsuba Multiplication} -Karatsuba \cite{KARA} multiplication when originally proposed in 1962 was among the first set of algorithms to break the $O(n^2)$ barrier for -general purpose multiplication. Given two polynomial basis representations $f(x) = ax + b$ and $g(x) = cx + d$, Karatsuba proved with -light algebra \cite{KARAP} that the following polynomial is equivalent to multiplication of the two integers the polynomials represent. - -\begin{equation} -f(x) \cdot g(x) = acx^2 + ((a + b)(c + d) - (ac + bd))x + bd -\end{equation} - -Using the observation that $ac$ and $bd$ could be re-used only three half sized multiplications would be required to produce the product. Applying -this algorithm recursively, the work factor becomes $O(n^{lg(3)})$ which is substantially better than the work factor $O(n^2)$ of the Comba technique. It turns -out what Karatsuba did not know or at least did not publish was that this is simply polynomial basis multiplication with the points -$\zeta_0$, $\zeta_{\infty}$ and $\zeta_{1}$. Consider the resultant system of equations. - -\begin{center} -\begin{tabular}{rcrcrcrc} -$\zeta_{0}$ & $=$ & & & & & $w_0$ \\ -$\zeta_{1}$ & $=$ & $w_2$ & $+$ & $w_1$ & $+$ & $w_0$ \\ -$\zeta_{\infty}$ & $=$ & $w_2$ & & & & \\ -\end{tabular} -\end{center} - -By adding the first and last equation to the equation in the middle the term $w_1$ can be isolated and all three coefficients solved for. The simplicity -of this system of equations has made Karatsuba fairly popular. In fact the cutoff point is often fairly low\footnote{With LibTomMath 0.18 it is 70 and 109 digits for the Intel P4 and AMD Athlon respectively.} -making it an ideal algorithm to speed up certain public key cryptosystems such as RSA and Diffie-Hellman. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_karatsuba\_mul}. \\ -\textbf{Input}. mp\_int $a$ and mp\_int $b$ \\ -\textbf{Output}. $c \leftarrow \vert a \vert \cdot \vert b \vert$ \\ -\hline \\ -1. Init the following mp\_int variables: $x0$, $x1$, $y0$, $y1$, $t1$, $x0y0$, $x1y1$.\\ -2. If step 2 failed then return(\textit{MP\_MEM}). \\ -\\ -Split the input. e.g. $a = x1 \cdot \beta^B + x0$ \\ -3. $B \leftarrow \mbox{min}(a.used, b.used)/2$ \\ -4. $x0 \leftarrow a \mbox{ (mod }\beta^B\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -5. $y0 \leftarrow b \mbox{ (mod }\beta^B\mbox{)}$ \\ -6. $x1 \leftarrow \lfloor a / \beta^B \rfloor$ (\textit{mp\_rshd}) \\ -7. $y1 \leftarrow \lfloor b / \beta^B \rfloor$ \\ -\\ -Calculate the three products. \\ -8. $x0y0 \leftarrow x0 \cdot y0$ (\textit{mp\_mul}) \\ -9. $x1y1 \leftarrow x1 \cdot y1$ \\ -10. $t1 \leftarrow x1 + x0$ (\textit{mp\_add}) \\ -11. $x0 \leftarrow y1 + y0$ \\ -12. $t1 \leftarrow t1 \cdot x0$ \\ -\\ -Calculate the middle term. \\ -13. $x0 \leftarrow x0y0 + x1y1$ \\ -14. $t1 \leftarrow t1 - x0$ (\textit{s\_mp\_sub}) \\ -\\ -Calculate the final product. \\ -15. $t1 \leftarrow t1 \cdot \beta^B$ (\textit{mp\_lshd}) \\ -16. $x1y1 \leftarrow x1y1 \cdot \beta^{2B}$ \\ -17. $t1 \leftarrow x0y0 + t1$ \\ -18. $c \leftarrow t1 + x1y1$ \\ -19. Clear all of the temporary variables. \\ -20. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_karatsuba\_mul} -\end{figure} - -\textbf{Algorithm mp\_karatsuba\_mul.} -This algorithm computes the unsigned product of two inputs using the Karatsuba multiplication algorithm. It is loosely based on the description -from Knuth \cite[pp. 294-295]{TAOCPV2}. - -\index{radix point} -In order to split the two inputs into their respective halves, a suitable \textit{radix point} must be chosen. The radix point chosen must -be used for both of the inputs meaning that it must be smaller than the smallest input. Step 3 chooses the radix point $B$ as half of the -smallest input \textbf{used} count. After the radix point is chosen the inputs are split into lower and upper halves. Step 4 and 5 -compute the lower halves. Step 6 and 7 computer the upper halves. - -After the halves have been computed the three intermediate half-size products must be computed. Step 8 and 9 compute the trivial products -$x0 \cdot y0$ and $x1 \cdot y1$. The mp\_int $x0$ is used as a temporary variable after $x1 + x0$ has been computed. By using $x0$ instead -of an additional temporary variable, the algorithm can avoid an addition memory allocation operation. - -The remaining steps 13 through 18 compute the Karatsuba polynomial through a variety of digit shifting and addition operations. - -EXAM,bn_mp_karatsuba_mul.c - -The new coding element in this routine, not seen in previous routines, is the usage of goto statements. The conventional -wisdom is that goto statements should be avoided. This is generally true, however when every single function call can fail, it makes sense -to handle error recovery with a single piece of code. Lines @61,if@ to @75,if@ handle initializing all of the temporary variables -required. Note how each of the if statements goes to a different label in case of failure. This allows the routine to correctly free only -the temporaries that have been successfully allocated so far. - -The temporary variables are all initialized using the mp\_init\_size routine since they are expected to be large. This saves the -additional reallocation that would have been necessary. Also $x0$, $x1$, $y0$ and $y1$ have to be able to hold at least their respective -number of digits for the next section of code. - -The first algebraic portion of the algorithm is to split the two inputs into their halves. However, instead of using mp\_mod\_2d and mp\_rshd -to extract the halves, the respective code has been placed inline within the body of the function. To initialize the halves, the \textbf{used} and -\textbf{sign} members are copied first. The first for loop on line @98,for@ copies the lower halves. Since they are both the same magnitude it -is simpler to calculate both lower halves in a single loop. The for loop on lines @104,for@ and @109,for@ calculate the upper halves $x1$ and -$y1$ respectively. - -By inlining the calculation of the halves, the Karatsuba multiplier has a slightly lower overhead and can be used for smaller magnitude inputs. - -When line @152,err@ is reached, the algorithm has completed succesfully. The ``error status'' variable $err$ is set to \textbf{MP\_OKAY} so that -the same code that handles errors can be used to clear the temporary variables and return. - -\subsection{Toom-Cook $3$-Way Multiplication} -Toom-Cook $3$-Way \cite{TOOM} multiplication is essentially the polynomial basis algorithm for $n = 2$ except that the points are -chosen such that $\zeta$ is easy to compute and the resulting system of equations easy to reduce. Here, the points $\zeta_{0}$, -$16 \cdot \zeta_{1 \over 2}$, $\zeta_1$, $\zeta_2$ and $\zeta_{\infty}$ make up the five required points to solve for the coefficients -of the $W(x)$. - -With the five relations that Toom-Cook specifies, the following system of equations is formed. - -\begin{center} -\begin{tabular}{rcrcrcrcrcr} -$\zeta_0$ & $=$ & $0w_4$ & $+$ & $0w_3$ & $+$ & $0w_2$ & $+$ & $0w_1$ & $+$ & $1w_0$ \\ -$16 \cdot \zeta_{1 \over 2}$ & $=$ & $1w_4$ & $+$ & $2w_3$ & $+$ & $4w_2$ & $+$ & $8w_1$ & $+$ & $16w_0$ \\ -$\zeta_1$ & $=$ & $1w_4$ & $+$ & $1w_3$ & $+$ & $1w_2$ & $+$ & $1w_1$ & $+$ & $1w_0$ \\ -$\zeta_2$ & $=$ & $16w_4$ & $+$ & $8w_3$ & $+$ & $4w_2$ & $+$ & $2w_1$ & $+$ & $1w_0$ \\ -$\zeta_{\infty}$ & $=$ & $1w_4$ & $+$ & $0w_3$ & $+$ & $0w_2$ & $+$ & $0w_1$ & $+$ & $0w_0$ \\ -\end{tabular} -\end{center} - -A trivial solution to this matrix requires $12$ subtractions, two multiplications by a small power of two, two divisions by a small power -of two, two divisions by three and one multiplication by three. All of these $19$ sub-operations require less than quadratic time, meaning that -the algorithm can be faster than a baseline multiplication. However, the greater complexity of this algorithm places the cutoff point -(\textbf{TOOM\_MUL\_CUTOFF}) where Toom-Cook becomes more efficient much higher than the Karatsuba cutoff point. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_toom\_mul}. \\ -\textbf{Input}. mp\_int $a$ and mp\_int $b$ \\ -\textbf{Output}. $c \leftarrow a \cdot b $ \\ -\hline \\ -Split $a$ and $b$ into three pieces. E.g. $a = a_2 \beta^{2k} + a_1 \beta^{k} + a_0$ \\ -1. $k \leftarrow \lfloor \mbox{min}(a.used, b.used) / 3 \rfloor$ \\ -2. $a_0 \leftarrow a \mbox{ (mod }\beta^{k}\mbox{)}$ \\ -3. $a_1 \leftarrow \lfloor a / \beta^k \rfloor$, $a_1 \leftarrow a_1 \mbox{ (mod }\beta^{k}\mbox{)}$ \\ -4. $a_2 \leftarrow \lfloor a / \beta^{2k} \rfloor$, $a_2 \leftarrow a_2 \mbox{ (mod }\beta^{k}\mbox{)}$ \\ -5. $b_0 \leftarrow a \mbox{ (mod }\beta^{k}\mbox{)}$ \\ -6. $b_1 \leftarrow \lfloor a / \beta^k \rfloor$, $b_1 \leftarrow b_1 \mbox{ (mod }\beta^{k}\mbox{)}$ \\ -7. $b_2 \leftarrow \lfloor a / \beta^{2k} \rfloor$, $b_2 \leftarrow b_2 \mbox{ (mod }\beta^{k}\mbox{)}$ \\ -\\ -Find the five equations for $w_0, w_1, ..., w_4$. \\ -8. $w_0 \leftarrow a_0 \cdot b_0$ \\ -9. $w_4 \leftarrow a_2 \cdot b_2$ \\ -10. $tmp_1 \leftarrow 2 \cdot a_0$, $tmp_1 \leftarrow a_1 + tmp_1$, $tmp_1 \leftarrow 2 \cdot tmp_1$, $tmp_1 \leftarrow tmp_1 + a_2$ \\ -11. $tmp_2 \leftarrow 2 \cdot b_0$, $tmp_2 \leftarrow b_1 + tmp_2$, $tmp_2 \leftarrow 2 \cdot tmp_2$, $tmp_2 \leftarrow tmp_2 + b_2$ \\ -12. $w_1 \leftarrow tmp_1 \cdot tmp_2$ \\ -13. $tmp_1 \leftarrow 2 \cdot a_2$, $tmp_1 \leftarrow a_1 + tmp_1$, $tmp_1 \leftarrow 2 \cdot tmp_1$, $tmp_1 \leftarrow tmp_1 + a_0$ \\ -14. $tmp_2 \leftarrow 2 \cdot b_2$, $tmp_2 \leftarrow b_1 + tmp_2$, $tmp_2 \leftarrow 2 \cdot tmp_2$, $tmp_2 \leftarrow tmp_2 + b_0$ \\ -15. $w_3 \leftarrow tmp_1 \cdot tmp_2$ \\ -16. $tmp_1 \leftarrow a_0 + a_1$, $tmp_1 \leftarrow tmp_1 + a_2$, $tmp_2 \leftarrow b_0 + b_1$, $tmp_2 \leftarrow tmp_2 + b_2$ \\ -17. $w_2 \leftarrow tmp_1 \cdot tmp_2$ \\ -\\ -Continued on the next page.\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_toom\_mul} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_toom\_mul} (continued). \\ -\textbf{Input}. mp\_int $a$ and mp\_int $b$ \\ -\textbf{Output}. $c \leftarrow a \cdot b $ \\ -\hline \\ -Now solve the system of equations. \\ -18. $w_1 \leftarrow w_4 - w_1$, $w_3 \leftarrow w_3 - w_0$ \\ -19. $w_1 \leftarrow \lfloor w_1 / 2 \rfloor$, $w_3 \leftarrow \lfloor w_3 / 2 \rfloor$ \\ -20. $w_2 \leftarrow w_2 - w_0$, $w_2 \leftarrow w_2 - w_4$ \\ -21. $w_1 \leftarrow w_1 - w_2$, $w_3 \leftarrow w_3 - w_2$ \\ -22. $tmp_1 \leftarrow 8 \cdot w_0$, $w_1 \leftarrow w_1 - tmp_1$, $tmp_1 \leftarrow 8 \cdot w_4$, $w_3 \leftarrow w_3 - tmp_1$ \\ -23. $w_2 \leftarrow 3 \cdot w_2$, $w_2 \leftarrow w_2 - w_1$, $w_2 \leftarrow w_2 - w_3$ \\ -24. $w_1 \leftarrow w_1 - w_2$, $w_3 \leftarrow w_3 - w_2$ \\ -25. $w_1 \leftarrow \lfloor w_1 / 3 \rfloor, w_3 \leftarrow \lfloor w_3 / 3 \rfloor$ \\ -\\ -Now substitute $\beta^k$ for $x$ by shifting $w_0, w_1, ..., w_4$. \\ -26. for $n$ from $1$ to $4$ do \\ -\hspace{3mm}26.1 $w_n \leftarrow w_n \cdot \beta^{nk}$ \\ -27. $c \leftarrow w_0 + w_1$, $c \leftarrow c + w_2$, $c \leftarrow c + w_3$, $c \leftarrow c + w_4$ \\ -28. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_toom\_mul (continued)} -\end{figure} - -\textbf{Algorithm mp\_toom\_mul.} -This algorithm computes the product of two mp\_int variables $a$ and $b$ using the Toom-Cook approach. Compared to the Karatsuba multiplication, this -algorithm has a lower asymptotic running time of approximately $O(n^{1.464})$ but at an obvious cost in overhead. In this -description, several statements have been compounded to save space. The intention is that the statements are executed from left to right across -any given step. - -The two inputs $a$ and $b$ are first split into three $k$-digit integers $a_0, a_1, a_2$ and $b_0, b_1, b_2$ respectively. From these smaller -integers the coefficients of the polynomial basis representations $f(x)$ and $g(x)$ are known and can be used to find the relations required. - -The first two relations $w_0$ and $w_4$ are the points $\zeta_{0}$ and $\zeta_{\infty}$ respectively. The relation $w_1, w_2$ and $w_3$ correspond -to the points $16 \cdot \zeta_{1 \over 2}, \zeta_{2}$ and $\zeta_{1}$ respectively. These are found using logical shifts to independently find -$f(y)$ and $g(y)$ which significantly speeds up the algorithm. - -After the five relations $w_0, w_1, \ldots, w_4$ have been computed, the system they represent must be solved in order for the unknown coefficients -$w_1, w_2$ and $w_3$ to be isolated. The steps 18 through 25 perform the system reduction required as previously described. Each step of -the reduction represents the comparable matrix operation that would be performed had this been performed by pencil. For example, step 18 indicates -that row $1$ must be subtracted from row $4$ and simultaneously row $0$ subtracted from row $3$. - -Once the coeffients have been isolated, the polynomial $W(x) = \sum_{i=0}^{2n} w_i x^i$ is known. By substituting $\beta^{k}$ for $x$, the integer -result $a \cdot b$ is produced. - -EXAM,bn_mp_toom_mul.c - -The first obvious thing to note is that this algorithm is complicated. The complexity is worth it if you are multiplying very -large numbers. For example, a 10,000 digit multiplication takes approximaly 99,282,205 fewer single precision multiplications with -Toom--Cook than a Comba or baseline approach (this is a savings of more than 99$\%$). For most ``crypto'' sized numbers this -algorithm is not practical as Karatsuba has a much lower cutoff point. - -First we split $a$ and $b$ into three roughly equal portions. This has been accomplished (lines @40,mod@ to @69,rshd@) with -combinations of mp\_rshd() and mp\_mod\_2d() function calls. At this point $a = a2 \cdot \beta^2 + a1 \cdot \beta + a0$ and similiarly -for $b$. - -Next we compute the five points $w0, w1, w2, w3$ and $w4$. Recall that $w0$ and $w4$ can be computed directly from the portions so -we get those out of the way first (lines @72,mul@ and @77,mul@). Next we compute $w1, w2$ and $w3$ using Horners method. - -After this point we solve for the actual values of $w1, w2$ and $w3$ by reducing the $5 \times 5$ system which is relatively -straight forward. - -\subsection{Signed Multiplication} -Now that algorithms to handle multiplications of every useful dimensions have been developed, a rather simple finishing touch is required. So far all -of the multiplication algorithms have been unsigned multiplications which leaves only a signed multiplication algorithm to be established. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul}. \\ -\textbf{Input}. mp\_int $a$ and mp\_int $b$ \\ -\textbf{Output}. $c \leftarrow a \cdot b$ \\ -\hline \\ -1. If $a.sign = b.sign$ then \\ -\hspace{3mm}1.1 $sign = MP\_ZPOS$ \\ -2. else \\ -\hspace{3mm}2.1 $sign = MP\_ZNEG$ \\ -3. If min$(a.used, b.used) \ge TOOM\_MUL\_CUTOFF$ then \\ -\hspace{3mm}3.1 $c \leftarrow a \cdot b$ using algorithm mp\_toom\_mul \\ -4. else if min$(a.used, b.used) \ge KARATSUBA\_MUL\_CUTOFF$ then \\ -\hspace{3mm}4.1 $c \leftarrow a \cdot b$ using algorithm mp\_karatsuba\_mul \\ -5. else \\ -\hspace{3mm}5.1 $digs \leftarrow a.used + b.used + 1$ \\ -\hspace{3mm}5.2 If $digs < MP\_ARRAY$ and min$(a.used, b.used) \le \delta$ then \\ -\hspace{6mm}5.2.1 $c \leftarrow a \cdot b \mbox{ (mod }\beta^{digs}\mbox{)}$ using algorithm fast\_s\_mp\_mul\_digs. \\ -\hspace{3mm}5.3 else \\ -\hspace{6mm}5.3.1 $c \leftarrow a \cdot b \mbox{ (mod }\beta^{digs}\mbox{)}$ using algorithm s\_mp\_mul\_digs. \\ -6. $c.sign \leftarrow sign$ \\ -7. Return the result of the unsigned multiplication performed. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul} -\end{figure} - -\textbf{Algorithm mp\_mul.} -This algorithm performs the signed multiplication of two inputs. It will make use of any of the three unsigned multiplication algorithms -available when the input is of appropriate size. The \textbf{sign} of the result is not set until the end of the algorithm since algorithm -s\_mp\_mul\_digs will clear it. - -EXAM,bn_mp_mul.c - -The implementation is rather simplistic and is not particularly noteworthy. Line @22,?@ computes the sign of the result using the ``?'' -operator from the C programming language. Line @37,<<@ computes $\delta$ using the fact that $1 << k$ is equal to $2^k$. - -\section{Squaring} -\label{sec:basesquare} - -Squaring is a special case of multiplication where both multiplicands are equal. At first it may seem like there is no significant optimization -available but in fact there is. Consider the multiplication of $576$ against $241$. In total there will be nine single precision multiplications -performed which are $1\cdot 6$, $1 \cdot 7$, $1 \cdot 5$, $4 \cdot 6$, $4 \cdot 7$, $4 \cdot 5$, $2 \cdot 6$, $2 \cdot 7$ and $2 \cdot 5$. Now consider -the multiplication of $123$ against $123$. The nine products are $3 \cdot 3$, $3 \cdot 2$, $3 \cdot 1$, $2 \cdot 3$, $2 \cdot 2$, $2 \cdot 1$, -$1 \cdot 3$, $1 \cdot 2$ and $1 \cdot 1$. On closer inspection some of the products are equivalent. For example, $3 \cdot 2 = 2 \cdot 3$ -and $3 \cdot 1 = 1 \cdot 3$. - -For any $n$-digit input, there are ${{\left (n^2 + n \right)}\over 2}$ possible unique single precision multiplications required compared to the $n^2$ -required for multiplication. The following diagram gives an example of the operations required. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{ccccc|c} -&&1&2&3&\\ -$\times$ &&1&2&3&\\ -\hline && $3 \cdot 1$ & $3 \cdot 2$ & $3 \cdot 3$ & Row 0\\ - & $2 \cdot 1$ & $2 \cdot 2$ & $2 \cdot 3$ && Row 1 \\ - $1 \cdot 1$ & $1 \cdot 2$ & $1 \cdot 3$ &&& Row 2 \\ -\end{tabular} -\end{center} -\caption{Squaring Optimization Diagram} -\end{figure} - -MARK,SQUARE -Starting from zero and numbering the columns from right to left a very simple pattern becomes obvious. For the purposes of this discussion let $x$ -represent the number being squared. The first observation is that in row $k$ the $2k$'th column of the product has a $\left (x_k \right)^2$ term in it. - -The second observation is that every column $j$ in row $k$ where $j \ne 2k$ is part of a double product. Every non-square term of a column will -appear twice hence the name ``double product''. Every odd column is made up entirely of double products. In fact every column is made up of double -products and at most one square (\textit{see the exercise section}). - -The third and final observation is that for row $k$ the first unique non-square term, that is, one that hasn't already appeared in an earlier row, -occurs at column $2k + 1$. For example, on row $1$ of the previous squaring, column one is part of the double product with column one from row zero. -Column two of row one is a square and column three is the first unique column. - -\subsection{The Baseline Squaring Algorithm} -The baseline squaring algorithm is meant to be a catch-all squaring algorithm. It will handle any of the input sizes that the faster routines -will not handle. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -1. Init a temporary mp\_int of at least $2 \cdot a.used +1$ digits. (\textit{mp\_init\_size}) \\ -2. If step 1 failed return(\textit{MP\_MEM}) \\ -3. $t.used \leftarrow 2 \cdot a.used + 1$ \\ -4. For $ix$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}Calculate the square. \\ -\hspace{3mm}4.1 $\hat r \leftarrow t_{2ix} + \left (a_{ix} \right )^2$ \\ -\hspace{3mm}4.2 $t_{2ix} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}Calculate the double products after the square. \\ -\hspace{3mm}4.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}4.4 For $iy$ from $ix + 1$ to $a.used - 1$ do \\ -\hspace{6mm}4.4.1 $\hat r \leftarrow 2 \cdot a_{ix}a_{iy} + t_{ix + iy} + u$ \\ -\hspace{6mm}4.4.2 $t_{ix + iy} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}4.4.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}Set the last carry. \\ -\hspace{3mm}4.5 While $u > 0$ do \\ -\hspace{6mm}4.5.1 $iy \leftarrow iy + 1$ \\ -\hspace{6mm}4.5.2 $\hat r \leftarrow t_{ix + iy} + u$ \\ -\hspace{6mm}4.5.3 $t_{ix + iy} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}4.5.4 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -5. Clamp excess digits of $t$. (\textit{mp\_clamp}) \\ -6. Exchange $b$ and $t$. \\ -7. Clear $t$ (\textit{mp\_clear}) \\ -8. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_sqr} -\end{figure} - -\textbf{Algorithm s\_mp\_sqr.} -This algorithm computes the square of an input using the three observations on squaring. It is based fairly faithfully on algorithm 14.16 of HAC -\cite[pp.596-597]{HAC}. Similar to algorithm s\_mp\_mul\_digs, a temporary mp\_int is allocated to hold the result of the squaring. This allows the -destination mp\_int to be the same as the source mp\_int. - -The outer loop of this algorithm begins on step 4. It is best to think of the outer loop as walking down the rows of the partial results, while -the inner loop computes the columns of the partial result. Step 4.1 and 4.2 compute the square term for each row, and step 4.3 and 4.4 propagate -the carry and compute the double products. - -The requirement that a mp\_word be able to represent the range $0 \le x < 2 \beta^2$ arises from this -very algorithm. The product $a_{ix}a_{iy}$ will lie in the range $0 \le x \le \beta^2 - 2\beta + 1$ which is obviously less than $\beta^2$ meaning that -when it is multiplied by two, it can be properly represented by a mp\_word. - -Similar to algorithm s\_mp\_mul\_digs, after every pass of the inner loop, the destination is correctly set to the sum of all of the partial -results calculated so far. This involves expensive carry propagation which will be eliminated in the next algorithm. - -EXAM,bn_s_mp_sqr.c - -Inside the outer loop (line @32,for@) the square term is calculated on line @35,r =@. The carry (line @42,>>@) has been -extracted from the mp\_word accumulator using a right shift. Aliases for $a_{ix}$ and $t_{ix+iy}$ are initialized -(lines @45,tmpx@ and @48,tmpt@) to simplify the inner loop. The doubling is performed using two -additions (line @57,r + r@) since it is usually faster than shifting, if not at least as fast. - -The important observation is that the inner loop does not begin at $iy = 0$ like for multiplication. As such the inner loops -get progressively shorter as the algorithm proceeds. This is what leads to the savings compared to using a multiplication to -square a number. - -\subsection{Faster Squaring by the ``Comba'' Method} -A major drawback to the baseline method is the requirement for single precision shifting inside the $O(n^2)$ nested loop. Squaring has an additional -drawback that it must double the product inside the inner loop as well. As for multiplication, the Comba technique can be used to eliminate these -performance hazards. - -The first obvious solution is to make an array of mp\_words which will hold all of the columns. This will indeed eliminate all of the carry -propagation operations from the inner loop. However, the inner product must still be doubled $O(n^2)$ times. The solution stems from the simple fact -that $2a + 2b + 2c = 2(a + b + c)$. That is the sum of all of the double products is equal to double the sum of all the products. For example, -$ab + ba + ac + ca = 2ab + 2ac = 2(ab + ac)$. - -However, we cannot simply double all of the columns, since the squares appear only once per row. The most practical solution is to have two -mp\_word arrays. One array will hold the squares and the other array will hold the double products. With both arrays the doubling and -carry propagation can be moved to a $O(n)$ work level outside the $O(n^2)$ level. In this case, we have an even simpler solution in mind. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{fast\_s\_mp\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -Place an array of \textbf{MP\_WARRAY} mp\_digits named $W$ on the stack. \\ -1. If $b.alloc < 2a.used + 1$ then grow $b$ to $2a.used + 1$ digits. (\textit{mp\_grow}). \\ -2. If step 1 failed return(\textit{MP\_MEM}). \\ -\\ -3. $pa \leftarrow 2 \cdot a.used$ \\ -4. $\hat W1 \leftarrow 0$ \\ -5. for $ix$ from $0$ to $pa - 1$ do \\ -\hspace{3mm}5.1 $\_ \hat W \leftarrow 0$ \\ -\hspace{3mm}5.2 $ty \leftarrow \mbox{MIN}(a.used - 1, ix)$ \\ -\hspace{3mm}5.3 $tx \leftarrow ix - ty$ \\ -\hspace{3mm}5.4 $iy \leftarrow \mbox{MIN}(a.used - tx, ty + 1)$ \\ -\hspace{3mm}5.5 $iy \leftarrow \mbox{MIN}(iy, \lfloor \left (ty - tx + 1 \right )/2 \rfloor)$ \\ -\hspace{3mm}5.6 for $iz$ from $0$ to $iz - 1$ do \\ -\hspace{6mm}5.6.1 $\_ \hat W \leftarrow \_ \hat W + a_{tx + iz}a_{ty - iz}$ \\ -\hspace{3mm}5.7 $\_ \hat W \leftarrow 2 \cdot \_ \hat W + \hat W1$ \\ -\hspace{3mm}5.8 if $ix$ is even then \\ -\hspace{6mm}5.8.1 $\_ \hat W \leftarrow \_ \hat W + \left ( a_{\lfloor ix/2 \rfloor}\right )^2$ \\ -\hspace{3mm}5.9 $W_{ix} \leftarrow \_ \hat W (\mbox{mod }\beta)$ \\ -\hspace{3mm}5.10 $\hat W1 \leftarrow \lfloor \_ \hat W / \beta \rfloor$ \\ -\\ -6. $oldused \leftarrow b.used$ \\ -7. $b.used \leftarrow 2 \cdot a.used$ \\ -8. for $ix$ from $0$ to $pa - 1$ do \\ -\hspace{3mm}8.1 $b_{ix} \leftarrow W_{ix}$ \\ -9. for $ix$ from $pa$ to $oldused - 1$ do \\ -\hspace{3mm}9.1 $b_{ix} \leftarrow 0$ \\ -10. Clamp excess digits from $b$. (\textit{mp\_clamp}) \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm fast\_s\_mp\_sqr} -\end{figure} - -\textbf{Algorithm fast\_s\_mp\_sqr.} -This algorithm computes the square of an input using the Comba technique. It is designed to be a replacement for algorithm -s\_mp\_sqr when the number of input digits is less than \textbf{MP\_WARRAY} and less than $\delta \over 2$. -This algorithm is very similar to the Comba multiplier except with a few key differences we shall make note of. - -First, we have an accumulator and carry variables $\_ \hat W$ and $\hat W1$ respectively. This is because the inner loop -products are to be doubled. If we had added the previous carry in we would be doubling too much. Next we perform an -addition MIN condition on $iy$ (step 5.5) to prevent overlapping digits. For example, $a_3 \cdot a_5$ is equal -$a_5 \cdot a_3$. Whereas in the multiplication case we would have $5 < a.used$ and $3 \ge 0$ is maintained since we double the sum -of the products just outside the inner loop we have to avoid doing this. This is also a good thing since we perform -fewer multiplications and the routine ends up being faster. - -Finally the last difference is the addition of the ``square'' term outside the inner loop (step 5.8). We add in the square -only to even outputs and it is the square of the term at the $\lfloor ix / 2 \rfloor$ position. - -EXAM,bn_fast_s_mp_sqr.c - -This implementation is essentially a copy of Comba multiplication with the appropriate changes added to make it faster for -the special case of squaring. - -\subsection{Polynomial Basis Squaring} -The same algorithm that performs optimal polynomial basis multiplication can be used to perform polynomial basis squaring. The minor exception -is that $\zeta_y = f(y)g(y)$ is actually equivalent to $\zeta_y = f(y)^2$ since $f(y) = g(y)$. Instead of performing $2n + 1$ -multiplications to find the $\zeta$ relations, squaring operations are performed instead. - -\subsection{Karatsuba Squaring} -Let $f(x) = ax + b$ represent the polynomial basis representation of a number to square. -Let $h(x) = \left ( f(x) \right )^2$ represent the square of the polynomial. The Karatsuba equation can be modified to square a -number with the following equation. - -\begin{equation} -h(x) = a^2x^2 + \left ((a + b)^2 - (a^2 + b^2) \right )x + b^2 -\end{equation} - -Upon closer inspection this equation only requires the calculation of three half-sized squares: $a^2$, $b^2$ and $(a + b)^2$. As in -Karatsuba multiplication, this algorithm can be applied recursively on the input and will achieve an asymptotic running time of -$O \left ( n^{lg(3)} \right )$. - -If the asymptotic times of Karatsuba squaring and multiplication are the same, why not simply use the multiplication algorithm -instead? The answer to this arises from the cutoff point for squaring. As in multiplication there exists a cutoff point, at which the -time required for a Comba based squaring and a Karatsuba based squaring meet. Due to the overhead inherent in the Karatsuba method, the cutoff -point is fairly high. For example, on an AMD Athlon XP processor with $\beta = 2^{28}$, the cutoff point is around 127 digits. - -Consider squaring a 200 digit number with this technique. It will be split into two 100 digit halves which are subsequently squared. -The 100 digit halves will not be squared using Karatsuba, but instead using the faster Comba based squaring algorithm. If Karatsuba multiplication -were used instead, the 100 digit numbers would be squared with a slower Comba based multiplication. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_karatsuba\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -1. Initialize the following temporary mp\_ints: $x0$, $x1$, $t1$, $t2$, $x0x0$ and $x1x1$. \\ -2. If any of the initializations on step 1 failed return(\textit{MP\_MEM}). \\ -\\ -Split the input. e.g. $a = x1\beta^B + x0$ \\ -3. $B \leftarrow \lfloor a.used / 2 \rfloor$ \\ -4. $x0 \leftarrow a \mbox{ (mod }\beta^B\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -5. $x1 \leftarrow \lfloor a / \beta^B \rfloor$ (\textit{mp\_lshd}) \\ -\\ -Calculate the three squares. \\ -6. $x0x0 \leftarrow x0^2$ (\textit{mp\_sqr}) \\ -7. $x1x1 \leftarrow x1^2$ \\ -8. $t1 \leftarrow x1 + x0$ (\textit{s\_mp\_add}) \\ -9. $t1 \leftarrow t1^2$ \\ -\\ -Compute the middle term. \\ -10. $t2 \leftarrow x0x0 + x1x1$ (\textit{s\_mp\_add}) \\ -11. $t1 \leftarrow t1 - t2$ \\ -\\ -Compute final product. \\ -12. $t1 \leftarrow t1\beta^B$ (\textit{mp\_lshd}) \\ -13. $x1x1 \leftarrow x1x1\beta^{2B}$ \\ -14. $t1 \leftarrow t1 + x0x0$ \\ -15. $b \leftarrow t1 + x1x1$ \\ -16. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_karatsuba\_sqr} -\end{figure} - -\textbf{Algorithm mp\_karatsuba\_sqr.} -This algorithm computes the square of an input $a$ using the Karatsuba technique. This algorithm is very similar to the Karatsuba based -multiplication algorithm with the exception that the three half-size multiplications have been replaced with three half-size squarings. - -The radix point for squaring is simply placed exactly in the middle of the digits when the input has an odd number of digits, otherwise it is -placed just below the middle. Step 3, 4 and 5 compute the two halves required using $B$ -as the radix point. The first two squares in steps 6 and 7 are rather straightforward while the last square is of a more compact form. - -By expanding $\left (x1 + x0 \right )^2$, the $x1^2$ and $x0^2$ terms in the middle disappear, that is $(x0 - x1)^2 - (x1^2 + x0^2) = 2 \cdot x0 \cdot x1$. -Now if $5n$ single precision additions and a squaring of $n$-digits is faster than multiplying two $n$-digit numbers and doubling then -this method is faster. Assuming no further recursions occur, the difference can be estimated with the following inequality. - -Let $p$ represent the cost of a single precision addition and $q$ the cost of a single precision multiplication both in terms of time\footnote{Or -machine clock cycles.}. - -\begin{equation} -5pn +{{q(n^2 + n)} \over 2} \le pn + qn^2 -\end{equation} - -For example, on an AMD Athlon XP processor $p = {1 \over 3}$ and $q = 6$. This implies that the following inequality should hold. -\begin{center} -\begin{tabular}{rcl} -${5n \over 3} + 3n^2 + 3n$ & $<$ & ${n \over 3} + 6n^2$ \\ -${5 \over 3} + 3n + 3$ & $<$ & ${1 \over 3} + 6n$ \\ -${13 \over 9}$ & $<$ & $n$ \\ -\end{tabular} -\end{center} - -This results in a cutoff point around $n = 2$. As a consequence it is actually faster to compute the middle term the ``long way'' on processors -where multiplication is substantially slower\footnote{On the Athlon there is a 1:17 ratio between clock cycles for addition and multiplication. On -the Intel P4 processor this ratio is 1:29 making this method even more beneficial. The only common exception is the ARMv4 processor which has a -ratio of 1:7. } than simpler operations such as addition. - -EXAM,bn_mp_karatsuba_sqr.c - -This implementation is largely based on the implementation of algorithm mp\_karatsuba\_mul. It uses the same inline style to copy and -shift the input into the two halves. The loop from line @54,{@ to line @70,}@ has been modified since only one input exists. The \textbf{used} -count of both $x0$ and $x1$ is fixed up and $x0$ is clamped before the calculations begin. At this point $x1$ and $x0$ are valid equivalents -to the respective halves as if mp\_rshd and mp\_mod\_2d had been used. - -By inlining the copy and shift operations the cutoff point for Karatsuba multiplication can be lowered. On the Athlon the cutoff point -is exactly at the point where Comba squaring can no longer be used (\textit{128 digits}). On slower processors such as the Intel P4 -it is actually below the Comba limit (\textit{at 110 digits}). - -This routine uses the same error trap coding style as mp\_karatsuba\_sqr. As the temporary variables are initialized errors are -redirected to the error trap higher up. If the algorithm completes without error the error code is set to \textbf{MP\_OKAY} and -mp\_clears are executed normally. - -\subsection{Toom-Cook Squaring} -The Toom-Cook squaring algorithm mp\_toom\_sqr is heavily based on the algorithm mp\_toom\_mul with the exception that squarings are used -instead of multiplication to find the five relations. The reader is encouraged to read the description of the latter algorithm and try to -derive their own Toom-Cook squaring algorithm. - -\subsection{High Level Squaring} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -1. If $a.used \ge TOOM\_SQR\_CUTOFF$ then \\ -\hspace{3mm}1.1 $b \leftarrow a^2$ using algorithm mp\_toom\_sqr \\ -2. else if $a.used \ge KARATSUBA\_SQR\_CUTOFF$ then \\ -\hspace{3mm}2.1 $b \leftarrow a^2$ using algorithm mp\_karatsuba\_sqr \\ -3. else \\ -\hspace{3mm}3.1 $digs \leftarrow a.used + b.used + 1$ \\ -\hspace{3mm}3.2 If $digs < MP\_ARRAY$ and $a.used \le \delta$ then \\ -\hspace{6mm}3.2.1 $b \leftarrow a^2$ using algorithm fast\_s\_mp\_sqr. \\ -\hspace{3mm}3.3 else \\ -\hspace{6mm}3.3.1 $b \leftarrow a^2$ using algorithm s\_mp\_sqr. \\ -4. $b.sign \leftarrow MP\_ZPOS$ \\ -5. Return the result of the unsigned squaring performed. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_sqr} -\end{figure} - -\textbf{Algorithm mp\_sqr.} -This algorithm computes the square of the input using one of four different algorithms. If the input is very large and has at least -\textbf{TOOM\_SQR\_CUTOFF} or \textbf{KARATSUBA\_SQR\_CUTOFF} digits then either the Toom-Cook or the Karatsuba Squaring algorithm is used. If -neither of the polynomial basis algorithms should be used then either the Comba or baseline algorithm is used. - -EXAM,bn_mp_sqr.c - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 3 \right ] $ & Devise an efficient algorithm for selection of the radix point to handle inputs \\ - & that have different number of digits in Karatsuba multiplication. \\ - & \\ -$\left [ 2 \right ] $ & In ~SQUARE~ the fact that every column of a squaring is made up \\ - & of double products and at most one square is stated. Prove this statement. \\ - & \\ -$\left [ 3 \right ] $ & Prove the equation for Karatsuba squaring. \\ - & \\ -$\left [ 1 \right ] $ & Prove that Karatsuba squaring requires $O \left (n^{lg(3)} \right )$ time. \\ - & \\ -$\left [ 2 \right ] $ & Determine the minimal ratio between addition and multiplication clock cycles \\ - & required for equation $6.7$ to be true. \\ - & \\ -$\left [ 3 \right ] $ & Implement a threaded version of Comba multiplication (and squaring) where you \\ - & compute subsets of the columns in each thread. Determine a cutoff point where \\ - & it is effective and add the logic to mp\_mul() and mp\_sqr(). \\ - &\\ -$\left [ 4 \right ] $ & Same as the previous but also modify the Karatsuba and Toom-Cook. You must \\ - & increase the throughput of mp\_exptmod() for random odd moduli in the range \\ - & $512 \ldots 4096$ bits significantly ($> 2x$) to complete this challenge. \\ - & \\ -\end{tabular} - -\chapter{Modular Reduction} -MARK,REDUCTION -\section{Basics of Modular Reduction} -\index{modular residue} -Modular reduction is an operation that arises quite often within public key cryptography algorithms and various number theoretic algorithms, -such as factoring. Modular reduction algorithms are the third class of algorithms of the ``multipliers'' set. A number $a$ is said to be \textit{reduced} -modulo another number $b$ by finding the remainder of the division $a/b$. Full integer division with remainder is a topic to be covered -in~\ref{sec:division}. - -Modular reduction is equivalent to solving for $r$ in the following equation. $a = bq + r$ where $q = \lfloor a/b \rfloor$. The result -$r$ is said to be ``congruent to $a$ modulo $b$'' which is also written as $r \equiv a \mbox{ (mod }b\mbox{)}$. In other vernacular $r$ is known as the -``modular residue'' which leads to ``quadratic residue''\footnote{That's fancy talk for $b \equiv a^2 \mbox{ (mod }p\mbox{)}$.} and -other forms of residues. - -Modular reductions are normally used to create either finite groups, rings or fields. The most common usage for performance driven modular reductions -is in modular exponentiation algorithms. That is to compute $d = a^b \mbox{ (mod }c\mbox{)}$ as fast as possible. This operation is used in the -RSA and Diffie-Hellman public key algorithms, for example. Modular multiplication and squaring also appears as a fundamental operation in -elliptic curve cryptographic algorithms. As will be discussed in the subsequent chapter there exist fast algorithms for computing modular -exponentiations without having to perform (\textit{in this example}) $b - 1$ multiplications. These algorithms will produce partial results in the -range $0 \le x < c^2$ which can be taken advantage of to create several efficient algorithms. They have also been used to create redundancy check -algorithms known as CRCs, error correction codes such as Reed-Solomon and solve a variety of number theoeretic problems. - -\section{The Barrett Reduction} -The Barrett reduction algorithm \cite{BARRETT} was inspired by fast division algorithms which multiply by the reciprocal to emulate -division. Barretts observation was that the residue $c$ of $a$ modulo $b$ is equal to - -\begin{equation} -c = a - b \cdot \lfloor a/b \rfloor -\end{equation} - -Since algorithms such as modular exponentiation would be using the same modulus extensively, typical DSP\footnote{It is worth noting that Barrett's paper -targeted the DSP56K processor.} intuition would indicate the next step would be to replace $a/b$ by a multiplication by the reciprocal. However, -DSP intuition on its own will not work as these numbers are considerably larger than the precision of common DSP floating point data types. -It would take another common optimization to optimize the algorithm. - -\subsection{Fixed Point Arithmetic} -The trick used to optimize the above equation is based on a technique of emulating floating point data types with fixed precision integers. Fixed -point arithmetic would become very popular as it greatly optimize the ``3d-shooter'' genre of games in the mid 1990s when floating point units were -fairly slow if not unavailable. The idea behind fixed point arithmetic is to take a normal $k$-bit integer data type and break it into $p$-bit -integer and a $q$-bit fraction part (\textit{where $p+q = k$}). - -In this system a $k$-bit integer $n$ would actually represent $n/2^q$. For example, with $q = 4$ the integer $n = 37$ would actually represent the -value $2.3125$. To multiply two fixed point numbers the integers are multiplied using traditional arithmetic and subsequently normalized by -moving the implied decimal point back to where it should be. For example, with $q = 4$ to multiply the integers $9$ and $5$ they must be converted -to fixed point first by multiplying by $2^q$. Let $a = 9(2^q)$ represent the fixed point representation of $9$ and $b = 5(2^q)$ represent the -fixed point representation of $5$. The product $ab$ is equal to $45(2^{2q})$ which when normalized by dividing by $2^q$ produces $45(2^q)$. - -This technique became popular since a normal integer multiplication and logical shift right are the only required operations to perform a multiplication -of two fixed point numbers. Using fixed point arithmetic, division can be easily approximated by multiplying by the reciprocal. If $2^q$ is -equivalent to one than $2^q/b$ is equivalent to the fixed point approximation of $1/b$ using real arithmetic. Using this fact dividing an integer -$a$ by another integer $b$ can be achieved with the following expression. - -\begin{equation} -\lfloor a / b \rfloor \mbox{ }\approx\mbox{ } \lfloor (a \cdot \lfloor 2^q / b \rfloor)/2^q \rfloor -\end{equation} - -The precision of the division is proportional to the value of $q$. If the divisor $b$ is used frequently as is the case with -modular exponentiation pre-computing $2^q/b$ will allow a division to be performed with a multiplication and a right shift. Both operations -are considerably faster than division on most processors. - -Consider dividing $19$ by $5$. The correct result is $\lfloor 19/5 \rfloor = 3$. With $q = 3$ the reciprocal is $\lfloor 2^q/5 \rfloor = 1$ which -leads to a product of $19$ which when divided by $2^q$ produces $2$. However, with $q = 4$ the reciprocal is $\lfloor 2^q/5 \rfloor = 3$ and -the result of the emulated division is $\lfloor 3 \cdot 19 / 2^q \rfloor = 3$ which is correct. The value of $2^q$ must be close to or ideally -larger than the dividend. In effect if $a$ is the dividend then $q$ should allow $0 \le \lfloor a/2^q \rfloor \le 1$ in order for this approach -to work correctly. Plugging this form of divison into the original equation the following modular residue equation arises. - -\begin{equation} -c = a - b \cdot \lfloor (a \cdot \lfloor 2^q / b \rfloor)/2^q \rfloor -\end{equation} - -Using the notation from \cite{BARRETT} the value of $\lfloor 2^q / b \rfloor$ will be represented by the $\mu$ symbol. Using the $\mu$ -variable also helps re-inforce the idea that it is meant to be computed once and re-used. - -\begin{equation} -c = a - b \cdot \lfloor (a \cdot \mu)/2^q \rfloor -\end{equation} - -Provided that $2^q \ge a$ this algorithm will produce a quotient that is either exactly correct or off by a value of one. In the context of Barrett -reduction the value of $a$ is bound by $0 \le a \le (b - 1)^2$ meaning that $2^q \ge b^2$ is sufficient to ensure the reciprocal will have enough -precision. - -Let $n$ represent the number of digits in $b$. This algorithm requires approximately $2n^2$ single precision multiplications to produce the quotient and -another $n^2$ single precision multiplications to find the residue. In total $3n^2$ single precision multiplications are required to -reduce the number. - -For example, if $b = 1179677$ and $q = 41$ ($2^q > b^2$), then the reciprocal $\mu$ is equal to $\lfloor 2^q / b \rfloor = 1864089$. Consider reducing -$a = 180388626447$ modulo $b$ using the above reduction equation. The quotient using the new formula is $\lfloor (a \cdot \mu) / 2^q \rfloor = 152913$. -By subtracting $152913b$ from $a$ the correct residue $a \equiv 677346 \mbox{ (mod }b\mbox{)}$ is found. - -\subsection{Choosing a Radix Point} -Using the fixed point representation a modular reduction can be performed with $3n^2$ single precision multiplications. If that were the best -that could be achieved a full division\footnote{A division requires approximately $O(2cn^2)$ single precision multiplications for a small value of $c$. -See~\ref{sec:division} for further details.} might as well be used in its place. The key to optimizing the reduction is to reduce the precision of -the initial multiplication that finds the quotient. - -Let $a$ represent the number of which the residue is sought. Let $b$ represent the modulus used to find the residue. Let $m$ represent -the number of digits in $b$. For the purposes of this discussion we will assume that the number of digits in $a$ is $2m$, which is generally true if -two $m$-digit numbers have been multiplied. Dividing $a$ by $b$ is the same as dividing a $2m$ digit integer by a $m$ digit integer. Digits below the -$m - 1$'th digit of $a$ will contribute at most a value of $1$ to the quotient because $\beta^k < b$ for any $0 \le k \le m - 1$. Another way to -express this is by re-writing $a$ as two parts. If $a' \equiv a \mbox{ (mod }b^m\mbox{)}$ and $a'' = a - a'$ then -${a \over b} \equiv {{a' + a''} \over b}$ which is equivalent to ${a' \over b} + {a'' \over b}$. Since $a'$ is bound to be less than $b$ the quotient -is bound by $0 \le {a' \over b} < 1$. - -Since the digits of $a'$ do not contribute much to the quotient the observation is that they might as well be zero. However, if the digits -``might as well be zero'' they might as well not be there in the first place. Let $q_0 = \lfloor a/\beta^{m-1} \rfloor$ represent the input -with the irrelevant digits trimmed. Now the modular reduction is trimmed to the almost equivalent equation - -\begin{equation} -c = a - b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor -\end{equation} - -Note that the original divisor $2^q$ has been replaced with $\beta^{m+1}$ where in this case $q$ is a multiple of $lg(\beta)$. Also note that the -exponent on the divisor when added to the amount $q_0$ was shifted by equals $2m$. If the optimization had not been performed the divisor -would have the exponent $2m$ so in the end the exponents do ``add up''. Using the above equation the quotient -$\lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor$ can be off from the true quotient by at most two. The original fixed point quotient can be off -by as much as one (\textit{provided the radix point is chosen suitably}) and now that the lower irrelevent digits have been trimmed the quotient -can be off by an additional value of one for a total of at most two. This implies that -$0 \le a - b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor < 3b$. By first subtracting $b$ times the quotient and then conditionally subtracting -$b$ once or twice the residue is found. - -The quotient is now found using $(m + 1)(m) = m^2 + m$ single precision multiplications and the residue with an additional $m^2$ single -precision multiplications, ignoring the subtractions required. In total $2m^2 + m$ single precision multiplications are required to find the residue. -This is considerably faster than the original attempt. - -For example, let $\beta = 10$ represent the radix of the digits. Let $b = 9999$ represent the modulus which implies $m = 4$. Let $a = 99929878$ -represent the value of which the residue is desired. In this case $q = 8$ since $10^7 < 9999^2$ meaning that $\mu = \lfloor \beta^{q}/b \rfloor = 10001$. -With the new observation the multiplicand for the quotient is equal to $q_0 = \lfloor a / \beta^{m - 1} \rfloor = 99929$. The quotient is then -$\lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor = 9993$. Subtracting $9993b$ from $a$ and the correct residue $a \equiv 9871 \mbox{ (mod }b\mbox{)}$ -is found. - -\subsection{Trimming the Quotient} -So far the reduction algorithm has been optimized from $3m^2$ single precision multiplications down to $2m^2 + m$ single precision multiplications. As -it stands now the algorithm is already fairly fast compared to a full integer division algorithm. However, there is still room for -optimization. - -After the first multiplication inside the quotient ($q_0 \cdot \mu$) the value is shifted right by $m + 1$ places effectively nullifying the lower -half of the product. It would be nice to be able to remove those digits from the product to effectively cut down the number of single precision -multiplications. If the number of digits in the modulus $m$ is far less than $\beta$ a full product is not required for the algorithm to work properly. -In fact the lower $m - 2$ digits will not affect the upper half of the product at all and do not need to be computed. - -The value of $\mu$ is a $m$-digit number and $q_0$ is a $m + 1$ digit number. Using a full multiplier $(m + 1)(m) = m^2 + m$ single precision -multiplications would be required. Using a multiplier that will only produce digits at and above the $m - 1$'th digit reduces the number -of single precision multiplications to ${m^2 + m} \over 2$ single precision multiplications. - -\subsection{Trimming the Residue} -After the quotient has been calculated it is used to reduce the input. As previously noted the algorithm is not exact and it can be off by a small -multiple of the modulus, that is $0 \le a - b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor < 3b$. If $b$ is $m$ digits than the -result of reduction equation is a value of at most $m + 1$ digits (\textit{provided $3 < \beta$}) implying that the upper $m - 1$ digits are -implicitly zero. - -The next optimization arises from this very fact. Instead of computing $b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor$ using a full -$O(m^2)$ multiplication algorithm only the lower $m+1$ digits of the product have to be computed. Similarly the value of $a$ can -be reduced modulo $\beta^{m+1}$ before the multiple of $b$ is subtracted which simplifes the subtraction as well. A multiplication that produces -only the lower $m+1$ digits requires ${m^2 + 3m - 2} \over 2$ single precision multiplications. - -With both optimizations in place the algorithm is the algorithm Barrett proposed. It requires $m^2 + 2m - 1$ single precision multiplications which -is considerably faster than the straightforward $3m^2$ method. - -\subsection{The Barrett Algorithm} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce}. \\ -\textbf{Input}. mp\_int $a$, mp\_int $b$ and $\mu = \lfloor \beta^{2m}/b \rfloor, m = \lceil lg_{\beta}(b) \rceil, (0 \le a < b^2, b > 1)$ \\ -\textbf{Output}. $a \mbox{ (mod }b\mbox{)}$ \\ -\hline \\ -Let $m$ represent the number of digits in $b$. \\ -1. Make a copy of $a$ and store it in $q$. (\textit{mp\_init\_copy}) \\ -2. $q \leftarrow \lfloor q / \beta^{m - 1} \rfloor$ (\textit{mp\_rshd}) \\ -\\ -Produce the quotient. \\ -3. $q \leftarrow q \cdot \mu$ (\textit{note: only produce digits at or above $m-1$}) \\ -4. $q \leftarrow \lfloor q / \beta^{m + 1} \rfloor$ \\ -\\ -Subtract the multiple of modulus from the input. \\ -5. $a \leftarrow a \mbox{ (mod }\beta^{m+1}\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -6. $q \leftarrow q \cdot b \mbox{ (mod }\beta^{m+1}\mbox{)}$ (\textit{s\_mp\_mul\_digs}) \\ -7. $a \leftarrow a - q$ (\textit{mp\_sub}) \\ -\\ -Add $\beta^{m+1}$ if a carry occured. \\ -8. If $a < 0$ then (\textit{mp\_cmp\_d}) \\ -\hspace{3mm}8.1 $q \leftarrow 1$ (\textit{mp\_set}) \\ -\hspace{3mm}8.2 $q \leftarrow q \cdot \beta^{m+1}$ (\textit{mp\_lshd}) \\ -\hspace{3mm}8.3 $a \leftarrow a + q$ \\ -\\ -Now subtract the modulus if the residue is too large (e.g. quotient too small). \\ -9. While $a \ge b$ do (\textit{mp\_cmp}) \\ -\hspace{3mm}9.1 $c \leftarrow a - b$ \\ -10. Clear $q$. \\ -11. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce} -\end{figure} - -\textbf{Algorithm mp\_reduce.} -This algorithm will reduce the input $a$ modulo $b$ in place using the Barrett algorithm. It is loosely based on algorithm 14.42 of HAC -\cite[pp. 602]{HAC} which is based on the paper from Paul Barrett \cite{BARRETT}. The algorithm has several restrictions and assumptions which must -be adhered to for the algorithm to work. - -First the modulus $b$ is assumed to be positive and greater than one. If the modulus were less than or equal to one than subtracting -a multiple of it would either accomplish nothing or actually enlarge the input. The input $a$ must be in the range $0 \le a < b^2$ in order -for the quotient to have enough precision. If $a$ is the product of two numbers that were already reduced modulo $b$, this will not be a problem. -Technically the algorithm will still work if $a \ge b^2$ but it will take much longer to finish. The value of $\mu$ is passed as an argument to this -algorithm and is assumed to be calculated and stored before the algorithm is used. - -Recall that the multiplication for the quotient on step 3 must only produce digits at or above the $m-1$'th position. An algorithm called -$s\_mp\_mul\_high\_digs$ which has not been presented is used to accomplish this task. The algorithm is based on $s\_mp\_mul\_digs$ except that -instead of stopping at a given level of precision it starts at a given level of precision. This optimal algorithm can only be used if the number -of digits in $b$ is very much smaller than $\beta$. - -While it is known that -$a \ge b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor$ only the lower $m+1$ digits are being used to compute the residue, so an implied -``borrow'' from the higher digits might leave a negative result. After the multiple of the modulus has been subtracted from $a$ the residue must be -fixed up in case it is negative. The invariant $\beta^{m+1}$ must be added to the residue to make it positive again. - -The while loop at step 9 will subtract $b$ until the residue is less than $b$. If the algorithm is performed correctly this step is -performed at most twice, and on average once. However, if $a \ge b^2$ than it will iterate substantially more times than it should. - -EXAM,bn_mp_reduce.c - -The first multiplication that determines the quotient can be performed by only producing the digits from $m - 1$ and up. This essentially halves -the number of single precision multiplications required. However, the optimization is only safe if $\beta$ is much larger than the number of digits -in the modulus. In the source code this is evaluated on lines @36,if@ to @44,}@ where algorithm s\_mp\_mul\_high\_digs is used when it is -safe to do so. - -\subsection{The Barrett Setup Algorithm} -In order to use algorithm mp\_reduce the value of $\mu$ must be calculated in advance. Ideally this value should be computed once and stored for -future use so that the Barrett algorithm can be used without delay. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_setup}. \\ -\textbf{Input}. mp\_int $a$ ($a > 1$) \\ -\textbf{Output}. $\mu \leftarrow \lfloor \beta^{2m}/a \rfloor$ \\ -\hline \\ -1. $\mu \leftarrow 2^{2 \cdot lg(\beta) \cdot m}$ (\textit{mp\_2expt}) \\ -2. $\mu \leftarrow \lfloor \mu / b \rfloor$ (\textit{mp\_div}) \\ -3. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_setup} -\end{figure} - -\textbf{Algorithm mp\_reduce\_setup.} -This algorithm computes the reciprocal $\mu$ required for Barrett reduction. First $\beta^{2m}$ is calculated as $2^{2 \cdot lg(\beta) \cdot m}$ which -is equivalent and much faster. The final value is computed by taking the integer quotient of $\lfloor \mu / b \rfloor$. - -EXAM,bn_mp_reduce_setup.c - -This simple routine calculates the reciprocal $\mu$ required by Barrett reduction. Note the extended usage of algorithm mp\_div where the variable -which would received the remainder is passed as NULL. As will be discussed in~\ref{sec:division} the division routine allows both the quotient and the -remainder to be passed as NULL meaning to ignore the value. - -\section{The Montgomery Reduction} -Montgomery reduction\footnote{Thanks to Niels Ferguson for his insightful explanation of the algorithm.} \cite{MONT} is by far the most interesting -form of reduction in common use. It computes a modular residue which is not actually equal to the residue of the input yet instead equal to a -residue times a constant. However, as perplexing as this may sound the algorithm is relatively simple and very efficient. - -Throughout this entire section the variable $n$ will represent the modulus used to form the residue. As will be discussed shortly the value of -$n$ must be odd. The variable $x$ will represent the quantity of which the residue is sought. Similar to the Barrett algorithm the input -is restricted to $0 \le x < n^2$. To begin the description some simple number theory facts must be established. - -\textbf{Fact 1.} Adding $n$ to $x$ does not change the residue since in effect it adds one to the quotient $\lfloor x / n \rfloor$. Another way -to explain this is that $n$ is (\textit{or multiples of $n$ are}) congruent to zero modulo $n$. Adding zero will not change the value of the residue. - -\textbf{Fact 2.} If $x$ is even then performing a division by two in $\Z$ is congruent to $x \cdot 2^{-1} \mbox{ (mod }n\mbox{)}$. Actually -this is an application of the fact that if $x$ is evenly divisible by any $k \in \Z$ then division in $\Z$ will be congruent to -multiplication by $k^{-1}$ modulo $n$. - -From these two simple facts the following simple algorithm can be derived. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Montgomery Reduction}. \\ -\textbf{Input}. Integer $x$, $n$ and $k$ \\ -\textbf{Output}. $2^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. for $t$ from $1$ to $k$ do \\ -\hspace{3mm}1.1 If $x$ is odd then \\ -\hspace{6mm}1.1.1 $x \leftarrow x + n$ \\ -\hspace{3mm}1.2 $x \leftarrow x/2$ \\ -2. Return $x$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Montgomery Reduction} -\end{figure} - -The algorithm reduces the input one bit at a time using the two congruencies stated previously. Inside the loop $n$, which is odd, is -added to $x$ if $x$ is odd. This forces $x$ to be even which allows the division by two in $\Z$ to be congruent to a modular division by two. Since -$x$ is assumed to be initially much larger than $n$ the addition of $n$ will contribute an insignificant magnitude to $x$. Let $r$ represent the -final result of the Montgomery algorithm. If $k > lg(n)$ and $0 \le x < n^2$ then the final result is limited to -$0 \le r < \lfloor x/2^k \rfloor + n$. As a result at most a single subtraction is required to get the residue desired. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|l|} -\hline \textbf{Step number ($t$)} & \textbf{Result ($x$)} \\ -\hline $1$ & $x + n = 5812$, $x/2 = 2906$ \\ -\hline $2$ & $x/2 = 1453$ \\ -\hline $3$ & $x + n = 1710$, $x/2 = 855$ \\ -\hline $4$ & $x + n = 1112$, $x/2 = 556$ \\ -\hline $5$ & $x/2 = 278$ \\ -\hline $6$ & $x/2 = 139$ \\ -\hline $7$ & $x + n = 396$, $x/2 = 198$ \\ -\hline $8$ & $x/2 = 99$ \\ -\hline $9$ & $x + n = 356$, $x/2 = 178$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Example of Montgomery Reduction (I)} -\label{fig:MONT1} -\end{figure} - -Consider the example in figure~\ref{fig:MONT1} which reduces $x = 5555$ modulo $n = 257$ when $k = 9$ (note $\beta^k = 512$ which is larger than $n$). The result of -the algorithm $r = 178$ is congruent to the value of $2^{-9} \cdot 5555 \mbox{ (mod }257\mbox{)}$. When $r$ is multiplied by $2^9$ modulo $257$ the correct residue -$r \equiv 158$ is produced. - -Let $k = \lfloor lg(n) \rfloor + 1$ represent the number of bits in $n$. The current algorithm requires $2k^2$ single precision shifts -and $k^2$ single precision additions. At this rate the algorithm is most certainly slower than Barrett reduction and not terribly useful. -Fortunately there exists an alternative representation of the algorithm. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Montgomery Reduction} (modified I). \\ -\textbf{Input}. Integer $x$, $n$ and $k$ ($2^k > n$) \\ -\textbf{Output}. $2^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. for $t$ from $1$ to $k$ do \\ -\hspace{3mm}1.1 If the $t$'th bit of $x$ is one then \\ -\hspace{6mm}1.1.1 $x \leftarrow x + 2^tn$ \\ -2. Return $x/2^k$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Montgomery Reduction (modified I)} -\end{figure} - -This algorithm is equivalent since $2^tn$ is a multiple of $n$ and the lower $k$ bits of $x$ are zero by step 2. The number of single -precision shifts has now been reduced from $2k^2$ to $k^2 + k$ which is only a small improvement. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|l|r|} -\hline \textbf{Step number ($t$)} & \textbf{Result ($x$)} & \textbf{Result ($x$) in Binary} \\ -\hline -- & $5555$ & $1010110110011$ \\ -\hline $1$ & $x + 2^{0}n = 5812$ & $1011010110100$ \\ -\hline $2$ & $5812$ & $1011010110100$ \\ -\hline $3$ & $x + 2^{2}n = 6840$ & $1101010111000$ \\ -\hline $4$ & $x + 2^{3}n = 8896$ & $10001011000000$ \\ -\hline $5$ & $8896$ & $10001011000000$ \\ -\hline $6$ & $8896$ & $10001011000000$ \\ -\hline $7$ & $x + 2^{6}n = 25344$ & $110001100000000$ \\ -\hline $8$ & $25344$ & $110001100000000$ \\ -\hline $9$ & $x + 2^{7}n = 91136$ & $10110010000000000$ \\ -\hline -- & $x/2^k = 178$ & \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Example of Montgomery Reduction (II)} -\label{fig:MONT2} -\end{figure} - -Figure~\ref{fig:MONT2} demonstrates the modified algorithm reducing $x = 5555$ modulo $n = 257$ with $k = 9$. -With this algorithm a single shift right at the end is the only right shift required to reduce the input instead of $k$ right shifts inside the -loop. Note that for the iterations $t = 2, 5, 6$ and $8$ where the result $x$ is not changed. In those iterations the $t$'th bit of $x$ is -zero and the appropriate multiple of $n$ does not need to be added to force the $t$'th bit of the result to zero. - -\subsection{Digit Based Montgomery Reduction} -Instead of computing the reduction on a bit-by-bit basis it is actually much faster to compute it on digit-by-digit basis. Consider the -previous algorithm re-written to compute the Montgomery reduction in this new fashion. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Montgomery Reduction} (modified II). \\ -\textbf{Input}. Integer $x$, $n$ and $k$ ($\beta^k > n$) \\ -\textbf{Output}. $\beta^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. for $t$ from $0$ to $k - 1$ do \\ -\hspace{3mm}1.1 $x \leftarrow x + \mu n \beta^t$ \\ -2. Return $x/\beta^k$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Montgomery Reduction (modified II)} -\end{figure} - -The value $\mu n \beta^t$ is a multiple of the modulus $n$ meaning that it will not change the residue. If the first digit of -the value $\mu n \beta^t$ equals the negative (modulo $\beta$) of the $t$'th digit of $x$ then the addition will result in a zero digit. This -problem breaks down to solving the following congruency. - -\begin{center} -\begin{tabular}{rcl} -$x_t + \mu n_0$ & $\equiv$ & $0 \mbox{ (mod }\beta\mbox{)}$ \\ -$\mu n_0$ & $\equiv$ & $-x_t \mbox{ (mod }\beta\mbox{)}$ \\ -$\mu$ & $\equiv$ & $-x_t/n_0 \mbox{ (mod }\beta\mbox{)}$ \\ -\end{tabular} -\end{center} - -In each iteration of the loop on step 1 a new value of $\mu$ must be calculated. The value of $-1/n_0 \mbox{ (mod }\beta\mbox{)}$ is used -extensively in this algorithm and should be precomputed. Let $\rho$ represent the negative of the modular inverse of $n_0$ modulo $\beta$. - -For example, let $\beta = 10$ represent the radix. Let $n = 17$ represent the modulus which implies $k = 2$ and $\rho \equiv 7$. Let $x = 33$ -represent the value to reduce. - -\newpage\begin{figure} -\begin{center} -\begin{tabular}{|c|c|c|} -\hline \textbf{Step ($t$)} & \textbf{Value of $x$} & \textbf{Value of $\mu$} \\ -\hline -- & $33$ & --\\ -\hline $0$ & $33 + \mu n = 50$ & $1$ \\ -\hline $1$ & $50 + \mu n \beta = 900$ & $5$ \\ -\hline -\end{tabular} -\end{center} -\caption{Example of Montgomery Reduction} -\end{figure} - -The final result $900$ is then divided by $\beta^k$ to produce the final result $9$. The first observation is that $9 \nequiv x \mbox{ (mod }n\mbox{)}$ -which implies the result is not the modular residue of $x$ modulo $n$. However, recall that the residue is actually multiplied by $\beta^{-k}$ in -the algorithm. To get the true residue the value must be multiplied by $\beta^k$. In this case $\beta^k \equiv 15 \mbox{ (mod }n\mbox{)}$ and -the correct residue is $9 \cdot 15 \equiv 16 \mbox{ (mod }n\mbox{)}$. - -\subsection{Baseline Montgomery Reduction} -The baseline Montgomery reduction algorithm will produce the residue for any size input. It is designed to be a catch-all algororithm for -Montgomery reductions. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_montgomery\_reduce}. \\ -\textbf{Input}. mp\_int $x$, mp\_int $n$ and a digit $\rho \equiv -1/n_0 \mbox{ (mod }n\mbox{)}$. \\ -\hspace{11.5mm}($0 \le x < n^2, n > 1, (n, \beta) = 1, \beta^k > n$) \\ -\textbf{Output}. $\beta^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. $digs \leftarrow 2n.used + 1$ \\ -2. If $digs < MP\_ARRAY$ and $m.used < \delta$ then \\ -\hspace{3mm}2.1 Use algorithm fast\_mp\_montgomery\_reduce instead. \\ -\\ -Setup $x$ for the reduction. \\ -3. If $x.alloc < digs$ then grow $x$ to $digs$ digits. \\ -4. $x.used \leftarrow digs$ \\ -\\ -Eliminate the lower $k$ digits. \\ -5. For $ix$ from $0$ to $k - 1$ do \\ -\hspace{3mm}5.1 $\mu \leftarrow x_{ix} \cdot \rho \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}5.2 $u \leftarrow 0$ \\ -\hspace{3mm}5.3 For $iy$ from $0$ to $k - 1$ do \\ -\hspace{6mm}5.3.1 $\hat r \leftarrow \mu n_{iy} + x_{ix + iy} + u$ \\ -\hspace{6mm}5.3.2 $x_{ix + iy} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}5.3.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}5.4 While $u > 0$ do \\ -\hspace{6mm}5.4.1 $iy \leftarrow iy + 1$ \\ -\hspace{6mm}5.4.2 $x_{ix + iy} \leftarrow x_{ix + iy} + u$ \\ -\hspace{6mm}5.4.3 $u \leftarrow \lfloor x_{ix+iy} / \beta \rfloor$ \\ -\hspace{6mm}5.4.4 $x_{ix + iy} \leftarrow x_{ix+iy} \mbox{ (mod }\beta\mbox{)}$ \\ -\\ -Divide by $\beta^k$ and fix up as required. \\ -6. $x \leftarrow \lfloor x / \beta^k \rfloor$ \\ -7. If $x \ge n$ then \\ -\hspace{3mm}7.1 $x \leftarrow x - n$ \\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_montgomery\_reduce} -\end{figure} - -\textbf{Algorithm mp\_montgomery\_reduce.} -This algorithm reduces the input $x$ modulo $n$ in place using the Montgomery reduction algorithm. The algorithm is loosely based -on algorithm 14.32 of \cite[pp.601]{HAC} except it merges the multiplication of $\mu n \beta^t$ with the addition in the inner loop. The -restrictions on this algorithm are fairly easy to adapt to. First $0 \le x < n^2$ bounds the input to numbers in the same range as -for the Barrett algorithm. Additionally if $n > 1$ and $n$ is odd there will exist a modular inverse $\rho$. $\rho$ must be calculated in -advance of this algorithm. Finally the variable $k$ is fixed and a pseudonym for $n.used$. - -Step 2 decides whether a faster Montgomery algorithm can be used. It is based on the Comba technique meaning that there are limits on -the size of the input. This algorithm is discussed in ~COMBARED~. - -Step 5 is the main reduction loop of the algorithm. The value of $\mu$ is calculated once per iteration in the outer loop. The inner loop -calculates $x + \mu n \beta^{ix}$ by multiplying $\mu n$ and adding the result to $x$ shifted by $ix$ digits. Both the addition and -multiplication are performed in the same loop to save time and memory. Step 5.4 will handle any additional carries that escape the inner loop. - -Using a quick inspection this algorithm requires $n$ single precision multiplications for the outer loop and $n^2$ single precision multiplications -in the inner loop. In total $n^2 + n$ single precision multiplications which compares favourably to Barrett at $n^2 + 2n - 1$ single precision -multiplications. - -EXAM,bn_mp_montgomery_reduce.c - -This is the baseline implementation of the Montgomery reduction algorithm. Lines @30,digs@ to @35,}@ determine if the Comba based -routine can be used instead. Line @47,mu@ computes the value of $\mu$ for that particular iteration of the outer loop. - -The multiplication $\mu n \beta^{ix}$ is performed in one step in the inner loop. The alias $tmpx$ refers to the $ix$'th digit of $x$ and -the alias $tmpn$ refers to the modulus $n$. - -\subsection{Faster ``Comba'' Montgomery Reduction} -MARK,COMBARED - -The Montgomery reduction requires fewer single precision multiplications than a Barrett reduction, however it is much slower due to the serial -nature of the inner loop. The Barrett reduction algorithm requires two slightly modified multipliers which can be implemented with the Comba -technique. The Montgomery reduction algorithm cannot directly use the Comba technique to any significant advantage since the inner loop calculates -a $k \times 1$ product $k$ times. - -The biggest obstacle is that at the $ix$'th iteration of the outer loop the value of $x_{ix}$ is required to calculate $\mu$. This means the -carries from $0$ to $ix - 1$ must have been propagated upwards to form a valid $ix$'th digit. The solution as it turns out is very simple. -Perform a Comba like multiplier and inside the outer loop just after the inner loop fix up the $ix + 1$'th digit by forwarding the carry. - -With this change in place the Montgomery reduction algorithm can be performed with a Comba style multiplication loop which substantially increases -the speed of the algorithm. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{fast\_mp\_montgomery\_reduce}. \\ -\textbf{Input}. mp\_int $x$, mp\_int $n$ and a digit $\rho \equiv -1/n_0 \mbox{ (mod }n\mbox{)}$. \\ -\hspace{11.5mm}($0 \le x < n^2, n > 1, (n, \beta) = 1, \beta^k > n$) \\ -\textbf{Output}. $\beta^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -Place an array of \textbf{MP\_WARRAY} mp\_word variables called $\hat W$ on the stack. \\ -1. if $x.alloc < n.used + 1$ then grow $x$ to $n.used + 1$ digits. \\ -Copy the digits of $x$ into the array $\hat W$ \\ -2. For $ix$ from $0$ to $x.used - 1$ do \\ -\hspace{3mm}2.1 $\hat W_{ix} \leftarrow x_{ix}$ \\ -3. For $ix$ from $x.used$ to $2n.used - 1$ do \\ -\hspace{3mm}3.1 $\hat W_{ix} \leftarrow 0$ \\ -Elimiate the lower $k$ digits. \\ -4. for $ix$ from $0$ to $n.used - 1$ do \\ -\hspace{3mm}4.1 $\mu \leftarrow \hat W_{ix} \cdot \rho \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}4.2 For $iy$ from $0$ to $n.used - 1$ do \\ -\hspace{6mm}4.2.1 $\hat W_{iy + ix} \leftarrow \hat W_{iy + ix} + \mu \cdot n_{iy}$ \\ -\hspace{3mm}4.3 $\hat W_{ix + 1} \leftarrow \hat W_{ix + 1} + \lfloor \hat W_{ix} / \beta \rfloor$ \\ -Propagate carries upwards. \\ -5. for $ix$ from $n.used$ to $2n.used + 1$ do \\ -\hspace{3mm}5.1 $\hat W_{ix + 1} \leftarrow \hat W_{ix + 1} + \lfloor \hat W_{ix} / \beta \rfloor$ \\ -Shift right and reduce modulo $\beta$ simultaneously. \\ -6. for $ix$ from $0$ to $n.used + 1$ do \\ -\hspace{3mm}6.1 $x_{ix} \leftarrow \hat W_{ix + n.used} \mbox{ (mod }\beta\mbox{)}$ \\ -Zero excess digits and fixup $x$. \\ -7. if $x.used > n.used + 1$ then do \\ -\hspace{3mm}7.1 for $ix$ from $n.used + 1$ to $x.used - 1$ do \\ -\hspace{6mm}7.1.1 $x_{ix} \leftarrow 0$ \\ -8. $x.used \leftarrow n.used + 1$ \\ -9. Clamp excessive digits of $x$. \\ -10. If $x \ge n$ then \\ -\hspace{3mm}10.1 $x \leftarrow x - n$ \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm fast\_mp\_montgomery\_reduce} -\end{figure} - -\textbf{Algorithm fast\_mp\_montgomery\_reduce.} -This algorithm will compute the Montgomery reduction of $x$ modulo $n$ using the Comba technique. It is on most computer platforms significantly -faster than algorithm mp\_montgomery\_reduce and algorithm mp\_reduce (\textit{Barrett reduction}). The algorithm has the same restrictions -on the input as the baseline reduction algorithm. An additional two restrictions are imposed on this algorithm. The number of digits $k$ in the -the modulus $n$ must not violate $MP\_WARRAY > 2k +1$ and $n < \delta$. When $\beta = 2^{28}$ this algorithm can be used to reduce modulo -a modulus of at most $3,556$ bits in length. - -As in the other Comba reduction algorithms there is a $\hat W$ array which stores the columns of the product. It is initially filled with the -contents of $x$ with the excess digits zeroed. The reduction loop is very similar the to the baseline loop at heart. The multiplication on step -4.1 can be single precision only since $ab \mbox{ (mod }\beta\mbox{)} \equiv (a \mbox{ mod }\beta)(b \mbox{ mod }\beta)$. Some multipliers such -as those on the ARM processors take a variable length time to complete depending on the number of bytes of result it must produce. By performing -a single precision multiplication instead half the amount of time is spent. - -Also note that digit $\hat W_{ix}$ must have the carry from the $ix - 1$'th digit propagated upwards in order for this to work. That is what step -4.3 will do. In effect over the $n.used$ iterations of the outer loop the $n.used$'th lower columns all have the their carries propagated forwards. Note -how the upper bits of those same words are not reduced modulo $\beta$. This is because those values will be discarded shortly and there is no -point. - -Step 5 will propagate the remainder of the carries upwards. On step 6 the columns are reduced modulo $\beta$ and shifted simultaneously as they are -stored in the destination $x$. - -EXAM,bn_fast_mp_montgomery_reduce.c - -The $\hat W$ array is first filled with digits of $x$ on line @49,for@ then the rest of the digits are zeroed on line @54,for@. Both loops share -the same alias variables to make the code easier to read. - -The value of $\mu$ is calculated in an interesting fashion. First the value $\hat W_{ix}$ is reduced modulo $\beta$ and cast to a mp\_digit. This -forces the compiler to use a single precision multiplication and prevents any concerns about loss of precision. Line @101,>>@ fixes the carry -for the next iteration of the loop by propagating the carry from $\hat W_{ix}$ to $\hat W_{ix+1}$. - -The for loop on line @113,for@ propagates the rest of the carries upwards through the columns. The for loop on line @126,for@ reduces the columns -modulo $\beta$ and shifts them $k$ places at the same time. The alias $\_ \hat W$ actually refers to the array $\hat W$ starting at the $n.used$'th -digit, that is $\_ \hat W_{t} = \hat W_{n.used + t}$. - -\subsection{Montgomery Setup} -To calculate the variable $\rho$ a relatively simple algorithm will be required. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_montgomery\_setup}. \\ -\textbf{Input}. mp\_int $n$ ($n > 1$ and $(n, 2) = 1$) \\ -\textbf{Output}. $\rho \equiv -1/n_0 \mbox{ (mod }\beta\mbox{)}$ \\ -\hline \\ -1. $b \leftarrow n_0$ \\ -2. If $b$ is even return(\textit{MP\_VAL}) \\ -3. $x \leftarrow (((b + 2) \mbox{ AND } 4) << 1) + b$ \\ -4. for $k$ from 0 to $\lceil lg(lg(\beta)) \rceil - 2$ do \\ -\hspace{3mm}4.1 $x \leftarrow x \cdot (2 - bx)$ \\ -5. $\rho \leftarrow \beta - x \mbox{ (mod }\beta\mbox{)}$ \\ -6. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_montgomery\_setup} -\end{figure} - -\textbf{Algorithm mp\_montgomery\_setup.} -This algorithm will calculate the value of $\rho$ required within the Montgomery reduction algorithms. It uses a very interesting trick -to calculate $1/n_0$ when $\beta$ is a power of two. - -EXAM,bn_mp_montgomery_setup.c - -This source code computes the value of $\rho$ required to perform Montgomery reduction. It has been modified to avoid performing excess -multiplications when $\beta$ is not the default 28-bits. - -\section{The Diminished Radix Algorithm} -The Diminished Radix method of modular reduction \cite{DRMET} is a fairly clever technique which can be more efficient than either the Barrett -or Montgomery methods for certain forms of moduli. The technique is based on the following simple congruence. - -\begin{equation} -(x \mbox{ mod } n) + k \lfloor x / n \rfloor \equiv x \mbox{ (mod }(n - k)\mbox{)} -\end{equation} - -This observation was used in the MMB \cite{MMB} block cipher to create a diffusion primitive. It used the fact that if $n = 2^{31}$ and $k=1$ that -then a x86 multiplier could produce the 62-bit product and use the ``shrd'' instruction to perform a double-precision right shift. The proof -of the above equation is very simple. First write $x$ in the product form. - -\begin{equation} -x = qn + r -\end{equation} - -Now reduce both sides modulo $(n - k)$. - -\begin{equation} -x \equiv qk + r \mbox{ (mod }(n-k)\mbox{)} -\end{equation} - -The variable $n$ reduces modulo $n - k$ to $k$. By putting $q = \lfloor x/n \rfloor$ and $r = x \mbox{ mod } n$ -into the equation the original congruence is reproduced, thus concluding the proof. The following algorithm is based on this observation. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Diminished Radix Reduction}. \\ -\textbf{Input}. Integer $x$, $n$, $k$ \\ -\textbf{Output}. $x \mbox{ mod } (n - k)$ \\ -\hline \\ -1. $q \leftarrow \lfloor x / n \rfloor$ \\ -2. $q \leftarrow k \cdot q$ \\ -3. $x \leftarrow x \mbox{ (mod }n\mbox{)}$ \\ -4. $x \leftarrow x + q$ \\ -5. If $x \ge (n - k)$ then \\ -\hspace{3mm}5.1 $x \leftarrow x - (n - k)$ \\ -\hspace{3mm}5.2 Goto step 1. \\ -6. Return $x$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Diminished Radix Reduction} -\label{fig:DR} -\end{figure} - -This algorithm will reduce $x$ modulo $n - k$ and return the residue. If $0 \le x < (n - k)^2$ then the algorithm will loop almost always -once or twice and occasionally three times. For simplicity sake the value of $x$ is bounded by the following simple polynomial. - -\begin{equation} -0 \le x < n^2 + k^2 - 2nk -\end{equation} - -The true bound is $0 \le x < (n - k - 1)^2$ but this has quite a few more terms. The value of $q$ after step 1 is bounded by the following. - -\begin{equation} -q < n - 2k - k^2/n -\end{equation} - -Since $k^2$ is going to be considerably smaller than $n$ that term will always be zero. The value of $x$ after step 3 is bounded trivially as -$0 \le x < n$. By step four the sum $x + q$ is bounded by - -\begin{equation} -0 \le q + x < (k + 1)n - 2k^2 - 1 -\end{equation} - -With a second pass $q$ will be loosely bounded by $0 \le q < k^2$ after step 2 while $x$ will still be loosely bounded by $0 \le x < n$ after step 3. After the second pass it is highly unlike that the -sum in step 4 will exceed $n - k$. In practice fewer than three passes of the algorithm are required to reduce virtually every input in the -range $0 \le x < (n - k - 1)^2$. - -\begin{figure} -\begin{small} -\begin{center} -\begin{tabular}{|l|} -\hline -$x = 123456789, n = 256, k = 3$ \\ -\hline $q \leftarrow \lfloor x/n \rfloor = 482253$ \\ -$q \leftarrow q*k = 1446759$ \\ -$x \leftarrow x \mbox{ mod } n = 21$ \\ -$x \leftarrow x + q = 1446780$ \\ -$x \leftarrow x - (n - k) = 1446527$ \\ -\hline -$q \leftarrow \lfloor x/n \rfloor = 5650$ \\ -$q \leftarrow q*k = 16950$ \\ -$x \leftarrow x \mbox{ mod } n = 127$ \\ -$x \leftarrow x + q = 17077$ \\ -$x \leftarrow x - (n - k) = 16824$ \\ -\hline -$q \leftarrow \lfloor x/n \rfloor = 65$ \\ -$q \leftarrow q*k = 195$ \\ -$x \leftarrow x \mbox{ mod } n = 184$ \\ -$x \leftarrow x + q = 379$ \\ -$x \leftarrow x - (n - k) = 126$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Example Diminished Radix Reduction} -\label{fig:EXDR} -\end{figure} - -Figure~\ref{fig:EXDR} demonstrates the reduction of $x = 123456789$ modulo $n - k = 253$ when $n = 256$ and $k = 3$. Note that even while $x$ -is considerably larger than $(n - k - 1)^2 = 63504$ the algorithm still converges on the modular residue exceedingly fast. In this case only -three passes were required to find the residue $x \equiv 126$. - - -\subsection{Choice of Moduli} -On the surface this algorithm looks like a very expensive algorithm. It requires a couple of subtractions followed by multiplication and other -modular reductions. The usefulness of this algorithm becomes exceedingly clear when an appropriate modulus is chosen. - -Division in general is a very expensive operation to perform. The one exception is when the division is by a power of the radix of representation used. -Division by ten for example is simple for pencil and paper mathematics since it amounts to shifting the decimal place to the right. Similarly division -by two (\textit{or powers of two}) is very simple for binary computers to perform. It would therefore seem logical to choose $n$ of the form $2^p$ -which would imply that $\lfloor x / n \rfloor$ is a simple shift of $x$ right $p$ bits. - -However, there is one operation related to division of power of twos that is even faster than this. If $n = \beta^p$ then the division may be -performed by moving whole digits to the right $p$ places. In practice division by $\beta^p$ is much faster than division by $2^p$ for any $p$. -Also with the choice of $n = \beta^p$ reducing $x$ modulo $n$ merely requires zeroing the digits above the $p-1$'th digit of $x$. - -Throughout the next section the term ``restricted modulus'' will refer to a modulus of the form $\beta^p - k$ whereas the term ``unrestricted -modulus'' will refer to a modulus of the form $2^p - k$. The word ``restricted'' in this case refers to the fact that it is based on the -$2^p$ logic except $p$ must be a multiple of $lg(\beta)$. - -\subsection{Choice of $k$} -Now that division and reduction (\textit{step 1 and 3 of figure~\ref{fig:DR}}) have been optimized to simple digit operations the multiplication by $k$ -in step 2 is the most expensive operation. Fortunately the choice of $k$ is not terribly limited. For all intents and purposes it might -as well be a single digit. The smaller the value of $k$ is the faster the algorithm will be. - -\subsection{Restricted Diminished Radix Reduction} -The restricted Diminished Radix algorithm can quickly reduce an input modulo a modulus of the form $n = \beta^p - k$. This algorithm can reduce -an input $x$ within the range $0 \le x < n^2$ using only a couple passes of the algorithm demonstrated in figure~\ref{fig:DR}. The implementation -of this algorithm has been optimized to avoid additional overhead associated with a division by $\beta^p$, the multiplication by $k$ or the addition -of $x$ and $q$. The resulting algorithm is very efficient and can lead to substantial improvements over Barrett and Montgomery reduction when modular -exponentiations are performed. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_dr\_reduce}. \\ -\textbf{Input}. mp\_int $x$, $n$ and a mp\_digit $k = \beta - n_0$ \\ -\hspace{11.5mm}($0 \le x < n^2$, $n > 1$, $0 < k < \beta$) \\ -\textbf{Output}. $x \mbox{ mod } n$ \\ -\hline \\ -1. $m \leftarrow n.used$ \\ -2. If $x.alloc < 2m$ then grow $x$ to $2m$ digits. \\ -3. $\mu \leftarrow 0$ \\ -4. for $i$ from $0$ to $m - 1$ do \\ -\hspace{3mm}4.1 $\hat r \leftarrow k \cdot x_{m+i} + x_{i} + \mu$ \\ -\hspace{3mm}4.2 $x_{i} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}4.3 $\mu \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -5. $x_{m} \leftarrow \mu$ \\ -6. for $i$ from $m + 1$ to $x.used - 1$ do \\ -\hspace{3mm}6.1 $x_{i} \leftarrow 0$ \\ -7. Clamp excess digits of $x$. \\ -8. If $x \ge n$ then \\ -\hspace{3mm}8.1 $x \leftarrow x - n$ \\ -\hspace{3mm}8.2 Goto step 3. \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_dr\_reduce} -\end{figure} - -\textbf{Algorithm mp\_dr\_reduce.} -This algorithm will perform the Dimished Radix reduction of $x$ modulo $n$. It has similar restrictions to that of the Barrett reduction -with the addition that $n$ must be of the form $n = \beta^m - k$ where $0 < k <\beta$. - -This algorithm essentially implements the pseudo-code in figure~\ref{fig:DR} except with a slight optimization. The division by $\beta^m$, multiplication by $k$ -and addition of $x \mbox{ mod }\beta^m$ are all performed simultaneously inside the loop on step 4. The division by $\beta^m$ is emulated by accessing -the term at the $m+i$'th position which is subsequently multiplied by $k$ and added to the term at the $i$'th position. After the loop the $m$'th -digit is set to the carry and the upper digits are zeroed. Steps 5 and 6 emulate the reduction modulo $\beta^m$ that should have happend to -$x$ before the addition of the multiple of the upper half. - -At step 8 if $x$ is still larger than $n$ another pass of the algorithm is required. First $n$ is subtracted from $x$ and then the algorithm resumes -at step 3. - -EXAM,bn_mp_dr_reduce.c - -The first step is to grow $x$ as required to $2m$ digits since the reduction is performed in place on $x$. The label on line @49,top:@ is where -the algorithm will resume if further reduction passes are required. In theory it could be placed at the top of the function however, the size of -the modulus and question of whether $x$ is large enough are invariant after the first pass meaning that it would be a waste of time. - -The aliases $tmpx1$ and $tmpx2$ refer to the digits of $x$ where the latter is offset by $m$ digits. By reading digits from $x$ offset by $m$ digits -a division by $\beta^m$ can be simulated virtually for free. The loop on line @61,for@ performs the bulk of the work (\textit{corresponds to step 4 of algorithm 7.11}) -in this algorithm. - -By line @68,mu@ the pointer $tmpx1$ points to the $m$'th digit of $x$ which is where the final carry will be placed. Similarly by line @71,for@ the -same pointer will point to the $m+1$'th digit where the zeroes will be placed. - -Since the algorithm is only valid if both $x$ and $n$ are greater than zero an unsigned comparison suffices to determine if another pass is required. -With the same logic at line @82,sub@ the value of $x$ is known to be greater than or equal to $n$ meaning that an unsigned subtraction can be used -as well. Since the destination of the subtraction is the larger of the inputs the call to algorithm s\_mp\_sub cannot fail and the return code -does not need to be checked. - -\subsubsection{Setup} -To setup the restricted Diminished Radix algorithm the value $k = \beta - n_0$ is required. This algorithm is not really complicated but provided for -completeness. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_dr\_setup}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $k = \beta - n_0$ \\ -\hline \\ -1. $k \leftarrow \beta - n_0$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_dr\_setup} -\end{figure} - -EXAM,bn_mp_dr_setup.c - -\subsubsection{Modulus Detection} -Another algorithm which will be useful is the ability to detect a restricted Diminished Radix modulus. An integer is said to be -of restricted Diminished Radix form if all of the digits are equal to $\beta - 1$ except the trailing digit which may be any value. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_dr\_is\_modulus}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $1$ if $n$ is in D.R form, $0$ otherwise \\ -\hline -1. If $n.used < 2$ then return($0$). \\ -2. for $ix$ from $1$ to $n.used - 1$ do \\ -\hspace{3mm}2.1 If $n_{ix} \ne \beta - 1$ return($0$). \\ -3. Return($1$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_dr\_is\_modulus} -\end{figure} - -\textbf{Algorithm mp\_dr\_is\_modulus.} -This algorithm determines if a value is in Diminished Radix form. Step 1 rejects obvious cases where fewer than two digits are -in the mp\_int. Step 2 tests all but the first digit to see if they are equal to $\beta - 1$. If the algorithm manages to get to -step 3 then $n$ must be of Diminished Radix form. - -EXAM,bn_mp_dr_is_modulus.c - -\subsection{Unrestricted Diminished Radix Reduction} -The unrestricted Diminished Radix algorithm allows modular reductions to be performed when the modulus is of the form $2^p - k$. This algorithm -is a straightforward adaptation of algorithm~\ref{fig:DR}. - -In general the restricted Diminished Radix reduction algorithm is much faster since it has considerably lower overhead. However, this new -algorithm is much faster than either Montgomery or Barrett reduction when the moduli are of the appropriate form. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_2k}. \\ -\textbf{Input}. mp\_int $a$ and $n$. mp\_digit $k$ \\ -\hspace{11.5mm}($a \ge 0$, $n > 1$, $0 < k < \beta$, $n + k$ is a power of two) \\ -\textbf{Output}. $a \mbox{ (mod }n\mbox{)}$ \\ -\hline -1. $p \leftarrow \lceil lg(n) \rceil$ (\textit{mp\_count\_bits}) \\ -2. While $a \ge n$ do \\ -\hspace{3mm}2.1 $q \leftarrow \lfloor a / 2^p \rfloor$ (\textit{mp\_div\_2d}) \\ -\hspace{3mm}2.2 $a \leftarrow a \mbox{ (mod }2^p\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -\hspace{3mm}2.3 $q \leftarrow q \cdot k$ (\textit{mp\_mul\_d}) \\ -\hspace{3mm}2.4 $a \leftarrow a - q$ (\textit{s\_mp\_sub}) \\ -\hspace{3mm}2.5 If $a \ge n$ then do \\ -\hspace{6mm}2.5.1 $a \leftarrow a - n$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_2k} -\end{figure} - -\textbf{Algorithm mp\_reduce\_2k.} -This algorithm quickly reduces an input $a$ modulo an unrestricted Diminished Radix modulus $n$. Division by $2^p$ is emulated with a right -shift which makes the algorithm fairly inexpensive to use. - -EXAM,bn_mp_reduce_2k.c - -The algorithm mp\_count\_bits calculates the number of bits in an mp\_int which is used to find the initial value of $p$. The call to mp\_div\_2d -on line @31,mp_div_2d@ calculates both the quotient $q$ and the remainder $a$ required. By doing both in a single function call the code size -is kept fairly small. The multiplication by $k$ is only performed if $k > 1$. This allows reductions modulo $2^p - 1$ to be performed without -any multiplications. - -The unsigned s\_mp\_add, mp\_cmp\_mag and s\_mp\_sub are used in place of their full sign counterparts since the inputs are only valid if they are -positive. By using the unsigned versions the overhead is kept to a minimum. - -\subsubsection{Unrestricted Setup} -To setup this reduction algorithm the value of $k = 2^p - n$ is required. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_2k\_setup}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $k = 2^p - n$ \\ -\hline -1. $p \leftarrow \lceil lg(n) \rceil$ (\textit{mp\_count\_bits}) \\ -2. $x \leftarrow 2^p$ (\textit{mp\_2expt}) \\ -3. $x \leftarrow x - n$ (\textit{mp\_sub}) \\ -4. $k \leftarrow x_0$ \\ -5. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_2k\_setup} -\end{figure} - -\textbf{Algorithm mp\_reduce\_2k\_setup.} -This algorithm computes the value of $k$ required for the algorithm mp\_reduce\_2k. By making a temporary variable $x$ equal to $2^p$ a subtraction -is sufficient to solve for $k$. Alternatively if $n$ has more than one digit the value of $k$ is simply $\beta - n_0$. - -EXAM,bn_mp_reduce_2k_setup.c - -\subsubsection{Unrestricted Detection} -An integer $n$ is a valid unrestricted Diminished Radix modulus if either of the following are true. - -\begin{enumerate} -\item The number has only one digit. -\item The number has more than one digit and every bit from the $\beta$'th to the most significant is one. -\end{enumerate} - -If either condition is true than there is a power of two $2^p$ such that $0 < 2^p - n < \beta$. If the input is only -one digit than it will always be of the correct form. Otherwise all of the bits above the first digit must be one. This arises from the fact -that there will be value of $k$ that when added to the modulus causes a carry in the first digit which propagates all the way to the most -significant bit. The resulting sum will be a power of two. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_is\_2k}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $1$ if of proper form, $0$ otherwise \\ -\hline -1. If $n.used = 0$ then return($0$). \\ -2. If $n.used = 1$ then return($1$). \\ -3. $p \leftarrow \lceil lg(n) \rceil$ (\textit{mp\_count\_bits}) \\ -4. for $x$ from $lg(\beta)$ to $p$ do \\ -\hspace{3mm}4.1 If the ($x \mbox{ mod }lg(\beta)$)'th bit of the $\lfloor x / lg(\beta) \rfloor$ of $n$ is zero then return($0$). \\ -5. Return($1$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_is\_2k} -\end{figure} - -\textbf{Algorithm mp\_reduce\_is\_2k.} -This algorithm quickly determines if a modulus is of the form required for algorithm mp\_reduce\_2k to function properly. - -EXAM,bn_mp_reduce_is_2k.c - - - -\section{Algorithm Comparison} -So far three very different algorithms for modular reduction have been discussed. Each of the algorithms have their own strengths and weaknesses -that makes having such a selection very useful. The following table sumarizes the three algorithms along with comparisons of work factors. Since -all three algorithms have the restriction that $0 \le x < n^2$ and $n > 1$ those limitations are not included in the table. - -\begin{center} -\begin{small} -\begin{tabular}{|c|c|c|c|c|c|} -\hline \textbf{Method} & \textbf{Work Required} & \textbf{Limitations} & \textbf{$m = 8$} & \textbf{$m = 32$} & \textbf{$m = 64$} \\ -\hline Barrett & $m^2 + 2m - 1$ & None & $79$ & $1087$ & $4223$ \\ -\hline Montgomery & $m^2 + m$ & $n$ must be odd & $72$ & $1056$ & $4160$ \\ -\hline D.R. & $2m$ & $n = \beta^m - k$ & $16$ & $64$ & $128$ \\ -\hline -\end{tabular} -\end{small} -\end{center} - -In theory Montgomery and Barrett reductions would require roughly the same amount of time to complete. However, in practice since Montgomery -reduction can be written as a single function with the Comba technique it is much faster. Barrett reduction suffers from the overhead of -calling the half precision multipliers, addition and division by $\beta$ algorithms. - -For almost every cryptographic algorithm Montgomery reduction is the algorithm of choice. The one set of algorithms where Diminished Radix reduction truly -shines are based on the discrete logarithm problem such as Diffie-Hellman \cite{DH} and ElGamal \cite{ELGAMAL}. In these algorithms -primes of the form $\beta^m - k$ can be found and shared amongst users. These primes will allow the Diminished Radix algorithm to be used in -modular exponentiation to greatly speed up the operation. - - - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 3 \right ]$ & Prove that the ``trick'' in algorithm mp\_montgomery\_setup actually \\ - & calculates the correct value of $\rho$. \\ - & \\ -$\left [ 2 \right ]$ & Devise an algorithm to reduce modulo $n + k$ for small $k$ quickly. \\ - & \\ -$\left [ 4 \right ]$ & Prove that the pseudo-code algorithm ``Diminished Radix Reduction'' \\ - & (\textit{figure~\ref{fig:DR}}) terminates. Also prove the probability that it will \\ - & terminate within $1 \le k \le 10$ iterations. \\ - & \\ -\end{tabular} - - -\chapter{Exponentiation} -Exponentiation is the operation of raising one variable to the power of another, for example, $a^b$. A variant of exponentiation, computed -in a finite field or ring, is called modular exponentiation. This latter style of operation is typically used in public key -cryptosystems such as RSA and Diffie-Hellman. The ability to quickly compute modular exponentiations is of great benefit to any -such cryptosystem and many methods have been sought to speed it up. - -\section{Exponentiation Basics} -A trivial algorithm would simply multiply $a$ against itself $b - 1$ times to compute the exponentiation desired. However, as $b$ grows in size -the number of multiplications becomes prohibitive. Imagine what would happen if $b$ $\approx$ $2^{1024}$ as is the case when computing an RSA signature -with a $1024$-bit key. Such a calculation could never be completed as it would take simply far too long. - -Fortunately there is a very simple algorithm based on the laws of exponents. Recall that $lg_a(a^b) = b$ and that $lg_a(a^ba^c) = b + c$ which -are two trivial relationships between the base and the exponent. Let $b_i$ represent the $i$'th bit of $b$ starting from the least -significant bit. If $b$ is a $k$-bit integer than the following equation is true. - -\begin{equation} -a^b = \prod_{i=0}^{k-1} a^{2^i \cdot b_i} -\end{equation} - -By taking the base $a$ logarithm of both sides of the equation the following equation is the result. - -\begin{equation} -b = \sum_{i=0}^{k-1}2^i \cdot b_i -\end{equation} - -The term $a^{2^i}$ can be found from the $i - 1$'th term by squaring the term since $\left ( a^{2^i} \right )^2$ is equal to -$a^{2^{i+1}}$. This observation forms the basis of essentially all fast exponentiation algorithms. It requires $k$ squarings and on average -$k \over 2$ multiplications to compute the result. This is indeed quite an improvement over simply multiplying by $a$ a total of $b-1$ times. - -While this current method is a considerable speed up there are further improvements to be made. For example, the $a^{2^i}$ term does not need to -be computed in an auxilary variable. Consider the following equivalent algorithm. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Left to Right Exponentiation}. \\ -\textbf{Input}. Integer $a$, $b$ and $k$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $c \leftarrow 1$ \\ -2. for $i$ from $k - 1$ to $0$ do \\ -\hspace{3mm}2.1 $c \leftarrow c^2$ \\ -\hspace{3mm}2.2 $c \leftarrow c \cdot a^{b_i}$ \\ -3. Return $c$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Left to Right Exponentiation} -\label{fig:LTOR} -\end{figure} - -This algorithm starts from the most significant bit and works towards the least significant bit. When the $i$'th bit of $b$ is set $a$ is -multiplied against the current product. In each iteration the product is squared which doubles the exponent of the individual terms of the -product. - -For example, let $b = 101100_2 \equiv 44_{10}$. The following chart demonstrates the actions of the algorithm. - -\newpage\begin{figure} -\begin{center} -\begin{tabular}{|c|c|} -\hline \textbf{Value of $i$} & \textbf{Value of $c$} \\ -\hline - & $1$ \\ -\hline $5$ & $a$ \\ -\hline $4$ & $a^2$ \\ -\hline $3$ & $a^4 \cdot a$ \\ -\hline $2$ & $a^8 \cdot a^2 \cdot a$ \\ -\hline $1$ & $a^{16} \cdot a^4 \cdot a^2$ \\ -\hline $0$ & $a^{32} \cdot a^8 \cdot a^4$ \\ -\hline -\end{tabular} -\end{center} -\caption{Example of Left to Right Exponentiation} -\end{figure} - -When the product $a^{32} \cdot a^8 \cdot a^4$ is simplified it is equal $a^{44}$ which is the desired exponentiation. This particular algorithm is -called ``Left to Right'' because it reads the exponent in that order. All of the exponentiation algorithms that will be presented are of this nature. - -\subsection{Single Digit Exponentiation} -The first algorithm in the series of exponentiation algorithms will be an unbounded algorithm where the exponent is a single digit. It is intended -to be used when a small power of an input is required (\textit{e.g. $a^5$}). It is faster than simply multiplying $b - 1$ times for all values of -$b$ that are greater than three. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_expt\_d}. \\ -\textbf{Input}. mp\_int $a$ and mp\_digit $b$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $g \leftarrow a$ (\textit{mp\_init\_copy}) \\ -2. $c \leftarrow 1$ (\textit{mp\_set}) \\ -3. for $x$ from 1 to $lg(\beta)$ do \\ -\hspace{3mm}3.1 $c \leftarrow c^2$ (\textit{mp\_sqr}) \\ -\hspace{3mm}3.2 If $b$ AND $2^{lg(\beta) - 1} \ne 0$ then \\ -\hspace{6mm}3.2.1 $c \leftarrow c \cdot g$ (\textit{mp\_mul}) \\ -\hspace{3mm}3.3 $b \leftarrow b << 1$ \\ -4. Clear $g$. \\ -5. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_expt\_d} -\end{figure} - -\textbf{Algorithm mp\_expt\_d.} -This algorithm computes the value of $a$ raised to the power of a single digit $b$. It uses the left to right exponentiation algorithm to -quickly compute the exponentiation. It is loosely based on algorithm 14.79 of HAC \cite[pp. 615]{HAC} with the difference that the -exponent is a fixed width. - -A copy of $a$ is made first to allow destination variable $c$ be the same as the source variable $a$. The result is set to the initial value of -$1$ in the subsequent step. - -Inside the loop the exponent is read from the most significant bit first down to the least significant bit. First $c$ is invariably squared -on step 3.1. In the following step if the most significant bit of $b$ is one the copy of $a$ is multiplied against $c$. The value -of $b$ is shifted left one bit to make the next bit down from the most signficant bit the new most significant bit. In effect each -iteration of the loop moves the bits of the exponent $b$ upwards to the most significant location. - -EXAM,bn_mp_expt_d_ex.c - -This describes only the algorithm that is used when the parameter $fast$ is $0$. Line @31,mp_set@ sets the initial value of the result to $1$. Next the loop on line @54,for@ steps through each bit of the exponent starting from -the most significant down towards the least significant. The invariant squaring operation placed on line @333,mp_sqr@ is performed first. After -the squaring the result $c$ is multiplied by the base $g$ if and only if the most significant bit of the exponent is set. The shift on line -@69,<<@ moves all of the bits of the exponent upwards towards the most significant location. - -\section{$k$-ary Exponentiation} -When calculating an exponentiation the most time consuming bottleneck is the multiplications which are in general a small factor -slower than squaring. Recall from the previous algorithm that $b_{i}$ refers to the $i$'th bit of the exponent $b$. Suppose instead it referred to -the $i$'th $k$-bit digit of the exponent of $b$. For $k = 1$ the definitions are synonymous and for $k > 1$ algorithm~\ref{fig:KARY} -computes the same exponentiation. A group of $k$ bits from the exponent is called a \textit{window}. That is it is a small window on only a -portion of the entire exponent. Consider the following modification to the basic left to right exponentiation algorithm. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{$k$-ary Exponentiation}. \\ -\textbf{Input}. Integer $a$, $b$, $k$ and $t$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $c \leftarrow 1$ \\ -2. for $i$ from $t - 1$ to $0$ do \\ -\hspace{3mm}2.1 $c \leftarrow c^{2^k} $ \\ -\hspace{3mm}2.2 Extract the $i$'th $k$-bit word from $b$ and store it in $g$. \\ -\hspace{3mm}2.3 $c \leftarrow c \cdot a^g$ \\ -3. Return $c$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{$k$-ary Exponentiation} -\label{fig:KARY} -\end{figure} - -The squaring on step 2.1 can be calculated by squaring the value $c$ successively $k$ times. If the values of $a^g$ for $0 < g < 2^k$ have been -precomputed this algorithm requires only $t$ multiplications and $tk$ squarings. The table can be generated with $2^{k - 1} - 1$ squarings and -$2^{k - 1} + 1$ multiplications. This algorithm assumes that the number of bits in the exponent is evenly divisible by $k$. -However, when it is not the remaining $0 < x \le k - 1$ bits can be handled with algorithm~\ref{fig:LTOR}. - -Suppose $k = 4$ and $t = 100$. This modified algorithm will require $109$ multiplications and $408$ squarings to compute the exponentiation. The -original algorithm would on average have required $200$ multiplications and $400$ squrings to compute the same value. The total number of squarings -has increased slightly but the number of multiplications has nearly halved. - -\subsection{Optimal Values of $k$} -An optimal value of $k$ will minimize $2^{k} + \lceil n / k \rceil + n - 1$ for a fixed number of bits in the exponent $n$. The simplest -approach is to brute force search amongst the values $k = 2, 3, \ldots, 8$ for the lowest result. Table~\ref{fig:OPTK} lists optimal values of $k$ -for various exponent sizes and compares the number of multiplication and squarings required against algorithm~\ref{fig:LTOR}. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|c|c|c|c|c|c|} -\hline \textbf{Exponent (bits)} & \textbf{Optimal $k$} & \textbf{Work at $k$} & \textbf{Work with ~\ref{fig:LTOR}} \\ -\hline $16$ & $2$ & $27$ & $24$ \\ -\hline $32$ & $3$ & $49$ & $48$ \\ -\hline $64$ & $3$ & $92$ & $96$ \\ -\hline $128$ & $4$ & $175$ & $192$ \\ -\hline $256$ & $4$ & $335$ & $384$ \\ -\hline $512$ & $5$ & $645$ & $768$ \\ -\hline $1024$ & $6$ & $1257$ & $1536$ \\ -\hline $2048$ & $6$ & $2452$ & $3072$ \\ -\hline $4096$ & $7$ & $4808$ & $6144$ \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Optimal Values of $k$ for $k$-ary Exponentiation} -\label{fig:OPTK} -\end{figure} - -\subsection{Sliding-Window Exponentiation} -A simple modification to the previous algorithm is only generate the upper half of the table in the range $2^{k-1} \le g < 2^k$. Essentially -this is a table for all values of $g$ where the most significant bit of $g$ is a one. However, in order for this to be allowed in the -algorithm values of $g$ in the range $0 \le g < 2^{k-1}$ must be avoided. - -Table~\ref{fig:OPTK2} lists optimal values of $k$ for various exponent sizes and compares the work required against algorithm {\ref{fig:KARY}}. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|c|c|c|c|c|c|} -\hline \textbf{Exponent (bits)} & \textbf{Optimal $k$} & \textbf{Work at $k$} & \textbf{Work with ~\ref{fig:KARY}} \\ -\hline $16$ & $3$ & $24$ & $27$ \\ -\hline $32$ & $3$ & $45$ & $49$ \\ -\hline $64$ & $4$ & $87$ & $92$ \\ -\hline $128$ & $4$ & $167$ & $175$ \\ -\hline $256$ & $5$ & $322$ & $335$ \\ -\hline $512$ & $6$ & $628$ & $645$ \\ -\hline $1024$ & $6$ & $1225$ & $1257$ \\ -\hline $2048$ & $7$ & $2403$ & $2452$ \\ -\hline $4096$ & $8$ & $4735$ & $4808$ \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Optimal Values of $k$ for Sliding Window Exponentiation} -\label{fig:OPTK2} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Sliding Window $k$-ary Exponentiation}. \\ -\textbf{Input}. Integer $a$, $b$, $k$ and $t$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $c \leftarrow 1$ \\ -2. for $i$ from $t - 1$ to $0$ do \\ -\hspace{3mm}2.1 If the $i$'th bit of $b$ is a zero then \\ -\hspace{6mm}2.1.1 $c \leftarrow c^2$ \\ -\hspace{3mm}2.2 else do \\ -\hspace{6mm}2.2.1 $c \leftarrow c^{2^k}$ \\ -\hspace{6mm}2.2.2 Extract the $k$ bits from $(b_{i}b_{i-1}\ldots b_{i-(k-1)})$ and store it in $g$. \\ -\hspace{6mm}2.2.3 $c \leftarrow c \cdot a^g$ \\ -\hspace{6mm}2.2.4 $i \leftarrow i - k$ \\ -3. Return $c$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Sliding Window $k$-ary Exponentiation} -\end{figure} - -Similar to the previous algorithm this algorithm must have a special handler when fewer than $k$ bits are left in the exponent. While this -algorithm requires the same number of squarings it can potentially have fewer multiplications. The pre-computed table $a^g$ is also half -the size as the previous table. - -Consider the exponent $b = 111101011001000_2 \equiv 31432_{10}$ with $k = 3$ using both algorithms. The first algorithm will divide the exponent up as -the following five $3$-bit words $b \equiv \left ( 111, 101, 011, 001, 000 \right )_{2}$. The second algorithm will break the -exponent as $b \equiv \left ( 111, 101, 0, 110, 0, 100, 0 \right )_{2}$. The single digit $0$ in the second representation are where -a single squaring took place instead of a squaring and multiplication. In total the first method requires $10$ multiplications and $18$ -squarings. The second method requires $8$ multiplications and $18$ squarings. - -In general the sliding window method is never slower than the generic $k$-ary method and often it is slightly faster. - -\section{Modular Exponentiation} - -Modular exponentiation is essentially computing the power of a base within a finite field or ring. For example, computing -$d \equiv a^b \mbox{ (mod }c\mbox{)}$ is a modular exponentiation. Instead of first computing $a^b$ and then reducing it -modulo $c$ the intermediate result is reduced modulo $c$ after every squaring or multiplication operation. - -This guarantees that any intermediate result is bounded by $0 \le d \le c^2 - 2c + 1$ and can be reduced modulo $c$ quickly using -one of the algorithms presented in ~REDUCTION~. - -Before the actual modular exponentiation algorithm can be written a wrapper algorithm must be written first. This algorithm -will allow the exponent $b$ to be negative which is computed as $c \equiv \left (1 / a \right )^{\vert b \vert} \mbox{(mod }d\mbox{)}$. The -value of $(1/a) \mbox{ mod }c$ is computed using the modular inverse (\textit{see \ref{sec;modinv}}). If no inverse exists the algorithm -terminates with an error. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_exptmod}. \\ -\textbf{Input}. mp\_int $a$, $b$ and $c$ \\ -\textbf{Output}. $y \equiv g^x \mbox{ (mod }p\mbox{)}$ \\ -\hline \\ -1. If $c.sign = MP\_NEG$ return(\textit{MP\_VAL}). \\ -2. If $b.sign = MP\_NEG$ then \\ -\hspace{3mm}2.1 $g' \leftarrow g^{-1} \mbox{ (mod }c\mbox{)}$ \\ -\hspace{3mm}2.2 $x' \leftarrow \vert x \vert$ \\ -\hspace{3mm}2.3 Compute $d \equiv g'^{x'} \mbox{ (mod }c\mbox{)}$ via recursion. \\ -3. if $p$ is odd \textbf{OR} $p$ is a D.R. modulus then \\ -\hspace{3mm}3.1 Compute $y \equiv g^{x} \mbox{ (mod }p\mbox{)}$ via algorithm mp\_exptmod\_fast. \\ -4. else \\ -\hspace{3mm}4.1 Compute $y \equiv g^{x} \mbox{ (mod }p\mbox{)}$ via algorithm s\_mp\_exptmod. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_exptmod} -\end{figure} - -\textbf{Algorithm mp\_exptmod.} -The first algorithm which actually performs modular exponentiation is algorithm s\_mp\_exptmod. It is a sliding window $k$-ary algorithm -which uses Barrett reduction to reduce the product modulo $p$. The second algorithm mp\_exptmod\_fast performs the same operation -except it uses either Montgomery or Diminished Radix reduction. The two latter reduction algorithms are clumped in the same exponentiation -algorithm since their arguments are essentially the same (\textit{two mp\_ints and one mp\_digit}). - -EXAM,bn_mp_exptmod.c - -In order to keep the algorithms in a known state the first step on line @29,if@ is to reject any negative modulus as input. If the exponent is -negative the algorithm tries to perform a modular exponentiation with the modular inverse of the base $G$. The temporary variable $tmpG$ is assigned -the modular inverse of $G$ and $tmpX$ is assigned the absolute value of $X$. The algorithm will recuse with these new values with a positive -exponent. - -If the exponent is positive the algorithm resumes the exponentiation. Line @63,dr_@ determines if the modulus is of the restricted Diminished Radix -form. If it is not line @65,reduce@ attempts to determine if it is of a unrestricted Diminished Radix form. The integer $dr$ will take on one -of three values. - -\begin{enumerate} -\item $dr = 0$ means that the modulus is not of either restricted or unrestricted Diminished Radix form. -\item $dr = 1$ means that the modulus is of restricted Diminished Radix form. -\item $dr = 2$ means that the modulus is of unrestricted Diminished Radix form. -\end{enumerate} - -Line @69,if@ determines if the fast modular exponentiation algorithm can be used. It is allowed if $dr \ne 0$ or if the modulus is odd. Otherwise, -the slower s\_mp\_exptmod algorithm is used which uses Barrett reduction. - -\subsection{Barrett Modular Exponentiation} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_exptmod}. \\ -\textbf{Input}. mp\_int $a$, $b$ and $c$ \\ -\textbf{Output}. $y \equiv g^x \mbox{ (mod }p\mbox{)}$ \\ -\hline \\ -1. $k \leftarrow lg(x)$ \\ -2. $winsize \leftarrow \left \lbrace \begin{array}{ll} - 2 & \mbox{if }k \le 7 \\ - 3 & \mbox{if }7 < k \le 36 \\ - 4 & \mbox{if }36 < k \le 140 \\ - 5 & \mbox{if }140 < k \le 450 \\ - 6 & \mbox{if }450 < k \le 1303 \\ - 7 & \mbox{if }1303 < k \le 3529 \\ - 8 & \mbox{if }3529 < k \\ - \end{array} \right .$ \\ -3. Initialize $2^{winsize}$ mp\_ints in an array named $M$ and one mp\_int named $\mu$ \\ -4. Calculate the $\mu$ required for Barrett Reduction (\textit{mp\_reduce\_setup}). \\ -5. $M_1 \leftarrow g \mbox{ (mod }p\mbox{)}$ \\ -\\ -Setup the table of small powers of $g$. First find $g^{2^{winsize}}$ and then all multiples of it. \\ -6. $k \leftarrow 2^{winsize - 1}$ \\ -7. $M_{k} \leftarrow M_1$ \\ -8. for $ix$ from 0 to $winsize - 2$ do \\ -\hspace{3mm}8.1 $M_k \leftarrow \left ( M_k \right )^2$ (\textit{mp\_sqr}) \\ -\hspace{3mm}8.2 $M_k \leftarrow M_k \mbox{ (mod }p\mbox{)}$ (\textit{mp\_reduce}) \\ -9. for $ix$ from $2^{winsize - 1} + 1$ to $2^{winsize} - 1$ do \\ -\hspace{3mm}9.1 $M_{ix} \leftarrow M_{ix - 1} \cdot M_{1}$ (\textit{mp\_mul}) \\ -\hspace{3mm}9.2 $M_{ix} \leftarrow M_{ix} \mbox{ (mod }p\mbox{)}$ (\textit{mp\_reduce}) \\ -10. $res \leftarrow 1$ \\ -\\ -Start Sliding Window. \\ -11. $mode \leftarrow 0, bitcnt \leftarrow 1, buf \leftarrow 0, digidx \leftarrow x.used - 1, bitcpy \leftarrow 0, bitbuf \leftarrow 0$ \\ -12. Loop \\ -\hspace{3mm}12.1 $bitcnt \leftarrow bitcnt - 1$ \\ -\hspace{3mm}12.2 If $bitcnt = 0$ then do \\ -\hspace{6mm}12.2.1 If $digidx = -1$ goto step 13. \\ -\hspace{6mm}12.2.2 $buf \leftarrow x_{digidx}$ \\ -\hspace{6mm}12.2.3 $digidx \leftarrow digidx - 1$ \\ -\hspace{6mm}12.2.4 $bitcnt \leftarrow lg(\beta)$ \\ -Continued on next page. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_exptmod} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_exptmod} (\textit{continued}). \\ -\textbf{Input}. mp\_int $a$, $b$ and $c$ \\ -\textbf{Output}. $y \equiv g^x \mbox{ (mod }p\mbox{)}$ \\ -\hline \\ -\hspace{3mm}12.3 $y \leftarrow (buf >> (lg(\beta) - 1))$ AND $1$ \\ -\hspace{3mm}12.4 $buf \leftarrow buf << 1$ \\ -\hspace{3mm}12.5 if $mode = 0$ and $y = 0$ then goto step 12. \\ -\hspace{3mm}12.6 if $mode = 1$ and $y = 0$ then do \\ -\hspace{6mm}12.6.1 $res \leftarrow res^2$ \\ -\hspace{6mm}12.6.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}12.6.3 Goto step 12. \\ -\hspace{3mm}12.7 $bitcpy \leftarrow bitcpy + 1$ \\ -\hspace{3mm}12.8 $bitbuf \leftarrow bitbuf + (y << (winsize - bitcpy))$ \\ -\hspace{3mm}12.9 $mode \leftarrow 2$ \\ -\hspace{3mm}12.10 If $bitcpy = winsize$ then do \\ -\hspace{6mm}Window is full so perform the squarings and single multiplication. \\ -\hspace{6mm}12.10.1 for $ix$ from $0$ to $winsize -1$ do \\ -\hspace{9mm}12.10.1.1 $res \leftarrow res^2$ \\ -\hspace{9mm}12.10.1.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}12.10.2 $res \leftarrow res \cdot M_{bitbuf}$ \\ -\hspace{6mm}12.10.3 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}Reset the window. \\ -\hspace{6mm}12.10.4 $bitcpy \leftarrow 0, bitbuf \leftarrow 0, mode \leftarrow 1$ \\ -\\ -No more windows left. Check for residual bits of exponent. \\ -13. If $mode = 2$ and $bitcpy > 0$ then do \\ -\hspace{3mm}13.1 for $ix$ form $0$ to $bitcpy - 1$ do \\ -\hspace{6mm}13.1.1 $res \leftarrow res^2$ \\ -\hspace{6mm}13.1.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}13.1.3 $bitbuf \leftarrow bitbuf << 1$ \\ -\hspace{6mm}13.1.4 If $bitbuf$ AND $2^{winsize} \ne 0$ then do \\ -\hspace{9mm}13.1.4.1 $res \leftarrow res \cdot M_{1}$ \\ -\hspace{9mm}13.1.4.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -14. $y \leftarrow res$ \\ -15. Clear $res$, $mu$ and the $M$ array. \\ -16. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_exptmod (continued)} -\end{figure} - -\textbf{Algorithm s\_mp\_exptmod.} -This algorithm computes the $x$'th power of $g$ modulo $p$ and stores the result in $y$. It takes advantage of the Barrett reduction -algorithm to keep the product small throughout the algorithm. - -The first two steps determine the optimal window size based on the number of bits in the exponent. The larger the exponent the -larger the window size becomes. After a window size $winsize$ has been chosen an array of $2^{winsize}$ mp\_int variables is allocated. This -table will hold the values of $g^x \mbox{ (mod }p\mbox{)}$ for $2^{winsize - 1} \le x < 2^{winsize}$. - -After the table is allocated the first power of $g$ is found. Since $g \ge p$ is allowed it must be first reduced modulo $p$ to make -the rest of the algorithm more efficient. The first element of the table at $2^{winsize - 1}$ is found by squaring $M_1$ successively $winsize - 2$ -times. The rest of the table elements are found by multiplying the previous element by $M_1$ modulo $p$. - -Now that the table is available the sliding window may begin. The following list describes the functions of all the variables in the window. -\begin{enumerate} -\item The variable $mode$ dictates how the bits of the exponent are interpreted. -\begin{enumerate} - \item When $mode = 0$ the bits are ignored since no non-zero bit of the exponent has been seen yet. For example, if the exponent were simply - $1$ then there would be $lg(\beta) - 1$ zero bits before the first non-zero bit. In this case bits are ignored until a non-zero bit is found. - \item When $mode = 1$ a non-zero bit has been seen before and a new $winsize$-bit window has not been formed yet. In this mode leading $0$ bits - are read and a single squaring is performed. If a non-zero bit is read a new window is created. - \item When $mode = 2$ the algorithm is in the middle of forming a window and new bits are appended to the window from the most significant bit - downwards. -\end{enumerate} -\item The variable $bitcnt$ indicates how many bits are left in the current digit of the exponent left to be read. When it reaches zero a new digit - is fetched from the exponent. -\item The variable $buf$ holds the currently read digit of the exponent. -\item The variable $digidx$ is an index into the exponents digits. It starts at the leading digit $x.used - 1$ and moves towards the trailing digit. -\item The variable $bitcpy$ indicates how many bits are in the currently formed window. When it reaches $winsize$ the window is flushed and - the appropriate operations performed. -\item The variable $bitbuf$ holds the current bits of the window being formed. -\end{enumerate} - -All of step 12 is the window processing loop. It will iterate while there are digits available form the exponent to read. The first step -inside this loop is to extract a new digit if no more bits are available in the current digit. If there are no bits left a new digit is -read and if there are no digits left than the loop terminates. - -After a digit is made available step 12.3 will extract the most significant bit of the current digit and move all other bits in the digit -upwards. In effect the digit is read from most significant bit to least significant bit and since the digits are read from leading to -trailing edges the entire exponent is read from most significant bit to least significant bit. - -At step 12.5 if the $mode$ and currently extracted bit $y$ are both zero the bit is ignored and the next bit is read. This prevents the -algorithm from having to perform trivial squaring and reduction operations before the first non-zero bit is read. Step 12.6 and 12.7-10 handle -the two cases of $mode = 1$ and $mode = 2$ respectively. - -FIGU,expt_state,Sliding Window State Diagram - -By step 13 there are no more digits left in the exponent. However, there may be partial bits in the window left. If $mode = 2$ then -a Left-to-Right algorithm is used to process the remaining few bits. - -EXAM,bn_s_mp_exptmod.c - -Lines @31,if@ through @45,}@ determine the optimal window size based on the length of the exponent in bits. The window divisions are sorted -from smallest to greatest so that in each \textbf{if} statement only one condition must be tested. For example, by the \textbf{if} statement -on line @37,if@ the value of $x$ is already known to be greater than $140$. - -The conditional piece of code beginning on line @42,ifdef@ allows the window size to be restricted to five bits. This logic is used to ensure -the table of precomputed powers of $G$ remains relatively small. - -The for loop on line @60,for@ initializes the $M$ array while lines @71,mp_init@ and @75,mp_reduce@ through @85,}@ initialize the reduction -function that will be used for this modulus. - --- More later. - -\section{Quick Power of Two} -Calculating $b = 2^a$ can be performed much quicker than with any of the previous algorithms. Recall that a logical shift left $m << k$ is -equivalent to $m \cdot 2^k$. By this logic when $m = 1$ a quick power of two can be achieved. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_2expt}. \\ -\textbf{Input}. integer $b$ \\ -\textbf{Output}. $a \leftarrow 2^b$ \\ -\hline \\ -1. $a \leftarrow 0$ \\ -2. If $a.alloc < \lfloor b / lg(\beta) \rfloor + 1$ then grow $a$ appropriately. \\ -3. $a.used \leftarrow \lfloor b / lg(\beta) \rfloor + 1$ \\ -4. $a_{\lfloor b / lg(\beta) \rfloor} \leftarrow 1 << (b \mbox{ mod } lg(\beta))$ \\ -5. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_2expt} -\end{figure} - -\textbf{Algorithm mp\_2expt.} - -EXAM,bn_mp_2expt.c - -\chapter{Higher Level Algorithms} - -This chapter discusses the various higher level algorithms that are required to complete a well rounded multiple precision integer package. These -routines are less performance oriented than the algorithms of chapters five, six and seven but are no less important. - -The first section describes a method of integer division with remainder that is universally well known. It provides the signed division logic -for the package. The subsequent section discusses a set of algorithms which allow a single digit to be the 2nd operand for a variety of operations. -These algorithms serve mostly to simplify other algorithms where small constants are required. The last two sections discuss how to manipulate -various representations of integers. For example, converting from an mp\_int to a string of character. - -\section{Integer Division with Remainder} -\label{sec:division} - -Integer division aside from modular exponentiation is the most intensive algorithm to compute. Like addition, subtraction and multiplication -the basis of this algorithm is the long-hand division algorithm taught to school children. Throughout this discussion several common variables -will be used. Let $x$ represent the divisor and $y$ represent the dividend. Let $q$ represent the integer quotient $\lfloor y / x \rfloor$ and -let $r$ represent the remainder $r = y - x \lfloor y / x \rfloor$. The following simple algorithm will be used to start the discussion. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Radix-$\beta$ Integer Division}. \\ -\textbf{Input}. integer $x$ and $y$ \\ -\textbf{Output}. $q = \lfloor y/x\rfloor, r = y - xq$ \\ -\hline \\ -1. $q \leftarrow 0$ \\ -2. $n \leftarrow \vert \vert y \vert \vert - \vert \vert x \vert \vert$ \\ -3. for $t$ from $n$ down to $0$ do \\ -\hspace{3mm}3.1 Maximize $k$ such that $kx\beta^t$ is less than or equal to $y$ and $(k + 1)x\beta^t$ is greater. \\ -\hspace{3mm}3.2 $q \leftarrow q + k\beta^t$ \\ -\hspace{3mm}3.3 $y \leftarrow y - kx\beta^t$ \\ -4. $r \leftarrow y$ \\ -5. Return($q, r$) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Radix-$\beta$ Integer Division} -\label{fig:raddiv} -\end{figure} - -As children we are taught this very simple algorithm for the case of $\beta = 10$. Almost instinctively several optimizations are taught for which -their reason of existing are never explained. For this example let $y = 5471$ represent the dividend and $x = 23$ represent the divisor. - -To find the first digit of the quotient the value of $k$ must be maximized such that $kx\beta^t$ is less than or equal to $y$ and -simultaneously $(k + 1)x\beta^t$ is greater than $y$. Implicitly $k$ is the maximum value the $t$'th digit of the quotient may have. The habitual method -used to find the maximum is to ``eyeball'' the two numbers, typically only the leading digits and quickly estimate a quotient. By only using leading -digits a much simpler division may be used to form an educated guess at what the value must be. In this case $k = \lfloor 54/23\rfloor = 2$ quickly -arises as a possible solution. Indeed $2x\beta^2 = 4600$ is less than $y = 5471$ and simultaneously $(k + 1)x\beta^2 = 6900$ is larger than $y$. -As a result $k\beta^2$ is added to the quotient which now equals $q = 200$ and $4600$ is subtracted from $y$ to give a remainder of $y = 841$. - -Again this process is repeated to produce the quotient digit $k = 3$ which makes the quotient $q = 200 + 3\beta = 230$ and the remainder -$y = 841 - 3x\beta = 181$. Finally the last iteration of the loop produces $k = 7$ which leads to the quotient $q = 230 + 7 = 237$ and the -remainder $y = 181 - 7x = 20$. The final quotient and remainder found are $q = 237$ and $r = y = 20$ which are indeed correct since -$237 \cdot 23 + 20 = 5471$ is true. - -\subsection{Quotient Estimation} -\label{sec:divest} -As alluded to earlier the quotient digit $k$ can be estimated from only the leading digits of both the divisor and dividend. When $p$ leading -digits are used from both the divisor and dividend to form an estimation the accuracy of the estimation rises as $p$ grows. Technically -speaking the estimation is based on assuming the lower $\vert \vert y \vert \vert - p$ and $\vert \vert x \vert \vert - p$ lower digits of the -dividend and divisor are zero. - -The value of the estimation may off by a few values in either direction and in general is fairly correct. A simplification \cite[pp. 271]{TAOCPV2} -of the estimation technique is to use $t + 1$ digits of the dividend and $t$ digits of the divisor, in particularly when $t = 1$. The estimate -using this technique is never too small. For the following proof let $t = \vert \vert y \vert \vert - 1$ and $s = \vert \vert x \vert \vert - 1$ -represent the most significant digits of the dividend and divisor respectively. - -\textbf{Proof.}\textit{ The quotient $\hat k = \lfloor (y_t\beta + y_{t-1}) / x_s \rfloor$ is greater than or equal to -$k = \lfloor y / (x \cdot \beta^{\vert \vert y \vert \vert - \vert \vert x \vert \vert - 1}) \rfloor$. } -The first obvious case is when $\hat k = \beta - 1$ in which case the proof is concluded since the real quotient cannot be larger. For all other -cases $\hat k = \lfloor (y_t\beta + y_{t-1}) / x_s \rfloor$ and $\hat k x_s \ge y_t\beta + y_{t-1} - x_s + 1$. The latter portion of the inequalility -$-x_s + 1$ arises from the fact that a truncated integer division will give the same quotient for at most $x_s - 1$ values. Next a series of -inequalities will prove the hypothesis. - -\begin{equation} -y - \hat k x \le y - \hat k x_s\beta^s -\end{equation} - -This is trivially true since $x \ge x_s\beta^s$. Next we replace $\hat kx_s\beta^s$ by the previous inequality for $\hat kx_s$. - -\begin{equation} -y - \hat k x \le y_t\beta^t + \ldots + y_0 - (y_t\beta^t + y_{t-1}\beta^{t-1} - x_s\beta^t + \beta^s) -\end{equation} - -By simplifying the previous inequality the following inequality is formed. - -\begin{equation} -y - \hat k x \le y_{t-2}\beta^{t-2} + \ldots + y_0 + x_s\beta^s - \beta^s -\end{equation} - -Subsequently, - -\begin{equation} -y_{t-2}\beta^{t-2} + \ldots + y_0 + x_s\beta^s - \beta^s < x_s\beta^s \le x -\end{equation} - -Which proves that $y - \hat kx \le x$ and by consequence $\hat k \ge k$ which concludes the proof. \textbf{QED} - - -\subsection{Normalized Integers} -For the purposes of division a normalized input is when the divisors leading digit $x_n$ is greater than or equal to $\beta / 2$. By multiplying both -$x$ and $y$ by $j = \lfloor (\beta / 2) / x_n \rfloor$ the quotient remains unchanged and the remainder is simply $j$ times the original -remainder. The purpose of normalization is to ensure the leading digit of the divisor is sufficiently large such that the estimated quotient will -lie in the domain of a single digit. Consider the maximum dividend $(\beta - 1) \cdot \beta + (\beta - 1)$ and the minimum divisor $\beta / 2$. - -\begin{equation} -{{\beta^2 - 1} \over { \beta / 2}} \le 2\beta - {2 \over \beta} -\end{equation} - -At most the quotient approaches $2\beta$, however, in practice this will not occur since that would imply the previous quotient digit was too small. - -\subsection{Radix-$\beta$ Division with Remainder} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div}. \\ -\textbf{Input}. mp\_int $a, b$ \\ -\textbf{Output}. $c = \lfloor a/b \rfloor$, $d = a - bc$ \\ -\hline \\ -1. If $b = 0$ return(\textit{MP\_VAL}). \\ -2. If $\vert a \vert < \vert b \vert$ then do \\ -\hspace{3mm}2.1 $d \leftarrow a$ \\ -\hspace{3mm}2.2 $c \leftarrow 0$ \\ -\hspace{3mm}2.3 Return(\textit{MP\_OKAY}). \\ -\\ -Setup the quotient to receive the digits. \\ -3. Grow $q$ to $a.used + 2$ digits. \\ -4. $q \leftarrow 0$ \\ -5. $x \leftarrow \vert a \vert , y \leftarrow \vert b \vert$ \\ -6. $sign \leftarrow \left \lbrace \begin{array}{ll} - MP\_ZPOS & \mbox{if }a.sign = b.sign \\ - MP\_NEG & \mbox{otherwise} \\ - \end{array} \right .$ \\ -\\ -Normalize the inputs such that the leading digit of $y$ is greater than or equal to $\beta / 2$. \\ -7. $norm \leftarrow (lg(\beta) - 1) - (\lceil lg(y) \rceil \mbox{ (mod }lg(\beta)\mbox{)})$ \\ -8. $x \leftarrow x \cdot 2^{norm}, y \leftarrow y \cdot 2^{norm}$ \\ -\\ -Find the leading digit of the quotient. \\ -9. $n \leftarrow x.used - 1, t \leftarrow y.used - 1$ \\ -10. $y \leftarrow y \cdot \beta^{n - t}$ \\ -11. While ($x \ge y$) do \\ -\hspace{3mm}11.1 $q_{n - t} \leftarrow q_{n - t} + 1$ \\ -\hspace{3mm}11.2 $x \leftarrow x - y$ \\ -12. $y \leftarrow \lfloor y / \beta^{n-t} \rfloor$ \\ -\\ -Continued on the next page. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div} (continued). \\ -\textbf{Input}. mp\_int $a, b$ \\ -\textbf{Output}. $c = \lfloor a/b \rfloor$, $d = a - bc$ \\ -\hline \\ -Now find the remainder fo the digits. \\ -13. for $i$ from $n$ down to $(t + 1)$ do \\ -\hspace{3mm}13.1 If $i > x.used$ then jump to the next iteration of this loop. \\ -\hspace{3mm}13.2 If $x_{i} = y_{t}$ then \\ -\hspace{6mm}13.2.1 $q_{i - t - 1} \leftarrow \beta - 1$ \\ -\hspace{3mm}13.3 else \\ -\hspace{6mm}13.3.1 $\hat r \leftarrow x_{i} \cdot \beta + x_{i - 1}$ \\ -\hspace{6mm}13.3.2 $\hat r \leftarrow \lfloor \hat r / y_{t} \rfloor$ \\ -\hspace{6mm}13.3.3 $q_{i - t - 1} \leftarrow \hat r$ \\ -\hspace{3mm}13.4 $q_{i - t - 1} \leftarrow q_{i - t - 1} + 1$ \\ -\\ -Fixup quotient estimation. \\ -\hspace{3mm}13.5 Loop \\ -\hspace{6mm}13.5.1 $q_{i - t - 1} \leftarrow q_{i - t - 1} - 1$ \\ -\hspace{6mm}13.5.2 t$1 \leftarrow 0$ \\ -\hspace{6mm}13.5.3 t$1_0 \leftarrow y_{t - 1}, $ t$1_1 \leftarrow y_t,$ t$1.used \leftarrow 2$ \\ -\hspace{6mm}13.5.4 $t1 \leftarrow t1 \cdot q_{i - t - 1}$ \\ -\hspace{6mm}13.5.5 t$2_0 \leftarrow x_{i - 2}, $ t$2_1 \leftarrow x_{i - 1}, $ t$2_2 \leftarrow x_i, $ t$2.used \leftarrow 3$ \\ -\hspace{6mm}13.5.6 If $\vert t1 \vert > \vert t2 \vert$ then goto step 13.5. \\ -\hspace{3mm}13.6 t$1 \leftarrow y \cdot q_{i - t - 1}$ \\ -\hspace{3mm}13.7 t$1 \leftarrow $ t$1 \cdot \beta^{i - t - 1}$ \\ -\hspace{3mm}13.8 $x \leftarrow x - $ t$1$ \\ -\hspace{3mm}13.9 If $x.sign = MP\_NEG$ then \\ -\hspace{6mm}13.10 t$1 \leftarrow y$ \\ -\hspace{6mm}13.11 t$1 \leftarrow $ t$1 \cdot \beta^{i - t - 1}$ \\ -\hspace{6mm}13.12 $x \leftarrow x + $ t$1$ \\ -\hspace{6mm}13.13 $q_{i - t - 1} \leftarrow q_{i - t - 1} - 1$ \\ -\\ -Finalize the result. \\ -14. Clamp excess digits of $q$ \\ -15. $c \leftarrow q, c.sign \leftarrow sign$ \\ -16. $x.sign \leftarrow a.sign$ \\ -17. $d \leftarrow \lfloor x / 2^{norm} \rfloor$ \\ -18. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div (continued)} -\end{figure} -\textbf{Algorithm mp\_div.} -This algorithm will calculate quotient and remainder from an integer division given a dividend and divisor. The algorithm is a signed -division and will produce a fully qualified quotient and remainder. - -First the divisor $b$ must be non-zero which is enforced in step one. If the divisor is larger than the dividend than the quotient is implicitly -zero and the remainder is the dividend. - -After the first two trivial cases of inputs are handled the variable $q$ is setup to receive the digits of the quotient. Two unsigned copies of the -divisor $y$ and dividend $x$ are made as well. The core of the division algorithm is an unsigned division and will only work if the values are -positive. Now the two values $x$ and $y$ must be normalized such that the leading digit of $y$ is greater than or equal to $\beta / 2$. -This is performed by shifting both to the left by enough bits to get the desired normalization. - -At this point the division algorithm can begin producing digits of the quotient. Recall that maximum value of the estimation used is -$2\beta - {2 \over \beta}$ which means that a digit of the quotient must be first produced by another means. In this case $y$ is shifted -to the left (\textit{step ten}) so that it has the same number of digits as $x$. The loop on step eleven will subtract multiples of the -shifted copy of $y$ until $x$ is smaller. Since the leading digit of $y$ is greater than or equal to $\beta/2$ this loop will iterate at most two -times to produce the desired leading digit of the quotient. - -Now the remainder of the digits can be produced. The equation $\hat q = \lfloor {{x_i \beta + x_{i-1}}\over y_t} \rfloor$ is used to fairly -accurately approximate the true quotient digit. The estimation can in theory produce an estimation as high as $2\beta - {2 \over \beta}$ but by -induction the upper quotient digit is correct (\textit{as established on step eleven}) and the estimate must be less than $\beta$. - -Recall from section~\ref{sec:divest} that the estimation is never too low but may be too high. The next step of the estimation process is -to refine the estimation. The loop on step 13.5 uses $x_i\beta^2 + x_{i-1}\beta + x_{i-2}$ and $q_{i - t - 1}(y_t\beta + y_{t-1})$ as a higher -order approximation to adjust the quotient digit. - -After both phases of estimation the quotient digit may still be off by a value of one\footnote{This is similar to the error introduced -by optimizing Barrett reduction.}. Steps 13.6 and 13.7 subtract the multiple of the divisor from the dividend (\textit{Similar to step 3.3 of -algorithm~\ref{fig:raddiv}} and then subsequently add a multiple of the divisor if the quotient was too large. - -Now that the quotient has been determine finializing the result is a matter of clamping the quotient, fixing the sizes and de-normalizing the -remainder. An important aspect of this algorithm seemingly overlooked in other descriptions such as that of Algorithm 14.20 HAC \cite[pp. 598]{HAC} -is that when the estimations are being made (\textit{inside the loop on step 13.5}) that the digits $y_{t-1}$, $x_{i-2}$ and $x_{i-1}$ may lie -outside their respective boundaries. For example, if $t = 0$ or $i \le 1$ then the digits would be undefined. In those cases the digits should -respectively be replaced with a zero. - -EXAM,bn_mp_div.c - -The implementation of this algorithm differs slightly from the pseudo code presented previously. In this algorithm either of the quotient $c$ or -remainder $d$ may be passed as a \textbf{NULL} pointer which indicates their value is not desired. For example, the C code to call the division -algorithm with only the quotient is - -\begin{verbatim} -mp_div(&a, &b, &c, NULL); /* c = [a/b] */ -\end{verbatim} - -Lines @108,if@ and @113,if@ handle the two trivial cases of inputs which are division by zero and dividend smaller than the divisor -respectively. After the two trivial cases all of the temporary variables are initialized. Line @147,neg@ determines the sign of -the quotient and line @148,sign@ ensures that both $x$ and $y$ are positive. - -The number of bits in the leading digit is calculated on line @151,norm@. Implictly an mp\_int with $r$ digits will require $lg(\beta)(r-1) + k$ bits -of precision which when reduced modulo $lg(\beta)$ produces the value of $k$. In this case $k$ is the number of bits in the leading digit which is -exactly what is required. For the algorithm to operate $k$ must equal $lg(\beta) - 1$ and when it does not the inputs must be normalized by shifting -them to the left by $lg(\beta) - 1 - k$ bits. - -Throughout the variables $n$ and $t$ will represent the highest digit of $x$ and $y$ respectively. These are first used to produce the -leading digit of the quotient. The loop beginning on line @184,for@ will produce the remainder of the quotient digits. - -The conditional ``continue'' on line @186,continue@ is used to prevent the algorithm from reading past the leading edge of $x$ which can occur when the -algorithm eliminates multiple non-zero digits in a single iteration. This ensures that $x_i$ is always non-zero since by definition the digits -above the $i$'th position $x$ must be zero in order for the quotient to be precise\footnote{Precise as far as integer division is concerned.}. - -Lines @214,t1@, @216,t1@ and @222,t2@ through @225,t2@ manually construct the high accuracy estimations by setting the digits of the two mp\_int -variables directly. - -\section{Single Digit Helpers} - -This section briefly describes a series of single digit helper algorithms which come in handy when working with small constants. All of -the helper functions assume the single digit input is positive and will treat them as such. - -\subsection{Single Digit Addition and Subtraction} - -Both addition and subtraction are performed by ``cheating'' and using mp\_set followed by the higher level addition or subtraction -algorithms. As a result these algorithms are subtantially simpler with a slight cost in performance. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_add\_d}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c = a + b$ \\ -\hline \\ -1. $t \leftarrow b$ (\textit{mp\_set}) \\ -2. $c \leftarrow a + t$ \\ -3. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_add\_d} -\end{figure} - -\textbf{Algorithm mp\_add\_d.} -This algorithm initiates a temporary mp\_int with the value of the single digit and uses algorithm mp\_add to add the two values together. - -EXAM,bn_mp_add_d.c - -Clever use of the letter 't'. - -\subsubsection{Subtraction} -The single digit subtraction algorithm mp\_sub\_d is essentially the same except it uses mp\_sub to subtract the digit from the mp\_int. - -\subsection{Single Digit Multiplication} -Single digit multiplication arises enough in division and radix conversion that it ought to be implement as a special case of the baseline -multiplication algorithm. Essentially this algorithm is a modified version of algorithm s\_mp\_mul\_digs where one of the multiplicands -only has one digit. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul\_d}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c = ab$ \\ -\hline \\ -1. $pa \leftarrow a.used$ \\ -2. Grow $c$ to at least $pa + 1$ digits. \\ -3. $oldused \leftarrow c.used$ \\ -4. $c.used \leftarrow pa + 1$ \\ -5. $c.sign \leftarrow a.sign$ \\ -6. $\mu \leftarrow 0$ \\ -7. for $ix$ from $0$ to $pa - 1$ do \\ -\hspace{3mm}7.1 $\hat r \leftarrow \mu + a_{ix}b$ \\ -\hspace{3mm}7.2 $c_{ix} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}7.3 $\mu \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -8. $c_{pa} \leftarrow \mu$ \\ -9. for $ix$ from $pa + 1$ to $oldused$ do \\ -\hspace{3mm}9.1 $c_{ix} \leftarrow 0$ \\ -10. Clamp excess digits of $c$. \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul\_d} -\end{figure} -\textbf{Algorithm mp\_mul\_d.} -This algorithm quickly multiplies an mp\_int by a small single digit value. It is specially tailored to the job and has a minimal of overhead. -Unlike the full multiplication algorithms this algorithm does not require any significnat temporary storage or memory allocations. - -EXAM,bn_mp_mul_d.c - -In this implementation the destination $c$ may point to the same mp\_int as the source $a$ since the result is written after the digit is -read from the source. This function uses pointer aliases $tmpa$ and $tmpc$ for the digits of $a$ and $c$ respectively. - -\subsection{Single Digit Division} -Like the single digit multiplication algorithm, single digit division is also a fairly common algorithm used in radix conversion. Since the -divisor is only a single digit a specialized variant of the division algorithm can be used to compute the quotient. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div\_d}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c = \lfloor a / b \rfloor, d = a - cb$ \\ -\hline \\ -1. If $b = 0$ then return(\textit{MP\_VAL}).\\ -2. If $b = 3$ then use algorithm mp\_div\_3 instead. \\ -3. Init $q$ to $a.used$ digits. \\ -4. $q.used \leftarrow a.used$ \\ -5. $q.sign \leftarrow a.sign$ \\ -6. $\hat w \leftarrow 0$ \\ -7. for $ix$ from $a.used - 1$ down to $0$ do \\ -\hspace{3mm}7.1 $\hat w \leftarrow \hat w \beta + a_{ix}$ \\ -\hspace{3mm}7.2 If $\hat w \ge b$ then \\ -\hspace{6mm}7.2.1 $t \leftarrow \lfloor \hat w / b \rfloor$ \\ -\hspace{6mm}7.2.2 $\hat w \leftarrow \hat w \mbox{ (mod }b\mbox{)}$ \\ -\hspace{3mm}7.3 else\\ -\hspace{6mm}7.3.1 $t \leftarrow 0$ \\ -\hspace{3mm}7.4 $q_{ix} \leftarrow t$ \\ -8. $d \leftarrow \hat w$ \\ -9. Clamp excess digits of $q$. \\ -10. $c \leftarrow q$ \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div\_d} -\end{figure} -\textbf{Algorithm mp\_div\_d.} -This algorithm divides the mp\_int $a$ by the single mp\_digit $b$ using an optimized approach. Essentially in every iteration of the -algorithm another digit of the dividend is reduced and another digit of quotient produced. Provided $b < \beta$ the value of $\hat w$ -after step 7.1 will be limited such that $0 \le \lfloor \hat w / b \rfloor < \beta$. - -If the divisor $b$ is equal to three a variant of this algorithm is used which is called mp\_div\_3. It replaces the division by three with -a multiplication by $\lfloor \beta / 3 \rfloor$ and the appropriate shift and residual fixup. In essence it is much like the Barrett reduction -from chapter seven. - -EXAM,bn_mp_div_d.c - -Like the implementation of algorithm mp\_div this algorithm allows either of the quotient or remainder to be passed as a \textbf{NULL} pointer to -indicate the respective value is not required. This allows a trivial single digit modular reduction algorithm, mp\_mod\_d to be created. - -The division and remainder on lines @90,/@ and @91,-@ can be replaced often by a single division on most processors. For example, the 32-bit x86 based -processors can divide a 64-bit quantity by a 32-bit quantity and produce the quotient and remainder simultaneously. Unfortunately the GCC -compiler does not recognize that optimization and will actually produce two function calls to find the quotient and remainder respectively. - -\subsection{Single Digit Root Extraction} - -Finding the $n$'th root of an integer is fairly easy as far as numerical analysis is concerned. Algorithms such as the Newton-Raphson approximation -(\ref{eqn:newton}) series will converge very quickly to a root for any continuous function $f(x)$. - -\begin{equation} -x_{i+1} = x_i - {f(x_i) \over f'(x_i)} -\label{eqn:newton} -\end{equation} - -In this case the $n$'th root is desired and $f(x) = x^n - a$ where $a$ is the integer of which the root is desired. The derivative of $f(x)$ is -simply $f'(x) = nx^{n - 1}$. Of particular importance is that this algorithm will be used over the integers not over the a more continuous domain -such as the real numbers. As a result the root found can be above the true root by few and must be manually adjusted. Ideally at the end of the -algorithm the $n$'th root $b$ of an integer $a$ is desired such that $b^n \le a$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_n\_root}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c^b \le a$ \\ -\hline \\ -1. If $b$ is even and $a.sign = MP\_NEG$ return(\textit{MP\_VAL}). \\ -2. $sign \leftarrow a.sign$ \\ -3. $a.sign \leftarrow MP\_ZPOS$ \\ -4. t$2 \leftarrow 2$ \\ -5. Loop \\ -\hspace{3mm}5.1 t$1 \leftarrow $ t$2$ \\ -\hspace{3mm}5.2 t$3 \leftarrow $ t$1^{b - 1}$ \\ -\hspace{3mm}5.3 t$2 \leftarrow $ t$3 $ $\cdot$ t$1$ \\ -\hspace{3mm}5.4 t$2 \leftarrow $ t$2 - a$ \\ -\hspace{3mm}5.5 t$3 \leftarrow $ t$3 \cdot b$ \\ -\hspace{3mm}5.6 t$3 \leftarrow \lfloor $t$2 / $t$3 \rfloor$ \\ -\hspace{3mm}5.7 t$2 \leftarrow $ t$1 - $ t$3$ \\ -\hspace{3mm}5.8 If t$1 \ne $ t$2$ then goto step 5. \\ -6. Loop \\ -\hspace{3mm}6.1 t$2 \leftarrow $ t$1^b$ \\ -\hspace{3mm}6.2 If t$2 > a$ then \\ -\hspace{6mm}6.2.1 t$1 \leftarrow $ t$1 - 1$ \\ -\hspace{6mm}6.2.2 Goto step 6. \\ -7. $a.sign \leftarrow sign$ \\ -8. $c \leftarrow $ t$1$ \\ -9. $c.sign \leftarrow sign$ \\ -10. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_n\_root} -\end{figure} -\textbf{Algorithm mp\_n\_root.} -This algorithm finds the integer $n$'th root of an input using the Newton-Raphson approach. It is partially optimized based on the observation -that the numerator of ${f(x) \over f'(x)}$ can be derived from a partial denominator. That is at first the denominator is calculated by finding -$x^{b - 1}$. This value can then be multiplied by $x$ and have $a$ subtracted from it to find the numerator. This saves a total of $b - 1$ -multiplications by t$1$ inside the loop. - -The initial value of the approximation is t$2 = 2$ which allows the algorithm to start with very small values and quickly converge on the -root. Ideally this algorithm is meant to find the $n$'th root of an input where $n$ is bounded by $2 \le n \le 5$. - -EXAM,bn_mp_n_root.c - -\section{Random Number Generation} - -Random numbers come up in a variety of activities from public key cryptography to simple simulations and various randomized algorithms. Pollard-Rho -factoring for example, can make use of random values as starting points to find factors of a composite integer. In this case the algorithm presented -is solely for simulations and not intended for cryptographic use. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_rand}. \\ -\textbf{Input}. An integer $b$ \\ -\textbf{Output}. A pseudo-random number of $b$ digits \\ -\hline \\ -1. $a \leftarrow 0$ \\ -2. If $b \le 0$ return(\textit{MP\_OKAY}) \\ -3. Pick a non-zero random digit $d$. \\ -4. $a \leftarrow a + d$ \\ -5. for $ix$ from 1 to $d - 1$ do \\ -\hspace{3mm}5.1 $a \leftarrow a \cdot \beta$ \\ -\hspace{3mm}5.2 Pick a random digit $d$. \\ -\hspace{3mm}5.3 $a \leftarrow a + d$ \\ -6. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_rand} -\end{figure} -\textbf{Algorithm mp\_rand.} -This algorithm produces a pseudo-random integer of $b$ digits. By ensuring that the first digit is non-zero the algorithm also guarantees that the -final result has at least $b$ digits. It relies heavily on a third-part random number generator which should ideally generate uniformly all of -the integers from $0$ to $\beta - 1$. - -EXAM,bn_mp_rand.c - -\section{Formatted Representations} -The ability to emit a radix-$n$ textual representation of an integer is useful for interacting with human parties. For example, the ability to -be given a string of characters such as ``114585'' and turn it into the radix-$\beta$ equivalent would make it easier to enter numbers -into a program. - -\subsection{Reading Radix-n Input} -For the purposes of this text we will assume that a simple lower ASCII map (\ref{fig:ASC}) is used for the values of from $0$ to $63$ to -printable characters. For example, when the character ``N'' is read it represents the integer $23$. The first $16$ characters of the -map are for the common representations up to hexadecimal. After that they match the ``base64'' encoding scheme which are suitable chosen -such that they are printable. While outputting as base64 may not be too helpful for human operators it does allow communication via non binary -mediums. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{cc|cc|cc|cc} -\hline \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} \\ -\hline -0 & 0 & 1 & 1 & 2 & 2 & 3 & 3 \\ -4 & 4 & 5 & 5 & 6 & 6 & 7 & 7 \\ -8 & 8 & 9 & 9 & 10 & A & 11 & B \\ -12 & C & 13 & D & 14 & E & 15 & F \\ -16 & G & 17 & H & 18 & I & 19 & J \\ -20 & K & 21 & L & 22 & M & 23 & N \\ -24 & O & 25 & P & 26 & Q & 27 & R \\ -28 & S & 29 & T & 30 & U & 31 & V \\ -32 & W & 33 & X & 34 & Y & 35 & Z \\ -36 & a & 37 & b & 38 & c & 39 & d \\ -40 & e & 41 & f & 42 & g & 43 & h \\ -44 & i & 45 & j & 46 & k & 47 & l \\ -48 & m & 49 & n & 50 & o & 51 & p \\ -52 & q & 53 & r & 54 & s & 55 & t \\ -56 & u & 57 & v & 58 & w & 59 & x \\ -60 & y & 61 & z & 62 & $+$ & 63 & $/$ \\ -\hline -\end{tabular} -\end{center} -\caption{Lower ASCII Map} -\label{fig:ASC} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_read\_radix}. \\ -\textbf{Input}. A string $str$ of length $sn$ and radix $r$. \\ -\textbf{Output}. The radix-$\beta$ equivalent mp\_int. \\ -\hline \\ -1. If $r < 2$ or $r > 64$ return(\textit{MP\_VAL}). \\ -2. $ix \leftarrow 0$ \\ -3. If $str_0 =$ ``-'' then do \\ -\hspace{3mm}3.1 $ix \leftarrow ix + 1$ \\ -\hspace{3mm}3.2 $sign \leftarrow MP\_NEG$ \\ -4. else \\ -\hspace{3mm}4.1 $sign \leftarrow MP\_ZPOS$ \\ -5. $a \leftarrow 0$ \\ -6. for $iy$ from $ix$ to $sn - 1$ do \\ -\hspace{3mm}6.1 Let $y$ denote the position in the map of $str_{iy}$. \\ -\hspace{3mm}6.2 If $str_{iy}$ is not in the map or $y \ge r$ then goto step 7. \\ -\hspace{3mm}6.3 $a \leftarrow a \cdot r$ \\ -\hspace{3mm}6.4 $a \leftarrow a + y$ \\ -7. If $a \ne 0$ then $a.sign \leftarrow sign$ \\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_read\_radix} -\end{figure} -\textbf{Algorithm mp\_read\_radix.} -This algorithm will read an ASCII string and produce the radix-$\beta$ mp\_int representation of the same integer. A minus symbol ``-'' may precede the -string to indicate the value is negative, otherwise it is assumed to be positive. The algorithm will read up to $sn$ characters from the input -and will stop when it reads a character it cannot map the algorithm stops reading characters from the string. This allows numbers to be embedded -as part of larger input without any significant problem. - -EXAM,bn_mp_read_radix.c - -\subsection{Generating Radix-$n$ Output} -Generating radix-$n$ output is fairly trivial with a division and remainder algorithm. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_toradix}. \\ -\textbf{Input}. A mp\_int $a$ and an integer $r$\\ -\textbf{Output}. The radix-$r$ representation of $a$ \\ -\hline \\ -1. If $r < 2$ or $r > 64$ return(\textit{MP\_VAL}). \\ -2. If $a = 0$ then $str = $ ``$0$'' and return(\textit{MP\_OKAY}). \\ -3. $t \leftarrow a$ \\ -4. $str \leftarrow$ ``'' \\ -5. if $t.sign = MP\_NEG$ then \\ -\hspace{3mm}5.1 $str \leftarrow str + $ ``-'' \\ -\hspace{3mm}5.2 $t.sign = MP\_ZPOS$ \\ -6. While ($t \ne 0$) do \\ -\hspace{3mm}6.1 $d \leftarrow t \mbox{ (mod }r\mbox{)}$ \\ -\hspace{3mm}6.2 $t \leftarrow \lfloor t / r \rfloor$ \\ -\hspace{3mm}6.3 Look up $d$ in the map and store the equivalent character in $y$. \\ -\hspace{3mm}6.4 $str \leftarrow str + y$ \\ -7. If $str_0 = $``$-$'' then \\ -\hspace{3mm}7.1 Reverse the digits $str_1, str_2, \ldots str_n$. \\ -8. Otherwise \\ -\hspace{3mm}8.1 Reverse the digits $str_0, str_1, \ldots str_n$. \\ -9. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_toradix} -\end{figure} -\textbf{Algorithm mp\_toradix.} -This algorithm computes the radix-$r$ representation of an mp\_int $a$. The ``digits'' of the representation are extracted by reducing -successive powers of $\lfloor a / r^k \rfloor$ the input modulo $r$ until $r^k > a$. Note that instead of actually dividing by $r^k$ in -each iteration the quotient $\lfloor a / r \rfloor$ is saved for the next iteration. As a result a series of trivial $n \times 1$ divisions -are required instead of a series of $n \times k$ divisions. One design flaw of this approach is that the digits are produced in the reverse order -(see~\ref{fig:mpradix}). To remedy this flaw the digits must be swapped or simply ``reversed''. - -\begin{figure} -\begin{center} -\begin{tabular}{|c|c|c|} -\hline \textbf{Value of $a$} & \textbf{Value of $d$} & \textbf{Value of $str$} \\ -\hline $1234$ & -- & -- \\ -\hline $123$ & $4$ & ``4'' \\ -\hline $12$ & $3$ & ``43'' \\ -\hline $1$ & $2$ & ``432'' \\ -\hline $0$ & $1$ & ``4321'' \\ -\hline -\end{tabular} -\end{center} -\caption{Example of Algorithm mp\_toradix.} -\label{fig:mpradix} -\end{figure} - -EXAM,bn_mp_toradix.c - -\chapter{Number Theoretic Algorithms} -This chapter discusses several fundamental number theoretic algorithms such as the greatest common divisor, least common multiple and Jacobi -symbol computation. These algorithms arise as essential components in several key cryptographic algorithms such as the RSA public key algorithm and -various Sieve based factoring algorithms. - -\section{Greatest Common Divisor} -The greatest common divisor of two integers $a$ and $b$, often denoted as $(a, b)$ is the largest integer $k$ that is a proper divisor of -both $a$ and $b$. That is, $k$ is the largest integer such that $0 \equiv a \mbox{ (mod }k\mbox{)}$ and $0 \equiv b \mbox{ (mod }k\mbox{)}$ occur -simultaneously. - -The most common approach (cite) is to reduce one input modulo another. That is if $a$ and $b$ are divisible by some integer $k$ and if $qa + r = b$ then -$r$ is also divisible by $k$. The reduction pattern follows $\left < a , b \right > \rightarrow \left < b, a \mbox{ mod } b \right >$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Greatest Common Divisor (I)}. \\ -\textbf{Input}. Two positive integers $a$ and $b$ greater than zero. \\ -\textbf{Output}. The greatest common divisor $(a, b)$. \\ -\hline \\ -1. While ($b > 0$) do \\ -\hspace{3mm}1.1 $r \leftarrow a \mbox{ (mod }b\mbox{)}$ \\ -\hspace{3mm}1.2 $a \leftarrow b$ \\ -\hspace{3mm}1.3 $b \leftarrow r$ \\ -2. Return($a$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Greatest Common Divisor (I)} -\label{fig:gcd1} -\end{figure} - -This algorithm will quickly converge on the greatest common divisor since the residue $r$ tends diminish rapidly. However, divisions are -relatively expensive operations to perform and should ideally be avoided. There is another approach based on a similar relationship of -greatest common divisors. The faster approach is based on the observation that if $k$ divides both $a$ and $b$ it will also divide $a - b$. -In particular, we would like $a - b$ to decrease in magnitude which implies that $b \ge a$. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Greatest Common Divisor (II)}. \\ -\textbf{Input}. Two positive integers $a$ and $b$ greater than zero. \\ -\textbf{Output}. The greatest common divisor $(a, b)$. \\ -\hline \\ -1. While ($b > 0$) do \\ -\hspace{3mm}1.1 Swap $a$ and $b$ such that $a$ is the smallest of the two. \\ -\hspace{3mm}1.2 $b \leftarrow b - a$ \\ -2. Return($a$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Greatest Common Divisor (II)} -\label{fig:gcd2} -\end{figure} - -\textbf{Proof} \textit{Algorithm~\ref{fig:gcd2} will return the greatest common divisor of $a$ and $b$.} -The algorithm in figure~\ref{fig:gcd2} will eventually terminate since $b \ge a$ the subtraction in step 1.2 will be a value less than $b$. In other -words in every iteration that tuple $\left < a, b \right >$ decrease in magnitude until eventually $a = b$. Since both $a$ and $b$ are always -divisible by the greatest common divisor (\textit{until the last iteration}) and in the last iteration of the algorithm $b = 0$, therefore, in the -second to last iteration of the algorithm $b = a$ and clearly $(a, a) = a$ which concludes the proof. \textbf{QED}. - -As a matter of practicality algorithm \ref{fig:gcd1} decreases far too slowly to be useful. Specially if $b$ is much larger than $a$ such that -$b - a$ is still very much larger than $a$. A simple addition to the algorithm is to divide $b - a$ by a power of some integer $p$ which does -not divide the greatest common divisor but will divide $b - a$. In this case ${b - a} \over p$ is also an integer and still divisible by -the greatest common divisor. - -However, instead of factoring $b - a$ to find a suitable value of $p$ the powers of $p$ can be removed from $a$ and $b$ that are in common first. -Then inside the loop whenever $b - a$ is divisible by some power of $p$ it can be safely removed. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Greatest Common Divisor (III)}. \\ -\textbf{Input}. Two positive integers $a$ and $b$ greater than zero. \\ -\textbf{Output}. The greatest common divisor $(a, b)$. \\ -\hline \\ -1. $k \leftarrow 0$ \\ -2. While $a$ and $b$ are both divisible by $p$ do \\ -\hspace{3mm}2.1 $a \leftarrow \lfloor a / p \rfloor$ \\ -\hspace{3mm}2.2 $b \leftarrow \lfloor b / p \rfloor$ \\ -\hspace{3mm}2.3 $k \leftarrow k + 1$ \\ -3. While $a$ is divisible by $p$ do \\ -\hspace{3mm}3.1 $a \leftarrow \lfloor a / p \rfloor$ \\ -4. While $b$ is divisible by $p$ do \\ -\hspace{3mm}4.1 $b \leftarrow \lfloor b / p \rfloor$ \\ -5. While ($b > 0$) do \\ -\hspace{3mm}5.1 Swap $a$ and $b$ such that $a$ is the smallest of the two. \\ -\hspace{3mm}5.2 $b \leftarrow b - a$ \\ -\hspace{3mm}5.3 While $b$ is divisible by $p$ do \\ -\hspace{6mm}5.3.1 $b \leftarrow \lfloor b / p \rfloor$ \\ -6. Return($a \cdot p^k$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Greatest Common Divisor (III)} -\label{fig:gcd3} -\end{figure} - -This algorithm is based on the first except it removes powers of $p$ first and inside the main loop to ensure the tuple $\left < a, b \right >$ -decreases more rapidly. The first loop on step two removes powers of $p$ that are in common. A count, $k$, is kept which will present a common -divisor of $p^k$. After step two the remaining common divisor of $a$ and $b$ cannot be divisible by $p$. This means that $p$ can be safely -divided out of the difference $b - a$ so long as the division leaves no remainder. - -In particular the value of $p$ should be chosen such that the division on step 5.3.1 occur often. It also helps that division by $p$ be easy -to compute. The ideal choice of $p$ is two since division by two amounts to a right logical shift. Another important observation is that by -step five both $a$ and $b$ are odd. Therefore, the diffrence $b - a$ must be even which means that each iteration removes one bit from the -largest of the pair. - -\subsection{Complete Greatest Common Divisor} -The algorithms presented so far cannot handle inputs which are zero or negative. The following algorithm can handle all input cases properly -and will produce the greatest common divisor. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_gcd}. \\ -\textbf{Input}. mp\_int $a$ and $b$ \\ -\textbf{Output}. The greatest common divisor $c = (a, b)$. \\ -\hline \\ -1. If $a = 0$ then \\ -\hspace{3mm}1.1 $c \leftarrow \vert b \vert $ \\ -\hspace{3mm}1.2 Return(\textit{MP\_OKAY}). \\ -2. If $b = 0$ then \\ -\hspace{3mm}2.1 $c \leftarrow \vert a \vert $ \\ -\hspace{3mm}2.2 Return(\textit{MP\_OKAY}). \\ -3. $u \leftarrow \vert a \vert, v \leftarrow \vert b \vert$ \\ -4. $k \leftarrow 0$ \\ -5. While $u.used > 0$ and $v.used > 0$ and $u_0 \equiv v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}5.1 $k \leftarrow k + 1$ \\ -\hspace{3mm}5.2 $u \leftarrow \lfloor u / 2 \rfloor$ \\ -\hspace{3mm}5.3 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -6. While $u.used > 0$ and $u_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}6.1 $u \leftarrow \lfloor u / 2 \rfloor$ \\ -7. While $v.used > 0$ and $v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}7.1 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -8. While $v.used > 0$ \\ -\hspace{3mm}8.1 If $\vert u \vert > \vert v \vert$ then \\ -\hspace{6mm}8.1.1 Swap $u$ and $v$. \\ -\hspace{3mm}8.2 $v \leftarrow \vert v \vert - \vert u \vert$ \\ -\hspace{3mm}8.3 While $v.used > 0$ and $v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{6mm}8.3.1 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -9. $c \leftarrow u \cdot 2^k$ \\ -10. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_gcd} -\end{figure} -\textbf{Algorithm mp\_gcd.} -This algorithm will produce the greatest common divisor of two mp\_ints $a$ and $b$. The algorithm was originally based on Algorithm B of -Knuth \cite[pp. 338]{TAOCPV2} but has been modified to be simpler to explain. In theory it achieves the same asymptotic working time as -Algorithm B and in practice this appears to be true. - -The first two steps handle the cases where either one of or both inputs are zero. If either input is zero the greatest common divisor is the -largest input or zero if they are both zero. If the inputs are not trivial than $u$ and $v$ are assigned the absolute values of -$a$ and $b$ respectively and the algorithm will proceed to reduce the pair. - -Step five will divide out any common factors of two and keep track of the count in the variable $k$. After this step, two is no longer a -factor of the remaining greatest common divisor between $u$ and $v$ and can be safely evenly divided out of either whenever they are even. Step -six and seven ensure that the $u$ and $v$ respectively have no more factors of two. At most only one of the while--loops will iterate since -they cannot both be even. - -By step eight both of $u$ and $v$ are odd which is required for the inner logic. First the pair are swapped such that $v$ is equal to -or greater than $u$. This ensures that the subtraction on step 8.2 will always produce a positive and even result. Step 8.3 removes any -factors of two from the difference $u$ to ensure that in the next iteration of the loop both are once again odd. - -After $v = 0$ occurs the variable $u$ has the greatest common divisor of the pair $\left < u, v \right >$ just after step six. The result -must be adjusted by multiplying by the common factors of two ($2^k$) removed earlier. - -EXAM,bn_mp_gcd.c - -This function makes use of the macros mp\_iszero and mp\_iseven. The former evaluates to $1$ if the input mp\_int is equivalent to the -integer zero otherwise it evaluates to $0$. The latter evaluates to $1$ if the input mp\_int represents a non-zero even integer otherwise -it evaluates to $0$. Note that just because mp\_iseven may evaluate to $0$ does not mean the input is odd, it could also be zero. The three -trivial cases of inputs are handled on lines @23,zero@ through @29,}@. After those lines the inputs are assumed to be non-zero. - -Lines @32,if@ and @36,if@ make local copies $u$ and $v$ of the inputs $a$ and $b$ respectively. At this point the common factors of two -must be divided out of the two inputs. The block starting at line @43,common@ removes common factors of two by first counting the number of trailing -zero bits in both. The local integer $k$ is used to keep track of how many factors of $2$ are pulled out of both values. It is assumed that -the number of factors will not exceed the maximum value of a C ``int'' data type\footnote{Strictly speaking no array in C may have more than -entries than are accessible by an ``int'' so this is not a limitation.}. - -At this point there are no more common factors of two in the two values. The divisions by a power of two on lines @60,div_2d@ and @67,div_2d@ remove -any independent factors of two such that both $u$ and $v$ are guaranteed to be an odd integer before hitting the main body of the algorithm. The while loop -on line @72, while@ performs the reduction of the pair until $v$ is equal to zero. The unsigned comparison and subtraction algorithms are used in -place of the full signed routines since both values are guaranteed to be positive and the result of the subtraction is guaranteed to be non-negative. - -\section{Least Common Multiple} -The least common multiple of a pair of integers is their product divided by their greatest common divisor. For two integers $a$ and $b$ the -least common multiple is normally denoted as $[ a, b ]$ and numerically equivalent to ${ab} \over {(a, b)}$. For example, if $a = 2 \cdot 2 \cdot 3 = 12$ -and $b = 2 \cdot 3 \cdot 3 \cdot 7 = 126$ the least common multiple is ${126 \over {(12, 126)}} = {126 \over 6} = 21$. - -The least common multiple arises often in coding theory as well as number theory. If two functions have periods of $a$ and $b$ respectively they will -collide, that is be in synchronous states, after only $[ a, b ]$ iterations. This is why, for example, random number generators based on -Linear Feedback Shift Registers (LFSR) tend to use registers with periods which are co-prime (\textit{e.g. the greatest common divisor is one.}). -Similarly in number theory if a composite $n$ has two prime factors $p$ and $q$ then maximal order of any unit of $\Z/n\Z$ will be $[ p - 1, q - 1] $. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_lcm}. \\ -\textbf{Input}. mp\_int $a$ and $b$ \\ -\textbf{Output}. The least common multiple $c = [a, b]$. \\ -\hline \\ -1. $c \leftarrow (a, b)$ \\ -2. $t \leftarrow a \cdot b$ \\ -3. $c \leftarrow \lfloor t / c \rfloor$ \\ -4. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_lcm} -\end{figure} -\textbf{Algorithm mp\_lcm.} -This algorithm computes the least common multiple of two mp\_int inputs $a$ and $b$. It computes the least common multiple directly by -dividing the product of the two inputs by their greatest common divisor. - -EXAM,bn_mp_lcm.c - -\section{Jacobi Symbol Computation} -To explain the Jacobi Symbol we shall first discuss the Legendre function\footnote{Arrg. What is the name of this?} off which the Jacobi symbol is -defined. The Legendre function computes whether or not an integer $a$ is a quadratic residue modulo an odd prime $p$. Numerically it is -equivalent to equation \ref{eqn:legendre}. - -\textit{-- Tom, don't be an ass, cite your source here...!} - -\begin{equation} -a^{(p-1)/2} \equiv \begin{array}{rl} - -1 & \mbox{if }a\mbox{ is a quadratic non-residue.} \\ - 0 & \mbox{if }a\mbox{ divides }p\mbox{.} \\ - 1 & \mbox{if }a\mbox{ is a quadratic residue}. - \end{array} \mbox{ (mod }p\mbox{)} -\label{eqn:legendre} -\end{equation} - -\textbf{Proof.} \textit{Equation \ref{eqn:legendre} correctly identifies the residue status of an integer $a$ modulo a prime $p$.} -An integer $a$ is a quadratic residue if the following equation has a solution. - -\begin{equation} -x^2 \equiv a \mbox{ (mod }p\mbox{)} -\label{eqn:root} -\end{equation} - -Consider the following equation. - -\begin{equation} -0 \equiv x^{p-1} - 1 \equiv \left \lbrace \left (x^2 \right )^{(p-1)/2} - a^{(p-1)/2} \right \rbrace + \left ( a^{(p-1)/2} - 1 \right ) \mbox{ (mod }p\mbox{)} -\label{eqn:rooti} -\end{equation} - -Whether equation \ref{eqn:root} has a solution or not equation \ref{eqn:rooti} is always true. If $a^{(p-1)/2} - 1 \equiv 0 \mbox{ (mod }p\mbox{)}$ -then the quantity in the braces must be zero. By reduction, - -\begin{eqnarray} -\left (x^2 \right )^{(p-1)/2} - a^{(p-1)/2} \equiv 0 \nonumber \\ -\left (x^2 \right )^{(p-1)/2} \equiv a^{(p-1)/2} \nonumber \\ -x^2 \equiv a \mbox{ (mod }p\mbox{)} -\end{eqnarray} - -As a result there must be a solution to the quadratic equation and in turn $a$ must be a quadratic residue. If $a$ does not divide $p$ and $a$ -is not a quadratic residue then the only other value $a^{(p-1)/2}$ may be congruent to is $-1$ since -\begin{equation} -0 \equiv a^{p - 1} - 1 \equiv (a^{(p-1)/2} + 1)(a^{(p-1)/2} - 1) \mbox{ (mod }p\mbox{)} -\end{equation} -One of the terms on the right hand side must be zero. \textbf{QED} - -\subsection{Jacobi Symbol} -The Jacobi symbol is a generalization of the Legendre function for any odd non prime moduli $p$ greater than 2. If $p = \prod_{i=0}^n p_i$ then -the Jacobi symbol $\left ( { a \over p } \right )$ is equal to the following equation. - -\begin{equation} -\left ( { a \over p } \right ) = \left ( { a \over p_0} \right ) \left ( { a \over p_1} \right ) \ldots \left ( { a \over p_n} \right ) -\end{equation} - -By inspection if $p$ is prime the Jacobi symbol is equivalent to the Legendre function. The following facts\footnote{See HAC \cite[pp. 72-74]{HAC} for -further details.} will be used to derive an efficient Jacobi symbol algorithm. Where $p$ is an odd integer greater than two and $a, b \in \Z$ the -following are true. - -\begin{enumerate} -\item $\left ( { a \over p} \right )$ equals $-1$, $0$ or $1$. -\item $\left ( { ab \over p} \right ) = \left ( { a \over p} \right )\left ( { b \over p} \right )$. -\item If $a \equiv b$ then $\left ( { a \over p} \right ) = \left ( { b \over p} \right )$. -\item $\left ( { 2 \over p} \right )$ equals $1$ if $p \equiv 1$ or $7 \mbox{ (mod }8\mbox{)}$. Otherwise, it equals $-1$. -\item $\left ( { a \over p} \right ) \equiv \left ( { p \over a} \right ) \cdot (-1)^{(p-1)(a-1)/4}$. More specifically -$\left ( { a \over p} \right ) = \left ( { p \over a} \right )$ if $p \equiv a \equiv 1 \mbox{ (mod }4\mbox{)}$. -\end{enumerate} - -Using these facts if $a = 2^k \cdot a'$ then - -\begin{eqnarray} -\left ( { a \over p } \right ) = \left ( {{2^k} \over p } \right ) \left ( {a' \over p} \right ) \nonumber \\ - = \left ( {2 \over p } \right )^k \left ( {a' \over p} \right ) -\label{eqn:jacobi} -\end{eqnarray} - -By fact five, - -\begin{equation} -\left ( { a \over p } \right ) = \left ( { p \over a } \right ) \cdot (-1)^{(p-1)(a-1)/4} -\end{equation} - -Subsequently by fact three since $p \equiv (p \mbox{ mod }a) \mbox{ (mod }a\mbox{)}$ then - -\begin{equation} -\left ( { a \over p } \right ) = \left ( { {p \mbox{ mod } a} \over a } \right ) \cdot (-1)^{(p-1)(a-1)/4} -\end{equation} - -By putting both observations into equation \ref{eqn:jacobi} the following simplified equation is formed. - -\begin{equation} -\left ( { a \over p } \right ) = \left ( {2 \over p } \right )^k \left ( {{p\mbox{ mod }a'} \over a'} \right ) \cdot (-1)^{(p-1)(a'-1)/4} -\end{equation} - -The value of $\left ( {{p \mbox{ mod }a'} \over a'} \right )$ can be found by using the same equation recursively. The value of -$\left ( {2 \over p } \right )^k$ equals $1$ if $k$ is even otherwise it equals $\left ( {2 \over p } \right )$. Using this approach the -factors of $p$ do not have to be known. Furthermore, if $(a, p) = 1$ then the algorithm will terminate when the recursion requests the -Jacobi symbol computation of $\left ( {1 \over a'} \right )$ which is simply $1$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_jacobi}. \\ -\textbf{Input}. mp\_int $a$ and $p$, $a \ge 0$, $p \ge 3$, $p \equiv 1 \mbox{ (mod }2\mbox{)}$ \\ -\textbf{Output}. The Jacobi symbol $c = \left ( {a \over p } \right )$. \\ -\hline \\ -1. If $a = 0$ then \\ -\hspace{3mm}1.1 $c \leftarrow 0$ \\ -\hspace{3mm}1.2 Return(\textit{MP\_OKAY}). \\ -2. If $a = 1$ then \\ -\hspace{3mm}2.1 $c \leftarrow 1$ \\ -\hspace{3mm}2.2 Return(\textit{MP\_OKAY}). \\ -3. $a' \leftarrow a$ \\ -4. $k \leftarrow 0$ \\ -5. While $a'.used > 0$ and $a'_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}5.1 $k \leftarrow k + 1$ \\ -\hspace{3mm}5.2 $a' \leftarrow \lfloor a' / 2 \rfloor$ \\ -6. If $k \equiv 0 \mbox{ (mod }2\mbox{)}$ then \\ -\hspace{3mm}6.1 $s \leftarrow 1$ \\ -7. else \\ -\hspace{3mm}7.1 $r \leftarrow p_0 \mbox{ (mod }8\mbox{)}$ \\ -\hspace{3mm}7.2 If $r = 1$ or $r = 7$ then \\ -\hspace{6mm}7.2.1 $s \leftarrow 1$ \\ -\hspace{3mm}7.3 else \\ -\hspace{6mm}7.3.1 $s \leftarrow -1$ \\ -8. If $p_0 \equiv a'_0 \equiv 3 \mbox{ (mod }4\mbox{)}$ then \\ -\hspace{3mm}8.1 $s \leftarrow -s$ \\ -9. If $a' \ne 1$ then \\ -\hspace{3mm}9.1 $p' \leftarrow p \mbox{ (mod }a'\mbox{)}$ \\ -\hspace{3mm}9.2 $s \leftarrow s \cdot \mbox{mp\_jacobi}(p', a')$ \\ -10. $c \leftarrow s$ \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_jacobi} -\end{figure} -\textbf{Algorithm mp\_jacobi.} -This algorithm computes the Jacobi symbol for an arbitrary positive integer $a$ with respect to an odd integer $p$ greater than three. The algorithm -is based on algorithm 2.149 of HAC \cite[pp. 73]{HAC}. - -Step numbers one and two handle the trivial cases of $a = 0$ and $a = 1$ respectively. Step five determines the number of two factors in the -input $a$. If $k$ is even than the term $\left ( { 2 \over p } \right )^k$ must always evaluate to one. If $k$ is odd than the term evaluates to one -if $p_0$ is congruent to one or seven modulo eight, otherwise it evaluates to $-1$. After the the $\left ( { 2 \over p } \right )^k$ term is handled -the $(-1)^{(p-1)(a'-1)/4}$ is computed and multiplied against the current product $s$. The latter term evaluates to one if both $p$ and $a'$ -are congruent to one modulo four, otherwise it evaluates to negative one. - -By step nine if $a'$ does not equal one a recursion is required. Step 9.1 computes $p' \equiv p \mbox{ (mod }a'\mbox{)}$ and will recurse to compute -$\left ( {p' \over a'} \right )$ which is multiplied against the current Jacobi product. - -EXAM,bn_mp_jacobi.c - -As a matter of practicality the variable $a'$ as per the pseudo-code is reprensented by the variable $a1$ since the $'$ symbol is not valid for a C -variable name character. - -The two simple cases of $a = 0$ and $a = 1$ are handled at the very beginning to simplify the algorithm. If the input is non-trivial the algorithm -has to proceed compute the Jacobi. The variable $s$ is used to hold the current Jacobi product. Note that $s$ is merely a C ``int'' data type since -the values it may obtain are merely $-1$, $0$ and $1$. - -After a local copy of $a$ is made all of the factors of two are divided out and the total stored in $k$. Technically only the least significant -bit of $k$ is required, however, it makes the algorithm simpler to follow to perform an addition. In practice an exclusive-or and addition have the same -processor requirements and neither is faster than the other. - -Line @59, if@ through @70, }@ determines the value of $\left ( { 2 \over p } \right )^k$. If the least significant bit of $k$ is zero than -$k$ is even and the value is one. Otherwise, the value of $s$ depends on which residue class $p$ belongs to modulo eight. The value of -$(-1)^{(p-1)(a'-1)/4}$ is compute and multiplied against $s$ on lines @73, if@ through @75, }@. - -Finally, if $a1$ does not equal one the algorithm must recurse and compute $\left ( {p' \over a'} \right )$. - -\textit{-- Comment about default $s$ and such...} - -\section{Modular Inverse} -\label{sec:modinv} -The modular inverse of a number actually refers to the modular multiplicative inverse. Essentially for any integer $a$ such that $(a, p) = 1$ there -exist another integer $b$ such that $ab \equiv 1 \mbox{ (mod }p\mbox{)}$. The integer $b$ is called the multiplicative inverse of $a$ which is -denoted as $b = a^{-1}$. Technically speaking modular inversion is a well defined operation for any finite ring or field not just for rings and -fields of integers. However, the former will be the matter of discussion. - -The simplest approach is to compute the algebraic inverse of the input. That is to compute $b \equiv a^{\Phi(p) - 1}$. If $\Phi(p)$ is the -order of the multiplicative subgroup modulo $p$ then $b$ must be the multiplicative inverse of $a$. The proof of which is trivial. - -\begin{equation} -ab \equiv a \left (a^{\Phi(p) - 1} \right ) \equiv a^{\Phi(p)} \equiv a^0 \equiv 1 \mbox{ (mod }p\mbox{)} -\end{equation} - -However, as simple as this approach may be it has two serious flaws. It requires that the value of $\Phi(p)$ be known which if $p$ is composite -requires all of the prime factors. This approach also is very slow as the size of $p$ grows. - -A simpler approach is based on the observation that solving for the multiplicative inverse is equivalent to solving the linear -Diophantine\footnote{See LeVeque \cite[pp. 40-43]{LeVeque} for more information.} equation. - -\begin{equation} -ab + pq = 1 -\end{equation} - -Where $a$, $b$, $p$ and $q$ are all integers. If such a pair of integers $ \left < b, q \right >$ exist than $b$ is the multiplicative inverse of -$a$ modulo $p$. The extended Euclidean algorithm (Knuth \cite[pp. 342]{TAOCPV2}) can be used to solve such equations provided $(a, p) = 1$. -However, instead of using that algorithm directly a variant known as the binary Extended Euclidean algorithm will be used in its place. The -binary approach is very similar to the binary greatest common divisor algorithm except it will produce a full solution to the Diophantine -equation. - -\subsection{General Case} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_invmod}. \\ -\textbf{Input}. mp\_int $a$ and $b$, $(a, b) = 1$, $p \ge 2$, $0 < a < p$. \\ -\textbf{Output}. The modular inverse $c \equiv a^{-1} \mbox{ (mod }b\mbox{)}$. \\ -\hline \\ -1. If $b \le 0$ then return(\textit{MP\_VAL}). \\ -2. If $b_0 \equiv 1 \mbox{ (mod }2\mbox{)}$ then use algorithm fast\_mp\_invmod. \\ -3. $x \leftarrow \vert a \vert, y \leftarrow b$ \\ -4. If $x_0 \equiv y_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ then return(\textit{MP\_VAL}). \\ -5. $B \leftarrow 0, C \leftarrow 0, A \leftarrow 1, D \leftarrow 1$ \\ -6. While $u.used > 0$ and $u_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}6.1 $u \leftarrow \lfloor u / 2 \rfloor$ \\ -\hspace{3mm}6.2 If ($A.used > 0$ and $A_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) or ($B.used > 0$ and $B_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) then \\ -\hspace{6mm}6.2.1 $A \leftarrow A + y$ \\ -\hspace{6mm}6.2.2 $B \leftarrow B - x$ \\ -\hspace{3mm}6.3 $A \leftarrow \lfloor A / 2 \rfloor$ \\ -\hspace{3mm}6.4 $B \leftarrow \lfloor B / 2 \rfloor$ \\ -7. While $v.used > 0$ and $v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}7.1 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -\hspace{3mm}7.2 If ($C.used > 0$ and $C_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) or ($D.used > 0$ and $D_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) then \\ -\hspace{6mm}7.2.1 $C \leftarrow C + y$ \\ -\hspace{6mm}7.2.2 $D \leftarrow D - x$ \\ -\hspace{3mm}7.3 $C \leftarrow \lfloor C / 2 \rfloor$ \\ -\hspace{3mm}7.4 $D \leftarrow \lfloor D / 2 \rfloor$ \\ -8. If $u \ge v$ then \\ -\hspace{3mm}8.1 $u \leftarrow u - v$ \\ -\hspace{3mm}8.2 $A \leftarrow A - C$ \\ -\hspace{3mm}8.3 $B \leftarrow B - D$ \\ -9. else \\ -\hspace{3mm}9.1 $v \leftarrow v - u$ \\ -\hspace{3mm}9.2 $C \leftarrow C - A$ \\ -\hspace{3mm}9.3 $D \leftarrow D - B$ \\ -10. If $u \ne 0$ goto step 6. \\ -11. If $v \ne 1$ return(\textit{MP\_VAL}). \\ -12. While $C \le 0$ do \\ -\hspace{3mm}12.1 $C \leftarrow C + b$ \\ -13. While $C \ge b$ do \\ -\hspace{3mm}13.1 $C \leftarrow C - b$ \\ -14. $c \leftarrow C$ \\ -15. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\end{figure} -\textbf{Algorithm mp\_invmod.} -This algorithm computes the modular multiplicative inverse of an integer $a$ modulo an integer $b$. This algorithm is a variation of the -extended binary Euclidean algorithm from HAC \cite[pp. 608]{HAC}. It has been modified to only compute the modular inverse and not a complete -Diophantine solution. - -If $b \le 0$ than the modulus is invalid and MP\_VAL is returned. Similarly if both $a$ and $b$ are even then there cannot be a multiplicative -inverse for $a$ and the error is reported. - -The astute reader will observe that steps seven through nine are very similar to the binary greatest common divisor algorithm mp\_gcd. In this case -the other variables to the Diophantine equation are solved. The algorithm terminates when $u = 0$ in which case the solution is - -\begin{equation} -Ca + Db = v -\end{equation} - -If $v$, the greatest common divisor of $a$ and $b$ is not equal to one then the algorithm will report an error as no inverse exists. Otherwise, $C$ -is the modular inverse of $a$. The actual value of $C$ is congruent to, but not necessarily equal to, the ideal modular inverse which should lie -within $1 \le a^{-1} < b$. Step numbers twelve and thirteen adjust the inverse until it is in range. If the original input $a$ is within $0 < a < p$ -then only a couple of additions or subtractions will be required to adjust the inverse. - -EXAM,bn_mp_invmod.c - -\subsubsection{Odd Moduli} - -When the modulus $b$ is odd the variables $A$ and $C$ are fixed and are not required to compute the inverse. In particular by attempting to solve -the Diophantine $Cb + Da = 1$ only $B$ and $D$ are required to find the inverse of $a$. - -The algorithm fast\_mp\_invmod is a direct adaptation of algorithm mp\_invmod with all all steps involving either $A$ or $C$ removed. This -optimization will halve the time required to compute the modular inverse. - -\section{Primality Tests} - -A non-zero integer $a$ is said to be prime if it is not divisible by any other integer excluding one and itself. For example, $a = 7$ is prime -since the integers $2 \ldots 6$ do not evenly divide $a$. By contrast, $a = 6$ is not prime since $a = 6 = 2 \cdot 3$. - -Prime numbers arise in cryptography considerably as they allow finite fields to be formed. The ability to determine whether an integer is prime or -not quickly has been a viable subject in cryptography and number theory for considerable time. The algorithms that will be presented are all -probablistic algorithms in that when they report an integer is composite it must be composite. However, when the algorithms report an integer is -prime the algorithm may be incorrect. - -As will be discussed it is possible to limit the probability of error so well that for practical purposes the probablity of error might as -well be zero. For the purposes of these discussions let $n$ represent the candidate integer of which the primality is in question. - -\subsection{Trial Division} - -Trial division means to attempt to evenly divide a candidate integer by small prime integers. If the candidate can be evenly divided it obviously -cannot be prime. By dividing by all primes $1 < p \le \sqrt{n}$ this test can actually prove whether an integer is prime. However, such a test -would require a prohibitive amount of time as $n$ grows. - -Instead of dividing by every prime, a smaller, more mangeable set of primes may be used instead. By performing trial division with only a subset -of the primes less than $\sqrt{n} + 1$ the algorithm cannot prove if a candidate is prime. However, often it can prove a candidate is not prime. - -The benefit of this test is that trial division by small values is fairly efficient. Specially compared to the other algorithms that will be -discussed shortly. The probability that this approach correctly identifies a composite candidate when tested with all primes upto $q$ is given by -$1 - {1.12 \over ln(q)}$. The graph (\ref{pic:primality}, will be added later) demonstrates the probability of success for the range -$3 \le q \le 100$. - -At approximately $q = 30$ the gain of performing further tests diminishes fairly quickly. At $q = 90$ further testing is generally not going to -be of any practical use. In the case of LibTomMath the default limit $q = 256$ was chosen since it is not too high and will eliminate -approximately $80\%$ of all candidate integers. The constant \textbf{PRIME\_SIZE} is equal to the number of primes in the test base. The -array \_\_prime\_tab is an array of the first \textbf{PRIME\_SIZE} prime numbers. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_prime\_is\_divisible}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $c = 1$ if $n$ is divisible by a small prime, otherwise $c = 0$. \\ -\hline \\ -1. for $ix$ from $0$ to $PRIME\_SIZE$ do \\ -\hspace{3mm}1.1 $d \leftarrow n \mbox{ (mod }\_\_prime\_tab_{ix}\mbox{)}$ \\ -\hspace{3mm}1.2 If $d = 0$ then \\ -\hspace{6mm}1.2.1 $c \leftarrow 1$ \\ -\hspace{6mm}1.2.2 Return(\textit{MP\_OKAY}). \\ -2. $c \leftarrow 0$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_prime\_is\_divisible} -\end{figure} -\textbf{Algorithm mp\_prime\_is\_divisible.} -This algorithm attempts to determine if a candidate integer $n$ is composite by performing trial divisions. - -EXAM,bn_mp_prime_is_divisible.c - -The algorithm defaults to a return of $0$ in case an error occurs. The values in the prime table are all specified to be in the range of a -mp\_digit. The table \_\_prime\_tab is defined in the following file. - -EXAM,bn_prime_tab.c - -Note that there are two possible tables. When an mp\_digit is 7-bits long only the primes upto $127$ may be included, otherwise the primes -upto $1619$ are used. Note that the value of \textbf{PRIME\_SIZE} is a constant dependent on the size of a mp\_digit. - -\subsection{The Fermat Test} -The Fermat test is probably one the oldest tests to have a non-trivial probability of success. It is based on the fact that if $n$ is in -fact prime then $a^{n} \equiv a \mbox{ (mod }n\mbox{)}$ for all $0 < a < n$. The reason being that if $n$ is prime than the order of -the multiplicative sub group is $n - 1$. Any base $a$ must have an order which divides $n - 1$ and as such $a^n$ is equivalent to -$a^1 = a$. - -If $n$ is composite then any given base $a$ does not have to have a period which divides $n - 1$. In which case -it is possible that $a^n \nequiv a \mbox{ (mod }n\mbox{)}$. However, this test is not absolute as it is possible that the order -of a base will divide $n - 1$ which would then be reported as prime. Such a base yields what is known as a Fermat pseudo-prime. Several -integers known as Carmichael numbers will be a pseudo-prime to all valid bases. Fortunately such numbers are extremely rare as $n$ grows -in size. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_prime\_fermat}. \\ -\textbf{Input}. mp\_int $a$ and $b$, $a \ge 2$, $0 < b < a$. \\ -\textbf{Output}. $c = 1$ if $b^a \equiv b \mbox{ (mod }a\mbox{)}$, otherwise $c = 0$. \\ -\hline \\ -1. $t \leftarrow b^a \mbox{ (mod }a\mbox{)}$ \\ -2. If $t = b$ then \\ -\hspace{3mm}2.1 $c = 1$ \\ -3. else \\ -\hspace{3mm}3.1 $c = 0$ \\ -4. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_prime\_fermat} -\end{figure} -\textbf{Algorithm mp\_prime\_fermat.} -This algorithm determines whether an mp\_int $a$ is a Fermat prime to the base $b$ or not. It uses a single modular exponentiation to -determine the result. - -EXAM,bn_mp_prime_fermat.c - -\subsection{The Miller-Rabin Test} -The Miller-Rabin (citation) test is another primality test which has tighter error bounds than the Fermat test specifically with sequentially chosen -candidate integers. The algorithm is based on the observation that if $n - 1 = 2^kr$ and if $b^r \nequiv \pm 1$ then after upto $k - 1$ squarings the -value must be equal to $-1$. The squarings are stopped as soon as $-1$ is observed. If the value of $1$ is observed first it means that -some value not congruent to $\pm 1$ when squared equals one which cannot occur if $n$ is prime. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_prime\_miller\_rabin}. \\ -\textbf{Input}. mp\_int $a$ and $b$, $a \ge 2$, $0 < b < a$. \\ -\textbf{Output}. $c = 1$ if $a$ is a Miller-Rabin prime to the base $a$, otherwise $c = 0$. \\ -\hline -1. $a' \leftarrow a - 1$ \\ -2. $r \leftarrow n1$ \\ -3. $c \leftarrow 0, s \leftarrow 0$ \\ -4. While $r.used > 0$ and $r_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}4.1 $s \leftarrow s + 1$ \\ -\hspace{3mm}4.2 $r \leftarrow \lfloor r / 2 \rfloor$ \\ -5. $y \leftarrow b^r \mbox{ (mod }a\mbox{)}$ \\ -6. If $y \nequiv \pm 1$ then \\ -\hspace{3mm}6.1 $j \leftarrow 1$ \\ -\hspace{3mm}6.2 While $j \le (s - 1)$ and $y \nequiv a'$ \\ -\hspace{6mm}6.2.1 $y \leftarrow y^2 \mbox{ (mod }a\mbox{)}$ \\ -\hspace{6mm}6.2.2 If $y = 1$ then goto step 8. \\ -\hspace{6mm}6.2.3 $j \leftarrow j + 1$ \\ -\hspace{3mm}6.3 If $y \nequiv a'$ goto step 8. \\ -7. $c \leftarrow 1$\\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_prime\_miller\_rabin} -\end{figure} -\textbf{Algorithm mp\_prime\_miller\_rabin.} -This algorithm performs one trial round of the Miller-Rabin algorithm to the base $b$. It will set $c = 1$ if the algorithm cannot determine -if $b$ is composite or $c = 0$ if $b$ is provably composite. The values of $s$ and $r$ are computed such that $a' = a - 1 = 2^sr$. - -If the value $y \equiv b^r$ is congruent to $\pm 1$ then the algorithm cannot prove if $a$ is composite or not. Otherwise, the algorithm will -square $y$ upto $s - 1$ times stopping only when $y \equiv -1$. If $y^2 \equiv 1$ and $y \nequiv \pm 1$ then the algorithm can report that $a$ -is provably composite. If the algorithm performs $s - 1$ squarings and $y \nequiv -1$ then $a$ is provably composite. If $a$ is not provably -composite then it is \textit{probably} prime. - -EXAM,bn_mp_prime_miller_rabin.c - - - - -\backmatter -\appendix -\begin{thebibliography}{ABCDEF} -\bibitem[1]{TAOCPV2} -Donald Knuth, \textit{The Art of Computer Programming}, Third Edition, Volume Two, Seminumerical Algorithms, Addison-Wesley, 1998 - -\bibitem[2]{HAC} -A. Menezes, P. van Oorschot, S. Vanstone, \textit{Handbook of Applied Cryptography}, CRC Press, 1996 - -\bibitem[3]{ROSE} -Michael Rosing, \textit{Implementing Elliptic Curve Cryptography}, Manning Publications, 1999 - -\bibitem[4]{COMBA} -Paul G. Comba, \textit{Exponentiation Cryptosystems on the IBM PC}. IBM Systems Journal 29(4): 526-538 (1990) - -\bibitem[5]{KARA} -A. Karatsuba, Doklay Akad. Nauk SSSR 145 (1962), pp.293-294 - -\bibitem[6]{KARAP} -Andre Weimerskirch and Christof Paar, \textit{Generalizations of the Karatsuba Algorithm for Polynomial Multiplication}, Submitted to Design, Codes and Cryptography, March 2002 - -\bibitem[7]{BARRETT} -Paul Barrett, \textit{Implementing the Rivest Shamir and Adleman Public Key Encryption Algorithm on a Standard Digital Signal Processor}, Advances in Cryptology, Crypto '86, Springer-Verlag. - -\bibitem[8]{MONT} -P.L.Montgomery. \textit{Modular multiplication without trial division}. Mathematics of Computation, 44(170):519-521, April 1985. - -\bibitem[9]{DRMET} -Chae Hoon Lim and Pil Joong Lee, \textit{Generating Efficient Primes for Discrete Log Cryptosystems}, POSTECH Information Research Laboratories - -\bibitem[10]{MMB} -J. Daemen and R. Govaerts and J. Vandewalle, \textit{Block ciphers based on Modular Arithmetic}, State and {P}rogress in the {R}esearch of {C}ryptography, 1993, pp. 80-89 - -\bibitem[11]{RSAREF} -R.L. Rivest, A. Shamir, L. Adleman, \textit{A Method for Obtaining Digital Signatures and Public-Key Cryptosystems} - -\bibitem[12]{DHREF} -Whitfield Diffie, Martin E. Hellman, \textit{New Directions in Cryptography}, IEEE Transactions on Information Theory, 1976 - -\bibitem[13]{IEEE} -IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985) - -\bibitem[14]{GMP} -GNU Multiple Precision (GMP), \url{http://www.swox.com/gmp/} - -\bibitem[15]{MPI} -Multiple Precision Integer Library (MPI), Michael Fromberger, \url{http://thayer.dartmouth.edu/~sting/mpi/} - -\bibitem[16]{OPENSSL} -OpenSSL Cryptographic Toolkit, \url{http://openssl.org} - -\bibitem[17]{LIP} -Large Integer Package, \url{http://home.hetnet.nl/~ecstr/LIP.zip} - -\bibitem[18]{ISOC} -JTC1/SC22/WG14, ISO/IEC 9899:1999, ``A draft rationale for the C99 standard.'' - -\bibitem[19]{JAVA} -The Sun Java Website, \url{http://java.sun.com/} - -\end{thebibliography} - -\input{tommath.ind} - -\end{document} diff --git a/libtommath/tommath.tex b/libtommath/tommath.tex deleted file mode 100644 index d70b64b..0000000 --- a/libtommath/tommath.tex +++ /dev/null @@ -1,10816 +0,0 @@ -\documentclass[b5paper]{book} -\usepackage{hyperref} -\usepackage{makeidx} -\usepackage{amssymb} -\usepackage{color} -\usepackage{alltt} -\usepackage{graphicx} -\usepackage{layout} -\def\union{\cup} -\def\intersect{\cap} -\def\getsrandom{\stackrel{\rm R}{\gets}} -\def\cross{\times} -\def\cat{\hspace{0.5em} \| \hspace{0.5em}} -\def\catn{$\|$} -\def\divides{\hspace{0.3em} | \hspace{0.3em}} -\def\nequiv{\not\equiv} -\def\approx{\raisebox{0.2ex}{\mbox{\small $\sim$}}} -\def\lcm{{\rm lcm}} -\def\gcd{{\rm gcd}} -\def\log{{\rm log}} -\def\ord{{\rm ord}} -\def\abs{{\mathit abs}} -\def\rep{{\mathit rep}} -\def\mod{{\mathit\ mod\ }} -\renewcommand{\pmod}[1]{\ ({\rm mod\ }{#1})} -\newcommand{\floor}[1]{\left\lfloor{#1}\right\rfloor} -\newcommand{\ceil}[1]{\left\lceil{#1}\right\rceil} -\def\Or{{\rm\ or\ }} -\def\And{{\rm\ and\ }} -\def\iff{\hspace{1em}\Longleftrightarrow\hspace{1em}} -\def\implies{\Rightarrow} -\def\undefined{{\rm ``undefined"}} -\def\Proof{\vspace{1ex}\noindent {\bf Proof:}\hspace{1em}} -\let\oldphi\phi -\def\phi{\varphi} -\def\Pr{{\rm Pr}} -\newcommand{\str}[1]{{\mathbf{#1}}} -\def\F{{\mathbb F}} -\def\N{{\mathbb N}} -\def\Z{{\mathbb Z}} -\def\R{{\mathbb R}} -\def\C{{\mathbb C}} -\def\Q{{\mathbb Q}} -\definecolor{DGray}{gray}{0.5} -\newcommand{\emailaddr}[1]{\mbox{$<${#1}$>$}} -\def\twiddle{\raisebox{0.3ex}{\mbox{\tiny $\sim$}}} -\def\gap{\vspace{0.5ex}} -\makeindex -\begin{document} -\frontmatter -\pagestyle{empty} -\title{Multi--Precision Math} -\author{\mbox{ -%\begin{small} -\begin{tabular}{c} -Tom St Denis \\ -Algonquin College \\ -\\ -Mads Rasmussen \\ -Open Communications Security \\ -\\ -Greg Rose \\ -QUALCOMM Australia \\ -\end{tabular} -%\end{small} -} -} -\maketitle -This text has been placed in the public domain. This text corresponds to the v0.39 release of the -LibTomMath project. - -This text is formatted to the international B5 paper size of 176mm wide by 250mm tall using the \LaTeX{} -{\em book} macro package and the Perl {\em booker} package. - -\tableofcontents -\listoffigures -\chapter*{Prefaces} -When I tell people about my LibTom projects and that I release them as public domain they are often puzzled. -They ask why I did it and especially why I continue to work on them for free. The best I can explain it is ``Because I can.'' -Which seems odd and perhaps too terse for adult conversation. I often qualify it with ``I am able, I am willing.'' which -perhaps explains it better. I am the first to admit there is not anything that special with what I have done. Perhaps -others can see that too and then we would have a society to be proud of. My LibTom projects are what I am doing to give -back to society in the form of tools and knowledge that can help others in their endeavours. - -I started writing this book because it was the most logical task to further my goal of open academia. The LibTomMath source -code itself was written to be easy to follow and learn from. There are times, however, where pure C source code does not -explain the algorithms properly. Hence this book. The book literally starts with the foundation of the library and works -itself outwards to the more complicated algorithms. The use of both pseudo--code and verbatim source code provides a duality -of ``theory'' and ``practice'' that the computer science students of the world shall appreciate. I never deviate too far -from relatively straightforward algebra and I hope that this book can be a valuable learning asset. - -This book and indeed much of the LibTom projects would not exist in their current form if it was not for a plethora -of kind people donating their time, resources and kind words to help support my work. Writing a text of significant -length (along with the source code) is a tiresome and lengthy process. Currently the LibTom project is four years old, -comprises of literally thousands of users and over 100,000 lines of source code, TeX and other material. People like Mads and Greg -were there at the beginning to encourage me to work well. It is amazing how timely validation from others can boost morale to -continue the project. Definitely my parents were there for me by providing room and board during the many months of work in 2003. - -To my many friends whom I have met through the years I thank you for the good times and the words of encouragement. I hope I -honour your kind gestures with this project. - -Open Source. Open Academia. Open Minds. - -\begin{flushright} Tom St Denis \end{flushright} - -\newpage -I found the opportunity to work with Tom appealing for several reasons, not only could I broaden my own horizons, but also -contribute to educate others facing the problem of having to handle big number mathematical calculations. - -This book is Tom's child and he has been caring and fostering the project ever since the beginning with a clear mind of -how he wanted the project to turn out. I have helped by proofreading the text and we have had several discussions about -the layout and language used. - -I hold a masters degree in cryptography from the University of Southern Denmark and have always been interested in the -practical aspects of cryptography. - -Having worked in the security consultancy business for several years in S\~{a}o Paulo, Brazil, I have been in touch with a -great deal of work in which multiple precision mathematics was needed. Understanding the possibilities for speeding up -multiple precision calculations is often very important since we deal with outdated machine architecture where modular -reductions, for example, become painfully slow. - -This text is for people who stop and wonder when first examining algorithms such as RSA for the first time and asks -themselves, ``You tell me this is only secure for large numbers, fine; but how do you implement these numbers?'' - -\begin{flushright} -Mads Rasmussen - -S\~{a}o Paulo - SP - -Brazil -\end{flushright} - -\newpage -It's all because I broke my leg. That just happened to be at about the same time that Tom asked for someone to review the section of the book about -Karatsuba multiplication. I was laid up, alone and immobile, and thought ``Why not?'' I vaguely knew what Karatsuba multiplication was, but not -really, so I thought I could help, learn, and stop myself from watching daytime cable TV, all at once. - -At the time of writing this, I've still not met Tom or Mads in meatspace. I've been following Tom's progress since his first splash on the -sci.crypt Usenet news group. I watched him go from a clueless newbie, to the cryptographic equivalent of a reformed smoker, to a real -contributor to the field, over a period of about two years. I've been impressed with his obvious intelligence, and astounded by his productivity. -Of course, he's young enough to be my own child, so he doesn't have my problems with staying awake. - -When I reviewed that single section of the book, in its very earliest form, I was very pleasantly surprised. So I decided to collaborate more fully, -and at least review all of it, and perhaps write some bits too. There's still a long way to go with it, and I have watched a number of close -friends go through the mill of publication, so I think that the way to go is longer than Tom thinks it is. Nevertheless, it's a good effort, -and I'm pleased to be involved with it. - -\begin{flushright} -Greg Rose, Sydney, Australia, June 2003. -\end{flushright} - -\mainmatter -\pagestyle{headings} -\chapter{Introduction} -\section{Multiple Precision Arithmetic} - -\subsection{What is Multiple Precision Arithmetic?} -When we think of long-hand arithmetic such as addition or multiplication we rarely consider the fact that we instinctively -raise or lower the precision of the numbers we are dealing with. For example, in decimal we almost immediate can -reason that $7$ times $6$ is $42$. However, $42$ has two digits of precision as opposed to one digit we started with. -Further multiplications of say $3$ result in a larger precision result $126$. In these few examples we have multiple -precisions for the numbers we are working with. Despite the various levels of precision a single subset\footnote{With the occasional optimization.} - of algorithms can be designed to accomodate them. - -By way of comparison a fixed or single precision operation would lose precision on various operations. For example, in -the decimal system with fixed precision $6 \cdot 7 = 2$. - -Essentially at the heart of computer based multiple precision arithmetic are the same long-hand algorithms taught in -schools to manually add, subtract, multiply and divide. - -\subsection{The Need for Multiple Precision Arithmetic} -The most prevalent need for multiple precision arithmetic, often referred to as ``bignum'' math, is within the implementation -of public-key cryptography algorithms. Algorithms such as RSA \cite{RSAREF} and Diffie-Hellman \cite{DHREF} require -integers of significant magnitude to resist known cryptanalytic attacks. For example, at the time of this writing a -typical RSA modulus would be at least greater than $10^{309}$. However, modern programming languages such as ISO C \cite{ISOC} and -Java \cite{JAVA} only provide instrinsic support for integers which are relatively small and single precision. - -\begin{figure}[!here] -\begin{center} -\begin{tabular}{|r|c|} -\hline \textbf{Data Type} & \textbf{Range} \\ -\hline char & $-128 \ldots 127$ \\ -\hline short & $-32768 \ldots 32767$ \\ -\hline long & $-2147483648 \ldots 2147483647$ \\ -\hline long long & $-9223372036854775808 \ldots 9223372036854775807$ \\ -\hline -\end{tabular} -\end{center} -\caption{Typical Data Types for the C Programming Language} -\label{fig:ISOC} -\end{figure} - -The largest data type guaranteed to be provided by the ISO C programming -language\footnote{As per the ISO C standard. However, each compiler vendor is allowed to augment the precision as they -see fit.} can only represent values up to $10^{19}$ as shown in figure \ref{fig:ISOC}. On its own the C language is -insufficient to accomodate the magnitude required for the problem at hand. An RSA modulus of magnitude $10^{19}$ could be -trivially factored\footnote{A Pollard-Rho factoring would take only $2^{16}$ time.} on the average desktop computer, -rendering any protocol based on the algorithm insecure. Multiple precision algorithms solve this very problem by -extending the range of representable integers while using single precision data types. - -Most advancements in fast multiple precision arithmetic stem from the need for faster and more efficient cryptographic -primitives. Faster modular reduction and exponentiation algorithms such as Barrett's algorithm, which have appeared in -various cryptographic journals, can render algorithms such as RSA and Diffie-Hellman more efficient. In fact, several -major companies such as RSA Security, Certicom and Entrust have built entire product lines on the implementation and -deployment of efficient algorithms. - -However, cryptography is not the only field of study that can benefit from fast multiple precision integer routines. -Another auxiliary use of multiple precision integers is high precision floating point data types. -The basic IEEE \cite{IEEE} standard floating point type is made up of an integer mantissa $q$, an exponent $e$ and a sign bit $s$. -Numbers are given in the form $n = q \cdot b^e \cdot -1^s$ where $b = 2$ is the most common base for IEEE. Since IEEE -floating point is meant to be implemented in hardware the precision of the mantissa is often fairly small -(\textit{23, 48 and 64 bits}). The mantissa is merely an integer and a multiple precision integer could be used to create -a mantissa of much larger precision than hardware alone can efficiently support. This approach could be useful where -scientific applications must minimize the total output error over long calculations. - -Yet another use for large integers is within arithmetic on polynomials of large characteristic (i.e. $GF(p)[x]$ for large $p$). -In fact the library discussed within this text has already been used to form a polynomial basis library\footnote{See \url{http://poly.libtomcrypt.org} for more details.}. - -\subsection{Benefits of Multiple Precision Arithmetic} -\index{precision} -The benefit of multiple precision representations over single or fixed precision representations is that -no precision is lost while representing the result of an operation which requires excess precision. For example, -the product of two $n$-bit integers requires at least $2n$ bits of precision to be represented faithfully. A multiple -precision algorithm would augment the precision of the destination to accomodate the result while a single precision system -would truncate excess bits to maintain a fixed level of precision. - -It is possible to implement algorithms which require large integers with fixed precision algorithms. For example, elliptic -curve cryptography (\textit{ECC}) is often implemented on smartcards by fixing the precision of the integers to the maximum -size the system will ever need. Such an approach can lead to vastly simpler algorithms which can accomodate the -integers required even if the host platform cannot natively accomodate them\footnote{For example, the average smartcard -processor has an 8 bit accumulator.}. However, as efficient as such an approach may be, the resulting source code is not -normally very flexible. It cannot, at runtime, accomodate inputs of higher magnitude than the designer anticipated. - -Multiple precision algorithms have the most overhead of any style of arithmetic. For the the most part the -overhead can be kept to a minimum with careful planning, but overall, it is not well suited for most memory starved -platforms. However, multiple precision algorithms do offer the most flexibility in terms of the magnitude of the -inputs. That is, the same algorithms based on multiple precision integers can accomodate any reasonable size input -without the designer's explicit forethought. This leads to lower cost of ownership for the code as it only has to -be written and tested once. - -\section{Purpose of This Text} -The purpose of this text is to instruct the reader regarding how to implement efficient multiple precision algorithms. -That is to not only explain a limited subset of the core theory behind the algorithms but also the various ``house keeping'' -elements that are neglected by authors of other texts on the subject. Several well reknowned texts \cite{TAOCPV2,HAC} -give considerably detailed explanations of the theoretical aspects of algorithms and often very little information -regarding the practical implementation aspects. - -In most cases how an algorithm is explained and how it is actually implemented are two very different concepts. For -example, the Handbook of Applied Cryptography (\textit{HAC}), algorithm 14.7 on page 594, gives a relatively simple -algorithm for performing multiple precision integer addition. However, the description lacks any discussion concerning -the fact that the two integer inputs may be of differing magnitudes. As a result the implementation is not as simple -as the text would lead people to believe. Similarly the division routine (\textit{algorithm 14.20, pp. 598}) does not -discuss how to handle sign or handle the dividend's decreasing magnitude in the main loop (\textit{step \#3}). - -Both texts also do not discuss several key optimal algorithms required such as ``Comba'' and Karatsuba multipliers -and fast modular inversion, which we consider practical oversights. These optimal algorithms are vital to achieve -any form of useful performance in non-trivial applications. - -To solve this problem the focus of this text is on the practical aspects of implementing a multiple precision integer -package. As a case study the ``LibTomMath''\footnote{Available at \url{http://math.libtomcrypt.com}} package is used -to demonstrate algorithms with real implementations\footnote{In the ISO C programming language.} that have been field -tested and work very well. The LibTomMath library is freely available on the Internet for all uses and this text -discusses a very large portion of the inner workings of the library. - -The algorithms that are presented will always include at least one ``pseudo-code'' description followed -by the actual C source code that implements the algorithm. The pseudo-code can be used to implement the same -algorithm in other programming languages as the reader sees fit. - -This text shall also serve as a walkthrough of the creation of multiple precision algorithms from scratch. Showing -the reader how the algorithms fit together as well as where to start on various taskings. - -\section{Discussion and Notation} -\subsection{Notation} -A multiple precision integer of $n$-digits shall be denoted as $x = (x_{n-1}, \ldots, x_1, x_0)_{ \beta }$ and represent -the integer $x \equiv \sum_{i=0}^{n-1} x_i\beta^i$. The elements of the array $x$ are said to be the radix $\beta$ digits -of the integer. For example, $x = (1,2,3)_{10}$ would represent the integer -$1\cdot 10^2 + 2\cdot10^1 + 3\cdot10^0 = 123$. - -\index{mp\_int} -The term ``mp\_int'' shall refer to a composite structure which contains the digits of the integer it represents, as well -as auxilary data required to manipulate the data. These additional members are discussed further in section -\ref{sec:MPINT}. For the purposes of this text a ``multiple precision integer'' and an ``mp\_int'' are assumed to be -synonymous. When an algorithm is specified to accept an mp\_int variable it is assumed the various auxliary data members -are present as well. An expression of the type \textit{variablename.item} implies that it should evaluate to the -member named ``item'' of the variable. For example, a string of characters may have a member ``length'' which would -evaluate to the number of characters in the string. If the string $a$ equals ``hello'' then it follows that -$a.length = 5$. - -For certain discussions more generic algorithms are presented to help the reader understand the final algorithm used -to solve a given problem. When an algorithm is described as accepting an integer input it is assumed the input is -a plain integer with no additional multiple-precision members. That is, algorithms that use integers as opposed to -mp\_ints as inputs do not concern themselves with the housekeeping operations required such as memory management. These -algorithms will be used to establish the relevant theory which will subsequently be used to describe a multiple -precision algorithm to solve the same problem. - -\subsection{Precision Notation} -The variable $\beta$ represents the radix of a single digit of a multiple precision integer and -must be of the form $q^p$ for $q, p \in \Z^+$. A single precision variable must be able to represent integers in -the range $0 \le x < q \beta$ while a double precision variable must be able to represent integers in the range -$0 \le x < q \beta^2$. The extra radix-$q$ factor allows additions and subtractions to proceed without truncation of the -carry. Since all modern computers are binary, it is assumed that $q$ is two. - -\index{mp\_digit} \index{mp\_word} -Within the source code that will be presented for each algorithm, the data type \textbf{mp\_digit} will represent -a single precision integer type, while, the data type \textbf{mp\_word} will represent a double precision integer type. In -several algorithms (notably the Comba routines) temporary results will be stored in arrays of double precision mp\_words. -For the purposes of this text $x_j$ will refer to the $j$'th digit of a single precision array and $\hat x_j$ will refer to -the $j$'th digit of a double precision array. Whenever an expression is to be assigned to a double precision -variable it is assumed that all single precision variables are promoted to double precision during the evaluation. -Expressions that are assigned to a single precision variable are truncated to fit within the precision of a single -precision data type. - -For example, if $\beta = 10^2$ a single precision data type may represent a value in the -range $0 \le x < 10^3$, while a double precision data type may represent a value in the range $0 \le x < 10^5$. Let -$a = 23$ and $b = 49$ represent two single precision variables. The single precision product shall be written -as $c \leftarrow a \cdot b$ while the double precision product shall be written as $\hat c \leftarrow a \cdot b$. -In this particular case, $\hat c = 1127$ and $c = 127$. The most significant digit of the product would not fit -in a single precision data type and as a result $c \ne \hat c$. - -\subsection{Algorithm Inputs and Outputs} -Within the algorithm descriptions all variables are assumed to be scalars of either single or double precision -as indicated. The only exception to this rule is when variables have been indicated to be of type mp\_int. This -distinction is important as scalars are often used as array indicies and various other counters. - -\subsection{Mathematical Expressions} -The $\lfloor \mbox{ } \rfloor$ brackets imply an expression truncated to an integer not greater than the expression -itself. For example, $\lfloor 5.7 \rfloor = 5$. Similarly the $\lceil \mbox{ } \rceil$ brackets imply an expression -rounded to an integer not less than the expression itself. For example, $\lceil 5.1 \rceil = 6$. Typically when -the $/$ division symbol is used the intention is to perform an integer division with truncation. For example, -$5/2 = 2$ which will often be written as $\lfloor 5/2 \rfloor = 2$ for clarity. When an expression is written as a -fraction a real value division is implied, for example ${5 \over 2} = 2.5$. - -The norm of a multiple precision integer, for example $\vert \vert x \vert \vert$, will be used to represent the number of digits in the representation -of the integer. For example, $\vert \vert 123 \vert \vert = 3$ and $\vert \vert 79452 \vert \vert = 5$. - -\subsection{Work Effort} -\index{big-Oh} -To measure the efficiency of the specified algorithms, a modified big-Oh notation is used. In this system all -single precision operations are considered to have the same cost\footnote{Except where explicitly noted.}. -That is a single precision addition, multiplication and division are assumed to take the same time to -complete. While this is generally not true in practice, it will simplify the discussions considerably. - -Some algorithms have slight advantages over others which is why some constants will not be removed in -the notation. For example, a normal baseline multiplication (section \ref{sec:basemult}) requires $O(n^2)$ work while a -baseline squaring (section \ref{sec:basesquare}) requires $O({{n^2 + n}\over 2})$ work. In standard big-Oh notation these -would both be said to be equivalent to $O(n^2)$. However, -in the context of the this text this is not the case as the magnitude of the inputs will typically be rather small. As a -result small constant factors in the work effort will make an observable difference in algorithm efficiency. - -All of the algorithms presented in this text have a polynomial time work level. That is, of the form -$O(n^k)$ for $n, k \in \Z^{+}$. This will help make useful comparisons in terms of the speed of the algorithms and how -various optimizations will help pay off in the long run. - -\section{Exercises} -Within the more advanced chapters a section will be set aside to give the reader some challenging exercises related to -the discussion at hand. These exercises are not designed to be prize winning problems, but instead to be thought -provoking. Wherever possible the problems are forward minded, stating problems that will be answered in subsequent -chapters. The reader is encouraged to finish the exercises as they appear to get a better understanding of the -subject material. - -That being said, the problems are designed to affirm knowledge of a particular subject matter. Students in particular -are encouraged to verify they can answer the problems correctly before moving on. - -Similar to the exercises of \cite[pp. ix]{TAOCPV2} these exercises are given a scoring system based on the difficulty of -the problem. However, unlike \cite{TAOCPV2} the problems do not get nearly as hard. The scoring of these -exercises ranges from one (the easiest) to five (the hardest). The following table sumarizes the -scoring system used. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|c|l|} -\hline $\left [ 1 \right ]$ & An easy problem that should only take the reader a manner of \\ - & minutes to solve. Usually does not involve much computer time \\ - & to solve. \\ -\hline $\left [ 2 \right ]$ & An easy problem that involves a marginal amount of computer \\ - & time usage. Usually requires a program to be written to \\ - & solve the problem. \\ -\hline $\left [ 3 \right ]$ & A moderately hard problem that requires a non-trivial amount \\ - & of work. Usually involves trivial research and development of \\ - & new theory from the perspective of a student. \\ -\hline $\left [ 4 \right ]$ & A moderately hard problem that involves a non-trivial amount \\ - & of work and research, the solution to which will demonstrate \\ - & a higher mastery of the subject matter. \\ -\hline $\left [ 5 \right ]$ & A hard problem that involves concepts that are difficult for a \\ - & novice to solve. Solutions to these problems will demonstrate a \\ - & complete mastery of the given subject. \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Exercise Scoring System} -\end{figure} - -Problems at the first level are meant to be simple questions that the reader can answer quickly without programming a solution or -devising new theory. These problems are quick tests to see if the material is understood. Problems at the second level -are also designed to be easy but will require a program or algorithm to be implemented to arrive at the answer. These -two levels are essentially entry level questions. - -Problems at the third level are meant to be a bit more difficult than the first two levels. The answer is often -fairly obvious but arriving at an exacting solution requires some thought and skill. These problems will almost always -involve devising a new algorithm or implementing a variation of another algorithm previously presented. Readers who can -answer these questions will feel comfortable with the concepts behind the topic at hand. - -Problems at the fourth level are meant to be similar to those of the level three questions except they will require -additional research to be completed. The reader will most likely not know the answer right away, nor will the text provide -the exact details of the answer until a subsequent chapter. - -Problems at the fifth level are meant to be the hardest -problems relative to all the other problems in the chapter. People who can correctly answer fifth level problems have a -mastery of the subject matter at hand. - -Often problems will be tied together. The purpose of this is to start a chain of thought that will be discussed in future chapters. The reader -is encouraged to answer the follow-up problems and try to draw the relevance of problems. - -\section{Introduction to LibTomMath} - -\subsection{What is LibTomMath?} -LibTomMath is a free and open source multiple precision integer library written entirely in portable ISO C. By portable it -is meant that the library does not contain any code that is computer platform dependent or otherwise problematic to use on -any given platform. - -The library has been successfully tested under numerous operating systems including Unix\footnote{All of these -trademarks belong to their respective rightful owners.}, MacOS, Windows, Linux, PalmOS and on standalone hardware such -as the Gameboy Advance. The library is designed to contain enough functionality to be able to develop applications such -as public key cryptosystems and still maintain a relatively small footprint. - -\subsection{Goals of LibTomMath} - -Libraries which obtain the most efficiency are rarely written in a high level programming language such as C. However, -even though this library is written entirely in ISO C, considerable care has been taken to optimize the algorithm implementations within the -library. Specifically the code has been written to work well with the GNU C Compiler (\textit{GCC}) on both x86 and ARM -processors. Wherever possible, highly efficient algorithms, such as Karatsuba multiplication, sliding window -exponentiation and Montgomery reduction have been provided to make the library more efficient. - -Even with the nearly optimal and specialized algorithms that have been included the Application Programing Interface -(\textit{API}) has been kept as simple as possible. Often generic place holder routines will make use of specialized -algorithms automatically without the developer's specific attention. One such example is the generic multiplication -algorithm \textbf{mp\_mul()} which will automatically use Toom--Cook, Karatsuba, Comba or baseline multiplication -based on the magnitude of the inputs and the configuration of the library. - -Making LibTomMath as efficient as possible is not the only goal of the LibTomMath project. Ideally the library should -be source compatible with another popular library which makes it more attractive for developers to use. In this case the -MPI library was used as a API template for all the basic functions. MPI was chosen because it is another library that fits -in the same niche as LibTomMath. Even though LibTomMath uses MPI as the template for the function names and argument -passing conventions, it has been written from scratch by Tom St Denis. - -The project is also meant to act as a learning tool for students, the logic being that no easy-to-follow ``bignum'' -library exists which can be used to teach computer science students how to perform fast and reliable multiple precision -integer arithmetic. To this end the source code has been given quite a few comments and algorithm discussion points. - -\section{Choice of LibTomMath} -LibTomMath was chosen as the case study of this text not only because the author of both projects is one and the same but -for more worthy reasons. Other libraries such as GMP \cite{GMP}, MPI \cite{MPI}, LIP \cite{LIP} and OpenSSL -\cite{OPENSSL} have multiple precision integer arithmetic routines but would not be ideal for this text for -reasons that will be explained in the following sub-sections. - -\subsection{Code Base} -The LibTomMath code base is all portable ISO C source code. This means that there are no platform dependent conditional -segments of code littered throughout the source. This clean and uncluttered approach to the library means that a -developer can more readily discern the true intent of a given section of source code without trying to keep track of -what conditional code will be used. - -The code base of LibTomMath is well organized. Each function is in its own separate source code file -which allows the reader to find a given function very quickly. On average there are $76$ lines of code per source -file which makes the source very easily to follow. By comparison MPI and LIP are single file projects making code tracing -very hard. GMP has many conditional code segments which also hinder tracing. - -When compiled with GCC for the x86 processor and optimized for speed the entire library is approximately $100$KiB\footnote{The notation ``KiB'' means $2^{10}$ octets, similarly ``MiB'' means $2^{20}$ octets.} - which is fairly small compared to GMP (over $250$KiB). LibTomMath is slightly larger than MPI (which compiles to about -$50$KiB) but LibTomMath is also much faster and more complete than MPI. - -\subsection{API Simplicity} -LibTomMath is designed after the MPI library and shares the API design. Quite often programs that use MPI will build -with LibTomMath without change. The function names correlate directly to the action they perform. Almost all of the -functions share the same parameter passing convention. The learning curve is fairly shallow with the API provided -which is an extremely valuable benefit for the student and developer alike. - -The LIP library is an example of a library with an API that is awkward to work with. LIP uses function names that are often ``compressed'' to -illegible short hand. LibTomMath does not share this characteristic. - -The GMP library also does not return error codes. Instead it uses a POSIX.1 \cite{POSIX1} signal system where errors -are signaled to the host application. This happens to be the fastest approach but definitely not the most versatile. In -effect a math error (i.e. invalid input, heap error, etc) can cause a program to stop functioning which is definitely -undersireable in many situations. - -\subsection{Optimizations} -While LibTomMath is certainly not the fastest library (GMP often beats LibTomMath by a factor of two) it does -feature a set of optimal algorithms for tasks such as modular reduction, exponentiation, multiplication and squaring. GMP -and LIP also feature such optimizations while MPI only uses baseline algorithms with no optimizations. GMP lacks a few -of the additional modular reduction optimizations that LibTomMath features\footnote{At the time of this writing GMP -only had Barrett and Montgomery modular reduction algorithms.}. - -LibTomMath is almost always an order of magnitude faster than the MPI library at computationally expensive tasks such as modular -exponentiation. In the grand scheme of ``bignum'' libraries LibTomMath is faster than the average library and usually -slower than the best libraries such as GMP and OpenSSL by only a small factor. - -\subsection{Portability and Stability} -LibTomMath will build ``out of the box'' on any platform equipped with a modern version of the GNU C Compiler -(\textit{GCC}). This means that without changes the library will build without configuration or setting up any -variables. LIP and MPI will build ``out of the box'' as well but have numerous known bugs. Most notably the author of -MPI has recently stopped working on his library and LIP has long since been discontinued. - -GMP requires a configuration script to run and will not build out of the box. GMP and LibTomMath are still in active -development and are very stable across a variety of platforms. - -\subsection{Choice} -LibTomMath is a relatively compact, well documented, highly optimized and portable library which seems only natural for -the case study of this text. Various source files from the LibTomMath project will be included within the text. However, -the reader is encouraged to download their own copy of the library to actually be able to work with the library. - -\chapter{Getting Started} -\section{Library Basics} -The trick to writing any useful library of source code is to build a solid foundation and work outwards from it. First, -a problem along with allowable solution parameters should be identified and analyzed. In this particular case the -inability to accomodate multiple precision integers is the problem. Futhermore, the solution must be written -as portable source code that is reasonably efficient across several different computer platforms. - -After a foundation is formed the remainder of the library can be designed and implemented in a hierarchical fashion. -That is, to implement the lowest level dependencies first and work towards the most abstract functions last. For example, -before implementing a modular exponentiation algorithm one would implement a modular reduction algorithm. -By building outwards from a base foundation instead of using a parallel design methodology the resulting project is -highly modular. Being highly modular is a desirable property of any project as it often means the resulting product -has a small footprint and updates are easy to perform. - -Usually when I start a project I will begin with the header files. I define the data types I think I will need and -prototype the initial functions that are not dependent on other functions (within the library). After I -implement these base functions I prototype more dependent functions and implement them. The process repeats until -I implement all of the functions I require. For example, in the case of LibTomMath I implemented functions such as -mp\_init() well before I implemented mp\_mul() and even further before I implemented mp\_exptmod(). As an example as to -why this design works note that the Karatsuba and Toom-Cook multipliers were written \textit{after} the -dependent function mp\_exptmod() was written. Adding the new multiplication algorithms did not require changes to the -mp\_exptmod() function itself and lowered the total cost of ownership (\textit{so to speak}) and of development -for new algorithms. This methodology allows new algorithms to be tested in a complete framework with relative ease. - -\begin{center} -\begin{figure}[here] -\includegraphics{pics/design_process.ps} -\caption{Design Flow of the First Few Original LibTomMath Functions.} -\label{pic:design_process} -\end{figure} -\end{center} - -Only after the majority of the functions were in place did I pursue a less hierarchical approach to auditing and optimizing -the source code. For example, one day I may audit the multipliers and the next day the polynomial basis functions. - -It only makes sense to begin the text with the preliminary data types and support algorithms required as well. -This chapter discusses the core algorithms of the library which are the dependents for every other algorithm. - -\section{What is a Multiple Precision Integer?} -Recall that most programming languages, in particular ISO C \cite{ISOC}, only have fixed precision data types that on their own cannot -be used to represent values larger than their precision will allow. The purpose of multiple precision algorithms is -to use fixed precision data types to create and manipulate multiple precision integers which may represent values -that are very large. - -As a well known analogy, school children are taught how to form numbers larger than nine by prepending more radix ten digits. In the decimal system -the largest single digit value is $9$. However, by concatenating digits together larger numbers may be represented. Newly prepended digits -(\textit{to the left}) are said to be in a different power of ten column. That is, the number $123$ can be described as having a $1$ in the hundreds -column, $2$ in the tens column and $3$ in the ones column. Or more formally $123 = 1 \cdot 10^2 + 2 \cdot 10^1 + 3 \cdot 10^0$. Computer based -multiple precision arithmetic is essentially the same concept. Larger integers are represented by adjoining fixed -precision computer words with the exception that a different radix is used. - -What most people probably do not think about explicitly are the various other attributes that describe a multiple precision -integer. For example, the integer $154_{10}$ has two immediately obvious properties. First, the integer is positive, -that is the sign of this particular integer is positive as opposed to negative. Second, the integer has three digits in -its representation. There is an additional property that the integer posesses that does not concern pencil-and-paper -arithmetic. The third property is how many digits placeholders are available to hold the integer. - -The human analogy of this third property is ensuring there is enough space on the paper to write the integer. For example, -if one starts writing a large number too far to the right on a piece of paper they will have to erase it and move left. -Similarly, computer algorithms must maintain strict control over memory usage to ensure that the digits of an integer -will not exceed the allowed boundaries. These three properties make up what is known as a multiple precision -integer or mp\_int for short. - -\subsection{The mp\_int Structure} -\label{sec:MPINT} -The mp\_int structure is the ISO C based manifestation of what represents a multiple precision integer. The ISO C standard does not provide for -any such data type but it does provide for making composite data types known as structures. The following is the structure definition -used within LibTomMath. - -\index{mp\_int} -\begin{figure}[here] -\begin{center} -\begin{small} -%\begin{verbatim} -\begin{tabular}{|l|} -\hline -typedef struct \{ \\ -\hspace{3mm}int used, alloc, sign;\\ -\hspace{3mm}mp\_digit *dp;\\ -\} \textbf{mp\_int}; \\ -\hline -\end{tabular} -%\end{verbatim} -\end{small} -\caption{The mp\_int Structure} -\label{fig:mpint} -\end{center} -\end{figure} - -The mp\_int structure (fig. \ref{fig:mpint}) can be broken down as follows. - -\begin{enumerate} -\item The \textbf{used} parameter denotes how many digits of the array \textbf{dp} contain the digits used to represent -a given integer. The \textbf{used} count must be positive (or zero) and may not exceed the \textbf{alloc} count. - -\item The \textbf{alloc} parameter denotes how -many digits are available in the array to use by functions before it has to increase in size. When the \textbf{used} count -of a result would exceed the \textbf{alloc} count all of the algorithms will automatically increase the size of the -array to accommodate the precision of the result. - -\item The pointer \textbf{dp} points to a dynamically allocated array of digits that represent the given multiple -precision integer. It is padded with $(\textbf{alloc} - \textbf{used})$ zero digits. The array is maintained in a least -significant digit order. As a pencil and paper analogy the array is organized such that the right most digits are stored -first starting at the location indexed by zero\footnote{In C all arrays begin at zero.} in the array. For example, -if \textbf{dp} contains $\lbrace a, b, c, \ldots \rbrace$ where \textbf{dp}$_0 = a$, \textbf{dp}$_1 = b$, \textbf{dp}$_2 = c$, $\ldots$ then -it would represent the integer $a + b\beta + c\beta^2 + \ldots$ - -\index{MP\_ZPOS} \index{MP\_NEG} -\item The \textbf{sign} parameter denotes the sign as either zero/positive (\textbf{MP\_ZPOS}) or negative (\textbf{MP\_NEG}). -\end{enumerate} - -\subsubsection{Valid mp\_int Structures} -Several rules are placed on the state of an mp\_int structure and are assumed to be followed for reasons of efficiency. -The only exceptions are when the structure is passed to initialization functions such as mp\_init() and mp\_init\_copy(). - -\begin{enumerate} -\item The value of \textbf{alloc} may not be less than one. That is \textbf{dp} always points to a previously allocated -array of digits. -\item The value of \textbf{used} may not exceed \textbf{alloc} and must be greater than or equal to zero. -\item The value of \textbf{used} implies the digit at index $(used - 1)$ of the \textbf{dp} array is non-zero. That is, -leading zero digits in the most significant positions must be trimmed. - \begin{enumerate} - \item Digits in the \textbf{dp} array at and above the \textbf{used} location must be zero. - \end{enumerate} -\item The value of \textbf{sign} must be \textbf{MP\_ZPOS} if \textbf{used} is zero; -this represents the mp\_int value of zero. -\end{enumerate} - -\section{Argument Passing} -A convention of argument passing must be adopted early on in the development of any library. Making the function -prototypes consistent will help eliminate many headaches in the future as the library grows to significant complexity. -In LibTomMath the multiple precision integer functions accept parameters from left to right as pointers to mp\_int -structures. That means that the source (input) operands are placed on the left and the destination (output) on the right. -Consider the following examples. - -\begin{verbatim} - mp_mul(&a, &b, &c); /* c = a * b */ - mp_add(&a, &b, &a); /* a = a + b */ - mp_sqr(&a, &b); /* b = a * a */ -\end{verbatim} - -The left to right order is a fairly natural way to implement the functions since it lets the developer read aloud the -functions and make sense of them. For example, the first function would read ``multiply a and b and store in c''. - -Certain libraries (\textit{LIP by Lenstra for instance}) accept parameters the other way around, to mimic the order -of assignment expressions. That is, the destination (output) is on the left and arguments (inputs) are on the right. In -truth, it is entirely a matter of preference. In the case of LibTomMath the convention from the MPI library has been -adopted. - -Another very useful design consideration, provided for in LibTomMath, is whether to allow argument sources to also be a -destination. For example, the second example (\textit{mp\_add}) adds $a$ to $b$ and stores in $a$. This is an important -feature to implement since it allows the calling functions to cut down on the number of variables it must maintain. -However, to implement this feature specific care has to be given to ensure the destination is not modified before the -source is fully read. - -\section{Return Values} -A well implemented application, no matter what its purpose, should trap as many runtime errors as possible and return them -to the caller. By catching runtime errors a library can be guaranteed to prevent undefined behaviour. However, the end -developer can still manage to cause a library to crash. For example, by passing an invalid pointer an application may -fault by dereferencing memory not owned by the application. - -In the case of LibTomMath the only errors that are checked for are related to inappropriate inputs (division by zero for -instance) and memory allocation errors. It will not check that the mp\_int passed to any function is valid nor -will it check pointers for validity. Any function that can cause a runtime error will return an error code as an -\textbf{int} data type with one of the following values (fig \ref{fig:errcodes}). - -\index{MP\_OKAY} \index{MP\_VAL} \index{MP\_MEM} -\begin{figure}[here] -\begin{center} -\begin{tabular}{|l|l|} -\hline \textbf{Value} & \textbf{Meaning} \\ -\hline \textbf{MP\_OKAY} & The function was successful \\ -\hline \textbf{MP\_VAL} & One of the input value(s) was invalid \\ -\hline \textbf{MP\_MEM} & The function ran out of heap memory \\ -\hline -\end{tabular} -\end{center} -\caption{LibTomMath Error Codes} -\label{fig:errcodes} -\end{figure} - -When an error is detected within a function it should free any memory it allocated, often during the initialization of -temporary mp\_ints, and return as soon as possible. The goal is to leave the system in the same state it was when the -function was called. Error checking with this style of API is fairly simple. - -\begin{verbatim} - int err; - if ((err = mp_add(&a, &b, &c)) != MP_OKAY) { - printf("Error: %s\n", mp_error_to_string(err)); - exit(EXIT_FAILURE); - } -\end{verbatim} - -The GMP \cite{GMP} library uses C style \textit{signals} to flag errors which is of questionable use. Not all errors are fatal -and it was not deemed ideal by the author of LibTomMath to force developers to have signal handlers for such cases. - -\section{Initialization and Clearing} -The logical starting point when actually writing multiple precision integer functions is the initialization and -clearing of the mp\_int structures. These two algorithms will be used by the majority of the higher level algorithms. - -Given the basic mp\_int structure an initialization routine must first allocate memory to hold the digits of -the integer. Often it is optimal to allocate a sufficiently large pre-set number of digits even though -the initial integer will represent zero. If only a single digit were allocated quite a few subsequent re-allocations -would occur when operations are performed on the integers. There is a tradeoff between how many default digits to allocate -and how many re-allocations are tolerable. Obviously allocating an excessive amount of digits initially will waste -memory and become unmanageable. - -If the memory for the digits has been successfully allocated then the rest of the members of the structure must -be initialized. Since the initial state of an mp\_int is to represent the zero integer, the allocated digits must be set -to zero. The \textbf{used} count set to zero and \textbf{sign} set to \textbf{MP\_ZPOS}. - -\subsection{Initializing an mp\_int} -An mp\_int is said to be initialized if it is set to a valid, preferably default, state such that all of the members of the -structure are set to valid values. The mp\_init algorithm will perform such an action. - -\index{mp\_init} -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Allocate memory and initialize $a$ to a known valid mp\_int state. \\ -\hline \\ -1. Allocate memory for \textbf{MP\_PREC} digits. \\ -2. If the allocation failed return(\textit{MP\_MEM}) \\ -3. for $n$ from $0$ to $MP\_PREC - 1$ do \\ -\hspace{3mm}3.1 $a_n \leftarrow 0$\\ -4. $a.sign \leftarrow MP\_ZPOS$\\ -5. $a.used \leftarrow 0$\\ -6. $a.alloc \leftarrow MP\_PREC$\\ -7. Return(\textit{MP\_OKAY})\\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_init} -\end{figure} - -\textbf{Algorithm mp\_init.} -The purpose of this function is to initialize an mp\_int structure so that the rest of the library can properly -manipulte it. It is assumed that the input may not have had any of its members previously initialized which is certainly -a valid assumption if the input resides on the stack. - -Before any of the members such as \textbf{sign}, \textbf{used} or \textbf{alloc} are initialized the memory for -the digits is allocated. If this fails the function returns before setting any of the other members. The \textbf{MP\_PREC} -name represents a constant\footnote{Defined in the ``tommath.h'' header file within LibTomMath.} -used to dictate the minimum precision of newly initialized mp\_int integers. Ideally, it is at least equal to the smallest -precision number you'll be working with. - -Allocating a block of digits at first instead of a single digit has the benefit of lowering the number of usually slow -heap operations later functions will have to perform in the future. If \textbf{MP\_PREC} is set correctly the slack -memory and the number of heap operations will be trivial. - -Once the allocation has been made the digits have to be set to zero as well as the \textbf{used}, \textbf{sign} and -\textbf{alloc} members initialized. This ensures that the mp\_int will always represent the default state of zero regardless -of the original condition of the input. - -\textbf{Remark.} -This function introduces the idiosyncrasy that all iterative loops, commonly initiated with the ``for'' keyword, iterate incrementally -when the ``to'' keyword is placed between two expressions. For example, ``for $a$ from $b$ to $c$ do'' means that -a subsequent expression (or body of expressions) are to be evaluated upto $c - b$ times so long as $b \le c$. In each -iteration the variable $a$ is substituted for a new integer that lies inclusively between $b$ and $c$. If $b > c$ occured -the loop would not iterate. By contrast if the ``downto'' keyword were used in place of ``to'' the loop would iterate -decrementally. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_init.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* init a new mp_int */ -018 int mp_init (mp_int * a) -019 \{ -020 int i; -021 -022 /* allocate memory required and clear it */ -023 a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * MP_PREC); -024 if (a->dp == NULL) \{ -025 return MP_MEM; -026 \} -027 -028 /* set the digits to zero */ -029 for (i = 0; i < MP_PREC; i++) \{ -030 a->dp[i] = 0; -031 \} -032 -033 /* set the used to zero, allocated digits to the default precision -034 * and sign to positive */ -035 a->used = 0; -036 a->alloc = MP_PREC; -037 a->sign = MP_ZPOS; -038 -039 return MP_OKAY; -040 \} -041 #endif -042 -\end{alltt} -\end{small} - -One immediate observation of this initializtion function is that it does not return a pointer to a mp\_int structure. It -is assumed that the caller has already allocated memory for the mp\_int structure, typically on the application stack. The -call to mp\_init() is used only to initialize the members of the structure to a known default state. - -Here we see (line 23) the memory allocation is performed first. This allows us to exit cleanly and quickly -if there is an error. If the allocation fails the routine will return \textbf{MP\_MEM} to the caller to indicate there -was a memory error. The function XMALLOC is what actually allocates the memory. Technically XMALLOC is not a function -but a macro defined in ``tommath.h``. By default, XMALLOC will evaluate to malloc() which is the C library's built--in -memory allocation routine. - -In order to assure the mp\_int is in a known state the digits must be set to zero. On most platforms this could have been -accomplished by using calloc() instead of malloc(). However, to correctly initialize a integer type to a given value in a -portable fashion you have to actually assign the value. The for loop (line 29) performs this required -operation. - -After the memory has been successfully initialized the remainder of the members are initialized -(lines 33 through 34) to their respective default states. At this point the algorithm has succeeded and -a success code is returned to the calling function. If this function returns \textbf{MP\_OKAY} it is safe to assume the -mp\_int structure has been properly initialized and is safe to use with other functions within the library. - -\subsection{Clearing an mp\_int} -When an mp\_int is no longer required by the application, the memory that has been allocated for its digits must be -returned to the application's memory pool with the mp\_clear algorithm. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_clear}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. The memory for $a$ shall be deallocated. \\ -\hline \\ -1. If $a$ has been previously freed then return(\textit{MP\_OKAY}). \\ -2. for $n$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}2.1 $a_n \leftarrow 0$ \\ -3. Free the memory allocated for the digits of $a$. \\ -4. $a.used \leftarrow 0$ \\ -5. $a.alloc \leftarrow 0$ \\ -6. $a.sign \leftarrow MP\_ZPOS$ \\ -7. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_clear} -\end{figure} - -\textbf{Algorithm mp\_clear.} -This algorithm accomplishes two goals. First, it clears the digits and the other mp\_int members. This ensures that -if a developer accidentally re-uses a cleared structure it is less likely to cause problems. The second goal -is to free the allocated memory. - -The logic behind the algorithm is extended by marking cleared mp\_int structures so that subsequent calls to this -algorithm will not try to free the memory multiple times. Cleared mp\_ints are detectable by having a pre-defined invalid -digit pointer \textbf{dp} setting. - -Once an mp\_int has been cleared the mp\_int structure is no longer in a valid state for any other algorithm -with the exception of algorithms mp\_init, mp\_init\_copy, mp\_init\_size and mp\_clear. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_clear.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* clear one (frees) */ -018 void -019 mp_clear (mp_int * a) -020 \{ -021 int i; -022 -023 /* only do anything if a hasn't been freed previously */ -024 if (a->dp != NULL) \{ -025 /* first zero the digits */ -026 for (i = 0; i < a->used; i++) \{ -027 a->dp[i] = 0; -028 \} -029 -030 /* free ram */ -031 XFREE(a->dp); -032 -033 /* reset members to make debugging easier */ -034 a->dp = NULL; -035 a->alloc = a->used = 0; -036 a->sign = MP_ZPOS; -037 \} -038 \} -039 #endif -040 -\end{alltt} -\end{small} - -The algorithm only operates on the mp\_int if it hasn't been previously cleared. The if statement (line 24) -checks to see if the \textbf{dp} member is not \textbf{NULL}. If the mp\_int is a valid mp\_int then \textbf{dp} cannot be -\textbf{NULL} in which case the if statement will evaluate to true. - -The digits of the mp\_int are cleared by the for loop (line 26) which assigns a zero to every digit. Similar to mp\_init() -the digits are assigned zero instead of using block memory operations (such as memset()) since this is more portable. - -The digits are deallocated off the heap via the XFREE macro. Similar to XMALLOC the XFREE macro actually evaluates to -a standard C library function. In this case the free() function. Since free() only deallocates the memory the pointer -still has to be reset to \textbf{NULL} manually (line 34). - -Now that the digits have been cleared and deallocated the other members are set to their final values (lines 35 and 36). - -\section{Maintenance Algorithms} - -The previous sections describes how to initialize and clear an mp\_int structure. To further support operations -that are to be performed on mp\_int structures (such as addition and multiplication) the dependent algorithms must be -able to augment the precision of an mp\_int and -initialize mp\_ints with differing initial conditions. - -These algorithms complete the set of low level algorithms required to work with mp\_int structures in the higher level -algorithms such as addition, multiplication and modular exponentiation. - -\subsection{Augmenting an mp\_int's Precision} -When storing a value in an mp\_int structure, a sufficient number of digits must be available to accomodate the entire -result of an operation without loss of precision. Quite often the size of the array given by the \textbf{alloc} member -is large enough to simply increase the \textbf{used} digit count. However, when the size of the array is too small it -must be re-sized appropriately to accomodate the result. The mp\_grow algorithm will provide this functionality. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_grow}. \\ -\textbf{Input}. An mp\_int $a$ and an integer $b$. \\ -\textbf{Output}. $a$ is expanded to accomodate $b$ digits. \\ -\hline \\ -1. if $a.alloc \ge b$ then return(\textit{MP\_OKAY}) \\ -2. $u \leftarrow b\mbox{ (mod }MP\_PREC\mbox{)}$ \\ -3. $v \leftarrow b + 2 \cdot MP\_PREC - u$ \\ -4. Re-allocate the array of digits $a$ to size $v$ \\ -5. If the allocation failed then return(\textit{MP\_MEM}). \\ -6. for n from a.alloc to $v - 1$ do \\ -\hspace{+3mm}6.1 $a_n \leftarrow 0$ \\ -7. $a.alloc \leftarrow v$ \\ -8. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_grow} -\end{figure} - -\textbf{Algorithm mp\_grow.} -It is ideal to prevent re-allocations from being performed if they are not required (step one). This is useful to -prevent mp\_ints from growing excessively in code that erroneously calls mp\_grow. - -The requested digit count is padded up to next multiple of \textbf{MP\_PREC} plus an additional \textbf{MP\_PREC} (steps two and three). -This helps prevent many trivial reallocations that would grow an mp\_int by trivially small values. - -It is assumed that the reallocation (step four) leaves the lower $a.alloc$ digits of the mp\_int intact. This is much -akin to how the \textit{realloc} function from the standard C library works. Since the newly allocated digits are -assumed to contain undefined values they are initially set to zero. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_grow.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* grow as required */ -018 int mp_grow (mp_int * a, int size) -019 \{ -020 int i; -021 mp_digit *tmp; -022 -023 /* if the alloc size is smaller alloc more ram */ -024 if (a->alloc < size) \{ -025 /* ensure there are always at least MP_PREC digits extra on top */ -026 size += (MP_PREC * 2) - (size % MP_PREC); -027 -028 /* reallocate the array a->dp -029 * -030 * We store the return in a temporary variable -031 * in case the operation failed we don't want -032 * to overwrite the dp member of a. -033 */ -034 tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * size); -035 if (tmp == NULL) \{ -036 /* reallocation failed but "a" is still valid [can be freed] */ -037 return MP_MEM; -038 \} -039 -040 /* reallocation succeeded so set a->dp */ -041 a->dp = tmp; -042 -043 /* zero excess digits */ -044 i = a->alloc; -045 a->alloc = size; -046 for (; i < a->alloc; i++) \{ -047 a->dp[i] = 0; -048 \} -049 \} -050 return MP_OKAY; -051 \} -052 #endif -053 -\end{alltt} -\end{small} - -A quick optimization is to first determine if a memory re-allocation is required at all. The if statement (line 24) checks -if the \textbf{alloc} member of the mp\_int is smaller than the requested digit count. If the count is not larger than \textbf{alloc} -the function skips the re-allocation part thus saving time. - -When a re-allocation is performed it is turned into an optimal request to save time in the future. The requested digit count is -padded upwards to 2nd multiple of \textbf{MP\_PREC} larger than \textbf{alloc} (line 26). The XREALLOC function is used -to re-allocate the memory. As per the other functions XREALLOC is actually a macro which evaluates to realloc by default. The realloc -function leaves the base of the allocation intact which means the first \textbf{alloc} digits of the mp\_int are the same as before -the re-allocation. All that is left is to clear the newly allocated digits and return. - -Note that the re-allocation result is actually stored in a temporary pointer $tmp$. This is to allow this function to return -an error with a valid pointer. Earlier releases of the library stored the result of XREALLOC into the mp\_int $a$. That would -result in a memory leak if XREALLOC ever failed. - -\subsection{Initializing Variable Precision mp\_ints} -Occasionally the number of digits required will be known in advance of an initialization, based on, for example, the size -of input mp\_ints to a given algorithm. The purpose of algorithm mp\_init\_size is similar to mp\_init except that it -will allocate \textit{at least} a specified number of digits. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init\_size}. \\ -\textbf{Input}. An mp\_int $a$ and the requested number of digits $b$. \\ -\textbf{Output}. $a$ is initialized to hold at least $b$ digits. \\ -\hline \\ -1. $u \leftarrow b \mbox{ (mod }MP\_PREC\mbox{)}$ \\ -2. $v \leftarrow b + 2 \cdot MP\_PREC - u$ \\ -3. Allocate $v$ digits. \\ -4. for $n$ from $0$ to $v - 1$ do \\ -\hspace{3mm}4.1 $a_n \leftarrow 0$ \\ -5. $a.sign \leftarrow MP\_ZPOS$\\ -6. $a.used \leftarrow 0$\\ -7. $a.alloc \leftarrow v$\\ -8. Return(\textit{MP\_OKAY})\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_init\_size} -\end{figure} - -\textbf{Algorithm mp\_init\_size.} -This algorithm will initialize an mp\_int structure $a$ like algorithm mp\_init with the exception that the number of -digits allocated can be controlled by the second input argument $b$. The input size is padded upwards so it is a -multiple of \textbf{MP\_PREC} plus an additional \textbf{MP\_PREC} digits. This padding is used to prevent trivial -allocations from becoming a bottleneck in the rest of the algorithms. - -Like algorithm mp\_init, the mp\_int structure is initialized to a default state representing the integer zero. This -particular algorithm is useful if it is known ahead of time the approximate size of the input. If the approximation is -correct no further memory re-allocations are required to work with the mp\_int. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_init\_size.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* init an mp_init for a given size */ -018 int mp_init_size (mp_int * a, int size) -019 \{ -020 int x; -021 -022 /* pad size so there are always extra digits */ -023 size += (MP_PREC * 2) - (size % MP_PREC); -024 -025 /* alloc mem */ -026 a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * size); -027 if (a->dp == NULL) \{ -028 return MP_MEM; -029 \} -030 -031 /* set the members */ -032 a->used = 0; -033 a->alloc = size; -034 a->sign = MP_ZPOS; -035 -036 /* zero the digits */ -037 for (x = 0; x < size; x++) \{ -038 a->dp[x] = 0; -039 \} -040 -041 return MP_OKAY; -042 \} -043 #endif -044 -\end{alltt} -\end{small} - -The number of digits $b$ requested is padded (line 23) by first augmenting it to the next multiple of -\textbf{MP\_PREC} and then adding \textbf{MP\_PREC} to the result. If the memory can be successfully allocated the -mp\_int is placed in a default state representing the integer zero. Otherwise, the error code \textbf{MP\_MEM} will be -returned (line 28). - -The digits are allocated with the malloc() function (line 26) and set to zero afterwards (line 37). The -\textbf{used} count is set to zero, the \textbf{alloc} count set to the padded digit count and the \textbf{sign} flag set -to \textbf{MP\_ZPOS} to achieve a default valid mp\_int state (lines 32, 33 and 34). If the function -returns succesfully then it is correct to assume that the mp\_int structure is in a valid state for the remainder of the -functions to work with. - -\subsection{Multiple Integer Initializations and Clearings} -Occasionally a function will require a series of mp\_int data types to be made available simultaneously. -The purpose of algorithm mp\_init\_multi is to initialize a variable length array of mp\_int structures in a single -statement. It is essentially a shortcut to multiple initializations. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init\_multi}. \\ -\textbf{Input}. Variable length array $V_k$ of mp\_int variables of length $k$. \\ -\textbf{Output}. The array is initialized such that each mp\_int of $V_k$ is ready to use. \\ -\hline \\ -1. for $n$ from 0 to $k - 1$ do \\ -\hspace{+3mm}1.1. Initialize the mp\_int $V_n$ (\textit{mp\_init}) \\ -\hspace{+3mm}1.2. If initialization failed then do \\ -\hspace{+6mm}1.2.1. for $j$ from $0$ to $n$ do \\ -\hspace{+9mm}1.2.1.1. Free the mp\_int $V_j$ (\textit{mp\_clear}) \\ -\hspace{+6mm}1.2.2. Return(\textit{MP\_MEM}) \\ -2. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_init\_multi} -\end{figure} - -\textbf{Algorithm mp\_init\_multi.} -The algorithm will initialize the array of mp\_int variables one at a time. If a runtime error has been detected -(\textit{step 1.2}) all of the previously initialized variables are cleared. The goal is an ``all or nothing'' -initialization which allows for quick recovery from runtime errors. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_init\_multi.c -\vspace{-3mm} -\begin{alltt} -016 #include -017 -018 int mp_init_multi(mp_int *mp, ...) -019 \{ -020 mp_err res = MP_OKAY; /* Assume ok until proven otherwise */ -021 int n = 0; /* Number of ok inits */ -022 mp_int* cur_arg = mp; -023 va_list args; -024 -025 va_start(args, mp); /* init args to next argument from caller */ -026 while (cur_arg != NULL) \{ -027 if (mp_init(cur_arg) != MP_OKAY) \{ -028 /* Oops - error! Back-track and mp_clear what we already -029 succeeded in init-ing, then return error. -030 */ -031 va_list clean_args; -032 -033 /* end the current list */ -034 va_end(args); -035 -036 /* now start cleaning up */ -037 cur_arg = mp; -038 va_start(clean_args, mp); -039 while (n-- != 0) \{ -040 mp_clear(cur_arg); -041 cur_arg = va_arg(clean_args, mp_int*); -042 \} -043 va_end(clean_args); -044 res = MP_MEM; -045 break; -046 \} -047 n++; -048 cur_arg = va_arg(args, mp_int*); -049 \} -050 va_end(args); -051 return res; /* Assumed ok, if error flagged above. */ -052 \} -053 -054 #endif -055 -\end{alltt} -\end{small} - -This function intializes a variable length list of mp\_int structure pointers. However, instead of having the mp\_int -structures in an actual C array they are simply passed as arguments to the function. This function makes use of the -``...'' argument syntax of the C programming language. The list is terminated with a final \textbf{NULL} argument -appended on the right. - -The function uses the ``stdarg.h'' \textit{va} functions to step portably through the arguments to the function. A count -$n$ of succesfully initialized mp\_int structures is maintained (line 47) such that if a failure does occur, -the algorithm can backtrack and free the previously initialized structures (lines 27 to 46). - - -\subsection{Clamping Excess Digits} -When a function anticipates a result will be $n$ digits it is simpler to assume this is true within the body of -the function instead of checking during the computation. For example, a multiplication of a $i$ digit number by a -$j$ digit produces a result of at most $i + j$ digits. It is entirely possible that the result is $i + j - 1$ -though, with no final carry into the last position. However, suppose the destination had to be first expanded -(\textit{via mp\_grow}) to accomodate $i + j - 1$ digits than further expanded to accomodate the final carry. -That would be a considerable waste of time since heap operations are relatively slow. - -The ideal solution is to always assume the result is $i + j$ and fix up the \textbf{used} count after the function -terminates. This way a single heap operation (\textit{at most}) is required. However, if the result was not checked -there would be an excess high order zero digit. - -For example, suppose the product of two integers was $x_n = (0x_{n-1}x_{n-2}...x_0)_{\beta}$. The leading zero digit -will not contribute to the precision of the result. In fact, through subsequent operations more leading zero digits would -accumulate to the point the size of the integer would be prohibitive. As a result even though the precision is very -low the representation is excessively large. - -The mp\_clamp algorithm is designed to solve this very problem. It will trim high-order zeros by decrementing the -\textbf{used} count until a non-zero most significant digit is found. Also in this system, zero is considered to be a -positive number which means that if the \textbf{used} count is decremented to zero, the sign must be set to -\textbf{MP\_ZPOS}. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_clamp}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Any excess leading zero digits of $a$ are removed \\ -\hline \\ -1. while $a.used > 0$ and $a_{a.used - 1} = 0$ do \\ -\hspace{+3mm}1.1 $a.used \leftarrow a.used - 1$ \\ -2. if $a.used = 0$ then do \\ -\hspace{+3mm}2.1 $a.sign \leftarrow MP\_ZPOS$ \\ -\hline \\ -\end{tabular} -\end{center} -\caption{Algorithm mp\_clamp} -\end{figure} - -\textbf{Algorithm mp\_clamp.} -As can be expected this algorithm is very simple. The loop on step one is expected to iterate only once or twice at -the most. For example, this will happen in cases where there is not a carry to fill the last position. Step two fixes the sign for -when all of the digits are zero to ensure that the mp\_int is valid at all times. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_clamp.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* trim unused digits -018 * -019 * This is used to ensure that leading zero digits are -020 * trimed and the leading "used" digit will be non-zero -021 * Typically very fast. Also fixes the sign if there -022 * are no more leading digits -023 */ -024 void -025 mp_clamp (mp_int * a) -026 \{ -027 /* decrease used while the most significant digit is -028 * zero. -029 */ -030 while ((a->used > 0) && (a->dp[a->used - 1] == 0)) \{ -031 --(a->used); -032 \} -033 -034 /* reset the sign flag if used == 0 */ -035 if (a->used == 0) \{ -036 a->sign = MP_ZPOS; -037 \} -038 \} -039 #endif -040 -\end{alltt} -\end{small} - -Note on line 27 how to test for the \textbf{used} count is made on the left of the \&\& operator. In the C programming -language the terms to \&\& are evaluated left to right with a boolean short-circuit if any condition fails. This is -important since if the \textbf{used} is zero the test on the right would fetch below the array. That is obviously -undesirable. The parenthesis on line 30 is used to make sure the \textbf{used} count is decremented and not -the pointer ``a''. - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 1 \right ]$ & Discuss the relevance of the \textbf{used} member of the mp\_int structure. \\ - & \\ -$\left [ 1 \right ]$ & Discuss the consequences of not using padding when performing allocations. \\ - & \\ -$\left [ 2 \right ]$ & Estimate an ideal value for \textbf{MP\_PREC} when performing 1024-bit RSA \\ - & encryption when $\beta = 2^{28}$. \\ - & \\ -$\left [ 1 \right ]$ & Discuss the relevance of the algorithm mp\_clamp. What does it prevent? \\ - & \\ -$\left [ 1 \right ]$ & Give an example of when the algorithm mp\_init\_copy might be useful. \\ - & \\ -\end{tabular} - - -%%% -% CHAPTER FOUR -%%% - -\chapter{Basic Operations} - -\section{Introduction} -In the previous chapter a series of low level algorithms were established that dealt with initializing and maintaining -mp\_int structures. This chapter will discuss another set of seemingly non-algebraic algorithms which will form the low -level basis of the entire library. While these algorithm are relatively trivial it is important to understand how they -work before proceeding since these algorithms will be used almost intrinsically in the following chapters. - -The algorithms in this chapter deal primarily with more ``programmer'' related tasks such as creating copies of -mp\_int structures, assigning small values to mp\_int structures and comparisons of the values mp\_int structures -represent. - -\section{Assigning Values to mp\_int Structures} -\subsection{Copying an mp\_int} -Assigning the value that a given mp\_int structure represents to another mp\_int structure shall be known as making -a copy for the purposes of this text. The copy of the mp\_int will be a separate entity that represents the same -value as the mp\_int it was copied from. The mp\_copy algorithm provides this functionality. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_copy}. \\ -\textbf{Input}. An mp\_int $a$ and $b$. \\ -\textbf{Output}. Store a copy of $a$ in $b$. \\ -\hline \\ -1. If $b.alloc < a.used$ then grow $b$ to $a.used$ digits. (\textit{mp\_grow}) \\ -2. for $n$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}2.1 $b_{n} \leftarrow a_{n}$ \\ -3. for $n$ from $a.used$ to $b.used - 1$ do \\ -\hspace{3mm}3.1 $b_{n} \leftarrow 0$ \\ -4. $b.used \leftarrow a.used$ \\ -5. $b.sign \leftarrow a.sign$ \\ -6. return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_copy} -\end{figure} - -\textbf{Algorithm mp\_copy.} -This algorithm copies the mp\_int $a$ such that upon succesful termination of the algorithm the mp\_int $b$ will -represent the same integer as the mp\_int $a$. The mp\_int $b$ shall be a complete and distinct copy of the -mp\_int $a$ meaing that the mp\_int $a$ can be modified and it shall not affect the value of the mp\_int $b$. - -If $b$ does not have enough room for the digits of $a$ it must first have its precision augmented via the mp\_grow -algorithm. The digits of $a$ are copied over the digits of $b$ and any excess digits of $b$ are set to zero (step two -and three). The \textbf{used} and \textbf{sign} members of $a$ are finally copied over the respective members of -$b$. - -\textbf{Remark.} This algorithm also introduces a new idiosyncrasy that will be used throughout the rest of the -text. The error return codes of other algorithms are not explicitly checked in the pseudo-code presented. For example, in -step one of the mp\_copy algorithm the return of mp\_grow is not explicitly checked to ensure it succeeded. Text space is -limited so it is assumed that if a algorithm fails it will clear all temporarily allocated mp\_ints and return -the error code itself. However, the C code presented will demonstrate all of the error handling logic required to -implement the pseudo-code. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_copy.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* copy, b = a */ -018 int -019 mp_copy (mp_int * a, mp_int * b) -020 \{ -021 int res, n; -022 -023 /* if dst == src do nothing */ -024 if (a == b) \{ -025 return MP_OKAY; -026 \} -027 -028 /* grow dest */ -029 if (b->alloc < a->used) \{ -030 if ((res = mp_grow (b, a->used)) != MP_OKAY) \{ -031 return res; -032 \} -033 \} -034 -035 /* zero b and copy the parameters over */ -036 \{ -037 mp_digit *tmpa, *tmpb; -038 -039 /* pointer aliases */ -040 -041 /* source */ -042 tmpa = a->dp; -043 -044 /* destination */ -045 tmpb = b->dp; -046 -047 /* copy all the digits */ -048 for (n = 0; n < a->used; n++) \{ -049 *tmpb++ = *tmpa++; -050 \} -051 -052 /* clear high digits */ -053 for (; n < b->used; n++) \{ -054 *tmpb++ = 0; -055 \} -056 \} -057 -058 /* copy used count and sign */ -059 b->used = a->used; -060 b->sign = a->sign; -061 return MP_OKAY; -062 \} -063 #endif -064 -\end{alltt} -\end{small} - -Occasionally a dependent algorithm may copy an mp\_int effectively into itself such as when the input and output -mp\_int structures passed to a function are one and the same. For this case it is optimal to return immediately without -copying digits (line 24). - -The mp\_int $b$ must have enough digits to accomodate the used digits of the mp\_int $a$. If $b.alloc$ is less than -$a.used$ the algorithm mp\_grow is used to augment the precision of $b$ (lines 29 to 33). In order to -simplify the inner loop that copies the digits from $a$ to $b$, two aliases $tmpa$ and $tmpb$ point directly at the digits -of the mp\_ints $a$ and $b$ respectively. These aliases (lines 42 and 45) allow the compiler to access the digits without first dereferencing the -mp\_int pointers and then subsequently the pointer to the digits. - -After the aliases are established the digits from $a$ are copied into $b$ (lines 48 to 50) and then the excess -digits of $b$ are set to zero (lines 53 to 55). Both ``for'' loops make use of the pointer aliases and in -fact the alias for $b$ is carried through into the second ``for'' loop to clear the excess digits. This optimization -allows the alias to stay in a machine register fairly easy between the two loops. - -\textbf{Remarks.} The use of pointer aliases is an implementation methodology first introduced in this function that will -be used considerably in other functions. Technically, a pointer alias is simply a short hand alias used to lower the -number of pointer dereferencing operations required to access data. For example, a for loop may resemble - -\begin{alltt} -for (x = 0; x < 100; x++) \{ - a->num[4]->dp[x] = 0; -\} -\end{alltt} - -This could be re-written using aliases as - -\begin{alltt} -mp_digit *tmpa; -a = a->num[4]->dp; -for (x = 0; x < 100; x++) \{ - *a++ = 0; -\} -\end{alltt} - -In this case an alias is used to access the -array of digits within an mp\_int structure directly. It may seem that a pointer alias is strictly not required -as a compiler may optimize out the redundant pointer operations. However, there are two dominant reasons to use aliases. - -The first reason is that most compilers will not effectively optimize pointer arithmetic. For example, some optimizations -may work for the Microsoft Visual C++ compiler (MSVC) and not for the GNU C Compiler (GCC). Also some optimizations may -work for GCC and not MSVC. As such it is ideal to find a common ground for as many compilers as possible. Pointer -aliases optimize the code considerably before the compiler even reads the source code which means the end compiled code -stands a better chance of being faster. - -The second reason is that pointer aliases often can make an algorithm simpler to read. Consider the first ``for'' -loop of the function mp\_copy() re-written to not use pointer aliases. - -\begin{alltt} - /* copy all the digits */ - for (n = 0; n < a->used; n++) \{ - b->dp[n] = a->dp[n]; - \} -\end{alltt} - -Whether this code is harder to read depends strongly on the individual. However, it is quantifiably slightly more -complicated as there are four variables within the statement instead of just two. - -\subsubsection{Nested Statements} -Another commonly used technique in the source routines is that certain sections of code are nested. This is used in -particular with the pointer aliases to highlight code phases. For example, a Comba multiplier (discussed in chapter six) -will typically have three different phases. First the temporaries are initialized, then the columns calculated and -finally the carries are propagated. In this example the middle column production phase will typically be nested as it -uses temporary variables and aliases the most. - -The nesting also simplies the source code as variables that are nested are only valid for their scope. As a result -the various temporary variables required do not propagate into other sections of code. - - -\subsection{Creating a Clone} -Another common operation is to make a local temporary copy of an mp\_int argument. To initialize an mp\_int -and then copy another existing mp\_int into the newly intialized mp\_int will be known as creating a clone. This is -useful within functions that need to modify an argument but do not wish to actually modify the original copy. The -mp\_init\_copy algorithm has been designed to help perform this task. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_init\_copy}. \\ -\textbf{Input}. An mp\_int $a$ and $b$\\ -\textbf{Output}. $a$ is initialized to be a copy of $b$. \\ -\hline \\ -1. Init $a$. (\textit{mp\_init}) \\ -2. Copy $b$ to $a$. (\textit{mp\_copy}) \\ -3. Return the status of the copy operation. \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_init\_copy} -\end{figure} - -\textbf{Algorithm mp\_init\_copy.} -This algorithm will initialize an mp\_int variable and copy another previously initialized mp\_int variable into it. As -such this algorithm will perform two operations in one step. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_init\_copy.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* creates "a" then copies b into it */ -018 int mp_init_copy (mp_int * a, mp_int * b) -019 \{ -020 int res; -021 -022 if ((res = mp_init_size (a, b->used)) != MP_OKAY) \{ -023 return res; -024 \} -025 return mp_copy (b, a); -026 \} -027 #endif -028 -\end{alltt} -\end{small} - -This will initialize \textbf{a} and make it a verbatim copy of the contents of \textbf{b}. Note that -\textbf{a} will have its own memory allocated which means that \textbf{b} may be cleared after the call -and \textbf{a} will be left intact. - -\section{Zeroing an Integer} -Reseting an mp\_int to the default state is a common step in many algorithms. The mp\_zero algorithm will be the algorithm used to -perform this task. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_zero}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Zero the contents of $a$ \\ -\hline \\ -1. $a.used \leftarrow 0$ \\ -2. $a.sign \leftarrow$ MP\_ZPOS \\ -3. for $n$ from 0 to $a.alloc - 1$ do \\ -\hspace{3mm}3.1 $a_n \leftarrow 0$ \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_zero} -\end{figure} - -\textbf{Algorithm mp\_zero.} -This algorithm simply resets a mp\_int to the default state. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_zero.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* set to zero */ -018 void mp_zero (mp_int * a) -019 \{ -020 int n; -021 mp_digit *tmp; -022 -023 a->sign = MP_ZPOS; -024 a->used = 0; -025 -026 tmp = a->dp; -027 for (n = 0; n < a->alloc; n++) \{ -028 *tmp++ = 0; -029 \} -030 \} -031 #endif -032 -\end{alltt} -\end{small} - -After the function is completed, all of the digits are zeroed, the \textbf{used} count is zeroed and the -\textbf{sign} variable is set to \textbf{MP\_ZPOS}. - -\section{Sign Manipulation} -\subsection{Absolute Value} -With the mp\_int representation of an integer, calculating the absolute value is trivial. The mp\_abs algorithm will compute -the absolute value of an mp\_int. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_abs}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Computes $b = \vert a \vert$ \\ -\hline \\ -1. Copy $a$ to $b$. (\textit{mp\_copy}) \\ -2. If the copy failed return(\textit{MP\_MEM}). \\ -3. $b.sign \leftarrow MP\_ZPOS$ \\ -4. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_abs} -\end{figure} - -\textbf{Algorithm mp\_abs.} -This algorithm computes the absolute of an mp\_int input. First it copies $a$ over $b$. This is an example of an -algorithm where the check in mp\_copy that determines if the source and destination are equal proves useful. This allows, -for instance, the developer to pass the same mp\_int as the source and destination to this function without addition -logic to handle it. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_abs.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* b = |a| -018 * -019 * Simple function copies the input and fixes the sign to positive -020 */ -021 int -022 mp_abs (mp_int * a, mp_int * b) -023 \{ -024 int res; -025 -026 /* copy a to b */ -027 if (a != b) \{ -028 if ((res = mp_copy (a, b)) != MP_OKAY) \{ -029 return res; -030 \} -031 \} -032 -033 /* force the sign of b to positive */ -034 b->sign = MP_ZPOS; -035 -036 return MP_OKAY; -037 \} -038 #endif -039 -\end{alltt} -\end{small} - -This fairly trivial algorithm first eliminates non--required duplications (line 27) and then sets the -\textbf{sign} flag to \textbf{MP\_ZPOS}. - -\subsection{Integer Negation} -With the mp\_int representation of an integer, calculating the negation is also trivial. The mp\_neg algorithm will compute -the negative of an mp\_int input. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_neg}. \\ -\textbf{Input}. An mp\_int $a$ \\ -\textbf{Output}. Computes $b = -a$ \\ -\hline \\ -1. Copy $a$ to $b$. (\textit{mp\_copy}) \\ -2. If the copy failed return(\textit{MP\_MEM}). \\ -3. If $a.used = 0$ then return(\textit{MP\_OKAY}). \\ -4. If $a.sign = MP\_ZPOS$ then do \\ -\hspace{3mm}4.1 $b.sign = MP\_NEG$. \\ -5. else do \\ -\hspace{3mm}5.1 $b.sign = MP\_ZPOS$. \\ -6. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_neg} -\end{figure} - -\textbf{Algorithm mp\_neg.} -This algorithm computes the negation of an input. First it copies $a$ over $b$. If $a$ has no used digits then -the algorithm returns immediately. Otherwise it flips the sign flag and stores the result in $b$. Note that if -$a$ had no digits then it must be positive by definition. Had step three been omitted then the algorithm would return -zero as negative. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_neg.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* b = -a */ -018 int mp_neg (mp_int * a, mp_int * b) -019 \{ -020 int res; -021 if (a != b) \{ -022 if ((res = mp_copy (a, b)) != MP_OKAY) \{ -023 return res; -024 \} -025 \} -026 -027 if (mp_iszero(b) != MP_YES) \{ -028 b->sign = (a->sign == MP_ZPOS) ? MP_NEG : MP_ZPOS; -029 \} else \{ -030 b->sign = MP_ZPOS; -031 \} -032 -033 return MP_OKAY; -034 \} -035 #endif -036 -\end{alltt} -\end{small} - -Like mp\_abs() this function avoids non--required duplications (line 21) and then sets the sign. We -have to make sure that only non--zero values get a \textbf{sign} of \textbf{MP\_NEG}. If the mp\_int is zero -than the \textbf{sign} is hard--coded to \textbf{MP\_ZPOS}. - -\section{Small Constants} -\subsection{Setting Small Constants} -Often a mp\_int must be set to a relatively small value such as $1$ or $2$. For these cases the mp\_set algorithm is useful. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_set}. \\ -\textbf{Input}. An mp\_int $a$ and a digit $b$ \\ -\textbf{Output}. Make $a$ equivalent to $b$ \\ -\hline \\ -1. Zero $a$ (\textit{mp\_zero}). \\ -2. $a_0 \leftarrow b \mbox{ (mod }\beta\mbox{)}$ \\ -3. $a.used \leftarrow \left \lbrace \begin{array}{ll} - 1 & \mbox{if }a_0 > 0 \\ - 0 & \mbox{if }a_0 = 0 - \end{array} \right .$ \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_set} -\end{figure} - -\textbf{Algorithm mp\_set.} -This algorithm sets a mp\_int to a small single digit value. Step number 1 ensures that the integer is reset to the default state. The -single digit is set (\textit{modulo $\beta$}) and the \textbf{used} count is adjusted accordingly. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_set.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* set to a digit */ -018 void mp_set (mp_int * a, mp_digit b) -019 \{ -020 mp_zero (a); -021 a->dp[0] = b & MP_MASK; -022 a->used = (a->dp[0] != 0) ? 1 : 0; -023 \} -024 #endif -025 -\end{alltt} -\end{small} - -First we zero (line 20) the mp\_int to make sure that the other members are initialized for a -small positive constant. mp\_zero() ensures that the \textbf{sign} is positive and the \textbf{used} count -is zero. Next we set the digit and reduce it modulo $\beta$ (line 21). After this step we have to -check if the resulting digit is zero or not. If it is not then we set the \textbf{used} count to one, otherwise -to zero. - -We can quickly reduce modulo $\beta$ since it is of the form $2^k$ and a quick binary AND operation with -$2^k - 1$ will perform the same operation. - -One important limitation of this function is that it will only set one digit. The size of a digit is not fixed, meaning source that uses -this function should take that into account. Only trivially small constants can be set using this function. - -\subsection{Setting Large Constants} -To overcome the limitations of the mp\_set algorithm the mp\_set\_int algorithm is ideal. It accepts a ``long'' -data type as input and will always treat it as a 32-bit integer. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_set\_int}. \\ -\textbf{Input}. An mp\_int $a$ and a ``long'' integer $b$ \\ -\textbf{Output}. Make $a$ equivalent to $b$ \\ -\hline \\ -1. Zero $a$ (\textit{mp\_zero}) \\ -2. for $n$ from 0 to 7 do \\ -\hspace{3mm}2.1 $a \leftarrow a \cdot 16$ (\textit{mp\_mul2d}) \\ -\hspace{3mm}2.2 $u \leftarrow \lfloor b / 2^{4(7 - n)} \rfloor \mbox{ (mod }16\mbox{)}$\\ -\hspace{3mm}2.3 $a_0 \leftarrow a_0 + u$ \\ -\hspace{3mm}2.4 $a.used \leftarrow a.used + 1$ \\ -3. Clamp excess used digits (\textit{mp\_clamp}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_set\_int} -\end{figure} - -\textbf{Algorithm mp\_set\_int.} -The algorithm performs eight iterations of a simple loop where in each iteration four bits from the source are added to the -mp\_int. Step 2.1 will multiply the current result by sixteen making room for four more bits in the less significant positions. In step 2.2 the -next four bits from the source are extracted and are added to the mp\_int. The \textbf{used} digit count is -incremented to reflect the addition. The \textbf{used} digit counter is incremented since if any of the leading digits were zero the mp\_int would have -zero digits used and the newly added four bits would be ignored. - -Excess zero digits are trimmed in steps 2.1 and 3 by using higher level algorithms mp\_mul2d and mp\_clamp. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_set\_int.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* set a 32-bit const */ -018 int mp_set_int (mp_int * a, unsigned long b) -019 \{ -020 int x, res; -021 -022 mp_zero (a); -023 -024 /* set four bits at a time */ -025 for (x = 0; x < 8; x++) \{ -026 /* shift the number up four bits */ -027 if ((res = mp_mul_2d (a, 4, a)) != MP_OKAY) \{ -028 return res; -029 \} -030 -031 /* OR in the top four bits of the source */ -032 a->dp[0] |= (b >> 28) & 15; -033 -034 /* shift the source up to the next four bits */ -035 b <<= 4; -036 -037 /* ensure that digits are not clamped off */ -038 a->used += 1; -039 \} -040 mp_clamp (a); -041 return MP_OKAY; -042 \} -043 #endif -044 -\end{alltt} -\end{small} - -This function sets four bits of the number at a time to handle all practical \textbf{DIGIT\_BIT} sizes. The weird -addition on line 38 ensures that the newly added in bits are added to the number of digits. While it may not -seem obvious as to why the digit counter does not grow exceedingly large it is because of the shift on line 27 -as well as the call to mp\_clamp() on line 40. Both functions will clamp excess leading digits which keeps -the number of used digits low. - -\section{Comparisons} -\subsection{Unsigned Comparisions} -Comparing a multiple precision integer is performed with the exact same algorithm used to compare two decimal numbers. For example, -to compare $1,234$ to $1,264$ the digits are extracted by their positions. That is we compare $1 \cdot 10^3 + 2 \cdot 10^2 + 3 \cdot 10^1 + 4 \cdot 10^0$ -to $1 \cdot 10^3 + 2 \cdot 10^2 + 6 \cdot 10^1 + 4 \cdot 10^0$ by comparing single digits at a time starting with the highest magnitude -positions. If any leading digit of one integer is greater than a digit in the same position of another integer then obviously it must be greater. - -The first comparision routine that will be developed is the unsigned magnitude compare which will perform a comparison based on the digits of two -mp\_int variables alone. It will ignore the sign of the two inputs. Such a function is useful when an absolute comparison is required or if the -signs are known to agree in advance. - -To facilitate working with the results of the comparison functions three constants are required. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{|r|l|} -\hline \textbf{Constant} & \textbf{Meaning} \\ -\hline \textbf{MP\_GT} & Greater Than \\ -\hline \textbf{MP\_EQ} & Equal To \\ -\hline \textbf{MP\_LT} & Less Than \\ -\hline -\end{tabular} -\end{center} -\caption{Comparison Return Codes} -\end{figure} - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_cmp\_mag}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$. \\ -\textbf{Output}. Unsigned comparison results ($a$ to the left of $b$). \\ -\hline \\ -1. If $a.used > b.used$ then return(\textit{MP\_GT}) \\ -2. If $a.used < b.used$ then return(\textit{MP\_LT}) \\ -3. for n from $a.used - 1$ to 0 do \\ -\hspace{+3mm}3.1 if $a_n > b_n$ then return(\textit{MP\_GT}) \\ -\hspace{+3mm}3.2 if $a_n < b_n$ then return(\textit{MP\_LT}) \\ -4. Return(\textit{MP\_EQ}) \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_cmp\_mag} -\end{figure} - -\textbf{Algorithm mp\_cmp\_mag.} -By saying ``$a$ to the left of $b$'' it is meant that the comparison is with respect to $a$, that is if $a$ is greater than $b$ it will return -\textbf{MP\_GT} and similar with respect to when $a = b$ and $a < b$. The first two steps compare the number of digits used in both $a$ and $b$. -Obviously if the digit counts differ there would be an imaginary zero digit in the smaller number where the leading digit of the larger number is. -If both have the same number of digits than the actual digits themselves must be compared starting at the leading digit. - -By step three both inputs must have the same number of digits so its safe to start from either $a.used - 1$ or $b.used - 1$ and count down to -the zero'th digit. If after all of the digits have been compared, no difference is found, the algorithm returns \textbf{MP\_EQ}. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_cmp\_mag.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* compare maginitude of two ints (unsigned) */ -018 int mp_cmp_mag (mp_int * a, mp_int * b) -019 \{ -020 int n; -021 mp_digit *tmpa, *tmpb; -022 -023 /* compare based on # of non-zero digits */ -024 if (a->used > b->used) \{ -025 return MP_GT; -026 \} -027 -028 if (a->used < b->used) \{ -029 return MP_LT; -030 \} -031 -032 /* alias for a */ -033 tmpa = a->dp + (a->used - 1); -034 -035 /* alias for b */ -036 tmpb = b->dp + (a->used - 1); -037 -038 /* compare based on digits */ -039 for (n = 0; n < a->used; ++n, --tmpa, --tmpb) \{ -040 if (*tmpa > *tmpb) \{ -041 return MP_GT; -042 \} -043 -044 if (*tmpa < *tmpb) \{ -045 return MP_LT; -046 \} -047 \} -048 return MP_EQ; -049 \} -050 #endif -051 -\end{alltt} -\end{small} - -The two if statements (lines 24 and 28) compare the number of digits in the two inputs. These two are -performed before all of the digits are compared since it is a very cheap test to perform and can potentially save -considerable time. The implementation given is also not valid without those two statements. $b.alloc$ may be -smaller than $a.used$, meaning that undefined values will be read from $b$ past the end of the array of digits. - - - -\subsection{Signed Comparisons} -Comparing with sign considerations is also fairly critical in several routines (\textit{division for example}). Based on an unsigned magnitude -comparison a trivial signed comparison algorithm can be written. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_cmp}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. Signed Comparison Results ($a$ to the left of $b$) \\ -\hline \\ -1. if $a.sign = MP\_NEG$ and $b.sign = MP\_ZPOS$ then return(\textit{MP\_LT}) \\ -2. if $a.sign = MP\_ZPOS$ and $b.sign = MP\_NEG$ then return(\textit{MP\_GT}) \\ -3. if $a.sign = MP\_NEG$ then \\ -\hspace{+3mm}3.1 Return the unsigned comparison of $b$ and $a$ (\textit{mp\_cmp\_mag}) \\ -4 Otherwise \\ -\hspace{+3mm}4.1 Return the unsigned comparison of $a$ and $b$ \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_cmp} -\end{figure} - -\textbf{Algorithm mp\_cmp.} -The first two steps compare the signs of the two inputs. If the signs do not agree then it can return right away with the appropriate -comparison code. When the signs are equal the digits of the inputs must be compared to determine the correct result. In step -three the unsigned comparision flips the order of the arguments since they are both negative. For instance, if $-a > -b$ then -$\vert a \vert < \vert b \vert$. Step number four will compare the two when they are both positive. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_cmp.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* compare two ints (signed)*/ -018 int -019 mp_cmp (mp_int * a, mp_int * b) -020 \{ -021 /* compare based on sign */ -022 if (a->sign != b->sign) \{ -023 if (a->sign == MP_NEG) \{ -024 return MP_LT; -025 \} else \{ -026 return MP_GT; -027 \} -028 \} -029 -030 /* compare digits */ -031 if (a->sign == MP_NEG) \{ -032 /* if negative compare opposite direction */ -033 return mp_cmp_mag(b, a); -034 \} else \{ -035 return mp_cmp_mag(a, b); -036 \} -037 \} -038 #endif -039 -\end{alltt} -\end{small} - -The two if statements (lines 22 and 23) perform the initial sign comparison. If the signs are not the equal then which ever -has the positive sign is larger. The inputs are compared (line 31) based on magnitudes. If the signs were both -negative then the unsigned comparison is performed in the opposite direction (line 33). Otherwise, the signs are assumed to -be both positive and a forward direction unsigned comparison is performed. - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 2 \right ]$ & Modify algorithm mp\_set\_int to accept as input a variable length array of bits. \\ - & \\ -$\left [ 3 \right ]$ & Give the probability that algorithm mp\_cmp\_mag will have to compare $k$ digits \\ - & of two random digits (of equal magnitude) before a difference is found. \\ - & \\ -$\left [ 1 \right ]$ & Suggest a simple method to speed up the implementation of mp\_cmp\_mag based \\ - & on the observations made in the previous problem. \\ - & -\end{tabular} - -\chapter{Basic Arithmetic} -\section{Introduction} -At this point algorithms for initialization, clearing, zeroing, copying, comparing and setting small constants have been -established. The next logical set of algorithms to develop are addition, subtraction and digit shifting algorithms. These -algorithms make use of the lower level algorithms and are the cruicial building block for the multiplication algorithms. It is very important -that these algorithms are highly optimized. On their own they are simple $O(n)$ algorithms but they can be called from higher level algorithms -which easily places them at $O(n^2)$ or even $O(n^3)$ work levels. - -All of the algorithms within this chapter make use of the logical bit shift operations denoted by $<<$ and $>>$ for left and right -logical shifts respectively. A logical shift is analogous to sliding the decimal point of radix-10 representations. For example, the real -number $0.9345$ is equivalent to $93.45\%$ which is found by sliding the the decimal two places to the right (\textit{multiplying by $\beta^2 = 10^2$}). -Algebraically a binary logical shift is equivalent to a division or multiplication by a power of two. -For example, $a << k = a \cdot 2^k$ while $a >> k = \lfloor a/2^k \rfloor$. - -One significant difference between a logical shift and the way decimals are shifted is that digits below the zero'th position are removed -from the number. For example, consider $1101_2 >> 1$ using decimal notation this would produce $110.1_2$. However, with a logical shift the -result is $110_2$. - -\section{Addition and Subtraction} -In common twos complement fixed precision arithmetic negative numbers are easily represented by subtraction from the modulus. For example, with 32-bit integers -$a - b\mbox{ (mod }2^{32}\mbox{)}$ is the same as $a + (2^{32} - b) \mbox{ (mod }2^{32}\mbox{)}$ since $2^{32} \equiv 0 \mbox{ (mod }2^{32}\mbox{)}$. -As a result subtraction can be performed with a trivial series of logical operations and an addition. - -However, in multiple precision arithmetic negative numbers are not represented in the same way. Instead a sign flag is used to keep track of the -sign of the integer. As a result signed addition and subtraction are actually implemented as conditional usage of lower level addition or -subtraction algorithms with the sign fixed up appropriately. - -The lower level algorithms will add or subtract integers without regard to the sign flag. That is they will add or subtract the magnitude of -the integers respectively. - -\subsection{Low Level Addition} -An unsigned addition of multiple precision integers is performed with the same long-hand algorithm used to add decimal numbers. That is to add the -trailing digits first and propagate the resulting carry upwards. Since this is a lower level algorithm the name will have a ``s\_'' prefix. -Historically that convention stems from the MPI library where ``s\_'' stood for static functions that were hidden from the developer entirely. - -\newpage -\begin{figure}[!here] -\begin{center} -\begin{small} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_add}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. The unsigned addition $c = \vert a \vert + \vert b \vert$. \\ -\hline \\ -1. if $a.used > b.used$ then \\ -\hspace{+3mm}1.1 $min \leftarrow b.used$ \\ -\hspace{+3mm}1.2 $max \leftarrow a.used$ \\ -\hspace{+3mm}1.3 $x \leftarrow a$ \\ -2. else \\ -\hspace{+3mm}2.1 $min \leftarrow a.used$ \\ -\hspace{+3mm}2.2 $max \leftarrow b.used$ \\ -\hspace{+3mm}2.3 $x \leftarrow b$ \\ -3. If $c.alloc < max + 1$ then grow $c$ to hold at least $max + 1$ digits (\textit{mp\_grow}) \\ -4. $oldused \leftarrow c.used$ \\ -5. $c.used \leftarrow max + 1$ \\ -6. $u \leftarrow 0$ \\ -7. for $n$ from $0$ to $min - 1$ do \\ -\hspace{+3mm}7.1 $c_n \leftarrow a_n + b_n + u$ \\ -\hspace{+3mm}7.2 $u \leftarrow c_n >> lg(\beta)$ \\ -\hspace{+3mm}7.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -8. if $min \ne max$ then do \\ -\hspace{+3mm}8.1 for $n$ from $min$ to $max - 1$ do \\ -\hspace{+6mm}8.1.1 $c_n \leftarrow x_n + u$ \\ -\hspace{+6mm}8.1.2 $u \leftarrow c_n >> lg(\beta)$ \\ -\hspace{+6mm}8.1.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -9. $c_{max} \leftarrow u$ \\ -10. if $olduse > max$ then \\ -\hspace{+3mm}10.1 for $n$ from $max + 1$ to $oldused - 1$ do \\ -\hspace{+6mm}10.1.1 $c_n \leftarrow 0$ \\ -11. Clamp excess digits in $c$. (\textit{mp\_clamp}) \\ -12. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Algorithm s\_mp\_add} -\end{figure} - -\textbf{Algorithm s\_mp\_add.} -This algorithm is loosely based on algorithm 14.7 of HAC \cite[pp. 594]{HAC} but has been extended to allow the inputs to have different magnitudes. -Coincidentally the description of algorithm A in Knuth \cite[pp. 266]{TAOCPV2} shares the same deficiency as the algorithm from \cite{HAC}. Even the -MIX pseudo machine code presented by Knuth \cite[pp. 266-267]{TAOCPV2} is incapable of handling inputs which are of different magnitudes. - -The first thing that has to be accomplished is to sort out which of the two inputs is the largest. The addition logic -will simply add all of the smallest input to the largest input and store that first part of the result in the -destination. Then it will apply a simpler addition loop to excess digits of the larger input. - -The first two steps will handle sorting the inputs such that $min$ and $max$ hold the digit counts of the two -inputs. The variable $x$ will be an mp\_int alias for the largest input or the second input $b$ if they have the -same number of digits. After the inputs are sorted the destination $c$ is grown as required to accomodate the sum -of the two inputs. The original \textbf{used} count of $c$ is copied and set to the new used count. - -At this point the first addition loop will go through as many digit positions that both inputs have. The carry -variable $\mu$ is set to zero outside the loop. Inside the loop an ``addition'' step requires three statements to produce -one digit of the summand. First -two digits from $a$ and $b$ are added together along with the carry $\mu$. The carry of this step is extracted and stored -in $\mu$ and finally the digit of the result $c_n$ is truncated within the range $0 \le c_n < \beta$. - -Now all of the digit positions that both inputs have in common have been exhausted. If $min \ne max$ then $x$ is an alias -for one of the inputs that has more digits. A simplified addition loop is then used to essentially copy the remaining digits -and the carry to the destination. - -The final carry is stored in $c_{max}$ and digits above $max$ upto $oldused$ are zeroed which completes the addition. - - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_s\_mp\_add.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* low level addition, based on HAC pp.594, Algorithm 14.7 */ -018 int -019 s_mp_add (mp_int * a, mp_int * b, mp_int * c) -020 \{ -021 mp_int *x; -022 int olduse, res, min, max; -023 -024 /* find sizes, we let |a| <= |b| which means we have to sort -025 * them. "x" will point to the input with the most digits -026 */ -027 if (a->used > b->used) \{ -028 min = b->used; -029 max = a->used; -030 x = a; -031 \} else \{ -032 min = a->used; -033 max = b->used; -034 x = b; -035 \} -036 -037 /* init result */ -038 if (c->alloc < (max + 1)) \{ -039 if ((res = mp_grow (c, max + 1)) != MP_OKAY) \{ -040 return res; -041 \} -042 \} -043 -044 /* get old used digit count and set new one */ -045 olduse = c->used; -046 c->used = max + 1; -047 -048 \{ -049 mp_digit u, *tmpa, *tmpb, *tmpc; -050 int i; -051 -052 /* alias for digit pointers */ -053 -054 /* first input */ -055 tmpa = a->dp; -056 -057 /* second input */ -058 tmpb = b->dp; -059 -060 /* destination */ -061 tmpc = c->dp; -062 -063 /* zero the carry */ -064 u = 0; -065 for (i = 0; i < min; i++) \{ -066 /* Compute the sum at one digit, T[i] = A[i] + B[i] + U */ -067 *tmpc = *tmpa++ + *tmpb++ + u; -068 -069 /* U = carry bit of T[i] */ -070 u = *tmpc >> ((mp_digit)DIGIT_BIT); -071 -072 /* take away carry bit from T[i] */ -073 *tmpc++ &= MP_MASK; -074 \} -075 -076 /* now copy higher words if any, that is in A+B -077 * if A or B has more digits add those in -078 */ -079 if (min != max) \{ -080 for (; i < max; i++) \{ -081 /* T[i] = X[i] + U */ -082 *tmpc = x->dp[i] + u; -083 -084 /* U = carry bit of T[i] */ -085 u = *tmpc >> ((mp_digit)DIGIT_BIT); -086 -087 /* take away carry bit from T[i] */ -088 *tmpc++ &= MP_MASK; -089 \} -090 \} -091 -092 /* add carry */ -093 *tmpc++ = u; -094 -095 /* clear digits above oldused */ -096 for (i = c->used; i < olduse; i++) \{ -097 *tmpc++ = 0; -098 \} -099 \} -100 -101 mp_clamp (c); -102 return MP_OKAY; -103 \} -104 #endif -105 -\end{alltt} -\end{small} - -We first sort (lines 27 to 35) the inputs based on magnitude and determine the $min$ and $max$ variables. -Note that $x$ is a pointer to an mp\_int assigned to the largest input, in effect it is a local alias. Next we -grow the destination (37 to 42) ensure that it can accomodate the result of the addition. - -Similar to the implementation of mp\_copy this function uses the braced code and local aliases coding style. The three aliases that are on -lines 55, 58 and 61 represent the two inputs and destination variables respectively. These aliases are used to ensure the -compiler does not have to dereference $a$, $b$ or $c$ (respectively) to access the digits of the respective mp\_int. - -The initial carry $u$ will be cleared (line 64), note that $u$ is of type mp\_digit which ensures type -compatibility within the implementation. The initial addition (line 65 to 74) adds digits from -both inputs until the smallest input runs out of digits. Similarly the conditional addition loop -(line 80 to 90) adds the remaining digits from the larger of the two inputs. The addition is finished -with the final carry being stored in $tmpc$ (line 93). Note the ``++'' operator within the same expression. -After line 93, $tmpc$ will point to the $c.used$'th digit of the mp\_int $c$. This is useful -for the next loop (line 96 to 99) which set any old upper digits to zero. - -\subsection{Low Level Subtraction} -The low level unsigned subtraction algorithm is very similar to the low level unsigned addition algorithm. The principle difference is that the -unsigned subtraction algorithm requires the result to be positive. That is when computing $a - b$ the condition $\vert a \vert \ge \vert b\vert$ must -be met for this algorithm to function properly. Keep in mind this low level algorithm is not meant to be used in higher level algorithms directly. -This algorithm as will be shown can be used to create functional signed addition and subtraction algorithms. - - -For this algorithm a new variable is required to make the description simpler. Recall from section 1.3.1 that a mp\_digit must be able to represent -the range $0 \le x < 2\beta$ for the algorithms to work correctly. However, it is allowable that a mp\_digit represent a larger range of values. For -this algorithm we will assume that the variable $\gamma$ represents the number of bits available in a -mp\_digit (\textit{this implies $2^{\gamma} > \beta$}). - -For example, the default for LibTomMath is to use a ``unsigned long'' for the mp\_digit ``type'' while $\beta = 2^{28}$. In ISO C an ``unsigned long'' -data type must be able to represent $0 \le x < 2^{32}$ meaning that in this case $\gamma \ge 32$. - -\newpage\begin{figure}[!here] -\begin{center} -\begin{small} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_sub}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ ($\vert a \vert \ge \vert b \vert$) \\ -\textbf{Output}. The unsigned subtraction $c = \vert a \vert - \vert b \vert$. \\ -\hline \\ -1. $min \leftarrow b.used$ \\ -2. $max \leftarrow a.used$ \\ -3. If $c.alloc < max$ then grow $c$ to hold at least $max$ digits. (\textit{mp\_grow}) \\ -4. $oldused \leftarrow c.used$ \\ -5. $c.used \leftarrow max$ \\ -6. $u \leftarrow 0$ \\ -7. for $n$ from $0$ to $min - 1$ do \\ -\hspace{3mm}7.1 $c_n \leftarrow a_n - b_n - u$ \\ -\hspace{3mm}7.2 $u \leftarrow c_n >> (\gamma - 1)$ \\ -\hspace{3mm}7.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -8. if $min < max$ then do \\ -\hspace{3mm}8.1 for $n$ from $min$ to $max - 1$ do \\ -\hspace{6mm}8.1.1 $c_n \leftarrow a_n - u$ \\ -\hspace{6mm}8.1.2 $u \leftarrow c_n >> (\gamma - 1)$ \\ -\hspace{6mm}8.1.3 $c_n \leftarrow c_n \mbox{ (mod }\beta\mbox{)}$ \\ -9. if $oldused > max$ then do \\ -\hspace{3mm}9.1 for $n$ from $max$ to $oldused - 1$ do \\ -\hspace{6mm}9.1.1 $c_n \leftarrow 0$ \\ -10. Clamp excess digits of $c$. (\textit{mp\_clamp}). \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Algorithm s\_mp\_sub} -\end{figure} - -\textbf{Algorithm s\_mp\_sub.} -This algorithm performs the unsigned subtraction of two mp\_int variables under the restriction that the result must be positive. That is when -passing variables $a$ and $b$ the condition that $\vert a \vert \ge \vert b \vert$ must be met for the algorithm to function correctly. This -algorithm is loosely based on algorithm 14.9 \cite[pp. 595]{HAC} and is similar to algorithm S in \cite[pp. 267]{TAOCPV2} as well. As was the case -of the algorithm s\_mp\_add both other references lack discussion concerning various practical details such as when the inputs differ in magnitude. - -The initial sorting of the inputs is trivial in this algorithm since $a$ is guaranteed to have at least the same magnitude of $b$. Steps 1 and 2 -set the $min$ and $max$ variables. Unlike the addition routine there is guaranteed to be no carry which means that the final result can be at -most $max$ digits in length as opposed to $max + 1$. Similar to the addition algorithm the \textbf{used} count of $c$ is copied locally and -set to the maximal count for the operation. - -The subtraction loop that begins on step seven is essentially the same as the addition loop of algorithm s\_mp\_add except single precision -subtraction is used instead. Note the use of the $\gamma$ variable to extract the carry (\textit{also known as the borrow}) within the subtraction -loops. Under the assumption that two's complement single precision arithmetic is used this will successfully extract the desired carry. - -For example, consider subtracting $0101_2$ from $0100_2$ where $\gamma = 4$ and $\beta = 2$. The least significant bit will force a carry upwards to -the third bit which will be set to zero after the borrow. After the very first bit has been subtracted $4 - 1 \equiv 0011_2$ will remain, When the -third bit of $0101_2$ is subtracted from the result it will cause another carry. In this case though the carry will be forced to propagate all the -way to the most significant bit. - -Recall that $\beta < 2^{\gamma}$. This means that if a carry does occur just before the $lg(\beta)$'th bit it will propagate all the way to the most -significant bit. Thus, the high order bits of the mp\_digit that are not part of the actual digit will either be all zero, or all one. All that -is needed is a single zero or one bit for the carry. Therefore a single logical shift right by $\gamma - 1$ positions is sufficient to extract the -carry. This method of carry extraction may seem awkward but the reason for it becomes apparent when the implementation is discussed. - -If $b$ has a smaller magnitude than $a$ then step 9 will force the carry and copy operation to propagate through the larger input $a$ into $c$. Step -10 will ensure that any leading digits of $c$ above the $max$'th position are zeroed. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_s\_mp\_sub.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ -018 int -019 s_mp_sub (mp_int * a, mp_int * b, mp_int * c) -020 \{ -021 int olduse, res, min, max; -022 -023 /* find sizes */ -024 min = b->used; -025 max = a->used; -026 -027 /* init result */ -028 if (c->alloc < max) \{ -029 if ((res = mp_grow (c, max)) != MP_OKAY) \{ -030 return res; -031 \} -032 \} -033 olduse = c->used; -034 c->used = max; -035 -036 \{ -037 mp_digit u, *tmpa, *tmpb, *tmpc; -038 int i; -039 -040 /* alias for digit pointers */ -041 tmpa = a->dp; -042 tmpb = b->dp; -043 tmpc = c->dp; -044 -045 /* set carry to zero */ -046 u = 0; -047 for (i = 0; i < min; i++) \{ -048 /* T[i] = A[i] - B[i] - U */ -049 *tmpc = (*tmpa++ - *tmpb++) - u; -050 -051 /* U = carry bit of T[i] -052 * Note this saves performing an AND operation since -053 * if a carry does occur it will propagate all the way to the -054 * MSB. As a result a single shift is enough to get the carry -055 */ -056 u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); -057 -058 /* Clear carry from T[i] */ -059 *tmpc++ &= MP_MASK; -060 \} -061 -062 /* now copy higher words if any, e.g. if A has more digits than B */ -063 for (; i < max; i++) \{ -064 /* T[i] = A[i] - U */ -065 *tmpc = *tmpa++ - u; -066 -067 /* U = carry bit of T[i] */ -068 u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); -069 -070 /* Clear carry from T[i] */ -071 *tmpc++ &= MP_MASK; -072 \} -073 -074 /* clear digits above used (since we may not have grown result above) */ - -075 for (i = c->used; i < olduse; i++) \{ -076 *tmpc++ = 0; -077 \} -078 \} -079 -080 mp_clamp (c); -081 return MP_OKAY; -082 \} -083 -084 #endif -085 -\end{alltt} -\end{small} - -Like low level addition we ``sort'' the inputs. Except in this case the sorting is hardcoded -(lines 24 and 25). In reality the $min$ and $max$ variables are only aliases and are only -used to make the source code easier to read. Again the pointer alias optimization is used -within this algorithm. The aliases $tmpa$, $tmpb$ and $tmpc$ are initialized -(lines 41, 42 and 43) for $a$, $b$ and $c$ respectively. - -The first subtraction loop (lines 46 through 60) subtract digits from both inputs until the smaller of -the two inputs has been exhausted. As remarked earlier there is an implementation reason for using the ``awkward'' -method of extracting the carry (line 56). The traditional method for extracting the carry would be to shift -by $lg(\beta)$ positions and logically AND the least significant bit. The AND operation is required because all of -the bits above the $\lg(\beta)$'th bit will be set to one after a carry occurs from subtraction. This carry -extraction requires two relatively cheap operations to extract the carry. The other method is to simply shift the -most significant bit to the least significant bit thus extracting the carry with a single cheap operation. This -optimization only works on twos compliment machines which is a safe assumption to make. - -If $a$ has a larger magnitude than $b$ an additional loop (lines 63 through 72) is required to propagate -the carry through $a$ and copy the result to $c$. - -\subsection{High Level Addition} -Now that both lower level addition and subtraction algorithms have been established an effective high level signed addition algorithm can be -established. This high level addition algorithm will be what other algorithms and developers will use to perform addition of mp\_int data -types. - -Recall from section 5.2 that an mp\_int represents an integer with an unsigned mantissa (\textit{the array of digits}) and a \textbf{sign} -flag. A high level addition is actually performed as a series of eight separate cases which can be optimized down to three unique cases. - -\begin{figure}[!here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_add}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. The signed addition $c = a + b$. \\ -\hline \\ -1. if $a.sign = b.sign$ then do \\ -\hspace{3mm}1.1 $c.sign \leftarrow a.sign$ \\ -\hspace{3mm}1.2 $c \leftarrow \vert a \vert + \vert b \vert$ (\textit{s\_mp\_add})\\ -2. else do \\ -\hspace{3mm}2.1 if $\vert a \vert < \vert b \vert$ then do (\textit{mp\_cmp\_mag}) \\ -\hspace{6mm}2.1.1 $c.sign \leftarrow b.sign$ \\ -\hspace{6mm}2.1.2 $c \leftarrow \vert b \vert - \vert a \vert$ (\textit{s\_mp\_sub}) \\ -\hspace{3mm}2.2 else do \\ -\hspace{6mm}2.2.1 $c.sign \leftarrow a.sign$ \\ -\hspace{6mm}2.2.2 $c \leftarrow \vert a \vert - \vert b \vert$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_add} -\end{figure} - -\textbf{Algorithm mp\_add.} -This algorithm performs the signed addition of two mp\_int variables. There is no reference algorithm to draw upon from -either \cite{TAOCPV2} or \cite{HAC} since they both only provide unsigned operations. The algorithm is fairly -straightforward but restricted since subtraction can only produce positive results. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|c|c|c|c|} -\hline \textbf{Sign of $a$} & \textbf{Sign of $b$} & \textbf{$\vert a \vert > \vert b \vert $} & \textbf{Unsigned Operation} & \textbf{Result Sign Flag} \\ -\hline $+$ & $+$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $+$ & $+$ & No & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $-$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $-$ & No & $c = a + b$ & $a.sign$ \\ -\hline &&&&\\ - -\hline $+$ & $-$ & No & $c = b - a$ & $b.sign$ \\ -\hline $-$ & $+$ & No & $c = b - a$ & $b.sign$ \\ - -\hline &&&&\\ - -\hline $+$ & $-$ & Yes & $c = a - b$ & $a.sign$ \\ -\hline $-$ & $+$ & Yes & $c = a - b$ & $a.sign$ \\ - -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Addition Guide Chart} -\label{fig:AddChart} -\end{figure} - -Figure~\ref{fig:AddChart} lists all of the eight possible input combinations and is sorted to show that only three -specific cases need to be handled. The return code of the unsigned operations at step 1.2, 2.1.2 and 2.2.2 are -forwarded to step three to check for errors. This simplifies the description of the algorithm considerably and best -follows how the implementation actually was achieved. - -Also note how the \textbf{sign} is set before the unsigned addition or subtraction is performed. Recall from the descriptions of algorithms -s\_mp\_add and s\_mp\_sub that the mp\_clamp function is used at the end to trim excess digits. The mp\_clamp algorithm will set the \textbf{sign} -to \textbf{MP\_ZPOS} when the \textbf{used} digit count reaches zero. - -For example, consider performing $-a + a$ with algorithm mp\_add. By the description of the algorithm the sign is set to \textbf{MP\_NEG} which would -produce a result of $-0$. However, since the sign is set first then the unsigned addition is performed the subsequent usage of algorithm mp\_clamp -within algorithm s\_mp\_add will force $-0$ to become $0$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_add.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* high level addition (handles signs) */ -018 int mp_add (mp_int * a, mp_int * b, mp_int * c) -019 \{ -020 int sa, sb, res; -021 -022 /* get sign of both inputs */ -023 sa = a->sign; -024 sb = b->sign; -025 -026 /* handle two cases, not four */ -027 if (sa == sb) \{ -028 /* both positive or both negative */ -029 /* add their magnitudes, copy the sign */ -030 c->sign = sa; -031 res = s_mp_add (a, b, c); -032 \} else \{ -033 /* one positive, the other negative */ -034 /* subtract the one with the greater magnitude from */ -035 /* the one of the lesser magnitude. The result gets */ -036 /* the sign of the one with the greater magnitude. */ -037 if (mp_cmp_mag (a, b) == MP_LT) \{ -038 c->sign = sb; -039 res = s_mp_sub (b, a, c); -040 \} else \{ -041 c->sign = sa; -042 res = s_mp_sub (a, b, c); -043 \} -044 \} -045 return res; -046 \} -047 -048 #endif -049 -\end{alltt} -\end{small} - -The source code follows the algorithm fairly closely. The most notable new source code addition is the usage of the $res$ integer variable which -is used to pass result of the unsigned operations forward. Unlike in the algorithm, the variable $res$ is merely returned as is without -explicitly checking it and returning the constant \textbf{MP\_OKAY}. The observation is this algorithm will succeed or fail only if the lower -level functions do so. Returning their return code is sufficient. - -\subsection{High Level Subtraction} -The high level signed subtraction algorithm is essentially the same as the high level signed addition algorithm. - -\newpage\begin{figure}[!here] -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_sub}. \\ -\textbf{Input}. Two mp\_ints $a$ and $b$ \\ -\textbf{Output}. The signed subtraction $c = a - b$. \\ -\hline \\ -1. if $a.sign \ne b.sign$ then do \\ -\hspace{3mm}1.1 $c.sign \leftarrow a.sign$ \\ -\hspace{3mm}1.2 $c \leftarrow \vert a \vert + \vert b \vert$ (\textit{s\_mp\_add}) \\ -2. else do \\ -\hspace{3mm}2.1 if $\vert a \vert \ge \vert b \vert$ then do (\textit{mp\_cmp\_mag}) \\ -\hspace{6mm}2.1.1 $c.sign \leftarrow a.sign$ \\ -\hspace{6mm}2.1.2 $c \leftarrow \vert a \vert - \vert b \vert$ (\textit{s\_mp\_sub}) \\ -\hspace{3mm}2.2 else do \\ -\hspace{6mm}2.2.1 $c.sign \leftarrow \left \lbrace \begin{array}{ll} - MP\_ZPOS & \mbox{if }a.sign = MP\_NEG \\ - MP\_NEG & \mbox{otherwise} \\ - \end{array} \right .$ \\ -\hspace{6mm}2.2.2 $c \leftarrow \vert b \vert - \vert a \vert$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\caption{Algorithm mp\_sub} -\end{figure} - -\textbf{Algorithm mp\_sub.} -This algorithm performs the signed subtraction of two inputs. Similar to algorithm mp\_add there is no reference in either \cite{TAOCPV2} or -\cite{HAC}. Also this algorithm is restricted by algorithm s\_mp\_sub. Chart \ref{fig:SubChart} lists the eight possible inputs and -the operations required. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{|c|c|c|c|c|} -\hline \textbf{Sign of $a$} & \textbf{Sign of $b$} & \textbf{$\vert a \vert \ge \vert b \vert $} & \textbf{Unsigned Operation} & \textbf{Result Sign Flag} \\ -\hline $+$ & $-$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $+$ & $-$ & No & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $+$ & Yes & $c = a + b$ & $a.sign$ \\ -\hline $-$ & $+$ & No & $c = a + b$ & $a.sign$ \\ -\hline &&&& \\ -\hline $+$ & $+$ & Yes & $c = a - b$ & $a.sign$ \\ -\hline $-$ & $-$ & Yes & $c = a - b$ & $a.sign$ \\ -\hline &&&& \\ -\hline $+$ & $+$ & No & $c = b - a$ & $\mbox{opposite of }a.sign$ \\ -\hline $-$ & $-$ & No & $c = b - a$ & $\mbox{opposite of }a.sign$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Subtraction Guide Chart} -\label{fig:SubChart} -\end{figure} - -Similar to the case of algorithm mp\_add the \textbf{sign} is set first before the unsigned addition or subtraction. That is to prevent the -algorithm from producing $-a - -a = -0$ as a result. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_sub.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* high level subtraction (handles signs) */ -018 int -019 mp_sub (mp_int * a, mp_int * b, mp_int * c) -020 \{ -021 int sa, sb, res; -022 -023 sa = a->sign; -024 sb = b->sign; -025 -026 if (sa != sb) \{ -027 /* subtract a negative from a positive, OR */ -028 /* subtract a positive from a negative. */ -029 /* In either case, ADD their magnitudes, */ -030 /* and use the sign of the first number. */ -031 c->sign = sa; -032 res = s_mp_add (a, b, c); -033 \} else \{ -034 /* subtract a positive from a positive, OR */ -035 /* subtract a negative from a negative. */ -036 /* First, take the difference between their */ -037 /* magnitudes, then... */ -038 if (mp_cmp_mag (a, b) != MP_LT) \{ -039 /* Copy the sign from the first */ -040 c->sign = sa; -041 /* The first has a larger or equal magnitude */ -042 res = s_mp_sub (a, b, c); -043 \} else \{ -044 /* The result has the *opposite* sign from */ -045 /* the first number. */ -046 c->sign = (sa == MP_ZPOS) ? MP_NEG : MP_ZPOS; -047 /* The second has a larger magnitude */ -048 res = s_mp_sub (b, a, c); -049 \} -050 \} -051 return res; -052 \} -053 -054 #endif -055 -\end{alltt} -\end{small} - -Much like the implementation of algorithm mp\_add the variable $res$ is used to catch the return code of the unsigned addition or subtraction operations -and forward it to the end of the function. On line 38 the ``not equal to'' \textbf{MP\_LT} expression is used to emulate a -``greater than or equal to'' comparison. - -\section{Bit and Digit Shifting} -It is quite common to think of a multiple precision integer as a polynomial in $x$, that is $y = f(\beta)$ where $f(x) = \sum_{i=0}^{n-1} a_i x^i$. -This notation arises within discussion of Montgomery and Diminished Radix Reduction as well as Karatsuba multiplication and squaring. - -In order to facilitate operations on polynomials in $x$ as above a series of simple ``digit'' algorithms have to be established. That is to shift -the digits left or right as well to shift individual bits of the digits left and right. It is important to note that not all ``shift'' operations -are on radix-$\beta$ digits. - -\subsection{Multiplication by Two} - -In a binary system where the radix is a power of two multiplication by two not only arises often in other algorithms it is a fairly efficient -operation to perform. A single precision logical shift left is sufficient to multiply a single digit by two. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul\_2}. \\ -\textbf{Input}. One mp\_int $a$ \\ -\textbf{Output}. $b = 2a$. \\ -\hline \\ -1. If $b.alloc < a.used + 1$ then grow $b$ to hold $a.used + 1$ digits. (\textit{mp\_grow}) \\ -2. $oldused \leftarrow b.used$ \\ -3. $b.used \leftarrow a.used$ \\ -4. $r \leftarrow 0$ \\ -5. for $n$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}5.1 $rr \leftarrow a_n >> (lg(\beta) - 1)$ \\ -\hspace{3mm}5.2 $b_n \leftarrow (a_n << 1) + r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}5.3 $r \leftarrow rr$ \\ -6. If $r \ne 0$ then do \\ -\hspace{3mm}6.1 $b_{n + 1} \leftarrow r$ \\ -\hspace{3mm}6.2 $b.used \leftarrow b.used + 1$ \\ -7. If $b.used < oldused - 1$ then do \\ -\hspace{3mm}7.1 for $n$ from $b.used$ to $oldused - 1$ do \\ -\hspace{6mm}7.1.1 $b_n \leftarrow 0$ \\ -8. $b.sign \leftarrow a.sign$ \\ -9. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul\_2} -\end{figure} - -\textbf{Algorithm mp\_mul\_2.} -This algorithm will quickly multiply a mp\_int by two provided $\beta$ is a power of two. Neither \cite{TAOCPV2} nor \cite{HAC} describe such -an algorithm despite the fact it arises often in other algorithms. The algorithm is setup much like the lower level algorithm s\_mp\_add since -it is for all intents and purposes equivalent to the operation $b = \vert a \vert + \vert a \vert$. - -Step 1 and 2 grow the input as required to accomodate the maximum number of \textbf{used} digits in the result. The initial \textbf{used} count -is set to $a.used$ at step 4. Only if there is a final carry will the \textbf{used} count require adjustment. - -Step 6 is an optimization implementation of the addition loop for this specific case. That is since the two values being added together -are the same there is no need to perform two reads from the digits of $a$. Step 6.1 performs a single precision shift on the current digit $a_n$ to -obtain what will be the carry for the next iteration. Step 6.2 calculates the $n$'th digit of the result as single precision shift of $a_n$ plus -the previous carry. Recall from section 4.1 that $a_n << 1$ is equivalent to $a_n \cdot 2$. An iteration of the addition loop is finished with -forwarding the carry to the next iteration. - -Step 7 takes care of any final carry by setting the $a.used$'th digit of the result to the carry and augmenting the \textbf{used} count of $b$. -Step 8 clears any leading digits of $b$ in case it originally had a larger magnitude than $a$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_mul\_2.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* b = a*2 */ -018 int mp_mul_2(mp_int * a, mp_int * b) -019 \{ -020 int x, res, oldused; -021 -022 /* grow to accomodate result */ -023 if (b->alloc < (a->used + 1)) \{ -024 if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) \{ -025 return res; -026 \} -027 \} -028 -029 oldused = b->used; -030 b->used = a->used; -031 -032 \{ -033 mp_digit r, rr, *tmpa, *tmpb; -034 -035 /* alias for source */ -036 tmpa = a->dp; -037 -038 /* alias for dest */ -039 tmpb = b->dp; -040 -041 /* carry */ -042 r = 0; -043 for (x = 0; x < a->used; x++) \{ -044 -045 /* get what will be the *next* carry bit from the -046 * MSB of the current digit -047 */ -048 rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1)); -049 -050 /* now shift up this digit, add in the carry [from the previous] */ -051 *tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK; -052 -053 /* copy the carry that would be from the source -054 * digit into the next iteration -055 */ -056 r = rr; -057 \} -058 -059 /* new leading digit? */ -060 if (r != 0) \{ -061 /* add a MSB which is always 1 at this point */ -062 *tmpb = 1; -063 ++(b->used); -064 \} -065 -066 /* now zero any excess digits on the destination -067 * that we didn't write to -068 */ -069 tmpb = b->dp + b->used; -070 for (x = b->used; x < oldused; x++) \{ -071 *tmpb++ = 0; -072 \} -073 \} -074 b->sign = a->sign; -075 return MP_OKAY; -076 \} -077 #endif -078 -\end{alltt} -\end{small} - -This implementation is essentially an optimized implementation of s\_mp\_add for the case of doubling an input. The only noteworthy difference -is the use of the logical shift operator on line 51 to perform a single precision doubling. - -\subsection{Division by Two} -A division by two can just as easily be accomplished with a logical shift right as multiplication by two can be with a logical shift left. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div\_2}. \\ -\textbf{Input}. One mp\_int $a$ \\ -\textbf{Output}. $b = a/2$. \\ -\hline \\ -1. If $b.alloc < a.used$ then grow $b$ to hold $a.used$ digits. (\textit{mp\_grow}) \\ -2. If the reallocation failed return(\textit{MP\_MEM}). \\ -3. $oldused \leftarrow b.used$ \\ -4. $b.used \leftarrow a.used$ \\ -5. $r \leftarrow 0$ \\ -6. for $n$ from $b.used - 1$ to $0$ do \\ -\hspace{3mm}6.1 $rr \leftarrow a_n \mbox{ (mod }2\mbox{)}$\\ -\hspace{3mm}6.2 $b_n \leftarrow (a_n >> 1) + (r << (lg(\beta) - 1)) \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}6.3 $r \leftarrow rr$ \\ -7. If $b.used < oldused - 1$ then do \\ -\hspace{3mm}7.1 for $n$ from $b.used$ to $oldused - 1$ do \\ -\hspace{6mm}7.1.1 $b_n \leftarrow 0$ \\ -8. $b.sign \leftarrow a.sign$ \\ -9. Clamp excess digits of $b$. (\textit{mp\_clamp}) \\ -10. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div\_2} -\end{figure} - -\textbf{Algorithm mp\_div\_2.} -This algorithm will divide an mp\_int by two using logical shifts to the right. Like mp\_mul\_2 it uses a modified low level addition -core as the basis of the algorithm. Unlike mp\_mul\_2 the shift operations work from the leading digit to the trailing digit. The algorithm -could be written to work from the trailing digit to the leading digit however, it would have to stop one short of $a.used - 1$ digits to prevent -reading past the end of the array of digits. - -Essentially the loop at step 6 is similar to that of mp\_mul\_2 except the logical shifts go in the opposite direction and the carry is at the -least significant bit not the most significant bit. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_div\_2.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* b = a/2 */ -018 int mp_div_2(mp_int * a, mp_int * b) -019 \{ -020 int x, res, oldused; -021 -022 /* copy */ -023 if (b->alloc < a->used) \{ -024 if ((res = mp_grow (b, a->used)) != MP_OKAY) \{ -025 return res; -026 \} -027 \} -028 -029 oldused = b->used; -030 b->used = a->used; -031 \{ -032 mp_digit r, rr, *tmpa, *tmpb; -033 -034 /* source alias */ -035 tmpa = a->dp + b->used - 1; -036 -037 /* dest alias */ -038 tmpb = b->dp + b->used - 1; -039 -040 /* carry */ -041 r = 0; -042 for (x = b->used - 1; x >= 0; x--) \{ -043 /* get the carry for the next iteration */ -044 rr = *tmpa & 1; -045 -046 /* shift the current digit, add in carry and store */ -047 *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1)); -048 -049 /* forward carry to next iteration */ -050 r = rr; -051 \} -052 -053 /* zero excess digits */ -054 tmpb = b->dp + b->used; -055 for (x = b->used; x < oldused; x++) \{ -056 *tmpb++ = 0; -057 \} -058 \} -059 b->sign = a->sign; -060 mp_clamp (b); -061 return MP_OKAY; -062 \} -063 #endif -064 -\end{alltt} -\end{small} - -\section{Polynomial Basis Operations} -Recall from section 4.3 that any integer can be represented as a polynomial in $x$ as $y = f(\beta)$. Such a representation is also known as -the polynomial basis \cite[pp. 48]{ROSE}. Given such a notation a multiplication or division by $x$ amounts to shifting whole digits a single -place. The need for such operations arises in several other higher level algorithms such as Barrett and Montgomery reduction, integer -division and Karatsuba multiplication. - -Converting from an array of digits to polynomial basis is very simple. Consider the integer $y \equiv (a_2, a_1, a_0)_{\beta}$ and recall that -$y = \sum_{i=0}^{2} a_i \beta^i$. Simply replace $\beta$ with $x$ and the expression is in polynomial basis. For example, $f(x) = 8x + 9$ is the -polynomial basis representation for $89$ using radix ten. That is, $f(10) = 8(10) + 9 = 89$. - -\subsection{Multiplication by $x$} - -Given a polynomial in $x$ such as $f(x) = a_n x^n + a_{n-1} x^{n-1} + ... + a_0$ multiplying by $x$ amounts to shifting the coefficients up one -degree. In this case $f(x) \cdot x = a_n x^{n+1} + a_{n-1} x^n + ... + a_0 x$. From a scalar basis point of view multiplying by $x$ is equivalent to -multiplying by the integer $\beta$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_lshd}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $a \leftarrow a \cdot \beta^b$ (equivalent to multiplication by $x^b$). \\ -\hline \\ -1. If $b \le 0$ then return(\textit{MP\_OKAY}). \\ -2. If $a.alloc < a.used + b$ then grow $a$ to at least $a.used + b$ digits. (\textit{mp\_grow}). \\ -3. If the reallocation failed return(\textit{MP\_MEM}). \\ -4. $a.used \leftarrow a.used + b$ \\ -5. $i \leftarrow a.used - 1$ \\ -6. $j \leftarrow a.used - 1 - b$ \\ -7. for $n$ from $a.used - 1$ to $b$ do \\ -\hspace{3mm}7.1 $a_{i} \leftarrow a_{j}$ \\ -\hspace{3mm}7.2 $i \leftarrow i - 1$ \\ -\hspace{3mm}7.3 $j \leftarrow j - 1$ \\ -8. for $n$ from 0 to $b - 1$ do \\ -\hspace{3mm}8.1 $a_n \leftarrow 0$ \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_lshd} -\end{figure} - -\textbf{Algorithm mp\_lshd.} -This algorithm multiplies an mp\_int by the $b$'th power of $x$. This is equivalent to multiplying by $\beta^b$. The algorithm differs -from the other algorithms presented so far as it performs the operation in place instead storing the result in a separate location. The -motivation behind this change is due to the way this function is typically used. Algorithms such as mp\_add store the result in an optionally -different third mp\_int because the original inputs are often still required. Algorithm mp\_lshd (\textit{and similarly algorithm mp\_rshd}) is -typically used on values where the original value is no longer required. The algorithm will return success immediately if -$b \le 0$ since the rest of algorithm is only valid when $b > 0$. - -First the destination $a$ is grown as required to accomodate the result. The counters $i$ and $j$ are used to form a \textit{sliding window} over -the digits of $a$ of length $b$. The head of the sliding window is at $i$ (\textit{the leading digit}) and the tail at $j$ (\textit{the trailing digit}). -The loop on step 7 copies the digit from the tail to the head. In each iteration the window is moved down one digit. The last loop on -step 8 sets the lower $b$ digits to zero. - -\newpage -\begin{center} -\begin{figure}[here] -\includegraphics{pics/sliding_window.ps} -\caption{Sliding Window Movement} -\label{pic:sliding_window} -\end{figure} -\end{center} - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_lshd.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* shift left a certain amount of digits */ -018 int mp_lshd (mp_int * a, int b) -019 \{ -020 int x, res; -021 -022 /* if its less than zero return */ -023 if (b <= 0) \{ -024 return MP_OKAY; -025 \} -026 -027 /* grow to fit the new digits */ -028 if (a->alloc < (a->used + b)) \{ -029 if ((res = mp_grow (a, a->used + b)) != MP_OKAY) \{ -030 return res; -031 \} -032 \} -033 -034 \{ -035 mp_digit *top, *bottom; -036 -037 /* increment the used by the shift amount then copy upwards */ -038 a->used += b; -039 -040 /* top */ -041 top = a->dp + a->used - 1; -042 -043 /* base */ -044 bottom = (a->dp + a->used - 1) - b; -045 -046 /* much like mp_rshd this is implemented using a sliding window -047 * except the window goes the otherway around. Copying from -048 * the bottom to the top. see bn_mp_rshd.c for more info. -049 */ -050 for (x = a->used - 1; x >= b; x--) \{ -051 *top-- = *bottom--; -052 \} -053 -054 /* zero the lower digits */ -055 top = a->dp; -056 for (x = 0; x < b; x++) \{ -057 *top++ = 0; -058 \} -059 \} -060 return MP_OKAY; -061 \} -062 #endif -063 -\end{alltt} -\end{small} - -The if statement (line 23) ensures that the $b$ variable is greater than zero since we do not interpret negative -shift counts properly. The \textbf{used} count is incremented by $b$ before the copy loop begins. This elminates -the need for an additional variable in the for loop. The variable $top$ (line 41) is an alias -for the leading digit while $bottom$ (line 44) is an alias for the trailing edge. The aliases form a -window of exactly $b$ digits over the input. - -\subsection{Division by $x$} - -Division by powers of $x$ is easily achieved by shifting the digits right and removing any that will end up to the right of the zero'th digit. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_rshd}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $a \leftarrow a / \beta^b$ (Divide by $x^b$). \\ -\hline \\ -1. If $b \le 0$ then return. \\ -2. If $a.used \le b$ then do \\ -\hspace{3mm}2.1 Zero $a$. (\textit{mp\_zero}). \\ -\hspace{3mm}2.2 Return. \\ -3. $i \leftarrow 0$ \\ -4. $j \leftarrow b$ \\ -5. for $n$ from 0 to $a.used - b - 1$ do \\ -\hspace{3mm}5.1 $a_i \leftarrow a_j$ \\ -\hspace{3mm}5.2 $i \leftarrow i + 1$ \\ -\hspace{3mm}5.3 $j \leftarrow j + 1$ \\ -6. for $n$ from $a.used - b$ to $a.used - 1$ do \\ -\hspace{3mm}6.1 $a_n \leftarrow 0$ \\ -7. $a.used \leftarrow a.used - b$ \\ -8. Return. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_rshd} -\end{figure} - -\textbf{Algorithm mp\_rshd.} -This algorithm divides the input in place by the $b$'th power of $x$. It is analogous to dividing by a $\beta^b$ but much quicker since -it does not require single precision division. This algorithm does not actually return an error code as it cannot fail. - -If the input $b$ is less than one the algorithm quickly returns without performing any work. If the \textbf{used} count is less than or equal -to the shift count $b$ then it will simply zero the input and return. - -After the trivial cases of inputs have been handled the sliding window is setup. Much like the case of algorithm mp\_lshd a sliding window that -is $b$ digits wide is used to copy the digits. Unlike mp\_lshd the window slides in the opposite direction from the trailing to the leading digit. -Also the digits are copied from the leading to the trailing edge. - -Once the window copy is complete the upper digits must be zeroed and the \textbf{used} count decremented. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_rshd.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* shift right a certain amount of digits */ -018 void mp_rshd (mp_int * a, int b) -019 \{ -020 int x; -021 -022 /* if b <= 0 then ignore it */ -023 if (b <= 0) \{ -024 return; -025 \} -026 -027 /* if b > used then simply zero it and return */ -028 if (a->used <= b) \{ -029 mp_zero (a); -030 return; -031 \} -032 -033 \{ -034 mp_digit *bottom, *top; -035 -036 /* shift the digits down */ -037 -038 /* bottom */ -039 bottom = a->dp; -040 -041 /* top [offset into digits] */ -042 top = a->dp + b; -043 -044 /* this is implemented as a sliding window where -045 * the window is b-digits long and digits from -046 * the top of the window are copied to the bottom -047 * -048 * e.g. -049 -050 b-2 | b-1 | b0 | b1 | b2 | ... | bb | ----> -051 /\symbol{92} | ----> -052 \symbol{92}-------------------/ ----> -053 */ -054 for (x = 0; x < (a->used - b); x++) \{ -055 *bottom++ = *top++; -056 \} -057 -058 /* zero the top digits */ -059 for (; x < a->used; x++) \{ -060 *bottom++ = 0; -061 \} -062 \} -063 -064 /* remove excess digits */ -065 a->used -= b; -066 \} -067 #endif -068 -\end{alltt} -\end{small} - -The only noteworthy element of this routine is the lack of a return type since it cannot fail. Like mp\_lshd() we -form a sliding window except we copy in the other direction. After the window (line 59) we then zero -the upper digits of the input to make sure the result is correct. - -\section{Powers of Two} - -Now that algorithms for moving single bits as well as whole digits exist algorithms for moving the ``in between'' distances are required. For -example, to quickly multiply by $2^k$ for any $k$ without using a full multiplier algorithm would prove useful. Instead of performing single -shifts $k$ times to achieve a multiplication by $2^{\pm k}$ a mixture of whole digit shifting and partial digit shifting is employed. - -\subsection{Multiplication by Power of Two} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul\_2d}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $c \leftarrow a \cdot 2^b$. \\ -\hline \\ -1. $c \leftarrow a$. (\textit{mp\_copy}) \\ -2. If $c.alloc < c.used + \lfloor b / lg(\beta) \rfloor + 2$ then grow $c$ accordingly. \\ -3. If the reallocation failed return(\textit{MP\_MEM}). \\ -4. If $b \ge lg(\beta)$ then \\ -\hspace{3mm}4.1 $c \leftarrow c \cdot \beta^{\lfloor b / lg(\beta) \rfloor}$ (\textit{mp\_lshd}). \\ -\hspace{3mm}4.2 If step 4.1 failed return(\textit{MP\_MEM}). \\ -5. $d \leftarrow b \mbox{ (mod }lg(\beta)\mbox{)}$ \\ -6. If $d \ne 0$ then do \\ -\hspace{3mm}6.1 $mask \leftarrow 2^d$ \\ -\hspace{3mm}6.2 $r \leftarrow 0$ \\ -\hspace{3mm}6.3 for $n$ from $0$ to $c.used - 1$ do \\ -\hspace{6mm}6.3.1 $rr \leftarrow c_n >> (lg(\beta) - d) \mbox{ (mod }mask\mbox{)}$ \\ -\hspace{6mm}6.3.2 $c_n \leftarrow (c_n << d) + r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}6.3.3 $r \leftarrow rr$ \\ -\hspace{3mm}6.4 If $r > 0$ then do \\ -\hspace{6mm}6.4.1 $c_{c.used} \leftarrow r$ \\ -\hspace{6mm}6.4.2 $c.used \leftarrow c.used + 1$ \\ -7. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul\_2d} -\end{figure} - -\textbf{Algorithm mp\_mul\_2d.} -This algorithm multiplies $a$ by $2^b$ and stores the result in $c$. The algorithm uses algorithm mp\_lshd and a derivative of algorithm mp\_mul\_2 to -quickly compute the product. - -First the algorithm will multiply $a$ by $x^{\lfloor b / lg(\beta) \rfloor}$ which will ensure that the remainder multiplicand is less than -$\beta$. For example, if $b = 37$ and $\beta = 2^{28}$ then this step will multiply by $x$ leaving a multiplication by $2^{37 - 28} = 2^{9}$ -left. - -After the digits have been shifted appropriately at most $lg(\beta) - 1$ shifts are left to perform. Step 5 calculates the number of remaining shifts -required. If it is non-zero a modified shift loop is used to calculate the remaining product. -Essentially the loop is a generic version of algorithm mp\_mul\_2 designed to handle any shift count in the range $1 \le x < lg(\beta)$. The $mask$ -variable is used to extract the upper $d$ bits to form the carry for the next iteration. - -This algorithm is loosely measured as a $O(2n)$ algorithm which means that if the input is $n$-digits that it takes $2n$ ``time'' to -complete. It is possible to optimize this algorithm down to a $O(n)$ algorithm at a cost of making the algorithm slightly harder to follow. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_mul\_2d.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* shift left by a certain bit count */ -018 int mp_mul_2d (mp_int * a, int b, mp_int * c) -019 \{ -020 mp_digit d; -021 int res; -022 -023 /* copy */ -024 if (a != c) \{ -025 if ((res = mp_copy (a, c)) != MP_OKAY) \{ -026 return res; -027 \} -028 \} -029 -030 if (c->alloc < (int)(c->used + (b / DIGIT_BIT) + 1)) \{ -031 if ((res = mp_grow (c, c->used + (b / DIGIT_BIT) + 1)) != MP_OKAY) \{ -032 return res; -033 \} -034 \} -035 -036 /* shift by as many digits in the bit count */ -037 if (b >= (int)DIGIT_BIT) \{ -038 if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) \{ -039 return res; -040 \} -041 \} -042 -043 /* shift any bit count < DIGIT_BIT */ -044 d = (mp_digit) (b % DIGIT_BIT); -045 if (d != 0) \{ -046 mp_digit *tmpc, shift, mask, r, rr; -047 int x; -048 -049 /* bitmask for carries */ -050 mask = (((mp_digit)1) << d) - 1; -051 -052 /* shift for msbs */ -053 shift = DIGIT_BIT - d; -054 -055 /* alias */ -056 tmpc = c->dp; -057 -058 /* carry */ -059 r = 0; -060 for (x = 0; x < c->used; x++) \{ -061 /* get the higher bits of the current word */ -062 rr = (*tmpc >> shift) & mask; -063 -064 /* shift the current word and OR in the carry */ -065 *tmpc = ((*tmpc << d) | r) & MP_MASK; -066 ++tmpc; -067 -068 /* set the carry to the carry bits of the current word */ -069 r = rr; -070 \} -071 -072 /* set final carry */ -073 if (r != 0) \{ -074 c->dp[(c->used)++] = r; -075 \} -076 \} -077 mp_clamp (c); -078 return MP_OKAY; -079 \} -080 #endif -081 -\end{alltt} -\end{small} - -The shifting is performed in--place which means the first step (line 24) is to copy the input to the -destination. We avoid calling mp\_copy() by making sure the mp\_ints are different. The destination then -has to be grown (line 31) to accomodate the result. - -If the shift count $b$ is larger than $lg(\beta)$ then a call to mp\_lshd() is used to handle all of the multiples -of $lg(\beta)$. Leaving only a remaining shift of $lg(\beta) - 1$ or fewer bits left. Inside the actual shift -loop (lines 45 to 76) we make use of pre--computed values $shift$ and $mask$. These are used to -extract the carry bit(s) to pass into the next iteration of the loop. The $r$ and $rr$ variables form a -chain between consecutive iterations to propagate the carry. - -\subsection{Division by Power of Two} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div\_2d}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $c \leftarrow \lfloor a / 2^b \rfloor, d \leftarrow a \mbox{ (mod }2^b\mbox{)}$. \\ -\hline \\ -1. If $b \le 0$ then do \\ -\hspace{3mm}1.1 $c \leftarrow a$ (\textit{mp\_copy}) \\ -\hspace{3mm}1.2 $d \leftarrow 0$ (\textit{mp\_zero}) \\ -\hspace{3mm}1.3 Return(\textit{MP\_OKAY}). \\ -2. $c \leftarrow a$ \\ -3. $d \leftarrow a \mbox{ (mod }2^b\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -4. If $b \ge lg(\beta)$ then do \\ -\hspace{3mm}4.1 $c \leftarrow \lfloor c/\beta^{\lfloor b/lg(\beta) \rfloor} \rfloor$ (\textit{mp\_rshd}). \\ -5. $k \leftarrow b \mbox{ (mod }lg(\beta)\mbox{)}$ \\ -6. If $k \ne 0$ then do \\ -\hspace{3mm}6.1 $mask \leftarrow 2^k$ \\ -\hspace{3mm}6.2 $r \leftarrow 0$ \\ -\hspace{3mm}6.3 for $n$ from $c.used - 1$ to $0$ do \\ -\hspace{6mm}6.3.1 $rr \leftarrow c_n \mbox{ (mod }mask\mbox{)}$ \\ -\hspace{6mm}6.3.2 $c_n \leftarrow (c_n >> k) + (r << (lg(\beta) - k))$ \\ -\hspace{6mm}6.3.3 $r \leftarrow rr$ \\ -7. Clamp excess digits of $c$. (\textit{mp\_clamp}) \\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div\_2d} -\end{figure} - -\textbf{Algorithm mp\_div\_2d.} -This algorithm will divide an input $a$ by $2^b$ and produce the quotient and remainder. The algorithm is designed much like algorithm -mp\_mul\_2d by first using whole digit shifts then single precision shifts. This algorithm will also produce the remainder of the division -by using algorithm mp\_mod\_2d. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_div\_2d.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* shift right by a certain bit count (store quotient in c, optional remaind - er in d) */ -018 int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) -019 \{ -020 mp_digit D, r, rr; -021 int x, res; -022 mp_int t; -023 -024 -025 /* if the shift count is <= 0 then we do no work */ -026 if (b <= 0) \{ -027 res = mp_copy (a, c); -028 if (d != NULL) \{ -029 mp_zero (d); -030 \} -031 return res; -032 \} -033 -034 if ((res = mp_init (&t)) != MP_OKAY) \{ -035 return res; -036 \} -037 -038 /* get the remainder */ -039 if (d != NULL) \{ -040 if ((res = mp_mod_2d (a, b, &t)) != MP_OKAY) \{ -041 mp_clear (&t); -042 return res; -043 \} -044 \} -045 -046 /* copy */ -047 if ((res = mp_copy (a, c)) != MP_OKAY) \{ -048 mp_clear (&t); -049 return res; -050 \} -051 -052 /* shift by as many digits in the bit count */ -053 if (b >= (int)DIGIT_BIT) \{ -054 mp_rshd (c, b / DIGIT_BIT); -055 \} -056 -057 /* shift any bit count < DIGIT_BIT */ -058 D = (mp_digit) (b % DIGIT_BIT); -059 if (D != 0) \{ -060 mp_digit *tmpc, mask, shift; -061 -062 /* mask */ -063 mask = (((mp_digit)1) << D) - 1; -064 -065 /* shift for lsb */ -066 shift = DIGIT_BIT - D; -067 -068 /* alias */ -069 tmpc = c->dp + (c->used - 1); -070 -071 /* carry */ -072 r = 0; -073 for (x = c->used - 1; x >= 0; x--) \{ -074 /* get the lower bits of this word in a temp */ -075 rr = *tmpc & mask; -076 -077 /* shift the current word and mix in the carry bits from the previous - word */ -078 *tmpc = (*tmpc >> D) | (r << shift); -079 --tmpc; -080 -081 /* set the carry to the carry bits of the current word found above */ -082 r = rr; -083 \} -084 \} -085 mp_clamp (c); -086 if (d != NULL) \{ -087 mp_exch (&t, d); -088 \} -089 mp_clear (&t); -090 return MP_OKAY; -091 \} -092 #endif -093 -\end{alltt} -\end{small} - -The implementation of algorithm mp\_div\_2d is slightly different than the algorithm specifies. The remainder $d$ may be optionally -ignored by passing \textbf{NULL} as the pointer to the mp\_int variable. The temporary mp\_int variable $t$ is used to hold the -result of the remainder operation until the end. This allows $d$ and $a$ to represent the same mp\_int without modifying $a$ before -the quotient is obtained. - -The remainder of the source code is essentially the same as the source code for mp\_mul\_2d. The only significant difference is -the direction of the shifts. - -\subsection{Remainder of Division by Power of Two} - -The last algorithm in the series of polynomial basis power of two algorithms is calculating the remainder of division by $2^b$. This -algorithm benefits from the fact that in twos complement arithmetic $a \mbox{ (mod }2^b\mbox{)}$ is the same as $a$ AND $2^b - 1$. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mod\_2d}. \\ -\textbf{Input}. One mp\_int $a$ and an integer $b$ \\ -\textbf{Output}. $c \leftarrow a \mbox{ (mod }2^b\mbox{)}$. \\ -\hline \\ -1. If $b \le 0$ then do \\ -\hspace{3mm}1.1 $c \leftarrow 0$ (\textit{mp\_zero}) \\ -\hspace{3mm}1.2 Return(\textit{MP\_OKAY}). \\ -2. If $b > a.used \cdot lg(\beta)$ then do \\ -\hspace{3mm}2.1 $c \leftarrow a$ (\textit{mp\_copy}) \\ -\hspace{3mm}2.2 Return the result of step 2.1. \\ -3. $c \leftarrow a$ \\ -4. If step 3 failed return(\textit{MP\_MEM}). \\ -5. for $n$ from $\lceil b / lg(\beta) \rceil$ to $c.used$ do \\ -\hspace{3mm}5.1 $c_n \leftarrow 0$ \\ -6. $k \leftarrow b \mbox{ (mod }lg(\beta)\mbox{)}$ \\ -7. $c_{\lfloor b / lg(\beta) \rfloor} \leftarrow c_{\lfloor b / lg(\beta) \rfloor} \mbox{ (mod }2^{k}\mbox{)}$. \\ -8. Clamp excess digits of $c$. (\textit{mp\_clamp}) \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mod\_2d} -\end{figure} - -\textbf{Algorithm mp\_mod\_2d.} -This algorithm will quickly calculate the value of $a \mbox{ (mod }2^b\mbox{)}$. First if $b$ is less than or equal to zero the -result is set to zero. If $b$ is greater than the number of bits in $a$ then it simply copies $a$ to $c$ and returns. Otherwise, $a$ -is copied to $b$, leading digits are removed and the remaining leading digit is trimed to the exact bit count. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_mod\_2d.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* calc a value mod 2**b */ -018 int -019 mp_mod_2d (mp_int * a, int b, mp_int * c) -020 \{ -021 int x, res; -022 -023 /* if b is <= 0 then zero the int */ -024 if (b <= 0) \{ -025 mp_zero (c); -026 return MP_OKAY; -027 \} -028 -029 /* if the modulus is larger than the value than return */ -030 if (b >= (int) (a->used * DIGIT_BIT)) \{ -031 res = mp_copy (a, c); -032 return res; -033 \} -034 -035 /* copy */ -036 if ((res = mp_copy (a, c)) != MP_OKAY) \{ -037 return res; -038 \} -039 -040 /* zero digits above the last digit of the modulus */ -041 for (x = (b / DIGIT_BIT) + (((b % DIGIT_BIT) == 0) ? 0 : 1); x < c->used; - x++) \{ -042 c->dp[x] = 0; -043 \} -044 /* clear the digit that is not completely outside/inside the modulus */ -045 c->dp[b / DIGIT_BIT] &= -046 (mp_digit) ((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digi - t) 1)); -047 mp_clamp (c); -048 return MP_OKAY; -049 \} -050 #endif -051 -\end{alltt} -\end{small} - -We first avoid cases of $b \le 0$ by simply mp\_zero()'ing the destination in such cases. Next if $2^b$ is larger -than the input we just mp\_copy() the input and return right away. After this point we know we must actually -perform some work to produce the remainder. - -Recalling that reducing modulo $2^k$ and a binary ``and'' with $2^k - 1$ are numerically equivalent we can quickly reduce -the number. First we zero any digits above the last digit in $2^b$ (line 41). Next we reduce the -leading digit of both (line 45) and then mp\_clamp(). - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 3 \right ] $ & Devise an algorithm that performs $a \cdot 2^b$ for generic values of $b$ \\ - & in $O(n)$ time. \\ - &\\ -$\left [ 3 \right ] $ & Devise an efficient algorithm to multiply by small low hamming \\ - & weight values such as $3$, $5$ and $9$. Extend it to handle all values \\ - & upto $64$ with a hamming weight less than three. \\ - &\\ -$\left [ 2 \right ] $ & Modify the preceding algorithm to handle values of the form \\ - & $2^k - 1$ as well. \\ - &\\ -$\left [ 3 \right ] $ & Using only algorithms mp\_mul\_2, mp\_div\_2 and mp\_add create an \\ - & algorithm to multiply two integers in roughly $O(2n^2)$ time for \\ - & any $n$-bit input. Note that the time of addition is ignored in the \\ - & calculation. \\ - & \\ -$\left [ 5 \right ] $ & Improve the previous algorithm to have a working time of at most \\ - & $O \left (2^{(k-1)}n + \left ({2n^2 \over k} \right ) \right )$ for an appropriate choice of $k$. Again ignore \\ - & the cost of addition. \\ - & \\ -$\left [ 2 \right ] $ & Devise a chart to find optimal values of $k$ for the previous problem \\ - & for $n = 64 \ldots 1024$ in steps of $64$. \\ - & \\ -$\left [ 2 \right ] $ & Using only algorithms mp\_abs and mp\_sub devise another method for \\ - & calculating the result of a signed comparison. \\ - & -\end{tabular} - -\chapter{Multiplication and Squaring} -\section{The Multipliers} -For most number theoretic problems including certain public key cryptographic algorithms, the ``multipliers'' form the most important subset of -algorithms of any multiple precision integer package. The set of multiplier algorithms include integer multiplication, squaring and modular reduction -where in each of the algorithms single precision multiplication is the dominant operation performed. This chapter will discuss integer multiplication -and squaring, leaving modular reductions for the subsequent chapter. - -The importance of the multiplier algorithms is for the most part driven by the fact that certain popular public key algorithms are based on modular -exponentiation, that is computing $d \equiv a^b \mbox{ (mod }c\mbox{)}$ for some arbitrary choice of $a$, $b$, $c$ and $d$. During a modular -exponentiation the majority\footnote{Roughly speaking a modular exponentiation will spend about 40\% of the time performing modular reductions, -35\% of the time performing squaring and 25\% of the time performing multiplications.} of the processor time is spent performing single precision -multiplications. - -For centuries general purpose multiplication has required a lengthly $O(n^2)$ process, whereby each digit of one multiplicand has to be multiplied -against every digit of the other multiplicand. Traditional long-hand multiplication is based on this process; while the techniques can differ the -overall algorithm used is essentially the same. Only ``recently'' have faster algorithms been studied. First Karatsuba multiplication was discovered in -1962. This algorithm can multiply two numbers with considerably fewer single precision multiplications when compared to the long-hand approach. -This technique led to the discovery of polynomial basis algorithms (\textit{good reference?}) and subquently Fourier Transform based solutions. - -\section{Multiplication} -\subsection{The Baseline Multiplication} -\label{sec:basemult} -\index{baseline multiplication} -Computing the product of two integers in software can be achieved using a trivial adaptation of the standard $O(n^2)$ long-hand multiplication -algorithm that school children are taught. The algorithm is considered an $O(n^2)$ algorithm since for two $n$-digit inputs $n^2$ single precision -multiplications are required. More specifically for a $m$ and $n$ digit input $m \cdot n$ single precision multiplications are required. To -simplify most discussions, it will be assumed that the inputs have comparable number of digits. - -The ``baseline multiplication'' algorithm is designed to act as the ``catch-all'' algorithm, only to be used when the faster algorithms cannot be -used. This algorithm does not use any particularly interesting optimizations and should ideally be avoided if possible. One important -facet of this algorithm, is that it has been modified to only produce a certain amount of output digits as resolution. The importance of this -modification will become evident during the discussion of Barrett modular reduction. Recall that for a $n$ and $m$ digit input the product -will be at most $n + m$ digits. Therefore, this algorithm can be reduced to a full multiplier by having it produce $n + m$ digits of the product. - -Recall from sub-section 4.2.2 the definition of $\gamma$ as the number of bits in the type \textbf{mp\_digit}. We shall now extend the variable set to -include $\alpha$ which shall represent the number of bits in the type \textbf{mp\_word}. This implies that $2^{\alpha} > 2 \cdot \beta^2$. The -constant $\delta = 2^{\alpha - 2lg(\beta)}$ will represent the maximal weight of any column in a product (\textit{see sub-section 5.2.2 for more information}). - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_mul\_digs}. \\ -\textbf{Input}. mp\_int $a$, mp\_int $b$ and an integer $digs$ \\ -\textbf{Output}. $c \leftarrow \vert a \vert \cdot \vert b \vert \mbox{ (mod }\beta^{digs}\mbox{)}$. \\ -\hline \\ -1. If min$(a.used, b.used) < \delta$ then do \\ -\hspace{3mm}1.1 Calculate $c = \vert a \vert \cdot \vert b \vert$ by the Comba method (\textit{see algorithm~\ref{fig:COMBAMULT}}). \\ -\hspace{3mm}1.2 Return the result of step 1.1 \\ -\\ -Allocate and initialize a temporary mp\_int. \\ -2. Init $t$ to be of size $digs$ \\ -3. If step 2 failed return(\textit{MP\_MEM}). \\ -4. $t.used \leftarrow digs$ \\ -\\ -Compute the product. \\ -5. for $ix$ from $0$ to $a.used - 1$ do \\ -\hspace{3mm}5.1 $u \leftarrow 0$ \\ -\hspace{3mm}5.2 $pb \leftarrow \mbox{min}(b.used, digs - ix)$ \\ -\hspace{3mm}5.3 If $pb < 1$ then goto step 6. \\ -\hspace{3mm}5.4 for $iy$ from $0$ to $pb - 1$ do \\ -\hspace{6mm}5.4.1 $\hat r \leftarrow t_{iy + ix} + a_{ix} \cdot b_{iy} + u$ \\ -\hspace{6mm}5.4.2 $t_{iy + ix} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}5.4.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}5.5 if $ix + pb < digs$ then do \\ -\hspace{6mm}5.5.1 $t_{ix + pb} \leftarrow u$ \\ -6. Clamp excess digits of $t$. \\ -7. Swap $c$ with $t$ \\ -8. Clear $t$ \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_mul\_digs} -\end{figure} - -\textbf{Algorithm s\_mp\_mul\_digs.} -This algorithm computes the unsigned product of two inputs $a$ and $b$, limited to an output precision of $digs$ digits. While it may seem -a bit awkward to modify the function from its simple $O(n^2)$ description, the usefulness of partial multipliers will arise in a subsequent -algorithm. The algorithm is loosely based on algorithm 14.12 from \cite[pp. 595]{HAC} and is similar to Algorithm M of Knuth \cite[pp. 268]{TAOCPV2}. -Algorithm s\_mp\_mul\_digs differs from these cited references since it can produce a variable output precision regardless of the precision of the -inputs. - -The first thing this algorithm checks for is whether a Comba multiplier can be used instead. If the minimum digit count of either -input is less than $\delta$, then the Comba method may be used instead. After the Comba method is ruled out, the baseline algorithm begins. A -temporary mp\_int variable $t$ is used to hold the intermediate result of the product. This allows the algorithm to be used to -compute products when either $a = c$ or $b = c$ without overwriting the inputs. - -All of step 5 is the infamous $O(n^2)$ multiplication loop slightly modified to only produce upto $digs$ digits of output. The $pb$ variable -is given the count of digits to read from $b$ inside the nested loop. If $pb \le 1$ then no more output digits can be produced and the algorithm -will exit the loop. The best way to think of the loops are as a series of $pb \times 1$ multiplications. That is, in each pass of the -innermost loop $a_{ix}$ is multiplied against $b$ and the result is added (\textit{with an appropriate shift}) to $t$. - -For example, consider multiplying $576$ by $241$. That is equivalent to computing $10^0(1)(576) + 10^1(4)(576) + 10^2(2)(576)$ which is best -visualized in the following table. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{|c|c|c|c|c|c|l|} -\hline && & 5 & 7 & 6 & \\ -\hline $\times$&& & 2 & 4 & 1 & \\ -\hline &&&&&&\\ - && & 5 & 7 & 6 & $10^0(1)(576)$ \\ - &2 & 3 & 6 & 1 & 6 & $10^1(4)(576) + 10^0(1)(576)$ \\ - 1 & 3 & 8 & 8 & 1 & 6 & $10^2(2)(576) + 10^1(4)(576) + 10^0(1)(576)$ \\ -\hline -\end{tabular} -\end{center} -\caption{Long-Hand Multiplication Diagram} -\end{figure} - -Each row of the product is added to the result after being shifted to the left (\textit{multiplied by a power of the radix}) by the appropriate -count. That is in pass $ix$ of the inner loop the product is added starting at the $ix$'th digit of the reult. - -Step 5.4.1 introduces the hat symbol (\textit{e.g. $\hat r$}) which represents a double precision variable. The multiplication on that step -is assumed to be a double wide output single precision multiplication. That is, two single precision variables are multiplied to produce a -double precision result. The step is somewhat optimized from a long-hand multiplication algorithm because the carry from the addition in step -5.4.1 is propagated through the nested loop. If the carry was not propagated immediately it would overflow the single precision digit -$t_{ix+iy}$ and the result would be lost. - -At step 5.5 the nested loop is finished and any carry that was left over should be forwarded. The carry does not have to be added to the $ix+pb$'th -digit since that digit is assumed to be zero at this point. However, if $ix + pb \ge digs$ the carry is not set as it would make the result -exceed the precision requested. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_s\_mp\_mul\_digs.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* multiplies |a| * |b| and only computes upto digs digits of result -018 * HAC pp. 595, Algorithm 14.12 Modified so you can control how -019 * many digits of output are created. -020 */ -021 int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) -022 \{ -023 mp_int t; -024 int res, pa, pb, ix, iy; -025 mp_digit u; -026 mp_word r; -027 mp_digit tmpx, *tmpt, *tmpy; -028 -029 /* can we use the fast multiplier? */ -030 if (((digs) < MP_WARRAY) && -031 (MIN (a->used, b->used) < -032 (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) \{ -033 return fast_s_mp_mul_digs (a, b, c, digs); -034 \} -035 -036 if ((res = mp_init_size (&t, digs)) != MP_OKAY) \{ -037 return res; -038 \} -039 t.used = digs; -040 -041 /* compute the digits of the product directly */ -042 pa = a->used; -043 for (ix = 0; ix < pa; ix++) \{ -044 /* set the carry to zero */ -045 u = 0; -046 -047 /* limit ourselves to making digs digits of output */ -048 pb = MIN (b->used, digs - ix); -049 -050 /* setup some aliases */ -051 /* copy of the digit from a used within the nested loop */ -052 tmpx = a->dp[ix]; -053 -054 /* an alias for the destination shifted ix places */ -055 tmpt = t.dp + ix; -056 -057 /* an alias for the digits of b */ -058 tmpy = b->dp; -059 -060 /* compute the columns of the output and propagate the carry */ -061 for (iy = 0; iy < pb; iy++) \{ -062 /* compute the column as a mp_word */ -063 r = (mp_word)*tmpt + -064 ((mp_word)tmpx * (mp_word)*tmpy++) + -065 (mp_word)u; -066 -067 /* the new column is the lower part of the result */ -068 *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); -069 -070 /* get the carry word from the result */ -071 u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); -072 \} -073 /* set carry if it is placed below digs */ -074 if ((ix + iy) < digs) \{ -075 *tmpt = u; -076 \} -077 \} -078 -079 mp_clamp (&t); -080 mp_exch (&t, c); -081 -082 mp_clear (&t); -083 return MP_OKAY; -084 \} -085 #endif -086 -\end{alltt} -\end{small} - -First we determine (line 30) if the Comba method can be used first since it's faster. The conditions for -sing the Comba routine are that min$(a.used, b.used) < \delta$ and the number of digits of output is less than -\textbf{MP\_WARRAY}. This new constant is used to control the stack usage in the Comba routines. By default it is -set to $\delta$ but can be reduced when memory is at a premium. - -If we cannot use the Comba method we proceed to setup the baseline routine. We allocate the the destination mp\_int -$t$ (line 36) to the exact size of the output to avoid further re--allocations. At this point we now -begin the $O(n^2)$ loop. - -This implementation of multiplication has the caveat that it can be trimmed to only produce a variable number of -digits as output. In each iteration of the outer loop the $pb$ variable is set (line 48) to the maximum -number of inner loop iterations. - -Inside the inner loop we calculate $\hat r$ as the mp\_word product of the two mp\_digits and the addition of the -carry from the previous iteration. A particularly important observation is that most modern optimizing -C compilers (GCC for instance) can recognize that a $N \times N \rightarrow 2N$ multiplication is all that -is required for the product. In x86 terms for example, this means using the MUL instruction. - -Each digit of the product is stored in turn (line 68) and the carry propagated (line 71) to the -next iteration. - -\subsection{Faster Multiplication by the ``Comba'' Method} - -One of the huge drawbacks of the ``baseline'' algorithms is that at the $O(n^2)$ level the carry must be -computed and propagated upwards. This makes the nested loop very sequential and hard to unroll and implement -in parallel. The ``Comba'' \cite{COMBA} method is named after little known (\textit{in cryptographic venues}) Paul G. -Comba who described a method of implementing fast multipliers that do not require nested carry fixup operations. As an -interesting aside it seems that Paul Barrett describes a similar technique in his 1986 paper \cite{BARRETT} written -five years before. - -At the heart of the Comba technique is once again the long-hand algorithm. Except in this case a slight -twist is placed on how the columns of the result are produced. In the standard long-hand algorithm rows of products -are produced then added together to form the final result. In the baseline algorithm the columns are added together -after each iteration to get the result instantaneously. - -In the Comba algorithm the columns of the result are produced entirely independently of each other. That is at -the $O(n^2)$ level a simple multiplication and addition step is performed. The carries of the columns are propagated -after the nested loop to reduce the amount of work requiored. Succintly the first step of the algorithm is to compute -the product vector $\vec x$ as follows. - -\begin{equation} -\vec x_n = \sum_{i+j = n} a_ib_j, \forall n \in \lbrace 0, 1, 2, \ldots, i + j \rbrace -\end{equation} - -Where $\vec x_n$ is the $n'th$ column of the output vector. Consider the following example which computes the vector $\vec x$ for the multiplication -of $576$ and $241$. - -\newpage\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|c|c|c|c|c|} - \hline & & 5 & 7 & 6 & First Input\\ - \hline $\times$ & & 2 & 4 & 1 & Second Input\\ -\hline & & $1 \cdot 5 = 5$ & $1 \cdot 7 = 7$ & $1 \cdot 6 = 6$ & First pass \\ - & $4 \cdot 5 = 20$ & $4 \cdot 7+5=33$ & $4 \cdot 6+7=31$ & 6 & Second pass \\ - $2 \cdot 5 = 10$ & $2 \cdot 7 + 20 = 34$ & $2 \cdot 6+33=45$ & 31 & 6 & Third pass \\ -\hline 10 & 34 & 45 & 31 & 6 & Final Result \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Comba Multiplication Diagram} -\end{figure} - -At this point the vector $x = \left < 10, 34, 45, 31, 6 \right >$ is the result of the first step of the Comba multipler. -Now the columns must be fixed by propagating the carry upwards. The resultant vector will have one extra dimension over the input vector which is -congruent to adding a leading zero digit. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Comba Fixup}. \\ -\textbf{Input}. Vector $\vec x$ of dimension $k$ \\ -\textbf{Output}. Vector $\vec x$ such that the carries have been propagated. \\ -\hline \\ -1. for $n$ from $0$ to $k - 1$ do \\ -\hspace{3mm}1.1 $\vec x_{n+1} \leftarrow \vec x_{n+1} + \lfloor \vec x_{n}/\beta \rfloor$ \\ -\hspace{3mm}1.2 $\vec x_{n} \leftarrow \vec x_{n} \mbox{ (mod }\beta\mbox{)}$ \\ -2. Return($\vec x$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Comba Fixup} -\end{figure} - -With that algorithm and $k = 5$ and $\beta = 10$ the following vector is produced $\vec x= \left < 1, 3, 8, 8, 1, 6 \right >$. In this case -$241 \cdot 576$ is in fact $138816$ and the procedure succeeded. If the algorithm is correct and as will be demonstrated shortly more -efficient than the baseline algorithm why not simply always use this algorithm? - -\subsubsection{Column Weight.} -At the nested $O(n^2)$ level the Comba method adds the product of two single precision variables to each column of the output -independently. A serious obstacle is if the carry is lost, due to lack of precision before the algorithm has a chance to fix -the carries. For example, in the multiplication of two three-digit numbers the third column of output will be the sum of -three single precision multiplications. If the precision of the accumulator for the output digits is less then $3 \cdot (\beta - 1)^2$ then -an overflow can occur and the carry information will be lost. For any $m$ and $n$ digit inputs the maximum weight of any column is -min$(m, n)$ which is fairly obvious. - -The maximum number of terms in any column of a product is known as the ``column weight'' and strictly governs when the algorithm can be used. Recall -from earlier that a double precision type has $\alpha$ bits of resolution and a single precision digit has $lg(\beta)$ bits of precision. Given these -two quantities we must not violate the following - -\begin{equation} -k \cdot \left (\beta - 1 \right )^2 < 2^{\alpha} -\end{equation} - -Which reduces to - -\begin{equation} -k \cdot \left ( \beta^2 - 2\beta + 1 \right ) < 2^{\alpha} -\end{equation} - -Let $\rho = lg(\beta)$ represent the number of bits in a single precision digit. By further re-arrangement of the equation the final solution is -found. - -\begin{equation} -k < {{2^{\alpha}} \over {\left (2^{2\rho} - 2^{\rho + 1} + 1 \right )}} -\end{equation} - -The defaults for LibTomMath are $\beta = 2^{28}$ and $\alpha = 2^{64}$ which means that $k$ is bounded by $k < 257$. In this configuration -the smaller input may not have more than $256$ digits if the Comba method is to be used. This is quite satisfactory for most applications since -$256$ digits would allow for numbers in the range of $0 \le x < 2^{7168}$ which, is much larger than most public key cryptographic algorithms require. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{fast\_s\_mp\_mul\_digs}. \\ -\textbf{Input}. mp\_int $a$, mp\_int $b$ and an integer $digs$ \\ -\textbf{Output}. $c \leftarrow \vert a \vert \cdot \vert b \vert \mbox{ (mod }\beta^{digs}\mbox{)}$. \\ -\hline \\ -Place an array of \textbf{MP\_WARRAY} single precision digits named $W$ on the stack. \\ -1. If $c.alloc < digs$ then grow $c$ to $digs$ digits. (\textit{mp\_grow}) \\ -2. If step 1 failed return(\textit{MP\_MEM}).\\ -\\ -3. $pa \leftarrow \mbox{MIN}(digs, a.used + b.used)$ \\ -\\ -4. $\_ \hat W \leftarrow 0$ \\ -5. for $ix$ from 0 to $pa - 1$ do \\ -\hspace{3mm}5.1 $ty \leftarrow \mbox{MIN}(b.used - 1, ix)$ \\ -\hspace{3mm}5.2 $tx \leftarrow ix - ty$ \\ -\hspace{3mm}5.3 $iy \leftarrow \mbox{MIN}(a.used - tx, ty + 1)$ \\ -\hspace{3mm}5.4 for $iz$ from 0 to $iy - 1$ do \\ -\hspace{6mm}5.4.1 $\_ \hat W \leftarrow \_ \hat W + a_{tx+iy}b_{ty-iy}$ \\ -\hspace{3mm}5.5 $W_{ix} \leftarrow \_ \hat W (\mbox{mod }\beta)$\\ -\hspace{3mm}5.6 $\_ \hat W \leftarrow \lfloor \_ \hat W / \beta \rfloor$ \\ -\\ -6. $oldused \leftarrow c.used$ \\ -7. $c.used \leftarrow digs$ \\ -8. for $ix$ from $0$ to $pa$ do \\ -\hspace{3mm}8.1 $c_{ix} \leftarrow W_{ix}$ \\ -9. for $ix$ from $pa + 1$ to $oldused - 1$ do \\ -\hspace{3mm}9.1 $c_{ix} \leftarrow 0$ \\ -\\ -10. Clamp $c$. \\ -11. Return MP\_OKAY. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm fast\_s\_mp\_mul\_digs} -\label{fig:COMBAMULT} -\end{figure} - -\textbf{Algorithm fast\_s\_mp\_mul\_digs.} -This algorithm performs the unsigned multiplication of $a$ and $b$ using the Comba method limited to $digs$ digits of precision. - -The outer loop of this algorithm is more complicated than that of the baseline multiplier. This is because on the inside of the -loop we want to produce one column per pass. This allows the accumulator $\_ \hat W$ to be placed in CPU registers and -reduce the memory bandwidth to two \textbf{mp\_digit} reads per iteration. - -The $ty$ variable is set to the minimum count of $ix$ or the number of digits in $b$. That way if $a$ has more digits than -$b$ this will be limited to $b.used - 1$. The $tx$ variable is set to the to the distance past $b.used$ the variable -$ix$ is. This is used for the immediately subsequent statement where we find $iy$. - -The variable $iy$ is the minimum digits we can read from either $a$ or $b$ before running out. Computing one column at a time -means we have to scan one integer upwards and the other downwards. $a$ starts at $tx$ and $b$ starts at $ty$. In each -pass we are producing the $ix$'th output column and we note that $tx + ty = ix$. As we move $tx$ upwards we have to -move $ty$ downards so the equality remains valid. The $iy$ variable is the number of iterations until -$tx \ge a.used$ or $ty < 0$ occurs. - -After every inner pass we store the lower half of the accumulator into $W_{ix}$ and then propagate the carry of the accumulator -into the next round by dividing $\_ \hat W$ by $\beta$. - -To measure the benefits of the Comba method over the baseline method consider the number of operations that are required. If the -cost in terms of time of a multiply and addition is $p$ and the cost of a carry propagation is $q$ then a baseline multiplication would require -$O \left ((p + q)n^2 \right )$ time to multiply two $n$-digit numbers. The Comba method requires only $O(pn^2 + qn)$ time, however in practice, -the speed increase is actually much more. With $O(n)$ space the algorithm can be reduced to $O(pn + qn)$ time by implementing the $n$ multiply -and addition operations in the nested loop in parallel. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_fast\_s\_mp\_mul\_digs.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* Fast (comba) multiplier -018 * -019 * This is the fast column-array [comba] multiplier. It is -020 * designed to compute the columns of the product first -021 * then handle the carries afterwards. This has the effect -022 * of making the nested loops that compute the columns very -023 * simple and schedulable on super-scalar processors. -024 * -025 * This has been modified to produce a variable number of -026 * digits of output so if say only a half-product is required -027 * you don't have to compute the upper half (a feature -028 * required for fast Barrett reduction). -029 * -030 * Based on Algorithm 14.12 on pp.595 of HAC. -031 * -032 */ -033 int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) -034 \{ -035 int olduse, res, pa, ix, iz; -036 mp_digit W[MP_WARRAY]; -037 mp_word _W; -038 -039 /* grow the destination as required */ -040 if (c->alloc < digs) \{ -041 if ((res = mp_grow (c, digs)) != MP_OKAY) \{ -042 return res; -043 \} -044 \} -045 -046 /* number of output digits to produce */ -047 pa = MIN(digs, a->used + b->used); -048 -049 /* clear the carry */ -050 _W = 0; -051 for (ix = 0; ix < pa; ix++) \{ -052 int tx, ty; -053 int iy; -054 mp_digit *tmpx, *tmpy; -055 -056 /* get offsets into the two bignums */ -057 ty = MIN(b->used-1, ix); -058 tx = ix - ty; -059 -060 /* setup temp aliases */ -061 tmpx = a->dp + tx; -062 tmpy = b->dp + ty; -063 -064 /* this is the number of times the loop will iterrate, essentially -065 while (tx++ < a->used && ty-- >= 0) \{ ... \} -066 */ -067 iy = MIN(a->used-tx, ty+1); -068 -069 /* execute loop */ -070 for (iz = 0; iz < iy; ++iz) \{ -071 _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--); -072 -073 \} -074 -075 /* store term */ -076 W[ix] = ((mp_digit)_W) & MP_MASK; -077 -078 /* make next carry */ -079 _W = _W >> ((mp_word)DIGIT_BIT); -080 \} -081 -082 /* setup dest */ -083 olduse = c->used; -084 c->used = pa; -085 -086 \{ -087 mp_digit *tmpc; -088 tmpc = c->dp; -089 for (ix = 0; ix < (pa + 1); ix++) \{ -090 /* now extract the previous digit [below the carry] */ -091 *tmpc++ = W[ix]; -092 \} -093 -094 /* clear unused digits [that existed in the old copy of c] */ -095 for (; ix < olduse; ix++) \{ -096 *tmpc++ = 0; -097 \} -098 \} -099 mp_clamp (c); -100 return MP_OKAY; -101 \} -102 #endif -103 -\end{alltt} -\end{small} - -As per the pseudo--code we first calculate $pa$ (line 47) as the number of digits to output. Next we begin the outer loop -to produce the individual columns of the product. We use the two aliases $tmpx$ and $tmpy$ (lines 61, 62) to point -inside the two multiplicands quickly. - -The inner loop (lines 70 to 73) of this implementation is where the tradeoff come into play. Originally this comba -implementation was ``row--major'' which means it adds to each of the columns in each pass. After the outer loop it would then fix -the carries. This was very fast except it had an annoying drawback. You had to read a mp\_word and two mp\_digits and write -one mp\_word per iteration. On processors such as the Athlon XP and P4 this did not matter much since the cache bandwidth -is very high and it can keep the ALU fed with data. It did, however, matter on older and embedded cpus where cache is often -slower and also often doesn't exist. This new algorithm only performs two reads per iteration under the assumption that the -compiler has aliased $\_ \hat W$ to a CPU register. - -After the inner loop we store the current accumulator in $W$ and shift $\_ \hat W$ (lines 76, 79) to forward it as -a carry for the next pass. After the outer loop we use the final carry (line 76) as the last digit of the product. - -\subsection{Polynomial Basis Multiplication} -To break the $O(n^2)$ barrier in multiplication requires a completely different look at integer multiplication. In the following algorithms -the use of polynomial basis representation for two integers $a$ and $b$ as $f(x) = \sum_{i=0}^{n} a_i x^i$ and -$g(x) = \sum_{i=0}^{n} b_i x^i$ respectively, is required. In this system both $f(x)$ and $g(x)$ have $n + 1$ terms and are of the $n$'th degree. - -The product $a \cdot b \equiv f(x)g(x)$ is the polynomial $W(x) = \sum_{i=0}^{2n} w_i x^i$. The coefficients $w_i$ will -directly yield the desired product when $\beta$ is substituted for $x$. The direct solution to solve for the $2n + 1$ coefficients -requires $O(n^2)$ time and would in practice be slower than the Comba technique. - -However, numerical analysis theory indicates that only $2n + 1$ distinct points in $W(x)$ are required to determine the values of the $2n + 1$ unknown -coefficients. This means by finding $\zeta_y = W(y)$ for $2n + 1$ small values of $y$ the coefficients of $W(x)$ can be found with -Gaussian elimination. This technique is also occasionally refered to as the \textit{interpolation technique} (\textit{references please...}) since in -effect an interpolation based on $2n + 1$ points will yield a polynomial equivalent to $W(x)$. - -The coefficients of the polynomial $W(x)$ are unknown which makes finding $W(y)$ for any value of $y$ impossible. However, since -$W(x) = f(x)g(x)$ the equivalent $\zeta_y = f(y) g(y)$ can be used in its place. The benefit of this technique stems from the -fact that $f(y)$ and $g(y)$ are much smaller than either $a$ or $b$ respectively. As a result finding the $2n + 1$ relations required -by multiplying $f(y)g(y)$ involves multiplying integers that are much smaller than either of the inputs. - -When picking points to gather relations there are always three obvious points to choose, $y = 0, 1$ and $ \infty$. The $\zeta_0$ term -is simply the product $W(0) = w_0 = a_0 \cdot b_0$. The $\zeta_1$ term is the product -$W(1) = \left (\sum_{i = 0}^{n} a_i \right ) \left (\sum_{i = 0}^{n} b_i \right )$. The third point $\zeta_{\infty}$ is less obvious but rather -simple to explain. The $2n + 1$'th coefficient of $W(x)$ is numerically equivalent to the most significant column in an integer multiplication. -The point at $\infty$ is used symbolically to represent the most significant column, that is $W(\infty) = w_{2n} = a_nb_n$. Note that the -points at $y = 0$ and $\infty$ yield the coefficients $w_0$ and $w_{2n}$ directly. - -If more points are required they should be of small values and powers of two such as $2^q$ and the related \textit{mirror points} -$\left (2^q \right )^{2n} \cdot \zeta_{2^{-q}}$ for small values of $q$. The term ``mirror point'' stems from the fact that -$\left (2^q \right )^{2n} \cdot \zeta_{2^{-q}}$ can be calculated in the exact opposite fashion as $\zeta_{2^q}$. For -example, when $n = 2$ and $q = 1$ then following two equations are equivalent to the point $\zeta_{2}$ and its mirror. - -\begin{eqnarray} -\zeta_{2} = f(2)g(2) = (4a_2 + 2a_1 + a_0)(4b_2 + 2b_1 + b_0) \nonumber \\ -16 \cdot \zeta_{1 \over 2} = 4f({1\over 2}) \cdot 4g({1 \over 2}) = (a_2 + 2a_1 + 4a_0)(b_2 + 2b_1 + 4b_0) -\end{eqnarray} - -Using such points will allow the values of $f(y)$ and $g(y)$ to be independently calculated using only left shifts. For example, when $n = 2$ the -polynomial $f(2^q)$ is equal to $2^q((2^qa_2) + a_1) + a_0$. This technique of polynomial representation is known as Horner's method. - -As a general rule of the algorithm when the inputs are split into $n$ parts each there are $2n - 1$ multiplications. Each multiplication is of -multiplicands that have $n$ times fewer digits than the inputs. The asymptotic running time of this algorithm is -$O \left ( k^{lg_n(2n - 1)} \right )$ for $k$ digit inputs (\textit{assuming they have the same number of digits}). Figure~\ref{fig:exponent} -summarizes the exponents for various values of $n$. - -\begin{figure} -\begin{center} -\begin{tabular}{|c|c|c|} -\hline \textbf{Split into $n$ Parts} & \textbf{Exponent} & \textbf{Notes}\\ -\hline $2$ & $1.584962501$ & This is Karatsuba Multiplication. \\ -\hline $3$ & $1.464973520$ & This is Toom-Cook Multiplication. \\ -\hline $4$ & $1.403677461$ &\\ -\hline $5$ & $1.365212389$ &\\ -\hline $10$ & $1.278753601$ &\\ -\hline $100$ & $1.149426538$ &\\ -\hline $1000$ & $1.100270931$ &\\ -\hline $10000$ & $1.075252070$ &\\ -\hline -\end{tabular} -\end{center} -\caption{Asymptotic Running Time of Polynomial Basis Multiplication} -\label{fig:exponent} -\end{figure} - -At first it may seem like a good idea to choose $n = 1000$ since the exponent is approximately $1.1$. However, the overhead -of solving for the 2001 terms of $W(x)$ will certainly consume any savings the algorithm could offer for all but exceedingly large -numbers. - -\subsubsection{Cutoff Point} -The polynomial basis multiplication algorithms all require fewer single precision multiplications than a straight Comba approach. However, -the algorithms incur an overhead (\textit{at the $O(n)$ work level}) since they require a system of equations to be solved. This makes the -polynomial basis approach more costly to use with small inputs. - -Let $m$ represent the number of digits in the multiplicands (\textit{assume both multiplicands have the same number of digits}). There exists a -point $y$ such that when $m < y$ the polynomial basis algorithms are more costly than Comba, when $m = y$ they are roughly the same cost and -when $m > y$ the Comba methods are slower than the polynomial basis algorithms. - -The exact location of $y$ depends on several key architectural elements of the computer platform in question. - -\begin{enumerate} -\item The ratio of clock cycles for single precision multiplication versus other simpler operations such as addition, shifting, etc. For example -on the AMD Athlon the ratio is roughly $17 : 1$ while on the Intel P4 it is $29 : 1$. The higher the ratio in favour of multiplication the lower -the cutoff point $y$ will be. - -\item The complexity of the linear system of equations (\textit{for the coefficients of $W(x)$}) is. Generally speaking as the number of splits -grows the complexity grows substantially. Ideally solving the system will only involve addition, subtraction and shifting of integers. This -directly reflects on the ratio previous mentioned. - -\item To a lesser extent memory bandwidth and function call overheads. Provided the values are in the processor cache this is less of an -influence over the cutoff point. - -\end{enumerate} - -A clean cutoff point separation occurs when a point $y$ is found such that all of the cutoff point conditions are met. For example, if the point -is too low then there will be values of $m$ such that $m > y$ and the Comba method is still faster. Finding the cutoff points is fairly simple when -a high resolution timer is available. - -\subsection{Karatsuba Multiplication} -Karatsuba \cite{KARA} multiplication when originally proposed in 1962 was among the first set of algorithms to break the $O(n^2)$ barrier for -general purpose multiplication. Given two polynomial basis representations $f(x) = ax + b$ and $g(x) = cx + d$, Karatsuba proved with -light algebra \cite{KARAP} that the following polynomial is equivalent to multiplication of the two integers the polynomials represent. - -\begin{equation} -f(x) \cdot g(x) = acx^2 + ((a + b)(c + d) - (ac + bd))x + bd -\end{equation} - -Using the observation that $ac$ and $bd$ could be re-used only three half sized multiplications would be required to produce the product. Applying -this algorithm recursively, the work factor becomes $O(n^{lg(3)})$ which is substantially better than the work factor $O(n^2)$ of the Comba technique. It turns -out what Karatsuba did not know or at least did not publish was that this is simply polynomial basis multiplication with the points -$\zeta_0$, $\zeta_{\infty}$ and $\zeta_{1}$. Consider the resultant system of equations. - -\begin{center} -\begin{tabular}{rcrcrcrc} -$\zeta_{0}$ & $=$ & & & & & $w_0$ \\ -$\zeta_{1}$ & $=$ & $w_2$ & $+$ & $w_1$ & $+$ & $w_0$ \\ -$\zeta_{\infty}$ & $=$ & $w_2$ & & & & \\ -\end{tabular} -\end{center} - -By adding the first and last equation to the equation in the middle the term $w_1$ can be isolated and all three coefficients solved for. The simplicity -of this system of equations has made Karatsuba fairly popular. In fact the cutoff point is often fairly low\footnote{With LibTomMath 0.18 it is 70 and 109 digits for the Intel P4 and AMD Athlon respectively.} -making it an ideal algorithm to speed up certain public key cryptosystems such as RSA and Diffie-Hellman. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_karatsuba\_mul}. \\ -\textbf{Input}. mp\_int $a$ and mp\_int $b$ \\ -\textbf{Output}. $c \leftarrow \vert a \vert \cdot \vert b \vert$ \\ -\hline \\ -1. Init the following mp\_int variables: $x0$, $x1$, $y0$, $y1$, $t1$, $x0y0$, $x1y1$.\\ -2. If step 2 failed then return(\textit{MP\_MEM}). \\ -\\ -Split the input. e.g. $a = x1 \cdot \beta^B + x0$ \\ -3. $B \leftarrow \mbox{min}(a.used, b.used)/2$ \\ -4. $x0 \leftarrow a \mbox{ (mod }\beta^B\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -5. $y0 \leftarrow b \mbox{ (mod }\beta^B\mbox{)}$ \\ -6. $x1 \leftarrow \lfloor a / \beta^B \rfloor$ (\textit{mp\_rshd}) \\ -7. $y1 \leftarrow \lfloor b / \beta^B \rfloor$ \\ -\\ -Calculate the three products. \\ -8. $x0y0 \leftarrow x0 \cdot y0$ (\textit{mp\_mul}) \\ -9. $x1y1 \leftarrow x1 \cdot y1$ \\ -10. $t1 \leftarrow x1 + x0$ (\textit{mp\_add}) \\ -11. $x0 \leftarrow y1 + y0$ \\ -12. $t1 \leftarrow t1 \cdot x0$ \\ -\\ -Calculate the middle term. \\ -13. $x0 \leftarrow x0y0 + x1y1$ \\ -14. $t1 \leftarrow t1 - x0$ (\textit{s\_mp\_sub}) \\ -\\ -Calculate the final product. \\ -15. $t1 \leftarrow t1 \cdot \beta^B$ (\textit{mp\_lshd}) \\ -16. $x1y1 \leftarrow x1y1 \cdot \beta^{2B}$ \\ -17. $t1 \leftarrow x0y0 + t1$ \\ -18. $c \leftarrow t1 + x1y1$ \\ -19. Clear all of the temporary variables. \\ -20. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_karatsuba\_mul} -\end{figure} - -\textbf{Algorithm mp\_karatsuba\_mul.} -This algorithm computes the unsigned product of two inputs using the Karatsuba multiplication algorithm. It is loosely based on the description -from Knuth \cite[pp. 294-295]{TAOCPV2}. - -\index{radix point} -In order to split the two inputs into their respective halves, a suitable \textit{radix point} must be chosen. The radix point chosen must -be used for both of the inputs meaning that it must be smaller than the smallest input. Step 3 chooses the radix point $B$ as half of the -smallest input \textbf{used} count. After the radix point is chosen the inputs are split into lower and upper halves. Step 4 and 5 -compute the lower halves. Step 6 and 7 computer the upper halves. - -After the halves have been computed the three intermediate half-size products must be computed. Step 8 and 9 compute the trivial products -$x0 \cdot y0$ and $x1 \cdot y1$. The mp\_int $x0$ is used as a temporary variable after $x1 + x0$ has been computed. By using $x0$ instead -of an additional temporary variable, the algorithm can avoid an addition memory allocation operation. - -The remaining steps 13 through 18 compute the Karatsuba polynomial through a variety of digit shifting and addition operations. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_karatsuba\_mul.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* c = |a| * |b| using Karatsuba Multiplication using -018 * three half size multiplications -019 * -020 * Let B represent the radix [e.g. 2**DIGIT_BIT] and -021 * let n represent half of the number of digits in -022 * the min(a,b) -023 * -024 * a = a1 * B**n + a0 -025 * b = b1 * B**n + b0 -026 * -027 * Then, a * b => -028 a1b1 * B**2n + ((a1 + a0)(b1 + b0) - (a0b0 + a1b1)) * B + a0b0 -029 * -030 * Note that a1b1 and a0b0 are used twice and only need to be -031 * computed once. So in total three half size (half # of -032 * digit) multiplications are performed, a0b0, a1b1 and -033 * (a1+b1)(a0+b0) -034 * -035 * Note that a multiplication of half the digits requires -036 * 1/4th the number of single precision multiplications so in -037 * total after one call 25% of the single precision multiplications -038 * are saved. Note also that the call to mp_mul can end up back -039 * in this function if the a0, a1, b0, or b1 are above the threshold. -040 * This is known as divide-and-conquer and leads to the famous -041 * O(N**lg(3)) or O(N**1.584) work which is asymptopically lower than -042 * the standard O(N**2) that the baseline/comba methods use. -043 * Generally though the overhead of this method doesn't pay off -044 * until a certain size (N ~ 80) is reached. -045 */ -046 int mp_karatsuba_mul (mp_int * a, mp_int * b, mp_int * c) -047 \{ -048 mp_int x0, x1, y0, y1, t1, x0y0, x1y1; -049 int B, err; -050 -051 /* default the return code to an error */ -052 err = MP_MEM; -053 -054 /* min # of digits */ -055 B = MIN (a->used, b->used); -056 -057 /* now divide in two */ -058 B = B >> 1; -059 -060 /* init copy all the temps */ -061 if (mp_init_size (&x0, B) != MP_OKAY) -062 goto ERR; -063 if (mp_init_size (&x1, a->used - B) != MP_OKAY) -064 goto X0; -065 if (mp_init_size (&y0, B) != MP_OKAY) -066 goto X1; -067 if (mp_init_size (&y1, b->used - B) != MP_OKAY) -068 goto Y0; -069 -070 /* init temps */ -071 if (mp_init_size (&t1, B * 2) != MP_OKAY) -072 goto Y1; -073 if (mp_init_size (&x0y0, B * 2) != MP_OKAY) -074 goto T1; -075 if (mp_init_size (&x1y1, B * 2) != MP_OKAY) -076 goto X0Y0; -077 -078 /* now shift the digits */ -079 x0.used = y0.used = B; -080 x1.used = a->used - B; -081 y1.used = b->used - B; -082 -083 \{ -084 int x; -085 mp_digit *tmpa, *tmpb, *tmpx, *tmpy; -086 -087 /* we copy the digits directly instead of using higher level functions -088 * since we also need to shift the digits -089 */ -090 tmpa = a->dp; -091 tmpb = b->dp; -092 -093 tmpx = x0.dp; -094 tmpy = y0.dp; -095 for (x = 0; x < B; x++) \{ -096 *tmpx++ = *tmpa++; -097 *tmpy++ = *tmpb++; -098 \} -099 -100 tmpx = x1.dp; -101 for (x = B; x < a->used; x++) \{ -102 *tmpx++ = *tmpa++; -103 \} -104 -105 tmpy = y1.dp; -106 for (x = B; x < b->used; x++) \{ -107 *tmpy++ = *tmpb++; -108 \} -109 \} -110 -111 /* only need to clamp the lower words since by definition the -112 * upper words x1/y1 must have a known number of digits -113 */ -114 mp_clamp (&x0); -115 mp_clamp (&y0); -116 -117 /* now calc the products x0y0 and x1y1 */ -118 /* after this x0 is no longer required, free temp [x0==t2]! */ -119 if (mp_mul (&x0, &y0, &x0y0) != MP_OKAY) -120 goto X1Y1; /* x0y0 = x0*y0 */ -121 if (mp_mul (&x1, &y1, &x1y1) != MP_OKAY) -122 goto X1Y1; /* x1y1 = x1*y1 */ -123 -124 /* now calc x1+x0 and y1+y0 */ -125 if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) -126 goto X1Y1; /* t1 = x1 - x0 */ -127 if (s_mp_add (&y1, &y0, &x0) != MP_OKAY) -128 goto X1Y1; /* t2 = y1 - y0 */ -129 if (mp_mul (&t1, &x0, &t1) != MP_OKAY) -130 goto X1Y1; /* t1 = (x1 + x0) * (y1 + y0) */ -131 -132 /* add x0y0 */ -133 if (mp_add (&x0y0, &x1y1, &x0) != MP_OKAY) -134 goto X1Y1; /* t2 = x0y0 + x1y1 */ -135 if (s_mp_sub (&t1, &x0, &t1) != MP_OKAY) -136 goto X1Y1; /* t1 = (x1+x0)*(y1+y0) - (x1y1 + x0y0) */ -137 -138 /* shift by B */ -139 if (mp_lshd (&t1, B) != MP_OKAY) -140 goto X1Y1; /* t1 = (x0y0 + x1y1 - (x1-x0)*(y1-y0))<used, b->used) / 3; -038 -039 /* a = a2 * B**2 + a1 * B + a0 */ -040 if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) \{ -041 goto ERR; -042 \} -043 -044 if ((res = mp_copy(a, &a1)) != MP_OKAY) \{ -045 goto ERR; -046 \} -047 mp_rshd(&a1, B); -048 if ((res = mp_mod_2d(&a1, DIGIT_BIT * B, &a1)) != MP_OKAY) \{ -049 goto ERR; -050 \} -051 -052 if ((res = mp_copy(a, &a2)) != MP_OKAY) \{ -053 goto ERR; -054 \} -055 mp_rshd(&a2, B*2); -056 -057 /* b = b2 * B**2 + b1 * B + b0 */ -058 if ((res = mp_mod_2d(b, DIGIT_BIT * B, &b0)) != MP_OKAY) \{ -059 goto ERR; -060 \} -061 -062 if ((res = mp_copy(b, &b1)) != MP_OKAY) \{ -063 goto ERR; -064 \} -065 mp_rshd(&b1, B); -066 (void)mp_mod_2d(&b1, DIGIT_BIT * B, &b1); -067 -068 if ((res = mp_copy(b, &b2)) != MP_OKAY) \{ -069 goto ERR; -070 \} -071 mp_rshd(&b2, B*2); -072 -073 /* w0 = a0*b0 */ -074 if ((res = mp_mul(&a0, &b0, &w0)) != MP_OKAY) \{ -075 goto ERR; -076 \} -077 -078 /* w4 = a2 * b2 */ -079 if ((res = mp_mul(&a2, &b2, &w4)) != MP_OKAY) \{ -080 goto ERR; -081 \} -082 -083 /* w1 = (a2 + 2(a1 + 2a0))(b2 + 2(b1 + 2b0)) */ -084 if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) \{ -085 goto ERR; -086 \} -087 if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) \{ -088 goto ERR; -089 \} -090 if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) \{ -091 goto ERR; -092 \} -093 if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) \{ -094 goto ERR; -095 \} -096 -097 if ((res = mp_mul_2(&b0, &tmp2)) != MP_OKAY) \{ -098 goto ERR; -099 \} -100 if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) \{ -101 goto ERR; -102 \} -103 if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) \{ -104 goto ERR; -105 \} -106 if ((res = mp_add(&tmp2, &b2, &tmp2)) != MP_OKAY) \{ -107 goto ERR; -108 \} -109 -110 if ((res = mp_mul(&tmp1, &tmp2, &w1)) != MP_OKAY) \{ -111 goto ERR; -112 \} -113 -114 /* w3 = (a0 + 2(a1 + 2a2))(b0 + 2(b1 + 2b2)) */ -115 if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) \{ -116 goto ERR; -117 \} -118 if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) \{ -119 goto ERR; -120 \} -121 if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) \{ -122 goto ERR; -123 \} -124 if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) \{ -125 goto ERR; -126 \} -127 -128 if ((res = mp_mul_2(&b2, &tmp2)) != MP_OKAY) \{ -129 goto ERR; -130 \} -131 if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) \{ -132 goto ERR; -133 \} -134 if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) \{ -135 goto ERR; -136 \} -137 if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) \{ -138 goto ERR; -139 \} -140 -141 if ((res = mp_mul(&tmp1, &tmp2, &w3)) != MP_OKAY) \{ -142 goto ERR; -143 \} -144 -145 -146 /* w2 = (a2 + a1 + a0)(b2 + b1 + b0) */ -147 if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) \{ -148 goto ERR; -149 \} -150 if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) \{ -151 goto ERR; -152 \} -153 if ((res = mp_add(&b2, &b1, &tmp2)) != MP_OKAY) \{ -154 goto ERR; -155 \} -156 if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) \{ -157 goto ERR; -158 \} -159 if ((res = mp_mul(&tmp1, &tmp2, &w2)) != MP_OKAY) \{ -160 goto ERR; -161 \} -162 -163 /* now solve the matrix -164 -165 0 0 0 0 1 -166 1 2 4 8 16 -167 1 1 1 1 1 -168 16 8 4 2 1 -169 1 0 0 0 0 -170 -171 using 12 subtractions, 4 shifts, -172 2 small divisions and 1 small multiplication -173 */ -174 -175 /* r1 - r4 */ -176 if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) \{ -177 goto ERR; -178 \} -179 /* r3 - r0 */ -180 if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) \{ -181 goto ERR; -182 \} -183 /* r1/2 */ -184 if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) \{ -185 goto ERR; -186 \} -187 /* r3/2 */ -188 if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) \{ -189 goto ERR; -190 \} -191 /* r2 - r0 - r4 */ -192 if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) \{ -193 goto ERR; -194 \} -195 if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) \{ -196 goto ERR; -197 \} -198 /* r1 - r2 */ -199 if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) \{ -200 goto ERR; -201 \} -202 /* r3 - r2 */ -203 if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) \{ -204 goto ERR; -205 \} -206 /* r1 - 8r0 */ -207 if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) \{ -208 goto ERR; -209 \} -210 if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) \{ -211 goto ERR; -212 \} -213 /* r3 - 8r4 */ -214 if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) \{ -215 goto ERR; -216 \} -217 if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) \{ -218 goto ERR; -219 \} -220 /* 3r2 - r1 - r3 */ -221 if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) \{ -222 goto ERR; -223 \} -224 if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) \{ -225 goto ERR; -226 \} -227 if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) \{ -228 goto ERR; -229 \} -230 /* r1 - r2 */ -231 if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) \{ -232 goto ERR; -233 \} -234 /* r3 - r2 */ -235 if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) \{ -236 goto ERR; -237 \} -238 /* r1/3 */ -239 if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) \{ -240 goto ERR; -241 \} -242 /* r3/3 */ -243 if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) \{ -244 goto ERR; -245 \} -246 -247 /* at this point shift W[n] by B*n */ -248 if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) \{ -249 goto ERR; -250 \} -251 if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) \{ -252 goto ERR; -253 \} -254 if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) \{ -255 goto ERR; -256 \} -257 if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) \{ -258 goto ERR; -259 \} -260 -261 if ((res = mp_add(&w0, &w1, c)) != MP_OKAY) \{ -262 goto ERR; -263 \} -264 if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) \{ -265 goto ERR; -266 \} -267 if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) \{ -268 goto ERR; -269 \} -270 if ((res = mp_add(&tmp1, c, c)) != MP_OKAY) \{ -271 goto ERR; -272 \} -273 -274 ERR: -275 mp_clear_multi(&w0, &w1, &w2, &w3, &w4, -276 &a0, &a1, &a2, &b0, &b1, -277 &b2, &tmp1, &tmp2, NULL); -278 return res; -279 \} -280 -281 #endif -282 -\end{alltt} -\end{small} - -The first obvious thing to note is that this algorithm is complicated. The complexity is worth it if you are multiplying very -large numbers. For example, a 10,000 digit multiplication takes approximaly 99,282,205 fewer single precision multiplications with -Toom--Cook than a Comba or baseline approach (this is a savings of more than 99$\%$). For most ``crypto'' sized numbers this -algorithm is not practical as Karatsuba has a much lower cutoff point. - -First we split $a$ and $b$ into three roughly equal portions. This has been accomplished (lines 40 to 71) with -combinations of mp\_rshd() and mp\_mod\_2d() function calls. At this point $a = a2 \cdot \beta^2 + a1 \cdot \beta + a0$ and similiarly -for $b$. - -Next we compute the five points $w0, w1, w2, w3$ and $w4$. Recall that $w0$ and $w4$ can be computed directly from the portions so -we get those out of the way first (lines 74 and 79). Next we compute $w1, w2$ and $w3$ using Horners method. - -After this point we solve for the actual values of $w1, w2$ and $w3$ by reducing the $5 \times 5$ system which is relatively -straight forward. - -\subsection{Signed Multiplication} -Now that algorithms to handle multiplications of every useful dimensions have been developed, a rather simple finishing touch is required. So far all -of the multiplication algorithms have been unsigned multiplications which leaves only a signed multiplication algorithm to be established. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul}. \\ -\textbf{Input}. mp\_int $a$ and mp\_int $b$ \\ -\textbf{Output}. $c \leftarrow a \cdot b$ \\ -\hline \\ -1. If $a.sign = b.sign$ then \\ -\hspace{3mm}1.1 $sign = MP\_ZPOS$ \\ -2. else \\ -\hspace{3mm}2.1 $sign = MP\_ZNEG$ \\ -3. If min$(a.used, b.used) \ge TOOM\_MUL\_CUTOFF$ then \\ -\hspace{3mm}3.1 $c \leftarrow a \cdot b$ using algorithm mp\_toom\_mul \\ -4. else if min$(a.used, b.used) \ge KARATSUBA\_MUL\_CUTOFF$ then \\ -\hspace{3mm}4.1 $c \leftarrow a \cdot b$ using algorithm mp\_karatsuba\_mul \\ -5. else \\ -\hspace{3mm}5.1 $digs \leftarrow a.used + b.used + 1$ \\ -\hspace{3mm}5.2 If $digs < MP\_ARRAY$ and min$(a.used, b.used) \le \delta$ then \\ -\hspace{6mm}5.2.1 $c \leftarrow a \cdot b \mbox{ (mod }\beta^{digs}\mbox{)}$ using algorithm fast\_s\_mp\_mul\_digs. \\ -\hspace{3mm}5.3 else \\ -\hspace{6mm}5.3.1 $c \leftarrow a \cdot b \mbox{ (mod }\beta^{digs}\mbox{)}$ using algorithm s\_mp\_mul\_digs. \\ -6. $c.sign \leftarrow sign$ \\ -7. Return the result of the unsigned multiplication performed. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul} -\end{figure} - -\textbf{Algorithm mp\_mul.} -This algorithm performs the signed multiplication of two inputs. It will make use of any of the three unsigned multiplication algorithms -available when the input is of appropriate size. The \textbf{sign} of the result is not set until the end of the algorithm since algorithm -s\_mp\_mul\_digs will clear it. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_mul.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* high level multiplication (handles sign) */ -018 int mp_mul (mp_int * a, mp_int * b, mp_int * c) -019 \{ -020 int res, neg; -021 neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; -022 -023 /* use Toom-Cook? */ -024 #ifdef BN_MP_TOOM_MUL_C -025 if (MIN (a->used, b->used) >= TOOM_MUL_CUTOFF) \{ -026 res = mp_toom_mul(a, b, c); -027 \} else -028 #endif -029 #ifdef BN_MP_KARATSUBA_MUL_C -030 /* use Karatsuba? */ -031 if (MIN (a->used, b->used) >= KARATSUBA_MUL_CUTOFF) \{ -032 res = mp_karatsuba_mul (a, b, c); -033 \} else -034 #endif -035 \{ -036 /* can we use the fast multiplier? -037 * -038 * The fast multiplier can be used if the output will -039 * have less than MP_WARRAY digits and the number of -040 * digits won't affect carry propagation -041 */ -042 int digs = a->used + b->used + 1; -043 -044 #ifdef BN_FAST_S_MP_MUL_DIGS_C -045 if ((digs < MP_WARRAY) && -046 (MIN(a->used, b->used) <= -047 (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) \{ -048 res = fast_s_mp_mul_digs (a, b, c, digs); -049 \} else -050 #endif -051 \{ -052 #ifdef BN_S_MP_MUL_DIGS_C -053 res = s_mp_mul (a, b, c); /* uses s_mp_mul_digs */ -054 #else -055 res = MP_VAL; -056 #endif -057 \} -058 \} -059 c->sign = (c->used > 0) ? neg : MP_ZPOS; -060 return res; -061 \} -062 #endif -063 -\end{alltt} -\end{small} - -The implementation is rather simplistic and is not particularly noteworthy. Line 23 computes the sign of the result using the ``?'' -operator from the C programming language. Line 47 computes $\delta$ using the fact that $1 << k$ is equal to $2^k$. - -\section{Squaring} -\label{sec:basesquare} - -Squaring is a special case of multiplication where both multiplicands are equal. At first it may seem like there is no significant optimization -available but in fact there is. Consider the multiplication of $576$ against $241$. In total there will be nine single precision multiplications -performed which are $1\cdot 6$, $1 \cdot 7$, $1 \cdot 5$, $4 \cdot 6$, $4 \cdot 7$, $4 \cdot 5$, $2 \cdot 6$, $2 \cdot 7$ and $2 \cdot 5$. Now consider -the multiplication of $123$ against $123$. The nine products are $3 \cdot 3$, $3 \cdot 2$, $3 \cdot 1$, $2 \cdot 3$, $2 \cdot 2$, $2 \cdot 1$, -$1 \cdot 3$, $1 \cdot 2$ and $1 \cdot 1$. On closer inspection some of the products are equivalent. For example, $3 \cdot 2 = 2 \cdot 3$ -and $3 \cdot 1 = 1 \cdot 3$. - -For any $n$-digit input, there are ${{\left (n^2 + n \right)}\over 2}$ possible unique single precision multiplications required compared to the $n^2$ -required for multiplication. The following diagram gives an example of the operations required. - -\begin{figure}[here] -\begin{center} -\begin{tabular}{ccccc|c} -&&1&2&3&\\ -$\times$ &&1&2&3&\\ -\hline && $3 \cdot 1$ & $3 \cdot 2$ & $3 \cdot 3$ & Row 0\\ - & $2 \cdot 1$ & $2 \cdot 2$ & $2 \cdot 3$ && Row 1 \\ - $1 \cdot 1$ & $1 \cdot 2$ & $1 \cdot 3$ &&& Row 2 \\ -\end{tabular} -\end{center} -\caption{Squaring Optimization Diagram} -\end{figure} - -Starting from zero and numbering the columns from right to left a very simple pattern becomes obvious. For the purposes of this discussion let $x$ -represent the number being squared. The first observation is that in row $k$ the $2k$'th column of the product has a $\left (x_k \right)^2$ term in it. - -The second observation is that every column $j$ in row $k$ where $j \ne 2k$ is part of a double product. Every non-square term of a column will -appear twice hence the name ``double product''. Every odd column is made up entirely of double products. In fact every column is made up of double -products and at most one square (\textit{see the exercise section}). - -The third and final observation is that for row $k$ the first unique non-square term, that is, one that hasn't already appeared in an earlier row, -occurs at column $2k + 1$. For example, on row $1$ of the previous squaring, column one is part of the double product with column one from row zero. -Column two of row one is a square and column three is the first unique column. - -\subsection{The Baseline Squaring Algorithm} -The baseline squaring algorithm is meant to be a catch-all squaring algorithm. It will handle any of the input sizes that the faster routines -will not handle. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -1. Init a temporary mp\_int of at least $2 \cdot a.used +1$ digits. (\textit{mp\_init\_size}) \\ -2. If step 1 failed return(\textit{MP\_MEM}) \\ -3. $t.used \leftarrow 2 \cdot a.used + 1$ \\ -4. For $ix$ from 0 to $a.used - 1$ do \\ -\hspace{3mm}Calculate the square. \\ -\hspace{3mm}4.1 $\hat r \leftarrow t_{2ix} + \left (a_{ix} \right )^2$ \\ -\hspace{3mm}4.2 $t_{2ix} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}Calculate the double products after the square. \\ -\hspace{3mm}4.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}4.4 For $iy$ from $ix + 1$ to $a.used - 1$ do \\ -\hspace{6mm}4.4.1 $\hat r \leftarrow 2 \cdot a_{ix}a_{iy} + t_{ix + iy} + u$ \\ -\hspace{6mm}4.4.2 $t_{ix + iy} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}4.4.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}Set the last carry. \\ -\hspace{3mm}4.5 While $u > 0$ do \\ -\hspace{6mm}4.5.1 $iy \leftarrow iy + 1$ \\ -\hspace{6mm}4.5.2 $\hat r \leftarrow t_{ix + iy} + u$ \\ -\hspace{6mm}4.5.3 $t_{ix + iy} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}4.5.4 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -5. Clamp excess digits of $t$. (\textit{mp\_clamp}) \\ -6. Exchange $b$ and $t$. \\ -7. Clear $t$ (\textit{mp\_clear}) \\ -8. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_sqr} -\end{figure} - -\textbf{Algorithm s\_mp\_sqr.} -This algorithm computes the square of an input using the three observations on squaring. It is based fairly faithfully on algorithm 14.16 of HAC -\cite[pp.596-597]{HAC}. Similar to algorithm s\_mp\_mul\_digs, a temporary mp\_int is allocated to hold the result of the squaring. This allows the -destination mp\_int to be the same as the source mp\_int. - -The outer loop of this algorithm begins on step 4. It is best to think of the outer loop as walking down the rows of the partial results, while -the inner loop computes the columns of the partial result. Step 4.1 and 4.2 compute the square term for each row, and step 4.3 and 4.4 propagate -the carry and compute the double products. - -The requirement that a mp\_word be able to represent the range $0 \le x < 2 \beta^2$ arises from this -very algorithm. The product $a_{ix}a_{iy}$ will lie in the range $0 \le x \le \beta^2 - 2\beta + 1$ which is obviously less than $\beta^2$ meaning that -when it is multiplied by two, it can be properly represented by a mp\_word. - -Similar to algorithm s\_mp\_mul\_digs, after every pass of the inner loop, the destination is correctly set to the sum of all of the partial -results calculated so far. This involves expensive carry propagation which will be eliminated in the next algorithm. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_s\_mp\_sqr.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */ -018 int s_mp_sqr (mp_int * a, mp_int * b) -019 \{ -020 mp_int t; -021 int res, ix, iy, pa; -022 mp_word r; -023 mp_digit u, tmpx, *tmpt; -024 -025 pa = a->used; -026 if ((res = mp_init_size (&t, (2 * pa) + 1)) != MP_OKAY) \{ -027 return res; -028 \} -029 -030 /* default used is maximum possible size */ -031 t.used = (2 * pa) + 1; -032 -033 for (ix = 0; ix < pa; ix++) \{ -034 /* first calculate the digit at 2*ix */ -035 /* calculate double precision result */ -036 r = (mp_word)t.dp[2*ix] + -037 ((mp_word)a->dp[ix] * (mp_word)a->dp[ix]); -038 -039 /* store lower part in result */ -040 t.dp[ix+ix] = (mp_digit) (r & ((mp_word) MP_MASK)); -041 -042 /* get the carry */ -043 u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); -044 -045 /* left hand side of A[ix] * A[iy] */ -046 tmpx = a->dp[ix]; -047 -048 /* alias for where to store the results */ -049 tmpt = t.dp + ((2 * ix) + 1); -050 -051 for (iy = ix + 1; iy < pa; iy++) \{ -052 /* first calculate the product */ -053 r = ((mp_word)tmpx) * ((mp_word)a->dp[iy]); -054 -055 /* now calculate the double precision result, note we use -056 * addition instead of *2 since it's easier to optimize -057 */ -058 r = ((mp_word) *tmpt) + r + r + ((mp_word) u); -059 -060 /* store lower part */ -061 *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); -062 -063 /* get carry */ -064 u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); -065 \} -066 /* propagate upwards */ -067 while (u != ((mp_digit) 0)) \{ -068 r = ((mp_word) *tmpt) + ((mp_word) u); -069 *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); -070 u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); -071 \} -072 \} -073 -074 mp_clamp (&t); -075 mp_exch (&t, b); -076 mp_clear (&t); -077 return MP_OKAY; -078 \} -079 #endif -080 -\end{alltt} -\end{small} - -Inside the outer loop (line 33) the square term is calculated on line 36. The carry (line 43) has been -extracted from the mp\_word accumulator using a right shift. Aliases for $a_{ix}$ and $t_{ix+iy}$ are initialized -(lines 46 and 49) to simplify the inner loop. The doubling is performed using two -additions (line 58) since it is usually faster than shifting, if not at least as fast. - -The important observation is that the inner loop does not begin at $iy = 0$ like for multiplication. As such the inner loops -get progressively shorter as the algorithm proceeds. This is what leads to the savings compared to using a multiplication to -square a number. - -\subsection{Faster Squaring by the ``Comba'' Method} -A major drawback to the baseline method is the requirement for single precision shifting inside the $O(n^2)$ nested loop. Squaring has an additional -drawback that it must double the product inside the inner loop as well. As for multiplication, the Comba technique can be used to eliminate these -performance hazards. - -The first obvious solution is to make an array of mp\_words which will hold all of the columns. This will indeed eliminate all of the carry -propagation operations from the inner loop. However, the inner product must still be doubled $O(n^2)$ times. The solution stems from the simple fact -that $2a + 2b + 2c = 2(a + b + c)$. That is the sum of all of the double products is equal to double the sum of all the products. For example, -$ab + ba + ac + ca = 2ab + 2ac = 2(ab + ac)$. - -However, we cannot simply double all of the columns, since the squares appear only once per row. The most practical solution is to have two -mp\_word arrays. One array will hold the squares and the other array will hold the double products. With both arrays the doubling and -carry propagation can be moved to a $O(n)$ work level outside the $O(n^2)$ level. In this case, we have an even simpler solution in mind. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{fast\_s\_mp\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -Place an array of \textbf{MP\_WARRAY} mp\_digits named $W$ on the stack. \\ -1. If $b.alloc < 2a.used + 1$ then grow $b$ to $2a.used + 1$ digits. (\textit{mp\_grow}). \\ -2. If step 1 failed return(\textit{MP\_MEM}). \\ -\\ -3. $pa \leftarrow 2 \cdot a.used$ \\ -4. $\hat W1 \leftarrow 0$ \\ -5. for $ix$ from $0$ to $pa - 1$ do \\ -\hspace{3mm}5.1 $\_ \hat W \leftarrow 0$ \\ -\hspace{3mm}5.2 $ty \leftarrow \mbox{MIN}(a.used - 1, ix)$ \\ -\hspace{3mm}5.3 $tx \leftarrow ix - ty$ \\ -\hspace{3mm}5.4 $iy \leftarrow \mbox{MIN}(a.used - tx, ty + 1)$ \\ -\hspace{3mm}5.5 $iy \leftarrow \mbox{MIN}(iy, \lfloor \left (ty - tx + 1 \right )/2 \rfloor)$ \\ -\hspace{3mm}5.6 for $iz$ from $0$ to $iz - 1$ do \\ -\hspace{6mm}5.6.1 $\_ \hat W \leftarrow \_ \hat W + a_{tx + iz}a_{ty - iz}$ \\ -\hspace{3mm}5.7 $\_ \hat W \leftarrow 2 \cdot \_ \hat W + \hat W1$ \\ -\hspace{3mm}5.8 if $ix$ is even then \\ -\hspace{6mm}5.8.1 $\_ \hat W \leftarrow \_ \hat W + \left ( a_{\lfloor ix/2 \rfloor}\right )^2$ \\ -\hspace{3mm}5.9 $W_{ix} \leftarrow \_ \hat W (\mbox{mod }\beta)$ \\ -\hspace{3mm}5.10 $\hat W1 \leftarrow \lfloor \_ \hat W / \beta \rfloor$ \\ -\\ -6. $oldused \leftarrow b.used$ \\ -7. $b.used \leftarrow 2 \cdot a.used$ \\ -8. for $ix$ from $0$ to $pa - 1$ do \\ -\hspace{3mm}8.1 $b_{ix} \leftarrow W_{ix}$ \\ -9. for $ix$ from $pa$ to $oldused - 1$ do \\ -\hspace{3mm}9.1 $b_{ix} \leftarrow 0$ \\ -10. Clamp excess digits from $b$. (\textit{mp\_clamp}) \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm fast\_s\_mp\_sqr} -\end{figure} - -\textbf{Algorithm fast\_s\_mp\_sqr.} -This algorithm computes the square of an input using the Comba technique. It is designed to be a replacement for algorithm -s\_mp\_sqr when the number of input digits is less than \textbf{MP\_WARRAY} and less than $\delta \over 2$. -This algorithm is very similar to the Comba multiplier except with a few key differences we shall make note of. - -First, we have an accumulator and carry variables $\_ \hat W$ and $\hat W1$ respectively. This is because the inner loop -products are to be doubled. If we had added the previous carry in we would be doubling too much. Next we perform an -addition MIN condition on $iy$ (step 5.5) to prevent overlapping digits. For example, $a_3 \cdot a_5$ is equal -$a_5 \cdot a_3$. Whereas in the multiplication case we would have $5 < a.used$ and $3 \ge 0$ is maintained since we double the sum -of the products just outside the inner loop we have to avoid doing this. This is also a good thing since we perform -fewer multiplications and the routine ends up being faster. - -Finally the last difference is the addition of the ``square'' term outside the inner loop (step 5.8). We add in the square -only to even outputs and it is the square of the term at the $\lfloor ix / 2 \rfloor$ position. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_fast\_s\_mp\_sqr.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* the jist of squaring... -018 * you do like mult except the offset of the tmpx [one that -019 * starts closer to zero] can't equal the offset of tmpy. -020 * So basically you set up iy like before then you min it with -021 * (ty-tx) so that it never happens. You double all those -022 * you add in the inner loop -023 -024 After that loop you do the squares and add them in. -025 */ -026 -027 int fast_s_mp_sqr (mp_int * a, mp_int * b) -028 \{ -029 int olduse, res, pa, ix, iz; -030 mp_digit W[MP_WARRAY], *tmpx; -031 mp_word W1; -032 -033 /* grow the destination as required */ -034 pa = a->used + a->used; -035 if (b->alloc < pa) \{ -036 if ((res = mp_grow (b, pa)) != MP_OKAY) \{ -037 return res; -038 \} -039 \} -040 -041 /* number of output digits to produce */ -042 W1 = 0; -043 for (ix = 0; ix < pa; ix++) \{ -044 int tx, ty, iy; -045 mp_word _W; -046 mp_digit *tmpy; -047 -048 /* clear counter */ -049 _W = 0; -050 -051 /* get offsets into the two bignums */ -052 ty = MIN(a->used-1, ix); -053 tx = ix - ty; -054 -055 /* setup temp aliases */ -056 tmpx = a->dp + tx; -057 tmpy = a->dp + ty; -058 -059 /* this is the number of times the loop will iterrate, essentially -060 while (tx++ < a->used && ty-- >= 0) \{ ... \} -061 */ -062 iy = MIN(a->used-tx, ty+1); -063 -064 /* now for squaring tx can never equal ty -065 * we halve the distance since they approach at a rate of 2x -066 * and we have to round because odd cases need to be executed -067 */ -068 iy = MIN(iy, ((ty-tx)+1)>>1); -069 -070 /* execute loop */ -071 for (iz = 0; iz < iy; iz++) \{ -072 _W += ((mp_word)*tmpx++)*((mp_word)*tmpy--); -073 \} -074 -075 /* double the inner product and add carry */ -076 _W = _W + _W + W1; -077 -078 /* even columns have the square term in them */ -079 if ((ix&1) == 0) \{ -080 _W += ((mp_word)a->dp[ix>>1])*((mp_word)a->dp[ix>>1]); -081 \} -082 -083 /* store it */ -084 W[ix] = (mp_digit)(_W & MP_MASK); -085 -086 /* make next carry */ -087 W1 = _W >> ((mp_word)DIGIT_BIT); -088 \} -089 -090 /* setup dest */ -091 olduse = b->used; -092 b->used = a->used+a->used; -093 -094 \{ -095 mp_digit *tmpb; -096 tmpb = b->dp; -097 for (ix = 0; ix < pa; ix++) \{ -098 *tmpb++ = W[ix] & MP_MASK; -099 \} -100 -101 /* clear unused digits [that existed in the old copy of c] */ -102 for (; ix < olduse; ix++) \{ -103 *tmpb++ = 0; -104 \} -105 \} -106 mp_clamp (b); -107 return MP_OKAY; -108 \} -109 #endif -110 -\end{alltt} -\end{small} - -This implementation is essentially a copy of Comba multiplication with the appropriate changes added to make it faster for -the special case of squaring. - -\subsection{Polynomial Basis Squaring} -The same algorithm that performs optimal polynomial basis multiplication can be used to perform polynomial basis squaring. The minor exception -is that $\zeta_y = f(y)g(y)$ is actually equivalent to $\zeta_y = f(y)^2$ since $f(y) = g(y)$. Instead of performing $2n + 1$ -multiplications to find the $\zeta$ relations, squaring operations are performed instead. - -\subsection{Karatsuba Squaring} -Let $f(x) = ax + b$ represent the polynomial basis representation of a number to square. -Let $h(x) = \left ( f(x) \right )^2$ represent the square of the polynomial. The Karatsuba equation can be modified to square a -number with the following equation. - -\begin{equation} -h(x) = a^2x^2 + \left ((a + b)^2 - (a^2 + b^2) \right )x + b^2 -\end{equation} - -Upon closer inspection this equation only requires the calculation of three half-sized squares: $a^2$, $b^2$ and $(a + b)^2$. As in -Karatsuba multiplication, this algorithm can be applied recursively on the input and will achieve an asymptotic running time of -$O \left ( n^{lg(3)} \right )$. - -If the asymptotic times of Karatsuba squaring and multiplication are the same, why not simply use the multiplication algorithm -instead? The answer to this arises from the cutoff point for squaring. As in multiplication there exists a cutoff point, at which the -time required for a Comba based squaring and a Karatsuba based squaring meet. Due to the overhead inherent in the Karatsuba method, the cutoff -point is fairly high. For example, on an AMD Athlon XP processor with $\beta = 2^{28}$, the cutoff point is around 127 digits. - -Consider squaring a 200 digit number with this technique. It will be split into two 100 digit halves which are subsequently squared. -The 100 digit halves will not be squared using Karatsuba, but instead using the faster Comba based squaring algorithm. If Karatsuba multiplication -were used instead, the 100 digit numbers would be squared with a slower Comba based multiplication. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_karatsuba\_sqr}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $b \leftarrow a^2$ \\ -\hline \\ -1. Initialize the following temporary mp\_ints: $x0$, $x1$, $t1$, $t2$, $x0x0$ and $x1x1$. \\ -2. If any of the initializations on step 1 failed return(\textit{MP\_MEM}). \\ -\\ -Split the input. e.g. $a = x1\beta^B + x0$ \\ -3. $B \leftarrow \lfloor a.used / 2 \rfloor$ \\ -4. $x0 \leftarrow a \mbox{ (mod }\beta^B\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -5. $x1 \leftarrow \lfloor a / \beta^B \rfloor$ (\textit{mp\_lshd}) \\ -\\ -Calculate the three squares. \\ -6. $x0x0 \leftarrow x0^2$ (\textit{mp\_sqr}) \\ -7. $x1x1 \leftarrow x1^2$ \\ -8. $t1 \leftarrow x1 + x0$ (\textit{s\_mp\_add}) \\ -9. $t1 \leftarrow t1^2$ \\ -\\ -Compute the middle term. \\ -10. $t2 \leftarrow x0x0 + x1x1$ (\textit{s\_mp\_add}) \\ -11. $t1 \leftarrow t1 - t2$ \\ -\\ -Compute final product. \\ -12. $t1 \leftarrow t1\beta^B$ (\textit{mp\_lshd}) \\ -13. $x1x1 \leftarrow x1x1\beta^{2B}$ \\ -14. $t1 \leftarrow t1 + x0x0$ \\ -15. $b \leftarrow t1 + x1x1$ \\ -16. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_karatsuba\_sqr} -\end{figure} - -\textbf{Algorithm mp\_karatsuba\_sqr.} -This algorithm computes the square of an input $a$ using the Karatsuba technique. This algorithm is very similar to the Karatsuba based -multiplication algorithm with the exception that the three half-size multiplications have been replaced with three half-size squarings. - -The radix point for squaring is simply placed exactly in the middle of the digits when the input has an odd number of digits, otherwise it is -placed just below the middle. Step 3, 4 and 5 compute the two halves required using $B$ -as the radix point. The first two squares in steps 6 and 7 are rather straightforward while the last square is of a more compact form. - -By expanding $\left (x1 + x0 \right )^2$, the $x1^2$ and $x0^2$ terms in the middle disappear, that is $(x0 - x1)^2 - (x1^2 + x0^2) = 2 \cdot x0 \cdot x1$. -Now if $5n$ single precision additions and a squaring of $n$-digits is faster than multiplying two $n$-digit numbers and doubling then -this method is faster. Assuming no further recursions occur, the difference can be estimated with the following inequality. - -Let $p$ represent the cost of a single precision addition and $q$ the cost of a single precision multiplication both in terms of time\footnote{Or -machine clock cycles.}. - -\begin{equation} -5pn +{{q(n^2 + n)} \over 2} \le pn + qn^2 -\end{equation} - -For example, on an AMD Athlon XP processor $p = {1 \over 3}$ and $q = 6$. This implies that the following inequality should hold. -\begin{center} -\begin{tabular}{rcl} -${5n \over 3} + 3n^2 + 3n$ & $<$ & ${n \over 3} + 6n^2$ \\ -${5 \over 3} + 3n + 3$ & $<$ & ${1 \over 3} + 6n$ \\ -${13 \over 9}$ & $<$ & $n$ \\ -\end{tabular} -\end{center} - -This results in a cutoff point around $n = 2$. As a consequence it is actually faster to compute the middle term the ``long way'' on processors -where multiplication is substantially slower\footnote{On the Athlon there is a 1:17 ratio between clock cycles for addition and multiplication. On -the Intel P4 processor this ratio is 1:29 making this method even more beneficial. The only common exception is the ARMv4 processor which has a -ratio of 1:7. } than simpler operations such as addition. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_karatsuba\_sqr.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* Karatsuba squaring, computes b = a*a using three -018 * half size squarings -019 * -020 * See comments of karatsuba_mul for details. It -021 * is essentially the same algorithm but merely -022 * tuned to perform recursive squarings. -023 */ -024 int mp_karatsuba_sqr (mp_int * a, mp_int * b) -025 \{ -026 mp_int x0, x1, t1, t2, x0x0, x1x1; -027 int B, err; -028 -029 err = MP_MEM; -030 -031 /* min # of digits */ -032 B = a->used; -033 -034 /* now divide in two */ -035 B = B >> 1; -036 -037 /* init copy all the temps */ -038 if (mp_init_size (&x0, B) != MP_OKAY) -039 goto ERR; -040 if (mp_init_size (&x1, a->used - B) != MP_OKAY) -041 goto X0; -042 -043 /* init temps */ -044 if (mp_init_size (&t1, a->used * 2) != MP_OKAY) -045 goto X1; -046 if (mp_init_size (&t2, a->used * 2) != MP_OKAY) -047 goto T1; -048 if (mp_init_size (&x0x0, B * 2) != MP_OKAY) -049 goto T2; -050 if (mp_init_size (&x1x1, (a->used - B) * 2) != MP_OKAY) -051 goto X0X0; -052 -053 \{ -054 int x; -055 mp_digit *dst, *src; -056 -057 src = a->dp; -058 -059 /* now shift the digits */ -060 dst = x0.dp; -061 for (x = 0; x < B; x++) \{ -062 *dst++ = *src++; -063 \} -064 -065 dst = x1.dp; -066 for (x = B; x < a->used; x++) \{ -067 *dst++ = *src++; -068 \} -069 \} -070 -071 x0.used = B; -072 x1.used = a->used - B; -073 -074 mp_clamp (&x0); -075 -076 /* now calc the products x0*x0 and x1*x1 */ -077 if (mp_sqr (&x0, &x0x0) != MP_OKAY) -078 goto X1X1; /* x0x0 = x0*x0 */ -079 if (mp_sqr (&x1, &x1x1) != MP_OKAY) -080 goto X1X1; /* x1x1 = x1*x1 */ -081 -082 /* now calc (x1+x0)**2 */ -083 if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) -084 goto X1X1; /* t1 = x1 - x0 */ -085 if (mp_sqr (&t1, &t1) != MP_OKAY) -086 goto X1X1; /* t1 = (x1 - x0) * (x1 - x0) */ -087 -088 /* add x0y0 */ -089 if (s_mp_add (&x0x0, &x1x1, &t2) != MP_OKAY) -090 goto X1X1; /* t2 = x0x0 + x1x1 */ -091 if (s_mp_sub (&t1, &t2, &t1) != MP_OKAY) -092 goto X1X1; /* t1 = (x1+x0)**2 - (x0x0 + x1x1) */ -093 -094 /* shift by B */ -095 if (mp_lshd (&t1, B) != MP_OKAY) -096 goto X1X1; /* t1 = (x0x0 + x1x1 - (x1-x0)*(x1-x0))<used >= TOOM_SQR_CUTOFF) \{ -026 res = mp_toom_sqr(a, b); -027 /* Karatsuba? */ -028 \} else -029 #endif -030 #ifdef BN_MP_KARATSUBA_SQR_C -031 if (a->used >= KARATSUBA_SQR_CUTOFF) \{ -032 res = mp_karatsuba_sqr (a, b); -033 \} else -034 #endif -035 \{ -036 #ifdef BN_FAST_S_MP_SQR_C -037 /* can we use the fast comba multiplier? */ -038 if ((((a->used * 2) + 1) < MP_WARRAY) && -039 (a->used < -040 (1 << (((sizeof(mp_word) * CHAR_BIT) - (2 * DIGIT_BIT)) - 1)))) \{ -041 res = fast_s_mp_sqr (a, b); -042 \} else -043 #endif -044 \{ -045 #ifdef BN_S_MP_SQR_C -046 res = s_mp_sqr (a, b); -047 #else -048 res = MP_VAL; -049 #endif -050 \} -051 \} -052 b->sign = MP_ZPOS; -053 return res; -054 \} -055 #endif -056 -\end{alltt} -\end{small} - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 3 \right ] $ & Devise an efficient algorithm for selection of the radix point to handle inputs \\ - & that have different number of digits in Karatsuba multiplication. \\ - & \\ -$\left [ 2 \right ] $ & In section 5.3 the fact that every column of a squaring is made up \\ - & of double products and at most one square is stated. Prove this statement. \\ - & \\ -$\left [ 3 \right ] $ & Prove the equation for Karatsuba squaring. \\ - & \\ -$\left [ 1 \right ] $ & Prove that Karatsuba squaring requires $O \left (n^{lg(3)} \right )$ time. \\ - & \\ -$\left [ 2 \right ] $ & Determine the minimal ratio between addition and multiplication clock cycles \\ - & required for equation $6.7$ to be true. \\ - & \\ -$\left [ 3 \right ] $ & Implement a threaded version of Comba multiplication (and squaring) where you \\ - & compute subsets of the columns in each thread. Determine a cutoff point where \\ - & it is effective and add the logic to mp\_mul() and mp\_sqr(). \\ - &\\ -$\left [ 4 \right ] $ & Same as the previous but also modify the Karatsuba and Toom-Cook. You must \\ - & increase the throughput of mp\_exptmod() for random odd moduli in the range \\ - & $512 \ldots 4096$ bits significantly ($> 2x$) to complete this challenge. \\ - & \\ -\end{tabular} - -\chapter{Modular Reduction} -\section{Basics of Modular Reduction} -\index{modular residue} -Modular reduction is an operation that arises quite often within public key cryptography algorithms and various number theoretic algorithms, -such as factoring. Modular reduction algorithms are the third class of algorithms of the ``multipliers'' set. A number $a$ is said to be \textit{reduced} -modulo another number $b$ by finding the remainder of the division $a/b$. Full integer division with remainder is a topic to be covered -in~\ref{sec:division}. - -Modular reduction is equivalent to solving for $r$ in the following equation. $a = bq + r$ where $q = \lfloor a/b \rfloor$. The result -$r$ is said to be ``congruent to $a$ modulo $b$'' which is also written as $r \equiv a \mbox{ (mod }b\mbox{)}$. In other vernacular $r$ is known as the -``modular residue'' which leads to ``quadratic residue''\footnote{That's fancy talk for $b \equiv a^2 \mbox{ (mod }p\mbox{)}$.} and -other forms of residues. - -Modular reductions are normally used to create either finite groups, rings or fields. The most common usage for performance driven modular reductions -is in modular exponentiation algorithms. That is to compute $d = a^b \mbox{ (mod }c\mbox{)}$ as fast as possible. This operation is used in the -RSA and Diffie-Hellman public key algorithms, for example. Modular multiplication and squaring also appears as a fundamental operation in -elliptic curve cryptographic algorithms. As will be discussed in the subsequent chapter there exist fast algorithms for computing modular -exponentiations without having to perform (\textit{in this example}) $b - 1$ multiplications. These algorithms will produce partial results in the -range $0 \le x < c^2$ which can be taken advantage of to create several efficient algorithms. They have also been used to create redundancy check -algorithms known as CRCs, error correction codes such as Reed-Solomon and solve a variety of number theoeretic problems. - -\section{The Barrett Reduction} -The Barrett reduction algorithm \cite{BARRETT} was inspired by fast division algorithms which multiply by the reciprocal to emulate -division. Barretts observation was that the residue $c$ of $a$ modulo $b$ is equal to - -\begin{equation} -c = a - b \cdot \lfloor a/b \rfloor -\end{equation} - -Since algorithms such as modular exponentiation would be using the same modulus extensively, typical DSP\footnote{It is worth noting that Barrett's paper -targeted the DSP56K processor.} intuition would indicate the next step would be to replace $a/b$ by a multiplication by the reciprocal. However, -DSP intuition on its own will not work as these numbers are considerably larger than the precision of common DSP floating point data types. -It would take another common optimization to optimize the algorithm. - -\subsection{Fixed Point Arithmetic} -The trick used to optimize the above equation is based on a technique of emulating floating point data types with fixed precision integers. Fixed -point arithmetic would become very popular as it greatly optimize the ``3d-shooter'' genre of games in the mid 1990s when floating point units were -fairly slow if not unavailable. The idea behind fixed point arithmetic is to take a normal $k$-bit integer data type and break it into $p$-bit -integer and a $q$-bit fraction part (\textit{where $p+q = k$}). - -In this system a $k$-bit integer $n$ would actually represent $n/2^q$. For example, with $q = 4$ the integer $n = 37$ would actually represent the -value $2.3125$. To multiply two fixed point numbers the integers are multiplied using traditional arithmetic and subsequently normalized by -moving the implied decimal point back to where it should be. For example, with $q = 4$ to multiply the integers $9$ and $5$ they must be converted -to fixed point first by multiplying by $2^q$. Let $a = 9(2^q)$ represent the fixed point representation of $9$ and $b = 5(2^q)$ represent the -fixed point representation of $5$. The product $ab$ is equal to $45(2^{2q})$ which when normalized by dividing by $2^q$ produces $45(2^q)$. - -This technique became popular since a normal integer multiplication and logical shift right are the only required operations to perform a multiplication -of two fixed point numbers. Using fixed point arithmetic, division can be easily approximated by multiplying by the reciprocal. If $2^q$ is -equivalent to one than $2^q/b$ is equivalent to the fixed point approximation of $1/b$ using real arithmetic. Using this fact dividing an integer -$a$ by another integer $b$ can be achieved with the following expression. - -\begin{equation} -\lfloor a / b \rfloor \mbox{ }\approx\mbox{ } \lfloor (a \cdot \lfloor 2^q / b \rfloor)/2^q \rfloor -\end{equation} - -The precision of the division is proportional to the value of $q$. If the divisor $b$ is used frequently as is the case with -modular exponentiation pre-computing $2^q/b$ will allow a division to be performed with a multiplication and a right shift. Both operations -are considerably faster than division on most processors. - -Consider dividing $19$ by $5$. The correct result is $\lfloor 19/5 \rfloor = 3$. With $q = 3$ the reciprocal is $\lfloor 2^q/5 \rfloor = 1$ which -leads to a product of $19$ which when divided by $2^q$ produces $2$. However, with $q = 4$ the reciprocal is $\lfloor 2^q/5 \rfloor = 3$ and -the result of the emulated division is $\lfloor 3 \cdot 19 / 2^q \rfloor = 3$ which is correct. The value of $2^q$ must be close to or ideally -larger than the dividend. In effect if $a$ is the dividend then $q$ should allow $0 \le \lfloor a/2^q \rfloor \le 1$ in order for this approach -to work correctly. Plugging this form of divison into the original equation the following modular residue equation arises. - -\begin{equation} -c = a - b \cdot \lfloor (a \cdot \lfloor 2^q / b \rfloor)/2^q \rfloor -\end{equation} - -Using the notation from \cite{BARRETT} the value of $\lfloor 2^q / b \rfloor$ will be represented by the $\mu$ symbol. Using the $\mu$ -variable also helps re-inforce the idea that it is meant to be computed once and re-used. - -\begin{equation} -c = a - b \cdot \lfloor (a \cdot \mu)/2^q \rfloor -\end{equation} - -Provided that $2^q \ge a$ this algorithm will produce a quotient that is either exactly correct or off by a value of one. In the context of Barrett -reduction the value of $a$ is bound by $0 \le a \le (b - 1)^2$ meaning that $2^q \ge b^2$ is sufficient to ensure the reciprocal will have enough -precision. - -Let $n$ represent the number of digits in $b$. This algorithm requires approximately $2n^2$ single precision multiplications to produce the quotient and -another $n^2$ single precision multiplications to find the residue. In total $3n^2$ single precision multiplications are required to -reduce the number. - -For example, if $b = 1179677$ and $q = 41$ ($2^q > b^2$), then the reciprocal $\mu$ is equal to $\lfloor 2^q / b \rfloor = 1864089$. Consider reducing -$a = 180388626447$ modulo $b$ using the above reduction equation. The quotient using the new formula is $\lfloor (a \cdot \mu) / 2^q \rfloor = 152913$. -By subtracting $152913b$ from $a$ the correct residue $a \equiv 677346 \mbox{ (mod }b\mbox{)}$ is found. - -\subsection{Choosing a Radix Point} -Using the fixed point representation a modular reduction can be performed with $3n^2$ single precision multiplications. If that were the best -that could be achieved a full division\footnote{A division requires approximately $O(2cn^2)$ single precision multiplications for a small value of $c$. -See~\ref{sec:division} for further details.} might as well be used in its place. The key to optimizing the reduction is to reduce the precision of -the initial multiplication that finds the quotient. - -Let $a$ represent the number of which the residue is sought. Let $b$ represent the modulus used to find the residue. Let $m$ represent -the number of digits in $b$. For the purposes of this discussion we will assume that the number of digits in $a$ is $2m$, which is generally true if -two $m$-digit numbers have been multiplied. Dividing $a$ by $b$ is the same as dividing a $2m$ digit integer by a $m$ digit integer. Digits below the -$m - 1$'th digit of $a$ will contribute at most a value of $1$ to the quotient because $\beta^k < b$ for any $0 \le k \le m - 1$. Another way to -express this is by re-writing $a$ as two parts. If $a' \equiv a \mbox{ (mod }b^m\mbox{)}$ and $a'' = a - a'$ then -${a \over b} \equiv {{a' + a''} \over b}$ which is equivalent to ${a' \over b} + {a'' \over b}$. Since $a'$ is bound to be less than $b$ the quotient -is bound by $0 \le {a' \over b} < 1$. - -Since the digits of $a'$ do not contribute much to the quotient the observation is that they might as well be zero. However, if the digits -``might as well be zero'' they might as well not be there in the first place. Let $q_0 = \lfloor a/\beta^{m-1} \rfloor$ represent the input -with the irrelevant digits trimmed. Now the modular reduction is trimmed to the almost equivalent equation - -\begin{equation} -c = a - b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor -\end{equation} - -Note that the original divisor $2^q$ has been replaced with $\beta^{m+1}$ where in this case $q$ is a multiple of $lg(\beta)$. Also note that the -exponent on the divisor when added to the amount $q_0$ was shifted by equals $2m$. If the optimization had not been performed the divisor -would have the exponent $2m$ so in the end the exponents do ``add up''. Using the above equation the quotient -$\lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor$ can be off from the true quotient by at most two. The original fixed point quotient can be off -by as much as one (\textit{provided the radix point is chosen suitably}) and now that the lower irrelevent digits have been trimmed the quotient -can be off by an additional value of one for a total of at most two. This implies that -$0 \le a - b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor < 3b$. By first subtracting $b$ times the quotient and then conditionally subtracting -$b$ once or twice the residue is found. - -The quotient is now found using $(m + 1)(m) = m^2 + m$ single precision multiplications and the residue with an additional $m^2$ single -precision multiplications, ignoring the subtractions required. In total $2m^2 + m$ single precision multiplications are required to find the residue. -This is considerably faster than the original attempt. - -For example, let $\beta = 10$ represent the radix of the digits. Let $b = 9999$ represent the modulus which implies $m = 4$. Let $a = 99929878$ -represent the value of which the residue is desired. In this case $q = 8$ since $10^7 < 9999^2$ meaning that $\mu = \lfloor \beta^{q}/b \rfloor = 10001$. -With the new observation the multiplicand for the quotient is equal to $q_0 = \lfloor a / \beta^{m - 1} \rfloor = 99929$. The quotient is then -$\lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor = 9993$. Subtracting $9993b$ from $a$ and the correct residue $a \equiv 9871 \mbox{ (mod }b\mbox{)}$ -is found. - -\subsection{Trimming the Quotient} -So far the reduction algorithm has been optimized from $3m^2$ single precision multiplications down to $2m^2 + m$ single precision multiplications. As -it stands now the algorithm is already fairly fast compared to a full integer division algorithm. However, there is still room for -optimization. - -After the first multiplication inside the quotient ($q_0 \cdot \mu$) the value is shifted right by $m + 1$ places effectively nullifying the lower -half of the product. It would be nice to be able to remove those digits from the product to effectively cut down the number of single precision -multiplications. If the number of digits in the modulus $m$ is far less than $\beta$ a full product is not required for the algorithm to work properly. -In fact the lower $m - 2$ digits will not affect the upper half of the product at all and do not need to be computed. - -The value of $\mu$ is a $m$-digit number and $q_0$ is a $m + 1$ digit number. Using a full multiplier $(m + 1)(m) = m^2 + m$ single precision -multiplications would be required. Using a multiplier that will only produce digits at and above the $m - 1$'th digit reduces the number -of single precision multiplications to ${m^2 + m} \over 2$ single precision multiplications. - -\subsection{Trimming the Residue} -After the quotient has been calculated it is used to reduce the input. As previously noted the algorithm is not exact and it can be off by a small -multiple of the modulus, that is $0 \le a - b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor < 3b$. If $b$ is $m$ digits than the -result of reduction equation is a value of at most $m + 1$ digits (\textit{provided $3 < \beta$}) implying that the upper $m - 1$ digits are -implicitly zero. - -The next optimization arises from this very fact. Instead of computing $b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor$ using a full -$O(m^2)$ multiplication algorithm only the lower $m+1$ digits of the product have to be computed. Similarly the value of $a$ can -be reduced modulo $\beta^{m+1}$ before the multiple of $b$ is subtracted which simplifes the subtraction as well. A multiplication that produces -only the lower $m+1$ digits requires ${m^2 + 3m - 2} \over 2$ single precision multiplications. - -With both optimizations in place the algorithm is the algorithm Barrett proposed. It requires $m^2 + 2m - 1$ single precision multiplications which -is considerably faster than the straightforward $3m^2$ method. - -\subsection{The Barrett Algorithm} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce}. \\ -\textbf{Input}. mp\_int $a$, mp\_int $b$ and $\mu = \lfloor \beta^{2m}/b \rfloor, m = \lceil lg_{\beta}(b) \rceil, (0 \le a < b^2, b > 1)$ \\ -\textbf{Output}. $a \mbox{ (mod }b\mbox{)}$ \\ -\hline \\ -Let $m$ represent the number of digits in $b$. \\ -1. Make a copy of $a$ and store it in $q$. (\textit{mp\_init\_copy}) \\ -2. $q \leftarrow \lfloor q / \beta^{m - 1} \rfloor$ (\textit{mp\_rshd}) \\ -\\ -Produce the quotient. \\ -3. $q \leftarrow q \cdot \mu$ (\textit{note: only produce digits at or above $m-1$}) \\ -4. $q \leftarrow \lfloor q / \beta^{m + 1} \rfloor$ \\ -\\ -Subtract the multiple of modulus from the input. \\ -5. $a \leftarrow a \mbox{ (mod }\beta^{m+1}\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -6. $q \leftarrow q \cdot b \mbox{ (mod }\beta^{m+1}\mbox{)}$ (\textit{s\_mp\_mul\_digs}) \\ -7. $a \leftarrow a - q$ (\textit{mp\_sub}) \\ -\\ -Add $\beta^{m+1}$ if a carry occured. \\ -8. If $a < 0$ then (\textit{mp\_cmp\_d}) \\ -\hspace{3mm}8.1 $q \leftarrow 1$ (\textit{mp\_set}) \\ -\hspace{3mm}8.2 $q \leftarrow q \cdot \beta^{m+1}$ (\textit{mp\_lshd}) \\ -\hspace{3mm}8.3 $a \leftarrow a + q$ \\ -\\ -Now subtract the modulus if the residue is too large (e.g. quotient too small). \\ -9. While $a \ge b$ do (\textit{mp\_cmp}) \\ -\hspace{3mm}9.1 $c \leftarrow a - b$ \\ -10. Clear $q$. \\ -11. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce} -\end{figure} - -\textbf{Algorithm mp\_reduce.} -This algorithm will reduce the input $a$ modulo $b$ in place using the Barrett algorithm. It is loosely based on algorithm 14.42 of HAC -\cite[pp. 602]{HAC} which is based on the paper from Paul Barrett \cite{BARRETT}. The algorithm has several restrictions and assumptions which must -be adhered to for the algorithm to work. - -First the modulus $b$ is assumed to be positive and greater than one. If the modulus were less than or equal to one than subtracting -a multiple of it would either accomplish nothing or actually enlarge the input. The input $a$ must be in the range $0 \le a < b^2$ in order -for the quotient to have enough precision. If $a$ is the product of two numbers that were already reduced modulo $b$, this will not be a problem. -Technically the algorithm will still work if $a \ge b^2$ but it will take much longer to finish. The value of $\mu$ is passed as an argument to this -algorithm and is assumed to be calculated and stored before the algorithm is used. - -Recall that the multiplication for the quotient on step 3 must only produce digits at or above the $m-1$'th position. An algorithm called -$s\_mp\_mul\_high\_digs$ which has not been presented is used to accomplish this task. The algorithm is based on $s\_mp\_mul\_digs$ except that -instead of stopping at a given level of precision it starts at a given level of precision. This optimal algorithm can only be used if the number -of digits in $b$ is very much smaller than $\beta$. - -While it is known that -$a \ge b \cdot \lfloor (q_0 \cdot \mu) / \beta^{m+1} \rfloor$ only the lower $m+1$ digits are being used to compute the residue, so an implied -``borrow'' from the higher digits might leave a negative result. After the multiple of the modulus has been subtracted from $a$ the residue must be -fixed up in case it is negative. The invariant $\beta^{m+1}$ must be added to the residue to make it positive again. - -The while loop at step 9 will subtract $b$ until the residue is less than $b$. If the algorithm is performed correctly this step is -performed at most twice, and on average once. However, if $a \ge b^2$ than it will iterate substantially more times than it should. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_reduce.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* reduces x mod m, assumes 0 < x < m**2, mu is -018 * precomputed via mp_reduce_setup. -019 * From HAC pp.604 Algorithm 14.42 -020 */ -021 int mp_reduce (mp_int * x, mp_int * m, mp_int * mu) -022 \{ -023 mp_int q; -024 int res, um = m->used; -025 -026 /* q = x */ -027 if ((res = mp_init_copy (&q, x)) != MP_OKAY) \{ -028 return res; -029 \} -030 -031 /* q1 = x / b**(k-1) */ -032 mp_rshd (&q, um - 1); -033 -034 /* according to HAC this optimization is ok */ -035 if (((mp_digit) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) \{ -036 if ((res = mp_mul (&q, mu, &q)) != MP_OKAY) \{ -037 goto CLEANUP; -038 \} -039 \} else \{ -040 #ifdef BN_S_MP_MUL_HIGH_DIGS_C -041 if ((res = s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) \{ -042 goto CLEANUP; -043 \} -044 #elif defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C) -045 if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) \{ -046 goto CLEANUP; -047 \} -048 #else -049 \{ -050 res = MP_VAL; -051 goto CLEANUP; -052 \} -053 #endif -054 \} -055 -056 /* q3 = q2 / b**(k+1) */ -057 mp_rshd (&q, um + 1); -058 -059 /* x = x mod b**(k+1), quick (no division) */ -060 if ((res = mp_mod_2d (x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) \{ -061 goto CLEANUP; -062 \} -063 -064 /* q = q * m mod b**(k+1), quick (no division) */ -065 if ((res = s_mp_mul_digs (&q, m, &q, um + 1)) != MP_OKAY) \{ -066 goto CLEANUP; -067 \} -068 -069 /* x = x - q */ -070 if ((res = mp_sub (x, &q, x)) != MP_OKAY) \{ -071 goto CLEANUP; -072 \} -073 -074 /* If x < 0, add b**(k+1) to it */ -075 if (mp_cmp_d (x, 0) == MP_LT) \{ -076 mp_set (&q, 1); -077 if ((res = mp_lshd (&q, um + 1)) != MP_OKAY) -078 goto CLEANUP; -079 if ((res = mp_add (x, &q, x)) != MP_OKAY) -080 goto CLEANUP; -081 \} -082 -083 /* Back off if it's too big */ -084 while (mp_cmp (x, m) != MP_LT) \{ -085 if ((res = s_mp_sub (x, m, x)) != MP_OKAY) \{ -086 goto CLEANUP; -087 \} -088 \} -089 -090 CLEANUP: -091 mp_clear (&q); -092 -093 return res; -094 \} -095 #endif -096 -\end{alltt} -\end{small} - -The first multiplication that determines the quotient can be performed by only producing the digits from $m - 1$ and up. This essentially halves -the number of single precision multiplications required. However, the optimization is only safe if $\beta$ is much larger than the number of digits -in the modulus. In the source code this is evaluated on lines 36 to 43 where algorithm s\_mp\_mul\_high\_digs is used when it is -safe to do so. - -\subsection{The Barrett Setup Algorithm} -In order to use algorithm mp\_reduce the value of $\mu$ must be calculated in advance. Ideally this value should be computed once and stored for -future use so that the Barrett algorithm can be used without delay. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_setup}. \\ -\textbf{Input}. mp\_int $a$ ($a > 1$) \\ -\textbf{Output}. $\mu \leftarrow \lfloor \beta^{2m}/a \rfloor$ \\ -\hline \\ -1. $\mu \leftarrow 2^{2 \cdot lg(\beta) \cdot m}$ (\textit{mp\_2expt}) \\ -2. $\mu \leftarrow \lfloor \mu / b \rfloor$ (\textit{mp\_div}) \\ -3. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_setup} -\end{figure} - -\textbf{Algorithm mp\_reduce\_setup.} -This algorithm computes the reciprocal $\mu$ required for Barrett reduction. First $\beta^{2m}$ is calculated as $2^{2 \cdot lg(\beta) \cdot m}$ which -is equivalent and much faster. The final value is computed by taking the integer quotient of $\lfloor \mu / b \rfloor$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_reduce\_setup.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* pre-calculate the value required for Barrett reduction -018 * For a given modulus "b" it calulates the value required in "a" -019 */ -020 int mp_reduce_setup (mp_int * a, mp_int * b) -021 \{ -022 int res; -023 -024 if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) \{ -025 return res; -026 \} -027 return mp_div (a, b, a, NULL); -028 \} -029 #endif -030 -\end{alltt} -\end{small} - -This simple routine calculates the reciprocal $\mu$ required by Barrett reduction. Note the extended usage of algorithm mp\_div where the variable -which would received the remainder is passed as NULL. As will be discussed in~\ref{sec:division} the division routine allows both the quotient and the -remainder to be passed as NULL meaning to ignore the value. - -\section{The Montgomery Reduction} -Montgomery reduction\footnote{Thanks to Niels Ferguson for his insightful explanation of the algorithm.} \cite{MONT} is by far the most interesting -form of reduction in common use. It computes a modular residue which is not actually equal to the residue of the input yet instead equal to a -residue times a constant. However, as perplexing as this may sound the algorithm is relatively simple and very efficient. - -Throughout this entire section the variable $n$ will represent the modulus used to form the residue. As will be discussed shortly the value of -$n$ must be odd. The variable $x$ will represent the quantity of which the residue is sought. Similar to the Barrett algorithm the input -is restricted to $0 \le x < n^2$. To begin the description some simple number theory facts must be established. - -\textbf{Fact 1.} Adding $n$ to $x$ does not change the residue since in effect it adds one to the quotient $\lfloor x / n \rfloor$. Another way -to explain this is that $n$ is (\textit{or multiples of $n$ are}) congruent to zero modulo $n$. Adding zero will not change the value of the residue. - -\textbf{Fact 2.} If $x$ is even then performing a division by two in $\Z$ is congruent to $x \cdot 2^{-1} \mbox{ (mod }n\mbox{)}$. Actually -this is an application of the fact that if $x$ is evenly divisible by any $k \in \Z$ then division in $\Z$ will be congruent to -multiplication by $k^{-1}$ modulo $n$. - -From these two simple facts the following simple algorithm can be derived. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Montgomery Reduction}. \\ -\textbf{Input}. Integer $x$, $n$ and $k$ \\ -\textbf{Output}. $2^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. for $t$ from $1$ to $k$ do \\ -\hspace{3mm}1.1 If $x$ is odd then \\ -\hspace{6mm}1.1.1 $x \leftarrow x + n$ \\ -\hspace{3mm}1.2 $x \leftarrow x/2$ \\ -2. Return $x$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Montgomery Reduction} -\end{figure} - -The algorithm reduces the input one bit at a time using the two congruencies stated previously. Inside the loop $n$, which is odd, is -added to $x$ if $x$ is odd. This forces $x$ to be even which allows the division by two in $\Z$ to be congruent to a modular division by two. Since -$x$ is assumed to be initially much larger than $n$ the addition of $n$ will contribute an insignificant magnitude to $x$. Let $r$ represent the -final result of the Montgomery algorithm. If $k > lg(n)$ and $0 \le x < n^2$ then the final result is limited to -$0 \le r < \lfloor x/2^k \rfloor + n$. As a result at most a single subtraction is required to get the residue desired. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|l|} -\hline \textbf{Step number ($t$)} & \textbf{Result ($x$)} \\ -\hline $1$ & $x + n = 5812$, $x/2 = 2906$ \\ -\hline $2$ & $x/2 = 1453$ \\ -\hline $3$ & $x + n = 1710$, $x/2 = 855$ \\ -\hline $4$ & $x + n = 1112$, $x/2 = 556$ \\ -\hline $5$ & $x/2 = 278$ \\ -\hline $6$ & $x/2 = 139$ \\ -\hline $7$ & $x + n = 396$, $x/2 = 198$ \\ -\hline $8$ & $x/2 = 99$ \\ -\hline $9$ & $x + n = 356$, $x/2 = 178$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Example of Montgomery Reduction (I)} -\label{fig:MONT1} -\end{figure} - -Consider the example in figure~\ref{fig:MONT1} which reduces $x = 5555$ modulo $n = 257$ when $k = 9$ (note $\beta^k = 512$ which is larger than $n$). The result of -the algorithm $r = 178$ is congruent to the value of $2^{-9} \cdot 5555 \mbox{ (mod }257\mbox{)}$. When $r$ is multiplied by $2^9$ modulo $257$ the correct residue -$r \equiv 158$ is produced. - -Let $k = \lfloor lg(n) \rfloor + 1$ represent the number of bits in $n$. The current algorithm requires $2k^2$ single precision shifts -and $k^2$ single precision additions. At this rate the algorithm is most certainly slower than Barrett reduction and not terribly useful. -Fortunately there exists an alternative representation of the algorithm. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Montgomery Reduction} (modified I). \\ -\textbf{Input}. Integer $x$, $n$ and $k$ ($2^k > n$) \\ -\textbf{Output}. $2^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. for $t$ from $1$ to $k$ do \\ -\hspace{3mm}1.1 If the $t$'th bit of $x$ is one then \\ -\hspace{6mm}1.1.1 $x \leftarrow x + 2^tn$ \\ -2. Return $x/2^k$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Montgomery Reduction (modified I)} -\end{figure} - -This algorithm is equivalent since $2^tn$ is a multiple of $n$ and the lower $k$ bits of $x$ are zero by step 2. The number of single -precision shifts has now been reduced from $2k^2$ to $k^2 + k$ which is only a small improvement. - -\begin{figure}[here] -\begin{small} -\begin{center} -\begin{tabular}{|c|l|r|} -\hline \textbf{Step number ($t$)} & \textbf{Result ($x$)} & \textbf{Result ($x$) in Binary} \\ -\hline -- & $5555$ & $1010110110011$ \\ -\hline $1$ & $x + 2^{0}n = 5812$ & $1011010110100$ \\ -\hline $2$ & $5812$ & $1011010110100$ \\ -\hline $3$ & $x + 2^{2}n = 6840$ & $1101010111000$ \\ -\hline $4$ & $x + 2^{3}n = 8896$ & $10001011000000$ \\ -\hline $5$ & $8896$ & $10001011000000$ \\ -\hline $6$ & $8896$ & $10001011000000$ \\ -\hline $7$ & $x + 2^{6}n = 25344$ & $110001100000000$ \\ -\hline $8$ & $25344$ & $110001100000000$ \\ -\hline $9$ & $x + 2^{7}n = 91136$ & $10110010000000000$ \\ -\hline -- & $x/2^k = 178$ & \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Example of Montgomery Reduction (II)} -\label{fig:MONT2} -\end{figure} - -Figure~\ref{fig:MONT2} demonstrates the modified algorithm reducing $x = 5555$ modulo $n = 257$ with $k = 9$. -With this algorithm a single shift right at the end is the only right shift required to reduce the input instead of $k$ right shifts inside the -loop. Note that for the iterations $t = 2, 5, 6$ and $8$ where the result $x$ is not changed. In those iterations the $t$'th bit of $x$ is -zero and the appropriate multiple of $n$ does not need to be added to force the $t$'th bit of the result to zero. - -\subsection{Digit Based Montgomery Reduction} -Instead of computing the reduction on a bit-by-bit basis it is actually much faster to compute it on digit-by-digit basis. Consider the -previous algorithm re-written to compute the Montgomery reduction in this new fashion. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Montgomery Reduction} (modified II). \\ -\textbf{Input}. Integer $x$, $n$ and $k$ ($\beta^k > n$) \\ -\textbf{Output}. $\beta^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. for $t$ from $0$ to $k - 1$ do \\ -\hspace{3mm}1.1 $x \leftarrow x + \mu n \beta^t$ \\ -2. Return $x/\beta^k$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Montgomery Reduction (modified II)} -\end{figure} - -The value $\mu n \beta^t$ is a multiple of the modulus $n$ meaning that it will not change the residue. If the first digit of -the value $\mu n \beta^t$ equals the negative (modulo $\beta$) of the $t$'th digit of $x$ then the addition will result in a zero digit. This -problem breaks down to solving the following congruency. - -\begin{center} -\begin{tabular}{rcl} -$x_t + \mu n_0$ & $\equiv$ & $0 \mbox{ (mod }\beta\mbox{)}$ \\ -$\mu n_0$ & $\equiv$ & $-x_t \mbox{ (mod }\beta\mbox{)}$ \\ -$\mu$ & $\equiv$ & $-x_t/n_0 \mbox{ (mod }\beta\mbox{)}$ \\ -\end{tabular} -\end{center} - -In each iteration of the loop on step 1 a new value of $\mu$ must be calculated. The value of $-1/n_0 \mbox{ (mod }\beta\mbox{)}$ is used -extensively in this algorithm and should be precomputed. Let $\rho$ represent the negative of the modular inverse of $n_0$ modulo $\beta$. - -For example, let $\beta = 10$ represent the radix. Let $n = 17$ represent the modulus which implies $k = 2$ and $\rho \equiv 7$. Let $x = 33$ -represent the value to reduce. - -\newpage\begin{figure} -\begin{center} -\begin{tabular}{|c|c|c|} -\hline \textbf{Step ($t$)} & \textbf{Value of $x$} & \textbf{Value of $\mu$} \\ -\hline -- & $33$ & --\\ -\hline $0$ & $33 + \mu n = 50$ & $1$ \\ -\hline $1$ & $50 + \mu n \beta = 900$ & $5$ \\ -\hline -\end{tabular} -\end{center} -\caption{Example of Montgomery Reduction} -\end{figure} - -The final result $900$ is then divided by $\beta^k$ to produce the final result $9$. The first observation is that $9 \nequiv x \mbox{ (mod }n\mbox{)}$ -which implies the result is not the modular residue of $x$ modulo $n$. However, recall that the residue is actually multiplied by $\beta^{-k}$ in -the algorithm. To get the true residue the value must be multiplied by $\beta^k$. In this case $\beta^k \equiv 15 \mbox{ (mod }n\mbox{)}$ and -the correct residue is $9 \cdot 15 \equiv 16 \mbox{ (mod }n\mbox{)}$. - -\subsection{Baseline Montgomery Reduction} -The baseline Montgomery reduction algorithm will produce the residue for any size input. It is designed to be a catch-all algororithm for -Montgomery reductions. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_montgomery\_reduce}. \\ -\textbf{Input}. mp\_int $x$, mp\_int $n$ and a digit $\rho \equiv -1/n_0 \mbox{ (mod }n\mbox{)}$. \\ -\hspace{11.5mm}($0 \le x < n^2, n > 1, (n, \beta) = 1, \beta^k > n$) \\ -\textbf{Output}. $\beta^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -1. $digs \leftarrow 2n.used + 1$ \\ -2. If $digs < MP\_ARRAY$ and $m.used < \delta$ then \\ -\hspace{3mm}2.1 Use algorithm fast\_mp\_montgomery\_reduce instead. \\ -\\ -Setup $x$ for the reduction. \\ -3. If $x.alloc < digs$ then grow $x$ to $digs$ digits. \\ -4. $x.used \leftarrow digs$ \\ -\\ -Eliminate the lower $k$ digits. \\ -5. For $ix$ from $0$ to $k - 1$ do \\ -\hspace{3mm}5.1 $\mu \leftarrow x_{ix} \cdot \rho \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}5.2 $u \leftarrow 0$ \\ -\hspace{3mm}5.3 For $iy$ from $0$ to $k - 1$ do \\ -\hspace{6mm}5.3.1 $\hat r \leftarrow \mu n_{iy} + x_{ix + iy} + u$ \\ -\hspace{6mm}5.3.2 $x_{ix + iy} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{6mm}5.3.3 $u \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -\hspace{3mm}5.4 While $u > 0$ do \\ -\hspace{6mm}5.4.1 $iy \leftarrow iy + 1$ \\ -\hspace{6mm}5.4.2 $x_{ix + iy} \leftarrow x_{ix + iy} + u$ \\ -\hspace{6mm}5.4.3 $u \leftarrow \lfloor x_{ix+iy} / \beta \rfloor$ \\ -\hspace{6mm}5.4.4 $x_{ix + iy} \leftarrow x_{ix+iy} \mbox{ (mod }\beta\mbox{)}$ \\ -\\ -Divide by $\beta^k$ and fix up as required. \\ -6. $x \leftarrow \lfloor x / \beta^k \rfloor$ \\ -7. If $x \ge n$ then \\ -\hspace{3mm}7.1 $x \leftarrow x - n$ \\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_montgomery\_reduce} -\end{figure} - -\textbf{Algorithm mp\_montgomery\_reduce.} -This algorithm reduces the input $x$ modulo $n$ in place using the Montgomery reduction algorithm. The algorithm is loosely based -on algorithm 14.32 of \cite[pp.601]{HAC} except it merges the multiplication of $\mu n \beta^t$ with the addition in the inner loop. The -restrictions on this algorithm are fairly easy to adapt to. First $0 \le x < n^2$ bounds the input to numbers in the same range as -for the Barrett algorithm. Additionally if $n > 1$ and $n$ is odd there will exist a modular inverse $\rho$. $\rho$ must be calculated in -advance of this algorithm. Finally the variable $k$ is fixed and a pseudonym for $n.used$. - -Step 2 decides whether a faster Montgomery algorithm can be used. It is based on the Comba technique meaning that there are limits on -the size of the input. This algorithm is discussed in sub-section 6.3.3. - -Step 5 is the main reduction loop of the algorithm. The value of $\mu$ is calculated once per iteration in the outer loop. The inner loop -calculates $x + \mu n \beta^{ix}$ by multiplying $\mu n$ and adding the result to $x$ shifted by $ix$ digits. Both the addition and -multiplication are performed in the same loop to save time and memory. Step 5.4 will handle any additional carries that escape the inner loop. - -Using a quick inspection this algorithm requires $n$ single precision multiplications for the outer loop and $n^2$ single precision multiplications -in the inner loop. In total $n^2 + n$ single precision multiplications which compares favourably to Barrett at $n^2 + 2n - 1$ single precision -multiplications. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_montgomery\_reduce.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* computes xR**-1 == x (mod N) via Montgomery Reduction */ -018 int -019 mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) -020 \{ -021 int ix, res, digs; -022 mp_digit mu; -023 -024 /* can the fast reduction [comba] method be used? -025 * -026 * Note that unlike in mul you're safely allowed *less* -027 * than the available columns [255 per default] since carries -028 * are fixed up in the inner loop. -029 */ -030 digs = (n->used * 2) + 1; -031 if ((digs < MP_WARRAY) && -032 (n->used < -033 (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) \{ -034 return fast_mp_montgomery_reduce (x, n, rho); -035 \} -036 -037 /* grow the input as required */ -038 if (x->alloc < digs) \{ -039 if ((res = mp_grow (x, digs)) != MP_OKAY) \{ -040 return res; -041 \} -042 \} -043 x->used = digs; -044 -045 for (ix = 0; ix < n->used; ix++) \{ -046 /* mu = ai * rho mod b -047 * -048 * The value of rho must be precalculated via -049 * montgomery_setup() such that -050 * it equals -1/n0 mod b this allows the -051 * following inner loop to reduce the -052 * input one digit at a time -053 */ -054 mu = (mp_digit) (((mp_word)x->dp[ix] * (mp_word)rho) & MP_MASK); -055 -056 /* a = a + mu * m * b**i */ -057 \{ -058 int iy; -059 mp_digit *tmpn, *tmpx, u; -060 mp_word r; -061 -062 /* alias for digits of the modulus */ -063 tmpn = n->dp; -064 -065 /* alias for the digits of x [the input] */ -066 tmpx = x->dp + ix; -067 -068 /* set the carry to zero */ -069 u = 0; -070 -071 /* Multiply and add in place */ -072 for (iy = 0; iy < n->used; iy++) \{ -073 /* compute product and sum */ -074 r = ((mp_word)mu * (mp_word)*tmpn++) + -075 (mp_word) u + (mp_word) *tmpx; -076 -077 /* get carry */ -078 u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); -079 -080 /* fix digit */ -081 *tmpx++ = (mp_digit)(r & ((mp_word) MP_MASK)); -082 \} -083 /* At this point the ix'th digit of x should be zero */ -084 -085 -086 /* propagate carries upwards as required*/ -087 while (u != 0) \{ -088 *tmpx += u; -089 u = *tmpx >> DIGIT_BIT; -090 *tmpx++ &= MP_MASK; -091 \} -092 \} -093 \} -094 -095 /* at this point the n.used'th least -096 * significant digits of x are all zero -097 * which means we can shift x to the -098 * right by n.used digits and the -099 * residue is unchanged. -100 */ -101 -102 /* x = x/b**n.used */ -103 mp_clamp(x); -104 mp_rshd (x, n->used); -105 -106 /* if x >= n then x = x - n */ -107 if (mp_cmp_mag (x, n) != MP_LT) \{ -108 return s_mp_sub (x, n, x); -109 \} -110 -111 return MP_OKAY; -112 \} -113 #endif -114 -\end{alltt} -\end{small} - -This is the baseline implementation of the Montgomery reduction algorithm. Lines 30 to 35 determine if the Comba based -routine can be used instead. Line 48 computes the value of $\mu$ for that particular iteration of the outer loop. - -The multiplication $\mu n \beta^{ix}$ is performed in one step in the inner loop. The alias $tmpx$ refers to the $ix$'th digit of $x$ and -the alias $tmpn$ refers to the modulus $n$. - -\subsection{Faster ``Comba'' Montgomery Reduction} - -The Montgomery reduction requires fewer single precision multiplications than a Barrett reduction, however it is much slower due to the serial -nature of the inner loop. The Barrett reduction algorithm requires two slightly modified multipliers which can be implemented with the Comba -technique. The Montgomery reduction algorithm cannot directly use the Comba technique to any significant advantage since the inner loop calculates -a $k \times 1$ product $k$ times. - -The biggest obstacle is that at the $ix$'th iteration of the outer loop the value of $x_{ix}$ is required to calculate $\mu$. This means the -carries from $0$ to $ix - 1$ must have been propagated upwards to form a valid $ix$'th digit. The solution as it turns out is very simple. -Perform a Comba like multiplier and inside the outer loop just after the inner loop fix up the $ix + 1$'th digit by forwarding the carry. - -With this change in place the Montgomery reduction algorithm can be performed with a Comba style multiplication loop which substantially increases -the speed of the algorithm. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{fast\_mp\_montgomery\_reduce}. \\ -\textbf{Input}. mp\_int $x$, mp\_int $n$ and a digit $\rho \equiv -1/n_0 \mbox{ (mod }n\mbox{)}$. \\ -\hspace{11.5mm}($0 \le x < n^2, n > 1, (n, \beta) = 1, \beta^k > n$) \\ -\textbf{Output}. $\beta^{-k}x \mbox{ (mod }n\mbox{)}$ \\ -\hline \\ -Place an array of \textbf{MP\_WARRAY} mp\_word variables called $\hat W$ on the stack. \\ -1. if $x.alloc < n.used + 1$ then grow $x$ to $n.used + 1$ digits. \\ -Copy the digits of $x$ into the array $\hat W$ \\ -2. For $ix$ from $0$ to $x.used - 1$ do \\ -\hspace{3mm}2.1 $\hat W_{ix} \leftarrow x_{ix}$ \\ -3. For $ix$ from $x.used$ to $2n.used - 1$ do \\ -\hspace{3mm}3.1 $\hat W_{ix} \leftarrow 0$ \\ -Elimiate the lower $k$ digits. \\ -4. for $ix$ from $0$ to $n.used - 1$ do \\ -\hspace{3mm}4.1 $\mu \leftarrow \hat W_{ix} \cdot \rho \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}4.2 For $iy$ from $0$ to $n.used - 1$ do \\ -\hspace{6mm}4.2.1 $\hat W_{iy + ix} \leftarrow \hat W_{iy + ix} + \mu \cdot n_{iy}$ \\ -\hspace{3mm}4.3 $\hat W_{ix + 1} \leftarrow \hat W_{ix + 1} + \lfloor \hat W_{ix} / \beta \rfloor$ \\ -Propagate carries upwards. \\ -5. for $ix$ from $n.used$ to $2n.used + 1$ do \\ -\hspace{3mm}5.1 $\hat W_{ix + 1} \leftarrow \hat W_{ix + 1} + \lfloor \hat W_{ix} / \beta \rfloor$ \\ -Shift right and reduce modulo $\beta$ simultaneously. \\ -6. for $ix$ from $0$ to $n.used + 1$ do \\ -\hspace{3mm}6.1 $x_{ix} \leftarrow \hat W_{ix + n.used} \mbox{ (mod }\beta\mbox{)}$ \\ -Zero excess digits and fixup $x$. \\ -7. if $x.used > n.used + 1$ then do \\ -\hspace{3mm}7.1 for $ix$ from $n.used + 1$ to $x.used - 1$ do \\ -\hspace{6mm}7.1.1 $x_{ix} \leftarrow 0$ \\ -8. $x.used \leftarrow n.used + 1$ \\ -9. Clamp excessive digits of $x$. \\ -10. If $x \ge n$ then \\ -\hspace{3mm}10.1 $x \leftarrow x - n$ \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm fast\_mp\_montgomery\_reduce} -\end{figure} - -\textbf{Algorithm fast\_mp\_montgomery\_reduce.} -This algorithm will compute the Montgomery reduction of $x$ modulo $n$ using the Comba technique. It is on most computer platforms significantly -faster than algorithm mp\_montgomery\_reduce and algorithm mp\_reduce (\textit{Barrett reduction}). The algorithm has the same restrictions -on the input as the baseline reduction algorithm. An additional two restrictions are imposed on this algorithm. The number of digits $k$ in the -the modulus $n$ must not violate $MP\_WARRAY > 2k +1$ and $n < \delta$. When $\beta = 2^{28}$ this algorithm can be used to reduce modulo -a modulus of at most $3,556$ bits in length. - -As in the other Comba reduction algorithms there is a $\hat W$ array which stores the columns of the product. It is initially filled with the -contents of $x$ with the excess digits zeroed. The reduction loop is very similar the to the baseline loop at heart. The multiplication on step -4.1 can be single precision only since $ab \mbox{ (mod }\beta\mbox{)} \equiv (a \mbox{ mod }\beta)(b \mbox{ mod }\beta)$. Some multipliers such -as those on the ARM processors take a variable length time to complete depending on the number of bytes of result it must produce. By performing -a single precision multiplication instead half the amount of time is spent. - -Also note that digit $\hat W_{ix}$ must have the carry from the $ix - 1$'th digit propagated upwards in order for this to work. That is what step -4.3 will do. In effect over the $n.used$ iterations of the outer loop the $n.used$'th lower columns all have the their carries propagated forwards. Note -how the upper bits of those same words are not reduced modulo $\beta$. This is because those values will be discarded shortly and there is no -point. - -Step 5 will propagate the remainder of the carries upwards. On step 6 the columns are reduced modulo $\beta$ and shifted simultaneously as they are -stored in the destination $x$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_fast\_mp\_montgomery\_reduce.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* computes xR**-1 == x (mod N) via Montgomery Reduction -018 * -019 * This is an optimized implementation of montgomery_reduce -020 * which uses the comba method to quickly calculate the columns of the -021 * reduction. -022 * -023 * Based on Algorithm 14.32 on pp.601 of HAC. -024 */ -025 int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) -026 \{ -027 int ix, res, olduse; -028 mp_word W[MP_WARRAY]; -029 -030 /* get old used count */ -031 olduse = x->used; -032 -033 /* grow a as required */ -034 if (x->alloc < (n->used + 1)) \{ -035 if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) \{ -036 return res; -037 \} -038 \} -039 -040 /* first we have to get the digits of the input into -041 * an array of double precision words W[...] -042 */ -043 \{ -044 mp_word *_W; -045 mp_digit *tmpx; -046 -047 /* alias for the W[] array */ -048 _W = W; -049 -050 /* alias for the digits of x*/ -051 tmpx = x->dp; -052 -053 /* copy the digits of a into W[0..a->used-1] */ -054 for (ix = 0; ix < x->used; ix++) \{ -055 *_W++ = *tmpx++; -056 \} -057 -058 /* zero the high words of W[a->used..m->used*2] */ -059 for (; ix < ((n->used * 2) + 1); ix++) \{ -060 *_W++ = 0; -061 \} -062 \} -063 -064 /* now we proceed to zero successive digits -065 * from the least significant upwards -066 */ -067 for (ix = 0; ix < n->used; ix++) \{ -068 /* mu = ai * m' mod b -069 * -070 * We avoid a double precision multiplication (which isn't required) -071 * by casting the value down to a mp_digit. Note this requires -072 * that W[ix-1] have the carry cleared (see after the inner loop) -073 */ -074 mp_digit mu; -075 mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK); -076 -077 /* a = a + mu * m * b**i -078 * -079 * This is computed in place and on the fly. The multiplication -080 * by b**i is handled by offseting which columns the results -081 * are added to. -082 * -083 * Note the comba method normally doesn't handle carries in the -084 * inner loop In this case we fix the carry from the previous -085 * column since the Montgomery reduction requires digits of the -086 * result (so far) [see above] to work. This is -087 * handled by fixing up one carry after the inner loop. The -088 * carry fixups are done in order so after these loops the -089 * first m->used words of W[] have the carries fixed -090 */ -091 \{ -092 int iy; -093 mp_digit *tmpn; -094 mp_word *_W; -095 -096 /* alias for the digits of the modulus */ -097 tmpn = n->dp; -098 -099 /* Alias for the columns set by an offset of ix */ -100 _W = W + ix; -101 -102 /* inner loop */ -103 for (iy = 0; iy < n->used; iy++) \{ -104 *_W++ += ((mp_word)mu) * ((mp_word)*tmpn++); -105 \} -106 \} -107 -108 /* now fix carry for next digit, W[ix+1] */ -109 W[ix + 1] += W[ix] >> ((mp_word) DIGIT_BIT); -110 \} -111 -112 /* now we have to propagate the carries and -113 * shift the words downward [all those least -114 * significant digits we zeroed]. -115 */ -116 \{ -117 mp_digit *tmpx; -118 mp_word *_W, *_W1; -119 -120 /* nox fix rest of carries */ -121 -122 /* alias for current word */ -123 _W1 = W + ix; -124 -125 /* alias for next word, where the carry goes */ -126 _W = W + ++ix; -127 -128 for (; ix <= ((n->used * 2) + 1); ix++) \{ -129 *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT); -130 \} -131 -132 /* copy out, A = A/b**n -133 * -134 * The result is A/b**n but instead of converting from an -135 * array of mp_word to mp_digit than calling mp_rshd -136 * we just copy them in the right order -137 */ -138 -139 /* alias for destination word */ -140 tmpx = x->dp; -141 -142 /* alias for shifted double precision result */ -143 _W = W + n->used; -144 -145 for (ix = 0; ix < (n->used + 1); ix++) \{ -146 *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK)); -147 \} -148 -149 /* zero oldused digits, if the input a was larger than -150 * m->used+1 we'll have to clear the digits -151 */ -152 for (; ix < olduse; ix++) \{ -153 *tmpx++ = 0; -154 \} -155 \} -156 -157 /* set the max used and clamp */ -158 x->used = n->used + 1; -159 mp_clamp (x); -160 -161 /* if A >= m then A = A - m */ -162 if (mp_cmp_mag (x, n) != MP_LT) \{ -163 return s_mp_sub (x, n, x); -164 \} -165 return MP_OKAY; -166 \} -167 #endif -168 -\end{alltt} -\end{small} - -The $\hat W$ array is first filled with digits of $x$ on line 50 then the rest of the digits are zeroed on line 54. Both loops share -the same alias variables to make the code easier to read. - -The value of $\mu$ is calculated in an interesting fashion. First the value $\hat W_{ix}$ is reduced modulo $\beta$ and cast to a mp\_digit. This -forces the compiler to use a single precision multiplication and prevents any concerns about loss of precision. Line 109 fixes the carry -for the next iteration of the loop by propagating the carry from $\hat W_{ix}$ to $\hat W_{ix+1}$. - -The for loop on line 108 propagates the rest of the carries upwards through the columns. The for loop on line 125 reduces the columns -modulo $\beta$ and shifts them $k$ places at the same time. The alias $\_ \hat W$ actually refers to the array $\hat W$ starting at the $n.used$'th -digit, that is $\_ \hat W_{t} = \hat W_{n.used + t}$. - -\subsection{Montgomery Setup} -To calculate the variable $\rho$ a relatively simple algorithm will be required. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_montgomery\_setup}. \\ -\textbf{Input}. mp\_int $n$ ($n > 1$ and $(n, 2) = 1$) \\ -\textbf{Output}. $\rho \equiv -1/n_0 \mbox{ (mod }\beta\mbox{)}$ \\ -\hline \\ -1. $b \leftarrow n_0$ \\ -2. If $b$ is even return(\textit{MP\_VAL}) \\ -3. $x \leftarrow (((b + 2) \mbox{ AND } 4) << 1) + b$ \\ -4. for $k$ from 0 to $\lceil lg(lg(\beta)) \rceil - 2$ do \\ -\hspace{3mm}4.1 $x \leftarrow x \cdot (2 - bx)$ \\ -5. $\rho \leftarrow \beta - x \mbox{ (mod }\beta\mbox{)}$ \\ -6. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_montgomery\_setup} -\end{figure} - -\textbf{Algorithm mp\_montgomery\_setup.} -This algorithm will calculate the value of $\rho$ required within the Montgomery reduction algorithms. It uses a very interesting trick -to calculate $1/n_0$ when $\beta$ is a power of two. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_montgomery\_setup.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* setups the montgomery reduction stuff */ -018 int -019 mp_montgomery_setup (mp_int * n, mp_digit * rho) -020 \{ -021 mp_digit x, b; -022 -023 /* fast inversion mod 2**k -024 * -025 * Based on the fact that -026 * -027 * XA = 1 (mod 2**n) => (X(2-XA)) A = 1 (mod 2**2n) -028 * => 2*X*A - X*X*A*A = 1 -029 * => 2*(1) - (1) = 1 -030 */ -031 b = n->dp[0]; -032 -033 if ((b & 1) == 0) \{ -034 return MP_VAL; -035 \} -036 -037 x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */ -038 x *= 2 - (b * x); /* here x*a==1 mod 2**8 */ -039 #if !defined(MP_8BIT) -040 x *= 2 - (b * x); /* here x*a==1 mod 2**16 */ -041 #endif -042 #if defined(MP_64BIT) || !(defined(MP_8BIT) || defined(MP_16BIT)) -043 x *= 2 - (b * x); /* here x*a==1 mod 2**32 */ -044 #endif -045 #ifdef MP_64BIT -046 x *= 2 - (b * x); /* here x*a==1 mod 2**64 */ -047 #endif -048 -049 /* rho = -1/m mod b */ -050 *rho = (mp_digit)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK; -051 -052 return MP_OKAY; -053 \} -054 #endif -055 -\end{alltt} -\end{small} - -This source code computes the value of $\rho$ required to perform Montgomery reduction. It has been modified to avoid performing excess -multiplications when $\beta$ is not the default 28-bits. - -\section{The Diminished Radix Algorithm} -The Diminished Radix method of modular reduction \cite{DRMET} is a fairly clever technique which can be more efficient than either the Barrett -or Montgomery methods for certain forms of moduli. The technique is based on the following simple congruence. - -\begin{equation} -(x \mbox{ mod } n) + k \lfloor x / n \rfloor \equiv x \mbox{ (mod }(n - k)\mbox{)} -\end{equation} - -This observation was used in the MMB \cite{MMB} block cipher to create a diffusion primitive. It used the fact that if $n = 2^{31}$ and $k=1$ that -then a x86 multiplier could produce the 62-bit product and use the ``shrd'' instruction to perform a double-precision right shift. The proof -of the above equation is very simple. First write $x$ in the product form. - -\begin{equation} -x = qn + r -\end{equation} - -Now reduce both sides modulo $(n - k)$. - -\begin{equation} -x \equiv qk + r \mbox{ (mod }(n-k)\mbox{)} -\end{equation} - -The variable $n$ reduces modulo $n - k$ to $k$. By putting $q = \lfloor x/n \rfloor$ and $r = x \mbox{ mod } n$ -into the equation the original congruence is reproduced, thus concluding the proof. The following algorithm is based on this observation. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Diminished Radix Reduction}. \\ -\textbf{Input}. Integer $x$, $n$, $k$ \\ -\textbf{Output}. $x \mbox{ mod } (n - k)$ \\ -\hline \\ -1. $q \leftarrow \lfloor x / n \rfloor$ \\ -2. $q \leftarrow k \cdot q$ \\ -3. $x \leftarrow x \mbox{ (mod }n\mbox{)}$ \\ -4. $x \leftarrow x + q$ \\ -5. If $x \ge (n - k)$ then \\ -\hspace{3mm}5.1 $x \leftarrow x - (n - k)$ \\ -\hspace{3mm}5.2 Goto step 1. \\ -6. Return $x$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Diminished Radix Reduction} -\label{fig:DR} -\end{figure} - -This algorithm will reduce $x$ modulo $n - k$ and return the residue. If $0 \le x < (n - k)^2$ then the algorithm will loop almost always -once or twice and occasionally three times. For simplicity sake the value of $x$ is bounded by the following simple polynomial. - -\begin{equation} -0 \le x < n^2 + k^2 - 2nk -\end{equation} - -The true bound is $0 \le x < (n - k - 1)^2$ but this has quite a few more terms. The value of $q$ after step 1 is bounded by the following. - -\begin{equation} -q < n - 2k - k^2/n -\end{equation} - -Since $k^2$ is going to be considerably smaller than $n$ that term will always be zero. The value of $x$ after step 3 is bounded trivially as -$0 \le x < n$. By step four the sum $x + q$ is bounded by - -\begin{equation} -0 \le q + x < (k + 1)n - 2k^2 - 1 -\end{equation} - -With a second pass $q$ will be loosely bounded by $0 \le q < k^2$ after step 2 while $x$ will still be loosely bounded by $0 \le x < n$ after step 3. After the second pass it is highly unlike that the -sum in step 4 will exceed $n - k$. In practice fewer than three passes of the algorithm are required to reduce virtually every input in the -range $0 \le x < (n - k - 1)^2$. - -\begin{figure} -\begin{small} -\begin{center} -\begin{tabular}{|l|} -\hline -$x = 123456789, n = 256, k = 3$ \\ -\hline $q \leftarrow \lfloor x/n \rfloor = 482253$ \\ -$q \leftarrow q*k = 1446759$ \\ -$x \leftarrow x \mbox{ mod } n = 21$ \\ -$x \leftarrow x + q = 1446780$ \\ -$x \leftarrow x - (n - k) = 1446527$ \\ -\hline -$q \leftarrow \lfloor x/n \rfloor = 5650$ \\ -$q \leftarrow q*k = 16950$ \\ -$x \leftarrow x \mbox{ mod } n = 127$ \\ -$x \leftarrow x + q = 17077$ \\ -$x \leftarrow x - (n - k) = 16824$ \\ -\hline -$q \leftarrow \lfloor x/n \rfloor = 65$ \\ -$q \leftarrow q*k = 195$ \\ -$x \leftarrow x \mbox{ mod } n = 184$ \\ -$x \leftarrow x + q = 379$ \\ -$x \leftarrow x - (n - k) = 126$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Example Diminished Radix Reduction} -\label{fig:EXDR} -\end{figure} - -Figure~\ref{fig:EXDR} demonstrates the reduction of $x = 123456789$ modulo $n - k = 253$ when $n = 256$ and $k = 3$. Note that even while $x$ -is considerably larger than $(n - k - 1)^2 = 63504$ the algorithm still converges on the modular residue exceedingly fast. In this case only -three passes were required to find the residue $x \equiv 126$. - - -\subsection{Choice of Moduli} -On the surface this algorithm looks like a very expensive algorithm. It requires a couple of subtractions followed by multiplication and other -modular reductions. The usefulness of this algorithm becomes exceedingly clear when an appropriate modulus is chosen. - -Division in general is a very expensive operation to perform. The one exception is when the division is by a power of the radix of representation used. -Division by ten for example is simple for pencil and paper mathematics since it amounts to shifting the decimal place to the right. Similarly division -by two (\textit{or powers of two}) is very simple for binary computers to perform. It would therefore seem logical to choose $n$ of the form $2^p$ -which would imply that $\lfloor x / n \rfloor$ is a simple shift of $x$ right $p$ bits. - -However, there is one operation related to division of power of twos that is even faster than this. If $n = \beta^p$ then the division may be -performed by moving whole digits to the right $p$ places. In practice division by $\beta^p$ is much faster than division by $2^p$ for any $p$. -Also with the choice of $n = \beta^p$ reducing $x$ modulo $n$ merely requires zeroing the digits above the $p-1$'th digit of $x$. - -Throughout the next section the term ``restricted modulus'' will refer to a modulus of the form $\beta^p - k$ whereas the term ``unrestricted -modulus'' will refer to a modulus of the form $2^p - k$. The word ``restricted'' in this case refers to the fact that it is based on the -$2^p$ logic except $p$ must be a multiple of $lg(\beta)$. - -\subsection{Choice of $k$} -Now that division and reduction (\textit{step 1 and 3 of figure~\ref{fig:DR}}) have been optimized to simple digit operations the multiplication by $k$ -in step 2 is the most expensive operation. Fortunately the choice of $k$ is not terribly limited. For all intents and purposes it might -as well be a single digit. The smaller the value of $k$ is the faster the algorithm will be. - -\subsection{Restricted Diminished Radix Reduction} -The restricted Diminished Radix algorithm can quickly reduce an input modulo a modulus of the form $n = \beta^p - k$. This algorithm can reduce -an input $x$ within the range $0 \le x < n^2$ using only a couple passes of the algorithm demonstrated in figure~\ref{fig:DR}. The implementation -of this algorithm has been optimized to avoid additional overhead associated with a division by $\beta^p$, the multiplication by $k$ or the addition -of $x$ and $q$. The resulting algorithm is very efficient and can lead to substantial improvements over Barrett and Montgomery reduction when modular -exponentiations are performed. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_dr\_reduce}. \\ -\textbf{Input}. mp\_int $x$, $n$ and a mp\_digit $k = \beta - n_0$ \\ -\hspace{11.5mm}($0 \le x < n^2$, $n > 1$, $0 < k < \beta$) \\ -\textbf{Output}. $x \mbox{ mod } n$ \\ -\hline \\ -1. $m \leftarrow n.used$ \\ -2. If $x.alloc < 2m$ then grow $x$ to $2m$ digits. \\ -3. $\mu \leftarrow 0$ \\ -4. for $i$ from $0$ to $m - 1$ do \\ -\hspace{3mm}4.1 $\hat r \leftarrow k \cdot x_{m+i} + x_{i} + \mu$ \\ -\hspace{3mm}4.2 $x_{i} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}4.3 $\mu \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -5. $x_{m} \leftarrow \mu$ \\ -6. for $i$ from $m + 1$ to $x.used - 1$ do \\ -\hspace{3mm}6.1 $x_{i} \leftarrow 0$ \\ -7. Clamp excess digits of $x$. \\ -8. If $x \ge n$ then \\ -\hspace{3mm}8.1 $x \leftarrow x - n$ \\ -\hspace{3mm}8.2 Goto step 3. \\ -9. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_dr\_reduce} -\end{figure} - -\textbf{Algorithm mp\_dr\_reduce.} -This algorithm will perform the Dimished Radix reduction of $x$ modulo $n$. It has similar restrictions to that of the Barrett reduction -with the addition that $n$ must be of the form $n = \beta^m - k$ where $0 < k <\beta$. - -This algorithm essentially implements the pseudo-code in figure~\ref{fig:DR} except with a slight optimization. The division by $\beta^m$, multiplication by $k$ -and addition of $x \mbox{ mod }\beta^m$ are all performed simultaneously inside the loop on step 4. The division by $\beta^m$ is emulated by accessing -the term at the $m+i$'th position which is subsequently multiplied by $k$ and added to the term at the $i$'th position. After the loop the $m$'th -digit is set to the carry and the upper digits are zeroed. Steps 5 and 6 emulate the reduction modulo $\beta^m$ that should have happend to -$x$ before the addition of the multiple of the upper half. - -At step 8 if $x$ is still larger than $n$ another pass of the algorithm is required. First $n$ is subtracted from $x$ and then the algorithm resumes -at step 3. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_dr\_reduce.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* reduce "x" in place modulo "n" using the Diminished Radix algorithm. -018 * -019 * Based on algorithm from the paper -020 * -021 * "Generating Efficient Primes for Discrete Log Cryptosystems" -022 * Chae Hoon Lim, Pil Joong Lee, -023 * POSTECH Information Research Laboratories -024 * -025 * The modulus must be of a special format [see manual] -026 * -027 * Has been modified to use algorithm 7.10 from the LTM book instead -028 * -029 * Input x must be in the range 0 <= x <= (n-1)**2 -030 */ -031 int -032 mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k) -033 \{ -034 int err, i, m; -035 mp_word r; -036 mp_digit mu, *tmpx1, *tmpx2; -037 -038 /* m = digits in modulus */ -039 m = n->used; -040 -041 /* ensure that "x" has at least 2m digits */ -042 if (x->alloc < (m + m)) \{ -043 if ((err = mp_grow (x, m + m)) != MP_OKAY) \{ -044 return err; -045 \} -046 \} -047 -048 /* top of loop, this is where the code resumes if -049 * another reduction pass is required. -050 */ -051 top: -052 /* aliases for digits */ -053 /* alias for lower half of x */ -054 tmpx1 = x->dp; -055 -056 /* alias for upper half of x, or x/B**m */ -057 tmpx2 = x->dp + m; -058 -059 /* set carry to zero */ -060 mu = 0; -061 -062 /* compute (x mod B**m) + k * [x/B**m] inline and inplace */ -063 for (i = 0; i < m; i++) \{ -064 r = (((mp_word)*tmpx2++) * (mp_word)k) + *tmpx1 + mu; -065 *tmpx1++ = (mp_digit)(r & MP_MASK); -066 mu = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); -067 \} -068 -069 /* set final carry */ -070 *tmpx1++ = mu; -071 -072 /* zero words above m */ -073 for (i = m + 1; i < x->used; i++) \{ -074 *tmpx1++ = 0; -075 \} -076 -077 /* clamp, sub and return */ -078 mp_clamp (x); -079 -080 /* if x >= n then subtract and reduce again -081 * Each successive "recursion" makes the input smaller and smaller. -082 */ -083 if (mp_cmp_mag (x, n) != MP_LT) \{ -084 if ((err = s_mp_sub(x, n, x)) != MP_OKAY) \{ -085 return err; -086 \} -087 goto top; -088 \} -089 return MP_OKAY; -090 \} -091 #endif -092 -\end{alltt} -\end{small} - -The first step is to grow $x$ as required to $2m$ digits since the reduction is performed in place on $x$. The label on line 51 is where -the algorithm will resume if further reduction passes are required. In theory it could be placed at the top of the function however, the size of -the modulus and question of whether $x$ is large enough are invariant after the first pass meaning that it would be a waste of time. - -The aliases $tmpx1$ and $tmpx2$ refer to the digits of $x$ where the latter is offset by $m$ digits. By reading digits from $x$ offset by $m$ digits -a division by $\beta^m$ can be simulated virtually for free. The loop on line 63 performs the bulk of the work (\textit{corresponds to step 4 of algorithm 7.11}) -in this algorithm. - -By line 70 the pointer $tmpx1$ points to the $m$'th digit of $x$ which is where the final carry will be placed. Similarly by line 73 the -same pointer will point to the $m+1$'th digit where the zeroes will be placed. - -Since the algorithm is only valid if both $x$ and $n$ are greater than zero an unsigned comparison suffices to determine if another pass is required. -With the same logic at line 84 the value of $x$ is known to be greater than or equal to $n$ meaning that an unsigned subtraction can be used -as well. Since the destination of the subtraction is the larger of the inputs the call to algorithm s\_mp\_sub cannot fail and the return code -does not need to be checked. - -\subsubsection{Setup} -To setup the restricted Diminished Radix algorithm the value $k = \beta - n_0$ is required. This algorithm is not really complicated but provided for -completeness. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_dr\_setup}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $k = \beta - n_0$ \\ -\hline \\ -1. $k \leftarrow \beta - n_0$ \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_dr\_setup} -\end{figure} - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_dr\_setup.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* determines the setup value */ -018 void mp_dr_setup(mp_int *a, mp_digit *d) -019 \{ -020 /* the casts are required if DIGIT_BIT is one less than -021 * the number of bits in a mp_digit [e.g. DIGIT_BIT==31] -022 */ -023 *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - -024 ((mp_word)a->dp[0])); -025 \} -026 -027 #endif -028 -\end{alltt} -\end{small} - -\subsubsection{Modulus Detection} -Another algorithm which will be useful is the ability to detect a restricted Diminished Radix modulus. An integer is said to be -of restricted Diminished Radix form if all of the digits are equal to $\beta - 1$ except the trailing digit which may be any value. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_dr\_is\_modulus}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $1$ if $n$ is in D.R form, $0$ otherwise \\ -\hline -1. If $n.used < 2$ then return($0$). \\ -2. for $ix$ from $1$ to $n.used - 1$ do \\ -\hspace{3mm}2.1 If $n_{ix} \ne \beta - 1$ return($0$). \\ -3. Return($1$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_dr\_is\_modulus} -\end{figure} - -\textbf{Algorithm mp\_dr\_is\_modulus.} -This algorithm determines if a value is in Diminished Radix form. Step 1 rejects obvious cases where fewer than two digits are -in the mp\_int. Step 2 tests all but the first digit to see if they are equal to $\beta - 1$. If the algorithm manages to get to -step 3 then $n$ must be of Diminished Radix form. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_dr\_is\_modulus.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* determines if a number is a valid DR modulus */ -018 int mp_dr_is_modulus(mp_int *a) -019 \{ -020 int ix; -021 -022 /* must be at least two digits */ -023 if (a->used < 2) \{ -024 return 0; -025 \} -026 -027 /* must be of the form b**k - a [a <= b] so all -028 * but the first digit must be equal to -1 (mod b). -029 */ -030 for (ix = 1; ix < a->used; ix++) \{ -031 if (a->dp[ix] != MP_MASK) \{ -032 return 0; -033 \} -034 \} -035 return 1; -036 \} -037 -038 #endif -039 -\end{alltt} -\end{small} - -\subsection{Unrestricted Diminished Radix Reduction} -The unrestricted Diminished Radix algorithm allows modular reductions to be performed when the modulus is of the form $2^p - k$. This algorithm -is a straightforward adaptation of algorithm~\ref{fig:DR}. - -In general the restricted Diminished Radix reduction algorithm is much faster since it has considerably lower overhead. However, this new -algorithm is much faster than either Montgomery or Barrett reduction when the moduli are of the appropriate form. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_2k}. \\ -\textbf{Input}. mp\_int $a$ and $n$. mp\_digit $k$ \\ -\hspace{11.5mm}($a \ge 0$, $n > 1$, $0 < k < \beta$, $n + k$ is a power of two) \\ -\textbf{Output}. $a \mbox{ (mod }n\mbox{)}$ \\ -\hline -1. $p \leftarrow \lceil lg(n) \rceil$ (\textit{mp\_count\_bits}) \\ -2. While $a \ge n$ do \\ -\hspace{3mm}2.1 $q \leftarrow \lfloor a / 2^p \rfloor$ (\textit{mp\_div\_2d}) \\ -\hspace{3mm}2.2 $a \leftarrow a \mbox{ (mod }2^p\mbox{)}$ (\textit{mp\_mod\_2d}) \\ -\hspace{3mm}2.3 $q \leftarrow q \cdot k$ (\textit{mp\_mul\_d}) \\ -\hspace{3mm}2.4 $a \leftarrow a - q$ (\textit{s\_mp\_sub}) \\ -\hspace{3mm}2.5 If $a \ge n$ then do \\ -\hspace{6mm}2.5.1 $a \leftarrow a - n$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_2k} -\end{figure} - -\textbf{Algorithm mp\_reduce\_2k.} -This algorithm quickly reduces an input $a$ modulo an unrestricted Diminished Radix modulus $n$. Division by $2^p$ is emulated with a right -shift which makes the algorithm fairly inexpensive to use. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_reduce\_2k.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* reduces a modulo n where n is of the form 2**p - d */ -018 int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d) -019 \{ -020 mp_int q; -021 int p, res; -022 -023 if ((res = mp_init(&q)) != MP_OKAY) \{ -024 return res; -025 \} -026 -027 p = mp_count_bits(n); -028 top: -029 /* q = a/2**p, a = a mod 2**p */ -030 if ((res = mp_div_2d(a, p, &q, a)) != MP_OKAY) \{ -031 goto ERR; -032 \} -033 -034 if (d != 1) \{ -035 /* q = q * d */ -036 if ((res = mp_mul_d(&q, d, &q)) != MP_OKAY) \{ -037 goto ERR; -038 \} -039 \} -040 -041 /* a = a + q */ -042 if ((res = s_mp_add(a, &q, a)) != MP_OKAY) \{ -043 goto ERR; -044 \} -045 -046 if (mp_cmp_mag(a, n) != MP_LT) \{ -047 if ((res = s_mp_sub(a, n, a)) != MP_OKAY) \{ -048 goto ERR; -049 \} -050 goto top; -051 \} -052 -053 ERR: -054 mp_clear(&q); -055 return res; -056 \} -057 -058 #endif -059 -\end{alltt} -\end{small} - -The algorithm mp\_count\_bits calculates the number of bits in an mp\_int which is used to find the initial value of $p$. The call to mp\_div\_2d -on line 30 calculates both the quotient $q$ and the remainder $a$ required. By doing both in a single function call the code size -is kept fairly small. The multiplication by $k$ is only performed if $k > 1$. This allows reductions modulo $2^p - 1$ to be performed without -any multiplications. - -The unsigned s\_mp\_add, mp\_cmp\_mag and s\_mp\_sub are used in place of their full sign counterparts since the inputs are only valid if they are -positive. By using the unsigned versions the overhead is kept to a minimum. - -\subsubsection{Unrestricted Setup} -To setup this reduction algorithm the value of $k = 2^p - n$ is required. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_2k\_setup}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $k = 2^p - n$ \\ -\hline -1. $p \leftarrow \lceil lg(n) \rceil$ (\textit{mp\_count\_bits}) \\ -2. $x \leftarrow 2^p$ (\textit{mp\_2expt}) \\ -3. $x \leftarrow x - n$ (\textit{mp\_sub}) \\ -4. $k \leftarrow x_0$ \\ -5. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_2k\_setup} -\end{figure} - -\textbf{Algorithm mp\_reduce\_2k\_setup.} -This algorithm computes the value of $k$ required for the algorithm mp\_reduce\_2k. By making a temporary variable $x$ equal to $2^p$ a subtraction -is sufficient to solve for $k$. Alternatively if $n$ has more than one digit the value of $k$ is simply $\beta - n_0$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_reduce\_2k\_setup.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* determines the setup value */ -018 int mp_reduce_2k_setup(mp_int *a, mp_digit *d) -019 \{ -020 int res, p; -021 mp_int tmp; -022 -023 if ((res = mp_init(&tmp)) != MP_OKAY) \{ -024 return res; -025 \} -026 -027 p = mp_count_bits(a); -028 if ((res = mp_2expt(&tmp, p)) != MP_OKAY) \{ -029 mp_clear(&tmp); -030 return res; -031 \} -032 -033 if ((res = s_mp_sub(&tmp, a, &tmp)) != MP_OKAY) \{ -034 mp_clear(&tmp); -035 return res; -036 \} -037 -038 *d = tmp.dp[0]; -039 mp_clear(&tmp); -040 return MP_OKAY; -041 \} -042 #endif -043 -\end{alltt} -\end{small} - -\subsubsection{Unrestricted Detection} -An integer $n$ is a valid unrestricted Diminished Radix modulus if either of the following are true. - -\begin{enumerate} -\item The number has only one digit. -\item The number has more than one digit and every bit from the $\beta$'th to the most significant is one. -\end{enumerate} - -If either condition is true than there is a power of two $2^p$ such that $0 < 2^p - n < \beta$. If the input is only -one digit than it will always be of the correct form. Otherwise all of the bits above the first digit must be one. This arises from the fact -that there will be value of $k$ that when added to the modulus causes a carry in the first digit which propagates all the way to the most -significant bit. The resulting sum will be a power of two. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_reduce\_is\_2k}. \\ -\textbf{Input}. mp\_int $n$ \\ -\textbf{Output}. $1$ if of proper form, $0$ otherwise \\ -\hline -1. If $n.used = 0$ then return($0$). \\ -2. If $n.used = 1$ then return($1$). \\ -3. $p \leftarrow \lceil lg(n) \rceil$ (\textit{mp\_count\_bits}) \\ -4. for $x$ from $lg(\beta)$ to $p$ do \\ -\hspace{3mm}4.1 If the ($x \mbox{ mod }lg(\beta)$)'th bit of the $\lfloor x / lg(\beta) \rfloor$ of $n$ is zero then return($0$). \\ -5. Return($1$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_reduce\_is\_2k} -\end{figure} - -\textbf{Algorithm mp\_reduce\_is\_2k.} -This algorithm quickly determines if a modulus is of the form required for algorithm mp\_reduce\_2k to function properly. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_reduce\_is\_2k.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* determines if mp_reduce_2k can be used */ -018 int mp_reduce_is_2k(mp_int *a) -019 \{ -020 int ix, iy, iw; -021 mp_digit iz; -022 -023 if (a->used == 0) \{ -024 return MP_NO; -025 \} else if (a->used == 1) \{ -026 return MP_YES; -027 \} else if (a->used > 1) \{ -028 iy = mp_count_bits(a); -029 iz = 1; -030 iw = 1; -031 -032 /* Test every bit from the second digit up, must be 1 */ -033 for (ix = DIGIT_BIT; ix < iy; ix++) \{ -034 if ((a->dp[iw] & iz) == 0) \{ -035 return MP_NO; -036 \} -037 iz <<= 1; -038 if (iz > (mp_digit)MP_MASK) \{ -039 ++iw; -040 iz = 1; -041 \} -042 \} -043 \} -044 return MP_YES; -045 \} -046 -047 #endif -048 -\end{alltt} -\end{small} - - - -\section{Algorithm Comparison} -So far three very different algorithms for modular reduction have been discussed. Each of the algorithms have their own strengths and weaknesses -that makes having such a selection very useful. The following table sumarizes the three algorithms along with comparisons of work factors. Since -all three algorithms have the restriction that $0 \le x < n^2$ and $n > 1$ those limitations are not included in the table. - -\begin{center} -\begin{small} -\begin{tabular}{|c|c|c|c|c|c|} -\hline \textbf{Method} & \textbf{Work Required} & \textbf{Limitations} & \textbf{$m = 8$} & \textbf{$m = 32$} & \textbf{$m = 64$} \\ -\hline Barrett & $m^2 + 2m - 1$ & None & $79$ & $1087$ & $4223$ \\ -\hline Montgomery & $m^2 + m$ & $n$ must be odd & $72$ & $1056$ & $4160$ \\ -\hline D.R. & $2m$ & $n = \beta^m - k$ & $16$ & $64$ & $128$ \\ -\hline -\end{tabular} -\end{small} -\end{center} - -In theory Montgomery and Barrett reductions would require roughly the same amount of time to complete. However, in practice since Montgomery -reduction can be written as a single function with the Comba technique it is much faster. Barrett reduction suffers from the overhead of -calling the half precision multipliers, addition and division by $\beta$ algorithms. - -For almost every cryptographic algorithm Montgomery reduction is the algorithm of choice. The one set of algorithms where Diminished Radix reduction truly -shines are based on the discrete logarithm problem such as Diffie-Hellman \cite{DH} and ElGamal \cite{ELGAMAL}. In these algorithms -primes of the form $\beta^m - k$ can be found and shared amongst users. These primes will allow the Diminished Radix algorithm to be used in -modular exponentiation to greatly speed up the operation. - - - -\section*{Exercises} -\begin{tabular}{cl} -$\left [ 3 \right ]$ & Prove that the ``trick'' in algorithm mp\_montgomery\_setup actually \\ - & calculates the correct value of $\rho$. \\ - & \\ -$\left [ 2 \right ]$ & Devise an algorithm to reduce modulo $n + k$ for small $k$ quickly. \\ - & \\ -$\left [ 4 \right ]$ & Prove that the pseudo-code algorithm ``Diminished Radix Reduction'' \\ - & (\textit{figure~\ref{fig:DR}}) terminates. Also prove the probability that it will \\ - & terminate within $1 \le k \le 10$ iterations. \\ - & \\ -\end{tabular} - - -\chapter{Exponentiation} -Exponentiation is the operation of raising one variable to the power of another, for example, $a^b$. A variant of exponentiation, computed -in a finite field or ring, is called modular exponentiation. This latter style of operation is typically used in public key -cryptosystems such as RSA and Diffie-Hellman. The ability to quickly compute modular exponentiations is of great benefit to any -such cryptosystem and many methods have been sought to speed it up. - -\section{Exponentiation Basics} -A trivial algorithm would simply multiply $a$ against itself $b - 1$ times to compute the exponentiation desired. However, as $b$ grows in size -the number of multiplications becomes prohibitive. Imagine what would happen if $b$ $\approx$ $2^{1024}$ as is the case when computing an RSA signature -with a $1024$-bit key. Such a calculation could never be completed as it would take simply far too long. - -Fortunately there is a very simple algorithm based on the laws of exponents. Recall that $lg_a(a^b) = b$ and that $lg_a(a^ba^c) = b + c$ which -are two trivial relationships between the base and the exponent. Let $b_i$ represent the $i$'th bit of $b$ starting from the least -significant bit. If $b$ is a $k$-bit integer than the following equation is true. - -\begin{equation} -a^b = \prod_{i=0}^{k-1} a^{2^i \cdot b_i} -\end{equation} - -By taking the base $a$ logarithm of both sides of the equation the following equation is the result. - -\begin{equation} -b = \sum_{i=0}^{k-1}2^i \cdot b_i -\end{equation} - -The term $a^{2^i}$ can be found from the $i - 1$'th term by squaring the term since $\left ( a^{2^i} \right )^2$ is equal to -$a^{2^{i+1}}$. This observation forms the basis of essentially all fast exponentiation algorithms. It requires $k$ squarings and on average -$k \over 2$ multiplications to compute the result. This is indeed quite an improvement over simply multiplying by $a$ a total of $b-1$ times. - -While this current method is a considerable speed up there are further improvements to be made. For example, the $a^{2^i}$ term does not need to -be computed in an auxilary variable. Consider the following equivalent algorithm. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Left to Right Exponentiation}. \\ -\textbf{Input}. Integer $a$, $b$ and $k$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $c \leftarrow 1$ \\ -2. for $i$ from $k - 1$ to $0$ do \\ -\hspace{3mm}2.1 $c \leftarrow c^2$ \\ -\hspace{3mm}2.2 $c \leftarrow c \cdot a^{b_i}$ \\ -3. Return $c$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Left to Right Exponentiation} -\label{fig:LTOR} -\end{figure} - -This algorithm starts from the most significant bit and works towards the least significant bit. When the $i$'th bit of $b$ is set $a$ is -multiplied against the current product. In each iteration the product is squared which doubles the exponent of the individual terms of the -product. - -For example, let $b = 101100_2 \equiv 44_{10}$. The following chart demonstrates the actions of the algorithm. - -\newpage\begin{figure} -\begin{center} -\begin{tabular}{|c|c|} -\hline \textbf{Value of $i$} & \textbf{Value of $c$} \\ -\hline - & $1$ \\ -\hline $5$ & $a$ \\ -\hline $4$ & $a^2$ \\ -\hline $3$ & $a^4 \cdot a$ \\ -\hline $2$ & $a^8 \cdot a^2 \cdot a$ \\ -\hline $1$ & $a^{16} \cdot a^4 \cdot a^2$ \\ -\hline $0$ & $a^{32} \cdot a^8 \cdot a^4$ \\ -\hline -\end{tabular} -\end{center} -\caption{Example of Left to Right Exponentiation} -\end{figure} - -When the product $a^{32} \cdot a^8 \cdot a^4$ is simplified it is equal $a^{44}$ which is the desired exponentiation. This particular algorithm is -called ``Left to Right'' because it reads the exponent in that order. All of the exponentiation algorithms that will be presented are of this nature. - -\subsection{Single Digit Exponentiation} -The first algorithm in the series of exponentiation algorithms will be an unbounded algorithm where the exponent is a single digit. It is intended -to be used when a small power of an input is required (\textit{e.g. $a^5$}). It is faster than simply multiplying $b - 1$ times for all values of -$b$ that are greater than three. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_expt\_d}. \\ -\textbf{Input}. mp\_int $a$ and mp\_digit $b$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $g \leftarrow a$ (\textit{mp\_init\_copy}) \\ -2. $c \leftarrow 1$ (\textit{mp\_set}) \\ -3. for $x$ from 1 to $lg(\beta)$ do \\ -\hspace{3mm}3.1 $c \leftarrow c^2$ (\textit{mp\_sqr}) \\ -\hspace{3mm}3.2 If $b$ AND $2^{lg(\beta) - 1} \ne 0$ then \\ -\hspace{6mm}3.2.1 $c \leftarrow c \cdot g$ (\textit{mp\_mul}) \\ -\hspace{3mm}3.3 $b \leftarrow b << 1$ \\ -4. Clear $g$. \\ -5. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_expt\_d} -\end{figure} - -\textbf{Algorithm mp\_expt\_d.} -This algorithm computes the value of $a$ raised to the power of a single digit $b$. It uses the left to right exponentiation algorithm to -quickly compute the exponentiation. It is loosely based on algorithm 14.79 of HAC \cite[pp. 615]{HAC} with the difference that the -exponent is a fixed width. - -A copy of $a$ is made first to allow destination variable $c$ be the same as the source variable $a$. The result is set to the initial value of -$1$ in the subsequent step. - -Inside the loop the exponent is read from the most significant bit first down to the least significant bit. First $c$ is invariably squared -on step 3.1. In the following step if the most significant bit of $b$ is one the copy of $a$ is multiplied against $c$. The value -of $b$ is shifted left one bit to make the next bit down from the most signficant bit the new most significant bit. In effect each -iteration of the loop moves the bits of the exponent $b$ upwards to the most significant location. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_expt\_d\_ex.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* calculate c = a**b using a square-multiply algorithm */ -018 int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) -019 \{ -020 int res; -021 unsigned int x; -022 -023 mp_int g; -024 -025 if ((res = mp_init_copy (&g, a)) != MP_OKAY) \{ -026 return res; -027 \} -028 -029 /* set initial result */ -030 mp_set (c, 1); -031 -032 if (fast != 0) \{ -033 while (b > 0) \{ -034 /* if the bit is set multiply */ -035 if ((b & 1) != 0) \{ -036 if ((res = mp_mul (c, &g, c)) != MP_OKAY) \{ -037 mp_clear (&g); -038 return res; -039 \} -040 \} -041 -042 /* square */ -043 if (b > 1) \{ -044 if ((res = mp_sqr (&g, &g)) != MP_OKAY) \{ -045 mp_clear (&g); -046 return res; -047 \} -048 \} -049 -050 /* shift to next bit */ -051 b >>= 1; -052 \} -053 \} -054 else \{ -055 for (x = 0; x < DIGIT_BIT; x++) \{ -056 /* square */ -057 if ((res = mp_sqr (c, c)) != MP_OKAY) \{ -058 mp_clear (&g); -059 return res; -060 \} -061 -062 /* if the bit is set multiply */ -063 if ((b & (mp_digit) (((mp_digit)1) << (DIGIT_BIT - 1))) != 0) \{ -064 if ((res = mp_mul (c, &g, c)) != MP_OKAY) \{ -065 mp_clear (&g); -066 return res; -067 \} -068 \} -069 -070 /* shift to next bit */ -071 b <<= 1; -072 \} -073 \} /* if ... else */ -074 -075 mp_clear (&g); -076 return MP_OKAY; -077 \} -078 #endif -079 -\end{alltt} -\end{small} - -This describes only the algorithm that is used when the parameter $fast$ is $0$. Line 30 sets the initial value of the result to $1$. Next the loop on line 55 steps through each bit of the exponent starting from -the most significant down towards the least significant. The invariant squaring operation placed on line 57 is performed first. After -the squaring the result $c$ is multiplied by the base $g$ if and only if the most significant bit of the exponent is set. The shift on line -71 moves all of the bits of the exponent upwards towards the most significant location. - -\section{$k$-ary Exponentiation} -When calculating an exponentiation the most time consuming bottleneck is the multiplications which are in general a small factor -slower than squaring. Recall from the previous algorithm that $b_{i}$ refers to the $i$'th bit of the exponent $b$. Suppose instead it referred to -the $i$'th $k$-bit digit of the exponent of $b$. For $k = 1$ the definitions are synonymous and for $k > 1$ algorithm~\ref{fig:KARY} -computes the same exponentiation. A group of $k$ bits from the exponent is called a \textit{window}. That is it is a small window on only a -portion of the entire exponent. Consider the following modification to the basic left to right exponentiation algorithm. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{$k$-ary Exponentiation}. \\ -\textbf{Input}. Integer $a$, $b$, $k$ and $t$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $c \leftarrow 1$ \\ -2. for $i$ from $t - 1$ to $0$ do \\ -\hspace{3mm}2.1 $c \leftarrow c^{2^k} $ \\ -\hspace{3mm}2.2 Extract the $i$'th $k$-bit word from $b$ and store it in $g$. \\ -\hspace{3mm}2.3 $c \leftarrow c \cdot a^g$ \\ -3. Return $c$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{$k$-ary Exponentiation} -\label{fig:KARY} -\end{figure} - -The squaring on step 2.1 can be calculated by squaring the value $c$ successively $k$ times. If the values of $a^g$ for $0 < g < 2^k$ have been -precomputed this algorithm requires only $t$ multiplications and $tk$ squarings. The table can be generated with $2^{k - 1} - 1$ squarings and -$2^{k - 1} + 1$ multiplications. This algorithm assumes that the number of bits in the exponent is evenly divisible by $k$. -However, when it is not the remaining $0 < x \le k - 1$ bits can be handled with algorithm~\ref{fig:LTOR}. - -Suppose $k = 4$ and $t = 100$. This modified algorithm will require $109$ multiplications and $408$ squarings to compute the exponentiation. The -original algorithm would on average have required $200$ multiplications and $400$ squrings to compute the same value. The total number of squarings -has increased slightly but the number of multiplications has nearly halved. - -\subsection{Optimal Values of $k$} -An optimal value of $k$ will minimize $2^{k} + \lceil n / k \rceil + n - 1$ for a fixed number of bits in the exponent $n$. The simplest -approach is to brute force search amongst the values $k = 2, 3, \ldots, 8$ for the lowest result. Table~\ref{fig:OPTK} lists optimal values of $k$ -for various exponent sizes and compares the number of multiplication and squarings required against algorithm~\ref{fig:LTOR}. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|c|c|c|c|c|c|} -\hline \textbf{Exponent (bits)} & \textbf{Optimal $k$} & \textbf{Work at $k$} & \textbf{Work with ~\ref{fig:LTOR}} \\ -\hline $16$ & $2$ & $27$ & $24$ \\ -\hline $32$ & $3$ & $49$ & $48$ \\ -\hline $64$ & $3$ & $92$ & $96$ \\ -\hline $128$ & $4$ & $175$ & $192$ \\ -\hline $256$ & $4$ & $335$ & $384$ \\ -\hline $512$ & $5$ & $645$ & $768$ \\ -\hline $1024$ & $6$ & $1257$ & $1536$ \\ -\hline $2048$ & $6$ & $2452$ & $3072$ \\ -\hline $4096$ & $7$ & $4808$ & $6144$ \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Optimal Values of $k$ for $k$-ary Exponentiation} -\label{fig:OPTK} -\end{figure} - -\subsection{Sliding-Window Exponentiation} -A simple modification to the previous algorithm is only generate the upper half of the table in the range $2^{k-1} \le g < 2^k$. Essentially -this is a table for all values of $g$ where the most significant bit of $g$ is a one. However, in order for this to be allowed in the -algorithm values of $g$ in the range $0 \le g < 2^{k-1}$ must be avoided. - -Table~\ref{fig:OPTK2} lists optimal values of $k$ for various exponent sizes and compares the work required against algorithm {\ref{fig:KARY}}. - -\begin{figure}[here] -\begin{center} -\begin{small} -\begin{tabular}{|c|c|c|c|c|c|} -\hline \textbf{Exponent (bits)} & \textbf{Optimal $k$} & \textbf{Work at $k$} & \textbf{Work with ~\ref{fig:KARY}} \\ -\hline $16$ & $3$ & $24$ & $27$ \\ -\hline $32$ & $3$ & $45$ & $49$ \\ -\hline $64$ & $4$ & $87$ & $92$ \\ -\hline $128$ & $4$ & $167$ & $175$ \\ -\hline $256$ & $5$ & $322$ & $335$ \\ -\hline $512$ & $6$ & $628$ & $645$ \\ -\hline $1024$ & $6$ & $1225$ & $1257$ \\ -\hline $2048$ & $7$ & $2403$ & $2452$ \\ -\hline $4096$ & $8$ & $4735$ & $4808$ \\ -\hline -\end{tabular} -\end{small} -\end{center} -\caption{Optimal Values of $k$ for Sliding Window Exponentiation} -\label{fig:OPTK2} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Sliding Window $k$-ary Exponentiation}. \\ -\textbf{Input}. Integer $a$, $b$, $k$ and $t$ \\ -\textbf{Output}. $c = a^b$ \\ -\hline \\ -1. $c \leftarrow 1$ \\ -2. for $i$ from $t - 1$ to $0$ do \\ -\hspace{3mm}2.1 If the $i$'th bit of $b$ is a zero then \\ -\hspace{6mm}2.1.1 $c \leftarrow c^2$ \\ -\hspace{3mm}2.2 else do \\ -\hspace{6mm}2.2.1 $c \leftarrow c^{2^k}$ \\ -\hspace{6mm}2.2.2 Extract the $k$ bits from $(b_{i}b_{i-1}\ldots b_{i-(k-1)})$ and store it in $g$. \\ -\hspace{6mm}2.2.3 $c \leftarrow c \cdot a^g$ \\ -\hspace{6mm}2.2.4 $i \leftarrow i - k$ \\ -3. Return $c$. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Sliding Window $k$-ary Exponentiation} -\end{figure} - -Similar to the previous algorithm this algorithm must have a special handler when fewer than $k$ bits are left in the exponent. While this -algorithm requires the same number of squarings it can potentially have fewer multiplications. The pre-computed table $a^g$ is also half -the size as the previous table. - -Consider the exponent $b = 111101011001000_2 \equiv 31432_{10}$ with $k = 3$ using both algorithms. The first algorithm will divide the exponent up as -the following five $3$-bit words $b \equiv \left ( 111, 101, 011, 001, 000 \right )_{2}$. The second algorithm will break the -exponent as $b \equiv \left ( 111, 101, 0, 110, 0, 100, 0 \right )_{2}$. The single digit $0$ in the second representation are where -a single squaring took place instead of a squaring and multiplication. In total the first method requires $10$ multiplications and $18$ -squarings. The second method requires $8$ multiplications and $18$ squarings. - -In general the sliding window method is never slower than the generic $k$-ary method and often it is slightly faster. - -\section{Modular Exponentiation} - -Modular exponentiation is essentially computing the power of a base within a finite field or ring. For example, computing -$d \equiv a^b \mbox{ (mod }c\mbox{)}$ is a modular exponentiation. Instead of first computing $a^b$ and then reducing it -modulo $c$ the intermediate result is reduced modulo $c$ after every squaring or multiplication operation. - -This guarantees that any intermediate result is bounded by $0 \le d \le c^2 - 2c + 1$ and can be reduced modulo $c$ quickly using -one of the algorithms presented in chapter six. - -Before the actual modular exponentiation algorithm can be written a wrapper algorithm must be written first. This algorithm -will allow the exponent $b$ to be negative which is computed as $c \equiv \left (1 / a \right )^{\vert b \vert} \mbox{(mod }d\mbox{)}$. The -value of $(1/a) \mbox{ mod }c$ is computed using the modular inverse (\textit{see \ref{sec;modinv}}). If no inverse exists the algorithm -terminates with an error. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_exptmod}. \\ -\textbf{Input}. mp\_int $a$, $b$ and $c$ \\ -\textbf{Output}. $y \equiv g^x \mbox{ (mod }p\mbox{)}$ \\ -\hline \\ -1. If $c.sign = MP\_NEG$ return(\textit{MP\_VAL}). \\ -2. If $b.sign = MP\_NEG$ then \\ -\hspace{3mm}2.1 $g' \leftarrow g^{-1} \mbox{ (mod }c\mbox{)}$ \\ -\hspace{3mm}2.2 $x' \leftarrow \vert x \vert$ \\ -\hspace{3mm}2.3 Compute $d \equiv g'^{x'} \mbox{ (mod }c\mbox{)}$ via recursion. \\ -3. if $p$ is odd \textbf{OR} $p$ is a D.R. modulus then \\ -\hspace{3mm}3.1 Compute $y \equiv g^{x} \mbox{ (mod }p\mbox{)}$ via algorithm mp\_exptmod\_fast. \\ -4. else \\ -\hspace{3mm}4.1 Compute $y \equiv g^{x} \mbox{ (mod }p\mbox{)}$ via algorithm s\_mp\_exptmod. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_exptmod} -\end{figure} - -\textbf{Algorithm mp\_exptmod.} -The first algorithm which actually performs modular exponentiation is algorithm s\_mp\_exptmod. It is a sliding window $k$-ary algorithm -which uses Barrett reduction to reduce the product modulo $p$. The second algorithm mp\_exptmod\_fast performs the same operation -except it uses either Montgomery or Diminished Radix reduction. The two latter reduction algorithms are clumped in the same exponentiation -algorithm since their arguments are essentially the same (\textit{two mp\_ints and one mp\_digit}). - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_exptmod.c -\vspace{-3mm} -\begin{alltt} -016 -017 -018 /* this is a shell function that calls either the normal or Montgomery -019 * exptmod functions. Originally the call to the montgomery code was -020 * embedded in the normal function but that wasted alot of stack space -021 * for nothing (since 99% of the time the Montgomery code would be called) -022 */ -023 int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) -024 \{ -025 int dr; -026 -027 /* modulus P must be positive */ -028 if (P->sign == MP_NEG) \{ -029 return MP_VAL; -030 \} -031 -032 /* if exponent X is negative we have to recurse */ -033 if (X->sign == MP_NEG) \{ -034 #ifdef BN_MP_INVMOD_C -035 mp_int tmpG, tmpX; -036 int err; -037 -038 /* first compute 1/G mod P */ -039 if ((err = mp_init(&tmpG)) != MP_OKAY) \{ -040 return err; -041 \} -042 if ((err = mp_invmod(G, P, &tmpG)) != MP_OKAY) \{ -043 mp_clear(&tmpG); -044 return err; -045 \} -046 -047 /* now get |X| */ -048 if ((err = mp_init(&tmpX)) != MP_OKAY) \{ -049 mp_clear(&tmpG); -050 return err; -051 \} -052 if ((err = mp_abs(X, &tmpX)) != MP_OKAY) \{ -053 mp_clear_multi(&tmpG, &tmpX, NULL); -054 return err; -055 \} -056 -057 /* and now compute (1/G)**|X| instead of G**X [X < 0] */ -058 err = mp_exptmod(&tmpG, &tmpX, P, Y); -059 mp_clear_multi(&tmpG, &tmpX, NULL); -060 return err; -061 #else -062 /* no invmod */ -063 return MP_VAL; -064 #endif -065 \} -066 -067 /* modified diminished radix reduction */ -068 #if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C) && defin - ed(BN_S_MP_EXPTMOD_C) -069 if (mp_reduce_is_2k_l(P) == MP_YES) \{ -070 return s_mp_exptmod(G, X, P, Y, 1); -071 \} -072 #endif -073 -074 #ifdef BN_MP_DR_IS_MODULUS_C -075 /* is it a DR modulus? */ -076 dr = mp_dr_is_modulus(P); -077 #else -078 /* default to no */ -079 dr = 0; -080 #endif -081 -082 #ifdef BN_MP_REDUCE_IS_2K_C -083 /* if not, is it a unrestricted DR modulus? */ -084 if (dr == 0) \{ -085 dr = mp_reduce_is_2k(P) << 1; -086 \} -087 #endif -088 -089 /* if the modulus is odd or dr != 0 use the montgomery method */ -090 #ifdef BN_MP_EXPTMOD_FAST_C -091 if ((mp_isodd (P) == MP_YES) || (dr != 0)) \{ -092 return mp_exptmod_fast (G, X, P, Y, dr); -093 \} else \{ -094 #endif -095 #ifdef BN_S_MP_EXPTMOD_C -096 /* otherwise use the generic Barrett reduction technique */ -097 return s_mp_exptmod (G, X, P, Y, 0); -098 #else -099 /* no exptmod for evens */ -100 return MP_VAL; -101 #endif -102 #ifdef BN_MP_EXPTMOD_FAST_C -103 \} -104 #endif -105 \} -106 -107 #endif -108 -\end{alltt} -\end{small} - -In order to keep the algorithms in a known state the first step on line 28 is to reject any negative modulus as input. If the exponent is -negative the algorithm tries to perform a modular exponentiation with the modular inverse of the base $G$. The temporary variable $tmpG$ is assigned -the modular inverse of $G$ and $tmpX$ is assigned the absolute value of $X$. The algorithm will recuse with these new values with a positive -exponent. - -If the exponent is positive the algorithm resumes the exponentiation. Line 76 determines if the modulus is of the restricted Diminished Radix -form. If it is not line 69 attempts to determine if it is of a unrestricted Diminished Radix form. The integer $dr$ will take on one -of three values. - -\begin{enumerate} -\item $dr = 0$ means that the modulus is not of either restricted or unrestricted Diminished Radix form. -\item $dr = 1$ means that the modulus is of restricted Diminished Radix form. -\item $dr = 2$ means that the modulus is of unrestricted Diminished Radix form. -\end{enumerate} - -Line 69 determines if the fast modular exponentiation algorithm can be used. It is allowed if $dr \ne 0$ or if the modulus is odd. Otherwise, -the slower s\_mp\_exptmod algorithm is used which uses Barrett reduction. - -\subsection{Barrett Modular Exponentiation} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_exptmod}. \\ -\textbf{Input}. mp\_int $a$, $b$ and $c$ \\ -\textbf{Output}. $y \equiv g^x \mbox{ (mod }p\mbox{)}$ \\ -\hline \\ -1. $k \leftarrow lg(x)$ \\ -2. $winsize \leftarrow \left \lbrace \begin{array}{ll} - 2 & \mbox{if }k \le 7 \\ - 3 & \mbox{if }7 < k \le 36 \\ - 4 & \mbox{if }36 < k \le 140 \\ - 5 & \mbox{if }140 < k \le 450 \\ - 6 & \mbox{if }450 < k \le 1303 \\ - 7 & \mbox{if }1303 < k \le 3529 \\ - 8 & \mbox{if }3529 < k \\ - \end{array} \right .$ \\ -3. Initialize $2^{winsize}$ mp\_ints in an array named $M$ and one mp\_int named $\mu$ \\ -4. Calculate the $\mu$ required for Barrett Reduction (\textit{mp\_reduce\_setup}). \\ -5. $M_1 \leftarrow g \mbox{ (mod }p\mbox{)}$ \\ -\\ -Setup the table of small powers of $g$. First find $g^{2^{winsize}}$ and then all multiples of it. \\ -6. $k \leftarrow 2^{winsize - 1}$ \\ -7. $M_{k} \leftarrow M_1$ \\ -8. for $ix$ from 0 to $winsize - 2$ do \\ -\hspace{3mm}8.1 $M_k \leftarrow \left ( M_k \right )^2$ (\textit{mp\_sqr}) \\ -\hspace{3mm}8.2 $M_k \leftarrow M_k \mbox{ (mod }p\mbox{)}$ (\textit{mp\_reduce}) \\ -9. for $ix$ from $2^{winsize - 1} + 1$ to $2^{winsize} - 1$ do \\ -\hspace{3mm}9.1 $M_{ix} \leftarrow M_{ix - 1} \cdot M_{1}$ (\textit{mp\_mul}) \\ -\hspace{3mm}9.2 $M_{ix} \leftarrow M_{ix} \mbox{ (mod }p\mbox{)}$ (\textit{mp\_reduce}) \\ -10. $res \leftarrow 1$ \\ -\\ -Start Sliding Window. \\ -11. $mode \leftarrow 0, bitcnt \leftarrow 1, buf \leftarrow 0, digidx \leftarrow x.used - 1, bitcpy \leftarrow 0, bitbuf \leftarrow 0$ \\ -12. Loop \\ -\hspace{3mm}12.1 $bitcnt \leftarrow bitcnt - 1$ \\ -\hspace{3mm}12.2 If $bitcnt = 0$ then do \\ -\hspace{6mm}12.2.1 If $digidx = -1$ goto step 13. \\ -\hspace{6mm}12.2.2 $buf \leftarrow x_{digidx}$ \\ -\hspace{6mm}12.2.3 $digidx \leftarrow digidx - 1$ \\ -\hspace{6mm}12.2.4 $bitcnt \leftarrow lg(\beta)$ \\ -Continued on next page. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_exptmod} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{s\_mp\_exptmod} (\textit{continued}). \\ -\textbf{Input}. mp\_int $a$, $b$ and $c$ \\ -\textbf{Output}. $y \equiv g^x \mbox{ (mod }p\mbox{)}$ \\ -\hline \\ -\hspace{3mm}12.3 $y \leftarrow (buf >> (lg(\beta) - 1))$ AND $1$ \\ -\hspace{3mm}12.4 $buf \leftarrow buf << 1$ \\ -\hspace{3mm}12.5 if $mode = 0$ and $y = 0$ then goto step 12. \\ -\hspace{3mm}12.6 if $mode = 1$ and $y = 0$ then do \\ -\hspace{6mm}12.6.1 $res \leftarrow res^2$ \\ -\hspace{6mm}12.6.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}12.6.3 Goto step 12. \\ -\hspace{3mm}12.7 $bitcpy \leftarrow bitcpy + 1$ \\ -\hspace{3mm}12.8 $bitbuf \leftarrow bitbuf + (y << (winsize - bitcpy))$ \\ -\hspace{3mm}12.9 $mode \leftarrow 2$ \\ -\hspace{3mm}12.10 If $bitcpy = winsize$ then do \\ -\hspace{6mm}Window is full so perform the squarings and single multiplication. \\ -\hspace{6mm}12.10.1 for $ix$ from $0$ to $winsize -1$ do \\ -\hspace{9mm}12.10.1.1 $res \leftarrow res^2$ \\ -\hspace{9mm}12.10.1.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}12.10.2 $res \leftarrow res \cdot M_{bitbuf}$ \\ -\hspace{6mm}12.10.3 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}Reset the window. \\ -\hspace{6mm}12.10.4 $bitcpy \leftarrow 0, bitbuf \leftarrow 0, mode \leftarrow 1$ \\ -\\ -No more windows left. Check for residual bits of exponent. \\ -13. If $mode = 2$ and $bitcpy > 0$ then do \\ -\hspace{3mm}13.1 for $ix$ form $0$ to $bitcpy - 1$ do \\ -\hspace{6mm}13.1.1 $res \leftarrow res^2$ \\ -\hspace{6mm}13.1.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -\hspace{6mm}13.1.3 $bitbuf \leftarrow bitbuf << 1$ \\ -\hspace{6mm}13.1.4 If $bitbuf$ AND $2^{winsize} \ne 0$ then do \\ -\hspace{9mm}13.1.4.1 $res \leftarrow res \cdot M_{1}$ \\ -\hspace{9mm}13.1.4.2 $res \leftarrow res \mbox{ (mod }p\mbox{)}$ \\ -14. $y \leftarrow res$ \\ -15. Clear $res$, $mu$ and the $M$ array. \\ -16. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm s\_mp\_exptmod (continued)} -\end{figure} - -\textbf{Algorithm s\_mp\_exptmod.} -This algorithm computes the $x$'th power of $g$ modulo $p$ and stores the result in $y$. It takes advantage of the Barrett reduction -algorithm to keep the product small throughout the algorithm. - -The first two steps determine the optimal window size based on the number of bits in the exponent. The larger the exponent the -larger the window size becomes. After a window size $winsize$ has been chosen an array of $2^{winsize}$ mp\_int variables is allocated. This -table will hold the values of $g^x \mbox{ (mod }p\mbox{)}$ for $2^{winsize - 1} \le x < 2^{winsize}$. - -After the table is allocated the first power of $g$ is found. Since $g \ge p$ is allowed it must be first reduced modulo $p$ to make -the rest of the algorithm more efficient. The first element of the table at $2^{winsize - 1}$ is found by squaring $M_1$ successively $winsize - 2$ -times. The rest of the table elements are found by multiplying the previous element by $M_1$ modulo $p$. - -Now that the table is available the sliding window may begin. The following list describes the functions of all the variables in the window. -\begin{enumerate} -\item The variable $mode$ dictates how the bits of the exponent are interpreted. -\begin{enumerate} - \item When $mode = 0$ the bits are ignored since no non-zero bit of the exponent has been seen yet. For example, if the exponent were simply - $1$ then there would be $lg(\beta) - 1$ zero bits before the first non-zero bit. In this case bits are ignored until a non-zero bit is found. - \item When $mode = 1$ a non-zero bit has been seen before and a new $winsize$-bit window has not been formed yet. In this mode leading $0$ bits - are read and a single squaring is performed. If a non-zero bit is read a new window is created. - \item When $mode = 2$ the algorithm is in the middle of forming a window and new bits are appended to the window from the most significant bit - downwards. -\end{enumerate} -\item The variable $bitcnt$ indicates how many bits are left in the current digit of the exponent left to be read. When it reaches zero a new digit - is fetched from the exponent. -\item The variable $buf$ holds the currently read digit of the exponent. -\item The variable $digidx$ is an index into the exponents digits. It starts at the leading digit $x.used - 1$ and moves towards the trailing digit. -\item The variable $bitcpy$ indicates how many bits are in the currently formed window. When it reaches $winsize$ the window is flushed and - the appropriate operations performed. -\item The variable $bitbuf$ holds the current bits of the window being formed. -\end{enumerate} - -All of step 12 is the window processing loop. It will iterate while there are digits available form the exponent to read. The first step -inside this loop is to extract a new digit if no more bits are available in the current digit. If there are no bits left a new digit is -read and if there are no digits left than the loop terminates. - -After a digit is made available step 12.3 will extract the most significant bit of the current digit and move all other bits in the digit -upwards. In effect the digit is read from most significant bit to least significant bit and since the digits are read from leading to -trailing edges the entire exponent is read from most significant bit to least significant bit. - -At step 12.5 if the $mode$ and currently extracted bit $y$ are both zero the bit is ignored and the next bit is read. This prevents the -algorithm from having to perform trivial squaring and reduction operations before the first non-zero bit is read. Step 12.6 and 12.7-10 handle -the two cases of $mode = 1$ and $mode = 2$ respectively. - -\begin{center} -\begin{figure}[here] -\includegraphics{pics/expt_state.ps} -\caption{Sliding Window State Diagram} -\label{pic:expt_state} -\end{figure} -\end{center} - -By step 13 there are no more digits left in the exponent. However, there may be partial bits in the window left. If $mode = 2$ then -a Left-to-Right algorithm is used to process the remaining few bits. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_s\_mp\_exptmod.c -\vspace{-3mm} -\begin{alltt} -016 #ifdef MP_LOW_MEM -017 #define TAB_SIZE 32 -018 #else -019 #define TAB_SIZE 256 -020 #endif -021 -022 int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmod - e) -023 \{ -024 mp_int M[TAB_SIZE], res, mu; -025 mp_digit buf; -026 int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; -027 int (*redux)(mp_int*,mp_int*,mp_int*); -028 -029 /* find window size */ -030 x = mp_count_bits (X); -031 if (x <= 7) \{ -032 winsize = 2; -033 \} else if (x <= 36) \{ -034 winsize = 3; -035 \} else if (x <= 140) \{ -036 winsize = 4; -037 \} else if (x <= 450) \{ -038 winsize = 5; -039 \} else if (x <= 1303) \{ -040 winsize = 6; -041 \} else if (x <= 3529) \{ -042 winsize = 7; -043 \} else \{ -044 winsize = 8; -045 \} -046 -047 #ifdef MP_LOW_MEM -048 if (winsize > 5) \{ -049 winsize = 5; -050 \} -051 #endif -052 -053 /* init M array */ -054 /* init first cell */ -055 if ((err = mp_init(&M[1])) != MP_OKAY) \{ -056 return err; -057 \} -058 -059 /* now init the second half of the array */ -060 for (x = 1<<(winsize-1); x < (1 << winsize); x++) \{ -061 if ((err = mp_init(&M[x])) != MP_OKAY) \{ -062 for (y = 1<<(winsize-1); y < x; y++) \{ -063 mp_clear (&M[y]); -064 \} -065 mp_clear(&M[1]); -066 return err; -067 \} -068 \} -069 -070 /* create mu, used for Barrett reduction */ -071 if ((err = mp_init (&mu)) != MP_OKAY) \{ -072 goto LBL_M; -073 \} -074 -075 if (redmode == 0) \{ -076 if ((err = mp_reduce_setup (&mu, P)) != MP_OKAY) \{ -077 goto LBL_MU; -078 \} -079 redux = mp_reduce; -080 \} else \{ -081 if ((err = mp_reduce_2k_setup_l (P, &mu)) != MP_OKAY) \{ -082 goto LBL_MU; -083 \} -084 redux = mp_reduce_2k_l; -085 \} -086 -087 /* create M table -088 * -089 * The M table contains powers of the base, -090 * e.g. M[x] = G**x mod P -091 * -092 * The first half of the table is not -093 * computed though accept for M[0] and M[1] -094 */ -095 if ((err = mp_mod (G, P, &M[1])) != MP_OKAY) \{ -096 goto LBL_MU; -097 \} -098 -099 /* compute the value at M[1<<(winsize-1)] by squaring -100 * M[1] (winsize-1) times -101 */ -102 if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) \{ -103 goto LBL_MU; -104 \} -105 -106 for (x = 0; x < (winsize - 1); x++) \{ -107 /* square it */ -108 if ((err = mp_sqr (&M[1 << (winsize - 1)], -109 &M[1 << (winsize - 1)])) != MP_OKAY) \{ -110 goto LBL_MU; -111 \} -112 -113 /* reduce modulo P */ -114 if ((err = redux (&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) \{ -115 goto LBL_MU; -116 \} -117 \} -118 -119 /* create upper table, that is M[x] = M[x-1] * M[1] (mod P) -120 * for x = (2**(winsize - 1) + 1) to (2**winsize - 1) -121 */ -122 for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) \{ -123 if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) \{ -124 goto LBL_MU; -125 \} -126 if ((err = redux (&M[x], P, &mu)) != MP_OKAY) \{ -127 goto LBL_MU; -128 \} -129 \} -130 -131 /* setup result */ -132 if ((err = mp_init (&res)) != MP_OKAY) \{ -133 goto LBL_MU; -134 \} -135 mp_set (&res, 1); -136 -137 /* set initial mode and bit cnt */ -138 mode = 0; -139 bitcnt = 1; -140 buf = 0; -141 digidx = X->used - 1; -142 bitcpy = 0; -143 bitbuf = 0; -144 -145 for (;;) \{ -146 /* grab next digit as required */ -147 if (--bitcnt == 0) \{ -148 /* if digidx == -1 we are out of digits */ -149 if (digidx == -1) \{ -150 break; -151 \} -152 /* read next digit and reset the bitcnt */ -153 buf = X->dp[digidx--]; -154 bitcnt = (int) DIGIT_BIT; -155 \} -156 -157 /* grab the next msb from the exponent */ -158 y = (buf >> (mp_digit)(DIGIT_BIT - 1)) & 1; -159 buf <<= (mp_digit)1; -160 -161 /* if the bit is zero and mode == 0 then we ignore it -162 * These represent the leading zero bits before the first 1 bit -163 * in the exponent. Technically this opt is not required but it -164 * does lower the # of trivial squaring/reductions used -165 */ -166 if ((mode == 0) && (y == 0)) \{ -167 continue; -168 \} -169 -170 /* if the bit is zero and mode == 1 then we square */ -171 if ((mode == 1) && (y == 0)) \{ -172 if ((err = mp_sqr (&res, &res)) != MP_OKAY) \{ -173 goto LBL_RES; -174 \} -175 if ((err = redux (&res, P, &mu)) != MP_OKAY) \{ -176 goto LBL_RES; -177 \} -178 continue; -179 \} -180 -181 /* else we add it to the window */ -182 bitbuf |= (y << (winsize - ++bitcpy)); -183 mode = 2; -184 -185 if (bitcpy == winsize) \{ -186 /* ok window is filled so square as required and multiply */ -187 /* square first */ -188 for (x = 0; x < winsize; x++) \{ -189 if ((err = mp_sqr (&res, &res)) != MP_OKAY) \{ -190 goto LBL_RES; -191 \} -192 if ((err = redux (&res, P, &mu)) != MP_OKAY) \{ -193 goto LBL_RES; -194 \} -195 \} -196 -197 /* then multiply */ -198 if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) \{ -199 goto LBL_RES; -200 \} -201 if ((err = redux (&res, P, &mu)) != MP_OKAY) \{ -202 goto LBL_RES; -203 \} -204 -205 /* empty window and reset */ -206 bitcpy = 0; -207 bitbuf = 0; -208 mode = 1; -209 \} -210 \} -211 -212 /* if bits remain then square/multiply */ -213 if ((mode == 2) && (bitcpy > 0)) \{ -214 /* square then multiply if the bit is set */ -215 for (x = 0; x < bitcpy; x++) \{ -216 if ((err = mp_sqr (&res, &res)) != MP_OKAY) \{ -217 goto LBL_RES; -218 \} -219 if ((err = redux (&res, P, &mu)) != MP_OKAY) \{ -220 goto LBL_RES; -221 \} -222 -223 bitbuf <<= 1; -224 if ((bitbuf & (1 << winsize)) != 0) \{ -225 /* then multiply */ -226 if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) \{ -227 goto LBL_RES; -228 \} -229 if ((err = redux (&res, P, &mu)) != MP_OKAY) \{ -230 goto LBL_RES; -231 \} -232 \} -233 \} -234 \} -235 -236 mp_exch (&res, Y); -237 err = MP_OKAY; -238 LBL_RES:mp_clear (&res); -239 LBL_MU:mp_clear (&mu); -240 LBL_M: -241 mp_clear(&M[1]); -242 for (x = 1<<(winsize-1); x < (1 << winsize); x++) \{ -243 mp_clear (&M[x]); -244 \} -245 return err; -246 \} -247 #endif -248 -\end{alltt} -\end{small} - -Lines 31 through 45 determine the optimal window size based on the length of the exponent in bits. The window divisions are sorted -from smallest to greatest so that in each \textbf{if} statement only one condition must be tested. For example, by the \textbf{if} statement -on line 37 the value of $x$ is already known to be greater than $140$. - -The conditional piece of code beginning on line 47 allows the window size to be restricted to five bits. This logic is used to ensure -the table of precomputed powers of $G$ remains relatively small. - -The for loop on line 60 initializes the $M$ array while lines 71 and 76 through 85 initialize the reduction -function that will be used for this modulus. - --- More later. - -\section{Quick Power of Two} -Calculating $b = 2^a$ can be performed much quicker than with any of the previous algorithms. Recall that a logical shift left $m << k$ is -equivalent to $m \cdot 2^k$. By this logic when $m = 1$ a quick power of two can be achieved. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_2expt}. \\ -\textbf{Input}. integer $b$ \\ -\textbf{Output}. $a \leftarrow 2^b$ \\ -\hline \\ -1. $a \leftarrow 0$ \\ -2. If $a.alloc < \lfloor b / lg(\beta) \rfloor + 1$ then grow $a$ appropriately. \\ -3. $a.used \leftarrow \lfloor b / lg(\beta) \rfloor + 1$ \\ -4. $a_{\lfloor b / lg(\beta) \rfloor} \leftarrow 1 << (b \mbox{ mod } lg(\beta))$ \\ -5. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_2expt} -\end{figure} - -\textbf{Algorithm mp\_2expt.} - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_2expt.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* computes a = 2**b -018 * -019 * Simple algorithm which zeroes the int, grows it then just sets one bit -020 * as required. -021 */ -022 int -023 mp_2expt (mp_int * a, int b) -024 \{ -025 int res; -026 -027 /* zero a as per default */ -028 mp_zero (a); -029 -030 /* grow a to accomodate the single bit */ -031 if ((res = mp_grow (a, (b / DIGIT_BIT) + 1)) != MP_OKAY) \{ -032 return res; -033 \} -034 -035 /* set the used count of where the bit will go */ -036 a->used = (b / DIGIT_BIT) + 1; -037 -038 /* put the single bit in its place */ -039 a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT); -040 -041 return MP_OKAY; -042 \} -043 #endif -044 -\end{alltt} -\end{small} - -\chapter{Higher Level Algorithms} - -This chapter discusses the various higher level algorithms that are required to complete a well rounded multiple precision integer package. These -routines are less performance oriented than the algorithms of chapters five, six and seven but are no less important. - -The first section describes a method of integer division with remainder that is universally well known. It provides the signed division logic -for the package. The subsequent section discusses a set of algorithms which allow a single digit to be the 2nd operand for a variety of operations. -These algorithms serve mostly to simplify other algorithms where small constants are required. The last two sections discuss how to manipulate -various representations of integers. For example, converting from an mp\_int to a string of character. - -\section{Integer Division with Remainder} -\label{sec:division} - -Integer division aside from modular exponentiation is the most intensive algorithm to compute. Like addition, subtraction and multiplication -the basis of this algorithm is the long-hand division algorithm taught to school children. Throughout this discussion several common variables -will be used. Let $x$ represent the divisor and $y$ represent the dividend. Let $q$ represent the integer quotient $\lfloor y / x \rfloor$ and -let $r$ represent the remainder $r = y - x \lfloor y / x \rfloor$. The following simple algorithm will be used to start the discussion. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Radix-$\beta$ Integer Division}. \\ -\textbf{Input}. integer $x$ and $y$ \\ -\textbf{Output}. $q = \lfloor y/x\rfloor, r = y - xq$ \\ -\hline \\ -1. $q \leftarrow 0$ \\ -2. $n \leftarrow \vert \vert y \vert \vert - \vert \vert x \vert \vert$ \\ -3. for $t$ from $n$ down to $0$ do \\ -\hspace{3mm}3.1 Maximize $k$ such that $kx\beta^t$ is less than or equal to $y$ and $(k + 1)x\beta^t$ is greater. \\ -\hspace{3mm}3.2 $q \leftarrow q + k\beta^t$ \\ -\hspace{3mm}3.3 $y \leftarrow y - kx\beta^t$ \\ -4. $r \leftarrow y$ \\ -5. Return($q, r$) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Radix-$\beta$ Integer Division} -\label{fig:raddiv} -\end{figure} - -As children we are taught this very simple algorithm for the case of $\beta = 10$. Almost instinctively several optimizations are taught for which -their reason of existing are never explained. For this example let $y = 5471$ represent the dividend and $x = 23$ represent the divisor. - -To find the first digit of the quotient the value of $k$ must be maximized such that $kx\beta^t$ is less than or equal to $y$ and -simultaneously $(k + 1)x\beta^t$ is greater than $y$. Implicitly $k$ is the maximum value the $t$'th digit of the quotient may have. The habitual method -used to find the maximum is to ``eyeball'' the two numbers, typically only the leading digits and quickly estimate a quotient. By only using leading -digits a much simpler division may be used to form an educated guess at what the value must be. In this case $k = \lfloor 54/23\rfloor = 2$ quickly -arises as a possible solution. Indeed $2x\beta^2 = 4600$ is less than $y = 5471$ and simultaneously $(k + 1)x\beta^2 = 6900$ is larger than $y$. -As a result $k\beta^2$ is added to the quotient which now equals $q = 200$ and $4600$ is subtracted from $y$ to give a remainder of $y = 841$. - -Again this process is repeated to produce the quotient digit $k = 3$ which makes the quotient $q = 200 + 3\beta = 230$ and the remainder -$y = 841 - 3x\beta = 181$. Finally the last iteration of the loop produces $k = 7$ which leads to the quotient $q = 230 + 7 = 237$ and the -remainder $y = 181 - 7x = 20$. The final quotient and remainder found are $q = 237$ and $r = y = 20$ which are indeed correct since -$237 \cdot 23 + 20 = 5471$ is true. - -\subsection{Quotient Estimation} -\label{sec:divest} -As alluded to earlier the quotient digit $k$ can be estimated from only the leading digits of both the divisor and dividend. When $p$ leading -digits are used from both the divisor and dividend to form an estimation the accuracy of the estimation rises as $p$ grows. Technically -speaking the estimation is based on assuming the lower $\vert \vert y \vert \vert - p$ and $\vert \vert x \vert \vert - p$ lower digits of the -dividend and divisor are zero. - -The value of the estimation may off by a few values in either direction and in general is fairly correct. A simplification \cite[pp. 271]{TAOCPV2} -of the estimation technique is to use $t + 1$ digits of the dividend and $t$ digits of the divisor, in particularly when $t = 1$. The estimate -using this technique is never too small. For the following proof let $t = \vert \vert y \vert \vert - 1$ and $s = \vert \vert x \vert \vert - 1$ -represent the most significant digits of the dividend and divisor respectively. - -\textbf{Proof.}\textit{ The quotient $\hat k = \lfloor (y_t\beta + y_{t-1}) / x_s \rfloor$ is greater than or equal to -$k = \lfloor y / (x \cdot \beta^{\vert \vert y \vert \vert - \vert \vert x \vert \vert - 1}) \rfloor$. } -The first obvious case is when $\hat k = \beta - 1$ in which case the proof is concluded since the real quotient cannot be larger. For all other -cases $\hat k = \lfloor (y_t\beta + y_{t-1}) / x_s \rfloor$ and $\hat k x_s \ge y_t\beta + y_{t-1} - x_s + 1$. The latter portion of the inequalility -$-x_s + 1$ arises from the fact that a truncated integer division will give the same quotient for at most $x_s - 1$ values. Next a series of -inequalities will prove the hypothesis. - -\begin{equation} -y - \hat k x \le y - \hat k x_s\beta^s -\end{equation} - -This is trivially true since $x \ge x_s\beta^s$. Next we replace $\hat kx_s\beta^s$ by the previous inequality for $\hat kx_s$. - -\begin{equation} -y - \hat k x \le y_t\beta^t + \ldots + y_0 - (y_t\beta^t + y_{t-1}\beta^{t-1} - x_s\beta^t + \beta^s) -\end{equation} - -By simplifying the previous inequality the following inequality is formed. - -\begin{equation} -y - \hat k x \le y_{t-2}\beta^{t-2} + \ldots + y_0 + x_s\beta^s - \beta^s -\end{equation} - -Subsequently, - -\begin{equation} -y_{t-2}\beta^{t-2} + \ldots + y_0 + x_s\beta^s - \beta^s < x_s\beta^s \le x -\end{equation} - -Which proves that $y - \hat kx \le x$ and by consequence $\hat k \ge k$ which concludes the proof. \textbf{QED} - - -\subsection{Normalized Integers} -For the purposes of division a normalized input is when the divisors leading digit $x_n$ is greater than or equal to $\beta / 2$. By multiplying both -$x$ and $y$ by $j = \lfloor (\beta / 2) / x_n \rfloor$ the quotient remains unchanged and the remainder is simply $j$ times the original -remainder. The purpose of normalization is to ensure the leading digit of the divisor is sufficiently large such that the estimated quotient will -lie in the domain of a single digit. Consider the maximum dividend $(\beta - 1) \cdot \beta + (\beta - 1)$ and the minimum divisor $\beta / 2$. - -\begin{equation} -{{\beta^2 - 1} \over { \beta / 2}} \le 2\beta - {2 \over \beta} -\end{equation} - -At most the quotient approaches $2\beta$, however, in practice this will not occur since that would imply the previous quotient digit was too small. - -\subsection{Radix-$\beta$ Division with Remainder} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div}. \\ -\textbf{Input}. mp\_int $a, b$ \\ -\textbf{Output}. $c = \lfloor a/b \rfloor$, $d = a - bc$ \\ -\hline \\ -1. If $b = 0$ return(\textit{MP\_VAL}). \\ -2. If $\vert a \vert < \vert b \vert$ then do \\ -\hspace{3mm}2.1 $d \leftarrow a$ \\ -\hspace{3mm}2.2 $c \leftarrow 0$ \\ -\hspace{3mm}2.3 Return(\textit{MP\_OKAY}). \\ -\\ -Setup the quotient to receive the digits. \\ -3. Grow $q$ to $a.used + 2$ digits. \\ -4. $q \leftarrow 0$ \\ -5. $x \leftarrow \vert a \vert , y \leftarrow \vert b \vert$ \\ -6. $sign \leftarrow \left \lbrace \begin{array}{ll} - MP\_ZPOS & \mbox{if }a.sign = b.sign \\ - MP\_NEG & \mbox{otherwise} \\ - \end{array} \right .$ \\ -\\ -Normalize the inputs such that the leading digit of $y$ is greater than or equal to $\beta / 2$. \\ -7. $norm \leftarrow (lg(\beta) - 1) - (\lceil lg(y) \rceil \mbox{ (mod }lg(\beta)\mbox{)})$ \\ -8. $x \leftarrow x \cdot 2^{norm}, y \leftarrow y \cdot 2^{norm}$ \\ -\\ -Find the leading digit of the quotient. \\ -9. $n \leftarrow x.used - 1, t \leftarrow y.used - 1$ \\ -10. $y \leftarrow y \cdot \beta^{n - t}$ \\ -11. While ($x \ge y$) do \\ -\hspace{3mm}11.1 $q_{n - t} \leftarrow q_{n - t} + 1$ \\ -\hspace{3mm}11.2 $x \leftarrow x - y$ \\ -12. $y \leftarrow \lfloor y / \beta^{n-t} \rfloor$ \\ -\\ -Continued on the next page. \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div} (continued). \\ -\textbf{Input}. mp\_int $a, b$ \\ -\textbf{Output}. $c = \lfloor a/b \rfloor$, $d = a - bc$ \\ -\hline \\ -Now find the remainder fo the digits. \\ -13. for $i$ from $n$ down to $(t + 1)$ do \\ -\hspace{3mm}13.1 If $i > x.used$ then jump to the next iteration of this loop. \\ -\hspace{3mm}13.2 If $x_{i} = y_{t}$ then \\ -\hspace{6mm}13.2.1 $q_{i - t - 1} \leftarrow \beta - 1$ \\ -\hspace{3mm}13.3 else \\ -\hspace{6mm}13.3.1 $\hat r \leftarrow x_{i} \cdot \beta + x_{i - 1}$ \\ -\hspace{6mm}13.3.2 $\hat r \leftarrow \lfloor \hat r / y_{t} \rfloor$ \\ -\hspace{6mm}13.3.3 $q_{i - t - 1} \leftarrow \hat r$ \\ -\hspace{3mm}13.4 $q_{i - t - 1} \leftarrow q_{i - t - 1} + 1$ \\ -\\ -Fixup quotient estimation. \\ -\hspace{3mm}13.5 Loop \\ -\hspace{6mm}13.5.1 $q_{i - t - 1} \leftarrow q_{i - t - 1} - 1$ \\ -\hspace{6mm}13.5.2 t$1 \leftarrow 0$ \\ -\hspace{6mm}13.5.3 t$1_0 \leftarrow y_{t - 1}, $ t$1_1 \leftarrow y_t,$ t$1.used \leftarrow 2$ \\ -\hspace{6mm}13.5.4 $t1 \leftarrow t1 \cdot q_{i - t - 1}$ \\ -\hspace{6mm}13.5.5 t$2_0 \leftarrow x_{i - 2}, $ t$2_1 \leftarrow x_{i - 1}, $ t$2_2 \leftarrow x_i, $ t$2.used \leftarrow 3$ \\ -\hspace{6mm}13.5.6 If $\vert t1 \vert > \vert t2 \vert$ then goto step 13.5. \\ -\hspace{3mm}13.6 t$1 \leftarrow y \cdot q_{i - t - 1}$ \\ -\hspace{3mm}13.7 t$1 \leftarrow $ t$1 \cdot \beta^{i - t - 1}$ \\ -\hspace{3mm}13.8 $x \leftarrow x - $ t$1$ \\ -\hspace{3mm}13.9 If $x.sign = MP\_NEG$ then \\ -\hspace{6mm}13.10 t$1 \leftarrow y$ \\ -\hspace{6mm}13.11 t$1 \leftarrow $ t$1 \cdot \beta^{i - t - 1}$ \\ -\hspace{6mm}13.12 $x \leftarrow x + $ t$1$ \\ -\hspace{6mm}13.13 $q_{i - t - 1} \leftarrow q_{i - t - 1} - 1$ \\ -\\ -Finalize the result. \\ -14. Clamp excess digits of $q$ \\ -15. $c \leftarrow q, c.sign \leftarrow sign$ \\ -16. $x.sign \leftarrow a.sign$ \\ -17. $d \leftarrow \lfloor x / 2^{norm} \rfloor$ \\ -18. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div (continued)} -\end{figure} -\textbf{Algorithm mp\_div.} -This algorithm will calculate quotient and remainder from an integer division given a dividend and divisor. The algorithm is a signed -division and will produce a fully qualified quotient and remainder. - -First the divisor $b$ must be non-zero which is enforced in step one. If the divisor is larger than the dividend than the quotient is implicitly -zero and the remainder is the dividend. - -After the first two trivial cases of inputs are handled the variable $q$ is setup to receive the digits of the quotient. Two unsigned copies of the -divisor $y$ and dividend $x$ are made as well. The core of the division algorithm is an unsigned division and will only work if the values are -positive. Now the two values $x$ and $y$ must be normalized such that the leading digit of $y$ is greater than or equal to $\beta / 2$. -This is performed by shifting both to the left by enough bits to get the desired normalization. - -At this point the division algorithm can begin producing digits of the quotient. Recall that maximum value of the estimation used is -$2\beta - {2 \over \beta}$ which means that a digit of the quotient must be first produced by another means. In this case $y$ is shifted -to the left (\textit{step ten}) so that it has the same number of digits as $x$. The loop on step eleven will subtract multiples of the -shifted copy of $y$ until $x$ is smaller. Since the leading digit of $y$ is greater than or equal to $\beta/2$ this loop will iterate at most two -times to produce the desired leading digit of the quotient. - -Now the remainder of the digits can be produced. The equation $\hat q = \lfloor {{x_i \beta + x_{i-1}}\over y_t} \rfloor$ is used to fairly -accurately approximate the true quotient digit. The estimation can in theory produce an estimation as high as $2\beta - {2 \over \beta}$ but by -induction the upper quotient digit is correct (\textit{as established on step eleven}) and the estimate must be less than $\beta$. - -Recall from section~\ref{sec:divest} that the estimation is never too low but may be too high. The next step of the estimation process is -to refine the estimation. The loop on step 13.5 uses $x_i\beta^2 + x_{i-1}\beta + x_{i-2}$ and $q_{i - t - 1}(y_t\beta + y_{t-1})$ as a higher -order approximation to adjust the quotient digit. - -After both phases of estimation the quotient digit may still be off by a value of one\footnote{This is similar to the error introduced -by optimizing Barrett reduction.}. Steps 13.6 and 13.7 subtract the multiple of the divisor from the dividend (\textit{Similar to step 3.3 of -algorithm~\ref{fig:raddiv}} and then subsequently add a multiple of the divisor if the quotient was too large. - -Now that the quotient has been determine finializing the result is a matter of clamping the quotient, fixing the sizes and de-normalizing the -remainder. An important aspect of this algorithm seemingly overlooked in other descriptions such as that of Algorithm 14.20 HAC \cite[pp. 598]{HAC} -is that when the estimations are being made (\textit{inside the loop on step 13.5}) that the digits $y_{t-1}$, $x_{i-2}$ and $x_{i-1}$ may lie -outside their respective boundaries. For example, if $t = 0$ or $i \le 1$ then the digits would be undefined. In those cases the digits should -respectively be replaced with a zero. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_div.c -\vspace{-3mm} -\begin{alltt} -016 -017 #ifdef BN_MP_DIV_SMALL -018 -019 /* slower bit-bang division... also smaller */ -020 int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d) -021 \{ -022 mp_int ta, tb, tq, q; -023 int res, n, n2; -024 -025 /* is divisor zero ? */ -026 if (mp_iszero (b) == MP_YES) \{ -027 return MP_VAL; -028 \} -029 -030 /* if a < b then q=0, r = a */ -031 if (mp_cmp_mag (a, b) == MP_LT) \{ -032 if (d != NULL) \{ -033 res = mp_copy (a, d); -034 \} else \{ -035 res = MP_OKAY; -036 \} -037 if (c != NULL) \{ -038 mp_zero (c); -039 \} -040 return res; -041 \} -042 -043 /* init our temps */ -044 if ((res = mp_init_multi(&ta, &tb, &tq, &q, NULL)) != MP_OKAY) \{ -045 return res; -046 \} -047 -048 -049 mp_set(&tq, 1); -050 n = mp_count_bits(a) - mp_count_bits(b); -051 if (((res = mp_abs(a, &ta)) != MP_OKAY) || -052 ((res = mp_abs(b, &tb)) != MP_OKAY) || -053 ((res = mp_mul_2d(&tb, n, &tb)) != MP_OKAY) || -054 ((res = mp_mul_2d(&tq, n, &tq)) != MP_OKAY)) \{ -055 goto LBL_ERR; -056 \} -057 -058 while (n-- >= 0) \{ -059 if (mp_cmp(&tb, &ta) != MP_GT) \{ -060 if (((res = mp_sub(&ta, &tb, &ta)) != MP_OKAY) || -061 ((res = mp_add(&q, &tq, &q)) != MP_OKAY)) \{ -062 goto LBL_ERR; -063 \} -064 \} -065 if (((res = mp_div_2d(&tb, 1, &tb, NULL)) != MP_OKAY) || -066 ((res = mp_div_2d(&tq, 1, &tq, NULL)) != MP_OKAY)) \{ -067 goto LBL_ERR; -068 \} -069 \} -070 -071 /* now q == quotient and ta == remainder */ -072 n = a->sign; -073 n2 = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; -074 if (c != NULL) \{ -075 mp_exch(c, &q); -076 c->sign = (mp_iszero(c) == MP_YES) ? MP_ZPOS : n2; -077 \} -078 if (d != NULL) \{ -079 mp_exch(d, &ta); -080 d->sign = (mp_iszero(d) == MP_YES) ? MP_ZPOS : n; -081 \} -082 LBL_ERR: -083 mp_clear_multi(&ta, &tb, &tq, &q, NULL); -084 return res; -085 \} -086 -087 #else -088 -089 /* integer signed division. -090 * c*b + d == a [e.g. a/b, c=quotient, d=remainder] -091 * HAC pp.598 Algorithm 14.20 -092 * -093 * Note that the description in HAC is horribly -094 * incomplete. For example, it doesn't consider -095 * the case where digits are removed from 'x' in -096 * the inner loop. It also doesn't consider the -097 * case that y has fewer than three digits, etc.. -098 * -099 * The overall algorithm is as described as -100 * 14.20 from HAC but fixed to treat these cases. -101 */ -102 int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) -103 \{ -104 mp_int q, x, y, t1, t2; -105 int res, n, t, i, norm, neg; -106 -107 /* is divisor zero ? */ -108 if (mp_iszero (b) == MP_YES) \{ -109 return MP_VAL; -110 \} -111 -112 /* if a < b then q=0, r = a */ -113 if (mp_cmp_mag (a, b) == MP_LT) \{ -114 if (d != NULL) \{ -115 res = mp_copy (a, d); -116 \} else \{ -117 res = MP_OKAY; -118 \} -119 if (c != NULL) \{ -120 mp_zero (c); -121 \} -122 return res; -123 \} -124 -125 if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) \{ -126 return res; -127 \} -128 q.used = a->used + 2; -129 -130 if ((res = mp_init (&t1)) != MP_OKAY) \{ -131 goto LBL_Q; -132 \} -133 -134 if ((res = mp_init (&t2)) != MP_OKAY) \{ -135 goto LBL_T1; -136 \} -137 -138 if ((res = mp_init_copy (&x, a)) != MP_OKAY) \{ -139 goto LBL_T2; -140 \} -141 -142 if ((res = mp_init_copy (&y, b)) != MP_OKAY) \{ -143 goto LBL_X; -144 \} -145 -146 /* fix the sign */ -147 neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; -148 x.sign = y.sign = MP_ZPOS; -149 -150 /* normalize both x and y, ensure that y >= b/2, [b == 2**DIGIT_BIT] */ -151 norm = mp_count_bits(&y) % DIGIT_BIT; -152 if (norm < (int)(DIGIT_BIT-1)) \{ -153 norm = (DIGIT_BIT-1) - norm; -154 if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) \{ -155 goto LBL_Y; -156 \} -157 if ((res = mp_mul_2d (&y, norm, &y)) != MP_OKAY) \{ -158 goto LBL_Y; -159 \} -160 \} else \{ -161 norm = 0; -162 \} -163 -164 /* note hac does 0 based, so if used==5 then its 0,1,2,3,4, e.g. use 4 */ -165 n = x.used - 1; -166 t = y.used - 1; -167 -168 /* while (x >= y*b**n-t) do \{ q[n-t] += 1; x -= y*b**\{n-t\} \} */ -169 if ((res = mp_lshd (&y, n - t)) != MP_OKAY) \{ /* y = y*b**\{n-t\} */ -170 goto LBL_Y; -171 \} -172 -173 while (mp_cmp (&x, &y) != MP_LT) \{ -174 ++(q.dp[n - t]); -175 if ((res = mp_sub (&x, &y, &x)) != MP_OKAY) \{ -176 goto LBL_Y; -177 \} -178 \} -179 -180 /* reset y by shifting it back down */ -181 mp_rshd (&y, n - t); -182 -183 /* step 3. for i from n down to (t + 1) */ -184 for (i = n; i >= (t + 1); i--) \{ -185 if (i > x.used) \{ -186 continue; -187 \} -188 -189 /* step 3.1 if xi == yt then set q\{i-t-1\} to b-1, -190 * otherwise set q\{i-t-1\} to (xi*b + x\{i-1\})/yt */ -191 if (x.dp[i] == y.dp[t]) \{ -192 q.dp[(i - t) - 1] = ((((mp_digit)1) << DIGIT_BIT) - 1); -193 \} else \{ -194 mp_word tmp; -195 tmp = ((mp_word) x.dp[i]) << ((mp_word) DIGIT_BIT); -196 tmp |= ((mp_word) x.dp[i - 1]); -197 tmp /= ((mp_word) y.dp[t]); -198 if (tmp > (mp_word) MP_MASK) \{ -199 tmp = MP_MASK; -200 \} -201 q.dp[(i - t) - 1] = (mp_digit) (tmp & (mp_word) (MP_MASK)); -202 \} -203 -204 /* while (q\{i-t-1\} * (yt * b + y\{t-1\})) > -205 xi * b**2 + xi-1 * b + xi-2 -206 -207 do q\{i-t-1\} -= 1; -208 */ -209 q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] + 1) & MP_MASK; -210 do \{ -211 q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] - 1) & MP_MASK; -212 -213 /* find left hand */ -214 mp_zero (&t1); -215 t1.dp[0] = ((t - 1) < 0) ? 0 : y.dp[t - 1]; -216 t1.dp[1] = y.dp[t]; -217 t1.used = 2; -218 if ((res = mp_mul_d (&t1, q.dp[(i - t) - 1], &t1)) != MP_OKAY) \{ -219 goto LBL_Y; -220 \} -221 -222 /* find right hand */ -223 t2.dp[0] = ((i - 2) < 0) ? 0 : x.dp[i - 2]; -224 t2.dp[1] = ((i - 1) < 0) ? 0 : x.dp[i - 1]; -225 t2.dp[2] = x.dp[i]; -226 t2.used = 3; -227 \} while (mp_cmp_mag(&t1, &t2) == MP_GT); -228 -229 /* step 3.3 x = x - q\{i-t-1\} * y * b**\{i-t-1\} */ -230 if ((res = mp_mul_d (&y, q.dp[(i - t) - 1], &t1)) != MP_OKAY) \{ -231 goto LBL_Y; -232 \} -233 -234 if ((res = mp_lshd (&t1, (i - t) - 1)) != MP_OKAY) \{ -235 goto LBL_Y; -236 \} -237 -238 if ((res = mp_sub (&x, &t1, &x)) != MP_OKAY) \{ -239 goto LBL_Y; -240 \} -241 -242 /* if x < 0 then \{ x = x + y*b**\{i-t-1\}; q\{i-t-1\} -= 1; \} */ -243 if (x.sign == MP_NEG) \{ -244 if ((res = mp_copy (&y, &t1)) != MP_OKAY) \{ -245 goto LBL_Y; -246 \} -247 if ((res = mp_lshd (&t1, (i - t) - 1)) != MP_OKAY) \{ -248 goto LBL_Y; -249 \} -250 if ((res = mp_add (&x, &t1, &x)) != MP_OKAY) \{ -251 goto LBL_Y; -252 \} -253 -254 q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] - 1UL) & MP_MASK; -255 \} -256 \} -257 -258 /* now q is the quotient and x is the remainder -259 * [which we have to normalize] -260 */ -261 -262 /* get sign before writing to c */ -263 x.sign = (x.used == 0) ? MP_ZPOS : a->sign; -264 -265 if (c != NULL) \{ -266 mp_clamp (&q); -267 mp_exch (&q, c); -268 c->sign = neg; -269 \} -270 -271 if (d != NULL) \{ -272 if ((res = mp_div_2d (&x, norm, &x, NULL)) != MP_OKAY) \{ -273 goto LBL_Y; -274 \} -275 mp_exch (&x, d); -276 \} -277 -278 res = MP_OKAY; -279 -280 LBL_Y:mp_clear (&y); -281 LBL_X:mp_clear (&x); -282 LBL_T2:mp_clear (&t2); -283 LBL_T1:mp_clear (&t1); -284 LBL_Q:mp_clear (&q); -285 return res; -286 \} -287 -288 #endif -289 -290 #endif -291 -\end{alltt} -\end{small} - -The implementation of this algorithm differs slightly from the pseudo code presented previously. In this algorithm either of the quotient $c$ or -remainder $d$ may be passed as a \textbf{NULL} pointer which indicates their value is not desired. For example, the C code to call the division -algorithm with only the quotient is - -\begin{verbatim} -mp_div(&a, &b, &c, NULL); /* c = [a/b] */ -\end{verbatim} - -Lines 108 and 113 handle the two trivial cases of inputs which are division by zero and dividend smaller than the divisor -respectively. After the two trivial cases all of the temporary variables are initialized. Line 147 determines the sign of -the quotient and line 148 ensures that both $x$ and $y$ are positive. - -The number of bits in the leading digit is calculated on line 151. Implictly an mp\_int with $r$ digits will require $lg(\beta)(r-1) + k$ bits -of precision which when reduced modulo $lg(\beta)$ produces the value of $k$. In this case $k$ is the number of bits in the leading digit which is -exactly what is required. For the algorithm to operate $k$ must equal $lg(\beta) - 1$ and when it does not the inputs must be normalized by shifting -them to the left by $lg(\beta) - 1 - k$ bits. - -Throughout the variables $n$ and $t$ will represent the highest digit of $x$ and $y$ respectively. These are first used to produce the -leading digit of the quotient. The loop beginning on line 184 will produce the remainder of the quotient digits. - -The conditional ``continue'' on line 186 is used to prevent the algorithm from reading past the leading edge of $x$ which can occur when the -algorithm eliminates multiple non-zero digits in a single iteration. This ensures that $x_i$ is always non-zero since by definition the digits -above the $i$'th position $x$ must be zero in order for the quotient to be precise\footnote{Precise as far as integer division is concerned.}. - -Lines 214, 216 and 223 through 225 manually construct the high accuracy estimations by setting the digits of the two mp\_int -variables directly. - -\section{Single Digit Helpers} - -This section briefly describes a series of single digit helper algorithms which come in handy when working with small constants. All of -the helper functions assume the single digit input is positive and will treat them as such. - -\subsection{Single Digit Addition and Subtraction} - -Both addition and subtraction are performed by ``cheating'' and using mp\_set followed by the higher level addition or subtraction -algorithms. As a result these algorithms are subtantially simpler with a slight cost in performance. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_add\_d}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c = a + b$ \\ -\hline \\ -1. $t \leftarrow b$ (\textit{mp\_set}) \\ -2. $c \leftarrow a + t$ \\ -3. Return(\textit{MP\_OKAY}) \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_add\_d} -\end{figure} - -\textbf{Algorithm mp\_add\_d.} -This algorithm initiates a temporary mp\_int with the value of the single digit and uses algorithm mp\_add to add the two values together. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_add\_d.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* single digit addition */ -018 int -019 mp_add_d (mp_int * a, mp_digit b, mp_int * c) -020 \{ -021 int res, ix, oldused; -022 mp_digit *tmpa, *tmpc, mu; -023 -024 /* grow c as required */ -025 if (c->alloc < (a->used + 1)) \{ -026 if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) \{ -027 return res; -028 \} -029 \} -030 -031 /* if a is negative and |a| >= b, call c = |a| - b */ -032 if ((a->sign == MP_NEG) && ((a->used > 1) || (a->dp[0] >= b))) \{ -033 /* temporarily fix sign of a */ -034 a->sign = MP_ZPOS; -035 -036 /* c = |a| - b */ -037 res = mp_sub_d(a, b, c); -038 -039 /* fix sign */ -040 a->sign = c->sign = MP_NEG; -041 -042 /* clamp */ -043 mp_clamp(c); -044 -045 return res; -046 \} -047 -048 /* old number of used digits in c */ -049 oldused = c->used; -050 -051 /* sign always positive */ -052 c->sign = MP_ZPOS; -053 -054 /* source alias */ -055 tmpa = a->dp; -056 -057 /* destination alias */ -058 tmpc = c->dp; -059 -060 /* if a is positive */ -061 if (a->sign == MP_ZPOS) \{ -062 /* add digit, after this we're propagating -063 * the carry. -064 */ -065 *tmpc = *tmpa++ + b; -066 mu = *tmpc >> DIGIT_BIT; -067 *tmpc++ &= MP_MASK; -068 -069 /* now handle rest of the digits */ -070 for (ix = 1; ix < a->used; ix++) \{ -071 *tmpc = *tmpa++ + mu; -072 mu = *tmpc >> DIGIT_BIT; -073 *tmpc++ &= MP_MASK; -074 \} -075 /* set final carry */ -076 ix++; -077 *tmpc++ = mu; -078 -079 /* setup size */ -080 c->used = a->used + 1; -081 \} else \{ -082 /* a was negative and |a| < b */ -083 c->used = 1; -084 -085 /* the result is a single digit */ -086 if (a->used == 1) \{ -087 *tmpc++ = b - a->dp[0]; -088 \} else \{ -089 *tmpc++ = b; -090 \} -091 -092 /* setup count so the clearing of oldused -093 * can fall through correctly -094 */ -095 ix = 1; -096 \} -097 -098 /* now zero to oldused */ -099 while (ix++ < oldused) \{ -100 *tmpc++ = 0; -101 \} -102 mp_clamp(c); -103 -104 return MP_OKAY; -105 \} -106 -107 #endif -108 -\end{alltt} -\end{small} - -Clever use of the letter 't'. - -\subsubsection{Subtraction} -The single digit subtraction algorithm mp\_sub\_d is essentially the same except it uses mp\_sub to subtract the digit from the mp\_int. - -\subsection{Single Digit Multiplication} -Single digit multiplication arises enough in division and radix conversion that it ought to be implement as a special case of the baseline -multiplication algorithm. Essentially this algorithm is a modified version of algorithm s\_mp\_mul\_digs where one of the multiplicands -only has one digit. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_mul\_d}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c = ab$ \\ -\hline \\ -1. $pa \leftarrow a.used$ \\ -2. Grow $c$ to at least $pa + 1$ digits. \\ -3. $oldused \leftarrow c.used$ \\ -4. $c.used \leftarrow pa + 1$ \\ -5. $c.sign \leftarrow a.sign$ \\ -6. $\mu \leftarrow 0$ \\ -7. for $ix$ from $0$ to $pa - 1$ do \\ -\hspace{3mm}7.1 $\hat r \leftarrow \mu + a_{ix}b$ \\ -\hspace{3mm}7.2 $c_{ix} \leftarrow \hat r \mbox{ (mod }\beta\mbox{)}$ \\ -\hspace{3mm}7.3 $\mu \leftarrow \lfloor \hat r / \beta \rfloor$ \\ -8. $c_{pa} \leftarrow \mu$ \\ -9. for $ix$ from $pa + 1$ to $oldused$ do \\ -\hspace{3mm}9.1 $c_{ix} \leftarrow 0$ \\ -10. Clamp excess digits of $c$. \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_mul\_d} -\end{figure} -\textbf{Algorithm mp\_mul\_d.} -This algorithm quickly multiplies an mp\_int by a small single digit value. It is specially tailored to the job and has a minimal of overhead. -Unlike the full multiplication algorithms this algorithm does not require any significnat temporary storage or memory allocations. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_mul\_d.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* multiply by a digit */ -018 int -019 mp_mul_d (mp_int * a, mp_digit b, mp_int * c) -020 \{ -021 mp_digit u, *tmpa, *tmpc; -022 mp_word r; -023 int ix, res, olduse; -024 -025 /* make sure c is big enough to hold a*b */ -026 if (c->alloc < (a->used + 1)) \{ -027 if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) \{ -028 return res; -029 \} -030 \} -031 -032 /* get the original destinations used count */ -033 olduse = c->used; -034 -035 /* set the sign */ -036 c->sign = a->sign; -037 -038 /* alias for a->dp [source] */ -039 tmpa = a->dp; -040 -041 /* alias for c->dp [dest] */ -042 tmpc = c->dp; -043 -044 /* zero carry */ -045 u = 0; -046 -047 /* compute columns */ -048 for (ix = 0; ix < a->used; ix++) \{ -049 /* compute product and carry sum for this term */ -050 r = (mp_word)u + ((mp_word)*tmpa++ * (mp_word)b); -051 -052 /* mask off higher bits to get a single digit */ -053 *tmpc++ = (mp_digit) (r & ((mp_word) MP_MASK)); -054 -055 /* send carry into next iteration */ -056 u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); -057 \} -058 -059 /* store final carry [if any] and increment ix offset */ -060 *tmpc++ = u; -061 ++ix; -062 -063 /* now zero digits above the top */ -064 while (ix++ < olduse) \{ -065 *tmpc++ = 0; -066 \} -067 -068 /* set used count */ -069 c->used = a->used + 1; -070 mp_clamp(c); -071 -072 return MP_OKAY; -073 \} -074 #endif -075 -\end{alltt} -\end{small} - -In this implementation the destination $c$ may point to the same mp\_int as the source $a$ since the result is written after the digit is -read from the source. This function uses pointer aliases $tmpa$ and $tmpc$ for the digits of $a$ and $c$ respectively. - -\subsection{Single Digit Division} -Like the single digit multiplication algorithm, single digit division is also a fairly common algorithm used in radix conversion. Since the -divisor is only a single digit a specialized variant of the division algorithm can be used to compute the quotient. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_div\_d}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c = \lfloor a / b \rfloor, d = a - cb$ \\ -\hline \\ -1. If $b = 0$ then return(\textit{MP\_VAL}).\\ -2. If $b = 3$ then use algorithm mp\_div\_3 instead. \\ -3. Init $q$ to $a.used$ digits. \\ -4. $q.used \leftarrow a.used$ \\ -5. $q.sign \leftarrow a.sign$ \\ -6. $\hat w \leftarrow 0$ \\ -7. for $ix$ from $a.used - 1$ down to $0$ do \\ -\hspace{3mm}7.1 $\hat w \leftarrow \hat w \beta + a_{ix}$ \\ -\hspace{3mm}7.2 If $\hat w \ge b$ then \\ -\hspace{6mm}7.2.1 $t \leftarrow \lfloor \hat w / b \rfloor$ \\ -\hspace{6mm}7.2.2 $\hat w \leftarrow \hat w \mbox{ (mod }b\mbox{)}$ \\ -\hspace{3mm}7.3 else\\ -\hspace{6mm}7.3.1 $t \leftarrow 0$ \\ -\hspace{3mm}7.4 $q_{ix} \leftarrow t$ \\ -8. $d \leftarrow \hat w$ \\ -9. Clamp excess digits of $q$. \\ -10. $c \leftarrow q$ \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_div\_d} -\end{figure} -\textbf{Algorithm mp\_div\_d.} -This algorithm divides the mp\_int $a$ by the single mp\_digit $b$ using an optimized approach. Essentially in every iteration of the -algorithm another digit of the dividend is reduced and another digit of quotient produced. Provided $b < \beta$ the value of $\hat w$ -after step 7.1 will be limited such that $0 \le \lfloor \hat w / b \rfloor < \beta$. - -If the divisor $b$ is equal to three a variant of this algorithm is used which is called mp\_div\_3. It replaces the division by three with -a multiplication by $\lfloor \beta / 3 \rfloor$ and the appropriate shift and residual fixup. In essence it is much like the Barrett reduction -from chapter seven. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_div\_d.c -\vspace{-3mm} -\begin{alltt} -016 -017 static int s_is_power_of_two(mp_digit b, int *p) -018 \{ -019 int x; -020 -021 /* fast return if no power of two */ -022 if ((b == 0) || ((b & (b-1)) != 0)) \{ -023 return 0; -024 \} -025 -026 for (x = 0; x < DIGIT_BIT; x++) \{ -027 if (b == (((mp_digit)1)<dp[0] & ((((mp_digit)1)<used)) != MP_OKAY) \{ -079 return res; -080 \} -081 -082 q.used = a->used; -083 q.sign = a->sign; -084 w = 0; -085 for (ix = a->used - 1; ix >= 0; ix--) \{ -086 w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); -087 -088 if (w >= b) \{ -089 t = (mp_digit)(w / b); -090 w -= ((mp_word)t) * ((mp_word)b); -091 \} else \{ -092 t = 0; -093 \} -094 q.dp[ix] = (mp_digit)t; -095 \} -096 -097 if (d != NULL) \{ -098 *d = (mp_digit)w; -099 \} -100 -101 if (c != NULL) \{ -102 mp_clamp(&q); -103 mp_exch(&q, c); -104 \} -105 mp_clear(&q); -106 -107 return res; -108 \} -109 -110 #endif -111 -\end{alltt} -\end{small} - -Like the implementation of algorithm mp\_div this algorithm allows either of the quotient or remainder to be passed as a \textbf{NULL} pointer to -indicate the respective value is not required. This allows a trivial single digit modular reduction algorithm, mp\_mod\_d to be created. - -The division and remainder on lines 89 and 90 can be replaced often by a single division on most processors. For example, the 32-bit x86 based -processors can divide a 64-bit quantity by a 32-bit quantity and produce the quotient and remainder simultaneously. Unfortunately the GCC -compiler does not recognize that optimization and will actually produce two function calls to find the quotient and remainder respectively. - -\subsection{Single Digit Root Extraction} - -Finding the $n$'th root of an integer is fairly easy as far as numerical analysis is concerned. Algorithms such as the Newton-Raphson approximation -(\ref{eqn:newton}) series will converge very quickly to a root for any continuous function $f(x)$. - -\begin{equation} -x_{i+1} = x_i - {f(x_i) \over f'(x_i)} -\label{eqn:newton} -\end{equation} - -In this case the $n$'th root is desired and $f(x) = x^n - a$ where $a$ is the integer of which the root is desired. The derivative of $f(x)$ is -simply $f'(x) = nx^{n - 1}$. Of particular importance is that this algorithm will be used over the integers not over the a more continuous domain -such as the real numbers. As a result the root found can be above the true root by few and must be manually adjusted. Ideally at the end of the -algorithm the $n$'th root $b$ of an integer $a$ is desired such that $b^n \le a$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_n\_root}. \\ -\textbf{Input}. mp\_int $a$ and a mp\_digit $b$ \\ -\textbf{Output}. $c^b \le a$ \\ -\hline \\ -1. If $b$ is even and $a.sign = MP\_NEG$ return(\textit{MP\_VAL}). \\ -2. $sign \leftarrow a.sign$ \\ -3. $a.sign \leftarrow MP\_ZPOS$ \\ -4. t$2 \leftarrow 2$ \\ -5. Loop \\ -\hspace{3mm}5.1 t$1 \leftarrow $ t$2$ \\ -\hspace{3mm}5.2 t$3 \leftarrow $ t$1^{b - 1}$ \\ -\hspace{3mm}5.3 t$2 \leftarrow $ t$3 $ $\cdot$ t$1$ \\ -\hspace{3mm}5.4 t$2 \leftarrow $ t$2 - a$ \\ -\hspace{3mm}5.5 t$3 \leftarrow $ t$3 \cdot b$ \\ -\hspace{3mm}5.6 t$3 \leftarrow \lfloor $t$2 / $t$3 \rfloor$ \\ -\hspace{3mm}5.7 t$2 \leftarrow $ t$1 - $ t$3$ \\ -\hspace{3mm}5.8 If t$1 \ne $ t$2$ then goto step 5. \\ -6. Loop \\ -\hspace{3mm}6.1 t$2 \leftarrow $ t$1^b$ \\ -\hspace{3mm}6.2 If t$2 > a$ then \\ -\hspace{6mm}6.2.1 t$1 \leftarrow $ t$1 - 1$ \\ -\hspace{6mm}6.2.2 Goto step 6. \\ -7. $a.sign \leftarrow sign$ \\ -8. $c \leftarrow $ t$1$ \\ -9. $c.sign \leftarrow sign$ \\ -10. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_n\_root} -\end{figure} -\textbf{Algorithm mp\_n\_root.} -This algorithm finds the integer $n$'th root of an input using the Newton-Raphson approach. It is partially optimized based on the observation -that the numerator of ${f(x) \over f'(x)}$ can be derived from a partial denominator. That is at first the denominator is calculated by finding -$x^{b - 1}$. This value can then be multiplied by $x$ and have $a$ subtracted from it to find the numerator. This saves a total of $b - 1$ -multiplications by t$1$ inside the loop. - -The initial value of the approximation is t$2 = 2$ which allows the algorithm to start with very small values and quickly converge on the -root. Ideally this algorithm is meant to find the $n$'th root of an input where $n$ is bounded by $2 \le n \le 5$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_n\_root.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* wrapper function for mp_n_root_ex() -018 * computes c = (a)**(1/b) such that (c)**b <= a and (c+1)**b > a -019 */ -020 int mp_n_root (mp_int * a, mp_digit b, mp_int * c) -021 \{ -022 return mp_n_root_ex(a, b, c, 0); -023 \} -024 -025 #endif -026 -\end{alltt} -\end{small} - -\section{Random Number Generation} - -Random numbers come up in a variety of activities from public key cryptography to simple simulations and various randomized algorithms. Pollard-Rho -factoring for example, can make use of random values as starting points to find factors of a composite integer. In this case the algorithm presented -is solely for simulations and not intended for cryptographic use. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_rand}. \\ -\textbf{Input}. An integer $b$ \\ -\textbf{Output}. A pseudo-random number of $b$ digits \\ -\hline \\ -1. $a \leftarrow 0$ \\ -2. If $b \le 0$ return(\textit{MP\_OKAY}) \\ -3. Pick a non-zero random digit $d$. \\ -4. $a \leftarrow a + d$ \\ -5. for $ix$ from 1 to $d - 1$ do \\ -\hspace{3mm}5.1 $a \leftarrow a \cdot \beta$ \\ -\hspace{3mm}5.2 Pick a random digit $d$. \\ -\hspace{3mm}5.3 $a \leftarrow a + d$ \\ -6. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_rand} -\end{figure} -\textbf{Algorithm mp\_rand.} -This algorithm produces a pseudo-random integer of $b$ digits. By ensuring that the first digit is non-zero the algorithm also guarantees that the -final result has at least $b$ digits. It relies heavily on a third-part random number generator which should ideally generate uniformly all of -the integers from $0$ to $\beta - 1$. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_rand.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* makes a pseudo-random int of a given size */ -018 int -019 mp_rand (mp_int * a, int digits) -020 \{ -021 int res; -022 mp_digit d; -023 -024 mp_zero (a); -025 if (digits <= 0) \{ -026 return MP_OKAY; -027 \} -028 -029 /* first place a random non-zero digit */ -030 do \{ -031 d = ((mp_digit) abs (MP_GEN_RANDOM())) & MP_MASK; -032 \} while (d == 0); -033 -034 if ((res = mp_add_d (a, d, a)) != MP_OKAY) \{ -035 return res; -036 \} -037 -038 while (--digits > 0) \{ -039 if ((res = mp_lshd (a, 1)) != MP_OKAY) \{ -040 return res; -041 \} -042 -043 if ((res = mp_add_d (a, ((mp_digit) abs (MP_GEN_RANDOM())), a)) != MP_OK - AY) \{ -044 return res; -045 \} -046 \} -047 -048 return MP_OKAY; -049 \} -050 #endif -051 -\end{alltt} -\end{small} - -\section{Formatted Representations} -The ability to emit a radix-$n$ textual representation of an integer is useful for interacting with human parties. For example, the ability to -be given a string of characters such as ``114585'' and turn it into the radix-$\beta$ equivalent would make it easier to enter numbers -into a program. - -\subsection{Reading Radix-n Input} -For the purposes of this text we will assume that a simple lower ASCII map (\ref{fig:ASC}) is used for the values of from $0$ to $63$ to -printable characters. For example, when the character ``N'' is read it represents the integer $23$. The first $16$ characters of the -map are for the common representations up to hexadecimal. After that they match the ``base64'' encoding scheme which are suitable chosen -such that they are printable. While outputting as base64 may not be too helpful for human operators it does allow communication via non binary -mediums. - -\newpage\begin{figure}[here] -\begin{center} -\begin{tabular}{cc|cc|cc|cc} -\hline \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} \\ -\hline -0 & 0 & 1 & 1 & 2 & 2 & 3 & 3 \\ -4 & 4 & 5 & 5 & 6 & 6 & 7 & 7 \\ -8 & 8 & 9 & 9 & 10 & A & 11 & B \\ -12 & C & 13 & D & 14 & E & 15 & F \\ -16 & G & 17 & H & 18 & I & 19 & J \\ -20 & K & 21 & L & 22 & M & 23 & N \\ -24 & O & 25 & P & 26 & Q & 27 & R \\ -28 & S & 29 & T & 30 & U & 31 & V \\ -32 & W & 33 & X & 34 & Y & 35 & Z \\ -36 & a & 37 & b & 38 & c & 39 & d \\ -40 & e & 41 & f & 42 & g & 43 & h \\ -44 & i & 45 & j & 46 & k & 47 & l \\ -48 & m & 49 & n & 50 & o & 51 & p \\ -52 & q & 53 & r & 54 & s & 55 & t \\ -56 & u & 57 & v & 58 & w & 59 & x \\ -60 & y & 61 & z & 62 & $+$ & 63 & $/$ \\ -\hline -\end{tabular} -\end{center} -\caption{Lower ASCII Map} -\label{fig:ASC} -\end{figure} - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_read\_radix}. \\ -\textbf{Input}. A string $str$ of length $sn$ and radix $r$. \\ -\textbf{Output}. The radix-$\beta$ equivalent mp\_int. \\ -\hline \\ -1. If $r < 2$ or $r > 64$ return(\textit{MP\_VAL}). \\ -2. $ix \leftarrow 0$ \\ -3. If $str_0 =$ ``-'' then do \\ -\hspace{3mm}3.1 $ix \leftarrow ix + 1$ \\ -\hspace{3mm}3.2 $sign \leftarrow MP\_NEG$ \\ -4. else \\ -\hspace{3mm}4.1 $sign \leftarrow MP\_ZPOS$ \\ -5. $a \leftarrow 0$ \\ -6. for $iy$ from $ix$ to $sn - 1$ do \\ -\hspace{3mm}6.1 Let $y$ denote the position in the map of $str_{iy}$. \\ -\hspace{3mm}6.2 If $str_{iy}$ is not in the map or $y \ge r$ then goto step 7. \\ -\hspace{3mm}6.3 $a \leftarrow a \cdot r$ \\ -\hspace{3mm}6.4 $a \leftarrow a + y$ \\ -7. If $a \ne 0$ then $a.sign \leftarrow sign$ \\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_read\_radix} -\end{figure} -\textbf{Algorithm mp\_read\_radix.} -This algorithm will read an ASCII string and produce the radix-$\beta$ mp\_int representation of the same integer. A minus symbol ``-'' may precede the -string to indicate the value is negative, otherwise it is assumed to be positive. The algorithm will read up to $sn$ characters from the input -and will stop when it reads a character it cannot map the algorithm stops reading characters from the string. This allows numbers to be embedded -as part of larger input without any significant problem. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_read\_radix.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* read a string [ASCII] in a given radix */ -018 int mp_read_radix (mp_int * a, const char *str, int radix) -019 \{ -020 int y, res, neg; -021 char ch; -022 -023 /* zero the digit bignum */ -024 mp_zero(a); -025 -026 /* make sure the radix is ok */ -027 if ((radix < 2) || (radix > 64)) \{ -028 return MP_VAL; -029 \} -030 -031 /* if the leading digit is a -032 * minus set the sign to negative. -033 */ -034 if (*str == '-') \{ -035 ++str; -036 neg = MP_NEG; -037 \} else \{ -038 neg = MP_ZPOS; -039 \} -040 -041 /* set the integer to the default of zero */ -042 mp_zero (a); -043 -044 /* process each digit of the string */ -045 while (*str != '\symbol{92}0') \{ -046 /* if the radix <= 36 the conversion is case insensitive -047 * this allows numbers like 1AB and 1ab to represent the same value -048 * [e.g. in hex] -049 */ -050 ch = (radix <= 36) ? (char)toupper((int)*str) : *str; -051 for (y = 0; y < 64; y++) \{ -052 if (ch == mp_s_rmap[y]) \{ -053 break; -054 \} -055 \} -056 -057 /* if the char was found in the map -058 * and is less than the given radix add it -059 * to the number, otherwise exit the loop. -060 */ -061 if (y < radix) \{ -062 if ((res = mp_mul_d (a, (mp_digit) radix, a)) != MP_OKAY) \{ -063 return res; -064 \} -065 if ((res = mp_add_d (a, (mp_digit) y, a)) != MP_OKAY) \{ -066 return res; -067 \} -068 \} else \{ -069 break; -070 \} -071 ++str; -072 \} -073 -074 /* set the sign only if a != 0 */ -075 if (mp_iszero(a) != MP_YES) \{ -076 a->sign = neg; -077 \} -078 return MP_OKAY; -079 \} -080 #endif -081 -\end{alltt} -\end{small} - -\subsection{Generating Radix-$n$ Output} -Generating radix-$n$ output is fairly trivial with a division and remainder algorithm. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_toradix}. \\ -\textbf{Input}. A mp\_int $a$ and an integer $r$\\ -\textbf{Output}. The radix-$r$ representation of $a$ \\ -\hline \\ -1. If $r < 2$ or $r > 64$ return(\textit{MP\_VAL}). \\ -2. If $a = 0$ then $str = $ ``$0$'' and return(\textit{MP\_OKAY}). \\ -3. $t \leftarrow a$ \\ -4. $str \leftarrow$ ``'' \\ -5. if $t.sign = MP\_NEG$ then \\ -\hspace{3mm}5.1 $str \leftarrow str + $ ``-'' \\ -\hspace{3mm}5.2 $t.sign = MP\_ZPOS$ \\ -6. While ($t \ne 0$) do \\ -\hspace{3mm}6.1 $d \leftarrow t \mbox{ (mod }r\mbox{)}$ \\ -\hspace{3mm}6.2 $t \leftarrow \lfloor t / r \rfloor$ \\ -\hspace{3mm}6.3 Look up $d$ in the map and store the equivalent character in $y$. \\ -\hspace{3mm}6.4 $str \leftarrow str + y$ \\ -7. If $str_0 = $``$-$'' then \\ -\hspace{3mm}7.1 Reverse the digits $str_1, str_2, \ldots str_n$. \\ -8. Otherwise \\ -\hspace{3mm}8.1 Reverse the digits $str_0, str_1, \ldots str_n$. \\ -9. Return(\textit{MP\_OKAY}).\\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_toradix} -\end{figure} -\textbf{Algorithm mp\_toradix.} -This algorithm computes the radix-$r$ representation of an mp\_int $a$. The ``digits'' of the representation are extracted by reducing -successive powers of $\lfloor a / r^k \rfloor$ the input modulo $r$ until $r^k > a$. Note that instead of actually dividing by $r^k$ in -each iteration the quotient $\lfloor a / r \rfloor$ is saved for the next iteration. As a result a series of trivial $n \times 1$ divisions -are required instead of a series of $n \times k$ divisions. One design flaw of this approach is that the digits are produced in the reverse order -(see~\ref{fig:mpradix}). To remedy this flaw the digits must be swapped or simply ``reversed''. - -\begin{figure} -\begin{center} -\begin{tabular}{|c|c|c|} -\hline \textbf{Value of $a$} & \textbf{Value of $d$} & \textbf{Value of $str$} \\ -\hline $1234$ & -- & -- \\ -\hline $123$ & $4$ & ``4'' \\ -\hline $12$ & $3$ & ``43'' \\ -\hline $1$ & $2$ & ``432'' \\ -\hline $0$ & $1$ & ``4321'' \\ -\hline -\end{tabular} -\end{center} -\caption{Example of Algorithm mp\_toradix.} -\label{fig:mpradix} -\end{figure} - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_toradix.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* stores a bignum as a ASCII string in a given radix (2..64) */ -018 int mp_toradix (mp_int * a, char *str, int radix) -019 \{ -020 int res, digs; -021 mp_int t; -022 mp_digit d; -023 char *_s = str; -024 -025 /* check range of the radix */ -026 if ((radix < 2) || (radix > 64)) \{ -027 return MP_VAL; -028 \} -029 -030 /* quick out if its zero */ -031 if (mp_iszero(a) == MP_YES) \{ -032 *str++ = '0'; -033 *str = '\symbol{92}0'; -034 return MP_OKAY; -035 \} -036 -037 if ((res = mp_init_copy (&t, a)) != MP_OKAY) \{ -038 return res; -039 \} -040 -041 /* if it is negative output a - */ -042 if (t.sign == MP_NEG) \{ -043 ++_s; -044 *str++ = '-'; -045 t.sign = MP_ZPOS; -046 \} -047 -048 digs = 0; -049 while (mp_iszero (&t) == MP_NO) \{ -050 if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) \{ -051 mp_clear (&t); -052 return res; -053 \} -054 *str++ = mp_s_rmap[d]; -055 ++digs; -056 \} -057 -058 /* reverse the digits of the string. In this case _s points -059 * to the first digit [exluding the sign] of the number] -060 */ -061 bn_reverse ((unsigned char *)_s, digs); -062 -063 /* append a NULL so the string is properly terminated */ -064 *str = '\symbol{92}0'; -065 -066 mp_clear (&t); -067 return MP_OKAY; -068 \} -069 -070 #endif -071 -\end{alltt} -\end{small} - -\chapter{Number Theoretic Algorithms} -This chapter discusses several fundamental number theoretic algorithms such as the greatest common divisor, least common multiple and Jacobi -symbol computation. These algorithms arise as essential components in several key cryptographic algorithms such as the RSA public key algorithm and -various Sieve based factoring algorithms. - -\section{Greatest Common Divisor} -The greatest common divisor of two integers $a$ and $b$, often denoted as $(a, b)$ is the largest integer $k$ that is a proper divisor of -both $a$ and $b$. That is, $k$ is the largest integer such that $0 \equiv a \mbox{ (mod }k\mbox{)}$ and $0 \equiv b \mbox{ (mod }k\mbox{)}$ occur -simultaneously. - -The most common approach (cite) is to reduce one input modulo another. That is if $a$ and $b$ are divisible by some integer $k$ and if $qa + r = b$ then -$r$ is also divisible by $k$. The reduction pattern follows $\left < a , b \right > \rightarrow \left < b, a \mbox{ mod } b \right >$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Greatest Common Divisor (I)}. \\ -\textbf{Input}. Two positive integers $a$ and $b$ greater than zero. \\ -\textbf{Output}. The greatest common divisor $(a, b)$. \\ -\hline \\ -1. While ($b > 0$) do \\ -\hspace{3mm}1.1 $r \leftarrow a \mbox{ (mod }b\mbox{)}$ \\ -\hspace{3mm}1.2 $a \leftarrow b$ \\ -\hspace{3mm}1.3 $b \leftarrow r$ \\ -2. Return($a$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Greatest Common Divisor (I)} -\label{fig:gcd1} -\end{figure} - -This algorithm will quickly converge on the greatest common divisor since the residue $r$ tends diminish rapidly. However, divisions are -relatively expensive operations to perform and should ideally be avoided. There is another approach based on a similar relationship of -greatest common divisors. The faster approach is based on the observation that if $k$ divides both $a$ and $b$ it will also divide $a - b$. -In particular, we would like $a - b$ to decrease in magnitude which implies that $b \ge a$. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Greatest Common Divisor (II)}. \\ -\textbf{Input}. Two positive integers $a$ and $b$ greater than zero. \\ -\textbf{Output}. The greatest common divisor $(a, b)$. \\ -\hline \\ -1. While ($b > 0$) do \\ -\hspace{3mm}1.1 Swap $a$ and $b$ such that $a$ is the smallest of the two. \\ -\hspace{3mm}1.2 $b \leftarrow b - a$ \\ -2. Return($a$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Greatest Common Divisor (II)} -\label{fig:gcd2} -\end{figure} - -\textbf{Proof} \textit{Algorithm~\ref{fig:gcd2} will return the greatest common divisor of $a$ and $b$.} -The algorithm in figure~\ref{fig:gcd2} will eventually terminate since $b \ge a$ the subtraction in step 1.2 will be a value less than $b$. In other -words in every iteration that tuple $\left < a, b \right >$ decrease in magnitude until eventually $a = b$. Since both $a$ and $b$ are always -divisible by the greatest common divisor (\textit{until the last iteration}) and in the last iteration of the algorithm $b = 0$, therefore, in the -second to last iteration of the algorithm $b = a$ and clearly $(a, a) = a$ which concludes the proof. \textbf{QED}. - -As a matter of practicality algorithm \ref{fig:gcd1} decreases far too slowly to be useful. Specially if $b$ is much larger than $a$ such that -$b - a$ is still very much larger than $a$. A simple addition to the algorithm is to divide $b - a$ by a power of some integer $p$ which does -not divide the greatest common divisor but will divide $b - a$. In this case ${b - a} \over p$ is also an integer and still divisible by -the greatest common divisor. - -However, instead of factoring $b - a$ to find a suitable value of $p$ the powers of $p$ can be removed from $a$ and $b$ that are in common first. -Then inside the loop whenever $b - a$ is divisible by some power of $p$ it can be safely removed. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{Greatest Common Divisor (III)}. \\ -\textbf{Input}. Two positive integers $a$ and $b$ greater than zero. \\ -\textbf{Output}. The greatest common divisor $(a, b)$. \\ -\hline \\ -1. $k \leftarrow 0$ \\ -2. While $a$ and $b$ are both divisible by $p$ do \\ -\hspace{3mm}2.1 $a \leftarrow \lfloor a / p \rfloor$ \\ -\hspace{3mm}2.2 $b \leftarrow \lfloor b / p \rfloor$ \\ -\hspace{3mm}2.3 $k \leftarrow k + 1$ \\ -3. While $a$ is divisible by $p$ do \\ -\hspace{3mm}3.1 $a \leftarrow \lfloor a / p \rfloor$ \\ -4. While $b$ is divisible by $p$ do \\ -\hspace{3mm}4.1 $b \leftarrow \lfloor b / p \rfloor$ \\ -5. While ($b > 0$) do \\ -\hspace{3mm}5.1 Swap $a$ and $b$ such that $a$ is the smallest of the two. \\ -\hspace{3mm}5.2 $b \leftarrow b - a$ \\ -\hspace{3mm}5.3 While $b$ is divisible by $p$ do \\ -\hspace{6mm}5.3.1 $b \leftarrow \lfloor b / p \rfloor$ \\ -6. Return($a \cdot p^k$). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm Greatest Common Divisor (III)} -\label{fig:gcd3} -\end{figure} - -This algorithm is based on the first except it removes powers of $p$ first and inside the main loop to ensure the tuple $\left < a, b \right >$ -decreases more rapidly. The first loop on step two removes powers of $p$ that are in common. A count, $k$, is kept which will present a common -divisor of $p^k$. After step two the remaining common divisor of $a$ and $b$ cannot be divisible by $p$. This means that $p$ can be safely -divided out of the difference $b - a$ so long as the division leaves no remainder. - -In particular the value of $p$ should be chosen such that the division on step 5.3.1 occur often. It also helps that division by $p$ be easy -to compute. The ideal choice of $p$ is two since division by two amounts to a right logical shift. Another important observation is that by -step five both $a$ and $b$ are odd. Therefore, the diffrence $b - a$ must be even which means that each iteration removes one bit from the -largest of the pair. - -\subsection{Complete Greatest Common Divisor} -The algorithms presented so far cannot handle inputs which are zero or negative. The following algorithm can handle all input cases properly -and will produce the greatest common divisor. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_gcd}. \\ -\textbf{Input}. mp\_int $a$ and $b$ \\ -\textbf{Output}. The greatest common divisor $c = (a, b)$. \\ -\hline \\ -1. If $a = 0$ then \\ -\hspace{3mm}1.1 $c \leftarrow \vert b \vert $ \\ -\hspace{3mm}1.2 Return(\textit{MP\_OKAY}). \\ -2. If $b = 0$ then \\ -\hspace{3mm}2.1 $c \leftarrow \vert a \vert $ \\ -\hspace{3mm}2.2 Return(\textit{MP\_OKAY}). \\ -3. $u \leftarrow \vert a \vert, v \leftarrow \vert b \vert$ \\ -4. $k \leftarrow 0$ \\ -5. While $u.used > 0$ and $v.used > 0$ and $u_0 \equiv v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}5.1 $k \leftarrow k + 1$ \\ -\hspace{3mm}5.2 $u \leftarrow \lfloor u / 2 \rfloor$ \\ -\hspace{3mm}5.3 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -6. While $u.used > 0$ and $u_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}6.1 $u \leftarrow \lfloor u / 2 \rfloor$ \\ -7. While $v.used > 0$ and $v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}7.1 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -8. While $v.used > 0$ \\ -\hspace{3mm}8.1 If $\vert u \vert > \vert v \vert$ then \\ -\hspace{6mm}8.1.1 Swap $u$ and $v$. \\ -\hspace{3mm}8.2 $v \leftarrow \vert v \vert - \vert u \vert$ \\ -\hspace{3mm}8.3 While $v.used > 0$ and $v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{6mm}8.3.1 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -9. $c \leftarrow u \cdot 2^k$ \\ -10. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_gcd} -\end{figure} -\textbf{Algorithm mp\_gcd.} -This algorithm will produce the greatest common divisor of two mp\_ints $a$ and $b$. The algorithm was originally based on Algorithm B of -Knuth \cite[pp. 338]{TAOCPV2} but has been modified to be simpler to explain. In theory it achieves the same asymptotic working time as -Algorithm B and in practice this appears to be true. - -The first two steps handle the cases where either one of or both inputs are zero. If either input is zero the greatest common divisor is the -largest input or zero if they are both zero. If the inputs are not trivial than $u$ and $v$ are assigned the absolute values of -$a$ and $b$ respectively and the algorithm will proceed to reduce the pair. - -Step five will divide out any common factors of two and keep track of the count in the variable $k$. After this step, two is no longer a -factor of the remaining greatest common divisor between $u$ and $v$ and can be safely evenly divided out of either whenever they are even. Step -six and seven ensure that the $u$ and $v$ respectively have no more factors of two. At most only one of the while--loops will iterate since -they cannot both be even. - -By step eight both of $u$ and $v$ are odd which is required for the inner logic. First the pair are swapped such that $v$ is equal to -or greater than $u$. This ensures that the subtraction on step 8.2 will always produce a positive and even result. Step 8.3 removes any -factors of two from the difference $u$ to ensure that in the next iteration of the loop both are once again odd. - -After $v = 0$ occurs the variable $u$ has the greatest common divisor of the pair $\left < u, v \right >$ just after step six. The result -must be adjusted by multiplying by the common factors of two ($2^k$) removed earlier. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_gcd.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* Greatest Common Divisor using the binary method */ -018 int mp_gcd (mp_int * a, mp_int * b, mp_int * c) -019 \{ -020 mp_int u, v; -021 int k, u_lsb, v_lsb, res; -022 -023 /* either zero than gcd is the largest */ -024 if (mp_iszero (a) == MP_YES) \{ -025 return mp_abs (b, c); -026 \} -027 if (mp_iszero (b) == MP_YES) \{ -028 return mp_abs (a, c); -029 \} -030 -031 /* get copies of a and b we can modify */ -032 if ((res = mp_init_copy (&u, a)) != MP_OKAY) \{ -033 return res; -034 \} -035 -036 if ((res = mp_init_copy (&v, b)) != MP_OKAY) \{ -037 goto LBL_U; -038 \} -039 -040 /* must be positive for the remainder of the algorithm */ -041 u.sign = v.sign = MP_ZPOS; -042 -043 /* B1. Find the common power of two for u and v */ -044 u_lsb = mp_cnt_lsb(&u); -045 v_lsb = mp_cnt_lsb(&v); -046 k = MIN(u_lsb, v_lsb); -047 -048 if (k > 0) \{ -049 /* divide the power of two out */ -050 if ((res = mp_div_2d(&u, k, &u, NULL)) != MP_OKAY) \{ -051 goto LBL_V; -052 \} -053 -054 if ((res = mp_div_2d(&v, k, &v, NULL)) != MP_OKAY) \{ -055 goto LBL_V; -056 \} -057 \} -058 -059 /* divide any remaining factors of two out */ -060 if (u_lsb != k) \{ -061 if ((res = mp_div_2d(&u, u_lsb - k, &u, NULL)) != MP_OKAY) \{ -062 goto LBL_V; -063 \} -064 \} -065 -066 if (v_lsb != k) \{ -067 if ((res = mp_div_2d(&v, v_lsb - k, &v, NULL)) != MP_OKAY) \{ -068 goto LBL_V; -069 \} -070 \} -071 -072 while (mp_iszero(&v) == MP_NO) \{ -073 /* make sure v is the largest */ -074 if (mp_cmp_mag(&u, &v) == MP_GT) \{ -075 /* swap u and v to make sure v is >= u */ -076 mp_exch(&u, &v); -077 \} -078 -079 /* subtract smallest from largest */ -080 if ((res = s_mp_sub(&v, &u, &v)) != MP_OKAY) \{ -081 goto LBL_V; -082 \} -083 -084 /* Divide out all factors of two */ -085 if ((res = mp_div_2d(&v, mp_cnt_lsb(&v), &v, NULL)) != MP_OKAY) \{ -086 goto LBL_V; -087 \} -088 \} -089 -090 /* multiply by 2**k which we divided out at the beginning */ -091 if ((res = mp_mul_2d (&u, k, c)) != MP_OKAY) \{ -092 goto LBL_V; -093 \} -094 c->sign = MP_ZPOS; -095 res = MP_OKAY; -096 LBL_V:mp_clear (&u); -097 LBL_U:mp_clear (&v); -098 return res; -099 \} -100 #endif -101 -\end{alltt} -\end{small} - -This function makes use of the macros mp\_iszero and mp\_iseven. The former evaluates to $1$ if the input mp\_int is equivalent to the -integer zero otherwise it evaluates to $0$. The latter evaluates to $1$ if the input mp\_int represents a non-zero even integer otherwise -it evaluates to $0$. Note that just because mp\_iseven may evaluate to $0$ does not mean the input is odd, it could also be zero. The three -trivial cases of inputs are handled on lines 23 through 29. After those lines the inputs are assumed to be non-zero. - -Lines 32 and 36 make local copies $u$ and $v$ of the inputs $a$ and $b$ respectively. At this point the common factors of two -must be divided out of the two inputs. The block starting at line 43 removes common factors of two by first counting the number of trailing -zero bits in both. The local integer $k$ is used to keep track of how many factors of $2$ are pulled out of both values. It is assumed that -the number of factors will not exceed the maximum value of a C ``int'' data type\footnote{Strictly speaking no array in C may have more than -entries than are accessible by an ``int'' so this is not a limitation.}. - -At this point there are no more common factors of two in the two values. The divisions by a power of two on lines 61 and 67 remove -any independent factors of two such that both $u$ and $v$ are guaranteed to be an odd integer before hitting the main body of the algorithm. The while loop -on line 72 performs the reduction of the pair until $v$ is equal to zero. The unsigned comparison and subtraction algorithms are used in -place of the full signed routines since both values are guaranteed to be positive and the result of the subtraction is guaranteed to be non-negative. - -\section{Least Common Multiple} -The least common multiple of a pair of integers is their product divided by their greatest common divisor. For two integers $a$ and $b$ the -least common multiple is normally denoted as $[ a, b ]$ and numerically equivalent to ${ab} \over {(a, b)}$. For example, if $a = 2 \cdot 2 \cdot 3 = 12$ -and $b = 2 \cdot 3 \cdot 3 \cdot 7 = 126$ the least common multiple is ${126 \over {(12, 126)}} = {126 \over 6} = 21$. - -The least common multiple arises often in coding theory as well as number theory. If two functions have periods of $a$ and $b$ respectively they will -collide, that is be in synchronous states, after only $[ a, b ]$ iterations. This is why, for example, random number generators based on -Linear Feedback Shift Registers (LFSR) tend to use registers with periods which are co-prime (\textit{e.g. the greatest common divisor is one.}). -Similarly in number theory if a composite $n$ has two prime factors $p$ and $q$ then maximal order of any unit of $\Z/n\Z$ will be $[ p - 1, q - 1] $. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_lcm}. \\ -\textbf{Input}. mp\_int $a$ and $b$ \\ -\textbf{Output}. The least common multiple $c = [a, b]$. \\ -\hline \\ -1. $c \leftarrow (a, b)$ \\ -2. $t \leftarrow a \cdot b$ \\ -3. $c \leftarrow \lfloor t / c \rfloor$ \\ -4. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_lcm} -\end{figure} -\textbf{Algorithm mp\_lcm.} -This algorithm computes the least common multiple of two mp\_int inputs $a$ and $b$. It computes the least common multiple directly by -dividing the product of the two inputs by their greatest common divisor. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_lcm.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* computes least common multiple as |a*b|/(a, b) */ -018 int mp_lcm (mp_int * a, mp_int * b, mp_int * c) -019 \{ -020 int res; -021 mp_int t1, t2; -022 -023 -024 if ((res = mp_init_multi (&t1, &t2, NULL)) != MP_OKAY) \{ -025 return res; -026 \} -027 -028 /* t1 = get the GCD of the two inputs */ -029 if ((res = mp_gcd (a, b, &t1)) != MP_OKAY) \{ -030 goto LBL_T; -031 \} -032 -033 /* divide the smallest by the GCD */ -034 if (mp_cmp_mag(a, b) == MP_LT) \{ -035 /* store quotient in t2 such that t2 * b is the LCM */ -036 if ((res = mp_div(a, &t1, &t2, NULL)) != MP_OKAY) \{ -037 goto LBL_T; -038 \} -039 res = mp_mul(b, &t2, c); -040 \} else \{ -041 /* store quotient in t2 such that t2 * a is the LCM */ -042 if ((res = mp_div(b, &t1, &t2, NULL)) != MP_OKAY) \{ -043 goto LBL_T; -044 \} -045 res = mp_mul(a, &t2, c); -046 \} -047 -048 /* fix the sign to positive */ -049 c->sign = MP_ZPOS; -050 -051 LBL_T: -052 mp_clear_multi (&t1, &t2, NULL); -053 return res; -054 \} -055 #endif -056 -\end{alltt} -\end{small} - -\section{Jacobi Symbol Computation} -To explain the Jacobi Symbol we shall first discuss the Legendre function\footnote{Arrg. What is the name of this?} off which the Jacobi symbol is -defined. The Legendre function computes whether or not an integer $a$ is a quadratic residue modulo an odd prime $p$. Numerically it is -equivalent to equation \ref{eqn:legendre}. - -\textit{-- Tom, don't be an ass, cite your source here...!} - -\begin{equation} -a^{(p-1)/2} \equiv \begin{array}{rl} - -1 & \mbox{if }a\mbox{ is a quadratic non-residue.} \\ - 0 & \mbox{if }a\mbox{ divides }p\mbox{.} \\ - 1 & \mbox{if }a\mbox{ is a quadratic residue}. - \end{array} \mbox{ (mod }p\mbox{)} -\label{eqn:legendre} -\end{equation} - -\textbf{Proof.} \textit{Equation \ref{eqn:legendre} correctly identifies the residue status of an integer $a$ modulo a prime $p$.} -An integer $a$ is a quadratic residue if the following equation has a solution. - -\begin{equation} -x^2 \equiv a \mbox{ (mod }p\mbox{)} -\label{eqn:root} -\end{equation} - -Consider the following equation. - -\begin{equation} -0 \equiv x^{p-1} - 1 \equiv \left \lbrace \left (x^2 \right )^{(p-1)/2} - a^{(p-1)/2} \right \rbrace + \left ( a^{(p-1)/2} - 1 \right ) \mbox{ (mod }p\mbox{)} -\label{eqn:rooti} -\end{equation} - -Whether equation \ref{eqn:root} has a solution or not equation \ref{eqn:rooti} is always true. If $a^{(p-1)/2} - 1 \equiv 0 \mbox{ (mod }p\mbox{)}$ -then the quantity in the braces must be zero. By reduction, - -\begin{eqnarray} -\left (x^2 \right )^{(p-1)/2} - a^{(p-1)/2} \equiv 0 \nonumber \\ -\left (x^2 \right )^{(p-1)/2} \equiv a^{(p-1)/2} \nonumber \\ -x^2 \equiv a \mbox{ (mod }p\mbox{)} -\end{eqnarray} - -As a result there must be a solution to the quadratic equation and in turn $a$ must be a quadratic residue. If $a$ does not divide $p$ and $a$ -is not a quadratic residue then the only other value $a^{(p-1)/2}$ may be congruent to is $-1$ since -\begin{equation} -0 \equiv a^{p - 1} - 1 \equiv (a^{(p-1)/2} + 1)(a^{(p-1)/2} - 1) \mbox{ (mod }p\mbox{)} -\end{equation} -One of the terms on the right hand side must be zero. \textbf{QED} - -\subsection{Jacobi Symbol} -The Jacobi symbol is a generalization of the Legendre function for any odd non prime moduli $p$ greater than 2. If $p = \prod_{i=0}^n p_i$ then -the Jacobi symbol $\left ( { a \over p } \right )$ is equal to the following equation. - -\begin{equation} -\left ( { a \over p } \right ) = \left ( { a \over p_0} \right ) \left ( { a \over p_1} \right ) \ldots \left ( { a \over p_n} \right ) -\end{equation} - -By inspection if $p$ is prime the Jacobi symbol is equivalent to the Legendre function. The following facts\footnote{See HAC \cite[pp. 72-74]{HAC} for -further details.} will be used to derive an efficient Jacobi symbol algorithm. Where $p$ is an odd integer greater than two and $a, b \in \Z$ the -following are true. - -\begin{enumerate} -\item $\left ( { a \over p} \right )$ equals $-1$, $0$ or $1$. -\item $\left ( { ab \over p} \right ) = \left ( { a \over p} \right )\left ( { b \over p} \right )$. -\item If $a \equiv b$ then $\left ( { a \over p} \right ) = \left ( { b \over p} \right )$. -\item $\left ( { 2 \over p} \right )$ equals $1$ if $p \equiv 1$ or $7 \mbox{ (mod }8\mbox{)}$. Otherwise, it equals $-1$. -\item $\left ( { a \over p} \right ) \equiv \left ( { p \over a} \right ) \cdot (-1)^{(p-1)(a-1)/4}$. More specifically -$\left ( { a \over p} \right ) = \left ( { p \over a} \right )$ if $p \equiv a \equiv 1 \mbox{ (mod }4\mbox{)}$. -\end{enumerate} - -Using these facts if $a = 2^k \cdot a'$ then - -\begin{eqnarray} -\left ( { a \over p } \right ) = \left ( {{2^k} \over p } \right ) \left ( {a' \over p} \right ) \nonumber \\ - = \left ( {2 \over p } \right )^k \left ( {a' \over p} \right ) -\label{eqn:jacobi} -\end{eqnarray} - -By fact five, - -\begin{equation} -\left ( { a \over p } \right ) = \left ( { p \over a } \right ) \cdot (-1)^{(p-1)(a-1)/4} -\end{equation} - -Subsequently by fact three since $p \equiv (p \mbox{ mod }a) \mbox{ (mod }a\mbox{)}$ then - -\begin{equation} -\left ( { a \over p } \right ) = \left ( { {p \mbox{ mod } a} \over a } \right ) \cdot (-1)^{(p-1)(a-1)/4} -\end{equation} - -By putting both observations into equation \ref{eqn:jacobi} the following simplified equation is formed. - -\begin{equation} -\left ( { a \over p } \right ) = \left ( {2 \over p } \right )^k \left ( {{p\mbox{ mod }a'} \over a'} \right ) \cdot (-1)^{(p-1)(a'-1)/4} -\end{equation} - -The value of $\left ( {{p \mbox{ mod }a'} \over a'} \right )$ can be found by using the same equation recursively. The value of -$\left ( {2 \over p } \right )^k$ equals $1$ if $k$ is even otherwise it equals $\left ( {2 \over p } \right )$. Using this approach the -factors of $p$ do not have to be known. Furthermore, if $(a, p) = 1$ then the algorithm will terminate when the recursion requests the -Jacobi symbol computation of $\left ( {1 \over a'} \right )$ which is simply $1$. - -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_jacobi}. \\ -\textbf{Input}. mp\_int $a$ and $p$, $a \ge 0$, $p \ge 3$, $p \equiv 1 \mbox{ (mod }2\mbox{)}$ \\ -\textbf{Output}. The Jacobi symbol $c = \left ( {a \over p } \right )$. \\ -\hline \\ -1. If $a = 0$ then \\ -\hspace{3mm}1.1 $c \leftarrow 0$ \\ -\hspace{3mm}1.2 Return(\textit{MP\_OKAY}). \\ -2. If $a = 1$ then \\ -\hspace{3mm}2.1 $c \leftarrow 1$ \\ -\hspace{3mm}2.2 Return(\textit{MP\_OKAY}). \\ -3. $a' \leftarrow a$ \\ -4. $k \leftarrow 0$ \\ -5. While $a'.used > 0$ and $a'_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}5.1 $k \leftarrow k + 1$ \\ -\hspace{3mm}5.2 $a' \leftarrow \lfloor a' / 2 \rfloor$ \\ -6. If $k \equiv 0 \mbox{ (mod }2\mbox{)}$ then \\ -\hspace{3mm}6.1 $s \leftarrow 1$ \\ -7. else \\ -\hspace{3mm}7.1 $r \leftarrow p_0 \mbox{ (mod }8\mbox{)}$ \\ -\hspace{3mm}7.2 If $r = 1$ or $r = 7$ then \\ -\hspace{6mm}7.2.1 $s \leftarrow 1$ \\ -\hspace{3mm}7.3 else \\ -\hspace{6mm}7.3.1 $s \leftarrow -1$ \\ -8. If $p_0 \equiv a'_0 \equiv 3 \mbox{ (mod }4\mbox{)}$ then \\ -\hspace{3mm}8.1 $s \leftarrow -s$ \\ -9. If $a' \ne 1$ then \\ -\hspace{3mm}9.1 $p' \leftarrow p \mbox{ (mod }a'\mbox{)}$ \\ -\hspace{3mm}9.2 $s \leftarrow s \cdot \mbox{mp\_jacobi}(p', a')$ \\ -10. $c \leftarrow s$ \\ -11. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_jacobi} -\end{figure} -\textbf{Algorithm mp\_jacobi.} -This algorithm computes the Jacobi symbol for an arbitrary positive integer $a$ with respect to an odd integer $p$ greater than three. The algorithm -is based on algorithm 2.149 of HAC \cite[pp. 73]{HAC}. - -Step numbers one and two handle the trivial cases of $a = 0$ and $a = 1$ respectively. Step five determines the number of two factors in the -input $a$. If $k$ is even than the term $\left ( { 2 \over p } \right )^k$ must always evaluate to one. If $k$ is odd than the term evaluates to one -if $p_0$ is congruent to one or seven modulo eight, otherwise it evaluates to $-1$. After the the $\left ( { 2 \over p } \right )^k$ term is handled -the $(-1)^{(p-1)(a'-1)/4}$ is computed and multiplied against the current product $s$. The latter term evaluates to one if both $p$ and $a'$ -are congruent to one modulo four, otherwise it evaluates to negative one. - -By step nine if $a'$ does not equal one a recursion is required. Step 9.1 computes $p' \equiv p \mbox{ (mod }a'\mbox{)}$ and will recurse to compute -$\left ( {p' \over a'} \right )$ which is multiplied against the current Jacobi product. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_jacobi.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* computes the jacobi c = (a | n) (or Legendre if n is prime) -018 * HAC pp. 73 Algorithm 2.149 -019 * HAC is wrong here, as the special case of (0 | 1) is not -020 * handled correctly. -021 */ -022 int mp_jacobi (mp_int * a, mp_int * n, int *c) -023 \{ -024 mp_int a1, p1; -025 int k, s, r, res; -026 mp_digit residue; -027 -028 /* if a < 0 return MP_VAL */ -029 if (mp_isneg(a) == MP_YES) \{ -030 return MP_VAL; -031 \} -032 -033 /* if n <= 0 return MP_VAL */ -034 if (mp_cmp_d(n, 0) != MP_GT) \{ -035 return MP_VAL; -036 \} -037 -038 /* step 1. handle case of a == 0 */ -039 if (mp_iszero (a) == MP_YES) \{ -040 /* special case of a == 0 and n == 1 */ -041 if (mp_cmp_d (n, 1) == MP_EQ) \{ -042 *c = 1; -043 \} else \{ -044 *c = 0; -045 \} -046 return MP_OKAY; -047 \} -048 -049 /* step 2. if a == 1, return 1 */ -050 if (mp_cmp_d (a, 1) == MP_EQ) \{ -051 *c = 1; -052 return MP_OKAY; -053 \} -054 -055 /* default */ -056 s = 0; -057 -058 /* step 3. write a = a1 * 2**k */ -059 if ((res = mp_init_copy (&a1, a)) != MP_OKAY) \{ -060 return res; -061 \} -062 -063 if ((res = mp_init (&p1)) != MP_OKAY) \{ -064 goto LBL_A1; -065 \} -066 -067 /* divide out larger power of two */ -068 k = mp_cnt_lsb(&a1); -069 if ((res = mp_div_2d(&a1, k, &a1, NULL)) != MP_OKAY) \{ -070 goto LBL_P1; -071 \} -072 -073 /* step 4. if e is even set s=1 */ -074 if ((k & 1) == 0) \{ -075 s = 1; -076 \} else \{ -077 /* else set s=1 if p = 1/7 (mod 8) or s=-1 if p = 3/5 (mod 8) */ -078 residue = n->dp[0] & 7; -079 -080 if ((residue == 1) || (residue == 7)) \{ -081 s = 1; -082 \} else if ((residue == 3) || (residue == 5)) \{ -083 s = -1; -084 \} -085 \} -086 -087 /* step 5. if p == 3 (mod 4) *and* a1 == 3 (mod 4) then s = -s */ -088 if ( ((n->dp[0] & 3) == 3) && ((a1.dp[0] & 3) == 3)) \{ -089 s = -s; -090 \} -091 -092 /* if a1 == 1 we're done */ -093 if (mp_cmp_d (&a1, 1) == MP_EQ) \{ -094 *c = s; -095 \} else \{ -096 /* n1 = n mod a1 */ -097 if ((res = mp_mod (n, &a1, &p1)) != MP_OKAY) \{ -098 goto LBL_P1; -099 \} -100 if ((res = mp_jacobi (&p1, &a1, &r)) != MP_OKAY) \{ -101 goto LBL_P1; -102 \} -103 *c = s * r; -104 \} -105 -106 /* done */ -107 res = MP_OKAY; -108 LBL_P1:mp_clear (&p1); -109 LBL_A1:mp_clear (&a1); -110 return res; -111 \} -112 #endif -113 -\end{alltt} -\end{small} - -As a matter of practicality the variable $a'$ as per the pseudo-code is reprensented by the variable $a1$ since the $'$ symbol is not valid for a C -variable name character. - -The two simple cases of $a = 0$ and $a = 1$ are handled at the very beginning to simplify the algorithm. If the input is non-trivial the algorithm -has to proceed compute the Jacobi. The variable $s$ is used to hold the current Jacobi product. Note that $s$ is merely a C ``int'' data type since -the values it may obtain are merely $-1$, $0$ and $1$. - -After a local copy of $a$ is made all of the factors of two are divided out and the total stored in $k$. Technically only the least significant -bit of $k$ is required, however, it makes the algorithm simpler to follow to perform an addition. In practice an exclusive-or and addition have the same -processor requirements and neither is faster than the other. - -Line 59 through 71 determines the value of $\left ( { 2 \over p } \right )^k$. If the least significant bit of $k$ is zero than -$k$ is even and the value is one. Otherwise, the value of $s$ depends on which residue class $p$ belongs to modulo eight. The value of -$(-1)^{(p-1)(a'-1)/4}$ is compute and multiplied against $s$ on lines 73 through 76. - -Finally, if $a1$ does not equal one the algorithm must recurse and compute $\left ( {p' \over a'} \right )$. - -\textit{-- Comment about default $s$ and such...} - -\section{Modular Inverse} -\label{sec:modinv} -The modular inverse of a number actually refers to the modular multiplicative inverse. Essentially for any integer $a$ such that $(a, p) = 1$ there -exist another integer $b$ such that $ab \equiv 1 \mbox{ (mod }p\mbox{)}$. The integer $b$ is called the multiplicative inverse of $a$ which is -denoted as $b = a^{-1}$. Technically speaking modular inversion is a well defined operation for any finite ring or field not just for rings and -fields of integers. However, the former will be the matter of discussion. - -The simplest approach is to compute the algebraic inverse of the input. That is to compute $b \equiv a^{\Phi(p) - 1}$. If $\Phi(p)$ is the -order of the multiplicative subgroup modulo $p$ then $b$ must be the multiplicative inverse of $a$. The proof of which is trivial. - -\begin{equation} -ab \equiv a \left (a^{\Phi(p) - 1} \right ) \equiv a^{\Phi(p)} \equiv a^0 \equiv 1 \mbox{ (mod }p\mbox{)} -\end{equation} - -However, as simple as this approach may be it has two serious flaws. It requires that the value of $\Phi(p)$ be known which if $p$ is composite -requires all of the prime factors. This approach also is very slow as the size of $p$ grows. - -A simpler approach is based on the observation that solving for the multiplicative inverse is equivalent to solving the linear -Diophantine\footnote{See LeVeque \cite[pp. 40-43]{LeVeque} for more information.} equation. - -\begin{equation} -ab + pq = 1 -\end{equation} - -Where $a$, $b$, $p$ and $q$ are all integers. If such a pair of integers $ \left < b, q \right >$ exist than $b$ is the multiplicative inverse of -$a$ modulo $p$. The extended Euclidean algorithm (Knuth \cite[pp. 342]{TAOCPV2}) can be used to solve such equations provided $(a, p) = 1$. -However, instead of using that algorithm directly a variant known as the binary Extended Euclidean algorithm will be used in its place. The -binary approach is very similar to the binary greatest common divisor algorithm except it will produce a full solution to the Diophantine -equation. - -\subsection{General Case} -\newpage\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_invmod}. \\ -\textbf{Input}. mp\_int $a$ and $b$, $(a, b) = 1$, $p \ge 2$, $0 < a < p$. \\ -\textbf{Output}. The modular inverse $c \equiv a^{-1} \mbox{ (mod }b\mbox{)}$. \\ -\hline \\ -1. If $b \le 0$ then return(\textit{MP\_VAL}). \\ -2. If $b_0 \equiv 1 \mbox{ (mod }2\mbox{)}$ then use algorithm fast\_mp\_invmod. \\ -3. $x \leftarrow \vert a \vert, y \leftarrow b$ \\ -4. If $x_0 \equiv y_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ then return(\textit{MP\_VAL}). \\ -5. $B \leftarrow 0, C \leftarrow 0, A \leftarrow 1, D \leftarrow 1$ \\ -6. While $u.used > 0$ and $u_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}6.1 $u \leftarrow \lfloor u / 2 \rfloor$ \\ -\hspace{3mm}6.2 If ($A.used > 0$ and $A_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) or ($B.used > 0$ and $B_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) then \\ -\hspace{6mm}6.2.1 $A \leftarrow A + y$ \\ -\hspace{6mm}6.2.2 $B \leftarrow B - x$ \\ -\hspace{3mm}6.3 $A \leftarrow \lfloor A / 2 \rfloor$ \\ -\hspace{3mm}6.4 $B \leftarrow \lfloor B / 2 \rfloor$ \\ -7. While $v.used > 0$ and $v_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}7.1 $v \leftarrow \lfloor v / 2 \rfloor$ \\ -\hspace{3mm}7.2 If ($C.used > 0$ and $C_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) or ($D.used > 0$ and $D_0 \equiv 1 \mbox{ (mod }2\mbox{)}$) then \\ -\hspace{6mm}7.2.1 $C \leftarrow C + y$ \\ -\hspace{6mm}7.2.2 $D \leftarrow D - x$ \\ -\hspace{3mm}7.3 $C \leftarrow \lfloor C / 2 \rfloor$ \\ -\hspace{3mm}7.4 $D \leftarrow \lfloor D / 2 \rfloor$ \\ -8. If $u \ge v$ then \\ -\hspace{3mm}8.1 $u \leftarrow u - v$ \\ -\hspace{3mm}8.2 $A \leftarrow A - C$ \\ -\hspace{3mm}8.3 $B \leftarrow B - D$ \\ -9. else \\ -\hspace{3mm}9.1 $v \leftarrow v - u$ \\ -\hspace{3mm}9.2 $C \leftarrow C - A$ \\ -\hspace{3mm}9.3 $D \leftarrow D - B$ \\ -10. If $u \ne 0$ goto step 6. \\ -11. If $v \ne 1$ return(\textit{MP\_VAL}). \\ -12. While $C \le 0$ do \\ -\hspace{3mm}12.1 $C \leftarrow C + b$ \\ -13. While $C \ge b$ do \\ -\hspace{3mm}13.1 $C \leftarrow C - b$ \\ -14. $c \leftarrow C$ \\ -15. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\end{figure} -\textbf{Algorithm mp\_invmod.} -This algorithm computes the modular multiplicative inverse of an integer $a$ modulo an integer $b$. This algorithm is a variation of the -extended binary Euclidean algorithm from HAC \cite[pp. 608]{HAC}. It has been modified to only compute the modular inverse and not a complete -Diophantine solution. - -If $b \le 0$ than the modulus is invalid and MP\_VAL is returned. Similarly if both $a$ and $b$ are even then there cannot be a multiplicative -inverse for $a$ and the error is reported. - -The astute reader will observe that steps seven through nine are very similar to the binary greatest common divisor algorithm mp\_gcd. In this case -the other variables to the Diophantine equation are solved. The algorithm terminates when $u = 0$ in which case the solution is - -\begin{equation} -Ca + Db = v -\end{equation} - -If $v$, the greatest common divisor of $a$ and $b$ is not equal to one then the algorithm will report an error as no inverse exists. Otherwise, $C$ -is the modular inverse of $a$. The actual value of $C$ is congruent to, but not necessarily equal to, the ideal modular inverse which should lie -within $1 \le a^{-1} < b$. Step numbers twelve and thirteen adjust the inverse until it is in range. If the original input $a$ is within $0 < a < p$ -then only a couple of additions or subtractions will be required to adjust the inverse. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_invmod.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* hac 14.61, pp608 */ -018 int mp_invmod (mp_int * a, mp_int * b, mp_int * c) -019 \{ -020 /* b cannot be negative */ -021 if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) \{ -022 return MP_VAL; -023 \} -024 -025 #ifdef BN_FAST_MP_INVMOD_C -026 /* if the modulus is odd we can use a faster routine instead */ -027 if (mp_isodd (b) == MP_YES) \{ -028 return fast_mp_invmod (a, b, c); -029 \} -030 #endif -031 -032 #ifdef BN_MP_INVMOD_SLOW_C -033 return mp_invmod_slow(a, b, c); -034 #else -035 return MP_VAL; -036 #endif -037 \} -038 #endif -039 -\end{alltt} -\end{small} - -\subsubsection{Odd Moduli} - -When the modulus $b$ is odd the variables $A$ and $C$ are fixed and are not required to compute the inverse. In particular by attempting to solve -the Diophantine $Cb + Da = 1$ only $B$ and $D$ are required to find the inverse of $a$. - -The algorithm fast\_mp\_invmod is a direct adaptation of algorithm mp\_invmod with all all steps involving either $A$ or $C$ removed. This -optimization will halve the time required to compute the modular inverse. - -\section{Primality Tests} - -A non-zero integer $a$ is said to be prime if it is not divisible by any other integer excluding one and itself. For example, $a = 7$ is prime -since the integers $2 \ldots 6$ do not evenly divide $a$. By contrast, $a = 6$ is not prime since $a = 6 = 2 \cdot 3$. - -Prime numbers arise in cryptography considerably as they allow finite fields to be formed. The ability to determine whether an integer is prime or -not quickly has been a viable subject in cryptography and number theory for considerable time. The algorithms that will be presented are all -probablistic algorithms in that when they report an integer is composite it must be composite. However, when the algorithms report an integer is -prime the algorithm may be incorrect. - -As will be discussed it is possible to limit the probability of error so well that for practical purposes the probablity of error might as -well be zero. For the purposes of these discussions let $n$ represent the candidate integer of which the primality is in question. - -\subsection{Trial Division} - -Trial division means to attempt to evenly divide a candidate integer by small prime integers. If the candidate can be evenly divided it obviously -cannot be prime. By dividing by all primes $1 < p \le \sqrt{n}$ this test can actually prove whether an integer is prime. However, such a test -would require a prohibitive amount of time as $n$ grows. - -Instead of dividing by every prime, a smaller, more mangeable set of primes may be used instead. By performing trial division with only a subset -of the primes less than $\sqrt{n} + 1$ the algorithm cannot prove if a candidate is prime. However, often it can prove a candidate is not prime. - -The benefit of this test is that trial division by small values is fairly efficient. Specially compared to the other algorithms that will be -discussed shortly. The probability that this approach correctly identifies a composite candidate when tested with all primes upto $q$ is given by -$1 - {1.12 \over ln(q)}$. The graph (\ref{pic:primality}, will be added later) demonstrates the probability of success for the range -$3 \le q \le 100$. - -At approximately $q = 30$ the gain of performing further tests diminishes fairly quickly. At $q = 90$ further testing is generally not going to -be of any practical use. In the case of LibTomMath the default limit $q = 256$ was chosen since it is not too high and will eliminate -approximately $80\%$ of all candidate integers. The constant \textbf{PRIME\_SIZE} is equal to the number of primes in the test base. The -array \_\_prime\_tab is an array of the first \textbf{PRIME\_SIZE} prime numbers. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_prime\_is\_divisible}. \\ -\textbf{Input}. mp\_int $a$ \\ -\textbf{Output}. $c = 1$ if $n$ is divisible by a small prime, otherwise $c = 0$. \\ -\hline \\ -1. for $ix$ from $0$ to $PRIME\_SIZE$ do \\ -\hspace{3mm}1.1 $d \leftarrow n \mbox{ (mod }\_\_prime\_tab_{ix}\mbox{)}$ \\ -\hspace{3mm}1.2 If $d = 0$ then \\ -\hspace{6mm}1.2.1 $c \leftarrow 1$ \\ -\hspace{6mm}1.2.2 Return(\textit{MP\_OKAY}). \\ -2. $c \leftarrow 0$ \\ -3. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_prime\_is\_divisible} -\end{figure} -\textbf{Algorithm mp\_prime\_is\_divisible.} -This algorithm attempts to determine if a candidate integer $n$ is composite by performing trial divisions. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_prime\_is\_divisible.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* determines if an integers is divisible by one -018 * of the first PRIME_SIZE primes or not -019 * -020 * sets result to 0 if not, 1 if yes -021 */ -022 int mp_prime_is_divisible (mp_int * a, int *result) -023 \{ -024 int err, ix; -025 mp_digit res; -026 -027 /* default to not */ -028 *result = MP_NO; -029 -030 for (ix = 0; ix < PRIME_SIZE; ix++) \{ -031 /* what is a mod LBL_prime_tab[ix] */ -032 if ((err = mp_mod_d (a, ltm_prime_tab[ix], &res)) != MP_OKAY) \{ -033 return err; -034 \} -035 -036 /* is the residue zero? */ -037 if (res == 0) \{ -038 *result = MP_YES; -039 return MP_OKAY; -040 \} -041 \} -042 -043 return MP_OKAY; -044 \} -045 #endif -046 -\end{alltt} -\end{small} - -The algorithm defaults to a return of $0$ in case an error occurs. The values in the prime table are all specified to be in the range of a -mp\_digit. The table \_\_prime\_tab is defined in the following file. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_prime\_tab.c -\vspace{-3mm} -\begin{alltt} -016 const mp_digit ltm_prime_tab[] = \{ -017 0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013, -018 0x0017, 0x001D, 0x001F, 0x0025, 0x0029, 0x002B, 0x002F, 0x0035, -019 0x003B, 0x003D, 0x0043, 0x0047, 0x0049, 0x004F, 0x0053, 0x0059, -020 0x0061, 0x0065, 0x0067, 0x006B, 0x006D, 0x0071, 0x007F, -021 #ifndef MP_8BIT -022 0x0083, -023 0x0089, 0x008B, 0x0095, 0x0097, 0x009D, 0x00A3, 0x00A7, 0x00AD, -024 0x00B3, 0x00B5, 0x00BF, 0x00C1, 0x00C5, 0x00C7, 0x00D3, 0x00DF, -025 0x00E3, 0x00E5, 0x00E9, 0x00EF, 0x00F1, 0x00FB, 0x0101, 0x0107, -026 0x010D, 0x010F, 0x0115, 0x0119, 0x011B, 0x0125, 0x0133, 0x0137, -027 -028 0x0139, 0x013D, 0x014B, 0x0151, 0x015B, 0x015D, 0x0161, 0x0167, -029 0x016F, 0x0175, 0x017B, 0x017F, 0x0185, 0x018D, 0x0191, 0x0199, -030 0x01A3, 0x01A5, 0x01AF, 0x01B1, 0x01B7, 0x01BB, 0x01C1, 0x01C9, -031 0x01CD, 0x01CF, 0x01D3, 0x01DF, 0x01E7, 0x01EB, 0x01F3, 0x01F7, -032 0x01FD, 0x0209, 0x020B, 0x021D, 0x0223, 0x022D, 0x0233, 0x0239, -033 0x023B, 0x0241, 0x024B, 0x0251, 0x0257, 0x0259, 0x025F, 0x0265, -034 0x0269, 0x026B, 0x0277, 0x0281, 0x0283, 0x0287, 0x028D, 0x0293, -035 0x0295, 0x02A1, 0x02A5, 0x02AB, 0x02B3, 0x02BD, 0x02C5, 0x02CF, -036 -037 0x02D7, 0x02DD, 0x02E3, 0x02E7, 0x02EF, 0x02F5, 0x02F9, 0x0301, -038 0x0305, 0x0313, 0x031D, 0x0329, 0x032B, 0x0335, 0x0337, 0x033B, -039 0x033D, 0x0347, 0x0355, 0x0359, 0x035B, 0x035F, 0x036D, 0x0371, -040 0x0373, 0x0377, 0x038B, 0x038F, 0x0397, 0x03A1, 0x03A9, 0x03AD, -041 0x03B3, 0x03B9, 0x03C7, 0x03CB, 0x03D1, 0x03D7, 0x03DF, 0x03E5, -042 0x03F1, 0x03F5, 0x03FB, 0x03FD, 0x0407, 0x0409, 0x040F, 0x0419, -043 0x041B, 0x0425, 0x0427, 0x042D, 0x043F, 0x0443, 0x0445, 0x0449, -044 0x044F, 0x0455, 0x045D, 0x0463, 0x0469, 0x047F, 0x0481, 0x048B, -045 -046 0x0493, 0x049D, 0x04A3, 0x04A9, 0x04B1, 0x04BD, 0x04C1, 0x04C7, -047 0x04CD, 0x04CF, 0x04D5, 0x04E1, 0x04EB, 0x04FD, 0x04FF, 0x0503, -048 0x0509, 0x050B, 0x0511, 0x0515, 0x0517, 0x051B, 0x0527, 0x0529, -049 0x052F, 0x0551, 0x0557, 0x055D, 0x0565, 0x0577, 0x0581, 0x058F, -050 0x0593, 0x0595, 0x0599, 0x059F, 0x05A7, 0x05AB, 0x05AD, 0x05B3, -051 0x05BF, 0x05C9, 0x05CB, 0x05CF, 0x05D1, 0x05D5, 0x05DB, 0x05E7, -052 0x05F3, 0x05FB, 0x0607, 0x060D, 0x0611, 0x0617, 0x061F, 0x0623, -053 0x062B, 0x062F, 0x063D, 0x0641, 0x0647, 0x0649, 0x064D, 0x0653 -054 #endif -055 \}; -056 #endif -057 -\end{alltt} -\end{small} - -Note that there are two possible tables. When an mp\_digit is 7-bits long only the primes upto $127$ may be included, otherwise the primes -upto $1619$ are used. Note that the value of \textbf{PRIME\_SIZE} is a constant dependent on the size of a mp\_digit. - -\subsection{The Fermat Test} -The Fermat test is probably one the oldest tests to have a non-trivial probability of success. It is based on the fact that if $n$ is in -fact prime then $a^{n} \equiv a \mbox{ (mod }n\mbox{)}$ for all $0 < a < n$. The reason being that if $n$ is prime than the order of -the multiplicative sub group is $n - 1$. Any base $a$ must have an order which divides $n - 1$ and as such $a^n$ is equivalent to -$a^1 = a$. - -If $n$ is composite then any given base $a$ does not have to have a period which divides $n - 1$. In which case -it is possible that $a^n \nequiv a \mbox{ (mod }n\mbox{)}$. However, this test is not absolute as it is possible that the order -of a base will divide $n - 1$ which would then be reported as prime. Such a base yields what is known as a Fermat pseudo-prime. Several -integers known as Carmichael numbers will be a pseudo-prime to all valid bases. Fortunately such numbers are extremely rare as $n$ grows -in size. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_prime\_fermat}. \\ -\textbf{Input}. mp\_int $a$ and $b$, $a \ge 2$, $0 < b < a$. \\ -\textbf{Output}. $c = 1$ if $b^a \equiv b \mbox{ (mod }a\mbox{)}$, otherwise $c = 0$. \\ -\hline \\ -1. $t \leftarrow b^a \mbox{ (mod }a\mbox{)}$ \\ -2. If $t = b$ then \\ -\hspace{3mm}2.1 $c = 1$ \\ -3. else \\ -\hspace{3mm}3.1 $c = 0$ \\ -4. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_prime\_fermat} -\end{figure} -\textbf{Algorithm mp\_prime\_fermat.} -This algorithm determines whether an mp\_int $a$ is a Fermat prime to the base $b$ or not. It uses a single modular exponentiation to -determine the result. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_prime\_fermat.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* performs one Fermat test. -018 * -019 * If "a" were prime then b**a == b (mod a) since the order of -020 * the multiplicative sub-group would be phi(a) = a-1. That means -021 * it would be the same as b**(a mod (a-1)) == b**1 == b (mod a). -022 * -023 * Sets result to 1 if the congruence holds, or zero otherwise. -024 */ -025 int mp_prime_fermat (mp_int * a, mp_int * b, int *result) -026 \{ -027 mp_int t; -028 int err; -029 -030 /* default to composite */ -031 *result = MP_NO; -032 -033 /* ensure b > 1 */ -034 if (mp_cmp_d(b, 1) != MP_GT) \{ -035 return MP_VAL; -036 \} -037 -038 /* init t */ -039 if ((err = mp_init (&t)) != MP_OKAY) \{ -040 return err; -041 \} -042 -043 /* compute t = b**a mod a */ -044 if ((err = mp_exptmod (b, a, a, &t)) != MP_OKAY) \{ -045 goto LBL_T; -046 \} -047 -048 /* is it equal to b? */ -049 if (mp_cmp (&t, b) == MP_EQ) \{ -050 *result = MP_YES; -051 \} -052 -053 err = MP_OKAY; -054 LBL_T:mp_clear (&t); -055 return err; -056 \} -057 #endif -058 -\end{alltt} -\end{small} - -\subsection{The Miller-Rabin Test} -The Miller-Rabin (citation) test is another primality test which has tighter error bounds than the Fermat test specifically with sequentially chosen -candidate integers. The algorithm is based on the observation that if $n - 1 = 2^kr$ and if $b^r \nequiv \pm 1$ then after upto $k - 1$ squarings the -value must be equal to $-1$. The squarings are stopped as soon as $-1$ is observed. If the value of $1$ is observed first it means that -some value not congruent to $\pm 1$ when squared equals one which cannot occur if $n$ is prime. - -\begin{figure}[!here] -\begin{small} -\begin{center} -\begin{tabular}{l} -\hline Algorithm \textbf{mp\_prime\_miller\_rabin}. \\ -\textbf{Input}. mp\_int $a$ and $b$, $a \ge 2$, $0 < b < a$. \\ -\textbf{Output}. $c = 1$ if $a$ is a Miller-Rabin prime to the base $a$, otherwise $c = 0$. \\ -\hline -1. $a' \leftarrow a - 1$ \\ -2. $r \leftarrow n1$ \\ -3. $c \leftarrow 0, s \leftarrow 0$ \\ -4. While $r.used > 0$ and $r_0 \equiv 0 \mbox{ (mod }2\mbox{)}$ \\ -\hspace{3mm}4.1 $s \leftarrow s + 1$ \\ -\hspace{3mm}4.2 $r \leftarrow \lfloor r / 2 \rfloor$ \\ -5. $y \leftarrow b^r \mbox{ (mod }a\mbox{)}$ \\ -6. If $y \nequiv \pm 1$ then \\ -\hspace{3mm}6.1 $j \leftarrow 1$ \\ -\hspace{3mm}6.2 While $j \le (s - 1)$ and $y \nequiv a'$ \\ -\hspace{6mm}6.2.1 $y \leftarrow y^2 \mbox{ (mod }a\mbox{)}$ \\ -\hspace{6mm}6.2.2 If $y = 1$ then goto step 8. \\ -\hspace{6mm}6.2.3 $j \leftarrow j + 1$ \\ -\hspace{3mm}6.3 If $y \nequiv a'$ goto step 8. \\ -7. $c \leftarrow 1$\\ -8. Return(\textit{MP\_OKAY}). \\ -\hline -\end{tabular} -\end{center} -\end{small} -\caption{Algorithm mp\_prime\_miller\_rabin} -\end{figure} -\textbf{Algorithm mp\_prime\_miller\_rabin.} -This algorithm performs one trial round of the Miller-Rabin algorithm to the base $b$. It will set $c = 1$ if the algorithm cannot determine -if $b$ is composite or $c = 0$ if $b$ is provably composite. The values of $s$ and $r$ are computed such that $a' = a - 1 = 2^sr$. - -If the value $y \equiv b^r$ is congruent to $\pm 1$ then the algorithm cannot prove if $a$ is composite or not. Otherwise, the algorithm will -square $y$ upto $s - 1$ times stopping only when $y \equiv -1$. If $y^2 \equiv 1$ and $y \nequiv \pm 1$ then the algorithm can report that $a$ -is provably composite. If the algorithm performs $s - 1$ squarings and $y \nequiv -1$ then $a$ is provably composite. If $a$ is not provably -composite then it is \textit{probably} prime. - -\vspace{+3mm}\begin{small} -\hspace{-5.1mm}{\bf File}: bn\_mp\_prime\_miller\_rabin.c -\vspace{-3mm} -\begin{alltt} -016 -017 /* Miller-Rabin test of "a" to the base of "b" as described in -018 * HAC pp. 139 Algorithm 4.24 -019 * -020 * Sets result to 0 if definitely composite or 1 if probably prime. -021 * Randomly the chance of error is no more than 1/4 and often -022 * very much lower. -023 */ -024 int mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result) -025 \{ -026 mp_int n1, y, r; -027 int s, j, err; -028 -029 /* default */ -030 *result = MP_NO; -031 -032 /* ensure b > 1 */ -033 if (mp_cmp_d(b, 1) != MP_GT) \{ -034 return MP_VAL; -035 \} -036 -037 /* get n1 = a - 1 */ -038 if ((err = mp_init_copy (&n1, a)) != MP_OKAY) \{ -039 return err; -040 \} -041 if ((err = mp_sub_d (&n1, 1, &n1)) != MP_OKAY) \{ -042 goto LBL_N1; -043 \} -044 -045 /* set 2**s * r = n1 */ -046 if ((err = mp_init_copy (&r, &n1)) != MP_OKAY) \{ -047 goto LBL_N1; -048 \} -049 -050 /* count the number of least significant bits -051 * which are zero -052 */ -053 s = mp_cnt_lsb(&r); -054 -055 /* now divide n - 1 by 2**s */ -056 if ((err = mp_div_2d (&r, s, &r, NULL)) != MP_OKAY) \{ -057 goto LBL_R; -058 \} -059 -060 /* compute y = b**r mod a */ -061 if ((err = mp_init (&y)) != MP_OKAY) \{ -062 goto LBL_R; -063 \} -064 if ((err = mp_exptmod (b, &r, a, &y)) != MP_OKAY) \{ -065 goto LBL_Y; -066 \} -067 -068 /* if y != 1 and y != n1 do */ -069 if ((mp_cmp_d (&y, 1) != MP_EQ) && (mp_cmp (&y, &n1) != MP_EQ)) \{ -070 j = 1; -071 /* while j <= s-1 and y != n1 */ -072 while ((j <= (s - 1)) && (mp_cmp (&y, &n1) != MP_EQ)) \{ -073 if ((err = mp_sqrmod (&y, a, &y)) != MP_OKAY) \{ -074 goto LBL_Y; -075 \} -076 -077 /* if y == 1 then composite */ -078 if (mp_cmp_d (&y, 1) == MP_EQ) \{ -079 goto LBL_Y; -080 \} -081 -082 ++j; -083 \} -084 -085 /* if y != n1 then composite */ -086 if (mp_cmp (&y, &n1) != MP_EQ) \{ -087 goto LBL_Y; -088 \} -089 \} -090 -091 /* probably prime now */ -092 *result = MP_YES; -093 LBL_Y:mp_clear (&y); -094 LBL_R:mp_clear (&r); -095 LBL_N1:mp_clear (&n1); -096 return err; -097 \} -098 #endif -099 -\end{alltt} -\end{small} - - - - -\backmatter -\appendix -\begin{thebibliography}{ABCDEF} -\bibitem[1]{TAOCPV2} -Donald Knuth, \textit{The Art of Computer Programming}, Third Edition, Volume Two, Seminumerical Algorithms, Addison-Wesley, 1998 - -\bibitem[2]{HAC} -A. Menezes, P. van Oorschot, S. Vanstone, \textit{Handbook of Applied Cryptography}, CRC Press, 1996 - -\bibitem[3]{ROSE} -Michael Rosing, \textit{Implementing Elliptic Curve Cryptography}, Manning Publications, 1999 - -\bibitem[4]{COMBA} -Paul G. Comba, \textit{Exponentiation Cryptosystems on the IBM PC}. IBM Systems Journal 29(4): 526-538 (1990) - -\bibitem[5]{KARA} -A. Karatsuba, Doklay Akad. Nauk SSSR 145 (1962), pp.293-294 - -\bibitem[6]{KARAP} -Andre Weimerskirch and Christof Paar, \textit{Generalizations of the Karatsuba Algorithm for Polynomial Multiplication}, Submitted to Design, Codes and Cryptography, March 2002 - -\bibitem[7]{BARRETT} -Paul Barrett, \textit{Implementing the Rivest Shamir and Adleman Public Key Encryption Algorithm on a Standard Digital Signal Processor}, Advances in Cryptology, Crypto '86, Springer-Verlag. - -\bibitem[8]{MONT} -P.L.Montgomery. \textit{Modular multiplication without trial division}. Mathematics of Computation, 44(170):519-521, April 1985. - -\bibitem[9]{DRMET} -Chae Hoon Lim and Pil Joong Lee, \textit{Generating Efficient Primes for Discrete Log Cryptosystems}, POSTECH Information Research Laboratories - -\bibitem[10]{MMB} -J. Daemen and R. Govaerts and J. Vandewalle, \textit{Block ciphers based on Modular Arithmetic}, State and {P}rogress in the {R}esearch of {C}ryptography, 1993, pp. 80-89 - -\bibitem[11]{RSAREF} -R.L. Rivest, A. Shamir, L. Adleman, \textit{A Method for Obtaining Digital Signatures and Public-Key Cryptosystems} - -\bibitem[12]{DHREF} -Whitfield Diffie, Martin E. Hellman, \textit{New Directions in Cryptography}, IEEE Transactions on Information Theory, 1976 - -\bibitem[13]{IEEE} -IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985) - -\bibitem[14]{GMP} -GNU Multiple Precision (GMP), \url{http://www.swox.com/gmp/} - -\bibitem[15]{MPI} -Multiple Precision Integer Library (MPI), Michael Fromberger, \url{http://thayer.dartmouth.edu/~sting/mpi/} - -\bibitem[16]{OPENSSL} -OpenSSL Cryptographic Toolkit, \url{http://openssl.org} - -\bibitem[17]{LIP} -Large Integer Package, \url{http://home.hetnet.nl/~ecstr/LIP.zip} - -\bibitem[18]{ISOC} -JTC1/SC22/WG14, ISO/IEC 9899:1999, ``A draft rationale for the C99 standard.'' - -\bibitem[19]{JAVA} -The Sun Java Website, \url{http://java.sun.com/} - -\end{thebibliography} - -\input{tommath.ind} - -\end{document} -- cgit v0.12 From 6d8b0c705f0d36540ea0d5624619a64a38986ec8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 30 Aug 2017 12:37:50 +0000 Subject: Tweak libtommath building, such that it doesn't depend on uint64_t any more. (handle mp_word in the same way as mp_digit) --- generic/tcl.h | 2 ++ generic/tclTomMath.h | 15 +++++++++++++++ tools/fix_tommath_h.tcl | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/generic/tcl.h b/generic/tcl.h index 6fa26f9..da9b292 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2263,6 +2263,8 @@ typedef struct mp_int mp_int; #define MP_INT_DECLARED typedef unsigned int mp_digit; #define MP_DIGIT_DECLARED +typedef unsigned TCL_WIDE_INT_TYPE mp_word; +#define MP_WORD_DECLARED /* *---------------------------------------------------------------------------- diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 87fe756..39132ed 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -46,7 +46,10 @@ extern "C" { typedef uint8_t mp_digit; #define MP_DIGIT_DECLARED #endif +#ifndef MP_WORD_DECLARED typedef uint16_t mp_word; +#define MP_WORD_DECLARED +#endif #define MP_SIZEOF_MP_DIGIT 1 #ifdef DIGIT_BIT #error You must not define DIGIT_BIT when using MP_8BIT @@ -56,7 +59,10 @@ extern "C" { typedef uint16_t mp_digit; #define MP_DIGIT_DECLARED #endif +#ifndef MP_WORD_DECLARED typedef uint32_t mp_word; +#define MP_WORD_DECLARED +#endif #define MP_SIZEOF_MP_DIGIT 2 #ifdef DIGIT_BIT #error You must not define DIGIT_BIT when using MP_16BIT @@ -68,13 +74,19 @@ extern "C" { #define MP_DIGIT_DECLARED #endif #if defined(_WIN32) +#ifndef MP_WORD_DECLARED typedef unsigned __int128 mp_word; +#define MP_WORD_DECLARED +#endif #elif defined(__GNUC__) typedef unsigned long mp_word __attribute__ ((mode(TI))); #else /* it seems you have a problem * but we assume you can somewhere define your own uint128_t */ +#ifndef MP_WORD_DECLARED typedef uint128_t mp_word; +#define MP_WORD_DECLARED +#endif #endif #define DIGIT_BIT 60 @@ -86,7 +98,10 @@ extern "C" { typedef uint32_t mp_digit; #define MP_DIGIT_DECLARED #endif +#ifndef MP_WORD_DECLARED typedef uint64_t mp_word; +#define MP_WORD_DECLARED +#endif #ifdef MP_31BIT /* this is an extension that uses 31-bit digits */ diff --git a/tools/fix_tommath_h.tcl b/tools/fix_tommath_h.tcl index 61fa4fd..cee29fa 100755 --- a/tools/fix_tommath_h.tcl +++ b/tools/fix_tommath_h.tcl @@ -45,6 +45,12 @@ foreach line [split $data \n] { puts "\#define MP_DIGIT_DECLARED" puts "\#endif" } + {typedef.*mp_word;} { + puts "\#ifndef MP_WORD_DECLARED" + puts $line + puts "\#define MP_WORD_DECLARED" + puts "\#endif" + } {typedef struct} { puts "\#ifndef MP_INT_DECLARED" puts "\#define MP_INT_DECLARED" -- cgit v0.12 From 7aafa756acec8c1f6746b28c8538c9868f5a89bf Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 30 Aug 2017 15:29:16 +0000 Subject: Cherrypick string.test [de104ef5ab] --- tests/string.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/string.test b/tests/string.test index 7b02928..549944d 100644 --- a/tests/string.test +++ b/tests/string.test @@ -1371,6 +1371,9 @@ test string-14.16 {string replace} { test string-14.17 {string replace} { string replace abcdefghijklmnop end end-1 } {abcdefghijklmnop} +test string-14.18 {string replace} { + string replace abcdefghijklmnop 10 9 XXX +} {abcdefghijklmnop} test string-15.1 {string tolower too few args} { list [catch {string tolower} msg] $msg -- cgit v0.12 From 7c7a396fc559a5365a644fa4088af9ff482e6a7f Mon Sep 17 00:00:00 2001 From: oehhar Date: Thu, 31 Aug 2017 06:31:05 +0000 Subject: http state 100 continue handling broken [2a94652ee1] --- changes | 3 +++ library/http/http.tcl | 3 ++- library/http/pkgIndex.tcl | 2 +- unix/Makefile.in | 4 ++-- win/Makefile.in | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) mode change 100644 => 100755 changes mode change 100644 => 100755 library/http/http.tcl mode change 100644 => 100755 library/http/pkgIndex.tcl mode change 100644 => 100755 unix/Makefile.in mode change 100644 => 100755 win/Makefile.in diff --git a/changes b/changes old mode 100644 new mode 100755 index f98eafc..d4be350 --- a/changes +++ b/changes @@ -8795,3 +8795,6 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans) --- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details + +2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann) +=> http 2.8.12 diff --git a/library/http/http.tcl b/library/http/http.tcl old mode 100644 new mode 100755 index 0350808..9f5310b --- a/library/http/http.tcl +++ b/library/http/http.tcl @@ -11,7 +11,7 @@ package require Tcl 8.6- # Keep this in sync with pkgIndex.tcl and with the install directories in # Makefiles -package provide http 2.8.11 +package provide http 2.8.12 namespace eval http { # Allow resourcing to not clobber existing data @@ -1027,6 +1027,7 @@ proc http::Event {sock token} { # We have now read all headers # We ignore HTTP/1.1 100 Continue returns. RFC2616 sec 8.2.3 if {$state(http) == "" || ([regexp {^\S+\s(\d+)} $state(http) {} x] && $x == 100)} { + set state(state) "connecting" return } diff --git a/library/http/pkgIndex.tcl b/library/http/pkgIndex.tcl old mode 100644 new mode 100755 index a0d28f1..d3fc7af --- a/library/http/pkgIndex.tcl +++ b/library/http/pkgIndex.tcl @@ -1,2 +1,2 @@ if {![package vsatisfies [package provide Tcl] 8.6-]} {return} -package ifneeded http 2.8.11 [list tclPkgSetup $dir http 2.8.11 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}] +package ifneeded http 2.8.12 [list tclPkgSetup $dir http 2.8.12 {{http.tcl source {::http::config ::http::formatQuery ::http::geturl ::http::reset ::http::wait ::http::register ::http::unregister ::http::mapReply}}}] diff --git a/unix/Makefile.in b/unix/Makefile.in old mode 100644 new mode 100755 index 7f45414..4814ee0 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -840,8 +840,8 @@ install-libraries: libraries do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/http1.0; \ done; - @echo "Installing package http 2.8.11 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.6/http-2.8.11.tm; + @echo "Installing package http 2.8.12 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.6/http-2.8.12.tm; @echo "Installing package opt0.4 files to $(SCRIPT_INSTALL_DIR)/opt0.4/"; @for i in $(TOP_DIR)/library/opt/*.tcl ; \ do \ diff --git a/win/Makefile.in b/win/Makefile.in old mode 100644 new mode 100755 index c62a3c7..633a9f5 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -651,8 +651,8 @@ install-libraries: libraries install-tzdata install-msgs do \ $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/http1.0"; \ done; - @echo "Installing package http 2.8.11 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.6/http-2.8.11.tm; + @echo "Installing package http 2.8.12 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.6/http-2.8.12.tm; @echo "Installing library opt0.4 directory"; @for j in $(ROOT_DIR)/library/opt/*.tcl; \ do \ -- cgit v0.12 From 432e75210fdb31c3bab2a57d04a6184b88c12c68 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 31 Aug 2017 13:32:52 +0000 Subject: Undo tag removal (just get libtommath directly from GitHUB), so we don't have useless file changes with every new release --- .fossil-settings/crlf-glob | 17 ++++ libtommath/README.md | 4 +- libtommath/TODO | 16 ---- libtommath/bn_error.c | 6 +- libtommath/bn_fast_mp_invmod.c | 6 +- libtommath/bn_fast_mp_montgomery_reduce.c | 6 +- libtommath/bn_fast_s_mp_mul_digs.c | 6 +- libtommath/bn_fast_s_mp_mul_high_digs.c | 6 +- libtommath/bn_fast_s_mp_sqr.c | 6 +- libtommath/bn_mp_2expt.c | 6 +- libtommath/bn_mp_abs.c | 6 +- libtommath/bn_mp_add.c | 6 +- libtommath/bn_mp_add_d.c | 6 +- libtommath/bn_mp_addmod.c | 6 +- libtommath/bn_mp_and.c | 6 +- libtommath/bn_mp_clamp.c | 6 +- libtommath/bn_mp_clear.c | 6 +- libtommath/bn_mp_clear_multi.c | 6 +- libtommath/bn_mp_cmp.c | 6 +- libtommath/bn_mp_cmp_d.c | 6 +- libtommath/bn_mp_cmp_mag.c | 6 +- libtommath/bn_mp_cnt_lsb.c | 6 +- libtommath/bn_mp_copy.c | 6 +- libtommath/bn_mp_count_bits.c | 6 +- libtommath/bn_mp_div.c | 6 +- libtommath/bn_mp_div_2.c | 6 +- libtommath/bn_mp_div_2d.c | 6 +- libtommath/bn_mp_div_3.c | 6 +- libtommath/bn_mp_div_d.c | 6 +- libtommath/bn_mp_dr_is_modulus.c | 6 +- libtommath/bn_mp_dr_reduce.c | 6 +- libtommath/bn_mp_dr_setup.c | 6 +- libtommath/bn_mp_exch.c | 6 +- libtommath/bn_mp_export.c | 6 +- libtommath/bn_mp_expt_d.c | 6 +- libtommath/bn_mp_expt_d_ex.c | 6 +- libtommath/bn_mp_exptmod.c | 6 +- libtommath/bn_mp_exptmod_fast.c | 6 +- libtommath/bn_mp_exteuclid.c | 6 +- libtommath/bn_mp_fread.c | 6 +- libtommath/bn_mp_fwrite.c | 6 +- libtommath/bn_mp_gcd.c | 6 +- libtommath/bn_mp_get_int.c | 6 +- libtommath/bn_mp_grow.c | 6 +- libtommath/bn_mp_import.c | 6 +- libtommath/bn_mp_init.c | 6 +- libtommath/bn_mp_init_copy.c | 6 +- libtommath/bn_mp_init_multi.c | 6 +- libtommath/bn_mp_init_set.c | 6 +- libtommath/bn_mp_init_set_int.c | 6 +- libtommath/bn_mp_init_size.c | 6 +- libtommath/bn_mp_invmod.c | 6 +- libtommath/bn_mp_invmod_slow.c | 6 +- libtommath/bn_mp_is_square.c | 6 +- libtommath/bn_mp_jacobi.c | 6 +- libtommath/bn_mp_karatsuba_mul.c | 6 +- libtommath/bn_mp_karatsuba_sqr.c | 6 +- libtommath/bn_mp_lcm.c | 6 +- libtommath/bn_mp_lshd.c | 6 +- libtommath/bn_mp_mod.c | 6 +- libtommath/bn_mp_mod_2d.c | 6 +- libtommath/bn_mp_mod_d.c | 6 +- libtommath/bn_mp_montgomery_calc_normalization.c | 6 +- libtommath/bn_mp_montgomery_reduce.c | 6 +- libtommath/bn_mp_montgomery_setup.c | 6 +- libtommath/bn_mp_mul.c | 6 +- libtommath/bn_mp_mul_2.c | 6 +- libtommath/bn_mp_mul_2d.c | 6 +- libtommath/bn_mp_mul_d.c | 6 +- libtommath/bn_mp_mulmod.c | 6 +- libtommath/bn_mp_n_root.c | 6 +- libtommath/bn_mp_n_root_ex.c | 6 +- libtommath/bn_mp_neg.c | 6 +- libtommath/bn_mp_or.c | 6 +- libtommath/bn_mp_prime_fermat.c | 6 +- libtommath/bn_mp_prime_is_divisible.c | 6 +- libtommath/bn_mp_prime_is_prime.c | 6 +- libtommath/bn_mp_prime_miller_rabin.c | 6 +- libtommath/bn_mp_prime_next_prime.c | 6 +- libtommath/bn_mp_prime_rabin_miller_trials.c | 6 +- libtommath/bn_mp_prime_random_ex.c | 6 +- libtommath/bn_mp_radix_size.c | 6 +- libtommath/bn_mp_radix_smap.c | 6 +- libtommath/bn_mp_rand.c | 6 +- libtommath/bn_mp_read_radix.c | 6 +- libtommath/bn_mp_read_signed_bin.c | 6 +- libtommath/bn_mp_read_unsigned_bin.c | 6 +- libtommath/bn_mp_reduce.c | 6 +- libtommath/bn_mp_reduce_2k.c | 6 +- libtommath/bn_mp_reduce_2k_l.c | 6 +- libtommath/bn_mp_reduce_2k_setup.c | 6 +- libtommath/bn_mp_reduce_2k_setup_l.c | 6 +- libtommath/bn_mp_reduce_is_2k.c | 6 +- libtommath/bn_mp_reduce_is_2k_l.c | 6 +- libtommath/bn_mp_reduce_setup.c | 6 +- libtommath/bn_mp_rshd.c | 6 +- libtommath/bn_mp_set.c | 6 +- libtommath/bn_mp_set_int.c | 6 +- libtommath/bn_mp_set_long.c | 6 +- libtommath/bn_mp_set_long_long.c | 6 +- libtommath/bn_mp_shrink.c | 6 +- libtommath/bn_mp_signed_bin_size.c | 6 +- libtommath/bn_mp_sqr.c | 6 +- libtommath/bn_mp_sqrmod.c | 6 +- libtommath/bn_mp_sqrt.c | 6 +- libtommath/bn_mp_sub.c | 6 +- libtommath/bn_mp_sub_d.c | 6 +- libtommath/bn_mp_submod.c | 6 +- libtommath/bn_mp_to_signed_bin.c | 6 +- libtommath/bn_mp_to_signed_bin_n.c | 6 +- libtommath/bn_mp_to_unsigned_bin.c | 6 +- libtommath/bn_mp_to_unsigned_bin_n.c | 6 +- libtommath/bn_mp_toom_mul.c | 6 +- libtommath/bn_mp_toom_sqr.c | 6 +- libtommath/bn_mp_toradix.c | 6 +- libtommath/bn_mp_toradix_n.c | 6 +- libtommath/bn_mp_unsigned_bin_size.c | 6 +- libtommath/bn_mp_xor.c | 6 +- libtommath/bn_mp_zero.c | 6 +- libtommath/bn_prime_tab.c | 6 +- libtommath/bn_reverse.c | 6 +- libtommath/bn_s_mp_add.c | 6 +- libtommath/bn_s_mp_exptmod.c | 6 +- libtommath/bn_s_mp_mul_digs.c | 6 +- libtommath/bn_s_mp_mul_high_digs.c | 6 +- libtommath/bn_s_mp_sqr.c | 6 +- libtommath/bn_s_mp_sub.c | 6 +- libtommath/bncore.c | 6 +- libtommath/makefile.include | 105 ----------------------- libtommath/tommath.h | 6 +- libtommath/tommath_private.h | 6 +- libtommath/tommath_superclass.h | 6 +- libtommath/updatemakes.sh | 6 +- 133 files changed, 407 insertions(+), 509 deletions(-) create mode 100644 .fossil-settings/crlf-glob delete mode 100644 libtommath/TODO delete mode 100644 libtommath/makefile.include diff --git a/.fossil-settings/crlf-glob b/.fossil-settings/crlf-glob new file mode 100644 index 0000000..2041cb6 --- /dev/null +++ b/.fossil-settings/crlf-glob @@ -0,0 +1,17 @@ +compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +compat/zlib/contrib/vstudio/readme.txt +compat/zlib/contrib/vstudio/*/zlib.rc +compat/zlib/win32/*.txt +compat/zlib/win64/*.txt +libtommath/*.dsp +libtommath/*.sln +libtommath/*.vcproj +tools/tcl.hpj.in +tools/tcl.wse.in +win/buildall.vc.bat +win/coffbase.txt +win/makefile.vc +win/rules.vc +win/tcl.dsp +win/tcl.dsw +win/tcl.hpj.in \ No newline at end of file diff --git a/libtommath/README.md b/libtommath/README.md index 866f024..4c5da71 100644 --- a/libtommath/README.md +++ b/libtommath/README.md @@ -1,4 +1,6 @@ -[![Build Status](https://travis-ci.org/libtom/libtommath.png?branch=develop)](https://travis-ci.org/libtom/libtommath) +[![Build Status - master](https://travis-ci.org/libtom/libtommath.png?branch=master)](https://travis-ci.org/libtom/libtommath) + +[![Build Status - develop](https://travis-ci.org/libtom/libtommath.png?branch=develop)](https://travis-ci.org/libtom/libtommath) This is the git repository for [LibTomMath](http://www.libtom.org/), a free open source portable number theoretic multiple-precision integer (MPI) library written entirely in C. diff --git a/libtommath/TODO b/libtommath/TODO deleted file mode 100644 index deffba1..0000000 --- a/libtommath/TODO +++ /dev/null @@ -1,16 +0,0 @@ -things for book in order of importance... - -- Fix up pseudo-code [only] for combas that are not consistent with source -- Start in chapter 3 [basics] and work up... - - re-write to prose [less abrupt] - - clean up pseudo code [spacing] - - more examples where appropriate and figures - -Goal: - - Get sync done by mid January [roughly 8-12 hours work] - - Finish ch3-6 by end of January [roughly 12-16 hours of work] - - Finish ch7-end by mid Feb [roughly 20-24 hours of work]. - -Goal isn't "first edition" but merely cleaner to read. - - diff --git a/libtommath/bn_error.c b/libtommath/bn_error.c index 380f46a..0d77411 100644 --- a/libtommath/bn_error.c +++ b/libtommath/bn_error.c @@ -42,6 +42,6 @@ const char *mp_error_to_string(int code) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c index c1d6271..12f42de 100644 --- a/libtommath/bn_fast_mp_invmod.c +++ b/libtommath/bn_fast_mp_invmod.c @@ -143,6 +143,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index 4d74630..16d5ff7 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -167,6 +167,6 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index 59cfa38..a1015af 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -102,6 +102,6 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c index 16f056c..08f0355 100644 --- a/libtommath/bn_fast_s_mp_mul_high_digs.c +++ b/libtommath/bn_fast_s_mp_mul_high_digs.c @@ -93,6 +93,6 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index 8fa8958..f435af9 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -109,6 +109,6 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_2expt.c b/libtommath/bn_mp_2expt.c index 36915bb..989bb9f 100644 --- a/libtommath/bn_mp_2expt.c +++ b/libtommath/bn_mp_2expt.c @@ -43,6 +43,6 @@ mp_2expt (mp_int * a, int b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index f3ec518..e7c5e25 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -38,6 +38,6 @@ mp_abs (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index 2487aba..bdb166f 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -48,6 +48,6 @@ int mp_add (mp_int * a, mp_int * b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index b7c8ea8..fd1a186 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -107,6 +107,6 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index 706e739..dc06788 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -36,6 +36,6 @@ mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 46c41a2..53008a5 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -52,6 +52,6 @@ mp_and (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_clamp.c b/libtommath/bn_mp_clamp.c index 149f1a8..2c0a1a6 100644 --- a/libtommath/bn_mp_clamp.c +++ b/libtommath/bn_mp_clamp.c @@ -39,6 +39,6 @@ mp_clamp (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_clear.c b/libtommath/bn_mp_clear.c index 37ce1e1..97f3db0 100644 --- a/libtommath/bn_mp_clear.c +++ b/libtommath/bn_mp_clear.c @@ -39,6 +39,6 @@ mp_clear (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_clear_multi.c b/libtommath/bn_mp_clear_multi.c index 583b1da..bd4b232 100644 --- a/libtommath/bn_mp_clear_multi.c +++ b/libtommath/bn_mp_clear_multi.c @@ -29,6 +29,6 @@ void mp_clear_multi(mp_int *mp, ...) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index 538ba34..e757ddf 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -38,6 +38,6 @@ mp_cmp (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c index e66b1e4..3f5ebae 100644 --- a/libtommath/bn_mp_cmp_d.c +++ b/libtommath/bn_mp_cmp_d.c @@ -39,6 +39,6 @@ int mp_cmp_d(mp_int * a, mp_digit b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c index d46a1be..7ceda97 100644 --- a/libtommath/bn_mp_cmp_mag.c +++ b/libtommath/bn_mp_cmp_mag.c @@ -50,6 +50,6 @@ int mp_cmp_mag (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_cnt_lsb.c b/libtommath/bn_mp_cnt_lsb.c index 1cf6159..bf201b5 100644 --- a/libtommath/bn_mp_cnt_lsb.c +++ b/libtommath/bn_mp_cnt_lsb.c @@ -48,6 +48,6 @@ int mp_cnt_lsb(mp_int *a) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index 1ba7381..84e839e 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -63,6 +63,6 @@ mp_copy (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index bd12a87..ff558eb 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -40,6 +40,6 @@ mp_count_bits (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 73f8779..0890e65 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -290,6 +290,6 @@ LBL_Q:mp_clear (&q); #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index a428869..2b5bb49 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -63,6 +63,6 @@ int mp_div_2(mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c index b8e27ba..635d374 100644 --- a/libtommath/bn_mp_div_2d.c +++ b/libtommath/bn_mp_div_2d.c @@ -81,6 +81,6 @@ int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index b716b22..e8504ea 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -74,6 +74,6 @@ mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index a2022ad..a5dbc59 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -110,6 +110,6 @@ int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c index f6d39c1..ced330c 100644 --- a/libtommath/bn_mp_dr_is_modulus.c +++ b/libtommath/bn_mp_dr_is_modulus.c @@ -38,6 +38,6 @@ int mp_dr_is_modulus(mp_int *a) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c index 920b52e..c85ee77 100644 --- a/libtommath/bn_mp_dr_reduce.c +++ b/libtommath/bn_mp_dr_reduce.c @@ -91,6 +91,6 @@ top: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c index 3aac30f..b0d4a14 100644 --- a/libtommath/bn_mp_dr_setup.c +++ b/libtommath/bn_mp_dr_setup.c @@ -27,6 +27,6 @@ void mp_dr_setup(mp_int *a, mp_digit *d) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_exch.c b/libtommath/bn_mp_exch.c index 5b5b359..fc26bae 100644 --- a/libtommath/bn_mp_exch.c +++ b/libtommath/bn_mp_exch.c @@ -29,6 +29,6 @@ mp_exch (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index 2e71a27..4bbc8c5 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -83,6 +83,6 @@ int mp_export(void* rop, size_t* countp, int order, size_t size, #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index d5ca456..a311926 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -23,6 +23,6 @@ int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index dced5a1..c361b27 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -78,6 +78,6 @@ int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c index 0998ce7..25c389d 100644 --- a/libtommath/bn_mp_exptmod.c +++ b/libtommath/bn_mp_exptmod.c @@ -107,6 +107,6 @@ int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 3322544..5e5c7f2 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -316,6 +316,6 @@ LBL_M: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index d9951ec..3c9612e 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -78,6 +78,6 @@ LBL_ERR: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_fread.c b/libtommath/bn_mp_fread.c index 4e38c6f..140721b 100644 --- a/libtommath/bn_mp_fread.c +++ b/libtommath/bn_mp_fread.c @@ -64,6 +64,6 @@ int mp_fread(mp_int *a, int radix, FILE *stream) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c index daa15db..23b5f64 100644 --- a/libtommath/bn_mp_fwrite.c +++ b/libtommath/bn_mp_fwrite.c @@ -49,6 +49,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index 40e7034..b0be8fb 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -100,6 +100,6 @@ LBL_U:mp_clear (&v); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index f99ffb2..5c820f8 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -40,6 +40,6 @@ unsigned long mp_get_int(mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_grow.c b/libtommath/bn_mp_grow.c index 3d47822..74e07b1 100644 --- a/libtommath/bn_mp_grow.c +++ b/libtommath/bn_mp_grow.c @@ -52,6 +52,6 @@ int mp_grow (mp_int * a, int size) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_import.c b/libtommath/bn_mp_import.c index 22e2342..df29389 100644 --- a/libtommath/bn_mp_import.c +++ b/libtommath/bn_mp_import.c @@ -68,6 +68,6 @@ int mp_import(mp_int* rop, size_t count, int order, size_t size, #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_init.c b/libtommath/bn_mp_init.c index 0f628df..ee374ae 100644 --- a/libtommath/bn_mp_init.c +++ b/libtommath/bn_mp_init.c @@ -41,6 +41,6 @@ int mp_init (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_init_copy.c b/libtommath/bn_mp_init_copy.c index c918d46..37a57ec 100644 --- a/libtommath/bn_mp_init_copy.c +++ b/libtommath/bn_mp_init_copy.c @@ -32,6 +32,6 @@ int mp_init_copy (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_init_multi.c b/libtommath/bn_mp_init_multi.c index c121188..73d6a0f 100644 --- a/libtommath/bn_mp_init_multi.c +++ b/libtommath/bn_mp_init_multi.c @@ -51,6 +51,6 @@ int mp_init_multi(mp_int *mp, ...) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_init_set.c b/libtommath/bn_mp_init_set.c index 24dc8bb..ed4955c 100644 --- a/libtommath/bn_mp_init_set.c +++ b/libtommath/bn_mp_init_set.c @@ -27,6 +27,6 @@ int mp_init_set (mp_int * a, mp_digit b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_init_set_int.c b/libtommath/bn_mp_init_set_int.c index 5a75e3e..1bc1942 100644 --- a/libtommath/bn_mp_init_set_int.c +++ b/libtommath/bn_mp_init_set_int.c @@ -26,6 +26,6 @@ int mp_init_set_int (mp_int * a, unsigned long b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_init_size.c b/libtommath/bn_mp_init_size.c index 4e30a2b..4446773 100644 --- a/libtommath/bn_mp_init_size.c +++ b/libtommath/bn_mp_init_size.c @@ -43,6 +43,6 @@ int mp_init_size (mp_int * a, int size) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index 75763ab..36011d0 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -38,6 +38,6 @@ int mp_invmod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c index cb7233d..ff0d5ae 100644 --- a/libtommath/bn_mp_invmod_slow.c +++ b/libtommath/bn_mp_invmod_slow.c @@ -170,6 +170,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 56d19c0..dd08d58 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -104,6 +104,6 @@ ERR:mp_clear(&t); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c index 8d147e0..5fc8593 100644 --- a/libtommath/bn_mp_jacobi.c +++ b/libtommath/bn_mp_jacobi.c @@ -112,6 +112,6 @@ LBL_A1:mp_clear (&a1); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index 31ed2e3..4d982c7 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -162,6 +162,6 @@ ERR: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c index 33a2bee..764e85a 100644 --- a/libtommath/bn_mp_karatsuba_sqr.c +++ b/libtommath/bn_mp_karatsuba_sqr.c @@ -116,6 +116,6 @@ ERR: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_lcm.c b/libtommath/bn_mp_lcm.c index d4bb1b6..512e8ec 100644 --- a/libtommath/bn_mp_lcm.c +++ b/libtommath/bn_mp_lcm.c @@ -55,6 +55,6 @@ LBL_T: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_lshd.c b/libtommath/bn_mp_lshd.c index e4f9abc..0143e94 100644 --- a/libtommath/bn_mp_lshd.c +++ b/libtommath/bn_mp_lshd.c @@ -62,6 +62,6 @@ int mp_lshd (mp_int * a, int b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index 0bc9530..06240a0 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -43,6 +43,6 @@ mp_mod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 472aa58..2bb86da 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -50,6 +50,6 @@ mp_mod_2d (mp_int * a, int b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index 6fbc2c3..bf2ccaa 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -22,6 +22,6 @@ mp_mod_d (mp_int * a, mp_digit b, mp_digit * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index 3e66d3f..679a871 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -54,6 +54,6 @@ int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index b64c80a..05e8bfa 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -113,6 +113,6 @@ mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index b15bafd..1c17445 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -54,6 +54,6 @@ mp_montgomery_setup (mp_int * n, mp_digit * rho) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index 3819c0a..cc3b9c8 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -62,6 +62,6 @@ int mp_mul (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index eba1450..d22fd89 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -77,6 +77,6 @@ int mp_mul_2(mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c index 798a1da..c00fd7e 100644 --- a/libtommath/bn_mp_mul_2d.c +++ b/libtommath/bn_mp_mul_2d.c @@ -80,6 +80,6 @@ int mp_mul_2d (mp_int * a, int b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index fa918da..6954ed3 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -74,6 +74,6 @@ mp_mul_d (mp_int * a, mp_digit b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c index 3c7e41b..d7a4d3c 100644 --- a/libtommath/bn_mp_mulmod.c +++ b/libtommath/bn_mp_mulmod.c @@ -35,6 +35,6 @@ int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c index f8f9d13..f717f17 100644 --- a/libtommath/bn_mp_n_root.c +++ b/libtommath/bn_mp_n_root.c @@ -25,6 +25,6 @@ int mp_n_root (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_n_root_ex.c b/libtommath/bn_mp_n_root_ex.c index 28d6b18..079b4f3 100644 --- a/libtommath/bn_mp_n_root_ex.c +++ b/libtommath/bn_mp_n_root_ex.c @@ -127,6 +127,6 @@ LBL_T1:mp_clear (&t1); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c index f488b57..d03e92e 100644 --- a/libtommath/bn_mp_neg.c +++ b/libtommath/bn_mp_neg.c @@ -35,6 +35,6 @@ int mp_neg (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index aee9734..b9775ce 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -45,6 +45,6 @@ int mp_or (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c index 5b992b5..d99feeb 100644 --- a/libtommath/bn_mp_prime_fermat.c +++ b/libtommath/bn_mp_prime_fermat.c @@ -57,6 +57,6 @@ LBL_T:mp_clear (&t); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c index f97498f..eea4a27 100644 --- a/libtommath/bn_mp_prime_is_divisible.c +++ b/libtommath/bn_mp_prime_is_divisible.c @@ -45,6 +45,6 @@ int mp_prime_is_divisible (mp_int * a, int *result) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c index 29571ba..3eda4fd 100644 --- a/libtommath/bn_mp_prime_is_prime.c +++ b/libtommath/bn_mp_prime_is_prime.c @@ -78,6 +78,6 @@ LBL_B:mp_clear (&b); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c index b168f01..7de0634 100644 --- a/libtommath/bn_mp_prime_miller_rabin.c +++ b/libtommath/bn_mp_prime_miller_rabin.c @@ -98,6 +98,6 @@ LBL_N1:mp_clear (&n1); } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_next_prime.c b/libtommath/bn_mp_prime_next_prime.c index 6515b1c..7a32d9b 100644 --- a/libtommath/bn_mp_prime_next_prime.c +++ b/libtommath/bn_mp_prime_next_prime.c @@ -165,6 +165,6 @@ LBL_ERR: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_rabin_miller_trials.c b/libtommath/bn_mp_prime_rabin_miller_trials.c index c98de6e..378ceb2 100644 --- a/libtommath/bn_mp_prime_rabin_miller_trials.c +++ b/libtommath/bn_mp_prime_rabin_miller_trials.c @@ -47,6 +47,6 @@ int mp_prime_rabin_miller_trials(int size) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_prime_random_ex.c b/libtommath/bn_mp_prime_random_ex.c index 04a7cf7..cf5272e 100644 --- a/libtommath/bn_mp_prime_random_ex.c +++ b/libtommath/bn_mp_prime_random_ex.c @@ -119,6 +119,6 @@ error: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c index 4a58e41..cb0c134 100644 --- a/libtommath/bn_mp_radix_size.c +++ b/libtommath/bn_mp_radix_size.c @@ -73,6 +73,6 @@ int mp_radix_size (mp_int * a, int radix, int *size) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_radix_smap.c b/libtommath/bn_mp_radix_smap.c index e351146..4c6e57c 100644 --- a/libtommath/bn_mp_radix_smap.c +++ b/libtommath/bn_mp_radix_smap.c @@ -19,6 +19,6 @@ const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/"; #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c index d5967c2..93e255a 100644 --- a/libtommath/bn_mp_rand.c +++ b/libtommath/bn_mp_rand.c @@ -75,6 +75,6 @@ mp_rand (mp_int * a, int digits) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index a4d1c8a..12aa499 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -86,6 +86,6 @@ int mp_read_radix (mp_int * a, const char *str, int radix) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_read_signed_bin.c b/libtommath/bn_mp_read_signed_bin.c index a034fbd..363e11f 100644 --- a/libtommath/bn_mp_read_signed_bin.c +++ b/libtommath/bn_mp_read_signed_bin.c @@ -36,6 +36,6 @@ int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_read_unsigned_bin.c b/libtommath/bn_mp_read_unsigned_bin.c index 27af256..1a50b58 100644 --- a/libtommath/bn_mp_read_unsigned_bin.c +++ b/libtommath/bn_mp_read_unsigned_bin.c @@ -50,6 +50,6 @@ int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c index a87fc30..367383f 100644 --- a/libtommath/bn_mp_reduce.c +++ b/libtommath/bn_mp_reduce.c @@ -95,6 +95,6 @@ CLEANUP: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_2k.c b/libtommath/bn_mp_reduce_2k.c index 4f13b07..6bc96d1 100644 --- a/libtommath/bn_mp_reduce_2k.c +++ b/libtommath/bn_mp_reduce_2k.c @@ -58,6 +58,6 @@ ERR: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_2k_l.c b/libtommath/bn_mp_reduce_2k_l.c index b41677a..8e6eeb0 100644 --- a/libtommath/bn_mp_reduce_2k_l.c +++ b/libtommath/bn_mp_reduce_2k_l.c @@ -59,6 +59,6 @@ ERR: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c index a0c507f..bf810c0 100644 --- a/libtommath/bn_mp_reduce_2k_setup.c +++ b/libtommath/bn_mp_reduce_2k_setup.c @@ -42,6 +42,6 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c index 7083533..56d1ba8 100644 --- a/libtommath/bn_mp_reduce_2k_setup_l.c +++ b/libtommath/bn_mp_reduce_2k_setup_l.c @@ -39,6 +39,6 @@ ERR: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c index 2e61839..0499e83 100644 --- a/libtommath/bn_mp_reduce_is_2k.c +++ b/libtommath/bn_mp_reduce_is_2k.c @@ -47,6 +47,6 @@ int mp_reduce_is_2k(mp_int *a) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index 65ae46e..48b3498 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -39,6 +39,6 @@ int mp_reduce_is_2k_l(mp_int *a) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c index ffddbce..8875698 100644 --- a/libtommath/bn_mp_reduce_setup.c +++ b/libtommath/bn_mp_reduce_setup.c @@ -29,6 +29,6 @@ int mp_reduce_setup (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_rshd.c b/libtommath/bn_mp_rshd.c index f412d93..4b598de 100644 --- a/libtommath/bn_mp_rshd.c +++ b/libtommath/bn_mp_rshd.c @@ -67,6 +67,6 @@ void mp_rshd (mp_int * a, int b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_set.c b/libtommath/bn_mp_set.c index 8eec001..dd4de3c 100644 --- a/libtommath/bn_mp_set.c +++ b/libtommath/bn_mp_set.c @@ -24,6 +24,6 @@ void mp_set (mp_int * a, mp_digit b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_set_int.c b/libtommath/bn_mp_set_int.c index f456a3a..3aafec9 100644 --- a/libtommath/bn_mp_set_int.c +++ b/libtommath/bn_mp_set_int.c @@ -43,6 +43,6 @@ int mp_set_int (mp_int * a, unsigned long b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_set_long.c b/libtommath/bn_mp_set_long.c index fbf9f82..8cbb811 100644 --- a/libtommath/bn_mp_set_long.c +++ b/libtommath/bn_mp_set_long.c @@ -19,6 +19,6 @@ MP_SET_XLONG(mp_set_long, unsigned long) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_set_long_long.c b/libtommath/bn_mp_set_long_long.c index 0a688c8..3566b45 100644 --- a/libtommath/bn_mp_set_long_long.c +++ b/libtommath/bn_mp_set_long_long.c @@ -19,6 +19,6 @@ MP_SET_XLONG(mp_set_long_long, unsigned long long) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_shrink.c b/libtommath/bn_mp_shrink.c index 9422a54..0712c2b 100644 --- a/libtommath/bn_mp_shrink.c +++ b/libtommath/bn_mp_shrink.c @@ -36,6 +36,6 @@ int mp_shrink (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c index bb63407..0910333 100644 --- a/libtommath/bn_mp_signed_bin_size.c +++ b/libtommath/bn_mp_signed_bin_size.c @@ -22,6 +22,6 @@ int mp_signed_bin_size (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index 299308d..ffe94e2 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -55,6 +55,6 @@ mp_sqr (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index 05ea9e0..3b29fbc 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -36,6 +36,6 @@ mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index 72d98f0..d3b5d62 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -76,6 +76,6 @@ E2: mp_clear(&t1); #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index 67da8da..2f73faa 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -54,6 +54,6 @@ mp_sub (mp_int * a, mp_int * b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index a4e1b1c..5e96030 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -88,6 +88,6 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index ec7885c..138863c 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -37,6 +37,6 @@ mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c index 109d8f7..c49c87d 100644 --- a/libtommath/bn_mp_to_signed_bin.c +++ b/libtommath/bn_mp_to_signed_bin.c @@ -28,6 +28,6 @@ int mp_to_signed_bin (mp_int * a, unsigned char *b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c index bcbdf79..dc5ec26 100644 --- a/libtommath/bn_mp_to_signed_bin_n.c +++ b/libtommath/bn_mp_to_signed_bin_n.c @@ -26,6 +26,6 @@ int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c index 0ac9887..d249359 100644 --- a/libtommath/bn_mp_to_unsigned_bin.c +++ b/libtommath/bn_mp_to_unsigned_bin.c @@ -43,6 +43,6 @@ int mp_to_unsigned_bin (mp_int * a, unsigned char *b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c index 19fe1e4..f671621 100644 --- a/libtommath/bn_mp_to_unsigned_bin_n.c +++ b/libtommath/bn_mp_to_unsigned_bin_n.c @@ -26,6 +26,6 @@ int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index 9a347fa..4a574fc 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -281,6 +281,6 @@ ERR: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 327a85f..0a38192 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -223,6 +223,6 @@ ERR: #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index baf0e3b..3337765 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -70,6 +70,6 @@ int mp_toradix (mp_int * a, char *str, int radix) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index 881cb52..ae24ada 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -83,6 +83,6 @@ int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c index 74f6ed0..f46d0ba 100644 --- a/libtommath/bn_mp_unsigned_bin_size.c +++ b/libtommath/bn_mp_unsigned_bin_size.c @@ -23,6 +23,6 @@ int mp_unsigned_bin_size (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index 9c83126..f51fc8e 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -46,6 +46,6 @@ mp_xor (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_mp_zero.c b/libtommath/bn_mp_zero.c index a76c2a9..a7d59e4 100644 --- a/libtommath/bn_mp_zero.c +++ b/libtommath/bn_mp_zero.c @@ -31,6 +31,6 @@ void mp_zero (mp_int * a) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_prime_tab.c b/libtommath/bn_prime_tab.c index 77535c7..5252130 100644 --- a/libtommath/bn_prime_tab.c +++ b/libtommath/bn_prime_tab.c @@ -56,6 +56,6 @@ const mp_digit ltm_prime_tab[] = { }; #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_reverse.c b/libtommath/bn_reverse.c index 9c00f2b..dc87a4e 100644 --- a/libtommath/bn_reverse.c +++ b/libtommath/bn_reverse.c @@ -34,6 +34,6 @@ bn_reverse (unsigned char *s, int len) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 2069d88..7a100e8 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -104,6 +104,6 @@ s_mp_add (mp_int * a, mp_int * b, mp_int * c) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index 8b10003..ab820d4 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -247,6 +247,6 @@ LBL_M: } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index 41bca7b..8f1bf97 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -85,6 +85,6 @@ int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 7e18680..031f17b 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -76,6 +76,6 @@ s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index 3bcc7c9..ac0e157 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -79,6 +79,6 @@ int s_mp_sqr (mp_int * a, mp_int * b) } #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index 260a95f..8091f4a 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -84,6 +84,6 @@ s_mp_sub (mp_int * a, mp_int * b, mp_int * c) #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/bncore.c b/libtommath/bncore.c index b07c629..e80ec99 100644 --- a/libtommath/bncore.c +++ b/libtommath/bncore.c @@ -31,6 +31,6 @@ int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsub TOOM_SQR_CUTOFF = 400; #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/makefile.include b/libtommath/makefile.include deleted file mode 100644 index c862f0f..0000000 --- a/libtommath/makefile.include +++ /dev/null @@ -1,105 +0,0 @@ -# -# Include makefile for libtommath -# - -#version of library -VERSION=1.0 -VERSION_SO=1:0 - -# default make target -default: ${LIBNAME} - -# Compiler and Linker Names -ifndef PREFIX - PREFIX= -endif - -ifeq ($(CC),cc) - CC = $(PREFIX)gcc -endif -LD=$(PREFIX)ld -AR=$(PREFIX)ar -RANLIB=$(PREFIX)ranlib - -ifndef MAKE - MAKE=make -endif - -CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow - -ifndef NO_ADDTL_WARNINGS -# additional warnings -CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align -CFLAGS += -Wstrict-prototypes -Wpointer-arith -endif - -ifdef COMPILE_DEBUG -#debug -CFLAGS += -g3 -else - -ifdef COMPILE_SIZE -#for size -CFLAGS += -Os -else - -ifndef IGNORE_SPEED -#for speed -CFLAGS += -O3 -funroll-loops - -#x86 optimizations [should be valid for any GCC install though] -CFLAGS += -fomit-frame-pointer -endif - -endif # COMPILE_SIZE -endif # COMPILE_DEBUG - -# adjust coverage set -ifneq ($(filter $(shell arch), i386 i686 x86_64 amd64 ia64),) - COVERAGE = test_standalone timing - COVERAGE_APP = ./test && ./ltmtest -else - COVERAGE = test_standalone - COVERAGE_APP = ./test -endif - -HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h -HEADERS=tommath_private.h $(HEADERS_PUB) - -test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0 - -#LIBPATH-The directory for libtommath to be installed to. -#INCPATH-The directory to install the header files for libtommath. -#DATAPATH-The directory to install the pdf docs. -LIBPATH?=/usr/lib -INCPATH?=/usr/include -DATAPATH?=/usr/share/doc/libtommath/pdf - -#make the code coverage of the library -# -coverage: CFLAGS += -fprofile-arcs -ftest-coverage -DTIMING_NO_LOGS -coverage: LFLAGS += -lgcov -coverage: LDFLAGS += -lgcov - -coverage: $(COVERAGE) - $(COVERAGE_APP) - -lcov: coverage - rm -f coverage.info - lcov --capture --no-external --no-recursion $(LCOV_ARGS) --output-file coverage.info -q - genhtml coverage.info --output-directory coverage -q - -# target that removes all coverage output -cleancov-clean: - rm -f `find . -type f -name "*.info" | xargs` - rm -rf coverage/ - -# cleans everything - coverage output and standard 'clean' -cleancov: cleancov-clean clean - -clean: - rm -f *.gcda *.gcno *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \ - *.idx *.toc *.log *.aux *.dvi *.lof *.ind *.ilg *.ps *.log *.s mpi.c *.da *.dyn *.dpi tommath.tex `find . -type f | grep [~] | xargs` *.lo *.la - rm -rf .libs/ - cd etc ; MAKE=${MAKE} ${MAKE} clean - cd pics ; MAKE=${MAKE} ${MAKE} clean diff --git a/libtommath/tommath.h b/libtommath/tommath.h index fc6b409..80bae69 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -565,6 +565,6 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream); #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 4c5389c..aeda684 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -118,6 +118,6 @@ int func_name (mp_int * a, type b) \ #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/tommath_superclass.h b/libtommath/tommath_superclass.h index 2489a07..a2f4d93 100644 --- a/libtommath/tommath_superclass.h +++ b/libtommath/tommath_superclass.h @@ -71,6 +71,6 @@ #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ diff --git a/libtommath/updatemakes.sh b/libtommath/updatemakes.sh index 54c3b84..0f9520e 100755 --- a/libtommath/updatemakes.sh +++ b/libtommath/updatemakes.sh @@ -28,6 +28,6 @@ rm -f tmp.delme rm -f tmplist -# $Source$ -# $Revision$ -# $Date$ +# ref: $Format:%D$ +# git commit: $Format:%H$ +# commit time: $Format:%ai$ -- cgit v0.12 From 25b97a7df947a49be144f13ba4c392d3fda00e7d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 31 Aug 2017 13:43:17 +0000 Subject: Adapt .fossil-settings/crlf-glob, for 5 libtommath-related files which have crlf ending --- .fossil-settings/crlf-glob | 3 +++ .fossil-settings/crnl-glob | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.fossil-settings/crlf-glob b/.fossil-settings/crlf-glob index f219a75..2041cb6 100644 --- a/.fossil-settings/crlf-glob +++ b/.fossil-settings/crlf-glob @@ -3,6 +3,9 @@ compat/zlib/contrib/vstudio/readme.txt compat/zlib/contrib/vstudio/*/zlib.rc compat/zlib/win32/*.txt compat/zlib/win64/*.txt +libtommath/*.dsp +libtommath/*.sln +libtommath/*.vcproj tools/tcl.hpj.in tools/tcl.wse.in win/buildall.vc.bat diff --git a/.fossil-settings/crnl-glob b/.fossil-settings/crnl-glob index f219a75..2041cb6 100644 --- a/.fossil-settings/crnl-glob +++ b/.fossil-settings/crnl-glob @@ -3,6 +3,9 @@ compat/zlib/contrib/vstudio/readme.txt compat/zlib/contrib/vstudio/*/zlib.rc compat/zlib/win32/*.txt compat/zlib/win64/*.txt +libtommath/*.dsp +libtommath/*.sln +libtommath/*.vcproj tools/tcl.hpj.in tools/tcl.wse.in win/buildall.vc.bat -- cgit v0.12 From ce32fdecb2337a3ce69b0fb71295c46478019e86 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 31 Aug 2017 15:07:57 +0000 Subject: Ignore libtommath/doc directory. Add some VS-related makefiles, useful for testing --- .fossil-settings/ignore-glob | 47 + libtommath/libtommath.dsp | 572 +++++++ libtommath/libtommath.pc.in | 10 + libtommath/libtommath_VS2005.sln | 20 + libtommath/libtommath_VS2005.vcproj | 2847 +++++++++++++++++++++++++++++++++++ libtommath/libtommath_VS2008.sln | 20 + libtommath/libtommath_VS2008.vcproj | 2813 ++++++++++++++++++++++++++++++++++ 7 files changed, 6329 insertions(+) create mode 100644 .fossil-settings/ignore-glob create mode 100644 libtommath/libtommath.dsp create mode 100644 libtommath/libtommath.pc.in create mode 100644 libtommath/libtommath_VS2005.sln create mode 100644 libtommath/libtommath_VS2005.vcproj create mode 100644 libtommath/libtommath_VS2008.sln create mode 100644 libtommath/libtommath_VS2008.vcproj diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob new file mode 100644 index 0000000..68c48e5 --- /dev/null +++ b/.fossil-settings/ignore-glob @@ -0,0 +1,47 @@ +*.a +*.dll +*.dylib +*.exe +*.exp +*.lib +*.o +*.obj +*.pdb +*.res +*.sl +*.so +*/Makefile +*/config.cache +*/config.log +*/config.status +*/tclConfig.sh +*/tclsh* +*/tcltest* +*/versions.vc +html +libtommath/bn.ilg +libtommath/bn.ind +libtommath/doc +libtommath/pretty.build +libtommath/tommath.src +libtommath/*.pdf +libtommath/*.pl +libtommath/*.sh +libtommath/tombc/* +libtommath/pre_gen/* +libtommath/pics/* +libtommath/mtest/* +libtommath/logs/* +libtommath/etc/* +libtommath/demo/* +libtommath/*.out +libtommath/*.tex +unix/autoMkindex.tcl +unix/dltest.marker +unix/tcl.pc +unix/tclIndex +unix/pkgs/* +win/Debug_VC* +win/Release_VC* +win/pkgs/* +win/tcl.hpj \ No newline at end of file diff --git a/libtommath/libtommath.dsp b/libtommath/libtommath.dsp new file mode 100644 index 0000000..71ac243 --- /dev/null +++ b/libtommath/libtommath.dsp @@ -0,0 +1,572 @@ +# Microsoft Developer Studio Project File - Name="libtommath" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=libtommath - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "libtommath.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "libtommath.mak" CFG="libtommath - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "libtommath - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "libtommath - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "libtommath" +# PROP Scc_LocalPath "." +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "libtommath - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"Release\tommath.lib" + +!ELSEIF "$(CFG)" == "libtommath - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"Debug\tommath.lib" + +!ENDIF + +# Begin Target + +# Name "libtommath - Win32 Release" +# Name "libtommath - Win32 Debug" +# Begin Source File + +SOURCE=.\bn_error.c +# End Source File +# Begin Source File + +SOURCE=.\bn_fast_mp_invmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_fast_mp_montgomery_reduce.c +# End Source File +# Begin Source File + +SOURCE=.\bn_fast_s_mp_mul_digs.c +# End Source File +# Begin Source File + +SOURCE=.\bn_fast_s_mp_mul_high_digs.c +# End Source File +# Begin Source File + +SOURCE=.\bn_fast_s_mp_sqr.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_2expt.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_abs.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_add.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_add_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_addmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_and.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_clamp.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_clear.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_clear_multi.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_cmp.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_cmp_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_cmp_mag.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_cnt_lsb.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_copy.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_count_bits.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_div.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_div_2.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_div_2d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_div_3.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_div_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_dr_is_modulus.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_dr_reduce.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_dr_setup.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_exch.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_expt_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_exptmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_exptmod_fast.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_exteuclid.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_fread.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_fwrite.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_gcd.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_get_int.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_grow.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_init.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_init_copy.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_init_multi.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_init_set.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_init_set_int.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_init_size.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_invmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_invmod_slow.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_is_square.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_jacobi.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_karatsuba_mul.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_karatsuba_sqr.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_lcm.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_lshd.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mod_2d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mod_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_montgomery_calc_normalization.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_montgomery_reduce.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_montgomery_setup.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mul.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mul_2.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mul_2d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mul_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_mulmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_n_root.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_neg.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_or.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_fermat.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_is_divisible.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_is_prime.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_miller_rabin.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_next_prime.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_rabin_miller_trials.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_prime_random_ex.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_radix_size.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_radix_smap.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_rand.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_read_radix.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_read_signed_bin.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_read_unsigned_bin.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_2k.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_2k_l.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_2k_setup.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_2k_setup_l.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_is_2k.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_is_2k_l.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_reduce_setup.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_rshd.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_set.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_set_int.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_shrink.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_signed_bin_size.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_sqr.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_sqrmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_sqrt.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_sub.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_sub_d.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_submod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_to_signed_bin.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_to_signed_bin_n.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_to_unsigned_bin.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_to_unsigned_bin_n.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_toom_mul.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_toom_sqr.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_toradix.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_toradix_n.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_unsigned_bin_size.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_xor.c +# End Source File +# Begin Source File + +SOURCE=.\bn_mp_zero.c +# End Source File +# Begin Source File + +SOURCE=.\bn_prime_tab.c +# End Source File +# Begin Source File + +SOURCE=.\bn_reverse.c +# End Source File +# Begin Source File + +SOURCE=.\bn_s_mp_add.c +# End Source File +# Begin Source File + +SOURCE=.\bn_s_mp_exptmod.c +# End Source File +# Begin Source File + +SOURCE=.\bn_s_mp_mul_digs.c +# End Source File +# Begin Source File + +SOURCE=.\bn_s_mp_mul_high_digs.c +# End Source File +# Begin Source File + +SOURCE=.\bn_s_mp_sqr.c +# End Source File +# Begin Source File + +SOURCE=.\bn_s_mp_sub.c +# End Source File +# Begin Source File + +SOURCE=.\bncore.c +# End Source File +# Begin Source File + +SOURCE=.\tommath.h +# End Source File +# Begin Source File + +SOURCE=.\tommath_class.h +# End Source File +# Begin Source File + +SOURCE=.\tommath_superclass.h +# End Source File +# End Target +# End Project diff --git a/libtommath/libtommath.pc.in b/libtommath/libtommath.pc.in new file mode 100644 index 0000000..099b1cd --- /dev/null +++ b/libtommath/libtommath.pc.in @@ -0,0 +1,10 @@ +prefix=@to-be-replaced@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: LibTomMath +Description: public domain library for manipulating large integer numbers +Version: @to-be-replaced@ +Libs: -L${libdir} -ltommath +Cflags: -I${includedir} diff --git a/libtommath/libtommath_VS2005.sln b/libtommath/libtommath_VS2005.sln new file mode 100644 index 0000000..21bc915 --- /dev/null +++ b/libtommath/libtommath_VS2005.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtommath", "libtommath_VS2005.vcproj", "{0272C9B2-D68B-4F24-B32D-C1FD552F7E51}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Debug|Win32.ActiveCfg = Debug|Win32 + {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Debug|Win32.Build.0 = Debug|Win32 + {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Release|Win32.ActiveCfg = Release|Win32 + {0272C9B2-D68B-4F24-B32D-C1FD552F7E51}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libtommath/libtommath_VS2005.vcproj b/libtommath/libtommath_VS2005.vcproj new file mode 100644 index 0000000..b977b4a --- /dev/null +++ b/libtommath/libtommath_VS2005.vcproj @@ -0,0 +1,2847 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libtommath/libtommath_VS2008.sln b/libtommath/libtommath_VS2008.sln new file mode 100644 index 0000000..1327ccf --- /dev/null +++ b/libtommath/libtommath_VS2008.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtommath", "libtommath_VS2008.vcproj", "{42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Debug|Win32.ActiveCfg = Debug|Win32 + {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Debug|Win32.Build.0 = Debug|Win32 + {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Release|Win32.ActiveCfg = Release|Win32 + {42109FEE-B0B9-4FCD-9E56-2863BF8C55D2}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libtommath/libtommath_VS2008.vcproj b/libtommath/libtommath_VS2008.vcproj new file mode 100644 index 0000000..34bf2ae --- /dev/null +++ b/libtommath/libtommath_VS2008.vcproj @@ -0,0 +1,2813 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v0.12 From e28f1eece4af6a2415de923fb4c3cfae7c055c8e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 1 Sep 2017 13:48:56 +0000 Subject: Handle Unicode surrogates correctly in Tcl_AppendFormatToObj() and BuildCharSet(). Only makes a difference for TCL_UTF_MAX=4, when surrogates are used in the format string ... highly unlikely corner-case. --- generic/tclScan.c | 4 ++-- generic/tclStringObj.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclScan.c b/generic/tclScan.c index 7a6a8a2..e1fcad4 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -72,7 +72,7 @@ BuildCharSet( CharSet *cset, const char *format) /* Points to first char of set. */ { - Tcl_UniChar ch, start; + Tcl_UniChar ch = 0, start; int offset, nranges; const char *end; @@ -582,7 +582,7 @@ Tcl_ScanObjCmd( char op = 0; int width, underflow = 0; Tcl_WideInt wideValue; - Tcl_UniChar ch, sch; + Tcl_UniChar ch = 0, sch = 0; Tcl_Obj **objs = NULL, *objPtr = NULL; int flags; char buf[513]; /* Temporary buffer to hold scanned number diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 6d97881..01b044e 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1682,6 +1682,7 @@ Tcl_AppendFormatToObj( const char *span = format, *msg, *errCode; int numBytes = 0, objIndex = 0, gotXpg = 0, gotSequential = 0; int originalLength, limit; + Tcl_UniChar ch = 0; static const char *mixedXPG = "cannot mix \"%\" and \"%n$\" conversion specifiers"; static const char *const badIndex[2] = { @@ -1709,7 +1710,6 @@ Tcl_AppendFormatToObj( #endif int newXpg, numChars, allocSegment = 0, segmentLimit, segmentNumBytes; Tcl_Obj *segment; - Tcl_UniChar ch = 0; int step = TclUtfToUniChar(format, &ch); format += step; -- cgit v0.12 From ce58cdff9f1d04dfc684cd7f68b920ef6f2164eb Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 2 Sep 2017 19:35:22 +0000 Subject: [Bug 0e4d88b650] First draft fix. Re-resolve namespace after cmd deletion. --- generic/tclBasic.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 44cf543..fddce1a 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -2017,7 +2017,7 @@ Tcl_CreateObjCommand( Command *cmdPtr, *refCmdPtr; Tcl_HashEntry *hPtr; const char *tail; - int isNew; + int isNew = 0, deleted = 0; ImportedCmdData *dataPtr; if (iPtr->flags & DELETED) { @@ -2030,6 +2030,14 @@ Tcl_CreateObjCommand( } /* + * If the command name we seek to create already exists, we need to + * delete that first. That can be tricky in the presence of traces. + * Loop until we no longer find an existing command in the way. + */ + + while (1) { + + /* * 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. @@ -2047,11 +2055,13 @@ Tcl_CreateObjCommand( } hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew); - TclInvalidateNsPath(nsPtr); - if (!isNew) { - cmdPtr = Tcl_GetHashValue(hPtr); + + if (isNew || deleted) { + break; + } /* Command already exists. */ + cmdPtr = Tcl_GetHashValue(hPtr); /* * [***] This is wrong. See Tcl Bug a16752c252. @@ -2089,8 +2099,8 @@ Tcl_CreateObjCommand( cmdPtr->importRefPtr = NULL; } TclCleanupCommandMacro(cmdPtr); - - hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew); + deleted = 1; + } if (!isNew) { /* * If the deletion callback recreated the command, just throw away @@ -2100,7 +2110,8 @@ Tcl_CreateObjCommand( ckfree(Tcl_GetHashValue(hPtr)); } - } else { + + if (!deleted) { /* * The list of command exported from the namespace might have changed. * However, we do not need to recompute this just yet; next time we @@ -2108,7 +2119,8 @@ Tcl_CreateObjCommand( */ TclInvalidateNsCmdLookup(nsPtr); - } + TclInvalidateNsPath(nsPtr); + } cmdPtr = (Command *) ckalloc(sizeof(Command)); Tcl_SetHashValue(hPtr, cmdPtr); cmdPtr->hPtr = hPtr; -- cgit v0.12 From 7afc6b1c1764a4b1305c9e716eec3949e655e626 Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 2 Sep 2017 20:17:26 +0000 Subject: Tidy up. --- generic/tclBasic.c | 73 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index fddce1a..7c223e9 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -2013,8 +2013,8 @@ Tcl_CreateObjCommand( { Interp *iPtr = (Interp *) interp; ImportRef *oldRefPtr = NULL; - Namespace *nsPtr, *dummy1, *dummy2; - Command *cmdPtr, *refCmdPtr; + Namespace *nsPtr; + Command *cmdPtr; Tcl_HashEntry *hPtr; const char *tail; int isNew = 0, deleted = 0; @@ -2032,35 +2032,41 @@ Tcl_CreateObjCommand( /* * If the command name we seek to create already exists, we need to * delete that first. That can be tricky in the presence of traces. - * Loop until we no longer find an existing command in the way. + * Loop until we no longer find an existing command in the way, or + * until we've deleted one command and that didn't finish the job. */ while (1) { + /* + * 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. + */ - /* - * 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) { + Namespace *dummy1, *dummy2; - if (strstr(cmdName, "::") != NULL) { - TclGetNamespaceForQualName(interp, cmdName, NULL, + TclGetNamespaceForQualName(interp, cmdName, 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; - } + if ((nsPtr == NULL) || (tail == NULL)) { + return (Tcl_Command) NULL; + } + } else { + nsPtr = iPtr->globalNsPtr; + tail = cmdName; + } - hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew); + hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew); - if (isNew || deleted) { - break; - } + if (isNew || deleted) { + /* + * isNew - No conflict with existing command. + * deleted - We've already deleted a conflicting command + */ + break; + } - /* Command already exists. */ + /* An existing command conflicts. Try to delete it.. */ cmdPtr = Tcl_GetHashValue(hPtr); /* @@ -2101,17 +2107,18 @@ Tcl_CreateObjCommand( TclCleanupCommandMacro(cmdPtr); deleted = 1; } - if (!isNew) { - /* - * 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(Tcl_GetHashValue(hPtr)); - } + if (!isNew) { + /* + * 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). + */ - if (!deleted) { + ckfree(Tcl_GetHashValue(hPtr)); + } + + if (!deleted) { /* * The list of command exported from the namespace might have changed. * However, we do not need to recompute this just yet; next time we @@ -2120,7 +2127,7 @@ Tcl_CreateObjCommand( TclInvalidateNsCmdLookup(nsPtr); TclInvalidateNsPath(nsPtr); - } + } cmdPtr = (Command *) ckalloc(sizeof(Command)); Tcl_SetHashValue(hPtr, cmdPtr); cmdPtr->hPtr = hPtr; @@ -2146,7 +2153,7 @@ Tcl_CreateObjCommand( if (oldRefPtr != NULL) { cmdPtr->importRefPtr = oldRefPtr; while (oldRefPtr != NULL) { - refCmdPtr = oldRefPtr->importedCmdPtr; + Command *refCmdPtr = oldRefPtr->importedCmdPtr; dataPtr = refCmdPtr->objClientData; dataPtr->realCmdPtr = cmdPtr; oldRefPtr = oldRefPtr->nextPtr; -- cgit v0.12 From 3ec5b35deb12c04bd8ca140242037d0b802b515c Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 2 Sep 2017 20:40:44 +0000 Subject: Similar fix to Tcl_CreateCommand(). --- generic/tclBasic.c | 85 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 31 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 7c223e9..7f75892 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -1851,11 +1851,11 @@ Tcl_CreateCommand( { Interp *iPtr = (Interp *) interp; ImportRef *oldRefPtr = NULL; - Namespace *nsPtr, *dummy1, *dummy2; - Command *cmdPtr, *refCmdPtr; + Namespace *nsPtr; + Command *cmdPtr; Tcl_HashEntry *hPtr; const char *tail; - int isNew; + int isNew = 0, deleted = 0; ImportedCmdData *dataPtr; if (iPtr->flags & DELETED) { @@ -1868,32 +1868,52 @@ Tcl_CreateCommand( } /* - * 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 the command name we seek to create already exists, we need to + * delete that first. That can be tricky in the presence of traces. + * Loop until we no longer find an existing command in the way, or + * until we've deleted one command and that didn't finish the job. */ - if (strstr(cmdName, "::") != NULL) { - TclGetNamespaceForQualName(interp, cmdName, 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; - } + while (1) { + /* + * 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. + */ - hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew); - if (!isNew) { + if (strstr(cmdName, "::") != NULL) { + Namespace *dummy1, *dummy2; + + TclGetNamespaceForQualName(interp, cmdName, 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, &isNew); + + if (isNew || deleted) { + /* + * isNew - No conflict with existing command. + * deleted - We've already deleted a conflicting command + */ + break; + } + + /* An existing command conflicts. Try to delete it.. */ + cmdPtr = Tcl_GetHashValue(hPtr); + /* - * Command already exists. Delete the old one. Be careful to preserve + * 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 = Tcl_GetHashValue(hPtr); cmdPtr->refCount++; if (cmdPtr->importRefPtr) { cmdPtr->flags |= CMD_REDEF_IN_PROGRESS; @@ -1906,18 +1926,21 @@ Tcl_CreateCommand( cmdPtr->importRefPtr = NULL; } TclCleanupCommandMacro(cmdPtr); + deleted = 1; + } - hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew); - if (!isNew) { - /* - * 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). - */ + if (!isNew) { + /* + * 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)); + } + + if (!deleted) { - 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 @@ -1952,7 +1975,7 @@ Tcl_CreateCommand( if (oldRefPtr != NULL) { cmdPtr->importRefPtr = oldRefPtr; while (oldRefPtr != NULL) { - refCmdPtr = oldRefPtr->importedCmdPtr; + Command *refCmdPtr = oldRefPtr->importedCmdPtr; dataPtr = refCmdPtr->objClientData; dataPtr->realCmdPtr = cmdPtr; oldRefPtr = oldRefPtr->nextPtr; -- cgit v0.12 From f42f0060be177134714f2fcfb31485e7e72a1916 Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 2 Sep 2017 21:14:55 +0000 Subject: Add test --- tests/basic.test | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/basic.test b/tests/basic.test index 91e4d6c..e4b46fd 100644 --- a/tests/basic.test +++ b/tests/basic.test @@ -221,6 +221,21 @@ test basic-15.1 {Tcl_CreateObjCommand, new cmd goes into a namespace specified i list [test_ns_basic::cmd] \ [namespace delete test_ns_basic] } {::test_ns_basic {}} +test basic-15.2 {Tcl_CreateObjCommand, Bug 0e4d88b650} -setup { + proc deleter {ns args} { + namespace delete $ns + } + namespace eval n { + proc p {} {} + } + trace add command n::p delete [list [namespace which deleter] [namespace current]::n] +} -body { + proc n::p {} {} +} -cleanup { + namespace delete n + rename deleter {} +} + test basic-16.1 {TclInvokeStringCommand} {emptyTest} { } {} -- cgit v0.12 From e08c86934d9b781f246aa5e1b0c6612c17bb4f90 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 4 Sep 2017 12:37:04 +0000 Subject: Typo's (Thanks to Gustaf Neumann), nothing functional. --- generic/tclBasic.c | 2 +- generic/tclEncoding.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 36d2301..acdcf41 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -2097,7 +2097,7 @@ Tcl_CreateCommand( /* An existing command conflicts. Try to delete it.. */ cmdPtr = Tcl_GetHashValue(hPtr); - + /* * Be careful to preserve * any existing import links so we can restore them down below. That diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 8450128..2548b73 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2329,7 +2329,7 @@ UtfToUtfProc( } if (UCHAR(*src) < 0x80 && !(UCHAR(*src) == 0 && pureNullMode == 0)) { /* - * Copy 7bit chatacters, but skip null-bytes when we are in input + * Copy 7bit characters, but skip null-bytes when we are in input * mode, so that they get converted to 0xc080. */ @@ -3374,7 +3374,7 @@ EscapeFromUtfProc( /* * The state variable has the value of oldState when word is 0. - * In this case, the escape sequense should not be copied to dst + * In this case, the escape sequence should not be copied to dst * because the current character set is not changed. */ -- cgit v0.12 From a15279ffd11639e3eee06f618dd684eab635e334 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 4 Sep 2017 13:59:04 +0000 Subject: Make pkgIndex.tcl from msgcat work for Tcl 9.0 (not really necessary, but for consistancy) --- library/msgcat/pkgIndex.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/msgcat/pkgIndex.tcl b/library/msgcat/pkgIndex.tcl index 7cdb703..72c5dc0 100644 --- a/library/msgcat/pkgIndex.tcl +++ b/library/msgcat/pkgIndex.tcl @@ -1,2 +1,2 @@ -if {![package vsatisfies [package provide Tcl] 8.5]} {return} +if {![package vsatisfies [package provide Tcl] 8.5-]} {return} package ifneeded msgcat 1.6.1 [list source [file join $dir msgcat.tcl]] -- cgit v0.12 From ca70072a998804499323fd4f553f3b1709f5a9a7 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 5 Sep 2017 15:38:02 +0000 Subject: update changes --- changes | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/changes b/changes index d1e6417..5cc49ea 100644 --- a/changes +++ b/changes @@ -8838,4 +8838,6 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann) => http 2.8.12 ---- Released 8.7a1, August ??, 2017 --- http://core.tcl.tk/tcl/ for details +2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter) + +--- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 522456ba985545e9ba23b34d8093a2f770ebc10b Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 5 Sep 2017 16:33:37 +0000 Subject: Removed the package style loader from tclAppInit. Zipfs now loads as part of the interpreter. --- unix/tclAppInit.c | 5 ----- win/tclAppInit.c | 5 ----- 2 files changed, 10 deletions(-) diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index 40b10f3..9bbc88b 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -17,7 +17,6 @@ #include "tcl.h" #ifdef TCL_TEST -#include "tclZipfs.h" extern Tcl_PackageInitProc Tcltest_Init; extern Tcl_PackageInitProc Tcltest_SafeInit; #endif /* TCL_TEST */ @@ -124,10 +123,6 @@ Tcl_AppInit( return TCL_ERROR; } Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, Tcltest_SafeInit); - if (Tclzipfs_Init(interp) == TCL_ERROR) { - return TCL_ERROR; - } - Tcl_StaticPackage(interp, "zipfs", Tclzipfs_Init, Tclzipfs_SafeInit); #endif /* TCL_TEST */ /* diff --git a/win/tclAppInit.c b/win/tclAppInit.c index b821ca7..e06eaf5 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -25,7 +25,6 @@ #include #ifdef TCL_TEST -#include "tclZipfs.h" extern Tcl_PackageInitProc Tcltest_Init; extern Tcl_PackageInitProc Tcltest_SafeInit; #endif /* TCL_TEST */ @@ -175,10 +174,6 @@ Tcl_AppInit( return TCL_ERROR; } Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, Tcltest_SafeInit); - if (Tclzipfs_Init(interp) == TCL_ERROR) { - return TCL_ERROR; - } - Tcl_StaticPackage(interp, "zipfs", Tclzipfs_Init, Tclzipfs_SafeInit); #endif /* TCL_TEST */ /* -- cgit v0.12 From 413fe66650f5b1467098f19daeee0c8843bebc4c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 6 Sep 2017 15:02:24 +0000 Subject: Fix use of "long long" (manually) in MSVC --- generic/tclTomMath.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 39132ed..508fadd 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -277,13 +277,19 @@ int mp_set_long_long(mp_int *a, unsigned long long b); */ /* get a 32-bit value */ -unsigned long mp_get_int(mp_int * a); +/* +unsigned long mp_get_int(const mp_int * a); +*/ /* get a platform dependent unsigned long value */ -unsigned long mp_get_long(mp_int * a); +/* +unsigned long mp_get_long(const mp_int * a); +*/ /* get a platform dependent unsigned long long value */ -unsigned long long mp_get_long_long(mp_int * a); +/* +unsigned long long mp_get_long_long(const mp_int * a); +*/ /* initialize and set a digit */ /* @@ -339,7 +345,7 @@ int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); /* b = a/2 */ /* -int mp_div_2(mp_int *a, mp_int *b); +int mp_div_2(const mp_int *a, mp_int *b); */ /* c = a * 2**b, implemented as c = a << b */ @@ -349,7 +355,7 @@ int mp_mul_2d(const mp_int *a, int b, mp_int *c); /* b = a*2 */ /* -int mp_mul_2(mp_int *a, mp_int *b); +int mp_mul_2(const mp_int *a, mp_int *b); */ /* c = a mod 2**b */ @@ -801,7 +807,7 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream); #endif -/* ref: tag: v1.0.1, master */ -/* git commit: 5953f62e42b24af93748b1ee5e1d062e242c2546 */ -/* commit time: 2017-08-29 22:27:36 +0200 */ +/* ref: $Format:%D$ */ +/* git commit: $Format:%H$ */ +/* commit time: $Format:%ai$ */ -- cgit v0.12 From d03a4dcc88f0ffb3e882124dc89f33f138419653 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 8 Sep 2017 13:13:15 +0000 Subject: Bump to 8.7a2 to distinguish trunk from 8.7a1 release. --- README | 2 +- generic/tcl.h | 4 ++-- library/init.tcl | 2 +- unix/configure | 2 +- unix/configure.ac | 2 +- win/configure | 2 +- win/configure.ac | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README b/README index 59de34d..322666a 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ README: Tcl - This is the Tcl 8.7a1 source distribution. + This is the Tcl 8.7a2 source distribution. http://sourceforge.net/projects/tcl/files/Tcl/ You can get any source release of Tcl from the URL above. diff --git a/generic/tcl.h b/generic/tcl.h index 589a63f..07d841d 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -55,10 +55,10 @@ extern "C" { #define TCL_MAJOR_VERSION 8 #define TCL_MINOR_VERSION 7 #define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE -#define TCL_RELEASE_SERIAL 1 +#define TCL_RELEASE_SERIAL 2 #define TCL_VERSION "8.7" -#define TCL_PATCH_LEVEL "8.7a1" +#define TCL_PATCH_LEVEL "8.7a2" #if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED) /* diff --git a/library/init.tcl b/library/init.tcl index b6e6e8b..e361645 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -16,7 +16,7 @@ if {[info commands package] == ""} { error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]" } -package require -exact Tcl 8.7a1 +package require -exact Tcl 8.7a2 # Compute the auto path to use in this interpreter. # The values on the path come from several locations: diff --git a/unix/configure b/unix/configure index 0b22a43..129c283 100755 --- a/unix/configure +++ b/unix/configure @@ -2325,7 +2325,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a1" +TCL_PATCH_LEVEL="a2" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/configure.ac b/unix/configure.ac index d7aa50f..e14d85e 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -25,7 +25,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a1" +TCL_PATCH_LEVEL="a2" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/win/configure b/win/configure index a47ff23..fdd3adb 100755 --- a/win/configure +++ b/win/configure @@ -2102,7 +2102,7 @@ SHELL=/bin/sh TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a1" +TCL_PATCH_LEVEL="a2" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 diff --git a/win/configure.ac b/win/configure.ac index e32dadc..d03695c 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -14,7 +14,7 @@ SHELL=/bin/sh TCL_VERSION=8.7 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a1" +TCL_PATCH_LEVEL="a2" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 -- cgit v0.12 From e86e8a501d19fb5963200791c3b575648c00090c Mon Sep 17 00:00:00 2001 From: gahr Date: Fri, 8 Sep 2017 13:30:29 +0000 Subject: Be consistent about how I am referred to. --- changes | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changes b/changes index 5cc49ea..ec8beb1 100644 --- a/changes +++ b/changes @@ -8234,7 +8234,7 @@ Dropped support for OS X versions less than 10.4 (Tiger) (fellows) 2013-05-16 (platform support) mingw-4.0 (nijtmans) -2013-05-19 (platform support) FreeBSD updates (cerutti) +2013-05-19 (platform support) FreeBSD updates (gahr) 2013-05-20 (bug fix)[3613567] access error temp file creation (keene) @@ -8657,7 +8657,7 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2016-05-21 (bug)[f7d4e] [namespace delete] performance (fellows) -2016-06-02 (TIP 447) execution time verbosity option (cerutti) +2016-06-02 (TIP 447) execution time verbosity option (gahr) => tcltest 2.4.0 2016-06-16 (bug)[16828b] crash due to [vwait] trace undo fail (dah,porter) -- cgit v0.12 From b2446d8d4189bfbfe9103548ebf459f29089398e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 8 Sep 2017 14:15:13 +0000 Subject: Add some more functions from libtommath for availability within Tcl (mainly the 'long long' variants). Add more 'const' keywords there too. --- generic/tclStubInit.c | 2 ++ generic/tclTomMath.decls | 11 +++++++++-- generic/tclTomMath.h | 4 ++-- generic/tclTomMathDecls.h | 21 +++++++++++++++++---- libtommath/bn_mp_div_2.c | 2 +- libtommath/bn_mp_get_int.c | 2 +- libtommath/bn_mp_get_long.c | 2 +- libtommath/bn_mp_get_long_long.c | 6 +++--- libtommath/bn_mp_mul_2.c | 2 +- libtommath/bn_mp_set_long_long.c | 2 +- libtommath/tommath.h | 12 ++++++------ unix/Makefile.in | 16 ++++++++++++++-- unix/tcl.spec | 2 +- win/Makefile.in | 3 +++ win/makefile.vc | 3 +++ 15 files changed, 65 insertions(+), 25 deletions(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 8cc21aa..a2f1ed3 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -859,6 +859,8 @@ const TclTomMathStubs tclTomMathStubs = { TclBNInitBignumFromWideInt, /* 65 */ TclBNInitBignumFromWideUInt, /* 66 */ TclBN_mp_expt_d_ex, /* 67 */ + TclBN_mp_set_long_long, /* 68 */ + TclBN_mp_get_long_long, /* 69 */ }; static const TclStubHooks tclStubHooks = { diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index 74ccefc..c4299d0 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -69,7 +69,7 @@ declare 14 { int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, mp_digit *r) } declare 15 { - int TclBN_mp_div_2(mp_int *a, mp_int *q) + int TclBN_mp_div_2(const mp_int *a, mp_int *q) } declare 16 { int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r) @@ -117,7 +117,7 @@ declare 30 { int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p) } declare 31 { - int TclBN_mp_mul_2(mp_int *a, mp_int *p) + int TclBN_mp_mul_2(const mp_int *a, mp_int *p) } declare 32 { int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p) @@ -237,6 +237,13 @@ declare 66 { declare 67 { int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } +# Added in libtommath 1.0.1 +declare 68 { + int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i) +} +declare 69 { + Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a) +} # Local Variables: # mode: tcl diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 508fadd..7e3c29e 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -273,7 +273,7 @@ int mp_set_long(mp_int *a, unsigned long b); /* set a platform dependent unsigned long long value */ /* -int mp_set_long_long(mp_int *a, unsigned long long b); +int mp_set_long_long(mp_int *a, Tcl_WideUInt b); */ /* get a 32-bit value */ @@ -288,7 +288,7 @@ unsigned long mp_get_long(const mp_int * a); /* get a platform dependent unsigned long long value */ /* -unsigned long long mp_get_long_long(const mp_int * a); +Tcl_WideUInt mp_get_long_long(const mp_int * a); */ /* initialize and set a digit */ diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 209c486..70de3b1 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -74,6 +74,8 @@ #define mp_exch TclBN_mp_exch #define mp_expt_d TclBN_mp_expt_d #define mp_expt_d_ex TclBN_mp_expt_d_ex +#define mp_get_int TclBN_mp_get_int +#define mp_get_long_long TclBN_mp_get_long_long #define mp_grow TclBN_mp_grow #define mp_init TclBN_mp_init #define mp_init_copy TclBN_mp_init_copy @@ -98,6 +100,7 @@ #define mp_s_rmap TclBNMpSRmap #define mp_set TclBN_mp_set #define mp_set_int TclBN_mp_set_int +#define mp_set_long_long TclBN_mp_set_long_long #define mp_shrink TclBN_mp_shrink #define mp_sqr TclBN_mp_sqr #define mp_sqrt TclBN_mp_sqrt @@ -176,7 +179,7 @@ EXTERN int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q, EXTERN int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 15 */ -EXTERN int TclBN_mp_div_2(mp_int *a, mp_int *q); +EXTERN int TclBN_mp_div_2(const mp_int *a, mp_int *q); /* 16 */ EXTERN int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r); @@ -209,7 +212,7 @@ EXTERN int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p); /* 30 */ EXTERN int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p); /* 31 */ -EXTERN int TclBN_mp_mul_2(mp_int *a, mp_int *p); +EXTERN int TclBN_mp_mul_2(const mp_int *a, mp_int *p); /* 32 */ EXTERN int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p); /* 33 */ @@ -292,6 +295,10 @@ EXTERN void TclBNInitBignumFromWideUInt(mp_int *bignum, /* 67 */ EXTERN int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast); +/* 68 */ +EXTERN int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i); +/* 69 */ +EXTERN Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a); typedef struct TclTomMathStubs { int magic; @@ -312,7 +319,7 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_count_bits) (const mp_int *a); /* 12 */ int (*tclBN_mp_div) (mp_int *a, mp_int *b, mp_int *q, mp_int *r); /* 13 */ int (*tclBN_mp_div_d) (mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */ - int (*tclBN_mp_div_2) (mp_int *a, mp_int *q); /* 15 */ + int (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); /* 15 */ int (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */ int (*tclBN_mp_div_3) (mp_int *a, mp_int *q, mp_digit *r); /* 17 */ void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */ @@ -328,7 +335,7 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */ int (*tclBN_mp_mul) (mp_int *a, mp_int *b, mp_int *p); /* 29 */ int (*tclBN_mp_mul_d) (mp_int *a, mp_digit b, mp_int *p); /* 30 */ - int (*tclBN_mp_mul_2) (mp_int *a, mp_int *p); /* 31 */ + int (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); /* 31 */ int (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */ int (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */ int (*tclBN_mp_or) (mp_int *a, mp_int *b, mp_int *c); /* 34 */ @@ -365,6 +372,8 @@ typedef struct TclTomMathStubs { void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ int (*tclBN_mp_expt_d_ex) (mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ + int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */ + Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */ } TclTomMathStubs; extern const TclTomMathStubs *tclTomMathStubsPtr; @@ -515,6 +524,10 @@ extern const TclTomMathStubs *tclTomMathStubsPtr; (tclTomMathStubsPtr->tclBNInitBignumFromWideUInt) /* 66 */ #define TclBN_mp_expt_d_ex \ (tclTomMathStubsPtr->tclBN_mp_expt_d_ex) /* 67 */ +#define TclBN_mp_set_long_long \ + (tclTomMathStubsPtr->tclBN_mp_set_long_long) /* 68 */ +#define TclBN_mp_get_long_long \ + (tclTomMathStubsPtr->tclBN_mp_get_long_long) /* 69 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index 2b5bb49..0e981a0 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -16,7 +16,7 @@ */ /* b = a/2 */ -int mp_div_2(mp_int * a, mp_int * b) +int mp_div_2(const mp_int * a, mp_int * b) { int x, res, oldused; diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index 5c820f8..abb7011 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -16,7 +16,7 @@ */ /* get the lower 32-bits of an mp_int */ -unsigned long mp_get_int(mp_int * a) +unsigned long mp_get_int(const mp_int * a) { int i; mp_min_u32 res; diff --git a/libtommath/bn_mp_get_long.c b/libtommath/bn_mp_get_long.c index 7c3d0fe..da69080 100644 --- a/libtommath/bn_mp_get_long.c +++ b/libtommath/bn_mp_get_long.c @@ -16,7 +16,7 @@ */ /* get the lower unsigned long of an mp_int, platform dependent */ -unsigned long mp_get_long(mp_int * a) +unsigned long mp_get_long(const mp_int * a) { int i; unsigned long res; diff --git a/libtommath/bn_mp_get_long_long.c b/libtommath/bn_mp_get_long_long.c index 4b959e6..534c48c 100644 --- a/libtommath/bn_mp_get_long_long.c +++ b/libtommath/bn_mp_get_long_long.c @@ -16,17 +16,17 @@ */ /* get the lower unsigned long long of an mp_int, platform dependent */ -unsigned long long mp_get_long_long (mp_int * a) +Tcl_WideUInt mp_get_long_long (const mp_int * a) { int i; - unsigned long long res; + Tcl_WideUInt res; if (a->used == 0) { return 0; } /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + i = MIN(a->used,(int)(((sizeof(Tcl_WideUInt) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; /* get most significant digit of result */ res = DIGIT(a,i); diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index d22fd89..0c8c2e3 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -16,7 +16,7 @@ */ /* b = a*2 */ -int mp_mul_2(mp_int * a, mp_int * b) +int mp_mul_2(const mp_int * a, mp_int * b) { int x, res, oldused; diff --git a/libtommath/bn_mp_set_long_long.c b/libtommath/bn_mp_set_long_long.c index 3566b45..0b8be33 100644 --- a/libtommath/bn_mp_set_long_long.c +++ b/libtommath/bn_mp_set_long_long.c @@ -16,7 +16,7 @@ */ /* set a platform dependent unsigned long long int */ -MP_SET_XLONG(mp_set_long_long, unsigned long long) +MP_SET_XLONG(mp_set_long_long, Tcl_WideUInt) #endif /* ref: $Format:%D$ */ diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 7d92d97..a8c9e21 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -220,16 +220,16 @@ int mp_set_int(mp_int *a, unsigned long b); int mp_set_long(mp_int *a, unsigned long b); /* set a platform dependent unsigned long long value */ -int mp_set_long_long(mp_int *a, unsigned long long b); +int mp_set_long_long(mp_int *a, Tcl_WideUInt b); /* get a 32-bit value */ -unsigned long mp_get_int(mp_int * a); +unsigned long mp_get_int(const mp_int * a); /* get a platform dependent unsigned long value */ -unsigned long mp_get_long(mp_int * a); +unsigned long mp_get_long(const mp_int * a); /* get a platform dependent unsigned long long value */ -unsigned long long mp_get_long_long(mp_int * a); +Tcl_WideUInt mp_get_long_long(const mp_int * a); /* initialize and set a digit */ int mp_init_set (mp_int * a, mp_digit b); @@ -264,13 +264,13 @@ int mp_lshd(mp_int *a, int b); int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); /* b = a/2 */ -int mp_div_2(mp_int *a, mp_int *b); +int mp_div_2(const mp_int *a, mp_int *b); /* c = a * 2**b, implemented as c = a << b */ int mp_mul_2d(const mp_int *a, int b, mp_int *c); /* b = a*2 */ -int mp_mul_2(mp_int *a, mp_int *b); +int mp_mul_2(const mp_int *a, mp_int *b); /* c = a mod 2**b */ int mp_mod_2d(const mp_int *a, int b, mp_int *c); diff --git a/unix/Makefile.in b/unix/Makefile.in index fadc147..2f97bf5 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -320,7 +320,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_cnt_lsb.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_expt_d.o bn_mp_expt_d_ex.o bn_mp_grow.o bn_mp_init.o \ + bn_mp_exch.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_get_int.o bn_mp_get_long_long.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_set_int.o bn_mp_init_size.o bn_mp_karatsuba_mul.o \ bn_mp_karatsuba_sqr.o \ @@ -328,7 +328,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_neg.o bn_mp_or.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_set_int.o \ - bn_mp_shrink.o \ + bn_mp_set_long_long.o bn_mp_shrink.o \ bn_mp_sqr.o bn_mp_sqrt.o bn_mp_sub.o bn_mp_sub_d.o \ bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o \ bn_mp_toom_mul.o bn_mp_toom_sqr.o bn_mp_toradix_n.o \ @@ -504,6 +504,8 @@ TOMMATH_SRCS = \ $(TOMMATH_DIR)/bn_mp_exch.c \ $(TOMMATH_DIR)/bn_mp_expt_d.c \ $(TOMMATH_DIR)/bn_mp_expt_d_ex.c \ + $(TOMMATH_DIR)/bn_mp_get_int.c \ + $(TOMMATH_DIR)/bn_mp_get_long_long.c \ $(TOMMATH_DIR)/bn_mp_grow.c \ $(TOMMATH_DIR)/bn_mp_init.c \ $(TOMMATH_DIR)/bn_mp_init_copy.c \ @@ -528,6 +530,7 @@ TOMMATH_SRCS = \ $(TOMMATH_DIR)/bn_mp_rshd.c \ $(TOMMATH_DIR)/bn_mp_set.c \ $(TOMMATH_DIR)/bn_mp_set_int.c \ + $(TOMMATH_DIR)/bn_mp_set_long_long.c \ $(TOMMATH_DIR)/bn_mp_shrink.c \ $(TOMMATH_DIR)/bn_mp_sqr.c \ $(TOMMATH_DIR)/bn_mp_sqrt.c \ @@ -1426,6 +1429,12 @@ bn_mp_expt_d.o: $(TOMMATH_DIR)/bn_mp_expt_d.c $(MATHHDRS) bn_mp_expt_d_ex.o: $(TOMMATH_DIR)/bn_mp_expt_d_ex.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_expt_d_ex.c +bn_mp_get_int.o: $(TOMMATH_DIR)/bn_mp_get_int.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_get_int.c + +bn_mp_get_long_long.o: $(TOMMATH_DIR)/bn_mp_get_long_long.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_get_long_long.c + bn_mp_grow.o: $(TOMMATH_DIR)/bn_mp_grow.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_grow.c @@ -1498,6 +1507,9 @@ bn_mp_set.o: $(TOMMATH_DIR)/bn_mp_set.c $(MATHHDRS) bn_mp_set_int.o: $(TOMMATH_DIR)/bn_mp_set_int.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set_int.c +bn_mp_set_long_long.o: $(TOMMATH_DIR)/bn_mp_set_long_long.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set_long_long.c + bn_mp_shrink.o: $(TOMMATH_DIR)/bn_mp_shrink.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_shrink.c diff --git a/unix/tcl.spec b/unix/tcl.spec index 868a226..265e4df 100644 --- a/unix/tcl.spec +++ b/unix/tcl.spec @@ -4,7 +4,7 @@ Name: tcl Summary: Tcl scripting language development environment -Version: 8.7a0 +Version: 8.7a2 Release: 2 License: BSD Group: Development/Languages diff --git a/win/Makefile.in b/win/Makefile.in index 24cb5b2..4a0f839 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -329,6 +329,8 @@ TOMMATH_OBJS = \ bn_mp_exch.${OBJEXT} \ bn_mp_expt_d.${OBJEXT} \ bn_mp_expt_d_ex.${OBJEXT} \ + bn_mp_get_int.${OBJEXT} \ + bn_mp_get_long_long.${OBJEXT} \ bn_mp_grow.${OBJEXT} \ bn_mp_init.${OBJEXT} \ bn_mp_init_copy.${OBJEXT} \ @@ -353,6 +355,7 @@ TOMMATH_OBJS = \ bn_mp_rshd.${OBJEXT} \ bn_mp_set.${OBJEXT} \ bn_mp_set_int.${OBJEXT} \ + bn_mp_set_long_long.${OBJEXT} \ bn_mp_shrink.${OBJEXT} \ bn_mp_sqr.${OBJEXT} \ bn_mp_sqrt.${OBJEXT} \ diff --git a/win/makefile.vc b/win/makefile.vc index 5566df2..ca8cc08 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -384,6 +384,8 @@ TOMMATHOBJS = \ $(TMP_DIR)\bn_mp_exch.obj \ $(TMP_DIR)\bn_mp_expt_d.obj \ $(TMP_DIR)\bn_mp_expt_d_ex.obj \ + $(TMP_DIR)\bn_mp_get_int.obj \ + $(TMP_DIR)\bn_mp_get_long_long.obj \ $(TMP_DIR)\bn_mp_grow.obj \ $(TMP_DIR)\bn_mp_init.obj \ $(TMP_DIR)\bn_mp_init_copy.obj \ @@ -408,6 +410,7 @@ TOMMATHOBJS = \ $(TMP_DIR)\bn_mp_rshd.obj \ $(TMP_DIR)\bn_mp_set.obj \ $(TMP_DIR)\bn_mp_set_int.obj \ + $(TMP_DIR)\bn_mp_set_long_long.obj \ $(TMP_DIR)\bn_mp_shrink.obj \ $(TMP_DIR)\bn_mp_sqr.obj \ $(TMP_DIR)\bn_mp_sqrt.obj \ -- cgit v0.12 From 3e55dbb18cf086d34207ca2e744ecea04cc67b38 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 11 Sep 2017 10:38:07 +0000 Subject: Many 'const' addtions in libtommath where it makes sense. To be submitted back to the libtommath guys. --- generic/tclTomMath.decls | 50 +++++++-------- generic/tclTomMath.h | 38 +++++------ generic/tclTomMathDecls.h | 125 ++++++++++++++++++++----------------- libtommath/bn_fast_s_mp_mul_digs.c | 2 +- libtommath/bn_fast_s_mp_sqr.c | 2 +- libtommath/bn_mp_add.c | 2 +- libtommath/bn_mp_and.c | 5 +- libtommath/bn_mp_div.c | 4 +- libtommath/bn_mp_div_3.c | 2 +- libtommath/bn_mp_div_d.c | 2 +- libtommath/bn_mp_expt_d.c | 2 +- libtommath/bn_mp_expt_d_ex.c | 2 +- libtommath/bn_mp_karatsuba_mul.c | 2 +- libtommath/bn_mp_karatsuba_sqr.c | 2 +- libtommath/bn_mp_mod.c | 2 +- libtommath/bn_mp_mul.c | 2 +- libtommath/bn_mp_mul_d.c | 2 +- libtommath/bn_mp_or.c | 5 +- libtommath/bn_mp_sqr.c | 2 +- libtommath/bn_mp_sqrt.c | 2 +- libtommath/bn_mp_sub.c | 2 +- libtommath/bn_mp_toom_mul.c | 2 +- libtommath/bn_mp_toom_sqr.c | 2 +- libtommath/bn_mp_xor.c | 5 +- libtommath/bn_s_mp_add.c | 4 +- libtommath/bn_s_mp_mul_digs.c | 2 +- libtommath/bn_s_mp_sqr.c | 2 +- libtommath/bn_s_mp_sub.c | 2 +- libtommath/tommath.h | 36 +++++------ libtommath/tommath_private.h | 20 +++--- 30 files changed, 174 insertions(+), 158 deletions(-) diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index c4299d0..5d1c8e8 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -30,13 +30,13 @@ declare 1 { } declare 2 { - int TclBN_mp_add(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_add(const mp_int *a, const mp_int *b, mp_int *c) } declare 3 { int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c) } declare 4 { - int TclBN_mp_and(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_and(const mp_int *a, const mp_int *b, mp_int *c) } declare 5 { void TclBN_mp_clamp(mp_int *a) @@ -63,10 +63,10 @@ declare 12 { int TclBN_mp_count_bits(const mp_int *a) } declare 13 { - int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q, mp_int *r) + int TclBN_mp_div(const mp_int *a, const mp_int *b, mp_int *q, mp_int *r) } declare 14 { - int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, mp_digit *r) + int TclBN_mp_div_d(const mp_int *a, mp_digit b, mp_int *q, mp_digit *r) } declare 15 { int TclBN_mp_div_2(const mp_int *a, mp_int *q) @@ -75,13 +75,13 @@ declare 16 { int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r) } declare 17 { - int TclBN_mp_div_3(mp_int *a, mp_int *q, mp_digit *r) + int TclBN_mp_div_3(const mp_int *a, mp_int *q, mp_digit *r) } declare 18 { void TclBN_mp_exch(mp_int *a, mp_int *b) } declare 19 { - int TclBN_mp_expt_d(mp_int *a, mp_digit b, mp_int *c) + int TclBN_mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) } declare 20 { int TclBN_mp_grow(mp_int *a, int size) @@ -105,16 +105,16 @@ declare 26 { int TclBN_mp_lshd(mp_int *a, int shift) } declare 27 { - int TclBN_mp_mod(mp_int *a, mp_int *b, mp_int *r) + int TclBN_mp_mod(const mp_int *a, const mp_int *b, mp_int *r) } declare 28 { int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r) } declare 29 { - int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p) + int TclBN_mp_mul(const mp_int *a, const mp_int *b, mp_int *p) } declare 30 { - int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p) + int TclBN_mp_mul_d(const mp_int *a, mp_digit b, mp_int *p) } declare 31 { int TclBN_mp_mul_2(const mp_int *a, mp_int *p) @@ -126,7 +126,7 @@ declare 33 { int TclBN_mp_neg(const mp_int *a, mp_int *b) } declare 34 { - int TclBN_mp_or(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_or(const mp_int *a, const mp_int *b, mp_int *c) } declare 35 { int TclBN_mp_radix_size(const mp_int *a, int radix, int *size) @@ -144,13 +144,13 @@ declare 39 { void TclBN_mp_set(mp_int *a, mp_digit b) } declare 40 { - int TclBN_mp_sqr(mp_int *a, mp_int *b) + int TclBN_mp_sqr(const mp_int *a, mp_int *b) } declare 41 { - int TclBN_mp_sqrt(mp_int *a, mp_int *b) + int TclBN_mp_sqrt(const mp_int *a, mp_int *b) } declare 42 { - int TclBN_mp_sub(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) } declare 43 { int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c) @@ -169,7 +169,7 @@ declare 47 { int TclBN_mp_unsigned_bin_size(mp_int *a) } declare 48 { - int TclBN_mp_xor(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c) } declare 49 { void TclBN_mp_zero(mp_int *a) @@ -182,34 +182,34 @@ declare 50 { void TclBN_reverse(unsigned char *s, int len) } declare 51 { - int TclBN_fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) + int TclBN_fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) } declare 52 { - int TclBN_fast_s_mp_sqr(mp_int *a, mp_int *b) + int TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b) } declare 53 { - int TclBN_mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c) } declare 54 { - int TclBN_mp_karatsuba_sqr(mp_int *a, mp_int *b) + int TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b) } declare 55 { - int TclBN_mp_toom_mul(mp_int *a, mp_int *b, mp_int *c) + int TclBN_mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c) } declare 56 { - int TclBN_mp_toom_sqr(mp_int *a, mp_int *b) + int TclBN_mp_toom_sqr(const mp_int *a, mp_int *b) } declare 57 { - int TclBN_s_mp_add(mp_int *a, mp_int *b, mp_int *c) + int TclBN_s_mp_add(const mp_int *a, const mp_int *b, mp_int *c) } declare 58 { - int TclBN_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) + int TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) } declare 59 { - int TclBN_s_mp_sqr(mp_int *a, mp_int *b) + int TclBN_s_mp_sqr(const mp_int *a, mp_int *b) } declare 60 { - int TclBN_s_mp_sub(mp_int *a, mp_int *b, mp_int *c) + int TclBN_s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) } declare 61 { int TclBN_mp_init_set_int(mp_int *a, unsigned long i) @@ -235,7 +235,7 @@ declare 66 { # Added in libtommath 1.0 declare 67 { - int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast) + int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) } # Added in libtommath 1.0.1 declare 68 { diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 7e3c29e..2ce8194 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -27,7 +27,7 @@ extern "C" { #endif /* detect 64-bit mode if possible */ -#if defined(NEVER) /* 128-bit ints fail in too many places */ +#if defined(NEVER) #if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) #define MP_64BIT #endif @@ -383,17 +383,17 @@ int mp_rand(mp_int *a, int digits); /* ---> binary operations <--- */ /* c = a XOR b */ /* -int mp_xor(mp_int *a, mp_int *b, mp_int *c); +int mp_xor(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = a OR b */ /* -int mp_or(mp_int *a, mp_int *b, mp_int *c); +int mp_or(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = a AND b */ /* -int mp_and(mp_int *a, mp_int *b, mp_int *c); +int mp_and(const mp_int *a, const mp_int *b, mp_int *c); */ /* ---> Basic arithmetic <--- */ @@ -405,7 +405,7 @@ int mp_neg(const mp_int *a, mp_int *b); /* b = |a| */ /* -int mp_abs(mp_int *a, mp_int *b); +int mp_abs(const mp_int *a, mp_int *b); */ /* compare a to b */ @@ -420,32 +420,32 @@ int mp_cmp_mag(const mp_int *a, const mp_int *b); /* c = a + b */ /* -int mp_add(mp_int *a, mp_int *b, mp_int *c); +int mp_add(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = a - b */ /* -int mp_sub(mp_int *a, mp_int *b, mp_int *c); +int mp_sub(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = a * b */ /* -int mp_mul(mp_int *a, mp_int *b, mp_int *c); +int mp_mul(const mp_int *a, const mp_int *b, mp_int *c); */ /* b = a*a */ /* -int mp_sqr(mp_int *a, mp_int *b); +int mp_sqr(const mp_int *a, mp_int *b); */ /* a/b => cb + d == a */ /* -int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d); */ /* c = a mod b, 0 <= c < b */ /* -int mp_mod(mp_int *a, mp_int *b, mp_int *c); +int mp_mod(const mp_int *a, const mp_int *b, mp_int *c); */ /* ---> single digit functions <--- */ @@ -457,40 +457,40 @@ int mp_cmp_d(const mp_int *a, mp_digit b); /* c = a + b */ /* -int mp_add_d(mp_int *a, mp_digit b, mp_int *c); +int mp_add_d(const mp_int *a, const mp_digit b, mp_int *c); */ /* c = a - b */ /* -int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); +int mp_sub_d(const mp_int *a, mp_digit b, mp_int *c); */ /* c = a * b */ /* -int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); +int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c); */ /* a/b => cb + d == a */ /* -int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d); +int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d); */ /* a/3 => 3c + d == a */ /* -int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); +int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d); */ /* c = a**b */ /* -int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); +int mp_expt_d(const mp_int *a, const mp_digit b, mp_int *c); */ /* -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast); +int mp_expt_d_ex (const mp_int * a, const mp_digit b, mp_int * c, int fast); */ /* c = a mod b, 0 <= c < b */ /* -int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); +int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); */ /* ---> number theory <--- */ diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 70de3b1..9d683dc 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -151,11 +151,13 @@ EXTERN int TclBN_epoch(void); /* 1 */ EXTERN int TclBN_revision(void); /* 2 */ -EXTERN int TclBN_mp_add(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_add(const mp_int *a, const mp_int *b, + mp_int *c); /* 3 */ EXTERN int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c); /* 4 */ -EXTERN int TclBN_mp_and(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_and(const mp_int *a, const mp_int *b, + mp_int *c); /* 5 */ EXTERN void TclBN_mp_clamp(mp_int *a); /* 6 */ @@ -173,22 +175,24 @@ EXTERN int TclBN_mp_copy(const mp_int *a, mp_int *b); /* 12 */ EXTERN int TclBN_mp_count_bits(const mp_int *a); /* 13 */ -EXTERN int TclBN_mp_div(mp_int *a, mp_int *b, mp_int *q, - mp_int *r); +EXTERN int TclBN_mp_div(const mp_int *a, const mp_int *b, + mp_int *q, mp_int *r); /* 14 */ -EXTERN int TclBN_mp_div_d(mp_int *a, mp_digit b, mp_int *q, - mp_digit *r); +EXTERN int TclBN_mp_div_d(const mp_int *a, mp_digit b, + mp_int *q, mp_digit *r); /* 15 */ EXTERN int TclBN_mp_div_2(const mp_int *a, mp_int *q); /* 16 */ EXTERN int TclBN_mp_div_2d(const mp_int *a, int b, mp_int *q, mp_int *r); /* 17 */ -EXTERN int TclBN_mp_div_3(mp_int *a, mp_int *q, mp_digit *r); +EXTERN int TclBN_mp_div_3(const mp_int *a, mp_int *q, + mp_digit *r); /* 18 */ EXTERN void TclBN_mp_exch(mp_int *a, mp_int *b); /* 19 */ -EXTERN int TclBN_mp_expt_d(mp_int *a, mp_digit b, mp_int *c); +EXTERN int TclBN_mp_expt_d(const mp_int *a, mp_digit b, + mp_int *c); /* 20 */ EXTERN int TclBN_mp_grow(mp_int *a, int size); /* 21 */ @@ -204,13 +208,16 @@ EXTERN int TclBN_mp_init_size(mp_int *a, int size); /* 26 */ EXTERN int TclBN_mp_lshd(mp_int *a, int shift); /* 27 */ -EXTERN int TclBN_mp_mod(mp_int *a, mp_int *b, mp_int *r); +EXTERN int TclBN_mp_mod(const mp_int *a, const mp_int *b, + mp_int *r); /* 28 */ EXTERN int TclBN_mp_mod_2d(const mp_int *a, int b, mp_int *r); /* 29 */ -EXTERN int TclBN_mp_mul(mp_int *a, mp_int *b, mp_int *p); +EXTERN int TclBN_mp_mul(const mp_int *a, const mp_int *b, + mp_int *p); /* 30 */ -EXTERN int TclBN_mp_mul_d(mp_int *a, mp_digit b, mp_int *p); +EXTERN int TclBN_mp_mul_d(const mp_int *a, mp_digit b, + mp_int *p); /* 31 */ EXTERN int TclBN_mp_mul_2(const mp_int *a, mp_int *p); /* 32 */ @@ -218,7 +225,8 @@ EXTERN int TclBN_mp_mul_2d(const mp_int *a, int d, mp_int *p); /* 33 */ EXTERN int TclBN_mp_neg(const mp_int *a, mp_int *b); /* 34 */ -EXTERN int TclBN_mp_or(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_or(const mp_int *a, const mp_int *b, + mp_int *c); /* 35 */ EXTERN int TclBN_mp_radix_size(const mp_int *a, int radix, int *size); @@ -232,11 +240,12 @@ EXTERN int TclBN_mp_shrink(mp_int *a); /* 39 */ EXTERN void TclBN_mp_set(mp_int *a, mp_digit b); /* 40 */ -EXTERN int TclBN_mp_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_sqr(const mp_int *a, mp_int *b); /* 41 */ -EXTERN int TclBN_mp_sqrt(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_sqrt(const mp_int *a, mp_int *b); /* 42 */ -EXTERN int TclBN_mp_sub(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_sub(const mp_int *a, const mp_int *b, + mp_int *c); /* 43 */ EXTERN int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c); /* 44 */ @@ -250,34 +259,38 @@ EXTERN int TclBN_mp_toradix_n(mp_int *a, char *str, int radix, /* 47 */ EXTERN int TclBN_mp_unsigned_bin_size(mp_int *a); /* 48 */ -EXTERN int TclBN_mp_xor(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_xor(const mp_int *a, const mp_int *b, + mp_int *c); /* 49 */ EXTERN void TclBN_mp_zero(mp_int *a); /* 50 */ EXTERN void TclBN_reverse(unsigned char *s, int len); /* 51 */ -EXTERN int TclBN_fast_s_mp_mul_digs(mp_int *a, mp_int *b, - mp_int *c, int digs); +EXTERN int TclBN_fast_s_mp_mul_digs(const mp_int *a, + const mp_int *b, mp_int *c, int digs); /* 52 */ -EXTERN int TclBN_fast_s_mp_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_fast_s_mp_sqr(const mp_int *a, mp_int *b); /* 53 */ -EXTERN int TclBN_mp_karatsuba_mul(mp_int *a, mp_int *b, - mp_int *c); +EXTERN int TclBN_mp_karatsuba_mul(const mp_int *a, + const mp_int *b, mp_int *c); /* 54 */ -EXTERN int TclBN_mp_karatsuba_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_karatsuba_sqr(const mp_int *a, mp_int *b); /* 55 */ -EXTERN int TclBN_mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_mp_toom_mul(const mp_int *a, const mp_int *b, + mp_int *c); /* 56 */ -EXTERN int TclBN_mp_toom_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_mp_toom_sqr(const mp_int *a, mp_int *b); /* 57 */ -EXTERN int TclBN_s_mp_add(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_s_mp_add(const mp_int *a, const mp_int *b, + mp_int *c); /* 58 */ -EXTERN int TclBN_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, - int digs); +EXTERN int TclBN_s_mp_mul_digs(const mp_int *a, const mp_int *b, + mp_int *c, int digs); /* 59 */ -EXTERN int TclBN_s_mp_sqr(mp_int *a, mp_int *b); +EXTERN int TclBN_s_mp_sqr(const mp_int *a, mp_int *b); /* 60 */ -EXTERN int TclBN_s_mp_sub(mp_int *a, mp_int *b, mp_int *c); +EXTERN int TclBN_s_mp_sub(const mp_int *a, const mp_int *b, + mp_int *c); /* 61 */ EXTERN int TclBN_mp_init_set_int(mp_int *a, unsigned long i); /* 62 */ @@ -293,8 +306,8 @@ EXTERN void TclBNInitBignumFromWideInt(mp_int *bignum, EXTERN void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal); /* 67 */ -EXTERN int TclBN_mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, - int fast); +EXTERN int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, + mp_int *c, int fast); /* 68 */ EXTERN int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i); /* 69 */ @@ -306,9 +319,9 @@ typedef struct TclTomMathStubs { int (*tclBN_epoch) (void); /* 0 */ int (*tclBN_revision) (void); /* 1 */ - int (*tclBN_mp_add) (mp_int *a, mp_int *b, mp_int *c); /* 2 */ + int (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 2 */ int (*tclBN_mp_add_d) (mp_int *a, mp_digit b, mp_int *c); /* 3 */ - int (*tclBN_mp_and) (mp_int *a, mp_int *b, mp_int *c); /* 4 */ + int (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 4 */ void (*tclBN_mp_clamp) (mp_int *a); /* 5 */ void (*tclBN_mp_clear) (mp_int *a); /* 6 */ void (*tclBN_mp_clear_multi) (mp_int *a, ...); /* 7 */ @@ -317,13 +330,13 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_cmp_mag) (const mp_int *a, const mp_int *b); /* 10 */ int (*tclBN_mp_copy) (const mp_int *a, mp_int *b); /* 11 */ int (*tclBN_mp_count_bits) (const mp_int *a); /* 12 */ - int (*tclBN_mp_div) (mp_int *a, mp_int *b, mp_int *q, mp_int *r); /* 13 */ - int (*tclBN_mp_div_d) (mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */ + int (*tclBN_mp_div) (const mp_int *a, const mp_int *b, mp_int *q, mp_int *r); /* 13 */ + int (*tclBN_mp_div_d) (const mp_int *a, mp_digit b, mp_int *q, mp_digit *r); /* 14 */ int (*tclBN_mp_div_2) (const mp_int *a, mp_int *q); /* 15 */ int (*tclBN_mp_div_2d) (const mp_int *a, int b, mp_int *q, mp_int *r); /* 16 */ - int (*tclBN_mp_div_3) (mp_int *a, mp_int *q, mp_digit *r); /* 17 */ + int (*tclBN_mp_div_3) (const mp_int *a, mp_int *q, mp_digit *r); /* 17 */ void (*tclBN_mp_exch) (mp_int *a, mp_int *b); /* 18 */ - int (*tclBN_mp_expt_d) (mp_int *a, mp_digit b, mp_int *c); /* 19 */ + int (*tclBN_mp_expt_d) (const mp_int *a, mp_digit b, mp_int *c); /* 19 */ int (*tclBN_mp_grow) (mp_int *a, int size); /* 20 */ int (*tclBN_mp_init) (mp_int *a); /* 21 */ int (*tclBN_mp_init_copy) (mp_int *a, const mp_int *b); /* 22 */ @@ -331,47 +344,47 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_init_set) (mp_int *a, mp_digit b); /* 24 */ int (*tclBN_mp_init_size) (mp_int *a, int size); /* 25 */ int (*tclBN_mp_lshd) (mp_int *a, int shift); /* 26 */ - int (*tclBN_mp_mod) (mp_int *a, mp_int *b, mp_int *r); /* 27 */ + int (*tclBN_mp_mod) (const mp_int *a, const mp_int *b, mp_int *r); /* 27 */ int (*tclBN_mp_mod_2d) (const mp_int *a, int b, mp_int *r); /* 28 */ - int (*tclBN_mp_mul) (mp_int *a, mp_int *b, mp_int *p); /* 29 */ - int (*tclBN_mp_mul_d) (mp_int *a, mp_digit b, mp_int *p); /* 30 */ + int (*tclBN_mp_mul) (const mp_int *a, const mp_int *b, mp_int *p); /* 29 */ + int (*tclBN_mp_mul_d) (const mp_int *a, mp_digit b, mp_int *p); /* 30 */ int (*tclBN_mp_mul_2) (const mp_int *a, mp_int *p); /* 31 */ int (*tclBN_mp_mul_2d) (const mp_int *a, int d, mp_int *p); /* 32 */ int (*tclBN_mp_neg) (const mp_int *a, mp_int *b); /* 33 */ - int (*tclBN_mp_or) (mp_int *a, mp_int *b, mp_int *c); /* 34 */ + int (*tclBN_mp_or) (const mp_int *a, const mp_int *b, mp_int *c); /* 34 */ int (*tclBN_mp_radix_size) (const mp_int *a, int radix, int *size); /* 35 */ int (*tclBN_mp_read_radix) (mp_int *a, const char *str, int radix); /* 36 */ void (*tclBN_mp_rshd) (mp_int *a, int shift); /* 37 */ int (*tclBN_mp_shrink) (mp_int *a); /* 38 */ void (*tclBN_mp_set) (mp_int *a, mp_digit b); /* 39 */ - int (*tclBN_mp_sqr) (mp_int *a, mp_int *b); /* 40 */ - int (*tclBN_mp_sqrt) (mp_int *a, mp_int *b); /* 41 */ - int (*tclBN_mp_sub) (mp_int *a, mp_int *b, mp_int *c); /* 42 */ + int (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */ + int (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */ + int (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */ int (*tclBN_mp_sub_d) (mp_int *a, mp_digit b, mp_int *c); /* 43 */ int (*tclBN_mp_to_unsigned_bin) (mp_int *a, unsigned char *b); /* 44 */ int (*tclBN_mp_to_unsigned_bin_n) (mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */ int (*tclBN_mp_toradix_n) (mp_int *a, char *str, int radix, int maxlen); /* 46 */ int (*tclBN_mp_unsigned_bin_size) (mp_int *a); /* 47 */ - int (*tclBN_mp_xor) (mp_int *a, mp_int *b, mp_int *c); /* 48 */ + int (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */ void (*tclBN_mp_zero) (mp_int *a); /* 49 */ void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */ - int (*tclBN_fast_s_mp_mul_digs) (mp_int *a, mp_int *b, mp_int *c, int digs); /* 51 */ - int (*tclBN_fast_s_mp_sqr) (mp_int *a, mp_int *b); /* 52 */ - int (*tclBN_mp_karatsuba_mul) (mp_int *a, mp_int *b, mp_int *c); /* 53 */ - int (*tclBN_mp_karatsuba_sqr) (mp_int *a, mp_int *b); /* 54 */ - int (*tclBN_mp_toom_mul) (mp_int *a, mp_int *b, mp_int *c); /* 55 */ - int (*tclBN_mp_toom_sqr) (mp_int *a, mp_int *b); /* 56 */ - int (*tclBN_s_mp_add) (mp_int *a, mp_int *b, mp_int *c); /* 57 */ - int (*tclBN_s_mp_mul_digs) (mp_int *a, mp_int *b, mp_int *c, int digs); /* 58 */ - int (*tclBN_s_mp_sqr) (mp_int *a, mp_int *b); /* 59 */ - int (*tclBN_s_mp_sub) (mp_int *a, mp_int *b, mp_int *c); /* 60 */ + int (*tclBN_fast_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 51 */ + int (*tclBN_fast_s_mp_sqr) (const mp_int *a, mp_int *b); /* 52 */ + int (*tclBN_mp_karatsuba_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 53 */ + int (*tclBN_mp_karatsuba_sqr) (const mp_int *a, mp_int *b); /* 54 */ + int (*tclBN_mp_toom_mul) (const mp_int *a, const mp_int *b, mp_int *c); /* 55 */ + int (*tclBN_mp_toom_sqr) (const mp_int *a, mp_int *b); /* 56 */ + int (*tclBN_s_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 57 */ + int (*tclBN_s_mp_mul_digs) (const mp_int *a, const mp_int *b, mp_int *c, int digs); /* 58 */ + int (*tclBN_s_mp_sqr) (const mp_int *a, mp_int *b); /* 59 */ + int (*tclBN_s_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 60 */ int (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */ int (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */ int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */ void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ - int (*tclBN_mp_expt_d_ex) (mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ + int (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */ Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */ } TclTomMathStubs; diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index a1015af..641b574 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -31,7 +31,7 @@ * Based on Algorithm 14.12 on pp.595 of HAC. * */ -int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int fast_s_mp_mul_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY]; diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index f435af9..282d303 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -25,7 +25,7 @@ After that loop you do the squares and add them in. */ -int fast_s_mp_sqr (mp_int * a, mp_int * b) +int fast_s_mp_sqr (const mp_int * a, mp_int * b) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY], *tmpx; diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index bdb166f..a68c02e 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -16,7 +16,7 @@ */ /* high level addition (handles signs) */ -int mp_add (mp_int * a, mp_int * b, mp_int * c) +int mp_add (const mp_int * a, const mp_int * b, mp_int * c) { int sa, sb, res; diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 53008a5..e90ab37 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -17,10 +17,11 @@ /* AND two ints together */ int -mp_and (mp_int * a, mp_int * b, mp_int * c) +mp_and (const mp_int * a, const mp_int * b, mp_int * c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy (&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 0890e65..30b36b6 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -18,7 +18,7 @@ #ifdef BN_MP_DIV_SMALL /* slower bit-bang division... also smaller */ -int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_div(const mp_int * a, const mp_int * b, mp_int * c, mp_int * d) { mp_int ta, tb, tq, q; int res, n, n2; @@ -100,7 +100,7 @@ LBL_ERR: * The overall algorithm is as described as * 14.20 from HAC but fixed to treat these cases. */ -int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_div (const mp_int * a, const mp_int * b, mp_int * c, mp_int * d) { mp_int q, x, y, t1, t2; int res, n, t, i, norm, neg; diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index e8504ea..5e75438 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -17,7 +17,7 @@ /* divide by three (based on routine from MPI and the GMP manual) */ int -mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) +mp_div_3 (const mp_int * a, mp_int *c, mp_digit * d) { mp_int q; mp_word w, t; diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index d1f2774..4767565 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -33,7 +33,7 @@ static int s_is_power_of_two(mp_digit b, int *p) } /* single digit division (based on routine from MPI) */ -int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) +int mp_div_d (const mp_int * a, mp_digit b, mp_int * c, mp_digit * d) { mp_int q; mp_word w; diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index a311926..ffa3b93 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -16,7 +16,7 @@ */ /* wrapper function for mp_expt_d_ex() */ -int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) +int mp_expt_d (const mp_int * a, mp_digit b, mp_int * c) { return mp_expt_d_ex(a, b, c, 0); } diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index c361b27..545d156 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -16,7 +16,7 @@ */ /* calculate c = a**b using a square-multiply algorithm */ -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) +int mp_expt_d_ex (const mp_int * a, mp_digit b, mp_int * c, int fast) { int res; unsigned int x; diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index 4d982c7..1e6a42b 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -44,7 +44,7 @@ * Generally though the overhead of this method doesn't pay off * until a certain size (N ~ 80) is reached. */ -int mp_karatsuba_mul (mp_int * a, mp_int * b, mp_int * c) +int mp_karatsuba_mul (const mp_int * a, const mp_int * b, mp_int * c) { mp_int x0, x1, y0, y1, t1, x0y0, x1y1; int B, err; diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c index 764e85a..90624d0 100644 --- a/libtommath/bn_mp_karatsuba_sqr.c +++ b/libtommath/bn_mp_karatsuba_sqr.c @@ -22,7 +22,7 @@ * is essentially the same algorithm but merely * tuned to perform recursive squarings. */ -int mp_karatsuba_sqr (mp_int * a, mp_int * b) +int mp_karatsuba_sqr (const mp_int * a, mp_int * b) { mp_int x0, x1, t1, t2, x0x0, x1x1; int B, err; diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index 06240a0..fff0f92 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -17,7 +17,7 @@ /* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */ int -mp_mod (mp_int * a, mp_int * b, mp_int * c) +mp_mod (const mp_int * a, const mp_int * b, mp_int * c) { mp_int t; int res; diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index cc3b9c8..b8b85c8 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -16,7 +16,7 @@ */ /* high level multiplication (handles sign) */ -int mp_mul (mp_int * a, mp_int * b, mp_int * c) +int mp_mul (const mp_int * a, const mp_int * b, mp_int * c) { int res, neg; neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index 6954ed3..266b082 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -17,7 +17,7 @@ /* multiply by a digit */ int -mp_mul_d (mp_int * a, mp_digit b, mp_int * c) +mp_mul_d (const mp_int * a, mp_digit b, mp_int * c) { mp_digit u, *tmpa, *tmpc; mp_word r; diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index b9775ce..afe8467 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -16,10 +16,11 @@ */ /* OR two ints together */ -int mp_or (mp_int * a, mp_int * b, mp_int * c) +int mp_or (const mp_int * a, const mp_int * b, mp_int * c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy (&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index ffe94e2..a61f506 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -17,7 +17,7 @@ /* computes b = a*a */ int -mp_sqr (mp_int * a, mp_int * b) +mp_sqr (const mp_int * a, mp_int * b) { int res; diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index 775e85f..ce8bd0e 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -20,7 +20,7 @@ #endif /* this function is less generic than mp_n_root, simpler and faster */ -int mp_sqrt(mp_int *arg, mp_int *ret) +int mp_sqrt(const mp_int *arg, mp_int *ret) { int res; mp_int t1,t2; diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index 2f73faa..9ff03d5 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -17,7 +17,7 @@ /* high level subtraction (handles signs) */ int -mp_sub (mp_int * a, mp_int * b, mp_int * c) +mp_sub (const mp_int * a, const mp_int * b, mp_int * c) { int sa, sb, res; diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index 4a574fc..0bf940d 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -22,7 +22,7 @@ * only particularly useful on VERY large inputs * (we're talking 1000s of digits here...). */ -int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c) +int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c) { mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2; int res, B; diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 0a38192..842ae47 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -17,7 +17,7 @@ /* squaring using Toom-Cook 3-way algorithm */ int -mp_toom_sqr(mp_int *a, mp_int *b) +mp_toom_sqr(const mp_int *a, mp_int *b) { mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; int res, B; diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index f51fc8e..9f7b086 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -17,10 +17,11 @@ /* XOR two ints together */ int -mp_xor (mp_int * a, mp_int * b, mp_int * c) +mp_xor (const mp_int * a, const mp_int * b, mp_int * c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy (&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 7a100e8..432e3b4 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -17,9 +17,9 @@ /* low level addition, based on HAC pp.594, Algorithm 14.7 */ int -s_mp_add (mp_int * a, mp_int * b, mp_int * c) +s_mp_add (const mp_int * a, const mp_int * b, mp_int * c) { - mp_int *x; + const mp_int *x; int olduse, res, min, max; /* find sizes, we let |a| <= |b| which means we have to sort diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index 8f1bf97..d32bf15 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -19,7 +19,7 @@ * HAC pp. 595, Algorithm 14.12 Modified so you can control how * many digits of output are created. */ -int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int s_mp_mul_digs (const mp_int * a, const mp_int * b, mp_int * c, int digs) { mp_int t; int res, pa, pb, ix, iy; diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index ac0e157..de6a3ea 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -16,7 +16,7 @@ */ /* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */ -int s_mp_sqr (mp_int * a, mp_int * b) +int s_mp_sqr (const mp_int * a, mp_int * b) { mp_int t; int res, ix, iy, pa; diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index 8091f4a..7f49d66 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -17,7 +17,7 @@ /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ int -s_mp_sub (mp_int * a, mp_int * b, mp_int * c) +s_mp_sub (const mp_int * a, const mp_int * b, mp_int * c) { int olduse, res, min, max; diff --git a/libtommath/tommath.h b/libtommath/tommath.h index a8c9e21..b183b8a 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -288,13 +288,13 @@ int mp_rand(mp_int *a, int digits); /* ---> binary operations <--- */ /* c = a XOR b */ -int mp_xor(mp_int *a, mp_int *b, mp_int *c); +int mp_xor(const mp_int *a, const mp_int *b, mp_int *c); /* c = a OR b */ -int mp_or(mp_int *a, mp_int *b, mp_int *c); +int mp_or(const mp_int *a, const mp_int *b, mp_int *c); /* c = a AND b */ -int mp_and(mp_int *a, mp_int *b, mp_int *c); +int mp_and(const mp_int *a, const mp_int *b, mp_int *c); /* ---> Basic arithmetic <--- */ @@ -302,7 +302,7 @@ int mp_and(mp_int *a, mp_int *b, mp_int *c); int mp_neg(const mp_int *a, mp_int *b); /* b = |a| */ -int mp_abs(mp_int *a, mp_int *b); +int mp_abs(const mp_int *a, mp_int *b); /* compare a to b */ int mp_cmp(const mp_int *a, const mp_int *b); @@ -311,22 +311,22 @@ int mp_cmp(const mp_int *a, const mp_int *b); int mp_cmp_mag(const mp_int *a, const mp_int *b); /* c = a + b */ -int mp_add(mp_int *a, mp_int *b, mp_int *c); +int mp_add(const mp_int *a, const mp_int *b, mp_int *c); /* c = a - b */ -int mp_sub(mp_int *a, mp_int *b, mp_int *c); +int mp_sub(const mp_int *a, const mp_int *b, mp_int *c); /* c = a * b */ -int mp_mul(mp_int *a, mp_int *b, mp_int *c); +int mp_mul(const mp_int *a, const mp_int *b, mp_int *c); /* b = a*a */ -int mp_sqr(mp_int *a, mp_int *b); +int mp_sqr(const mp_int *a, mp_int *b); /* a/b => cb + d == a */ -int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d); /* c = a mod b, 0 <= c < b */ -int mp_mod(mp_int *a, mp_int *b, mp_int *c); +int mp_mod(const mp_int *a, const mp_int *b, mp_int *c); /* ---> single digit functions <--- */ @@ -334,26 +334,26 @@ int mp_mod(mp_int *a, mp_int *b, mp_int *c); int mp_cmp_d(const mp_int *a, mp_digit b); /* c = a + b */ -int mp_add_d(mp_int *a, mp_digit b, mp_int *c); +int mp_add_d(const mp_int *a, const mp_digit b, mp_int *c); /* c = a - b */ int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); /* c = a * b */ -int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); +int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c); /* a/b => cb + d == a */ -int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d); +int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d); /* a/3 => 3c + d == a */ -int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); +int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d); /* c = a**b */ -int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast); +int mp_expt_d(const mp_int *a, const mp_digit b, mp_int *c); +int mp_expt_d_ex (const mp_int * a, const mp_digit b, mp_int * c, int fast); /* c = a mod b, 0 <= c < b */ -int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); +int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); /* ---> number theory <--- */ @@ -389,7 +389,7 @@ int mp_n_root(mp_int *a, mp_digit b, mp_int *c); int mp_n_root_ex (mp_int * a, mp_digit b, mp_int * c, int fast); /* special sqrt algo */ -int mp_sqrt(mp_int *arg, mp_int *ret); +int mp_sqrt(const mp_int *arg, mp_int *ret); /* special sqrt (mod prime) */ int mp_sqrtmod_prime(mp_int *arg, mp_int *prime, mp_int *ret); diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 3217ee7..07607a8 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -57,19 +57,19 @@ extern "C" { #endif /* lowlevel functions, do not call! */ -int s_mp_add(mp_int *a, mp_int *b, mp_int *c); -int s_mp_sub(mp_int *a, mp_int *b, mp_int *c); +int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c); +int s_mp_sub(const mp_int *a, const 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) -int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int fast_s_mp_sqr(mp_int *a, mp_int *b); -int s_mp_sqr(mp_int *a, mp_int *b); -int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c); -int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); -int mp_karatsuba_sqr(mp_int *a, mp_int *b); -int mp_toom_sqr(mp_int *a, mp_int *b); +int fast_s_mp_sqr(const mp_int *a, mp_int *b); +int s_mp_sqr(const mp_int *a, mp_int *b); +int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c); +int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c); +int mp_karatsuba_sqr(const mp_int *a, mp_int *b); +int mp_toom_sqr(const mp_int *a, mp_int *b); int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c); int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c); int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho); -- cgit v0.12 From c659b044b1e05ff3f4bcd0a94b01b3d2611c251c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 13 Sep 2017 10:14:31 +0000 Subject: Make mp_get_long and mp_set_long available to tommath-enabled Tcl extensions. Deprecate the internal TclBNInitBignumFrom* functions, in favor of the official tommath functions with the same purpose. --- generic/tclBasic.c | 4 +- generic/tclBinary.c | 2 +- generic/tclDecls.h | 9 +++++ generic/tclExecute.c | 6 +-- generic/tclInt.h | 4 ++ generic/tclObj.c | 6 +-- generic/tclStrToD.c | 32 ++++++++-------- generic/tclStubInit.c | 6 +++ generic/tclTomMath.decls | 12 ++++-- generic/tclTomMathDecls.h | 17 ++++++--- generic/tclTomMathInterface.c | 89 +++++++++++-------------------------------- unix/Makefile.in | 12 +++++- win/Makefile.in | 2 + win/makefile.vc | 2 + 14 files changed, 100 insertions(+), 103 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index cceef45..d4fa833 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -7460,7 +7460,7 @@ ExprAbsFunc( } goto unChanged; } else if (l == LONG_MIN) { - TclBNInitBignumFromLong(&big, l); + TclInitBignumFromLong(&big, l); goto tooLarge; } Tcl_SetObjResult(interp, Tcl_NewLongObj(-l)); @@ -7495,7 +7495,7 @@ ExprAbsFunc( goto unChanged; } if (w == LLONG_MIN) { - TclBNInitBignumFromWideInt(&big, w); + TclInitBignumFromWideInt(&big, w); goto tooLarge; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(-w)); diff --git a/generic/tclBinary.c b/generic/tclBinary.c index a693894..cb5a5cb 100644 --- a/generic/tclBinary.c +++ b/generic/tclBinary.c @@ -2284,7 +2284,7 @@ ScanNumber( Tcl_Obj *bigObj = NULL; mp_int big; - TclBNInitBignumFromWideUInt(&big, uwvalue); + TclInitBignumFromWideUInt(&big, uwvalue); bigObj = Tcl_NewBignumObj(&big); return bigObj; } diff --git a/generic/tclDecls.h b/generic/tclDecls.h index d543238..464fc0f 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -23,6 +23,15 @@ # endif #endif +#if !defined(BUILD_tcl) +# define TCL_DEPRECATED(msg) EXTERN TCL_DEPRECATED_API(msg) +#elif defined(TCL_NO_DEPRECATED) +# define TCL_DEPRECATED(msg) MODULE_SCOPE +#else +# define TCL_DEPRECATED(msg) EXTERN +#endif + + /* * WARNING: This file is automatically generated by the tools/genStubs.tcl * script. Any modifications to the function declarations below should be made diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 0113b28..f4c71ec 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -8218,7 +8218,7 @@ ExecuteExtendedBinaryMathOp( * Arguments are opposite sign; remainder is sum. */ - TclBNInitBignumFromWideInt(&big1, w1); + TclInitBignumFromWideInt(&big1, w1); mp_add(&big2, &big1, &big2); mp_clear(&big1); BIG_RESULT(&big2); @@ -9184,7 +9184,7 @@ ExecuteExtendedUnaryMathOp( if (w != LLONG_MIN) { WIDE_RESULT(-w); } - TclBNInitBignumFromLong(&big, *(const long *) ptr); + TclInitBignumFromLong(&big, *(const long *) ptr); break; #ifndef TCL_WIDE_INT_IS_LONG case TCL_NUMBER_WIDE: @@ -9192,7 +9192,7 @@ ExecuteExtendedUnaryMathOp( if (w != LLONG_MIN) { WIDE_RESULT(-w); } - TclBNInitBignumFromWideInt(&big, w); + TclInitBignumFromWideInt(&big, w); break; #endif default: diff --git a/generic/tclInt.h b/generic/tclInt.h index 118af85..9a657de 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2757,6 +2757,10 @@ MODULE_SCOPE long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS]; MODULE_SCOPE char tclEmptyString; +MODULE_SCOPE void TclInitBignumFromLong(mp_int *, long); +MODULE_SCOPE void TclInitBignumFromWideInt(mp_int *, Tcl_WideInt); +MODULE_SCOPE void TclInitBignumFromWideUInt(mp_int *, Tcl_WideUInt); + /* *---------------------------------------------------------------- * Procedures shared among Tcl modules but not used by the outside world, diff --git a/generic/tclObj.c b/generic/tclObj.c index f4b81f2..1a00011 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -3038,7 +3038,7 @@ Tcl_SetWideIntObj( #else mp_int big; - TclBNInitBignumFromWideInt(&big, wideValue); + TclInitBignumFromWideInt(&big, wideValue); Tcl_SetBignumObj(objPtr, &big); #endif } @@ -3402,12 +3402,12 @@ GetBignumFromObj( return TCL_OK; } if (objPtr->typePtr == &tclIntType) { - TclBNInitBignumFromLong(bignumValue, objPtr->internalRep.longValue); + TclInitBignumFromLong(bignumValue, objPtr->internalRep.longValue); return TCL_OK; } #ifndef TCL_WIDE_INT_IS_LONG if (objPtr->typePtr == &tclWideIntType) { - TclBNInitBignumFromWideInt(bignumValue, + TclInitBignumFromWideInt(bignumValue, objPtr->internalRep.wideValue); return TCL_OK; } diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 539a92c..630e498 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -711,7 +711,7 @@ TclParseNumber( || (octalSignificandWide > (~(Tcl_WideUInt)0 >> shift)))) { octalSignificandOverflow = 1; - TclBNInitBignumFromWideUInt(&octalSignificandBig, + TclInitBignumFromWideUInt(&octalSignificandBig, octalSignificandWide); } } @@ -828,7 +828,7 @@ TclParseNumber( ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) || significandWide > (~(Tcl_WideUInt)0 >> shift))) { significandOverflow = 1; - TclBNInitBignumFromWideUInt(&significandBig, + TclInitBignumFromWideUInt(&significandBig, significandWide); } } @@ -869,7 +869,7 @@ TclParseNumber( ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) || significandWide > (~(Tcl_WideUInt)0 >> shift))) { significandOverflow = 1; - TclBNInitBignumFromWideUInt(&significandBig, + TclInitBignumFromWideUInt(&significandBig, significandWide); } } @@ -1214,7 +1214,7 @@ TclParseNumber( ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) || significandWide > (MOST_BITS + signum) >> shift)) { significandOverflow = 1; - TclBNInitBignumFromWideUInt(&significandBig, significandWide); + TclInitBignumFromWideUInt(&significandBig, significandWide); } if (shift) { if (!significandOverflow) { @@ -1235,7 +1235,7 @@ TclParseNumber( ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) || significandWide > (MOST_BITS + signum) >> shift)) { significandOverflow = 1; - TclBNInitBignumFromWideUInt(&significandBig, significandWide); + TclInitBignumFromWideUInt(&significandBig, significandWide); } if (shift) { if (!significandOverflow) { @@ -1256,7 +1256,7 @@ TclParseNumber( ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) || octalSignificandWide > (MOST_BITS + signum) >> shift)) { octalSignificandOverflow = 1; - TclBNInitBignumFromWideUInt(&octalSignificandBig, + TclInitBignumFromWideUInt(&octalSignificandBig, octalSignificandWide); } if (shift) { @@ -1283,7 +1283,7 @@ TclParseNumber( break; } #endif - TclBNInitBignumFromWideUInt(&octalSignificandBig, + TclInitBignumFromWideUInt(&octalSignificandBig, octalSignificandWide); octalSignificandOverflow = 1; } else { @@ -1311,7 +1311,7 @@ TclParseNumber( &significandWide, &significandBig, significandOverflow); if (!significandOverflow && (significandWide > MOST_BITS+signum)){ significandOverflow = 1; - TclBNInitBignumFromWideUInt(&significandBig, significandWide); + TclInitBignumFromWideUInt(&significandBig, significandWide); } returnInteger: if (!significandOverflow) { @@ -1330,7 +1330,7 @@ TclParseNumber( break; } #endif - TclBNInitBignumFromWideUInt(&significandBig, + TclInitBignumFromWideUInt(&significandBig, significandWide); significandOverflow = 1; } else { @@ -1485,7 +1485,7 @@ AccumulateDecimalDigit( * bignum and fall through into the bignum case. */ - TclBNInitBignumFromWideUInt(bignumRepPtr, w); + TclInitBignumFromWideUInt(bignumRepPtr, w); } else { /* * Wide multiplication. @@ -1628,7 +1628,7 @@ MakeLowPrecisionDouble( * call MakeHighPrecisionDouble to do it the hard way. */ - TclBNInitBignumFromWideUInt(&significandBig, significand); + TclInitBignumFromWideUInt(&significandBig, significand); retval = MakeHighPrecisionDouble(0, &significandBig, numSigDigs, exponent); mp_clear(&significandBig); @@ -3315,7 +3315,7 @@ ShorteningBignumConversionPowD( * mminus = 5**m5 */ - TclBNInitBignumFromWideUInt(&b, bw); + TclInitBignumFromWideUInt(&b, bw); mp_init_set_int(&mminus, 1); MulPow5(&b, b5, &b); mp_mul_2d(&b, b2, &b); @@ -3502,7 +3502,7 @@ StrictBignumConversionPowD( * b = bw * 2**b2 * 5**b5 */ - TclBNInitBignumFromWideUInt(&b, bw); + TclInitBignumFromWideUInt(&b, bw); MulPow5(&b, b5, &b); mp_mul_2d(&b, b2, &b); @@ -3710,7 +3710,7 @@ ShorteningBignumConversion( * S = 2**s2 * 5*s5 */ - TclBNInitBignumFromWideUInt(&b, bw); + TclInitBignumFromWideUInt(&b, bw); mp_mul_2d(&b, b2, &b); mp_init_set_int(&S, 1); MulPow5(&S, s5, &S); mp_mul_2d(&S, s2, &S); @@ -3923,7 +3923,7 @@ StrictBignumConversion( */ mp_init_multi(&temp, &dig, NULL); - TclBNInitBignumFromWideUInt(&b, bw); + TclInitBignumFromWideUInt(&b, bw); mp_mul_2d(&b, b2, &b); mp_init_set_int(&S, 1); MulPow5(&S, s5, &S); mp_mul_2d(&S, s2, &S); @@ -4579,7 +4579,7 @@ Tcl_InitBignumFromDouble( Tcl_WideInt w = (Tcl_WideInt) ldexp(fract, mantBits); int shift = expt - mantBits; - TclBNInitBignumFromWideInt(b, w); + TclInitBignumFromWideInt(b, w); if (shift < 0) { mp_div_2d(b, -shift, b, NULL); } else if (shift > 0) { diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index a2f1ed3..2845441 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -69,6 +69,9 @@ static int TclSockMinimumBuffersOld(int sock, int size) # define TclWinGetSockOpt 0 # define TclWinSetSockOpt 0 # define TclWinNToHS 0 +# define TclBNInitBignumFromWideUInt 0 +# define TclBNInitBignumFromWideInt 0 +# define TclBNInitBignumFromLong 0 #else #define TclSetStartupScriptPath setStartupScriptPath static void TclSetStartupScriptPath(Tcl_Obj *path) @@ -103,6 +106,9 @@ static unsigned short TclWinNToHS(unsigned short ns) { return ntohs(ns); } #endif +# define TclBNInitBignumFromWideUInt TclInitBignumFromWideUInt +# define TclBNInitBignumFromWideInt TclInitBignumFromWideInt +# define TclBNInitBignumFromLong TclInitBignumFromLong #endif /* TCL_NO_DEPRECATED */ #ifdef _WIN32 diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index 5d1c8e8..d628cfe 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -223,13 +223,13 @@ declare 63 { # Formerly internal API to allow initialisation of bignums without knowing the # typedefs of how a bignum works internally. -declare 64 { +declare 64 {deprecated {Use mp_init() + mp_set_long_long()}} { void TclBNInitBignumFromLong(mp_int *bignum, long initVal) } -declare 65 { +declare 65 {deprecated {Use mp_init() + mp_set_long_long()}} { void TclBNInitBignumFromWideInt(mp_int *bignum, Tcl_WideInt initVal) } -declare 66 { +declare 66 {deprecated {Use mp_init() + mp_set_long_long()}} { void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal) } @@ -244,6 +244,12 @@ declare 68 { declare 69 { Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a) } +declare 70 { + int TclBN_mp_set_long(mp_int *a, unsigned long i) +} +declare 71 { + unsigned long TclBN_mp_get_long(const mp_int *a) +} # Local Variables: # mode: tcl diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 9d683dc..03f383f 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -75,6 +75,7 @@ #define mp_expt_d TclBN_mp_expt_d #define mp_expt_d_ex TclBN_mp_expt_d_ex #define mp_get_int TclBN_mp_get_int +#define mp_get_long TclBN_mp_get_long #define mp_get_long_long TclBN_mp_get_long_long #define mp_grow TclBN_mp_grow #define mp_init TclBN_mp_init @@ -100,6 +101,7 @@ #define mp_s_rmap TclBNMpSRmap #define mp_set TclBN_mp_set #define mp_set_int TclBN_mp_set_int +#define mp_set_long TclBN_mp_set_long #define mp_set_long_long TclBN_mp_set_long_long #define mp_shrink TclBN_mp_shrink #define mp_sqr TclBN_mp_sqr @@ -298,12 +300,15 @@ EXTERN int TclBN_mp_set_int(mp_int *a, unsigned long i); /* 63 */ EXTERN int TclBN_mp_cnt_lsb(const mp_int *a); /* 64 */ -EXTERN void TclBNInitBignumFromLong(mp_int *bignum, long initVal); +TCL_DEPRECATED("Use mp_init() + mp_set_long() or mp_set_long_long()") +void TclBNInitBignumFromLong(mp_int *bignum, long initVal); /* 65 */ -EXTERN void TclBNInitBignumFromWideInt(mp_int *bignum, +TCL_DEPRECATED("Use mp_init() + mp_set_long_long()") +void TclBNInitBignumFromWideInt(mp_int *bignum, Tcl_WideInt initVal); /* 66 */ -EXTERN void TclBNInitBignumFromWideUInt(mp_int *bignum, +TCL_DEPRECATED("Use mp_init() + mp_set_long_long()") +void TclBNInitBignumFromWideUInt(mp_int *bignum, Tcl_WideUInt initVal); /* 67 */ EXTERN int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, @@ -381,9 +386,9 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */ int (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */ int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */ - void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ - void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ - void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ + TCL_DEPRECATED_API("Use mp_init() + mp_set_long() or mp_set_long_long()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ + TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ + TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ int (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */ Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */ diff --git a/generic/tclTomMathInterface.c b/generic/tclTomMathInterface.c index 48db8c3..78888a7 100644 --- a/generic/tclTomMathInterface.c +++ b/generic/tclTomMathInterface.c @@ -168,7 +168,7 @@ TclBNFree( /* *---------------------------------------------------------------------- * - * TclBNInitBignumFromLong -- + * TclInitBignumFromLong -- * * Allocate and initialize a 'bignum' from a native 'long'. * @@ -181,47 +181,20 @@ TclBNFree( *---------------------------------------------------------------------- */ -extern void -TclBNInitBignumFromLong( +void +TclInitBignumFromLong( mp_int *a, - long initVal) + long v) { - 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) { + if (mp_init_size(a, (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { Tcl_Panic("initialization failure in TclBNInitBignumFromLong"); } - - /* - * Convert arg to sign and magnitude. - */ - - if (initVal < 0) { - a->sign = MP_NEG; - v = -initVal; + if (v < (long)0) { + mp_set_long_long(a, (Tcl_WideUInt)(-(Tcl_WideInt)v)); + mp_neg(a, a); } 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; + mp_set_long_long(a, (Tcl_WideUInt)v); } - a->used = p - a->dp; } /* @@ -240,16 +213,19 @@ TclBNInitBignumFromLong( *---------------------------------------------------------------------- */ -extern void -TclBNInitBignumFromWideInt( +void +TclInitBignumFromWideInt( mp_int *a, /* Bignum to initialize */ Tcl_WideInt v) /* Initial value */ { + if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { + Tcl_Panic("initialization failure in TclBNInitBignumFromWideInt"); + } if (v < (Tcl_WideInt)0) { - TclBNInitBignumFromWideUInt(a, (Tcl_WideUInt)(-v)); + mp_set_long_long(a, (Tcl_WideUInt)(-v)); mp_neg(a, a); } else { - TclBNInitBignumFromWideUInt(a, (Tcl_WideUInt)v); + mp_set_long_long(a, (Tcl_WideUInt)v); } } @@ -269,36 +245,15 @@ TclBNInitBignumFromWideInt( *---------------------------------------------------------------------- */ -extern void -TclBNInitBignumFromWideUInt( +void +TclInitBignumFromWideUInt( mp_int *a, /* Bignum to initialize */ Tcl_WideUInt v) /* Initial value */ { - int status; - mp_digit *p; - - /* - * Allocate enough memory to hold the largest possible Tcl_WideUInt. - */ - - status = mp_init_size(a, - (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT); - if (status != MP_OKAY) { - Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt"); - } - - a->sign = MP_ZPOS; - - /* - * 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; + if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { + Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt"); + } + mp_set_long_long(a, v); } /* diff --git a/unix/Makefile.in b/unix/Makefile.in index 2f97bf5..c31d128 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -320,7 +320,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_cnt_lsb.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_expt_d.o bn_mp_expt_d_ex.o bn_mp_get_int.o bn_mp_get_long_long.o bn_mp_grow.o bn_mp_init.o \ + bn_mp_exch.o bn_mp_expt_d.o bn_mp_expt_d_ex.o bn_mp_get_int.o bn_mp_get_long.o bn_mp_get_long_long.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_set_int.o bn_mp_init_size.o bn_mp_karatsuba_mul.o \ bn_mp_karatsuba_sqr.o \ @@ -328,7 +328,7 @@ TOMMATH_OBJS = bncore.o bn_reverse.o bn_fast_s_mp_mul_digs.o \ bn_mp_mul_2d.o bn_mp_mul_d.o bn_mp_neg.o bn_mp_or.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_set_int.o \ - bn_mp_set_long_long.o bn_mp_shrink.o \ + bn_mp_set_long.o bn_mp_set_long_long.o bn_mp_shrink.o \ bn_mp_sqr.o bn_mp_sqrt.o bn_mp_sub.o bn_mp_sub_d.o \ bn_mp_to_unsigned_bin.o bn_mp_to_unsigned_bin_n.o \ bn_mp_toom_mul.o bn_mp_toom_sqr.o bn_mp_toradix_n.o \ @@ -505,6 +505,7 @@ TOMMATH_SRCS = \ $(TOMMATH_DIR)/bn_mp_expt_d.c \ $(TOMMATH_DIR)/bn_mp_expt_d_ex.c \ $(TOMMATH_DIR)/bn_mp_get_int.c \ + $(TOMMATH_DIR)/bn_mp_get_long.c \ $(TOMMATH_DIR)/bn_mp_get_long_long.c \ $(TOMMATH_DIR)/bn_mp_grow.c \ $(TOMMATH_DIR)/bn_mp_init.c \ @@ -530,6 +531,7 @@ TOMMATH_SRCS = \ $(TOMMATH_DIR)/bn_mp_rshd.c \ $(TOMMATH_DIR)/bn_mp_set.c \ $(TOMMATH_DIR)/bn_mp_set_int.c \ + $(TOMMATH_DIR)/bn_mp_set_long.c \ $(TOMMATH_DIR)/bn_mp_set_long_long.c \ $(TOMMATH_DIR)/bn_mp_shrink.c \ $(TOMMATH_DIR)/bn_mp_sqr.c \ @@ -1432,6 +1434,9 @@ bn_mp_expt_d_ex.o: $(TOMMATH_DIR)/bn_mp_expt_d_ex.c $(MATHHDRS) bn_mp_get_int.o: $(TOMMATH_DIR)/bn_mp_get_int.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_get_int.c +bn_mp_get_long.o: $(TOMMATH_DIR)/bn_mp_get_long.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_get_long.c + bn_mp_get_long_long.o: $(TOMMATH_DIR)/bn_mp_get_long_long.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_get_long_long.c @@ -1507,6 +1512,9 @@ bn_mp_set.o: $(TOMMATH_DIR)/bn_mp_set.c $(MATHHDRS) bn_mp_set_int.o: $(TOMMATH_DIR)/bn_mp_set_int.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set_int.c +bn_mp_set_long.o: $(TOMMATH_DIR)/bn_mp_set_long.c $(MATHHDRS) + $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set_long.c + bn_mp_set_long_long.o: $(TOMMATH_DIR)/bn_mp_set_long_long.c $(MATHHDRS) $(CC) -c $(CC_SWITCHES) $(TOMMATH_DIR)/bn_mp_set_long_long.c diff --git a/win/Makefile.in b/win/Makefile.in index 4a0f839..a3275ba 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -330,6 +330,7 @@ TOMMATH_OBJS = \ bn_mp_expt_d.${OBJEXT} \ bn_mp_expt_d_ex.${OBJEXT} \ bn_mp_get_int.${OBJEXT} \ + bn_mp_get_long.${OBJEXT} \ bn_mp_get_long_long.${OBJEXT} \ bn_mp_grow.${OBJEXT} \ bn_mp_init.${OBJEXT} \ @@ -355,6 +356,7 @@ TOMMATH_OBJS = \ bn_mp_rshd.${OBJEXT} \ bn_mp_set.${OBJEXT} \ bn_mp_set_int.${OBJEXT} \ + bn_mp_set_long.${OBJEXT} \ bn_mp_set_long_long.${OBJEXT} \ bn_mp_shrink.${OBJEXT} \ bn_mp_sqr.${OBJEXT} \ diff --git a/win/makefile.vc b/win/makefile.vc index ca8cc08..2bff871 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -385,6 +385,7 @@ TOMMATHOBJS = \ $(TMP_DIR)\bn_mp_expt_d.obj \ $(TMP_DIR)\bn_mp_expt_d_ex.obj \ $(TMP_DIR)\bn_mp_get_int.obj \ + $(TMP_DIR)\bn_mp_get_long.obj \ $(TMP_DIR)\bn_mp_get_long_long.obj \ $(TMP_DIR)\bn_mp_grow.obj \ $(TMP_DIR)\bn_mp_init.obj \ @@ -410,6 +411,7 @@ TOMMATHOBJS = \ $(TMP_DIR)\bn_mp_rshd.obj \ $(TMP_DIR)\bn_mp_set.obj \ $(TMP_DIR)\bn_mp_set_int.obj \ + $(TMP_DIR)\bn_mp_set_long.obj \ $(TMP_DIR)\bn_mp_set_long_long.obj \ $(TMP_DIR)\bn_mp_shrink.obj \ $(TMP_DIR)\bn_mp_sqr.obj \ -- cgit v0.12 From db3273f34623ce56fdd5f0a8e6fefa6c2c956619 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 14 Sep 2017 07:41:09 +0000 Subject: Fix [f5da3d30e096a1c3486fbc480a6ece01fcb277a6|f5da3d30e0]: clerical error in comments --- library/init.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/init.tcl b/library/init.tcl index 3684258..c31eea3 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -624,7 +624,7 @@ proc auto_import {pattern} { if {$tcl_platform(platform) eq "windows"} { # Windows version. # -# Note that info executable doesn't work under Windows, so we have to +# Note that file 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. -- cgit v0.12 From 99d940211cdbe88b0459c4f15b9e6eb005b92a5a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 14 Sep 2017 08:05:32 +0000 Subject: Remove some unnecessary #if 0 sections. Fix comments and panic messages. No functional changes. --- generic/tclHash.c | 13 ------- generic/tclTomMath.h | 2 +- generic/tclTomMathInterface.c | 81 ++----------------------------------------- 3 files changed, 4 insertions(+), 92 deletions(-) diff --git a/generic/tclHash.c b/generic/tclHash.c index 78ad514..3c820c0 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -46,19 +46,6 @@ static int CompareArrayKeys(void *keyPtr, Tcl_HashEntry *hPtr); static TCL_HASH_TYPE HashArrayKey(Tcl_HashTable *tablePtr, void *keyPtr); /* - * Prototypes for the one word hash key methods. Not actually declared because - * this is a critical path that is implemented in the core hash table access - * function. - */ - -#if 0 -static Tcl_HashEntry * AllocOneWordEntry(Tcl_HashTable *tablePtr, - void *keyPtr); -static int CompareOneWordKeys(void *keyPtr, Tcl_HashEntry *hPtr); -static unsigned int HashOneWordKey(Tcl_HashTable *tablePtr, void *keyPtr); -#endif - -/* * Prototypes for the string hash key methods. */ diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 2ce8194..f110490 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -27,7 +27,7 @@ extern "C" { #endif /* detect 64-bit mode if possible */ -#if defined(NEVER) +#if defined(NEVER) /* 128-bit ints fail in too many places */ #if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) #define MP_64BIT #endif diff --git a/generic/tclTomMathInterface.c b/generic/tclTomMathInterface.c index 78888a7..9e7bf4b 100644 --- a/generic/tclTomMathInterface.c +++ b/generic/tclTomMathInterface.c @@ -89,81 +89,6 @@ TclBN_revision(void) { return TCLTOMMATH_REVISION; } -#if 0 - -/* - *---------------------------------------------------------------------- - * - * 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 *) ckalloc((unsigned int) x); -} - -/* - *---------------------------------------------------------------------- - * - * TclBNRealloc -- - * - * 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. - * - *---------------------------------------------------------------------- - */ - -void * -TclBNRealloc( - void *p, - size_t s) -{ - return (void *) ckrealloc((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) -{ - ckree((char *) p); -} -#endif /* *---------------------------------------------------------------------- @@ -187,7 +112,7 @@ TclInitBignumFromLong( long v) { if (mp_init_size(a, (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { - Tcl_Panic("initialization failure in TclBNInitBignumFromLong"); + Tcl_Panic("initialization failure in TclInitBignumFromLong"); } if (v < (long)0) { mp_set_long_long(a, (Tcl_WideUInt)(-(Tcl_WideInt)v)); @@ -219,7 +144,7 @@ TclInitBignumFromWideInt( Tcl_WideInt v) /* Initial value */ { if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { - Tcl_Panic("initialization failure in TclBNInitBignumFromWideInt"); + Tcl_Panic("initialization failure in TclInitBignumFromWideInt"); } if (v < (Tcl_WideInt)0) { mp_set_long_long(a, (Tcl_WideUInt)(-v)); @@ -251,7 +176,7 @@ TclInitBignumFromWideUInt( Tcl_WideUInt v) /* Initial value */ { if (mp_init_size(a, (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) != MP_OKAY) { - Tcl_Panic("initialization failure in TclBNInitBignumFromWideUInt"); + Tcl_Panic("initialization failure in TclInitBignumFromWideUInt"); } mp_set_long_long(a, v); } -- cgit v0.12 From bf01a303da2833ef352dae626b2a8d4929aaca37 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 14 Sep 2017 14:02:12 +0000 Subject: Move new declarations to more conventional place for tidier merging. --- generic/tclInt.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 9a657de..0b5ff0c 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2757,10 +2757,6 @@ MODULE_SCOPE long tclObjsShared[TCL_MAX_SHARED_OBJ_STATS]; MODULE_SCOPE char tclEmptyString; -MODULE_SCOPE void TclInitBignumFromLong(mp_int *, long); -MODULE_SCOPE void TclInitBignumFromWideInt(mp_int *, Tcl_WideInt); -MODULE_SCOPE void TclInitBignumFromWideUInt(mp_int *, Tcl_WideUInt); - /* *---------------------------------------------------------------- * Procedures shared among Tcl modules but not used by the outside world, @@ -3011,6 +3007,9 @@ MODULE_SCOPE int TclInfoLocalsCmd(ClientData dummy, Tcl_Interp *interp, MODULE_SCOPE int TclInfoVarsCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE void TclInitAlloc(void); +MODULE_SCOPE void TclInitBignumFromLong(mp_int *, long); +MODULE_SCOPE void TclInitBignumFromWideInt(mp_int *, Tcl_WideInt); +MODULE_SCOPE void TclInitBignumFromWideUInt(mp_int *, Tcl_WideUInt); MODULE_SCOPE void TclInitDbCkalloc(void); MODULE_SCOPE void TclInitDoubleConversion(void); MODULE_SCOPE void TclInitEmbeddedConfigurationInformation( -- cgit v0.12 From 8f339500a2b79c84698261987f664ed30af94814 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 15 Sep 2017 13:08:31 +0000 Subject: 'const'ify more libtommath functions. All functions in generic/tclTomMath.decls (used by Tcl) are done now. --- generic/tclStubInit.c | 2 ++ generic/tclTomMath.decls | 12 +++++----- generic/tclTomMath.h | 16 +++++++------- generic/tclTomMathDecls.h | 43 +++++++++++++++++++++++------------- libtommath/bn_mp_add_d.c | 9 ++++---- libtommath/bn_mp_fwrite.c | 2 +- libtommath/bn_mp_signed_bin_size.c | 2 +- libtommath/bn_mp_sub_d.c | 9 ++++---- libtommath/bn_mp_to_signed_bin.c | 2 +- libtommath/bn_mp_to_signed_bin_n.c | 2 +- libtommath/bn_mp_to_unsigned_bin.c | 2 +- libtommath/bn_mp_to_unsigned_bin_n.c | 2 +- libtommath/bn_mp_toradix.c | 2 +- libtommath/bn_mp_toradix_n.c | 2 +- libtommath/bn_mp_unsigned_bin_size.c | 2 +- libtommath/tommath.h | 20 ++++++++--------- 16 files changed, 73 insertions(+), 56 deletions(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 2845441..ebd2086 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -867,6 +867,8 @@ const TclTomMathStubs tclTomMathStubs = { TclBN_mp_expt_d_ex, /* 67 */ TclBN_mp_set_long_long, /* 68 */ TclBN_mp_get_long_long, /* 69 */ + TclBN_mp_set_long, /* 70 */ + TclBN_mp_get_long, /* 71 */ }; static const TclStubHooks tclStubHooks = { diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index d628cfe..10df919 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -33,7 +33,7 @@ declare 2 { int TclBN_mp_add(const mp_int *a, const mp_int *b, mp_int *c) } declare 3 { - int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c) + int TclBN_mp_add_d(const mp_int *a, mp_digit b, mp_int *c) } declare 4 { int TclBN_mp_and(const mp_int *a, const mp_int *b, mp_int *c) @@ -153,20 +153,20 @@ declare 42 { int TclBN_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) } declare 43 { - int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c) + int TclBN_mp_sub_d(const mp_int *a, mp_digit b, mp_int *c) } declare 44 { - int TclBN_mp_to_unsigned_bin(mp_int *a, unsigned char *b) + int TclBN_mp_to_unsigned_bin(const mp_int *a, unsigned char *b) } declare 45 { - int TclBN_mp_to_unsigned_bin_n(mp_int *a, unsigned char *b, + int TclBN_mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen) } declare 46 { - int TclBN_mp_toradix_n(mp_int *a, char *str, int radix, int maxlen) + int TclBN_mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen) } declare 47 { - int TclBN_mp_unsigned_bin_size(mp_int *a) + int TclBN_mp_unsigned_bin_size(const mp_int *a) } declare 48 { int TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c) diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index f110490..34ac1bb 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -747,33 +747,33 @@ int mp_unsigned_bin_size(mp_int *a); int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); */ /* -int mp_to_unsigned_bin(mp_int *a, unsigned char *b); +int mp_to_unsigned_bin(const mp_int *a, unsigned char *b); */ /* -int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +int mp_to_unsigned_bin_n (const mp_int * a, unsigned char *b, unsigned long *outlen); */ /* -int mp_signed_bin_size(mp_int *a); +int mp_signed_bin_size(const mp_int *a); */ /* int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c); */ /* -int mp_to_signed_bin(mp_int *a, unsigned char *b); +int mp_to_signed_bin(const mp_int *a, unsigned char *b); */ /* -int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +int mp_to_signed_bin_n (const mp_int * a, unsigned char *b, unsigned long *outlen); */ /* int mp_read_radix(mp_int *a, const char *str, int radix); */ /* -int mp_toradix(mp_int *a, char *str, int radix); +int mp_toradix(const mp_int *a, char *str, int radix); */ /* -int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen); +int mp_toradix_n(const mp_int * a, char *str, int radix, int maxlen); */ /* int mp_radix_size(const mp_int *a, int radix, int *size); @@ -784,7 +784,7 @@ int mp_radix_size(const mp_int *a, int radix, int *size); int mp_fread(mp_int *a, int radix, FILE *stream); */ /* -int mp_fwrite(mp_int *a, int radix, FILE *stream); +int mp_fwrite(const mp_int *a, int radix, FILE *stream); */ #endif diff --git a/generic/tclTomMathDecls.h b/generic/tclTomMathDecls.h index 03f383f..f3145d7 100644 --- a/generic/tclTomMathDecls.h +++ b/generic/tclTomMathDecls.h @@ -156,7 +156,8 @@ EXTERN int TclBN_revision(void); EXTERN int TclBN_mp_add(const mp_int *a, const mp_int *b, mp_int *c); /* 3 */ -EXTERN int TclBN_mp_add_d(mp_int *a, mp_digit b, mp_int *c); +EXTERN int TclBN_mp_add_d(const mp_int *a, mp_digit b, + mp_int *c); /* 4 */ EXTERN int TclBN_mp_and(const mp_int *a, const mp_int *b, mp_int *c); @@ -249,17 +250,19 @@ EXTERN int TclBN_mp_sqrt(const mp_int *a, mp_int *b); EXTERN int TclBN_mp_sub(const mp_int *a, const mp_int *b, mp_int *c); /* 43 */ -EXTERN int TclBN_mp_sub_d(mp_int *a, mp_digit b, mp_int *c); +EXTERN int TclBN_mp_sub_d(const mp_int *a, mp_digit b, + mp_int *c); /* 44 */ -EXTERN int TclBN_mp_to_unsigned_bin(mp_int *a, unsigned char *b); +EXTERN int TclBN_mp_to_unsigned_bin(const mp_int *a, + unsigned char *b); /* 45 */ -EXTERN int TclBN_mp_to_unsigned_bin_n(mp_int *a, +EXTERN int TclBN_mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen); /* 46 */ -EXTERN int TclBN_mp_toradix_n(mp_int *a, char *str, int radix, - int maxlen); +EXTERN int TclBN_mp_toradix_n(const mp_int *a, char *str, + int radix, int maxlen); /* 47 */ -EXTERN int TclBN_mp_unsigned_bin_size(mp_int *a); +EXTERN int TclBN_mp_unsigned_bin_size(const mp_int *a); /* 48 */ EXTERN int TclBN_mp_xor(const mp_int *a, const mp_int *b, mp_int *c); @@ -300,7 +303,7 @@ EXTERN int TclBN_mp_set_int(mp_int *a, unsigned long i); /* 63 */ EXTERN int TclBN_mp_cnt_lsb(const mp_int *a); /* 64 */ -TCL_DEPRECATED("Use mp_init() + mp_set_long() or mp_set_long_long()") +TCL_DEPRECATED("Use mp_init() + mp_set_long_long()") void TclBNInitBignumFromLong(mp_int *bignum, long initVal); /* 65 */ TCL_DEPRECATED("Use mp_init() + mp_set_long_long()") @@ -317,6 +320,10 @@ EXTERN int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, EXTERN int TclBN_mp_set_long_long(mp_int *a, Tcl_WideUInt i); /* 69 */ EXTERN Tcl_WideUInt TclBN_mp_get_long_long(const mp_int *a); +/* 70 */ +EXTERN int TclBN_mp_set_long(mp_int *a, unsigned long i); +/* 71 */ +EXTERN unsigned long TclBN_mp_get_long(const mp_int *a); typedef struct TclTomMathStubs { int magic; @@ -325,7 +332,7 @@ typedef struct TclTomMathStubs { int (*tclBN_epoch) (void); /* 0 */ int (*tclBN_revision) (void); /* 1 */ int (*tclBN_mp_add) (const mp_int *a, const mp_int *b, mp_int *c); /* 2 */ - int (*tclBN_mp_add_d) (mp_int *a, mp_digit b, mp_int *c); /* 3 */ + int (*tclBN_mp_add_d) (const mp_int *a, mp_digit b, mp_int *c); /* 3 */ int (*tclBN_mp_and) (const mp_int *a, const mp_int *b, mp_int *c); /* 4 */ void (*tclBN_mp_clamp) (mp_int *a); /* 5 */ void (*tclBN_mp_clear) (mp_int *a); /* 6 */ @@ -365,11 +372,11 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_sqr) (const mp_int *a, mp_int *b); /* 40 */ int (*tclBN_mp_sqrt) (const mp_int *a, mp_int *b); /* 41 */ int (*tclBN_mp_sub) (const mp_int *a, const mp_int *b, mp_int *c); /* 42 */ - int (*tclBN_mp_sub_d) (mp_int *a, mp_digit b, mp_int *c); /* 43 */ - int (*tclBN_mp_to_unsigned_bin) (mp_int *a, unsigned char *b); /* 44 */ - int (*tclBN_mp_to_unsigned_bin_n) (mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */ - int (*tclBN_mp_toradix_n) (mp_int *a, char *str, int radix, int maxlen); /* 46 */ - int (*tclBN_mp_unsigned_bin_size) (mp_int *a); /* 47 */ + int (*tclBN_mp_sub_d) (const mp_int *a, mp_digit b, mp_int *c); /* 43 */ + int (*tclBN_mp_to_unsigned_bin) (const mp_int *a, unsigned char *b); /* 44 */ + int (*tclBN_mp_to_unsigned_bin_n) (const mp_int *a, unsigned char *b, unsigned long *outlen); /* 45 */ + int (*tclBN_mp_toradix_n) (const mp_int *a, char *str, int radix, int maxlen); /* 46 */ + int (*tclBN_mp_unsigned_bin_size) (const mp_int *a); /* 47 */ int (*tclBN_mp_xor) (const mp_int *a, const mp_int *b, mp_int *c); /* 48 */ void (*tclBN_mp_zero) (mp_int *a); /* 49 */ void (*tclBN_reverse) (unsigned char *s, int len); /* 50 */ @@ -386,12 +393,14 @@ typedef struct TclTomMathStubs { int (*tclBN_mp_init_set_int) (mp_int *a, unsigned long i); /* 61 */ int (*tclBN_mp_set_int) (mp_int *a, unsigned long i); /* 62 */ int (*tclBN_mp_cnt_lsb) (const mp_int *a); /* 63 */ - TCL_DEPRECATED_API("Use mp_init() + mp_set_long() or mp_set_long_long()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ + TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromLong) (mp_int *bignum, long initVal); /* 64 */ TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideInt) (mp_int *bignum, Tcl_WideInt initVal); /* 65 */ TCL_DEPRECATED_API("Use mp_init() + mp_set_long_long()") void (*tclBNInitBignumFromWideUInt) (mp_int *bignum, Tcl_WideUInt initVal); /* 66 */ int (*tclBN_mp_expt_d_ex) (const mp_int *a, mp_digit b, mp_int *c, int fast); /* 67 */ int (*tclBN_mp_set_long_long) (mp_int *a, Tcl_WideUInt i); /* 68 */ Tcl_WideUInt (*tclBN_mp_get_long_long) (const mp_int *a); /* 69 */ + int (*tclBN_mp_set_long) (mp_int *a, unsigned long i); /* 70 */ + unsigned long (*tclBN_mp_get_long) (const mp_int *a); /* 71 */ } TclTomMathStubs; extern const TclTomMathStubs *tclTomMathStubsPtr; @@ -546,6 +555,10 @@ extern const TclTomMathStubs *tclTomMathStubsPtr; (tclTomMathStubsPtr->tclBN_mp_set_long_long) /* 68 */ #define TclBN_mp_get_long_long \ (tclTomMathStubsPtr->tclBN_mp_get_long_long) /* 69 */ +#define TclBN_mp_set_long \ + (tclTomMathStubsPtr->tclBN_mp_set_long) /* 70 */ +#define TclBN_mp_get_long \ + (tclTomMathStubsPtr->tclBN_mp_get_long) /* 71 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index fd1a186..c2f2e0e 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -17,7 +17,7 @@ /* single digit addition */ int -mp_add_d (mp_int * a, mp_digit b, mp_int * c) +mp_add_d (const mp_int * a, mp_digit b, mp_int * c) { int res, ix, oldused; mp_digit *tmpa, *tmpc, mu; @@ -31,14 +31,15 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c) /* if a is negative and |a| >= b, call c = |a| - b */ if ((a->sign == MP_NEG) && ((a->used > 1) || (a->dp[0] >= b))) { + mp_int a_ = *a; /* temporarily fix sign of a */ - a->sign = MP_ZPOS; + a_.sign = MP_ZPOS; /* c = |a| - b */ - res = mp_sub_d(a, b, c); + res = mp_sub_d(&a_, b, c); /* fix sign */ - a->sign = c->sign = MP_NEG; + c->sign = MP_NEG; /* clamp */ mp_clamp(c); diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c index 23b5f64..e2b5ec2 100644 --- a/libtommath/bn_mp_fwrite.c +++ b/libtommath/bn_mp_fwrite.c @@ -16,7 +16,7 @@ */ #ifndef LTM_NO_FILE -int mp_fwrite(mp_int *a, int radix, FILE *stream) +int mp_fwrite(const mp_int *a, int radix, FILE *stream) { char *buf; int err, len, x; diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c index 0910333..6b57bed 100644 --- a/libtommath/bn_mp_signed_bin_size.c +++ b/libtommath/bn_mp_signed_bin_size.c @@ -16,7 +16,7 @@ */ /* get the size for an signed equivalent */ -int mp_signed_bin_size (mp_int * a) +int mp_signed_bin_size (const mp_int * a) { return 1 + mp_unsigned_bin_size (a); } diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index 5e96030..2d24899 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -17,7 +17,7 @@ /* single digit subtraction */ int -mp_sub_d (mp_int * a, mp_digit b, mp_int * c) +mp_sub_d (const mp_int * a, mp_digit b, mp_int * c) { mp_digit *tmpa, *tmpc, mu; int res, ix, oldused; @@ -33,9 +33,10 @@ mp_sub_d (mp_int * a, mp_digit b, mp_int * c) * addition [with fudged signs] */ if (a->sign == MP_NEG) { - a->sign = MP_ZPOS; - res = mp_add_d(a, b, c); - a->sign = c->sign = MP_NEG; + mp_int a_ = *a; + a_.sign = MP_ZPOS; + res = mp_add_d(&a_, b, c); + c->sign = MP_NEG; /* clamp */ mp_clamp(c); diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c index c49c87d..69f6423 100644 --- a/libtommath/bn_mp_to_signed_bin.c +++ b/libtommath/bn_mp_to_signed_bin.c @@ -16,7 +16,7 @@ */ /* store in signed [big endian] format */ -int mp_to_signed_bin (mp_int * a, unsigned char *b) +int mp_to_signed_bin (const mp_int * a, unsigned char *b) { int res; diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c index dc5ec26..fc0e822 100644 --- a/libtommath/bn_mp_to_signed_bin_n.c +++ b/libtommath/bn_mp_to_signed_bin_n.c @@ -16,7 +16,7 @@ */ /* store in signed [big endian] format */ -int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) +int mp_to_signed_bin_n (const mp_int * a, unsigned char *b, unsigned long *outlen) { if (*outlen < (unsigned long)mp_signed_bin_size(a)) { return MP_VAL; diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c index d249359..e8d9c4f 100644 --- a/libtommath/bn_mp_to_unsigned_bin.c +++ b/libtommath/bn_mp_to_unsigned_bin.c @@ -16,7 +16,7 @@ */ /* store in unsigned [big endian] format */ -int mp_to_unsigned_bin (mp_int * a, unsigned char *b) +int mp_to_unsigned_bin (const mp_int * a, unsigned char *b) { int x, res; mp_int t; diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c index f671621..9e9eef5 100644 --- a/libtommath/bn_mp_to_unsigned_bin_n.c +++ b/libtommath/bn_mp_to_unsigned_bin_n.c @@ -16,7 +16,7 @@ */ /* store in unsigned [big endian] format */ -int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) +int mp_to_unsigned_bin_n (const mp_int * a, unsigned char *b, unsigned long *outlen) { if (*outlen < (unsigned long)mp_unsigned_bin_size(a)) { return MP_VAL; diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index 3337765..59676a7 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -16,7 +16,7 @@ */ /* stores a bignum as a ASCII string in a given radix (2..64) */ -int mp_toradix (mp_int * a, char *str, int radix) +int mp_toradix (const mp_int * a, char *str, int radix) { int res, digs; mp_int t; diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index ae24ada..c0079c8 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -19,7 +19,7 @@ * * Stores upto maxlen-1 chars and always a NULL byte */ -int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) +int mp_toradix_n(const mp_int * a, char *str, int radix, int maxlen) { int res, digs; mp_int t; diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c index f46d0ba..74655e7 100644 --- a/libtommath/bn_mp_unsigned_bin_size.c +++ b/libtommath/bn_mp_unsigned_bin_size.c @@ -16,7 +16,7 @@ */ /* get the size for an unsigned equivalent */ -int mp_unsigned_bin_size (mp_int * a) +int mp_unsigned_bin_size (const mp_int * a) { int size = mp_count_bits (a); return (size / 8) + (((size & 7) != 0) ? 1 : 0); diff --git a/libtommath/tommath.h b/libtommath/tommath.h index b183b8a..527f316 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -337,7 +337,7 @@ int mp_cmp_d(const mp_int *a, mp_digit b); int mp_add_d(const mp_int *a, const mp_digit b, mp_int *c); /* c = a - b */ -int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); +int mp_sub_d(const mp_int *a, mp_digit b, mp_int *c); /* c = a * b */ int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c); @@ -526,24 +526,24 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback /* ---> radix conversion <--- */ int mp_count_bits(const mp_int *a); -int mp_unsigned_bin_size(mp_int *a); +int mp_unsigned_bin_size(const mp_int *a); int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); -int mp_to_unsigned_bin(mp_int *a, unsigned char *b); -int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +int mp_to_unsigned_bin(const mp_int *a, unsigned char *b); +int mp_to_unsigned_bin_n (const mp_int * a, unsigned char *b, unsigned long *outlen); -int mp_signed_bin_size(mp_int *a); +int mp_signed_bin_size(const mp_int *a); int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c); -int mp_to_signed_bin(mp_int *a, unsigned char *b); -int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +int mp_to_signed_bin(const mp_int *a, unsigned char *b); +int mp_to_signed_bin_n (const mp_int * a, unsigned char *b, unsigned long *outlen); int mp_read_radix(mp_int *a, const char *str, int radix); -int mp_toradix(mp_int *a, char *str, int radix); -int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen); +int mp_toradix(const mp_int *a, char *str, int radix); +int mp_toradix_n(const mp_int * a, char *str, int radix, int maxlen); int mp_radix_size(const mp_int *a, int radix, int *size); #ifndef LTM_NO_FILE int mp_fread(mp_int *a, int radix, FILE *stream); -int mp_fwrite(mp_int *a, int radix, FILE *stream); +int mp_fwrite(const mp_int *a, int radix, FILE *stream); #endif #define mp_read_raw(mp, str, len) mp_read_signed_bin((mp), (str), (len)) -- cgit v0.12 From d4e73bcab52ca3c76e007a1acc7cb76f50b8feb5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 15 Sep 2017 14:44:00 +0000 Subject: re-format everything through astyle. Taken from libtom/libtommath (pull request [https://github.com/libtom/libtommath/pull/85|85]) --- libtommath/astylerc | 27 + libtommath/bn_error.c | 16 +- libtommath/bn_fast_mp_invmod.c | 223 ++-- libtommath/bn_fast_mp_montgomery_reduce.c | 270 ++--- libtommath/bn_fast_s_mp_mul_digs.c | 80 +- libtommath/bn_fast_s_mp_mul_high_digs.c | 70 +- libtommath/bn_fast_s_mp_sqr.c | 80 +- libtommath/bn_mp_2expt.c | 29 +- libtommath/bn_mp_abs.c | 25 +- libtommath/bn_mp_add.c | 48 +- libtommath/bn_mp_add_d.c | 171 ++- libtommath/bn_mp_addmod.c | 27 +- libtommath/bn_mp_and.c | 55 +- libtommath/bn_mp_clamp.c | 25 +- libtommath/bn_mp_clear.c | 31 +- libtommath/bn_mp_clear_multi.c | 18 +- libtommath/bn_mp_cmp.c | 35 +- libtommath/bn_mp_cmp_d.c | 34 +- libtommath/bn_mp_cmp_mag.c | 54 +- libtommath/bn_mp_cnt_lsb.c | 2 +- libtommath/bn_mp_copy.c | 67 +- libtommath/bn_mp_count_bits.c | 35 +- libtommath/bn_mp_div.c | 453 ++++---- libtommath/bn_mp_div_2.c | 70 +- libtommath/bn_mp_div_2d.c | 100 +- libtommath/bn_mp_div_3.c | 87 +- libtommath/bn_mp_div_d.c | 128 +-- libtommath/bn_mp_dr_is_modulus.c | 6 +- libtommath/bn_mp_dr_reduce.c | 85 +- libtommath/bn_mp_dr_setup.c | 3 +- libtommath/bn_mp_exch.c | 13 +- libtommath/bn_mp_export.c | 121 +- libtommath/bn_mp_expt_d.c | 4 +- libtommath/bn_mp_expt_d_ex.c | 95 +- libtommath/bn_mp_exptmod.c | 114 +- libtommath/bn_mp_exptmod_fast.c | 487 ++++---- libtommath/bn_mp_exteuclid.c | 94 +- libtommath/bn_mp_fread.c | 18 +- libtommath/bn_mp_fwrite.c | 22 +- libtommath/bn_mp_gcd.c | 140 +-- libtommath/bn_mp_get_int.c | 30 +- libtommath/bn_mp_get_long.c | 28 +- libtommath/bn_mp_get_long_long.c | 28 +- libtommath/bn_mp_grow.c | 56 +- libtommath/bn_mp_import.c | 72 +- libtommath/bn_mp_init.c | 32 +- libtommath/bn_mp_init_copy.c | 18 +- libtommath/bn_mp_init_multi.c | 58 +- libtommath/bn_mp_init_set.c | 14 +- libtommath/bn_mp_init_set_int.c | 12 +- libtommath/bn_mp_init_size.c | 36 +- libtommath/bn_mp_invmod.c | 22 +- libtommath/bn_mp_invmod_slow.c | 247 ++-- libtommath/bn_mp_is_square.c | 137 +-- libtommath/bn_mp_jacobi.c | 152 +-- libtommath/bn_mp_karatsuba_mul.c | 263 ++--- libtommath/bn_mp_karatsuba_sqr.c | 190 ++-- libtommath/bn_mp_lcm.c | 66 +- libtommath/bn_mp_lshd.c | 68 +- libtommath/bn_mp_mod.c | 37 +- libtommath/bn_mp_mod_2d.c | 51 +- libtommath/bn_mp_mod_d.c | 5 +- libtommath/bn_mp_montgomery_calc_normalization.c | 46 +- libtommath/bn_mp_montgomery_reduce.c | 179 ++- libtommath/bn_mp_montgomery_setup.c | 45 +- libtommath/bn_mp_mul.c | 62 +- libtommath/bn_mp_mul_2.c | 100 +- libtommath/bn_mp_mul_2d.c | 100 +- libtommath/bn_mp_mul_d.c | 81 +- libtommath/bn_mp_mulmod.c | 26 +- libtommath/bn_mp_n_root.c | 4 +- libtommath/bn_mp_n_root_ex.c | 185 +-- libtommath/bn_mp_neg.c | 26 +- libtommath/bn_mp_or.c | 46 +- libtommath/bn_mp_prime_fermat.c | 63 +- libtommath/bn_mp_prime_is_divisible.c | 36 +- libtommath/bn_mp_prime_is_prime.c | 77 +- libtommath/bn_mp_prime_miller_rabin.c | 125 +- libtommath/bn_mp_prime_next_prime.c | 86 +- libtommath/bn_mp_prime_rabin_miller_trials.c | 26 +- libtommath/bn_mp_prime_random_ex.c | 38 +- libtommath/bn_mp_radix_size.c | 84 +- libtommath/bn_mp_rand.c | 75 +- libtommath/bn_mp_read_radix.c | 110 +- libtommath/bn_mp_read_signed_bin.c | 26 +- libtommath/bn_mp_read_unsigned_bin.c | 46 +- libtommath/bn_mp_reduce.c | 112 +- libtommath/bn_mp_reduce_2k_setup.c | 8 +- libtommath/bn_mp_reduce_2k_setup_l.c | 8 +- libtommath/bn_mp_reduce_is_2k.c | 20 +- libtommath/bn_mp_reduce_is_2k_l.c | 10 +- libtommath/bn_mp_reduce_setup.c | 14 +- libtommath/bn_mp_rshd.c | 76 +- libtommath/bn_mp_set.c | 8 +- libtommath/bn_mp_set_int.c | 38 +- libtommath/bn_mp_shrink.c | 32 +- libtommath/bn_mp_signed_bin_size.c | 4 +- libtommath/bn_mp_sqr.c | 49 +- libtommath/bn_mp_sqrmod.c | 27 +- libtommath/bn_mp_sqrt.c | 90 +- libtommath/bn_mp_sqrtmod_prime.c | 184 +-- libtommath/bn_mp_sub.c | 59 +- libtommath/bn_mp_sub_d.c | 113 +- libtommath/bn_mp_submod.c | 27 +- libtommath/bn_mp_to_signed_bin.c | 14 +- libtommath/bn_mp_to_signed_bin_n.c | 2 +- libtommath/bn_mp_to_unsigned_bin.c | 36 +- libtommath/bn_mp_to_unsigned_bin_n.c | 2 +- libtommath/bn_mp_toom_mul.c | 454 ++++---- libtommath/bn_mp_toom_sqr.c | 399 ++++--- libtommath/bn_mp_toradix.c | 82 +- libtommath/bn_mp_toradix_n.c | 104 +- libtommath/bn_mp_unsigned_bin_size.c | 6 +- libtommath/bn_mp_xor.c | 47 +- libtommath/bn_mp_zero.c | 18 +- libtommath/bn_prime_tab.c | 66 +- libtommath/bn_reverse.c | 25 +- libtommath/bn_s_mp_add.c | 159 ++- libtommath/bn_s_mp_exptmod.c | 412 +++---- libtommath/bn_s_mp_mul_digs.c | 106 +- libtommath/bn_s_mp_mul_high_digs.c | 85 +- libtommath/bn_s_mp_sqr.c | 96 +- libtommath/bn_s_mp_sub.c | 101 +- libtommath/bncore.c | 6 +- libtommath/makefile | 3 + libtommath/tommath.h | 154 +-- libtommath/tommath_class.h | 1315 +++++++++++----------- libtommath/tommath_private.h | 34 +- libtommath/tommath_superclass.h | 102 +- 129 files changed, 5787 insertions(+), 5696 deletions(-) create mode 100644 libtommath/astylerc diff --git a/libtommath/astylerc b/libtommath/astylerc new file mode 100644 index 0000000..5d63f7a --- /dev/null +++ b/libtommath/astylerc @@ -0,0 +1,27 @@ +# Artistic Style, see http://astyle.sourceforge.net/ +# full documentation, see: http://astyle.sourceforge.net/astyle.html +# +# usage: +# astyle --options=astylerc *.[ch] + +## Bracket Style Options +style=kr + +## Tab Options +indent=spaces=3 + +## Bracket Modify Options + +## Indentation Options +min-conditional-indent=0 + +## Padding Options +pad-header +unpad-paren +align-pointer=name + +## Formatting Options +break-after-logical +max-code-length=120 +convert-tabs +mode=c diff --git a/libtommath/bn_error.c b/libtommath/bn_error.c index 0d77411..a51d712 100644 --- a/libtommath/bn_error.c +++ b/libtommath/bn_error.c @@ -16,12 +16,12 @@ */ static const struct { - int code; - const char *msg; + int code; + const char *msg; } msgs[] = { - { MP_OKAY, "Successful" }, - { MP_MEM, "Out of heap" }, - { MP_VAL, "Value out of range" } + { MP_OKAY, "Successful" }, + { MP_MEM, "Out of heap" }, + { MP_VAL, "Value out of range" } }; /* return a char * string for a given code */ @@ -31,9 +31,9 @@ const char *mp_error_to_string(int code) /* scan the lookup table for the given message */ for (x = 0; x < (int)(sizeof(msgs) / sizeof(msgs[0])); x++) { - if (msgs[x].code == code) { - return msgs[x].msg; - } + if (msgs[x].code == code) { + return msgs[x].msg; + } } /* generic reply for invalid code */ diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c index 12f42de..7771136 100644 --- a/libtommath/bn_fast_mp_invmod.c +++ b/libtommath/bn_fast_mp_invmod.c @@ -15,131 +15,132 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* computes the modular inverse via binary extended euclidean algorithm, - * that is c = 1/a mod b +/* computes the modular inverse via binary extended euclidean algorithm, + * that is c = 1/a mod b * - * Based on slow invmod except this is optimized for the case where b is + * Based on slow invmod except this is optimized for the case where b is * odd as per HAC Note 14.64 on pp. 610 */ -int fast_mp_invmod (mp_int * a, mp_int * b, mp_int * c) +int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c) { - mp_int x, y, u, v, B, D; - int res, neg; - - /* 2. [modified] b must be odd */ - if (mp_iseven (b) == MP_YES) { - return MP_VAL; - } - - /* init all our temps */ - if ((res = mp_init_multi(&x, &y, &u, &v, &B, &D, NULL)) != MP_OKAY) { - return res; - } - - /* x == modulus, y == value to invert */ - if ((res = mp_copy (b, &x)) != MP_OKAY) { - goto LBL_ERR; - } - - /* we need y = |a| */ - if ((res = mp_mod (a, b, &y)) != MP_OKAY) { - goto LBL_ERR; - } - - /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */ - if ((res = mp_copy (&x, &u)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_copy (&y, &v)) != MP_OKAY) { - goto LBL_ERR; - } - mp_set (&D, 1); + mp_int x, y, u, v, B, D; + int res, neg; -top: - /* 4. while u is even do */ - while (mp_iseven (&u) == MP_YES) { - /* 4.1 u = u/2 */ - if ((res = mp_div_2 (&u, &u)) != MP_OKAY) { - goto LBL_ERR; - } - /* 4.2 if B is odd then */ - if (mp_isodd (&B) == MP_YES) { - if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } - /* B = B/2 */ - if ((res = mp_div_2 (&B, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } + /* 2. [modified] b must be odd */ + if (mp_iseven(b) == MP_YES) { + return MP_VAL; + } - /* 5. while v is even do */ - while (mp_iseven (&v) == MP_YES) { - /* 5.1 v = v/2 */ - if ((res = mp_div_2 (&v, &v)) != MP_OKAY) { - goto LBL_ERR; - } - /* 5.2 if D is odd then */ - if (mp_isodd (&D) == MP_YES) { - /* D = (D-x)/2 */ - if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - /* D = D/2 */ - if ((res = mp_div_2 (&D, &D)) != MP_OKAY) { + /* init all our temps */ + if ((res = mp_init_multi(&x, &y, &u, &v, &B, &D, NULL)) != MP_OKAY) { + return res; + } + + /* x == modulus, y == value to invert */ + if ((res = mp_copy(b, &x)) != MP_OKAY) { goto LBL_ERR; - } - } + } - /* 6. if u >= v then */ - if (mp_cmp (&u, &v) != MP_LT) { - /* u = u - v, B = B - D */ - if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) { + /* we need y = |a| */ + if ((res = mp_mod(a, b, &y)) != MP_OKAY) { goto LBL_ERR; - } + } - if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) { + /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */ + if ((res = mp_copy(&x, &u)) != MP_OKAY) { goto LBL_ERR; - } - } else { - /* v - v - u, D = D - B */ - if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) { + } + if ((res = mp_copy(&y, &v)) != MP_OKAY) { goto LBL_ERR; - } + } + mp_set(&D, 1); - if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } - - /* if not zero goto step 4 */ - if (mp_iszero (&u) == MP_NO) { - goto top; - } - - /* now a = C, b = D, gcd == g*v */ - - /* if v != 1 then there is no inverse */ - if (mp_cmp_d (&v, 1) != MP_EQ) { - res = MP_VAL; - goto LBL_ERR; - } - - /* b is now the inverse */ - neg = a->sign; - while (D.sign == MP_NEG) { - if ((res = mp_add (&D, b, &D)) != MP_OKAY) { +top: + /* 4. while u is even do */ + while (mp_iseven(&u) == MP_YES) { + /* 4.1 u = u/2 */ + if ((res = mp_div_2(&u, &u)) != MP_OKAY) { + goto LBL_ERR; + } + /* 4.2 if B is odd then */ + if (mp_isodd(&B) == MP_YES) { + if ((res = mp_sub(&B, &x, &B)) != MP_OKAY) { + goto LBL_ERR; + } + } + /* B = B/2 */ + if ((res = mp_div_2(&B, &B)) != MP_OKAY) { + goto LBL_ERR; + } + } + + /* 5. while v is even do */ + while (mp_iseven(&v) == MP_YES) { + /* 5.1 v = v/2 */ + if ((res = mp_div_2(&v, &v)) != MP_OKAY) { + goto LBL_ERR; + } + /* 5.2 if D is odd then */ + if (mp_isodd(&D) == MP_YES) { + /* D = (D-x)/2 */ + if ((res = mp_sub(&D, &x, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } + /* D = D/2 */ + if ((res = mp_div_2(&D, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } + + /* 6. if u >= v then */ + if (mp_cmp(&u, &v) != MP_LT) { + /* u = u - v, B = B - D */ + if ((res = mp_sub(&u, &v, &u)) != MP_OKAY) { + goto LBL_ERR; + } + + if ((res = mp_sub(&B, &D, &B)) != MP_OKAY) { + goto LBL_ERR; + } + } else { + /* v - v - u, D = D - B */ + if ((res = mp_sub(&v, &u, &v)) != MP_OKAY) { + goto LBL_ERR; + } + + if ((res = mp_sub(&D, &B, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } + + /* if not zero goto step 4 */ + if (mp_iszero(&u) == MP_NO) { + goto top; + } + + /* now a = C, b = D, gcd == g*v */ + + /* if v != 1 then there is no inverse */ + if (mp_cmp_d(&v, 1) != MP_EQ) { + res = MP_VAL; goto LBL_ERR; - } - } - mp_exch (&D, c); - c->sign = neg; - res = MP_OKAY; - -LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL); - return res; + } + + /* b is now the inverse */ + neg = a->sign; + while (D.sign == MP_NEG) { + if ((res = mp_add(&D, b, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } + mp_exch(&D, c); + c->sign = neg; + res = MP_OKAY; + +LBL_ERR: + mp_clear_multi(&x, &y, &u, &v, &B, &D, NULL); + return res; } #endif diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index 16d5ff7..f2c38bf 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -23,147 +23,147 @@ * * Based on Algorithm 14.32 on pp.601 of HAC. */ -int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) +int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho) { - int ix, res, olduse; - mp_word W[MP_WARRAY]; - - /* get old used count */ - olduse = x->used; - - /* grow a as required */ - if (x->alloc < (n->used + 1)) { - if ((res = mp_grow (x, n->used + 1)) != MP_OKAY) { - return res; - } - } - - /* first we have to get the digits of the input into - * an array of double precision words W[...] - */ - { - mp_word *_W; - mp_digit *tmpx; - - /* alias for the W[] array */ - _W = W; - - /* alias for the digits of x*/ - tmpx = x->dp; - - /* copy the digits of a into W[0..a->used-1] */ - for (ix = 0; ix < x->used; ix++) { - *_W++ = *tmpx++; - } - - /* zero the high words of W[a->used..m->used*2] */ - for (; ix < ((n->used * 2) + 1); ix++) { - *_W++ = 0; - } - } - - /* now we proceed to zero successive digits - * from the least significant upwards - */ - for (ix = 0; ix < n->used; ix++) { - /* mu = ai * m' mod b - * - * We avoid a double precision multiplication (which isn't required) - * by casting the value down to a mp_digit. Note this requires - * that W[ix-1] have the carry cleared (see after the inner loop) - */ - mp_digit mu; - mu = (mp_digit) (((W[ix] & MP_MASK) * rho) & MP_MASK); - - /* a = a + mu * m * b**i - * - * This is computed in place and on the fly. The multiplication - * by b**i is handled by offseting which columns the results - * are added to. - * - * Note the comba method normally doesn't handle carries in the - * inner loop In this case we fix the carry from the previous - * column since the Montgomery reduction requires digits of the - * result (so far) [see above] to work. This is - * handled by fixing up one carry after the inner loop. The - * carry fixups are done in order so after these loops the - * first m->used words of W[] have the carries fixed - */ - { - int iy; - mp_digit *tmpn; + int ix, res, olduse; + mp_word W[MP_WARRAY]; + + /* get old used count */ + olduse = x->used; + + /* grow a as required */ + if (x->alloc < (n->used + 1)) { + if ((res = mp_grow(x, n->used + 1)) != MP_OKAY) { + return res; + } + } + + /* first we have to get the digits of the input into + * an array of double precision words W[...] + */ + { mp_word *_W; + mp_digit *tmpx; + + /* alias for the W[] array */ + _W = W; - /* alias for the digits of the modulus */ - tmpn = n->dp; + /* alias for the digits of x*/ + tmpx = x->dp; - /* Alias for the columns set by an offset of ix */ - _W = W + ix; + /* copy the digits of a into W[0..a->used-1] */ + for (ix = 0; ix < x->used; ix++) { + *_W++ = *tmpx++; + } - /* inner loop */ - for (iy = 0; iy < n->used; iy++) { - *_W++ += ((mp_word)mu) * ((mp_word)*tmpn++); + /* zero the high words of W[a->used..m->used*2] */ + for (; ix < ((n->used * 2) + 1); ix++) { + *_W++ = 0; } - } - - /* now fix carry for next digit, W[ix+1] */ - W[ix + 1] += W[ix] >> ((mp_word) DIGIT_BIT); - } - - /* now we have to propagate the carries and - * shift the words downward [all those least - * significant digits we zeroed]. - */ - { - mp_digit *tmpx; - mp_word *_W, *_W1; - - /* nox fix rest of carries */ - - /* alias for current word */ - _W1 = W + ix; - - /* alias for next word, where the carry goes */ - _W = W + ++ix; - - for (; ix <= ((n->used * 2) + 1); ix++) { - *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT); - } - - /* copy out, A = A/b**n - * - * The result is A/b**n but instead of converting from an - * array of mp_word to mp_digit than calling mp_rshd - * we just copy them in the right order - */ - - /* alias for destination word */ - tmpx = x->dp; - - /* alias for shifted double precision result */ - _W = W + n->used; - - for (ix = 0; ix < (n->used + 1); ix++) { - *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK)); - } - - /* zero oldused digits, if the input a was larger than - * m->used+1 we'll have to clear the digits - */ - for (; ix < olduse; ix++) { - *tmpx++ = 0; - } - } - - /* set the max used and clamp */ - x->used = n->used + 1; - mp_clamp (x); - - /* if A >= m then A = A - m */ - if (mp_cmp_mag (x, n) != MP_LT) { - return s_mp_sub (x, n, x); - } - return MP_OKAY; + } + + /* now we proceed to zero successive digits + * from the least significant upwards + */ + for (ix = 0; ix < n->used; ix++) { + /* mu = ai * m' mod b + * + * We avoid a double precision multiplication (which isn't required) + * by casting the value down to a mp_digit. Note this requires + * that W[ix-1] have the carry cleared (see after the inner loop) + */ + mp_digit mu; + mu = (mp_digit)(((W[ix] & MP_MASK) * rho) & MP_MASK); + + /* a = a + mu * m * b**i + * + * This is computed in place and on the fly. The multiplication + * by b**i is handled by offseting which columns the results + * are added to. + * + * Note the comba method normally doesn't handle carries in the + * inner loop In this case we fix the carry from the previous + * column since the Montgomery reduction requires digits of the + * result (so far) [see above] to work. This is + * handled by fixing up one carry after the inner loop. The + * carry fixups are done in order so after these loops the + * first m->used words of W[] have the carries fixed + */ + { + int iy; + mp_digit *tmpn; + mp_word *_W; + + /* alias for the digits of the modulus */ + tmpn = n->dp; + + /* Alias for the columns set by an offset of ix */ + _W = W + ix; + + /* inner loop */ + for (iy = 0; iy < n->used; iy++) { + *_W++ += ((mp_word)mu) * ((mp_word)*tmpn++); + } + } + + /* now fix carry for next digit, W[ix+1] */ + W[ix + 1] += W[ix] >> ((mp_word) DIGIT_BIT); + } + + /* now we have to propagate the carries and + * shift the words downward [all those least + * significant digits we zeroed]. + */ + { + mp_digit *tmpx; + mp_word *_W, *_W1; + + /* nox fix rest of carries */ + + /* alias for current word */ + _W1 = W + ix; + + /* alias for next word, where the carry goes */ + _W = W + ++ix; + + for (; ix <= ((n->used * 2) + 1); ix++) { + *_W++ += *_W1++ >> ((mp_word) DIGIT_BIT); + } + + /* copy out, A = A/b**n + * + * The result is A/b**n but instead of converting from an + * array of mp_word to mp_digit than calling mp_rshd + * we just copy them in the right order + */ + + /* alias for destination word */ + tmpx = x->dp; + + /* alias for shifted double precision result */ + _W = W + n->used; + + for (ix = 0; ix < (n->used + 1); ix++) { + *tmpx++ = (mp_digit)(*_W++ & ((mp_word) MP_MASK)); + } + + /* zero oldused digits, if the input a was larger than + * m->used+1 we'll have to clear the digits + */ + for (; ix < olduse; ix++) { + *tmpx++ = 0; + } + } + + /* set the max used and clamp */ + x->used = n->used + 1; + mp_clamp(x); + + /* if A >= m then A = A - m */ + if (mp_cmp_mag(x, n) != MP_LT) { + return s_mp_sub(x, n, x); + } + return MP_OKAY; } #endif diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index a1015af..763dbb1 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -17,39 +17,39 @@ /* Fast (comba) multiplier * - * This is the fast column-array [comba] multiplier. It is - * designed to compute the columns of the product first - * then handle the carries afterwards. This has the effect + * This is the fast column-array [comba] multiplier. It is + * designed to compute the columns of the product first + * then handle the carries afterwards. This has the effect * of making the nested loops that compute the columns very * simple and schedulable on super-scalar processors. * - * This has been modified to produce a variable number of - * digits of output so if say only a half-product is required - * you don't have to compute the upper half (a feature + * This has been modified to produce a variable number of + * digits of output so if say only a half-product is required + * you don't have to compute the upper half (a feature * required for fast Barrett reduction). * * Based on Algorithm 14.12 on pp.595 of HAC. * */ -int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) { - int olduse, res, pa, ix, iz; - mp_digit W[MP_WARRAY]; - mp_word _W; + int olduse, res, pa, ix, iz; + mp_digit W[MP_WARRAY]; + mp_word _W; - /* grow the destination as required */ - if (c->alloc < digs) { - if ((res = mp_grow (c, digs)) != MP_OKAY) { - return res; - } - } + /* grow the destination as required */ + if (c->alloc < digs) { + if ((res = mp_grow(c, digs)) != MP_OKAY) { + return res; + } + } - /* number of output digits to produce */ - pa = MIN(digs, a->used + b->used); + /* number of output digits to produce */ + pa = MIN(digs, a->used + b->used); - /* clear the carry */ - _W = 0; - for (ix = 0; ix < pa; ix++) { + /* clear the carry */ + _W = 0; + for (ix = 0; ix < pa; ix++) { int tx, ty; int iy; mp_digit *tmpx, *tmpy; @@ -62,7 +62,7 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) tmpx = a->dp + tx; tmpy = b->dp + ty; - /* this is the number of times the loop will iterrate, essentially + /* this is the number of times the loop will iterrate, essentially while (tx++ < a->used && ty-- >= 0) { ... } */ iy = MIN(a->used-tx, ty+1); @@ -78,27 +78,27 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) /* make next carry */ _W = _W >> ((mp_word)DIGIT_BIT); - } + } - /* setup dest */ - olduse = c->used; - c->used = pa; + /* setup dest */ + olduse = c->used; + c->used = pa; - { - mp_digit *tmpc; - tmpc = c->dp; - for (ix = 0; ix < (pa + 1); ix++) { - /* now extract the previous digit [below the carry] */ - *tmpc++ = W[ix]; - } + { + mp_digit *tmpc; + tmpc = c->dp; + for (ix = 0; ix < (pa + 1); ix++) { + /* now extract the previous digit [below the carry] */ + *tmpc++ = W[ix]; + } - /* clear unused digits [that existed in the old copy of c] */ - for (; ix < olduse; ix++) { - *tmpc++ = 0; - } - } - mp_clamp (c); - return MP_OKAY; + /* clear unused digits [that existed in the old copy of c] */ + for (; ix < olduse; ix++) { + *tmpc++ = 0; + } + } + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c index 08f0355..588d80b 100644 --- a/libtommath/bn_fast_s_mp_mul_high_digs.c +++ b/libtommath/bn_fast_s_mp_mul_high_digs.c @@ -24,24 +24,24 @@ * * Based on Algorithm 14.12 on pp.595 of HAC. */ -int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs) { - int olduse, res, pa, ix, iz; - mp_digit W[MP_WARRAY]; - mp_word _W; + int olduse, res, pa, ix, iz; + mp_digit W[MP_WARRAY]; + mp_word _W; - /* grow the destination as required */ - pa = a->used + b->used; - if (c->alloc < pa) { - if ((res = mp_grow (c, pa)) != MP_OKAY) { - return res; - } - } + /* grow the destination as required */ + pa = a->used + b->used; + if (c->alloc < pa) { + if ((res = mp_grow(c, pa)) != MP_OKAY) { + return res; + } + } - /* number of output digits to produce */ - pa = a->used + b->used; - _W = 0; - for (ix = digs; ix < pa; ix++) { + /* number of output digits to produce */ + pa = a->used + b->used; + _W = 0; + for (ix = digs; ix < pa; ix++) { int tx, ty, iy; mp_digit *tmpx, *tmpy; @@ -53,7 +53,7 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) tmpx = a->dp + tx; tmpy = b->dp + ty; - /* this is the number of times the loop will iterrate, essentially its + /* this is the number of times the loop will iterrate, essentially its while (tx++ < a->used && ty-- >= 0) { ... } */ iy = MIN(a->used-tx, ty+1); @@ -68,28 +68,28 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) /* make next carry */ _W = _W >> ((mp_word)DIGIT_BIT); - } - - /* setup dest */ - olduse = c->used; - c->used = pa; + } + + /* setup dest */ + olduse = c->used; + c->used = pa; - { - mp_digit *tmpc; + { + mp_digit *tmpc; - tmpc = c->dp + digs; - for (ix = digs; ix < pa; ix++) { - /* now extract the previous digit [below the carry] */ - *tmpc++ = W[ix]; - } + tmpc = c->dp + digs; + for (ix = digs; ix < pa; ix++) { + /* now extract the previous digit [below the carry] */ + *tmpc++ = W[ix]; + } - /* clear unused digits [that existed in the old copy of c] */ - for (; ix < olduse; ix++) { - *tmpc++ = 0; - } - } - mp_clamp (c); - return MP_OKAY; + /* clear unused digits [that existed in the old copy of c] */ + for (; ix < olduse; ix++) { + *tmpc++ = 0; + } + } + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index f435af9..ceed82b 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -16,32 +16,32 @@ */ /* the jist of squaring... - * you do like mult except the offset of the tmpx [one that - * starts closer to zero] can't equal the offset of tmpy. + * you do like mult except the offset of the tmpx [one that + * starts closer to zero] can't equal the offset of tmpy. * So basically you set up iy like before then you min it with - * (ty-tx) so that it never happens. You double all those + * (ty-tx) so that it never happens. You double all those * you add in the inner loop After that loop you do the squares and add them in. */ -int fast_s_mp_sqr (mp_int * a, mp_int * b) +int fast_s_mp_sqr(mp_int *a, mp_int *b) { - int olduse, res, pa, ix, iz; - mp_digit W[MP_WARRAY], *tmpx; - mp_word W1; - - /* grow the destination as required */ - pa = a->used + a->used; - if (b->alloc < pa) { - if ((res = mp_grow (b, pa)) != MP_OKAY) { - return res; - } - } - - /* number of output digits to produce */ - W1 = 0; - for (ix = 0; ix < pa; ix++) { + int olduse, res, pa, ix, iz; + mp_digit W[MP_WARRAY], *tmpx; + mp_word W1; + + /* grow the destination as required */ + pa = a->used + a->used; + if (b->alloc < pa) { + if ((res = mp_grow(b, pa)) != MP_OKAY) { + return res; + } + } + + /* number of output digits to produce */ + W1 = 0; + for (ix = 0; ix < pa; ix++) { int tx, ty, iy; mp_word _W; mp_digit *tmpy; @@ -62,7 +62,7 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b) */ iy = MIN(a->used-tx, ty+1); - /* now for squaring tx can never equal ty + /* now for squaring tx can never equal ty * we halve the distance since they approach at a rate of 2x * and we have to round because odd cases need to be executed */ @@ -86,26 +86,26 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b) /* make next carry */ W1 = _W >> ((mp_word)DIGIT_BIT); - } - - /* setup dest */ - olduse = b->used; - b->used = a->used+a->used; - - { - mp_digit *tmpb; - tmpb = b->dp; - for (ix = 0; ix < pa; ix++) { - *tmpb++ = W[ix] & MP_MASK; - } - - /* clear unused digits [that existed in the old copy of c] */ - for (; ix < olduse; ix++) { - *tmpb++ = 0; - } - } - mp_clamp (b); - return MP_OKAY; + } + + /* setup dest */ + olduse = b->used; + b->used = a->used+a->used; + + { + mp_digit *tmpb; + tmpb = b->dp; + for (ix = 0; ix < pa; ix++) { + *tmpb++ = W[ix] & MP_MASK; + } + + /* clear unused digits [that existed in the old copy of c] */ + for (; ix < olduse; ix++) { + *tmpb++ = 0; + } + } + mp_clamp(b); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_2expt.c b/libtommath/bn_mp_2expt.c index 989bb9f..701144c 100644 --- a/libtommath/bn_mp_2expt.c +++ b/libtommath/bn_mp_2expt.c @@ -15,31 +15,30 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* computes a = 2**b +/* computes a = 2**b * * Simple algorithm which zeroes the int, grows it then just sets one bit * as required. */ -int -mp_2expt (mp_int * a, int b) +int mp_2expt(mp_int *a, int b) { - int res; + int res; - /* zero a as per default */ - mp_zero (a); + /* zero a as per default */ + mp_zero(a); - /* grow a to accomodate the single bit */ - if ((res = mp_grow (a, (b / DIGIT_BIT) + 1)) != MP_OKAY) { - return res; - } + /* grow a to accomodate the single bit */ + if ((res = mp_grow(a, (b / DIGIT_BIT) + 1)) != MP_OKAY) { + return res; + } - /* set the used count of where the bit will go */ - a->used = (b / DIGIT_BIT) + 1; + /* set the used count of where the bit will go */ + a->used = (b / DIGIT_BIT) + 1; - /* put the single bit in its place */ - a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT); + /* put the single bit in its place */ + a->dp[b / DIGIT_BIT] = ((mp_digit)1) << (b % DIGIT_BIT); - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index e7c5e25..d5fc012 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -15,26 +15,25 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* b = |a| +/* b = |a| * * Simple function copies the input and fixes the sign to positive */ -int -mp_abs (mp_int * a, mp_int * b) +int mp_abs(mp_int *a, mp_int *b) { - int res; + int res; - /* copy a to b */ - if (a != b) { - if ((res = mp_copy (a, b)) != MP_OKAY) { - return res; - } - } + /* copy a to b */ + if (a != b) { + if ((res = mp_copy(a, b)) != MP_OKAY) { + return res; + } + } - /* force the sign of b to positive */ - b->sign = MP_ZPOS; + /* force the sign of b to positive */ + b->sign = MP_ZPOS; - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index bdb166f..4df4c81 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -16,34 +16,34 @@ */ /* high level addition (handles signs) */ -int mp_add (mp_int * a, mp_int * b, mp_int * c) +int mp_add(mp_int *a, mp_int *b, mp_int *c) { - int sa, sb, res; + int sa, sb, res; - /* get sign of both inputs */ - sa = a->sign; - sb = b->sign; + /* get sign of both inputs */ + sa = a->sign; + sb = b->sign; - /* handle two cases, not four */ - if (sa == sb) { - /* both positive or both negative */ - /* add their magnitudes, copy the sign */ - c->sign = sa; - res = s_mp_add (a, b, c); - } else { - /* one positive, the other negative */ - /* subtract the one with the greater magnitude from */ - /* the one of the lesser magnitude. The result gets */ - /* the sign of the one with the greater magnitude. */ - if (mp_cmp_mag (a, b) == MP_LT) { - c->sign = sb; - res = s_mp_sub (b, a, c); - } else { + /* handle two cases, not four */ + if (sa == sb) { + /* both positive or both negative */ + /* add their magnitudes, copy the sign */ c->sign = sa; - res = s_mp_sub (a, b, c); - } - } - return res; + res = s_mp_add(a, b, c); + } else { + /* one positive, the other negative */ + /* subtract the one with the greater magnitude from */ + /* the one of the lesser magnitude. The result gets */ + /* the sign of the one with the greater magnitude. */ + if (mp_cmp_mag(a, b) == MP_LT) { + c->sign = sb; + res = s_mp_sub(b, a, c); + } else { + c->sign = sa; + res = s_mp_sub(a, b, c); + } + } + return res; } #endif diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index fd1a186..1e6ff63 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -16,93 +16,92 @@ */ /* single digit addition */ -int -mp_add_d (mp_int * a, mp_digit b, mp_int * c) +int mp_add_d(mp_int *a, mp_digit b, mp_int *c) { - int res, ix, oldused; - mp_digit *tmpa, *tmpc, mu; - - /* grow c as required */ - if (c->alloc < (a->used + 1)) { - if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { - return res; - } - } - - /* if a is negative and |a| >= b, call c = |a| - b */ - if ((a->sign == MP_NEG) && ((a->used > 1) || (a->dp[0] >= b))) { - /* temporarily fix sign of a */ - a->sign = MP_ZPOS; - - /* c = |a| - b */ - res = mp_sub_d(a, b, c); - - /* fix sign */ - a->sign = c->sign = MP_NEG; - - /* clamp */ - mp_clamp(c); - - return res; - } - - /* old number of used digits in c */ - oldused = c->used; - - /* source alias */ - tmpa = a->dp; - - /* destination alias */ - tmpc = c->dp; - - /* if a is positive */ - if (a->sign == MP_ZPOS) { - /* add digit, after this we're propagating - * the carry. - */ - *tmpc = *tmpa++ + b; - mu = *tmpc >> DIGIT_BIT; - *tmpc++ &= MP_MASK; - - /* now handle rest of the digits */ - for (ix = 1; ix < a->used; ix++) { - *tmpc = *tmpa++ + mu; - mu = *tmpc >> DIGIT_BIT; - *tmpc++ &= MP_MASK; - } - /* set final carry */ - ix++; - *tmpc++ = mu; - - /* setup size */ - c->used = a->used + 1; - } else { - /* a was negative and |a| < b */ - c->used = 1; - - /* the result is a single digit */ - if (a->used == 1) { - *tmpc++ = b - a->dp[0]; - } else { - *tmpc++ = b; - } - - /* setup count so the clearing of oldused - * can fall through correctly - */ - ix = 1; - } - - /* sign always positive */ - c->sign = MP_ZPOS; - - /* now zero to oldused */ - while (ix++ < oldused) { - *tmpc++ = 0; - } - mp_clamp(c); - - return MP_OKAY; + int res, ix, oldused; + mp_digit *tmpa, *tmpc, mu; + + /* grow c as required */ + if (c->alloc < (a->used + 1)) { + if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { + return res; + } + } + + /* if a is negative and |a| >= b, call c = |a| - b */ + if ((a->sign == MP_NEG) && ((a->used > 1) || (a->dp[0] >= b))) { + /* temporarily fix sign of a */ + a->sign = MP_ZPOS; + + /* c = |a| - b */ + res = mp_sub_d(a, b, c); + + /* fix sign */ + a->sign = c->sign = MP_NEG; + + /* clamp */ + mp_clamp(c); + + return res; + } + + /* old number of used digits in c */ + oldused = c->used; + + /* source alias */ + tmpa = a->dp; + + /* destination alias */ + tmpc = c->dp; + + /* if a is positive */ + if (a->sign == MP_ZPOS) { + /* add digit, after this we're propagating + * the carry. + */ + *tmpc = *tmpa++ + b; + mu = *tmpc >> DIGIT_BIT; + *tmpc++ &= MP_MASK; + + /* now handle rest of the digits */ + for (ix = 1; ix < a->used; ix++) { + *tmpc = *tmpa++ + mu; + mu = *tmpc >> DIGIT_BIT; + *tmpc++ &= MP_MASK; + } + /* set final carry */ + ix++; + *tmpc++ = mu; + + /* setup size */ + c->used = a->used + 1; + } else { + /* a was negative and |a| < b */ + c->used = 1; + + /* the result is a single digit */ + if (a->used == 1) { + *tmpc++ = b - a->dp[0]; + } else { + *tmpc++ = b; + } + + /* setup count so the clearing of oldused + * can fall through correctly + */ + ix = 1; + } + + /* sign always positive */ + c->sign = MP_ZPOS; + + /* now zero to oldused */ + while (ix++ < oldused) { + *tmpc++ = 0; + } + mp_clamp(c); + + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index dc06788..229a716 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -16,23 +16,22 @@ */ /* d = a + b (mod c) */ -int -mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) { - int res; - mp_int t; + int res; + mp_int t; - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } + if ((res = mp_init(&t)) != MP_OKAY) { + return res; + } - if ((res = mp_add (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, c, d); - mp_clear (&t); - return res; + if ((res = mp_add(a, b, &t)) != MP_OKAY) { + mp_clear(&t); + return res; + } + res = mp_mod(&t, c, d); + mp_clear(&t); + return res; } #endif diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 53008a5..2f1472a 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -16,39 +16,38 @@ */ /* AND two ints together */ -int -mp_and (mp_int * a, mp_int * b, mp_int * c) +int mp_and(mp_int *a, mp_int *b, mp_int *c) { - int res, ix, px; - mp_int t, *x; + int res, ix, px; + mp_int t, *x; - if (a->used > b->used) { - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - px = b->used; - x = b; - } else { - if ((res = mp_init_copy (&t, b)) != MP_OKAY) { - return res; - } - px = a->used; - x = a; - } + if (a->used > b->used) { + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } + px = b->used; + x = b; + } else { + if ((res = mp_init_copy(&t, b)) != MP_OKAY) { + return res; + } + px = a->used; + x = a; + } - for (ix = 0; ix < px; ix++) { - t.dp[ix] &= x->dp[ix]; - } + for (ix = 0; ix < px; ix++) { + t.dp[ix] &= x->dp[ix]; + } - /* zero digits above the last from the smallest mp_int */ - for (; ix < t.used; ix++) { - t.dp[ix] = 0; - } + /* zero digits above the last from the smallest mp_int */ + for (; ix < t.used; ix++) { + t.dp[ix] = 0; + } - mp_clamp (&t); - mp_exch (c, &t); - mp_clear (&t); - return MP_OKAY; + mp_clamp(&t); + mp_exch(c, &t); + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_clamp.c b/libtommath/bn_mp_clamp.c index 2c0a1a6..3853914 100644 --- a/libtommath/bn_mp_clamp.c +++ b/libtommath/bn_mp_clamp.c @@ -15,27 +15,26 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* trim unused digits +/* trim unused digits * * This is used to ensure that leading zero digits are * trimed and the leading "used" digit will be non-zero * Typically very fast. Also fixes the sign if there * are no more leading digits */ -void -mp_clamp (mp_int * a) +void mp_clamp(mp_int *a) { - /* decrease used while the most significant digit is - * zero. - */ - while ((a->used > 0) && (a->dp[a->used - 1] == 0)) { - --(a->used); - } + /* decrease used while the most significant digit is + * zero. + */ + while ((a->used > 0) && (a->dp[a->used - 1] == 0)) { + --(a->used); + } - /* reset the sign flag if used == 0 */ - if (a->used == 0) { - a->sign = MP_ZPOS; - } + /* reset the sign flag if used == 0 */ + if (a->used == 0) { + a->sign = MP_ZPOS; + } } #endif diff --git a/libtommath/bn_mp_clear.c b/libtommath/bn_mp_clear.c index 97f3db0..fcf4d61 100644 --- a/libtommath/bn_mp_clear.c +++ b/libtommath/bn_mp_clear.c @@ -16,26 +16,25 @@ */ /* clear one (frees) */ -void -mp_clear (mp_int * a) +void mp_clear(mp_int *a) { - int i; + int i; - /* only do anything if a hasn't been freed previously */ - if (a->dp != NULL) { - /* first zero the digits */ - for (i = 0; i < a->used; i++) { - a->dp[i] = 0; - } + /* only do anything if a hasn't been freed previously */ + if (a->dp != NULL) { + /* first zero the digits */ + for (i = 0; i < a->used; i++) { + a->dp[i] = 0; + } - /* free ram */ - XFREE(a->dp); + /* free ram */ + XFREE(a->dp); - /* reset members to make debugging easier */ - a->dp = NULL; - a->alloc = a->used = 0; - a->sign = MP_ZPOS; - } + /* reset members to make debugging easier */ + a->dp = NULL; + a->alloc = a->used = 0; + a->sign = MP_ZPOS; + } } #endif diff --git a/libtommath/bn_mp_clear_multi.c b/libtommath/bn_mp_clear_multi.c index bd4b232..284fab8 100644 --- a/libtommath/bn_mp_clear_multi.c +++ b/libtommath/bn_mp_clear_multi.c @@ -16,16 +16,16 @@ */ #include -void mp_clear_multi(mp_int *mp, ...) +void mp_clear_multi(mp_int *mp, ...) { - mp_int* next_mp = mp; - va_list args; - va_start(args, mp); - while (next_mp != NULL) { - mp_clear(next_mp); - next_mp = va_arg(args, mp_int*); - } - va_end(args); + mp_int *next_mp = mp; + va_list args; + va_start(args, mp); + while (next_mp != NULL) { + mp_clear(next_mp); + next_mp = va_arg(args, mp_int *); + } + va_end(args); } #endif diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index e757ddf..9047060 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -16,25 +16,24 @@ */ /* compare two ints (signed)*/ -int -mp_cmp (mp_int * a, mp_int * b) +int mp_cmp(mp_int *a, mp_int *b) { - /* compare based on sign */ - if (a->sign != b->sign) { - if (a->sign == MP_NEG) { - return MP_LT; - } else { - return MP_GT; - } - } - - /* compare digits */ - if (a->sign == MP_NEG) { - /* if negative compare opposite direction */ - return mp_cmp_mag(b, a); - } else { - return mp_cmp_mag(a, b); - } + /* compare based on sign */ + if (a->sign != b->sign) { + if (a->sign == MP_NEG) { + return MP_LT; + } else { + return MP_GT; + } + } + + /* compare digits */ + if (a->sign == MP_NEG) { + /* if negative compare opposite direction */ + return mp_cmp_mag(b, a); + } else { + return mp_cmp_mag(a, b); + } } #endif diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c index 3f5ebae..27a546d 100644 --- a/libtommath/bn_mp_cmp_d.c +++ b/libtommath/bn_mp_cmp_d.c @@ -16,26 +16,26 @@ */ /* compare a digit */ -int mp_cmp_d(mp_int * a, mp_digit b) +int mp_cmp_d(mp_int *a, mp_digit b) { - /* compare based on sign */ - if (a->sign == MP_NEG) { - return MP_LT; - } + /* compare based on sign */ + if (a->sign == MP_NEG) { + return MP_LT; + } - /* compare based on magnitude */ - if (a->used > 1) { - return MP_GT; - } + /* compare based on magnitude */ + if (a->used > 1) { + return MP_GT; + } - /* compare the only digit of a to b */ - if (a->dp[0] > b) { - return MP_GT; - } else if (a->dp[0] < b) { - return MP_LT; - } else { - return MP_EQ; - } + /* compare the only digit of a to b */ + if (a->dp[0] > b) { + return MP_GT; + } else if (a->dp[0] < b) { + return MP_LT; + } else { + return MP_EQ; + } } #endif diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c index 7ceda97..ca2bc88 100644 --- a/libtommath/bn_mp_cmp_mag.c +++ b/libtommath/bn_mp_cmp_mag.c @@ -16,37 +16,37 @@ */ /* compare maginitude of two ints (unsigned) */ -int mp_cmp_mag (mp_int * a, mp_int * b) +int mp_cmp_mag(mp_int *a, mp_int *b) { - int n; - mp_digit *tmpa, *tmpb; - - /* compare based on # of non-zero digits */ - if (a->used > b->used) { - return MP_GT; - } - - if (a->used < b->used) { - return MP_LT; - } - - /* alias for a */ - tmpa = a->dp + (a->used - 1); - - /* alias for b */ - tmpb = b->dp + (a->used - 1); - - /* compare based on digits */ - for (n = 0; n < a->used; ++n, --tmpa, --tmpb) { - if (*tmpa > *tmpb) { + int n; + mp_digit *tmpa, *tmpb; + + /* compare based on # of non-zero digits */ + if (a->used > b->used) { return MP_GT; - } + } - if (*tmpa < *tmpb) { + if (a->used < b->used) { return MP_LT; - } - } - return MP_EQ; + } + + /* alias for a */ + tmpa = a->dp + (a->used - 1); + + /* alias for b */ + tmpb = b->dp + (a->used - 1); + + /* compare based on digits */ + for (n = 0; n < a->used; ++n, --tmpa, --tmpb) { + if (*tmpa > *tmpb) { + return MP_GT; + } + + if (*tmpa < *tmpb) { + return MP_LT; + } + } + return MP_EQ; } #endif diff --git a/libtommath/bn_mp_cnt_lsb.c b/libtommath/bn_mp_cnt_lsb.c index bf201b5..7273655 100644 --- a/libtommath/bn_mp_cnt_lsb.c +++ b/libtommath/bn_mp_cnt_lsb.c @@ -15,7 +15,7 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -static const int lnz[16] = { +static const int lnz[16] = { 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 }; diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index 84e839e..bed03b2 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -16,50 +16,49 @@ */ /* copy, b = a */ -int -mp_copy (mp_int * a, mp_int * b) +int mp_copy(mp_int *a, mp_int *b) { - int res, n; + int res, n; - /* if dst == src do nothing */ - if (a == b) { - return MP_OKAY; - } + /* if dst == src do nothing */ + if (a == b) { + return MP_OKAY; + } - /* grow dest */ - if (b->alloc < a->used) { - if ((res = mp_grow (b, a->used)) != MP_OKAY) { - return res; - } - } + /* grow dest */ + if (b->alloc < a->used) { + if ((res = mp_grow(b, a->used)) != MP_OKAY) { + return res; + } + } - /* zero b and copy the parameters over */ - { - mp_digit *tmpa, *tmpb; + /* zero b and copy the parameters over */ + { + mp_digit *tmpa, *tmpb; - /* pointer aliases */ + /* pointer aliases */ - /* source */ - tmpa = a->dp; + /* source */ + tmpa = a->dp; - /* destination */ - tmpb = b->dp; + /* destination */ + tmpb = b->dp; - /* copy all the digits */ - for (n = 0; n < a->used; n++) { - *tmpb++ = *tmpa++; - } + /* copy all the digits */ + for (n = 0; n < a->used; n++) { + *tmpb++ = *tmpa++; + } - /* clear high digits */ - for (; n < b->used; n++) { - *tmpb++ = 0; - } - } + /* clear high digits */ + for (; n < b->used; n++) { + *tmpb++ = 0; + } + } - /* copy used count and sign */ - b->used = a->used; - b->sign = a->sign; - return MP_OKAY; + /* copy used count and sign */ + b->used = a->used; + b->sign = a->sign; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index ff558eb..dea364f 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -16,27 +16,26 @@ */ /* returns the number of bits in an int */ -int -mp_count_bits (mp_int * a) +int mp_count_bits(mp_int *a) { - int r; - mp_digit q; + int r; + mp_digit q; - /* shortcut */ - if (a->used == 0) { - return 0; - } + /* shortcut */ + if (a->used == 0) { + return 0; + } - /* get number of digits and add that */ - r = (a->used - 1) * DIGIT_BIT; - - /* take the last digit and count the bits in it */ - q = a->dp[a->used - 1]; - while (q > ((mp_digit) 0)) { - ++r; - q >>= ((mp_digit) 1); - } - return r; + /* get number of digits and add that */ + r = (a->used - 1) * DIGIT_BIT; + + /* take the last digit and count the bits in it */ + q = a->dp[a->used - 1]; + while (q > ((mp_digit) 0)) { + ++r; + q >>= ((mp_digit) 1); + } + return r; } #endif diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 0890e65..fdb3453 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -18,68 +18,68 @@ #ifdef BN_MP_DIV_SMALL /* slower bit-bang division... also smaller */ -int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d) { mp_int ta, tb, tq, q; int res, n, n2; - /* is divisor zero ? */ - if (mp_iszero (b) == MP_YES) { - return MP_VAL; - } - - /* if a < b then q=0, r = a */ - if (mp_cmp_mag (a, b) == MP_LT) { - if (d != NULL) { - res = mp_copy (a, d); - } else { - res = MP_OKAY; - } - if (c != NULL) { - mp_zero (c); - } - return res; - } - - /* init our temps */ - if ((res = mp_init_multi(&ta, &tb, &tq, &q, NULL)) != MP_OKAY) { - return res; - } - - - mp_set(&tq, 1); - n = mp_count_bits(a) - mp_count_bits(b); - if (((res = mp_abs(a, &ta)) != MP_OKAY) || - ((res = mp_abs(b, &tb)) != MP_OKAY) || - ((res = mp_mul_2d(&tb, n, &tb)) != MP_OKAY) || - ((res = mp_mul_2d(&tq, n, &tq)) != MP_OKAY)) { + /* is divisor zero ? */ + if (mp_iszero(b) == MP_YES) { + return MP_VAL; + } + + /* if a < b then q=0, r = a */ + if (mp_cmp_mag(a, b) == MP_LT) { + if (d != NULL) { + res = mp_copy(a, d); + } else { + res = MP_OKAY; + } + if (c != NULL) { + mp_zero(c); + } + return res; + } + + /* init our temps */ + if ((res = mp_init_multi(&ta, &tb, &tq, &q, NULL)) != MP_OKAY) { + return res; + } + + + mp_set(&tq, 1); + n = mp_count_bits(a) - mp_count_bits(b); + if (((res = mp_abs(a, &ta)) != MP_OKAY) || + ((res = mp_abs(b, &tb)) != MP_OKAY) || + ((res = mp_mul_2d(&tb, n, &tb)) != MP_OKAY) || + ((res = mp_mul_2d(&tq, n, &tq)) != MP_OKAY)) { goto LBL_ERR; - } - - while (n-- >= 0) { - if (mp_cmp(&tb, &ta) != MP_GT) { - if (((res = mp_sub(&ta, &tb, &ta)) != MP_OKAY) || - ((res = mp_add(&q, &tq, &q)) != MP_OKAY)) { - goto LBL_ERR; - } - } - if (((res = mp_div_2d(&tb, 1, &tb, NULL)) != MP_OKAY) || - ((res = mp_div_2d(&tq, 1, &tq, NULL)) != MP_OKAY)) { - goto LBL_ERR; - } - } - - /* now q == quotient and ta == remainder */ - n = a->sign; - n2 = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; - if (c != NULL) { - mp_exch(c, &q); - c->sign = (mp_iszero(c) == MP_YES) ? MP_ZPOS : n2; - } - if (d != NULL) { - mp_exch(d, &ta); - d->sign = (mp_iszero(d) == MP_YES) ? MP_ZPOS : n; - } + } + + while (n-- >= 0) { + if (mp_cmp(&tb, &ta) != MP_GT) { + if (((res = mp_sub(&ta, &tb, &ta)) != MP_OKAY) || + ((res = mp_add(&q, &tq, &q)) != MP_OKAY)) { + goto LBL_ERR; + } + } + if (((res = mp_div_2d(&tb, 1, &tb, NULL)) != MP_OKAY) || + ((res = mp_div_2d(&tq, 1, &tq, NULL)) != MP_OKAY)) { + goto LBL_ERR; + } + } + + /* now q == quotient and ta == remainder */ + n = a->sign; + n2 = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; + if (c != NULL) { + mp_exch(c, &q); + c->sign = (mp_iszero(c) == MP_YES) ? MP_ZPOS : n2; + } + if (d != NULL) { + mp_exch(d, &ta); + d->sign = (mp_iszero(d) == MP_YES) ? MP_ZPOS : n; + } LBL_ERR: mp_clear_multi(&ta, &tb, &tq, &q, NULL); return res; @@ -100,190 +100,195 @@ LBL_ERR: * The overall algorithm is as described as * 14.20 from HAC but fixed to treat these cases. */ -int mp_div (mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d) { - mp_int q, x, y, t1, t2; - int res, n, t, i, norm, neg; - - /* is divisor zero ? */ - if (mp_iszero (b) == MP_YES) { - return MP_VAL; - } - - /* if a < b then q=0, r = a */ - if (mp_cmp_mag (a, b) == MP_LT) { - if (d != NULL) { - res = mp_copy (a, d); - } else { - res = MP_OKAY; - } - if (c != NULL) { - mp_zero (c); - } - return res; - } - - if ((res = mp_init_size (&q, a->used + 2)) != MP_OKAY) { - return res; - } - q.used = a->used + 2; - - if ((res = mp_init (&t1)) != MP_OKAY) { - goto LBL_Q; - } - - if ((res = mp_init (&t2)) != MP_OKAY) { - goto LBL_T1; - } - - if ((res = mp_init_copy (&x, a)) != MP_OKAY) { - goto LBL_T2; - } - - if ((res = mp_init_copy (&y, b)) != MP_OKAY) { - goto LBL_X; - } - - /* fix the sign */ - neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; - x.sign = y.sign = MP_ZPOS; - - /* normalize both x and y, ensure that y >= b/2, [b == 2**DIGIT_BIT] */ - norm = mp_count_bits(&y) % DIGIT_BIT; - if (norm < (int)(DIGIT_BIT-1)) { - norm = (DIGIT_BIT-1) - norm; - if ((res = mp_mul_2d (&x, norm, &x)) != MP_OKAY) { - goto LBL_Y; - } - if ((res = mp_mul_2d (&y, norm, &y)) != MP_OKAY) { - goto LBL_Y; - } - } else { - norm = 0; - } - - /* note hac does 0 based, so if used==5 then its 0,1,2,3,4, e.g. use 4 */ - n = x.used - 1; - t = y.used - 1; - - /* while (x >= y*b**n-t) do { q[n-t] += 1; x -= y*b**{n-t} } */ - if ((res = mp_lshd (&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */ - goto LBL_Y; - } - - while (mp_cmp (&x, &y) != MP_LT) { - ++(q.dp[n - t]); - if ((res = mp_sub (&x, &y, &x)) != MP_OKAY) { - goto LBL_Y; - } - } - - /* reset y by shifting it back down */ - mp_rshd (&y, n - t); - - /* step 3. for i from n down to (t + 1) */ - for (i = n; i >= (t + 1); i--) { - if (i > x.used) { - continue; - } - - /* step 3.1 if xi == yt then set q{i-t-1} to b-1, - * otherwise set q{i-t-1} to (xi*b + x{i-1})/yt */ - if (x.dp[i] == y.dp[t]) { - q.dp[(i - t) - 1] = ((((mp_digit)1) << DIGIT_BIT) - 1); - } else { - mp_word tmp; - tmp = ((mp_word) x.dp[i]) << ((mp_word) DIGIT_BIT); - tmp |= ((mp_word) x.dp[i - 1]); - tmp /= ((mp_word) y.dp[t]); - if (tmp > (mp_word) MP_MASK) { - tmp = MP_MASK; + mp_int q, x, y, t1, t2; + int res, n, t, i, norm, neg; + + /* is divisor zero ? */ + if (mp_iszero(b) == MP_YES) { + return MP_VAL; + } + + /* if a < b then q=0, r = a */ + if (mp_cmp_mag(a, b) == MP_LT) { + if (d != NULL) { + res = mp_copy(a, d); + } else { + res = MP_OKAY; } - q.dp[(i - t) - 1] = (mp_digit) (tmp & (mp_word) (MP_MASK)); - } - - /* while (q{i-t-1} * (yt * b + y{t-1})) > - xi * b**2 + xi-1 * b + xi-2 - - do q{i-t-1} -= 1; - */ - q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] + 1) & MP_MASK; - do { - q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] - 1) & MP_MASK; - - /* find left hand */ - mp_zero (&t1); - t1.dp[0] = ((t - 1) < 0) ? 0 : y.dp[t - 1]; - t1.dp[1] = y.dp[t]; - t1.used = 2; - if ((res = mp_mul_d (&t1, q.dp[(i - t) - 1], &t1)) != MP_OKAY) { - goto LBL_Y; + if (c != NULL) { + mp_zero(c); } + return res; + } + + if ((res = mp_init_size(&q, a->used + 2)) != MP_OKAY) { + return res; + } + q.used = a->used + 2; + + if ((res = mp_init(&t1)) != MP_OKAY) { + goto LBL_Q; + } + + if ((res = mp_init(&t2)) != MP_OKAY) { + goto LBL_T1; + } + + if ((res = mp_init_copy(&x, a)) != MP_OKAY) { + goto LBL_T2; + } + + if ((res = mp_init_copy(&y, b)) != MP_OKAY) { + goto LBL_X; + } + + /* fix the sign */ + neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; + x.sign = y.sign = MP_ZPOS; + + /* normalize both x and y, ensure that y >= b/2, [b == 2**DIGIT_BIT] */ + norm = mp_count_bits(&y) % DIGIT_BIT; + if (norm < (int)(DIGIT_BIT-1)) { + norm = (DIGIT_BIT-1) - norm; + if ((res = mp_mul_2d(&x, norm, &x)) != MP_OKAY) { + goto LBL_Y; + } + if ((res = mp_mul_2d(&y, norm, &y)) != MP_OKAY) { + goto LBL_Y; + } + } else { + norm = 0; + } - /* find right hand */ - t2.dp[0] = ((i - 2) < 0) ? 0 : x.dp[i - 2]; - t2.dp[1] = ((i - 1) < 0) ? 0 : x.dp[i - 1]; - t2.dp[2] = x.dp[i]; - t2.used = 3; - } while (mp_cmp_mag(&t1, &t2) == MP_GT); + /* note hac does 0 based, so if used==5 then its 0,1,2,3,4, e.g. use 4 */ + n = x.used - 1; + t = y.used - 1; - /* step 3.3 x = x - q{i-t-1} * y * b**{i-t-1} */ - if ((res = mp_mul_d (&y, q.dp[(i - t) - 1], &t1)) != MP_OKAY) { + /* while (x >= y*b**n-t) do { q[n-t] += 1; x -= y*b**{n-t} } */ + if ((res = mp_lshd(&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */ goto LBL_Y; - } + } - if ((res = mp_lshd (&t1, (i - t) - 1)) != MP_OKAY) { - goto LBL_Y; - } + while (mp_cmp(&x, &y) != MP_LT) { + ++(q.dp[n - t]); + if ((res = mp_sub(&x, &y, &x)) != MP_OKAY) { + goto LBL_Y; + } + } - if ((res = mp_sub (&x, &t1, &x)) != MP_OKAY) { - goto LBL_Y; - } + /* reset y by shifting it back down */ + mp_rshd(&y, n - t); - /* if x < 0 then { x = x + y*b**{i-t-1}; q{i-t-1} -= 1; } */ - if (x.sign == MP_NEG) { - if ((res = mp_copy (&y, &t1)) != MP_OKAY) { - goto LBL_Y; + /* step 3. for i from n down to (t + 1) */ + for (i = n; i >= (t + 1); i--) { + if (i > x.used) { + continue; } - if ((res = mp_lshd (&t1, (i - t) - 1)) != MP_OKAY) { - goto LBL_Y; + + /* step 3.1 if xi == yt then set q{i-t-1} to b-1, + * otherwise set q{i-t-1} to (xi*b + x{i-1})/yt */ + if (x.dp[i] == y.dp[t]) { + q.dp[(i - t) - 1] = ((((mp_digit)1) << DIGIT_BIT) - 1); + } else { + mp_word tmp; + tmp = ((mp_word) x.dp[i]) << ((mp_word) DIGIT_BIT); + tmp |= ((mp_word) x.dp[i - 1]); + tmp /= ((mp_word) y.dp[t]); + if (tmp > (mp_word) MP_MASK) { + tmp = MP_MASK; + } + q.dp[(i - t) - 1] = (mp_digit)(tmp & (mp_word)(MP_MASK)); } - if ((res = mp_add (&x, &t1, &x)) != MP_OKAY) { - goto LBL_Y; + + /* while (q{i-t-1} * (yt * b + y{t-1})) > + xi * b**2 + xi-1 * b + xi-2 + + do q{i-t-1} -= 1; + */ + q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] + 1) & MP_MASK; + do { + q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] - 1) & MP_MASK; + + /* find left hand */ + mp_zero(&t1); + t1.dp[0] = ((t - 1) < 0) ? 0 : y.dp[t - 1]; + t1.dp[1] = y.dp[t]; + t1.used = 2; + if ((res = mp_mul_d(&t1, q.dp[(i - t) - 1], &t1)) != MP_OKAY) { + goto LBL_Y; + } + + /* find right hand */ + t2.dp[0] = ((i - 2) < 0) ? 0 : x.dp[i - 2]; + t2.dp[1] = ((i - 1) < 0) ? 0 : x.dp[i - 1]; + t2.dp[2] = x.dp[i]; + t2.used = 3; + } while (mp_cmp_mag(&t1, &t2) == MP_GT); + + /* step 3.3 x = x - q{i-t-1} * y * b**{i-t-1} */ + if ((res = mp_mul_d(&y, q.dp[(i - t) - 1], &t1)) != MP_OKAY) { + goto LBL_Y; } - q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] - 1UL) & MP_MASK; - } - } + if ((res = mp_lshd(&t1, (i - t) - 1)) != MP_OKAY) { + goto LBL_Y; + } - /* now q is the quotient and x is the remainder - * [which we have to normalize] - */ + if ((res = mp_sub(&x, &t1, &x)) != MP_OKAY) { + goto LBL_Y; + } - /* get sign before writing to c */ - x.sign = (x.used == 0) ? MP_ZPOS : a->sign; + /* if x < 0 then { x = x + y*b**{i-t-1}; q{i-t-1} -= 1; } */ + if (x.sign == MP_NEG) { + if ((res = mp_copy(&y, &t1)) != MP_OKAY) { + goto LBL_Y; + } + if ((res = mp_lshd(&t1, (i - t) - 1)) != MP_OKAY) { + goto LBL_Y; + } + if ((res = mp_add(&x, &t1, &x)) != MP_OKAY) { + goto LBL_Y; + } + + q.dp[(i - t) - 1] = (q.dp[(i - t) - 1] - 1UL) & MP_MASK; + } + } - if (c != NULL) { - mp_clamp (&q); - mp_exch (&q, c); - c->sign = neg; - } + /* now q is the quotient and x is the remainder + * [which we have to normalize] + */ - if (d != NULL) { - if ((res = mp_div_2d (&x, norm, &x, NULL)) != MP_OKAY) { - goto LBL_Y; - } - mp_exch (&x, d); - } - - res = MP_OKAY; - -LBL_Y:mp_clear (&y); -LBL_X:mp_clear (&x); -LBL_T2:mp_clear (&t2); -LBL_T1:mp_clear (&t1); -LBL_Q:mp_clear (&q); - return res; + /* get sign before writing to c */ + x.sign = (x.used == 0) ? MP_ZPOS : a->sign; + + if (c != NULL) { + mp_clamp(&q); + mp_exch(&q, c); + c->sign = neg; + } + + if (d != NULL) { + if ((res = mp_div_2d(&x, norm, &x, NULL)) != MP_OKAY) { + goto LBL_Y; + } + mp_exch(&x, d); + } + + res = MP_OKAY; + +LBL_Y: + mp_clear(&y); +LBL_X: + mp_clear(&x); +LBL_T2: + mp_clear(&t2); +LBL_T1: + mp_clear(&t1); +LBL_Q: + mp_clear(&q); + return res; } #endif diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index 2b5bb49..b9d5339 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -16,50 +16,50 @@ */ /* b = a/2 */ -int mp_div_2(mp_int * a, mp_int * b) +int mp_div_2(mp_int *a, mp_int *b) { - int x, res, oldused; + int x, res, oldused; - /* copy */ - if (b->alloc < a->used) { - if ((res = mp_grow (b, a->used)) != MP_OKAY) { - return res; - } - } + /* copy */ + if (b->alloc < a->used) { + if ((res = mp_grow(b, a->used)) != MP_OKAY) { + return res; + } + } - oldused = b->used; - b->used = a->used; - { - mp_digit r, rr, *tmpa, *tmpb; + oldused = b->used; + b->used = a->used; + { + mp_digit r, rr, *tmpa, *tmpb; - /* source alias */ - tmpa = a->dp + b->used - 1; + /* source alias */ + tmpa = a->dp + b->used - 1; - /* dest alias */ - tmpb = b->dp + b->used - 1; + /* dest alias */ + tmpb = b->dp + b->used - 1; - /* carry */ - r = 0; - for (x = b->used - 1; x >= 0; x--) { - /* get the carry for the next iteration */ - rr = *tmpa & 1; + /* carry */ + r = 0; + for (x = b->used - 1; x >= 0; x--) { + /* get the carry for the next iteration */ + rr = *tmpa & 1; - /* shift the current digit, add in carry and store */ - *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1)); + /* shift the current digit, add in carry and store */ + *tmpb-- = (*tmpa-- >> 1) | (r << (DIGIT_BIT - 1)); - /* forward carry to next iteration */ - r = rr; - } + /* forward carry to next iteration */ + r = rr; + } - /* zero excess digits */ - tmpb = b->dp + b->used; - for (x = b->used; x < oldused; x++) { - *tmpb++ = 0; - } - } - b->sign = a->sign; - mp_clamp (b); - return MP_OKAY; + /* zero excess digits */ + tmpb = b->dp + b->used; + for (x = b->used; x < oldused; x++) { + *tmpb++ = 0; + } + } + b->sign = a->sign; + mp_clamp(b); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c index 635d374..d6723ee 100644 --- a/libtommath/bn_mp_div_2d.c +++ b/libtommath/bn_mp_div_2d.c @@ -16,68 +16,68 @@ */ /* shift right by a certain bit count (store quotient in c, optional remainder in d) */ -int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) +int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d) { - mp_digit D, r, rr; - int x, res; + mp_digit D, r, rr; + int x, res; - /* if the shift count is <= 0 then we do no work */ - if (b <= 0) { - res = mp_copy (a, c); - if (d != NULL) { - mp_zero (d); - } - return res; - } - - /* copy */ - if ((res = mp_copy (a, c)) != MP_OKAY) { - return res; - } - /* 'a' should not be used after here - it might be the same as d */ + /* if the shift count is <= 0 then we do no work */ + if (b <= 0) { + res = mp_copy(a, c); + if (d != NULL) { + mp_zero(d); + } + return res; + } - /* get the remainder */ - if (d != NULL) { - if ((res = mp_mod_2d (a, b, d)) != MP_OKAY) { + /* copy */ + if ((res = mp_copy(a, c)) != MP_OKAY) { return res; - } - } + } + /* 'a' should not be used after here - it might be the same as d */ + + /* get the remainder */ + if (d != NULL) { + if ((res = mp_mod_2d(a, b, d)) != MP_OKAY) { + return res; + } + } - /* shift by as many digits in the bit count */ - if (b >= (int)DIGIT_BIT) { - mp_rshd (c, b / DIGIT_BIT); - } + /* shift by as many digits in the bit count */ + if (b >= (int)DIGIT_BIT) { + mp_rshd(c, b / DIGIT_BIT); + } - /* shift any bit count < DIGIT_BIT */ - D = (mp_digit) (b % DIGIT_BIT); - if (D != 0) { - mp_digit *tmpc, mask, shift; + /* shift any bit count < DIGIT_BIT */ + D = (mp_digit)(b % DIGIT_BIT); + if (D != 0) { + mp_digit *tmpc, mask, shift; - /* mask */ - mask = (((mp_digit)1) << D) - 1; + /* mask */ + mask = (((mp_digit)1) << D) - 1; - /* shift for lsb */ - shift = DIGIT_BIT - D; + /* shift for lsb */ + shift = DIGIT_BIT - D; - /* alias */ - tmpc = c->dp + (c->used - 1); + /* alias */ + tmpc = c->dp + (c->used - 1); - /* carry */ - r = 0; - for (x = c->used - 1; x >= 0; x--) { - /* get the lower bits of this word in a temp */ - rr = *tmpc & mask; + /* carry */ + r = 0; + for (x = c->used - 1; x >= 0; x--) { + /* get the lower bits of this word in a temp */ + rr = *tmpc & mask; - /* shift the current word and mix in the carry bits from the previous word */ - *tmpc = (*tmpc >> D) | (r << shift); - --tmpc; + /* shift the current word and mix in the carry bits from the previous word */ + *tmpc = (*tmpc >> D) | (r << shift); + --tmpc; - /* set the carry to the carry bits of the current word found above */ - r = rr; - } - } - mp_clamp (c); - return MP_OKAY; + /* set the carry to the carry bits of the current word found above */ + r = rr; + } + } + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index e8504ea..c3a023a 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -16,60 +16,59 @@ */ /* divide by three (based on routine from MPI and the GMP manual) */ -int -mp_div_3 (mp_int * a, mp_int *c, mp_digit * d) +int mp_div_3(mp_int *a, mp_int *c, mp_digit *d) { - mp_int q; - mp_word w, t; - mp_digit b; - int res, ix; - - /* b = 2**DIGIT_BIT / 3 */ - b = (((mp_word)1) << ((mp_word)DIGIT_BIT)) / ((mp_word)3); + mp_int q; + mp_word w, t; + mp_digit b; + int res, ix; - if ((res = mp_init_size(&q, a->used)) != MP_OKAY) { - return res; - } - - q.used = a->used; - q.sign = a->sign; - w = 0; - for (ix = a->used - 1; ix >= 0; ix--) { - w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); + /* b = 2**DIGIT_BIT / 3 */ + b = (((mp_word)1) << ((mp_word)DIGIT_BIT)) / ((mp_word)3); - if (w >= 3) { - /* multiply w by [1/3] */ - t = (w * ((mp_word)b)) >> ((mp_word)DIGIT_BIT); + if ((res = mp_init_size(&q, a->used)) != MP_OKAY) { + return res; + } - /* now subtract 3 * [w/3] from w, to get the remainder */ - w -= t+t+t; + q.used = a->used; + q.sign = a->sign; + w = 0; + for (ix = a->used - 1; ix >= 0; ix--) { + w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); - /* fixup the remainder as required since - * the optimization is not exact. - */ - while (w >= 3) { - t += 1; - w -= 3; - } + if (w >= 3) { + /* multiply w by [1/3] */ + t = (w * ((mp_word)b)) >> ((mp_word)DIGIT_BIT); + + /* now subtract 3 * [w/3] from w, to get the remainder */ + w -= t+t+t; + + /* fixup the remainder as required since + * the optimization is not exact. + */ + while (w >= 3) { + t += 1; + w -= 3; + } } else { - t = 0; + t = 0; } q.dp[ix] = (mp_digit)t; - } + } + + /* [optional] store the remainder */ + if (d != NULL) { + *d = (mp_digit)w; + } - /* [optional] store the remainder */ - if (d != NULL) { - *d = (mp_digit)w; - } + /* [optional] store the quotient */ + if (c != NULL) { + mp_clamp(&q); + mp_exch(&q, c); + } + mp_clear(&q); - /* [optional] store the quotient */ - if (c != NULL) { - mp_clamp(&q); - mp_exch(&q, c); - } - mp_clear(&q); - - return res; + return res; } #endif diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index a5dbc59..141db1d 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -34,78 +34,78 @@ static int s_is_power_of_two(mp_digit b, int *p) } /* single digit division (based on routine from MPI) */ -int mp_div_d (mp_int * a, mp_digit b, mp_int * c, mp_digit * d) +int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d) { - mp_int q; - mp_word w; - mp_digit t; - int res, ix; - - /* cannot divide by zero */ - if (b == 0) { - return MP_VAL; - } - - /* quick outs */ - if ((b == 1) || (mp_iszero(a) == MP_YES)) { - if (d != NULL) { - *d = 0; - } - if (c != NULL) { - return mp_copy(a, c); - } - return MP_OKAY; - } - - /* power of two ? */ - if (s_is_power_of_two(b, &ix) == 1) { - if (d != NULL) { - *d = a->dp[0] & ((((mp_digit)1)<dp[0] & ((((mp_digit)1)<used)) != MP_OKAY) { - return res; - } - - q.used = a->used; - q.sign = a->sign; - w = 0; - for (ix = a->used - 1; ix >= 0; ix--) { - w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); - - if (w >= b) { - t = (mp_digit)(w / b); - w -= ((mp_word)t) * ((mp_word)b); + /* no easy answer [c'est la vie]. Just division */ + if ((res = mp_init_size(&q, a->used)) != MP_OKAY) { + return res; + } + + q.used = a->used; + q.sign = a->sign; + w = 0; + for (ix = a->used - 1; ix >= 0; ix--) { + w = (w << ((mp_word)DIGIT_BIT)) | ((mp_word)a->dp[ix]); + + if (w >= b) { + t = (mp_digit)(w / b); + w -= ((mp_word)t) * ((mp_word)b); } else { - t = 0; + t = 0; } q.dp[ix] = (mp_digit)t; - } - - if (d != NULL) { - *d = (mp_digit)w; - } - - if (c != NULL) { - mp_clamp(&q); - mp_exch(&q, c); - } - mp_clear(&q); - - return res; + } + + if (d != NULL) { + *d = (mp_digit)w; + } + + if (c != NULL) { + mp_clamp(&q); + mp_exch(&q, c); + } + mp_clear(&q); + + return res; } #endif diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c index ced330c..4631daa 100644 --- a/libtommath/bn_mp_dr_is_modulus.c +++ b/libtommath/bn_mp_dr_is_modulus.c @@ -29,9 +29,9 @@ int mp_dr_is_modulus(mp_int *a) * but the first digit must be equal to -1 (mod b). */ for (ix = 1; ix < a->used; ix++) { - if (a->dp[ix] != MP_MASK) { - return 0; - } + if (a->dp[ix] != MP_MASK) { + return 0; + } } return 1; } diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c index c85ee77..25079be 100644 --- a/libtommath/bn_mp_dr_reduce.c +++ b/libtommath/bn_mp_dr_reduce.c @@ -29,65 +29,64 @@ * * Input x must be in the range 0 <= x <= (n-1)**2 */ -int -mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k) +int mp_dr_reduce(mp_int *x, mp_int *n, mp_digit k) { - int err, i, m; - mp_word r; - mp_digit mu, *tmpx1, *tmpx2; + int err, i, m; + mp_word r; + mp_digit mu, *tmpx1, *tmpx2; - /* m = digits in modulus */ - m = n->used; + /* m = digits in modulus */ + m = n->used; - /* ensure that "x" has at least 2m digits */ - if (x->alloc < (m + m)) { - if ((err = mp_grow (x, m + m)) != MP_OKAY) { - return err; - } - } + /* ensure that "x" has at least 2m digits */ + if (x->alloc < (m + m)) { + if ((err = mp_grow(x, m + m)) != MP_OKAY) { + return err; + } + } -/* top of loop, this is where the code resumes if - * another reduction pass is required. - */ + /* top of loop, this is where the code resumes if + * another reduction pass is required. + */ top: - /* aliases for digits */ - /* alias for lower half of x */ - tmpx1 = x->dp; + /* aliases for digits */ + /* alias for lower half of x */ + tmpx1 = x->dp; - /* alias for upper half of x, or x/B**m */ - tmpx2 = x->dp + m; + /* alias for upper half of x, or x/B**m */ + tmpx2 = x->dp + m; - /* set carry to zero */ - mu = 0; + /* set carry to zero */ + mu = 0; - /* compute (x mod B**m) + k * [x/B**m] inline and inplace */ - for (i = 0; i < m; i++) { + /* compute (x mod B**m) + k * [x/B**m] inline and inplace */ + for (i = 0; i < m; i++) { r = (((mp_word)*tmpx2++) * (mp_word)k) + *tmpx1 + mu; *tmpx1++ = (mp_digit)(r & MP_MASK); mu = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); - } + } - /* set final carry */ - *tmpx1++ = mu; + /* set final carry */ + *tmpx1++ = mu; - /* zero words above m */ - for (i = m + 1; i < x->used; i++) { + /* zero words above m */ + for (i = m + 1; i < x->used; i++) { *tmpx1++ = 0; - } + } - /* clamp, sub and return */ - mp_clamp (x); + /* clamp, sub and return */ + mp_clamp(x); - /* if x >= n then subtract and reduce again - * Each successive "recursion" makes the input smaller and smaller. - */ - if (mp_cmp_mag (x, n) != MP_LT) { - if ((err = s_mp_sub(x, n, x)) != MP_OKAY) { - return err; - } - goto top; - } - return MP_OKAY; + /* if x >= n then subtract and reduce again + * Each successive "recursion" makes the input smaller and smaller. + */ + if (mp_cmp_mag(x, n) != MP_LT) { + if ((err = s_mp_sub(x, n, x)) != MP_OKAY) { + return err; + } + goto top; + } + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c index b0d4a14..97f31ba 100644 --- a/libtommath/bn_mp_dr_setup.c +++ b/libtommath/bn_mp_dr_setup.c @@ -21,8 +21,7 @@ void mp_dr_setup(mp_int *a, mp_digit *d) /* the casts are required if DIGIT_BIT is one less than * the number of bits in a mp_digit [e.g. DIGIT_BIT==31] */ - *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - - ((mp_word)a->dp[0])); + *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - ((mp_word)a->dp[0])); } #endif diff --git a/libtommath/bn_mp_exch.c b/libtommath/bn_mp_exch.c index fc26bae..2bc635f 100644 --- a/libtommath/bn_mp_exch.c +++ b/libtommath/bn_mp_exch.c @@ -15,17 +15,16 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* swap the elements of two integers, for cases where you can't simply swap the +/* swap the elements of two integers, for cases where you can't simply swap the * mp_int pointers around */ -void -mp_exch (mp_int * a, mp_int * b) +void mp_exch(mp_int *a, mp_int *b) { - mp_int t; + mp_int t; - t = *a; - *a = *b; - *b = t; + t = *a; + *a = *b; + *b = t; } #endif diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index 4bbc8c5..b69a4fb 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -18,67 +18,66 @@ /* based on gmp's mpz_export. * see http://gmplib.org/manual/Integer-Import-and-Export.html */ -int mp_export(void* rop, size_t* countp, int order, size_t size, - int endian, size_t nails, mp_int* op) { - int result; - size_t odd_nails, nail_bytes, i, j, bits, count; - unsigned char odd_nail_mask; - - mp_int t; - - if ((result = mp_init_copy(&t, op)) != MP_OKAY) { - return result; - } - - if (endian == 0) { - union { - unsigned int i; - char c[4]; - } lint; - lint.i = 0x01020304; - - endian = (lint.c[0] == 4) ? -1 : 1; - } - - odd_nails = (nails % 8); - odd_nail_mask = 0xff; - for (i = 0; i < odd_nails; ++i) { - odd_nail_mask ^= (1 << (7 - i)); - } - nail_bytes = nails / 8; - - bits = mp_count_bits(&t); - count = (bits / ((size * 8) - nails)) + (((bits % ((size * 8) - nails)) != 0) ? 1 : 0); - - for (i = 0; i < count; ++i) { - for (j = 0; j < size; ++j) { - unsigned char* byte = ( - (unsigned char*)rop + - (((order == -1) ? i : ((count - 1) - i)) * size) + - ((endian == -1) ? j : ((size - 1) - j)) - ); - - if (j >= (size - nail_bytes)) { - *byte = 0; - continue; - } - - *byte = (unsigned char)((j == ((size - nail_bytes) - 1)) ? (t.dp[0] & odd_nail_mask) : (t.dp[0] & 0xFF)); - - if ((result = mp_div_2d(&t, ((j == ((size - nail_bytes) - 1)) ? (8 - odd_nails) : 8), &t, NULL)) != MP_OKAY) { - mp_clear(&t); - return result; - } - } - } - - mp_clear(&t); - - if (countp != NULL) { - *countp = count; - } - - return MP_OKAY; +int mp_export(void *rop, size_t *countp, int order, size_t size, + int endian, size_t nails, mp_int *op) +{ + int result; + size_t odd_nails, nail_bytes, i, j, bits, count; + unsigned char odd_nail_mask; + + mp_int t; + + if ((result = mp_init_copy(&t, op)) != MP_OKAY) { + return result; + } + + if (endian == 0) { + union { + unsigned int i; + char c[4]; + } lint; + lint.i = 0x01020304; + + endian = (lint.c[0] == 4) ? -1 : 1; + } + + odd_nails = (nails % 8); + odd_nail_mask = 0xff; + for (i = 0; i < odd_nails; ++i) { + odd_nail_mask ^= (1 << (7 - i)); + } + nail_bytes = nails / 8; + + bits = mp_count_bits(&t); + count = (bits / ((size * 8) - nails)) + (((bits % ((size * 8) - nails)) != 0) ? 1 : 0); + + for (i = 0; i < count; ++i) { + for (j = 0; j < size; ++j) { + unsigned char *byte = (unsigned char *)rop + + (((order == -1) ? i : ((count - 1) - i)) * size) + + ((endian == -1) ? j : ((size - 1) - j)); + + if (j >= (size - nail_bytes)) { + *byte = 0; + continue; + } + + *byte = (unsigned char)((j == ((size - nail_bytes) - 1)) ? (t.dp[0] & odd_nail_mask) : (t.dp[0] & 0xFF)); + + if ((result = mp_div_2d(&t, ((j == ((size - nail_bytes) - 1)) ? (8 - odd_nails) : 8), &t, NULL)) != MP_OKAY) { + mp_clear(&t); + return result; + } + } + } + + mp_clear(&t); + + if (countp != NULL) { + *countp = count; + } + + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index a311926..38bf679 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -16,9 +16,9 @@ */ /* wrapper function for mp_expt_d_ex() */ -int mp_expt_d (mp_int * a, mp_digit b, mp_int * c) +int mp_expt_d(mp_int *a, mp_digit b, mp_int *c) { - return mp_expt_d_ex(a, b, c, 0); + return mp_expt_d_ex(a, b, c, 0); } #endif diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index c361b27..bece77b 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -16,65 +16,64 @@ */ /* calculate c = a**b using a square-multiply algorithm */ -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast) +int mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast) { - int res; - unsigned int x; + int res; + unsigned int x; - mp_int g; + mp_int g; - if ((res = mp_init_copy (&g, a)) != MP_OKAY) { - return res; - } + if ((res = mp_init_copy(&g, a)) != MP_OKAY) { + return res; + } - /* set initial result */ - mp_set (c, 1); + /* set initial result */ + mp_set(c, 1); - if (fast != 0) { - while (b > 0) { - /* if the bit is set multiply */ - if ((b & 1) != 0) { - if ((res = mp_mul (c, &g, c)) != MP_OKAY) { - mp_clear (&g); - return res; - } - } + if (fast != 0) { + while (b > 0) { + /* if the bit is set multiply */ + if ((b & 1) != 0) { + if ((res = mp_mul(c, &g, c)) != MP_OKAY) { + mp_clear(&g); + return res; + } + } - /* square */ - if (b > 1) { - if ((res = mp_sqr (&g, &g)) != MP_OKAY) { - mp_clear (&g); - return res; - } - } + /* square */ + if (b > 1) { + if ((res = mp_sqr(&g, &g)) != MP_OKAY) { + mp_clear(&g); + return res; + } + } - /* shift to next bit */ - b >>= 1; - } - } - else { - for (x = 0; x < DIGIT_BIT; x++) { - /* square */ - if ((res = mp_sqr (c, c)) != MP_OKAY) { - mp_clear (&g); - return res; + /* shift to next bit */ + b >>= 1; } + } else { + for (x = 0; x < DIGIT_BIT; x++) { + /* square */ + if ((res = mp_sqr(c, c)) != MP_OKAY) { + mp_clear(&g); + return res; + } - /* if the bit is set multiply */ - if ((b & (mp_digit) (((mp_digit)1) << (DIGIT_BIT - 1))) != 0) { - if ((res = mp_mul (c, &g, c)) != MP_OKAY) { - mp_clear (&g); - return res; - } - } + /* if the bit is set multiply */ + if ((b & (mp_digit)(((mp_digit)1) << (DIGIT_BIT - 1))) != 0) { + if ((res = mp_mul(c, &g, c)) != MP_OKAY) { + mp_clear(&g); + return res; + } + } - /* shift to next bit */ - b <<= 1; - } - } /* if ... else */ + /* shift to next bit */ + b <<= 1; + } + } /* if ... else */ - mp_clear (&g); - return MP_OKAY; + mp_clear(&g); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c index 25c389d..c4f392b 100644 --- a/libtommath/bn_mp_exptmod.c +++ b/libtommath/bn_mp_exptmod.c @@ -21,87 +21,87 @@ * embedded in the normal function but that wasted alot of stack space * for nothing (since 99% of the time the Montgomery code would be called) */ -int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y) +int mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y) { - int dr; + int dr; - /* modulus P must be positive */ - if (P->sign == MP_NEG) { - return MP_VAL; - } + /* modulus P must be positive */ + if (P->sign == MP_NEG) { + return MP_VAL; + } - /* if exponent X is negative we have to recurse */ - if (X->sign == MP_NEG) { + /* if exponent X is negative we have to recurse */ + if (X->sign == MP_NEG) { #ifdef BN_MP_INVMOD_C - mp_int tmpG, tmpX; - int err; + mp_int tmpG, tmpX; + int err; - /* first compute 1/G mod P */ - if ((err = mp_init(&tmpG)) != MP_OKAY) { - return err; - } - if ((err = mp_invmod(G, P, &tmpG)) != MP_OKAY) { - mp_clear(&tmpG); - return err; - } + /* first compute 1/G mod P */ + if ((err = mp_init(&tmpG)) != MP_OKAY) { + return err; + } + if ((err = mp_invmod(G, P, &tmpG)) != MP_OKAY) { + mp_clear(&tmpG); + return err; + } - /* now get |X| */ - if ((err = mp_init(&tmpX)) != MP_OKAY) { - mp_clear(&tmpG); - return err; - } - if ((err = mp_abs(X, &tmpX)) != MP_OKAY) { - mp_clear_multi(&tmpG, &tmpX, NULL); - return err; - } + /* now get |X| */ + if ((err = mp_init(&tmpX)) != MP_OKAY) { + mp_clear(&tmpG); + return err; + } + if ((err = mp_abs(X, &tmpX)) != MP_OKAY) { + mp_clear_multi(&tmpG, &tmpX, NULL); + return err; + } - /* and now compute (1/G)**|X| instead of G**X [X < 0] */ - err = mp_exptmod(&tmpG, &tmpX, P, Y); - mp_clear_multi(&tmpG, &tmpX, NULL); - return err; -#else - /* no invmod */ - return MP_VAL; + /* and now compute (1/G)**|X| instead of G**X [X < 0] */ + err = mp_exptmod(&tmpG, &tmpX, P, Y); + mp_clear_multi(&tmpG, &tmpX, NULL); + return err; +#else + /* no invmod */ + return MP_VAL; #endif - } + } -/* modified diminished radix reduction */ + /* modified diminished radix reduction */ #if defined(BN_MP_REDUCE_IS_2K_L_C) && defined(BN_MP_REDUCE_2K_L_C) && defined(BN_S_MP_EXPTMOD_C) - if (mp_reduce_is_2k_l(P) == MP_YES) { - return s_mp_exptmod(G, X, P, Y, 1); - } + if (mp_reduce_is_2k_l(P) == MP_YES) { + return s_mp_exptmod(G, X, P, Y, 1); + } #endif #ifdef BN_MP_DR_IS_MODULUS_C - /* is it a DR modulus? */ - dr = mp_dr_is_modulus(P); + /* is it a DR modulus? */ + dr = mp_dr_is_modulus(P); #else - /* default to no */ - dr = 0; + /* default to no */ + dr = 0; #endif #ifdef BN_MP_REDUCE_IS_2K_C - /* if not, is it a unrestricted DR modulus? */ - if (dr == 0) { - dr = mp_reduce_is_2k(P) << 1; - } + /* if not, is it a unrestricted DR modulus? */ + if (dr == 0) { + dr = mp_reduce_is_2k(P) << 1; + } #endif - - /* if the modulus is odd or dr != 0 use the montgomery method */ + + /* if the modulus is odd or dr != 0 use the montgomery method */ #ifdef BN_MP_EXPTMOD_FAST_C - if ((mp_isodd (P) == MP_YES) || (dr != 0)) { - return mp_exptmod_fast (G, X, P, Y, dr); - } else { + if ((mp_isodd(P) == MP_YES) || (dr != 0)) { + return mp_exptmod_fast(G, X, P, Y, dr); + } else { #endif #ifdef BN_S_MP_EXPTMOD_C - /* otherwise use the generic Barrett reduction technique */ - return s_mp_exptmod (G, X, P, Y, 0); + /* otherwise use the generic Barrett reduction technique */ + return s_mp_exptmod(G, X, P, Y, 0); #else - /* no exptmod for evens */ - return MP_VAL; + /* no exptmod for evens */ + return MP_VAL; #endif #ifdef BN_MP_EXPTMOD_FAST_C - } + } #endif } diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 5e5c7f2..38e0265 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -24,294 +24,295 @@ */ #ifdef MP_LOW_MEM - #define TAB_SIZE 32 +# define TAB_SIZE 32 #else - #define TAB_SIZE 256 +# define TAB_SIZE 256 #endif -int mp_exptmod_fast (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode) +int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) { - mp_int M[TAB_SIZE], res; - mp_digit buf, mp; - int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; - - /* use a pointer to the reduction algorithm. This allows us to use - * one of many reduction algorithms without modding the guts of - * the code with if statements everywhere. - */ - int (*redux)(mp_int*,mp_int*,mp_digit); - - /* find window size */ - x = mp_count_bits (X); - if (x <= 7) { - winsize = 2; - } else if (x <= 36) { - winsize = 3; - } else if (x <= 140) { - winsize = 4; - } else if (x <= 450) { - winsize = 5; - } else if (x <= 1303) { - winsize = 6; - } else if (x <= 3529) { - winsize = 7; - } else { - winsize = 8; - } + mp_int M[TAB_SIZE], res; + mp_digit buf, mp; + int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; + + /* use a pointer to the reduction algorithm. This allows us to use + * one of many reduction algorithms without modding the guts of + * the code with if statements everywhere. + */ + int (*redux)(mp_int *,mp_int *,mp_digit); + + /* find window size */ + x = mp_count_bits(X); + if (x <= 7) { + winsize = 2; + } else if (x <= 36) { + winsize = 3; + } else if (x <= 140) { + winsize = 4; + } else if (x <= 450) { + winsize = 5; + } else if (x <= 1303) { + winsize = 6; + } else if (x <= 3529) { + winsize = 7; + } else { + winsize = 8; + } #ifdef MP_LOW_MEM - if (winsize > 5) { - winsize = 5; - } + if (winsize > 5) { + winsize = 5; + } #endif - /* init M array */ - /* init first cell */ - if ((err = mp_init_size(&M[1], P->alloc)) != MP_OKAY) { - return err; - } - - /* now init the second half of the array */ - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - if ((err = mp_init_size(&M[x], P->alloc)) != MP_OKAY) { - for (y = 1<<(winsize-1); y < x; y++) { - mp_clear (&M[y]); - } - mp_clear(&M[1]); + /* init M array */ + /* init first cell */ + if ((err = mp_init_size(&M[1], P->alloc)) != MP_OKAY) { return err; - } - } - - /* determine and setup reduction code */ - if (redmode == 0) { -#ifdef BN_MP_MONTGOMERY_SETUP_C - /* now setup montgomery */ - if ((err = mp_montgomery_setup (P, &mp)) != MP_OKAY) { - goto LBL_M; - } + } + + /* now init the second half of the array */ + for (x = 1<<(winsize-1); x < (1 << winsize); x++) { + if ((err = mp_init_size(&M[x], P->alloc)) != MP_OKAY) { + for (y = 1<<(winsize-1); y < x; y++) { + mp_clear(&M[y]); + } + mp_clear(&M[1]); + return err; + } + } + + /* determine and setup reduction code */ + if (redmode == 0) { +#ifdef BN_MP_MONTGOMERY_SETUP_C + /* now setup montgomery */ + if ((err = mp_montgomery_setup(P, &mp)) != MP_OKAY) { + goto LBL_M; + } #else - err = MP_VAL; - goto LBL_M; + err = MP_VAL; + goto LBL_M; #endif - /* automatically pick the comba one if available (saves quite a few calls/ifs) */ + /* automatically pick the comba one if available (saves quite a few calls/ifs) */ #ifdef BN_FAST_MP_MONTGOMERY_REDUCE_C - if ((((P->used * 2) + 1) < MP_WARRAY) && + if ((((P->used * 2) + 1) < MP_WARRAY) && (P->used < (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { - redux = fast_mp_montgomery_reduce; - } else + redux = fast_mp_montgomery_reduce; + } else #endif - { + { #ifdef BN_MP_MONTGOMERY_REDUCE_C - /* use slower baseline Montgomery method */ - redux = mp_montgomery_reduce; + /* use slower baseline Montgomery method */ + redux = mp_montgomery_reduce; #else - err = MP_VAL; - goto LBL_M; + err = MP_VAL; + goto LBL_M; #endif - } - } else if (redmode == 1) { + } + } else if (redmode == 1) { #if defined(BN_MP_DR_SETUP_C) && defined(BN_MP_DR_REDUCE_C) - /* setup DR reduction for moduli of the form B**k - b */ - mp_dr_setup(P, &mp); - redux = mp_dr_reduce; + /* setup DR reduction for moduli of the form B**k - b */ + mp_dr_setup(P, &mp); + redux = mp_dr_reduce; #else - err = MP_VAL; - goto LBL_M; + err = MP_VAL; + goto LBL_M; #endif - } else { + } else { #if defined(BN_MP_REDUCE_2K_SETUP_C) && defined(BN_MP_REDUCE_2K_C) - /* setup DR reduction for moduli of the form 2**k - b */ - if ((err = mp_reduce_2k_setup(P, &mp)) != MP_OKAY) { - goto LBL_M; - } - redux = mp_reduce_2k; + /* setup DR reduction for moduli of the form 2**k - b */ + if ((err = mp_reduce_2k_setup(P, &mp)) != MP_OKAY) { + goto LBL_M; + } + redux = mp_reduce_2k; #else - err = MP_VAL; - goto LBL_M; + err = MP_VAL; + goto LBL_M; #endif - } + } - /* setup result */ - if ((err = mp_init_size (&res, P->alloc)) != MP_OKAY) { - goto LBL_M; - } + /* setup result */ + if ((err = mp_init_size(&res, P->alloc)) != MP_OKAY) { + goto LBL_M; + } - /* create M table - * + /* create M table + * - * - * The first half of the table is not computed though accept for M[0] and M[1] - */ + * + * The first half of the table is not computed though accept for M[0] and M[1] + */ - if (redmode == 0) { + if (redmode == 0) { #ifdef BN_MP_MONTGOMERY_CALC_NORMALIZATION_C - /* now we need R mod m */ - if ((err = mp_montgomery_calc_normalization (&res, P)) != MP_OKAY) { - goto LBL_RES; - } - - /* now set M[1] to G * R mod m */ - if ((err = mp_mulmod (G, &res, P, &M[1])) != MP_OKAY) { - goto LBL_RES; - } + /* now we need R mod m */ + if ((err = mp_montgomery_calc_normalization(&res, P)) != MP_OKAY) { + goto LBL_RES; + } + + /* now set M[1] to G * R mod m */ + if ((err = mp_mulmod(G, &res, P, &M[1])) != MP_OKAY) { + goto LBL_RES; + } #else - err = MP_VAL; - goto LBL_RES; -#endif - } else { - mp_set(&res, 1); - if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) { - goto LBL_RES; - } - } - - /* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */ - if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_RES; - } - - for (x = 0; x < (winsize - 1); x++) { - if ((err = mp_sqr (&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) { + err = MP_VAL; goto LBL_RES; - } - } +#endif + } else { + mp_set(&res, 1); + if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) { + goto LBL_RES; + } + } - /* create upper table */ - for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { - if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&M[x], P, mp)) != MP_OKAY) { + /* compute the value at M[1<<(winsize-1)] by squaring M[1] (winsize-1) times */ + if ((err = mp_copy(&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { goto LBL_RES; - } - } - - /* set initial mode and bit cnt */ - mode = 0; - bitcnt = 1; - buf = 0; - digidx = X->used - 1; - bitcpy = 0; - bitbuf = 0; - - for (;;) { - /* grab next digit as required */ - if (--bitcnt == 0) { - /* if digidx == -1 we are out of digits so break */ - if (digidx == -1) { - break; + } + + for (x = 0; x < (winsize - 1); x++) { + if ((err = mp_sqr(&M[1 << (winsize - 1)], &M[1 << (winsize - 1)])) != MP_OKAY) { + goto LBL_RES; } - /* read next digit and reset bitcnt */ - buf = X->dp[digidx--]; - bitcnt = (int)DIGIT_BIT; - } - - /* grab the next msb from the exponent */ - y = (mp_digit)(buf >> (DIGIT_BIT - 1)) & 1; - buf <<= (mp_digit)1; - - /* if the bit is zero and mode == 0 then we ignore it - * These represent the leading zero bits before the first 1 bit - * in the exponent. Technically this opt is not required but it - * does lower the # of trivial squaring/reductions used - */ - if ((mode == 0) && (y == 0)) { - continue; - } - - /* if the bit is zero and mode == 1 then we square */ - if ((mode == 1) && (y == 0)) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; + if ((err = redux(&M[1 << (winsize - 1)], P, mp)) != MP_OKAY) { + goto LBL_RES; } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; + } + + /* create upper table */ + for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { + if ((err = mp_mul(&M[x - 1], &M[1], &M[x])) != MP_OKAY) { + goto LBL_RES; } - continue; - } - - /* else we add it to the window */ - bitbuf |= (y << (winsize - ++bitcpy)); - mode = 2; - - if (bitcpy == winsize) { - /* ok window is filled so square as required and multiply */ - /* square first */ - for (x = 0; x < winsize; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } + if ((err = redux(&M[x], P, mp)) != MP_OKAY) { + goto LBL_RES; + } + } + + /* set initial mode and bit cnt */ + mode = 0; + bitcnt = 1; + buf = 0; + digidx = X->used - 1; + bitcpy = 0; + bitbuf = 0; + + for (;;) { + /* grab next digit as required */ + if (--bitcnt == 0) { + /* if digidx == -1 we are out of digits so break */ + if (digidx == -1) { + break; + } + /* read next digit and reset bitcnt */ + buf = X->dp[digidx--]; + bitcnt = (int)DIGIT_BIT; } - /* then multiply */ - if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) { - goto LBL_RES; + /* grab the next msb from the exponent */ + y = (mp_digit)(buf >> (DIGIT_BIT - 1)) & 1; + buf <<= (mp_digit)1; + + /* if the bit is zero and mode == 0 then we ignore it + * These represent the leading zero bits before the first 1 bit + * in the exponent. Technically this opt is not required but it + * does lower the # of trivial squaring/reductions used + */ + if ((mode == 0) && (y == 0)) { + continue; } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; + + /* if the bit is zero and mode == 1 then we square */ + if ((mode == 1) && (y == 0)) { + if ((err = mp_sqr(&res, &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, mp)) != MP_OKAY) { + goto LBL_RES; + } + continue; } - /* empty window and reset */ - bitcpy = 0; - bitbuf = 0; - mode = 1; - } - } - - /* if bits remain then square/multiply */ - if ((mode == 2) && (bitcpy > 0)) { - /* square then multiply if the bit is set */ - for (x = 0; x < bitcpy; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; + /* else we add it to the window */ + bitbuf |= (y << (winsize - ++bitcpy)); + mode = 2; + + if (bitcpy == winsize) { + /* ok window is filled so square as required and multiply */ + /* square first */ + for (x = 0; x < winsize; x++) { + if ((err = mp_sqr(&res, &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, mp)) != MP_OKAY) { + goto LBL_RES; + } + } + + /* then multiply */ + if ((err = mp_mul(&res, &M[bitbuf], &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, mp)) != MP_OKAY) { + goto LBL_RES; + } + + /* empty window and reset */ + bitcpy = 0; + bitbuf = 0; + mode = 1; } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; + } + + /* if bits remain then square/multiply */ + if ((mode == 2) && (bitcpy > 0)) { + /* square then multiply if the bit is set */ + for (x = 0; x < bitcpy; x++) { + if ((err = mp_sqr(&res, &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, mp)) != MP_OKAY) { + goto LBL_RES; + } + + /* get next bit of the window */ + bitbuf <<= 1; + if ((bitbuf & (1 << winsize)) != 0) { + /* then multiply */ + if ((err = mp_mul(&res, &M[1], &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, mp)) != MP_OKAY) { + goto LBL_RES; + } + } } - - /* get next bit of the window */ - bitbuf <<= 1; - if ((bitbuf & (1 << winsize)) != 0) { - /* then multiply */ - if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } + } + + if (redmode == 0) { + /* fixup result if Montgomery reduction is used + * recall that any value in a Montgomery system is + * actually multiplied by R mod n. So we have + * to reduce one more time to cancel out the factor + * of R. + */ + if ((err = redux(&res, P, mp)) != MP_OKAY) { + goto LBL_RES; } - } - } - - if (redmode == 0) { - /* fixup result if Montgomery reduction is used - * recall that any value in a Montgomery system is - * actually multiplied by R mod n. So we have - * to reduce one more time to cancel out the factor - * of R. - */ - if ((err = redux(&res, P, mp)) != MP_OKAY) { - goto LBL_RES; - } - } - - /* swap res with Y */ - mp_exch (&res, Y); - err = MP_OKAY; -LBL_RES:mp_clear (&res); + } + + /* swap res with Y */ + mp_exch(&res, Y); + err = MP_OKAY; +LBL_RES: + mp_clear(&res); LBL_M: - mp_clear(&M[1]); - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - mp_clear (&M[x]); - } - return err; + mp_clear(&M[1]); + for (x = 1<<(winsize-1); x < (1 << winsize); x++) { + mp_clear(&M[x]); + } + return err; } #endif diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index 3c9612e..98eef76 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -20,7 +20,7 @@ */ int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) { - mp_int u1,u2,u3,v1,v2,v3,t1,t2,t3,q,tmp; + mp_int u1, u2, u3, v1, v2, v3, t1, t2, t3, q, tmp; int err; if ((err = mp_init_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL)) != MP_OKAY) { @@ -29,47 +29,89 @@ int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) /* initialize, (u1,u2,u3) = (1,0,a) */ mp_set(&u1, 1); - if ((err = mp_copy(a, &u3)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_copy(a, &u3)) != MP_OKAY) { + goto LBL_ERR; + } /* initialize, (v1,v2,v3) = (0,1,b) */ mp_set(&v2, 1); - if ((err = mp_copy(b, &v3)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_copy(b, &v3)) != MP_OKAY) { + goto LBL_ERR; + } /* loop while v3 != 0 */ while (mp_iszero(&v3) == MP_NO) { - /* q = u3/v3 */ - if ((err = mp_div(&u3, &v3, &q, NULL)) != MP_OKAY) { goto LBL_ERR; } + /* q = u3/v3 */ + if ((err = mp_div(&u3, &v3, &q, NULL)) != MP_OKAY) { + goto LBL_ERR; + } - /* (t1,t2,t3) = (u1,u2,u3) - (v1,v2,v3)q */ - if ((err = mp_mul(&v1, &q, &tmp)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_sub(&u1, &tmp, &t1)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_mul(&v2, &q, &tmp)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_sub(&u2, &tmp, &t2)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_mul(&v3, &q, &tmp)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_sub(&u3, &tmp, &t3)) != MP_OKAY) { goto LBL_ERR; } + /* (t1,t2,t3) = (u1,u2,u3) - (v1,v2,v3)q */ + if ((err = mp_mul(&v1, &q, &tmp)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_sub(&u1, &tmp, &t1)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_mul(&v2, &q, &tmp)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_sub(&u2, &tmp, &t2)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_mul(&v3, &q, &tmp)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_sub(&u3, &tmp, &t3)) != MP_OKAY) { + goto LBL_ERR; + } - /* (u1,u2,u3) = (v1,v2,v3) */ - if ((err = mp_copy(&v1, &u1)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_copy(&v2, &u2)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_copy(&v3, &u3)) != MP_OKAY) { goto LBL_ERR; } + /* (u1,u2,u3) = (v1,v2,v3) */ + if ((err = mp_copy(&v1, &u1)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_copy(&v2, &u2)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_copy(&v3, &u3)) != MP_OKAY) { + goto LBL_ERR; + } - /* (v1,v2,v3) = (t1,t2,t3) */ - if ((err = mp_copy(&t1, &v1)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_copy(&t2, &v2)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_copy(&t3, &v3)) != MP_OKAY) { goto LBL_ERR; } + /* (v1,v2,v3) = (t1,t2,t3) */ + if ((err = mp_copy(&t1, &v1)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_copy(&t2, &v2)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_copy(&t3, &v3)) != MP_OKAY) { + goto LBL_ERR; + } } /* make sure U3 >= 0 */ if (u3.sign == MP_NEG) { - if ((err = mp_neg(&u1, &u1)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_neg(&u2, &u2)) != MP_OKAY) { goto LBL_ERR; } - if ((err = mp_neg(&u3, &u3)) != MP_OKAY) { goto LBL_ERR; } + if ((err = mp_neg(&u1, &u1)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_neg(&u2, &u2)) != MP_OKAY) { + goto LBL_ERR; + } + if ((err = mp_neg(&u3, &u3)) != MP_OKAY) { + goto LBL_ERR; + } } /* copy result out */ - if (U1 != NULL) { mp_exch(U1, &u1); } - if (U2 != NULL) { mp_exch(U2, &u2); } - if (U3 != NULL) { mp_exch(U3, &u3); } + if (U1 != NULL) { + mp_exch(U1, &u1); + } + if (U2 != NULL) { + mp_exch(U2, &u2); + } + if (U3 != NULL) { + mp_exch(U3, &u3); + } err = MP_OKAY; LBL_ERR: diff --git a/libtommath/bn_mp_fread.c b/libtommath/bn_mp_fread.c index 140721b..d0de595 100644 --- a/libtommath/bn_mp_fread.c +++ b/libtommath/bn_mp_fread.c @@ -20,10 +20,10 @@ int mp_fread(mp_int *a, int radix, FILE *stream) { int err, ch, neg, y; - + /* clear a */ mp_zero(a); - + /* if first digit is - then set negative */ ch = fgetc(stream); if (ch == '-') { @@ -32,18 +32,18 @@ int mp_fread(mp_int *a, int radix, FILE *stream) } else { neg = MP_ZPOS; } - + for (;;) { /* find y in the radix map */ for (y = 0; y < radix; y++) { - if (mp_s_rmap[y] == ch) { - break; - } + if (mp_s_rmap[y] == ch) { + break; + } } if (y == radix) { break; } - + /* shift up and add */ if ((err = mp_mul_d(a, radix, a)) != MP_OKAY) { return err; @@ -51,13 +51,13 @@ int mp_fread(mp_int *a, int radix, FILE *stream) if ((err = mp_add_d(a, y, a)) != MP_OKAY) { return err; } - + ch = fgetc(stream); } if (mp_cmp_d(a, 0) != MP_EQ) { a->sign = neg; } - + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c index 23b5f64..3641823 100644 --- a/libtommath/bn_mp_fwrite.c +++ b/libtommath/bn_mp_fwrite.c @@ -20,29 +20,29 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream) { char *buf; int err, len, x; - + if ((err = mp_radix_size(a, radix, &len)) != MP_OKAY) { return err; } - buf = OPT_CAST(char) XMALLOC (len); + buf = OPT_CAST(char) XMALLOC(len); if (buf == NULL) { return MP_MEM; } - + if ((err = mp_toradix(a, buf, radix)) != MP_OKAY) { - XFREE (buf); + XFREE(buf); return err; } - + for (x = 0; x < len; x++) { - if (fputc(buf[x], stream) == EOF) { - XFREE (buf); - return MP_VAL; - } + if (fputc(buf[x], stream) == EOF) { + XFREE(buf); + return MP_VAL; + } } - - XFREE (buf); + + XFREE(buf); return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index b0be8fb..18f6dc3 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -16,87 +16,89 @@ */ /* Greatest Common Divisor using the binary method */ -int mp_gcd (mp_int * a, mp_int * b, mp_int * c) +int mp_gcd(mp_int *a, mp_int *b, mp_int *c) { - mp_int u, v; - int k, u_lsb, v_lsb, res; + mp_int u, v; + int k, u_lsb, v_lsb, res; - /* either zero than gcd is the largest */ - if (mp_iszero (a) == MP_YES) { - return mp_abs (b, c); - } - if (mp_iszero (b) == MP_YES) { - return mp_abs (a, c); - } + /* either zero than gcd is the largest */ + if (mp_iszero(a) == MP_YES) { + return mp_abs(b, c); + } + if (mp_iszero(b) == MP_YES) { + return mp_abs(a, c); + } - /* get copies of a and b we can modify */ - if ((res = mp_init_copy (&u, a)) != MP_OKAY) { - return res; - } + /* get copies of a and b we can modify */ + if ((res = mp_init_copy(&u, a)) != MP_OKAY) { + return res; + } - if ((res = mp_init_copy (&v, b)) != MP_OKAY) { - goto LBL_U; - } + if ((res = mp_init_copy(&v, b)) != MP_OKAY) { + goto LBL_U; + } - /* must be positive for the remainder of the algorithm */ - u.sign = v.sign = MP_ZPOS; + /* must be positive for the remainder of the algorithm */ + u.sign = v.sign = MP_ZPOS; - /* B1. Find the common power of two for u and v */ - u_lsb = mp_cnt_lsb(&u); - v_lsb = mp_cnt_lsb(&v); - k = MIN(u_lsb, v_lsb); + /* B1. Find the common power of two for u and v */ + u_lsb = mp_cnt_lsb(&u); + v_lsb = mp_cnt_lsb(&v); + k = MIN(u_lsb, v_lsb); - if (k > 0) { - /* divide the power of two out */ - if ((res = mp_div_2d(&u, k, &u, NULL)) != MP_OKAY) { - goto LBL_V; - } + if (k > 0) { + /* divide the power of two out */ + if ((res = mp_div_2d(&u, k, &u, NULL)) != MP_OKAY) { + goto LBL_V; + } - if ((res = mp_div_2d(&v, k, &v, NULL)) != MP_OKAY) { - goto LBL_V; - } - } + if ((res = mp_div_2d(&v, k, &v, NULL)) != MP_OKAY) { + goto LBL_V; + } + } - /* divide any remaining factors of two out */ - if (u_lsb != k) { - if ((res = mp_div_2d(&u, u_lsb - k, &u, NULL)) != MP_OKAY) { - goto LBL_V; - } - } + /* divide any remaining factors of two out */ + if (u_lsb != k) { + if ((res = mp_div_2d(&u, u_lsb - k, &u, NULL)) != MP_OKAY) { + goto LBL_V; + } + } - if (v_lsb != k) { - if ((res = mp_div_2d(&v, v_lsb - k, &v, NULL)) != MP_OKAY) { - goto LBL_V; - } - } + if (v_lsb != k) { + if ((res = mp_div_2d(&v, v_lsb - k, &v, NULL)) != MP_OKAY) { + goto LBL_V; + } + } - while (mp_iszero(&v) == MP_NO) { - /* make sure v is the largest */ - if (mp_cmp_mag(&u, &v) == MP_GT) { - /* swap u and v to make sure v is >= u */ - mp_exch(&u, &v); - } - - /* subtract smallest from largest */ - if ((res = s_mp_sub(&v, &u, &v)) != MP_OKAY) { - goto LBL_V; - } - - /* Divide out all factors of two */ - if ((res = mp_div_2d(&v, mp_cnt_lsb(&v), &v, NULL)) != MP_OKAY) { - goto LBL_V; - } - } + while (mp_iszero(&v) == MP_NO) { + /* make sure v is the largest */ + if (mp_cmp_mag(&u, &v) == MP_GT) { + /* swap u and v to make sure v is >= u */ + mp_exch(&u, &v); + } - /* multiply by 2**k which we divided out at the beginning */ - if ((res = mp_mul_2d (&u, k, c)) != MP_OKAY) { - goto LBL_V; - } - c->sign = MP_ZPOS; - res = MP_OKAY; -LBL_V:mp_clear (&u); -LBL_U:mp_clear (&v); - return res; + /* subtract smallest from largest */ + if ((res = s_mp_sub(&v, &u, &v)) != MP_OKAY) { + goto LBL_V; + } + + /* Divide out all factors of two */ + if ((res = mp_div_2d(&v, mp_cnt_lsb(&v), &v, NULL)) != MP_OKAY) { + goto LBL_V; + } + } + + /* multiply by 2**k which we divided out at the beginning */ + if ((res = mp_mul_2d(&u, k, c)) != MP_OKAY) { + goto LBL_V; + } + c->sign = MP_ZPOS; + res = MP_OKAY; +LBL_V: + mp_clear(&u); +LBL_U: + mp_clear(&v); + return res; } #endif diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index 5c820f8..a3d1602 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -16,27 +16,27 @@ */ /* get the lower 32-bits of an mp_int */ -unsigned long mp_get_int(mp_int * a) +unsigned long mp_get_int(mp_int *a) { - int i; - mp_min_u32 res; + int i; + mp_min_u32 res; - if (a->used == 0) { - return 0; - } + if (a->used == 0) { + return 0; + } - /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + /* get number of digits of the lsb we have to read */ + i = MIN(a->used, (int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; - /* get most significant digit of result */ - res = DIGIT(a,i); + /* get most significant digit of result */ + res = DIGIT(a, i); - while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); - } + while (--i >= 0) { + res = (res << DIGIT_BIT) | DIGIT(a, i); + } - /* force result to 32-bits always so it is consistent on non 32-bit platforms */ - return res & 0xFFFFFFFFUL; + /* force result to 32-bits always so it is consistent on non 32-bit platforms */ + return res & 0xFFFFFFFFUL; } #endif diff --git a/libtommath/bn_mp_get_long.c b/libtommath/bn_mp_get_long.c index 7c3d0fe..053930c 100644 --- a/libtommath/bn_mp_get_long.c +++ b/libtommath/bn_mp_get_long.c @@ -16,26 +16,26 @@ */ /* get the lower unsigned long of an mp_int, platform dependent */ -unsigned long mp_get_long(mp_int * a) +unsigned long mp_get_long(mp_int *a) { - int i; - unsigned long res; + int i; + unsigned long res; - if (a->used == 0) { - return 0; - } + if (a->used == 0) { + return 0; + } - /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + /* get number of digits of the lsb we have to read */ + i = MIN(a->used, (int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; - /* get most significant digit of result */ - res = DIGIT(a,i); + /* get most significant digit of result */ + res = DIGIT(a, i); #if (ULONG_MAX != 0xffffffffuL) || (DIGIT_BIT < 32) - while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); - } + while (--i >= 0) { + res = (res << DIGIT_BIT) | DIGIT(a, i); + } #endif - return res; + return res; } #endif diff --git a/libtommath/bn_mp_get_long_long.c b/libtommath/bn_mp_get_long_long.c index 4b959e6..131571a 100644 --- a/libtommath/bn_mp_get_long_long.c +++ b/libtommath/bn_mp_get_long_long.c @@ -16,26 +16,26 @@ */ /* get the lower unsigned long long of an mp_int, platform dependent */ -unsigned long long mp_get_long_long (mp_int * a) +unsigned long long mp_get_long_long(mp_int *a) { - int i; - unsigned long long res; + int i; + unsigned long long res; - if (a->used == 0) { - return 0; - } + if (a->used == 0) { + return 0; + } - /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + /* get number of digits of the lsb we have to read */ + i = MIN(a->used, (int)(((sizeof(unsigned long long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; - /* get most significant digit of result */ - res = DIGIT(a,i); + /* get most significant digit of result */ + res = DIGIT(a, i); #if DIGIT_BIT < 64 - while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); - } + while (--i >= 0) { + res = (res << DIGIT_BIT) | DIGIT(a, i); + } #endif - return res; + return res; } #endif diff --git a/libtommath/bn_mp_grow.c b/libtommath/bn_mp_grow.c index 74e07b1..0030931 100644 --- a/libtommath/bn_mp_grow.c +++ b/libtommath/bn_mp_grow.c @@ -16,39 +16,39 @@ */ /* grow as required */ -int mp_grow (mp_int * a, int size) +int mp_grow(mp_int *a, int size) { - int i; - mp_digit *tmp; + int i; + mp_digit *tmp; - /* if the alloc size is smaller alloc more ram */ - if (a->alloc < size) { - /* ensure there are always at least MP_PREC digits extra on top */ - size += (MP_PREC * 2) - (size % MP_PREC); + /* if the alloc size is smaller alloc more ram */ + if (a->alloc < size) { + /* ensure there are always at least MP_PREC digits extra on top */ + size += (MP_PREC * 2) - (size % MP_PREC); - /* reallocate the array a->dp - * - * We store the return in a temporary variable - * in case the operation failed we don't want - * to overwrite the dp member of a. - */ - tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * size); - if (tmp == NULL) { - /* reallocation failed but "a" is still valid [can be freed] */ - return MP_MEM; - } + /* reallocate the array a->dp + * + * We store the return in a temporary variable + * in case the operation failed we don't want + * to overwrite the dp member of a. + */ + tmp = OPT_CAST(mp_digit) XREALLOC(a->dp, sizeof(mp_digit) * size); + if (tmp == NULL) { + /* reallocation failed but "a" is still valid [can be freed] */ + return MP_MEM; + } - /* reallocation succeeded so set a->dp */ - a->dp = tmp; + /* reallocation succeeded so set a->dp */ + a->dp = tmp; - /* zero excess digits */ - i = a->alloc; - a->alloc = size; - for (; i < a->alloc; i++) { - a->dp[i] = 0; - } - } - return MP_OKAY; + /* zero excess digits */ + i = a->alloc; + a->alloc = size; + for (; i < a->alloc; i++) { + a->dp[i] = 0; + } + } + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_import.c b/libtommath/bn_mp_import.c index df29389..afd735e 100644 --- a/libtommath/bn_mp_import.c +++ b/libtommath/bn_mp_import.c @@ -18,52 +18,50 @@ /* based on gmp's mpz_import. * see http://gmplib.org/manual/Integer-Import-and-Export.html */ -int mp_import(mp_int* rop, size_t count, int order, size_t size, - int endian, size_t nails, const void* op) { - int result; - size_t odd_nails, nail_bytes, i, j; - unsigned char odd_nail_mask; +int mp_import(mp_int *rop, size_t count, int order, size_t size, + int endian, size_t nails, const void *op) +{ + int result; + size_t odd_nails, nail_bytes, i, j; + unsigned char odd_nail_mask; - mp_zero(rop); + mp_zero(rop); - if (endian == 0) { - union { - unsigned int i; - char c[4]; - } lint; - lint.i = 0x01020304; + if (endian == 0) { + union { + unsigned int i; + char c[4]; + } lint; + lint.i = 0x01020304; - endian = (lint.c[0] == 4) ? -1 : 1; - } + endian = (lint.c[0] == 4) ? -1 : 1; + } - odd_nails = (nails % 8); - odd_nail_mask = 0xff; - for (i = 0; i < odd_nails; ++i) { - odd_nail_mask ^= (1 << (7 - i)); - } - nail_bytes = nails / 8; + odd_nails = (nails % 8); + odd_nail_mask = 0xff; + for (i = 0; i < odd_nails; ++i) { + odd_nail_mask ^= (1 << (7 - i)); + } + nail_bytes = nails / 8; - for (i = 0; i < count; ++i) { - for (j = 0; j < (size - nail_bytes); ++j) { - unsigned char byte = *( - (unsigned char*)op + - (((order == 1) ? i : ((count - 1) - i)) * size) + - ((endian == 1) ? (j + nail_bytes) : (((size - 1) - j) - nail_bytes)) - ); + for (i = 0; i < count; ++i) { + for (j = 0; j < (size - nail_bytes); ++j) { + unsigned char byte = *((unsigned char *)op + + (((order == 1) ? i : ((count - 1) - i)) * size) + + ((endian == 1) ? (j + nail_bytes) : (((size - 1) - j) - nail_bytes))); - if ( - (result = mp_mul_2d(rop, ((j == 0) ? (8 - odd_nails) : 8), rop)) != MP_OKAY) { - return result; - } + if ((result = mp_mul_2d(rop, ((j == 0) ? (8 - odd_nails) : 8), rop)) != MP_OKAY) { + return result; + } - rop->dp[0] |= (j == 0) ? (byte & odd_nail_mask) : byte; - rop->used += 1; - } - } + rop->dp[0] |= (j == 0) ? (byte & odd_nail_mask) : byte; + rop->used += 1; + } + } - mp_clamp(rop); + mp_clamp(rop); - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_init.c b/libtommath/bn_mp_init.c index ee374ae..0556aeb 100644 --- a/libtommath/bn_mp_init.c +++ b/libtommath/bn_mp_init.c @@ -16,28 +16,28 @@ */ /* init a new mp_int */ -int mp_init (mp_int * a) +int mp_init(mp_int *a) { - int i; + int i; - /* allocate memory required and clear it */ - a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * MP_PREC); - if (a->dp == NULL) { - return MP_MEM; - } + /* allocate memory required and clear it */ + a->dp = OPT_CAST(mp_digit) XMALLOC(sizeof(mp_digit) * MP_PREC); + if (a->dp == NULL) { + return MP_MEM; + } - /* set the digits to zero */ - for (i = 0; i < MP_PREC; i++) { + /* set the digits to zero */ + for (i = 0; i < MP_PREC; i++) { a->dp[i] = 0; - } + } - /* set the used to zero, allocated digits to the default precision - * and sign to positive */ - a->used = 0; - a->alloc = MP_PREC; - a->sign = MP_ZPOS; + /* set the used to zero, allocated digits to the default precision + * and sign to positive */ + a->used = 0; + a->alloc = MP_PREC; + a->sign = MP_ZPOS; - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_init_copy.c b/libtommath/bn_mp_init_copy.c index 37a57ec..c711e06 100644 --- a/libtommath/bn_mp_init_copy.c +++ b/libtommath/bn_mp_init_copy.c @@ -16,19 +16,19 @@ */ /* creates "a" then copies b into it */ -int mp_init_copy (mp_int * a, mp_int * b) +int mp_init_copy(mp_int *a, mp_int *b) { - int res; + int res; - if ((res = mp_init_size (a, b->used)) != MP_OKAY) { - return res; - } + if ((res = mp_init_size(a, b->used)) != MP_OKAY) { + return res; + } - if((res = mp_copy (b, a)) != MP_OKAY) { - mp_clear(a); - } + if ((res = mp_copy(b, a)) != MP_OKAY) { + mp_clear(a); + } - return res; + return res; } #endif diff --git a/libtommath/bn_mp_init_multi.c b/libtommath/bn_mp_init_multi.c index 73d6a0f..0da7803 100644 --- a/libtommath/bn_mp_init_multi.c +++ b/libtommath/bn_mp_init_multi.c @@ -16,37 +16,37 @@ */ #include -int mp_init_multi(mp_int *mp, ...) +int mp_init_multi(mp_int *mp, ...) { - mp_err res = MP_OKAY; /* Assume ok until proven otherwise */ - int n = 0; /* Number of ok inits */ - mp_int* cur_arg = mp; - va_list args; + mp_err res = MP_OKAY; /* Assume ok until proven otherwise */ + int n = 0; /* Number of ok inits */ + mp_int *cur_arg = mp; + va_list args; - va_start(args, mp); /* init args to next argument from caller */ - while (cur_arg != NULL) { - if (mp_init(cur_arg) != MP_OKAY) { - /* Oops - error! Back-track and mp_clear what we already - succeeded in init-ing, then return error. - */ - va_list clean_args; - - /* now start cleaning up */ - cur_arg = mp; - va_start(clean_args, mp); - while (n-- != 0) { - mp_clear(cur_arg); - cur_arg = va_arg(clean_args, mp_int*); - } - va_end(clean_args); - res = MP_MEM; - break; - } - n++; - cur_arg = va_arg(args, mp_int*); - } - va_end(args); - return res; /* Assumed ok, if error flagged above. */ + va_start(args, mp); /* init args to next argument from caller */ + while (cur_arg != NULL) { + if (mp_init(cur_arg) != MP_OKAY) { + /* Oops - error! Back-track and mp_clear what we already + succeeded in init-ing, then return error. + */ + va_list clean_args; + + /* now start cleaning up */ + cur_arg = mp; + va_start(clean_args, mp); + while (n-- != 0) { + mp_clear(cur_arg); + cur_arg = va_arg(clean_args, mp_int *); + } + va_end(clean_args); + res = MP_MEM; + break; + } + n++; + cur_arg = va_arg(args, mp_int *); + } + va_end(args); + return res; /* Assumed ok, if error flagged above. */ } #endif diff --git a/libtommath/bn_mp_init_set.c b/libtommath/bn_mp_init_set.c index ed4955c..e9c1b12 100644 --- a/libtommath/bn_mp_init_set.c +++ b/libtommath/bn_mp_init_set.c @@ -16,14 +16,14 @@ */ /* initialize and set a digit */ -int mp_init_set (mp_int * a, mp_digit b) +int mp_init_set(mp_int *a, mp_digit b) { - int err; - if ((err = mp_init(a)) != MP_OKAY) { - return err; - } - mp_set(a, b); - return err; + int err; + if ((err = mp_init(a)) != MP_OKAY) { + return err; + } + mp_set(a, b); + return err; } #endif diff --git a/libtommath/bn_mp_init_set_int.c b/libtommath/bn_mp_init_set_int.c index 1bc1942..8e7441a 100644 --- a/libtommath/bn_mp_init_set_int.c +++ b/libtommath/bn_mp_init_set_int.c @@ -16,13 +16,13 @@ */ /* initialize and set a digit */ -int mp_init_set_int (mp_int * a, unsigned long b) +int mp_init_set_int(mp_int *a, unsigned long b) { - int err; - if ((err = mp_init(a)) != MP_OKAY) { - return err; - } - return mp_set_int(a, b); + int err; + if ((err = mp_init(a)) != MP_OKAY) { + return err; + } + return mp_set_int(a, b); } #endif diff --git a/libtommath/bn_mp_init_size.c b/libtommath/bn_mp_init_size.c index 4446773..623a03f 100644 --- a/libtommath/bn_mp_init_size.c +++ b/libtommath/bn_mp_init_size.c @@ -16,30 +16,30 @@ */ /* init an mp_init for a given size */ -int mp_init_size (mp_int * a, int size) +int mp_init_size(mp_int *a, int size) { - int x; + int x; - /* pad size so there are always extra digits */ - size += (MP_PREC * 2) - (size % MP_PREC); - - /* alloc mem */ - a->dp = OPT_CAST(mp_digit) XMALLOC (sizeof (mp_digit) * size); - if (a->dp == NULL) { - return MP_MEM; - } + /* pad size so there are always extra digits */ + size += (MP_PREC * 2) - (size % MP_PREC); - /* set the members */ - a->used = 0; - a->alloc = size; - a->sign = MP_ZPOS; + /* alloc mem */ + a->dp = OPT_CAST(mp_digit) XMALLOC(sizeof(mp_digit) * size); + if (a->dp == NULL) { + return MP_MEM; + } - /* zero the digits */ - for (x = 0; x < size; x++) { + /* set the members */ + a->used = 0; + a->alloc = size; + a->sign = MP_ZPOS; + + /* zero the digits */ + for (x = 0; x < size; x++) { a->dp[x] = 0; - } + } - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index 36011d0..b70fe18 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -16,24 +16,24 @@ */ /* hac 14.61, pp608 */ -int mp_invmod (mp_int * a, mp_int * b, mp_int * c) +int mp_invmod(mp_int *a, mp_int *b, mp_int *c) { - /* b cannot be negative */ - if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { - return MP_VAL; - } + /* b cannot be negative */ + if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { + return MP_VAL; + } #ifdef BN_FAST_MP_INVMOD_C - /* if the modulus is odd we can use a faster routine instead */ - if ((mp_isodd(b) == MP_YES) && (mp_cmp_d(b, 1) != MP_EQ)) { - return fast_mp_invmod (a, b, c); - } + /* if the modulus is odd we can use a faster routine instead */ + if ((mp_isodd(b) == MP_YES) && (mp_cmp_d(b, 1) != MP_EQ)) { + return fast_mp_invmod(a, b, c); + } #endif #ifdef BN_MP_INVMOD_SLOW_C - return mp_invmod_slow(a, b, c); + return mp_invmod_slow(a, b, c); #else - return MP_VAL; + return MP_VAL; #endif } #endif diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c index ff0d5ae..2bdd2b1 100644 --- a/libtommath/bn_mp_invmod_slow.c +++ b/libtommath/bn_mp_invmod_slow.c @@ -16,157 +16,158 @@ */ /* hac 14.61, pp608 */ -int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c) +int mp_invmod_slow(mp_int *a, mp_int *b, mp_int *c) { - mp_int x, y, u, v, A, B, C, D; - int res; - - /* b cannot be negative */ - if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { - return MP_VAL; - } - - /* init temps */ - if ((res = mp_init_multi(&x, &y, &u, &v, - &A, &B, &C, &D, NULL)) != MP_OKAY) { - return res; - } - - /* x = a, y = b */ - if ((res = mp_mod(a, b, &x)) != MP_OKAY) { + mp_int x, y, u, v, A, B, C, D; + int res; + + /* b cannot be negative */ + if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { + return MP_VAL; + } + + /* init temps */ + if ((res = mp_init_multi(&x, &y, &u, &v, + &A, &B, &C, &D, NULL)) != MP_OKAY) { + return res; + } + + /* x = a, y = b */ + if ((res = mp_mod(a, b, &x)) != MP_OKAY) { goto LBL_ERR; - } - if ((res = mp_copy (b, &y)) != MP_OKAY) { - goto LBL_ERR; - } - - /* 2. [modified] if x,y are both even then return an error! */ - if ((mp_iseven (&x) == MP_YES) && (mp_iseven (&y) == MP_YES)) { - res = MP_VAL; - goto LBL_ERR; - } - - /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */ - if ((res = mp_copy (&x, &u)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_copy (&y, &v)) != MP_OKAY) { - goto LBL_ERR; - } - mp_set (&A, 1); - mp_set (&D, 1); + } + if ((res = mp_copy(b, &y)) != MP_OKAY) { + goto LBL_ERR; + } -top: - /* 4. while u is even do */ - while (mp_iseven (&u) == MP_YES) { - /* 4.1 u = u/2 */ - if ((res = mp_div_2 (&u, &u)) != MP_OKAY) { + /* 2. [modified] if x,y are both even then return an error! */ + if ((mp_iseven(&x) == MP_YES) && (mp_iseven(&y) == MP_YES)) { + res = MP_VAL; + goto LBL_ERR; + } + + /* 3. u=x, v=y, A=1, B=0, C=0,D=1 */ + if ((res = mp_copy(&x, &u)) != MP_OKAY) { + goto LBL_ERR; + } + if ((res = mp_copy(&y, &v)) != MP_OKAY) { goto LBL_ERR; - } - /* 4.2 if A or B is odd then */ - if ((mp_isodd (&A) == MP_YES) || (mp_isodd (&B) == MP_YES)) { - /* A = (A+y)/2, B = (B-x)/2 */ - if ((res = mp_add (&A, &y, &A)) != MP_OKAY) { + } + mp_set(&A, 1); + mp_set(&D, 1); + +top: + /* 4. while u is even do */ + while (mp_iseven(&u) == MP_YES) { + /* 4.1 u = u/2 */ + if ((res = mp_div_2(&u, &u)) != MP_OKAY) { goto LBL_ERR; } - if ((res = mp_sub (&B, &x, &B)) != MP_OKAY) { + /* 4.2 if A or B is odd then */ + if ((mp_isodd(&A) == MP_YES) || (mp_isodd(&B) == MP_YES)) { + /* A = (A+y)/2, B = (B-x)/2 */ + if ((res = mp_add(&A, &y, &A)) != MP_OKAY) { + goto LBL_ERR; + } + if ((res = mp_sub(&B, &x, &B)) != MP_OKAY) { + goto LBL_ERR; + } + } + /* A = A/2, B = B/2 */ + if ((res = mp_div_2(&A, &A)) != MP_OKAY) { goto LBL_ERR; } - } - /* A = A/2, B = B/2 */ - if ((res = mp_div_2 (&A, &A)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_div_2 (&B, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } + if ((res = mp_div_2(&B, &B)) != MP_OKAY) { + goto LBL_ERR; + } + } - /* 5. while v is even do */ - while (mp_iseven (&v) == MP_YES) { - /* 5.1 v = v/2 */ - if ((res = mp_div_2 (&v, &v)) != MP_OKAY) { - goto LBL_ERR; - } - /* 5.2 if C or D is odd then */ - if ((mp_isodd (&C) == MP_YES) || (mp_isodd (&D) == MP_YES)) { - /* C = (C+y)/2, D = (D-x)/2 */ - if ((res = mp_add (&C, &y, &C)) != MP_OKAY) { + /* 5. while v is even do */ + while (mp_iseven(&v) == MP_YES) { + /* 5.1 v = v/2 */ + if ((res = mp_div_2(&v, &v)) != MP_OKAY) { goto LBL_ERR; } - if ((res = mp_sub (&D, &x, &D)) != MP_OKAY) { + /* 5.2 if C or D is odd then */ + if ((mp_isodd(&C) == MP_YES) || (mp_isodd(&D) == MP_YES)) { + /* C = (C+y)/2, D = (D-x)/2 */ + if ((res = mp_add(&C, &y, &C)) != MP_OKAY) { + goto LBL_ERR; + } + if ((res = mp_sub(&D, &x, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } + /* C = C/2, D = D/2 */ + if ((res = mp_div_2(&C, &C)) != MP_OKAY) { goto LBL_ERR; } - } - /* C = C/2, D = D/2 */ - if ((res = mp_div_2 (&C, &C)) != MP_OKAY) { - goto LBL_ERR; - } - if ((res = mp_div_2 (&D, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } + if ((res = mp_div_2(&D, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } - /* 6. if u >= v then */ - if (mp_cmp (&u, &v) != MP_LT) { - /* u = u - v, A = A - C, B = B - D */ - if ((res = mp_sub (&u, &v, &u)) != MP_OKAY) { - goto LBL_ERR; - } + /* 6. if u >= v then */ + if (mp_cmp(&u, &v) != MP_LT) { + /* u = u - v, A = A - C, B = B - D */ + if ((res = mp_sub(&u, &v, &u)) != MP_OKAY) { + goto LBL_ERR; + } - if ((res = mp_sub (&A, &C, &A)) != MP_OKAY) { - goto LBL_ERR; - } + if ((res = mp_sub(&A, &C, &A)) != MP_OKAY) { + goto LBL_ERR; + } - if ((res = mp_sub (&B, &D, &B)) != MP_OKAY) { - goto LBL_ERR; - } - } else { - /* v - v - u, C = C - A, D = D - B */ - if ((res = mp_sub (&v, &u, &v)) != MP_OKAY) { - goto LBL_ERR; - } + if ((res = mp_sub(&B, &D, &B)) != MP_OKAY) { + goto LBL_ERR; + } + } else { + /* v - v - u, C = C - A, D = D - B */ + if ((res = mp_sub(&v, &u, &v)) != MP_OKAY) { + goto LBL_ERR; + } - if ((res = mp_sub (&C, &A, &C)) != MP_OKAY) { - goto LBL_ERR; - } + if ((res = mp_sub(&C, &A, &C)) != MP_OKAY) { + goto LBL_ERR; + } - if ((res = mp_sub (&D, &B, &D)) != MP_OKAY) { - goto LBL_ERR; - } - } + if ((res = mp_sub(&D, &B, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } - /* if not zero goto step 4 */ - if (mp_iszero (&u) == MP_NO) - goto top; + /* if not zero goto step 4 */ + if (mp_iszero(&u) == MP_NO) + goto top; - /* now a = C, b = D, gcd == g*v */ + /* now a = C, b = D, gcd == g*v */ - /* if v != 1 then there is no inverse */ - if (mp_cmp_d (&v, 1) != MP_EQ) { - res = MP_VAL; - goto LBL_ERR; - } + /* if v != 1 then there is no inverse */ + if (mp_cmp_d(&v, 1) != MP_EQ) { + res = MP_VAL; + goto LBL_ERR; + } - /* if its too low */ - while (mp_cmp_d(&C, 0) == MP_LT) { + /* if its too low */ + while (mp_cmp_d(&C, 0) == MP_LT) { if ((res = mp_add(&C, b, &C)) != MP_OKAY) { goto LBL_ERR; } - } - - /* too big */ - while (mp_cmp_mag(&C, b) != MP_LT) { + } + + /* too big */ + while (mp_cmp_mag(&C, b) != MP_LT) { if ((res = mp_sub(&C, b, &C)) != MP_OKAY) { goto LBL_ERR; } - } - - /* C is now the inverse */ - mp_exch (&C, c); - res = MP_OKAY; -LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &A, &B, &C, &D, NULL); - return res; + } + + /* C is now the inverse */ + mp_exch(&C, c); + res = MP_OKAY; +LBL_ERR: + mp_clear_multi(&x, &y, &u, &v, &A, &B, &C, &D, NULL); + return res; } #endif diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index dd08d58..303fab6 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -17,90 +17,91 @@ /* Check if remainders are possible squares - fast exclude non-squares */ static const char rem_128[128] = { - 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 + 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1 }; static const char rem_105[105] = { - 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, - 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 + 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, + 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, + 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, + 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1 }; /* Store non-zero to ret if arg is square, and zero if not */ -int mp_is_square(mp_int *arg,int *ret) +int mp_is_square(mp_int *arg, int *ret) { - int res; - mp_digit c; - mp_int t; - unsigned long r; + int res; + mp_digit c; + mp_int t; + unsigned long r; - /* Default to Non-square :) */ - *ret = MP_NO; + /* Default to Non-square :) */ + *ret = MP_NO; - if (arg->sign == MP_NEG) { - return MP_VAL; - } + if (arg->sign == MP_NEG) { + return MP_VAL; + } - /* digits used? (TSD) */ - if (arg->used == 0) { - return MP_OKAY; - } + /* digits used? (TSD) */ + if (arg->used == 0) { + return MP_OKAY; + } - /* First check mod 128 (suppose that DIGIT_BIT is at least 7) */ - if (rem_128[127 & DIGIT(arg,0)] == 1) { - return MP_OKAY; - } + /* First check mod 128 (suppose that DIGIT_BIT is at least 7) */ + if (rem_128[127 & DIGIT(arg, 0)] == 1) { + return MP_OKAY; + } - /* Next check mod 105 (3*5*7) */ - if ((res = mp_mod_d(arg,105,&c)) != MP_OKAY) { - return res; - } - if (rem_105[c] == 1) { - return MP_OKAY; - } + /* Next check mod 105 (3*5*7) */ + if ((res = mp_mod_d(arg, 105, &c)) != MP_OKAY) { + return res; + } + if (rem_105[c] == 1) { + return MP_OKAY; + } - if ((res = mp_init_set_int(&t,11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { - return res; - } - if ((res = mp_mod(arg,&t,&t)) != MP_OKAY) { - goto ERR; - } - r = mp_get_int(&t); - /* Check for other prime modules, note it's not an ERROR but we must - * free "t" so the easiest way is to goto ERR. We know that res - * is already equal to MP_OKAY from the mp_mod call - */ - if (((1L<<(r%11)) & 0x5C4L) != 0L) goto ERR; - if (((1L<<(r%13)) & 0x9E4L) != 0L) goto ERR; - if (((1L<<(r%17)) & 0x5CE8L) != 0L) goto ERR; - if (((1L<<(r%19)) & 0x4F50CL) != 0L) goto ERR; - if (((1L<<(r%23)) & 0x7ACCA0L) != 0L) goto ERR; - if (((1L<<(r%29)) & 0xC2EDD0CL) != 0L) goto ERR; - if (((1L<<(r%31)) & 0x6DE2B848L) != 0L) goto ERR; + if ((res = mp_init_set_int(&t, 11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { + return res; + } + if ((res = mp_mod(arg, &t, &t)) != MP_OKAY) { + goto ERR; + } + r = mp_get_int(&t); + /* Check for other prime modules, note it's not an ERROR but we must + * free "t" so the easiest way is to goto ERR. We know that res + * is already equal to MP_OKAY from the mp_mod call + */ + if (((1L<<(r%11)) & 0x5C4L) != 0L) goto ERR; + if (((1L<<(r%13)) & 0x9E4L) != 0L) goto ERR; + if (((1L<<(r%17)) & 0x5CE8L) != 0L) goto ERR; + if (((1L<<(r%19)) & 0x4F50CL) != 0L) goto ERR; + if (((1L<<(r%23)) & 0x7ACCA0L) != 0L) goto ERR; + if (((1L<<(r%29)) & 0xC2EDD0CL) != 0L) goto ERR; + if (((1L<<(r%31)) & 0x6DE2B848L) != 0L) goto ERR; - /* Final check - is sqr(sqrt(arg)) == arg ? */ - if ((res = mp_sqrt(arg,&t)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sqr(&t,&t)) != MP_OKAY) { - goto ERR; - } + /* Final check - is sqr(sqrt(arg)) == arg ? */ + if ((res = mp_sqrt(arg, &t)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sqr(&t, &t)) != MP_OKAY) { + goto ERR; + } - *ret = (mp_cmp_mag(&t,arg) == MP_EQ) ? MP_YES : MP_NO; -ERR:mp_clear(&t); - return res; + *ret = (mp_cmp_mag(&t, arg) == MP_EQ) ? MP_YES : MP_NO; +ERR: + mp_clear(&t); + return res; } #endif diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c index 5fc8593..8981393 100644 --- a/libtommath/bn_mp_jacobi.c +++ b/libtommath/bn_mp_jacobi.c @@ -20,95 +20,97 @@ * HAC is wrong here, as the special case of (0 | 1) is not * handled correctly. */ -int mp_jacobi (mp_int * a, mp_int * n, int *c) +int mp_jacobi(mp_int *a, mp_int *n, int *c) { - mp_int a1, p1; - int k, s, r, res; - mp_digit residue; + mp_int a1, p1; + int k, s, r, res; + mp_digit residue; - /* if a < 0 return MP_VAL */ - if (mp_isneg(a) == MP_YES) { - return MP_VAL; - } + /* if a < 0 return MP_VAL */ + if (mp_isneg(a) == MP_YES) { + return MP_VAL; + } - /* if n <= 0 return MP_VAL */ - if (mp_cmp_d(n, 0) != MP_GT) { - return MP_VAL; - } + /* if n <= 0 return MP_VAL */ + if (mp_cmp_d(n, 0) != MP_GT) { + return MP_VAL; + } - /* step 1. handle case of a == 0 */ - if (mp_iszero (a) == MP_YES) { - /* special case of a == 0 and n == 1 */ - if (mp_cmp_d (n, 1) == MP_EQ) { - *c = 1; - } else { - *c = 0; - } - return MP_OKAY; - } + /* step 1. handle case of a == 0 */ + if (mp_iszero(a) == MP_YES) { + /* special case of a == 0 and n == 1 */ + if (mp_cmp_d(n, 1) == MP_EQ) { + *c = 1; + } else { + *c = 0; + } + return MP_OKAY; + } - /* step 2. if a == 1, return 1 */ - if (mp_cmp_d (a, 1) == MP_EQ) { - *c = 1; - return MP_OKAY; - } + /* step 2. if a == 1, return 1 */ + if (mp_cmp_d(a, 1) == MP_EQ) { + *c = 1; + return MP_OKAY; + } - /* default */ - s = 0; + /* default */ + s = 0; - /* step 3. write a = a1 * 2**k */ - if ((res = mp_init_copy (&a1, a)) != MP_OKAY) { - return res; - } + /* step 3. write a = a1 * 2**k */ + if ((res = mp_init_copy(&a1, a)) != MP_OKAY) { + return res; + } - if ((res = mp_init (&p1)) != MP_OKAY) { - goto LBL_A1; - } + if ((res = mp_init(&p1)) != MP_OKAY) { + goto LBL_A1; + } - /* divide out larger power of two */ - k = mp_cnt_lsb(&a1); - if ((res = mp_div_2d(&a1, k, &a1, NULL)) != MP_OKAY) { - goto LBL_P1; - } - - /* step 4. if e is even set s=1 */ - if ((k & 1) == 0) { - s = 1; - } else { - /* else set s=1 if p = 1/7 (mod 8) or s=-1 if p = 3/5 (mod 8) */ - residue = n->dp[0] & 7; + /* divide out larger power of two */ + k = mp_cnt_lsb(&a1); + if ((res = mp_div_2d(&a1, k, &a1, NULL)) != MP_OKAY) { + goto LBL_P1; + } - if ((residue == 1) || (residue == 7)) { + /* step 4. if e is even set s=1 */ + if ((k & 1) == 0) { s = 1; - } else if ((residue == 3) || (residue == 5)) { - s = -1; - } - } + } else { + /* else set s=1 if p = 1/7 (mod 8) or s=-1 if p = 3/5 (mod 8) */ + residue = n->dp[0] & 7; - /* step 5. if p == 3 (mod 4) *and* a1 == 3 (mod 4) then s = -s */ - if ( ((n->dp[0] & 3) == 3) && ((a1.dp[0] & 3) == 3)) { - s = -s; - } + if ((residue == 1) || (residue == 7)) { + s = 1; + } else if ((residue == 3) || (residue == 5)) { + s = -1; + } + } - /* if a1 == 1 we're done */ - if (mp_cmp_d (&a1, 1) == MP_EQ) { - *c = s; - } else { - /* n1 = n mod a1 */ - if ((res = mp_mod (n, &a1, &p1)) != MP_OKAY) { - goto LBL_P1; - } - if ((res = mp_jacobi (&p1, &a1, &r)) != MP_OKAY) { - goto LBL_P1; - } - *c = s * r; - } + /* step 5. if p == 3 (mod 4) *and* a1 == 3 (mod 4) then s = -s */ + if (((n->dp[0] & 3) == 3) && ((a1.dp[0] & 3) == 3)) { + s = -s; + } + + /* if a1 == 1 we're done */ + if (mp_cmp_d(&a1, 1) == MP_EQ) { + *c = s; + } else { + /* n1 = n mod a1 */ + if ((res = mp_mod(n, &a1, &p1)) != MP_OKAY) { + goto LBL_P1; + } + if ((res = mp_jacobi(&p1, &a1, &r)) != MP_OKAY) { + goto LBL_P1; + } + *c = s * r; + } - /* done */ - res = MP_OKAY; -LBL_P1:mp_clear (&p1); -LBL_A1:mp_clear (&a1); - return res; + /* done */ + res = MP_OKAY; +LBL_P1: + mp_clear(&p1); +LBL_A1: + mp_clear(&a1); + return res; } #endif diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index 4d982c7..353c37c 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -15,150 +15,157 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* c = |a| * |b| using Karatsuba Multiplication using +/* c = |a| * |b| using Karatsuba Multiplication using * three half size multiplications * - * Let B represent the radix [e.g. 2**DIGIT_BIT] and - * let n represent half of the number of digits in + * Let B represent the radix [e.g. 2**DIGIT_BIT] and + * let n represent half of the number of digits in * the min(a,b) * * a = a1 * B**n + a0 * b = b1 * B**n + b0 * - * Then, a * b => + * Then, a * b => a1b1 * B**2n + ((a1 + a0)(b1 + b0) - (a0b0 + a1b1)) * B + a0b0 * - * Note that a1b1 and a0b0 are used twice and only need to be - * computed once. So in total three half size (half # of - * digit) multiplications are performed, a0b0, a1b1 and + * Note that a1b1 and a0b0 are used twice and only need to be + * computed once. So in total three half size (half # of + * digit) multiplications are performed, a0b0, a1b1 and * (a1+b1)(a0+b0) * * Note that a multiplication of half the digits requires - * 1/4th the number of single precision multiplications so in - * total after one call 25% of the single precision multiplications - * are saved. Note also that the call to mp_mul can end up back - * in this function if the a0, a1, b0, or b1 are above the threshold. - * This is known as divide-and-conquer and leads to the famous - * O(N**lg(3)) or O(N**1.584) work which is asymptopically lower than - * the standard O(N**2) that the baseline/comba methods use. - * Generally though the overhead of this method doesn't pay off + * 1/4th the number of single precision multiplications so in + * total after one call 25% of the single precision multiplications + * are saved. Note also that the call to mp_mul can end up back + * in this function if the a0, a1, b0, or b1 are above the threshold. + * This is known as divide-and-conquer and leads to the famous + * O(N**lg(3)) or O(N**1.584) work which is asymptopically lower than + * the standard O(N**2) that the baseline/comba methods use. + * Generally though the overhead of this method doesn't pay off * until a certain size (N ~ 80) is reached. */ -int mp_karatsuba_mul (mp_int * a, mp_int * b, mp_int * c) +int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c) { - mp_int x0, x1, y0, y1, t1, x0y0, x1y1; - int B, err; - - /* default the return code to an error */ - err = MP_MEM; - - /* min # of digits */ - B = MIN (a->used, b->used); - - /* now divide in two */ - B = B >> 1; - - /* init copy all the temps */ - if (mp_init_size (&x0, B) != MP_OKAY) - goto ERR; - if (mp_init_size (&x1, a->used - B) != MP_OKAY) - goto X0; - if (mp_init_size (&y0, B) != MP_OKAY) - goto X1; - if (mp_init_size (&y1, b->used - B) != MP_OKAY) - goto Y0; - - /* init temps */ - if (mp_init_size (&t1, B * 2) != MP_OKAY) - goto Y1; - if (mp_init_size (&x0y0, B * 2) != MP_OKAY) - goto T1; - if (mp_init_size (&x1y1, B * 2) != MP_OKAY) - goto X0Y0; - - /* now shift the digits */ - x0.used = y0.used = B; - x1.used = a->used - B; - y1.used = b->used - B; - - { - int x; - mp_digit *tmpa, *tmpb, *tmpx, *tmpy; - - /* we copy the digits directly instead of using higher level functions - * since we also need to shift the digits - */ - tmpa = a->dp; - tmpb = b->dp; - - tmpx = x0.dp; - tmpy = y0.dp; - for (x = 0; x < B; x++) { - *tmpx++ = *tmpa++; - *tmpy++ = *tmpb++; - } - - tmpx = x1.dp; - for (x = B; x < a->used; x++) { - *tmpx++ = *tmpa++; - } - - tmpy = y1.dp; - for (x = B; x < b->used; x++) { - *tmpy++ = *tmpb++; - } - } - - /* only need to clamp the lower words since by definition the - * upper words x1/y1 must have a known number of digits - */ - mp_clamp (&x0); - mp_clamp (&y0); - - /* now calc the products x0y0 and x1y1 */ - /* after this x0 is no longer required, free temp [x0==t2]! */ - if (mp_mul (&x0, &y0, &x0y0) != MP_OKAY) - goto X1Y1; /* x0y0 = x0*y0 */ - if (mp_mul (&x1, &y1, &x1y1) != MP_OKAY) - goto X1Y1; /* x1y1 = x1*y1 */ - - /* now calc x1+x0 and y1+y0 */ - if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) - goto X1Y1; /* t1 = x1 - x0 */ - if (s_mp_add (&y1, &y0, &x0) != MP_OKAY) - goto X1Y1; /* t2 = y1 - y0 */ - if (mp_mul (&t1, &x0, &t1) != MP_OKAY) - goto X1Y1; /* t1 = (x1 + x0) * (y1 + y0) */ - - /* add x0y0 */ - if (mp_add (&x0y0, &x1y1, &x0) != MP_OKAY) - goto X1Y1; /* t2 = x0y0 + x1y1 */ - if (s_mp_sub (&t1, &x0, &t1) != MP_OKAY) - goto X1Y1; /* t1 = (x1+x0)*(y1+y0) - (x1y1 + x0y0) */ - - /* shift by B */ - if (mp_lshd (&t1, B) != MP_OKAY) - goto X1Y1; /* t1 = (x0y0 + x1y1 - (x1-x0)*(y1-y0))<used, b->used); + + /* now divide in two */ + B = B >> 1; + + /* init copy all the temps */ + if (mp_init_size(&x0, B) != MP_OKAY) + goto ERR; + if (mp_init_size(&x1, a->used - B) != MP_OKAY) + goto X0; + if (mp_init_size(&y0, B) != MP_OKAY) + goto X1; + if (mp_init_size(&y1, b->used - B) != MP_OKAY) + goto Y0; + + /* init temps */ + if (mp_init_size(&t1, B * 2) != MP_OKAY) + goto Y1; + if (mp_init_size(&x0y0, B * 2) != MP_OKAY) + goto T1; + if (mp_init_size(&x1y1, B * 2) != MP_OKAY) + goto X0Y0; + + /* now shift the digits */ + x0.used = y0.used = B; + x1.used = a->used - B; + y1.used = b->used - B; + + { + int x; + mp_digit *tmpa, *tmpb, *tmpx, *tmpy; + + /* we copy the digits directly instead of using higher level functions + * since we also need to shift the digits + */ + tmpa = a->dp; + tmpb = b->dp; + + tmpx = x0.dp; + tmpy = y0.dp; + for (x = 0; x < B; x++) { + *tmpx++ = *tmpa++; + *tmpy++ = *tmpb++; + } + + tmpx = x1.dp; + for (x = B; x < a->used; x++) { + *tmpx++ = *tmpa++; + } + + tmpy = y1.dp; + for (x = B; x < b->used; x++) { + *tmpy++ = *tmpb++; + } + } + + /* only need to clamp the lower words since by definition the + * upper words x1/y1 must have a known number of digits + */ + mp_clamp(&x0); + mp_clamp(&y0); + + /* now calc the products x0y0 and x1y1 */ + /* after this x0 is no longer required, free temp [x0==t2]! */ + if (mp_mul(&x0, &y0, &x0y0) != MP_OKAY) + goto X1Y1; /* x0y0 = x0*y0 */ + if (mp_mul(&x1, &y1, &x1y1) != MP_OKAY) + goto X1Y1; /* x1y1 = x1*y1 */ + + /* now calc x1+x0 and y1+y0 */ + if (s_mp_add(&x1, &x0, &t1) != MP_OKAY) + goto X1Y1; /* t1 = x1 - x0 */ + if (s_mp_add(&y1, &y0, &x0) != MP_OKAY) + goto X1Y1; /* t2 = y1 - y0 */ + if (mp_mul(&t1, &x0, &t1) != MP_OKAY) + goto X1Y1; /* t1 = (x1 + x0) * (y1 + y0) */ + + /* add x0y0 */ + if (mp_add(&x0y0, &x1y1, &x0) != MP_OKAY) + goto X1Y1; /* t2 = x0y0 + x1y1 */ + if (s_mp_sub(&t1, &x0, &t1) != MP_OKAY) + goto X1Y1; /* t1 = (x1+x0)*(y1+y0) - (x1y1 + x0y0) */ + + /* shift by B */ + if (mp_lshd(&t1, B) != MP_OKAY) + goto X1Y1; /* t1 = (x0y0 + x1y1 - (x1-x0)*(y1-y0))<used; - - /* now divide in two */ - B = B >> 1; - - /* init copy all the temps */ - if (mp_init_size (&x0, B) != MP_OKAY) - goto ERR; - if (mp_init_size (&x1, a->used - B) != MP_OKAY) - goto X0; - - /* init temps */ - if (mp_init_size (&t1, a->used * 2) != MP_OKAY) - goto X1; - if (mp_init_size (&t2, a->used * 2) != MP_OKAY) - goto T1; - if (mp_init_size (&x0x0, B * 2) != MP_OKAY) - goto T2; - if (mp_init_size (&x1x1, (a->used - B) * 2) != MP_OKAY) - goto X0X0; - - { - int x; - mp_digit *dst, *src; - - src = a->dp; - - /* now shift the digits */ - dst = x0.dp; - for (x = 0; x < B; x++) { - *dst++ = *src++; - } - - dst = x1.dp; - for (x = B; x < a->used; x++) { - *dst++ = *src++; - } - } - - x0.used = B; - x1.used = a->used - B; - - mp_clamp (&x0); - - /* now calc the products x0*x0 and x1*x1 */ - if (mp_sqr (&x0, &x0x0) != MP_OKAY) - goto X1X1; /* x0x0 = x0*x0 */ - if (mp_sqr (&x1, &x1x1) != MP_OKAY) - goto X1X1; /* x1x1 = x1*x1 */ - - /* now calc (x1+x0)**2 */ - if (s_mp_add (&x1, &x0, &t1) != MP_OKAY) - goto X1X1; /* t1 = x1 - x0 */ - if (mp_sqr (&t1, &t1) != MP_OKAY) - goto X1X1; /* t1 = (x1 - x0) * (x1 - x0) */ - - /* add x0y0 */ - if (s_mp_add (&x0x0, &x1x1, &t2) != MP_OKAY) - goto X1X1; /* t2 = x0x0 + x1x1 */ - if (s_mp_sub (&t1, &t2, &t1) != MP_OKAY) - goto X1X1; /* t1 = (x1+x0)**2 - (x0x0 + x1x1) */ - - /* shift by B */ - if (mp_lshd (&t1, B) != MP_OKAY) - goto X1X1; /* t1 = (x0x0 + x1x1 - (x1-x0)*(x1-x0))<used; + + /* now divide in two */ + B = B >> 1; + + /* init copy all the temps */ + if (mp_init_size(&x0, B) != MP_OKAY) + goto ERR; + if (mp_init_size(&x1, a->used - B) != MP_OKAY) + goto X0; + + /* init temps */ + if (mp_init_size(&t1, a->used * 2) != MP_OKAY) + goto X1; + if (mp_init_size(&t2, a->used * 2) != MP_OKAY) + goto T1; + if (mp_init_size(&x0x0, B * 2) != MP_OKAY) + goto T2; + if (mp_init_size(&x1x1, (a->used - B) * 2) != MP_OKAY) + goto X0X0; + + { + int x; + mp_digit *dst, *src; + + src = a->dp; + + /* now shift the digits */ + dst = x0.dp; + for (x = 0; x < B; x++) { + *dst++ = *src++; + } + + dst = x1.dp; + for (x = B; x < a->used; x++) { + *dst++ = *src++; + } + } + + x0.used = B; + x1.used = a->used - B; + + mp_clamp(&x0); + + /* now calc the products x0*x0 and x1*x1 */ + if (mp_sqr(&x0, &x0x0) != MP_OKAY) + goto X1X1; /* x0x0 = x0*x0 */ + if (mp_sqr(&x1, &x1x1) != MP_OKAY) + goto X1X1; /* x1x1 = x1*x1 */ + + /* now calc (x1+x0)**2 */ + if (s_mp_add(&x1, &x0, &t1) != MP_OKAY) + goto X1X1; /* t1 = x1 - x0 */ + if (mp_sqr(&t1, &t1) != MP_OKAY) + goto X1X1; /* t1 = (x1 - x0) * (x1 - x0) */ + + /* add x0y0 */ + if (s_mp_add(&x0x0, &x1x1, &t2) != MP_OKAY) + goto X1X1; /* t2 = x0x0 + x1x1 */ + if (s_mp_sub(&t1, &t2, &t1) != MP_OKAY) + goto X1X1; /* t1 = (x1+x0)**2 - (x0x0 + x1x1) */ + + /* shift by B */ + if (mp_lshd(&t1, B) != MP_OKAY) + goto X1X1; /* t1 = (x0x0 + x1x1 - (x1-x0)*(x1-x0))<sign = MP_ZPOS; + int res; + mp_int t1, t2; + + + if ((res = mp_init_multi(&t1, &t2, NULL)) != MP_OKAY) { + return res; + } + + /* t1 = get the GCD of the two inputs */ + if ((res = mp_gcd(a, b, &t1)) != MP_OKAY) { + goto LBL_T; + } + + /* divide the smallest by the GCD */ + if (mp_cmp_mag(a, b) == MP_LT) { + /* store quotient in t2 such that t2 * b is the LCM */ + if ((res = mp_div(a, &t1, &t2, NULL)) != MP_OKAY) { + goto LBL_T; + } + res = mp_mul(b, &t2, c); + } else { + /* store quotient in t2 such that t2 * a is the LCM */ + if ((res = mp_div(b, &t1, &t2, NULL)) != MP_OKAY) { + goto LBL_T; + } + res = mp_mul(a, &t2, c); + } + + /* fix the sign to positive */ + c->sign = MP_ZPOS; LBL_T: - mp_clear_multi (&t1, &t2, NULL); - return res; + mp_clear_multi(&t1, &t2, NULL); + return res; } #endif diff --git a/libtommath/bn_mp_lshd.c b/libtommath/bn_mp_lshd.c index 0143e94..888989a 100644 --- a/libtommath/bn_mp_lshd.c +++ b/libtommath/bn_mp_lshd.c @@ -16,49 +16,49 @@ */ /* shift left a certain amount of digits */ -int mp_lshd (mp_int * a, int b) +int mp_lshd(mp_int *a, int b) { - int x, res; + int x, res; - /* if its less than zero return */ - if (b <= 0) { - return MP_OKAY; - } + /* if its less than zero return */ + if (b <= 0) { + return MP_OKAY; + } - /* grow to fit the new digits */ - if (a->alloc < (a->used + b)) { - if ((res = mp_grow (a, a->used + b)) != MP_OKAY) { - return res; - } - } + /* grow to fit the new digits */ + if (a->alloc < (a->used + b)) { + if ((res = mp_grow(a, a->used + b)) != MP_OKAY) { + return res; + } + } - { - mp_digit *top, *bottom; + { + mp_digit *top, *bottom; - /* increment the used by the shift amount then copy upwards */ - a->used += b; + /* increment the used by the shift amount then copy upwards */ + a->used += b; - /* top */ - top = a->dp + a->used - 1; + /* top */ + top = a->dp + a->used - 1; - /* base */ - bottom = (a->dp + a->used - 1) - b; + /* base */ + bottom = (a->dp + a->used - 1) - b; - /* much like mp_rshd this is implemented using a sliding window - * except the window goes the otherway around. Copying from - * the bottom to the top. see bn_mp_rshd.c for more info. - */ - for (x = a->used - 1; x >= b; x--) { - *top-- = *bottom--; - } + /* much like mp_rshd this is implemented using a sliding window + * except the window goes the otherway around. Copying from + * the bottom to the top. see bn_mp_rshd.c for more info. + */ + for (x = a->used - 1; x >= b; x--) { + *top-- = *bottom--; + } - /* zero the lower digits */ - top = a->dp; - for (x = 0; x < b; x++) { - *top++ = 0; - } - } - return MP_OKAY; + /* zero the lower digits */ + top = a->dp; + for (x = 0; x < b; x++) { + *top++ = 0; + } + } + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index 06240a0..267688c 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -16,30 +16,29 @@ */ /* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */ -int -mp_mod (mp_int * a, mp_int * b, mp_int * c) +int mp_mod(mp_int *a, mp_int *b, mp_int *c) { - mp_int t; - int res; + mp_int t; + int res; - if ((res = mp_init_size (&t, b->used)) != MP_OKAY) { - return res; - } + if ((res = mp_init_size(&t, b->used)) != MP_OKAY) { + return res; + } - if ((res = mp_div (a, b, NULL, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } + if ((res = mp_div(a, b, NULL, &t)) != MP_OKAY) { + mp_clear(&t); + return res; + } - if ((mp_iszero(&t) != MP_NO) || (t.sign == b->sign)) { - res = MP_OKAY; - mp_exch (&t, c); - } else { - res = mp_add (b, &t, c); - } + if ((mp_iszero(&t) != MP_NO) || (t.sign == b->sign)) { + res = MP_OKAY; + mp_exch(&t, c); + } else { + res = mp_add(b, &t, c); + } - mp_clear (&t); - return res; + mp_clear(&t); + return res; } #endif diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 2bb86da..59270b9 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -16,37 +16,36 @@ */ /* calc a value mod 2**b */ -int -mp_mod_2d (mp_int * a, int b, mp_int * c) +int mp_mod_2d(mp_int *a, int b, mp_int *c) { - int x, res; + int x, res; - /* if b is <= 0 then zero the int */ - if (b <= 0) { - mp_zero (c); - return MP_OKAY; - } + /* if b is <= 0 then zero the int */ + if (b <= 0) { + mp_zero(c); + return MP_OKAY; + } - /* if the modulus is larger than the value than return */ - if (b >= (int) (a->used * DIGIT_BIT)) { - res = mp_copy (a, c); - return res; - } + /* if the modulus is larger than the value than return */ + if (b >= (int)(a->used * DIGIT_BIT)) { + res = mp_copy(a, c); + return res; + } - /* copy */ - if ((res = mp_copy (a, c)) != MP_OKAY) { - return res; - } + /* copy */ + if ((res = mp_copy(a, c)) != MP_OKAY) { + return res; + } - /* zero digits above the last digit of the modulus */ - for (x = (b / DIGIT_BIT) + (((b % DIGIT_BIT) == 0) ? 0 : 1); x < c->used; x++) { - c->dp[x] = 0; - } - /* clear the digit that is not completely outside/inside the modulus */ - c->dp[b / DIGIT_BIT] &= - (mp_digit) ((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digit) 1)); - mp_clamp (c); - return MP_OKAY; + /* zero digits above the last digit of the modulus */ + for (x = (b / DIGIT_BIT) + (((b % DIGIT_BIT) == 0) ? 0 : 1); x < c->used; x++) { + c->dp[x] = 0; + } + /* clear the digit that is not completely outside/inside the modulus */ + c->dp[b / DIGIT_BIT] &= + (mp_digit)((((mp_digit) 1) << (((mp_digit) b) % DIGIT_BIT)) - ((mp_digit) 1)); + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index bf2ccaa..ff77346 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -15,10 +15,9 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -int -mp_mod_d (mp_int * a, mp_digit b, mp_digit * c) +int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c) { - return mp_div_d(a, b, NULL, c); + return mp_div_d(a, b, NULL, c); } #endif diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index 679a871..2d95140 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -21,36 +21,36 @@ * The method is slightly modified to shift B unconditionally upto just under * the leading bit of b. This saves alot of multiple precision shifting. */ -int mp_montgomery_calc_normalization (mp_int * a, mp_int * b) +int mp_montgomery_calc_normalization(mp_int *a, mp_int *b) { - int x, bits, res; + int x, bits, res; - /* how many bits of last digit does b use */ - bits = mp_count_bits (b) % DIGIT_BIT; + /* how many bits of last digit does b use */ + bits = mp_count_bits(b) % DIGIT_BIT; - if (b->used > 1) { - if ((res = mp_2expt (a, ((b->used - 1) * DIGIT_BIT) + bits - 1)) != MP_OKAY) { - return res; - } - } else { - mp_set(a, 1); - bits = 1; - } + if (b->used > 1) { + if ((res = mp_2expt(a, ((b->used - 1) * DIGIT_BIT) + bits - 1)) != MP_OKAY) { + return res; + } + } else { + mp_set(a, 1); + bits = 1; + } - /* now compute C = A * B mod b */ - for (x = bits - 1; x < (int)DIGIT_BIT; x++) { - if ((res = mp_mul_2 (a, a)) != MP_OKAY) { - return res; - } - if (mp_cmp_mag (a, b) != MP_LT) { - if ((res = s_mp_sub (a, b, a)) != MP_OKAY) { - return res; + /* now compute C = A * B mod b */ + for (x = bits - 1; x < (int)DIGIT_BIT; x++) { + if ((res = mp_mul_2(a, a)) != MP_OKAY) { + return res; + } + if (mp_cmp_mag(a, b) != MP_LT) { + if ((res = s_mp_sub(a, b, a)) != MP_OKAY) { + return res; + } } - } - } + } - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index 05e8bfa..1909997 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -16,100 +16,99 @@ */ /* computes xR**-1 == x (mod N) via Montgomery Reduction */ -int -mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho) +int mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho) { - int ix, res, digs; - mp_digit mu; - - /* can the fast reduction [comba] method be used? - * - * Note that unlike in mul you're safely allowed *less* - * than the available columns [255 per default] since carries - * are fixed up in the inner loop. - */ - digs = (n->used * 2) + 1; - if ((digs < MP_WARRAY) && - (n->used < - (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { - return fast_mp_montgomery_reduce (x, n, rho); - } - - /* grow the input as required */ - if (x->alloc < digs) { - if ((res = mp_grow (x, digs)) != MP_OKAY) { - return res; - } - } - x->used = digs; - - for (ix = 0; ix < n->used; ix++) { - /* mu = ai * rho mod b - * - * The value of rho must be precalculated via - * montgomery_setup() such that - * it equals -1/n0 mod b this allows the - * following inner loop to reduce the - * input one digit at a time - */ - mu = (mp_digit) (((mp_word)x->dp[ix] * (mp_word)rho) & MP_MASK); - - /* a = a + mu * m * b**i */ - { - int iy; - mp_digit *tmpn, *tmpx, u; - mp_word r; - - /* alias for digits of the modulus */ - tmpn = n->dp; - - /* alias for the digits of x [the input] */ - tmpx = x->dp + ix; - - /* set the carry to zero */ - u = 0; - - /* Multiply and add in place */ - for (iy = 0; iy < n->used; iy++) { - /* compute product and sum */ - r = ((mp_word)mu * (mp_word)*tmpn++) + - (mp_word) u + (mp_word) *tmpx; - - /* get carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - - /* fix digit */ - *tmpx++ = (mp_digit)(r & ((mp_word) MP_MASK)); + int ix, res, digs; + mp_digit mu; + + /* can the fast reduction [comba] method be used? + * + * Note that unlike in mul you're safely allowed *less* + * than the available columns [255 per default] since carries + * are fixed up in the inner loop. + */ + digs = (n->used * 2) + 1; + if ((digs < MP_WARRAY) && + (n->used < + (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { + return fast_mp_montgomery_reduce(x, n, rho); + } + + /* grow the input as required */ + if (x->alloc < digs) { + if ((res = mp_grow(x, digs)) != MP_OKAY) { + return res; } - /* At this point the ix'th digit of x should be zero */ + } + x->used = digs; + + for (ix = 0; ix < n->used; ix++) { + /* mu = ai * rho mod b + * + * The value of rho must be precalculated via + * montgomery_setup() such that + * it equals -1/n0 mod b this allows the + * following inner loop to reduce the + * input one digit at a time + */ + mu = (mp_digit)(((mp_word)x->dp[ix] * (mp_word)rho) & MP_MASK); + + /* a = a + mu * m * b**i */ + { + int iy; + mp_digit *tmpn, *tmpx, u; + mp_word r; + + /* alias for digits of the modulus */ + tmpn = n->dp; + + /* alias for the digits of x [the input] */ + tmpx = x->dp + ix; + + /* set the carry to zero */ + u = 0; + + /* Multiply and add in place */ + for (iy = 0; iy < n->used; iy++) { + /* compute product and sum */ + r = ((mp_word)mu * (mp_word)*tmpn++) + + (mp_word) u + (mp_word) *tmpx; + + /* get carry */ + u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + + /* fix digit */ + *tmpx++ = (mp_digit)(r & ((mp_word) MP_MASK)); + } + /* At this point the ix'th digit of x should be zero */ + + + /* propagate carries upwards as required*/ + while (u != 0) { + *tmpx += u; + u = *tmpx >> DIGIT_BIT; + *tmpx++ &= MP_MASK; + } + } + } + /* at this point the n.used'th least + * significant digits of x are all zero + * which means we can shift x to the + * right by n.used digits and the + * residue is unchanged. + */ - /* propagate carries upwards as required*/ - while (u != 0) { - *tmpx += u; - u = *tmpx >> DIGIT_BIT; - *tmpx++ &= MP_MASK; - } - } - } - - /* at this point the n.used'th least - * significant digits of x are all zero - * which means we can shift x to the - * right by n.used digits and the - * residue is unchanged. - */ - - /* x = x/b**n.used */ - mp_clamp(x); - mp_rshd (x, n->used); - - /* if x >= n then x = x - n */ - if (mp_cmp_mag (x, n) != MP_LT) { - return s_mp_sub (x, n, x); - } - - return MP_OKAY; + /* x = x/b**n.used */ + mp_clamp(x); + mp_rshd(x, n->used); + + /* if x >= n then x = x - n */ + if (mp_cmp_mag(x, n) != MP_LT) { + return s_mp_sub(x, n, x); + } + + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index 1c17445..46f560d 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -16,41 +16,40 @@ */ /* setups the montgomery reduction stuff */ -int -mp_montgomery_setup (mp_int * n, mp_digit * rho) +int mp_montgomery_setup(mp_int *n, mp_digit *rho) { - mp_digit x, b; + mp_digit x, b; -/* fast inversion mod 2**k - * - * Based on the fact that - * - * XA = 1 (mod 2**n) => (X(2-XA)) A = 1 (mod 2**2n) - * => 2*X*A - X*X*A*A = 1 - * => 2*(1) - (1) = 1 - */ - b = n->dp[0]; + /* fast inversion mod 2**k + * + * Based on the fact that + * + * XA = 1 (mod 2**n) => (X(2-XA)) A = 1 (mod 2**2n) + * => 2*X*A - X*X*A*A = 1 + * => 2*(1) - (1) = 1 + */ + b = n->dp[0]; - if ((b & 1) == 0) { - return MP_VAL; - } + if ((b & 1) == 0) { + return MP_VAL; + } - x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */ - x *= 2 - (b * x); /* here x*a==1 mod 2**8 */ + x = (((b + 2) & 4) << 1) + b; /* here x*a==1 mod 2**4 */ + x *= 2 - (b * x); /* here x*a==1 mod 2**8 */ #if !defined(MP_8BIT) - x *= 2 - (b * x); /* here x*a==1 mod 2**16 */ + x *= 2 - (b * x); /* here x*a==1 mod 2**16 */ #endif #if defined(MP_64BIT) || !(defined(MP_8BIT) || defined(MP_16BIT)) - x *= 2 - (b * x); /* here x*a==1 mod 2**32 */ + x *= 2 - (b * x); /* here x*a==1 mod 2**32 */ #endif #ifdef MP_64BIT - x *= 2 - (b * x); /* here x*a==1 mod 2**64 */ + x *= 2 - (b * x); /* here x*a==1 mod 2**64 */ #endif - /* rho = -1/m mod b */ - *rho = (mp_digit)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK; + /* rho = -1/m mod b */ + *rho = (mp_digit)(((mp_word)1 << ((mp_word) DIGIT_BIT)) - x) & MP_MASK; - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index cc3b9c8..315a520 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -16,49 +16,49 @@ */ /* high level multiplication (handles sign) */ -int mp_mul (mp_int * a, mp_int * b, mp_int * c) +int mp_mul(mp_int *a, mp_int *b, mp_int *c) { - int res, neg; - neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; + int res, neg; + neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; - /* use Toom-Cook? */ + /* use Toom-Cook? */ #ifdef BN_MP_TOOM_MUL_C - if (MIN (a->used, b->used) >= TOOM_MUL_CUTOFF) { - res = mp_toom_mul(a, b, c); - } else + if (MIN(a->used, b->used) >= TOOM_MUL_CUTOFF) { + res = mp_toom_mul(a, b, c); + } else #endif #ifdef BN_MP_KARATSUBA_MUL_C - /* use Karatsuba? */ - if (MIN (a->used, b->used) >= KARATSUBA_MUL_CUTOFF) { - res = mp_karatsuba_mul (a, b, c); - } else + /* use Karatsuba? */ + if (MIN(a->used, b->used) >= KARATSUBA_MUL_CUTOFF) { + res = mp_karatsuba_mul(a, b, c); + } else #endif - { - /* can we use the fast multiplier? - * - * The fast multiplier can be used if the output will - * have less than MP_WARRAY digits and the number of - * digits won't affect carry propagation - */ - int digs = a->used + b->used + 1; + { + /* can we use the fast multiplier? + * + * The fast multiplier can be used if the output will + * have less than MP_WARRAY digits and the number of + * digits won't affect carry propagation + */ + int digs = a->used + b->used + 1; #ifdef BN_FAST_S_MP_MUL_DIGS_C - if ((digs < MP_WARRAY) && - (MIN(a->used, b->used) <= - (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { - res = fast_s_mp_mul_digs (a, b, c, digs); - } else + if ((digs < MP_WARRAY) && + (MIN(a->used, b->used) <= + (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { + res = fast_s_mp_mul_digs(a, b, c, digs); + } else #endif - { + { #ifdef BN_S_MP_MUL_DIGS_C - res = s_mp_mul (a, b, c); /* uses s_mp_mul_digs */ + res = s_mp_mul(a, b, c); /* uses s_mp_mul_digs */ #else - res = MP_VAL; + res = MP_VAL; #endif - } - } - c->sign = (c->used > 0) ? neg : MP_ZPOS; - return res; + } + } + c->sign = (c->used > 0) ? neg : MP_ZPOS; + return res; } #endif diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index d22fd89..33bdc4c 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -16,64 +16,64 @@ */ /* b = a*2 */ -int mp_mul_2(mp_int * a, mp_int * b) +int mp_mul_2(mp_int *a, mp_int *b) { - int x, res, oldused; + int x, res, oldused; - /* grow to accomodate result */ - if (b->alloc < (a->used + 1)) { - if ((res = mp_grow (b, a->used + 1)) != MP_OKAY) { - return res; - } - } + /* grow to accomodate result */ + if (b->alloc < (a->used + 1)) { + if ((res = mp_grow(b, a->used + 1)) != MP_OKAY) { + return res; + } + } - oldused = b->used; - b->used = a->used; + oldused = b->used; + b->used = a->used; - { - mp_digit r, rr, *tmpa, *tmpb; + { + mp_digit r, rr, *tmpa, *tmpb; - /* alias for source */ - tmpa = a->dp; - - /* alias for dest */ - tmpb = b->dp; + /* alias for source */ + tmpa = a->dp; - /* carry */ - r = 0; - for (x = 0; x < a->used; x++) { - - /* get what will be the *next* carry bit from the - * MSB of the current digit - */ - rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1)); - - /* now shift up this digit, add in the carry [from the previous] */ - *tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK; - - /* copy the carry that would be from the source - * digit into the next iteration - */ - r = rr; - } + /* alias for dest */ + tmpb = b->dp; + + /* carry */ + r = 0; + for (x = 0; x < a->used; x++) { + + /* get what will be the *next* carry bit from the + * MSB of the current digit + */ + rr = *tmpa >> ((mp_digit)(DIGIT_BIT - 1)); - /* new leading digit? */ - if (r != 0) { - /* add a MSB which is always 1 at this point */ - *tmpb = 1; - ++(b->used); - } + /* now shift up this digit, add in the carry [from the previous] */ + *tmpb++ = ((*tmpa++ << ((mp_digit)1)) | r) & MP_MASK; - /* now zero any excess digits on the destination - * that we didn't write to - */ - tmpb = b->dp + b->used; - for (x = b->used; x < oldused; x++) { - *tmpb++ = 0; - } - } - b->sign = a->sign; - return MP_OKAY; + /* copy the carry that would be from the source + * digit into the next iteration + */ + r = rr; + } + + /* new leading digit? */ + if (r != 0) { + /* add a MSB which is always 1 at this point */ + *tmpb = 1; + ++(b->used); + } + + /* now zero any excess digits on the destination + * that we didn't write to + */ + tmpb = b->dp + b->used; + for (x = b->used; x < oldused; x++) { + *tmpb++ = 0; + } + } + b->sign = a->sign; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c index c00fd7e..b3d92a9 100644 --- a/libtommath/bn_mp_mul_2d.c +++ b/libtommath/bn_mp_mul_2d.c @@ -16,67 +16,67 @@ */ /* shift left by a certain bit count */ -int mp_mul_2d (mp_int * a, int b, mp_int * c) +int mp_mul_2d(mp_int *a, int b, mp_int *c) { - mp_digit d; - int res; + mp_digit d; + int res; - /* copy */ - if (a != c) { - if ((res = mp_copy (a, c)) != MP_OKAY) { - return res; - } - } + /* copy */ + if (a != c) { + if ((res = mp_copy(a, c)) != MP_OKAY) { + return res; + } + } - if (c->alloc < (int)(c->used + (b / DIGIT_BIT) + 1)) { - if ((res = mp_grow (c, c->used + (b / DIGIT_BIT) + 1)) != MP_OKAY) { - return res; - } - } + if (c->alloc < (int)(c->used + (b / DIGIT_BIT) + 1)) { + if ((res = mp_grow(c, c->used + (b / DIGIT_BIT) + 1)) != MP_OKAY) { + return res; + } + } - /* shift by as many digits in the bit count */ - if (b >= (int)DIGIT_BIT) { - if ((res = mp_lshd (c, b / DIGIT_BIT)) != MP_OKAY) { - return res; - } - } + /* shift by as many digits in the bit count */ + if (b >= (int)DIGIT_BIT) { + if ((res = mp_lshd(c, b / DIGIT_BIT)) != MP_OKAY) { + return res; + } + } - /* shift any bit count < DIGIT_BIT */ - d = (mp_digit) (b % DIGIT_BIT); - if (d != 0) { - mp_digit *tmpc, shift, mask, r, rr; - int x; + /* shift any bit count < DIGIT_BIT */ + d = (mp_digit)(b % DIGIT_BIT); + if (d != 0) { + mp_digit *tmpc, shift, mask, r, rr; + int x; - /* bitmask for carries */ - mask = (((mp_digit)1) << d) - 1; + /* bitmask for carries */ + mask = (((mp_digit)1) << d) - 1; - /* shift for msbs */ - shift = DIGIT_BIT - d; + /* shift for msbs */ + shift = DIGIT_BIT - d; - /* alias */ - tmpc = c->dp; + /* alias */ + tmpc = c->dp; - /* carry */ - r = 0; - for (x = 0; x < c->used; x++) { - /* get the higher bits of the current word */ - rr = (*tmpc >> shift) & mask; + /* carry */ + r = 0; + for (x = 0; x < c->used; x++) { + /* get the higher bits of the current word */ + rr = (*tmpc >> shift) & mask; - /* shift the current word and OR in the carry */ - *tmpc = ((*tmpc << d) | r) & MP_MASK; - ++tmpc; + /* shift the current word and OR in the carry */ + *tmpc = ((*tmpc << d) | r) & MP_MASK; + ++tmpc; - /* set the carry to the carry bits of the current word */ - r = rr; - } - - /* set final carry */ - if (r != 0) { - c->dp[(c->used)++] = r; - } - } - mp_clamp (c); - return MP_OKAY; + /* set the carry to the carry bits of the current word */ + r = rr; + } + + /* set final carry */ + if (r != 0) { + c->dp[(c->used)++] = r; + } + } + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index 6954ed3..1aa448c 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -16,61 +16,60 @@ */ /* multiply by a digit */ -int -mp_mul_d (mp_int * a, mp_digit b, mp_int * c) +int mp_mul_d(mp_int *a, mp_digit b, mp_int *c) { - mp_digit u, *tmpa, *tmpc; - mp_word r; - int ix, res, olduse; + mp_digit u, *tmpa, *tmpc; + mp_word r; + int ix, res, olduse; - /* make sure c is big enough to hold a*b */ - if (c->alloc < (a->used + 1)) { - if ((res = mp_grow (c, a->used + 1)) != MP_OKAY) { - return res; - } - } + /* make sure c is big enough to hold a*b */ + if (c->alloc < (a->used + 1)) { + if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { + return res; + } + } - /* get the original destinations used count */ - olduse = c->used; + /* get the original destinations used count */ + olduse = c->used; - /* set the sign */ - c->sign = a->sign; + /* set the sign */ + c->sign = a->sign; - /* alias for a->dp [source] */ - tmpa = a->dp; + /* alias for a->dp [source] */ + tmpa = a->dp; - /* alias for c->dp [dest] */ - tmpc = c->dp; + /* alias for c->dp [dest] */ + tmpc = c->dp; - /* zero carry */ - u = 0; + /* zero carry */ + u = 0; - /* compute columns */ - for (ix = 0; ix < a->used; ix++) { - /* compute product and carry sum for this term */ - r = (mp_word)u + ((mp_word)*tmpa++ * (mp_word)b); + /* compute columns */ + for (ix = 0; ix < a->used; ix++) { + /* compute product and carry sum for this term */ + r = (mp_word)u + ((mp_word)*tmpa++ * (mp_word)b); - /* mask off higher bits to get a single digit */ - *tmpc++ = (mp_digit) (r & ((mp_word) MP_MASK)); + /* mask off higher bits to get a single digit */ + *tmpc++ = (mp_digit)(r & ((mp_word)MP_MASK)); - /* send carry into next iteration */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } + /* send carry into next iteration */ + u = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); + } - /* store final carry [if any] and increment ix offset */ - *tmpc++ = u; - ++ix; + /* store final carry [if any] and increment ix offset */ + *tmpc++ = u; + ++ix; - /* now zero digits above the top */ - while (ix++ < olduse) { - *tmpc++ = 0; - } + /* now zero digits above the top */ + while (ix++ < olduse) { + *tmpc++ = 0; + } - /* set used count */ - c->used = a->used + 1; - mp_clamp(c); + /* set used count */ + c->used = a->used + 1; + mp_clamp(c); - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c index d7a4d3c..b1e6a33 100644 --- a/libtommath/bn_mp_mulmod.c +++ b/libtommath/bn_mp_mulmod.c @@ -16,22 +16,22 @@ */ /* d = a * b (mod c) */ -int mp_mulmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) { - int res; - mp_int t; + int res; + mp_int t; - if ((res = mp_init_size (&t, c->used)) != MP_OKAY) { - return res; - } + if ((res = mp_init_size(&t, c->used)) != MP_OKAY) { + return res; + } - if ((res = mp_mul (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, c, d); - mp_clear (&t); - return res; + if ((res = mp_mul(a, b, &t)) != MP_OKAY) { + mp_clear(&t); + return res; + } + res = mp_mod(&t, c, d); + mp_clear(&t); + return res; } #endif diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c index f717f17..8211c0a 100644 --- a/libtommath/bn_mp_n_root.c +++ b/libtommath/bn_mp_n_root.c @@ -18,9 +18,9 @@ /* wrapper function for mp_n_root_ex() * computes c = (a)**(1/b) such that (c)**b <= a and (c+1)**b > a */ -int mp_n_root (mp_int * a, mp_digit b, mp_int * c) +int mp_n_root(mp_int *a, mp_digit b, mp_int *c) { - return mp_n_root_ex(a, b, c, 0); + return mp_n_root_ex(a, b, c, 0); } #endif diff --git a/libtommath/bn_mp_n_root_ex.c b/libtommath/bn_mp_n_root_ex.c index 079b4f3..9546745 100644 --- a/libtommath/bn_mp_n_root_ex.c +++ b/libtommath/bn_mp_n_root_ex.c @@ -25,105 +25,108 @@ * each step involves a fair bit. This is not meant to * find huge roots [square and cube, etc]. */ -int mp_n_root_ex (mp_int * a, mp_digit b, mp_int * c, int fast) +int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) { - mp_int t1, t2, t3; - int res, neg; - - /* input must be positive if b is even */ - if (((b & 1) == 0) && (a->sign == MP_NEG)) { - return MP_VAL; - } - - if ((res = mp_init (&t1)) != MP_OKAY) { - return res; - } - - if ((res = mp_init (&t2)) != MP_OKAY) { - goto LBL_T1; - } - - if ((res = mp_init (&t3)) != MP_OKAY) { - goto LBL_T2; - } - - /* if a is negative fudge the sign but keep track */ - neg = a->sign; - a->sign = MP_ZPOS; - - /* t2 = 2 */ - mp_set (&t2, 2); - - do { - /* t1 = t2 */ - if ((res = mp_copy (&t2, &t1)) != MP_OKAY) { - goto LBL_T3; - } - - /* t2 = t1 - ((t1**b - a) / (b * t1**(b-1))) */ - - /* t3 = t1**(b-1) */ - if ((res = mp_expt_d_ex (&t1, b - 1, &t3, fast)) != MP_OKAY) { - goto LBL_T3; - } - - /* numerator */ - /* t2 = t1**b */ - if ((res = mp_mul (&t3, &t1, &t2)) != MP_OKAY) { - goto LBL_T3; - } - - /* t2 = t1**b - a */ - if ((res = mp_sub (&t2, a, &t2)) != MP_OKAY) { - goto LBL_T3; - } - - /* denominator */ - /* t3 = t1**(b-1) * b */ - if ((res = mp_mul_d (&t3, b, &t3)) != MP_OKAY) { - goto LBL_T3; - } - - /* t3 = (t1**b - a)/(b * t1**(b-1)) */ - if ((res = mp_div (&t2, &t3, &t3, NULL)) != MP_OKAY) { - goto LBL_T3; - } - - if ((res = mp_sub (&t1, &t3, &t2)) != MP_OKAY) { - goto LBL_T3; - } - } while (mp_cmp (&t1, &t2) != MP_EQ); - - /* result can be off by a few so check */ - for (;;) { - if ((res = mp_expt_d_ex (&t1, b, &t2, fast)) != MP_OKAY) { - goto LBL_T3; - } - - if (mp_cmp (&t2, a) == MP_GT) { - if ((res = mp_sub_d (&t1, 1, &t1)) != MP_OKAY) { + mp_int t1, t2, t3; + int res, neg; + + /* input must be positive if b is even */ + if (((b & 1) == 0) && (a->sign == MP_NEG)) { + return MP_VAL; + } + + if ((res = mp_init(&t1)) != MP_OKAY) { + return res; + } + + if ((res = mp_init(&t2)) != MP_OKAY) { + goto LBL_T1; + } + + if ((res = mp_init(&t3)) != MP_OKAY) { + goto LBL_T2; + } + + /* if a is negative fudge the sign but keep track */ + neg = a->sign; + a->sign = MP_ZPOS; + + /* t2 = 2 */ + mp_set(&t2, 2); + + do { + /* t1 = t2 */ + if ((res = mp_copy(&t2, &t1)) != MP_OKAY) { + goto LBL_T3; + } + + /* t2 = t1 - ((t1**b - a) / (b * t1**(b-1))) */ + + /* t3 = t1**(b-1) */ + if ((res = mp_expt_d_ex(&t1, b - 1, &t3, fast)) != MP_OKAY) { + goto LBL_T3; + } + + /* numerator */ + /* t2 = t1**b */ + if ((res = mp_mul(&t3, &t1, &t2)) != MP_OKAY) { goto LBL_T3; } - } else { - break; - } - } - /* reset the sign of a first */ - a->sign = neg; + /* t2 = t1**b - a */ + if ((res = mp_sub(&t2, a, &t2)) != MP_OKAY) { + goto LBL_T3; + } + + /* denominator */ + /* t3 = t1**(b-1) * b */ + if ((res = mp_mul_d(&t3, b, &t3)) != MP_OKAY) { + goto LBL_T3; + } + + /* t3 = (t1**b - a)/(b * t1**(b-1)) */ + if ((res = mp_div(&t2, &t3, &t3, NULL)) != MP_OKAY) { + goto LBL_T3; + } + + if ((res = mp_sub(&t1, &t3, &t2)) != MP_OKAY) { + goto LBL_T3; + } + } while (mp_cmp(&t1, &t2) != MP_EQ); + + /* result can be off by a few so check */ + for (;;) { + if ((res = mp_expt_d_ex(&t1, b, &t2, fast)) != MP_OKAY) { + goto LBL_T3; + } + + if (mp_cmp(&t2, a) == MP_GT) { + if ((res = mp_sub_d(&t1, 1, &t1)) != MP_OKAY) { + goto LBL_T3; + } + } else { + break; + } + } + + /* reset the sign of a first */ + a->sign = neg; - /* set the result */ - mp_exch (&t1, c); + /* set the result */ + mp_exch(&t1, c); - /* set the sign of the result */ - c->sign = neg; + /* set the sign of the result */ + c->sign = neg; - res = MP_OKAY; + res = MP_OKAY; -LBL_T3:mp_clear (&t3); -LBL_T2:mp_clear (&t2); -LBL_T1:mp_clear (&t1); - return res; +LBL_T3: + mp_clear(&t3); +LBL_T2: + mp_clear(&t2); +LBL_T1: + mp_clear(&t1); + return res; } #endif diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c index d03e92e..b30d044 100644 --- a/libtommath/bn_mp_neg.c +++ b/libtommath/bn_mp_neg.c @@ -16,22 +16,22 @@ */ /* b = -a */ -int mp_neg (mp_int * a, mp_int * b) +int mp_neg(mp_int *a, mp_int *b) { - int res; - if (a != b) { - if ((res = mp_copy (a, b)) != MP_OKAY) { - return res; - } - } + int res; + if (a != b) { + if ((res = mp_copy(a, b)) != MP_OKAY) { + return res; + } + } - if (mp_iszero(b) != MP_YES) { - b->sign = (a->sign == MP_ZPOS) ? MP_NEG : MP_ZPOS; - } else { - b->sign = MP_ZPOS; - } + if (mp_iszero(b) != MP_YES) { + b->sign = (a->sign == MP_ZPOS) ? MP_NEG : MP_ZPOS; + } else { + b->sign = MP_ZPOS; + } - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index b9775ce..2318c79 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -16,32 +16,32 @@ */ /* OR two ints together */ -int mp_or (mp_int * a, mp_int * b, mp_int * c) +int mp_or(mp_int *a, mp_int *b, mp_int *c) { - int res, ix, px; - mp_int t, *x; + int res, ix, px; + mp_int t, *x; - if (a->used > b->used) { - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - px = b->used; - x = b; - } else { - if ((res = mp_init_copy (&t, b)) != MP_OKAY) { - return res; - } - px = a->used; - x = a; - } + if (a->used > b->used) { + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } + px = b->used; + x = b; + } else { + if ((res = mp_init_copy(&t, b)) != MP_OKAY) { + return res; + } + px = a->used; + x = a; + } - for (ix = 0; ix < px; ix++) { - t.dp[ix] |= x->dp[ix]; - } - mp_clamp (&t); - mp_exch (c, &t); - mp_clear (&t); - return MP_OKAY; + for (ix = 0; ix < px; ix++) { + t.dp[ix] |= x->dp[ix]; + } + mp_clamp(&t); + mp_exch(c, &t); + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c index d99feeb..37ad6ec 100644 --- a/libtommath/bn_mp_prime_fermat.c +++ b/libtommath/bn_mp_prime_fermat.c @@ -16,44 +16,45 @@ */ /* performs one Fermat test. - * + * * If "a" were prime then b**a == b (mod a) since the order of * the multiplicative sub-group would be phi(a) = a-1. That means * it would be the same as b**(a mod (a-1)) == b**1 == b (mod a). * * Sets result to 1 if the congruence holds, or zero otherwise. */ -int mp_prime_fermat (mp_int * a, mp_int * b, int *result) +int mp_prime_fermat(mp_int *a, mp_int *b, int *result) { - mp_int t; - int err; - - /* default to composite */ - *result = MP_NO; - - /* ensure b > 1 */ - if (mp_cmp_d(b, 1) != MP_GT) { - return MP_VAL; - } - - /* init t */ - if ((err = mp_init (&t)) != MP_OKAY) { - return err; - } - - /* compute t = b**a mod a */ - if ((err = mp_exptmod (b, a, a, &t)) != MP_OKAY) { - goto LBL_T; - } - - /* is it equal to b? */ - if (mp_cmp (&t, b) == MP_EQ) { - *result = MP_YES; - } - - err = MP_OKAY; -LBL_T:mp_clear (&t); - return err; + mp_int t; + int err; + + /* default to composite */ + *result = MP_NO; + + /* ensure b > 1 */ + if (mp_cmp_d(b, 1) != MP_GT) { + return MP_VAL; + } + + /* init t */ + if ((err = mp_init(&t)) != MP_OKAY) { + return err; + } + + /* compute t = b**a mod a */ + if ((err = mp_exptmod(b, a, a, &t)) != MP_OKAY) { + goto LBL_T; + } + + /* is it equal to b? */ + if (mp_cmp(&t, b) == MP_EQ) { + *result = MP_YES; + } + + err = MP_OKAY; +LBL_T: + mp_clear(&t); + return err; } #endif diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c index eea4a27..92af330 100644 --- a/libtommath/bn_mp_prime_is_divisible.c +++ b/libtommath/bn_mp_prime_is_divisible.c @@ -15,33 +15,33 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* determines if an integers is divisible by one +/* determines if an integers is divisible by one * of the first PRIME_SIZE primes or not * * sets result to 0 if not, 1 if yes */ -int mp_prime_is_divisible (mp_int * a, int *result) +int mp_prime_is_divisible(mp_int *a, int *result) { - int err, ix; - mp_digit res; + int err, ix; + mp_digit res; - /* default to not */ - *result = MP_NO; + /* default to not */ + *result = MP_NO; - for (ix = 0; ix < PRIME_SIZE; ix++) { - /* what is a mod LBL_prime_tab[ix] */ - if ((err = mp_mod_d (a, ltm_prime_tab[ix], &res)) != MP_OKAY) { - return err; - } + for (ix = 0; ix < PRIME_SIZE; ix++) { + /* what is a mod LBL_prime_tab[ix] */ + if ((err = mp_mod_d(a, ltm_prime_tab[ix], &res)) != MP_OKAY) { + return err; + } - /* is the residue zero? */ - if (res == 0) { - *result = MP_YES; - return MP_OKAY; - } - } + /* is the residue zero? */ + if (res == 0) { + *result = MP_YES; + return MP_OKAY; + } + } - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c index 3eda4fd..20a7d1f 100644 --- a/libtommath/bn_mp_prime_is_prime.c +++ b/libtommath/bn_mp_prime_is_prime.c @@ -22,59 +22,60 @@ * * Sets result to 1 if probably prime, 0 otherwise */ -int mp_prime_is_prime (mp_int * a, int t, int *result) +int mp_prime_is_prime(mp_int *a, int t, int *result) { - mp_int b; - int ix, err, res; + mp_int b; + int ix, err, res; - /* default to no */ - *result = MP_NO; + /* default to no */ + *result = MP_NO; - /* valid value of t? */ - if ((t <= 0) || (t > PRIME_SIZE)) { - return MP_VAL; - } + /* valid value of t? */ + if ((t <= 0) || (t > PRIME_SIZE)) { + return MP_VAL; + } - /* is the input equal to one of the primes in the table? */ - for (ix = 0; ix < PRIME_SIZE; ix++) { + /* is the input equal to one of the primes in the table? */ + for (ix = 0; ix < PRIME_SIZE; ix++) { if (mp_cmp_d(a, ltm_prime_tab[ix]) == MP_EQ) { *result = 1; return MP_OKAY; } - } + } - /* first perform trial division */ - if ((err = mp_prime_is_divisible (a, &res)) != MP_OKAY) { - return err; - } + /* first perform trial division */ + if ((err = mp_prime_is_divisible(a, &res)) != MP_OKAY) { + return err; + } - /* return if it was trivially divisible */ - if (res == MP_YES) { - return MP_OKAY; - } + /* return if it was trivially divisible */ + if (res == MP_YES) { + return MP_OKAY; + } - /* now perform the miller-rabin rounds */ - if ((err = mp_init (&b)) != MP_OKAY) { - return err; - } + /* now perform the miller-rabin rounds */ + if ((err = mp_init(&b)) != MP_OKAY) { + return err; + } - for (ix = 0; ix < t; ix++) { - /* set the prime */ - mp_set (&b, ltm_prime_tab[ix]); + for (ix = 0; ix < t; ix++) { + /* set the prime */ + mp_set(&b, ltm_prime_tab[ix]); - if ((err = mp_prime_miller_rabin (a, &b, &res)) != MP_OKAY) { - goto LBL_B; - } + if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) { + goto LBL_B; + } - if (res == MP_NO) { - goto LBL_B; - } - } + if (res == MP_NO) { + goto LBL_B; + } + } - /* passed the test */ - *result = MP_YES; -LBL_B:mp_clear (&b); - return err; + /* passed the test */ + *result = MP_YES; +LBL_B: + mp_clear(&b); + return err; } #endif diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c index 7de0634..917dc01 100644 --- a/libtommath/bn_mp_prime_miller_rabin.c +++ b/libtommath/bn_mp_prime_miller_rabin.c @@ -15,86 +15,89 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* Miller-Rabin test of "a" to the base of "b" as described in +/* Miller-Rabin test of "a" to the base of "b" as described in * HAC pp. 139 Algorithm 4.24 * * Sets result to 0 if definitely composite or 1 if probably prime. - * Randomly the chance of error is no more than 1/4 and often + * Randomly the chance of error is no more than 1/4 and often * very much lower. */ -int mp_prime_miller_rabin (mp_int * a, mp_int * b, int *result) +int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result) { - mp_int n1, y, r; - int s, j, err; + mp_int n1, y, r; + int s, j, err; - /* default */ - *result = MP_NO; + /* default */ + *result = MP_NO; - /* ensure b > 1 */ - if (mp_cmp_d(b, 1) != MP_GT) { - return MP_VAL; - } + /* ensure b > 1 */ + if (mp_cmp_d(b, 1) != MP_GT) { + return MP_VAL; + } - /* get n1 = a - 1 */ - if ((err = mp_init_copy (&n1, a)) != MP_OKAY) { - return err; - } - if ((err = mp_sub_d (&n1, 1, &n1)) != MP_OKAY) { - goto LBL_N1; - } + /* get n1 = a - 1 */ + if ((err = mp_init_copy(&n1, a)) != MP_OKAY) { + return err; + } + if ((err = mp_sub_d(&n1, 1, &n1)) != MP_OKAY) { + goto LBL_N1; + } - /* set 2**s * r = n1 */ - if ((err = mp_init_copy (&r, &n1)) != MP_OKAY) { - goto LBL_N1; - } + /* set 2**s * r = n1 */ + if ((err = mp_init_copy(&r, &n1)) != MP_OKAY) { + goto LBL_N1; + } - /* count the number of least significant bits - * which are zero - */ - s = mp_cnt_lsb(&r); + /* count the number of least significant bits + * which are zero + */ + s = mp_cnt_lsb(&r); - /* now divide n - 1 by 2**s */ - if ((err = mp_div_2d (&r, s, &r, NULL)) != MP_OKAY) { - goto LBL_R; - } + /* now divide n - 1 by 2**s */ + if ((err = mp_div_2d(&r, s, &r, NULL)) != MP_OKAY) { + goto LBL_R; + } - /* compute y = b**r mod a */ - if ((err = mp_init (&y)) != MP_OKAY) { - goto LBL_R; - } - if ((err = mp_exptmod (b, &r, a, &y)) != MP_OKAY) { - goto LBL_Y; - } + /* compute y = b**r mod a */ + if ((err = mp_init(&y)) != MP_OKAY) { + goto LBL_R; + } + if ((err = mp_exptmod(b, &r, a, &y)) != MP_OKAY) { + goto LBL_Y; + } - /* if y != 1 and y != n1 do */ - if ((mp_cmp_d (&y, 1) != MP_EQ) && (mp_cmp (&y, &n1) != MP_EQ)) { - j = 1; - /* while j <= s-1 and y != n1 */ - while ((j <= (s - 1)) && (mp_cmp (&y, &n1) != MP_EQ)) { - if ((err = mp_sqrmod (&y, a, &y)) != MP_OKAY) { - goto LBL_Y; + /* if y != 1 and y != n1 do */ + if ((mp_cmp_d(&y, 1) != MP_EQ) && (mp_cmp(&y, &n1) != MP_EQ)) { + j = 1; + /* while j <= s-1 and y != n1 */ + while ((j <= (s - 1)) && (mp_cmp(&y, &n1) != MP_EQ)) { + if ((err = mp_sqrmod(&y, a, &y)) != MP_OKAY) { + goto LBL_Y; + } + + /* if y == 1 then composite */ + if (mp_cmp_d(&y, 1) == MP_EQ) { + goto LBL_Y; + } + + ++j; } - /* if y == 1 then composite */ - if (mp_cmp_d (&y, 1) == MP_EQ) { + /* if y != n1 then composite */ + if (mp_cmp(&y, &n1) != MP_EQ) { goto LBL_Y; } + } - ++j; - } - - /* if y != n1 then composite */ - if (mp_cmp (&y, &n1) != MP_EQ) { - goto LBL_Y; - } - } - - /* probably prime now */ - *result = MP_YES; -LBL_Y:mp_clear (&y); -LBL_R:mp_clear (&r); -LBL_N1:mp_clear (&n1); - return err; + /* probably prime now */ + *result = MP_YES; +LBL_Y: + mp_clear(&y); +LBL_R: + mp_clear(&r); +LBL_N1: + mp_clear(&n1); + return err; } #endif diff --git a/libtommath/bn_mp_prime_next_prime.c b/libtommath/bn_mp_prime_next_prime.c index 7a32d9b..f383cbb 100644 --- a/libtommath/bn_mp_prime_next_prime.c +++ b/libtommath/bn_mp_prime_next_prime.c @@ -38,28 +38,28 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style) if (mp_cmp_d(a, ltm_prime_tab[PRIME_SIZE-1]) == MP_LT) { /* find which prime it is bigger than */ for (x = PRIME_SIZE - 2; x >= 0; x--) { - if (mp_cmp_d(a, ltm_prime_tab[x]) != MP_LT) { - if (bbs_style == 1) { - /* ok we found a prime smaller or - * equal [so the next is larger] - * - * however, the prime must be - * congruent to 3 mod 4 - */ - if ((ltm_prime_tab[x + 1] & 3) != 3) { - /* scan upwards for a prime congruent to 3 mod 4 */ - for (y = x + 1; y < PRIME_SIZE; y++) { - if ((ltm_prime_tab[y] & 3) == 3) { - mp_set(a, ltm_prime_tab[y]); - return MP_OKAY; - } - } - } - } else { - mp_set(a, ltm_prime_tab[x + 1]); - return MP_OKAY; - } - } + if (mp_cmp_d(a, ltm_prime_tab[x]) != MP_LT) { + if (bbs_style == 1) { + /* ok we found a prime smaller or + * equal [so the next is larger] + * + * however, the prime must be + * congruent to 3 mod 4 + */ + if ((ltm_prime_tab[x + 1] & 3) != 3) { + /* scan upwards for a prime congruent to 3 mod 4 */ + for (y = x + 1; y < PRIME_SIZE; y++) { + if ((ltm_prime_tab[y] & 3) == 3) { + mp_set(a, ltm_prime_tab[y]); + return MP_OKAY; + } + } + } + } else { + mp_set(a, ltm_prime_tab[x + 1]); + return MP_OKAY; + } + } } /* at this point a maybe 1 */ if (mp_cmp_d(a, 1) == MP_EQ) { @@ -81,7 +81,9 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style) if (bbs_style == 1) { /* if a mod 4 != 3 subtract the correct value to make it so */ if ((a->dp[0] & 3) != 3) { - if ((err = mp_sub_d(a, (a->dp[0] & 3) + 1, a)) != MP_OKAY) { return err; }; + if ((err = mp_sub_d(a, (a->dp[0] & 3) + 1, a)) != MP_OKAY) { + return err; + }; } } else { if (mp_iseven(a) == MP_YES) { @@ -116,18 +118,18 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style) /* compute the new residue without using division */ for (x = 1; x < PRIME_SIZE; x++) { - /* add the step to each residue */ - res_tab[x] += kstep; - - /* subtract the modulus [instead of using division] */ - if (res_tab[x] >= ltm_prime_tab[x]) { - res_tab[x] -= ltm_prime_tab[x]; - } - - /* set flag if zero */ - if (res_tab[x] == 0) { - y = 1; - } + /* add the step to each residue */ + res_tab[x] += kstep; + + /* subtract the modulus [instead of using division] */ + if (res_tab[x] >= ltm_prime_tab[x]) { + res_tab[x] -= ltm_prime_tab[x]; + } + + /* set flag if zero */ + if (res_tab[x] == 0) { + y = 1; + } } } while ((y == 1) && (step < ((((mp_digit)1) << DIGIT_BIT) - kstep))); @@ -143,13 +145,13 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style) /* is this prime? */ for (x = 0; x < t; x++) { - mp_set(&b, ltm_prime_tab[x]); - if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) { - goto LBL_ERR; - } - if (res == MP_NO) { - break; - } + mp_set(&b, ltm_prime_tab[x]); + if ((err = mp_prime_miller_rabin(a, &b, &res)) != MP_OKAY) { + goto LBL_ERR; + } + if (res == MP_NO) { + break; + } } if (res == MP_YES) { diff --git a/libtommath/bn_mp_prime_rabin_miller_trials.c b/libtommath/bn_mp_prime_rabin_miller_trials.c index 378ceb2..cde309a 100644 --- a/libtommath/bn_mp_prime_rabin_miller_trials.c +++ b/libtommath/bn_mp_prime_rabin_miller_trials.c @@ -19,14 +19,14 @@ static const struct { int k, t; } sizes[] = { -{ 128, 28 }, -{ 256, 16 }, -{ 384, 10 }, -{ 512, 7 }, -{ 640, 6 }, -{ 768, 5 }, -{ 896, 4 }, -{ 1024, 4 } + { 128, 28 }, + { 256, 16 }, + { 384, 10 }, + { 512, 7 }, + { 640, 6 }, + { 768, 5 }, + { 896, 4 }, + { 1024, 4 } }; /* returns # of RM trials required for a given bit size */ @@ -35,11 +35,11 @@ int mp_prime_rabin_miller_trials(int size) int x; for (x = 0; x < (int)(sizeof(sizes)/(sizeof(sizes[0]))); x++) { - if (sizes[x].k == size) { - return sizes[x].t; - } else if (sizes[x].k > size) { - return (x == 0) ? sizes[0].t : sizes[x - 1].t; - } + if (sizes[x].k == size) { + return sizes[x].t; + } else if (sizes[x].k > size) { + return (x == 0) ? sizes[0].t : sizes[x - 1].t; + } } return sizes[x-1].t + 1; } diff --git a/libtommath/bn_mp_prime_random_ex.c b/libtommath/bn_mp_prime_random_ex.c index cf5272e..d3d6f3d 100644 --- a/libtommath/bn_mp_prime_random_ex.c +++ b/libtommath/bn_mp_prime_random_ex.c @@ -18,7 +18,7 @@ /* 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_ON - make the 2nd highest bit one @@ -62,7 +62,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback maskOR_msb_offset = ((size & 7) == 1) ? 1 : 0; if ((flags & LTM_PRIME_2MSB_ON) != 0) { maskOR_msb |= 0x80 >> ((9 - size) & 7); - } + } /* get the maskOR_lsb */ maskOR_lsb = 1; @@ -76,7 +76,7 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback err = MP_VAL; goto error; } - + /* work over the MSbyte */ tmp[0] &= maskAND; tmp[0] |= 1 << ((size - 1) & 7); @@ -86,28 +86,42 @@ int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback tmp[bsize-1] |= maskOR_lsb; /* read it in */ - if ((err = mp_read_unsigned_bin(a, tmp, bsize)) != MP_OKAY) { goto error; } + if ((err = mp_read_unsigned_bin(a, tmp, bsize)) != MP_OKAY) { + goto error; + } /* is it prime? */ - if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { goto error; } - if (res == MP_NO) { + if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { + goto error; + } + if (res == MP_NO) { continue; } if ((flags & LTM_PRIME_SAFE) != 0) { /* see if (a-1)/2 is prime */ - if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) { goto error; } - if ((err = mp_div_2(a, a)) != MP_OKAY) { goto error; } - + if ((err = mp_sub_d(a, 1, a)) != MP_OKAY) { + goto error; + } + if ((err = mp_div_2(a, a)) != MP_OKAY) { + goto error; + } + /* is it prime? */ - if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { goto error; } + if ((err = mp_prime_is_prime(a, t, &res)) != MP_OKAY) { + goto error; + } } } while (res == MP_NO); if ((flags & LTM_PRIME_SAFE) != 0) { /* restore a to the original value */ - if ((err = mp_mul_2(a, a)) != MP_OKAY) { goto error; } - if ((err = mp_add_d(a, 1, a)) != MP_OKAY) { goto error; } + if ((err = mp_mul_2(a, a)) != MP_OKAY) { + goto error; + } + if ((err = mp_add_d(a, 1, a)) != MP_OKAY) { + goto error; + } } err = MP_OKAY; diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c index cb0c134..a6e2f04 100644 --- a/libtommath/bn_mp_radix_size.c +++ b/libtommath/bn_mp_radix_size.c @@ -16,59 +16,59 @@ */ /* returns size of ASCII reprensentation */ -int mp_radix_size (mp_int * a, int radix, int *size) +int mp_radix_size(mp_int *a, int radix, int *size) { - int res, digs; - mp_int t; - mp_digit d; + int res, digs; + mp_int t; + mp_digit d; - *size = 0; + *size = 0; - /* make sure the radix is in range */ - if ((radix < 2) || (radix > 64)) { - return MP_VAL; - } + /* make sure the radix is in range */ + if ((radix < 2) || (radix > 64)) { + return MP_VAL; + } - if (mp_iszero(a) == MP_YES) { - *size = 2; - return MP_OKAY; - } + if (mp_iszero(a) == MP_YES) { + *size = 2; + return MP_OKAY; + } - /* special case for binary */ - if (radix == 2) { - *size = mp_count_bits (a) + ((a->sign == MP_NEG) ? 1 : 0) + 1; - return MP_OKAY; - } + /* special case for binary */ + if (radix == 2) { + *size = mp_count_bits(a) + ((a->sign == MP_NEG) ? 1 : 0) + 1; + return MP_OKAY; + } - /* digs is the digit count */ - digs = 0; + /* digs is the digit count */ + digs = 0; - /* if it's negative add one for the sign */ - if (a->sign == MP_NEG) { - ++digs; - } + /* if it's negative add one for the sign */ + if (a->sign == MP_NEG) { + ++digs; + } - /* init a copy of the input */ - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } + /* init a copy of the input */ + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } - /* force temp to positive */ - t.sign = MP_ZPOS; + /* force temp to positive */ + t.sign = MP_ZPOS; - /* fetch out all of the digits */ - while (mp_iszero (&t) == MP_NO) { - if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { - mp_clear (&t); - return res; - } - ++digs; - } - mp_clear (&t); + /* fetch out all of the digits */ + while (mp_iszero(&t) == MP_NO) { + if ((res = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) { + mp_clear(&t); + return res; + } + ++digs; + } + mp_clear(&t); - /* return digs + 1, the 1 is for the NULL byte that would be required. */ - *size = digs + 1; - return MP_OKAY; + /* return digs + 1, the 1 is for the NULL byte that would be required. */ + *size = digs + 1; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c index 93e255a..92a9a97 100644 --- a/libtommath/bn_mp_rand.c +++ b/libtommath/bn_mp_rand.c @@ -16,13 +16,13 @@ */ #if MP_GEN_RANDOM_MAX == 0xffffffff - #define MP_GEN_RANDOM_SHIFT 32 +#define MP_GEN_RANDOM_SHIFT 32 #elif MP_GEN_RANDOM_MAX == 32767 - /* SHRT_MAX */ - #define MP_GEN_RANDOM_SHIFT 15 +/* SHRT_MAX */ +#define MP_GEN_RANDOM_SHIFT 15 #elif MP_GEN_RANDOM_MAX == 2147483647 - /* INT_MAX */ - #define MP_GEN_RANDOM_SHIFT 31 +/* INT_MAX */ +#define MP_GEN_RANDOM_SHIFT 31 #elif !defined(MP_GEN_RANDOM_SHIFT) #error Thou shalt define their own valid MP_GEN_RANDOM_SHIFT #endif @@ -30,48 +30,47 @@ /* makes a pseudo-random int of a given size */ static mp_digit s_gen_random(void) { - mp_digit d = 0, msk = 0; - do { - d <<= MP_GEN_RANDOM_SHIFT; - d |= ((mp_digit) MP_GEN_RANDOM()); - msk <<= MP_GEN_RANDOM_SHIFT; - msk |= (MP_MASK & MP_GEN_RANDOM_MAX); - } while ((MP_MASK & msk) != MP_MASK); - d &= MP_MASK; - return d; + mp_digit d = 0, msk = 0; + do { + d <<= MP_GEN_RANDOM_SHIFT; + d |= ((mp_digit) MP_GEN_RANDOM()); + msk <<= MP_GEN_RANDOM_SHIFT; + msk |= (MP_MASK & MP_GEN_RANDOM_MAX); + } while ((MP_MASK & msk) != MP_MASK); + d &= MP_MASK; + return d; } -int -mp_rand (mp_int * a, int digits) +int mp_rand(mp_int *a, int digits) { - int res; - mp_digit d; + int res; + mp_digit d; - mp_zero (a); - if (digits <= 0) { - return MP_OKAY; - } + mp_zero(a); + if (digits <= 0) { + return MP_OKAY; + } - /* first place a random non-zero digit */ - do { - d = s_gen_random(); - } while (d == 0); + /* first place a random non-zero digit */ + do { + d = s_gen_random(); + } while (d == 0); - if ((res = mp_add_d (a, d, a)) != MP_OKAY) { - return res; - } - - while (--digits > 0) { - if ((res = mp_lshd (a, 1)) != MP_OKAY) { + if ((res = mp_add_d(a, d, a)) != MP_OKAY) { return res; - } + } - if ((res = mp_add_d (a, s_gen_random(), a)) != MP_OKAY) { - return res; - } - } + while (--digits > 0) { + if ((res = mp_lshd(a, 1)) != MP_OKAY) { + return res; + } + + if ((res = mp_add_d(a, s_gen_random(), a)) != MP_OKAY) { + return res; + } + } - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index 12aa499..bc31cc5 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -16,73 +16,73 @@ */ /* read a string [ASCII] in a given radix */ -int mp_read_radix (mp_int * a, const char *str, int radix) +int mp_read_radix(mp_int *a, const char *str, int radix) { - int y, res, neg; - char ch; + int y, res, neg; + char ch; - /* zero the digit bignum */ - mp_zero(a); + /* zero the digit bignum */ + mp_zero(a); - /* make sure the radix is ok */ - if ((radix < 2) || (radix > 64)) { - return MP_VAL; - } + /* make sure the radix is ok */ + if ((radix < 2) || (radix > 64)) { + return MP_VAL; + } - /* if the leading digit is a - * minus set the sign to negative. - */ - if (*str == '-') { - ++str; - neg = MP_NEG; - } else { - neg = MP_ZPOS; - } + /* if the leading digit is a + * minus set the sign to negative. + */ + if (*str == '-') { + ++str; + neg = MP_NEG; + } else { + neg = MP_ZPOS; + } - /* set the integer to the default of zero */ - mp_zero (a); - - /* process each digit of the string */ - while (*str != '\0') { - /* if the radix <= 36 the conversion is case insensitive - * this allows numbers like 1AB and 1ab to represent the same value - * [e.g. in hex] - */ - ch = (radix <= 36) ? (char)toupper((int)*str) : *str; - for (y = 0; y < 64; y++) { - if (ch == mp_s_rmap[y]) { - break; - } - } + /* set the integer to the default of zero */ + mp_zero(a); - /* if the char was found in the map - * and is less than the given radix add it - * to the number, otherwise exit the loop. - */ - if (y < radix) { - if ((res = mp_mul_d (a, (mp_digit) radix, a)) != MP_OKAY) { - return res; + /* process each digit of the string */ + while (*str != '\0') { + /* if the radix <= 36 the conversion is case insensitive + * this allows numbers like 1AB and 1ab to represent the same value + * [e.g. in hex] + */ + ch = (radix <= 36) ? (char)toupper((int)*str) : *str; + for (y = 0; y < 64; y++) { + if (ch == mp_s_rmap[y]) { + break; + } } - if ((res = mp_add_d (a, (mp_digit) y, a)) != MP_OKAY) { - return res; + + /* if the char was found in the map + * and is less than the given radix add it + * to the number, otherwise exit the loop. + */ + if (y < radix) { + if ((res = mp_mul_d(a, (mp_digit)radix, a)) != MP_OKAY) { + return res; + } + if ((res = mp_add_d(a, (mp_digit)y, a)) != MP_OKAY) { + return res; + } + } else { + break; } - } else { - break; - } - ++str; - } + ++str; + } - /* if an illegal character was found, fail. */ - if (!(*str == '\0' || *str == '\r' || *str == '\n')) { + /* if an illegal character was found, fail. */ + if (!(*str == '\0' || *str == '\r' || *str == '\n')) { mp_zero(a); return MP_VAL; - } + } - /* set the sign only if a != 0 */ - if (mp_iszero(a) != MP_YES) { - a->sign = neg; - } - return MP_OKAY; + /* set the sign only if a != 0 */ + if (mp_iszero(a) != MP_YES) { + a->sign = neg; + } + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_read_signed_bin.c b/libtommath/bn_mp_read_signed_bin.c index 363e11f..eabc803 100644 --- a/libtommath/bn_mp_read_signed_bin.c +++ b/libtommath/bn_mp_read_signed_bin.c @@ -16,23 +16,23 @@ */ /* read signed bin, big endian, first byte is 0==positive or 1==negative */ -int mp_read_signed_bin (mp_int * a, const unsigned char *b, int c) +int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c) { - int res; + int res; - /* read magnitude */ - if ((res = mp_read_unsigned_bin (a, b + 1, c - 1)) != MP_OKAY) { - return res; - } + /* read magnitude */ + if ((res = mp_read_unsigned_bin(a, b + 1, c - 1)) != MP_OKAY) { + return res; + } - /* first byte is 0 for positive, non-zero for negative */ - if (b[0] == 0) { - a->sign = MP_ZPOS; - } else { - a->sign = MP_NEG; - } + /* first byte is 0 for positive, non-zero for negative */ + if (b[0] == 0) { + a->sign = MP_ZPOS; + } else { + a->sign = MP_NEG; + } - return MP_OKAY; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_read_unsigned_bin.c b/libtommath/bn_mp_read_unsigned_bin.c index 1a50b58..ad9f05f 100644 --- a/libtommath/bn_mp_read_unsigned_bin.c +++ b/libtommath/bn_mp_read_unsigned_bin.c @@ -16,37 +16,37 @@ */ /* reads a unsigned char array, assumes the msb is stored first [big endian] */ -int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c) +int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c) { - int res; + int res; - /* make sure there are at least two digits */ - if (a->alloc < 2) { - if ((res = mp_grow(a, 2)) != MP_OKAY) { - return res; - } - } + /* make sure there are at least two digits */ + if (a->alloc < 2) { + if ((res = mp_grow(a, 2)) != MP_OKAY) { + return res; + } + } - /* zero the int */ - mp_zero (a); + /* zero the int */ + mp_zero(a); - /* read the bytes in */ - while (c-- > 0) { - if ((res = mp_mul_2d (a, 8, a)) != MP_OKAY) { - return res; - } + /* read the bytes in */ + while (c-- > 0) { + if ((res = mp_mul_2d(a, 8, a)) != MP_OKAY) { + return res; + } #ifndef MP_8BIT - a->dp[0] |= *b++; - a->used += 1; + a->dp[0] |= *b++; + a->used += 1; #else - a->dp[0] = (*b & MP_MASK); - a->dp[1] |= ((*b++ >> 7U) & 1); - a->used += 2; + a->dp[0] = (*b & MP_MASK); + a->dp[1] |= ((*b++ >> 7U) & 1); + a->used += 2; #endif - } - mp_clamp (a); - return MP_OKAY; + } + mp_clamp(a); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c index 367383f..a2b9bf7 100644 --- a/libtommath/bn_mp_reduce.c +++ b/libtommath/bn_mp_reduce.c @@ -19,79 +19,79 @@ * precomputed via mp_reduce_setup. * From HAC pp.604 Algorithm 14.42 */ -int mp_reduce (mp_int * x, mp_int * m, mp_int * mu) +int mp_reduce(mp_int *x, mp_int *m, mp_int *mu) { - mp_int q; - int res, um = m->used; + mp_int q; + int res, um = m->used; - /* q = x */ - if ((res = mp_init_copy (&q, x)) != MP_OKAY) { - return res; - } + /* q = x */ + if ((res = mp_init_copy(&q, x)) != MP_OKAY) { + return res; + } - /* q1 = x / b**(k-1) */ - mp_rshd (&q, um - 1); + /* q1 = x / b**(k-1) */ + mp_rshd(&q, um - 1); - /* according to HAC this optimization is ok */ - if (((mp_digit) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) { - if ((res = mp_mul (&q, mu, &q)) != MP_OKAY) { - goto CLEANUP; - } - } else { + /* according to HAC this optimization is ok */ + if (((mp_digit) um) > (((mp_digit)1) << (DIGIT_BIT - 1))) { + if ((res = mp_mul(&q, mu, &q)) != MP_OKAY) { + goto CLEANUP; + } + } else { #ifdef BN_S_MP_MUL_HIGH_DIGS_C - if ((res = s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) { - goto CLEANUP; - } + if ((res = s_mp_mul_high_digs(&q, mu, &q, um)) != MP_OKAY) { + goto CLEANUP; + } #elif defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C) - if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) { - goto CLEANUP; - } + if ((res = fast_s_mp_mul_high_digs(&q, mu, &q, um)) != MP_OKAY) { + goto CLEANUP; + } #else - { - res = MP_VAL; - goto CLEANUP; - } + { + res = MP_VAL; + goto CLEANUP; + } #endif - } - - /* q3 = q2 / b**(k+1) */ - mp_rshd (&q, um + 1); + } - /* x = x mod b**(k+1), quick (no division) */ - if ((res = mp_mod_2d (x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) { - goto CLEANUP; - } + /* q3 = q2 / b**(k+1) */ + mp_rshd(&q, um + 1); - /* q = q * m mod b**(k+1), quick (no division) */ - if ((res = s_mp_mul_digs (&q, m, &q, um + 1)) != MP_OKAY) { - goto CLEANUP; - } - - /* x = x - q */ - if ((res = mp_sub (x, &q, x)) != MP_OKAY) { - goto CLEANUP; - } - - /* If x < 0, add b**(k+1) to it */ - if (mp_cmp_d (x, 0) == MP_LT) { - mp_set (&q, 1); - if ((res = mp_lshd (&q, um + 1)) != MP_OKAY) + /* x = x mod b**(k+1), quick (no division) */ + if ((res = mp_mod_2d(x, DIGIT_BIT * (um + 1), x)) != MP_OKAY) { goto CLEANUP; - if ((res = mp_add (x, &q, x)) != MP_OKAY) + } + + /* q = q * m mod b**(k+1), quick (no division) */ + if ((res = s_mp_mul_digs(&q, m, &q, um + 1)) != MP_OKAY) { goto CLEANUP; - } + } - /* Back off if it's too big */ - while (mp_cmp (x, m) != MP_LT) { - if ((res = s_mp_sub (x, m, x)) != MP_OKAY) { + /* x = x - q */ + if ((res = mp_sub(x, &q, x)) != MP_OKAY) { goto CLEANUP; - } - } + } + + /* If x < 0, add b**(k+1) to it */ + if (mp_cmp_d(x, 0) == MP_LT) { + mp_set(&q, 1); + if ((res = mp_lshd(&q, um + 1)) != MP_OKAY) + goto CLEANUP; + if ((res = mp_add(x, &q, x)) != MP_OKAY) + goto CLEANUP; + } + + /* Back off if it's too big */ + while (mp_cmp(x, m) != MP_LT) { + if ((res = s_mp_sub(x, m, x)) != MP_OKAY) { + goto CLEANUP; + } + } CLEANUP: - mp_clear (&q); + mp_clear(&q); - return res; + return res; } #endif diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c index bf810c0..802a5ba 100644 --- a/libtommath/bn_mp_reduce_2k_setup.c +++ b/libtommath/bn_mp_reduce_2k_setup.c @@ -20,22 +20,22 @@ int mp_reduce_2k_setup(mp_int *a, mp_digit *d) { int res, p; mp_int tmp; - + if ((res = mp_init(&tmp)) != MP_OKAY) { return res; } - + p = mp_count_bits(a); if ((res = mp_2expt(&tmp, p)) != MP_OKAY) { mp_clear(&tmp); return res; } - + if ((res = s_mp_sub(&tmp, a, &tmp)) != MP_OKAY) { mp_clear(&tmp); return res; } - + *d = tmp.dp[0]; mp_clear(&tmp); return MP_OKAY; diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c index 56d1ba8..34367ed 100644 --- a/libtommath/bn_mp_reduce_2k_setup_l.c +++ b/libtommath/bn_mp_reduce_2k_setup_l.c @@ -20,19 +20,19 @@ int mp_reduce_2k_setup_l(mp_int *a, mp_int *d) { int res; mp_int tmp; - + if ((res = mp_init(&tmp)) != MP_OKAY) { return res; } - + if ((res = mp_2expt(&tmp, mp_count_bits(a))) != MP_OKAY) { goto ERR; } - + if ((res = s_mp_sub(&tmp, a, d)) != MP_OKAY) { goto ERR; } - + ERR: mp_clear(&tmp); return res; diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c index 0499e83..c733ca9 100644 --- a/libtommath/bn_mp_reduce_is_2k.c +++ b/libtommath/bn_mp_reduce_is_2k.c @@ -20,7 +20,7 @@ int mp_reduce_is_2k(mp_int *a) { int ix, iy, iw; mp_digit iz; - + if (a->used == 0) { return MP_NO; } else if (a->used == 1) { @@ -29,17 +29,17 @@ int mp_reduce_is_2k(mp_int *a) iy = mp_count_bits(a); iz = 1; iw = 1; - + /* Test every bit from the second digit up, must be 1 */ for (ix = DIGIT_BIT; ix < iy; ix++) { - if ((a->dp[iw] & iz) == 0) { - return MP_NO; - } - iz <<= 1; - if (iz > (mp_digit)MP_MASK) { - ++iw; - iz = 1; - } + if ((a->dp[iw] & iz) == 0) { + return MP_NO; + } + iz <<= 1; + if (iz > (mp_digit)MP_MASK) { + ++iw; + iz = 1; + } } } return MP_YES; diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index 48b3498..d4804d5 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -19,7 +19,7 @@ int mp_reduce_is_2k_l(mp_int *a) { int ix, iy; - + if (a->used == 0) { return MP_NO; } else if (a->used == 1) { @@ -27,12 +27,12 @@ int mp_reduce_is_2k_l(mp_int *a) } else if (a->used > 1) { /* if more than half of the digits are -1 we're sold */ for (iy = ix = 0; ix < a->used; ix++) { - if (a->dp[ix] == MP_MASK) { - ++iy; - } + if (a->dp[ix] == MP_MASK) { + ++iy; + } } return (iy >= (a->used/2)) ? MP_YES : MP_NO; - + } return MP_NO; } diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c index 8875698..00ff61c 100644 --- a/libtommath/bn_mp_reduce_setup.c +++ b/libtommath/bn_mp_reduce_setup.c @@ -18,14 +18,14 @@ /* pre-calculate the value required for Barrett reduction * For a given modulus "b" it calulates the value required in "a" */ -int mp_reduce_setup (mp_int * a, mp_int * b) +int mp_reduce_setup(mp_int *a, mp_int *b) { - int res; - - if ((res = mp_2expt (a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) { - return res; - } - return mp_div (a, b, a, NULL); + int res; + + if ((res = mp_2expt(a, b->used * 2 * DIGIT_BIT)) != MP_OKAY) { + return res; + } + return mp_div(a, b, a, NULL); } #endif diff --git a/libtommath/bn_mp_rshd.c b/libtommath/bn_mp_rshd.c index 4b598de..fd06735 100644 --- a/libtommath/bn_mp_rshd.c +++ b/libtommath/bn_mp_rshd.c @@ -16,54 +16,54 @@ */ /* shift right a certain amount of digits */ -void mp_rshd (mp_int * a, int b) +void mp_rshd(mp_int *a, int b) { - int x; + int x; - /* if b <= 0 then ignore it */ - if (b <= 0) { - return; - } + /* if b <= 0 then ignore it */ + if (b <= 0) { + return; + } - /* if b > used then simply zero it and return */ - if (a->used <= b) { - mp_zero (a); - return; - } + /* if b > used then simply zero it and return */ + if (a->used <= b) { + mp_zero(a); + return; + } - { - mp_digit *bottom, *top; + { + mp_digit *bottom, *top; - /* shift the digits down */ + /* shift the digits down */ - /* bottom */ - bottom = a->dp; + /* bottom */ + bottom = a->dp; - /* top [offset into digits] */ - top = a->dp + b; + /* top [offset into digits] */ + top = a->dp + b; - /* this is implemented as a sliding window where - * the window is b-digits long and digits from - * the top of the window are copied to the bottom - * - * e.g. + /* this is implemented as a sliding window where + * the window is b-digits long and digits from + * the top of the window are copied to the bottom + * + * e.g. - b-2 | b-1 | b0 | b1 | b2 | ... | bb | ----> - /\ | ----> - \-------------------/ ----> - */ - for (x = 0; x < (a->used - b); x++) { - *bottom++ = *top++; - } + b-2 | b-1 | b0 | b1 | b2 | ... | bb | ----> + /\ | ----> + \-------------------/ ----> + */ + for (x = 0; x < (a->used - b); x++) { + *bottom++ = *top++; + } - /* zero the top digits */ - for (; x < a->used; x++) { - *bottom++ = 0; - } - } - - /* remove excess digits */ - a->used -= b; + /* zero the top digits */ + for (; x < a->used; x++) { + *bottom++ = 0; + } + } + + /* remove excess digits */ + a->used -= b; } #endif diff --git a/libtommath/bn_mp_set.c b/libtommath/bn_mp_set.c index dd4de3c..eaf7fed 100644 --- a/libtommath/bn_mp_set.c +++ b/libtommath/bn_mp_set.c @@ -16,11 +16,11 @@ */ /* set to a digit */ -void mp_set (mp_int * a, mp_digit b) +void mp_set(mp_int *a, mp_digit b) { - mp_zero (a); - a->dp[0] = b & MP_MASK; - a->used = (a->dp[0] != 0) ? 1 : 0; + mp_zero(a); + a->dp[0] = b & MP_MASK; + a->used = (a->dp[0] != 0) ? 1 : 0; } #endif diff --git a/libtommath/bn_mp_set_int.c b/libtommath/bn_mp_set_int.c index 3aafec9..4c71180 100644 --- a/libtommath/bn_mp_set_int.c +++ b/libtommath/bn_mp_set_int.c @@ -16,30 +16,30 @@ */ /* set a 32-bit const */ -int mp_set_int (mp_int * a, unsigned long b) +int mp_set_int(mp_int *a, unsigned long b) { - int x, res; + int x, res; - mp_zero (a); - - /* set four bits at a time */ - for (x = 0; x < 8; x++) { - /* shift the number up four bits */ - if ((res = mp_mul_2d (a, 4, a)) != MP_OKAY) { - return res; - } + mp_zero(a); - /* OR in the top four bits of the source */ - a->dp[0] |= (b >> 28) & 15; + /* set four bits at a time */ + for (x = 0; x < 8; x++) { + /* shift the number up four bits */ + if ((res = mp_mul_2d(a, 4, a)) != MP_OKAY) { + return res; + } - /* shift the source up to the next four bits */ - b <<= 4; + /* OR in the top four bits of the source */ + a->dp[0] |= (b >> 28) & 15; - /* ensure that digits are not clamped off */ - a->used += 1; - } - mp_clamp (a); - return MP_OKAY; + /* shift the source up to the next four bits */ + b <<= 4; + + /* ensure that digits are not clamped off */ + a->used += 1; + } + mp_clamp(a); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_shrink.c b/libtommath/bn_mp_shrink.c index 0712c2b..8ac1f33 100644 --- a/libtommath/bn_mp_shrink.c +++ b/libtommath/bn_mp_shrink.c @@ -16,23 +16,23 @@ */ /* shrink a bignum */ -int mp_shrink (mp_int * a) +int mp_shrink(mp_int *a) { - mp_digit *tmp; - int used = 1; - - if(a->used > 0) { - used = a->used; - } - - if (a->alloc != used) { - if ((tmp = OPT_CAST(mp_digit) XREALLOC (a->dp, sizeof (mp_digit) * used)) == NULL) { - return MP_MEM; - } - a->dp = tmp; - a->alloc = used; - } - return MP_OKAY; + mp_digit *tmp; + int used = 1; + + if (a->used > 0) { + used = a->used; + } + + if (a->alloc != used) { + if ((tmp = OPT_CAST(mp_digit) XREALLOC(a->dp, sizeof(mp_digit) * used)) == NULL) { + return MP_MEM; + } + a->dp = tmp; + a->alloc = used; + } + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c index 0910333..082aeca 100644 --- a/libtommath/bn_mp_signed_bin_size.c +++ b/libtommath/bn_mp_signed_bin_size.c @@ -16,9 +16,9 @@ */ /* get the size for an signed equivalent */ -int mp_signed_bin_size (mp_int * a) +int mp_signed_bin_size(mp_int *a) { - return 1 + mp_unsigned_bin_size (a); + return 1 + mp_unsigned_bin_size(a); } #endif diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index ffe94e2..e2e8641 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -16,42 +16,41 @@ */ /* computes b = a*a */ -int -mp_sqr (mp_int * a, mp_int * b) +int mp_sqr(mp_int *a, mp_int *b) { - int res; + int res; #ifdef BN_MP_TOOM_SQR_C - /* use Toom-Cook? */ - if (a->used >= TOOM_SQR_CUTOFF) { - res = mp_toom_sqr(a, b); - /* Karatsuba? */ - } else + /* use Toom-Cook? */ + if (a->used >= TOOM_SQR_CUTOFF) { + res = mp_toom_sqr(a, b); + /* Karatsuba? */ + } else #endif #ifdef BN_MP_KARATSUBA_SQR_C - if (a->used >= KARATSUBA_SQR_CUTOFF) { - res = mp_karatsuba_sqr (a, b); - } else + if (a->used >= KARATSUBA_SQR_CUTOFF) { + res = mp_karatsuba_sqr(a, b); + } else #endif - { + { #ifdef BN_FAST_S_MP_SQR_C - /* can we use the fast comba multiplier? */ - if ((((a->used * 2) + 1) < MP_WARRAY) && - (a->used < - (1 << (((sizeof(mp_word) * CHAR_BIT) - (2 * DIGIT_BIT)) - 1)))) { - res = fast_s_mp_sqr (a, b); - } else + /* can we use the fast comba multiplier? */ + if ((((a->used * 2) + 1) < MP_WARRAY) && + (a->used < + (1 << (((sizeof(mp_word) * CHAR_BIT) - (2 * DIGIT_BIT)) - 1)))) { + res = fast_s_mp_sqr(a, b); + } else #endif - { + { #ifdef BN_S_MP_SQR_C - res = s_mp_sqr (a, b); + res = s_mp_sqr(a, b); #else - res = MP_VAL; + res = MP_VAL; #endif - } - } - b->sign = MP_ZPOS; - return res; + } + } + b->sign = MP_ZPOS; + return res; } #endif diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index 3b29fbc..96a7574 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -16,23 +16,22 @@ */ /* c = a * a (mod b) */ -int -mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) +int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c) { - int res; - mp_int t; + int res; + mp_int t; - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } + if ((res = mp_init(&t)) != MP_OKAY) { + return res; + } - if ((res = mp_sqr (a, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, b, c); - mp_clear (&t); - return res; + if ((res = mp_sqr(a, &t)) != MP_OKAY) { + mp_clear(&t); + return res; + } + res = mp_mod(&t, b, c); + mp_clear(&t); + return res; } #endif diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index d3b5d62..95a6892 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -16,62 +16,64 @@ */ /* this function is less generic than mp_n_root, simpler and faster */ -int mp_sqrt(mp_int *arg, mp_int *ret) +int mp_sqrt(mp_int *arg, mp_int *ret) { - int res; - mp_int t1,t2; + int res; + mp_int t1, t2; - /* must be positive */ - if (arg->sign == MP_NEG) { - return MP_VAL; - } + /* must be positive */ + if (arg->sign == MP_NEG) { + return MP_VAL; + } - /* easy out */ - if (mp_iszero(arg) == MP_YES) { - mp_zero(ret); - return MP_OKAY; - } + /* easy out */ + if (mp_iszero(arg) == MP_YES) { + mp_zero(ret); + return MP_OKAY; + } - if ((res = mp_init_copy(&t1, arg)) != MP_OKAY) { - return res; - } + if ((res = mp_init_copy(&t1, arg)) != MP_OKAY) { + return res; + } - if ((res = mp_init(&t2)) != MP_OKAY) { - goto E2; - } + if ((res = mp_init(&t2)) != MP_OKAY) { + goto E2; + } - /* First approx. (not very bad for large arg) */ - mp_rshd (&t1,t1.used/2); + /* First approx. (not very bad for large arg) */ + mp_rshd(&t1, t1.used/2); - /* t1 > 0 */ - if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) { - goto E1; - } - if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) { - goto E1; - } - if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) { - goto E1; - } - /* And now t1 > sqrt(arg) */ - do { - if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) { + /* t1 > 0 */ + if ((res = mp_div(arg, &t1, &t2, NULL)) != MP_OKAY) { goto E1; - } - if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) { + } + if ((res = mp_add(&t1, &t2, &t1)) != MP_OKAY) { goto E1; - } - if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) { + } + if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) { goto E1; - } - /* t1 >= sqrt(arg) >= t2 at this point */ - } while (mp_cmp_mag(&t1,&t2) == MP_GT); + } + /* And now t1 > sqrt(arg) */ + do { + if ((res = mp_div(arg, &t1, &t2, NULL)) != MP_OKAY) { + goto E1; + } + if ((res = mp_add(&t1, &t2, &t1)) != MP_OKAY) { + goto E1; + } + if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) { + goto E1; + } + /* t1 >= sqrt(arg) >= t2 at this point */ + } while (mp_cmp_mag(&t1, &t2) == MP_GT); - mp_exch(&t1,ret); + mp_exch(&t1, ret); -E1: mp_clear(&t2); -E2: mp_clear(&t1); - return res; +E1: + mp_clear(&t2); +E2: + mp_clear(&t1); + return res; } #endif diff --git a/libtommath/bn_mp_sqrtmod_prime.c b/libtommath/bn_mp_sqrtmod_prime.c index 968729e..12b427c 100644 --- a/libtommath/bn_mp_sqrtmod_prime.c +++ b/libtommath/bn_mp_sqrtmod_prime.c @@ -17,108 +17,108 @@ int mp_sqrtmod_prime(mp_int *n, mp_int *prime, mp_int *ret) { - int res, legendre; - mp_int t1, C, Q, S, Z, M, T, R, two; - mp_digit i; + int res, legendre; + mp_int t1, C, Q, S, Z, M, T, R, two; + mp_digit i; - /* first handle the simple cases */ - if (mp_cmp_d(n, 0) == MP_EQ) { - mp_zero(ret); - return MP_OKAY; - } - if (mp_cmp_d(prime, 2) == MP_EQ) return MP_VAL; /* prime must be odd */ - if ((res = mp_jacobi(n, prime, &legendre)) != MP_OKAY) return res; - if (legendre == -1) return MP_VAL; /* quadratic non-residue mod prime */ + /* first handle the simple cases */ + if (mp_cmp_d(n, 0) == MP_EQ) { + mp_zero(ret); + return MP_OKAY; + } + if (mp_cmp_d(prime, 2) == MP_EQ) return MP_VAL; /* prime must be odd */ + if ((res = mp_jacobi(n, prime, &legendre)) != MP_OKAY) return res; + if (legendre == -1) return MP_VAL; /* quadratic non-residue mod prime */ - if ((res = mp_init_multi(&t1, &C, &Q, &S, &Z, &M, &T, &R, &two, NULL)) != MP_OKAY) { - return res; - } + if ((res = mp_init_multi(&t1, &C, &Q, &S, &Z, &M, &T, &R, &two, NULL)) != MP_OKAY) { + return res; + } - /* SPECIAL CASE: if prime mod 4 == 3 - * compute directly: res = n^(prime+1)/4 mod prime - * Handbook of Applied Cryptography algorithm 3.36 - */ - if ((res = mp_mod_d(prime, 4, &i)) != MP_OKAY) goto cleanup; - if (i == 3) { - if ((res = mp_add_d(prime, 1, &t1)) != MP_OKAY) goto cleanup; - if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) goto cleanup; - if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) goto cleanup; - if ((res = mp_exptmod(n, &t1, prime, ret)) != MP_OKAY) goto cleanup; - res = MP_OKAY; - goto cleanup; - } + /* SPECIAL CASE: if prime mod 4 == 3 + * compute directly: res = n^(prime+1)/4 mod prime + * Handbook of Applied Cryptography algorithm 3.36 + */ + if ((res = mp_mod_d(prime, 4, &i)) != MP_OKAY) goto cleanup; + if (i == 3) { + if ((res = mp_add_d(prime, 1, &t1)) != MP_OKAY) goto cleanup; + if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) goto cleanup; + if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) goto cleanup; + if ((res = mp_exptmod(n, &t1, prime, ret)) != MP_OKAY) goto cleanup; + res = MP_OKAY; + goto cleanup; + } - /* NOW: Tonelli-Shanks algorithm */ + /* NOW: Tonelli-Shanks algorithm */ - /* factor out powers of 2 from prime-1, defining Q and S as: prime-1 = Q*2^S */ - if ((res = mp_copy(prime, &Q)) != MP_OKAY) goto cleanup; - if ((res = mp_sub_d(&Q, 1, &Q)) != MP_OKAY) goto cleanup; - /* Q = prime - 1 */ - mp_zero(&S); - /* S = 0 */ - while (mp_iseven(&Q) != MP_NO) { - if ((res = mp_div_2(&Q, &Q)) != MP_OKAY) goto cleanup; - /* Q = Q / 2 */ - if ((res = mp_add_d(&S, 1, &S)) != MP_OKAY) goto cleanup; - /* S = S + 1 */ - } + /* factor out powers of 2 from prime-1, defining Q and S as: prime-1 = Q*2^S */ + if ((res = mp_copy(prime, &Q)) != MP_OKAY) goto cleanup; + if ((res = mp_sub_d(&Q, 1, &Q)) != MP_OKAY) goto cleanup; + /* Q = prime - 1 */ + mp_zero(&S); + /* S = 0 */ + while (mp_iseven(&Q) != MP_NO) { + if ((res = mp_div_2(&Q, &Q)) != MP_OKAY) goto cleanup; + /* Q = Q / 2 */ + if ((res = mp_add_d(&S, 1, &S)) != MP_OKAY) goto cleanup; + /* S = S + 1 */ + } - /* find a Z such that the Legendre symbol (Z|prime) == -1 */ - if ((res = mp_set_int(&Z, 2)) != MP_OKAY) goto cleanup; - /* Z = 2 */ - while(1) { - if ((res = mp_jacobi(&Z, prime, &legendre)) != MP_OKAY) goto cleanup; - if (legendre == -1) break; - if ((res = mp_add_d(&Z, 1, &Z)) != MP_OKAY) goto cleanup; - /* Z = Z + 1 */ - } + /* find a Z such that the Legendre symbol (Z|prime) == -1 */ + if ((res = mp_set_int(&Z, 2)) != MP_OKAY) goto cleanup; + /* Z = 2 */ + while (1) { + if ((res = mp_jacobi(&Z, prime, &legendre)) != MP_OKAY) goto cleanup; + if (legendre == -1) break; + if ((res = mp_add_d(&Z, 1, &Z)) != MP_OKAY) goto cleanup; + /* Z = Z + 1 */ + } - if ((res = mp_exptmod(&Z, &Q, prime, &C)) != MP_OKAY) goto cleanup; - /* C = Z ^ Q mod prime */ - if ((res = mp_add_d(&Q, 1, &t1)) != MP_OKAY) goto cleanup; - if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) goto cleanup; - /* t1 = (Q + 1) / 2 */ - if ((res = mp_exptmod(n, &t1, prime, &R)) != MP_OKAY) goto cleanup; - /* R = n ^ ((Q + 1) / 2) mod prime */ - if ((res = mp_exptmod(n, &Q, prime, &T)) != MP_OKAY) goto cleanup; - /* T = n ^ Q mod prime */ - if ((res = mp_copy(&S, &M)) != MP_OKAY) goto cleanup; - /* M = S */ - if ((res = mp_set_int(&two, 2)) != MP_OKAY) goto cleanup; + if ((res = mp_exptmod(&Z, &Q, prime, &C)) != MP_OKAY) goto cleanup; + /* C = Z ^ Q mod prime */ + if ((res = mp_add_d(&Q, 1, &t1)) != MP_OKAY) goto cleanup; + if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) goto cleanup; + /* t1 = (Q + 1) / 2 */ + if ((res = mp_exptmod(n, &t1, prime, &R)) != MP_OKAY) goto cleanup; + /* R = n ^ ((Q + 1) / 2) mod prime */ + if ((res = mp_exptmod(n, &Q, prime, &T)) != MP_OKAY) goto cleanup; + /* T = n ^ Q mod prime */ + if ((res = mp_copy(&S, &M)) != MP_OKAY) goto cleanup; + /* M = S */ + if ((res = mp_set_int(&two, 2)) != MP_OKAY) goto cleanup; - res = MP_VAL; - while (1) { - if ((res = mp_copy(&T, &t1)) != MP_OKAY) goto cleanup; - i = 0; - while (1) { - if (mp_cmp_d(&t1, 1) == MP_EQ) break; - if ((res = mp_exptmod(&t1, &two, prime, &t1)) != MP_OKAY) goto cleanup; - i++; - } - if (i == 0) { - if ((res = mp_copy(&R, ret)) != MP_OKAY) goto cleanup; - res = MP_OKAY; - goto cleanup; - } - if ((res = mp_sub_d(&M, i, &t1)) != MP_OKAY) goto cleanup; - if ((res = mp_sub_d(&t1, 1, &t1)) != MP_OKAY) goto cleanup; - if ((res = mp_exptmod(&two, &t1, prime, &t1)) != MP_OKAY) goto cleanup; - /* t1 = 2 ^ (M - i - 1) */ - if ((res = mp_exptmod(&C, &t1, prime, &t1)) != MP_OKAY) goto cleanup; - /* t1 = C ^ (2 ^ (M - i - 1)) mod prime */ - if ((res = mp_sqrmod(&t1, prime, &C)) != MP_OKAY) goto cleanup; - /* C = (t1 * t1) mod prime */ - if ((res = mp_mulmod(&R, &t1, prime, &R)) != MP_OKAY) goto cleanup; - /* R = (R * t1) mod prime */ - if ((res = mp_mulmod(&T, &C, prime, &T)) != MP_OKAY) goto cleanup; - /* T = (T * C) mod prime */ - mp_set(&M, i); - /* M = i */ - } + res = MP_VAL; + while (1) { + if ((res = mp_copy(&T, &t1)) != MP_OKAY) goto cleanup; + i = 0; + while (1) { + if (mp_cmp_d(&t1, 1) == MP_EQ) break; + if ((res = mp_exptmod(&t1, &two, prime, &t1)) != MP_OKAY) goto cleanup; + i++; + } + if (i == 0) { + if ((res = mp_copy(&R, ret)) != MP_OKAY) goto cleanup; + res = MP_OKAY; + goto cleanup; + } + if ((res = mp_sub_d(&M, i, &t1)) != MP_OKAY) goto cleanup; + if ((res = mp_sub_d(&t1, 1, &t1)) != MP_OKAY) goto cleanup; + if ((res = mp_exptmod(&two, &t1, prime, &t1)) != MP_OKAY) goto cleanup; + /* t1 = 2 ^ (M - i - 1) */ + if ((res = mp_exptmod(&C, &t1, prime, &t1)) != MP_OKAY) goto cleanup; + /* t1 = C ^ (2 ^ (M - i - 1)) mod prime */ + if ((res = mp_sqrmod(&t1, prime, &C)) != MP_OKAY) goto cleanup; + /* C = (t1 * t1) mod prime */ + if ((res = mp_mulmod(&R, &t1, prime, &R)) != MP_OKAY) goto cleanup; + /* R = (R * t1) mod prime */ + if ((res = mp_mulmod(&T, &C, prime, &T)) != MP_OKAY) goto cleanup; + /* T = (T * C) mod prime */ + mp_set(&M, i); + /* M = i */ + } cleanup: - mp_clear_multi(&t1, &C, &Q, &S, &Z, &M, &T, &R, &two, NULL); - return res; + mp_clear_multi(&t1, &C, &Q, &S, &Z, &M, &T, &R, &two, NULL); + return res; } #endif diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index 2f73faa..75c7c2d 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -16,40 +16,39 @@ */ /* high level subtraction (handles signs) */ -int -mp_sub (mp_int * a, mp_int * b, mp_int * c) +int mp_sub(mp_int *a, mp_int *b, mp_int *c) { - int sa, sb, res; + int sa, sb, res; - sa = a->sign; - sb = b->sign; + sa = a->sign; + sb = b->sign; - if (sa != sb) { - /* subtract a negative from a positive, OR */ - /* subtract a positive from a negative. */ - /* In either case, ADD their magnitudes, */ - /* and use the sign of the first number. */ - c->sign = sa; - res = s_mp_add (a, b, c); - } else { - /* subtract a positive from a positive, OR */ - /* subtract a negative from a negative. */ - /* First, take the difference between their */ - /* magnitudes, then... */ - if (mp_cmp_mag (a, b) != MP_LT) { - /* Copy the sign from the first */ + if (sa != sb) { + /* subtract a negative from a positive, OR */ + /* subtract a positive from a negative. */ + /* In either case, ADD their magnitudes, */ + /* and use the sign of the first number. */ c->sign = sa; - /* The first has a larger or equal magnitude */ - res = s_mp_sub (a, b, c); - } else { - /* The result has the *opposite* sign from */ - /* the first number. */ - c->sign = (sa == MP_ZPOS) ? MP_NEG : MP_ZPOS; - /* The second has a larger magnitude */ - res = s_mp_sub (b, a, c); - } - } - return res; + res = s_mp_add(a, b, c); + } else { + /* subtract a positive from a positive, OR */ + /* subtract a negative from a negative. */ + /* First, take the difference between their */ + /* magnitudes, then... */ + if (mp_cmp_mag(a, b) != MP_LT) { + /* Copy the sign from the first */ + c->sign = sa; + /* The first has a larger or equal magnitude */ + res = s_mp_sub(a, b, c); + } else { + /* The result has the *opposite* sign from */ + /* the first number. */ + c->sign = (sa == MP_ZPOS) ? MP_NEG : MP_ZPOS; + /* The second has a larger magnitude */ + res = s_mp_sub(b, a, c); + } + } + return res; } #endif diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index 5e96030..7016abc 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -16,74 +16,73 @@ */ /* single digit subtraction */ -int -mp_sub_d (mp_int * a, mp_digit b, mp_int * c) +int mp_sub_d(mp_int *a, mp_digit b, mp_int *c) { - mp_digit *tmpa, *tmpc, mu; - int res, ix, oldused; + mp_digit *tmpa, *tmpc, mu; + int res, ix, oldused; - /* grow c as required */ - if (c->alloc < (a->used + 1)) { - if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { - return res; - } - } + /* grow c as required */ + if (c->alloc < (a->used + 1)) { + if ((res = mp_grow(c, a->used + 1)) != MP_OKAY) { + return res; + } + } - /* if a is negative just do an unsigned - * addition [with fudged signs] - */ - if (a->sign == MP_NEG) { - a->sign = MP_ZPOS; - res = mp_add_d(a, b, c); - a->sign = c->sign = MP_NEG; + /* if a is negative just do an unsigned + * addition [with fudged signs] + */ + if (a->sign == MP_NEG) { + a->sign = MP_ZPOS; + res = mp_add_d(a, b, c); + a->sign = c->sign = MP_NEG; - /* clamp */ - mp_clamp(c); + /* clamp */ + mp_clamp(c); - return res; - } + return res; + } - /* setup regs */ - oldused = c->used; - tmpa = a->dp; - tmpc = c->dp; + /* setup regs */ + oldused = c->used; + tmpa = a->dp; + tmpc = c->dp; - /* if a <= b simply fix the single digit */ - if (((a->used == 1) && (a->dp[0] <= b)) || (a->used == 0)) { - if (a->used == 1) { - *tmpc++ = b - *tmpa; - } else { - *tmpc++ = b; - } - ix = 1; + /* if a <= b simply fix the single digit */ + if (((a->used == 1) && (a->dp[0] <= b)) || (a->used == 0)) { + if (a->used == 1) { + *tmpc++ = b - *tmpa; + } else { + *tmpc++ = b; + } + ix = 1; - /* negative/1digit */ - c->sign = MP_NEG; - c->used = 1; - } else { - /* positive/size */ - c->sign = MP_ZPOS; - c->used = a->used; + /* negative/1digit */ + c->sign = MP_NEG; + c->used = 1; + } else { + /* positive/size */ + c->sign = MP_ZPOS; + c->used = a->used; - /* subtract first digit */ - *tmpc = *tmpa++ - b; - mu = *tmpc >> ((sizeof(mp_digit) * CHAR_BIT) - 1); - *tmpc++ &= MP_MASK; + /* subtract first digit */ + *tmpc = *tmpa++ - b; + mu = *tmpc >> ((sizeof(mp_digit) * CHAR_BIT) - 1); + *tmpc++ &= MP_MASK; - /* handle rest of the digits */ - for (ix = 1; ix < a->used; ix++) { - *tmpc = *tmpa++ - mu; - mu = *tmpc >> ((sizeof(mp_digit) * CHAR_BIT) - 1); - *tmpc++ &= MP_MASK; - } - } + /* handle rest of the digits */ + for (ix = 1; ix < a->used; ix++) { + *tmpc = *tmpa++ - mu; + mu = *tmpc >> ((sizeof(mp_digit) * CHAR_BIT) - 1); + *tmpc++ &= MP_MASK; + } + } - /* zero excess digits */ - while (ix++ < oldused) { - *tmpc++ = 0; - } - mp_clamp(c); - return MP_OKAY; + /* zero excess digits */ + while (ix++ < oldused) { + *tmpc++ = 0; + } + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index 138863c..510fb19 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -16,24 +16,23 @@ */ /* d = a - b (mod c) */ -int -mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d) +int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) { - int res; - mp_int t; + int res; + mp_int t; - if ((res = mp_init (&t)) != MP_OKAY) { - return res; - } + if ((res = mp_init(&t)) != MP_OKAY) { + return res; + } - if ((res = mp_sub (a, b, &t)) != MP_OKAY) { - mp_clear (&t); - return res; - } - res = mp_mod (&t, c, d); - mp_clear (&t); - return res; + if ((res = mp_sub(a, b, &t)) != MP_OKAY) { + mp_clear(&t); + return res; + } + res = mp_mod(&t, c, d); + mp_clear(&t); + return res; } #endif diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c index c49c87d..615bf32 100644 --- a/libtommath/bn_mp_to_signed_bin.c +++ b/libtommath/bn_mp_to_signed_bin.c @@ -16,15 +16,15 @@ */ /* store in signed [big endian] format */ -int mp_to_signed_bin (mp_int * a, unsigned char *b) +int mp_to_signed_bin(mp_int *a, unsigned char *b) { - int res; + int res; - if ((res = mp_to_unsigned_bin (a, b + 1)) != MP_OKAY) { - return res; - } - b[0] = (a->sign == MP_ZPOS) ? (unsigned char)0 : (unsigned char)1; - return MP_OKAY; + if ((res = mp_to_unsigned_bin(a, b + 1)) != MP_OKAY) { + return res; + } + b[0] = (a->sign == MP_ZPOS) ? (unsigned char)0 : (unsigned char)1; + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c index dc5ec26..501f849 100644 --- a/libtommath/bn_mp_to_signed_bin_n.c +++ b/libtommath/bn_mp_to_signed_bin_n.c @@ -16,7 +16,7 @@ */ /* store in signed [big endian] format */ -int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) +int mp_to_signed_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen) { if (*outlen < (unsigned long)mp_signed_bin_size(a)) { return MP_VAL; diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c index d249359..e103383 100644 --- a/libtommath/bn_mp_to_unsigned_bin.c +++ b/libtommath/bn_mp_to_unsigned_bin.c @@ -16,30 +16,30 @@ */ /* store in unsigned [big endian] format */ -int mp_to_unsigned_bin (mp_int * a, unsigned char *b) +int mp_to_unsigned_bin(mp_int *a, unsigned char *b) { - int x, res; - mp_int t; + int x, res; + mp_int t; - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } - x = 0; - while (mp_iszero (&t) == MP_NO) { + x = 0; + while (mp_iszero(&t) == MP_NO) { #ifndef MP_8BIT - b[x++] = (unsigned char) (t.dp[0] & 255); + b[x++] = (unsigned char)(t.dp[0] & 255); #else - b[x++] = (unsigned char) (t.dp[0] | ((t.dp[1] & 0x01) << 7)); + b[x++] = (unsigned char)(t.dp[0] | ((t.dp[1] & 0x01) << 7)); #endif - if ((res = mp_div_2d (&t, 8, &t, NULL)) != MP_OKAY) { - mp_clear (&t); - return res; - } - } - bn_reverse (b, x); - mp_clear (&t); - return MP_OKAY; + if ((res = mp_div_2d(&t, 8, &t, NULL)) != MP_OKAY) { + mp_clear(&t); + return res; + } + } + bn_reverse(b, x); + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c index f671621..5ee28f1 100644 --- a/libtommath/bn_mp_to_unsigned_bin_n.c +++ b/libtommath/bn_mp_to_unsigned_bin_n.c @@ -16,7 +16,7 @@ */ /* store in unsigned [big endian] format */ -int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen) +int mp_to_unsigned_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen) { if (*outlen < (unsigned long)mp_unsigned_bin_size(a)) { return MP_VAL; diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index 4a574fc..8b771bc 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -24,259 +24,259 @@ */ int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c) { - mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2; - int res, B; + mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2; + int res, B; - /* init temps */ - if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, - &a0, &a1, &a2, &b0, &b1, - &b2, &tmp1, &tmp2, NULL)) != MP_OKAY) { - return res; - } + /* init temps */ + if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, + &a0, &a1, &a2, &b0, &b1, + &b2, &tmp1, &tmp2, NULL)) != MP_OKAY) { + return res; + } - /* B */ - B = MIN(a->used, b->used) / 3; + /* B */ + B = MIN(a->used, b->used) / 3; - /* a = a2 * B**2 + a1 * B + a0 */ - if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { - goto ERR; - } + /* a = a2 * B**2 + a1 * B + a0 */ + if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_copy(a, &a1)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a1, B); - if ((res = mp_mod_2d(&a1, DIGIT_BIT * B, &a1)) != MP_OKAY) { - goto ERR; - } + if ((res = mp_copy(a, &a1)) != MP_OKAY) { + goto ERR; + } + mp_rshd(&a1, B); + if ((res = mp_mod_2d(&a1, DIGIT_BIT * B, &a1)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_copy(a, &a2)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a2, B*2); + if ((res = mp_copy(a, &a2)) != MP_OKAY) { + goto ERR; + } + mp_rshd(&a2, B*2); - /* b = b2 * B**2 + b1 * B + b0 */ - if ((res = mp_mod_2d(b, DIGIT_BIT * B, &b0)) != MP_OKAY) { - goto ERR; - } + /* b = b2 * B**2 + b1 * B + b0 */ + if ((res = mp_mod_2d(b, DIGIT_BIT * B, &b0)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_copy(b, &b1)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&b1, B); - (void)mp_mod_2d(&b1, DIGIT_BIT * B, &b1); + if ((res = mp_copy(b, &b1)) != MP_OKAY) { + goto ERR; + } + mp_rshd(&b1, B); + (void)mp_mod_2d(&b1, DIGIT_BIT * B, &b1); - if ((res = mp_copy(b, &b2)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&b2, B*2); + if ((res = mp_copy(b, &b2)) != MP_OKAY) { + goto ERR; + } + mp_rshd(&b2, B*2); - /* w0 = a0*b0 */ - if ((res = mp_mul(&a0, &b0, &w0)) != MP_OKAY) { - goto ERR; - } + /* w0 = a0*b0 */ + if ((res = mp_mul(&a0, &b0, &w0)) != MP_OKAY) { + goto ERR; + } - /* w4 = a2 * b2 */ - if ((res = mp_mul(&a2, &b2, &w4)) != MP_OKAY) { - goto ERR; - } + /* w4 = a2 * b2 */ + if ((res = mp_mul(&a2, &b2, &w4)) != MP_OKAY) { + goto ERR; + } - /* w1 = (a2 + 2(a1 + 2a0))(b2 + 2(b1 + 2b0)) */ - if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { - goto ERR; - } + /* w1 = (a2 + 2(a1 + 2a0))(b2 + 2(b1 + 2b0)) */ + if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_mul_2(&b0, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b2, &tmp2)) != MP_OKAY) { - goto ERR; - } + if ((res = mp_mul_2(&b0, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp2, &b2, &tmp2)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_mul(&tmp1, &tmp2, &w1)) != MP_OKAY) { - goto ERR; - } + if ((res = mp_mul(&tmp1, &tmp2, &w1)) != MP_OKAY) { + goto ERR; + } - /* w3 = (a0 + 2(a1 + 2a2))(b0 + 2(b1 + 2b2)) */ - if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } + /* w3 = (a0 + 2(a1 + 2a2))(b0 + 2(b1 + 2b2)) */ + if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_mul_2(&b2, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { - goto ERR; - } + if ((res = mp_mul_2(&b2, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp2, &b1, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul_2(&tmp2, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_mul(&tmp1, &tmp2, &w3)) != MP_OKAY) { - goto ERR; - } + if ((res = mp_mul(&tmp1, &tmp2, &w3)) != MP_OKAY) { + goto ERR; + } - /* w2 = (a2 + a1 + a0)(b2 + b1 + b0) */ - if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&b2, &b1, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul(&tmp1, &tmp2, &w2)) != MP_OKAY) { - goto ERR; - } + /* w2 = (a2 + a1 + a0)(b2 + b1 + b0) */ + if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&b2, &b1, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp2, &b0, &tmp2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul(&tmp1, &tmp2, &w2)) != MP_OKAY) { + goto ERR; + } - /* now solve the matrix + /* now solve the matrix - 0 0 0 0 1 - 1 2 4 8 16 - 1 1 1 1 1 - 16 8 4 2 1 - 1 0 0 0 0 + 0 0 0 0 1 + 1 2 4 8 16 + 1 1 1 1 1 + 16 8 4 2 1 + 1 0 0 0 0 - using 12 subtractions, 4 shifts, - 2 small divisions and 1 small multiplication - */ + using 12 subtractions, 4 shifts, + 2 small divisions and 1 small multiplication + */ - /* r1 - r4 */ - if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r0 */ - if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/2 */ - if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3/2 */ - if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { - goto ERR; - } - /* r2 - r0 - r4 */ - if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1 - 8r0 */ - if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - 8r4 */ - if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { - goto ERR; - } - /* 3r2 - r1 - r3 */ - if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/3 */ - if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { - goto ERR; - } - /* r3/3 */ - if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { - goto ERR; - } + /* r1 - r4 */ + if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - r0 */ + if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { + goto ERR; + } + /* r1/2 */ + if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3/2 */ + if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { + goto ERR; + } + /* r2 - r0 - r4 */ + if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { + goto ERR; + } + /* r1 - r2 */ + if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - r2 */ + if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { + goto ERR; + } + /* r1 - 8r0 */ + if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - 8r4 */ + if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { + goto ERR; + } + /* 3r2 - r1 - r3 */ + if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { + goto ERR; + } + /* r1 - r2 */ + if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - r2 */ + if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { + goto ERR; + } + /* r1/3 */ + if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { + goto ERR; + } + /* r3/3 */ + if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { + goto ERR; + } - /* at this point shift W[n] by B*n */ - if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { - goto ERR; - } + /* at this point shift W[n] by B*n */ + if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { + goto ERR; + } - if ((res = mp_add(&w0, &w1, c)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, c, c)) != MP_OKAY) { - goto ERR; - } + if ((res = mp_add(&w0, &w1, c)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, c, c)) != MP_OKAY) { + goto ERR; + } ERR: - mp_clear_multi(&w0, &w1, &w2, &w3, &w4, - &a0, &a1, &a2, &b0, &b1, - &b2, &tmp1, &tmp2, NULL); - return res; + mp_clear_multi(&w0, &w1, &w2, &w3, &w4, + &a0, &a1, &a2, &b0, &b1, + &b2, &tmp1, &tmp2, NULL); + return res; } #endif diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 0a38192..5e1e452 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -16,209 +16,208 @@ */ /* squaring using Toom-Cook 3-way algorithm */ -int -mp_toom_sqr(mp_int *a, mp_int *b) +int mp_toom_sqr(mp_int *a, mp_int *b) { - mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; - int res, B; - - /* init temps */ - if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL)) != MP_OKAY) { - return res; - } - - /* B */ - B = a->used / 3; - - /* a = a2 * B**2 + a1 * B + a0 */ - if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_copy(a, &a1)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a1, B); - if ((res = mp_mod_2d(&a1, DIGIT_BIT * B, &a1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_copy(a, &a2)) != MP_OKAY) { - goto ERR; - } - mp_rshd(&a2, B*2); - - /* w0 = a0*a0 */ - if ((res = mp_sqr(&a0, &w0)) != MP_OKAY) { - goto ERR; - } - - /* w4 = a2 * a2 */ - if ((res = mp_sqr(&a2, &w4)) != MP_OKAY) { - goto ERR; - } - - /* w1 = (a2 + 2(a1 + 2a0))**2 */ - if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_sqr(&tmp1, &w1)) != MP_OKAY) { - goto ERR; - } - - /* w3 = (a0 + 2(a1 + 2a2))**2 */ - if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_sqr(&tmp1, &w3)) != MP_OKAY) { - goto ERR; - } - - - /* w2 = (a2 + a1 + a0)**2 */ - if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sqr(&tmp1, &w2)) != MP_OKAY) { - goto ERR; - } - - /* now solve the matrix - - 0 0 0 0 1 - 1 2 4 8 16 - 1 1 1 1 1 - 16 8 4 2 1 - 1 0 0 0 0 - - using 12 subtractions, 4 shifts, 2 small divisions and 1 small multiplication. - */ - - /* r1 - r4 */ - if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r0 */ - if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/2 */ - if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3/2 */ - if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { - goto ERR; - } - /* r2 - r0 - r4 */ - if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1 - 8r0 */ - if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - 8r4 */ - if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { - goto ERR; - } - /* 3r2 - r1 - r3 */ - if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { - goto ERR; - } - /* r1 - r2 */ - if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { - goto ERR; - } - /* r3 - r2 */ - if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { - goto ERR; - } - /* r1/3 */ - if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { - goto ERR; - } - /* r3/3 */ - if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { - goto ERR; - } - - /* at this point shift W[n] by B*n */ - if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { - goto ERR; - } - - if ((res = mp_add(&w0, &w1, b)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { - goto ERR; - } - if ((res = mp_add(&tmp1, b, b)) != MP_OKAY) { - goto ERR; - } + mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; + int res, B; + + /* init temps */ + if ((res = mp_init_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL)) != MP_OKAY) { + return res; + } + + /* B */ + B = a->used / 3; + + /* a = a2 * B**2 + a1 * B + a0 */ + if ((res = mp_mod_2d(a, DIGIT_BIT * B, &a0)) != MP_OKAY) { + goto ERR; + } + + if ((res = mp_copy(a, &a1)) != MP_OKAY) { + goto ERR; + } + mp_rshd(&a1, B); + if ((res = mp_mod_2d(&a1, DIGIT_BIT * B, &a1)) != MP_OKAY) { + goto ERR; + } + + if ((res = mp_copy(a, &a2)) != MP_OKAY) { + goto ERR; + } + mp_rshd(&a2, B*2); + + /* w0 = a0*a0 */ + if ((res = mp_sqr(&a0, &w0)) != MP_OKAY) { + goto ERR; + } + + /* w4 = a2 * a2 */ + if ((res = mp_sqr(&a2, &w4)) != MP_OKAY) { + goto ERR; + } + + /* w1 = (a2 + 2(a1 + 2a0))**2 */ + if ((res = mp_mul_2(&a0, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a2, &tmp1)) != MP_OKAY) { + goto ERR; + } + + if ((res = mp_sqr(&tmp1, &w1)) != MP_OKAY) { + goto ERR; + } + + /* w3 = (a0 + 2(a1 + 2a2))**2 */ + if ((res = mp_mul_2(&a2, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_mul_2(&tmp1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { + goto ERR; + } + + if ((res = mp_sqr(&tmp1, &w3)) != MP_OKAY) { + goto ERR; + } + + + /* w2 = (a2 + a1 + a0)**2 */ + if ((res = mp_add(&a2, &a1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, &a0, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sqr(&tmp1, &w2)) != MP_OKAY) { + goto ERR; + } + + /* now solve the matrix + + 0 0 0 0 1 + 1 2 4 8 16 + 1 1 1 1 1 + 16 8 4 2 1 + 1 0 0 0 0 + + using 12 subtractions, 4 shifts, 2 small divisions and 1 small multiplication. + */ + + /* r1 - r4 */ + if ((res = mp_sub(&w1, &w4, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - r0 */ + if ((res = mp_sub(&w3, &w0, &w3)) != MP_OKAY) { + goto ERR; + } + /* r1/2 */ + if ((res = mp_div_2(&w1, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3/2 */ + if ((res = mp_div_2(&w3, &w3)) != MP_OKAY) { + goto ERR; + } + /* r2 - r0 - r4 */ + if ((res = mp_sub(&w2, &w0, &w2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w2, &w4, &w2)) != MP_OKAY) { + goto ERR; + } + /* r1 - r2 */ + if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - r2 */ + if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { + goto ERR; + } + /* r1 - 8r0 */ + if ((res = mp_mul_2d(&w0, 3, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w1, &tmp1, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - 8r4 */ + if ((res = mp_mul_2d(&w4, 3, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w3, &tmp1, &w3)) != MP_OKAY) { + goto ERR; + } + /* 3r2 - r1 - r3 */ + if ((res = mp_mul_d(&w2, 3, &w2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w2, &w1, &w2)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_sub(&w2, &w3, &w2)) != MP_OKAY) { + goto ERR; + } + /* r1 - r2 */ + if ((res = mp_sub(&w1, &w2, &w1)) != MP_OKAY) { + goto ERR; + } + /* r3 - r2 */ + if ((res = mp_sub(&w3, &w2, &w3)) != MP_OKAY) { + goto ERR; + } + /* r1/3 */ + if ((res = mp_div_3(&w1, &w1, NULL)) != MP_OKAY) { + goto ERR; + } + /* r3/3 */ + if ((res = mp_div_3(&w3, &w3, NULL)) != MP_OKAY) { + goto ERR; + } + + /* at this point shift W[n] by B*n */ + if ((res = mp_lshd(&w1, 1*B)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_lshd(&w2, 2*B)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_lshd(&w3, 3*B)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_lshd(&w4, 4*B)) != MP_OKAY) { + goto ERR; + } + + if ((res = mp_add(&w0, &w1, b)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&w2, &w3, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&w4, &tmp1, &tmp1)) != MP_OKAY) { + goto ERR; + } + if ((res = mp_add(&tmp1, b, b)) != MP_OKAY) { + goto ERR; + } ERR: - mp_clear_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL); - return res; + mp_clear_multi(&w0, &w1, &w2, &w3, &w4, &a0, &a1, &a2, &tmp1, NULL); + return res; } #endif diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index 3337765..5016219 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -16,56 +16,56 @@ */ /* stores a bignum as a ASCII string in a given radix (2..64) */ -int mp_toradix (mp_int * a, char *str, int radix) +int mp_toradix(mp_int *a, char *str, int radix) { - int res, digs; - mp_int t; - mp_digit d; - char *_s = str; + int res, digs; + mp_int t; + mp_digit d; + char *_s = str; - /* check range of the radix */ - if ((radix < 2) || (radix > 64)) { - return MP_VAL; - } + /* check range of the radix */ + if ((radix < 2) || (radix > 64)) { + return MP_VAL; + } - /* quick out if its zero */ - if (mp_iszero(a) == MP_YES) { - *str++ = '0'; - *str = '\0'; - return MP_OKAY; - } + /* quick out if its zero */ + if (mp_iszero(a) == MP_YES) { + *str++ = '0'; + *str = '\0'; + return MP_OKAY; + } - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } - /* if it is negative output a - */ - if (t.sign == MP_NEG) { - ++_s; - *str++ = '-'; - t.sign = MP_ZPOS; - } + /* if it is negative output a - */ + if (t.sign == MP_NEG) { + ++_s; + *str++ = '-'; + t.sign = MP_ZPOS; + } - digs = 0; - while (mp_iszero (&t) == MP_NO) { - if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { - mp_clear (&t); - return res; - } - *str++ = mp_s_rmap[d]; - ++digs; - } + digs = 0; + while (mp_iszero(&t) == MP_NO) { + if ((res = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) { + mp_clear(&t); + return res; + } + *str++ = mp_s_rmap[d]; + ++digs; + } - /* reverse the digits of the string. In this case _s points - * to the first digit [exluding the sign] of the number] - */ - bn_reverse ((unsigned char *)_s, digs); + /* reverse the digits of the string. In this case _s points + * to the first digit [exluding the sign] of the number] + */ + bn_reverse((unsigned char *)_s, digs); - /* append a NULL so the string is properly terminated */ - *str = '\0'; + /* append a NULL so the string is properly terminated */ + *str = '\0'; - mp_clear (&t); - return MP_OKAY; + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index ae24ada..287d3f8 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -15,70 +15,70 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -/* stores a bignum as a ASCII string in a given radix (2..64) +/* stores a bignum as a ASCII string in a given radix (2..64) * - * Stores upto maxlen-1 chars and always a NULL byte + * Stores upto maxlen-1 chars and always a NULL byte */ -int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen) +int mp_toradix_n(mp_int *a, char *str, int radix, int maxlen) { - int res, digs; - mp_int t; - mp_digit d; - char *_s = str; + int res, digs; + mp_int t; + mp_digit d; + char *_s = str; - /* check range of the maxlen, radix */ - if ((maxlen < 2) || (radix < 2) || (radix > 64)) { - return MP_VAL; - } + /* check range of the maxlen, radix */ + if ((maxlen < 2) || (radix < 2) || (radix > 64)) { + return MP_VAL; + } - /* quick out if its zero */ - if (mp_iszero(a) == MP_YES) { - *str++ = '0'; - *str = '\0'; - return MP_OKAY; - } + /* quick out if its zero */ + if (mp_iszero(a) == MP_YES) { + *str++ = '0'; + *str = '\0'; + return MP_OKAY; + } - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } - /* if it is negative output a - */ - if (t.sign == MP_NEG) { - /* we have to reverse our digits later... but not the - sign!! */ - ++_s; + /* if it is negative output a - */ + if (t.sign == MP_NEG) { + /* we have to reverse our digits later... but not the - sign!! */ + ++_s; - /* store the flag and mark the number as positive */ - *str++ = '-'; - t.sign = MP_ZPOS; - - /* subtract a char */ - --maxlen; - } + /* store the flag and mark the number as positive */ + *str++ = '-'; + t.sign = MP_ZPOS; - digs = 0; - while (mp_iszero (&t) == MP_NO) { - if (--maxlen < 1) { - /* no more room */ - break; - } - if ((res = mp_div_d (&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { - mp_clear (&t); - return res; - } - *str++ = mp_s_rmap[d]; - ++digs; - } + /* subtract a char */ + --maxlen; + } + + digs = 0; + while (mp_iszero(&t) == MP_NO) { + if (--maxlen < 1) { + /* no more room */ + break; + } + if ((res = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) { + mp_clear(&t); + return res; + } + *str++ = mp_s_rmap[d]; + ++digs; + } - /* reverse the digits of the string. In this case _s points - * to the first digit [exluding the sign] of the number - */ - bn_reverse ((unsigned char *)_s, digs); + /* reverse the digits of the string. In this case _s points + * to the first digit [exluding the sign] of the number + */ + bn_reverse((unsigned char *)_s, digs); - /* append a NULL so the string is properly terminated */ - *str = '\0'; + /* append a NULL so the string is properly terminated */ + *str = '\0'; - mp_clear (&t); - return MP_OKAY; + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c index f46d0ba..174cdc1 100644 --- a/libtommath/bn_mp_unsigned_bin_size.c +++ b/libtommath/bn_mp_unsigned_bin_size.c @@ -16,10 +16,10 @@ */ /* get the size for an unsigned equivalent */ -int mp_unsigned_bin_size (mp_int * a) +int mp_unsigned_bin_size(mp_int *a) { - int size = mp_count_bits (a); - return (size / 8) + (((size & 7) != 0) ? 1 : 0); + int size = mp_count_bits(a); + return (size / 8) + (((size & 7) != 0) ? 1 : 0); } #endif diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index f51fc8e..4224a7f 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -16,33 +16,32 @@ */ /* XOR two ints together */ -int -mp_xor (mp_int * a, mp_int * b, mp_int * c) +int mp_xor(mp_int *a, mp_int *b, mp_int *c) { - int res, ix, px; - mp_int t, *x; + int res, ix, px; + mp_int t, *x; - if (a->used > b->used) { - if ((res = mp_init_copy (&t, a)) != MP_OKAY) { - return res; - } - px = b->used; - x = b; - } else { - if ((res = mp_init_copy (&t, b)) != MP_OKAY) { - return res; - } - px = a->used; - x = a; - } + if (a->used > b->used) { + if ((res = mp_init_copy(&t, a)) != MP_OKAY) { + return res; + } + px = b->used; + x = b; + } else { + if ((res = mp_init_copy(&t, b)) != MP_OKAY) { + return res; + } + px = a->used; + x = a; + } - for (ix = 0; ix < px; ix++) { - t.dp[ix] ^= x->dp[ix]; - } - mp_clamp (&t); - mp_exch (c, &t); - mp_clear (&t); - return MP_OKAY; + for (ix = 0; ix < px; ix++) { + t.dp[ix] ^= x->dp[ix]; + } + mp_clamp(&t); + mp_exch(c, &t); + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_mp_zero.c b/libtommath/bn_mp_zero.c index a7d59e4..08aac2a 100644 --- a/libtommath/bn_mp_zero.c +++ b/libtommath/bn_mp_zero.c @@ -16,18 +16,18 @@ */ /* set to zero */ -void mp_zero (mp_int * a) +void mp_zero(mp_int *a) { - int n; - mp_digit *tmp; + int n; + mp_digit *tmp; - a->sign = MP_ZPOS; - a->used = 0; + a->sign = MP_ZPOS; + a->used = 0; - tmp = a->dp; - for (n = 0; n < a->alloc; n++) { - *tmp++ = 0; - } + tmp = a->dp; + for (n = 0; n < a->alloc; n++) { + *tmp++ = 0; + } } #endif diff --git a/libtommath/bn_prime_tab.c b/libtommath/bn_prime_tab.c index 5252130..c8fadcd 100644 --- a/libtommath/bn_prime_tab.c +++ b/libtommath/bn_prime_tab.c @@ -15,43 +15,43 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ const mp_digit ltm_prime_tab[] = { - 0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013, - 0x0017, 0x001D, 0x001F, 0x0025, 0x0029, 0x002B, 0x002F, 0x0035, - 0x003B, 0x003D, 0x0043, 0x0047, 0x0049, 0x004F, 0x0053, 0x0059, - 0x0061, 0x0065, 0x0067, 0x006B, 0x006D, 0x0071, 0x007F, + 0x0002, 0x0003, 0x0005, 0x0007, 0x000B, 0x000D, 0x0011, 0x0013, + 0x0017, 0x001D, 0x001F, 0x0025, 0x0029, 0x002B, 0x002F, 0x0035, + 0x003B, 0x003D, 0x0043, 0x0047, 0x0049, 0x004F, 0x0053, 0x0059, + 0x0061, 0x0065, 0x0067, 0x006B, 0x006D, 0x0071, 0x007F, #ifndef MP_8BIT - 0x0083, - 0x0089, 0x008B, 0x0095, 0x0097, 0x009D, 0x00A3, 0x00A7, 0x00AD, - 0x00B3, 0x00B5, 0x00BF, 0x00C1, 0x00C5, 0x00C7, 0x00D3, 0x00DF, - 0x00E3, 0x00E5, 0x00E9, 0x00EF, 0x00F1, 0x00FB, 0x0101, 0x0107, - 0x010D, 0x010F, 0x0115, 0x0119, 0x011B, 0x0125, 0x0133, 0x0137, + 0x0083, + 0x0089, 0x008B, 0x0095, 0x0097, 0x009D, 0x00A3, 0x00A7, 0x00AD, + 0x00B3, 0x00B5, 0x00BF, 0x00C1, 0x00C5, 0x00C7, 0x00D3, 0x00DF, + 0x00E3, 0x00E5, 0x00E9, 0x00EF, 0x00F1, 0x00FB, 0x0101, 0x0107, + 0x010D, 0x010F, 0x0115, 0x0119, 0x011B, 0x0125, 0x0133, 0x0137, - 0x0139, 0x013D, 0x014B, 0x0151, 0x015B, 0x015D, 0x0161, 0x0167, - 0x016F, 0x0175, 0x017B, 0x017F, 0x0185, 0x018D, 0x0191, 0x0199, - 0x01A3, 0x01A5, 0x01AF, 0x01B1, 0x01B7, 0x01BB, 0x01C1, 0x01C9, - 0x01CD, 0x01CF, 0x01D3, 0x01DF, 0x01E7, 0x01EB, 0x01F3, 0x01F7, - 0x01FD, 0x0209, 0x020B, 0x021D, 0x0223, 0x022D, 0x0233, 0x0239, - 0x023B, 0x0241, 0x024B, 0x0251, 0x0257, 0x0259, 0x025F, 0x0265, - 0x0269, 0x026B, 0x0277, 0x0281, 0x0283, 0x0287, 0x028D, 0x0293, - 0x0295, 0x02A1, 0x02A5, 0x02AB, 0x02B3, 0x02BD, 0x02C5, 0x02CF, + 0x0139, 0x013D, 0x014B, 0x0151, 0x015B, 0x015D, 0x0161, 0x0167, + 0x016F, 0x0175, 0x017B, 0x017F, 0x0185, 0x018D, 0x0191, 0x0199, + 0x01A3, 0x01A5, 0x01AF, 0x01B1, 0x01B7, 0x01BB, 0x01C1, 0x01C9, + 0x01CD, 0x01CF, 0x01D3, 0x01DF, 0x01E7, 0x01EB, 0x01F3, 0x01F7, + 0x01FD, 0x0209, 0x020B, 0x021D, 0x0223, 0x022D, 0x0233, 0x0239, + 0x023B, 0x0241, 0x024B, 0x0251, 0x0257, 0x0259, 0x025F, 0x0265, + 0x0269, 0x026B, 0x0277, 0x0281, 0x0283, 0x0287, 0x028D, 0x0293, + 0x0295, 0x02A1, 0x02A5, 0x02AB, 0x02B3, 0x02BD, 0x02C5, 0x02CF, - 0x02D7, 0x02DD, 0x02E3, 0x02E7, 0x02EF, 0x02F5, 0x02F9, 0x0301, - 0x0305, 0x0313, 0x031D, 0x0329, 0x032B, 0x0335, 0x0337, 0x033B, - 0x033D, 0x0347, 0x0355, 0x0359, 0x035B, 0x035F, 0x036D, 0x0371, - 0x0373, 0x0377, 0x038B, 0x038F, 0x0397, 0x03A1, 0x03A9, 0x03AD, - 0x03B3, 0x03B9, 0x03C7, 0x03CB, 0x03D1, 0x03D7, 0x03DF, 0x03E5, - 0x03F1, 0x03F5, 0x03FB, 0x03FD, 0x0407, 0x0409, 0x040F, 0x0419, - 0x041B, 0x0425, 0x0427, 0x042D, 0x043F, 0x0443, 0x0445, 0x0449, - 0x044F, 0x0455, 0x045D, 0x0463, 0x0469, 0x047F, 0x0481, 0x048B, + 0x02D7, 0x02DD, 0x02E3, 0x02E7, 0x02EF, 0x02F5, 0x02F9, 0x0301, + 0x0305, 0x0313, 0x031D, 0x0329, 0x032B, 0x0335, 0x0337, 0x033B, + 0x033D, 0x0347, 0x0355, 0x0359, 0x035B, 0x035F, 0x036D, 0x0371, + 0x0373, 0x0377, 0x038B, 0x038F, 0x0397, 0x03A1, 0x03A9, 0x03AD, + 0x03B3, 0x03B9, 0x03C7, 0x03CB, 0x03D1, 0x03D7, 0x03DF, 0x03E5, + 0x03F1, 0x03F5, 0x03FB, 0x03FD, 0x0407, 0x0409, 0x040F, 0x0419, + 0x041B, 0x0425, 0x0427, 0x042D, 0x043F, 0x0443, 0x0445, 0x0449, + 0x044F, 0x0455, 0x045D, 0x0463, 0x0469, 0x047F, 0x0481, 0x048B, - 0x0493, 0x049D, 0x04A3, 0x04A9, 0x04B1, 0x04BD, 0x04C1, 0x04C7, - 0x04CD, 0x04CF, 0x04D5, 0x04E1, 0x04EB, 0x04FD, 0x04FF, 0x0503, - 0x0509, 0x050B, 0x0511, 0x0515, 0x0517, 0x051B, 0x0527, 0x0529, - 0x052F, 0x0551, 0x0557, 0x055D, 0x0565, 0x0577, 0x0581, 0x058F, - 0x0593, 0x0595, 0x0599, 0x059F, 0x05A7, 0x05AB, 0x05AD, 0x05B3, - 0x05BF, 0x05C9, 0x05CB, 0x05CF, 0x05D1, 0x05D5, 0x05DB, 0x05E7, - 0x05F3, 0x05FB, 0x0607, 0x060D, 0x0611, 0x0617, 0x061F, 0x0623, - 0x062B, 0x062F, 0x063D, 0x0641, 0x0647, 0x0649, 0x064D, 0x0653 + 0x0493, 0x049D, 0x04A3, 0x04A9, 0x04B1, 0x04BD, 0x04C1, 0x04C7, + 0x04CD, 0x04CF, 0x04D5, 0x04E1, 0x04EB, 0x04FD, 0x04FF, 0x0503, + 0x0509, 0x050B, 0x0511, 0x0515, 0x0517, 0x051B, 0x0527, 0x0529, + 0x052F, 0x0551, 0x0557, 0x055D, 0x0565, 0x0577, 0x0581, 0x058F, + 0x0593, 0x0595, 0x0599, 0x059F, 0x05A7, 0x05AB, 0x05AD, 0x05B3, + 0x05BF, 0x05C9, 0x05CB, 0x05CF, 0x05D1, 0x05D5, 0x05DB, 0x05E7, + 0x05F3, 0x05FB, 0x0607, 0x060D, 0x0611, 0x0617, 0x061F, 0x0623, + 0x062B, 0x062F, 0x063D, 0x0641, 0x0647, 0x0649, 0x064D, 0x0653 #endif }; #endif diff --git a/libtommath/bn_reverse.c b/libtommath/bn_reverse.c index dc87a4e..71e3d03 100644 --- a/libtommath/bn_reverse.c +++ b/libtommath/bn_reverse.c @@ -16,21 +16,20 @@ */ /* reverse an array, used for radix code */ -void -bn_reverse (unsigned char *s, int len) +void bn_reverse(unsigned char *s, int len) { - int ix, iy; - unsigned char t; + int ix, iy; + unsigned char t; - ix = 0; - iy = len - 1; - while (ix < iy) { - t = s[ix]; - s[ix] = s[iy]; - s[iy] = t; - ++ix; - --iy; - } + ix = 0; + iy = len - 1; + while (ix < iy) { + t = s[ix]; + s[ix] = s[iy]; + s[iy] = t; + ++ix; + --iy; + } } #endif diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 7a100e8..6ba65da 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -16,91 +16,90 @@ */ /* low level addition, based on HAC pp.594, Algorithm 14.7 */ -int -s_mp_add (mp_int * a, mp_int * b, mp_int * c) +int s_mp_add(mp_int *a, mp_int *b, mp_int *c) { - mp_int *x; - int olduse, res, min, max; - - /* find sizes, we let |a| <= |b| which means we have to sort - * them. "x" will point to the input with the most digits - */ - if (a->used > b->used) { - min = b->used; - max = a->used; - x = a; - } else { - min = a->used; - max = b->used; - x = b; - } - - /* init result */ - if (c->alloc < (max + 1)) { - if ((res = mp_grow (c, max + 1)) != MP_OKAY) { - return res; - } - } - - /* get old used digit count and set new one */ - olduse = c->used; - c->used = max + 1; - - { - mp_digit u, *tmpa, *tmpb, *tmpc; - int i; - - /* alias for digit pointers */ - - /* first input */ - tmpa = a->dp; - - /* second input */ - tmpb = b->dp; - - /* destination */ - tmpc = c->dp; - - /* zero the carry */ - u = 0; - for (i = 0; i < min; i++) { - /* Compute the sum at one digit, T[i] = A[i] + B[i] + U */ - *tmpc = *tmpa++ + *tmpb++ + u; - - /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)DIGIT_BIT); - - /* take away carry bit from T[i] */ - *tmpc++ &= MP_MASK; - } - - /* now copy higher words if any, that is in A+B - * if A or B has more digits add those in - */ - if (min != max) { - for (; i < max; i++) { - /* T[i] = X[i] + U */ - *tmpc = x->dp[i] + u; - - /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)DIGIT_BIT); - - /* take away carry bit from T[i] */ - *tmpc++ &= MP_MASK; + mp_int *x; + int olduse, res, min, max; + + /* find sizes, we let |a| <= |b| which means we have to sort + * them. "x" will point to the input with the most digits + */ + if (a->used > b->used) { + min = b->used; + max = a->used; + x = a; + } else { + min = a->used; + max = b->used; + x = b; + } + + /* init result */ + if (c->alloc < (max + 1)) { + if ((res = mp_grow(c, max + 1)) != MP_OKAY) { + return res; } - } + } - /* add carry */ - *tmpc++ = u; + /* get old used digit count and set new one */ + olduse = c->used; + c->used = max + 1; - /* clear digits above oldused */ - for (i = c->used; i < olduse; i++) { - *tmpc++ = 0; - } - } + { + mp_digit u, *tmpa, *tmpb, *tmpc; + int i; - mp_clamp (c); - return MP_OKAY; + /* alias for digit pointers */ + + /* first input */ + tmpa = a->dp; + + /* second input */ + tmpb = b->dp; + + /* destination */ + tmpc = c->dp; + + /* zero the carry */ + u = 0; + for (i = 0; i < min; i++) { + /* Compute the sum at one digit, T[i] = A[i] + B[i] + U */ + *tmpc = *tmpa++ + *tmpb++ + u; + + /* U = carry bit of T[i] */ + u = *tmpc >> ((mp_digit)DIGIT_BIT); + + /* take away carry bit from T[i] */ + *tmpc++ &= MP_MASK; + } + + /* now copy higher words if any, that is in A+B + * if A or B has more digits add those in + */ + if (min != max) { + for (; i < max; i++) { + /* T[i] = X[i] + U */ + *tmpc = x->dp[i] + u; + + /* U = carry bit of T[i] */ + u = *tmpc >> ((mp_digit)DIGIT_BIT); + + /* take away carry bit from T[i] */ + *tmpc++ &= MP_MASK; + } + } + + /* add carry */ + *tmpc++ = u; + + /* clear digits above oldused */ + for (i = c->used; i < olduse; i++) { + *tmpc++ = 0; + } + } + + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index ab820d4..f8e6b3b 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -15,235 +15,237 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ #ifdef MP_LOW_MEM - #define TAB_SIZE 32 +# define TAB_SIZE 32 #else - #define TAB_SIZE 256 +# define TAB_SIZE 256 #endif -int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode) +int s_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) { - mp_int M[TAB_SIZE], res, mu; - mp_digit buf; - int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; - int (*redux)(mp_int*,mp_int*,mp_int*); - - /* find window size */ - x = mp_count_bits (X); - if (x <= 7) { - winsize = 2; - } else if (x <= 36) { - winsize = 3; - } else if (x <= 140) { - winsize = 4; - } else if (x <= 450) { - winsize = 5; - } else if (x <= 1303) { - winsize = 6; - } else if (x <= 3529) { - winsize = 7; - } else { - winsize = 8; - } + mp_int M[TAB_SIZE], res, mu; + mp_digit buf; + int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; + int (*redux)(mp_int *,mp_int *,mp_int *); + + /* find window size */ + x = mp_count_bits(X); + if (x <= 7) { + winsize = 2; + } else if (x <= 36) { + winsize = 3; + } else if (x <= 140) { + winsize = 4; + } else if (x <= 450) { + winsize = 5; + } else if (x <= 1303) { + winsize = 6; + } else if (x <= 3529) { + winsize = 7; + } else { + winsize = 8; + } #ifdef MP_LOW_MEM - if (winsize > 5) { - winsize = 5; - } + if (winsize > 5) { + winsize = 5; + } #endif - /* init M array */ - /* init first cell */ - if ((err = mp_init(&M[1])) != MP_OKAY) { - return err; - } - - /* now init the second half of the array */ - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - if ((err = mp_init(&M[x])) != MP_OKAY) { - for (y = 1<<(winsize-1); y < x; y++) { - mp_clear (&M[y]); - } - mp_clear(&M[1]); + /* init M array */ + /* init first cell */ + if ((err = mp_init(&M[1])) != MP_OKAY) { return err; - } - } - - /* create mu, used for Barrett reduction */ - if ((err = mp_init (&mu)) != MP_OKAY) { - goto LBL_M; - } - - if (redmode == 0) { - if ((err = mp_reduce_setup (&mu, P)) != MP_OKAY) { - goto LBL_MU; - } - redux = mp_reduce; - } else { - if ((err = mp_reduce_2k_setup_l (P, &mu)) != MP_OKAY) { - goto LBL_MU; - } - redux = mp_reduce_2k_l; - } - - /* create M table - * - * The M table contains powers of the base, - * e.g. M[x] = G**x mod P - * - * The first half of the table is not - * computed though accept for M[0] and M[1] - */ - if ((err = mp_mod (G, P, &M[1])) != MP_OKAY) { - goto LBL_MU; - } - - /* compute the value at M[1<<(winsize-1)] by squaring - * M[1] (winsize-1) times - */ - if ((err = mp_copy (&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_MU; - } - - for (x = 0; x < (winsize - 1); x++) { - /* square it */ - if ((err = mp_sqr (&M[1 << (winsize - 1)], - &M[1 << (winsize - 1)])) != MP_OKAY) { - goto LBL_MU; - } + } + + /* now init the second half of the array */ + for (x = 1<<(winsize-1); x < (1 << winsize); x++) { + if ((err = mp_init(&M[x])) != MP_OKAY) { + for (y = 1<<(winsize-1); y < x; y++) { + mp_clear(&M[y]); + } + mp_clear(&M[1]); + return err; + } + } - /* reduce modulo P */ - if ((err = redux (&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) { - goto LBL_MU; - } - } - - /* create upper table, that is M[x] = M[x-1] * M[1] (mod P) - * for x = (2**(winsize - 1) + 1) to (2**winsize - 1) - */ - for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { - if ((err = mp_mul (&M[x - 1], &M[1], &M[x])) != MP_OKAY) { + /* create mu, used for Barrett reduction */ + if ((err = mp_init(&mu)) != MP_OKAY) { + goto LBL_M; + } + + if (redmode == 0) { + if ((err = mp_reduce_setup(&mu, P)) != MP_OKAY) { + goto LBL_MU; + } + redux = mp_reduce; + } else { + if ((err = mp_reduce_2k_setup_l(P, &mu)) != MP_OKAY) { + goto LBL_MU; + } + redux = mp_reduce_2k_l; + } + + /* create M table + * + * The M table contains powers of the base, + * e.g. M[x] = G**x mod P + * + * The first half of the table is not + * computed though accept for M[0] and M[1] + */ + if ((err = mp_mod(G, P, &M[1])) != MP_OKAY) { goto LBL_MU; - } - if ((err = redux (&M[x], P, &mu)) != MP_OKAY) { + } + + /* compute the value at M[1<<(winsize-1)] by squaring + * M[1] (winsize-1) times + */ + if ((err = mp_copy(&M[1], &M[1 << (winsize - 1)])) != MP_OKAY) { goto LBL_MU; - } - } - - /* setup result */ - if ((err = mp_init (&res)) != MP_OKAY) { - goto LBL_MU; - } - mp_set (&res, 1); - - /* set initial mode and bit cnt */ - mode = 0; - bitcnt = 1; - buf = 0; - digidx = X->used - 1; - bitcpy = 0; - bitbuf = 0; - - for (;;) { - /* grab next digit as required */ - if (--bitcnt == 0) { - /* if digidx == -1 we are out of digits */ - if (digidx == -1) { - break; + } + + for (x = 0; x < (winsize - 1); x++) { + /* square it */ + if ((err = mp_sqr(&M[1 << (winsize - 1)], + &M[1 << (winsize - 1)])) != MP_OKAY) { + goto LBL_MU; } - /* read next digit and reset the bitcnt */ - buf = X->dp[digidx--]; - bitcnt = (int) DIGIT_BIT; - } - - /* grab the next msb from the exponent */ - y = (buf >> (mp_digit)(DIGIT_BIT - 1)) & 1; - buf <<= (mp_digit)1; - - /* if the bit is zero and mode == 0 then we ignore it - * These represent the leading zero bits before the first 1 bit - * in the exponent. Technically this opt is not required but it - * does lower the # of trivial squaring/reductions used - */ - if ((mode == 0) && (y == 0)) { - continue; - } - - /* if the bit is zero and mode == 1 then we square */ - if ((mode == 1) && (y == 0)) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; + + /* reduce modulo P */ + if ((err = redux(&M[1 << (winsize - 1)], P, &mu)) != MP_OKAY) { + goto LBL_MU; } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; + } + + /* create upper table, that is M[x] = M[x-1] * M[1] (mod P) + * for x = (2**(winsize - 1) + 1) to (2**winsize - 1) + */ + for (x = (1 << (winsize - 1)) + 1; x < (1 << winsize); x++) { + if ((err = mp_mul(&M[x - 1], &M[1], &M[x])) != MP_OKAY) { + goto LBL_MU; } - continue; - } - - /* else we add it to the window */ - bitbuf |= (y << (winsize - ++bitcpy)); - mode = 2; - - if (bitcpy == winsize) { - /* ok window is filled so square as required and multiply */ - /* square first */ - for (x = 0; x < winsize; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } + if ((err = redux(&M[x], P, &mu)) != MP_OKAY) { + goto LBL_MU; } + } - /* then multiply */ - if ((err = mp_mul (&res, &M[bitbuf], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; + /* setup result */ + if ((err = mp_init(&res)) != MP_OKAY) { + goto LBL_MU; + } + mp_set(&res, 1); + + /* set initial mode and bit cnt */ + mode = 0; + bitcnt = 1; + buf = 0; + digidx = X->used - 1; + bitcpy = 0; + bitbuf = 0; + + for (;;) { + /* grab next digit as required */ + if (--bitcnt == 0) { + /* if digidx == -1 we are out of digits */ + if (digidx == -1) { + break; + } + /* read next digit and reset the bitcnt */ + buf = X->dp[digidx--]; + bitcnt = (int)DIGIT_BIT; } - /* empty window and reset */ - bitcpy = 0; - bitbuf = 0; - mode = 1; - } - } - - /* if bits remain then square/multiply */ - if ((mode == 2) && (bitcpy > 0)) { - /* square then multiply if the bit is set */ - for (x = 0; x < bitcpy; x++) { - if ((err = mp_sqr (&res, &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; + /* grab the next msb from the exponent */ + y = (buf >> (mp_digit)(DIGIT_BIT - 1)) & 1; + buf <<= (mp_digit)1; + + /* if the bit is zero and mode == 0 then we ignore it + * These represent the leading zero bits before the first 1 bit + * in the exponent. Technically this opt is not required but it + * does lower the # of trivial squaring/reductions used + */ + if ((mode == 0) && (y == 0)) { + continue; } - bitbuf <<= 1; - if ((bitbuf & (1 << winsize)) != 0) { - /* then multiply */ - if ((err = mp_mul (&res, &M[1], &res)) != MP_OKAY) { - goto LBL_RES; - } - if ((err = redux (&res, P, &mu)) != MP_OKAY) { - goto LBL_RES; - } + /* if the bit is zero and mode == 1 then we square */ + if ((mode == 1) && (y == 0)) { + if ((err = mp_sqr(&res, &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, &mu)) != MP_OKAY) { + goto LBL_RES; + } + continue; } - } - } - mp_exch (&res, Y); - err = MP_OKAY; -LBL_RES:mp_clear (&res); -LBL_MU:mp_clear (&mu); + /* else we add it to the window */ + bitbuf |= (y << (winsize - ++bitcpy)); + mode = 2; + + if (bitcpy == winsize) { + /* ok window is filled so square as required and multiply */ + /* square first */ + for (x = 0; x < winsize; x++) { + if ((err = mp_sqr(&res, &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, &mu)) != MP_OKAY) { + goto LBL_RES; + } + } + + /* then multiply */ + if ((err = mp_mul(&res, &M[bitbuf], &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, &mu)) != MP_OKAY) { + goto LBL_RES; + } + + /* empty window and reset */ + bitcpy = 0; + bitbuf = 0; + mode = 1; + } + } + + /* if bits remain then square/multiply */ + if ((mode == 2) && (bitcpy > 0)) { + /* square then multiply if the bit is set */ + for (x = 0; x < bitcpy; x++) { + if ((err = mp_sqr(&res, &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, &mu)) != MP_OKAY) { + goto LBL_RES; + } + + bitbuf <<= 1; + if ((bitbuf & (1 << winsize)) != 0) { + /* then multiply */ + if ((err = mp_mul(&res, &M[1], &res)) != MP_OKAY) { + goto LBL_RES; + } + if ((err = redux(&res, P, &mu)) != MP_OKAY) { + goto LBL_RES; + } + } + } + } + + mp_exch(&res, Y); + err = MP_OKAY; +LBL_RES: + mp_clear(&res); +LBL_MU: + mp_clear(&mu); LBL_M: - mp_clear(&M[1]); - for (x = 1<<(winsize-1); x < (1 << winsize); x++) { - mp_clear (&M[x]); - } - return err; + mp_clear(&M[1]); + for (x = 1<<(winsize-1); x < (1 << winsize); x++) { + mp_clear(&M[x]); + } + return err; } #endif diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index 8f1bf97..c72c2a8 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -16,72 +16,72 @@ */ /* multiplies |a| * |b| and only computes upto digs digits of result - * HAC pp. 595, Algorithm 14.12 Modified so you can control how + * HAC pp. 595, Algorithm 14.12 Modified so you can control how * many digits of output are created. */ -int s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) { - mp_int t; - int res, pa, pb, ix, iy; - mp_digit u; - mp_word r; - mp_digit tmpx, *tmpt, *tmpy; + mp_int t; + int res, pa, pb, ix, iy; + mp_digit u; + mp_word r; + mp_digit tmpx, *tmpt, *tmpy; - /* can we use the fast multiplier? */ - if (((digs) < MP_WARRAY) && - (MIN (a->used, b->used) < - (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { - return fast_s_mp_mul_digs (a, b, c, digs); - } + /* can we use the fast multiplier? */ + if (((digs) < MP_WARRAY) && + (MIN(a->used, b->used) < + (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { + return fast_s_mp_mul_digs(a, b, c, digs); + } - if ((res = mp_init_size (&t, digs)) != MP_OKAY) { - return res; - } - t.used = digs; + if ((res = mp_init_size(&t, digs)) != MP_OKAY) { + return res; + } + t.used = digs; - /* compute the digits of the product directly */ - pa = a->used; - for (ix = 0; ix < pa; ix++) { - /* set the carry to zero */ - u = 0; + /* compute the digits of the product directly */ + pa = a->used; + for (ix = 0; ix < pa; ix++) { + /* set the carry to zero */ + u = 0; - /* limit ourselves to making digs digits of output */ - pb = MIN (b->used, digs - ix); + /* limit ourselves to making digs digits of output */ + pb = MIN(b->used, digs - ix); - /* setup some aliases */ - /* copy of the digit from a used within the nested loop */ - tmpx = a->dp[ix]; - - /* an alias for the destination shifted ix places */ - tmpt = t.dp + ix; - - /* an alias for the digits of b */ - tmpy = b->dp; + /* setup some aliases */ + /* copy of the digit from a used within the nested loop */ + tmpx = a->dp[ix]; - /* compute the columns of the output and propagate the carry */ - for (iy = 0; iy < pb; iy++) { - /* compute the column as a mp_word */ - r = (mp_word)*tmpt + - ((mp_word)tmpx * (mp_word)*tmpy++) + - (mp_word)u; + /* an alias for the destination shifted ix places */ + tmpt = t.dp + ix; - /* the new column is the lower part of the result */ - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); + /* an alias for the digits of b */ + tmpy = b->dp; - /* get the carry word from the result */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } - /* set carry if it is placed below digs */ - if ((ix + iy) < digs) { - *tmpt = u; - } - } + /* compute the columns of the output and propagate the carry */ + for (iy = 0; iy < pb; iy++) { + /* compute the column as a mp_word */ + r = (mp_word)*tmpt + + ((mp_word)tmpx * (mp_word)*tmpy++) + + (mp_word)u; - mp_clamp (&t); - mp_exch (&t, c); + /* the new column is the lower part of the result */ + *tmpt++ = (mp_digit)(r & ((mp_word) MP_MASK)); - mp_clear (&t); - return MP_OKAY; + /* get the carry word from the result */ + u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + } + /* set carry if it is placed below digs */ + if ((ix + iy) < digs) { + *tmpt = u; + } + } + + mp_clamp(&t); + mp_exch(&t, c); + + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 031f17b..0e12f3b 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -18,61 +18,60 @@ /* multiplies |a| * |b| and does not compute the lower digs digits * [meant to get the higher part of the product] */ -int -s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs) +int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs) { - mp_int t; - int res, pa, pb, ix, iy; - mp_digit u; - mp_word r; - mp_digit tmpx, *tmpt, *tmpy; + mp_int t; + int res, pa, pb, ix, iy; + mp_digit u; + mp_word r; + mp_digit tmpx, *tmpt, *tmpy; - /* can we use the fast multiplier? */ + /* can we use the fast multiplier? */ #ifdef BN_FAST_S_MP_MUL_HIGH_DIGS_C - if (((a->used + b->used + 1) < MP_WARRAY) - && (MIN (a->used, b->used) < (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { - return fast_s_mp_mul_high_digs (a, b, c, digs); - } + if (((a->used + b->used + 1) < MP_WARRAY) + && (MIN(a->used, b->used) < (1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) { + return fast_s_mp_mul_high_digs(a, b, c, digs); + } #endif - if ((res = mp_init_size (&t, a->used + b->used + 1)) != MP_OKAY) { - return res; - } - t.used = a->used + b->used + 1; + if ((res = mp_init_size(&t, a->used + b->used + 1)) != MP_OKAY) { + return res; + } + t.used = a->used + b->used + 1; - pa = a->used; - pb = b->used; - for (ix = 0; ix < pa; ix++) { - /* clear the carry */ - u = 0; + pa = a->used; + pb = b->used; + for (ix = 0; ix < pa; ix++) { + /* clear the carry */ + u = 0; - /* left hand side of A[ix] * B[iy] */ - tmpx = a->dp[ix]; + /* left hand side of A[ix] * B[iy] */ + tmpx = a->dp[ix]; - /* alias to the address of where the digits will be stored */ - tmpt = &(t.dp[digs]); + /* alias to the address of where the digits will be stored */ + tmpt = &(t.dp[digs]); - /* alias for where to read the right hand side from */ - tmpy = b->dp + (digs - ix); + /* alias for where to read the right hand side from */ + tmpy = b->dp + (digs - ix); - for (iy = digs - ix; iy < pb; iy++) { - /* calculate the double precision result */ - r = (mp_word)*tmpt + - ((mp_word)tmpx * (mp_word)*tmpy++) + - (mp_word)u; + for (iy = digs - ix; iy < pb; iy++) { + /* calculate the double precision result */ + r = (mp_word)*tmpt + + ((mp_word)tmpx * (mp_word)*tmpy++) + + (mp_word)u; - /* get the lower part */ - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); + /* get the lower part */ + *tmpt++ = (mp_digit)(r & ((mp_word) MP_MASK)); - /* carry the carry */ - u = (mp_digit) (r >> ((mp_word) DIGIT_BIT)); - } - *tmpt = u; - } - mp_clamp (&t); - mp_exch (&t, c); - mp_clear (&t); - return MP_OKAY; + /* carry the carry */ + u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + } + *tmpt = u; + } + mp_clamp(&t); + mp_exch(&t, c); + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index ac0e157..2910f24 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -16,66 +16,66 @@ */ /* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */ -int s_mp_sqr (mp_int * a, mp_int * b) +int s_mp_sqr(mp_int *a, mp_int *b) { - mp_int t; - int res, ix, iy, pa; - mp_word r; - mp_digit u, tmpx, *tmpt; + mp_int t; + int res, ix, iy, pa; + mp_word r; + mp_digit u, tmpx, *tmpt; - pa = a->used; - if ((res = mp_init_size (&t, (2 * pa) + 1)) != MP_OKAY) { - return res; - } + pa = a->used; + if ((res = mp_init_size(&t, (2 * pa) + 1)) != MP_OKAY) { + return res; + } - /* default used is maximum possible size */ - t.used = (2 * pa) + 1; + /* default used is maximum possible size */ + t.used = (2 * pa) + 1; - for (ix = 0; ix < pa; ix++) { - /* first calculate the digit at 2*ix */ - /* calculate double precision result */ - r = (mp_word)t.dp[2*ix] + - ((mp_word)a->dp[ix] * (mp_word)a->dp[ix]); + for (ix = 0; ix < pa; ix++) { + /* first calculate the digit at 2*ix */ + /* calculate double precision result */ + r = (mp_word)t.dp[2*ix] + + ((mp_word)a->dp[ix] * (mp_word)a->dp[ix]); - /* store lower part in result */ - t.dp[ix+ix] = (mp_digit) (r & ((mp_word) MP_MASK)); + /* store lower part in result */ + t.dp[ix+ix] = (mp_digit)(r & ((mp_word)MP_MASK)); - /* get the carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + /* get the carry */ + u = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); - /* left hand side of A[ix] * A[iy] */ - tmpx = a->dp[ix]; + /* left hand side of A[ix] * A[iy] */ + tmpx = a->dp[ix]; - /* alias for where to store the results */ - tmpt = t.dp + ((2 * ix) + 1); - - for (iy = ix + 1; iy < pa; iy++) { - /* first calculate the product */ - r = ((mp_word)tmpx) * ((mp_word)a->dp[iy]); + /* alias for where to store the results */ + tmpt = t.dp + ((2 * ix) + 1); - /* now calculate the double precision result, note we use - * addition instead of *2 since it's easier to optimize - */ - r = ((mp_word) *tmpt) + r + r + ((mp_word) u); + for (iy = ix + 1; iy < pa; iy++) { + /* first calculate the product */ + r = ((mp_word)tmpx) * ((mp_word)a->dp[iy]); - /* store lower part */ - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); + /* now calculate the double precision result, note we use + * addition instead of *2 since it's easier to optimize + */ + r = ((mp_word) *tmpt) + r + r + ((mp_word) u); - /* get carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - } - /* propagate upwards */ - while (u != ((mp_digit) 0)) { - r = ((mp_word) *tmpt) + ((mp_word) u); - *tmpt++ = (mp_digit) (r & ((mp_word) MP_MASK)); - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); - } - } + /* store lower part */ + *tmpt++ = (mp_digit)(r & ((mp_word) MP_MASK)); - mp_clamp (&t); - mp_exch (&t, b); - mp_clear (&t); - return MP_OKAY; + /* get carry */ + u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + } + /* propagate upwards */ + while (u != ((mp_digit) 0)) { + r = ((mp_word) *tmpt) + ((mp_word) u); + *tmpt++ = (mp_digit)(r & ((mp_word) MP_MASK)); + u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + } + } + + mp_clamp(&t); + mp_exch(&t, b); + mp_clear(&t); + return MP_OKAY; } #endif diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index 8091f4a..f61aa83 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -16,70 +16,69 @@ */ /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ -int -s_mp_sub (mp_int * a, mp_int * b, mp_int * c) +int s_mp_sub(mp_int *a, mp_int *b, mp_int *c) { - int olduse, res, min, max; + int olduse, res, min, max; - /* find sizes */ - min = b->used; - max = a->used; + /* find sizes */ + min = b->used; + max = a->used; - /* init result */ - if (c->alloc < max) { - if ((res = mp_grow (c, max)) != MP_OKAY) { - return res; - } - } - olduse = c->used; - c->used = max; + /* init result */ + if (c->alloc < max) { + if ((res = mp_grow(c, max)) != MP_OKAY) { + return res; + } + } + olduse = c->used; + c->used = max; - { - mp_digit u, *tmpa, *tmpb, *tmpc; - int i; + { + mp_digit u, *tmpa, *tmpb, *tmpc; + int i; - /* alias for digit pointers */ - tmpa = a->dp; - tmpb = b->dp; - tmpc = c->dp; + /* alias for digit pointers */ + tmpa = a->dp; + tmpb = b->dp; + tmpc = c->dp; - /* set carry to zero */ - u = 0; - for (i = 0; i < min; i++) { - /* T[i] = A[i] - B[i] - U */ - *tmpc = (*tmpa++ - *tmpb++) - u; + /* set carry to zero */ + u = 0; + for (i = 0; i < min; i++) { + /* T[i] = A[i] - B[i] - U */ + *tmpc = (*tmpa++ - *tmpb++) - u; - /* U = carry bit of T[i] - * Note this saves performing an AND operation since - * if a carry does occur it will propagate all the way to the - * MSB. As a result a single shift is enough to get the carry - */ - u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); + /* U = carry bit of T[i] + * Note this saves performing an AND operation since + * if a carry does occur it will propagate all the way to the + * MSB. As a result a single shift is enough to get the carry + */ + u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); - /* Clear carry from T[i] */ - *tmpc++ &= MP_MASK; - } + /* Clear carry from T[i] */ + *tmpc++ &= MP_MASK; + } - /* now copy higher words if any, e.g. if A has more digits than B */ - for (; i < max; i++) { - /* T[i] = A[i] - U */ - *tmpc = *tmpa++ - u; + /* now copy higher words if any, e.g. if A has more digits than B */ + for (; i < max; i++) { + /* T[i] = A[i] - U */ + *tmpc = *tmpa++ - u; - /* U = carry bit of T[i] */ - u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); + /* U = carry bit of T[i] */ + u = *tmpc >> ((mp_digit)((CHAR_BIT * sizeof(mp_digit)) - 1)); - /* Clear carry from T[i] */ - *tmpc++ &= MP_MASK; - } + /* Clear carry from T[i] */ + *tmpc++ &= MP_MASK; + } - /* clear digits above used (since we may not have grown result above) */ - for (i = c->used; i < olduse; i++) { - *tmpc++ = 0; - } - } + /* clear digits above used (since we may not have grown result above) */ + for (i = c->used; i < olduse; i++) { + *tmpc++ = 0; + } + } - mp_clamp (c); - return MP_OKAY; + mp_clamp(c); + return MP_OKAY; } #endif diff --git a/libtommath/bncore.c b/libtommath/bncore.c index e80ec99..cfd19f0 100644 --- a/libtommath/bncore.c +++ b/libtommath/bncore.c @@ -21,14 +21,14 @@ ------------------------------------------------------------- Intel P4 Northwood /GCC v3.4.1 / 88/ 128/LTM 0.32 ;-) AMD Athlon64 /GCC v3.4.4 / 80/ 120/LTM 0.35 - + */ int KARATSUBA_MUL_CUTOFF = 80, /* Min. number of digits before Karatsuba multiplication is used. */ KARATSUBA_SQR_CUTOFF = 120, /* Min. number of digits before Karatsuba squaring is used. */ - + TOOM_MUL_CUTOFF = 350, /* no optimal values of these are known yet so set em high */ - TOOM_SQR_CUTOFF = 400; + TOOM_SQR_CUTOFF = 400; #endif /* ref: $Format:%D$ */ diff --git a/libtommath/makefile b/libtommath/makefile index fdd2435..64d8fcd 100644 --- a/libtommath/makefile +++ b/libtommath/makefile @@ -149,3 +149,6 @@ new_file: perlcritic: perlcritic *.pl + +astyle: + astyle --options=astylerc $(OBJECTS:.o=.c) diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 80bae69..2aaea5b 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -33,9 +33,9 @@ extern "C" { defined(__sparcv9) || defined(__sparc_v9__) || defined(__sparc64__) || \ defined(__ia64) || defined(__ia64__) || defined(__itanium__) || defined(_M_IA64) || \ defined(__LP64__) || defined(_LP64) || defined(__64BIT__) - #if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) - #define MP_64BIT - #endif +# if !(defined(MP_32BIT) || defined(MP_16BIT) || defined(MP_8BIT)) +# define MP_64BIT +# endif #endif /* some default configurations. @@ -47,68 +47,68 @@ extern "C" { * [any size beyond that is ok provided it doesn't overflow the data type] */ #ifdef MP_8BIT - typedef uint8_t mp_digit; - typedef uint16_t mp_word; -#define MP_SIZEOF_MP_DIGIT 1 -#ifdef DIGIT_BIT -#error You must not define DIGIT_BIT when using MP_8BIT -#endif +typedef uint8_t mp_digit; +typedef uint16_t mp_word; +# define MP_SIZEOF_MP_DIGIT 1 +# ifdef DIGIT_BIT +# error You must not define DIGIT_BIT when using MP_8BIT +# endif #elif defined(MP_16BIT) - typedef uint16_t mp_digit; - typedef uint32_t mp_word; -#define MP_SIZEOF_MP_DIGIT 2 -#ifdef DIGIT_BIT -#error You must not define DIGIT_BIT when using MP_16BIT -#endif +typedef uint16_t mp_digit; +typedef uint32_t mp_word; +# define MP_SIZEOF_MP_DIGIT 2 +# ifdef DIGIT_BIT +# error You must not define DIGIT_BIT when using MP_16BIT +# endif #elif defined(MP_64BIT) - /* for GCC only on supported platforms */ - typedef uint64_t mp_digit; -#if defined(_WIN32) - typedef unsigned __int128 mp_word; -#elif defined(__GNUC__) - typedef unsigned long mp_word __attribute__ ((mode(TI))); -#else - /* it seems you have a problem - * but we assume you can somewhere define your own uint128_t */ - typedef uint128_t mp_word; -#endif - - #define DIGIT_BIT 60 +/* for GCC only on supported platforms */ +typedef uint64_t mp_digit; +# if defined(_WIN32) +typedef unsigned __int128 mp_word; +# elif defined(__GNUC__) +typedef unsigned long mp_word __attribute__((mode(TI))); +# else +/* it seems you have a problem + * but we assume you can somewhere define your own uint128_t */ +typedef uint128_t mp_word; +# endif + +# define DIGIT_BIT 60 #else - /* this is the default case, 28-bit digits */ - - /* this is to make porting into LibTomCrypt easier :-) */ - typedef uint32_t mp_digit; - typedef uint64_t 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 +/* this is the default case, 28-bit digits */ + +/* this is to make porting into LibTomCrypt easier :-) */ +typedef uint32_t mp_digit; +typedef uint64_t 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 /* otherwise the bits per digit is calculated automatically from the size of a mp_digit */ #ifndef DIGIT_BIT - #define DIGIT_BIT (((CHAR_BIT * MP_SIZEOF_MP_DIGIT) - 1)) /* bits per digit */ - typedef uint_least32_t mp_min_u32; +# define DIGIT_BIT (((CHAR_BIT * MP_SIZEOF_MP_DIGIT) - 1)) /* bits per digit */ +typedef uint_least32_t mp_min_u32; #else - typedef mp_digit mp_min_u32; +typedef mp_digit mp_min_u32; #endif /* use arc4random on platforms that support it */ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) - #define MP_GEN_RANDOM() arc4random() - #define MP_GEN_RANDOM_MAX 0xffffffff +# define MP_GEN_RANDOM() arc4random() +# define MP_GEN_RANDOM_MAX 0xffffffff #endif /* use rand() as fall-back if there's no better rand function */ #ifndef MP_GEN_RANDOM - #define MP_GEN_RANDOM() rand() - #define MP_GEN_RANDOM_MAX RAND_MAX +# define MP_GEN_RANDOM() rand() +# define MP_GEN_RANDOM_MAX RAND_MAX #endif #define MP_DIGIT_BIT DIGIT_BIT @@ -140,20 +140,20 @@ typedef int mp_err; /* you'll have to tune these... */ extern int KARATSUBA_MUL_CUTOFF, - KARATSUBA_SQR_CUTOFF, - TOOM_MUL_CUTOFF, - TOOM_SQR_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 32 /* default digits of precision */ - #else - #define MP_PREC 8 /* default digits of precision */ - #endif +# ifndef MP_LOW_MEM +# define MP_PREC 32 /* 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) */ @@ -161,17 +161,17 @@ extern int KARATSUBA_MUL_CUTOFF, /* the infamous mp_int structure */ typedef struct { - int used, alloc, sign; - mp_digit *dp; + int used, alloc, sign; + mp_digit *dp; } mp_int; /* 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) +#define USED(m) ((m)->used) +#define DIGIT(m, k) ((m)->dp[(k)]) +#define SIGN(m) ((m)->sign) /* error code to char* string */ const char *mp_error_to_string(int code); @@ -223,19 +223,19 @@ int mp_set_long(mp_int *a, unsigned long b); int mp_set_long_long(mp_int *a, unsigned long long b); /* get a 32-bit value */ -unsigned long mp_get_int(mp_int * a); +unsigned long mp_get_int(mp_int *a); /* get a platform dependent unsigned long value */ -unsigned long mp_get_long(mp_int * a); +unsigned long mp_get_long(mp_int *a); /* get a platform dependent unsigned long long value */ -unsigned long long mp_get_long_long(mp_int * a); +unsigned long long mp_get_long_long(mp_int *a); /* initialize and set a digit */ -int mp_init_set (mp_int * a, mp_digit b); +int mp_init_set(mp_int *a, mp_digit b); /* initialize and set 32-bit value */ -int mp_init_set_int (mp_int * a, unsigned long b); +int mp_init_set_int(mp_int *a, unsigned long b); /* copy, b = a */ int mp_copy(mp_int *a, mp_int *b); @@ -247,10 +247,10 @@ int mp_init_copy(mp_int *a, mp_int *b); void mp_clamp(mp_int *a); /* import binary data */ -int mp_import(mp_int* rop, size_t count, int order, size_t size, int endian, size_t nails, const void* op); +int mp_import(mp_int *rop, size_t count, int order, size_t size, int endian, size_t nails, const void *op); /* export binary data */ -int mp_export(void* rop, size_t* countp, int order, size_t size, int endian, size_t nails, mp_int* op); +int mp_export(void *rop, size_t *countp, int order, size_t size, int endian, size_t nails, mp_int *op); /* ---> digit manipulation <--- */ @@ -350,7 +350,7 @@ int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); /* c = a**b */ int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); -int mp_expt_d_ex (mp_int * a, mp_digit b, mp_int * c, int fast); +int mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast); /* c = a mod b, 0 <= c < b */ int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); @@ -386,7 +386,7 @@ int mp_lcm(mp_int *a, mp_int *b, mp_int *c); * returns error if a < 0 and b is even */ int mp_n_root(mp_int *a, mp_digit b, mp_int *c); -int mp_n_root_ex (mp_int * a, mp_digit b, mp_int * c, int fast); +int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast); /* special sqrt algo */ int mp_sqrt(mp_int *arg, mp_int *ret); @@ -455,9 +455,9 @@ int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); /* number of primes */ #ifdef MP_8BIT - #define PRIME_SIZE 31 +# define PRIME_SIZE 31 #else - #define PRIME_SIZE 256 +# define PRIME_SIZE 256 #endif /* table of first PRIME_SIZE primes */ @@ -529,16 +529,16 @@ int mp_count_bits(mp_int *a); int mp_unsigned_bin_size(mp_int *a); int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); int mp_to_unsigned_bin(mp_int *a, unsigned char *b); -int mp_to_unsigned_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +int mp_to_unsigned_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen); int mp_signed_bin_size(mp_int *a); int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c); int mp_to_signed_bin(mp_int *a, unsigned char *b); -int mp_to_signed_bin_n (mp_int * a, unsigned char *b, unsigned long *outlen); +int mp_to_signed_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen); int mp_read_radix(mp_int *a, const char *str, int radix); int mp_toradix(mp_int *a, char *str, int radix); -int mp_toradix_n(mp_int * a, char *str, int radix, int maxlen); +int mp_toradix_n(mp_int *a, char *str, int radix, int maxlen); int mp_radix_size(mp_int *a, int radix, int *size); #ifndef LTM_NO_FILE @@ -559,7 +559,7 @@ int mp_fwrite(mp_int *a, int radix, FILE *stream); #define mp_tohex(M, S) mp_toradix((M), (S), 16) #ifdef __cplusplus - } +} #endif #endif diff --git a/libtommath/tommath_class.h b/libtommath/tommath_class.h index e860613..f700d66 100644 --- a/libtommath/tommath_class.h +++ b/libtommath/tommath_class.h @@ -1,220 +1,220 @@ #if !(defined(LTM1) && defined(LTM2) && defined(LTM3)) #if defined(LTM2) -#define LTM3 +# define LTM3 #endif #if defined(LTM1) -#define LTM2 +# define LTM2 #endif #define LTM1 #if defined(LTM_ALL) -#define BN_ERROR_C -#define BN_FAST_MP_INVMOD_C -#define BN_FAST_MP_MONTGOMERY_REDUCE_C -#define BN_FAST_S_MP_MUL_DIGS_C -#define BN_FAST_S_MP_MUL_HIGH_DIGS_C -#define BN_FAST_S_MP_SQR_C -#define BN_MP_2EXPT_C -#define BN_MP_ABS_C -#define BN_MP_ADD_C -#define BN_MP_ADD_D_C -#define BN_MP_ADDMOD_C -#define BN_MP_AND_C -#define BN_MP_CLAMP_C -#define BN_MP_CLEAR_C -#define BN_MP_CLEAR_MULTI_C -#define BN_MP_CMP_C -#define BN_MP_CMP_D_C -#define BN_MP_CMP_MAG_C -#define BN_MP_CNT_LSB_C -#define BN_MP_COPY_C -#define BN_MP_COUNT_BITS_C -#define BN_MP_DIV_C -#define BN_MP_DIV_2_C -#define BN_MP_DIV_2D_C -#define BN_MP_DIV_3_C -#define BN_MP_DIV_D_C -#define BN_MP_DR_IS_MODULUS_C -#define BN_MP_DR_REDUCE_C -#define BN_MP_DR_SETUP_C -#define BN_MP_EXCH_C -#define BN_MP_EXPORT_C -#define BN_MP_EXPT_D_C -#define BN_MP_EXPT_D_EX_C -#define BN_MP_EXPTMOD_C -#define BN_MP_EXPTMOD_FAST_C -#define BN_MP_EXTEUCLID_C -#define BN_MP_FREAD_C -#define BN_MP_FWRITE_C -#define BN_MP_GCD_C -#define BN_MP_GET_INT_C -#define BN_MP_GET_LONG_C -#define BN_MP_GET_LONG_LONG_C -#define BN_MP_GROW_C -#define BN_MP_IMPORT_C -#define BN_MP_INIT_C -#define BN_MP_INIT_COPY_C -#define BN_MP_INIT_MULTI_C -#define BN_MP_INIT_SET_C -#define BN_MP_INIT_SET_INT_C -#define BN_MP_INIT_SIZE_C -#define BN_MP_INVMOD_C -#define BN_MP_INVMOD_SLOW_C -#define BN_MP_IS_SQUARE_C -#define BN_MP_JACOBI_C -#define BN_MP_KARATSUBA_MUL_C -#define BN_MP_KARATSUBA_SQR_C -#define BN_MP_LCM_C -#define BN_MP_LSHD_C -#define BN_MP_MOD_C -#define BN_MP_MOD_2D_C -#define BN_MP_MOD_D_C -#define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C -#define BN_MP_MONTGOMERY_REDUCE_C -#define BN_MP_MONTGOMERY_SETUP_C -#define BN_MP_MUL_C -#define BN_MP_MUL_2_C -#define BN_MP_MUL_2D_C -#define BN_MP_MUL_D_C -#define BN_MP_MULMOD_C -#define BN_MP_N_ROOT_C -#define BN_MP_N_ROOT_EX_C -#define BN_MP_NEG_C -#define BN_MP_OR_C -#define BN_MP_PRIME_FERMAT_C -#define BN_MP_PRIME_IS_DIVISIBLE_C -#define BN_MP_PRIME_IS_PRIME_C -#define BN_MP_PRIME_MILLER_RABIN_C -#define BN_MP_PRIME_NEXT_PRIME_C -#define BN_MP_PRIME_RABIN_MILLER_TRIALS_C -#define BN_MP_PRIME_RANDOM_EX_C -#define BN_MP_RADIX_SIZE_C -#define BN_MP_RADIX_SMAP_C -#define BN_MP_RAND_C -#define BN_MP_READ_RADIX_C -#define BN_MP_READ_SIGNED_BIN_C -#define BN_MP_READ_UNSIGNED_BIN_C -#define BN_MP_REDUCE_C -#define BN_MP_REDUCE_2K_C -#define BN_MP_REDUCE_2K_L_C -#define BN_MP_REDUCE_2K_SETUP_C -#define BN_MP_REDUCE_2K_SETUP_L_C -#define BN_MP_REDUCE_IS_2K_C -#define BN_MP_REDUCE_IS_2K_L_C -#define BN_MP_REDUCE_SETUP_C -#define BN_MP_RSHD_C -#define BN_MP_SET_C -#define BN_MP_SET_INT_C -#define BN_MP_SET_LONG_C -#define BN_MP_SET_LONG_LONG_C -#define BN_MP_SHRINK_C -#define BN_MP_SIGNED_BIN_SIZE_C -#define BN_MP_SQR_C -#define BN_MP_SQRMOD_C -#define BN_MP_SQRT_C -#define BN_MP_SQRTMOD_PRIME_C -#define BN_MP_SUB_C -#define BN_MP_SUB_D_C -#define BN_MP_SUBMOD_C -#define BN_MP_TO_SIGNED_BIN_C -#define BN_MP_TO_SIGNED_BIN_N_C -#define BN_MP_TO_UNSIGNED_BIN_C -#define BN_MP_TO_UNSIGNED_BIN_N_C -#define BN_MP_TOOM_MUL_C -#define BN_MP_TOOM_SQR_C -#define BN_MP_TORADIX_C -#define BN_MP_TORADIX_N_C -#define BN_MP_UNSIGNED_BIN_SIZE_C -#define BN_MP_XOR_C -#define BN_MP_ZERO_C -#define BN_PRIME_TAB_C -#define BN_REVERSE_C -#define BN_S_MP_ADD_C -#define BN_S_MP_EXPTMOD_C -#define BN_S_MP_MUL_DIGS_C -#define BN_S_MP_MUL_HIGH_DIGS_C -#define BN_S_MP_SQR_C -#define BN_S_MP_SUB_C -#define BNCORE_C +# define BN_ERROR_C +# define BN_FAST_MP_INVMOD_C +# define BN_FAST_MP_MONTGOMERY_REDUCE_C +# define BN_FAST_S_MP_MUL_DIGS_C +# define BN_FAST_S_MP_MUL_HIGH_DIGS_C +# define BN_FAST_S_MP_SQR_C +# define BN_MP_2EXPT_C +# define BN_MP_ABS_C +# define BN_MP_ADD_C +# define BN_MP_ADD_D_C +# define BN_MP_ADDMOD_C +# define BN_MP_AND_C +# define BN_MP_CLAMP_C +# define BN_MP_CLEAR_C +# define BN_MP_CLEAR_MULTI_C +# define BN_MP_CMP_C +# define BN_MP_CMP_D_C +# define BN_MP_CMP_MAG_C +# define BN_MP_CNT_LSB_C +# define BN_MP_COPY_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_DIV_C +# define BN_MP_DIV_2_C +# define BN_MP_DIV_2D_C +# define BN_MP_DIV_3_C +# define BN_MP_DIV_D_C +# define BN_MP_DR_IS_MODULUS_C +# define BN_MP_DR_REDUCE_C +# define BN_MP_DR_SETUP_C +# define BN_MP_EXCH_C +# define BN_MP_EXPORT_C +# define BN_MP_EXPT_D_C +# define BN_MP_EXPT_D_EX_C +# define BN_MP_EXPTMOD_C +# define BN_MP_EXPTMOD_FAST_C +# define BN_MP_EXTEUCLID_C +# define BN_MP_FREAD_C +# define BN_MP_FWRITE_C +# define BN_MP_GCD_C +# define BN_MP_GET_INT_C +# define BN_MP_GET_LONG_C +# define BN_MP_GET_LONG_LONG_C +# define BN_MP_GROW_C +# define BN_MP_IMPORT_C +# define BN_MP_INIT_C +# define BN_MP_INIT_COPY_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_INIT_SET_C +# define BN_MP_INIT_SET_INT_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_INVMOD_C +# define BN_MP_INVMOD_SLOW_C +# define BN_MP_IS_SQUARE_C +# define BN_MP_JACOBI_C +# define BN_MP_KARATSUBA_MUL_C +# define BN_MP_KARATSUBA_SQR_C +# define BN_MP_LCM_C +# define BN_MP_LSHD_C +# define BN_MP_MOD_C +# define BN_MP_MOD_2D_C +# define BN_MP_MOD_D_C +# define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +# define BN_MP_MONTGOMERY_REDUCE_C +# define BN_MP_MONTGOMERY_SETUP_C +# define BN_MP_MUL_C +# define BN_MP_MUL_2_C +# define BN_MP_MUL_2D_C +# define BN_MP_MUL_D_C +# define BN_MP_MULMOD_C +# define BN_MP_N_ROOT_C +# define BN_MP_N_ROOT_EX_C +# define BN_MP_NEG_C +# define BN_MP_OR_C +# define BN_MP_PRIME_FERMAT_C +# define BN_MP_PRIME_IS_DIVISIBLE_C +# define BN_MP_PRIME_IS_PRIME_C +# define BN_MP_PRIME_MILLER_RABIN_C +# define BN_MP_PRIME_NEXT_PRIME_C +# define BN_MP_PRIME_RABIN_MILLER_TRIALS_C +# define BN_MP_PRIME_RANDOM_EX_C +# define BN_MP_RADIX_SIZE_C +# define BN_MP_RADIX_SMAP_C +# define BN_MP_RAND_C +# define BN_MP_READ_RADIX_C +# define BN_MP_READ_SIGNED_BIN_C +# define BN_MP_READ_UNSIGNED_BIN_C +# define BN_MP_REDUCE_C +# define BN_MP_REDUCE_2K_C +# define BN_MP_REDUCE_2K_L_C +# define BN_MP_REDUCE_2K_SETUP_C +# define BN_MP_REDUCE_2K_SETUP_L_C +# define BN_MP_REDUCE_IS_2K_C +# define BN_MP_REDUCE_IS_2K_L_C +# define BN_MP_REDUCE_SETUP_C +# define BN_MP_RSHD_C +# define BN_MP_SET_C +# define BN_MP_SET_INT_C +# define BN_MP_SET_LONG_C +# define BN_MP_SET_LONG_LONG_C +# define BN_MP_SHRINK_C +# define BN_MP_SIGNED_BIN_SIZE_C +# define BN_MP_SQR_C +# define BN_MP_SQRMOD_C +# define BN_MP_SQRT_C +# define BN_MP_SQRTMOD_PRIME_C +# define BN_MP_SUB_C +# define BN_MP_SUB_D_C +# define BN_MP_SUBMOD_C +# define BN_MP_TO_SIGNED_BIN_C +# define BN_MP_TO_SIGNED_BIN_N_C +# define BN_MP_TO_UNSIGNED_BIN_C +# define BN_MP_TO_UNSIGNED_BIN_N_C +# define BN_MP_TOOM_MUL_C +# define BN_MP_TOOM_SQR_C +# define BN_MP_TORADIX_C +# define BN_MP_TORADIX_N_C +# define BN_MP_UNSIGNED_BIN_SIZE_C +# define BN_MP_XOR_C +# define BN_MP_ZERO_C +# define BN_PRIME_TAB_C +# define BN_REVERSE_C +# define BN_S_MP_ADD_C +# define BN_S_MP_EXPTMOD_C +# define BN_S_MP_MUL_DIGS_C +# define BN_S_MP_MUL_HIGH_DIGS_C +# define BN_S_MP_SQR_C +# define BN_S_MP_SUB_C +# define BNCORE_C #endif #if defined(BN_ERROR_C) - #define BN_MP_ERROR_TO_STRING_C +# define BN_MP_ERROR_TO_STRING_C #endif #if defined(BN_FAST_MP_INVMOD_C) - #define BN_MP_ISEVEN_C - #define BN_MP_INIT_MULTI_C - #define BN_MP_COPY_C - #define BN_MP_MOD_C - #define BN_MP_SET_C - #define BN_MP_DIV_2_C - #define BN_MP_ISODD_C - #define BN_MP_SUB_C - #define BN_MP_CMP_C - #define BN_MP_ISZERO_C - #define BN_MP_CMP_D_C - #define BN_MP_ADD_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_ISEVEN_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_COPY_C +# define BN_MP_MOD_C +# define BN_MP_SET_C +# define BN_MP_DIV_2_C +# define BN_MP_ISODD_C +# define BN_MP_SUB_C +# define BN_MP_CMP_C +# define BN_MP_ISZERO_C +# define BN_MP_CMP_D_C +# define BN_MP_ADD_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_FAST_MP_MONTGOMERY_REDUCE_C) - #define BN_MP_GROW_C - #define BN_MP_RSHD_C - #define BN_MP_CLAMP_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C +# define BN_MP_GROW_C +# define BN_MP_RSHD_C +# define BN_MP_CLAMP_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C #endif #if defined(BN_FAST_S_MP_MUL_DIGS_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BN_FAST_S_MP_SQR_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_2EXPT_C) - #define BN_MP_ZERO_C - #define BN_MP_GROW_C +# define BN_MP_ZERO_C +# define BN_MP_GROW_C #endif #if defined(BN_MP_ABS_C) - #define BN_MP_COPY_C +# define BN_MP_COPY_C #endif #if defined(BN_MP_ADD_C) - #define BN_S_MP_ADD_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C +# define BN_S_MP_ADD_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C #endif #if defined(BN_MP_ADD_D_C) - #define BN_MP_GROW_C - #define BN_MP_SUB_D_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_SUB_D_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_ADDMOD_C) - #define BN_MP_INIT_C - #define BN_MP_ADD_C - #define BN_MP_CLEAR_C - #define BN_MP_MOD_C +# define BN_MP_INIT_C +# define BN_MP_ADD_C +# define BN_MP_CLEAR_C +# define BN_MP_MOD_C #endif #if defined(BN_MP_AND_C) - #define BN_MP_INIT_COPY_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_COPY_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_CLAMP_C) @@ -224,11 +224,11 @@ #endif #if defined(BN_MP_CLEAR_MULTI_C) - #define BN_MP_CLEAR_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_CMP_C) - #define BN_MP_CMP_MAG_C +# define BN_MP_CMP_MAG_C #endif #if defined(BN_MP_CMP_D_C) @@ -238,81 +238,81 @@ #endif #if defined(BN_MP_CNT_LSB_C) - #define BN_MP_ISZERO_C +# define BN_MP_ISZERO_C #endif #if defined(BN_MP_COPY_C) - #define BN_MP_GROW_C +# define BN_MP_GROW_C #endif #if defined(BN_MP_COUNT_BITS_C) #endif #if defined(BN_MP_DIV_C) - #define BN_MP_ISZERO_C - #define BN_MP_CMP_MAG_C - #define BN_MP_COPY_C - #define BN_MP_ZERO_C - #define BN_MP_INIT_MULTI_C - #define BN_MP_SET_C - #define BN_MP_COUNT_BITS_C - #define BN_MP_ABS_C - #define BN_MP_MUL_2D_C - #define BN_MP_CMP_C - #define BN_MP_SUB_C - #define BN_MP_ADD_C - #define BN_MP_DIV_2D_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_MULTI_C - #define BN_MP_INIT_SIZE_C - #define BN_MP_INIT_C - #define BN_MP_INIT_COPY_C - #define BN_MP_LSHD_C - #define BN_MP_RSHD_C - #define BN_MP_MUL_D_C - #define BN_MP_CLAMP_C - #define BN_MP_CLEAR_C +# define BN_MP_ISZERO_C +# define BN_MP_CMP_MAG_C +# define BN_MP_COPY_C +# define BN_MP_ZERO_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_SET_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_ABS_C +# define BN_MP_MUL_2D_C +# define BN_MP_CMP_C +# define BN_MP_SUB_C +# define BN_MP_ADD_C +# define BN_MP_DIV_2D_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_MULTI_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_INIT_C +# define BN_MP_INIT_COPY_C +# define BN_MP_LSHD_C +# define BN_MP_RSHD_C +# define BN_MP_MUL_D_C +# define BN_MP_CLAMP_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_DIV_2_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_DIV_2D_C) - #define BN_MP_COPY_C - #define BN_MP_ZERO_C - #define BN_MP_MOD_2D_C - #define BN_MP_RSHD_C - #define BN_MP_CLAMP_C +# define BN_MP_COPY_C +# define BN_MP_ZERO_C +# define BN_MP_MOD_2D_C +# define BN_MP_RSHD_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_DIV_3_C) - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_DIV_D_C) - #define BN_MP_ISZERO_C - #define BN_MP_COPY_C - #define BN_MP_DIV_2D_C - #define BN_MP_DIV_3_C - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_ISZERO_C +# define BN_MP_COPY_C +# define BN_MP_DIV_2D_C +# define BN_MP_DIV_3_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_DR_IS_MODULUS_C) #endif #if defined(BN_MP_DR_REDUCE_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C #endif #if defined(BN_MP_DR_SETUP_C) @@ -322,96 +322,96 @@ #endif #if defined(BN_MP_EXPORT_C) - #define BN_MP_INIT_COPY_C - #define BN_MP_COUNT_BITS_C - #define BN_MP_DIV_2D_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_COPY_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_DIV_2D_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_EXPT_D_C) - #define BN_MP_EXPT_D_EX_C +# define BN_MP_EXPT_D_EX_C #endif #if defined(BN_MP_EXPT_D_EX_C) - #define BN_MP_INIT_COPY_C - #define BN_MP_SET_C - #define BN_MP_MUL_C - #define BN_MP_CLEAR_C - #define BN_MP_SQR_C +# define BN_MP_INIT_COPY_C +# define BN_MP_SET_C +# define BN_MP_MUL_C +# define BN_MP_CLEAR_C +# define BN_MP_SQR_C #endif #if defined(BN_MP_EXPTMOD_C) - #define BN_MP_INIT_C - #define BN_MP_INVMOD_C - #define BN_MP_CLEAR_C - #define BN_MP_ABS_C - #define BN_MP_CLEAR_MULTI_C - #define BN_MP_REDUCE_IS_2K_L_C - #define BN_S_MP_EXPTMOD_C - #define BN_MP_DR_IS_MODULUS_C - #define BN_MP_REDUCE_IS_2K_C - #define BN_MP_ISODD_C - #define BN_MP_EXPTMOD_FAST_C +# define BN_MP_INIT_C +# define BN_MP_INVMOD_C +# define BN_MP_CLEAR_C +# define BN_MP_ABS_C +# define BN_MP_CLEAR_MULTI_C +# define BN_MP_REDUCE_IS_2K_L_C +# define BN_S_MP_EXPTMOD_C +# define BN_MP_DR_IS_MODULUS_C +# define BN_MP_REDUCE_IS_2K_C +# define BN_MP_ISODD_C +# define BN_MP_EXPTMOD_FAST_C #endif #if defined(BN_MP_EXPTMOD_FAST_C) - #define BN_MP_COUNT_BITS_C - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLEAR_C - #define BN_MP_MONTGOMERY_SETUP_C - #define BN_FAST_MP_MONTGOMERY_REDUCE_C - #define BN_MP_MONTGOMERY_REDUCE_C - #define BN_MP_DR_SETUP_C - #define BN_MP_DR_REDUCE_C - #define BN_MP_REDUCE_2K_SETUP_C - #define BN_MP_REDUCE_2K_C - #define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C - #define BN_MP_MULMOD_C - #define BN_MP_SET_C - #define BN_MP_MOD_C - #define BN_MP_COPY_C - #define BN_MP_SQR_C - #define BN_MP_MUL_C - #define BN_MP_EXCH_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLEAR_C +# define BN_MP_MONTGOMERY_SETUP_C +# define BN_FAST_MP_MONTGOMERY_REDUCE_C +# define BN_MP_MONTGOMERY_REDUCE_C +# define BN_MP_DR_SETUP_C +# define BN_MP_DR_REDUCE_C +# define BN_MP_REDUCE_2K_SETUP_C +# define BN_MP_REDUCE_2K_C +# define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C +# define BN_MP_MULMOD_C +# define BN_MP_SET_C +# define BN_MP_MOD_C +# define BN_MP_COPY_C +# define BN_MP_SQR_C +# define BN_MP_MUL_C +# define BN_MP_EXCH_C #endif #if defined(BN_MP_EXTEUCLID_C) - #define BN_MP_INIT_MULTI_C - #define BN_MP_SET_C - #define BN_MP_COPY_C - #define BN_MP_ISZERO_C - #define BN_MP_DIV_C - #define BN_MP_MUL_C - #define BN_MP_SUB_C - #define BN_MP_NEG_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_SET_C +# define BN_MP_COPY_C +# define BN_MP_ISZERO_C +# define BN_MP_DIV_C +# define BN_MP_MUL_C +# define BN_MP_SUB_C +# define BN_MP_NEG_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_MP_FREAD_C) - #define BN_MP_ZERO_C - #define BN_MP_S_RMAP_C - #define BN_MP_MUL_D_C - #define BN_MP_ADD_D_C - #define BN_MP_CMP_D_C +# define BN_MP_ZERO_C +# define BN_MP_S_RMAP_C +# define BN_MP_MUL_D_C +# define BN_MP_ADD_D_C +# define BN_MP_CMP_D_C #endif #if defined(BN_MP_FWRITE_C) - #define BN_MP_RADIX_SIZE_C - #define BN_MP_TORADIX_C +# define BN_MP_RADIX_SIZE_C +# define BN_MP_TORADIX_C #endif #if defined(BN_MP_GCD_C) - #define BN_MP_ISZERO_C - #define BN_MP_ABS_C - #define BN_MP_INIT_COPY_C - #define BN_MP_CNT_LSB_C - #define BN_MP_DIV_2D_C - #define BN_MP_CMP_MAG_C - #define BN_MP_EXCH_C - #define BN_S_MP_SUB_C - #define BN_MP_MUL_2D_C - #define BN_MP_CLEAR_C +# define BN_MP_ISZERO_C +# define BN_MP_ABS_C +# define BN_MP_INIT_COPY_C +# define BN_MP_CNT_LSB_C +# define BN_MP_DIV_2D_C +# define BN_MP_CMP_MAG_C +# define BN_MP_EXCH_C +# define BN_S_MP_SUB_C +# define BN_MP_MUL_2D_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_GET_INT_C) @@ -427,402 +427,402 @@ #endif #if defined(BN_MP_IMPORT_C) - #define BN_MP_ZERO_C - #define BN_MP_MUL_2D_C - #define BN_MP_CLAMP_C +# define BN_MP_ZERO_C +# define BN_MP_MUL_2D_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_INIT_C) #endif #if defined(BN_MP_INIT_COPY_C) - #define BN_MP_INIT_SIZE_C - #define BN_MP_COPY_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_COPY_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_INIT_MULTI_C) - #define BN_MP_ERR_C - #define BN_MP_INIT_C - #define BN_MP_CLEAR_C +# define BN_MP_ERR_C +# define BN_MP_INIT_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_INIT_SET_C) - #define BN_MP_INIT_C - #define BN_MP_SET_C +# define BN_MP_INIT_C +# define BN_MP_SET_C #endif #if defined(BN_MP_INIT_SET_INT_C) - #define BN_MP_INIT_C - #define BN_MP_SET_INT_C +# define BN_MP_INIT_C +# define BN_MP_SET_INT_C #endif #if defined(BN_MP_INIT_SIZE_C) - #define BN_MP_INIT_C +# define BN_MP_INIT_C #endif #if defined(BN_MP_INVMOD_C) - #define BN_MP_ISZERO_C - #define BN_MP_ISODD_C - #define BN_MP_CMP_D_C - #define BN_FAST_MP_INVMOD_C - #define BN_MP_INVMOD_SLOW_C +# define BN_MP_ISZERO_C +# define BN_MP_ISODD_C +# define BN_MP_CMP_D_C +# define BN_FAST_MP_INVMOD_C +# define BN_MP_INVMOD_SLOW_C #endif #if defined(BN_MP_INVMOD_SLOW_C) - #define BN_MP_ISZERO_C - #define BN_MP_INIT_MULTI_C - #define BN_MP_MOD_C - #define BN_MP_COPY_C - #define BN_MP_ISEVEN_C - #define BN_MP_SET_C - #define BN_MP_DIV_2_C - #define BN_MP_ISODD_C - #define BN_MP_ADD_C - #define BN_MP_SUB_C - #define BN_MP_CMP_C - #define BN_MP_CMP_D_C - #define BN_MP_CMP_MAG_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_ISZERO_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_MOD_C +# define BN_MP_COPY_C +# define BN_MP_ISEVEN_C +# define BN_MP_SET_C +# define BN_MP_DIV_2_C +# define BN_MP_ISODD_C +# define BN_MP_ADD_C +# define BN_MP_SUB_C +# define BN_MP_CMP_C +# define BN_MP_CMP_D_C +# define BN_MP_CMP_MAG_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_MP_IS_SQUARE_C) - #define BN_MP_MOD_D_C - #define BN_MP_INIT_SET_INT_C - #define BN_MP_MOD_C - #define BN_MP_GET_INT_C - #define BN_MP_SQRT_C - #define BN_MP_SQR_C - #define BN_MP_CMP_MAG_C - #define BN_MP_CLEAR_C +# define BN_MP_MOD_D_C +# define BN_MP_INIT_SET_INT_C +# define BN_MP_MOD_C +# define BN_MP_GET_INT_C +# define BN_MP_SQRT_C +# define BN_MP_SQR_C +# define BN_MP_CMP_MAG_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_JACOBI_C) - #define BN_MP_ISNEG_C - #define BN_MP_CMP_D_C - #define BN_MP_ISZERO_C - #define BN_MP_INIT_COPY_C - #define BN_MP_CNT_LSB_C - #define BN_MP_DIV_2D_C - #define BN_MP_MOD_C - #define BN_MP_CLEAR_C +# define BN_MP_ISNEG_C +# define BN_MP_CMP_D_C +# define BN_MP_ISZERO_C +# define BN_MP_INIT_COPY_C +# define BN_MP_CNT_LSB_C +# define BN_MP_DIV_2D_C +# define BN_MP_MOD_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_KARATSUBA_MUL_C) - #define BN_MP_MUL_C - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_S_MP_ADD_C - #define BN_MP_ADD_C - #define BN_S_MP_SUB_C - #define BN_MP_LSHD_C - #define BN_MP_CLEAR_C +# define BN_MP_MUL_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_S_MP_ADD_C +# define BN_MP_ADD_C +# define BN_S_MP_SUB_C +# define BN_MP_LSHD_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_KARATSUBA_SQR_C) - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_MP_SQR_C - #define BN_S_MP_ADD_C - #define BN_S_MP_SUB_C - #define BN_MP_LSHD_C - #define BN_MP_ADD_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_MP_SQR_C +# define BN_S_MP_ADD_C +# define BN_S_MP_SUB_C +# define BN_MP_LSHD_C +# define BN_MP_ADD_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_LCM_C) - #define BN_MP_INIT_MULTI_C - #define BN_MP_GCD_C - #define BN_MP_CMP_MAG_C - #define BN_MP_DIV_C - #define BN_MP_MUL_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_GCD_C +# define BN_MP_CMP_MAG_C +# define BN_MP_DIV_C +# define BN_MP_MUL_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_MP_LSHD_C) - #define BN_MP_GROW_C - #define BN_MP_RSHD_C +# define BN_MP_GROW_C +# define BN_MP_RSHD_C #endif #if defined(BN_MP_MOD_C) - #define BN_MP_INIT_SIZE_C - #define BN_MP_DIV_C - #define BN_MP_CLEAR_C - #define BN_MP_ISZERO_C - #define BN_MP_EXCH_C - #define BN_MP_ADD_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_DIV_C +# define BN_MP_CLEAR_C +# define BN_MP_ISZERO_C +# define BN_MP_EXCH_C +# define BN_MP_ADD_C #endif #if defined(BN_MP_MOD_2D_C) - #define BN_MP_ZERO_C - #define BN_MP_COPY_C - #define BN_MP_CLAMP_C +# define BN_MP_ZERO_C +# define BN_MP_COPY_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_MOD_D_C) - #define BN_MP_DIV_D_C +# define BN_MP_DIV_D_C #endif #if defined(BN_MP_MONTGOMERY_CALC_NORMALIZATION_C) - #define BN_MP_COUNT_BITS_C - #define BN_MP_2EXPT_C - #define BN_MP_SET_C - #define BN_MP_MUL_2_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_2EXPT_C +# define BN_MP_SET_C +# define BN_MP_MUL_2_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C #endif #if defined(BN_MP_MONTGOMERY_REDUCE_C) - #define BN_FAST_MP_MONTGOMERY_REDUCE_C - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C - #define BN_MP_RSHD_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C +# define BN_FAST_MP_MONTGOMERY_REDUCE_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C +# define BN_MP_RSHD_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C #endif #if defined(BN_MP_MONTGOMERY_SETUP_C) #endif #if defined(BN_MP_MUL_C) - #define BN_MP_TOOM_MUL_C - #define BN_MP_KARATSUBA_MUL_C - #define BN_FAST_S_MP_MUL_DIGS_C - #define BN_S_MP_MUL_C - #define BN_S_MP_MUL_DIGS_C +# define BN_MP_TOOM_MUL_C +# define BN_MP_KARATSUBA_MUL_C +# define BN_FAST_S_MP_MUL_DIGS_C +# define BN_S_MP_MUL_C +# define BN_S_MP_MUL_DIGS_C #endif #if defined(BN_MP_MUL_2_C) - #define BN_MP_GROW_C +# define BN_MP_GROW_C #endif #if defined(BN_MP_MUL_2D_C) - #define BN_MP_COPY_C - #define BN_MP_GROW_C - #define BN_MP_LSHD_C - #define BN_MP_CLAMP_C +# define BN_MP_COPY_C +# define BN_MP_GROW_C +# define BN_MP_LSHD_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_MUL_D_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_MULMOD_C) - #define BN_MP_INIT_SIZE_C - #define BN_MP_MUL_C - #define BN_MP_CLEAR_C - #define BN_MP_MOD_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_MUL_C +# define BN_MP_CLEAR_C +# define BN_MP_MOD_C #endif #if defined(BN_MP_N_ROOT_C) - #define BN_MP_N_ROOT_EX_C +# define BN_MP_N_ROOT_EX_C #endif #if defined(BN_MP_N_ROOT_EX_C) - #define BN_MP_INIT_C - #define BN_MP_SET_C - #define BN_MP_COPY_C - #define BN_MP_EXPT_D_EX_C - #define BN_MP_MUL_C - #define BN_MP_SUB_C - #define BN_MP_MUL_D_C - #define BN_MP_DIV_C - #define BN_MP_CMP_C - #define BN_MP_SUB_D_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_C +# define BN_MP_SET_C +# define BN_MP_COPY_C +# define BN_MP_EXPT_D_EX_C +# define BN_MP_MUL_C +# define BN_MP_SUB_C +# define BN_MP_MUL_D_C +# define BN_MP_DIV_C +# define BN_MP_CMP_C +# define BN_MP_SUB_D_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_NEG_C) - #define BN_MP_COPY_C - #define BN_MP_ISZERO_C +# define BN_MP_COPY_C +# define BN_MP_ISZERO_C #endif #if defined(BN_MP_OR_C) - #define BN_MP_INIT_COPY_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_COPY_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_PRIME_FERMAT_C) - #define BN_MP_CMP_D_C - #define BN_MP_INIT_C - #define BN_MP_EXPTMOD_C - #define BN_MP_CMP_C - #define BN_MP_CLEAR_C +# define BN_MP_CMP_D_C +# define BN_MP_INIT_C +# define BN_MP_EXPTMOD_C +# define BN_MP_CMP_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_PRIME_IS_DIVISIBLE_C) - #define BN_MP_MOD_D_C +# define BN_MP_MOD_D_C #endif #if defined(BN_MP_PRIME_IS_PRIME_C) - #define BN_MP_CMP_D_C - #define BN_MP_PRIME_IS_DIVISIBLE_C - #define BN_MP_INIT_C - #define BN_MP_SET_C - #define BN_MP_PRIME_MILLER_RABIN_C - #define BN_MP_CLEAR_C +# define BN_MP_CMP_D_C +# define BN_MP_PRIME_IS_DIVISIBLE_C +# define BN_MP_INIT_C +# define BN_MP_SET_C +# define BN_MP_PRIME_MILLER_RABIN_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_PRIME_MILLER_RABIN_C) - #define BN_MP_CMP_D_C - #define BN_MP_INIT_COPY_C - #define BN_MP_SUB_D_C - #define BN_MP_CNT_LSB_C - #define BN_MP_DIV_2D_C - #define BN_MP_EXPTMOD_C - #define BN_MP_CMP_C - #define BN_MP_SQRMOD_C - #define BN_MP_CLEAR_C +# define BN_MP_CMP_D_C +# define BN_MP_INIT_COPY_C +# define BN_MP_SUB_D_C +# define BN_MP_CNT_LSB_C +# define BN_MP_DIV_2D_C +# define BN_MP_EXPTMOD_C +# define BN_MP_CMP_C +# define BN_MP_SQRMOD_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_PRIME_NEXT_PRIME_C) - #define BN_MP_CMP_D_C - #define BN_MP_SET_C - #define BN_MP_SUB_D_C - #define BN_MP_ISEVEN_C - #define BN_MP_MOD_D_C - #define BN_MP_INIT_C - #define BN_MP_ADD_D_C - #define BN_MP_PRIME_MILLER_RABIN_C - #define BN_MP_CLEAR_C +# define BN_MP_CMP_D_C +# define BN_MP_SET_C +# define BN_MP_SUB_D_C +# define BN_MP_ISEVEN_C +# define BN_MP_MOD_D_C +# define BN_MP_INIT_C +# define BN_MP_ADD_D_C +# define BN_MP_PRIME_MILLER_RABIN_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_PRIME_RABIN_MILLER_TRIALS_C) #endif #if defined(BN_MP_PRIME_RANDOM_EX_C) - #define BN_MP_READ_UNSIGNED_BIN_C - #define BN_MP_PRIME_IS_PRIME_C - #define BN_MP_SUB_D_C - #define BN_MP_DIV_2_C - #define BN_MP_MUL_2_C - #define BN_MP_ADD_D_C +# define BN_MP_READ_UNSIGNED_BIN_C +# define BN_MP_PRIME_IS_PRIME_C +# define BN_MP_SUB_D_C +# define BN_MP_DIV_2_C +# define BN_MP_MUL_2_C +# define BN_MP_ADD_D_C #endif #if defined(BN_MP_RADIX_SIZE_C) - #define BN_MP_ISZERO_C - #define BN_MP_COUNT_BITS_C - #define BN_MP_INIT_COPY_C - #define BN_MP_DIV_D_C - #define BN_MP_CLEAR_C +# define BN_MP_ISZERO_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_INIT_COPY_C +# define BN_MP_DIV_D_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_RADIX_SMAP_C) - #define BN_MP_S_RMAP_C +# define BN_MP_S_RMAP_C #endif #if defined(BN_MP_RAND_C) - #define BN_MP_ZERO_C - #define BN_MP_ADD_D_C - #define BN_MP_LSHD_C +# define BN_MP_ZERO_C +# define BN_MP_ADD_D_C +# define BN_MP_LSHD_C #endif #if defined(BN_MP_READ_RADIX_C) - #define BN_MP_ZERO_C - #define BN_MP_S_RMAP_C - #define BN_MP_MUL_D_C - #define BN_MP_ADD_D_C - #define BN_MP_ISZERO_C +# define BN_MP_ZERO_C +# define BN_MP_S_RMAP_C +# define BN_MP_MUL_D_C +# define BN_MP_ADD_D_C +# define BN_MP_ISZERO_C #endif #if defined(BN_MP_READ_SIGNED_BIN_C) - #define BN_MP_READ_UNSIGNED_BIN_C +# define BN_MP_READ_UNSIGNED_BIN_C #endif #if defined(BN_MP_READ_UNSIGNED_BIN_C) - #define BN_MP_GROW_C - #define BN_MP_ZERO_C - #define BN_MP_MUL_2D_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_ZERO_C +# define BN_MP_MUL_2D_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_REDUCE_C) - #define BN_MP_REDUCE_SETUP_C - #define BN_MP_INIT_COPY_C - #define BN_MP_RSHD_C - #define BN_MP_MUL_C - #define BN_S_MP_MUL_HIGH_DIGS_C - #define BN_FAST_S_MP_MUL_HIGH_DIGS_C - #define BN_MP_MOD_2D_C - #define BN_S_MP_MUL_DIGS_C - #define BN_MP_SUB_C - #define BN_MP_CMP_D_C - #define BN_MP_SET_C - #define BN_MP_LSHD_C - #define BN_MP_ADD_C - #define BN_MP_CMP_C - #define BN_S_MP_SUB_C - #define BN_MP_CLEAR_C +# define BN_MP_REDUCE_SETUP_C +# define BN_MP_INIT_COPY_C +# define BN_MP_RSHD_C +# define BN_MP_MUL_C +# define BN_S_MP_MUL_HIGH_DIGS_C +# define BN_FAST_S_MP_MUL_HIGH_DIGS_C +# define BN_MP_MOD_2D_C +# define BN_S_MP_MUL_DIGS_C +# define BN_MP_SUB_C +# define BN_MP_CMP_D_C +# define BN_MP_SET_C +# define BN_MP_LSHD_C +# define BN_MP_ADD_C +# define BN_MP_CMP_C +# define BN_S_MP_SUB_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_REDUCE_2K_C) - #define BN_MP_INIT_C - #define BN_MP_COUNT_BITS_C - #define BN_MP_DIV_2D_C - #define BN_MP_MUL_D_C - #define BN_S_MP_ADD_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_DIV_2D_C +# define BN_MP_MUL_D_C +# define BN_S_MP_ADD_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_REDUCE_2K_L_C) - #define BN_MP_INIT_C - #define BN_MP_COUNT_BITS_C - #define BN_MP_DIV_2D_C - #define BN_MP_MUL_C - #define BN_S_MP_ADD_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_DIV_2D_C +# define BN_MP_MUL_C +# define BN_S_MP_ADD_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_REDUCE_2K_SETUP_C) - #define BN_MP_INIT_C - #define BN_MP_COUNT_BITS_C - #define BN_MP_2EXPT_C - #define BN_MP_CLEAR_C - #define BN_S_MP_SUB_C +# define BN_MP_INIT_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_2EXPT_C +# define BN_MP_CLEAR_C +# define BN_S_MP_SUB_C #endif #if defined(BN_MP_REDUCE_2K_SETUP_L_C) - #define BN_MP_INIT_C - #define BN_MP_2EXPT_C - #define BN_MP_COUNT_BITS_C - #define BN_S_MP_SUB_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_C +# define BN_MP_2EXPT_C +# define BN_MP_COUNT_BITS_C +# define BN_S_MP_SUB_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_REDUCE_IS_2K_C) - #define BN_MP_REDUCE_2K_C - #define BN_MP_COUNT_BITS_C +# define BN_MP_REDUCE_2K_C +# define BN_MP_COUNT_BITS_C #endif #if defined(BN_MP_REDUCE_IS_2K_L_C) #endif #if defined(BN_MP_REDUCE_SETUP_C) - #define BN_MP_2EXPT_C - #define BN_MP_DIV_C +# define BN_MP_2EXPT_C +# define BN_MP_DIV_C #endif #if defined(BN_MP_RSHD_C) - #define BN_MP_ZERO_C +# define BN_MP_ZERO_C #endif #if defined(BN_MP_SET_C) - #define BN_MP_ZERO_C +# define BN_MP_ZERO_C #endif #if defined(BN_MP_SET_INT_C) - #define BN_MP_ZERO_C - #define BN_MP_MUL_2D_C - #define BN_MP_CLAMP_C +# define BN_MP_ZERO_C +# define BN_MP_MUL_2D_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_SET_LONG_C) @@ -835,155 +835,155 @@ #endif #if defined(BN_MP_SIGNED_BIN_SIZE_C) - #define BN_MP_UNSIGNED_BIN_SIZE_C +# define BN_MP_UNSIGNED_BIN_SIZE_C #endif #if defined(BN_MP_SQR_C) - #define BN_MP_TOOM_SQR_C - #define BN_MP_KARATSUBA_SQR_C - #define BN_FAST_S_MP_SQR_C - #define BN_S_MP_SQR_C +# define BN_MP_TOOM_SQR_C +# define BN_MP_KARATSUBA_SQR_C +# define BN_FAST_S_MP_SQR_C +# define BN_S_MP_SQR_C #endif #if defined(BN_MP_SQRMOD_C) - #define BN_MP_INIT_C - #define BN_MP_SQR_C - #define BN_MP_CLEAR_C - #define BN_MP_MOD_C +# define BN_MP_INIT_C +# define BN_MP_SQR_C +# define BN_MP_CLEAR_C +# define BN_MP_MOD_C #endif #if defined(BN_MP_SQRT_C) - #define BN_MP_N_ROOT_C - #define BN_MP_ISZERO_C - #define BN_MP_ZERO_C - #define BN_MP_INIT_COPY_C - #define BN_MP_RSHD_C - #define BN_MP_DIV_C - #define BN_MP_ADD_C - #define BN_MP_DIV_2_C - #define BN_MP_CMP_MAG_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_N_ROOT_C +# define BN_MP_ISZERO_C +# define BN_MP_ZERO_C +# define BN_MP_INIT_COPY_C +# define BN_MP_RSHD_C +# define BN_MP_DIV_C +# define BN_MP_ADD_C +# define BN_MP_DIV_2_C +# define BN_MP_CMP_MAG_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_SQRTMOD_PRIME_C) - #define BN_MP_CMP_D_C - #define BN_MP_ZERO_C - #define BN_MP_JACOBI_C - #define BN_MP_INIT_MULTI_C - #define BN_MP_MOD_D_C - #define BN_MP_ADD_D_C - #define BN_MP_DIV_2_C - #define BN_MP_EXPTMOD_C - #define BN_MP_COPY_C - #define BN_MP_SUB_D_C - #define BN_MP_ISEVEN_C - #define BN_MP_SET_INT_C - #define BN_MP_SQRMOD_C - #define BN_MP_MULMOD_C - #define BN_MP_SET_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_CMP_D_C +# define BN_MP_ZERO_C +# define BN_MP_JACOBI_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_MOD_D_C +# define BN_MP_ADD_D_C +# define BN_MP_DIV_2_C +# define BN_MP_EXPTMOD_C +# define BN_MP_COPY_C +# define BN_MP_SUB_D_C +# define BN_MP_ISEVEN_C +# define BN_MP_SET_INT_C +# define BN_MP_SQRMOD_C +# define BN_MP_MULMOD_C +# define BN_MP_SET_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_MP_SUB_C) - #define BN_S_MP_ADD_C - #define BN_MP_CMP_MAG_C - #define BN_S_MP_SUB_C +# define BN_S_MP_ADD_C +# define BN_MP_CMP_MAG_C +# define BN_S_MP_SUB_C #endif #if defined(BN_MP_SUB_D_C) - #define BN_MP_GROW_C - #define BN_MP_ADD_D_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_ADD_D_C +# define BN_MP_CLAMP_C #endif #if defined(BN_MP_SUBMOD_C) - #define BN_MP_INIT_C - #define BN_MP_SUB_C - #define BN_MP_CLEAR_C - #define BN_MP_MOD_C +# define BN_MP_INIT_C +# define BN_MP_SUB_C +# define BN_MP_CLEAR_C +# define BN_MP_MOD_C #endif #if defined(BN_MP_TO_SIGNED_BIN_C) - #define BN_MP_TO_UNSIGNED_BIN_C +# define BN_MP_TO_UNSIGNED_BIN_C #endif #if defined(BN_MP_TO_SIGNED_BIN_N_C) - #define BN_MP_SIGNED_BIN_SIZE_C - #define BN_MP_TO_SIGNED_BIN_C +# define BN_MP_SIGNED_BIN_SIZE_C +# define BN_MP_TO_SIGNED_BIN_C #endif #if defined(BN_MP_TO_UNSIGNED_BIN_C) - #define BN_MP_INIT_COPY_C - #define BN_MP_ISZERO_C - #define BN_MP_DIV_2D_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_COPY_C +# define BN_MP_ISZERO_C +# define BN_MP_DIV_2D_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_TO_UNSIGNED_BIN_N_C) - #define BN_MP_UNSIGNED_BIN_SIZE_C - #define BN_MP_TO_UNSIGNED_BIN_C +# define BN_MP_UNSIGNED_BIN_SIZE_C +# define BN_MP_TO_UNSIGNED_BIN_C #endif #if defined(BN_MP_TOOM_MUL_C) - #define BN_MP_INIT_MULTI_C - #define BN_MP_MOD_2D_C - #define BN_MP_COPY_C - #define BN_MP_RSHD_C - #define BN_MP_MUL_C - #define BN_MP_MUL_2_C - #define BN_MP_ADD_C - #define BN_MP_SUB_C - #define BN_MP_DIV_2_C - #define BN_MP_MUL_2D_C - #define BN_MP_MUL_D_C - #define BN_MP_DIV_3_C - #define BN_MP_LSHD_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_MOD_2D_C +# define BN_MP_COPY_C +# define BN_MP_RSHD_C +# define BN_MP_MUL_C +# define BN_MP_MUL_2_C +# define BN_MP_ADD_C +# define BN_MP_SUB_C +# define BN_MP_DIV_2_C +# define BN_MP_MUL_2D_C +# define BN_MP_MUL_D_C +# define BN_MP_DIV_3_C +# define BN_MP_LSHD_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_MP_TOOM_SQR_C) - #define BN_MP_INIT_MULTI_C - #define BN_MP_MOD_2D_C - #define BN_MP_COPY_C - #define BN_MP_RSHD_C - #define BN_MP_SQR_C - #define BN_MP_MUL_2_C - #define BN_MP_ADD_C - #define BN_MP_SUB_C - #define BN_MP_DIV_2_C - #define BN_MP_MUL_2D_C - #define BN_MP_MUL_D_C - #define BN_MP_DIV_3_C - #define BN_MP_LSHD_C - #define BN_MP_CLEAR_MULTI_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_MOD_2D_C +# define BN_MP_COPY_C +# define BN_MP_RSHD_C +# define BN_MP_SQR_C +# define BN_MP_MUL_2_C +# define BN_MP_ADD_C +# define BN_MP_SUB_C +# define BN_MP_DIV_2_C +# define BN_MP_MUL_2D_C +# define BN_MP_MUL_D_C +# define BN_MP_DIV_3_C +# define BN_MP_LSHD_C +# define BN_MP_CLEAR_MULTI_C #endif #if defined(BN_MP_TORADIX_C) - #define BN_MP_ISZERO_C - #define BN_MP_INIT_COPY_C - #define BN_MP_DIV_D_C - #define BN_MP_CLEAR_C - #define BN_MP_S_RMAP_C +# define BN_MP_ISZERO_C +# define BN_MP_INIT_COPY_C +# define BN_MP_DIV_D_C +# define BN_MP_CLEAR_C +# define BN_MP_S_RMAP_C #endif #if defined(BN_MP_TORADIX_N_C) - #define BN_MP_ISZERO_C - #define BN_MP_INIT_COPY_C - #define BN_MP_DIV_D_C - #define BN_MP_CLEAR_C - #define BN_MP_S_RMAP_C +# define BN_MP_ISZERO_C +# define BN_MP_INIT_COPY_C +# define BN_MP_DIV_D_C +# define BN_MP_CLEAR_C +# define BN_MP_S_RMAP_C #endif #if defined(BN_MP_UNSIGNED_BIN_SIZE_C) - #define BN_MP_COUNT_BITS_C +# define BN_MP_COUNT_BITS_C #endif #if defined(BN_MP_XOR_C) - #define BN_MP_INIT_COPY_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_COPY_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_MP_ZERO_C) @@ -996,62 +996,63 @@ #endif #if defined(BN_S_MP_ADD_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BN_S_MP_EXPTMOD_C) - #define BN_MP_COUNT_BITS_C - #define BN_MP_INIT_C - #define BN_MP_CLEAR_C - #define BN_MP_REDUCE_SETUP_C - #define BN_MP_REDUCE_C - #define BN_MP_REDUCE_2K_SETUP_L_C - #define BN_MP_REDUCE_2K_L_C - #define BN_MP_MOD_C - #define BN_MP_COPY_C - #define BN_MP_SQR_C - #define BN_MP_MUL_C - #define BN_MP_SET_C - #define BN_MP_EXCH_C +# define BN_MP_COUNT_BITS_C +# define BN_MP_INIT_C +# define BN_MP_CLEAR_C +# define BN_MP_REDUCE_SETUP_C +# define BN_MP_REDUCE_C +# define BN_MP_REDUCE_2K_SETUP_L_C +# define BN_MP_REDUCE_2K_L_C +# define BN_MP_MOD_C +# define BN_MP_COPY_C +# define BN_MP_SQR_C +# define BN_MP_MUL_C +# define BN_MP_SET_C +# define BN_MP_EXCH_C #endif #if defined(BN_S_MP_MUL_DIGS_C) - #define BN_FAST_S_MP_MUL_DIGS_C - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_FAST_S_MP_MUL_DIGS_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_S_MP_MUL_HIGH_DIGS_C) - #define BN_FAST_S_MP_MUL_HIGH_DIGS_C - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_FAST_S_MP_MUL_HIGH_DIGS_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_S_MP_SQR_C) - #define BN_MP_INIT_SIZE_C - #define BN_MP_CLAMP_C - #define BN_MP_EXCH_C - #define BN_MP_CLEAR_C +# define BN_MP_INIT_SIZE_C +# define BN_MP_CLAMP_C +# define BN_MP_EXCH_C +# define BN_MP_CLEAR_C #endif #if defined(BN_S_MP_SUB_C) - #define BN_MP_GROW_C - #define BN_MP_CLAMP_C +# define BN_MP_GROW_C +# define BN_MP_CLAMP_C #endif #if defined(BNCORE_C) #endif #ifdef LTM3 -#define LTM_LAST +# define LTM_LAST #endif + #include #include #else -#define LTM_LAST +# define LTM_LAST #endif diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index aeda684..ee39694 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -19,39 +19,39 @@ #include #ifndef MIN - #define MIN(x,y) (((x) < (y)) ? (x) : (y)) +#define MIN(x, y) (((x) < (y)) ? (x) : (y)) #endif #ifndef MAX - #define MAX(x,y) (((x) > (y)) ? (x) : (y)) +#define MAX(x, y) (((x) > (y)) ? (x) : (y)) #endif #ifdef __cplusplus extern "C" { /* C++ compilers don't like assigning void * to mp_digit * */ -#define OPT_CAST(x) (x *) +#define OPT_CAST(x) (x *) #else /* C on the other hand doesn't care */ -#define OPT_CAST(x) +#define OPT_CAST(x) #endif /* define heap macros */ #ifndef XMALLOC - /* default to libc stuff */ - #define XMALLOC malloc - #define XFREE free - #define XREALLOC realloc - #define XCALLOC calloc +/* default to libc stuff */ +# 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 *XREALLOC(void *p, size_t n); - extern void *XCALLOC(size_t n, size_t s); - extern void XFREE(void *p); +/* prototypes for our heap functions */ +extern void *XMALLOC(size_t n); +extern void *XREALLOC(void *p, size_t n); +extern void *XCALLOC(size_t n, size_t s); +extern void XFREE(void *p); #endif /* lowlevel functions, do not call! */ @@ -69,10 +69,10 @@ int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); int mp_karatsuba_sqr(mp_int *a, mp_int *b); int mp_toom_sqr(mp_int *a, mp_int *b); int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c); -int mp_invmod_slow (mp_int * a, mp_int * b, mp_int * c); +int mp_invmod_slow(mp_int *a, mp_int *b, mp_int *c); int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho); int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode); -int s_mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y, int redmode); +int s_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode); void bn_reverse(unsigned char *s, int len); extern const char *mp_s_rmap; @@ -112,7 +112,7 @@ int func_name (mp_int * a, type b) \ } #ifdef __cplusplus - } +} #endif #endif diff --git a/libtommath/tommath_superclass.h b/libtommath/tommath_superclass.h index a2f4d93..da53793 100644 --- a/libtommath/tommath_superclass.h +++ b/libtommath/tommath_superclass.h @@ -14,60 +14,60 @@ /* Works for RSA only, mpi.o is 68KiB */ #ifdef SC_RSA_1 - #define BN_MP_SHRINK_C - #define BN_MP_LCM_C - #define BN_MP_PRIME_RANDOM_EX_C - #define BN_MP_INVMOD_C - #define BN_MP_GCD_C - #define BN_MP_MOD_C - #define BN_MP_MULMOD_C - #define BN_MP_ADDMOD_C - #define BN_MP_EXPTMOD_C - #define BN_MP_SET_INT_C - #define BN_MP_INIT_MULTI_C - #define BN_MP_CLEAR_MULTI_C - #define BN_MP_UNSIGNED_BIN_SIZE_C - #define BN_MP_TO_UNSIGNED_BIN_C - #define BN_MP_MOD_D_C - #define BN_MP_PRIME_RABIN_MILLER_TRIALS_C - #define BN_REVERSE_C - #define BN_PRIME_TAB_C +# define BN_MP_SHRINK_C +# define BN_MP_LCM_C +# define BN_MP_PRIME_RANDOM_EX_C +# define BN_MP_INVMOD_C +# define BN_MP_GCD_C +# define BN_MP_MOD_C +# define BN_MP_MULMOD_C +# define BN_MP_ADDMOD_C +# define BN_MP_EXPTMOD_C +# define BN_MP_SET_INT_C +# define BN_MP_INIT_MULTI_C +# define BN_MP_CLEAR_MULTI_C +# define BN_MP_UNSIGNED_BIN_SIZE_C +# define BN_MP_TO_UNSIGNED_BIN_C +# define BN_MP_MOD_D_C +# define BN_MP_PRIME_RABIN_MILLER_TRIALS_C +# define BN_REVERSE_C +# define BN_PRIME_TAB_C - /* other modifiers */ - #define BN_MP_DIV_SMALL /* Slower division, not critical */ +/* other modifiers */ +# define BN_MP_DIV_SMALL /* Slower division, not critical */ - /* here we are on the last pass so we turn things off. The functions classes are still there - * but we remove them specifically from the build. This also invokes tweaks in functions - * like removing support for even moduli, etc... - */ -#ifdef LTM_LAST - #undef BN_MP_TOOM_MUL_C - #undef BN_MP_TOOM_SQR_C - #undef BN_MP_KARATSUBA_MUL_C - #undef BN_MP_KARATSUBA_SQR_C - #undef BN_MP_REDUCE_C - #undef BN_MP_REDUCE_SETUP_C - #undef BN_MP_DR_IS_MODULUS_C - #undef BN_MP_DR_SETUP_C - #undef BN_MP_DR_REDUCE_C - #undef BN_MP_REDUCE_IS_2K_C - #undef BN_MP_REDUCE_2K_SETUP_C - #undef BN_MP_REDUCE_2K_C - #undef BN_S_MP_EXPTMOD_C - #undef BN_MP_DIV_3_C - #undef BN_S_MP_MUL_HIGH_DIGS_C - #undef BN_FAST_S_MP_MUL_HIGH_DIGS_C - #undef BN_FAST_MP_INVMOD_C +/* here we are on the last pass so we turn things off. The functions classes are still there + * but we remove them specifically from the build. This also invokes tweaks in functions + * like removing support for even moduli, etc... + */ +# ifdef LTM_LAST +# undef BN_MP_TOOM_MUL_C +# undef BN_MP_TOOM_SQR_C +# undef BN_MP_KARATSUBA_MUL_C +# undef BN_MP_KARATSUBA_SQR_C +# undef BN_MP_REDUCE_C +# undef BN_MP_REDUCE_SETUP_C +# undef BN_MP_DR_IS_MODULUS_C +# undef BN_MP_DR_SETUP_C +# undef BN_MP_DR_REDUCE_C +# undef BN_MP_REDUCE_IS_2K_C +# undef BN_MP_REDUCE_2K_SETUP_C +# undef BN_MP_REDUCE_2K_C +# undef BN_S_MP_EXPTMOD_C +# undef BN_MP_DIV_3_C +# undef BN_S_MP_MUL_HIGH_DIGS_C +# undef BN_FAST_S_MP_MUL_HIGH_DIGS_C +# undef BN_FAST_MP_INVMOD_C - /* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold - * which is roughly 255 digits [7140 bits for 32-bit machines, 15300 bits for 64-bit machines] - * which means roughly speaking you can handle upto 2536-bit RSA keys with these defined without - * trouble. - */ - #undef BN_S_MP_MUL_DIGS_C - #undef BN_S_MP_SQR_C - #undef BN_MP_MONTGOMERY_REDUCE_C -#endif +/* To safely undefine these you have to make sure your RSA key won't exceed the Comba threshold + * which is roughly 255 digits [7140 bits for 32-bit machines, 15300 bits for 64-bit machines] + * which means roughly speaking you can handle upto 2536-bit RSA keys with these defined without + * trouble. + */ +# undef BN_S_MP_MUL_DIGS_C +# undef BN_S_MP_SQR_C +# undef BN_MP_MONTGOMERY_REDUCE_C +# endif #endif -- cgit v0.12 From f5ea63343e4245c7b8e5a0872e65c867e5e9d6f2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Sep 2017 12:53:48 +0000 Subject: Another round of libtommath const'ification. To be submitted to the libtommath folks --- generic/tclTomMath.h | 56 ++++++++++++------------ libtommath/bn_fast_mp_invmod.c | 2 +- libtommath/bn_fast_mp_montgomery_reduce.c | 2 +- libtommath/bn_mp_abs.c | 2 +- libtommath/bn_mp_addmod.c | 2 +- libtommath/bn_mp_dr_is_modulus.c | 2 +- libtommath/bn_mp_dr_reduce.c | 2 +- libtommath/bn_mp_dr_setup.c | 2 +- libtommath/bn_mp_exptmod.c | 2 +- libtommath/bn_mp_exptmod_fast.c | 4 +- libtommath/bn_mp_exteuclid.c | 2 +- libtommath/bn_mp_gcd.c | 2 +- libtommath/bn_mp_invmod.c | 2 +- libtommath/bn_mp_invmod_slow.c | 2 +- libtommath/bn_mp_is_square.c | 2 +- libtommath/bn_mp_jacobi.c | 2 +- libtommath/bn_mp_lcm.c | 2 +- libtommath/bn_mp_mod_d.c | 2 +- libtommath/bn_mp_montgomery_calc_normalization.c | 2 +- libtommath/bn_mp_montgomery_reduce.c | 2 +- libtommath/bn_mp_montgomery_setup.c | 2 +- libtommath/bn_mp_mulmod.c | 2 +- libtommath/bn_mp_n_root.c | 2 +- libtommath/bn_mp_n_root_ex.c | 19 ++++---- libtommath/bn_mp_reduce.c | 2 +- libtommath/bn_mp_reduce_2k.c | 2 +- libtommath/bn_mp_reduce_2k_l.c | 2 +- libtommath/bn_mp_reduce_2k_setup.c | 2 +- libtommath/bn_mp_reduce_2k_setup_l.c | 2 +- libtommath/bn_mp_reduce_is_2k.c | 2 +- libtommath/bn_mp_reduce_is_2k_l.c | 2 +- libtommath/bn_mp_reduce_setup.c | 2 +- libtommath/bn_mp_sqrmod.c | 2 +- libtommath/bn_mp_sqrtmod_prime.c | 2 +- libtommath/bn_mp_submod.c | 2 +- libtommath/bn_s_mp_exptmod.c | 4 +- libtommath/tommath.h | 56 ++++++++++++------------ libtommath/tommath_private.h | 10 ++--- 38 files changed, 105 insertions(+), 108 deletions(-) diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 14cf5b6..1f22d6f 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -497,42 +497,42 @@ int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); /* d = a + b (mod c) */ /* -int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); */ /* d = a - b (mod c) */ /* -int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); */ /* d = a * b (mod c) */ /* -int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); */ /* c = a * a (mod b) */ /* -int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c); +int mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = 1/a (mod b) */ /* -int mp_invmod(mp_int *a, mp_int *b, mp_int *c); +int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c); */ /* c = (a, b) */ /* -int mp_gcd(mp_int *a, mp_int *b, mp_int *c); +int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c); */ /* produces value such that U1*a + U2*b = U3 */ /* -int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); +int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); */ /* c = [a, b] or (a*b)/(a, b) */ /* -int mp_lcm(mp_int *a, mp_int *b, mp_int *c); +int mp_lcm(const mp_int *a, const mp_int *b, mp_int *c); */ /* finds one of the b'th root of a, such that |c|**b <= |a| @@ -540,10 +540,10 @@ int mp_lcm(mp_int *a, mp_int *b, mp_int *c); * returns error if a < 0 and b is even */ /* -int mp_n_root(mp_int *a, mp_digit b, mp_int *c); +int mp_n_root(const mp_int *a, mp_digit b, mp_int *c); */ /* -int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast); +int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast); */ /* special sqrt algo */ @@ -553,22 +553,22 @@ int mp_sqrt(const mp_int *arg, mp_int *ret); /* special sqrt (mod prime) */ /* -int mp_sqrtmod_prime(mp_int *arg, mp_int *prime, mp_int *ret); +int mp_sqrtmod_prime(const mp_int *arg, const mp_int *prime, mp_int *ret); */ /* is number a square? */ /* -int mp_is_square(mp_int *arg, int *ret); +int mp_is_square(const mp_int *arg, int *ret); */ /* computes the jacobi c = (a | n) (or Legendre if b is prime) */ /* -int mp_jacobi(mp_int *a, mp_int *n, int *c); +int mp_jacobi(const mp_int *a, const mp_int *n, int *c); */ /* used to setup the Barrett reduction for a given modulus b */ /* -int mp_reduce_setup(mp_int *a, mp_int *b); +int mp_reduce_setup(mp_int *a, const mp_int *b); */ /* Barrett Reduction, computes a (mod b) with a precomputed value c @@ -577,74 +577,74 @@ int mp_reduce_setup(mp_int *a, mp_int *b); * compute the reduction as -1 * mp_reduce(mp_abs(a)) [pseudo code]. */ /* -int mp_reduce(mp_int *a, mp_int *b, mp_int *c); +int mp_reduce(mp_int *a, const mp_int *b, mp_int *c); */ /* setups the montgomery reduction */ /* -int mp_montgomery_setup(mp_int *a, mp_digit *mp); +int mp_montgomery_setup(const mp_int *a, mp_digit *mp); */ /* computes a = B**n mod b without division or multiplication useful for * normalizing numbers in a Montgomery system. */ /* -int mp_montgomery_calc_normalization(mp_int *a, mp_int *b); +int mp_montgomery_calc_normalization(mp_int *a, const mp_int *b); */ /* computes x/R == x (mod N) via Montgomery Reduction */ /* -int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); +int mp_montgomery_reduce(mp_int *a, const mp_int *m, mp_digit mp); */ /* returns 1 if a is a valid DR modulus */ /* -int mp_dr_is_modulus(mp_int *a); +int mp_dr_is_modulus(const mp_int *a); */ /* sets the value of "d" required for mp_dr_reduce */ /* -void mp_dr_setup(mp_int *a, mp_digit *d); +void mp_dr_setup(const mp_int *a, mp_digit *d); */ /* reduces a modulo b using the Diminished Radix method */ /* -int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp); +int mp_dr_reduce(mp_int *a, const mp_int *b, mp_digit mp); */ /* returns true if a can be reduced with mp_reduce_2k */ /* -int mp_reduce_is_2k(mp_int *a); +int mp_reduce_is_2k(const mp_int *a); */ /* determines k value for 2k reduction */ /* -int mp_reduce_2k_setup(mp_int *a, mp_digit *d); +int mp_reduce_2k_setup(const mp_int *a, mp_digit *d); */ /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ /* -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d); +int mp_reduce_2k(mp_int *a, const mp_int *n, mp_digit d); */ /* returns true if a can be reduced with mp_reduce_2k_l */ /* -int mp_reduce_is_2k_l(mp_int *a); +int mp_reduce_is_2k_l(const mp_int *a); */ /* determines k value for 2k reduction */ /* -int mp_reduce_2k_setup_l(mp_int *a, mp_int *d); +int mp_reduce_2k_setup_l(const mp_int *a, mp_int *d); */ /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ /* -int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d); +int mp_reduce_2k_l(mp_int *a, const mp_int *n, mp_int *d); */ /* d = a**b (mod c) */ /* -int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); */ /* ---> Primes <--- */ diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c index 7771136..08389dd 100644 --- a/libtommath/bn_fast_mp_invmod.c +++ b/libtommath/bn_fast_mp_invmod.c @@ -21,7 +21,7 @@ * Based on slow invmod except this is optimized for the case where b is * odd as per HAC Note 14.64 on pp. 610 */ -int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c) +int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c) { mp_int x, y, u, v, B, D; int res, neg; diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index f2c38bf..54d9b0a 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -23,7 +23,7 @@ * * Based on Algorithm 14.32 on pp.601 of HAC. */ -int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho) +int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho) { int ix, res, olduse; mp_word W[MP_WARRAY]; diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index 343a102..03904d2 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -20,7 +20,7 @@ * Simple function copies the input and fixes the sign to positive */ int -mp_abs(mp_int *a, mp_int *b) +mp_abs(const mp_int *a, mp_int *b) { int res; diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index 0521974..5aee233 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -17,7 +17,7 @@ /* d = a + b (mod c) */ int -mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c index 4631daa..bf4ed8b 100644 --- a/libtommath/bn_mp_dr_is_modulus.c +++ b/libtommath/bn_mp_dr_is_modulus.c @@ -16,7 +16,7 @@ */ /* determines if a number is a valid DR modulus */ -int mp_dr_is_modulus(mp_int *a) +int mp_dr_is_modulus(const mp_int *a) { int ix; diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c index e90dc55..17ab289 100644 --- a/libtommath/bn_mp_dr_reduce.c +++ b/libtommath/bn_mp_dr_reduce.c @@ -30,7 +30,7 @@ * Input x must be in the range 0 <= x <= (n-1)**2 */ int -mp_dr_reduce(mp_int *x, mp_int *n, mp_digit k) +mp_dr_reduce(mp_int *x, const mp_int *n, mp_digit k) { int err, i, m; mp_word r; diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c index b49c81a..5dff995 100644 --- a/libtommath/bn_mp_dr_setup.c +++ b/libtommath/bn_mp_dr_setup.c @@ -16,7 +16,7 @@ */ /* determines the setup value */ -void mp_dr_setup(mp_int *a, mp_digit *d) +void mp_dr_setup(const mp_int *a, mp_digit *d) { /* the casts are required if DIGIT_BIT is one less than * the number of bits in a mp_digit [e.g. DIGIT_BIT==31] diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c index c4f392b..934fd25 100644 --- a/libtommath/bn_mp_exptmod.c +++ b/libtommath/bn_mp_exptmod.c @@ -21,7 +21,7 @@ * embedded in the normal function but that wasted alot of stack space * for nothing (since 99% of the time the Montgomery code would be called) */ -int mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y) +int mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y) { int dr; diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 7278b9f..08c6bc3 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -29,7 +29,7 @@ #define TAB_SIZE 256 #endif -int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) +int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) { mp_int M[TAB_SIZE], res; mp_digit buf, mp; @@ -39,7 +39,7 @@ int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) * one of many reduction algorithms without modding the guts of * the code with if statements everywhere. */ - int (*redux)(mp_int *,mp_int *,mp_digit); + int (*redux)(mp_int *,const mp_int *,mp_digit); /* find window size */ x = mp_count_bits(X); diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index 419146b..adaea86 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -18,7 +18,7 @@ /* Extended euclidean algorithm of (a, b) produces a*u1 + b*u2 = u3 */ -int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) +int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) { mp_int u1,u2,u3,v1,v2,v3,t1,t2,t3,q,tmp; int err; diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index 18f6dc3..f5aa78b 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -16,7 +16,7 @@ */ /* Greatest Common Divisor using the binary method */ -int mp_gcd(mp_int *a, mp_int *b, mp_int *c) +int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c) { mp_int u, v; int k, u_lsb, v_lsb, res; diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index b70fe18..525493a 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -16,7 +16,7 @@ */ /* hac 14.61, pp608 */ -int mp_invmod(mp_int *a, mp_int *b, mp_int *c) +int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c) { /* b cannot be negative */ if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c index 2bdd2b1..2bb5196 100644 --- a/libtommath/bn_mp_invmod_slow.c +++ b/libtommath/bn_mp_invmod_slow.c @@ -16,7 +16,7 @@ */ /* hac 14.61, pp608 */ -int mp_invmod_slow(mp_int *a, mp_int *b, mp_int *c) +int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c) { mp_int x, y, u, v, A, B, C, D; int res; diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 84229bf..4d8612f 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -38,7 +38,7 @@ static const char rem_105[105] = { }; /* Store non-zero to ret if arg is square, and zero if not */ -int mp_is_square(mp_int *arg,int *ret) +int mp_is_square(const mp_int *arg,int *ret) { int res; mp_digit c; diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c index 8981393..c314c82 100644 --- a/libtommath/bn_mp_jacobi.c +++ b/libtommath/bn_mp_jacobi.c @@ -20,7 +20,7 @@ * HAC is wrong here, as the special case of (0 | 1) is not * handled correctly. */ -int mp_jacobi(mp_int *a, mp_int *n, int *c) +int mp_jacobi(const mp_int *a, const mp_int *n, int *c) { mp_int a1, p1; int k, s, r, res; diff --git a/libtommath/bn_mp_lcm.c b/libtommath/bn_mp_lcm.c index dc661f3..24b621c 100644 --- a/libtommath/bn_mp_lcm.c +++ b/libtommath/bn_mp_lcm.c @@ -16,7 +16,7 @@ */ /* computes least common multiple as |a*b|/(a, b) */ -int mp_lcm(mp_int *a, mp_int *b, mp_int *c) +int mp_lcm(const mp_int *a, const mp_int *b, mp_int *c) { int res; mp_int t1, t2; diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index 6afe4f1..5217aa4 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -16,7 +16,7 @@ */ int -mp_mod_d(mp_int *a, mp_digit b, mp_digit *c) +mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c) { return mp_div_d(a, b, NULL, c); } diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index 2d95140..f2b0856 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -21,7 +21,7 @@ * The method is slightly modified to shift B unconditionally upto just under * the leading bit of b. This saves alot of multiple precision shifting. */ -int mp_montgomery_calc_normalization(mp_int *a, mp_int *b) +int mp_montgomery_calc_normalization(mp_int *a, const mp_int *b) { int x, bits, res; diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index 1ee69b2..e9f6c1c 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -17,7 +17,7 @@ /* computes xR**-1 == x (mod N) via Montgomery Reduction */ int -mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho) +mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho) { int ix, res, digs; mp_digit mu; diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index fac71a6..37069c3 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -17,7 +17,7 @@ /* setups the montgomery reduction stuff */ int -mp_montgomery_setup(mp_int *n, mp_digit *rho) +mp_montgomery_setup(const mp_int *n, mp_digit *rho) { mp_digit x, b; diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c index b1e6a33..aeee4ee 100644 --- a/libtommath/bn_mp_mulmod.c +++ b/libtommath/bn_mp_mulmod.c @@ -16,7 +16,7 @@ */ /* d = a * b (mod c) */ -int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +int mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c index 8211c0a..a09804f 100644 --- a/libtommath/bn_mp_n_root.c +++ b/libtommath/bn_mp_n_root.c @@ -18,7 +18,7 @@ /* wrapper function for mp_n_root_ex() * computes c = (a)**(1/b) such that (c)**b <= a and (c+1)**b > a */ -int mp_n_root(mp_int *a, mp_digit b, mp_int *c) +int mp_n_root(const mp_int *a, mp_digit b, mp_int *c) { return mp_n_root_ex(a, b, c, 0); } diff --git a/libtommath/bn_mp_n_root_ex.c b/libtommath/bn_mp_n_root_ex.c index 9546745..ca50649 100644 --- a/libtommath/bn_mp_n_root_ex.c +++ b/libtommath/bn_mp_n_root_ex.c @@ -25,10 +25,10 @@ * each step involves a fair bit. This is not meant to * find huge roots [square and cube, etc]. */ -int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) +int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) { - mp_int t1, t2, t3; - int res, neg; + mp_int t1, t2, t3, a_; + int res; /* input must be positive if b is even */ if (((b & 1) == 0) && (a->sign == MP_NEG)) { @@ -48,8 +48,8 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } /* if a is negative fudge the sign but keep track */ - neg = a->sign; - a->sign = MP_ZPOS; + a_ = *a; + a_.sign = MP_ZPOS; /* t2 = 2 */ mp_set(&t2, 2); @@ -74,7 +74,7 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } /* t2 = t1**b - a */ - if ((res = mp_sub(&t2, a, &t2)) != MP_OKAY) { + if ((res = mp_sub(&t2, &a_, &t2)) != MP_OKAY) { goto LBL_T3; } @@ -100,7 +100,7 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) goto LBL_T3; } - if (mp_cmp(&t2, a) == MP_GT) { + if (mp_cmp(&t2, &a_) == MP_GT) { if ((res = mp_sub_d(&t1, 1, &t1)) != MP_OKAY) { goto LBL_T3; } @@ -109,14 +109,11 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } } - /* reset the sign of a first */ - a->sign = neg; - /* set the result */ mp_exch(&t1, c); /* set the sign of the result */ - c->sign = neg; + c->sign = a->sign; res = MP_OKAY; diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c index a2b9bf7..6665acb 100644 --- a/libtommath/bn_mp_reduce.c +++ b/libtommath/bn_mp_reduce.c @@ -19,7 +19,7 @@ * precomputed via mp_reduce_setup. * From HAC pp.604 Algorithm 14.42 */ -int mp_reduce(mp_int *x, mp_int *m, mp_int *mu) +int mp_reduce(mp_int *x, const mp_int *m, mp_int *mu) { mp_int q; int res, um = m->used; diff --git a/libtommath/bn_mp_reduce_2k.c b/libtommath/bn_mp_reduce_2k.c index 6bc96d1..2922cad 100644 --- a/libtommath/bn_mp_reduce_2k.c +++ b/libtommath/bn_mp_reduce_2k.c @@ -16,7 +16,7 @@ */ /* reduces a modulo n where n is of the form 2**p - d */ -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d) +int mp_reduce_2k(mp_int *a, const mp_int *n, mp_digit d) { mp_int q; int p, res; diff --git a/libtommath/bn_mp_reduce_2k_l.c b/libtommath/bn_mp_reduce_2k_l.c index 8e6eeb0..3b23a37 100644 --- a/libtommath/bn_mp_reduce_2k_l.c +++ b/libtommath/bn_mp_reduce_2k_l.c @@ -19,7 +19,7 @@ This differs from reduce_2k since "d" can be larger than a single digit. */ -int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d) +int mp_reduce_2k_l(mp_int *a, const mp_int *n, mp_int *d) { mp_int q; int p, res; diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c index 802a5ba..e6ae839 100644 --- a/libtommath/bn_mp_reduce_2k_setup.c +++ b/libtommath/bn_mp_reduce_2k_setup.c @@ -16,7 +16,7 @@ */ /* determines the setup value */ -int mp_reduce_2k_setup(mp_int *a, mp_digit *d) +int mp_reduce_2k_setup(const mp_int *a, mp_digit *d) { int res, p; mp_int tmp; diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c index 34367ed..af81b5b 100644 --- a/libtommath/bn_mp_reduce_2k_setup_l.c +++ b/libtommath/bn_mp_reduce_2k_setup_l.c @@ -16,7 +16,7 @@ */ /* determines the setup value */ -int mp_reduce_2k_setup_l(mp_int *a, mp_int *d) +int mp_reduce_2k_setup_l(const mp_int *a, mp_int *d) { int res; mp_int tmp; diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c index c733ca9..932521e 100644 --- a/libtommath/bn_mp_reduce_is_2k.c +++ b/libtommath/bn_mp_reduce_is_2k.c @@ -16,7 +16,7 @@ */ /* determines if mp_reduce_2k can be used */ -int mp_reduce_is_2k(mp_int *a) +int mp_reduce_is_2k(const mp_int *a) { int ix, iy, iw; mp_digit iz; diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index d4804d5..22c7582 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -16,7 +16,7 @@ */ /* determines if reduce_2k_l can be used */ -int mp_reduce_is_2k_l(mp_int *a) +int mp_reduce_is_2k_l(const mp_int *a) { int ix, iy; diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c index 00ff61c..70e193a 100644 --- a/libtommath/bn_mp_reduce_setup.c +++ b/libtommath/bn_mp_reduce_setup.c @@ -18,7 +18,7 @@ /* pre-calculate the value required for Barrett reduction * For a given modulus "b" it calulates the value required in "a" */ -int mp_reduce_setup(mp_int *a, mp_int *b) +int mp_reduce_setup(mp_int *a, const mp_int *b) { int res; diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index ebb1b53..b8265fe 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -17,7 +17,7 @@ /* c = a * a (mod b) */ int -mp_sqrmod(mp_int *a, mp_int *b, mp_int *c) +mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c) { int res; mp_int t; diff --git a/libtommath/bn_mp_sqrtmod_prime.c b/libtommath/bn_mp_sqrtmod_prime.c index 12b427c..261723e 100644 --- a/libtommath/bn_mp_sqrtmod_prime.c +++ b/libtommath/bn_mp_sqrtmod_prime.c @@ -15,7 +15,7 @@ * */ -int mp_sqrtmod_prime(mp_int *n, mp_int *prime, mp_int *ret) +int mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret) { int res, legendre; mp_int t1, C, Q, S, Z, M, T, R, two; diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index 96a3a1b..9a45f6d 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -17,7 +17,7 @@ /* d = a - b (mod c) */ int -mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index bd37169..e73c12e 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -20,12 +20,12 @@ #define TAB_SIZE 256 #endif -int s_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) +int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) { mp_int M[TAB_SIZE], res, mu; mp_digit buf; int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; - int (*redux)(mp_int *,mp_int *,mp_int *); + int (*redux)(mp_int *,const mp_int *,mp_int *); /* find window size */ x = mp_count_bits(X); diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 9d811fa..513b5b9 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -358,98 +358,98 @@ int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); /* ---> number theory <--- */ /* d = a + b (mod c) */ -int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* d = a - b (mod c) */ -int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* d = a * b (mod c) */ -int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* c = a * a (mod b) */ -int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c); +int mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c); /* c = 1/a (mod b) */ -int mp_invmod(mp_int *a, mp_int *b, mp_int *c); +int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c); /* c = (a, b) */ -int mp_gcd(mp_int *a, mp_int *b, mp_int *c); +int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c); /* produces value such that U1*a + U2*b = U3 */ -int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); +int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); /* c = [a, b] or (a*b)/(a, b) */ -int mp_lcm(mp_int *a, mp_int *b, mp_int *c); +int mp_lcm(const mp_int *a, const 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 */ -int mp_n_root(mp_int *a, mp_digit b, mp_int *c); -int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast); +int mp_n_root(const mp_int *a, mp_digit b, mp_int *c); +int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast); /* special sqrt algo */ int mp_sqrt(const mp_int *arg, mp_int *ret); /* special sqrt (mod prime) */ -int mp_sqrtmod_prime(mp_int *arg, mp_int *prime, mp_int *ret); +int mp_sqrtmod_prime(const mp_int *arg, const mp_int *prime, mp_int *ret); /* is number a square? */ -int mp_is_square(mp_int *arg, int *ret); +int mp_is_square(const mp_int *arg, int *ret); /* computes the jacobi c = (a | n) (or Legendre if b is prime) */ -int mp_jacobi(mp_int *a, mp_int *n, int *c); +int mp_jacobi(const mp_int *a, const mp_int *n, int *c); /* used to setup the Barrett reduction for a given modulus b */ -int mp_reduce_setup(mp_int *a, mp_int *b); +int mp_reduce_setup(mp_int *a, const 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]. */ -int mp_reduce(mp_int *a, mp_int *b, mp_int *c); +int mp_reduce(mp_int *a, const mp_int *b, mp_int *c); /* setups the montgomery reduction */ -int mp_montgomery_setup(mp_int *a, mp_digit *mp); +int mp_montgomery_setup(const mp_int *a, mp_digit *mp); /* computes a = B**n mod b without division or multiplication useful for * normalizing numbers in a Montgomery system. */ -int mp_montgomery_calc_normalization(mp_int *a, mp_int *b); +int mp_montgomery_calc_normalization(mp_int *a, const mp_int *b); /* computes x/R == x (mod N) via Montgomery Reduction */ -int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); +int mp_montgomery_reduce(mp_int *a, const mp_int *m, mp_digit mp); /* returns 1 if a is a valid DR modulus */ -int mp_dr_is_modulus(mp_int *a); +int mp_dr_is_modulus(const mp_int *a); /* sets the value of "d" required for mp_dr_reduce */ -void mp_dr_setup(mp_int *a, mp_digit *d); +void mp_dr_setup(const mp_int *a, mp_digit *d); /* reduces a modulo b using the Diminished Radix method */ -int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp); +int mp_dr_reduce(mp_int *a, const mp_int *b, mp_digit mp); /* returns true if a can be reduced with mp_reduce_2k */ -int mp_reduce_is_2k(mp_int *a); +int mp_reduce_is_2k(const mp_int *a); /* determines k value for 2k reduction */ -int mp_reduce_2k_setup(mp_int *a, mp_digit *d); +int mp_reduce_2k_setup(const mp_int *a, mp_digit *d); /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d); +int mp_reduce_2k(mp_int *a, const mp_int *n, mp_digit d); /* returns true if a can be reduced with mp_reduce_2k_l */ -int mp_reduce_is_2k_l(mp_int *a); +int mp_reduce_is_2k_l(const mp_int *a); /* determines k value for 2k reduction */ -int mp_reduce_2k_setup_l(mp_int *a, mp_int *d); +int mp_reduce_2k_setup_l(const mp_int *a, mp_int *d); /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ -int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d); +int mp_reduce_2k_l(mp_int *a, const mp_int *n, mp_int *d); /* d = a**b (mod c) */ -int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* ---> Primes <--- */ diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 7f33fab..58846bf 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -70,11 +70,11 @@ int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c); int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c); int mp_karatsuba_sqr(const mp_int *a, mp_int *b); int mp_toom_sqr(const mp_int *a, mp_int *b); -int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c); -int mp_invmod_slow(mp_int *a, mp_int *b, mp_int *c); -int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho); -int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode); -int s_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode); +int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c); +int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c); +int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho); +int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode); +int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode); void bn_reverse(unsigned char *s, int len); extern const char *mp_s_rmap; -- cgit v0.12 From f75f76c9d479632f92d722036fdb45311338021f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Sep 2017 14:38:26 +0000 Subject: Finish libtommath's constification work. All done (hopefully). And make sure that C preprocessor directives have the '#' as first character on the line. --- generic/tclTomMath.h | 8 ++++---- libtommath/bn_fast_s_mp_mul_high_digs.c | 2 +- libtommath/bn_mp_prime_fermat.c | 2 +- libtommath/bn_mp_prime_is_divisible.c | 2 +- libtommath/bn_mp_prime_is_prime.c | 2 +- libtommath/bn_mp_prime_miller_rabin.c | 2 +- libtommath/bn_s_mp_mul_high_digs.c | 2 +- libtommath/tommath.h | 8 ++++---- libtommath/tommath_private.h | 8 +++----- win/tclAppInit.c | 4 ++-- win/tclWinPipe.c | 12 ++++++------ 11 files changed, 25 insertions(+), 27 deletions(-) diff --git a/generic/tclTomMath.h b/generic/tclTomMath.h index 1f22d6f..c8b2a87 100644 --- a/generic/tclTomMath.h +++ b/generic/tclTomMath.h @@ -663,21 +663,21 @@ MODULE_SCOPE const mp_digit ltm_prime_tab[PRIME_SIZE]; /* result=1 if a is divisible by one of the first PRIME_SIZE primes */ /* -int mp_prime_is_divisible(mp_int *a, int *result); +int mp_prime_is_divisible(const 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 */ /* -int mp_prime_fermat(mp_int *a, mp_int *b, int *result); +int mp_prime_fermat(const mp_int *a, const 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 */ /* -int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result); +int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result); */ /* This gives [for a given bit size] the number of trials required @@ -695,7 +695,7 @@ int mp_prime_rabin_miller_trials(int size); * Sets result to 1 if probably prime, 0 otherwise */ /* -int mp_prime_is_prime(mp_int *a, int t, int *result); +int mp_prime_is_prime(const mp_int *a, int t, int *result); */ /* finds the next prime after the number "a" using "t" trials diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c index 588d80b..8b662ed 100644 --- a/libtommath/bn_fast_s_mp_mul_high_digs.c +++ b/libtommath/bn_fast_s_mp_mul_high_digs.c @@ -24,7 +24,7 @@ * * Based on Algorithm 14.12 on pp.595 of HAC. */ -int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs) +int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY]; diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c index 37ad6ec..9c15435 100644 --- a/libtommath/bn_mp_prime_fermat.c +++ b/libtommath/bn_mp_prime_fermat.c @@ -23,7 +23,7 @@ * * Sets result to 1 if the congruence holds, or zero otherwise. */ -int mp_prime_fermat(mp_int *a, mp_int *b, int *result) +int mp_prime_fermat(const mp_int *a, const mp_int *b, int *result) { mp_int t; int err; diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c index 92af330..c1e1158 100644 --- a/libtommath/bn_mp_prime_is_divisible.c +++ b/libtommath/bn_mp_prime_is_divisible.c @@ -20,7 +20,7 @@ * * sets result to 0 if not, 1 if yes */ -int mp_prime_is_divisible(mp_int *a, int *result) +int mp_prime_is_divisible(const mp_int *a, int *result) { int err, ix; mp_digit res; diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c index 20a7d1f..e97712d 100644 --- a/libtommath/bn_mp_prime_is_prime.c +++ b/libtommath/bn_mp_prime_is_prime.c @@ -22,7 +22,7 @@ * * Sets result to 1 if probably prime, 0 otherwise */ -int mp_prime_is_prime(mp_int *a, int t, int *result) +int mp_prime_is_prime(const mp_int *a, int t, int *result) { mp_int b; int ix, err, res; diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c index 917dc01..5de5f05 100644 --- a/libtommath/bn_mp_prime_miller_rabin.c +++ b/libtommath/bn_mp_prime_miller_rabin.c @@ -22,7 +22,7 @@ * Randomly the chance of error is no more than 1/4 and often * very much lower. */ -int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result) +int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result) { mp_int n1, y, r; int s, j, err; diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 44d0d21..0a829b9 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -19,7 +19,7 @@ * [meant to get the higher part of the product] */ int -s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs) +s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { mp_int t; int res, pa, pb, ix, iy; diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 513b5b9..dee7ab5 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -464,17 +464,17 @@ int mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); extern const mp_digit ltm_prime_tab[PRIME_SIZE]; /* result=1 if a is divisible by one of the first PRIME_SIZE primes */ -int mp_prime_is_divisible(mp_int *a, int *result); +int mp_prime_is_divisible(const 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 */ -int mp_prime_fermat(mp_int *a, mp_int *b, int *result); +int mp_prime_fermat(const mp_int *a, const 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 */ -int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result); +int mp_prime_miller_rabin(const mp_int *a, const 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 @@ -488,7 +488,7 @@ int mp_prime_rabin_miller_trials(int size); * * Sets result to 1 if probably prime, 0 otherwise */ -int mp_prime_is_prime(mp_int *a, int t, int *result); +int mp_prime_is_prime(const mp_int *a, int t, int *result); /* finds the next prime after the number "a" using "t" trials * of Miller-Rabin. diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index 58846bf..be065cd 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -40,21 +40,19 @@ extern "C" { #endif /* define heap macros */ -#if 0 #ifndef XMALLOC /* default to libc stuff */ # define XMALLOC malloc # define XFREE free # define XREALLOC realloc # define XCALLOC calloc -#else +#elif 0 /* prototypes for our heap functions */ extern void *XMALLOC(size_t n); extern void *XREALLOC(void *p, size_t n); extern void *XCALLOC(size_t n, size_t s); extern void XFREE(void *p); #endif -#endif /* lowlevel functions, do not call! */ int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c); @@ -62,8 +60,8 @@ int s_mp_sub(const mp_int *a, const 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) int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); -int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); +int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); int fast_s_mp_sqr(const mp_int *a, mp_int *b); int s_mp_sqr(const mp_int *a, mp_int *b); int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c); diff --git a/win/tclAppInit.c b/win/tclAppInit.c index e06eaf5..ef9f98b 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -263,8 +263,8 @@ setargv( } /* Make sure we don't call ckalloc through the (not yet initialized) stub table */ - #undef Tcl_Alloc - #undef Tcl_DbCkalloc +# undef Tcl_Alloc +# undef Tcl_DbCkalloc argSpace = ckalloc(size * sizeof(char *) + (_tcslen(cmdLine) * sizeof(TCHAR)) + sizeof(TCHAR)); diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 4b372a5..5f1aa70 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -3392,11 +3392,11 @@ TclPipeThreadStop( SetEvent(pipeTI->evWakeUp); } CloseHandle(pipeTI->evControl); - #ifndef _PTI_USE_CKALLOC +# ifndef _PTI_USE_CKALLOC free(pipeTI); - #else +# else ckfree(pipeTI); - #endif +# endif } } @@ -3440,13 +3440,13 @@ TclPipeThreadExit( if (pipeTI->evWakeUp) { SetEvent(pipeTI->evWakeUp); } - #ifndef _PTI_USE_CKALLOC +# ifndef _PTI_USE_CKALLOC free(pipeTI); - #else +# else ckfree(pipeTI); /* be sure all subsystems used are finalized */ Tcl_FinalizeThread(); - #endif +# endif } } -- cgit v0.12 -- cgit v0.12 From 78a20a11b21ab416516724818432027dae27e5ac Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 19 Sep 2017 12:10:25 +0000 Subject: Remove /Gs which enables _chkstk on *every* function call. The normal default behaviour (without the option) checks only local variable space exceeds page size. This is what Microsoft recommends. Also moved -O2 to rules.vc file so as to keep all optimization flags in one location. Removed optimizations switches subsumed by -O2. --- win/makefile.vc | 2 +- win/rules.vc | 36 +++++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index ada08cc..cb6d92c 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -470,7 +470,7 @@ PKGSDIR = $(ROOT)\pkgs !if !$(DEBUG) !if $(OPTIMIZING) ### This cranks the optimization level to maximize speed -cdebug = -O2 $(OPTIMIZATIONS) +cdebug = $(OPTIMIZATIONS) !else cdebug = !endif diff --git a/win/rules.vc b/win/rules.vc index 4a3ae26..3f3d077 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -113,42 +113,46 @@ CFG_ENCODING = \"cp1252\" #---------------------------------------------------------- ### test for optimizations -!if [nmakehlp -c -Ot] +# /O2 optimization includes /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy as per +# documentation. Note we do NOT want /Gs as that inserts a _chkstk +# stack probe at *every* function entry, not just those with more than +# a page of stack allocation resulting in a performance hit. However, +# /O2 documentation is misleading as its stack probes are simply the +# default page size locals allocation probes and not what is implied +# by an explicit /Gs option. + +!if [nmakehlp -c -O2] !message *** Compiler has 'Optimizations' OPTIMIZING = 1 +OPTIMIZATIONS = -O2 !else !message *** Compiler does not have 'Optimizations' OPTIMIZING = 0 +OPTIMIZATIONS = !endif -OPTIMIZATIONS = - -!if [nmakehlp -c -Ot] -OPTIMIZATIONS = $(OPTIMIZATIONS) -Ot -!endif - -!if [nmakehlp -c -Oi] -OPTIMIZATIONS = $(OPTIMIZATIONS) -Oi -!endif +# -Op improves float consistency. Note only needed for older compilers +# Newer compilers do not need or support this option. !if [nmakehlp -c -Op] OPTIMIZATIONS = $(OPTIMIZATIONS) -Op !endif +# Strict floating point semantics - present in newer compilers in lieu of -Op !if [nmakehlp -c -fp:strict] OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:strict !endif -!if [nmakehlp -c -Gs] -OPTIMIZATIONS = $(OPTIMIZATIONS) -Gs -!endif - +# Checks for buffer overflows in local arrays !if [nmakehlp -c -GS] OPTIMIZATIONS = $(OPTIMIZATIONS) -GS !endif +# Link time optimization. Note that this option (potentially) makes generated libraries +# only usable by the specific VC++ version that created it. Requires /LTCG linker option !if [nmakehlp -c -GL] OPTIMIZATIONS = $(OPTIMIZATIONS) -GL +CC_GL_OPT_ENABLED = 1 !endif DEBUGFLAGS = @@ -208,8 +212,10 @@ ALIGN98_HACK = 0 LINKERFLAGS = +!ifdef CC_GL_OPT_ENABLED !if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)] -LINKERFLAGS =-ltcg +LINKERFLAGS = $(LINKERFLAGS) -ltcg +!endif !endif #---------------------------------------------------------- -- cgit v0.12 From 0e5d15e07293f2792b0a403dcf4e2039332cbb0c Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 19 Sep 2017 12:50:25 +0000 Subject: Fix mapping of VCVERSION to VCVER. The simplistic calculation no longer holds for new versions of the compiler. Instead directly use the internal compiler version for these. --- win/rules.vc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/win/rules.vc b/win/rules.vc index 3f3d077..bca052b 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -68,11 +68,18 @@ VCVER=0 && ![echo $(_HASH)endif >> vercl.x] \ && ![cl -nologo -TC -P vercl.x $(ERRNULL)] !include vercl.i +!if $(VCVERSION) < 1900 !if ![echo VCVER= ^\> vercl.vc] \ && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc] !include vercl.vc !endif +!else +# The simple calculation above does not apply to new Visual Studio releases +# Keep the compiler version in its native form. +VCVER = $(VCVERSION) +!endif !endif + !if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc] !endif -- cgit v0.12 From b81c66b4c7d8c66becb3def11d368d1af0c059ed Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 19 Sep 2017 15:12:52 +0000 Subject: Do not permit nothreads in OPTS as sockets, registry and dde require threading. --- win/makefile.vc | 3 +-- win/rules.vc | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index cb6d92c..4de6a1c 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -71,7 +71,7 @@ the build instructions. # Sets where to install Tcl from the built binaries. # C:\Progra~1\Tcl is assumed when not specified. # -# OPTS=loimpact,msvcrt,nothreads,pdbs,profile,static,staticpkg,symbols,thrdalloc,tclalloc,unchecked,none +# OPTS=loimpact,msvcrt,pdbs,profile,static,staticpkg,symbols,thrdalloc,tclalloc,unchecked,none # Sets special options for the core. The default is for none. # Any combination of the above may be used (comma separated). # 'none' will over-ride everything to nothing. @@ -82,7 +82,6 @@ the build instructions. # using libcmt(d) as the C runtime [by default] to # msvcrt(d). This is useful for static embedding # support. -# nothreads= Turns off full multithreading support. # pdbs = Build detached symbols for release builds. # profile = Adds profiling hooks. Map file is assumed. # static = Builds a static library of the core instead of a diff --git a/win/rules.vc b/win/rules.vc index bca052b..a57c25e 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -230,6 +230,9 @@ LINKERFLAGS = $(LINKERFLAGS) -ltcg #---------------------------------------------------------- !if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"] + +# if No OPTS specified + STATIC_BUILD = 0 TCL_THREADS = 1 DEBUG = 0 @@ -241,13 +244,18 @@ LOIMPACT = 0 TCL_USE_STATIC_PACKAGES = 0 USE_THREAD_ALLOC = 1 UNCHECKED = 0 + !else + +# OPTS are specified, parse them + !if [nmakehlp -f $(OPTS) "static"] !message *** Doing static STATIC_BUILD = 1 !else STATIC_BUILD = 0 !endif + !if [nmakehlp -f $(OPTS) "nomsvcrt"] !message *** Doing nomsvcrt MSVCRT = 0 @@ -262,14 +270,17 @@ MSVCRT = 1 MSVCRT = 0 !endif !endif -!endif +!endif # [nmakehlp -f $(OPTS) "nomsvcrt"] + !if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD) !message *** Doing staticpkg TCL_USE_STATIC_PACKAGES = 1 !else TCL_USE_STATIC_PACKAGES = 0 !endif + !if [nmakehlp -f $(OPTS) "nothreads"] +!error Option "nothreads" no longer supported. Threads required for sockets, registry and dde to work. !message *** Compile explicitly for non-threaded tcl TCL_THREADS = 0 USE_THREAD_ALLOC= 0 @@ -277,24 +288,28 @@ USE_THREAD_ALLOC= 0 TCL_THREADS = 1 USE_THREAD_ALLOC= 1 !endif + !if [nmakehlp -f $(OPTS) "symbols"] !message *** Doing symbols DEBUG = 1 !else DEBUG = 0 !endif + !if [nmakehlp -f $(OPTS) "pdbs"] !message *** Doing pdbs SYMBOLS = 1 !else SYMBOLS = 0 !endif + !if [nmakehlp -f $(OPTS) "profile"] !message *** Doing profile PROFILE = 1 !else PROFILE = 0 !endif + !if [nmakehlp -f $(OPTS) "pgi"] !message *** Doing profile guided optimization instrumentation PGO = 1 @@ -304,27 +319,32 @@ PGO = 2 !else PGO = 0 !endif + !if [nmakehlp -f $(OPTS) "loimpact"] !message *** Doing loimpact LOIMPACT = 1 !else LOIMPACT = 0 !endif + !if [nmakehlp -f $(OPTS) "thrdalloc"] !message *** Doing thrdalloc USE_THREAD_ALLOC = 1 !endif + !if [nmakehlp -f $(OPTS) "tclalloc"] !message *** Doing tclalloc USE_THREAD_ALLOC = 0 !endif + !if [nmakehlp -f $(OPTS) "unchecked"] !message *** Doing unchecked UNCHECKED = 1 !else UNCHECKED = 0 !endif -!endif + +!endif # "$(OPTS)" == "" ... parsing of OPTS #---------------------------------------------------------- # Figure-out how to name our intermediate and output directories. -- cgit v0.12 From 071f38c4823457396818de582f5af25884c2befe Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 19 Sep 2017 16:07:14 +0000 Subject: Eliminated some obsolete checks (Win98, IA64 etc.) to reduce the noise. --- win/makefile.vc | 19 ++++++++----------- win/rules.vc | 25 +------------------------ 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 4de6a1c..4da9da7 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -120,12 +120,12 @@ the build instructions. # nodep = Turns off compatibility macros to ensure the core # isn't being built with deprecated functions. # -# MACHINE=(ALPHA|AMD64|IA64|IX86) +# MACHINE=(AMD64|IX86) # Set the machine type used for the compiler, linker, and # resource compiler. This hook is needed to tell the tools -# when alternate platforms are requested. IX86 is the default -# when not specified. If the CPU environment variable has been -# set (ie: recent Platform SDK) then MACHINE is set from CPU. +# when alternate platforms are requested. This should normally +# NOT be set as it is automatically detected based on the +# compiler in use. # # TMP_DIR= # OUT_DIR= @@ -153,11 +153,8 @@ the build instructions. # c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl # # Building for Win64 -# c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat -# Setting environment for using Microsoft Visual C++ tools. -# c:\tcl_src\win\>c:\progra~1\platfo~1\setenv.bat /pre64 /RETAIL -# Targeting Windows pre64 RETAIL -# c:\tcl_src\win\>nmake -f makefile.vc MACHINE=IA64 +# c:\tcl_src\win\>c:\progra~1\platfo~1\setenv.bat /x64 /RETAIL +# c:\tcl_src\win\>nmake -f makefile.vc # #------------------------------------------------------------------------------ #============================================================================== @@ -476,7 +473,7 @@ cdebug = !if $(SYMBOLS) cdebug = $(cdebug) -Zi !endif -!else if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" +!else if "$(MACHINE)" == "AMD64" ### Warnings are too many, can't support warnings into errors. cdebug = -Zi -Od $(DEBUGFLAGS) !else @@ -552,7 +549,7 @@ guilflags = $(lflags) -subsystem:windows baselibs = netapi32.lib kernel32.lib user32.lib advapi32.lib userenv.lib ws2_32.lib # Avoid 'unresolved external symbol __security_cookie' errors. # c.f. http://support.microsoft.com/?id=894573 -!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" +!if "$(MACHINE)" == "AMD64" !if $(VCVERSION) > 1399 && $(VCVERSION) < 1500 baselibs = $(baselibs) bufferoverflowU.lib !endif diff --git a/win/rules.vc b/win/rules.vc index a57c25e..afa8c2c 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -33,23 +33,10 @@ _INSTALLDIR = $(INSTALLDIR:/=\) # "delete all" method. #---------------------------------------------------------- -!if "$(OS)" == "Windows_NT" RMDIR = rmdir /S /Q ERRNULL = 2>NUL -!if ![ver | find "4.0" > nul] -CPY = echo y | xcopy /i >NUL -COPY = copy >NUL -!else CPY = xcopy /i /y >NUL COPY = copy /y >NUL -!endif -!else # "$(OS)" != "Windows_NT" -CPY = xcopy /i >_JUNK.OUT # On Win98 NUL does not work here. -COPY = copy >_JUNK.OUT # On Win98 NUL does not work here. -RMDIR = deltree /Y -NULL = \NUL # Used in testing directory existence -ERRNULL = >NUL # Win9x shell cannot redirect stderr -!endif MKDIR = mkdir #------------------------------------------------------------------------------ @@ -189,16 +176,6 @@ COMPILERFLAGS = $(COMPILERFLAGS) -QI0f !endif !endif -!if "$(MACHINE)" == "IA64" -### test for Itanium errata -!if [nmakehlp -c -QIA64_Bx] -!message *** Compiler has 'B-stepping errata workarounds' -COMPILERFLAGS = $(COMPILERFLAGS) -QIA64_Bx -!else -!message *** Compiler does not have 'B-stepping errata workarounds' -!endif -!endif - # Prevents "LNK1561: entry point must be defined" error compiling from VS-IDE: !ifndef LINKER_TESTFLAGS LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmhlp-out.txt @@ -519,7 +496,7 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_OPTIMIZED !if $(PROFILE) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_PROFILED !endif -!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" +!if "$(MACHINE)" == "AMD64" OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT !endif !if $(VCVERSION) < 1300 -- cgit v0.12 From 6d855646966f1a37b99033910bdacd11b743ba4e Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 19 Sep 2017 16:43:19 +0000 Subject: Disable pointer<->int warnings related to cast between different sizes There are a gadzillion of these due to use of ClientData and clutter up compiler output increasing chance of a real warning getting lost. So disable them. Eventually some day, Tcl will be 64-bit clean. --- win/makefile.vc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/win/makefile.vc b/win/makefile.vc index 4da9da7..e82b288 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -482,6 +482,13 @@ cdebug = -Zi -WX $(DEBUGFLAGS) ### Declarations common to all compiler options cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE +!if "$(MACHINE)" == "AMD64" +# Disable pointer<->int warnings related to cast between different sizes +# There are a gadzillion of these due to use of ClientData and clutter up compiler +# output increasing chance of a real warning getting lost. So disable them. +# Eventually some day, Tcl will be 64-bit clean. +cwarn = $(cwarn) -wd4311 -wd4312 +!endif cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ !if $(MSVCRT) -- cgit v0.12 From 65703d1f87d85eea842224137695c20c320c7bd7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 20 Sep 2017 09:07:35 +0000 Subject: Further astyle formatting of libtommath. No functional changes. --- libtommath/bn_mp_2expt.c | 3 +-- libtommath/bn_mp_abs.c | 3 +-- libtommath/bn_mp_add_d.c | 3 +-- libtommath/bn_mp_addmod.c | 3 +-- libtommath/bn_mp_and.c | 3 +-- libtommath/bn_mp_clamp.c | 3 +-- libtommath/bn_mp_clear.c | 3 +-- libtommath/bn_mp_cmp.c | 3 +-- libtommath/bn_mp_copy.c | 3 +-- libtommath/bn_mp_count_bits.c | 3 +-- libtommath/bn_mp_div.c | 2 +- libtommath/bn_mp_div_3.c | 3 +-- libtommath/bn_mp_div_d.c | 7 +++++-- libtommath/bn_mp_dr_reduce.c | 3 +-- libtommath/bn_mp_dr_setup.c | 3 +-- libtommath/bn_mp_exch.c | 3 +-- libtommath/bn_mp_export.c | 8 +++----- libtommath/bn_mp_exptmod_fast.c | 4 ++-- libtommath/bn_mp_exteuclid.c | 2 +- libtommath/bn_mp_get_int.c | 6 +++--- libtommath/bn_mp_get_long.c | 6 +++--- libtommath/bn_mp_get_long_long.c | 6 +++--- libtommath/bn_mp_import.c | 11 ++++------- libtommath/bn_mp_is_square.c | 16 ++++++++-------- libtommath/bn_mp_mod.c | 3 +-- libtommath/bn_mp_mod_2d.c | 3 +-- libtommath/bn_mp_mod_d.c | 3 +-- libtommath/bn_mp_montgomery_reduce.c | 3 +-- libtommath/bn_mp_montgomery_setup.c | 3 +-- libtommath/bn_mp_mul.c | 2 +- libtommath/bn_mp_mul_d.c | 7 +++---- libtommath/bn_mp_radix_size.c | 2 +- libtommath/bn_mp_rand.c | 3 +-- libtommath/bn_mp_read_radix.c | 4 ++-- libtommath/bn_mp_sqr.c | 3 +-- libtommath/bn_mp_sqrmod.c | 3 +-- libtommath/bn_mp_sub.c | 3 +-- libtommath/bn_mp_sub_d.c | 3 +-- libtommath/bn_mp_submod.c | 3 +-- libtommath/bn_mp_toom_sqr.c | 3 +-- libtommath/bn_mp_toradix.c | 2 +- libtommath/bn_mp_toradix_n.c | 2 +- libtommath/bn_mp_xor.c | 3 +-- libtommath/bn_reverse.c | 3 +-- libtommath/bn_s_mp_add.c | 3 +-- libtommath/bn_s_mp_exptmod.c | 6 +++--- libtommath/bn_s_mp_mul_high_digs.c | 3 +-- libtommath/bn_s_mp_sqr.c | 4 ++-- libtommath/bn_s_mp_sub.c | 3 +-- 49 files changed, 78 insertions(+), 112 deletions(-) diff --git a/libtommath/bn_mp_2expt.c b/libtommath/bn_mp_2expt.c index bdc868f..701144c 100644 --- a/libtommath/bn_mp_2expt.c +++ b/libtommath/bn_mp_2expt.c @@ -20,8 +20,7 @@ * Simple algorithm which zeroes the int, grows it then just sets one bit * as required. */ -int -mp_2expt(mp_int *a, int b) +int mp_2expt(mp_int *a, int b) { int res; diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index 03904d2..9b6bcec 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -19,8 +19,7 @@ * * Simple function copies the input and fixes the sign to positive */ -int -mp_abs(const mp_int *a, mp_int *b) +int mp_abs(const mp_int *a, mp_int *b) { int res; diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index 5270d27..e5ede1f 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -16,8 +16,7 @@ */ /* single digit addition */ -int -mp_add_d(const mp_int *a, mp_digit b, mp_int *c) +int mp_add_d(const mp_int *a, mp_digit b, mp_int *c) { int res, ix, oldused; mp_digit *tmpa, *tmpc, mu; diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index 5aee233..0d612c3 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -16,8 +16,7 @@ */ /* d = a + b (mod c) */ -int -mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) +int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index c6e8cf7..09ff772 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -16,8 +16,7 @@ */ /* AND two ints together */ -int -mp_and(const mp_int *a, const mp_int *b, mp_int *c) +int mp_and(const mp_int *a, const mp_int *b, mp_int *c) { int res, ix, px; mp_int t; diff --git a/libtommath/bn_mp_clamp.c b/libtommath/bn_mp_clamp.c index e5c8907..3853914 100644 --- a/libtommath/bn_mp_clamp.c +++ b/libtommath/bn_mp_clamp.c @@ -22,8 +22,7 @@ * Typically very fast. Also fixes the sign if there * are no more leading digits */ -void -mp_clamp(mp_int *a) +void mp_clamp(mp_int *a) { /* decrease used while the most significant digit is * zero. diff --git a/libtommath/bn_mp_clear.c b/libtommath/bn_mp_clear.c index eada2d7..fcf4d61 100644 --- a/libtommath/bn_mp_clear.c +++ b/libtommath/bn_mp_clear.c @@ -16,8 +16,7 @@ */ /* clear one (frees) */ -void -mp_clear(mp_int *a) +void mp_clear(mp_int *a) { int i; diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index 37f616e..a33d483 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -16,8 +16,7 @@ */ /* compare two ints (signed)*/ -int -mp_cmp(const mp_int *a, const mp_int *b) +int mp_cmp(const mp_int *a, const mp_int *b) { /* compare based on sign */ if (a->sign != b->sign) { diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index 0f31138..17816e8 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -16,8 +16,7 @@ */ /* copy, b = a */ -int -mp_copy(const mp_int *a, mp_int *b) +int mp_copy(const mp_int *a, mp_int *b) { int res, n; diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index f2cd190..7424581 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -16,8 +16,7 @@ */ /* returns the number of bits in an int */ -int -mp_count_bits(const mp_int *a) +int mp_count_bits(const mp_int *a) { int r; mp_digit q; diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index 6bad443..dbfdc03 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -167,7 +167,7 @@ int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d) t = y.used - 1; /* while (x >= y*b**n-t) do { q[n-t] += 1; x -= y*b**{n-t} } */ - if ((res = mp_lshd(&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */ + if ((res = mp_lshd(&y, n - t)) != MP_OKAY) { /* y = y*b**{n-t} */ goto LBL_Y; } diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index 8011965..9cc8caa 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -16,8 +16,7 @@ */ /* divide by three (based on routine from MPI and the GMP manual) */ -int -mp_div_3(const mp_int *a, mp_int *c, mp_digit *d) +int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d) { mp_int q; mp_word w, t; diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index 9997646..0e9dc95 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -19,10 +19,13 @@ static int s_is_power_of_two(mp_digit b, int *p) { int x; - /* quick out - if (b & (b-1)) isn't zero, b isn't a power of two */ - if ((b == 0) || ((b & (b-1)) != 0)) { + /* fast return if no power of two */ + if ((b & (b-1)) != 0) { return 0; } + + /* This loops gives the wrong result for b==1, + * but this function is never called for those values. */ for (x = 1; x < DIGIT_BIT; x++) { if (b == (((mp_digit)1)<dp[0])); + *d = (mp_digit)((((mp_word)1) << ((mp_word)DIGIT_BIT)) - ((mp_word)a->dp[0])); } #endif diff --git a/libtommath/bn_mp_exch.c b/libtommath/bn_mp_exch.c index a95560a..2bc635f 100644 --- a/libtommath/bn_mp_exch.c +++ b/libtommath/bn_mp_exch.c @@ -18,8 +18,7 @@ /* swap the elements of two integers, for cases where you can't simply swap the * mp_int pointers around */ -void -mp_exch(mp_int *a, mp_int *b) +void mp_exch(mp_int *a, mp_int *b) { mp_int t; diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index 43228a8..b69a4fb 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -53,11 +53,9 @@ int mp_export(void *rop, size_t *countp, int order, size_t size, for (i = 0; i < count; ++i) { for (j = 0; j < size; ++j) { - unsigned char *byte = ( - (unsigned char *)rop + - (((order == -1) ? i : ((count - 1) - i)) * size) + - ((endian == -1) ? j : ((size - 1) - j)) - ); + unsigned char *byte = (unsigned char *)rop + + (((order == -1) ? i : ((count - 1) - i)) * size) + + ((endian == -1) ? j : ((size - 1) - j)); if (j >= (size - nail_bytes)) { *byte = 0; diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 08c6bc3..4a188d0 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -24,9 +24,9 @@ */ #ifdef MP_LOW_MEM -#define TAB_SIZE 32 +# define TAB_SIZE 32 #else -#define TAB_SIZE 256 +# define TAB_SIZE 256 #endif int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index adaea86..08e5ff2 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -20,7 +20,7 @@ */ int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) { - mp_int u1,u2,u3,v1,v2,v3,t1,t2,t3,q,tmp; + mp_int u1, u2, u3, v1, v2, v3, t1, t2, t3, q, tmp; int err; if ((err = mp_init_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL)) != MP_OKAY) { diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index 5d26ce9..f4a347f 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -26,13 +26,13 @@ unsigned long mp_get_int(const mp_int *a) } /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + i = MIN(a->used, (int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; /* get most significant digit of result */ - res = DIGIT(a,i); + res = DIGIT(a, i); while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); + res = (res << DIGIT_BIT) | DIGIT(a, i); } /* force result to 32-bits always so it is consistent on non 32-bit platforms */ diff --git a/libtommath/bn_mp_get_long.c b/libtommath/bn_mp_get_long.c index ea9ac43..3fc7c35 100644 --- a/libtommath/bn_mp_get_long.c +++ b/libtommath/bn_mp_get_long.c @@ -26,14 +26,14 @@ unsigned long mp_get_long(const mp_int *a) } /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + i = MIN(a->used, (int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; /* get most significant digit of result */ - res = DIGIT(a,i); + res = DIGIT(a, i); #if (ULONG_MAX != 0xffffffffuL) || (DIGIT_BIT < 32) while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); + res = (res << DIGIT_BIT) | DIGIT(a, i); } #endif return res; diff --git a/libtommath/bn_mp_get_long_long.c b/libtommath/bn_mp_get_long_long.c index 111b469..a363f60 100644 --- a/libtommath/bn_mp_get_long_long.c +++ b/libtommath/bn_mp_get_long_long.c @@ -26,14 +26,14 @@ Tcl_WideUInt mp_get_long_long(const mp_int *a) } /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(Tcl_WideUInt) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + i = MIN(a->used, (int)(((sizeof(Tcl_WideUInt) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; /* get most significant digit of result */ - res = DIGIT(a,i); + res = DIGIT(a, i); #if DIGIT_BIT < 64 while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); + res = (res << DIGIT_BIT) | DIGIT(a, i); } #endif return res; diff --git a/libtommath/bn_mp_import.c b/libtommath/bn_mp_import.c index 50bee2e..afd735e 100644 --- a/libtommath/bn_mp_import.c +++ b/libtommath/bn_mp_import.c @@ -46,14 +46,11 @@ int mp_import(mp_int *rop, size_t count, int order, size_t size, for (i = 0; i < count; ++i) { for (j = 0; j < (size - nail_bytes); ++j) { - unsigned char byte = *( - (unsigned char *)op + - (((order == 1) ? i : ((count - 1) - i)) * size) + - ((endian == 1) ? (j + nail_bytes) : (((size - 1) - j) - nail_bytes)) - ); + unsigned char byte = *((unsigned char *)op + + (((order == 1) ? i : ((count - 1) - i)) * size) + + ((endian == 1) ? (j + nail_bytes) : (((size - 1) - j) - nail_bytes))); - if ( - (result = mp_mul_2d(rop, ((j == 0) ? (8 - odd_nails) : 8), rop)) != MP_OKAY) { + if ((result = mp_mul_2d(rop, ((j == 0) ? (8 - odd_nails) : 8), rop)) != MP_OKAY) { return result; } diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 4d8612f..dd5150e 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -38,7 +38,7 @@ static const char rem_105[105] = { }; /* Store non-zero to ret if arg is square, and zero if not */ -int mp_is_square(const mp_int *arg,int *ret) +int mp_is_square(const mp_int *arg, int *ret) { int res; mp_digit c; @@ -58,12 +58,12 @@ int mp_is_square(const mp_int *arg,int *ret) } /* First check mod 128 (suppose that DIGIT_BIT is at least 7) */ - if (rem_128[127 & DIGIT(arg,0)] == 1) { + if (rem_128[127 & DIGIT(arg, 0)] == 1) { return MP_OKAY; } /* Next check mod 105 (3*5*7) */ - if ((res = mp_mod_d(arg,105,&c)) != MP_OKAY) { + if ((res = mp_mod_d(arg, 105, &c)) != MP_OKAY) { return res; } if (rem_105[c] == 1) { @@ -71,10 +71,10 @@ int mp_is_square(const mp_int *arg,int *ret) } - if ((res = mp_init_set_int(&t,11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { + if ((res = mp_init_set_int(&t, 11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { return res; } - if ((res = mp_mod(arg,&t,&t)) != MP_OKAY) { + if ((res = mp_mod(arg, &t, &t)) != MP_OKAY) { goto ERR; } r = mp_get_int(&t); @@ -91,14 +91,14 @@ int mp_is_square(const mp_int *arg,int *ret) if (((1L<<(r%31)) & 0x6DE2B848L) != 0L) goto ERR; /* Final check - is sqr(sqrt(arg)) == arg ? */ - if ((res = mp_sqrt(arg,&t)) != MP_OKAY) { + if ((res = mp_sqrt(arg, &t)) != MP_OKAY) { goto ERR; } - if ((res = mp_sqr(&t,&t)) != MP_OKAY) { + if ((res = mp_sqr(&t, &t)) != MP_OKAY) { goto ERR; } - *ret = (mp_cmp_mag(&t,arg) == MP_EQ) ? MP_YES : MP_NO; + *ret = (mp_cmp_mag(&t, arg) == MP_EQ) ? MP_YES : MP_NO; ERR: mp_clear(&t); return res; diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index a7525c0..64e73ea 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -16,8 +16,7 @@ */ /* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */ -int -mp_mod(const mp_int *a, const mp_int *b, mp_int *c) +int mp_mod(const mp_int *a, const mp_int *b, mp_int *c) { mp_int t; int res; diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 31997d3..8e69757 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -16,8 +16,7 @@ */ /* calc a value mod 2**b */ -int -mp_mod_2d(const mp_int *a, int b, mp_int *c) +int mp_mod_2d(const mp_int *a, int b, mp_int *c) { int x, res; diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index 5217aa4..9a24e78 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -15,8 +15,7 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -int -mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c) +int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c) { return mp_div_d(a, b, NULL, c); } diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index e9f6c1c..a38173e 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -16,8 +16,7 @@ */ /* computes xR**-1 == x (mod N) via Montgomery Reduction */ -int -mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho) +int mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho) { int ix, res, digs; mp_digit mu; diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index 37069c3..685ba51 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -16,8 +16,7 @@ */ /* setups the montgomery reduction stuff */ -int -mp_montgomery_setup(const mp_int *n, mp_digit *rho) +int mp_montgomery_setup(const mp_int *n, mp_digit *rho) { mp_digit x, b; diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index 6e7f956..71d523d 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -51,7 +51,7 @@ int mp_mul(const mp_int *a, const mp_int *b, mp_int *c) #endif { #ifdef BN_S_MP_MUL_DIGS_C - res = s_mp_mul(a, b, c); /* uses s_mp_mul_digs */ + res = s_mp_mul(a, b, c); /* uses s_mp_mul_digs */ #else res = MP_VAL; #endif diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index 98b99c9..0f6d03e 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -16,8 +16,7 @@ */ /* multiply by a digit */ -int -mp_mul_d(const mp_int *a, mp_digit b, mp_int *c) +int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c) { mp_digit u, *tmpa, *tmpc; mp_word r; @@ -51,10 +50,10 @@ mp_mul_d(const mp_int *a, mp_digit b, mp_int *c) r = (mp_word)u + ((mp_word)*tmpa++ * (mp_word)b); /* mask off higher bits to get a single digit */ - *tmpc++ = (mp_digit)(r & ((mp_word) MP_MASK)); + *tmpc++ = (mp_digit)(r & ((mp_word)MP_MASK)); /* send carry into next iteration */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + u = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); } /* store final carry [if any] and increment ix offset */ diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c index edcf618..29355cb 100644 --- a/libtommath/bn_mp_radix_size.c +++ b/libtommath/bn_mp_radix_size.c @@ -58,7 +58,7 @@ int mp_radix_size(const mp_int *a, int radix, int *size) /* fetch out all of the digits */ while (mp_iszero(&t) == MP_NO) { - if ((res = mp_div_d(&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { + if ((res = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) { mp_clear(&t); return res; } diff --git a/libtommath/bn_mp_rand.c b/libtommath/bn_mp_rand.c index 7ac01dc..92a9a97 100644 --- a/libtommath/bn_mp_rand.c +++ b/libtommath/bn_mp_rand.c @@ -41,8 +41,7 @@ static mp_digit s_gen_random(void) return d; } -int -mp_rand(mp_int *a, int digits) +int mp_rand(mp_int *a, int digits) { int res; mp_digit d; diff --git a/libtommath/bn_mp_read_radix.c b/libtommath/bn_mp_read_radix.c index 6e57ed5..bc31cc5 100644 --- a/libtommath/bn_mp_read_radix.c +++ b/libtommath/bn_mp_read_radix.c @@ -60,10 +60,10 @@ int mp_read_radix(mp_int *a, const char *str, int radix) * to the number, otherwise exit the loop. */ if (y < radix) { - if ((res = mp_mul_d(a, (mp_digit) radix, a)) != MP_OKAY) { + if ((res = mp_mul_d(a, (mp_digit)radix, a)) != MP_OKAY) { return res; } - if ((res = mp_add_d(a, (mp_digit) y, a)) != MP_OKAY) { + if ((res = mp_add_d(a, (mp_digit)y, a)) != MP_OKAY) { return res; } } else { diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index 0fd077c..2b71097 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -16,8 +16,7 @@ */ /* computes b = a*a */ -int -mp_sqr(const mp_int *a, mp_int *b) +int mp_sqr(const mp_int *a, mp_int *b) { int res; diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index b8265fe..c3c7ec9 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -16,8 +16,7 @@ */ /* c = a * a (mod b) */ -int -mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c) +int mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c) { int res; mp_int t; diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index b865dbd..19cb65e 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -16,8 +16,7 @@ */ /* high level subtraction (handles signs) */ -int -mp_sub(const mp_int *a, const mp_int *b, mp_int *c) +int mp_sub(const mp_int *a, const mp_int *b, mp_int *c) { int sa, sb, res; diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index e22c35c..4d66a90 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -16,8 +16,7 @@ */ /* single digit subtraction */ -int -mp_sub_d(const mp_int *a, mp_digit b, mp_int *c) +int mp_sub_d(const mp_int *a, mp_digit b, mp_int *c) { mp_digit *tmpa, *tmpc, mu; int res, ix, oldused; diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index 9a45f6d..c4db397 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -16,8 +16,7 @@ */ /* d = a - b (mod c) */ -int -mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) +int mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 921d6a5..b985435 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -16,8 +16,7 @@ */ /* squaring using Toom-Cook 3-way algorithm */ -int -mp_toom_sqr(const mp_int *a, mp_int *b) +int mp_toom_sqr(const mp_int *a, mp_int *b) { mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; int res, B; diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index 79960f0..7dd6e4f 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -48,7 +48,7 @@ int mp_toradix(const mp_int *a, char *str, int radix) digs = 0; while (mp_iszero(&t) == MP_NO) { - if ((res = mp_div_d(&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { + if ((res = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) { mp_clear(&t); return res; } diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index 5d766bd..ef885fc 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -61,7 +61,7 @@ int mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen) /* no more room */ break; } - if ((res = mp_div_d(&t, (mp_digit) radix, &t, &d)) != MP_OKAY) { + if ((res = mp_div_d(&t, (mp_digit)radix, &t, &d)) != MP_OKAY) { mp_clear(&t); return res; } diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index 91bcd02..9ebc53a 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -16,8 +16,7 @@ */ /* XOR two ints together */ -int -mp_xor(const mp_int *a, const mp_int *b, mp_int *c) +int mp_xor(const mp_int *a, const mp_int *b, mp_int *c) { int res, ix, px; mp_int t; diff --git a/libtommath/bn_reverse.c b/libtommath/bn_reverse.c index c3e7cf2..71e3d03 100644 --- a/libtommath/bn_reverse.c +++ b/libtommath/bn_reverse.c @@ -16,8 +16,7 @@ */ /* reverse an array, used for radix code */ -void -bn_reverse(unsigned char *s, int len) +void bn_reverse(unsigned char *s, int len) { int ix, iy; unsigned char t; diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 415521f..2046722 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -16,8 +16,7 @@ */ /* low level addition, based on HAC pp.594, Algorithm 14.7 */ -int -s_mp_add(const mp_int *a, const mp_int *b, mp_int *c) +int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c) { const mp_int *x; int olduse, res, min, max; diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index e73c12e..0d0145d 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -15,9 +15,9 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ #ifdef MP_LOW_MEM -#define TAB_SIZE 32 +# define TAB_SIZE 32 #else -#define TAB_SIZE 256 +# define TAB_SIZE 256 #endif int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) @@ -152,7 +152,7 @@ int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, i } /* read next digit and reset the bitcnt */ buf = X->dp[digidx--]; - bitcnt = (int) DIGIT_BIT; + bitcnt = (int)DIGIT_BIT; } /* grab the next msb from the exponent */ diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 0a829b9..37c108e 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -18,8 +18,7 @@ /* multiplies |a| * |b| and does not compute the lower digs digits * [meant to get the higher part of the product] */ -int -s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) +int s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { mp_int t; int res, pa, pb, ix, iy; diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index e07bf1c..aae06eb 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -38,10 +38,10 @@ int s_mp_sqr(const mp_int *a, mp_int *b) ((mp_word)a->dp[ix] * (mp_word)a->dp[ix]); /* store lower part in result */ - t.dp[ix+ix] = (mp_digit)(r & ((mp_word) MP_MASK)); + t.dp[ix+ix] = (mp_digit)(r & ((mp_word)MP_MASK)); /* get the carry */ - u = (mp_digit)(r >> ((mp_word) DIGIT_BIT)); + u = (mp_digit)(r >> ((mp_word)DIGIT_BIT)); /* left hand side of A[ix] * A[iy] */ tmpx = a->dp[ix]; diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index 8373025..52b8096 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -16,8 +16,7 @@ */ /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ -int -s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) +int s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) { int olduse, res, min, max; -- cgit v0.12 From 1b28405773771365e5ad486b41fe5f2c43703d27 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 20 Sep 2017 09:21:54 +0000 Subject: Move fast return from s_is_power_of_two() to mp_div_d(). This saves a function call in the common case where b is not a power of 2. --- libtommath/bn_mp_div_d.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index 0e9dc95..d0131c3 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -19,13 +19,8 @@ static int s_is_power_of_two(mp_digit b, int *p) { int x; - /* fast return if no power of two */ - if ((b & (b-1)) != 0) { - return 0; - } - - /* This loops gives the wrong result for b==1, - * but this function is never called for those values. */ + /* Gives the wrong result for b==1, but this function + * is never called for this value anyway. */ for (x = 1; x < DIGIT_BIT; x++) { if (b == (((mp_digit)1)<dp[0] & ((((mp_digit)1)< Date: Wed, 20 Sep 2017 12:58:59 +0000 Subject: First cut at making application-independent compile and link flags common to all extensions defined in a single place - rules.vc - instead of having each extension cut and paste the same code. --- win/makefile.vc | 90 ++------------------------------------------- win/rules.vc | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 114 insertions(+), 88 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index e82b288..19f41ab 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -463,47 +463,12 @@ PKGSDIR = $(ROOT)\pkgs # Compile flags #--------------------------------------------------------------------- -!if !$(DEBUG) -!if $(OPTIMIZING) -### This cranks the optimization level to maximize speed -cdebug = $(OPTIMIZATIONS) -!else -cdebug = -!endif -!if $(SYMBOLS) -cdebug = $(cdebug) -Zi -!endif -!else if "$(MACHINE)" == "AMD64" -### Warnings are too many, can't support warnings into errors. -cdebug = -Zi -Od $(DEBUGFLAGS) -!else -cdebug = -Zi -WX $(DEBUGFLAGS) -!endif ### Declarations common to all compiler options -cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE -!if "$(MACHINE)" == "AMD64" -# Disable pointer<->int warnings related to cast between different sizes -# There are a gadzillion of these due to use of ClientData and clutter up compiler -# output increasing chance of a real warning getting lost. So disable them. -# Eventually some day, Tcl will be 64-bit clean. -cwarn = $(cwarn) -wd4311 -wd4312 -!endif +cwarn = $(cwarn) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE + cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ -!if $(MSVCRT) -!if $(DEBUG) && !$(UNCHECKED) -crt = -MDd -!else -crt = -MD -!endif -!else -!if $(DEBUG) && !$(UNCHECKED) -crt = -MTd -!else -crt = -MT -!endif -!endif TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TOMMATHDIR)" TCL_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 @@ -514,56 +479,9 @@ STUB_CFLAGS = $(cflags) $(cdebug) $(OPTDEFINES) #--------------------------------------------------------------------- -# Link flags +# Link libraries #--------------------------------------------------------------------- - -!if $(DEBUG) -ldebug = -debug -debugtype:cv -!else -ldebug = -release -opt:ref -opt:icf,3 -!if $(SYMBOLS) -ldebug = $(ldebug) -debug -debugtype:cv -!endif -!endif - -### Declarations common to all linker options -lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) - -!if $(PROFILE) -lflags = $(lflags) -profile -!endif - -!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 -lflags = $(lflags) -nodefaultlib:libucrt.lib -!endif - -!if $(ALIGN98_HACK) && !$(STATIC_BUILD) -### Align sections for PE size savings. -lflags = $(lflags) -opt:nowin98 -!else if !$(ALIGN98_HACK) && $(STATIC_BUILD) -### Align sections for speed in loading by choosing the virtual page size. -lflags = $(lflags) -align:4096 -!endif - -!if $(LOIMPACT) -lflags = $(lflags) -ws:aggressive -!endif - -dlllflags = $(lflags) -dll -conlflags = $(lflags) -subsystem:console -guilflags = $(lflags) -subsystem:windows - -baselibs = netapi32.lib kernel32.lib user32.lib advapi32.lib userenv.lib ws2_32.lib -# Avoid 'unresolved external symbol __security_cookie' errors. -# c.f. http://support.microsoft.com/?id=894573 -!if "$(MACHINE)" == "AMD64" -!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500 -baselibs = $(baselibs) bufferoverflowU.lib -!endif -!endif -!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 -baselibs = $(baselibs) ucrt.lib -!endif +extralibs = netapi32.lib user32.lib userenv.lib ws2_32.lib #--------------------------------------------------------------------- # TclTest flags diff --git a/win/rules.vc b/win/rules.vc index afa8c2c..ce17485 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -157,7 +157,7 @@ DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 DEBUGFLAGS = $(DEBUGFLAGS) -GZ !endif -COMPILERFLAGS =-W3 /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING +COMPILERFLAGS = /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING # In v13 -GL and -YX are incompatible. !if [nmakehlp -c -YX] @@ -702,6 +702,114 @@ TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" !endif + +#----------------------------------------------------------------------------------- +# Now we have all the information we need, set up the actual flags and options that +# we will pass to the compiler and linker. The main makefile should use these in +# combination with whatever other flags and switches are specific to it. +#----------------------------------------------------------------------------------- + +# crt picks the C run time based on selected OPTS +!if $(MSVCRT) +!if $(DEBUG) && !$(UNCHECKED) +crt = -MDd +!else +crt = -MD +!endif +!else +!if $(DEBUG) && !$(UNCHECKED) +crt = -MTd +!else +crt = -MT +!endif +!endif + +# cdebug includes compiler options for debugging as well as optimization. +!if $(DEBUG) + +# In debugging mode, optimizations need to be disabled +cdebug = -Zi -Od $(DEBUGFLAGS) + +!else + +cdebug = $(OPTIMIZATIONS) +!if $(SYMBOLS) +cdebug = $(cdebug) -Zi +!endif + +!endif # $(DEBUG) + +# cwarn includes default warning levels. +cwarn = $(WARNINGS) +!if "$(MACHINE)" == "AMD64" +# Disable pointer<->int warnings related to cast between different sizes +# There are a gadzillion of these due to use of ClientData and clutter up compiler +# output increasing chance of a real warning getting lost. So disable them. +# Eventually some day, Tcl will be 64-bit clean. +cwarn = $(cwarn) -wd4311 -wd4312 +!endif +!if $(DEBUG) +# Turn warnings into errors +cwarn = $(cwarn) -WX +!endif + +# Link flags + +!if $(DEBUG) +ldebug = -debug -debugtype:cv +!else +ldebug = -release -opt:ref -opt:icf,3 +!if $(SYMBOLS) +ldebug = $(ldebug) -debug -debugtype:cv +!endif +!endif + +# Note: Profiling is currently only possible with the Enterprise version of Visual Studio +!if $(PROFILE) +ldebug= $(ldebug) -profile +!endif + +### Declarations common to all linker versions +lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) + +!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 +lflags = $(lflags) -nodefaultlib:libucrt.lib +!endif + +!if $(ALIGN98_HACK) && !$(STATIC_BUILD) +### Align sections for PE size savings. +lflags = $(lflags) -opt:nowin98 +!else if !$(ALIGN98_HACK) && $(STATIC_BUILD) +### Align sections for speed in loading by choosing the virtual page size. +lflags = $(lflags) -align:4096 +!endif + +!if $(LOIMPACT) +lflags = $(lflags) -ws:aggressive +!endif + +dlllflags = $(lflags) -dll +conlflags = $(lflags) -subsystem:console +guilflags = $(lflags) -subsystem:windows + +# Libraries that are required for every image. +# Extensions should define any additional libraries with $(extralibs) +winlibs = kernel32.lib advapi32.lib + +# Avoid 'unresolved external symbol __security_cookie' errors. +# c.f. http://support.microsoft.com/?id=894573 +!if "$(MACHINE)" == "AMD64" +!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500 +winlibs = $(winlibs) bufferoverflowU.lib +!endif +!endif + +baselibs = $(winlibs) $(extralibs) + +!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 +baselibs = $(baselibs) ucrt.lib +!endif + #---------------------------------------------------------- # Display stats being used. #---------------------------------------------------------- @@ -715,4 +823,4 @@ TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" !message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)' !message *** Link options '$(LINKERFLAGS)' -!endif +!endif # ifdef _RULES_VC -- cgit v0.12 From d45863129f9c0e0c509456d9615321b6e7202a5e Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Thu, 21 Sep 2017 18:47:45 +0000 Subject: RFE [566a999189] - better error message for 32/64 bit mismatch on load. --- win/tclWinLoad.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 26512b1..3ad6328 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -66,6 +66,7 @@ TclpDlopen( HINSTANCE hInstance; const TCHAR *nativeName; Tcl_LoadHandle handlePtr; + DWORD firstError; /* * First try the full path the user gave us. This is particularly @@ -84,6 +85,12 @@ TclpDlopen( Tcl_DString ds; + /* + * Remember the first error on load attempt to be used if the + * second load attempt below also fails. + */ + firstError = GetLastError(); + nativeName = Tcl_WinUtfToTChar(Tcl_GetString(pathPtr), -1, &ds); hInstance = LoadLibraryEx(nativeName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); @@ -91,8 +98,21 @@ TclpDlopen( } if (hInstance == NULL) { - DWORD lastError = GetLastError(); - Tcl_Obj *errMsg = Tcl_ObjPrintf("couldn't load library \"%s\": ", + DWORD lastError; + Tcl_Obj *errMsg; + + /* + * We choose to only use the error from the second call if the first + * call failed due to the file not being found. Else stick to the + * first error for reporting purposes. + */ + if (firstError == ERROR_MOD_NOT_FOUND || + firstError == ERROR_DLL_NOT_FOUND) + lastError = GetLastError(); + else + lastError = firstError; + + errMsg = Tcl_ObjPrintf("couldn't load library \"%s\": ", Tcl_GetString(pathPtr)); /* @@ -129,7 +149,11 @@ TclpDlopen( Tcl_AppendToObj(errMsg, "the library initialization" " routine failed", -1); break; - default: + case ERROR_BAD_EXE_FORMAT: + Tcl_SetErrorCode(interp, "WIN_LOAD", "BAD_EXE_FORMAT", NULL); + Tcl_AppendToObj(errMsg, "Bad exe format. Possibly a 32/64-bit mismatch.", -1); + break; + default: TclWinConvertError(lastError); Tcl_AppendToObj(errMsg, Tcl_PosixError(interp), -1); } -- cgit v0.12 From 4bf8f43b3a8029883f5c5f566ff9afaaecc33e6f Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Thu, 21 Sep 2017 19:05:11 +0000 Subject: RFE [566a999189] - better error message for 32/64 bit mismatch on load. --- win/tclWinLoad.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 26512b1..3ad6328 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -66,6 +66,7 @@ TclpDlopen( HINSTANCE hInstance; const TCHAR *nativeName; Tcl_LoadHandle handlePtr; + DWORD firstError; /* * First try the full path the user gave us. This is particularly @@ -84,6 +85,12 @@ TclpDlopen( Tcl_DString ds; + /* + * Remember the first error on load attempt to be used if the + * second load attempt below also fails. + */ + firstError = GetLastError(); + nativeName = Tcl_WinUtfToTChar(Tcl_GetString(pathPtr), -1, &ds); hInstance = LoadLibraryEx(nativeName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); @@ -91,8 +98,21 @@ TclpDlopen( } if (hInstance == NULL) { - DWORD lastError = GetLastError(); - Tcl_Obj *errMsg = Tcl_ObjPrintf("couldn't load library \"%s\": ", + DWORD lastError; + Tcl_Obj *errMsg; + + /* + * We choose to only use the error from the second call if the first + * call failed due to the file not being found. Else stick to the + * first error for reporting purposes. + */ + if (firstError == ERROR_MOD_NOT_FOUND || + firstError == ERROR_DLL_NOT_FOUND) + lastError = GetLastError(); + else + lastError = firstError; + + errMsg = Tcl_ObjPrintf("couldn't load library \"%s\": ", Tcl_GetString(pathPtr)); /* @@ -129,7 +149,11 @@ TclpDlopen( Tcl_AppendToObj(errMsg, "the library initialization" " routine failed", -1); break; - default: + case ERROR_BAD_EXE_FORMAT: + Tcl_SetErrorCode(interp, "WIN_LOAD", "BAD_EXE_FORMAT", NULL); + Tcl_AppendToObj(errMsg, "Bad exe format. Possibly a 32/64-bit mismatch.", -1); + break; + default: TclWinConvertError(lastError); Tcl_AppendToObj(errMsg, Tcl_PosixError(interp), -1); } -- cgit v0.12 From b0fe49c36dde40613283049b38e045f4f251c283 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 22 Sep 2017 08:48:23 +0000 Subject: Make libtommath's "make" work in Tcl environment (for testing). Eliminate internal s_is_power_of_two(), which can better be done inline. Fix tommath.h for _MSC_VER. --- libtommath/bn_mp_div_d.c | 22 ++++++---------------- libtommath/tommath.h | 4 +++- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index d0131c3..c408602 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -15,21 +15,6 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -static int s_is_power_of_two(mp_digit b, int *p) -{ - int x; - - /* Gives the wrong result for b==1, but this function - * is never called for this value anyway. */ - for (x = 1; x < DIGIT_BIT; x++) { - if (b == (((mp_digit)1)<dp[0] & ((((mp_digit)1)< Date: Fri, 22 Sep 2017 13:26:14 +0000 Subject: First step in complete refactoring. Breaking up into logical sections with comments. Fix floating point option selection to be the same on debug and release. Pick up nmakehlp.c from installed Tcl if available when building extensions. Mods to allow extensions to use the same exact rules.vc file. --- win/makefile.vc | 10 +- win/rules.vc | 421 ++++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 295 insertions(+), 136 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 19f41ab..49890f3 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -964,27 +964,27 @@ $(TCLOBJS) #--------------------------------------------------------------------- {$(WINDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<< + $(cc32) $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<< $< << {$(TOMMATHDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<< + $(cc32) $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<< $< << {$(GENERICDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<< + $(cc32) $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<< $< << {$(COMPATDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<< + $(cc32) $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<< $< << {$(COMPATDIR)\zlib}.c{$(TMP_DIR)}.obj:: - $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<< + $(cc32) $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<< $< << diff --git a/win/rules.vc b/win/rules.vc index ce17485..d3c36d9 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -9,23 +9,33 @@ # # Copyright (c) 2001-2003 David Gravereaux. # Copyright (c) 2003-2008 Patrick Thoyts +# Copyright (c) 2017 Ashok P. Nadkarni #------------------------------------------------------------------------------ !ifndef _RULES_VC _RULES_VC = 1 -cc32 = $(CC) # built-in default. -link32 = link -lib32 = lib -rc32 = $(RC) # built-in default. +################################################################ +# Nmake is a pretty weak environment in syntax and capabilities +# so this file is necessarily verbose. It's broken down into +# the following parts. +# +# 1. First define the external tools used for compiling, copying etc. +# as this is independent of everything else. +# 2. Figure out our build structure in terms of the directory, whether +# we are building Tcl or an extension, etc. +# 3. Determine the compiler and linker versions +# 4. Build the nmakehlp helper application +# 5. Determine the supported compiler options and features +# 6. Parse the OPTS macro value for user-specified configuration +# +# One final note about the macro names used. They are as they are +# for historical reasons. We would like legacy extensions to +# continue to work with this make include file so be wary of +# changing them for consistency or clarity. -!ifndef INSTALLDIR -### Assume the normal default. -_INSTALLDIR = C:\Program Files\Tcl -!else -### Fix the path separators. -_INSTALLDIR = $(INSTALLDIR:/=\) -!endif +################################################################ +# 1. Define external programs being used #---------------------------------------------------------- # Set the proper copy method to avoid overwrite questions @@ -39,9 +49,125 @@ CPY = xcopy /i /y >NUL COPY = copy /y >NUL MKDIR = mkdir -#------------------------------------------------------------------------------ -# Determine the host and target architectures and compiler version. -#------------------------------------------------------------------------------ + +###################################################################### +# 2. Figure out our build environment in terms of what we're building. +# +# (a) Tcl itself +# (b) a Tcl extension using libraries/includes from an *installed* Tcl +# (c) a Tcl extension using libraries/includes from Tcl source directory +# +# This last is needed because some extensions (even Tk) still need +# some Tcl interfaces that have are not publicly exposed. +# +# The fragment will set the following macros: +# _TCLDIR - root of the Tcl installation OR the Tcl sources. Not set +# when building Tcl itself. +# _INSTALLDIR - native form of the installation path. For Tcl +# this will be the root of the Tcl installation. For extensions +# this will be the lib directory under the root. +# TCLINSTALL - set to 1 if an extension is being built against the +# headers and libraries from an installed Tcl, and 0 if built against +# Tcl sources. Not set when building Tcl itself. Yes, not very well +# named. +# _TCL_H - native path to the tcl.h file + +# The root directory where the built packages and binaries will be installed. +# INSTALLDIR is the (optional) path specified by the user. +# _INSTALLDIR is INSTALLDIR using the backslash separator syntax +!ifdef INSTALLDIR +### Fix the path separators. +_INSTALLDIR = $(INSTALLDIR:/=\) +!else +### Assume the normal default. +_INSTALLDIR = C:\Program Files\Tcl +!endif + +!if "$(PROJECT)" == "tcl" # Case 2(a) - Building Tcl itself + +# Only need to define _TCL_H +_TCL_H = ..\generic\tcl.h + +!else # Case 2(b) or (c) - Building an extension + +# If command line has specified Tcl location through TCLDIR, use it +# else default to the INSTALLDIR setting +!ifdef TCLDIR + +_TCLDIR = $(TCLDIR:/=\) +!if exist("$(_TCLDIR)\include\tcl.h") # Case 2(a) with TCLDIR defined +TCLINSTALL = 1 +_TCL_H = $(_TCLDIR)\include\tcl.h +!elseif exist("$(_TCLDIR)\generic\tcl.h") # Case 2(b) with TCLDIR defined +TCLINSTALL = 0 +_TCL_H = $(_TCLDIR)\generic\tcl.h +!endif + +!else # TCLDIR is not defined + +!if "$(PROJECT)" == "tk" + +!if exist("..\..\tcl\generic\tcl.h") # Special case Tk with TCLDIR undefined +TCLINSTALL = 0 +TCLDIR = ..\..\tcl +_TCLDIR = $(TCLDIR) +_TCL_H = $(_TCLDIR)\generic\tcl.h +!endif + +!elseif exist("$(_INSTALLDIR)\include\tcl.h") # Case 2(a) for non-Tk with TCLDIR undefined + +TCLINSTALL = 1 +TCLDIR = $(_INSTALLDIR) +_TCLDIR = $(_INSTALLDIR) +_TCL_H = $(_INSTALLDIR)\include\tcl.h + +!endif # $(PROJECT) == "tk" + +!endif # TCLDIR + +# If INSTALLDIR set to tcl root dir then reset to the lib dir. +!if exist("$(_INSTALLDIR)\include\tcl.h") +_INSTALLDIR=$(_INSTALLDIR)\lib +!endif + +!endif # if $(PROJECT) == "tcl" + +!ifndef _TCL_H +MSG =^ +Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and default path does not contain tcl.h. +!error $(MSG) +!endif + + + +################################################################ +# 3. Determine compiler version and architecture +# In this section, we figure out the compiler version and the +# architecture for which we are building. This sets the +# following macros: +# VCVERSION - the internal compiler version as 1200, 1400, 1910 etc. +# This is also printed by the compiler in dotted form 19.10 etc. +# VCVER - the "marketing version", for example Visual C++ 6 for internal +# compiler version 1200. This is kept only for legacy reasons as it +# does not make sense for recent Microsoft compilers. Only used for +# output directory names. +# ARCH - set to IX86 or AMD64 depending on 32- or 64-bit target +# NATIVE_ARCH - set to IX86 or AMD64 for the host machine +# MACHINE - same as $(ARCH) - legacy +# _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed +# CFG_ENCODING - set to an character encoding. +# TBD - this is passed to compiler as TCL_CFGVAL_ENCODING but can't +# see where it is used + +cc32 = $(CC) # built-in default. +link32 = link +lib32 = lib +rc32 = $(RC) # built-in default. + +#---------------------------------------------------------------- +# Figure out the compiler architecture and version by writing +# the C macros to a file, preprocessing them with the C +# preprocessor and reading back the created file _HASH=^# _VC_MANIFEST_EMBED_EXE= @@ -53,7 +179,7 @@ VCVER=0 && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \ && ![echo ARCH=AMD64 >> vercl.x] \ && ![echo $(_HASH)endif >> vercl.x] \ - && ![cl -nologo -TC -P vercl.x $(ERRNULL)] + && ![$(cc32) -nologo -TC -P vercl.x $(ERRNULL)] !include vercl.i !if $(VCVERSION) < 1900 !if ![echo VCVER= ^\> vercl.vc] \ @@ -70,6 +196,26 @@ VCVER = $(VCVERSION) !if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc] !endif +#---------------------------------------------------------------- +# The MACHINE macro is used by legacy makefiles so set it as well +!ifdef MACHINE +!if "$(MACHINE)" == "x86" +!undef MACHINE +MACHINE = IX86 +!elseif "$(MACHINE)" == "x64" +!undef MACHINE +MACHINE = AMD64 +!endif +!if "$(MACHINE)" != "$(ARCH)" +!error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH). +!endif +!else +MACHINE=$(ARCH) +!endif + +#------------------------------------------------------------ +# Figure out the *host* architecture by reading the registry + !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86] NATIVE_ARCH=IX86 !else @@ -82,29 +228,95 @@ _VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -ou _VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 !endif -!ifndef MACHINE -MACHINE=$(ARCH) -!endif - !ifndef CFG_ENCODING CFG_ENCODING = \"cp1252\" !endif -!message =============================================================================== +!message ===================================================================== -#---------------------------------------------------------- -# build the helper app we need to overcome nmake's limiting -# environment. -#---------------------------------------------------------- +################################################################ +# 4. Build the nmakehlp program +# This is a helper app we need to overcome nmake's limiting +# environment. We will call out to it to get various bits of +# information about supported compiler options etc. +# +# Tcl itself will always use the nmakehlp.c program which is +# in its own source. This is the "master" copy and kept updated. +# +# Extensions built against an installed Tcl will use the installed +# copy of Tcl's nmakehlp.c if there is one and their own version +# otherwise. In the latter case, they would also be using their own +# rules.vc. Note that older versions of Tcl do not install nmakehlp.c +# or rules.vc. +# +# Extensions built against Tcl sources will use the one from the Tcl source. +# +# This can all be overridden by defining the NMAKEHLPC macro to point +# to the nmakehlp.c file to be used, either from the command line or +# the containing makefile. + +!ifndef NMAKEHLPC +# Default to the one in the current directory (the extension's own nmakehlp.c) +NMAKEHLPC = nmakehlp.c -!if !exist(nmakehlp.exe) -!if [$(cc32) -nologo nmakehlp.c -link -subsystem:console > nul] +!if "$(PROJECT)" != "tcl" +!if $(TCLINSTALL) +!if exist("$(_TCLDIR)\lib\config.nmake\nmakehlp.c") +NMAKEHLPC = $(_TCLDIR)\lib\config.nmake\nmakehlp.c !endif +!else # ! $(TCLINSTALL) +!if exist("$(_TCLDIR)\win\nmakehlp.c") +NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c !endif +!endif # $(TCLINSTALL) +!endif # $(PROJECT) != "tcl" -#---------------------------------------------------------- -# Test for compiler features -#---------------------------------------------------------- +!endif # NMAKEHLPC + +# We always build nmakehlp even if it exists since we do not know +# what source it was built from. +!message *** Using $(NMAKEHLPC) +!if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul] +!endif + +################################################################ +# 5. Test for compiler features +# Visual C++ compiler options have changed over the years. Check +# which options are supported by the compiler in use. +# +# The following macros are set: +# OPTIMIZATIONS - the compiler flags to be used for optimized builds +# DEBUGFLAGS - the compiler flags to be used for debug builds +# LINKERFLAGS - Flags passed to the linker +# +# Note that these are the compiler settings *available*, not those +# that will be *used*. The latter depends on the OPTS macro settings +# which we have not yet parsed. +# +# Also note that some of the flags in OPTIMIZATIONS are not really +# related to optimization. They are placed there only for legacy reasons +# as some extensions expect them to be included in that macro. + +# -Op improves float consistency. Note only needed for older compilers +# Newer compilers do not need or support this option. +!if [nmakehlp -c -Op] +FPOPTS = -Op +!endif + +# Strict floating point semantics - present in newer compilers in lieu of -Op +!if [nmakehlp -c -fp:strict] +FPOPTS = $(FPOPTS) -fp:strict +!endif + +!if "$(MACHINE)" == "IX86" +### test for pentium errata +!if [nmakehlp -c -QI0f] +!message *** Compiler has 'Pentium 0x0f fix' +FPOPTS = $(FPOPTS) -QI0f +!else +!message *** Compiler does not have 'Pentium 0x0f fix' +!endif +!endif ### test for optimizations # /O2 optimization includes /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy as per @@ -115,26 +327,16 @@ CFG_ENCODING = \"cp1252\" # default page size locals allocation probes and not what is implied # by an explicit /Gs option. +OPTIMIZATIONS = $(FPOPTS) + !if [nmakehlp -c -O2] !message *** Compiler has 'Optimizations' -OPTIMIZING = 1 -OPTIMIZATIONS = -O2 +OPTIMIZING = 1 +OPTIMIZATIONS = $(OPTIMIZATIONS) -O2 !else +# Legacy, really. All modern compilers support this !message *** Compiler does not have 'Optimizations' -OPTIMIZING = 0 -OPTIMIZATIONS = -!endif - - -# -Op improves float consistency. Note only needed for older compilers -# Newer compilers do not need or support this option. -!if [nmakehlp -c -Op] -OPTIMIZATIONS = $(OPTIMIZATIONS) -Op -!endif - -# Strict floating point semantics - present in newer compilers in lieu of -Op -!if [nmakehlp -c -fp:strict] -OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:strict +OPTIMIZING = 0 !endif # Checks for buffer overflows in local arrays @@ -142,60 +344,46 @@ OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:strict OPTIMIZATIONS = $(OPTIMIZATIONS) -GS !endif -# Link time optimization. Note that this option (potentially) makes generated libraries -# only usable by the specific VC++ version that created it. Requires /LTCG linker option +# Link time optimization. Note that this option (potentially) makes +# generated libraries only usable by the specific VC++ version that +# created it. Requires /LTCG linker option !if [nmakehlp -c -GL] OPTIMIZATIONS = $(OPTIMIZATIONS) -GL CC_GL_OPT_ENABLED = 1 +!else +# In newer compilers -GL and -YX are incompatible. +!if [nmakehlp -c -YX] +OPTIMIZATIONS = $(OPTIMIZATIONS) -YX !endif +!endif # [nmakehlp -c -GL] -DEBUGFLAGS = +DEBUGFLAGS = $(FPOPTS) +# Run time error checks. Not available or valid in a release, non-debug build +# RTC is for modern compilers, -GZ is legacy !if [nmakehlp -c -RTC1] DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 !elseif [nmakehlp -c -GZ] DEBUGFLAGS = $(DEBUGFLAGS) -GZ !endif -COMPILERFLAGS = /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING -# In v13 -GL and -YX are incompatible. -!if [nmakehlp -c -YX] -!if ![nmakehlp -c -GL] -OPTIMIZATIONS = $(OPTIMIZATIONS) -YX -!endif -!endif -!if "$(MACHINE)" == "IX86" -### test for pentium errata -!if [nmakehlp -c -QI0f] -!message *** Compiler has 'Pentium 0x0f fix' -COMPILERFLAGS = $(COMPILERFLAGS) -QI0f -!else -!message *** Compiler does not have 'Pentium 0x0f fix' -!endif -!endif +#---------------------------------------------------------------- +# Linker flags -# Prevents "LNK1561: entry point must be defined" error compiling from VS-IDE: +# LINKER_TESTFLAGS are for internal use when we call nmakehlp to test +# if the linker supports a specific option. Without these flags link will +# return "LNK1561: entry point must be defined" error compiling from VS-IDE: +# They are not passed through to the actual application / extension +# link rules. !ifndef LINKER_TESTFLAGS LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmhlp-out.txt !endif -!if "$(MACHINE)" == "IX86" -### test for -align:4096, when align:512 will do. -!if [nmakehlp -l -opt:nowin98 $(LINKER_TESTFLAGS)] -!message *** Linker has 'Win98 alignment problem' -ALIGN98_HACK = 1 -!else -!message *** Linker does not have 'Win98 alignment problem' -ALIGN98_HACK = 0 -!endif -!else -ALIGN98_HACK = 0 -!endif - LINKERFLAGS = +# If compiler has enabled link time optimization, linker must too with -ltcg !ifdef CC_GL_OPT_ENABLED !if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)] LINKERFLAGS = $(LINKERFLAGS) -ltcg @@ -503,47 +691,6 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 !endif -#---------------------------------------------------------- -# Locate the Tcl headers to build against -#---------------------------------------------------------- - -!if "$(PROJECT)" == "tcl" - -_TCL_H = ..\generic\tcl.h - -!else - -# If INSTALLDIR set to tcl root dir then reset to the lib dir. -!if exist("$(_INSTALLDIR)\include\tcl.h") -_INSTALLDIR=$(_INSTALLDIR)\lib -!endif - -!if !defined(TCLDIR) -!if exist("$(_INSTALLDIR)\..\include\tcl.h") -TCLINSTALL = 1 -_TCLDIR = $(_INSTALLDIR)\.. -_TCL_H = $(_INSTALLDIR)\..\include\tcl.h -TCLDIR = $(_INSTALLDIR)\.. -!else -MSG=^ -Failed to find tcl.h. Set the TCLDIR macro. -!error $(MSG) -!endif -!else -_TCLDIR = $(TCLDIR:/=\) -!if exist("$(_TCLDIR)\include\tcl.h") -TCLINSTALL = 1 -_TCL_H = $(_TCLDIR)\include\tcl.h -!elseif exist("$(_TCLDIR)\generic\tcl.h") -TCLINSTALL = 0 -_TCL_H = $(_TCLDIR)\generic\tcl.h -!else -MSG =^ -Failed to find tcl.h. The TCLDIR macro does not appear correct. -!error $(MSG) -!endif -!endif -!endif #-------------------------------------------------------------- # Extract various version numbers from tcl headers @@ -703,11 +850,14 @@ TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" !endif -#----------------------------------------------------------------------------------- -# Now we have all the information we need, set up the actual flags and options that -# we will pass to the compiler and linker. The main makefile should use these in -# combination with whatever other flags and switches are specific to it. -#----------------------------------------------------------------------------------- +#---------------------------------------------------------------------- +# Now we have all the information we need, set up the actual flags and +# options that we will pass to the compiler and linker. The main +# makefile should use these in combination with whatever other flags +# and switches are specific to it. +#---------------------------------------------------------------------- + +COMPILERFLAGS = /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING /DBUILD_$(PROJECT) # crt picks the C run time based on selected OPTS !if $(MSVCRT) @@ -741,13 +891,16 @@ cdebug = $(cdebug) -Zi # cwarn includes default warning levels. cwarn = $(WARNINGS) + !if "$(MACHINE)" == "AMD64" # Disable pointer<->int warnings related to cast between different sizes -# There are a gadzillion of these due to use of ClientData and clutter up compiler +# There are a gadzillion of these due to use of ClientData and +# clutter up compiler # output increasing chance of a real warning getting lost. So disable them. # Eventually some day, Tcl will be 64-bit clean. cwarn = $(cwarn) -wd4311 -wd4312 !endif + !if $(DEBUG) # Turn warnings into errors cwarn = $(cwarn) -WX @@ -764,7 +917,7 @@ ldebug = $(ldebug) -debug -debugtype:cv !endif !endif -# Note: Profiling is currently only possible with the Enterprise version of Visual Studio +# Note: Profiling is currently only possible with the Visual Studio Enterprise !if $(PROFILE) ldebug= $(ldebug) -profile !endif @@ -776,12 +929,16 @@ lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) lflags = $(lflags) -nodefaultlib:libucrt.lib !endif -!if $(ALIGN98_HACK) && !$(STATIC_BUILD) -### Align sections for PE size savings. +# Old linkers (Visual C++ 6 in particular) will link for fast loading +# on Win98. Since we do not support Win98 any more, we specify nowin98 +# as recommended for NT and later. However, this is only required by +# IX86 on older compilers and only needed if we are not doing a static build. + +!if "$(MACHINE)" == "IX86" && !$(STATIC_BUILD) +!if [nmakehlp -l -opt:nowin98 $(LINKER_TESTFLAGS)] +# Align sections for PE size savings. lflags = $(lflags) -opt:nowin98 -!else if !$(ALIGN98_HACK) && $(STATIC_BUILD) -### Align sections for speed in loading by choosing the virtual page size. -lflags = $(lflags) -align:4096 +!endif !endif !if $(LOIMPACT) @@ -810,6 +967,8 @@ baselibs = $(winlibs) $(extralibs) baselibs = $(baselibs) ucrt.lib !endif + + #---------------------------------------------------------- # Display stats being used. #---------------------------------------------------------- -- cgit v0.12 From c7e43807bf0e2db98723fe0513e4e92ec2ab60ae Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sat, 23 Sep 2017 07:35:32 +0000 Subject: More refactoring. Moved defines that are Tcl-specific to makefile.vc as rules.vc is common to extensions. Reworked parsing of STATS and CHECKS. --- win/makefile.vc | 24 +++++ win/rules.vc | 308 ++++++++++++++++++++++++++++++-------------------------- 2 files changed, 188 insertions(+), 144 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 49890f3..5a78e9f 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -182,6 +182,30 @@ Please `cd` to its location first. PROJECT = tcl !include "rules.vc" +!if [echo PKG_HTTP_VER = \>> versions.vc] \ + && [nmakehlp -V ..\library\http\pkgIndex.tcl http >> versions.vc] +!endif +!if [echo PKG_TCLTEST_VER = \>> versions.vc] \ + && [nmakehlp -V ..\library\tcltest\pkgIndex.tcl tcltest >> versions.vc] +!endif +!if [echo PKG_MSGCAT_VER = \>> versions.vc] \ + && [nmakehlp -V ..\library\msgcat\pkgIndex.tcl msgcat >> versions.vc] +!endif +!if [echo PKG_PLATFORM_VER = \>> versions.vc] \ + && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform " >> versions.vc] +!endif +!if [echo PKG_SHELL_VER = \>> versions.vc] \ + && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform::shell" >> versions.vc] +!endif +!if [echo PKG_DDE_VER = \>> versions.vc] \ + && [nmakehlp -V ..\library\dde\pkgIndex.tcl "dde " >> versions.vc] +!endif +!if [echo PKG_REG_VER =\>> versions.vc] \ + && [nmakehlp -V ..\library\reg\pkgIndex.tcl registry >> versions.vc] +!endif + +!include versions.vc + STUBPREFIX = $(PROJECT)stub DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) diff --git a/win/rules.vc b/win/rules.vc index d3c36d9..f58beb8 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -27,7 +27,12 @@ _RULES_VC = 1 # 3. Determine the compiler and linker versions # 4. Build the nmakehlp helper application # 5. Determine the supported compiler options and features -# 6. Parse the OPTS macro value for user-specified configuration +# 6. Parse the OPTS macro value for user-specified build configuration +# 7. Parse the STATS macro value for statistics instrumentation +# 8. Parse the CHECKS macro for additional compilation checks +# 9. Extract Tcl version numbers from the headers +# 10.Based on this specified configuration, construct the output +# directory names # # One final note about the macro names used. They are as they are # for historical reasons. We would like legacy extensions to @@ -390,14 +395,34 @@ LINKERFLAGS = $(LINKERFLAGS) -ltcg !endif !endif -#---------------------------------------------------------- -# Decode the options requested. -#---------------------------------------------------------- - -!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"] - -# if No OPTS specified +######################################################################## +# 6. Parse the OPTS macro to work out the requested build configuration. +# Based on this, we will construct the actual switches to be passed to the +# compiler and linker using the macros defined in the previous section. +# The following macros are defined by this section based on OPTS +# STATIC_BUILD - 0 -> Tcl is to be built as a shared library +# 1 -> build as a static library and shell +# TCL_THREADS - legacy but always 1 on Windows since winsock requires it. +# DEBUG - 1 -> debug build, 0 -> release builds +# SYMBOLS - 1 -> generate PDB's, 0 -> no PDB's +# PROFILE - 1 -> generate profiling info, 0 -> no profiling +# PGO - 1 -> profile based optimization, 0 -> no +# MSVCRT - 1 -> link to dynamic C runtime even when building static Tcl build +# 0 -> link to static C runtime for static Tcl build. +# Does not impact shared Tcl builds (STATIC_BUILD == 0) +# LOIMPACT - 1 -> Ask Windows loader to aggressively trim the working set. +# Will reduce physical memory use at cost of performance. +# TCL_USE_STATIC_PACKAGES - 1 -> statically link the registry and dde extensions +# in the Tcl shell. 0 -> keep them as shared libraries +# Does not impact shared Tcl builds. +# USE_THREAD_ALLOC - 1 -> Use a shared global free pool for allocation. +# 0 -> Use the non-thread allocator. +# UNCHECKED - 1 -> when doing a debug build with symbols, use the release +# C runtime, 0 -> use the debug C runtime. +# +# Further, LINKERFLAGS are modified based on above. +# Default values for all the above STATIC_BUILD = 0 TCL_THREADS = 1 DEBUG = 0 @@ -410,7 +435,9 @@ TCL_USE_STATIC_PACKAGES = 0 USE_THREAD_ALLOC = 1 UNCHECKED = 0 -!else +# If OPTS is not empty AND does not contain "none" which turns off all OPTS +# set the above macros based on OPTS content +!if "$(OPTS)" != "" && ![nmakehlp -f "$(OPTS)" "none"] # OPTS are specified, parse them @@ -446,12 +473,6 @@ TCL_USE_STATIC_PACKAGES = 0 !if [nmakehlp -f $(OPTS) "nothreads"] !error Option "nothreads" no longer supported. Threads required for sockets, registry and dde to work. -!message *** Compile explicitly for non-threaded tcl -TCL_THREADS = 0 -USE_THREAD_ALLOC= 0 -!else -TCL_THREADS = 1 -USE_THREAD_ALLOC= 1 !endif !if [nmakehlp -f $(OPTS) "symbols"] @@ -492,11 +513,13 @@ LOIMPACT = 1 LOIMPACT = 0 !endif +# TBD - should get rid of this option !if [nmakehlp -f $(OPTS) "thrdalloc"] !message *** Doing thrdalloc USE_THREAD_ALLOC = 1 !endif +# TBD - should get rid of this option !if [nmakehlp -f $(OPTS) "tclalloc"] !message *** Doing tclalloc USE_THREAD_ALLOC = 0 @@ -509,24 +532,135 @@ UNCHECKED = 1 UNCHECKED = 0 !endif -!endif # "$(OPTS)" == "" ... parsing of OPTS +!endif # "$(OPTS)" != "" && ... parsing of OPTS -#---------------------------------------------------------- -# Figure-out how to name our intermediate and output directories. -# We wouldn't want different builds to use the same .obj files -# by accident. -#---------------------------------------------------------- +# Set linker flags based on above + +!if $(PGO) > 1 +!if [nmakehlp -l -ltcg:pgoptimize $(LINKER_TESTFLAGS)] +LINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize +!else +MSG=^ +This compiler does not support profile guided optimization. +!error $(MSG) +!endif +!elseif $(PGO) > 0 +!if [nmakehlp -l -ltcg:pginstrument $(LINKER_TESTFLAGS)] +LINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument +!else +MSG=^ +This compiler does not support profile guided optimization. +!error $(MSG) +!endif +!endif + +################################################################ +# 7. Parse the STATS macro to configure code instrumentation +# The following macros are set by this section: +# TCL_MEM_DEBUG - 1 -> enables memory allocation instrumentation +# 0 -> disables +# TCL_COMPILE_DEBUG - 1 -> enables byte compiler logging +# 0 -> disables + +# Default both are off +TCL_MEM_DEBUG = 0 +TCL_COMPILE_DEBUG = 0 + +!if "$(STATS)" != "" && ![nmakehlp -f "$(STATS)" "none"] + +!if [nmakehlp -f $(STATS) "memdbg"] +!message *** Doing memdbg +TCL_MEM_DEBUG = 1 +!else +TCL_MEM_DEBUG = 0 +!endif + +!if [nmakehlp -f $(STATS) "compdbg"] +!message *** Doing compdbg +TCL_COMPILE_DEBUG = 1 +!else +TCL_COMPILE_DEBUG = 0 +!endif -#---------------------------------------- -# Naming convention: +!endif + +#################################################################### +# 8. Parse the CHECKS macro to configure additional compiler checks +# The following macros are set by this section: +# WARNINGS - compiler switches that control the warnings level +# TCL_NO_DEPRECATED - 1 -> disable support for deprecated functions +# 0 -> enable deprecated functions + +# Defaults - Permit deprecated functions and warning level 3 +TCL_NO_DEPRECATED = 0 +WARNINGS = -W3 + +!if "$(CHECKS)" != "" && ![nmakehlp -f "$(CHECKS)" "none"] + +!if [nmakehlp -f $(CHECKS) "nodep"] +!message *** Doing nodep check +TCL_NO_DEPRECATED = 1 +!endif + +!if [nmakehlp -f $(CHECKS) "fullwarn"] +!message *** Doing full warnings check +WARNINGS = -W4 +!if [nmakehlp -l -warn:3 $(LINKER_TESTFLAGS)] +LINKERFLAGS = $(LINKERFLAGS) -warn:3 +!endif +!endif + +!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64] +!message *** Doing 64bit portability warnings +WARNINGS = $(WARNINGS) -Wp64 +!endif + +!endif + +################################################################ +# 9. Extract various version numbers from tcl headers +# Sets the following macros: +# TCL_MAJOR_VERSION +# TCL_MINOR_VERSION +# TCL_PATCH_LEVEL +#-------------------------------------------------------------- + +!if [echo REM = This file is generated from rules.vc > versions.vc] +!endif +!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \ + && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc] +!endif +!if [echo TCL_MINOR_VERSION = \>> versions.vc] \ + && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc] +!endif +!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \ + && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc] +!endif + +!include versions.vc + +################################################################ +# 10. Construct output directory names +# Figure-out how to name our intermediate and output directories. +# In order to avoid inadvertent mixing of object files built using +# different compilers, build configurations etc., +# +# Naming convention (suffixes): # t = full thread support. -# s = static library (as opposed to an -# import library) -# g = linked to the debug enabled C -# run-time. -# x = special static build when it -# links to the dynamic C run-time. -#---------------------------------------- +# s = static library (as opposed to an import library) +# g = linked to the debug enabled C run-time. +# x = special static build when it links to the dynamic C run-time. +# +# The following macros are set in this section: +# SUFX - the suffix to use for binaries based on above naming convention +# BUILDDIRTOP - the toplevel default output directory +# is of the form {Release,Debug}[_AMD64][_COMPILERVERSION] +# TMP_DIR - directory where object files are created +# OUT_DIR - directory where output executables are created +# Both TMP_DIR and OUT_DIR are defaulted only if not defined by the +# parent makefile (or command line). The default values are +# based on BUILDDIRTOP. + SUFX = tsgx !if $(DEBUG) @@ -581,76 +715,6 @@ OUT_DIR = $(TMP_DIR) #---------------------------------------------------------- -# Decode the statistics requested. -#---------------------------------------------------------- - -!if "$(STATS)" == "" || [nmakehlp -f "$(STATS)" "none"] -TCL_MEM_DEBUG = 0 -TCL_COMPILE_DEBUG = 0 -!else -!if [nmakehlp -f $(STATS) "memdbg"] -!message *** Doing memdbg -TCL_MEM_DEBUG = 1 -!else -TCL_MEM_DEBUG = 0 -!endif -!if [nmakehlp -f $(STATS) "compdbg"] -!message *** Doing compdbg -TCL_COMPILE_DEBUG = 1 -!else -TCL_COMPILE_DEBUG = 0 -!endif -!endif - - -#---------------------------------------------------------- -# Decode the checks requested. -#---------------------------------------------------------- - -!if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"] -TCL_NO_DEPRECATED = 0 -WARNINGS = -W3 -!else -!if [nmakehlp -f $(CHECKS) "nodep"] -!message *** Doing nodep check -TCL_NO_DEPRECATED = 1 -!else -TCL_NO_DEPRECATED = 0 -!endif -!if [nmakehlp -f $(CHECKS) "fullwarn"] -!message *** Doing full warnings check -WARNINGS = -W4 -!if [nmakehlp -l -warn:3 $(LINKER_TESTFLAGS)] -LINKERFLAGS = $(LINKERFLAGS) -warn:3 -!endif -!else -WARNINGS = -W3 -!endif -!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64] -!message *** Doing 64bit portability warnings -WARNINGS = $(WARNINGS) -Wp64 -!endif -!endif - -!if $(PGO) > 1 -!if [nmakehlp -l -ltcg:pgoptimize $(LINKER_TESTFLAGS)] -LINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize -!else -MSG=^ -This compiler does not support profile guided optimization. -!error $(MSG) -!endif -!elseif $(PGO) > 0 -!if [nmakehlp -l -ltcg:pginstrument $(LINKER_TESTFLAGS)] -LINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument -!else -MSG=^ -This compiler does not support profile guided optimization. -!error $(MSG) -!endif -!endif - -#---------------------------------------------------------- # Set our defines now armed with our options. #---------------------------------------------------------- @@ -693,50 +757,6 @@ OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 #-------------------------------------------------------------- -# Extract various version numbers from tcl headers -# The generated file is then included in the makefile. -#-------------------------------------------------------------- - -!if [echo REM = This file is generated from rules.vc > versions.vc] -!endif -!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \ - && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc] -!endif -!if [echo TCL_MINOR_VERSION = \>> versions.vc] \ - && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc] -!endif -!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \ - && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc] -!endif - -# If building the tcl core then we need additional package versions -!if "$(PROJECT)" == "tcl" -!if [echo PKG_HTTP_VER = \>> versions.vc] \ - && [nmakehlp -V ..\library\http\pkgIndex.tcl http >> versions.vc] -!endif -!if [echo PKG_TCLTEST_VER = \>> versions.vc] \ - && [nmakehlp -V ..\library\tcltest\pkgIndex.tcl tcltest >> versions.vc] -!endif -!if [echo PKG_MSGCAT_VER = \>> versions.vc] \ - && [nmakehlp -V ..\library\msgcat\pkgIndex.tcl msgcat >> versions.vc] -!endif -!if [echo PKG_PLATFORM_VER = \>> versions.vc] \ - && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform " >> versions.vc] -!endif -!if [echo PKG_SHELL_VER = \>> versions.vc] \ - && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform::shell" >> versions.vc] -!endif -!if [echo PKG_DDE_VER = \>> versions.vc] \ - && [nmakehlp -V ..\library\dde\pkgIndex.tcl "dde " >> versions.vc] -!endif -!if [echo PKG_REG_VER =\>> versions.vc] \ - && [nmakehlp -V ..\library\reg\pkgIndex.tcl registry >> versions.vc] -!endif -!endif - -!include versions.vc - -#-------------------------------------------------------------- # Setup tcl version dependent stuff headers #-------------------------------------------------------------- -- cgit v0.12 From ad9a3b8b45304f8f24b7de903fcfd18394e09045 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sun, 24 Sep 2017 06:03:34 +0000 Subject: Moved generic compiler and linker flags completely into rules.vc so extensions do not have to repeat the verbage. Special case Tk as a Tcl extension and add default for locating Tcl source. Both Tcl and Tk compile with new rules. --- win/makefile.vc | 16 ++- win/rules.vc | 341 +++++++++++++++++++++++++++++++------------------------- 2 files changed, 197 insertions(+), 160 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 5a78e9f..2891e2f 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -182,6 +182,8 @@ Please `cd` to its location first. PROJECT = tcl !include "rules.vc" +!if [echo REM = This file is generated from makefile.vc > versions.vc] +!endif !if [echo PKG_HTTP_VER = \>> versions.vc] \ && [nmakehlp -V ..\library\http\pkgIndex.tcl http >> versions.vc] !endif @@ -488,18 +490,14 @@ PKGSDIR = $(ROOT)\pkgs #--------------------------------------------------------------------- -### Declarations common to all compiler options -cwarn = $(cwarn) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE - -cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ - +cflags = $(cflags) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE +cflags = $(cflags) -Fp$(TMP_DIR)^\ TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TOMMATHDIR)" TCL_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 -BASE_CFLAGS = $(cflags) $(cdebug) $(crt) $(TCL_INCLUDES) $(TCL_DEFINES) -CON_CFLAGS = $(cflags) $(cdebug) $(crt) -DCONSOLE -TCL_CFLAGS = $(BASE_CFLAGS) $(OPTDEFINES) -STUB_CFLAGS = $(cflags) $(cdebug) $(OPTDEFINES) +CON_CFLAGS = $(cflags) $(crt) -DCONSOLE +TCL_CFLAGS = $(cflags) $(crt) $(TCL_INCLUDES) $(TCL_DEFINES) $(OPTDEFINES) +STUB_CFLAGS = $(cflags) $(OPTDEFINES) #--------------------------------------------------------------------- diff --git a/win/rules.vc b/win/rules.vc index f58beb8..a09e879 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -30,9 +30,11 @@ _RULES_VC = 1 # 6. Parse the OPTS macro value for user-specified build configuration # 7. Parse the STATS macro value for statistics instrumentation # 8. Parse the CHECKS macro for additional compilation checks -# 9. Extract Tcl version numbers from the headers -# 10.Based on this specified configuration, construct the output -# directory names +# 9. Extract Tcl, and possibly Tk, version numbers from the headers +# 10.Based on this selected configuration, construct the output +# directory and file paths +# 11.Set up the actual options passed to compiler and linker based +# on the information gathered above. # # One final note about the macro names used. They are as they are # for historical reasons. We would like legacy extensions to @@ -59,11 +61,12 @@ MKDIR = mkdir # 2. Figure out our build environment in terms of what we're building. # # (a) Tcl itself -# (b) a Tcl extension using libraries/includes from an *installed* Tcl -# (c) a Tcl extension using libraries/includes from Tcl source directory +# (b) Tk +# (c) a Tcl extension using libraries/includes from an *installed* Tcl +# (d) a Tcl extension using libraries/includes from Tcl source directory # -# This last is needed because some extensions (even Tk) still need -# some Tcl interfaces that have are not publicly exposed. +# This last is needed because some extensions still need +# some Tcl interfaces that are not publicly exposed. # # The fragment will set the following macros: # _TCLDIR - root of the Tcl installation OR the Tcl sources. Not set @@ -71,11 +74,17 @@ MKDIR = mkdir # _INSTALLDIR - native form of the installation path. For Tcl # this will be the root of the Tcl installation. For extensions # this will be the lib directory under the root. -# TCLINSTALL - set to 1 if an extension is being built against the +# TCLINSTALL - set to 1 if _TCLDIR refers to # headers and libraries from an installed Tcl, and 0 if built against # Tcl sources. Not set when building Tcl itself. Yes, not very well # named. # _TCL_H - native path to the tcl.h file +# +# If Tk is involved, also sets the following +# _TKDIR - native form Tk installation OR Tk source. Not set if building +# Tk itself. +# TKINSTALL - set 1 if _TKDIR refers to installed Tk and 0 if Tk sources +# _TK_H - native path to the tk.h file # The root directory where the built packages and binaries will be installed. # INSTALLDIR is the (optional) path specified by the user. @@ -88,62 +97,114 @@ _INSTALLDIR = $(INSTALLDIR:/=\) _INSTALLDIR = C:\Program Files\Tcl !endif -!if "$(PROJECT)" == "tcl" # Case 2(a) - Building Tcl itself +!if "$(PROJECT)" == "tcl" + +# BEGIN Case 2(a) - Building Tcl itself # Only need to define _TCL_H _TCL_H = ..\generic\tcl.h -!else # Case 2(b) or (c) - Building an extension +# END Case 2(a) - Building Tcl itself + +!elseif "$(PROJECT)" == "tk" + +# BEGIN Case 2(b) - Building Tk + +TCLINSTALL = 0 # Tk always builds against Tcl source, not an installed Tcl +!ifndef TCLDIR +TCLDIR = ../../tcl +!endif +_TCLDIR = $(TCLDIR:/=\) +_TCL_H = $(_TCLDIR)\generic\tcl.h +!message TCLH $(_TCL_H) +!if !exist("$(_TCL_H)") +!error Could not locate tcl.h. Please set the TCLDIR macro to point to the Tcl *source* directory. +!endif + +_TK_H = ..\generic\tk.h + +# END Case 2(b) - Building Tk + +!else + +# BEGIN Case 2(c) or (d) - Building an extension other than Tk # If command line has specified Tcl location through TCLDIR, use it # else default to the INSTALLDIR setting !ifdef TCLDIR _TCLDIR = $(TCLDIR:/=\) -!if exist("$(_TCLDIR)\include\tcl.h") # Case 2(a) with TCLDIR defined +!if exist("$(_TCLDIR)\include\tcl.h") # Case 2(c) with TCLDIR defined TCLINSTALL = 1 _TCL_H = $(_TCLDIR)\include\tcl.h -!elseif exist("$(_TCLDIR)\generic\tcl.h") # Case 2(b) with TCLDIR defined +!elseif exist("$(_TCLDIR)\generic\tcl.h") # Case 2(d) with TCLDIR defined TCLINSTALL = 0 _TCL_H = $(_TCLDIR)\generic\tcl.h !endif !else # TCLDIR is not defined -!if "$(PROJECT)" == "tk" - -!if exist("..\..\tcl\generic\tcl.h") # Special case Tk with TCLDIR undefined -TCLINSTALL = 0 -TCLDIR = ..\..\tcl -_TCLDIR = $(TCLDIR) -_TCL_H = $(_TCLDIR)\generic\tcl.h -!endif - -!elseif exist("$(_INSTALLDIR)\include\tcl.h") # Case 2(a) for non-Tk with TCLDIR undefined - +!if exist("$(_INSTALLDIR)\include\tcl.h") # Case 2(c) for extensions with TCLDIR undefined TCLINSTALL = 1 TCLDIR = $(_INSTALLDIR) _TCLDIR = $(_INSTALLDIR) _TCL_H = $(_INSTALLDIR)\include\tcl.h - -!endif # $(PROJECT) == "tk" +!endif !endif # TCLDIR -# If INSTALLDIR set to tcl root dir then reset to the lib dir. -!if exist("$(_INSTALLDIR)\include\tcl.h") -_INSTALLDIR=$(_INSTALLDIR)\lib +!ifndef _TCL_H +MSG =^ +Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and default path does not contain tcl.h. +!error $(MSG) !endif -!endif # if $(PROJECT) == "tcl" +# Now do the same to locate Tk headers and libs if project requires Tk +!ifdef PROJECT_REQUIRES_TK -!ifndef _TCL_H +!ifdef TKDIR + +_TKDIR = $(TKDIR:/=\) +!if exist("$(_TKDIR)\include\tk.h") +TKINSTALL = 1 +_TK_H = $(_TKDIR)\include\tk.h +!elseif exist("$(_TKDIR)\generic\tk.h") +TKINSTALL = 0 +_TK_H = $(_TKDIR)\generic\tk.h +!endif + +!else # TKDIR not defined + +!if exist("$(_INSTALLDIR)\..\include\tk.h") +TKINSTALL = 1 +_TKDIR = $(_INSTALLDIR)\.. +_TK_H = $(_TKDIR)\include\tk.h +TKDIR = $(_TKDIR) +!elseif exist("$(_TCLDIR)\include\tk.h") +TKINSTALL = 1 +_TKDIR = $(_TCLDIR) +_TK_H = $(_TKDIR)\include\tk.h +TKDIR = $(_TKDIR) +!endif + +!endif # TKDIR + +!ifndef _TK_H MSG =^ -Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and default path does not contain tcl.h. +Failed to find tk.h. The TKDIR macro is set incorrectly or is not set and default path does not contain tk.h. !error $(MSG) !endif +!endif # PROJECT_REQUIRES_TK +# If INSTALLDIR set to tcl installation root dir then reset to the +# lib dir for installing extensions +!if exist("$(_INSTALLDIR)\include\tcl.h") +_INSTALLDIR=$(_INSTALLDIR)\lib +!endif + +# END Case 2(c) or (d) - Building an extension +!endif # if $(PROJECT) == "tcl" ################################################################ # 3. Determine compiler version and architecture @@ -372,8 +433,6 @@ DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 DEBUGFLAGS = $(DEBUGFLAGS) -GZ !endif - - #---------------------------------------------------------------- # Linker flags @@ -623,6 +682,11 @@ WARNINGS = $(WARNINGS) -Wp64 # TCL_MAJOR_VERSION # TCL_MINOR_VERSION # TCL_PATCH_LEVEL +# TCL_VERSION +# TK_MAJOR_VERSION +# TK_MINOR_VERSION +# TK_PATCH_LEVEL +# TK_VERSION #-------------------------------------------------------------- !if [echo REM = This file is generated from rules.vc > versions.vc] @@ -637,10 +701,28 @@ WARNINGS = $(WARNINGS) -Wp64 && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc] !endif +!if defined(_TK_H) +!if [echo TK_MAJOR_VERSION = \>> versions.vc] \ + && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc] +!endif +!if [echo TK_MINOR_VERSION = \>> versions.vc] \ + && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc] +!endif +!if [echo TK_PATCH_LEVEL = \>> versions.vc] \ + && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc] +!endif +!endif # _TK_H + !include versions.vc +TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) +!if defined(_TK_H) +TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION) +!endif + + ################################################################ -# 10. Construct output directory names +# 10. Construct output directory and file paths # Figure-out how to name our intermediate and output directories. # In order to avoid inadvertent mixing of object files built using # different compilers, build configurations etc., @@ -713,58 +795,11 @@ OUT_DIR = $(TMP_DIR) !endif !endif - -#---------------------------------------------------------- -# Set our defines now armed with our options. -#---------------------------------------------------------- - -OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS - -!if $(TCL_MEM_DEBUG) -OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG -!endif -!if $(TCL_COMPILE_DEBUG) -OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS -!endif -!if $(TCL_THREADS) -OPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1 -!if $(USE_THREAD_ALLOC) -OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 -!endif -!endif -!if $(STATIC_BUILD) -OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD -!endif -!if $(TCL_NO_DEPRECATED) -OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED -!endif - -!if !$(DEBUG) -OPTDEFINES = $(OPTDEFINES) -DNDEBUG -!if $(OPTIMIZING) -OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_OPTIMIZED -!endif -!endif -!if $(PROFILE) -OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_PROFILED -!endif -!if "$(MACHINE)" == "AMD64" -OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT -!endif -!if $(VCVERSION) < 1300 -OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 -!endif - - -#-------------------------------------------------------------- -# Setup tcl version dependent stuff headers -#-------------------------------------------------------------- - +# Set up paths to various Tcl executables and libraries needed by extensions !if "$(PROJECT)" != "tcl" -TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) +!if $(TCLINSTALL) # Building against an installed Tcl -!if $(TCLINSTALL) TCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe" !if !exist($(TCLSH)) && $(TCL_THREADS) TCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe" @@ -777,7 +812,9 @@ TCLDDELIB = "$(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib" COFFBASE = \must\have\tcl\sources\to\build\this\target TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target TCL_INCLUDES = -I"$(_TCLDIR)\include" -!else + +!else # Building against Tcl sources + TCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe" !if !exist($(TCLSH)) && $(TCL_THREADS) TCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe" @@ -790,93 +827,94 @@ TCLDDELIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib" COFFBASE = "$(_TCLDIR)\win\coffbase.txt" TCLTOOLSDIR = $(_TCLDIR)\tools TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" -!endif -!endif +!endif # TCLINSTALL -#------------------------------------------------------------------------- -# Locate the Tk headers to build against -#------------------------------------------------------------------------- +!endif $(PROJECT) != "tcl" -!if "$(PROJECT)" == "tk" -_TK_H = ..\generic\tk.h -_INSTALLDIR = $(_INSTALLDIR)\.. -!endif +# Do the same for Tk extensions that require the Tk libraries +!if defined(PROJECT_REQUIRES_TK) -!ifdef PROJECT_REQUIRES_TK -!if !defined(TKDIR) -!if exist("$(_INSTALLDIR)\..\include\tk.h") -TKINSTALL = 1 -_TKDIR = $(_INSTALLDIR)\.. -_TK_H = $(_TKDIR)\include\tk.h -TKDIR = $(_TKDIR) -!elseif exist("$(_TCLDIR)\include\tk.h") -TKINSTALL = 1 -_TKDIR = $(_TCLDIR) -_TK_H = $(_TKDIR)\include\tk.h -TKDIR = $(_TKDIR) -!endif -!else -_TKDIR = $(TKDIR:/=\) -!if exist("$(_TKDIR)\include\tk.h") -TKINSTALL = 1 -_TK_H = $(_TKDIR)\include\tk.h -!elseif exist("$(_TKDIR)\generic\tk.h") -TKINSTALL = 0 -_TK_H = $(_TKDIR)\generic\tk.h -!else -MSG =^ -Failed to find tk.h. The TKDIR macro does not appear correct. -!error $(MSG) -!endif -!endif -!endif - -#------------------------------------------------------------------------- -# Extract Tk version numbers -#------------------------------------------------------------------------- - -!if defined(PROJECT_REQUIRES_TK) || "$(PROJECT)" == "tk" +!if $(TKINSTALL) # Building against installed Tk -!if [echo TK_MAJOR_VERSION = \>> versions.vc] \ - && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc] -!endif -!if [echo TK_MINOR_VERSION = \>> versions.vc] \ - && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc] -!endif -!if [echo TK_PATCH_LEVEL = \>> versions.vc] \ - && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc] -!endif - -!include versions.vc - -TK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) -TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION) - -!if "$(PROJECT)" != "tk" -!if $(TKINSTALL) WISH = "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe" TKSTUBLIB = "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib" TKIMPLIB = "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib" TK_INCLUDES = -I"$(_TKDIR)\include" -!else + +!else # Building against Tk sources + WISH = "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe" TKSTUBLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib" TKIMPLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib" TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" -!endif -!endif -!endif +!endif # TKINSTALL +!endif # PROJECT_REQUIRES_TK -#---------------------------------------------------------------------- + +################################################################### +# 11. Set up actual options to be passed to the compiler and linker # Now we have all the information we need, set up the actual flags and # options that we will pass to the compiler and linker. The main # makefile should use these in combination with whatever other flags # and switches are specific to it. -#---------------------------------------------------------------------- +# The following macros are defined, names are for historical compatibility: +# OPTDEFINES - /Dxxx C macro flags based on user-specified OPTS +# COMPILERFLAGS - /Dxxx C macro flags independent of any configuration opttions +# crt - Compiler switch that selects the appropriate C runtime +# cdebug - Compiler switches related to debug AND optimizations +# cwarn - Compiler switches that set warning levels +# cflags - complete compiler switches (subsumes cdebug and cwarn) +# ldebug - Linker switches controlling debug information and optimization +# lflags - complete linker switches (subsumes ldebug) except subsystem type +# dlllflags - complete linker switches to build DLLs (subsumes lflags) +# conlflags - complete linker switches for console program (subsumes lflags) +# guilflags - complete linker switches for GUI program (subsumes lflags) +# baselibs - minimum Windows libraries required. Parent makefile can +# define extralibs before including rules.rc if additional libs are needed + +OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS + +!if $(TCL_MEM_DEBUG) +OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG +!endif +!if $(TCL_COMPILE_DEBUG) +OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS +!endif +!if $(TCL_THREADS) +OPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1 +!if $(USE_THREAD_ALLOC) +OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 +!endif +!endif +!if $(STATIC_BUILD) +OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD +!endif +!if $(TCL_NO_DEPRECATED) +OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED +!endif +!if !$(DEBUG) +OPTDEFINES = $(OPTDEFINES) -DNDEBUG +!if $(OPTIMIZING) +OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_OPTIMIZED +!endif +!endif +!if $(PROFILE) +OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_PROFILED +!endif +!if "$(MACHINE)" == "AMD64" +OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT +!endif +!if $(VCVERSION) < 1300 +OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 +!endif + +# UNICODE - Use the wide char Windows API. +# _ATL_XP_TARGETING - Newer SDK's need this to build for XP +# BUILD_xxx - defined to export the xxx_Init call from the DLL COMPILERFLAGS = /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING /DBUILD_$(PROJECT) # crt picks the C run time based on selected OPTS @@ -926,6 +964,8 @@ cwarn = $(cwarn) -wd4311 -wd4312 cwarn = $(cwarn) -WX !endif +cflags = -nologo -c $(COMPILERFLAGS) $(cdebug) $(cwarn) -Fp$(TMP_DIR)^\ + # Link flags !if $(DEBUG) @@ -988,7 +1028,6 @@ baselibs = $(baselibs) ucrt.lib !endif - #---------------------------------------------------------- # Display stats being used. #---------------------------------------------------------- -- cgit v0.12 From a91099b33b6288e117d3913fb6da2800c2026758 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sun, 24 Sep 2017 12:13:29 +0000 Subject: Move installation dir macros to rules.vc --- win/makefile.vc | 20 ------------------ win/rules.vc | 63 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 54 insertions(+), 29 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 2891e2f..098662b 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -13,16 +13,6 @@ # Copyright (c) 2003-2008 Pat Thoyts. #------------------------------------------------------------------------------ -# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or -# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir) -!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR) -MSG = ^ -You need to run vcvars32.bat from Developer Studio or setenv.bat from the^ -Platform SDK first to setup the environment. Jump to this line to read^ -the build instructions. -!error $(MSG) -!endif - #------------------------------------------------------------------------------ # HOW TO USE this makefile: # @@ -218,9 +208,6 @@ DDEVERSION = $(DDEDOTVERSION:.=) REGDOTVERSION = 1.3 REGVERSION = $(REGDOTVERSION:.=) -BINROOT = $(MAKEDIR) # originally . -ROOT = $(MAKEDIR)\.. # originally .. - TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) TCLLIB = $(OUT_DIR)\$(TCLLIBNAME) @@ -249,13 +236,6 @@ TCLSH_NATIVE = $(TCLSH) !endif !endif -### Make sure we use backslash only. -LIB_INSTALL_DIR = $(_INSTALLDIR)\lib -BIN_INSTALL_DIR = $(_INSTALLDIR)\bin -DOC_INSTALL_DIR = $(_INSTALLDIR)\doc -SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\tcl$(DOTVERSION) -INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include - TCLSHOBJS = \ $(TMP_DIR)\tclAppInit.obj \ !if !$(STATIC_BUILD) diff --git a/win/rules.vc b/win/rules.vc index a09e879..3a45cd7 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -20,6 +20,7 @@ _RULES_VC = 1 # so this file is necessarily verbose. It's broken down into # the following parts. # +# 0. Sanity check that compiler environment is set up. # 1. First define the external tools used for compiling, copying etc. # as this is independent of everything else. # 2. Figure out our build structure in terms of the directory, whether @@ -31,16 +32,26 @@ _RULES_VC = 1 # 7. Parse the STATS macro value for statistics instrumentation # 8. Parse the CHECKS macro for additional compilation checks # 9. Extract Tcl, and possibly Tk, version numbers from the headers -# 10.Based on this selected configuration, construct the output -# directory and file paths -# 11.Set up the actual options passed to compiler and linker based -# on the information gathered above. +# 10. Based on this selected configuration, construct the output +# directory and file paths +# 11. Construct the paths where the package is to be installed +# 12. Set up the actual options passed to compiler and linker based +# on the information gathered above. # # One final note about the macro names used. They are as they are # for historical reasons. We would like legacy extensions to # continue to work with this make include file so be wary of # changing them for consistency or clarity. +# 0. Sanity check compiler environment +# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or +# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir) +!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR) +MSG = ^ +Visual C++ compiler environment not initialized. +!error $(MSG) +!endif + ################################################################ # 1. Define external programs being used @@ -69,6 +80,7 @@ MKDIR = mkdir # some Tcl interfaces that are not publicly exposed. # # The fragment will set the following macros: +# ROOT - root of this module sources # _TCLDIR - root of the Tcl installation OR the Tcl sources. Not set # when building Tcl itself. # _INSTALLDIR - native form of the installation path. For Tcl @@ -86,7 +98,10 @@ MKDIR = mkdir # TKINSTALL - set 1 if _TKDIR refers to installed Tk and 0 if Tk sources # _TK_H - native path to the tk.h file -# The root directory where the built packages and binaries will be installed. +# Root directory for sources +ROOT = $(MAKEDIR)\.. + +# The target directory where the built packages and binaries will be installed. # INSTALLDIR is the (optional) path specified by the user. # _INSTALLDIR is INSTALLDIR using the backslash separator syntax !ifdef INSTALLDIR @@ -116,7 +131,6 @@ TCLDIR = ../../tcl !endif _TCLDIR = $(TCLDIR:/=\) _TCL_H = $(_TCLDIR)\generic\tcl.h -!message TCLH $(_TCL_H) !if !exist("$(_TCL_H)") !error Could not locate tcl.h. Please set the TCLDIR macro to point to the Tcl *source* directory. !endif @@ -739,6 +753,7 @@ TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION) # is of the form {Release,Debug}[_AMD64][_COMPILERVERSION] # TMP_DIR - directory where object files are created # OUT_DIR - directory where output executables are created +# STUBPREFIX - name of the stubs library for this project # Both TMP_DIR and OUT_DIR are defaulted only if not defined by the # parent makefile (or command line). The default values are # based on BUILDDIRTOP. @@ -795,6 +810,9 @@ OUT_DIR = $(TMP_DIR) !endif !endif +# The name of the stubs library for the project being built +STUBPREFIX = $(PROJECT)stub + # Set up paths to various Tcl executables and libraries needed by extensions !if "$(PROJECT)" != "tcl" @@ -855,7 +873,34 @@ TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" ################################################################### -# 11. Set up actual options to be passed to the compiler and linker +# 11. Construct the paths for the installation directories +# The following macros get defined in this section: +# LIB_INSTALL_DIR - where libraries should be installed +# BIN_INSTALL_DIR - where the executables should be installed +# DOC_INSTALL_DIR - where documentation should be installed +# SCRIPT_INSTALL_DIR - where scripts should be installed +# INCLUDE_INSTALL_DIR - where C include files should be installed +!if "$(PROJECT)" == "tcl" || "$(PROJECT)" == "tk" +LIB_INSTALL_DIR = $(_INSTALLDIR)\lib +BIN_INSTALL_DIR = $(_INSTALLDIR)\bin +DOC_INSTALL_DIR = $(_INSTALLDIR)\doc +!if "$(PROJECT)" == "tcl" +SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\tcl$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) +!else +SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\tk$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) +!endif +INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include +!else +PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION) +LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR) +BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR) +DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR) +SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR) +INCLUDE_INSTALL_DIR = $(_TCLDIR)\include +!endif + +################################################################### +# 12. Set up actual options to be passed to the compiler and linker # Now we have all the information we need, set up the actual flags and # options that we will pass to the compiler and linker. The main # makefile should use these in combination with whatever other flags @@ -1038,7 +1083,7 @@ baselibs = $(baselibs) ucrt.lib !message *** Optional defines are '$(OPTDEFINES)' !message *** Compiler version $(VCVER). Target machine is $(MACHINE) !message *** Host architecture is $(NATIVE_ARCH) -!message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)' -!message *** Link options '$(LINKERFLAGS)' +!message *** Cflags '$(cflags)' +!message *** Lflags '$(lflags)' !endif # ifdef _RULES_VC -- cgit v0.12 From 34cb030c7be20776256f30ae2545dc88805e37be Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sun, 24 Sep 2017 14:25:48 +0000 Subject: Move clean target to rules.vc to avoid repetition in every extension --- win/makefile.vc | 32 +++----------------------------- win/rules.vc | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 098662b..d08f30c 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -198,7 +198,6 @@ PROJECT = tcl !include versions.vc -STUBPREFIX = $(PROJECT)stub DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) @@ -456,13 +455,9 @@ TCLSTUBOBJS = \ $(TMP_DIR)\tclTomMathStubLib.obj \ $(TMP_DIR)\tclOOStubLib.obj -### The following paths CANNOT have spaces in them. -COMPATDIR = $(ROOT)\compat -DOCDIR = $(ROOT)\doc -GENERICDIR = $(ROOT)\generic +### The following paths CANNOT have spaces in them as they appear on +### the left side of implicit rules. TOMMATHDIR = $(ROOT)\libtommath -TOOLSDIR = $(ROOT)\tools -WINDIR = $(ROOT)\win PKGSDIR = $(ROOT)\pkgs #--------------------------------------------------------------------- @@ -471,7 +466,6 @@ PKGSDIR = $(ROOT)\pkgs cflags = $(cflags) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE -cflags = $(cflags) -Fp$(TMP_DIR)^\ TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TOMMATHDIR)" TCL_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 @@ -1138,27 +1132,7 @@ tidy: @echo Removing $(TCLREGLIB) ... @if exist $(TCLREGLIB) del $(TCLREGLIB) -clean: clean-pkgs - @echo Cleaning $(TMP_DIR)\* ... - @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) - @echo Cleaning $(WINDIR)\nmakehlp.obj ... - @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj - @echo Cleaning $(WINDIR)\nmakehlp.exe ... - @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe - @echo Cleaning $(WINDIR)\_junk.pch ... - @if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch - @echo Cleaning $(WINDIR)\vercl.x ... - @if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x - @echo Cleaning $(WINDIR)\vercl.i ... - @if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i - @echo Cleaning $(WINDIR)\versions.vc ... - @if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc - -realclean: hose - -hose: - @echo Hosing $(OUT_DIR)\* ... - @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) +clean: basicclean clean-pkgs # Local Variables: # mode: makefile diff --git a/win/rules.vc b/win/rules.vc index 3a45cd7..7addfd0 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -81,6 +81,11 @@ MKDIR = mkdir # # The fragment will set the following macros: # ROOT - root of this module sources +# COMPATDIR - source directory that holds compatibility sources +# DOCDIR - source directory containing documentation files +# GENERICDIR - platform-independent source directory +# WINDIR - Windows-specific source directory +# TOOLSDIR - directory containing build tools # _TCLDIR - root of the Tcl installation OR the Tcl sources. Not set # when building Tcl itself. # _INSTALLDIR - native form of the installation path. For Tcl @@ -98,8 +103,16 @@ MKDIR = mkdir # TKINSTALL - set 1 if _TKDIR refers to installed Tk and 0 if Tk sources # _TK_H - native path to the tk.h file -# Root directory for sources +# Root directory for sources and assumed subdirectories ROOT = $(MAKEDIR)\.. +# The following paths CANNOT have spaces in them as they appear on the +# left side of implicit rules. +COMPATDIR = $(ROOT)\compat +DOCDIR = $(ROOT)\doc +GENERICDIR = $(ROOT)\generic +TOOLSDIR = $(ROOT)\tools +WINDIR = $(ROOT)\win + # The target directory where the built packages and binaries will be installed. # INSTALLDIR is the (optional) path specified by the user. @@ -1072,6 +1085,29 @@ baselibs = $(winlibs) $(extralibs) baselibs = $(baselibs) ucrt.lib !endif +basicclean: clean-pkgs + @echo Cleaning $(TMP_DIR)\* ... + @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) + @echo Cleaning $(WINDIR)\nmakehlp.obj ... + @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj + @echo Cleaning $(WINDIR)\nmakehlp.exe ... + @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe + @echo Cleaning $(WINDIR)\_junk.pch ... + @if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch + @echo Cleaning $(WINDIR)\vercl.x ... + @if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x + @echo Cleaning $(WINDIR)\vercl.i ... + @if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i + @echo Cleaning $(WINDIR)\versions.vc ... + @if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc + @if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc + +realclean: hose + +hose: + @echo Hosing $(OUT_DIR)\* ... + @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) + #---------------------------------------------------------- # Display stats being used. -- cgit v0.12 From 56e2bd0be497799c08838affb375239aebfbf16d Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Mon, 25 Sep 2017 10:41:22 +0000 Subject: Added project-specific include paths and preprocessor defines. --- win/makefile.vc | 74 +++++++++++++++++++++++++++------------------------------ win/rules.vc | 42 ++++++++++++++++++++++++++++---- 2 files changed, 72 insertions(+), 44 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index d08f30c..e36f0e9 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -169,9 +169,24 @@ Please `cd` to its location first. !error $(MSG) !endif +# The PROJECT macro is used by rules.vc for generating appropriate +# macros and rules. PROJECT = tcl + +# Default target to build if no target is specified. If unspecified, the +# rules.vc file will set up "all" as the target. +DEFAULT_BUILD_TARGET = release + +# The rules.vc file does most of the hard work in terms of defining +# the build configuration, macros, output directories etc. !include "rules.vc" +# Tcl version info based on macros set up by rules.vc +DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) +VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) + +# We need versions of various core packages to generate appropriate +# file names during installation. !if [echo REM = This file is generated from makefile.vc > versions.vc] !endif !if [echo PKG_HTTP_VER = \>> versions.vc] \ @@ -198,9 +213,6 @@ PROJECT = tcl !include versions.vc -DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) -VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) - DDEDOTVERSION = 1.4 DDEVERSION = $(DDEDOTVERSION:.=) @@ -465,19 +477,20 @@ PKGSDIR = $(ROOT)\pkgs #--------------------------------------------------------------------- -cflags = $(cflags) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE +# Additional include and C macro definitions for the implicit rules +# defined in rules.vc +PRJ_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TOMMATHDIR)" +PRJ_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE -TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TOMMATHDIR)" -TCL_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 -CON_CFLAGS = $(cflags) $(crt) -DCONSOLE -TCL_CFLAGS = $(cflags) $(crt) $(TCL_INCLUDES) $(TCL_DEFINES) $(OPTDEFINES) -STUB_CFLAGS = $(cflags) $(OPTDEFINES) +# Define compiler flags used in our private implicit rules that are +# not covered by rules.vc +TCL_CFLAGS = $(cflags) $(crt) $(PRJ_INCLUDES) $(PRJ_DEFINES) +STUB_CFLAGS = $(cflags) -#--------------------------------------------------------------------- -# Link libraries -#--------------------------------------------------------------------- -extralibs = netapi32.lib user32.lib userenv.lib ws2_32.lib +# Additional Link libraries needed beyond those in rules.vc +PRJ_LIBS = netapi32.lib user32.lib userenv.lib ws2_32.lib + #--------------------------------------------------------------------- # TclTest flags @@ -610,7 +623,7 @@ clean-pkgs: ) $(CAT32): $(WINDIR)\cat.c - $(cc32) $(CON_CFLAGS) -Fo$(TMP_DIR)\ $? + $(cc32) $(cflags) $(crt) -DCONSOLE -Fo$(TMP_DIR)\ $? $(link32) $(conlflags) -out:$@ -stack:16384 $(TMP_DIR)\cat.obj \ $(baselibs) $(_VC_MANIFEST_EMBED_EXE) @@ -765,6 +778,7 @@ install-docs: tclConfig: $(OUT_DIR)\tclConfig.sh +# TBD - is this tclConfig.sh file ever used? The values are incorrect! $(OUT_DIR)\tclConfig.sh: $(WINDIR)\tclConfig.sh.in @echo Creating tclConfig.sh @nmakehlp -s << $** >$@ @@ -782,7 +796,7 @@ $(OUT_DIR)\tclConfig.sh: $(WINDIR)\tclConfig.sh.in @TCL_DBGX@ $(SUFX) @TCL_LIB_FILE@ $(PROJECT)$(VERSION)$(SUFX).lib @TCL_NEEDS_EXP_FILE@ -@LIBS@ $(baselibs) +@LIBS@ $(baselibs) $(PRJ_LIBS) @prefix@ $(_INSTALLDIR) @exec_prefix@ $(BIN_INSTALL_DIR) @SHLIB_CFLAGS@ @@ -791,7 +805,7 @@ $(OUT_DIR)\tclConfig.sh: $(WINDIR)\tclConfig.sh.in @EXTRA_CFLAGS@ -YX @SHLIB_LD@ $(link32) $(dlllflags) @STLIB_LD@ $(lib32) -nologo -@SHLIB_LD_LIBS@ $(baselibs) +@SHLIB_LD_LIBS@ $(baselibs) $(PRJ_LIBS) @SHLIB_SUFFIX@ .dll @DL_LIBS@ @LDFLAGS@ @@ -905,13 +919,13 @@ $(TMP_DIR)\tclWinDde.obj: $(WINDIR)\tclWinDde.c ### specific C run-time. $(TMP_DIR)\tclStubLib.obj: $(GENERICDIR)\tclStubLib.c - $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) -Fo$@ $? + $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(PRJ_INCLUDES) -Fo$@ $? $(TMP_DIR)\tclTomMathStubLib.obj: $(GENERICDIR)\tclTomMathStubLib.c - $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) -Fo$@ $? + $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(PRJ_INCLUDES) -Fo$@ $? $(TMP_DIR)\tclOOStubLib.obj: $(GENERICDIR)\tclOOStubLib.c - $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) -Fo$@ $? + $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(PRJ_INCLUDES) -Fo$@ $? $(TMP_DIR)\tclsh.exe.manifest: $(WINDIR)\tclsh.exe.manifest.in @nmakehlp -s << $** >$@ @@ -932,7 +946,7 @@ depend: @echo Build tclsh first! !else $(TCLSH) $(TOOLSDIR:\=/)/mkdepend.tcl -vc32 -out:"$(OUT_DIR)\depend.mk" \ - -passthru:"-DBUILD_tcl $(TCL_INCLUDES)" $(GENERICDIR),$$(GENERICDIR) \ + -passthru:"-DBUILD_tcl $(PRJ_INCLUDES)" $(GENERICDIR),$$(GENERICDIR) \ $(COMPATDIR),$$(COMPATDIR) $(TOMMATHDIR),$$(TOMMATHDIR) $(WINDIR),$$(WINDIR) @<< $(TCLOBJS) << @@ -959,26 +973,11 @@ $(TCLOBJS) # absolute. #--------------------------------------------------------------------- -{$(WINDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<< -$< -<< - {$(TOMMATHDIR)}.c{$(TMP_DIR)}.obj:: $(cc32) $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<< $< << -{$(GENERICDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<< -$< -<< - -{$(COMPATDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<< -$< -<< - {$(COMPATDIR)\zlib}.c{$(TMP_DIR)}.obj:: $(cc32) $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<< $< @@ -993,9 +992,6 @@ $< $(TMP_DIR)\tclsh.res: $(TMP_DIR)\tclsh.exe.manifest -.SUFFIXES: -.SUFFIXES:.c .rc - #--------------------------------------------------------------------- # Installation. @@ -1132,7 +1128,7 @@ tidy: @echo Removing $(TCLREGLIB) ... @if exist $(TCLREGLIB) del $(TCLREGLIB) -clean: basicclean clean-pkgs +clean: clean-pkgs # Local Variables: # mode: makefile diff --git a/win/rules.vc b/win/rules.vc index 7addfd0..47f1608 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -37,6 +37,7 @@ _RULES_VC = 1 # 11. Construct the paths where the package is to be installed # 12. Set up the actual options passed to compiler and linker based # on the information gathered above. +# 13. Define some standard build targets and implicit rules. # # One final note about the macro names used. They are as they are # for historical reasons. We would like legacy extensions to @@ -46,6 +47,7 @@ _RULES_VC = 1 # 0. Sanity check compiler environment # Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or # VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir) + !if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR) MSG = ^ Visual C++ compiler environment not initialized. @@ -931,7 +933,7 @@ INCLUDE_INSTALL_DIR = $(_TCLDIR)\include # conlflags - complete linker switches for console program (subsumes lflags) # guilflags - complete linker switches for GUI program (subsumes lflags) # baselibs - minimum Windows libraries required. Parent makefile can -# define extralibs before including rules.rc if additional libs are needed +# define PRJ_LIBS before including rules.rc if additional libs are needed OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS @@ -1022,7 +1024,7 @@ cwarn = $(cwarn) -wd4311 -wd4312 cwarn = $(cwarn) -WX !endif -cflags = -nologo -c $(COMPILERFLAGS) $(cdebug) $(cwarn) -Fp$(TMP_DIR)^\ +cflags = -nologo -c $(COMPILERFLAGS) $(cdebug) $(cwarn) -Fp$(TMP_DIR)^\ $(OPTDEFINES) # Link flags @@ -1068,7 +1070,7 @@ conlflags = $(lflags) -subsystem:console guilflags = $(lflags) -subsystem:windows # Libraries that are required for every image. -# Extensions should define any additional libraries with $(extralibs) +# Extensions should define any additional libraries with $(PRJ_LIBS) winlibs = kernel32.lib advapi32.lib # Avoid 'unresolved external symbol __security_cookie' errors. @@ -1079,13 +1081,22 @@ winlibs = $(winlibs) bufferoverflowU.lib !endif !endif -baselibs = $(winlibs) $(extralibs) +baselibs = $(winlibs) $(PRJ_LIBS) !if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 baselibs = $(baselibs) ucrt.lib !endif -basicclean: clean-pkgs +################################################################ +# 3. Define common make targets and implicit rules + +!ifndef DEFAULT_BUILD_TARGET +DEFAULT_BUILD_TARGET = all +!endif + +default_target: $(DEFAULT_BUILD_TARGET) + +clean: @echo Cleaning $(TMP_DIR)\* ... @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) @echo Cleaning $(WINDIR)\nmakehlp.obj ... @@ -1108,6 +1119,27 @@ hose: @echo Hosing $(OUT_DIR)\* ... @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) +# Implicit rule definitions + +{$(WINDIR)}.c{$(TMP_DIR)}.obj:: + $(cc32) $(cflags) $(crt) $(PRJ_INCLUDES) $(PRJ_DEFINES) -Fo$(TMP_DIR)\ @<< +$< +<< + +{$(GENERICDIR)}.c{$(TMP_DIR)}.obj:: + $(cc32) $(cflags) $(crt) $(PRJ_INCLUDES) $(PRJ_DEFINES) -Fo$(TMP_DIR)\ @<< +$< +<< + +{$(COMPATDIR)}.c{$(TMP_DIR)}.obj:: + $(cc32) $(cflags) $(crt) $(PRJ_INCLUDES) $(PRJ_DEFINES) -Fo$(TMP_DIR)\ @<< +$< +<< + +.SUFFIXES: +.SUFFIXES:.c .rc + + #---------------------------------------------------------- # Display stats being used. -- cgit v0.12 From b5e3779cf2ab3f4316b4229e164dc1e58c0c1611 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Mon, 25 Sep 2017 13:45:34 +0000 Subject: Move TCLSH and TCLSH_NATIVE macros to rules.vc --- win/makefile.vc | 21 ++++----------------- win/rules.vc | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index e36f0e9..2ef453b 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -226,9 +226,6 @@ TCLLIB = $(OUT_DIR)\$(TCLLIBNAME) TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME) -TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe -TCLSH = $(OUT_DIR)\$(TCLSHNAME) - TCLREGLIBNAME = $(PROJECT)reg$(REGVERSION)$(SUFX:t=).$(EXT) TCLREGLIB = $(OUT_DIR)\$(TCLREGLIBNAME) @@ -238,15 +235,6 @@ TCLDDELIB = $(OUT_DIR)\$(TCLDDELIBNAME) TCLTEST = $(OUT_DIR)\$(PROJECT)test.exe CAT32 = $(OUT_DIR)\cat32.exe -# Can we run what we build? IX86 runs on all architectures. -!ifndef TCLSH_NATIVE -!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)" -TCLSH_NATIVE = $(TCLSH) -!else -!error You must explicitly set TCLSH_NATIVE for cross-compilation -!endif -!endif - TCLSHOBJS = \ $(TMP_DIR)\tclAppInit.obj \ !if !$(STATIC_BUILD) @@ -772,6 +760,8 @@ install-docs: @$(CPY) "$(HELPCNT)" "$(DOC_INSTALL_DIR)\" !endif +# "emacs font-lock highlighting fix + #--------------------------------------------------------------------- # Build tclConfig.sh for the TEA build system. #--------------------------------------------------------------------- @@ -968,7 +958,8 @@ $(TCLOBJS) #--------------------------------------------------------------------- -# Implicit rules. A limitation exists with nmake that requires that +# Implicit rules that are not covered by the common ones defined in +# rules.vc. A limitation exists with nmake that requires that # source directory can not contain spaces in the path. This an # absolute. #--------------------------------------------------------------------- @@ -1011,8 +1002,6 @@ install-binaries: @echo Installing $(TCLSTUBLIBNAME) @$(CPY) "$(TCLSTUBLIB)" "$(LIB_INSTALL_DIR)\" -#" emacs fix - install-libraries: tclConfig install-msgs install-tzdata @if not exist "$(SCRIPT_INSTALL_DIR)$(NULL)" \ $(MKDIR) "$(SCRIPT_INSTALL_DIR)" @@ -1094,8 +1083,6 @@ install-libraries: tclConfig install-msgs install-tzdata @$(CPY) "$(ROOT)\library\encoding\*.enc" \ "$(SCRIPT_INSTALL_DIR)\encoding\" -#" emacs fix - install-tzdata: @echo Installing time zone data @set TCL_LIBRARY=$(ROOT:\=/)/library diff --git a/win/rules.vc b/win/rules.vc index 47f1608..5afcf5e 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -829,7 +829,12 @@ OUT_DIR = $(TMP_DIR) STUBPREFIX = $(PROJECT)stub # Set up paths to various Tcl executables and libraries needed by extensions -!if "$(PROJECT)" != "tcl" +!if "$(PROJECT)" == "tcl" + +TCLSHNAME = $(PROJECT)sh$(TCL_VERSION)$(SUFX).exe +TCLSH = $(OUT_DIR)\$(TCLSHNAME) + +!else # $(PROJECT) is not "tcl" !if $(TCLINSTALL) # Building against an installed Tcl @@ -865,6 +870,16 @@ TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" !endif $(PROJECT) != "tcl" +# We need a tclsh that will run on the host machine as part of the build. +# IX86 runs on all architectures. +!ifndef TCLSH_NATIVE +!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)" +TCLSH_NATIVE = $(TCLSH) +!else +!error You must explicitly set TCLSH_NATIVE for cross-compilation +!endif +!endif + # Do the same for Tk extensions that require the Tk libraries !if defined(PROJECT_REQUIRES_TK) -- cgit v0.12 From 301208c889f2ffd4f5f8e4e7e02b06c397d0c7ae Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Mon, 25 Sep 2017 16:23:34 +0000 Subject: Unify build commands with MAKE{LIB,DLL,CON,GUI}CMD macros --- win/makefile.vc | 24 ++++++++++-------------- win/rules.vc | 5 ++++- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 2ef453b..b42257c 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -536,45 +536,42 @@ $(TCLIMPLIB): $(TCLLIB) $(TCLLIB): $(TCLOBJS) !if $(STATIC_BUILD) - $(lib32) -nologo $(LINKERFLAGS) -out:$@ @<< + $(MAKELIBCMD) @<< $** << !else - $(link32) $(dlllflags) -base:@$(WINDIR)\coffbase.txt,tcl -out:$@ \ - $(baselibs) @<< + $(MAKEDLLCMD) @<< $** << $(_VC_MANIFEST_EMBED_DLL) !endif $(TCLSTUBLIB): $(TCLSTUBOBJS) - $(lib32) -nologo $(LINKERFLAGS) -nodefaultlib -out:$@ $(TCLSTUBOBJS) + $(MAKELIBCMD) -nodefaultlib $(TCLSTUBOBJS) $(TCLSH): $(TCLSHOBJS) $(TCLSTUBLIB) $(TCLIMPLIB) - $(link32) $(conlflags) -stack:2300000 -out:$@ $(baselibs) $** + $(MAKECONCMD) -stack:2300000 $** $(_VC_MANIFEST_EMBED_EXE) $(TCLTEST): $(TCLTESTOBJS) $(TCLSTUBLIB) $(TCLIMPLIB) - $(link32) $(conlflags) -stack:2300000 -out:$@ $(baselibs) $** + $(MAKECONCMD) -stack:2300000 $** $(_VC_MANIFEST_EMBED_EXE) !if $(STATIC_BUILD) $(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj - $(lib32) -nologo $(LINKERFLAGS) -out:$@ $** + $(MAKELIBCMD) $** !else $(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj $(TCLSTUBLIB) - $(link32) $(dlllflags) -base:@$(WINDIR)\coffbase.txt,tcldde -out:$@ \ - $** $(baselibs) + $(MAKEDLLCMD) -base:@$(WINDIR)\coffbase.txt,tcldde $** $(_VC_MANIFEST_EMBED_DLL) !endif !if $(STATIC_BUILD) $(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj - $(lib32) -nologo $(LINKERFLAGS) -out:$@ $** + $(MAKELIBCMD) $** !else $(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj $(TCLSTUBLIB) - $(link32) $(dlllflags) -base:@$(WINDIR)\coffbase.txt,tclreg -out:$@ \ - $** $(baselibs) + $(MAKEDLLCMD) -base:@$(WINDIR)\coffbase.txt,tclreg $** $(_VC_MANIFEST_EMBED_DLL) !endif @@ -612,8 +609,7 @@ clean-pkgs: $(CAT32): $(WINDIR)\cat.c $(cc32) $(cflags) $(crt) -DCONSOLE -Fo$(TMP_DIR)\ $? - $(link32) $(conlflags) -out:$@ -stack:16384 $(TMP_DIR)\cat.obj \ - $(baselibs) + $(MAKECONCMD) -stack:16384 $(TMP_DIR)\cat.obj $(_VC_MANIFEST_EMBED_EXE) #--------------------------------------------------------------------- diff --git a/win/rules.vc b/win/rules.vc index 5afcf5e..22379c4 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1154,7 +1154,10 @@ $< .SUFFIXES: .SUFFIXES:.c .rc - +MAKELIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ +MAKEDLLCMD = $(link32) $(dlllflags) -base:@$(WINDIR)\coffbase.txt,tcl -out:$@ $(baselibs) +MAKECONEXECMD = $(link32) $(conlflags) -out:$@ $(baselibs) +MAKEGUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) #---------------------------------------------------------- # Display stats being used. -- cgit v0.12 From 54bc992b814ebb022b6cdb9798e2effdc14a2550 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 25 Sep 2017 16:23:56 +0000 Subject: Improvements to Tip#430 based on community input. Added a forward declaration of TclZipfs_Init. Added TclZipfs_Mount() and TclZifs_Unmount to stubs table. --- generic/tcl.decls | 9 +++++++- generic/tclBasic.c | 2 +- generic/tclDecls.h | 13 +++++++++++ generic/tclInt.h | 4 ++++ generic/tclStubInit.c | 2 ++ generic/tclZipfs.c | 62 +++++++++++++++++++++++++-------------------------- generic/tclZipfs.h | 8 +++---- 7 files changed, 63 insertions(+), 37 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index b2b91a9..c19bf68 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2335,7 +2335,14 @@ declare 631 { # ----- BASELINE -- FOR -- 8.7.0 ----- # - +# TIP #430 +declare 632 { + int TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, + const char *passwd) +} +declare 633 { + int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) +} ############################################################################## diff --git a/generic/tclBasic.c b/generic/tclBasic.c index f798a3d..3e6ad56 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -990,7 +990,7 @@ Tcl_CreateInterp(void) if (TclZlibInit(interp) != TCL_OK) { Tcl_Panic("%s", TclGetString(Tcl_GetObjResult(interp))); } - if (TclZipfsInit(interp) != TCL_OK) { + if (TclZipfs_Init(interp) != TCL_OK) { Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp))); } #endif diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 464fc0f..24a22c3 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1831,6 +1831,13 @@ EXTERN Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); +/* 632 */ +EXTERN int TclZipfs_Mount(Tcl_Interp *interp, + const char *zipname, const char *mntpt, + const char *passwd); +/* 633 */ +EXTERN int TclZipfs_Unmount(Tcl_Interp *interp, + const char *zipname); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2498,6 +2505,8 @@ typedef struct TclStubs { int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */ void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */ Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, const char *service, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */ + int (*tclZipfs_Mount) (Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd); /* 632 */ + int (*tclZipfs_Unmount) (Tcl_Interp *interp, const char *zipname); /* 633 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -3792,6 +3801,10 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_ZlibStreamSetCompressionDictionary) /* 630 */ #define Tcl_OpenTcpServerEx \ (tclStubsPtr->tcl_OpenTcpServerEx) /* 631 */ +#define TclZipfs_Mount \ + (tclStubsPtr->tclZipfs_Mount) /* 632 */ +#define TclZipfs_Unmount \ + (tclStubsPtr->tclZipfs_Unmount) /* 633 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclInt.h b/generic/tclInt.h index be93f16..8339fb1 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3215,6 +3215,10 @@ MODULE_SCOPE void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr); MODULE_SCOPE void * TclpThreadGetMasterTSD(void *tsdKeyPtr); MODULE_SCOPE void TclErrorStackResetIf(Tcl_Interp *interp, const char *msg, int length); +/* Tip 430 */ +MODULE_SCOPE int TclZipfs_Init(Tcl_Interp *interp); +MODULE_SCOPE int TclZipfs_SafeInit(Tcl_Interp *interp); + /* *---------------------------------------------------------------- diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index ebd2086..f251a57 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -1536,6 +1536,8 @@ const TclStubs tclStubs = { Tcl_FSUnloadFile, /* 629 */ Tcl_ZlibStreamSetCompressionDictionary, /* 630 */ Tcl_OpenTcpServerEx, /* 631 */ + TclZipfs_Mount, /* 632 */ + TclZipfs_Unmount, /* 633 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 01d46c6..9d74890 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -505,19 +505,19 @@ CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr,int ZIPFSPA int i, j, c, isunc = 0, isvfs=0, n=0; #if HAS_DRIVES int zipfspath=1; - if ((tail[0] != '\0') && (strchr(drvletters, tail[0]) != NULL) && - (tail[1] == ':')) { + if ((tail[0] != '\0') && (strchr(drvletters, tail[0]) != NULL) && + (tail[1] == ':')) { tail += 2; zipfspath=0; - } - /* UNC style path */ - if (tail[0] == '\\') { - root = ""; + } + /* UNC style path */ + if (tail[0] == '\\') { + root = ""; ++tail; zipfspath=0; - } - if (tail[0] == '\\') { - root = "/"; + } + if (tail[0] == '\\') { + root = "/"; ++tail; zipfspath=0; } @@ -571,7 +571,7 @@ CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr,int ZIPFSPA } else if(isvfs==2) { Tcl_DStringSetLength(dsPtr, j); path = Tcl_DStringValue(dsPtr); - memcpy(path, tail, j); + memcpy(path, tail, j); } else { if (ZIPFSPATH) { Tcl_DStringSetLength(dsPtr, i + j + ZIPFS_VOLUME_LEN); @@ -586,12 +586,12 @@ CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr,int ZIPFSPA memcpy(path + i, tail, j); } } -#if HAS_DRIVES - for (i = 0; path[i] != '\0'; i++) { - if (path[i] == '\\') { - path[i] = '/'; +#if HAS_DRIVES + for (i = 0; path[i] != '\0'; i++) { + if (path[i] == '\\') { + path[i] = '/'; } - } + } #endif if(ZIPFSPATH) { n=ZIPFS_VOLUME_LEN; @@ -706,7 +706,7 @@ static ZipEntry * ZipFSLookup(char *filename) { char *realname; - + Tcl_HashEntry *hPtr; ZipEntry *z; Tcl_DString ds; @@ -1030,7 +1030,7 @@ error: /* *------------------------------------------------------------------------- * - * TclZipfsMount -- + * TclZipfs_Mount -- * * This procedure is invoked to mount a given ZIP archive file on * a given mountpoint with optional ZIP password. @@ -1046,7 +1046,7 @@ error: */ int -TclZipfsMount(Tcl_Interp *interp, const char *zipname, const char *mntpt, +TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd) { char *realname, *p; @@ -1379,7 +1379,7 @@ nextent: /* *------------------------------------------------------------------------- * - * TclZipfsUnmount -- + * TclZipfs_Unmount -- * * This procedure is invoked to unmount a given ZIP archive. * @@ -1393,7 +1393,7 @@ nextent: */ int -TclZipfsUnmount(Tcl_Interp *interp, const char *zipname) +TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) { char *realname; ZipFile *zf; @@ -1471,7 +1471,7 @@ ZipFSMountObjCmd(ClientData clientData, Tcl_Interp *interp, "?zipfile? ?mountpoint? ?password?"); return TCL_ERROR; } - return TclZipfsMount(interp, (objc > 1) ? Tcl_GetString(objv[1]) : NULL, + return TclZipfs_Mount(interp, (objc > 1) ? Tcl_GetString(objv[1]) : NULL, (objc > 2) ? Tcl_GetString(objv[2]) : NULL, (objc > 3) ? Tcl_GetString(objv[3]) : NULL); } @@ -1500,7 +1500,7 @@ ZipFSUnmountObjCmd(ClientData clientData, Tcl_Interp *interp, Tcl_WrongNumArgs(interp, 1, objv, "zipfile"); return TCL_ERROR; } - return TclZipfsUnmount(interp, Tcl_GetString(objv[1])); + return TclZipfs_Unmount(interp, Tcl_GetString(objv[1])); } /* @@ -2271,7 +2271,7 @@ ZipFSCanonicalObjCmd(ClientData clientData, Tcl_Interp *interp, } mntpoint = Tcl_GetString(objv[1]); filename = Tcl_GetString(objv[2]); - result=CanonicalPath(mntpoint,filename,&dPath,zipfs); + result=CanonicalPath(mntpoint,filename,&dPath,zipfs); } Tcl_SetObjResult(interp,Tcl_NewStringObj(result,-1)); return TCL_OK; @@ -3430,7 +3430,7 @@ Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr) if(strncmp(path,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN)!=0) { return -1; } - + Tcl_DStringInit(&ds); path = CanonicalPath("",path, &ds, 1); len = Tcl_DStringLength(&ds); @@ -3793,7 +3793,7 @@ const Tcl_Filesystem zipfsFilesystem = { /* *------------------------------------------------------------------------- * - * TclZipfsInit -- + * TclZipfs_Init -- * * Perform per interpreter initialization of this module. * @@ -3808,7 +3808,7 @@ const Tcl_Filesystem zipfsFilesystem = { */ int -TclZipfsInit(Tcl_Interp *interp) +TclZipfs_Init(Tcl_Interp *interp) { #ifdef HAVE_ZLIB /* one-time initialization */ @@ -3884,7 +3884,7 @@ TclZipfsInit(Tcl_Interp *interp) /* *------------------------------------------------------------------------- * - * TclZipfsMount, TclZipfsUnmount -- + * TclZipfs_Mount, TclZipfs_Unmount -- * * Dummy version when no ZLIB support available. * @@ -3892,16 +3892,16 @@ TclZipfsInit(Tcl_Interp *interp) */ int -TclZipfsMount(Tcl_Interp *interp, const char *zipname, const char *mntpt, +TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd) { - return TclZipFsInit(interp, 1); + return TclZipfs_Init(interp, 1); } int -TclZipfsUnmount(Tcl_Interp *interp, const char *zipname) +TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) { - return TclZipFsInit(interp, 1); + return TclZipfs_Init(interp, 1); } #endif diff --git a/generic/tclZipfs.h b/generic/tclZipfs.h index 01c9e96..f7da3bd 100644 --- a/generic/tclZipfs.h +++ b/generic/tclZipfs.h @@ -27,11 +27,11 @@ extern "C" { # define ZIPFSAPI DLLEXPORT #endif -ZIPFSAPI int Tclzipfs_Mount(Tcl_Interp *interp, const char *zipname, +ZIPFSAPI int TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd); -ZIPFSAPI int Tclzipfs_Unmount(Tcl_Interp *interp, const char *zipname); -ZIPFSAPI int Tclzipfs_Init(Tcl_Interp *interp); -ZIPFSAPI int Tclzipfs_SafeInit(Tcl_Interp *interp); +ZIPFSAPI int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname); +ZIPFSAPI int TclZipfs_Init(Tcl_Interp *interp); +ZIPFSAPI int TclZipfs_SafeInit(Tcl_Interp *interp); #ifdef __cplusplus } -- cgit v0.12 From f1aa04858d2ad42cdb07c9c9b080e84c399c84e5 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Mon, 25 Sep 2017 16:33:20 +0000 Subject: Eliminated /base option on linking as not recommended with ASLR --- win/makefile.vc | 4 ++-- win/rules.vc | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index b42257c..9686d26 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -562,7 +562,7 @@ $(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj $(MAKELIBCMD) $** !else $(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj $(TCLSTUBLIB) - $(MAKEDLLCMD) -base:@$(WINDIR)\coffbase.txt,tcldde $** + $(MAKEDLLCMD) $** $(_VC_MANIFEST_EMBED_DLL) !endif @@ -571,7 +571,7 @@ $(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj $(MAKELIBCMD) $** !else $(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj $(TCLSTUBLIB) - $(MAKEDLLCMD) -base:@$(WINDIR)\coffbase.txt,tclreg $** + $(MAKEDLLCMD) $** $(_VC_MANIFEST_EMBED_DLL) !endif diff --git a/win/rules.vc b/win/rules.vc index 22379c4..f52b237 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -847,7 +847,6 @@ TCLIMPLIB = "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib" TCL_LIBRARY = $(_TCLDIR)\lib TCLREGLIB = "$(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib" TCLDDELIB = "$(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib" -COFFBASE = \must\have\tcl\sources\to\build\this\target TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target TCL_INCLUDES = -I"$(_TCLDIR)\include" @@ -862,7 +861,6 @@ TCLIMPLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib" TCL_LIBRARY = $(_TCLDIR)\library TCLREGLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib" TCLDDELIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib" -COFFBASE = "$(_TCLDIR)\win\coffbase.txt" TCLTOOLSDIR = $(_TCLDIR)\tools TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" @@ -1155,9 +1153,9 @@ $< .SUFFIXES:.c .rc MAKELIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ -MAKEDLLCMD = $(link32) $(dlllflags) -base:@$(WINDIR)\coffbase.txt,tcl -out:$@ $(baselibs) -MAKECONEXECMD = $(link32) $(conlflags) -out:$@ $(baselibs) -MAKEGUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) +MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) +MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) +MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) #---------------------------------------------------------- # Display stats being used. @@ -1169,7 +1167,5 @@ MAKEGUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) !message *** Optional defines are '$(OPTDEFINES)' !message *** Compiler version $(VCVER). Target machine is $(MACHINE) !message *** Host architecture is $(NATIVE_ARCH) -!message *** Cflags '$(cflags)' -!message *** Lflags '$(lflags)' !endif # ifdef _RULES_VC -- cgit v0.12 From 246e5991428e8da2ba868c84541901336a472ca0 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Mon, 25 Sep 2017 17:35:29 +0000 Subject: Eliminate obsolete winhelp style documentation and fix Html Help doc build to work on 64-bit systems. --- win/makefile.vc | 73 +++++---------------------------------------------------- win/rules.vc | 11 +++++++++ 2 files changed, 17 insertions(+), 67 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 9686d26..2fe5c72 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -649,7 +649,11 @@ gentommath_h: # NOTE: you can define HHC on the command-line to override this !ifndef HHC -HHC=""%ProgramFiles%\HTML Help Workshop\hhc.exe"" +!if exist("$(PROGRAMFILES_X86)\HTML Help Workshop\hhc.exe") +HHC=$(PROGRAMFILES_X86)\HTML Help Workshop\hhc.exe +!else +HHC=hhc.exe +!endif !endif HTMLDIR=$(OUT_DIR)\html HTMLBASE=TclTk$(VERSION) @@ -661,7 +665,7 @@ htmlhelp: chmsetup $(CHMFILE) $(CHMFILE): $(DOCDIR)\* @$(TCLSH) $(TOOLSDIR)\tcltk-man2html.tcl "--htmldir=$(HTMLDIR)" @echo Compiling HTML help project - -$(HHC) <<$(HHPFILE) >NUL + -"$(HHC)" <<$(HHPFILE) >NUL [OPTIONS] Compatibility=1.1 or later Compiled file=$(HTMLBASE).chm @@ -685,76 +689,11 @@ UserCmd\*.htm chmsetup: @if not exist $(HTMLDIR)\nul mkdir $(HTMLDIR) -#------------------------------------------------------------------------- -# Build the old-style Windows .hlp file -#------------------------------------------------------------------------- - -TCLHLPBASE = $(PROJECT)$(VERSION) -HELPFILE = $(OUT_DIR)\$(TCLHLPBASE).hlp -HELPCNT = $(OUT_DIR)\$(TCLHLPBASE).cnt -DOCTMP_DIR = $(OUT_DIR)\$(PROJECT)_docs -HELPRTF = $(DOCTMP_DIR)\$(PROJECT).rtf -MAN2HELP = $(DOCTMP_DIR)\man2help.tcl -MAN2HELP2 = $(DOCTMP_DIR)\man2help2.tcl -INDEX = $(DOCTMP_DIR)\index.tcl -BMP = $(DOCTMP_DIR)\feather.bmp -BMP_NOPATH = feather.bmp -MAN2TCL = $(DOCTMP_DIR)\man2tcl.exe - -winhelp: docsetup $(HELPFILE) - -docsetup: - @if not exist $(DOCTMP_DIR)\nul mkdir $(DOCTMP_DIR) - -$(MAN2HELP) $(MAN2HELP2) $(INDEX) $(BMP): $(TOOLSDIR)\$$(@F) - @$(CPY) $(TOOLSDIR)\$(@F) $(@D) - -$(HELPFILE): $(HELPRTF) $(BMP) - cd $(DOCTMP_DIR) - start /wait hcrtf.exe -x <<$(PROJECT).hpj -[OPTIONS] -COMPRESS=12 Hall Zeck -LCID=0x409 0x0 0x0 ; English (United States) -TITLE=Tcl/Tk Reference Manual -BMROOT=. -CNT=$(@B).cnt -HLP=$(@B).hlp - -[FILES] -$(PROJECT).rtf - -[WINDOWS] -main="Tcl/Tk Reference Manual",,27648,(r15263976),(r65535) - -[CONFIG] -BrowseButtons() -CreateButton(1, "Web", ExecFile("http://www.tcl.tk")) -CreateButton(2, "SF", ExecFile("http://sf.net/projects/tcl")) -CreateButton(3, "Wiki", ExecFile("http://wiki.tcl.tk")) -CreateButton(4, "FAQ", ExecFile("http://www.purl.org/NET/Tcl-FAQ/")) -<< - cd $(MAKEDIR) - @$(CPY) "$(DOCTMP_DIR)\$(@B).hlp" "$(OUT_DIR)" - @$(CPY) "$(DOCTMP_DIR)\$(@B).cnt" "$(OUT_DIR)" - -$(MAN2TCL): $(TOOLSDIR)\$$(@B).c - $(cc32) $(TCL_CFLAGS) -Fo$(@D)\ $(TOOLSDIR)\$(@B).c - $(link32) $(conlflags) -out:$@ -stack:16384 $(@D)\man2tcl.obj - $(_VC_MANIFEST_EMBED_EXE) - -$(HELPRTF): $(MAN2TCL) $(MAN2HELP) $(MAN2HELP2) $(INDEX) $(DOCDIR)\* - $(TCLSH) $(MAN2HELP) -bitmap $(BMP_NOPATH) $(PROJECT) $(VERSION) $(DOCDIR:\=/) - install-docs: !if exist("$(CHMFILE)") @echo Installing compiled HTML help @$(CPY) "$(CHMFILE)" "$(DOC_INSTALL_DIR)\" !endif -!if exist("$(HELPFILE)") - @echo Installing Windows help - @$(CPY) "$(HELPFILE)" "$(DOC_INSTALL_DIR)\" - @$(CPY) "$(HELPCNT)" "$(DOC_INSTALL_DIR)\" -!endif # "emacs font-lock highlighting fix diff --git a/win/rules.vc b/win/rules.vc index f52b237..7ae345b 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -69,6 +69,17 @@ CPY = xcopy /i /y >NUL COPY = copy /y >NUL MKDIR = mkdir +# The ProgramFiles(x86) environment variable is not accessible +# from nmake since it has the parenthesis which nmake does not like +# within a macro name. So define our own in terms of the +# ProgramFiles environment variable. +# Note: env variables are always UPPER CASE in nmake +!if defined(PROCESSOR_ARCHITECTURE) && "$(PROCESSOR_ARCHITECTURE)" == "AMD64" +PROGRAMFILES_X86 = $(PROGRAMFILES) (x86) +!else +PROGRAMFILES_X86 = $(PROGRAMFILES) +!endif + ###################################################################### # 2. Figure out our build environment in terms of what we're building. -- cgit v0.12 From 07c1c221cb6dff468b482320fb122254ab0b49ed Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 26 Sep 2017 12:22:42 +0000 Subject: Include rules.vc and nmakehlp.c as part of install. Work toward not having to keep updating extensions with the latest version of rules.vc and nmakehlp. Extension makefiles can instead use the installed files instead. Also added some basic sanity checks to rules.vc to warn if extensions are being compiled with options incompatible with those used to build Tcl. --- win/makefile.vc | 34 ++++++++++++++++++++++-------- win/rules.vc | 64 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 82 insertions(+), 16 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 2fe5c72..99d013e 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -468,7 +468,7 @@ PKGSDIR = $(ROOT)\pkgs # Additional include and C macro definitions for the implicit rules # defined in rules.vc PRJ_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TOMMATHDIR)" -PRJ_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE +PRJ_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE # Define compiler flags used in our private implicit rules that are # not covered by rules.vc @@ -698,6 +698,19 @@ install-docs: # "emacs font-lock highlighting fix #--------------------------------------------------------------------- +# Generate the tcl.nmake file which contains the options used to build +# Tcl itself. This is used when building extensions. +#--------------------------------------------------------------------- +tcl-nmake: $(OUT_DIR)\tcl.nmake +$(OUT_DIR)\tcl.nmake: + @type << >$@ +CORE_MACHINE = $(MACHINE) +CORE_DEBUG = $(DEBUG) +CORE_TCL_THREADS = $(TCL_THREADS) +CORE_USE_THREAD_ALLOC = $(USE_THREAD_ALLOC) +<< + +#--------------------------------------------------------------------- # Build tclConfig.sh for the TEA build system. #--------------------------------------------------------------------- @@ -937,19 +950,21 @@ install-binaries: @echo Installing $(TCLSTUBLIBNAME) @$(CPY) "$(TCLSTUBLIB)" "$(LIB_INSTALL_DIR)\" -install-libraries: tclConfig install-msgs install-tzdata - @if not exist "$(SCRIPT_INSTALL_DIR)$(NULL)" \ +install-libraries: tclConfig tcl-nmake install-msgs install-tzdata + @if not exist "$(SCRIPT_INSTALL_DIR)" \ $(MKDIR) "$(SCRIPT_INSTALL_DIR)" - @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8$(NULL)" \ + @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8" \ $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8" - @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4$(NULL)" \ + @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4" \ $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4" - @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform$(NULL)" \ + @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform" \ $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform" - @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5$(NULL)" \ + @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5" \ $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5" - @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.6$(NULL)" \ + @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.6" \ $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.6" + @if not exist "$(LIB_INSTALL_DIR)\nmake" \ + $(MKDIR) "$(LIB_INSTALL_DIR)\nmake" @echo Installing header files @$(CPY) "$(GENERICDIR)\tcl.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclDecls.h" "$(INCLUDE_INSTALL_DIR)\" @@ -973,6 +988,9 @@ install-libraries: tclConfig install-msgs install-tzdata @$(CPY) "$(ROOT)\library\auto.tcl" "$(SCRIPT_INSTALL_DIR)\" @$(CPY) "$(OUT_DIR)\tclConfig.sh" "$(LIB_INSTALL_DIR)\" @$(CPY) "$(WINDIR)\tclooConfig.sh" "$(LIB_INSTALL_DIR)\" + @$(CPY) "$(WINDIR)\rules.vc" "$(LIB_INSTALL_DIR)\nmake\" + @$(CPY) "$(WINDIR)\nmakehlp.c" "$(LIB_INSTALL_DIR)\nmake\" + @$(CPY) "$(OUT_DIR)\tcl.nmake" "$(LIB_INSTALL_DIR)\nmake\" @echo Installing library http1.0 directory @$(CPY) "$(ROOT)\library\http1.0\*.tcl" \ "$(SCRIPT_INSTALL_DIR)\http1.0\" diff --git a/win/rules.vc b/win/rules.vc index 7ae345b..f94c894 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -38,6 +38,8 @@ _RULES_VC = 1 # 12. Set up the actual options passed to compiler and linker based # on the information gathered above. # 13. Define some standard build targets and implicit rules. +# 14. (For extensions only.) Compare the configuration of the target +# Tcl and the extensions and warn against discrepancies. # # One final note about the macro names used. They are as they are # for historical reasons. We would like legacy extensions to @@ -120,13 +122,24 @@ PROGRAMFILES_X86 = $(PROGRAMFILES) ROOT = $(MAKEDIR)\.. # The following paths CANNOT have spaces in them as they appear on the # left side of implicit rules. +!ifndef COMPATDIR COMPATDIR = $(ROOT)\compat +!endif +!ifndef DOCDIR DOCDIR = $(ROOT)\doc +!endif +!ifndef GENERICDIR GENERICDIR = $(ROOT)\generic +!endif +!ifndef TOOLSDIR TOOLSDIR = $(ROOT)\tools +!endif +# Do NOT enclose WINDIR in a !ifndef because Windows always defines +# WINDIR env var to point to c:\windows! +# TBD - This is a potentially dangerous conflict, rename WINDIR to +# something else WINDIR = $(ROOT)\win - # The target directory where the built packages and binaries will be installed. # INSTALLDIR is the (optional) path specified by the user. # _INSTALLDIR is INSTALLDIR using the backslash separator syntax @@ -367,8 +380,8 @@ NMAKEHLPC = nmakehlp.c !if "$(PROJECT)" != "tcl" !if $(TCLINSTALL) -!if exist("$(_TCLDIR)\lib\config.nmake\nmakehlp.c") -NMAKEHLPC = $(_TCLDIR)\lib\config.nmake\nmakehlp.c +!if exist("$(_TCLDIR)\lib\nmake\nmakehlp.c") +NMAKEHLPC = $(_TCLDIR)\lib\nmake\nmakehlp.c !endif !else # ! $(TCLINSTALL) !if exist("$(_TCLDIR)\win\nmakehlp.c") @@ -1123,17 +1136,15 @@ default_target: $(DEFAULT_BUILD_TARGET) clean: @echo Cleaning $(TMP_DIR)\* ... @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) - @echo Cleaning $(WINDIR)\nmakehlp.obj ... + @echo Cleaning $(WINDIR)\nmakehlp.obj, nmakehlp.exe ... @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj - @echo Cleaning $(WINDIR)\nmakehlp.exe ... @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe @echo Cleaning $(WINDIR)\_junk.pch ... @if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch - @echo Cleaning $(WINDIR)\vercl.x ... + @echo Cleaning $(WINDIR)\vercl.x, vercl.i ... @if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x - @echo Cleaning $(WINDIR)\vercl.i ... @if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i - @echo Cleaning $(WINDIR)\versions.vc ... + @echo Cleaning $(WINDIR)\versions.vc, version.vc ... @if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc @if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc @@ -1168,6 +1179,43 @@ MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) +################################################################ +# 14. Sanity check selected options against Tcl build options +# When building an extension, certain configuration options should +# match the ones used when Tcl was built. Here we check and +# warn on a mismatch. +!if "$(PROJECT)" != "tcl" + +!if $(TCLINSTALL) # Building against an installed Tcl +!if exist("$(_TCLDIR)\lib\nmake\tcl.nmake") +TCLNMAKECONFIG = "$(_TCLDIR)\lib\nmake\tcl.nmake" +!endif +!else # ! $(TCLINSTALL) - building against Tcl source +!if exist("$(OUT_DIR)\tcl.nmake") +TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake" +!endif +!endif # TCLINSTALL + +!if ! $(DISABLE_CONFIG_CHECKS) +!ifdef TCLNMAKECONFIG +!include $(TCLMAKECONFIG) + +!if defined(CORE_MACHINE) && $(CORE_MACHINE) != $(MACHINE) +!error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)). +!endif +!if defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC) +!message WARNING: Value of USE_THREAD_ALLOC ($(USE_THREAD_ALLOC)) does not match its Tcl core value ($(CORE_USE_THREAD_ALLOC)). +!endif +!if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG) +!message WARNING: Value of DEBUG ($(DEBUG)) does not match its Tcl library configuration ($(DEBUG)). +!endif +!endif + +!endif # TCLNMAKECONFIG + +!endif # $(PROJECT) == "tcl" + + #---------------------------------------------------------- # Display stats being used. #---------------------------------------------------------- -- cgit v0.12 From 37349378785168cf70e452f241bc3df32d03d379 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Thu, 28 Sep 2017 12:22:41 +0000 Subject: Add pkgcflags, appcflags and stubscflags to reflect different compilation modes. Packages compile (at least) three types of objects files - the shared library extension (e.g. tk86.dll), application programs (e.g. wish) and a static stubs library (tkstub86.lib). Thus we need to construct three different sets of compilation flags accordingly. Also updated makefile header comments to reflect modern usage. --- win/makefile.vc | 117 +++++++++++++++++++++++--------------------------------- win/rules.vc | 99 ++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 133 insertions(+), 83 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 99d013e..015f6ba 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -1,7 +1,6 @@ -#------------------------------------------------------------- -# makefile.vc -- +#------------------------------------------------------------- -*- makefile -*- # -# Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+) +# Microsoft Visual C++ makefile for use with nmake # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -11,27 +10,28 @@ # Copyright (c) 2001-2005 ActiveState Corporation. # Copyright (c) 2001-2004 David Gravereaux. # Copyright (c) 2003-2008 Pat Thoyts. +# Copyright (c) 2017 Ashok P. Nadkarni #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # HOW TO USE this makefile: # -# 1) It is now necessary to have MSVCDir, MSDevDir or MSSDK set in the -# environment. This is used as a check to see if vcvars32.bat had been -# run prior to running nmake or during the installation of Microsoft -# Visual C++, MSVCDir had been set globally and the PATH adjusted. -# Either way is valid. +# 1) It is necessary to have the appropriate Visual C++ environment +# set up before invoking nmake. The steps required depend on which +# version of Visual Studio and/or the Windows SDK you are building +# against and are not described here. With Visual Studio, the simplest +# is to start a command shell using one of the installed short cuts. +# An alternative is to run vcvars32.bat, vcvars64.bat, vcvarsamd64_x86.bat +# etc. depending on the host and target architectures. If compiling +# with the Windows SDK instead, run (again depending on the SDK version) +# the setenv.bat or equivalent batch file from the command prompt. # -# You'll need to run vcvars32.bat contained in the MsDev's vc(98)/bin -# directory to setup the proper environment, if needed, for your -# current setup. This is a needed bootstrap requirement and allows the -# swapping of different environments to be easier. -# -# 2) To use the Platform SDK (not expressly needed), run setenv.bat after +# NOTE: For older (Visual C++ 6 or the 2003 SDK), to use the Platform +# SDK (not expressly needed), run setenv.bat after # vcvars32.bat according to the instructions for it. This can also # turn on the 64-bit compiler, if your SDK has it. # -# 3) Targets are: +# 2) Targets are: # release -- Builds the core, the shell and the dlls. (default) # dlls -- Just builds the windows extensions # shell -- Just builds the shell and the core. @@ -51,12 +51,8 @@ # troff manual pages found in $(ROOT)\doc. You need to # have installed the HTML Help Compiler package from Microsoft # to produce the .chm file. -# winhelp -- (deprecated) Builds the windows .hlp file for Tcl from -# the troff man files found in $(ROOT)\doc. This type of -# help file is deprecated by Microsoft in favour of html -# help files (.chm) # -# 4) Macros usable on the commandline: +# 3) Macros usable on the commandline: # INSTALLDIR= # Sets where to install Tcl from the built binaries. # C:\Progra~1\Tcl is assumed when not specified. @@ -67,7 +63,7 @@ # 'none' will over-ride everything to nothing. # # loimpact = Adds a flag for how NT treats the heap to keep memory -# in use, low. This is said to impact alloc performance. +# in use, low. Said to impact alloc performance. # msvcrt = Affects the static option only to switch it from # using libcmt(d) as the C runtime [by default] to # msvcrt(d). This is useful for static embedding @@ -113,15 +109,15 @@ # MACHINE=(AMD64|IX86) # Set the machine type used for the compiler, linker, and # resource compiler. This hook is needed to tell the tools -# when alternate platforms are requested. This should normally -# NOT be set as it is automatically detected based on the -# compiler in use. +# when alternate platforms are requested. THIS SHOULD NORMALLY +# NOT BE SET AS IT IS AUTOMATICALLY DETECTED BASED ON THE +# COMPILER IN USE. # # TMP_DIR= # OUT_DIR= # Hooks to allow the intermediate and output directories to be # changed. $(OUT_DIR) is assumed to be -# $(BINROOT)\(Release|Debug) based on if symbols are requested. +# .\(Release|Debug) based on if symbols are requested. # $(TMP_DIR) will de $(OUT_DIR)\ by default. # # TESTPAT= @@ -131,20 +127,20 @@ # name of encoding for configuration information. Defaults # to cp1252 # -# 5) Examples: +# 4) Examples: # # Basic syntax of calling nmake looks like this: # nmake [-nologo] -f makefile.vc [target|macrodef [target|macrodef] [...]] # # Standard (no frills) -# c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat -# Setting environment for using Microsoft Visual C++ tools. # c:\tcl_src\win\>nmake -f makefile.vc release # c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl # -# Building for Win64 -# c:\tcl_src\win\>c:\progra~1\platfo~1\setenv.bat /x64 /RETAIL -# c:\tcl_src\win\>nmake -f makefile.vc +# With symbols in release builds +# c:\tcl_src\win\>nmake -f makefile.vc release OPTS=pdbs +# +# Debug build +# c:\tcl_src\win\>nmake -f makefile.vc release OPTS=symbols # #------------------------------------------------------------------------------ #============================================================================== @@ -219,13 +215,6 @@ DDEVERSION = $(DDEDOTVERSION:.=) REGDOTVERSION = 1.3 REGVERSION = $(REGDOTVERSION:.=) -TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib -TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) -TCLLIB = $(OUT_DIR)\$(TCLLIBNAME) - -TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib -TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME) - TCLREGLIBNAME = $(PROJECT)reg$(REGVERSION)$(SUFX:t=).$(EXT) TCLREGLIB = $(OUT_DIR)\$(TCLREGLIBNAME) @@ -460,26 +449,14 @@ TCLSTUBOBJS = \ TOMMATHDIR = $(ROOT)\libtommath PKGSDIR = $(ROOT)\pkgs -#--------------------------------------------------------------------- -# Compile flags -#--------------------------------------------------------------------- - - # Additional include and C macro definitions for the implicit rules # defined in rules.vc -PRJ_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TOMMATHDIR)" +PRJ_INCLUDES = -I"$(TOMMATHDIR)" PRJ_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -# Define compiler flags used in our private implicit rules that are -# not covered by rules.vc -TCL_CFLAGS = $(cflags) $(crt) $(PRJ_INCLUDES) $(PRJ_DEFINES) -STUB_CFLAGS = $(cflags) - - # Additional Link libraries needed beyond those in rules.vc PRJ_LIBS = netapi32.lib user32.lib userenv.lib ws2_32.lib - #--------------------------------------------------------------------- # TclTest flags #--------------------------------------------------------------------- @@ -726,7 +703,7 @@ $(OUT_DIR)\tclConfig.sh: $(WINDIR)\tclConfig.sh.in @TCL_MINOR_VERSION@ $(TCL_MINOR_VERSION) @TCL_PATCH_LEVEL@ $(TCL_PATCH_LEVEL) @CC@ $(CC) -@DEFS@ $(TCL_CFLAGS) +@DEFS@ $(pkgcflags) @CFLAGS_DEBUG@ -nologo -c -W3 -YX -Fp$(TMP_DIR)\ -MDd @CFLAGS_OPTIMIZE@ -nologo -c -W3 -YX -Fp$(TMP_DIR)\ -MD @LDFLAGS_DEBUG@ -nologo -machine:$(MACHINE) -debug -debugtype:cv @@ -794,28 +771,28 @@ gendate: #--------------------------------------------------------------------- $(TMP_DIR)\testMain.obj: $(WINDIR)\tclAppInit.c - $(cc32) $(TCL_CFLAGS) -DTCL_TEST \ + $(cc32) $(appcflags) -DTCL_TEST \ -DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \ -Fo$@ $? $(TMP_DIR)\tclMain2.obj: $(GENERICDIR)\tclMain.c - $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -DTCL_ASCII_MAIN \ + $(cc32) $(pkgcflags) -DTCL_ASCII_MAIN \ -Fo$@ $? $(TMP_DIR)\tclTest.obj: $(GENERICDIR)\tclTest.c - $(cc32) $(TCL_CFLAGS) -Fo$@ $? + $(cc32) $(appcflags) -Fo$@ $? $(TMP_DIR)\tclTestObj.obj: $(GENERICDIR)\tclTestObj.c - $(cc32) $(TCL_CFLAGS) -Fo$@ $? + $(cc32) $(appcflags) -Fo$@ $? $(TMP_DIR)\tclWinTest.obj: $(WINDIR)\tclWinTest.c - $(cc32) $(TCL_CFLAGS) -Fo$@ $? + $(cc32) $(appcflags) -Fo$@ $? $(TMP_DIR)\tclZlib.obj: $(GENERICDIR)\tclZlib.c - $(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -DBUILD_tcl -Fo$@ $? + $(cc32) $(pkgcflags) -I$(COMPATDIR)\zlib -Fo$@ $? $(TMP_DIR)\tclPkgConfig.obj: $(GENERICDIR)\tclPkgConfig.c - $(cc32) -DBUILD_tcl $(TCL_CFLAGS) \ + $(cc32) $(pkgcflags) \ -DCFG_INSTALL_LIBDIR="\"$(LIB_INSTALL_DIR:\=\\)\"" \ -DCFG_INSTALL_BINDIR="\"$(BIN_INSTALL_DIR:\=\\)\"" \ -DCFG_INSTALL_SCRDIR="\"$(SCRIPT_INSTALL_DIR:\=\\)\"" \ @@ -829,7 +806,7 @@ $(TMP_DIR)\tclPkgConfig.obj: $(GENERICDIR)\tclPkgConfig.c -Fo$@ $? $(TMP_DIR)\tclAppInit.obj: $(WINDIR)\tclAppInit.c - $(cc32) $(TCL_CFLAGS) \ + $(cc32) $(appcflags) \ -DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \ -Fo$@ $? @@ -838,17 +815,17 @@ $(TMP_DIR)\tclAppInit.obj: $(WINDIR)\tclAppInit.c $(TMP_DIR)\tclWinReg.obj: $(WINDIR)\tclWinReg.c !if $(STATIC_BUILD) - $(cc32) $(TCL_CFLAGS) -DTCL_THREADS=1 -DSTATIC_BUILD -Fo$@ $? + $(cc32) $(appcflags) -DSTATIC_BUILD -Fo$@ $? !else - $(cc32) $(TCL_CFLAGS) -DTCL_THREADS=1 -DUSE_TCL_STUBS -Fo$@ $? + $(cc32) $(appcflags) -DUSE_TCL_STUBS -Fo$@ $? !endif $(TMP_DIR)\tclWinDde.obj: $(WINDIR)\tclWinDde.c !if $(STATIC_BUILD) - $(cc32) $(TCL_CFLAGS) -DTCL_THREADS=1 -DSTATIC_BUILD -Fo$@ $? + $(cc32) $(appcflags) -DSTATIC_BUILD -Fo$@ $? !else - $(cc32) $(TCL_CFLAGS) -DTCL_THREADS=1 -DUSE_TCL_STUBS -Fo$@ $? + $(cc32) $(appcflags) -DUSE_TCL_STUBS -Fo$@ $? !endif @@ -857,13 +834,13 @@ $(TMP_DIR)\tclWinDde.obj: $(WINDIR)\tclWinDde.c ### specific C run-time. $(TMP_DIR)\tclStubLib.obj: $(GENERICDIR)\tclStubLib.c - $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(PRJ_INCLUDES) -Fo$@ $? + $(cc32) $(stubscflags) -Fo$@ $? $(TMP_DIR)\tclTomMathStubLib.obj: $(GENERICDIR)\tclTomMathStubLib.c - $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(PRJ_INCLUDES) -Fo$@ $? + $(cc32) $(stubscflags) -Fo$@ $? $(TMP_DIR)\tclOOStubLib.obj: $(GENERICDIR)\tclOOStubLib.c - $(cc32) $(STUB_CFLAGS) -Zl -DSTATIC_BUILD $(PRJ_INCLUDES) -Fo$@ $? + $(cc32) $(stubscflags) -Fo$@ $? $(TMP_DIR)\tclsh.exe.manifest: $(WINDIR)\tclsh.exe.manifest.in @nmakehlp -s << $** >$@ @@ -884,7 +861,7 @@ depend: @echo Build tclsh first! !else $(TCLSH) $(TOOLSDIR:\=/)/mkdepend.tcl -vc32 -out:"$(OUT_DIR)\depend.mk" \ - -passthru:"-DBUILD_tcl $(PRJ_INCLUDES)" $(GENERICDIR),$$(GENERICDIR) \ + -passthru:"-DBUILD_tcl $(TCL_INCLUDES) $(PRJ_INCLUDES)" $(GENERICDIR),$$(GENERICDIR) \ $(COMPATDIR),$$(COMPATDIR) $(TOMMATHDIR),$$(TOMMATHDIR) $(WINDIR),$$(WINDIR) @<< $(TCLOBJS) << @@ -913,12 +890,12 @@ $(TCLOBJS) #--------------------------------------------------------------------- {$(TOMMATHDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<< + $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<< $< << {$(COMPATDIR)\zlib}.c{$(TMP_DIR)}.obj:: - $(cc32) $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<< + $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<< $< << diff --git a/win/rules.vc b/win/rules.vc index f94c894..fe5a8e7 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -139,6 +139,9 @@ TOOLSDIR = $(ROOT)\tools # TBD - This is a potentially dangerous conflict, rename WINDIR to # something else WINDIR = $(ROOT)\win +!ifndef RCDIR +RCDIR = $(WINDIR)\rc +!endif # The target directory where the built packages and binaries will be installed. # INSTALLDIR is the (optional) path specified by the user. @@ -202,6 +205,11 @@ TCLINSTALL = 1 TCLDIR = $(_INSTALLDIR) _TCLDIR = $(_INSTALLDIR) _TCL_H = $(_INSTALLDIR)\include\tcl.h +!elseif exist("..\..\tcl\generic\tcl.h") +TCLINSTALL = 0 +TCLDIR = ..\..\tcl +_TCLDIR = $(TCLDIR) +_TCL_H = $(_TCLDIR)\generic\tcl.h !endif !endif # TCLDIR @@ -531,7 +539,9 @@ LINKERFLAGS = $(LINKERFLAGS) -ltcg # 0 -> Use the non-thread allocator. # UNCHECKED - 1 -> when doing a debug build with symbols, use the release # C runtime, 0 -> use the debug C runtime. -# +# USE_STUBS - 1 -> compile to use stubs interfaces, 0 -> direct linking +# CONFIG_CHECK - 1 -> check current build configuration against Tcl +# configuration (ignored for Tcl itself) # Further, LINKERFLAGS are modified based on above. # Default values for all the above @@ -546,6 +556,12 @@ LOIMPACT = 0 TCL_USE_STATIC_PACKAGES = 0 USE_THREAD_ALLOC = 1 UNCHECKED = 0 +CONFIG_CHECK = 1 +!if "$(PROJECT)" == "tcl" || "$(PROJECT)" == "tk" +USE_STUBS = 0 +!else +USE_STUBS = 1 +!endif # If OPTS is not empty AND does not contain "none" which turns off all OPTS # set the above macros based on OPTS content @@ -556,8 +572,11 @@ UNCHECKED = 0 !if [nmakehlp -f $(OPTS) "static"] !message *** Doing static STATIC_BUILD = 1 -!else -STATIC_BUILD = 0 +!endif + +!if [nmakehlp -f $(OPTS) "nostubs"] +!message *** Not using stubs +USE_STUBS = 0 !endif !if [nmakehlp -f $(OPTS) "nomsvcrt"] @@ -644,6 +663,12 @@ UNCHECKED = 1 UNCHECKED = 0 !endif +!if [nmakehlp -f $(OPTS) "noconfigcheck"] +CONFIG_CHECK = 1 +!else +CONFIG_CHECK = 0 +!endif + !endif # "$(OPTS)" != "" && ... parsing of OPTS # Set linker flags based on above @@ -855,8 +880,15 @@ STUBPREFIX = $(PROJECT)stub # Set up paths to various Tcl executables and libraries needed by extensions !if "$(PROJECT)" == "tcl" -TCLSHNAME = $(PROJECT)sh$(TCL_VERSION)$(SUFX).exe +TCLSHNAME = $(PROJECT)sh$(TCL_VERSION)$(SUFX).exe TCLSH = $(OUT_DIR)\$(TCLSHNAME) +TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib +TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) +TCLLIB = $(OUT_DIR)\$(TCLLIBNAME) + +TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib +TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME) +TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" !else # $(PROJECT) is not "tcl" @@ -902,8 +934,17 @@ TCLSH_NATIVE = $(TCLSH) !endif !endif -# Do the same for Tk extensions that require the Tk libraries -!if defined(PROJECT_REQUIRES_TK) +# Do the same for Tk and Tk extensions that require the Tk libraries +!if "$(PROJECT)" == "tk" + +WISH = "$(OUT_DIR)\$(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe" +TKSTUBLIBNAME = $(STUBPREFIX)$(TK_VERSION).lib +TKSTUBLIB = "$(OUT_DIR)\$(TKSTUBLIBNAME)" +TKIMPLIB = "$(OUT_DIR)\$(PROJECT)$(TK_VERSION)$(SUFX).lib" +TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT) +TK_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" + +!elseif defined(PROJECT_REQUIRES_TK) !if $(TKINSTALL) # Building against installed Tk @@ -993,6 +1034,17 @@ OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED !endif +!if $(USE_STUBS) +# Note we do not define USE_TCL_STUBS even when building tk since some +# test targets in tk do not use stubs +!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk" +OPTDEFINES = $(OPTDEFINES) -DUSE_TCL_STUBS -DUSE_TCLOO_STUBS +!ifdef PROJECT_REQUIRES_TK +OPTDEFINES = $(OPTDEFINES) -DUSE_TK_STUBS +!endif +!endif +!endif # USE_STUBS + !if !$(DEBUG) OPTDEFINES = $(OPTDEFINES) -DNDEBUG !if $(OPTIMIZING) @@ -1012,7 +1064,7 @@ OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 # UNICODE - Use the wide char Windows API. # _ATL_XP_TARGETING - Newer SDK's need this to build for XP # BUILD_xxx - defined to export the xxx_Init call from the DLL -COMPILERFLAGS = /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING /DBUILD_$(PROJECT) +COMPILERFLAGS = /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING # crt picks the C run time based on selected OPTS !if $(MSVCRT) @@ -1061,7 +1113,27 @@ cwarn = $(cwarn) -wd4311 -wd4312 cwarn = $(cwarn) -WX !endif -cflags = -nologo -c $(COMPILERFLAGS) $(cdebug) $(cwarn) -Fp$(TMP_DIR)^\ $(OPTDEFINES) +# These flags are defined roughly in the order of the pre-reform rules.vc/makefile.vc to help +# visually compare that the pre- and post-reform build logs + +# cflags contains generic flags to be used for building practically all object files +cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug) + +# appcflags contains $(cflags) and flags for building the application object files +# (e.g. tclsh, or wish) +# pkgcflags contains $(cflags) plus flags used for building shared object files +# The two differ in the BUILD_$(PROJECT) macro which should be defined only for +# the shared library *implementation* and not for its caller interface +appcflags = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) +pkgcflags = $(appcflags) /DBUILD_$(PROJECT) + +# stubscflags contains $(cflags) plus flags used for building a stubs library for the +# package. +# Note: -DSTATIC_BUILD is defined in $(OPTDEFINES) only if the OPTS configuration indicates +# a static library. However the stubs library is ALWAYS static hence included here +# irrespective of the OPTS setting. +stubscflags = $(cflags) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) + # Link flags @@ -1154,20 +1226,21 @@ hose: @echo Hosing $(OUT_DIR)\* ... @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) -# Implicit rule definitions +# Implicit rule definitions - only for building library objects. For stubs and main +# application, the master makefile should define explicit rules. {$(WINDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(cflags) $(crt) $(PRJ_INCLUDES) $(PRJ_DEFINES) -Fo$(TMP_DIR)\ @<< + $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<< $< << {$(GENERICDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(cflags) $(crt) $(PRJ_INCLUDES) $(PRJ_DEFINES) -Fo$(TMP_DIR)\ @<< + $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<< $< << {$(COMPATDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(cflags) $(crt) $(PRJ_INCLUDES) $(PRJ_DEFINES) -Fo$(TMP_DIR)\ @<< + $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<< $< << @@ -1196,7 +1269,7 @@ TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake" !endif !endif # TCLINSTALL -!if ! $(DISABLE_CONFIG_CHECKS) +!if $(CONFIG_CHECK) !ifdef TCLNMAKECONFIG !include $(TCLMAKECONFIG) -- cgit v0.12 From e4269a71402fe87814784726463492302dfb48d8 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Fri, 29 Sep 2017 06:12:04 +0000 Subject: Updated for Tk compatibility. Removed extraneous quotes in macro definitions. Macros should be quoted at *use* time, not *definition* time. Added _nostubs versions of pkgcflags and appcflags. --- win/makefile.vc | 2 +- win/rules.vc | 91 ++++++++++++++++++++++++++++++--------------------------- 2 files changed, 49 insertions(+), 44 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 015f6ba..f2f3208 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -118,7 +118,7 @@ # Hooks to allow the intermediate and output directories to be # changed. $(OUT_DIR) is assumed to be # .\(Release|Debug) based on if symbols are requested. -# $(TMP_DIR) will de $(OUT_DIR)\ by default. +# $(TMP_DIR) will be $(OUT_DIR)\ by default. # # TESTPAT= # Reads the tests requested to be run from this file. diff --git a/win/rules.vc b/win/rules.vc index fe5a8e7..be49672 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -557,7 +557,7 @@ TCL_USE_STATIC_PACKAGES = 0 USE_THREAD_ALLOC = 1 UNCHECKED = 0 CONFIG_CHECK = 1 -!if "$(PROJECT)" == "tcl" || "$(PROJECT)" == "tk" +!if "$(PROJECT)" == "tcl" USE_STUBS = 0 !else USE_STUBS = 1 @@ -894,29 +894,29 @@ TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" !if $(TCLINSTALL) # Building against an installed Tcl -TCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe" +TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe !if !exist($(TCLSH)) && $(TCL_THREADS) -TCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe" +TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe !endif -TCLSTUBLIB = "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib" -TCLIMPLIB = "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib" +TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib +TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib TCL_LIBRARY = $(_TCLDIR)\lib -TCLREGLIB = "$(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib" -TCLDDELIB = "$(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib" +TCLREGLIB = $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib +TCLDDELIB = $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target TCL_INCLUDES = -I"$(_TCLDIR)\include" !else # Building against Tcl sources -TCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe" +TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe !if !exist($(TCLSH)) && $(TCL_THREADS) -TCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe" +TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe !endif -TCLSTUBLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib" -TCLIMPLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib" +TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib +TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib TCL_LIBRARY = $(_TCLDIR)\library -TCLREGLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib" -TCLDDELIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib" +TCLREGLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib +TCLDDELIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib TCLTOOLSDIR = $(_TCLDIR)\tools TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" @@ -937,27 +937,29 @@ TCLSH_NATIVE = $(TCLSH) # Do the same for Tk and Tk extensions that require the Tk libraries !if "$(PROJECT)" == "tk" -WISH = "$(OUT_DIR)\$(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe" +WISHNAMEPREFIX = wish +WISH = $(OUT_DIR)\$(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe TKSTUBLIBNAME = $(STUBPREFIX)$(TK_VERSION).lib -TKSTUBLIB = "$(OUT_DIR)\$(TKSTUBLIBNAME)" -TKIMPLIB = "$(OUT_DIR)\$(PROJECT)$(TK_VERSION)$(SUFX).lib" +TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME) +TKIMPLIB = $(OUT_DIR)\$(PROJECT)$(TK_VERSION)$(SUFX).lib TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT) +TKLIB = $(OUT_DIR)\$(TKLIBNAME) TK_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" !elseif defined(PROJECT_REQUIRES_TK) !if $(TKINSTALL) # Building against installed Tk -WISH = "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe" -TKSTUBLIB = "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib" -TKIMPLIB = "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib" +WISH = $(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe +TKSTUBLIB = $(_TKDIR)\lib\tkstub$(TK_VERSION).lib +TKIMPLIB = $(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib TK_INCLUDES = -I"$(_TKDIR)\include" !else # Building against Tk sources -WISH = "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe" -TKSTUBLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib" -TKIMPLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib" +WISH = $(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe +TKSTUBLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib +TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" !endif # TKINSTALL @@ -978,9 +980,9 @@ LIB_INSTALL_DIR = $(_INSTALLDIR)\lib BIN_INSTALL_DIR = $(_INSTALLDIR)\bin DOC_INSTALL_DIR = $(_INSTALLDIR)\doc !if "$(PROJECT)" == "tcl" -SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\tcl$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) +SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) !else -SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\tk$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) +SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) !endif INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include !else @@ -1037,10 +1039,10 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED !if $(USE_STUBS) # Note we do not define USE_TCL_STUBS even when building tk since some # test targets in tk do not use stubs -!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk" -OPTDEFINES = $(OPTDEFINES) -DUSE_TCL_STUBS -DUSE_TCLOO_STUBS +!if "$(PROJECT)" != "tcl" +USE_STUBS_DEFS = -DUSE_TCL_STUBS -DUSE_TCLOO_STUBS !ifdef PROJECT_REQUIRES_TK -OPTDEFINES = $(OPTDEFINES) -DUSE_TK_STUBS +USE_STUBS_DEFS = $(USE_STUBS_DEFS) -DUSE_TK_STUBS !endif !endif !endif # USE_STUBS @@ -1063,7 +1065,6 @@ OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 # UNICODE - Use the wide char Windows API. # _ATL_XP_TARGETING - Newer SDK's need this to build for XP -# BUILD_xxx - defined to export the xxx_Init call from the DLL COMPILERFLAGS = /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING # crt picks the C run time based on selected OPTS @@ -1113,27 +1114,31 @@ cwarn = $(cwarn) -wd4311 -wd4312 cwarn = $(cwarn) -WX !endif -# These flags are defined roughly in the order of the pre-reform rules.vc/makefile.vc to help -# visually compare that the pre- and post-reform build logs +# These flags are defined roughly in the order of the pre-reform +# rules.vc/makefile.vc to help visually compare that the pre- and +# post-reform build logs -# cflags contains generic flags to be used for building practically all object files +# cflags contains generic flags used for building practically all object files cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug) -# appcflags contains $(cflags) and flags for building the application object files -# (e.g. tclsh, or wish) -# pkgcflags contains $(cflags) plus flags used for building shared object files -# The two differ in the BUILD_$(PROJECT) macro which should be defined only for -# the shared library *implementation* and not for its caller interface -appcflags = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) +# appcflags contains $(cflags) and flags for building the application +# object files (e.g. tclsh, or wish) pkgcflags contains $(cflags) plus +# flags used for building shared object files The two differ in the +# BUILD_$(PROJECT) macro which should be defined only for the shared +# library *implementation* and not for its caller interface + +appcflags = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) $(USE_STUBS_DEFS) +appcflags_nostubs = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) pkgcflags = $(appcflags) /DBUILD_$(PROJECT) +pkgcflags_nostubs = $(appcflags_nostubs) /DBUILD_$(PROJECT) -# stubscflags contains $(cflags) plus flags used for building a stubs library for the -# package. -# Note: -DSTATIC_BUILD is defined in $(OPTDEFINES) only if the OPTS configuration indicates -# a static library. However the stubs library is ALWAYS static hence included here -# irrespective of the OPTS setting. -stubscflags = $(cflags) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) +# stubscflags contains $(cflags) plus flags used for building a stubs +# library for the package. Note: -DSTATIC_BUILD is defined in +# $(OPTDEFINES) only if the OPTS configuration indicates a static +# library. However the stubs library is ALWAYS static hence included +# here irrespective of the OPTS setting. +stubscflags = $(cflags) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) # Link flags -- cgit v0.12 From 71c784c8bc5a9a679f643f2047d5330ffd87fa08 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Fri, 29 Sep 2017 12:41:02 +0000 Subject: Added implicit rule for compiling resources. Added Tcl import libraries to link macro. --- win/makefile.vc | 9 +-------- win/rules.vc | 25 ++++++++++++++++++++----- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index f2f3208..a32549b 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -899,14 +899,7 @@ $< $< << -{$(WINDIR)}.rc{$(TMP_DIR)}.res: - $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ - -d DEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ - -d TCL_THREADS=$(TCL_THREADS) \ - -d STATIC_BUILD=$(STATIC_BUILD) \ - $< - -$(TMP_DIR)\tclsh.res: $(TMP_DIR)\tclsh.exe.manifest +$(TMP_DIR)\tclsh.res: $(TMP_DIR)\tclsh.exe.manifest $(WINDIR)\tclsh.rc #--------------------------------------------------------------------- diff --git a/win/rules.vc b/win/rules.vc index be49672..2744330 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -922,6 +922,8 @@ TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" !endif # TCLINSTALL +tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)" + !endif $(PROJECT) != "tcl" # We need a tclsh that will run on the host machine as part of the build. @@ -1129,8 +1131,8 @@ cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug) appcflags = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) $(USE_STUBS_DEFS) appcflags_nostubs = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) -pkgcflags = $(appcflags) /DBUILD_$(PROJECT) -pkgcflags_nostubs = $(appcflags_nostubs) /DBUILD_$(PROJECT) +pkgcflags = $(appcflags) -DBUILD_$(PROJECT) +pkgcflags_nostubs = $(appcflags_nostubs) -DBUILD_$(PROJECT) # stubscflags contains $(cflags) plus flags used for building a stubs # library for the package. Note: -DSTATIC_BUILD is defined in @@ -1249,13 +1251,26 @@ $< $< << +{$(RCDIR)}.rc{$(TMP_DIR)}.res: + $(MAKERESCMD) + +{$(WINDIR)}.rc{$(TMP_DIR)}.res: + $(MAKERESCMD) + .SUFFIXES: .SUFFIXES:.c .rc MAKELIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ -MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) -MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) -MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) +MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) +MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) +MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) +MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ + $(TCL_INCLUDES) \ + -d DEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ + -d TCL_THREADS=$(TCL_THREADS) \ + -d STATIC_BUILD=$(STATIC_BUILD) \ + $< + ################################################################ # 14. Sanity check selected options against Tcl build options -- cgit v0.12 From 78cf38319762a590b74fbe99f1802584e73e9db3 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Fri, 29 Sep 2017 14:23:17 +0000 Subject: Permit definition of implicit rules and standard targets to be disabled --- win/rules.vc | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 2744330..973cef9 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -37,7 +37,8 @@ _RULES_VC = 1 # 11. Construct the paths where the package is to be installed # 12. Set up the actual options passed to compiler and linker based # on the information gathered above. -# 13. Define some standard build targets and implicit rules. +# 13. Define some standard build targets and implicit rules. These may +# be optionally disabled by the parent makefile. # 14. (For extensions only.) Compare the configuration of the target # Tcl and the extensions and warn against discrepancies. # @@ -1204,7 +1205,20 @@ baselibs = $(baselibs) ucrt.lib !endif ################################################################ -# 3. Define common make targets and implicit rules +# 3. Define standard commands, common make targets and implicit rules + +MAKELIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ +MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) +MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) +MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) +MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ + $(TCL_INCLUDES) \ + -d DEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ + -d TCL_THREADS=$(TCL_THREADS) \ + -d STATIC_BUILD=$(STATIC_BUILD) \ + $< + +!ifndef DISABLE_DEFAULT_TARGETS !ifndef DEFAULT_BUILD_TARGET DEFAULT_BUILD_TARGET = all @@ -1233,8 +1247,11 @@ hose: @echo Hosing $(OUT_DIR)\* ... @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) -# Implicit rule definitions - only for building library objects. For stubs and main -# application, the master makefile should define explicit rules. +!endif + +!ifndef DISABLE_IMPLICIT_RULES +# Implicit rule definitions - only for building library objects. For stubs and +# main application, the master makefile should define explicit rules. {$(WINDIR)}.c{$(TMP_DIR)}.obj:: $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<< @@ -1260,17 +1277,7 @@ $< .SUFFIXES: .SUFFIXES:.c .rc -MAKELIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ -MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) -MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) -MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) -MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ - $(TCL_INCLUDES) \ - -d DEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ - -d TCL_THREADS=$(TCL_THREADS) \ - -d STATIC_BUILD=$(STATIC_BUILD) \ - $< - +!endif ################################################################ # 14. Sanity check selected options against Tcl build options -- cgit v0.12 From 457587f033b206475f695919961b1e2e83ecfc2f Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sat, 30 Sep 2017 06:20:33 +0000 Subject: Added standard macros LIBDIR and DEMODIR. Also set common Tk related names and paths --- win/rules.vc | 55 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 973cef9..5a5883b 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -135,6 +135,16 @@ GENERICDIR = $(ROOT)\generic !ifndef TOOLSDIR TOOLSDIR = $(ROOT)\tools !endif +!ifndef LIBDIR +LIBDIR = $(ROOT)\library +!endif +!ifndef DEMODIR +!if exist("$(LIBDIR)\demos") +DEMODIR = $(LIBDIR)\demos +!else +DEMODIR = $(ROOT)\demos +!endif +!endif # ifndef DEMODIR # Do NOT enclose WINDIR in a !ifndef because Windows always defines # WINDIR env var to point to c:\windows! # TBD - This is a potentially dangerous conflict, rename WINDIR to @@ -938,37 +948,36 @@ TCLSH_NATIVE = $(TCLSH) !endif # Do the same for Tk and Tk extensions that require the Tk libraries -!if "$(PROJECT)" == "tk" - +!if "$(PROJECT)" == "tk" || defined(PROJECT_REQUIRES_TK) WISHNAMEPREFIX = wish -WISH = $(OUT_DIR)\$(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe -TKSTUBLIBNAME = $(STUBPREFIX)$(TK_VERSION).lib -TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME) -TKIMPLIB = $(OUT_DIR)\$(PROJECT)$(TK_VERSION)$(SUFX).lib +WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT) +TKSTUBLIBNAME = tkstub$(TK_VERSION).lib +TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX).lib + +!if "$(PROJECT)" == "tk" +WISH = $(OUT_DIR)\$(WISHNAME) +TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME) +TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME) TKLIB = $(OUT_DIR)\$(TKLIBNAME) TK_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -!elseif defined(PROJECT_REQUIRES_TK) +!else # effectively PROJECT_REQUIRES_TK !if $(TKINSTALL) # Building against installed Tk - -WISH = $(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe -TKSTUBLIB = $(_TKDIR)\lib\tkstub$(TK_VERSION).lib -TKIMPLIB = $(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib +WISH = $(_TKDIR)\bin\$(WISHNAME) +TKSTUBLIB = $(_TKDIR)\lib\$(TKSTUBLIBNAME) +TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME) TK_INCLUDES = -I"$(_TKDIR)\include" - !else # Building against Tk sources - -WISH = $(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe -TKSTUBLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib -TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib +WISH = $(_TKDIR)\win\$(BUILDDIRTOP)\$(WISHNAME) +TKSTUBLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME) +TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME) TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" - !endif # TKINSTALL -!endif # PROJECT_REQUIRES_TK - +!endif # $(PROJECT) == tk +!endif # $(PROJECT) == tk || PROJECT_REQUIRES_TK ################################################################### # 11. Construct the paths for the installation directories @@ -978,6 +987,9 @@ TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" # DOC_INSTALL_DIR - where documentation should be installed # SCRIPT_INSTALL_DIR - where scripts should be installed # INCLUDE_INSTALL_DIR - where C include files should be installed +# DEMO_INSTALL_DIR - where demos should be installed +# PRJ_INSTALL_DIR - where package will be installed (not set for tcl and tk) + !if "$(PROJECT)" == "tcl" || "$(PROJECT)" == "tk" LIB_INSTALL_DIR = $(_INSTALLDIR)\lib BIN_INSTALL_DIR = $(_INSTALLDIR)\bin @@ -987,14 +999,19 @@ SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MIN !else SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) !endif +DEMO_INSTALL_DIR = $(SCRIPT_INSTALL_DIR)\demos INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include + !else + PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION) LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR) BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR) DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR) SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR) +DEMO_INSTALL_DIR = $(PRJ_INSTALL_DIR)\demos INCLUDE_INSTALL_DIR = $(_TCLDIR)\include + !endif ################################################################### -- cgit v0.12 From 24b65fbe41afddbd86e64d6a7459d46144fe246b Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sat, 30 Sep 2017 08:34:31 +0000 Subject: Added MAKEEXTCMD macro. Fixed couple of syntax errors when building extensions. --- win/rules.vc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 5a5883b..75919d2 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -906,7 +906,7 @@ TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" !if $(TCLINSTALL) # Building against an installed Tcl TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe -!if !exist($(TCLSH)) && $(TCL_THREADS) +!if !exist("$(TCLSH)") && $(TCL_THREADS) TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe !endif TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib @@ -1225,7 +1225,13 @@ baselibs = $(baselibs) ucrt.lib # 3. Define standard commands, common make targets and implicit rules MAKELIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ -MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) +MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) + +!if $(STATIC_BUILD) +MAKEEXTCMD = $(MAKELIBCMD) +!else +MAKEEXTCMD = $(MAKEDLLCMD) +!endif MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ @@ -1315,9 +1321,9 @@ TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake" !if $(CONFIG_CHECK) !ifdef TCLNMAKECONFIG -!include $(TCLMAKECONFIG) +!include $(TCLNMAKECONFIG) -!if defined(CORE_MACHINE) && $(CORE_MACHINE) != $(MACHINE) +!if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)" !error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)). !endif !if defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC) -- cgit v0.12 From 01201582b7a72ee2efbb6d431ef8f02becd562f1 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sat, 30 Sep 2017 14:11:08 +0000 Subject: Fix initialization of _TCLDIR and use MAKE*CMD macros in makefile.vc Fixed initialization of _TCLDIR when it is not defined by caller when building an extension. _INSTALLDIR is modified AFTER it is used to initialize _TCLDIR. However, nmake expands late so we have to init _TCLDIR relative to the *modified* _INSTALLDIR. --- win/makefile.vc | 22 +++++----------------- win/rules.vc | 16 +++++++++++----- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index a32549b..9bd91f5 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -503,25 +503,15 @@ runshell: setup $(TCLSH) dlls set TCL_LIBRARY=$(ROOT:\=/)/library $(DEBUGGER) $(TCLSH) $(SCRIPT) -setup: - @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) - @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) - !if !$(STATIC_BUILD) $(TCLIMPLIB): $(TCLLIB) !endif $(TCLLIB): $(TCLOBJS) -!if $(STATIC_BUILD) - $(MAKELIBCMD) @<< -$** -<< -!else - $(MAKEDLLCMD) @<< + $(MAKEBINCMD) @<< $** << $(_VC_MANIFEST_EMBED_DLL) -!endif $(TCLSTUBLIB): $(TCLSTUBOBJS) $(MAKELIBCMD) -nodefaultlib $(TCLSTUBOBJS) @@ -536,21 +526,19 @@ $(TCLTEST): $(TCLTESTOBJS) $(TCLSTUBLIB) $(TCLIMPLIB) !if $(STATIC_BUILD) $(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj - $(MAKELIBCMD) $** !else $(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj $(TCLSTUBLIB) - $(MAKEDLLCMD) $** - $(_VC_MANIFEST_EMBED_DLL) !endif + $(MAKEBINCMD) $** + $(_VC_MANIFEST_EMBED_DLL) !if $(STATIC_BUILD) $(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj - $(MAKELIBCMD) $** !else $(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj $(TCLSTUBLIB) - $(MAKEDLLCMD) $** - $(_VC_MANIFEST_EMBED_DLL) !endif + $(MAKEBINCMD) $** + $(_VC_MANIFEST_EMBED_DLL) pkgs: @for /d %d in ($(PKGSDIR)\*) do \ diff --git a/win/rules.vc b/win/rules.vc index 75919d2..f62be5c 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -213,9 +213,11 @@ _TCL_H = $(_TCLDIR)\generic\tcl.h !if exist("$(_INSTALLDIR)\include\tcl.h") # Case 2(c) for extensions with TCLDIR undefined TCLINSTALL = 1 -TCLDIR = $(_INSTALLDIR) -_TCLDIR = $(_INSTALLDIR) -_TCL_H = $(_INSTALLDIR)\include\tcl.h +TCLDIR = $(_INSTALLDIR)\.. +# NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions +# later so the \.. accounts for the /lib +_TCLDIR = $(_INSTALLDIR)\.. +_TCL_H = $(_TCLDIR)\include\tcl.h !elseif exist("..\..\tcl\generic\tcl.h") TCLINSTALL = 0 TCLDIR = ..\..\tcl @@ -1228,9 +1230,9 @@ MAKELIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) !if $(STATIC_BUILD) -MAKEEXTCMD = $(MAKELIBCMD) +MAKEBINCMD = $(MAKELIBCMD) !else -MAKEEXTCMD = $(MAKEDLLCMD) +MAKEBINCMD = $(MAKEDLLCMD) !endif MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) @@ -1249,6 +1251,10 @@ DEFAULT_BUILD_TARGET = all default_target: $(DEFAULT_BUILD_TARGET) +setup: + @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) + @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) + clean: @echo Cleaning $(TMP_DIR)\* ... @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) -- cgit v0.12 From 6881a1a27437cae50d56f12227e9cfe10c7a49f2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 2 Oct 2017 15:22:27 +0000 Subject: 'const'ify all libtommath functions, will appear in next libtommath version. See: pull request [https://github.com/libtom/libtommath/pull/88|88] --- libtommath/bn_fast_mp_invmod.c | 2 +- libtommath/bn_fast_mp_montgomery_reduce.c | 2 +- libtommath/bn_fast_s_mp_mul_digs.c | 2 +- libtommath/bn_fast_s_mp_mul_high_digs.c | 2 +- libtommath/bn_fast_s_mp_sqr.c | 2 +- libtommath/bn_mp_abs.c | 2 +- libtommath/bn_mp_add.c | 2 +- libtommath/bn_mp_add_d.c | 9 +- libtommath/bn_mp_addmod.c | 2 +- libtommath/bn_mp_and.c | 5 +- libtommath/bn_mp_cmp.c | 2 +- libtommath/bn_mp_cmp_d.c | 2 +- libtommath/bn_mp_cmp_mag.c | 2 +- libtommath/bn_mp_cnt_lsb.c | 2 +- libtommath/bn_mp_copy.c | 2 +- libtommath/bn_mp_count_bits.c | 2 +- libtommath/bn_mp_div.c | 4 +- libtommath/bn_mp_div_2.c | 2 +- libtommath/bn_mp_div_2d.c | 2 +- libtommath/bn_mp_div_3.c | 2 +- libtommath/bn_mp_div_d.c | 2 +- libtommath/bn_mp_dr_is_modulus.c | 2 +- libtommath/bn_mp_dr_reduce.c | 2 +- libtommath/bn_mp_dr_setup.c | 2 +- libtommath/bn_mp_export.c | 2 +- libtommath/bn_mp_expt_d.c | 2 +- libtommath/bn_mp_expt_d_ex.c | 2 +- libtommath/bn_mp_exptmod.c | 2 +- libtommath/bn_mp_exptmod_fast.c | 4 +- libtommath/bn_mp_exteuclid.c | 2 +- libtommath/bn_mp_fwrite.c | 2 +- libtommath/bn_mp_gcd.c | 2 +- libtommath/bn_mp_get_int.c | 2 +- libtommath/bn_mp_get_long.c | 2 +- libtommath/bn_mp_get_long_long.c | 2 +- libtommath/bn_mp_init_copy.c | 2 +- libtommath/bn_mp_invmod.c | 2 +- libtommath/bn_mp_invmod_slow.c | 2 +- libtommath/bn_mp_is_square.c | 2 +- libtommath/bn_mp_jacobi.c | 2 +- libtommath/bn_mp_karatsuba_mul.c | 2 +- libtommath/bn_mp_karatsuba_sqr.c | 2 +- libtommath/bn_mp_lcm.c | 2 +- libtommath/bn_mp_mod.c | 2 +- libtommath/bn_mp_mod_2d.c | 2 +- libtommath/bn_mp_mod_d.c | 2 +- libtommath/bn_mp_montgomery_calc_normalization.c | 2 +- libtommath/bn_mp_montgomery_reduce.c | 2 +- libtommath/bn_mp_montgomery_setup.c | 2 +- libtommath/bn_mp_mul.c | 2 +- libtommath/bn_mp_mul_2.c | 2 +- libtommath/bn_mp_mul_2d.c | 2 +- libtommath/bn_mp_mul_d.c | 2 +- libtommath/bn_mp_mulmod.c | 2 +- libtommath/bn_mp_n_root.c | 2 +- libtommath/bn_mp_n_root_ex.c | 19 ++- libtommath/bn_mp_neg.c | 2 +- libtommath/bn_mp_or.c | 5 +- libtommath/bn_mp_prime_fermat.c | 2 +- libtommath/bn_mp_prime_is_divisible.c | 2 +- libtommath/bn_mp_prime_is_prime.c | 2 +- libtommath/bn_mp_prime_miller_rabin.c | 2 +- libtommath/bn_mp_radix_size.c | 2 +- libtommath/bn_mp_reduce.c | 2 +- libtommath/bn_mp_reduce_2k.c | 2 +- libtommath/bn_mp_reduce_2k_l.c | 2 +- libtommath/bn_mp_reduce_2k_setup.c | 2 +- libtommath/bn_mp_reduce_2k_setup_l.c | 2 +- libtommath/bn_mp_reduce_is_2k.c | 2 +- libtommath/bn_mp_reduce_is_2k_l.c | 2 +- libtommath/bn_mp_reduce_setup.c | 2 +- libtommath/bn_mp_signed_bin_size.c | 2 +- libtommath/bn_mp_sqr.c | 2 +- libtommath/bn_mp_sqrmod.c | 2 +- libtommath/bn_mp_sqrt.c | 2 +- libtommath/bn_mp_sqrtmod_prime.c | 2 +- libtommath/bn_mp_sub.c | 2 +- libtommath/bn_mp_sub_d.c | 9 +- libtommath/bn_mp_submod.c | 2 +- libtommath/bn_mp_to_signed_bin.c | 2 +- libtommath/bn_mp_to_signed_bin_n.c | 2 +- libtommath/bn_mp_to_unsigned_bin.c | 2 +- libtommath/bn_mp_to_unsigned_bin_n.c | 2 +- libtommath/bn_mp_toom_mul.c | 2 +- libtommath/bn_mp_toom_sqr.c | 2 +- libtommath/bn_mp_toradix.c | 2 +- libtommath/bn_mp_toradix_n.c | 2 +- libtommath/bn_mp_unsigned_bin_size.c | 2 +- libtommath/bn_mp_xor.c | 5 +- libtommath/bn_s_mp_add.c | 4 +- libtommath/bn_s_mp_exptmod.c | 4 +- libtommath/bn_s_mp_mul_digs.c | 2 +- libtommath/bn_s_mp_mul_high_digs.c | 2 +- libtommath/bn_s_mp_sqr.c | 2 +- libtommath/bn_s_mp_sub.c | 2 +- libtommath/tommath.h | 156 +++++++++++------------ libtommath/tommath_private.h | 34 ++--- 97 files changed, 215 insertions(+), 213 deletions(-) diff --git a/libtommath/bn_fast_mp_invmod.c b/libtommath/bn_fast_mp_invmod.c index 7771136..08389dd 100644 --- a/libtommath/bn_fast_mp_invmod.c +++ b/libtommath/bn_fast_mp_invmod.c @@ -21,7 +21,7 @@ * Based on slow invmod except this is optimized for the case where b is * odd as per HAC Note 14.64 on pp. 610 */ -int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c) +int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c) { mp_int x, y, u, v, B, D; int res, neg; diff --git a/libtommath/bn_fast_mp_montgomery_reduce.c b/libtommath/bn_fast_mp_montgomery_reduce.c index f2c38bf..54d9b0a 100644 --- a/libtommath/bn_fast_mp_montgomery_reduce.c +++ b/libtommath/bn_fast_mp_montgomery_reduce.c @@ -23,7 +23,7 @@ * * Based on Algorithm 14.32 on pp.601 of HAC. */ -int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho) +int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho) { int ix, res, olduse; mp_word W[MP_WARRAY]; diff --git a/libtommath/bn_fast_s_mp_mul_digs.c b/libtommath/bn_fast_s_mp_mul_digs.c index 763dbb1..558d151 100644 --- a/libtommath/bn_fast_s_mp_mul_digs.c +++ b/libtommath/bn_fast_s_mp_mul_digs.c @@ -31,7 +31,7 @@ * Based on Algorithm 14.12 on pp.595 of HAC. * */ -int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) +int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY]; diff --git a/libtommath/bn_fast_s_mp_mul_high_digs.c b/libtommath/bn_fast_s_mp_mul_high_digs.c index 588d80b..8b662ed 100644 --- a/libtommath/bn_fast_s_mp_mul_high_digs.c +++ b/libtommath/bn_fast_s_mp_mul_high_digs.c @@ -24,7 +24,7 @@ * * Based on Algorithm 14.12 on pp.595 of HAC. */ -int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs) +int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY]; diff --git a/libtommath/bn_fast_s_mp_sqr.c b/libtommath/bn_fast_s_mp_sqr.c index ceed82b..161f785 100644 --- a/libtommath/bn_fast_s_mp_sqr.c +++ b/libtommath/bn_fast_s_mp_sqr.c @@ -25,7 +25,7 @@ After that loop you do the squares and add them in. */ -int fast_s_mp_sqr(mp_int *a, mp_int *b) +int fast_s_mp_sqr(const mp_int *a, mp_int *b) { int olduse, res, pa, ix, iz; mp_digit W[MP_WARRAY], *tmpx; diff --git a/libtommath/bn_mp_abs.c b/libtommath/bn_mp_abs.c index d5fc012..9b6bcec 100644 --- a/libtommath/bn_mp_abs.c +++ b/libtommath/bn_mp_abs.c @@ -19,7 +19,7 @@ * * Simple function copies the input and fixes the sign to positive */ -int mp_abs(mp_int *a, mp_int *b) +int mp_abs(const mp_int *a, mp_int *b) { int res; diff --git a/libtommath/bn_mp_add.c b/libtommath/bn_mp_add.c index 4df4c81..d31d5a0 100644 --- a/libtommath/bn_mp_add.c +++ b/libtommath/bn_mp_add.c @@ -16,7 +16,7 @@ */ /* high level addition (handles signs) */ -int mp_add(mp_int *a, mp_int *b, mp_int *c) +int mp_add(const mp_int *a, const mp_int *b, mp_int *c) { int sa, sb, res; diff --git a/libtommath/bn_mp_add_d.c b/libtommath/bn_mp_add_d.c index 1e6ff63..e5ede1f 100644 --- a/libtommath/bn_mp_add_d.c +++ b/libtommath/bn_mp_add_d.c @@ -16,7 +16,7 @@ */ /* single digit addition */ -int mp_add_d(mp_int *a, mp_digit b, mp_int *c) +int mp_add_d(const mp_int *a, mp_digit b, mp_int *c) { int res, ix, oldused; mp_digit *tmpa, *tmpc, mu; @@ -30,14 +30,15 @@ int mp_add_d(mp_int *a, mp_digit b, mp_int *c) /* if a is negative and |a| >= b, call c = |a| - b */ if ((a->sign == MP_NEG) && ((a->used > 1) || (a->dp[0] >= b))) { + mp_int a_ = *a; /* temporarily fix sign of a */ - a->sign = MP_ZPOS; + a_.sign = MP_ZPOS; /* c = |a| - b */ - res = mp_sub_d(a, b, c); + res = mp_sub_d(&a_, b, c); /* fix sign */ - a->sign = c->sign = MP_NEG; + c->sign = MP_NEG; /* clamp */ mp_clamp(c); diff --git a/libtommath/bn_mp_addmod.c b/libtommath/bn_mp_addmod.c index 229a716..0d612c3 100644 --- a/libtommath/bn_mp_addmod.c +++ b/libtommath/bn_mp_addmod.c @@ -16,7 +16,7 @@ */ /* d = a + b (mod c) */ -int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_and.c b/libtommath/bn_mp_and.c index 2f1472a..09ff772 100644 --- a/libtommath/bn_mp_and.c +++ b/libtommath/bn_mp_and.c @@ -16,10 +16,11 @@ */ /* AND two ints together */ -int mp_and(mp_int *a, mp_int *b, mp_int *c) +int mp_and(const mp_int *a, const mp_int *b, mp_int *c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy(&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index 9047060..a33d483 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -16,7 +16,7 @@ */ /* compare two ints (signed)*/ -int mp_cmp(mp_int *a, mp_int *b) +int mp_cmp(const mp_int *a, const mp_int *b) { /* compare based on sign */ if (a->sign != b->sign) { diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c index 27a546d..576a073 100644 --- a/libtommath/bn_mp_cmp_d.c +++ b/libtommath/bn_mp_cmp_d.c @@ -16,7 +16,7 @@ */ /* compare a digit */ -int mp_cmp_d(mp_int *a, mp_digit b) +int mp_cmp_d(const mp_int *a, mp_digit b) { /* compare based on sign */ if (a->sign == MP_NEG) { diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c index ca2bc88..e2c723f 100644 --- a/libtommath/bn_mp_cmp_mag.c +++ b/libtommath/bn_mp_cmp_mag.c @@ -16,7 +16,7 @@ */ /* compare maginitude of two ints (unsigned) */ -int mp_cmp_mag(mp_int *a, mp_int *b) +int mp_cmp_mag(const mp_int *a, const mp_int *b) { int n; mp_digit *tmpa, *tmpb; diff --git a/libtommath/bn_mp_cnt_lsb.c b/libtommath/bn_mp_cnt_lsb.c index 7273655..9a94d3d 100644 --- a/libtommath/bn_mp_cnt_lsb.c +++ b/libtommath/bn_mp_cnt_lsb.c @@ -20,7 +20,7 @@ static const int lnz[16] = { }; /* Counts the number of lsbs which are zero before the first zero bit */ -int mp_cnt_lsb(mp_int *a) +int mp_cnt_lsb(const mp_int *a) { int x; mp_digit q, qq; diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index bed03b2..17816e8 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -16,7 +16,7 @@ */ /* copy, b = a */ -int mp_copy(mp_int *a, mp_int *b) +int mp_copy(const mp_int *a, mp_int *b) { int res, n; diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index dea364f..7424581 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -16,7 +16,7 @@ */ /* returns the number of bits in an int */ -int mp_count_bits(mp_int *a) +int mp_count_bits(const mp_int *a) { int r; mp_digit q; diff --git a/libtommath/bn_mp_div.c b/libtommath/bn_mp_div.c index fdb3453..dbfdc03 100644 --- a/libtommath/bn_mp_div.c +++ b/libtommath/bn_mp_div.c @@ -18,7 +18,7 @@ #ifdef BN_MP_DIV_SMALL /* slower bit-bang division... also smaller */ -int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d) { mp_int ta, tb, tq, q; int res, n, n2; @@ -100,7 +100,7 @@ LBL_ERR: * The overall algorithm is as described as * 14.20 from HAC but fixed to treat these cases. */ -int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d) { mp_int q, x, y, t1, t2; int res, n, t, i, norm, neg; diff --git a/libtommath/bn_mp_div_2.c b/libtommath/bn_mp_div_2.c index b9d5339..edc8982 100644 --- a/libtommath/bn_mp_div_2.c +++ b/libtommath/bn_mp_div_2.c @@ -16,7 +16,7 @@ */ /* b = a/2 */ -int mp_div_2(mp_int *a, mp_int *b) +int mp_div_2(const mp_int *a, mp_int *b) { int x, res, oldused; diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c index d6723ee..eae3498 100644 --- a/libtommath/bn_mp_div_2d.c +++ b/libtommath/bn_mp_div_2d.c @@ -16,7 +16,7 @@ */ /* shift right by a certain bit count (store quotient in c, optional remainder in d) */ -int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d) +int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d) { mp_digit D, r, rr; int x, res; diff --git a/libtommath/bn_mp_div_3.c b/libtommath/bn_mp_div_3.c index c3a023a..9cc8caa 100644 --- a/libtommath/bn_mp_div_3.c +++ b/libtommath/bn_mp_div_3.c @@ -16,7 +16,7 @@ */ /* divide by three (based on routine from MPI and the GMP manual) */ -int mp_div_3(mp_int *a, mp_int *c, mp_digit *d) +int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d) { mp_int q; mp_word w, t; diff --git a/libtommath/bn_mp_div_d.c b/libtommath/bn_mp_div_d.c index 141db1d..db4a0a2 100644 --- a/libtommath/bn_mp_div_d.c +++ b/libtommath/bn_mp_div_d.c @@ -34,7 +34,7 @@ static int s_is_power_of_two(mp_digit b, int *p) } /* single digit division (based on routine from MPI) */ -int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d) +int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d) { mp_int q; mp_word w; diff --git a/libtommath/bn_mp_dr_is_modulus.c b/libtommath/bn_mp_dr_is_modulus.c index 4631daa..bf4ed8b 100644 --- a/libtommath/bn_mp_dr_is_modulus.c +++ b/libtommath/bn_mp_dr_is_modulus.c @@ -16,7 +16,7 @@ */ /* determines if a number is a valid DR modulus */ -int mp_dr_is_modulus(mp_int *a) +int mp_dr_is_modulus(const mp_int *a) { int ix; diff --git a/libtommath/bn_mp_dr_reduce.c b/libtommath/bn_mp_dr_reduce.c index 25079be..1ccb669 100644 --- a/libtommath/bn_mp_dr_reduce.c +++ b/libtommath/bn_mp_dr_reduce.c @@ -29,7 +29,7 @@ * * Input x must be in the range 0 <= x <= (n-1)**2 */ -int mp_dr_reduce(mp_int *x, mp_int *n, mp_digit k) +int mp_dr_reduce(mp_int *x, const mp_int *n, mp_digit k) { int err, i, m; mp_word r; diff --git a/libtommath/bn_mp_dr_setup.c b/libtommath/bn_mp_dr_setup.c index 97f31ba..af0e213 100644 --- a/libtommath/bn_mp_dr_setup.c +++ b/libtommath/bn_mp_dr_setup.c @@ -16,7 +16,7 @@ */ /* determines the setup value */ -void mp_dr_setup(mp_int *a, mp_digit *d) +void mp_dr_setup(const mp_int *a, mp_digit *d) { /* the casts are required if DIGIT_BIT is one less than * the number of bits in a mp_digit [e.g. DIGIT_BIT==31] diff --git a/libtommath/bn_mp_export.c b/libtommath/bn_mp_export.c index b69a4fb..4276f4f 100644 --- a/libtommath/bn_mp_export.c +++ b/libtommath/bn_mp_export.c @@ -19,7 +19,7 @@ * see http://gmplib.org/manual/Integer-Import-and-Export.html */ int mp_export(void *rop, size_t *countp, int order, size_t size, - int endian, size_t nails, mp_int *op) + int endian, size_t nails, const mp_int *op) { int result; size_t odd_nails, nail_bytes, i, j, bits, count; diff --git a/libtommath/bn_mp_expt_d.c b/libtommath/bn_mp_expt_d.c index 38bf679..f5ce3c1 100644 --- a/libtommath/bn_mp_expt_d.c +++ b/libtommath/bn_mp_expt_d.c @@ -16,7 +16,7 @@ */ /* wrapper function for mp_expt_d_ex() */ -int mp_expt_d(mp_int *a, mp_digit b, mp_int *c) +int mp_expt_d(const mp_int *a, mp_digit b, mp_int *c) { return mp_expt_d_ex(a, b, c, 0); } diff --git a/libtommath/bn_mp_expt_d_ex.c b/libtommath/bn_mp_expt_d_ex.c index bece77b..99319a5 100644 --- a/libtommath/bn_mp_expt_d_ex.c +++ b/libtommath/bn_mp_expt_d_ex.c @@ -16,7 +16,7 @@ */ /* calculate c = a**b using a square-multiply algorithm */ -int mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast) +int mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) { int res; unsigned int x; diff --git a/libtommath/bn_mp_exptmod.c b/libtommath/bn_mp_exptmod.c index c4f392b..934fd25 100644 --- a/libtommath/bn_mp_exptmod.c +++ b/libtommath/bn_mp_exptmod.c @@ -21,7 +21,7 @@ * embedded in the normal function but that wasted alot of stack space * for nothing (since 99% of the time the Montgomery code would be called) */ -int mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y) +int mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y) { int dr; diff --git a/libtommath/bn_mp_exptmod_fast.c b/libtommath/bn_mp_exptmod_fast.c index 38e0265..4a188d0 100644 --- a/libtommath/bn_mp_exptmod_fast.c +++ b/libtommath/bn_mp_exptmod_fast.c @@ -29,7 +29,7 @@ # define TAB_SIZE 256 #endif -int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) +int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) { mp_int M[TAB_SIZE], res; mp_digit buf, mp; @@ -39,7 +39,7 @@ int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) * one of many reduction algorithms without modding the guts of * the code with if statements everywhere. */ - int (*redux)(mp_int *,mp_int *,mp_digit); + int (*redux)(mp_int *,const mp_int *,mp_digit); /* find window size */ x = mp_count_bits(X); diff --git a/libtommath/bn_mp_exteuclid.c b/libtommath/bn_mp_exteuclid.c index 98eef76..08e5ff2 100644 --- a/libtommath/bn_mp_exteuclid.c +++ b/libtommath/bn_mp_exteuclid.c @@ -18,7 +18,7 @@ /* Extended euclidean algorithm of (a, b) produces a*u1 + b*u2 = u3 */ -int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) +int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) { mp_int u1, u2, u3, v1, v2, v3, t1, t2, t3, q, tmp; int err; diff --git a/libtommath/bn_mp_fwrite.c b/libtommath/bn_mp_fwrite.c index 3641823..829dd4a 100644 --- a/libtommath/bn_mp_fwrite.c +++ b/libtommath/bn_mp_fwrite.c @@ -16,7 +16,7 @@ */ #ifndef LTM_NO_FILE -int mp_fwrite(mp_int *a, int radix, FILE *stream) +int mp_fwrite(const mp_int *a, int radix, FILE *stream) { char *buf; int err, len, x; diff --git a/libtommath/bn_mp_gcd.c b/libtommath/bn_mp_gcd.c index 18f6dc3..f5aa78b 100644 --- a/libtommath/bn_mp_gcd.c +++ b/libtommath/bn_mp_gcd.c @@ -16,7 +16,7 @@ */ /* Greatest Common Divisor using the binary method */ -int mp_gcd(mp_int *a, mp_int *b, mp_int *c) +int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c) { mp_int u, v; int k, u_lsb, v_lsb, res; diff --git a/libtommath/bn_mp_get_int.c b/libtommath/bn_mp_get_int.c index a3d1602..f4a347f 100644 --- a/libtommath/bn_mp_get_int.c +++ b/libtommath/bn_mp_get_int.c @@ -16,7 +16,7 @@ */ /* get the lower 32-bits of an mp_int */ -unsigned long mp_get_int(mp_int *a) +unsigned long mp_get_int(const mp_int *a) { int i; mp_min_u32 res; diff --git a/libtommath/bn_mp_get_long.c b/libtommath/bn_mp_get_long.c index 053930c..3fc7c35 100644 --- a/libtommath/bn_mp_get_long.c +++ b/libtommath/bn_mp_get_long.c @@ -16,7 +16,7 @@ */ /* get the lower unsigned long of an mp_int, platform dependent */ -unsigned long mp_get_long(mp_int *a) +unsigned long mp_get_long(const mp_int *a) { int i; unsigned long res; diff --git a/libtommath/bn_mp_get_long_long.c b/libtommath/bn_mp_get_long_long.c index 131571a..838c3c3 100644 --- a/libtommath/bn_mp_get_long_long.c +++ b/libtommath/bn_mp_get_long_long.c @@ -16,7 +16,7 @@ */ /* get the lower unsigned long long of an mp_int, platform dependent */ -unsigned long long mp_get_long_long(mp_int *a) +unsigned long long mp_get_long_long(const mp_int *a) { int i; unsigned long long res; diff --git a/libtommath/bn_mp_init_copy.c b/libtommath/bn_mp_init_copy.c index c711e06..5681015 100644 --- a/libtommath/bn_mp_init_copy.c +++ b/libtommath/bn_mp_init_copy.c @@ -16,7 +16,7 @@ */ /* creates "a" then copies b into it */ -int mp_init_copy(mp_int *a, mp_int *b) +int mp_init_copy(mp_int *a, const mp_int *b) { int res; diff --git a/libtommath/bn_mp_invmod.c b/libtommath/bn_mp_invmod.c index b70fe18..525493a 100644 --- a/libtommath/bn_mp_invmod.c +++ b/libtommath/bn_mp_invmod.c @@ -16,7 +16,7 @@ */ /* hac 14.61, pp608 */ -int mp_invmod(mp_int *a, mp_int *b, mp_int *c) +int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c) { /* b cannot be negative */ if ((b->sign == MP_NEG) || (mp_iszero(b) == MP_YES)) { diff --git a/libtommath/bn_mp_invmod_slow.c b/libtommath/bn_mp_invmod_slow.c index 2bdd2b1..2bb5196 100644 --- a/libtommath/bn_mp_invmod_slow.c +++ b/libtommath/bn_mp_invmod_slow.c @@ -16,7 +16,7 @@ */ /* hac 14.61, pp608 */ -int mp_invmod_slow(mp_int *a, mp_int *b, mp_int *c) +int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c) { mp_int x, y, u, v, A, B, C, D; int res; diff --git a/libtommath/bn_mp_is_square.c b/libtommath/bn_mp_is_square.c index 303fab6..dd5150e 100644 --- a/libtommath/bn_mp_is_square.c +++ b/libtommath/bn_mp_is_square.c @@ -38,7 +38,7 @@ static const char rem_105[105] = { }; /* Store non-zero to ret if arg is square, and zero if not */ -int mp_is_square(mp_int *arg, int *ret) +int mp_is_square(const mp_int *arg, int *ret) { int res; mp_digit c; diff --git a/libtommath/bn_mp_jacobi.c b/libtommath/bn_mp_jacobi.c index 8981393..c314c82 100644 --- a/libtommath/bn_mp_jacobi.c +++ b/libtommath/bn_mp_jacobi.c @@ -20,7 +20,7 @@ * HAC is wrong here, as the special case of (0 | 1) is not * handled correctly. */ -int mp_jacobi(mp_int *a, mp_int *n, int *c) +int mp_jacobi(const mp_int *a, const mp_int *n, int *c) { mp_int a1, p1; int k, s, r, res; diff --git a/libtommath/bn_mp_karatsuba_mul.c b/libtommath/bn_mp_karatsuba_mul.c index 353c37c..1a84211 100644 --- a/libtommath/bn_mp_karatsuba_mul.c +++ b/libtommath/bn_mp_karatsuba_mul.c @@ -44,7 +44,7 @@ * Generally though the overhead of this method doesn't pay off * until a certain size (N ~ 80) is reached. */ -int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c) +int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c) { mp_int x0, x1, y0, y1, t1, x0y0, x1y1; int B, err; diff --git a/libtommath/bn_mp_karatsuba_sqr.c b/libtommath/bn_mp_karatsuba_sqr.c index fe39a33..c566b06 100644 --- a/libtommath/bn_mp_karatsuba_sqr.c +++ b/libtommath/bn_mp_karatsuba_sqr.c @@ -22,7 +22,7 @@ * is essentially the same algorithm but merely * tuned to perform recursive squarings. */ -int mp_karatsuba_sqr(mp_int *a, mp_int *b) +int mp_karatsuba_sqr(const mp_int *a, mp_int *b) { mp_int x0, x1, t1, t2, x0x0, x1x1; int B, err; diff --git a/libtommath/bn_mp_lcm.c b/libtommath/bn_mp_lcm.c index dc661f3..24b621c 100644 --- a/libtommath/bn_mp_lcm.c +++ b/libtommath/bn_mp_lcm.c @@ -16,7 +16,7 @@ */ /* computes least common multiple as |a*b|/(a, b) */ -int mp_lcm(mp_int *a, mp_int *b, mp_int *c) +int mp_lcm(const mp_int *a, const mp_int *b, mp_int *c) { int res; mp_int t1, t2; diff --git a/libtommath/bn_mp_mod.c b/libtommath/bn_mp_mod.c index 267688c..64e73ea 100644 --- a/libtommath/bn_mp_mod.c +++ b/libtommath/bn_mp_mod.c @@ -16,7 +16,7 @@ */ /* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */ -int mp_mod(mp_int *a, mp_int *b, mp_int *c) +int mp_mod(const mp_int *a, const mp_int *b, mp_int *c) { mp_int t; int res; diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 59270b9..8e69757 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -16,7 +16,7 @@ */ /* calc a value mod 2**b */ -int mp_mod_2d(mp_int *a, int b, mp_int *c) +int mp_mod_2d(const mp_int *a, int b, mp_int *c) { int x, res; diff --git a/libtommath/bn_mp_mod_d.c b/libtommath/bn_mp_mod_d.c index ff77346..9a24e78 100644 --- a/libtommath/bn_mp_mod_d.c +++ b/libtommath/bn_mp_mod_d.c @@ -15,7 +15,7 @@ * Tom St Denis, tstdenis82@gmail.com, http://libtom.org */ -int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c) +int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c) { return mp_div_d(a, b, NULL, c); } diff --git a/libtommath/bn_mp_montgomery_calc_normalization.c b/libtommath/bn_mp_montgomery_calc_normalization.c index 2d95140..f2b0856 100644 --- a/libtommath/bn_mp_montgomery_calc_normalization.c +++ b/libtommath/bn_mp_montgomery_calc_normalization.c @@ -21,7 +21,7 @@ * The method is slightly modified to shift B unconditionally upto just under * the leading bit of b. This saves alot of multiple precision shifting. */ -int mp_montgomery_calc_normalization(mp_int *a, mp_int *b) +int mp_montgomery_calc_normalization(mp_int *a, const mp_int *b) { int x, bits, res; diff --git a/libtommath/bn_mp_montgomery_reduce.c b/libtommath/bn_mp_montgomery_reduce.c index 1909997..a38173e 100644 --- a/libtommath/bn_mp_montgomery_reduce.c +++ b/libtommath/bn_mp_montgomery_reduce.c @@ -16,7 +16,7 @@ */ /* computes xR**-1 == x (mod N) via Montgomery Reduction */ -int mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho) +int mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho) { int ix, res, digs; mp_digit mu; diff --git a/libtommath/bn_mp_montgomery_setup.c b/libtommath/bn_mp_montgomery_setup.c index 46f560d..685ba51 100644 --- a/libtommath/bn_mp_montgomery_setup.c +++ b/libtommath/bn_mp_montgomery_setup.c @@ -16,7 +16,7 @@ */ /* setups the montgomery reduction stuff */ -int mp_montgomery_setup(mp_int *n, mp_digit *rho) +int mp_montgomery_setup(const mp_int *n, mp_digit *rho) { mp_digit x, b; diff --git a/libtommath/bn_mp_mul.c b/libtommath/bn_mp_mul.c index 315a520..71d523d 100644 --- a/libtommath/bn_mp_mul.c +++ b/libtommath/bn_mp_mul.c @@ -16,7 +16,7 @@ */ /* high level multiplication (handles sign) */ -int mp_mul(mp_int *a, mp_int *b, mp_int *c) +int mp_mul(const mp_int *a, const mp_int *b, mp_int *c) { int res, neg; neg = (a->sign == b->sign) ? MP_ZPOS : MP_NEG; diff --git a/libtommath/bn_mp_mul_2.c b/libtommath/bn_mp_mul_2.c index 33bdc4c..1744681 100644 --- a/libtommath/bn_mp_mul_2.c +++ b/libtommath/bn_mp_mul_2.c @@ -16,7 +16,7 @@ */ /* b = a*2 */ -int mp_mul_2(mp_int *a, mp_int *b) +int mp_mul_2(const mp_int *a, mp_int *b) { int x, res, oldused; diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c index b3d92a9..4938e57 100644 --- a/libtommath/bn_mp_mul_2d.c +++ b/libtommath/bn_mp_mul_2d.c @@ -16,7 +16,7 @@ */ /* shift left by a certain bit count */ -int mp_mul_2d(mp_int *a, int b, mp_int *c) +int mp_mul_2d(const mp_int *a, int b, mp_int *c) { mp_digit d; int res; diff --git a/libtommath/bn_mp_mul_d.c b/libtommath/bn_mp_mul_d.c index 1aa448c..0f6d03e 100644 --- a/libtommath/bn_mp_mul_d.c +++ b/libtommath/bn_mp_mul_d.c @@ -16,7 +16,7 @@ */ /* multiply by a digit */ -int mp_mul_d(mp_int *a, mp_digit b, mp_int *c) +int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c) { mp_digit u, *tmpa, *tmpc; mp_word r; diff --git a/libtommath/bn_mp_mulmod.c b/libtommath/bn_mp_mulmod.c index b1e6a33..aeee4ee 100644 --- a/libtommath/bn_mp_mulmod.c +++ b/libtommath/bn_mp_mulmod.c @@ -16,7 +16,7 @@ */ /* d = a * b (mod c) */ -int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +int mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_n_root.c b/libtommath/bn_mp_n_root.c index 8211c0a..a09804f 100644 --- a/libtommath/bn_mp_n_root.c +++ b/libtommath/bn_mp_n_root.c @@ -18,7 +18,7 @@ /* wrapper function for mp_n_root_ex() * computes c = (a)**(1/b) such that (c)**b <= a and (c+1)**b > a */ -int mp_n_root(mp_int *a, mp_digit b, mp_int *c) +int mp_n_root(const mp_int *a, mp_digit b, mp_int *c) { return mp_n_root_ex(a, b, c, 0); } diff --git a/libtommath/bn_mp_n_root_ex.c b/libtommath/bn_mp_n_root_ex.c index 9546745..ca50649 100644 --- a/libtommath/bn_mp_n_root_ex.c +++ b/libtommath/bn_mp_n_root_ex.c @@ -25,10 +25,10 @@ * each step involves a fair bit. This is not meant to * find huge roots [square and cube, etc]. */ -int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) +int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) { - mp_int t1, t2, t3; - int res, neg; + mp_int t1, t2, t3, a_; + int res; /* input must be positive if b is even */ if (((b & 1) == 0) && (a->sign == MP_NEG)) { @@ -48,8 +48,8 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } /* if a is negative fudge the sign but keep track */ - neg = a->sign; - a->sign = MP_ZPOS; + a_ = *a; + a_.sign = MP_ZPOS; /* t2 = 2 */ mp_set(&t2, 2); @@ -74,7 +74,7 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } /* t2 = t1**b - a */ - if ((res = mp_sub(&t2, a, &t2)) != MP_OKAY) { + if ((res = mp_sub(&t2, &a_, &t2)) != MP_OKAY) { goto LBL_T3; } @@ -100,7 +100,7 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) goto LBL_T3; } - if (mp_cmp(&t2, a) == MP_GT) { + if (mp_cmp(&t2, &a_) == MP_GT) { if ((res = mp_sub_d(&t1, 1, &t1)) != MP_OKAY) { goto LBL_T3; } @@ -109,14 +109,11 @@ int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast) } } - /* reset the sign of a first */ - a->sign = neg; - /* set the result */ mp_exch(&t1, c); /* set the sign of the result */ - c->sign = neg; + c->sign = a->sign; res = MP_OKAY; diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c index b30d044..75f8bbd 100644 --- a/libtommath/bn_mp_neg.c +++ b/libtommath/bn_mp_neg.c @@ -16,7 +16,7 @@ */ /* b = -a */ -int mp_neg(mp_int *a, mp_int *b) +int mp_neg(const mp_int *a, mp_int *b) { int res; if (a != b) { diff --git a/libtommath/bn_mp_or.c b/libtommath/bn_mp_or.c index 2318c79..f411509 100644 --- a/libtommath/bn_mp_or.c +++ b/libtommath/bn_mp_or.c @@ -16,10 +16,11 @@ */ /* OR two ints together */ -int mp_or(mp_int *a, mp_int *b, mp_int *c) +int mp_or(const mp_int *a, const mp_int *b, mp_int *c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy(&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_mp_prime_fermat.c b/libtommath/bn_mp_prime_fermat.c index 37ad6ec..9c15435 100644 --- a/libtommath/bn_mp_prime_fermat.c +++ b/libtommath/bn_mp_prime_fermat.c @@ -23,7 +23,7 @@ * * Sets result to 1 if the congruence holds, or zero otherwise. */ -int mp_prime_fermat(mp_int *a, mp_int *b, int *result) +int mp_prime_fermat(const mp_int *a, const mp_int *b, int *result) { mp_int t; int err; diff --git a/libtommath/bn_mp_prime_is_divisible.c b/libtommath/bn_mp_prime_is_divisible.c index 92af330..c1e1158 100644 --- a/libtommath/bn_mp_prime_is_divisible.c +++ b/libtommath/bn_mp_prime_is_divisible.c @@ -20,7 +20,7 @@ * * sets result to 0 if not, 1 if yes */ -int mp_prime_is_divisible(mp_int *a, int *result) +int mp_prime_is_divisible(const mp_int *a, int *result) { int err, ix; mp_digit res; diff --git a/libtommath/bn_mp_prime_is_prime.c b/libtommath/bn_mp_prime_is_prime.c index 20a7d1f..e97712d 100644 --- a/libtommath/bn_mp_prime_is_prime.c +++ b/libtommath/bn_mp_prime_is_prime.c @@ -22,7 +22,7 @@ * * Sets result to 1 if probably prime, 0 otherwise */ -int mp_prime_is_prime(mp_int *a, int t, int *result) +int mp_prime_is_prime(const mp_int *a, int t, int *result) { mp_int b; int ix, err, res; diff --git a/libtommath/bn_mp_prime_miller_rabin.c b/libtommath/bn_mp_prime_miller_rabin.c index 917dc01..5de5f05 100644 --- a/libtommath/bn_mp_prime_miller_rabin.c +++ b/libtommath/bn_mp_prime_miller_rabin.c @@ -22,7 +22,7 @@ * Randomly the chance of error is no more than 1/4 and often * very much lower. */ -int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result) +int mp_prime_miller_rabin(const mp_int *a, const mp_int *b, int *result) { mp_int n1, y, r; int s, j, err; diff --git a/libtommath/bn_mp_radix_size.c b/libtommath/bn_mp_radix_size.c index a6e2f04..29355cb 100644 --- a/libtommath/bn_mp_radix_size.c +++ b/libtommath/bn_mp_radix_size.c @@ -16,7 +16,7 @@ */ /* returns size of ASCII reprensentation */ -int mp_radix_size(mp_int *a, int radix, int *size) +int mp_radix_size(const mp_int *a, int radix, int *size) { int res, digs; mp_int t; diff --git a/libtommath/bn_mp_reduce.c b/libtommath/bn_mp_reduce.c index a2b9bf7..bbc521f 100644 --- a/libtommath/bn_mp_reduce.c +++ b/libtommath/bn_mp_reduce.c @@ -19,7 +19,7 @@ * precomputed via mp_reduce_setup. * From HAC pp.604 Algorithm 14.42 */ -int mp_reduce(mp_int *x, mp_int *m, mp_int *mu) +int mp_reduce(mp_int *x, const mp_int *m, const mp_int *mu) { mp_int q; int res, um = m->used; diff --git a/libtommath/bn_mp_reduce_2k.c b/libtommath/bn_mp_reduce_2k.c index 6bc96d1..2922cad 100644 --- a/libtommath/bn_mp_reduce_2k.c +++ b/libtommath/bn_mp_reduce_2k.c @@ -16,7 +16,7 @@ */ /* reduces a modulo n where n is of the form 2**p - d */ -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d) +int mp_reduce_2k(mp_int *a, const mp_int *n, mp_digit d) { mp_int q; int p, res; diff --git a/libtommath/bn_mp_reduce_2k_l.c b/libtommath/bn_mp_reduce_2k_l.c index 8e6eeb0..23381bf 100644 --- a/libtommath/bn_mp_reduce_2k_l.c +++ b/libtommath/bn_mp_reduce_2k_l.c @@ -19,7 +19,7 @@ This differs from reduce_2k since "d" can be larger than a single digit. */ -int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d) +int mp_reduce_2k_l(mp_int *a, const mp_int *n, const mp_int *d) { mp_int q; int p, res; diff --git a/libtommath/bn_mp_reduce_2k_setup.c b/libtommath/bn_mp_reduce_2k_setup.c index 802a5ba..e6ae839 100644 --- a/libtommath/bn_mp_reduce_2k_setup.c +++ b/libtommath/bn_mp_reduce_2k_setup.c @@ -16,7 +16,7 @@ */ /* determines the setup value */ -int mp_reduce_2k_setup(mp_int *a, mp_digit *d) +int mp_reduce_2k_setup(const mp_int *a, mp_digit *d) { int res, p; mp_int tmp; diff --git a/libtommath/bn_mp_reduce_2k_setup_l.c b/libtommath/bn_mp_reduce_2k_setup_l.c index 34367ed..af81b5b 100644 --- a/libtommath/bn_mp_reduce_2k_setup_l.c +++ b/libtommath/bn_mp_reduce_2k_setup_l.c @@ -16,7 +16,7 @@ */ /* determines the setup value */ -int mp_reduce_2k_setup_l(mp_int *a, mp_int *d) +int mp_reduce_2k_setup_l(const mp_int *a, mp_int *d) { int res; mp_int tmp; diff --git a/libtommath/bn_mp_reduce_is_2k.c b/libtommath/bn_mp_reduce_is_2k.c index c733ca9..932521e 100644 --- a/libtommath/bn_mp_reduce_is_2k.c +++ b/libtommath/bn_mp_reduce_is_2k.c @@ -16,7 +16,7 @@ */ /* determines if mp_reduce_2k can be used */ -int mp_reduce_is_2k(mp_int *a) +int mp_reduce_is_2k(const mp_int *a) { int ix, iy, iw; mp_digit iz; diff --git a/libtommath/bn_mp_reduce_is_2k_l.c b/libtommath/bn_mp_reduce_is_2k_l.c index d4804d5..22c7582 100644 --- a/libtommath/bn_mp_reduce_is_2k_l.c +++ b/libtommath/bn_mp_reduce_is_2k_l.c @@ -16,7 +16,7 @@ */ /* determines if reduce_2k_l can be used */ -int mp_reduce_is_2k_l(mp_int *a) +int mp_reduce_is_2k_l(const mp_int *a) { int ix, iy; diff --git a/libtommath/bn_mp_reduce_setup.c b/libtommath/bn_mp_reduce_setup.c index 00ff61c..70e193a 100644 --- a/libtommath/bn_mp_reduce_setup.c +++ b/libtommath/bn_mp_reduce_setup.c @@ -18,7 +18,7 @@ /* pre-calculate the value required for Barrett reduction * For a given modulus "b" it calulates the value required in "a" */ -int mp_reduce_setup(mp_int *a, mp_int *b) +int mp_reduce_setup(mp_int *a, const mp_int *b) { int res; diff --git a/libtommath/bn_mp_signed_bin_size.c b/libtommath/bn_mp_signed_bin_size.c index 082aeca..1fdfd85 100644 --- a/libtommath/bn_mp_signed_bin_size.c +++ b/libtommath/bn_mp_signed_bin_size.c @@ -16,7 +16,7 @@ */ /* get the size for an signed equivalent */ -int mp_signed_bin_size(mp_int *a) +int mp_signed_bin_size(const mp_int *a) { return 1 + mp_unsigned_bin_size(a); } diff --git a/libtommath/bn_mp_sqr.c b/libtommath/bn_mp_sqr.c index e2e8641..2b71097 100644 --- a/libtommath/bn_mp_sqr.c +++ b/libtommath/bn_mp_sqr.c @@ -16,7 +16,7 @@ */ /* computes b = a*a */ -int mp_sqr(mp_int *a, mp_int *b) +int mp_sqr(const mp_int *a, mp_int *b) { int res; diff --git a/libtommath/bn_mp_sqrmod.c b/libtommath/bn_mp_sqrmod.c index 96a7574..c3c7ec9 100644 --- a/libtommath/bn_mp_sqrmod.c +++ b/libtommath/bn_mp_sqrmod.c @@ -16,7 +16,7 @@ */ /* c = a * a (mod b) */ -int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c) +int mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c) { int res; mp_int t; diff --git a/libtommath/bn_mp_sqrt.c b/libtommath/bn_mp_sqrt.c index 95a6892..d70c523 100644 --- a/libtommath/bn_mp_sqrt.c +++ b/libtommath/bn_mp_sqrt.c @@ -16,7 +16,7 @@ */ /* this function is less generic than mp_n_root, simpler and faster */ -int mp_sqrt(mp_int *arg, mp_int *ret) +int mp_sqrt(const mp_int *arg, mp_int *ret) { int res; mp_int t1, t2; diff --git a/libtommath/bn_mp_sqrtmod_prime.c b/libtommath/bn_mp_sqrtmod_prime.c index 12b427c..261723e 100644 --- a/libtommath/bn_mp_sqrtmod_prime.c +++ b/libtommath/bn_mp_sqrtmod_prime.c @@ -15,7 +15,7 @@ * */ -int mp_sqrtmod_prime(mp_int *n, mp_int *prime, mp_int *ret) +int mp_sqrtmod_prime(const mp_int *n, const mp_int *prime, mp_int *ret) { int res, legendre; mp_int t1, C, Q, S, Z, M, T, R, two; diff --git a/libtommath/bn_mp_sub.c b/libtommath/bn_mp_sub.c index 75c7c2d..19cb65e 100644 --- a/libtommath/bn_mp_sub.c +++ b/libtommath/bn_mp_sub.c @@ -16,7 +16,7 @@ */ /* high level subtraction (handles signs) */ -int mp_sub(mp_int *a, mp_int *b, mp_int *c) +int mp_sub(const mp_int *a, const mp_int *b, mp_int *c) { int sa, sb, res; diff --git a/libtommath/bn_mp_sub_d.c b/libtommath/bn_mp_sub_d.c index 7016abc..4d66a90 100644 --- a/libtommath/bn_mp_sub_d.c +++ b/libtommath/bn_mp_sub_d.c @@ -16,7 +16,7 @@ */ /* single digit subtraction */ -int mp_sub_d(mp_int *a, mp_digit b, mp_int *c) +int mp_sub_d(const mp_int *a, mp_digit b, mp_int *c) { mp_digit *tmpa, *tmpc, mu; int res, ix, oldused; @@ -32,9 +32,10 @@ int mp_sub_d(mp_int *a, mp_digit b, mp_int *c) * addition [with fudged signs] */ if (a->sign == MP_NEG) { - a->sign = MP_ZPOS; - res = mp_add_d(a, b, c); - a->sign = c->sign = MP_NEG; + mp_int a_ = *a; + a_.sign = MP_ZPOS; + res = mp_add_d(&a_, b, c); + c->sign = MP_NEG; /* clamp */ mp_clamp(c); diff --git a/libtommath/bn_mp_submod.c b/libtommath/bn_mp_submod.c index 510fb19..c4db397 100644 --- a/libtommath/bn_mp_submod.c +++ b/libtommath/bn_mp_submod.c @@ -16,7 +16,7 @@ */ /* d = a - b (mod c) */ -int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d) +int mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d) { int res; mp_int t; diff --git a/libtommath/bn_mp_to_signed_bin.c b/libtommath/bn_mp_to_signed_bin.c index 615bf32..4d4be88 100644 --- a/libtommath/bn_mp_to_signed_bin.c +++ b/libtommath/bn_mp_to_signed_bin.c @@ -16,7 +16,7 @@ */ /* store in signed [big endian] format */ -int mp_to_signed_bin(mp_int *a, unsigned char *b) +int mp_to_signed_bin(const mp_int *a, unsigned char *b) { int res; diff --git a/libtommath/bn_mp_to_signed_bin_n.c b/libtommath/bn_mp_to_signed_bin_n.c index 501f849..1447624 100644 --- a/libtommath/bn_mp_to_signed_bin_n.c +++ b/libtommath/bn_mp_to_signed_bin_n.c @@ -16,7 +16,7 @@ */ /* store in signed [big endian] format */ -int mp_to_signed_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen) +int mp_to_signed_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen) { if (*outlen < (unsigned long)mp_signed_bin_size(a)) { return MP_VAL; diff --git a/libtommath/bn_mp_to_unsigned_bin.c b/libtommath/bn_mp_to_unsigned_bin.c index e103383..9339cce 100644 --- a/libtommath/bn_mp_to_unsigned_bin.c +++ b/libtommath/bn_mp_to_unsigned_bin.c @@ -16,7 +16,7 @@ */ /* store in unsigned [big endian] format */ -int mp_to_unsigned_bin(mp_int *a, unsigned char *b) +int mp_to_unsigned_bin(const mp_int *a, unsigned char *b) { int x, res; mp_int t; diff --git a/libtommath/bn_mp_to_unsigned_bin_n.c b/libtommath/bn_mp_to_unsigned_bin_n.c index 5ee28f1..707dc82 100644 --- a/libtommath/bn_mp_to_unsigned_bin_n.c +++ b/libtommath/bn_mp_to_unsigned_bin_n.c @@ -16,7 +16,7 @@ */ /* store in unsigned [big endian] format */ -int mp_to_unsigned_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen) +int mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen) { if (*outlen < (unsigned long)mp_unsigned_bin_size(a)) { return MP_VAL; diff --git a/libtommath/bn_mp_toom_mul.c b/libtommath/bn_mp_toom_mul.c index 8b771bc..3554ea8 100644 --- a/libtommath/bn_mp_toom_mul.c +++ b/libtommath/bn_mp_toom_mul.c @@ -22,7 +22,7 @@ * only particularly useful on VERY large inputs * (we're talking 1000s of digits here...). */ -int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c) +int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c) { mp_int w0, w1, w2, w3, w4, tmp1, tmp2, a0, a1, a2, b0, b1, b2; int res, B; diff --git a/libtommath/bn_mp_toom_sqr.c b/libtommath/bn_mp_toom_sqr.c index 5e1e452..b985435 100644 --- a/libtommath/bn_mp_toom_sqr.c +++ b/libtommath/bn_mp_toom_sqr.c @@ -16,7 +16,7 @@ */ /* squaring using Toom-Cook 3-way algorithm */ -int mp_toom_sqr(mp_int *a, mp_int *b) +int mp_toom_sqr(const mp_int *a, mp_int *b) { mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; int res, B; diff --git a/libtommath/bn_mp_toradix.c b/libtommath/bn_mp_toradix.c index 5016219..7dd6e4f 100644 --- a/libtommath/bn_mp_toradix.c +++ b/libtommath/bn_mp_toradix.c @@ -16,7 +16,7 @@ */ /* stores a bignum as a ASCII string in a given radix (2..64) */ -int mp_toradix(mp_int *a, char *str, int radix) +int mp_toradix(const mp_int *a, char *str, int radix) { int res, digs; mp_int t; diff --git a/libtommath/bn_mp_toradix_n.c b/libtommath/bn_mp_toradix_n.c index 287d3f8..ef885fc 100644 --- a/libtommath/bn_mp_toradix_n.c +++ b/libtommath/bn_mp_toradix_n.c @@ -19,7 +19,7 @@ * * Stores upto maxlen-1 chars and always a NULL byte */ -int mp_toradix_n(mp_int *a, char *str, int radix, int maxlen) +int mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen) { int res, digs; mp_int t; diff --git a/libtommath/bn_mp_unsigned_bin_size.c b/libtommath/bn_mp_unsigned_bin_size.c index 174cdc1..04107fe 100644 --- a/libtommath/bn_mp_unsigned_bin_size.c +++ b/libtommath/bn_mp_unsigned_bin_size.c @@ -16,7 +16,7 @@ */ /* get the size for an unsigned equivalent */ -int mp_unsigned_bin_size(mp_int *a) +int mp_unsigned_bin_size(const mp_int *a) { int size = mp_count_bits(a); return (size / 8) + (((size & 7) != 0) ? 1 : 0); diff --git a/libtommath/bn_mp_xor.c b/libtommath/bn_mp_xor.c index 4224a7f..9ebc53a 100644 --- a/libtommath/bn_mp_xor.c +++ b/libtommath/bn_mp_xor.c @@ -16,10 +16,11 @@ */ /* XOR two ints together */ -int mp_xor(mp_int *a, mp_int *b, mp_int *c) +int mp_xor(const mp_int *a, const mp_int *b, mp_int *c) { int res, ix, px; - mp_int t, *x; + mp_int t; + const mp_int *x; if (a->used > b->used) { if ((res = mp_init_copy(&t, a)) != MP_OKAY) { diff --git a/libtommath/bn_s_mp_add.c b/libtommath/bn_s_mp_add.c index 6ba65da..2046722 100644 --- a/libtommath/bn_s_mp_add.c +++ b/libtommath/bn_s_mp_add.c @@ -16,9 +16,9 @@ */ /* low level addition, based on HAC pp.594, Algorithm 14.7 */ -int s_mp_add(mp_int *a, mp_int *b, mp_int *c) +int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c) { - mp_int *x; + const mp_int *x; int olduse, res, min, max; /* find sizes, we let |a| <= |b| which means we have to sort diff --git a/libtommath/bn_s_mp_exptmod.c b/libtommath/bn_s_mp_exptmod.c index f8e6b3b..a886361 100644 --- a/libtommath/bn_s_mp_exptmod.c +++ b/libtommath/bn_s_mp_exptmod.c @@ -20,12 +20,12 @@ # define TAB_SIZE 256 #endif -int s_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode) +int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode) { mp_int M[TAB_SIZE], res, mu; mp_digit buf; int err, bitbuf, bitcpy, bitcnt, mode, digidx, x, y, winsize; - int (*redux)(mp_int *,mp_int *,mp_int *); + int (*redux)(mp_int *, const mp_int *, const mp_int *); /* find window size */ x = mp_count_bits(X); diff --git a/libtommath/bn_s_mp_mul_digs.c b/libtommath/bn_s_mp_mul_digs.c index c72c2a8..af13a02 100644 --- a/libtommath/bn_s_mp_mul_digs.c +++ b/libtommath/bn_s_mp_mul_digs.c @@ -19,7 +19,7 @@ * HAC pp. 595, Algorithm 14.12 Modified so you can control how * many digits of output are created. */ -int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs) +int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { mp_int t; int res, pa, pb, ix, iy; diff --git a/libtommath/bn_s_mp_mul_high_digs.c b/libtommath/bn_s_mp_mul_high_digs.c index 0e12f3b..37c108e 100644 --- a/libtommath/bn_s_mp_mul_high_digs.c +++ b/libtommath/bn_s_mp_mul_high_digs.c @@ -18,7 +18,7 @@ /* multiplies |a| * |b| and does not compute the lower digs digits * [meant to get the higher part of the product] */ -int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs) +int s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) { mp_int t; int res, pa, pb, ix, iy; diff --git a/libtommath/bn_s_mp_sqr.c b/libtommath/bn_s_mp_sqr.c index 2910f24..aae06eb 100644 --- a/libtommath/bn_s_mp_sqr.c +++ b/libtommath/bn_s_mp_sqr.c @@ -16,7 +16,7 @@ */ /* low level squaring, b = a*a, HAC pp.596-597, Algorithm 14.16 */ -int s_mp_sqr(mp_int *a, mp_int *b) +int s_mp_sqr(const mp_int *a, mp_int *b) { mp_int t; int res, ix, iy, pa; diff --git a/libtommath/bn_s_mp_sub.c b/libtommath/bn_s_mp_sub.c index f61aa83..52b8096 100644 --- a/libtommath/bn_s_mp_sub.c +++ b/libtommath/bn_s_mp_sub.c @@ -16,7 +16,7 @@ */ /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ -int s_mp_sub(mp_int *a, mp_int *b, mp_int *c) +int s_mp_sub(const mp_int *a, const mp_int *b, mp_int *c) { int olduse, res, min, max; diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 2aaea5b..591076e 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -223,13 +223,13 @@ int mp_set_long(mp_int *a, unsigned long b); int mp_set_long_long(mp_int *a, unsigned long long b); /* get a 32-bit value */ -unsigned long mp_get_int(mp_int *a); +unsigned long mp_get_int(const mp_int *a); /* get a platform dependent unsigned long value */ -unsigned long mp_get_long(mp_int *a); +unsigned long mp_get_long(const mp_int *a); /* get a platform dependent unsigned long long value */ -unsigned long long mp_get_long_long(mp_int *a); +unsigned long long mp_get_long_long(const mp_int *a); /* initialize and set a digit */ int mp_init_set(mp_int *a, mp_digit b); @@ -238,10 +238,10 @@ int mp_init_set(mp_int *a, mp_digit b); int mp_init_set_int(mp_int *a, unsigned long b); /* copy, b = a */ -int mp_copy(mp_int *a, mp_int *b); +int mp_copy(const mp_int *a, mp_int *b); /* inits and copies, a = b */ -int mp_init_copy(mp_int *a, mp_int *b); +int mp_init_copy(mp_int *a, const mp_int *b); /* trim unused digits */ void mp_clamp(mp_int *a); @@ -250,7 +250,7 @@ void mp_clamp(mp_int *a); int mp_import(mp_int *rop, size_t count, int order, size_t size, int endian, size_t nails, const void *op); /* export binary data */ -int mp_export(void *rop, size_t *countp, int order, size_t size, int endian, size_t nails, mp_int *op); +int mp_export(void *rop, size_t *countp, int order, size_t size, int endian, size_t nails, const mp_int *op); /* ---> digit manipulation <--- */ @@ -261,25 +261,25 @@ void mp_rshd(mp_int *a, int b); int mp_lshd(mp_int *a, int b); /* c = a / 2**b, implemented as c = a >> b */ -int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d); +int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); /* b = a/2 */ -int mp_div_2(mp_int *a, mp_int *b); +int mp_div_2(const mp_int *a, mp_int *b); /* c = a * 2**b, implemented as c = a << b */ -int mp_mul_2d(mp_int *a, int b, mp_int *c); +int mp_mul_2d(const mp_int *a, int b, mp_int *c); /* b = a*2 */ -int mp_mul_2(mp_int *a, mp_int *b); +int mp_mul_2(const mp_int *a, mp_int *b); /* c = a mod 2**b */ -int mp_mod_2d(mp_int *a, int b, mp_int *c); +int mp_mod_2d(const mp_int *a, int b, mp_int *c); /* computes a = 2**b */ int mp_2expt(mp_int *a, int b); /* Counts the number of lsbs which are zero before the first zero bit */ -int mp_cnt_lsb(mp_int *a); +int mp_cnt_lsb(const mp_int *a); /* I Love Earth! */ @@ -288,168 +288,168 @@ int mp_rand(mp_int *a, int digits); /* ---> binary operations <--- */ /* c = a XOR b */ -int mp_xor(mp_int *a, mp_int *b, mp_int *c); +int mp_xor(const mp_int *a, const mp_int *b, mp_int *c); /* c = a OR b */ -int mp_or(mp_int *a, mp_int *b, mp_int *c); +int mp_or(const mp_int *a, const mp_int *b, mp_int *c); /* c = a AND b */ -int mp_and(mp_int *a, mp_int *b, mp_int *c); +int mp_and(const mp_int *a, const mp_int *b, mp_int *c); /* ---> Basic arithmetic <--- */ /* b = -a */ -int mp_neg(mp_int *a, mp_int *b); +int mp_neg(const mp_int *a, mp_int *b); /* b = |a| */ -int mp_abs(mp_int *a, mp_int *b); +int mp_abs(const mp_int *a, mp_int *b); /* compare a to b */ -int mp_cmp(mp_int *a, mp_int *b); +int mp_cmp(const mp_int *a, const mp_int *b); /* compare |a| to |b| */ -int mp_cmp_mag(mp_int *a, mp_int *b); +int mp_cmp_mag(const mp_int *a, const mp_int *b); /* c = a + b */ -int mp_add(mp_int *a, mp_int *b, mp_int *c); +int mp_add(const mp_int *a, const mp_int *b, mp_int *c); /* c = a - b */ -int mp_sub(mp_int *a, mp_int *b, mp_int *c); +int mp_sub(const mp_int *a, const mp_int *b, mp_int *c); /* c = a * b */ -int mp_mul(mp_int *a, mp_int *b, mp_int *c); +int mp_mul(const mp_int *a, const mp_int *b, mp_int *c); /* b = a*a */ -int mp_sqr(mp_int *a, mp_int *b); +int mp_sqr(const mp_int *a, mp_int *b); /* a/b => cb + d == a */ -int mp_div(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_div(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d); /* c = a mod b, 0 <= c < b */ -int mp_mod(mp_int *a, mp_int *b, mp_int *c); +int mp_mod(const mp_int *a, const mp_int *b, mp_int *c); /* ---> single digit functions <--- */ /* compare against a single digit */ -int mp_cmp_d(mp_int *a, mp_digit b); +int mp_cmp_d(const mp_int *a, mp_digit b); /* c = a + b */ -int mp_add_d(mp_int *a, mp_digit b, mp_int *c); +int mp_add_d(const mp_int *a, mp_digit b, mp_int *c); /* c = a - b */ -int mp_sub_d(mp_int *a, mp_digit b, mp_int *c); +int mp_sub_d(const mp_int *a, mp_digit b, mp_int *c); /* c = a * b */ -int mp_mul_d(mp_int *a, mp_digit b, mp_int *c); +int mp_mul_d(const mp_int *a, mp_digit b, mp_int *c); /* a/b => cb + d == a */ -int mp_div_d(mp_int *a, mp_digit b, mp_int *c, mp_digit *d); +int mp_div_d(const mp_int *a, mp_digit b, mp_int *c, mp_digit *d); /* a/3 => 3c + d == a */ -int mp_div_3(mp_int *a, mp_int *c, mp_digit *d); +int mp_div_3(const mp_int *a, mp_int *c, mp_digit *d); /* c = a**b */ -int mp_expt_d(mp_int *a, mp_digit b, mp_int *c); -int mp_expt_d_ex(mp_int *a, mp_digit b, mp_int *c, int fast); +int mp_expt_d(const mp_int *a, mp_digit b, mp_int *c); +int mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast); /* c = a mod b, 0 <= c < b */ -int mp_mod_d(mp_int *a, mp_digit b, mp_digit *c); +int mp_mod_d(const mp_int *a, mp_digit b, mp_digit *c); /* ---> number theory <--- */ /* d = a + b (mod c) */ -int mp_addmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* d = a - b (mod c) */ -int mp_submod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_submod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* d = a * b (mod c) */ -int mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* c = a * a (mod b) */ -int mp_sqrmod(mp_int *a, mp_int *b, mp_int *c); +int mp_sqrmod(const mp_int *a, const mp_int *b, mp_int *c); /* c = 1/a (mod b) */ -int mp_invmod(mp_int *a, mp_int *b, mp_int *c); +int mp_invmod(const mp_int *a, const mp_int *b, mp_int *c); /* c = (a, b) */ -int mp_gcd(mp_int *a, mp_int *b, mp_int *c); +int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c); /* produces value such that U1*a + U2*b = U3 */ -int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); +int mp_exteuclid(const mp_int *a, const mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3); /* c = [a, b] or (a*b)/(a, b) */ -int mp_lcm(mp_int *a, mp_int *b, mp_int *c); +int mp_lcm(const mp_int *a, const 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 */ -int mp_n_root(mp_int *a, mp_digit b, mp_int *c); -int mp_n_root_ex(mp_int *a, mp_digit b, mp_int *c, int fast); +int mp_n_root(const mp_int *a, mp_digit b, mp_int *c); +int mp_n_root_ex(const mp_int *a, mp_digit b, mp_int *c, int fast); /* special sqrt algo */ -int mp_sqrt(mp_int *arg, mp_int *ret); +int mp_sqrt(const mp_int *arg, mp_int *ret); /* special sqrt (mod prime) */ -int mp_sqrtmod_prime(mp_int *arg, mp_int *prime, mp_int *ret); +int mp_sqrtmod_prime(const mp_int *arg, const mp_int *prime, mp_int *ret); /* is number a square? */ -int mp_is_square(mp_int *arg, int *ret); +int mp_is_square(const mp_int *arg, int *ret); /* computes the jacobi c = (a | n) (or Legendre if b is prime) */ -int mp_jacobi(mp_int *a, mp_int *n, int *c); +int mp_jacobi(const mp_int *a, const mp_int *n, int *c); /* used to setup the Barrett reduction for a given modulus b */ -int mp_reduce_setup(mp_int *a, mp_int *b); +int mp_reduce_setup(mp_int *a, const 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]. */ -int mp_reduce(mp_int *a, mp_int *b, mp_int *c); +int mp_reduce(mp_int *a, const mp_int *b, const mp_int *c); /* setups the montgomery reduction */ -int mp_montgomery_setup(mp_int *a, mp_digit *mp); +int mp_montgomery_setup(const mp_int *a, mp_digit *mp); /* computes a = B**n mod b without division or multiplication useful for * normalizing numbers in a Montgomery system. */ -int mp_montgomery_calc_normalization(mp_int *a, mp_int *b); +int mp_montgomery_calc_normalization(mp_int *a, const mp_int *b); /* computes x/R == x (mod N) via Montgomery Reduction */ -int mp_montgomery_reduce(mp_int *a, mp_int *m, mp_digit mp); +int mp_montgomery_reduce(mp_int *a, const mp_int *m, mp_digit mp); /* returns 1 if a is a valid DR modulus */ -int mp_dr_is_modulus(mp_int *a); +int mp_dr_is_modulus(const mp_int *a); /* sets the value of "d" required for mp_dr_reduce */ -void mp_dr_setup(mp_int *a, mp_digit *d); +void mp_dr_setup(const mp_int *a, mp_digit *d); /* reduces a modulo b using the Diminished Radix method */ -int mp_dr_reduce(mp_int *a, mp_int *b, mp_digit mp); +int mp_dr_reduce(mp_int *a, const mp_int *b, mp_digit mp); /* returns true if a can be reduced with mp_reduce_2k */ -int mp_reduce_is_2k(mp_int *a); +int mp_reduce_is_2k(const mp_int *a); /* determines k value for 2k reduction */ -int mp_reduce_2k_setup(mp_int *a, mp_digit *d); +int mp_reduce_2k_setup(const mp_int *a, mp_digit *d); /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ -int mp_reduce_2k(mp_int *a, mp_int *n, mp_digit d); +int mp_reduce_2k(mp_int *a, const mp_int *n, mp_digit d); /* returns true if a can be reduced with mp_reduce_2k_l */ -int mp_reduce_is_2k_l(mp_int *a); +int mp_reduce_is_2k_l(const mp_int *a); /* determines k value for 2k reduction */ -int mp_reduce_2k_setup_l(mp_int *a, mp_int *d); +int mp_reduce_2k_setup_l(const mp_int *a, mp_int *d); /* reduces a modulo b where b is of the form 2**p - k [0 <= a] */ -int mp_reduce_2k_l(mp_int *a, mp_int *n, mp_int *d); +int mp_reduce_2k_l(mp_int *a, const mp_int *n, const mp_int *d); /* d = a**b (mod c) */ -int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); +int mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d); /* ---> Primes <--- */ @@ -464,17 +464,17 @@ int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); extern const mp_digit ltm_prime_tab[PRIME_SIZE]; /* result=1 if a is divisible by one of the first PRIME_SIZE primes */ -int mp_prime_is_divisible(mp_int *a, int *result); +int mp_prime_is_divisible(const 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 */ -int mp_prime_fermat(mp_int *a, mp_int *b, int *result); +int mp_prime_fermat(const mp_int *a, const 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 */ -int mp_prime_miller_rabin(mp_int *a, mp_int *b, int *result); +int mp_prime_miller_rabin(const mp_int *a, const 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 @@ -488,7 +488,7 @@ int mp_prime_rabin_miller_trials(int size); * * Sets result to 1 if probably prime, 0 otherwise */ -int mp_prime_is_prime(mp_int *a, int t, int *result); +int mp_prime_is_prime(const mp_int *a, int t, int *result); /* finds the next prime after the number "a" using "t" trials * of Miller-Rabin. @@ -524,26 +524,26 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style); int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat); /* ---> radix conversion <--- */ -int mp_count_bits(mp_int *a); +int mp_count_bits(const mp_int *a); -int mp_unsigned_bin_size(mp_int *a); +int mp_unsigned_bin_size(const mp_int *a); int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); -int mp_to_unsigned_bin(mp_int *a, unsigned char *b); -int mp_to_unsigned_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen); +int mp_to_unsigned_bin(const mp_int *a, unsigned char *b); +int mp_to_unsigned_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen); -int mp_signed_bin_size(mp_int *a); +int mp_signed_bin_size(const mp_int *a); int mp_read_signed_bin(mp_int *a, const unsigned char *b, int c); -int mp_to_signed_bin(mp_int *a, unsigned char *b); -int mp_to_signed_bin_n(mp_int *a, unsigned char *b, unsigned long *outlen); +int mp_to_signed_bin(const mp_int *a, unsigned char *b); +int mp_to_signed_bin_n(const mp_int *a, unsigned char *b, unsigned long *outlen); int mp_read_radix(mp_int *a, const char *str, int radix); -int mp_toradix(mp_int *a, char *str, int radix); -int mp_toradix_n(mp_int *a, char *str, int radix, int maxlen); -int mp_radix_size(mp_int *a, int radix, int *size); +int mp_toradix(const mp_int *a, char *str, int radix); +int mp_toradix_n(const mp_int *a, char *str, int radix, int maxlen); +int mp_radix_size(const mp_int *a, int radix, int *size); #ifndef LTM_NO_FILE int mp_fread(mp_int *a, int radix, FILE *stream); -int mp_fwrite(mp_int *a, int radix, FILE *stream); +int mp_fwrite(const mp_int *a, int radix, FILE *stream); #endif #define mp_read_raw(mp, str, len) mp_read_signed_bin((mp), (str), (len)) diff --git a/libtommath/tommath_private.h b/libtommath/tommath_private.h index ee39694..087ddcd 100644 --- a/libtommath/tommath_private.h +++ b/libtommath/tommath_private.h @@ -55,24 +55,24 @@ extern void XFREE(void *p); #endif /* lowlevel functions, do not call! */ -int s_mp_add(mp_int *a, mp_int *b, mp_int *c); -int s_mp_sub(mp_int *a, mp_int *b, mp_int *c); +int s_mp_add(const mp_int *a, const mp_int *b, mp_int *c); +int s_mp_sub(const mp_int *a, const 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) -int fast_s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int s_mp_mul_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int fast_s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int s_mp_mul_high_digs(mp_int *a, mp_int *b, mp_int *c, int digs); -int fast_s_mp_sqr(mp_int *a, mp_int *b); -int s_mp_sqr(mp_int *a, mp_int *b); -int mp_karatsuba_mul(mp_int *a, mp_int *b, mp_int *c); -int mp_toom_mul(mp_int *a, mp_int *b, mp_int *c); -int mp_karatsuba_sqr(mp_int *a, mp_int *b); -int mp_toom_sqr(mp_int *a, mp_int *b); -int fast_mp_invmod(mp_int *a, mp_int *b, mp_int *c); -int mp_invmod_slow(mp_int *a, mp_int *b, mp_int *c); -int fast_mp_montgomery_reduce(mp_int *x, mp_int *n, mp_digit rho); -int mp_exptmod_fast(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode); -int s_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y, int redmode); +int fast_s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int fast_s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs); +int fast_s_mp_sqr(const mp_int *a, mp_int *b); +int s_mp_sqr(const mp_int *a, mp_int *b); +int mp_karatsuba_mul(const mp_int *a, const mp_int *b, mp_int *c); +int mp_toom_mul(const mp_int *a, const mp_int *b, mp_int *c); +int mp_karatsuba_sqr(const mp_int *a, mp_int *b); +int mp_toom_sqr(const mp_int *a, mp_int *b); +int fast_mp_invmod(const mp_int *a, const mp_int *b, mp_int *c); +int mp_invmod_slow(const mp_int *a, const mp_int *b, mp_int *c); +int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho); +int mp_exptmod_fast(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode); +int s_mp_exptmod(const mp_int *G, const mp_int *X, const mp_int *P, mp_int *Y, int redmode); void bn_reverse(unsigned char *s, int len); extern const char *mp_s_rmap; -- cgit v0.12 From 35256f809ed60c7d2fe088246d90c8841686dc76 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Mon, 2 Oct 2017 17:09:56 +0000 Subject: Introduce rules-ext.vc file for extensions to select most recent rules.vc --- win/rules-ext.vc | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ win/rules.vc | 16 +++++++++--- 2 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 win/rules-ext.vc diff --git a/win/rules-ext.vc b/win/rules-ext.vc new file mode 100644 index 0000000..2a8943b --- /dev/null +++ b/win/rules-ext.vc @@ -0,0 +1,74 @@ +# This file should only be included in makefiles for Tcl extensions, +# NOT in the makefile for Tcl itself. +!if "$(PROJECT)" == "tcl" +!error The rules-ext.vc file is not intended for Tcl itself. +!endif + +# First locate the Tcl directory that we are working with. +!ifndef TCLDIR + +# If an installation path is specified, that is also the Tcl directory. +# Also, tk never builds against an installed Tcl, it needs Tcl sources +!if defined(INSTALLDIR) && "$(PROJECT)" != "tk" +TCLDIR=$(INSTALLDIR) +!else +TCLDIR = ../../tcl +!endif + +!endif # ifndef TCLDIR + +# _TCLDIR = Windows native path format of TCLDIR +_TCLDIR = $(TCLDIR:/=\) + +# Now look for the rules.vc file under the Tcl root +!if exist("$(_TCLDIR)\lib\nmake\rules.vc") # Building against installed Tcl +_RULESDIR = $(_TCLDIR)\lib\nmake +!elseif exist("$(_TCLDIR)\win\rules.vc") # Building against Tcl sources +_RULESDIR = $(_TCLDIR)\win +!else +# If we have not located Tcl's rules file, most likely we are compiling +# against an older version of Tcl and so must use our own support files. +_RULESDIR = . +!endif + +_RULES_VC = $(_RULESDIR)\rules.vc + +!if "$(_RULESDIR)" != "." +# Potentially using Tcl's support files. Need to compare the versions. +# We extract version numbers using the nmakehlp program. For this +# purpose, we use the version of nmakehlp that we have. +!if [$(CC) -nologo nmakehlp.c -link -subsystem:console > nul] +!endif + +!if [echo TCL_RULES_MAJOR = \> versions.vc] \ + && [nmakehlp -V "$(_RULES_VC)" RULES_VERSION_MAJOR >> versions.vc] +!endif +!if [echo TCL_RULES_MINOR = \>> versions.vc] \ + && [nmakehlp -V "$(_RULES_VC)" RULES_VERSION_MINOR >> versions.vc] +!endif + +!if [echo OUR_RULES_MAJOR = \>> versions.vc] \ + && [nmakehlp -V "rules.vc" RULES_VERSION_MAJOR >> versions.vc] +!endif +!if [echo OUR_RULES_MINOR = \>> versions.vc] \ + && [nmakehlp -V "rules.vc" RULES_VERSION_MINOR >> versions.vc] +!endif +!include versions.vc +# We have a newer version of the support files, use them +!message V $(TCL_RULES_MAJOR) $(TCL_RULES_MINOR) $(OUR_RULES_MAJOR) $(OUR_RULES_MINOR) +!if ($(TCL_RULES_MAJOR) != $(OUR_RULES_MAJOR)) || ($(TCL_RULES_MINOR) < $(OUR_RULES_MINOR)) +_RULESDIR = . +!endif + +!endif # $(_RULESDIR) != "." + + +# Get rid of our internal defines before calling rules.vc +!undef _TCLDIR +!undef TCL_RULES_MAJOR +!undef TCL_RULES_MINOR +!undef OUR_RULES_MAJOR +!undef OUR_RULES_MINOR + +!message *** Using $(_RULESDIR)\rules.vc +#!include "$(_RULESDIR)\rules.vc" diff --git a/win/rules.vc b/win/rules.vc index f62be5c..6846a32 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1,4 +1,4 @@ -#------------------------------------------------------------------------------ +#------------------------------------------------------------- -*- makefile -*- # rules.vc -- # # Microsoft Visual C++ makefile include for decoding the commandline @@ -15,6 +15,10 @@ !ifndef _RULES_VC _RULES_VC = 1 +# The following macros define the version of the rules.vc nmake build system +RULES_VERSION_MAJOR = 1 +RULES_VERSION_MINOR = 0 + ################################################################ # Nmake is a pretty weak environment in syntax and capabilities # so this file is necessarily verbose. It's broken down into @@ -1085,9 +1089,13 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 !endif -# UNICODE - Use the wide char Windows API. # _ATL_XP_TARGETING - Newer SDK's need this to build for XP -COMPILERFLAGS = /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING +COMPILERFLAGS = /D_ATL_XP_TARGETING + +# UNICODE - Use the wide char Windows API. Tcl 8.5 does not define this. +!if $(TCL_VERSION) > 85 +COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE +!endif # crt picks the C run time based on selected OPTS !if $(MSVCRT) @@ -1299,7 +1307,7 @@ $< {$(RCDIR)}.rc{$(TMP_DIR)}.res: $(MAKERESCMD) - + {$(WINDIR)}.rc{$(TMP_DIR)}.res: $(MAKERESCMD) -- cgit v0.12 From f5c6b072469892af03a919e8c941e0426baead1f Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 3 Oct 2017 08:06:30 +0000 Subject: Remove use of any macros used in rules.vc from rules-ext.vc Added USE_WIDECHAR_API to control usage of Windows wide API's. --- win/makefile.vc | 2 ++ win/rules-ext.vc | 36 +++++++++++++++++++----------------- win/rules.vc | 15 ++++++++++++++- 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 9bd91f5..7a3de6e 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -673,6 +673,7 @@ CORE_MACHINE = $(MACHINE) CORE_DEBUG = $(DEBUG) CORE_TCL_THREADS = $(TCL_THREADS) CORE_USE_THREAD_ALLOC = $(USE_THREAD_ALLOC) +CORE_USE_WIDECHAR_API = $(USE_WIDECHAR_API) << #--------------------------------------------------------------------- @@ -947,6 +948,7 @@ install-libraries: tclConfig tcl-nmake install-msgs install-tzdata @$(CPY) "$(OUT_DIR)\tclConfig.sh" "$(LIB_INSTALL_DIR)\" @$(CPY) "$(WINDIR)\tclooConfig.sh" "$(LIB_INSTALL_DIR)\" @$(CPY) "$(WINDIR)\rules.vc" "$(LIB_INSTALL_DIR)\nmake\" + @$(CPY) "$(WINDIR)\rules-ext.vc" "$(LIB_INSTALL_DIR)\nmake\" @$(CPY) "$(WINDIR)\nmakehlp.c" "$(LIB_INSTALL_DIR)\nmake\" @$(CPY) "$(OUT_DIR)\tcl.nmake" "$(LIB_INSTALL_DIR)\nmake\" @echo Installing library http1.0 directory diff --git a/win/rules-ext.vc b/win/rules-ext.vc index 2a8943b..094bc32 100644 --- a/win/rules-ext.vc +++ b/win/rules-ext.vc @@ -1,38 +1,40 @@ # This file should only be included in makefiles for Tcl extensions, # NOT in the makefile for Tcl itself. + +!ifndef _RULES_EXT_VC + !if "$(PROJECT)" == "tcl" !error The rules-ext.vc file is not intended for Tcl itself. !endif # First locate the Tcl directory that we are working with. -!ifndef TCLDIR +!ifdef TCLDIR + +_RULESDIR = $(TCLDIR:/=\) + +!else # If an installation path is specified, that is also the Tcl directory. # Also, tk never builds against an installed Tcl, it needs Tcl sources !if defined(INSTALLDIR) && "$(PROJECT)" != "tk" -TCLDIR=$(INSTALLDIR) +_RULESDIR=$(INSTALLDIR:/=\) !else -TCLDIR = ../../tcl +_RULESDIR = ..\..\tcl !endif !endif # ifndef TCLDIR -# _TCLDIR = Windows native path format of TCLDIR -_TCLDIR = $(TCLDIR:/=\) - # Now look for the rules.vc file under the Tcl root -!if exist("$(_TCLDIR)\lib\nmake\rules.vc") # Building against installed Tcl -_RULESDIR = $(_TCLDIR)\lib\nmake -!elseif exist("$(_TCLDIR)\win\rules.vc") # Building against Tcl sources -_RULESDIR = $(_TCLDIR)\win +!if exist("$(_RULESDIR)\lib\nmake\rules.vc") # Building against installed Tcl +_RULESDIR = $(_RULESDIR)\lib\nmake +!elseif exist("$(_RULESDIR)\win\rules.vc") # Building against Tcl sources +_RULESDIR = $(_RULESDIR)\win !else # If we have not located Tcl's rules file, most likely we are compiling # against an older version of Tcl and so must use our own support files. _RULESDIR = . !endif -_RULES_VC = $(_RULESDIR)\rules.vc - !if "$(_RULESDIR)" != "." # Potentially using Tcl's support files. Need to compare the versions. # We extract version numbers using the nmakehlp program. For this @@ -41,10 +43,10 @@ _RULES_VC = $(_RULESDIR)\rules.vc !endif !if [echo TCL_RULES_MAJOR = \> versions.vc] \ - && [nmakehlp -V "$(_RULES_VC)" RULES_VERSION_MAJOR >> versions.vc] + && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MAJOR >> versions.vc] !endif !if [echo TCL_RULES_MINOR = \>> versions.vc] \ - && [nmakehlp -V "$(_RULES_VC)" RULES_VERSION_MINOR >> versions.vc] + && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MINOR >> versions.vc] !endif !if [echo OUR_RULES_MAJOR = \>> versions.vc] \ @@ -55,7 +57,6 @@ _RULES_VC = $(_RULESDIR)\rules.vc !endif !include versions.vc # We have a newer version of the support files, use them -!message V $(TCL_RULES_MAJOR) $(TCL_RULES_MINOR) $(OUR_RULES_MAJOR) $(OUR_RULES_MINOR) !if ($(TCL_RULES_MAJOR) != $(OUR_RULES_MAJOR)) || ($(TCL_RULES_MINOR) < $(OUR_RULES_MINOR)) _RULESDIR = . !endif @@ -64,11 +65,12 @@ _RULESDIR = . # Get rid of our internal defines before calling rules.vc -!undef _TCLDIR !undef TCL_RULES_MAJOR !undef TCL_RULES_MINOR !undef OUR_RULES_MAJOR !undef OUR_RULES_MINOR !message *** Using $(_RULESDIR)\rules.vc -#!include "$(_RULESDIR)\rules.vc" +!include "$(_RULESDIR)\rules.vc" + +!endif # _RULES_EXT_VC \ No newline at end of file diff --git a/win/rules.vc b/win/rules.vc index 6846a32..399796f 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1092,8 +1092,21 @@ OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 # _ATL_XP_TARGETING - Newer SDK's need this to build for XP COMPILERFLAGS = /D_ATL_XP_TARGETING -# UNICODE - Use the wide char Windows API. Tcl 8.5 does not define this. + +# Following is primarily for the benefit of extensions. Tcl 8.5 builds +# Tcl without /DUNICODE, while 8.6 builds with it defined. When building +# an extension, it is advisable (but not mandated) to use the same Windows +# API as the Tcl build. This is accordingly defaulted below. A particular +# extension can override this by pre-definining USE_WIDECHAR_API. +!ifndef USE_WIDECHAR_API !if $(TCL_VERSION) > 85 +USE_WIDECHAR_API = 1 +!else +USE_WIDECHAR_API = 0 +!endif +!endif + +!if $(USE_WIDECHAR_API) COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE !endif -- cgit v0.12 From ec0fc7f8162eaba81d27f3c3ca6fe65b0e3d0932 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 3 Oct 2017 13:41:53 +0000 Subject: Have nmakehlp return non-0 exit code if version string not located with -V option --- win/nmakehlp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 22b7b06..42034c6 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -74,6 +74,7 @@ main( char msg[300]; DWORD dwWritten; int chars; + char *s; /* * Make sure children (cl.exe and link.exe) are kept quiet. @@ -153,8 +154,13 @@ main( &dwWritten, NULL); return 0; } - printf("%s\n", GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0')); - return 0; + s = GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0'); + if (s && *s) { + printf("%s\n", s); + return 0; + } else + return 1; /* Version not found. Return non-0 exit code */ + case 'Q': if (argc != 3) { chars = snprintf(msg, sizeof(msg) - 1, -- cgit v0.12 From 8c50df7bbf81ebcc60be310c1dc8e08ff893fa1d Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 3 Oct 2017 13:44:49 +0000 Subject: Extract version numbers from TEA files so do not have to be separately defined. --- win/makefile.vc | 2 +- win/rules.vc | 101 ++++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 77 insertions(+), 26 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 7a3de6e..e8a91e8 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -639,7 +639,7 @@ Display compile progress=no Error log file=$(HTMLBASE).log Full-text search=Yes Language=0x409 English (United States) -Title=Tcl/Tk $(DOT_VERSION) Help +Title=Tcl/Tk $(DOTVERSION) Help [FILES] contents.htm docs.css diff --git a/win/rules.vc b/win/rules.vc index 399796f..a69c26f 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -19,6 +19,19 @@ _RULES_VC = 1 RULES_VERSION_MAJOR = 1 RULES_VERSION_MINOR = 0 +# The PROJECT macro must be defined by parent makefile. +# Also special case Tcl and Tk to save some typing later +!ifndef PROJECT +!error *** Error: Macro PROJECT not defined! Please define it before including rules.vc +!endif +DOING_TCL = 0 +DOING_TK = 0 +!if "$(PROJECT)" == "tcl" +DOING_TCL = 1 +!elseif "$(PROJECT)" == "tk" +DOING_TK = 1 +!endif + ################################################################ # Nmake is a pretty weak environment in syntax and capabilities # so this file is necessarily verbose. It's broken down into @@ -169,7 +182,7 @@ _INSTALLDIR = $(INSTALLDIR:/=\) _INSTALLDIR = C:\Program Files\Tcl !endif -!if "$(PROJECT)" == "tcl" +!if $(DOING_TCL) # BEGIN Case 2(a) - Building Tcl itself @@ -178,7 +191,7 @@ _TCL_H = ..\generic\tcl.h # END Case 2(a) - Building Tcl itself -!elseif "$(PROJECT)" == "tk" +!elseif $(DOING_TK) # BEGIN Case 2(b) - Building Tk @@ -282,7 +295,7 @@ _INSTALLDIR=$(_INSTALLDIR)\lib !endif # END Case 2(c) or (d) - Building an extension -!endif # if $(PROJECT) == "tcl" +!endif # if $(DOING_TCL) ################################################################ # 3. Determine compiler version and architecture @@ -403,7 +416,7 @@ CFG_ENCODING = \"cp1252\" # Default to the one in the current directory (the extension's own nmakehlp.c) NMAKEHLPC = nmakehlp.c -!if "$(PROJECT)" != "tcl" +!if !$(DOING_TCL) !if $(TCLINSTALL) !if exist("$(_TCLDIR)\lib\nmake\nmakehlp.c") NMAKEHLPC = $(_TCLDIR)\lib\nmake\nmakehlp.c @@ -413,7 +426,7 @@ NMAKEHLPC = $(_TCLDIR)\lib\nmake\nmakehlp.c NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c !endif !endif # $(TCLINSTALL) -!endif # $(PROJECT) != "tcl" +!endif # !$(DOING_TCL) !endif # NMAKEHLPC @@ -574,7 +587,7 @@ TCL_USE_STATIC_PACKAGES = 0 USE_THREAD_ALLOC = 1 UNCHECKED = 0 CONFIG_CHECK = 1 -!if "$(PROJECT)" == "tcl" +!if $(DOING_TCL) USE_STUBS = 0 !else USE_STUBS = 1 @@ -772,7 +785,11 @@ WARNINGS = $(WARNINGS) -Wp64 !endif ################################################################ -# 9. Extract various version numbers from tcl headers +# 9. Extract various version numbers +# For Tcl and Tk, version numbers are exctracted from tcl.h and tk.h +# respectively. For extensions, versions are extracted from the +# configure.in or configure.ac from the TEA configuration if it +# exists, and unset otherwise. # Sets the following macros: # TCL_MAJOR_VERSION # TCL_MINOR_VERSION @@ -782,6 +799,8 @@ WARNINGS = $(WARNINGS) -Wp64 # TK_MINOR_VERSION # TK_PATCH_LEVEL # TK_VERSION +# DOTVERSION - set as (for example) 2.5 +# VERSION - set as (for example 25) #-------------------------------------------------------------- !if [echo REM = This file is generated from rules.vc > versions.vc] @@ -811,10 +830,39 @@ WARNINGS = $(WARNINGS) -Wp64 !include versions.vc TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) +TCL_DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) !if defined(_TK_H) TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION) +TK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) !endif +# Set DOTVERSION and VERSION +!if $(DOING_TCL) + +DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) +VERSION = $(TCL_VERSION) + +!elseif $(DOING_TK) + +DOTVERSION = $(TK_DOTVERSION) +VERSION = $(TK_VERSION) + +!else # Doing a non-Tk extension + +# If parent makefile has not defined DOTVERSION, try to get it from TEA +# first from a configure.in file, and then from configure.ac +!ifndef DOTVERSION +!if [echo DOTVERSION = \> versions.vc] \ + || [nmakehlp -V ..\configure.in AC_INIT >> versions.vc] +!if [echo DOTVERSION = \> versions.vc] \ + || [nmakehlp -V ..\configure.ac AC_INIT >> versions.vc] +!error *** Could not figure out extension version. Please define DOTVERSION in parent makefile before including rules.vc. +!endif +!endif +!include versions.vc +!endif # DOTVERSION + +!endif # $(DOING_TCL) ... etc. ################################################################ # 10. Construct output directory and file paths @@ -895,7 +943,7 @@ OUT_DIR = $(TMP_DIR) STUBPREFIX = $(PROJECT)stub # Set up paths to various Tcl executables and libraries needed by extensions -!if "$(PROJECT)" == "tcl" +!if $(DOING_TCL) TCLSHNAME = $(PROJECT)sh$(TCL_VERSION)$(SUFX).exe TCLSH = $(OUT_DIR)\$(TCLSHNAME) @@ -907,7 +955,7 @@ TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME) TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -!else # $(PROJECT) is not "tcl" +!else # ! $(DOING_TCL) !if $(TCLINSTALL) # Building against an installed Tcl @@ -941,7 +989,7 @@ TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)" -!endif $(PROJECT) != "tcl" +!endif # $(DOING_TCL) # We need a tclsh that will run on the host machine as part of the build. # IX86 runs on all architectures. @@ -954,14 +1002,14 @@ TCLSH_NATIVE = $(TCLSH) !endif # Do the same for Tk and Tk extensions that require the Tk libraries -!if "$(PROJECT)" == "tk" || defined(PROJECT_REQUIRES_TK) +!if $(DOING_TK) || defined(PROJECT_REQUIRES_TK) WISHNAMEPREFIX = wish WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT) TKSTUBLIBNAME = tkstub$(TK_VERSION).lib TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX).lib -!if "$(PROJECT)" == "tk" +!if $(DOING_TK) WISH = $(OUT_DIR)\$(WISHNAME) TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME) TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME) @@ -982,8 +1030,8 @@ TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME) TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" !endif # TKINSTALL -!endif # $(PROJECT) == tk -!endif # $(PROJECT) == tk || PROJECT_REQUIRES_TK +!endif # $(DOING_TK) +!endif # $(DOING_TK) || PROJECT_REQUIRES_TK ################################################################### # 11. Construct the paths for the installation directories @@ -996,19 +1044,19 @@ TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" # DEMO_INSTALL_DIR - where demos should be installed # PRJ_INSTALL_DIR - where package will be installed (not set for tcl and tk) -!if "$(PROJECT)" == "tcl" || "$(PROJECT)" == "tk" +!if $(DOING_TCL) || $(DOING_TK) LIB_INSTALL_DIR = $(_INSTALLDIR)\lib BIN_INSTALL_DIR = $(_INSTALLDIR)\bin DOC_INSTALL_DIR = $(_INSTALLDIR)\doc -!if "$(PROJECT)" == "tcl" +!if $(DOING_TCL) SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) -!else +!else # DOING_TK SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) !endif DEMO_INSTALL_DIR = $(SCRIPT_INSTALL_DIR)\demos INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include -!else +!else # extension other than Tk PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION) LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR) @@ -1065,7 +1113,7 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED !if $(USE_STUBS) # Note we do not define USE_TCL_STUBS even when building tk since some # test targets in tk do not use stubs -!if "$(PROJECT)" != "tcl" +!if ! $(DOING_TCL) USE_STUBS_DEFS = -DUSE_TCL_STUBS -DUSE_TCLOO_STUBS !ifdef PROJECT_REQUIRES_TK USE_STUBS_DEFS = $(USE_STUBS_DEFS) -DUSE_TK_STUBS @@ -1092,7 +1140,6 @@ OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 # _ATL_XP_TARGETING - Newer SDK's need this to build for XP COMPILERFLAGS = /D_ATL_XP_TARGETING - # Following is primarily for the benefit of extensions. Tcl 8.5 builds # Tcl without /DUNICODE, while 8.6 builds with it defined. When building # an extension, it is advisable (but not mandated) to use the same Windows @@ -1259,9 +1306,13 @@ MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ $(TCL_INCLUDES) \ - -d DEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ - -d TCL_THREADS=$(TCL_THREADS) \ - -d STATIC_BUILD=$(STATIC_BUILD) \ + -DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ + -DTCL_THREADS=$(TCL_THREADS) \ + -DSTATIC_BUILD=$(STATIC_BUILD) \ + -DCOMMAVERSION=$(DOTVERSION:.=,),0 \ + -DDOTVERSION=\"$(DOTVERSION)\" \ + -DVERSION=\"$(VERSION)\" \ + -DSUFX=\"$(SUFX)\" \ $< !ifndef DISABLE_DEFAULT_TARGETS @@ -1334,7 +1385,7 @@ $< # When building an extension, certain configuration options should # match the ones used when Tcl was built. Here we check and # warn on a mismatch. -!if "$(PROJECT)" != "tcl" +!if ! $(DOING_TCL) !if $(TCLINSTALL) # Building against an installed Tcl !if exist("$(_TCLDIR)\lib\nmake\tcl.nmake") @@ -1363,7 +1414,7 @@ TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake" !endif # TCLNMAKECONFIG -!endif # $(PROJECT) == "tcl" +!endif # ! $(DOING_TCL) #---------------------------------------------------------- -- cgit v0.12 From c0295836a87989ce8b73459877b76171a32eaf4e Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Wed, 4 Oct 2017 01:57:51 +0000 Subject: Add default-* targets --- win/rules.vc | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 11 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index a69c26f..6f14f67 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -37,7 +37,8 @@ DOING_TK = 1 # so this file is necessarily verbose. It's broken down into # the following parts. # -# 0. Sanity check that compiler environment is set up. +# 0. Sanity check that compiler environment is set up and initialize +# any built-in settings from the parent makefile # 1. First define the external tools used for compiling, copying etc. # as this is independent of everything else. # 2. Figure out our build structure in terms of the directory, whether @@ -74,6 +75,11 @@ Visual C++ compiler environment not initialized. !error $(MSG) !endif +# Defaults for built-in internal settings defined in parent makefile +!ifndef DISABLE_DEFAULT_TARGETS +DISABLE_DEFAULT_TARGETS = 0 +!endif + ################################################################ # 1. Define external programs being used @@ -882,10 +888,15 @@ VERSION = $(TK_VERSION) # is of the form {Release,Debug}[_AMD64][_COMPILERVERSION] # TMP_DIR - directory where object files are created # OUT_DIR - directory where output executables are created -# STUBPREFIX - name of the stubs library for this project # Both TMP_DIR and OUT_DIR are defaulted only if not defined by the # parent makefile (or command line). The default values are # based on BUILDDIRTOP. +# STUBPREFIX - name of the stubs library for this project +# PRJIMPLIB - output path of the generated project import library +# PRJLIBNAME - name of generated project library +# PRJLIB - output path of generated project library +# PRJSTUBLIBNAME - name of the generated project stubs library +# PRJSTUBLIB - output path of the generated project stubs library SUFX = tsgx @@ -1033,6 +1044,14 @@ TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" !endif # $(DOING_TK) !endif # $(DOING_TK) || PROJECT_REQUIRES_TK +# Various output paths +PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib +PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) +PRJLIB = $(OUT_DIR)\$(PRJLIBNAME) + +PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib +PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME) + ################################################################### # 11. Construct the paths for the installation directories # The following macros get defined in this section: @@ -1315,19 +1334,27 @@ MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ -DSUFX=\"$(SUFX)\" \ $< -!ifndef DISABLE_DEFAULT_TARGETS !ifndef DEFAULT_BUILD_TARGET DEFAULT_BUILD_TARGET = all !endif -default_target: $(DEFAULT_BUILD_TARGET) +default-target: $(DEFAULT_BUILD_TARGET) -setup: - @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) - @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) +default-install: default-install-binaries default-install-libraries + +default-install-binaries: $(PRJLIB) + @echo Installing binaries to '$(SCRIPT_INSTALL_DIR)' + @if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" + @$(CPY) $(PRJLIB) "$(SCRIPT_INSTALL_DIR)" >NUL -clean: +default-install-libraries: $(OUT_DIR)\pkgIndex.tcl + @echo Installing libraries to '$(SCRIPT_INSTALL_DIR)' + @if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)" + @echo Installing package index in '$(SCRIPT_INSTALL_DIR)' + @$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR) + +default-clean: @echo Cleaning $(TMP_DIR)\* ... @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) @echo Cleaning $(WINDIR)\nmakehlp.obj, nmakehlp.exe ... @@ -1342,12 +1369,28 @@ clean: @if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc @if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc -realclean: hose - -hose: +default-hose: @echo Hosing $(OUT_DIR)\* ... @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) +default-distclean: default-hose + @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe + @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj + +default-setup: + @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) + @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) + +# Always enable this target as this is fairly standard across Tcl and all +# extensions and does the same thing everywhere. +setup: default-setup + +!if ! $(DISABLE_DEFAULT_TARGETS) +install: default-install +clean: default-clean +realclean: hose +hose: default-hose +distclean: realclean default-distclean !endif !ifndef DISABLE_IMPLICIT_RULES -- cgit v0.12 From 20730e0afb57e613514f889ef6f2f93314717f74 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Thu, 5 Oct 2017 14:19:50 +0000 Subject: Added default-pkgindex target and split DISABLE_DEFAULT_TARGETS to DISABLE_{STANDARD,CLEAN}_TARGETS. --- win/makefile.vc | 3 +++ win/rules.vc | 24 +++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index e8a91e8..dd6acca 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -173,6 +173,9 @@ PROJECT = tcl # rules.vc file will set up "all" as the target. DEFAULT_BUILD_TARGET = release +# We do not want the standard install targets defined in rules.vc +DISABLE_STANDARD_TARGETS = 1 + # The rules.vc file does most of the hard work in terms of defining # the build configuration, macros, output directories etc. !include "rules.vc" diff --git a/win/rules.vc b/win/rules.vc index 6f14f67..7f5ff3d 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -76,8 +76,11 @@ Visual C++ compiler environment not initialized. !endif # Defaults for built-in internal settings defined in parent makefile -!ifndef DISABLE_DEFAULT_TARGETS -DISABLE_DEFAULT_TARGETS = 0 +!ifndef DISABLE_STANDARD_TARGETS +DISABLE_STANDARD_TARGETS = 0 +!endif +!ifndef DISABLE_CLEAN_TARGETS +DISABLE_CLEAN_TARGETS = 0 !endif ################################################################ @@ -1341,6 +1344,18 @@ DEFAULT_BUILD_TARGET = all default-target: $(DEFAULT_BUILD_TARGET) +default-pkgindex: + @echo package ifneeded $(PROJECT) $(DOTVERSION) \ + [list load [file join $$dir $(PRJLIBNAME)]] >> $(OUT_DIR)\pkgIndex.tcl + +default-pkgindex-tea: + @if exist $(ROOT)\pkgIndex.tcl.in nmakehlp -s << $(ROOT)\pkgIndex.tcl.in > $(OUT_DIR)\pkgIndex.tcl +@PACKAGE_VERSION@ $(DOTVERSION) +@PACKAGE_NAME@ $(PROJECT) +@PKG_LIB_FILE@ $(PRJLIBNAME) +<< + + default-install: default-install-binaries default-install-libraries default-install-binaries: $(PRJLIB) @@ -1385,8 +1400,11 @@ default-setup: # extensions and does the same thing everywhere. setup: default-setup -!if ! $(DISABLE_DEFAULT_TARGETS) +!if ! $(DISABLE_STANDARD_TARGETS) install: default-install +!endif + +!if ! $(DISABLE_CLEAN_TARGETS) clean: default-clean realclean: hose hose: default-hose -- cgit v0.12 From 65895760ea527481c4c02b11273431f1053aec5a Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Thu, 5 Oct 2017 17:00:39 +0000 Subject: Added standard target for generating pkgIndex.tcl. Added PKGNAMEFLAGS to pass PACKAGE_NAME and PACKAGE_VERSION. --- win/makefile.vc | 2 +- win/rules-ext.vc | 7 +++++++ win/rules.vc | 19 +++++++++++++------ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index dd6acca..92844e5 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -480,6 +480,7 @@ dlls: setup $(TCLREGLIB) $(TCLDDELIB) all: setup $(TCLSH) $(TCLSTUBLIB) dlls $(CAT32) pkgs tcltest: setup $(TCLTEST) dlls $(CAT32) install: install-binaries install-libraries install-docs install-pkgs +setup: default-setup test: test-core test-pkgs test-core: setup $(TCLTEST) dlls $(CAT32) @@ -951,7 +952,6 @@ install-libraries: tclConfig tcl-nmake install-msgs install-tzdata @$(CPY) "$(OUT_DIR)\tclConfig.sh" "$(LIB_INSTALL_DIR)\" @$(CPY) "$(WINDIR)\tclooConfig.sh" "$(LIB_INSTALL_DIR)\" @$(CPY) "$(WINDIR)\rules.vc" "$(LIB_INSTALL_DIR)\nmake\" - @$(CPY) "$(WINDIR)\rules-ext.vc" "$(LIB_INSTALL_DIR)\nmake\" @$(CPY) "$(WINDIR)\nmakehlp.c" "$(LIB_INSTALL_DIR)\nmake\" @$(CPY) "$(OUT_DIR)\tcl.nmake" "$(LIB_INSTALL_DIR)\nmake\" @echo Installing library http1.0 directory diff --git a/win/rules-ext.vc b/win/rules-ext.vc index 094bc32..825bf1a 100644 --- a/win/rules-ext.vc +++ b/win/rules-ext.vc @@ -3,6 +3,13 @@ !ifndef _RULES_EXT_VC +!if !exist("rules-ext.vc") +MSG = ^ +You must run this makefile only from the directory it is in.^ +Please `cd` to its location first. +!error $(MSG) +!endif + !if "$(PROJECT)" == "tcl" !error The rules-ext.vc file is not intended for Tcl itself. !endif diff --git a/win/rules.vc b/win/rules.vc index 7f5ff3d..0730553 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1179,6 +1179,13 @@ USE_WIDECHAR_API = 0 COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE !endif +# Like the TEA system only set this non empty for non-Tk extensions +!if !$(DOING_TCL) && !$(DOING_TK) +PKGNAMEFLAGS = -DPACKAGE_NAME="\"$(PROJECT)\"" \ + -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \ + -DMODULE_SCOPE=extern +!endif + # crt picks the C run time based on selected OPTS !if $(MSVCRT) !if $(DEBUG) && !$(UNCHECKED) @@ -1241,8 +1248,8 @@ cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug) appcflags = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) $(USE_STUBS_DEFS) appcflags_nostubs = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) -pkgcflags = $(appcflags) -DBUILD_$(PROJECT) -pkgcflags_nostubs = $(appcflags_nostubs) -DBUILD_$(PROJECT) +pkgcflags = $(appcflags) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) +pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) # stubscflags contains $(cflags) plus flags used for building a stubs # library for the package. Note: -DSTATIC_BUILD is defined in @@ -1396,12 +1403,12 @@ default-setup: @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) -# Always enable this target as this is fairly standard across Tcl and all -# extensions and does the same thing everywhere. -setup: default-setup - !if ! $(DISABLE_STANDARD_TARGETS) +setup: default-setup install: default-install +pkgindex: default-pkgindex +pkgIndex: default-pkgindex +pkgindex-tea: default-pkgindex-tea !endif !if ! $(DISABLE_CLEAN_TARGETS) -- cgit v0.12 From 21379b0cf5fd2a51ee08f109d65d29636e920592 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Fri, 6 Oct 2017 13:38:26 +0000 Subject: Move standard predefined targets to targets.vc as this allows the master makefile to modify macros if required before the targets are defined. --- win/makefile.vc | 9 +++++---- win/rules-ext.vc | 2 ++ win/rules.vc | 23 ++++------------------- win/targets.vc | 21 +++++++++++++++++++++ 4 files changed, 32 insertions(+), 23 deletions(-) create mode 100644 win/targets.vc diff --git a/win/makefile.vc b/win/makefile.vc index 92844e5..dfbf961 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -173,9 +173,6 @@ PROJECT = tcl # rules.vc file will set up "all" as the target. DEFAULT_BUILD_TARGET = release -# We do not want the standard install targets defined in rules.vc -DISABLE_STANDARD_TARGETS = 1 - # The rules.vc file does most of the hard work in terms of defining # the build configuration, macros, output directories etc. !include "rules.vc" @@ -952,6 +949,7 @@ install-libraries: tclConfig tcl-nmake install-msgs install-tzdata @$(CPY) "$(OUT_DIR)\tclConfig.sh" "$(LIB_INSTALL_DIR)\" @$(CPY) "$(WINDIR)\tclooConfig.sh" "$(LIB_INSTALL_DIR)\" @$(CPY) "$(WINDIR)\rules.vc" "$(LIB_INSTALL_DIR)\nmake\" + @$(CPY) "$(WINDIR)\targets.vc" "$(LIB_INSTALL_DIR)\nmake\" @$(CPY) "$(WINDIR)\nmakehlp.c" "$(LIB_INSTALL_DIR)\nmake\" @$(CPY) "$(OUT_DIR)\tcl.nmake" "$(LIB_INSTALL_DIR)\nmake\" @echo Installing library http1.0 directory @@ -998,6 +996,7 @@ install-libraries: tclConfig tcl-nmake install-msgs install-tzdata @echo Installing encodings @$(CPY) "$(ROOT)\library\encoding\*.enc" \ "$(SCRIPT_INSTALL_DIR)\encoding\" +# "emacs font-lock highlighting fix install-tzdata: @echo Installing time zone data @@ -1031,7 +1030,9 @@ tidy: @echo Removing $(TCLREGLIB) ... @if exist $(TCLREGLIB) del $(TCLREGLIB) -clean: clean-pkgs +clean: default-clean clean-pkgs +hose: default-hose +realclean: hose # Local Variables: # mode: makefile diff --git a/win/rules-ext.vc b/win/rules-ext.vc index 825bf1a..97c11b4 100644 --- a/win/rules-ext.vc +++ b/win/rules-ext.vc @@ -70,6 +70,8 @@ _RULESDIR = . !endif # $(_RULESDIR) != "." +# Let rules.vc know what copy of nmakehlp.c to use. +NMAKEHLPC = $(_RULESDIR)\nmakehlp.c # Get rid of our internal defines before calling rules.vc !undef TCL_RULES_MAJOR diff --git a/win/rules.vc b/win/rules.vc index 0730553..c0d2915 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -417,9 +417,9 @@ CFG_ENCODING = \"cp1252\" # # Extensions built against Tcl sources will use the one from the Tcl source. # -# This can all be overridden by defining the NMAKEHLPC macro to point -# to the nmakehlp.c file to be used, either from the command line or -# the containing makefile. +# When building an extension using a sufficiently new version of Tcl, +# rules-ext.vc will define NMAKEHLPC appropriately to point to the +# copy of nmakehlp.c to be used. !ifndef NMAKEHLPC # Default to the one in the current directory (the extension's own nmakehlp.c) @@ -1346,7 +1346,7 @@ MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ !ifndef DEFAULT_BUILD_TARGET -DEFAULT_BUILD_TARGET = all +DEFAULT_BUILD_TARGET = $(PROJECT) !endif default-target: $(DEFAULT_BUILD_TARGET) @@ -1403,21 +1403,6 @@ default-setup: @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) -!if ! $(DISABLE_STANDARD_TARGETS) -setup: default-setup -install: default-install -pkgindex: default-pkgindex -pkgIndex: default-pkgindex -pkgindex-tea: default-pkgindex-tea -!endif - -!if ! $(DISABLE_CLEAN_TARGETS) -clean: default-clean -realclean: hose -hose: default-hose -distclean: realclean default-distclean -!endif - !ifndef DISABLE_IMPLICIT_RULES # Implicit rule definitions - only for building library objects. For stubs and # main application, the master makefile should define explicit rules. diff --git a/win/targets.vc b/win/targets.vc new file mode 100644 index 0000000..6844045 --- /dev/null +++ b/win/targets.vc @@ -0,0 +1,21 @@ +#------------------------------------------------------------- -*- makefile -*- + +$(PROJECT): setup pkgindex $(PRJLIB) + +!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk" +# MAKEBINCMD will do shared, static and debug links as appropriate +# _VC_MANIFEST_EMBED_DLL embeds the manifest for shared libraries +# and is a no-op for static libraries +$(PRJLIB): $(PRJ_OBJS) + $(MAKEBINCMD) $** + $(_VC_MANIFEST_EMBED_DLL) + -@del $*.exp +!endif + +setup: default-setup +install: default-install +clean: default-clean +realclean: hose +hose: default-hose +distclean: realclean default-distclean + -- cgit v0.12 From a0f84e1b737e33956703918e18ec26da6a95d224 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sat, 7 Oct 2017 13:33:13 +0000 Subject: Fix ignore glob for Visual C++ output directories. --- .fossil-settings/ignore-glob | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob index 08d388d..c85b488 100644 --- a/.fossil-settings/ignore-glob +++ b/.fossil-settings/ignore-glob @@ -18,6 +18,7 @@ */tclsh* */tcltest* */versions.vc +*/version.vc html libtommath/bn.ilg libtommath/bn.ind @@ -40,7 +41,8 @@ unix/dltest.marker unix/tcl.pc unix/tclIndex unix/pkgs/* -win/Debug_VC* -win/Release_VC* +win/Debug* +win/Release* win/pkgs/* -win/tcl.hpj \ No newline at end of file +win/tcl.hpj +win/nmhlp-out.txt -- cgit v0.12 From fdc29e53d31d86bad4fd5489197ec23e34369052 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sat, 7 Oct 2017 17:16:20 +0000 Subject: Was not setting VERSION for extensions. --- win/rules.vc | 1 + 1 file changed, 1 insertion(+) diff --git a/win/rules.vc b/win/rules.vc index c0d2915..702e313 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -870,6 +870,7 @@ VERSION = $(TK_VERSION) !endif !include versions.vc !endif # DOTVERSION +VERSION = $(DOTVERSION:.=) !endif # $(DOING_TCL) ... etc. -- cgit v0.12 From 9845cc7c9ceedb5f71e3f0223391fb952156b7d1 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sun, 8 Oct 2017 13:18:15 +0000 Subject: Add default rc template so extensions do not have to write their own --- win/rules.vc | 46 ++++++++++++++++++++++++++++++++++++++++++---- win/tcl.rc | 20 +------------------- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 702e313..d5952fd 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -398,8 +398,6 @@ _VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -ou CFG_ENCODING = \"cp1252\" !endif -!message ===================================================================== - ################################################################ # 4. Build the nmakehlp program # This is a helper app we need to overcome nmake's limiting @@ -1337,12 +1335,12 @@ MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ $(TCL_INCLUDES) \ -DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ - -DTCL_THREADS=$(TCL_THREADS) \ - -DSTATIC_BUILD=$(STATIC_BUILD) \ -DCOMMAVERSION=$(DOTVERSION:.=,),0 \ -DDOTVERSION=\"$(DOTVERSION)\" \ -DVERSION=\"$(VERSION)\" \ -DSUFX=\"$(SUFX)\" \ + -DPROJECT=\"$(PROJECT)\" \ + -DPRJLIBNAME=\"$(PRJLIBNAME)\" \ $< @@ -1404,6 +1402,43 @@ default-setup: @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) +default-rc: + @$(COPY) << $(TMP_DIR)\$(PROJECT).rc +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION COMMAVERSION + PRODUCTVERSION COMMAVERSION + FILEFLAGSMASK 0x3fL +#ifdef DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "Tcl extension " PROJECT + VALUE "OriginalFilename", PRJLIBNAME + VALUE "FileVersion", DOTVERSION + VALUE "ProductName", "Package " PROJECT " for Tcl" + VALUE "ProductVersion", DOTVERSION + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +<< + + !ifndef DISABLE_IMPLICIT_RULES # Implicit rule definitions - only for building library objects. For stubs and # main application, the master makefile should define explicit rules. @@ -1429,6 +1464,9 @@ $< {$(WINDIR)}.rc{$(TMP_DIR)}.res: $(MAKERESCMD) +{$(TMP_DIR)}.rc{$(TMP_DIR)}.res: + $(MAKERESCMD) + .SUFFIXES: .SUFFIXES:.c .rc diff --git a/win/tcl.rc b/win/tcl.rc index be5e0a7..2ca6015 100644 --- a/win/tcl.rc +++ b/win/tcl.rc @@ -4,24 +4,6 @@ #include #include -// -// build-up the name suffix that defines the type of build this is. -// -#if TCL_THREADS -#define SUFFIX_THREADS "t" -#else -#define SUFFIX_THREADS "" -#endif - -#if DEBUG && !UNCHECKED -#define SUFFIX_DEBUG "g" -#else -#define SUFFIX_DEBUG "" -#endif - -#define SUFFIX SUFFIX_THREADS SUFFIX_DEBUG - - LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */ VS_VERSION_INFO VERSIONINFO @@ -42,7 +24,7 @@ BEGIN BLOCK "040904b0" /* LANG_ENGLISH/SUBLANG_ENGLISH_US, Unicode CP */ BEGIN VALUE "FileDescription", "Tcl DLL\0" - VALUE "OriginalFilename", "tcl" STRINGIFY(TCL_MAJOR_VERSION) STRINGIFY(TCL_MINOR_VERSION) SUFFIX ".dll\0" + VALUE "OriginalFilename", PRJLIBNAME VALUE "CompanyName", "ActiveState Corporation\0" VALUE "FileVersion", TCL_PATCH_LEVEL VALUE "LegalCopyright", "Copyright \251 2001 by ActiveState Corporation, et al\0" -- cgit v0.12 From f4e4349cadfc93b252489357206f87c5ebfea419 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sun, 8 Oct 2017 14:25:19 +0000 Subject: Fix htmlhelp generation on 64-bit systems --- win/makefile.vc | 11 +++++------ win/rules.vc | 12 ------------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index dfbf961..62e3fa7 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -613,13 +613,12 @@ gentommath_h: # Build the Windows HTML help file. #--------------------------------------------------------------------- -# NOTE: you can define HHC on the command-line to override this -!ifndef HHC -!if exist("$(PROGRAMFILES_X86)\HTML Help Workshop\hhc.exe") -HHC=$(PROGRAMFILES_X86)\HTML Help Workshop\hhc.exe +# NOTE: you can define HHC on the command-line to override this. +# nmake does not set macro values if already set on the command line. +!if defined(PROCESSOR_ARCHITECTURE) && "$(PROCESSOR_ARCHITECTURE)" == "AMD64" +HHC="%ProgramFiles(x86)%\HTML Help Workshop\hhc.exe" !else -HHC=hhc.exe -!endif +HHC="%ProgramFiles%\HTML Help Workshop\hhc.exe" !endif HTMLDIR=$(OUT_DIR)\html HTMLBASE=TclTk$(VERSION) diff --git a/win/rules.vc b/win/rules.vc index d5952fd..6ab58f6 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -98,18 +98,6 @@ CPY = xcopy /i /y >NUL COPY = copy /y >NUL MKDIR = mkdir -# The ProgramFiles(x86) environment variable is not accessible -# from nmake since it has the parenthesis which nmake does not like -# within a macro name. So define our own in terms of the -# ProgramFiles environment variable. -# Note: env variables are always UPPER CASE in nmake -!if defined(PROCESSOR_ARCHITECTURE) && "$(PROCESSOR_ARCHITECTURE)" == "AMD64" -PROGRAMFILES_X86 = $(PROGRAMFILES) (x86) -!else -PROGRAMFILES_X86 = $(PROGRAMFILES) -!endif - - ###################################################################### # 2. Figure out our build environment in terms of what we're building. # -- cgit v0.12 From 0c646bc3d1d73a89e9a196dec828b447f224535d Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sun, 8 Oct 2017 16:12:23 +0000 Subject: Fix RC template dependency to not generate it every time --- win/rules.vc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/win/rules.vc b/win/rules.vc index 6ab58f6..d970755 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1390,7 +1390,9 @@ default-setup: @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) -default-rc: +default-rc: $(TMP_DIR)\$(PROJECT).rc + +$(TMP_DIR)\$(PROJECT).rc: @$(COPY) << $(TMP_DIR)\$(PROJECT).rc #include -- cgit v0.12 From b8e5e2909ee8607f2351ffc9a72c114dfb571e6b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 9 Oct 2017 12:52:14 +0000 Subject: Add visual-studio related entries to ignore-glob. Taken over from reform-vc branch --- .fossil-settings/ignore-glob | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob index 9ed86b1..c85b488 100644 --- a/.fossil-settings/ignore-glob +++ b/.fossil-settings/ignore-glob @@ -6,6 +6,7 @@ *.lib *.o *.obj +*.pdb *.res *.sl *.so @@ -17,8 +18,31 @@ */tclsh* */tcltest* */versions.vc +*/version.vc +html +libtommath/bn.ilg +libtommath/bn.ind +libtommath/pretty.build +libtommath/tommath.src +libtommath/*.pdf +libtommath/*.pl +libtommath/*.sh +libtommath/tombc/* +libtommath/pre_gen/* +libtommath/pics/* +libtommath/mtest/* +libtommath/logs/* +libtommath/etc/* +libtommath/demo/* +libtommath/*.out +libtommath/*.tex +unix/autoMkindex.tcl unix/dltest.marker unix/tcl.pc +unix/tclIndex unix/pkgs/* +win/Debug* +win/Release* win/pkgs/* win/tcl.hpj +win/nmhlp-out.txt -- cgit v0.12 From 15a7950c9ec165ae183a8455436e57ccf23afb1c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 9 Oct 2017 14:23:39 +0000 Subject: In nmakehlp -v, return non-0 exit code if version is not found. (taken from vc-reform branch) --- win/nmakehlp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 22b7b06..0439d1c 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -74,6 +74,7 @@ main( char msg[300]; DWORD dwWritten; int chars; + char *s; /* * Make sure children (cl.exe and link.exe) are kept quiet. @@ -153,8 +154,13 @@ main( &dwWritten, NULL); return 0; } - printf("%s\n", GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0')); - return 0; + s = GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0'); + if (s && *s) { + printf("%s\n", s); + return 0; + } else + return 1; /* Version not found. Return non-0 exit code */ + case 'Q': if (argc != 3) { chars = snprintf(msg, sizeof(msg) - 1, -- cgit v0.12 From e7582d10c6c53ea496551d815b3fb83bf984fd02 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 12 Oct 2017 15:20:42 +0000 Subject: Eliminate variable which is only used once. And a minor end-of-line space reduction. No functional change. --- win/tclWinFCmd.c | 4 +--- win/tclWinLoad.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 01af950..319ecf9 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -1611,13 +1611,11 @@ ConvertFileNameFormat( for (i = 0; i < pathc; i++) { Tcl_Obj *elt; char *pathv; - size_t pathLen; Tcl_ListObjIndex(NULL, splitPath, i, &elt); pathv = TclGetString(elt); - pathLen = elt->length; - if ((pathv[0] == '/') || ((pathLen == 3) && (pathv[1] == ':')) + if ((pathv[0] == '/') || ((elt->length == 3) && (pathv[1] == ':')) || (strcmp(pathv, ".") == 0) || (strcmp(pathv, "..") == 0)) { /* * Handle "/", "//machine/export", "c:/", "." or ".." by just diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 3ad6328..27eb8f3 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -85,7 +85,7 @@ TclpDlopen( Tcl_DString ds; - /* + /* * Remember the first error on load attempt to be used if the * second load attempt below also fails. */ -- cgit v0.12 From 5015dd8a1f1a346f1105d9d31a21ab7c496746c9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 13 Oct 2017 14:46:26 +0000 Subject: Fix missing line (after manual merge-conflict). Fix compiler warning on linux64. --- generic/tcl.h | 6 +++++- generic/tclStringObj.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/generic/tcl.h b/generic/tcl.h index b847fef..5c32781 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -424,7 +424,11 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; # define TCL_LL_MODIFIER "ll" #endif /* !TCL_LL_MODIFIER */ #ifndef TCL_Z_MODIFIER -# define TCL_Z_MODIFIER "" +# if defined(__GNUC__) && !defined(_WIN32) +# define TCL_Z_MODIFIER "z" +# else +# define TCL_Z_MODIFIER "" +# endif #endif /* !TCL_Z_MODIFIER */ #define Tcl_WideAsLong(val) ((long)((Tcl_WideInt)(val))) #define Tcl_LongAsWide(val) ((Tcl_WideInt)((long)(val))) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 6d065c3..98f4755 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2028,6 +2028,7 @@ Tcl_AppendFormatToObj( if (gotHash || (ch == 'p')) { switch (ch) { case 'o': + Tcl_AppendToObj(segment, "0o", 2); segmentLimit -= 2; break; case 'p': -- cgit v0.12 From 8a910c1a53dec36b9d3dd4b7a378017251c3ef56 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 13 Oct 2017 16:15:52 +0000 Subject: Plug some memleaks. --- generic/tclDictObj.c | 2 ++ generic/tclStringObj.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index c82f88a..1c74c5f 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -2331,7 +2331,9 @@ DictAppendCmd( valuePtr = Tcl_DuplicateObj(valuePtr); } + Tcl_IncrRefCount(appendObjPtr); Tcl_AppendObjToObj(valuePtr, appendObjPtr); + Tcl_DecrRefCount(appendObjPtr); } Tcl_DictObjPut(NULL, dictPtr, objv[2], valuePtr); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 59758bb..7c1d42b 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3102,6 +3102,7 @@ TclStringCatObjv( /* Ugly interface! No scheme to init array size. */ objResultPtr = Tcl_NewUnicodeObj(&ch, 0); /* PANIC? */ if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { + Tcl_DecrRefCount(objResultPtr); if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "concatenation failed: unable to alloc %" @@ -3149,6 +3150,7 @@ TclStringCatObjv( } else { objResultPtr = Tcl_NewObj(); /* PANIC? */ if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { + Tcl_DecrRefCount(objResultPtr); if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "concatenation failed: unable to alloc %u bytes", -- cgit v0.12 From a72fed191ebed3ff0a7a22b976155f08082c9fdf Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 14 Oct 2017 22:52:26 +0000 Subject: fix unixFCmd test-cases, as result of the octal behavior change --- tests/unixFCmd.test | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/unixFCmd.test b/tests/unixFCmd.test index 183c145..08eb664 100644 --- a/tests/unixFCmd.test +++ b/tests/unixFCmd.test @@ -221,12 +221,12 @@ test unixFCmd-2.5 {TclpCopyFile: copy attributes} -setup { cleanup } -constraints {unix notRoot} -body { close [open tf1 a] - file attributes tf1 -permissions 0472 + file attributes tf1 -permissions 0o472 file copy tf1 tf2 file attributes tf2 -permissions } -cleanup { cleanup -} -result 00472 ;# i.e. perms field of [exec ls -l tf2] is -r--rwx-w- +} -result 0o472 ;# i.e. perms field of [exec ls -l tf2] is -r--rwx-w- test unixFCmd-3.1 {CopyFile not done} {emptyTest unix notRoot} { } {} @@ -375,11 +375,11 @@ proc permcheck {testnum permList expected} { set result } $expected } -permcheck unixFCmd-17.5 rwxrwxrwx 00777 -permcheck unixFCmd-17.6 r--r---w- 00442 -permcheck unixFCmd-17.7 {0 u+rwx,g+r u-w o+rwx} {00000 00740 00540 00547} -permcheck unixFCmd-17.11 --x--x--x 00111 -permcheck unixFCmd-17.12 {0 a+rwx} {00000 00777} +permcheck unixFCmd-17.5 rwxrwxrwx 0o777 +permcheck unixFCmd-17.6 r--r---w- 0o442 +permcheck unixFCmd-17.7 {0 u+rwx,g+r u-w o+rwx} {00000 0o740 0o540 0o547} +permcheck unixFCmd-17.11 --x--x--x 0o111 +permcheck unixFCmd-17.12 {0 a+rwx} {00000 0o777} file delete -force -- foo.test test unixFCmd-18.1 {Unix pwd} -constraints {unix notRoot nonPortable} -setup { -- cgit v0.12 From 823edbf0abc533041ff6a572705fbafd4cbe5cfd Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sun, 15 Oct 2017 06:58:20 +0000 Subject: Permit application makefile to define RCFILE. Change PROJECT_REQUIRES_TK to use value instead of ifdef. Change MAKERESCMD macro not to specify included input files. --- win/makefile.vc | 3 +++ win/rules.vc | 54 ++++++++++++++++++++++++++++++++++-------------------- win/targets.vc | 2 +- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 62e3fa7..09b0b9f 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -173,6 +173,9 @@ PROJECT = tcl # rules.vc file will set up "all" as the target. DEFAULT_BUILD_TARGET = release +# We want to use our own resource file, not the standard template one. +RCFILE = tcl.rc + # The rules.vc file does most of the hard work in terms of defining # the build configuration, macros, output directories etc. !include "rules.vc" diff --git a/win/rules.vc b/win/rules.vc index d970755..d9bb95d 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -32,6 +32,10 @@ DOING_TCL = 1 DOING_TK = 1 !endif +!ifndef(PROJECT_REQUIRES_TK) +PROJECT_REQUIRES_TK = 0 +!endif + ################################################################ # Nmake is a pretty weak environment in syntax and capabilities # so this file is necessarily verbose. It's broken down into @@ -75,14 +79,6 @@ Visual C++ compiler environment not initialized. !error $(MSG) !endif -# Defaults for built-in internal settings defined in parent makefile -!ifndef DISABLE_STANDARD_TARGETS -DISABLE_STANDARD_TARGETS = 0 -!endif -!ifndef DISABLE_CLEAN_TARGETS -DISABLE_CLEAN_TARGETS = 0 -!endif - ################################################################ # 1. Define external programs being used @@ -167,6 +163,7 @@ WINDIR = $(ROOT)\win !ifndef RCDIR RCDIR = $(WINDIR)\rc !endif +RCDIR = $(RCDIR:/=\) # The target directory where the built packages and binaries will be installed. # INSTALLDIR is the (optional) path specified by the user. @@ -176,7 +173,7 @@ RCDIR = $(WINDIR)\rc _INSTALLDIR = $(INSTALLDIR:/=\) !else ### Assume the normal default. -_INSTALLDIR = C:\Program Files\Tcl +_INSTALLDIR = $(HOMEDRIVE)\Tcl !endif !if $(DOING_TCL) @@ -248,7 +245,7 @@ Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and defa !endif # Now do the same to locate Tk headers and libs if project requires Tk -!ifdef PROJECT_REQUIRES_TK +!if $(PROJECT_REQUIRES_TK) !ifdef TKDIR @@ -887,6 +884,7 @@ VERSION = $(DOTVERSION:.=) # PRJLIB - output path of generated project library # PRJSTUBLIBNAME - name of the generated project stubs library # PRJSTUBLIB - output path of the generated project stubs library +# RESFILE - output resource file (only if not static build) SUFX = tsgx @@ -1003,7 +1001,7 @@ TCLSH_NATIVE = $(TCLSH) !endif # Do the same for Tk and Tk extensions that require the Tk libraries -!if $(DOING_TK) || defined(PROJECT_REQUIRES_TK) +!if $(DOING_TK) || $(PROJECT_REQUIRES_TK) WISHNAMEPREFIX = wish WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT) @@ -1032,7 +1030,7 @@ TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" !endif # TKINSTALL !endif # $(DOING_TK) -!endif # $(DOING_TK) || PROJECT_REQUIRES_TK +!endif # $(DOING_TK) || $(PROJECT_REQUIRES_TK) # Various output paths PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib @@ -1042,6 +1040,16 @@ PRJLIB = $(OUT_DIR)\$(PRJLIBNAME) PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME) +# If extension parent makefile has not defined a resource definition file, +# we will generate one from standard template. +!if !$(DOING_TCL) && !$(DOING_TK) && !$(STATIC_BUILD) +!ifdef RCFILE +RESFILE = $(RCFILE:.rc=.res) +!else +RESFILE = $(TMP_DIR)\$(PROJECT).res +!endif +!endif + ################################################################### # 11. Construct the paths for the installation directories # The following macros get defined in this section: @@ -1124,7 +1132,7 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED # test targets in tk do not use stubs !if ! $(DOING_TCL) USE_STUBS_DEFS = -DUSE_TCL_STUBS -DUSE_TCLOO_STUBS -!ifdef PROJECT_REQUIRES_TK +!if $(PROJECT_REQUIRES_TK) USE_STUBS_DEFS = $(USE_STUBS_DEFS) -DUSE_TK_STUBS !endif !endif @@ -1328,9 +1336,7 @@ MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ -DVERSION=\"$(VERSION)\" \ -DSUFX=\"$(SUFX)\" \ -DPROJECT=\"$(PROJECT)\" \ - -DPRJLIBNAME=\"$(PRJLIBNAME)\" \ - $< - + -DPRJLIBNAME=\"$(PRJLIBNAME)\" !ifndef DEFAULT_BUILD_TARGET DEFAULT_BUILD_TARGET = $(PROJECT) @@ -1390,7 +1396,10 @@ default-setup: @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) -default-rc: $(TMP_DIR)\$(PROJECT).rc +!ifndef RCFILE +# If parent makefile has not defined a resource definition file, +# we will generate one from standard template. +$(TMP_DIR)\$(PROJECT).res: $(TMP_DIR)\$(PROJECT).rc $(TMP_DIR)\$(PROJECT).rc: @$(COPY) << $(TMP_DIR)\$(PROJECT).rc @@ -1428,8 +1437,13 @@ END << +!endif # ifndef RCFILE !ifndef DISABLE_IMPLICIT_RULES +DISABLE_IMPLICIT_RULES = 0 +!endif + +!if $(DISABLE_IMPLICIT_RULES) # Implicit rule definitions - only for building library objects. For stubs and # main application, the master makefile should define explicit rules. @@ -1449,13 +1463,13 @@ $< << {$(RCDIR)}.rc{$(TMP_DIR)}.res: - $(MAKERESCMD) + $(MAKERESCMD) $< {$(WINDIR)}.rc{$(TMP_DIR)}.res: - $(MAKERESCMD) + $(MAKERESCMD) $< {$(TMP_DIR)}.rc{$(TMP_DIR)}.res: - $(MAKERESCMD) + $(MAKERESCMD) $< .SUFFIXES: .SUFFIXES:.c .rc diff --git a/win/targets.vc b/win/targets.vc index 6844045..84ce2a4 100644 --- a/win/targets.vc +++ b/win/targets.vc @@ -6,7 +6,7 @@ $(PROJECT): setup pkgindex $(PRJLIB) # MAKEBINCMD will do shared, static and debug links as appropriate # _VC_MANIFEST_EMBED_DLL embeds the manifest for shared libraries # and is a no-op for static libraries -$(PRJLIB): $(PRJ_OBJS) +$(PRJLIB): $(PRJ_OBJS) $(RESFILE) $(MAKEBINCMD) $** $(_VC_MANIFEST_EMBED_DLL) -@del $*.exp -- cgit v0.12 From 237b4d22a295dc64ee912a86d34cf1d178a07363 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 16 Oct 2017 11:55:57 +0000 Subject: Add support for 'L' length modifier (either long double or mp_int) and 'a'/'A' modifiers (floating point in hex notation) --- generic/tclStringObj.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 98f4755..084a6c9 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2534,15 +2534,26 @@ AppendPrintfToObjVA( Tcl_ListObjAppendElement(NULL, list, Tcl_NewWideIntObj( va_arg(argList, Tcl_WideInt))); break; + case 3: + Tcl_ListObjAppendElement(NULL, list, Tcl_NewBignumObj( + va_arg(argList, mp_int *))); + break; } break; + case 'a': + case 'A': case 'e': case 'E': case 'f': case 'g': case 'G': + if (size > 0) { Tcl_ListObjAppendElement(NULL, list, Tcl_NewDoubleObj( - va_arg(argList, double))); + (double)va_arg(argList, long double))); + } else { + Tcl_ListObjAppendElement(NULL, list, Tcl_NewDoubleObj( + va_arg(argList, double))); + } seekingConversion = 0; break; case '*': @@ -2562,7 +2573,6 @@ AppendPrintfToObjVA( gotPrecision = 1; p++; break; - /* TODO: support for bignum arguments */ case 'l': ++size; p++; @@ -2590,6 +2600,10 @@ AppendPrintfToObjVA( } p++; break; + case 'L': + size = 3; + p++; + break; case 'h': size = -1; default: -- cgit v0.12 From 4ef03a89506970e90d30b6b7c14ac1a6143b1161 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Mon, 16 Oct 2017 12:46:53 +0000 Subject: Fixed reversed check for implicit rules --- win/rules.vc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index d9bb95d..3a37856 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -32,7 +32,7 @@ DOING_TCL = 1 DOING_TK = 1 !endif -!ifndef(PROJECT_REQUIRES_TK) +!ifndef PROJECT_REQUIRES_TK PROJECT_REQUIRES_TK = 0 !endif @@ -845,9 +845,9 @@ VERSION = $(TK_VERSION) # first from a configure.in file, and then from configure.ac !ifndef DOTVERSION !if [echo DOTVERSION = \> versions.vc] \ - || [nmakehlp -V ..\configure.in AC_INIT >> versions.vc] + || [nmakehlp -V $(ROOT)\configure.in AC_INIT >> versions.vc] !if [echo DOTVERSION = \> versions.vc] \ - || [nmakehlp -V ..\configure.ac AC_INIT >> versions.vc] + || [nmakehlp -V $(ROOT)\configure.ac AC_INIT >> versions.vc] !error *** Could not figure out extension version. Please define DOTVERSION in parent makefile before including rules.vc. !endif !endif @@ -1443,7 +1443,7 @@ END DISABLE_IMPLICIT_RULES = 0 !endif -!if $(DISABLE_IMPLICIT_RULES) +!if !$(DISABLE_IMPLICIT_RULES) # Implicit rule definitions - only for building library objects. For stubs and # main application, the master makefile should define explicit rules. -- cgit v0.12 From b6f90aaf1f3d7f67c39f358e9835f6cfb4f53a9a Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 17 Oct 2017 15:01:56 +0000 Subject: Add PRJ_MANIFEST to support manifest generation. --- win/targets.vc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/win/targets.vc b/win/targets.vc index 84ce2a4..56b6427 100644 --- a/win/targets.vc +++ b/win/targets.vc @@ -1,6 +1,13 @@ #------------------------------------------------------------- -*- makefile -*- $(PROJECT): setup pkgindex $(PRJLIB) +!ifdef PRJ_MANIFEST +$(PROJECT): $(PRJLIB).manifest +$(PRJLIB).manifest: $(PRJ_MANIFEST) + @nmakehlp -s << $** >$@ +@MACHINE@ $(MACHINE:IX86=X86) +<< +!endif !if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk" # MAKEBINCMD will do shared, static and debug links as appropriate -- cgit v0.12 From 63a9fcf2e7aefe28c1dd7aeb985434addfd43013 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Wed, 18 Oct 2017 16:03:08 +0000 Subject: Fix resource file compilation when makefile specifies PRJ_RCFILE --- win/rules.vc | 64 ++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 3a37856..852b1eb 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -91,6 +91,7 @@ Visual C++ compiler environment not initialized. RMDIR = rmdir /S /Q ERRNULL = 2>NUL CPY = xcopy /i /y >NUL +CPYDIR = xcopy /e /i /y >NUL COPY = copy /y >NUL MKDIR = mkdir @@ -161,7 +162,11 @@ DEMODIR = $(ROOT)\demos # something else WINDIR = $(ROOT)\win !ifndef RCDIR +!if exist("$(WINDIR)\rc") RCDIR = $(WINDIR)\rc +!else +RCDIR = $(WINDIR) +!endif !endif RCDIR = $(RCDIR:/=\) @@ -845,9 +850,9 @@ VERSION = $(TK_VERSION) # first from a configure.in file, and then from configure.ac !ifndef DOTVERSION !if [echo DOTVERSION = \> versions.vc] \ - || [nmakehlp -V $(ROOT)\configure.in AC_INIT >> versions.vc] + || [nmakehlp -V $(ROOT)\configure.in ^[$(PROJECT)^] >> versions.vc] !if [echo DOTVERSION = \> versions.vc] \ - || [nmakehlp -V $(ROOT)\configure.ac AC_INIT >> versions.vc] + || [nmakehlp -V $(ROOT)\configure.ac ^[$(PROJECT)^] >> versions.vc] !error *** Could not figure out extension version. Please define DOTVERSION in parent makefile before including rules.vc. !endif !endif @@ -1028,6 +1033,7 @@ TKSTUBLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME) TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME) TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" !endif # TKINSTALL +tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)" !endif # $(DOING_TK) !endif # $(DOING_TK) || $(PROJECT_REQUIRES_TK) @@ -1043,8 +1049,8 @@ PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME) # If extension parent makefile has not defined a resource definition file, # we will generate one from standard template. !if !$(DOING_TCL) && !$(DOING_TK) && !$(STATIC_BUILD) -!ifdef RCFILE -RESFILE = $(RCFILE:.rc=.res) +!ifdef PRJ_RCFILE +RESFILE = $(TMP_DIR)\$(PRJ_RCFILE:.rc=.res) !else RESFILE = $(TMP_DIR)\$(PROJECT).res !endif @@ -1228,6 +1234,11 @@ cwarn = $(cwarn) -wd4311 -wd4312 cwarn = $(cwarn) -WX !endif +INCLUDES = $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) +!if !$(DOING_TCL) && !$(DOING_TK) +INCLUDES = $(INCLUDES) -I$(GENERICDIR) -I$(WINDIR) -I(COMPATDIR) +!endif + # These flags are defined roughly in the order of the pre-reform # rules.vc/makefile.vc to help visually compare that the pre- and # post-reform build logs @@ -1241,8 +1252,8 @@ cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug) # BUILD_$(PROJECT) macro which should be defined only for the shared # library *implementation* and not for its caller interface -appcflags = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) $(USE_STUBS_DEFS) -appcflags_nostubs = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) +appcflags = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) $(USE_STUBS_DEFS) +appcflags_nostubs = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) pkgcflags = $(appcflags) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) @@ -1251,8 +1262,11 @@ pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) # $(OPTDEFINES) only if the OPTS configuration indicates a static # library. However the stubs library is ALWAYS static hence included # here irrespective of the OPTS setting. - -stubscflags = $(cflags) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) +# +# TBD - tclvfs has a comment that stubs libs should not be compiled with -GL +# without stating why. Tcl itself compiled stubs libs with this flag. +# so we do not remove it from cflags. +stubscflags = $(cflags) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(INCLUDES) # Link flags @@ -1301,6 +1315,10 @@ guilflags = $(lflags) -subsystem:windows # Extensions should define any additional libraries with $(PRJ_LIBS) winlibs = kernel32.lib advapi32.lib +!if $(PROJECT_REQUIRES_TK) +winlibs = $(winlibs) gdi32.lib user32.lib uxtheme.lib +!endif + # Avoid 'unresolved external symbol __security_cookie' errors. # c.f. http://support.microsoft.com/?id=894573 !if "$(MACHINE)" == "AMD64" @@ -1319,15 +1337,15 @@ baselibs = $(baselibs) ucrt.lib # 3. Define standard commands, common make targets and implicit rules MAKELIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ -MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) +MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) !if $(STATIC_BUILD) MAKEBINCMD = $(MAKELIBCMD) !else MAKEBINCMD = $(MAKEDLLCMD) !endif -MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) -MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) +MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) +MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ $(TCL_INCLUDES) \ -DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ @@ -1369,6 +1387,21 @@ default-install-libraries: $(OUT_DIR)\pkgIndex.tcl @echo Installing package index in '$(SCRIPT_INSTALL_DIR)' @$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR) +default-install-html: + @echo Installing documentation files to '$(DOC_INSTALL_DIR)' + @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" + @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css") do @$(COPY) %f "$(DOC_INSTALL_DIR)" + +default-install-man: + @echo Installing documentation files to '$(DOC_INSTALL_DIR)' + @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" + @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.n") do @$(COPY) %f "$(DOC_INSTALL_DIR)" + +default-install-demos: + @echo Installing demos to '$(DEMO_INSTALL_DIR)' + @if not exist "$(DEMO_INSTALL_DIR)" mkdir "$(DEMO_INSTALL_DIR)" + @if exist $(DEMODIR) $(CPYDIR) "$(DEMODIR)" "$(DEMO_INSTALL_DIR)" + default-clean: @echo Cleaning $(TMP_DIR)\* ... @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR) @@ -1396,7 +1429,12 @@ default-setup: @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) -!ifndef RCFILE +!ifdef PRJ_RCFILE + +$(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc + $(MAKERESCMD) $** +!else + # If parent makefile has not defined a resource definition file, # we will generate one from standard template. $(TMP_DIR)\$(PROJECT).res: $(TMP_DIR)\$(PROJECT).rc @@ -1437,7 +1475,7 @@ END << -!endif # ifndef RCFILE +!endif # ifdef PRJ_RCFILE !ifndef DISABLE_IMPLICIT_RULES DISABLE_IMPLICIT_RULES = 0 -- cgit v0.12 From fa7141288f0899b531d7dc94763423094be8608d Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Wed, 18 Oct 2017 16:04:13 +0000 Subject: Update RCFILE to PRJ_RCFILE. --- win/makefile.vc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/makefile.vc b/win/makefile.vc index 09b0b9f..675d8fc 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -174,7 +174,7 @@ PROJECT = tcl DEFAULT_BUILD_TARGET = release # We want to use our own resource file, not the standard template one. -RCFILE = tcl.rc +PRJ_RCFILE = tcl.rc # The rules.vc file does most of the hard work in terms of defining # the build configuration, macros, output directories etc. -- cgit v0.12 From 69030a86c83b4982c53feaaa0e46e5d235abb665 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 18 Oct 2017 18:23:38 +0000 Subject: [1a56550e96] Mixins aren't being searched correctly by [info class methods -all] --- tests/oo.test | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/oo.test b/tests/oo.test index 5eaa8bf..3a6d2d1 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -3799,7 +3799,29 @@ test oo-35.4 {Bug 593baa032c: mixins list teardown} { oo::class create D {mixin B} namespace eval [info object namespace D] [list [namespace which B] destroy] } {} - +test oo-35.5 {Bug } -setup { + oo::class create base { + unexport destroy + } +} -body { + oo::class create C { + superclass base + method c {} {} + } + oo::class create D { + superclass base + mixin C + method d {} {} + } + oo::class create E { + superclass D + method e {} {} + } + E create e1 + list [lsort [info class methods E -all]] [lsort [info object methods e1 -all]] +} -cleanup { + base destroy +} -result {{c d e} {c d e}} cleanupTests return -- cgit v0.12 From 252f75d8c8a95ffa59c91a4ed54881d09a72e137 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 19 Oct 2017 09:22:05 +0000 Subject: Ensure that method list introspection finds methods from mixins in all cases. Use better approach for preventing excessive iteration. --- generic/tclOOCall.c | 75 +++++++++++++++++++++++++++++++++++++++-------------- tests/oo.test | 2 +- 2 files changed, 57 insertions(+), 20 deletions(-) diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index ac0b94d..e449893 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -53,7 +53,8 @@ static void AddClassFiltersToCallContext(Object *const oPtr, Class *clsPtr, struct ChainBuilder *const cbPtr, Tcl_HashTable *const doneFilters, int flags); static void AddClassMethodNames(Class *clsPtr, const int flags, - Tcl_HashTable *const namesPtr); + Tcl_HashTable *const namesPtr, + Tcl_HashTable *const examinedClassesPtr); static inline void AddMethodToCallChain(Method *const mPtr, struct ChainBuilder *const cbPtr, Tcl_HashTable *const doneFilters, @@ -367,6 +368,10 @@ TclOOGetSortedMethodList( { Tcl_HashTable names; /* Tcl_Obj* method name to "wanted in list" * mapping. */ + Tcl_HashTable examinedClasses; + /* Used to track what classes have been looked + * at. Is set-like in nature and keyed by + * pointer to class. */ FOREACH_HASH_DECLS; int i; Class *mixinPtr; @@ -376,6 +381,7 @@ TclOOGetSortedMethodList( void *isWanted; Tcl_InitObjHashTable(&names); + Tcl_InitHashTable(&examinedClasses, TCL_ONE_WORD_KEYS); /* * Name the bits used in the names table values. @@ -436,11 +442,14 @@ TclOOGetSortedMethodList( * hierarchy. */ - AddClassMethodNames(oPtr->selfCls, flags, &names); + AddClassMethodNames(oPtr->selfCls, flags, &names, &examinedClasses); FOREACH(mixinPtr, oPtr->mixins) { - AddClassMethodNames(mixinPtr, flags|TRAVERSED_MIXIN, &names); + AddClassMethodNames(mixinPtr, flags|TRAVERSED_MIXIN, &names, + &examinedClasses); } + Tcl_DeleteHashTable(&examinedClasses); + /* * See how many (visible) method names there are. If none, we do not (and * should not) try to sort the list of them. @@ -495,18 +504,24 @@ TclOOGetSortedClassMethodList( { Tcl_HashTable names; /* Tcl_Obj* method name to "wanted in list" * mapping. */ + Tcl_HashTable examinedClasses; + /* Used to track what classes have been looked + * at. Is set-like in nature and keyed by + * pointer to class. */ FOREACH_HASH_DECLS; int i; Tcl_Obj *namePtr; void *isWanted; Tcl_InitObjHashTable(&names); + Tcl_InitHashTable(&examinedClasses, TCL_ONE_WORD_KEYS); /* * Process method names from the class hierarchy and the mixin hierarchy. */ - AddClassMethodNames(clsPtr, flags, &names); + AddClassMethodNames(clsPtr, flags, &names, &examinedClasses); + Tcl_DeleteHashTable(&examinedClasses); /* * See how many (visible) method names there are. If none, we do not (and @@ -581,39 +596,48 @@ AddClassMethodNames( Class *clsPtr, /* Class to get method names from. */ const int flags, /* Whether we are interested in just the * public method names. */ - Tcl_HashTable *const namesPtr) + Tcl_HashTable *const namesPtr, /* Reference to the hash table to put the * information in. The hash table maps the * Tcl_Obj * method name to an integral value * describing whether the method is wanted. * This ensures that public/private override - * semantics are handled correctly.*/ + * semantics are handled correctly. */ + Tcl_HashTable *const examinedClassesPtr) + /* Hash table that tracks what classes have + * already been looked at. The keys are the + * pointers to the classes, and the values are + * immaterial. */ { /* + * If we've already started looking at this class, stop working on it now + * to prevent repeated work. + */ + + if (Tcl_FindHashEntry(examinedClassesPtr, (char *) clsPtr)) { + return; + } + + /* * Scope all declarations so that the compiler can stand a good chance of * making the recursive step highly efficient. We also hand-implement the * tail-recursive case using a while loop; C compilers typically cannot do * tail-recursion optimization usefully. */ - if (clsPtr->mixins.num != 0) { - Class *mixinPtr; - int i; - - /* TODO: Beware of infinite loops! */ - FOREACH(mixinPtr, clsPtr->mixins) { - AddClassMethodNames(mixinPtr, flags|TRAVERSED_MIXIN, namesPtr); - } - } - while (1) { FOREACH_HASH_DECLS; Tcl_Obj *namePtr; Method *mPtr; + int isNew; - FOREACH_HASH(namePtr, mPtr, &clsPtr->classMethods) { - int isNew; + (void) Tcl_CreateHashEntry(examinedClassesPtr, (char *) clsPtr, + &isNew); + if (!isNew) { + break; + } + FOREACH_HASH(namePtr, mPtr, &clsPtr->classMethods) { hPtr = Tcl_CreateHashEntry(namesPtr, (char *) namePtr, &isNew); if (isNew) { int isWanted = (!(flags & PUBLIC_METHOD) @@ -630,6 +654,18 @@ AddClassMethodNames( } } + if (clsPtr->mixins.num != 0) { + Class *mixinPtr; + int i; + + FOREACH(mixinPtr, clsPtr->mixins) { + if (mixinPtr != clsPtr) { + AddClassMethodNames(mixinPtr, flags|TRAVERSED_MIXIN, + namesPtr, examinedClassesPtr); + } + } + } + if (clsPtr->superclasses.num != 1) { break; } @@ -640,7 +676,8 @@ AddClassMethodNames( int i; FOREACH(superPtr, clsPtr->superclasses) { - AddClassMethodNames(superPtr, flags, namesPtr); + AddClassMethodNames(superPtr, flags, namesPtr, + examinedClassesPtr); } } } diff --git a/tests/oo.test b/tests/oo.test index 3a6d2d1..1ac6f37 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -3799,7 +3799,7 @@ test oo-35.4 {Bug 593baa032c: mixins list teardown} { oo::class create D {mixin B} namespace eval [info object namespace D] [list [namespace which B] destroy] } {} -test oo-35.5 {Bug } -setup { +test oo-35.5 {Bug 1a56550e96: introspectors must traverse mixin links correctly} -setup { oo::class create base { unexport destroy } -- cgit v0.12 From df974e71f99feff44f12a02e66281948465d32ec Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 19 Oct 2017 09:28:16 +0000 Subject: Oops; put the code in the wrong place. Mixins have priority when deciding method visibility. --- generic/tclOOCall.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index e449893..3e4f561 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -637,6 +637,18 @@ AddClassMethodNames( break; } + if (clsPtr->mixins.num != 0) { + Class *mixinPtr; + int i; + + FOREACH(mixinPtr, clsPtr->mixins) { + if (mixinPtr != clsPtr) { + AddClassMethodNames(mixinPtr, flags|TRAVERSED_MIXIN, + namesPtr, examinedClassesPtr); + } + } + } + FOREACH_HASH(namePtr, mPtr, &clsPtr->classMethods) { hPtr = Tcl_CreateHashEntry(namesPtr, (char *) namePtr, &isNew); if (isNew) { @@ -654,18 +666,6 @@ AddClassMethodNames( } } - if (clsPtr->mixins.num != 0) { - Class *mixinPtr; - int i; - - FOREACH(mixinPtr, clsPtr->mixins) { - if (mixinPtr != clsPtr) { - AddClassMethodNames(mixinPtr, flags|TRAVERSED_MIXIN, - namesPtr, examinedClassesPtr); - } - } - } - if (clsPtr->superclasses.num != 1) { break; } -- cgit v0.12 From 6f23316c4abdd3a5605d3aa6b558639095d75650 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Fri, 20 Oct 2017 15:32:22 +0000 Subject: Added test and shell targets. --- win/makefile.vc | 9 --------- win/rules.vc | 36 +++++++++++++++++++++++++++++++++--- win/targets.vc | 20 +++++++++++++++++++- 3 files changed, 52 insertions(+), 13 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 675d8fc..d09b187 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -485,19 +485,10 @@ setup: default-setup test: test-core test-pkgs test-core: setup $(TCLTEST) dlls $(CAT32) set TCL_LIBRARY=$(ROOT:\=/)/library -!if "$(OS)" == "Windows_NT" || "$(MSVCDIR)" == "IDE" $(DEBUGGER) $(TCLTEST) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS) -loadfile << package ifneeded dde 1.4.0 [list load "$(TCLDDELIB:\=/)" dde] package ifneeded registry 1.3.2 [list load "$(TCLREGLIB:\=/)" registry] << -!else - @echo Please wait while the tests are collected... - $(TCLTEST) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS) -loadfile << > tests.log - package ifneeded dde 1.4.0 "$(TCLDDELIB:\=/)" dde] - package ifneeded registry 1.3.2 "$(TCLREGLIB:\=/)" registry] -<< - type tests.log | more -!endif runtest: setup $(TCLTEST) dlls $(CAT32) set TCL_LIBRARY=$(ROOT:\=/)/library diff --git a/win/rules.vc b/win/rules.vc index 852b1eb..88b90e0 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -112,6 +112,7 @@ MKDIR = mkdir # DOCDIR - source directory containing documentation files # GENERICDIR - platform-independent source directory # WINDIR - Windows-specific source directory +# TESTDIR - directory containing test files # TOOLSDIR - directory containing build tools # _TCLDIR - root of the Tcl installation OR the Tcl sources. Not set # when building Tcl itself. @@ -146,8 +147,15 @@ GENERICDIR = $(ROOT)\generic !ifndef TOOLSDIR TOOLSDIR = $(ROOT)\tools !endif +!ifndef TESTDIR +TESTDIR = $(ROOT)\tests +!endif !ifndef LIBDIR +!if exist("$(ROOT)\library") LIBDIR = $(ROOT)\library +!else +LIBDIR = $(ROOT)\lib +!endif !endif !ifndef DEMODIR !if exist("$(LIBDIR)\demos") @@ -1265,7 +1273,9 @@ pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) # # TBD - tclvfs has a comment that stubs libs should not be compiled with -GL # without stating why. Tcl itself compiled stubs libs with this flag. -# so we do not remove it from cflags. +# so we do not remove it from cflags. -GL may prevent extensions +# compiled with one VC version to fail to link against stubs library +# compiled with another VC version. Check for this and fix accordingly. stubscflags = $(cflags) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(INCLUDES) # Link flags @@ -1387,12 +1397,12 @@ default-install-libraries: $(OUT_DIR)\pkgIndex.tcl @echo Installing package index in '$(SCRIPT_INSTALL_DIR)' @$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR) -default-install-html: +default-install-docs-html: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css") do @$(COPY) %f "$(DOC_INSTALL_DIR)" -default-install-man: +default-install-docs-n: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.n") do @$(COPY) %f "$(DOC_INSTALL_DIR)" @@ -1429,6 +1439,21 @@ default-setup: @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) +!if "$(TESTPAT)" != "" +TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT) +!endif + +default-test: default-setup $(PROJECT) + @set TCLLIBPATH=$(OUT_DIR:\=/) + @if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)" + cd "$(TESTDIR)" && $(DEBUGGER) $(TCLSH) all.tcl $(TESTFLAGS) + +default-shell: default-setup $(PROJECT) + @set TCLLIBPATH=$(OUT_DIR:\=/) + @if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)" + $(DEBUGGER) $(TCLSH) + +# Generation of Windows version resource !ifdef PRJ_RCFILE $(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc @@ -1485,6 +1510,11 @@ DISABLE_IMPLICIT_RULES = 0 # Implicit rule definitions - only for building library objects. For stubs and # main application, the master makefile should define explicit rules. +{$(ROOT)}.c{$(TMP_DIR)}.obj:: + $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<< +$< +<< + {$(WINDIR)}.c{$(TMP_DIR)}.obj:: $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<< $< diff --git a/win/targets.vc b/win/targets.vc index 56b6427..dbe4b82 100644 --- a/win/targets.vc +++ b/win/targets.vc @@ -1,6 +1,16 @@ #------------------------------------------------------------- -*- makefile -*- $(PROJECT): setup pkgindex $(PRJLIB) + +!ifdef PRJ_STUBOBJS +$(PROJECT): $(PRJSTUBLIB) +$(PRJSTUBLIB): $(PRJ_STUBOBJS) + $(MAKELIBCMD) $** + +$(PRJ_STUBOBJS): + $(cc32) $(stubscflags) -Fo$(TMP_DIR)\ %s +!endif + !ifdef PRJ_MANIFEST $(PROJECT): $(PRJLIB).manifest $(PRJLIB).manifest: $(PRJ_MANIFEST) @@ -9,6 +19,7 @@ $(PRJLIB).manifest: $(PRJ_MANIFEST) << !endif + !if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk" # MAKEBINCMD will do shared, static and debug links as appropriate # _VC_MANIFEST_EMBED_DLL embeds the manifest for shared libraries @@ -19,10 +30,17 @@ $(PRJLIB): $(PRJ_OBJS) $(RESFILE) -@del $*.exp !endif +!ifndef DISABLE_STANDARD_TARGETS +DISABLE_STANDARD_TARGETS = 0 +!endif + +!if !$(DISABLE_STANDARD_TARGETS) setup: default-setup install: default-install clean: default-clean realclean: hose hose: default-hose distclean: realclean default-distclean - +test: default-test +shell: default-shell +!endif -- cgit v0.12 From 7db056b75a847ee07e8c457304fec5b3c68bed4a Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sat, 21 Oct 2017 12:14:25 +0000 Subject: Fully qualify OUT_DIR and TMP_DIR paths so that the test target can change directories and not break relative paths to the built extension. --- win/makefile.vc | 7 ------- win/rules.vc | 24 ++++++++++++++++++++++-- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index d09b187..2884aa3 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -158,13 +158,6 @@ #============================================================================== #------------------------------------------------------------------------------ -!if !exist("makefile.vc") -MSG = ^ -You must run this makefile only from the directory it is in.^ -Please `cd` to its location first. -!error $(MSG) -!endif - # The PROJECT macro is used by rules.vc for generating appropriate # macros and rules. PROJECT = tcl diff --git a/win/rules.vc b/win/rules.vc index 88b90e0..69f531e 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -70,6 +70,14 @@ PROJECT_REQUIRES_TK = 0 # changing them for consistency or clarity. # 0. Sanity check compiler environment + +!if !exist("rules-ext.vc") +MSG = ^ +You must run nmake from the directory containing the makefile and rules-ext.vc.^ +Please `cd` to its location first. +!error $(MSG) +!endif + # Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or # VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir) @@ -538,7 +546,7 @@ DEBUGFLAGS = $(DEBUGFLAGS) -GZ # They are not passed through to the actual application / extension # link rules. !ifndef LINKER_TESTFLAGS -LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmhlp-out.txt +LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmakehlp.out !endif LINKERFLAGS = @@ -951,6 +959,17 @@ OUT_DIR = $(TMP_DIR) !endif !endif +# Relative paths -> absolute +!if [echo OUT_DIR = \> nmakehlp.out] \ + || [nmakehlp -Q "$(OUT_DIR)" >> nmakehlp.out] +!error *** Could not fully qualify path OUT_DIR=$(OUT_DIR) +!endif +!if [echo TMP_DIR = \>> nmakehlp.out] \ + || [nmakehlp -Q "$(TMP_DIR)" >> nmakehlp.out] +!error *** Could not fully qualify path TMP_DIR=$(TMP_DIR) +!endif +!include nmakehlp.out + # The name of the stubs library for the project being built STUBPREFIX = $(PROJECT)stub @@ -1400,7 +1419,7 @@ default-install-libraries: $(OUT_DIR)\pkgIndex.tcl default-install-docs-html: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" - @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css") do @$(COPY) %f "$(DOC_INSTALL_DIR)" + @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css" "$(DOCDIR)\*.png") do @$(COPY) %f "$(DOC_INSTALL_DIR)" default-install-docs-n: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @@ -1418,6 +1437,7 @@ default-clean: @echo Cleaning $(WINDIR)\nmakehlp.obj, nmakehlp.exe ... @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe + @if exist $(WINDIR)\nmakehlp.out del $(WINDIR)\nmakehlp.out @echo Cleaning $(WINDIR)\_junk.pch ... @if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch @echo Cleaning $(WINDIR)\vercl.x, vercl.i ... -- cgit v0.12 From cdb25d894650feb93162033ae30f0e158b6efb1e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 23 Oct 2017 12:09:48 +0000 Subject: Fix [b58e6897034fc5292c9d36ba8099d9a835c98172|b58e689703]: Return value of 'Tcl_Flush' --- generic/tclIO.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 64501fd..e74624f 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -6660,7 +6660,7 @@ Tcl_Flush( chanPtr = statePtr->topChanPtr; if (CheckChannelErrors(statePtr, TCL_WRITABLE) != 0) { - return -1; + return TCL_ERROR; } result = FlushChannel(NULL, chanPtr, 0); -- cgit v0.12 From 5470f1329925b63a1ac3def74b82b9b3a4851f0e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 23 Oct 2017 13:47:57 +0000 Subject: tclWinPanic.c is in the \win directory, not in \generic! --- win/tcl.dsp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/win/tcl.dsp b/win/tcl.dsp index abad0bb..214449c 100644 --- a/win/tcl.dsp +++ b/win/tcl.dsp @@ -1304,10 +1304,6 @@ SOURCE=..\generic\tclOOStubLib.c # End Source File # Begin Source File -SOURCE=..\generic\tclWinPanic.c -# End Source File -# Begin Source File - SOURCE=..\generic\tclTomMathStubLib.c # End Source File # Begin Source File @@ -1532,6 +1528,10 @@ SOURCE=.\tclWinNotify.c # End Source File # Begin Source File +SOURCE=.\tclWinPanic.c +# End Source File +# Begin Source File + SOURCE=.\tclWinPipe.c # End Source File # Begin Source File -- cgit v0.12 From fe8915122a91a1f6a4ba0a1a3999ae673399b404 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Mon, 23 Oct 2017 13:53:51 +0000 Subject: Eliminate loimpact and tclalloc options. --- win/rules.vc | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 69f531e..6bdfa8a 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -573,8 +573,6 @@ LINKERFLAGS = $(LINKERFLAGS) -ltcg # MSVCRT - 1 -> link to dynamic C runtime even when building static Tcl build # 0 -> link to static C runtime for static Tcl build. # Does not impact shared Tcl builds (STATIC_BUILD == 0) -# LOIMPACT - 1 -> Ask Windows loader to aggressively trim the working set. -# Will reduce physical memory use at cost of performance. # TCL_USE_STATIC_PACKAGES - 1 -> statically link the registry and dde extensions # in the Tcl shell. 0 -> keep them as shared libraries # Does not impact shared Tcl builds. @@ -595,7 +593,6 @@ SYMBOLS = 0 PROFILE = 0 PGO = 0 MSVCRT = 1 -LOIMPACT = 0 TCL_USE_STATIC_PACKAGES = 0 USE_THREAD_ALLOC = 1 UNCHECKED = 0 @@ -681,10 +678,7 @@ PGO = 0 !endif !if [nmakehlp -f $(OPTS) "loimpact"] -!message *** Doing loimpact -LOIMPACT = 1 -!else -LOIMPACT = 0 +!message *** Warning: ignoring option "loimpact" - deprecated on modern Windows. !endif # TBD - should get rid of this option @@ -693,9 +687,8 @@ LOIMPACT = 0 USE_THREAD_ALLOC = 1 !endif -# TBD - should get rid of this option !if [nmakehlp -f $(OPTS) "tclalloc"] -!message *** Doing tclalloc +!error *** Option `tclalloc` is USE_THREAD_ALLOC = 0 !endif @@ -1332,10 +1325,6 @@ lflags = $(lflags) -opt:nowin98 !endif !endif -!if $(LOIMPACT) -lflags = $(lflags) -ws:aggressive -!endif - dlllflags = $(lflags) -dll conlflags = $(lflags) -subsystem:console guilflags = $(lflags) -subsystem:windows -- cgit v0.12 From 172896b15a2b5b8a1163c9de824e20297a876ed5 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 23 Oct 2017 16:20:18 +0000 Subject: Implementation branch for TIP 114 - Eliminate Octal Parsing... --- doc/GetInt.3 | 7 +- doc/expr.n | 4 +- doc/scan.n | 6 +- generic/tclBasic.c | 1 - generic/tclExecute.c | 14 +--- generic/tclInt.h | 2 - generic/tclStrToD.c | 65 +--------------- generic/tclUtil.c | 68 ----------------- tests/assemble.test | 2 +- tests/compExpr-old.test | 24 +++--- tests/compile.test | 2 +- tests/execute.test | 22 +++--- tests/expr-old.test | 64 ++++++++-------- tests/expr.test | 46 ++++++------ tests/get.test | 8 +- tests/lindex.test | 16 ++-- tests/mathop.test | 194 ++++++++++++++++++++++++------------------------ tests/string.test | 4 +- tests/stringComp.test | 4 +- tests/while-old.test | 2 +- tests/while.test | 4 +- 21 files changed, 205 insertions(+), 354 deletions(-) mode change 100644 => 100755 generic/tclStrToD.c diff --git a/doc/GetInt.3 b/doc/GetInt.3 index eba549d..5562e28 100644 --- a/doc/GetInt.3 +++ b/doc/GetInt.3 @@ -64,12 +64,9 @@ if the first such characters are then \fIsrc\fR is expected to be in octal form; otherwise, if the first such characters are .QW \fB0b\fR -then \fIsrc\fR is expected to be in binary form; otherwise, -if the first such character is -.QW \fB0\fR then \fIsrc\fR -is expected to be in octal form; otherwise, \fIsrc\fR -is expected to be in decimal form. +is expected to be in binary 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 diff --git a/doc/expr.n b/doc/expr.n index d33623c..9cb1625 100644 --- a/doc/expr.n +++ b/doc/expr.n @@ -50,9 +50,7 @@ An integer operand may be specified in decimal (the normal case, the optional first two characters are \fB0d\fR), binary (the first two characters are \fB0b\fR), octal (the first two characters are \fB0o\fR), or hexadecimal -(the first two characters are \fB0x\fR) form. For -compatibility with older Tcl releases, an operand that begins with \fB0\fR is -interpreted as an octal integer even if the second character is not \fBo\fR. +(the first two characters are \fB0x\fR) form. A floating-point number may be specified in any of several common decimal formats, and may use the decimal point \fB.\fR, \fBe\fR or \fBE\fR for scientific notation, and diff --git a/doc/scan.n b/doc/scan.n index 0c24fea..e87bef1 100644 --- a/doc/scan.n +++ b/doc/scan.n @@ -224,12 +224,10 @@ set string "#08D03F" \fBscan\fR $string "#%2x%2x%2x" r g b .CE .PP -Parse a \fIHH:MM\fR time string, noting that this avoids problems with -octal numbers by forcing interpretation as decimals (if we did not -care, we would use the \fB%i\fR conversion instead): +Parse a \fIHH:MM\fR time string: .PP .CS -set string "08:08" ;# *Not* octal! +set string "08:08" if {[\fBscan\fR $string "%d:%d" hours minutes] != 2} { error "not a valid time string" } diff --git a/generic/tclBasic.c b/generic/tclBasic.c index d4fa833..682709b 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3583,7 +3583,6 @@ OldMathFuncProc( Tcl_SetObjResult(interp, Tcl_NewStringObj( "argument to math function didn't have numeric value", -1)); - TclCheckBadOctal(interp, TclGetString(valuePtr)); ckfree(args); return TCL_ERROR; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f4c71ec..d43ddfd 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -9626,16 +9626,7 @@ IllegalExprOperandType( } if (GetNumberFromObj(NULL, opndPtr, &ptr, &type) != TCL_OK) { - int numBytes; - const char *bytes = TclGetStringFromObj(opndPtr, &numBytes); - - if (numBytes == 0) { - description = "empty string"; - } else if (TclCheckBadOctal(NULL, bytes)) { - description = "invalid octal number"; - } else { - description = "non-numeric string"; - } + description = "non-numeric string"; } else if (type == TCL_NUMBER_NAN) { description = "non-numeric floating-point value"; } else if (type == TCL_NUMBER_DOUBLE) { @@ -9646,7 +9637,8 @@ IllegalExprOperandType( } Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't use %s as operand of \"%s\"", description, operator)); + "can't use %s \"%s\" as operand of \"%s\"", description, + Tcl_GetString(opndPtr), operator)); Tcl_SetErrorCode(interp, "ARITH", "DOMAIN", description, NULL); } diff --git a/generic/tclInt.h b/generic/tclInt.h index 0b5ff0c..63df300 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2894,8 +2894,6 @@ MODULE_SCOPE int TclByteArrayMatch(const unsigned char *string, MODULE_SCOPE double TclCeil(const mp_int *a); MODULE_SCOPE void TclChannelPreserve(Tcl_Channel chan); MODULE_SCOPE void TclChannelRelease(Tcl_Channel chan); -MODULE_SCOPE int TclCheckBadOctal(Tcl_Interp *interp, - const char *value); MODULE_SCOPE int TclChanCaughtErrorBypass(Tcl_Interp *interp, Tcl_Channel chan); MODULE_SCOPE Tcl_ObjCmdProc TclChannelNamesCmd; diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c old mode 100644 new mode 100755 index 630e498..6502733 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -483,7 +483,7 @@ TclParseNumber( enum State { INITIAL, SIGNUM, ZERO, ZERO_X, ZERO_O, ZERO_B, ZERO_D, BINARY, - HEXADECIMAL, OCTAL, BAD_OCTAL, DECIMAL, + HEXADECIMAL, OCTAL, DECIMAL, LEADING_RADIX_POINT, FRACTION, EXPONENT_START, EXPONENT_SIGNUM, EXPONENT, sI, sIN, sINF, sINFI, sINFIN, sINFINI, sINFINIT, sINFINITY @@ -528,7 +528,6 @@ TclParseNumber( char d = 0; /* Last hexadecimal digit scanned; initialized * to avoid a compiler warning. */ int shift = 0; /* Amount to shift when accumulating binary */ - int explicitOctal = 0; #define ALL_BITS (~(Tcl_WideUInt)0) #define MOST_BITS (ALL_BITS >> 1) @@ -660,7 +659,6 @@ TclParseNumber( goto zerob; } if (c == 'o' || c == 'O') { - explicitOctal = 1; state = ZERO_O; break; } @@ -668,10 +666,7 @@ TclParseNumber( state = ZERO_D; break; } -#ifdef TCL_NO_DEPRECATED goto decimal; -#endif - /* FALLTHROUGH */ case OCTAL: /* @@ -734,58 +729,6 @@ TclParseNumber( state = OCTAL; break; } - /* FALLTHROUGH */ - - case BAD_OCTAL: - if (explicitOctal) { - /* - * No forgiveness for bad digits in explicitly octal numbers. - */ - - goto endgame; - } - if (flags & TCL_PARSE_INTEGER_ONLY) { - /* - * No seeking floating point when parsing only integer. - */ - - goto endgame; - } -#ifndef TCL_NO_DEPRECATED - - /* - * Scanned a number with a leading zero that contains an 8, 9, - * radix point or E. This is an invalid octal number, but might - * still be floating point. - */ - - if (c == '0') { - numTrailZeros++; - state = BAD_OCTAL; - break; - } else if (isdigit(UCHAR(c))) { - if (objPtr != NULL) { - significandOverflow = AccumulateDecimalDigit( - (unsigned)(c-'0'), numTrailZeros, - &significandWide, &significandBig, - significandOverflow); - } - if (numSigDigs != 0) { - numSigDigs += (numTrailZeros + 1); - } else { - numSigDigs = 1; - } - numTrailZeros = 0; - state = BAD_OCTAL; - break; - } else if (c == '.') { - state = FRACTION; - break; - } else if (c == 'E' || c == 'e') { - state = EXPONENT_START; - break; - } -#endif goto endgame; /* @@ -900,9 +843,7 @@ TclParseNumber( * digits. */ -#ifdef TCL_NO_DEPRECATED decimal: -#endif acceptState = state; acceptPoint = p; acceptLen = len; @@ -1186,7 +1127,6 @@ TclParseNumber( TclFreeIntRep(objPtr); switch (acceptState) { case SIGNUM: - case BAD_OCTAL: case ZERO_X: case ZERO_O: case ZERO_B: @@ -1412,9 +1352,6 @@ TclParseNumber( Tcl_AppendLimitedToObj(msg, bytes, numBytes, 50, ""); Tcl_AppendToObj(msg, "\"", -1); - if (state == BAD_OCTAL) { - Tcl_AppendToObj(msg, " (looks like invalid octal number)", -1); - } Tcl_SetObjResult(interp, msg); Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL); } diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 608cd15..6a727a1 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3655,7 +3655,6 @@ TclGetIntForIndex( if (!strncmp(bytes, "end-", 4)) { bytes += 4; } - TclCheckBadOctal(interp, bytes); Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", NULL); } @@ -3799,73 +3798,6 @@ SetEndOffsetFromAny( /* *---------------------------------------------------------------------- * - * TclCheckBadOctal -- - * - * This function checks for a bad octal value and appends a meaningful - * error to the interp's result. - * - * Results: - * 1 if the argument was a bad octal, else 0. - * - * Side effects: - * The interpreter's result is modified. - * - *---------------------------------------------------------------------- - */ - -int -TclCheckBadOctal( - Tcl_Interp *interp, /* Interpreter to use for error reporting. If - * NULL, then no error message is left after - * errors. */ - const char *value) /* String to check. */ -{ - register const char *p = value; - - /* - * A frequent mistake is invalid octal values due to an unwanted leading - * zero. Try to generate a meaningful error message. - */ - - while (TclIsSpaceProc(*p)) { - p++; - } - if (*p == '+' || *p == '-') { - p++; - } - if (*p == '0') { - if ((p[1] == 'o') || p[1] == 'O') { - p += 2; - } - while (isdigit(UCHAR(*p))) { /* INTL: digit. */ - p++; - } - while (TclIsSpaceProc(*p)) { - p++; - } - if (*p == '\0') { - /* - * Reached end of string. - */ - - if (interp != NULL) { - /* - * Don't reset the result here because we want this result to - * be added to an existing error message as extra info. - */ - - Tcl_AppendToObj(Tcl_GetObjResult(interp), - " (looks like invalid octal number)", -1); - } - return 1; - } - } - return 0; -} - -/* - *---------------------------------------------------------------------- - * * ClearHash -- * * Remove all the entries in the hash table *tablePtr. diff --git a/tests/assemble.test b/tests/assemble.test index d17bfd9..9d6965e 100644 --- a/tests/assemble.test +++ b/tests/assemble.test @@ -781,7 +781,7 @@ test assemble-7.43 {uplus} { } } -returnCodes error - -result {can't use non-numeric floating-point value as operand of "+"} + -result {can't use non-numeric floating-point value "NaN" as operand of "+"} } test assemble-7.43.1 {tryCvtToNumeric} { -body { diff --git a/tests/compExpr-old.test b/tests/compExpr-old.test index bae26a0..7144487 100644 --- a/tests/compExpr-old.test +++ b/tests/compExpr-old.test @@ -285,10 +285,10 @@ test compExpr-old-6.8 {CompileBitXorExpr: error compiling bitxor arm} -body { } -returnCodes error -match glob -result * 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 "^"}} +} {1 {can't use floating-point value "24.0" 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 "^"}} +} {1 {can't use non-numeric string "a" 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 @@ -309,10 +309,10 @@ test compExpr-old-7.11 {CompileBitAndExpr: error compiling bitand arm} -body { } -returnCodes error -match glob -result * 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 "&"}} +} {1 {can't use floating-point value "24.0" 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 "&"}} +} {1 {can't use non-numeric string "a" 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 @@ -377,10 +377,10 @@ test compExpr-old-10.9 {CompileShiftExpr: error compiling shift arm} -body { } -returnCodes error -match glob -result * 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 ">>"}} +} {1 {can't use floating-point value "24.0" 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 "<<"}} +} {1 {can't use non-numeric string "a" 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 @@ -399,10 +399,10 @@ test compExpr-old-11.9 {CompileAddExpr: error compiling add arm} -body { } -returnCodes error -match glob -result * 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 "+"}} +} {1 {can't use non-numeric string "xx" 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 "-"}} +} {1 {can't use non-numeric string "a" as operand of "-"}} test compExpr-old-11.12 {CompileAddExpr: runtime error} { list [catch {expr {3/0}} msg] $msg } {1 {divide by zero}} @@ -430,10 +430,10 @@ test compExpr-old-12.9 {CompileMultiplyExpr: error compiling multiply arm} -body } -returnCodes error -match glob -result * 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 "*"}} +} {1 {can't use non-numeric string "xx" 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 "/"}} +} {1 {can't use non-numeric string "a" as operand of "/"}} test compExpr-old-13.1 {CompileUnaryExpr: unary exprs} {expr -0xff} -255 test compExpr-old-13.2 {CompileUnaryExpr: unary exprs} {expr +0o00123} 83 @@ -451,10 +451,10 @@ test compExpr-old-13.9 {CompileUnaryExpr: error compiling unary expr} -body { } -returnCodes error -match glob -result * test compExpr-old-13.10 {CompileUnaryExpr: runtime error} { list [catch {expr {~"xx"}} msg] $msg -} {1 {can't use non-numeric string as operand of "~"}} +} {1 {can't use non-numeric string "xx" as operand of "~"}} test compExpr-old-13.11 {CompileUnaryExpr: runtime error} { list [catch {expr ~4.0} msg] $msg -} {1 {can't use floating-point value as operand of "~"}} +} {1 {can't use floating-point value "4.0" as operand of "~"}} test compExpr-old-13.12 {CompileUnaryExpr: just primary expr} {expr 0x123} 291 test compExpr-old-13.13 {CompileUnaryExpr: just primary expr} { set a 27 diff --git a/tests/compile.test b/tests/compile.test index 2fa4147..c76bd82 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -323,7 +323,7 @@ test compile-11.2 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body { } -returnCodes error -result {bad index "bogus": must be integer?[+-]integer? or end?[+-]integer?} test compile-11.3 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body { apply {{} { set r [list foobar] ; string index a 0o9 }} -} -returnCodes error -match glob -result {*invalid octal number*} +} -returnCodes error -match glob -result {*} test compile-11.4 {Tcl_Append*: ensure Tcl_ResetResult is used properly} -body { apply {{} { set r [list foobar] ; array set var {one two many} }} } -returnCodes error -result {list must have an even number of elements} diff --git a/tests/execute.test b/tests/execute.test index 5b8ce2d..2480a95 100644 --- a/tests/execute.test +++ b/tests/execute.test @@ -174,7 +174,7 @@ test execute-3.5 {TclExecuteByteCode, INST_ADD, op1 is string double} {testobj} test execute-3.6 {TclExecuteByteCode, INST_ADD, op1 is non-numeric} {testobj} { set x [teststringobj set 0 foo] list [catch {expr {$x + 1}} msg] $msg -} {1 {can't use non-numeric string as operand of "+"}} +} {1 {can't use non-numeric string "foo" as operand of "+"}} test execute-3.7 {TclExecuteByteCode, INST_ADD, op2 is int} {testobj} { set x [testintobj set 0 1] expr {1 + $x} @@ -199,7 +199,7 @@ test execute-3.11 {TclExecuteByteCode, INST_ADD, op2 is string double} {testobj} test execute-3.12 {TclExecuteByteCode, INST_ADD, op2 is non-numeric} {testobj} { set x [teststringobj set 0 foo] list [catch {expr {1 + $x}} msg] $msg -} {1 {can't use non-numeric string as operand of "+"}} +} {1 {can't use non-numeric string "foo" as operand of "+"}} # INST_SUB is partially tested: test execute-3.13 {TclExecuteByteCode, INST_SUB, op1 is int} {testobj} { @@ -226,7 +226,7 @@ test execute-3.17 {TclExecuteByteCode, INST_SUB, op1 is string double} {testobj} test execute-3.18 {TclExecuteByteCode, INST_SUB, op1 is non-numeric} {testobj} { set x [teststringobj set 0 foo] list [catch {expr {$x - 1}} msg] $msg -} {1 {can't use non-numeric string as operand of "-"}} +} {1 {can't use non-numeric string "foo" as operand of "-"}} test execute-3.19 {TclExecuteByteCode, INST_SUB, op2 is int} {testobj} { set x [testintobj set 0 1] expr {1 - $x} @@ -251,7 +251,7 @@ test execute-3.23 {TclExecuteByteCode, INST_SUB, op2 is string double} {testobj} test execute-3.24 {TclExecuteByteCode, INST_SUB, op2 is non-numeric} {testobj} { set x [teststringobj set 0 foo] list [catch {expr {1 - $x}} msg] $msg -} {1 {can't use non-numeric string as operand of "-"}} +} {1 {can't use non-numeric string "foo" as operand of "-"}} # INST_MULT is partially tested: test execute-3.25 {TclExecuteByteCode, INST_MULT, op1 is int} {testobj} { @@ -278,7 +278,7 @@ test execute-3.29 {TclExecuteByteCode, INST_MULT, op1 is string double} {testobj test execute-3.30 {TclExecuteByteCode, INST_MULT, op1 is non-numeric} {testobj} { set x [teststringobj set 1 foo] list [catch {expr {$x * 1}} msg] $msg -} {1 {can't use non-numeric string as operand of "*"}} +} {1 {can't use non-numeric string "foo" as operand of "*"}} test execute-3.31 {TclExecuteByteCode, INST_MULT, op2 is int} {testobj} { set x [testintobj set 1 1] expr {1 * $x} @@ -303,7 +303,7 @@ test execute-3.35 {TclExecuteByteCode, INST_MULT, op2 is string double} {testobj test execute-3.36 {TclExecuteByteCode, INST_MULT, op2 is non-numeric} {testobj} { set x [teststringobj set 1 foo] list [catch {expr {1 * $x}} msg] $msg -} {1 {can't use non-numeric string as operand of "*"}} +} {1 {can't use non-numeric string "foo" as operand of "*"}} # INST_DIV is partially tested: test execute-3.37 {TclExecuteByteCode, INST_DIV, op1 is int} {testobj} { @@ -330,7 +330,7 @@ test execute-3.41 {TclExecuteByteCode, INST_DIV, op1 is string double} {testobj} test execute-3.42 {TclExecuteByteCode, INST_DIV, op1 is non-numeric} {testobj} { set x [teststringobj set 1 foo] list [catch {expr {$x / 1}} msg] $msg -} {1 {can't use non-numeric string as operand of "/"}} +} {1 {can't use non-numeric string "foo" as operand of "/"}} test execute-3.43 {TclExecuteByteCode, INST_DIV, op2 is int} {testobj} { set x [testintobj set 1 1] expr {2 / $x} @@ -355,7 +355,7 @@ test execute-3.47 {TclExecuteByteCode, INST_DIV, op2 is string double} {testobj} test execute-3.48 {TclExecuteByteCode, INST_DIV, op2 is non-numeric} {testobj} { set x [teststringobj set 1 foo] list [catch {expr {1 / $x}} msg] $msg -} {1 {can't use non-numeric string as operand of "/"}} +} {1 {can't use non-numeric string "foo" as operand of "/"}} # INST_UPLUS is partially tested: test execute-3.49 {TclExecuteByteCode, INST_UPLUS, op is int} {testobj} { @@ -382,7 +382,7 @@ test execute-3.53 {TclExecuteByteCode, INST_UPLUS, op is string double} {testobj test execute-3.54 {TclExecuteByteCode, INST_UPLUS, op is non-numeric} {testobj} { set x [teststringobj set 1 foo] list [catch {expr {+ $x}} msg] $msg -} {1 {can't use non-numeric string as operand of "+"}} +} {1 {can't use non-numeric string "foo" as operand of "+"}} # INST_UMINUS is partially tested: test execute-3.55 {TclExecuteByteCode, INST_UMINUS, op is int} {testobj} { @@ -409,7 +409,7 @@ test execute-3.59 {TclExecuteByteCode, INST_UMINUS, op is string double} {testob test execute-3.60 {TclExecuteByteCode, INST_UMINUS, op is non-numeric} {testobj} { set x [teststringobj set 1 foo] list [catch {expr {- $x}} msg] $msg -} {1 {can't use non-numeric string as operand of "-"}} +} {1 {can't use non-numeric string "foo" as operand of "-"}} # INST_LNOT is partially tested: test execute-3.61 {TclExecuteByteCode, INST_LNOT, op is int} {testobj} { @@ -457,7 +457,7 @@ test execute-3.70 {TclExecuteByteCode, INST_LNOT, op is string double} {testobj} test execute-3.71 {TclExecuteByteCode, INST_LNOT, op is non-numeric} {testobj} { set x [teststringobj set 1 foo] list [catch {expr {! $x}} msg] $msg -} {1 {can't use non-numeric string as operand of "!"}} +} {1 {can't use non-numeric string "foo" as operand of "!"}} # INST_BITNOT not tested # INST_CALL_BUILTIN_FUNC1 not tested diff --git a/tests/expr-old.test b/tests/expr-old.test index 3adfb63..54191b6 100644 --- a/tests/expr-old.test +++ b/tests/expr-old.test @@ -197,34 +197,34 @@ test expr-old-2.38 {floating-point operators} { test expr-old-3.1 {illegal floating-point operations} { list [catch {expr ~4.0} msg] $msg -} {1 {can't use floating-point value as operand of "~"}} +} {1 {can't use floating-point value "4.0" as operand of "~"}} test expr-old-3.2 {illegal floating-point operations} { list [catch {expr 27%4.0} msg] $msg -} {1 {can't use floating-point value as operand of "%"}} +} {1 {can't use floating-point value "4.0" as operand of "%"}} test expr-old-3.3 {illegal floating-point operations} { list [catch {expr 27.0%4} msg] $msg -} {1 {can't use floating-point value as operand of "%"}} +} {1 {can't use floating-point value "27.0" as operand of "%"}} test expr-old-3.4 {illegal floating-point operations} { list [catch {expr 1.0<<3} msg] $msg -} {1 {can't use floating-point value as operand of "<<"}} +} {1 {can't use floating-point value "1.0" as operand of "<<"}} test expr-old-3.5 {illegal floating-point operations} { list [catch {expr 3<<1.0} msg] $msg -} {1 {can't use floating-point value as operand of "<<"}} +} {1 {can't use floating-point value "1.0" as operand of "<<"}} test expr-old-3.6 {illegal floating-point operations} { list [catch {expr 24.0>>3} msg] $msg -} {1 {can't use floating-point value as operand of ">>"}} +} {1 {can't use floating-point value "24.0" as operand of ">>"}} test expr-old-3.7 {illegal floating-point operations} { list [catch {expr 24>>3.0} msg] $msg -} {1 {can't use floating-point value as operand of ">>"}} +} {1 {can't use floating-point value "3.0" as operand of ">>"}} test expr-old-3.8 {illegal floating-point operations} { list [catch {expr 24&3.0} msg] $msg -} {1 {can't use floating-point value as operand of "&"}} +} {1 {can't use floating-point value "3.0" as operand of "&"}} test expr-old-3.9 {illegal floating-point operations} { list [catch {expr 24.0|3} msg] $msg -} {1 {can't use floating-point value as operand of "|"}} +} {1 {can't use floating-point value "24.0" as operand of "|"}} test expr-old-3.10 {illegal floating-point operations} { list [catch {expr 24.0^3} msg] $msg -} {1 {can't use floating-point value as operand of "^"}} +} {1 {can't use floating-point value "24.0" as operand of "^"}} # Check the string operators individually. @@ -265,46 +265,46 @@ test expr-old-4.32 {string operators} {expr {0?"foo":"bar"}} bar test expr-old-5.1 {illegal string operations} { list [catch {expr {-"a"}} msg] $msg -} {1 {can't use non-numeric string as operand of "-"}} +} {1 {can't use non-numeric string "a" as operand of "-"}} test expr-old-5.2 {illegal string operations} { list [catch {expr {+"a"}} msg] $msg -} {1 {can't use non-numeric string as operand of "+"}} +} {1 {can't use non-numeric string "a" as operand of "+"}} test expr-old-5.3 {illegal string operations} { list [catch {expr {~"a"}} msg] $msg -} {1 {can't use non-numeric string as operand of "~"}} +} {1 {can't use non-numeric string "a" as operand of "~"}} test expr-old-5.4 {illegal string operations} { list [catch {expr {!"a"}} msg] $msg -} {1 {can't use non-numeric string as operand of "!"}} +} {1 {can't use non-numeric string "a" as operand of "!"}} test expr-old-5.5 {illegal string operations} { list [catch {expr {"a"*"b"}} msg] $msg -} {1 {can't use non-numeric string as operand of "*"}} +} {1 {can't use non-numeric string "a" as operand of "*"}} test expr-old-5.6 {illegal string operations} { list [catch {expr {"a"/"b"}} msg] $msg -} {1 {can't use non-numeric string as operand of "/"}} +} {1 {can't use non-numeric string "a" as operand of "/"}} test expr-old-5.7 {illegal string operations} { list [catch {expr {"a"%"b"}} msg] $msg -} {1 {can't use non-numeric string as operand of "%"}} +} {1 {can't use non-numeric string "a" as operand of "%"}} test expr-old-5.8 {illegal string operations} { list [catch {expr {"a"+"b"}} msg] $msg -} {1 {can't use non-numeric string as operand of "+"}} +} {1 {can't use non-numeric string "a" as operand of "+"}} test expr-old-5.9 {illegal string operations} { list [catch {expr {"a"-"b"}} msg] $msg -} {1 {can't use non-numeric string as operand of "-"}} +} {1 {can't use non-numeric string "a" as operand of "-"}} test expr-old-5.10 {illegal string operations} { list [catch {expr {"a"<<"b"}} msg] $msg -} {1 {can't use non-numeric string as operand of "<<"}} +} {1 {can't use non-numeric string "a" as operand of "<<"}} test expr-old-5.11 {illegal string operations} { list [catch {expr {"a">>"b"}} msg] $msg -} {1 {can't use non-numeric string as operand of ">>"}} +} {1 {can't use non-numeric string "a" as operand of ">>"}} test expr-old-5.12 {illegal string operations} { list [catch {expr {"a"&"b"}} msg] $msg -} {1 {can't use non-numeric string as operand of "&"}} +} {1 {can't use non-numeric string "a" as operand of "&"}} test expr-old-5.13 {illegal string operations} { list [catch {expr {"a"^"b"}} msg] $msg -} {1 {can't use non-numeric string as operand of "^"}} +} {1 {can't use non-numeric string "a" as operand of "^"}} test expr-old-5.14 {illegal string operations} { list [catch {expr {"a"|"b"}} msg] $msg -} {1 {can't use non-numeric string as operand of "|"}} +} {1 {can't use non-numeric string "a" as operand of "|"}} test expr-old-5.15 {illegal string operations} { list [catch {expr {"a"&&"b"}} msg] $msg } {1 {expected boolean value but got "a"}} @@ -493,7 +493,7 @@ test expr-old-25.20 {type conversions} {expr 10.0} 10.0 test expr-old-26.1 {error conditions} { list [catch {expr 2+"a"} msg] $msg -} {1 {can't use non-numeric string as operand of "+"}} +} {1 {can't use non-numeric string "a" as operand of "+"}} test expr-old-26.2 {error conditions} -body { expr 2+4* } -returnCodes error -match glob -result * @@ -507,10 +507,10 @@ test expr-old-26.4 {error conditions} { set a xx test expr-old-26.5 {error conditions} { list [catch {expr {2+$a}} msg] $msg -} {1 {can't use non-numeric string as operand of "+"}} +} {1 {can't use non-numeric string "xx" as operand of "+"}} test expr-old-26.6 {error conditions} { list [catch {expr {2+[set a]}} msg] $msg -} {1 {can't use non-numeric string as operand of "+"}} +} {1 {can't use non-numeric string "xx" as operand of "+"}} test expr-old-26.7 {error conditions} -body { expr {2+(4} } -returnCodes error -match glob -result * @@ -534,7 +534,7 @@ test expr-old-26.12 {error conditions} -body { } -returnCodes error -match glob -result * test expr-old-26.13 {error conditions} { list [catch {expr {"a"/"b"}} msg] $msg -} {1 {can't use non-numeric string as operand of "/"}} +} {1 {can't use non-numeric string "a" as operand of "/"}} test expr-old-26.14 {error conditions} -body { expr 2:3 } -returnCodes error -match glob -result * @@ -963,7 +963,7 @@ test expr-old-36.1 {ExprLooksLikeInt procedure} -body { test expr-old-36.2 {ExprLooksLikeInt procedure} { set x 0o289 list [catch {expr {$x+1}} msg] $msg -} {1 {can't use invalid octal number as operand of "+"}} +} {1 {can't use non-numeric string "0o289" as operand of "+"}} test expr-old-36.3 {ExprLooksLikeInt procedure} { list [catch {expr 0289.1} msg] $msg } {0 289.1} @@ -1003,11 +1003,11 @@ test expr-old-36.11 {ExprLooksLikeInt procedure} { test expr-old-36.12 {ExprLooksLikeInt procedure} { set x "10;" list [catch {expr {$x+1}} msg] $msg -} {1 {can't use non-numeric string as operand of "+"}} +} {1 {can't use non-numeric string "10;" as operand of "+"}} test expr-old-36.13 {ExprLooksLikeInt procedure} { set x " +" list [catch {expr {$x+1}} msg] $msg -} {1 {can't use non-numeric string as operand of "+"}} +} {1 {can't use non-numeric string " +" as operand of "+"}} test expr-old-36.14 {ExprLooksLikeInt procedure} { set x "123456789012345678901234567890 " expr {$x+1} @@ -1015,7 +1015,7 @@ test expr-old-36.14 {ExprLooksLikeInt procedure} { test expr-old-36.15 {ExprLooksLikeInt procedure} { set x "0o99 " list [catch {expr {$x+1}} msg] $msg -} {1 {can't use invalid octal number as operand of "+"}} +} {1 {can't use non-numeric string "0o99 " as operand of "+"}} test expr-old-36.16 {ExprLooksLikeInt procedure} { set x " 0xffffffffffffffffffffffffffffffffffffff " expr {$x+1} diff --git a/tests/expr.test b/tests/expr.test index 8e083c5..664b479 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -257,7 +257,7 @@ test expr-4.9 {CompileLorExpr: long lor arm} { } 1 test expr-4.10 {CompileLorExpr: error compiling ! operand} { list [catch {expr {!"a"}} msg] $msg -} {1 {can't use non-numeric string as operand of "!"}} +} {1 {can't use non-numeric string "a" as operand of "!"}} test expr-4.11 {CompileLorExpr: error compiling land arms} { list [catch {expr {"a"||0}} msg] $msg } {1 {expected boolean value but got "a"}} @@ -304,10 +304,10 @@ test expr-6.8 {CompileBitXorExpr: error compiling bitxor arm} -body { } -returnCodes error -match glob -result * 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 "^"}} +} {1 {can't use floating-point value "24.0" 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 "^"}} +} {1 {can't use non-numeric string "a" 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 @@ -328,10 +328,10 @@ test expr-7.11 {CompileBitAndExpr: error compiling bitand arm} -body { } -returnCodes error -match glob -result * 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 "&"}} +} {1 {can't use floating-point value "24.0" 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 "&"}} +} {1 {can't use non-numeric string "a" 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 { @@ -456,10 +456,10 @@ test expr-10.9 {CompileShiftExpr: error compiling shift arm} -body { } -returnCodes error -match glob -result * 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 ">>"}} +} {1 {can't use floating-point value "24.0" 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 "<<"}} +} {1 {can't use non-numeric string "a" 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 @@ -478,10 +478,10 @@ test expr-11.9 {CompileAddExpr: error compiling add arm} -body { } -returnCodes error -match glob -result * 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 "+"}} +} {1 {can't use non-numeric string "xx" 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 "-"}} +} {1 {can't use non-numeric string "a" as operand of "-"}} test expr-11.12 {CompileAddExpr: runtime error} { list [catch {expr {3/0}} msg] $msg } {1 {divide by zero}} @@ -509,10 +509,10 @@ test expr-12.9 {CompileMultiplyExpr: error compiling multiply arm} -body { } -returnCodes error -match glob -result * 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 "*"}} +} {1 {can't use non-numeric string "xx" 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 "/"}} +} {1 {can't use non-numeric string "a" as operand of "/"}} test expr-13.1 {CompileUnaryExpr: unary exprs} {expr -0xff} -255 test expr-13.2 {CompileUnaryExpr: unary exprs} {expr +0o00123} 83 @@ -529,10 +529,10 @@ test expr-13.9 {CompileUnaryExpr: error compiling unary expr} -body { } -returnCodes error -match glob -result * test expr-13.10 {CompileUnaryExpr: runtime error} { list [catch {expr {~"xx"}} msg] $msg -} {1 {can't use non-numeric string as operand of "~"}} +} {1 {can't use non-numeric string "xx" as operand of "~"}} test expr-13.11 {CompileUnaryExpr: runtime error} { list [catch {expr ~4.0} msg] $msg -} {1 {can't use floating-point value as operand of "~"}} +} {1 {can't use floating-point value "4.0" as operand of "~"}} test expr-13.12 {CompileUnaryExpr: just primary expr} {expr 0x123} 291 test expr-13.13 {CompileUnaryExpr: just primary expr} { set a 27 @@ -844,15 +844,15 @@ test expr-21.13 {non-numeric boolean literals} -body { } -returnCodes error -match glob -result * test expr-21.14 {non-numeric boolean literals} { list [catch {expr !"truef"} err] $err -} {1 {can't use non-numeric string as operand of "!"}} +} {1 {can't use non-numeric string "truef" as operand of "!"}} test expr-21.15 {non-numeric boolean variables} { set v truef list [catch {expr {!$v}} err] $err -} {1 {can't use non-numeric string as operand of "!"}} +} {1 {can't use non-numeric string "truef" as operand of "!"}} test expr-21.16 {non-numeric boolean variables} { set v "true " list [catch {expr {!$v}} err] $err -} {1 {can't use non-numeric string as operand of "!"}} +} {1 {can't use non-numeric string "true " as operand of "!"}} test expr-21.17 {non-numeric boolean variables} { set v "tru" list [catch {expr {!$v}} err] $err @@ -872,23 +872,23 @@ test expr-21.20 {non-numeric boolean variables} { test expr-21.21 {non-numeric boolean variables} { set v "o" list [catch {expr {!$v}} err] $err -} {1 {can't use non-numeric string as operand of "!"}} +} {1 {can't use non-numeric string "o" as operand of "!"}} test expr-21.22 {non-numeric boolean variables} { set v "" list [catch {expr {!$v}} err] $err -} {1 {can't use empty string as operand of "!"}} +} {1 {can't use non-numeric string "" as operand of "!"}} # Test for non-numeric float handling. test expr-22.1 {non-numeric floats} { list [catch {expr {NaN + 1}} msg] $msg -} {1 {can't use non-numeric floating-point value as operand of "+"}} +} {1 {can't use non-numeric floating-point value "NaN" as operand of "+"}} test expr-22.2 {non-numeric floats} !ieeeFloatingPoint { list [catch {expr {Inf + 1}} msg] $msg } {1 {can't use infinite floating-point value as operand of "+"}} test expr-22.3 {non-numeric floats} { set nan NaN list [catch {expr {$nan + 1}} msg] $msg -} {1 {can't use non-numeric floating-point value as operand of "+"}} +} {1 {can't use non-numeric floating-point value "NaN" as operand of "+"}} test expr-22.4 {non-numeric floats} !ieeeFloatingPoint { set inf Inf list [catch {expr {$inf + 1}} msg] $msg @@ -901,7 +901,7 @@ test expr-22.6 {non-numeric floats} !ieeeFloatingPoint { } {1 {floating-point value too large to represent}} test expr-22.7 {non-numeric floats} { list [catch {expr {1 / NaN}} msg] $msg -} {1 {can't use non-numeric floating-point value as operand of "/"}} +} {1 {can't use non-numeric floating-point value "NaN" as operand of "/"}} test expr-22.8 {non-numeric floats} !ieeeFloatingPoint { list [catch {expr {1 / Inf}} msg] $msg } {1 {can't use infinite floating-point value as operand of "/"}} @@ -937,10 +937,10 @@ test expr-23.8 {CompileExponentialExpr: error compiling expo arm} -body { } -returnCodes error -match glob -result * 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 "**"}} +} {1 {can't use non-numeric string "xx" 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 "**"}} +} {1 {can't use non-numeric string "a" as operand of "**"}} test expr-23.11 {CompileExponentialExpr: runtime error} { list [catch {expr {0**-1}} msg] $msg } {1 {exponentiation of zero by negative power}} diff --git a/tests/get.test b/tests/get.test index d6a7206..c82b7e5 100644 --- a/tests/get.test +++ b/tests/get.test @@ -98,17 +98,17 @@ test get-3.2 {Tcl_GetDouble(FromObj), bad numbers} { } {0 1 0 1 1 {expected floating-point number but got "++1.0"} 1 {expected floating-point number but got "+-1.0"} 1 {expected floating-point number but got "-+1.0"} 0 -1 1 {expected floating-point number but got "--1.0"} 1 {expected floating-point number but got "- +1.0"}} # Bug 7114ac6141 test get-3.3 {tcl_GetInt with iffy numbers} testgetint { - lmap x {0 " 0" "0 " " 0 " " 0xa " " 007 " " 0o10 " " 0b10 "} { + lmap x {0 " 0" "0 " " 0 " " 0xa " " 010 " " 0o10 " " 0b10 "} { catch {testgetint 44 $x} x set x } -} {44 44 44 44 54 51 52 46} +} {44 44 44 44 54 54 52 46} test get-3.4 {Tcl_GetDouble with iffy numbers} testdoubleobj { - lmap x {0 0.0 " .0" ".0 " " 0e0 " "07" "- 0" "-0" "0o12" "0b10"} { + lmap x {0 0.0 " .0" ".0 " " 0e0 " "09" "- 0" "-0" "0o12" "0b10"} { catch {testdoubleobj set 1 $x} x set x } -} {0.0 0.0 0.0 0.0 0.0 7.0 {expected floating-point number but got "- 0"} 0.0 10.0 2.0} +} {0.0 0.0 0.0 0.0 0.0 9.0 {expected floating-point number but got "- 0"} 0.0 10.0 2.0} # cleanup ::tcltest::cleanupTests diff --git a/tests/lindex.test b/tests/lindex.test index 29eb898..4802e28 100644 --- a/tests/lindex.test +++ b/tests/lindex.test @@ -70,11 +70,11 @@ test lindex-3.4 {integer 3} testevalex { test lindex-3.5 {bad octal} -constraints testevalex -body { set x 0o8 list [catch { testevalex {lindex {a b c} $x} } result] $result -} -match glob -result {1 {*invalid octal number*}} +} -match glob -result {1 {*}} test lindex-3.6 {bad octal} -constraints testevalex -body { set x -0o9 list [catch { testevalex {lindex {a b c} $x} } result] $result -} -match glob -result {1 {*invalid octal number*}} +} -match glob -result {1 {*}} 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] @@ -105,11 +105,11 @@ test lindex-4.5 {index = end-3} testevalex { test lindex-4.6 {bad octal} -constraints testevalex -body { set x end-0o8 list [catch { testevalex {lindex {a b c} $x} } result] $result -} -match glob -result {1 {*invalid octal number*}} +} -match glob -result {1 {*}} test lindex-4.7 {bad octal} -constraints testevalex -body { set x end--0o9 list [catch { testevalex {lindex {a b c} $x} } result] $result -} -match glob -result {1 {*invalid octal number*}} +} -match glob -result {1 {*}} test lindex-4.8 {bad integer, not octal} testevalex { set x end-0a2 list [catch { testevalex {lindex {a b c} $x} } result] $result @@ -261,11 +261,11 @@ test lindex-11.4 {integer 3} { test lindex-11.5 {bad octal} -body { set x 0o8 list [catch { lindex {a b c} $x } result] $result -} -match glob -result {1 {*invalid octal number*}} +} -match glob -result {1 {*}} test lindex-11.6 {bad octal} -body { set x -0o9 list [catch { lindex {a b c} $x } result] $result -} -match glob -result {1 {*invalid octal number*}} +} -match glob -result {1 {*}} # Indices relative to end @@ -307,11 +307,11 @@ test lindex-12.5 {index = end-3} { test lindex-12.6 {bad octal} -body { set x end-0o8 list [catch { lindex {a b c} $x } result] $result -} -match glob -result {1 {*invalid octal number*}} +} -match glob -result {1 {*}} test lindex-12.7 {bad octal} -body { set x end--0o9 list [catch { lindex {a b c} $x } result] $result -} -match glob -result {1 {*invalid octal number*}} +} -match glob -result {1 {*}} test lindex-12.8 {bad integer, not octal} { set x end-0a2 list [catch { lindex {a b c} $x } result] $result diff --git a/tests/mathop.test b/tests/mathop.test index f122b7b..0808d42 100644 --- a/tests/mathop.test +++ b/tests/mathop.test @@ -114,22 +114,22 @@ namespace eval ::testmathop { test mathop-1.10 {compiled +} { + 1 2 3000000000000000000000 } 3000000000000000000003 test mathop-1.11 {compiled +: errors} -returnCodes error -body { + x 0 - } -result {can't use non-numeric string as operand of "+"} + } -result {can't use non-numeric string "x" as operand of "+"} test mathop-1.12 {compiled +: errors} -returnCodes error -body { + nan 0 - } -result {can't use non-numeric floating-point value as operand of "+"} + } -result {can't use non-numeric floating-point value "nan" as operand of "+"} test mathop-1.13 {compiled +: errors} -returnCodes error -body { + 0 x - } -result {can't use non-numeric string as operand of "+"} + } -result {can't use non-numeric string "x" as operand of "+"} test mathop-1.14 {compiled +: errors} -returnCodes error -body { + 0 nan - } -result {can't use non-numeric floating-point value as operand of "+"} + } -result {can't use non-numeric floating-point value "nan" as operand of "+"} test mathop-1.15 {compiled +: errors} -returnCodes error -body { + 0o8 0 - } -result {can't use invalid octal number as operand of "+"} + } -result {can't use non-numeric string "0o8" as operand of "+"} test mathop-1.16 {compiled +: errors} -returnCodes error -body { + 0 0o8 - } -result {can't use invalid octal number as operand of "+"} + } -result {can't use non-numeric string "0o8" as operand of "+"} test mathop-1.17 {compiled +: errors} -returnCodes error -body { + 0 [error expectedError] } -result expectedError @@ -152,22 +152,22 @@ namespace eval ::testmathop { test mathop-1.28 {interpreted +} { $op 1 2 3000000000000000000000 } 3000000000000000000003 test mathop-1.29 {interpreted +: errors} -returnCodes error -body { $op x 0 - } -result {can't use non-numeric string as operand of "+"} + } -result {can't use non-numeric string "x" as operand of "+"} test mathop-1.30 {interpreted +: errors} -returnCodes error -body { $op nan 0 - } -result {can't use non-numeric floating-point value as operand of "+"} + } -result {can't use non-numeric floating-point value "nan" as operand of "+"} test mathop-1.31 {interpreted +: errors} -returnCodes error -body { $op 0 x - } -result {can't use non-numeric string as operand of "+"} + } -result {can't use non-numeric string "x" as operand of "+"} test mathop-1.32 {interpreted +: errors} -returnCodes error -body { $op 0 nan - } -result {can't use non-numeric floating-point value as operand of "+"} + } -result {can't use non-numeric floating-point value "nan" as operand of "+"} test mathop-1.33 {interpreted +: errors} -returnCodes error -body { $op 0o8 0 - } -result {can't use invalid octal number as operand of "+"} + } -result {can't use non-numeric string "0o8" as operand of "+"} test mathop-1.34 {interpreted +: errors} -returnCodes error -body { $op 0 0o8 - } -result {can't use invalid octal number as operand of "+"} + } -result {can't use non-numeric string "0o8" as operand of "+"} test mathop-1.35 {interpreted +: errors} -returnCodes error -body { $op 0 [error expectedError] } -result expectedError @@ -189,22 +189,22 @@ namespace eval ::testmathop { test mathop-2.10 {compiled *} { * 1 2 3000000000000000000000 } 6000000000000000000000 test mathop-2.11 {compiled *: errors} -returnCodes error -body { * x 0 - } -result {can't use non-numeric string as operand of "*"} + } -result {can't use non-numeric string "x" as operand of "*"} test mathop-2.12 {compiled *: errors} -returnCodes error -body { * nan 0 - } -result {can't use non-numeric floating-point value as operand of "*"} + } -result {can't use non-numeric floating-point value "nan" as operand of "*"} test mathop-2.13 {compiled *: errors} -returnCodes error -body { * 0 x - } -result {can't use non-numeric string as operand of "*"} + } -result {can't use non-numeric string "x" as operand of "*"} test mathop-2.14 {compiled *: errors} -returnCodes error -body { * 0 nan - } -result {can't use non-numeric floating-point value as operand of "*"} + } -result {can't use non-numeric floating-point value "nan" as operand of "*"} test mathop-2.15 {compiled *: errors} -returnCodes error -body { * 0o8 0 - } -result {can't use invalid octal number as operand of "*"} + } -result {can't use non-numeric string "0o8" as operand of "*"} test mathop-2.16 {compiled *: errors} -returnCodes error -body { * 0 0o8 - } -result {can't use invalid octal number as operand of "*"} + } -result {can't use non-numeric string "0o8" as operand of "*"} test mathop-2.17 {compiled *: errors} -returnCodes error -body { * 0 [error expectedError] } -result expectedError @@ -227,22 +227,22 @@ namespace eval ::testmathop { test mathop-2.28 {interpreted *} { $op 1 2 3000000000000000000000 } 6000000000000000000000 test mathop-2.29 {interpreted *: errors} -returnCodes error -body { $op x 0 - } -result {can't use non-numeric string as operand of "*"} + } -result {can't use non-numeric string "x" as operand of "*"} test mathop-2.30 {interpreted *: errors} -returnCodes error -body { $op nan 0 - } -result {can't use non-numeric floating-point value as operand of "*"} + } -result {can't use non-numeric floating-point value "nan" as operand of "*"} test mathop-2.31 {interpreted *: errors} -returnCodes error -body { $op 0 x - } -result {can't use non-numeric string as operand of "*"} + } -result {can't use non-numeric string "x" as operand of "*"} test mathop-2.32 {interpreted *: errors} -returnCodes error -body { $op 0 nan - } -result {can't use non-numeric floating-point value as operand of "*"} + } -result {can't use non-numeric floating-point value "nan" as operand of "*"} test mathop-2.33 {interpreted *: errors} -returnCodes error -body { $op 0o8 0 - } -result {can't use invalid octal number as operand of "*"} + } -result {can't use non-numeric string "0o8" as operand of "*"} test mathop-2.34 {interpreted *: errors} -returnCodes error -body { $op 0 0o8 - } -result {can't use invalid octal number as operand of "*"} + } -result {can't use non-numeric string "0o8" as operand of "*"} test mathop-2.35 {interpreted *: errors} -returnCodes error -body { $op 0 [error expectedError] } -result expectedError @@ -261,7 +261,7 @@ namespace eval ::testmathop { test mathop-3.7 {compiled !} {! 10000000000000000000000000} 0 test mathop-3.8 {compiled !: errors} -body { ! foobar - } -returnCodes error -result {can't use non-numeric string as operand of "!"} + } -returnCodes error -result {can't use non-numeric string "foobar" as operand of "!"} test mathop-3.9 {compiled !: errors} -body { ! 0 0 } -returnCodes error -result "wrong # args: should be \"! boolean\"" @@ -278,7 +278,7 @@ namespace eval ::testmathop { test mathop-3.17 {interpreted !} {$op 10000000000000000000000000} 0 test mathop-3.18 {interpreted !: errors} -body { $op foobar - } -returnCodes error -result {can't use non-numeric string as operand of "!"} + } -returnCodes error -result {can't use non-numeric string "foobar" as operand of "!"} test mathop-3.19 {interpreted !: errors} -body { $op 0 0 } -returnCodes error -result "wrong # args: should be \"! boolean\"" @@ -287,10 +287,10 @@ namespace eval ::testmathop { } -returnCodes error -result "wrong # args: should be \"! boolean\"" test mathop-3.21 {compiled !: error} -returnCodes error -body { ! NaN - } -result {can't use non-numeric floating-point value as operand of "!"} + } -result {can't use non-numeric floating-point value "NaN" as operand of "!"} test mathop-3.22 {interpreted !: error} -returnCodes error -body { $op NaN - } -result {can't use non-numeric floating-point value as operand of "!"} + } -result {can't use non-numeric floating-point value "NaN" as operand of "!"} test mathop-4.1 {compiled ~} {~ 0} -1 test mathop-4.2 {compiled ~} {~ 1} -2 @@ -301,7 +301,7 @@ namespace eval ::testmathop { test mathop-4.7 {compiled ~} {~ 10000000000000000000000000} -10000000000000000000000001 test mathop-4.8 {compiled ~: errors} -body { ~ foobar - } -returnCodes error -result {can't use non-numeric string as operand of "~"} + } -returnCodes error -result {can't use non-numeric string "foobar" as operand of "~"} test mathop-4.9 {compiled ~: errors} -body { ~ 0 0 } -returnCodes error -result "wrong # args: should be \"~ integer\"" @@ -310,10 +310,10 @@ namespace eval ::testmathop { } -returnCodes error -result "wrong # args: should be \"~ integer\"" test mathop-4.11 {compiled ~: errors} -returnCodes error -body { ~ 0.0 - } -result {can't use floating-point value as operand of "~"} + } -result {can't use floating-point value "0.0" as operand of "~"} test mathop-4.12 {compiled ~: errors} -returnCodes error -body { ~ NaN - } -result {can't use non-numeric floating-point value as operand of "~"} + } -result {can't use non-numeric floating-point value "NaN" as operand of "~"} set op ~ test mathop-4.13 {interpreted ~} {$op 0} -1 test mathop-4.14 {interpreted ~} {$op 1} -2 @@ -324,7 +324,7 @@ namespace eval ::testmathop { test mathop-4.19 {interpreted ~} {$op 10000000000000000000000000} -10000000000000000000000001 test mathop-4.20 {interpreted ~: errors} -body { $op foobar - } -returnCodes error -result {can't use non-numeric string as operand of "~"} + } -returnCodes error -result {can't use non-numeric string "foobar" as operand of "~"} test mathop-4.21 {interpreted ~: errors} -body { $op 0 0 } -returnCodes error -result "wrong # args: should be \"~ integer\"" @@ -333,10 +333,10 @@ namespace eval ::testmathop { } -returnCodes error -result "wrong # args: should be \"~ integer\"" test mathop-4.23 {interpreted ~: errors} -returnCodes error -body { $op 0.0 - } -result {can't use floating-point value as operand of "~"} + } -result {can't use floating-point value "0.0" as operand of "~"} test mathop-4.24 {interpreted ~: errors} -returnCodes error -body { $op NaN - } -result {can't use non-numeric floating-point value as operand of "~"} + } -result {can't use non-numeric floating-point value "NaN" as operand of "~"} test mathop-5.1 {compiled eq} {eq {} a} 0 test mathop-5.2 {compiled eq} {eq a a} 1 @@ -377,32 +377,32 @@ namespace eval ::testmathop { test mathop-6.4 {compiled &} { & 3 7 6 } 2 test mathop-6.5 {compiled &} -returnCodes error -body { & 1.0 2 3 - } -result {can't use floating-point value as operand of "&"} + } -result {can't use floating-point value "1.0" as operand of "&"} test mathop-6.6 {compiled &} -returnCodes error -body { & 1 2 3.0 - } -result {can't use floating-point value as operand of "&"} + } -result {can't use floating-point value "3.0" as operand of "&"} test mathop-6.7 {compiled &} { & 100000000002 18 -126 } 2 test mathop-6.8 {compiled &} { & 0xff 0o377 333333333333 } 85 test mathop-6.9 {compiled &} { & 1000000000000000000002 18 -126 } 2 test mathop-6.10 {compiled &} { & 0xff 0o377 3333333333333333333333 } 85 test mathop-6.11 {compiled &: errors} -returnCodes error -body { & x 0 - } -result {can't use non-numeric string as operand of "&"} + } -result {can't use non-numeric string "x" as operand of "&"} test mathop-6.12 {compiled &: errors} -returnCodes error -body { & nan 0 - } -result {can't use non-numeric floating-point value as operand of "&"} + } -result {can't use non-numeric floating-point value "nan" as operand of "&"} test mathop-6.13 {compiled &: errors} -returnCodes error -body { & 0 x - } -result {can't use non-numeric string as operand of "&"} + } -result {can't use non-numeric string "x" as operand of "&"} test mathop-6.14 {compiled &: errors} -returnCodes error -body { & 0 nan - } -result {can't use non-numeric floating-point value as operand of "&"} + } -result {can't use non-numeric floating-point value "nan" as operand of "&"} test mathop-6.15 {compiled &: errors} -returnCodes error -body { & 0o8 0 - } -result {can't use invalid octal number as operand of "&"} + } -result {can't use non-numeric string "0o8" as operand of "&"} test mathop-6.16 {compiled &: errors} -returnCodes error -body { & 0 0o8 - } -result {can't use invalid octal number as operand of "&"} + } -result {can't use non-numeric string "0o8" as operand of "&"} test mathop-6.17 {compiled &: errors} -returnCodes error -body { & 0 [error expectedError] } -result expectedError @@ -419,32 +419,32 @@ namespace eval ::testmathop { test mathop-6.22 {interpreted &} { $op 3 7 6 } 2 test mathop-6.23 {interpreted &} -returnCodes error -body { $op 1.0 2 3 - } -result {can't use floating-point value as operand of "&"} + } -result {can't use floating-point value "1.0" as operand of "&"} test mathop-6.24 {interpreted &} -returnCodes error -body { $op 1 2 3.0 - } -result {can't use floating-point value as operand of "&"} + } -result {can't use floating-point value "3.0" as operand of "&"} test mathop-6.25 {interpreted &} { $op 100000000002 18 -126 } 2 test mathop-6.26 {interpreted &} { $op 0xff 0o377 333333333333 } 85 test mathop-6.27 {interpreted &} { $op 1000000000000000000002 18 -126 } 2 test mathop-6.28 {interpreted &} { $op 0xff 0o377 3333333333333333333333 } 85 test mathop-6.29 {interpreted &: errors} -returnCodes error -body { $op x 0 - } -result {can't use non-numeric string as operand of "&"} + } -result {can't use non-numeric string "x" as operand of "&"} test mathop-6.30 {interpreted &: errors} -returnCodes error -body { $op nan 0 - } -result {can't use non-numeric floating-point value as operand of "&"} + } -result {can't use non-numeric floating-point value "nan" as operand of "&"} test mathop-6.31 {interpreted &: errors} -returnCodes error -body { $op 0 x - } -result {can't use non-numeric string as operand of "&"} + } -result {can't use non-numeric string "x" as operand of "&"} test mathop-6.32 {interpreted &: errors} -returnCodes error -body { $op 0 nan - } -result {can't use non-numeric floating-point value as operand of "&"} + } -result {can't use non-numeric floating-point value "nan" as operand of "&"} test mathop-6.33 {interpreted &: errors} -returnCodes error -body { $op 0o8 0 - } -result {can't use invalid octal number as operand of "&"} + } -result {can't use non-numeric string "0o8" as operand of "&"} test mathop-6.34 {interpreted &: errors} -returnCodes error -body { $op 0 0o8 - } -result {can't use invalid octal number as operand of "&"} + } -result {can't use non-numeric string "0o8" as operand of "&"} test mathop-6.35 {interpreted &: errors} -returnCodes error -body { $op 0 [error expectedError] } -result expectedError @@ -487,32 +487,32 @@ namespace eval ::testmathop { test mathop-7.4 {compiled |} { | 3 7 6 } 7 test mathop-7.5 {compiled |} -returnCodes error -body { | 1.0 2 3 - } -result {can't use floating-point value as operand of "|"} + } -result {can't use floating-point value "1.0" as operand of "|"} test mathop-7.6 {compiled |} -returnCodes error -body { | 1 2 3.0 - } -result {can't use floating-point value as operand of "|"} + } -result {can't use floating-point value "3.0" as operand of "|"} test mathop-7.7 {compiled |} { | 100000000002 18 -126 } -110 test mathop-7.8 {compiled |} { | 0xff 0o377 333333333333 } 333333333503 test mathop-7.9 {compiled |} { | 1000000000000000000002 18 -126 } -110 test mathop-7.10 {compiled |} { | 0xff 0o377 3333333333333333333333 } 3333333333333333333503 test mathop-7.11 {compiled |: errors} -returnCodes error -body { | x 0 - } -result {can't use non-numeric string as operand of "|"} + } -result {can't use non-numeric string "x" as operand of "|"} test mathop-7.12 {compiled |: errors} -returnCodes error -body { | nan 0 - } -result {can't use non-numeric floating-point value as operand of "|"} + } -result {can't use non-numeric floating-point value "nan" as operand of "|"} test mathop-7.13 {compiled |: errors} -returnCodes error -body { | 0 x - } -result {can't use non-numeric string as operand of "|"} + } -result {can't use non-numeric string "x" as operand of "|"} test mathop-7.14 {compiled |: errors} -returnCodes error -body { | 0 nan - } -result {can't use non-numeric floating-point value as operand of "|"} + } -result {can't use non-numeric floating-point value "nan" as operand of "|"} test mathop-7.15 {compiled |: errors} -returnCodes error -body { | 0o8 0 - } -result {can't use invalid octal number as operand of "|"} + } -result {can't use non-numeric string "0o8" as operand of "|"} test mathop-7.16 {compiled |: errors} -returnCodes error -body { | 0 0o8 - } -result {can't use invalid octal number as operand of "|"} + } -result {can't use non-numeric string "0o8" as operand of "|"} test mathop-7.17 {compiled |: errors} -returnCodes error -body { | 0 [error expectedError] } -result expectedError @@ -529,32 +529,32 @@ namespace eval ::testmathop { test mathop-7.22 {interpreted |} { $op 3 7 6 } 7 test mathop-7.23 {interpreted |} -returnCodes error -body { $op 1.0 2 3 - } -result {can't use floating-point value as operand of "|"} + } -result {can't use floating-point value "1.0" as operand of "|"} test mathop-7.24 {interpreted |} -returnCodes error -body { $op 1 2 3.0 - } -result {can't use floating-point value as operand of "|"} + } -result {can't use floating-point value "3.0" as operand of "|"} test mathop-7.25 {interpreted |} { $op 100000000002 18 -126 } -110 test mathop-7.26 {interpreted |} { $op 0xff 0o377 333333333333 } 333333333503 test mathop-7.27 {interpreted |} { $op 1000000000000000000002 18 -126 } -110 test mathop-7.28 {interpreted |} { $op 0xff 0o377 3333333333333333333333 } 3333333333333333333503 test mathop-7.29 {interpreted |: errors} -returnCodes error -body { $op x 0 - } -result {can't use non-numeric string as operand of "|"} + } -result {can't use non-numeric string "x" as operand of "|"} test mathop-7.30 {interpreted |: errors} -returnCodes error -body { $op nan 0 - } -result {can't use non-numeric floating-point value as operand of "|"} + } -result {can't use non-numeric floating-point value "nan" as operand of "|"} test mathop-7.31 {interpreted |: errors} -returnCodes error -body { $op 0 x - } -result {can't use non-numeric string as operand of "|"} + } -result {can't use non-numeric string "x" as operand of "|"} test mathop-7.32 {interpreted |: errors} -returnCodes error -body { $op 0 nan - } -result {can't use non-numeric floating-point value as operand of "|"} + } -result {can't use non-numeric floating-point value "nan" as operand of "|"} test mathop-7.33 {interpreted |: errors} -returnCodes error -body { $op 0o8 0 - } -result {can't use invalid octal number as operand of "|"} + } -result {can't use non-numeric string "0o8" as operand of "|"} test mathop-7.34 {interpreted |: errors} -returnCodes error -body { $op 0 0o8 - } -result {can't use invalid octal number as operand of "|"} + } -result {can't use non-numeric string "0o8" as operand of "|"} test mathop-7.35 {interpreted |: errors} -returnCodes error -body { $op 0 [error expectedError] } -result expectedError @@ -597,32 +597,32 @@ namespace eval ::testmathop { test mathop-8.4 {compiled ^} { ^ 3 7 6 } 2 test mathop-8.5 {compiled ^} -returnCodes error -body { ^ 1.0 2 3 - } -result {can't use floating-point value as operand of "^"} + } -result {can't use floating-point value "1.0" as operand of "^"} test mathop-8.6 {compiled ^} -returnCodes error -body { ^ 1 2 3.0 - } -result {can't use floating-point value as operand of "^"} + } -result {can't use floating-point value "3.0" as operand of "^"} test mathop-8.7 {compiled ^} { ^ 100000000002 18 -126 } -100000000110 test mathop-8.8 {compiled ^} { ^ 0xff 0o377 333333333333 } 333333333333 test mathop-8.9 {compiled ^} { ^ 1000000000000000000002 18 -126 } -1000000000000000000110 test mathop-8.10 {compiled ^} { ^ 0xff 0o377 3333333333333333333333 } 3333333333333333333333 test mathop-8.11 {compiled ^: errors} -returnCodes error -body { ^ x 0 - } -result {can't use non-numeric string as operand of "^"} + } -result {can't use non-numeric string "x" as operand of "^"} test mathop-8.12 {compiled ^: errors} -returnCodes error -body { ^ nan 0 - } -result {can't use non-numeric floating-point value as operand of "^"} + } -result {can't use non-numeric floating-point value "nan" as operand of "^"} test mathop-8.13 {compiled ^: errors} -returnCodes error -body { ^ 0 x - } -result {can't use non-numeric string as operand of "^"} + } -result {can't use non-numeric string "x" as operand of "^"} test mathop-8.14 {compiled ^: errors} -returnCodes error -body { ^ 0 nan - } -result {can't use non-numeric floating-point value as operand of "^"} + } -result {can't use non-numeric floating-point value "nan" as operand of "^"} test mathop-8.15 {compiled ^: errors} -returnCodes error -body { ^ 0o8 0 - } -result {can't use invalid octal number as operand of "^"} + } -result {can't use non-numeric string "0o8" as operand of "^"} test mathop-8.16 {compiled ^: errors} -returnCodes error -body { ^ 0 0o8 - } -result {can't use invalid octal number as operand of "^"} + } -result {can't use non-numeric string "0o8" as operand of "^"} test mathop-8.17 {compiled ^: errors} -returnCodes error -body { ^ 0 [error expectedError] } -result expectedError @@ -639,32 +639,32 @@ namespace eval ::testmathop { test mathop-8.22 {interpreted ^} { $op 3 7 6 } 2 test mathop-8.23 {interpreted ^} -returnCodes error -body { $op 1.0 2 3 - } -result {can't use floating-point value as operand of "^"} + } -result {can't use floating-point value "1.0" as operand of "^"} test mathop-8.24 {interpreted ^} -returnCodes error -body { $op 1 2 3.0 - } -result {can't use floating-point value as operand of "^"} + } -result {can't use floating-point value "3.0" as operand of "^"} test mathop-8.25 {interpreted ^} { $op 100000000002 18 -126 } -100000000110 test mathop-8.26 {interpreted ^} { $op 0xff 0o377 333333333333 } 333333333333 test mathop-8.27 {interpreted ^} { $op 1000000000000000000002 18 -126 } -1000000000000000000110 test mathop-8.28 {interpreted ^} { $op 0xff 0o377 3333333333333333333333 } 3333333333333333333333 test mathop-8.29 {interpreted ^: errors} -returnCodes error -body { $op x 0 - } -result {can't use non-numeric string as operand of "^"} + } -result {can't use non-numeric string "x" as operand of "^"} test mathop-8.30 {interpreted ^: errors} -returnCodes error -body { $op nan 0 - } -result {can't use non-numeric floating-point value as operand of "^"} + } -result {can't use non-numeric floating-point value "nan" as operand of "^"} test mathop-8.31 {interpreted ^: errors} -returnCodes error -body { $op 0 x - } -result {can't use non-numeric string as operand of "^"} + } -result {can't use non-numeric string "x" as operand of "^"} test mathop-8.32 {interpreted ^: errors} -returnCodes error -body { $op 0 nan - } -result {can't use non-numeric floating-point value as operand of "^"} + } -result {can't use non-numeric floating-point value "nan" as operand of "^"} test mathop-8.33 {interpreted ^: errors} -returnCodes error -body { $op 0o8 0 - } -result {can't use invalid octal number as operand of "^"} + } -result {can't use non-numeric string "0o8" as operand of "^"} test mathop-8.34 {interpreted ^: errors} -returnCodes error -body { $op 0 0o8 - } -result {can't use invalid octal number as operand of "^"} + } -result {can't use non-numeric string "0o8" as operand of "^"} test mathop-8.35 {interpreted ^: errors} -returnCodes error -body { $op 0 [error expectedError] } -result expectedError @@ -775,13 +775,13 @@ test mathop-20.6 { one arg, error } { # skipping - for now, knownbug... foreach op {+ * / & | ^ **} { lappend res [TestOp $op {*}$vals] - lappend exp "can't use non-numeric string as operand of \"$op\"\ + lappend exp "can't use non-numeric string \"x\" as operand of \"$op\"\ ARITH DOMAIN {non-numeric string}" } } foreach op {+ * / & | ^ **} { lappend res [TestOp $op NaN 1] - lappend exp "can't use non-numeric floating-point value as operand of \"$op\"\ + lappend exp "can't use non-numeric floating-point value \"NaN\" as operand of \"$op\"\ ARITH DOMAIN {non-numeric floating-point value}" } expr {$res eq $exp ? 0 : $res} @@ -850,15 +850,15 @@ test mathop-21.5 { unary ops, bad values } { set res {} set exp {} lappend res [TestOp / x] - lappend exp "can't use non-numeric string as operand of \"/\" ARITH DOMAIN {non-numeric string}" + lappend exp "can't use non-numeric string \"x\" as operand of \"/\" ARITH DOMAIN {non-numeric string}" lappend res [TestOp - x] - lappend exp "can't use non-numeric string as operand of \"-\" ARITH DOMAIN {non-numeric string}" + lappend exp "can't use non-numeric string \"x\" as operand of \"-\" ARITH DOMAIN {non-numeric string}" lappend res [TestOp ~ x] - lappend exp "can't use non-numeric string as operand of \"~\" ARITH DOMAIN {non-numeric string}" + lappend exp "can't use non-numeric string \"x\" as operand of \"~\" ARITH DOMAIN {non-numeric string}" lappend res [TestOp ! x] - lappend exp "can't use non-numeric string as operand of \"!\" ARITH DOMAIN {non-numeric string}" + lappend exp "can't use non-numeric string \"x\" as operand of \"!\" ARITH DOMAIN {non-numeric string}" lappend res [TestOp ~ 5.0] - lappend exp "can't use floating-point value as operand of \"~\" ARITH DOMAIN {floating-point value}" + lappend exp "can't use floating-point value \"5.0\" as operand of \"~\" ARITH DOMAIN {floating-point value}" expr {$res eq $exp ? 0 : $res} } 0 test mathop-21.6 { unary ops, too many } { @@ -965,9 +965,9 @@ test mathop-22.4 { unary ops, bad values } { set exp {} foreach op {& | ^} { lappend res [TestOp $op x 5] - lappend exp "can't use non-numeric string as operand of \"$op\" ARITH DOMAIN {non-numeric string}" + lappend exp "can't use non-numeric string \"x\" as operand of \"$op\" ARITH DOMAIN {non-numeric string}" lappend res [TestOp $op 5 x] - lappend exp "can't use non-numeric string as operand of \"$op\" ARITH DOMAIN {non-numeric string}" + lappend exp "can't use non-numeric string \"x\" as operand of \"$op\" ARITH DOMAIN {non-numeric string}" } expr {$res eq $exp ? 0 : $res} } 0 @@ -1080,15 +1080,15 @@ test mathop-24.3 { binary ops, bad values } { set exp {} foreach op {% << >>} { lappend res [TestOp $op x 1] - lappend exp "can't use non-numeric string as operand of \"$op\" ARITH DOMAIN {non-numeric string}" + lappend exp "can't use non-numeric string \"x\" as operand of \"$op\" ARITH DOMAIN {non-numeric string}" lappend res [TestOp $op 1 x] - lappend exp "can't use non-numeric string as operand of \"$op\" ARITH DOMAIN {non-numeric string}" + lappend exp "can't use non-numeric string \"x\" as operand of \"$op\" ARITH DOMAIN {non-numeric string}" } foreach op {% << >>} { lappend res [TestOp $op 5.0 1] - lappend exp "can't use floating-point value as operand of \"$op\" ARITH DOMAIN {floating-point value}" + lappend exp "can't use floating-point value \"5.0\" as operand of \"$op\" ARITH DOMAIN {floating-point value}" lappend res [TestOp $op 1 5.0] - lappend exp "can't use floating-point value as operand of \"$op\" ARITH DOMAIN {floating-point value}" + lappend exp "can't use floating-point value \"5.0\" as operand of \"$op\" ARITH DOMAIN {floating-point value}" } foreach op {in ni} { lappend res [TestOp $op 5 "a b \{ c"] @@ -1240,9 +1240,9 @@ test mathop-25.23 { exp operator errors } { lappend res [TestOp ** $huge 2.1] lappend exp "Inf" lappend res [TestOp ** 2 foo] - lappend exp "can't use non-numeric string as operand of \"**\" ARITH DOMAIN {non-numeric string}" + lappend exp "can't use non-numeric string \"foo\" as operand of \"**\" ARITH DOMAIN {non-numeric string}" lappend res [TestOp ** foo 2] - lappend exp "can't use non-numeric string as operand of \"**\" ARITH DOMAIN {non-numeric string}" + lappend exp "can't use non-numeric string \"foo\" as operand of \"**\" ARITH DOMAIN {non-numeric string}" expr {$res eq $exp ? 0 : $res} } 0 diff --git a/tests/string.test b/tests/string.test index 549944d..f3160a8 100644 --- a/tests/string.test +++ b/tests/string.test @@ -280,10 +280,10 @@ test string-5.16 {string index, bytearray object with string obj shimmering} { } 0 test string-5.17 {string index, bad integer} -body { list [catch {string index "abc" 0o8} msg] $msg -} -match glob -result {1 {*invalid octal number*}} +} -match glob -result {1 {*}} test string-5.18 {string index, bad integer} -body { list [catch {string index "abc" end-0o0289} msg] $msg -} -match glob -result {1 {*invalid octal number*}} +} -match glob -result {1 {*}} test string-5.19 {string index, bytearray object out of bounds} { string index [binary format I* {0x50515253 0x52}] -1 } {} diff --git a/tests/stringComp.test b/tests/stringComp.test index 2aeb08e..3ce2b72 100644 --- a/tests/stringComp.test +++ b/tests/stringComp.test @@ -355,11 +355,11 @@ test stringComp-5.16 {string index, bytearray object with string obj shimmering} test stringComp-5.17 {string index, bad integer} -body { proc foo {} {string index "abc" 0o8} list [catch {foo} msg] $msg -} -match glob -result {1 {*invalid octal number*}} +} -match glob -result {1 {*}} test stringComp-5.18 {string index, bad integer} -body { proc foo {} {string index "abc" end-0o0289} list [catch {foo} msg] $msg -} -match glob -result {1 {*invalid octal number*}} +} -match glob -result {1 {*}} test stringComp-5.19 {string index, bytearray object out of bounds} { proc foo {} {string index [binary format I* {0x50515253 0x52}] -1} foo diff --git a/tests/while-old.test b/tests/while-old.test index ee17d0b..e33bd0b 100644 --- a/tests/while-old.test +++ b/tests/while-old.test @@ -92,7 +92,7 @@ test while-old-4.3 {errors in while loops} { test while-old-4.4 {errors in while loops} { set err [catch {while {"a"+"b"} {error "loop aborted"}} msg] list $err $msg -} {1 {can't use non-numeric string as operand of "+"}} +} {1 {can't use non-numeric string "a" as operand of "+"}} test while-old-4.5 {errors in while loops} { catch {unset x} set x 1 diff --git a/tests/while.test b/tests/while.test index 642ec93..c25b404 100644 --- a/tests/while.test +++ b/tests/while.test @@ -32,7 +32,7 @@ test while-1.2 {TclCompileWhileCmd: error in test expression} -body { } -match glob -result {*"while {$i<} break"} test while-1.3 {TclCompileWhileCmd: error in test expression} -body { while {"a"+"b"} {error "loop aborted"} -} -returnCodes error -result {can't use non-numeric string as operand of "+"} +} -returnCodes error -result {can't use non-numeric string "a" as operand of "+"} test while-1.4 {TclCompileWhileCmd: multiline test expr} -body { set value 1 while {($tcl_platform(platform) != "foobar1") && \ @@ -343,7 +343,7 @@ test while-4.3 {while (not compiled): error in test expression} -body { test while-4.4 {while (not compiled): error in test expression} -body { set z while $z {"a"+"b"} {error "loop aborted"} -} -returnCodes error -result {can't use non-numeric string as operand of "+"} +} -returnCodes error -result {can't use non-numeric string "a" as operand of "+"} test while-4.5 {while (not compiled): multiline test expr} -body { set value 1 set z while -- cgit v0.12 From 44077043167cd6acfe43132817852e7508b4ff29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ignacio=20Mar=C3=ADn?= Date: Mon, 23 Oct 2017 16:59:20 +0000 Subject: Update TZ info to tzcode2017c. --- library/tzdata/Africa/Juba | 40 ++++++++- library/tzdata/Africa/Khartoum | 1 + library/tzdata/Africa/Windhoek | 169 +------------------------------------- library/tzdata/America/Adak | 4 +- library/tzdata/America/Anchorage | 2 +- library/tzdata/America/Detroit | 2 - library/tzdata/America/Grand_Turk | 164 ++++++++++++++++++++++++++++++++++++ library/tzdata/America/Juneau | 2 +- library/tzdata/America/Metlakatla | 2 +- library/tzdata/America/Nome | 4 +- library/tzdata/America/Sitka | 2 +- library/tzdata/America/Yakutat | 2 +- library/tzdata/Asia/Famagusta | 165 +++++++++++++++++++++++++++++++++++++ library/tzdata/Asia/Kolkata | 6 +- library/tzdata/Asia/Yangon | 6 +- library/tzdata/Asia/Yerevan | 1 + library/tzdata/Europe/Dublin | 6 +- library/tzdata/Pacific/Apia | 2 +- library/tzdata/Pacific/Fiji | 24 +++--- library/tzdata/Pacific/Pago_Pago | 2 +- library/tzdata/Pacific/Tongatapu | 165 ------------------------------------- 21 files changed, 404 insertions(+), 367 deletions(-) diff --git a/library/tzdata/Africa/Juba b/library/tzdata/Africa/Juba index 40551f2..a0dbf5e 100644 --- a/library/tzdata/Africa/Juba +++ b/library/tzdata/Africa/Juba @@ -1,5 +1,39 @@ # created by tools/tclZIC.tcl - do not edit -if {![info exists TZData(Africa/Khartoum)]} { - LoadTimeZoneFile Africa/Khartoum + +set TZData(:Africa/Juba) { + {-9223372036854775808 7588 0 LMT} + {-1230775588 7200 0 CAT} + {10360800 10800 1 CAST} + {24786000 7200 0 CAT} + {41810400 10800 1 CAST} + {56322000 7200 0 CAT} + {73432800 10800 1 CAST} + {87944400 7200 0 CAT} + {104882400 10800 1 CAST} + {119480400 7200 0 CAT} + {136332000 10800 1 CAST} + {151016400 7200 0 CAT} + {167781600 10800 1 CAST} + {182552400 7200 0 CAT} + {199231200 10800 1 CAST} + {214174800 7200 0 CAT} + {230680800 10800 1 CAST} + {245710800 7200 0 CAT} + {262735200 10800 1 CAST} + {277246800 7200 0 CAT} + {294184800 10800 1 CAST} + {308782800 7200 0 CAT} + {325634400 10800 1 CAST} + {340405200 7200 0 CAT} + {357084000 10800 1 CAST} + {371941200 7200 0 CAT} + {388533600 10800 1 CAST} + {403477200 7200 0 CAT} + {419983200 10800 1 CAST} + {435013200 7200 0 CAT} + {452037600 10800 1 CAST} + {466635600 7200 0 CAT} + {483487200 10800 1 CAST} + {498171600 7200 0 CAT} + {947930400 10800 0 EAT} } -set TZData(:Africa/Juba) $TZData(:Africa/Khartoum) diff --git a/library/tzdata/Africa/Khartoum b/library/tzdata/Africa/Khartoum index dfcac82..dc441f6 100644 --- a/library/tzdata/Africa/Khartoum +++ b/library/tzdata/Africa/Khartoum @@ -36,4 +36,5 @@ set TZData(:Africa/Khartoum) { {483487200 10800 1 CAST} {498171600 7200 0 CAT} {947930400 10800 0 EAT} + {1509483600 7200 0 CAT} } diff --git a/library/tzdata/Africa/Windhoek b/library/tzdata/Africa/Windhoek index 1b8f86a..974ebda 100644 --- a/library/tzdata/Africa/Windhoek +++ b/library/tzdata/Africa/Windhoek @@ -7,7 +7,8 @@ set TZData(:Africa/Windhoek) { {-860976000 10800 1 SAST} {-845254800 7200 0 SAST} {637970400 7200 0 CAT} - {765324000 3600 0 WAT} + {764200800 3600 0 WAT} + {764204400 3600 0 WAT} {778640400 7200 1 WAST} {796780800 3600 0 WAT} {810090000 7200 1 WAST} @@ -54,169 +55,5 @@ set TZData(:Africa/Windhoek) { {1459641600 3600 0 WAT} {1472950800 7200 1 WAST} {1491091200 3600 0 WAT} - {1504400400 7200 1 WAST} - {1522540800 3600 0 WAT} - {1535850000 7200 1 WAST} - {1554595200 3600 0 WAT} - {1567299600 7200 1 WAST} - {1586044800 3600 0 WAT} - {1599354000 7200 1 WAST} - {1617494400 3600 0 WAT} - {1630803600 7200 1 WAST} - {1648944000 3600 0 WAT} - {1662253200 7200 1 WAST} - {1680393600 3600 0 WAT} - {1693702800 7200 1 WAST} - {1712448000 3600 0 WAT} - {1725152400 7200 1 WAST} - {1743897600 3600 0 WAT} - {1757206800 7200 1 WAST} - {1775347200 3600 0 WAT} - {1788656400 7200 1 WAST} - {1806796800 3600 0 WAT} - {1820106000 7200 1 WAST} - {1838246400 3600 0 WAT} - {1851555600 7200 1 WAST} - {1869696000 3600 0 WAT} - {1883005200 7200 1 WAST} - {1901750400 3600 0 WAT} - {1914454800 7200 1 WAST} - {1933200000 3600 0 WAT} - {1946509200 7200 1 WAST} - {1964649600 3600 0 WAT} - {1977958800 7200 1 WAST} - {1996099200 3600 0 WAT} - {2009408400 7200 1 WAST} - {2027548800 3600 0 WAT} - {2040858000 7200 1 WAST} - {2058998400 3600 0 WAT} - {2072307600 7200 1 WAST} - {2091052800 3600 0 WAT} - {2104362000 7200 1 WAST} - {2122502400 3600 0 WAT} - {2135811600 7200 1 WAST} - {2153952000 3600 0 WAT} - {2167261200 7200 1 WAST} - {2185401600 3600 0 WAT} - {2198710800 7200 1 WAST} - {2216851200 3600 0 WAT} - {2230160400 7200 1 WAST} - {2248905600 3600 0 WAT} - {2261610000 7200 1 WAST} - {2280355200 3600 0 WAT} - {2293664400 7200 1 WAST} - {2311804800 3600 0 WAT} - {2325114000 7200 1 WAST} - {2343254400 3600 0 WAT} - {2356563600 7200 1 WAST} - {2374704000 3600 0 WAT} - {2388013200 7200 1 WAST} - {2406153600 3600 0 WAT} - {2419462800 7200 1 WAST} - {2438208000 3600 0 WAT} - {2450912400 7200 1 WAST} - {2469657600 3600 0 WAT} - {2482966800 7200 1 WAST} - {2501107200 3600 0 WAT} - {2514416400 7200 1 WAST} - {2532556800 3600 0 WAT} - {2545866000 7200 1 WAST} - {2564006400 3600 0 WAT} - {2577315600 7200 1 WAST} - {2596060800 3600 0 WAT} - {2608765200 7200 1 WAST} - {2627510400 3600 0 WAT} - {2640819600 7200 1 WAST} - {2658960000 3600 0 WAT} - {2672269200 7200 1 WAST} - {2690409600 3600 0 WAT} - {2703718800 7200 1 WAST} - {2721859200 3600 0 WAT} - {2735168400 7200 1 WAST} - {2753308800 3600 0 WAT} - {2766618000 7200 1 WAST} - {2785363200 3600 0 WAT} - {2798067600 7200 1 WAST} - {2816812800 3600 0 WAT} - {2830122000 7200 1 WAST} - {2848262400 3600 0 WAT} - {2861571600 7200 1 WAST} - {2879712000 3600 0 WAT} - {2893021200 7200 1 WAST} - {2911161600 3600 0 WAT} - {2924470800 7200 1 WAST} - {2942611200 3600 0 WAT} - {2955920400 7200 1 WAST} - {2974665600 3600 0 WAT} - {2987974800 7200 1 WAST} - {3006115200 3600 0 WAT} - {3019424400 7200 1 WAST} - {3037564800 3600 0 WAT} - {3050874000 7200 1 WAST} - {3069014400 3600 0 WAT} - {3082323600 7200 1 WAST} - {3100464000 3600 0 WAT} - {3113773200 7200 1 WAST} - {3132518400 3600 0 WAT} - {3145222800 7200 1 WAST} - {3163968000 3600 0 WAT} - {3177277200 7200 1 WAST} - {3195417600 3600 0 WAT} - {3208726800 7200 1 WAST} - {3226867200 3600 0 WAT} - {3240176400 7200 1 WAST} - {3258316800 3600 0 WAT} - {3271626000 7200 1 WAST} - {3289766400 3600 0 WAT} - {3303075600 7200 1 WAST} - {3321820800 3600 0 WAT} - {3334525200 7200 1 WAST} - {3353270400 3600 0 WAT} - {3366579600 7200 1 WAST} - {3384720000 3600 0 WAT} - {3398029200 7200 1 WAST} - {3416169600 3600 0 WAT} - {3429478800 7200 1 WAST} - {3447619200 3600 0 WAT} - {3460928400 7200 1 WAST} - {3479673600 3600 0 WAT} - {3492378000 7200 1 WAST} - {3511123200 3600 0 WAT} - {3524432400 7200 1 WAST} - {3542572800 3600 0 WAT} - {3555882000 7200 1 WAST} - {3574022400 3600 0 WAT} - {3587331600 7200 1 WAST} - {3605472000 3600 0 WAT} - {3618781200 7200 1 WAST} - {3636921600 3600 0 WAT} - {3650230800 7200 1 WAST} - {3668976000 3600 0 WAT} - {3681680400 7200 1 WAST} - {3700425600 3600 0 WAT} - {3713734800 7200 1 WAST} - {3731875200 3600 0 WAT} - {3745184400 7200 1 WAST} - {3763324800 3600 0 WAT} - {3776634000 7200 1 WAST} - {3794774400 3600 0 WAT} - {3808083600 7200 1 WAST} - {3826224000 3600 0 WAT} - {3839533200 7200 1 WAST} - {3858278400 3600 0 WAT} - {3871587600 7200 1 WAST} - {3889728000 3600 0 WAT} - {3903037200 7200 1 WAST} - {3921177600 3600 0 WAT} - {3934486800 7200 1 WAST} - {3952627200 3600 0 WAT} - {3965936400 7200 1 WAST} - {3984076800 3600 0 WAT} - {3997386000 7200 1 WAST} - {4016131200 3600 0 WAT} - {4028835600 7200 1 WAST} - {4047580800 3600 0 WAT} - {4060890000 7200 1 WAST} - {4079030400 3600 0 WAT} - {4092339600 7200 1 WAST} + {1504400400 7200 0 CAT} } diff --git a/library/tzdata/America/Adak b/library/tzdata/America/Adak index bd5d5ab..04c4628 100644 --- a/library/tzdata/America/Adak +++ b/library/tzdata/America/Adak @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:America/Adak) { - {-9223372036854775808 44001 0 LMT} - {-3225356001 -42398 0 LMT} + {-9223372036854775808 44002 0 LMT} + {-3225223727 -42398 0 LMT} {-2188944802 -39600 0 NST} {-883573200 -39600 0 NST} {-880196400 -36000 1 NWT} diff --git a/library/tzdata/America/Anchorage b/library/tzdata/America/Anchorage index 127d365..c0ff8de 100644 --- a/library/tzdata/America/Anchorage +++ b/library/tzdata/America/Anchorage @@ -2,7 +2,7 @@ set TZData(:America/Anchorage) { {-9223372036854775808 50424 0 LMT} - {-3225362424 -35976 0 LMT} + {-3225223727 -35976 0 LMT} {-2188951224 -36000 0 AST} {-883576800 -36000 0 AST} {-880200000 -32400 1 AWT} diff --git a/library/tzdata/America/Detroit b/library/tzdata/America/Detroit index 696a663..f725874 100644 --- a/library/tzdata/America/Detroit +++ b/library/tzdata/America/Detroit @@ -11,8 +11,6 @@ set TZData(:America/Detroit) { {-757364400 -18000 0 EST} {-684349200 -14400 1 EDT} {-671047200 -18000 0 EST} - {-80499600 -14400 1 EDT} - {-68666400 -18000 0 EST} {94712400 -18000 0 EST} {104914800 -14400 1 EDT} {120636000 -18000 0 EST} diff --git a/library/tzdata/America/Grand_Turk b/library/tzdata/America/Grand_Turk index 0edcf0b..c963adc 100644 --- a/library/tzdata/America/Grand_Turk +++ b/library/tzdata/America/Grand_Turk @@ -79,4 +79,168 @@ set TZData(:America/Grand_Turk) { {1414908000 -18000 0 EST} {1425798000 -14400 1 EDT} {1446361200 -14400 0 AST} + {1520751600 -14400 0 EDT} + {1541311200 -18000 0 EST} + {1552201200 -14400 1 EDT} + {1572760800 -18000 0 EST} + {1583650800 -14400 1 EDT} + {1604210400 -18000 0 EST} + {1615705200 -14400 1 EDT} + {1636264800 -18000 0 EST} + {1647154800 -14400 1 EDT} + {1667714400 -18000 0 EST} + {1678604400 -14400 1 EDT} + {1699164000 -18000 0 EST} + {1710054000 -14400 1 EDT} + {1730613600 -18000 0 EST} + {1741503600 -14400 1 EDT} + {1762063200 -18000 0 EST} + {1772953200 -14400 1 EDT} + {1793512800 -18000 0 EST} + {1805007600 -14400 1 EDT} + {1825567200 -18000 0 EST} + {1836457200 -14400 1 EDT} + {1857016800 -18000 0 EST} + {1867906800 -14400 1 EDT} + {1888466400 -18000 0 EST} + {1899356400 -14400 1 EDT} + {1919916000 -18000 0 EST} + {1930806000 -14400 1 EDT} + {1951365600 -18000 0 EST} + {1962860400 -14400 1 EDT} + {1983420000 -18000 0 EST} + {1994310000 -14400 1 EDT} + {2014869600 -18000 0 EST} + {2025759600 -14400 1 EDT} + {2046319200 -18000 0 EST} + {2057209200 -14400 1 EDT} + {2077768800 -18000 0 EST} + {2088658800 -14400 1 EDT} + {2109218400 -18000 0 EST} + {2120108400 -14400 1 EDT} + {2140668000 -18000 0 EST} + {2152162800 -14400 1 EDT} + {2172722400 -18000 0 EST} + {2183612400 -14400 1 EDT} + {2204172000 -18000 0 EST} + {2215062000 -14400 1 EDT} + {2235621600 -18000 0 EST} + {2246511600 -14400 1 EDT} + {2267071200 -18000 0 EST} + {2277961200 -14400 1 EDT} + {2298520800 -18000 0 EST} + {2309410800 -14400 1 EDT} + {2329970400 -18000 0 EST} + {2341465200 -14400 1 EDT} + {2362024800 -18000 0 EST} + {2372914800 -14400 1 EDT} + {2393474400 -18000 0 EST} + {2404364400 -14400 1 EDT} + {2424924000 -18000 0 EST} + {2435814000 -14400 1 EDT} + {2456373600 -18000 0 EST} + {2467263600 -14400 1 EDT} + {2487823200 -18000 0 EST} + {2499318000 -14400 1 EDT} + {2519877600 -18000 0 EST} + {2530767600 -14400 1 EDT} + {2551327200 -18000 0 EST} + {2562217200 -14400 1 EDT} + {2582776800 -18000 0 EST} + {2593666800 -14400 1 EDT} + {2614226400 -18000 0 EST} + {2625116400 -14400 1 EDT} + {2645676000 -18000 0 EST} + {2656566000 -14400 1 EDT} + {2677125600 -18000 0 EST} + {2688620400 -14400 1 EDT} + {2709180000 -18000 0 EST} + {2720070000 -14400 1 EDT} + {2740629600 -18000 0 EST} + {2751519600 -14400 1 EDT} + {2772079200 -18000 0 EST} + {2782969200 -14400 1 EDT} + {2803528800 -18000 0 EST} + {2814418800 -14400 1 EDT} + {2834978400 -18000 0 EST} + {2846473200 -14400 1 EDT} + {2867032800 -18000 0 EST} + {2877922800 -14400 1 EDT} + {2898482400 -18000 0 EST} + {2909372400 -14400 1 EDT} + {2929932000 -18000 0 EST} + {2940822000 -14400 1 EDT} + {2961381600 -18000 0 EST} + {2972271600 -14400 1 EDT} + {2992831200 -18000 0 EST} + {3003721200 -14400 1 EDT} + {3024280800 -18000 0 EST} + {3035775600 -14400 1 EDT} + {3056335200 -18000 0 EST} + {3067225200 -14400 1 EDT} + {3087784800 -18000 0 EST} + {3098674800 -14400 1 EDT} + {3119234400 -18000 0 EST} + {3130124400 -14400 1 EDT} + {3150684000 -18000 0 EST} + {3161574000 -14400 1 EDT} + {3182133600 -18000 0 EST} + {3193023600 -14400 1 EDT} + {3213583200 -18000 0 EST} + {3225078000 -14400 1 EDT} + {3245637600 -18000 0 EST} + {3256527600 -14400 1 EDT} + {3277087200 -18000 0 EST} + {3287977200 -14400 1 EDT} + {3308536800 -18000 0 EST} + {3319426800 -14400 1 EDT} + {3339986400 -18000 0 EST} + {3350876400 -14400 1 EDT} + {3371436000 -18000 0 EST} + {3382930800 -14400 1 EDT} + {3403490400 -18000 0 EST} + {3414380400 -14400 1 EDT} + {3434940000 -18000 0 EST} + {3445830000 -14400 1 EDT} + {3466389600 -18000 0 EST} + {3477279600 -14400 1 EDT} + {3497839200 -18000 0 EST} + {3508729200 -14400 1 EDT} + {3529288800 -18000 0 EST} + {3540178800 -14400 1 EDT} + {3560738400 -18000 0 EST} + {3572233200 -14400 1 EDT} + {3592792800 -18000 0 EST} + {3603682800 -14400 1 EDT} + {3624242400 -18000 0 EST} + {3635132400 -14400 1 EDT} + {3655692000 -18000 0 EST} + {3666582000 -14400 1 EDT} + {3687141600 -18000 0 EST} + {3698031600 -14400 1 EDT} + {3718591200 -18000 0 EST} + {3730086000 -14400 1 EDT} + {3750645600 -18000 0 EST} + {3761535600 -14400 1 EDT} + {3782095200 -18000 0 EST} + {3792985200 -14400 1 EDT} + {3813544800 -18000 0 EST} + {3824434800 -14400 1 EDT} + {3844994400 -18000 0 EST} + {3855884400 -14400 1 EDT} + {3876444000 -18000 0 EST} + {3887334000 -14400 1 EDT} + {3907893600 -18000 0 EST} + {3919388400 -14400 1 EDT} + {3939948000 -18000 0 EST} + {3950838000 -14400 1 EDT} + {3971397600 -18000 0 EST} + {3982287600 -14400 1 EDT} + {4002847200 -18000 0 EST} + {4013737200 -14400 1 EDT} + {4034296800 -18000 0 EST} + {4045186800 -14400 1 EDT} + {4065746400 -18000 0 EST} + {4076636400 -14400 1 EDT} + {4097196000 -18000 0 EST} } diff --git a/library/tzdata/America/Juneau b/library/tzdata/America/Juneau index fead810..070a27a 100644 --- a/library/tzdata/America/Juneau +++ b/library/tzdata/America/Juneau @@ -2,7 +2,7 @@ set TZData(:America/Juneau) { {-9223372036854775808 54139 0 LMT} - {-3225366139 -32261 0 LMT} + {-3225223727 -32261 0 LMT} {-2188954939 -28800 0 PST} {-883584000 -28800 0 PST} {-880207200 -25200 1 PWT} diff --git a/library/tzdata/America/Metlakatla b/library/tzdata/America/Metlakatla index 407948d..371fdcf 100644 --- a/library/tzdata/America/Metlakatla +++ b/library/tzdata/America/Metlakatla @@ -2,7 +2,7 @@ set TZData(:America/Metlakatla) { {-9223372036854775808 54822 0 LMT} - {-3225366822 -31578 0 LMT} + {-3225223727 -31578 0 LMT} {-2188955622 -28800 0 PST} {-883584000 -28800 0 PST} {-880207200 -25200 1 PWT} diff --git a/library/tzdata/America/Nome b/library/tzdata/America/Nome index c095b79..d7a9186 100644 --- a/library/tzdata/America/Nome +++ b/library/tzdata/America/Nome @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:America/Nome) { - {-9223372036854775808 46701 0 LMT} - {-3225358701 -39698 0 LMT} + {-9223372036854775808 46702 0 LMT} + {-3225223727 -39698 0 LMT} {-2188947502 -39600 0 NST} {-883573200 -39600 0 NST} {-880196400 -36000 1 NWT} diff --git a/library/tzdata/America/Sitka b/library/tzdata/America/Sitka index 8c53d93..7cef02a 100644 --- a/library/tzdata/America/Sitka +++ b/library/tzdata/America/Sitka @@ -2,7 +2,7 @@ set TZData(:America/Sitka) { {-9223372036854775808 53927 0 LMT} - {-3225365927 -32473 0 LMT} + {-3225223727 -32473 0 LMT} {-2188954727 -28800 0 PST} {-883584000 -28800 0 PST} {-880207200 -25200 1 PWT} diff --git a/library/tzdata/America/Yakutat b/library/tzdata/America/Yakutat index a0420c5..b1d66ff 100644 --- a/library/tzdata/America/Yakutat +++ b/library/tzdata/America/Yakutat @@ -2,7 +2,7 @@ set TZData(:America/Yakutat) { {-9223372036854775808 52865 0 LMT} - {-3225364865 -33535 0 LMT} + {-3225223727 -33535 0 LMT} {-2188953665 -32400 0 YST} {-883580400 -32400 0 YST} {-880203600 -28800 1 YWT} diff --git a/library/tzdata/Asia/Famagusta b/library/tzdata/Asia/Famagusta index 384c183..55eade6 100644 --- a/library/tzdata/Asia/Famagusta +++ b/library/tzdata/Asia/Famagusta @@ -88,4 +88,169 @@ set TZData(:Asia/Famagusta) { {1445734800 7200 0 EET} {1459040400 10800 1 EEST} {1473285600 10800 0 +03} + {1509238800 7200 0 EET} + {1521939600 10800 1 EEST} + {1540688400 7200 0 EET} + {1553994000 10800 1 EEST} + {1572138000 7200 0 EET} + {1585443600 10800 1 EEST} + {1603587600 7200 0 EET} + {1616893200 10800 1 EEST} + {1635642000 7200 0 EET} + {1648342800 10800 1 EEST} + {1667091600 7200 0 EET} + {1679792400 10800 1 EEST} + {1698541200 7200 0 EET} + {1711846800 10800 1 EEST} + {1729990800 7200 0 EET} + {1743296400 10800 1 EEST} + {1761440400 7200 0 EET} + {1774746000 10800 1 EEST} + {1792890000 7200 0 EET} + {1806195600 10800 1 EEST} + {1824944400 7200 0 EET} + {1837645200 10800 1 EEST} + {1856394000 7200 0 EET} + {1869094800 10800 1 EEST} + {1887843600 7200 0 EET} + {1901149200 10800 1 EEST} + {1919293200 7200 0 EET} + {1932598800 10800 1 EEST} + {1950742800 7200 0 EET} + {1964048400 10800 1 EEST} + {1982797200 7200 0 EET} + {1995498000 10800 1 EEST} + {2014246800 7200 0 EET} + {2026947600 10800 1 EEST} + {2045696400 7200 0 EET} + {2058397200 10800 1 EEST} + {2077146000 7200 0 EET} + {2090451600 10800 1 EEST} + {2108595600 7200 0 EET} + {2121901200 10800 1 EEST} + {2140045200 7200 0 EET} + {2153350800 10800 1 EEST} + {2172099600 7200 0 EET} + {2184800400 10800 1 EEST} + {2203549200 7200 0 EET} + {2216250000 10800 1 EEST} + {2234998800 7200 0 EET} + {2248304400 10800 1 EEST} + {2266448400 7200 0 EET} + {2279754000 10800 1 EEST} + {2297898000 7200 0 EET} + {2311203600 10800 1 EEST} + {2329347600 7200 0 EET} + {2342653200 10800 1 EEST} + {2361402000 7200 0 EET} + {2374102800 10800 1 EEST} + {2392851600 7200 0 EET} + {2405552400 10800 1 EEST} + {2424301200 7200 0 EET} + {2437606800 10800 1 EEST} + {2455750800 7200 0 EET} + {2469056400 10800 1 EEST} + {2487200400 7200 0 EET} + {2500506000 10800 1 EEST} + {2519254800 7200 0 EET} + {2531955600 10800 1 EEST} + {2550704400 7200 0 EET} + {2563405200 10800 1 EEST} + {2582154000 7200 0 EET} + {2595459600 10800 1 EEST} + {2613603600 7200 0 EET} + {2626909200 10800 1 EEST} + {2645053200 7200 0 EET} + {2658358800 10800 1 EEST} + {2676502800 7200 0 EET} + {2689808400 10800 1 EEST} + {2708557200 7200 0 EET} + {2721258000 10800 1 EEST} + {2740006800 7200 0 EET} + {2752707600 10800 1 EEST} + {2771456400 7200 0 EET} + {2784762000 10800 1 EEST} + {2802906000 7200 0 EET} + {2816211600 10800 1 EEST} + {2834355600 7200 0 EET} + {2847661200 10800 1 EEST} + {2866410000 7200 0 EET} + {2879110800 10800 1 EEST} + {2897859600 7200 0 EET} + {2910560400 10800 1 EEST} + {2929309200 7200 0 EET} + {2942010000 10800 1 EEST} + {2960758800 7200 0 EET} + {2974064400 10800 1 EEST} + {2992208400 7200 0 EET} + {3005514000 10800 1 EEST} + {3023658000 7200 0 EET} + {3036963600 10800 1 EEST} + {3055712400 7200 0 EET} + {3068413200 10800 1 EEST} + {3087162000 7200 0 EET} + {3099862800 10800 1 EEST} + {3118611600 7200 0 EET} + {3131917200 10800 1 EEST} + {3150061200 7200 0 EET} + {3163366800 10800 1 EEST} + {3181510800 7200 0 EET} + {3194816400 10800 1 EEST} + {3212960400 7200 0 EET} + {3226266000 10800 1 EEST} + {3245014800 7200 0 EET} + {3257715600 10800 1 EEST} + {3276464400 7200 0 EET} + {3289165200 10800 1 EEST} + {3307914000 7200 0 EET} + {3321219600 10800 1 EEST} + {3339363600 7200 0 EET} + {3352669200 10800 1 EEST} + {3370813200 7200 0 EET} + {3384118800 10800 1 EEST} + {3402867600 7200 0 EET} + {3415568400 10800 1 EEST} + {3434317200 7200 0 EET} + {3447018000 10800 1 EEST} + {3465766800 7200 0 EET} + {3479072400 10800 1 EEST} + {3497216400 7200 0 EET} + {3510522000 10800 1 EEST} + {3528666000 7200 0 EET} + {3541971600 10800 1 EEST} + {3560115600 7200 0 EET} + {3573421200 10800 1 EEST} + {3592170000 7200 0 EET} + {3604870800 10800 1 EEST} + {3623619600 7200 0 EET} + {3636320400 10800 1 EEST} + {3655069200 7200 0 EET} + {3668374800 10800 1 EEST} + {3686518800 7200 0 EET} + {3699824400 10800 1 EEST} + {3717968400 7200 0 EET} + {3731274000 10800 1 EEST} + {3750022800 7200 0 EET} + {3762723600 10800 1 EEST} + {3781472400 7200 0 EET} + {3794173200 10800 1 EEST} + {3812922000 7200 0 EET} + {3825622800 10800 1 EEST} + {3844371600 7200 0 EET} + {3857677200 10800 1 EEST} + {3875821200 7200 0 EET} + {3889126800 10800 1 EEST} + {3907270800 7200 0 EET} + {3920576400 10800 1 EEST} + {3939325200 7200 0 EET} + {3952026000 10800 1 EEST} + {3970774800 7200 0 EET} + {3983475600 10800 1 EEST} + {4002224400 7200 0 EET} + {4015530000 10800 1 EEST} + {4033674000 7200 0 EET} + {4046979600 10800 1 EEST} + {4065123600 7200 0 EET} + {4078429200 10800 1 EEST} + {4096573200 7200 0 EET} } diff --git a/library/tzdata/Asia/Kolkata b/library/tzdata/Asia/Kolkata index 6b3b9fb..b78f8cd 100644 --- a/library/tzdata/Asia/Kolkata +++ b/library/tzdata/Asia/Kolkata @@ -2,8 +2,10 @@ set TZData(:Asia/Kolkata) { {-9223372036854775808 21208 0 LMT} - {-2840162008 21200 0 HMT} - {-891582800 23400 0 +0630} + {-3645237208 21200 0 HMT} + {-3155694800 19270 0 MMT} + {-2019705670 19800 0 IST} + {-891581400 23400 1 +0630} {-872058600 19800 0 IST} {-862637400 23400 1 +0630} {-764145000 19800 0 IST} diff --git a/library/tzdata/Asia/Yangon b/library/tzdata/Asia/Yangon index 8e17d82..82870c6 100644 --- a/library/tzdata/Asia/Yangon +++ b/library/tzdata/Asia/Yangon @@ -1,9 +1,9 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Yangon) { - {-9223372036854775808 23080 0 LMT} - {-2840163880 23080 0 RMT} - {-1577946280 23400 0 +0630} + {-9223372036854775808 23087 0 LMT} + {-2840163887 23087 0 RMT} + {-1577946287 23400 0 +0630} {-873268200 32400 0 +09} {-778410000 23400 0 +0630} } diff --git a/library/tzdata/Asia/Yerevan b/library/tzdata/Asia/Yerevan index 0ffb69e..25a349a 100644 --- a/library/tzdata/Asia/Yerevan +++ b/library/tzdata/Asia/Yerevan @@ -64,6 +64,7 @@ set TZData(:Asia/Yerevan) { {1256421600 14400 0 +04} {1269727200 18000 1 +05} {1288476000 14400 0 +04} + {1293825600 14400 0 +04} {1301176800 18000 1 +05} {1319925600 14400 0 +04} } diff --git a/library/tzdata/Europe/Dublin b/library/tzdata/Europe/Dublin index 4b43bc0..c3a5c0e 100644 --- a/library/tzdata/Europe/Dublin +++ b/library/tzdata/Europe/Dublin @@ -52,10 +52,10 @@ set TZData(:Europe/Dublin) { {-986162400 0 0 IST} {-969228000 3600 1 IST} {-950479200 0 0 IST} - {-942015600 3600 1 IST} - {-733359600 0 0 GMT} + {-942012000 3600 1 IST} + {-733356000 0 0 GMT} {-719445600 3600 1 IST} - {-699490800 0 0 GMT} + {-699487200 0 0 GMT} {-684972000 3600 0 IST} {-668037600 0 0 IST} {-654732000 3600 1 IST} diff --git a/library/tzdata/Pacific/Apia b/library/tzdata/Pacific/Apia index feef374..4c0d84a 100644 --- a/library/tzdata/Pacific/Apia +++ b/library/tzdata/Pacific/Apia @@ -2,7 +2,7 @@ set TZData(:Pacific/Apia) { {-9223372036854775808 45184 0 LMT} - {-2855737984 -41216 0 LMT} + {-2445424384 -41216 0 LMT} {-1861878784 -41400 0 -1130} {-631110600 -39600 0 -10} {1285498800 -36000 1 -10} diff --git a/library/tzdata/Pacific/Fiji b/library/tzdata/Pacific/Fiji index fa8c99e..f9d393c 100644 --- a/library/tzdata/Pacific/Fiji +++ b/library/tzdata/Pacific/Fiji @@ -24,7 +24,7 @@ set TZData(:Pacific/Fiji) { {1478354400 46800 1 +13} {1484402400 43200 0 +12} {1509804000 46800 1 +13} - {1516456800 43200 0 +12} + {1515852000 43200 0 +12} {1541253600 46800 1 +13} {1547906400 43200 0 +12} {1572703200 46800 1 +13} @@ -36,7 +36,7 @@ set TZData(:Pacific/Fiji) { {1667656800 46800 1 +13} {1673704800 43200 0 +12} {1699106400 46800 1 +13} - {1705759200 43200 0 +12} + {1705154400 43200 0 +12} {1730556000 46800 1 +13} {1737208800 43200 0 +12} {1762005600 46800 1 +13} @@ -46,7 +46,7 @@ set TZData(:Pacific/Fiji) { {1825509600 46800 1 +13} {1831557600 43200 0 +12} {1856959200 46800 1 +13} - {1863612000 43200 0 +12} + {1863007200 43200 0 +12} {1888408800 46800 1 +13} {1895061600 43200 0 +12} {1919858400 46800 1 +13} @@ -58,7 +58,7 @@ set TZData(:Pacific/Fiji) { {2014812000 46800 1 +13} {2020860000 43200 0 +12} {2046261600 46800 1 +13} - {2052914400 43200 0 +12} + {2052309600 43200 0 +12} {2077711200 46800 1 +13} {2084364000 43200 0 +12} {2109160800 46800 1 +13} @@ -80,7 +80,7 @@ set TZData(:Pacific/Fiji) { {2361967200 46800 1 +13} {2368015200 43200 0 +12} {2393416800 46800 1 +13} - {2400069600 43200 0 +12} + {2399464800 43200 0 +12} {2424866400 46800 1 +13} {2431519200 43200 0 +12} {2456316000 46800 1 +13} @@ -92,7 +92,7 @@ set TZData(:Pacific/Fiji) { {2551269600 46800 1 +13} {2557317600 43200 0 +12} {2582719200 46800 1 +13} - {2589372000 43200 0 +12} + {2588767200 43200 0 +12} {2614168800 46800 1 +13} {2620821600 43200 0 +12} {2645618400 46800 1 +13} @@ -102,7 +102,7 @@ set TZData(:Pacific/Fiji) { {2709122400 46800 1 +13} {2715170400 43200 0 +12} {2740572000 46800 1 +13} - {2747224800 43200 0 +12} + {2746620000 43200 0 +12} {2772021600 46800 1 +13} {2778674400 43200 0 +12} {2803471200 46800 1 +13} @@ -114,7 +114,7 @@ set TZData(:Pacific/Fiji) { {2898424800 46800 1 +13} {2904472800 43200 0 +12} {2929874400 46800 1 +13} - {2936527200 43200 0 +12} + {2935922400 43200 0 +12} {2961324000 46800 1 +13} {2967976800 43200 0 +12} {2992773600 46800 1 +13} @@ -136,7 +136,7 @@ set TZData(:Pacific/Fiji) { {3245580000 46800 1 +13} {3251628000 43200 0 +12} {3277029600 46800 1 +13} - {3283682400 43200 0 +12} + {3283077600 43200 0 +12} {3308479200 46800 1 +13} {3315132000 43200 0 +12} {3339928800 46800 1 +13} @@ -148,7 +148,7 @@ set TZData(:Pacific/Fiji) { {3434882400 46800 1 +13} {3440930400 43200 0 +12} {3466332000 46800 1 +13} - {3472984800 43200 0 +12} + {3472380000 43200 0 +12} {3497781600 46800 1 +13} {3504434400 43200 0 +12} {3529231200 46800 1 +13} @@ -158,7 +158,7 @@ set TZData(:Pacific/Fiji) { {3592735200 46800 1 +13} {3598783200 43200 0 +12} {3624184800 46800 1 +13} - {3630837600 43200 0 +12} + {3630232800 43200 0 +12} {3655634400 46800 1 +13} {3662287200 43200 0 +12} {3687084000 46800 1 +13} @@ -170,7 +170,7 @@ set TZData(:Pacific/Fiji) { {3782037600 46800 1 +13} {3788085600 43200 0 +12} {3813487200 46800 1 +13} - {3820140000 43200 0 +12} + {3819535200 43200 0 +12} {3844936800 46800 1 +13} {3851589600 43200 0 +12} {3876386400 46800 1 +13} diff --git a/library/tzdata/Pacific/Pago_Pago b/library/tzdata/Pacific/Pago_Pago index d30c981..9b5607f 100644 --- a/library/tzdata/Pacific/Pago_Pago +++ b/library/tzdata/Pacific/Pago_Pago @@ -2,6 +2,6 @@ set TZData(:Pacific/Pago_Pago) { {-9223372036854775808 45432 0 LMT} - {-2855738232 -40968 0 LMT} + {-2445424632 -40968 0 LMT} {-1861879032 -39600 0 SST} } diff --git a/library/tzdata/Pacific/Tongatapu b/library/tzdata/Pacific/Tongatapu index 731b4f6..3cfaaaa 100644 --- a/library/tzdata/Pacific/Tongatapu +++ b/library/tzdata/Pacific/Tongatapu @@ -13,169 +13,4 @@ set TZData(:Pacific/Tongatapu) { {1012046400 46800 0 +13} {1478350800 50400 1 +14} {1484398800 46800 0 +13} - {1509800400 50400 1 +14} - {1516453200 46800 0 +13} - {1541250000 50400 1 +14} - {1547902800 46800 0 +13} - {1572699600 50400 1 +14} - {1579352400 46800 0 +13} - {1604149200 50400 1 +14} - {1610802000 46800 0 +13} - {1636203600 50400 1 +14} - {1642251600 46800 0 +13} - {1667653200 50400 1 +14} - {1673701200 46800 0 +13} - {1699102800 50400 1 +14} - {1705755600 46800 0 +13} - {1730552400 50400 1 +14} - {1737205200 46800 0 +13} - {1762002000 50400 1 +14} - {1768654800 46800 0 +13} - {1793451600 50400 1 +14} - {1800104400 46800 0 +13} - {1825506000 50400 1 +14} - {1831554000 46800 0 +13} - {1856955600 50400 1 +14} - {1863608400 46800 0 +13} - {1888405200 50400 1 +14} - {1895058000 46800 0 +13} - {1919854800 50400 1 +14} - {1926507600 46800 0 +13} - {1951304400 50400 1 +14} - {1957957200 46800 0 +13} - {1983358800 50400 1 +14} - {1989406800 46800 0 +13} - {2014808400 50400 1 +14} - {2020856400 46800 0 +13} - {2046258000 50400 1 +14} - {2052910800 46800 0 +13} - {2077707600 50400 1 +14} - {2084360400 46800 0 +13} - {2109157200 50400 1 +14} - {2115810000 46800 0 +13} - {2140606800 50400 1 +14} - {2147259600 46800 0 +13} - {2172661200 50400 1 +14} - {2178709200 46800 0 +13} - {2204110800 50400 1 +14} - {2210158800 46800 0 +13} - {2235560400 50400 1 +14} - {2242213200 46800 0 +13} - {2267010000 50400 1 +14} - {2273662800 46800 0 +13} - {2298459600 50400 1 +14} - {2305112400 46800 0 +13} - {2329909200 50400 1 +14} - {2336562000 46800 0 +13} - {2361963600 50400 1 +14} - {2368011600 46800 0 +13} - {2393413200 50400 1 +14} - {2400066000 46800 0 +13} - {2424862800 50400 1 +14} - {2431515600 46800 0 +13} - {2456312400 50400 1 +14} - {2462965200 46800 0 +13} - {2487762000 50400 1 +14} - {2494414800 46800 0 +13} - {2519816400 50400 1 +14} - {2525864400 46800 0 +13} - {2551266000 50400 1 +14} - {2557314000 46800 0 +13} - {2582715600 50400 1 +14} - {2589368400 46800 0 +13} - {2614165200 50400 1 +14} - {2620818000 46800 0 +13} - {2645614800 50400 1 +14} - {2652267600 46800 0 +13} - {2677064400 50400 1 +14} - {2683717200 46800 0 +13} - {2709118800 50400 1 +14} - {2715166800 46800 0 +13} - {2740568400 50400 1 +14} - {2747221200 46800 0 +13} - {2772018000 50400 1 +14} - {2778670800 46800 0 +13} - {2803467600 50400 1 +14} - {2810120400 46800 0 +13} - {2834917200 50400 1 +14} - {2841570000 46800 0 +13} - {2866971600 50400 1 +14} - {2873019600 46800 0 +13} - {2898421200 50400 1 +14} - {2904469200 46800 0 +13} - {2929870800 50400 1 +14} - {2936523600 46800 0 +13} - {2961320400 50400 1 +14} - {2967973200 46800 0 +13} - {2992770000 50400 1 +14} - {2999422800 46800 0 +13} - {3024219600 50400 1 +14} - {3030872400 46800 0 +13} - {3056274000 50400 1 +14} - {3062322000 46800 0 +13} - {3087723600 50400 1 +14} - {3093771600 46800 0 +13} - {3119173200 50400 1 +14} - {3125826000 46800 0 +13} - {3150622800 50400 1 +14} - {3157275600 46800 0 +13} - {3182072400 50400 1 +14} - {3188725200 46800 0 +13} - {3213522000 50400 1 +14} - {3220174800 46800 0 +13} - {3245576400 50400 1 +14} - {3251624400 46800 0 +13} - {3277026000 50400 1 +14} - {3283678800 46800 0 +13} - {3308475600 50400 1 +14} - {3315128400 46800 0 +13} - {3339925200 50400 1 +14} - {3346578000 46800 0 +13} - {3371374800 50400 1 +14} - {3378027600 46800 0 +13} - {3403429200 50400 1 +14} - {3409477200 46800 0 +13} - {3434878800 50400 1 +14} - {3440926800 46800 0 +13} - {3466328400 50400 1 +14} - {3472981200 46800 0 +13} - {3497778000 50400 1 +14} - {3504430800 46800 0 +13} - {3529227600 50400 1 +14} - {3535880400 46800 0 +13} - {3560677200 50400 1 +14} - {3567330000 46800 0 +13} - {3592731600 50400 1 +14} - {3598779600 46800 0 +13} - {3624181200 50400 1 +14} - {3630834000 46800 0 +13} - {3655630800 50400 1 +14} - {3662283600 46800 0 +13} - {3687080400 50400 1 +14} - {3693733200 46800 0 +13} - {3718530000 50400 1 +14} - {3725182800 46800 0 +13} - {3750584400 50400 1 +14} - {3756632400 46800 0 +13} - {3782034000 50400 1 +14} - {3788082000 46800 0 +13} - {3813483600 50400 1 +14} - {3820136400 46800 0 +13} - {3844933200 50400 1 +14} - {3851586000 46800 0 +13} - {3876382800 50400 1 +14} - {3883035600 46800 0 +13} - {3907832400 50400 1 +14} - {3914485200 46800 0 +13} - {3939886800 50400 1 +14} - {3945934800 46800 0 +13} - {3971336400 50400 1 +14} - {3977384400 46800 0 +13} - {4002786000 50400 1 +14} - {4009438800 46800 0 +13} - {4034235600 50400 1 +14} - {4040888400 46800 0 +13} - {4065685200 50400 1 +14} - {4072338000 46800 0 +13} - {4097134800 50400 1 +14} } -- cgit v0.12 From 45d0977a5ca8ae0ead48b66feeb51c65d1ce45b4 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 23 Oct 2017 17:06:57 +0000 Subject: Implementation branch for TIP 345: Kill the "identity" encoding. This checkin, completely does that. Bad news is it causes huge failures. We're still making a lot of use of this encoding, and cannot complete this TIP until the branch is repaired. --- generic/tclEncoding.c | 77 --------------------------------------------------- 1 file changed, 77 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index e328340..37d5fb6 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -195,11 +195,6 @@ static unsigned short emptyPage[256]; * Functions used only in this module. */ -static int BinaryProc(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(Tcl_Obj *srcPtr, Tcl_Obj *dupPtr); static void EscapeFreeProc(ClientData clientData); static int EscapeFromUtfProc(ClientData clientData, @@ -563,14 +558,6 @@ TclInitEncodingSubsystem(void) * formed UTF-8 into a properly formed stream. */ - type.encodingName = "identity"; - type.toUtfProc = BinaryProc; - type.fromUtfProc = BinaryProc; - type.freeProc = NULL; - type.nullSize = 1; - type.clientData = NULL; - tclIdentityEncoding = Tcl_CreateEncoding(&type); - type.encodingName = "utf-8"; type.toUtfProc = UtfExtToUtfIntProc; type.fromUtfProc = UtfIntToUtfExtProc; @@ -2083,70 +2070,6 @@ LoadEscapeEncoding( /* *------------------------------------------------------------------------- * - * BinaryProc -- - * - * The default conversion when no other conversion is specified. No - * translation is done; source bytes are copied directly to destination - * bytes. - * - * Results: - * Returns TCL_OK if conversion was successful. - * - * Side effects: - * None. - * - *------------------------------------------------------------------------- - */ - -static int -BinaryProc( - ClientData clientData, /* Not used. */ - const char *src, /* Source string (unknown encoding). */ - int srcLen, /* Source string length in bytes. */ - int flags, /* Conversion control flags. */ - Tcl_EncodingState *statePtr,/* Place for conversion routine to store state - * information used during a piecewise - * conversion. Contents of statePtr are - * initialized and/or reset by conversion - * routine under control of flags argument. */ - char *dst, /* Output buffer in which converted string is - * stored. */ - int dstLen, /* The maximum length of output buffer in - * bytes. */ - int *srcReadPtr, /* Filled with the number of bytes from the - * source string that were converted. */ - int *dstWrotePtr, /* Filled with the number of bytes that were - * stored in the output buffer as a result of - * the conversion. */ - int *dstCharsPtr) /* Filled with the number of characters that - * correspond to the bytes stored in the - * output buffer. */ -{ - int result; - - result = TCL_OK; - dstLen -= TCL_UTF_MAX - 1; - if (dstLen < 0) { - dstLen = 0; - } - if ((flags & TCL_ENCODING_CHAR_LIMIT) && srcLen > *dstCharsPtr) { - srcLen = *dstCharsPtr; - } - if (srcLen > dstLen) { - srcLen = dstLen; - result = TCL_CONVERT_NOSPACE; - } - - *srcReadPtr = srcLen; - *dstWrotePtr = srcLen; - *dstCharsPtr = srcLen; - memcpy(dst, src, (size_t) srcLen); - return result; -} - -/* - *------------------------------------------------------------------------- - * * UtfExtToUtfIntProc -- * * Convert from UTF-8 to UTF-8. While converting null-bytes from the -- cgit v0.12 From 319b71965b6c3a38ef712ac4e6b58fa7dae7e6f4 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 23 Oct 2017 17:58:07 +0000 Subject: backout initial commit; need more care. Binary writes internally make use of this encoding. Need to hide it instead of destroy it. --- generic/tclEncoding.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 37d5fb6..e328340 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -195,6 +195,11 @@ static unsigned short emptyPage[256]; * Functions used only in this module. */ +static int BinaryProc(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(Tcl_Obj *srcPtr, Tcl_Obj *dupPtr); static void EscapeFreeProc(ClientData clientData); static int EscapeFromUtfProc(ClientData clientData, @@ -558,6 +563,14 @@ TclInitEncodingSubsystem(void) * formed UTF-8 into a properly formed stream. */ + type.encodingName = "identity"; + type.toUtfProc = BinaryProc; + type.fromUtfProc = BinaryProc; + type.freeProc = NULL; + type.nullSize = 1; + type.clientData = NULL; + tclIdentityEncoding = Tcl_CreateEncoding(&type); + type.encodingName = "utf-8"; type.toUtfProc = UtfExtToUtfIntProc; type.fromUtfProc = UtfIntToUtfExtProc; @@ -2070,6 +2083,70 @@ LoadEscapeEncoding( /* *------------------------------------------------------------------------- * + * BinaryProc -- + * + * The default conversion when no other conversion is specified. No + * translation is done; source bytes are copied directly to destination + * bytes. + * + * Results: + * Returns TCL_OK if conversion was successful. + * + * Side effects: + * None. + * + *------------------------------------------------------------------------- + */ + +static int +BinaryProc( + ClientData clientData, /* Not used. */ + const char *src, /* Source string (unknown encoding). */ + int srcLen, /* Source string length in bytes. */ + int flags, /* Conversion control flags. */ + Tcl_EncodingState *statePtr,/* Place for conversion routine to store state + * information used during a piecewise + * conversion. Contents of statePtr are + * initialized and/or reset by conversion + * routine under control of flags argument. */ + char *dst, /* Output buffer in which converted string is + * stored. */ + int dstLen, /* The maximum length of output buffer in + * bytes. */ + int *srcReadPtr, /* Filled with the number of bytes from the + * source string that were converted. */ + int *dstWrotePtr, /* Filled with the number of bytes that were + * stored in the output buffer as a result of + * the conversion. */ + int *dstCharsPtr) /* Filled with the number of characters that + * correspond to the bytes stored in the + * output buffer. */ +{ + int result; + + result = TCL_OK; + dstLen -= TCL_UTF_MAX - 1; + if (dstLen < 0) { + dstLen = 0; + } + if ((flags & TCL_ENCODING_CHAR_LIMIT) && srcLen > *dstCharsPtr) { + srcLen = *dstCharsPtr; + } + if (srcLen > dstLen) { + srcLen = dstLen; + result = TCL_CONVERT_NOSPACE; + } + + *srcReadPtr = srcLen; + *dstWrotePtr = srcLen; + *dstCharsPtr = srcLen; + memcpy(dst, src, (size_t) srcLen); + return result; +} + +/* + *------------------------------------------------------------------------- + * * UtfExtToUtfIntProc -- * * Convert from UTF-8 to UTF-8. While converting null-bytes from the -- cgit v0.12 From fada61905269aa299f85ae2a25a2786b6cbe4053 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Tue, 24 Oct 2017 08:38:17 +0000 Subject: [fc1409fc91]: TclOO method with non-literal value for body argument causes segmentation fault --- generic/tclOOMethod.c | 1 + 1 file changed, 1 insertion(+) diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index 9c49caa..e8fad82 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -1314,6 +1314,7 @@ CloneProcedureMethod( */ bodyObj = Tcl_DuplicateObj(pmPtr->procPtr->bodyPtr); + Tcl_GetString(bodyObj); TclFreeIntRep(bodyObj); /* -- cgit v0.12 From 8e537759cf8215fe82bd51ca374f580d8b2c4a99 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 24 Oct 2017 11:23:54 +0000 Subject: Added test case. --- tests/oo.test | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/oo.test b/tests/oo.test index b538b60..2a6eb80 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -2048,6 +2048,17 @@ test oo-15.14 {OO: object cloning with target NS} -setup { } -cleanup { Cls destroy } -result {{} ::dupens::test-15.14} +test oo-15.15 {method cloning must ensure that there is a string representation of bodies} -setup { + oo::class create cls +} -body { + cls create foo + oo::objdefine foo { + method m1 {} [string map {a b} {return hello}] + } + [oo::copy foo] m1 +} -cleanup { + cls destroy +} -result hello test oo-16.1 {OO: object introspection} -body { info object -- cgit v0.12 From 2332ac45caa86287fe27e939ac352499c10462fe Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Tue, 24 Oct 2017 13:18:51 +0000 Subject: Update to tzdata2017c --- library/tzdata/Africa/Juba | 40 ++++++++- library/tzdata/Africa/Khartoum | 1 + library/tzdata/Africa/Windhoek | 169 +------------------------------------- library/tzdata/America/Adak | 4 +- library/tzdata/America/Anchorage | 2 +- library/tzdata/America/Detroit | 2 - library/tzdata/America/Grand_Turk | 164 ++++++++++++++++++++++++++++++++++++ library/tzdata/America/Juneau | 2 +- library/tzdata/America/Metlakatla | 2 +- library/tzdata/America/Nome | 4 +- library/tzdata/America/Sitka | 2 +- library/tzdata/America/Yakutat | 2 +- library/tzdata/Asia/Famagusta | 165 +++++++++++++++++++++++++++++++++++++ library/tzdata/Asia/Kolkata | 6 +- library/tzdata/Asia/Yangon | 6 +- library/tzdata/Asia/Yerevan | 1 + library/tzdata/Europe/Dublin | 6 +- library/tzdata/Pacific/Apia | 2 +- library/tzdata/Pacific/Fiji | 24 +++--- library/tzdata/Pacific/Pago_Pago | 2 +- library/tzdata/Pacific/Tongatapu | 165 ------------------------------------- 21 files changed, 404 insertions(+), 367 deletions(-) diff --git a/library/tzdata/Africa/Juba b/library/tzdata/Africa/Juba index 40551f2..a0dbf5e 100644 --- a/library/tzdata/Africa/Juba +++ b/library/tzdata/Africa/Juba @@ -1,5 +1,39 @@ # created by tools/tclZIC.tcl - do not edit -if {![info exists TZData(Africa/Khartoum)]} { - LoadTimeZoneFile Africa/Khartoum + +set TZData(:Africa/Juba) { + {-9223372036854775808 7588 0 LMT} + {-1230775588 7200 0 CAT} + {10360800 10800 1 CAST} + {24786000 7200 0 CAT} + {41810400 10800 1 CAST} + {56322000 7200 0 CAT} + {73432800 10800 1 CAST} + {87944400 7200 0 CAT} + {104882400 10800 1 CAST} + {119480400 7200 0 CAT} + {136332000 10800 1 CAST} + {151016400 7200 0 CAT} + {167781600 10800 1 CAST} + {182552400 7200 0 CAT} + {199231200 10800 1 CAST} + {214174800 7200 0 CAT} + {230680800 10800 1 CAST} + {245710800 7200 0 CAT} + {262735200 10800 1 CAST} + {277246800 7200 0 CAT} + {294184800 10800 1 CAST} + {308782800 7200 0 CAT} + {325634400 10800 1 CAST} + {340405200 7200 0 CAT} + {357084000 10800 1 CAST} + {371941200 7200 0 CAT} + {388533600 10800 1 CAST} + {403477200 7200 0 CAT} + {419983200 10800 1 CAST} + {435013200 7200 0 CAT} + {452037600 10800 1 CAST} + {466635600 7200 0 CAT} + {483487200 10800 1 CAST} + {498171600 7200 0 CAT} + {947930400 10800 0 EAT} } -set TZData(:Africa/Juba) $TZData(:Africa/Khartoum) diff --git a/library/tzdata/Africa/Khartoum b/library/tzdata/Africa/Khartoum index dfcac82..dc441f6 100644 --- a/library/tzdata/Africa/Khartoum +++ b/library/tzdata/Africa/Khartoum @@ -36,4 +36,5 @@ set TZData(:Africa/Khartoum) { {483487200 10800 1 CAST} {498171600 7200 0 CAT} {947930400 10800 0 EAT} + {1509483600 7200 0 CAT} } diff --git a/library/tzdata/Africa/Windhoek b/library/tzdata/Africa/Windhoek index 1b8f86a..974ebda 100644 --- a/library/tzdata/Africa/Windhoek +++ b/library/tzdata/Africa/Windhoek @@ -7,7 +7,8 @@ set TZData(:Africa/Windhoek) { {-860976000 10800 1 SAST} {-845254800 7200 0 SAST} {637970400 7200 0 CAT} - {765324000 3600 0 WAT} + {764200800 3600 0 WAT} + {764204400 3600 0 WAT} {778640400 7200 1 WAST} {796780800 3600 0 WAT} {810090000 7200 1 WAST} @@ -54,169 +55,5 @@ set TZData(:Africa/Windhoek) { {1459641600 3600 0 WAT} {1472950800 7200 1 WAST} {1491091200 3600 0 WAT} - {1504400400 7200 1 WAST} - {1522540800 3600 0 WAT} - {1535850000 7200 1 WAST} - {1554595200 3600 0 WAT} - {1567299600 7200 1 WAST} - {1586044800 3600 0 WAT} - {1599354000 7200 1 WAST} - {1617494400 3600 0 WAT} - {1630803600 7200 1 WAST} - {1648944000 3600 0 WAT} - {1662253200 7200 1 WAST} - {1680393600 3600 0 WAT} - {1693702800 7200 1 WAST} - {1712448000 3600 0 WAT} - {1725152400 7200 1 WAST} - {1743897600 3600 0 WAT} - {1757206800 7200 1 WAST} - {1775347200 3600 0 WAT} - {1788656400 7200 1 WAST} - {1806796800 3600 0 WAT} - {1820106000 7200 1 WAST} - {1838246400 3600 0 WAT} - {1851555600 7200 1 WAST} - {1869696000 3600 0 WAT} - {1883005200 7200 1 WAST} - {1901750400 3600 0 WAT} - {1914454800 7200 1 WAST} - {1933200000 3600 0 WAT} - {1946509200 7200 1 WAST} - {1964649600 3600 0 WAT} - {1977958800 7200 1 WAST} - {1996099200 3600 0 WAT} - {2009408400 7200 1 WAST} - {2027548800 3600 0 WAT} - {2040858000 7200 1 WAST} - {2058998400 3600 0 WAT} - {2072307600 7200 1 WAST} - {2091052800 3600 0 WAT} - {2104362000 7200 1 WAST} - {2122502400 3600 0 WAT} - {2135811600 7200 1 WAST} - {2153952000 3600 0 WAT} - {2167261200 7200 1 WAST} - {2185401600 3600 0 WAT} - {2198710800 7200 1 WAST} - {2216851200 3600 0 WAT} - {2230160400 7200 1 WAST} - {2248905600 3600 0 WAT} - {2261610000 7200 1 WAST} - {2280355200 3600 0 WAT} - {2293664400 7200 1 WAST} - {2311804800 3600 0 WAT} - {2325114000 7200 1 WAST} - {2343254400 3600 0 WAT} - {2356563600 7200 1 WAST} - {2374704000 3600 0 WAT} - {2388013200 7200 1 WAST} - {2406153600 3600 0 WAT} - {2419462800 7200 1 WAST} - {2438208000 3600 0 WAT} - {2450912400 7200 1 WAST} - {2469657600 3600 0 WAT} - {2482966800 7200 1 WAST} - {2501107200 3600 0 WAT} - {2514416400 7200 1 WAST} - {2532556800 3600 0 WAT} - {2545866000 7200 1 WAST} - {2564006400 3600 0 WAT} - {2577315600 7200 1 WAST} - {2596060800 3600 0 WAT} - {2608765200 7200 1 WAST} - {2627510400 3600 0 WAT} - {2640819600 7200 1 WAST} - {2658960000 3600 0 WAT} - {2672269200 7200 1 WAST} - {2690409600 3600 0 WAT} - {2703718800 7200 1 WAST} - {2721859200 3600 0 WAT} - {2735168400 7200 1 WAST} - {2753308800 3600 0 WAT} - {2766618000 7200 1 WAST} - {2785363200 3600 0 WAT} - {2798067600 7200 1 WAST} - {2816812800 3600 0 WAT} - {2830122000 7200 1 WAST} - {2848262400 3600 0 WAT} - {2861571600 7200 1 WAST} - {2879712000 3600 0 WAT} - {2893021200 7200 1 WAST} - {2911161600 3600 0 WAT} - {2924470800 7200 1 WAST} - {2942611200 3600 0 WAT} - {2955920400 7200 1 WAST} - {2974665600 3600 0 WAT} - {2987974800 7200 1 WAST} - {3006115200 3600 0 WAT} - {3019424400 7200 1 WAST} - {3037564800 3600 0 WAT} - {3050874000 7200 1 WAST} - {3069014400 3600 0 WAT} - {3082323600 7200 1 WAST} - {3100464000 3600 0 WAT} - {3113773200 7200 1 WAST} - {3132518400 3600 0 WAT} - {3145222800 7200 1 WAST} - {3163968000 3600 0 WAT} - {3177277200 7200 1 WAST} - {3195417600 3600 0 WAT} - {3208726800 7200 1 WAST} - {3226867200 3600 0 WAT} - {3240176400 7200 1 WAST} - {3258316800 3600 0 WAT} - {3271626000 7200 1 WAST} - {3289766400 3600 0 WAT} - {3303075600 7200 1 WAST} - {3321820800 3600 0 WAT} - {3334525200 7200 1 WAST} - {3353270400 3600 0 WAT} - {3366579600 7200 1 WAST} - {3384720000 3600 0 WAT} - {3398029200 7200 1 WAST} - {3416169600 3600 0 WAT} - {3429478800 7200 1 WAST} - {3447619200 3600 0 WAT} - {3460928400 7200 1 WAST} - {3479673600 3600 0 WAT} - {3492378000 7200 1 WAST} - {3511123200 3600 0 WAT} - {3524432400 7200 1 WAST} - {3542572800 3600 0 WAT} - {3555882000 7200 1 WAST} - {3574022400 3600 0 WAT} - {3587331600 7200 1 WAST} - {3605472000 3600 0 WAT} - {3618781200 7200 1 WAST} - {3636921600 3600 0 WAT} - {3650230800 7200 1 WAST} - {3668976000 3600 0 WAT} - {3681680400 7200 1 WAST} - {3700425600 3600 0 WAT} - {3713734800 7200 1 WAST} - {3731875200 3600 0 WAT} - {3745184400 7200 1 WAST} - {3763324800 3600 0 WAT} - {3776634000 7200 1 WAST} - {3794774400 3600 0 WAT} - {3808083600 7200 1 WAST} - {3826224000 3600 0 WAT} - {3839533200 7200 1 WAST} - {3858278400 3600 0 WAT} - {3871587600 7200 1 WAST} - {3889728000 3600 0 WAT} - {3903037200 7200 1 WAST} - {3921177600 3600 0 WAT} - {3934486800 7200 1 WAST} - {3952627200 3600 0 WAT} - {3965936400 7200 1 WAST} - {3984076800 3600 0 WAT} - {3997386000 7200 1 WAST} - {4016131200 3600 0 WAT} - {4028835600 7200 1 WAST} - {4047580800 3600 0 WAT} - {4060890000 7200 1 WAST} - {4079030400 3600 0 WAT} - {4092339600 7200 1 WAST} + {1504400400 7200 0 CAT} } diff --git a/library/tzdata/America/Adak b/library/tzdata/America/Adak index bd5d5ab..04c4628 100644 --- a/library/tzdata/America/Adak +++ b/library/tzdata/America/Adak @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:America/Adak) { - {-9223372036854775808 44001 0 LMT} - {-3225356001 -42398 0 LMT} + {-9223372036854775808 44002 0 LMT} + {-3225223727 -42398 0 LMT} {-2188944802 -39600 0 NST} {-883573200 -39600 0 NST} {-880196400 -36000 1 NWT} diff --git a/library/tzdata/America/Anchorage b/library/tzdata/America/Anchorage index 127d365..c0ff8de 100644 --- a/library/tzdata/America/Anchorage +++ b/library/tzdata/America/Anchorage @@ -2,7 +2,7 @@ set TZData(:America/Anchorage) { {-9223372036854775808 50424 0 LMT} - {-3225362424 -35976 0 LMT} + {-3225223727 -35976 0 LMT} {-2188951224 -36000 0 AST} {-883576800 -36000 0 AST} {-880200000 -32400 1 AWT} diff --git a/library/tzdata/America/Detroit b/library/tzdata/America/Detroit index 696a663..f725874 100644 --- a/library/tzdata/America/Detroit +++ b/library/tzdata/America/Detroit @@ -11,8 +11,6 @@ set TZData(:America/Detroit) { {-757364400 -18000 0 EST} {-684349200 -14400 1 EDT} {-671047200 -18000 0 EST} - {-80499600 -14400 1 EDT} - {-68666400 -18000 0 EST} {94712400 -18000 0 EST} {104914800 -14400 1 EDT} {120636000 -18000 0 EST} diff --git a/library/tzdata/America/Grand_Turk b/library/tzdata/America/Grand_Turk index 0edcf0b..c963adc 100644 --- a/library/tzdata/America/Grand_Turk +++ b/library/tzdata/America/Grand_Turk @@ -79,4 +79,168 @@ set TZData(:America/Grand_Turk) { {1414908000 -18000 0 EST} {1425798000 -14400 1 EDT} {1446361200 -14400 0 AST} + {1520751600 -14400 0 EDT} + {1541311200 -18000 0 EST} + {1552201200 -14400 1 EDT} + {1572760800 -18000 0 EST} + {1583650800 -14400 1 EDT} + {1604210400 -18000 0 EST} + {1615705200 -14400 1 EDT} + {1636264800 -18000 0 EST} + {1647154800 -14400 1 EDT} + {1667714400 -18000 0 EST} + {1678604400 -14400 1 EDT} + {1699164000 -18000 0 EST} + {1710054000 -14400 1 EDT} + {1730613600 -18000 0 EST} + {1741503600 -14400 1 EDT} + {1762063200 -18000 0 EST} + {1772953200 -14400 1 EDT} + {1793512800 -18000 0 EST} + {1805007600 -14400 1 EDT} + {1825567200 -18000 0 EST} + {1836457200 -14400 1 EDT} + {1857016800 -18000 0 EST} + {1867906800 -14400 1 EDT} + {1888466400 -18000 0 EST} + {1899356400 -14400 1 EDT} + {1919916000 -18000 0 EST} + {1930806000 -14400 1 EDT} + {1951365600 -18000 0 EST} + {1962860400 -14400 1 EDT} + {1983420000 -18000 0 EST} + {1994310000 -14400 1 EDT} + {2014869600 -18000 0 EST} + {2025759600 -14400 1 EDT} + {2046319200 -18000 0 EST} + {2057209200 -14400 1 EDT} + {2077768800 -18000 0 EST} + {2088658800 -14400 1 EDT} + {2109218400 -18000 0 EST} + {2120108400 -14400 1 EDT} + {2140668000 -18000 0 EST} + {2152162800 -14400 1 EDT} + {2172722400 -18000 0 EST} + {2183612400 -14400 1 EDT} + {2204172000 -18000 0 EST} + {2215062000 -14400 1 EDT} + {2235621600 -18000 0 EST} + {2246511600 -14400 1 EDT} + {2267071200 -18000 0 EST} + {2277961200 -14400 1 EDT} + {2298520800 -18000 0 EST} + {2309410800 -14400 1 EDT} + {2329970400 -18000 0 EST} + {2341465200 -14400 1 EDT} + {2362024800 -18000 0 EST} + {2372914800 -14400 1 EDT} + {2393474400 -18000 0 EST} + {2404364400 -14400 1 EDT} + {2424924000 -18000 0 EST} + {2435814000 -14400 1 EDT} + {2456373600 -18000 0 EST} + {2467263600 -14400 1 EDT} + {2487823200 -18000 0 EST} + {2499318000 -14400 1 EDT} + {2519877600 -18000 0 EST} + {2530767600 -14400 1 EDT} + {2551327200 -18000 0 EST} + {2562217200 -14400 1 EDT} + {2582776800 -18000 0 EST} + {2593666800 -14400 1 EDT} + {2614226400 -18000 0 EST} + {2625116400 -14400 1 EDT} + {2645676000 -18000 0 EST} + {2656566000 -14400 1 EDT} + {2677125600 -18000 0 EST} + {2688620400 -14400 1 EDT} + {2709180000 -18000 0 EST} + {2720070000 -14400 1 EDT} + {2740629600 -18000 0 EST} + {2751519600 -14400 1 EDT} + {2772079200 -18000 0 EST} + {2782969200 -14400 1 EDT} + {2803528800 -18000 0 EST} + {2814418800 -14400 1 EDT} + {2834978400 -18000 0 EST} + {2846473200 -14400 1 EDT} + {2867032800 -18000 0 EST} + {2877922800 -14400 1 EDT} + {2898482400 -18000 0 EST} + {2909372400 -14400 1 EDT} + {2929932000 -18000 0 EST} + {2940822000 -14400 1 EDT} + {2961381600 -18000 0 EST} + {2972271600 -14400 1 EDT} + {2992831200 -18000 0 EST} + {3003721200 -14400 1 EDT} + {3024280800 -18000 0 EST} + {3035775600 -14400 1 EDT} + {3056335200 -18000 0 EST} + {3067225200 -14400 1 EDT} + {3087784800 -18000 0 EST} + {3098674800 -14400 1 EDT} + {3119234400 -18000 0 EST} + {3130124400 -14400 1 EDT} + {3150684000 -18000 0 EST} + {3161574000 -14400 1 EDT} + {3182133600 -18000 0 EST} + {3193023600 -14400 1 EDT} + {3213583200 -18000 0 EST} + {3225078000 -14400 1 EDT} + {3245637600 -18000 0 EST} + {3256527600 -14400 1 EDT} + {3277087200 -18000 0 EST} + {3287977200 -14400 1 EDT} + {3308536800 -18000 0 EST} + {3319426800 -14400 1 EDT} + {3339986400 -18000 0 EST} + {3350876400 -14400 1 EDT} + {3371436000 -18000 0 EST} + {3382930800 -14400 1 EDT} + {3403490400 -18000 0 EST} + {3414380400 -14400 1 EDT} + {3434940000 -18000 0 EST} + {3445830000 -14400 1 EDT} + {3466389600 -18000 0 EST} + {3477279600 -14400 1 EDT} + {3497839200 -18000 0 EST} + {3508729200 -14400 1 EDT} + {3529288800 -18000 0 EST} + {3540178800 -14400 1 EDT} + {3560738400 -18000 0 EST} + {3572233200 -14400 1 EDT} + {3592792800 -18000 0 EST} + {3603682800 -14400 1 EDT} + {3624242400 -18000 0 EST} + {3635132400 -14400 1 EDT} + {3655692000 -18000 0 EST} + {3666582000 -14400 1 EDT} + {3687141600 -18000 0 EST} + {3698031600 -14400 1 EDT} + {3718591200 -18000 0 EST} + {3730086000 -14400 1 EDT} + {3750645600 -18000 0 EST} + {3761535600 -14400 1 EDT} + {3782095200 -18000 0 EST} + {3792985200 -14400 1 EDT} + {3813544800 -18000 0 EST} + {3824434800 -14400 1 EDT} + {3844994400 -18000 0 EST} + {3855884400 -14400 1 EDT} + {3876444000 -18000 0 EST} + {3887334000 -14400 1 EDT} + {3907893600 -18000 0 EST} + {3919388400 -14400 1 EDT} + {3939948000 -18000 0 EST} + {3950838000 -14400 1 EDT} + {3971397600 -18000 0 EST} + {3982287600 -14400 1 EDT} + {4002847200 -18000 0 EST} + {4013737200 -14400 1 EDT} + {4034296800 -18000 0 EST} + {4045186800 -14400 1 EDT} + {4065746400 -18000 0 EST} + {4076636400 -14400 1 EDT} + {4097196000 -18000 0 EST} } diff --git a/library/tzdata/America/Juneau b/library/tzdata/America/Juneau index fead810..070a27a 100644 --- a/library/tzdata/America/Juneau +++ b/library/tzdata/America/Juneau @@ -2,7 +2,7 @@ set TZData(:America/Juneau) { {-9223372036854775808 54139 0 LMT} - {-3225366139 -32261 0 LMT} + {-3225223727 -32261 0 LMT} {-2188954939 -28800 0 PST} {-883584000 -28800 0 PST} {-880207200 -25200 1 PWT} diff --git a/library/tzdata/America/Metlakatla b/library/tzdata/America/Metlakatla index 407948d..371fdcf 100644 --- a/library/tzdata/America/Metlakatla +++ b/library/tzdata/America/Metlakatla @@ -2,7 +2,7 @@ set TZData(:America/Metlakatla) { {-9223372036854775808 54822 0 LMT} - {-3225366822 -31578 0 LMT} + {-3225223727 -31578 0 LMT} {-2188955622 -28800 0 PST} {-883584000 -28800 0 PST} {-880207200 -25200 1 PWT} diff --git a/library/tzdata/America/Nome b/library/tzdata/America/Nome index c095b79..d7a9186 100644 --- a/library/tzdata/America/Nome +++ b/library/tzdata/America/Nome @@ -1,8 +1,8 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:America/Nome) { - {-9223372036854775808 46701 0 LMT} - {-3225358701 -39698 0 LMT} + {-9223372036854775808 46702 0 LMT} + {-3225223727 -39698 0 LMT} {-2188947502 -39600 0 NST} {-883573200 -39600 0 NST} {-880196400 -36000 1 NWT} diff --git a/library/tzdata/America/Sitka b/library/tzdata/America/Sitka index 8c53d93..7cef02a 100644 --- a/library/tzdata/America/Sitka +++ b/library/tzdata/America/Sitka @@ -2,7 +2,7 @@ set TZData(:America/Sitka) { {-9223372036854775808 53927 0 LMT} - {-3225365927 -32473 0 LMT} + {-3225223727 -32473 0 LMT} {-2188954727 -28800 0 PST} {-883584000 -28800 0 PST} {-880207200 -25200 1 PWT} diff --git a/library/tzdata/America/Yakutat b/library/tzdata/America/Yakutat index a0420c5..b1d66ff 100644 --- a/library/tzdata/America/Yakutat +++ b/library/tzdata/America/Yakutat @@ -2,7 +2,7 @@ set TZData(:America/Yakutat) { {-9223372036854775808 52865 0 LMT} - {-3225364865 -33535 0 LMT} + {-3225223727 -33535 0 LMT} {-2188953665 -32400 0 YST} {-883580400 -32400 0 YST} {-880203600 -28800 1 YWT} diff --git a/library/tzdata/Asia/Famagusta b/library/tzdata/Asia/Famagusta index 384c183..55eade6 100644 --- a/library/tzdata/Asia/Famagusta +++ b/library/tzdata/Asia/Famagusta @@ -88,4 +88,169 @@ set TZData(:Asia/Famagusta) { {1445734800 7200 0 EET} {1459040400 10800 1 EEST} {1473285600 10800 0 +03} + {1509238800 7200 0 EET} + {1521939600 10800 1 EEST} + {1540688400 7200 0 EET} + {1553994000 10800 1 EEST} + {1572138000 7200 0 EET} + {1585443600 10800 1 EEST} + {1603587600 7200 0 EET} + {1616893200 10800 1 EEST} + {1635642000 7200 0 EET} + {1648342800 10800 1 EEST} + {1667091600 7200 0 EET} + {1679792400 10800 1 EEST} + {1698541200 7200 0 EET} + {1711846800 10800 1 EEST} + {1729990800 7200 0 EET} + {1743296400 10800 1 EEST} + {1761440400 7200 0 EET} + {1774746000 10800 1 EEST} + {1792890000 7200 0 EET} + {1806195600 10800 1 EEST} + {1824944400 7200 0 EET} + {1837645200 10800 1 EEST} + {1856394000 7200 0 EET} + {1869094800 10800 1 EEST} + {1887843600 7200 0 EET} + {1901149200 10800 1 EEST} + {1919293200 7200 0 EET} + {1932598800 10800 1 EEST} + {1950742800 7200 0 EET} + {1964048400 10800 1 EEST} + {1982797200 7200 0 EET} + {1995498000 10800 1 EEST} + {2014246800 7200 0 EET} + {2026947600 10800 1 EEST} + {2045696400 7200 0 EET} + {2058397200 10800 1 EEST} + {2077146000 7200 0 EET} + {2090451600 10800 1 EEST} + {2108595600 7200 0 EET} + {2121901200 10800 1 EEST} + {2140045200 7200 0 EET} + {2153350800 10800 1 EEST} + {2172099600 7200 0 EET} + {2184800400 10800 1 EEST} + {2203549200 7200 0 EET} + {2216250000 10800 1 EEST} + {2234998800 7200 0 EET} + {2248304400 10800 1 EEST} + {2266448400 7200 0 EET} + {2279754000 10800 1 EEST} + {2297898000 7200 0 EET} + {2311203600 10800 1 EEST} + {2329347600 7200 0 EET} + {2342653200 10800 1 EEST} + {2361402000 7200 0 EET} + {2374102800 10800 1 EEST} + {2392851600 7200 0 EET} + {2405552400 10800 1 EEST} + {2424301200 7200 0 EET} + {2437606800 10800 1 EEST} + {2455750800 7200 0 EET} + {2469056400 10800 1 EEST} + {2487200400 7200 0 EET} + {2500506000 10800 1 EEST} + {2519254800 7200 0 EET} + {2531955600 10800 1 EEST} + {2550704400 7200 0 EET} + {2563405200 10800 1 EEST} + {2582154000 7200 0 EET} + {2595459600 10800 1 EEST} + {2613603600 7200 0 EET} + {2626909200 10800 1 EEST} + {2645053200 7200 0 EET} + {2658358800 10800 1 EEST} + {2676502800 7200 0 EET} + {2689808400 10800 1 EEST} + {2708557200 7200 0 EET} + {2721258000 10800 1 EEST} + {2740006800 7200 0 EET} + {2752707600 10800 1 EEST} + {2771456400 7200 0 EET} + {2784762000 10800 1 EEST} + {2802906000 7200 0 EET} + {2816211600 10800 1 EEST} + {2834355600 7200 0 EET} + {2847661200 10800 1 EEST} + {2866410000 7200 0 EET} + {2879110800 10800 1 EEST} + {2897859600 7200 0 EET} + {2910560400 10800 1 EEST} + {2929309200 7200 0 EET} + {2942010000 10800 1 EEST} + {2960758800 7200 0 EET} + {2974064400 10800 1 EEST} + {2992208400 7200 0 EET} + {3005514000 10800 1 EEST} + {3023658000 7200 0 EET} + {3036963600 10800 1 EEST} + {3055712400 7200 0 EET} + {3068413200 10800 1 EEST} + {3087162000 7200 0 EET} + {3099862800 10800 1 EEST} + {3118611600 7200 0 EET} + {3131917200 10800 1 EEST} + {3150061200 7200 0 EET} + {3163366800 10800 1 EEST} + {3181510800 7200 0 EET} + {3194816400 10800 1 EEST} + {3212960400 7200 0 EET} + {3226266000 10800 1 EEST} + {3245014800 7200 0 EET} + {3257715600 10800 1 EEST} + {3276464400 7200 0 EET} + {3289165200 10800 1 EEST} + {3307914000 7200 0 EET} + {3321219600 10800 1 EEST} + {3339363600 7200 0 EET} + {3352669200 10800 1 EEST} + {3370813200 7200 0 EET} + {3384118800 10800 1 EEST} + {3402867600 7200 0 EET} + {3415568400 10800 1 EEST} + {3434317200 7200 0 EET} + {3447018000 10800 1 EEST} + {3465766800 7200 0 EET} + {3479072400 10800 1 EEST} + {3497216400 7200 0 EET} + {3510522000 10800 1 EEST} + {3528666000 7200 0 EET} + {3541971600 10800 1 EEST} + {3560115600 7200 0 EET} + {3573421200 10800 1 EEST} + {3592170000 7200 0 EET} + {3604870800 10800 1 EEST} + {3623619600 7200 0 EET} + {3636320400 10800 1 EEST} + {3655069200 7200 0 EET} + {3668374800 10800 1 EEST} + {3686518800 7200 0 EET} + {3699824400 10800 1 EEST} + {3717968400 7200 0 EET} + {3731274000 10800 1 EEST} + {3750022800 7200 0 EET} + {3762723600 10800 1 EEST} + {3781472400 7200 0 EET} + {3794173200 10800 1 EEST} + {3812922000 7200 0 EET} + {3825622800 10800 1 EEST} + {3844371600 7200 0 EET} + {3857677200 10800 1 EEST} + {3875821200 7200 0 EET} + {3889126800 10800 1 EEST} + {3907270800 7200 0 EET} + {3920576400 10800 1 EEST} + {3939325200 7200 0 EET} + {3952026000 10800 1 EEST} + {3970774800 7200 0 EET} + {3983475600 10800 1 EEST} + {4002224400 7200 0 EET} + {4015530000 10800 1 EEST} + {4033674000 7200 0 EET} + {4046979600 10800 1 EEST} + {4065123600 7200 0 EET} + {4078429200 10800 1 EEST} + {4096573200 7200 0 EET} } diff --git a/library/tzdata/Asia/Kolkata b/library/tzdata/Asia/Kolkata index 6b3b9fb..b78f8cd 100644 --- a/library/tzdata/Asia/Kolkata +++ b/library/tzdata/Asia/Kolkata @@ -2,8 +2,10 @@ set TZData(:Asia/Kolkata) { {-9223372036854775808 21208 0 LMT} - {-2840162008 21200 0 HMT} - {-891582800 23400 0 +0630} + {-3645237208 21200 0 HMT} + {-3155694800 19270 0 MMT} + {-2019705670 19800 0 IST} + {-891581400 23400 1 +0630} {-872058600 19800 0 IST} {-862637400 23400 1 +0630} {-764145000 19800 0 IST} diff --git a/library/tzdata/Asia/Yangon b/library/tzdata/Asia/Yangon index 8e17d82..82870c6 100644 --- a/library/tzdata/Asia/Yangon +++ b/library/tzdata/Asia/Yangon @@ -1,9 +1,9 @@ # created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Yangon) { - {-9223372036854775808 23080 0 LMT} - {-2840163880 23080 0 RMT} - {-1577946280 23400 0 +0630} + {-9223372036854775808 23087 0 LMT} + {-2840163887 23087 0 RMT} + {-1577946287 23400 0 +0630} {-873268200 32400 0 +09} {-778410000 23400 0 +0630} } diff --git a/library/tzdata/Asia/Yerevan b/library/tzdata/Asia/Yerevan index 0ffb69e..25a349a 100644 --- a/library/tzdata/Asia/Yerevan +++ b/library/tzdata/Asia/Yerevan @@ -64,6 +64,7 @@ set TZData(:Asia/Yerevan) { {1256421600 14400 0 +04} {1269727200 18000 1 +05} {1288476000 14400 0 +04} + {1293825600 14400 0 +04} {1301176800 18000 1 +05} {1319925600 14400 0 +04} } diff --git a/library/tzdata/Europe/Dublin b/library/tzdata/Europe/Dublin index 4b43bc0..c3a5c0e 100644 --- a/library/tzdata/Europe/Dublin +++ b/library/tzdata/Europe/Dublin @@ -52,10 +52,10 @@ set TZData(:Europe/Dublin) { {-986162400 0 0 IST} {-969228000 3600 1 IST} {-950479200 0 0 IST} - {-942015600 3600 1 IST} - {-733359600 0 0 GMT} + {-942012000 3600 1 IST} + {-733356000 0 0 GMT} {-719445600 3600 1 IST} - {-699490800 0 0 GMT} + {-699487200 0 0 GMT} {-684972000 3600 0 IST} {-668037600 0 0 IST} {-654732000 3600 1 IST} diff --git a/library/tzdata/Pacific/Apia b/library/tzdata/Pacific/Apia index feef374..4c0d84a 100644 --- a/library/tzdata/Pacific/Apia +++ b/library/tzdata/Pacific/Apia @@ -2,7 +2,7 @@ set TZData(:Pacific/Apia) { {-9223372036854775808 45184 0 LMT} - {-2855737984 -41216 0 LMT} + {-2445424384 -41216 0 LMT} {-1861878784 -41400 0 -1130} {-631110600 -39600 0 -10} {1285498800 -36000 1 -10} diff --git a/library/tzdata/Pacific/Fiji b/library/tzdata/Pacific/Fiji index fa8c99e..f9d393c 100644 --- a/library/tzdata/Pacific/Fiji +++ b/library/tzdata/Pacific/Fiji @@ -24,7 +24,7 @@ set TZData(:Pacific/Fiji) { {1478354400 46800 1 +13} {1484402400 43200 0 +12} {1509804000 46800 1 +13} - {1516456800 43200 0 +12} + {1515852000 43200 0 +12} {1541253600 46800 1 +13} {1547906400 43200 0 +12} {1572703200 46800 1 +13} @@ -36,7 +36,7 @@ set TZData(:Pacific/Fiji) { {1667656800 46800 1 +13} {1673704800 43200 0 +12} {1699106400 46800 1 +13} - {1705759200 43200 0 +12} + {1705154400 43200 0 +12} {1730556000 46800 1 +13} {1737208800 43200 0 +12} {1762005600 46800 1 +13} @@ -46,7 +46,7 @@ set TZData(:Pacific/Fiji) { {1825509600 46800 1 +13} {1831557600 43200 0 +12} {1856959200 46800 1 +13} - {1863612000 43200 0 +12} + {1863007200 43200 0 +12} {1888408800 46800 1 +13} {1895061600 43200 0 +12} {1919858400 46800 1 +13} @@ -58,7 +58,7 @@ set TZData(:Pacific/Fiji) { {2014812000 46800 1 +13} {2020860000 43200 0 +12} {2046261600 46800 1 +13} - {2052914400 43200 0 +12} + {2052309600 43200 0 +12} {2077711200 46800 1 +13} {2084364000 43200 0 +12} {2109160800 46800 1 +13} @@ -80,7 +80,7 @@ set TZData(:Pacific/Fiji) { {2361967200 46800 1 +13} {2368015200 43200 0 +12} {2393416800 46800 1 +13} - {2400069600 43200 0 +12} + {2399464800 43200 0 +12} {2424866400 46800 1 +13} {2431519200 43200 0 +12} {2456316000 46800 1 +13} @@ -92,7 +92,7 @@ set TZData(:Pacific/Fiji) { {2551269600 46800 1 +13} {2557317600 43200 0 +12} {2582719200 46800 1 +13} - {2589372000 43200 0 +12} + {2588767200 43200 0 +12} {2614168800 46800 1 +13} {2620821600 43200 0 +12} {2645618400 46800 1 +13} @@ -102,7 +102,7 @@ set TZData(:Pacific/Fiji) { {2709122400 46800 1 +13} {2715170400 43200 0 +12} {2740572000 46800 1 +13} - {2747224800 43200 0 +12} + {2746620000 43200 0 +12} {2772021600 46800 1 +13} {2778674400 43200 0 +12} {2803471200 46800 1 +13} @@ -114,7 +114,7 @@ set TZData(:Pacific/Fiji) { {2898424800 46800 1 +13} {2904472800 43200 0 +12} {2929874400 46800 1 +13} - {2936527200 43200 0 +12} + {2935922400 43200 0 +12} {2961324000 46800 1 +13} {2967976800 43200 0 +12} {2992773600 46800 1 +13} @@ -136,7 +136,7 @@ set TZData(:Pacific/Fiji) { {3245580000 46800 1 +13} {3251628000 43200 0 +12} {3277029600 46800 1 +13} - {3283682400 43200 0 +12} + {3283077600 43200 0 +12} {3308479200 46800 1 +13} {3315132000 43200 0 +12} {3339928800 46800 1 +13} @@ -148,7 +148,7 @@ set TZData(:Pacific/Fiji) { {3434882400 46800 1 +13} {3440930400 43200 0 +12} {3466332000 46800 1 +13} - {3472984800 43200 0 +12} + {3472380000 43200 0 +12} {3497781600 46800 1 +13} {3504434400 43200 0 +12} {3529231200 46800 1 +13} @@ -158,7 +158,7 @@ set TZData(:Pacific/Fiji) { {3592735200 46800 1 +13} {3598783200 43200 0 +12} {3624184800 46800 1 +13} - {3630837600 43200 0 +12} + {3630232800 43200 0 +12} {3655634400 46800 1 +13} {3662287200 43200 0 +12} {3687084000 46800 1 +13} @@ -170,7 +170,7 @@ set TZData(:Pacific/Fiji) { {3782037600 46800 1 +13} {3788085600 43200 0 +12} {3813487200 46800 1 +13} - {3820140000 43200 0 +12} + {3819535200 43200 0 +12} {3844936800 46800 1 +13} {3851589600 43200 0 +12} {3876386400 46800 1 +13} diff --git a/library/tzdata/Pacific/Pago_Pago b/library/tzdata/Pacific/Pago_Pago index d30c981..9b5607f 100644 --- a/library/tzdata/Pacific/Pago_Pago +++ b/library/tzdata/Pacific/Pago_Pago @@ -2,6 +2,6 @@ set TZData(:Pacific/Pago_Pago) { {-9223372036854775808 45432 0 LMT} - {-2855738232 -40968 0 LMT} + {-2445424632 -40968 0 LMT} {-1861879032 -39600 0 SST} } diff --git a/library/tzdata/Pacific/Tongatapu b/library/tzdata/Pacific/Tongatapu index 731b4f6..3cfaaaa 100644 --- a/library/tzdata/Pacific/Tongatapu +++ b/library/tzdata/Pacific/Tongatapu @@ -13,169 +13,4 @@ set TZData(:Pacific/Tongatapu) { {1012046400 46800 0 +13} {1478350800 50400 1 +14} {1484398800 46800 0 +13} - {1509800400 50400 1 +14} - {1516453200 46800 0 +13} - {1541250000 50400 1 +14} - {1547902800 46800 0 +13} - {1572699600 50400 1 +14} - {1579352400 46800 0 +13} - {1604149200 50400 1 +14} - {1610802000 46800 0 +13} - {1636203600 50400 1 +14} - {1642251600 46800 0 +13} - {1667653200 50400 1 +14} - {1673701200 46800 0 +13} - {1699102800 50400 1 +14} - {1705755600 46800 0 +13} - {1730552400 50400 1 +14} - {1737205200 46800 0 +13} - {1762002000 50400 1 +14} - {1768654800 46800 0 +13} - {1793451600 50400 1 +14} - {1800104400 46800 0 +13} - {1825506000 50400 1 +14} - {1831554000 46800 0 +13} - {1856955600 50400 1 +14} - {1863608400 46800 0 +13} - {1888405200 50400 1 +14} - {1895058000 46800 0 +13} - {1919854800 50400 1 +14} - {1926507600 46800 0 +13} - {1951304400 50400 1 +14} - {1957957200 46800 0 +13} - {1983358800 50400 1 +14} - {1989406800 46800 0 +13} - {2014808400 50400 1 +14} - {2020856400 46800 0 +13} - {2046258000 50400 1 +14} - {2052910800 46800 0 +13} - {2077707600 50400 1 +14} - {2084360400 46800 0 +13} - {2109157200 50400 1 +14} - {2115810000 46800 0 +13} - {2140606800 50400 1 +14} - {2147259600 46800 0 +13} - {2172661200 50400 1 +14} - {2178709200 46800 0 +13} - {2204110800 50400 1 +14} - {2210158800 46800 0 +13} - {2235560400 50400 1 +14} - {2242213200 46800 0 +13} - {2267010000 50400 1 +14} - {2273662800 46800 0 +13} - {2298459600 50400 1 +14} - {2305112400 46800 0 +13} - {2329909200 50400 1 +14} - {2336562000 46800 0 +13} - {2361963600 50400 1 +14} - {2368011600 46800 0 +13} - {2393413200 50400 1 +14} - {2400066000 46800 0 +13} - {2424862800 50400 1 +14} - {2431515600 46800 0 +13} - {2456312400 50400 1 +14} - {2462965200 46800 0 +13} - {2487762000 50400 1 +14} - {2494414800 46800 0 +13} - {2519816400 50400 1 +14} - {2525864400 46800 0 +13} - {2551266000 50400 1 +14} - {2557314000 46800 0 +13} - {2582715600 50400 1 +14} - {2589368400 46800 0 +13} - {2614165200 50400 1 +14} - {2620818000 46800 0 +13} - {2645614800 50400 1 +14} - {2652267600 46800 0 +13} - {2677064400 50400 1 +14} - {2683717200 46800 0 +13} - {2709118800 50400 1 +14} - {2715166800 46800 0 +13} - {2740568400 50400 1 +14} - {2747221200 46800 0 +13} - {2772018000 50400 1 +14} - {2778670800 46800 0 +13} - {2803467600 50400 1 +14} - {2810120400 46800 0 +13} - {2834917200 50400 1 +14} - {2841570000 46800 0 +13} - {2866971600 50400 1 +14} - {2873019600 46800 0 +13} - {2898421200 50400 1 +14} - {2904469200 46800 0 +13} - {2929870800 50400 1 +14} - {2936523600 46800 0 +13} - {2961320400 50400 1 +14} - {2967973200 46800 0 +13} - {2992770000 50400 1 +14} - {2999422800 46800 0 +13} - {3024219600 50400 1 +14} - {3030872400 46800 0 +13} - {3056274000 50400 1 +14} - {3062322000 46800 0 +13} - {3087723600 50400 1 +14} - {3093771600 46800 0 +13} - {3119173200 50400 1 +14} - {3125826000 46800 0 +13} - {3150622800 50400 1 +14} - {3157275600 46800 0 +13} - {3182072400 50400 1 +14} - {3188725200 46800 0 +13} - {3213522000 50400 1 +14} - {3220174800 46800 0 +13} - {3245576400 50400 1 +14} - {3251624400 46800 0 +13} - {3277026000 50400 1 +14} - {3283678800 46800 0 +13} - {3308475600 50400 1 +14} - {3315128400 46800 0 +13} - {3339925200 50400 1 +14} - {3346578000 46800 0 +13} - {3371374800 50400 1 +14} - {3378027600 46800 0 +13} - {3403429200 50400 1 +14} - {3409477200 46800 0 +13} - {3434878800 50400 1 +14} - {3440926800 46800 0 +13} - {3466328400 50400 1 +14} - {3472981200 46800 0 +13} - {3497778000 50400 1 +14} - {3504430800 46800 0 +13} - {3529227600 50400 1 +14} - {3535880400 46800 0 +13} - {3560677200 50400 1 +14} - {3567330000 46800 0 +13} - {3592731600 50400 1 +14} - {3598779600 46800 0 +13} - {3624181200 50400 1 +14} - {3630834000 46800 0 +13} - {3655630800 50400 1 +14} - {3662283600 46800 0 +13} - {3687080400 50400 1 +14} - {3693733200 46800 0 +13} - {3718530000 50400 1 +14} - {3725182800 46800 0 +13} - {3750584400 50400 1 +14} - {3756632400 46800 0 +13} - {3782034000 50400 1 +14} - {3788082000 46800 0 +13} - {3813483600 50400 1 +14} - {3820136400 46800 0 +13} - {3844933200 50400 1 +14} - {3851586000 46800 0 +13} - {3876382800 50400 1 +14} - {3883035600 46800 0 +13} - {3907832400 50400 1 +14} - {3914485200 46800 0 +13} - {3939886800 50400 1 +14} - {3945934800 46800 0 +13} - {3971336400 50400 1 +14} - {3977384400 46800 0 +13} - {4002786000 50400 1 +14} - {4009438800 46800 0 +13} - {4034235600 50400 1 +14} - {4040888400 46800 0 +13} - {4065685200 50400 1 +14} - {4072338000 46800 0 +13} - {4097134800 50400 1 +14} } -- cgit v0.12 From f18d453679d9b42aaca721479cff7d92205796af Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Tue, 24 Oct 2017 13:24:25 +0000 Subject: Historical change affecting tests: Detroit did not observe Daylight Saving Time in 1967 --- tests/clock.test | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/tests/clock.test b/tests/clock.test index 7d62a60..a697714 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -15416,30 +15416,9 @@ test clock-5.29 {time zone boundary case 1948-09-26 01:00:01} detroit { clock format -671047199 -format {%H:%M:%S %z %Z} \ -timezone :America/Detroit } {01:00:01 -0500 EST} -test clock-5.30 {time zone boundary case 1967-06-14 01:59:59} detroit { - clock format -80499601 -format {%H:%M:%S %z %Z} \ - -timezone :America/Detroit -} {01:59:59 -0500 EST} -test clock-5.31 {time zone boundary case 1967-06-14 03:00:00} detroit { - clock format -80499600 -format {%H:%M:%S %z %Z} \ - -timezone :America/Detroit -} {03:00:00 -0400 EDT} -test clock-5.32 {time zone boundary case 1967-06-14 03:00:01} detroit { - clock format -80499599 -format {%H:%M:%S %z %Z} \ - -timezone :America/Detroit -} {03:00:01 -0400 EDT} -test clock-5.33 {time zone boundary case 1967-10-29 01:59:59} detroit { - clock format -68666401 -format {%H:%M:%S %z %Z} \ - -timezone :America/Detroit -} {01:59:59 -0400 EDT} -test clock-5.34 {time zone boundary case 1967-10-29 01:00:00} detroit { - clock format -68666400 -format {%H:%M:%S %z %Z} \ - -timezone :America/Detroit -} {01:00:00 -0500 EST} -test clock-5.35 {time zone boundary case 1967-10-29 01:00:01} detroit { - clock format -68666399 -format {%H:%M:%S %z %Z} \ - -timezone :America/Detroit -} {01:00:01 -0500 EST} + +# Detroit did not observe Daylight Saving Time in 1967 + test clock-5.36 {time zone boundary case 1972-12-31 23:59:59} detroit { clock format 94712399 -format {%H:%M:%S %z %Z} \ -timezone :America/Detroit -- cgit v0.12 From d5f679a3f608fabb7954ae203eff8f37b2e1747b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 24 Oct 2017 13:56:26 +0000 Subject: Change (internal) refCount field from TclRegexp to type size_t: this allows more references on 64-bit platforms. Remove unused macro "xxx" in regguts.h. Remove superflouous eol-space in oo.test. --- generic/regguts.h | 1 - generic/tclRegexp.h | 2 +- tests/oo.test | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/generic/regguts.h b/generic/regguts.h index ad9d5b9..b3dbaa4 100644 --- a/generic/regguts.h +++ b/generic/regguts.h @@ -70,7 +70,6 @@ */ #define NOTREACHED 0 -#define xxx 1 #define DUPMAX _POSIX2_RE_DUP_MAX #define DUPINF (DUPMAX+1) diff --git a/generic/tclRegexp.h b/generic/tclRegexp.h index eac0aaa..a263dfd 100644 --- a/generic/tclRegexp.h +++ b/generic/tclRegexp.h @@ -37,7 +37,7 @@ typedef struct TclRegexp { * of subexpressions. */ rm_detail_t details; /* Detailed information on match (currently * used only for REG_EXPECT). */ - unsigned int refCount; /* Count of number of references to this + size_t refCount; /* Count of number of references to this * compiled regexp. */ } TclRegexp; diff --git a/tests/oo.test b/tests/oo.test index 2a6eb80..54c4b75 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -2053,7 +2053,7 @@ test oo-15.15 {method cloning must ensure that there is a string representation } -body { cls create foo oo::objdefine foo { - method m1 {} [string map {a b} {return hello}] + method m1 {} [string map {a b} {return hello}] } [oo::copy foo] m1 } -cleanup { -- cgit v0.12 From 9306fa604ca63f8626f859c1f6cb5154a659e504 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 24 Oct 2017 14:11:16 +0000 Subject: Cherrypick: [fc1409fc91] Method cloning needs to be careful with body representations. --- generic/tclOOMethod.c | 1 + tests/oo.test | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/generic/tclOOMethod.c b/generic/tclOOMethod.c index 99a8bfc..8da0fb3 100644 --- a/generic/tclOOMethod.c +++ b/generic/tclOOMethod.c @@ -1314,6 +1314,7 @@ CloneProcedureMethod( */ bodyObj = Tcl_DuplicateObj(pmPtr->procPtr->bodyPtr); + Tcl_GetString(bodyObj); TclFreeIntRep(bodyObj); /* diff --git a/tests/oo.test b/tests/oo.test index 1ac6f37..61a5e01 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -2048,6 +2048,17 @@ test oo-15.14 {OO: object cloning with target NS} -setup { } -cleanup { Cls destroy } -result {{} ::dupens::test-15.14} +test oo-15.15 {method cloning must ensure that there is a string representation of bodies} -setup { + oo::class create cls +} -body { + cls create foo + oo::objdefine foo { + method m1 {} [string map {a b} {return hello}] + } + [oo::copy foo] m1 +} -cleanup { + cls destroy +} -result hello test oo-16.1 {OO: object introspection} -body { info object -- cgit v0.12 From 40ce2eccbc52b403d4a4b7bc479fbde987a14e18 Mon Sep 17 00:00:00 2001 From: fvogel Date: Tue, 24 Oct 2017 21:24:07 +0000 Subject: 'array for' implementation (TIP #421) from Brad Lanam --- doc/array.n | 7 + generic/tclVar.c | 388 +++++++++++++++++++++++++++++++++++++++++++++++++---- tests/set-old.test | 6 +- tests/var.test | 160 +++++++++++++++++++++- 4 files changed, 528 insertions(+), 33 deletions(-) diff --git a/doc/array.n b/doc/array.n index 25ad0c6..751c688 100644 --- a/doc/array.n +++ b/doc/array.n @@ -47,6 +47,13 @@ been the return value from a previous invocation of Returns 1 if \fIarrayName\fR is an array variable, 0 if there is no variable by that name or if it is a scalar variable. .TP +\fBarray for {\fIkeyVariable ?valueVariable?\fB} \fIarrayName body\fR +The first argument is a one or two element list of variable names for the +key and value of each entry in the array. The second argument is the +array name to iterate over. The third argument is the body to execute +for each key and value returned. +The ordering of the returned keys is undefined. +.TP \fBarray get \fIarrayName\fR ?\fIpattern\fR? Returns a list containing pairs of elements. The first element in each pair is the name of an element in \fIarrayName\fR diff --git a/generic/tclVar.c b/generic/tclVar.c index 3dd6790..d6f3e96 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -165,6 +165,7 @@ typedef struct ArraySearch { struct ArraySearch *nextPtr;/* Next in list of all active searches for * this variable, or NULL if this is the last * one. */ + Tcl_Obj *arrayNameObj; /* name of the array object */ } ArraySearch; /* @@ -173,6 +174,8 @@ typedef struct ArraySearch { static void AppendLocals(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *patternPtr, int includeLinks); +static void ArrayDoneSearch (Interp *iPtr, Var *varPtr, ArraySearch *searchPtr); +static Tcl_NRPostProc ArrayForLoopCallback; static void DeleteSearches(Interp *iPtr, Var *arrayVarPtr); static void DeleteArray(Interp *iPtr, Tcl_Obj *arrayNamePtr, Var *varPtr, int flags, int index); @@ -3098,6 +3101,321 @@ TclArraySet( /* *---------------------------------------------------------------------- * + * ArrayForNRCmd + * ArrayForLoopCallback + * ArrayObjFirst + * ArrayObjNext + * + * These functions implement the "array for" Tcl command. + * array for {k v} a {} + * The array for command iterates over the array, setting the + * the specified loop variables, and executing the body each iteration. + * + * ArrayForNRCmd() sets up the ArraySearch structure, sets arrayNamePtr + * inside the structure and calls VarHashFirstEntry to start the hash + * iteration. + * + * ArrayForNRCmd() does not execute the body or set the loop variables, + * it only initializes the iterator. + * + * ArrayForLoopCallback() iterates over the entire array, executing + * the body each time. + * + * ArrayObjFirst() Does not execute the body or set the key/value variables. + * + *---------------------------------------------------------------------- + */ +void +ArrayObjFirst( + Tcl_Interp *interp, + Tcl_Obj *arrayNameObj, + Var *varPtr, + ArraySearch *searchPtr) +{ + Interp *iPtr = (Interp *) interp; + Tcl_HashEntry *hPtr; + int isNew; + + searchPtr->varPtr = varPtr; + searchPtr->arrayNameObj = arrayNameObj; + + /* add the search to the search table */ + hPtr = Tcl_CreateHashEntry(&iPtr->varSearches, varPtr, &isNew); + if (isNew) { + searchPtr->id = 1; + varPtr->flags |= VAR_SEARCH_ACTIVE; + searchPtr->nextPtr = NULL; + } else { + searchPtr->id = ((ArraySearch *) Tcl_GetHashValue(hPtr))->id + 1; + searchPtr->nextPtr = Tcl_GetHashValue(hPtr); + } + searchPtr->nextEntry = VarHashFirstEntry(varPtr->value.tablePtr, + &searchPtr->search); + Tcl_SetHashValue(hPtr, searchPtr); +} + +int +ArrayObjNext( + Tcl_Interp *interp, + Var *varPtr, /* array */ + ArraySearch *searchPtr, + Tcl_Obj **keyPtrPtr, /* Pointer to a variable to have the key + * written into, or NULL. */ + Tcl_Obj **valuePtrPtr /* Pointer to a variable to have the + * value written into, or NULL.*/ + ) +{ + Tcl_Obj *keyObj; + Tcl_Obj *valueObj = NULL; + int gotValue; + int donerc; + + donerc = TCL_BREAK; + + if ((varPtr->flags & VAR_SEARCH_ACTIVE) != VAR_SEARCH_ACTIVE) { + donerc = TCL_ERROR; + return donerc; + } + + gotValue = 0; + while (1) { + Tcl_HashEntry *hPtr = searchPtr->nextEntry; + if (hPtr != NULL) { + searchPtr->nextEntry = NULL; + } else { + hPtr = Tcl_NextHashEntry(&searchPtr->search); + if (hPtr == NULL) { + gotValue = 0; + break; + } + } + varPtr = VarHashGetValue(hPtr); + if (!TclIsVarUndefined(varPtr)) { + gotValue = 1; + break; + } + } + + if (! gotValue) { + return donerc; + } + + donerc = TCL_CONTINUE; + + keyObj = VarHashGetKey(varPtr); + *keyPtrPtr = keyObj; + valueObj = Tcl_ObjGetVar2(interp, searchPtr->arrayNameObj, + keyObj, TCL_LEAVE_ERR_MSG); + *valuePtrPtr = valueObj; + + return donerc; +} + +static int +ArrayForNRCmd( + ClientData dummy, + Tcl_Interp *interp, + int objc, + Tcl_Obj *const *objv) +{ + Interp *iPtr = (Interp *) interp; + Tcl_Obj *scriptObj, *keyVarObj, *valueVarObj; + Tcl_Obj **varv; + Tcl_Obj *arrayNameObj; + ArraySearch *searchPtr = NULL; + Var *varPtr; + Var *arrayPtr; + int varc; + + /* + * array for {k v} a body + */ + + if (objc != 4) { + Tcl_WrongNumArgs(interp, 1, objv, + "{key value} arrayName script"); + return TCL_ERROR; + } + + /* + * Parse arguments. + */ + + if (TclListObjGetElements(interp, objv[1], &varc, &varv) != TCL_OK) { + return TCL_ERROR; + } + if (varc != 2) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "must have two variable names", -1)); + Tcl_SetErrorCode(interp, "TCL", "SYNTAX", "array", "for", NULL); + return TCL_ERROR; + } + + arrayNameObj = objv[2]; + keyVarObj = varv[0]; + valueVarObj = varv[1]; + scriptObj = objv[3]; + + /* + * Locate the array variable. + */ + + varPtr = TclObjLookupVarEx(interp, arrayNameObj, NULL, /*flags*/ 0, + /*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 && (varPtr->flags & VAR_TRACED_ARRAY) + && (TclIsVarArray(varPtr) || TclIsVarUndefined(varPtr))) { + if (TclObjCallVarTraces(iPtr, arrayPtr, varPtr, arrayNameObj, NULL, + (TCL_LEAVE_ERR_MSG|TCL_NAMESPACE_ONLY|TCL_GLOBAL_ONLY| + TCL_TRACE_ARRAY), /* leaveErrMsg */ 1, -1) == TCL_ERROR) { + return TCL_ERROR; + } + } + + /* + * Verify that it is indeed an array variable. This test comes after the + * traces; the variable may actually become an array as an effect of said + * traces. + */ + + if ((varPtr == NULL) || !TclIsVarArray(varPtr) + || TclIsVarUndefined(varPtr)) { + const char *varName = Tcl_GetString(arrayNameObj); + + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "\"%s\" isn't an array", varName)); + Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ARRAY", varName, NULL); + return TCL_ERROR; + } + + /* + * Make a new array search, put it on the stack. + */ + + searchPtr = ckalloc(sizeof(ArraySearch)); + searchPtr->arrayNameObj = NULL; + ArrayObjFirst(interp, arrayNameObj, varPtr, searchPtr); + + /* + * Make sure that these objects (which we need throughout the body of the + * loop) don't vanish. + */ + + Tcl_IncrRefCount(keyVarObj); + Tcl_IncrRefCount(valueVarObj); + Tcl_IncrRefCount(scriptObj); + + /* + * Run the script. + */ + + TclNRAddCallback(interp, ArrayForLoopCallback, searchPtr, keyVarObj, + valueVarObj, scriptObj); + return TCL_OK; +} + +static int +ArrayForLoopCallback( + ClientData data[], + Tcl_Interp *interp, + int result) +{ + Interp *iPtr = (Interp *) interp; + ArraySearch *searchPtr = data[0]; + Tcl_Obj *keyVarObj = data[1]; + Tcl_Obj *valueVarObj = data[2]; + Tcl_Obj *scriptObj = data[3]; + Tcl_Obj *keyObj, *valueObj; + Var *varPtr; + Var *arrayPtr; + int done; + + /* + * Process the result from the previous execution of the script body. + */ + + done = TCL_ERROR; + varPtr = TclObjLookupVarEx(interp, searchPtr->arrayNameObj, NULL, /*flags*/ 0, + /*msg*/ 0, /*createPart1*/ 0, /*createPart2*/ 0, &arrayPtr); + + if (result == TCL_CONTINUE) { + result = TCL_OK; + } else if (result != TCL_OK) { + if (result == TCL_BREAK) { + Tcl_ResetResult(interp); + result = TCL_OK; + } else if (result == TCL_ERROR) { + Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( + "\n (\"array for\" body line %d)", + Tcl_GetErrorLine(interp))); + } + goto arrayfordone; + } + + /* + * Get the next mapping from the array. + */ + + keyObj = NULL; + valueObj = NULL; + done = ArrayObjNext (interp, varPtr, searchPtr, &keyObj, &valueObj); + + result = TCL_OK; + if (done != TCL_CONTINUE) { + Tcl_ResetResult(interp); + if (done == TCL_ERROR) { + varPtr->flags |= TCL_LEAVE_ERR_MSG; + Tcl_AddErrorInfo(interp, "array changed during iteration"); + result = done; + } + goto arrayfordone; + } + if (Tcl_ObjSetVar2(interp, keyVarObj, NULL, keyObj, TCL_LEAVE_ERR_MSG) == NULL) { + result = TCL_ERROR; + goto arrayfordone; + } + if (valueObj != NULL) { + if (Tcl_ObjSetVar2(interp, valueVarObj, NULL, valueObj, TCL_LEAVE_ERR_MSG) == NULL) { + result = TCL_ERROR; + goto arrayfordone; + } + } + + /* + * Run the script. + */ + + TclNRAddCallback(interp, ArrayForLoopCallback, searchPtr, keyVarObj, + valueVarObj, scriptObj); + return TclNREvalObjEx(interp, scriptObj, 0, iPtr->cmdFramePtr, 3); + + /* + * For unwinding everything once the iterating is done. + */ + + arrayfordone: + /* if the search was terminated by an array change, the + * VAR_SEARCH_ACTIVE flag will no longer be set + */ + if (done != TCL_ERROR) { + ArrayDoneSearch (iPtr, varPtr, searchPtr); + ckfree(searchPtr); + } + + TclDecrRefCount(keyVarObj); + TclDecrRefCount(valueVarObj); + TclDecrRefCount(scriptObj); + return result; +} + +/* + *---------------------------------------------------------------------- + * * ArrayStartSearchCmd -- * * This object-based function is invoked to process the "array @@ -3197,6 +3515,50 @@ ArrayStartSearchCmd( /* *---------------------------------------------------------------------- * + * ArrayDoneSearch -- + * + * Removes the search from the hash of active searches. + * + *---------------------------------------------------------------------- + */ +static void +ArrayDoneSearch ( + Interp *iPtr, + Var *varPtr, + ArraySearch *searchPtr) +{ + Tcl_HashEntry *hPtr; + ArraySearch *prevPtr; + + /* + * Unhook the search from the list of searches associated with the + * variable. + */ + + hPtr = Tcl_FindHashEntry(&iPtr->varSearches, varPtr); + if (hPtr == NULL) { + return; + } + if (searchPtr == Tcl_GetHashValue(hPtr)) { + if (searchPtr->nextPtr) { + Tcl_SetHashValue(hPtr, searchPtr->nextPtr); + } else { + varPtr->flags &= ~VAR_SEARCH_ACTIVE; + Tcl_DeleteHashEntry(hPtr); + } + } else { + for (prevPtr=Tcl_GetHashValue(hPtr) ;; prevPtr=prevPtr->nextPtr) { + if (prevPtr->nextPtr == searchPtr) { + prevPtr->nextPtr = searchPtr->nextPtr; + break; + } + } + } +} + +/* + *---------------------------------------------------------------------- + * * ArrayAnyMoreCmd -- * * This object-based function is invoked to process the "array anymore" @@ -3437,9 +3799,8 @@ ArrayDoneSearchCmd( { Interp *iPtr = (Interp *) interp; Var *varPtr, *arrayPtr; - Tcl_HashEntry *hPtr; Tcl_Obj *varNameObj, *searchObj; - ArraySearch *searchPtr, *prevPtr; + ArraySearch *searchPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "arrayName searchId"); @@ -3493,27 +3854,7 @@ ArrayDoneSearchCmd( return TCL_ERROR; } - /* - * Unhook the search from the list of searches associated with the - * variable. - */ - - hPtr = Tcl_FindHashEntry(&iPtr->varSearches, varPtr); - if (searchPtr == Tcl_GetHashValue(hPtr)) { - if (searchPtr->nextPtr) { - Tcl_SetHashValue(hPtr, searchPtr->nextPtr); - } else { - varPtr->flags &= ~VAR_SEARCH_ACTIVE; - Tcl_DeleteHashEntry(hPtr); - } - } else { - for (prevPtr=Tcl_GetHashValue(hPtr) ;; prevPtr=prevPtr->nextPtr) { - if (prevPtr->nextPtr == searchPtr) { - prevPtr->nextPtr = searchPtr->nextPtr; - break; - } - } - } + ArrayDoneSearch (iPtr, varPtr, searchPtr); ckfree(searchPtr); return TCL_OK; } @@ -4372,6 +4713,7 @@ TclInitArrayCmd( {"anymore", ArrayAnyMoreCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0}, {"donesearch", ArrayDoneSearchCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0}, {"exists", ArrayExistsCmd, TclCompileArrayExistsCmd, NULL, NULL, 0}, + {"for", NULL, TclCompileBasic3ArgCmd, ArrayForNRCmd, NULL, 0}, {"get", ArrayGetCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0}, {"names", ArrayNamesCmd, TclCompileBasic1To3ArgCmd, NULL, NULL, 0}, {"nextelement", ArrayNextElementCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0}, diff --git a/tests/set-old.test b/tests/set-old.test index 6138ed8..3b4184c 100644 --- a/tests/set-old.test +++ b/tests/set-old.test @@ -340,7 +340,7 @@ test set-old-8.6 {array command} { catch {unset a} set a(22) 3 list [catch {array gorp a} msg] $msg -} {1 {unknown or ambiguous subcommand "gorp": must be anymore, donesearch, exists, get, names, nextelement, set, size, startsearch, statistics, or unset}} +} {1 {unknown or ambiguous subcommand "gorp": must be anymore, donesearch, exists, for, get, names, nextelement, set, size, startsearch, statistics, or unset}} test set-old-8.7 {array command, anymore option} { catch {unset a} list [catch {array anymore a x} msg] $msg @@ -652,7 +652,7 @@ test set-old-8.52 {array command, array names -regexp on regexp pattern} { set a(11) 1 list [catch {lsort [array names a -regexp ^1]} msg] $msg } {0 {1*2 11 12}} -test set-old-8.52.1 {array command, array names -regexp, backrefs} { +?test set-old-8.52.1 {array command, array names -regexp, backrefs} { catch {unset a} set a(1*2) 1 set a(12) 1 @@ -940,7 +940,7 @@ catch {rename foo {}} # cleanup ::tcltest::cleanupTests -return +return # Local Variables: # mode: tcl diff --git a/tests/var.test b/tests/var.test index a9d93ac..630202a 100644 --- a/tests/var.test +++ b/tests/var.test @@ -53,7 +53,7 @@ catch {unset arr} test var-1.1 {TclLookupVar, Array handling} -setup { catch {unset a} } -body { - set x "incr" ;# force no compilation and runtime call to Tcl_IncrCmd + set x "incr" ;# force no compilation and runtime call to Tcl_IncrCmd set i 10 set arr(foo) 37 list [$x i] $i [$x arr(foo)] $arr(foo) @@ -234,7 +234,7 @@ test var-3.3 {MakeUpvar, my var has TCL_GLOBAL_ONLY specified} -setup { set a 123321 proc p {} { # create global xx linked to global a - testupvar 1 a {} xx global + testupvar 1 a {} xx global } list [p] $xx [set xx 789] $a } -result {{} 123321 789 789} @@ -246,7 +246,7 @@ test var-3.4 {MakeUpvar, my var has TCL_NAMESPACE_ONLY specified} -setup { catch {unset ::test_ns_var::vv} proc p {} { # create namespace var vv linked to global a - testupvar 1 a {} vv namespace + testupvar 1 a {} vv namespace } p } @@ -548,11 +548,11 @@ test var-7.14 {Tcl_VariableObjCmd, array element parameter} -body { namespace eval test_ns_var { variable arrayvar(1) } } -returnCodes error -result "can't define \"arrayvar(1)\": name refers to an element in an array" test var-7.15 {Tcl_VariableObjCmd, array element parameter} -body { - namespace eval test_ns_var { + namespace eval test_ns_var { variable arrayvar set arrayvar(1) x variable arrayvar(1) y - } + } } -returnCodes error -result "can't define \"arrayvar(1)\": name refers to an element in an array" test var-7.16 {Tcl_VariableObjCmd, no args (TIP 323)} { variable @@ -790,7 +790,7 @@ test var-15.1 {segfault in [unset], [Bug 735335]} { set var $name } # - # Note that the variable name has to be + # Note that the variable name has to be # unused previously for the segfault to # be triggered. # @@ -997,7 +997,153 @@ test var-22.1 {leak in localVarName intrep: Bug 80304238ac} -setup { rename getbytes {} rename doit {} } -result 0 - + +unset -nocomplain a k v +test var-23.1 {array command, for loop, too many args} -returnCodes error -body { + array for {k v} c d e {} +} -result {wrong # args: should be "array for {key value} arrayName script"} +test var-23.2 {array command, for loop, not enough args} -returnCodes error -body { + array for {k v} {} +} -result {wrong # args: should be "array for {key value} arrayName script"} +test var-23.3 {array command, for loop, too many list args} -setup { + unset -nocomplain a +} -returnCodes error -body { + array for {k v w} a {} +} -result {must have two variable names} +test var-23.4 {array command, for loop, not enough list args} -setup { + unset -nocomplain a +} -returnCodes error -body { + array for {k} a {} +} -result {must have two variable names} +test var-23.5 {array command, for loop, no array} -setup { + unset -nocomplain a +} -returnCodes error -body { + array for {k v} a {} +} -result {"a" isn't an array} +test var-23.6 {array command, for loop, array doesn't exist yet but has compiler-allocated procedure slot} -setup { + catch {rename p ""} +} -returnCodes error -body { + apply {{x} { + if {$x==1} { + return [array for {k v} a {}] + } + set a(x) 123 + }} 1 +} -result {"a" isn't an array} +test var-23.7 {array enumeration} -setup { + unset -nocomplain a + set reslist [list] +} -body { + array set a {a 1 b 2 c 3} + array for {k v} a { + lappend reslist $k $v + } + lsort -stride 2 -index 0 $reslist +} -cleanup { + unset -nocomplain a + unset -nocomplain reslist +} -result {a 1 b 2 c 3} +test var-23.9 {array enumeration, nested} -setup { + unset -nocomplain a + set reslist [list] +} -body { + array set a {a 1 b 2 c 3} + array for {k1 v1} a { + lappend reslist $k1 $v1 + set r2 {} + array for {k2 v2} a { + lappend r2 $k2 $v2 + } + lappend reslist [lsort -stride 2 -index 0 $r2] + } + # there is no guarantee in which order the array contents will be + # returned. + lsort -stride 3 -index 0 $reslist +} -cleanup { + unset -nocomplain a + unset -nocomplain reslist +} -result {a 1 {a 1 b 2 c 3} b 2 {a 1 b 2 c 3} c 3 {a 1 b 2 c 3}} +test var-23.10 {array enumeration, delete key} -match glob -setup { + unset -nocomplain a + set reslist [list] +} -body { + set retval {} + try { + array set a {a 1 b 2 c 3 d 4} + array for {k v} a { + lappend reslist $k $v + if { $k eq "a" } { + unset a(c) + } + } + lsort -stride 2 -index 0 $reslist + } on error {err res} { + set retval [dict get $res -errorinfo] + } + set retval +} -cleanup { + unset -nocomplain a + unset -nocomplain reslist + unset -nocomplain retval +} -result {array changed during iteration*} +test var-23.11 {array enumeration, insert key} -match glob -setup { + unset -nocomplain a + set reslist [list] +} -body { + set retval {} + try { + array set a {a 1 b 2 c 3 d 4} + array for {k v} a { + lappend reslist $k $v + if { $k eq "a" } { + set a(e) 5 + } + } + lsort -stride 2 -index 0 $reslist + } on error {err res} { + set retval [dict get $res -errorinfo] + } +} -cleanup { + unset -nocomplain a + unset -nocomplain reslist +} -result {array changed during iteration*} +test var-23.12 {array enumeration, change value} -setup { + unset -nocomplain a + set reslist [list] +} -body { + array set a {a 1 b 2 c 3} + array for {k v} a { + lappend reslist $k $v + if { $k eq "a" } { + set a(c) 9 + } + } + lsort -stride 2 -index 0 $reslist +} -cleanup { + unset -nocomplain a + unset -nocomplain reslist +} -result {a 1 b 2 c 9} +test var-23.13 {array enumeration, number of traces} -setup { + set ::countarrayfor 0 + proc ::tracearrayfor { args } { + incr ::countarrayfor + } + unset -nocomplain ::a + set reslist [list] +} -body { + array set ::a {a 1 b 2 c 3} + foreach {k} [array names a] { + trace add variable ::a($k) read ::tracearrayfor + } + array for {k v} ::a { + lappend reslist $k $v + } + set ::countarrayfor +} -cleanup { + unset -nocomplain ::countarrayfor + unset -nocomplain ::a + unset -nocomplain reslist +} -result 3 catch {namespace delete ns} catch {unset arr} -- cgit v0.12 From 1552384787fef03116569d8281bc0a69a02d6e3f Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 24 Oct 2017 23:16:23 +0000 Subject: Extend Tcl_CreateEncoding() to be able to create an encoding without registering it when it has no name. Then use this to create "identity" encoding without naming it "identity". Then no one can look it up by that name. --- generic/tclEncoding.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index e328340..f43c0e1 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -563,7 +563,7 @@ TclInitEncodingSubsystem(void) * formed UTF-8 into a properly formed stream. */ - type.encodingName = "identity"; + type.encodingName = NULL; type.toUtfProc = BinaryProc; type.fromUtfProc = BinaryProc; type.freeProc = NULL; @@ -851,7 +851,9 @@ FreeEncoding( if (encodingPtr->hPtr != NULL) { Tcl_DeleteHashEntry(encodingPtr->hPtr); } - ckfree(encodingPtr->name); + if (encodingPtr->name) { + ckfree(encodingPtr->name); + } ckfree(encodingPtr); } } @@ -1040,9 +1042,24 @@ Tcl_CreateEncoding( const Tcl_EncodingType *typePtr) /* The encoding type. */ { + Encoding *encodingPtr = ckalloc(sizeof(Encoding)); + encodingPtr->name = NULL; + encodingPtr->toUtfProc = typePtr->toUtfProc; + encodingPtr->fromUtfProc = typePtr->fromUtfProc; + encodingPtr->freeProc = typePtr->freeProc; + encodingPtr->nullSize = typePtr->nullSize; + encodingPtr->clientData = typePtr->clientData; + if (typePtr->nullSize == 1) { + encodingPtr->lengthProc = (LengthProc *) strlen; + } else { + encodingPtr->lengthProc = (LengthProc *) unilen; + } + encodingPtr->refCount = 1; + encodingPtr->hPtr = NULL; + + if (typePtr->encodingName) { Tcl_HashEntry *hPtr; int isNew; - Encoding *encodingPtr; char *name; Tcl_MutexLock(&encodingMutex); @@ -1058,25 +1075,12 @@ Tcl_CreateEncoding( } name = ckalloc(strlen(typePtr->encodingName) + 1); - - encodingPtr = ckalloc(sizeof(Encoding)); encodingPtr->name = strcpy(name, typePtr->encodingName); - encodingPtr->toUtfProc = typePtr->toUtfProc; - encodingPtr->fromUtfProc = typePtr->fromUtfProc; - encodingPtr->freeProc = typePtr->freeProc; - encodingPtr->nullSize = typePtr->nullSize; - encodingPtr->clientData = typePtr->clientData; - if (typePtr->nullSize == 1) { - encodingPtr->lengthProc = (LengthProc *) strlen; - } else { - encodingPtr->lengthProc = (LengthProc *) unilen; - } - encodingPtr->refCount = 1; encodingPtr->hPtr = hPtr; Tcl_SetHashValue(hPtr, encodingPtr); Tcl_MutexUnlock(&encodingMutex); - + } return (Tcl_Encoding) encodingPtr; } -- cgit v0.12 From 40d9b81e23c10ebc3abfe4ac12af411d01318fb9 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 24 Oct 2017 23:30:35 +0000 Subject: Stop using "identity" as an encoding to test basic functionng of the [encoding] command. "iso8859-1" is another one always available. --- tests/cmdAH.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cmdAH.test b/tests/cmdAH.test index 3c58c1b..03f4d66 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -188,7 +188,7 @@ test cmdAH-4.5 {Tcl_EncodingObjCmd} -setup { test cmdAH-4.6 {Tcl_EncodingObjCmd} -setup { set system [encoding system] } -body { - encoding system identity + encoding system iso8859-1 encoding convertto jis0208 \u4e4e } -cleanup { encoding system $system @@ -210,7 +210,7 @@ test cmdAH-4.9 {Tcl_EncodingObjCmd} -setup { test cmdAH-4.10 {Tcl_EncodingObjCmd} -setup { set system [encoding system] } -body { - encoding system identity + encoding system iso8859-1 encoding convertfrom jis0208 8C } -cleanup { encoding system $system @@ -224,11 +224,11 @@ test cmdAH-4.12 {Tcl_EncodingObjCmd} -returnCodes error -body { test cmdAH-4.13 {Tcl_EncodingObjCmd} -setup { set system [encoding system] } -body { - encoding system identity + encoding system iso8859-1 encoding system } -cleanup { encoding system $system -} -result identity +} -result iso8859-1 test cmdAH-5.1 {Tcl_FileObjCmd} -returnCodes error -body { file -- cgit v0.12 From eb2cfa3e6f2fc11362ae54a2004ade43a57c86de Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 25 Oct 2017 02:23:12 +0000 Subject: Repair Tcl_CreateEncoding(); Modernize [testencoding]; Update most tests toying with identity encoding. --- generic/tclEncoding.c | 4 ++-- generic/tclTest.c | 9 ++++++--- tests/encoding.test | 12 ++++-------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index f43c0e1..1f48a1c 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -1070,8 +1070,8 @@ Tcl_CreateEncoding( * reference goes away. */ - encodingPtr = Tcl_GetHashValue(hPtr); - encodingPtr->hPtr = NULL; + Encoding *replaceMe = Tcl_GetHashValue(hPtr); + replaceMe->hPtr = NULL; } name = ckalloc(strlen(typePtr->encodingName) + 1); diff --git a/generic/tclTest.c b/generic/tclTest.c index ebd90ae..c455d42 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -1985,9 +1985,12 @@ TestencodingObjCmd( if (objc != 3) { return TCL_ERROR; } - encoding = Tcl_GetEncoding(NULL, Tcl_GetString(objv[2])); - Tcl_FreeEncoding(encoding); - Tcl_FreeEncoding(encoding); + if (TCL_OK != Tcl_GetEncodingFromObj(interp, objv[2], &encoding)) { + return TCL_ERROR; + } + Tcl_FreeEncoding(encoding); /* Free returned reference */ + Tcl_FreeEncoding(encoding); /* Free to match CREATE */ + TclFreeIntRep(objv[2]); /* Free the cached ref */ break; } return TCL_OK; diff --git a/tests/encoding.test b/tests/encoding.test index be1f4d5..0ee08b6 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -75,11 +75,11 @@ test encoding-2.2 {Tcl_FreeEncoding: refcount != 0} -setup { encoding system shiftjis ;# incr ref count encoding dirs [list [pwd]] set x [encoding convertto shiftjis \u4e4e] ;# old one found - encoding system identity + encoding system iso8859-1 llength shiftjis ;# Shimmer away any cache of Tcl_Encoding lappend x [catch {encoding convertto shiftjis \u4e4e} msg] $msg } -cleanup { - encoding system identity + encoding system iso8859-1 encoding dirs $path encoding system $system } -result "\u008c\u00c1 1 {unknown encoding \"shiftjis\"}" @@ -136,7 +136,7 @@ test encoding-5.1 {Tcl_SetSystemEncoding} -setup { encoding system jis0208 encoding convertto \u4e4e } -cleanup { - encoding system identity + encoding system iso8859-1 encoding system $old } -result {8C} test encoding-5.2 {Tcl_SetSystemEncoding: test ref count} { @@ -259,7 +259,7 @@ test encoding-11.5.1 {LoadEncodingFile: escape file} { test encoding-11.6 {LoadEncodingFile: invalid file} -constraints {testencoding} -setup { set system [encoding system] set path [encoding dirs] - encoding system identity + encoding system iso8859-1 } -body { cd [temporaryDirectory] encoding dirs [file join tmp encoding] @@ -308,10 +308,6 @@ test encoding-13.1 {LoadEscapeTable} { viewable [set x [encoding convertto iso2022 ab\u4e4e\u68d9g]] } [viewable "ab\x1b\$B8C\x1b\$\(DD%\x1b(Bg"] -test encoding-14.1 {BinaryProc} { - encoding convertto identity \x12\x34\x56\xff\x69 -} "\x12\x34\x56\xc3\xbf\x69" - test encoding-15.1 {UtfToUtfProc} { encoding convertto utf-8 \xa3 } "\xc2\xa3" -- cgit v0.12 From 30c6827ee17807b25e79676f049f66877bf3d4ff Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 25 Oct 2017 02:54:24 +0000 Subject: Convert remaining tests to use [testbytestring]. encoding-15.3 still needs replacement for [encoding convertto identity]. That is, some testing command to expose objPtr->bytes. --- tests/encoding.test | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/encoding.test b/tests/encoding.test index 0ee08b6..11f08ef 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -34,6 +34,7 @@ proc runtests {} { # Some tests require the testencoding command testConstraint testencoding [llength [info commands testencoding]] +testConstraint testbytestring [llength [info commands testbytestring]] testConstraint fullutf [expr {[format %c 0x010000] != "\ufffd"}] testConstraint exec [llength [info commands exec]] testConstraint testgetencpath [llength [info commands testgetencpath]] @@ -311,15 +312,14 @@ test encoding-13.1 {LoadEscapeTable} { test encoding-15.1 {UtfToUtfProc} { encoding convertto utf-8 \xa3 } "\xc2\xa3" -test encoding-15.2 {UtfToUtfProc null character output} { +test encoding-15.2 {UtfToUtfProc null character output} testbytestring { set x \u0000 - set y [encoding convertto utf-8 \u0000] - set y [encoding convertfrom identity $y] + set y [testbytestring [encoding convertto utf-8 \u0000]] binary scan $y H* z list [string bytelength $x] [string bytelength $y] $z } {2 1 00} -test encoding-15.3 {UtfToUtfProc null character input} { - set x [encoding convertfrom identity \x00] +test encoding-15.3 {UtfToUtfProc null character input} testbytestring { + set x [testbytestring \x00] set y [encoding convertfrom utf-8 $x] binary scan [encoding convertto identity $y] H* z list [string bytelength $x] [string bytelength $y] $z -- cgit v0.12 From ff1c34897080fdd52c75ac01a0e020d0e8e3c557 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Wed, 25 Oct 2017 02:59:46 +0000 Subject: Updated comments. --- win/makefile.vc | 134 +++++++++----------------------------------------------- 1 file changed, 20 insertions(+), 114 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 2884aa3..95161a8 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -1,6 +1,6 @@ #------------------------------------------------------------- -*- makefile -*- # -# Microsoft Visual C++ makefile for use with nmake +# Microsoft Visual C++ makefile for building Tcl with nmake # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -13,25 +13,13 @@ # Copyright (c) 2017 Ashok P. Nadkarni #------------------------------------------------------------------------------ -#------------------------------------------------------------------------------ -# HOW TO USE this makefile: -# -# 1) It is necessary to have the appropriate Visual C++ environment -# set up before invoking nmake. The steps required depend on which -# version of Visual Studio and/or the Windows SDK you are building -# against and are not described here. With Visual Studio, the simplest -# is to start a command shell using one of the installed short cuts. -# An alternative is to run vcvars32.bat, vcvars64.bat, vcvarsamd64_x86.bat -# etc. depending on the host and target architectures. If compiling -# with the Windows SDK instead, run (again depending on the SDK version) -# the setenv.bat or equivalent batch file from the command prompt. +# General usage: +# nmake [-nologo] -f makefile.vc [TARGET|MACRODEF [TARGET|MACRODEF] [...]] # -# NOTE: For older (Visual C++ 6 or the 2003 SDK), to use the Platform -# SDK (not expressly needed), run setenv.bat after -# vcvars32.bat according to the instructions for it. This can also -# turn on the 64-bit compiler, if your SDK has it. +# For MACRODEF, see TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) +# or examine Steps 6-8 in rules.vc. # -# 2) Targets are: +# Possible values of TARGET are: # release -- Builds the core, the shell and the dlls. (default) # dlls -- Just builds the windows extensions # shell -- Just builds the shell and the core. @@ -52,111 +40,29 @@ # have installed the HTML Help Compiler package from Microsoft # to produce the .chm file. # -# 3) Macros usable on the commandline: -# INSTALLDIR= -# Sets where to install Tcl from the built binaries. -# C:\Progra~1\Tcl is assumed when not specified. -# -# OPTS=loimpact,msvcrt,pdbs,profile,static,staticpkg,symbols,thrdalloc,tclalloc,unchecked,none -# Sets special options for the core. The default is for none. -# Any combination of the above may be used (comma separated). -# 'none' will over-ride everything to nothing. -# -# loimpact = Adds a flag for how NT treats the heap to keep memory -# in use, low. Said to impact alloc performance. -# msvcrt = Affects the static option only to switch it from -# using libcmt(d) as the C runtime [by default] to -# msvcrt(d). This is useful for static embedding -# support. -# pdbs = Build detached symbols for release builds. -# profile = Adds profiling hooks. Map file is assumed. -# static = Builds a static library of the core instead of a -# dll. The static library will contain the dde and reg -# extensions. External applications who want to use -# this, need to link with the stub library as well as -# the static Tcl library.The shell will be static (and -# large), as well. -# staticpkg = Affects the static option only to switch -# tclshXX.exe to have the dde and reg extension linked -# inside it. -# symbols = Debug build. Links to the debug C runtime, disables -# optimizations and creates pdb symbols files. -# thrdalloc = Use the thread allocator (shared global free pool) -# This is the default on threaded builds. -# tclalloc = Use the old non-thread allocator -# unchecked= Allows a symbols build to not use the debug -# enabled runtime (msvcrt.dll not msvcrtd.dll -# or libcmt.lib not libcmtd.lib). -# -# STATS=compdbg,memdbg,none -# Sets optional memory and bytecode compiler debugging code added -# to the core. The default is for none. Any combination of the -# above may be used (comma separated). 'none' will over-ride -# everything to nothing. -# -# compdbg = Enables byte compilation logging. -# memdbg = Enables the debugging memory allocator. -# -# CHECKS=64bit,fullwarn,nodep,none -# Sets special macros for checking compatibility. -# -# 64bit = Enable 64bit portability warnings (if available) -# fullwarn = Builds with full compiler and link warnings enabled. -# Very verbose. -# nodep = Turns off compatibility macros to ensure the core -# isn't being built with deprecated functions. -# -# MACHINE=(AMD64|IX86) -# Set the machine type used for the compiler, linker, and -# resource compiler. This hook is needed to tell the tools -# when alternate platforms are requested. THIS SHOULD NORMALLY -# NOT BE SET AS IT IS AUTOMATICALLY DETECTED BASED ON THE -# COMPILER IN USE. -# -# TMP_DIR= -# OUT_DIR= -# Hooks to allow the intermediate and output directories to be -# changed. $(OUT_DIR) is assumed to be -# .\(Release|Debug) based on if symbols are requested. -# $(TMP_DIR) will be $(OUT_DIR)\ by default. # -# TESTPAT= -# Reads the tests requested to be run from this file. +# The steps to setup a Visual C++ environment depend on which +# version of Visual Studio and/or the Windows SDK you are building +# against and are not described here. The simplest method is generally +# to start a command shell using one of the short cuts installed by +# Visual Studio/Windows SDK for the appropriate target architecture. # -# CFG_ENCODING=encoding -# name of encoding for configuration information. Defaults -# to cp1252 +# NOTE: For older (Visual C++ 6 or the 2003 SDK), to use the Platform +# SDK (not expressly needed), run setenv.bat after +# vcvars32.bat according to the instructions for it. This can also +# turn on the 64-bit compiler, if your SDK has it. # -# 4) Examples: -# -# Basic syntax of calling nmake looks like this: -# nmake [-nologo] -f makefile.vc [target|macrodef [target|macrodef] [...]] -# -# Standard (no frills) +# Examples: # c:\tcl_src\win\>nmake -f makefile.vc release +# c:\tcl_src\win\>nmake -f makefile.vc test # c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl -# -# With symbols in release builds # c:\tcl_src\win\>nmake -f makefile.vc release OPTS=pdbs -# -# Debug build # c:\tcl_src\win\>nmake -f makefile.vc release OPTS=symbols # -#------------------------------------------------------------------------------ -#============================================================================== -############################################################################### - -# //==================================================================\\ -# >>[ -> Do not modify below this line. <- ]<< -# >>[ Please, use the commandline macros to modify how Tcl is built. ]<< -# >>[ If you need more features, send us a patch for more macros. ]<< -# \\==================================================================// - - -############################################################################### -#============================================================================== -#------------------------------------------------------------------------------ +# NOTE: +# Before modifying this file, check whether the modification is applicable +# to building extensions as well and if so, modify rules.vc instead. # The PROJECT macro is used by rules.vc for generating appropriate # macros and rules. -- cgit v0.12 From d8cae66217adcfb4920030071e54e37b5a88a1c4 Mon Sep 17 00:00:00 2001 From: fvogel Date: Wed, 25 Oct 2017 17:31:09 +0000 Subject: Fix typo in set-old.test --- tests/set-old.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/set-old.test b/tests/set-old.test index 3b4184c..b2e7aa6 100644 --- a/tests/set-old.test +++ b/tests/set-old.test @@ -652,7 +652,7 @@ test set-old-8.52 {array command, array names -regexp on regexp pattern} { set a(11) 1 list [catch {lsort [array names a -regexp ^1]} msg] $msg } {0 {1*2 11 12}} -?test set-old-8.52.1 {array command, array names -regexp, backrefs} { +test set-old-8.52.1 {array command, array names -regexp, backrefs} { catch {unset a} set a(1*2) 1 set a(12) 1 -- cgit v0.12 From 053a74e0facac37a830c2c317c90d11bc13e5264 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 26 Oct 2017 02:08:27 +0000 Subject: Create new testing command [teststringbytes] to probe the things that otherwise require [encoding convertto identity]. adapt encoding-15.3 to use. --- generic/tclTest.c | 38 ++++++++++++++++++++++++++++++++++++++ tests/encoding.test | 20 +++++++++----------- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index c455d42..834cd79 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -227,6 +227,9 @@ static int TestasyncCmd(ClientData dummy, static int TestbytestringObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int TeststringbytesObjCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); static int TestcmdinfoCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); static int TestcmdtokenCmd(ClientData dummy, @@ -581,6 +584,7 @@ Tcltest_Init( Tcl_CreateCommand(interp, "noop", NoopCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "noop", NoopObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testbytestring", TestbytestringObjCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "teststringbytes", TeststringbytesObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testwrongnumargs", TestWrongNumArgsObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testfilesystem", TestFilesystemObjCmd, @@ -5049,6 +5053,40 @@ NoopObjCmd( /* *---------------------------------------------------------------------- * + * TeststringbytesObjCmd -- + * Returns bytearray value of the bytes in argument string rep + * + * Results: + * Returns the TCL_OK result code. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static int +TeststringbytesObjCmd( + ClientData unused, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* The argument objects. */ +{ + int n; + const unsigned char *p; + + if (objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "value"); + return TCL_ERROR; + } + p = (const unsigned char *)Tcl_GetStringFromObj(objv[1], &n); + Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(p, n)); + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * * TestbytestringObjCmd -- * * This object-based procedure constructs a string which can diff --git a/tests/encoding.test b/tests/encoding.test index 11f08ef..e447c20 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -35,6 +35,7 @@ proc runtests {} { # Some tests require the testencoding command testConstraint testencoding [llength [info commands testencoding]] testConstraint testbytestring [llength [info commands testbytestring]] +testConstraint teststringbytes [llength [info commands teststringbytes]] testConstraint fullutf [expr {[format %c 0x010000] != "\ufffd"}] testConstraint exec [llength [info commands exec]] testConstraint testgetencpath [llength [info commands testgetencpath]] @@ -313,17 +314,14 @@ test encoding-15.1 {UtfToUtfProc} { encoding convertto utf-8 \xa3 } "\xc2\xa3" test encoding-15.2 {UtfToUtfProc null character output} testbytestring { - set x \u0000 - set y [testbytestring [encoding convertto utf-8 \u0000]] - binary scan $y H* z - list [string bytelength $x] [string bytelength $y] $z -} {2 1 00} -test encoding-15.3 {UtfToUtfProc null character input} testbytestring { - set x [testbytestring \x00] - set y [encoding convertfrom utf-8 $x] - binary scan [encoding convertto identity $y] H* z - list [string bytelength $x] [string bytelength $y] $z -} {1 2 c080} + binary scan [testbytestring [encoding convertto utf-8 \u0000]] H* z + set z +} 00 +test encoding-15.3 {UtfToUtfProc null character input} teststringbytes { + set y [encoding convertfrom utf-8 [encoding convertto utf-8 \u0000]] + binary scan [teststringbytes $y] H* z + set z +} c080 test encoding-16.1 {UnicodeToUtfProc} { set val [encoding convertfrom unicode NN] -- cgit v0.12 From c324bb3effc60b384c19e243194f0bd3a4a61b35 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Thu, 26 Oct 2017 15:07:16 +0000 Subject: Reworked build command macros (MAKEBINCMD, CCPKGCMD etc.) and purged old comments. --- win/makefile.vc | 40 ++++++++++++++--------- win/rules-ext.vc | 5 +++ win/rules.vc | 96 ++++++++++++++++++++++++++++++++++++++------------------ win/targets.vc | 19 ++++++++--- 4 files changed, 110 insertions(+), 50 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 95161a8..7759fc3 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -17,7 +17,7 @@ # nmake [-nologo] -f makefile.vc [TARGET|MACRODEF [TARGET|MACRODEF] [...]] # # For MACRODEF, see TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) -# or examine Steps 6-8 in rules.vc. +# or examine Sections 6-8 in rules.vc. # # Possible values of TARGET are: # release -- Builds the core, the shell and the dlls. (default) @@ -40,7 +40,6 @@ # have installed the HTML Help Compiler package from Microsoft # to produce the .chm file. # -# # The steps to setup a Visual C++ environment depend on which # version of Visual Studio and/or the Windows SDK you are building # against and are not described here. The simplest method is generally @@ -397,42 +396,53 @@ runshell: setup $(TCLSH) dlls set TCL_LIBRARY=$(ROOT:\=/)/library $(DEBUGGER) $(TCLSH) $(SCRIPT) -!if !$(STATIC_BUILD) -$(TCLIMPLIB): $(TCLLIB) -!endif +!if $(STATIC_BUILD) + +$(TCLLIB): $(TCLOBJS) + $(LIBCMD) @<< +$** +<< + +!else $(TCLLIB): $(TCLOBJS) - $(MAKEBINCMD) @<< + $(DLLCMD) @<< $** << $(_VC_MANIFEST_EMBED_DLL) +$(TCLIMPLIB): $(TCLLIB) + +!endif # $(STATIC_BUILD) + $(TCLSTUBLIB): $(TCLSTUBOBJS) - $(MAKELIBCMD) -nodefaultlib $(TCLSTUBOBJS) + $(LIBCMD) -nodefaultlib $(TCLSTUBOBJS) $(TCLSH): $(TCLSHOBJS) $(TCLSTUBLIB) $(TCLIMPLIB) - $(MAKECONCMD) -stack:2300000 $** + $(CONEXECMD) -stack:2300000 $** $(_VC_MANIFEST_EMBED_EXE) $(TCLTEST): $(TCLTESTOBJS) $(TCLSTUBLIB) $(TCLIMPLIB) - $(MAKECONCMD) -stack:2300000 $** + $(CONEXECMD) -stack:2300000 $** $(_VC_MANIFEST_EMBED_EXE) !if $(STATIC_BUILD) $(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj + $(LIBCMD) $** !else $(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj $(TCLSTUBLIB) -!endif - $(MAKEBINCMD) $** + $(DLLCMD) $** $(_VC_MANIFEST_EMBED_DLL) +!endif !if $(STATIC_BUILD) $(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj + $(LIBCMD) $** !else $(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj $(TCLSTUBLIB) -!endif - $(MAKEBINCMD) $** + $(DLLCMD) $** $(_VC_MANIFEST_EMBED_DLL) +!endif pkgs: @for /d %d in ($(PKGSDIR)\*) do \ @@ -467,8 +477,8 @@ clean-pkgs: ) $(CAT32): $(WINDIR)\cat.c - $(cc32) $(cflags) $(crt) -DCONSOLE -Fo$(TMP_DIR)\ $? - $(MAKECONCMD) -stack:16384 $(TMP_DIR)\cat.obj + $(cc32) $(cflags) $(crt) -D_CRT_NONSTDC_NO_DEPRECATE -DCONSOLE -Fo$(TMP_DIR)\ $? + $(CONEXECMD) -stack:16384 $(TMP_DIR)\cat.obj $(_VC_MANIFEST_EMBED_EXE) #--------------------------------------------------------------------- diff --git a/win/rules-ext.vc b/win/rules-ext.vc index 97c11b4..e0a363c 100644 --- a/win/rules-ext.vc +++ b/win/rules-ext.vc @@ -1,5 +1,10 @@ +#------------------------------------------------------------- -*- makefile -*- +# rules-ext.vc -- +# +# Part of the nmake based build system for Tcl and its extensions. # This file should only be included in makefiles for Tcl extensions, # NOT in the makefile for Tcl itself. +# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for docs. !ifndef _RULES_EXT_VC diff --git a/win/rules.vc b/win/rules.vc index 6bdfa8a..5e98d77 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1,8 +1,13 @@ #------------------------------------------------------------- -*- makefile -*- # rules.vc -- # -# Microsoft Visual C++ makefile include for decoding the commandline -# macros. This file does not need editing to build Tcl. +# Part of the nmake based build system for Tcl and its extensions. +# This file does all the hard work in terms of parsing build options, +# compiler switches, defining common targets and macros. The Tcl makefile +# directly includes this. Extensions include it via "rules-ext.vc". +# +# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for +# detailed documentation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -16,6 +21,8 @@ _RULES_VC = 1 # The following macros define the version of the rules.vc nmake build system +# For modifications that are not backward-compatible, you *must* change +# the major version. RULES_VERSION_MAJOR = 1 RULES_VERSION_MINOR = 0 @@ -32,8 +39,21 @@ DOING_TCL = 1 DOING_TK = 1 !endif -!ifndef PROJECT_REQUIRES_TK -PROJECT_REQUIRES_TK = 0 +!ifndef NEED_TK +# Backwards compatibility +!ifdef PROJECT_REQUIRES_TK +NEED_TK = $(PROJECT_REQUIRES_TK) +!else +NEED_TK = 0 +!endif +!endif + +!ifndef NEED_TCL_SOURCE +NEED_TCL_SOURCE = 0 +!endif + +!ifndef NEED_TK_SOURCE +NEED_TK_SOURCE = 0 !endif ################################################################ @@ -266,7 +286,7 @@ Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and defa !endif # Now do the same to locate Tk headers and libs if project requires Tk -!if $(PROJECT_REQUIRES_TK) +!if $(NEED_TK) !ifdef TKDIR @@ -301,7 +321,24 @@ Failed to find tk.h. The TKDIR macro is set incorrectly or is not set and defaul !error $(MSG) !endif -!endif # PROJECT_REQUIRES_TK +!endif # NEED_TK + +!if $(NEED_TCL_SOURCE) && $(TCLINSTALL) +MSG = ^ +*** Warning: This extension requires the source distribution of Tcl.^ +*** Please set the TCLDIR macro to point to the Tcl sources. +!error $(MSG) +!endif + +!if $(NEED_TK_SOURCE) +!if $(TKINSTALL) +MSG = ^ +*** Warning: This extension requires the source distribution of Tk.^ +*** Please set the TKDIR macro to point to the Tk sources. +!error $(MSG) +!endif +!endif + # If INSTALLDIR set to tcl installation root dir then reset to the # lib dir for installing extensions @@ -1026,7 +1063,7 @@ TCLSH_NATIVE = $(TCLSH) !endif # Do the same for Tk and Tk extensions that require the Tk libraries -!if $(DOING_TK) || $(PROJECT_REQUIRES_TK) +!if $(DOING_TK) || $(NEED_TK) WISHNAMEPREFIX = wish WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT) @@ -1040,7 +1077,7 @@ TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME) TKLIB = $(OUT_DIR)\$(TKLIBNAME) TK_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -!else # effectively PROJECT_REQUIRES_TK +!else # effectively NEED_TK !if $(TKINSTALL) # Building against installed Tk WISH = $(_TKDIR)\bin\$(WISHNAME) @@ -1056,7 +1093,7 @@ TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)" !endif # $(DOING_TK) -!endif # $(DOING_TK) || $(PROJECT_REQUIRES_TK) +!endif # $(DOING_TK) || $(NEED_TK) # Various output paths PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib @@ -1158,7 +1195,7 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED # test targets in tk do not use stubs !if ! $(DOING_TCL) USE_STUBS_DEFS = -DUSE_TCL_STUBS -DUSE_TCLOO_STUBS -!if $(PROJECT_REQUIRES_TK) +!if $(NEED_TK) USE_STUBS_DEFS = $(USE_STUBS_DEFS) -DUSE_TK_STUBS !endif !endif @@ -1333,7 +1370,7 @@ guilflags = $(lflags) -subsystem:windows # Extensions should define any additional libraries with $(PRJ_LIBS) winlibs = kernel32.lib advapi32.lib -!if $(PROJECT_REQUIRES_TK) +!if $(NEED_TK) winlibs = $(winlibs) gdi32.lib user32.lib uxtheme.lib !endif @@ -1352,19 +1389,18 @@ baselibs = $(baselibs) ucrt.lib !endif ################################################################ -# 3. Define standard commands, common make targets and implicit rules +# 13. Define standard commands, common make targets and implicit rules -MAKELIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ -MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) +CCPKGCMD = $(cc32) $(pkgcflags) -Fo$(TMP_DIR)^\ +CCAPPCMD = $(cc32) $(appcflags) -Fo$(TMP_DIR)^\ +CCSTUBSCMD = $(cc32) $(stubscflags) -Fo$(TMP_DIR)^\ -!if $(STATIC_BUILD) -MAKEBINCMD = $(MAKELIBCMD) -!else -MAKEBINCMD = $(MAKEDLLCMD) -!endif -MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) -MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) -MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ +LIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@ +DLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) + +CONEXECMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) +GUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) +RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ $(TCL_INCLUDES) \ -DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ -DCOMMAVERSION=$(DOTVERSION:.=,),0 \ @@ -1466,7 +1502,7 @@ default-shell: default-setup $(PROJECT) !ifdef PRJ_RCFILE $(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc - $(MAKERESCMD) $** + $(RESCMD) $** !else # If parent makefile has not defined a resource definition file, @@ -1520,33 +1556,33 @@ DISABLE_IMPLICIT_RULES = 0 # main application, the master makefile should define explicit rules. {$(ROOT)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<< + $(CCPKGCMD) @<< $< << {$(WINDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<< + $(CCPKGCMD) @<< $< << {$(GENERICDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<< + $(CCPKGCMD) @<< $< << {$(COMPATDIR)}.c{$(TMP_DIR)}.obj:: - $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<< + $(CCPKGCMD) @<< $< << {$(RCDIR)}.rc{$(TMP_DIR)}.res: - $(MAKERESCMD) $< + $(RESCMD) $< {$(WINDIR)}.rc{$(TMP_DIR)}.res: - $(MAKERESCMD) $< + $(RESCMD) $< {$(TMP_DIR)}.rc{$(TMP_DIR)}.res: - $(MAKERESCMD) $< + $(RESCMD) $< .SUFFIXES: .SUFFIXES:.c .rc diff --git a/win/targets.vc b/win/targets.vc index dbe4b82..a345b4f 100644 --- a/win/targets.vc +++ b/win/targets.vc @@ -1,15 +1,21 @@ #------------------------------------------------------------- -*- makefile -*- +# targets.vc -- +# +# Part of the nmake based build system for Tcl and its extensions. +# This file defines some standard targets for the convenience of extensions +# and can be optionally included by the extension makefile. +# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for docs. $(PROJECT): setup pkgindex $(PRJLIB) !ifdef PRJ_STUBOBJS $(PROJECT): $(PRJSTUBLIB) $(PRJSTUBLIB): $(PRJ_STUBOBJS) - $(MAKELIBCMD) $** + $(LIBCMD) $** $(PRJ_STUBOBJS): - $(cc32) $(stubscflags) -Fo$(TMP_DIR)\ %s -!endif + $(CCSTUBSCMD) %s +!endif # PRJ_STUBOBJS !ifdef PRJ_MANIFEST $(PROJECT): $(PRJLIB).manifest @@ -19,13 +25,16 @@ $(PRJLIB).manifest: $(PRJ_MANIFEST) << !endif - !if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk" # MAKEBINCMD will do shared, static and debug links as appropriate # _VC_MANIFEST_EMBED_DLL embeds the manifest for shared libraries # and is a no-op for static libraries $(PRJLIB): $(PRJ_OBJS) $(RESFILE) - $(MAKEBINCMD) $** +!if $(STATIC_BUILD) + $(LIBCMD) $** +!else + $(DLLCMD) $** +!endif $(_VC_MANIFEST_EMBED_DLL) -@del $*.exp !endif -- cgit v0.12 From fa2e7e8949ad5728da4d3dfdd796a4f7e3e0e811 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 27 Oct 2017 07:26:15 +0000 Subject: =?UTF-8?q?Fix=20timeout=20calculation=20in=20epoll-based=20notifi?= =?UTF-8?q?er.=20Proposed=20fix=20for=20[1a6a36d901dedead248ea96df09d5dc15?= =?UTF-8?q?9532652|1a6a36d901].=20Patch=20by=20Lucio=20Andr=C3=A9s=20Illan?= =?UTF-8?q?es=20Albornoz.=20Thanks!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unix/tclEpollNotfy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 088f314..9d0053c 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -462,7 +462,10 @@ PlatformEventsWait( } else if (!timePtr->tv_sec && !timePtr->tv_usec) { timeout = 0; } else { - timeout = (int)timePtr->tv_sec; + timeout = (int)timePtr->tv_sec * 1000; + if (timePtr->tv_usec) { + timeout += (int)timePtr->tv_usec / 1000; + } } /* -- cgit v0.12 From 67e505d2abdb7ddb2d38ee7e579785a410008188 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 27 Oct 2017 08:45:13 +0000 Subject: First implementation of [http://core.tcl.tk/tips/doc/trunk/tip/481.md|TIP #481]: Extend size range of various Tcl_Get*() functions --- generic/tcl.decls | 12 ++++++++++++ generic/tcl.h | 8 ++++++++ generic/tclDecls.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ generic/tclObj.c | 48 ++++++++++++++++++++++++++++++++++++++++++++-- generic/tclStringObj.c | 26 ++++++++++++++++++++++++- generic/tclStubInit.c | 5 +++++ generic/tclTest.c | 26 +++++++++++++------------ generic/tclTestObj.c | 5 +++-- 8 files changed, 165 insertions(+), 17 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index b2b91a9..85b7b81 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2332,6 +2332,18 @@ declare 631 { const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData) } +# TIP #481 +declare 634 { + int Tcl_GetValue(Tcl_Interp *interp, Tcl_Obj *objPtr, + void *intPtr, int flags) +} +declare 635 { + char *Tcl_GetStringFromObj2(Tcl_Obj *objPtr, size_t *lengthPtr) +} +declare 636 { + Tcl_UniChar *Tcl_GetUnicodeFromObj2(Tcl_Obj *objPtr, size_t *lengthPtr) +} + # ----- BASELINE -- FOR -- 8.7.0 ----- # diff --git a/generic/tcl.h b/generic/tcl.h index 07d841d..17406e1 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -1153,6 +1153,14 @@ typedef struct Tcl_DString { #define TCL_LINK_FLOAT 13 #define TCL_LINK_WIDE_UINT 14 #define TCL_LINK_READ_ONLY 0x80 + +/* + * Types for Tcl_GetValue(): + */ + +#define TCL_TYPE_I(type) (0x100 | (int)sizeof(type)) /* signed integer */ +#define TCL_TYPE_U(type) (0x200 | (int)sizeof(type)) /* unsigned integer */ +#define TCL_TYPE_D(type) (0x300 | (int)sizeof(type)) /* float/double/long double */ /* *---------------------------------------------------------------------------- diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 464fc0f..b4b0320 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1831,6 +1831,17 @@ EXTERN Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); +/* Slot 632 is reserved */ +/* Slot 633 is reserved */ +/* 634 */ +EXTERN int Tcl_GetValue(Tcl_Interp *interp, Tcl_Obj *objPtr, + void *intPtr, int flags); +/* 635 */ +EXTERN char * Tcl_GetStringFromObj2(Tcl_Obj *objPtr, + size_t *lengthPtr); +/* 636 */ +EXTERN Tcl_UniChar * Tcl_GetUnicodeFromObj2(Tcl_Obj *objPtr, + size_t *lengthPtr); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2498,6 +2509,11 @@ typedef struct TclStubs { int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */ void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */ Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, const char *service, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */ + void (*reserved632)(void); + void (*reserved633)(void); + int (*tcl_GetValue) (Tcl_Interp *interp, Tcl_Obj *objPtr, void *intPtr, int flags); /* 634 */ + char * (*tcl_GetStringFromObj2) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 635 */ + Tcl_UniChar * (*tcl_GetUnicodeFromObj2) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 636 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -3792,6 +3808,14 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tcl_ZlibStreamSetCompressionDictionary) /* 630 */ #define Tcl_OpenTcpServerEx \ (tclStubsPtr->tcl_OpenTcpServerEx) /* 631 */ +/* Slot 632 is reserved */ +/* Slot 633 is reserved */ +#define Tcl_GetValue \ + (tclStubsPtr->tcl_GetValue) /* 634 */ +#define Tcl_GetStringFromObj2 \ + (tclStubsPtr->tcl_GetStringFromObj2) /* 635 */ +#define Tcl_GetUnicodeFromObj2 \ + (tclStubsPtr->tcl_GetUnicodeFromObj2) /* 636 */ #endif /* defined(USE_TCL_STUBS) */ @@ -3966,6 +3990,34 @@ extern const TclStubs *tclStubsPtr; # endif #endif +#undef Tcl_GetDoubleFromObj +#undef Tcl_GetIntFromObj +#undef Tcl_GetStringFromObj +#undef Tcl_GetUnicodeFromObj +#if defined(USE_TCL_STUBS) +#define Tcl_GetDoubleFromObj(interp, objPtr, dblPtr) \ + (sizeof(*dblPtr) == sizeof(double) ? tclStubsPtr->tcl_GetDoubleFromObj(interp, objPtr, (double *)dblPtr) : tclStubsPtr->tcl_GetValue(interp, objPtr, dblPtr, TCL_TYPE_D(*dblPtr))) +#define Tcl_GetIntFromObj(interp, objPtr, intPtr) \ + (sizeof(*intPtr) == sizeof(int) ? tclStubsPtr->tcl_GetIntFromObj(interp, objPtr, (int *)intPtr) : tclStubsPtr->tcl_GetValue(interp, objPtr, intPtr, TCL_TYPE_I(*intPtr))) +#define Tcl_GetUIntFromObj(interp, objPtr, intPtr) \ + (sizeof(*intPtr) == sizeof(int) ? tclStubsPtr->tcl_GetIntFromObj(interp, objPtr, (int *)intPtr) : tclStubsPtr->tcl_GetValue(interp, objPtr, intPtr, TCL_TYPE_U(*intPtr))) +#define Tcl_GetStringFromObj(objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetStringFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tcl_GetStringFromObj2(objPtr, (size_t *)sizePtr)) +#define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tcl_GetUnicodeFromObj2(objPtr, (size_t *)sizePtr)) +#else +#define Tcl_GetDoubleFromObj(interp, objPtr, dblPtr) \ + (sizeof(*dblPtr) == sizeof(double) ? (Tcl_GetDoubleFromObj)(interp, objPtr, (double *)dblPtr) : Tcl_GetValue(interp, objPtr, dblPtr, TCL_TYPE_D(*dblPtr))) +#define Tcl_GetIntFromObj(interp, objPtr, intPtr) \ + (sizeof(*intPtr) == sizeof(int) ? Tcl_GetIntFromObj(interp, objPtr, (int *)intPtr) : Tcl_GetValue(interp, objPtr, intPtr, TCL_TYPE_I(*intPtr))) +#define Tcl_GetUIntFromObj(interp, objPtr, intPtr) \ + (sizeof(*intPtr) == sizeof(int) ? Tcl_GetIntFromObj(interp, objPtr, (int *)intPtr) : Tcl_GetValue(interp, objPtr, intPtr, TCL_TYPE_U(*intPtr))) +#define Tcl_GetStringFromObj(objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? Tcl_GetStringFromObj(objPtr, (int *)sizePtr) : Tcl_GetStringFromObj2(objPtr, (size_t *)sizePtr)) +#define Tcl_GetUnicodeFromObj(objPtr, sizePtr) \ + (sizeof(*sizePtr) <= sizeof(int) ? Tcl_GetUnicodeFromObj(objPtr, (int *)sizePtr) : Tcl_GetUnicodeFromObj2(objPtr, (size_t *)sizePtr)) +#endif + /* * Deprecated Tcl procedures: */ diff --git a/generic/tclObj.c b/generic/tclObj.c index 1a00011..f61ccb7 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1659,7 +1659,7 @@ Tcl_GetString( /* *---------------------------------------------------------------------- * - * Tcl_GetStringFromObj -- + * Tcl_GetStringFromObj/Tcl_GetStringFromObj2 -- * * Returns the string representation's byte array pointer and length for * an object. @@ -1679,6 +1679,7 @@ Tcl_GetString( *---------------------------------------------------------------------- */ +#undef Tcl_GetStringFromObj char * Tcl_GetStringFromObj( register Tcl_Obj *objPtr, /* Object whose string rep byte pointer should @@ -1694,6 +1695,21 @@ Tcl_GetStringFromObj( } return objPtr->bytes; } +char * +Tcl_GetStringFromObj2( + register Tcl_Obj *objPtr, /* Object whose string rep byte pointer should + * be returned. */ + register size_t *lengthPtr) /* If non-NULL, the location where the string + * rep's byte array length should * be stored. + * If NULL, no length is stored. */ +{ + (void) TclGetString(objPtr); + + if (lengthPtr != NULL) { + *lengthPtr = objPtr->length; + } + return objPtr->bytes; +} /* *---------------------------------------------------------------------- @@ -2273,6 +2289,7 @@ Tcl_SetDoubleObj( *---------------------------------------------------------------------- */ +#undef Tcl_GetDoubleFromObj int Tcl_GetDoubleFromObj( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ @@ -2466,7 +2483,7 @@ Tcl_SetIntObj( /* *---------------------------------------------------------------------- * - * Tcl_GetIntFromObj -- + * Tcl_GetIntFromObj/Tcl_GetValue -- * * Attempt to return an int from the Tcl object "objPtr". If the object * is not already an int, an attempt will be made to convert it to one. @@ -2489,6 +2506,7 @@ Tcl_SetIntObj( *---------------------------------------------------------------------- */ +#undef Tcl_GetIntFromObj int Tcl_GetIntFromObj( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ @@ -2516,6 +2534,32 @@ Tcl_GetIntFromObj( return TCL_OK; #endif } +int +Tcl_GetValue( + Tcl_Interp *interp, /* Used for error reporting if not NULL. */ + register Tcl_Obj *objPtr, /* The object from which to get a int. */ + register void *ptr, /* Place to store resulting int. */ + register int flags) +{ + double value; + int result; + if (flags == TCL_TYPE_I(int)) { + return Tcl_GetIntFromObj(interp, objPtr, ptr); + } + if (flags == TCL_TYPE_I(Tcl_WideInt)) { + return Tcl_GetWideIntFromObj(interp, objPtr, ptr); + } + if (flags == TCL_TYPE_D(double)) { + return Tcl_GetDoubleFromObj(interp, objPtr, ptr); + } + result = Tcl_GetDoubleFromObj(interp, objPtr, &value); + if (flags == TCL_TYPE_D(float)) { + *(float *)ptr = (float) value; + } else { + *(long double *)ptr = (long double) value; + } + return result; +} /* *---------------------------------------------------------------------- diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 7c1d42b..0195656 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -540,7 +540,7 @@ Tcl_GetUnicode( /* *---------------------------------------------------------------------- * - * Tcl_GetUnicodeFromObj -- + * Tcl_GetUnicodeFromObj/Tcl_GetUnicodeFromObj2 -- * * Get the Unicode form of the String object with length. If the object * is not already a String object, it will be converted to one. If the @@ -556,6 +556,7 @@ Tcl_GetUnicode( *---------------------------------------------------------------------- */ +#undef Tcl_GetUnicodeFromObj Tcl_UniChar * Tcl_GetUnicodeFromObj( Tcl_Obj *objPtr, /* The object to find the unicode string @@ -579,6 +580,29 @@ Tcl_GetUnicodeFromObj( } return stringPtr->unicode; } +Tcl_UniChar * +Tcl_GetUnicodeFromObj2( + Tcl_Obj *objPtr, /* The object to find the unicode string + * for. */ + size_t *lengthPtr) /* If non-NULL, the location where the string + * rep's unichar length should be stored. If + * NULL, no length is stored. */ +{ + String *stringPtr; + + SetStringFromAny(NULL, objPtr); + stringPtr = GET_STRING(objPtr); + + if (stringPtr->hasUnicode == 0) { + FillUnicodeRep(objPtr); + stringPtr = GET_STRING(objPtr); + } + + if (lengthPtr != NULL) { + *lengthPtr = stringPtr->numChars; + } + return stringPtr->unicode; +} /* *---------------------------------------------------------------------- diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index ebd2086..b765206 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -1536,6 +1536,11 @@ const TclStubs tclStubs = { Tcl_FSUnloadFile, /* 629 */ Tcl_ZlibStreamSetCompressionDictionary, /* 630 */ Tcl_OpenTcpServerEx, /* 631 */ + 0, /* 632 */ + 0, /* 633 */ + Tcl_GetValue, /* 634 */ + Tcl_GetStringFromObj2, /* 635 */ + Tcl_GetUnicodeFromObj2, /* 636 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tclTest.c b/generic/tclTest.c index ebd90ae..5bb99cc 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -1733,9 +1733,9 @@ TestdoubledigitsObjCmd(ClientData unused, }; const Tcl_ObjType* doubleType; - double d; + long double d; int status; - int ndigits; + size_t ndigits; int type; int decpt; int signum; @@ -1752,16 +1752,18 @@ TestdoubledigitsObjCmd(ClientData unused, if (status != TCL_OK) { doubleType = Tcl_GetObjType("double"); if (objv[1]->typePtr == doubleType - || TclIsNaN(objv[1]->internalRep.doubleValue)) { + && TclIsNaN(objv[1]->internalRep.doubleValue)) { + double d1; status = TCL_OK; - memcpy(&d, &(objv[1]->internalRep.doubleValue), sizeof(double)); + memcpy(&d1, &(objv[1]->internalRep.doubleValue), sizeof(double)); + d = d1; } } if (status != TCL_OK || Tcl_GetIntFromObj(interp, objv[2], &ndigits) != TCL_OK || Tcl_GetIndexFromObj(interp, objv[3], options, "conversion type", TCL_EXACT, &type) != TCL_OK) { - fprintf(stderr, "bad value? %g\n", d); + fprintf(stderr, "bad value? %Lg\n", d); return TCL_ERROR; } type = types[type]; @@ -3084,7 +3086,7 @@ TestlinkCmd( } if (argv[6][0] != 0) { tmp = Tcl_NewStringObj(argv[6], -1); - if (Tcl_GetWideIntFromObj(interp, tmp, &wideVar) != TCL_OK) { + if (Tcl_GetIntFromObj(interp, tmp, &wideVar) != TCL_OK) { Tcl_DecrRefCount(tmp); return TCL_ERROR; } @@ -3142,7 +3144,7 @@ TestlinkCmd( if (argv[15][0]) { Tcl_WideInt w; tmp = Tcl_NewStringObj(argv[15], -1); - if (Tcl_GetWideIntFromObj(interp, tmp, &w) != TCL_OK) { + if (Tcl_GetIntFromObj(interp, tmp, &w) != TCL_OK) { Tcl_DecrRefCount(tmp); return TCL_ERROR; } @@ -3192,7 +3194,7 @@ TestlinkCmd( } if (argv[6][0] != 0) { tmp = Tcl_NewStringObj(argv[6], -1); - if (Tcl_GetWideIntFromObj(interp, tmp, &wideVar) != TCL_OK) { + if (Tcl_GetIntFromObj(interp, tmp, &wideVar) != TCL_OK) { Tcl_DecrRefCount(tmp); return TCL_ERROR; } @@ -3259,7 +3261,7 @@ TestlinkCmd( if (argv[15][0]) { Tcl_WideInt w; tmp = Tcl_NewStringObj(argv[15], -1); - if (Tcl_GetWideIntFromObj(interp, tmp, &w) != TCL_OK) { + if (Tcl_GetIntFromObj(interp, tmp, &w) != TCL_OK) { Tcl_DecrRefCount(tmp); return TCL_ERROR; } @@ -3527,7 +3529,7 @@ TestparserObjCmd( Tcl_Obj *const objv[]) /* The argument objects. */ { const char *script; - int length, dummy; + size_t length, dummy; Tcl_Parse parse; if (objc != 3) { @@ -3583,7 +3585,7 @@ TestexprparserObjCmd( Tcl_Obj *const objv[]) /* The argument objects. */ { const char *script; - int length, dummy; + size_t length, dummy; Tcl_Parse parse; if (objc != 3) { @@ -3870,7 +3872,7 @@ TestprintObjCmd( } if (objc > 1) { - Tcl_GetWideIntFromObj(interp, objv[2], &argv1); + Tcl_GetIntFromObj(interp, objv[2], &argv1); } argv2 = (size_t)argv1; Tcl_SetObjResult(interp, Tcl_ObjPrintf(Tcl_GetString(objv[1]), argv1, argv2, argv2)); diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index 5627608..f08b893 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -1163,7 +1163,8 @@ TeststringobjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tcl_UniChar *unicode; - int varIndex, option, i, length; + int varIndex, option; + size_t length, i; #define MAX_STRINGS 11 const char *index, *string, *strings[MAX_STRINGS+1]; String *strPtr; @@ -1230,7 +1231,7 @@ TeststringobjCmd( if (Tcl_IsShared(varPtr[varIndex])) { SetVarToObj(varPtr, varIndex, Tcl_DuplicateObj(varPtr[varIndex])); } - for (i = 3; i < objc; i++) { + for (i = 3; i < (size_t)objc; i++) { strings[i-3] = Tcl_GetString(objv[i]); } for ( ; i < 12 + 3; i++) { -- cgit v0.12 From 4ab9cb54181038d61f85f76f76a7b23e7a7c59ca Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 27 Oct 2017 12:23:28 +0000 Subject: Update tests that were still written on the outdated premise that Tcl's encoding subsystem had to initialize starting in the identity encoding. --- tests/cmdAH.test | 8 ++++---- tests/encoding.test | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/cmdAH.test b/tests/cmdAH.test index 4ca90c6..45a867a 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -145,7 +145,7 @@ test cmdAH-4.5 {Tcl_EncodingObjCmd} { } 8C test cmdAH-4.6 {Tcl_EncodingObjCmd} { set system [encoding system] - encoding system identity + encoding system iso8859-1 set x [encoding convertto jis0208 \u4e4e] encoding system $system set x @@ -165,7 +165,7 @@ test cmdAH-4.9 {Tcl_EncodingObjCmd} { } \u4e4e test cmdAH-4.10 {Tcl_EncodingObjCmd} { set system [encoding system] - encoding system identity + encoding system iso8859-1 set x [encoding convertfrom jis0208 8C] encoding system $system set x @@ -178,11 +178,11 @@ test cmdAH-4.12 {Tcl_EncodingObjCmd} { } {1 {wrong # args: should be "encoding system ?encoding?"}} test cmdAH-4.13 {Tcl_EncodingObjCmd} { set system [encoding system] - encoding system identity + encoding system iso8859-1 set x [encoding system] encoding system $system set x -} identity +} iso8859-1 test cmdAH-5.1 {Tcl_FileObjCmd} { list [catch file msg] $msg diff --git a/tests/encoding.test b/tests/encoding.test index 85deb33..498e176 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -66,10 +66,10 @@ test encoding-2.2 {Tcl_FreeEncoding: refcount != 0} {testencoding} { encoding system shiftjis ;# incr ref count encoding dirs [list [pwd]] set x [encoding convertto shiftjis \u4e4e] ;# old one found - encoding system identity + encoding system iso8859-1 llength shiftjis lappend x [catch {encoding convertto shiftjis \u4e4e} msg] $msg - encoding system identity + encoding system iso8859-1 encoding dirs $path encoding system $system set x @@ -121,7 +121,7 @@ test encoding-5.1 {Tcl_SetSystemEncoding} { set old [encoding system] encoding system jis0208 set x [encoding convertto \u4e4e] - encoding system identity + encoding system iso8859-1 encoding system $old set x } {8C} @@ -245,7 +245,7 @@ test encoding-11.5.1 {LoadEncodingFile: escape file} { test encoding-11.6 {LoadEncodingFile: invalid file} {testencoding} { set system [encoding system] set path [encoding dirs] - encoding system identity + encoding system iso8859-1 cd [temporaryDirectory] encoding dirs [file join tmp encoding] makeDirectory tmp -- cgit v0.12 From 0a3f9ca6fcac186283561f4f377448ddd6444aa4 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 27 Oct 2017 12:57:15 +0000 Subject: oops --- tests/encoding.test | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/encoding.test b/tests/encoding.test index eb58ea0..ed0e6a4 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -80,7 +80,6 @@ test encoding-2.2 {Tcl_FreeEncoding: refcount != 0} -setup { lappend x [catch {encoding convertto shiftjis \u4e4e} msg] $msg } -cleanup { encoding system iso8859-1 - encoding system identity encoding dirs $path encoding system $system } -result "\u008c\u00c1 1 {unknown encoding \"shiftjis\"}" -- cgit v0.12 From 2318b70929448012d0488f26c5fc85fa1251aa41 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sat, 28 Oct 2017 17:18:58 +0000 Subject: Minor edits --- win/makefile.vc | 2 +- win/targets.vc | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index 7759fc3..d7ea7ae 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -678,7 +678,7 @@ $(TMP_DIR)\tclTestObj.obj: $(GENERICDIR)\tclTestObj.c $(cc32) $(appcflags) -Fo$@ $? $(TMP_DIR)\tclWinTest.obj: $(WINDIR)\tclWinTest.c - $(cc32) $(appcflags) -Fo$@ $? + $(CCAPPCMD) $? $(TMP_DIR)\tclZlib.obj: $(GENERICDIR)\tclZlib.c $(cc32) $(pkgcflags) -I$(COMPATDIR)\zlib -Fo$@ $? diff --git a/win/targets.vc b/win/targets.vc index a345b4f..dd76908 100644 --- a/win/targets.vc +++ b/win/targets.vc @@ -26,16 +26,13 @@ $(PRJLIB).manifest: $(PRJ_MANIFEST) !endif !if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk" -# MAKEBINCMD will do shared, static and debug links as appropriate -# _VC_MANIFEST_EMBED_DLL embeds the manifest for shared libraries -# and is a no-op for static libraries $(PRJLIB): $(PRJ_OBJS) $(RESFILE) !if $(STATIC_BUILD) $(LIBCMD) $** !else $(DLLCMD) $** -!endif $(_VC_MANIFEST_EMBED_DLL) +!endif -@del $*.exp !endif -- cgit v0.12 From 1d0751deb7fafb3e276e1ba022ef023e795946fb Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 30 Oct 2017 02:55:30 +0000 Subject: Revise tests that relied on deprecated variable resolution rules. --- tests/assemble.test | 2 +- tests/execute.test | 6 +++--- tests/resolver.test | 9 +++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/assemble.test b/tests/assemble.test index a9c77e3..5231048 100644 --- a/tests/assemble.test +++ b/tests/assemble.test @@ -852,7 +852,7 @@ test assemble-8.5 {bad context} { -body { namespace eval assem { set x 1 - list [catch {assemble {load x}} result] $result $errorCode + list [catch {assemble {load x}} result opts] $result [dict get $opts -errorcode] } } -result {1 {cannot use this instruction to create a variable in a non-proc context} {TCL ASSEM LVT}} diff --git a/tests/execute.test b/tests/execute.test index 9a2ffbd..e1ed68b 100644 --- a/tests/execute.test +++ b/tests/execute.test @@ -724,7 +724,7 @@ test execute-6.14 {Tcl_ExprObj: exprcode context validation} -setup { } set result {} lappend result [expr $e] - lappend result [namespace eval foo {expr $e}] + lappend result [namespace eval foo [list expr $e]] } -cleanup { namespace delete foo } -result {1 2} @@ -733,11 +733,11 @@ test execute-6.15 {Tcl_ExprObj: exprcode name resolution epoch validation} -setu } -body { set e { [llength {}]+1 } set result {} - lappend result [namespace eval foo {expr $e}] + lappend result [namespace eval foo [list expr $e]] namespace eval foo { proc llength {args} {return 1} } - lappend result [namespace eval foo {expr $e}] + lappend result [namespace eval foo [list expr $e]] } -cleanup { namespace delete foo } -result {1 2} diff --git a/tests/resolver.test b/tests/resolver.test index 9bb4c08..b0b395d 100644 --- a/tests/resolver.test +++ b/tests/resolver.test @@ -139,13 +139,10 @@ test resolver-1.5 {cmdNameObj sharing vs. cmd resolver: other than global NS} -s variable r2 "" } } -constraints testinterpresolver -body { - set r0 [namespace eval ::ns2 {x}] - set r1 [namespace eval ::ns2 {z}] - namespace eval ::ns2 { + list [namespace eval ::ns2 {x}] [namespace eval ::ns2 {z}] [namespace eval ::ns2 { namespace import ::ns1::z - set r2 [z] - } - list $r0 $r1 $r2 + z + }] } -cleanup { testinterpresolver down namespace delete ::ns2 -- cgit v0.12 From c5865fcd241e9a0eec80a61152b696d9d066944b Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 30 Oct 2017 03:23:28 +0000 Subject: More test rewrites for robust var resolution. --- tests/platform.test | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/platform.test b/tests/platform.test index c826444..8ee0ec7 100644 --- a/tests/platform.test +++ b/tests/platform.test @@ -16,7 +16,9 @@ namespace eval ::tcl::test::platform { namespace import ::tcltest::test namespace import ::tcltest::cleanupTests - variable ::tcl_platform + # This is not how [variable] works. See TIP 276. + #variable ::tcl_platform + namespace upvar :: tcl_platform tcl_platform ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] -- cgit v0.12 From a79bc3c8ce1f7c5fc723d0ab7e256cb9090433a8 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Mon, 30 Oct 2017 05:19:55 +0000 Subject: Fix for issue 9fd5c629c1, TclOO - aborts when a trace on command deletion deletes the object's namespace. --- generic/tclBasic.c | 8 ++++---- generic/tclFileName.c | 2 +- generic/tclOO.c | 35 ++++++++++++++++++++++++++--------- generic/tclOOCall.c | 8 ++++---- generic/tclOOInt.h | 16 ++++++++-------- tests/oo.test | 12 ++++++++++++ 6 files changed, 55 insertions(+), 26 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index d4fa833..e6022ac 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3112,7 +3112,7 @@ Tcl_DeleteCommandFromToken( /* * We must delete this command, even though both traces and delete procs * may try to avoid this (renaming the command etc). Also traces and - * delete procs may try to delete the command themsevles. This flag + * delete procs may try to delete the command themselves. This flag * declares that a delete is in progress and that recursive deletes should * be ignored. */ @@ -7722,8 +7722,8 @@ ExprRandFunc( 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) + * To ensure different seeds in different threads (bug #416643), + * take into consideration the thread this interp is running in. */ iPtr->randSeed = TclpGetClicks() + (PTR2INT(Tcl_GetCurrentThread())<<12); @@ -9091,7 +9091,7 @@ TclNRCoroutineObjCmd( TclNRAddCallback(interp, NRCoroutineExitCallback, corPtr, NULL, NULL, NULL); - /* insure that the command is looked up in the correct namespace */ + /* ensure that the command is looked up in the correct namespace */ iPtr->lookupNsPtr = lookupNsPtr; Tcl_NREvalObj(interp, Tcl_NewListObj(objc-2, objv+2), 0); iPtr->numLevels--; diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 150fb8c..15fcde7 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -1904,7 +1904,7 @@ TclGlob( } /* - * To process a [glob] invokation, this function may be called multiple + * To process a [glob] invocation, this function may be called multiple * times. Each time, the previously discovered filenames are in the * interpreter result. We stash that away here so the result is free for * error messsages. diff --git a/generic/tclOO.c b/generic/tclOO.c index 73acce8..e9ef2ce 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -880,7 +880,7 @@ ObjectRenamedTrace( * 2950259] */ - if (((Namespace *) oPtr->namespacePtr)->earlyDeleteProc != NULL) { + if (oPtr->namespacePtr && ((Namespace *) oPtr->namespacePtr)->earlyDeleteProc != NULL) { Tcl_DeleteNamespace(oPtr->namespacePtr); } if (oPtr->classPtr) { @@ -1168,7 +1168,7 @@ ObjectNamespaceDeleted( Class *clsPtr = oPtr->classPtr, *mixinPtr; Method *mPtr; Tcl_Obj *filterObj, *variableObj; - int i; + int deleteAlreadyInProgress = 0, i; /* * Instruct everyone to no longer use any allocated fields of the object. @@ -1178,6 +1178,14 @@ ObjectNamespaceDeleted( */ if (oPtr->command) { + if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) { + /* + * Namespace deletion must have been triggered by a trace on command + * deletion , meaning that + */ + deleteAlreadyInProgress = 1; + } + Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command); } if (oPtr->myCommand) { @@ -1273,14 +1281,17 @@ ObjectNamespaceDeleted( if (clsPtr->subclasses.list) { ckfree(clsPtr->subclasses.list); + clsPtr->subclasses.list = NULL; clsPtr->subclasses.num = 0; } if (clsPtr->instances.list) { ckfree(clsPtr->instances.list); + clsPtr->instances.list = NULL; clsPtr->instances.num = 0; } if (clsPtr->mixinSubs.list) { ckfree(clsPtr->mixinSubs.list); + clsPtr->mixinSubs.list = NULL; clsPtr->mixinSubs.num = 0; } @@ -1305,7 +1316,13 @@ ObjectNamespaceDeleted( * Delete the object structure itself. */ - DelRef(oPtr); + if (deleteAlreadyInProgress) { + oPtr->classPtr = NULL; + oPtr->namespacePtr = NULL; + } else { + DelRef(oPtr); + } + } /* @@ -2433,7 +2450,7 @@ Tcl_ObjectSetMetadata( * * PublicObjectCmd, PrivateObjectCmd, TclOOInvokeObject -- * - * Main entry point for object invokations. The Public* and Private* + * Main entry point for object invocations. The Public* and Private* * wrapper functions (implementations of both object instance commands * and [my]) are just thin wrappers round the main TclOOObjectCmdCore * function. Note that the core is function is NRE-aware. @@ -2518,8 +2535,8 @@ TclOOInvokeObject( * * TclOOObjectCmdCore, FinalizeObjectCall -- * - * Main function for object invokations. Does call chain creation, - * management and invokation. The function FinalizeObjectCall exists to + * Main function for object invocations. Does call chain creation, + * management and invocation. The function FinalizeObjectCall exists to * clean up after the non-recursive processing of TclOOObjectCmdCore. * * ---------------------------------------------------------------------- @@ -2531,7 +2548,7 @@ TclOOObjectCmdCore( Tcl_Interp *interp, /* The interpreter containing the object. */ int objc, /* How many arguments are being passed in. */ Tcl_Obj *const *objv, /* The array of arguments. */ - int flags, /* Whether this is an invokation through the + int flags, /* Whether this is an invocation through the * public or the private command interface. */ Class *startCls) /* Where to start in the call chain, or NULL * if we are to start at the front with @@ -2720,7 +2737,7 @@ Tcl_ObjectContextInvokeNext( * call context while we process the body. However, need to adjust the * argument-skip control because we're guaranteed to have a single prefix * arg (i.e., 'next') and not the variable amount that can happen because - * method invokations (i.e., '$obj meth' and 'my meth'), constructors + * method invocations (i.e., '$obj meth' and 'my meth'), constructors * (i.e., '$cls new' and '$cls create obj') and destructors (no args at * all) come through the same code. */ @@ -2789,7 +2806,7 @@ TclNRObjectContextInvokeNext( * call context while we process the body. However, need to adjust the * argument-skip control because we're guaranteed to have a single prefix * arg (i.e., 'next') and not the variable amount that can happen because - * method invokations (i.e., '$obj meth' and 'my meth'), constructors + * method invocations (i.e., '$obj meth' and 'my meth'), constructors * (i.e., '$cls new' and '$cls create obj') and destructors (no args at * all) come through the same code. */ diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index 3e4f561..d4e1e34 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -233,7 +233,7 @@ FreeMethodNameRep( * TclOOInvokeContext -- * * Invokes a single step along a method call-chain context. Note that the - * invokation of a step along the chain can cause further steps along the + * invocation of a step along the chain can cause further steps along the * chain to be invoked. Note that this function is written to be as light * in stack usage as possible. * @@ -830,7 +830,7 @@ AddMethodToCallChain( * Call chain semantics states that methods come as *late* in the * call chain as possible. This is done by copying down the * following methods. Note that this does not change the number of - * method invokations in the call chain; it just rearranges them. + * method invocations in the call chain; it just rearranges them. */ Class *declCls = callPtr->chain[i].filterDeclarer; @@ -935,7 +935,7 @@ IsStillValid( * TclOOGetCallContext -- * * Responsible for constructing the call context, an ordered list of all - * method implementations to be called as part of a method invokation. + * method implementations to be called as part of a method invocation. * This method is central to the whole operation of the OO system. * * ---------------------------------------------------------------------- @@ -1517,7 +1517,7 @@ TclOORenderCallChain( /* * Do the actual construction of the descriptions. They consist of a list * of triples that describe the details of how a method is understood. For - * each triple, the first word is the type of invokation ("method" is + * each triple, the first word is the type of invocation ("method" is * normal, "unknown" is special because it adds the method name as an * extra argument when handled by some method types, and "filter" is * special because it's a filter method). The second word is the name of diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index 476446d..11ba698 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -149,8 +149,8 @@ typedef struct Object { struct Foundation *fPtr; /* The basis for the object system. Putting * this here allows the avoidance of quite a * lot of hash lookups on the critical path - * for object invokation and creation. */ - Tcl_Namespace *namespacePtr;/* This object's tame namespace. */ + * for object invocation and creation. */ + Tcl_Namespace *namespacePtr;/* This object's namespace. */ Tcl_Command command; /* Reference to this object's public * command. */ Tcl_Command myCommand; /* Reference to this object's internal @@ -162,12 +162,12 @@ typedef struct Object { /* Classes mixed into this object. */ LIST_STATIC(Tcl_Obj *) filters; /* List of filter names. */ - struct Class *classPtr; /* All classes have this non-NULL; it points - * to the class structure. Everything else has - * this NULL. */ + struct Class *classPtr; /* This is non-NULL for all classes, and NULL + * for everything else. It points to the class + * structure. */ int refCount; /* Number of strong references to this object. * Note that there may be many more weak - * references; this mechanism is there to + * references; this mechanism exists to * avoid Tcl_Preserve. */ int flags; int creationEpoch; /* Unique value to make comparisons of objects @@ -323,7 +323,7 @@ typedef struct Foundation { } Foundation; /* - * A call context structure is built when a method is called. They contain the + * A call context structure is built when a method is called. It contains the * chain of method implementations that are to be invoked by a particular * call, and the process of calling walks the chain, with the [next] command * proceeding to the next entry in the chain. @@ -334,7 +334,7 @@ typedef struct Foundation { struct MInvoke { Method *mPtr; /* Reference to the method implementation * record. */ - int isFilter; /* Whether this is a filter invokation. */ + int isFilter; /* Whether this is a filter invocation. */ Class *filterDeclarer; /* What class decided to add the filter; if * NULL, it was added by the object. */ }; diff --git a/tests/oo.test b/tests/oo.test index 2a6eb80..6268dc6 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -1482,6 +1482,18 @@ test oo-11.4 {OO: cleanup} { lappend result [bar0 destroy] [oo::object create foo] [foo destroy] \ [oo::object create bar2] [bar2 destroy] } {1 {can't create object "foo": command already exists with that name} destroyed {} ::foo {} ::bar2 {}} +test oo-11.5 {OO: cleanup} { + oo::class create obj1 + + trace add command obj1 delete {apply {{name1 name2 action} { + set namespace [info object namespace $name1] + namespace delete $namespace + }}} + + rename obj1 {} + # No segmentation fault + return done +} done test oo-12.1 {OO: filters} { oo::class create Aclass -- cgit v0.12 From fe508fa3b5c9dffaebbd68b86344a799a45075c4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 30 Oct 2017 08:47:33 +0000 Subject: Experimental branch meant to eliminate the "wideint" type, just merge it to a single "int" type. No effect on linux64 and similar systems, code simplification for Win64 and 32-bit system. No TIP yet, implementation ongoing. --- generic/tclCmdMZ.c | 4 ++-- generic/tclDisassemble.c | 6 +++--- generic/tclExecute.c | 8 ++++---- generic/tclGet.c | 2 +- generic/tclInt.h | 14 +++++++------- generic/tclObj.c | 26 +++++++++++++------------- generic/tclProc.c | 4 ++-- generic/tclStrToD.c | 8 ++++---- generic/tclStubInit.c | 2 +- generic/tclUtil.c | 8 ++++---- 10 files changed, 41 insertions(+), 41 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 2195aa1..522b76f 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1580,9 +1580,9 @@ StringIsCmd( result = length1 == 0; } } else if (((index == STR_IS_TRUE) && - objPtr->internalRep.longValue == 0) + objPtr->internalRep.wideValue == 0) || ((index == STR_IS_FALSE) && - objPtr->internalRep.longValue != 0)) { + objPtr->internalRep.wideValue != 0)) { result = 0; } break; diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index d61ed42..70a5847 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -797,7 +797,7 @@ TclNewInstNameObj( Tcl_Obj *objPtr = Tcl_NewObj(); objPtr->typePtr = &tclInstNameType; - objPtr->internalRep.longValue = (long) inst; + objPtr->internalRep.wideValue = (long) inst; objPtr->bytes = NULL; return objPtr; @@ -817,7 +817,7 @@ static void UpdateStringOfInstName( Tcl_Obj *objPtr) { - int inst = objPtr->internalRep.longValue; + int inst = objPtr->internalRep.wideValue; char *s, buf[20]; int len; @@ -825,7 +825,7 @@ UpdateStringOfInstName( sprintf(buf, "inst_%d", inst); s = buf; } else { - s = (char *) tclInstructionTable[objPtr->internalRep.longValue].name; + s = (char *) tclInstructionTable[objPtr->internalRep.wideValue].name; } len = strlen(s); objPtr->bytes = ckalloc(len + 1); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f4c71ec..b068e0d 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -503,7 +503,7 @@ VarHashCreateVar( (((objPtr)->typePtr == &tclIntType) \ ? (*(tPtr) = TCL_NUMBER_LONG, \ *(ptrPtr) = (ClientData) \ - (&((objPtr)->internalRep.longValue)), TCL_OK) : \ + (&((objPtr)->internalRep.wideValue)), TCL_OK) : \ ((objPtr)->typePtr == &tclDoubleType) \ ? (((TclIsNaN((objPtr)->internalRep.doubleValue)) \ ? (*(tPtr) = TCL_NUMBER_NAN) \ @@ -518,7 +518,7 @@ VarHashCreateVar( (((objPtr)->typePtr == &tclIntType) \ ? (*(tPtr) = TCL_NUMBER_LONG, \ *(ptrPtr) = (ClientData) \ - (&((objPtr)->internalRep.longValue)), TCL_OK) : \ + (&((objPtr)->internalRep.wideValue)), TCL_OK) : \ ((objPtr)->typePtr == &tclWideIntType) \ ? (*(tPtr) = TCL_NUMBER_WIDE, \ *(ptrPtr) = (ClientData) \ @@ -545,7 +545,7 @@ VarHashCreateVar( #define TclGetBooleanFromObj(interp, objPtr, boolPtr) \ ((((objPtr)->typePtr == &tclIntType) \ || ((objPtr)->typePtr == &tclBooleanType)) \ - ? (*(boolPtr) = ((objPtr)->internalRep.longValue!=0), TCL_OK) \ + ? (*(boolPtr) = ((objPtr)->internalRep.wideValue!=0), TCL_OK) \ : Tcl_GetBooleanFromObj((interp), (objPtr), (boolPtr))) /* @@ -6692,7 +6692,7 @@ TEBCresume( iterVarPtr = LOCAL(infoPtr->loopCtTemp); valuePtr = iterVarPtr->value.objPtr; - iterNum = valuePtr->internalRep.longValue + 1; + iterNum = valuePtr->internalRep.wideValue + 1; TclSetLongObj(valuePtr, iterNum); /* diff --git a/generic/tclGet.c b/generic/tclGet.c index 97e8c7b..727db0a 100644 --- a/generic/tclGet.c +++ b/generic/tclGet.c @@ -142,7 +142,7 @@ Tcl_GetBoolean( Tcl_Panic("invalid sharing of Tcl_Obj on C stack"); } if (code == TCL_OK) { - *boolPtr = obj.internalRep.longValue; + *boolPtr = obj.internalRep.wideValue; } return code; } diff --git a/generic/tclInt.h b/generic/tclInt.h index 0b5ff0c..feffeba 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2453,17 +2453,17 @@ typedef struct List { #define TclGetLongFromObj(interp, objPtr, longPtr) \ (((objPtr)->typePtr == &tclIntType) \ - ? ((*(longPtr) = (objPtr)->internalRep.longValue), TCL_OK) \ + ? ((*(longPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \ : Tcl_GetLongFromObj((interp), (objPtr), (longPtr))) #if (LONG_MAX == INT_MAX) #define TclGetIntFromObj(interp, objPtr, intPtr) \ (((objPtr)->typePtr == &tclIntType) \ - ? ((*(intPtr) = (objPtr)->internalRep.longValue), TCL_OK) \ + ? ((*(intPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \ : Tcl_GetIntFromObj((interp), (objPtr), (intPtr))) #define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \ (((objPtr)->typePtr == &tclIntType) \ - ? ((*(idxPtr) = (objPtr)->internalRep.longValue), TCL_OK) \ + ? ((*(idxPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \ : TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr))) #else #define TclGetIntFromObj(interp, objPtr, intPtr) \ @@ -2484,7 +2484,7 @@ typedef struct List { #define TclGetWideIntFromObj(interp, objPtr, wideIntPtr) \ (((objPtr)->typePtr == &tclIntType) \ ? (*(wideIntPtr) = (Tcl_WideInt) \ - ((objPtr)->internalRep.longValue), TCL_OK) : \ + ((objPtr)->internalRep.wideValue), TCL_OK) : \ Tcl_GetWideIntFromObj((interp), (objPtr), (wideIntPtr))) #else /* !TCL_WIDE_INT_IS_LONG */ #define TclGetWideIntFromObj(interp, objPtr, wideIntPtr) \ @@ -2492,7 +2492,7 @@ typedef struct List { ? (*(wideIntPtr) = (objPtr)->internalRep.wideValue, TCL_OK) : \ ((objPtr)->typePtr == &tclIntType) \ ? (*(wideIntPtr) = (Tcl_WideInt) \ - ((objPtr)->internalRep.longValue), TCL_OK) : \ + ((objPtr)->internalRep.wideValue), TCL_OK) : \ Tcl_GetWideIntFromObj((interp), (objPtr), (wideIntPtr))) #endif /* TCL_WIDE_INT_IS_LONG */ @@ -4545,7 +4545,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; do { \ TclInvalidateStringRep(objPtr); \ TclFreeIntRep(objPtr); \ - (objPtr)->internalRep.longValue = (long)(i); \ + (objPtr)->internalRep.wideValue = (long)(i); \ (objPtr)->typePtr = &tclIntType; \ } while (0) @@ -4589,7 +4589,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; TclAllocObjStorage(objPtr); \ (objPtr)->refCount = 0; \ (objPtr)->bytes = NULL; \ - (objPtr)->internalRep.longValue = (long)(i); \ + (objPtr)->internalRep.wideValue = (long)(i); \ (objPtr)->typePtr = &tclIntType; \ TCL_DTRACE_OBJ_CREATE(objPtr); \ } while (0) diff --git a/generic/tclObj.c b/generic/tclObj.c index 1a00011..f0bcc5e 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1810,7 +1810,7 @@ Tcl_DbNewBooleanObj( TclDbNewObj(objPtr, file, line); objPtr->bytes = NULL; - objPtr->internalRep.longValue = (boolValue != 0); + objPtr->internalRep.wideValue = (boolValue != 0); objPtr->typePtr = &tclIntType; return objPtr; } @@ -1888,11 +1888,11 @@ Tcl_GetBooleanFromObj( { do { if (objPtr->typePtr == &tclIntType) { - *boolPtr = (objPtr->internalRep.longValue != 0); + *boolPtr = (objPtr->internalRep.wideValue != 0); return TCL_OK; } if (objPtr->typePtr == &tclBooleanType) { - *boolPtr = (int) objPtr->internalRep.longValue; + *boolPtr = (int) objPtr->internalRep.wideValue; return TCL_OK; } if (objPtr->typePtr == &tclDoubleType) { @@ -1960,7 +1960,7 @@ TclSetBooleanFromAny( if (objPtr->bytes == NULL) { if (objPtr->typePtr == &tclIntType) { - switch (objPtr->internalRep.longValue) { + switch (objPtr->internalRep.wideValue) { case 0L: case 1L: return TCL_OK; } @@ -2107,13 +2107,13 @@ ParseBoolean( goodBoolean: TclFreeIntRep(objPtr); - objPtr->internalRep.longValue = newBool; + objPtr->internalRep.wideValue = newBool; objPtr->typePtr = &tclBooleanType; return TCL_OK; numericBoolean: TclFreeIntRep(objPtr); - objPtr->internalRep.longValue = newBool; + objPtr->internalRep.wideValue = newBool; objPtr->typePtr = &tclIntType; return TCL_OK; } @@ -2294,7 +2294,7 @@ Tcl_GetDoubleFromObj( return TCL_OK; } if (objPtr->typePtr == &tclIntType) { - *dblPtr = objPtr->internalRep.longValue; + *dblPtr = objPtr->internalRep.wideValue; return TCL_OK; } if (objPtr->typePtr == &tclBignumType) { @@ -2569,7 +2569,7 @@ UpdateStringOfInt( char buffer[TCL_INTEGER_SPACE]; register int len; - len = TclFormatInt(buffer, objPtr->internalRep.longValue); + len = TclFormatInt(buffer, objPtr->internalRep.wideValue); objPtr->bytes = ckalloc(len + 1); memcpy(objPtr->bytes, buffer, (unsigned) len + 1); @@ -2679,7 +2679,7 @@ Tcl_DbNewLongObj( TclDbNewObj(objPtr, file, line); objPtr->bytes = NULL; - objPtr->internalRep.longValue = longValue; + objPtr->internalRep.wideValue = longValue; objPtr->typePtr = &tclIntType; return objPtr; } @@ -2759,7 +2759,7 @@ Tcl_GetLongFromObj( { do { if (objPtr->typePtr == &tclIntType) { - *longPtr = objPtr->internalRep.longValue; + *longPtr = objPtr->internalRep.wideValue; return TCL_OK; } #ifndef TCL_WIDE_INT_IS_LONG @@ -3080,7 +3080,7 @@ Tcl_GetWideIntFromObj( } #endif if (objPtr->typePtr == &tclIntType) { - *wideIntPtr = (Tcl_WideInt) objPtr->internalRep.longValue; + *wideIntPtr = (Tcl_WideInt) objPtr->internalRep.wideValue; return TCL_OK; } if (objPtr->typePtr == &tclDoubleType) { @@ -3402,7 +3402,7 @@ GetBignumFromObj( return TCL_OK; } if (objPtr->typePtr == &tclIntType) { - TclInitBignumFromLong(bignumValue, objPtr->internalRep.longValue); + TclInitBignumFromLong(bignumValue, objPtr->internalRep.wideValue); return TCL_OK; } #ifndef TCL_WIDE_INT_IS_LONG @@ -3653,7 +3653,7 @@ TclGetNumberFromObj( } if (objPtr->typePtr == &tclIntType) { *typePtr = TCL_NUMBER_LONG; - *clientDataPtr = &objPtr->internalRep.longValue; + *clientDataPtr = &objPtr->internalRep.wideValue; return TCL_OK; } #ifndef TCL_WIDE_INT_IS_LONG diff --git a/generic/tclProc.c b/generic/tclProc.c index 96bdcf3..133f41d 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -826,7 +826,7 @@ TclObjGetFrame( level = curLevel - level; result = 1; } else if (objPtr->typePtr == &levelReferenceType) { - level = (int) objPtr->internalRep.longValue; + level = (int) objPtr->internalRep.wideValue; result = 1; } else { name = TclGetString(objPtr); @@ -834,7 +834,7 @@ TclObjGetFrame( if (TCL_OK == Tcl_GetInt(NULL, name+1, &level) && level >= 0) { TclFreeIntRep(objPtr); objPtr->typePtr = &levelReferenceType; - objPtr->internalRep.longValue = level; + objPtr->internalRep.wideValue = level; result = 1; } else { result = -1; diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 630e498..c8bc7b5 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -1289,10 +1289,10 @@ TclParseNumber( } else { objPtr->typePtr = &tclIntType; if (signum) { - objPtr->internalRep.longValue = + objPtr->internalRep.wideValue = - (long) octalSignificandWide; } else { - objPtr->internalRep.longValue = + objPtr->internalRep.wideValue = (long) octalSignificandWide; } } @@ -1336,10 +1336,10 @@ TclParseNumber( } else { objPtr->typePtr = &tclIntType; if (signum) { - objPtr->internalRep.longValue = + objPtr->internalRep.wideValue = - (long) significandWide; } else { - objPtr->internalRep.longValue = + objPtr->internalRep.wideValue = (long) significandWide; } } diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index ebd2086..c8b4dce 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -244,7 +244,7 @@ static Tcl_Obj *dbNewLongObj( TclDbNewObj(objPtr, file, line); objPtr->bytes = NULL; - objPtr->internalRep.longValue = (long) intValue; + objPtr->internalRep.wideValue = (long) intValue; objPtr->typePtr = &tclIntType; return objPtr; #else diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 608cd15..da4dc49 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3598,7 +3598,7 @@ TclGetIntForIndex( * be converted to one, use it. */ - *indexPtr = endValue + objPtr->internalRep.longValue; + *indexPtr = endValue + objPtr->internalRep.wideValue; return TCL_OK; } @@ -3690,9 +3690,9 @@ UpdateStringOfEndOffset( register int len = 3; memcpy(buffer, "end", 4); - if (objPtr->internalRep.longValue != 0) { + if (objPtr->internalRep.wideValue != 0) { buffer[len++] = '-'; - len += TclFormatInt(buffer+len, -(objPtr->internalRep.longValue)); + len += TclFormatInt(buffer+len, -(objPtr->internalRep.wideValue)); } objPtr->bytes = ckalloc((unsigned) len+1); memcpy(objPtr->bytes, buffer, (unsigned) len+1); @@ -3790,7 +3790,7 @@ SetEndOffsetFromAny( */ TclFreeIntRep(objPtr); - objPtr->internalRep.longValue = offset; + objPtr->internalRep.wideValue = offset; objPtr->typePtr = &tclEndOffsetType; return TCL_OK; -- cgit v0.12 From aad24c7ffcbdb7271ba73f1548b5be00185df1b2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 30 Oct 2017 11:01:28 +0000 Subject: Change (internal) TclFormatInt() signature, so it can handle WideInt's directly. Ongoing simplifications ... --- generic/tclInt.decls | 2 +- generic/tclIntDecls.h | 4 +-- generic/tclObj.c | 83 +++------------------------------------------------ generic/tclTimer.c | 32 +++++++------------- generic/tclUtil.c | 21 +++++++++---- 5 files changed, 33 insertions(+), 109 deletions(-) diff --git a/generic/tclInt.decls b/generic/tclInt.decls index dea698c..63ed6c6 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -114,7 +114,7 @@ declare 23 { } # Replaced with macro (see tclInt.h) in Tcl 8.5.0, restored in 8.5.10 declare 24 { - int TclFormatInt(char *buffer, long n) + int TclFormatInt(char *buffer, Tcl_WideInt n) } declare 25 { void TclFreePackageInfo(Interp *iPtr) diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 5bccfe5..2d437d5 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -113,7 +113,7 @@ EXTERN int TclFindElement(Tcl_Interp *interp, /* 23 */ EXTERN Proc * TclFindProc(Interp *iPtr, const char *procName); /* 24 */ -EXTERN int TclFormatInt(char *buffer, long n); +EXTERN int TclFormatInt(char *buffer, Tcl_WideInt n); /* 25 */ EXTERN void TclFreePackageInfo(Interp *iPtr); /* Slot 26 is reserved */ @@ -668,7 +668,7 @@ typedef struct TclIntStubs { void (*reserved21)(void); int (*tclFindElement) (Tcl_Interp *interp, const char *listStr, int listLength, const char **elementPtr, const char **nextPtr, int *sizePtr, int *bracePtr); /* 22 */ Proc * (*tclFindProc) (Interp *iPtr, const char *procName); /* 23 */ - int (*tclFormatInt) (char *buffer, long n); /* 24 */ + int (*tclFormatInt) (char *buffer, Tcl_WideInt n); /* 24 */ void (*tclFreePackageInfo) (Interp *iPtr); /* 25 */ void (*reserved26)(void); void (*reserved27)(void); diff --git a/generic/tclObj.c b/generic/tclObj.c index f0bcc5e..bf1a2e6 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -210,10 +210,6 @@ static int SetDoubleFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetIntFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static void UpdateStringOfDouble(Tcl_Obj *objPtr); static void UpdateStringOfInt(Tcl_Obj *objPtr); -#ifndef TCL_WIDE_INT_IS_LONG -static void UpdateStringOfWideInt(Tcl_Obj *objPtr); -static int SetWideIntFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); -#endif static void FreeBignum(Tcl_Obj *objPtr); static void DupBignum(Tcl_Obj *objPtr, Tcl_Obj *copyPtr); static void UpdateStringOfBignum(Tcl_Obj *objPtr); @@ -275,8 +271,8 @@ const Tcl_ObjType tclWideIntType = { "wideInt", /* name */ NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ - UpdateStringOfWideInt, /* updateStringProc */ - SetWideIntFromAny /* setFromAnyProc */ + UpdateStringOfInt, /* updateStringProc */ + SetIntFromAny /* setFromAnyProc */ }; #endif const Tcl_ObjType tclBignumType = { @@ -2538,9 +2534,8 @@ SetIntFromAny( Tcl_Interp *interp, /* Tcl interpreter */ Tcl_Obj *objPtr) /* Pointer to the object to convert */ { - long l; - - return TclGetLongFromObj(interp, objPtr, &l); + Tcl_WideInt w; + return Tcl_GetWideIntFromObj(interp, objPtr, &w); } /* @@ -2836,49 +2831,6 @@ Tcl_GetLongFromObj( TCL_PARSE_INTEGER_ONLY)==TCL_OK); return TCL_ERROR; } -#ifndef TCL_WIDE_INT_IS_LONG - -/* - *---------------------------------------------------------------------- - * - * UpdateStringOfWideInt -- - * - * Update the string representation for a wide integer object. Note: this - * function does not free an existing old string rep so storage will be - * lost if this has not already been done. - * - * Results: - * None. - * - * Side effects: - * The object's string is set to a valid string that results from the - * wideInt-to-string conversion. - * - *---------------------------------------------------------------------- - */ - -static void -UpdateStringOfWideInt( - register Tcl_Obj *objPtr) /* Int object whose string rep to update. */ -{ - char buffer[TCL_INTEGER_SPACE+2]; - register unsigned len; - register Tcl_WideInt wideVal = objPtr->internalRep.wideValue; - - /* - * Note that sprintf will generate a compiler warning under Mingw claiming - * %I64 is an unknown format specifier. Just ignore this warning. We can't - * use %L as the format specifier since that gets printed as a 32 bit - * value. - */ - - sprintf(buffer, "%" TCL_LL_MODIFIER "d", wideVal); - len = strlen(buffer); - objPtr->bytes = ckalloc(len + 1); - memcpy(objPtr->bytes, buffer, len + 1); - objPtr->length = len; -} -#endif /* !TCL_WIDE_INT_IS_LONG */ /* *---------------------------------------------------------------------- @@ -3133,33 +3085,6 @@ Tcl_GetWideIntFromObj( TCL_PARSE_INTEGER_ONLY)==TCL_OK); return TCL_ERROR; } -#ifndef TCL_WIDE_INT_IS_LONG - -/* - *---------------------------------------------------------------------- - * - * SetWideIntFromAny -- - * - * Attempts to force the internal representation for a Tcl object to - * tclWideIntType, specifically. - * - * Results: - * The return value is a standard object Tcl result. If an error occurs - * during conversion, an error message is left in the interpreter's - * result unless "interp" is NULL. - * - *---------------------------------------------------------------------- - */ - -static int -SetWideIntFromAny( - Tcl_Interp *interp, /* Tcl interpreter */ - Tcl_Obj *objPtr) /* Pointer to the object to convert */ -{ - Tcl_WideInt w; - return Tcl_GetWideIntFromObj(interp, objPtr, &w); -} -#endif /* !TCL_WIDE_INT_IS_LONG */ /* *---------------------------------------------------------------------- diff --git a/generic/tclTimer.c b/generic/tclTimer.c index 3467305..4bb5a35 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.c @@ -1045,37 +1045,27 @@ AfterDelay( if (iPtr->limit.timeEvent == NULL || TCL_TIME_BEFORE(endTime, iPtr->limit.time)) { diff = TCL_TIME_DIFF_MS_CEILING(endTime, now); -#ifndef TCL_WIDE_INT_IS_LONG - if (diff > LONG_MAX) { - diff = LONG_MAX; - } -#endif if (diff > TCL_TIME_MAXIMUM_SLICE) { diff = TCL_TIME_MAXIMUM_SLICE; } - if (diff == 0 && TCL_TIME_BEFORE(now, endTime)) { - diff = 1; - } + if (diff == 0 && TCL_TIME_BEFORE(now, endTime)) { + diff = 1; + } if (diff > 0) { - Tcl_Sleep((long) diff); - if (diff < SLEEP_OFFLOAD_GETTIMEOFDAY) { - break; - } + Tcl_Sleep((int) diff); + if (diff < SLEEP_OFFLOAD_GETTIMEOFDAY) { + break; + } } else { - break; - } + break; + } } else { diff = TCL_TIME_DIFF_MS(iPtr->limit.time, now); -#ifndef TCL_WIDE_INT_IS_LONG - if (diff > LONG_MAX) { - diff = LONG_MAX; - } -#endif if (diff > TCL_TIME_MAXIMUM_SLICE) { diff = TCL_TIME_MAXIMUM_SLICE; } if (diff > 0) { - Tcl_Sleep((long) diff); + Tcl_Sleep((int) diff); } if (Tcl_AsyncReady()) { if (Tcl_AsyncInvoke(interp, TCL_OK) != TCL_OK) { @@ -1089,7 +1079,7 @@ AfterDelay( return TCL_ERROR; } } - Tcl_GetTime(&now); + Tcl_GetTime(&now); } while (TCL_TIME_BEFORE(now, endTime)); return TCL_OK; } diff --git a/generic/tclUtil.c b/generic/tclUtil.c index da4dc49..27e1877 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3489,9 +3489,9 @@ int TclFormatInt( char *buffer, /* Points to the storage into which the * formatted characters are written. */ - long n) /* The integer to format. */ + Tcl_WideInt n) /* The integer to format. */ { - long intVal; + Tcl_WideInt intVal; int i; int numFormatted, j; const char *digits = "0123456789"; @@ -3514,7 +3514,7 @@ TclFormatInt( intVal = -n; /* [Bug 3390638] Workaround for*/ if (n == -n || intVal == n) { /* broken compiler optimizers. */ - return sprintf(buffer, "%ld", n); + return sprintf(buffer, "%" TCL_LL_MODIFIER "d", n); } /* @@ -3722,7 +3722,7 @@ SetEndOffsetFromAny( Tcl_Interp *interp, /* Tcl interpreter or NULL */ Tcl_Obj *objPtr) /* Pointer to the object to parse */ { - int offset; /* Offset in the "end-offset" expression */ + Tcl_WideInt offset; /* Offset in the "end-offset" expression */ register const char *bytes; /* String rep of the object */ int length; /* Length of the object's string rep */ @@ -3758,15 +3758,24 @@ SetEndOffsetFromAny( } 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. + * after "end-" to TclParseNumber. */ if (TclIsSpaceProc(bytes[4])) { goto badIndexFormat; } - if (Tcl_GetInt(interp, bytes+4, &offset) != TCL_OK) { + if (TclParseNumber(NULL, objPtr, NULL, bytes+4, length-4, NULL, + TCL_PARSE_INTEGER_ONLY) != TCL_OK) { return TCL_ERROR; } + if ((objPtr->typePtr != &tclIntType) +#ifndef TCL_WIDE_INT_IS_LONG + && (objPtr->typePtr != &tclWideIntType) +#endif + ) { + goto badIndexFormat; + } + offset = objPtr->internalRep.wideValue; if (bytes[3] == '-') { offset = -offset; } -- cgit v0.12 From 6642181b9d3599f1bde42f466b34f2d44f9a26e8 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 30 Oct 2017 12:41:21 +0000 Subject: Rebase tip-278 branch to workaround CVS conversion woes. --- generic/tclVar.c | 12 ++++++------ tests/namespace-old.test | 24 ++++++++++++++---------- tests/namespace.test | 36 ++++++++++++++++++++++++------------ tests/parse.test | 6 +++--- tests/tcltest.test | 1 + tests/var.test | 9 +++++---- 6 files changed, 53 insertions(+), 35 deletions(-) diff --git a/generic/tclVar.c b/generic/tclVar.c index 7c8bb73..4f2d435 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -816,12 +816,8 @@ TclLookupSimpleVar( *indexPtr = -1; flags = (flags | TCL_GLOBAL_ONLY) & ~TCL_NAMESPACE_ONLY; } else { - if (flags & TCL_AVOID_RESOLVERS) { - flags = (flags | TCL_NAMESPACE_ONLY); - } - if (flags & TCL_NAMESPACE_ONLY) { - *indexPtr = -2; - } + flags = (flags | TCL_NAMESPACE_ONLY); + *indexPtr = -2; } /* @@ -5709,6 +5705,10 @@ ObjFindNamespaceVar( * Find the namespace(s) that contain the variable. */ + if (!(flags & TCL_GLOBAL_ONLY)) { + flags |= TCL_NAMESPACE_ONLY; + } + TclGetNamespaceForQualName(interp, name, (Namespace *) contextNsPtr, flags, &nsPtr[0], &nsPtr[1], &cxtNsPtr, &simpleName); diff --git a/tests/namespace-old.test b/tests/namespace-old.test index 1d6a805..3f8737b 100644 --- a/tests/namespace-old.test +++ b/tests/namespace-old.test @@ -293,12 +293,13 @@ namespace eval test_ns_hier1 { namespace eval test_ns_hier2a {} namespace eval test_ns_hier2b {} } +# TIP 278: secondary lookup disabled for vars, tests disabled with # test namespace-old-5.4 {nested namespaces can access global namespace} { - list [namespace eval test_ns_hier1 {set test_ns_var_global}] \ + list [namespace eval test_ns_hier1 {#set test_ns_var_global}] \ [namespace eval test_ns_hier1 {test_ns_cmd_global}] \ - [namespace eval test_ns_hier1::test_ns_hier2 {set test_ns_var_global}] \ + [namespace eval test_ns_hier1::test_ns_hier2 {#set test_ns_var_global}] \ [namespace eval test_ns_hier1::test_ns_hier2 {test_ns_cmd_global}] -} {{var in ::} {cmd in ::} {var in ::} {cmd in ::}} +} {{} {cmd in ::} {} {cmd in ::}} test namespace-old-5.5 {variables in different namespaces don't conflict} { list [set test_ns_hier1::test_ns_level] \ [set test_ns_hier1::test_ns_hier2::test_ns_level] @@ -468,11 +469,12 @@ test namespace-old-6.11 {commands affect all parent namespaces} { } list [test_ns_cache1::trigger] [test_ns_cache1::test_ns_cache2::trigger] } {{cache2 version} {cache2 version}} +# TIP 278: secondary lookup disabled, catch added, result changed from {global version} test namespace-old-6.12 {define test variables} { variable test_ns_cache_var "global version" set trigger {set test_ns_cache_var} - namespace eval test_ns_cache1 $trigger -} {global version} + list [catch {namespace eval test_ns_cache1 $trigger} msg] $msg +} {1 {can't read "test_ns_cache_var": no such variable}} set trigger {set test_ns_cache_var} test namespace-old-6.13 {one-level check for variable shadowing} { namespace eval test_ns_cache1 { @@ -481,22 +483,24 @@ test namespace-old-6.13 {one-level check for variable shadowing} { namespace eval test_ns_cache1 $trigger } {cache1 version} variable ::test_ns_cache_var "global version" +# TIP 278: secondary lookup disabled, catch added, result changed from {global version} test namespace-old-6.14 {deleting variables changes variable epoch} { namespace eval test_ns_cache1 { variable test_ns_cache_var "cache1 version" } list [namespace eval test_ns_cache1 $trigger] \ [namespace eval test_ns_cache1 {unset test_ns_cache_var}] \ - [namespace eval test_ns_cache1 $trigger] -} {{cache1 version} {} {global version}} + [catch {namespace eval test_ns_cache1 $trigger}] +} {{cache1 version} {} 1} +# TIP 278: secondary lookup disabled, catch added, result changed test namespace-old-6.15 {define test namespaces} { namespace eval test_ns_cache2 { variable test_ns_cache_var "global cache2 version" } set trigger2 {set test_ns_cache2::test_ns_cache_var} - list [namespace eval test_ns_cache1 $trigger2] \ - [namespace eval test_ns_cache1::test_ns_cache2 $trigger] -} {{global cache2 version} {global version}} + catch {list [namespace eval test_ns_cache1 $trigger2] \ + [namespace eval test_ns_cache1::test_ns_cache2 $trigger]} +} 1 set trigger2 {set test_ns_cache2::test_ns_cache_var} test namespace-old-6.16 {public variables affect all parent namespaces} { variable test_ns_cache1::test_ns_cache2::test_ns_cache_var "cache2 version" diff --git a/tests/namespace.test b/tests/namespace.test index f6f817b..24c1c7d 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -46,9 +46,9 @@ test namespace-2.2 {Tcl_GetCurrentNamespace} { set l {} lappend l [namespace current] namespace eval test_ns_1 { - lappend l [namespace current] + lappend ::l [namespace current] namespace eval foo { - lappend l [namespace current] + lappend ::l [namespace current] } } lappend l [namespace current] @@ -633,6 +633,8 @@ test namespace-14.2 {TclGetNamespaceForQualName, invalid absolute names} -setup [catch {namespace children test_ns_777} msg] $msg } } -result {1 {can't read "::test_ns_777::v": no such variable} 1 {namespace "test_ns_777" not found in "::test_ns_1"}} + +# TIP 278: secondary lookup disabled, results changed from {10 20} test namespace-14.3 {TclGetNamespaceForQualName, relative names} -setup { catch {namespace delete {*}[namespace children :: test_ns_*]} variable v 10 @@ -644,9 +646,11 @@ test namespace-14.3 {TclGetNamespaceForQualName, relative names} -setup { } } -body { namespace eval test_ns_1 { - list $v $test_ns_2::v + # list $v $test_ns_2::v + list [catch {set v} msg] $msg [catch {set test_ns_2::v} msg] $msg } -} -result {10 20} +} -result {1 {can't read "v": no such variable} 0 20} + test namespace-14.4 {TclGetNamespaceForQualName, relative ns names looked up only in current ns} { namespace eval test_ns_1::test_ns_2 { namespace eval foo {} @@ -707,15 +711,17 @@ test namespace-14.11 {TclGetNamespaceForQualName, extra ::s are significant for proc test_ns_1::test_ns_2:: {args} {return "\{\}: $args"} lappend l [test_ns_1::test_ns_2:: hello] } -result {1 {invalid command name "test_ns_1::test_ns_2::"} {{}: hello}} + +# TIP 278: secondary lookup disabled, added catch, result changed from y test namespace-14.12 {TclGetNamespaceForQualName, extra ::s are significant for vars} -setup { catch {namespace delete {*}[namespace children :: test_ns_*]} } -body { namespace eval test_ns_1 { variable {} - set test_ns_1::(x) y + catch {set test_ns_1::(x) y} ::msg } - set test_ns_1::(x) -} -result y + list $::msg [catch {set test_ns_1::(x)} msg] $msg +} -result {{can't set "test_ns_1::(x)": parent namespace doesn't exist} 1 {can't read "test_ns_1::(x)": no such variable}} test namespace-14.13 {TclGetNamespaceForQualName, namespace other than global ns can't have empty name} -setup { catch {namespace delete {*}[namespace children :: test_ns_*]} } -returnCodes error -body { @@ -888,13 +894,15 @@ test namespace-17.6 {Tcl_FindNamespaceVar, relative name found} -setup { set x } } -result {777} + +# TIP 278: secondary lookup disabled, catch added, result changed from 314159 test namespace-17.7 {Tcl_FindNamespaceVar, relative name found} { namespace eval test_ns_1 { variable x 777 unset x - set x ;# must be global x now + list [catch {set x} msg] $msg ;# must not be global x now } -} {314159} +} {1 {can't read "x": no such variable}} test namespace-17.8 {Tcl_FindNamespaceVar, relative name not found} -body { namespace eval test_ns_1 { set wuzzat @@ -906,6 +914,8 @@ test namespace-17.9 {Tcl_FindNamespaceVar, relative name and TCL_GLOBAL_ONLY} { } set test_ns_1::a } {hello} + +# TIP 278: secondary lookup disabled, result changed from 1 test namespace-17.10 {Tcl_FindNamespaceVar, interference with cached varNames} -setup { namespace eval test_ns_1 {} } -body { @@ -919,7 +929,7 @@ test namespace-17.10 {Tcl_FindNamespaceVar, interference with cached varNames} - namespace eval test_ns_1 set a 1 namespace delete test_ns_1 return $a -} -result 1 +} -result 0 catch {unset a} catch {unset x} @@ -1540,6 +1550,8 @@ test namespace-34.6 {NamespaceWhichCmd, -command is default} -setup { [namespace which ::test_ns_2::cmd2] } } -result {::foreach ::test_ns_3::p ::test_ns_3::cmd1 ::test_ns_2::cmd2} + +# TIP 278: secondary lookup disabled, catch added, result changed test namespace-34.7 {NamespaceWhichCmd, variable lookup} -setup { catch {namespace delete {*}[namespace children test_ns_*]} namespace eval test_ns_1 { @@ -1559,12 +1571,12 @@ test namespace-34.7 {NamespaceWhichCmd, variable lookup} -setup { } } -body { namespace eval test_ns_3 { - list [namespace which -variable env] \ + list [catch {namespace which -variable env } msg] $msg \ [namespace which -variable v3] \ [namespace which -variable ::test_ns_2::v2] \ [catch {namespace which -variable ::test_ns_2::noSuchVar} msg] $msg } -} -result {::env ::test_ns_3::v3 ::test_ns_2::v2 0 {}} +} -result {0 {} ::test_ns_3::v3 ::test_ns_2::v2 0 {}} test namespace-35.1 {FreeNsNameInternalRep, resulting ref count > 0} -setup { catch {namespace delete {*}[namespace children :: test_ns_*]} diff --git a/tests/parse.test b/tests/parse.test index 287c392..d36472e 100644 --- a/tests/parse.test +++ b/tests/parse.test @@ -376,12 +376,12 @@ test parse-8.8 {Tcl_EvalObjv procedure, async handlers} -constraints { return "new result" } set handler1 [testasync create async1] - set aresult xxx - set acode yyy + set ::aresult xxx + set ::acode yyy } -cleanup { testasync delete } -body { - list [testevalobjv 0 testasync mark $handler1 original 0] $acode $aresult + list [testevalobjv 0 testasync mark $handler1 original 0] $::acode $::aresult } -result {{new result} 0 original} test parse-8.9 {Tcl_EvalObjv procedure, exceptional return} testevalobjv { list [catch {testevalobjv 0 error message} msg] $msg diff --git a/tests/tcltest.test b/tests/tcltest.test index 728a018..cd3c621 100644 --- a/tests/tcltest.test +++ b/tests/tcltest.test @@ -544,6 +544,7 @@ set notReadableDir [file join [temporaryDirectory] notreadable] set notWriteableDir [file join [temporaryDirectory] notwriteable] makeDirectory notreadable makeDirectory notwriteable + switch -- $::tcl_platform(platform) { unix { file attributes $notReadableDir -permissions 00333 diff --git a/tests/var.test b/tests/var.test index 9816d98..e32dbcf 100644 --- a/tests/var.test +++ b/tests/var.test @@ -247,10 +247,11 @@ test var-3.4 {MakeUpvar, my var has TCL_NAMESPACE_ONLY specified} -setup { catch {unset ::test_ns_var::vv} proc p {} { # create namespace var vv linked to global a - testupvar 1 a {} vv namespace + testupvar 2 a {} vv namespace } p } + # Modified: that should create a global var according to the docs! list $test_ns_var::vv [set test_ns_var::vv 123] $a } -result {456 123 123} test var-3.5 {MakeUpvar, no call frame so my var will be in global :: ns} -setup { @@ -442,7 +443,7 @@ test var-7.5 {Tcl_VariableObjCmd, value for last var is optional} -setup { set six 666 namespace eval test_ns_var { variable five 5 six - lappend a $five + lappend ::a $five } lappend a $test_ns_var::five \ [set test_ns_var::six 6] [set test_ns_var::six] $six @@ -469,9 +470,9 @@ test var-7.8 {Tcl_VariableObjCmd, if var already exists and no value is given, l set a "" namespace eval test_ns_var { variable eight 8 - lappend a $eight + lappend ::a $eight variable eight - lappend a $eight + lappend ::a $eight } set a } {8 8} -- cgit v0.12 From ca470c3d4eeb58156583417df4011087612bb186 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 30 Oct 2017 14:32:52 +0000 Subject: more progress in code simplifications --- generic/tclAssembly.c | 2 +- generic/tclBasic.c | 30 +++------- generic/tclCmdMZ.c | 4 -- generic/tclExecute.c | 163 ++++++-------------------------------------------- generic/tclInt.h | 8 +-- generic/tclObj.c | 30 +--------- generic/tclTimer.c | 2 - generic/tclUtil.c | 2 - 8 files changed, 30 insertions(+), 211 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index 4c5ae68..c7ded6e 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -4266,7 +4266,7 @@ AddBasicBlockRangeToErrorInfo( Tcl_AppendObjToErrorInfo(interp, lineNo); Tcl_AddErrorInfo(interp, " and "); if (bbPtr->successor1 != NULL) { - TclSetLongObj(lineNo, bbPtr->successor1->startLine); + TclSetWideIntObj(lineNo, bbPtr->successor1->startLine); Tcl_AppendObjToErrorInfo(interp, lineNo); } else { Tcl_AddErrorInfo(interp, "end of assembly code"); diff --git a/generic/tclBasic.c b/generic/tclBasic.c index e6022ac..a911028 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -7442,12 +7442,12 @@ ExprAbsFunc( return TCL_ERROR; } - if (type == TCL_NUMBER_LONG) { - long l = *((const long *) ptr); + if (type == TCL_NUMBER_LONG || type == TCL_NUMBER_WIDE) { + Tcl_WideInt l = *((const Tcl_WideInt *) ptr); - if (l > (long)0) { + if (l > (Tcl_WideInt)0) { goto unChanged; - } else if (l == (long)0) { + } else if (l == (Tcl_WideInt)0) { const char *string = objv[1]->bytes; if (string) { while (*string != '0') { @@ -7459,11 +7459,11 @@ ExprAbsFunc( } } goto unChanged; - } else if (l == LONG_MIN) { - TclInitBignumFromLong(&big, l); + } else if (l == LLONG_MIN) { + TclInitBignumFromWideInt(&big, l); goto tooLarge; } - Tcl_SetObjResult(interp, Tcl_NewLongObj(-l)); + Tcl_SetObjResult(interp, Tcl_NewWideIntObj(-l)); return TCL_OK; } @@ -7487,22 +7487,6 @@ ExprAbsFunc( return TCL_OK; } -#ifndef TCL_WIDE_INT_IS_LONG - if (type == TCL_NUMBER_WIDE) { - Tcl_WideInt w = *((const Tcl_WideInt *) ptr); - - if (w >= (Tcl_WideInt)0) { - goto unChanged; - } - if (w == LLONG_MIN) { - TclInitBignumFromWideInt(&big, w); - goto tooLarge; - } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(-w)); - return TCL_OK; - } -#endif - if (type == TCL_NUMBER_BIG) { if (mp_cmp_d((const mp_int *) ptr, 0) == MP_LT) { Tcl_GetBignumFromObj(NULL, objv[1], &big); diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 522b76f..c984bbe 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1596,9 +1596,7 @@ StringIsCmd( /* TODO */ if ((objPtr->typePtr == &tclDoubleType) || (objPtr->typePtr == &tclIntType) || -#ifndef TCL_WIDE_INT_IS_LONG (objPtr->typePtr == &tclWideIntType) || -#endif (objPtr->typePtr == &tclBignumType)) { break; } @@ -1633,9 +1631,7 @@ StringIsCmd( goto failedIntParse; case STR_IS_ENTIER: if ((objPtr->typePtr == &tclIntType) || -#ifndef TCL_WIDE_INT_IS_LONG (objPtr->typePtr == &tclWideIntType) || -#endif (objPtr->typePtr == &tclBignumType)) { break; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index b068e0d..3e64805 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1892,7 +1892,6 @@ TclIncrObj( TclSetLongObj(valuePtr, sum); return TCL_OK; } -#ifndef TCL_WIDE_INT_IS_LONG { Tcl_WideInt w1 = (Tcl_WideInt) augend; Tcl_WideInt w2 = (Tcl_WideInt) addend; @@ -1905,7 +1904,6 @@ TclIncrObj( TclSetWideIntObj(valuePtr, w1 + w2); return TCL_OK; } -#endif } if ((type1 == TCL_NUMBER_DOUBLE) || (type1 == TCL_NUMBER_NAN)) { @@ -1925,7 +1923,6 @@ TclIncrObj( return TCL_ERROR; } -#ifndef TCL_WIDE_INT_IS_LONG if ((type1 != TCL_NUMBER_BIG) && (type2 != TCL_NUMBER_BIG)) { Tcl_WideInt w1, w2, sum; @@ -1942,7 +1939,6 @@ TclIncrObj( return TCL_OK; } } -#endif Tcl_TakeBignumFromObj(interp, valuePtr, &value); Tcl_GetBignumFromObj(interp, incrPtr, &incr); @@ -3626,9 +3622,7 @@ TEBCresume( { Tcl_Obj *incrPtr; -#ifndef TCL_WIDE_INT_IS_LONG Tcl_WideInt w; -#endif long increment; case INST_INCR_SCALAR1: @@ -3750,7 +3744,6 @@ TEBCresume( } goto doneIncr; } -#ifndef TCL_WIDE_INT_IS_LONG w = (Tcl_WideInt)augend; TRACE(("%u %ld => ", opnd, increment)); @@ -3770,9 +3763,7 @@ TEBCresume( TclSetWideIntObj(objPtr, w+increment); } goto doneIncr; -#endif } /* end if (type == TCL_NUMBER_LONG) */ -#ifndef TCL_WIDE_INT_IS_LONG if (type == TCL_NUMBER_WIDE) { Tcl_WideInt sum; @@ -3804,7 +3795,6 @@ TEBCresume( goto doneIncr; } } -#endif } if (Tcl_IsShared(objPtr)) { objPtr->refCount--; /* We know it's shared */ @@ -5915,7 +5905,6 @@ TEBCresume( if (Tcl_GetIntFromObj(NULL, OBJ_AT_TOS, &i) != TCL_OK) { type1 = TCL_NUMBER_WIDE; } -#ifndef TCL_WIDE_INT_IS_LONG } else if (type1 == TCL_NUMBER_WIDE) { /* value is between WIDE_MIN and WIDE_MAX */ /* [string is wideinteger] is -UWIDE_MAX to UWIDE_MAX range */ @@ -5923,7 +5912,6 @@ TEBCresume( if (Tcl_GetIntFromObj(NULL, OBJ_AT_TOS, &i) == TCL_OK) { type1 = TCL_NUMBER_LONG; } -#endif } else if (type1 == TCL_NUMBER_BIG) { /* value is an integer outside the WIDE_MIN to WIDE_MAX range */ /* [string is wideinteger] is -UWIDE_MAX to UWIDE_MAX range */ @@ -6307,7 +6295,6 @@ TEBCresume( w1 = (Tcl_WideInt) l1; w2 = (Tcl_WideInt) l2; wResult = w1 + w2; -#ifdef TCL_WIDE_INT_IS_LONG /* * Check for overflow. */ @@ -6315,14 +6302,12 @@ TEBCresume( if (Overflowing(w1, w2, wResult)) { goto overflow; } -#endif goto wideResultOfArithmetic; case INST_SUB: w1 = (Tcl_WideInt) l1; w2 = (Tcl_WideInt) l2; wResult = w1 - w2; -#ifdef TCL_WIDE_INT_IS_LONG /* * Must check for overflow. The macro tests for overflows in * sums by looking at the sign bits. As we have a subtraction @@ -6336,7 +6321,6 @@ TEBCresume( if (Overflowing(w1, ~w2, wResult)) { goto overflow; } -#endif wideResultOfArithmetic: TRACE(("%s %s => ", O2S(valuePtr), O2S(value2Ptr))); if (Tcl_IsShared(valuePtr)) { @@ -8124,14 +8108,6 @@ ExecuteExtendedBinaryMathOp( Tcl_Obj *valuePtr, /* The first operand on the stack. */ Tcl_Obj *value2Ptr) /* The second operand on the stack. */ { -#define LONG_RESULT(l) \ - if (Tcl_IsShared(valuePtr)) { \ - TclNewLongObj(objResultPtr, l); \ - return objResultPtr; \ - } else { \ - Tcl_SetLongObj(valuePtr, l); \ - return NULL; \ - } #define WIDE_RESULT(w) \ if (Tcl_IsShared(valuePtr)) { \ return Tcl_NewWideIntObj(w); \ @@ -8186,7 +8162,6 @@ ExecuteExtendedBinaryMathOp( return constants[0]; } } -#ifndef TCL_WIDE_INT_IS_LONG if (type1 == TCL_NUMBER_WIDE) { w1 = *((const Tcl_WideInt *)ptr1); if (type2 != TCL_NUMBER_BIG) { @@ -8231,7 +8206,6 @@ ExecuteExtendedBinaryMathOp( mp_clear(&big2); return NULL; } -#endif Tcl_GetBignumFromObj(NULL, valuePtr, &big1); Tcl_GetBignumFromObj(NULL, value2Ptr, &big2); mp_init(&bigResult); @@ -8258,14 +8232,10 @@ ExecuteExtendedBinaryMathOp( */ switch (type2) { - case TCL_NUMBER_LONG: - invalid = (*((const long *)ptr2) < 0L); - break; -#ifndef TCL_WIDE_INT_IS_LONG case TCL_NUMBER_WIDE: + case TCL_NUMBER_LONG: invalid = (*((const Tcl_WideInt *)ptr2) < (Tcl_WideInt)0); break; -#endif case TCL_NUMBER_BIG: Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2); invalid = (mp_cmp_d(&big2, 0) == MP_LT); @@ -8345,11 +8315,9 @@ ExecuteExtendedBinaryMathOp( case TCL_NUMBER_LONG: zero = (*(const long *)ptr1 > 0L); break; -#ifndef TCL_WIDE_INT_IS_LONG case TCL_NUMBER_WIDE: zero = (*(const Tcl_WideInt *)ptr1 > (Tcl_WideInt)0); break; -#endif case TCL_NUMBER_BIG: Tcl_TakeBignumFromObj(NULL, valuePtr, &big1); zero = (mp_cmp_d(&big1, 0) == MP_GT); @@ -8362,11 +8330,10 @@ ExecuteExtendedBinaryMathOp( if (zero) { return constants[0]; } - LONG_RESULT(-1); + WIDE_RESULT(-1); } shift = (int)(*(const long *)ptr2); -#ifndef TCL_WIDE_INT_IS_LONG /* * Handle shifts within the native wide range. */ @@ -8377,11 +8344,10 @@ ExecuteExtendedBinaryMathOp( if (w1 >= (Tcl_WideInt)0) { return constants[0]; } - LONG_RESULT(-1); + WIDE_RESULT(-1); } WIDE_RESULT(w1 >> shift); } -#endif } Tcl_TakeBignumFromObj(NULL, valuePtr, &big1); @@ -8549,7 +8515,6 @@ ExecuteExtendedBinaryMathOp( BIG_RESULT(&bigResult); } -#ifndef TCL_WIDE_INT_IS_LONG if ((type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_WIDE)) { TclGetWideIntFromObj(NULL, valuePtr, &w1); TclGetWideIntFromObj(NULL, value2Ptr, &w2); @@ -8570,7 +8535,6 @@ ExecuteExtendedBinaryMathOp( } WIDE_RESULT(wResult); } -#endif l1 = *((const long *)ptr1); l2 = *((const long *)ptr2); @@ -8588,7 +8552,7 @@ ExecuteExtendedBinaryMathOp( /* Unused, here to silence compiler warning. */ lResult = 0; } - LONG_RESULT(lResult); + WIDE_RESULT(lResult); case INST_EXPON: { int oddExponent = 0, negativeExponent = 0; @@ -8627,13 +8591,11 @@ ExecuteExtendedBinaryMathOp( negativeExponent = (l2 < 0); oddExponent = (int) (l2 & 1); break; -#ifndef TCL_WIDE_INT_IS_LONG case TCL_NUMBER_WIDE: w2 = *((const Tcl_WideInt *)ptr2); negativeExponent = (w2 < 0); oddExponent = (int) (w2 & (Tcl_WideInt)1); break; -#endif case TCL_NUMBER_BIG: Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2); negativeExponent = (mp_cmp_d(&big2, 0) == MP_LT); @@ -8657,7 +8619,7 @@ ExecuteExtendedBinaryMathOp( return EXPONENT_OF_ZERO; case -1: if (oddExponent) { - LONG_RESULT(-1); + WIDE_RESULT(-1); } /* fallthrough */ case 1: @@ -8695,7 +8657,7 @@ ExecuteExtendedBinaryMathOp( if (!oddExponent) { return constants[1]; } - LONG_RESULT(-1); + WIDE_RESULT(-1); } } @@ -8720,14 +8682,9 @@ ExecuteExtendedBinaryMathOp( * Reduce small powers of 2 to shifts. */ - if ((unsigned long) l2 < CHAR_BIT * sizeof(long) - 1) { - LONG_RESULT(1L << l2); - } -#if !defined(TCL_WIDE_INT_IS_LONG) - if ((unsigned long)l2 < CHAR_BIT*sizeof(Tcl_WideInt) - 1) { + if ((Tcl_WideUInt) l2 < (Tcl_WideUInt) CHAR_BIT*sizeof(Tcl_WideInt) - 1) { WIDE_RESULT(((Tcl_WideInt) 1) << l2); } -#endif goto overflowExpon; } if (l1 == -2) { @@ -8737,14 +8694,9 @@ ExecuteExtendedBinaryMathOp( * Reduce small powers of 2 to shifts. */ - if ((unsigned long) l2 < CHAR_BIT * sizeof(long) - 1) { - LONG_RESULT(signum * (1L << l2)); - } -#if !defined(TCL_WIDE_INT_IS_LONG) if ((unsigned long)l2 < CHAR_BIT*sizeof(Tcl_WideInt) - 1){ WIDE_RESULT(signum * (((Tcl_WideInt) 1) << l2)); } -#endif goto overflowExpon; } #if (LONG_MAX == 0x7fffffff) @@ -8783,7 +8735,7 @@ ExecuteExtendedBinaryMathOp( lResult *= lResult; /* b**8 */ break; } - LONG_RESULT(lResult); + WIDE_RESULT(lResult); } if (l1 - 3 >= 0 && l1 -2 < (long)Exp32IndexSize @@ -8796,7 +8748,7 @@ ExecuteExtendedBinaryMathOp( * table lookup. */ - LONG_RESULT(Exp32Value[base]); + WIDE_RESULT(Exp32Value[base]); } } if (-l1 - 3 >= 0 && -l1 - 2 < (long)Exp32IndexSize @@ -8811,7 +8763,7 @@ ExecuteExtendedBinaryMathOp( lResult = (oddExponent) ? -Exp32Value[base] : Exp32Value[base]; - LONG_RESULT(lResult); + WIDE_RESULT(lResult); } } #endif @@ -8819,10 +8771,8 @@ ExecuteExtendedBinaryMathOp( #if (LONG_MAX > 0x7fffffff) || !defined(TCL_WIDE_INT_IS_LONG) if (type1 == TCL_NUMBER_LONG) { w1 = l1; -#ifndef TCL_WIDE_INT_IS_LONG } else if (type1 == TCL_NUMBER_WIDE) { w1 = *((const Tcl_WideInt *) ptr1); -#endif } else { goto overflowExpon; } @@ -9022,9 +8972,7 @@ ExecuteExtendedBinaryMathOp( switch (opcode) { case INST_ADD: wResult = w1 + w2; -#ifndef TCL_WIDE_INT_IS_LONG if ((type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_WIDE)) -#endif { /* * Check for overflow. @@ -9038,9 +8986,7 @@ ExecuteExtendedBinaryMathOp( case INST_SUB: wResult = w1 - w2; -#ifndef TCL_WIDE_INT_IS_LONG if ((type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_WIDE)) -#endif { /* * Must check for overflow. The macro tests for overflows @@ -9164,12 +9110,10 @@ ExecuteExtendedUnaryMathOp( switch (opcode) { case INST_BITNOT: -#ifndef TCL_WIDE_INT_IS_LONG if (type == TCL_NUMBER_WIDE) { w = *((const Tcl_WideInt *) ptr); WIDE_RESULT(~w); } -#endif Tcl_TakeBignumFromObj(NULL, valuePtr, &big); /* ~a = - a - 1 */ mp_neg(&big, &big); @@ -9180,13 +9124,6 @@ ExecuteExtendedUnaryMathOp( case TCL_NUMBER_DOUBLE: DOUBLE_RESULT(-(*((const double *) ptr))); case TCL_NUMBER_LONG: - w = (Tcl_WideInt) (*((const long *) ptr)); - if (w != LLONG_MIN) { - WIDE_RESULT(-w); - } - TclInitBignumFromLong(&big, *(const long *) ptr); - break; -#ifndef TCL_WIDE_INT_IS_LONG case TCL_NUMBER_WIDE: w = *((const Tcl_WideInt *) ptr); if (w != LLONG_MIN) { @@ -9194,7 +9131,6 @@ ExecuteExtendedUnaryMathOp( } TclInitBignumFromWideInt(&big, w); break; -#endif default: Tcl_TakeBignumFromObj(NULL, valuePtr, &big); } @@ -9205,7 +9141,6 @@ ExecuteExtendedUnaryMathOp( Tcl_Panic("unexpected opcode"); return NULL; } -#undef LONG_RESULT #undef WIDE_RESULT #undef BIG_RESULT #undef DOUBLE_RESULT @@ -9237,31 +9172,24 @@ TclCompareTwoNumbers( ClientData ptr1, ptr2; mp_int big1, big2; double d1, d2, tmp; - long l1, l2; -#ifndef TCL_WIDE_INT_IS_LONG Tcl_WideInt w1, w2; -#endif (void) GetNumberFromObj(NULL, valuePtr, &ptr1, &type1); (void) GetNumberFromObj(NULL, value2Ptr, &ptr2, &type2); switch (type1) { case TCL_NUMBER_LONG: - l1 = *((const long *)ptr1); + case TCL_NUMBER_WIDE: + w1 = *((const Tcl_WideInt *)ptr1); switch (type2) { case TCL_NUMBER_LONG: - l2 = *((const long *)ptr2); - longCompare: - return (l1 < l2) ? MP_LT : ((l1 > l2) ? MP_GT : MP_EQ); -#ifndef TCL_WIDE_INT_IS_LONG case TCL_NUMBER_WIDE: w2 = *((const Tcl_WideInt *)ptr2); - w1 = (Tcl_WideInt)l1; - goto wideCompare; -#endif + wideCompare: + return (w1 < w2) ? MP_LT : ((w1 > w2) ? MP_GT : MP_EQ); case TCL_NUMBER_DOUBLE: d2 = *((const double *)ptr2); - d1 = (double) l1; + d1 = (double) w1; /* * If the double has a fractional part, or if the long can be @@ -9269,7 +9197,7 @@ TclCompareTwoNumbers( * doubles. */ - if (DBL_MANT_DIG > CHAR_BIT*sizeof(long) || l1 == (long) d1 + if (DBL_MANT_DIG > CHAR_BIT*sizeof(Tcl_WideInt) || w1 == (Tcl_WideInt) d1 || modf(d2, &tmp) != 0.0) { goto doubleCompare; } @@ -9292,44 +9220,6 @@ TclCompareTwoNumbers( if (d2 > (double)LONG_MAX) { return MP_LT; } - l2 = (long) d2; - goto longCompare; - case TCL_NUMBER_BIG: - Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2); - if (mp_cmp_d(&big2, 0) == MP_LT) { - compare = MP_GT; - } else { - compare = MP_LT; - } - mp_clear(&big2); - return compare; - } - -#ifndef TCL_WIDE_INT_IS_LONG - case TCL_NUMBER_WIDE: - w1 = *((const Tcl_WideInt *)ptr1); - switch (type2) { - case TCL_NUMBER_WIDE: - w2 = *((const Tcl_WideInt *)ptr2); - wideCompare: - return (w1 < w2) ? MP_LT : ((w1 > w2) ? MP_GT : MP_EQ); - case TCL_NUMBER_LONG: - l2 = *((const long *)ptr2); - w2 = (Tcl_WideInt)l2; - goto wideCompare; - case TCL_NUMBER_DOUBLE: - d2 = *((const double *)ptr2); - d1 = (double) w1; - if (DBL_MANT_DIG > CHAR_BIT*sizeof(Tcl_WideInt) - || w1 == (Tcl_WideInt) d1 || modf(d2, &tmp) != 0.0) { - goto doubleCompare; - } - if (d2 < (double)LLONG_MIN) { - return MP_GT; - } - if (d2 > (double)LLONG_MAX) { - return MP_LT; - } w2 = (Tcl_WideInt) d2; goto wideCompare; case TCL_NUMBER_BIG: @@ -9342,7 +9232,6 @@ TclCompareTwoNumbers( mp_clear(&big2); return compare; } -#endif case TCL_NUMBER_DOUBLE: d1 = *((const double *)ptr1); @@ -9352,21 +9241,6 @@ TclCompareTwoNumbers( doubleCompare: return (d1 < d2) ? MP_LT : ((d1 > d2) ? MP_GT : MP_EQ); case TCL_NUMBER_LONG: - l2 = *((const long *)ptr2); - d2 = (double) l2; - if (DBL_MANT_DIG > CHAR_BIT*sizeof(long) || l2 == (long) d2 - || modf(d1, &tmp) != 0.0) { - goto doubleCompare; - } - if (d1 < (double)LONG_MIN) { - return MP_LT; - } - if (d1 > (double)LONG_MAX) { - return MP_GT; - } - l1 = (long) d1; - goto longCompare; -#ifndef TCL_WIDE_INT_IS_LONG case TCL_NUMBER_WIDE: w2 = *((const Tcl_WideInt *)ptr2); d2 = (double) w2; @@ -9382,7 +9256,6 @@ TclCompareTwoNumbers( } w1 = (Tcl_WideInt) d1; goto wideCompare; -#endif case TCL_NUMBER_BIG: if (TclIsInfinite(d1)) { return (d1 > 0.0) ? MP_GT : MP_LT; @@ -9410,10 +9283,8 @@ TclCompareTwoNumbers( case TCL_NUMBER_BIG: Tcl_TakeBignumFromObj(NULL, valuePtr, &big1); switch (type2) { -#ifndef TCL_WIDE_INT_IS_LONG - case TCL_NUMBER_WIDE: -#endif case TCL_NUMBER_LONG: + case TCL_NUMBER_WIDE: compare = mp_cmp_d(&big1, 0); mp_clear(&big1); return compare; diff --git a/generic/tclInt.h b/generic/tclInt.h index feffeba..bb02ddf 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2720,9 +2720,7 @@ MODULE_SCOPE const Tcl_ObjType tclDictType; MODULE_SCOPE const Tcl_ObjType tclProcBodyType; MODULE_SCOPE const Tcl_ObjType tclStringType; MODULE_SCOPE const Tcl_ObjType tclEnsembleCmdType; -#ifndef TCL_WIDE_INT_IS_LONG MODULE_SCOPE const Tcl_ObjType tclWideIntType; -#endif MODULE_SCOPE const Tcl_ObjType tclRegexpType; MODULE_SCOPE Tcl_ObjType tclCmdNameType; @@ -4545,11 +4543,13 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; do { \ TclInvalidateStringRep(objPtr); \ TclFreeIntRep(objPtr); \ - (objPtr)->internalRep.wideValue = (long)(i); \ + (objPtr)->internalRep.wideValue = (Tcl_WideInt)(i); \ (objPtr)->typePtr = &tclIntType; \ } while (0) -#ifndef TCL_WIDE_INT_IS_LONG +#ifdef TCL_WIDE_INT_IS_LONG +#define TclSetWideIntObj(objPtr, w) TclSetLongObj(objPtr, w) +#else #define TclSetWideIntObj(objPtr, w) \ do { \ TclInvalidateStringRep(objPtr); \ diff --git a/generic/tclObj.c b/generic/tclObj.c index bf1a2e6..78d7518 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -266,7 +266,6 @@ const Tcl_ObjType tclIntType = { UpdateStringOfInt, /* updateStringProc */ SetIntFromAny /* setFromAnyProc */ }; -#ifndef TCL_WIDE_INT_IS_LONG const Tcl_ObjType tclWideIntType = { "wideInt", /* name */ NULL, /* freeIntRepProc */ @@ -274,7 +273,6 @@ const Tcl_ObjType tclWideIntType = { UpdateStringOfInt, /* updateStringProc */ SetIntFromAny /* setFromAnyProc */ }; -#endif const Tcl_ObjType tclBignumType = { "bignum", /* name */ FreeBignum, /* freeIntRepProc */ @@ -403,9 +401,6 @@ TclInitObjSubsystem(void) /* For backward compatibility only ... */ Tcl_RegisterObjType(&oldBooleanType); -#ifndef TCL_WIDE_INT_IS_LONG - Tcl_RegisterObjType(&tclWideIntType); -#endif #ifdef TCL_COMPILE_STATS Tcl_MutexLock(&tclObjMutex); @@ -1912,12 +1907,10 @@ Tcl_GetBooleanFromObj( *boolPtr = 1; return TCL_OK; } -#ifndef TCL_WIDE_INT_IS_LONG if (objPtr->typePtr == &tclWideIntType) { *boolPtr = (objPtr->internalRep.wideValue != 0); return TCL_OK; } -#endif } while ((ParseBoolean(objPtr) == TCL_OK) || (TCL_OK == TclParseNumber(interp, objPtr, "boolean value", NULL,-1,NULL,0))); return TCL_ERROR; @@ -1967,11 +1960,9 @@ TclSetBooleanFromAny( goto badBoolean; } -#ifndef TCL_WIDE_INT_IS_LONG if (objPtr->typePtr == &tclWideIntType) { goto badBoolean; } -#endif if (objPtr->typePtr == &tclDoubleType) { goto badBoolean; @@ -2300,12 +2291,10 @@ Tcl_GetDoubleFromObj( *dblPtr = TclBignumToDouble(&big); return TCL_OK; } -#ifndef TCL_WIDE_INT_IS_LONG if (objPtr->typePtr == &tclWideIntType) { *dblPtr = (double) objPtr->internalRep.wideValue; return TCL_OK; } -#endif } while (SetDoubleFromAny(interp, objPtr) == TCL_OK); return TCL_ERROR; } @@ -2757,7 +2746,6 @@ Tcl_GetLongFromObj( *longPtr = objPtr->internalRep.wideValue; return TCL_OK; } -#ifndef TCL_WIDE_INT_IS_LONG if (objPtr->typePtr == &tclWideIntType) { /* * We return any integer in the range -ULONG_MAX to ULONG_MAX @@ -2776,7 +2764,6 @@ Tcl_GetLongFromObj( } goto tooLarge; } -#endif if (objPtr->typePtr == &tclDoubleType) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -2815,9 +2802,7 @@ Tcl_GetLongFromObj( return TCL_OK; } } -#ifndef TCL_WIDE_INT_IS_LONG tooLarge: -#endif if (interp != NULL) { const char *s = "integer value too large to represent"; Tcl_Obj *msg = Tcl_NewStringObj(s, -1); @@ -2983,16 +2968,9 @@ Tcl_SetWideIntObj( if ((wideValue >= (Tcl_WideInt) LONG_MIN) && (wideValue <= (Tcl_WideInt) LONG_MAX)) { - TclSetLongObj(objPtr, (long) wideValue); + TclSetLongObj(objPtr, wideValue); } else { -#ifndef TCL_WIDE_INT_IS_LONG TclSetWideIntObj(objPtr, wideValue); -#else - mp_int big; - - TclInitBignumFromWideInt(&big, wideValue); - Tcl_SetBignumObj(objPtr, &big); -#endif } } @@ -3025,12 +3003,10 @@ Tcl_GetWideIntFromObj( /* Place to store resulting long. */ { do { -#ifndef TCL_WIDE_INT_IS_LONG if (objPtr->typePtr == &tclWideIntType) { *wideIntPtr = objPtr->internalRep.wideValue; return TCL_OK; } -#endif if (objPtr->typePtr == &tclIntType) { *wideIntPtr = (Tcl_WideInt) objPtr->internalRep.wideValue; return TCL_OK; @@ -3330,13 +3306,11 @@ GetBignumFromObj( TclInitBignumFromLong(bignumValue, objPtr->internalRep.wideValue); return TCL_OK; } -#ifndef TCL_WIDE_INT_IS_LONG if (objPtr->typePtr == &tclWideIntType) { TclInitBignumFromWideInt(bignumValue, objPtr->internalRep.wideValue); return TCL_OK; } -#endif if (objPtr->typePtr == &tclDoubleType) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -3581,13 +3555,11 @@ TclGetNumberFromObj( *clientDataPtr = &objPtr->internalRep.wideValue; return TCL_OK; } -#ifndef TCL_WIDE_INT_IS_LONG if (objPtr->typePtr == &tclWideIntType) { *typePtr = TCL_NUMBER_WIDE; *clientDataPtr = &objPtr->internalRep.wideValue; return TCL_OK; } -#endif if (objPtr->typePtr == &tclBignumType) { static Tcl_ThreadDataKey bignumKey; mp_int *bigPtr = Tcl_GetThreadData(&bignumKey, diff --git a/generic/tclTimer.c b/generic/tclTimer.c index 4bb5a35..279e110 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.c @@ -819,9 +819,7 @@ Tcl_AfterObjCmd( */ if (objv[1]->typePtr == &tclIntType -#ifndef TCL_WIDE_INT_IS_LONG || objv[1]->typePtr == &tclWideIntType -#endif || objv[1]->typePtr == &tclBignumType || (Tcl_GetIndexFromObj(NULL, objv[1], afterSubCmds, "", 0, &index) != TCL_OK)) { diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 27e1877..198424f 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3769,9 +3769,7 @@ SetEndOffsetFromAny( return TCL_ERROR; } if ((objPtr->typePtr != &tclIntType) -#ifndef TCL_WIDE_INT_IS_LONG && (objPtr->typePtr != &tclWideIntType) -#endif ) { goto badIndexFormat; } -- cgit v0.12 From 3aa68b1a0bf5f1f0d08c76c900f86e3366c062bd Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 30 Oct 2017 14:56:57 +0000 Subject: Patch to make changes to Tcl 9 prescribed by TIPs 330 and 336. This makes the Tcl_Interp struct fully opaque. No interp->result or interp->errorline --- doc/Interp.3 | 13 -- doc/SetResult.3 | 13 -- generic/tcl.h | 42 +----- generic/tclBasic.c | 109 ++------------- generic/tclHistory.c | 7 - generic/tclInt.h | 74 +++-------- generic/tclLoad.c | 11 ++ generic/tclResult.c | 368 ++------------------------------------------------- generic/tclStubLib.c | 5 +- generic/tclTest.c | 8 +- generic/tclUtil.c | 74 ----------- tests/result.test | 4 +- 12 files changed, 62 insertions(+), 666 deletions(-) diff --git a/doc/Interp.3 b/doc/Interp.3 index 731007b..daf76fb 100644 --- a/doc/Interp.3 +++ b/doc/Interp.3 @@ -33,19 +33,6 @@ the pointer as described below is no longer supported. The supported public routines \fBTcl_SetResult\fR, \fBTcl_GetResult\fR, \fBTcl_SetErrorLine\fR, \fBTcl_GetErrorLine\fR must be used instead. .PP -For legacy programs and extensions no longer being maintained, compiles -against the Tcl 8.6 header files are only possible with the compiler -directives -.CS -#define USE_INTERP_RESULT -.CE -and/or -.CS -#define USE_INTERP_ERRORLINE -.CE -depending on which fields of the \fBTcl_Interp\fR struct are accessed. -These directives may be embedded in code or supplied via compiler options. -.PP The \fIresult\fR and \fIfreeProc\fR fields are used to return results or error messages from commands. This information is returned by command procedures back to \fBTcl_Eval\fR, diff --git a/doc/SetResult.3 b/doc/SetResult.3 index e5b81d7..545787c 100644 --- a/doc/SetResult.3 +++ b/doc/SetResult.3 @@ -197,19 +197,6 @@ It also sets \fIinterp->freeProc\fR to zero, but does not change \fIinterp->result\fR or clear error state. \fBTcl_FreeResult\fR is most commonly used when a procedure is about to replace one result value with another. -.SS "DIRECT ACCESS TO INTERP->RESULT" -.PP -It used to be legal for programs to -directly read and write \fIinterp->result\fR -to manipulate the interpreter result. The Tcl headers no longer -permit this access by default, and C code still doing this must -be updated to use supported routines \fBTcl_GetObjResult\fR, -\fBTcl_GetStringResult\fR, \fBTcl_SetObjResult\fR, and \fBTcl_SetResult\fR. -As a migration aid, access can be restored with the compiler directive -.CS -#define USE_INTERP_RESULT -.CE -but this is meant only to offer life support to otherwise dead code. .SH "THE TCL_FREEPROC ARGUMENT TO TCL_SETRESULT" .PP \fBTcl_SetResult\fR's \fIfreeProc\fR argument specifies how diff --git a/generic/tcl.h b/generic/tcl.h index 07d841d..47f0b01 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -492,39 +492,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; * accessed with Tcl_GetObjResult() and Tcl_SetObjResult(). */ -typedef struct Tcl_Interp -#ifndef TCL_NO_DEPRECATED -{ - /* TIP #330: Strongly discourage extensions from using the string - * result. */ -#ifdef USE_INTERP_RESULT - char *result TCL_DEPRECATED_API("use Tcl_GetStringResult/Tcl_SetResult"); - /* If the last command returned a string - * result, this points to it. */ - void (*freeProc) (char *blockPtr) - TCL_DEPRECATED_API("use Tcl_GetStringResult/Tcl_SetResult"); - /* Zero means the string result is statically - * allocated. TCL_DYNAMIC means it was - * allocated with ckalloc and should be freed - * with ckfree. Other values give the address - * of function to invoke to free the result. - * Tcl_Eval must free it before executing next - * command. */ -#else - char *resultDontUse; /* Don't use in extensions! */ - void (*freeProcDontUse) (char *); /* Don't use in extensions! */ -#endif -#ifdef USE_INTERP_ERRORLINE - int errorLine TCL_DEPRECATED_API("use Tcl_GetErrorLine/Tcl_SetErrorLine"); - /* When TCL_ERROR is returned, this gives the - * line number within the command where the - * error occurred (1 if first line). */ -#else - int errorLineDontUse; /* Don't use in extensions! */ -#endif -} -#endif /* !TCL_NO_DEPRECATED */ -Tcl_Interp; +typedef struct Tcl_Interp Tcl_Interp; typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; typedef struct Tcl_Channel_ *Tcl_Channel; @@ -673,8 +641,6 @@ typedef struct stat *Tcl_OldStat_; #define TCL_BREAK 3 #define TCL_CONTINUE 4 -#define TCL_RESULT_SIZE 200 - /* *---------------------------------------------------------------------------- * Flags to control what substitutions are performed by Tcl_SubstObj(): @@ -865,13 +831,7 @@ int Tcl_IsShared(Tcl_Obj *objPtr); */ typedef struct Tcl_SavedResult { - char *result; - Tcl_FreeProc *freeProc; Tcl_Obj *objResultPtr; - char *appendResult; - int appendAvl; - int appendUsed; - char resultSpace[TCL_RESULT_SIZE+1]; } Tcl_SavedResult; /* diff --git a/generic/tclBasic.c b/generic/tclBasic.c index e6022ac..4f11a1a 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -510,13 +510,12 @@ Tcl_CreateInterp(void) iPtr = ckalloc(sizeof(Interp)); interp = (Tcl_Interp *) iPtr; -#ifdef TCL_NO_DEPRECATED - iPtr->result = &tclEmptyString; -#else - iPtr->result = iPtr->resultSpace; -#endif - iPtr->freeProc = NULL; + iPtr->legacyResult = NULL; + /* Special invalid value: Any attempt to free the legacy result + * will cause a crash. */ + iPtr->legacyFreeProc = (void (*) (void))-1; iPtr->errorLine = 0; + iPtr->stubTable = &tclStubs; iPtr->objResultPtr = Tcl_NewObj(); Tcl_IncrRefCount(iPtr->objResultPtr); iPtr->handle = TclHandleCreate(iPtr); @@ -574,12 +573,6 @@ Tcl_CreateInterp(void) iPtr->rootFramePtr = NULL; /* Initialise as soon as :: is available */ iPtr->lookupNsPtr = NULL; -#ifndef TCL_NO_DEPRECATED - iPtr->appendResult = NULL; - iPtr->appendAvl = 0; - iPtr->appendUsed = 0; -#endif - Tcl_InitHashTable(&iPtr->packageTable, TCL_STRING_KEYS); iPtr->packageUnknown = NULL; @@ -608,9 +601,6 @@ Tcl_CreateInterp(void) iPtr->emptyObjPtr = Tcl_NewObj(); /* Another empty object. */ Tcl_IncrRefCount(iPtr->emptyObjPtr); -#ifndef TCL_NO_DEPRECATED - iPtr->resultSpace[0] = 0; -#endif iPtr->threadId = Tcl_GetCurrentThread(); /* TIP #378 */ @@ -721,12 +711,6 @@ Tcl_CreateInterp(void) #endif /* TCL_COMPILE_STATS */ /* - * Initialise the stub table pointer. - */ - - iPtr->stubTable = &tclStubs; - - /* * Initialize the ensemble error message rewriting support. */ @@ -1521,7 +1505,6 @@ DeleteInterpProc( */ Tcl_FreeResult(interp); - iPtr->result = NULL; Tcl_DecrRefCount(iPtr->objResultPtr); iPtr->objResultPtr = NULL; Tcl_DecrRefCount(iPtr->ecVar); @@ -1543,12 +1526,6 @@ DeleteInterpProc( if (iPtr->returnOpts) { Tcl_DecrRefCount(iPtr->returnOpts); } -#ifndef TCL_NO_DEPRECATED - if (iPtr->appendResult != NULL) { - ckfree(iPtr->appendResult); - iPtr->appendResult = NULL; - } -#endif TclFreePackageInfo(iPtr); while (iPtr->tracePtr != NULL) { Tcl_DeleteTrace((Tcl_Interp *) iPtr, (Tcl_Trace) iPtr->tracePtr); @@ -2482,7 +2459,7 @@ TclInvokeStringCommand( * in the Command structure. * * Results: - * A standard Tcl string result value. + * A standard Tcl result value. * * Side effects: * Besides those side effects of the called Tcl_ObjCmdProc, @@ -2523,13 +2500,6 @@ TclInvokeObjectCommand( } /* - * 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. */ @@ -3833,7 +3803,7 @@ Tcl_ListMathFuncs( * otherwise. * * Side effects: - * The interpreters object and string results are cleared. + * The interpreter's result is cleared. * *---------------------------------------------------------------------- */ @@ -3845,8 +3815,8 @@ TclInterpReady( register Interp *iPtr = (Interp *) interp; /* - * Reset both the interpreter's string and object results and clear out - * any previous error information. + * Reset the interpreter's result and clear out any previous error + * information. */ Tcl_ResetResult(interp); @@ -4426,24 +4396,9 @@ TclNRRunCallbacks( /* All callbacks down to rootPtr not inclusive * are to be run. */ { - Interp *iPtr = (Interp *) interp; NRE_callback *callbackPtr; Tcl_NRPostProc *procPtr; - /* - * If the interpreter has a non-empty string result, the result object is - * either empty or stale because some function set interp->result - * directly. If so, move the string result to the result object, then - * reset the string result. - * - * This only needs to be done for the first item in the list: all other - * are for NR function calls, and those are Tcl_Obj based. - */ - - if (*(iPtr->result) != 0) { - (void) Tcl_GetObjResult(interp); - } - while (TOP_CB(interp) != rootPtr) { callbackPtr = TOP_CB(interp); procPtr = callbackPtr->procPtr; @@ -5911,16 +5866,7 @@ Tcl_Eval( * 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). - */ - - (void) Tcl_GetStringResult(interp); - return code; + return Tcl_EvalEx(interp, script, -1, 0); } /* @@ -6343,9 +6289,6 @@ Tcl_ExprLong( Tcl_IncrRefCount(exprPtr); result = Tcl_ExprLongObj(interp, exprPtr, ptr); Tcl_DecrRefCount(exprPtr); - if (result != TCL_OK) { - (void) Tcl_GetStringResult(interp); - } } return result; } @@ -6372,9 +6315,6 @@ Tcl_ExprDouble( result = Tcl_ExprDoubleObj(interp, exprPtr, ptr); Tcl_DecrRefCount(exprPtr); /* Discard the expression object. */ - if (result != TCL_OK) { - (void) Tcl_GetStringResult(interp); - } } return result; } @@ -6400,14 +6340,6 @@ Tcl_ExprBoolean( 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; } } @@ -6723,11 +6655,6 @@ Tcl_ExprString( } } - /* - * Force the string rep of the interp result. - */ - - (void) Tcl_GetStringResult(interp); return code; } @@ -6834,19 +6761,7 @@ Tcl_AddObjErrorInfo( iPtr->flags |= ERR_LEGACY_COPY; if (iPtr->errorInfo == NULL) { - if (iPtr->result[0] != 0) { - /* - * The interp's string result is set, apparently by some extension - * making a deprecated direct write to it. That extension may - * expect interp->result to continue to be set, so we'll take - * special pains to avoid clearing it, until we drop support for - * interp->result completely. - */ - - iPtr->errorInfo = Tcl_NewStringObj(iPtr->result, -1); - } else { - iPtr->errorInfo = iPtr->objResultPtr; - } + iPtr->errorInfo = iPtr->objResultPtr; Tcl_IncrRefCount(iPtr->errorInfo); if (!iPtr->errorCode) { Tcl_SetErrorCode(interp, "NONE", NULL); @@ -6924,7 +6839,7 @@ Tcl_VarEvalVA( * * Results: * A standard Tcl return result. An error message or other result may be - * left in interp->result. + * left in the interp. * * Side effects: * Depends on what was done by the command. diff --git a/generic/tclHistory.c b/generic/tclHistory.c index 47806d4..0c8201a 100644 --- a/generic/tclHistory.c +++ b/generic/tclHistory.c @@ -74,13 +74,6 @@ Tcl_RecordAndEval( result = Tcl_RecordAndEvalObj(interp, cmdPtr, flags); /* - * Move the interpreter's object result to the string result, then - * reset the object result. - */ - - (void) Tcl_GetStringResult(interp); - - /* * Discard the Tcl object created to hold the command. */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 0b5ff0c..6278267 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1773,41 +1773,31 @@ typedef struct AllocCache { typedef struct Interp { /* - * Note: the first three fields must match exactly the fields in a - * Tcl_Interp struct (see tcl.h). If you change one, be sure to change the - * other. - * - * The interpreter's result is held in both the string and the - * objResultPtr fields. These fields hold, respectively, the result's - * string or object value. The interpreter's result is always in the - * result field if that is non-empty, otherwise it is in objResultPtr. - * The two fields are kept consistent unless some C code sets - * interp->result directly. Programs should not access result and - * objResultPtr directly; instead, they should always get and set the - * result using procedures such as Tcl_SetObjResult, Tcl_GetObjResult, and - * Tcl_GetStringResult. See the SetResult man page for details. + * The first two fields were named "result" and "freeProc" in earlier + * verions of Tcl. They are no longer used within Tcl, and are no + * longer available to be accessed by extensions. However, they cannot + * be removed. Why? There is a deployed base of stub-enabled extensions + * that query the value of iPtr->stubTable. For them to continue to work, + * the location of the field "stubTable" within the Interp struct cannot + * change. The most robust way to assure that is to leave all fields up to + * that one undisturbed. */ - char *result; /* If the last command returned a string - * result, this points to it. Should not be - * accessed directly; see comment above. */ - Tcl_FreeProc *freeProc; /* Zero means a string result is statically - * allocated. TCL_DYNAMIC means string result - * was allocated with ckalloc and should be - * freed with ckfree. Other values give - * address of procedure to invoke to free the - * string result. Tcl_Eval must free it before - * executing next command. */ + const char *legacyResult; + void (*legacyFreeProc) (void); int errorLine; /* When TCL_ERROR is returned, this gives the * line number in the command where the error * occurred (1 means first line). */ const struct TclStubs *stubTable; - /* Pointer to the exported Tcl stub table. On - * previous versions of Tcl this is a pointer - * to the objResultPtr or a pointer to a - * buckets array in a hash table. We therefore - * have to do some careful checking before we - * can use this. */ + /* Pointer to the exported Tcl stub table. In + * ancient pre-8.1 versions of Tcl this was a + * pointer to the objResultptr or a pointer to a + * buckets array in a hash table. Deployed stubs + * enabled extensions check for a NULL pointer value + * and for a TCL_STUBS_MAGIC value to verify they + * are not [load]ing into one of those pre-stubs + * interps. + */ TclHandle handle; /* Handle used to keep track of when this * interp is deleted. */ @@ -1858,25 +1848,6 @@ typedef struct Interp { * TCL_EVAL_INVOKE call to Tcl_EvalObjv. */ /* - * Information used by Tcl_AppendResult to keep track of partial results. - * See Tcl_AppendResult code for details. - */ - -#ifndef TCL_NO_DEPRECATED - char *appendResult; /* Storage space for results generated by - * Tcl_AppendResult. Ckalloc-ed. NULL means - * not yet allocated. */ - int appendAvl; /* Total amount of space available at - * partialResult. */ - int appendUsed; /* Number of non-null bytes currently stored - * at partialResult. */ -#else - char *appendResultDontUse; - int appendAvlDontUse; - int appendUsedDontUse; -#endif - - /* * Information about packages. Used only in tclPkg.c. */ @@ -1898,7 +1869,6 @@ typedef struct Interp { * Normally zero, but may be set before * calling Tcl_Eval. See below for valid * values. */ - int unused1; /* No longer used (was termOffset) */ LiteralTable literalTable; /* Contains LiteralEntry's describing all Tcl * objects holding literals of scripts * compiled by the interpreter. Indexed by the @@ -1936,12 +1906,6 @@ typedef struct Interp { * string. Returned by Tcl_ObjSetVar2 when * variable traces change a variable in a * gross way. */ -#ifndef TCL_NO_DEPRECATED - char resultSpace[TCL_RESULT_SIZE+1]; - /* Static space holding small results. */ -#else - char resultSpaceDontUse[TCL_RESULT_SIZE+1]; -#endif Tcl_Obj *objResultPtr; /* If the last command returned an object * result, this points to it. Should not be * accessed directly; see comment above. */ diff --git a/generic/tclLoad.c b/generic/tclLoad.c index e0bb5ef..87bb1c1 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -470,6 +470,17 @@ Tcl_LoadObjCmd( */ if (code != TCL_OK) { + Interp *iPtr = (Interp *) target; + if (iPtr->legacyResult && !iPtr->legacyFreeProc) { + /* + * A call to Tcl_InitStubs() determined the caller extension and + * this interp are incompatible in their stubs mechanisms, and + * recorded the error in the oldest legacy place we have to do so. + */ + Tcl_SetObjResult(target, Tcl_NewStringObj(iPtr->legacyResult, -1)); + iPtr->legacyResult = NULL; + iPtr->legacyFreeProc = (void (*) (void))-1; + } Tcl_TransferResult(target, code, interp); goto done; } diff --git a/generic/tclResult.c b/generic/tclResult.c index 57a6de5..0f44ed2 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -27,9 +27,6 @@ enum returnKeys { static Tcl_Obj ** GetKeys(void); static void ReleaseKeys(ClientData clientData); static void ResetObjResult(Interp *iPtr); -#ifndef TCL_NO_DEPRECATED -static void SetupAppendBuffer(Interp *iPtr, int newSpace); -#endif /* !TCL_NO_DEPRECATED */ /* * This structure is used to take a snapshot of the interpreter state in @@ -250,44 +247,6 @@ Tcl_SaveResult( statePtr->objResultPtr = iPtr->objResultPtr; iPtr->objResultPtr = Tcl_NewObj(); Tcl_IncrRefCount(iPtr->objResultPtr); - - /* - * Save the string result. - */ - - statePtr->freeProc = iPtr->freeProc; - if (iPtr->result == iPtr->resultSpace) { - /* - * Copy the static string data out of the interp buffer. - */ - - statePtr->result = statePtr->resultSpace; - strcpy(statePtr->result, iPtr->result); - statePtr->appendResult = NULL; - } else if (iPtr->result == iPtr->appendResult) { - /* - * Move the append buffer out of the interp. - */ - - statePtr->appendResult = iPtr->appendResult; - statePtr->appendAvl = iPtr->appendAvl; - statePtr->appendUsed = iPtr->appendUsed; - statePtr->result = statePtr->appendResult; - iPtr->appendResult = NULL; - iPtr->appendAvl = 0; - iPtr->appendUsed = 0; - } else { - /* - * Move the dynamic or static string out of the interpreter. - */ - - statePtr->result = iPtr->result; - statePtr->appendResult = NULL; - } - - iPtr->result = iPtr->resultSpace; - iPtr->resultSpace[0] = 0; - iPtr->freeProc = 0; } /* @@ -319,39 +278,6 @@ Tcl_RestoreResult( Tcl_ResetResult(interp); /* - * Restore the string result. - */ - - iPtr->freeProc = statePtr->freeProc; - if (statePtr->result == statePtr->resultSpace) { - /* - * Copy the static string data into the interp buffer. - */ - - iPtr->result = iPtr->resultSpace; - strcpy(iPtr->result, statePtr->result); - } else if (statePtr->result == statePtr->appendResult) { - /* - * Move the append buffer back into the interp. - */ - - if (iPtr->appendResult != NULL) { - ckfree(iPtr->appendResult); - } - - iPtr->appendResult = statePtr->appendResult; - iPtr->appendAvl = statePtr->appendAvl; - iPtr->appendUsed = statePtr->appendUsed; - iPtr->result = iPtr->appendResult; - } else { - /* - * Move the dynamic or static string back into the interpreter. - */ - - iPtr->result = statePtr->result; - } - - /* * Restore the object result. */ @@ -383,14 +309,6 @@ Tcl_DiscardResult( Tcl_SavedResult *statePtr) /* State returned by Tcl_SaveResult. */ { TclDecrRefCount(statePtr->objResultPtr); - - if (statePtr->result == statePtr->appendResult) { - ckfree(statePtr->appendResult); - } else if (statePtr->freeProc == TCL_DYNAMIC) { - ckfree(statePtr->result); - } else if (statePtr->freeProc) { - statePtr->freeProc(statePtr->result); - } } /* @@ -420,49 +338,15 @@ Tcl_SetResult( * TCL_STATIC, TCL_VOLATILE, or the address of * a Tcl_FreeProc such as free. */ { - Interp *iPtr = (Interp *) interp; - 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) { - int length = strlen(result); - - if (length > TCL_RESULT_SIZE) { - iPtr->result = ckalloc(length + 1); - iPtr->freeProc = TCL_DYNAMIC; - } else { - iPtr->result = iPtr->resultSpace; - iPtr->freeProc = 0; - } - memcpy(iPtr->result, result, (unsigned) length+1); - } else { - iPtr->result = (char *) result; - iPtr->freeProc = freeProc; + Tcl_SetObjResult(interp, Tcl_NewStringObj(result, -1)); + if (result == NULL || freeProc == NULL || freeProc == TCL_VOLATILE) { + return; } - - /* - * 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. - */ - - if (oldFreeProc != 0) { - if (oldFreeProc == TCL_DYNAMIC) { - ckfree(oldResult); - } else { - oldFreeProc(oldResult); - } + if (freeProc == TCL_DYNAMIC) { + ckfree(result); + } else { + (*freeProc)(result); } - - /* - * Reset the object result since we just set the string result. - */ - - ResetObjResult(iPtr); } #endif /* !TCL_NO_DEPRECATED */ @@ -488,20 +372,7 @@ Tcl_GetStringResult( register Tcl_Interp *interp)/* Interpreter whose result to return. */ { Interp *iPtr = (Interp *) interp; -#ifdef TCL_NO_DEPRECATED return Tcl_GetString(iPtr->objResultPtr); -#else - /* - * If the string result is empty, move the object result to the string - * result, then reset the object result. - */ - - if (*(iPtr->result) == 0) { - Tcl_SetResult(interp, TclGetString(Tcl_GetObjResult(interp)), - TCL_VOLATILE); - } - return iPtr->result; -#endif } /* @@ -542,23 +413,6 @@ Tcl_SetObjResult( */ TclDecrRefCount(oldObjResult); - -#ifndef TCL_NO_DEPRECATED - /* - * Reset the string result since we just set the result object. - */ - - if (iPtr->freeProc != NULL) { - if (iPtr->freeProc == TCL_DYNAMIC) { - ckfree(iPtr->result); - } else { - iPtr->freeProc(iPtr->result); - } - iPtr->freeProc = 0; - } - iPtr->result = iPtr->resultSpace; - iPtr->resultSpace[0] = 0; -#endif } /* @@ -587,34 +441,6 @@ Tcl_GetObjResult( Tcl_Interp *interp) /* Interpreter whose result to return. */ { register Interp *iPtr = (Interp *) interp; -#ifndef TCL_NO_DEPRECATED - Tcl_Obj *objResultPtr; - int length; - - /* - * If the string result is non-empty, move the string result to the object - * result, then reset the string result. - */ - - if (iPtr->result[0] != 0) { - ResetObjResult(iPtr); - - objResultPtr = iPtr->objResultPtr; - length = strlen(iPtr->result); - TclInitStringRep(objResultPtr, iPtr->result, length); - - if (iPtr->freeProc != NULL) { - if (iPtr->freeProc == TCL_DYNAMIC) { - ckfree(iPtr->result); - } else { - iPtr->freeProc(iPtr->result); - } - iPtr->freeProc = 0; - } - iPtr->result = iPtr->resultSpace; - iPtr->result[0] = 0; - } -#endif /* !TCL_NO_DEPRECATED */ return iPtr->objResultPtr; } @@ -651,23 +477,6 @@ Tcl_AppendResultVA( } Tcl_AppendStringsToObjVA(objPtr, argList); Tcl_SetObjResult(interp, objPtr); - - /* - * Strictly we should call Tcl_GetStringResult(interp) here to make sure - * that interp->result is correct according to the old contract, but that - * makes the performance of much code (e.g. in Tk) absolutely awful. So we - * leave it out; code that really wants interp->result can just insert the - * calls to Tcl_GetStringResult() itself. [Patch 1041072 discussion] - */ - -#ifdef USE_INTERP_RESULT - /* - * Ensure that the interp->result is legal so old Tcl 7.* code still - * works. There's still embarrasingly much of it about... - */ - - (void) Tcl_GetStringResult(interp); -#endif /* USE_INTERP_RESULT */ } /* @@ -733,7 +542,6 @@ Tcl_AppendElement( * to result. */ { Interp *iPtr = (Interp *) interp; -#ifdef TCL_NO_DEPRECATED Tcl_Obj *elementPtr = Tcl_NewStringObj(element, -1); Tcl_Obj *listPtr = Tcl_NewListObj(1, &elementPtr); const char *bytes; @@ -747,134 +555,7 @@ Tcl_AppendElement( } Tcl_AppendObjToObj(iPtr->objResultPtr, listPtr); Tcl_DecrRefCount(listPtr); -#else - 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); - } - - /* - * Convert the string into a list element and copy it to the buffer that's - * forming, with a space separator if needed. - */ - - dst = iPtr->appendResult + iPtr->appendUsed; - if (TclNeedSpace(iPtr->appendResult, dst)) { - iPtr->appendUsed++; - *dst = ' '; - dst++; - - /* - * 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); -#endif /* !TCL_NO_DEPRECATED */ -} - -/* - *---------------------------------------------------------------------- - * - * SetupAppendBuffer -- - * - * This function makes sure that there is an append buffer properly - * initialized, if necessary, from the interpreter's result, and that it - * has at least enough room to accommodate newSpace new bytes of - * information. - * - * Results: - * None. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -#ifndef TCL_NO_DEPRECATED -static void -SetupAppendBuffer( - Interp *iPtr, /* Interpreter whose result is being set up. */ - int newSpace) /* Make sure that at least this many bytes of - * new information may be added. */ -{ - int totalSpace; - - /* - * Make the append buffer larger, if that's necessary, then copy the - * result into the append buffer and make the append buffer the official - * Tcl result. - */ - - if (iPtr->result != iPtr->appendResult) { - /* - * If an oversized buffer was used recently, then free it up so we go - * back to a smaller buffer. This avoids tying up memory forever after - * a large operation. - */ - - if (iPtr->appendAvl > 500) { - ckfree(iPtr->appendResult); - iPtr->appendResult = NULL; - iPtr->appendAvl = 0; - } - iPtr->appendUsed = strlen(iPtr->result); - } else if (iPtr->result[iPtr->appendUsed] != 0) { - /* - * Most likely someone has modified a result created by - * Tcl_AppendResult et al. so that it has a different size. Just - * recompute the size. - */ - - iPtr->appendUsed = strlen(iPtr->result); - } - - totalSpace = newSpace + iPtr->appendUsed; - if (totalSpace >= iPtr->appendAvl) { - char *new; - - if (totalSpace < 100) { - totalSpace = 200; - } else { - totalSpace *= 2; - } - new = ckalloc(totalSpace); - strcpy(new, iPtr->result); - if (iPtr->appendResult != NULL) { - ckfree(iPtr->appendResult); - } - iPtr->appendResult = new; - iPtr->appendAvl = totalSpace; - } else if (iPtr->result != iPtr->appendResult) { - strcpy(iPtr->appendResult, iPtr->result); - } - - Tcl_FreeResult((Tcl_Interp *) iPtr); - iPtr->result = iPtr->appendResult; } -#endif /* !TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- @@ -882,18 +563,16 @@ SetupAppendBuffer( * Tcl_FreeResult -- * * This function frees up the memory associated with an interpreter's - * string result. It also resets the interpreter's result object. - * Tcl_FreeResult is most commonly used when a function is about to - * replace one result value with another. + * result, resetting the interpreter's result object. Tcl_FreeResult is + * most commonly used when a function is about to replace one result + * value with another. * * Results: * None. * * Side effects: - * Frees the memory associated with interp's string result and sets - * interp->freeProc to zero, but does not change interp->result or clear - * error state. Resets interp's result object to an unshared empty - * object. + * Frees the memory associated with interp's result but does not change + * any part of the error dictionary. * *---------------------------------------------------------------------- */ @@ -904,17 +583,6 @@ Tcl_FreeResult( { register Interp *iPtr = (Interp *) interp; -#ifndef TCL_NO_DEPRECATED - if (iPtr->freeProc != NULL) { - if (iPtr->freeProc == TCL_DYNAMIC) { - ckfree(iPtr->result); - } else { - iPtr->freeProc(iPtr->result); - } - iPtr->freeProc = 0; - } - -#endif /* !TCL_NO_DEPRECATED */ ResetObjResult(iPtr); } @@ -944,18 +612,6 @@ Tcl_ResetResult( register Interp *iPtr = (Interp *) interp; ResetObjResult(iPtr); -#ifndef TCL_NO_DEPRECATED - if (iPtr->freeProc != NULL) { - if (iPtr->freeProc == TCL_DYNAMIC) { - ckfree(iPtr->result); - } else { - iPtr->freeProc(iPtr->result); - } - iPtr->freeProc = 0; - } - iPtr->result = iPtr->resultSpace; - iPtr->resultSpace[0] = 0; -#endif /* !TCL_NO_DEPRECATED */ if (iPtr->errorCode) { /* Legacy support */ if (iPtr->flags & ERR_LEGACY_COPY) { diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c index 5261591..a135465 100644 --- a/generic/tclStubLib.c +++ b/generic/tclStubLib.c @@ -66,8 +66,9 @@ Tcl_InitStubs( */ if (!stubsPtr || (stubsPtr->magic != (((exact&0xff00) >= 0x900) ? magic : TCL_STUB_MAGIC))) { - iPtr->result = (char *)"interpreter uses an incompatible stubs mechanism"; - iPtr->freeProc = 0; + iPtr->legacyResult + = "interpreter uses an incompatible stubs mechanism"; + iPtr->legacyFreeProc = 0; /* TCL_STATIC */ return NULL; } diff --git a/generic/tclTest.c b/generic/tclTest.c index ebd90ae..6e357c2 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -5187,7 +5187,6 @@ TestsaveresultCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* The argument objects. */ { - Interp* iPtr = (Interp*) interp; int discard, result, index; Tcl_SavedResult state; Tcl_Obj *objPtr; @@ -5255,12 +5254,9 @@ TestsaveresultCmd( } switch ((enum options) index) { - case RESULT_DYNAMIC: { - int presentOrFreed = (iPtr->freeProc == TestsaveresultFree) ^ freeCount; - - Tcl_AppendElement(interp, presentOrFreed ? "presentOrFreed" : "missingOrLeak"); + case RESULT_DYNAMIC: + Tcl_AppendElement(interp, freeCount ? "freed" : "leak"); break; - } case RESULT_OBJECT: Tcl_AppendElement(interp, Tcl_GetObjResult(interp) == objPtr ? "same" : "different"); diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 608cd15..3f809d5 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2923,86 +2923,12 @@ Tcl_DStringGetResult( Tcl_DString *dsPtr) /* Dynamic string that is to become the result * of interp. */ { -#ifdef TCL_NO_DEPRECATED Tcl_Obj *obj = Tcl_GetObjResult(interp); const char *bytes = TclGetString(obj); Tcl_DStringFree(dsPtr); Tcl_DStringAppend(dsPtr, bytes, obj->length); Tcl_ResetResult(interp); -#else - Interp *iPtr = (Interp *) interp; - - if (dsPtr->string != dsPtr->staticSpace) { - ckfree(dsPtr->string); - } - - /* - * Do more efficient transfer when we know the result is a Tcl_Obj. When - * there's no string result, we only have to deal with two cases: - * - * 1. When the string rep is the empty string, when we don't copy but - * instead use the staticSpace in the DString to hold an empty string. - - * 2. When the string rep is not there or there's a real string rep, when - * we use Tcl_GetString to fetch (or generate) the string rep - which - * we know to have been allocated with ckalloc() - and use it to - * populate the DString space. Then, we free the internal rep. and set - * the object's string representation back to the canonical empty - * string. - */ - - if (!iPtr->result[0] && iPtr->objResultPtr - && !Tcl_IsShared(iPtr->objResultPtr)) { - if (iPtr->objResultPtr->bytes == &tclEmptyString) { - dsPtr->string = dsPtr->staticSpace; - dsPtr->string[0] = 0; - dsPtr->length = 0; - dsPtr->spaceAvl = TCL_DSTRING_STATIC_SIZE; - } else { - dsPtr->string = TclGetString(iPtr->objResultPtr); - dsPtr->length = iPtr->objResultPtr->length; - dsPtr->spaceAvl = dsPtr->length + 1; - TclFreeIntRep(iPtr->objResultPtr); - iPtr->objResultPtr->bytes = &tclEmptyString; - iPtr->objResultPtr->length = 0; - } - return; - } - - /* - * If the string result is empty, move the object result to the string - * result, then reset the object result. - */ - - (void) Tcl_GetStringResult(interp); - - dsPtr->length = strlen(iPtr->result); - if (iPtr->freeProc != NULL) { - if (iPtr->freeProc == TCL_DYNAMIC) { - dsPtr->string = iPtr->result; - dsPtr->spaceAvl = dsPtr->length+1; - } else { - dsPtr->string = ckalloc(dsPtr->length+1); - memcpy(dsPtr->string, iPtr->result, (unsigned) dsPtr->length+1); - iPtr->freeProc(iPtr->result); - } - dsPtr->spaceAvl = dsPtr->length+1; - iPtr->freeProc = NULL; - } else { - if (dsPtr->length < TCL_DSTRING_STATIC_SIZE) { - dsPtr->string = dsPtr->staticSpace; - dsPtr->spaceAvl = TCL_DSTRING_STATIC_SIZE; - } else { - dsPtr->string = ckalloc(dsPtr->length+1); - dsPtr->spaceAvl = dsPtr->length + 1; - } - memcpy(dsPtr->string, iPtr->result, (unsigned) dsPtr->length+1); - } - - iPtr->result = iPtr->resultSpace; - iPtr->resultSpace[0] = 0; -#endif /* !TCL_NO_DEPRECATED */ } /* diff --git a/tests/result.test b/tests/result.test index 859e546..1eff46e 100644 --- a/tests/result.test +++ b/tests/result.test @@ -31,7 +31,7 @@ test result-1.2 {Tcl_SaveInterpResult} {testsaveresult} { } {append result} test result-1.3 {Tcl_SaveInterpResult} {testsaveresult} { testsaveresult dynamic {set x 42} 0 -} {dynamic result presentOrFreed} +} {dynamic result freed} test result-1.4 {Tcl_SaveInterpResult} {testsaveresult} { testsaveresult object {set x 42} 0 } {object result same} @@ -43,7 +43,7 @@ test result-1.6 {Tcl_SaveInterpResult} {testsaveresult} { } {42} test result-1.7 {Tcl_SaveInterpResult} {testsaveresult} { testsaveresult dynamic {set x 42} 1 -} {42 presentOrFreed} +} {42 freed} test result-1.8 {Tcl_SaveInterpResult} {testsaveresult} { testsaveresult object {set x 42} 1 } {42 different} -- cgit v0.12 From 9e80ee005ea69417d49687f4e51dd80bba72deee Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 30 Oct 2017 15:15:06 +0000 Subject: tidying --- generic/tcl.h | 5 ++--- generic/tclBasic.c | 3 +-- generic/tclInt.h | 4 ++-- generic/tclLoad.c | 22 +++++++++++----------- generic/tclStubLib.c | 3 +-- generic/tclUtil.c | 6 +++--- 6 files changed, 20 insertions(+), 23 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 47f0b01..0d40f41 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -825,9 +825,8 @@ int Tcl_IsShared(Tcl_Obj *objPtr); /* *---------------------------------------------------------------------------- - * The following structure contains the state needed by Tcl_SaveResult. No-one - * outside of Tcl should access any of these fields. This structure is - * typically allocated on the stack. + * The following type contains the state needed by Tcl_SaveResult. This + * structure is typically allocated on the stack. */ typedef struct Tcl_SavedResult { diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 4f11a1a..32808b8 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -6654,7 +6654,6 @@ Tcl_ExprString( Tcl_DecrRefCount(resultPtr); } } - return code; } @@ -6761,7 +6760,7 @@ Tcl_AddObjErrorInfo( iPtr->flags |= ERR_LEGACY_COPY; if (iPtr->errorInfo == NULL) { - iPtr->errorInfo = iPtr->objResultPtr; + iPtr->errorInfo = iPtr->objResultPtr; Tcl_IncrRefCount(iPtr->errorInfo); if (!iPtr->errorCode) { Tcl_SetErrorCode(interp, "NONE", NULL); diff --git a/generic/tclInt.h b/generic/tclInt.h index 6278267..9b5efd1 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1774,7 +1774,7 @@ typedef struct AllocCache { typedef struct Interp { /* * The first two fields were named "result" and "freeProc" in earlier - * verions of Tcl. They are no longer used within Tcl, and are no + * versions of Tcl. They are no longer used within Tcl, and are no * longer available to be accessed by extensions. However, they cannot * be removed. Why? There is a deployed base of stub-enabled extensions * that query the value of iPtr->stubTable. For them to continue to work, @@ -1792,7 +1792,7 @@ typedef struct Interp { /* Pointer to the exported Tcl stub table. In * ancient pre-8.1 versions of Tcl this was a * pointer to the objResultptr or a pointer to a - * buckets array in a hash table. Deployed stubs + * buckets array in a hash table. Deployed stubs * enabled extensions check for a NULL pointer value * and for a TCL_STUBS_MAGIC value to verify they * are not [load]ing into one of those pre-stubs diff --git a/generic/tclLoad.c b/generic/tclLoad.c index 87bb1c1..4e6ee2f 100644 --- a/generic/tclLoad.c +++ b/generic/tclLoad.c @@ -470,17 +470,17 @@ Tcl_LoadObjCmd( */ if (code != TCL_OK) { - Interp *iPtr = (Interp *) target; - if (iPtr->legacyResult && !iPtr->legacyFreeProc) { - /* - * A call to Tcl_InitStubs() determined the caller extension and - * this interp are incompatible in their stubs mechanisms, and - * recorded the error in the oldest legacy place we have to do so. - */ - Tcl_SetObjResult(target, Tcl_NewStringObj(iPtr->legacyResult, -1)); - iPtr->legacyResult = NULL; - iPtr->legacyFreeProc = (void (*) (void))-1; - } + Interp *iPtr = (Interp *) target; + if (iPtr->legacyResult && !iPtr->legacyFreeProc) { + /* + * A call to Tcl_InitStubs() determined the caller extension and + * this interp are incompatible in their stubs mechanisms, and + * recorded the error in the oldest legacy place we have to do so. + */ + Tcl_SetObjResult(target, Tcl_NewStringObj(iPtr->legacyResult, -1)); + iPtr->legacyResult = NULL; + iPtr->legacyFreeProc = (void (*) (void))-1; + } Tcl_TransferResult(target, code, interp); goto done; } diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c index a135465..b26fb01 100644 --- a/generic/tclStubLib.c +++ b/generic/tclStubLib.c @@ -66,8 +66,7 @@ Tcl_InitStubs( */ if (!stubsPtr || (stubsPtr->magic != (((exact&0xff00) >= 0x900) ? magic : TCL_STUB_MAGIC))) { - iPtr->legacyResult - = "interpreter uses an incompatible stubs mechanism"; + iPtr->legacyResult = "interpreter uses an incompatible stubs mechanism"; iPtr->legacyFreeProc = 0; /* TCL_STATIC */ return NULL; } diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 3f809d5..5c0f55c 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2923,11 +2923,11 @@ Tcl_DStringGetResult( Tcl_DString *dsPtr) /* Dynamic string that is to become the result * of interp. */ { - Tcl_Obj *obj = Tcl_GetObjResult(interp); - const char *bytes = TclGetString(obj); + int length; + char *bytes = TclGetStringFromObj(Tcl_GetObjResult(interp), &length); Tcl_DStringFree(dsPtr); - Tcl_DStringAppend(dsPtr, bytes, obj->length); + Tcl_DStringAppend(dsPtr, bytes, length); Tcl_ResetResult(interp); } -- cgit v0.12 From 312263821fb4b272cff0d1b7de06da1260a75112 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 30 Oct 2017 15:25:36 +0000 Subject: tidy --- generic/tclInt.h | 18 +++++++++--------- generic/tclResult.c | 5 ++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 9b5efd1..84c8f5f 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1789,15 +1789,15 @@ typedef struct Interp { * line number in the command where the error * occurred (1 means first line). */ const struct TclStubs *stubTable; - /* Pointer to the exported Tcl stub table. In - * ancient pre-8.1 versions of Tcl this was a - * pointer to the objResultptr or a pointer to a - * buckets array in a hash table. Deployed stubs - * enabled extensions check for a NULL pointer value - * and for a TCL_STUBS_MAGIC value to verify they - * are not [load]ing into one of those pre-stubs - * interps. - */ + /* Pointer to the exported Tcl stub table. In + * ancient pre-8.1 versions of Tcl this was a + * pointer to the objResultPtr or a pointer to a + * buckets array in a hash table. Deployed stubs + * enabled extensions check for a NULL pointer value + * and for a TCL_STUBS_MAGIC value to verify they + * are not [load]ing into one of those pre-stubs + * interps. + */ TclHandle handle; /* Handle used to keep track of when this * interp is deleted. */ diff --git a/generic/tclResult.c b/generic/tclResult.c index 0f44ed2..fb97e0b 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -372,6 +372,7 @@ Tcl_GetStringResult( register Tcl_Interp *interp)/* Interpreter whose result to return. */ { Interp *iPtr = (Interp *) interp; + return Tcl_GetString(iPtr->objResultPtr); } @@ -441,6 +442,7 @@ Tcl_GetObjResult( Tcl_Interp *interp) /* Interpreter whose result to return. */ { register Interp *iPtr = (Interp *) interp; + return iPtr->objResultPtr; } @@ -572,7 +574,8 @@ Tcl_AppendElement( * * Side effects: * Frees the memory associated with interp's result but does not change - * any part of the error dictionary. + * any part of the error dictionary (i.e., the errorinfo and errorcode + * remain the same). * *---------------------------------------------------------------------- */ -- cgit v0.12 From 9a322ef01682c544f3a875c9c5f961b4428a9aee Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 30 Oct 2017 15:35:58 +0000 Subject: tidy? --- generic/tclInt.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 84c8f5f..6f87abc 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1789,15 +1789,15 @@ typedef struct Interp { * line number in the command where the error * occurred (1 means first line). */ const struct TclStubs *stubTable; - /* Pointer to the exported Tcl stub table. In - * ancient pre-8.1 versions of Tcl this was a - * pointer to the objResultPtr or a pointer to a - * buckets array in a hash table. Deployed stubs - * enabled extensions check for a NULL pointer value - * and for a TCL_STUBS_MAGIC value to verify they - * are not [load]ing into one of those pre-stubs - * interps. - */ + /* Pointer to the exported Tcl stub table. In + * ancient pre-8.1 versions of Tcl this was a + * pointer to the objResultPtr or a pointer to a + * buckets array in a hash table. Deployed stubs + * enabled extensions check for a NULL pointer value + * and for a TCL_STUBS_MAGIC value to verify they + * are not [load]ing into one of those pre-stubs + * interps. + */ TclHandle handle; /* Handle used to keep track of when this * interp is deleted. */ -- cgit v0.12 From b8b341fea6c287382301eb3de4309197d4390b60 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 30 Oct 2017 16:46:49 +0000 Subject: Fix some pointer arthemeric (only visible on big-endian systems) --- generic/tclExecute.c | 53 ++++++++++++++++++++++++---------------------------- generic/tclInt.h | 19 ++++++++++++++++++- generic/tclObj.c | 7 +------ 3 files changed, 43 insertions(+), 36 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 3e64805..ee9e2e0 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1878,8 +1878,8 @@ TclIncrObj( } if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { - long augend = *((const long *) ptr1); - long addend = *((const long *) ptr2); + long augend = *((const Tcl_WideInt *) ptr1); + long addend = *((const Tcl_WideInt *) ptr2); long sum = augend + addend; /* @@ -3722,7 +3722,7 @@ TEBCresume( objPtr = varPtr->value.objPtr; if (GetNumberFromObj(NULL, objPtr, &ptr, &type) == TCL_OK) { if (type == TCL_NUMBER_LONG) { - long augend = *((const long *)ptr); + long augend = *((const Tcl_WideInt *)ptr); long sum = augend + increment; /* @@ -5897,19 +5897,14 @@ TEBCresume( case INST_NUM_TYPE: if (GetNumberFromObj(NULL, OBJ_AT_TOS, &ptr1, &type1) != TCL_OK) { type1 = 0; - } else if (type1 == TCL_NUMBER_LONG) { + } else if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { /* value is between LONG_MIN and LONG_MAX */ /* [string is integer] is -UINT_MAX to UINT_MAX range */ int i; if (Tcl_GetIntFromObj(NULL, OBJ_AT_TOS, &i) != TCL_OK) { type1 = TCL_NUMBER_WIDE; - } - } else if (type1 == TCL_NUMBER_WIDE) { - /* value is between WIDE_MIN and WIDE_MAX */ - /* [string is wideinteger] is -UWIDE_MAX to UWIDE_MAX range */ - int i; - if (Tcl_GetIntFromObj(NULL, OBJ_AT_TOS, &i) == TCL_OK) { + } else { type1 = TCL_NUMBER_LONG; } } else if (type1 == TCL_NUMBER_BIG) { @@ -5957,8 +5952,8 @@ TEBCresume( goto convertComparison; } if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { - l1 = *((const long *)ptr1); - l2 = *((const long *)ptr2); + l1 = *((const Tcl_WideInt *)ptr1); + l2 = *((const Tcl_WideInt *)ptr2); compare = (l1 < l2) ? MP_LT : ((l1 > l2) ? MP_GT : MP_EQ); } else { compare = TclCompareTwoNumbers(valuePtr, value2Ptr); @@ -6036,8 +6031,8 @@ TEBCresume( */ if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { - l1 = *((const long *)ptr1); - l2 = *((const long *)ptr2); + l1 = *((const Tcl_WideInt *)ptr1); + l2 = *((const Tcl_WideInt *)ptr2); switch (*pc) { case INST_MOD: @@ -6287,8 +6282,8 @@ TEBCresume( if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { Tcl_WideInt w1, w2, wResult; - l1 = *((const long *)ptr1); - l2 = *((const long *)ptr2); + l1 = *((const Tcl_WideInt *)ptr1); + l2 = *((const Tcl_WideInt *)ptr2); switch (*pc) { case INST_ADD: @@ -6434,7 +6429,7 @@ TEBCresume( goto gotError; } if (type1 == TCL_NUMBER_LONG) { - l1 = *((const long *) ptr1); + l1 = *((const Tcl_WideInt *) ptr1); if (Tcl_IsShared(valuePtr)) { TclNewLongObj(objResultPtr, ~l1); TRACE_APPEND(("%s\n", O2S(objResultPtr))); @@ -6471,7 +6466,7 @@ TEBCresume( TRACE_APPEND(("%s\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); case TCL_NUMBER_LONG: - l1 = *((const long *) ptr1); + l1 = *((const Tcl_WideInt *) ptr1); if (l1 != LONG_MIN) { if (Tcl_IsShared(valuePtr)) { TclNewLongObj(objResultPtr, -l1); @@ -8150,7 +8145,7 @@ ExecuteExtendedBinaryMathOp( l2 = 0; /* silence gcc warning */ if (type2 == TCL_NUMBER_LONG) { - l2 = *((const long *)ptr2); + l2 = *((const Tcl_WideInt *)ptr2); if (l2 == 0) { return DIVIDED_BY_ZERO; } @@ -8255,7 +8250,7 @@ ExecuteExtendedBinaryMathOp( * Zero shifted any number of bits is still zero. */ - if ((type1==TCL_NUMBER_LONG) && (*((const long *)ptr1) == (long)0)) { + if ((type1==TCL_NUMBER_LONG) && (*((const Tcl_WideInt *)ptr1) == (long)0)) { return constants[0]; } @@ -8269,7 +8264,7 @@ ExecuteExtendedBinaryMathOp( */ if ((type2 != TCL_NUMBER_LONG) - || (*((const long *)ptr2) > (long) INT_MAX)) { + || (*((const Tcl_WideInt *)ptr2) > (long) INT_MAX)) { /* * Technically, we could hold the value (1 << (INT_MAX+1)) in * an mp_int, but since we're using mp_mul_2d() to do the @@ -8281,7 +8276,7 @@ ExecuteExtendedBinaryMathOp( "integer value too large to represent", -1)); return GENERAL_ARITHMETIC_ERROR; } - shift = (int)(*((const long *)ptr2)); + shift = (int)(*((const Tcl_WideInt *)ptr2)); /* * Handle shifts within the native wide range. @@ -8302,7 +8297,7 @@ ExecuteExtendedBinaryMathOp( */ if ((type2 != TCL_NUMBER_LONG) - || (*(const long *)ptr2 > INT_MAX)) { + || (*(const Tcl_WideInt *)ptr2 > INT_MAX)) { /* * Again, technically, the value to be shifted could be an * mp_int so huge that a right shift by (INT_MAX+1) bits could @@ -8313,7 +8308,7 @@ ExecuteExtendedBinaryMathOp( switch (type1) { case TCL_NUMBER_LONG: - zero = (*(const long *)ptr1 > 0L); + zero = (*(const Tcl_WideInt *)ptr1 > 0L); break; case TCL_NUMBER_WIDE: zero = (*(const Tcl_WideInt *)ptr1 > (Tcl_WideInt)0); @@ -8332,7 +8327,7 @@ ExecuteExtendedBinaryMathOp( } WIDE_RESULT(-1); } - shift = (int)(*(const long *)ptr2); + shift = (int)(*(const Tcl_WideInt *)ptr2); /* * Handle shifts within the native wide range. @@ -8535,8 +8530,8 @@ ExecuteExtendedBinaryMathOp( } WIDE_RESULT(wResult); } - l1 = *((const long *)ptr1); - l2 = *((const long *)ptr2); + l1 = *((const Tcl_WideInt *)ptr1); + l2 = *((const Tcl_WideInt *)ptr2); switch (opcode) { case INST_BITAND: @@ -8570,7 +8565,7 @@ ExecuteExtendedBinaryMathOp( } l1 = l2 = 0; if (type2 == TCL_NUMBER_LONG) { - l2 = *((const long *) ptr2); + l2 = *((const Tcl_WideInt *) ptr2); if (l2 == 0) { /* * Anything to the zero power is 1. @@ -8606,7 +8601,7 @@ ExecuteExtendedBinaryMathOp( } if (type1 == TCL_NUMBER_LONG) { - l1 = *((const long *)ptr1); + l1 = *((const Tcl_WideInt *)ptr1); } if (negativeExponent) { if (type1 == TCL_NUMBER_LONG) { diff --git a/generic/tclInt.h b/generic/tclInt.h index bb02ddf..3799287 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4589,11 +4589,25 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; TclAllocObjStorage(objPtr); \ (objPtr)->refCount = 0; \ (objPtr)->bytes = NULL; \ - (objPtr)->internalRep.wideValue = (long)(i); \ + (objPtr)->internalRep.wideValue = (Tcl_WideInt)(i); \ (objPtr)->typePtr = &tclIntType; \ TCL_DTRACE_OBJ_CREATE(objPtr); \ } while (0) +#ifndef TCL_WIDE_INT_IS_LONG +#define TclNewWideObj(objPtr, i) \ + do { \ + TclIncrObjsAllocated(); \ + TclAllocObjStorage(objPtr); \ + (objPtr)->refCount = 0; \ + (objPtr)->bytes = NULL; \ + (objPtr)->internalRep.wideValue = (Tcl_WideInt)(i); \ + (objPtr)->typePtr = &tclWideIntType; \ + TCL_DTRACE_OBJ_CREATE(objPtr); \ + } while (0) +#else +#define TclNewWideObj(objPtr, i) TclNewLongObj(objPtr, i) +#endif #define TclNewDoubleObj(objPtr, d) \ do { \ TclIncrObjsAllocated(); \ @@ -4619,6 +4633,9 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; #define TclNewLongObj(objPtr, l) \ (objPtr) = Tcl_NewLongObj(l) +#define TclNewWideObj(objPtr, w) \ + (objPtr) = Tcl_NewWideIntObj(w) + #define TclNewDoubleObj(objPtr, d) \ (objPtr) = Tcl_NewDoubleObj(d) diff --git a/generic/tclObj.c b/generic/tclObj.c index 78d7518..e4613ba 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -3550,12 +3550,7 @@ TclGetNumberFromObj( *clientDataPtr = &objPtr->internalRep.doubleValue; return TCL_OK; } - if (objPtr->typePtr == &tclIntType) { - *typePtr = TCL_NUMBER_LONG; - *clientDataPtr = &objPtr->internalRep.wideValue; - return TCL_OK; - } - if (objPtr->typePtr == &tclWideIntType) { + if (objPtr->typePtr == &tclIntType || objPtr->typePtr == &tclWideIntType) { *typePtr = TCL_NUMBER_WIDE; *clientDataPtr = &objPtr->internalRep.wideValue; return TCL_OK; -- cgit v0.12 From b0a9f6c55b529b1b7ad08fabce66218512634149 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 31 Oct 2017 09:48:57 +0000 Subject: Simplify implementation of Tcl_SaveResult/Tcl_RestoreResult/Tcl_DiscardResult by no longer assuming that Tcl_SavedResult is a struct. Backported from "novem" branch. --- doc/SaveResult.3 | 4 ++-- generic/tcl.h | 8 +++----- generic/tclDecls.h | 10 +++++----- generic/tclResult.c | 6 +++--- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/doc/SaveResult.3 b/doc/SaveResult.3 index b2270a2..6dd6cb6 100644 --- a/doc/SaveResult.3 +++ b/doc/SaveResult.3 @@ -54,9 +54,9 @@ is called, Tcl will take care of memory management. .PP The second triplet stores the snapshot of only the interpreter result (not its complete state) in memory allocated by the caller. -These routines are passed a pointer to a \fBTcl_SavedResult\fR structure +These routines are passed a pointer to \fBTcl_SavedResult\fR that is used to store enough information to restore the interpreter result. -This structure can be allocated on the stack of the calling +\fBTcl_SavedResult\fR can be allocated on the stack of the calling procedure. These routines do not save the state of any error information in the interpreter (e.g. the \fB\-errorcode\fR or \fB\-errorinfo\fR return options, when an error is in progress). diff --git a/generic/tcl.h b/generic/tcl.h index 0d40f41..6d4e6bb 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -825,13 +825,11 @@ int Tcl_IsShared(Tcl_Obj *objPtr); /* *---------------------------------------------------------------------------- - * The following type contains the state needed by Tcl_SaveResult. This - * structure is typically allocated on the stack. + * The following type contains the state needed by Tcl_SaveResult. It + * is typically allocated on the stack. */ -typedef struct Tcl_SavedResult { - Tcl_Obj *objResultPtr; -} Tcl_SavedResult; +typedef Tcl_Obj *Tcl_SavedResult; /* *---------------------------------------------------------------------------- diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 464fc0f..17d60a8 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3888,20 +3888,20 @@ extern const TclStubs *tclStubsPtr; #undef Tcl_SaveResult #define Tcl_SaveResult(interp, statePtr) \ do { \ - (statePtr)->objResultPtr = Tcl_GetObjResult(interp); \ - Tcl_IncrRefCount((statePtr)->objResultPtr); \ + *(statePtr) = Tcl_GetObjResult(interp); \ + Tcl_IncrRefCount(*(statePtr)); \ Tcl_SetObjResult(interp, Tcl_NewObj()); \ } while(0) #undef Tcl_RestoreResult #define Tcl_RestoreResult(interp, statePtr) \ do { \ Tcl_ResetResult(interp); \ - Tcl_SetObjResult(interp, (statePtr)->objResultPtr); \ - Tcl_DecrRefCount((statePtr)->objResultPtr); \ + Tcl_SetObjResult(interp, *(statePtr)); \ + Tcl_DecrRefCount(*(statePtr)); \ } while(0) #undef Tcl_DiscardResult #define Tcl_DiscardResult(statePtr) \ - Tcl_DecrRefCount((statePtr)->objResultPtr) + Tcl_DecrRefCount(*(statePtr)) #undef Tcl_SetResult #define Tcl_SetResult(interp, result, freeProc) \ do { \ diff --git a/generic/tclResult.c b/generic/tclResult.c index fb97e0b..5a8ef61 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -244,7 +244,7 @@ Tcl_SaveResult( * reference. Put an empty object into the interpreter. */ - statePtr->objResultPtr = iPtr->objResultPtr; + *statePtr = iPtr->objResultPtr; iPtr->objResultPtr = Tcl_NewObj(); Tcl_IncrRefCount(iPtr->objResultPtr); } @@ -282,7 +282,7 @@ Tcl_RestoreResult( */ Tcl_DecrRefCount(iPtr->objResultPtr); - iPtr->objResultPtr = statePtr->objResultPtr; + iPtr->objResultPtr = *statePtr; } /* @@ -308,7 +308,7 @@ void Tcl_DiscardResult( Tcl_SavedResult *statePtr) /* State returned by Tcl_SaveResult. */ { - TclDecrRefCount(statePtr->objResultPtr); + Tcl_DecrRefCount(*statePtr); } /* -- cgit v0.12 From c8fbbd8f3eef002f8913793c394ddc6f9e416da1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 31 Oct 2017 11:37:29 +0000 Subject: Fix 2 failing test-cases, broken by some earlier commit --- generic/tclExecute.c | 68 ++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index ee9e2e0..76e1496 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5893,13 +5893,15 @@ TEBCresume( ClientData ptr1, ptr2; int type1, type2; long l1, l2, lResult; + Tcl_WideInt w1, w2, wResult; case INST_NUM_TYPE: if (GetNumberFromObj(NULL, OBJ_AT_TOS, &ptr1, &type1) != TCL_OK) { type1 = 0; } else if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { - /* value is between LONG_MIN and LONG_MAX */ + /* value is between WIDE_MIN and WIDE_MAX */ /* [string is integer] is -UINT_MAX to UINT_MAX range */ + /* [string is wideinteger] is -UWIDE_MAX to UWIDE_MAX range */ int i; if (Tcl_GetIntFromObj(NULL, OBJ_AT_TOS, &i) != TCL_OK) { @@ -5909,10 +5911,14 @@ TEBCresume( } } else if (type1 == TCL_NUMBER_BIG) { /* value is an integer outside the WIDE_MIN to WIDE_MAX range */ + /* [string is integer] is -UINT_MAX to UINT_MAX range */ /* [string is wideinteger] is -UWIDE_MAX to UWIDE_MAX range */ + int i; Tcl_WideInt w; - if (Tcl_GetWideIntFromObj(NULL, OBJ_AT_TOS, &w) == TCL_OK) { + if (Tcl_GetIntFromObj(NULL, OBJ_AT_TOS, &i) == TCL_OK) { + type1 = TCL_NUMBER_LONG; + } else if (Tcl_GetWideIntFromObj(NULL, OBJ_AT_TOS, &w) == TCL_OK) { type1 = TCL_NUMBER_WIDE; } } @@ -5951,10 +5957,10 @@ TEBCresume( compare = MP_EQ; goto convertComparison; } - if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { - l1 = *((const Tcl_WideInt *)ptr1); - l2 = *((const Tcl_WideInt *)ptr2); - compare = (l1 < l2) ? MP_LT : ((l1 > l2) ? MP_GT : MP_EQ); + if ((type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) && (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE)) { + w1 = *((const Tcl_WideInt *)ptr1); + w2 = *((const Tcl_WideInt *)ptr2); + compare = (w1 < w2) ? MP_LT : ((w1 > w2) ? MP_GT : MP_EQ); } else { compare = TclCompareTwoNumbers(valuePtr, value2Ptr); } @@ -6280,15 +6286,13 @@ TEBCresume( */ if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { - Tcl_WideInt w1, w2, wResult; - - l1 = *((const Tcl_WideInt *)ptr1); - l2 = *((const Tcl_WideInt *)ptr2); + w1 = *((const Tcl_WideInt *)ptr1); + w2 = *((const Tcl_WideInt *)ptr2); + l1 = w1; + l2 = w2; switch (*pc) { case INST_ADD: - w1 = (Tcl_WideInt) l1; - w2 = (Tcl_WideInt) l2; wResult = w1 + w2; /* * Check for overflow. @@ -6300,8 +6304,6 @@ TEBCresume( goto wideResultOfArithmetic; case INST_SUB: - w1 = (Tcl_WideInt) l1; - w2 = (Tcl_WideInt) l2; wResult = w1 - w2; /* * Must check for overflow. The macro tests for overflows in @@ -6328,40 +6330,40 @@ TEBCresume( NEXT_INST_F(1, 1, 0); case INST_DIV: - if (l2 == 0) { + if (w2 == 0) { TRACE(("%s %s => DIVIDE BY ZERO\n", O2S(valuePtr), O2S(value2Ptr))); goto divideByZero; - } else if ((l1 == LONG_MIN) && (l2 == -1)) { + } else if ((w1 == LLONG_MIN) && (w2 == -1)) { /* - * Can't represent (-LONG_MIN) as a long. + * Can't represent (-LLONG_MIN) as a long. */ goto overflow; } - lResult = l1 / l2; + wResult = w1 / w2; /* * Force Tcl's integer division rules. * TODO: examine for logic simplification */ - if (((lResult < 0) || ((lResult == 0) && - ((l1 < 0 && l2 > 0) || (l1 > 0 && l2 < 0)))) && - ((lResult * l2) != l1)) { - lResult -= 1; + if (((wResult < 0) || ((wResult == 0) && + ((w1 < 0 && w2 > 0) || (w1 > 0 && w2 < 0)))) && + ((wResult * w2) != w1)) { + wResult -= 1; } - goto longResultOfArithmetic; + goto wideResultOfArithmetic; case INST_MULT: if (((sizeof(long) >= 2*sizeof(int)) - && (l1 <= INT_MAX) && (l1 >= INT_MIN) - && (l2 <= INT_MAX) && (l2 >= INT_MIN)) + && (w1 <= INT_MAX) && (w1 >= INT_MIN) + && (w2 <= INT_MAX) && (w2 >= INT_MIN)) || ((sizeof(long) >= 2*sizeof(short)) - && (l1 <= SHRT_MAX) && (l1 >= SHRT_MIN) - && (l2 <= SHRT_MAX) && (l2 >= SHRT_MIN))) { - lResult = l1 * l2; - goto longResultOfArithmetic; + && (w1 <= SHRT_MAX) && (w1 >= SHRT_MIN) + && (w2 <= SHRT_MAX) && (w2 >= SHRT_MIN))) { + wResult = w1 * w2; + goto wideResultOfArithmetic; } } @@ -8227,8 +8229,8 @@ ExecuteExtendedBinaryMathOp( */ switch (type2) { - case TCL_NUMBER_WIDE: case TCL_NUMBER_LONG: + case TCL_NUMBER_WIDE: invalid = (*((const Tcl_WideInt *)ptr2) < (Tcl_WideInt)0); break; case TCL_NUMBER_BIG: @@ -8250,7 +8252,7 @@ ExecuteExtendedBinaryMathOp( * Zero shifted any number of bits is still zero. */ - if ((type1==TCL_NUMBER_LONG) && (*((const Tcl_WideInt *)ptr1) == (long)0)) { + if ((type1==TCL_NUMBER_LONG || type1==TCL_NUMBER_WIDE) && (*((const Tcl_WideInt *)ptr1) == (Tcl_WideInt)0)) { return constants[0]; } @@ -8308,8 +8310,6 @@ ExecuteExtendedBinaryMathOp( switch (type1) { case TCL_NUMBER_LONG: - zero = (*(const Tcl_WideInt *)ptr1 > 0L); - break; case TCL_NUMBER_WIDE: zero = (*(const Tcl_WideInt *)ptr1 > (Tcl_WideInt)0); break; @@ -8981,7 +8981,7 @@ ExecuteExtendedBinaryMathOp( case INST_SUB: wResult = w1 - w2; - if ((type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_WIDE)) + if ((type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE)) { /* * Must check for overflow. The macro tests for overflows -- cgit v0.12 From 8fd76cb8733824c202c3eda72e9716013c8c2d82 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 31 Oct 2017 12:39:16 +0000 Subject: more simplifications --- generic/tclExecute.c | 57 ++++++++++------------------------------------------ 1 file changed, 11 insertions(+), 46 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 76e1496..ed4c00f 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1877,35 +1877,6 @@ TclIncrObj( return TCL_ERROR; } - if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { - long augend = *((const Tcl_WideInt *) ptr1); - long addend = *((const Tcl_WideInt *) ptr2); - long sum = augend + addend; - - /* - * Overflow when (augend and sum have different sign) and (augend and - * addend have the same sign). This is encapsulated in the Overflowing - * macro. - */ - - if (!Overflowing(augend, addend, sum)) { - TclSetLongObj(valuePtr, sum); - return TCL_OK; - } - { - Tcl_WideInt w1 = (Tcl_WideInt) augend; - Tcl_WideInt w2 = (Tcl_WideInt) addend; - - /* - * We know the sum value is outside the long range, so we use the - * macro form that doesn't range test again. - */ - - TclSetWideIntObj(valuePtr, w1 + w2); - return TCL_OK; - } - } - if ((type1 == TCL_NUMBER_DOUBLE) || (type1 == TCL_NUMBER_NAN)) { /* * Produce error message (reparse?!) @@ -8146,12 +8117,12 @@ ExecuteExtendedBinaryMathOp( /* TODO: Attempts to re-use unshared operands on stack */ l2 = 0; /* silence gcc warning */ - if (type2 == TCL_NUMBER_LONG) { - l2 = *((const Tcl_WideInt *)ptr2); - if (l2 == 0) { + if (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE) { + l2 = w2 = *((const Tcl_WideInt *)ptr2); + if (w2 == 0) { return DIVIDED_BY_ZERO; } - if ((l2 == 1) || (l2 == -1)) { + if ((w2 == 1) || (w2 == -1)) { /* * Div. by |1| always yields remainder of 0. */ @@ -8583,9 +8554,6 @@ ExecuteExtendedBinaryMathOp( switch (type2) { case TCL_NUMBER_LONG: - negativeExponent = (l2 < 0); - oddExponent = (int) (l2 & 1); - break; case TCL_NUMBER_WIDE: w2 = *((const Tcl_WideInt *)ptr2); negativeExponent = (w2 < 0); @@ -8600,12 +8568,12 @@ ExecuteExtendedBinaryMathOp( break; } - if (type1 == TCL_NUMBER_LONG) { - l1 = *((const Tcl_WideInt *)ptr1); + if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { + l1 = w1 = *((const Tcl_WideInt *)ptr1); } if (negativeExponent) { if (type1 == TCL_NUMBER_LONG) { - switch (l1) { + switch (w1) { case 0: /* * Zero to a negative power is div by zero error. @@ -8635,7 +8603,7 @@ ExecuteExtendedBinaryMathOp( } if (type1 == TCL_NUMBER_LONG) { - switch (l1) { + switch (w1) { case 0: /* * Zero to a positive power is zero. @@ -8764,9 +8732,7 @@ ExecuteExtendedBinaryMathOp( #endif } #if (LONG_MAX > 0x7fffffff) || !defined(TCL_WIDE_INT_IS_LONG) - if (type1 == TCL_NUMBER_LONG) { - w1 = l1; - } else if (type1 == TCL_NUMBER_WIDE) { + if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { w1 = *((const Tcl_WideInt *) ptr1); } else { goto overflowExpon; @@ -9001,8 +8967,7 @@ ExecuteExtendedBinaryMathOp( break; case INST_MULT: - if ((type1 != TCL_NUMBER_LONG) || (type2 != TCL_NUMBER_LONG) - || (sizeof(Tcl_WideInt) < 2*sizeof(long))) { + if ((w1 < INT_MIN) || (w1 > INT_MAX) || (w2 < INT_MIN) || (w2 > INT_MAX)) { goto overflowBasic; } wResult = w1 * w2; @@ -9105,7 +9070,7 @@ ExecuteExtendedUnaryMathOp( switch (opcode) { case INST_BITNOT: - if (type == TCL_NUMBER_WIDE) { + if (type == TCL_NUMBER_LONG || type == TCL_NUMBER_WIDE) { w = *((const Tcl_WideInt *) ptr); WIDE_RESULT(~w); } -- cgit v0.12 From 2f2459e12003ac4f386e21b70b7929fe73859258 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 31 Oct 2017 14:40:33 +0000 Subject: more progress --- generic/tclExecute.c | 129 +++++++++++++++++++++++---------------------------- 1 file changed, 59 insertions(+), 70 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index ed4c00f..704ee57 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5863,7 +5863,7 @@ TEBCresume( { ClientData ptr1, ptr2; int type1, type2; - long l1, l2, lResult; + long l1; Tcl_WideInt w1, w2, wResult; case INST_NUM_TYPE: @@ -6008,16 +6008,16 @@ TEBCresume( */ if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { - l1 = *((const Tcl_WideInt *)ptr1); - l2 = *((const Tcl_WideInt *)ptr2); + l1 = w1 = *((const Tcl_WideInt *)ptr1); + w2 = *((const Tcl_WideInt *)ptr2); switch (*pc) { case INST_MOD: - if (l2 == 0) { + if (w2 == 0) { TRACE(("%s %s => DIVIDE BY ZERO\n", O2S(valuePtr), O2S(value2Ptr))); goto divideByZero; - } else if ((l2 == 1) || (l2 == -1)) { + } else if ((w2 == 1) || (w2 == -1)) { /* * Div. by |1| always yields remainder of 0. */ @@ -6026,7 +6026,7 @@ TEBCresume( objResultPtr = TCONST(0); TRACE(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 2, 1); - } else if (l1 == 0) { + } else if (w1 == 0) { /* * 0 % (non-zero) always yields remainder of 0. */ @@ -6036,24 +6036,24 @@ TEBCresume( TRACE(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 2, 1); } else { - lResult = l1 / l2; + wResult = w1 / w2; /* * Force Tcl's integer division rules. * TODO: examine for logic simplification */ - if ((lResult < 0 || (lResult == 0 && - ((l1 < 0 && l2 > 0) || (l1 > 0 && l2 < 0)))) && - (lResult * l2 != l1)) { - lResult -= 1; + if ((wResult < 0 || (wResult == 0 && + ((w1 < 0 && w2 > 0) || (w1 > 0 && w2 < 0)))) && + (wResult * w2 != w1)) { + wResult -= 1; } - lResult = l1 - l2*lResult; - goto longResultOfArithmetic; + wResult = w1 - w2*wResult; + goto wideResultOfArithmetic; } case INST_RSHIFT: - if (l2 < 0) { + if (w2 < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "negative shift argument", -1)); #ifdef ERROR_CODE_FOR_EARLY_DETECTED_ARITH_ERROR @@ -6064,7 +6064,7 @@ TEBCresume( CACHE_STACK_INFO(); #endif /* ERROR_CODE_FOR_EARLY_DETECTED_ARITH_ERROR */ goto gotError; - } else if (l1 == 0) { + } else if (w1 == 0) { TRACE(("%s %s => ", O2S(valuePtr), O2S(value2Ptr))); objResultPtr = TCONST(0); TRACE(("%s\n", O2S(objResultPtr))); @@ -6074,7 +6074,7 @@ TEBCresume( * Quickly force large right shifts to 0 or -1. */ - if (l2 >= (long)(CHAR_BIT*sizeof(long))) { + if (w2 >= (long)(CHAR_BIT*sizeof(long))) { /* * We assume that INT_MAX is much larger than the * number of bits in a long. This is a pretty safe @@ -6083,7 +6083,7 @@ TEBCresume( */ TRACE(("%s %s => ", O2S(valuePtr), O2S(value2Ptr))); - if (l1 > 0L) { + if (w1 > 0L) { objResultPtr = TCONST(0); } else { TclNewLongObj(objResultPtr, -1); @@ -6096,12 +6096,12 @@ TEBCresume( * Handle shifts within the native long range. */ - lResult = l1 >> ((int) l2); - goto longResultOfArithmetic; + wResult = w1 >> ((int) w2); + goto wideResultOfArithmetic; } case INST_LSHIFT: - if (l2 < 0) { + if (w2 < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "negative shift argument", -1)); #ifdef ERROR_CODE_FOR_EARLY_DETECTED_ARITH_ERROR @@ -6112,12 +6112,12 @@ TEBCresume( CACHE_STACK_INFO(); #endif /* ERROR_CODE_FOR_EARLY_DETECTED_ARITH_ERROR */ goto gotError; - } else if (l1 == 0) { + } else if (w1 == 0) { TRACE(("%s %s => ", O2S(valuePtr), O2S(value2Ptr))); objResultPtr = TCONST(0); TRACE(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 2, 1); - } else if (l2 > (long) INT_MAX) { + } else if (w2 > (long) INT_MAX) { /* * Technically, we could hold the value (1 << (INT_MAX+1)) * in an mp_int, but since we're using mp_mul_2d() to do @@ -6135,17 +6135,17 @@ TEBCresume( #endif /* ERROR_CODE_FOR_EARLY_DETECTED_ARITH_ERROR */ goto gotError; } else { - int shift = (int) l2; + int shift = (int) w2; /* * Handle shifts within the native long range. */ - if ((size_t) shift < CHAR_BIT*sizeof(long) && (l1 != 0) - && !((l1>0 ? l1 : ~l1) & + if ((size_t) shift < CHAR_BIT*sizeof(long) && (w1 != 0) + && !((w1>0 ? w1 : ~w1) & -(1L<<(CHAR_BIT*sizeof(long) - 1 - shift)))) { - lResult = l1 << shift; - goto longResultOfArithmetic; + wResult = w1 << shift; + goto wideResultOfArithmetic; } } @@ -6157,23 +6157,14 @@ TEBCresume( break; case INST_BITAND: - lResult = l1 & l2; - goto longResultOfArithmetic; + wResult = w1 & w2; + goto wideResultOfArithmetic; case INST_BITOR: - lResult = l1 | l2; - goto longResultOfArithmetic; + wResult = w1 | w2; + goto wideResultOfArithmetic; case INST_BITXOR: - lResult = l1 ^ l2; - longResultOfArithmetic: - TRACE(("%s %s => ", O2S(valuePtr), O2S(value2Ptr))); - if (Tcl_IsShared(valuePtr)) { - TclNewLongObj(objResultPtr, lResult); - TRACE(("%s\n", O2S(objResultPtr))); - NEXT_INST_F(1, 2, 1); - } - TclSetLongObj(valuePtr, lResult); - TRACE(("%s\n", O2S(valuePtr))); - NEXT_INST_F(1, 1, 0); + wResult = w1 ^ w2; + goto wideResultOfArithmetic; } } @@ -6257,10 +6248,8 @@ TEBCresume( */ if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { - w1 = *((const Tcl_WideInt *)ptr1); + l1 = w1 = *((const Tcl_WideInt *)ptr1); w2 = *((const Tcl_WideInt *)ptr2); - l1 = w1; - l2 = w2; switch (*pc) { case INST_ADD: @@ -6401,14 +6390,14 @@ TEBCresume( CACHE_STACK_INFO(); goto gotError; } - if (type1 == TCL_NUMBER_LONG) { - l1 = *((const Tcl_WideInt *) ptr1); + if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { + w1 = *((const Tcl_WideInt *) ptr1); if (Tcl_IsShared(valuePtr)) { - TclNewLongObj(objResultPtr, ~l1); + TclNewWideObj(objResultPtr, ~w1); TRACE_APPEND(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 1, 1); } - TclSetLongObj(valuePtr, ~l1); + TclSetWideIntObj(valuePtr, ~w1); TRACE_APPEND(("%s\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); } @@ -6439,7 +6428,7 @@ TEBCresume( TRACE_APPEND(("%s\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); case TCL_NUMBER_LONG: - l1 = *((const Tcl_WideInt *) ptr1); + l1 = w1 = *((const Tcl_WideInt *) ptr1); if (l1 != LONG_MIN) { if (Tcl_IsShared(valuePtr)) { TclNewLongObj(objResultPtr, -l1); @@ -8501,8 +8490,8 @@ ExecuteExtendedBinaryMathOp( } WIDE_RESULT(wResult); } - l1 = *((const Tcl_WideInt *)ptr1); - l2 = *((const Tcl_WideInt *)ptr2); + l1 = w1 = *((const Tcl_WideInt *)ptr1); + l2 = w2 = *((const Tcl_WideInt *)ptr2); switch (opcode) { case INST_BITAND: @@ -8536,14 +8525,14 @@ ExecuteExtendedBinaryMathOp( } l1 = l2 = 0; if (type2 == TCL_NUMBER_LONG) { - l2 = *((const Tcl_WideInt *) ptr2); - if (l2 == 0) { + l2 = w2 = *((const Tcl_WideInt *) ptr2); + if (w2 == 0) { /* * Anything to the zero power is 1. */ return constants[1]; - } else if (l2 == 1) { + } else if (w2 == 1) { /* * Anything to the first power is itself */ @@ -8640,25 +8629,25 @@ ExecuteExtendedBinaryMathOp( } if (type1 == TCL_NUMBER_LONG) { - if (l1 == 2) { + if (w1 == 2) { /* * Reduce small powers of 2 to shifts. */ - if ((Tcl_WideUInt) l2 < (Tcl_WideUInt) CHAR_BIT*sizeof(Tcl_WideInt) - 1) { - WIDE_RESULT(((Tcl_WideInt) 1) << l2); + if ((Tcl_WideUInt) w2 < (Tcl_WideUInt) CHAR_BIT*sizeof(Tcl_WideInt) - 1) { + WIDE_RESULT(((Tcl_WideInt) 1) << (int)w2); } goto overflowExpon; } - if (l1 == -2) { + if (w1 == -2) { int signum = oddExponent ? -1 : 1; /* * Reduce small powers of 2 to shifts. */ - if ((unsigned long)l2 < CHAR_BIT*sizeof(Tcl_WideInt) - 1){ - WIDE_RESULT(signum * (((Tcl_WideInt) 1) << l2)); + if ((Tcl_WideUInt)w2 < CHAR_BIT*sizeof(Tcl_WideInt) - 1){ + WIDE_RESULT(signum * (((Tcl_WideInt) 1) << (int) w2)); } goto overflowExpon; } @@ -8737,19 +8726,19 @@ ExecuteExtendedBinaryMathOp( } else { goto overflowExpon; } - if (l2 - 2 < (long)MaxBase64Size - && w1 <= MaxBase64[l2 - 2] - && w1 >= -MaxBase64[l2 - 2]) { + if (w2 - 2 < (long)MaxBase64Size + && w1 <= MaxBase64[w2 - 2] + && w1 >= -MaxBase64[w2 - 2]) { /* * Small powers of integers whose result is wide. */ wResult = w1 * w1; /* b**2 */ - switch (l2) { + switch (w2) { case 2: break; case 3: - wResult *= l1; /* b**3 */ + wResult *= w1; /* b**3 */ break; case 4: wResult *= wResult; /* b**4 */ @@ -8826,9 +8815,9 @@ ExecuteExtendedBinaryMathOp( */ if (w1 - 3 >= 0 && w1 - 2 < (long)Exp64IndexSize - && l2 - 2 < (long)(Exp64ValueSize + MaxBase64Size)) { + && w2 - 2 < (long)(Exp64ValueSize + MaxBase64Size)) { base = Exp64Index[w1 - 3] - + (unsigned short) (l2 - 2 - MaxBase64Size); + + (unsigned short) (w2 - 2 - MaxBase64Size); if (base < Exp64Index[w1 - 2]) { /* * 64-bit number raised to intermediate power, done by @@ -8840,9 +8829,9 @@ ExecuteExtendedBinaryMathOp( } if (-w1 - 3 >= 0 && -w1 - 2 < (long)Exp64IndexSize - && l2 - 2 < (long)(Exp64ValueSize + MaxBase64Size)) { + && w2 - 2 < (long)(Exp64ValueSize + MaxBase64Size)) { base = Exp64Index[-w1 - 3] - + (unsigned short) (l2 - 2 - MaxBase64Size); + + (unsigned short) (w2 - 2 - MaxBase64Size); if (base < Exp64Index[-w1 - 2]) { /* * 64-bit number raised to intermediate power, done by -- cgit v0.12 From db930a501ff7f2b3826325f52d9bbcf2f26eaead Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 31 Oct 2017 14:48:28 +0000 Subject: Only use 64-bit tables for all platforms --- generic/tclExecute.c | 105 --------------------------------------------------- 1 file changed, 105 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 704ee57..2c77979 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -576,40 +576,6 @@ VarHashCreateVar( * Auxiliary tables used to compute powers of small integers. */ -#if (LONG_MAX == 0x7fffffff) - -/* - * Maximum base that, when raised to powers 2, 3, ... 8, fits in a 32-bit - * signed integer. - */ - -static const long MaxBase32[] = {46340, 1290, 215, 73, 35, 21, 14}; -static const size_t MaxBase32Size = sizeof(MaxBase32)/sizeof(long); - -/* - * Table giving 3, 4, ..., 11, raised to the powers 9, 10, ..., as far as they - * fit in a 32-bit signed integer. Exp32Index[i] gives the starting index of - * powers of i+3; Exp32Value[i] gives the corresponding powers. - */ - -static const unsigned short Exp32Index[] = { - 0, 11, 18, 23, 26, 29, 31, 32, 33 -}; -static const size_t Exp32IndexSize = - sizeof(Exp32Index) / sizeof(unsigned short); -static const long Exp32Value[] = { - 19683, 59049, 177147, 531441, 1594323, 4782969, 14348907, 43046721, - 129140163, 387420489, 1162261467, 262144, 1048576, 4194304, - 16777216, 67108864, 268435456, 1073741824, 1953125, 9765625, - 48828125, 244140625, 1220703125, 10077696, 60466176, 362797056, - 40353607, 282475249, 1977326743, 134217728, 1073741824, 387420489, - 1000000000 -}; -static const size_t Exp32ValueSize = sizeof(Exp32Value)/sizeof(long); -#endif /* LONG_MAX == 0x7fffffff -- 32 bit machine */ - -#if (LONG_MAX > 0x7fffffff) || !defined(TCL_WIDE_INT_IS_LONG) - /* * Maximum base that, when raised to powers 2, 3, ..., 16, fits in a * Tcl_WideInt. @@ -713,7 +679,6 @@ static const Tcl_WideInt Exp64Value[] = { (Tcl_WideInt)371293*371293*371293*13*13 }; static const size_t Exp64ValueSize = sizeof(Exp64Value) / sizeof(Tcl_WideInt); -#endif /* (LONG_MAX > 0x7fffffff) || !defined(TCL_WIDE_INT_IS_LONG) */ /* * Markers for ExecuteExtendedBinaryMathOp. @@ -8651,76 +8616,7 @@ ExecuteExtendedBinaryMathOp( } goto overflowExpon; } -#if (LONG_MAX == 0x7fffffff) - if (l2 - 2 < (long)MaxBase32Size - && l1 <= MaxBase32[l2 - 2] - && l1 >= -MaxBase32[l2 - 2]) { - /* - * Small powers of 32-bit integers. - */ - - lResult = l1 * l1; /* b**2 */ - switch (l2) { - case 2: - break; - case 3: - lResult *= l1; /* b**3 */ - break; - case 4: - lResult *= lResult; /* b**4 */ - break; - case 5: - lResult *= lResult; /* b**4 */ - lResult *= l1; /* b**5 */ - break; - case 6: - lResult *= l1; /* b**3 */ - lResult *= lResult; /* b**6 */ - break; - case 7: - lResult *= l1; /* b**3 */ - lResult *= lResult; /* b**6 */ - lResult *= l1; /* b**7 */ - break; - case 8: - lResult *= lResult; /* b**4 */ - lResult *= lResult; /* b**8 */ - break; - } - WIDE_RESULT(lResult); - } - - if (l1 - 3 >= 0 && l1 -2 < (long)Exp32IndexSize - && l2 - 2 < (long)(Exp32ValueSize + MaxBase32Size)) { - base = Exp32Index[l1 - 3] - + (unsigned short) (l2 - 2 - MaxBase32Size); - if (base < Exp32Index[l1 - 2]) { - /* - * 32-bit number raised to intermediate power, done by - * table lookup. - */ - - WIDE_RESULT(Exp32Value[base]); - } - } - if (-l1 - 3 >= 0 && -l1 - 2 < (long)Exp32IndexSize - && l2 - 2 < (long)(Exp32ValueSize + MaxBase32Size)) { - base = Exp32Index[-l1 - 3] - + (unsigned short) (l2 - 2 - MaxBase32Size); - if (base < Exp32Index[-l1 - 2]) { - /* - * 32-bit number raised to intermediate power, done by - * table lookup. - */ - - lResult = (oddExponent) ? - -Exp32Value[base] : Exp32Value[base]; - WIDE_RESULT(lResult); - } - } -#endif } -#if (LONG_MAX > 0x7fffffff) || !defined(TCL_WIDE_INT_IS_LONG) if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { w1 = *((const Tcl_WideInt *) ptr1); } else { @@ -8842,7 +8738,6 @@ ExecuteExtendedBinaryMathOp( WIDE_RESULT(wResult); } } -#endif overflowExpon: Tcl_TakeBignumFromObj(NULL, value2Ptr, &big2); -- cgit v0.12 From 1cbd95eeee01fe3a144bba18c710be5c8442ff14 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 31 Oct 2017 16:16:46 +0000 Subject: eliminate most use of (long) type, except for increments --- generic/tclExecute.c | 110 ++++++++++++++++++--------------------------------- 1 file changed, 39 insertions(+), 71 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 2c77979..846b04f 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -3657,9 +3657,9 @@ TEBCresume( objPtr = varPtr->value.objPtr; if (GetNumberFromObj(NULL, objPtr, &ptr, &type) == TCL_OK) { - if (type == TCL_NUMBER_LONG) { - long augend = *((const Tcl_WideInt *)ptr); - long sum = augend + increment; + if (type == TCL_NUMBER_LONG || type == TCL_NUMBER_WIDE) { + Tcl_WideInt augend = *((const Tcl_WideInt *)ptr); + Tcl_WideInt sum = augend + increment; /* * Overflow when (augend and sum have different sign) and @@ -3671,12 +3671,12 @@ TEBCresume( TRACE(("%u %ld => ", opnd, increment)); if (Tcl_IsShared(objPtr)) { objPtr->refCount--; /* We know it's shared. */ - TclNewLongObj(objResultPtr, sum); + TclNewWideObj(objResultPtr, sum); Tcl_IncrRefCount(objResultPtr); varPtr->value.objPtr = objResultPtr; } else { objResultPtr = objPtr; - TclSetLongObj(objPtr, sum); + TclSetWideIntObj(objPtr, sum); } goto doneIncr; } @@ -3699,38 +3699,7 @@ TEBCresume( TclSetWideIntObj(objPtr, w+increment); } goto doneIncr; - } /* end if (type == TCL_NUMBER_LONG) */ - if (type == TCL_NUMBER_WIDE) { - Tcl_WideInt sum; - - w = *((const Tcl_WideInt *) ptr); - sum = w + increment; - - /* - * Check for overflow. - */ - - if (!Overflowing(w, increment, sum)) { - TRACE(("%u %ld => ", opnd, increment)); - if (Tcl_IsShared(objPtr)) { - objPtr->refCount--; /* We know it's shared. */ - objResultPtr = Tcl_NewWideIntObj(sum); - Tcl_IncrRefCount(objResultPtr); - varPtr->value.objPtr = objResultPtr; - } else { - objResultPtr = objPtr; - - /* - * We *do not* know the sum value is outside the - * long range (wide + long can yield long); use - * the function call that checks range. - */ - - Tcl_SetWideIntObj(objPtr, sum); - } - goto doneIncr; - } - } + } /* end if (type == TCL_NUMBER_LONG || type == TCL_NUMBER_WIDE) */ } if (Tcl_IsShared(objPtr)) { objPtr->refCount--; /* We know it's shared */ @@ -5828,7 +5797,6 @@ TEBCresume( { ClientData ptr1, ptr2; int type1, type2; - long l1; Tcl_WideInt w1, w2, wResult; case INST_NUM_TYPE: @@ -5972,8 +5940,8 @@ TEBCresume( * Check for common, simple case. */ - if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { - l1 = w1 = *((const Tcl_WideInt *)ptr1); + if ((type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) && (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE)) { + w1 = *((const Tcl_WideInt *)ptr1); w2 = *((const Tcl_WideInt *)ptr2); switch (*pc) { @@ -6039,7 +6007,7 @@ TEBCresume( * Quickly force large right shifts to 0 or -1. */ - if (w2 >= (long)(CHAR_BIT*sizeof(long))) { + if (w2 >= (Tcl_WideInt)(CHAR_BIT*sizeof(long))) { /* * We assume that INT_MAX is much larger than the * number of bits in a long. This is a pretty safe @@ -6082,7 +6050,7 @@ TEBCresume( objResultPtr = TCONST(0); TRACE(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 2, 1); - } else if (w2 > (long) INT_MAX) { + } else if (w2 > (Tcl_WideInt) INT_MAX) { /* * Technically, we could hold the value (1 << (INT_MAX+1)) * in an mp_int, but since we're using mp_mul_2d() to do @@ -6212,8 +6180,8 @@ TEBCresume( * an external function. */ - if ((type1 == TCL_NUMBER_LONG) && (type2 == TCL_NUMBER_LONG)) { - l1 = w1 = *((const Tcl_WideInt *)ptr1); + if ((type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) && (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE)) { + w1 = *((const Tcl_WideInt *)ptr1); w2 = *((const Tcl_WideInt *)ptr2); switch (*pc) { @@ -6393,14 +6361,15 @@ TEBCresume( TRACE_APPEND(("%s\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); case TCL_NUMBER_LONG: - l1 = w1 = *((const Tcl_WideInt *) ptr1); - if (l1 != LONG_MIN) { + case TCL_NUMBER_WIDE: + w1 = *((const Tcl_WideInt *) ptr1); + if (w1 != LLONG_MIN) { if (Tcl_IsShared(valuePtr)) { - TclNewLongObj(objResultPtr, -l1); + TclNewWideObj(objResultPtr, -w1); TRACE_APPEND(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 1, 1); } - TclSetLongObj(valuePtr, -l1); + TclSetWideIntObj(valuePtr, -w1); TRACE_APPEND(("%s\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); } @@ -8056,7 +8025,6 @@ ExecuteExtendedBinaryMathOp( int type1, type2; ClientData ptr1, ptr2; double d1, d2, dResult; - long l1, l2, lResult; Tcl_WideInt w1, w2, wResult; mp_int big1, big2, bigResult, bigRemainder; Tcl_Obj *objResultPtr; @@ -8070,9 +8038,9 @@ ExecuteExtendedBinaryMathOp( case INST_MOD: /* TODO: Attempts to re-use unshared operands on stack */ - l2 = 0; /* silence gcc warning */ + w2 = 0; /* silence gcc warning */ if (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE) { - l2 = w2 = *((const Tcl_WideInt *)ptr2); + w2 = *((const Tcl_WideInt *)ptr2); if (w2 == 0) { return DIVIDED_BY_ZERO; } @@ -8190,7 +8158,7 @@ ExecuteExtendedBinaryMathOp( * counterparts, leading to incorrect results. */ - if ((type2 != TCL_NUMBER_LONG) + if ((type2 != TCL_NUMBER_LONG && type2 != TCL_NUMBER_WIDE) || (*((const Tcl_WideInt *)ptr2) > (long) INT_MAX)) { /* * Technically, we could hold the value (1 << (INT_MAX+1)) in @@ -8223,7 +8191,7 @@ ExecuteExtendedBinaryMathOp( * Quickly force large right shifts to 0 or -1. */ - if ((type2 != TCL_NUMBER_LONG) + if ((type2 != TCL_NUMBER_LONG && type2 != TCL_NUMBER_WIDE) || (*(const Tcl_WideInt *)ptr2 > INT_MAX)) { /* * Again, technically, the value to be shifted could be an @@ -8258,7 +8226,7 @@ ExecuteExtendedBinaryMathOp( * Handle shifts within the native wide range. */ - if (type1 == TCL_NUMBER_WIDE) { + if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { w1 = *(const Tcl_WideInt *)ptr1; if ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideInt)) { if (w1 >= (Tcl_WideInt)0) { @@ -8435,7 +8403,7 @@ ExecuteExtendedBinaryMathOp( BIG_RESULT(&bigResult); } - if ((type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_WIDE)) { + if ((type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE)) { TclGetWideIntFromObj(NULL, valuePtr, &w1); TclGetWideIntFromObj(NULL, value2Ptr, &w2); @@ -8455,24 +8423,24 @@ ExecuteExtendedBinaryMathOp( } WIDE_RESULT(wResult); } - l1 = w1 = *((const Tcl_WideInt *)ptr1); - l2 = w2 = *((const Tcl_WideInt *)ptr2); + w1 = *((const Tcl_WideInt *)ptr1); + w2 = *((const Tcl_WideInt *)ptr2); switch (opcode) { case INST_BITAND: - lResult = l1 & l2; + wResult = w1 & w2; break; case INST_BITOR: - lResult = l1 | l2; + wResult = w1 | w2; break; case INST_BITXOR: - lResult = l1 ^ l2; + wResult = w1 ^ w2; break; default: /* Unused, here to silence compiler warning. */ - lResult = 0; + wResult = 0; } - WIDE_RESULT(lResult); + WIDE_RESULT(wResult); case INST_EXPON: { int oddExponent = 0, negativeExponent = 0; @@ -8488,9 +8456,9 @@ ExecuteExtendedBinaryMathOp( dResult = pow(d1, d2); goto doubleResult; } - l1 = l2 = 0; - if (type2 == TCL_NUMBER_LONG) { - l2 = w2 = *((const Tcl_WideInt *) ptr2); + w2 = 0; + if (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE) { + w2 = *((const Tcl_WideInt *) ptr2); if (w2 == 0) { /* * Anything to the zero power is 1. @@ -8523,10 +8491,10 @@ ExecuteExtendedBinaryMathOp( } if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { - l1 = w1 = *((const Tcl_WideInt *)ptr1); + w1 = *((const Tcl_WideInt *)ptr1); } if (negativeExponent) { - if (type1 == TCL_NUMBER_LONG) { + if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { switch (w1) { case 0: /* @@ -8556,7 +8524,7 @@ ExecuteExtendedBinaryMathOp( return constants[0]; } - if (type1 == TCL_NUMBER_LONG) { + if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { switch (w1) { case 0: /* @@ -8587,13 +8555,13 @@ ExecuteExtendedBinaryMathOp( * accept. */ - if (type2 != TCL_NUMBER_LONG) { + if (type2 != TCL_NUMBER_LONG && type2 != TCL_NUMBER_WIDE) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "exponent too large", -1)); return GENERAL_ARITHMETIC_ERROR; } - if (type1 == TCL_NUMBER_LONG) { + if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { if (w1 == 2) { /* * Reduce small powers of 2 to shifts. @@ -8817,7 +8785,7 @@ ExecuteExtendedBinaryMathOp( switch (opcode) { case INST_ADD: wResult = w1 + w2; - if ((type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_WIDE)) + if ((type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE)) { /* * Check for overflow. -- cgit v0.12 From adc216698f7b3e45354f185b714df1754c429aa9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 31 Oct 2017 16:40:57 +0000 Subject: Eliminate most usage of TCL_NUMBER_LONG, just use TCL_NUMBER_WIDE in stead (since both have the same internal representation now) --- generic/tclBasic.c | 3 +-- generic/tclExecute.c | 67 +++++++++++++++++++++------------------------------- 2 files changed, 28 insertions(+), 42 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index a911028..f69e861 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -6466,7 +6466,6 @@ Tcl_ExprLongObj( resultPtr = Tcl_NewBignumObj(&big); /* FALLTHROUGH */ } - case TCL_NUMBER_LONG: case TCL_NUMBER_WIDE: case TCL_NUMBER_BIG: result = TclGetLongFromObj(interp, resultPtr, ptr); @@ -7442,7 +7441,7 @@ ExprAbsFunc( return TCL_ERROR; } - if (type == TCL_NUMBER_LONG || type == TCL_NUMBER_WIDE) { + if (type == TCL_NUMBER_WIDE) { Tcl_WideInt l = *((const Tcl_WideInt *) ptr); if (l > (Tcl_WideInt)0) { diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 846b04f..9eed936 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -501,7 +501,7 @@ VarHashCreateVar( #ifdef TCL_WIDE_INT_IS_LONG #define GetNumberFromObj(interp, objPtr, ptrPtr, tPtr) \ (((objPtr)->typePtr == &tclIntType) \ - ? (*(tPtr) = TCL_NUMBER_LONG, \ + ? (*(tPtr) = TCL_NUMBER_WIDE, \ *(ptrPtr) = (ClientData) \ (&((objPtr)->internalRep.wideValue)), TCL_OK) : \ ((objPtr)->typePtr == &tclDoubleType) \ @@ -516,7 +516,7 @@ VarHashCreateVar( #else /* !TCL_WIDE_INT_IS_LONG */ #define GetNumberFromObj(interp, objPtr, ptrPtr, tPtr) \ (((objPtr)->typePtr == &tclIntType) \ - ? (*(tPtr) = TCL_NUMBER_LONG, \ + ? (*(tPtr) = TCL_NUMBER_WIDE, \ *(ptrPtr) = (ClientData) \ (&((objPtr)->internalRep.wideValue)), TCL_OK) : \ ((objPtr)->typePtr == &tclWideIntType) \ @@ -3657,7 +3657,7 @@ TEBCresume( objPtr = varPtr->value.objPtr; if (GetNumberFromObj(NULL, objPtr, &ptr, &type) == TCL_OK) { - if (type == TCL_NUMBER_LONG || type == TCL_NUMBER_WIDE) { + if (type == TCL_NUMBER_WIDE) { Tcl_WideInt augend = *((const Tcl_WideInt *)ptr); Tcl_WideInt sum = augend + increment; @@ -3699,7 +3699,7 @@ TEBCresume( TclSetWideIntObj(objPtr, w+increment); } goto doneIncr; - } /* end if (type == TCL_NUMBER_LONG || type == TCL_NUMBER_WIDE) */ + } /* end if (type == TCL_NUMBER_WIDE) */ } if (Tcl_IsShared(objPtr)) { objPtr->refCount--; /* We know it's shared */ @@ -5802,7 +5802,7 @@ TEBCresume( case INST_NUM_TYPE: if (GetNumberFromObj(NULL, OBJ_AT_TOS, &ptr1, &type1) != TCL_OK) { type1 = 0; - } else if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { + } else if (type1 == TCL_NUMBER_WIDE) { /* value is between WIDE_MIN and WIDE_MAX */ /* [string is integer] is -UINT_MAX to UINT_MAX range */ /* [string is wideinteger] is -UWIDE_MAX to UWIDE_MAX range */ @@ -5815,14 +5815,10 @@ TEBCresume( } } else if (type1 == TCL_NUMBER_BIG) { /* value is an integer outside the WIDE_MIN to WIDE_MAX range */ - /* [string is integer] is -UINT_MAX to UINT_MAX range */ /* [string is wideinteger] is -UWIDE_MAX to UWIDE_MAX range */ - int i; Tcl_WideInt w; - if (Tcl_GetIntFromObj(NULL, OBJ_AT_TOS, &i) == TCL_OK) { - type1 = TCL_NUMBER_LONG; - } else if (Tcl_GetWideIntFromObj(NULL, OBJ_AT_TOS, &w) == TCL_OK) { + if (Tcl_GetWideIntFromObj(NULL, OBJ_AT_TOS, &w) == TCL_OK) { type1 = TCL_NUMBER_WIDE; } } @@ -5861,7 +5857,7 @@ TEBCresume( compare = MP_EQ; goto convertComparison; } - if ((type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) && (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE)) { + if ((type1 == TCL_NUMBER_WIDE) && (type2 == TCL_NUMBER_WIDE)) { w1 = *((const Tcl_WideInt *)ptr1); w2 = *((const Tcl_WideInt *)ptr2); compare = (w1 < w2) ? MP_LT : ((w1 > w2) ? MP_GT : MP_EQ); @@ -5940,7 +5936,7 @@ TEBCresume( * Check for common, simple case. */ - if ((type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) && (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE)) { + if ((type1 == TCL_NUMBER_WIDE) && (type2 == TCL_NUMBER_WIDE)) { w1 = *((const Tcl_WideInt *)ptr1); w2 = *((const Tcl_WideInt *)ptr2); @@ -6180,7 +6176,7 @@ TEBCresume( * an external function. */ - if ((type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) && (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE)) { + if ((type1 == TCL_NUMBER_WIDE) && (type2 == TCL_NUMBER_WIDE)) { w1 = *((const Tcl_WideInt *)ptr1); w2 = *((const Tcl_WideInt *)ptr2); @@ -6323,7 +6319,7 @@ TEBCresume( CACHE_STACK_INFO(); goto gotError; } - if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { + if (type1 == TCL_NUMBER_WIDE) { w1 = *((const Tcl_WideInt *) ptr1); if (Tcl_IsShared(valuePtr)) { TclNewWideObj(objResultPtr, ~w1); @@ -6360,7 +6356,6 @@ TEBCresume( /* -NaN => NaN */ TRACE_APPEND(("%s\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); - case TCL_NUMBER_LONG: case TCL_NUMBER_WIDE: w1 = *((const Tcl_WideInt *) ptr1); if (w1 != LLONG_MIN) { @@ -8039,7 +8034,7 @@ ExecuteExtendedBinaryMathOp( /* TODO: Attempts to re-use unshared operands on stack */ w2 = 0; /* silence gcc warning */ - if (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE) { + if (type2 == TCL_NUMBER_WIDE) { w2 = *((const Tcl_WideInt *)ptr2); if (w2 == 0) { return DIVIDED_BY_ZERO; @@ -8122,7 +8117,6 @@ ExecuteExtendedBinaryMathOp( */ switch (type2) { - case TCL_NUMBER_LONG: case TCL_NUMBER_WIDE: invalid = (*((const Tcl_WideInt *)ptr2) < (Tcl_WideInt)0); break; @@ -8145,7 +8139,7 @@ ExecuteExtendedBinaryMathOp( * Zero shifted any number of bits is still zero. */ - if ((type1==TCL_NUMBER_LONG || type1==TCL_NUMBER_WIDE) && (*((const Tcl_WideInt *)ptr1) == (Tcl_WideInt)0)) { + if ((type1==TCL_NUMBER_WIDE) && (*((const Tcl_WideInt *)ptr1) == (Tcl_WideInt)0)) { return constants[0]; } @@ -8158,7 +8152,7 @@ ExecuteExtendedBinaryMathOp( * counterparts, leading to incorrect results. */ - if ((type2 != TCL_NUMBER_LONG && type2 != TCL_NUMBER_WIDE) + if ((type2 != TCL_NUMBER_WIDE) || (*((const Tcl_WideInt *)ptr2) > (long) INT_MAX)) { /* * Technically, we could hold the value (1 << (INT_MAX+1)) in @@ -8191,7 +8185,7 @@ ExecuteExtendedBinaryMathOp( * Quickly force large right shifts to 0 or -1. */ - if ((type2 != TCL_NUMBER_LONG && type2 != TCL_NUMBER_WIDE) + if ((type2 != TCL_NUMBER_WIDE) || (*(const Tcl_WideInt *)ptr2 > INT_MAX)) { /* * Again, technically, the value to be shifted could be an @@ -8202,7 +8196,6 @@ ExecuteExtendedBinaryMathOp( */ switch (type1) { - case TCL_NUMBER_LONG: case TCL_NUMBER_WIDE: zero = (*(const Tcl_WideInt *)ptr1 > (Tcl_WideInt)0); break; @@ -8226,7 +8219,7 @@ ExecuteExtendedBinaryMathOp( * Handle shifts within the native wide range. */ - if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { + if (type1 == TCL_NUMBER_WIDE) { w1 = *(const Tcl_WideInt *)ptr1; if ((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideInt)) { if (w1 >= (Tcl_WideInt)0) { @@ -8403,7 +8396,7 @@ ExecuteExtendedBinaryMathOp( BIG_RESULT(&bigResult); } - if ((type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE)) { + if ((type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_WIDE)) { TclGetWideIntFromObj(NULL, valuePtr, &w1); TclGetWideIntFromObj(NULL, value2Ptr, &w2); @@ -8457,7 +8450,7 @@ ExecuteExtendedBinaryMathOp( goto doubleResult; } w2 = 0; - if (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE) { + if (type2 == TCL_NUMBER_WIDE) { w2 = *((const Tcl_WideInt *) ptr2); if (w2 == 0) { /* @@ -8475,7 +8468,6 @@ ExecuteExtendedBinaryMathOp( } switch (type2) { - case TCL_NUMBER_LONG: case TCL_NUMBER_WIDE: w2 = *((const Tcl_WideInt *)ptr2); negativeExponent = (w2 < 0); @@ -8490,11 +8482,11 @@ ExecuteExtendedBinaryMathOp( break; } - if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { + if (type1 == TCL_NUMBER_WIDE) { w1 = *((const Tcl_WideInt *)ptr1); } if (negativeExponent) { - if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { + if (type1 == TCL_NUMBER_WIDE) { switch (w1) { case 0: /* @@ -8524,7 +8516,7 @@ ExecuteExtendedBinaryMathOp( return constants[0]; } - if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { + if (type1 == TCL_NUMBER_WIDE) { switch (w1) { case 0: /* @@ -8551,17 +8543,17 @@ ExecuteExtendedBinaryMathOp( * which means the max exponent value is 2**28-1 = 0x0fffffff = * 268435455, which fits into a signed 32 bit int which is within the * range of the long int type. This means any numeric Tcl_Obj value - * not using TCL_NUMBER_LONG type must hold a value larger than we + * not using TCL_NUMBER_WIDE type must hold a value larger than we * accept. */ - if (type2 != TCL_NUMBER_LONG && type2 != TCL_NUMBER_WIDE) { + if (type2 != TCL_NUMBER_WIDE) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "exponent too large", -1)); return GENERAL_ARITHMETIC_ERROR; } - if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { + if (type1 == TCL_NUMBER_WIDE) { if (w1 == 2) { /* * Reduce small powers of 2 to shifts. @@ -8585,7 +8577,7 @@ ExecuteExtendedBinaryMathOp( goto overflowExpon; } } - if (type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) { + if (type1 == TCL_NUMBER_WIDE) { w1 = *((const Tcl_WideInt *) ptr1); } else { goto overflowExpon; @@ -8785,7 +8777,7 @@ ExecuteExtendedBinaryMathOp( switch (opcode) { case INST_ADD: wResult = w1 + w2; - if ((type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE)) + if ((type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_WIDE)) { /* * Check for overflow. @@ -8799,7 +8791,7 @@ ExecuteExtendedBinaryMathOp( case INST_SUB: wResult = w1 - w2; - if ((type1 == TCL_NUMBER_LONG || type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_LONG || type2 == TCL_NUMBER_WIDE)) + if ((type1 == TCL_NUMBER_WIDE) || (type2 == TCL_NUMBER_WIDE)) { /* * Must check for overflow. The macro tests for overflows @@ -8922,7 +8914,7 @@ ExecuteExtendedUnaryMathOp( switch (opcode) { case INST_BITNOT: - if (type == TCL_NUMBER_LONG || type == TCL_NUMBER_WIDE) { + if (type == TCL_NUMBER_WIDE) { w = *((const Tcl_WideInt *) ptr); WIDE_RESULT(~w); } @@ -8935,7 +8927,6 @@ ExecuteExtendedUnaryMathOp( switch (type) { case TCL_NUMBER_DOUBLE: DOUBLE_RESULT(-(*((const double *) ptr))); - case TCL_NUMBER_LONG: case TCL_NUMBER_WIDE: w = *((const Tcl_WideInt *) ptr); if (w != LLONG_MIN) { @@ -8990,11 +8981,9 @@ TclCompareTwoNumbers( (void) GetNumberFromObj(NULL, value2Ptr, &ptr2, &type2); switch (type1) { - case TCL_NUMBER_LONG: case TCL_NUMBER_WIDE: w1 = *((const Tcl_WideInt *)ptr1); switch (type2) { - case TCL_NUMBER_LONG: case TCL_NUMBER_WIDE: w2 = *((const Tcl_WideInt *)ptr2); wideCompare: @@ -9052,7 +9041,6 @@ TclCompareTwoNumbers( d2 = *((const double *)ptr2); doubleCompare: return (d1 < d2) ? MP_LT : ((d1 > d2) ? MP_GT : MP_EQ); - case TCL_NUMBER_LONG: case TCL_NUMBER_WIDE: w2 = *((const Tcl_WideInt *)ptr2); d2 = (double) w2; @@ -9095,7 +9083,6 @@ TclCompareTwoNumbers( case TCL_NUMBER_BIG: Tcl_TakeBignumFromObj(NULL, valuePtr, &big1); switch (type2) { - case TCL_NUMBER_LONG: case TCL_NUMBER_WIDE: compare = mp_cmp_d(&big1, 0); mp_clear(&big1); -- cgit v0.12 From 9e2ed8b729812f2ab4c70025a0e71f255bec1a78 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 1 Nov 2017 12:35:40 +0000 Subject: Finally, get rid of tclWideIntType completely --- generic/tclAssembly.c | 2 +- generic/tclBasic.c | 2 +- generic/tclCmdMZ.c | 4 +-- generic/tclExecute.c | 68 +++++++++++++++++---------------------------------- generic/tclInt.h | 53 +++++---------------------------------- generic/tclObj.c | 67 +++++++++++++++----------------------------------- generic/tclStrToD.c | 4 +-- generic/tclTimer.c | 1 - generic/tclUtil.c | 4 +-- generic/tclZlib.c | 2 +- 10 files changed, 56 insertions(+), 151 deletions(-) diff --git a/generic/tclAssembly.c b/generic/tclAssembly.c index c7ded6e..0fd7c60 100644 --- a/generic/tclAssembly.c +++ b/generic/tclAssembly.c @@ -4266,7 +4266,7 @@ AddBasicBlockRangeToErrorInfo( Tcl_AppendObjToErrorInfo(interp, lineNo); Tcl_AddErrorInfo(interp, " and "); if (bbPtr->successor1 != NULL) { - TclSetWideIntObj(lineNo, bbPtr->successor1->startLine); + TclSetWideObj(lineNo, bbPtr->successor1->startLine); Tcl_AppendObjToErrorInfo(interp, lineNo); } else { Tcl_AddErrorInfo(interp, "end of assembly code"); diff --git a/generic/tclBasic.c b/generic/tclBasic.c index f69e861..f84b420 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3651,7 +3651,7 @@ OldMathFuncProc( */ if (funcResult.type == TCL_INT) { - TclNewLongObj(valuePtr, funcResult.intValue); + TclNewWideObj(valuePtr, funcResult.intValue); } else if (funcResult.type == TCL_WIDE_INT) { valuePtr = Tcl_NewWideIntObj(funcResult.wideValue); } else { diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index c984bbe..8ab687f 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1596,7 +1596,6 @@ StringIsCmd( /* TODO */ if ((objPtr->typePtr == &tclDoubleType) || (objPtr->typePtr == &tclIntType) || - (objPtr->typePtr == &tclWideIntType) || (objPtr->typePtr == &tclBignumType)) { break; } @@ -1631,7 +1630,6 @@ StringIsCmd( goto failedIntParse; case STR_IS_ENTIER: if ((objPtr->typePtr == &tclIntType) || - (objPtr->typePtr == &tclWideIntType) || (objPtr->typePtr == &tclBignumType)) { break; } @@ -4289,7 +4287,7 @@ TclNRTryObjCmd( } info[0] = objv[i]; /* type */ - TclNewLongObj(info[1], code); /* returnCode */ + TclNewWideObj(info[1], code); /* returnCode */ if (info[2] == NULL) { /* errorCodePrefix */ TclNewObj(info[2]); } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 9eed936..51f9bff 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -325,7 +325,7 @@ VarHashCreateVar( NEXT_INST_F(((condition)? TclGetInt4AtPtr(pc+1) : 5), (cleanup), 0); \ default: \ if ((condition) < 0) { \ - TclNewLongObj(objResultPtr, -1); \ + TclNewWideObj(objResultPtr, -1); \ } else { \ objResultPtr = TCONST((condition) > 0); \ } \ @@ -346,7 +346,7 @@ VarHashCreateVar( NEXT_INST_V(((condition)? TclGetInt4AtPtr(pc+1) : 5), (cleanup), 0); \ default: \ if ((condition) < 0) { \ - TclNewLongObj(objResultPtr, -1); \ + TclNewWideObj(objResultPtr, -1); \ } else { \ objResultPtr = TCONST((condition) > 0); \ } \ @@ -357,7 +357,7 @@ VarHashCreateVar( #define JUMP_PEEPHOLE_F(condition, pcAdjustment, cleanup) \ do{ \ if ((condition) < 0) { \ - TclNewLongObj(objResultPtr, -1); \ + TclNewWideObj(objResultPtr, -1); \ } else { \ objResultPtr = TCONST((condition) > 0); \ } \ @@ -366,7 +366,7 @@ VarHashCreateVar( #define JUMP_PEEPHOLE_V(condition, pcAdjustment, cleanup) \ do{ \ if ((condition) < 0) { \ - TclNewLongObj(objResultPtr, -1); \ + TclNewWideObj(objResultPtr, -1); \ } else { \ objResultPtr = TCONST((condition) > 0); \ } \ @@ -498,7 +498,6 @@ VarHashCreateVar( * ClientData *ptrPtr, int *tPtr); */ -#ifdef TCL_WIDE_INT_IS_LONG #define GetNumberFromObj(interp, objPtr, ptrPtr, tPtr) \ (((objPtr)->typePtr == &tclIntType) \ ? (*(tPtr) = TCL_NUMBER_WIDE, \ @@ -513,26 +512,6 @@ VarHashCreateVar( (((objPtr)->bytes != NULL) && ((objPtr)->length == 0)) \ ? TCL_ERROR : \ TclGetNumberFromObj((interp), (objPtr), (ptrPtr), (tPtr))) -#else /* !TCL_WIDE_INT_IS_LONG */ -#define GetNumberFromObj(interp, objPtr, ptrPtr, tPtr) \ - (((objPtr)->typePtr == &tclIntType) \ - ? (*(tPtr) = TCL_NUMBER_WIDE, \ - *(ptrPtr) = (ClientData) \ - (&((objPtr)->internalRep.wideValue)), TCL_OK) : \ - ((objPtr)->typePtr == &tclWideIntType) \ - ? (*(tPtr) = TCL_NUMBER_WIDE, \ - *(ptrPtr) = (ClientData) \ - (&((objPtr)->internalRep.wideValue)), TCL_OK) : \ - ((objPtr)->typePtr == &tclDoubleType) \ - ? (((TclIsNaN((objPtr)->internalRep.doubleValue)) \ - ? (*(tPtr) = TCL_NUMBER_NAN) \ - : (*(tPtr) = TCL_NUMBER_DOUBLE)), \ - *(ptrPtr) = (ClientData) \ - (&((objPtr)->internalRep.doubleValue)), TCL_OK) : \ - (((objPtr)->bytes != NULL) && ((objPtr)->length == 0)) \ - ? TCL_ERROR : \ - TclGetNumberFromObj((interp), (objPtr), (ptrPtr), (tPtr))) -#endif /* TCL_WIDE_INT_IS_LONG */ /* * Macro used in this file to save a function call for common uses of @@ -873,9 +852,9 @@ TclCreateExecEnv( + (size_t) (size-1) * sizeof(Tcl_Obj *)); eePtr->execStackPtr = esPtr; - TclNewLongObj(eePtr->constants[0], 0); + TclNewWideObj(eePtr->constants[0], 0); Tcl_IncrRefCount(eePtr->constants[0]); - TclNewLongObj(eePtr->constants[1], 1); + TclNewWideObj(eePtr->constants[1], 1); Tcl_IncrRefCount(eePtr->constants[1]); eePtr->interp = interp; eePtr->callbackPtr = NULL; @@ -3676,7 +3655,7 @@ TEBCresume( varPtr->value.objPtr = objResultPtr; } else { objResultPtr = objPtr; - TclSetWideIntObj(objPtr, sum); + TclSetWideObj(objPtr, sum); } goto doneIncr; } @@ -3696,7 +3675,7 @@ TEBCresume( * use macro form that doesn't range test again. */ - TclSetWideIntObj(objPtr, w+increment); + TclSetWideObj(objPtr, w+increment); } goto doneIncr; } /* end if (type == TCL_NUMBER_WIDE) */ @@ -3709,7 +3688,7 @@ TEBCresume( } else { objResultPtr = objPtr; } - TclNewLongObj(incrPtr, increment); + TclNewWideObj(incrPtr, increment); if (TclIncrObj(interp, objResultPtr, incrPtr) != TCL_OK) { Tcl_DecrRefCount(incrPtr); TRACE_ERROR(interp); @@ -3723,7 +3702,7 @@ TEBCresume( * All other cases, flow through to generic handling. */ - TclNewLongObj(incrPtr, increment); + TclNewWideObj(incrPtr, increment); Tcl_IncrRefCount(incrPtr); doIncrScalar: @@ -4421,7 +4400,7 @@ TEBCresume( NEXT_INST_F(1, 0, 1); } case INST_INFO_LEVEL_NUM: - TclNewLongObj(objResultPtr, iPtr->varFramePtr->level); + TclNewWideObj(objResultPtr, iPtr->varFramePtr->level); TRACE_WITH_OBJ(("=> "), objResultPtr); NEXT_INST_F(1, 0, 1); case INST_INFO_LEVEL_ARGS: { @@ -4790,7 +4769,7 @@ TEBCresume( TRACE_ERROR(interp); goto gotError; } - TclNewLongObj(objResultPtr, length); + TclNewWideObj(objResultPtr, length); TRACE_APPEND(("%d\n", length)); NEXT_INST_F(1, 1, 1); @@ -5261,7 +5240,7 @@ TEBCresume( case INST_STR_LEN: valuePtr = OBJ_AT_TOS; length = Tcl_GetCharLength(valuePtr); - TclNewLongObj(objResultPtr, length); + TclNewWideObj(objResultPtr, length); TRACE(("\"%.20s\" => %d\n", O2S(valuePtr), length)); NEXT_INST_F(1, 1, 1); @@ -5616,7 +5595,7 @@ TEBCresume( TRACE(("%.20s %.20s => %d\n", O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match)); - TclNewLongObj(objResultPtr, match); + TclNewWideObj(objResultPtr, match); NEXT_INST_F(1, 2, 1); case INST_STR_FIND_LAST: @@ -5624,7 +5603,7 @@ TEBCresume( TRACE(("%.20s %.20s => %d\n", O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match)); - TclNewLongObj(objResultPtr, match); + TclNewWideObj(objResultPtr, match); NEXT_INST_F(1, 2, 1); case INST_STR_CLASS: @@ -5822,7 +5801,7 @@ TEBCresume( type1 = TCL_NUMBER_WIDE; } } - TclNewLongObj(objResultPtr, type1); + TclNewWideObj(objResultPtr, type1); TRACE(("\"%.20s\" => %d\n", O2S(OBJ_AT_TOS), type1)); NEXT_INST_F(1, 1, 1); @@ -6015,7 +5994,7 @@ TEBCresume( if (w1 > 0L) { objResultPtr = TCONST(0); } else { - TclNewLongObj(objResultPtr, -1); + TclNewWideObj(objResultPtr, -1); } TRACE(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 2, 1); @@ -6326,7 +6305,7 @@ TEBCresume( TRACE_APPEND(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 1, 1); } - TclSetWideIntObj(valuePtr, ~w1); + TclSetWideObj(valuePtr, ~w1); TRACE_APPEND(("%s\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); } @@ -6364,7 +6343,7 @@ TEBCresume( TRACE_APPEND(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 1, 1); } - TclSetWideIntObj(valuePtr, -w1); + TclSetWideObj(valuePtr, -w1); TRACE_APPEND(("%s\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); } @@ -6525,10 +6504,10 @@ TEBCresume( oldValuePtr = iterVarPtr->value.objPtr; if (oldValuePtr == NULL) { - TclNewLongObj(iterVarPtr->value.objPtr, -1); + TclNewWideObj(iterVarPtr->value.objPtr, -1); Tcl_IncrRefCount(iterVarPtr->value.objPtr); } else { - TclSetLongObj(oldValuePtr, -1); + TclSetWideObj(oldValuePtr, -1); } TRACE(("%u => loop iter count temp %d\n", opnd, iterTmpIndex)); @@ -6563,7 +6542,7 @@ TEBCresume( iterVarPtr = LOCAL(infoPtr->loopCtTemp); valuePtr = iterVarPtr->value.objPtr; iterNum = valuePtr->internalRep.wideValue + 1; - TclSetLongObj(valuePtr, iterNum); + TclSetWideObj(valuePtr, iterNum); /* * Check whether all value lists are exhausted and we should stop the @@ -6896,7 +6875,7 @@ TEBCresume( NEXT_INST_F(1, 0, -1); case INST_PUSH_RETURN_CODE: - TclNewLongObj(objResultPtr, result); + TclNewWideObj(objResultPtr, result); TRACE(("=> %u\n", result)); NEXT_INST_F(1, 0, 1); @@ -7562,7 +7541,6 @@ TEBCresume( default: Tcl_Panic("clockRead instruction with unknown clock#"); } - /* TclNewWideObj(objResultPtr, wval); doesn't exist */ objResultPtr = Tcl_NewWideIntObj(wval); TRACE_WITH_OBJ(("=> "), objResultPtr); NEXT_INST_F(2, 0, 1); diff --git a/generic/tclInt.h b/generic/tclInt.h index 3799287..34e3e43 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2451,12 +2451,13 @@ typedef struct List { * WARNING: these macros eval their args more than once. */ -#define TclGetLongFromObj(interp, objPtr, longPtr) \ +#define TclGetLongFromObj(interp, objPtr, longPtr) Tcl_GetLongFromObj(interp, objPtr, longPtr) +#define TclGetLongFromObjX(interp, objPtr, longPtr) \ (((objPtr)->typePtr == &tclIntType) \ ? ((*(longPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \ : Tcl_GetLongFromObj((interp), (objPtr), (longPtr))) -#if (LONG_MAX == INT_MAX) +#if 0 #define TclGetIntFromObj(interp, objPtr, intPtr) \ (((objPtr)->typePtr == &tclIntType) \ ? ((*(intPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \ @@ -2480,21 +2481,11 @@ typedef struct List { * Tcl_WideInt *wideIntPtr); */ -#ifdef TCL_WIDE_INT_IS_LONG #define TclGetWideIntFromObj(interp, objPtr, wideIntPtr) \ (((objPtr)->typePtr == &tclIntType) \ ? (*(wideIntPtr) = (Tcl_WideInt) \ ((objPtr)->internalRep.wideValue), TCL_OK) : \ Tcl_GetWideIntFromObj((interp), (objPtr), (wideIntPtr))) -#else /* !TCL_WIDE_INT_IS_LONG */ -#define TclGetWideIntFromObj(interp, objPtr, wideIntPtr) \ - (((objPtr)->typePtr == &tclWideIntType) \ - ? (*(wideIntPtr) = (objPtr)->internalRep.wideValue, TCL_OK) : \ - ((objPtr)->typePtr == &tclIntType) \ - ? (*(wideIntPtr) = (Tcl_WideInt) \ - ((objPtr)->internalRep.wideValue), TCL_OK) : \ - Tcl_GetWideIntFromObj((interp), (objPtr), (wideIntPtr))) -#endif /* TCL_WIDE_INT_IS_LONG */ /* * Flag values for TclTraceDictPath(). @@ -2720,7 +2711,6 @@ MODULE_SCOPE const Tcl_ObjType tclDictType; MODULE_SCOPE const Tcl_ObjType tclProcBodyType; MODULE_SCOPE const Tcl_ObjType tclStringType; MODULE_SCOPE const Tcl_ObjType tclEnsembleCmdType; -MODULE_SCOPE const Tcl_ObjType tclWideIntType; MODULE_SCOPE const Tcl_ObjType tclRegexpType; MODULE_SCOPE Tcl_ObjType tclCmdNameType; @@ -4533,13 +4523,12 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; * core. They should only be called on unshared objects. The ANSI C * "prototypes" for these macros are: * - * MODULE_SCOPE void TclSetLongObj(Tcl_Obj *objPtr, long longValue); - * MODULE_SCOPE void TclSetWideIntObj(Tcl_Obj *objPtr, Tcl_WideInt w); + * MODULE_SCOPE void TclSetWideObj(Tcl_Obj *objPtr, Tcl_WideInt w); * MODULE_SCOPE void TclSetDoubleObj(Tcl_Obj *objPtr, double d); *---------------------------------------------------------------- */ -#define TclSetLongObj(objPtr, i) \ +#define TclSetWideObj(objPtr, i) \ do { \ TclInvalidateStringRep(objPtr); \ TclFreeIntRep(objPtr); \ @@ -4547,18 +4536,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; (objPtr)->typePtr = &tclIntType; \ } while (0) -#ifdef TCL_WIDE_INT_IS_LONG -#define TclSetWideIntObj(objPtr, w) TclSetLongObj(objPtr, w) -#else -#define TclSetWideIntObj(objPtr, w) \ - do { \ - TclInvalidateStringRep(objPtr); \ - TclFreeIntRep(objPtr); \ - (objPtr)->internalRep.wideValue = (Tcl_WideInt)(w); \ - (objPtr)->typePtr = &tclWideIntType; \ - } while (0) -#endif - #define TclSetDoubleObj(objPtr, d) \ do { \ TclInvalidateStringRep(objPtr); \ @@ -4573,7 +4550,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; * types, avoiding the corresponding function calls in time critical parts of * the core. The ANSI C "prototypes" for these macros are: * - * MODULE_SCOPE void TclNewLongObj(Tcl_Obj *objPtr, long l); * MODULE_SCOPE void TclNewWideObj(Tcl_Obj *objPtr, Tcl_WideInt w); * MODULE_SCOPE void TclNewDoubleObj(Tcl_Obj *objPtr, double d); * MODULE_SCOPE void TclNewStringObj(Tcl_Obj *objPtr, const char *s, int len); @@ -4583,7 +4559,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; */ #ifndef TCL_MEM_DEBUG -#define TclNewLongObj(objPtr, i) \ +#define TclNewWideObj(objPtr, i) \ do { \ TclIncrObjsAllocated(); \ TclAllocObjStorage(objPtr); \ @@ -4594,20 +4570,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; TCL_DTRACE_OBJ_CREATE(objPtr); \ } while (0) -#ifndef TCL_WIDE_INT_IS_LONG -#define TclNewWideObj(objPtr, i) \ - do { \ - TclIncrObjsAllocated(); \ - TclAllocObjStorage(objPtr); \ - (objPtr)->refCount = 0; \ - (objPtr)->bytes = NULL; \ - (objPtr)->internalRep.wideValue = (Tcl_WideInt)(i); \ - (objPtr)->typePtr = &tclWideIntType; \ - TCL_DTRACE_OBJ_CREATE(objPtr); \ - } while (0) -#else -#define TclNewWideObj(objPtr, i) TclNewLongObj(objPtr, i) -#endif #define TclNewDoubleObj(objPtr, d) \ do { \ TclIncrObjsAllocated(); \ @@ -4630,9 +4592,6 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; } while (0) #else /* TCL_MEM_DEBUG */ -#define TclNewLongObj(objPtr, l) \ - (objPtr) = Tcl_NewLongObj(l) - #define TclNewWideObj(objPtr, w) \ (objPtr) = Tcl_NewWideIntObj(w) diff --git a/generic/tclObj.c b/generic/tclObj.c index e4613ba..04fdeaa 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -266,13 +266,6 @@ const Tcl_ObjType tclIntType = { UpdateStringOfInt, /* updateStringProc */ SetIntFromAny /* setFromAnyProc */ }; -const Tcl_ObjType tclWideIntType = { - "wideInt", /* name */ - NULL, /* freeIntRepProc */ - NULL, /* dupIntRepProc */ - UpdateStringOfInt, /* updateStringProc */ - SetIntFromAny /* setFromAnyProc */ -}; const Tcl_ObjType tclBignumType = { "bignum", /* name */ FreeBignum, /* freeIntRepProc */ @@ -1753,7 +1746,7 @@ Tcl_NewBooleanObj( { register Tcl_Obj *objPtr; - TclNewLongObj(objPtr, boolValue!=0); + TclNewWideObj(objPtr, boolValue!=0); return objPtr; } #endif /* TCL_MEM_DEBUG */ @@ -1848,7 +1841,7 @@ Tcl_SetBooleanObj( Tcl_Panic("%s called with shared object", "Tcl_SetBooleanObj"); } - TclSetLongObj(objPtr, boolValue!=0); + TclSetWideObj(objPtr, boolValue!=0); } #endif /* TCL_NO_DEPRECATED */ @@ -1907,10 +1900,6 @@ Tcl_GetBooleanFromObj( *boolPtr = 1; return TCL_OK; } - if (objPtr->typePtr == &tclWideIntType) { - *boolPtr = (objPtr->internalRep.wideValue != 0); - return TCL_OK; - } } while ((ParseBoolean(objPtr) == TCL_OK) || (TCL_OK == TclParseNumber(interp, objPtr, "boolean value", NULL,-1,NULL,0))); return TCL_ERROR; @@ -1960,10 +1949,6 @@ TclSetBooleanFromAny( goto badBoolean; } - if (objPtr->typePtr == &tclWideIntType) { - goto badBoolean; - } - if (objPtr->typePtr == &tclDoubleType) { goto badBoolean; } @@ -2281,7 +2266,7 @@ Tcl_GetDoubleFromObj( return TCL_OK; } if (objPtr->typePtr == &tclIntType) { - *dblPtr = objPtr->internalRep.wideValue; + *dblPtr = (double) objPtr->internalRep.wideValue; return TCL_OK; } if (objPtr->typePtr == &tclBignumType) { @@ -2291,10 +2276,6 @@ Tcl_GetDoubleFromObj( *dblPtr = TclBignumToDouble(&big); return TCL_OK; } - if (objPtr->typePtr == &tclWideIntType) { - *dblPtr = (double) objPtr->internalRep.wideValue; - return TCL_OK; - } } while (SetDoubleFromAny(interp, objPtr) == TCL_OK); return TCL_ERROR; } @@ -2412,7 +2393,7 @@ Tcl_NewIntObj( { register Tcl_Obj *objPtr; - TclNewLongObj(objPtr, intValue); + TclNewWideObj(objPtr, intValue); return objPtr; } #endif /* if TCL_MEM_DEBUG */ @@ -2445,7 +2426,7 @@ Tcl_SetIntObj( Tcl_Panic("%s called with shared object", "Tcl_SetIntObj"); } - TclSetLongObj(objPtr, intValue); + TclSetWideObj(objPtr, intValue); } /* @@ -2610,7 +2591,7 @@ Tcl_NewLongObj( { register Tcl_Obj *objPtr; - TclNewLongObj(objPtr, longValue); + TclNewWideObj(objPtr, longValue); return objPtr; } #endif /* if TCL_MEM_DEBUG */ @@ -2711,7 +2692,7 @@ Tcl_SetLongObj( Tcl_Panic("%s called with shared object", "Tcl_SetLongObj"); } - TclSetLongObj(objPtr, longValue); + TclSetWideObj(objPtr, longValue); } /* @@ -2742,11 +2723,13 @@ Tcl_GetLongFromObj( register long *longPtr) /* Place to store resulting long. */ { do { +#if (LONG_MAX == LLONG_MAX) if (objPtr->typePtr == &tclIntType) { *longPtr = objPtr->internalRep.wideValue; return TCL_OK; } - if (objPtr->typePtr == &tclWideIntType) { +#else + if (objPtr->typePtr == &tclIntType) { /* * We return any integer in the range -ULONG_MAX to ULONG_MAX * converted to a long, ignoring overflow. The rule preserves @@ -2764,6 +2747,7 @@ Tcl_GetLongFromObj( } goto tooLarge; } +#endif if (objPtr->typePtr == &tclDoubleType) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -2802,7 +2786,9 @@ Tcl_GetLongFromObj( return TCL_OK; } } +#if (LONG_MAX != LLONG_MAX) tooLarge: +#endif if (interp != NULL) { const char *s = "integer value too large to represent"; Tcl_Obj *msg = Tcl_NewStringObj(s, -1); @@ -2966,12 +2952,7 @@ Tcl_SetWideIntObj( Tcl_Panic("%s called with shared object", "Tcl_SetWideIntObj"); } - if ((wideValue >= (Tcl_WideInt) LONG_MIN) - && (wideValue <= (Tcl_WideInt) LONG_MAX)) { - TclSetLongObj(objPtr, wideValue); - } else { - TclSetWideIntObj(objPtr, wideValue); - } + TclSetWideObj(objPtr, wideValue); } /* @@ -3003,12 +2984,8 @@ Tcl_GetWideIntFromObj( /* Place to store resulting long. */ { do { - if (objPtr->typePtr == &tclWideIntType) { - *wideIntPtr = objPtr->internalRep.wideValue; - return TCL_OK; - } if (objPtr->typePtr == &tclIntType) { - *wideIntPtr = (Tcl_WideInt) objPtr->internalRep.wideValue; + *wideIntPtr = objPtr->internalRep.wideValue; return TCL_OK; } if (objPtr->typePtr == &tclDoubleType) { @@ -3303,10 +3280,6 @@ GetBignumFromObj( return TCL_OK; } if (objPtr->typePtr == &tclIntType) { - TclInitBignumFromLong(bignumValue, objPtr->internalRep.wideValue); - return TCL_OK; - } - if (objPtr->typePtr == &tclWideIntType) { TclInitBignumFromWideInt(bignumValue, objPtr->internalRep.wideValue); return TCL_OK; @@ -3435,9 +3408,9 @@ Tcl_SetBignumObj( goto tooLargeForLong; } if (bignumValue->sign) { - TclSetLongObj(objPtr, -(long)value); + TclSetWideObj(objPtr, -(long)value); } else { - TclSetLongObj(objPtr, (long)value); + TclSetWideObj(objPtr, (long)value); } mp_clear(bignumValue); return; @@ -3461,9 +3434,9 @@ Tcl_SetBignumObj( goto tooLargeForWide; } if (bignumValue->sign) { - TclSetWideIntObj(objPtr, -(Tcl_WideInt)value); + TclSetWideObj(objPtr, -(Tcl_WideInt)value); } else { - TclSetWideIntObj(objPtr, (Tcl_WideInt)value); + TclSetWideObj(objPtr, (Tcl_WideInt)value); } mp_clear(bignumValue); return; @@ -3550,7 +3523,7 @@ TclGetNumberFromObj( *clientDataPtr = &objPtr->internalRep.doubleValue; return TCL_OK; } - if (objPtr->typePtr == &tclIntType || objPtr->typePtr == &tclWideIntType) { + if (objPtr->typePtr == &tclIntType) { *typePtr = TCL_NUMBER_WIDE; *clientDataPtr = &objPtr->internalRep.wideValue; return TCL_OK; diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index c8bc7b5..9663c21 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -1272,7 +1272,7 @@ TclParseNumber( (Tcl_WideUInt)(((~(unsigned long)0) >> 1) + signum)) { #ifndef TCL_WIDE_INT_IS_LONG if (octalSignificandWide <= (MOST_BITS + signum)) { - objPtr->typePtr = &tclWideIntType; + objPtr->typePtr = &tclIntType; if (signum) { objPtr->internalRep.wideValue = - (Tcl_WideInt) octalSignificandWide; @@ -1319,7 +1319,7 @@ TclParseNumber( (Tcl_WideUInt)(((~(unsigned long)0) >> 1) + signum)) { #ifndef TCL_WIDE_INT_IS_LONG if (significandWide <= MOST_BITS+signum) { - objPtr->typePtr = &tclWideIntType; + objPtr->typePtr = &tclIntType; if (signum) { objPtr->internalRep.wideValue = - (Tcl_WideInt) significandWide; diff --git a/generic/tclTimer.c b/generic/tclTimer.c index 279e110..54854d0 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.c @@ -819,7 +819,6 @@ Tcl_AfterObjCmd( */ if (objv[1]->typePtr == &tclIntType - || objv[1]->typePtr == &tclWideIntType || objv[1]->typePtr == &tclBignumType || (Tcl_GetIndexFromObj(NULL, objv[1], afterSubCmds, "", 0, &index) != TCL_OK)) { diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 198424f..61a84ce 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3768,9 +3768,7 @@ SetEndOffsetFromAny( TCL_PARSE_INTEGER_ONLY) != TCL_OK) { return TCL_ERROR; } - if ((objPtr->typePtr != &tclIntType) - && (objPtr->typePtr != &tclWideIntType) - ) { + if (objPtr->typePtr != &tclIntType) { goto badIndexFormat; } offset = objPtr->internalRep.wideValue; diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 33eebd1..dc124f7 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -373,7 +373,7 @@ ConvertErrorToList( default: TclNewLiteralStringObj(objv[2], "UNKNOWN"); - TclNewLongObj(objv[3], code); + TclNewWideObj(objv[3], code); return Tcl_NewListObj(4, objv); } } -- cgit v0.12 From 8bb421f959a1a5cb8a552a423341b4a7896b042c Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 1 Nov 2017 21:05:32 +0000 Subject: Fix bug 3c32a3f8bd, segmentation fault in TclOO.c/ReleaseClassContents() for a class mixed into one of its instances. --- generic/tclOO.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index e9ef2ce..51731d3 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -1006,8 +1006,18 @@ ReleaseClassContents( } for(j=0 ; jmixins.num ; j++) { Class *mixin = instancePtr->mixins.list[j]; + Class *nextMixin = NULL; if (mixin == clsPtr) { - instancePtr->mixins.list[j] = NULL; + if (j < instancePtr->mixins.num - 1) { + nextMixin = instancePtr->mixins.list[j+1]; + } + if (j == 0) { + instancePtr->mixins.num = 0; + instancePtr->mixins.list = NULL; + } else { + instancePtr->mixins.list[j-1] = nextMixin; + } + instancePtr->mixins.num -= 1; } } if (instancePtr != NULL && !IsRoot(instancePtr)) { @@ -1181,7 +1191,8 @@ ObjectNamespaceDeleted( if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) { /* * Namespace deletion must have been triggered by a trace on command - * deletion , meaning that + * deletion , meaning that ObjectRenamedTrace() is eventually going + * to be called . */ deleteAlreadyInProgress = 1; } -- cgit v0.12 From d33ee7bc07e1c461c4292dfe866e2400f2536367 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 1 Nov 2017 22:21:50 +0000 Subject: Unit test for issue 3c32a3f8bd, Segmentation fault in TclOO.c/ReleaseClassContents() for a class mixed into one of its instances. --- tests/oo.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/oo.test b/tests/oo.test index 6413094..b6af1ee 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -1495,6 +1495,24 @@ test oo-11.5 {OO: cleanup} { return done } done +test oo-11.6 { + OO: cleanup ReleaseClassContents() where class is mixed into one of its + instances +} { + oo::class create obj1 + ::oo::define obj1 {self mixin [self]} + + ::oo::copy obj1 obj2 + ::oo::objdefine obj2 {mixin [self]} + + ::oo::copy obj2 obj3 + trace add command obj3 delete [list obj3 dying] + rename obj2 {} + + # No segmentation fault + return done +} done + test oo-12.1 {OO: filters} { oo::class create Aclass Aclass create Aobject -- cgit v0.12 From 274ab123a800239134ffb7e63421a13f55b38b89 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 3 Nov 2017 12:14:01 +0000 Subject: Better versions of TclGetIntFromObj and TclGetIntForIndexM macro's, which give advantage for platforms where longs are not ints (e.g. linux64) --- generic/tclInt.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 2f830cc..1908e32 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2422,8 +2422,8 @@ typedef struct List { #define TCL_EACH_COLLECT 1 /* Collect iteration result like [lmap] */ /* - * Macros providing a faster path to integers: Tcl_GetLongFromObj everywhere, - * Tcl_GetIntFromObj and TclGetIntForIndex on platforms where longs are ints. + * Macros providing a faster path to integers: Tcl_GetLongFromObj, + * Tcl_GetIntFromObj and TclGetIntForIndex. * * WARNING: these macros eval their args more than once. */ @@ -2444,9 +2444,17 @@ typedef struct List { : TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr))) #else #define TclGetIntFromObj(interp, objPtr, intPtr) \ - Tcl_GetIntFromObj((interp), (objPtr), (intPtr)) -#define TclGetIntForIndexM(interp, objPtr, ignore, idxPtr) \ - TclGetIntForIndex(interp, objPtr, ignore, idxPtr) + (((objPtr)->typePtr == &tclIntType \ + && (objPtr)->internalRep.longValue >= -(Tcl_WideInt)(UINT_MAX) \ + && (objPtr)->internalRep.longValue <= (Tcl_WideInt)(UINT_MAX)) \ + ? ((*(intPtr) = (objPtr)->internalRep.longValue), TCL_OK) \ + : Tcl_GetIntFromObj((interp), (objPtr), (intPtr))) +#define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \ + (((objPtr)->typePtr == &tclIntType \ + && (objPtr)->internalRep.longValue >= INT_MIN \ + && (objPtr)->internalRep.longValue <= INT_MAX) \ + ? ((*(idxPtr) = (objPtr)->internalRep.longValue), TCL_OK) \ + : TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr))) #endif /* -- cgit v0.12 From 5528e1c1a25f45988be72e2e16ff577f0dbb1abd Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 3 Nov 2017 12:57:15 +0000 Subject: Fix [6f2f83cc149e9918884faffefebc8dfa695f4ea0|6f2f83cc14]: tclWinload.c robustness. And fix a minor possible memory leak in TclSetupEnv() as well. Thanks to Christian Werner for both suggestions, backported from Androwish. --- generic/tclEnv.c | 1 + win/tclWinLoad.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/generic/tclEnv.c b/generic/tclEnv.c index 66ddb57..8cc4b74 100644 --- a/generic/tclEnv.c +++ b/generic/tclEnv.c @@ -130,6 +130,7 @@ TclSetupEnv( * '='; ignore the entry. */ + Tcl_DStringFree(&envString); continue; } p2++; diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c index 3ad6328..2946ea2 100644 --- a/win/tclWinLoad.c +++ b/win/tclWinLoad.c @@ -63,7 +63,7 @@ TclpDlopen( * file. */ int flags) { - HINSTANCE hInstance; + HINSTANCE hInstance = NULL; const TCHAR *nativeName; Tcl_LoadHandle handlePtr; DWORD firstError; @@ -75,7 +75,10 @@ TclpDlopen( */ nativeName = Tcl_FSGetNativePath(pathPtr); - hInstance = LoadLibraryEx(nativeName,NULL,LOAD_WITH_ALTERED_SEARCH_PATH); + if (nativeName != NULL) { + hInstance = LoadLibraryEx(nativeName, NULL, + LOAD_WITH_ALTERED_SEARCH_PATH); + } if (hInstance == NULL) { /* * Let the OS loader examine the binary search path for whatever @@ -89,7 +92,8 @@ TclpDlopen( * Remember the first error on load attempt to be used if the * second load attempt below also fails. */ - firstError = GetLastError(); + firstError = (nativeName == NULL) ? + ERROR_MOD_NOT_FOUND : GetLastError(); nativeName = Tcl_WinUtfToTChar(Tcl_GetString(pathPtr), -1, &ds); hInstance = LoadLibraryEx(nativeName, NULL, -- cgit v0.12 From 0480b5d79b11a26b00e355bc15655e9cfabdbeb9 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 3 Nov 2017 17:02:49 +0000 Subject: Revise a few stray packages not yet ready to tolerate a Tcl 9 bump. --- library/opt/optparse.tcl | 4 ++-- library/opt/pkgIndex.tcl | 4 ++-- library/tcltest/pkgIndex.tcl | 4 ++-- library/tcltest/tcltest.tcl | 2 +- unix/Makefile.in | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/library/opt/optparse.tcl b/library/opt/optparse.tcl index 869a2b6..e5ce052 100644 --- a/library/opt/optparse.tcl +++ b/library/opt/optparse.tcl @@ -8,10 +8,10 @@ # on it. If your code does rely on this package you # may directly incorporate this code into your application. -package require Tcl 8.2 +package require Tcl 8.2- # When this version number changes, update the pkgIndex.tcl file # and the install directory in the Makefiles. -package provide opt 0.4.6 +package provide opt 0.4.7 namespace eval ::tcl { diff --git a/library/opt/pkgIndex.tcl b/library/opt/pkgIndex.tcl index 107d4c6..d6ecdd6 100644 --- a/library/opt/pkgIndex.tcl +++ b/library/opt/pkgIndex.tcl @@ -8,5 +8,5 @@ # script is sourced, the variable $dir must contain the # full path name of this file's directory. -if {![package vsatisfies [package provide Tcl] 8.2]} {return} -package ifneeded opt 0.4.6 [list source [file join $dir optparse.tcl]] +if {![package vsatisfies [package provide Tcl] 8.2-]} {return} +package ifneeded opt 0.4.7 [list source [file join $dir optparse.tcl]] diff --git a/library/tcltest/pkgIndex.tcl b/library/tcltest/pkgIndex.tcl index 5ac8823..eadb1bd 100644 --- a/library/tcltest/pkgIndex.tcl +++ b/library/tcltest/pkgIndex.tcl @@ -8,5 +8,5 @@ # script is sourced, the variable $dir must contain the # full path name of this file's directory. -if {![package vsatisfies [package provide Tcl] 8.5]} {return} -package ifneeded tcltest 2.4.0 [list source [file join $dir tcltest.tcl]] +if {![package vsatisfies [package provide Tcl] 8.5-]} {return} +package ifneeded tcltest 2.4.1 [list source [file join $dir tcltest.tcl]] diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index 75975d2..f1b6082 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -22,7 +22,7 @@ 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. - variable Version 2.4.0 + variable Version 2.4.1 # Compatibility support for dumb variables defined in tcltest 1 # Do not use these. Call [package provide Tcl] and [info patchlevel] diff --git a/unix/Makefile.in b/unix/Makefile.in index c31d128..032b5ac 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -857,8 +857,8 @@ install-libraries: libraries done; @echo "Installing package msgcat 1.6.1 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.6.1.tm; - @echo "Installing package tcltest 2.4.0 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.4.0.tm; + @echo "Installing package tcltest 2.4.1 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.4.1.tm; @echo "Installing package platform 1.0.14 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform-1.0.14.tm; -- cgit v0.12 From 1a0c2e24ebd161899980a2a962a854e143d4ae1d Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 3 Nov 2017 17:11:13 +0000 Subject: Bump to 9.0a0 --- README | 2 +- generic/tcl.h | 10 +++++----- library/init.tcl | 2 +- macosx/Tcl-Common.xcconfig | 2 +- tools/tcl.hpj.in | 4 ++-- unix/configure | 26 +++++++++++++------------- unix/configure.ac | 10 +++++----- unix/tcl.spec | 2 +- win/README | 4 ++-- win/configure | 8 ++++---- win/configure.ac | 8 ++++---- 11 files changed, 39 insertions(+), 39 deletions(-) diff --git a/README b/README index 322666a..2a3b597 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ README: Tcl - This is the Tcl 8.7a2 source distribution. + This is the Tcl 9.0a0 source distribution. http://sourceforge.net/projects/tcl/files/Tcl/ You can get any source release of Tcl from the URL above. diff --git a/generic/tcl.h b/generic/tcl.h index 07d841d..007effb 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -52,13 +52,13 @@ extern "C" { * tools/tcl.hpj.in (not patchlevel, for windows installer) */ -#define TCL_MAJOR_VERSION 8 -#define TCL_MINOR_VERSION 7 +#define TCL_MAJOR_VERSION 9 +#define TCL_MINOR_VERSION 0 #define TCL_RELEASE_LEVEL TCL_ALPHA_RELEASE -#define TCL_RELEASE_SERIAL 2 +#define TCL_RELEASE_SERIAL 0 -#define TCL_VERSION "8.7" -#define TCL_PATCH_LEVEL "8.7a2" +#define TCL_VERSION "9.0" +#define TCL_PATCH_LEVEL "9.0a0" #if !defined(TCL_NO_DEPRECATED) || defined(RC_INVOKED) /* diff --git a/library/init.tcl b/library/init.tcl index 87d9f14..4ef78a5 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -16,7 +16,7 @@ if {[info commands package] == ""} { error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]" } -package require -exact Tcl 8.7a2 +package require -exact Tcl 9.0a0 # Compute the auto path to use in this interpreter. # The values on the path come from several locations: diff --git a/macosx/Tcl-Common.xcconfig b/macosx/Tcl-Common.xcconfig index 77402b7..13b5df5 100644 --- a/macosx/Tcl-Common.xcconfig +++ b/macosx/Tcl-Common.xcconfig @@ -34,4 +34,4 @@ TCL_CONFIGURE_ARGS = --enable-threads --enable-dtrace TCL_LIBRARY = $(LIBDIR)/tcl$(VERSION) TCL_PACKAGE_PATH = "$(LIBDIR)" TCL_DEFS = HAVE_TCL_CONFIG_H -VERSION = 8.7 +VERSION = 9.0 diff --git a/tools/tcl.hpj.in b/tools/tcl.hpj.in index 08d411d..a3d1a49 100644 --- a/tools/tcl.hpj.in +++ b/tools/tcl.hpj.in @@ -5,9 +5,9 @@ HCW=0 LCID=0x409 0x0 0x0 ;English (United States) REPORT=Yes TITLE=Tcl/Tk Reference Manual -CNT=tcl87.cnt +CNT=tcl90.cnt COPYRIGHT=Copyright © 2000 Ajuba Solutions -HLP=tcl87.hlp +HLP=tcl90.hlp [FILES] tcl.rtf diff --git a/unix/configure b/unix/configure index 129c283..6b9cedf 100755 --- a/unix/configure +++ b/unix/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for tcl 8.7. +# Generated by GNU Autoconf 2.69 for tcl 9.0. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='tcl' PACKAGE_TARNAME='tcl' -PACKAGE_VERSION='8.7' -PACKAGE_STRING='tcl 8.7' +PACKAGE_VERSION='9.0' +PACKAGE_STRING='tcl 9.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1319,7 +1319,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures tcl 8.7 to adapt to many kinds of systems. +\`configure' configures tcl 9.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1380,7 +1380,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of tcl 8.7:";; + short | recursive ) echo "Configuration of tcl 9.0:";; esac cat <<\_ACEOF @@ -1494,7 +1494,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -tcl configure 8.7 +tcl configure 9.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1970,7 +1970,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by tcl $as_me 8.7, which was +It was created by tcl $as_me 9.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2322,10 +2322,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -TCL_VERSION=8.7 -TCL_MAJOR_VERSION=8 -TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a2" +TCL_VERSION=9.0 +TCL_MAJOR_VERSION=9 +TCL_MINOR_VERSION=0 +TCL_PATCH_LEVEL="a0" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} @@ -10966,7 +10966,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by tcl $as_me 8.7, which was +This file was extended by tcl $as_me 9.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -11023,7 +11023,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -tcl config.status 8.7 +tcl config.status 9.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/unix/configure.ac b/unix/configure.ac index e14d85e..bd7a0e4 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -3,7 +3,7 @@ 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. -AC_INIT([tcl],[8.7]) +AC_INIT([tcl],[9.0]) AC_PREREQ(2.69) dnl This is only used when included from macosx/configure.ac @@ -22,10 +22,10 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ #endif /* _TCLCONFIG */]) ]) -TCL_VERSION=8.7 -TCL_MAJOR_VERSION=8 -TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a2" +TCL_VERSION=9.0 +TCL_MAJOR_VERSION=9 +TCL_MINOR_VERSION=0 +TCL_PATCH_LEVEL="a0" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/tcl.spec b/unix/tcl.spec index 265e4df..0858ee7 100644 --- a/unix/tcl.spec +++ b/unix/tcl.spec @@ -4,7 +4,7 @@ Name: tcl Summary: Tcl scripting language development environment -Version: 8.7a2 +Version: 9.0a0 Release: 2 License: BSD Group: Development/Languages diff --git a/win/README b/win/README index 972923c..c8fdad6 100644 --- a/win/README +++ b/win/README @@ -1,4 +1,4 @@ -Tcl 8.7 for Windows +Tcl 9.0 for Windows 1. Introduction --------------- @@ -16,7 +16,7 @@ The information in this file is maintained on the web at: In order to compile Tcl for Windows, you need the following: - Tcl 8.7 Source Distribution (plus any patches) + Tcl 9.0 Source Distribution (plus any patches) and diff --git a/win/configure b/win/configure index fdd3adb..9554f3a 100755 --- a/win/configure +++ b/win/configure @@ -2099,10 +2099,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh -TCL_VERSION=8.7 -TCL_MAJOR_VERSION=8 -TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a2" +TCL_VERSION=9.0 +TCL_MAJOR_VERSION=9 +TCL_MINOR_VERSION=0 +TCL_PATCH_LEVEL="a0" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 diff --git a/win/configure.ac b/win/configure.ac index d03695c..5804754 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -11,10 +11,10 @@ AC_PREREQ(2.69) # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh -TCL_VERSION=8.7 -TCL_MAJOR_VERSION=8 -TCL_MINOR_VERSION=7 -TCL_PATCH_LEVEL="a2" +TCL_VERSION=9.0 +TCL_MAJOR_VERSION=9 +TCL_MINOR_VERSION=0 +TCL_PATCH_LEVEL="a0" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 -- cgit v0.12 From e4356f7d64ab9d2c871b3015e10ecf3955d7f539 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 4 Nov 2017 00:25:43 +0000 Subject: Detected bug in [string first] with unicode. Pat Thoyts found it. --- tests/string.test | 16 +++++++++++++--- tests/stringObj.test | 5 ++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/string.test b/tests/string.test index 549944d..cb901b9 100644 --- a/tests/string.test +++ b/tests/string.test @@ -28,6 +28,11 @@ testConstraint testindexobj [expr {[info commands testindexobj] != {}}] # Used for constraining memory leak tests testConstraint memory [llength [info commands memory]] +proc representationpoke s { + set r [::tcl::unsupported::representation $s] + list [lindex $r 3] [string match {*, string representation "*"} $r] +} + test string-1.1 {error conditions} { list [catch {string gorp a b} msg] $msg } {1 {unknown or ambiguous subcommand "gorp": must be bytelength, cat, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, reverse, tolower, totitle, toupper, trim, trimleft, trimright, wordend, or wordstart}} @@ -224,6 +229,13 @@ test string-4.15 {string first, ability to two-byte encoded utf-8 chars} { set uchar \u057e ;# character with two-byte encoding in utf-8 string first % %#$uchar$uchar#$uchar$uchar#% 3 } 8 +test string-4.16 {string first, normal string vs pure unicode string} { + set s hello + regexp ll $s m + # Representation checks are canaries + list [representationpoke $s] [representationpoke $m] \ + [string first $m $s] +} {{string 1} {string 0} 2} test string-5.1 {string index} { list [catch {string index} msg] $msg @@ -2042,9 +2054,7 @@ test string-29.15 {string cat, efficiency} -setup { } -body { tcl::unsupported::representation [string cat $e $f $e $f [list x]] } -match glob -result {*no string representation} - - - + # cleanup rename MemStress {} catch {rename foo {}} diff --git a/tests/stringObj.test b/tests/stringObj.test index 49f268e..a78b5f8 100644 --- a/tests/stringObj.test +++ b/tests/stringObj.test @@ -480,7 +480,6 @@ test stringObj-15.8 {Tcl_Append*ToObj: self appends} testobj { teststringobj set 1 foo teststringobj appendself2 1 3 } foo - if {[testConstraint testobj]} { testobj freeallvars @@ -489,3 +488,7 @@ if {[testConstraint testobj]} { # cleanup ::tcltest::cleanupTests return + +# Local Variables: +# mode: tcl +# End: -- cgit v0.12 From b55d5cc57eba5295979ff84c7256c577f2a24cc8 Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 4 Nov 2017 00:34:48 +0000 Subject: Fix for the weird [string first] behaviour. --- generic/tclStringObj.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 7c1d42b..3a35bcf 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3242,40 +3242,44 @@ TclStringFind( return -1; } + /* + * Check if we have two strings of single-byte characters. If we have, we + * can use strstr() to do the search. Note that we can sometimes have + * multibyte characters when the string could be minimally represented + * using single byte characters; we can't assume that a mismatch here + * means no match. + */ + lh = Tcl_GetCharLength(haystack); - if (haystack->bytes && (lh == haystack->length)) { - /* haystack is all single-byte chars */ + if (haystack->bytes && (lh == haystack->length) && needle->bytes + && (ln == needle->length)) { + /* + * Both haystack and needle are all single-byte chars. + */ - if (needle->bytes && (ln == needle->length)) { - /* needle is also all single-byte chars */ - char *found = strstr(haystack->bytes + start, needle->bytes); + char *found = strstr(haystack->bytes + start, needle->bytes); - if (found) { - return (found - haystack->bytes); - } else { - return -1; - } + if (found) { + return (found - haystack->bytes); } else { - /* - * Cannot find substring with a multi-byte char inside - * a string with no multi-byte chars. - */ return -1; } } else { + /* + * Do the search on the unicode representation for simplicity. + */ + Tcl_UniChar *try, *end, *uh; Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); uh = Tcl_GetUnicodeFromObj(haystack, &lh); end = uh + lh; - try = uh + start; - while (try + ln <= end) { - if ((*try == *un) - && (0 == memcmp(try+1, un+1, (ln-1)*sizeof(Tcl_UniChar)))) { + for (try = uh + start; try + ln <= end; try++) { + if ((*try == *un) && (0 == + memcmp(try + 1, un + 1, (ln-1) * sizeof(Tcl_UniChar)))) { return (try - uh); } - try++; } return -1; } -- cgit v0.12 From ded2a799663066ed98c0a0b07d5fc5a661f988d8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 5 Nov 2017 14:14:23 +0000 Subject: update .project file with branch name. Make clear that optparse doesnt work with 8.4 any more --- .project | 2 +- library/opt/optparse.tcl | 2 +- library/opt/pkgIndex.tcl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.project b/.project index a9d6ecf..eddd834 100644 --- a/.project +++ b/.project @@ -1,6 +1,6 @@ - tcl8.7 + tcl8 diff --git a/library/opt/optparse.tcl b/library/opt/optparse.tcl index e5ce052..c8946fd 100644 --- a/library/opt/optparse.tcl +++ b/library/opt/optparse.tcl @@ -8,7 +8,7 @@ # on it. If your code does rely on this package you # may directly incorporate this code into your application. -package require Tcl 8.2- +package require Tcl 8.5- # When this version number changes, update the pkgIndex.tcl file # and the install directory in the Makefiles. package provide opt 0.4.7 diff --git a/library/opt/pkgIndex.tcl b/library/opt/pkgIndex.tcl index d6ecdd6..daf9aa9 100644 --- a/library/opt/pkgIndex.tcl +++ b/library/opt/pkgIndex.tcl @@ -8,5 +8,5 @@ # script is sourced, the variable $dir must contain the # full path name of this file's directory. -if {![package vsatisfies [package provide Tcl] 8.2-]} {return} +if {![package vsatisfies [package provide Tcl] 8.5-]} {return} package ifneeded opt 0.4.7 [list source [file join $dir optparse.tcl]] -- cgit v0.12 From 6fff25ecbcc670141c504a6dd0555d01204f761e Mon Sep 17 00:00:00 2001 From: "f.bonnet" Date: Sun, 5 Nov 2017 16:41:11 +0000 Subject: Fixed stupid Tcl_DecrRefCount bug in TclCleanupChildren with normally terminated processes. --- generic/tclPipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclPipe.c b/generic/tclPipe.c index bc760b6..13f4539 100644 --- a/generic/tclPipe.c +++ b/generic/tclPipe.c @@ -313,9 +313,9 @@ TclCleanupChildren( Tcl_SetObjErrorCode(interp, error); Tcl_SetObjResult(interp, msg); } + Tcl_DecrRefCount(error); + Tcl_DecrRefCount(msg); } - Tcl_DecrRefCount(error); - Tcl_DecrRefCount(msg); } /* -- cgit v0.12 From 22719c659625a4a57aa00294b5b02c96c51762d4 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 6 Nov 2017 00:10:21 +0000 Subject: Test case for Bug 5d65e65036. --- tests/pkg.test | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/pkg.test b/tests/pkg.test index b935a3f..10b4732 100644 --- a/tests/pkg.test +++ b/tests/pkg.test @@ -518,6 +518,16 @@ test pkg-2.52 {Tcl_PkgRequire procedure, picking best stable version} { set x } {1.3} +test pkg-2.53 {Tcl_PkgRequire procedure, picking best stable version} { + package forget t + foreach i {1.2b1 1.1} { + package ifneeded t $i "set x $i; package provide t $i" + } + set x xxx + package require t + set x +} {1.1} + test pkg-3.1 {Tcl_PackageCmd procedure} { -- cgit v0.12 From 9b30058284ab5a87d78cb96dcd63b95a7ada2393 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Mon, 6 Nov 2017 01:33:57 +0000 Subject: Rewrite documentation in comments for brevity and clarity. --- generic/tclListObj.c | 593 +++++++++++++++++++++++++-------------------------- generic/tclObj.c | 31 +-- generic/tclUtil.c | 37 ++-- 3 files changed, 325 insertions(+), 336 deletions(-) diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 11374cc..f94433b 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -55,20 +55,22 @@ const Tcl_ObjType tclListType = { * * NewListIntRep -- * - * Creates a list internal rep with space for objc elements. objc - * must be > 0. If objv!=NULL, initializes with the first objc values - * in that array. If objv==NULL, initalize list internal rep to have - * 0 elements, with space to add objc more. Flag value "p" indicates + * Creates a 'List' structure with space for 'objc' elements. 'objc' must + * be > 0. If 'objv' is not NULL, The list is initialized with first + * 'objc' values in that array. Otherwise the list is initialized to have + * 0 elements, with space to add 'objc' more. Flag value 'p' indicates * how to behave on failure. * - * Results: - * A new List struct with refCount 0 is returned. If some failure - * prevents this then if p=0, NULL is returned and otherwise the - * routine panics. + * Value * - * Side effects: - * The ref counts of the elements in objv are incremented since the - * resulting list now refers to them. + * A new 'List' structure with refCount 0. If some failure + * prevents this NULL is returned if 'p' is 0 , and 'Tcl_Panic' + * is called if it is not. + * + * Effect + * + * The refCount of each value in 'objv' is incremented as it is added + * to the list. * *---------------------------------------------------------------------- */ @@ -132,22 +134,10 @@ NewListIntRep( /* *---------------------------------------------------------------------- * - * AttemptNewList -- - * - * Creates a list internal rep with space for objc elements. objc - * must be > 0. If objv!=NULL, initializes with the first objc values - * in that array. If objv==NULL, initalize list internal rep to have - * 0 elements, with space to add objc more. - * - * Results: - * A new List struct with refCount 0 is returned. If some failure - * prevents this then NULL is returned, and an error message is left - * in the interp result, unless interp is NULL. - * - * Side effects: - * The ref counts of the elements in objv are incremented since the - * resulting list now refers to them. + * AttemptNewList -- * + * Like NewListIntRep, but additionally sets an error message on failure. + * *---------------------------------------------------------------------- */ @@ -179,23 +169,20 @@ AttemptNewList( * * Tcl_NewListObj -- * - * This function is normally called when not debugging: i.e., when - * TCL_MEM_DEBUG is not defined. It creates a new list object from an - * (objc,objv) array: that is, each of the objc elements of the array - * referenced by objv is inserted as an element into a new Tcl object. + * Creates a new list object and adds values to it. When TCL_MEM_DEBUG is + * defined, 'Tcl_DbNewListObj' is called instead. * - * When TCL_MEM_DEBUG is defined, this function just returns the result - * of calling the debugging version Tcl_DbNewListObj. + * Value * - * Results: - * A new list object is returned that is initialized from the object - * pointers in objv. If objc is less than or equal to zero, an empty - * object is returned. The new object's string representation is left - * NULL. The resulting new list object has ref count 0. + * A new list 'Tcl_Obj' to which is appended values from 'objv', or if + * 'objc' is less than or equal to zero, a list 'Tcl_Obj' having no + * elements. The string representation of the new 'Tcl_Obj' is set to + * NULL. The refCount of the list is 0. * - * Side effects: - * The ref counts of the elements in objv are incremented since the - * resulting list now refers to them. + * Effect + * + * The refCount of each elements in 'objv' is incremented as it is added + * to the list. * *---------------------------------------------------------------------- */ @@ -246,28 +233,14 @@ Tcl_NewListObj( /* *---------------------------------------------------------------------- * - * Tcl_DbNewListObj -- - * - * This function is normally called when debugging: i.e., when - * TCL_MEM_DEBUG is defined. It creates new list objects. It is the same - * as the Tcl_NewListObj function above except that it calls - * Tcl_DbCkalloc directly with the file name and line number from its - * caller. This simplifies debugging since then the [memory active] - * command will report the correct file name and line number when - * reporting objects that haven't been freed. - * - * When TCL_MEM_DEBUG is not defined, this function just returns the - * result of calling Tcl_NewListObj. - * - * Results: - * A new list object is returned that is initialized from the object - * pointers in objv. If objc is less than or equal to zero, an empty - * object is returned. The new object's string representation is left - * NULL. The new list object has ref count 0. - * - * Side effects: - * The ref counts of the elements in objv are incremented since the - * resulting list now refers to them. + * Tcl_DbNewListObj -- + * + * Like 'Tcl_NewListObj', but it calls Tcl_DbCkalloc directly with the + * file name and line number from its caller. This simplifies debugging + * since the [memory active] command will report the correct file + * name and line number when reporting objects that haven't been freed. + * + * When TCL_MEM_DEBUG is not defined, 'Tcl_NewListObj' is called instead. * *---------------------------------------------------------------------- */ @@ -328,19 +301,8 @@ Tcl_DbNewListObj( * * Tcl_SetListObj -- * - * Modify an object to be a list containing each of the objc elements of - * the object array referenced by objv. - * - * Results: - * None. - * - * Side effects: - * The object is made a list object and is initialized from the object - * pointers in objv. If objc is less than or equal to zero, an empty - * object is returned. The new object's string representation is left - * NULL. The ref counts of the elements in objv are incremented since the - * list now refers to them. The object's old string and internal - * representations are freed and its type is set NULL. + * Like 'Tcl_NewListObj', but operates on an existing 'Tcl_Obj'instead of + * creating a new one. * *---------------------------------------------------------------------- */ @@ -384,18 +346,20 @@ Tcl_SetListObj( * * TclListObjCopy -- * - * Makes a "pure list" copy of a list value. This provides for the C - * level a counterpart of the [lrange $list 0 end] command, while using - * internals details to be as efficient as possible. + * Creates a new 'Tcl_Obj' which is a pure copy of a list value. This + * provides for the C level a counterpart of the [lrange $list 0 end] + * command, while using internals details to be as efficient as possible. + * + * Value * - * Results: - * Normally returns a pointer to a new Tcl_Obj, that contains the same - * list value as *listPtr does. The returned Tcl_Obj has a refCount of - * zero. If *listPtr does not hold a list, NULL is returned, and if - * interp is non-NULL, an error message is recorded there. + * The address of the new 'Tcl_Obj' which shares its internal + * representation with 'listPtr', and whose refCount is 0. If 'listPtr' + * is not actually a list, the value is NULL, and an error message is left + * in 'interp' if it is not NULL. * - * Side effects: - * None. + * Effect + * + * 'listPtr' is converted to a list if it isn't one already. * *---------------------------------------------------------------------- */ @@ -425,27 +389,30 @@ TclListObjCopy( * * Tcl_ListObjGetElements -- * - * This function returns an (objc,objv) array of the elements in a list - * object. + * Retreive the elements in a list 'Tcl_Obj'. + * + * Value + * + * TCL_OK + * + * A count of list elements is stored, 'objcPtr', And a pointer to the + * array of elements in the list is stored in 'objvPtr'. * - * Results: - * The return value is normally TCL_OK; in this case *objcPtr is set to - * the count of list elements and *objvPtr is set to a pointer to an - * array of (*objcPtr) pointers to each list element. If listPtr does not - * refer to a list object and the object can not be converted to one, - * TCL_ERROR is returned and an error message will be left in the - * interpreter's result if interp is not NULL. + * The elements accessible via 'objvPtr' should be treated as readonly + * and the refCount for each object is _not_ incremented; the caller + * must do that if it holds on to a reference. Furthermore, the + * pointer and length returned by this function may change as soon as + * any function is called on the list object. Be careful about + * retaining the pointer in a local data structure. * - * The objects referenced by the returned array should be treated as - * readonly and their ref counts are _not_ incremented; the caller must - * do that if it holds on to a reference. Furthermore, the pointer and - * length returned by this function may change as soon as any function is - * called on the list object; be careful about retaining the pointer in a - * local data structure. + * TCL_ERROR * - * Side effects: - * The possible conversion of the object referenced by listPtr - * to a list object. + * 'listPtr' is not a valid list. An error message is left in the + * interpreter's result if 'interp' is not NULL. + * + * Effect + * + * 'listPtr' is converted to a list object if it isn't one already. * *---------------------------------------------------------------------- */ @@ -486,20 +453,27 @@ Tcl_ListObjGetElements( * * Tcl_ListObjAppendList -- * - * This function appends the elements in the list value referenced by - * elemListPtr to the list value referenced by listPtr. + * Appends the elements of elemListPtr to those of listPtr. + * + * Value + * + * TCL_OK + * + * Success. * - * Results: - * The return value is normally TCL_OK. If listPtr or elemListPtr do not - * refer to list values, TCL_ERROR is returned and an error message is - * left in the interpreter's result if interp is not NULL. + * TCL_ERROR * - * Side effects: - * The reference counts of the elements in elemListPtr are incremented - * since the list now refers to them. listPtr and elemListPtr are - * converted, if necessary, to list objects. Also, appending the new - * elements may cause listObj's array of element pointers to grow. - * listPtr's old string representation, if any, is invalidated. + * 'listPtr' or 'elemListPtr' are not valid lists. An error + * message is left in the interpreter's result if 'interp' is not NULL. + * + * Effect + * + * The reference count of each element of 'elemListPtr' as it is added to + * 'listPtr'. 'listPtr' and 'elemListPtr' are converted to 'tclListType' + * if they are not already. Appending the new elements may cause the + * array of element pointers in 'listObj' to grow. If any objects are + * appended to 'listPtr'. Any preexisting string representation of + * 'listPtr' is invalidated. * *---------------------------------------------------------------------- */ @@ -538,24 +512,27 @@ Tcl_ListObjAppendList( * * Tcl_ListObjAppendElement -- * - * This function is a special purpose version of Tcl_ListObjAppendList: - * it appends a single object referenced by objPtr to the list object - * referenced by listPtr. If listPtr is not already a list object, an - * attempt will be made to convert it to one. - * - * Results: - * The return value is normally TCL_OK; in this case objPtr is added to - * the end of listPtr's list. If listPtr does not refer to a list object - * and the object can not be converted to one, TCL_ERROR is returned and - * an error message will be left in the interpreter's result if interp is - * not NULL. - * - * Side effects: - * The ref count of objPtr is incremented since the list now refers to - * it. listPtr will be converted, if necessary, to a list object. Also, - * appending the new element may cause listObj's array of element - * pointers to grow. listPtr's old string representation, if any, is - * invalidated. + * Like 'Tcl_ListObjAppendList', but Appends a single value to a list. + * + * Value + * + * TCL_OK + * + * 'objPtr' is appended to the elements of 'listPtr'. + * + * TCL_ERROR + * + * listPtr does not refer to a list object and the object can not be + * converted to one. An error message will be left in the + * interpreter's result if interp is not NULL. + * + * Effect + * + * If 'listPtr' is not already of type 'tclListType', it is converted. + * The 'refCount' of 'objPtr' is incremented as it is added to 'listPtr'. + * Appending the new element may cause the the array of element pointers + * in 'listObj' to grow. Any preexisting string representation of + * 'listPtr' is invalidated. * *---------------------------------------------------------------------- */ @@ -706,23 +683,27 @@ Tcl_ListObjAppendElement( * * Tcl_ListObjIndex -- * - * This function returns a pointer to the index'th object from the list - * referenced by listPtr. The first element has index 0. If index is - * negative or greater than or equal to the number of elements in the - * list, a NULL is returned. If listPtr is not a list object, an attempt - * will be made to convert it to a list. + * Retrieve a pointer to the element of 'listPtr' at 'index'. The index + * of the first element is 0. + * + * Value + * + * TCL_OK * - * Results: - * The return value is normally TCL_OK; in this case objPtrPtr is set to - * the Tcl_Obj pointer for the index'th list element or NULL if index is - * out of range. This object should be treated as readonly and its ref - * count is _not_ incremented; the caller must do that if it holds on to - * the reference. If listPtr does not refer to a list and can't be - * converted to one, TCL_ERROR is returned and an error message is left - * in the interpreter's result if interp is not NULL. + * A pointer to the element at 'index' is stored in 'objPtrPtr'. If + * 'index' is out of range, NULL is stored in 'objPtrPtr'. This + * object should be treated as readonly and its 'refCount' is _not_ + * incremented. The caller must do that if it holds on to the + * reference. + * + * TCL_ERROR * - * Side effects: - * listPtr will be converted, if necessary, to a list object. + * 'listPtr' is not a valid list. An an error message is left in the + * interpreter's result if 'interp' is not NULL. + * + * Effect + * + * If 'listPtr' is not already of type 'tclListType', it is converted. * *---------------------------------------------------------------------- */ @@ -764,19 +745,20 @@ Tcl_ListObjIndex( * * Tcl_ListObjLength -- * - * This function returns the number of elements in a list object. If the - * object is not already a list object, an attempt will be made to - * convert it to one. + * Retrieve the number of elements in a list. + * + * Value + * + * TCL_OK + * + * A count of list elements is stored at the address provided by + * 'intPtr'. If 'listPtr' is not already of type 'tclListPtr', it is + * converted. * - * Results: - * The return value is normally TCL_OK; in this case *intPtr will be set - * to the integer count of list elements. If listPtr does not refer to a - * list object and the object can not be converted to one, TCL_ERROR is - * returned and an error message will be left in the interpreter's result - * if interp is not NULL. + * TCL_ERROR * - * Side effects: - * The possible conversion of the argument object to a list object. + * 'listPtr' is not a valid list. An error message will be left in + * the interpreter's result if 'interp' is not NULL. * *---------------------------------------------------------------------- */ @@ -812,35 +794,36 @@ Tcl_ListObjLength( * * Tcl_ListObjReplace -- * - * This function replaces zero or more elements of the list referenced by - * listPtr with the objects from an (objc,objv) array. The objc elements - * of the array referenced by objv replace the count elements in listPtr - * starting at first. - * - * If the argument first is zero or negative, it refers to the first - * element. If first is greater than or equal to the number of elements - * in the list, then no elements are deleted; the new elements are - * appended to the list. Count gives the number of elements to replace. - * If count is zero or negative then no elements are deleted; the new - * elements are simply inserted before first. - * - * The argument objv refers to an array of objc pointers to the new - * elements to be added to listPtr in place of those that were deleted. - * If objv is NULL, no new elements are added. If listPtr is not a list - * object, an attempt will be made to convert it to one. - * - * Results: - * The return value is normally TCL_OK. If listPtr does not refer to a - * list object and can not be converted to one, TCL_ERROR is returned and - * an error message will be left in the interpreter's result if interp is - * not NULL. - * - * Side effects: - * The ref counts of the objc elements in objv are incremented since the - * resulting list now refers to them. Similarly, the ref counts for - * replaced objects are decremented. listPtr is converted, if necessary, - * to a list object. listPtr's old string representation, if any, is - * freed. + * Replace values in a list. + * + * If 'first' is zero or negative, it refers to the first element. If + * 'first' outside the range of elements in the list, no elements are + * deleted. + * + * If 'count' is zero or negative no elements are deleted, and any new + * elements are inserted at the beginning of the list. + * + * Value + * + * TCL_OK + * + * The first 'objc' values of 'objv' replaced 'count' elements in 'listPtr' + * starting at 'first'. If 'objc' 0, no new elements are added. + * + * TCL_ERROR + * + * 'listPtr' is not a valid list. An error message is left in the + * interpreter's result if 'interp' is not NULL. + * + * Effect + * + * If 'listPtr' is not of type 'tclListType', it is converted if possible. + * + * The 'refCount' of each element appended to the list is incremented. + * Similarly, the 'refCount' for each replaced element is decremented. + * + * If 'listPtr' is modified, any previous string representation is + * invalidated. * *---------------------------------------------------------------------- */ @@ -1098,22 +1081,19 @@ Tcl_ListObjReplace( * * TclLindexList -- * - * This procedure handles the 'lindex' command when objc==3. + * Implements the 'lindex' command when objc==3. * - * Results: - * Returns a pointer to the object extracted, or NULL if an error - * occurred. The returned object already includes one reference count for - * the pointer returned. + * Implemented entirely as a wrapper around 'TclLindexFlat'. Reconfigures + * the argument format into required form while taking care to manage + * shimmering so as to tend to keep the most useful intreps + * and/or avoid the most expensive conversions. * - * Side effects: - * None. + * Value * - * Notes: - * This procedure is implemented entirely as a wrapper around - * TclLindexFlat. All it does is reconfigure the argument format into the - * form required by TclLindexFlat, while taking care to manage shimmering - * in such a way that we tend to keep the most useful intreps and/or - * avoid the most expensive conversions. + * A pointer to the specified element, with its 'refCount' incremented, or + * NULL if an error occurred. + * + * Notes * *---------------------------------------------------------------------- */ @@ -1185,25 +1165,20 @@ TclLindexList( /* *---------------------------------------------------------------------- * - * TclLindexFlat -- + * TclLindexFlat -- + * + * The core of the 'lindex' command, with all index + * arguments presented as a flat list. * - * This procedure is the core of the 'lindex' command, with all index - * arguments presented as a flat list. + * Value * - * Results: - * Returns a pointer to the object extracted, or NULL if an error - * occurred. The returned object already includes one reference count for - * the pointer returned. + * A pointer to the object extracted, with its 'refCount' incremented, or + * NULL if an error occurred. Thus, the calling code will usually do + * something like: * - * Side effects: - * None. + * Tcl_SetObjResult(interp, result); + * Tcl_DecrRefCount(result); * - * Notes: - * The reference count of the returned object includes one reference - * corresponding to the pointer returned. Thus, the calling code will - * usually do something like: - * Tcl_SetObjResult(interp, result); - * Tcl_DecrRefCount(result); * *---------------------------------------------------------------------- */ @@ -1279,23 +1254,16 @@ TclLindexFlat( * * TclLsetList -- * - * Core of the 'lset' command when objc == 4. Objv[2] may be either a + * The core of [lset] when objc == 4. Objv[2] may be either a * scalar index or a list of indices. * - * Results: - * Returns the new value of the list variable, or NULL if there was an - * error. The returned object includes one reference count for the - * pointer returned. + * Implemented entirely as a wrapper around 'TclLindexFlat', as described + * for 'TclLindexList'. * - * Side effects: - * None. + * Value * - * Notes: - * This procedure is implemented entirely as a wrapper around - * TclLsetFlat. All it does is reconfigure the argument format into the - * form required by TclLsetFlat, while taking care to manage shimmering - * in such a way that we tend to keep the most useful intreps and/or - * avoid the most expensive conversions. + * The new list, with the 'refCount' of 'valuPtr' incremented, or NULL if + * there was an error. * *---------------------------------------------------------------------- */ @@ -1357,36 +1325,39 @@ TclLsetList( * * Core engine of the 'lset' command. * - * Results: - * Returns the new value of the list variable, or NULL if an error - * occurred. The returned object includes one reference count for the - * pointer returned. - * - * Side effects: - * On entry, the reference count of the variable value does not reflect - * any references held on the stack. The first action of this function is - * to determine whether the object is shared, and to duplicate it if it - * is. The reference count of the duplicate is incremented. At this - * point, the reference count will be 1 for either case, so that the - * object will appear to be unshared. - * - * If an error occurs, and the object has been duplicated, the reference - * count on the duplicate is decremented so that it is now 0: this - * dismisses any memory that was allocated by this function. - * - * If no error occurs, the reference count of the original object is - * incremented if the object has not been duplicated, and nothing is done - * to a reference count of the duplicate. Now the reference count of an - * unduplicated object is 2 (the returned pointer, plus the one stored in - * the variable). The reference count of a duplicate object is 1, - * reflecting that the returned pointer is the only active reference. The - * caller is expected to store the returned value back in the variable - * and decrement its reference count. (INST_STORE_* does exactly this.) - * - * Surgery is performed on the unshared list value to produce the result. - * TclLsetFlat maintains a linked list of Tcl_Obj's whose string + * Value + * + * The resulting list + * + * The 'refCount' of 'valuePtr' is incremented. If 'listPtr' was not + * duplicated, its 'refCount' is incremented. The reference count of + * an unduplicated object is therefore 2 (one for the returned pointer + * and one for the variable that holds it). The reference count of a + * duplicate object is 1, reflecting that result is the only active + * reference. The caller is expected to store the result in the + * variable and decrement its reference count. (INST_STORE_* does + * exactly this.) + * + * NULL + * + * An error occurred. If 'listPtr' was duplicated, the reference + * count on the duplicate is decremented so that it is 0, causing any + * memory allocated by this function to be freed. + * + * + * Effect + * + * On entry, the reference count of 'listPtr' does not reflect any + * references held on the stack. The first action of this function is to + * determine whether 'listPtr' is shared and to create a duplicate + * unshared copy if it is. The reference count of the duplicate is + * incremented. At this point, the reference count is 1 in either case so + * that the object is considered unshared. + * + * The unshared list is altered directly to produce the result. + * 'TclLsetFlat' maintains a linked list of 'Tcl_Obj' values whose string * representations must be spoilt by threading via 'ptr2' of the - * two-pointer internal representation. On entry to TclLsetFlat, the + * two-pointer internal representation. On entry to 'TclLsetFlat', the * values of 'ptr2' are immaterial; on exit, the 'ptr2' field of any * Tcl_Obj that has been modified is set to NULL. * @@ -1601,26 +1572,38 @@ TclLsetFlat( * * TclListObjSetElement -- * - * Set a single element of a list to a specified value + * Set a single element of a list to a specified value. * - * Results: - * The return value is normally TCL_OK. If listPtr does not refer to a - * list object and cannot be converted to one, TCL_ERROR is returned and - * an error message will be left in the interpreter result if interp is - * not NULL. Similarly, if index designates an element outside the range - * [0..listLength-1], where 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. + * It is the caller's responsibility to invalidate the string + * representation of the 'listPtr'. * - * 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. + * Value + * + * TCL_OK + * + * Success. + * + * TCL_ERROR + * + * 'listPtr' does not refer to a list object and cannot be converted + * to one. An error message will be left in the interpreter result if + * interp is not NULL. + * + * TCL_ERROR + * + * An index designates an element outside the range [0..listLength-1], + * where 'listLength' is the count of elements in the list object + * designated by 'listPtr'. An error message is left in the + * interpreter result. + * + * Effect + * + * If 'listPtr' designates a shared object, 'Tcl_Panic' is called. If + * 'listPtr' is not already of type 'tclListType', it is converted and the + * internal representation is unshared. The 'refCount' of the element at + * 'index' is decremented and replaced in the list with the 'valuePtr', + * whose 'refCount' in turn is incremented. * - * It is the caller's responsibility to invalidate the string - * representation of the object. * *---------------------------------------------------------------------- */ @@ -1738,16 +1721,14 @@ TclListObjSetElement( * * FreeListInternalRep -- * - * Deallocate the storage associated with a list object's internal - * representation. + * Deallocate the storage associated with the internal representation of a + * a list object. * - * Results: - * None. + * Effect * - * Side effects: - * Frees listPtr's List* internal representation and sets listPtr's - * internalRep.twoPtrValue.ptr1 to NULL. Decrements the ref counts of all - * element objects, which may free them. + * The storage for the internal 'List' pointer of 'listPtr' is freed, the + * 'internalRep.twoPtrValue.ptr1' of 'listPtr' is set to NULL, and the 'refCount' + * of each element of the list is decremented. * *---------------------------------------------------------------------- */ @@ -1776,14 +1757,12 @@ FreeListInternalRep( * * DupListInternalRep -- * - * Initialize the internal representation of a list Tcl_Obj to share the + * Initialize the internal representation of a list 'Tcl_Obj' to share the * internal representation of an existing list object. * - * Results: - * None. + * Effect * - * Side effects: - * The reference count of the List internal rep is incremented. + * The 'refCount' of the List internal rep is incremented. * *---------------------------------------------------------------------- */ @@ -1803,16 +1782,20 @@ DupListInternalRep( * * SetListFromAny -- * - * Attempt to generate a list internal form for the Tcl object "objPtr". + * Convert any object to a list. + * + * Value * - * Results: - * The return value is TCL_OK or TCL_ERROR. If an error occurs during - * conversion, an error message is left in the interpreter's result - * unless "interp" is NULL. + * TCL_OK + * + * Success. The internal representation of 'objPtr' is set, and the type + * of 'objPtr' is 'tclListType'. + * + * TCL_ERROR + * + * An error occured during conversion. An error message is left in the + * interpreter's result if 'interp' is not NULL. * - * Side effects: - * If no error occurs, a list is stored as "objPtr"s internal - * representation. * *---------------------------------------------------------------------- */ @@ -1937,18 +1920,16 @@ SetListFromAny( * * UpdateStringOfList -- * - * Update the string representation for a list object. Note: This - * function does not invalidate an existing old string rep so storage - * will be lost if this has not already been done. + * Update the string representation for a list object. + * + * Any previously-exising string representation is not invalidated, so + * storage is lost if this has not been taken care of. * - * Results: - * None. + * Effect * - * Side effects: - * The object's string is set to a valid string that results from the - * list-to-string conversion. This string will be empty if the list has - * no elements. The list internal representation should not be NULL and - * we assume it is not NULL. + * The string representation of 'listPtr' is set to the resulting string. + * This string will be empty if the list has no elements. It is assumed + * that the list internal representation is not NULL. * *---------------------------------------------------------------------- */ diff --git a/generic/tclObj.c b/generic/tclObj.c index 1a00011..fdbc89a 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -2468,23 +2468,26 @@ Tcl_SetIntObj( * * Tcl_GetIntFromObj -- * - * Attempt to return an int from the Tcl object "objPtr". If the object - * is not already an int, an attempt will be made to convert it to one. + * Retrieve the integer value of 'objPtr'. * - * Integer and long integer objects share the same "integer" type - * implementation. We store all integers as longs and Tcl_GetIntFromObj - * checks whether the current value of the long can be represented by an - * int. + * Value * - * Results: - * The return value is a standard Tcl object result. If an error occurs - * during conversion or if the long integer held by the object can not be - * represented by an int, an error message is left in the interpreter's - * result unless "interp" is NULL. + * TCL_OK * - * Side effects: - * If the object is not already an int, the conversion will free any old - * internal representation. + * Success. + * + * TCL_ERROR + * + * An error occurred during conversion or the integral value can not + * be represented as an integer (it might be too large). An error + * message is left in the interpreter's result if 'interp' is not + * NULL. + * + * Effect + * + * 'objPtr' is converted to an integer if necessary if it is not one + * already. The conversion frees any previously-existing internal + * representation. * *---------------------------------------------------------------------- */ diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 411eabb..bfa4b2d 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3479,22 +3479,27 @@ TclFormatInt( * * TclGetIntForIndex -- * - * This function 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. - * + * Provides an integer corresponding to the list index held in a Tcl + * object. The string value 'objPtr' is expected have the format + * integer([+-]integer)? or end([+-]integer)?. + * + * Value + * TCL_OK + * + * The index is stored at the address given by by 'indexPtr'. If + * 'objPtr' has the value "end", the value stored is 'endValue'. + * + * TCL_ERROR + * + * The value of 'objPtr' does not have one of the expected formats. If + * 'interp' is non-NULL, an error message is left in the interpreter's + * result object. + * + * Effect + * + * The object referenced by 'objPtr' is converted, as needed, to an + * integer, wide integer, or end-based-index object. + * *---------------------------------------------------------------------- */ -- cgit v0.12 From c06751fdf8ec42ead80c501c199817370fbef853 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 6 Nov 2017 14:46:49 +0000 Subject: Fix version number of Windows Help file (not sure if it's actually used, but better safe than sorry) --- win/tcl.hpj.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win/tcl.hpj.in b/win/tcl.hpj.in index a94cea6..08d411d 100644 --- a/win/tcl.hpj.in +++ b/win/tcl.hpj.in @@ -5,9 +5,9 @@ HCW=0 LCID=0x409 0x0 0x0 ;English (United States) REPORT=Yes TITLE=Tcl/Tk Reference Manual -CNT=tcl86.cnt +CNT=tcl87.cnt COPYRIGHT=Copyright © 2000 Ajuba Solutions -HLP=tcl86.hlp +HLP=tcl87.hlp [FILES] tcl.rtf -- cgit v0.12 From 27e8f4db3d5d3fa5840fc71f3cf231238ff2863b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 6 Nov 2017 14:50:08 +0000 Subject: More tcl8 -> tcl9 renumbering, for example related to the installation of Tcl packages where tcl9 actually can find them. --- library/safe.tcl | 2 +- tools/README | 2 +- tools/checkLibraryDoc.tcl | 4 ++-- unix/Makefile.in | 14 +++++++------- win/Makefile.in | 14 +++++++------- win/README | 4 ++-- win/makefile.vc | 26 +++++++++++--------------- win/tcl.hpj.in | 4 ++-- 8 files changed, 33 insertions(+), 37 deletions(-) diff --git a/library/safe.tcl b/library/safe.tcl index ea6391d..c48d002 100644 --- a/library/safe.tcl +++ b/library/safe.tcl @@ -113,7 +113,7 @@ proc ::safe::CheckInterp {slave} { # we had the bad idea to support for the sake of user simplicity in # create/init but which makes life hard in configure... # So this will be hopefully written and some integrated with opt1.0 -# (hopefully for tcl8.1 ?) +# (hopefully for tcl9.0 ?) proc ::safe::interpConfigure {args} { switch [llength $args] { 1 { diff --git a/tools/README b/tools/README index f4bf627..87a9af4 100644 --- a/tools/README +++ b/tools/README @@ -12,7 +12,7 @@ Generating HTML files. The tcl-tk-man-html.tcl script from Robert Critchlow generates a nice set of HTML with good cross references. Use it like - tclsh tcl-tk-man-html.tcl --htmldir=/tmp/tcl8.2 + tclsh tcl-tk-man-html.tcl --htmldir=/tmp/tcl9.0 This script is very picky about the organization of man pages, effectively acting as a style enforcer. diff --git a/tools/checkLibraryDoc.tcl b/tools/checkLibraryDoc.tcl index 6d147ac..a220ea8 100755 --- a/tools/checkLibraryDoc.tcl +++ b/tools/checkLibraryDoc.tcl @@ -3,7 +3,7 @@ # This script attempts to determine what APIs exist in the source base that # have not been documented. By grepping through all of the doc/*.3 man # pages, looking for "Pkg_*" (e.g., Tcl_ or Tk_), and comparing this list -# against the list of Pkg_ APIs found in the source (e.g., tcl8.2/*/*.[ch]) +# against the list of Pkg_ APIs found in the source (e.g., tcl9.0/*/*.[ch]) # we create six lists: # 1) APIs in Source not in Docs. # 2) APIs in Docs not in Source. @@ -106,7 +106,7 @@ proc main {} { if {($len != 2) && ($len != 3)} { puts "usage: $argv0 pkgName pkgDir \[outFile\]" puts " pkgName == Tcl,Tk" - puts " pkgDir == /home/surles/cvs/tcl8.2" + puts " pkgDir == /home/surles/cvs/tcl9.0" exit 1 } diff --git a/unix/Makefile.in b/unix/Makefile.in index 032b5ac..4e2ddc8 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -829,7 +829,7 @@ install-libraries: libraries else true; \ fi; \ done; - @for i in opt0.4 http1.0 encoding ../tcl8 ../tcl8/8.4 ../tcl8/8.4/platform ../tcl8/8.5 ../tcl8/8.6; \ + @for i in opt0.4 http1.0 encoding ../tcl9 ../tcl9/9.0 ../tcl9/9.0/platform; \ do \ if [ ! -d "$(SCRIPT_INSTALL_DIR)"/$$i ] ; then \ echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \ @@ -849,21 +849,21 @@ install-libraries: libraries $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/http1.0; \ done; @echo "Installing package http 2.8.12 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.6/http-2.8.12.tm; + @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl9/9.0/http-2.8.12.tm; @echo "Installing package opt0.4 files to $(SCRIPT_INSTALL_DIR)/opt0.4/"; @for i in $(TOP_DIR)/library/opt/*.tcl ; \ do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/opt0.4; \ done; @echo "Installing package msgcat 1.6.1 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.6.1.tm; + @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl9/9.0/msgcat-1.6.1.tm; @echo "Installing package tcltest 2.4.1 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.4.1.tm; + @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl9/9.0/tcltest-2.4.1.tm; @echo "Installing package platform 1.0.14 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform-1.0.14.tm; + @$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl9/9.0/platform-1.0.14.tm; @echo "Installing package platform::shell 1.1.4 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/platform/shell.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.4/platform/shell-1.1.4.tm; + @$(INSTALL_DATA) $(TOP_DIR)/library/platform/shell.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl9/9.0/platform/shell-1.1.4.tm; @echo "Installing encoding files to $(SCRIPT_INSTALL_DIR)/encoding/"; @for i in $(TOP_DIR)/library/encoding/*.enc ; do \ @@ -2097,7 +2097,7 @@ alldist: dist #-------------------------------------------------------------------------- # 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.* & +# workspace. It depends on the Tcl & Tk being in directories called tcl9.* & # tk8.* up two directories from the TOOL_DIR. # # Note that for platforms where this is important, it is more common to use a diff --git a/win/Makefile.in b/win/Makefile.in index a3275ba..e8b0ff6 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -630,7 +630,7 @@ install-libraries: libraries install-tzdata install-msgs else true; \ fi; \ done; - @for i in http1.0 opt0.4 encoding ../tcl8 ../tcl8/8.4 ../tcl8/8.4/platform ../tcl8/8.5 ../tcl8/8.6; \ + @for i in http1.0 opt0.4 encoding ../tcl9 ../tcl9/9.0 ../tcl9/9.0/platform; \ do \ if [ ! -d $(SCRIPT_INSTALL_DIR)/$$i ] ; then \ echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \ @@ -658,20 +658,20 @@ install-libraries: libraries install-tzdata install-msgs $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/http1.0"; \ done; @echo "Installing package http 2.8.12 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.6/http-2.8.12.tm; + @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl9/9.0/http-2.8.12.tm; @echo "Installing library opt0.4 directory"; @for j in $(ROOT_DIR)/library/opt/*.tcl; \ do \ $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \ done; @echo "Installing package msgcat 1.6.1 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.6.1.tm; + @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl9/9.0/msgcat-1.6.1.tm; @echo "Installing package tcltest 2.4.0 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.4.0.tm; + @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl9/9.0/tcltest-2.4.0.tm; @echo "Installing package platform 1.0.14 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform-1.0.14.tm; + @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl9/9.0/platform-1.0.14.tm; @echo "Installing package platform::shell 1.1.4 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/platform/shell.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform/shell-1.1.4.tm; + @$(COPY) $(ROOT_DIR)/library/platform/shell.tcl $(SCRIPT_INSTALL_DIR)/../tcl9/9.0/platform/shell-1.1.4.tm; @echo "Installing encodings"; @for i in $(ROOT_DIR)/library/encoding/*.enc ; do \ $(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)/encoding"; \ @@ -858,7 +858,7 @@ genstubs: # # 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.* & +# workspace. It depends on the Tcl & Tk being in directories called tcl9.* & # tk8.* up two directories from the TOOL_DIR. # diff --git a/win/README b/win/README index c8fdad6..022dc11 100644 --- a/win/README +++ b/win/README @@ -79,9 +79,9 @@ Use the Makefile "install" target to install Tcl. It will install it according to the prefix options you provided in the correct directory structure. -Note that in order to run tclsh87.exe, you must ensure that tcl87.dll is +Note that in order to run tclsh90.exe, you must ensure that tcl90.dll is on your path, in the system directory, or in the directory containing -tclsh87.exe. +tclsh90.exe. Note: Tcl no longer provides support for Win32s. diff --git a/win/makefile.vc b/win/makefile.vc index 2bff871..ceedc10 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -1116,16 +1116,12 @@ install-binaries: install-libraries: tclConfig install-msgs install-tzdata @if not exist "$(SCRIPT_INSTALL_DIR)$(NULL)" \ $(MKDIR) "$(SCRIPT_INSTALL_DIR)" - @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8$(NULL)" \ - $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8" - @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4$(NULL)" \ - $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4" - @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform$(NULL)" \ - $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform" - @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5$(NULL)" \ - $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5" - @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.6$(NULL)" \ - $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.6" + @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl9$(NULL)" \ + $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl9" + @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0$(NULL)" \ + $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0" + @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\platform$(NULL)" \ + $(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\platform" @echo Installing header files @$(CPY) "$(GENERICDIR)\tcl.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclDecls.h" "$(INCLUDE_INSTALL_DIR)\" @@ -1157,19 +1153,19 @@ install-libraries: tclConfig install-msgs install-tzdata "$(SCRIPT_INSTALL_DIR)\opt0.4\" @echo Installing package http $(PKG_HTTP_VER) as a Tcl Module @$(COPY) "$(ROOT)\library\http\http.tcl" \ - "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.6\http-$(PKG_HTTP_VER).tm" + "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\http-$(PKG_HTTP_VER).tm" @echo Installing package msgcat $(PKG_MSGCAT_VER) as a Tcl Module @$(COPY) "$(ROOT)\library\msgcat\msgcat.tcl" \ - "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5\msgcat-$(PKG_MSGCAT_VER).tm" + "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\msgcat-$(PKG_MSGCAT_VER).tm" @echo Installing package tcltest $(PKG_TCLTEST_VER) as a Tcl Module @$(COPY) "$(ROOT)\library\tcltest\tcltest.tcl" \ - "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5\tcltest-$(PKG_TCLTEST_VER).tm" + "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\tcltest-$(PKG_TCLTEST_VER).tm" @echo Installing package platform $(PKG_PLATFORM_VER) as a Tcl Module @$(COPY) "$(ROOT)\library\platform\platform.tcl" \ - "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform-$(PKG_PLATFORM_VER).tm" + "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\platform-$(PKG_PLATFORM_VER).tm" @echo Installing package platform::shell $(PKG_SHELL_VER) as a Tcl Module @$(COPY) "$(ROOT)\library\platform\shell.tcl" \ - "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform\shell-$(PKG_SHELL_VER).tm" + "$(SCRIPT_INSTALL_DIR)\..\tcl9\9.0\platform\shell-$(PKG_SHELL_VER).tm" @echo Installing $(TCLDDELIBNAME) !if $(STATIC_BUILD) !if !$(TCL_USE_STATIC_PACKAGES) diff --git a/win/tcl.hpj.in b/win/tcl.hpj.in index a94cea6..a3d1a49 100644 --- a/win/tcl.hpj.in +++ b/win/tcl.hpj.in @@ -5,9 +5,9 @@ HCW=0 LCID=0x409 0x0 0x0 ;English (United States) REPORT=Yes TITLE=Tcl/Tk Reference Manual -CNT=tcl86.cnt +CNT=tcl90.cnt COPYRIGHT=Copyright © 2000 Ajuba Solutions -HLP=tcl86.hlp +HLP=tcl90.hlp [FILES] tcl.rtf -- cgit v0.12 From 45808db8dcbdfbee40971863bf92da08d2217966 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 7 Nov 2017 09:08:48 +0000 Subject: TIP #422 implementation, Tcl 8.7 part. --- generic/tcl.decls | 10 +++++----- generic/tclDecls.h | 25 +++++++++++++++---------- generic/tclStubInit.c | 5 +++++ 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index b2b91a9..0bdffec 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -945,10 +945,10 @@ declare 265 { declare 266 { void Tcl_ValidateAllMemory(const char *file, int line) } -declare 267 { +declare 267 {deprecated {see TIP #422}} { void Tcl_AppendResultVA(Tcl_Interp *interp, va_list argList) } -declare 268 { +declare 268 {deprecated {see TIP #422}} { void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, va_list argList) } declare 269 { @@ -976,16 +976,16 @@ declare 274 { CONST84_RETURN char *Tcl_PkgRequire(Tcl_Interp *interp, const char *name, const char *version, int exact) } -declare 275 { +declare 275 {deprecated {see TIP #422}} { void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList) } -declare 276 { +declare 276 {deprecated {see TIP #422}} { int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList) } declare 277 { Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options) } -declare 278 { +declare 278 {deprecated {see TIP #422}} { TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList) } declare 279 { diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 464fc0f..dc48dd5 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -812,10 +812,12 @@ EXTERN int Tcl_DumpActiveMemory(const char *fileName); /* 266 */ EXTERN void Tcl_ValidateAllMemory(const char *file, int line); /* 267 */ -EXTERN void Tcl_AppendResultVA(Tcl_Interp *interp, +TCL_DEPRECATED("see TIP #422") +void Tcl_AppendResultVA(Tcl_Interp *interp, va_list argList); /* 268 */ -EXTERN void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, +TCL_DEPRECATED("see TIP #422") +void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, va_list argList); /* 269 */ EXTERN char * Tcl_HashStats(Tcl_HashTable *tablePtr); @@ -838,14 +840,17 @@ EXTERN CONST84_RETURN char * Tcl_PkgRequire(Tcl_Interp *interp, const char *name, const char *version, int exact); /* 275 */ -EXTERN void Tcl_SetErrorCodeVA(Tcl_Interp *interp, +TCL_DEPRECATED("see TIP #422") +void Tcl_SetErrorCodeVA(Tcl_Interp *interp, va_list argList); /* 276 */ -EXTERN int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList); +TCL_DEPRECATED("see TIP #422") +int Tcl_VarEvalVA(Tcl_Interp *interp, va_list argList); /* 277 */ EXTERN Tcl_Pid Tcl_WaitPid(Tcl_Pid pid, int *statPtr, int options); /* 278 */ -EXTERN TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList); +TCL_DEPRECATED("see TIP #422") +TCL_NORETURN void Tcl_PanicVA(const char *format, va_list argList); /* 279 */ EXTERN void Tcl_GetVersion(int *major, int *minor, int *patchLevel, int *type); @@ -2133,18 +2138,18 @@ typedef struct TclStubs { void (*tcl_WrongNumArgs) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], const char *message); /* 264 */ int (*tcl_DumpActiveMemory) (const char *fileName); /* 265 */ void (*tcl_ValidateAllMemory) (const char *file, int line); /* 266 */ - void (*tcl_AppendResultVA) (Tcl_Interp *interp, va_list argList); /* 267 */ - void (*tcl_AppendStringsToObjVA) (Tcl_Obj *objPtr, va_list argList); /* 268 */ + TCL_DEPRECATED_API("see TIP #422") void (*tcl_AppendResultVA) (Tcl_Interp *interp, va_list argList); /* 267 */ + TCL_DEPRECATED_API("see TIP #422") void (*tcl_AppendStringsToObjVA) (Tcl_Obj *objPtr, va_list argList); /* 268 */ char * (*tcl_HashStats) (Tcl_HashTable *tablePtr); /* 269 */ CONST84_RETURN char * (*tcl_ParseVar) (Tcl_Interp *interp, const char *start, CONST84 char **termPtr); /* 270 */ CONST84_RETURN char * (*tcl_PkgPresent) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 271 */ CONST84_RETURN char * (*tcl_PkgPresentEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 272 */ int (*tcl_PkgProvide) (Tcl_Interp *interp, const char *name, const char *version); /* 273 */ CONST84_RETURN char * (*tcl_PkgRequire) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 274 */ - void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */ - int (*tcl_VarEvalVA) (Tcl_Interp *interp, va_list argList); /* 276 */ + TCL_DEPRECATED_API("see TIP #422") void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */ + TCL_DEPRECATED_API("see TIP #422") int (*tcl_VarEvalVA) (Tcl_Interp *interp, va_list argList); /* 276 */ Tcl_Pid (*tcl_WaitPid) (Tcl_Pid pid, int *statPtr, int options); /* 277 */ - TCL_NORETURN1 void (*tcl_PanicVA) (const char *format, va_list argList); /* 278 */ + TCL_DEPRECATED_API("see TIP #422") TCL_NORETURN1 void (*tcl_PanicVA) (const char *format, va_list argList); /* 278 */ void (*tcl_GetVersion) (int *major, int *minor, int *patchLevel, int *type); /* 279 */ void (*tcl_InitMemory) (Tcl_Interp *interp); /* 280 */ Tcl_Channel (*tcl_StackChannel) (Tcl_Interp *interp, const Tcl_ChannelType *typePtr, ClientData instanceData, int mask, Tcl_Channel prevChan); /* 281 */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index ebd2086..24b28e5 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -72,6 +72,11 @@ static int TclSockMinimumBuffersOld(int sock, int size) # define TclBNInitBignumFromWideUInt 0 # define TclBNInitBignumFromWideInt 0 # define TclBNInitBignumFromLong 0 +# define Tcl_AppendResultVA 0 +# define Tcl_AppendStringsToObjVA 0 +# define Tcl_SetErrorCodeVA 0 +# define Tcl_PanicVA 0 +# define Tcl_VarEvalVA 0 #else #define TclSetStartupScriptPath setStartupScriptPath static void TclSetStartupScriptPath(Tcl_Obj *path) -- cgit v0.12 From 48b529209c87473364215e8aef740e331f88415a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 7 Nov 2017 12:15:30 +0000 Subject: Somewhat simplified implementation of TIP #389, in which the "string length" if characters > U+FFFF is considered to be 2, not 1. --- doc/StringObj.3 | 2 +- doc/ToUpper.3 | 2 +- doc/Utf.3 | 2 +- generic/tcl.decls | 10 +++--- generic/tcl.h | 2 +- generic/tclCmdMZ.c | 18 ++++++++-- generic/tclDecls.h | 20 +++++------ generic/tclScan.c | 12 +++++-- generic/tclStringObj.c | 12 +++---- generic/tclUtf.c | 95 +++++++++++++++++++++++++++++++++++--------------- tests/string.test | 26 +++++++------- tests/utf.test | 4 +-- 12 files changed, 132 insertions(+), 73 deletions(-) diff --git a/doc/StringObj.3 b/doc/StringObj.3 index 7042cc8..8d9bb56 100644 --- a/doc/StringObj.3 +++ b/doc/StringObj.3 @@ -37,7 +37,7 @@ Tcl_UniChar * Tcl_UniChar * \fBTcl_GetUnicode\fR(\fIobjPtr\fR) .sp -Tcl_UniChar +int \fBTcl_GetUniChar\fR(\fIobjPtr, index\fR) .sp int diff --git a/doc/ToUpper.3 b/doc/ToUpper.3 index b933e9c..14766da 100644 --- a/doc/ToUpper.3 +++ b/doc/ToUpper.3 @@ -13,7 +13,7 @@ Tcl_UniCharToUpper, Tcl_UniCharToLower, Tcl_UniCharToTitle, Tcl_UtfToUpper, Tcl_ .nf \fB#include \fR .sp -Tcl_UniChar +int \fBTcl_UniCharToUpper\fR(\fIch\fR) .sp Tcl_UniChar diff --git a/doc/Utf.3 b/doc/Utf.3 index 378c806..5cd6b7df 100644 --- a/doc/Utf.3 +++ b/doc/Utf.3 @@ -63,7 +63,7 @@ const char * const char * \fBTcl_UtfPrev\fR(\fIsrc, start\fR) .sp -Tcl_UniChar +int \fBTcl_UniCharAtIndex\fR(\fIsrc, index\fR) .sp const char * diff --git a/generic/tcl.decls b/generic/tcl.decls index b2b91a9..e3ea9bc 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -1148,16 +1148,16 @@ declare 319 { Tcl_QueuePosition position) } declare 320 { - Tcl_UniChar Tcl_UniCharAtIndex(const char *src, int index) + int Tcl_UniCharAtIndex(const char *src, int index) } declare 321 { - Tcl_UniChar Tcl_UniCharToLower(int ch) + int Tcl_UniCharToLower(int ch) } declare 322 { - Tcl_UniChar Tcl_UniCharToTitle(int ch) + int Tcl_UniCharToTitle(int ch) } declare 323 { - Tcl_UniChar Tcl_UniCharToUpper(int ch) + int Tcl_UniCharToUpper(int ch) } declare 324 { int Tcl_UniCharToUtf(int ch, char *buf) @@ -1351,7 +1351,7 @@ declare 380 { int Tcl_GetCharLength(Tcl_Obj *objPtr) } declare 381 { - Tcl_UniChar Tcl_GetUniChar(Tcl_Obj *objPtr, int index) + int Tcl_GetUniChar(Tcl_Obj *objPtr, int index) } declare 382 { Tcl_UniChar *Tcl_GetUnicode(Tcl_Obj *objPtr) diff --git a/generic/tcl.h b/generic/tcl.h index 07d841d..f874997 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2201,7 +2201,7 @@ typedef struct Tcl_EncodingType { */ #ifndef TCL_UTF_MAX -#define TCL_UTF_MAX 3 +#define TCL_UTF_MAX 4 #endif /* diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 2195aa1..b6a8fe9 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -309,7 +309,7 @@ Tcl_RegexpObjCmd( eflags = 0; } else if (offset > stringLength) { eflags = TCL_REG_NOTBOL; - } else if (Tcl_GetUniChar(objPtr, offset-1) == (Tcl_UniChar)'\n') { + } else if (Tcl_GetUniChar(objPtr, offset-1) == '\n') { eflags = 0; } else { eflags = TCL_REG_NOTBOL; @@ -1218,6 +1218,12 @@ Tcl_SplitObjCmd( for ( ; stringPtr < end; stringPtr += len) { len = TclUtfToUniChar(stringPtr, &ch); +#if TCL_UTF_MAX == 4 + if (!len) { + continue; + } +#endif + /* * Assume Tcl_UniChar is an integral type... */ @@ -1814,8 +1820,16 @@ StringIsCmd( } end = string1 + length1; for (; string1 < end; string1 += length2, failat++) { + int fullchar; length2 = TclUtfToUniChar(string1, &ch); - if (!chcomp(ch)) { + fullchar = ch; +#if TCL_UTF_MAX == 4 + if (!length2) { + length2 = TclUtfToUniChar(string1, &ch); + fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + } +#endif + if (!chcomp(fullchar)) { result = 0; break; } diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 464fc0f..5f83636 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -959,13 +959,13 @@ EXTERN void Tcl_ThreadAlert(Tcl_ThreadId threadId); EXTERN void Tcl_ThreadQueueEvent(Tcl_ThreadId threadId, Tcl_Event *evPtr, Tcl_QueuePosition position); /* 320 */ -EXTERN Tcl_UniChar Tcl_UniCharAtIndex(const char *src, int index); +EXTERN int Tcl_UniCharAtIndex(const char *src, int index); /* 321 */ -EXTERN Tcl_UniChar Tcl_UniCharToLower(int ch); +EXTERN int Tcl_UniCharToLower(int ch); /* 322 */ -EXTERN Tcl_UniChar Tcl_UniCharToTitle(int ch); +EXTERN int Tcl_UniCharToTitle(int ch); /* 323 */ -EXTERN Tcl_UniChar Tcl_UniCharToUpper(int ch); +EXTERN int Tcl_UniCharToUpper(int ch); /* 324 */ EXTERN int Tcl_UniCharToUtf(int ch, char *buf); /* 325 */ @@ -1117,7 +1117,7 @@ EXTERN void Tcl_SetUnicodeObj(Tcl_Obj *objPtr, /* 380 */ EXTERN int Tcl_GetCharLength(Tcl_Obj *objPtr); /* 381 */ -EXTERN Tcl_UniChar Tcl_GetUniChar(Tcl_Obj *objPtr, int index); +EXTERN int Tcl_GetUniChar(Tcl_Obj *objPtr, int index); /* 382 */ EXTERN Tcl_UniChar * Tcl_GetUnicode(Tcl_Obj *objPtr); /* 383 */ @@ -2186,10 +2186,10 @@ typedef struct TclStubs { Tcl_Obj * (*tcl_SetVar2Ex) (Tcl_Interp *interp, const char *part1, const char *part2, Tcl_Obj *newValuePtr, int flags); /* 317 */ void (*tcl_ThreadAlert) (Tcl_ThreadId threadId); /* 318 */ void (*tcl_ThreadQueueEvent) (Tcl_ThreadId threadId, Tcl_Event *evPtr, Tcl_QueuePosition position); /* 319 */ - Tcl_UniChar (*tcl_UniCharAtIndex) (const char *src, int index); /* 320 */ - Tcl_UniChar (*tcl_UniCharToLower) (int ch); /* 321 */ - Tcl_UniChar (*tcl_UniCharToTitle) (int ch); /* 322 */ - Tcl_UniChar (*tcl_UniCharToUpper) (int ch); /* 323 */ + int (*tcl_UniCharAtIndex) (const char *src, int index); /* 320 */ + int (*tcl_UniCharToLower) (int ch); /* 321 */ + int (*tcl_UniCharToTitle) (int ch); /* 322 */ + int (*tcl_UniCharToUpper) (int ch); /* 323 */ int (*tcl_UniCharToUtf) (int ch, char *buf); /* 324 */ CONST84_RETURN char * (*tcl_UtfAtIndex) (const char *src, int index); /* 325 */ int (*tcl_UtfCharComplete) (const char *src, int length); /* 326 */ @@ -2247,7 +2247,7 @@ typedef struct TclStubs { Tcl_Obj * (*tcl_NewUnicodeObj) (const Tcl_UniChar *unicode, int numChars); /* 378 */ void (*tcl_SetUnicodeObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int numChars); /* 379 */ int (*tcl_GetCharLength) (Tcl_Obj *objPtr); /* 380 */ - Tcl_UniChar (*tcl_GetUniChar) (Tcl_Obj *objPtr, int index); /* 381 */ + int (*tcl_GetUniChar) (Tcl_Obj *objPtr, int index); /* 381 */ Tcl_UniChar * (*tcl_GetUnicode) (Tcl_Obj *objPtr); /* 382 */ Tcl_Obj * (*tcl_GetRange) (Tcl_Obj *objPtr, int first, int last); /* 383 */ void (*tcl_AppendUnicodeToObj) (Tcl_Obj *objPtr, const Tcl_UniChar *unicode, int length); /* 384 */ diff --git a/generic/tclScan.c b/generic/tclScan.c index e1fcad4..7f71262 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -885,9 +885,17 @@ Tcl_ScanObjCmd( * Scan a single Unicode character. */ - string += TclUtfToUniChar(string, &sch); + offset = TclUtfToUniChar(string, &sch); + i = (int)sch; +#if TCL_UTF_MAX == 4 + if (!offset) { + offset = Tcl_UtfToUniChar(string, &sch); + i = (((i<<10) & 0x0FFC00) + 0x10000) + (sch & 0x3FF); + } +#endif + string += offset; if (!(flags & SCAN_SUPPRESS)) { - objPtr = Tcl_NewIntObj((int)sch); + objPtr = Tcl_NewIntObj(i); Tcl_IncrRefCount(objPtr); CLANG_ASSERT(objs); objs[objIndex++] = objPtr; diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 3a35bcf..1ccd778 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -466,7 +466,7 @@ Tcl_GetCharLength( *---------------------------------------------------------------------- */ -Tcl_UniChar +int Tcl_GetUniChar( Tcl_Obj *objPtr, /* The object to get the Unicode charater * from. */ @@ -483,7 +483,7 @@ Tcl_GetUniChar( if (TclIsPureByteArray(objPtr)) { unsigned char *bytes = Tcl_GetByteArrayFromObj(objPtr, NULL); - return (Tcl_UniChar) bytes[index]; + return (int) bytes[index]; } /* @@ -507,7 +507,7 @@ Tcl_GetUniChar( FillUnicodeRep(objPtr); stringPtr = GET_STRING(objPtr); } - return stringPtr->unicode[index]; + return (int) stringPtr->unicode[index]; } /* @@ -3462,7 +3462,6 @@ TclStringObjReverse( * Tcl_SetObjLength into growing the unicode rep buffer. */ - ch = 0; objPtr = Tcl_NewUnicodeObj(&ch, 1); Tcl_SetObjLength(objPtr, stringPtr->numChars); to = Tcl_GetUnicode(objPtr); @@ -3565,7 +3564,7 @@ ExtendUnicodeRepWithString( { String *stringPtr = GET_STRING(objPtr); int needed, numOrigChars = 0; - Tcl_UniChar *dst; + Tcl_UniChar *dst, unichar = 0; if (stringPtr->hasUnicode) { numOrigChars = stringPtr->numChars; @@ -3588,7 +3587,8 @@ ExtendUnicodeRepWithString( numAppendChars = 0; } for (dst=stringPtr->unicode + numOrigChars; numAppendChars-- > 0; dst++) { - bytes += TclUtfToUniChar(bytes, dst); + bytes += TclUtfToUniChar(bytes, &unichar); + *dst = unichar; } *dst = 0; } diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 25cc2d1..859fe78 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -699,7 +699,7 @@ Tcl_UtfPrev( *--------------------------------------------------------------------------- */ -Tcl_UniChar +int Tcl_UniCharAtIndex( register const char *src, /* The UTF-8 string to dereference. */ register int index) /* The position of the desired character. */ @@ -819,7 +819,8 @@ int Tcl_UtfToUpper( char *str) /* String to convert in place. */ { - Tcl_UniChar ch = 0, upChar; + Tcl_UniChar ch = 0; + int upChar; char *src, *dst; int bytes; @@ -830,7 +831,14 @@ Tcl_UtfToUpper( src = dst = str; while (*src) { bytes = TclUtfToUniChar(src, &ch); - upChar = Tcl_UniCharToUpper(ch); + upChar = ch; + if (!bytes) { + /* TclUtfToUniChar only returns 0 for chars > 0xffff ! */ + bytes = TclUtfToUniChar(src, &ch); + /* Combine surrogates */ + upChar = (((upChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + } + upChar = Tcl_UniCharToUpper(upChar); /* * To keep badly formed Utf strings from getting inflated by the @@ -872,7 +880,8 @@ int Tcl_UtfToLower( char *str) /* String to convert in place. */ { - Tcl_UniChar ch = 0, lowChar; + Tcl_UniChar ch = 0; + int lowChar; char *src, *dst; int bytes; @@ -883,7 +892,14 @@ Tcl_UtfToLower( src = dst = str; while (*src) { bytes = TclUtfToUniChar(src, &ch); - lowChar = Tcl_UniCharToLower(ch); + lowChar = ch; + if (!bytes) { + /* TclUtfToUniChar only returns 0 for chars > 0xffff ! */ + bytes = TclUtfToUniChar(src, &ch); + /* Combine surrogates */ + lowChar = (((lowChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + } + lowChar = Tcl_UniCharToLower(lowChar); /* * To keep badly formed Utf strings from getting inflated by the @@ -926,7 +942,8 @@ int Tcl_UtfToTitle( char *str) /* String to convert in place. */ { - Tcl_UniChar ch = 0, titleChar, lowChar; + Tcl_UniChar ch = 0; + int titleChar, lowChar; char *src, *dst; int bytes; @@ -939,7 +956,14 @@ Tcl_UtfToTitle( if (*src) { bytes = TclUtfToUniChar(src, &ch); - titleChar = Tcl_UniCharToTitle(ch); + titleChar = ch; + if (!bytes) { + /* TclUtfToUniChar only returns 0 for chars > 0xffff ! */ + bytes = TclUtfToUniChar(src, &ch); + /* Combine surrogates */ + titleChar = (((titleChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + } + titleChar = Tcl_UniCharToTitle(titleChar); if (bytes < TclUtfCount(titleChar)) { memcpy(dst, src, (size_t) bytes); @@ -951,7 +975,14 @@ Tcl_UtfToTitle( } while (*src) { bytes = TclUtfToUniChar(src, &ch); - lowChar = Tcl_UniCharToLower(ch); + lowChar = ch; + if (!bytes) { + /* TclUtfToUniChar only returns 0 for chars > 0xffff ! */ + bytes = TclUtfToUniChar(src, &ch); + /* Combine surrogates */ + lowChar = (((lowChar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + } + lowChar = Tcl_UniCharToLower(lowChar); if (bytes < TclUtfCount(lowChar)) { memcpy(dst, src, (size_t) bytes); @@ -1159,16 +1190,18 @@ TclUtfCasecmp( *---------------------------------------------------------------------- */ -Tcl_UniChar +int Tcl_UniCharToUpper( int ch) /* Unicode character to convert. */ { - int info = GetUniCharInfo(ch); + if (!UNICODE_OUT_OF_RANGE(ch)) { + int info = GetUniCharInfo(ch); - if (GetCaseType(info) & 0x04) { - ch -= GetDelta(info); + if (GetCaseType(info) & 0x04) { + ch -= GetDelta(info); + } } - return (Tcl_UniChar) ch; + return ch & 0x1FFFFF; } /* @@ -1187,16 +1220,18 @@ Tcl_UniCharToUpper( *---------------------------------------------------------------------- */ -Tcl_UniChar +int Tcl_UniCharToLower( int ch) /* Unicode character to convert. */ { - int info = GetUniCharInfo(ch); + if (!UNICODE_OUT_OF_RANGE(ch)) { + int info = GetUniCharInfo(ch); - if (GetCaseType(info) & 0x02) { - ch += GetDelta(info); + if (GetCaseType(info) & 0x02) { + ch += GetDelta(info); + } } - return (Tcl_UniChar) ch; + return ch & 0x1FFFFF; } /* @@ -1215,23 +1250,25 @@ Tcl_UniCharToLower( *---------------------------------------------------------------------- */ -Tcl_UniChar +int Tcl_UniCharToTitle( int ch) /* Unicode character to convert. */ { - int info = GetUniCharInfo(ch); - int mode = GetCaseType(info); + if (!UNICODE_OUT_OF_RANGE(ch)) { + int info = GetUniCharInfo(ch); + int mode = GetCaseType(info); - if (mode & 0x1) { - /* - * Subtract or add one depending on the original case. - */ + if (mode & 0x1) { + /* + * Subtract or add one depending on the original case. + */ - ch += ((mode & 0x4) ? -1 : 1); - } else if (mode == 0x4) { - ch -= GetDelta(info); + ch += ((mode & 0x4) ? -1 : 1); + } else if (mode == 0x4) { + ch -= GetDelta(info); + } } - return (Tcl_UniChar) ch; + return ch & 0x1FFFFF; } /* diff --git a/tests/string.test b/tests/string.test index cb901b9..cebaf4c 100644 --- a/tests/string.test +++ b/tests/string.test @@ -1697,40 +1697,40 @@ test string-24.4 {string reverse command - unshared string} { string reverse $x$y } edcba test string-24.5 {string reverse command - shared unicode string} { - set x abcde\udead + set x abcde\ud0ad string reverse $x -} \udeadedcba +} \ud0adedcba test string-24.6 {string reverse command - unshared string} { set x abc - set y de\udead + set y de\ud0ad string reverse $x$y -} \udeadedcba +} \ud0adedcba test string-24.7 {string reverse command - simple case} { string reverse a } a test string-24.8 {string reverse command - simple case} { - string reverse \udead -} \udead + string reverse \ud0ad +} \ud0ad test string-24.9 {string reverse command - simple case} { string reverse {} } {} test string-24.10 {string reverse command - corner case} { - set x \ubeef\udead + set x \ubeef\ud0ad string reverse $x -} \udead\ubeef +} \ud0ad\ubeef test string-24.11 {string reverse command - corner case} { set x \ubeef - set y \udead + set y \ud0ad string reverse $x$y -} \udead\ubeef +} \ud0ad\ubeef test string-24.12 {string reverse command - corner case} { set x \ubeef - set y \udead + set y \ud0ad string is ascii [string reverse $x$y] } 0 test string-24.13 {string reverse command - pure Unicode string} { - string reverse [string range \ubeef\udead\ubeef\udead\ubeef\udead 1 5] -} \udead\ubeef\udead\ubeef\udead + string reverse [string range \ubeef\ud0ad\ubeef\ud0ad\ubeef\ud0ad 1 5] +} \ud0ad\ubeef\ud0ad\ubeef\ud0ad test string-24.14 {string reverse command - pure bytearray} { binary scan [string reverse [binary format H* 010203]] H* x set x diff --git a/tests/utf.test b/tests/utf.test index 422ab08..45f9c0c 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -68,10 +68,10 @@ test utf-2.7 {Tcl_UtfToUniChar: lead (3-byte) followed by 2 trail} testbytestrin } {1} test utf-2.8 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {fullutf testbytestring} -body { string length [testbytestring "\xF0\x90\x80\x80"] -} -result {1} +} -result {2} test utf-2.9 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {fullutf testbytestring} -body { string length [testbytestring "\xF4\x8F\xBF\xBF"] -} -result {1} +} -result {2} test utf-2.10 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail, underflow} testbytestring { string length [testbytestring "\xF0\x8F\xBF\xBF"] } {4} -- cgit v0.12 From ac4fb39a73fb01e2cbb763a086191aa4fcec175f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 7 Nov 2017 13:19:37 +0000 Subject: Don't use Unicode character \udead in test-cases, because it is an invalid Unicode code-point (lower surrogate). This will cause test-failures with TIP #389. Just use \ud0ad in stead. Also fix some other test-cases which fail for TCL_UTF_MAX == 4. --- tests/string.test | 26 +++++++++++++------------- tests/utf.test | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/string.test b/tests/string.test index cc65e67..bbba5eb 100644 --- a/tests/string.test +++ b/tests/string.test @@ -1682,40 +1682,40 @@ test string-24.4 {string reverse command - unshared string} { string reverse $x$y } edcba test string-24.5 {string reverse command - shared unicode string} { - set x abcde\udead + set x abcde\ud0ad string reverse $x -} \udeadedcba +} \ud0adedcba test string-24.6 {string reverse command - unshared string} { set x abc - set y de\udead + set y de\ud0ad string reverse $x$y -} \udeadedcba +} \ud0adedcba test string-24.7 {string reverse command - simple case} { string reverse a } a test string-24.8 {string reverse command - simple case} { - string reverse \udead -} \udead + string reverse \ud0ad +} \ud0ad test string-24.9 {string reverse command - simple case} { string reverse {} } {} test string-24.10 {string reverse command - corner case} { - set x \ubeef\udead + set x \ubeef\ud0ad string reverse $x -} \udead\ubeef +} \ud0ad\ubeef test string-24.11 {string reverse command - corner case} { set x \ubeef - set y \udead + set y \ud0ad string reverse $x$y -} \udead\ubeef +} \ud0ad\ubeef test string-24.12 {string reverse command - corner case} { set x \ubeef - set y \udead + set y \ud0ad string is ascii [string reverse $x$y] } 0 test string-24.13 {string reverse command - pure Unicode string} { - string reverse [string range \ubeef\udead\ubeef\udead\ubeef\udead 1 5] -} \udead\ubeef\udead\ubeef\udead + string reverse [string range \ubeef\ud0ad\ubeef\ud0ad\ubeef\ud0ad 1 5] +} \ud0ad\ubeef\ud0ad\ubeef\ud0ad test string-24.14 {string reverse command - pure bytearray} { binary scan [string reverse [binary format H* 010203]] H* x set x diff --git a/tests/utf.test b/tests/utf.test index 422ab08..45f9c0c 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -68,10 +68,10 @@ test utf-2.7 {Tcl_UtfToUniChar: lead (3-byte) followed by 2 trail} testbytestrin } {1} test utf-2.8 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {fullutf testbytestring} -body { string length [testbytestring "\xF0\x90\x80\x80"] -} -result {1} +} -result {2} test utf-2.9 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {fullutf testbytestring} -body { string length [testbytestring "\xF4\x8F\xBF\xBF"] -} -result {1} +} -result {2} test utf-2.10 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail, underflow} testbytestring { string length [testbytestring "\xF0\x8F\xBF\xBF"] } {4} -- cgit v0.12 From 42764c99bec23aaae227ff1aba60c1ff9e7d9230 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 7 Nov 2017 16:16:52 +0000 Subject: More code simplifications, with still equal functionality. --- generic/tclExecute.c | 6 ++---- generic/tclObj.c | 33 +++------------------------------ generic/tclStrToD.c | 40 ++++++---------------------------------- 3 files changed, 11 insertions(+), 68 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 51f9bff..68056c6 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5776,7 +5776,7 @@ TEBCresume( { ClientData ptr1, ptr2; int type1, type2; - Tcl_WideInt w1, w2, wResult; + Tcl_WideInt w1, w2, wResult; case INST_NUM_TYPE: if (GetNumberFromObj(NULL, OBJ_AT_TOS, &ptr1, &type1) != TCL_OK) { @@ -5787,9 +5787,7 @@ TEBCresume( /* [string is wideinteger] is -UWIDE_MAX to UWIDE_MAX range */ int i; - if (Tcl_GetIntFromObj(NULL, OBJ_AT_TOS, &i) != TCL_OK) { - type1 = TCL_NUMBER_WIDE; - } else { + if (Tcl_GetIntFromObj(NULL, OBJ_AT_TOS, &i) == TCL_OK) { type1 = TCL_NUMBER_LONG; } } else if (type1 == TCL_NUMBER_BIG) { diff --git a/generic/tclObj.c b/generic/tclObj.c index 04fdeaa..634f8db 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -3393,38 +3393,12 @@ Tcl_SetBignumObj( Tcl_Panic("%s called with shared object", "Tcl_SetBignumObj"); } if ((size_t) bignumValue->used - <= (CHAR_BIT * sizeof(long) + DIGIT_BIT - 1) / DIGIT_BIT) { - unsigned long value = 0, numBytes = sizeof(long); - long scratch; + <= (CHAR_BIT * sizeof(Tcl_WideUInt) + DIGIT_BIT - 1) / DIGIT_BIT) { + Tcl_WideUInt value = 0, numBytes = sizeof(Tcl_WideUInt); + Tcl_WideUInt scratch; unsigned char *bytes = (unsigned char *) &scratch; if (mp_to_unsigned_bin_n(bignumValue, bytes, &numBytes) != MP_OKAY) { - goto tooLargeForLong; - } - while (numBytes-- > 0) { - value = (value << CHAR_BIT) | *bytes++; - } - if (value > (((~(unsigned long)0) >> 1) + bignumValue->sign)) { - goto tooLargeForLong; - } - if (bignumValue->sign) { - TclSetWideObj(objPtr, -(long)value); - } else { - TclSetWideObj(objPtr, (long)value); - } - mp_clear(bignumValue); - return; - } - tooLargeForLong: -#ifndef TCL_WIDE_INT_IS_LONG - if ((size_t) bignumValue->used - <= (CHAR_BIT * sizeof(Tcl_WideInt) + DIGIT_BIT - 1) / DIGIT_BIT) { - Tcl_WideUInt value = 0; - unsigned long numBytes = sizeof(Tcl_WideInt); - Tcl_WideInt scratch; - unsigned char *bytes = (unsigned char *)&scratch; - - if (mp_to_unsigned_bin_n(bignumValue, bytes, &numBytes) != MP_OKAY) { goto tooLargeForWide; } while (numBytes-- > 0) { @@ -3442,7 +3416,6 @@ Tcl_SetBignumObj( return; } tooLargeForWide: -#endif TclInvalidateStringRep(objPtr); TclFreeIntRep(objPtr); TclSetBignumIntRep(objPtr, bignumValue); diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 9663c21..ac2ca68 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -1268,21 +1268,7 @@ TclParseNumber( } } if (!octalSignificandOverflow) { - if (octalSignificandWide > - (Tcl_WideUInt)(((~(unsigned long)0) >> 1) + signum)) { -#ifndef TCL_WIDE_INT_IS_LONG - if (octalSignificandWide <= (MOST_BITS + signum)) { - objPtr->typePtr = &tclIntType; - if (signum) { - objPtr->internalRep.wideValue = - - (Tcl_WideInt) octalSignificandWide; - } else { - objPtr->internalRep.wideValue = - (Tcl_WideInt) octalSignificandWide; - } - break; - } -#endif + if (octalSignificandWide > (MOST_BITS + signum)) { TclInitBignumFromWideUInt(&octalSignificandBig, octalSignificandWide); octalSignificandOverflow = 1; @@ -1290,10 +1276,10 @@ TclParseNumber( objPtr->typePtr = &tclIntType; if (signum) { objPtr->internalRep.wideValue = - - (long) octalSignificandWide; + - (Tcl_WideInt) octalSignificandWide; } else { objPtr->internalRep.wideValue = - (long) octalSignificandWide; + (Tcl_WideInt) octalSignificandWide; } } } @@ -1315,21 +1301,7 @@ TclParseNumber( } returnInteger: if (!significandOverflow) { - if (significandWide > - (Tcl_WideUInt)(((~(unsigned long)0) >> 1) + signum)) { -#ifndef TCL_WIDE_INT_IS_LONG - if (significandWide <= MOST_BITS+signum) { - objPtr->typePtr = &tclIntType; - if (signum) { - objPtr->internalRep.wideValue = - - (Tcl_WideInt) significandWide; - } else { - objPtr->internalRep.wideValue = - (Tcl_WideInt) significandWide; - } - break; - } -#endif + if (significandWide > MOST_BITS+signum) { TclInitBignumFromWideUInt(&significandBig, significandWide); significandOverflow = 1; @@ -1337,10 +1309,10 @@ TclParseNumber( objPtr->typePtr = &tclIntType; if (signum) { objPtr->internalRep.wideValue = - - (long) significandWide; + - (Tcl_WideInt) significandWide; } else { objPtr->internalRep.wideValue = - (long) significandWide; + (Tcl_WideInt) significandWide; } } } -- cgit v0.12 From c7530621ad6451c1adfa3908a9019e7dd24e042a Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 7 Nov 2017 16:47:35 +0000 Subject: Fix inclusion of custom resource files to match TIP spec --- win/makefile.vc | 2 +- win/rules.vc | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/win/makefile.vc b/win/makefile.vc index d7ea7ae..ff31e96 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -72,7 +72,7 @@ PROJECT = tcl DEFAULT_BUILD_TARGET = release # We want to use our own resource file, not the standard template one. -PRJ_RCFILE = tcl.rc +RCFILE = tcl.rc # The rules.vc file does most of the hard work in terms of defining # the build configuration, macros, output directories etc. diff --git a/win/rules.vc b/win/rules.vc index 5e98d77..a1c30e0 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -117,7 +117,6 @@ Visual C++ compiler environment not initialized. #---------------------------------------------------------- RMDIR = rmdir /S /Q -ERRNULL = 2>NUL CPY = xcopy /i /y >NUL CPYDIR = xcopy /e /i /y >NUL COPY = copy /y >NUL @@ -197,6 +196,7 @@ DEMODIR = $(ROOT)\demos # TBD - This is a potentially dangerous conflict, rename WINDIR to # something else WINDIR = $(ROOT)\win + !ifndef RCDIR !if exist("$(WINDIR)\rc") RCDIR = $(WINDIR)\rc @@ -388,7 +388,7 @@ VCVER=0 && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \ && ![echo ARCH=AMD64 >> vercl.x] \ && ![echo $(_HASH)endif >> vercl.x] \ - && ![$(cc32) -nologo -TC -P vercl.x $(ERRNULL)] + && ![$(cc32) -nologo -TC -P vercl.x 2>NUL] !include vercl.i !if $(VCVERSION) < 1900 !if ![echo VCVER= ^\> vercl.vc] \ @@ -402,7 +402,7 @@ VCVER = $(VCVERSION) !endif !endif -!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc] +!if ![del 2>NUL /q/f vercl.x vercl.i vercl.vc] !endif #---------------------------------------------------------------- @@ -829,7 +829,7 @@ WARNINGS = $(WARNINGS) -Wp64 ################################################################ # 9. Extract various version numbers -# For Tcl and Tk, version numbers are exctracted from tcl.h and tk.h +# For Tcl and Tk, version numbers are extracted from tcl.h and tk.h # respectively. For extensions, versions are extracted from the # configure.in or configure.ac from the TEA configuration if it # exists, and unset otherwise. @@ -1106,8 +1106,8 @@ PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME) # If extension parent makefile has not defined a resource definition file, # we will generate one from standard template. !if !$(DOING_TCL) && !$(DOING_TK) && !$(STATIC_BUILD) -!ifdef PRJ_RCFILE -RESFILE = $(TMP_DIR)\$(PRJ_RCFILE:.rc=.res) +!ifdef RCFILE +RESFILE = $(TMP_DIR)\$(RCFILE:.rc=.res) !else RESFILE = $(TMP_DIR)\$(PROJECT).res !endif @@ -1499,10 +1499,13 @@ default-shell: default-setup $(PROJECT) $(DEBUGGER) $(TCLSH) # Generation of Windows version resource -!ifdef PRJ_RCFILE +!ifdef RCFILE +# Note: don't use $** in below rule because there may be other dependencies +# and only the "master" rc must be passed to the resource compiler $(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc - $(RESCMD) $** + $(RESCMD) $(RCDIR)\$(PROJECT).rc + !else # If parent makefile has not defined a resource definition file, @@ -1545,7 +1548,7 @@ END << -!endif # ifdef PRJ_RCFILE +!endif # ifdef RCFILE !ifndef DISABLE_IMPLICIT_RULES DISABLE_IMPLICIT_RULES = 0 -- cgit v0.12 From 338e92cb28bb8cc4d6dac152cf24593323d293bb Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 7 Nov 2017 18:45:24 +0000 Subject: Updated the zipfs portion of the testsuite to tip430 standards --- tests/zipfs.test | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/zipfs.test b/tests/zipfs.test index adacbde..2aea3bf 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -17,9 +17,10 @@ if {"::tcltest" ni [namespace children]} { testConstraint zipfs [expr {[llength [info commands zlib]] && [regexp tcltest [info nameofexecutable]]}] -test zipfs-1.1 {zipfs basics} -constraints zipfs -body { - load {} zipfs -} -result {} +# Removed in tip430 - zipfs is no longer a static package +#test zipfs-1.1 {zipfs basics} -constraints zipfs -body { +# load {} zipfs +#} -result {} test zipfs-1.2 {zipfs basics} -constraints zipfs -body { package require zipfs @@ -66,18 +67,18 @@ test zipfs-2.2 {zipfs mkzip} -constraints zipfs -body { set pwd [pwd] cd $tcl_library/encoding zipfs mkzip abc.zip . - zipfs mount abc.zip /abc - zipfs list -glob /abc/cp850.* + zipfs mount abc.zip zipfs:/abc + zipfs list -glob zipfs:/abc/cp850.* } -cleanup { cd $pwd -} -result {/abc/cp850.enc} +} -result {zipfs:/abc/cp850.enc} test zipfs-2.3 {zipfs unmount} -constraints zipfs -body { - zipfs info /abc/cp850.enc + zipfs info zipfs:/abc/cp850.enc } -result [list $tcl_library/encoding/abc.zip 1090 527 39434] test zipfs-2.4 {zipfs unmount} -constraints zipfs -body { - set f [open /abc/cp850.enc] + set f [open zipfs:/abc/cp850.enc] read $f } -result {# Encoding file: cp850, single-byte S -- cgit v0.12 From 399ff79e21dd4d6374ddc5d825a8a35912a3eaa0 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 7 Nov 2017 19:13:34 +0000 Subject: Adding a [file normalize] to zipfs tests that are looking for absolute filenames. On Linux symlinks can cause a discrepency in what the tests think they are looking for. --- tests/zipfs.test | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/zipfs.test b/tests/zipfs.test index 2aea3bf..89d35ad 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -58,14 +58,15 @@ test zipfs-1.10 {zipfs basics} -constraints zipfs -returnCodes error -body { zipfs list a b c d e f } -result {wrong # args: should be "zipfs list ?(-glob|-regexp)? ?pattern?"} +set ntcl_library [file normalize $tcl_library] test zipfs-2.1 {zipfs mkzip empty archive} -constraints zipfs -returnCodes error -body { - zipfs mkzip abc.zip $tcl_library/xxxx + zipfs mkzip abc.zip $ntcl_library/xxxx } -result {empty archive} test zipfs-2.2 {zipfs mkzip} -constraints zipfs -body { set pwd [pwd] - cd $tcl_library/encoding + cd $ntcl_library/encoding zipfs mkzip abc.zip . zipfs mount abc.zip zipfs:/abc zipfs list -glob zipfs:/abc/cp850.* @@ -75,7 +76,7 @@ test zipfs-2.2 {zipfs mkzip} -constraints zipfs -body { test zipfs-2.3 {zipfs unmount} -constraints zipfs -body { zipfs info zipfs:/abc/cp850.enc -} -result [list $tcl_library/encoding/abc.zip 1090 527 39434] +} -result [list $ntcl_library/encoding/abc.zip 1090 527 39434] test zipfs-2.4 {zipfs unmount} -constraints zipfs -body { set f [open zipfs:/abc/cp850.enc] -- cgit v0.12 From 23440fcbd7900cac63198c161e871dd19ae36d10 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 7 Nov 2017 19:26:21 +0000 Subject: Removing patches for Androwish that are not needed for tip430 --- generic/tclIOUtil.c | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index bb6a7ca..2c389c6 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -190,8 +190,6 @@ const Tcl_Filesystem tclNativeFilesystem = { TclpObjChdir }; -MODULE_SCOPE Tcl_Filesystem zipfsFilesystem; - /* * Define the tail of the linked list. Note that for unconventional uses of * Tcl without a native filesystem, we may in the future wish to modify the @@ -1414,22 +1412,6 @@ TclFSNormalizeToUniquePath( Claim(); for (fsRecPtr=firstFsRecPtr; fsRecPtr!=NULL; fsRecPtr=fsRecPtr->nextPtr) { - if (fsRecPtr->fsPtr == &zipfsFilesystem) { - ClientData clientData = NULL; - /* - * Allow mounted zipfs filesystem to overtake entire normalisation. - * This is needed on unix for mounts on symlinks right below root. - */ - - if (fsRecPtr->fsPtr->pathInFilesystemProc != NULL) { - if (fsRecPtr->fsPtr->pathInFilesystemProc(pathPtr, - &clientData)!=-1) { - TclFSSetPathDetails(pathPtr, fsRecPtr->fsPtr, clientData); - break; - } - } - continue; - } if (fsRecPtr->fsPtr != &tclNativeFilesystem) { continue; } @@ -1454,9 +1436,6 @@ TclFSNormalizeToUniquePath( if (fsRecPtr->fsPtr == &tclNativeFilesystem) { continue; } - if (fsRecPtr->fsPtr == &zipfsFilesystem) { - continue; - } if (fsRecPtr->fsPtr->normalizePathProc != NULL) { startAt = fsRecPtr->fsPtr->normalizePathProc(interp, pathPtr, @@ -2939,19 +2918,6 @@ Tcl_FSChdir( } fsPtr = Tcl_FSGetFileSystemForPath(pathPtr); - - if ((fsPtr != NULL) && (fsPtr != &tclNativeFilesystem)) { - /* - * Watch out for tilde substitution. - * Only valid in native filesystem. - */ - char *name = Tcl_GetString(pathPtr); - - if ((name != NULL) && (*name == '~')) { - fsPtr = &tclNativeFilesystem; - } - } - if (fsPtr != NULL) { if (fsPtr->chdirProc != NULL) { /* -- cgit v0.12 From c2dfae075806fd3b5117755f85ba3e8a3a6c2170 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 7 Nov 2017 19:51:53 +0000 Subject: Removing kit building facilities. They aren't part of the tip430 spec --- library/practcl/pkgIndex.tcl | 11 - library/practcl/practcl.tcl | 4014 --------------------------------------- library/zvfstools/pkgIndex.tcl | 1 - library/zvfstools/zvfstools.tcl | 325 ---- pkgs/make.tcl | 165 -- pkgs/packages.tcl | 92 - 6 files changed, 4608 deletions(-) delete mode 100644 library/practcl/pkgIndex.tcl delete mode 100644 library/practcl/practcl.tcl delete mode 100644 library/zvfstools/pkgIndex.tcl delete mode 100644 library/zvfstools/zvfstools.tcl delete mode 100644 pkgs/make.tcl delete mode 100644 pkgs/packages.tcl diff --git a/library/practcl/pkgIndex.tcl b/library/practcl/pkgIndex.tcl deleted file mode 100644 index 1e378e8..0000000 --- a/library/practcl/pkgIndex.tcl +++ /dev/null @@ -1,11 +0,0 @@ -# Tcl package index file, version 1.1 -# This file is generated by the "pkg_mkIndex" command -# and sourced either when an application starts up or -# by a "package unknown" script. It invokes the -# "package ifneeded" command to set up package-related -# information so that packages will be loaded automatically -# in response to "package require" commands. When this -# script is sourced, the variable $dir must contain the -# full path name of this file's directory. - -package ifneeded practcl 0.5 [list source [file join $dir practcl.tcl]] diff --git a/library/practcl/practcl.tcl b/library/practcl/practcl.tcl deleted file mode 100644 index 77d1181..0000000 --- a/library/practcl/practcl.tcl +++ /dev/null @@ -1,4014 +0,0 @@ -### -# Practcl -# An object oriented templating system for stamping out Tcl API calls to C -### -puts [list LOADED practcl.tcl from [info script]] -package require TclOO -proc ::debug args { - #puts $args - ::practcl::cputs ::DEBUG_INFO $args -} - -### -# Drop in a static copy of Tcl -### -proc ::doexec args { - puts [list {*}$args] - exec {*}$args >&@ stdout -} - -proc ::dotclexec args { - puts [list [info nameofexecutable] {*}$args] - exec [info nameofexecutable] {*}$args >&@ stdout -} - -proc ::domake {path args} { - set PWD [pwd] - cd $path - puts [list *** $path ***] - puts [list make {*}$args] - exec make {*}$args >&@ stdout - cd $PWD -} - -proc ::domake.tcl {path args} { - set PWD [pwd] - cd $path - puts [list *** $path ***] - puts [list make.tcl {*}$args] - exec [info nameofexecutable] make.tcl {*}$args >&@ stdout - cd $PWD -} - -proc ::fossil {path args} { - set PWD [pwd] - cd $path - puts [list {*}$args] - exec fossil {*}$args >&@ stdout - cd $PWD -} - - -proc ::fossil_status {dir} { - if {[info exists ::fosdat($dir)]} { - return $::fosdat($dir) - } - set result { -tags experimental -version {} - } - set pwd [pwd] - cd $dir - set info [exec fossil status] - cd $pwd - foreach line [split $info \n] { - if {[lindex $line 0] eq "checkout:"} { - set hash [lindex $line end-3] - set maxdate [lrange $line end-2 end-1] - dict set result hash $hash - dict set result maxdate $maxdate - regsub -all {[^0-9]} $maxdate {} isodate - dict set result isodate $isodate - } - if {[lindex $line 0] eq "tags:"} { - set tags [lrange $line 1 end] - dict set result tags $tags - break - } - } - set ::fosdat($dir) $result - return $result -} -### -# Seek out Tcllib if it's available -### -set tcllib_path {} -foreach path {.. ../.. ../../..} { - foreach path [glob -nocomplain [file join [file normalize $path] tcllib* modules]] { - set tclib_path $path - lappend ::auto_path $path - break - } - if {$tcllib_path ne {}} break -} - - -### -# Build utility functions -### -namespace eval ::practcl {} - -proc ::practcl::os {} { - if {[info exists ::project(TEACUP_OS)] && $::project(TEACUP_OS) ni {"@TEACUP_OS@" {}}} { - return $::project(TEACUP_OS) - } - set info [::practcl::config.tcl $::project(builddir)] - if {[dict exists $info TEACUP_OS]} { - return [dict get $info TEACUP_OS] - } - return unknown -} - -### -# Detect local platform -### -proc ::practcl::config.tcl {path} { - dict set result buildpath $path - set result {} - if {[file exists [file join $path config.tcl]]} { - set fin [open [file join $path config.tcl] r] - set bufline {} - set rawcount 0 - set linecount 0 - while {[gets $fin thisline]>=0} { - incr rawcount - append bufline \n $thisline - if {![info complete $bufline]} continue - set line [string trimleft $bufline] - set bufline {} - if {[string index [string trimleft $line] 0] eq "#"} continue - incr linecount - set key [lindex $line 0] - set value [lindex $line 1] - dict set result $key $value - } - dict set result sandbox [file dirname [dict get $result srcdir]] - dict set result download [file join [dict get $result sandbox] download] - dict set result teapot [file join [dict get $result sandbox] teapot] - set result [::practcl::de_shell $result] - } - # If data is available from autoconf, defer to that - if {[dict exists $result TEACUP_OS] && [dict get $result TEACUP_OS] ni {"@TEACUP_OS@" {}}} { - return $result - } - # If autoconf hasn't run yet, assume we are not cross compiling - # and defer to local checks - dict set result TEACUP_PROFILE unknown - dict set result TEACUP_OS unknown - dict set result EXEEXT {} - if {$::tcl_platform(platform) eq "windows"} { - set system "windows" - set arch ix86 - dict set result TEACUP_PROFILE win32-ix86 - dict set result TEACUP_OS windows - dict set result EXEEXT .exe - } else { - set system [exec uname -s]-[exec uname -r] - set arch unknown - dict set result TEACUP_OS generic - } - dict set result TEA_PLATFORM $system - dict set result TEA_SYSTEM $system - switch -glob $system { - Linux* { - dict set result TEACUP_OS linux - set arch [exec uname -m] - dict set result TEACUP_PROFILE "linux-glibc2.3-$arch" - } - GNU* { - set arch [exec uname -m] - dict set result TEACUP_OS "gnu" - } - NetBSD-Debian { - set arch [exec uname -m] - dict set result TEACUP_OS "netbsd-debian" - } - OpenBSD-* { - set arch [exec arch -s] - dict set result TEACUP_OS "openbsd" - } - Darwin* { - set arch [exec uname -m] - dict set result TEACUP_OS "macosx" - if {$arch eq "x86_64"} { - dict set result TEACUP_PROFILE "macosx10.5-i386-x86_84" - } else { - dict set result TEACUP_PROFILE "macosx-universal" - } - } - OpenBSD* { - set arch [exec arch -s] - dict set result TEACUP_OS "openbsd" - } - } - if {$arch eq "unknown"} { - catch {set arch [exec uname -m]} - } - switch -glob $arch { - i*86 { - set arch "ix86" - } - amd64 { - set arch "x86_64" - } - } - dict set result TEACUP_ARCH $arch - if {[dict get $result TEACUP_PROFILE] eq "unknown"} { - dict set result TEACUP_PROFILE [dict get $result TEACUP_OS]-$arch - } - return $result -} - - -### -# Convert an MSYS path to a windows native path -### -if {$::tcl_platform(platform) eq "windows"} { -proc ::practcl::msys_to_tclpath msyspath { - return [exec sh -c "cd $msyspath ; pwd -W"] -} -} else { -proc ::practcl::msys_to_tclpath msyspath { - return [file normalize $msyspath] -} -} - -### -# Bits stolen from fileutil -### -proc ::practcl::cat fname { - set fname [open $fname r] - set data [read $fname] - close $fname - return $data -} - -proc ::practcl::file_lexnormalize {sp} { - set spx [file split $sp] - - # Resolution of embedded relative modifiers (., and ..). - - if { - ([lsearch -exact $spx . ] < 0) && - ([lsearch -exact $spx ..] < 0) - } { - # Quick path out if there are no relative modifiers - return $sp - } - - set absolute [expr {![string equal [file pathtype $sp] relative]}] - # A volumerelative path counts as absolute for our purposes. - - set sp $spx - set np {} - set noskip 1 - - while {[llength $sp]} { - set ele [lindex $sp 0] - set sp [lrange $sp 1 end] - set islast [expr {[llength $sp] == 0}] - - if {[string equal $ele ".."]} { - if { - ($absolute && ([llength $np] > 1)) || - (!$absolute && ([llength $np] >= 1)) - } { - # .. : Remove the previous element added to the - # new path, if there actually is enough to remove. - set np [lrange $np 0 end-1] - } - } elseif {[string equal $ele "."]} { - # Ignore .'s, they stay at the current location - continue - } else { - # A regular element. - lappend np $ele - } - } - if {[llength $np] > 0} { - return [eval [linsert $np 0 file join]] - # 8.5: return [file join {*}$np] - } - return {} -} - -proc ::practcl::file_relative {base dst} { - # Ensure that the link to directory 'dst' is properly done relative to - # the directory 'base'. - - if {![string equal [file pathtype $base] [file pathtype $dst]]} { - return -code error "Unable to compute relation for paths of different pathtypes: [file pathtype $base] vs. [file pathtype $dst], ($base vs. $dst)" - } - - set base [file_lexnormalize [file join [pwd] $base]] - set dst [file_lexnormalize [file join [pwd] $dst]] - - set save $dst - set base [file split $base] - set dst [file split $dst] - - while {[string equal [lindex $dst 0] [lindex $base 0]]} { - set dst [lrange $dst 1 end] - set base [lrange $base 1 end] - if {![llength $dst]} {break} - } - - set dstlen [llength $dst] - set baselen [llength $base] - - if {($dstlen == 0) && ($baselen == 0)} { - # Cases: - # (a) base == dst - - set dst . - } else { - # Cases: - # (b) base is: base/sub = sub - # dst is: base = {} - - # (c) base is: base = {} - # dst is: base/sub = sub - - while {$baselen > 0} { - set dst [linsert $dst 0 ..] - incr baselen -1 - } - # 8.5: set dst [file join {*}$dst] - set dst [eval [linsert $dst 0 file join]] - } - - return $dst -} - -### -# Unpack the source of a fossil project into a designated location -### -proc ::practcl::fossil_sandbox {pkg args} { - if {[llength $args]==1} { - set info [lindex $args 0] - } else { - set info $args - } - set result $info - if {[dict exists $info srcroot]} { - set srcroot [dict get $info srcroot] - } elseif {[dict exists $info sandbox]} { - set srcroot [file join [dict get $info sandbox] $pkg] - } else { - set srcroot [file join $::CWD .. $pkg] - } - dict set result srcroot $srcroot - puts [list fossil_sandbox $pkg $srcroot] - if {[dict exists $info download]} { - ### - # Source is actually a zip archive - ### - set download [dict get $info download] - if {[file exists [file join $download $pkg.zip]]} { - if {![info exists $srcroot]} { - package require zipfile::decode - ::zipfile::decode::unzipfile [file join $download $pkg.zip] $srcroot - } - return - } - } - variable fossil_dbs - if {![::info exists fossil_dbs]} { - # Get a list of local fossil databases - set fossil_dbs [exec fossil all list] - } - set CWD [pwd] - if {![dict exists $info tag]} { - set tag trunk - } else { - set tag [dict get $info tag] - } - dict set result tag $tag - - try { - if {[file exists [file join $srcroot .fslckout]]} { - if {[dict exists $info update] && [dict get $info update]==1} { - catch { - puts "FOSSIL UPDATE" - cd $srcroot - doexec fossil update $tag - } - } - } elseif {[file exists [file join $srcroot _FOSSIL_]]} { - if {[dict exists $info update] && [dict get $info update]==1} { - catch { - puts "FOSSIL UPDATE" - cd $srcroot - doexec fossil update $tag - } - } - } else { - puts "OPEN AND UNPACK" - set fosdb {} - foreach line [split $fossil_dbs \n] { - set line [string trim $line] - if {[file rootname [file tail $line]] eq $pkg} { - set fosdb $line - break - } - } - if {$fosdb eq {}} { - file mkdir [file join $download fossil] - set fosdb [file join $download fossil $pkg.fos] - set cloned 0 - if {[dict exists $info localmirror]} { - set localmirror [dict get $info localmirror] - catch { - doexec fossil clone $localmirror/$pkg $fosdb - set cloned 1 - } - } - if {!$cloned && [dict exists $info fossil_url]} { - set localmirror [dict get $info fossil_url] - catch { - doexec fossil clone $localmirror/$pkg $fosdb - set cloned 1 - } - } - if {!$cloned} { - doexec fossil clone http://fossil.etoyoc.com/fossil/$pkg $fosdb - } - } - file mkdir $srcroot - cd $srcroot - puts "FOSSIL OPEN [pwd]" - doexec fossil open $fosdb $tag - } - } on error {result opts} { - puts [list ERR [dict get $opts -errorinfo]] - return {*}$opts - } finally { - cd $CWD - } - return $result -} - -### -# topic: e71f3f61c348d56292011eec83e95f0aacc1c618 -# description: Converts a XXX.sh file into a series of Tcl variables -### -proc ::practcl::read_sh_subst {line info} { - regsub -all {\x28} $line \x7B line - regsub -all {\x29} $line \x7D line - - #set line [string map $key [string trim $line]] - foreach {field value} $info { - catch {set $field $value} - } - if [catch {subst $line} result] { - return {} - } - set result [string trim $result] - return [string trim $result '] -} - -### -# topic: 03567140cca33c814664c7439570f669b9ab88e6 -### -proc ::practcl::read_sh_file {filename {localdat {}}} { - set fin [open $filename r] - set result {} - if {$localdat eq {}} { - set top 1 - set local [array get ::env] - dict set local EXE {} - } else { - set top 0 - set local $localdat - } - while {[gets $fin line] >= 0} { - set line [string trim $line] - if {[string index $line 0] eq "#"} continue - if {$line eq {}} continue - catch { - if {[string range $line 0 6] eq "export "} { - set eq [string first "=" $line] - set field [string trim [string range $line 6 [expr {$eq - 1}]]] - set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local] - dict set result $field [read_sh_subst $value $local] - dict set local $field $value - } elseif {[string range $line 0 7] eq "include "} { - set subfile [read_sh_subst [string range $line 7 end] $local] - foreach {field value} [read_sh_file $subfile $local] { - dict set result $field $value - } - } else { - set eq [string first "=" $line] - if {$eq > 0} { - set field [read_sh_subst [string range $line 0 [expr {$eq - 1}]] $local] - set value [string trim [string range $line [expr {$eq+1}] end] '] - #set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local] - dict set local $field $value - dict set result $field $value - } - } - } err opts - if {[dict get $opts -code] != 0} { - #puts $opts - puts "Error reading line:\n$line\nerr: $err\n***" - return $err {*}$opts - } - } - return $result -} - -### -# A simpler form of read_sh_file tailored -# to pulling data from (tcl|tk)Config.sh -### -proc ::practcl::read_Config.sh filename { - set fin [open $filename r] - set result {} - set linecount 0 - while {[gets $fin line] >= 0} { - set line [string trim $line] - if {[string index $line 0] eq "#"} continue - if {$line eq {}} continue - catch { - set eq [string first "=" $line] - if {$eq > 0} { - set field [string range $line 0 [expr {$eq - 1}]] - set value [string trim [string range $line [expr {$eq+1}] end] '] - #set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local] - dict set result $field $value - incr $linecount - } - } err opts - if {[dict get $opts -code] != 0} { - #puts $opts - puts "Error reading line:\n$line\nerr: $err\n***" - return $err {*}$opts - } - } - return $result -} - -### -# A simpler form of read_sh_file tailored -# to pulling data from a Makefile -### -proc ::practcl::read_Makefile filename { - set fin [open $filename r] - set result {} - while {[gets $fin line] >= 0} { - set line [string trim $line] - if {[string index $line 0] eq "#"} continue - if {$line eq {}} continue - catch { - set eq [string first "=" $line] - if {$eq > 0} { - set field [string trim [string range $line 0 [expr {$eq - 1}]]] - set value [string trim [string trim [string range $line [expr {$eq+1}] end] ']] - switch $field { - PKG_LIB_FILE { - dict set result libfile $value - } - srcdir { - if {$value eq "."} { - dict set result srcdir [file dirname $filename] - } else { - dict set result srcdir $value - } - } - PACKAGE_NAME { - dict set result name $value - } - PACKAGE_VERSION { - dict set result version $value - } - LIBS { - dict set result PRACTCL_LIBS $value - } - PKG_LIB_FILE { - dict set result libfile $value - } - } - } - } err opts - if {[dict get $opts -code] != 0} { - #puts $opts - puts "Error reading line:\n$line\nerr: $err\n***" - return $err {*}$opts - } - # the Compile field is about where most TEA files start getting silly - if {$field eq "compile"} { - break - } - } - return $result -} - -## Append arguments to a buffer -# The command works like puts in that each call will also insert -# a line feed. Unlike puts, blank links in the interstitial are -# suppressed -proc ::practcl::cputs {varname args} { - upvar 1 $varname buffer - if {[llength $args]==1 && [string length [string trim [lindex $args 0]]] == 0} { - - } - if {[info exist buffer]} { - if {[string index $buffer end] ne "\n"} { - append buffer \n - } - } else { - set buffer \n - } - # Trim leading \n's - append buffer [string trimleft [lindex $args 0] \n] {*}[lrange $args 1 end] -} - - -proc ::practcl::tcl_to_c {body} { - set result {} - foreach rawline [split $body \n] { - set line [string map [list \" \\\" \\ \\\\] $rawline] - cputs result "\n \"$line\\n\" \\" - } - return [string trimright $result \\] -} - - -proc ::practcl::_tagblock {text {style tcl} {note {}}} { - if {[string length [string trim $text]]==0} { - return {} - } - set output {} - switch $style { - tcl { - ::practcl::cputs output "# BEGIN $note" - } - c { - ::practcl::cputs output "/* BEGIN $note */" - } - default { - ::practcl::cputs output "# BEGIN $note" - } - } - ::practcl::cputs output $text - switch $style { - tcl { - ::practcl::cputs output "# END $note" - } - c { - ::practcl::cputs output "/* END $note */" - } - default { - ::practcl::cputs output "# END $note" - } - } - return $output -} - -proc ::practcl::_isdirectory name { - return [file isdirectory $name] -} - -### -# Return true if the pkgindex file contains -# any statement other than "package ifneeded" -# and/or if any package ifneeded loads a DLL -### -proc ::practcl::_pkgindex_directory {path} { - set buffer {} - set pkgidxfile [file join $path pkgIndex.tcl] - if {![file exists $pkgidxfile]} { - # No pkgIndex file, read the source - foreach file [glob -nocomplain $path/*.tm] { - set file [file normalize $file] - set fname [file rootname [file tail $file]] - ### - # We used to be able to ... Assume the package is correct in the filename - # No hunt for a "package provides" - ### - set package [lindex [split $fname -] 0] - set version [lindex [split $fname -] 1] - ### - # Read the file, and override assumptions as needed - ### - set fin [open $file r] - set dat [read $fin] - close $fin - # Look for a teapot style Package statement - foreach line [split $dat \n] { - set line [string trim $line] - if { [string range $line 0 9] != "# Package " } continue - set package [lindex $line 2] - set version [lindex $line 3] - break - } - # Look for a package provide statement - foreach line [split $dat \n] { - set line [string trim $line] - if { [string range $line 0 14] != "package provide" } continue - set package [lindex $line 2] - set version [lindex $line 3] - break - } - append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n - } - foreach file [glob -nocomplain $path/*.tcl] { - if { [file tail $file] == "version_info.tcl" } continue - set fin [open $file r] - set dat [read $fin] - close $fin - if {![regexp "package provide" $dat]} continue - set fname [file rootname [file tail $file]] - # Look for a package provide statement - foreach line [split $dat \n] { - set line [string trim $line] - if { [string range $line 0 14] != "package provide" } continue - set package [lindex $line 2] - set version [lindex $line 3] - if {[string index $package 0] in "\$ \["} continue - if {[string index $version 0] in "\$ \["} continue - append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n - break - } - } - return $buffer - } - set fin [open $pkgidxfile r] - set dat [read $fin] - close $fin - set thisline {} - foreach line [split $dat \n] { - append thisline $line \n - if {![info complete $thisline]} continue - set line [string trim $line] - if {[string length $line]==0} { - set thisline {} ; continue - } - if {[string index $line 0] eq "#"} { - set thisline {} ; continue - } - try { - # Ignore contditionals - if {[regexp "if.*catch.*package.*Tcl.*return" $thisline]} continue - if {[regexp "if.*package.*vsatisfies.*package.*provide.*return" $thisline]} continue - if {![regexp "package.*ifneeded" $thisline]} { - # This package index contains arbitrary code - # source instead of trying to add it to the master - # package index - return {source [file join $dir pkgIndex.tcl]} - } - append buffer $thisline \n - } on error {err opts} { - puts *** - puts "GOOF: $pkgidxfile" - puts $line - puts $err - puts [dict get $opts -errorinfo] - puts *** - } finally { - set thisline {} - } - } - return $buffer -} - - -proc ::practcl::_pkgindex_path_subdir {path} { - set result {} - foreach subpath [glob -nocomplain [file join $path *]] { - if {[file isdirectory $subpath]} { - lappend result $subpath {*}[_pkgindex_path_subdir $subpath] - } - } - return $result -} -### -# Index all paths given as though they will end up in the same -# virtual file system -### -proc ::practcl::pkgindex_path args { - set stack {} - set buffer { -lappend ::PATHSTACK $dir - } - foreach base $args { - set base [file normalize $base] - set paths [::practcl::_pkgindex_path_subdir $base] - set i [string length $base] - # Build a list of all of the paths - foreach path $paths { - if {$path eq $base} continue - set path_indexed($path) 0 - } - set path_indexed($base) 1 - set path_indexed([file join $base boot tcl]) 1 - #set path_index([file join $base boot tk]) 1 - - foreach path $paths { - if {$path_indexed($path)} continue - set thisdir [file_relative $base $path] - #set thisdir [string range $path $i+1 end] - set idxbuf [::practcl::_pkgindex_directory $path] - if {[string length $idxbuf]} { - incr path_indexed($path) - append buffer "set dir \[set PKGDIR \[file join \[lindex \$::PATHSTACK end\] $thisdir\]\]" \n - append buffer [string map {$dir $PKGDIR} [string trimright $idxbuf]] \n - } - } - } - append buffer { -set dir [lindex $::PATHSTACK end] -set ::PATHSTACK [lrange $::PATHSTACK 0 end-1] -} - return $buffer -} - -### -# topic: 64319f4600fb63c82b2258d908f9d066 -# description: Script to build the VFS file system -### -proc ::practcl::installDir {d1 d2} { - - puts [format {%*sCreating %s} [expr {4 * [info level]}] {} [file tail $d2]] - file delete -force -- $d2 - file mkdir $d2 - - foreach ftail [glob -directory $d1 -nocomplain -tails *] { - set f [file join $d1 $ftail] - if {[file isdirectory $f] && [string compare CVS $ftail]} { - installDir $f [file join $d2 $ftail] - } elseif {[file isfile $f]} { - file copy -force $f [file join $d2 $ftail] - if {$::tcl_platform(platform) eq {unix}} { - file attributes [file join $d2 $ftail] -permissions 0644 - } else { - file attributes [file join $d2 $ftail] -readonly 1 - } - } - } - - if {$::tcl_platform(platform) eq {unix}} { - file attributes $d2 -permissions 0755 - } else { - file attributes $d2 -readonly 1 - } -} - -proc ::practcl::copyDir {d1 d2} { - #puts [list $d1 -> $d2] - #file delete -force -- $d2 - file mkdir $d2 - - foreach ftail [glob -directory $d1 -nocomplain -tails *] { - set f [file join $d1 $ftail] - if {[file isdirectory $f] && [string compare CVS $ftail]} { - copyDir $f [file join $d2 $ftail] - } elseif {[file isfile $f]} { - file copy -force $f [file join $d2 $ftail] - } - } -} - -::oo::class create ::practcl::metaclass { - superclass ::oo::object - - method script script { - eval $script - } - - method source filename { - source $filename - } - - method initialize {} {} - - method define {submethod args} { - my variable define - switch $submethod { - dump { - return [array get define] - } - add { - set field [lindex $args 0] - if {![info exists define($field)]} { - set define($field) {} - } - foreach arg [lrange $args 1 end] { - if {$arg ni $define($field)} { - lappend define($field) $arg - } - } - return $define($field) - } - remove { - set field [lindex $args 0] - if {![info exists define($field)]} { - return - } - set rlist [lrange $args 1 end] - set olist $define($field) - set nlist {} - foreach arg $olist { - if {$arg in $rlist} continue - lappend nlist $arg - } - set define($field) $nlist - return $nlist - } - exists { - set field [lindex $args 0] - return [info exists define($field)] - } - getnull - - get - - cget { - set field [lindex $args 0] - if {[info exists define($field)]} { - return $define($field) - } - return [lindex $args 1] - } - set { - if {[llength $args]==1} { - set arglist [lindex $args 0] - } else { - set arglist $args - } - array set define $arglist - if {[dict exists $arglist class]} { - my select - } - } - default { - array $submethod define {*}$args - } - } - } - - method graft args { - my variable organs - if {[llength $args] == 1} { - error "Need two arguments" - } - set object {} - foreach {stub object} $args { - dict set organs $stub $object - oo::objdefine [self] forward <${stub}> $object - oo::objdefine [self] export <${stub}> - } - return $object - } - - method organ {{stub all}} { - my variable organs - if {![info exists organs]} { - return {} - } - if { $stub eq "all" } { - return $organs - } - if {[dict exists $organs $stub]} { - return [dict get $organs $stub] - } - } - - method link {command args} { - my variable links - switch $command { - object { - foreach obj $args { - foreach linktype [$obj linktype] { - my link add $linktype $obj - } - } - } - add { - ### - # Add a link to an object that was externally created - ### - if {[llength $args] ne 2} { error "Usage: link add LINKTYPE OBJECT"} - lassign $args linktype object - if {[info exists links($linktype)] && $object in $links($linktype)} { - return - } - lappend links($linktype) $object - } - remove { - set object [lindex $args 0] - if {[llength $args]==1} { - set ltype * - } else { - set ltype [lindex $args 1] - } - foreach {linktype elements} [array get links $ltype] { - if {$object in $elements} { - set nlist {} - foreach e $elements { - if { $object ne $e } { lappend nlist $e } - } - set links($linktype) $nlist - } - } - } - list { - if {[llength $args]==0} { - return [array get links] - } - if {[llength $args] != 1} { error "Usage: link list LINKTYPE"} - set linktype [lindex $args 0] - if {![info exists links($linktype)]} { - return {} - } - return $links($linktype) - } - dump { - return [array get links] - } - } - } - - method select {} { - my variable define - set class {} - if {[info exists define(class)]} { - if {[info command $define(class)] ne {}} { - set class $define(class) - } elseif {[info command ::practcl::$define(class)] ne {}} { - set class ::practcl::$define(class) - } else { - switch $define(class) { - default { - set class ::practcl::object - } - } - } - } - if {$class ne {}} { - ::oo::objdefine [self] class $class - } - if {[::info exists define(oodefine)]} { - ::oo::objdefine [self] $define(oodefine) - unset define(oodefine) - } - } -} - -proc ::practcl::trigger {args} { - foreach name $args { - if {[dict exists $::make_objects $name]} { - [dict get $::make_objects $name] triggers - } - } -} - -proc ::practcl::depends {args} { - foreach name $args { - if {[dict exists $::make_objects $name]} { - [dict get $::make_objects $name] check - } - } -} - -proc ::practcl::target {name info} { - set obj [::practcl::target_obj new $name $info] - dict set ::make_objects $name $obj - if {[dict exists $info aliases]} { - foreach item [dict get $info aliases] { - if {![dict exists $::make_objects $item]} { - dict set ::make_objects $item $obj - } - } - } - set ::make($name) 0 - set ::trigger($name) 0 - set filename [$obj define get filename] - if {$filename ne {}} { - set ::target($name) $filename - } -} - -### Batch Tasks - -namespace eval ::practcl::build {} - -## method DEFS -# This method populates 4 variables: -# name - The name of the package -# version - The version of the package -# defs - C flags passed to the compiler -# includedir - A list of paths to feed to the compiler for finding headers -# -proc ::practcl::build::DEFS {PROJECT DEFS namevar versionvar defsvar} { - upvar 1 $namevar name $versionvar version NAME NAME $defsvar defs - set name [string tolower [${PROJECT} define get name [${PROJECT} define get pkg_name]]] - set NAME [string toupper $name] - set version [${PROJECT} define get version [${PROJECT} define get pkg_vers]] - if {$version eq {}} { - set version 0.1a - } - set defs {} - append defs " -DPACKAGE_NAME=\"${name}\" -DPACKAGE_VERSION=\"${version}\"" - append defs " -DPACKAGE_TARNAME=\"${name}\" -DPACKAGE_STRING=\"${name}\x5c\x20${version}\"" - set NAME [string toupper $name] - set idx 0 - set count 0 - while {$idx>=0} { - set ndx [string first " -D" $DEFS $idx+1] - set item [string range $DEFS $idx $ndx] - set item [string trim $item] - set item [string trimleft $item -D] - if {[string range $item 0 7] eq "PACKAGE_"} { - set idx $ndx - continue - } - set eqidx [string first = $item ] - if {$eqidx < 0} { - append defs { } $item - set idx $ndx - continue - } - - set field [string range $item 0 [expr {$eqidx-1}]] - set value [string range $item [expr {$eqidx+1}] end] - set emap {} - # On Windows we need to do some munging of escape characters - if {[practcl::os]=="windows"} { - lappend emap \x5c \x5c\x5c \x20 \x5c\x20 \x22 \x5c\x22 \x28 \x5c\x28 \x29 \x5c\x29 - if {[string is integer -strict $value]} { - append defs " -D${field}=$value" - } else { - append defs " -D${field}=[string map $emap $value]" - } - } else { - append defs " -D${field}=$value" - } - set idx $ndx - } - return $defs -} - -proc ::practcl::build::tclkit_main {PROJECT PKG_OBJS} { - ### - # Build static package list - ### - set statpkglist {} - dict set statpkglist Tk {autoload 0} - puts [list TCLKIT MAIN $PROJECT] - - foreach {ofile info} [${PROJECT} compile-products] { - puts [list * PROD $ofile $info] - if {![dict exists $info object]} continue - set cobj [dict get $info object] - foreach {pkg info} [$cobj static-packages] { - dict set statpkglist $pkg $info - } - } - foreach cobj [list {*}${PKG_OBJS} $PROJECT] { - puts [list * PROG $cobj] - foreach {pkg info} [$cobj static-packages] { - puts [list * PKG $pkg $info] - dict set statpkglist $pkg $info - } - } - - set result {} - $PROJECT include {} - $PROJECT include {"tclInt.h"} - $PROJECT include {"tclFileSystem.h"} - $PROJECT include {} - $PROJECT include {} - $PROJECT include {} - $PROJECT include {} - $PROJECT include {} - - $PROJECT code header { -#ifndef MODULE_SCOPE -# define MODULE_SCOPE extern -#endif - -/* -** Provide a dummy Tcl_InitStubs if we are using this as a static -** library. -*/ -#ifndef USE_TCL_STUBS -# undef Tcl_InitStubs -# define Tcl_InitStubs(a,b,c) TCL_VERSION -#endif -#define STATIC_BUILD 1 -#undef USE_TCL_STUBS - -/* Make sure the stubbed variants of those are never used. */ -#undef Tcl_ObjSetVar2 -#undef Tcl_NewStringObj -#undef Tk_Init -#undef Tk_MainEx -#undef Tk_SafeInit -} - - # Build an area of the file for #define directives and - # function declarations - set define {} - set mainhook [$PROJECT define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] - set mainfunc [$PROJECT define get TCL_LOCAL_APPINIT Tclkit_AppInit] - set mainscript [$PROJECT define get main.tcl main.tcl] - set vfsroot [$PROJECT define get vfsroot zipfs:/app] - set vfs_main "${vfsroot}/${mainscript}" - set vfs_tcl_library "${vfsroot}/boot/tcl" - set vfs_tk_library "${vfsroot}/boot/tk" - - set map {} - foreach var { - vfsroot mainhook mainfunc vfs_main vfs_tcl_library vfs_tk_library - } { - dict set map %${var}% [set $var] - } - set preinitscript { -set ::odie(boot_vfs) {%vfsroot%} -set ::SRCDIR {%vfsroot%} -if {[file exists {%vfs_tcl_library%}]} { - set ::tcl_library {%vfs_tcl_library%} - set ::auto_path {} -} -if {[file exists {%vfs_tk_library%}]} { - set ::tk_library {%vfs_tk_library%} -} -} ; # Preinitscript - - set zvfsboot { -/* - * %mainhook% -- - * Performs the argument munging for the shell - */ - } - ::practcl::cputs zvfsboot { - CONST char *archive; - Tcl_FindExecutable(*argv[0]); - archive=Tcl_GetNameOfExecutable(); -} - if {![$PROJECT define get CORE_ZIPFS 0]} { - ::practcl::cputs zvfsboot { - /* - ** We have to initialize the virtual filesystem before calling - ** Tcl_Init(). Otherwise, Tcl_Init() will not be able to find - ** its startup script files. - */ - Tclzipfs_Init(NULL); -} - $PROJECT include {"tclZipfs.h"} - } - - ::practcl::cputs zvfsboot " if(!TclZipfsMount(NULL, archive, \"%vfsroot%\", NULL)) \x7B " - ::practcl::cputs zvfsboot { - Tcl_Obj *vfsinitscript; - vfsinitscript=Tcl_NewStringObj("%vfs_main%",-1); - Tcl_IncrRefCount(vfsinitscript); - if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { - /* Startup script should be set before calling Tcl_AppInit */ - Tcl_SetStartupScript(vfsinitscript,NULL); - } - } - ::practcl::cputs zvfsboot " TclSetPreInitScript([::practcl::tcl_to_c $preinitscript])\;" - ::practcl::cputs zvfsboot " \x7D else \x7B" - ::practcl::cputs zvfsboot " TclSetPreInitScript([::practcl::tcl_to_c { -foreach path { - ../tcl -} { - set p [file join $path library init.tcl] - if {[file exists [file join $path library init.tcl]]} { - set ::tcl_library [file normalize [file join $path library]] - break - } -} -foreach path { - ../tk -} { - if {[file exists [file join $path library tk.tcl]]} { - set ::tk_library [file normalize [file join $path library]] - break - } -} -}])\;" - - ::practcl::cputs zvfsboot " \x7D" - - ::practcl::cputs zvfsboot " return TCL_OK;" - - if {[$PROJECT define get os] eq "windows"} { - set header {int %mainhook%(int *argc, TCHAR ***argv)} - } else { - set header {int %mainhook%(int *argc, char ***argv)} - } - $PROJECT c_function [string map $map $header] [string map $map $zvfsboot] - - practcl::cputs appinit "int %mainfunc%(Tcl_Interp *interp) \x7B" - - # Build AppInit() - set appinit {} - practcl::cputs appinit { - if ((Tcl_Init)(interp) == TCL_ERROR) { - return TCL_ERROR; - } -} - set main_init_script {} - - foreach {statpkg info} $statpkglist { - set initfunc {} - if {[dict exists $info initfunc]} { - set initfunc [dict get $info initfunc] - } - if {$initfunc eq {}} { - set initfunc [string totitle ${statpkg}]_Init - } - # We employ a NULL to prevent the package system from thinking the - # package is actually loaded into the interpreter - $PROJECT code header "extern Tcl_PackageInitProc $initfunc\;\n" - set script [list package ifneeded $statpkg [dict get $info version] [list ::load {} $statpkg]] - append main_init_script \n [list set ::kitpkg(${statpkg}) $script] - if {[dict get $info autoload]} { - ::practcl::cputs appinit " if(${initfunc}(interp)) return TCL_ERROR\;" - ::practcl::cputs appinit " Tcl_StaticPackage(interp,\"$statpkg\",$initfunc,NULL)\;" - } else { - ::practcl::cputs appinit "\n Tcl_StaticPackage(NULL,\"$statpkg\",$initfunc,NULL)\;" - append main_init_script \n $script - } - } - append main_init_script \n { -if {[file exists [file join $::SRCDIR packages.tcl]]} { - #In a wrapped exe, we don't go out to the environment - set dir $::SRCDIR - source [file join $::SRCDIR packages.tcl] -} -# Specify a user-specific startup file to invoke if the application -# is run interactively. Typically the startup file is "~/.apprc" -# where "app" is the name of the application. If this line is deleted -# then no user-specific startup file will be run under any conditions. - } - append main_init_script \n [list set tcl_rcFileName [$PROJECT define get tcl_rcFileName ~/.tclshrc]] - practcl::cputs appinit " Tcl_Eval(interp,[::practcl::tcl_to_c $main_init_script]);" - practcl::cputs appinit { return TCL_OK;} - $PROJECT c_function [string map $map "int %mainfunc%(Tcl_Interp *interp)"] [string map $map $appinit] -} - -proc ::practcl::build::compile-sources {PROJECT COMPILE {CPPCOMPILE {}}} { - set EXTERN_OBJS {} - set OBJECTS {} - set result {} - set builddir [$PROJECT define get builddir] - file mkdir [file join $builddir objs] - set debug [$PROJECT define get debug 0] - if {$CPPCOMPILE eq {}} { - set CPPCOMPILE $COMPILE - } - set task [${PROJECT} compile-products] - ### - # Compile the C sources - ### - foreach {ofile info} $task { - dict set task $ofile done 0 - if {[dict exists $info external] && [dict get $info external]==1} { - dict set task $ofile external 1 - } else { - dict set task $ofile external 0 - } - if {[dict exists $info library]} { - dict set task $ofile done 1 - continue - } - # Products with no cfile aren't compiled - if {![dict exists $info cfile] || [set cfile [dict get $info cfile]] eq {}} { - dict set task $ofile done 1 - continue - } - set cfile [dict get $info cfile] - set ofilename [file join $builddir objs [file tail $ofile]] - if {$debug} { - set ofilename [file join $builddir objs [file rootname [file tail $ofile]].debug.o] - } - dict set task $ofile filename $ofilename - if {[file exists $ofilename] && [file mtime $ofilename]>[file mtime $cfile]} { - lappend result $ofilename - dict set task $ofile done 1 - continue - } - if {![dict exist $info command]} { - if {[file extension $cfile] in {.c++ .cpp}} { - set cmd $CPPCOMPILE - } else { - set cmd $COMPILE - } - if {[dict exists $info extra]} { - append cmd " [dict get $info extra]" - } - append cmd " -c $cfile" - append cmd " -o $ofilename" - dict set task $ofile command $cmd - } - } - set completed 0 - while {$completed==0} { - set completed 1 - foreach {ofile info} $task { - set waiting {} - if {[dict exists $info done] && [dict get $info done]} continue - if {[dict exists $info depend]} { - foreach file [dict get $info depend] { - if {[dict exists $task $file command] && [dict exists $task $file done] && [dict get $task $file done] != 1} { - set waiting $file - break - } - } - } - if {$waiting ne {}} { - set completed 0 - puts "$ofile waiting for $waiting" - continue - } - if {[dict exists $info command]} { - set cmd [dict get $info command] - puts "$cmd" - exec {*}$cmd >&@ stdout - } - lappend result [dict get $info filename] - dict set task $ofile done 1 - } - } - return $result -} - -proc ::practcl::de_shell {data} { - set values {} - foreach flag {DEFS TCL_DEFS TK_DEFS} { - if {[dict exists $data $flag]} { - set value {} - foreach item [dict get $data $flag] { - append value " " [string map {{ } {\ }} $item] - } - dict set values $flag $value - } - } - set map {} - lappend map {${PKG_OBJECTS}} %LIBRARY_OBJECTS% - lappend map {$(PKG_OBJECTS)} %LIBRARY_OBJECTS% - lappend map {${PKG_STUB_OBJECTS}} %LIBRARY_STUB_OBJECTS% - lappend map {$(PKG_STUB_OBJECTS)} %LIBRARY_STUB_OBJECTS% - - lappend map %LIBRARY_NAME% [dict get $data name] - lappend map %LIBRARY_VERSION% [dict get $data version] - lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} [dict get $data version]] - if {[dict exists $data libprefix]} { - lappend map %LIBRARY_PREFIX% [dict get $data libprefix] - } else { - lappend map %LIBRARY_PREFIX% [dict get $data prefix] - } - foreach flag [dict keys $data] { - if {$flag in {TCL_DEFS TK_DEFS DEFS}} continue - - dict set map "%${flag}%" [dict get $data $flag] - dict set map "\$\{${flag}\}" [dict get $data $flag] - dict set map "\$\(${flag}\)" [dict get $data $flag] - dict set values $flag [dict get $data $flag] - #dict set map "\$\{${flag}\}" $proj($flag) - } - set changed 1 - while {$changed} { - set changed 0 - foreach {field value} $values { - if {$field in {TCL_DEFS TK_DEFS DEFS}} continue - dict with values {} - set newval [string map $map $value] - if {$newval eq $value} continue - set changed 1 - dict set values $field $newval - } - } - return $values -} - -proc ::practcl::build::Makefile {path PROJECT} { - array set proj [$PROJECT define dump] - set path $proj(builddir) - cd $path - set includedir . - #lappend includedir [::practcl::file_relative $path $proj(TCL_INCLUDES)] - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TCL_SRC_DIR) generic]]] - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(srcdir) generic]]] - foreach include [$PROJECT generate-include-directory] { - set cpath [::practcl::file_relative $path [file normalize $include]] - if {$cpath ni $includedir} { - lappend includedir $cpath - } - } - set INCLUDES "-I[join $includedir " -I"]" - set NAME [string toupper $proj(name)] - set result {} - set products {} - set libraries {} - set thisline {} - ::practcl::cputs result "${NAME}_DEFS = $proj(DEFS)\n" - ::practcl::cputs result "${NAME}_INCLUDES = -I\"[join $includedir "\" -I\""]\"\n" - ::practcl::cputs result "${NAME}_COMPILE = \$(CC) \$(CFLAGS) \$(PKG_CFLAGS) \$(${NAME}_DEFS) \$(${NAME}_INCLUDES) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS) \$(AM_CFLAGS)" - ::practcl::cputs result "${NAME}_CPPCOMPILE = \$(CXX) \$(CFLAGS) \$(PKG_CFLAGS) \$(${NAME}_DEFS) \$(${NAME}_INCLUDES) \$(INCLUDES) \$(AM_CPPFLAGS) \$(CPPFLAGS) \$(AM_CFLAGS)" - - foreach {ofile info} [$PROJECT compile-products] { - dict set products $ofile $info - if {[dict exists $info library]} { -lappend libraries $ofile -continue - } - if {[dict exists $info depend]} { - ::practcl::cputs result "\n${ofile}: [dict get $info depend]" - } else { - ::practcl::cputs result "\n${ofile}:" - } - set cfile [dict get $info cfile] - if {[file extension $cfile] in {.c++ .cpp}} { - set cmd "\t\$\(${NAME}_CPPCOMPILE\)" - } else { - set cmd "\t\$\(${NAME}_COMPILE\)" - } - if {[dict exists $info extra]} { - append cmd " [dict get $info extra]" - } - append cmd " -c [dict get $info cfile] -o \$@\n\t" - ::practcl::cputs result $cmd - } - - set map {} - lappend map %LIBRARY_NAME% $proj(name) - lappend map %LIBRARY_VERSION% $proj(version) - lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} $proj(version)] - lappend map %LIBRARY_PREFIX% [$PROJECT define getnull libprefix] - - if {[string is true [$PROJECT define get SHARED_BUILD]]} { - set outfile [$PROJECT define get libfile] - } else { - set outfile [$PROJECT shared_library] - } - $PROJECT define set shared_library $outfile - ::practcl::cputs result " -${NAME}_SHLIB = $outfile -${NAME}_OBJS = [dict keys $products] -" - - #lappend map %OUTFILE% {\[$]@} - lappend map %OUTFILE% $outfile - lappend map %LIBRARY_OBJECTS% "\$(${NAME}_OBJS)" - ::practcl::cputs result "$outfile: \$(${NAME}_OBJS)" - ::practcl::cputs result "\t[string map $map [$PROJECT define get PRACTCL_SHARED_LIB]]" - if {[$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL] ni {: {}}} { - ::practcl::cputs result "\t[string map $map [$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL]]" - } - ::practcl::cputs result {} - if {[string is true [$PROJECT define get SHARED_BUILD]]} { - #set outfile [$PROJECT static_library] - set outfile $proj(name).a - } else { - set outfile [$PROJECT define get libfile] - } - $PROJECT define set static_library $outfile - dict set map %OUTFILE% $outfile - ::practcl::cputs result "$outfile: \$(${NAME}_OBJS)" - ::practcl::cputs result "\t[string map $map [$PROJECT define get PRACTCL_STATIC_LIB]]" - ::practcl::cputs result {} - return $result -} - -### -# Produce a dynamic library -### -proc ::practcl::build::library {outfile PROJECT} { - array set proj [$PROJECT define dump] - set path $proj(builddir) - cd $path - set includedir . - #lappend includedir [::practcl::file_relative $path $proj(TCL_INCLUDES)] - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TCL_SRC_DIR) generic]]] - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(srcdir) generic]]] - if {[$PROJECT define get tk 0]} { - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TK_SRC_DIR) generic]]] - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TK_SRC_DIR) ttk]]] - lappend includedir [::practcl::file_relative $path [file normalize [file join $proj(TK_SRC_DIR) xlib]]] - lappend includedir [::practcl::file_relative $path [file normalize $proj(TK_BIN_DIR)]] - } - foreach include [$PROJECT generate-include-directory] { - set cpath [::practcl::file_relative $path [file normalize $include]] - if {$cpath ni $includedir} { - lappend includedir $cpath - } - } - ::practcl::build::DEFS $PROJECT $proj(DEFS) name version defs - set NAME [string toupper $name] - set debug [$PROJECT define get debug 0] - set os [$PROJECT define get os] - - set INCLUDES "-I[join $includedir " -I"]" - if {$debug} { - set COMPILE "$proj(CC) $proj(CFLAGS_DEBUG) -ggdb \ -$proj(CFLAGS_WARNING) $INCLUDES $defs" - - if {[info exists proc(CXX)]} { - set COMPILECPP "$proj(CXX) $defs $INCLUDES $proj(CFLAGS_DEBUG) -ggdb \ - $proj(DEFS) $proj(CFLAGS_WARNING)" - } else { - set COMPILECPP $COMPILE - } - } else { - set COMPILE "$proj(CC) $proj(CFLAGS) $defs $INCLUDES " - - if {[info exists proc(CXX)]} { - set COMPILECPP "$proj(CXX) $defs $INCLUDES $proj(CFLAGS) $proj(DEFS)" - } else { - set COMPILECPP $COMPILE - } - } - - set products [compile-sources $PROJECT $COMPILE $COMPILECPP] - - set map {} - lappend map %LIBRARY_NAME% $proj(name) - lappend map %LIBRARY_VERSION% $proj(version) - lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} $proj(version)] - lappend map %OUTFILE% $outfile - lappend map %LIBRARY_OBJECTS% $products - lappend map {${CFLAGS}} "$proj(CFLAGS_DEFAULT) $proj(CFLAGS_WARNING)" - - if {[string is true [$PROJECT define get SHARED_BUILD 1]]} { - set cmd [$PROJECT define get PRACTCL_SHARED_LIB] - append cmd " [$PROJECT define get PRACTCL_LIBS]" - set cmd [string map $map $cmd] - puts $cmd - exec {*}$cmd >&@ stdout - if {[$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL] ni {: {}}} { - set cmd [string map $map [$PROJECT define get PRACTCL_VC_MANIFEST_EMBED_DLL]] - puts $cmd - exec {*}$cmd >&@ stdout - } - } else { - set cmd [string map $map [$PROJECT define get PRACTCL_STATIC_LIB]] - puts $cmd - exec {*}$cmd >&@ stdout - } -} - -### -# Produce a static executable -### -proc ::practcl::build::static-tclsh {outfile PROJECT} { - puts " BUILDING STATIC TCLSH " - set TCLOBJ [$PROJECT project TCLCORE] - set TKOBJ [$PROJECT project TKCORE] - set ODIEOBJ [$PROJECT project odie] - - set PKG_OBJS {} - foreach item [$PROJECT link list package] { - if {[string is true [$item define get static]]} { - lappend PKG_OBJS $item - } - } - array set TCL [$TCLOBJ config.sh] - array set TK [$TKOBJ config.sh] - set path [file dirname $outfile] - cd $path - ### - # For a static Tcl shell, we need to build all local sources - # with the same DEFS flags as the tcl core was compiled with. - # The DEFS produced by a TEA extension aren't intended to operate - # with the internals of a staticly linked Tcl - ### - ::practcl::build::DEFS $PROJECT $TCL(defs) name version defs - - set debug [$PROJECT define get debug 0] - set NAME [string toupper $name] - set result {} - set libraries {} - set thisline {} - set OBJECTS {} - set EXTERN_OBJS {} - foreach obj $PKG_OBJS { - $obj compile - set config($obj) [$obj config.sh] - } - set os [$PROJECT define get os] - set TCLSRCDIR [$TCLOBJ define get srcroot] - set TKSRCDIR [$TKOBJ define get srcroot] - - set includedir . - foreach include [$TCLOBJ generate-include-directory] { - set cpath [::practcl::file_relative $path [file normalize $include]] - if {$cpath ni $includedir} { - lappend includedir $cpath - } - } - lappend includedir [::practcl::file_relative $path [file normalize ../tcl/compat/zlib]] - foreach include [$PROJECT generate-include-directory] { - set cpath [::practcl::file_relative $path [file normalize $include]] - if {$cpath ni $includedir} { - lappend includedir $cpath - } - } - - set INCLUDES "-I[join $includedir " -I"]" - if {$debug} { - set COMPILE "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_debug) -ggdb \ -$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" - } else { - set COMPILE "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_optimize) \ -$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" - } - append COMPILE " " $defs - lappend OBJECTS {*}[compile-sources $PROJECT $COMPILE $COMPILE] - - if {[${PROJECT} define get platform] eq "windows"} { - set RSOBJ [file join $path build tclkit.res.o] - set RCSRC [${PROJECT} define get kit_resource_file] - if {$RCSRC eq {} || ![file exists $RCSRC]} { - set RCSRC [file join $TKSRCDIR win rc wish.rc] - } - set cmd [list windres -o $RSOBJ -DSTATIC_BUILD] - set TCLSRC [file normalize $TCLSRCDIR] - set TKSRC [file normalize $TKSRCDIR] - - lappend cmd --include [::practcl::file_relative $path [file join $TCLSRC generic]] \ - --include [::practcl::file_relative $path [file join $TKSRC generic]] \ - --include [::practcl::file_relative $path [file join $TKSRC win]] \ - --include [::practcl::file_relative $path [file join $TKSRC win rc]] - foreach item [${PROJECT} define get resource_include] { - lappend cmd --include [::practcl::file_relative $path [file normalize $item]] - } - lappend cmd $RCSRC - doexec {*}$cmd - - lappend OBJECTS $RSOBJ - set LDFLAGS_CONSOLE {-mconsole -pipe -static-libgcc} - set LDFLAGS_WINDOW {-mwindows -pipe -static-libgcc} - } else { - set LDFLAGS_CONSOLE {} - set LDFLAGS_WINDOW {} - } - puts "***" - if {$debug} { - set cmd "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_debug) \ -$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" - } else { - set cmd "$TCL(cc) $TCL(shlib_cflags) $TCL(cflags_optimize) \ -$TCL(cflags_warning) $TCL(extra_cflags) $INCLUDES" - } - append cmd " $OBJECTS" - append cmd " $EXTERN_OBJS " - # On OSX it is impossibly to generate a completely static - # executable - if {[$PROJECT define get TEACUP_OS] ne "macosx"} { - append cmd " -static " - } - parray TCL - if {$debug} { - if {$os eq "windows"} { - append cmd " -L${TCL(src_dir)}/win -ltcl86g" - append cmd " -L${TK(src_dir)}/win -ltk86g" - } else { - append cmd " -L${TCL(src_dir)}/unix -ltcl86g" - append cmd " -L${TK(src_dir)}/unix -ltk86g" - } - } else { - append cmd " $TCL(build_lib_spec) $TK(build_lib_spec)" - } - foreach obj $PKG_OBJS { - append cmd " [$obj linker-products $config($obj)]" - } - append cmd " $TCL(libs) $TK(libs)" - foreach obj $PKG_OBJS { - append cmd " [$obj linker-external $config($obj)]" - } - if {$debug} { - if {$os eq "windows"} { - append cmd " -L${TCL(src_dir)}/win ${TCL(stub_lib_flag)}" - append cmd " -L${TK(src_dir)}/win ${TK(stub_lib_flag)}" - } else { - append cmd " -L${TCL(src_dir)}/unix ${TCL(stub_lib_flag)}" - append cmd " -L${TK(src_dir)}/unix ${TK(stub_lib_flag)}" - } - } else { - append cmd " $TCL(build_stub_lib_spec)" - append cmd " $TK(build_stub_lib_spec)" - } - append cmd " -o $outfile $LDFLAGS_CONSOLE" - puts "LINK: $cmd" - exec {*}$cmd >&@ stdout -} - -::oo::class create ::practcl::target_obj { - superclass ::practcl::metaclass - - constructor {name info} { - my variable define triggered domake - set triggered 0 - set domake 0 - set define(name) $name - set data [uplevel 2 [list subst $info]] - array set define $data - my select - my initialize - } - - method do {} { - my variable domake - return $domake - } - - method check {} { - my variable needs_make domake - if {$domake} { - return 1 - } - if {[info exists needs_make]} { - return $needs_make - } - set needs_make 0 - foreach item [my define get depends] { - if {![dict exists $::make_objects $item]} continue - set depobj [dict get $::make_objects $item] - if {$depobj eq [self]} { - puts "WARNING [self] depends on itself" - continue - } - if {[$depobj check]} { - set needs_make 1 - } - } - if {!$needs_make} { - set filename [my define get filename] - if {$filename ne {} && ![file exists $filename]} { - set needs_make 1 - } - } - return $needs_make - } - - method triggers {} { - my variable triggered domake define - if {$triggered} { - return $domake - } - set triggered 1 - foreach item [my define get depends] { - puts [list $item [dict exists $::make_objects $item]] - if {![dict exists $::make_objects $item]} continue - set depobj [dict get $::make_objects $item] - if {$depobj eq [self]} { - puts "WARNING [self] triggers itself" - continue - } else { - set r [$depobj check] - puts [list $depobj check $r] - if {$r} { - puts [list $depobj TRIGGER] - $depobj triggers - } - } - } - if {[info exists ::make($define(name))] && $::make($define(name))} { - return - } - set ::make($define(name)) 1 - ::practcl::trigger {*}[my define get triggers] - } -} - - -### -# Define the metaclass -### -::oo::class create ::practcl::object { - superclass ::practcl::metaclass - - constructor {parent args} { - my variable links define - set organs [$parent child organs] - my graft {*}$organs - array set define $organs - array set define [$parent child define] - array set links {} - if {[llength $args]==1 && [file exists [lindex $args 0]]} { - my InitializeSourceFile [lindex $args 0] - } elseif {[llength $args] == 1} { - set data [uplevel 1 [list subst [lindex $args 0]]] - array set define $data - my select - my initialize - } else { - array set define [uplevel 1 [list subst $args]] - my select - my initialize - } - } - - - method include_dir args { - my define add include_dir {*}$args - } - - method include_directory args { - my define add include_dir {*}$args - } - - method Collate_Source CWD {} - - - method child {method} { - return {} - } - - method InitializeSourceFile filename { - my define set filename $filename - set class {} - switch [file extension $filename] { - .tcl { - set class ::practcl::dynamic - } - .h { - set class ::practcl::cheader - } - .c { - set class ::practcl::csource - } - .ini { - switch [file tail $filename] { - module.ini { - set class ::practcl::module - } - library.ini { - set class ::practcl::subproject - } - } - } - .so - - .dll - - .dylib - - .a { - set class ::practcl::clibrary - } - } - if {$class ne {}} { - oo::objdefine [self] class $class - my initialize - } - } - - method add args { - my variable links - set object [::practcl::object new [self] {*}$args] - foreach linktype [$object linktype] { - lappend links($linktype) $object - } - return $object - } - - method go {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable links - foreach {linktype objs} [array get links] { - foreach obj $objs { - $obj go - } - } - debug [list /[self] [self method] [self class]] - } - - method code {section body} { - my variable code - ::practcl::cputs code($section) $body - } - - method Ofile filename { - set lpath [my define get localpath] - if {$lpath eq {}} { - set lpath [my define get name] - } - return ${lpath}_[file rootname [file tail $filename]].o - } - - method compile-products {} { - set filename [my define get filename] - set result {} - if {$filename ne {}} { - if {[my define exists ofile]} { - set ofile [my define get ofile] - } else { - set ofile [my Ofile $filename] - my define set ofile $ofile - } - lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]] object [self]] - } - foreach item [my link list subordinate] { - lappend result {*}[$item compile-products] - } - return $result - } - - method generate-include-directory {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result [my define get include_dir] - foreach obj [my link list product] { - foreach path [$obj generate-include-directory] { - lappend result $path - } - } - return $result - } - - method generate-debug {{spaces {}}} { - set result {} - ::practcl::cputs result "$spaces[list [self] [list class [info object class [self]] filename [my define get filename]] links [my link list]]" - foreach item [my link list subordinate] { - practcl::cputs result [$item generate-debug "$spaces "] - } - return $result - } - - # Empty template methods - method generate-cheader {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cfunct cstruct methods tcltype tclprocs - set result {} - if {[info exists code(header)]} { - ::practcl::cputs result $code(header) - } - foreach obj [my link list product] { - # Exclude products that will generate their own C files - if {[$obj define get output_c] ne {}} continue - ::practcl::cputs result "/* BEGIN [$obj define get filename] generate-cheader */" - ::practcl::cputs result [$obj generate-cheader] - ::practcl::cputs result "/* END [$obj define get filename] generate-cheader */" - } - debug [list cfunct [info exists cfunct]] - if {[info exists cfunct]} { - foreach {funcname info} $cfunct { - if {[dict get $info public]} continue - ::practcl::cputs result "[dict get $info header]\;" - } - } - debug [list tclprocs [info exists tclprocs]] - if {[info exists tclprocs]} { - foreach {name info} $tclprocs { - if {[dict exists $info header]} { - ::practcl::cputs result "[dict get $info header]\;" - } - } - } - debug [list methods [info exists methods] [my define get cclass]] - - if {[info exists methods]} { - set thisclass [my define get cclass] - foreach {name info} $methods { - if {[dict exists $info header]} { - ::practcl::cputs result "[dict get $info header]\;" - } - } - # Add the initializer wrapper for the class - ::practcl::cputs result "static int ${thisclass}_OO_Init(Tcl_Interp *interp)\;" - } - return $result - } - - method generate-public-define {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code - set result {} - if {[info exists code(public-define)]} { - ::practcl::cputs result $code(public-define) - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-public-define] - } - return $result - } - - method generate-public-macro {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code - set result {} - if {[info exists code(public-macro)]} { - ::practcl::cputs result $code(public-macro) - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-public-macro] - } - return $result - } - - method generate-public-typedef {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cstruct - set result {} - if {[info exists code(public-typedef)]} { - ::practcl::cputs result $code(public-typedef) - } - if {[info exists cstruct]} { - # Add defintion for native c data structures - foreach {name info} $cstruct { - ::practcl::cputs result "typedef struct $name ${name}\;" - if {[dict exists $info aliases]} { - foreach n [dict get $info aliases] { - ::practcl::cputs result "typedef struct $name ${n}\;" - } - } - } - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-public-typedef] - } - return $result - } - - method generate-public-structure {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cstruct - set result {} - if {[info exists code(public-structure)]} { - ::practcl::cputs result $code(public-structure) - } - if {[info exists cstruct]} { - foreach {name info} $cstruct { - if {[dict exists $info comment]} { - ::practcl::cputs result [dict get $info comment] - } - ::practcl::cputs result "struct $name \{[dict get $info body]\}\;" - } - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-public-structure] - } - return $result - } - method generate-public-headers {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code tcltype - set result {} - if {[info exists code(public-header)]} { - ::practcl::cputs result $code(public-header) - } - if {[info exists tcltype]} { - foreach {type info} $tcltype { - if {![dict exists $info cname]} { - set cname [string tolower ${type}]_tclobjtype - dict set tcltype $type cname $cname - } else { - set cname [dict get $info cname] - } - ::practcl::cputs result "extern const Tcl_ObjType $cname\;" - } - } - if {[info exists code(public)]} { - ::practcl::cputs result $code(public) - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-public-headers] - } - return $result - } - - method generate-stub-function {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cfunct tcltype - set result {} - foreach mod [my link list product] { - foreach {funct def} [$mod generate-stub-function] { - dict set result $funct $def - } - } - if {[info exists cfunct]} { - foreach {funcname info} $cfunct { - if {![dict get $info export]} continue - dict set result $funcname [dict get $info header] - } - } - return $result - } - - method generate-public-function {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cfunct tcltype - set result {} - - if {[my define get initfunc] ne {}} { - ::practcl::cputs result "int [my define get initfunc](Tcl_Interp *interp);" - } - if {[info exists cfunct]} { - foreach {funcname info} $cfunct { - if {![dict get $info public]} continue - ::practcl::cputs result "[dict get $info header]\;" - } - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-public-function] - } - return $result - } - - method generate-public-includes {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set includes {} - foreach item [my define get public-include] { - if {$item ni $includes} { - lappend includes $item - } - } - foreach mod [my link list product] { - foreach item [$mod generate-public-includes] { - if {$item ni $includes} { - lappend includes $item - } - } - } - return $includes - } - method generate-public-verbatim {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set includes {} - foreach item [my define get public-verbatim] { - if {$item ni $includes} { - lappend includes $item - } - } - foreach mod [my link list subordinate] { - foreach item [$mod generate-public-verbatim] { - if {$item ni $includes} { - lappend includes $item - } - } - } - return $includes - } - ### - # This methods generates the contents of an amalgamated .h file - # which describes the public API of this module - ### - method generate-h {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result {} - set includes [my generate-public-includes] - foreach inc $includes { - if {[string index $inc 0] ni {< \"}} { - ::practcl::cputs result "#include \"$inc\"" - } else { - ::practcl::cputs result "#include $inc" - } - } - foreach file [my generate-public-verbatim] { - ::practcl::cputs result "/* BEGIN $file */" - ::practcl::cputs result [::practcl::cat $file] - ::practcl::cputs result "/* END $file */" - } - foreach method { - generate-public-define - generate-public-macro - generate-public-typedef - generate-public-structure - generate-public-headers - generate-public-function - } { - ::practcl::cputs result "/* BEGIN SECTION $method */" - ::practcl::cputs result [my $method] - ::practcl::cputs result "/* END SECTION $method */" - } - return $result - } - - ### - # This methods generates the contents of an amalgamated .c file - # which implements the loader for a batch of tools - ### - method generate-c {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result { -/* This file was generated by practcl */ - } - set includes {} - lappend headers - if {[my define get tk 0]} { - lappend headers - } - lappend headers {*}[my define get include] - if {[my define get output_h] ne {}} { - lappend headers "\"[my define get output_h]\"" - } - foreach mod [my link list product] { - # Signal modules to formulate final implementation - $mod go - } - foreach mod [my link list dynamic] { - foreach inc [$mod define get include] { - if {$inc ni $headers} { - lappend headers $inc - } - } - } - foreach inc $headers { - if {[string index $inc 0] ni {< \"}} { - ::practcl::cputs result "#include \"$inc\"" - } else { - ::practcl::cputs result "#include $inc" - } - } - foreach {method} { - generate-cheader - generate-cstruct - generate-constant - generate-cfunct - generate-cmethod - } { - ::practcl::cputs result "/* BEGIN $method [my define get filename] */" - ::practcl::cputs result [my $method] - ::practcl::cputs result "/* END $method [my define get filename] */" - } - debug [list /[self] [self method] [self class] -- [my define get filename] [info object class [self]]] - return $result - } - - - method generate-loader {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result {} - if {[my define get initfunc] eq {}} return - ::practcl::cputs result " -extern int DLLEXPORT [my define get initfunc]( Tcl_Interp *interp ) \{" - ::practcl::cputs result { - /* Initialise the stubs tables. */ - #ifdef USE_TCL_STUBS - if (Tcl_InitStubs(interp, "8.6", 0)==NULL) return TCL_ERROR; - if (TclOOInitializeStubs(interp, "1.0") == NULL) return TCL_ERROR; -} - if {[my define get tk 0]} { - ::practcl::cputs result { if (Tk_InitStubs(interp, "8.6", 0)==NULL) return TCL_ERROR;} - } - ::practcl::cputs result { #endif} - set TCLINIT [my generate-tcl] - ::practcl::cputs result " if(Tcl_Eval(interp,[::practcl::tcl_to_c $TCLINIT])) return TCL_ERROR ;" - foreach item [my link list product] { - if {[$item define get output_c] ne {}} { - ::practcl::cputs result [$item generate-cinit-external] - } else { - ::practcl::cputs result [$item generate-cinit] - } - } - if {[my define exists pkg_name]} { - ::practcl::cputs result " if (Tcl_PkgProvide(interp, \"[my define get pkg_name [my define get name]]\" , \"[my define get pkg_vers [my define get version]]\" )) return TCL_ERROR\;" - } - ::practcl::cputs result " return TCL_OK\;\n\}\n" - return $result - } - - ### - # This methods generates any Tcl script file - # which is required to pre-initialize the C library - ### - method generate-tcl {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result {} - my variable code - if {[info exists code(tcl)]} { - ::practcl::cputs result $code(tcl) - } - set result [::practcl::_tagblock $result tcl [my define get filename]] - foreach mod [my link list product] { - ::practcl::cputs result [$mod generate-tcl] - } - return $result - } - - method static-packages {} { - set result [my define get static_packages] - set statpkg [my define get static_pkg] - set initfunc [my define get initfunc] - if {$initfunc ne {}} { - set pkg_name [my define get pkg_name] - if {$pkg_name ne {}} { - dict set result $pkg_name initfunc $initfunc - dict set result $pkg_name version [my define get version [my define get pkg_vers]] - dict set result $pkg_name autoload [my define get autoload 0] - } - } - foreach item [my link list subordinate] { - foreach {pkg info} [$item static-packages] { - dict set result $pkg $info - } - } - return $result - } - - method target {method args} { - switch $method { - is_unix { return [expr {$::tcl_platform(platform) eq "unix"}] } - } - } - -} - -::oo::class create ::practcl::product { - superclass ::practcl::object - - method linktype {} { - return {subordinate product} - } - - method include header { - my define add include $header - } - - method cstructure {name definition {argdat {}}} { - my variable cstruct - dict set cstruct $name body $definition - foreach {f v} $argdat { - dict set cstruct $name $f $v - } - } - - method generate-cinit {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code - set result {} - if {[info exists code(cinit)]} { - ::practcl::cputs result $code(cinit) - } - if {[my define get initfunc] ne {}} { - ::practcl::cputs result " if([my define get initfunc](interp)!=TCL_OK) return TCL_ERROR\;" - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach obj [my link list product] { - ::practcl::cputs result [$obj generate-cinit] - } - return $result - } -} - -### -# Dynamic blocks do not generate their own .c files, -# instead the contribute to the amalgamation -# of the main library file -### -::oo::class create ::practcl::dynamic { - superclass ::practcl::product - - # Retrieve any additional source files required - - method compile-products {} { - set filename [my define get output_c] - set result {} - if {$filename ne {}} { - if {[my define exists ofile]} { - set ofile [my define get ofile] - } else { - set ofile [my Ofile $filename] - my define set ofile $ofile - } - lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]]] - } else { - set filename [my define get cfile] - if {$filename ne {}} { - if {[my define exists ofile]} { - set ofile [my define get ofile] - } else { - set ofile [my Ofile $filename] - my define set ofile $ofile - } - lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]]] - } - } - foreach item [my link list subordinate] { - lappend result {*}[$item compile-products] - } - return $result - } - - method implement path { - my go - my Collate_Source $path - if {[my define get output_c] eq {}} return - set filename [file join $path [my define get output_c]] - my define set cfile $filename - set fout [open $filename w] - puts $fout [my generate-c] - puts $fout "extern int DLLEXPORT [my define get initfunc]( Tcl_Interp *interp ) \x7B" - puts $fout [my generate-cinit] - if {[my define get pkg_name] ne {}} { - puts $fout " Tcl_PkgProvide(interp, \"[my define get pkg_name]\", \"[my define get pkg_vers]\");" - } - puts $fout " return TCL_OK\;" - puts $fout "\x7D" - close $fout - } - - method initialize {} { - set filename [my define get filename] - if {$filename eq {}} { - return - } - if {[my define get name] eq {}} { - my define set name [file tail [file rootname $filename]] - } - if {[my define get localpath] eq {}} { - my define set localpath [my define get localpath]_[my define get name] - } - ::source $filename - } - - method linktype {} { - return {subordinate product dynamic} - } - - ### - # Populate const static data structures - ### - method generate-cstruct {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cstruct methods tcltype - set result {} - if {[info exists code(struct)]} { - ::practcl::cputs result $code(struct) - } - foreach obj [my link list dynamic] { - # Exclude products that will generate their own C files - if {[$obj define get output_c] ne {}} continue - ::practcl::cputs result [$obj generate-cstruct] - } - return $result - } - - method generate-constant {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result {} - my variable code cstruct methods tcltype - if {[info exists code(constant)]} { - ::practcl::cputs result "/* [my define get filename] CONSTANT */" - ::practcl::cputs result $code(constant) - } - if {[info exists cstruct]} { - foreach {name info} $cstruct { - set map {} - lappend map @NAME@ $name - lappend map @MACRO@ GET[string toupper $name] - - if {[dict exists $info deleteproc]} { - lappend map @DELETEPROC@ [dict get $info deleteproc] - } else { - lappend map @DELETEPROC@ NULL - } - if {[dict exists $info cloneproc]} { - lappend map @CLONEPROC@ [dict get $info cloneproc] - } else { - lappend map @CLONEPROC@ NULL - } - ::practcl::cputs result [string map $map { -const static Tcl_ObjectMetadataType @NAME@DataType = { - TCL_OO_METADATA_VERSION_CURRENT, - "@NAME@", - @DELETEPROC@, - @CLONEPROC@ -}; -#define @MACRO@(OBJCONTEXT) (@NAME@ *) Tcl_ObjectGetMetadata(OBJCONTEXT,&@NAME@DataType) -}] - } - } - if {[info exists tcltype]} { - foreach {type info} $tcltype { - dict with info {} - ::practcl::cputs result "const Tcl_ObjType $cname = \{\n .freeIntRepProc = &${freeproc},\n .dupIntRepProc = &${dupproc},\n .updateStringProc = &${updatestringproc},\n .setFromAnyProc = &${setfromanyproc}\n\}\;" - } - } - - if {[info exists methods]} { - set mtypes {} - foreach {name info} $methods { - set callproc [dict get $info callproc] - set methodtype [dict get $info methodtype] - if {$methodtype in $mtypes} continue - lappend mtypes $methodtype - ### - # Build the data struct for this method - ### - ::practcl::cputs result "const static Tcl_MethodType $methodtype = \{" - ::practcl::cputs result " .version = TCL_OO_METADATA_VERSION_CURRENT,\n .name = \"$name\",\n .callProc = $callproc," - if {[dict exists $info deleteproc]} { - set deleteproc [dict get $info deleteproc] - } else { - set deleteproc NULL - } - if {$deleteproc ni { {} NULL }} { - ::practcl::cputs result " .deleteProc = $deleteproc," - } else { - ::practcl::cputs result " .deleteProc = NULL," - } - if {[dict exists $info cloneproc]} { - set cloneproc [dict get $info cloneproc] - } else { - set cloneproc NULL - } - if {$cloneproc ni { {} NULL }} { - ::practcl::cputs result " .cloneProc = $cloneproc\n\}\;" - } else { - ::practcl::cputs result " .cloneProc = NULL\n\}\;" - } - dict set methods $name methodtype $methodtype - } - } - foreach obj [my link list dynamic] { - # Exclude products that will generate their own C files - if {[$obj define get output_c] ne {}} continue - ::practcl::cputs result [$obj generate-constant] - } - return $result - } - - ### - # Generate code that provides subroutines called by - # Tcl API methods - ### - method generate-cfunct {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code cfunct - set result {} - if {[info exists code(funct)]} { - ::practcl::cputs result $code(funct) - } - if {[info exists cfunct]} { - foreach {funcname info} $cfunct { - ::practcl::cputs result "[dict get $info header]\{[dict get $info body]\}\;" - } - } - foreach obj [my link list dynamic] { - # Exclude products that will generate their own C files - if {[$obj define get output_c] ne {}} { - continue - } - ::practcl::cputs result [$obj generate-cfunct] - } - return $result - } - - ### - # Generate code that provides implements Tcl API - # calls - ### - method generate-cmethod {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - my variable code methods tclprocs - set result {} - if {[info exists code(method)]} { - ::practcl::cputs result $code(method) - } - - if {[info exists tclprocs]} { - foreach {name info} $tclprocs { - if {![dict exists $info body]} continue - set callproc [dict get $info callproc] - set header [dict get $info header] - set body [dict get $info body] - ::practcl::cputs result "${header} \{${body}\}" - } - } - - - if {[info exists methods]} { - set thisclass [my define get cclass] - foreach {name info} $methods { - if {![dict exists $info body]} continue - set callproc [dict get $info callproc] - set header [dict get $info header] - set body [dict get $info body] - ::practcl::cputs result "${header} \{${body}\}" - } - # Build the OO_Init function - ::practcl::cputs result "static int ${thisclass}_OO_Init(Tcl_Interp *interp) \{" - ::practcl::cputs result [string map [list @CCLASS@ $thisclass @TCLCLASS@ [my define get class]] { - /* - ** Build the "@TCLCLASS@" class - */ - Tcl_Obj* nameObj; /* Name of a class or method being looked up */ - Tcl_Object curClassObject; /* Tcl_Object representing the current class */ - Tcl_Class curClass; /* Tcl_Class representing the current class */ - - /* - * Find the "@TCLCLASS@" class, and attach an 'init' method to it. - */ - - nameObj = Tcl_NewStringObj("@TCLCLASS@", -1); - Tcl_IncrRefCount(nameObj); - if ((curClassObject = Tcl_GetObjectFromObj(interp, nameObj)) == NULL) { - Tcl_DecrRefCount(nameObj); - return TCL_ERROR; - } - Tcl_DecrRefCount(nameObj); - curClass = Tcl_GetObjectAsClass(curClassObject); -}] - if {[dict exists $methods constructor]} { - set mtype [dict get $methods constructor methodtype] - ::practcl::cputs result [string map [list @MTYPE@ $mtype] { - /* Attach the constructor to the class */ - Tcl_ClassSetConstructor(interp, curClass, Tcl_NewMethod(interp, curClass, NULL, 1, &@MTYPE@, NULL)); - }] - } - foreach {name info} $methods { - dict with info {} - if {$name in {constructor destructor}} continue - ::practcl::cputs result [string map [list @NAME@ $name @MTYPE@ $methodtype] { - nameObj=Tcl_NewStringObj("@NAME@",-1); - Tcl_NewMethod(interp, curClass, nameObj, 1, &@MTYPE@, (ClientData) NULL); - Tcl_DecrRefCount(nameObj); -}] - if {[dict exists $info aliases]} { - foreach alias [dict get $info aliases] { - if {[dict exists $methods $alias]} continue - ::practcl::cputs result [string map [list @NAME@ $alias @MTYPE@ $methodtype] { - nameObj=Tcl_NewStringObj("@NAME@",-1); - Tcl_NewMethod(interp, curClass, nameObj, 1, &@MTYPE@, (ClientData) NULL); - Tcl_DecrRefCount(nameObj); -}] - } - } - } - ::practcl::cputs result " return TCL_OK\;\n\}\n" - } - foreach obj [my link list dynamic] { - # Exclude products that will generate their own C files - if {[$obj define get output_c] ne {}} continue - ::practcl::cputs result [$obj generate-cmethod] - } - return $result - } - - method generate-cinit-external {} { - if {[my define get initfunc] eq {}} { - return "/* [my define get filename] declared not initfunc */" - } - return " if([my define get initfunc](interp)) return TCL_ERROR\;" - } - - ### - # Generate code that runs when the package/module is - # initialized into the interpreter - ### - method generate-cinit {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set result {} - my variable code methods tclprocs - if {[info exists code(nspace)]} { - ::practcl::cputs result " \{\n Tcl_Namespace *modPtr;" - foreach nspace $code(nspace) { - ::practcl::cputs result [string map [list @NSPACE@ $nspace] { - modPtr=Tcl_FindNamespace(interp,"@NSPACE@",NULL,TCL_NAMESPACE_ONLY); - if(!modPtr) { - modPtr = Tcl_CreateNamespace(interp, "@NSPACE@", NULL, NULL); - } -}] - } - ::practcl::cputs result " \}" - } - if {[info exists code(tclinit)]} { - ::practcl::cputs result $code(tclinit) - } - if {[info exists code(cinit)]} { - ::practcl::cputs result $code(cinit) - } - if {[info exists code(initfuncts)]} { - foreach func $code(initfuncts) { - ::practcl::cputs result " if (${func}(interp) != TCL_OK) return TCL_ERROR\;" - } - } - if {[info exists tclprocs]} { - foreach {name info} $tclprocs { - set map [list @NAME@ $name @CALLPROC@ [dict get $info callproc]] - ::practcl::cputs result [string map $map { Tcl_CreateObjCommand(interp,"@NAME@",(Tcl_ObjCmdProc *)@CALLPROC@,NULL,NULL);}] - if {[dict exists $info aliases]} { - foreach alias [dict get $info aliases] { - set map [list @NAME@ $alias @CALLPROC@ [dict get $info callproc]] - ::practcl::cputs result [string map $map { Tcl_CreateObjCommand(interp,"@NAME@",(Tcl_ObjCmdProc *)@CALLPROC@,NULL,NULL);}] - } - } - } - } - - if {[info exists code(nspace)]} { - ::practcl::cputs result " \{\n Tcl_Namespace *modPtr;" - foreach nspace $code(nspace) { - ::practcl::cputs result [string map [list @NSPACE@ $nspace] { - modPtr=Tcl_FindNamespace(interp,"@NSPACE@",NULL,TCL_NAMESPACE_ONLY); - Tcl_CreateEnsemble(interp, modPtr->fullName, modPtr, TCL_ENSEMBLE_PREFIX); - Tcl_Export(interp, modPtr, "[a-z]*", 1); -}] - } - ::practcl::cputs result " \}" - } - set result [::practcl::_tagblock $result c [my define get filename]] - foreach obj [my link list product] { - # Exclude products that will generate their own C files - if {[$obj define get output_c] ne {}} { - ::practcl::cputs result [$obj generate-cinit-external] - } else { - ::practcl::cputs result [$obj generate-cinit] - } - } - return $result - } - - method c_header body { - my variable code - ::practcl::cputs code(header) $body - } - - method c_code body { - my variable code - ::practcl::cputs code(funct) $body - } - method c_function {header body} { - my variable code cfunct - foreach regexp { - {(.*) ([a-zA-Z_][a-zA-Z0-9_]*) *\((.*)\)} - {(.*) (\x2a[a-zA-Z_][a-zA-Z0-9_]*) *\((.*)\)} - } { - if {[regexp $regexp $header all keywords funcname arglist]} { - dict set cfunct $funcname header $header - dict set cfunct $funcname body $body - dict set cfunct $funcname keywords $keywords - dict set cfunct $funcname arglist $arglist - dict set cfunct $funcname public [expr {"static" ni $keywords}] - dict set cfunct $funcname export [expr {"STUB_EXPORT" in $keywords}] - - return - } - } - ::practcl::cputs code(header) "$header\;" - # Could not parse that block as a function - # append it verbatim to our c_implementation - ::practcl::cputs code(funct) "$header [list $body]" - } - - - method cmethod {name body {arginfo {}}} { - my variable methods code - foreach {f v} $arginfo { - dict set methods $name $f $v - } - dict set methods $name body "Tcl_Object thisObject = Tcl_ObjectContextObject(objectContext); /* The current connection object */ -$body" - } - - method c_tclproc_nspace nspace { - my variable code - if {![info exists code(nspace)]} { - set code(nspace) {} - } - if {$nspace ni $code(nspace)} { - lappend code(nspace) $nspace - } - } - - method c_tclproc_raw {name body {arginfo {}}} { - my variable tclprocs code - - foreach {f v} $arginfo { - dict set tclprocs $name $f $v - } - dict set tclprocs $name body $body - } - - method go {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - next - my variable methods code cstruct tclprocs - if {[info exists methods]} { - debug [self] methods [my define get cclass] - set thisclass [my define get cclass] - foreach {name info} $methods { - # Provide a callproc - if {![dict exists $info callproc]} { - set callproc [string map {____ _ ___ _ __ _} [string map {{ } _ : _} OOMethod_${thisclass}_${name}]] - dict set methods $name callproc $callproc - } else { - set callproc [dict get $info callproc] - } - if {[dict exists $info body] && ![dict exists $info header]} { - dict set methods $name header "static int ${callproc}(ClientData clientData, Tcl_Interp *interp, Tcl_ObjectContext objectContext ,int objc ,Tcl_Obj *const *objv)" - } - if {![dict exists $info methodtype]} { - set methodtype [string map {{ } _ : _} MethodType_${thisclass}_${name}] - dict set methods $name methodtype $methodtype - } - } - if {![info exists code(initfuncts)] || "${thisclass}_OO_Init" ni $code(initfuncts)} { - lappend code(initfuncts) "${thisclass}_OO_Init" - } - } - set thisnspace [my define get nspace] - - if {[info exists tclprocs]} { - debug [self] tclprocs [dict keys $tclprocs] - foreach {name info} $tclprocs { - if {![dict exists $info callproc]} { - set callproc [string map {____ _ ___ _ __ _} [string map {{ } _ : _} Tclcmd_${thisnspace}_${name}]] - dict set tclprocs $name callproc $callproc - } else { - set callproc [dict get $info callproc] - } - if {[dict exists $info body] && ![dict exists $info header]} { - dict set tclprocs $name header "static int ${callproc}(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv\[\])" - } - } - } - debug [list /[self] [self method] [self class]] - } - - # Once an object marks itself as some - # flavor of dynamic, stop trying to morph - # it into something else - method select {} {} - - - method tcltype {name argdat} { - my variable tcltype - foreach {f v} $argdat { - dict set tcltype $name $f $v - } - if {![dict exists tcltype $name cname]} { - dict set tcltype $name cname [string tolower $name]_tclobjtype - } - lappend map @NAME@ $name - set info [dict get $tcltype $name] - foreach {f v} $info { - lappend map @[string toupper $f]@ $v - } - foreach {func fpat template} { - freeproc {@Name@Obj_freeIntRepProc} {void @FNAME@(Tcl_Obj *objPtr)} - dupproc {@Name@Obj_dupIntRepProc} {void @FNAME@(Tcl_Obj *srcPtr,Tcl_Obj *dupPtr)} - updatestringproc {@Name@Obj_updateStringRepProc} {void @FNAME@(Tcl_Obj *objPtr)} - setfromanyproc {@Name@Obj_setFromAnyProc} {int @FNAME@(Tcl_Interp *interp,Tcl_Obj *objPtr)} - } { - if {![dict exists $info $func]} { - error "$name does not define $func" - } - set body [dict get $info $func] - # We were given a function name to call - if {[llength $body] eq 1} continue - set fname [string map [list @Name@ [string totitle $name]] $fpat] - my c_function [string map [list @FNAME@ $fname] $template] [string map $map $body] - dict set tcltype $name $func $fname - } - } -} - -::oo::class create ::practcl::cheader { - superclass ::practcl::product - - method compile-products {} {} - method generate-cinit {} {} -} - -::oo::class create ::practcl::csource { - superclass ::practcl::product -} - -::oo::class create ::practcl::clibrary { - superclass ::practcl::product - - method linker-products {configdict} { - return [my define get filename] - } - -} - -### -# In the end, all C code must be loaded into a module -# This will either be a dynamically loaded library implementing -# a tcl extension, or a compiled in segment of a custom shell/app -### -::oo::class create ::practcl::module { - superclass ::practcl::dynamic - - method child which { - switch $which { - organs { - return [list project [my define get project] module [self]] - } - } - } - - method initialize {} { - set filename [my define get filename] - if {$filename eq {}} { - return - } - if {[my define get name] eq {}} { - my define set name [file tail [file dirname $filename]] - } - if {[my define get localpath] eq {}} { - my define set localpath [my define get name]_[my define get name] - } - debug [self] SOURCE $filename - my source $filename - } - - method implement path { - my go - my Collate_Source $path - foreach item [my link list dynamic] { - if {[catch {$item implement $path} err]} { - puts "Skipped $item: $err" - } - } - foreach item [my link list module] { - if {[catch {$item implement $path} err]} { - puts "Skipped $item: $err" - } - } - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set filename [my define get output_c] - if {$filename eq {}} { - debug [list /[self] [self method] [self class]] - return - } - set cout [open [file join $path [file rootname $filename].c] w] - puts $cout [subst {/* -** This file is generated by the [info script] script -** any changes will be overwritten the next time it is run -*/}] - puts $cout [my generate-c] - puts $cout [my generate-loader] - close $cout - debug [list /[self] [self method] [self class]] - } - - method linktype {} { - return {subordinate product dynamic module} - } -} - -::oo::class create ::practcl::autoconf { - - ### - # find or fake a key/value list describing this project - ### - method config.sh {} { - my variable conf_result - if {[info exists conf_result]} { - return $conf_result - } - set result {} - set name [my define get name] - set PWD $::CWD - set builddir [my define get builddir] - my unpack - set srcroot [my define get srcroot] - if {![file exists $builddir]} { - my Configure - } - set filename [file join $builddir config.tcl] - # Project uses the practcl template. Use the leavings from autoconf - if {[file exists $filename]} { - set dat [::practcl::config.tcl $builddir] - foreach {item value} [lsort -stride 2 -dictionary $dat] { - dict set result $item $value - } - set conf_result $result - return $result - } - set filename [file join $builddir ${name}Config.sh] - if {[file exists $filename]} { - set l [expr {[string length $name]+1}] - foreach {field dat} [::practcl::read_Config.sh $filename] { - set field [string tolower $field] - if {[string match ${name}_* $field]} { - set field [string range $field $l end] - } - dict set result $field $dat - } - set conf_result $result - return $result - } - ### - # Oh man... we have to guess - ### - set filename [file join $builddir Makefile] - if {![file exists $filename]} { - error "Could not locate any configuration data in $srcroot" - } - foreach {field dat} [::practcl::read_Makefile $filename] { - dict set result $field $dat - } - set conf_result $result - cd $PWD - return $result - } -} - - -::oo::class create ::practcl::project { - superclass ::practcl::module ::practcl::autoconf - - constructor args { - my variable define - if {[llength $args] == 1} { - if {[catch {uplevel 1 [list subst [lindex $args 0]]} contents]} { - set contents [lindex $args 0] - } - } else { - if {[catch {uplevel 1 [list subst $args]} contents]} { - set contents $args - } - } - array set define $contents - my select - my initialize - } - - - method add_project {pkg info {oodefine {}}} { - set os [my define get os] - if {$os eq {}} { - set os [::practcl::os] - my define set os $os - } - set fossilinfo [list download [my define get download] tag trunk sandbox [my define get sandbox]] - if {[dict exists $info os] && ($os ni [dict get $info os])} return - # Select which tag to use here. - # For production builds: tag-release - if {[::info exists ::env(FOSSIL_MIRROR)]} { - dict set info localmirror $::env(FOSSIL_MIRROR) - } - set profile [my define get profile release]: - if {[dict exists $info profile $profile]} { - dict set info tag [dict get $info profile $profile] - } - set obj [namespace current]::PROJECT.$pkg - if {[info command $obj] eq {}} { - set obj [::practcl::subproject create $obj [self] [dict merge $fossilinfo [list name $pkg pkg_name $pkg static 0] $info]] - } - my link object $obj - oo::objdefine $obj $oodefine - $obj define set masterpath $::CWD - $obj go - return $obj - } - - method child which { - switch $which { - organs { - # A library can be a project, it can be a module. Any - # subordinate modules will indicate their existance - return [list project [self] module [self]] - } - } - } - - method linktype {} { - return project - } - - # Exercise the methods of a sub-object - method project {pkg args} { - set obj [namespace current]::PROJECT.$pkg - if {[llength $args]==0} { - return $obj - } - tailcall ${obj} {*}$args - } -} - -::oo::class create ::practcl::library { - superclass ::practcl::project - - method compile-products {} { - set result {} - foreach item [my link list subordinate] { - lappend result {*}[$item compile-products] - } - set filename [my define get output_c] - if {$filename ne {}} { - set ofile [file rootname [file tail $filename]]_main.o - lappend result $ofile [list cfile $filename extra [my define get extra] external [string is true -strict [my define get external]]] - } - return $result - } - - method generate-tcl-loader {} { - set result {} - set PKGINIT [my define get pkginit] - set PKG_NAME [my define get name [my define get pkg_name]] - set PKG_VERSION [my define get pkg_vers [my define get version]] - if {[string is true [my define get SHARED_BUILD 0]]} { - set LIBFILE [my define get libfile] - ::practcl::cputs result [string map \ - [list @LIBFILE@ $LIBFILE @PKGINIT@ $PKGINIT @PKG_NAME@ $PKG_NAME @PKG_VERSION@ $PKG_VERSION] { -# Shared Library Style -load [file join [file dirname [file join [pwd] [info script]]] @LIBFILE@] @PKGINIT@ -package provide @PKG_NAME@ @PKG_VERSION@ -}] - } else { - ::practcl::cputs result [string map \ - [list @PKGINIT@ $PKGINIT @PKG_NAME@ $PKG_NAME @PKG_VERSION@ $PKG_VERSION] { -# Tclkit Style -load {} @PKGINIT@ -package provide @PKG_NAME@ @PKG_VERSION@ -}] - } - return $result - } - - method go {} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set name [my define getnull name] - if {$name eq {}} { - set name generic - my define name generic - } - if {[my define get tk] eq {@TEA_TK_EXTENSION@}} { - my define set tk 0 - } - set output_c [my define getnull output_c] - if {$output_c eq {}} { - set output_c [file rootname $name].c - my define set output_c $output_c - } - set output_h [my define getnull output_h] - if {$output_h eq {}} { - set output_h [file rootname $output_c].h - my define set output_h $output_h - } - set output_tcl [my define getnull output_tcl] - #if {$output_tcl eq {}} { - # set output_tcl [file rootname $output_c].tcl - # my define set output_tcl $output_tcl - #} - #set output_mk [my define getnull output_mk] - #if {$output_mk eq {}} { - # set output_mk [file rootname $output_c].mk - # my define set output_mk $output_mk - #} - set initfunc [my define getnull initfunc] - if {$initfunc eq {}} { - set initfunc [string totitle $name]_Init - my define set initfunc $initfunc - } - set output_decls [my define getnull output_decls] - if {$output_decls eq {}} { - set output_decls [file rootname $output_c].decls - my define set output_decls $output_decls - } - my variable links - foreach {linktype objs} [array get links] { - foreach obj $objs { - $obj go - } - } - debug [list /[self] [self method] [self class] -- [my define get filename] [info object class [self]]] - } - - method implement path { - my go - my Collate_Source $path - foreach item [my link list dynamic] { - if {[catch {$item implement $path} err]} { - puts "Skipped $item: $err" - } - } - foreach item [my link list module] { - if {[catch {$item implement $path} err]} { - puts "Skipped $item: $err" - } - } - set cout [open [file join $path [my define get output_c]] w] - puts $cout [subst {/* -** This file is generated by the [info script] script -** any changes will be overwritten the next time it is run -*/}] - puts $cout [my generate-c] - puts $cout [my generate-loader] - close $cout - - set macro HAVE_[string toupper [file rootname [my define get output_h]]]_H - set hout [open [file join $path [my define get output_h]] w] - puts $hout [subst {/* -** This file is generated by the [info script] script -** any changes will be overwritten the next time it is run -*/}] - puts $hout "#ifndef ${macro}" - puts $hout "#define ${macro}" - puts $hout [my generate-h] - puts $hout "#endif" - close $hout - - set output_tcl [my define get output_tcl] - if {$output_tcl ne {}} { - set tclout [open [file join $path [my define get output_tcl]] w] - puts $tclout "### -# This file is generated by the [info script] script -# any changes will be overwritten the next time it is run -###" - puts $tclout [my generate-tcl] - puts $tclout [my generate-tcl-loader] - close $tclout - } - } - - method generate-decls {pkgname path} { - debug [list [self] [self method] [self class] -- [my define get filename] [info object class [self]]] - set outfile [file join $path/$pkgname.decls] - - ### - # Build the decls file - ### - set fout [open $outfile w] - puts $fout [subst {### - # $outfile - # - # This file was generated by [info script] - ### - - library $pkgname - interface $pkgname - }] - - ### - # Generate list of functions - ### - set stubfuncts [my generate-stub-function] - set thisline {} - set functcount 0 - foreach {func header} $stubfuncts { - puts $fout [list declare [incr functcount] $header] - } - puts $fout [list export "int [my define get initfunc](Tcl_Inter *interp)"] - puts $fout [list export "char *[string totitle [my define get name]]_InitStubs(Tcl_Inter *interp, char *version, int exact)"] - - close $fout - - ### - # Build [package]Decls.h - ### - set hout [open [file join $path ${pkgname}Decls.h] w] - - close $hout - - set cout [open [file join $path ${pkgname}StubInit.c] w] -puts $cout [string map [list %pkgname% $pkgname %PkgName% [string totitle $pkgname]] { -#ifndef USE_TCL_STUBS -#define USE_TCL_STUBS -#endif -#undef USE_TCL_STUB_PROCS - -#include "tcl.h" -#include "%pkgname%.h" - - /* - ** Ensure that Tdom_InitStubs is built as an exported symbol. The other stub - ** functions should be built as non-exported symbols. - */ - -#undef TCL_STORAGE_CLASS -#define TCL_STORAGE_CLASS DLLEXPORT - -%PkgName%Stubs *%pkgname%StubsPtr; - - /* - **---------------------------------------------------------------------- - ** - ** %PkgName%_InitStubs -- - ** - ** Checks that the correct version of %PkgName% is loaded and that it - ** supports stubs. It then initialises the stub table pointers. - ** - ** Results: - ** The actual version of %PkgName% that satisfies the request, or - ** NULL to indicate that an error occurred. - ** - ** Side effects: - ** Sets the stub table pointers. - ** - **---------------------------------------------------------------------- - */ - -char * -%PkgName%_InitStubs (Tcl_Interp *interp, char *version, int exact) -{ - char *actualVersion; - actualVersion = Tcl_PkgRequireEx(interp, "%pkgname%", version, exact,(ClientData *) &%pkgname%StubsPtr); - if (!actualVersion) { - return NULL; - } - if (!%pkgname%StubsPtr) { - Tcl_SetResult(interp,"This implementation of %PkgName% does not support stubs",TCL_STATIC); - return NULL; - } - return actualVersion; -} -}] - close $cout - } - - # Backward compadible call - method generate-make path { - ::practcl::build::Makefile $path [self] - } - - method install-headers {} { - set result {} - return $result - } - - method linktype {} { - return library - } - - # Create a "package ifneeded" - # Args are a list of aliases for which this package will answer to - method package-ifneeded {args} { - set result {} - set name [my define get pkg_name [my define get name]] - set version [my define get pkg_vers [my define get version]] - if {$version eq {}} { - set version 0.1a - } - set output_tcl [my define get output_tcl] - if {$output_tcl ne {}} { - set script "\[list source \[file join \$dir $output_tcl\]\]" - } elseif {[string is true -strict [my define get SHARED_BUILD]]} { - set script "\[list load \[file join \$dir [my define get libfile]\] $name\]" - } else { - # Provide a null passthrough - set script [list package provide $name $version] - } - set result "package ifneeded [list $name] [list $version] $script" - foreach alias $args { - set script "package require $name $version \; package provide $alias $version" - append result \n\n [list package ifneeded $alias $version $script] - } - return $result - } - - - method shared_library {} { - set name [string tolower [my define get name [my define get pkg_name]]] - set NAME [string toupper $name] - set version [my define get version [my define get pkg_vers]] - set map {} - lappend map %LIBRARY_NAME% $name - lappend map %LIBRARY_VERSION% $version - lappend map %LIBRARY_VERSION_NODOTS% [string map {. {}} $version] - lappend map %LIBRARY_PREFIX% [my define getnull libprefix] - set outfile [string map $map [my define get PRACTCL_NAME_LIBRARY]][my define get SHLIB_SUFFIX] - return $outfile - } -} - -::oo::class create ::practcl::tclkit { - superclass ::practcl::library - - method Collate_Source CWD { - my define set SHARED_BUILD 0 - set name [my define get name] - - if {![my define exists TCL_LOCAL_APPINIT]} { - my define set TCL_LOCAL_APPINIT Tclkit_AppInit - } - if {![my define exists TCL_LOCAL_MAIN_HOOK]} { - my define set TCL_LOCAL_MAIN_HOOK Tclkit_MainHook - } - - set PROJECT [self] - set os [$PROJECT define get os] - set TCLOBJ [$PROJECT project TCLCORE] - set TKOBJ [$PROJECT project TKCORE] - set ODIEOBJ [$PROJECT project odie] - - set TCLSRCDIR [$TCLOBJ define get srcroot] - set TKSRCDIR [$TKOBJ define get srcroot] - set PKG_OBJS {} - foreach item [$PROJECT link list package] { - if {[string is true [$item define get static]]} { - lappend PKG_OBJS $item - } - } - # Arrange to build an main.c that utilizes TCL_LOCAL_APPINIT and TCL_LOCAL_MAIN_HOOK - if {$os eq "windows"} { - set PLATFORM_SRC_DIR win - my add class csource filename [file join $TCLSRCDIR win tclWinReg.c] initfunc Registry_Init pkg_name registry pkg_vers 1.3.1 autoload 1 - my add class csource filename [file join $TCLSRCDIR win tclWinDde.c] initfunc Dde_Init pkg_name dde pkg_vers 1.4.0 autoload 1 - my add class csource ofile [my define get name]_appinit.o filename [file join $TCLSRCDIR win tclAppInit.c] extra [list -DTCL_LOCAL_MAIN_HOOK=[my define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] -DTCL_LOCAL_APPINIT=[my define get TCL_LOCAL_APPINIT Tclkit_AppInit]] - } else { - set PLATFORM_SRC_DIR unix - my add class csource ofile [my define get name]_appinit.o filename [file join $TCLSRCDIR unix tclAppInit.c] extra [list -DTCL_LOCAL_MAIN_HOOK=[my define get TCL_LOCAL_MAIN_HOOK Tclkit_MainHook] -DTCL_LOCAL_APPINIT=[my define get TCL_LOCAL_APPINIT Tclkit_AppInit]] - } - - ### - # Pre 8.7, Tcl doesn't include a Zipfs implementation - # in the core. Grab the one from odielib - ### - set zipfs [file join $TCLSRCDIR generic tclZipfs.c] - if {[file exists $zipfs]} { - my define set CORE_ZIPFS 1 - } else { - ### - # Add local static Zlib implementation - ### - set cdir [file join $TCLSRCDIR compat zlib] - foreach file { - adler32.c compress.c crc32.c - deflate.c infback.c inffast.c - inflate.c inftrees.c trees.c - uncompr.c zutil.c - } { - my add [file join $cdir $file] - } - # The Odie project maintains a mirror of the version - # released with the Tcl core - my define set CORE_ZIPFS 0 - my add_project odie { - tag trunk - class subproject - vfsinstall 0 - } - my project odie unpack - set ODIESRCROOT [my project odie define get srcroot] - set cdir [file join $ODIESRCROOT compat zipfs] - my define add include_dir $cdir - set zipfs [file join $cdir zvfs.c] - my add class csource filename $zipfs initfunc Tclzipfs_Init pkg_name zipfs pkg_vers 1.0 autoload 1 - } - - - my define add include_dir [file join $TKSRCDIR generic] - my define add include_dir [file join $TKSRCDIR $PLATFORM_SRC_DIR] - my define add include_dir [file join $TKSRCDIR bitmaps] - my define add include_dir [file join $TKSRCDIR xlib] - my define add include_dir [file join $TCLSRCDIR generic] - my define add include_dir [file join $TCLSRCDIR $PLATFORM_SRC_DIR] - my define add include_dir [file join $TCLSRCDIR compat zlib] - # This file will implement TCL_LOCAL_APPINIT and TCL_LOCAL_MAIN_HOOK - ::practcl::build::tclkit_main $PROJECT $PKG_OBJS - } - - ## Wrap an executable - # - method wrap {PWD exename vfspath args} { - cd $PWD - if {![file exists $vfspath]} { - file mkdir $vfspath - } - foreach item [my link list core.library] { - set name [$item define get name] - set libsrcroot [$item define get srcroot] - if {[file exists [file join $libsrcroot library]]} { - ::practcl::copyDir [file join $libsrcroot library] [file join $vfspath boot $name] - } - } - if {[my define get installdir] ne {}} { - ::practcl::copyDir [file join [my define get installdir] [string trimleft [my define get prefix] /] lib] [file join $vfspath lib] - } - foreach arg $args { - ::practcl::copyDir $arg $vfspath - } - - set fout [open [file join $vfspath packages.tcl] w] - puts $fout { - set ::PKGIDXFILE [info script] - set dir [file dirname $::PKGIDXFILE] - } - #set BASEVFS [my define get BASEVFS] - set EXEEXT [my define get EXEEXT] - - set tclkit_bare [my define get tclkit_bare] - - set buffer [::practcl::pkgindex_path $vfspath] - puts $fout $buffer - puts $fout { - # Advertise statically linked packages - foreach {pkg script} [array get ::kitpkg] { - eval $script - } - } - close $fout - package require zipfile::mkzip - ::zipfile::mkzip::mkzip ${exename}${EXEEXT} -runtime $tclkit_bare -directory $vfspath - if { [my define get platform] ne "windows" } { - file attributes ${exename}${EXEEXT} -permissions a+x - } - } -} - -### -# Meta repository -# The default is an inert source code block -### -oo::class create ::practcl::subproject { - superclass ::practcl::object - - method compile {} {} - - method go {} { - set platform [my define get platform] - my define get USEMSVC [my define get USEMSVC] - set name [my define get name] - if {![my define exists srcroot]} { - my define set srcroot [file join [my define get sandbox] $name] - } - set srcroot [my define get srcroot] - my define set localsrcdir $srcroot - my define add include_dir [file join $srcroot generic] - my sources - } - - # Install project into the local build system - method install-local {} { - my unpack - } - - # Install project into the virtual file system - method install-vfs {} {} - - method linktype {} { - return {subordinate package} - } - - method linker-products {configdict} {} - - method linker-external {configdict} { - if {[dict exists $configdict PRACTCL_LIBS]} { - return [dict get $configdict PRACTCL_LIBS] - } - } - - method sources {} {} - - method unpack {} { - set name [my define get name] - puts [list $name [self] UNPACK] - my define set [::practcl::fossil_sandbox $name [my define dump]] - } - - method update {} { - set name [my define get name] - my define set [::practcl::fossil_sandbox $name [dict merge [my define dump] {update 1}]] - } -} - -### -# A project which the kit compiles and integrates -# the source for itself -### -oo::class create ::practcl::subproject.source { - superclass ::practcl::subproject ::practcl::library - - method linktype {} { - return {subordinate package source} - } - -} - -# a copy from the teapot -oo::class create ::practcl::subproject.teapot { - superclass ::practcl::subproject - - method install-local {} { - my install-vfs - } - - method install-vfs {} { - set pkg [my define get pkg_name [my define get name]] - set download [my define get download] - my unpack - set DEST [my define get installdir] - set prefix [string trimleft [my define get prefix] /] - # Get tcllib from our destination - set dir [file join $DEST $prefix lib tcllib] - source [file join $DEST $prefix lib tcllib pkgIndex.tcl] - package require zipfile::decode - ::zipfile::decode::unzipfile [file join $download $pkg.zip] [file join $DEST $prefix lib $pkg] - } -} - -oo::class create ::practcl::subproject.sak { - superclass ::practcl::subproject - - method install-local {} { - my install-vfs - } - - method install-vfs {} { - ### - # Handle teapot installs - ### - set pkg [my define get pkg_name [my define get name]] - my unpack - set DEST [my define get installdir] - set prefix [string trimleft [my define get prefix] /] - set srcroot [my define get srcroot] - ::dotclexec [file join $srcroot installer.tcl] \ - -pkg-path [file join $DEST $prefix lib $pkg] \ - -no-examples -no-html -no-nroff \ - -no-wait -no-gui -no-apps - } -} - -### -# A binary package -### -oo::class create ::practcl::subproject.binary { - superclass ::practcl::subproject ::practcl::autoconf - - - method compile-products {} {} - - method ConfigureOpts {} { - set opts {} - set builddir [my define get builddir] - if {[my define get broken_destroot 0]} { - set PREFIX [my define get prefix_broken_destdir] - } else { - set PREFIX [my define get prefix] - } - if {[my define get HOST] != [my define get TARGET]} { - lappend opts --host=[my define get TARGET] - } - if {[my define exists tclsrcdir]} { - set TCLSRCDIR [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tclsrcdir]]]] - set TCLGENERIC [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tclsrcdir] .. generic]]] - lappend opts --with-tcl=$TCLSRCDIR --with-tclinclude=$TCLGENERIC - } - if {[my define exists tksrcdir]} { - set TKSRCDIR [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tksrcdir]]]] - set TKGENERIC [::practcl::file_relative [file normalize $builddir] [file normalize [file join $::CWD [my define get tksrcdir] .. generic]]] - lappend opts --with-tk=$TKSRCDIR --with-tkinclude=$TKGENERIC - } - lappend opts {*}[my define get config_opts] - lappend opts --prefix=$PREFIX - #--exec_prefix=$PREFIX - #if {$::tcl_platform(platform) eq "windows"} { - # lappend opts --disable-64bit - #} - if {[my define get static 1]} { - lappend opts --disable-shared --disable-stubs - # - } else { - lappend opts --enable-shared - } - return $opts - } - - method go {} { - next - my define set builddir [my BuildDir [my define get masterpath]] - } - - method linker-products {configdict} { - if {![my define get static 0]} { - return {} - } - set srcdir [my define get builddir] - if {[dict exists $configdict libfile]} { - return " [file join $srcdir [dict get $configdict libfile]]" - } - } - - method static-packages {} { - if {![my define get static 0]} { - return {} - } - set result [my define get static_packages] - set statpkg [my define get static_pkg] - set initfunc [my define get initfunc] - if {$initfunc ne {}} { - set pkg_name [my define get pkg_name] - if {$pkg_name ne {}} { - dict set result $pkg_name initfunc $initfunc - set version [my define get version] - if {$version eq {}} { - set info [my config.sh] - set version [dict get $info version] - set pl {} - if {[dict exists $info patch_level]} { - set pl [dict get $info patch_level] - append version $pl - } - my define set version $version - } - dict set result $pkg_name version $version - dict set result $pkg_name autoload [my define get autoload 0] - } - } - foreach item [my link list subordinate] { - foreach {pkg info} [$item static-packages] { - dict set result $pkg $info - } - } - return $result - } - - method BuildDir {PWD} { - set name [my define get name] - return [my define get builddir [file join $PWD pkg.$name]] - } - - method compile {} { - set name [my define get name] - set PWD $::CWD - cd $PWD - my go - set srcroot [file normalize [my define get srcroot]] - my Collate_Source $PWD - - ### - # Build a starter VFS for both Tcl and wish - ### - set srcroot [my define get srcroot] - if {[my define get static 1]} { - puts "BUILDING Static $name $srcroot" - } else { - puts "BUILDING Dynamic $name $srcroot" - } - if {[my define get USEMSVC 0]} { - cd $srcroot - doexec nmake -f makefile.vc INSTALLDIR=[my define get installdir] release - } else { - cd $::CWD - set builddir [file normalize [my define get builddir]] - file mkdir $builddir - if {![file exists [file join $builddir Makefile]]} { - my Configure - } - if {[file exists [file join $builddir make.tcl]]} { - domake.tcl $builddir library - } else { - domake $builddir all - } - } - cd $PWD - } - - - method Configure {} { - cd $::CWD - my unpack - my TeaConfig - set builddir [file normalize [my define get builddir]] - file mkdir $builddir - set srcroot [file normalize [my define get srcroot]] - if {[my define get USEMSVC 0]} { - return - } - set opts [my ConfigureOpts] - puts [list [self] CONFIGURE] - puts [list PWD [pwd]] - puts [list LOCALSRC $srcroot] - puts [list BUILDDIR $builddir] - puts [list CONFIGURE {*}$opts] - cd $builddir - exec sh [file join $srcroot configure] {*}$opts >& [file join $builddir practcl.log] - cd $::CWD - } - - method install-vfs {} { - set PWD [pwd] - set PKGROOT [my define get installdir] - set PREFIX [my define get prefix] - - ### - # Handle teapot installs - ### - set pkg [my define get pkg_name [my define get name]] - if {[my define get teapot] ne {}} { - set TEAPOT [my define get teapot] - set found 0 - foreach ver [my define get pkg_vers [my define get version]] { - set teapath [file join $TEAPOT $pkg$ver] - if {[file exists $teapath]} { - set dest [file join $PKGROOT [string trimleft $PREFIX /] lib [file tail $teapath]] - ::practcl::copyDir $teapath $dest - return - } - } - } - my compile - if {[my define get USEMSVC 0]} { - set srcroot [my define get srcroot] - cd $srcroot - puts "[self] VFS INSTALL $PKGROOT" - doexec nmake -f makefile.vc INSTALLDIR=$PKGROOT install - } else { - set builddir [my define get builddir] - if {[file exists [file join $builddir make.tcl]]} { - # Practcl builds can inject right to where we need them - puts "[self] VFS INSTALL $PKGROOT (Practcl)" - domake.tcl $builddir install-package $PKGROOT - } elseif {[my define get broken_destroot 0] == 0} { - # Most modern TEA projects understand DESTROOT in the makefile - puts "[self] VFS INSTALL $PKGROOT (TEA)" - domake $builddir install DESTDIR=$PKGROOT - } else { - # But some require us to do an install into a fictitious filesystem - # and then extract the gooey parts within. - # (*cough*) TkImg - set PREFIX [my define get prefix] - set BROKENROOT [::practcl::msys_to_tclpath [my define get prefix_broken_destdir]] - file delete -force $BROKENROOT - file mkdir $BROKENROOT - domake $builddir $install - ::practcl::copyDir $BROKENROOT [file join $PKGROOT [string trimleft $PREFIX /]] - file delete -force $BROKENROOT - } - } - cd $PWD - } - - method TeaConfig {} { - set srcroot [file normalize [my define get srcroot]] - set copytea 0 - if {![file exists [file join $srcroot tclconfig]]} { - set copytea 1 - } else { - if {![file exists [file join $srcroot tclconfig practcl.tcl]] || ![file exists [file join $srcroot tclconfig config.tcl.in]]} { - set copytea 1 - } - } - # ensure we have tclconfig with all of the trimming - if {$copytea} { - set tclconfiginfo [::practcl::fossil_sandbox tclconfig [list sandbox [my define get sandbox]]] - ::practcl::copyDir [dict get $tclconfiginfo srcroot] [file join $srcroot tclconfig] - if {$::tcl_platform(platform) ne "windows"} { - set pwd [pwd] - cd $srcroot - # On windows there's no practical way to execute - # autoconf. We'll have to trust that configure - # us up to date - foreach template {configure.ac configure.in} { - set input [file join $srcroot $template] - if {[file exists $input]} { - puts "autoconf -f $input > [file join $srcroot configure]" - exec autoconf -f $input > [file join $srcroot configure] - } - } - cd $pwd - } - } - } -} - -oo::class create ::practcl::subproject.core { - superclass ::practcl::subproject.binary - - # On the windows platform MinGW must build - # from the platform directory in the source repo - method BuildDir {PWD} { - return [my define get localsrcdir] - } - - method Configure {} { - if {[my define get USEMSVC 0]} { - return - } - set opts [my ConfigureOpts] - puts [list PWD [pwd]] - puts [list [self] CONFIGURE] - set builddir [file normalize [my define get builddir]] - set localsrcdir [file normalize [my define get localsrcdir]] - puts [list LOCALSRC $localsrcdir] - puts [list BUILDDIR $builddir] - puts [list CONFIGURE {*}$opts] - cd $localsrcdir - exec sh [file join $localsrcdir configure] {*}$opts >& [file join $builddir practcl.log] - } - - method ConfigureOpts {} { - set opts {} - set builddir [file normalize [my define get builddir]] - set PREFIX [my define get prefix] - if {[my define get HOST] != [my define get TARGET]} { - lappend opts --host=[my define get TARGET] - } - lappend opts {*}[my define get config_opts] - lappend opts --prefix=$PREFIX - #--exec_prefix=$PREFIX - lappend opts --disable-shared - return $opts - } - - method go {} { - set name [my define get name] - set platform [my define get platform] - if {![my define exists srcroot]} { - my define set srcroot [file join [my define get sandbox] $name] - } - set srcroot [my define get srcroot] - my define add include_dir [file join $srcroot generic] - switch $platform { - windows { - my define set localsrcdir [file join $srcroot win] - my define add include_dir [file join $srcroot win] - } - default { - my define set localsrcdir [file join $srcroot unix] - my define add include_dir [file join $srcroot $name unix] - } - } - my define set builddir [my BuildDir [my define get masterpath]] - } - - method linktype {} { - return {subordinate core.library} - } -} - -package provide practcl 0.5 diff --git a/library/zvfstools/pkgIndex.tcl b/library/zvfstools/pkgIndex.tcl deleted file mode 100644 index 824d5b3..0000000 --- a/library/zvfstools/pkgIndex.tcl +++ /dev/null @@ -1 +0,0 @@ -package ifneeded zvfstools 0.1 [list source [file join $dir zvfstools.tcl]] diff --git a/library/zvfstools/zvfstools.tcl b/library/zvfstools/zvfstools.tcl deleted file mode 100644 index 274d5a1..0000000 --- a/library/zvfstools/zvfstools.tcl +++ /dev/null @@ -1,325 +0,0 @@ -# -*- tcl -*- -# ### ### ### ######### ######### ######### -## Copyright (c) 2008-2009 ActiveState Software Inc. -## Andreas Kupries -## Copyright (C) 2009 Pat Thoyts -## Copyright (C) 2014 Sean Woods -## -## BSD License -## -# Package providing commands for: -# * the generation of a zip archive, -# * building a zip archive from a file system -# * building a file system from a zip archive - -package require Tcl 8.6 -# Cop -# -# Create ZIP archives in Tcl. -# -# Create a zipkit using mkzip filename.zkit -zipkit -directory xyz.vfs -# or a zipfile using mkzip filename.zip -directory dirname -exclude "*~" -# - -namespace eval ::zvfs {} - -proc ::zvfs::setbinary chan { - fconfigure $chan \ - -encoding binary \ - -translation binary \ - -eofchar {} - -} - -# zip::timet_to_dos -# -# Convert a unix timestamp into a DOS timestamp for ZIP times. -# -# DOS timestamps are 32 bits split into bit regions as follows: -# 24 16 8 0 -# +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ -# |Y|Y|Y|Y|Y|Y|Y|m| |m|m|m|d|d|d|d|d| |h|h|h|h|h|m|m|m| |m|m|m|s|s|s|s|s| -# +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ -# -proc ::zvfs::timet_to_dos {time_t} { - set s [clock format $time_t -format {%Y %m %e %k %M %S}] - scan $s {%d %d %d %d %d %d} year month day hour min sec - expr {(($year-1980) << 25) | ($month << 21) | ($day << 16) - | ($hour << 11) | ($min << 5) | ($sec >> 1)} -} - -# zip::pop -- -# -# Pop an element from a list -# -proc ::zvfs::pop {varname {nth 0}} { - upvar $varname args - set r [lindex $args $nth] - set args [lreplace $args $nth $nth] - return $r -} - -# zip::walk -- -# -# Walk a directory tree rooted at 'path'. The excludes list can be -# a set of glob expressions to match against files and to avoid. -# The match arg is internal. -# eg: walk library {CVS/* *~ .#*} to exclude CVS and emacs cruft. -# -proc ::zvfs::walk {base {excludes ""} {match *} {path {}}} { - set result {} - set imatch [file join $path $match] - set files [glob -nocomplain -tails -types f -directory $base $imatch] - foreach file $files { - set excluded 0 - foreach glob $excludes { - if {[string match $glob $file]} { - set excluded 1 - break - } - } - if {!$excluded} {lappend result $file} - } - foreach dir [glob -nocomplain -tails -types d -directory $base $imatch] { - lappend result $dir - set subdir [walk $base $excludes $match $dir] - if {[llength $subdir]>0} { - set result [concat $result [list $dir] $subdir] - } - } - return $result -} - -# zvfs::add_file_to_archive -- -# -# Add a single file to a zip archive. The zipchan channel should -# already be open and binary. You may provide a comment for the -# file The return value is the central directory record that -# will need to be used when finalizing the zip archive. -# -# FIX ME: should handle the current offset for non-seekable channels -# -proc ::zvfs::add_file_to_archive {zipchan base path {comment ""}} { - set fullpath [file join $base $path] - set mtime [timet_to_dos [file mtime $fullpath]] - if {[file isdirectory $fullpath]} { - append path / - } - set utfpath [encoding convertto utf-8 $path] - set utfcomment [encoding convertto utf-8 $comment] - set flags [expr {(1<<11)}] ;# utf-8 comment and path - set method 0 ;# store 0, deflate 8 - set attr 0 ;# text or binary (default binary) - set version 20 ;# minumum version req'd to extract - set extra "" - set crc 0 - set size 0 - set csize 0 - set data "" - set seekable [expr {[tell $zipchan] != -1}] - if {[file isdirectory $fullpath]} { - set attrex 0x41ff0010 ;# 0o040777 (drwxrwxrwx) - } elseif {[file executable $fullpath]} { - set attrex 0x81ff0080 ;# 0o100777 (-rwxrwxrwx) - } else { - set attrex 0x81b60020 ;# 0o100666 (-rw-rw-rw-) - if {[file extension $fullpath] in {".tcl" ".txt" ".c"}} { - set attr 1 ;# text - } - } - - if {[file isfile $fullpath]} { - set size [file size $fullpath] - if {!$seekable} {set flags [expr {$flags | (1 << 3)}]} - } - - set offset [tell $zipchan] - set local [binary format a4sssiiiiss PK\03\04 \ - $version $flags $method $mtime $crc $csize $size \ - [string length $utfpath] [string length $extra]] - append local $utfpath $extra - puts -nonewline $zipchan $local - - if {[file isfile $fullpath]} { - # If the file is under 2MB then zip in one chunk, otherwize we use - # streaming to avoid requiring excess memory. This helps to prevent - # storing re-compressed data that may be larger than the source when - # handling PNG or JPEG or nested ZIP files. - if {$size < 0x00200000} { - set fin [::open $fullpath rb] - setbinary $fin - set data [::read $fin] - set crc [::zlib crc32 $data] - set cdata [::zlib deflate $data] - if {[string length $cdata] < $size} { - set method 8 - set data $cdata - } - close $fin - set csize [string length $data] - puts -nonewline $zipchan $data - } else { - set method 8 - set fin [::open $fullpath rb] - setbinary $fin - set zlib [::zlib stream deflate] - while {![eof $fin]} { - set data [read $fin 4096] - set crc [zlib crc32 $data $crc] - $zlib put $data - if {[string length [set zdata [$zlib get]]]} { - incr csize [string length $zdata] - puts -nonewline $zipchan $zdata - } - } - close $fin - $zlib finalize - set zdata [$zlib get] - incr csize [string length $zdata] - puts -nonewline $zipchan $zdata - $zlib close - } - - if {$seekable} { - # update the header if the output is seekable - set local [binary format a4sssiiii PK\03\04 \ - $version $flags $method $mtime $crc $csize $size] - set current [tell $zipchan] - seek $zipchan $offset - puts -nonewline $zipchan $local - seek $zipchan $current - } else { - # Write a data descriptor record - set ddesc [binary format a4iii PK\7\8 $crc $csize $size] - puts -nonewline $zipchan $ddesc - } - } - - set hdr [binary format a4ssssiiiisssssii PK\01\02 0x0317 \ - $version $flags $method $mtime $crc $csize $size \ - [string length $utfpath] [string length $extra]\ - [string length $utfcomment] 0 $attr $attrex $offset] - append hdr $utfpath $extra $utfcomment - return $hdr -} - -# zvfs::mkzip -- -# -# Create a zip archive in 'filename'. If a file already exists it will be -# overwritten by a new file. If '-directory' is used, the new zip archive -# will be rooted in the provided directory. -# -runtime can be used to specify a prefix file. For instance, -# zip myzip -runtime unzipsfx.exe -directory subdir -# will create a self-extracting zip archive from the subdir/ folder. -# The -comment parameter specifies an optional comment for the archive. -# -# eg: zip my.zip -directory Subdir -runtime unzipsfx.exe *.txt -# -proc ::zvfs::mkzip {filename args} { - array set opts { - -zipkit 0 -runtime "" -comment "" -directory "" - -exclude {CVS/* */CVS/* *~ ".#*" "*/.#*"} - } - - while {[string match -* [set option [lindex $args 0]]]} { - switch -exact -- $option { - -zipkit { set opts(-zipkit) 1 } - -comment { set opts(-comment) [encoding convertto utf-8 [pop args 1]] } - -runtime { set opts(-runtime) [pop args 1] } - -directory {set opts(-directory) [file normalize [pop args 1]] } - -exclude {set opts(-exclude) [pop args 1] } - -- { pop args ; break } - default { - break - } - } - pop args - } - - set zf [::open $filename wb] - setbinary $zf - if {$opts(-runtime) ne ""} { - set rt [::open $opts(-runtime) rb] - setbinary $rt - fcopy $rt $zf - close $rt - } elseif {$opts(-zipkit)} { - set zkd {#!/usr/bin/env tclsh -# This is a zip-based Tcl Module -if {![package vsatisfies [package provide zvfs] 1.0]} { - package require vfs::zip - vfs::zip::Mount [info script] [info script] -} else { - zvfs::mount [info script] [info script] -} -# Load any CLIP file present -if {[file exists [file join [info script] pkgIndex.tcl]] } { - set dir [info script] - source [file join [info script] pkgIndex.tcl] -} -# Run any main.tcl present -if {[file exists [file join [info script] main.tcl]] } { - source [file join [info script] main.tcl] -} - } - append zkd \x1A - puts -nonewline $zf $zkd - } - - set count 0 - set cd "" - - if {$opts(-directory) ne ""} { - set paths [walk $opts(-directory) $opts(-exclude)] - } else { - set paths [glob -nocomplain {*}$args] - } - foreach path $paths { - append cd [add_file_to_archive $zf $opts(-directory) $path] - incr count - } - set cdoffset [tell $zf] - set endrec [binary format a4ssssiis PK\05\06 0 0 \ - $count $count [string length $cd] $cdoffset\ - [string length $opts(-comment)]] - append endrec $opts(-comment) - puts -nonewline $zf $cd - puts -nonewline $zf $endrec - close $zf - - return -} - -### -# Decode routines -### -proc ::zvfs::copy_file {zipbase destbase file} { - set l [string length $zipbase] - set relname [string trimleft [string range $file $l end] /] - if {[file isdirectory $file]} { - foreach sfile [glob -nocomplain $file/*] { - file mkdir [file join $destbase $relname] - copy_file $zipbase $destbase $sfile - } - return - } - file copy -force $file [file join $destbase $relname] -} - -# ### ### ### ######### ######### ######### -## Convenience command, decode and copy to dir -## This routine relies on zvfs::mount, so we only load -## it when the zvfs package is present -## -proc ::zvfs::unzip {in out} { - package require zvfs 1.0 - set root /ziptmp#[incr ::zvfs::count] - zvfs::mount $in $root - set out [file normalize $out] - foreach file [glob $root/*] { - copy_file $root $out $file - } - zvfs::unmount $in - return -} -package provide zvfstools 0.1 diff --git a/pkgs/make.tcl b/pkgs/make.tcl deleted file mode 100644 index 94a4050..0000000 --- a/pkgs/make.tcl +++ /dev/null @@ -1,165 +0,0 @@ -### -# This file contains instructions for how to build the Odielib library -# It will produce the following files in whatever directory it was called from: -# -# * odielibc.mk - A Makefile snippet needed to compile the odielib sources -# * odielibc.c - A C file which acts as the loader for odielibc -# * logicset.c/h - A c -# * (several .c and .h files) - C sources that are generated on the fly by automation -### -# Ad a "just in case" version or practcl we ship locally - -set ::CWD [pwd] -set ::project(builddir) $::CWD -set ::project(srcdir) [file dirname [file dirname [file normalize [info script]]]] -set ::project(sandbox) [file dirname $::project(srcdir)] -set ::project(download) [file join $::project(sandbox) download] -set ::project(teapot) [file join $::project(sandbox) teapot] -source [file join $::CWD .. library practcl practcl.tcl] -array set ::project [::practcl::config.tcl $CWD] - -set SRCPATH $::project(srcdir) -set SANDBOX $::project(sandbox) -file mkdir $CWD/build - -::practcl::target implement { - triggers {} -} -::practcl::target tcltk { - depends deps - triggers {script-packages script-pkgindex} -} -::practcl::target basekit { - depends {deps tcltk} - triggers {} - filename [file join $CWD tclkit_bare$::project(EXEEXT)] -} -::practcl::target packages { - depends {deps tcltk} -} -::practcl::target distclean {} -::practcl::target example { - depends basekit -} - -switch [lindex $argv 0] { - autoconf - - pre - - deps { - ::practcl::trigger implement - } - os { - puts "OS: [practcl::os]" - parray ::project - exit 0 - } - wrap { - ::practcl::depends basekit - } - all { - # Auto detect missing bits - foreach {item obj} $::make_objects { - if {[$obj check]} { - $obj trigger - } - } - } - package { - ::practcl::trigger packages - } - default { - ::practcl::trigger {*}$argv - } -} - -parray make - -set ::CWD [pwd] -::practcl::tclkit create BASEKIT {} -BASEKIT define set name tclkit -BASEKIT define set pkg_name tclkit -BASEKIT define set pkg_version 8.7.0a -BASEKIT define set localpath tclkit -BASEKIT define set profile devel -BASEKIT source [file join $::CWD packages.tcl] - -if {$make(distclean)} { - # Clean all source code back to it's pristine state from fossil - foreach item [BASEKIT link list package] { - $item go - set projdir [$item define get localsrcdir] - if {$projdir ne {} && [file exists $projdir]} { - fossil $projdir clean -force - } - } -} - -file mkdir [file join $CWD build] - -if {$make(tcltk)} { - ### - # Download our required packages - ### - set tcl_config_opts {} - set tk_config_opts {} - switch [::practcl::os] { - windows { - #lappend tcl_config_opts --disable-stubs - } - linux { - lappend tk_config_opts --enable-xft=no --enable-xss=no - } - macosx { - lappend tcl_config_opts --enable-corefoundation=yes --enable-framework=no - lappend tk_config_opts --enable-aqua=yes - } - } - lappend tcl_config_opts --with-tzdata --prefix [BASEKIT define get prefix] - BASEKIT project TCLCORE define set config_opts $tcl_config_opts - BASEKIT project TCLCORE go - set _TclSrcDir [BASEKIT project TCLCORE define get localsrcdir] - BASEKIT define set tclsrcdir $_TclSrcDir - lappend tk_config_opts --with-tcl=$_TclSrcDir - BASEKIT project TKCORE define set config_opts $tk_config_opts - BASEKIT project TCLCORE compile - BASEKIT project TKCORE compile -} - -if {$make(basekit)} { - BASEKIT implement $CWD - ::practcl::build::static-tclsh $target(basekit) BASEKIT -} - -if {[lindex $argv 0] eq "package"} { - #set result {} - foreach item [lrange $argv 1 end] { - set obj [BASEKIT project $item] - puts [list build $item [$obj define get static] [info object class $obj]] - if {[string is true [$obj define get static]]} { - $obj compile - } - if {[string is true [$obj define get vfsinstall]]} { - $obj install-vfs - } - } - #puts "RESULT: $result" -} elseif {$make(packages)} { - foreach item [BASEKIT link list package] { - if {[string is true [$item define get static]]} { - $item compile - } - if {[string is true [$item define get vfsinstall]]} { - $item install-vfs - } - } -} - - -if {$make(example)} { - file mkdir [file join $CWD example.vfs] - BASEKIT wrap $CWD example example.vfs -} - -if {[lindex $argv 0] eq "wrap"} { - BASEKIT wrap $CWD {*}[lrange $argv 1 end] -} diff --git a/pkgs/packages.tcl b/pkgs/packages.tcl deleted file mode 100644 index 2a84971..0000000 --- a/pkgs/packages.tcl +++ /dev/null @@ -1,92 +0,0 @@ -### -# This script implements a basic TclTkit with statically linked -# Tk, sqlite, threads, udp, and mmtk (which includes canvas3d and tkhtml) -### - -set CWD [pwd] - -my define set [array get ::project] -set os [::practcl::os] -my define set os $os -puts [list BASEKIT SANDBOX $::project(sandbox)] -my define set platform $::project(TEA_PLATFORM) -my define set prefix /zvfs -my define set sandbox [file normalize $::project(sandbox)] -my define set installdir [file join $::project(sandbox) pkg] -my define set teapot [file join $::project(sandbox) teapot] -my define set USEMSVC [info exists env(VisualStudioVersion)] -my define set prefix_broken_destdir [file join $::project(sandbox) tmp] -my define set HOST $os -my define set TARGET $os -my define set tclkit_bare [file join $CWD tclkit_bare$::project(EXEEXT)] - -my define set name tclkit -my define set output_c tclkit.c -my define set libs {} - -my add_project TCLCORE { - class subproject.core - name tcl - tag release - static 1 -} -my project TCLCORE define set srcdir [file dirname $::project(sandbox)] - -my add_project TKCORE { - class subproject.core - name tk - tag release - static 1 - autoload 0 - pkg_name Tk - initfunc Tk_Init -} - -my add_project tclconfig { - profile { - release: 3dfb97da548fae506374ac0015352ac0921d0cc9 - devel: practcl - } - class subproject - preload 1 - vfsinstall 0 -} - -my add_project thread { - profile { - release: 2a36d0a6c31569bfb3562e3d58e9e8204f447a7e - devel: practcl - } - class subproject.binary - pkg_name Thread - autoload 1 - initfunc Thread_Init - static 1 -} - -my add_project sqlite { - profile { - release: 40ffdfb26af3e7443b2912e1039c06bf9ed75846 - devel: practcl - } - class subproject.binary - pkg_name sqlite3 - autoload 1 - initfunc Sqlite3_Init - static 1 - vfsinstall 0 -} - -my add_project udp { - profile { - release: 7c396e1a767db57b07b48daa8e0cfc0ea622bbe9 - devel: practcl - } - class subproject.binary - static 1 - autoload 1 - initfunc Udp_Init - pkg_name udp - vfsinstall 0 -} - -- cgit v0.12 From 2c1224dce7ce2f827991e0abf968d2ccdb31f32b Mon Sep 17 00:00:00 2001 From: pooryorick Date: Tue, 7 Nov 2017 20:54:02 +0000 Subject: TclOO object allocation: Set classPtr to NULL if it wasn't otherwise set. --- generic/tclOO.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index 51731d3..e48158c 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -538,7 +538,8 @@ KillFoundation( * AllocObject -- * * Allocate an object of basic type. Does not splice the object into its - * class's instance list. + * class's instance list. The caller must set the classPtr on the object, + * either to a class or to NULL. * * ---------------------------------------------------------------------- */ @@ -1701,6 +1702,8 @@ Tcl_NewObjectInstance( AllocClass(interp, oPtr); oPtr->selfCls = classPtr; TclOOAddToSubclasses(oPtr->classPtr, fPtr->objectCls); + } else { + oPtr->classPtr = NULL; } /* -- cgit v0.12 From fd61a8e89e832f6814d5deb7fe5a0c171e638167 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 7 Nov 2017 21:32:04 +0000 Subject: Attempted bug fix. --- generic/tclHash.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/generic/tclHash.c b/generic/tclHash.c index 256b073..b553c68 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -1013,12 +1013,18 @@ static void RebuildTable( register Tcl_HashTable *tablePtr) /* Table to enlarge. */ { - int oldSize, count, index; - Tcl_HashEntry **oldBuckets; + int count, index, oldSize = tablePtr->numBuckets; + Tcl_HashEntry **oldBuckets = tablePtr->buckets; register Tcl_HashEntry **oldChainPtr, **newChainPtr; register Tcl_HashEntry *hPtr; const Tcl_HashKeyType *typePtr; + /* Avoid outgrowing capability of the memory allocators */ + if (oldSize > UINT_MAX / (4 * sizeof(Tcl_HashEntry *))) { + tablePtr->rebuildSize = INT_MAX; + return; + } + if (tablePtr->keyType == TCL_STRING_KEYS) { typePtr = &tclStringHashKeyType; } else if (tablePtr->keyType == TCL_ONE_WORD_KEYS) { @@ -1030,9 +1036,6 @@ RebuildTable( typePtr = &tclArrayHashKeyType; } - oldSize = tablePtr->numBuckets; - oldBuckets = tablePtr->buckets; - /* * Allocate and initialize the new bucket array, and set up hashing * constants for new array size. -- cgit v0.12 From a982dd11fa97fd5c0f45076a0662f40a80f43503 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 8 Nov 2017 00:39:17 +0000 Subject: Modify TclCreateProc to handle arbitrary argument names, not just ASCII. --- generic/tclExecute.c | 4 +-- generic/tclInt.h | 2 +- generic/tclProc.c | 96 +++++++++++++++++++++++----------------------------- 3 files changed, 45 insertions(+), 57 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index d43ddfd..3eba833 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1333,12 +1333,12 @@ TclStackAlloc( int numBytes) { Interp *iPtr = (Interp *) interp; - int numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *); + int numWords; if (iPtr == NULL || iPtr->execEnvPtr == NULL) { return (void *) ckalloc(numBytes); } - + numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *); return (void *) StackAllocWords(interp, numWords); } diff --git a/generic/tclInt.h b/generic/tclInt.h index 29956ec..33a0236 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4445,7 +4445,7 @@ MODULE_SCOPE int TclIsPureByteArray(Tcl_Obj *objPtr); /* *---------------------------------------------------------------- - * Macro used by the Tcl core to increment a namespace's export export epoch + * Macro used by the Tcl core to increment a namespace's export epoch * counter. The ANSI C "prototype" for this macro is: * * MODULE_SCOPE void TclInvalidateNsCmdLookup(Namespace *nsPtr); diff --git a/generic/tclProc.c b/generic/tclProc.c index 96bdcf3..8fc6dcb 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -393,13 +393,13 @@ TclCreateProc( Proc **procPtrPtr) /* Returns: pointer to proc data. */ { Interp *iPtr = (Interp *) interp; - const char **argArray = NULL; register Proc *procPtr; - int i, length, result, numArgs; - const char *args, *bytes, *p; + int i, result, numArgs, plen; + const char *bytes, *argname, *argnamei; + char argnamelast; register CompiledLocal *localPtr = NULL; - Tcl_Obj *defPtr; + Tcl_Obj *defPtr, *errorObj, **argArray; int precompiled = 0; if (bodyPtr->typePtr == &tclProcBodyType) { @@ -436,6 +436,7 @@ TclCreateProc( */ if (Tcl_IsShared(bodyPtr)) { + int length; Tcl_Obj *sharedBodyPtr = bodyPtr; bytes = TclGetStringFromObj(bodyPtr, &length); @@ -473,12 +474,9 @@ TclCreateProc( * argument specifier. If the body is precompiled, processing is limited * to checking that the parsed argument is consistent with the one stored * in the Proc. - * - * THIS FAILS IF THE ARG LIST OBJECT'S STRING REP CONTAINS NULS. */ - args = TclGetStringFromObj(argsPtr, &length); - result = Tcl_SplitList(interp, args, &numArgs, &argArray); + result = Tcl_ListObjGetElements(interp , argsPtr ,&numArgs ,&argArray); if (result != TCL_OK) { goto procError; } @@ -502,28 +500,28 @@ TclCreateProc( for (i = 0; i < numArgs; i++) { int fieldCount, nameLength; size_t valueLength; - const char **fieldValues; + Tcl_Obj **fieldValues; /* * Now divide the specifier up into name and default. */ - result = Tcl_SplitList(interp, argArray[i], &fieldCount, + result = Tcl_ListObjGetElements(interp, argArray[i], &fieldCount, &fieldValues); if (result != TCL_OK) { goto procError; } if (fieldCount > 2) { - ckfree(fieldValues); - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "too many fields in argument specifier \"%s\"", - argArray[i])); + errorObj = Tcl_NewStringObj( + "too many fields in argument specifier \"", -1); + Tcl_AppendObjToObj(errorObj, argArray[i]); + Tcl_AppendToObj(errorObj, "\"", -1); + Tcl_SetObjResult(interp, errorObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "FORMALARGUMENTFORMAT", NULL); goto procError; } - if ((fieldCount == 0) || (*fieldValues[0] == 0)) { - ckfree(fieldValues); + if ((fieldCount == 0) || (fieldValues[0]->length == 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "argument with no name", -1)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", @@ -531,9 +529,10 @@ TclCreateProc( goto procError; } - nameLength = strlen(fieldValues[0]); + nameLength = Tcl_NumUtfChars(Tcl_GetString(fieldValues[0]), fieldValues[0]->length); if (fieldCount == 2) { - valueLength = strlen(fieldValues[1]); + valueLength = Tcl_NumUtfChars(Tcl_GetString(fieldValues[1]), + fieldValues[1]->length); } else { valueLength = 0; } @@ -542,33 +541,29 @@ TclCreateProc( * Check that the formal parameter name is a scalar. */ - p = fieldValues[0]; - while (*p != '\0') { - if (*p == '(') { - const char *q = p; - do { - q++; - } while (*q != '\0'); - q--; - if (*q == ')') { /* We have an array element. */ + argname = Tcl_GetStringFromObj(fieldValues[0], &plen); + argnamei = argname; + argnamelast = argname[plen-1]; + while (plen--) { + if (argnamei[0] == '(') { + if (argnamelast == ')') { /* We have an array element. */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "formal parameter \"%s\" is an array element", - fieldValues[0])); - ckfree(fieldValues); + Tcl_GetString(fieldValues[0]))); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "FORMALARGUMENTFORMAT", NULL); goto procError; } - } else if ((*p == ':') && (*(p+1) == ':')) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "formal parameter \"%s\" is not a simple name", - fieldValues[0])); - ckfree(fieldValues); + } else if ((argnamei[0] == ':') && (argnamei[1] == ':')) { + errorObj = Tcl_NewStringObj("formal parameter \"", -1); + Tcl_AppendObjToObj(errorObj, fieldValues[0]); + Tcl_AppendToObj(errorObj, "\" is not a simple name", -1); + Tcl_SetObjResult(interp, errorObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "FORMALARGUMENTFORMAT", NULL); goto procError; } - p++; + argnamei = Tcl_UtfNext(argnamei); } if (precompiled) { @@ -584,7 +579,7 @@ TclCreateProc( */ if ((localPtr->nameLength != nameLength) - || (strcmp(localPtr->name, fieldValues[0])) + || (Tcl_UtfNcmp(localPtr->name, argname, nameLength)) || (localPtr->frameIndex != i) || !(localPtr->flags & VAR_ARGUMENT) || (localPtr->defValuePtr == NULL && fieldCount == 2) @@ -592,7 +587,6 @@ TclCreateProc( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "procedure \"%s\": formal parameter %d is " "inconsistent with precompiled body", procName, i)); - ckfree(fieldValues); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "BYTECODELIES", NULL); goto procError; @@ -607,12 +601,13 @@ TclCreateProc( size_t tmpLength = localPtr->defValuePtr->length; if ((valueLength != tmpLength) || - strncmp(fieldValues[1], tmpPtr, tmpLength)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "procedure \"%s\": formal parameter \"%s\" has " - "default value inconsistent with precompiled body", - procName, fieldValues[0])); - ckfree(fieldValues); + Tcl_UtfNcmp(Tcl_GetString(fieldValues[1]), tmpPtr, tmpLength)) { + errorObj = Tcl_ObjPrintf( + "procedure \"%s\": formal parameter \"" ,procName); + Tcl_AppendObjToObj(errorObj, fieldValues[0]); + Tcl_AppendToObj(errorObj, "\" has " + "default value inconsistent with precompiled body", -1); + Tcl_SetObjResult(interp, errorObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "BYTECODELIES", NULL); goto procError; @@ -632,7 +627,7 @@ TclCreateProc( * local variables for the argument. */ - localPtr = ckalloc(TclOffset(CompiledLocal, name) + nameLength+1); + localPtr = ckalloc(TclOffset(CompiledLocal, name) + fieldValues[0]->length +1); if (procPtr->firstLocalPtr == NULL) { procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr; } else { @@ -640,19 +635,18 @@ TclCreateProc( procPtr->lastLocalPtr = localPtr; } localPtr->nextPtr = NULL; - localPtr->nameLength = nameLength; + localPtr->nameLength = Tcl_NumUtfChars(argname, fieldValues[0]->length); localPtr->frameIndex = i; localPtr->flags = VAR_ARGUMENT; localPtr->resolveInfo = NULL; if (fieldCount == 2) { - localPtr->defValuePtr = - Tcl_NewStringObj(fieldValues[1], valueLength); + localPtr->defValuePtr = fieldValues[1]; Tcl_IncrRefCount(localPtr->defValuePtr); } else { localPtr->defValuePtr = NULL; } - memcpy(localPtr->name, fieldValues[0], nameLength + 1); + memcpy(localPtr->name, argname, fieldValues[0]->length + 1); if ((i == numArgs - 1) && (localPtr->nameLength == 4) && (localPtr->name[0] == 'a') @@ -660,12 +654,9 @@ TclCreateProc( localPtr->flags |= VAR_IS_ARGS; } } - - ckfree(fieldValues); } *procPtrPtr = procPtr; - ckfree(argArray); return TCL_OK; procError: @@ -686,9 +677,6 @@ TclCreateProc( } ckfree(procPtr); } - if (argArray != NULL) { - ckfree(argArray); - } return TCL_ERROR; } -- cgit v0.12 From 98c6b22c1002fae94f8abf7422758530a9a6fdeb Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 8 Nov 2017 02:21:49 +0000 Subject: TclOO object allocation: Set classPtr to NULL if it wasn't otherwise set. --- generic/tclOO.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index ec666ee..f236ac9 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -537,7 +537,8 @@ KillFoundation( * AllocObject -- * * Allocate an object of basic type. Does not splice the object into its - * class's instance list. + * class's instance list. The caller must set the classPtr on the object, + * either to a class or to NULL. * * ---------------------------------------------------------------------- */ @@ -1672,6 +1673,8 @@ Tcl_NewObjectInstance( AllocClass(interp, oPtr); oPtr->selfCls = classPtr; TclOOAddToSubclasses(oPtr->classPtr, fPtr->objectCls); + } else { + oPtr->classPtr = NULL; } /* -- cgit v0.12 From 2ba5fab30eefc4f31112e67aeba2dd49a178ff4c Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 8 Nov 2017 02:25:40 +0000 Subject: Modify TclCreateProc to handle arbitrary argument names, not just ASCII. --- generic/tclExecute.c | 4 +-- generic/tclInt.h | 2 +- generic/tclProc.c | 96 +++++++++++++++++++++++----------------------------- 3 files changed, 45 insertions(+), 57 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f4c71ec..54c73fd 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1333,12 +1333,12 @@ TclStackAlloc( int numBytes) { Interp *iPtr = (Interp *) interp; - int numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *); + int numWords; if (iPtr == NULL || iPtr->execEnvPtr == NULL) { return (void *) ckalloc(numBytes); } - + numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *); return (void *) StackAllocWords(interp, numWords); } diff --git a/generic/tclInt.h b/generic/tclInt.h index 0d68e8e..29392b6 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4483,7 +4483,7 @@ MODULE_SCOPE int TclIsPureByteArray(Tcl_Obj *objPtr); /* *---------------------------------------------------------------- - * Macro used by the Tcl core to increment a namespace's export export epoch + * Macro used by the Tcl core to increment a namespace's export epoch * counter. The ANSI C "prototype" for this macro is: * * MODULE_SCOPE void TclInvalidateNsCmdLookup(Namespace *nsPtr); diff --git a/generic/tclProc.c b/generic/tclProc.c index 96bdcf3..8fc6dcb 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -393,13 +393,13 @@ TclCreateProc( Proc **procPtrPtr) /* Returns: pointer to proc data. */ { Interp *iPtr = (Interp *) interp; - const char **argArray = NULL; register Proc *procPtr; - int i, length, result, numArgs; - const char *args, *bytes, *p; + int i, result, numArgs, plen; + const char *bytes, *argname, *argnamei; + char argnamelast; register CompiledLocal *localPtr = NULL; - Tcl_Obj *defPtr; + Tcl_Obj *defPtr, *errorObj, **argArray; int precompiled = 0; if (bodyPtr->typePtr == &tclProcBodyType) { @@ -436,6 +436,7 @@ TclCreateProc( */ if (Tcl_IsShared(bodyPtr)) { + int length; Tcl_Obj *sharedBodyPtr = bodyPtr; bytes = TclGetStringFromObj(bodyPtr, &length); @@ -473,12 +474,9 @@ TclCreateProc( * argument specifier. If the body is precompiled, processing is limited * to checking that the parsed argument is consistent with the one stored * in the Proc. - * - * THIS FAILS IF THE ARG LIST OBJECT'S STRING REP CONTAINS NULS. */ - args = TclGetStringFromObj(argsPtr, &length); - result = Tcl_SplitList(interp, args, &numArgs, &argArray); + result = Tcl_ListObjGetElements(interp , argsPtr ,&numArgs ,&argArray); if (result != TCL_OK) { goto procError; } @@ -502,28 +500,28 @@ TclCreateProc( for (i = 0; i < numArgs; i++) { int fieldCount, nameLength; size_t valueLength; - const char **fieldValues; + Tcl_Obj **fieldValues; /* * Now divide the specifier up into name and default. */ - result = Tcl_SplitList(interp, argArray[i], &fieldCount, + result = Tcl_ListObjGetElements(interp, argArray[i], &fieldCount, &fieldValues); if (result != TCL_OK) { goto procError; } if (fieldCount > 2) { - ckfree(fieldValues); - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "too many fields in argument specifier \"%s\"", - argArray[i])); + errorObj = Tcl_NewStringObj( + "too many fields in argument specifier \"", -1); + Tcl_AppendObjToObj(errorObj, argArray[i]); + Tcl_AppendToObj(errorObj, "\"", -1); + Tcl_SetObjResult(interp, errorObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "FORMALARGUMENTFORMAT", NULL); goto procError; } - if ((fieldCount == 0) || (*fieldValues[0] == 0)) { - ckfree(fieldValues); + if ((fieldCount == 0) || (fieldValues[0]->length == 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "argument with no name", -1)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", @@ -531,9 +529,10 @@ TclCreateProc( goto procError; } - nameLength = strlen(fieldValues[0]); + nameLength = Tcl_NumUtfChars(Tcl_GetString(fieldValues[0]), fieldValues[0]->length); if (fieldCount == 2) { - valueLength = strlen(fieldValues[1]); + valueLength = Tcl_NumUtfChars(Tcl_GetString(fieldValues[1]), + fieldValues[1]->length); } else { valueLength = 0; } @@ -542,33 +541,29 @@ TclCreateProc( * Check that the formal parameter name is a scalar. */ - p = fieldValues[0]; - while (*p != '\0') { - if (*p == '(') { - const char *q = p; - do { - q++; - } while (*q != '\0'); - q--; - if (*q == ')') { /* We have an array element. */ + argname = Tcl_GetStringFromObj(fieldValues[0], &plen); + argnamei = argname; + argnamelast = argname[plen-1]; + while (plen--) { + if (argnamei[0] == '(') { + if (argnamelast == ')') { /* We have an array element. */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "formal parameter \"%s\" is an array element", - fieldValues[0])); - ckfree(fieldValues); + Tcl_GetString(fieldValues[0]))); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "FORMALARGUMENTFORMAT", NULL); goto procError; } - } else if ((*p == ':') && (*(p+1) == ':')) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "formal parameter \"%s\" is not a simple name", - fieldValues[0])); - ckfree(fieldValues); + } else if ((argnamei[0] == ':') && (argnamei[1] == ':')) { + errorObj = Tcl_NewStringObj("formal parameter \"", -1); + Tcl_AppendObjToObj(errorObj, fieldValues[0]); + Tcl_AppendToObj(errorObj, "\" is not a simple name", -1); + Tcl_SetObjResult(interp, errorObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "FORMALARGUMENTFORMAT", NULL); goto procError; } - p++; + argnamei = Tcl_UtfNext(argnamei); } if (precompiled) { @@ -584,7 +579,7 @@ TclCreateProc( */ if ((localPtr->nameLength != nameLength) - || (strcmp(localPtr->name, fieldValues[0])) + || (Tcl_UtfNcmp(localPtr->name, argname, nameLength)) || (localPtr->frameIndex != i) || !(localPtr->flags & VAR_ARGUMENT) || (localPtr->defValuePtr == NULL && fieldCount == 2) @@ -592,7 +587,6 @@ TclCreateProc( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "procedure \"%s\": formal parameter %d is " "inconsistent with precompiled body", procName, i)); - ckfree(fieldValues); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "BYTECODELIES", NULL); goto procError; @@ -607,12 +601,13 @@ TclCreateProc( size_t tmpLength = localPtr->defValuePtr->length; if ((valueLength != tmpLength) || - strncmp(fieldValues[1], tmpPtr, tmpLength)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "procedure \"%s\": formal parameter \"%s\" has " - "default value inconsistent with precompiled body", - procName, fieldValues[0])); - ckfree(fieldValues); + Tcl_UtfNcmp(Tcl_GetString(fieldValues[1]), tmpPtr, tmpLength)) { + errorObj = Tcl_ObjPrintf( + "procedure \"%s\": formal parameter \"" ,procName); + Tcl_AppendObjToObj(errorObj, fieldValues[0]); + Tcl_AppendToObj(errorObj, "\" has " + "default value inconsistent with precompiled body", -1); + Tcl_SetObjResult(interp, errorObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "BYTECODELIES", NULL); goto procError; @@ -632,7 +627,7 @@ TclCreateProc( * local variables for the argument. */ - localPtr = ckalloc(TclOffset(CompiledLocal, name) + nameLength+1); + localPtr = ckalloc(TclOffset(CompiledLocal, name) + fieldValues[0]->length +1); if (procPtr->firstLocalPtr == NULL) { procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr; } else { @@ -640,19 +635,18 @@ TclCreateProc( procPtr->lastLocalPtr = localPtr; } localPtr->nextPtr = NULL; - localPtr->nameLength = nameLength; + localPtr->nameLength = Tcl_NumUtfChars(argname, fieldValues[0]->length); localPtr->frameIndex = i; localPtr->flags = VAR_ARGUMENT; localPtr->resolveInfo = NULL; if (fieldCount == 2) { - localPtr->defValuePtr = - Tcl_NewStringObj(fieldValues[1], valueLength); + localPtr->defValuePtr = fieldValues[1]; Tcl_IncrRefCount(localPtr->defValuePtr); } else { localPtr->defValuePtr = NULL; } - memcpy(localPtr->name, fieldValues[0], nameLength + 1); + memcpy(localPtr->name, argname, fieldValues[0]->length + 1); if ((i == numArgs - 1) && (localPtr->nameLength == 4) && (localPtr->name[0] == 'a') @@ -660,12 +654,9 @@ TclCreateProc( localPtr->flags |= VAR_IS_ARGS; } } - - ckfree(fieldValues); } *procPtrPtr = procPtr; - ckfree(argArray); return TCL_OK; procError: @@ -686,9 +677,6 @@ TclCreateProc( } ckfree(procPtr); } - if (argArray != NULL) { - ckfree(argArray); - } return TCL_ERROR; } -- cgit v0.12 From f31af075d052f3285352b8c4c10174baef2eee4a Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 8 Nov 2017 02:50:28 +0000 Subject: compiler warning --- generic/tclHash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclHash.c b/generic/tclHash.c index b553c68..5d6ea86 100644 --- a/generic/tclHash.c +++ b/generic/tclHash.c @@ -1020,7 +1020,7 @@ RebuildTable( const Tcl_HashKeyType *typePtr; /* Avoid outgrowing capability of the memory allocators */ - if (oldSize > UINT_MAX / (4 * sizeof(Tcl_HashEntry *))) { + if (oldSize > (int)(UINT_MAX / (4 * sizeof(Tcl_HashEntry *)))) { tablePtr->rebuildSize = INT_MAX; return; } -- cgit v0.12 From 12d3a7d307b177672437966afd5673f994b757f8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 8 Nov 2017 09:37:31 +0000 Subject: Change "epoch" field for dicts from "int" to "unsigned int". This doubles the number of available epoch's before overflow. Also make 0 the special value in stead of -1, meaning "dict search done". That also means that epoch counting starts with 1. --- generic/tcl.h | 4 ++-- generic/tclDictObj.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 07d841d..80c8dcb 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -1344,8 +1344,8 @@ typedef struct Tcl_HashSearch { typedef struct { void *next; /* Search position for underlying hash * table. */ - int epoch; /* Epoch marker for dictionary being searched, - * or -1 if search has terminated. */ + unsigned int epoch; /* Epoch marker for dictionary being searched, + * or 0 if search has terminated. */ Tcl_Dict dictionaryPtr; /* Reference to dictionary being searched. */ } Tcl_DictSearch; diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 1c74c5f..b1962e6 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -141,7 +141,7 @@ typedef struct Dict { * the dictionary. Used for doing traversal of * the entries in the order that they are * created. */ - int epoch; /* Epoch counter */ + unsigned int epoch; /* Epoch counter */ size_t refCount; /* Reference counter (see above) */ Tcl_Obj *chain; /* Linked list used for invalidating the * string representations of updated nested @@ -390,7 +390,7 @@ DupDictInternalRep( * Initialise other fields. */ - newDict->epoch = 0; + newDict->epoch = 1; newDict->chain = NULL; newDict->refCount = 1; @@ -710,7 +710,7 @@ SetDictFromAny( */ TclFreeIntRep(objPtr); - dict->epoch = 0; + dict->epoch = 1; dict->chain = NULL; dict->refCount = 1; DICT(objPtr) = dict; @@ -1109,7 +1109,7 @@ Tcl_DictObjFirst( dict = DICT(dictPtr); cPtr = dict->entryChainHead; if (cPtr == NULL) { - searchPtr->epoch = -1; + searchPtr->epoch = 0; *donePtr = 1; } else { *donePtr = 0; @@ -1170,7 +1170,7 @@ Tcl_DictObjNext( * If the searh is done; we do no work. */ - if (searchPtr->epoch == -1) { + if (!searchPtr->epoch) { *donePtr = 1; return; } @@ -1227,8 +1227,8 @@ Tcl_DictObjDone( { Dict *dict; - if (searchPtr->epoch != -1) { - searchPtr->epoch = -1; + if (searchPtr->epoch) { + searchPtr->epoch = 0; dict = (Dict *) searchPtr->dictionaryPtr; if (dict->refCount-- <= 1) { DeleteDict(dict); @@ -1380,7 +1380,7 @@ Tcl_NewDictObj(void) TclInvalidateStringRep(dictPtr); dict = ckalloc(sizeof(Dict)); InitChainTable(dict); - dict->epoch = 0; + dict->epoch = 1; dict->chain = NULL; dict->refCount = 1; DICT(dictPtr) = dict; @@ -1430,7 +1430,7 @@ Tcl_DbNewDictObj( TclInvalidateStringRep(dictPtr); dict = ckalloc(sizeof(Dict)); InitChainTable(dict); - dict->epoch = 0; + dict->epoch = 1; dict->chain = NULL; dict->refCount = 1; DICT(dictPtr) = dict; -- cgit v0.12 From b2722c42b1a43b10ba1047b6be28d5b4663732b8 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Wed, 8 Nov 2017 09:41:00 +0000 Subject: Pairing down the tip#430 branch to only include files and utilities called out by the tip. Eliminated the header files tclZipfs.h and zcrypt.h. The only public calls for tclZipfs.h are now in the stubs table and the contents of zcrypt.h are already part of the minizip implementation that Tcl keeps around in the compat/zlib/contrib/minizip directory. tclBootVFS.h hasn't been used by the implementation in a while. Alos eliminated the mkzip.tcl facility from tools/. The C based mkzip is much faster and more reliable --- doc/zipfs.3 | 21 +----- generic/tclBootVfs.h | 24 ------- generic/tclZipfs.c | 6 +- generic/tclZipfs.h | 48 ------------- generic/zcrypt.h | 131 ---------------------------------- tools/mkVfs.tcl | 198 +++++++++++++++++++++++++-------------------------- tools/mkzip.tcl | 5 -- unix/Makefile.in | 4 +- win/Makefile.in | 6 +- win/makefile.vc | 4 +- 10 files changed, 113 insertions(+), 334 deletions(-) delete mode 100644 generic/tclBootVfs.h delete mode 100644 generic/tclZipfs.h delete mode 100644 generic/zcrypt.h delete mode 100644 tools/mkzip.tcl diff --git a/doc/zipfs.3 b/doc/zipfs.3 index 6846f58..a3b3da8 100644 --- a/doc/zipfs.3 +++ b/doc/zipfs.3 @@ -1,24 +1,18 @@ '\" '\" Copyright (c) 2015 Jan Nijtmans '\" Copyright (c) 2015 Christian Werner +'\" Copyright (c) 2017 Sean Woods '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" +'\" .TH Tclzipfs 3 8.7 Tcl "Tcl Library Procedures" .so man.macros .BS .SH NAME -Tclzipfs_Init, Tclzipfs_SafeInit, Tclzipfs_Mount, Tclzipfs_Unmount \- handle ZIP files as VFS +Tclzipfs_Mount, Tclzipfs_Unmount \- handle ZIP files as VFS .SH SYNOPSIS .nf -\fB#include \fR -.sp -int -\fBTclzipfs_Init\fR(\fIinterp\fR) -.sp -int -\fBTclzipfs_SafeInit\fR(\fIinterp\fR) .sp int \fBTclzipfs_Mount\fR(\fIinterp, zipname, mntpt, passwd\fR) @@ -38,15 +32,6 @@ Name of a mount point. An (optional) password. .BE .SH DESCRIPTION -\fBTclzipfs_Init()\fR performs one-time initialization of the file system -and registers it process wide. Additionally, a package named \fIzipfs\fR -is provided and supplemental Tcl commands are created in the given -interpreter \fIinterp\fR. -.PP -\fBTclzipfs_SafeInit()\fR is the version of \fBTclzipfs_Init()\fR for -safe interpreters. It exposes only uncritical supplemental Tcl commands -in the given interpreter \fIinterp\fR. -.PP \fBTclzipfs_Mount()\fR mount the ZIP archive \fIzipname\fR on the mount point given in \fImntpt\fR using the optional ZIP password \fIpasswd\fR. Errors during that process are reported in the interpreter \fIinterp\fR. diff --git a/generic/tclBootVfs.h b/generic/tclBootVfs.h deleted file mode 100644 index 1cb7c23..0000000 --- a/generic/tclBootVfs.h +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include "tclInt.h" -#include "tclFileSystem.h" - -#ifndef MODULE_SCOPE -# define MODULE_SCOPE extern -#endif - -#define TCLVFSBOOT_INIT "main.tcl" -#define TCLVFSBOOT_MOUNT "/zvfs" - -/* Make sure the stubbed variants of those are never used. */ -#undef Tcl_ObjSetVar2 -#undef Tcl_NewStringObj -#undef Tk_Init -#undef Tk_MainEx -#undef Tk_SafeInit - -MODULE_SCOPE int Tcl_Zvfs_Boot(const char *,const char *,const char *); -MODULE_SCOPE int Zvfs_Init(Tcl_Interp *); -MODULE_SCOPE int Zvfs_SafeInit(Tcl_Interp *); -MODULE_SCOPE int Tclkit_Packages_Init(Tcl_Interp *); - - diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 9d74890..fe4553e 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -4,7 +4,7 @@ * Implementation of the ZIP filesystem used in TIP 430 * Adapted from the implentation for AndroWish. * - * Coptright (c) 2016 Sean Woods + * Coptright (c) 2016-2017 Sean Woods * Copyright (c) 2013-2015 Christian Werner * * See the file "license.terms" for information on usage and redistribution of @@ -26,7 +26,7 @@ #ifdef HAVE_ZLIB #include "zlib.h" -#include "zcrypt.h" +#include "crypt.h" #define ZIPFS_VOLUME "zipfs:/" #define ZIPFS_VOLUME_LEN 7 @@ -235,7 +235,7 @@ static const char pwrot[16] = { * Table to compute CRC32. */ -static const unsigned int crc32tab[256] = { +static const unsigned long crc32tab[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, diff --git a/generic/tclZipfs.h b/generic/tclZipfs.h deleted file mode 100644 index f7da3bd..0000000 --- a/generic/tclZipfs.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * tclZipfs.h -- - * - * This header file describes the interface of the ZIPFS filesystem - * - * Copyright (c) 2013-2015 Christian Werner - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ - -#ifndef _ZIPFS_H -#define _ZIPFS_H - -#include "tcl.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef ZIPFSAPI -# define ZIPFSAPI extern -#endif - -#ifdef BUILD_tcl -# undef ZIPFSAPI -# define ZIPFSAPI DLLEXPORT -#endif - -ZIPFSAPI int TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, - const char *mntpt, const char *passwd); -ZIPFSAPI int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname); -ZIPFSAPI int TclZipfs_Init(Tcl_Interp *interp); -ZIPFSAPI int TclZipfs_SafeInit(Tcl_Interp *interp); - -#ifdef __cplusplus -} -#endif - -#endif /* _ZIPFS_H */ - -/* - * Local Variables: - * mode: c - * c-basic-offset: 4 - * fill-column: 78 - * End: - */ diff --git a/generic/zcrypt.h b/generic/zcrypt.h deleted file mode 100644 index eb9865b..0000000 --- a/generic/zcrypt.h +++ /dev/null @@ -1,131 +0,0 @@ -/* crypt.h -- base code for crypt/uncrypt ZIPfile - - - Version 1.01e, February 12th, 2005 - - Copyright (C) 1998-2005 Gilles Vollant - - This code is a modified version of crypting code in Infozip distribution - - The encryption/decryption parts of this source code (as opposed to the - non-echoing password parts) were originally written in Europe. The - whole source package can be freely distributed, including from the USA. - (Prior to January 2000, re-export from the US was a violation of US law.) - - This encryption code is a direct transcription of the algorithm from - Roger Schlafly, described by Phil Katz in the file appnote.txt. This - file (appnote.txt) is distributed with the PKZIP program (even in the - version without encryption capabilities). - - If you don't need crypting in your application, just define symbols - NOCRYPT and NOUNCRYPT. - - This code support the "Traditional PKWARE Encryption". - - The new AES encryption added on Zip format by Winzip (see the page - http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong - Encryption is not supported. -*/ - -#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) - -/*********************************************************************** - * Return the next byte in the pseudo-random sequence - */ -static int decrypt_byte(unsigned long* pkeys, const unsigned int* pcrc_32_tab) -{ - unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an - * unpredictable manner on 16-bit systems; not a problem - * with any known compiler so far, though */ - - temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; - return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); -} - -/*********************************************************************** - * Update the encryption keys with the next byte of plain text - */ -static int update_keys(unsigned long* pkeys,const unsigned int* pcrc_32_tab,int c) -{ - (*(pkeys+0)) = CRC32((*(pkeys+0)), c); - (*(pkeys+1)) += (*(pkeys+0)) & 0xff; - (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; - { - register int keyshift = (int)((*(pkeys+1)) >> 24); - (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); - } - return c; -} - - -/*********************************************************************** - * Initialize the encryption keys and the random header according to - * the given password. - */ -static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned int* pcrc_32_tab) -{ - *(pkeys+0) = 305419896L; - *(pkeys+1) = 591751049L; - *(pkeys+2) = 878082192L; - while (*passwd != '\0') { - update_keys(pkeys,pcrc_32_tab,(int)*passwd); - passwd++; - } -} - -#define zdecode(pkeys,pcrc_32_tab,c) \ - (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) - -#define zencode(pkeys,pcrc_32_tab,c,t) \ - (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) - -#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED - -#define RAND_HEAD_LEN 12 - /* "last resort" source for second part of crypt seed pattern */ -# ifndef ZCR_SEED2 -# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ -# endif - -static int crypthead(const char* passwd, /* password string */ - unsigned char* buf, /* where to write header */ - int bufSize, - unsigned long* pkeys, - const unsigned int* pcrc_32_tab, - unsigned long crcForCrypting) -{ - int n; /* index in random header */ - int t; /* temporary */ - int c; /* random byte */ - unsigned char header[RAND_HEAD_LEN-2]; /* random header */ - static unsigned calls = 0; /* ensure different random header each time */ - - if (bufSize> 7) & 0xff; - header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); - } - /* Encrypt random header (last two bytes is high word of crc) */ - init_keys(passwd, pkeys, pcrc_32_tab); - for (n = 0; n < RAND_HEAD_LEN-2; n++) - { - buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); - } - buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); - buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); - return n; -} - -#endif diff --git a/tools/mkVfs.tcl b/tools/mkVfs.tcl index e670775..cbfb81e 100644 --- a/tools/mkVfs.tcl +++ b/tools/mkVfs.tcl @@ -1,99 +1,99 @@ -proc cat fname { - set fname [open $fname r] - set data [read $fname] - close $fname - return $data -} - -proc pkgIndexDir {root fout d1} { - - puts [format {%*sIndexing %s} [expr {4 * [info level]}] {} \ - [file tail $d1]] - set idx [string length $root] - foreach ftail [glob -directory $d1 -nocomplain -tails *] { - set f [file join $d1 $ftail] - if {[file isdirectory $f] && [string compare CVS $ftail]} { - pkgIndexDir $root $fout $f - } elseif {[file tail $f] eq "pkgIndex.tcl"} { - puts $fout "set dir \${VFSROOT}[string range $d1 $idx end]" - puts $fout [cat $f] - } - } -} - -### -# Script to build the VFS file system -### -proc copyDir {d1 d2} { - - puts [format {%*sCreating %s} [expr {4 * [info level]}] {} \ - [file tail $d2]] - - file delete -force -- $d2 - file mkdir $d2 - - foreach ftail [glob -directory $d1 -nocomplain -tails *] { - set f [file join $d1 $ftail] - if {[file isdirectory $f] && [string compare CVS $ftail]} { - copyDir $f [file join $d2 $ftail] - } elseif {[file isfile $f]} { - file copy -force $f [file join $d2 $ftail] - if {$::tcl_platform(platform) eq {unix}} { - file attributes [file join $d2 $ftail] -permissions 0644 - } else { - file attributes [file join $d2 $ftail] -readonly 1 - } - } - } - - if {$::tcl_platform(platform) eq {unix}} { - file attributes $d2 -permissions 0755 - } else { - file attributes $d2 -readonly 1 - } -} - -if {[llength $argv] < 3} { - puts "Usage: VFS_ROOT TCLSRC_ROOT PLATFORM" - exit 1 -} -set TCL_SCRIPT_DIR [lindex $argv 0] -set TCLSRC_ROOT [lindex $argv 1] -set PLATFORM [lindex $argv 2] -set TKDLL [lindex $argv 3] -set TKVER [lindex $argv 4] - -puts "Building [file tail $TCL_SCRIPT_DIR] for $PLATFORM" -copyDir ${TCLSRC_ROOT}/library ${TCL_SCRIPT_DIR} - -if {$PLATFORM == "windows"} { - set ddedll [glob -nocomplain ${TCLSRC_ROOT}/win/tcldde*.dll] - puts "DDE DLL $ddedll" - if {$ddedll != {}} { - file copy $ddedll ${TCL_SCRIPT_DIR}/dde - } - set regdll [glob -nocomplain ${TCLSRC_ROOT}/win/tclreg*.dll] - puts "REG DLL $ddedll" - if {$regdll != {}} { - file copy $regdll ${TCL_SCRIPT_DIR}/reg - } -} else { - # Remove the dde and reg package paths - file delete -force ${TCL_SCRIPT_DIR}/dde - file delete -force ${TCL_SCRIPT_DIR}/reg -} - -# For the following packages, cat their pkgIndex files to tclIndex -file attributes ${TCL_SCRIPT_DIR}/tclIndex -readonly 0 -set fout [open ${TCL_SCRIPT_DIR}/tclIndex a] -puts $fout {# -# MANIFEST OF INCLUDED PACKAGES -# -set VFSROOT $dir -} -if {$TKDLL ne {} && [file exists $TKDLL]} { - file copy $TKDLL ${TCL_SCRIPT_DIR} - puts $fout [list package ifneeded Tk $TKVER "load \$dir $TKDLL"] -} -pkgIndexDir ${TCL_SCRIPT_DIR} $fout ${TCL_SCRIPT_DIR} -close $fout +proc cat fname { + set fname [open $fname r] + set data [read $fname] + close $fname + return $data +} + +proc pkgIndexDir {root fout d1} { + + puts [format {%*sIndexing %s} [expr {4 * [info level]}] {} \ + [file tail $d1]] + set idx [string length $root] + foreach ftail [glob -directory $d1 -nocomplain -tails *] { + set f [file join $d1 $ftail] + if {[file isdirectory $f] && [string compare CVS $ftail]} { + pkgIndexDir $root $fout $f + } elseif {[file tail $f] eq "pkgIndex.tcl"} { + puts $fout "set dir \${VFSROOT}[string range $d1 $idx end]" + puts $fout [cat $f] + } + } +} + +### +# Script to build the VFS file system +### +proc copyDir {d1 d2} { + + puts [format {%*sCreating %s} [expr {4 * [info level]}] {} \ + [file tail $d2]] + + file delete -force -- $d2 + file mkdir $d2 + + foreach ftail [glob -directory $d1 -nocomplain -tails *] { + set f [file join $d1 $ftail] + if {[file isdirectory $f] && [string compare CVS $ftail]} { + copyDir $f [file join $d2 $ftail] + } elseif {[file isfile $f]} { + file copy -force $f [file join $d2 $ftail] + if {$::tcl_platform(platform) eq {unix}} { + file attributes [file join $d2 $ftail] -permissions 0644 + } else { + file attributes [file join $d2 $ftail] -readonly 1 + } + } + } + + if {$::tcl_platform(platform) eq {unix}} { + file attributes $d2 -permissions 0755 + } else { + file attributes $d2 -readonly 1 + } +} + +if {[llength $argv] < 3} { + puts "Usage: VFS_ROOT TCLSRC_ROOT PLATFORM" + exit 1 +} +set TCL_SCRIPT_DIR [lindex $argv 0] +set TCLSRC_ROOT [lindex $argv 1] +set PLATFORM [lindex $argv 2] +set TKDLL [lindex $argv 3] +set TKVER [lindex $argv 4] + +puts "Building [file tail $TCL_SCRIPT_DIR] for $PLATFORM" +copyDir ${TCLSRC_ROOT}/library ${TCL_SCRIPT_DIR} + +if {$PLATFORM == "windows"} { + set ddedll [glob -nocomplain ${TCLSRC_ROOT}/win/tcldde*.dll] + puts "DDE DLL $ddedll" + if {$ddedll != {}} { + file copy $ddedll ${TCL_SCRIPT_DIR}/dde + } + set regdll [glob -nocomplain ${TCLSRC_ROOT}/win/tclreg*.dll] + puts "REG DLL $ddedll" + if {$regdll != {}} { + file copy $regdll ${TCL_SCRIPT_DIR}/reg + } +} else { + # Remove the dde and reg package paths + file delete -force ${TCL_SCRIPT_DIR}/dde + file delete -force ${TCL_SCRIPT_DIR}/reg +} + +# For the following packages, cat their pkgIndex files to tclIndex +file attributes ${TCL_SCRIPT_DIR}/tclIndex -readonly 0 +set fout [open ${TCL_SCRIPT_DIR}/tclIndex a] +puts $fout {# +# MANIFEST OF INCLUDED PACKAGES +# +set VFSROOT $dir +} +if {$TKDLL ne {} && [file exists $TKDLL]} { + file copy $TKDLL ${TCL_SCRIPT_DIR} + puts $fout [list package ifneeded Tk $TKVER "load \$dir $TKDLL"] +} +pkgIndexDir ${TCL_SCRIPT_DIR} $fout ${TCL_SCRIPT_DIR} +close $fout diff --git a/tools/mkzip.tcl b/tools/mkzip.tcl deleted file mode 100644 index ba10908..0000000 --- a/tools/mkzip.tcl +++ /dev/null @@ -1,5 +0,0 @@ -### -# Wrapper to allow access to Tcl's zvfs::mkzip command from Makefiles -### -source [file join [file dirname [file normalize [info script]]] .. library zvfstools zvfstools.tcl] -zvfs::mkzip {*}$argv diff --git a/unix/Makefile.in b/unix/Makefile.in index ee3ed75..5f4e125 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -373,7 +373,6 @@ GENERIC_HDRS = \ $(GENERIC_DIR)/tclInt.h \ $(GENERIC_DIR)/tclIntDecls.h \ $(GENERIC_DIR)/tclIntPlatDecls.h \ - $(GENERIC_DIR)/tclZipfs.h \ $(GENERIC_DIR)/tclTomMath.h \ $(GENERIC_DIR)/tclTomMathDecls.h \ $(GENERIC_DIR)/tclOO.h \ @@ -962,7 +961,6 @@ install-headers: @for i in $(GENERIC_DIR)/tcl.h $(GENERIC_DIR)/tclDecls.h \ $(GENERIC_DIR)/tclOO.h $(GENERIC_DIR)/tclOODecls.h \ $(GENERIC_DIR)/tclPlatDecls.h \ - $(GENERIC_DIR)/tclZipfs.h \ $(GENERIC_DIR)/tclTomMath.h \ $(GENERIC_DIR)/tclTomMathDecls.h ; \ do \ @@ -1333,7 +1331,7 @@ tclZlib.o: $(GENERIC_DIR)/tclZlib.c $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/tclZlib.c tclZipfs.o: $(GENERIC_DIR)/tclZipfs.c - $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/tclZipfs.c + $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) -I$(ZLIB_DIR)/contrib/minizip $(GENERIC_DIR)/tclZipfs.c tclTest.o: $(GENERIC_DIR)/tclTest.c $(IOHDR) $(TCLREHDRS) $(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tclTest.c diff --git a/win/Makefile.in b/win/Makefile.in index 8d5aa5a..1a88cc8 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -502,6 +502,11 @@ testMain.${OBJEXT}: tclAppInit.c tclMain2.${OBJEXT}: tclMain.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_ASCII_MAIN @DEPARG@ $(CC_OBJNAME) +# TIP #430, ZipFS Support +tclZipfs.${OBJEXT}: $(GENERIC_DIR)/tclZipfs.c + $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) -I$(ZLIB_DIR)/contrib/minizip $(GENERIC_DIR)/tclZipfs.c + + # TIP #59, embedding of configuration information into the binary library. # # Part of Tcl's configuration information are the paths where it was installed @@ -642,7 +647,6 @@ install-libraries: libraries install-tzdata install-msgs @echo "Installing header files"; @for i in "$(GENERIC_DIR)/tcl.h" "$(GENERIC_DIR)/tclDecls.h" \ "$(GENERIC_DIR)/tclOO.h" "$(GENERIC_DIR)/tclOODecls.h" \ - "$(GENERIC_DIR)/tclZipfs.h" \ "$(GENERIC_DIR)/tclPlatDecls.h" \ "$(GENERIC_DIR)/tclTomMath.h" \ "$(GENERIC_DIR)/tclTomMathDecls.h"; \ diff --git a/win/makefile.vc b/win/makefile.vc index 19e1e2d..c8713fe 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -959,8 +959,9 @@ $(TMP_DIR)\tclWinTest.obj: $(WINDIR)\tclWinTest.c $(TMP_DIR)\tclZlib.obj: $(GENERICDIR)\tclZlib.c $(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -DBUILD_tcl -Fo$@ $? +### TIP #430 ZipFS Support $(TMP_DIR)\zipfs.obj: $(GENERICDIR)\zipfs.c - $(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -DBUILD_tcl -Fo$@ $? + $(cc32) $(TCL_CFLAGS) -I$(COMPATDIR)\zlib -I$(COMPATDIR)\zlib\contrib\minizip -DBUILD_tcl -Fo$@ $? $(TMP_DIR)\tclPkgConfig.obj: $(GENERICDIR)\tclPkgConfig.c $(cc32) -DBUILD_tcl $(TCL_CFLAGS) \ @@ -1135,7 +1136,6 @@ install-libraries: tclConfig install-msgs install-tzdata @$(CPY) "$(GENERICDIR)\tclDecls.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclOO.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclOODecls.h" "$(INCLUDE_INSTALL_DIR)\" - @$(CPY) "$(GENERICDIR)\tclZipfs.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclPlatDecls.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclTomMath.h" "$(INCLUDE_INSTALL_DIR)\" @$(CPY) "$(GENERICDIR)\tclTomMathDecls.h" "$(INCLUDE_INSTALL_DIR)\" -- cgit v0.12 From cf4d5a8cfe114d1b687b43c361a25182eba9597c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 8 Nov 2017 11:50:55 +0000 Subject: TIP #485 implementation: "Remove Deprecated API". Based on Tcl 8.7 (core-8-branch). --- generic/tcl.decls | 16 ++--- generic/tclBasic.c | 2 +- generic/tclCmdAH.c | 2 +- generic/tclDecls.h | 40 +++++++----- generic/tclIOCmd.c | 6 +- generic/tclInt.h | 2 +- generic/tclStubInit.c | 8 +++ generic/tclTest.c | 163 ------------------------------------------------ tests/case.test | 94 ---------------------------- tests/compExpr-old.test | 22 ------- tests/compExpr.test | 12 ---- tests/expr-old.test | 17 ----- tests/expr.test | 39 ------------ 13 files changed, 46 insertions(+), 377 deletions(-) delete mode 100644 tests/case.test diff --git a/generic/tcl.decls b/generic/tcl.decls index b2b91a9..f7ffd29 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -285,7 +285,7 @@ declare 75 { declare 76 { void Tcl_BackgroundError(Tcl_Interp *interp) } -declare 77 { +declare 77 {deprecated {Use Tcl_UtfBackslash}} { char Tcl_Backslash(const char *src, int *readPtr) } declare 78 { @@ -352,7 +352,7 @@ declare 93 { declare 94 { Tcl_Interp *Tcl_CreateInterp(void) } -declare 95 { +declare 95 {deprecated {}} { void Tcl_CreateMathFunc(Tcl_Interp *interp, const char *name, int numArgs, Tcl_ValueType *argTypes, Tcl_MathProc *proc, ClientData clientData) @@ -470,7 +470,7 @@ declare 129 { int Tcl_Eval(Tcl_Interp *interp, const char *script) } # This is obsolete, use Tcl_FSEvalFile -declare 130 { +declare 130 {deprecated {Use Tcl_FSEvalFile}} { int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName) } declare 131 { @@ -1214,10 +1214,10 @@ declare 339 { declare 340 { char *Tcl_GetString(Tcl_Obj *objPtr) } -declare 341 { +declare 341 {deprecated {Use Tcl_GetEncodingSearchPath}} { CONST84_RETURN char *Tcl_GetDefaultEncodingDir(void) } -declare 342 { +declare 342 {deprecated {Use Tcl_SetEncodingSearchPath}} { void Tcl_SetDefaultEncodingDir(const char *path) } declare 343 { @@ -1266,7 +1266,7 @@ declare 356 { Tcl_RegExp Tcl_GetRegExpFromObj(Tcl_Interp *interp, Tcl_Obj *patObj, int flags) } -declare 357 { +declare 357 {deprecated {Use Tcl_EvalTokensStandard}} { Tcl_Obj *Tcl_EvalTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr, int count) } @@ -1548,12 +1548,12 @@ declare 434 { } # TIP#15 (math function introspection) dkf -declare 435 { +declare 435 {deprecated {}} { int Tcl_GetMathFuncInfo(Tcl_Interp *interp, const char *name, int *numArgsPtr, Tcl_ValueType **argTypesPtr, Tcl_MathProc **procPtr, ClientData *clientDataPtr) } -declare 436 { +declare 436 {deprecated {}} { Tcl_Obj *Tcl_ListMathFuncs(Tcl_Interp *interp, const char *pattern) } diff --git a/generic/tclBasic.c b/generic/tclBasic.c index e6022ac..c334fb8 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -203,7 +203,7 @@ static const CmdInfo builtInCmds[] = { {"append", Tcl_AppendObjCmd, TclCompileAppendCmd, NULL, CMD_IS_SAFE}, {"apply", Tcl_ApplyObjCmd, NULL, TclNRApplyObjCmd, CMD_IS_SAFE}, {"break", Tcl_BreakObjCmd, TclCompileBreakCmd, NULL, CMD_IS_SAFE}, -#ifndef TCL_NO_DEPRECATED +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 {"case", Tcl_CaseObjCmd, NULL, NULL, CMD_IS_SAFE}, #endif {"catch", Tcl_CatchObjCmd, TclCompileCatchCmd, TclNRCatchObjCmd, CMD_IS_SAFE}, diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 807a1ac..49c8c56 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -164,7 +164,7 @@ Tcl_BreakObjCmd( * *---------------------------------------------------------------------- */ -#ifndef TCL_NO_DEPRECATED +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 /* ARGSUSED */ int Tcl_CaseObjCmd( diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 464fc0f..c521845 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -263,7 +263,8 @@ EXTERN int Tcl_AsyncReady(void); /* 76 */ EXTERN void Tcl_BackgroundError(Tcl_Interp *interp); /* 77 */ -EXTERN char Tcl_Backslash(const char *src, int *readPtr); +TCL_DEPRECATED("Use Tcl_UtfBackslash") +char Tcl_Backslash(const char *src, int *readPtr); /* 78 */ EXTERN int Tcl_BadChannelOption(Tcl_Interp *interp, const char *optionName, @@ -322,7 +323,8 @@ EXTERN void Tcl_CreateExitHandler(Tcl_ExitProc *proc, /* 94 */ EXTERN Tcl_Interp * Tcl_CreateInterp(void); /* 95 */ -EXTERN void Tcl_CreateMathFunc(Tcl_Interp *interp, +TCL_DEPRECATED("") +void Tcl_CreateMathFunc(Tcl_Interp *interp, const char *name, int numArgs, Tcl_ValueType *argTypes, Tcl_MathProc *proc, ClientData clientData); @@ -418,7 +420,8 @@ EXTERN CONST84_RETURN char * Tcl_ErrnoMsg(int err); /* 129 */ EXTERN int Tcl_Eval(Tcl_Interp *interp, const char *script); /* 130 */ -EXTERN int Tcl_EvalFile(Tcl_Interp *interp, +TCL_DEPRECATED("Use Tcl_FSEvalFile") +int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName); /* 131 */ EXTERN int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr); @@ -1010,9 +1013,11 @@ EXTERN int Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr); /* 340 */ EXTERN char * Tcl_GetString(Tcl_Obj *objPtr); /* 341 */ -EXTERN CONST84_RETURN char * Tcl_GetDefaultEncodingDir(void); +TCL_DEPRECATED("Use Tcl_GetEncodingSearchPath") +CONST84_RETURN char * Tcl_GetDefaultEncodingDir(void); /* 342 */ -EXTERN void Tcl_SetDefaultEncodingDir(const char *path); +TCL_DEPRECATED("Use Tcl_SetEncodingSearchPath") +void Tcl_SetDefaultEncodingDir(const char *path); /* 343 */ EXTERN void Tcl_AlertNotifier(ClientData clientData); /* 344 */ @@ -1047,7 +1052,8 @@ EXTERN Tcl_UniChar * Tcl_UtfToUniCharDString(const char *src, int length, EXTERN Tcl_RegExp Tcl_GetRegExpFromObj(Tcl_Interp *interp, Tcl_Obj *patObj, int flags); /* 357 */ -EXTERN Tcl_Obj * Tcl_EvalTokens(Tcl_Interp *interp, +TCL_DEPRECATED("Use Tcl_EvalTokensStandard") +Tcl_Obj * Tcl_EvalTokens(Tcl_Interp *interp, Tcl_Token *tokenPtr, int count); /* 358 */ EXTERN void Tcl_FreeParse(Tcl_Parse *parsePtr); @@ -1268,13 +1274,15 @@ EXTERN Tcl_ThreadId Tcl_GetChannelThread(Tcl_Channel channel); EXTERN Tcl_UniChar * Tcl_GetUnicodeFromObj(Tcl_Obj *objPtr, int *lengthPtr); /* 435 */ -EXTERN int Tcl_GetMathFuncInfo(Tcl_Interp *interp, +TCL_DEPRECATED("") +int Tcl_GetMathFuncInfo(Tcl_Interp *interp, const char *name, int *numArgsPtr, Tcl_ValueType **argTypesPtr, Tcl_MathProc **procPtr, ClientData *clientDataPtr); /* 436 */ -EXTERN Tcl_Obj * Tcl_ListMathFuncs(Tcl_Interp *interp, +TCL_DEPRECATED("") +Tcl_Obj * Tcl_ListMathFuncs(Tcl_Interp *interp, const char *pattern); /* 437 */ EXTERN Tcl_Obj * Tcl_SubstObj(Tcl_Interp *interp, Tcl_Obj *objPtr, @@ -1935,7 +1943,7 @@ typedef struct TclStubs { void (*tcl_AsyncMark) (Tcl_AsyncHandler async); /* 74 */ int (*tcl_AsyncReady) (void); /* 75 */ void (*tcl_BackgroundError) (Tcl_Interp *interp); /* 76 */ - char (*tcl_Backslash) (const char *src, int *readPtr); /* 77 */ + TCL_DEPRECATED_API("Use Tcl_UtfBackslash") char (*tcl_Backslash) (const char *src, int *readPtr); /* 77 */ int (*tcl_BadChannelOption) (Tcl_Interp *interp, const char *optionName, const char *optionList); /* 78 */ void (*tcl_CallWhenDeleted) (Tcl_Interp *interp, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 79 */ void (*tcl_CancelIdleCall) (Tcl_IdleProc *idleProc, ClientData clientData); /* 80 */ @@ -1953,7 +1961,7 @@ typedef struct TclStubs { void (*tcl_CreateEventSource) (Tcl_EventSetupProc *setupProc, Tcl_EventCheckProc *checkProc, ClientData clientData); /* 92 */ void (*tcl_CreateExitHandler) (Tcl_ExitProc *proc, ClientData clientData); /* 93 */ Tcl_Interp * (*tcl_CreateInterp) (void); /* 94 */ - void (*tcl_CreateMathFunc) (Tcl_Interp *interp, const char *name, int numArgs, Tcl_ValueType *argTypes, Tcl_MathProc *proc, ClientData clientData); /* 95 */ + TCL_DEPRECATED_API("") void (*tcl_CreateMathFunc) (Tcl_Interp *interp, const char *name, int numArgs, Tcl_ValueType *argTypes, Tcl_MathProc *proc, ClientData clientData); /* 95 */ Tcl_Command (*tcl_CreateObjCommand) (Tcl_Interp *interp, const char *cmdName, Tcl_ObjCmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc); /* 96 */ Tcl_Interp * (*tcl_CreateSlave) (Tcl_Interp *interp, const char *slaveName, int isSafe); /* 97 */ Tcl_TimerToken (*tcl_CreateTimerHandler) (int milliseconds, Tcl_TimerProc *proc, ClientData clientData); /* 98 */ @@ -1988,7 +1996,7 @@ typedef struct TclStubs { CONST84_RETURN char * (*tcl_ErrnoId) (void); /* 127 */ CONST84_RETURN char * (*tcl_ErrnoMsg) (int err); /* 128 */ int (*tcl_Eval) (Tcl_Interp *interp, const char *script); /* 129 */ - int (*tcl_EvalFile) (Tcl_Interp *interp, const char *fileName); /* 130 */ + TCL_DEPRECATED_API("Use Tcl_FSEvalFile") int (*tcl_EvalFile) (Tcl_Interp *interp, const char *fileName); /* 130 */ int (*tcl_EvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 131 */ void (*tcl_EventuallyFree) (ClientData clientData, Tcl_FreeProc *freeProc); /* 132 */ TCL_NORETURN1 void (*tcl_Exit) (int status); /* 133 */ @@ -2207,8 +2215,8 @@ typedef struct TclStubs { int (*tcl_WriteChars) (Tcl_Channel chan, const char *src, int srcLen); /* 338 */ int (*tcl_WriteObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 339 */ char * (*tcl_GetString) (Tcl_Obj *objPtr); /* 340 */ - CONST84_RETURN char * (*tcl_GetDefaultEncodingDir) (void); /* 341 */ - void (*tcl_SetDefaultEncodingDir) (const char *path); /* 342 */ + TCL_DEPRECATED_API("Use Tcl_GetEncodingSearchPath") CONST84_RETURN char * (*tcl_GetDefaultEncodingDir) (void); /* 341 */ + TCL_DEPRECATED_API("Use Tcl_SetEncodingSearchPath") void (*tcl_SetDefaultEncodingDir) (const char *path); /* 342 */ void (*tcl_AlertNotifier) (ClientData clientData); /* 343 */ void (*tcl_ServiceModeHook) (int mode); /* 344 */ int (*tcl_UniCharIsAlnum) (int ch); /* 345 */ @@ -2223,7 +2231,7 @@ typedef struct TclStubs { char * (*tcl_UniCharToUtfDString) (const Tcl_UniChar *uniStr, int uniLength, Tcl_DString *dsPtr); /* 354 */ Tcl_UniChar * (*tcl_UtfToUniCharDString) (const char *src, int length, Tcl_DString *dsPtr); /* 355 */ Tcl_RegExp (*tcl_GetRegExpFromObj) (Tcl_Interp *interp, Tcl_Obj *patObj, int flags); /* 356 */ - Tcl_Obj * (*tcl_EvalTokens) (Tcl_Interp *interp, Tcl_Token *tokenPtr, int count); /* 357 */ + TCL_DEPRECATED_API("Use Tcl_EvalTokensStandard") Tcl_Obj * (*tcl_EvalTokens) (Tcl_Interp *interp, Tcl_Token *tokenPtr, int count); /* 357 */ void (*tcl_FreeParse) (Tcl_Parse *parsePtr); /* 358 */ void (*tcl_LogCommandInfo) (Tcl_Interp *interp, const char *script, const char *command, int length); /* 359 */ int (*tcl_ParseBraces) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, CONST84 char **termPtr); /* 360 */ @@ -2301,8 +2309,8 @@ typedef struct TclStubs { int (*tcl_AttemptSetObjLength) (Tcl_Obj *objPtr, int length); /* 432 */ Tcl_ThreadId (*tcl_GetChannelThread) (Tcl_Channel channel); /* 433 */ Tcl_UniChar * (*tcl_GetUnicodeFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 434 */ - int (*tcl_GetMathFuncInfo) (Tcl_Interp *interp, const char *name, int *numArgsPtr, Tcl_ValueType **argTypesPtr, Tcl_MathProc **procPtr, ClientData *clientDataPtr); /* 435 */ - Tcl_Obj * (*tcl_ListMathFuncs) (Tcl_Interp *interp, const char *pattern); /* 436 */ + TCL_DEPRECATED_API("") int (*tcl_GetMathFuncInfo) (Tcl_Interp *interp, const char *name, int *numArgsPtr, Tcl_ValueType **argTypesPtr, Tcl_MathProc **procPtr, ClientData *clientDataPtr); /* 435 */ + TCL_DEPRECATED_API("") Tcl_Obj * (*tcl_ListMathFuncs) (Tcl_Interp *interp, const char *pattern); /* 436 */ Tcl_Obj * (*tcl_SubstObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); /* 437 */ int (*tcl_DetachChannel) (Tcl_Interp *interp, Tcl_Channel channel); /* 438 */ int (*tcl_IsStandardChannel) (Tcl_Channel channel); /* 439 */ diff --git a/generic/tclIOCmd.c b/generic/tclIOCmd.c index 6e8bd09..87bf415 100644 --- a/generic/tclIOCmd.c +++ b/generic/tclIOCmd.c @@ -137,7 +137,7 @@ Tcl_PutsObjCmd( chanObjPtr = objv[2]; string = objv[3]; break; -#if TCL_MAJOR_VERSION < 9 +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 } else if (strcmp(TclGetString(objv[3]), "nonewline") == 0) { /* * The code below provides backwards compatibility with an old @@ -439,7 +439,7 @@ Tcl_ReadObjCmd( if (i < objc) { if ((TclGetIntFromObj(interp, objv[i], &toRead) != TCL_OK) || (toRead < 0)) { -#if TCL_MAJOR_VERSION < 9 +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 /* * The code below provides backwards compatibility with an old * form of the command that is no longer recommended or @@ -454,7 +454,7 @@ Tcl_ReadObjCmd( TclGetString(objv[i]))); Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL); return TCL_ERROR; -#if TCL_MAJOR_VERSION < 9 +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 } newline = 1; #endif diff --git a/generic/tclInt.h b/generic/tclInt.h index 29392b6..6b61af1 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3240,7 +3240,7 @@ MODULE_SCOPE Tcl_Command TclInitBinaryCmd(Tcl_Interp *interp); MODULE_SCOPE int Tcl_BreakObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -#ifndef TCL_NO_DEPRECATED +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 MODULE_SCOPE int Tcl_CaseObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index ebd2086..03ef7d6 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -72,6 +72,14 @@ static int TclSockMinimumBuffersOld(int sock, int size) # define TclBNInitBignumFromWideUInt 0 # define TclBNInitBignumFromWideInt 0 # define TclBNInitBignumFromLong 0 +# define Tcl_BackSlash 0 +# define Tcl_EvalFile 0 +# define Tcl_GetDefaultEncodingDir 0 +# define Tcl_SetDefaultEncodingDir 0 +# define Tcl_EvalTokens 0 +# define Tcl_CreateMathFunc 0 +# define Tcl_GetMathFuncInfo 0 +# define Tcl_ListMathFuncs 0 #else #define TclSetStartupScriptPath setStartupScriptPath static void TclSetStartupScriptPath(Tcl_Obj *path) diff --git a/generic/tclTest.c b/generic/tclTest.c index 834cd79..3aa853f 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -305,14 +305,6 @@ static int TestlinkCmd(ClientData dummy, static int TestlocaleCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -#ifndef TCL_NO_DEPRECATED -static int TestMathFunc(ClientData clientData, - Tcl_Interp *interp, Tcl_Value *args, - Tcl_Value *resultPtr); -static int TestMathFunc2(ClientData clientData, - Tcl_Interp *interp, Tcl_Value *args, - Tcl_Value *resultPtr); -#endif /* TCL_NO_DEPRECATED */ static int TestmainthreadCmd(ClientData dummy, Tcl_Interp *interp, int argc, const char **argv); static int TestsetmainloopCmd(ClientData dummy, @@ -549,10 +541,6 @@ int Tcltest_Init( Tcl_Interp *interp) /* Interpreter for application. */ { -#ifndef TCL_NO_DEPRECATED - Tcl_ValueType t3ArgTypes[2]; -#endif /* TCL_NO_DEPRECATED */ - Tcl_Obj *listPtr; Tcl_Obj **objv; int objc, index; @@ -701,10 +689,6 @@ Tcltest_Init( Tcl_CreateCommand(interp, "testtranslatefilename", TesttranslatefilenameCmd, NULL, NULL); Tcl_CreateCommand(interp, "testupvar", TestupvarCmd, NULL, NULL); -#ifndef TCL_NO_DEPRECATED - Tcl_CreateMathFunc(interp, "T1", 0, NULL, TestMathFunc, (ClientData) 123); - Tcl_CreateMathFunc(interp, "T2", 0, NULL, TestMathFunc, (ClientData) 345); -#endif /* TCL_NO_DEPRECATED */ Tcl_CreateCommand(interp, "testmainthread", TestmainthreadCmd, NULL, NULL); Tcl_CreateCommand(interp, "testsetmainloop", TestsetmainloopCmd, @@ -715,13 +699,6 @@ Tcltest_Init( Tcl_CreateObjCommand(interp, "testcpuid", TestcpuidCmd, (ClientData) 0, NULL); #endif -#ifndef TCL_NO_DEPRECATED - t3ArgTypes[0] = TCL_EITHER; - t3ArgTypes[1] = TCL_EITHER; - Tcl_CreateMathFunc(interp, "T3", 2, t3ArgTypes, TestMathFunc2, - NULL); -#endif /* TCL_NO_DEPRECATED */ - Tcl_CreateObjCommand(interp, "testnreunwind", TestNREUnwind, NULL, NULL); Tcl_CreateObjCommand(interp, "testnrelevels", TestNRELevels, @@ -3347,146 +3324,6 @@ TestlocaleCmd( /* *---------------------------------------------------------------------- * - * TestMathFunc -- - * - * This is a user-defined math procedure to test out math procedures - * with no arguments. - * - * Results: - * A normal Tcl completion code. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - - /* ARGSUSED */ -#ifndef TCL_NO_DEPRECATED -static int -TestMathFunc( - ClientData clientData, /* Integer value to return. */ - Tcl_Interp *interp, /* Not used. */ - Tcl_Value *args, /* Not used. */ - Tcl_Value *resultPtr) /* Where to store result. */ -{ - resultPtr->type = TCL_INT; - resultPtr->intValue = PTR2INT(clientData); - return TCL_OK; -} - -/* - *---------------------------------------------------------------------- - * - * TestMathFunc2 -- - * - * This is a user-defined math procedure to test out math procedures - * that do have arguments, in this case 2. - * - * Results: - * A normal Tcl completion code. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - - /* ARGSUSED */ -static int -TestMathFunc2( - ClientData clientData, /* Integer value to return. */ - Tcl_Interp *interp, /* Used to report errors. */ - Tcl_Value *args, /* Points to an array of two Tcl_Value structs - * for the two arguments. */ - Tcl_Value *resultPtr) /* Where to store the result. */ -{ - int result = TCL_OK; - - /* - * Return the maximum of the two arguments with the correct type. - */ - - if (args[0].type == TCL_INT) { - int i0 = args[0].intValue; - - if (args[1].type == TCL_INT) { - int i1 = args[1].intValue; - - resultPtr->type = TCL_INT; - resultPtr->intValue = ((i0 > i1)? i0 : i1); - } else if (args[1].type == TCL_DOUBLE) { - double d0 = i0; - double d1 = args[1].doubleValue; - - resultPtr->type = TCL_DOUBLE; - resultPtr->doubleValue = ((d0 > d1)? d0 : d1); - } else if (args[1].type == TCL_WIDE_INT) { - Tcl_WideInt w0 = Tcl_LongAsWide(i0); - Tcl_WideInt w1 = args[1].wideValue; - - resultPtr->type = TCL_WIDE_INT; - resultPtr->wideValue = ((w0 > w1)? w0 : w1); - } else { - Tcl_AppendResult(interp, "T3: wrong type for arg 2", NULL); - result = TCL_ERROR; - } - } else if (args[0].type == TCL_DOUBLE) { - double d0 = args[0].doubleValue; - - if (args[1].type == TCL_INT) { - double d1 = args[1].intValue; - - resultPtr->type = TCL_DOUBLE; - resultPtr->doubleValue = ((d0 > d1)? d0 : d1); - } else if (args[1].type == TCL_DOUBLE) { - double d1 = args[1].doubleValue; - - resultPtr->type = TCL_DOUBLE; - resultPtr->doubleValue = ((d0 > d1)? d0 : d1); - } else if (args[1].type == TCL_WIDE_INT) { - double d1 = Tcl_WideAsDouble(args[1].wideValue); - - resultPtr->type = TCL_DOUBLE; - resultPtr->doubleValue = ((d0 > d1)? d0 : d1); - } else { - Tcl_AppendResult(interp, "T3: wrong type for arg 2", NULL); - result = TCL_ERROR; - } - } else if (args[0].type == TCL_WIDE_INT) { - Tcl_WideInt w0 = args[0].wideValue; - - if (args[1].type == TCL_INT) { - Tcl_WideInt w1 = Tcl_LongAsWide(args[1].intValue); - - resultPtr->type = TCL_WIDE_INT; - resultPtr->wideValue = ((w0 > w1)? w0 : w1); - } else if (args[1].type == TCL_DOUBLE) { - double d0 = Tcl_WideAsDouble(w0); - double d1 = args[1].doubleValue; - - resultPtr->type = TCL_DOUBLE; - resultPtr->doubleValue = ((d0 > d1)? d0 : d1); - } else if (args[1].type == TCL_WIDE_INT) { - Tcl_WideInt w1 = args[1].wideValue; - - resultPtr->type = TCL_WIDE_INT; - resultPtr->wideValue = ((w0 > w1)? w0 : w1); - } else { - Tcl_AppendResult(interp, "T3: wrong type for arg 2", NULL); - result = TCL_ERROR; - } - } else { - Tcl_AppendResult(interp, "T3: wrong type for arg 1", NULL); - result = TCL_ERROR; - } - return result; -} -#endif /* TCL_NO_DEPRECATED */ - -/* - *---------------------------------------------------------------------- - * * CleanupTestSetassocdataTests -- * * This function is called when an interpreter is deleted to clean diff --git a/tests/case.test b/tests/case.test deleted file mode 100644 index d7558a9..0000000 --- a/tests/case.test +++ /dev/null @@ -1,94 +0,0 @@ -# Commands covered: case -# -# 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. - -if {![llength [info commands case]]} { - # No "case" command? So no need to test - return -} - -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest - namespace import -force ::tcltest::* -} - -test case-1.1 {simple pattern} { - case a in a {format 1} b {format 2} c {format 3} default {format 4} -} 1 -test case-1.2 {simple pattern} { - case b a {format 1} b {format 2} c {format 3} default {format 4} -} 2 -test case-1.3 {simple pattern} { - case x in a {format 1} b {format 2} c {format 3} default {format 4} -} 4 -test case-1.4 {simple pattern} { - case x a {format 1} b {format 2} c {format 3} -} {} -test case-1.5 {simple pattern matches many times} { - case b a {format 1} b {format 2} b {format 3} b {format 4} -} 2 -test case-1.6 {fancier pattern} { - case cx a {format 1} *c {format 2} *x {format 3} default {format 4} -} 3 -test case-1.7 {list of patterns} { - case abc in {a b c} {format 1} {def abc ghi} {format 2} -} 2 - -test case-2.1 {error in executed command} { - list [catch {case a in a {error "Just a test"} default {format 1}} msg] \ - $msg $::errorInfo -} {1 {Just a test} {Just a test - while executing -"error "Just a test"" - ("a" arm line 1) - invoked from within -"case a in a {error "Just a test"} default {format 1}"}} -test case-2.2 {error: not enough args} { - list [catch {case} msg] $msg -} {1 {wrong # args: should be "case string ?in? ?pattern body ...? ?default body?"}} -test case-2.3 {error: pattern with no body} { - list [catch {case a b} msg] $msg -} {1 {extra case pattern with no body}} -test case-2.4 {error: pattern with no body} { - list [catch {case a in b {format 1} c} msg] $msg -} {1 {extra case pattern with no body}} -test case-2.5 {error in default command} { - list [catch {case foo in a {error case1} default {error case2} \ - b {error case 3}} msg] $msg $::errorInfo -} {1 case2 {case2 - while executing -"error case2" - ("default" arm line 1) - invoked from within -"case foo in a {error case1} default {error case2} b {error case 3}"}} - -test case-3.1 {single-argument form for pattern/command pairs} { - case b in { - a {format 1} - b {format 2} - default {format 6} - } -} {2} -test case-3.2 {single-argument form for pattern/command pairs} { - case b { - a {format 1} - b {format 2} - default {format 6} - } -} {2} -test case-3.3 {single-argument form for pattern/command pairs} { - list [catch {case z in {a 2 b}} msg] $msg -} {1 {extra case pattern with no body}} - -# cleanup -::tcltest::cleanupTests -return diff --git a/tests/compExpr-old.test b/tests/compExpr-old.test index bae26a0..0136ccd 100644 --- a/tests/compExpr-old.test +++ b/tests/compExpr-old.test @@ -20,12 +20,6 @@ if {[lsearch [namespace children] ::tcltest] == -1} { ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] -if {[catch {expr T1()} msg] && $msg eq {invalid command name "tcl::mathfunc::T1"}} { - testConstraint testmathfunctions 0 -} else { - testConstraint testmathfunctions 1 -} - # Big test for correct ordering of data in [expr] proc testIEEE {} { @@ -602,22 +596,6 @@ test compExpr-old-15.5 {CompileMathFuncCall: too few arguments} -body { test compExpr-old-15.6 {CompileMathFuncCall: missing ')'} -body { expr sin(1 } -returnCodes error -match glob -result * -test compExpr-old-15.7 {CompileMathFuncCall: call registered math function} testmathfunctions { - expr 2*T1() -} 246 -test compExpr-old-15.8 {CompileMathFuncCall: call registered math function} testmathfunctions { - expr T2()*3 -} 1035 -test compExpr-old-15.9 {CompileMathFuncCall: call registered math function} testmathfunctions { - expr T3(21, 37) -} 37 -test compExpr-old-15.10 {CompileMathFuncCall: call registered math function} testmathfunctions { - expr T3(21.2, 37) -} 37.0 -test compExpr-old-15.11 {CompileMathFuncCall: call registered math function} testmathfunctions { - expr T3(-21.2, -17.5) -} -17.5 - test compExpr-old-16.1 {GetToken: checks whether integer token starting with "0x" (e.g., "0x$") is invalid} { catch {unset a} set a(VALUE) ff15 diff --git a/tests/compExpr.test b/tests/compExpr.test index 14c875d..3b44af8 100644 --- a/tests/compExpr.test +++ b/tests/compExpr.test @@ -16,12 +16,6 @@ if {"::tcltest" ni [namespace children]} { ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] -if {[catch {expr T1()} msg] && $msg eq {invalid command name "tcl::mathfunc::T1"}} { - testConstraint testmathfunctions 0 -} else { - testConstraint testmathfunctions 1 -} - # Constrain memory leak tests testConstraint memory [llength [info commands memory]] @@ -319,12 +313,6 @@ test compExpr-5.1 {CompileMathFuncCall procedure, math function found} { test compExpr-5.2 {CompileMathFuncCall procedure, math function not found} -body { expr {do_it()} } -returnCodes error -match glob -result {* "*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 { expr {atan2(1.0)} } -returnCodes error -match glob -result {too few arguments for math function*} diff --git a/tests/expr-old.test b/tests/expr-old.test index 3adfb63..cea20f1 100644 --- a/tests/expr-old.test +++ b/tests/expr-old.test @@ -24,12 +24,6 @@ testConstraint testexprdouble [llength [info commands testexprdouble]] testConstraint testexprstring [llength [info commands testexprstring]] testConstraint longIs32bit [expr {int(0x80000000) < 0}] -if {[catch {expr T1()} msg] && $msg eq {invalid command name "tcl::mathfunc::T1"}} { - testConstraint testmathfunctions 0 -} else { - testConstraint testmathfunctions 1 -} - # Big test for correct ordering of data in [expr] proc testIEEE {} { @@ -847,12 +841,6 @@ test expr-old-32.41 {math functions in expressions} { test expr-old-32.42 {math functions in expressions} { list [catch {expr hypot(5*.8,3)} msg] $msg } {0 5.0} -test expr-old-32.43 {math functions in expressions} testmathfunctions { - expr 2*T1() -} 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} @@ -952,11 +940,6 @@ test expr-old-34.15 {errors in math functions} { test expr-old-34.16 {errors in math functions} { expr round(-1.0e30) } -1000000000000000019884624838656 -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 0o289 } -returnCodes error -match glob -result {*invalid octal number*} diff --git a/tests/expr.test b/tests/expr.test index 8e083c5..0b3620a 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -18,10 +18,6 @@ if {[lsearch [namespace children] ::tcltest] == -1} { ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] -testConstraint testmathfunctions [expr { - ([catch {expr T1()} msg] != 1) || ($msg ne {invalid command name "tcl::mathfunc::T1"}) -}] - # Determine if "long int" type is a 32 bit number and if the wide # type is a 64 bit number on this machine. @@ -685,41 +681,6 @@ test expr-15.5 {CompileMathFuncCall: too few arguments} -body { test expr-15.6 {CompileMathFuncCall: missing ')'} -body { expr sin(1 } -returnCodes error -match glob -result * -test expr-15.7 {CompileMathFuncCall: call registered math function} {testmathfunctions} { - expr 2*T1() -} 246 -test expr-15.8 {CompileMathFuncCall: call registered math function} {testmathfunctions} { - expr T2()*3 -} 1035 -test expr-15.9 {CompileMathFuncCall: call registered math function} {testmathfunctions} { - expr T3(21, 37) -} 37 -test expr-15.10 {CompileMathFuncCall: call registered math function} {testmathfunctions} { - expr T3(21.2, 37) -} 37.0 -test expr-15.11 {CompileMathFuncCall: call registered math function} {testmathfunctions} { - expr T3(-21.2, -17.5) -} -17.5 -test expr-15.12 {ExprCallMathFunc: call registered math function} {testmathfunctions} { - expr T3(21, wide(37)) -} 37 -test expr=15.13 {ExprCallMathFunc: call registered math function} {testmathfunctions} { - expr T3(wide(21), 37) -} 37 -test expr=15.14 {ExprCallMathFunc: call registered math function} {testmathfunctions} { - expr T3(wide(21), wide(37)) -} 37 -test expr-15.15 {ExprCallMathFunc: call registered math function} {testmathfunctions} { - expr T3(21.0, wide(37)) -} 37.0 -test expr-15.16 {ExprCallMathFunc: call registered math function} {testmathfunctions} { - expr T3(wide(21), 37.0) -} 37.0 -test expr-15.17 {ExprCallMathFunc: non-numeric arg} -constraints { - testmathfunctions -} -body { - expr T3(0,"a") -} -returnCodes error -result {argument to math function didn't have numeric value} test expr-16.1 {GetToken: checks whether integer token starting with "0x" (e.g., "0x$") is invalid} { -- cgit v0.12 From 429acda3ee22bea891e82e69efc09872e7608915 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 9 Nov 2017 10:34:10 +0000 Subject: Put Tcl_EvalFile back, but then as a macro in terms of Tcl_FSEvalFileEx(). --- generic/tclDecls.h | 3 +++ generic/tclIOUtil.c | 24 +++++++++++------------- generic/tclStubInit.c | 2 ++ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/generic/tclDecls.h b/generic/tclDecls.h index c521845..7718588 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3984,5 +3984,8 @@ extern const TclStubs *tclStubsPtr; #undef Tcl_GlobalEvalObj #define Tcl_GlobalEvalObj(interp, objPtr) \ Tcl_EvalObjEx(interp, objPtr, TCL_EVAL_GLOBAL) +#undef Tcl_EvalFile +#define Tcl_EvalFile(interp, fileName) \ + Tcl_FSEvalFileEx(interp, Tcl_NewStringObj(filename, -1), NULL); #endif /* _TCLDECLS */ diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 2c389c6..39a9474 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -412,21 +412,18 @@ Tcl_GetCwd( return Tcl_DStringValue(cwdPtr); } +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 /* Obsolete */ +#undef Tcl_EvalFile int Tcl_EvalFile( Tcl_Interp *interp, /* Interpreter in which to process file. */ const char *fileName) /* Name of file to process. Tilde-substitution * will be performed on this name. */ { - int ret; - Tcl_Obj *pathPtr = Tcl_NewStringObj(fileName,-1); - - Tcl_IncrRefCount(pathPtr); - ret = Tcl_FSEvalFile(interp, pathPtr); - Tcl_DecrRefCount(pathPtr); - return ret; + return Tcl_FSEvalFileEx(interp, Tcl_NewStringObj(fileName, -1), NULL); } +#endif /* * Now move on to the basic filesystem implementation. @@ -1740,8 +1737,11 @@ Tcl_FSEvalFileEx( Tcl_Channel chan; Tcl_Obj *objPtr; + Tcl_IncrRefCount(pathPtr); + objPtr = Tcl_NewObj(); + Tcl_IncrRefCount(objPtr); if (Tcl_FSGetNormalizedPath(interp, pathPtr) == NULL) { - return result; + goto end; } if (Tcl_FSStat(pathPtr, &statBuf) == -1) { @@ -1756,7 +1756,7 @@ Tcl_FSEvalFileEx( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't read file \"%s\": %s", Tcl_GetString(pathPtr), Tcl_PosixError(interp))); - return result; + goto end; } /* @@ -1775,13 +1775,10 @@ Tcl_FSEvalFileEx( if (Tcl_SetChannelOption(interp, chan, "-encoding", encodingName) != TCL_OK) { Tcl_Close(interp,chan); - return result; + goto end; } } - objPtr = Tcl_NewObj(); - Tcl_IncrRefCount(objPtr); - /* * Try to read first character of stream, so we can check for utf-8 BOM to * be handled especially. @@ -1857,6 +1854,7 @@ Tcl_FSEvalFileEx( end: Tcl_DecrRefCount(objPtr); + Tcl_DecrRefCount(pathPtr); return result; } diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 03ef7d6..eacc8ca 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -371,6 +371,8 @@ static int formatInt(char *buffer, int n){ # define Tcl_EvalObj 0 # undef Tcl_GlobalEvalObj # define Tcl_GlobalEvalObj 0 +# undef Tcl_EvalFile +# define Tcl_EvalFile 0 # define TclBackgroundException 0 # undef TclpReaddir # define TclpReaddir 0 -- cgit v0.12 From 56e7df256a6fc22cd478e4be02a8dca93634e942 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 9 Nov 2017 11:04:49 +0000 Subject: No longer mark Tcl_EvalFile() as obsolete/deprecated. Thanks to all feedback to TIP #485! --- generic/tcl.decls | 4 ++-- generic/tclDecls.h | 5 ++--- generic/tclEncoding.c | 2 ++ generic/tclStubInit.c | 3 +-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index f7ffd29..1083adc 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -469,8 +469,8 @@ declare 128 { declare 129 { int Tcl_Eval(Tcl_Interp *interp, const char *script) } -# This is obsolete, use Tcl_FSEvalFile -declare 130 {deprecated {Use Tcl_FSEvalFile}} { +# Stub entry no longer needed. It is now a macro in terms of Tcl_FSEvalFileEx(). +declare 130 { int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName) } declare 131 { diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 7718588..9241175 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -420,8 +420,7 @@ EXTERN CONST84_RETURN char * Tcl_ErrnoMsg(int err); /* 129 */ EXTERN int Tcl_Eval(Tcl_Interp *interp, const char *script); /* 130 */ -TCL_DEPRECATED("Use Tcl_FSEvalFile") -int Tcl_EvalFile(Tcl_Interp *interp, +EXTERN int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName); /* 131 */ EXTERN int Tcl_EvalObj(Tcl_Interp *interp, Tcl_Obj *objPtr); @@ -1996,7 +1995,7 @@ typedef struct TclStubs { CONST84_RETURN char * (*tcl_ErrnoId) (void); /* 127 */ CONST84_RETURN char * (*tcl_ErrnoMsg) (int err); /* 128 */ int (*tcl_Eval) (Tcl_Interp *interp, const char *script); /* 129 */ - TCL_DEPRECATED_API("Use Tcl_FSEvalFile") int (*tcl_EvalFile) (Tcl_Interp *interp, const char *fileName); /* 130 */ + int (*tcl_EvalFile) (Tcl_Interp *interp, const char *fileName); /* 130 */ int (*tcl_EvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 131 */ void (*tcl_EventuallyFree) (ClientData clientData, Tcl_FreeProc *freeProc); /* 132 */ TCL_NORETURN1 void (*tcl_Exit) (int status); /* 133 */ diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 1f48a1c..b0c595c 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -693,6 +693,7 @@ TclFinalizeEncodingSubsystem(void) *------------------------------------------------------------------------- */ +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 const char * Tcl_GetDefaultEncodingDir(void) { @@ -736,6 +737,7 @@ Tcl_SetDefaultEncodingDir( Tcl_ListObjReplace(NULL, searchPath, 0, 0, 1, &directory); Tcl_SetEncodingSearchPath(searchPath); } +#endif /* *------------------------------------------------------------------------- diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index eacc8ca..d276dbc 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -72,8 +72,7 @@ static int TclSockMinimumBuffersOld(int sock, int size) # define TclBNInitBignumFromWideUInt 0 # define TclBNInitBignumFromWideInt 0 # define TclBNInitBignumFromLong 0 -# define Tcl_BackSlash 0 -# define Tcl_EvalFile 0 +# define Tcl_Backslash 0 # define Tcl_GetDefaultEncodingDir 0 # define Tcl_SetDefaultEncodingDir 0 # define Tcl_EvalTokens 0 -- cgit v0.12 From a037934e2165dc52888a2daa656c9e5d5ddc980e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 9 Nov 2017 11:49:10 +0000 Subject: Get rid of Tcl_DStringTrunc et al, as described in the TIP (Thanks, Don!). --- generic/tcl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 80c8dcb..54c6b73 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -997,7 +997,7 @@ typedef struct Tcl_DString { #define Tcl_DStringLength(dsPtr) ((dsPtr)->length) #define Tcl_DStringValue(dsPtr) ((dsPtr)->string) -#ifndef TCL_NO_DEPRECATED +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 # define Tcl_DStringTrunc Tcl_DStringSetLength #endif /* !TCL_NO_DEPRECATED */ @@ -2615,7 +2615,7 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); * Deprecated Tcl functions: */ -#ifndef TCL_NO_DEPRECATED +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 /* * These function have been renamed. The old names are deprecated, but we * define these macros for backwards compatibilty. -- cgit v0.12 From c59b3f3bc10dd286aed6474e627a9613dc69bb44 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 9 Nov 2017 12:37:20 +0000 Subject: For alpha/beta versions of Tcl, stub-enabled extensions are only allowed to run on the EXACT the same Tcl versions as compiled: The stubs might still be in flux, they are not guaranteed to work on future Tcl versions anyway. Backported from "novem" (which already had this special protection). For final releases (8.7.0) everything works as before. --- generic/tcl.h | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index 80c8dcb..a6a8c94 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -2409,14 +2409,27 @@ const char * TclTomMathInitializeStubs(Tcl_Interp *interp, const char *version, int epoch, int revision); #ifdef USE_TCL_STUBS -#define Tcl_InitStubs(interp, version, exact) \ - (Tcl_InitStubs)(interp, version, \ +#if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE +# define Tcl_InitStubs(interp, version, exact) \ + (Tcl_InitStubs)(interp, version, \ (exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \ TCL_STUB_MAGIC) #else -#define Tcl_InitStubs(interp, version, exact) \ - Tcl_PkgInitStubsCheck(interp, version, \ - (exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16)) +# define Tcl_InitStubs(interp, version, exact) \ + (Tcl_InitStubs)(interp, TCL_PATCH_LEVEL, \ + 1|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16), \ + TCL_STUB_MAGIC) +#endif +#else +#if TCL_RELEASE_LEVEL == TCL_FINAL_RELEASE +# define Tcl_InitStubs(interp, version, exact) \ + Tcl_PkgInitStubsCheck(interp, version, \ + (exact)|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16)) +#else +# define Tcl_InitStubs(interp, version, exact) \ + Tcl_PkgInitStubsCheck(interp, TCL_PATCH_LEVEL, \ + 1|(TCL_MAJOR_VERSION<<8)|(TCL_MINOR_VERSION<<16)) +#endif #endif /* -- cgit v0.12 From 729fcd5f0987531367d7572998e8be23743febd1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 9 Nov 2017 12:48:54 +0000 Subject: Make "scan %c" and the internal function ExtendUnicodeRepWithString() work as expected for TCL_UTF_MAX == 4 when handling characters > U+ffff. No effect when TCL_UTF_MAX == 3 or TCL_UTF_MAX == 6 --- generic/tclScan.c | 12 ++++++++++-- generic/tclStringObj.c | 6 +++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/generic/tclScan.c b/generic/tclScan.c index e1fcad4..7f71262 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -885,9 +885,17 @@ Tcl_ScanObjCmd( * Scan a single Unicode character. */ - string += TclUtfToUniChar(string, &sch); + offset = TclUtfToUniChar(string, &sch); + i = (int)sch; +#if TCL_UTF_MAX == 4 + if (!offset) { + offset = Tcl_UtfToUniChar(string, &sch); + i = (((i<<10) & 0x0FFC00) + 0x10000) + (sch & 0x3FF); + } +#endif + string += offset; if (!(flags & SCAN_SUPPRESS)) { - objPtr = Tcl_NewIntObj((int)sch); + objPtr = Tcl_NewIntObj(i); Tcl_IncrRefCount(objPtr); CLANG_ASSERT(objs); objs[objIndex++] = objPtr; diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 01b044e..d43cc45 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2720,7 +2720,6 @@ TclStringObjReverse( * Tcl_SetObjLength into growing the unicode rep buffer. */ - ch = 0; objPtr = Tcl_NewUnicodeObj(&ch, 1); Tcl_SetObjLength(objPtr, stringPtr->numChars); to = Tcl_GetUnicode(objPtr); @@ -2823,7 +2822,7 @@ ExtendUnicodeRepWithString( { String *stringPtr = GET_STRING(objPtr); int needed, numOrigChars = 0; - Tcl_UniChar *dst; + Tcl_UniChar *dst, unichar = 0; if (stringPtr->hasUnicode) { numOrigChars = stringPtr->numChars; @@ -2846,7 +2845,8 @@ ExtendUnicodeRepWithString( numAppendChars = 0; } for (dst=stringPtr->unicode + numOrigChars; numAppendChars-- > 0; dst++) { - bytes += TclUtfToUniChar(bytes, dst); + bytes += TclUtfToUniChar(bytes, &unichar); + *dst = unichar; } *dst = 0; } -- cgit v0.12 From 1ffeaf24efc557cfbfd2120f1871cf015e466cf2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 10 Nov 2017 08:40:45 +0000 Subject: Make "string split" and "string is (alpha|graph|...)" work as expected with Unicode chars > U+ffff, when Tcl is compiled with TCL_UTF_MAX == 4. No effect when TCL_UTF_MAX == 3 or TCL_UTF_MAX == 6. Test-case added for "string split". --- generic/tclCmdMZ.c | 23 ++++++++++++++++++++--- tests/split.test | 3 +++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 7010495..d63a985 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -309,7 +309,7 @@ Tcl_RegexpObjCmd( eflags = 0; } else if (offset > stringLength) { eflags = TCL_REG_NOTBOL; - } else if (Tcl_GetUniChar(objPtr, offset-1) == (Tcl_UniChar)'\n') { + } else if (Tcl_GetUniChar(objPtr, offset-1) == '\n') { eflags = 0; } else { eflags = TCL_REG_NOTBOL; @@ -1080,13 +1080,22 @@ Tcl_SplitObjCmd( Tcl_InitHashTable(&charReuseTable, TCL_ONE_WORD_KEYS); for ( ; stringPtr < end; stringPtr += len) { + int fullchar; len = TclUtfToUniChar(stringPtr, &ch); + fullchar = ch; + +#if TCL_UTF_MAX == 4 + if (!len) { + len += TclUtfToUniChar(stringPtr, &ch); + fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + } +#endif /* * Assume Tcl_UniChar is an integral type... */ - hPtr = Tcl_CreateHashEntry(&charReuseTable, INT2PTR((int) ch), + hPtr = Tcl_CreateHashEntry(&charReuseTable, INT2PTR(fullchar), &isNew); if (isNew) { TclNewStringObj(objPtr, stringPtr, len); @@ -1783,8 +1792,16 @@ StringIsCmd( } end = string1 + length1; for (; string1 < end; string1 += length2, failat++) { + int fullchar; length2 = TclUtfToUniChar(string1, &ch); - if (!chcomp(ch)) { + fullchar = ch; +#if TCL_UTF_MAX == 4 + if (!length2) { + length2 = TclUtfToUniChar(string1, &ch); + fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + } +#endif + if (!chcomp(fullchar)) { result = 0; break; } diff --git a/tests/split.test b/tests/split.test index 778131f..18055b3 100644 --- a/tests/split.test +++ b/tests/split.test @@ -70,6 +70,9 @@ test split-1.13 {basic split commands} { test split-1.14 {basic split commands} { split ",12,,,34,56," {,} } {{} 12 {} {} 34 56 {}} +test split-1.15 {basic split commands} -body { + split "a\U01f4a9b" {} +} -result "a \U01f4a9 b" test split-2.1 {split errors} { list [catch split msg] $msg $errorCode -- cgit v0.12 From 932afb01058a92816df27ea786c0a5c0cbd09290 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sat, 11 Nov 2017 09:18:09 +0000 Subject: Improvements to tip430 to embed the /library file system within a shared library or as a zip archive with a canonical name matching the current patch level This new version also builds a native executable version of minizip to allow archive to be built within make, even when cross compiling Added a new function TclZipfs_AppHook which implements tip430 core behavior startups to stock tclsh Embedding the file system as a zip archive can be defeated with --enable-zipfs=no --- generic/tcl.decls | 4 +- generic/tclDecls.h | 5 ++ generic/tclInterp.c | 2 + generic/tclPkgConfig.c | 2 + generic/tclStubInit.c | 1 + generic/tclZipfs.c | 73 +++++++++++++++++++- unix/Makefile.in | 152 +++++++++++++++++++++++++++++++++++++++-- unix/configure | 178 ++++++++++++++++++++++++++++++++++++++++++++++++- unix/configure.ac | 61 +++++++++++++++++ unix/tcl.m4 | 107 +++++++++++++++++++++++++++++ unix/tclAppInit.c | 2 + unix/tclConfig.sh.in | 3 + 12 files changed, 582 insertions(+), 8 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index c19bf68..fcc6235 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2343,7 +2343,9 @@ declare 632 { declare 633 { int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) } - +declare 634 { + int TclZipfs_AppHook(int *argc, char ***argv) +} ############################################################################## # Define the platform specific public Tcl interface. These functions are only diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 24a22c3..c7cac7c 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1838,6 +1838,8 @@ EXTERN int TclZipfs_Mount(Tcl_Interp *interp, /* 633 */ EXTERN int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname); +/* 634 */ +EXTERN int TclZipfs_AppHook(int *argc, char ***argv); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2507,6 +2509,7 @@ typedef struct TclStubs { Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, const char *service, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */ int (*tclZipfs_Mount) (Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd); /* 632 */ int (*tclZipfs_Unmount) (Tcl_Interp *interp, const char *zipname); /* 633 */ + int (*tclZipfs_AppHook) (int *argc, char ***argv); /* 634 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -3805,6 +3808,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tclZipfs_Mount) /* 632 */ #define TclZipfs_Unmount \ (tclStubsPtr->tclZipfs_Unmount) /* 633 */ +#define TclZipfs_AppHook \ + (tclStubsPtr->tclZipfs_AppHook) /* 634 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclInterp.c b/generic/tclInterp.c index d9dfd37..2b0582a 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -402,6 +402,8 @@ Tcl_Init( " set scripts {{set tcl_library}}\n" " } else {\n" " set scripts {}\n" +" lappend scripts {set temp zipfs:/lib/tcl/tcl_library}\n" +" lappend scripts {set temp zipfs:/app/tcl_library}\n" " if {[info exists env(TCL_LIBRARY)] && ($env(TCL_LIBRARY) ne {})} {\n" " lappend scripts {set env(TCL_LIBRARY)}\n" " lappend scripts {\n" diff --git a/generic/tclPkgConfig.c b/generic/tclPkgConfig.c index 466d535..53b7dbb 100644 --- a/generic/tclPkgConfig.c +++ b/generic/tclPkgConfig.c @@ -105,6 +105,8 @@ static Tcl_Config const cfg[] = { {"scriptdir,runtime", CFG_RUNTIME_SCRDIR}, {"includedir,runtime", CFG_RUNTIME_INCDIR}, {"docdir,runtime", CFG_RUNTIME_DOCDIR}, + {"dllfile,runtime", CFG_RUNTIME_DLLFILE}, + {"zipfile,runtime", CFG_RUNTIME_ZIPFILE}, /* Installation paths to various stuff */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index f251a57..16d5837 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -1538,6 +1538,7 @@ const TclStubs tclStubs = { Tcl_OpenTcpServerEx, /* 631 */ TclZipfs_Mount, /* 632 */ TclZipfs_Unmount, /* 633 */ + TclZipfs_AppHook, /* 634 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index fe4553e..9dfca7a 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -28,7 +28,10 @@ #include "zlib.h" #include "crypt.h" -#define ZIPFS_VOLUME "zipfs:/" +#define ZIPFS_VOLUME "zipfs:/" +#define ZIPFS_APP_MOUNT "zipfs:/app" +#define ZIPFS_ZIP_MOUNT "zipfs:/lib/tcl" + #define ZIPFS_VOLUME_LEN 7 /* @@ -3807,7 +3810,7 @@ const Tcl_Filesystem zipfsFilesystem = { *------------------------------------------------------------------------- */ -int +MODULE_SCOPE int TclZipfs_Init(Tcl_Interp *interp) { #ifdef HAVE_ZLIB @@ -3877,6 +3880,72 @@ TclZipfs_Init(Tcl_Interp *interp) return TCL_ERROR; #endif } + +static int TclZipfs_AppHook_FindTclInit(const char *archive){ + Tcl_Obj *vfsinitscript; + int found; + if(TclZipfs_Mount(NULL, archive, ZIPFS_ZIP_MOUNT, NULL)) { + /* Either the file doesn't exist or it is not a zip archive */ + return TCL_ERROR; + } + vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/init.tcl",-1); + Tcl_IncrRefCount(vfsinitscript); + found=Tcl_FSAccess(vfsinitscript,F_OK); + if(found==0) { + return TCL_OK; + } + Tcl_DecrRefCount(vfsinitscript); + vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/tcl_library/init.tcl",-1); + Tcl_IncrRefCount(vfsinitscript); + found=Tcl_FSAccess(vfsinitscript,F_OK); + if(found==0) { + return TCL_OK; + } + return TCL_ERROR; +} + +int TclZipfs_AppHook(int *argc, char ***argv){ + /* + * Tclkit_MainHook -- + * Performs the argument munging for the shell + */ + + CONST char *archive; + Tcl_FindExecutable(*argv[0]); + archive=Tcl_GetNameOfExecutable(); + TclZipfs_Init(NULL); + if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { + int found; + Tcl_Obj *vfsinitscript; + vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/main.tcl",-1); + Tcl_IncrRefCount(vfsinitscript); + if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { + /* Startup script should be set before calling Tcl_AppInit */ + Tcl_SetStartupScript(vfsinitscript,NULL); + } else { + Tcl_DecrRefCount(vfsinitscript); + } + /* Set Tcl Encodings */ + vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library/init.tcl",-1); + Tcl_IncrRefCount(vfsinitscript); + found=Tcl_FSAccess(vfsinitscript,F_OK); + Tcl_DecrRefCount(vfsinitscript); + if(found==TCL_OK) { + return TCL_OK; + } + } + /* Mount zip file and dll before releasing to search */ + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_ZIPFILE)==TCL_OK) { + return TCL_OK; + } + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { + return TCL_OK; + } + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_DLLFILE)==TCL_OK) { + return TCL_OK; + } + return TCL_OK; +} #ifndef HAVE_ZLIB diff --git a/unix/Makefile.in b/unix/Makefile.in index 5f4e125..d7cc3c7 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -199,6 +199,10 @@ LD_SEARCH_FLAGS = @LD_SEARCH_FLAGS@ BUILD_DLTEST = @BUILD_DLTEST@ #BUILD_DLTEST = +TCL_ZIP_FILE = @TCL_ZIP_FILE@ +TCL_VFS_PATH = libtcl.vfs/tcl_library +TCL_VFS_ROOT = libtcl.vfs + TCL_LIB_FILE = @TCL_LIB_FILE@ #TCL_LIB_FILE = libtcl.a @@ -242,6 +246,14 @@ ZLIB_DIR = ${COMPAT_DIR}/zlib ZLIB_INCLUDE = @ZLIB_INCLUDE@ CC = @CC@ +OBJEXT = @OBJEXT@ +HOST_CC = @CC_FOR_BUILD@ +HOST_EXEEXT = @EXEEXT_FOR_BUILD@ +HOST_OBJEXT = @OBJEXT_FOR_BUILD@ +ZIPFS_BUILD = @ZIPFS_BUILD@ +NATIVE_ZIP = @ZIP_PROG@ +SHARED_BUILD = @SHARED_BUILD@ + #CC = purify -best-effort @CC@ -DPURIFY # Flags to be passed to installManPage to control how the manpages should be @@ -251,6 +263,10 @@ MAN_FLAGS = @MAN_FLAGS@ # If non-empty, install the timezone files that are included with Tcl, # otherwise use the ones that ship with the OS. INSTALL_TZDATA = @INSTALL_TZDATA@ +INSTALL_LIBRARIES = @INSTALL_LIBRARIES@ +INSTALL_MSGS = @INSTALL_MSGS@ + + #-------------------------------------------------------------------------- # The information below is usually usable as is. The configure script won't @@ -617,6 +633,26 @@ ZLIB_SRCS = \ SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \ $(OO_SRCS) $(STUB_SRCS) @PLAT_SRCS@ @ZLIB_SRCS@ +# Minizip +MINIZIP_OBJS = \ + adler32.$(HOST_OBJEXT) \ + compress.$(HOST_OBJEXT) \ + crc32.$(HOST_OBJEXT) \ + deflate.$(HOST_OBJEXT) \ + infback.$(HOST_OBJEXT) \ + inffast.$(HOST_OBJEXT) \ + inflate.$(HOST_OBJEXT) \ + inftrees.$(HOST_OBJEXT) \ + ioapi.$(HOST_OBJEXT) \ + trees.$(HOST_OBJEXT) \ + uncompr.$(HOST_OBJEXT) \ + zip.$(HOST_OBJEXT) \ + zutil.$(HOST_OBJEXT) \ + minizip.$(HOST_OBJEXT) + +ZIP_INSTALL_OBJS = minizip${EXEEXT_FOR_BUILD} + + #-------------------------------------------------------------------------- # Start of rules #-------------------------------------------------------------------------- @@ -629,11 +665,23 @@ libraries: doc: +tclzipfile: ${TCL_ZIP_FILE} + + +${TCL_ZIP_FILE}: ${ZIP_INSTALL_OBJS} + rm -rf ${TCL_VFS_ROOT} + mkdir -p ${TCL_VFS_PATH} + cp -a ../library/* ${TCL_VFS_PATH} + cd ${TCL_VFS_ROOT} ; ../minizip${EXEEXT_FOR_BUILD} -o ../${TCL_ZIP_FILE} `find . -type f` + # The following target is configured by autoconf to generate either a shared # library or non-shared library for Tcl. -${LIB_FILE}: ${STUB_LIB_FILE} ${OBJS} +${LIB_FILE}: ${STUB_LIB_FILE} ${OBJS} ${TCL_ZIP_FILE} rm -f $@ @MAKE_LIB@ +ifeq (${ZIPFS_BUILD},1) + cat ${TCL_ZIP_FILE} >> ${LIB_FILE} +endif ${STUB_LIB_FILE}: ${STUB_LIB_OBJS} @if test "x${LIB_FILE}" = "xlibtcl${MAJOR_VERSION}.${MINOR_VERSION}.dll"; then \ @@ -667,7 +715,8 @@ Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in clean: clean-packages rm -rf *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \ - errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ + errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ \ + minizip${EXEEXT_FOR_BUILD} *.${HOST_OBJEXT} cd dltest ; $(MAKE) clean distclean: distclean-packages clean @@ -777,7 +826,7 @@ trace-test: ${TCLTEST_EXE} # Installation rules #-------------------------------------------------------------------------- -INSTALL_BASE_TARGETS = install-binaries install-libraries install-msgs $(INSTALL_TZDATA) +INSTALL_BASE_TARGETS = install-binaries $(INSTALL_LIBRARIES) $(INSTALL_MSGS) $(INSTALL_TZDATA) INSTALL_DOC_TARGETS = install-doc INSTALL_PACKAGE_TARGETS = install-packages INSTALL_DEV_TARGETS = install-headers @@ -821,6 +870,25 @@ install-binaries: binaries @$(INSTALL_DATA_DIR) $(LIB_INSTALL_DIR)/pkgconfig @$(INSTALL_DATA) tcl.pc $(LIB_INSTALL_DIR)/pkgconfig/tcl.pc +install-libraries-zipfs-shared: libraries + @for i in "$(SCRIPT_INSTALL_DIR)"; \ + do \ + if [ ! -d "$$i" ] ; then \ + echo "Making directory $$i"; \ + $(INSTALL_DATA_DIR) "$$i"; \ + else true; \ + fi; \ + done; + @echo "Installing library files to $(SCRIPT_INSTALL_DIR)/"; + @for i in \ + $(UNIX_DIR)/tclAppInit.c @LDAIX_SRC@ @DTRACE_SRC@; \ + do \ + $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"; \ + done; + +install-libraries-zipfs-static: install-libraries-zipfs-shared + $(INSTALL_DATA) ${TCL_ZIP_FILE} "$(LIB_INSTALL_DIR)" ;\ + install-libraries: libraries @for i in "$(SCRIPT_INSTALL_DIR)"; \ do \ @@ -875,6 +943,7 @@ install-libraries: libraries echo "if {![interp issafe]} { ::tcl::tm::roots {$(TCL_MODULE_PATH)} }" >> \ "$(SCRIPT_INSTALL_DIR)"/tm.tcl; \ fi + end install-tzdata: @for i in tzdata; \ @@ -1282,6 +1351,8 @@ tclPkgConfig.o: $(GENERIC_DIR)/tclPkgConfig.c -DCFG_RUNTIME_SCRDIR="\"$(TCL_LIBRARY)\"" \ -DCFG_RUNTIME_INCDIR="\"$(includedir)\"" \ -DCFG_RUNTIME_DOCDIR="\"$(mandir)\"" \ + -DCFG_RUNTIME_DLLFILE="\"$(TCL_LIB_FILE)\"" \ + -DCFG_RUNTIME_ZIPFILE="\"$(TCL_ZIP_FILE)\"" \ \ $(GENERIC_DIR)/tclPkgConfig.c @@ -1331,7 +1402,11 @@ tclZlib.o: $(GENERIC_DIR)/tclZlib.c $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) $(GENERIC_DIR)/tclZlib.c tclZipfs.o: $(GENERIC_DIR)/tclZipfs.c - $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) -I$(ZLIB_DIR)/contrib/minizip $(GENERIC_DIR)/tclZipfs.c + $(CC) -c $(CC_SWITCHES) \ + -DCFG_RUNTIME_DLLFILE="\"$(TCL_LIB_FILE)\"" \ + -DCFG_RUNTIME_ZIPFILE="\"$(TCL_ZIP_FILE)\"" \ + -DCFG_RUNTIME_PATH="\"$(DLL_INSTALL_DIR)\"" \ + $(ZLIB_INCLUDE) -I$(ZLIB_DIR)/contrib/minizip $(GENERIC_DIR)/tclZipfs.c tclTest.o: $(GENERIC_DIR)/tclTest.c $(IOHDR) $(TCLREHDRS) $(CC) -c $(APP_CC_SWITCHES) $(GENERIC_DIR)/tclTest.c @@ -1741,6 +1816,74 @@ tclOOStubLib.o: $(GENERIC_DIR)/tclOOStubLib.c $(CC) -c $(CC_SWITCHES) $< #-------------------------------------------------------------------------- +# Minizip implementation +#-------------------------------------------------------------------------- +adler32.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/adler32.c + +compress.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/compress.c + +crc32.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/crc32.c + +deflate.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/deflate.c + +ioapi.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/ioapi.c + +infback.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/infback.c + +inffast.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/inffast.c + +inflate.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/inflate.c + +inftrees.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/inftrees.c + +trees.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/trees.c + +uncompr.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/uncompr.c + +zip.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/zip.c + +zutil.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/zutil.c + +minizip.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/minizip.c + +minizip${EXEEXT_FOR_BUILD}: $(MINIZIP_OBJS) + $(HOST_CC) -o $@ $(MINIZIP_OBJS) + +tclvfs.zip: minizip${EXEEXT_FOR_BUILD} + rm -rf $(TCL_VFS_ROOT) + mkdir -p $(TCL_VFS_PATH) + @for i in "$(TCL_VFS_PATH)"; \ + do \ + if [ ! -d "$$i" ] ; then \ + echo "Making directory $$i"; \ + $(INSTALL_DATA_DIR) "$$i"; \ + else true; \ + fi; \ + done; + cp -a ../library/* $(TCL_VFS_PATH) + (cd $TCL_VFS ROOT ; ./minizip${EXEEXT_FOR_BUILD} -o ../tclvfs.zip `find . -type f`) + +zipsetupstub.$(HOST_OBJEXT): $(COMPAT_DIR)/zipsetupstub.c + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(COMPAT_DIR)/zipsetupstub.c + +zipsetupstub${EXEEXT_FOR_BUILD}: zipsetupstub.$(HOST_OBJEXT) + $(HOST_CC) -o $@ zipsetupstub.$(HOST_OBJEXT) + +#-------------------------------------------------------------------------- # Bundled Package targets #-------------------------------------------------------------------------- @@ -2148,6 +2291,7 @@ BUILD_HTML = \ .PHONY: install-tzdata install-msgs .PHONY: packages configure-packages test-packages clean-packages .PHONY: dist-packages distclean-packages install-packages +.PHONY: iinstall-libraries-zipfs-shared install-libraries-zipfs-static tclzipfile #-------------------------------------------------------------------------- # DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/unix/configure b/unix/configure index 129c283..8e2ec0f 100755 --- a/unix/configure +++ b/unix/configure @@ -658,12 +658,16 @@ TCL_STUB_LIB_FILE TCL_LIB_SPEC TCL_LIB_FLAG TCL_LIB_FILE +TCL_ZIP_FILE PKG_CFG_ARGS TCL_YEAR TCL_PATCH_LEVEL TCL_MINOR_VERSION TCL_MAJOR_VERSION TCL_VERSION +INSTALL_MSGS +INSTALL_LIBRARIES +ZIPFS_BUILD DTRACE LDFLAGS_DEFAULT CFLAGS_DEFAULT @@ -698,7 +702,11 @@ RANLIB ZLIB_INCLUDE ZLIB_SRCS ZLIB_OBJS +EXEEXT_FOR_BUILD +CC_FOR_BUILD +ZIP_PROG TCLSH_PROG +SHARED_BUILD TCL_THREADS EGREP GREP @@ -748,7 +756,8 @@ PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +OBJEXT_FOR_BUILD' ac_subst_files='' ac_user_opts=' enable_option_checking @@ -768,6 +777,7 @@ enable_langinfo enable_dll_unloading with_tzdata enable_dtrace +enable_zipfs enable_framework ' ac_precious_vars='build_alias @@ -1408,6 +1418,7 @@ Optional Features: startup, otherwise use old heuristic (default: on) --enable-dll-unloading enable the 'unload' command (default: on) --enable-dtrace build with DTrace support (default: off) + --enable-zipfs build with Zipfs support (default: on) --enable-framework package shared libraries in MacOSX frameworks (default: off) @@ -2330,6 +2341,7 @@ VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} EXTRA_BUILD_HTML=${EXTRA_BUILD_HTML:-"@:"} +TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip #------------------------------------------------------------------------ # Setup configure arguments for bundled packages @@ -3273,6 +3285,7 @@ _ACEOF esac + #-------------------------------------------------------------------- # Supply substitutes for missing POSIX header files. Special notes: # - stdlib.h doesn't define strtol, strtoul, or @@ -4545,6 +4558,7 @@ $as_echo "#define STATIC_BUILD 1" >>confdefs.h fi + #-------------------------------------------------------------------- # Look for a native installed tclsh binary (if available) # If one cannot be found then use the binary we build (fails for @@ -4590,6 +4604,120 @@ if test "$TCLSH_PROG" = ""; then TCLSH_PROG='./${TCL_EXE}' fi +# +# Check for --enable-zipfs flag +# +SC_ENABLE_ZIPFS + +# +# Find a native zip implementation +# + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 +$as_echo_n "checking for zip... " >&6; } + if ${ac_cv_path_zip+:} false; then : + $as_echo_n "(cached) " >&6 +else + + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/zip 2> /dev/null` \ + `ls -r $dir/zip 2> /dev/null` ; do + if test x"$ac_cv_path_zip" = x ; then + if test -f "$j" ; then + ac_cv_path_zip=$j + break + fi + fi + done + done + +fi + + + if test -f "$ac_cv_path_zip" ; then + ZIP_PROG="$ac_cv_path_zip" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5 +$as_echo "$ZIP_PROG" >&6; } + else + # It is not an error if an installed version of Zip can't be located. + ZIP_PROG="" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH" >&5 +$as_echo "No zip found on PATH" >&6; } + fi + + + +# +# Find a native compiler +# +# Put a plausible default for CC_FOR_BUILD in Makefile. +if test -z "$CC_FOR_BUILD"; then + if test "x$cross_compiling" = "xno"; then + CC_FOR_BUILD='$(CC)' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5 +$as_echo_n "checking for gcc... " >&6; } + if ${ac_cv_path_cc+:} false; then : + $as_echo_n "(cached) " >&6 +else + + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/gcc 2> /dev/null` \ + `ls -r $dir/gcc 2> /dev/null` ; do + if test x"$ac_cv_path_cc" = x ; then + if test -f "$j" ; then + ac_cv_path_cc=$j + break + fi + fi + done + done + +fi + + fi +fi + +# Also set EXEEXT_FOR_BUILD. +if test "x$cross_compiling" = "xno"; then + EXEEXT_FOR_BUILD='$(EXEEXT)' + OBJEXT_FOR_BUILD='$(OBJEXT)' +else + OBJEXT_FOR_BUILD='.no' + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5 +$as_echo_n "checking for build system executable suffix... " >&6; } +if ${bfd_cv_build_exeext+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.c + bfd_cv_build_exeext= + ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + rm -f conftest* + test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5 +$as_echo "$bfd_cv_build_exeext" >&6; } + EXEEXT_FOR_BUILD="" + test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} +fi + + +if test "$ZIP_PROG" = ""; then + ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}' +fi + + + + #------------------------------------------------------------------------ # Add stuff for zlib #------------------------------------------------------------------------ @@ -10151,6 +10279,53 @@ fi $as_echo "$tcl_ok" >&6; } #-------------------------------------------------------------------- +# Zipfs support +#-------------------------------------------------------------------- + +# Check whether --enable-zipfs was given. +if test "${enable_zipfs+set}" = set; then : + enableval=$enable_zipfs; tcl_ok=$enableval +else + tcl_ok=yes +fi + + if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then + ZIPFS_BUILD=1 + else + ZIPFS_BUILD=0 + fi + # Do checking message here to not mess up interleaved configure output + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5 +$as_echo_n "checking for building with zipfs... " >&6; } + if test "${ZIPFS_BUILD}" = 1; then + if test "${SHARED_BUILD}" = 0; then + ZIPFS_BUILD=2; + +$as_echo "#define ZIPFS_BUILD 2" >>confdefs.h + + INSTALL_LIBRARIES=install-libraries-zipfs-static + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + +$as_echo "#define ZIPFS_BUILD 1" >>confdefs.h +\ + INSTALL_LIBRARIES=install-libraries-zipfs-shared + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + INSTALL_LIBRARIES=install-libraries + INSTALL_MSGS=install-msgs + fi + + + + + +#-------------------------------------------------------------------- # The check below checks whether the cpuid instruction is usable. #-------------------------------------------------------------------- @@ -10436,6 +10611,7 @@ TCL_SHARED_BUILD=${SHARED_BUILD} + ac_config_files="$ac_config_files Makefile:../unix/Makefile.in dltest/Makefile:../unix/dltest/Makefile.in tclConfig.sh:../unix/tclConfig.sh.in tcl.pc:../unix/tcl.pc.in" cat >confcache <<\_ACEOF diff --git a/unix/configure.ac b/unix/configure.ac index e14d85e..b2700cf 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -30,6 +30,7 @@ VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} EXTRA_BUILD_HTML=${EXTRA_BUILD_HTML:-"@:"} +TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip #------------------------------------------------------------------------ # Setup configure arguments for bundled packages @@ -86,6 +87,7 @@ fi AC_PROG_CC AC_C_INLINE + #-------------------------------------------------------------------- # Supply substitutes for missing POSIX header files. Special notes: # - stdlib.h doesn't define strtol, strtoul, or @@ -153,6 +155,28 @@ if test "$TCLSH_PROG" = ""; then TCLSH_PROG='./${TCL_EXE}' fi +# +# Check for --enable-zipfs flag +# +SC_ENABLE_ZIPFS + +# +# Find a native zip implementation +# +SC_PROG_ZIP + +# +# Find a native compiler +# +AX_CC_FOR_BUILD + +if test "$ZIP_PROG" = ""; then + ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}' +fi + + + + #------------------------------------------------------------------------ # Add stuff for zlib #------------------------------------------------------------------------ @@ -791,6 +815,42 @@ fi AC_MSG_RESULT([$tcl_ok]) #-------------------------------------------------------------------- +# Zipfs support +#-------------------------------------------------------------------- + +AC_ARG_ENABLE(zipfs, + AC_HELP_STRING([--enable-zipfs], + [build with Zipfs support (default: on)]), + [tcl_ok=$enableval], [tcl_ok=yes]) + if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then + ZIPFS_BUILD=1 + else + ZIPFS_BUILD=0 + fi + # Do checking message here to not mess up interleaved configure output + AC_MSG_CHECKING([for building with zipfs]) + if test "${ZIPFS_BUILD}" = 1; then + if test "${SHARED_BUILD}" = 0; then + ZIPFS_BUILD=2; + AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?]) + INSTALL_LIBRARIES=install-libraries-zipfs-static + AC_MSG_RESULT([yes]) + else + AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\ + INSTALL_LIBRARIES=install-libraries-zipfs-shared + AC_MSG_RESULT([yes]) + fi + else + AC_MSG_RESULT([no]) + INSTALL_LIBRARIES=install-libraries + INSTALL_MSGS=install-msgs + fi + AC_SUBST(ZIPFS_BUILD) + AC_SUBST(INSTALL_LIBRARIES) + AC_SUBST(INSTALL_MSGS) + + +#-------------------------------------------------------------------- # The check below checks whether the cpuid instruction is usable. #-------------------------------------------------------------------- @@ -960,6 +1020,7 @@ AC_SUBST(TCL_PATCH_LEVEL) AC_SUBST(TCL_YEAR) AC_SUBST(PKG_CFG_ARGS) +AC_SUBST(TCL_ZIP_FILE) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_LIB_SPEC) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 45922e0..132e602 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -276,6 +276,7 @@ AC_DEFUN([SC_PATH_TKCONFIG], [ # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE +# TCL_ZIP_FILE #------------------------------------------------------------------------ AC_DEFUN([SC_LOAD_TCLCONFIG], [ @@ -289,6 +290,7 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [ fi # eval is required to do the TCL_DBGX substitution + eval "TCL_ZIP_FILE=\"${TCL_ZIP_FILE}\"" eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" @@ -336,6 +338,7 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [ AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SRC_DIR) + AC_SUBST(TCL_ZIP_FILE) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_LIB_SPEC) @@ -542,6 +545,7 @@ AC_DEFUN([SC_ENABLE_SHARED], [ SHARED_BUILD=0 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?]) fi + AC_SUBST(SHARED_BUILD) ]) #------------------------------------------------------------------------ @@ -3014,6 +3018,109 @@ if test "x$NEED_FAKE_RFC2553" = "x1"; then AC_CHECK_FUNC(strlcpy) fi ]) + +#------------------------------------------------------------------------ +# SC_PROG_ZIP +# Locate a zip encoder installed on the system path, or none. +# +# Arguments: +# none +# +# Results: +# Substitutes the following vars: +# ZIP_PROG +#------------------------------------------------------------------------ + +AC_DEFUN([SC_PROG_ZIP], [ + AC_MSG_CHECKING([for zip]) + AC_CACHE_VAL(ac_cv_path_zip, [ + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/zip 2> /dev/null` \ + `ls -r $dir/zip 2> /dev/null` ; do + if test x"$ac_cv_path_zip" = x ; then + if test -f "$j" ; then + ac_cv_path_zip=$j + break + fi + fi + done + done + ]) + + if test -f "$ac_cv_path_zip" ; then + ZIP_PROG="$ac_cv_path_zip" + AC_MSG_RESULT([$ZIP_PROG]) + else + # It is not an error if an installed version of Zip can't be located. + ZIP_PROG="" + AC_MSG_RESULT([No zip found on PATH]) + fi + AC_SUBST(ZIP_PROG) +]) + +#------------------------------------------------------------------------ +# SC_CC_FOR_BUILD +# For cross compiles, locate a C compiler that can generate native binaries. +# +# Arguments: +# none +# +# Results: +# Substitutes the following vars: +# CC_FOR_BUILD +# EXEEXT_FOR_BUILD +#------------------------------------------------------------------------ + +dnl Get a default for CC_FOR_BUILD to put into Makefile. +AC_DEFUN([AX_CC_FOR_BUILD], +[# Put a plausible default for CC_FOR_BUILD in Makefile. +if test -z "$CC_FOR_BUILD"; then + if test "x$cross_compiling" = "xno"; then + CC_FOR_BUILD='$(CC)' + else + AC_MSG_CHECKING([for gcc]) + AC_CACHE_VAL(ac_cv_path_cc, [ + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/gcc 2> /dev/null` \ + `ls -r $dir/gcc 2> /dev/null` ; do + if test x"$ac_cv_path_cc" = x ; then + if test -f "$j" ; then + ac_cv_path_cc=$j + break + fi + fi + done + done + ]) + fi +fi +AC_SUBST(CC_FOR_BUILD) +# Also set EXEEXT_FOR_BUILD. +if test "x$cross_compiling" = "xno"; then + EXEEXT_FOR_BUILD='$(EXEEXT)' + OBJEXT_FOR_BUILD='$(OBJEXT)' +else + OBJEXT_FOR_BUILD='.no' + AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, + [rm -f conftest* + echo 'int main () { return 0; }' > conftest.c + bfd_cv_build_exeext= + ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + rm -f conftest* + test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) + EXEEXT_FOR_BUILD="" + test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} +fi +AC_SUBST(EXEEXT_FOR_BUILD)])dnl +AC_SUBST(OBJEXT_FOR_BUILD)])dnl # Local Variables: # mode: autoconf # End: diff --git a/unix/tclAppInit.c b/unix/tclAppInit.c index 9bbc88b..3587f35 100644 --- a/unix/tclAppInit.c +++ b/unix/tclAppInit.c @@ -79,6 +79,8 @@ main( #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); +#else + TclZipfs_AppHook(&argc, &argv); #endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); diff --git a/unix/tclConfig.sh.in b/unix/tclConfig.sh.in index fdc56b7..3da4afd 100644 --- a/unix/tclConfig.sh.in +++ b/unix/tclConfig.sh.in @@ -39,6 +39,9 @@ TCL_SHARED_BUILD=@TCL_SHARED_BUILD@ # The name of the Tcl library (may be either a .a file or a shared library): TCL_LIB_FILE='@TCL_LIB_FILE@' +# The name of a zip containing the /library and /encodings (may be either a .zip file or a shared library): +TCL_ZIP_FILE='@TCL_ZIP_FILE@' + # Additional libraries to use when linking Tcl. TCL_LIBS='@TCL_LIBS@' -- cgit v0.12 From 01fd6594cf127d8b79a5747c73469af626bdccd8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 13 Nov 2017 08:37:55 +0000 Subject: Add a lot of "deprecation" marks to internal API which will be removed in Tcl 9.0 (see also tcl-9-cleanup branch). Extensions still using this API will get a compiler warning, but everything will continue to work fine for all future 8.x releases. --- generic/tcl.decls | 6 ++---- generic/tclDecls.h | 10 +++++---- generic/tclInt.decls | 56 +++++++++++++++++++------------------------------- generic/tclIntDecls.h | 57 ++++++++++++++++++++++++++++++--------------------- 4 files changed, 63 insertions(+), 66 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index b2b91a9..7c9935a 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -780,8 +780,7 @@ declare 218 { declare 219 { int Tcl_ScanCountedElement(const char *src, int length, int *flagPtr) } -# Obsolete -declare 220 { +declare 220 {deprecated {}} { int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode) } declare 221 { @@ -868,8 +867,7 @@ declare 244 { declare 245 { int Tcl_StringMatch(const char *str, const char *pattern) } -# Obsolete -declare 246 { +declare 246 {deprecated {}} { int Tcl_TellOld(Tcl_Channel chan) } declare 247 { diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 464fc0f..864cad8 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -669,7 +669,8 @@ EXTERN int Tcl_ScanElement(const char *src, int *flagPtr); EXTERN int Tcl_ScanCountedElement(const char *src, int length, int *flagPtr); /* 220 */ -EXTERN int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode); +TCL_DEPRECATED("") +int Tcl_SeekOld(Tcl_Channel chan, int offset, int mode); /* 221 */ EXTERN int Tcl_ServiceAll(void); /* 222 */ @@ -741,7 +742,8 @@ EXTERN void Tcl_StaticPackage(Tcl_Interp *interp, /* 245 */ EXTERN int Tcl_StringMatch(const char *str, const char *pattern); /* 246 */ -EXTERN int Tcl_TellOld(Tcl_Channel chan); +TCL_DEPRECATED("") +int Tcl_TellOld(Tcl_Channel chan); /* 247 */ EXTERN int Tcl_TraceVar(Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, @@ -2086,7 +2088,7 @@ typedef struct TclStubs { void (*tcl_ResetResult) (Tcl_Interp *interp); /* 217 */ int (*tcl_ScanElement) (const char *src, int *flagPtr); /* 218 */ int (*tcl_ScanCountedElement) (const char *src, int length, int *flagPtr); /* 219 */ - int (*tcl_SeekOld) (Tcl_Channel chan, int offset, int mode); /* 220 */ + TCL_DEPRECATED_API("") int (*tcl_SeekOld) (Tcl_Channel chan, int offset, int mode); /* 220 */ int (*tcl_ServiceAll) (void); /* 221 */ int (*tcl_ServiceEvent) (int flags); /* 222 */ void (*tcl_SetAssocData) (Tcl_Interp *interp, const char *name, Tcl_InterpDeleteProc *proc, ClientData clientData); /* 223 */ @@ -2112,7 +2114,7 @@ typedef struct TclStubs { void (*tcl_SplitPath) (const char *path, int *argcPtr, CONST84 char ***argvPtr); /* 243 */ void (*tcl_StaticPackage) (Tcl_Interp *interp, const char *pkgName, Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc); /* 244 */ int (*tcl_StringMatch) (const char *str, const char *pattern); /* 245 */ - int (*tcl_TellOld) (Tcl_Channel chan); /* 246 */ + TCL_DEPRECATED_API("") int (*tcl_TellOld) (Tcl_Channel chan); /* 246 */ int (*tcl_TraceVar) (Tcl_Interp *interp, const char *varName, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 247 */ int (*tcl_TraceVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags, Tcl_VarTraceProc *proc, ClientData clientData); /* 248 */ char * (*tcl_TranslateFileName) (Tcl_Interp *interp, const char *name, Tcl_DString *bufferPtr); /* 249 */ diff --git a/generic/tclInt.decls b/generic/tclInt.decls index dea698c..b683a29 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -50,7 +50,7 @@ declare 6 { declare 7 { int TclCopyAndCollapse(int count, const char *src, char *dst) } -declare 8 { +declare 8 {deprecated {}} { int TclCopyChannelOld(Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr) } @@ -73,7 +73,7 @@ declare 11 { declare 12 { void TclDeleteVars(Interp *iPtr, TclVarHashTable *tablePtr) } -# Removed in 8.5 +# Removed in 8.5: #declare 13 { # int TclDoGlob(Tcl_Interp *interp, char *separators, # Tcl_DString *headPtr, char *tail, Tcl_GlobTypeData *types) @@ -88,7 +88,7 @@ declare 14 { declare 16 { void TclExprFloatError(Tcl_Interp *interp, double value) } -# Removed in 8.4 +# Removed in 8.4: #declare 17 { # int TclFileAttrsCmd(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) #} @@ -123,7 +123,7 @@ declare 25 { # declare 26 { # char *TclGetCwd(Tcl_Interp *interp) # } -# Removed in 8.5 +# Removed in 8.5: #declare 27 { # int TclGetDate(char *p, unsigned long now, long zone, # unsigned long *timePtr) @@ -147,7 +147,7 @@ declare 32 { int TclGetFrame(Tcl_Interp *interp, const char *str, CallFrame **framePtrPtr) } -# Removed in Tcl 8.5 +# Removed in 8.5: #declare 33 { # TclCmdProcType TclGetInterpProc(void) #} @@ -160,7 +160,7 @@ declare 34 { # Tcl_Obj *TclGetIndexedScalar(Tcl_Interp *interp, int localIndex, # int flags) #} -# Removed in 8.6a2 +# Removed in 8.6a2: #declare 36 { # int TclGetLong(Tcl_Interp *interp, const char *str, long *longPtr) #} @@ -185,7 +185,7 @@ declare 41 { declare 42 { CONST86 char *TclpGetUserHome(const char *name, Tcl_DString *bufferPtr) } -# Removed in Tcl 8.5a2 +# Removed in 8.5a2: #declare 43 { # int TclGlobalInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv, # int flags) @@ -220,7 +220,7 @@ declare 50 { declare 51 { int TclInterpInit(Tcl_Interp *interp) } -# Removed in Tcl 8.5a2 +# Removed in 8.5a2: #declare 52 { # int TclInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv, # int flags) @@ -273,7 +273,7 @@ declare 64 { int TclObjInvoke(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags) } -# Removed in Tcl 8.5a2 +# Removed in 8.5a2: #declare 65 { # int TclObjInvokeGlobal(Tcl_Interp *interp, int objc, # Tcl_Obj *const objv[], int flags) @@ -313,9 +313,7 @@ declare 75 { declare 76 { unsigned long TclpGetSeconds(void) } - -# deprecated -declare 77 { +declare 77 {deprecated {}} { void TclpGetTime(Tcl_Time *time) } # Removed in 8.6: @@ -380,7 +378,7 @@ declare 92 { declare 93 { void TclProcDeleteProc(ClientData clientData) } -# Removed in Tcl 8.5: +# Removed in 8.5: #declare 94 { # int TclProcInterpProc(ClientData clientData, Tcl_Interp *interp, # int argc, const char **argv) @@ -419,7 +417,7 @@ declare 103 { int TclSockGetPort(Tcl_Interp *interp, const char *str, const char *proto, int *portPtr) } -declare 104 { +declare 104 {deprecated {}} { int TclSockMinimumBuffersOld(int sock, int size) } # Replaced by Tcl_FSStat in 8.4: @@ -532,7 +530,7 @@ declare 131 { declare 132 { int TclpHasSockets(Tcl_Interp *interp) } -declare 133 { +declare 133 {deprecated {}} { struct tm *TclpGetDate(const time_t *time, int useGMT) } # Removed in 8.5 @@ -625,12 +623,10 @@ declare 156 { declare 157 { Var *TclVarTraceExists(Tcl_Interp *interp, const char *varName) } -# REMOVED (except from stub table) - use public Tcl_SetStartupScript() -declare 158 { +declare 158 {deprecated {use public Tcl_SetStartupScript()}} { void TclSetStartupScriptFileName(const char *filename) } -# REMOVED (except from stub table) - use public Tcl_GetStartupScript() -declare 159 { +declare 159 {deprecated {use public Tcl_GetStartupScript()}} { const char *TclGetStartupScriptFileName(void) } #declare 160 { @@ -676,13 +672,10 @@ declare 166 { int index, Tcl_Obj *valuePtr) } -# VFS-aware versions of Tcl*StartupScriptFileName (158 and 159 above) -# REMOVED (except from stub table) - use public Tcl_SetStartupScript() -declare 167 { +declare 167 {deprecated {use public Tcl_SetStartupScript()}} { void TclSetStartupScriptPath(Tcl_Obj *pathPtr) } -# REMOVED (except from stub table) - use public Tcl_GetStartupScript() -declare 168 { +declare 168 {deprecated {use public Tcl_GetStartupScript()}} { Tcl_Obj *TclGetStartupScriptPath(void) } # variant of Tcl_UtfNCmp that takes n as bytes, not chars @@ -730,7 +723,6 @@ declare 177 { void TclVarErrMsg(Tcl_Interp *interp, const char *part1, const char *part2, const char *operation, const char *reason) } -# TIP 338 made these public - now declared in tcl.h too declare 178 { void Tcl_SetStartupScript(Tcl_Obj *pathPtr, const char *encodingName) } @@ -748,12 +740,10 @@ declare 179 { # const char *file, int line) #} -# TclpGmtime and TclpLocaltime promoted to the generic interface from unix - -declare 182 { +declare 182 {deprecated {}} { struct tm *TclpLocaltime(const time_t *clock) } -declare 183 { +declare 183 {deprecated {}} { struct tm *TclpGmtime(const time_t *clock) } @@ -937,10 +927,7 @@ declare 234 { declare 235 { void TclInitVarHashTable(TclVarHashTable *tablePtr, Namespace *nsPtr) } - - -# TIP 337 made this one public -declare 236 { +declare 236 {deprecated {use Tcl_BackgroundException}} { void TclBackgroundException(Tcl_Interp *interp, int code) } @@ -1090,7 +1077,7 @@ declare 9 win { declare 10 win { Tcl_DirEntry *TclpReaddir(DIR *dir) } -# Removed in 8.3.1 (for Win32s only) +# Removed in 8.3.1 (for Win32s only): #declare 10 win { # int TclWinSynchSpawn(void *args, int type, void **trans, Tcl_Pid *pidPtr) #} @@ -1140,7 +1127,6 @@ declare 19 win { declare 20 win { void TclWinAddProcess(HANDLE hProcess, DWORD id) } -# new for 8.4.20+/8.5.12+ declare 21 win { char *TclpInetNtoa(struct in_addr addr) } diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 5bccfe5..4244362 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -75,7 +75,8 @@ EXTERN void TclCleanupCommand(Command *cmdPtr); EXTERN int TclCopyAndCollapse(int count, const char *src, char *dst); /* 8 */ -EXTERN int TclCopyChannelOld(Tcl_Interp *interp, +TCL_DEPRECATED("") +int TclCopyChannelOld(Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr); /* 9 */ @@ -218,7 +219,8 @@ EXTERN unsigned long TclpGetClicks(void); /* 76 */ EXTERN unsigned long TclpGetSeconds(void); /* 77 */ -EXTERN void TclpGetTime(Tcl_Time *time); +TCL_DEPRECATED("") +void TclpGetTime(Tcl_Time *time); /* Slot 78 is reserved */ /* Slot 79 is reserved */ /* Slot 80 is reserved */ @@ -267,7 +269,8 @@ EXTERN void TclSetupEnv(Tcl_Interp *interp); EXTERN int TclSockGetPort(Tcl_Interp *interp, const char *str, const char *proto, int *portPtr); /* 104 */ -EXTERN int TclSockMinimumBuffersOld(int sock, int size); +TCL_DEPRECATED("") +int TclSockMinimumBuffersOld(int sock, int size); /* Slot 105 is reserved */ /* Slot 106 is reserved */ /* Slot 107 is reserved */ @@ -350,7 +353,8 @@ EXTERN void Tcl_SetNamespaceResolvers( /* 132 */ EXTERN int TclpHasSockets(Tcl_Interp *interp); /* 133 */ -EXTERN struct tm * TclpGetDate(const time_t *time, int useGMT); +TCL_DEPRECATED("") +struct tm * TclpGetDate(const time_t *time, int useGMT); /* Slot 134 is reserved */ /* Slot 135 is reserved */ /* Slot 136 is reserved */ @@ -401,9 +405,11 @@ EXTERN void TclRegError(Tcl_Interp *interp, const char *msg, EXTERN Var * TclVarTraceExists(Tcl_Interp *interp, const char *varName); /* 158 */ -EXTERN void TclSetStartupScriptFileName(const char *filename); +TCL_DEPRECATED("use public Tcl_SetStartupScript()") +void TclSetStartupScriptFileName(const char *filename); /* 159 */ -EXTERN const char * TclGetStartupScriptFileName(void); +TCL_DEPRECATED("use public Tcl_GetStartupScript()") +const char * TclGetStartupScriptFileName(void); /* Slot 160 is reserved */ /* 161 */ EXTERN int TclChannelTransform(Tcl_Interp *interp, @@ -422,9 +428,11 @@ EXTERN int TclListObjSetElement(Tcl_Interp *interp, Tcl_Obj *listPtr, int index, Tcl_Obj *valuePtr); /* 167 */ -EXTERN void TclSetStartupScriptPath(Tcl_Obj *pathPtr); +TCL_DEPRECATED("use public Tcl_SetStartupScript()") +void TclSetStartupScriptPath(Tcl_Obj *pathPtr); /* 168 */ -EXTERN Tcl_Obj * TclGetStartupScriptPath(void); +TCL_DEPRECATED("use public Tcl_GetStartupScript()") +Tcl_Obj * TclGetStartupScriptPath(void); /* 169 */ EXTERN int TclpUtfNcmp2(const char *s1, const char *s2, unsigned long n); @@ -464,9 +472,11 @@ EXTERN Tcl_Obj * Tcl_GetStartupScript(const char **encodingNamePtr); /* Slot 180 is reserved */ /* Slot 181 is reserved */ /* 182 */ -EXTERN struct tm * TclpLocaltime(const time_t *clock); +TCL_DEPRECATED("") +struct tm * TclpLocaltime(const time_t *clock); /* 183 */ -EXTERN struct tm * TclpGmtime(const time_t *clock); +TCL_DEPRECATED("") +struct tm * TclpGmtime(const time_t *clock); /* Slot 184 is reserved */ /* Slot 185 is reserved */ /* Slot 186 is reserved */ @@ -570,7 +580,8 @@ EXTERN Var * TclVarHashCreateVar(TclVarHashTable *tablePtr, EXTERN void TclInitVarHashTable(TclVarHashTable *tablePtr, Namespace *nsPtr); /* 236 */ -EXTERN void TclBackgroundException(Tcl_Interp *interp, int code); +TCL_DEPRECATED("use Tcl_BackgroundException") +void TclBackgroundException(Tcl_Interp *interp, int code); /* 237 */ EXTERN int TclResetCancellation(Tcl_Interp *interp, int force); /* 238 */ @@ -652,7 +663,7 @@ typedef struct TclIntStubs { int (*tclCleanupChildren) (Tcl_Interp *interp, int numPids, Tcl_Pid *pidPtr, Tcl_Channel errorChan); /* 5 */ void (*tclCleanupCommand) (Command *cmdPtr); /* 6 */ int (*tclCopyAndCollapse) (int count, const char *src, char *dst); /* 7 */ - int (*tclCopyChannelOld) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr); /* 8 */ + TCL_DEPRECATED_API("") int (*tclCopyChannelOld) (Tcl_Interp *interp, Tcl_Channel inChan, Tcl_Channel outChan, int toRead, Tcl_Obj *cmdPtr); /* 8 */ int (*tclCreatePipeline) (Tcl_Interp *interp, int argc, const char **argv, Tcl_Pid **pidArrayPtr, TclFile *inPipePtr, TclFile *outPipePtr, TclFile *errFilePtr); /* 9 */ int (*tclCreateProc) (Tcl_Interp *interp, Namespace *nsPtr, const char *procName, Tcl_Obj *argsPtr, Tcl_Obj *bodyPtr, Proc **procPtrPtr); /* 10 */ void (*tclDeleteCompiledLocalVars) (Interp *iPtr, CallFrame *framePtr); /* 11 */ @@ -721,7 +732,7 @@ typedef struct TclIntStubs { void (*tclpFree) (char *ptr); /* 74 */ unsigned long (*tclpGetClicks) (void); /* 75 */ unsigned long (*tclpGetSeconds) (void); /* 76 */ - void (*tclpGetTime) (Tcl_Time *time); /* 77 */ + TCL_DEPRECATED_API("") void (*tclpGetTime) (Tcl_Time *time); /* 77 */ void (*reserved78)(void); void (*reserved79)(void); void (*reserved80)(void); @@ -748,7 +759,7 @@ typedef struct TclIntStubs { CONST86 char * (*tclSetPreInitScript) (const char *string); /* 101 */ void (*tclSetupEnv) (Tcl_Interp *interp); /* 102 */ int (*tclSockGetPort) (Tcl_Interp *interp, const char *str, const char *proto, int *portPtr); /* 103 */ - int (*tclSockMinimumBuffersOld) (int sock, int size); /* 104 */ + TCL_DEPRECATED_API("") int (*tclSockMinimumBuffersOld) (int sock, int size); /* 104 */ void (*reserved105)(void); void (*reserved106)(void); void (*reserved107)(void); @@ -777,7 +788,7 @@ typedef struct TclIntStubs { int (*tcl_RemoveInterpResolvers) (Tcl_Interp *interp, const char *name); /* 130 */ void (*tcl_SetNamespaceResolvers) (Tcl_Namespace *namespacePtr, Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc, Tcl_ResolveCompiledVarProc *compiledVarProc); /* 131 */ int (*tclpHasSockets) (Tcl_Interp *interp); /* 132 */ - struct tm * (*tclpGetDate) (const time_t *time, int useGMT); /* 133 */ + TCL_DEPRECATED_API("") struct tm * (*tclpGetDate) (const time_t *time, int useGMT); /* 133 */ void (*reserved134)(void); void (*reserved135)(void); void (*reserved136)(void); @@ -802,8 +813,8 @@ typedef struct TclIntStubs { void (*reserved155)(void); void (*tclRegError) (Tcl_Interp *interp, const char *msg, int status); /* 156 */ Var * (*tclVarTraceExists) (Tcl_Interp *interp, const char *varName); /* 157 */ - void (*tclSetStartupScriptFileName) (const char *filename); /* 158 */ - const char * (*tclGetStartupScriptFileName) (void); /* 159 */ + TCL_DEPRECATED_API("use public Tcl_SetStartupScript()") void (*tclSetStartupScriptFileName) (const char *filename); /* 158 */ + TCL_DEPRECATED_API("use public Tcl_GetStartupScript()") const char * (*tclGetStartupScriptFileName) (void); /* 159 */ void (*reserved160)(void); int (*tclChannelTransform) (Tcl_Interp *interp, Tcl_Channel chan, Tcl_Obj *cmdObjPtr); /* 161 */ void (*tclChannelEventScriptInvoker) (ClientData clientData, int flags); /* 162 */ @@ -811,8 +822,8 @@ typedef struct TclIntStubs { void (*tclExpandCodeArray) (void *envPtr); /* 164 */ void (*tclpSetInitialEncodings) (void); /* 165 */ int (*tclListObjSetElement) (Tcl_Interp *interp, Tcl_Obj *listPtr, int index, Tcl_Obj *valuePtr); /* 166 */ - void (*tclSetStartupScriptPath) (Tcl_Obj *pathPtr); /* 167 */ - Tcl_Obj * (*tclGetStartupScriptPath) (void); /* 168 */ + TCL_DEPRECATED_API("use public Tcl_SetStartupScript()") void (*tclSetStartupScriptPath) (Tcl_Obj *pathPtr); /* 167 */ + TCL_DEPRECATED_API("use public Tcl_GetStartupScript()") Tcl_Obj * (*tclGetStartupScriptPath) (void); /* 168 */ int (*tclpUtfNcmp2) (const char *s1, const char *s2, unsigned long n); /* 169 */ int (*tclCheckInterpTraces) (Tcl_Interp *interp, const char *command, int numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]); /* 170 */ int (*tclCheckExecutionTraces) (Tcl_Interp *interp, const char *command, int numChars, Command *cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *const objv[]); /* 171 */ @@ -826,8 +837,8 @@ typedef struct TclIntStubs { Tcl_Obj * (*tcl_GetStartupScript) (const char **encodingNamePtr); /* 179 */ void (*reserved180)(void); void (*reserved181)(void); - struct tm * (*tclpLocaltime) (const time_t *clock); /* 182 */ - struct tm * (*tclpGmtime) (const time_t *clock); /* 183 */ + TCL_DEPRECATED_API("") struct tm * (*tclpLocaltime) (const time_t *clock); /* 182 */ + TCL_DEPRECATED_API("") struct tm * (*tclpGmtime) (const time_t *clock); /* 183 */ void (*reserved184)(void); void (*reserved185)(void); void (*reserved186)(void); @@ -880,7 +891,7 @@ typedef struct TclIntStubs { void (*tclGetSrcInfoForPc) (CmdFrame *contextPtr); /* 233 */ Var * (*tclVarHashCreateVar) (TclVarHashTable *tablePtr, const char *key, int *newPtr); /* 234 */ void (*tclInitVarHashTable) (TclVarHashTable *tablePtr, Namespace *nsPtr); /* 235 */ - void (*tclBackgroundException) (Tcl_Interp *interp, int code); /* 236 */ + TCL_DEPRECATED_API("use Tcl_BackgroundException") void (*tclBackgroundException) (Tcl_Interp *interp, int code); /* 236 */ int (*tclResetCancellation) (Tcl_Interp *interp, int force); /* 237 */ int (*tclNRInterpProc) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 238 */ int (*tclNRInterpProcCore) (Tcl_Interp *interp, Tcl_Obj *procNameObj, int skip, ProcErrorProc *errorProc); /* 239 */ @@ -1356,7 +1367,7 @@ extern const TclIntStubs *tclIntStubsPtr; #undef TclSetStartupScriptPath #undef TclBackgroundException -#if defined(USE_TCL_STUBS) && defined(TCL_NO_DEPRECATED) +#if defined(USE_TCL_STUBS) # undef Tcl_SetStartupScript # define Tcl_SetStartupScript \ (tclStubsPtr->tcl_SetStartupScript) /* 622 */ -- cgit v0.12 From 0fc6533fcba4c33f7364f789fa22ea0793783995 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 13 Nov 2017 10:49:25 +0000 Subject: No longer mark Tcl_EvalFile() as obsolete, since it will continue to be supported in Tcl 9.0 --- generic/tcl.decls | 1 - generic/tclIOUtil.c | 1 - 2 files changed, 2 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 92ccdcf..6fbf45f 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -468,7 +468,6 @@ declare 128 { declare 129 { int Tcl_Eval(Tcl_Interp *interp, const char *script) } -# This is obsolete, use Tcl_FSEvalFile declare 130 { int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName) } diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 6465931..a124406 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -254,7 +254,6 @@ Tcl_GetCwd( } } -/* Obsolete */ int Tcl_EvalFile( Tcl_Interp *interp, /* Interpreter in which to process file. */ -- cgit v0.12 From a7b6d6094829c332ba8c551876a64b0226148c93 Mon Sep 17 00:00:00 2001 From: aku Date: Mon, 13 Nov 2017 18:58:16 +0000 Subject: Ticket [5d65e65036]. My fix. Do not skip the second check for stable versions even when the main check fails. Avoided radical changes to the structure (kept single search loop, with selection after). --- generic/tclPkg.c | 91 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 33 deletions(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 52f33c3..d3dd584 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -349,7 +349,7 @@ PkgRequireCore( Interp *iPtr = (Interp *) interp; Package *pkgPtr; PkgAvail *availPtr, *bestPtr, *bestStablePtr; - char *availVersion, *bestVersion; + char *availVersion, *bestVersion, *bestStableVersion; /* Internal rep. of versions */ int availStable, code, satisfies, pass; char *script, *pkgVersionI; @@ -395,6 +395,7 @@ PkgRequireCore( bestPtr = NULL; bestStablePtr = NULL; bestVersion = NULL; + bestStableVersion = NULL; for (availPtr = pkgPtr->availPtr; availPtr != NULL; availPtr = availPtr->nextPtr) { @@ -408,58 +409,82 @@ PkgRequireCore( continue; } - + + /* Check satisfaction of requirements before considering the current version further. */ + if (reqc > 0) { + satisfies = SomeRequirementSatisfied(availVersion, reqc, reqv); + if (!satisfies) { + ckfree(availVersion); + availVersion = NULL; + continue; + } + } + if (bestPtr != NULL) { int res = CompareVersions(availVersion, bestVersion, NULL); /* - * Note: Use internal reps! + * Note: Used internal reps in the comparison! */ - if (res <= 0) { + if (res > 0) { /* - * The version of the package sought is not as good as the - * currently selected version. Ignore it. + * The version of the package sought is better than the + * currently selected version. */ - - ckfree(availVersion); - availVersion = NULL; - continue; + goto newbest; } - } - - /* We have found a version which is better than our max. */ - - if (reqc > 0) { - /* Check satisfaction of requirements. */ + } else { + newbest: + /* We have found a version which is better than our max. */ - satisfies = SomeRequirementSatisfied(availVersion, reqc, reqv); - if (!satisfies) { - ckfree(availVersion); - availVersion = NULL; - continue; - } + bestPtr = availPtr; + CheckVersionAndConvert(interp, bestPtr->version, &bestVersion, NULL); } - bestPtr = availPtr; - - if (bestVersion != NULL) { - ckfree(bestVersion); + if (!availStable) { + ckfree(availVersion); + availVersion = NULL; + continue; } - bestVersion = availVersion; - /* - * If this new best version is stable then it also has to be - * better than the max stable version found so far. - */ + if (bestStablePtr != NULL) { + int res = CompareVersions(availVersion, bestStableVersion, NULL); + + /* + * Note: Used internal reps in the comparison! + */ - if (availStable) { + if (res > 0) { + /* + * This stable version of the package sought is better + * than the currently selected stable version. + */ + goto newstable; + } + } else { + newstable: + /* We have found a stable version which is better than our max stable. */ bestStablePtr = availPtr; + CheckVersionAndConvert(interp, bestStablePtr->version, &bestStableVersion, NULL); } - } + ckfree(availVersion); + availVersion = NULL; + } /* end for */ + + /* + * Clean up memorized internal reps, if any. + */ + if (bestVersion != NULL) { ckfree(bestVersion); + bestVersion = NULL; + } + + if (bestStableVersion != NULL) { + ckfree(bestStableVersion); + bestStableVersion = NULL; } /* -- cgit v0.12 From 9f6573581348d2a8ceb4647ad9781d35644aee8b Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 14 Nov 2017 17:09:49 +0000 Subject: Repair lost of broken [package prefer] testing. --- tests/package.test | 125 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 100 insertions(+), 25 deletions(-) diff --git a/tests/package.test b/tests/package.test index faa15ec..bb938b8 100644 --- a/tests/package.test +++ b/tests/package.test @@ -20,18 +20,19 @@ if {"::tcltest" ni [namespace children]} { ::tcltest::loadTestedCommands catch [list package require -exact Tcltest [info patchlevel]] -testConstraint testpreferstable [llength [info commands testpreferstable]] - # Do all this in a slave interp to avoid garbaging the package list set i [interp create] tcltest::loadIntoSlaveInterpreter $i {*}$argv +load {} Tcltest $i interp eval $i { namespace import -force ::tcltest::* -package forget {*}[package names] +#package forget {*}[package names] set oldPkgUnknown [package unknown] package unknown {} set oldPath $auto_path set auto_path "" + +testConstraint testpreferstable [llength [info commands testpreferstable]] test package-1.1 {pkg::create gives error on insufficient args} -body { ::pkg::create @@ -575,15 +576,23 @@ test package-3.44 {Tcl_PkgRequire: exact version matching (1578344)} -setup { package forget demo } -result {version conflict for package "demo": have 1.2.3, need exactly 1.2} test package-3.50 {Tcl_PkgRequire procedure, picking best stable version} -constraints testpreferstable -setup { + interp create child + load {} Tcltest child + child eval { testpreferstable package forget t set x xxx + } } -body { + child eval { foreach i {1.4 3.4 4.0a1 2.3 2.4 2.2} { package ifneeded t $i "set x $i; package provide t $i" } package require t set x + } +} -cleanup { + interp delete child } -result {3.4} test package-3.51 {Tcl_PkgRequire procedure, picking best stable version} -setup { package forget t @@ -621,28 +630,51 @@ test pkg-3.53 {Tcl_PkgRequire procedure, picking best stable version} -constrain test package-4.1 {Tcl_PackageCmd procedure} -returnCodes error -body { package } -result {wrong # args: should be "package option ?arg ...?"} -test package-4.2 {Tcl_PackageCmd procedure, "forget" option} { +test package-4.2 {Tcl_PackageCmd procedure, "forget" option} -setup { + interp create child +} -body { + child eval { package forget {*}[package names] package names -} {} -test package-4.3 {Tcl_PackageCmd procedure, "forget" option} { + } +} -cleanup { + interp delete child +} -result {} +test package-4.3 {Tcl_PackageCmd procedure, "forget" option} -setup { + interp create child +} -body { + child eval { package forget {*}[package names] package forget foo -} {} + } +} -cleanup { + interp delete child +} -result {} test package-4.4 {Tcl_PackageCmd procedure, "forget" option} -setup { + interp create child + child eval { package forget {*}[package names] set result {} + } } -body { + child eval { package ifneeded t 1.1 {first script} package ifneeded t 2.3 {second script} package ifneeded x 1.4 {x's script} lappend result [lsort [package names]] [package versions t] package forget t lappend result [lsort [package names]] [package versions t] + } +} -cleanup { + interp delete child } -result {{t x} {1.1 2.3} x {}} test package-4.5 {Tcl_PackageCmd procedure, "forget" option} -setup { + interp create child + child eval { package forget {*}[package names] + } } -body { + child eval { package ifneeded a 1.1 {first script} package ifneeded b 2.3 {second script} package ifneeded c 1.4 {third script} @@ -650,6 +682,9 @@ test package-4.5 {Tcl_PackageCmd procedure, "forget" option} -setup { set result [list [lsort [package names]]] package forget a c lappend result [lsort [package names]] + } +} -cleanup { + interp delete child } -result {{a b c} b} test package-4.5.1 {Tcl_PackageCmd procedure, "forget" option} -body { # Test for Bug 415273 @@ -668,28 +703,55 @@ test package-4.7 {Tcl_PackageCmd procedure, "ifneeded" option} -body { test package-4.8 {Tcl_PackageCmd procedure, "ifneeded" option} -body { package ifneeded t xyz } -returnCodes error -result {expected version number but got "xyz"} -test package-4.9 {Tcl_PackageCmd procedure, "ifneeded" option} { +test package-4.9 {Tcl_PackageCmd procedure, "ifneeded" option} -setup { + interp create child +} -body { + child eval { package forget {*}[package names] list [package ifneeded foo 1.1] [package names] -} {{} {}} + } +} -cleanup { + interp delete child +} -result {{} {}} test package-4.10 {Tcl_PackageCmd procedure, "ifneeded" option} -setup { - package forget t + interp create child + child eval { + package forget {*}[package names] + } } -body { + child eval { package ifneeded t 1.4 "script for t 1.4" list [package names] [package ifneeded t 1.4] [package versions t] + } +} -cleanup { + interp delete child } -result {t {script for t 1.4} 1.4} test package-4.11 {Tcl_PackageCmd procedure, "ifneeded" option} -setup { - package forget t + interp create child + child eval { + package forget {*}[package names] + } } -body { + child eval { package ifneeded t 1.4 "script for t 1.4" list [package ifneeded t 1.5] [package names] [package versions t] + } +} -cleanup { + interp delete child } -result {{} t 1.4} test package-4.12 {Tcl_PackageCmd procedure, "ifneeded" option} -setup { - package forget t + interp create child + child eval { + package forget {*}[package names] + } } -body { + child eval { package ifneeded t 1.4 "script for t 1.4" package ifneeded t 1.4 "second script for t 1.4" list [package ifneeded t 1.4] [package names] [package versions t] + } +} -cleanup { + interp delete child } -result {{second script for t 1.4} t 1.4} test package-4.13 {Tcl_PackageCmd procedure, "ifneeded" option} -setup { package forget t @@ -702,18 +764,31 @@ test package-4.13 {Tcl_PackageCmd procedure, "ifneeded" option} -setup { test package-4.14 {Tcl_PackageCmd procedure, "names" option} -body { package names a } -returnCodes error -result {wrong # args: should be "package names"} -test package-4.15 {Tcl_PackageCmd procedure, "names" option} { +test package-4.15 {Tcl_PackageCmd procedure, "names" option} -setup { + interp create child +} -body { + child eval { package forget {*}[package names] package names -} {} + } +} -cleanup { + interp delete child +} -result {} test package-4.16 {Tcl_PackageCmd procedure, "names" option} -setup { + interp create child + child eval { package forget {*}[package names] + } } -body { + child eval { package ifneeded x 1.2 {dummy} package provide x 1.3 package provide y 2.4 catch {package require z 47.16} lsort [package names] + } +} -cleanup { + interp delete child } -result {x y} test package-4.17 {Tcl_PackageCmd procedure, "provide" option} -body { package provide @@ -1251,11 +1326,9 @@ proc prefer {args} { } } -test package-13.0 {package prefer defaults} -constraints testpreferstable -setup { - testpreferstable -} -body { +test package-13.0 {package prefer defaults} -body { prefer -} -result stable +} -result [expr {[string match {*[ab]*} [package provide Tcl]] ? "latest" : "stable"}] test package-13.1 {package prefer defaults} -body { set ::env(TCL_PKG_PREFER_LATEST) stable ;# value not relevant! prefer @@ -1272,23 +1345,25 @@ test package-14.1 {bogus argument} -returnCodes error -body { test package-15.0 {set, keep} -constraints testpreferstable -setup { testpreferstable -} -body {package prefer stable} -result stable +} -body {package prefer} -result stable test package-15.1 {set stable, keep} -constraints testpreferstable -setup { testpreferstable -} -body {prefer stable} -result {stable stable} +} -body {package prefer stable} -result stable test package-15.2 {set latest, change} -constraints testpreferstable -setup { testpreferstable -} -body {prefer latest} -result {stable latest} +} -body {package prefer latest} -result latest test package-15.3 {set latest, keep} -constraints testpreferstable -setup { testpreferstable } -body { - prefer latest latest -} -result {stable latest latest} + package prefer latest + package prefer latest +} -result latest test package-15.4 {set stable, rejected} -constraints testpreferstable -setup { testpreferstable } -body { - prefer latest stable -} -result {stable latest latest} + package prefer latest + package prefer stable +} -result latest rename prefer {} -- cgit v0.12 From 1ed5a135edb9b30eae6aa9dcc091929aba2c3864 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 14 Nov 2017 18:35:22 +0000 Subject: TIP 484 proposes a re-implementation of Tcl's "int" Tcl_ObjType. Since the new implementation is not consistent with the former one, any callers of Tcl_GetObjType("int") who are expecting the return value to point them at something playing by the former rules are at risk of having their code broken. In this branch I remove the registation of Tcl's "int" type, so such callers will get NULL (which they should already be able to handle) instead of something misleading them into breakage. Examine this branch and decide if it should be incorporated into TIP 484. --- generic/tclObj.c | 1 - 1 file changed, 1 deletion(-) diff --git a/generic/tclObj.c b/generic/tclObj.c index 634f8db..318e41f 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -383,7 +383,6 @@ TclInitObjSubsystem(void) Tcl_RegisterObjType(&tclByteArrayType); Tcl_RegisterObjType(&tclDoubleType); Tcl_RegisterObjType(&tclEndOffsetType); - Tcl_RegisterObjType(&tclIntType); Tcl_RegisterObjType(&tclStringType); Tcl_RegisterObjType(&tclListType); Tcl_RegisterObjType(&tclDictType); -- cgit v0.12 From ca86fd3219bf704113fa6abac8e5393fdbd38ca9 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Wed, 15 Nov 2017 07:54:08 +0000 Subject: Added default-install-stubs target. Make presence of nmake support files in extension directory optional (except for rules-ext.vc). This requires them to only build against a Tcl with the new nmake build system. --- win/rules-ext.vc | 24 ++++++++++++++---------- win/rules.vc | 5 +++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/win/rules-ext.vc b/win/rules-ext.vc index e0a363c..7de6055 100644 --- a/win/rules-ext.vc +++ b/win/rules-ext.vc @@ -1,10 +1,5 @@ -#------------------------------------------------------------- -*- makefile -*- -# rules-ext.vc -- -# -# Part of the nmake based build system for Tcl and its extensions. # This file should only be included in makefiles for Tcl extensions, # NOT in the makefile for Tcl itself. -# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for docs. !ifndef _RULES_EXT_VC @@ -48,10 +43,13 @@ _RULESDIR = . !endif !if "$(_RULESDIR)" != "." -# Potentially using Tcl's support files. Need to compare the versions. -# We extract version numbers using the nmakehlp program. For this -# purpose, we use the version of nmakehlp that we have. -!if [$(CC) -nologo nmakehlp.c -link -subsystem:console > nul] +# Potentially using Tcl's support files. If this extension has its own +# nmake support files, need to compare the versions and pick newer. + +!if exist("rules.vc") # The extension has its own copy + +# We extract version numbers using the nmakehlp program. +!if [$(CC) -nologo "$(_RULESDIR)\nmakehlp.c" -link -subsystem:console > nul] !endif !if [echo TCL_RULES_MAJOR = \> versions.vc] \ @@ -73,7 +71,9 @@ _RULESDIR = . _RULESDIR = . !endif -!endif # $(_RULESDIR) != "." +!endif # if exist("rules.vc") + +!endif # if $(_RULESDIR) != "." # Let rules.vc know what copy of nmakehlp.c to use. NMAKEHLPC = $(_RULESDIR)\nmakehlp.c @@ -84,7 +84,11 @@ NMAKEHLPC = $(_RULESDIR)\nmakehlp.c !undef OUR_RULES_MAJOR !undef OUR_RULES_MINOR +!if exist("$(_RULESDIR)\rules.vc") !message *** Using $(_RULESDIR)\rules.vc !include "$(_RULESDIR)\rules.vc" +!else +!error *** Could not locate rules.vc +!endif !endif # _RULES_EXT_VC \ No newline at end of file diff --git a/win/rules.vc b/win/rules.vc index a1c30e0..fb35840 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1441,6 +1441,11 @@ default-install-libraries: $(OUT_DIR)\pkgIndex.tcl @echo Installing package index in '$(SCRIPT_INSTALL_DIR)' @$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR) +default-install-stubs: + @echo Installing stubs library to '$(SCRIPT_INSTALL_DIR)' + @if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" + @$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL + default-install-docs-html: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" -- cgit v0.12 From 59ebc49f0f9163be7bcbd33b23e6eae865540ab4 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 15 Nov 2017 08:54:13 +0000 Subject: Change signature of (internal) TclScanElement() function. This saves memory allocation and the possibility for panic's in dict and list handling, requiring 1/4 of memory for internal allocation of temporary storage. No change to external API. --- generic/tclDictObj.c | 9 +++------ generic/tclIndexObj.c | 3 ++- generic/tclInt.h | 2 +- generic/tclListObj.c | 6 +++--- generic/tclUtil.c | 27 ++++++--------------------- 5 files changed, 15 insertions(+), 32 deletions(-) diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index d15255f..2eff1ff 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -487,15 +487,14 @@ static void UpdateStringOfDict( Tcl_Obj *dictPtr) { -#define LOCAL_SIZE 20 - int localFlags[LOCAL_SIZE], *flagPtr = NULL; +#define LOCAL_SIZE 64 + char localFlags[LOCAL_SIZE], *flagPtr = NULL; Dict *dict = DICT(dictPtr); ChainEntry *cPtr; Tcl_Obj *keyPtr, *valuePtr; int i, length, bytesNeeded = 0; const char *elem; char *dst; - const int maxFlags = UINT_MAX / sizeof(int); /* * This field is the most useful one in the whole hash structure, and it @@ -517,10 +516,8 @@ UpdateStringOfDict( if (numElems <= LOCAL_SIZE) { flagPtr = localFlags; - } else if (numElems > maxFlags) { - Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX); } else { - flagPtr = ckalloc(numElems * sizeof(int)); + flagPtr = ckalloc(numElems); } for (i=0,cPtr=dict->entryChainHead; inextPtr) { /* diff --git a/generic/tclIndexObj.c b/generic/tclIndexObj.c index 0e0ddc9..30c33f1 100644 --- a/generic/tclIndexObj.c +++ b/generic/tclIndexObj.c @@ -878,7 +878,8 @@ Tcl_WrongNumArgs( * NULL. */ { Tcl_Obj *objPtr; - int i, len, elemLen, flags; + int i, len, elemLen; + char flags; Interp *iPtr = (Interp *) interp; const char *elementStr; diff --git a/generic/tclInt.h b/generic/tclInt.h index 1908e32..91c8b96 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3106,7 +3106,7 @@ MODULE_SCOPE int TclReToGlob(Tcl_Interp *interp, const char *reStr, int reStrLen, Tcl_DString *dsPtr, int *flagsPtr, int *quantifiersFoundPtr); MODULE_SCOPE int TclScanElement(const char *string, int length, - int *flagPtr); + char *flagPtr); MODULE_SCOPE void TclSetBgErrorHandler(Tcl_Interp *interp, Tcl_Obj *cmdPrefix); MODULE_SCOPE void TclSetBignumIntRep(Tcl_Obj *objPtr, diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 344d0fd..3a1555d 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -1957,8 +1957,8 @@ static void UpdateStringOfList( Tcl_Obj *listPtr) /* List object with string rep to update. */ { -# define LOCAL_SIZE 20 - int localFlags[LOCAL_SIZE], *flagPtr = NULL; +# define LOCAL_SIZE 64 + char localFlags[LOCAL_SIZE], *flagPtr = NULL; List *listRepPtr = ListRepPtr(listPtr); int numElems = listRepPtr->elemCount; int i, length, bytesNeeded = 0; @@ -1995,7 +1995,7 @@ UpdateStringOfList( * We know numElems <= LIST_MAX, so this is safe. */ - flagPtr = ckalloc(numElems * sizeof(int)); + flagPtr = ckalloc(numElems); } elemPtrs = &listRepPtr->elements; for (i = 0; i < numElems; i++) { diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 0eddb00..feee9c5 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -974,7 +974,7 @@ Tcl_ScanCountedElement( int *flagPtr) /* Where to store information to guide * Tcl_ConvertElement. */ { - int flags = CONVERT_ANY; + char flags = CONVERT_ANY; int numBytes = TclScanElement(src, length, &flags); *flagPtr = flags; @@ -1015,7 +1015,7 @@ int TclScanElement( const char *src, /* String to convert to Tcl list element. */ int length, /* Number of bytes in src, or -1. */ - int *flagPtr) /* Where to store information to guide + char *flagPtr) /* Where to store information to guide * Tcl_ConvertElement. */ { const char *p = src; @@ -1547,11 +1547,10 @@ Tcl_Merge( int argc, /* How many strings to merge. */ const char *const *argv) /* Array of string values. */ { -#define LOCAL_SIZE 20 - int localFlags[LOCAL_SIZE], *flagPtr = NULL; +#define LOCAL_SIZE 64 + char localFlags[LOCAL_SIZE], *flagPtr = NULL; int i, bytesNeeded = 0; char *result, *dst; - const int maxFlags = UINT_MAX / sizeof(int); /* * Handle empty list case first, so logic of the general case can be @@ -1570,22 +1569,8 @@ Tcl_Merge( if (argc <= LOCAL_SIZE) { flagPtr = localFlags; - } else if (argc > maxFlags) { - /* - * We cannot allocate a large enough flag array to format this list in - * one pass. We could imagine converting this routine to a multi-pass - * implementation, but for sizeof(int) == 4, the limit is a max of - * 2^30 list elements and since each element is at least one byte - * formatted, and requires one byte space between it and the next one, - * that a minimum space requirement of 2^31 bytes, which is already - * INT_MAX. If we tried to format a list of > maxFlags elements, we're - * just going to overflow the size limits on the formatted string - * anyway, so just issue that same panic early. - */ - - Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX); } else { - flagPtr = ckalloc(argc * sizeof(int)); + flagPtr = ckalloc(argc); } for (i = 0; i < argc; i++) { flagPtr[i] = ( i ? TCL_DONT_QUOTE_HASH : 0 ); @@ -2717,7 +2702,7 @@ Tcl_DStringAppendElement( { char *dst = dsPtr->string + dsPtr->length; int needSpace = TclNeedSpace(dsPtr->string, dst); - int flags = needSpace ? TCL_DONT_QUOTE_HASH : 0; + char flags = needSpace ? TCL_DONT_QUOTE_HASH : 0; int newSize = dsPtr->length + needSpace + TclScanElement(element, -1, &flags); -- cgit v0.12 From 346cce57455de92d12fcef5ea4115a9657458b84 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 15 Nov 2017 09:42:07 +0000 Subject: Remove compat/float.h and related machinery. The last system known where this was needed was SunOS-4, which is not supported by Tcl any more for a long ... long time .... Also, fix a typo in generic/tclInt.h and remove some end-of-line spacing. --- compat/float.h | 14 -------------- generic/tclBasic.c | 2 +- generic/tclInt.h | 2 +- generic/tclPkg.c | 6 +++--- unix/configure | 10 ---------- unix/tcl.m4 | 1 - unix/tclConfig.h.in | 3 --- unix/tclUnixPort.h | 5 +---- win/tcl.dsp | 4 ---- win/tclWinThrd.c | 2 -- 10 files changed, 6 insertions(+), 43 deletions(-) delete mode 100644 compat/float.h diff --git a/compat/float.h b/compat/float.h deleted file mode 100644 index 411edbf..0000000 --- a/compat/float.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * float.h -- - * - * This is a dummy header file to #include in Tcl when there - * is no float.h in /usr/include. Right now this file is empty: - * Tcl contains #ifdefs to deal with the lack of definitions; - * all it needs is for the #include statement to work. - * - * Copyright (c) 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. - */ diff --git a/generic/tclBasic.c b/generic/tclBasic.c index e6022ac..fe29db0 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -7722,7 +7722,7 @@ ExprRandFunc( iPtr->flags |= RAND_SEED_INITIALIZED; /* - * To ensure different seeds in different threads (bug #416643), + * To ensure different seeds in different threads (bug #416643), * take into consideration the thread this interp is running in. */ diff --git a/generic/tclInt.h b/generic/tclInt.h index 6426c21..23a20e6 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2922,7 +2922,7 @@ MODULE_SCOPE int TclFindDictElement(Tcl_Interp *interp, const char *dict, int dictLength, const char **elementPtr, const char **nextPtr, int *sizePtr, int *literalPtr); -/* TIP #280 - Modified token based evulation, with line information. */ +/* TIP #280 - Modified token based evaluation, with line information. */ MODULE_SCOPE int TclEvalEx(Tcl_Interp *interp, const char *script, int numBytes, int flags, int line, int *clNextOuter, const char *outerScript); diff --git a/generic/tclPkg.c b/generic/tclPkg.c index ea95320..fb721a0 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -480,7 +480,7 @@ PkgRequireCore( continue; } - + /* Check satisfaction of requirements before considering the current version further. */ if (reqc > 0) { satisfies = SomeRequirementSatisfied(availVersion, reqc, reqv); @@ -490,7 +490,7 @@ PkgRequireCore( continue; } } - + if (bestPtr != NULL) { int res = CompareVersions(availVersion, bestVersion, NULL); @@ -547,7 +547,7 @@ PkgRequireCore( /* * Clean up memorized internal reps, if any. */ - + if (bestVersion != NULL) { ckfree(bestVersion); bestVersion = NULL; diff --git a/unix/configure b/unix/configure index 129c283..51d694f 100755 --- a/unix/configure +++ b/unix/configure @@ -3733,16 +3733,6 @@ $as_echo "#define NO_DIRENT_H 1" >>confdefs.h fi - ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" -if test "x$ac_cv_header_float_h" = xyes; then : - -else - -$as_echo "#define NO_FLOAT_H 1" >>confdefs.h - -fi - - ac_fn_c_check_header_mongrel "$LINENO" "values.h" "ac_cv_header_values_h" "$ac_includes_default" if test "x$ac_cv_header_values_h" = xyes; then : diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 45922e0..9aa3eb2 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2078,7 +2078,6 @@ closedir(d); AC_DEFINE(NO_DIRENT_H, 1, [Do we have ?]) fi - AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have ?])]) AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have ?])]) AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index adbc80d..28ce012 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -295,9 +295,6 @@ /* Do we have fd_set? */ #undef NO_FD_SET -/* Do we have ? */ -#undef NO_FLOAT_H - /* Do we have fstatfs()? */ #undef NO_FSTATFS diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index ba56089..8b766d6 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -181,13 +181,10 @@ extern int TclUnixSetBlockingMode(int fd, int mode); *--------------------------------------------------------------------------- */ -#ifndef NO_FLOAT_H -# include -#else +#include #ifndef NO_VALUES_H # include #endif -#endif #ifndef FLT_MAX # ifdef MAXFLOAT diff --git a/win/tcl.dsp b/win/tcl.dsp index 48eae9d..ad9c764 100644 --- a/win/tcl.dsp +++ b/win/tcl.dsp @@ -152,10 +152,6 @@ SOURCE=..\compat\fixstrtod.c # End Source File # Begin Source File -SOURCE=..\compat\float.h -# End Source File -# Begin Source File - SOURCE=..\compat\gettod.c # End Source File # Begin Source File diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index b9cde72..8c130a7 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -13,8 +13,6 @@ #include "tclWinInt.h" -#include - /* Workaround for mingw versions which don't provide this in float.h */ #ifndef _MCW_EM # define _MCW_EM 0x0008001F /* Error masks */ -- cgit v0.12 From 0197a30845c7644fe45ca1a4ec1fc0b9c9ee0c20 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Wed, 15 Nov 2017 11:47:16 +0000 Subject: Include PKGNAMEFLAGS in stubscflags as some extension stubs use it --- win/rules.vc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/rules.vc b/win/rules.vc index fb35840..8db07bd 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1325,7 +1325,7 @@ pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) # so we do not remove it from cflags. -GL may prevent extensions # compiled with one VC version to fail to link against stubs library # compiled with another VC version. Check for this and fix accordingly. -stubscflags = $(cflags) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(INCLUDES) +stubscflags = $(cflags) $(PKGNAMEFLAGS) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(INCLUDES) # Link flags -- cgit v0.12 From c4d4363abd0a6d7f54d613ba0aa5c319c0d8bd36 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Wed, 15 Nov 2017 13:18:00 +0000 Subject: Loosen restriction on where rules-ext.vc file is located. --- win/rules-ext.vc | 22 ++++++++++++++++++---- win/rules.vc | 35 +++++++++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/win/rules-ext.vc b/win/rules-ext.vc index 7de6055..ec84464 100644 --- a/win/rules-ext.vc +++ b/win/rules-ext.vc @@ -3,11 +3,25 @@ !ifndef _RULES_EXT_VC -!if !exist("rules-ext.vc") +# We need to run from the directory the parent makefile is located in. +# nmake does not tell us what makefile was used to invoke it so parent +# makefile has to set the MAKEFILEVC macro or we just make a guess and +# warn if we think that is not the case. +!if "$(MAKEFILEVC)" == "" + +!if exist("$(PROJECT).vc") +MAKEFILEVC = $(PROJECT).vc +!elseif exist("makefile.vc") +MAKEFILEVC = makefile.vc +!endif +!endif # "$(MAKEFILEVC)" == "" + +!if !exist("$(MAKEFILEVC)") MSG = ^ -You must run this makefile only from the directory it is in.^ -Please `cd` to its location first. -!error $(MSG) +You must run nmake from the directory containing the project makefile.^ +If you are doing that and getting this message, set the MAKEFILEVC^ +macro to the name of the project makefile. +!message WARNING: $(MSG) !endif !if "$(PROJECT)" == "tcl" diff --git a/win/rules.vc b/win/rules.vc index 8db07bd..586272d 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -52,7 +52,11 @@ NEED_TK = 0 NEED_TCL_SOURCE = 0 !endif -!ifndef NEED_TK_SOURCE +!ifdef NEED_TK_SOURCE +!if $(NEED_TK_SOURCE) +NEED_TK = 1 +!endif +!else NEED_TK_SOURCE = 0 !endif @@ -91,13 +95,6 @@ NEED_TK_SOURCE = 0 # 0. Sanity check compiler environment -!if !exist("rules-ext.vc") -MSG = ^ -You must run nmake from the directory containing the makefile and rules-ext.vc.^ -Please `cd` to its location first. -!error $(MSG) -!endif - # Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or # VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir) @@ -107,6 +104,28 @@ Visual C++ compiler environment not initialized. !error $(MSG) !endif +# We need to run from the directory the parent makefile is located in. +# nmake does not tell us what makefile was used to invoke it so parent +# makefile has to set the MAKEFILEVC macro or we just make a guess and +# warn if we think that is not the case. +!if "$(MAKEFILEVC)" == "" + +!if exist("$(PROJECT).vc") +MAKEFILEVC = $(PROJECT).vc +!elseif exist("makefile.vc") +MAKEFILEVC = makefile.vc +!endif +!endif # "$(MAKEFILEVC)" == "" + +!if !exist("$(MAKEFILEVC)") +MSG = ^ +You must run nmake from the directory containing the project makefile.^ +If you are doing that and getting this message, set the MAKEFILEVC^ +macro to the name of the project makefile. +!message WARNING: $(MSG) +!endif + + ################################################################ # 1. Define external programs being used -- cgit v0.12 From 65007a4d02a35e26d92288bc5a20aa1bfde3696e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 16 Nov 2017 08:39:41 +0000 Subject: No longer document (even though it's only in an example) that Tcl_SavedResult is a struct, and that the internal representation of an int is stored in the object's internalRep.longValue member. That might no longer be true in the future. --- doc/Object.3 | 6 +++--- doc/SaveResult.3 | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/doc/Object.3 b/doc/Object.3 index 4df6c1a..a7e06c8 100644 --- a/doc/Object.3 +++ b/doc/Object.3 @@ -3,7 +3,7 @@ '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" +'\" .TH Tcl_Obj 3 8.5 Tcl "Tcl Library Procedures" .so man.macros .BS @@ -94,7 +94,7 @@ Also, most Tcl values are only read and never modified. This is especially true for procedure arguments, which can be shared between the caller and the called procedure. Assignment and argument binding is done by -simply assigning a pointer to the value. +simply assigning a pointer to the value. Reference counting is used to determine when it is safe to reclaim an object's storage. .PP @@ -249,7 +249,7 @@ The \fBincr\fR command first gets an integer from \fIx\fR's object by calling \fBTcl_GetIntFromObj\fR. This procedure checks whether the object is already an integer object. Since it is not, it converts the object -by setting the object's \fIinternalRep.longValue\fR member +by setting the object's internal representation to the integer \fB123\fR and setting the object's \fItypePtr\fR to point to the integer Tcl_ObjType structure. diff --git a/doc/SaveResult.3 b/doc/SaveResult.3 index 74da9f4..0a2ee51 100644 --- a/doc/SaveResult.3 +++ b/doc/SaveResult.3 @@ -4,7 +4,7 @@ '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" +'\" .TH Tcl_SaveResult 3 8.1 Tcl "Tcl Library Procedures" .so man.macros .BS @@ -56,9 +56,9 @@ is called, Tcl will take care of memory management. .PP The second triplet stores the snapshot of only the interpreter result (not its complete state) in memory allocated by the caller. -These routines are passed a pointer to a \fBTcl_SavedResult\fR structure +These routines are passed a pointer to \fBTcl_SavedResult\fR that is used to store enough information to restore the interpreter result. -This structure can be allocated on the stack of the calling +\fBTcl_SavedResult\fR can be allocated on the stack of the calling procedure. These routines do not save the state of any error information in the interpreter (e.g. the \fB\-errorcode\fR or \fB\-errorinfo\fR return options, when an error is in progress). @@ -69,7 +69,7 @@ a superset of the functions provided by the other routines, any new code should only make use of the more powerful routines. The older, weaker routines \fBTcl_SaveResult\fR, \fBTcl_RestoreResult\fR, and \fBTcl_DiscardResult\fR continue to exist only for the sake -of existing programs that may already be using them. +of existing programs that may already be using them. .PP \fBTcl_SaveInterpState\fR takes a snapshot of those portions of interpreter state that make up the full result of script evaluation. @@ -118,7 +118,6 @@ uninitialized state and cannot be used until another call to Once \fBTcl_SaveResult\fR is called to save the interpreter result, either \fBTcl_RestoreResult\fR or \fBTcl_DiscardResult\fR must be called to properly clean up the -memory associated with the saved state. - +memory associated with the saved state. .SH KEYWORDS result, state, interp -- cgit v0.12 From be47788793ebb60ab44b11d994b5f053e8f6050a Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Fri, 17 Nov 2017 03:09:26 +0000 Subject: Moved Zipfs initialization and path hinting out of tclInterp.c and into a preinit script populated by TclZipfs_AppHook --- generic/tclInterp.c | 2 -- generic/tclZipfs.c | 22 +++++++++++++++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 2b0582a..d9dfd37 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -402,8 +402,6 @@ Tcl_Init( " set scripts {{set tcl_library}}\n" " } else {\n" " set scripts {}\n" -" lappend scripts {set temp zipfs:/lib/tcl/tcl_library}\n" -" lappend scripts {set temp zipfs:/app/tcl_library}\n" " if {[info exists env(TCL_LIBRARY)] && ($env(TCL_LIBRARY) ne {})} {\n" " lappend scripts {set env(TCL_LIBRARY)}\n" " lappend scripts {\n" diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 9dfca7a..bc7d65a 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3816,6 +3816,7 @@ TclZipfs_Init(Tcl_Interp *interp) #ifdef HAVE_ZLIB /* one-time initialization */ WriteLock(); + Tcl_StaticPackage(interp, "zipfs", TclZipfs_Init, TclZipfs_Init); if (!ZipFS.initialized) { #ifdef TCL_THREADS static const Tcl_Time t = { 0, 0 }; @@ -3870,7 +3871,7 @@ TclZipfs_Init(Tcl_Interp *interp) Tcl_LinkVar(interp, "::zipfs::wrmax", (char *) &ZipFS.wrmax, TCL_LINK_INT); TclMakeEnsemble(interp, "zipfs", initMap); - Tcl_PkgProvide(interp, "zipfs", "1.0"); + Tcl_PkgProvide(interp, "zipfs", "2.0"); } return TCL_OK; #else @@ -3914,6 +3915,25 @@ int TclZipfs_AppHook(int *argc, char ***argv){ Tcl_FindExecutable(*argv[0]); archive=Tcl_GetNameOfExecutable(); TclZipfs_Init(NULL); + TclSetPreInitScript( +"foreach {path} {\n" +" {" ZIPFS_APP_MOUNT "/tcl_library}\n" +" {" ZIPFS_ZIP_MOUNT "/tcl_library}\n" +"} {\n" +" if {![file exists [file join $path init.tcl]]} continue\n" +" set ::tcl_library $path\n" +" break\n" +"}\n" +"foreach {path} {\n" +" {" ZIPFS_APP_MOUNT "/tk_library}\n" +" {" ZIPFS_ZIP_MOUNT "/tk_library}\n" +" {" ZIPFS_VOLUME "lib/tk/tk_library}\n" +"} {\n" +" if {[file exists [file join $path init.tcl]]} continue\n" +" set ::tk_library $path\n" +" break\n" +"}\n" + ); if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { int found; Tcl_Obj *vfsinitscript; -- cgit v0.12 From e84763748b39ba9655d93c056c0bfe614b7cb791 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Fri, 17 Nov 2017 04:13:48 +0000 Subject: First pass on the Msys style windows build. Moving Zipfs features closer together in the autoconf --- unix/Makefile.in | 32 ++++---- unix/configure | 231 ++++++++++++++++++++++++++-------------------------- unix/configure.ac | 41 +++++----- win/Makefile.in | 149 ++++++++++++++++++++++++++++++++- win/configure | 176 ++++++++++++++++++++++++++++++++++++++- win/configure.ac | 59 ++++++++++++++ win/tcl.m4 | 108 ++++++++++++++++++++++++ win/tclAppInit.c | 2 + win/tclConfig.sh.in | 3 + 9 files changed, 644 insertions(+), 157 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index d7cc3c7..4540710 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -199,10 +199,6 @@ LD_SEARCH_FLAGS = @LD_SEARCH_FLAGS@ BUILD_DLTEST = @BUILD_DLTEST@ #BUILD_DLTEST = -TCL_ZIP_FILE = @TCL_ZIP_FILE@ -TCL_VFS_PATH = libtcl.vfs/tcl_library -TCL_VFS_ROOT = libtcl.vfs - TCL_LIB_FILE = @TCL_LIB_FILE@ #TCL_LIB_FILE = libtcl.a @@ -247,12 +243,6 @@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ CC = @CC@ OBJEXT = @OBJEXT@ -HOST_CC = @CC_FOR_BUILD@ -HOST_EXEEXT = @EXEEXT_FOR_BUILD@ -HOST_OBJEXT = @OBJEXT_FOR_BUILD@ -ZIPFS_BUILD = @ZIPFS_BUILD@ -NATIVE_ZIP = @ZIP_PROG@ -SHARED_BUILD = @SHARED_BUILD@ #CC = purify -best-effort @CC@ -DPURIFY @@ -263,10 +253,6 @@ MAN_FLAGS = @MAN_FLAGS@ # If non-empty, install the timezone files that are included with Tcl, # otherwise use the ones that ship with the OS. INSTALL_TZDATA = @INSTALL_TZDATA@ -INSTALL_LIBRARIES = @INSTALL_LIBRARIES@ -INSTALL_MSGS = @INSTALL_MSGS@ - - #-------------------------------------------------------------------------- # The information below is usually usable as is. The configure script won't @@ -633,6 +619,23 @@ ZLIB_SRCS = \ SRCS = $(GENERIC_SRCS) $(TOMMATH_SRCS) $(UNIX_SRCS) $(NOTIFY_SRCS) \ $(OO_SRCS) $(STUB_SRCS) @PLAT_SRCS@ @ZLIB_SRCS@ +### +# Tip 430 - ZipFS Modifications +### + +TCL_ZIP_FILE = @TCL_ZIP_FILE@ +TCL_VFS_PATH = libtcl.vfs/tcl_library +TCL_VFS_ROOT = libtcl.vfs + +HOST_CC = @CC_FOR_BUILD@ +HOST_EXEEXT = @EXEEXT_FOR_BUILD@ +HOST_OBJEXT = @OBJEXT_FOR_BUILD@ +ZIPFS_BUILD = @ZIPFS_BUILD@ +NATIVE_ZIP = @ZIP_PROG@ +SHARED_BUILD = @SHARED_BUILD@ +INSTALL_LIBRARIES = @INSTALL_LIBRARIES@ +INSTALL_MSGS = @INSTALL_MSGS@ + # Minizip MINIZIP_OBJS = \ adler32.$(HOST_OBJEXT) \ @@ -652,7 +655,6 @@ MINIZIP_OBJS = \ ZIP_INSTALL_OBJS = minizip${EXEEXT_FOR_BUILD} - #-------------------------------------------------------------------------- # Start of rules #-------------------------------------------------------------------------- diff --git a/unix/configure b/unix/configure index cff57cb..44bd2a6 100755 --- a/unix/configure +++ b/unix/configure @@ -668,6 +668,9 @@ TCL_VERSION INSTALL_MSGS INSTALL_LIBRARIES ZIPFS_BUILD +EXEEXT_FOR_BUILD +CC_FOR_BUILD +ZIP_PROG DTRACE LDFLAGS_DEFAULT CFLAGS_DEFAULT @@ -702,9 +705,6 @@ RANLIB ZLIB_INCLUDE ZLIB_SRCS ZLIB_OBJS -EXEEXT_FOR_BUILD -CC_FOR_BUILD -ZIP_PROG TCLSH_PROG SHARED_BUILD TCL_THREADS @@ -4594,120 +4594,6 @@ if test "$TCLSH_PROG" = ""; then TCLSH_PROG='./${TCL_EXE}' fi -# -# Check for --enable-zipfs flag -# -SC_ENABLE_ZIPFS - -# -# Find a native zip implementation -# - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 -$as_echo_n "checking for zip... " >&6; } - if ${ac_cv_path_zip+:} false; then : - $as_echo_n "(cached) " >&6 -else - - search_path=`echo ${PATH} | sed -e 's/:/ /g'` - for dir in $search_path ; do - for j in `ls -r $dir/zip 2> /dev/null` \ - `ls -r $dir/zip 2> /dev/null` ; do - if test x"$ac_cv_path_zip" = x ; then - if test -f "$j" ; then - ac_cv_path_zip=$j - break - fi - fi - done - done - -fi - - - if test -f "$ac_cv_path_zip" ; then - ZIP_PROG="$ac_cv_path_zip" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5 -$as_echo "$ZIP_PROG" >&6; } - else - # It is not an error if an installed version of Zip can't be located. - ZIP_PROG="" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH" >&5 -$as_echo "No zip found on PATH" >&6; } - fi - - - -# -# Find a native compiler -# -# Put a plausible default for CC_FOR_BUILD in Makefile. -if test -z "$CC_FOR_BUILD"; then - if test "x$cross_compiling" = "xno"; then - CC_FOR_BUILD='$(CC)' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5 -$as_echo_n "checking for gcc... " >&6; } - if ${ac_cv_path_cc+:} false; then : - $as_echo_n "(cached) " >&6 -else - - search_path=`echo ${PATH} | sed -e 's/:/ /g'` - for dir in $search_path ; do - for j in `ls -r $dir/gcc 2> /dev/null` \ - `ls -r $dir/gcc 2> /dev/null` ; do - if test x"$ac_cv_path_cc" = x ; then - if test -f "$j" ; then - ac_cv_path_cc=$j - break - fi - fi - done - done - -fi - - fi -fi - -# Also set EXEEXT_FOR_BUILD. -if test "x$cross_compiling" = "xno"; then - EXEEXT_FOR_BUILD='$(EXEEXT)' - OBJEXT_FOR_BUILD='$(OBJEXT)' -else - OBJEXT_FOR_BUILD='.no' - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5 -$as_echo_n "checking for build system executable suffix... " >&6; } -if ${bfd_cv_build_exeext+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f conftest* - echo 'int main () { return 0; }' > conftest.c - bfd_cv_build_exeext= - ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 - for file in conftest.*; do - case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; - *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - rm -f conftest* - test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5 -$as_echo "$bfd_cv_build_exeext" >&6; } - EXEEXT_FOR_BUILD="" - test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} -fi - - -if test "$ZIP_PROG" = ""; then - ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}' -fi - - - - #------------------------------------------------------------------------ # Add stuff for zlib #------------------------------------------------------------------------ @@ -10272,6 +10158,117 @@ $as_echo "$tcl_ok" >&6; } # Zipfs support #-------------------------------------------------------------------- +# +# Check for --enable-zipfs flag +# +SC_ENABLE_ZIPFS + +# +# Find a native zip implementation +# + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 +$as_echo_n "checking for zip... " >&6; } + if ${ac_cv_path_zip+:} false; then : + $as_echo_n "(cached) " >&6 +else + + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/zip 2> /dev/null` \ + `ls -r $dir/zip 2> /dev/null` ; do + if test x"$ac_cv_path_zip" = x ; then + if test -f "$j" ; then + ac_cv_path_zip=$j + break + fi + fi + done + done + +fi + + + if test -f "$ac_cv_path_zip" ; then + ZIP_PROG="$ac_cv_path_zip" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5 +$as_echo "$ZIP_PROG" >&6; } + else + # It is not an error if an installed version of Zip can't be located. + ZIP_PROG="" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH" >&5 +$as_echo "No zip found on PATH" >&6; } + fi + + + +# +# Find a native compiler +# +# Put a plausible default for CC_FOR_BUILD in Makefile. +if test -z "$CC_FOR_BUILD"; then + if test "x$cross_compiling" = "xno"; then + CC_FOR_BUILD='$(CC)' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5 +$as_echo_n "checking for gcc... " >&6; } + if ${ac_cv_path_cc+:} false; then : + $as_echo_n "(cached) " >&6 +else + + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/gcc 2> /dev/null` \ + `ls -r $dir/gcc 2> /dev/null` ; do + if test x"$ac_cv_path_cc" = x ; then + if test -f "$j" ; then + ac_cv_path_cc=$j + break + fi + fi + done + done + +fi + + fi +fi + +# Also set EXEEXT_FOR_BUILD. +if test "x$cross_compiling" = "xno"; then + EXEEXT_FOR_BUILD='$(EXEEXT)' + OBJEXT_FOR_BUILD='$(OBJEXT)' +else + OBJEXT_FOR_BUILD='.no' + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5 +$as_echo_n "checking for build system executable suffix... " >&6; } +if ${bfd_cv_build_exeext+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.c + bfd_cv_build_exeext= + ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + rm -f conftest* + test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5 +$as_echo "$bfd_cv_build_exeext" >&6; } + EXEEXT_FOR_BUILD="" + test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} +fi + + +if test "$ZIP_PROG" = ""; then + ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}' +fi + # Check whether --enable-zipfs was given. if test "${enable_zipfs+set}" = set; then : enableval=$enable_zipfs; tcl_ok=$enableval diff --git a/unix/configure.ac b/unix/configure.ac index b2700cf..35429b5 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -155,28 +155,6 @@ if test "$TCLSH_PROG" = ""; then TCLSH_PROG='./${TCL_EXE}' fi -# -# Check for --enable-zipfs flag -# -SC_ENABLE_ZIPFS - -# -# Find a native zip implementation -# -SC_PROG_ZIP - -# -# Find a native compiler -# -AX_CC_FOR_BUILD - -if test "$ZIP_PROG" = ""; then - ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}' -fi - - - - #------------------------------------------------------------------------ # Add stuff for zlib #------------------------------------------------------------------------ @@ -818,6 +796,25 @@ AC_MSG_RESULT([$tcl_ok]) # Zipfs support #-------------------------------------------------------------------- +# +# Check for --enable-zipfs flag +# +SC_ENABLE_ZIPFS + +# +# Find a native zip implementation +# +SC_PROG_ZIP + +# +# Find a native compiler +# +AX_CC_FOR_BUILD + +if test "$ZIP_PROG" = ""; then + ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}' +fi + AC_ARG_ENABLE(zipfs, AC_HELP_STRING([--enable-zipfs], [build with Zipfs support (default: on)]), diff --git a/win/Makefile.in b/win/Makefile.in index 1a88cc8..14868cf 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -137,6 +137,11 @@ DDEDOTVER = @TCL_DDE_MAJOR_VERSION@.@TCL_DDE_MINOR_VERSION@ REGVER = @TCL_REG_MAJOR_VERSION@@TCL_REG_MINOR_VERSION@ REGDOTVER = @TCL_REG_MAJOR_VERSION@.@TCL_REG_MINOR_VERSION@ +TCL_ZIP_FILE = @TCL_ZIP_FILE@ +TCL_VFS_PATH = libtcl.vfs/tcl_library +TCL_VFS_ROOT = libtcl.vfs + + TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ TCL_DLL_FILE = @TCL_DLL_FILE@ TCL_LIB_FILE = @TCL_LIB_FILE@ @@ -196,6 +201,42 @@ SHELL = @SHELL@ RM = rm -f COPY = cp +### +# Tip 430 - ZipFS Modifications +### + +TCL_ZIP_FILE = @TCL_ZIP_FILE@ +TCL_VFS_PATH = libtcl.vfs/tcl_library +TCL_VFS_ROOT = libtcl.vfs + +HOST_CC = @CC_FOR_BUILD@ +HOST_EXEEXT = @EXEEXT_FOR_BUILD@ +HOST_OBJEXT = @OBJEXT_FOR_BUILD@ +ZIPFS_BUILD = @ZIPFS_BUILD@ +NATIVE_ZIP = @ZIP_PROG@ +SHARED_BUILD = @SHARED_BUILD@ +INSTALL_MSGS = @INSTALL_MSGS@ +INSTALL_LIBRARIES = @INSTALL_LIBRARIES@ + +# Minizip +MINIZIP_OBJS = \ + adler32.$(HOST_OBJEXT) \ + compress.$(HOST_OBJEXT) \ + crc32.$(HOST_OBJEXT) \ + deflate.$(HOST_OBJEXT) \ + infback.$(HOST_OBJEXT) \ + inffast.$(HOST_OBJEXT) \ + inflate.$(HOST_OBJEXT) \ + inftrees.$(HOST_OBJEXT) \ + ioapi.$(HOST_OBJEXT) \ + trees.$(HOST_OBJEXT) \ + uncompr.$(HOST_OBJEXT) \ + zip.$(HOST_OBJEXT) \ + zutil.$(HOST_OBJEXT) \ + minizip.$(HOST_OBJEXT) + +ZIP_INSTALL_OBJS = minizip${EXEEXT_FOR_BUILD} + CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${TCL_SHLIB_CFLAGS} \ -I"${ZLIB_DIR_NATIVE}" -I"${GENERIC_DIR_NATIVE}" \ -DMP_PREC=4 -I"${TOMMATH_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \ @@ -434,9 +475,17 @@ libraries: doc: +tclzipfile: ${TCL_ZIP_FILE} + +${TCL_ZIP_FILE}: ${ZIP_INSTALL_OBJS} + rm -rf ${TCL_VFS_ROOT} + mkdir -p ${TCL_VFS_PATH} + cp -a ../library/* ${TCL_VFS_PATH} + cd ${TCL_VFS_ROOT} ; ../minizip${EXEEXT_FOR_BUILD} -o ../${TCL_ZIP_FILE} `find . -type f` + $(TCLSH): $(TCLSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) $(CC) $(CFLAGS) $(TCLSH_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ - tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) + tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) @VC_MANIFEST_EMBED_EXE@ cat32.$(OBJEXT): cat.c @@ -453,10 +502,13 @@ ${TCL_STUB_LIB_FILE}: ${STUB_OBJS} @MAKE_STUB_LIB@ ${STUB_OBJS} @POST_MAKE_LIB@ -${TCL_DLL_FILE}: ${TCL_OBJS} tcl.$(RES) @ZLIB_DLL_FILE@ +${TCL_DLL_FILE}: ${TCL_OBJS} tcl.$(RES) @ZLIB_DLL_FILE@ ${TCL_ZIP_FILE} @$(RM) ${TCL_DLL_FILE} $(TCL_LIB_FILE) @MAKE_DLL@ ${TCL_OBJS} tcl.$(RES) $(SHLIB_LD_LIBS) @VC_MANIFEST_EMBED_DLL@ +ifeq (${ZIPFS_BUILD},1) + cat ${TCL_ZIP_FILE} >> ${TCL_DLL_FILE} +endif ${TCL_LIB_FILE}: ${TCL_OBJS} ${DDE_OBJS} ${REG_OBJS} @$(RM) ${TCL_LIB_FILE} @@ -528,6 +580,8 @@ tclPkgConfig.${OBJEXT}: tclPkgConfig.c -DCFG_RUNTIME_SCRDIR=\"$(TCL_LIBRARY_NATIVE)\" \ -DCFG_RUNTIME_INCDIR=\"$(includedir_native)\" \ -DCFG_RUNTIME_DOCDIR=\"$(mandir_native)\" \ + -DCFG_RUNTIME_DLLFILE="\"$(TCL_LIB_FILE)\"" \ + -DCFG_RUNTIME_ZIPFILE="\"$(TCL_ZIP_FILE)\"" \ -DBUILD_tcl \ @DEPARG@ $(CC_OBJNAME) @@ -551,6 +605,76 @@ tclOOStubLib.${OBJEXT}: tclOOStubLib.c .rc.$(RES): $(RC) @RC_OUT@ $@ @RC_TYPE@ @RC_DEFINES@ @RC_INCLUDE@ "$(GENERIC_DIR_NATIVE)" @RC_INCLUDE@ "$(WIN_DIR_NATIVE)" @DEPARG@ + + +#-------------------------------------------------------------------------- +# Minizip implementation +#-------------------------------------------------------------------------- +adler32.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/adler32.c + +compress.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/compress.c + +crc32.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/crc32.c + +deflate.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/deflate.c + +ioapi.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/ioapi.c + +infback.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/infback.c + +inffast.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/inffast.c + +inflate.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/inflate.c + +inftrees.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/inftrees.c + +trees.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/trees.c + +uncompr.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/uncompr.c + +zip.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/zip.c + +zutil.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/zutil.c + +minizip.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/minizip.c + +minizip${EXEEXT_FOR_BUILD}: $(MINIZIP_OBJS) + $(HOST_CC) -o $@ $(MINIZIP_OBJS) + +tclvfs.zip: minizip${EXEEXT_FOR_BUILD} + rm -rf $(TCL_VFS_ROOT) + mkdir -p $(TCL_VFS_PATH) + @for i in "$(TCL_VFS_PATH)"; \ + do \ + if [ ! -d "$$i" ] ; then \ + echo "Making directory $$i"; \ + $(INSTALL_DATA_DIR) "$$i"; \ + else true; \ + fi; \ + done; + cp -a ../library/* $(TCL_VFS_PATH) + (cd $TCL_VFS ROOT ; ./minizip${EXEEXT_FOR_BUILD} -o ../tclvfs.zip `find . -type f`) + +zipsetupstub.$(HOST_OBJEXT): $(COMPAT_DIR)/zipsetupstub.c + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(COMPAT_DIR)/zipsetupstub.c + +zipsetupstub${EXEEXT_FOR_BUILD}: zipsetupstub.$(HOST_OBJEXT) + $(HOST_CC) -o $@ zipsetupstub.$(HOST_OBJEXT) + # The following target generates the file generic/tclDate.c from the yacc # grammar found in generic/tclGetDate.y. This is only run by hand as yacc is # not available in all environments. The name of the .c file is different than @@ -626,6 +750,25 @@ install-binaries: binaries $(COPY) $(REG_LIB_FILE) $(LIB_INSTALL_DIR)/reg${REGDOTVER}; \ fi +install-libraries-zipfs-shared: libraries + @for i in "$(SCRIPT_INSTALL_DIR)"; \ + do \ + if [ ! -d "$$i" ] ; then \ + echo "Making directory $$i"; \ + $(INSTALL_DATA_DIR) "$$i"; \ + else true; \ + fi; \ + done; + @echo "Installing library files to $(SCRIPT_INSTALL_DIR)/"; + @for i in \ + $(UNIX_DIR)/tclAppInit.c @LDAIX_SRC@ @DTRACE_SRC@; \ + do \ + $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"; \ + done; + +install-libraries-zipfs-static: install-libraries-zipfs-shared + $(INSTALL_DATA) ${TCL_ZIP_FILE} "$(LIB_INSTALL_DIR)" ;\ + install-libraries: libraries install-tzdata install-msgs @for i in "$$($(CYGPATH) $(prefix)/lib)" "$(INCLUDE_INSTALL_DIR)" \ $(SCRIPT_INSTALL_DIR); \ @@ -758,6 +901,7 @@ clean: cleanhelp clean-packages $(RM) *.lib *.a *.exp *.dll *.$(RES) *.${OBJEXT} *~ \#* TAGS a.out $(RM) $(TCLSH) $(CAT32) $(RM) *.pch *.ilk *.pdb + minizip${EXEEXT_FOR_BUILD} *.${HOST_OBJEXT} distclean: distclean-packages clean $(RM) Makefile config.status config.cache config.log tclConfig.sh \ @@ -890,5 +1034,6 @@ html-tk: $(TCLSH) .PHONY: gdb depend cleanhelp clean distclean packages install-packages .PHONY: test-packages clean-packages distclean-packages genstubs html .PHONY: html-tcl html-tk +.PHONY: iinstall-libraries-zipfs-shared install-libraries-zipfs-static tclzipfile # DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/win/configure b/win/configure index fdd3adb..ddba42a 100755 --- a/win/configure +++ b/win/configure @@ -687,6 +687,7 @@ TCL_STATIC_LIB_FLAG TCL_STATIC_LIB_FILE TCL_LIB_FLAG TCL_LIB_FILE +TCL_ZIP_FILE TCL_EXE PKG_CFG_ARGS TCL_PATCH_LEVEL @@ -699,6 +700,12 @@ VC_MANIFEST_EMBED_EXE VC_MANIFEST_EMBED_DLL LDFLAGS_DEFAULT CFLAGS_DEFAULT +INSTALL_MSGS +INSTALL_LIBRARIES +ZIPFS_BUILD +EXEEXT_FOR_BUILD +CC_FOR_BUILD +ZIP_PROG ZLIB_OBJS ZLIB_LIBS ZLIB_DLL_FILE @@ -708,6 +715,7 @@ CFLAGS_DEBUG DL_LIBS CELIB_DIR CYGPATH +SHARED_BUILD TCL_THREADS SET_MAKE RC @@ -760,7 +768,8 @@ PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +OBJEXT_FOR_BUILD' ac_subst_files='' ac_user_opts=' enable_option_checking @@ -770,6 +779,7 @@ enable_shared enable_64bit enable_wince with_celib +enable_zipfs enable_symbols enable_embedded_manifest ' @@ -1393,6 +1403,7 @@ Optional Features: --enable-shared build and link with shared libraries (default: on) --enable-64bit enable 64bit support (where applicable) --enable-wince enable Win/CE support (where applicable) + --enable-zipfs build with Zipfs support (default: on) --enable-symbols build with debugging symbols (default: off) --enable-embedded-manifest embed manifest if possible (default: yes) @@ -2117,6 +2128,8 @@ REGVER=$TCL_REG_MAJOR_VERSION$TCL_REG_MINOR_VERSION PKG_CFG_ARGS=$@ +TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip + #------------------------------------------------------------------------ # Empty slate for bundled packages, to avoid stale configuration #------------------------------------------------------------------------ @@ -3772,6 +3785,7 @@ $as_echo "#define STATIC_BUILD 1" >>confdefs.h fi + #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This # macro depends on the value of SHARED_BUILD, and should be called @@ -4828,6 +4842,165 @@ _ACEOF fi + +#-------------------------------------------------------------------- +# Zipfs support +#-------------------------------------------------------------------- + +# +# Check for --enable-zipfs flag +# +SC_ENABLE_ZIPFS + +# +# Find a native zip implementation +# + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 +$as_echo_n "checking for zip... " >&6; } + if ${ac_cv_path_zip+:} false; then : + $as_echo_n "(cached) " >&6 +else + + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/zip 2> /dev/null` \ + `ls -r $dir/zip 2> /dev/null` ; do + if test x"$ac_cv_path_zip" = x ; then + if test -f "$j" ; then + ac_cv_path_zip=$j + break + fi + fi + done + done + +fi + + + if test -f "$ac_cv_path_zip" ; then + ZIP_PROG="$ac_cv_path_zip" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5 +$as_echo "$ZIP_PROG" >&6; } + else + # It is not an error if an installed version of Zip can't be located. + ZIP_PROG="" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH" >&5 +$as_echo "No zip found on PATH" >&6; } + fi + + + +# +# Find a native compiler +# +# Put a plausible default for CC_FOR_BUILD in Makefile. +if test -z "$CC_FOR_BUILD"; then + if test "x$cross_compiling" = "xno"; then + CC_FOR_BUILD='$(CC)' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5 +$as_echo_n "checking for gcc... " >&6; } + if ${ac_cv_path_cc+:} false; then : + $as_echo_n "(cached) " >&6 +else + + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/gcc 2> /dev/null` \ + `ls -r $dir/gcc 2> /dev/null` ; do + if test x"$ac_cv_path_cc" = x ; then + if test -f "$j" ; then + ac_cv_path_cc=$j + break + fi + fi + done + done + +fi + + fi +fi + +# Also set EXEEXT_FOR_BUILD. +if test "x$cross_compiling" = "xno"; then + EXEEXT_FOR_BUILD='$(EXEEXT)' + OBJEXT_FOR_BUILD='$(OBJEXT)' +else + OBJEXT_FOR_BUILD='.no' + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5 +$as_echo_n "checking for build system executable suffix... " >&6; } +if ${bfd_cv_build_exeext+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.c + bfd_cv_build_exeext= + ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + rm -f conftest* + test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5 +$as_echo "$bfd_cv_build_exeext" >&6; } + EXEEXT_FOR_BUILD="" + test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} +fi + + +if test "$ZIP_PROG" = ""; then + ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}' +fi + +# Check whether --enable-zipfs was given. +if test "${enable_zipfs+set}" = set; then : + enableval=$enable_zipfs; tcl_ok=$enableval +else + tcl_ok=yes +fi + + if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then + ZIPFS_BUILD=1 + else + ZIPFS_BUILD=0 + fi + # Do checking message here to not mess up interleaved configure output + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5 +$as_echo_n "checking for building with zipfs... " >&6; } + if test "${ZIPFS_BUILD}" = 1; then + if test "${SHARED_BUILD}" = 0; then + ZIPFS_BUILD=2; + +$as_echo "#define ZIPFS_BUILD 2" >>confdefs.h + + INSTALL_LIBRARIES=install-libraries-zipfs-static + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + +$as_echo "#define ZIPFS_BUILD 1" >>confdefs.h +\ + INSTALL_LIBRARIES=install-libraries-zipfs-shared + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + INSTALL_LIBRARIES=install-libraries + INSTALL_MSGS=install-msgs + fi + + + + + #-------------------------------------------------------------------- # Perform additinal compiler tests. #-------------------------------------------------------------------- @@ -5220,6 +5393,7 @@ TCL_WIN_VERSION="$TCL_VERSION.$TCL_RELEASE_LEVEL.`echo $TCL_PATCH_LEVEL | tr -d + # empty on win diff --git a/win/configure.ac b/win/configure.ac index d03695c..0bb0d7d 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -29,6 +29,8 @@ REGVER=$TCL_REG_MAJOR_VERSION$TCL_REG_MINOR_VERSION PKG_CFG_ARGS=$@ +TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip + #------------------------------------------------------------------------ # Empty slate for bundled packages, to avoid stale configuration #------------------------------------------------------------------------ @@ -174,6 +176,62 @@ AC_CHECK_TYPE([uintptr_t], [ fi ]) + +#-------------------------------------------------------------------- +# Zipfs support +#-------------------------------------------------------------------- + +# +# Check for --enable-zipfs flag +# +SC_ENABLE_ZIPFS + +# +# Find a native zip implementation +# +SC_PROG_ZIP + +# +# Find a native compiler +# +AX_CC_FOR_BUILD + +if test "$ZIP_PROG" = ""; then + ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}' +fi + +AC_ARG_ENABLE(zipfs, + AC_HELP_STRING([--enable-zipfs], + [build with Zipfs support (default: on)]), + [tcl_ok=$enableval], [tcl_ok=yes]) + if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then + ZIPFS_BUILD=1 + else + ZIPFS_BUILD=0 + fi + # Do checking message here to not mess up interleaved configure output + AC_MSG_CHECKING([for building with zipfs]) + if test "${ZIPFS_BUILD}" = 1; then + if test "${SHARED_BUILD}" = 0; then + ZIPFS_BUILD=2; + AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?]) + INSTALL_LIBRARIES=install-libraries-zipfs-static + AC_MSG_RESULT([yes]) + else + AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\ + INSTALL_LIBRARIES=install-libraries-zipfs-shared + AC_MSG_RESULT([yes]) + fi + else + AC_MSG_RESULT([no]) + INSTALL_LIBRARIES=install-libraries + INSTALL_MSGS=install-msgs + fi + AC_SUBST(ZIPFS_BUILD) + AC_SUBST(INSTALL_LIBRARIES) + AC_SUBST(INSTALL_MSGS) + + #-------------------------------------------------------------------- # Perform additinal compiler tests. #-------------------------------------------------------------------- @@ -370,6 +428,7 @@ AC_SUBST(TCL_PATCH_LEVEL) AC_SUBST(PKG_CFG_ARGS) AC_SUBST(TCL_EXE) +AC_SUBST(TCL_ZIP_FILE) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_STATIC_LIB_FILE) diff --git a/win/tcl.m4 b/win/tcl.m4 index b4fbcce..07be5a4 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -251,6 +251,7 @@ AC_DEFUN([SC_PATH_TKCONFIG], [ # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE +# TCL_ZIP_FILE # #------------------------------------------------------------------------ @@ -283,6 +284,7 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [ # eval is required to do the TCL_DBGX substitution # + eval "TCL_ZIP_FILE=\"${TCL_ZIP_FILE}\"" eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" @@ -295,6 +297,7 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [ AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SRC_DIR) + AC_SUBST(TCL_ZIP_FILE) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_LIB_SPEC) @@ -380,6 +383,7 @@ AC_DEFUN([SC_ENABLE_SHARED], [ SHARED_BUILD=0 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?]) fi + AC_SUBST(SHARED_BUILD) ]) #------------------------------------------------------------------------ @@ -1297,3 +1301,107 @@ print("manifest needed") AC_SUBST(VC_MANIFEST_EMBED_DLL) AC_SUBST(VC_MANIFEST_EMBED_EXE) ]) + + +#------------------------------------------------------------------------ +# SC_PROG_ZIP +# Locate a zip encoder installed on the system path, or none. +# +# Arguments: +# none +# +# Results: +# Substitutes the following vars: +# ZIP_PROG +#------------------------------------------------------------------------ + +AC_DEFUN([SC_PROG_ZIP], [ + AC_MSG_CHECKING([for zip]) + AC_CACHE_VAL(ac_cv_path_zip, [ + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/zip 2> /dev/null` \ + `ls -r $dir/zip 2> /dev/null` ; do + if test x"$ac_cv_path_zip" = x ; then + if test -f "$j" ; then + ac_cv_path_zip=$j + break + fi + fi + done + done + ]) + + if test -f "$ac_cv_path_zip" ; then + ZIP_PROG="$ac_cv_path_zip" + AC_MSG_RESULT([$ZIP_PROG]) + else + # It is not an error if an installed version of Zip can't be located. + ZIP_PROG="" + AC_MSG_RESULT([No zip found on PATH]) + fi + AC_SUBST(ZIP_PROG) +]) + +#------------------------------------------------------------------------ +# SC_CC_FOR_BUILD +# For cross compiles, locate a C compiler that can generate native binaries. +# +# Arguments: +# none +# +# Results: +# Substitutes the following vars: +# CC_FOR_BUILD +# EXEEXT_FOR_BUILD +#------------------------------------------------------------------------ + +dnl Get a default for CC_FOR_BUILD to put into Makefile. +AC_DEFUN([AX_CC_FOR_BUILD], +[# Put a plausible default for CC_FOR_BUILD in Makefile. +if test -z "$CC_FOR_BUILD"; then + if test "x$cross_compiling" = "xno"; then + CC_FOR_BUILD='$(CC)' + else + AC_MSG_CHECKING([for gcc]) + AC_CACHE_VAL(ac_cv_path_cc, [ + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/gcc 2> /dev/null` \ + `ls -r $dir/gcc 2> /dev/null` ; do + if test x"$ac_cv_path_cc" = x ; then + if test -f "$j" ; then + ac_cv_path_cc=$j + break + fi + fi + done + done + ]) + fi +fi +AC_SUBST(CC_FOR_BUILD) +# Also set EXEEXT_FOR_BUILD. +if test "x$cross_compiling" = "xno"; then + EXEEXT_FOR_BUILD='$(EXEEXT)' + OBJEXT_FOR_BUILD='$(OBJEXT)' +else + OBJEXT_FOR_BUILD='.no' + AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, + [rm -f conftest* + echo 'int main () { return 0; }' > conftest.c + bfd_cv_build_exeext= + ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + rm -f conftest* + test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) + EXEEXT_FOR_BUILD="" + test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} +fi +AC_SUBST(EXEEXT_FOR_BUILD)])dnl +AC_SUBST(OBJEXT_FOR_BUILD)])dnl diff --git a/win/tclAppInit.c b/win/tclAppInit.c index ef9f98b..bbe727f 100644 --- a/win/tclAppInit.c +++ b/win/tclAppInit.c @@ -124,6 +124,8 @@ _tmain( #ifdef TCL_LOCAL_MAIN_HOOK TCL_LOCAL_MAIN_HOOK(&argc, &argv); +#else + TclZipfs_AppHook(&argc, &argv); #endif Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); diff --git a/win/tclConfig.sh.in b/win/tclConfig.sh.in index 97670aa..25fc3de 100644 --- a/win/tclConfig.sh.in +++ b/win/tclConfig.sh.in @@ -41,6 +41,9 @@ TCL_SHARED_BUILD=@TCL_SHARED_BUILD@ # The name of the Tcl library (may be either a .a file or a shared library): TCL_LIB_FILE='@TCL_LIB_FILE@' +# The name of a zip containing the /library and /encodings (may be either a .zip file or a shared library): +TCL_ZIP_FILE='@TCL_ZIP_FILE@' + # Flag to indicate whether shared libraries need export files. TCL_NEEDS_EXP_FILE=@TCL_NEEDS_EXP_FILE@ -- cgit v0.12 From ded3368d3c2650fc1d5a7c888218f8ca7a4fd459 Mon Sep 17 00:00:00 2001 From: tne Date: Fri, 17 Nov 2017 04:45:07 +0000 Subject: Final tweaks to get Msys Zipfs build working --- unix/configure.ac | 5 ----- win/Makefile.in | 10 +++++++++- win/configure.ac | 5 ----- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/unix/configure.ac b/unix/configure.ac index 35429b5..ed85184 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -797,11 +797,6 @@ AC_MSG_RESULT([$tcl_ok]) #-------------------------------------------------------------------- # -# Check for --enable-zipfs flag -# -SC_ENABLE_ZIPFS - -# # Find a native zip implementation # SC_PROG_ZIP diff --git a/win/Makefile.in b/win/Makefile.in index 14868cf..214cf7b 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -229,6 +229,7 @@ MINIZIP_OBJS = \ inflate.$(HOST_OBJEXT) \ inftrees.$(HOST_OBJEXT) \ ioapi.$(HOST_OBJEXT) \ + iowin32.$(HOST_OBJEXT) \ trees.$(HOST_OBJEXT) \ uncompr.$(HOST_OBJEXT) \ zip.$(HOST_OBJEXT) \ @@ -556,7 +557,11 @@ tclMain2.${OBJEXT}: tclMain.c # TIP #430, ZipFS Support tclZipfs.${OBJEXT}: $(GENERIC_DIR)/tclZipfs.c - $(CC) -c $(CC_SWITCHES) $(ZLIB_INCLUDE) -I$(ZLIB_DIR)/contrib/minizip $(GENERIC_DIR)/tclZipfs.c + $(CC) -c $(CC_SWITCHES) -DBUILD_tcl \ + -DCFG_RUNTIME_DLLFILE="\"$(TCL_LIB_FILE)\"" \ + -DCFG_RUNTIME_ZIPFILE="\"$(TCL_ZIP_FILE)\"" \ + -DCFG_RUNTIME_PATH="\"$(DLL_INSTALL_DIR)\"" \ + $(ZLIB_INCLUDE) -I$(ZLIB_DIR)/contrib/minizip @DEPARG@ $(CC_OBJNAME) # TIP #59, embedding of configuration information into the binary library. @@ -625,6 +630,9 @@ deflate.$(HOST_OBJEXT): ioapi.$(HOST_OBJEXT): $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/ioapi.c +iowin32.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/iowin32.c + infback.$(HOST_OBJEXT): $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/infback.c diff --git a/win/configure.ac b/win/configure.ac index 0bb0d7d..cf66fc2 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -182,11 +182,6 @@ AC_CHECK_TYPE([uintptr_t], [ #-------------------------------------------------------------------- # -# Check for --enable-zipfs flag -# -SC_ENABLE_ZIPFS - -# # Find a native zip implementation # SC_PROG_ZIP -- cgit v0.12 From 3c532f6336d06908079d7247329984747d31e152 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Fri, 17 Nov 2017 04:47:16 +0000 Subject: Rebuilt the configure files without the call to the missing SC_ENABLE_ZIPFS macro --- unix/configure | 5 ----- win/configure | 5 ----- 2 files changed, 10 deletions(-) diff --git a/unix/configure b/unix/configure index 44bd2a6..dd6bf6b 100755 --- a/unix/configure +++ b/unix/configure @@ -10159,11 +10159,6 @@ $as_echo "$tcl_ok" >&6; } #-------------------------------------------------------------------- # -# Check for --enable-zipfs flag -# -SC_ENABLE_ZIPFS - -# # Find a native zip implementation # diff --git a/win/configure b/win/configure index ddba42a..f65b78a 100755 --- a/win/configure +++ b/win/configure @@ -4848,11 +4848,6 @@ fi #-------------------------------------------------------------------- # -# Check for --enable-zipfs flag -# -SC_ENABLE_ZIPFS - -# # Find a native zip implementation # -- cgit v0.12 From 51319d2caea0e5bcc5b852171ddbc85901c6f845 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Fri, 17 Nov 2017 06:52:48 +0000 Subject: Add PRJ_PACKAGE_TCLNAME and other minor changes. Also: Change ifdef checks to check for empty string instead. Quote include paths. --- win/rules.vc | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 586272d..425f873 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -27,10 +27,15 @@ RULES_VERSION_MAJOR = 1 RULES_VERSION_MINOR = 0 # The PROJECT macro must be defined by parent makefile. -# Also special case Tcl and Tk to save some typing later -!ifndef PROJECT +!if "$(PROJECT)" == "" !error *** Error: Macro PROJECT not defined! Please define it before including rules.vc !endif + +!if "$(PRJ_PACKAGE_TCLNAME)" == "" +PRJ_PACKAGE_TCLNAME = $(PROJECT) +!endif + +# Also special case Tcl and Tk to save some typing later DOING_TCL = 0 DOING_TK = 0 !if "$(PROJECT)" == "tcl" @@ -250,7 +255,7 @@ _TCL_H = ..\generic\tcl.h # BEGIN Case 2(b) - Building Tk TCLINSTALL = 0 # Tk always builds against Tcl source, not an installed Tcl -!ifndef TCLDIR +!if "$(TCLDIR)" == "" TCLDIR = ../../tcl !endif _TCLDIR = $(TCLDIR:/=\) @@ -269,7 +274,7 @@ _TK_H = ..\generic\tk.h # If command line has specified Tcl location through TCLDIR, use it # else default to the INSTALLDIR setting -!ifdef TCLDIR +!if "$(TCLDIR)" != "" _TCLDIR = $(TCLDIR:/=\) !if exist("$(_TCLDIR)\include\tcl.h") # Case 2(c) with TCLDIR defined @@ -307,7 +312,7 @@ Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and defa # Now do the same to locate Tk headers and libs if project requires Tk !if $(NEED_TK) -!ifdef TKDIR +!if "$(TKDIR)" != "" _TKDIR = $(TKDIR:/=\) !if exist("$(_TKDIR)\include\tk.h") @@ -1259,6 +1264,7 @@ COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE # Like the TEA system only set this non empty for non-Tk extensions !if !$(DOING_TCL) && !$(DOING_TK) PKGNAMEFLAGS = -DPACKAGE_NAME="\"$(PROJECT)\"" \ + -DPACKAGE_TCLNAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \ -DMODULE_SCOPE=extern !endif @@ -1312,7 +1318,7 @@ cwarn = $(cwarn) -WX INCLUDES = $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) !if !$(DOING_TCL) && !$(DOING_TK) -INCLUDES = $(INCLUDES) -I$(GENERICDIR) -I$(WINDIR) -I(COMPATDIR) +INCLUDES = $(INCLUDES) -I"$(GENERICDIR)" -I"$(WINDIR)" -I"$(COMPATDIR)" !endif # These flags are defined roughly in the order of the pre-reform @@ -1436,13 +1442,14 @@ DEFAULT_BUILD_TARGET = $(PROJECT) default-target: $(DEFAULT_BUILD_TARGET) default-pkgindex: - @echo package ifneeded $(PROJECT) $(DOTVERSION) \ - [list load [file join $$dir $(PRJLIBNAME)]] >> $(OUT_DIR)\pkgIndex.tcl + @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ + [list load [file join $$dir $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl default-pkgindex-tea: @if exist $(ROOT)\pkgIndex.tcl.in nmakehlp -s << $(ROOT)\pkgIndex.tcl.in > $(OUT_DIR)\pkgIndex.tcl @PACKAGE_VERSION@ $(DOTVERSION) @PACKAGE_NAME@ $(PROJECT) +@PACKAGE_TCLNAME@ $(PRJ_PACKAGE_TCLNAME) @PKG_LIB_FILE@ $(PRJLIBNAME) << -- cgit v0.12 From 5560b9198b6cdd785cf9d82301a7fff87c0c8c1f Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Fri, 17 Nov 2017 07:05:23 +0000 Subject: Check for existence of targets.vc, not rules.vc to determine nmake support dir. --- win/rules-ext.vc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/win/rules-ext.vc b/win/rules-ext.vc index ec84464..abaaed6 100644 --- a/win/rules-ext.vc +++ b/win/rules-ext.vc @@ -45,13 +45,14 @@ _RULESDIR = ..\..\tcl !endif # ifndef TCLDIR -# Now look for the rules.vc file under the Tcl root -!if exist("$(_RULESDIR)\lib\nmake\rules.vc") # Building against installed Tcl +# Now look for the targets.vc file under the Tcl root. Note we check this +# file and not rules.vc because the latter also exists on older systems. +!if exist("$(_RULESDIR)\lib\nmake\targets.vc") # Building against installed Tcl _RULESDIR = $(_RULESDIR)\lib\nmake -!elseif exist("$(_RULESDIR)\win\rules.vc") # Building against Tcl sources +!elseif exist("$(_RULESDIR)\win\targets.vc") # Building against Tcl sources _RULESDIR = $(_RULESDIR)\win !else -# If we have not located Tcl's rules file, most likely we are compiling +# If we have not located Tcl's targets file, most likely we are compiling # against an older version of Tcl and so must use our own support files. _RULESDIR = . !endif @@ -102,7 +103,7 @@ NMAKEHLPC = $(_RULESDIR)\nmakehlp.c !message *** Using $(_RULESDIR)\rules.vc !include "$(_RULESDIR)\rules.vc" !else -!error *** Could not locate rules.vc +!error *** Could not locate rules.vc in $(_RULESDIR) !endif !endif # _RULES_EXT_VC \ No newline at end of file -- cgit v0.12 From ac3259b669c253852e4108c8da44a959fb1465a9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 17 Nov 2017 08:32:16 +0000 Subject: Suggested patch for [4f51e1c5dc]: patch to correct linker flag sequence. Same change done for a few other platforms where it might matter. --- unix/configure | 8 ++++---- unix/tcl.m4 | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/unix/configure b/unix/configure index 39076a4..888fe0c 100755 --- a/unix/configure +++ b/unix/configure @@ -6954,7 +6954,7 @@ echo "$as_me: error: CYGWIN compile is only supported with --enable-threads" >&2 LDFLAGS="$LDFLAGS -Wl,--export-dynamic" SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" - SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}' + SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-lroot" echo "$as_me:$LINENO: checking for inet_ntoa in -lnetwork" >&5 @@ -7383,7 +7383,7 @@ fi # get rid of the warnings. #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" - SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}' + SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" @@ -7525,7 +7525,7 @@ fi SHLIB_CFLAGS="-fpic" ;; esac - SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' + SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" @@ -7554,7 +7554,7 @@ fi NetBSD-*) # NetBSD has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" - SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' + SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 8a802fb..6ca2047 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1258,7 +1258,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ LDFLAGS="$LDFLAGS -Wl,--export-dynamic" SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" - SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}' + SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-lroot" AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"]) @@ -1402,7 +1402,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ # get rid of the warnings. #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES" - SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}' + SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -Wl,--export-dynamic" @@ -1473,7 +1473,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ SHLIB_CFLAGS="-fpic" ;; esac - SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' + SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" @@ -1496,7 +1496,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ NetBSD-*) # NetBSD has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" - SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' + SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" -- cgit v0.12 From da76cd286ccf8763ea9970ee813e3ef3da20e252 Mon Sep 17 00:00:00 2001 From: aspect Date: Fri, 17 Nov 2017 08:39:31 +0000 Subject: Zipfs: Use //zipfs:/ as mount point. Use Tcl_FSNormalizePath() on the way in to most VFS operations. Add some tests. --- generic/tclInterp.c | 4 +- generic/tclZipfs.c | 19 ++++++++-- tests/zipfs.test | 104 ++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 93 insertions(+), 34 deletions(-) diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 2b0582a..8d45d87 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -402,8 +402,8 @@ Tcl_Init( " set scripts {{set tcl_library}}\n" " } else {\n" " set scripts {}\n" -" lappend scripts {set temp zipfs:/lib/tcl/tcl_library}\n" -" lappend scripts {set temp zipfs:/app/tcl_library}\n" +" lappend scripts {set temp //zipfs:/lib/tcl/tcl_library}\n" +" lappend scripts {set temp //zipfs:/app/tcl_library}\n" " if {[info exists env(TCL_LIBRARY)] && ($env(TCL_LIBRARY) ne {})} {\n" " lappend scripts {set env(TCL_LIBRARY)}\n" " lappend scripts {\n" diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 9dfca7a..6b707fc 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -28,11 +28,11 @@ #include "zlib.h" #include "crypt.h" -#define ZIPFS_VOLUME "zipfs:/" -#define ZIPFS_APP_MOUNT "zipfs:/app" -#define ZIPFS_ZIP_MOUNT "zipfs:/lib/tcl" +#define ZIPFS_VOLUME "//zipfs:/" +#define ZIPFS_APP_MOUNT "//zipfs:/app" +#define ZIPFS_ZIP_MOUNT "//zipfs:/lib/tcl" -#define ZIPFS_VOLUME_LEN 7 +#define ZIPFS_VOLUME_LEN 9 /* * Various constants and offsets found in ZIP archive files @@ -2775,6 +2775,7 @@ ZipChannelOpen(Tcl_Interp *interp, char *filename, int mode, int permissions) if (z == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("file not found", -1)); + Tcl_AppendResult(interp, " \"", filename, "\"", NULL); } goto error; } @@ -3156,6 +3157,8 @@ Zip_FSOpenFileChannelProc(Tcl_Interp *interp, Tcl_Obj *pathPtr, { int len; + if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; + return ZipChannelOpen(interp, Tcl_GetStringFromObj(pathPtr, &len), mode, permissions); } @@ -3182,6 +3185,8 @@ Zip_FSStatProc(Tcl_Obj *pathPtr, Tcl_StatBuf *buf) { int len; + if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; + return ZipEntryStat(Tcl_GetStringFromObj(pathPtr, &len), buf); } @@ -3207,6 +3212,8 @@ Zip_FSAccessProc(Tcl_Obj *pathPtr, int mode) { int len; + if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; + return ZipEntryAccess(Tcl_GetStringFromObj(pathPtr, &len), mode); } @@ -3429,6 +3436,8 @@ Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr) char *path; Tcl_DString ds; + if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; + path = Tcl_GetStringFromObj(pathPtr, &len); if(strncmp(path,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN)!=0) { return -1; @@ -3552,6 +3561,8 @@ Zip_FSFileAttrsGetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, char *path; ZipEntry *z; + if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; + path = Tcl_GetStringFromObj(pathPtr, &len); ReadLock(); z = ZipFSLookup(path); diff --git a/tests/zipfs.test b/tests/zipfs.test index 89d35ad..b14aa7d 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -18,69 +18,108 @@ if {"::tcltest" ni [namespace children]} { testConstraint zipfs [expr {[llength [info commands zlib]] && [regexp tcltest [info nameofexecutable]]}] # Removed in tip430 - zipfs is no longer a static package -#test zipfs-1.1 {zipfs basics} -constraints zipfs -body { +#test zipfs-0.0 {zipfs basics} -constraints zipfs -body { # load {} zipfs #} -result {} -test zipfs-1.2 {zipfs basics} -constraints zipfs -body { +test zipfs-0.1 {zipfs basics} -constraints zipfs -body { package require zipfs } -result {1.0} -test zipfs-1.3 {zipfs basics} -constraints zipfs -returnCodes error -body { +test zipfs-0.1 {zipfs basics} -constraints zipfs -body { + expr {"//zipfs:/" in [file volumes]} +} -result 1 + +test zipfs-0.2 {zipfs basics} -constraints zipfs -body { + string match //zipfs:/* $tcl_library +} -result 1 + +test zipfs-0.3 {zipfs basics: glob} -constraints zipfs -body { + set pwd [pwd] + cd $tcl_library + lsort [glob -dir . http*] +} -cleanup { + cd $pwd +} -result {./http ./http1.0} + +test zipfs-0.4 {zipfs basics: glob} -constraints zipfs -body { + set pwd [pwd] + cd $tcl_library + lsort [glob -dir [pwd] http*] +} -cleanup { + cd $pwd +} -result [list $tcl_library/http $tcl_library/http1.0] + +test zipfs-0.5 {zipfs basics: glob} -constraints zipfs -body { + lsort [glob -dir $tcl_library http*] +} -result [list $tcl_library/http $tcl_library/http1.0] + +test zipfs-0.6 {zipfs basics: glob} -constraints zipfs -body { + lsort [glob -tails -dir $tcl_library http*] +} -result {http http1.0} + +test zipfs-0.7 {zipfs basics: glob} -constraints zipfs -body { + lsort [glob -nocomplain -tails -types d -dir $tcl_library http*] +} -result {http http1.0} + +test zipfs-0.8 {zipfs basics: glob} -constraints zipfs -body { + lsort [glob -nocomplain -tails -types f -dir $tcl_library http*] +} -result {} + + +test zipfs-1.3 {zipfs errors} -constraints zipfs -returnCodes error -body { zipfs mount a b c d e f } -result {wrong # args: should be "zipfs mount ?zipfile? ?mountpoint? ?password?"} -test zipfs-1.4 {zipfs basics} -constraints zipfs -returnCodes error -body { +test zipfs-1.4 {zipfs errors} -constraints zipfs -returnCodes error -body { zipfs unmount a b c d e f } -result {wrong # args: should be "zipfs unmount zipfile"} -test zipfs-1.5 {zipfs basics} -constraints zipfs -returnCodes error -body { +test zipfs-1.5 {zipfs errors} -constraints zipfs -returnCodes error -body { zipfs mkkey a b c d e f } -result {wrong # args: should be "zipfs mkkey password"} -test zipfs-1.6 {zipfs basics} -constraints zipfs -returnCodes error -body { +test zipfs-1.6 {zipfs errors} -constraints zipfs -returnCodes error -body { zipfs mkimg a b c d e f } -result {wrong # args: should be "zipfs mkimg outfile indir ?strip? ?password? ?infile?"} -test zipfs-1.7 {zipfs basics} -constraints zipfs -returnCodes error -body { +test zipfs-1.7 {zipfs errors} -constraints zipfs -returnCodes error -body { zipfs mkzip a b c d e f } -result {wrong # args: should be "zipfs mkzip outfile indir ?strip? ?password?"} -test zipfs-1.8 {zipfs basics} -constraints zipfs -returnCodes error -body { +test zipfs-1.8 {zipfs errors} -constraints zipfs -returnCodes error -body { zipfs exists a b c d e f } -result {wrong # args: should be "zipfs exists filename"} -test zipfs-1.9 {zipfs basics} -constraints zipfs -returnCodes error -body { +test zipfs-1.9 {zipfs errors} -constraints zipfs -returnCodes error -body { zipfs info a b c d e f } -result {wrong # args: should be "zipfs info filename"} -test zipfs-1.10 {zipfs basics} -constraints zipfs -returnCodes error -body { +test zipfs-1.10 {zipfs errors} -constraints zipfs -returnCodes error -body { zipfs list a b c d e f } -result {wrong # args: should be "zipfs list ?(-glob|-regexp)? ?pattern?"} -set ntcl_library [file normalize $tcl_library] - test zipfs-2.1 {zipfs mkzip empty archive} -constraints zipfs -returnCodes error -body { - zipfs mkzip abc.zip $ntcl_library/xxxx + zipfs mkzip /tmp/abc.zip $tcl_library/xxxx ;# FIXME: test independence } -result {empty archive} test zipfs-2.2 {zipfs mkzip} -constraints zipfs -body { set pwd [pwd] - cd $ntcl_library/encoding - zipfs mkzip abc.zip . - zipfs mount abc.zip zipfs:/abc - zipfs list -glob zipfs:/abc/cp850.* + cd $tcl_library/encoding + zipfs mkzip /tmp/abc.zip . + zipfs mount /tmp/abc.zip //zipfs:/abc ;# FIXME: test independence + zipfs list -glob //zipfs:/abc/cp850.* } -cleanup { cd $pwd -} -result {zipfs:/abc/cp850.enc} +} -result {//zipfs:/abc/cp850.enc} -test zipfs-2.3 {zipfs unmount} -constraints zipfs -body { - zipfs info zipfs:/abc/cp850.enc -} -result [list $ntcl_library/encoding/abc.zip 1090 527 39434] +test zipfs-2.3 {zipfs info} -constraints zipfs -body { + zipfs info //zipfs:/abc/cp850.enc +} -result [list /tmp/abc.zip 1090 527 39318] ;# FIXME: result depends on content of encodings dir -test zipfs-2.4 {zipfs unmount} -constraints zipfs -body { - set f [open zipfs:/abc/cp850.enc] - read $f +test zipfs-2.4 {zipfs data} -constraints zipfs -body { + set zipfd [open //zipfs:/abc/cp850.enc] ;# FIXME: leave open - see later test + read $zipfd } -result {# Encoding file: cp850, single-byte S 003F 0 1 @@ -101,14 +140,23 @@ S 00F000D000CA00CB00C8013100CD00CE00CF2518250C2588258400A600CC2580 00D300DF00D400D200F500D500B500FE00DE00DA00DB00D900FD00DD00AF00B4 00AD00B1201700BE00B600A700F700B800B000A800B700B900B300B225A000A0 -} +} ;# FIXME: result depends on content of encodings dir test zipfs-2.5 {zipfs exists} -constraints zipfs -body { - zipfs unmount abc.zip zipfs exists /abc/cp850.enc -} -cleanup { - file delete abc.zip } -result 1 + +test zipfs-2.6 {zipfs unmount while busy} -constraints zipfs -body { + zipfs unmount /tmp/abc.zip +} -returnCodes error -result {filesystem is busy} + +test zipfs-2.7 {zipfs unmount} -constraints zipfs -body { + close $zipfd + zipfs unmount /tmp/abc.zip + zipfs exists /abc/cp850.enc +} -cleanup { + file delete /tmp/abc.zip ;# FIXME: test independence +} -result 0 ::tcltest::cleanupTests return -- cgit v0.12 From 87d37d3101b7ac510f9eb38766e63de5308a4d4b Mon Sep 17 00:00:00 2001 From: aspect Date: Fri, 17 Nov 2017 10:17:47 +0000 Subject: Zipfs: Nix AbsolutePath() and most uses of CanonicalPath(). Tcl_FSNormalizePath is to be trusted. --- generic/tclZipfs.c | 116 +++++++++++++++-------------------------------------- 1 file changed, 32 insertions(+), 84 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 6b707fc..a03f4cf 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -645,50 +645,6 @@ CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr,int ZIPFSPA /* *------------------------------------------------------------------------- * - * AbsolutePath -- - * - * This function computes the absolute path from a given - * (relative) path name into the specified Tcl_DString. - * - * Results: - * Returns the pointer to the absolute path contained in the - * specified Tcl_DString. - * - * Side effects: - * Modifies the specified Tcl_DString. - * - *------------------------------------------------------------------------- - */ - -static char * -AbsolutePath(const char *path, - Tcl_DString *dsPtr, - int ZIPFSPATH) -{ - char *result; - if (*path == '~') { - Tcl_DStringAppend(dsPtr, path, -1); - return Tcl_DStringValue(dsPtr); - } - if (*path != '/') { - Tcl_DString pwd; - - /* relative path */ - Tcl_DStringInit(&pwd); - Tcl_GetCwd(NULL, &pwd); - result = Tcl_DStringValue(&pwd); - result = CanonicalPath(result, path, dsPtr,ZIPFSPATH); - Tcl_DStringFree(&pwd); - } else { - /* absolute path */ - result = CanonicalPath("", path, dsPtr,ZIPFSPATH); - } - return result; -} - -/* - *------------------------------------------------------------------------- - * * ZipFSLookup -- * * This function returns the ZIP entry struct corresponding to @@ -708,14 +664,11 @@ AbsolutePath(const char *path, static ZipEntry * ZipFSLookup(char *filename) { - char *realname; - Tcl_HashEntry *hPtr; ZipEntry *z; Tcl_DString ds; Tcl_DStringInit(&ds); - realname = AbsolutePath(filename, &ds, 1); - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, realname); + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, filename); z = hPtr ? (ZipEntry *) Tcl_GetHashValue(hPtr) : NULL; Tcl_DStringFree(&ds); return z; @@ -743,18 +696,16 @@ ZipFSLookup(char *filename) static int ZipFSLookupMount(char *filename) { - char *realname; Tcl_HashEntry *hPtr; Tcl_HashSearch search; ZipFile *zf; Tcl_DString ds; int match = 0; Tcl_DStringInit(&ds); - realname = AbsolutePath(filename, &ds, 1); hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); while (hPtr != NULL) { if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { - if (strcmp(zf->mntpt, realname) == 0) { + if (strcmp(zf->mntpt, filename) == 0) { match = 1; break; } @@ -1052,12 +1003,11 @@ int TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd) { - char *realname, *p; int i, pwlen, isNew; ZipFile *zf, zf0; ZipEntry *z; Tcl_HashEntry *hPtr; - Tcl_DString ds, dsm, fpBuf; + Tcl_DString ds, fpBuf; unsigned char *q; ReadLock(); @@ -1096,9 +1046,7 @@ TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, Unlock(); return TCL_OK; } - Tcl_DStringInit(&ds); - p = AbsolutePath(zipname, &ds, 0); - hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, p); + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, zipname); if (hPtr != NULL) { if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { Tcl_SetObjResult(interp, @@ -1106,7 +1054,6 @@ TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, } } Unlock(); - Tcl_DStringFree(&ds); return TCL_OK; } Unlock(); @@ -1124,18 +1071,13 @@ TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, if (ZipFSOpenArchive(interp, zipname, 1, &zf0) != TCL_OK) { return TCL_ERROR; } - Tcl_DStringInit(&ds); - realname = AbsolutePath(zipname, &ds, 0); /* * Mount point can come from Tcl_GetNameOfExecutable() * which sometimes is a relative or otherwise denormalized path. * But an absolute name is needed as mount point here. */ - Tcl_DStringInit(&dsm); - mntpt = CanonicalPath("", mntpt, &dsm, 1); WriteLock(); - hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, realname, &isNew); - Tcl_DStringSetLength(&ds, 0); + hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, zipname, &isNew); if (!isNew) { zf = (ZipFile *) Tcl_GetHashValue(hPtr); if (interp != NULL) { @@ -1143,8 +1085,6 @@ TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, zf->mntpt : "/", "\"", (char *) NULL); } Unlock(); - Tcl_DStringFree(&ds); - Tcl_DStringFree(&dsm); ZipFSCloseArchive(interp, &zf0); return TCL_ERROR; } @@ -1157,8 +1097,6 @@ TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, Tcl_AppendResult(interp, "out of memory", (char *) NULL); } Unlock(); - Tcl_DStringFree(&ds); - Tcl_DStringFree(&dsm); ZipFSCloseArchive(interp, &zf0); return TCL_ERROR; } @@ -1209,6 +1147,7 @@ TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, } q = zf->data + zf->centoffs; Tcl_DStringInit(&fpBuf); + Tcl_DStringInit(&ds); for (i = 0; i < zf->nfiles; i++) { int pathlen, comlen, extra, isdir = 0, dosTime, dosDate, nbcompr, offs; unsigned char *lq, *gq = NULL; @@ -1374,7 +1313,6 @@ nextent: Unlock(); Tcl_DStringFree(&fpBuf); Tcl_DStringFree(&ds); - Tcl_DStringFree(&dsm); Tcl_FSMountsChanged(NULL); return TCL_OK; } @@ -1398,7 +1336,6 @@ nextent: int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) { - char *realname; ZipFile *zf; ZipEntry *z, *znext; Tcl_HashEntry *hPtr; @@ -1406,12 +1343,11 @@ TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) int ret = TCL_OK, unmounted = 0; Tcl_DStringInit(&ds); - realname = AbsolutePath(zipname, &ds, 0); WriteLock(); if (!ZipFS.initialized) { goto done; } - hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, realname); + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, zipname); if (hPtr == NULL) { /* don't report error */ goto done; @@ -2304,15 +2240,24 @@ ZipFSExistsObjCmd(ClientData clientData, Tcl_Interp *interp, { char *filename; int exists; + Tcl_DString ds; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "filename"); return TCL_ERROR; } + + /* prepend ZIPFS_VOLUME to filename, eliding the final / */ filename = Tcl_GetStringFromObj(objv[1], 0); + Tcl_DStringInit(&ds); + Tcl_DStringAppend(&ds, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN-1); + Tcl_DStringAppend(&ds, filename, -1); + filename = Tcl_DStringValue(&ds); + ReadLock(); exists = ZipFSLookup(filename) != NULL; Unlock(); + Tcl_SetObjResult(interp,Tcl_NewBooleanObj(exists)); return TCL_OK; } @@ -3157,7 +3102,7 @@ Zip_FSOpenFileChannelProc(Tcl_Interp *interp, Tcl_Obj *pathPtr, { int len; - if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; + if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return NULL; return ZipChannelOpen(interp, Tcl_GetStringFromObj(pathPtr, &len), mode, permissions); @@ -3267,19 +3212,26 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, { Tcl_HashEntry *hPtr; Tcl_HashSearch search; + Tcl_Obj *normPathPtr; int scnt, len, l, dirOnly = -1, prefixLen, strip = 0; char *pat, *prefix, *path; - Tcl_DString ds, dsPref; + Tcl_DString dsPref; + + if (!(normPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; + if (types != NULL) { dirOnly = (types->type & TCL_GLOB_TYPE_DIR) == TCL_GLOB_TYPE_DIR; } - Tcl_DStringInit(&ds); - Tcl_DStringInit(&dsPref); + + /* the prefix that gets prepended to results */ prefix = Tcl_GetStringFromObj(pathPtr, &prefixLen); + + /* the (normalized) path we're searching */ + path = Tcl_GetStringFromObj(normPathPtr, &len); + + Tcl_DStringInit(&dsPref); Tcl_DStringAppend(&dsPref, prefix, prefixLen); - prefix = Tcl_DStringValue(&dsPref); - path = AbsolutePath(prefix, &ds, 1); - len = Tcl_DStringLength(&ds); + if (strcmp(prefix, path) == 0) { prefix = NULL; } else { @@ -3405,7 +3357,6 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, end: Unlock(); Tcl_DStringFree(&dsPref); - Tcl_DStringFree(&ds); return TCL_OK; } @@ -3434,7 +3385,6 @@ Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr) ZipFile *zf; int ret = -1, len; char *path; - Tcl_DString ds; if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; @@ -3443,9 +3393,8 @@ Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr) return -1; } - Tcl_DStringInit(&ds); - path = CanonicalPath("",path, &ds, 1); - len = Tcl_DStringLength(&ds); + len = strlen(path); + ReadLock(); hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path); if (hPtr != NULL) { @@ -3476,7 +3425,6 @@ Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr) } endloop: Unlock(); - Tcl_DStringFree(&ds); return ret; } -- cgit v0.12 From 451510384623e7c0f4ca04f3ec6d5845fe69de33 Mon Sep 17 00:00:00 2001 From: aspect Date: Fri, 17 Nov 2017 10:21:41 +0000 Subject: whitespace consistency --- generic/tclZipfs.c | 1152 ++++++++++++++++++++++++++-------------------------- 1 file changed, 576 insertions(+), 576 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index a03f4cf..5aa001f 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -503,141 +503,141 @@ CountSlashes(const char *string) static char * CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr,int ZIPFSPATH) { - char *path; - char *result; - int i, j, c, isunc = 0, isvfs=0, n=0; + char *path; + char *result; + int i, j, c, isunc = 0, isvfs=0, n=0; #if HAS_DRIVES - int zipfspath=1; - if ((tail[0] != '\0') && (strchr(drvletters, tail[0]) != NULL) && - (tail[1] == ':')) { - tail += 2; - zipfspath=0; - } - /* UNC style path */ - if (tail[0] == '\\') { - root = ""; - ++tail; - zipfspath=0; - } - if (tail[0] == '\\') { - root = "/"; - ++tail; - zipfspath=0; - } - if(zipfspath) { -#endif + int zipfspath=1; + if ((tail[0] != '\0') && (strchr(drvletters, tail[0]) != NULL) && + (tail[1] == ':')) { + tail += 2; + zipfspath=0; + } /* UNC style path */ - if(root && strncmp(root,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN)==0) { - isvfs=1; - } else if (tail && strncmp(tail,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN) == 0) { - isvfs=2; - } - if(isvfs!=1) { - if ((root[0] == '/') && (root[1] == '/')) { - isunc = 1; - } + if (tail[0] == '\\') { + root = ""; + ++tail; + zipfspath=0; } -#if HAS_DRIVES - } -#endif - if(isvfs!=2) { - if (tail[0] == '/') { - if(isvfs!=1) { - root = ""; - } - ++tail; - isunc = 0; + if (tail[0] == '\\') { + root = "/"; + ++tail; + zipfspath=0; } - if (tail[0] == '/') { - if(isvfs!=1) { - root = "/"; - } - ++tail; - isunc = 1; - } - } - i = strlen(root); - j = strlen(tail); - if(isvfs==1) { - if(i>ZIPFS_VOLUME_LEN) { - Tcl_DStringSetLength(dsPtr, i + j + 1); - path = Tcl_DStringValue(dsPtr); - memcpy(path, root, i); - path[i++] = '/'; - memcpy(path + i, tail, j); - } else { - Tcl_DStringSetLength(dsPtr, i + j); - path = Tcl_DStringValue(dsPtr); - memcpy(path, root, i); - memcpy(path + i, tail, j); + if(zipfspath) { +#endif + /* UNC style path */ + if(root && strncmp(root,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN)==0) { + isvfs=1; + } else if (tail && strncmp(tail,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN) == 0) { + isvfs=2; + } + if(isvfs!=1) { + if ((root[0] == '/') && (root[1] == '/')) { + isunc = 1; + } + } +#if HAS_DRIVES } - } else if(isvfs==2) { - Tcl_DStringSetLength(dsPtr, j); - path = Tcl_DStringValue(dsPtr); - memcpy(path, tail, j); - } else { - if (ZIPFSPATH) { - Tcl_DStringSetLength(dsPtr, i + j + ZIPFS_VOLUME_LEN); - path = Tcl_DStringValue(dsPtr); - memcpy(path, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN); - memcpy(path + ZIPFS_VOLUME_LEN + i , tail, j); +#endif + if(isvfs!=2) { + if (tail[0] == '/') { + if(isvfs!=1) { + root = ""; + } + ++tail; + isunc = 0; + } + if (tail[0] == '/') { + if(isvfs!=1) { + root = "/"; + } + ++tail; + isunc = 1; + } + } + i = strlen(root); + j = strlen(tail); + if(isvfs==1) { + if(i>ZIPFS_VOLUME_LEN) { + Tcl_DStringSetLength(dsPtr, i + j + 1); + path = Tcl_DStringValue(dsPtr); + memcpy(path, root, i); + path[i++] = '/'; + memcpy(path + i, tail, j); + } else { + Tcl_DStringSetLength(dsPtr, i + j); + path = Tcl_DStringValue(dsPtr); + memcpy(path, root, i); + memcpy(path + i, tail, j); + } + } else if(isvfs==2) { + Tcl_DStringSetLength(dsPtr, j); + path = Tcl_DStringValue(dsPtr); + memcpy(path, tail, j); } else { - Tcl_DStringSetLength(dsPtr, i + j + 1); - path = Tcl_DStringValue(dsPtr); - memcpy(path, root, i); - path[i++] = '/'; - memcpy(path + i, tail, j); + if (ZIPFSPATH) { + Tcl_DStringSetLength(dsPtr, i + j + ZIPFS_VOLUME_LEN); + path = Tcl_DStringValue(dsPtr); + memcpy(path, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN); + memcpy(path + ZIPFS_VOLUME_LEN + i , tail, j); + } else { + Tcl_DStringSetLength(dsPtr, i + j + 1); + path = Tcl_DStringValue(dsPtr); + memcpy(path, root, i); + path[i++] = '/'; + memcpy(path + i, tail, j); + } } - } #if HAS_DRIVES - for (i = 0; path[i] != '\0'; i++) { - if (path[i] == '\\') { - path[i] = '/'; + for (i = 0; path[i] != '\0'; i++) { + if (path[i] == '\\') { + path[i] = '/'; + } } - } #endif - if(ZIPFSPATH) { - n=ZIPFS_VOLUME_LEN; - } else { - n=0; - } - for (i = j = n; (c = path[i]) != '\0'; i++) { - if (c == '/') { + if(ZIPFSPATH) { + n=ZIPFS_VOLUME_LEN; + } else { + n=0; + } + for (i = j = n; (c = path[i]) != '\0'; i++) { + if (c == '/') { int c2 = path[i + 1]; if (c2 == '/') { - continue; + continue; } if (c2 == '.') { - int c3 = path[i + 2]; - if ((c3 == '/') || (c3 == '\0')) { - i++; - continue; - } - if ((c3 == '.') && - ((path[i + 3] == '/') || (path [i + 3] == '\0'))) { - i += 2; - while ((j > 0) && (path[j - 1] != '/')) { - j--; - } - if (j > isunc) { - --j; - while ((j > 1 + isunc) && (path[j - 2] == '/')) { - j--; - } - } - continue; - } + int c3 = path[i + 2]; + if ((c3 == '/') || (c3 == '\0')) { + i++; + continue; + } + if ((c3 == '.') && + ((path[i + 3] == '/') || (path [i + 3] == '\0'))) { + i += 2; + while ((j > 0) && (path[j - 1] != '/')) { + j--; + } + if (j > isunc) { + --j; + while ((j > 1 + isunc) && (path[j - 2] == '/')) { + j--; + } + } + continue; + } } + } + path[j++] = c; + } + if (j == 0) { + path[j++] = '/'; } - path[j++] = c; - } - if (j == 0) { - path[j++] = '/'; - } - path[j] = 0; - Tcl_DStringSetLength(dsPtr, j); - result=Tcl_DStringValue(dsPtr); - return result; + path[j] = 0; + Tcl_DStringSetLength(dsPtr, j); + result=Tcl_DStringValue(dsPtr); + return result; } @@ -664,14 +664,14 @@ CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr,int ZIPFSPA static ZipEntry * ZipFSLookup(char *filename) { - Tcl_HashEntry *hPtr; - ZipEntry *z; - Tcl_DString ds; - Tcl_DStringInit(&ds); - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, filename); - z = hPtr ? (ZipEntry *) Tcl_GetHashValue(hPtr) : NULL; - Tcl_DStringFree(&ds); - return z; + Tcl_HashEntry *hPtr; + ZipEntry *z; + Tcl_DString ds; + Tcl_DStringInit(&ds); + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, filename); + z = hPtr ? (ZipEntry *) Tcl_GetHashValue(hPtr) : NULL; + Tcl_DStringFree(&ds); + return z; } #ifdef NEVER_USED @@ -696,24 +696,24 @@ ZipFSLookup(char *filename) static int ZipFSLookupMount(char *filename) { - Tcl_HashEntry *hPtr; - Tcl_HashSearch search; - ZipFile *zf; - Tcl_DString ds; - int match = 0; - Tcl_DStringInit(&ds); - hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); - while (hPtr != NULL) { - if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { - if (strcmp(zf->mntpt, filename) == 0) { - match = 1; - break; - } + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + ZipFile *zf; + Tcl_DString ds; + int match = 0; + Tcl_DStringInit(&ds); + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { + if (strcmp(zf->mntpt, filename) == 0) { + match = 1; + break; + } + } + hPtr = Tcl_NextHashEntry(&search); } - hPtr = Tcl_NextHashEntry(&search); - } - Tcl_DStringFree(&ds); - return match; + Tcl_DStringFree(&ds); + return match; } #endif @@ -1003,190 +1003,190 @@ int TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd) { - int i, pwlen, isNew; - ZipFile *zf, zf0; - ZipEntry *z; - Tcl_HashEntry *hPtr; - Tcl_DString ds, fpBuf; - unsigned char *q; - - ReadLock(); - if (!ZipFS.initialized) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("not initialized", -1)); - } - Unlock(); - return TCL_ERROR; - } - if (zipname == NULL) { - Tcl_HashSearch search; - int ret = TCL_OK; + int i, pwlen, isNew; + ZipFile *zf, zf0; + ZipEntry *z; + Tcl_HashEntry *hPtr; + Tcl_DString ds, fpBuf; + unsigned char *q; - i = 0; - hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); - while (hPtr != NULL) { - if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { - if (interp != NULL) { - Tcl_AppendElement(interp, zf->mntpt); - Tcl_AppendElement(interp, zf->name); - } - ++i; - } - hPtr = Tcl_NextHashEntry(&search); + ReadLock(); + if (!ZipFS.initialized) { + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("not initialized", -1)); + } + Unlock(); + return TCL_ERROR; } - if (interp == NULL) { - ret = (i > 0) ? TCL_OK : TCL_BREAK; + if (zipname == NULL) { + Tcl_HashSearch search; + int ret = TCL_OK; + + i = 0; + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { + if (interp != NULL) { + Tcl_AppendElement(interp, zf->mntpt); + Tcl_AppendElement(interp, zf->name); + } + ++i; + } + hPtr = Tcl_NextHashEntry(&search); + } + if (interp == NULL) { + ret = (i > 0) ? TCL_OK : TCL_BREAK; + } + Unlock(); + return ret; } - Unlock(); - return ret; - } - if (mntpt == NULL) { - if (interp == NULL) { + if (mntpt == NULL) { + if (interp == NULL) { Unlock(); return TCL_OK; - } - hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, zipname); - if (hPtr != NULL) { - if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); - } + } + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, zipname); + if (hPtr != NULL) { + if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); + } + } + Unlock(); + return TCL_OK; } Unlock(); - return TCL_OK; - } - Unlock(); - pwlen = 0; - if (passwd != NULL) { - pwlen = strlen(passwd); - if ((pwlen > 255) || (strchr(passwd, 0xff) != NULL)) { + pwlen = 0; + if (passwd != NULL) { + pwlen = strlen(passwd); + if ((pwlen > 255) || (strchr(passwd, 0xff) != NULL)) { if (interp) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("illegal password", -1)); + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal password", -1)); } return TCL_ERROR; + } } - } - if (ZipFSOpenArchive(interp, zipname, 1, &zf0) != TCL_OK) { - return TCL_ERROR; - } - /* - * Mount point can come from Tcl_GetNameOfExecutable() - * which sometimes is a relative or otherwise denormalized path. - * But an absolute name is needed as mount point here. - */ - WriteLock(); - hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, zipname, &isNew); - if (!isNew) { - zf = (ZipFile *) Tcl_GetHashValue(hPtr); - if (interp != NULL) { - Tcl_AppendResult(interp, "already mounted on \"", zf->mntptlen ? - zf->mntpt : "/", "\"", (char *) NULL); - } - Unlock(); - ZipFSCloseArchive(interp, &zf0); - return TCL_ERROR; - } - if (strcmp(mntpt, "/") == 0) { - mntpt = ""; - } - zf = (ZipFile *) Tcl_AttemptAlloc(sizeof (*zf) + strlen(mntpt) + 1); - if (zf == NULL) { - if (interp != NULL) { - Tcl_AppendResult(interp, "out of memory", (char *) NULL); + if (ZipFSOpenArchive(interp, zipname, 1, &zf0) != TCL_OK) { + return TCL_ERROR; } - Unlock(); - ZipFSCloseArchive(interp, &zf0); - return TCL_ERROR; - } - *zf = zf0; - zf->name = Tcl_GetHashKey(&ZipFS.zipHash, hPtr); - strcpy(zf->mntpt, mntpt); - zf->mntptlen = strlen(zf->mntpt); - zf->entries = NULL; - zf->topents = NULL; - zf->nopen = 0; - Tcl_SetHashValue(hPtr, (ClientData) zf); - if ((zf->pwbuf[0] == 0) && pwlen) { - int k = 0; - i = pwlen; - zf->pwbuf[k++] = i; - while (i > 0) { - zf->pwbuf[k] = (passwd[i - 1] & 0x0f) | - pwrot[(passwd[i - 1] >> 4) & 0x0f]; - k++; - i--; - } - zf->pwbuf[k] = '\0'; - } - if (mntpt[0] != '\0') { - z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); - z->name = NULL; - z->tnext = NULL; - z->depth = CountSlashes(mntpt); - z->zipfile = zf; - z->isdir = 1; - z->isenc = 0; - z->offset = zf->baseoffs; - z->crc32 = 0; - z->timestamp = 0; - z->nbyte = z->nbytecompr = 0; - z->cmeth = ZIP_COMPMETH_STORED; - z->data = NULL; - hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, mntpt, &isNew); + /* + * Mount point can come from Tcl_GetNameOfExecutable() + * which sometimes is a relative or otherwise denormalized path. + * But an absolute name is needed as mount point here. + */ + WriteLock(); + hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, zipname, &isNew); if (!isNew) { + zf = (ZipFile *) Tcl_GetHashValue(hPtr); + if (interp != NULL) { + Tcl_AppendResult(interp, "already mounted on \"", zf->mntptlen ? + zf->mntpt : "/", "\"", (char *) NULL); + } + Unlock(); + ZipFSCloseArchive(interp, &zf0); + return TCL_ERROR; + } + if (strcmp(mntpt, "/") == 0) { + mntpt = ""; + } + zf = (ZipFile *) Tcl_AttemptAlloc(sizeof (*zf) + strlen(mntpt) + 1); + if (zf == NULL) { + if (interp != NULL) { + Tcl_AppendResult(interp, "out of memory", (char *) NULL); + } + Unlock(); + ZipFSCloseArchive(interp, &zf0); + return TCL_ERROR; + } + *zf = zf0; + zf->name = Tcl_GetHashKey(&ZipFS.zipHash, hPtr); + strcpy(zf->mntpt, mntpt); + zf->mntptlen = strlen(zf->mntpt); + zf->entries = NULL; + zf->topents = NULL; + zf->nopen = 0; + Tcl_SetHashValue(hPtr, (ClientData) zf); + if ((zf->pwbuf[0] == 0) && pwlen) { + int k = 0; + i = pwlen; + zf->pwbuf[k++] = i; + while (i > 0) { + zf->pwbuf[k] = (passwd[i - 1] & 0x0f) | + pwrot[(passwd[i - 1] >> 4) & 0x0f]; + k++; + i--; + } + zf->pwbuf[k] = '\0'; + } + if (mntpt[0] != '\0') { + z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); + z->name = NULL; + z->tnext = NULL; + z->depth = CountSlashes(mntpt); + z->zipfile = zf; + z->isdir = 1; + z->isenc = 0; + z->offset = zf->baseoffs; + z->crc32 = 0; + z->timestamp = 0; + z->nbyte = z->nbytecompr = 0; + z->cmeth = ZIP_COMPMETH_STORED; + z->data = NULL; + hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, mntpt, &isNew); + if (!isNew) { /* skip it */ Tcl_Free((char *) z); - } else { + } else { Tcl_SetHashValue(hPtr, (ClientData) z); z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); z->next = zf->entries; zf->entries = z; + } } - } - q = zf->data + zf->centoffs; - Tcl_DStringInit(&fpBuf); - Tcl_DStringInit(&ds); - for (i = 0; i < zf->nfiles; i++) { - int pathlen, comlen, extra, isdir = 0, dosTime, dosDate, nbcompr, offs; - unsigned char *lq, *gq = NULL; - char *fullpath, *path; - - pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); - comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); - extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); - Tcl_DStringSetLength(&ds, 0); - Tcl_DStringAppend(&ds, (char *) q + ZIP_CENTRAL_HEADER_LEN, pathlen); - path = Tcl_DStringValue(&ds); - if ((pathlen > 0) && (path[pathlen - 1] == '/')) { + q = zf->data + zf->centoffs; + Tcl_DStringInit(&fpBuf); + Tcl_DStringInit(&ds); + for (i = 0; i < zf->nfiles; i++) { + int pathlen, comlen, extra, isdir = 0, dosTime, dosDate, nbcompr, offs; + unsigned char *lq, *gq = NULL; + char *fullpath, *path; + + pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); + comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); + extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); + Tcl_DStringSetLength(&ds, 0); + Tcl_DStringAppend(&ds, (char *) q + ZIP_CENTRAL_HEADER_LEN, pathlen); + path = Tcl_DStringValue(&ds); + if ((pathlen > 0) && (path[pathlen - 1] == '/')) { Tcl_DStringSetLength(&ds, pathlen - 1); path = Tcl_DStringValue(&ds); isdir = 1; - } - if ((strcmp(path, ".") == 0) || (strcmp(path, "..") == 0)) { + } + if ((strcmp(path, ".") == 0) || (strcmp(path, "..") == 0)) { goto nextent; - } - lq = zf->data + zf->baseoffs + - zip_read_int(q + ZIP_CENTRAL_LOCALHDR_OFFS); - if ((lq < zf->data) || (lq > (zf->data + zf->length))) { + } + lq = zf->data + zf->baseoffs + + zip_read_int(q + ZIP_CENTRAL_LOCALHDR_OFFS); + if ((lq < zf->data) || (lq > (zf->data + zf->length))) { goto nextent; - } - nbcompr = zip_read_int(lq + ZIP_LOCAL_COMPLEN_OFFS); - if (!isdir && (nbcompr == 0) && - (zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS) == 0) && - (zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS) == 0)) { + } + nbcompr = zip_read_int(lq + ZIP_LOCAL_COMPLEN_OFFS); + if (!isdir && (nbcompr == 0) && + (zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS) == 0) && + (zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS) == 0)) { gq = q; nbcompr = zip_read_int(gq + ZIP_CENTRAL_COMPLEN_OFFS); - } - offs = (lq - zf->data) - + ZIP_LOCAL_HEADER_LEN - + zip_read_short(lq + ZIP_LOCAL_PATHLEN_OFFS) - + zip_read_short(lq + ZIP_LOCAL_EXTRALEN_OFFS); - if ((offs + nbcompr) > zf->length) { + } + offs = (lq - zf->data) + + ZIP_LOCAL_HEADER_LEN + + zip_read_short(lq + ZIP_LOCAL_PATHLEN_OFFS) + + zip_read_short(lq + ZIP_LOCAL_EXTRALEN_OFFS); + if ((offs + nbcompr) > zf->length) { goto nextent; - } - if (!isdir && (mntpt[0] == '\0') && !CountSlashes(path)) { + } + if (!isdir && (mntpt[0] == '\0') && !CountSlashes(path)) { #ifdef ANDROID /* * When mounting the ZIP archive on the root directory try @@ -1204,117 +1204,117 @@ TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, Tcl_DStringAppend(&ds2, path, -1); hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, Tcl_DStringValue(&ds2)); if (hPtr != NULL) { - /* should not happen but skip it anyway */ - Tcl_DStringFree(&ds2); - goto nextent; + /* should not happen but skip it anyway */ + Tcl_DStringFree(&ds2); + goto nextent; } Tcl_DStringSetLength(&ds, 0); Tcl_DStringAppend(&ds, Tcl_DStringValue(&ds2), - Tcl_DStringLength(&ds2)); + Tcl_DStringLength(&ds2)); path = Tcl_DStringValue(&ds); Tcl_DStringFree(&ds2); #else - /* - * Regular files skipped when mounting on root. - */ - goto nextent; + /* + * Regular files skipped when mounting on root. + */ + goto nextent; #endif - } - Tcl_DStringSetLength(&fpBuf, 0); - fullpath = CanonicalPath(mntpt, path, &fpBuf, 1); - z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); - z->name = NULL; - z->tnext = NULL; - z->depth = CountSlashes(fullpath); - z->zipfile = zf; - z->isdir = isdir; - z->isenc = (zip_read_short(lq + ZIP_LOCAL_FLAGS_OFFS) & 1) + } + Tcl_DStringSetLength(&fpBuf, 0); + fullpath = CanonicalPath(mntpt, path, &fpBuf, 1); + z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); + z->name = NULL; + z->tnext = NULL; + z->depth = CountSlashes(fullpath); + z->zipfile = zf; + z->isdir = isdir; + z->isenc = (zip_read_short(lq + ZIP_LOCAL_FLAGS_OFFS) & 1) && (nbcompr > 12); - z->offset = offs; - if (gq != NULL) { + z->offset = offs; + if (gq != NULL) { z->crc32 = zip_read_int(gq + ZIP_CENTRAL_CRC32_OFFS); dosDate = zip_read_short(gq + ZIP_CENTRAL_MDATE_OFFS); dosTime = zip_read_short(gq + ZIP_CENTRAL_MTIME_OFFS); z->timestamp = DosTimeDate(dosDate, dosTime); z->nbyte = zip_read_int(gq + ZIP_CENTRAL_UNCOMPLEN_OFFS); z->cmeth = zip_read_short(gq + ZIP_CENTRAL_COMPMETH_OFFS); - } else { + } else { z->crc32 = zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS); dosDate = zip_read_short(lq + ZIP_LOCAL_MDATE_OFFS); dosTime = zip_read_short(lq + ZIP_LOCAL_MTIME_OFFS); z->timestamp = DosTimeDate(dosDate, dosTime); z->nbyte = zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS); z->cmeth = zip_read_short(lq + ZIP_LOCAL_COMPMETH_OFFS); - } - z->nbytecompr = nbcompr; - z->data = NULL; - hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, fullpath, &isNew); - if (!isNew) { + } + z->nbytecompr = nbcompr; + z->data = NULL; + hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, fullpath, &isNew); + if (!isNew) { /* should not happen but skip it anyway */ Tcl_Free((char *) z); - } else { + } else { Tcl_SetHashValue(hPtr, (ClientData) z); z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); z->next = zf->entries; zf->entries = z; if (isdir && (mntpt[0] == '\0') && (z->depth == 1)) { - z->tnext = zf->topents; - zf->topents = z; + z->tnext = zf->topents; + zf->topents = z; } if (!z->isdir && (z->depth > 1)) { - char *dir, *end; - ZipEntry *zd; - - Tcl_DStringSetLength(&ds, strlen(z->name) + 8); - Tcl_DStringSetLength(&ds, 0); - Tcl_DStringAppend(&ds, z->name, -1); - dir = Tcl_DStringValue(&ds); - end = strrchr(dir, '/'); - while ((end != NULL) && (end != dir)) { - Tcl_DStringSetLength(&ds, end - dir); - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, dir); - if (hPtr != NULL) { - break; - } - zd = (ZipEntry *) Tcl_Alloc(sizeof (*zd)); - zd->name = NULL; - zd->tnext = NULL; - zd->depth = CountSlashes(dir); - zd->zipfile = zf; - zd->isdir = 1; - zd->isenc = 0; - zd->offset = z->offset; - zd->crc32 = 0; - zd->timestamp = z->timestamp; - zd->nbyte = zd->nbytecompr = 0; - zd->cmeth = ZIP_COMPMETH_STORED; - zd->data = NULL; - hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, dir, &isNew); - if (!isNew) { - /* should not happen but skip it anyway */ - Tcl_Free((char *) zd); - } else { - Tcl_SetHashValue(hPtr, (ClientData) zd); - zd->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); - zd->next = zf->entries; - zf->entries = zd; - if ((mntpt[0] == '\0') && (zd->depth == 1)) { - zd->tnext = zf->topents; - zf->topents = zd; - } - } - end = strrchr(dir, '/'); - } + char *dir, *end; + ZipEntry *zd; + + Tcl_DStringSetLength(&ds, strlen(z->name) + 8); + Tcl_DStringSetLength(&ds, 0); + Tcl_DStringAppend(&ds, z->name, -1); + dir = Tcl_DStringValue(&ds); + end = strrchr(dir, '/'); + while ((end != NULL) && (end != dir)) { + Tcl_DStringSetLength(&ds, end - dir); + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, dir); + if (hPtr != NULL) { + break; + } + zd = (ZipEntry *) Tcl_Alloc(sizeof (*zd)); + zd->name = NULL; + zd->tnext = NULL; + zd->depth = CountSlashes(dir); + zd->zipfile = zf; + zd->isdir = 1; + zd->isenc = 0; + zd->offset = z->offset; + zd->crc32 = 0; + zd->timestamp = z->timestamp; + zd->nbyte = zd->nbytecompr = 0; + zd->cmeth = ZIP_COMPMETH_STORED; + zd->data = NULL; + hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, dir, &isNew); + if (!isNew) { + /* should not happen but skip it anyway */ + Tcl_Free((char *) zd); + } else { + Tcl_SetHashValue(hPtr, (ClientData) zd); + zd->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); + zd->next = zf->entries; + zf->entries = zd; + if ((mntpt[0] == '\0') && (zd->depth == 1)) { + zd->tnext = zf->topents; + zf->topents = zd; + } + } + end = strrchr(dir, '/'); + } } - } + } nextent: - q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; - } - Unlock(); - Tcl_DStringFree(&fpBuf); - Tcl_DStringFree(&ds); - Tcl_FSMountsChanged(NULL); - return TCL_OK; + q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; + } + Unlock(); + Tcl_DStringFree(&fpBuf); + Tcl_DStringFree(&ds); + Tcl_FSMountsChanged(NULL); + return TCL_OK; } /* @@ -1336,53 +1336,53 @@ nextent: int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) { - ZipFile *zf; - ZipEntry *z, *znext; - Tcl_HashEntry *hPtr; - Tcl_DString ds; - int ret = TCL_OK, unmounted = 0; - - Tcl_DStringInit(&ds); - WriteLock(); - if (!ZipFS.initialized) { - goto done; - } - hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, zipname); - if (hPtr == NULL) { - /* don't report error */ - goto done; - } - zf = (ZipFile *) Tcl_GetHashValue(hPtr); - if (zf->nopen > 0) { - if (interp != NULL) { + ZipFile *zf; + ZipEntry *z, *znext; + Tcl_HashEntry *hPtr; + Tcl_DString ds; + int ret = TCL_OK, unmounted = 0; + + Tcl_DStringInit(&ds); + WriteLock(); + if (!ZipFS.initialized) { + goto done; + } + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, zipname); + if (hPtr == NULL) { + /* don't report error */ + goto done; + } + zf = (ZipFile *) Tcl_GetHashValue(hPtr); + if (zf->nopen > 0) { + if (interp != NULL) { Tcl_SetObjResult(interp, - Tcl_NewStringObj("filesystem is busy", -1)); + Tcl_NewStringObj("filesystem is busy", -1)); + } + ret = TCL_ERROR; + goto done; } - ret = TCL_ERROR; - goto done; - } - Tcl_DeleteHashEntry(hPtr); - for (z = zf->entries; z; z = znext) { - znext = z->next; - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, z->name); - if (hPtr) { + Tcl_DeleteHashEntry(hPtr); + for (z = zf->entries; z; z = znext) { + znext = z->next; + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, z->name); + if (hPtr) { Tcl_DeleteHashEntry(hPtr); - } - if (z->data != NULL) { + } + if (z->data != NULL) { Tcl_Free((char *) z->data); + } + Tcl_Free((char *) z); } - Tcl_Free((char *) z); - } - ZipFSCloseArchive(interp, zf); - Tcl_Free((char *) zf); - unmounted = 1; + ZipFSCloseArchive(interp, zf); + Tcl_Free((char *) zf); + unmounted = 1; done: - Unlock(); - Tcl_DStringFree(&ds); - if (unmounted) { - Tcl_FSMountsChanged(NULL); - } - return ret; + Unlock(); + Tcl_DStringFree(&ds); + if (unmounted) { + Tcl_FSMountsChanged(NULL); + } + return ret; } /* @@ -2186,34 +2186,34 @@ static int ZipFSCanonicalObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - char *mntpoint=NULL; - char *filename=NULL; - char *result; - Tcl_DString dPath; + char *mntpoint=NULL; + char *filename=NULL; + char *result; + Tcl_DString dPath; - if (objc != 2 && objc != 3 && objc!=4) { - Tcl_WrongNumArgs(interp, 1, objv, "?mntpnt? filename ?ZIPFS?"); - return TCL_ERROR; - } - Tcl_DStringInit(&dPath); - if(objc==2) { - filename = Tcl_GetString(objv[1]); - result=CanonicalPath("",filename,&dPath,1); - } else if (objc==3) { - mntpoint = Tcl_GetString(objv[1]); - filename = Tcl_GetString(objv[2]); - result=CanonicalPath(mntpoint,filename,&dPath,1); - } else { - int zipfs=0; - if(Tcl_GetBooleanFromObj(interp,objv[3],&zipfs)) { - return TCL_ERROR; + if (objc != 2 && objc != 3 && objc!=4) { + Tcl_WrongNumArgs(interp, 1, objv, "?mntpnt? filename ?ZIPFS?"); + return TCL_ERROR; + } + Tcl_DStringInit(&dPath); + if(objc==2) { + filename = Tcl_GetString(objv[1]); + result=CanonicalPath("",filename,&dPath,1); + } else if (objc==3) { + mntpoint = Tcl_GetString(objv[1]); + filename = Tcl_GetString(objv[2]); + result=CanonicalPath(mntpoint,filename,&dPath,1); + } else { + int zipfs=0; + if(Tcl_GetBooleanFromObj(interp,objv[3],&zipfs)) { + return TCL_ERROR; + } + mntpoint = Tcl_GetString(objv[1]); + filename = Tcl_GetString(objv[2]); + result=CanonicalPath(mntpoint,filename,&dPath,zipfs); } - mntpoint = Tcl_GetString(objv[1]); - filename = Tcl_GetString(objv[2]); - result=CanonicalPath(mntpoint,filename,&dPath,zipfs); - } - Tcl_SetObjResult(interp,Tcl_NewStringObj(result,-1)); - return TCL_OK; + Tcl_SetObjResult(interp,Tcl_NewStringObj(result,-1)); + return TCL_OK; } /* @@ -3210,154 +3210,154 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, Tcl_Obj *pathPtr, const char *pattern, Tcl_GlobTypeData *types) { - Tcl_HashEntry *hPtr; - Tcl_HashSearch search; - Tcl_Obj *normPathPtr; - int scnt, len, l, dirOnly = -1, prefixLen, strip = 0; - char *pat, *prefix, *path; - Tcl_DString dsPref; - - if (!(normPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; - - if (types != NULL) { - dirOnly = (types->type & TCL_GLOB_TYPE_DIR) == TCL_GLOB_TYPE_DIR; - } - - /* the prefix that gets prepended to results */ - prefix = Tcl_GetStringFromObj(pathPtr, &prefixLen); - - /* the (normalized) path we're searching */ - path = Tcl_GetStringFromObj(normPathPtr, &len); - - Tcl_DStringInit(&dsPref); - Tcl_DStringAppend(&dsPref, prefix, prefixLen); - - if (strcmp(prefix, path) == 0) { - prefix = NULL; - } else { - strip = len + 1; - } - if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, "/", 1); - prefixLen++; - prefix = Tcl_DStringValue(&dsPref); - } - ReadLock(); - if ((types != NULL) && (types->type == TCL_GLOB_TYPE_MOUNT)) { - l = CountSlashes(path); - if (path[len - 1] == '/') { - len--; + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + Tcl_Obj *normPathPtr; + int scnt, len, l, dirOnly = -1, prefixLen, strip = 0; + char *pat, *prefix, *path; + Tcl_DString dsPref; + + if (!(normPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; + + if (types != NULL) { + dirOnly = (types->type & TCL_GLOB_TYPE_DIR) == TCL_GLOB_TYPE_DIR; + } + + /* the prefix that gets prepended to results */ + prefix = Tcl_GetStringFromObj(pathPtr, &prefixLen); + + /* the (normalized) path we're searching */ + path = Tcl_GetStringFromObj(normPathPtr, &len); + + Tcl_DStringInit(&dsPref); + Tcl_DStringAppend(&dsPref, prefix, prefixLen); + + if (strcmp(prefix, path) == 0) { + prefix = NULL; } else { - l++; + strip = len + 1; } - if ((pattern == NULL) || (pattern[0] == '\0')) { - pattern = "*"; + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, "/", 1); + prefixLen++; + prefix = Tcl_DStringValue(&dsPref); } - hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); - while (hPtr != NULL) { + ReadLock(); + if ((types != NULL) && (types->type == TCL_GLOB_TYPE_MOUNT)) { + l = CountSlashes(path); + if (path[len - 1] == '/') { + len--; + } else { + l++; + } + if ((pattern == NULL) || (pattern[0] == '\0')) { + pattern = "*"; + } + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { ZipFile *zf = (ZipFile *) Tcl_GetHashValue(hPtr); if (zf->mntptlen == 0) { - ZipEntry *z = zf->topents; - while (z != NULL) { - int lenz = strlen(z->name); - if ((lenz > len + 1) && - (strncmp(z->name, path, len) == 0) && - (z->name[len] == '/') && - (CountSlashes(z->name) == l) && - Tcl_StringCaseMatch(z->name + len + 1, pattern, 0)) { - if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, z->name, lenz); - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(Tcl_DStringValue(&dsPref), - Tcl_DStringLength(&dsPref))); - Tcl_DStringSetLength(&dsPref, prefixLen); - } else { - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(z->name, lenz)); - } - } - z = z->tnext; - } + ZipEntry *z = zf->topents; + while (z != NULL) { + int lenz = strlen(z->name); + if ((lenz > len + 1) && + (strncmp(z->name, path, len) == 0) && + (z->name[len] == '/') && + (CountSlashes(z->name) == l) && + Tcl_StringCaseMatch(z->name + len + 1, pattern, 0)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, z->name, lenz); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(z->name, lenz)); + } + } + z = z->tnext; + } } else if ((zf->mntptlen > len + 1) && - (strncmp(zf->mntpt, path, len) == 0) && - (zf->mntpt[len] == '/') && - (CountSlashes(zf->mntpt) == l) && - Tcl_StringCaseMatch(zf->mntpt + len + 1, pattern, 0)) { - if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, zf->mntpt, zf->mntptlen); - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(Tcl_DStringValue(&dsPref), - Tcl_DStringLength(&dsPref))); - Tcl_DStringSetLength(&dsPref, prefixLen); - } else { - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); - } + (strncmp(zf->mntpt, path, len) == 0) && + (zf->mntpt[len] == '/') && + (CountSlashes(zf->mntpt) == l) && + Tcl_StringCaseMatch(zf->mntpt + len + 1, pattern, 0)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, zf->mntpt, zf->mntptlen); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); + } } hPtr = Tcl_NextHashEntry(&search); + } + goto end; } - goto end; - } - if ((pattern == NULL) || (pattern[0] == '\0')) { - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path); - if (hPtr != NULL) { + if ((pattern == NULL) || (pattern[0] == '\0')) { + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path); + if (hPtr != NULL) { ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); if ((dirOnly < 0) || - (!dirOnly && !z->isdir) || - (dirOnly && z->isdir)) { - if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, z->name, -1); - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(Tcl_DStringValue(&dsPref), - Tcl_DStringLength(&dsPref))); - Tcl_DStringSetLength(&dsPref, prefixLen); - } else { - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(z->name, -1)); - } + (!dirOnly && !z->isdir) || + (dirOnly && z->isdir)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, z->name, -1); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(z->name, -1)); + } } - } - goto end; - } - l = strlen(pattern); - pat = Tcl_Alloc(len + l + 2); - memcpy(pat, path, len); - while ((len > 1) && (pat[len - 1] == '/')) { - --len; - } - if ((len > 1) || (pat[0] != '/')) { - pat[len] = '/'; - ++len; - } - memcpy(pat + len, pattern, l + 1); - scnt = CountSlashes(pat); - for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); - hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); - if ((dirOnly >= 0) && - ((dirOnly && !z->isdir) || (!dirOnly && z->isdir))) { + } + goto end; + } + l = strlen(pattern); + pat = Tcl_Alloc(len + l + 2); + memcpy(pat, path, len); + while ((len > 1) && (pat[len - 1] == '/')) { + --len; + } + if ((len > 1) || (pat[0] != '/')) { + pat[len] = '/'; + ++len; + } + memcpy(pat + len, pattern, l + 1); + scnt = CountSlashes(pat); + for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + if ((dirOnly >= 0) && + ((dirOnly && !z->isdir) || (!dirOnly && z->isdir))) { continue; - } - if ((z->depth == scnt) && Tcl_StringCaseMatch(z->name, pat, 0)) { + } + if ((z->depth == scnt) && Tcl_StringCaseMatch(z->name, pat, 0)) { if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, z->name + strip, -1); - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(Tcl_DStringValue(&dsPref), - Tcl_DStringLength(&dsPref))); - Tcl_DStringSetLength(&dsPref, prefixLen); + Tcl_DStringAppend(&dsPref, z->name + strip, -1); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); } else { - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(z->name + strip, -1)); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(z->name + strip, -1)); } + } } - } - Tcl_Free(pat); + Tcl_Free(pat); end: - Unlock(); - Tcl_DStringFree(&dsPref); - return TCL_OK; + Unlock(); + Tcl_DStringFree(&dsPref); + return TCL_OK; } /* @@ -3445,7 +3445,7 @@ endloop: */ static Tcl_Obj * Zip_FSListVolumesProc(void) { - return Tcl_NewStringObj(ZIPFS_VOLUME, -1); + return Tcl_NewStringObj(ZIPFS_VOLUME, -1); } /* -- cgit v0.12 From 7c1f63bb60215a26625aa1f5a7ad3074d83d4898 Mon Sep 17 00:00:00 2001 From: aspect Date: Fri, 17 Nov 2017 10:24:45 +0000 Subject: clean up stray unused dstrings --- generic/tclZipfs.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 5aa001f..38abf0e 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -699,9 +699,7 @@ ZipFSLookupMount(char *filename) Tcl_HashEntry *hPtr; Tcl_HashSearch search; ZipFile *zf; - Tcl_DString ds; int match = 0; - Tcl_DStringInit(&ds); hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); while (hPtr != NULL) { if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { @@ -712,7 +710,6 @@ ZipFSLookupMount(char *filename) } hPtr = Tcl_NextHashEntry(&search); } - Tcl_DStringFree(&ds); return match; } #endif @@ -1339,10 +1336,8 @@ TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) ZipFile *zf; ZipEntry *z, *znext; Tcl_HashEntry *hPtr; - Tcl_DString ds; int ret = TCL_OK, unmounted = 0; - Tcl_DStringInit(&ds); WriteLock(); if (!ZipFS.initialized) { goto done; @@ -1378,7 +1373,6 @@ TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) unmounted = 1; done: Unlock(); - Tcl_DStringFree(&ds); if (unmounted) { Tcl_FSMountsChanged(NULL); } -- cgit v0.12 From 42236b435fc3744a44500a2a63fd951f3c377afc Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 17 Nov 2017 11:35:26 +0000 Subject: Fix ignore-glob versioned setting (something went wrong in previous merge). Also convert rules-ext.vc and targets.vc to CRLF line-endings. --- .fossil-settings/crlf-glob | 2 + .fossil-settings/crnl-glob | 2 + .fossil-settings/ignore-glob | 3 +- win/rules-ext.vc | 216 +++++++++++++++++++++---------------------- win/targets.vc | 104 ++++++++++----------- 5 files changed, 166 insertions(+), 161 deletions(-) diff --git a/.fossil-settings/crlf-glob b/.fossil-settings/crlf-glob index 2041cb6..56f3a03 100644 --- a/.fossil-settings/crlf-glob +++ b/.fossil-settings/crlf-glob @@ -12,6 +12,8 @@ win/buildall.vc.bat win/coffbase.txt win/makefile.vc win/rules.vc +win/rules-ext.vc +win/targets.vc win/tcl.dsp win/tcl.dsw win/tcl.hpj.in \ No newline at end of file diff --git a/.fossil-settings/crnl-glob b/.fossil-settings/crnl-glob index 2041cb6..56f3a03 100644 --- a/.fossil-settings/crnl-glob +++ b/.fossil-settings/crnl-glob @@ -12,6 +12,8 @@ win/buildall.vc.bat win/coffbase.txt win/makefile.vc win/rules.vc +win/rules-ext.vc +win/targets.vc win/tcl.dsp win/tcl.dsw win/tcl.hpj.in \ No newline at end of file diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob index d5c9a1e..c85b488 100644 --- a/.fossil-settings/ignore-glob +++ b/.fossil-settings/ignore-glob @@ -44,4 +44,5 @@ unix/pkgs/* win/Debug* win/Release* win/pkgs/* -win/tcl.hpjwin/nmhlp-out.txt +win/tcl.hpj +win/nmhlp-out.txt diff --git a/win/rules-ext.vc b/win/rules-ext.vc index abaaed6..3aba80d 100644 --- a/win/rules-ext.vc +++ b/win/rules-ext.vc @@ -1,109 +1,109 @@ -# This file should only be included in makefiles for Tcl extensions, -# NOT in the makefile for Tcl itself. - -!ifndef _RULES_EXT_VC - -# We need to run from the directory the parent makefile is located in. -# nmake does not tell us what makefile was used to invoke it so parent -# makefile has to set the MAKEFILEVC macro or we just make a guess and -# warn if we think that is not the case. -!if "$(MAKEFILEVC)" == "" - -!if exist("$(PROJECT).vc") -MAKEFILEVC = $(PROJECT).vc -!elseif exist("makefile.vc") -MAKEFILEVC = makefile.vc -!endif -!endif # "$(MAKEFILEVC)" == "" - -!if !exist("$(MAKEFILEVC)") -MSG = ^ -You must run nmake from the directory containing the project makefile.^ -If you are doing that and getting this message, set the MAKEFILEVC^ -macro to the name of the project makefile. -!message WARNING: $(MSG) -!endif - -!if "$(PROJECT)" == "tcl" -!error The rules-ext.vc file is not intended for Tcl itself. -!endif - -# First locate the Tcl directory that we are working with. -!ifdef TCLDIR - -_RULESDIR = $(TCLDIR:/=\) - -!else - -# If an installation path is specified, that is also the Tcl directory. -# Also, tk never builds against an installed Tcl, it needs Tcl sources -!if defined(INSTALLDIR) && "$(PROJECT)" != "tk" -_RULESDIR=$(INSTALLDIR:/=\) -!else -_RULESDIR = ..\..\tcl -!endif - -!endif # ifndef TCLDIR - -# Now look for the targets.vc file under the Tcl root. Note we check this -# file and not rules.vc because the latter also exists on older systems. -!if exist("$(_RULESDIR)\lib\nmake\targets.vc") # Building against installed Tcl -_RULESDIR = $(_RULESDIR)\lib\nmake -!elseif exist("$(_RULESDIR)\win\targets.vc") # Building against Tcl sources -_RULESDIR = $(_RULESDIR)\win -!else -# If we have not located Tcl's targets file, most likely we are compiling -# against an older version of Tcl and so must use our own support files. -_RULESDIR = . -!endif - -!if "$(_RULESDIR)" != "." -# Potentially using Tcl's support files. If this extension has its own -# nmake support files, need to compare the versions and pick newer. - -!if exist("rules.vc") # The extension has its own copy - -# We extract version numbers using the nmakehlp program. -!if [$(CC) -nologo "$(_RULESDIR)\nmakehlp.c" -link -subsystem:console > nul] -!endif - -!if [echo TCL_RULES_MAJOR = \> versions.vc] \ - && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MAJOR >> versions.vc] -!endif -!if [echo TCL_RULES_MINOR = \>> versions.vc] \ - && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MINOR >> versions.vc] -!endif - -!if [echo OUR_RULES_MAJOR = \>> versions.vc] \ - && [nmakehlp -V "rules.vc" RULES_VERSION_MAJOR >> versions.vc] -!endif -!if [echo OUR_RULES_MINOR = \>> versions.vc] \ - && [nmakehlp -V "rules.vc" RULES_VERSION_MINOR >> versions.vc] -!endif -!include versions.vc -# We have a newer version of the support files, use them -!if ($(TCL_RULES_MAJOR) != $(OUR_RULES_MAJOR)) || ($(TCL_RULES_MINOR) < $(OUR_RULES_MINOR)) -_RULESDIR = . -!endif - -!endif # if exist("rules.vc") - -!endif # if $(_RULESDIR) != "." - -# Let rules.vc know what copy of nmakehlp.c to use. -NMAKEHLPC = $(_RULESDIR)\nmakehlp.c - -# Get rid of our internal defines before calling rules.vc -!undef TCL_RULES_MAJOR -!undef TCL_RULES_MINOR -!undef OUR_RULES_MAJOR -!undef OUR_RULES_MINOR - -!if exist("$(_RULESDIR)\rules.vc") -!message *** Using $(_RULESDIR)\rules.vc -!include "$(_RULESDIR)\rules.vc" -!else -!error *** Could not locate rules.vc in $(_RULESDIR) -!endif - +# This file should only be included in makefiles for Tcl extensions, +# NOT in the makefile for Tcl itself. + +!ifndef _RULES_EXT_VC + +# We need to run from the directory the parent makefile is located in. +# nmake does not tell us what makefile was used to invoke it so parent +# makefile has to set the MAKEFILEVC macro or we just make a guess and +# warn if we think that is not the case. +!if "$(MAKEFILEVC)" == "" + +!if exist("$(PROJECT).vc") +MAKEFILEVC = $(PROJECT).vc +!elseif exist("makefile.vc") +MAKEFILEVC = makefile.vc +!endif +!endif # "$(MAKEFILEVC)" == "" + +!if !exist("$(MAKEFILEVC)") +MSG = ^ +You must run nmake from the directory containing the project makefile.^ +If you are doing that and getting this message, set the MAKEFILEVC^ +macro to the name of the project makefile. +!message WARNING: $(MSG) +!endif + +!if "$(PROJECT)" == "tcl" +!error The rules-ext.vc file is not intended for Tcl itself. +!endif + +# First locate the Tcl directory that we are working with. +!ifdef TCLDIR + +_RULESDIR = $(TCLDIR:/=\) + +!else + +# If an installation path is specified, that is also the Tcl directory. +# Also, tk never builds against an installed Tcl, it needs Tcl sources +!if defined(INSTALLDIR) && "$(PROJECT)" != "tk" +_RULESDIR=$(INSTALLDIR:/=\) +!else +_RULESDIR = ..\..\tcl +!endif + +!endif # ifndef TCLDIR + +# Now look for the targets.vc file under the Tcl root. Note we check this +# file and not rules.vc because the latter also exists on older systems. +!if exist("$(_RULESDIR)\lib\nmake\targets.vc") # Building against installed Tcl +_RULESDIR = $(_RULESDIR)\lib\nmake +!elseif exist("$(_RULESDIR)\win\targets.vc") # Building against Tcl sources +_RULESDIR = $(_RULESDIR)\win +!else +# If we have not located Tcl's targets file, most likely we are compiling +# against an older version of Tcl and so must use our own support files. +_RULESDIR = . +!endif + +!if "$(_RULESDIR)" != "." +# Potentially using Tcl's support files. If this extension has its own +# nmake support files, need to compare the versions and pick newer. + +!if exist("rules.vc") # The extension has its own copy + +# We extract version numbers using the nmakehlp program. +!if [$(CC) -nologo "$(_RULESDIR)\nmakehlp.c" -link -subsystem:console > nul] +!endif + +!if [echo TCL_RULES_MAJOR = \> versions.vc] \ + && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MAJOR >> versions.vc] +!endif +!if [echo TCL_RULES_MINOR = \>> versions.vc] \ + && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MINOR >> versions.vc] +!endif + +!if [echo OUR_RULES_MAJOR = \>> versions.vc] \ + && [nmakehlp -V "rules.vc" RULES_VERSION_MAJOR >> versions.vc] +!endif +!if [echo OUR_RULES_MINOR = \>> versions.vc] \ + && [nmakehlp -V "rules.vc" RULES_VERSION_MINOR >> versions.vc] +!endif +!include versions.vc +# We have a newer version of the support files, use them +!if ($(TCL_RULES_MAJOR) != $(OUR_RULES_MAJOR)) || ($(TCL_RULES_MINOR) < $(OUR_RULES_MINOR)) +_RULESDIR = . +!endif + +!endif # if exist("rules.vc") + +!endif # if $(_RULESDIR) != "." + +# Let rules.vc know what copy of nmakehlp.c to use. +NMAKEHLPC = $(_RULESDIR)\nmakehlp.c + +# Get rid of our internal defines before calling rules.vc +!undef TCL_RULES_MAJOR +!undef TCL_RULES_MINOR +!undef OUR_RULES_MAJOR +!undef OUR_RULES_MINOR + +!if exist("$(_RULESDIR)\rules.vc") +!message *** Using $(_RULESDIR)\rules.vc +!include "$(_RULESDIR)\rules.vc" +!else +!error *** Could not locate rules.vc in $(_RULESDIR) +!endif + !endif # _RULES_EXT_VC \ No newline at end of file diff --git a/win/targets.vc b/win/targets.vc index dd76908..ca227d8 100644 --- a/win/targets.vc +++ b/win/targets.vc @@ -1,52 +1,52 @@ -#------------------------------------------------------------- -*- makefile -*- -# targets.vc -- -# -# Part of the nmake based build system for Tcl and its extensions. -# This file defines some standard targets for the convenience of extensions -# and can be optionally included by the extension makefile. -# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for docs. - -$(PROJECT): setup pkgindex $(PRJLIB) - -!ifdef PRJ_STUBOBJS -$(PROJECT): $(PRJSTUBLIB) -$(PRJSTUBLIB): $(PRJ_STUBOBJS) - $(LIBCMD) $** - -$(PRJ_STUBOBJS): - $(CCSTUBSCMD) %s -!endif # PRJ_STUBOBJS - -!ifdef PRJ_MANIFEST -$(PROJECT): $(PRJLIB).manifest -$(PRJLIB).manifest: $(PRJ_MANIFEST) - @nmakehlp -s << $** >$@ -@MACHINE@ $(MACHINE:IX86=X86) -<< -!endif - -!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk" -$(PRJLIB): $(PRJ_OBJS) $(RESFILE) -!if $(STATIC_BUILD) - $(LIBCMD) $** -!else - $(DLLCMD) $** - $(_VC_MANIFEST_EMBED_DLL) -!endif - -@del $*.exp -!endif - -!ifndef DISABLE_STANDARD_TARGETS -DISABLE_STANDARD_TARGETS = 0 -!endif - -!if !$(DISABLE_STANDARD_TARGETS) -setup: default-setup -install: default-install -clean: default-clean -realclean: hose -hose: default-hose -distclean: realclean default-distclean -test: default-test -shell: default-shell -!endif +#------------------------------------------------------------- -*- makefile -*- +# targets.vc -- +# +# Part of the nmake based build system for Tcl and its extensions. +# This file defines some standard targets for the convenience of extensions +# and can be optionally included by the extension makefile. +# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for docs. + +$(PROJECT): setup pkgindex $(PRJLIB) + +!ifdef PRJ_STUBOBJS +$(PROJECT): $(PRJSTUBLIB) +$(PRJSTUBLIB): $(PRJ_STUBOBJS) + $(LIBCMD) $** + +$(PRJ_STUBOBJS): + $(CCSTUBSCMD) %s +!endif # PRJ_STUBOBJS + +!ifdef PRJ_MANIFEST +$(PROJECT): $(PRJLIB).manifest +$(PRJLIB).manifest: $(PRJ_MANIFEST) + @nmakehlp -s << $** >$@ +@MACHINE@ $(MACHINE:IX86=X86) +<< +!endif + +!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk" +$(PRJLIB): $(PRJ_OBJS) $(RESFILE) +!if $(STATIC_BUILD) + $(LIBCMD) $** +!else + $(DLLCMD) $** + $(_VC_MANIFEST_EMBED_DLL) +!endif + -@del $*.exp +!endif + +!ifndef DISABLE_STANDARD_TARGETS +DISABLE_STANDARD_TARGETS = 0 +!endif + +!if !$(DISABLE_STANDARD_TARGETS) +setup: default-setup +install: default-install +clean: default-clean +realclean: hose +hose: default-hose +distclean: realclean default-distclean +test: default-test +shell: default-shell +!endif -- cgit v0.12 From f81c2ae72421a94e27139ec158ac8822ad6beb5c Mon Sep 17 00:00:00 2001 From: aspect Date: Fri, 17 Nov 2017 11:53:19 +0000 Subject: fix [glob] handling of leading // --- generic/tclFileName.c | 2 +- tests/zipfs.test | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 15fcde7..015cfc3 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -1881,7 +1881,7 @@ TclGlob( separators = "/\\"; } else if (tclPlatform == TCL_PLATFORM_UNIX) { - if (pathPrefix == NULL && tail[0] == '/') { + if (pathPrefix == NULL && tail[0] == '/' && tail[1] != '/') { pathPrefix = Tcl_NewStringObj(tail, 1); tail++; Tcl_IncrRefCount(pathPrefix); diff --git a/tests/zipfs.test b/tests/zipfs.test index b14aa7d..97dc463 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -55,14 +55,18 @@ test zipfs-0.5 {zipfs basics: glob} -constraints zipfs -body { } -result [list $tcl_library/http $tcl_library/http1.0] test zipfs-0.6 {zipfs basics: glob} -constraints zipfs -body { + lsort [glob $tcl_library/http*] +} -result [list $tcl_library/http $tcl_library/http1.0] + +test zipfs-0.7 {zipfs basics: glob} -constraints zipfs -body { lsort [glob -tails -dir $tcl_library http*] } -result {http http1.0} -test zipfs-0.7 {zipfs basics: glob} -constraints zipfs -body { +test zipfs-0.8 {zipfs basics: glob} -constraints zipfs -body { lsort [glob -nocomplain -tails -types d -dir $tcl_library http*] } -result {http http1.0} -test zipfs-0.8 {zipfs basics: glob} -constraints zipfs -body { +test zipfs-0.9 {zipfs basics: glob} -constraints zipfs -body { lsort [glob -nocomplain -tails -types f -dir $tcl_library http*] } -result {} -- cgit v0.12 From ff436137df3cce5d4e96e59c54a3f1211a3e8a33 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 17 Nov 2017 15:28:09 +0000 Subject: Fix [fab92486a1b05ba6f7cfe8677da95b9efb3beff0|fab92486a1]: Windows error 14 "Out of memory" mapping to Posix EFAULT "Bad address in system call argument" feels wrong --- win/tclWinError.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/tclWinError.c b/win/tclWinError.c index a74d2e2..c569d61 100644 --- a/win/tclWinError.c +++ b/win/tclWinError.c @@ -32,7 +32,7 @@ static CONST unsigned char errorTable[] = { ENOEXEC, /* ERROR_BAD_FORMAT 11 */ EACCES, /* ERROR_INVALID_ACCESS 12 */ EINVAL, /* ERROR_INVALID_DATA 13 */ - EFAULT, /* ERROR_OUT_OF_MEMORY 14 */ + ENOMEM, /* ERROR_OUT_OF_MEMORY 14 */ ENOENT, /* ERROR_INVALID_DRIVE 15 */ EACCES, /* ERROR_CURRENT_DIRECTORY 16 */ EXDEV, /* ERROR_NOT_SAME_DEVICE 17 */ -- cgit v0.12 From 335305de9cd5835ff41ab2b95ca46360fe7257fc Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Fri, 17 Nov 2017 15:46:23 +0000 Subject: Added back nothreads option. --- win/rules.vc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 1351455..af39a94 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -704,7 +704,12 @@ TCL_USE_STATIC_PACKAGES = 0 !endif !if [nmakehlp -f $(OPTS) "nothreads"] -!error Option "nothreads" no longer supported. Threads required for sockets, registry and dde to work. +!message *** Compile explicitly for non-threaded tcl +TCL_THREADS = 0 +USE_THREAD_ALLOC= 0 +!else +TCL_THREADS = 1 +USE_THREAD_ALLOC= 1 !endif !if [nmakehlp -f $(OPTS) "symbols"] @@ -749,7 +754,6 @@ USE_THREAD_ALLOC = 1 !endif !if [nmakehlp -f $(OPTS) "tclalloc"] -!error *** Option `tclalloc` is USE_THREAD_ALLOC = 0 !endif -- cgit v0.12 From 2ea8f0fe98ed8a2f72d7d355b9c080fbb5bdd912 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 17 Nov 2017 16:08:49 +0000 Subject: merge core-8-branch. Fix some Tcl_UniChar initialization, in case TCL_UTF_MAX == 4 --- doc/ToUpper.3 | 6 +++--- doc/UniCharIsAlpha.3 | 7 ++----- doc/Utf.3 | 2 +- generic/tclScan.c | 2 +- generic/tclStringObj.c | 10 +++++----- generic/tclUtf.c | 34 ++++++++++++++++++++++++---------- generic/tclUtil.c | 14 +++++++------- win/tclWinSerial.c | 6 +++--- 8 files changed, 46 insertions(+), 35 deletions(-) diff --git a/doc/ToUpper.3 b/doc/ToUpper.3 index 14766da..b06b793 100644 --- a/doc/ToUpper.3 +++ b/doc/ToUpper.3 @@ -16,10 +16,10 @@ Tcl_UniCharToUpper, Tcl_UniCharToLower, Tcl_UniCharToTitle, Tcl_UtfToUpper, Tcl_ int \fBTcl_UniCharToUpper\fR(\fIch\fR) .sp -Tcl_UniChar +int \fBTcl_UniCharToLower\fR(\fIch\fR) .sp -Tcl_UniChar +int \fBTcl_UniCharToTitle\fR(\fIch\fR) .sp int @@ -33,7 +33,7 @@ int .SH ARGUMENTS .AS char *str in/out .AP int ch in -The Tcl_UniChar to be converted. +The character to be converted. .AP char *str in/out Pointer to UTF-8 string to be converted in place. .BE diff --git a/doc/UniCharIsAlpha.3 b/doc/UniCharIsAlpha.3 index 2336c34..e1d23ab 100644 --- a/doc/UniCharIsAlpha.3 +++ b/doc/UniCharIsAlpha.3 @@ -48,19 +48,16 @@ int .SH ARGUMENTS .AS int ch .AP int ch in -The Tcl_UniChar to be examined. +The character to be examined. .BE .SH DESCRIPTION .PP -All of the routines described examine Tcl_UniChars and return a +All of the routines described examine characters and return a boolean value. A non-zero return value means that the character does belong to the character class associated with the called routine. The rest of this document just describes the character classes associated with the various routines. -.PP -Note: A Tcl_UniChar is a Unicode character represented as an unsigned, -fixed-size quantity. .SH "CHARACTER CLASSES" .PP diff --git a/doc/Utf.3 b/doc/Utf.3 index 5cd6b7df..638f349 100644 --- a/doc/Utf.3 +++ b/doc/Utf.3 @@ -77,7 +77,7 @@ int 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. +The character 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 diff --git a/generic/tclScan.c b/generic/tclScan.c index 7f71262..e0798df 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -889,7 +889,7 @@ Tcl_ScanObjCmd( i = (int)sch; #if TCL_UTF_MAX == 4 if (!offset) { - offset = Tcl_UtfToUniChar(string, &sch); + offset = TclUtfToUniChar(string, &sch); i = (((i<<10) & 0x0FFC00) + 0x10000) + (sch & 0x3FF); } #endif diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 1ccd778..fda6ac1 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1869,20 +1869,20 @@ Tcl_AppendFormatToObj( } else if (ch == 'I') { if ((format[1] == '6') && (format[2] == '4')) { format += (step + 2); - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); #ifndef TCL_WIDE_INT_IS_LONG useWide = 1; #endif } else if ((format[1] == '3') && (format[2] == '2')) { format += (step + 2); - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } else { format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } } else if ((ch == 't') || (ch == 'z')) { format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); #ifndef TCL_WIDE_INT_IS_LONG if (sizeof(size_t) > sizeof(int)) { useWide = 1; @@ -1890,7 +1890,7 @@ Tcl_AppendFormatToObj( #endif } else if ((ch == 'q') ||(ch == 'j')) { format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); #ifndef TCL_WIDE_INT_IS_LONG useWide = 1; #endif diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 859fe78..e651757 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -398,7 +398,7 @@ Tcl_UtfToUniCharDString( * appended to this previously initialized * DString. */ { - Tcl_UniChar ch, *w, *wString; + Tcl_UniChar ch = 0, *w, *wString; const char *p, *end; int oldLength; @@ -522,12 +522,12 @@ Tcl_NumUtfChars( * * Tcl_UtfFindFirst -- * - * Returns a pointer to the first occurance of the given Tcl_UniChar in + * Returns a pointer to the first occurance of the given character in * the NULL-terminated UTF-8 string. The NULL terminator is considered * part of the UTF-8 string. Equivalent to Plan 9 utfrune(). * * Results: - * As above. If the Tcl_UniChar does not exist in the given string, the + * As above. If the character does not exist in the given string, the * return value is NULL. * * Side effects: @@ -539,14 +539,21 @@ Tcl_NumUtfChars( const char * Tcl_UtfFindFirst( const char *src, /* The UTF-8 string to be searched. */ - int ch) /* The Tcl_UniChar to search for. */ + int ch) /* The character to search for. */ { - int len; + int len, fullchar; Tcl_UniChar find = 0; while (1) { len = TclUtfToUniChar(src, &find); - if (find == ch) { + fullchar = find; +#if TCL_UTF_MAX == 4 + if (!len) { + len += TclUtfToUniChar(stringPtr, &find); + fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + } +#endif + if (find == fullchar) { return src; } if (*src == '\0') { @@ -578,16 +585,23 @@ Tcl_UtfFindFirst( const char * Tcl_UtfFindLast( const char *src, /* The UTF-8 string to be searched. */ - int ch) /* The Tcl_UniChar to search for. */ + int ch) /* The character to search for. */ { - int len; + int len, fullchar; Tcl_UniChar find = 0; const char *last; last = NULL; while (1) { len = TclUtfToUniChar(src, &find); - if (find == ch) { + fullchar = find; +#if TCL_UTF_MAX == 4 + if (!len) { + len += TclUtfToUniChar(stringPtr, &find); + fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + } +#endif + if (find == fullchar) { last = src; } if (*src == '\0') { @@ -1158,7 +1172,7 @@ TclUtfCasecmp( const char *ct) /* UTF string cs is compared to. */ { while (*cs && *ct) { - Tcl_UniChar ch1, ch2; + Tcl_UniChar ch1 = 0, ch2 = 0; cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 8ebace5..21d1071 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1695,7 +1695,7 @@ TclTrimRight( */ do { - Tcl_UniChar ch2; + Tcl_UniChar ch2 = 0; int qInc = TclUtfToUniChar(q, &ch2); if (ch1 == ch2) { @@ -1763,7 +1763,7 @@ TclTrimLeft( */ do { - Tcl_UniChar ch1; + Tcl_UniChar ch1 = 0; int pInc = TclUtfToUniChar(p, &ch1); const char *q = trim; int bytesLeft = numTrim; @@ -1773,7 +1773,7 @@ TclTrimLeft( */ do { - Tcl_UniChar ch2; + Tcl_UniChar ch2 = 0; int qInc = TclUtfToUniChar(q, &ch2); if (ch1 == ch2) { @@ -2107,7 +2107,7 @@ Tcl_StringCaseMatch( { int p, charLen; const char *pstart = pattern; - Tcl_UniChar ch1, ch2; + Tcl_UniChar ch1 = 0, ch2 = 0; while (1) { p = *pattern; @@ -2217,7 +2217,7 @@ Tcl_StringCaseMatch( */ if (p == '[') { - Tcl_UniChar startChar, endChar; + Tcl_UniChar startChar = 0, endChar = 0; pattern++; if (UCHAR(*str) < 0x80) { @@ -2225,7 +2225,7 @@ Tcl_StringCaseMatch( (nocase ? tolower(UCHAR(*str)) : UCHAR(*str)); str++; } else { - str += Tcl_UtfToUniChar(str, &ch1); + str += TclUtfToUniChar(str, &ch1); if (nocase) { ch1 = Tcl_UniCharToLower(ch1); } @@ -2254,7 +2254,7 @@ Tcl_StringCaseMatch( ? tolower(UCHAR(*pattern)) : UCHAR(*pattern)); pattern++; } else { - pattern += Tcl_UtfToUniChar(pattern, &endChar); + pattern += TclUtfToUniChar(pattern, &endChar); if (nocase) { endChar = Tcl_UniCharToLower(endChar); } diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index ed1a8e5..894f431 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -1738,15 +1738,15 @@ SerialSetOptionProc( dcb.XonChar = argv[0][0]; dcb.XoffChar = argv[1][0]; if (argv[0][0] & 0x80 || argv[1][0] & 0x80) { - Tcl_UniChar character; + Tcl_UniChar character = 0; int charLen; - charLen = Tcl_UtfToUniChar(argv[0], &character); + charLen = TclUtfToUniChar(argv[0], &character); if (argv[0][charLen]) { goto badXchar; } dcb.XonChar = (char) character; - charLen = Tcl_UtfToUniChar(argv[1], &character); + charLen = TclUtfToUniChar(argv[1], &character); if (argv[1][charLen]) { goto badXchar; } -- cgit v0.12 From c6d82079ea51d3ce14e290d139edd76ddc971794 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Fri, 17 Nov 2017 17:23:01 +0000 Subject: Added a package manifest to init to allow core distributed packages to auto-populate [package ifneeded] on startup --- library/init.tcl | 4 ++++ library/pkgIndex.tcl | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 library/pkgIndex.tcl diff --git a/library/init.tcl b/library/init.tcl index 87d9f14..38d8726 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -836,3 +836,7 @@ proc tcl::CopyDirectory {action src dest} { } return } +if {[file exists [file join $::tcl_library pkgIndex.tcl]]} { + set dir $::tcl_library + source [file join $::tcl_library pkgIndex.tcl] +} diff --git a/library/pkgIndex.tcl b/library/pkgIndex.tcl new file mode 100644 index 0000000..ff8d0f1 --- /dev/null +++ b/library/pkgIndex.tcl @@ -0,0 +1,16 @@ +### +# Package manifest for all Tcl packages included in the /library file system +### +foreach {package version file} { + http 2.8.12 {http http.tcl} + http 1.0 {http1.0 http.tcl} + msgcat 1.6.1 {msgcat msgcat.tcl} + opt 0.4.7 {opt optparse.tcl} + platform 1.0.14 {platform platform.tcl} + platform::shell 1.1.4 {platform shell.tcl} + tcltest 2.4.1 {tcltest tcltest.tcl} +} { + package ifneeded $package $version [list source [file join $dir {*}$file]] +} +# Opt is the odd man out +package ifneeded opt 0.4.7 [list source [file join $dir opt optparse.tcl]] -- cgit v0.12 From 3c942c50d91bc8ea58c64065922babf397943e8f Mon Sep 17 00:00:00 2001 From: pooryorick Date: Fri, 17 Nov 2017 22:30:06 +0000 Subject: Fix [16fe1b5807]: namespace ensemble command named ":" is mistakenly given the empty string as its name. --- generic/tclBasic.c | 105 +++++++++++++++++++++++++------------ generic/tclEnsemble.c | 140 +++++++++++++++++++++++++++++++------------------- generic/tclInt.h | 26 ++++++++++ generic/tclNamesp.c | 31 ++++++++++- generic/tclProc.c | 20 +------- tests/namespace.test | 18 +++++-- 6 files changed, 231 insertions(+), 109 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index fe29db0..334febc 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -2098,13 +2098,13 @@ Tcl_CreateCommand( hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew); - if (isNew || deleted) { + if (isNew || deleted) { /* * isNew - No conflict with existing command. * deleted - We've already deleted a conflicting command */ break; - } + } /* An existing command conflicts. Try to delete it.. */ cmdPtr = Tcl_GetHashValue(hPtr); @@ -2245,64 +2245,81 @@ Tcl_CreateObjCommand( * name. */ ClientData clientData, /* Arbitrary value to pass to object * function. */ - Tcl_CmdDeleteProc *deleteProc) + Tcl_CmdDeleteProc *deleteProc /* If not NULL, gives a function to call when * this command is deleted. */ +) { Interp *iPtr = (Interp *) interp; - ImportRef *oldRefPtr = NULL; Namespace *nsPtr; - Command *cmdPtr; - Tcl_HashEntry *hPtr; const char *tail; - int isNew = 0, deleted = 0; - ImportedCmdData *dataPtr; if (iPtr->flags & DELETED) { /* * The interpreter is being deleted. Don't create any new commands; * it's not safe to muck with the interpreter anymore. */ - return (Tcl_Command) NULL; } /* + * 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) { + Namespace *dummy1, *dummy2; + + TclGetNamespaceForQualName(interp, cmdName, 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; + } + + return tclCreateObjCommandInNs(interp, tail, (Tcl_Namespace *) nsPtr, + proc, clientData, deleteProc); +} + +Tcl_Command tclCreateObjCommandInNs ( + Tcl_Interp *interp, + const char *cmdName, /* Name of command, without any namespace components */ + Tcl_Namespace *namespace, /* The namespace to create the command in */ + Tcl_ObjCmdProc *proc, /* Object-based function to associate with + * name. */ + ClientData clientData, /* Arbitrary value to pass to object + * function. */ + Tcl_CmdDeleteProc *deleteProc + /* If not NULL, gives a function to call when + * this command is deleted. */ +) { + int deleted = 0, isNew = 0; + Command *cmdPtr; + ImportRef *oldRefPtr = NULL; + ImportedCmdData *dataPtr; + Tcl_HashEntry *hPtr; + Namespace *nsPtr = (Namespace *) namespace; + /* * If the command name we seek to create already exists, we need to * delete that first. That can be tricky in the presence of traces. * Loop until we no longer find an existing command in the way, or * until we've deleted one command and that didn't finish the job. */ - while (1) { - /* - * 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) { - Namespace *dummy1, *dummy2; - - TclGetNamespaceForQualName(interp, cmdName, 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, cmdName, &isNew); - hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, tail, &isNew); - - if (isNew || deleted) { + if (isNew || deleted) { /* * isNew - No conflict with existing command. * deleted - We've already deleted a conflicting command */ break; - } + } + /* An existing command conflicts. Try to delete it.. */ cmdPtr = Tcl_GetHashValue(hPtr); @@ -2336,7 +2353,13 @@ Tcl_CreateObjCommand( cmdPtr->flags |= CMD_REDEF_IN_PROGRESS; } + /* Make sure namespace doesn't get deallocated. */ + cmdPtr->nsPtr->refCount++; + Tcl_DeleteCommandFromToken(interp, (Tcl_Command) cmdPtr); + nsPtr = (Namespace *) TclEnsureNamespace(interp, + (Tcl_Namespace *)cmdPtr->nsPtr); + TclNsDecrRefCount(cmdPtr->nsPtr); if (cmdPtr->flags & CMD_REDEF_IN_PROGRESS) { oldRefPtr = cmdPtr->importRefPtr; @@ -2345,7 +2368,6 @@ Tcl_CreateObjCommand( TclCleanupCommandMacro(cmdPtr); deleted = 1; } - if (!isNew) { /* * If the deletion callback recreated the command, just throw away @@ -2367,7 +2389,7 @@ Tcl_CreateObjCommand( * commands. */ - TclInvalidateCmdLiteral(interp, tail, nsPtr); + TclInvalidateCmdLiteral(interp, cmdName, nsPtr); /* * The list of command exported from the namespace might have changed. @@ -8187,6 +8209,21 @@ Tcl_NRCreateCommand( cmdPtr->nreProc = nreProc; return (Tcl_Command) cmdPtr; } + +Tcl_Command tclNRCreateCommandInNs ( + Tcl_Interp *interp, + const char *cmdName, + Tcl_Namespace *nsPtr, + Tcl_ObjCmdProc *proc, + Tcl_ObjCmdProc *nreProc, + ClientData clientData, + Tcl_CmdDeleteProc *deleteProc) { + Command *cmdPtr = (Command *) + tclCreateObjCommandInNs(interp,cmdName,nsPtr,proc,clientData,deleteProc); + + cmdPtr->nreProc = nreProc; + return (Tcl_Command) cmdPtr; +} /**************************************************************************** * Stuff for the public api diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index f3e8187..28802b0 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -146,10 +146,12 @@ TclNamespaceEnsembleCmd( Tcl_Obj *const objv[]) { Tcl_Namespace *namespacePtr; - Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp); + Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp), *cxtPtr, + *foundNsPtr, *altFoundNsPtr, *actualCxtPtr; Tcl_Command token; Tcl_DictSearch search; Tcl_Obj *listObj; + const char *simpleName; int index, done; if (nsPtr == NULL || nsPtr->flags & NS_DYING) { @@ -195,13 +197,8 @@ TclNamespaceEnsembleCmd( objv += 2; objc -= 2; - /* - * Work out what name to use for the command to create. If supplied, - * it is either fully specified or relative to the current namespace. - * If not supplied, it is exactly the name of the current namespace. - */ - - name = nsPtr->fullName; + name = nsPtr->name; + cxtPtr = (Namespace *) nsPtr->parentPtr; /* * Parse the option list, applying type checks as we go. Note that we @@ -221,6 +218,7 @@ TclNamespaceEnsembleCmd( switch ((enum EnsCreateOpts) index) { case CRT_CMD: name = TclGetString(objv[1]); + cxtPtr = nsPtr; continue; case CRT_SUBCMDS: if (TclListObjLength(interp, objv[1], &len) != TCL_OK) { @@ -337,6 +335,10 @@ TclNamespaceEnsembleCmd( } } + TclGetNamespaceForQualName(interp, name, cxtPtr, + TCL_CREATE_NS_IF_UNKNOWN, &foundNsPtr, &altFoundNsPtr, &actualCxtPtr, + &simpleName); + /* * Create the ensemble. Note that this might delete another ensemble * linked to the same namespace, so we must be careful. However, we @@ -344,8 +346,9 @@ TclNamespaceEnsembleCmd( * we've created it (and after any deletions have occurred.) */ - token = Tcl_CreateEnsemble(interp, name, NULL, - (permitPrefix ? TCL_ENSEMBLE_PREFIX : 0)); + token = TclCreateEnsembleInNs(interp, simpleName, + (Tcl_Namespace *) foundNsPtr, (Tcl_Namespace *) nsPtr, + (permitPrefix ? TCL_ENSEMBLE_PREFIX : 0)); Tcl_SetEnsembleSubcommandList(interp, token, subcmdObj); Tcl_SetEnsembleMappingDict(interp, token, mapObj); Tcl_SetEnsembleUnknownHandler(interp, token, unknownObj); @@ -636,48 +639,38 @@ TclNamespaceEnsembleCmd( /* *---------------------------------------------------------------------- * - * Tcl_CreateEnsemble -- + * TclCreateEnsembleInNs -- * - * Create a simple ensemble attached to the given namespace. - * - * Results: - * The token for the command created. - * - * Side effects: - * The ensemble is created and marked for compilation. + * Like Tcl_CreateEnsemble, but additionally accepts as an argument the + * name of the namespace to create the command in. * *---------------------------------------------------------------------- */ Tcl_Command -Tcl_CreateEnsemble( - Tcl_Interp *interp, - const char *name, - Tcl_Namespace *namespacePtr, - int flags) +TclCreateEnsembleInNs( + Tcl_Interp *interp, + + const char *name, /* Simple name of command to create (no */ + /* namespace components). */ + Tcl_Namespace /* Name of namespace to create the command in. */ + *nameNsPtr, + Tcl_Namespace + *ensembleNsPtr, /* Name of the namespace for the ensemble. */ + int flags + ) { - Namespace *nsPtr = (Namespace *) namespacePtr; - EnsembleConfig *ensemblePtr = ckalloc(sizeof(EnsembleConfig)); - Tcl_Obj *nameObj = NULL; - - if (nsPtr == NULL) { - nsPtr = (Namespace *) TclGetCurrentNamespace(interp); - } - - /* - * Make the name of the ensemble into a fully qualified name. This might - * allocate a temporary object. - */ + Namespace *nsPtr = (Namespace *) ensembleNsPtr; + EnsembleConfig *ensemblePtr; + Tcl_Command token; - if (!(name[0] == ':' && name[1] == ':')) { - nameObj = NewNsObj((Tcl_Namespace *) nsPtr); - if (nsPtr->parentPtr == NULL) { - Tcl_AppendStringsToObj(nameObj, name, NULL); - } else { - Tcl_AppendStringsToObj(nameObj, "::", name, NULL); - } - Tcl_IncrRefCount(nameObj); - name = TclGetString(nameObj); + ensemblePtr = ckalloc(sizeof(EnsembleConfig)); + token = tclNRCreateCommandInNs(interp, name, + (Tcl_Namespace *) nameNsPtr, NsEnsembleImplementationCmd, + NsEnsembleImplementationCmdNR, ensemblePtr, DeleteEnsembleConfig); + if (token == NULL) { + ckfree(ensemblePtr); + return NULL; } ensemblePtr->nsPtr = nsPtr; @@ -690,9 +683,7 @@ Tcl_CreateEnsemble( ensemblePtr->numParameters = 0; ensemblePtr->parameterList = NULL; ensemblePtr->unknownHandler = NULL; - ensemblePtr->token = Tcl_NRCreateCommand(interp, name, - NsEnsembleImplementationCmd, NsEnsembleImplementationCmdNR, - ensemblePtr, DeleteEnsembleConfig); + ensemblePtr->token = token; ensemblePtr->next = (EnsembleConfig *) nsPtr->ensembles; nsPtr->ensembles = (Tcl_Ensemble *) ensemblePtr; @@ -709,11 +700,56 @@ Tcl_CreateEnsemble( ((Command *) ensemblePtr->token)->compileProc = TclCompileEnsemble; } + return ensemblePtr->token; + +} + + +/* + *---------------------------------------------------------------------- + * + * Tcl_CreateEnsemble + * + * Create a simple ensemble attached to the given namespace. + * + * Deprecated by TclCreateEnsembleInNs. + * + * Value + * + * The token for the command created. + * + * Effect + * The ensemble is created and marked for compilation. + * + * + *---------------------------------------------------------------------- + */ + +Tcl_Command +Tcl_CreateEnsemble( + Tcl_Interp *interp, + const char *name, + Tcl_Namespace *namespacePtr, + int flags) +{ + Tcl_Obj *nameObj = NULL; + Namespace *nsPtr = (Namespace *)namespacePtr, *foundNsPtr, *altNsPtr, + *actualNsPtr; + const char * simpleName; + + if (nsPtr == NULL) { + nsPtr = (Namespace *) TclGetCurrentNamespace(interp); + } + + TclGetNamespaceForQualName(interp, name, nsPtr, 0, + &foundNsPtr, &altNsPtr, &actualNsPtr, &simpleName); if (nameObj != NULL) { - TclDecrRefCount(nameObj); + TclDecrRefCount(nameObj); } - return ensemblePtr->token; + return TclCreateEnsembleInNs(interp, simpleName, + (Tcl_Namespace *) foundNsPtr, (Tcl_Namespace *) nsPtr, flags); } + /* *---------------------------------------------------------------------- @@ -1885,6 +1921,7 @@ NsEnsembleImplementationCmdNR( TclSkipTailcall(interp); Tcl_ListObjGetElements(NULL, copyPtr, ©Objc, ©Objv); + ((Interp *)interp)->lookupNsPtr = ensemblePtr->nsPtr; return TclNREvalObjv(interp, copyObjc, copyObjv, TCL_EVAL_INVOKE, NULL); } @@ -2635,10 +2672,7 @@ BuildEnsembleConfig( Tcl_Obj *cmdObj, *cmdPrefixObj; TclNewObj(cmdObj); - Tcl_AppendStringsToObj(cmdObj, - ensemblePtr->nsPtr->fullName, - (ensemblePtr->nsPtr->parentPtr ? "::" : ""), - nsCmdName, NULL); + Tcl_AppendStringsToObj(cmdObj, nsCmdName, NULL); cmdPrefixObj = Tcl_NewListObj(1, &cmdObj); Tcl_SetHashValue(hPtr, cmdPrefixObj); Tcl_IncrRefCount(cmdPrefixObj); diff --git a/generic/tclInt.h b/generic/tclInt.h index 23a20e6..480ae5a 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2917,6 +2917,19 @@ MODULE_SCOPE void TclContinuationsCopy(Tcl_Obj *objPtr, Tcl_Obj *originObjPtr); MODULE_SCOPE int TclConvertElement(const char *src, int length, char *dst, int flags); +MODULE_SCOPE Tcl_Command tclCreateObjCommandInNs ( + Tcl_Interp *interp, + const char *cmdName, + Tcl_Namespace *nsPtr, + Tcl_ObjCmdProc *proc, + ClientData clientData, + Tcl_CmdDeleteProc *deleteProc); +MODULE_SCOPE Tcl_Command TclCreateEnsembleInNs( + Tcl_Interp *interp, + const char *name, + Tcl_Namespace *nameNamespacePtr, + Tcl_Namespace *ensembleNamespacePtr, + int flags); MODULE_SCOPE void TclDeleteNamespaceVars(Namespace *nsPtr); MODULE_SCOPE int TclFindDictElement(Tcl_Interp *interp, const char *dict, int dictLength, @@ -2945,6 +2958,10 @@ MODULE_SCOPE char * TclDStringAppendDString(Tcl_DString *dsPtr, MODULE_SCOPE Tcl_Obj * TclDStringToObj(Tcl_DString *dsPtr); MODULE_SCOPE Tcl_Obj *const * TclFetchEnsembleRoot(Tcl_Interp *interp, Tcl_Obj *const *objv, int objc, int *objcPtr); +Tcl_Namespace * TclEnsureNamespace( + Tcl_Interp *interp, + Tcl_Namespace *namespacePtr); + MODULE_SCOPE void TclFinalizeAllocSubsystem(void); MODULE_SCOPE void TclFinalizeAsync(void); MODULE_SCOPE void TclFinalizeDoubleConversion(void); @@ -2971,6 +2988,15 @@ MODULE_SCOPE double TclFloor(const mp_int *a); MODULE_SCOPE void TclFormatNaN(double value, char *buffer); MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr, const char *attributeName, int *indexPtr); +MODULE_SCOPE Tcl_Command tclNRCreateCommandInNs ( + Tcl_Interp *interp, + const char *cmdName, + Tcl_Namespace *nsPtr, + Tcl_ObjCmdProc *proc, + Tcl_ObjCmdProc *nreProc, + ClientData clientData, + Tcl_CmdDeleteProc *deleteProc); + MODULE_SCOPE int TclNREvalFile(Tcl_Interp *interp, Tcl_Obj *pathPtr, const char *encodingName); MODULE_SCOPE void TclFSUnloadTempFile(Tcl_LoadHandle loadHandle); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index e1bad0e..e7914ad 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -2424,6 +2424,35 @@ TclGetNamespaceForQualName( /* *---------------------------------------------------------------------- * + * TclEnsureNamespace -- + * + * Provide a namespace that is not deleted. + * + * Value + * + * namespacePtr, if it is not scheduled for deletion, or a pointer to a + * new namespace with the same name otherwise. + * + * Effect + * None. + * + *---------------------------------------------------------------------- + */ +Tcl_Namespace * +TclEnsureNamespace( + Tcl_Interp *interp, + Tcl_Namespace *namespacePtr) +{ + Namespace *nsPtr = (Namespace *) namespacePtr; + if (!nsPtr->flags & NS_DYING) { + return namespacePtr; + } + return Tcl_CreateNamespace(interp, nsPtr->fullName, NULL, NULL); +} + +/* + *---------------------------------------------------------------------- + * * Tcl_FindNamespace -- * * Searches for a namespace. @@ -2638,7 +2667,7 @@ Tcl_FindCommand( Namespace *nsPtr[2]; register int search; - TclGetNamespaceForQualName(interp, name, (Namespace *) contextNsPtr, + TclGetNamespaceForQualName(interp, name, cxtNsPtr, flags, &nsPtr[0], &nsPtr[1], &cxtNsPtr, &simpleName); /* diff --git a/generic/tclProc.c b/generic/tclProc.c index 8fc6dcb..f5f2b03 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -128,7 +128,6 @@ Tcl_ProcObjCmd( const char *procName, *procArgs, *procBody; Namespace *nsPtr, *altNsPtr, *cxtNsPtr; Tcl_Command cmd; - Tcl_DString ds; if (objc != 4) { Tcl_WrongNumArgs(interp, 1, objv, "name args body"); @@ -180,23 +179,8 @@ Tcl_ProcObjCmd( return TCL_ERROR; } - /* - * Now create a command for the procedure. This will initially be in the - * current namespace unless the procedure's name included namespace - * qualifiers. To create the new command in the right namespace, we - * generate a fully qualified name for it. - */ - - Tcl_DStringInit(&ds); - if (nsPtr != iPtr->globalNsPtr) { - Tcl_DStringAppend(&ds, nsPtr->fullName, -1); - TclDStringAppendLiteral(&ds, "::"); - } - Tcl_DStringAppend(&ds, procName, -1); - - cmd = Tcl_NRCreateCommand(interp, Tcl_DStringValue(&ds), TclObjInterpProc, - TclNRInterpProc, procPtr, TclProcDeleteProc); - Tcl_DStringFree(&ds); + cmd = tclNRCreateCommandInNs(interp, procName, (Tcl_Namespace *) nsPtr, + TclObjInterpProc, TclNRInterpProc, procPtr, TclProcDeleteProc); /* * Now initialize the new procedure's cmdPtr field. This will be used diff --git a/tests/namespace.test b/tests/namespace.test index f6f817b..220fa53 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -1784,7 +1784,7 @@ test namespace-42.7 {ensembles: nested} -body { list [ns x0 z] [ns x1] [ns x2] [ns x3] } -cleanup { namespace delete ns -} -result {{1 ::ns::x0::z} 1 2 3} +} -result {{1 z} 1 2 3} test namespace-42.8 {ensembles: [Bug 1670091]} -setup { proc demo args {} variable target [list [namespace which demo] x] @@ -2084,7 +2084,7 @@ test namespace-47.1 {ensemble: unknown handler} { lappend result [catch {ns c d e} msg] $msg lappend result [catch {ns Magic foo bar spong wibble} msg] $msg list $result [lsort [info commands ::ns::*]] $log [namespace delete ns] -} {{0 2 0 2 0 2 0 2 1 {unknown or protected subcommand "Magic"}} {::ns::Magic ::ns::a ::ns::b ::ns::c} {{making a} {running ::ns::a b c} {running ::ns::a b c} {making b} {running ::ns::b c d} {making c} {running ::ns::c d e} {unknown Magic - args = foo bar spong wibble}} {}} +} {{0 2 0 2 0 2 0 2 1 {unknown or protected subcommand "Magic"}} {::ns::Magic ::ns::a ::ns::b ::ns::c} {{making a} {running a b c} {running a b c} {making b} {running b c d} {making c} {running c d e} {unknown Magic - args = foo bar spong wibble}} {}} test namespace-47.2 {ensemble: unknown handler} { namespace eval ns { namespace export {[a-z]*} @@ -3183,7 +3183,7 @@ test namespace-53.10 {ensembles: nested rewrite} -setup { 1 {wrong # args: should be "ns z1 x a1"}\ 1 {wrong # args: should be "ns z2 x a1 a2"}\ 1 {wrong # args: should be "ns z2 x a1 a2"}\ - 1 {wrong # args: should be "::ns::x::z0"}\ + 1 {wrong # args: should be "z0"}\ 0 {1 v}\ 1 {wrong # args: should be "ns v x z2 a2"}\ 0 {2 v v2}} @@ -3267,6 +3267,18 @@ test namespace-56.3 {bug f97d4ee020: mutually-entangled deletion} { } } } {::testing::abc::def ::testing::abc::ghi} + +test namespace-56.4 {bug 16fe1b5807: names starting with ":"} { +namespace eval : { + namespace ensemble create + namespace export * + proc p1 {} { + return 16fe1b5807 + } +} + +: p1 +} 16fe1b5807 # cleanup catch {rename cmd1 {}} -- cgit v0.12 From 42c80667fd7da57b65d92fee77d2b954fba95970 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Fri, 17 Nov 2017 23:42:16 +0000 Subject: Lift the restriction on command names names that begin with ":". --- generic/tclBasic.c | 8 -------- generic/tclProc.c | 8 -------- 2 files changed, 16 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 334febc..a51578c 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -9042,14 +9042,6 @@ TclNRCoroutineObjCmd( Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", fullName, NULL); return TCL_ERROR; } - if ((nsPtr != iPtr->globalNsPtr) - && (procName != NULL) && (procName[0] == ':')) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't create procedure \"%s\" in non-global namespace with" - " name starting with \":\"", procName)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", procName, NULL); - return TCL_ERROR; - } /* * We ARE creating the coroutine command: allocate the corresponding diff --git a/generic/tclProc.c b/generic/tclProc.c index f5f2b03..3c30623 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -158,14 +158,6 @@ Tcl_ProcObjCmd( Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", NULL); return TCL_ERROR; } - if ((nsPtr != iPtr->globalNsPtr) - && (procName != NULL) && (procName[0] == ':')) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't create procedure \"%s\" in non-global namespace with" - " name starting with \":\"", procName)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", NULL); - return TCL_ERROR; - } /* * Create the data structure to represent the procedure. -- cgit v0.12 From b59255450b97c1cc7fe5223937c86c805aa89eb8 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sat, 18 Nov 2017 11:48:08 +0000 Subject: Added a pool of literal strings to zipfs to manage constants that are being belched out by the file system. Created a separate mount point for Unix and Windows, with a new "zipfs root" command to tell the user which location to use for their platform --- generic/tclZipfs.c | 92 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 76 insertions(+), 16 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 8eae35a..4a72392 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -28,12 +28,21 @@ #include "zlib.h" #include "crypt.h" +/* +** On windows we need VFS to look like a volume +** On Unix we need it to look like a UNC path +*/ +#if defined(_WIN32) || defined(_WIN64) +#define ZIPFS_VOLUME "zipfs:/" +#define ZIPFS_VOLUME_LEN 7 +#define ZIPFS_APP_MOUNT "zipfs:/app" +#define ZIPFS_ZIP_MOUNT "zipfs:/lib/tcl" +#else #define ZIPFS_VOLUME "//zipfs:/" +#define ZIPFS_VOLUME_LEN 9 #define ZIPFS_APP_MOUNT "//zipfs:/app" #define ZIPFS_ZIP_MOUNT "//zipfs:/lib/tcl" - -#define ZIPFS_VOLUME_LEN 9 - +#endif /* * Various constants and offsets found in ZIP archive files */ @@ -292,6 +301,11 @@ static const unsigned long crc32tab[256] = { 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, }; + +static Tcl_Obj *zipfs_literal_fstype=NULL; +static Tcl_Obj *zipfs_literal_fsroot=NULL; +static Tcl_Obj *zipfs_literal_fsseparator=NULL; + /* *------------------------------------------------------------------------- @@ -1412,6 +1426,35 @@ ZipFSMountObjCmd(ClientData clientData, Tcl_Interp *interp, /* *------------------------------------------------------------------------- * + * ZipFSRootObjCmd -- + * + * This procedure is invoked to process the "zipfs::root" command. It + * returns the root that all zipfs file systems are mounted under. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSRootObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + if(!zipfs_literal_fsroot) { + zipfs_literal_fsroot=Tcl_NewStringObj(ZIPFS_VOLUME, -1); + Tcl_IncrRefCount(zipfs_literal_fsroot); + } + Tcl_IncrRefCount(zipfs_literal_fsroot); + Tcl_SetObjResult(interp,zipfs_literal_fsroot); + return TCL_OK; +} + +/* + *------------------------------------------------------------------------- + * * ZipFSUnmountObjCmd -- * * This procedure is invoked to process the "zipfs::unmount" command. @@ -3178,7 +3221,12 @@ Zip_FSAccessProc(Tcl_Obj *pathPtr, int mode) static Tcl_Obj * Zip_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr) { - return Tcl_NewStringObj("/", -1); + if(!zipfs_literal_fsseparator) { + zipfs_literal_fsseparator=Tcl_NewStringObj("/", -1); + Tcl_IncrRefCount(zipfs_literal_fsseparator); + } + Tcl_IncrRefCount(zipfs_literal_fsseparator); + return zipfs_literal_fsseparator; } /* @@ -3439,7 +3487,12 @@ endloop: */ static Tcl_Obj * Zip_FSListVolumesProc(void) { - return Tcl_NewStringObj(ZIPFS_VOLUME, -1); + if(!zipfs_literal_fsroot) { + zipfs_literal_fsroot=Tcl_NewStringObj(ZIPFS_VOLUME, -1); + Tcl_IncrRefCount(zipfs_literal_fsroot); + } + Tcl_IncrRefCount(zipfs_literal_fsroot); + return zipfs_literal_fsroot; } /* @@ -3586,7 +3639,12 @@ Zip_FSFileAttrsSetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, static Tcl_Obj * Zip_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr) { - return Tcl_NewStringObj("zip", -1); + if(!zipfs_literal_fstype) { + zipfs_literal_fstype=Tcl_NewStringObj("zip", -1); + Tcl_IncrRefCount(zipfs_literal_fstype); + } + Tcl_IncrRefCount(zipfs_literal_fstype); + return zipfs_literal_fstype; } @@ -3788,17 +3846,19 @@ TclZipfs_Init(Tcl_Interp *interp) Unlock(); if(interp != NULL) { static const EnsembleImplMap initMap[] = { - {"mount", ZipFSMountObjCmd, NULL, NULL, NULL, 0}, - {"unmount", ZipFSUnmountObjCmd, NULL, NULL, NULL, 0}, - {"mkkey", ZipFSMkKeyObjCmd, NULL, NULL, NULL, 0}, - {"mkimg", ZipFSMkImgObjCmd, NULL, NULL, NULL, 0}, - {"mkzip", ZipFSMkZipObjCmd, NULL, NULL, NULL, 0}, - {"lmkimg", ZipFSLMkImgObjCmd, NULL, NULL, NULL, 0}, - {"lmkzip", ZipFSLMkZipObjCmd, NULL, NULL, NULL, 0}, - {"exists", ZipFSExistsObjCmd, NULL, NULL, NULL, 1}, - {"info", ZipFSInfoObjCmd, NULL, NULL, NULL, 1}, - {"list", ZipFSListObjCmd, NULL, NULL, NULL, 1}, + {"mount", ZipFSMountObjCmd, NULL, NULL, NULL, 0}, + {"unmount", ZipFSUnmountObjCmd, NULL, NULL, NULL, 0}, + {"mkkey", ZipFSMkKeyObjCmd, NULL, NULL, NULL, 0}, + {"mkimg", ZipFSMkImgObjCmd, NULL, NULL, NULL, 0}, + {"mkzip", ZipFSMkZipObjCmd, NULL, NULL, NULL, 0}, + {"lmkimg", ZipFSLMkImgObjCmd, NULL, NULL, NULL, 0}, + {"lmkzip", ZipFSLMkZipObjCmd, NULL, NULL, NULL, 0}, + {"exists", ZipFSExistsObjCmd, NULL, NULL, NULL, 1}, + {"info", ZipFSInfoObjCmd, NULL, NULL, NULL, 1}, + {"list", ZipFSListObjCmd, NULL, NULL, NULL, 1}, {"canonical", ZipFSCanonicalObjCmd, NULL, NULL, NULL, 1}, + {"root", ZipFSRootObjCmd, NULL, NULL, NULL, 1}, + {NULL, NULL, NULL, NULL, NULL, 0} }; static const char findproc[] = -- cgit v0.12 From 02a019458f248912f3eaffedd11359545eb79abb Mon Sep 17 00:00:00 2001 From: tne Date: Sat, 18 Nov 2017 11:59:20 +0000 Subject: Updated zipfs tests to recognize the mount points are different on different platforms --- tests/zipfs.test | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/zipfs.test b/tests/zipfs.test index 97dc463..9284404 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -22,16 +22,18 @@ testConstraint zipfs [expr {[llength [info commands zlib]] && [regexp tcltest [i # load {} zipfs #} -result {} +set ziproot [zipfs root] + test zipfs-0.1 {zipfs basics} -constraints zipfs -body { package require zipfs -} -result {1.0} +} -result {2.0} test zipfs-0.1 {zipfs basics} -constraints zipfs -body { - expr {"//zipfs:/" in [file volumes]} + expr {${ziproot} in [file volumes]} } -result 1 test zipfs-0.2 {zipfs basics} -constraints zipfs -body { - string match //zipfs:/* $tcl_library + string match ${ziproot}* $tcl_library } -result 1 test zipfs-0.3 {zipfs basics: glob} -constraints zipfs -body { @@ -111,18 +113,18 @@ test zipfs-2.2 {zipfs mkzip} -constraints zipfs -body { set pwd [pwd] cd $tcl_library/encoding zipfs mkzip /tmp/abc.zip . - zipfs mount /tmp/abc.zip //zipfs:/abc ;# FIXME: test independence - zipfs list -glob //zipfs:/abc/cp850.* + zipfs mount /tmp/abc.zip /abc ;# FIXME: test independence + zipfs list -glob ${ziproot}/abc/cp850.* } -cleanup { cd $pwd -} -result {//zipfs:/abc/cp850.enc} +} -result {[zipfs root]/abc/cp850.enc} test zipfs-2.3 {zipfs info} -constraints zipfs -body { - zipfs info //zipfs:/abc/cp850.enc + zipfs info ${ziproot}/abc/cp850.enc } -result [list /tmp/abc.zip 1090 527 39318] ;# FIXME: result depends on content of encodings dir test zipfs-2.4 {zipfs data} -constraints zipfs -body { - set zipfd [open //zipfs:/abc/cp850.enc] ;# FIXME: leave open - see later test + set zipfd [open ${ziproot}/abc/cp850.enc] ;# FIXME: leave open - see later test read $zipfd } -result {# Encoding file: cp850, single-byte S -- cgit v0.12 From b171f5cc41b72d1f0b313a6b720394c25bd8d310 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sat, 18 Nov 2017 12:21:35 +0000 Subject: Added documentation for the zipfs root command and working of TclZipfs_AppHook --- doc/zipfs.3 | 22 +++++++++++++++++++++- doc/zipfs.n | 10 ++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/doc/zipfs.3 b/doc/zipfs.3 index a3b3da8..b23afae 100644 --- a/doc/zipfs.3 +++ b/doc/zipfs.3 @@ -10,16 +10,24 @@ .so man.macros .BS .SH NAME -Tclzipfs_Mount, Tclzipfs_Unmount \- handle ZIP files as VFS +TclZipfs_AppHook, Tclzipfs_Mount, Tclzipfs_Unmount, \- handle ZIP files as VFS .SH SYNOPSIS .nf .sp int +\fBTclZipfs_AppHook(\fIint *argc, char ***argv\fR) +.sp +int \fBTclzipfs_Mount\fR(\fIinterp, zipname, mntpt, passwd\fR) .sp int \fBTclzipfs_Unmount\fR(\fIinterp, zipname\fR) .SH ARGUMENTS +.AP "int" *argc in +Number of command line arguments from main() +.AP "char" ***argv in +Pointer to an array of strings containing the command +line arguments to main() .AS Tcl_Interp **termPtr .AP Tcl_Interp *interp in Interpreter in which the zip file system is mounted. The interpreter's result is @@ -32,6 +40,18 @@ Name of a mount point. An (optional) password. .BE .SH DESCRIPTION +\fBTclZipfs_AppHook()\fR is a utility function to perform standard +application initialization procedures. If the current application has +a mountable zip file system, that file system is mounted under \fIZIPROOT\fR\fB/app\fR. +If a file named \fBmain.tcl\fR is located in that file system, it is treated +as the startup script for the process. If the file \fIZIPROOT\fR\fB/app/tcl_library/init.tcl\fR +is present, \fBtcl_library\fR is set to \fIZIPROOT\fR\fB/app/tcl_library. +.PP +If the \fBtcl_library\fR was not found in the application, the system will then search for it +as either a VFS attached to the application dynamic library, or as a zip archive named +libtcl_\fIMAJOR\fR_\fIMINOR\fR_\fIpatchLevel\fR.zip either in the present working directory +or in the standard tcl install location. +.PP \fBTclzipfs_Mount()\fR mount the ZIP archive \fIzipname\fR on the mount point given in \fImntpt\fR using the optional ZIP password \fIpasswd\fR. Errors during that process are reported in the interpreter \fIinterp\fR. diff --git a/doc/zipfs.n b/doc/zipfs.n index f82100f..a026b6d 100644 --- a/doc/zipfs.n +++ b/doc/zipfs.n @@ -24,6 +24,7 @@ zipfs \- Mount and work with ZIP files within Tcl \fBzipfs mkkey\fR \fIpassword\fR \fBzipfs mkzip\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR \fBzipfs mount\fR \fI?zipfile?\fR \fI?mountpoint?\fR \fI?password?\fR +\fBzipfs root\fR \fBzipfs unmount\fR \fIzipfile\fR .fi .BE @@ -41,7 +42,7 @@ Return 1 if the given filename exists in the mounted zipfs and 0 if it does not. Recursively lists files including and below the directory \fIdir\fR. The result list consists of relative path names starting from the given directory. This command is also used by the \fBzipfs mkzip\fR -and \fBzipfs mkimg\fR commands. +and \fBzipfs mkimg\fR commands. .TP \fBzipfs info\fR \fIfile\fR . @@ -92,7 +93,7 @@ of the respective file name. .PP Caution: the choice of the \fIindir\fR parameter (less the optional stripped prefix) determines the later root name of the -archive's content. +archive's content. .RE .TP \fBzipfs mount ?\fIzipfile\fR? ?\fImountpoint\fR? ?\fIpassword\fR? @@ -107,6 +108,11 @@ With no \fIzipfile\fR, return all zipfile/mount pairs. If \fImountpoint\fR is specified as an empty string, mount on file path. .RE .TP +\fBzipfs root\fR +Returns a constant string which indicates the mount point for zipfs volumes +for the current platform. On Windows, this value is zipfs:/. On Unux, //zipfs:/ +.RE +.TP \fBzipfs unmount \fIzipfile\fR . Unmounts a previously mounted ZIP archive file \fIzipfile\fR. -- cgit v0.12 From 3730061388d459b86b5b62d877d786e1ddfee7ff Mon Sep 17 00:00:00 2001 From: aspect Date: Sat, 18 Nov 2017 17:02:08 +0000 Subject: fix zipfs tests --- tests/zipfs.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/zipfs.test b/tests/zipfs.test index 9284404..ce287da 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -113,14 +113,14 @@ test zipfs-2.2 {zipfs mkzip} -constraints zipfs -body { set pwd [pwd] cd $tcl_library/encoding zipfs mkzip /tmp/abc.zip . - zipfs mount /tmp/abc.zip /abc ;# FIXME: test independence - zipfs list -glob ${ziproot}/abc/cp850.* + zipfs mount /tmp/abc.zip ${ziproot}abc ;# FIXME: test independence + zipfs list -glob ${ziproot}abc/cp850.* } -cleanup { cd $pwd -} -result {[zipfs root]/abc/cp850.enc} +} -result "[zipfs root]abc/cp850.enc" test zipfs-2.3 {zipfs info} -constraints zipfs -body { - zipfs info ${ziproot}/abc/cp850.enc + zipfs info ${ziproot}abc/cp850.enc } -result [list /tmp/abc.zip 1090 527 39318] ;# FIXME: result depends on content of encodings dir test zipfs-2.4 {zipfs data} -constraints zipfs -body { -- cgit v0.12 From d8a0c08bbc357c4f126c8852692c0fd6d9d2688a Mon Sep 17 00:00:00 2001 From: aspect Date: Sat, 18 Nov 2017 17:04:03 +0000 Subject: add some tests for join and normalize --- tests/zipfs.test | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/zipfs.test b/tests/zipfs.test index ce287da..abf888b 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -72,6 +72,17 @@ test zipfs-0.9 {zipfs basics: glob} -constraints zipfs -body { lsort [glob -nocomplain -tails -types f -dir $tcl_library http*] } -result {} +test zipfs-0.10 {zipfs basics: join} -constraints zipfs -body { + file join [zipfs root] bar baz +} -result "[zipfs root]bar/baz" + +test zipfs-0.11 {zipfs basics: join} -constraints zipfs -body { + file normalize [zipfs root] +} -result "[zipfs root]" + +test zipfs-0.12 {zipfs basics: join} -constraints zipfs -body { + file normalize [zipfs root]//bar/baz//qux/../ +} -result "[zipfs root]bar/baz" test zipfs-1.3 {zipfs errors} -constraints zipfs -returnCodes error -body { zipfs mount a b c d e f -- cgit v0.12 From 157e55c7bc831fdf3cb6d68917ac6c7222442166 Mon Sep 17 00:00:00 2001 From: aspect Date: Sat, 18 Nov 2017 17:07:48 +0000 Subject: Reserve paths matching //[^/]*: for VFS mount points, and prevent calling native filesystem ops during normalization for them. This is permitted by UNC standards (which do not allow : at the end), and should prevent observed slow [glob] operations (and others) on Windows when using such paths. --- generic/tclIOUtil.c | 59 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 14 deletions(-) diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 4f2288e..bca74fa 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -1400,31 +1400,62 @@ TclFSNormalizeToUniquePath( { FilesystemRecord *fsRecPtr, *firstFsRecPtr; + int i; + int isVfsPath = 0; + char *path; + /* - * Call each of the "normalise path" functions in succession. This is a - * special case, in which if we have a native filesystem handler, we call - * it first. This is because the root of Tcl's filesystem is always a - * native filesystem (i.e., '/' on unix is native). + * Paths starting with a UNC prefix whose final character is a colon + * are reserved for VFS use. These names can not conflict with real + * UNC paths per https://msdn.microsoft.com/en-us/library/gg465305.aspx + * and rfc3986's definition of reg-name. + * + * We check these first to avoid useless calls to the native filesystem's + * normalizePathProc. */ + path = Tcl_GetStringFromObj(pathPtr, &i); + + if ( (i >= 3) && ( (path[0] == '/' && path[1] == '/') + || (path[0] == '\\' && path[1] == '\\') ) ) { + for ( i = 2; ; i++) { + if (path[i] == '\0') break; + if (path[i] == path[0]) break; + } + --i; + if (path[i] == ':') isVfsPath = 1; + } + /* + * Call each of the "normalise path" functions in succession. + */ firstFsRecPtr = FsGetFirstFilesystem(); Claim(); - for (fsRecPtr=firstFsRecPtr; fsRecPtr!=NULL; fsRecPtr=fsRecPtr->nextPtr) { - if (fsRecPtr->fsPtr != &tclNativeFilesystem) { - continue; - } + + if (!isVfsPath) { /* - * TODO: Assume that we always find the native file system; it should - * always be there... + * If we have a native filesystem handler, we call it first. This is + * because the root of Tcl's filesystem is always a native filesystem + * (i.e., '/' on unix is native). */ - if (fsRecPtr->fsPtr->normalizePathProc != NULL) { - startAt = fsRecPtr->fsPtr->normalizePathProc(interp, pathPtr, - startAt); + for (fsRecPtr=firstFsRecPtr; fsRecPtr!=NULL; fsRecPtr=fsRecPtr->nextPtr) { + if (fsRecPtr->fsPtr != &tclNativeFilesystem) { + continue; + } + + /* + * TODO: Assume that we always find the native file system; it should + * always be there... + */ + + if (fsRecPtr->fsPtr->normalizePathProc != NULL) { + startAt = fsRecPtr->fsPtr->normalizePathProc(interp, pathPtr, + startAt); + } + break; } - break; } for (fsRecPtr=firstFsRecPtr; fsRecPtr!=NULL; fsRecPtr=fsRecPtr->nextPtr) { -- cgit v0.12 From 30938251a229de790732bbffff59a1de806d083d Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sat, 18 Nov 2017 20:21:13 +0000 Subject: Adjust the rule to look for libtcl_XXX.zip ONLY in the directory that contains the executable or the install location for tcl. The directory adjacent copy is only looked for and mounted in an install location version cannot be located. --- generic/tclZipfs.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 4a72392..80d153b 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3928,6 +3928,11 @@ int TclZipfs_AppHook(int *argc, char ***argv){ Tcl_FindExecutable(*argv[0]); archive=Tcl_GetNameOfExecutable(); TclZipfs_Init(NULL); + /* + ** Look for init.tcl in one of the locations mounted later in this function + ** and failing that, look for a file name CFG_RUNTIME_ZIPFILE adjacent to the + ** executable + */ TclSetPreInitScript( "foreach {path} {\n" " {" ZIPFS_APP_MOUNT "/tcl_library}\n" @@ -3937,6 +3942,17 @@ int TclZipfs_AppHook(int *argc, char ***argv){ " set ::tcl_library $path\n" " break\n" "}\n" +"if {![info exists ::tcl_library] || $::tcl_library eq {}} {\n" +" set zipfile [file join [file dirname [info nameofexecutable]] " CFG_RUNTIME_ZIPFILE "]\n" +" if {[file exists $zipfile]} {\n" +" zipfs mount $zipfile {" ZIPFS_ZIP_MOUNT "}\n" +" if {[file exists [file join {" ZIPFS_ZIP_MOUNT "} init.tcl]]} \{\n" +" set ::tcl_library {" ZIPFS_ZIP_MOUNT "}\n" +" } else {\n" +" zipfs unmount {" ZIPFS_ZIP_MOUNT "}\n" +" }\n" +" }\n" +"}\n" "foreach {path} {\n" " {" ZIPFS_APP_MOUNT "/tk_library}\n" " {" ZIPFS_ZIP_MOUNT "/tk_library}\n" @@ -3968,15 +3984,12 @@ int TclZipfs_AppHook(int *argc, char ***argv){ } } /* Mount zip file and dll before releasing to search */ - if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_ZIPFILE)==TCL_OK) { + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_DLLFILE)==TCL_OK) { return TCL_OK; } if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { return TCL_OK; } - if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_DLLFILE)==TCL_OK) { - return TCL_OK; - } return TCL_OK; } -- cgit v0.12 From 1d444f56103f94c966ce2541224daf28a519421a Mon Sep 17 00:00:00 2001 From: tne Date: Sat, 18 Nov 2017 20:25:25 +0000 Subject: Now that UNC paths work correctly on Windows, removing the platform specific zipfs mount point for windows --- generic/tclZipfs.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 80d153b..af19224 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -32,17 +32,10 @@ ** On windows we need VFS to look like a volume ** On Unix we need it to look like a UNC path */ -#if defined(_WIN32) || defined(_WIN64) -#define ZIPFS_VOLUME "zipfs:/" -#define ZIPFS_VOLUME_LEN 7 -#define ZIPFS_APP_MOUNT "zipfs:/app" -#define ZIPFS_ZIP_MOUNT "zipfs:/lib/tcl" -#else #define ZIPFS_VOLUME "//zipfs:/" #define ZIPFS_VOLUME_LEN 9 #define ZIPFS_APP_MOUNT "//zipfs:/app" #define ZIPFS_ZIP_MOUNT "//zipfs:/lib/tcl" -#endif /* * Various constants and offsets found in ZIP archive files */ -- cgit v0.12 From 75924256c128fb94dc0cfbddf6d56fc89aeb10e7 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Sun, 19 Nov 2017 00:06:51 +0000 Subject: Fix segmentation fault in TclOO that was noted in [16fe1b5807]. Update coroutine and TclOO object creation routines to use TclCreateObjCommandInNs. --- generic/tclBasic.c | 46 +++++++++++++++++----------------------------- generic/tclEnsemble.c | 12 +++--------- generic/tclInt.h | 4 ++-- generic/tclOO.c | 37 +++++++++++++++++++++---------------- generic/tclProc.c | 22 +++++++++++----------- tests/namespace.test | 2 +- 6 files changed, 55 insertions(+), 68 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index a51578c..2acd2e7 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -2281,11 +2281,11 @@ Tcl_CreateObjCommand( tail = cmdName; } - return tclCreateObjCommandInNs(interp, tail, (Tcl_Namespace *) nsPtr, + return TclCreateObjCommandInNs(interp, tail, (Tcl_Namespace *) nsPtr, proc, clientData, deleteProc); } -Tcl_Command tclCreateObjCommandInNs ( +Tcl_Command TclCreateObjCommandInNs ( Tcl_Interp *interp, const char *cmdName, /* Name of command, without any namespace components */ Tcl_Namespace *namespace, /* The namespace to create the command in */ @@ -8210,7 +8210,7 @@ Tcl_NRCreateCommand( return (Tcl_Command) cmdPtr; } -Tcl_Command tclNRCreateCommandInNs ( +Tcl_Command TclNRCreateCommandInNs ( Tcl_Interp *interp, const char *cmdName, Tcl_Namespace *nsPtr, @@ -8219,7 +8219,7 @@ Tcl_Command tclNRCreateCommandInNs ( ClientData clientData, Tcl_CmdDeleteProc *deleteProc) { Command *cmdPtr = (Command *) - tclCreateObjCommandInNs(interp,cmdName,nsPtr,proc,clientData,deleteProc); + TclCreateObjCommandInNs(interp,cmdName,nsPtr,proc,clientData,deleteProc); cmdPtr->nreProc = nreProc; return (Tcl_Command) cmdPtr; @@ -9009,9 +9009,9 @@ TclNRCoroutineObjCmd( { Command *cmdPtr; CoroutineData *corPtr; - const char *fullName, *procName; - Namespace *nsPtr, *altNsPtr, *cxtNsPtr; - Tcl_DString ds; + const char *procName, *simpleName; + Namespace *nsPtr, *altNsPtr, *cxtNsPtr, + *inNsPtr = (Namespace *)TclGetCurrentNamespace(interp); Namespace *lookupNsPtr = iPtr->varFramePtr->nsPtr; if (objc < 3) { @@ -9019,27 +9019,22 @@ TclNRCoroutineObjCmd( return TCL_ERROR; } - /* - * FIXME: this is copy/pasted from Tcl_ProcObjCommand. Should have - * something in tclUtil.c to find the FQ name. - */ - - fullName = TclGetString(objv[1]); - TclGetNamespaceForQualName(interp, fullName, NULL, 0, - &nsPtr, &altNsPtr, &cxtNsPtr, &procName); + procName = TclGetString(objv[1]); + TclGetNamespaceForQualName(interp, procName, inNsPtr, 0, + &nsPtr, &altNsPtr, &cxtNsPtr, &simpleName); if (nsPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't create procedure \"%s\": unknown namespace", - fullName)); + procName)); Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "NAMESPACE", NULL); return TCL_ERROR; } - if (procName == NULL) { + if (simpleName == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't create procedure \"%s\": bad procedure name", - fullName)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", fullName, NULL); + procName)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", procName, NULL); return TCL_ERROR; } @@ -9050,16 +9045,9 @@ TclNRCoroutineObjCmd( corPtr = ckalloc(sizeof(CoroutineData)); - Tcl_DStringInit(&ds); - if (nsPtr != iPtr->globalNsPtr) { - Tcl_DStringAppend(&ds, nsPtr->fullName, -1); - TclDStringAppendLiteral(&ds, "::"); - } - Tcl_DStringAppend(&ds, procName, -1); - - cmdPtr = (Command *) Tcl_NRCreateCommand(interp, Tcl_DStringValue(&ds), - /*objProc*/ NULL, TclNRInterpCoroutine, corPtr, DeleteCoroutine); - Tcl_DStringFree(&ds); + cmdPtr = (Command *) TclNRCreateCommandInNs(interp, simpleName, + (Tcl_Namespace *)nsPtr, /*objProc*/ NULL, TclNRInterpCoroutine, + corPtr, DeleteCoroutine); corPtr->cmdPtr = cmdPtr; cmdPtr->refCount++; diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 28802b0..cce7666 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -665,7 +665,7 @@ TclCreateEnsembleInNs( Tcl_Command token; ensemblePtr = ckalloc(sizeof(EnsembleConfig)); - token = tclNRCreateCommandInNs(interp, name, + token = TclNRCreateCommandInNs(interp, name, (Tcl_Namespace *) nameNsPtr, NsEnsembleImplementationCmd, NsEnsembleImplementationCmdNR, ensemblePtr, DeleteEnsembleConfig); if (token == NULL) { @@ -2605,12 +2605,7 @@ BuildEnsembleConfig( * the programmer's responsibility (or [::unknown] of course). */ - cmdObj = NewNsObj((Tcl_Namespace *) ensemblePtr->nsPtr); - if (ensemblePtr->nsPtr->parentPtr != NULL) { - Tcl_AppendStringsToObj(cmdObj, "::", name, NULL); - } else { - Tcl_AppendStringsToObj(cmdObj, name, NULL); - } + cmdObj = Tcl_NewStringObj(name, -1); cmdPrefixObj = Tcl_NewListObj(1, &cmdObj); Tcl_SetHashValue(hPtr, cmdPrefixObj); Tcl_IncrRefCount(cmdPrefixObj); @@ -2671,8 +2666,7 @@ BuildEnsembleConfig( if (isNew) { Tcl_Obj *cmdObj, *cmdPrefixObj; - TclNewObj(cmdObj); - Tcl_AppendStringsToObj(cmdObj, nsCmdName, NULL); + cmdObj = Tcl_NewStringObj(nsCmdName, -1); cmdPrefixObj = Tcl_NewListObj(1, &cmdObj); Tcl_SetHashValue(hPtr, cmdPrefixObj); Tcl_IncrRefCount(cmdPrefixObj); diff --git a/generic/tclInt.h b/generic/tclInt.h index 480ae5a..7078ba0 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2917,7 +2917,7 @@ MODULE_SCOPE void TclContinuationsCopy(Tcl_Obj *objPtr, Tcl_Obj *originObjPtr); MODULE_SCOPE int TclConvertElement(const char *src, int length, char *dst, int flags); -MODULE_SCOPE Tcl_Command tclCreateObjCommandInNs ( +MODULE_SCOPE Tcl_Command TclCreateObjCommandInNs ( Tcl_Interp *interp, const char *cmdName, Tcl_Namespace *nsPtr, @@ -2988,7 +2988,7 @@ MODULE_SCOPE double TclFloor(const mp_int *a); MODULE_SCOPE void TclFormatNaN(double value, char *buffer); MODULE_SCOPE int TclFSFileAttrIndex(Tcl_Obj *pathPtr, const char *attributeName, int *indexPtr); -MODULE_SCOPE Tcl_Command tclNRCreateCommandInNs ( +MODULE_SCOPE Tcl_Command TclNRCreateCommandInNs ( Tcl_Interp *interp, const char *cmdName, Tcl_Namespace *nsPtr, diff --git a/generic/tclOO.c b/generic/tclOO.c index e48158c..7feeb5d 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -562,7 +562,10 @@ AllocObject( Object *oPtr; Command *cmdPtr; CommandTrace *tracePtr; + Namespace *nsPtr, *altNsPtr, *cxtNsPtr; + Tcl_Namespace *inNsPtr; int creationEpoch, ignored; + const char *simpleName; oPtr = ckalloc(sizeof(Object)); memset(oPtr, 0, sizeof(Object)); @@ -652,24 +655,18 @@ AllocObject( * command is deleted). */ - if (!nameStr) { - oPtr->command = Tcl_CreateObjCommand(interp, - oPtr->namespacePtr->fullName, PublicObjectCmd, oPtr, NULL); - } else if (nameStr[0] == ':' && nameStr[1] == ':') { - oPtr->command = Tcl_CreateObjCommand(interp, nameStr, - PublicObjectCmd, oPtr, NULL); + if (nameStr) { + inNsPtr = TclGetCurrentNamespace(interp); } else { - Tcl_DString buffer; - - Tcl_DStringInit(&buffer); - Tcl_DStringAppend(&buffer, - Tcl_GetCurrentNamespace(interp)->fullName, -1); - TclDStringAppendLiteral(&buffer, "::"); - Tcl_DStringAppend(&buffer, nameStr, -1); - oPtr->command = Tcl_CreateObjCommand(interp, - Tcl_DStringValue(&buffer), PublicObjectCmd, oPtr, NULL); - Tcl_DStringFree(&buffer); + nameStr = oPtr->namespacePtr->name; + inNsPtr = oPtr->namespacePtr; } + + TclGetNamespaceForQualName(interp, nameStr, (Namespace *) inNsPtr, 0, + &nsPtr, &altNsPtr, &cxtNsPtr, &simpleName); + + oPtr->command = TclCreateObjCommandInNs(interp, simpleName, + (Tcl_Namespace *)nsPtr, PublicObjectCmd, oPtr, NULL); /* * Add the NRE command and trace directly. While this breaks a number of @@ -1795,6 +1792,11 @@ TclNRNewObjectInstance( Object *oPtr; /* + * Protect classPtr from getting cleaned up when the command is created. + */ + AddRef(classPtr); + + /* * Check if we're going to create an object over an existing command; * that's not allowed. */ @@ -1841,11 +1843,13 @@ TclNRNewObjectInstance( if (objc < 0) { *objectPtr = (Tcl_Object) oPtr; + DelRef(classPtr); return TCL_OK; } contextPtr = TclOOGetCallContext(oPtr, NULL, CONSTRUCTOR, NULL); if (contextPtr == NULL) { *objectPtr = (Tcl_Object) oPtr; + DelRef(classPtr); return TCL_OK; } @@ -1869,6 +1873,7 @@ TclNRNewObjectInstance( TclNRAddCallback(interp, FinalizeAlloc, contextPtr, oPtr, state, objectPtr); TclPushTailcallPoint(interp); + DelRef(classPtr); return TclOOInvokeContext(contextPtr, interp, objc, objv); } diff --git a/generic/tclProc.c b/generic/tclProc.c index 3c30623..b89357c 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -124,8 +124,8 @@ Tcl_ProcObjCmd( { register Interp *iPtr = (Interp *) interp; Proc *procPtr; - const char *fullName; - const char *procName, *procArgs, *procBody; + const char *procName; + const char *simpleName, *procArgs, *procBody; Namespace *nsPtr, *altNsPtr, *cxtNsPtr; Tcl_Command cmd; @@ -140,21 +140,21 @@ Tcl_ProcObjCmd( * namespace. */ - fullName = TclGetString(objv[1]); - TclGetNamespaceForQualName(interp, fullName, NULL, 0, - &nsPtr, &altNsPtr, &cxtNsPtr, &procName); + procName = TclGetString(objv[1]); + TclGetNamespaceForQualName(interp, procName, NULL, 0, + &nsPtr, &altNsPtr, &cxtNsPtr, &simpleName); if (nsPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't create procedure \"%s\": unknown namespace", - fullName)); + procName)); Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", NULL); return TCL_ERROR; } - if (procName == NULL) { + if (simpleName == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't create procedure \"%s\": bad procedure name", - fullName)); + procName)); Tcl_SetErrorCode(interp, "TCL", "VALUE", "COMMAND", NULL); return TCL_ERROR; } @@ -163,15 +163,15 @@ Tcl_ProcObjCmd( * Create the data structure to represent the procedure. */ - if (TclCreateProc(interp, nsPtr, procName, objv[2], objv[3], + if (TclCreateProc(interp, nsPtr, simpleName, objv[2], objv[3], &procPtr) != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (creating proc \""); - Tcl_AddErrorInfo(interp, procName); + Tcl_AddErrorInfo(interp, simpleName); Tcl_AddErrorInfo(interp, "\")"); return TCL_ERROR; } - cmd = tclNRCreateCommandInNs(interp, procName, (Tcl_Namespace *) nsPtr, + cmd = TclNRCreateCommandInNs(interp, simpleName, (Tcl_Namespace *) nsPtr, TclObjInterpProc, TclNRInterpProc, procPtr, TclProcDeleteProc); /* diff --git a/tests/namespace.test b/tests/namespace.test index 220fa53..de96682 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -1920,7 +1920,7 @@ test namespace-44.5 {ensemble: errors} -setup { foobar foobarcon } -cleanup { rename foobar {} -} -returnCodes error -result {invalid command name "::foobarconfigure"} +} -returnCodes error -result {invalid command name "foobarconfigure"} test namespace-44.6 {ensemble: errors} -returnCodes error -body { namespace ensemble create gorp } -result {wrong # args: should be "namespace ensemble create ?option value ...?"} -- cgit v0.12 From 280b6aa62e68db8d71bc519af2d89d05c745cfcc Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sun, 19 Nov 2017 18:16:43 +0000 Subject: Added handling to allow Tclsh to intercept a zip file fed as the first command line argument, and open it as a kit --- generic/tclZipfs.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index af19224..689a648 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3975,6 +3975,29 @@ int TclZipfs_AppHook(int *argc, char ***argv){ if(found==TCL_OK) { return TCL_OK; } + } else if (*argc>1) { + archive=(*argv)[1]; + fflush(stdout); + if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { + int found; + Tcl_Obj *vfsinitscript; + vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/main.tcl",-1); + Tcl_IncrRefCount(vfsinitscript); + if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { + /* Startup script should be set before calling Tcl_AppInit */ + Tcl_SetStartupScript(vfsinitscript,NULL); + } else { + Tcl_DecrRefCount(vfsinitscript); + } + /* Set Tcl Encodings */ + vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library/init.tcl",-1); + Tcl_IncrRefCount(vfsinitscript); + found=Tcl_FSAccess(vfsinitscript,F_OK); + Tcl_DecrRefCount(vfsinitscript); + if(found==TCL_OK) { + return TCL_OK; + } + } } /* Mount zip file and dll before releasing to search */ if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_DLLFILE)==TCL_OK) { -- cgit v0.12 From c2eeda3f09a8b05e10e5f8f968fc28bb2dcf3750 Mon Sep 17 00:00:00 2001 From: pspjuth Date: Sun, 19 Nov 2017 18:40:13 +0000 Subject: Changed math functions min and max to C implementations. --- generic/tclBasic.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++ generic/tclExecute.c | 2 -- generic/tclInt.h | 2 ++ library/init.tcl | 37 ---------------------------- tests/expr-old.test | 20 ++++++++++++--- 5 files changed, 87 insertions(+), 43 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index acdcf41..eefb102 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -118,6 +118,8 @@ static Tcl_ObjCmdProc ExprEntierFunc; static Tcl_ObjCmdProc ExprFloorFunc; static Tcl_ObjCmdProc ExprIntFunc; static Tcl_ObjCmdProc ExprIsqrtFunc; +static Tcl_ObjCmdProc ExprMaxFunc; +static Tcl_ObjCmdProc ExprMinFunc; static Tcl_ObjCmdProc ExprRandFunc; static Tcl_ObjCmdProc ExprRoundFunc; static Tcl_ObjCmdProc ExprSqrtFunc; @@ -321,6 +323,8 @@ static const BuiltinFuncDef BuiltinFuncTable[] = { { "isqrt", ExprIsqrtFunc, NULL }, { "log", ExprUnaryFunc, (ClientData) log }, { "log10", ExprUnaryFunc, (ClientData) log10 }, + { "max", ExprMaxFunc, NULL }, + { "min", ExprMinFunc, NULL }, { "pow", ExprBinaryFunc, (ClientData) pow }, { "rand", ExprRandFunc, NULL }, { "round", ExprRoundFunc, NULL }, @@ -7677,6 +7681,71 @@ ExprWideFunc( return TCL_OK; } +/* + * Common implmentation of max() and min(). + */ +static int +ExprMaxMinFunc( + 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 op) /* Comparison direction */ +{ + Tcl_Obj *res; + double d; + int type, i; + ClientData ptr; + + if (objc < 2) { + MathFuncWrongNumArgs(interp, 2, objc, objv); + return TCL_ERROR; + } + res = objv[1]; + for (i = 1; i < objc; i++) { + if (TclGetNumberFromObj(interp, objv[i], &ptr, &type) != TCL_OK) { + return TCL_ERROR; + } + if (type == TCL_NUMBER_NAN) { + /* + * Get the error message for NaN. + */ + + Tcl_GetDoubleFromObj(interp, objv[i], &d); + return TCL_ERROR; + } + if (TclCompareTwoNumbers(objv[i], res) == op) { + res = objv[i]; + } + } + + Tcl_SetObjResult(interp, res); + return TCL_OK; +} + +static int +ExprMaxFunc( + 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. */ +{ + return ExprMaxMinFunc(clientData, interp, objc, objv, MP_GT); +} + +static int +ExprMinFunc( + 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. */ +{ + return ExprMaxMinFunc(clientData, interp, objc, objv, MP_LT); +} + static int ExprRandFunc( ClientData clientData, /* Ignored. */ diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 761a23e..c4aa381 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -744,8 +744,6 @@ static ByteCode * CompileExprObj(Tcl_Interp *interp, Tcl_Obj *objPtr); static void DeleteExecStack(ExecStack *esPtr); static void DupExprCodeInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); -MODULE_SCOPE int TclCompareTwoNumbers(Tcl_Obj *valuePtr, - Tcl_Obj *value2Ptr); static Tcl_Obj * ExecuteExtendedBinaryMathOp(Tcl_Interp *interp, int opcode, Tcl_Obj **constants, Tcl_Obj *valuePtr, Tcl_Obj *value2Ptr); diff --git a/generic/tclInt.h b/generic/tclInt.h index 91c8b96..64c60e4 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2878,6 +2878,8 @@ MODULE_SCOPE int TclChanCaughtErrorBypass(Tcl_Interp *interp, Tcl_Channel chan); MODULE_SCOPE Tcl_ObjCmdProc TclChannelNamesCmd; MODULE_SCOPE Tcl_NRPostProc TclClearRootEnsemble; +MODULE_SCOPE int TclCompareTwoNumbers(Tcl_Obj *valuePtr, + Tcl_Obj *value2Ptr); MODULE_SCOPE ContLineLoc *TclContinuationsEnter(Tcl_Obj *objPtr, int num, int *loc); MODULE_SCOPE void TclContinuationsEnterDerived(Tcl_Obj *objPtr, diff --git a/library/init.tcl b/library/init.tcl index c31eea3..d5beb69 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -73,43 +73,6 @@ namespace eval tcl { encoding dirs $Path } } - - # TIP #255 min and max functions - namespace eval mathfunc { - proc min {args} { - if {![llength $args]} { - return -code error \ - "too few arguments to math function \"min\"" - } - set val Inf - foreach arg $args { - # This will handle forcing the numeric value without - # ruining the internal type of a numeric object - if {[catch {expr {double($arg)}} err]} { - return -code error $err - } - if {$arg < $val} {set val $arg} - } - return $val - } - proc max {args} { - if {![llength $args]} { - return -code error \ - "too few arguments to math function \"max\"" - } - set val -Inf - foreach arg $args { - # This will handle forcing the numeric value without - # ruining the internal type of a numeric object - if {[catch {expr {double($arg)}} err]} { - return -code error $err - } - if {$arg > $val} {set val $arg} - } - return $val - } - namespace export min max - } } # Windows specific end of initialization diff --git a/tests/expr-old.test b/tests/expr-old.test index 06a00ba..262a71b 100644 --- a/tests/expr-old.test +++ b/tests/expr-old.test @@ -1159,8 +1159,8 @@ test expr-old-40.2 {min math function} -body { expr {min(0.0)} } -result 0.0 test expr-old-40.3 {min math function} -body { - list [catch {expr {min()}} msg] $msg -} -result {1 {too few arguments to math function "min"}} + expr {min()} +} -returnCodes error -result {too few arguments for math function "min"} test expr-old-40.4 {min math function} -body { expr {min(wide(-1) << 30, 4.5, -10)} } -result [expr {wide(-1) << 30}] @@ -1170,6 +1170,12 @@ test expr-old-40.5 {min math function} -body { test expr-old-40.6 {min math function} -body { expr {min(300, "0xFF")} } -result 255 +test expr-old-40.7 {min math function} -body { + expr min(1[string repeat 0 10000], 1e300) +} -result 1e+300 +test expr-old-40.8 {min math function} -body { + expr {min(0, "a")} +} -returnCodes error -match glob -result * test expr-old-41.1 {max math function} -body { expr {max(0)} @@ -1178,8 +1184,8 @@ test expr-old-41.2 {max math function} -body { expr {max(0.0)} } -result 0.0 test expr-old-41.3 {max math function} -body { - list [catch {expr {max()}} msg] $msg -} -result {1 {too few arguments to math function "max"}} + expr {max()} +} -returnCodes error -result {too few arguments for math function "max"} test expr-old-41.4 {max math function} -body { expr {max(wide(1) << 30, 4.5, -10)} } -result [expr {wide(1) << 30}] @@ -1189,6 +1195,12 @@ test expr-old-41.5 {max math function} -body { test expr-old-41.6 {max math function} -body { expr {max(200, "0xFF")} } -result 255 +test expr-old-41.7 {max math function} -body { + expr max(1[string repeat 0 10000], 1e300) +} -result 1[string repeat 0 10000] +test expr-old-41.8 {max math function} -body { + expr {max(0, "a")} +} -returnCodes error -match glob -result * # Special test for Pentium arithmetic bug of 1994: -- cgit v0.12 From b946ce971fbde11b9739fc0b77237ed382e24bd0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 20 Nov 2017 08:58:39 +0000 Subject: Fix [e058307eef73cf21cf6805ad7c778e1024f9eb7d|e058307eef]: Use of values.h breaks build of Tk trunk on macOS --- unix/configure | 10 ---------- unix/tcl.m4 | 2 -- unix/tclConfig.h.in | 3 --- unix/tclUnixPort.h | 3 --- 4 files changed, 18 deletions(-) diff --git a/unix/configure b/unix/configure index 51d694f..90116c8 100755 --- a/unix/configure +++ b/unix/configure @@ -3733,16 +3733,6 @@ $as_echo "#define NO_DIRENT_H 1" >>confdefs.h fi - ac_fn_c_check_header_mongrel "$LINENO" "values.h" "ac_cv_header_values_h" "$ac_includes_default" -if test "x$ac_cv_header_values_h" = xyes; then : - -else - -$as_echo "#define NO_VALUES_H 1" >>confdefs.h - -fi - - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : tcl_ok=1 diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 9aa3eb2..51459c9 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -2040,7 +2040,6 @@ dnl # preprocessing tests use only CPPFLAGS. # # Defines some of the following vars: # NO_DIRENT_H -# NO_VALUES_H # NO_STDLIB_H # NO_STRING_H # NO_SYS_WAIT_H @@ -2078,7 +2077,6 @@ closedir(d); AC_DEFINE(NO_DIRENT_H, 1, [Do we have ?]) fi - AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have ?])]) AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0) diff --git a/unix/tclConfig.h.in b/unix/tclConfig.h.in index 28ce012..4902083 100644 --- a/unix/tclConfig.h.in +++ b/unix/tclConfig.h.in @@ -331,9 +331,6 @@ /* Do we have a usable 'union wait'? */ #undef NO_UNION_WAIT -/* Do we have ? */ -#undef NO_VALUES_H - /* Do we have wait3() */ #undef NO_WAIT3 diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index 8b766d6..d464f05 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -182,9 +182,6 @@ extern int TclUnixSetBlockingMode(int fd, int mode); */ #include -#ifndef NO_VALUES_H -# include -#endif #ifndef FLT_MAX # ifdef MAXFLOAT -- cgit v0.12 From bc3e198cba9e40c015a6acfa992c69434274dde6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 20 Nov 2017 10:15:59 +0000 Subject: Fix error-message for min/math functions: "to" -> "for", for consistancy with the error-messages for other math functions. --- library/init.tcl | 4 ++-- tests/expr-old.test | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/library/init.tcl b/library/init.tcl index 87d9f14..13a4300 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -79,7 +79,7 @@ namespace eval tcl { proc min {args} { if {![llength $args]} { return -code error \ - "too few arguments to math function \"min\"" + "too few arguments for math function \"min\"" } set val Inf foreach arg $args { @@ -95,7 +95,7 @@ namespace eval tcl { proc max {args} { if {![llength $args]} { return -code error \ - "too few arguments to math function \"max\"" + "too few arguments for math function \"max\"" } set val -Inf foreach arg $args { diff --git a/tests/expr-old.test b/tests/expr-old.test index 3adfb63..8c159b2 100644 --- a/tests/expr-old.test +++ b/tests/expr-old.test @@ -1159,8 +1159,8 @@ test expr-old-40.2 {min math function} -body { expr {min(0.0)} } -result 0.0 test expr-old-40.3 {min math function} -body { - list [catch {expr {min()}} msg] $msg -} -result {1 {too few arguments to math function "min"}} + expr {min()} +} -returnCodes error -result {too few arguments for math function "min"} test expr-old-40.4 {min math function} -body { expr {min(wide(-1) << 30, 4.5, -10)} } -result [expr {wide(-1) << 30}] @@ -1170,6 +1170,12 @@ test expr-old-40.5 {min math function} -body { test expr-old-40.6 {min math function} -body { expr {min(300, "0xFF")} } -result 255 +test expr-old-40.7 {min math function} -body { + expr min(1[string repeat 0 10000], 1e300) +} -result 1e+300 +test expr-old-40.8 {min math function} -body { + expr {min(0, "a")} +} -returnCodes error -match glob -result * test expr-old-41.1 {max math function} -body { expr {max(0)} @@ -1178,8 +1184,8 @@ test expr-old-41.2 {max math function} -body { expr {max(0.0)} } -result 0.0 test expr-old-41.3 {max math function} -body { - list [catch {expr {max()}} msg] $msg -} -result {1 {too few arguments to math function "max"}} + expr {max()} +} -returnCodes error -result {too few arguments for math function "max"} test expr-old-41.4 {max math function} -body { expr {max(wide(1) << 30, 4.5, -10)} } -result [expr {wide(1) << 30}] @@ -1189,6 +1195,12 @@ test expr-old-41.5 {max math function} -body { test expr-old-41.6 {max math function} -body { expr {max(200, "0xFF")} } -result 255 +test expr-old-41.7 {max math function} -body { + expr max(1[string repeat 0 10000], 1e300) +} -result 1[string repeat 0 10000] +test expr-old-41.8 {max math function} -body { + expr {max(0, "a")} +} -returnCodes error -match glob -result * # Special test for Pentium arithmetic bug of 1994: -- cgit v0.12 From a1bc5b8a2b3fbc46b0207124137c9b2a5a8cced1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 20 Nov 2017 12:07:08 +0000 Subject: If Tcl is compiled with -DTCL_NO_DEPRECATED, remove a lot of (internal) stub entries which correspond to functions which will be removed in Tcl 9. This commit should have been part of [7849f573c0e7d758|this] earlier commit. No effect when Tcl is not compiled with -DTCL_NO_DEPRECATED. --- generic/tclIO.c | 2 + generic/tclInt.decls | 28 +++---- generic/tclIntDecls.h | 200 +++++++++++++++++++------------------------------- generic/tclStubInit.c | 67 ++++++++++++----- unix/tclUnixThrd.c | 2 + 5 files changed, 143 insertions(+), 156 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index df04794..81fd298 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -9032,6 +9032,7 @@ ZeroTransferTimerProc( *---------------------------------------------------------------------- */ +#if !defined(TCL_NO_DEPRECATED) int TclCopyChannelOld( Tcl_Interp *interp, /* Current interpreter. */ @@ -9043,6 +9044,7 @@ TclCopyChannelOld( return TclCopyChannel(interp, inChan, outChan, (Tcl_WideInt) toRead, cmdPtr); } +#endif int TclCopyChannel( diff --git a/generic/tclInt.decls b/generic/tclInt.decls index b683a29..33bf0b3 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -453,26 +453,26 @@ declare 111 { Tcl_ResolveCompiledVarProc *compiledVarProc) } declare 112 { - int Tcl_AppendExportList(Tcl_Interp *interp, Tcl_Namespace *nsPtr, + int TclAppendExportList(Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *objPtr) } declare 113 { - Tcl_Namespace *Tcl_CreateNamespace(Tcl_Interp *interp, const char *name, + Tcl_Namespace *TclCreateNamespace(Tcl_Interp *interp, const char *name, ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc) } declare 114 { - void Tcl_DeleteNamespace(Tcl_Namespace *nsPtr) + void TclDeleteNamespace(Tcl_Namespace *nsPtr) } declare 115 { - int Tcl_Export(Tcl_Interp *interp, Tcl_Namespace *nsPtr, + int TclExport(Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int resetListFirst) } declare 116 { - Tcl_Command Tcl_FindCommand(Tcl_Interp *interp, const char *name, + Tcl_Command TclFindCommand(Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags) } declare 117 { - Tcl_Namespace *Tcl_FindNamespace(Tcl_Interp *interp, const char *name, + Tcl_Namespace *TclFindNamespace(Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags) } declare 118 { @@ -488,28 +488,28 @@ declare 120 { Tcl_Namespace *contextNsPtr, int flags) } declare 121 { - int Tcl_ForgetImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr, + int TclForgetImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern) } declare 122 { - Tcl_Command Tcl_GetCommandFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr) + Tcl_Command TclGetCommandFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr) } declare 123 { - void Tcl_GetCommandFullName(Tcl_Interp *interp, Tcl_Command command, + void TclGetCommandFullName(Tcl_Interp *interp, Tcl_Command command, Tcl_Obj *objPtr) } declare 124 { - Tcl_Namespace *Tcl_GetCurrentNamespace(Tcl_Interp *interp) + Tcl_Namespace *TclGetCurrentNamespace_(Tcl_Interp *interp) } declare 125 { - Tcl_Namespace *Tcl_GetGlobalNamespace(Tcl_Interp *interp) + Tcl_Namespace *TclGetGlobalNamespace_(Tcl_Interp *interp) } declare 126 { void Tcl_GetVariableFullName(Tcl_Interp *interp, Tcl_Var variable, Tcl_Obj *objPtr) } declare 127 { - int Tcl_Import(Tcl_Interp *interp, Tcl_Namespace *nsPtr, + int TclImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int allowOverwrite) } declare 128 { @@ -724,10 +724,10 @@ declare 177 { const char *operation, const char *reason) } declare 178 { - void Tcl_SetStartupScript(Tcl_Obj *pathPtr, const char *encodingName) + void TclSetStartupScript(Tcl_Obj *pathPtr, const char *encodingName) } declare 179 { - Tcl_Obj *Tcl_GetStartupScript(const char **encodingNamePtr) + Tcl_Obj *TclGetStartupScript(const char **encodingNamePtr) } # REMOVED diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 4244362..22b8072 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -28,22 +28,6 @@ # endif #endif -/* [Bug #803489] Tcl_FindNamespace problem in the Stubs table */ -#undef Tcl_CreateNamespace -#undef Tcl_DeleteNamespace -#undef Tcl_AppendExportList -#undef Tcl_Export -#undef Tcl_Import -#undef Tcl_ForgetImport -#undef Tcl_GetCurrentNamespace -#undef Tcl_GetGlobalNamespace -#undef Tcl_FindNamespace -#undef Tcl_FindCommand -#undef Tcl_GetCommandFromObj -#undef Tcl_GetCommandFullName -#undef Tcl_SetStartupScript -#undef Tcl_GetStartupScript - /* * WARNING: This file is automatically generated by the tools/genStubs.tcl * script. Any modifications to the function declarations below should be made @@ -287,22 +271,22 @@ EXTERN void Tcl_AddInterpResolvers(Tcl_Interp *interp, Tcl_ResolveVarProc *varProc, Tcl_ResolveCompiledVarProc *compiledVarProc); /* 112 */ -EXTERN int Tcl_AppendExportList(Tcl_Interp *interp, +EXTERN int TclAppendExportList(Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *objPtr); /* 113 */ -EXTERN Tcl_Namespace * Tcl_CreateNamespace(Tcl_Interp *interp, +EXTERN Tcl_Namespace * TclCreateNamespace(Tcl_Interp *interp, const char *name, ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc); /* 114 */ -EXTERN void Tcl_DeleteNamespace(Tcl_Namespace *nsPtr); +EXTERN void TclDeleteNamespace(Tcl_Namespace *nsPtr); /* 115 */ -EXTERN int Tcl_Export(Tcl_Interp *interp, Tcl_Namespace *nsPtr, +EXTERN int TclExport(Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int resetListFirst); /* 116 */ -EXTERN Tcl_Command Tcl_FindCommand(Tcl_Interp *interp, const char *name, +EXTERN Tcl_Command TclFindCommand(Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 117 */ -EXTERN Tcl_Namespace * Tcl_FindNamespace(Tcl_Interp *interp, +EXTERN Tcl_Namespace * TclFindNamespace(Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 118 */ @@ -317,23 +301,23 @@ EXTERN Tcl_Var Tcl_FindNamespaceVar(Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 121 */ -EXTERN int Tcl_ForgetImport(Tcl_Interp *interp, +EXTERN int TclForgetImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern); /* 122 */ -EXTERN Tcl_Command Tcl_GetCommandFromObj(Tcl_Interp *interp, +EXTERN Tcl_Command TclGetCommandFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr); /* 123 */ -EXTERN void Tcl_GetCommandFullName(Tcl_Interp *interp, +EXTERN void TclGetCommandFullName(Tcl_Interp *interp, Tcl_Command command, Tcl_Obj *objPtr); /* 124 */ -EXTERN Tcl_Namespace * Tcl_GetCurrentNamespace(Tcl_Interp *interp); +EXTERN Tcl_Namespace * TclGetCurrentNamespace_(Tcl_Interp *interp); /* 125 */ -EXTERN Tcl_Namespace * Tcl_GetGlobalNamespace(Tcl_Interp *interp); +EXTERN Tcl_Namespace * TclGetGlobalNamespace_(Tcl_Interp *interp); /* 126 */ EXTERN void Tcl_GetVariableFullName(Tcl_Interp *interp, Tcl_Var variable, Tcl_Obj *objPtr); /* 127 */ -EXTERN int Tcl_Import(Tcl_Interp *interp, Tcl_Namespace *nsPtr, +EXTERN int TclImport(Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int allowOverwrite); /* 128 */ EXTERN void Tcl_PopCallFrame(Tcl_Interp *interp); @@ -465,10 +449,10 @@ EXTERN void TclVarErrMsg(Tcl_Interp *interp, const char *part1, const char *part2, const char *operation, const char *reason); /* 178 */ -EXTERN void Tcl_SetStartupScript(Tcl_Obj *pathPtr, +EXTERN void TclSetStartupScript(Tcl_Obj *pathPtr, const char *encodingName); /* 179 */ -EXTERN Tcl_Obj * Tcl_GetStartupScript(const char **encodingNamePtr); +EXTERN Tcl_Obj * TclGetStartupScript(const char **encodingNamePtr); /* Slot 180 is reserved */ /* Slot 181 is reserved */ /* 182 */ @@ -767,22 +751,22 @@ typedef struct TclIntStubs { int (*tclUpdateReturnInfo) (Interp *iPtr); /* 109 */ int (*tclSockMinimumBuffers) (void *sock, int size); /* 110 */ void (*tcl_AddInterpResolvers) (Tcl_Interp *interp, const char *name, Tcl_ResolveCmdProc *cmdProc, Tcl_ResolveVarProc *varProc, Tcl_ResolveCompiledVarProc *compiledVarProc); /* 111 */ - int (*tcl_AppendExportList) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *objPtr); /* 112 */ - Tcl_Namespace * (*tcl_CreateNamespace) (Tcl_Interp *interp, const char *name, ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc); /* 113 */ - void (*tcl_DeleteNamespace) (Tcl_Namespace *nsPtr); /* 114 */ - int (*tcl_Export) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int resetListFirst); /* 115 */ - Tcl_Command (*tcl_FindCommand) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 116 */ - Tcl_Namespace * (*tcl_FindNamespace) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 117 */ + int (*tclAppendExportList) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, Tcl_Obj *objPtr); /* 112 */ + Tcl_Namespace * (*tclCreateNamespace) (Tcl_Interp *interp, const char *name, ClientData clientData, Tcl_NamespaceDeleteProc *deleteProc); /* 113 */ + void (*tclDeleteNamespace) (Tcl_Namespace *nsPtr); /* 114 */ + int (*tclExport) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int resetListFirst); /* 115 */ + Tcl_Command (*tclFindCommand) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 116 */ + Tcl_Namespace * (*tclFindNamespace) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 117 */ int (*tcl_GetInterpResolvers) (Tcl_Interp *interp, const char *name, Tcl_ResolverInfo *resInfo); /* 118 */ int (*tcl_GetNamespaceResolvers) (Tcl_Namespace *namespacePtr, Tcl_ResolverInfo *resInfo); /* 119 */ Tcl_Var (*tcl_FindNamespaceVar) (Tcl_Interp *interp, const char *name, Tcl_Namespace *contextNsPtr, int flags); /* 120 */ - int (*tcl_ForgetImport) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern); /* 121 */ - Tcl_Command (*tcl_GetCommandFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 122 */ - void (*tcl_GetCommandFullName) (Tcl_Interp *interp, Tcl_Command command, Tcl_Obj *objPtr); /* 123 */ - Tcl_Namespace * (*tcl_GetCurrentNamespace) (Tcl_Interp *interp); /* 124 */ - Tcl_Namespace * (*tcl_GetGlobalNamespace) (Tcl_Interp *interp); /* 125 */ + int (*tclForgetImport) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern); /* 121 */ + Tcl_Command (*tclGetCommandFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 122 */ + void (*tclGetCommandFullName) (Tcl_Interp *interp, Tcl_Command command, Tcl_Obj *objPtr); /* 123 */ + Tcl_Namespace * (*tclGetCurrentNamespace_) (Tcl_Interp *interp); /* 124 */ + Tcl_Namespace * (*tclGetGlobalNamespace_) (Tcl_Interp *interp); /* 125 */ void (*tcl_GetVariableFullName) (Tcl_Interp *interp, Tcl_Var variable, Tcl_Obj *objPtr); /* 126 */ - int (*tcl_Import) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int allowOverwrite); /* 127 */ + int (*tclImport) (Tcl_Interp *interp, Tcl_Namespace *nsPtr, const char *pattern, int allowOverwrite); /* 127 */ void (*tcl_PopCallFrame) (Tcl_Interp *interp); /* 128 */ int (*tcl_PushCallFrame) (Tcl_Interp *interp, Tcl_CallFrame *framePtr, Tcl_Namespace *nsPtr, int isProcCallFrame); /* 129 */ int (*tcl_RemoveInterpResolvers) (Tcl_Interp *interp, const char *name); /* 130 */ @@ -833,8 +817,8 @@ typedef struct TclIntStubs { int (*tclCallVarTraces) (Interp *iPtr, Var *arrayPtr, Var *varPtr, const char *part1, const char *part2, int flags, int leaveErrMsg); /* 175 */ void (*tclCleanupVar) (Var *varPtr, Var *arrayPtr); /* 176 */ void (*tclVarErrMsg) (Tcl_Interp *interp, const char *part1, const char *part2, const char *operation, const char *reason); /* 177 */ - void (*tcl_SetStartupScript) (Tcl_Obj *pathPtr, const char *encodingName); /* 178 */ - Tcl_Obj * (*tcl_GetStartupScript) (const char **encodingNamePtr); /* 179 */ + void (*tclSetStartupScript) (Tcl_Obj *pathPtr, const char *encodingName); /* 178 */ + Tcl_Obj * (*tclGetStartupScript) (const char **encodingNamePtr); /* 179 */ void (*reserved180)(void); void (*reserved181)(void); TCL_DEPRECATED_API("") struct tm * (*tclpLocaltime) (const time_t *clock); /* 182 */ @@ -1099,38 +1083,38 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclSockMinimumBuffers) /* 110 */ #define Tcl_AddInterpResolvers \ (tclIntStubsPtr->tcl_AddInterpResolvers) /* 111 */ -#define Tcl_AppendExportList \ - (tclIntStubsPtr->tcl_AppendExportList) /* 112 */ -#define Tcl_CreateNamespace \ - (tclIntStubsPtr->tcl_CreateNamespace) /* 113 */ -#define Tcl_DeleteNamespace \ - (tclIntStubsPtr->tcl_DeleteNamespace) /* 114 */ -#define Tcl_Export \ - (tclIntStubsPtr->tcl_Export) /* 115 */ -#define Tcl_FindCommand \ - (tclIntStubsPtr->tcl_FindCommand) /* 116 */ -#define Tcl_FindNamespace \ - (tclIntStubsPtr->tcl_FindNamespace) /* 117 */ +#define TclAppendExportList \ + (tclIntStubsPtr->tclAppendExportList) /* 112 */ +#define TclCreateNamespace \ + (tclIntStubsPtr->tclCreateNamespace) /* 113 */ +#define TclDeleteNamespace \ + (tclIntStubsPtr->tclDeleteNamespace) /* 114 */ +#define TclExport \ + (tclIntStubsPtr->tclExport) /* 115 */ +#define TclFindCommand \ + (tclIntStubsPtr->tclFindCommand) /* 116 */ +#define TclFindNamespace \ + (tclIntStubsPtr->tclFindNamespace) /* 117 */ #define Tcl_GetInterpResolvers \ (tclIntStubsPtr->tcl_GetInterpResolvers) /* 118 */ #define Tcl_GetNamespaceResolvers \ (tclIntStubsPtr->tcl_GetNamespaceResolvers) /* 119 */ #define Tcl_FindNamespaceVar \ (tclIntStubsPtr->tcl_FindNamespaceVar) /* 120 */ -#define Tcl_ForgetImport \ - (tclIntStubsPtr->tcl_ForgetImport) /* 121 */ -#define Tcl_GetCommandFromObj \ - (tclIntStubsPtr->tcl_GetCommandFromObj) /* 122 */ -#define Tcl_GetCommandFullName \ - (tclIntStubsPtr->tcl_GetCommandFullName) /* 123 */ -#define Tcl_GetCurrentNamespace \ - (tclIntStubsPtr->tcl_GetCurrentNamespace) /* 124 */ -#define Tcl_GetGlobalNamespace \ - (tclIntStubsPtr->tcl_GetGlobalNamespace) /* 125 */ +#define TclForgetImport \ + (tclIntStubsPtr->tclForgetImport) /* 121 */ +#define TclGetCommandFromObj \ + (tclIntStubsPtr->tclGetCommandFromObj) /* 122 */ +#define TclGetCommandFullName \ + (tclIntStubsPtr->tclGetCommandFullName) /* 123 */ +#define TclGetCurrentNamespace_ \ + (tclIntStubsPtr->tclGetCurrentNamespace_) /* 124 */ +#define TclGetGlobalNamespace_ \ + (tclIntStubsPtr->tclGetGlobalNamespace_) /* 125 */ #define Tcl_GetVariableFullName \ (tclIntStubsPtr->tcl_GetVariableFullName) /* 126 */ -#define Tcl_Import \ - (tclIntStubsPtr->tcl_Import) /* 127 */ +#define TclImport \ + (tclIntStubsPtr->tclImport) /* 127 */ #define Tcl_PopCallFrame \ (tclIntStubsPtr->tcl_PopCallFrame) /* 128 */ #define Tcl_PushCallFrame \ @@ -1221,10 +1205,10 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclCleanupVar) /* 176 */ #define TclVarErrMsg \ (tclIntStubsPtr->tclVarErrMsg) /* 177 */ -#define Tcl_SetStartupScript \ - (tclIntStubsPtr->tcl_SetStartupScript) /* 178 */ -#define Tcl_GetStartupScript \ - (tclIntStubsPtr->tcl_GetStartupScript) /* 179 */ +#define TclSetStartupScript \ + (tclIntStubsPtr->tclSetStartupScript) /* 178 */ +#define TclGetStartupScript \ + (tclIntStubsPtr->tclGetStartupScript) /* 179 */ /* Slot 180 is reserved */ /* Slot 181 is reserved */ #define TclpLocaltime \ @@ -1361,58 +1345,28 @@ extern const TclIntStubs *tclIntStubsPtr; #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT -#undef TclGetStartupScriptFileName -#undef TclSetStartupScriptFileName -#undef TclGetStartupScriptPath -#undef TclSetStartupScriptPath -#undef TclBackgroundException - #if defined(USE_TCL_STUBS) -# undef Tcl_SetStartupScript -# define Tcl_SetStartupScript \ - (tclStubsPtr->tcl_SetStartupScript) /* 622 */ -# undef Tcl_GetStartupScript -# define Tcl_GetStartupScript \ - (tclStubsPtr->tcl_GetStartupScript) /* 623 */ -# undef Tcl_CreateNamespace -# define Tcl_CreateNamespace \ - (tclStubsPtr->tcl_CreateNamespace) /* 506 */ -# undef Tcl_DeleteNamespace -# define Tcl_DeleteNamespace \ - (tclStubsPtr->tcl_DeleteNamespace) /* 507 */ -# undef Tcl_AppendExportList -# define Tcl_AppendExportList \ - (tclStubsPtr->tcl_AppendExportList) /* 508 */ -# undef Tcl_Export -# define Tcl_Export \ - (tclStubsPtr->tcl_Export) /* 509 */ -# undef Tcl_Import -# define Tcl_Import \ - (tclStubsPtr->tcl_Import) /* 510 */ -# undef Tcl_ForgetImport -# define Tcl_ForgetImport \ - (tclStubsPtr->tcl_ForgetImport) /* 511 */ -# undef Tcl_GetCurrentNamespace -# define Tcl_GetCurrentNamespace \ - (tclStubsPtr->tcl_GetCurrentNamespace) /* 512 */ -# undef Tcl_GetGlobalNamespace -# define Tcl_GetGlobalNamespace \ - (tclStubsPtr->tcl_GetGlobalNamespace) /* 513 */ -# undef Tcl_FindNamespace -# define Tcl_FindNamespace \ - (tclStubsPtr->tcl_FindNamespace) /* 514 */ -# undef Tcl_FindCommand -# define Tcl_FindCommand \ - (tclStubsPtr->tcl_FindCommand) /* 515 */ -# undef Tcl_GetCommandFromObj -# define Tcl_GetCommandFromObj \ - (tclStubsPtr->tcl_GetCommandFromObj) /* 516 */ -# undef Tcl_GetCommandFullName -# define Tcl_GetCommandFullName \ - (tclStubsPtr->tcl_GetCommandFullName) /* 517 */ +# undef TclGetStartupScriptFileName +# undef TclSetStartupScriptFileName +# undef TclGetStartupScriptPath +# undef TclSetStartupScriptPath +# undef TclBackgroundException +# undef TclSetStartupScript +# undef TclGetStartupScript +# undef TclCreateNamespace +# undef TclDeleteNamespace +# undef TclAppendExportList +# undef TclExport +# undef TclImport +# undef TclForgetImport +# undef TclGetCurrentNamespace_ +# undef TclGetGlobalNamespace_ +# undef TclFindNamespace +# undef TclFindCommand +# undef TclGetCommandFromObj +# undef TclGetCommandFullName +# undef TclCopyChannelOld +# undef TclSockMinimumBuffersOld #endif -#undef TclCopyChannelOld -#undef TclSockMinimumBuffersOld - #endif /* _TCLINTDECLS */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 24b28e5..d2de021 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -72,11 +72,6 @@ static int TclSockMinimumBuffersOld(int sock, int size) # define TclBNInitBignumFromWideUInt 0 # define TclBNInitBignumFromWideInt 0 # define TclBNInitBignumFromLong 0 -# define Tcl_AppendResultVA 0 -# define Tcl_AppendStringsToObjVA 0 -# define Tcl_SetErrorCodeVA 0 -# define Tcl_PanicVA 0 -# define Tcl_VarEvalVA 0 #else #define TclSetStartupScriptPath setStartupScriptPath static void TclSetStartupScriptPath(Tcl_Obj *path) @@ -371,6 +366,26 @@ static int formatInt(char *buffer, int n){ # define TclBackgroundException 0 # undef TclpReaddir # define TclpReaddir 0 +# define TclSetStartupScript 0 +# define TclGetStartupScript 0 +# define TclCreateNamespace 0 +# define TclDeleteNamespace 0 +# define TclAppendExportList 0 +# define TclExport 0 +# define TclImport 0 +# define TclForgetImport 0 +# define TclGetCurrentNamespace_ 0 +# define TclGetGlobalNamespace_ 0 +# define TclFindNamespace 0 +# define TclFindCommand 0 +# define TclGetCommandFromObj 0 +# define TclGetCommandFullName 0 +# define TclCopyChannelOld 0 +# define Tcl_AppendResultVA 0 +# define Tcl_AppendStringsToObjVA 0 +# define Tcl_SetErrorCodeVA 0 +# define Tcl_PanicVA 0 +# define Tcl_VarEvalVA 0 # undef TclpGetDate # define TclpGetDate 0 # undef TclpLocaltime @@ -383,6 +398,20 @@ static int formatInt(char *buffer, int n){ # define Tcl_SeekOld seekOld # define Tcl_TellOld tellOld # define TclBackgroundException Tcl_BackgroundException +# define TclSetStartupScript Tcl_SetStartupScript +# define TclGetStartupScript Tcl_GetStartupScript +# define TclCreateNamespace Tcl_CreateNamespace +# define TclDeleteNamespace Tcl_DeleteNamespace +# define TclAppendExportList Tcl_AppendExportList +# define TclExport Tcl_Export +# define TclImport Tcl_Import +# define TclForgetImport Tcl_ForgetImport +# define TclGetCurrentNamespace_ Tcl_GetCurrentNamespace +# define TclGetGlobalNamespace_ Tcl_GetGlobalNamespace +# define TclFindNamespace Tcl_FindNamespace +# define TclFindCommand Tcl_FindCommand +# define TclGetCommandFromObj Tcl_GetCommandFromObj +# define TclGetCommandFullName Tcl_GetCommandFullName # define TclpLocaltime_unix TclpLocaltime # define TclpGmtime_unix TclpGmtime @@ -535,22 +564,22 @@ static const TclIntStubs tclIntStubs = { TclUpdateReturnInfo, /* 109 */ TclSockMinimumBuffers, /* 110 */ Tcl_AddInterpResolvers, /* 111 */ - Tcl_AppendExportList, /* 112 */ - Tcl_CreateNamespace, /* 113 */ - Tcl_DeleteNamespace, /* 114 */ - Tcl_Export, /* 115 */ - Tcl_FindCommand, /* 116 */ - Tcl_FindNamespace, /* 117 */ + TclAppendExportList, /* 112 */ + TclCreateNamespace, /* 113 */ + TclDeleteNamespace, /* 114 */ + TclExport, /* 115 */ + TclFindCommand, /* 116 */ + TclFindNamespace, /* 117 */ Tcl_GetInterpResolvers, /* 118 */ Tcl_GetNamespaceResolvers, /* 119 */ Tcl_FindNamespaceVar, /* 120 */ - Tcl_ForgetImport, /* 121 */ - Tcl_GetCommandFromObj, /* 122 */ - Tcl_GetCommandFullName, /* 123 */ - Tcl_GetCurrentNamespace, /* 124 */ - Tcl_GetGlobalNamespace, /* 125 */ + TclForgetImport, /* 121 */ + TclGetCommandFromObj, /* 122 */ + TclGetCommandFullName, /* 123 */ + TclGetCurrentNamespace_, /* 124 */ + TclGetGlobalNamespace_, /* 125 */ Tcl_GetVariableFullName, /* 126 */ - Tcl_Import, /* 127 */ + TclImport, /* 127 */ Tcl_PopCallFrame, /* 128 */ Tcl_PushCallFrame, /* 129 */ Tcl_RemoveInterpResolvers, /* 130 */ @@ -601,8 +630,8 @@ static const TclIntStubs tclIntStubs = { TclCallVarTraces, /* 175 */ TclCleanupVar, /* 176 */ TclVarErrMsg, /* 177 */ - Tcl_SetStartupScript, /* 178 */ - Tcl_GetStartupScript, /* 179 */ + TclSetStartupScript, /* 178 */ + TclGetStartupScript, /* 179 */ 0, /* 180 */ 0, /* 181 */ TclpLocaltime, /* 182 */ diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index f475aed..6fa837c 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -15,11 +15,13 @@ #ifdef TCL_THREADS +#ifndef TCL_NO_DEPRECATED typedef struct { char nabuf[16]; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; +#endif /* * masterLock is used to serialize creation of mutexes, condition variables, -- cgit v0.12 From 61536390c542d9aa9d1a91d173190cd2421294e5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 20 Nov 2017 13:05:36 +0000 Subject: Fix executable flags --- generic/tclDecls.h | 0 generic/tclIntDecls.h | 0 generic/tclStubInit.c | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 generic/tclDecls.h mode change 100755 => 100644 generic/tclIntDecls.h mode change 100755 => 100644 generic/tclStubInit.c diff --git a/generic/tclDecls.h b/generic/tclDecls.h old mode 100755 new mode 100644 diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h old mode 100755 new mode 100644 diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c old mode 100755 new mode 100644 -- cgit v0.12 From 52b098ca11d6cbae8661a4d1e1461335674f2ce2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 20 Nov 2017 16:26:03 +0000 Subject: Deprecate support for macro's like CONST, CONST84, _ANSI_ARGS_, INLINE, TCL_VARARGS --- generic/tcl.decls | 82 +++++++++++------------ generic/tcl.h | 41 +++--------- generic/tclDecls.h | 181 ++++++++++++++++++++++++-------------------------- generic/tclInt.decls | 10 +-- generic/tclInt.h | 6 +- generic/tclIntDecls.h | 14 ++-- 6 files changed, 153 insertions(+), 181 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index fd7468a..60aebfd 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -32,7 +32,7 @@ declare 0 { const char *version, const void *clientData) } declare 1 { - CONST84_RETURN char *Tcl_PkgRequireEx(Tcl_Interp *interp, + const char *Tcl_PkgRequireEx(Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr) } @@ -154,7 +154,7 @@ declare 35 { } declare 36 { int Tcl_GetIndexFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, - CONST84 char *const *tablePtr, const char *msg, int flags, int *indexPtr) + const char *const *tablePtr, const char *msg, int flags, int *indexPtr) } declare 37 { int Tcl_GetInt(Tcl_Interp *interp, const char *src, int *intPtr) @@ -306,7 +306,7 @@ declare 82 { int Tcl_CommandComplete(const char *cmd) } declare 83 { - char *Tcl_Concat(int argc, CONST84 char *const *argv) + char *Tcl_Concat(int argc, const char *const *argv) } declare 84 { int Tcl_ConvertElement(const char *src, char *dst, int flags) @@ -318,7 +318,7 @@ declare 85 { declare 86 { int Tcl_CreateAlias(Tcl_Interp *slave, const char *slaveCmd, Tcl_Interp *target, const char *targetCmd, int argc, - CONST84 char *const *argv) + const char *const *argv) } declare 87 { int Tcl_CreateAliasObj(Tcl_Interp *slave, const char *slaveCmd, @@ -461,10 +461,10 @@ declare 126 { int Tcl_Eof(Tcl_Channel chan) } declare 127 { - CONST84_RETURN char *Tcl_ErrnoId(void) + const char *Tcl_ErrnoId(void) } declare 128 { - CONST84_RETURN char *Tcl_ErrnoMsg(int err) + const char *Tcl_ErrnoMsg(int err) } declare 129 { int Tcl_Eval(Tcl_Interp *interp, const char *script) @@ -528,12 +528,12 @@ declare 147 { } declare 148 { int Tcl_GetAlias(Tcl_Interp *interp, const char *slaveCmd, - Tcl_Interp **targetInterpPtr, CONST84 char **targetCmdPtr, - int *argcPtr, CONST84 char ***argvPtr) + Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, + int *argcPtr, const char ***argvPtr) } declare 149 { int Tcl_GetAliasObj(Tcl_Interp *interp, const char *slaveCmd, - Tcl_Interp **targetInterpPtr, CONST84 char **targetCmdPtr, + Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, int *objcPtr, Tcl_Obj ***objv) } declare 150 { @@ -558,7 +558,7 @@ declare 155 { int Tcl_GetChannelMode(Tcl_Channel chan) } declare 156 { - CONST84_RETURN char *Tcl_GetChannelName(Tcl_Channel chan) + const char *Tcl_GetChannelName(Tcl_Channel chan) } declare 157 { int Tcl_GetChannelOption(Tcl_Interp *interp, Tcl_Channel chan, @@ -572,14 +572,14 @@ declare 159 { Tcl_CmdInfo *infoPtr) } declare 160 { - CONST84_RETURN char *Tcl_GetCommandName(Tcl_Interp *interp, + const char *Tcl_GetCommandName(Tcl_Interp *interp, Tcl_Command command) } declare 161 { int Tcl_GetErrno(void) } declare 162 { - CONST84_RETURN char *Tcl_GetHostName(void) + const char *Tcl_GetHostName(void) } declare 163 { int Tcl_GetInterpPath(Tcl_Interp *askInterp, Tcl_Interp *slaveInterp) @@ -622,14 +622,14 @@ declare 173 { Tcl_Channel Tcl_GetStdChannel(int type) } declare 174 { - CONST84_RETURN char *Tcl_GetStringResult(Tcl_Interp *interp) + const char *Tcl_GetStringResult(Tcl_Interp *interp) } declare 175 { - CONST84_RETURN char *Tcl_GetVar(Tcl_Interp *interp, const char *varName, + const char *Tcl_GetVar(Tcl_Interp *interp, const char *varName, int flags) } declare 176 { - CONST84_RETURN char *Tcl_GetVar2(Tcl_Interp *interp, const char *part1, + const char *Tcl_GetVar2(Tcl_Interp *interp, const char *part1, const char *part2, int flags) } declare 177 { @@ -662,7 +662,7 @@ declare 185 { } # Obsolete, use Tcl_FSJoinPath declare 186 { - char *Tcl_JoinPath(int argc, CONST84 char *const *argv, + char *Tcl_JoinPath(int argc, const char *const *argv, Tcl_DString *resultPtr) } declare 187 { @@ -685,7 +685,7 @@ declare 191 { Tcl_Channel Tcl_MakeTcpClientChannel(ClientData tcpSocket) } declare 192 { - char *Tcl_Merge(int argc, CONST84 char *const *argv) + char *Tcl_Merge(int argc, const char *const *argv) } declare 193 { Tcl_HashEntry *Tcl_NextHashEntry(Tcl_HashSearch *searchPtr) @@ -703,7 +703,7 @@ declare 196 { } declare 197 { Tcl_Channel Tcl_OpenCommandChannel(Tcl_Interp *interp, int argc, - CONST84 char **argv, int flags) + const char **argv, int flags) } # This is obsolete, use Tcl_FSOpenFileChannel declare 198 { @@ -729,7 +729,7 @@ declare 203 { int Tcl_PutEnv(const char *assignment) } declare 204 { - CONST84_RETURN char *Tcl_PosixError(Tcl_Interp *interp) + const char *Tcl_PosixError(Tcl_Interp *interp) } declare 205 { void Tcl_QueueEvent(Tcl_Event *evPtr, Tcl_QueuePosition position) @@ -765,7 +765,7 @@ declare 214 { } declare 215 { void Tcl_RegExpRange(Tcl_RegExp regexp, int index, - CONST84 char **startPtr, CONST84 char **endPtr) + const char **startPtr, const char **endPtr) } declare 216 { void Tcl_Release(ClientData clientData) @@ -835,29 +835,29 @@ declare 236 { void Tcl_SetStdChannel(Tcl_Channel channel, int type) } declare 237 { - CONST84_RETURN char *Tcl_SetVar(Tcl_Interp *interp, const char *varName, + const char *Tcl_SetVar(Tcl_Interp *interp, const char *varName, const char *newValue, int flags) } declare 238 { - CONST84_RETURN char *Tcl_SetVar2(Tcl_Interp *interp, const char *part1, + const char *Tcl_SetVar2(Tcl_Interp *interp, const char *part1, const char *part2, const char *newValue, int flags) } declare 239 { - CONST84_RETURN char *Tcl_SignalId(int sig) + const char *Tcl_SignalId(int sig) } declare 240 { - CONST84_RETURN char *Tcl_SignalMsg(int sig) + const char *Tcl_SignalMsg(int sig) } declare 241 { void Tcl_SourceRCFile(Tcl_Interp *interp) } declare 242 { int Tcl_SplitList(Tcl_Interp *interp, const char *listStr, int *argcPtr, - CONST84 char ***argvPtr) + const char ***argvPtr) } # Obsolete, use Tcl_FSSplitPath declare 243 { - void Tcl_SplitPath(const char *path, int *argcPtr, CONST84 char ***argvPtr) + void Tcl_SplitPath(const char *path, int *argcPtr, const char ***argvPtr) } declare 244 { void Tcl_StaticPackage(Tcl_Interp *interp, const char *pkgName, @@ -952,15 +952,15 @@ declare 269 { char *Tcl_HashStats(Tcl_HashTable *tablePtr) } declare 270 { - CONST84_RETURN char *Tcl_ParseVar(Tcl_Interp *interp, const char *start, - CONST84 char **termPtr) + const char *Tcl_ParseVar(Tcl_Interp *interp, const char *start, + const char **termPtr) } declare 271 { - CONST84_RETURN char *Tcl_PkgPresent(Tcl_Interp *interp, const char *name, + const char *Tcl_PkgPresent(Tcl_Interp *interp, const char *name, const char *version, int exact) } declare 272 { - CONST84_RETURN char *Tcl_PkgPresentEx(Tcl_Interp *interp, + const char *Tcl_PkgPresentEx(Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr) } @@ -970,7 +970,7 @@ declare 273 { } # TIP #268: The internally used new Require function is in slot 573. declare 274 { - CONST84_RETURN char *Tcl_PkgRequire(Tcl_Interp *interp, const char *name, + const char *Tcl_PkgRequire(Tcl_Interp *interp, const char *name, const char *version, int exact) } declare 275 {deprecated {see TIP #422}} { @@ -1084,7 +1084,7 @@ declare 301 { Tcl_Encoding Tcl_GetEncoding(Tcl_Interp *interp, const char *name) } declare 302 { - CONST84_RETURN char *Tcl_GetEncodingName(Tcl_Encoding encoding) + const char *Tcl_GetEncodingName(Tcl_Encoding encoding) } declare 303 { void Tcl_GetEncodingNames(Tcl_Interp *interp) @@ -1160,7 +1160,7 @@ declare 324 { int Tcl_UniCharToUtf(int ch, char *buf) } declare 325 { - CONST84_RETURN char *Tcl_UtfAtIndex(const char *src, int index) + const char *Tcl_UtfAtIndex(const char *src, int index) } declare 326 { int Tcl_UtfCharComplete(const char *src, int length) @@ -1169,16 +1169,16 @@ declare 327 { int Tcl_UtfBackslash(const char *src, int *readPtr, char *dst) } declare 328 { - CONST84_RETURN char *Tcl_UtfFindFirst(const char *src, int ch) + const char *Tcl_UtfFindFirst(const char *src, int ch) } declare 329 { - CONST84_RETURN char *Tcl_UtfFindLast(const char *src, int ch) + const char *Tcl_UtfFindLast(const char *src, int ch) } declare 330 { - CONST84_RETURN char *Tcl_UtfNext(const char *src) + const char *Tcl_UtfNext(const char *src) } declare 331 { - CONST84_RETURN char *Tcl_UtfPrev(const char *src, const char *start) + const char *Tcl_UtfPrev(const char *src, const char *start) } declare 332 { int Tcl_UtfToExternal(Tcl_Interp *interp, Tcl_Encoding encoding, @@ -1212,7 +1212,7 @@ declare 340 { char *Tcl_GetString(Tcl_Obj *objPtr) } declare 341 {deprecated {Use Tcl_GetEncodingSearchPath}} { - CONST84_RETURN char *Tcl_GetDefaultEncodingDir(void) + const char *Tcl_GetDefaultEncodingDir(void) } declare 342 {deprecated {Use Tcl_SetEncodingSearchPath}} { void Tcl_SetDefaultEncodingDir(const char *path) @@ -1276,7 +1276,7 @@ declare 359 { } declare 360 { int Tcl_ParseBraces(Tcl_Interp *interp, const char *start, int numBytes, - Tcl_Parse *parsePtr, int append, CONST84 char **termPtr) + Tcl_Parse *parsePtr, int append, const char **termPtr) } declare 361 { int Tcl_ParseCommand(Tcl_Interp *interp, const char *start, int numBytes, @@ -1289,7 +1289,7 @@ declare 362 { declare 363 { int Tcl_ParseQuotedString(Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, - CONST84 char **termPtr) + const char **termPtr) } declare 364 { int Tcl_ParseVarName(Tcl_Interp *interp, const char *start, int numBytes, @@ -1405,7 +1405,7 @@ declare 397 { int Tcl_ChannelBuffered(Tcl_Channel chan) } declare 398 { - CONST84_RETURN char *Tcl_ChannelName(const Tcl_ChannelType *chanTypePtr) + const char *Tcl_ChannelName(const Tcl_ChannelType *chanTypePtr) } declare 399 { Tcl_ChannelTypeVersion Tcl_ChannelVersion( diff --git a/generic/tcl.h b/generic/tcl.h index 23a0a9a..e054c19 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -137,7 +137,7 @@ extern "C" { */ #include -#ifndef TCL_NO_DEPRECATED +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 # define TCL_VARARGS(type, name) (type name, ...) # define TCL_VARARGS_DEF(type, name) (type name, ...) # define TCL_VARARGS_START(type, name, list) (va_start(list, name), name) @@ -254,10 +254,9 @@ extern "C" { * New code should use prototypes. */ -#ifndef TCL_NO_DEPRECATED +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 # undef _ANSI_ARGS_ # define _ANSI_ARGS_(x) x -#endif /* !TCL_NO_DEPRECATED */ /* * Definitions that allow this header file to be used either with or without @@ -267,34 +266,16 @@ extern "C" { #ifndef INLINE # define INLINE #endif - -#ifdef NO_CONST -# ifndef const -# define const -# endif -#endif #ifndef CONST # define CONST const #endif +#define CONST84 const +#define CONST84_RETURN const -#ifdef USE_NON_CONST -# ifdef USE_COMPAT_CONST -# error define at most one of USE_NON_CONST and USE_COMPAT_CONST -# endif -# define CONST84 -# define CONST84_RETURN -#else -# ifdef USE_COMPAT_CONST -# define CONST84 -# define CONST84_RETURN const -# else -# define CONST84 const -# define CONST84_RETURN const -# endif -#endif +#endif /* !TCL_NO_DEPRECATED */ #ifndef CONST86 -# define CONST86 CONST84 +# define CONST86 const #endif /* @@ -720,10 +701,10 @@ typedef void (Tcl_ChannelProc) (ClientData clientData, int mask); typedef void (Tcl_CloseProc) (ClientData data); typedef void (Tcl_CmdDeleteProc) (ClientData clientData); typedef int (Tcl_CmdProc) (ClientData clientData, Tcl_Interp *interp, - int argc, CONST84 char *argv[]); + int argc, const char *argv[]); typedef void (Tcl_CmdTraceProc) (ClientData clientData, Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *proc, - ClientData cmdClientData, int argc, CONST84 char *argv[]); + ClientData cmdClientData, int argc, const char *argv[]); typedef int (Tcl_CmdObjTraceProc) (ClientData clientData, Tcl_Interp *interp, int level, const char *command, Tcl_Command commandInfo, int objc, struct Tcl_Obj *const *objv); @@ -760,7 +741,7 @@ typedef void (Tcl_TimerProc) (ClientData clientData); typedef int (Tcl_SetFromAnyProc) (Tcl_Interp *interp, struct Tcl_Obj *objPtr); typedef void (Tcl_UpdateStringProc) (struct Tcl_Obj *objPtr); typedef char * (Tcl_VarTraceProc) (ClientData clientData, Tcl_Interp *interp, - CONST84 char *part1, CONST84 char *part2, int flags); + const char *part1, const char *part2, int flags); typedef void (Tcl_CommandTraceProc) (ClientData clientData, Tcl_Interp *interp, const char *oldName, const char *newName, int flags); typedef void (Tcl_CreateFileHandlerProc) (int fd, int mask, Tcl_FileProc *proc, @@ -1478,14 +1459,14 @@ typedef int (Tcl_DriverClose2Proc) (ClientData instanceData, typedef int (Tcl_DriverInputProc) (ClientData instanceData, char *buf, int toRead, int *errorCodePtr); typedef int (Tcl_DriverOutputProc) (ClientData instanceData, - CONST84 char *buf, int toWrite, int *errorCodePtr); + const char *buf, int toWrite, int *errorCodePtr); typedef int (Tcl_DriverSeekProc) (ClientData instanceData, long offset, int mode, int *errorCodePtr); typedef int (Tcl_DriverSetOptionProc) (ClientData instanceData, Tcl_Interp *interp, const char *optionName, const char *value); typedef int (Tcl_DriverGetOptionProc) (ClientData instanceData, - Tcl_Interp *interp, CONST84 char *optionName, + Tcl_Interp *interp, const char *optionName, Tcl_DString *dsPtr); typedef void (Tcl_DriverWatchProc) (ClientData instanceData, int mask); typedef int (Tcl_DriverGetHandleProc) (ClientData instanceData, diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 3afe45a..0c1505b 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -53,7 +53,7 @@ EXTERN int Tcl_PkgProvideEx(Tcl_Interp *interp, const char *name, const char *version, const void *clientData); /* 1 */ -EXTERN CONST84_RETURN char * Tcl_PkgRequireEx(Tcl_Interp *interp, +EXTERN const char * Tcl_PkgRequireEx(Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 2 */ @@ -159,8 +159,7 @@ EXTERN int Tcl_GetDoubleFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, double *doublePtr); /* 36 */ EXTERN int Tcl_GetIndexFromObj(Tcl_Interp *interp, - Tcl_Obj *objPtr, - CONST84 char *const *tablePtr, + Tcl_Obj *objPtr, const char *const *tablePtr, const char *msg, int flags, int *indexPtr); /* 37 */ EXTERN int Tcl_GetInt(Tcl_Interp *interp, const char *src, @@ -281,7 +280,7 @@ EXTERN int Tcl_Close(Tcl_Interp *interp, Tcl_Channel chan); /* 82 */ EXTERN int Tcl_CommandComplete(const char *cmd); /* 83 */ -EXTERN char * Tcl_Concat(int argc, CONST84 char *const *argv); +EXTERN char * Tcl_Concat(int argc, const char *const *argv); /* 84 */ EXTERN int Tcl_ConvertElement(const char *src, char *dst, int flags); @@ -292,7 +291,7 @@ EXTERN int Tcl_ConvertCountedElement(const char *src, EXTERN int Tcl_CreateAlias(Tcl_Interp *slave, const char *slaveCmd, Tcl_Interp *target, const char *targetCmd, int argc, - CONST84 char *const *argv); + const char *const *argv); /* 87 */ EXTERN int Tcl_CreateAliasObj(Tcl_Interp *slave, const char *slaveCmd, Tcl_Interp *target, @@ -414,9 +413,9 @@ EXTERN void Tcl_DStringStartSublist(Tcl_DString *dsPtr); /* 126 */ EXTERN int Tcl_Eof(Tcl_Channel chan); /* 127 */ -EXTERN CONST84_RETURN char * Tcl_ErrnoId(void); +EXTERN const char * Tcl_ErrnoId(void); /* 128 */ -EXTERN CONST84_RETURN char * Tcl_ErrnoMsg(int err); +EXTERN const char * Tcl_ErrnoMsg(int err); /* 129 */ EXTERN int Tcl_Eval(Tcl_Interp *interp, const char *script); /* 130 */ @@ -471,13 +470,13 @@ EXTERN void Tcl_FreeResult(Tcl_Interp *interp); EXTERN int Tcl_GetAlias(Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, - CONST84 char **targetCmdPtr, int *argcPtr, - CONST84 char ***argvPtr); + const char **targetCmdPtr, int *argcPtr, + const char ***argvPtr); /* 149 */ EXTERN int Tcl_GetAliasObj(Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, - CONST84 char **targetCmdPtr, int *objcPtr, + const char **targetCmdPtr, int *objcPtr, Tcl_Obj ***objv); /* 150 */ EXTERN ClientData Tcl_GetAssocData(Tcl_Interp *interp, @@ -496,7 +495,7 @@ EXTERN ClientData Tcl_GetChannelInstanceData(Tcl_Channel chan); /* 155 */ EXTERN int Tcl_GetChannelMode(Tcl_Channel chan); /* 156 */ -EXTERN CONST84_RETURN char * Tcl_GetChannelName(Tcl_Channel chan); +EXTERN const char * Tcl_GetChannelName(Tcl_Channel chan); /* 157 */ EXTERN int Tcl_GetChannelOption(Tcl_Interp *interp, Tcl_Channel chan, const char *optionName, @@ -507,12 +506,12 @@ EXTERN CONST86 Tcl_ChannelType * Tcl_GetChannelType(Tcl_Channel chan); EXTERN int Tcl_GetCommandInfo(Tcl_Interp *interp, const char *cmdName, Tcl_CmdInfo *infoPtr); /* 160 */ -EXTERN CONST84_RETURN char * Tcl_GetCommandName(Tcl_Interp *interp, +EXTERN const char * Tcl_GetCommandName(Tcl_Interp *interp, Tcl_Command command); /* 161 */ EXTERN int Tcl_GetErrno(void); /* 162 */ -EXTERN CONST84_RETURN char * Tcl_GetHostName(void); +EXTERN const char * Tcl_GetHostName(void); /* 163 */ EXTERN int Tcl_GetInterpPath(Tcl_Interp *askInterp, Tcl_Interp *slaveInterp); @@ -548,14 +547,13 @@ EXTERN Tcl_Interp * Tcl_GetSlave(Tcl_Interp *interp, /* 173 */ EXTERN Tcl_Channel Tcl_GetStdChannel(int type); /* 174 */ -EXTERN CONST84_RETURN char * Tcl_GetStringResult(Tcl_Interp *interp); +EXTERN const char * Tcl_GetStringResult(Tcl_Interp *interp); /* 175 */ -EXTERN CONST84_RETURN char * Tcl_GetVar(Tcl_Interp *interp, - const char *varName, int flags); -/* 176 */ -EXTERN CONST84_RETURN char * Tcl_GetVar2(Tcl_Interp *interp, - const char *part1, const char *part2, +EXTERN const char * Tcl_GetVar(Tcl_Interp *interp, const char *varName, int flags); +/* 176 */ +EXTERN const char * Tcl_GetVar2(Tcl_Interp *interp, const char *part1, + const char *part2, int flags); /* 177 */ EXTERN int Tcl_GlobalEval(Tcl_Interp *interp, const char *command); @@ -580,7 +578,7 @@ EXTERN int Tcl_InterpDeleted(Tcl_Interp *interp); /* 185 */ EXTERN int Tcl_IsSafe(Tcl_Interp *interp); /* 186 */ -EXTERN char * Tcl_JoinPath(int argc, CONST84 char *const *argv, +EXTERN char * Tcl_JoinPath(int argc, const char *const *argv, Tcl_DString *resultPtr); /* 187 */ EXTERN int Tcl_LinkVar(Tcl_Interp *interp, const char *varName, @@ -593,7 +591,7 @@ EXTERN int Tcl_MakeSafe(Tcl_Interp *interp); /* 191 */ EXTERN Tcl_Channel Tcl_MakeTcpClientChannel(ClientData tcpSocket); /* 192 */ -EXTERN char * Tcl_Merge(int argc, CONST84 char *const *argv); +EXTERN char * Tcl_Merge(int argc, const char *const *argv); /* 193 */ EXTERN Tcl_HashEntry * Tcl_NextHashEntry(Tcl_HashSearch *searchPtr); /* 194 */ @@ -607,7 +605,7 @@ EXTERN Tcl_Obj * Tcl_ObjSetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, int flags); /* 197 */ EXTERN Tcl_Channel Tcl_OpenCommandChannel(Tcl_Interp *interp, int argc, - CONST84 char **argv, int flags); + const char **argv, int flags); /* 198 */ EXTERN Tcl_Channel Tcl_OpenFileChannel(Tcl_Interp *interp, const char *fileName, const char *modeString, @@ -629,7 +627,7 @@ EXTERN void Tcl_PrintDouble(Tcl_Interp *interp, double value, /* 203 */ EXTERN int Tcl_PutEnv(const char *assignment); /* 204 */ -EXTERN CONST84_RETURN char * Tcl_PosixError(Tcl_Interp *interp); +EXTERN const char * Tcl_PosixError(Tcl_Interp *interp); /* 205 */ EXTERN void Tcl_QueueEvent(Tcl_Event *evPtr, Tcl_QueuePosition position); @@ -659,8 +657,7 @@ EXTERN int Tcl_RegExpMatch(Tcl_Interp *interp, const char *text, const char *pattern); /* 215 */ EXTERN void Tcl_RegExpRange(Tcl_RegExp regexp, int index, - CONST84 char **startPtr, - CONST84 char **endPtr); + const char **startPtr, const char **endPtr); /* 216 */ EXTERN void Tcl_Release(ClientData clientData); /* 217 */ @@ -716,26 +713,25 @@ EXTERN void Tcl_SetObjResult(Tcl_Interp *interp, /* 236 */ EXTERN void Tcl_SetStdChannel(Tcl_Channel channel, int type); /* 237 */ -EXTERN CONST84_RETURN char * Tcl_SetVar(Tcl_Interp *interp, - const char *varName, const char *newValue, - int flags); -/* 238 */ -EXTERN CONST84_RETURN char * Tcl_SetVar2(Tcl_Interp *interp, - const char *part1, const char *part2, +EXTERN const char * Tcl_SetVar(Tcl_Interp *interp, const char *varName, const char *newValue, int flags); +/* 238 */ +EXTERN const char * Tcl_SetVar2(Tcl_Interp *interp, const char *part1, + const char *part2, const char *newValue, + int flags); /* 239 */ -EXTERN CONST84_RETURN char * Tcl_SignalId(int sig); +EXTERN const char * Tcl_SignalId(int sig); /* 240 */ -EXTERN CONST84_RETURN char * Tcl_SignalMsg(int sig); +EXTERN const char * Tcl_SignalMsg(int sig); /* 241 */ EXTERN void Tcl_SourceRCFile(Tcl_Interp *interp); /* 242 */ EXTERN int Tcl_SplitList(Tcl_Interp *interp, const char *listStr, int *argcPtr, - CONST84 char ***argvPtr); + const char ***argvPtr); /* 243 */ EXTERN void Tcl_SplitPath(const char *path, int *argcPtr, - CONST84 char ***argvPtr); + const char ***argvPtr); /* 244 */ EXTERN void Tcl_StaticPackage(Tcl_Interp *interp, const char *pkgName, @@ -826,23 +822,21 @@ void Tcl_AppendStringsToObjVA(Tcl_Obj *objPtr, /* 269 */ EXTERN char * Tcl_HashStats(Tcl_HashTable *tablePtr); /* 270 */ -EXTERN CONST84_RETURN char * Tcl_ParseVar(Tcl_Interp *interp, - const char *start, CONST84 char **termPtr); +EXTERN const char * Tcl_ParseVar(Tcl_Interp *interp, const char *start, + const char **termPtr); /* 271 */ -EXTERN CONST84_RETURN char * Tcl_PkgPresent(Tcl_Interp *interp, - const char *name, const char *version, - int exact); +EXTERN const char * Tcl_PkgPresent(Tcl_Interp *interp, const char *name, + const char *version, int exact); /* 272 */ -EXTERN CONST84_RETURN char * Tcl_PkgPresentEx(Tcl_Interp *interp, +EXTERN const char * Tcl_PkgPresentEx(Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 273 */ EXTERN int Tcl_PkgProvide(Tcl_Interp *interp, const char *name, const char *version); /* 274 */ -EXTERN CONST84_RETURN char * Tcl_PkgRequire(Tcl_Interp *interp, - const char *name, const char *version, - int exact); +EXTERN const char * Tcl_PkgRequire(Tcl_Interp *interp, const char *name, + const char *version, int exact); /* 275 */ TCL_DEPRECATED("see TIP #422") void Tcl_SetErrorCodeVA(Tcl_Interp *interp, @@ -919,7 +913,7 @@ EXTERN Tcl_ThreadId Tcl_GetCurrentThread(void); /* 301 */ EXTERN Tcl_Encoding Tcl_GetEncoding(Tcl_Interp *interp, const char *name); /* 302 */ -EXTERN CONST84_RETURN char * Tcl_GetEncodingName(Tcl_Encoding encoding); +EXTERN const char * Tcl_GetEncodingName(Tcl_Encoding encoding); /* 303 */ EXTERN void Tcl_GetEncodingNames(Tcl_Interp *interp); /* 304 */ @@ -978,20 +972,20 @@ EXTERN Tcl_UniChar Tcl_UniCharToUpper(int ch); /* 324 */ EXTERN int Tcl_UniCharToUtf(int ch, char *buf); /* 325 */ -EXTERN CONST84_RETURN char * Tcl_UtfAtIndex(const char *src, int index); +EXTERN const char * Tcl_UtfAtIndex(const char *src, int index); /* 326 */ EXTERN int Tcl_UtfCharComplete(const char *src, int length); /* 327 */ EXTERN int Tcl_UtfBackslash(const char *src, int *readPtr, char *dst); /* 328 */ -EXTERN CONST84_RETURN char * Tcl_UtfFindFirst(const char *src, int ch); +EXTERN const char * Tcl_UtfFindFirst(const char *src, int ch); /* 329 */ -EXTERN CONST84_RETURN char * Tcl_UtfFindLast(const char *src, int ch); +EXTERN const char * Tcl_UtfFindLast(const char *src, int ch); /* 330 */ -EXTERN CONST84_RETURN char * Tcl_UtfNext(const char *src); +EXTERN const char * Tcl_UtfNext(const char *src); /* 331 */ -EXTERN CONST84_RETURN char * Tcl_UtfPrev(const char *src, const char *start); +EXTERN const char * Tcl_UtfPrev(const char *src, const char *start); /* 332 */ EXTERN int Tcl_UtfToExternal(Tcl_Interp *interp, Tcl_Encoding encoding, const char *src, @@ -1020,7 +1014,7 @@ EXTERN int Tcl_WriteObj(Tcl_Channel chan, Tcl_Obj *objPtr); EXTERN char * Tcl_GetString(Tcl_Obj *objPtr); /* 341 */ TCL_DEPRECATED("Use Tcl_GetEncodingSearchPath") -CONST84_RETURN char * Tcl_GetDefaultEncodingDir(void); +const char * Tcl_GetDefaultEncodingDir(void); /* 342 */ TCL_DEPRECATED("Use Tcl_SetEncodingSearchPath") void Tcl_SetDefaultEncodingDir(const char *path); @@ -1071,7 +1065,7 @@ EXTERN void Tcl_LogCommandInfo(Tcl_Interp *interp, EXTERN int Tcl_ParseBraces(Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, - CONST84 char **termPtr); + const char **termPtr); /* 361 */ EXTERN int Tcl_ParseCommand(Tcl_Interp *interp, const char *start, int numBytes, int nested, @@ -1083,7 +1077,7 @@ EXTERN int Tcl_ParseExpr(Tcl_Interp *interp, const char *start, EXTERN int Tcl_ParseQuotedString(Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, - CONST84 char **termPtr); + const char **termPtr); /* 364 */ EXTERN int Tcl_ParseVarName(Tcl_Interp *interp, const char *start, int numBytes, @@ -1173,8 +1167,7 @@ EXTERN Tcl_Channel Tcl_GetTopChannel(Tcl_Channel chan); /* 397 */ EXTERN int Tcl_ChannelBuffered(Tcl_Channel chan); /* 398 */ -EXTERN CONST84_RETURN char * Tcl_ChannelName( - const Tcl_ChannelType *chanTypePtr); +EXTERN const char * Tcl_ChannelName(const Tcl_ChannelType *chanTypePtr); /* 399 */ EXTERN Tcl_ChannelTypeVersion Tcl_ChannelVersion( const Tcl_ChannelType *chanTypePtr); @@ -1857,7 +1850,7 @@ typedef struct TclStubs { const TclStubHooks *hooks; int (*tcl_PkgProvideEx) (Tcl_Interp *interp, const char *name, const char *version, const void *clientData); /* 0 */ - CONST84_RETURN char * (*tcl_PkgRequireEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 1 */ + const char * (*tcl_PkgRequireEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 1 */ TCL_NORETURN1 void (*tcl_Panic) (const char *format, ...) TCL_FORMAT_PRINTF(1, 2); /* 2 */ char * (*tcl_Alloc) (unsigned int size); /* 3 */ void (*tcl_Free) (char *ptr); /* 4 */ @@ -1908,7 +1901,7 @@ typedef struct TclStubs { unsigned char * (*tcl_GetByteArrayFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 33 */ int (*tcl_GetDouble) (Tcl_Interp *interp, const char *src, double *doublePtr); /* 34 */ int (*tcl_GetDoubleFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, double *doublePtr); /* 35 */ - int (*tcl_GetIndexFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, CONST84 char *const *tablePtr, const char *msg, int flags, int *indexPtr); /* 36 */ + int (*tcl_GetIndexFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, const char *const *tablePtr, const char *msg, int flags, int *indexPtr); /* 36 */ int (*tcl_GetInt) (Tcl_Interp *interp, const char *src, int *intPtr); /* 37 */ int (*tcl_GetIntFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *intPtr); /* 38 */ int (*tcl_GetLongFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, long *longPtr); /* 39 */ @@ -1955,10 +1948,10 @@ typedef struct TclStubs { void (*tcl_CancelIdleCall) (Tcl_IdleProc *idleProc, ClientData clientData); /* 80 */ int (*tcl_Close) (Tcl_Interp *interp, Tcl_Channel chan); /* 81 */ int (*tcl_CommandComplete) (const char *cmd); /* 82 */ - char * (*tcl_Concat) (int argc, CONST84 char *const *argv); /* 83 */ + char * (*tcl_Concat) (int argc, const char *const *argv); /* 83 */ int (*tcl_ConvertElement) (const char *src, char *dst, int flags); /* 84 */ int (*tcl_ConvertCountedElement) (const char *src, int length, char *dst, int flags); /* 85 */ - int (*tcl_CreateAlias) (Tcl_Interp *slave, const char *slaveCmd, Tcl_Interp *target, const char *targetCmd, int argc, CONST84 char *const *argv); /* 86 */ + int (*tcl_CreateAlias) (Tcl_Interp *slave, const char *slaveCmd, Tcl_Interp *target, const char *targetCmd, int argc, const char *const *argv); /* 86 */ int (*tcl_CreateAliasObj) (Tcl_Interp *slave, const char *slaveCmd, Tcl_Interp *target, const char *targetCmd, int objc, Tcl_Obj *const objv[]); /* 87 */ Tcl_Channel (*tcl_CreateChannel) (const Tcl_ChannelType *typePtr, const char *chanName, ClientData instanceData, int mask); /* 88 */ void (*tcl_CreateChannelHandler) (Tcl_Channel chan, int mask, Tcl_ChannelProc *proc, ClientData clientData); /* 89 */ @@ -1999,8 +1992,8 @@ typedef struct TclStubs { void (*tcl_DStringSetLength) (Tcl_DString *dsPtr, int length); /* 124 */ void (*tcl_DStringStartSublist) (Tcl_DString *dsPtr); /* 125 */ int (*tcl_Eof) (Tcl_Channel chan); /* 126 */ - CONST84_RETURN char * (*tcl_ErrnoId) (void); /* 127 */ - CONST84_RETURN char * (*tcl_ErrnoMsg) (int err); /* 128 */ + const char * (*tcl_ErrnoId) (void); /* 127 */ + const char * (*tcl_ErrnoMsg) (int err); /* 128 */ int (*tcl_Eval) (Tcl_Interp *interp, const char *script); /* 129 */ int (*tcl_EvalFile) (Tcl_Interp *interp, const char *fileName); /* 130 */ int (*tcl_EvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 131 */ @@ -2020,21 +2013,21 @@ typedef struct TclStubs { Tcl_HashEntry * (*tcl_FirstHashEntry) (Tcl_HashTable *tablePtr, Tcl_HashSearch *searchPtr); /* 145 */ int (*tcl_Flush) (Tcl_Channel chan); /* 146 */ void (*tcl_FreeResult) (Tcl_Interp *interp); /* 147 */ - int (*tcl_GetAlias) (Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, CONST84 char **targetCmdPtr, int *argcPtr, CONST84 char ***argvPtr); /* 148 */ - int (*tcl_GetAliasObj) (Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, CONST84 char **targetCmdPtr, int *objcPtr, Tcl_Obj ***objv); /* 149 */ + int (*tcl_GetAlias) (Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, int *argcPtr, const char ***argvPtr); /* 148 */ + int (*tcl_GetAliasObj) (Tcl_Interp *interp, const char *slaveCmd, Tcl_Interp **targetInterpPtr, const char **targetCmdPtr, int *objcPtr, Tcl_Obj ***objv); /* 149 */ ClientData (*tcl_GetAssocData) (Tcl_Interp *interp, const char *name, Tcl_InterpDeleteProc **procPtr); /* 150 */ Tcl_Channel (*tcl_GetChannel) (Tcl_Interp *interp, const char *chanName, int *modePtr); /* 151 */ int (*tcl_GetChannelBufferSize) (Tcl_Channel chan); /* 152 */ int (*tcl_GetChannelHandle) (Tcl_Channel chan, int direction, ClientData *handlePtr); /* 153 */ ClientData (*tcl_GetChannelInstanceData) (Tcl_Channel chan); /* 154 */ int (*tcl_GetChannelMode) (Tcl_Channel chan); /* 155 */ - CONST84_RETURN char * (*tcl_GetChannelName) (Tcl_Channel chan); /* 156 */ + const char * (*tcl_GetChannelName) (Tcl_Channel chan); /* 156 */ int (*tcl_GetChannelOption) (Tcl_Interp *interp, Tcl_Channel chan, const char *optionName, Tcl_DString *dsPtr); /* 157 */ CONST86 Tcl_ChannelType * (*tcl_GetChannelType) (Tcl_Channel chan); /* 158 */ int (*tcl_GetCommandInfo) (Tcl_Interp *interp, const char *cmdName, Tcl_CmdInfo *infoPtr); /* 159 */ - CONST84_RETURN char * (*tcl_GetCommandName) (Tcl_Interp *interp, Tcl_Command command); /* 160 */ + const char * (*tcl_GetCommandName) (Tcl_Interp *interp, Tcl_Command command); /* 160 */ int (*tcl_GetErrno) (void); /* 161 */ - CONST84_RETURN char * (*tcl_GetHostName) (void); /* 162 */ + const char * (*tcl_GetHostName) (void); /* 162 */ int (*tcl_GetInterpPath) (Tcl_Interp *askInterp, Tcl_Interp *slaveInterp); /* 163 */ Tcl_Interp * (*tcl_GetMaster) (Tcl_Interp *interp); /* 164 */ const char * (*tcl_GetNameOfExecutable) (void); /* 165 */ @@ -2054,9 +2047,9 @@ typedef struct TclStubs { int (*tcl_GetServiceMode) (void); /* 171 */ Tcl_Interp * (*tcl_GetSlave) (Tcl_Interp *interp, const char *slaveName); /* 172 */ Tcl_Channel (*tcl_GetStdChannel) (int type); /* 173 */ - CONST84_RETURN char * (*tcl_GetStringResult) (Tcl_Interp *interp); /* 174 */ - CONST84_RETURN char * (*tcl_GetVar) (Tcl_Interp *interp, const char *varName, int flags); /* 175 */ - CONST84_RETURN char * (*tcl_GetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags); /* 176 */ + const char * (*tcl_GetStringResult) (Tcl_Interp *interp); /* 174 */ + const char * (*tcl_GetVar) (Tcl_Interp *interp, const char *varName, int flags); /* 175 */ + const char * (*tcl_GetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, int flags); /* 176 */ int (*tcl_GlobalEval) (Tcl_Interp *interp, const char *command); /* 177 */ int (*tcl_GlobalEvalObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 178 */ int (*tcl_HideCommand) (Tcl_Interp *interp, const char *cmdName, const char *hiddenCmdToken); /* 179 */ @@ -2066,25 +2059,25 @@ typedef struct TclStubs { int (*tcl_InputBuffered) (Tcl_Channel chan); /* 183 */ int (*tcl_InterpDeleted) (Tcl_Interp *interp); /* 184 */ int (*tcl_IsSafe) (Tcl_Interp *interp); /* 185 */ - char * (*tcl_JoinPath) (int argc, CONST84 char *const *argv, Tcl_DString *resultPtr); /* 186 */ + char * (*tcl_JoinPath) (int argc, const char *const *argv, Tcl_DString *resultPtr); /* 186 */ int (*tcl_LinkVar) (Tcl_Interp *interp, const char *varName, char *addr, int type); /* 187 */ void (*reserved188)(void); Tcl_Channel (*tcl_MakeFileChannel) (ClientData handle, int mode); /* 189 */ int (*tcl_MakeSafe) (Tcl_Interp *interp); /* 190 */ Tcl_Channel (*tcl_MakeTcpClientChannel) (ClientData tcpSocket); /* 191 */ - char * (*tcl_Merge) (int argc, CONST84 char *const *argv); /* 192 */ + char * (*tcl_Merge) (int argc, const char *const *argv); /* 192 */ Tcl_HashEntry * (*tcl_NextHashEntry) (Tcl_HashSearch *searchPtr); /* 193 */ void (*tcl_NotifyChannel) (Tcl_Channel channel, int mask); /* 194 */ Tcl_Obj * (*tcl_ObjGetVar2) (Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, int flags); /* 195 */ Tcl_Obj * (*tcl_ObjSetVar2) (Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, int flags); /* 196 */ - Tcl_Channel (*tcl_OpenCommandChannel) (Tcl_Interp *interp, int argc, CONST84 char **argv, int flags); /* 197 */ + Tcl_Channel (*tcl_OpenCommandChannel) (Tcl_Interp *interp, int argc, const char **argv, int flags); /* 197 */ Tcl_Channel (*tcl_OpenFileChannel) (Tcl_Interp *interp, const char *fileName, const char *modeString, int permissions); /* 198 */ Tcl_Channel (*tcl_OpenTcpClient) (Tcl_Interp *interp, int port, const char *address, const char *myaddr, int myport, int async); /* 199 */ Tcl_Channel (*tcl_OpenTcpServer) (Tcl_Interp *interp, int port, const char *host, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 200 */ void (*tcl_Preserve) (ClientData data); /* 201 */ void (*tcl_PrintDouble) (Tcl_Interp *interp, double value, char *dst); /* 202 */ int (*tcl_PutEnv) (const char *assignment); /* 203 */ - CONST84_RETURN char * (*tcl_PosixError) (Tcl_Interp *interp); /* 204 */ + const char * (*tcl_PosixError) (Tcl_Interp *interp); /* 204 */ void (*tcl_QueueEvent) (Tcl_Event *evPtr, Tcl_QueuePosition position); /* 205 */ int (*tcl_Read) (Tcl_Channel chan, char *bufPtr, int toRead); /* 206 */ void (*tcl_ReapDetachedProcs) (void); /* 207 */ @@ -2095,7 +2088,7 @@ typedef struct TclStubs { Tcl_RegExp (*tcl_RegExpCompile) (Tcl_Interp *interp, const char *pattern); /* 212 */ int (*tcl_RegExpExec) (Tcl_Interp *interp, Tcl_RegExp regexp, const char *text, const char *start); /* 213 */ int (*tcl_RegExpMatch) (Tcl_Interp *interp, const char *text, const char *pattern); /* 214 */ - void (*tcl_RegExpRange) (Tcl_RegExp regexp, int index, CONST84 char **startPtr, CONST84 char **endPtr); /* 215 */ + void (*tcl_RegExpRange) (Tcl_RegExp regexp, int index, const char **startPtr, const char **endPtr); /* 215 */ void (*tcl_Release) (ClientData clientData); /* 216 */ void (*tcl_ResetResult) (Tcl_Interp *interp); /* 217 */ int (*tcl_ScanElement) (const char *src, int *flagPtr); /* 218 */ @@ -2117,13 +2110,13 @@ typedef struct TclStubs { void (*tcl_SetObjErrorCode) (Tcl_Interp *interp, Tcl_Obj *errorObjPtr); /* 234 */ void (*tcl_SetObjResult) (Tcl_Interp *interp, Tcl_Obj *resultObjPtr); /* 235 */ void (*tcl_SetStdChannel) (Tcl_Channel channel, int type); /* 236 */ - CONST84_RETURN char * (*tcl_SetVar) (Tcl_Interp *interp, const char *varName, const char *newValue, int flags); /* 237 */ - CONST84_RETURN char * (*tcl_SetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, const char *newValue, int flags); /* 238 */ - CONST84_RETURN char * (*tcl_SignalId) (int sig); /* 239 */ - CONST84_RETURN char * (*tcl_SignalMsg) (int sig); /* 240 */ + const char * (*tcl_SetVar) (Tcl_Interp *interp, const char *varName, const char *newValue, int flags); /* 237 */ + const char * (*tcl_SetVar2) (Tcl_Interp *interp, const char *part1, const char *part2, const char *newValue, int flags); /* 238 */ + const char * (*tcl_SignalId) (int sig); /* 239 */ + const char * (*tcl_SignalMsg) (int sig); /* 240 */ void (*tcl_SourceRCFile) (Tcl_Interp *interp); /* 241 */ - int (*tcl_SplitList) (Tcl_Interp *interp, const char *listStr, int *argcPtr, CONST84 char ***argvPtr); /* 242 */ - void (*tcl_SplitPath) (const char *path, int *argcPtr, CONST84 char ***argvPtr); /* 243 */ + int (*tcl_SplitList) (Tcl_Interp *interp, const char *listStr, int *argcPtr, const char ***argvPtr); /* 242 */ + void (*tcl_SplitPath) (const char *path, int *argcPtr, const char ***argvPtr); /* 243 */ void (*tcl_StaticPackage) (Tcl_Interp *interp, const char *pkgName, Tcl_PackageInitProc *initProc, Tcl_PackageInitProc *safeInitProc); /* 244 */ int (*tcl_StringMatch) (const char *str, const char *pattern); /* 245 */ TCL_DEPRECATED_API("") int (*tcl_TellOld) (Tcl_Channel chan); /* 246 */ @@ -2150,11 +2143,11 @@ typedef struct TclStubs { TCL_DEPRECATED_API("see TIP #422") void (*tcl_AppendResultVA) (Tcl_Interp *interp, va_list argList); /* 267 */ TCL_DEPRECATED_API("see TIP #422") void (*tcl_AppendStringsToObjVA) (Tcl_Obj *objPtr, va_list argList); /* 268 */ char * (*tcl_HashStats) (Tcl_HashTable *tablePtr); /* 269 */ - CONST84_RETURN char * (*tcl_ParseVar) (Tcl_Interp *interp, const char *start, CONST84 char **termPtr); /* 270 */ - CONST84_RETURN char * (*tcl_PkgPresent) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 271 */ - CONST84_RETURN char * (*tcl_PkgPresentEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 272 */ + const char * (*tcl_ParseVar) (Tcl_Interp *interp, const char *start, const char **termPtr); /* 270 */ + const char * (*tcl_PkgPresent) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 271 */ + const char * (*tcl_PkgPresentEx) (Tcl_Interp *interp, const char *name, const char *version, int exact, void *clientDataPtr); /* 272 */ int (*tcl_PkgProvide) (Tcl_Interp *interp, const char *name, const char *version); /* 273 */ - CONST84_RETURN char * (*tcl_PkgRequire) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 274 */ + const char * (*tcl_PkgRequire) (Tcl_Interp *interp, const char *name, const char *version, int exact); /* 274 */ TCL_DEPRECATED_API("see TIP #422") void (*tcl_SetErrorCodeVA) (Tcl_Interp *interp, va_list argList); /* 275 */ TCL_DEPRECATED_API("see TIP #422") int (*tcl_VarEvalVA) (Tcl_Interp *interp, va_list argList); /* 276 */ Tcl_Pid (*tcl_WaitPid) (Tcl_Pid pid, int *statPtr, int options); /* 277 */ @@ -2182,7 +2175,7 @@ typedef struct TclStubs { void (*tcl_FreeEncoding) (Tcl_Encoding encoding); /* 299 */ Tcl_ThreadId (*tcl_GetCurrentThread) (void); /* 300 */ Tcl_Encoding (*tcl_GetEncoding) (Tcl_Interp *interp, const char *name); /* 301 */ - CONST84_RETURN char * (*tcl_GetEncodingName) (Tcl_Encoding encoding); /* 302 */ + const char * (*tcl_GetEncodingName) (Tcl_Encoding encoding); /* 302 */ void (*tcl_GetEncodingNames) (Tcl_Interp *interp); /* 303 */ int (*tcl_GetIndexFromObjStruct) (Tcl_Interp *interp, Tcl_Obj *objPtr, const void *tablePtr, int offset, const char *msg, int flags, int *indexPtr); /* 304 */ void * (*tcl_GetThreadData) (Tcl_ThreadDataKey *keyPtr, int size); /* 305 */ @@ -2205,13 +2198,13 @@ typedef struct TclStubs { Tcl_UniChar (*tcl_UniCharToTitle) (int ch); /* 322 */ Tcl_UniChar (*tcl_UniCharToUpper) (int ch); /* 323 */ int (*tcl_UniCharToUtf) (int ch, char *buf); /* 324 */ - CONST84_RETURN char * (*tcl_UtfAtIndex) (const char *src, int index); /* 325 */ + const char * (*tcl_UtfAtIndex) (const char *src, int index); /* 325 */ int (*tcl_UtfCharComplete) (const char *src, int length); /* 326 */ int (*tcl_UtfBackslash) (const char *src, int *readPtr, char *dst); /* 327 */ - CONST84_RETURN char * (*tcl_UtfFindFirst) (const char *src, int ch); /* 328 */ - CONST84_RETURN char * (*tcl_UtfFindLast) (const char *src, int ch); /* 329 */ - CONST84_RETURN char * (*tcl_UtfNext) (const char *src); /* 330 */ - CONST84_RETURN char * (*tcl_UtfPrev) (const char *src, const char *start); /* 331 */ + const char * (*tcl_UtfFindFirst) (const char *src, int ch); /* 328 */ + const char * (*tcl_UtfFindLast) (const char *src, int ch); /* 329 */ + const char * (*tcl_UtfNext) (const char *src); /* 330 */ + const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 331 */ int (*tcl_UtfToExternal) (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) (Tcl_Encoding encoding, const char *src, int srcLen, Tcl_DString *dsPtr); /* 333 */ int (*tcl_UtfToLower) (char *src); /* 334 */ @@ -2221,7 +2214,7 @@ typedef struct TclStubs { int (*tcl_WriteChars) (Tcl_Channel chan, const char *src, int srcLen); /* 338 */ int (*tcl_WriteObj) (Tcl_Channel chan, Tcl_Obj *objPtr); /* 339 */ char * (*tcl_GetString) (Tcl_Obj *objPtr); /* 340 */ - TCL_DEPRECATED_API("Use Tcl_GetEncodingSearchPath") CONST84_RETURN char * (*tcl_GetDefaultEncodingDir) (void); /* 341 */ + TCL_DEPRECATED_API("Use Tcl_GetEncodingSearchPath") const char * (*tcl_GetDefaultEncodingDir) (void); /* 341 */ TCL_DEPRECATED_API("Use Tcl_SetEncodingSearchPath") void (*tcl_SetDefaultEncodingDir) (const char *path); /* 342 */ void (*tcl_AlertNotifier) (ClientData clientData); /* 343 */ void (*tcl_ServiceModeHook) (int mode); /* 344 */ @@ -2240,10 +2233,10 @@ typedef struct TclStubs { TCL_DEPRECATED_API("Use Tcl_EvalTokensStandard") Tcl_Obj * (*tcl_EvalTokens) (Tcl_Interp *interp, Tcl_Token *tokenPtr, int count); /* 357 */ void (*tcl_FreeParse) (Tcl_Parse *parsePtr); /* 358 */ void (*tcl_LogCommandInfo) (Tcl_Interp *interp, const char *script, const char *command, int length); /* 359 */ - int (*tcl_ParseBraces) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, CONST84 char **termPtr); /* 360 */ + int (*tcl_ParseBraces) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, const char **termPtr); /* 360 */ int (*tcl_ParseCommand) (Tcl_Interp *interp, const char *start, int numBytes, int nested, Tcl_Parse *parsePtr); /* 361 */ int (*tcl_ParseExpr) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr); /* 362 */ - int (*tcl_ParseQuotedString) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, CONST84 char **termPtr); /* 363 */ + int (*tcl_ParseQuotedString) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append, const char **termPtr); /* 363 */ int (*tcl_ParseVarName) (Tcl_Interp *interp, const char *start, int numBytes, Tcl_Parse *parsePtr, int append); /* 364 */ char * (*tcl_GetCwd) (Tcl_Interp *interp, Tcl_DString *cwdPtr); /* 365 */ int (*tcl_Chdir) (const char *dirName); /* 366 */ @@ -2278,7 +2271,7 @@ typedef struct TclStubs { int (*tcl_WriteRaw) (Tcl_Channel chan, const char *src, int srcLen); /* 395 */ Tcl_Channel (*tcl_GetTopChannel) (Tcl_Channel chan); /* 396 */ int (*tcl_ChannelBuffered) (Tcl_Channel chan); /* 397 */ - CONST84_RETURN char * (*tcl_ChannelName) (const Tcl_ChannelType *chanTypePtr); /* 398 */ + const char * (*tcl_ChannelName) (const Tcl_ChannelType *chanTypePtr); /* 398 */ Tcl_ChannelTypeVersion (*tcl_ChannelVersion) (const Tcl_ChannelType *chanTypePtr); /* 399 */ Tcl_DriverBlockModeProc * (*tcl_ChannelBlockModeProc) (const Tcl_ChannelType *chanTypePtr); /* 400 */ Tcl_DriverCloseProc * (*tcl_ChannelCloseProc) (const Tcl_ChannelType *chanTypePtr); /* 401 */ diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 33bf0b3..3fe3e8f 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -187,7 +187,7 @@ declare 42 { } # Removed in 8.5a2: #declare 43 { -# int TclGlobalInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv, +# int TclGlobalInvoke(Tcl_Interp *interp, int argc, const char **argv, # int flags) #} declare 44 { @@ -222,12 +222,12 @@ declare 51 { } # Removed in 8.5a2: #declare 52 { -# int TclInvoke(Tcl_Interp *interp, int argc, CONST84 char **argv, +# int TclInvoke(Tcl_Interp *interp, int argc, const char **argv, # int flags) #} declare 53 { int TclInvokeObjectCommand(ClientData clientData, Tcl_Interp *interp, - int argc, CONST84 char **argv) + int argc, const char **argv) } declare 54 { int TclInvokeStringCommand(ClientData clientData, Tcl_Interp *interp, @@ -548,7 +548,7 @@ declare 133 {deprecated {}} { # int TclpChdir(const char *dirName) #} declare 138 { - CONST84_RETURN char *TclGetEnv(const char *name, Tcl_DString *valuePtr) + const char *TclGetEnv(const char *name, Tcl_DString *valuePtr) } #declare 139 { # int TclpLoadFile(Tcl_Interp *interp, char *fileName, char *sym1, @@ -560,7 +560,7 @@ declare 138 { #} # This is used by TclX, but should otherwise be considered private declare 141 { - CONST84_RETURN char *TclpGetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr) + const char *TclpGetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr) } declare 142 { int TclSetByteCodeFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr, diff --git a/generic/tclInt.h b/generic/tclInt.h index 8aaa7a8..ecd2924 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -160,13 +160,13 @@ typedef struct Tcl_ResolvedVarInfo { } Tcl_ResolvedVarInfo; typedef int (Tcl_ResolveCompiledVarProc)(Tcl_Interp *interp, - CONST84 char *name, int length, Tcl_Namespace *context, + const char *name, int length, Tcl_Namespace *context, Tcl_ResolvedVarInfo **rPtr); -typedef int (Tcl_ResolveVarProc)(Tcl_Interp *interp, CONST84 char *name, +typedef int (Tcl_ResolveVarProc)(Tcl_Interp *interp, const char *name, Tcl_Namespace *context, int flags, Tcl_Var *rPtr); -typedef int (Tcl_ResolveCmdProc)(Tcl_Interp *interp, CONST84 char *name, +typedef int (Tcl_ResolveCmdProc)(Tcl_Interp *interp, const char *name, Tcl_Namespace *context, int flags, Tcl_Command *rPtr); typedef struct Tcl_ResolverInfo { diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 22b8072..cd494f4 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -158,7 +158,7 @@ EXTERN int TclInterpInit(Tcl_Interp *interp); /* 53 */ EXTERN int TclInvokeObjectCommand(ClientData clientData, Tcl_Interp *interp, int argc, - CONST84 char **argv); + const char **argv); /* 54 */ EXTERN int TclInvokeStringCommand(ClientData clientData, Tcl_Interp *interp, int objc, @@ -344,13 +344,11 @@ struct tm * TclpGetDate(const time_t *time, int useGMT); /* Slot 136 is reserved */ /* Slot 137 is reserved */ /* 138 */ -EXTERN CONST84_RETURN char * TclGetEnv(const char *name, - Tcl_DString *valuePtr); +EXTERN const char * TclGetEnv(const char *name, Tcl_DString *valuePtr); /* Slot 139 is reserved */ /* Slot 140 is reserved */ /* 141 */ -EXTERN CONST84_RETURN char * TclpGetCwd(Tcl_Interp *interp, - Tcl_DString *cwdPtr); +EXTERN const char * TclpGetCwd(Tcl_Interp *interp, Tcl_DString *cwdPtr); /* 142 */ EXTERN int TclSetByteCodeFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr, CompileHookProc *hookProc, @@ -692,7 +690,7 @@ typedef struct TclIntStubs { void (*tclInitCompiledLocals) (Tcl_Interp *interp, CallFrame *framePtr, Namespace *nsPtr); /* 50 */ int (*tclInterpInit) (Tcl_Interp *interp); /* 51 */ void (*reserved52)(void); - int (*tclInvokeObjectCommand) (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char **argv); /* 53 */ + int (*tclInvokeObjectCommand) (ClientData clientData, Tcl_Interp *interp, int argc, const char **argv); /* 53 */ int (*tclInvokeStringCommand) (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 54 */ Proc * (*tclIsProc) (Command *cmdPtr); /* 55 */ void (*reserved56)(void); @@ -777,10 +775,10 @@ typedef struct TclIntStubs { void (*reserved135)(void); void (*reserved136)(void); void (*reserved137)(void); - CONST84_RETURN char * (*tclGetEnv) (const char *name, Tcl_DString *valuePtr); /* 138 */ + const char * (*tclGetEnv) (const char *name, Tcl_DString *valuePtr); /* 138 */ void (*reserved139)(void); void (*reserved140)(void); - CONST84_RETURN char * (*tclpGetCwd) (Tcl_Interp *interp, Tcl_DString *cwdPtr); /* 141 */ + const char * (*tclpGetCwd) (Tcl_Interp *interp, Tcl_DString *cwdPtr); /* 141 */ int (*tclSetByteCodeFromAny) (Tcl_Interp *interp, Tcl_Obj *objPtr, CompileHookProc *hookProc, ClientData clientData); /* 142 */ int (*tclAddLiteralObj) (struct CompileEnv *envPtr, Tcl_Obj *objPtr, LiteralEntry **litPtrPtr); /* 143 */ void (*tclHideLiteral) (Tcl_Interp *interp, struct CompileEnv *envPtr, int index); /* 144 */ -- cgit v0.12 From 4e97c16367e23bcde62e1b0910c32a7d06614518 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 20 Nov 2017 17:09:44 +0000 Subject: Modifications to allow the Tcl build system to exploit either a native zip executable in the path or a tclsh that understands the new "install" keyword from the command line Added a new file to /library which is run when the user executes "tclsh install ..." Embedded in installer.tcl is a facility for building zip archives --- generic/tclZipfs.c | 39 ++++++----- library/install.tcl | 13 ++++ unix/Makefile.in | 6 +- unix/configure | 194 +++++++++++++++++++++------------------------------- unix/configure.ac | 75 ++++++++++---------- unix/tcl.m4 | 192 +++++++++++++++++++++++++++++---------------------- win/Makefile.in | 6 +- win/configure | 114 ++++++++++-------------------- win/configure.ac | 77 ++++++++++----------- win/tcl.m4 | 112 +++++++++++++++++++----------- 10 files changed, 408 insertions(+), 420 deletions(-) create mode 100644 library/install.tcl diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 689a648..8c852b2 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3977,25 +3977,32 @@ int TclZipfs_AppHook(int *argc, char ***argv){ } } else if (*argc>1) { archive=(*argv)[1]; - fflush(stdout); - if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { - int found; + if(strcmp(archive,"install")==0) { + /* If the first argument is mkzip, run the mkzip program */ Tcl_Obj *vfsinitscript; - vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/main.tcl",-1); + vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/tcl_library/install.tcl",-1); Tcl_IncrRefCount(vfsinitscript); - if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { - /* Startup script should be set before calling Tcl_AppInit */ - Tcl_SetStartupScript(vfsinitscript,NULL); - } else { + Tcl_SetStartupScript(vfsinitscript,NULL); + } else { + if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { + int found; + Tcl_Obj *vfsinitscript; + vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/main.tcl",-1); + Tcl_IncrRefCount(vfsinitscript); + if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { + /* Startup script should be set before calling Tcl_AppInit */ + Tcl_SetStartupScript(vfsinitscript,NULL); + } else { + Tcl_DecrRefCount(vfsinitscript); + } + /* Set Tcl Encodings */ + vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library/init.tcl",-1); + Tcl_IncrRefCount(vfsinitscript); + found=Tcl_FSAccess(vfsinitscript,F_OK); Tcl_DecrRefCount(vfsinitscript); - } - /* Set Tcl Encodings */ - vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library/init.tcl",-1); - Tcl_IncrRefCount(vfsinitscript); - found=Tcl_FSAccess(vfsinitscript,F_OK); - Tcl_DecrRefCount(vfsinitscript); - if(found==TCL_OK) { - return TCL_OK; + if(found==TCL_OK) { + return TCL_OK; + } } } } diff --git a/library/install.tcl b/library/install.tcl new file mode 100644 index 0000000..f126b37 --- /dev/null +++ b/library/install.tcl @@ -0,0 +1,13 @@ +### +# Installer actions built into tclsh and invoked +# if the first command line argument is "install" +### +if {[llength $argv] < 2} { + exit 0 +} +switch [lindex $argv 1] { + mkzip { + zipfs mkzip {*}[lrange $argv 2 end] + } +} +exit 0 diff --git a/unix/Makefile.in b/unix/Makefile.in index 4540710..98c5865 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -632,6 +632,8 @@ HOST_EXEEXT = @EXEEXT_FOR_BUILD@ HOST_OBJEXT = @OBJEXT_FOR_BUILD@ ZIPFS_BUILD = @ZIPFS_BUILD@ NATIVE_ZIP = @ZIP_PROG@ +ZIP_PROG_OPTIONS = @ZIP_PROG_OPTIONS@ +ZIP_PROG_VFSSEARCH = @ZIP_PROG_VFSSEARCH@ SHARED_BUILD = @SHARED_BUILD@ INSTALL_LIBRARIES = @INSTALL_LIBRARIES@ INSTALL_MSGS = @INSTALL_MSGS@ @@ -653,7 +655,7 @@ MINIZIP_OBJS = \ zutil.$(HOST_OBJEXT) \ minizip.$(HOST_OBJEXT) -ZIP_INSTALL_OBJS = minizip${EXEEXT_FOR_BUILD} +ZIP_INSTALL_OBJS = @ZIP_INSTALL_OBJS@ #-------------------------------------------------------------------------- # Start of rules @@ -674,7 +676,7 @@ ${TCL_ZIP_FILE}: ${ZIP_INSTALL_OBJS} rm -rf ${TCL_VFS_ROOT} mkdir -p ${TCL_VFS_PATH} cp -a ../library/* ${TCL_VFS_PATH} - cd ${TCL_VFS_ROOT} ; ../minizip${EXEEXT_FOR_BUILD} -o ../${TCL_ZIP_FILE} `find . -type f` + cd ${TCL_VFS_ROOT} ; ${NATIVE_ZIP} ${ZIP_PROG_OPTIONS} ../${TCL_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} # The following target is configured by autoconf to generate either a shared # library or non-shared library for Tcl. diff --git a/unix/configure b/unix/configure index dd6bf6b..1c3a206 100755 --- a/unix/configure +++ b/unix/configure @@ -658,7 +658,6 @@ TCL_STUB_LIB_FILE TCL_LIB_SPEC TCL_LIB_FLAG TCL_LIB_FILE -TCL_ZIP_FILE PKG_CFG_ARGS TCL_YEAR TCL_PATCH_LEVEL @@ -667,10 +666,10 @@ TCL_MAJOR_VERSION TCL_VERSION INSTALL_MSGS INSTALL_LIBRARIES +TCL_ZIP_FILE ZIPFS_BUILD EXEEXT_FOR_BUILD CC_FOR_BUILD -ZIP_PROG DTRACE LDFLAGS_DEFAULT CFLAGS_DEFAULT @@ -2341,7 +2340,6 @@ VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} EXTRA_BUILD_HTML=${EXTRA_BUILD_HTML:-"@:"} -TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip #------------------------------------------------------------------------ # Setup configure arguments for bundled packages @@ -10155,153 +10153,115 @@ fi $as_echo "$tcl_ok" >&6; } #-------------------------------------------------------------------- -# Zipfs support +# Zipfs support - Tip 430 #-------------------------------------------------------------------- - -# -# Find a native zip implementation -# - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 -$as_echo_n "checking for zip... " >&6; } - if ${ac_cv_path_zip+:} false; then : - $as_echo_n "(cached) " >&6 +# Check whether --enable-zipfs was given. +if test "${enable_zipfs+set}" = set; then : + enableval=$enable_zipfs; tcl_ok=$enableval else - - search_path=`echo ${PATH} | sed -e 's/:/ /g'` - for dir in $search_path ; do - for j in `ls -r $dir/zip 2> /dev/null` \ - `ls -r $dir/zip 2> /dev/null` ; do - if test x"$ac_cv_path_zip" = x ; then - if test -f "$j" ; then - ac_cv_path_zip=$j - break - fi - fi - done - done - + tcl_ok=yes fi - - if test -f "$ac_cv_path_zip" ; then - ZIP_PROG="$ac_cv_path_zip" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5 -$as_echo "$ZIP_PROG" >&6; } - else - # It is not an error if an installed version of Zip can't be located. - ZIP_PROG="" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH" >&5 -$as_echo "No zip found on PATH" >&6; } - fi - - - -# -# Find a native compiler -# -# Put a plausible default for CC_FOR_BUILD in Makefile. -if test -z "$CC_FOR_BUILD"; then - if test "x$cross_compiling" = "xno"; then - CC_FOR_BUILD='$(CC)' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5 +if test "$tcl_ok" = "yes" ; then + # + # Find a native compiler + # + # Put a plausible default for CC_FOR_BUILD in Makefile. + if test -z "$CC_FOR_BUILD"; then + if test "x$cross_compiling" = "xno"; then + CC_FOR_BUILD='$(CC)' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc" >&5 $as_echo_n "checking for gcc... " >&6; } - if ${ac_cv_path_cc+:} false; then : + if ${ac_cv_path_cc+:} false; then : $as_echo_n "(cached) " >&6 else - search_path=`echo ${PATH} | sed -e 's/:/ /g'` - for dir in $search_path ; do - for j in `ls -r $dir/gcc 2> /dev/null` \ - `ls -r $dir/gcc 2> /dev/null` ; do - if test x"$ac_cv_path_cc" = x ; then - if test -f "$j" ; then - ac_cv_path_cc=$j - break - fi - fi - done - done + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/gcc 2> /dev/null` \ + `ls -r $dir/gcc 2> /dev/null` ; do + if test x"$ac_cv_path_cc" = x ; then + if test -f "$j" ; then + ac_cv_path_cc=$j + break + fi + fi + done + done fi - fi -fi + fi + fi -# Also set EXEEXT_FOR_BUILD. -if test "x$cross_compiling" = "xno"; then - EXEEXT_FOR_BUILD='$(EXEEXT)' - OBJEXT_FOR_BUILD='$(OBJEXT)' -else - OBJEXT_FOR_BUILD='.no' - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5 + # Also set EXEEXT_FOR_BUILD. + if test "x$cross_compiling" = "xno"; then + EXEEXT_FOR_BUILD='$(EXEEXT)' + OBJEXT_FOR_BUILD='$(OBJEXT)' + else + OBJEXT_FOR_BUILD='.no' + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5 $as_echo_n "checking for build system executable suffix... " >&6; } if ${bfd_cv_build_exeext+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest* - echo 'int main () { return 0; }' > conftest.c - bfd_cv_build_exeext= - ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 - for file in conftest.*; do - case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; - *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - rm -f conftest* - test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no + echo 'int main () { return 0; }' > conftest.c + bfd_cv_build_exeext= + ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + rm -f conftest* + test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_build_exeext" >&5 $as_echo "$bfd_cv_build_exeext" >&6; } - EXEEXT_FOR_BUILD="" - test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} -fi - - -if test "$ZIP_PROG" = ""; then - ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}' -fi - -# Check whether --enable-zipfs was given. -if test "${enable_zipfs+set}" = set; then : - enableval=$enable_zipfs; tcl_ok=$enableval -else - tcl_ok=yes -fi + EXEEXT_FOR_BUILD="" + test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} + fi - if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then + # + # Find a native zip implementation + # + SC_PROG_ZIP ZIPFS_BUILD=1 - else + TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip +else ZIPFS_BUILD=0 - fi - # Do checking message here to not mess up interleaved configure output - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5 + TCL_ZIP_FILE= +fi +# Do checking message here to not mess up interleaved configure output +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5 $as_echo_n "checking for building with zipfs... " >&6; } - if test "${ZIPFS_BUILD}" = 1; then - if test "${SHARED_BUILD}" = 0; then - ZIPFS_BUILD=2; +if test "${ZIPFS_BUILD}" = 1; then + if test "${SHARED_BUILD}" = 0; then + ZIPFS_BUILD=2; $as_echo "#define ZIPFS_BUILD 2" >>confdefs.h - INSTALL_LIBRARIES=install-libraries-zipfs-static - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + INSTALL_LIBRARIES=install-libraries-zipfs-static + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - else + else $as_echo "#define ZIPFS_BUILD 1" >>confdefs.h \ - INSTALL_LIBRARIES=install-libraries-zipfs-shared - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + INSTALL_LIBRARIES=install-libraries-zipfs-shared + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - INSTALL_LIBRARIES=install-libraries - INSTALL_MSGS=install-msgs fi +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +INSTALL_LIBRARIES=install-libraries +INSTALL_MSGS=install-msgs +fi + diff --git a/unix/configure.ac b/unix/configure.ac index ed85184..0928fc8 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -30,7 +30,6 @@ VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} EXTRA_BUILD_HTML=${EXTRA_BUILD_HTML:-"@:"} -TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip #------------------------------------------------------------------------ # Setup configure arguments for bundled packages @@ -793,53 +792,49 @@ fi AC_MSG_RESULT([$tcl_ok]) #-------------------------------------------------------------------- -# Zipfs support +# Zipfs support - Tip 430 #-------------------------------------------------------------------- - -# -# Find a native zip implementation -# -SC_PROG_ZIP - -# -# Find a native compiler -# -AX_CC_FOR_BUILD - -if test "$ZIP_PROG" = ""; then - ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}' -fi - AC_ARG_ENABLE(zipfs, AC_HELP_STRING([--enable-zipfs], [build with Zipfs support (default: on)]), [tcl_ok=$enableval], [tcl_ok=yes]) - if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then +if test "$tcl_ok" = "yes" ; then + # + # Find a native compiler + # + AX_CC_FOR_BUILD + # + # Find a native zip implementation + # + SC_PROG_ZIP ZIPFS_BUILD=1 - else + TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip +else ZIPFS_BUILD=0 + TCL_ZIP_FILE= +fi +# Do checking message here to not mess up interleaved configure output +AC_MSG_CHECKING([for building with zipfs]) +if test "${ZIPFS_BUILD}" = 1; then + if test "${SHARED_BUILD}" = 0; then + ZIPFS_BUILD=2; + AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?]) + INSTALL_LIBRARIES=install-libraries-zipfs-static + AC_MSG_RESULT([yes]) + else + AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\ + INSTALL_LIBRARIES=install-libraries-zipfs-shared + AC_MSG_RESULT([yes]) fi - # Do checking message here to not mess up interleaved configure output - AC_MSG_CHECKING([for building with zipfs]) - if test "${ZIPFS_BUILD}" = 1; then - if test "${SHARED_BUILD}" = 0; then - ZIPFS_BUILD=2; - AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?]) - INSTALL_LIBRARIES=install-libraries-zipfs-static - AC_MSG_RESULT([yes]) - else - AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\ - INSTALL_LIBRARIES=install-libraries-zipfs-shared - AC_MSG_RESULT([yes]) - fi - else - AC_MSG_RESULT([no]) - INSTALL_LIBRARIES=install-libraries - INSTALL_MSGS=install-msgs - fi - AC_SUBST(ZIPFS_BUILD) - AC_SUBST(INSTALL_LIBRARIES) - AC_SUBST(INSTALL_MSGS) +else +AC_MSG_RESULT([no]) +INSTALL_LIBRARIES=install-libraries +INSTALL_MSGS=install-msgs +fi +AC_SUBST(ZIPFS_BUILD) +AC_SUBST(TCL_ZIP_FILE) +AC_SUBST(INSTALL_LIBRARIES) +AC_SUBST(INSTALL_MSGS) #-------------------------------------------------------------------- diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 1806207..9cfb746 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -276,7 +276,6 @@ AC_DEFUN([SC_PATH_TKCONFIG], [ # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE -# TCL_ZIP_FILE #------------------------------------------------------------------------ AC_DEFUN([SC_LOAD_TCLCONFIG], [ @@ -290,7 +289,6 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [ fi # eval is required to do the TCL_DBGX substitution - eval "TCL_ZIP_FILE=\"${TCL_ZIP_FILE}\"" eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" @@ -338,7 +336,6 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [ AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SRC_DIR) - AC_SUBST(TCL_ZIP_FILE) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_LIB_SPEC) @@ -3019,107 +3016,138 @@ fi ]) #------------------------------------------------------------------------ -# SC_PROG_ZIP -# Locate a zip encoder installed on the system path, or none. +# SC_CC_FOR_BUILD +# For cross compiles, locate a C compiler that can generate native binaries. # # Arguments: # none # # Results: # Substitutes the following vars: -# ZIP_PROG +# CC_FOR_BUILD +# EXEEXT_FOR_BUILD #------------------------------------------------------------------------ -AC_DEFUN([SC_PROG_ZIP], [ - AC_MSG_CHECKING([for zip]) - AC_CACHE_VAL(ac_cv_path_zip, [ - search_path=`echo ${PATH} | sed -e 's/:/ /g'` - for dir in $search_path ; do - for j in `ls -r $dir/zip 2> /dev/null` \ - `ls -r $dir/zip 2> /dev/null` ; do - if test x"$ac_cv_path_zip" = x ; then - if test -f "$j" ; then - ac_cv_path_zip=$j - break - fi - fi - done - done - ]) - - if test -f "$ac_cv_path_zip" ; then - ZIP_PROG="$ac_cv_path_zip" - AC_MSG_RESULT([$ZIP_PROG]) +dnl Get a default for CC_FOR_BUILD to put into Makefile. +AC_DEFUN([AX_CC_FOR_BUILD],[# Put a plausible default for CC_FOR_BUILD in Makefile. + if test -z "$CC_FOR_BUILD"; then + if test "x$cross_compiling" = "xno"; then + CC_FOR_BUILD='$(CC)' + else + AC_MSG_CHECKING([for gcc]) + AC_CACHE_VAL(ac_cv_path_cc, [ + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/gcc 2> /dev/null` \ + `ls -r $dir/gcc 2> /dev/null` ; do + if test x"$ac_cv_path_cc" = x ; then + if test -f "$j" ; then + ac_cv_path_cc=$j + break + fi + fi + done + done + ]) + fi + fi + AC_SUBST(CC_FOR_BUILD) + # Also set EXEEXT_FOR_BUILD. + if test "x$cross_compiling" = "xno"; then + EXEEXT_FOR_BUILD='$(EXEEXT)' + OBJEXT_FOR_BUILD='$(OBJEXT)' else - # It is not an error if an installed version of Zip can't be located. - ZIP_PROG="" - AC_MSG_RESULT([No zip found on PATH]) + OBJEXT_FOR_BUILD='.no' + AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, + [rm -f conftest* + echo 'int main () { return 0; }' > conftest.c + bfd_cv_build_exeext= + ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + rm -f conftest* + test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) + EXEEXT_FOR_BUILD="" + test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} fi - AC_SUBST(ZIP_PROG) + AC_SUBST(EXEEXT_FOR_BUILD)])dnl + AC_SUBST(OBJEXT_FOR_BUILD)])dnl ]) + #------------------------------------------------------------------------ -# SC_CC_FOR_BUILD -# For cross compiles, locate a C compiler that can generate native binaries. +# SC_ZIPFS_SUPPORT +# Locate a zip encoder installed on the system path, or none. # # Arguments: # none # # Results: # Substitutes the following vars: -# CC_FOR_BUILD -# EXEEXT_FOR_BUILD +# ZIP_PROG +# ZIP_PROG_OPTIONS +# ZIP_PROG_VFSSEARCH +# ZIP_INSTALL_OBJS #------------------------------------------------------------------------ -dnl Get a default for CC_FOR_BUILD to put into Makefile. -AC_DEFUN([AX_CC_FOR_BUILD], -[# Put a plausible default for CC_FOR_BUILD in Makefile. -if test -z "$CC_FOR_BUILD"; then - if test "x$cross_compiling" = "xno"; then - CC_FOR_BUILD='$(CC)' - else - AC_MSG_CHECKING([for gcc]) - AC_CACHE_VAL(ac_cv_path_cc, [ - search_path=`echo ${PATH} | sed -e 's/:/ /g'` - for dir in $search_path ; do - for j in `ls -r $dir/gcc 2> /dev/null` \ - `ls -r $dir/gcc 2> /dev/null` ; do - if test x"$ac_cv_path_cc" = x ; then - if test -f "$j" ; then - ac_cv_path_cc=$j - break - fi - fi - done - done +AC_DEFUN([SC_ZIPFS_SUPPORT], [ + ZIP_PROG="" + ZIP_PROG_OPTIONS="" + ZIP_PROG_VFSSEARCH="" + ZIP_INSTALL_OBJS="" + AC_MSG_CHECKING([for zip]) + # If our native tclsh processes the "install" command line option + # we can use it to mint zip files + AS_IF([$TCLSH_PROG install],[ + ZIP_PROG=${TCLSH_PROG} + ZIP_PROG_OPTIONS="install mkzip" + ZIP_PROG_VFSSEARCH="." + AC_MSG_RESULT([Can use Native Tclsh for Zip encoding]) ]) - fi -fi -AC_SUBST(CC_FOR_BUILD) -# Also set EXEEXT_FOR_BUILD. -if test "x$cross_compiling" = "xno"; then - EXEEXT_FOR_BUILD='$(EXEEXT)' - OBJEXT_FOR_BUILD='$(OBJEXT)' -else - OBJEXT_FOR_BUILD='.no' - AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, - [rm -f conftest* - echo 'int main () { return 0; }' > conftest.c - bfd_cv_build_exeext= - ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 - for file in conftest.*; do - case $file in - *.c | *.o | *.obj | *.ilk | *.pdb) ;; - *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; - esac - done - rm -f conftest* - test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) - EXEEXT_FOR_BUILD="" - test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} -fi -AC_SUBST(EXEEXT_FOR_BUILD)])dnl -AC_SUBST(OBJEXT_FOR_BUILD)])dnl + + if test "x$ZIP_PROG" = "x" ; then + AC_MSG_CHECKING([for zip]) + AC_CACHE_VAL(ac_cv_path_zip, [ + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/zip 2> /dev/null` \ + `ls -r $dir/zip 2> /dev/null` ; do + if test x"$ac_cv_path_zip" = x ; then + if test -f "$j" ; then + ac_cv_path_zip=$j + break + fi + fi + done + done + ]) + if test -f "$ac_cv_path_zip" ; then + ZIP_PROG="$ac_cv_path_zip " + AC_MSG_RESULT([$ZIP_PROG]) + ZIP_PROG_OPTIONS="-rq" + ZIP_PROG_VFSSEARCH="." + AC_MSG_RESULT([Found INFO Zip in environment]) + # Use standard arguments for zip + else + # It is not an error if an installed version of Zip can't be located. + # We can use the locally distributed minizip instead + ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" + ZIP_PROG_OPTIONS="\"-o\"" + ZIP_PROG_VFSSEARCH="\`find . -type f\'" + ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" + AC_MSG_RESULT([No zip found on PATH building minizip]) + fi + fi + AC_SUBST(ZIP_PROG) + AC_SUBST(ZIP_PROG_OPTIONS) + AC_SUBST(ZIP_PROG_VFSSEARCH) + AC_SUBST(ZIP_INSTALL_OBJS) +]) + # Local Variables: # mode: autoconf # End: diff --git a/win/Makefile.in b/win/Makefile.in index 214cf7b..7f4fc70 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -214,6 +214,8 @@ HOST_EXEEXT = @EXEEXT_FOR_BUILD@ HOST_OBJEXT = @OBJEXT_FOR_BUILD@ ZIPFS_BUILD = @ZIPFS_BUILD@ NATIVE_ZIP = @ZIP_PROG@ +ZIP_PROG_OPTIONS = @ZIP_PROG_OPTIONS@ +ZIP_PROG_VFSSEARCH = @ZIP_PROG_VFSSEARCH@ SHARED_BUILD = @SHARED_BUILD@ INSTALL_MSGS = @INSTALL_MSGS@ INSTALL_LIBRARIES = @INSTALL_LIBRARIES@ @@ -236,7 +238,7 @@ MINIZIP_OBJS = \ zutil.$(HOST_OBJEXT) \ minizip.$(HOST_OBJEXT) -ZIP_INSTALL_OBJS = minizip${EXEEXT_FOR_BUILD} +ZIP_INSTALL_OBJS = @ZIP_INSTALL_OBJS@ CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${TCL_SHLIB_CFLAGS} \ -I"${ZLIB_DIR_NATIVE}" -I"${GENERIC_DIR_NATIVE}" \ @@ -482,7 +484,7 @@ ${TCL_ZIP_FILE}: ${ZIP_INSTALL_OBJS} rm -rf ${TCL_VFS_ROOT} mkdir -p ${TCL_VFS_PATH} cp -a ../library/* ${TCL_VFS_PATH} - cd ${TCL_VFS_ROOT} ; ../minizip${EXEEXT_FOR_BUILD} -o ../${TCL_ZIP_FILE} `find . -type f` + cd ${TCL_VFS_ROOT} ; ${NATIVE_ZIP} ${ZIP_PROG_OPTIONS} ../${TCL_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} $(TCLSH): $(TCLSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) $(CC) $(CFLAGS) $(TCLSH_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ diff --git a/win/configure b/win/configure index f65b78a..c99d499 100755 --- a/win/configure +++ b/win/configure @@ -687,7 +687,6 @@ TCL_STATIC_LIB_FLAG TCL_STATIC_LIB_FILE TCL_LIB_FLAG TCL_LIB_FILE -TCL_ZIP_FILE TCL_EXE PKG_CFG_ARGS TCL_PATCH_LEVEL @@ -702,10 +701,10 @@ LDFLAGS_DEFAULT CFLAGS_DEFAULT INSTALL_MSGS INSTALL_LIBRARIES +TCL_ZIP_FILE ZIPFS_BUILD EXEEXT_FOR_BUILD CC_FOR_BUILD -ZIP_PROG ZLIB_OBJS ZLIB_LIBS ZLIB_DLL_FILE @@ -2128,8 +2127,6 @@ REGVER=$TCL_REG_MAJOR_VERSION$TCL_REG_MINOR_VERSION PKG_CFG_ARGS=$@ -TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip - #------------------------------------------------------------------------ # Empty slate for bundled packages, to avoid stale configuration #------------------------------------------------------------------------ @@ -4844,52 +4841,20 @@ fi #-------------------------------------------------------------------- -# Zipfs support +# Zipfs support - Tip 430 #-------------------------------------------------------------------- - -# -# Find a native zip implementation -# - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 -$as_echo_n "checking for zip... " >&6; } - if ${ac_cv_path_zip+:} false; then : - $as_echo_n "(cached) " >&6 +# Check whether --enable-zipfs was given. +if test "${enable_zipfs+set}" = set; then : + enableval=$enable_zipfs; tcl_ok=$enableval else - - search_path=`echo ${PATH} | sed -e 's/:/ /g'` - for dir in $search_path ; do - for j in `ls -r $dir/zip 2> /dev/null` \ - `ls -r $dir/zip 2> /dev/null` ; do - if test x"$ac_cv_path_zip" = x ; then - if test -f "$j" ; then - ac_cv_path_zip=$j - break - fi - fi - done - done - + tcl_ok=yes fi - - if test -f "$ac_cv_path_zip" ; then - ZIP_PROG="$ac_cv_path_zip" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5 -$as_echo "$ZIP_PROG" >&6; } - else - # It is not an error if an installed version of Zip can't be located. - ZIP_PROG="" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH" >&5 -$as_echo "No zip found on PATH" >&6; } - fi - - - -# -# Find a native compiler -# -# Put a plausible default for CC_FOR_BUILD in Makefile. +if test "$tcl_ok" = "yes" ; then + # + # Find a native compiler + # + # Put a plausible default for CC_FOR_BUILD in Makefile. if test -z "$CC_FOR_BUILD"; then if test "x$cross_compiling" = "xno"; then CC_FOR_BUILD='$(CC)' @@ -4948,49 +4913,43 @@ $as_echo "$bfd_cv_build_exeext" >&6; } test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} fi - -if test "$ZIP_PROG" = ""; then - ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}' -fi - -# Check whether --enable-zipfs was given. -if test "${enable_zipfs+set}" = set; then : - enableval=$enable_zipfs; tcl_ok=$enableval -else - tcl_ok=yes -fi - - if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then + # + # Find a native zip implementation + # + SC_PROG_ZIP ZIPFS_BUILD=1 - else + TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip +else ZIPFS_BUILD=0 - fi - # Do checking message here to not mess up interleaved configure output - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5 + TCL_ZIP_FILE= +fi +# Do checking message here to not mess up interleaved configure output +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for building with zipfs" >&5 $as_echo_n "checking for building with zipfs... " >&6; } - if test "${ZIPFS_BUILD}" = 1; then - if test "${SHARED_BUILD}" = 0; then - ZIPFS_BUILD=2; +if test "${ZIPFS_BUILD}" = 1; then + if test "${SHARED_BUILD}" = 0; then + ZIPFS_BUILD=2; $as_echo "#define ZIPFS_BUILD 2" >>confdefs.h - INSTALL_LIBRARIES=install-libraries-zipfs-static - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + INSTALL_LIBRARIES=install-libraries-zipfs-static + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - else + else $as_echo "#define ZIPFS_BUILD 1" >>confdefs.h \ - INSTALL_LIBRARIES=install-libraries-zipfs-shared - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + INSTALL_LIBRARIES=install-libraries-zipfs-shared + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - INSTALL_LIBRARIES=install-libraries - INSTALL_MSGS=install-msgs fi +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +INSTALL_LIBRARIES=install-libraries +INSTALL_MSGS=install-msgs +fi + @@ -5388,7 +5347,6 @@ TCL_WIN_VERSION="$TCL_VERSION.$TCL_RELEASE_LEVEL.`echo $TCL_PATCH_LEVEL | tr -d - # empty on win diff --git a/win/configure.ac b/win/configure.ac index cf66fc2..b1f3a52 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -29,8 +29,6 @@ REGVER=$TCL_REG_MAJOR_VERSION$TCL_REG_MINOR_VERSION PKG_CFG_ARGS=$@ -TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip - #------------------------------------------------------------------------ # Empty slate for bundled packages, to avoid stale configuration #------------------------------------------------------------------------ @@ -178,53 +176,49 @@ AC_CHECK_TYPE([uintptr_t], [ #-------------------------------------------------------------------- -# Zipfs support +# Zipfs support - Tip 430 #-------------------------------------------------------------------- - -# -# Find a native zip implementation -# -SC_PROG_ZIP - -# -# Find a native compiler -# -AX_CC_FOR_BUILD - -if test "$ZIP_PROG" = ""; then - ZIP_PROG='./minizip${EXEEXT_FOR_BUILD}' -fi - AC_ARG_ENABLE(zipfs, AC_HELP_STRING([--enable-zipfs], [build with Zipfs support (default: on)]), [tcl_ok=$enableval], [tcl_ok=yes]) - if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then +if test "$tcl_ok" = "yes" ; then + # + # Find a native compiler + # + AX_CC_FOR_BUILD + # + # Find a native zip implementation + # + SC_PROG_ZIP ZIPFS_BUILD=1 - else + TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip +else ZIPFS_BUILD=0 + TCL_ZIP_FILE= +fi +# Do checking message here to not mess up interleaved configure output +AC_MSG_CHECKING([for building with zipfs]) +if test "${ZIPFS_BUILD}" = 1; then + if test "${SHARED_BUILD}" = 0; then + ZIPFS_BUILD=2; + AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?]) + INSTALL_LIBRARIES=install-libraries-zipfs-static + AC_MSG_RESULT([yes]) + else + AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\ + INSTALL_LIBRARIES=install-libraries-zipfs-shared + AC_MSG_RESULT([yes]) fi - # Do checking message here to not mess up interleaved configure output - AC_MSG_CHECKING([for building with zipfs]) - if test "${ZIPFS_BUILD}" = 1; then - if test "${SHARED_BUILD}" = 0; then - ZIPFS_BUILD=2; - AC_DEFINE(ZIPFS_BUILD, 2, [Are we building with zipfs enabled?]) - INSTALL_LIBRARIES=install-libraries-zipfs-static - AC_MSG_RESULT([yes]) - else - AC_DEFINE(ZIPFS_BUILD, 1, [Are we building with zipfs enabled?])\ - INSTALL_LIBRARIES=install-libraries-zipfs-shared - AC_MSG_RESULT([yes]) - fi - else - AC_MSG_RESULT([no]) - INSTALL_LIBRARIES=install-libraries - INSTALL_MSGS=install-msgs - fi - AC_SUBST(ZIPFS_BUILD) - AC_SUBST(INSTALL_LIBRARIES) - AC_SUBST(INSTALL_MSGS) +else +AC_MSG_RESULT([no]) +INSTALL_LIBRARIES=install-libraries +INSTALL_MSGS=install-msgs +fi +AC_SUBST(ZIPFS_BUILD) +AC_SUBST(TCL_ZIP_FILE) +AC_SUBST(INSTALL_LIBRARIES) +AC_SUBST(INSTALL_MSGS) #-------------------------------------------------------------------- @@ -423,7 +417,6 @@ AC_SUBST(TCL_PATCH_LEVEL) AC_SUBST(PKG_CFG_ARGS) AC_SUBST(TCL_EXE) -AC_SUBST(TCL_ZIP_FILE) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_STATIC_LIB_FILE) diff --git a/win/tcl.m4 b/win/tcl.m4 index 07be5a4..4d34c7d 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -1302,47 +1302,6 @@ print("manifest needed") AC_SUBST(VC_MANIFEST_EMBED_EXE) ]) - -#------------------------------------------------------------------------ -# SC_PROG_ZIP -# Locate a zip encoder installed on the system path, or none. -# -# Arguments: -# none -# -# Results: -# Substitutes the following vars: -# ZIP_PROG -#------------------------------------------------------------------------ - -AC_DEFUN([SC_PROG_ZIP], [ - AC_MSG_CHECKING([for zip]) - AC_CACHE_VAL(ac_cv_path_zip, [ - search_path=`echo ${PATH} | sed -e 's/:/ /g'` - for dir in $search_path ; do - for j in `ls -r $dir/zip 2> /dev/null` \ - `ls -r $dir/zip 2> /dev/null` ; do - if test x"$ac_cv_path_zip" = x ; then - if test -f "$j" ; then - ac_cv_path_zip=$j - break - fi - fi - done - done - ]) - - if test -f "$ac_cv_path_zip" ; then - ZIP_PROG="$ac_cv_path_zip" - AC_MSG_RESULT([$ZIP_PROG]) - else - # It is not an error if an installed version of Zip can't be located. - ZIP_PROG="" - AC_MSG_RESULT([No zip found on PATH]) - fi - AC_SUBST(ZIP_PROG) -]) - #------------------------------------------------------------------------ # SC_CC_FOR_BUILD # For cross compiles, locate a C compiler that can generate native binaries. @@ -1405,3 +1364,74 @@ else fi AC_SUBST(EXEEXT_FOR_BUILD)])dnl AC_SUBST(OBJEXT_FOR_BUILD)])dnl + + + +#------------------------------------------------------------------------ +# SC_ZIPFS_SUPPORT +# Locate a zip encoder installed on the system path, or none. +# +# Arguments: +# none +# +# Results: +# Substitutes the following vars: +# ZIP_PROG +# ZIP_PROG_OPTIONS +# ZIP_PROG_VFSSEARCH +# ZIP_INSTALL_OBJS +#------------------------------------------------------------------------ + +AC_DEFUN([SC_ZIPFS_SUPPORT], [ + ZIP_PROG="" + ZIP_PROG_OPTIONS="" + ZIP_PROG_VFSSEARCH="" + ZIP_INSTALL_OBJS="" + AC_MSG_CHECKING([for zip]) + # If our native tclsh processes the "install" command line option + # we can use it to mint zip files + AS_IF([$TCLSH_PROG install],[ + ZIP_PROG=${TCLSH_PROG} + ZIP_PROG_OPTIONS="install mkzip" + ZIP_PROG_VFSSEARCH="." + AC_MSG_RESULT([Can use Native Tclsh for Zip encoding]) + ]) + + if test "x$ZIP_PROG" = "x" ; then + AC_MSG_CHECKING([for zip]) + AC_CACHE_VAL(ac_cv_path_zip, [ + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/zip 2> /dev/null` \ + `ls -r $dir/zip 2> /dev/null` ; do + if test x"$ac_cv_path_zip" = x ; then + if test -f "$j" ; then + ac_cv_path_zip=$j + break + fi + fi + done + done + ]) + if test -f "$ac_cv_path_zip" ; then + ZIP_PROG="$ac_cv_path_zip " + AC_MSG_RESULT([$ZIP_PROG]) + ZIP_PROG_OPTIONS="-rq" + ZIP_PROG_VFSSEARCH="." + AC_MSG_RESULT([Found INFO Zip in environment]) + # Use standard arguments for zip + else + # It is not an error if an installed version of Zip can't be located. + # We can use the locally distributed minizip instead + ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" + ZIP_PROG_OPTIONS="\"-o\"" + ZIP_PROG_VFSSEARCH="\`find . -type f\'" + ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" + AC_MSG_RESULT([No zip found on PATH building minizip]) + fi + fi + AC_SUBST(ZIP_PROG) + AC_SUBST(ZIP_PROG_OPTIONS) + AC_SUBST(ZIP_PROG_VFSSEARCH) + AC_SUBST(ZIP_INSTALL_OBJS) +]) -- cgit v0.12 From 3640513caf65072e9caf1d7f24856864767c9cca Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 20 Nov 2017 18:08:12 +0000 Subject: Autoconf fixes --- unix/configure | 71 ++++++++++++++++++++++++++++++++++- unix/configure.ac | 2 +- win/configure | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++- win/configure.ac | 3 +- 4 files changed, 180 insertions(+), 4 deletions(-) diff --git a/unix/configure b/unix/configure index 1c3a206..cbcdd85 100755 --- a/unix/configure +++ b/unix/configure @@ -668,6 +668,10 @@ INSTALL_MSGS INSTALL_LIBRARIES TCL_ZIP_FILE ZIPFS_BUILD +ZIP_INSTALL_OBJS +ZIP_PROG_VFSSEARCH +ZIP_PROG_OPTIONS +ZIP_PROG EXEEXT_FOR_BUILD CC_FOR_BUILD DTRACE @@ -10228,7 +10232,72 @@ $as_echo "$bfd_cv_build_exeext" >&6; } # # Find a native zip implementation # - SC_PROG_ZIP + + ZIP_PROG="" + ZIP_PROG_OPTIONS="" + ZIP_PROG_VFSSEARCH="" + ZIP_INSTALL_OBJS="" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 +$as_echo_n "checking for zip... " >&6; } + # If our native tclsh processes the "install" command line option + # we can use it to mint zip files + if $TCLSH_PROG install; then : + + ZIP_PROG=${TCLSH_PROG} + ZIP_PROG_OPTIONS="install mkzip" + ZIP_PROG_VFSSEARCH="." + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Can use Native Tclsh for Zip encoding" >&5 +$as_echo "Can use Native Tclsh for Zip encoding" >&6; } + +fi + + if test "x$ZIP_PROG" = "x" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 +$as_echo_n "checking for zip... " >&6; } + if ${ac_cv_path_zip+:} false; then : + $as_echo_n "(cached) " >&6 +else + + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/zip 2> /dev/null` \ + `ls -r $dir/zip 2> /dev/null` ; do + if test x"$ac_cv_path_zip" = x ; then + if test -f "$j" ; then + ac_cv_path_zip=$j + break + fi + fi + done + done + +fi + + if test -f "$ac_cv_path_zip" ; then + ZIP_PROG="$ac_cv_path_zip " + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5 +$as_echo "$ZIP_PROG" >&6; } + ZIP_PROG_OPTIONS="-rq" + ZIP_PROG_VFSSEARCH="." + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Found INFO Zip in environment" >&5 +$as_echo "Found INFO Zip in environment" >&6; } + # Use standard arguments for zip + else + # It is not an error if an installed version of Zip can't be located. + # We can use the locally distributed minizip instead + ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" + ZIP_PROG_OPTIONS="\"-o\"" + ZIP_PROG_VFSSEARCH="\`find . -type f\'" + ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH building minizip" >&5 +$as_echo "No zip found on PATH building minizip" >&6; } + fi + fi + + + + + ZIPFS_BUILD=1 TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip else diff --git a/unix/configure.ac b/unix/configure.ac index 0928fc8..d633cce 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -806,7 +806,7 @@ if test "$tcl_ok" = "yes" ; then # # Find a native zip implementation # - SC_PROG_ZIP + SC_ZIPFS_SUPPORT ZIPFS_BUILD=1 TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip else diff --git a/win/configure b/win/configure index c99d499..9bc07f0 100755 --- a/win/configure +++ b/win/configure @@ -703,6 +703,11 @@ INSTALL_MSGS INSTALL_LIBRARIES TCL_ZIP_FILE ZIPFS_BUILD +ZIP_INSTALL_OBJS +ZIP_PROG_VFSSEARCH +ZIP_PROG_OPTIONS +ZIP_PROG +TCLSH_PROG EXEEXT_FOR_BUILD CC_FOR_BUILD ZLIB_OBJS @@ -4916,7 +4921,108 @@ fi # # Find a native zip implementation # - SC_PROG_ZIP + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5 +$as_echo_n "checking for tclsh... " >&6; } + + if ${ac_cv_path_tclsh+:} false; then : + $as_echo_n "(cached) " >&6 +else + + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/tclsh[8-9]*.exe 2> /dev/null` \ + `ls -r $dir/tclsh* 2> /dev/null` ; do + if test x"$ac_cv_path_tclsh" = x ; then + if test -f "$j" ; then + ac_cv_path_tclsh=$j + break + fi + fi + done + done + +fi + + + if test -f "$ac_cv_path_tclsh" ; then + TCLSH_PROG="$ac_cv_path_tclsh" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH_PROG" >&5 +$as_echo "$TCLSH_PROG" >&6; } + else + # It is not an error if an installed version of Tcl can't be located. + TCLSH_PROG="" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: No tclsh found on PATH" >&5 +$as_echo "No tclsh found on PATH" >&6; } + fi + + + + ZIP_PROG="" + ZIP_PROG_OPTIONS="" + ZIP_PROG_VFSSEARCH="" + ZIP_INSTALL_OBJS="" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 +$as_echo_n "checking for zip... " >&6; } + # If our native tclsh processes the "install" command line option + # we can use it to mint zip files + if $TCLSH_PROG install; then : + + ZIP_PROG=${TCLSH_PROG} + ZIP_PROG_OPTIONS="install mkzip" + ZIP_PROG_VFSSEARCH="." + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Can use Native Tclsh for Zip encoding" >&5 +$as_echo "Can use Native Tclsh for Zip encoding" >&6; } + +fi + + if test "x$ZIP_PROG" = "x" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zip" >&5 +$as_echo_n "checking for zip... " >&6; } + if ${ac_cv_path_zip+:} false; then : + $as_echo_n "(cached) " >&6 +else + + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + for dir in $search_path ; do + for j in `ls -r $dir/zip 2> /dev/null` \ + `ls -r $dir/zip 2> /dev/null` ; do + if test x"$ac_cv_path_zip" = x ; then + if test -f "$j" ; then + ac_cv_path_zip=$j + break + fi + fi + done + done + +fi + + if test -f "$ac_cv_path_zip" ; then + ZIP_PROG="$ac_cv_path_zip " + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP_PROG" >&5 +$as_echo "$ZIP_PROG" >&6; } + ZIP_PROG_OPTIONS="-rq" + ZIP_PROG_VFSSEARCH="." + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Found INFO Zip in environment" >&5 +$as_echo "Found INFO Zip in environment" >&6; } + # Use standard arguments for zip + else + # It is not an error if an installed version of Zip can't be located. + # We can use the locally distributed minizip instead + ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" + ZIP_PROG_OPTIONS="\"-o\"" + ZIP_PROG_VFSSEARCH="\`find . -type f\'" + ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH building minizip" >&5 +$as_echo "No zip found on PATH building minizip" >&6; } + fi + fi + + + + + ZIPFS_BUILD=1 TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip else diff --git a/win/configure.ac b/win/configure.ac index b1f3a52..41bd55c 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -190,7 +190,8 @@ if test "$tcl_ok" = "yes" ; then # # Find a native zip implementation # - SC_PROG_ZIP + SC_PROG_TCLSH + SC_ZIPFS_SUPPORT ZIPFS_BUILD=1 TCL_ZIP_FILE=libtcl_${TCL_MAJOR_VERSION}_${TCL_MINOR_VERSION}_${TCL_PATCH_LEVEL}.zip else -- cgit v0.12 From 4a8bb308e8dad6abe65db94dfe0c0ddccdbcbb6c Mon Sep 17 00:00:00 2001 From: tne Date: Mon, 20 Nov 2017 19:21:12 +0000 Subject: Fixes to determing the dll location on Windows using GetModuleFileName() --- generic/tclZipfs.c | 41 +++++++++++++++++++++++++++++++++++++++ win/Makefile.in | 57 +++++++++++++++++++++++++++++------------------------- 2 files changed, 72 insertions(+), 26 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 8c852b2..f02cc06 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -16,6 +16,8 @@ #if !defined(_WIN32) && !defined(_WIN64) #include +#else +#include #endif #include #include @@ -3888,6 +3890,26 @@ TclZipfs_Init(Tcl_Interp *interp) #endif } +#if defined(_WIN32) || defined(_WIN64) +#define LIBRARY_SIZE 64 +static int +ToUtf( + const WCHAR *wSrc, + char *dst) +{ + char *start; + + start = dst; + while (*wSrc != '\0') { + dst += Tcl_UniCharToUtf(*wSrc, dst); + wSrc++; + } + *dst = '\0'; + return (int) (dst - start); +} + +#endif + static int TclZipfs_AppHook_FindTclInit(const char *archive){ Tcl_Obj *vfsinitscript; int found; @@ -3918,6 +3940,12 @@ int TclZipfs_AppHook(int *argc, char ***argv){ */ CONST char *archive; +#if defined(_WIN32) || defined(_WIN64) + HMODULE hModule = TclWinGetTclInstance(); + WCHAR wName[MAX_PATH + LIBRARY_SIZE]; + char dllname[(MAX_PATH + LIBRARY_SIZE) * TCL_UTF_MAX]; +#endif + Tcl_FindExecutable(*argv[0]); archive=Tcl_GetNameOfExecutable(); TclZipfs_Init(NULL); @@ -4006,10 +4034,23 @@ int TclZipfs_AppHook(int *argc, char ***argv){ } } } +#if defined(_WIN32) || defined(_WIN64) + if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) { + GetModuleFileNameA(hModule, dllname, MAX_PATH); + } else { + ToUtf(wName, dllname); + } + printf("DLL FILE: %s\n",dllname); fflush(stdout); + /* Mount zip file and dll before releasing to search */ + if(TclZipfs_AppHook_FindTclInit(dllname)==TCL_OK) { + return TCL_OK; + } +#else /* Mount zip file and dll before releasing to search */ if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_DLLFILE)==TCL_OK) { return TCL_OK; } +#endif if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { return TCL_OK; } diff --git a/win/Makefile.in b/win/Makefile.in index 7f4fc70..6734985 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -560,9 +560,10 @@ tclMain2.${OBJEXT}: tclMain.c # TIP #430, ZipFS Support tclZipfs.${OBJEXT}: $(GENERIC_DIR)/tclZipfs.c $(CC) -c $(CC_SWITCHES) -DBUILD_tcl \ + -DCFG_RUNTIME_PATH=\"$(bindir_native)\" \ -DCFG_RUNTIME_DLLFILE="\"$(TCL_LIB_FILE)\"" \ -DCFG_RUNTIME_ZIPFILE="\"$(TCL_ZIP_FILE)\"" \ - -DCFG_RUNTIME_PATH="\"$(DLL_INSTALL_DIR)\"" \ + -DCFG_RUNTIME_PATH="\"$(BIN_INSTALL_DIR)\"" \ $(ZLIB_INCLUDE) -I$(ZLIB_DIR)/contrib/minizip @DEPARG@ $(CC_OBJNAME) @@ -705,7 +706,15 @@ gentommath_h: "$(TOMMATH_DIR_NATIVE)/tommath.h" \ > "$(GENERIC_DIR_NATIVE)/tclTomMath.h" -install: all install-binaries install-libraries install-doc install-packages +INSTALL_BASE_TARGETS = install-binaries $(INSTALL_LIBRARIES) $(INSTALL_MSGS) $(INSTALL_TZDATA) +INSTALL_DOC_TARGETS = install-doc +INSTALL_PACKAGE_TARGETS = install-packages +INSTALL_DEV_TARGETS = install-headers +INSTALL_EXTRA_TARGETS = +INSTALL_TARGETS = $(INSTALL_BASE_TARGETS) $(INSTALL_DOC_TARGETS) $(INSTALL_DEV_TARGETS) \ + $(INSTALL_PACKAGE_TARGETS) $(INSTALL_EXTRA_TARGETS) + +install: $(INSTALL_TARGETS) install-binaries: binaries @for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" ; \ @@ -761,23 +770,9 @@ install-binaries: binaries fi install-libraries-zipfs-shared: libraries - @for i in "$(SCRIPT_INSTALL_DIR)"; \ - do \ - if [ ! -d "$$i" ] ; then \ - echo "Making directory $$i"; \ - $(INSTALL_DATA_DIR) "$$i"; \ - else true; \ - fi; \ - done; - @echo "Installing library files to $(SCRIPT_INSTALL_DIR)/"; - @for i in \ - $(UNIX_DIR)/tclAppInit.c @LDAIX_SRC@ @DTRACE_SRC@; \ - do \ - $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"; \ - done; install-libraries-zipfs-static: install-libraries-zipfs-shared - $(INSTALL_DATA) ${TCL_ZIP_FILE} "$(LIB_INSTALL_DIR)" ;\ + $(INSTALL_DATA) ${TCL_ZIP_FILE} "$(LIB_INSTALL_DIR)" install-libraries: libraries install-tzdata install-msgs @for i in "$$($(CYGPATH) $(prefix)/lib)" "$(INCLUDE_INSTALL_DIR)" \ @@ -797,15 +792,6 @@ install-libraries: libraries install-tzdata install-msgs else true; \ fi; \ done; - @echo "Installing header files"; - @for i in "$(GENERIC_DIR)/tcl.h" "$(GENERIC_DIR)/tclDecls.h" \ - "$(GENERIC_DIR)/tclOO.h" "$(GENERIC_DIR)/tclOODecls.h" \ - "$(GENERIC_DIR)/tclPlatDecls.h" \ - "$(GENERIC_DIR)/tclTomMath.h" \ - "$(GENERIC_DIR)/tclTomMathDecls.h"; \ - do \ - $(COPY) "$$i" "$(INCLUDE_INSTALL_DIR)"; \ - done; @echo "Installing library files to $(SCRIPT_INSTALL_DIR)"; @for i in $(ROOT_DIR)/library/*.tcl $(ROOT_DIR)/library/tclIndex; \ do \ @@ -848,6 +834,25 @@ install-msgs: install-doc: doc +install-headers: + @for i in "$(INCLUDE_INSTALL_DIR)"; \ + do \ + if [ ! -d "$$i" ] ; then \ + echo "Making directory $$i"; \ + $(INSTALL_DATA_DIR) "$$i"; \ + else true; \ + fi; \ + done; + @echo "Installing header files to $(INCLUDE_INSTALL_DIR)/"; + @for i in $(GENERIC_DIR)/tcl.h $(GENERIC_DIR)/tclDecls.h \ + $(GENERIC_DIR)/tclOO.h $(GENERIC_DIR)/tclOODecls.h \ + $(GENERIC_DIR)/tclPlatDecls.h \ + $(GENERIC_DIR)/tclTomMath.h \ + $(GENERIC_DIR)/tclTomMathDecls.h ; \ + do \ + $(COPY) $$i "$(INCLUDE_INSTALL_DIR)"; \ + done; + # Optional target to install private headers install-private-headers: libraries @for i in $(PRIVATE_INCLUDE_INSTALL_DIR); \ -- cgit v0.12 From 1f34b918b9bf1c3cc57c59952f006aec619c435c Mon Sep 17 00:00:00 2001 From: tne Date: Mon, 20 Nov 2017 19:35:40 +0000 Subject: Removing debugging printf() statement --- generic/tclZipfs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index f02cc06..b3e863b 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -4040,7 +4040,6 @@ int TclZipfs_AppHook(int *argc, char ***argv){ } else { ToUtf(wName, dllname); } - printf("DLL FILE: %s\n",dllname); fflush(stdout); /* Mount zip file and dll before releasing to search */ if(TclZipfs_AppHook_FindTclInit(dllname)==TCL_OK) { return TCL_OK; -- cgit v0.12 From 12a14f4954455c5d991ab3e71094f7995b15e8c7 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 20 Nov 2017 21:29:57 +0000 Subject: Updating tcl.m4 in windows to fix a typo --- win/configure | 2 +- win/tcl.m4 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/win/configure b/win/configure index 9bc07f0..846d824 100755 --- a/win/configure +++ b/win/configure @@ -5012,7 +5012,7 @@ $as_echo "Found INFO Zip in environment" >&6; } # We can use the locally distributed minizip instead ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" ZIP_PROG_OPTIONS="\"-o\"" - ZIP_PROG_VFSSEARCH="\`find . -type f\'" + ZIP_PROG_VFSSEARCH="'find . -type f'" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH building minizip" >&5 $as_echo "No zip found on PATH building minizip" >&6; } diff --git a/win/tcl.m4 b/win/tcl.m4 index 4d34c7d..3a9ae07 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -1425,7 +1425,7 @@ AC_DEFUN([SC_ZIPFS_SUPPORT], [ # We can use the locally distributed minizip instead ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" ZIP_PROG_OPTIONS="\"-o\"" - ZIP_PROG_VFSSEARCH="\`find . -type f\'" + ZIP_PROG_VFSSEARCH="'find . -type f'" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" AC_MSG_RESULT([No zip found on PATH building minizip]) fi -- cgit v0.12 From d2fc7a6ed510eccea8dd9052d243ed160eb883ba Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Mon, 20 Nov 2017 22:45:35 +0000 Subject: Fixing the quoting for arguments to minizip --- unix/configure | 4 ++-- unix/tcl.m4 | 4 ++-- win/configure | 2 +- win/tcl.m4 | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/unix/configure b/unix/configure index cbcdd85..53e0a07 100755 --- a/unix/configure +++ b/unix/configure @@ -10286,8 +10286,8 @@ $as_echo "Found INFO Zip in environment" >&6; } # It is not an error if an installed version of Zip can't be located. # We can use the locally distributed minizip instead ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" - ZIP_PROG_OPTIONS="\"-o\"" - ZIP_PROG_VFSSEARCH="\`find . -type f\'" + ZIP_PROG_OPTIONS="-o" + ZIP_PROG_VFSSEARCH="\"`find . -type f`\"" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH building minizip" >&5 $as_echo "No zip found on PATH building minizip" >&6; } diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 9cfb746..dbc92da 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -3136,8 +3136,8 @@ AC_DEFUN([SC_ZIPFS_SUPPORT], [ # It is not an error if an installed version of Zip can't be located. # We can use the locally distributed minizip instead ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" - ZIP_PROG_OPTIONS="\"-o\"" - ZIP_PROG_VFSSEARCH="\`find . -type f\'" + ZIP_PROG_OPTIONS="-o" + ZIP_PROG_VFSSEARCH="\"`find . -type f`\"" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" AC_MSG_RESULT([No zip found on PATH building minizip]) fi diff --git a/win/configure b/win/configure index 846d824..f4d0448 100755 --- a/win/configure +++ b/win/configure @@ -5012,7 +5012,7 @@ $as_echo "Found INFO Zip in environment" >&6; } # We can use the locally distributed minizip instead ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" ZIP_PROG_OPTIONS="\"-o\"" - ZIP_PROG_VFSSEARCH="'find . -type f'" + ZIP_PROG_VFSSEARCH="\"`find . -type f`\"" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH building minizip" >&5 $as_echo "No zip found on PATH building minizip" >&6; } diff --git a/win/tcl.m4 b/win/tcl.m4 index 3a9ae07..ecfcd52 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -1425,7 +1425,7 @@ AC_DEFUN([SC_ZIPFS_SUPPORT], [ # We can use the locally distributed minizip instead ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" ZIP_PROG_OPTIONS="\"-o\"" - ZIP_PROG_VFSSEARCH="'find . -type f'" + ZIP_PROG_VFSSEARCH="\"`find . -type f`\"" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" AC_MSG_RESULT([No zip found on PATH building minizip]) fi -- cgit v0.12 From 3cd8b86e50caa31bf230d5f1b224708f5dda41af Mon Sep 17 00:00:00 2001 From: tne Date: Mon, 20 Nov 2017 23:34:21 +0000 Subject: Change to TclZipfs_AppHook to accomidate Windows --- generic/tcl.decls | 11 +++++++---- generic/tclDecls.h | 5 ----- generic/tclPlatDecls.h | 26 ++++++++++++++++++++------ generic/tclStubInit.c | 7 +++++-- generic/tclZipfs.c | 31 ++++++++++++++++++++++++++++--- 5 files changed, 60 insertions(+), 20 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index e929eaf..03104ba 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2340,9 +2340,7 @@ declare 632 { declare 633 { int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) } -declare 634 { - int TclZipfs_AppHook(int *argc, char ***argv) -} + ############################################################################## # Define the platform specific public Tcl interface. These functions are only @@ -2353,6 +2351,9 @@ interface tclPlat ################################ # Unix specific functions # (none) +declare 0 unix { + int TclZipfs_AppHook(int *argc, char ***argv) +} ################################ # Windows specific functions @@ -2365,7 +2366,9 @@ declare 0 win { declare 1 win { char *Tcl_WinTCharToUtf(const TCHAR *str, int len, Tcl_DString *dsPtr) } - +declare 2 win { + int TclZipfs_AppHook(int *argc, TCHAR ***argv) +} ################################ # Mac OS X specific functions diff --git a/generic/tclDecls.h b/generic/tclDecls.h index c41a20b..c5b42d3 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1845,8 +1845,6 @@ EXTERN int TclZipfs_Mount(Tcl_Interp *interp, /* 633 */ EXTERN int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname); -/* 634 */ -EXTERN int TclZipfs_AppHook(int *argc, char ***argv); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2516,7 +2514,6 @@ typedef struct TclStubs { Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, const char *service, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */ int (*tclZipfs_Mount) (Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd); /* 632 */ int (*tclZipfs_Unmount) (Tcl_Interp *interp, const char *zipname); /* 633 */ - int (*tclZipfs_AppHook) (int *argc, char ***argv); /* 634 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -3815,8 +3812,6 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tclZipfs_Mount) /* 632 */ #define TclZipfs_Unmount \ (tclStubsPtr->tclZipfs_Unmount) /* 633 */ -#define TclZipfs_AppHook \ - (tclStubsPtr->tclZipfs_AppHook) /* 634 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h index abc8ee8..e746a6d 100644 --- a/generic/tclPlatDecls.h +++ b/generic/tclPlatDecls.h @@ -50,6 +50,10 @@ extern "C" { * Exported function declarations: */ +#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ +/* 0 */ +EXTERN int TclZipfs_AppHook(int *argc, char ***argv); +#endif /* UNIX */ #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ /* 0 */ EXTERN TCHAR * Tcl_WinUtfToTChar(const char *str, int len, @@ -57,12 +61,12 @@ EXTERN TCHAR * Tcl_WinUtfToTChar(const char *str, int len, /* 1 */ EXTERN char * Tcl_WinTCharToUtf(const TCHAR *str, int len, Tcl_DString *dsPtr); +/* 2 */ +EXTERN int TclZipfs_AppHook(int *argc, TCHAR ***argv); #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ /* 0 */ -EXTERN int Tcl_MacOSXOpenBundleResources(Tcl_Interp *interp, - const char *bundleName, int hasResourceFile, - int maxPathLen, char *libraryPath); +EXTERN int TclZipfs_AppHook(int *argc, char ***argv); /* 1 */ EXTERN int Tcl_MacOSXOpenVersionedBundleResources( Tcl_Interp *interp, const char *bundleName, @@ -75,12 +79,16 @@ typedef struct TclPlatStubs { int magic; void *hooks; +#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ + int (*tclZipfs_AppHook) (int *argc, char ***argv); /* 0 */ +#endif /* UNIX */ #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ TCHAR * (*tcl_WinUtfToTChar) (const char *str, int len, Tcl_DString *dsPtr); /* 0 */ char * (*tcl_WinTCharToUtf) (const TCHAR *str, int len, Tcl_DString *dsPtr); /* 1 */ + int (*tclZipfs_AppHook) (int *argc, TCHAR ***argv); /* 2 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ - int (*tcl_MacOSXOpenBundleResources) (Tcl_Interp *interp, const char *bundleName, int hasResourceFile, int maxPathLen, char *libraryPath); /* 0 */ + int (*tclZipfs_AppHook) (int *argc, char ***argv); /* 0 */ int (*tcl_MacOSXOpenVersionedBundleResources) (Tcl_Interp *interp, const char *bundleName, const char *bundleVersion, int hasResourceFile, int maxPathLen, char *libraryPath); /* 1 */ #endif /* MACOSX */ } TclPlatStubs; @@ -97,15 +105,21 @@ extern const TclPlatStubs *tclPlatStubsPtr; * Inline function declarations: */ +#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ +#define TclZipfs_AppHook \ + (tclPlatStubsPtr->tclZipfs_AppHook) /* 0 */ +#endif /* UNIX */ #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ #define Tcl_WinUtfToTChar \ (tclPlatStubsPtr->tcl_WinUtfToTChar) /* 0 */ #define Tcl_WinTCharToUtf \ (tclPlatStubsPtr->tcl_WinTCharToUtf) /* 1 */ +#define TclZipfs_AppHook \ + (tclPlatStubsPtr->tclZipfs_AppHook) /* 2 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ -#define Tcl_MacOSXOpenBundleResources \ - (tclPlatStubsPtr->tcl_MacOSXOpenBundleResources) /* 0 */ +#define TclZipfs_AppHook \ + (tclPlatStubsPtr->tclZipfs_AppHook) /* 0 */ #define Tcl_MacOSXOpenVersionedBundleResources \ (tclPlatStubsPtr->tcl_MacOSXOpenVersionedBundleResources) /* 1 */ #endif /* MACOSX */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 0702f69..ffa42bf 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -789,12 +789,16 @@ static const TclIntPlatStubs tclIntPlatStubs = { static const TclPlatStubs tclPlatStubs = { TCL_STUB_MAGIC, 0, +#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TCL) /* UNIX */ + TclZipfs_AppHook, /* 0 */ +#endif /* UNIX */ #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ Tcl_WinUtfToTChar, /* 0 */ Tcl_WinTCharToUtf, /* 1 */ + TclZipfs_AppHook, /* 2 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ - Tcl_MacOSXOpenBundleResources, /* 0 */ + TclZipfs_AppHook, /* 0 */ Tcl_MacOSXOpenVersionedBundleResources, /* 1 */ #endif /* MACOSX */ }; @@ -1543,7 +1547,6 @@ const TclStubs tclStubs = { Tcl_OpenTcpServerEx, /* 631 */ TclZipfs_Mount, /* 632 */ TclZipfs_Unmount, /* 633 */ - TclZipfs_AppHook, /* 634 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index b3e863b..e6acc8d 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3933,13 +3933,18 @@ static int TclZipfs_AppHook_FindTclInit(const char *archive){ return TCL_ERROR; } -int TclZipfs_AppHook(int *argc, char ***argv){ +#if defined(_WIN32) || defined(_WIN64) +int TclZipfs_AppHook(int *argc, TCHAR ***argv) +#else +int TclZipfs_AppHook(int *argc, char ***argv) +#endif +{ /* * Tclkit_MainHook -- * Performs the argument munging for the shell */ - CONST char *archive; + char *archive; #if defined(_WIN32) || defined(_WIN64) HMODULE hModule = TclWinGetTclInstance(); WCHAR wName[MAX_PATH + LIBRARY_SIZE]; @@ -4004,13 +4009,33 @@ int TclZipfs_AppHook(int *argc, char ***argv){ return TCL_OK; } } else if (*argc>1) { + Tcl_DString ds; +#if defined(_WIN32) || defined(_WIN64) + strcpy(archive, Tcl_WinTCharToUtf((*argv)[1], -1, &ds)); + Tcl_DStringFree(&ds); +#else archive=(*argv)[1]; +#endif + printf(" arg1 %s\n",archive); fflush(stdout); if(strcmp(archive,"install")==0) { /* If the first argument is mkzip, run the mkzip program */ Tcl_Obj *vfsinitscript; + vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/tcl_library/install.tcl",-1); Tcl_IncrRefCount(vfsinitscript); - Tcl_SetStartupScript(vfsinitscript,NULL); + printf(" startup script %s\n",Tcl_GetString(vfsinitscript)); fflush(stdout); +#if defined(_WIN32) || defined(_WIN64) + if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) { + GetModuleFileNameA(hModule, dllname, MAX_PATH); + } else { + ToUtf(wName, dllname); + } + /* Mount zip file and dll before releasing to search */ + if(TclZipfs_AppHook_FindTclInit(dllname)==TCL_OK) { + Tcl_SetStartupScript(vfsinitscript,NULL); + return TCL_OK; + } +#endif } else { if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { int found; -- cgit v0.12 From 6b40a5dc5afee7752743e154ebff5935e614214f Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 21 Nov 2017 00:36:55 +0000 Subject: Added a new function to the Zipfs: TclZipfs_TclLibrary, which returns a previously discovered /library file system from a zip archive, performs the search to see if the current dll has one (and return that), or NULL if zipfs cannot locate /library. Injected a call to [zipfs tcl_library] (which invokes TclZipfs_TclLibrary) inside if interp.c as the first command to try to locate Tcl_Library (if a preinit script hasn't already pointed one out to us.) --- generic/tcl.decls | 4 +- generic/tclDecls.h | 5 ++ generic/tclInterp.c | 1 + generic/tclStubInit.c | 1 + generic/tclZipfs.c | 136 ++++++++++++++++++++++++++++++++++---------------- 5 files changed, 102 insertions(+), 45 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 03104ba..87beab3 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2340,7 +2340,9 @@ declare 632 { declare 633 { int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) } - +declare 634 { + Tcl_Obj *TclZipfs_TclLibrary(void) +} ############################################################################## # Define the platform specific public Tcl interface. These functions are only diff --git a/generic/tclDecls.h b/generic/tclDecls.h index c5b42d3..8ba9e5c 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1845,6 +1845,8 @@ EXTERN int TclZipfs_Mount(Tcl_Interp *interp, /* 633 */ EXTERN int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname); +/* 634 */ +EXTERN Tcl_Obj * TclZipfs_TclLibrary(void); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2514,6 +2516,7 @@ typedef struct TclStubs { Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, const char *service, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */ int (*tclZipfs_Mount) (Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd); /* 632 */ int (*tclZipfs_Unmount) (Tcl_Interp *interp, const char *zipname); /* 633 */ + Tcl_Obj * (*tclZipfs_TclLibrary) (void); /* 634 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -3812,6 +3815,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tclZipfs_Mount) /* 632 */ #define TclZipfs_Unmount \ (tclStubsPtr->tclZipfs_Unmount) /* 633 */ +#define TclZipfs_TclLibrary \ + (tclStubsPtr->tclZipfs_TclLibrary) /* 634 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclInterp.c b/generic/tclInterp.c index d9dfd37..b58aee0 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -402,6 +402,7 @@ Tcl_Init( " set scripts {{set tcl_library}}\n" " } else {\n" " set scripts {}\n" +" lappend scripts {zipfs tcl_library}\n" " if {[info exists env(TCL_LIBRARY)] && ($env(TCL_LIBRARY) ne {})} {\n" " lappend scripts {set env(TCL_LIBRARY)}\n" " lappend scripts {\n" diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index ffa42bf..abd030a 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -1547,6 +1547,7 @@ const TclStubs tclStubs = { Tcl_OpenTcpServerEx, /* 631 */ TclZipfs_Mount, /* 632 */ TclZipfs_Unmount, /* 633 */ + TclZipfs_TclLibrary, /* 634 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index e6acc8d..2e24afe 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -300,6 +300,8 @@ static const unsigned long crc32tab[256] = { static Tcl_Obj *zipfs_literal_fstype=NULL; static Tcl_Obj *zipfs_literal_fsroot=NULL; static Tcl_Obj *zipfs_literal_fsseparator=NULL; +static Tcl_Obj *zipfs_literal_null=NULL; +static Tcl_Obj *zipfs_literal_tcl_library=NULL; /* @@ -2424,6 +2426,40 @@ ZipFSListObjCmd(ClientData clientData, Tcl_Interp *interp, Unlock(); return TCL_OK; } + +/* + *------------------------------------------------------------------------- + * + * ZipFSTclLibraryObjCmd -- + * + * This procedure is invoked to process the "zipfs::root" command. It + * returns the root that all zipfs file systems are mounted under. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSTclLibraryObjCmd(ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *const objv[]) +{ + Tcl_Obj *pResult; + pResult=TclZipfs_TclLibrary(); + if(!pResult) { + if(!zipfs_literal_null) { + zipfs_literal_null=Tcl_NewObj(); + Tcl_IncrRefCount(zipfs_literal_null); + } + pResult=zipfs_literal_null; + Tcl_IncrRefCount(zipfs_literal_null); + } + Tcl_SetObjResult(interp,pResult); + return TCL_OK; +} /* *------------------------------------------------------------------------- @@ -3853,6 +3889,7 @@ TclZipfs_Init(Tcl_Interp *interp) {"list", ZipFSListObjCmd, NULL, NULL, NULL, 1}, {"canonical", ZipFSCanonicalObjCmd, NULL, NULL, NULL, 1}, {"root", ZipFSRootObjCmd, NULL, NULL, NULL, 1}, + {"tcl_library", ZipFSTclLibraryObjCmd, NULL, NULL, NULL, 0}, {NULL, NULL, NULL, NULL, NULL, 0} }; @@ -3920,14 +3957,19 @@ static int TclZipfs_AppHook_FindTclInit(const char *archive){ vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/init.tcl",-1); Tcl_IncrRefCount(vfsinitscript); found=Tcl_FSAccess(vfsinitscript,F_OK); + Tcl_DecrRefCount(vfsinitscript); if(found==0) { + zipfs_literal_tcl_library=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT,-1); + Tcl_IncrRefCount(zipfs_literal_tcl_library); return TCL_OK; } - Tcl_DecrRefCount(vfsinitscript); vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/tcl_library/init.tcl",-1); Tcl_IncrRefCount(vfsinitscript); found=Tcl_FSAccess(vfsinitscript,F_OK); + Tcl_DecrRefCount(vfsinitscript); if(found==0) { + zipfs_literal_tcl_library=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/tcl_library",-1); + Tcl_IncrRefCount(zipfs_literal_tcl_library); return TCL_OK; } return TCL_ERROR; @@ -3943,14 +3985,8 @@ int TclZipfs_AppHook(int *argc, char ***argv) * Tclkit_MainHook -- * Performs the argument munging for the shell */ - char *archive; -#if defined(_WIN32) || defined(_WIN64) - HMODULE hModule = TclWinGetTclInstance(); - WCHAR wName[MAX_PATH + LIBRARY_SIZE]; - char dllname[(MAX_PATH + LIBRARY_SIZE) * TCL_UTF_MAX]; -#endif - + Tcl_FindExecutable(*argv[0]); archive=Tcl_GetNameOfExecutable(); TclZipfs_Init(NULL); @@ -4001,41 +4037,34 @@ int TclZipfs_AppHook(int *argc, char ***argv) Tcl_DecrRefCount(vfsinitscript); } /* Set Tcl Encodings */ - vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library/init.tcl",-1); - Tcl_IncrRefCount(vfsinitscript); - found=Tcl_FSAccess(vfsinitscript,F_OK); - Tcl_DecrRefCount(vfsinitscript); - if(found==TCL_OK) { - return TCL_OK; + if(!zipfs_literal_tcl_library) { + vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library/init.tcl",-1); + Tcl_IncrRefCount(vfsinitscript); + found=Tcl_FSAccess(vfsinitscript,F_OK); + Tcl_DecrRefCount(vfsinitscript); + if(found==TCL_OK) { + zipfs_literal_tcl_library=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library",-1); + Tcl_IncrRefCount(zipfs_literal_tcl_library); + return TCL_OK; + } } } else if (*argc>1) { - Tcl_DString ds; #if defined(_WIN32) || defined(_WIN64) + Tcl_DString ds; strcpy(archive, Tcl_WinTCharToUtf((*argv)[1], -1, &ds)); Tcl_DStringFree(&ds); #else archive=(*argv)[1]; #endif - printf(" arg1 %s\n",archive); fflush(stdout); if(strcmp(archive,"install")==0) { /* If the first argument is mkzip, run the mkzip program */ Tcl_Obj *vfsinitscript; vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/tcl_library/install.tcl",-1); Tcl_IncrRefCount(vfsinitscript); - printf(" startup script %s\n",Tcl_GetString(vfsinitscript)); fflush(stdout); -#if defined(_WIN32) || defined(_WIN64) - if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) { - GetModuleFileNameA(hModule, dllname, MAX_PATH); - } else { - ToUtf(wName, dllname); - } - /* Mount zip file and dll before releasing to search */ - if(TclZipfs_AppHook_FindTclInit(dllname)==TCL_OK) { - Tcl_SetStartupScript(vfsinitscript,NULL); - return TCL_OK; - } -#endif + /* Run this now to ensure the file is present by the time Tcl_Main wants it */ + TclZipfs_TclLibrary(); + return TCL_OK; } else { if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { int found; @@ -4054,31 +4083,50 @@ int TclZipfs_AppHook(int *argc, char ***argv) found=Tcl_FSAccess(vfsinitscript,F_OK); Tcl_DecrRefCount(vfsinitscript); if(found==TCL_OK) { + zipfs_literal_tcl_library=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library",-1); + Tcl_IncrRefCount(zipfs_literal_tcl_library); + zipfs_literal_tcl_library=vfsinitscript; return TCL_OK; } } } } -#if defined(_WIN32) || defined(_WIN64) - if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) { - GetModuleFileNameA(hModule, dllname, MAX_PATH); + return TCL_OK; +} + +Tcl_Obj *TclZipfs_TclLibrary(void) { + if(zipfs_literal_tcl_library) { + Tcl_IncrRefCount(zipfs_literal_tcl_library); + return zipfs_literal_tcl_library; } else { - ToUtf(wName, dllname); - } - /* Mount zip file and dll before releasing to search */ - if(TclZipfs_AppHook_FindTclInit(dllname)==TCL_OK) { - return TCL_OK; - } +#if defined(_WIN32) || defined(_WIN64) + HMODULE hModule = TclWinGetTclInstance(); + WCHAR wName[MAX_PATH + LIBRARY_SIZE]; + char dllname[(MAX_PATH + LIBRARY_SIZE) * TCL_UTF_MAX]; + + if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) { + GetModuleFileNameA(hModule, dllname, MAX_PATH); + } else { + ToUtf(wName, dllname); + } + /* Mount zip file and dll before releasing to search */ + if(TclZipfs_AppHook_FindTclInit(dllname)==TCL_OK) { + Tcl_IncrRefCount(zipfs_literal_tcl_library); + return zipfs_literal_tcl_library; + } #else - /* Mount zip file and dll before releasing to search */ - if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_DLLFILE)==TCL_OK) { - return TCL_OK; - } + /* Mount zip file and dll before releasing to search */ + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_DLLFILE)==TCL_OK) { + Tcl_IncrRefCount(zipfs_literal_tcl_library); + return zipfs_literal_tcl_library; + } #endif + } if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { - return TCL_OK; + Tcl_IncrRefCount(zipfs_literal_tcl_library); + return zipfs_literal_tcl_library; } - return TCL_OK; + return NULL; } -- cgit v0.12 From 9ef614086a2b3267669f4fb644ad1a92debb5fb0 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 21 Nov 2017 00:41:04 +0000 Subject: Typo fixes for minizip --- win/configure | 4 ++-- win/tcl.m4 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/win/configure b/win/configure index f4d0448..f0159d1 100755 --- a/win/configure +++ b/win/configure @@ -5011,8 +5011,8 @@ $as_echo "Found INFO Zip in environment" >&6; } # It is not an error if an installed version of Zip can't be located. # We can use the locally distributed minizip instead ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" - ZIP_PROG_OPTIONS="\"-o\"" - ZIP_PROG_VFSSEARCH="\"`find . -type f`\"" + ZIP_PROG_OPTIONS="-o" + ZIP_PROG_VFSSEARCH="\"\`find . -type f\`\"" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH building minizip" >&5 $as_echo "No zip found on PATH building minizip" >&6; } diff --git a/win/tcl.m4 b/win/tcl.m4 index ecfcd52..c56cd09 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -1424,8 +1424,8 @@ AC_DEFUN([SC_ZIPFS_SUPPORT], [ # It is not an error if an installed version of Zip can't be located. # We can use the locally distributed minizip instead ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" - ZIP_PROG_OPTIONS="\"-o\"" - ZIP_PROG_VFSSEARCH="\"`find . -type f`\"" + ZIP_PROG_OPTIONS="-o" + ZIP_PROG_VFSSEARCH="\"\`find . -type f\`\"" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" AC_MSG_RESULT([No zip found on PATH building minizip]) fi -- cgit v0.12 From d7b40297d2ec40549321631ce061f496a14b4f46 Mon Sep 17 00:00:00 2001 From: tne Date: Tue, 21 Nov 2017 01:14:05 +0000 Subject: Final tweaks to make "./tclsh install" work properly on Windows NOTE: We still seem to be screwing up minizip on MinGW. the `find . -type f` substitution is not working --- generic/tclZipfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 2e24afe..a954dd6 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -4059,11 +4059,13 @@ int TclZipfs_AppHook(int *argc, char ***argv) if(strcmp(archive,"install")==0) { /* If the first argument is mkzip, run the mkzip program */ Tcl_Obj *vfsinitscript; - - vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/tcl_library/install.tcl",-1); - Tcl_IncrRefCount(vfsinitscript); /* Run this now to ensure the file is present by the time Tcl_Main wants it */ TclZipfs_TclLibrary(); + vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/tcl_library/install.tcl",-1); + Tcl_IncrRefCount(vfsinitscript); + if(Tcl_FSAccess(vfsinitscript,F_OK)==0) { + Tcl_SetStartupScript(vfsinitscript,NULL); + } return TCL_OK; } else { if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { -- cgit v0.12 From d8a921174ea67582c89d57f5e1b8d072acfd462c Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 21 Nov 2017 04:07:45 +0000 Subject: Added an implementation of tinydir.h, and spliced it into minizip to allow minizip to recurse directory structures (and get us out of having to feed `find` via autoconf) --- compat/zlib/contrib/minizip/minizip.c | 264 ++++++----- compat/zlib/contrib/minizip/tinydir.h | 816 ++++++++++++++++++++++++++++++++++ unix/configure | 4 +- unix/tcl.m4 | 4 +- win/configure | 4 +- win/tcl.m4 | 4 +- 6 files changed, 975 insertions(+), 121 deletions(-) create mode 100755 compat/zlib/contrib/minizip/tinydir.h diff --git a/compat/zlib/contrib/minizip/minizip.c b/compat/zlib/contrib/minizip/minizip.c index 4288962..b5c67cc 100644 --- a/compat/zlib/contrib/minizip/minizip.c +++ b/compat/zlib/contrib/minizip/minizip.c @@ -12,7 +12,6 @@ Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) */ - #if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) #ifndef __USE_FILE_OFFSET64 #define __USE_FILE_OFFSET64 @@ -39,8 +38,7 @@ #define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin) #endif - - +#include "tinydir.h" #include #include #include @@ -172,6 +170,7 @@ void do_banner() void do_help() { printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \ + " -r Scan directories recursively\n" \ " -o Overwrite existing file.zip\n" \ " -a Append to existing file.zip\n" \ " -0 Store only\n" \ @@ -243,12 +242,153 @@ int isLargeFile(const char* filename) return largeFile; } +void addFileToZip(zipFile zf, const char *filenameinzip, const char *password, int opt_exclude_path,int opt_compress_level) { + FILE * fin; + int size_read; + const char *savefilenameinzip; + zip_fileinfo zi; + unsigned long crcFile=0; + int zip64 = 0; + int err=0; + int size_buf=WRITEBUFFERSIZE; + unsigned char buf[WRITEBUFFERSIZE]; + zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour = + zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0; + zi.dosDate = 0; + zi.internal_fa = 0; + zi.external_fa = 0; + filetime(filenameinzip,&zi.tmz_date,&zi.dosDate); + +/* + err = zipOpenNewFileInZip(zf,filenameinzip,&zi, + NULL,0,NULL,0,NULL / * comment * /, + (opt_compress_level != 0) ? Z_DEFLATED : 0, + opt_compress_level); +*/ + if ((password != NULL) && (err==ZIP_OK)) + err = getFileCrc(filenameinzip,buf,size_buf,&crcFile); + + zip64 = isLargeFile(filenameinzip); + + /* The path name saved, should not include a leading slash. */ + /*if it did, windows/xp and dynazip couldn't read the zip file. */ + savefilenameinzip = filenameinzip; + while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' ) + { + savefilenameinzip++; + } + + /*should the zip file contain any path at all?*/ + if( opt_exclude_path ) + { + const char *tmpptr; + const char *lastslash = 0; + for( tmpptr = savefilenameinzip; *tmpptr; tmpptr++) + { + if( *tmpptr == '\\' || *tmpptr == '/') + { + lastslash = tmpptr; + } + } + if( lastslash != NULL ) + { + savefilenameinzip = lastslash+1; // base filename follows last slash. + } + } + + /**/ + err = zipOpenNewFileInZip3_64(zf,savefilenameinzip,&zi, + NULL,0,NULL,0,NULL /* comment*/, + (opt_compress_level != 0) ? Z_DEFLATED : 0, + opt_compress_level,0, + /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */ + -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, + password,crcFile, zip64); + + if (err != ZIP_OK) + printf("error in opening %s in zipfile\n",filenameinzip); + else + { + fin = FOPEN_FUNC(filenameinzip,"rb"); + if (fin==NULL) + { + err=ZIP_ERRNO; + printf("error in opening %s for reading\n",filenameinzip); + } + } + + if (err == ZIP_OK) + do + { + err = ZIP_OK; + size_read = (int)fread(buf,1,size_buf,fin); + if (size_read < size_buf) + if (feof(fin)==0) + { + printf("error in reading %s\n",filenameinzip); + err = ZIP_ERRNO; + } + + if (size_read>0) + { + err = zipWriteInFileInZip (zf,buf,size_read); + if (err<0) + { + printf("error in writing %s in the zipfile\n", + filenameinzip); + } + + } + } while ((err == ZIP_OK) && (size_read>0)); + + if (fin) + fclose(fin); + + if (err<0) + err=ZIP_ERRNO; + else + { + err = zipCloseFileInZip(zf); + if (err!=ZIP_OK) + printf("error in closing %s in the zipfile\n", + filenameinzip); + } +} + + +void addPathToZip(zipFile zf, const char *filenameinzip, const char *password, int opt_exclude_path,int opt_compress_level) { + tinydir_dir dir; + int i; + char *newname[512]; + + tinydir_open_sorted(&dir, filenameinzip); + + for (i = 0; i < dir.n_files; i++) + { + tinydir_file file; + tinydir_readfile_n(&dir, &file, i); + if(strcmp(file.name,".")==0) continue; + if(strcmp(file.name,"..")==0) continue; + sprintf(newname,"%s/%s",dir.path,file.name); + if (file.is_dir) + { + addPathToZip(zf,newname,password,opt_exclude_path,opt_compress_level); + } else { + addFileToZip(zf,newname,password,opt_exclude_path,opt_compress_level); + } + } + + tinydir_close(&dir); +} + + int main(argc,argv) int argc; char *argv[]; { int i; - int opt_overwrite=0; + int opt_recursive=0; + int opt_overwrite=1; int opt_compress_level=Z_DEFAULT_COMPRESSION; int opt_exclude_path=0; int zipfilenamearg = 0; @@ -285,7 +425,8 @@ int main(argc,argv) opt_compress_level = c-'0'; if ((c=='j') || (c=='J')) opt_exclude_path = 1; - + if ((c=='r') || (c=='R')) + opt_recursive = 1; if (((c=='p') || (c=='P')) && (i+1='0') || (argv[i][1]<='9'))) && (strlen(argv[i]) == 2))) { - FILE * fin; - int size_read; - const char* filenameinzip = argv[i]; - const char *savefilenameinzip; - zip_fileinfo zi; - unsigned long crcFile=0; - int zip64 = 0; - - zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour = - zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0; - zi.dosDate = 0; - zi.internal_fa = 0; - zi.external_fa = 0; - filetime(filenameinzip,&zi.tmz_date,&zi.dosDate); - -/* - err = zipOpenNewFileInZip(zf,filenameinzip,&zi, - NULL,0,NULL,0,NULL / * comment * /, - (opt_compress_level != 0) ? Z_DEFLATED : 0, - opt_compress_level); -*/ - if ((password != NULL) && (err==ZIP_OK)) - err = getFileCrc(filenameinzip,buf,size_buf,&crcFile); - - zip64 = isLargeFile(filenameinzip); - - /* The path name saved, should not include a leading slash. */ - /*if it did, windows/xp and dynazip couldn't read the zip file. */ - savefilenameinzip = filenameinzip; - while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' ) - { - savefilenameinzip++; - } - - /*should the zip file contain any path at all?*/ - if( opt_exclude_path ) - { - const char *tmpptr; - const char *lastslash = 0; - for( tmpptr = savefilenameinzip; *tmpptr; tmpptr++) - { - if( *tmpptr == '\\' || *tmpptr == '/') - { - lastslash = tmpptr; - } - } - if( lastslash != NULL ) - { - savefilenameinzip = lastslash+1; // base filename follows last slash. - } - } - - /**/ - err = zipOpenNewFileInZip3_64(zf,savefilenameinzip,&zi, - NULL,0,NULL,0,NULL /* comment*/, - (opt_compress_level != 0) ? Z_DEFLATED : 0, - opt_compress_level,0, - /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */ - -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, - password,crcFile, zip64); - - if (err != ZIP_OK) - printf("error in opening %s in zipfile\n",filenameinzip); - else - { - fin = FOPEN_FUNC(filenameinzip,"rb"); - if (fin==NULL) - { - err=ZIP_ERRNO; - printf("error in opening %s for reading\n",filenameinzip); - } - } - - if (err == ZIP_OK) - do - { - err = ZIP_OK; - size_read = (int)fread(buf,1,size_buf,fin); - if (size_read < size_buf) - if (feof(fin)==0) - { - printf("error in reading %s\n",filenameinzip); - err = ZIP_ERRNO; - } - - if (size_read>0) - { - err = zipWriteInFileInZip (zf,buf,size_read); - if (err<0) - { - printf("error in writing %s in the zipfile\n", - filenameinzip); - } - - } - } while ((err == ZIP_OK) && (size_read>0)); - - if (fin) - fclose(fin); - - if (err<0) - err=ZIP_ERRNO; - else - { - err = zipCloseFileInZip(zf); - if (err!=ZIP_OK) - printf("error in closing %s in the zipfile\n", - filenameinzip); + if(opt_recursive) { + addPathToZip(zf,argv[i],password,opt_exclude_path,opt_compress_level); + } else { + addFileToZip(zf,argv[i],password,opt_exclude_path,opt_compress_level); } } } diff --git a/compat/zlib/contrib/minizip/tinydir.h b/compat/zlib/contrib/minizip/tinydir.h new file mode 100755 index 0000000..eb34399 --- /dev/null +++ b/compat/zlib/contrib/minizip/tinydir.h @@ -0,0 +1,816 @@ +/* +Copyright (c) 2013-2017, tinydir authors: +- Cong Xu +- Lautis Sun +- Baudouin Feildel +- Andargor +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +#ifndef TINYDIR_H +#define TINYDIR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if ((defined _UNICODE) && !(defined UNICODE)) +#define UNICODE +#endif + +#if ((defined UNICODE) && !(defined _UNICODE)) +#define _UNICODE +#endif + +#include +#include +#include +#ifdef _MSC_VER +# define WIN32_LEAN_AND_MEAN +# include +# include +# pragma warning(push) +# pragma warning (disable : 4996) +#else +# include +# include +# include +# include +#endif +#ifdef __MINGW32__ +# include +#endif + + +/* types */ + +/* Windows UNICODE wide character support */ +#if defined _MSC_VER || defined __MINGW32__ +# define _tinydir_char_t TCHAR +# define TINYDIR_STRING(s) _TEXT(s) +# define _tinydir_strlen _tcslen +# define _tinydir_strcpy _tcscpy +# define _tinydir_strcat _tcscat +# define _tinydir_strcmp _tcscmp +# define _tinydir_strrchr _tcsrchr +# define _tinydir_strncmp _tcsncmp +#else +# define _tinydir_char_t char +# define TINYDIR_STRING(s) s +# define _tinydir_strlen strlen +# define _tinydir_strcpy strcpy +# define _tinydir_strcat strcat +# define _tinydir_strcmp strcmp +# define _tinydir_strrchr strrchr +# define _tinydir_strncmp strncmp +#endif + +#if (defined _MSC_VER || defined __MINGW32__) +# include +# define _TINYDIR_PATH_MAX MAX_PATH +#elif defined __linux__ +# include +# define _TINYDIR_PATH_MAX PATH_MAX +#elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) +# include +# if defined(BSD) +# include +# define _TINYDIR_PATH_MAX PATH_MAX +# endif +#endif + +#ifndef _TINYDIR_PATH_MAX +#define _TINYDIR_PATH_MAX 4096 +#endif + +#ifdef _MSC_VER +/* extra chars for the "\\*" mask */ +# define _TINYDIR_PATH_EXTRA 2 +#else +# define _TINYDIR_PATH_EXTRA 0 +#endif + +#define _TINYDIR_FILENAME_MAX 256 + +#if (defined _MSC_VER || defined __MINGW32__) +#define _TINYDIR_DRIVE_MAX 3 +#endif + +#ifdef _MSC_VER +# define _TINYDIR_FUNC static __inline +#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# define _TINYDIR_FUNC static __inline__ +#else +# define _TINYDIR_FUNC static inline +#endif + +/* readdir_r usage; define TINYDIR_USE_READDIR_R to use it (if supported) */ +#ifdef TINYDIR_USE_READDIR_R + +/* readdir_r is a POSIX-only function, and may not be available under various + * environments/settings, e.g. MinGW. Use readdir fallback */ +#if _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE ||\ + _POSIX_SOURCE +# define _TINYDIR_HAS_READDIR_R +#endif +#if _POSIX_C_SOURCE >= 200112L +# define _TINYDIR_HAS_FPATHCONF +# include +#endif +#if _BSD_SOURCE || _SVID_SOURCE || \ + (_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700) +# define _TINYDIR_HAS_DIRFD +# include +#endif +#if defined _TINYDIR_HAS_FPATHCONF && defined _TINYDIR_HAS_DIRFD &&\ + defined _PC_NAME_MAX +# define _TINYDIR_USE_FPATHCONF +#endif +#if defined __MINGW32__ || !defined _TINYDIR_HAS_READDIR_R ||\ + !(defined _TINYDIR_USE_FPATHCONF || defined NAME_MAX) +# define _TINYDIR_USE_READDIR +#endif + +/* Use readdir by default */ +#else +# define _TINYDIR_USE_READDIR +#endif + +/* MINGW32 has two versions of dirent, ASCII and UNICODE*/ +#ifndef _MSC_VER +#if (defined __MINGW32__) && (defined _UNICODE) +#define _TINYDIR_DIR _WDIR +#define _tinydir_dirent _wdirent +#define _tinydir_opendir _wopendir +#define _tinydir_readdir _wreaddir +#define _tinydir_closedir _wclosedir +#else +#define _TINYDIR_DIR DIR +#define _tinydir_dirent dirent +#define _tinydir_opendir opendir +#define _tinydir_readdir readdir +#define _tinydir_closedir closedir +#endif +#endif + +/* Allow user to use a custom allocator by defining _TINYDIR_MALLOC and _TINYDIR_FREE. */ +#if defined(_TINYDIR_MALLOC) && defined(_TINYDIR_FREE) +#elif !defined(_TINYDIR_MALLOC) && !defined(_TINYDIR_FREE) +#else +#error "Either define both alloc and free or none of them!" +#endif + +#if !defined(_TINYDIR_MALLOC) + #define _TINYDIR_MALLOC(_size) malloc(_size) + #define _TINYDIR_FREE(_ptr) free(_ptr) +#endif /* !defined(_TINYDIR_MALLOC) */ + +typedef struct tinydir_file +{ + _tinydir_char_t path[_TINYDIR_PATH_MAX]; + _tinydir_char_t name[_TINYDIR_FILENAME_MAX]; + _tinydir_char_t *extension; + int is_dir; + int is_reg; + +#ifndef _MSC_VER +#ifdef __MINGW32__ + struct _stat _s; +#else + struct stat _s; +#endif +#endif +} tinydir_file; + +typedef struct tinydir_dir +{ + _tinydir_char_t path[_TINYDIR_PATH_MAX]; + int has_next; + size_t n_files; + + tinydir_file *_files; +#ifdef _MSC_VER + HANDLE _h; + WIN32_FIND_DATA _f; +#else + _TINYDIR_DIR *_d; + struct _tinydir_dirent *_e; +#ifndef _TINYDIR_USE_READDIR + struct _tinydir_dirent *_ep; +#endif +#endif +} tinydir_dir; + + +/* declarations */ + +_TINYDIR_FUNC +int tinydir_open(tinydir_dir *dir, const _tinydir_char_t *path); +_TINYDIR_FUNC +int tinydir_open_sorted(tinydir_dir *dir, const _tinydir_char_t *path); +_TINYDIR_FUNC +void tinydir_close(tinydir_dir *dir); + +_TINYDIR_FUNC +int tinydir_next(tinydir_dir *dir); +_TINYDIR_FUNC +int tinydir_readfile(const tinydir_dir *dir, tinydir_file *file); +_TINYDIR_FUNC +int tinydir_readfile_n(const tinydir_dir *dir, tinydir_file *file, size_t i); +_TINYDIR_FUNC +int tinydir_open_subdir_n(tinydir_dir *dir, size_t i); + +_TINYDIR_FUNC +int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path); +_TINYDIR_FUNC +void _tinydir_get_ext(tinydir_file *file); +_TINYDIR_FUNC +int _tinydir_file_cmp(const void *a, const void *b); +#ifndef _MSC_VER +#ifndef _TINYDIR_USE_READDIR +_TINYDIR_FUNC +size_t _tinydir_dirent_buf_size(_TINYDIR_DIR *dirp); +#endif +#endif + + +/* definitions*/ + +_TINYDIR_FUNC +int tinydir_open(tinydir_dir *dir, const _tinydir_char_t *path) +{ +#ifndef _MSC_VER +#ifndef _TINYDIR_USE_READDIR + int error; + int size; /* using int size */ +#endif +#else + _tinydir_char_t path_buf[_TINYDIR_PATH_MAX]; +#endif + _tinydir_char_t *pathp; + + if (dir == NULL || path == NULL || _tinydir_strlen(path) == 0) + { + errno = EINVAL; + return -1; + } + if (_tinydir_strlen(path) + _TINYDIR_PATH_EXTRA >= _TINYDIR_PATH_MAX) + { + errno = ENAMETOOLONG; + return -1; + } + + /* initialise dir */ + dir->_files = NULL; +#ifdef _MSC_VER + dir->_h = INVALID_HANDLE_VALUE; +#else + dir->_d = NULL; +#ifndef _TINYDIR_USE_READDIR + dir->_ep = NULL; +#endif +#endif + tinydir_close(dir); + + _tinydir_strcpy(dir->path, path); + /* Remove trailing slashes */ + pathp = &dir->path[_tinydir_strlen(dir->path) - 1]; + while (pathp != dir->path && (*pathp == TINYDIR_STRING('\\') || *pathp == TINYDIR_STRING('/'))) + { + *pathp = TINYDIR_STRING('\0'); + pathp++; + } +#ifdef _MSC_VER + _tinydir_strcpy(path_buf, dir->path); + _tinydir_strcat(path_buf, TINYDIR_STRING("\\*")); +#if (defined WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) + dir->_h = FindFirstFileEx(path_buf, FindExInfoStandard, &dir->_f, FindExSearchNameMatch, NULL, 0); +#else + dir->_h = FindFirstFile(path_buf, &dir->_f); +#endif + if (dir->_h == INVALID_HANDLE_VALUE) + { + errno = ENOENT; +#else + dir->_d = _tinydir_opendir(path); + if (dir->_d == NULL) + { +#endif + goto bail; + } + + /* read first file */ + dir->has_next = 1; +#ifndef _MSC_VER +#ifdef _TINYDIR_USE_READDIR + dir->_e = _tinydir_readdir(dir->_d); +#else + /* allocate dirent buffer for readdir_r */ + size = _tinydir_dirent_buf_size(dir->_d); /* conversion to int */ + if (size == -1) return -1; + dir->_ep = (struct _tinydir_dirent*)_TINYDIR_MALLOC(size); + if (dir->_ep == NULL) return -1; + + error = readdir_r(dir->_d, dir->_ep, &dir->_e); + if (error != 0) return -1; +#endif + if (dir->_e == NULL) + { + dir->has_next = 0; + } +#endif + + return 0; + +bail: + tinydir_close(dir); + return -1; +} + +_TINYDIR_FUNC +int tinydir_open_sorted(tinydir_dir *dir, const _tinydir_char_t *path) +{ + /* Count the number of files first, to pre-allocate the files array */ + size_t n_files = 0; + if (tinydir_open(dir, path) == -1) + { + return -1; + } + while (dir->has_next) + { + n_files++; + if (tinydir_next(dir) == -1) + { + goto bail; + } + } + tinydir_close(dir); + + if (tinydir_open(dir, path) == -1) + { + return -1; + } + + dir->n_files = 0; + dir->_files = (tinydir_file *)_TINYDIR_MALLOC(sizeof *dir->_files * n_files); + if (dir->_files == NULL) + { + goto bail; + } + while (dir->has_next) + { + tinydir_file *p_file; + dir->n_files++; + + p_file = &dir->_files[dir->n_files - 1]; + if (tinydir_readfile(dir, p_file) == -1) + { + goto bail; + } + + if (tinydir_next(dir) == -1) + { + goto bail; + } + + /* Just in case the number of files has changed between the first and + second reads, terminate without writing into unallocated memory */ + if (dir->n_files == n_files) + { + break; + } + } + + qsort(dir->_files, dir->n_files, sizeof(tinydir_file), _tinydir_file_cmp); + + return 0; + +bail: + tinydir_close(dir); + return -1; +} + +_TINYDIR_FUNC +void tinydir_close(tinydir_dir *dir) +{ + if (dir == NULL) + { + return; + } + + memset(dir->path, 0, sizeof(dir->path)); + dir->has_next = 0; + dir->n_files = 0; + _TINYDIR_FREE(dir->_files); + dir->_files = NULL; +#ifdef _MSC_VER + if (dir->_h != INVALID_HANDLE_VALUE) + { + FindClose(dir->_h); + } + dir->_h = INVALID_HANDLE_VALUE; +#else + if (dir->_d) + { + _tinydir_closedir(dir->_d); + } + dir->_d = NULL; + dir->_e = NULL; +#ifndef _TINYDIR_USE_READDIR + _TINYDIR_FREE(dir->_ep); + dir->_ep = NULL; +#endif +#endif +} + +_TINYDIR_FUNC +int tinydir_next(tinydir_dir *dir) +{ + if (dir == NULL) + { + errno = EINVAL; + return -1; + } + if (!dir->has_next) + { + errno = ENOENT; + return -1; + } + +#ifdef _MSC_VER + if (FindNextFile(dir->_h, &dir->_f) == 0) +#else +#ifdef _TINYDIR_USE_READDIR + dir->_e = _tinydir_readdir(dir->_d); +#else + if (dir->_ep == NULL) + { + return -1; + } + if (readdir_r(dir->_d, dir->_ep, &dir->_e) != 0) + { + return -1; + } +#endif + if (dir->_e == NULL) +#endif + { + dir->has_next = 0; +#ifdef _MSC_VER + if (GetLastError() != ERROR_SUCCESS && + GetLastError() != ERROR_NO_MORE_FILES) + { + tinydir_close(dir); + errno = EIO; + return -1; + } +#endif + } + + return 0; +} + +_TINYDIR_FUNC +int tinydir_readfile(const tinydir_dir *dir, tinydir_file *file) +{ + if (dir == NULL || file == NULL) + { + errno = EINVAL; + return -1; + } +#ifdef _MSC_VER + if (dir->_h == INVALID_HANDLE_VALUE) +#else + if (dir->_e == NULL) +#endif + { + errno = ENOENT; + return -1; + } + if (_tinydir_strlen(dir->path) + + _tinydir_strlen( +#ifdef _MSC_VER + dir->_f.cFileName +#else + dir->_e->d_name +#endif + ) + 1 + _TINYDIR_PATH_EXTRA >= + _TINYDIR_PATH_MAX) + { + /* the path for the file will be too long */ + errno = ENAMETOOLONG; + return -1; + } + if (_tinydir_strlen( +#ifdef _MSC_VER + dir->_f.cFileName +#else + dir->_e->d_name +#endif + ) >= _TINYDIR_FILENAME_MAX) + { + errno = ENAMETOOLONG; + return -1; + } + + _tinydir_strcpy(file->path, dir->path); + _tinydir_strcat(file->path, TINYDIR_STRING("/")); + _tinydir_strcpy(file->name, +#ifdef _MSC_VER + dir->_f.cFileName +#else + dir->_e->d_name +#endif + ); + _tinydir_strcat(file->path, file->name); +#ifndef _MSC_VER +#ifdef __MINGW32__ + if (_tstat( +#else + if (stat( +#endif + file->path, &file->_s) == -1) + { + return -1; + } +#endif + _tinydir_get_ext(file); + + file->is_dir = +#ifdef _MSC_VER + !!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); +#else + S_ISDIR(file->_s.st_mode); +#endif + file->is_reg = +#ifdef _MSC_VER + !!(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_NORMAL) || + ( + !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DEVICE) && + !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && + !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_ENCRYPTED) && +#ifdef FILE_ATTRIBUTE_INTEGRITY_STREAM + !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_INTEGRITY_STREAM) && +#endif +#ifdef FILE_ATTRIBUTE_NO_SCRUB_DATA + !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_NO_SCRUB_DATA) && +#endif + !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) && + !(dir->_f.dwFileAttributes & FILE_ATTRIBUTE_TEMPORARY)); +#else + S_ISREG(file->_s.st_mode); +#endif + + return 0; +} + +_TINYDIR_FUNC +int tinydir_readfile_n(const tinydir_dir *dir, tinydir_file *file, size_t i) +{ + if (dir == NULL || file == NULL) + { + errno = EINVAL; + return -1; + } + if (i >= dir->n_files) + { + errno = ENOENT; + return -1; + } + + memcpy(file, &dir->_files[i], sizeof(tinydir_file)); + _tinydir_get_ext(file); + + return 0; +} + +_TINYDIR_FUNC +int tinydir_open_subdir_n(tinydir_dir *dir, size_t i) +{ + _tinydir_char_t path[_TINYDIR_PATH_MAX]; + if (dir == NULL) + { + errno = EINVAL; + return -1; + } + if (i >= dir->n_files || !dir->_files[i].is_dir) + { + errno = ENOENT; + return -1; + } + + _tinydir_strcpy(path, dir->_files[i].path); + tinydir_close(dir); + if (tinydir_open_sorted(dir, path) == -1) + { + return -1; + } + + return 0; +} + +/* Open a single file given its path */ +_TINYDIR_FUNC +int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path) +{ + tinydir_dir dir; + int result = 0; + int found = 0; + _tinydir_char_t dir_name_buf[_TINYDIR_PATH_MAX]; + _tinydir_char_t file_name_buf[_TINYDIR_FILENAME_MAX]; + _tinydir_char_t *dir_name; + _tinydir_char_t *base_name; +#if (defined _MSC_VER || defined __MINGW32__) + _tinydir_char_t drive_buf[_TINYDIR_PATH_MAX]; + _tinydir_char_t ext_buf[_TINYDIR_FILENAME_MAX]; +#endif + + if (file == NULL || path == NULL || _tinydir_strlen(path) == 0) + { + errno = EINVAL; + return -1; + } + if (_tinydir_strlen(path) + _TINYDIR_PATH_EXTRA >= _TINYDIR_PATH_MAX) + { + errno = ENAMETOOLONG; + return -1; + } + + /* Get the parent path */ +#if (defined _MSC_VER || defined __MINGW32__) +#if ((defined _MSC_VER) && (_MSC_VER >= 1400)) + _tsplitpath_s( + path, + drive_buf, _TINYDIR_DRIVE_MAX, + dir_name_buf, _TINYDIR_FILENAME_MAX, + file_name_buf, _TINYDIR_FILENAME_MAX, + ext_buf, _TINYDIR_FILENAME_MAX); +#else + _tsplitpath( + path, + drive_buf, + dir_name_buf, + file_name_buf, + ext_buf); +#endif + +/* _splitpath_s not work fine with only filename and widechar support */ +#ifdef _UNICODE + if (drive_buf[0] == L'\xFEFE') + drive_buf[0] = '\0'; + if (dir_name_buf[0] == L'\xFEFE') + dir_name_buf[0] = '\0'; +#endif + + if (errno) + { + errno = EINVAL; + return -1; + } + /* Emulate the behavior of dirname by returning "." for dir name if it's + empty */ + if (drive_buf[0] == '\0' && dir_name_buf[0] == '\0') + { + _tinydir_strcpy(dir_name_buf, TINYDIR_STRING(".")); + } + /* Concatenate the drive letter and dir name to form full dir name */ + _tinydir_strcat(drive_buf, dir_name_buf); + dir_name = drive_buf; + /* Concatenate the file name and extension to form base name */ + _tinydir_strcat(file_name_buf, ext_buf); + base_name = file_name_buf; +#else + _tinydir_strcpy(dir_name_buf, path); + dir_name = dirname(dir_name_buf); + _tinydir_strcpy(file_name_buf, path); + base_name =basename(file_name_buf); +#endif + + /* Open the parent directory */ + if (tinydir_open(&dir, dir_name) == -1) + { + return -1; + } + + /* Read through the parent directory and look for the file */ + while (dir.has_next) + { + if (tinydir_readfile(&dir, file) == -1) + { + result = -1; + goto bail; + } + if (_tinydir_strcmp(file->name, base_name) == 0) + { + /* File found */ + found = 1; + break; + } + tinydir_next(&dir); + } + if (!found) + { + result = -1; + errno = ENOENT; + } + +bail: + tinydir_close(&dir); + return result; +} + +_TINYDIR_FUNC +void _tinydir_get_ext(tinydir_file *file) +{ + _tinydir_char_t *period = _tinydir_strrchr(file->name, TINYDIR_STRING('.')); + if (period == NULL) + { + file->extension = &(file->name[_tinydir_strlen(file->name)]); + } + else + { + file->extension = period + 1; + } +} + +_TINYDIR_FUNC +int _tinydir_file_cmp(const void *a, const void *b) +{ + const tinydir_file *fa = (const tinydir_file *)a; + const tinydir_file *fb = (const tinydir_file *)b; + if (fa->is_dir != fb->is_dir) + { + return -(fa->is_dir - fb->is_dir); + } + return _tinydir_strncmp(fa->name, fb->name, _TINYDIR_FILENAME_MAX); +} + +#ifndef _MSC_VER +#ifndef _TINYDIR_USE_READDIR +/* +The following authored by Ben Hutchings +from https://womble.decadent.org.uk/readdir_r-advisory.html +*/ +/* Calculate the required buffer size (in bytes) for directory * +* entries read from the given directory handle. Return -1 if this * +* this cannot be done. * +* * +* This code does not trust values of NAME_MAX that are less than * +* 255, since some systems (including at least HP-UX) incorrectly * +* define it to be a smaller value. */ +_TINYDIR_FUNC +size_t _tinydir_dirent_buf_size(_TINYDIR_DIR *dirp) +{ + long name_max; + size_t name_end; + /* parameter may be unused */ + (void)dirp; + +#if defined _TINYDIR_USE_FPATHCONF + name_max = fpathconf(dirfd(dirp), _PC_NAME_MAX); + if (name_max == -1) +#if defined(NAME_MAX) + name_max = (NAME_MAX > 255) ? NAME_MAX : 255; +#else + return (size_t)(-1); +#endif +#elif defined(NAME_MAX) + name_max = (NAME_MAX > 255) ? NAME_MAX : 255; +#else +#error "buffer size for readdir_r cannot be determined" +#endif + name_end = (size_t)offsetof(struct _tinydir_dirent, d_name) + name_max + 1; + return (name_end > sizeof(struct _tinydir_dirent) ? + name_end : sizeof(struct _tinydir_dirent)); +} +#endif +#endif + +#ifdef __cplusplus +} +#endif + +# if defined (_MSC_VER) +# pragma warning(pop) +# endif + +#endif diff --git a/unix/configure b/unix/configure index 53e0a07..08c97e9 100755 --- a/unix/configure +++ b/unix/configure @@ -10286,8 +10286,8 @@ $as_echo "Found INFO Zip in environment" >&6; } # It is not an error if an installed version of Zip can't be located. # We can use the locally distributed minizip instead ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" - ZIP_PROG_OPTIONS="-o" - ZIP_PROG_VFSSEARCH="\"`find . -type f`\"" + ZIP_PROG_OPTIONS="-o -r" + ZIP_PROG_VFSSEARCH="." ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH building minizip" >&5 $as_echo "No zip found on PATH building minizip" >&6; } diff --git a/unix/tcl.m4 b/unix/tcl.m4 index dbc92da..81c0601 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -3136,8 +3136,8 @@ AC_DEFUN([SC_ZIPFS_SUPPORT], [ # It is not an error if an installed version of Zip can't be located. # We can use the locally distributed minizip instead ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" - ZIP_PROG_OPTIONS="-o" - ZIP_PROG_VFSSEARCH="\"`find . -type f`\"" + ZIP_PROG_OPTIONS="-o -r" + ZIP_PROG_VFSSEARCH="." ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" AC_MSG_RESULT([No zip found on PATH building minizip]) fi diff --git a/win/configure b/win/configure index f0159d1..bc851bc 100755 --- a/win/configure +++ b/win/configure @@ -5011,8 +5011,8 @@ $as_echo "Found INFO Zip in environment" >&6; } # It is not an error if an installed version of Zip can't be located. # We can use the locally distributed minizip instead ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" - ZIP_PROG_OPTIONS="-o" - ZIP_PROG_VFSSEARCH="\"\`find . -type f\`\"" + ZIP_PROG_OPTIONS="-o -r" + ZIP_PROG_VFSSEARCH="." ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" { $as_echo "$as_me:${as_lineno-$LINENO}: result: No zip found on PATH building minizip" >&5 $as_echo "No zip found on PATH building minizip" >&6; } diff --git a/win/tcl.m4 b/win/tcl.m4 index c56cd09..4f5b562 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -1424,8 +1424,8 @@ AC_DEFUN([SC_ZIPFS_SUPPORT], [ # It is not an error if an installed version of Zip can't be located. # We can use the locally distributed minizip instead ZIP_PROG="../minizip${EXEEXT_FOR_BUILD}" - ZIP_PROG_OPTIONS="-o" - ZIP_PROG_VFSSEARCH="\"\`find . -type f\`\"" + ZIP_PROG_OPTIONS="-o -r" + ZIP_PROG_VFSSEARCH="." ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" AC_MSG_RESULT([No zip found on PATH building minizip]) fi -- cgit v0.12 From 334149646f5c9c764a5fd5c7c0c9eaee1d90c04e Mon Sep 17 00:00:00 2001 From: tne Date: Tue, 21 Nov 2017 04:26:37 +0000 Subject: Fixes to "make clean" to do a better job of cleaning up zip files and vfs directories Fixed a type that was keeping minizip from building --- unix/Makefile.in | 24 ++---------------------- win/Makefile.in | 26 ++++---------------------- 2 files changed, 6 insertions(+), 44 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 98c5865..d6152a6 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -720,7 +720,7 @@ Makefile: $(UNIX_DIR)/Makefile.in $(DLTEST_DIR)/Makefile.in clean: clean-packages rm -rf *.a *.o libtcl* core errs *~ \#* TAGS *.E a.out \ errors ${TCL_EXE} ${TCLTEST_EXE} lib.exp Tcl @DTRACE_HDR@ \ - minizip${EXEEXT_FOR_BUILD} *.${HOST_OBJEXT} + minizip${HOST_EXEEXT} *.${HOST_OBJEXT} *.zip *.vfs cd dltest ; $(MAKE) clean distclean: distclean-packages clean @@ -1864,29 +1864,9 @@ zutil.$(HOST_OBJEXT): minizip.$(HOST_OBJEXT): $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/minizip.c -minizip${EXEEXT_FOR_BUILD}: $(MINIZIP_OBJS) +minizip${HOST_EXEEXT}: $(MINIZIP_OBJS) $(HOST_CC) -o $@ $(MINIZIP_OBJS) -tclvfs.zip: minizip${EXEEXT_FOR_BUILD} - rm -rf $(TCL_VFS_ROOT) - mkdir -p $(TCL_VFS_PATH) - @for i in "$(TCL_VFS_PATH)"; \ - do \ - if [ ! -d "$$i" ] ; then \ - echo "Making directory $$i"; \ - $(INSTALL_DATA_DIR) "$$i"; \ - else true; \ - fi; \ - done; - cp -a ../library/* $(TCL_VFS_PATH) - (cd $TCL_VFS ROOT ; ./minizip${EXEEXT_FOR_BUILD} -o ../tclvfs.zip `find . -type f`) - -zipsetupstub.$(HOST_OBJEXT): $(COMPAT_DIR)/zipsetupstub.c - $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(COMPAT_DIR)/zipsetupstub.c - -zipsetupstub${EXEEXT_FOR_BUILD}: zipsetupstub.$(HOST_OBJEXT) - $(HOST_CC) -o $@ zipsetupstub.$(HOST_OBJEXT) - #-------------------------------------------------------------------------- # Bundled Package targets #-------------------------------------------------------------------------- diff --git a/win/Makefile.in b/win/Makefile.in index 6734985..49f0bfb 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -663,29 +663,9 @@ zutil.$(HOST_OBJEXT): minizip.$(HOST_OBJEXT): $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/minizip.c -minizip${EXEEXT_FOR_BUILD}: $(MINIZIP_OBJS) +minizip${HOST_EXEEXT}: $(MINIZIP_OBJS) $(HOST_CC) -o $@ $(MINIZIP_OBJS) -tclvfs.zip: minizip${EXEEXT_FOR_BUILD} - rm -rf $(TCL_VFS_ROOT) - mkdir -p $(TCL_VFS_PATH) - @for i in "$(TCL_VFS_PATH)"; \ - do \ - if [ ! -d "$$i" ] ; then \ - echo "Making directory $$i"; \ - $(INSTALL_DATA_DIR) "$$i"; \ - else true; \ - fi; \ - done; - cp -a ../library/* $(TCL_VFS_PATH) - (cd $TCL_VFS ROOT ; ./minizip${EXEEXT_FOR_BUILD} -o ../tclvfs.zip `find . -type f`) - -zipsetupstub.$(HOST_OBJEXT): $(COMPAT_DIR)/zipsetupstub.c - $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(COMPAT_DIR)/zipsetupstub.c - -zipsetupstub${EXEEXT_FOR_BUILD}: zipsetupstub.$(HOST_OBJEXT) - $(HOST_CC) -o $@ zipsetupstub.$(HOST_OBJEXT) - # The following target generates the file generic/tclDate.c from the yacc # grammar found in generic/tclGetDate.y. This is only run by hand as yacc is # not available in all environments. The name of the .c file is different than @@ -916,7 +896,9 @@ clean: cleanhelp clean-packages $(RM) *.lib *.a *.exp *.dll *.$(RES) *.${OBJEXT} *~ \#* TAGS a.out $(RM) $(TCLSH) $(CAT32) $(RM) *.pch *.ilk *.pdb - minizip${EXEEXT_FOR_BUILD} *.${HOST_OBJEXT} + $(RM) minizip${HOST_EXEEXT} *.${HOST_OBJEXT} + $(RM) *.zip + $(RMDIR) *.vfs distclean: distclean-packages clean $(RM) Makefile config.status config.cache config.log tclConfig.sh \ -- cgit v0.12 From 011dd7b0f6b3f7eae43f139e2c0b654387718fd8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 21 Nov 2017 09:13:08 +0000 Subject: Revert [d874801c57]: putting back "string bytelength". It turns out to be too complicated to take along with the other deprecations in TIP #485 --- doc/string.n | 4 ++-- generic/tclCmdMZ.c | 4 ---- library/init.tcl | 4 ++-- tests/info.test | 4 ++-- tests/regexp.test | 4 ++-- tests/regexpComp.test | 4 ++-- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/doc/string.n b/doc/string.n index 730f49e..00ce85c 100644 --- a/doc/string.n +++ b/doc/string.n @@ -386,8 +386,8 @@ store the representation is of very low value (except to C extension code, which has direct access for the purpose of memory management, etc.) .PP -\fICompatibility note:\fR this subcommand will be gone in -Tcl 9.0. It is better to use the +\fICompatibility note:\fR it is likely that this subcommand will be +withdrawn in a future version of Tcl. It is better to use the \fBencoding convertto\fR command to convert a string to a known encoding and then apply \fBstring length\fR to that. .PP diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 14ea6ad..67fbc94 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -2893,7 +2893,6 @@ StringCatCmd( * *---------------------------------------------------------------------- */ -#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 static int StringBytesCmd( ClientData dummy, /* Not used. */ @@ -2912,7 +2911,6 @@ StringBytesCmd( Tcl_SetObjResult(interp, Tcl_NewIntObj(length)); return TCL_OK; } -#endif /* !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 */ /* *---------------------------------------------------------------------- @@ -3370,9 +3368,7 @@ TclInitStringCmd( Tcl_Interp *interp) /* Current interpreter. */ { static const EnsembleImplMap stringImplMap[] = { -#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 {"bytelength", StringBytesCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0}, -#endif {"cat", StringCatCmd, TclCompileStringCatCmd, NULL, NULL, 0}, {"compare", StringCmpCmd, TclCompileStringCmpCmd, NULL, NULL, 0}, {"equal", StringEqualCmd, TclCompileStringEqualCmd, NULL, NULL, 0}, diff --git a/library/init.tcl b/library/init.tcl index a3ee05f..13a4300 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -279,9 +279,9 @@ proc unknown args { set errInfo [dict get $opts -errorinfo] set errCode [dict get $opts -errorcode] set cinfo $args - if {[string length $cinfo] > 150} { + if {[string bytelength $cinfo] > 150} { set cinfo [string range $cinfo 0 150] - while {[string length $cinfo] > 150} { + while {[string bytelength $cinfo] > 150} { set cinfo [string range $cinfo 0 end-1] } append cinfo ... diff --git a/tests/info.test b/tests/info.test index ac4b98c..fd89b47 100644 --- a/tests/info.test +++ b/tests/info.test @@ -103,8 +103,8 @@ test info-2.5 {info body option, returning bytecompiled bodies} -body { # causing an empty string to be returned [Bug #545644] test info-2.6 {info body option, returning list bodies} { proc foo args [list subst bar] - list [string length [info body foo]] \ - [foo; string length [info body foo]] + list [string bytelength [info body foo]] \ + [foo; string bytelength [info body foo]] } {9 9} proc testinfocmdcount {} { diff --git a/tests/regexp.test b/tests/regexp.test index 62cadd3..7367af7 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -760,8 +760,8 @@ test regexp-20.1 {regsub shared object shimmering} { set b $a set c abcdefghijklmnopqurstuvwxyz0123456789 regsub $a $c $b d - list $d [string length $d] -} [list abcdefghijklmnopqurstuvwxyz0123456789 37] + list $d [string length $d] [string bytelength $d] +} [list abcdefghijklmnopqurstuvwxyz0123456789 37 37] test regexp-20.2 {regsub shared object shimmering with -about} { eval regexp -about abc } {0 {}} diff --git a/tests/regexpComp.test b/tests/regexpComp.test index dc7b909..fbf8012 100644 --- a/tests/regexpComp.test +++ b/tests/regexpComp.test @@ -798,9 +798,9 @@ test regexpComp-20.1 {regsub shared object shimmering} { set b $a set c abcdefghijklmnopqurstuvwxyz0123456789 regsub $a $c $b d - list $d [string length $d] + list $d [string length $d] [string bytelength $d] } -} [list abcdefghijklmnopqurstuvwxyz0123456789 37] +} [list abcdefghijklmnopqurstuvwxyz0123456789 37 37] test regexpComp-20.2 {regsub shared object shimmering with -about} { evalInProc { eval regexp -about abc -- cgit v0.12 From 119652bd95761672adbaaae020c3c30141104a19 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 21 Nov 2017 09:48:36 +0000 Subject: deprecate VOID/CHAR/SHORT/LONG (windows-only) as well. --- generic/tcl.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index e054c19..e85988f 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -299,6 +299,7 @@ extern "C" { * VOID. This block is skipped under Cygwin and Mingw. */ +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 #if defined(_WIN32) && !defined(HAVE_WINNT_IGNORE_VOID) #ifndef VOID #define VOID void @@ -314,23 +315,16 @@ typedef long LONG; */ #ifndef __VXWORKS__ -# ifndef NO_VOID -# define VOID void -# else -# define VOID char -# endif +# define VOID void #endif +#endif /* !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 */ /* * Miscellaneous declarations. */ #ifndef _CLIENTDATA -# ifndef NO_VOID - typedef void *ClientData; -# else - typedef int *ClientData; -# endif + typedef void *ClientData; # define _CLIENTDATA #endif -- cgit v0.12 From 35adf8c728b9c0592670777b6beada9fdd6efa70 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 21 Nov 2017 14:21:48 +0000 Subject: Removing the pool of literal values within the internals of tclZipfs.c. Replaced with a single pointer to a const string once discovery has sorted out where tcl_library is to be loaded from. Fixed a goof in the build system if tcl is compiled outside of the source directory --- generic/tclZipfs.c | 76 ++++++++++++++---------------------------------------- unix/Makefile.in | 2 +- unix/tcl.pc.in | 2 ++ win/Makefile.in | 2 +- 4 files changed, 23 insertions(+), 59 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index a954dd6..03170a1 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -297,11 +297,7 @@ static const unsigned long crc32tab[256] = { 0x2d02ef8d, }; -static Tcl_Obj *zipfs_literal_fstype=NULL; -static Tcl_Obj *zipfs_literal_fsroot=NULL; -static Tcl_Obj *zipfs_literal_fsseparator=NULL; -static Tcl_Obj *zipfs_literal_null=NULL; -static Tcl_Obj *zipfs_literal_tcl_library=NULL; +const char *zipfs_literal_tcl_library=NULL; /* @@ -1440,13 +1436,7 @@ static int ZipFSRootObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - if(!zipfs_literal_fsroot) { - zipfs_literal_fsroot=Tcl_NewStringObj(ZIPFS_VOLUME, -1); - Tcl_IncrRefCount(zipfs_literal_fsroot); - } - Tcl_IncrRefCount(zipfs_literal_fsroot); - Tcl_SetObjResult(interp,zipfs_literal_fsroot); - return TCL_OK; + return Tcl_NewStringObj(ZIPFS_VOLUME, -1); } /* @@ -2450,12 +2440,7 @@ ZipFSTclLibraryObjCmd(ClientData clientData, Tcl_Interp *interp, Tcl_Obj *pResult; pResult=TclZipfs_TclLibrary(); if(!pResult) { - if(!zipfs_literal_null) { - zipfs_literal_null=Tcl_NewObj(); - Tcl_IncrRefCount(zipfs_literal_null); - } - pResult=zipfs_literal_null; - Tcl_IncrRefCount(zipfs_literal_null); + pResult=Tcl_NewObj(); } Tcl_SetObjResult(interp,pResult); return TCL_OK; @@ -3252,12 +3237,7 @@ Zip_FSAccessProc(Tcl_Obj *pathPtr, int mode) static Tcl_Obj * Zip_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr) { - if(!zipfs_literal_fsseparator) { - zipfs_literal_fsseparator=Tcl_NewStringObj("/", -1); - Tcl_IncrRefCount(zipfs_literal_fsseparator); - } - Tcl_IncrRefCount(zipfs_literal_fsseparator); - return zipfs_literal_fsseparator; + return Tcl_NewStringObj("/", -1); } /* @@ -3518,12 +3498,7 @@ endloop: */ static Tcl_Obj * Zip_FSListVolumesProc(void) { - if(!zipfs_literal_fsroot) { - zipfs_literal_fsroot=Tcl_NewStringObj(ZIPFS_VOLUME, -1); - Tcl_IncrRefCount(zipfs_literal_fsroot); - } - Tcl_IncrRefCount(zipfs_literal_fsroot); - return zipfs_literal_fsroot; + return Tcl_NewStringObj(ZIPFS_VOLUME, -1); } /* @@ -3670,12 +3645,7 @@ Zip_FSFileAttrsSetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, static Tcl_Obj * Zip_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr) { - if(!zipfs_literal_fstype) { - zipfs_literal_fstype=Tcl_NewStringObj("zip", -1); - Tcl_IncrRefCount(zipfs_literal_fstype); - } - Tcl_IncrRefCount(zipfs_literal_fstype); - return zipfs_literal_fstype; + return Tcl_NewStringObj("zip", -1); } @@ -3959,8 +3929,7 @@ static int TclZipfs_AppHook_FindTclInit(const char *archive){ found=Tcl_FSAccess(vfsinitscript,F_OK); Tcl_DecrRefCount(vfsinitscript); if(found==0) { - zipfs_literal_tcl_library=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT,-1); - Tcl_IncrRefCount(zipfs_literal_tcl_library); + zipfs_literal_tcl_library=ZIPFS_ZIP_MOUNT; return TCL_OK; } vfsinitscript=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/tcl_library/init.tcl",-1); @@ -3968,8 +3937,7 @@ static int TclZipfs_AppHook_FindTclInit(const char *archive){ found=Tcl_FSAccess(vfsinitscript,F_OK); Tcl_DecrRefCount(vfsinitscript); if(found==0) { - zipfs_literal_tcl_library=Tcl_NewStringObj(ZIPFS_ZIP_MOUNT "/tcl_library",-1); - Tcl_IncrRefCount(zipfs_literal_tcl_library); + zipfs_literal_tcl_library=ZIPFS_ZIP_MOUNT "/tcl_library"; return TCL_OK; } return TCL_ERROR; @@ -4020,7 +3988,7 @@ int TclZipfs_AppHook(int *argc, char ***argv) " {" ZIPFS_ZIP_MOUNT "/tk_library}\n" " {" ZIPFS_VOLUME "lib/tk/tk_library}\n" "} {\n" -" if {[file exists [file join $path init.tcl]]} continue\n" +" if {![file exists [file join $path init.tcl]]} continue\n" " set ::tk_library $path\n" " break\n" "}\n" @@ -4043,8 +4011,7 @@ int TclZipfs_AppHook(int *argc, char ***argv) found=Tcl_FSAccess(vfsinitscript,F_OK); Tcl_DecrRefCount(vfsinitscript); if(found==TCL_OK) { - zipfs_literal_tcl_library=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library",-1); - Tcl_IncrRefCount(zipfs_literal_tcl_library); + zipfs_literal_tcl_library=ZIPFS_APP_MOUNT "/tcl_library"; return TCL_OK; } } @@ -4085,9 +4052,7 @@ int TclZipfs_AppHook(int *argc, char ***argv) found=Tcl_FSAccess(vfsinitscript,F_OK); Tcl_DecrRefCount(vfsinitscript); if(found==TCL_OK) { - zipfs_literal_tcl_library=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library",-1); - Tcl_IncrRefCount(zipfs_literal_tcl_library); - zipfs_literal_tcl_library=vfsinitscript; + zipfs_literal_tcl_library=ZIPFS_APP_MOUNT "/tcl_library"; return TCL_OK; } } @@ -4097,10 +4062,7 @@ int TclZipfs_AppHook(int *argc, char ***argv) } Tcl_Obj *TclZipfs_TclLibrary(void) { - if(zipfs_literal_tcl_library) { - Tcl_IncrRefCount(zipfs_literal_tcl_library); - return zipfs_literal_tcl_library; - } else { + if(!zipfs_literal_tcl_library) { #if defined(_WIN32) || defined(_WIN64) HMODULE hModule = TclWinGetTclInstance(); WCHAR wName[MAX_PATH + LIBRARY_SIZE]; @@ -4113,20 +4075,20 @@ Tcl_Obj *TclZipfs_TclLibrary(void) { } /* Mount zip file and dll before releasing to search */ if(TclZipfs_AppHook_FindTclInit(dllname)==TCL_OK) { - Tcl_IncrRefCount(zipfs_literal_tcl_library); - return zipfs_literal_tcl_library; + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); } #else /* Mount zip file and dll before releasing to search */ if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_DLLFILE)==TCL_OK) { - Tcl_IncrRefCount(zipfs_literal_tcl_library); - return zipfs_literal_tcl_library; + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); } #endif + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); + } } - if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { - Tcl_IncrRefCount(zipfs_literal_tcl_library); - return zipfs_literal_tcl_library; + if(zipfs_literal_tcl_library) { + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); } return NULL; } diff --git a/unix/Makefile.in b/unix/Makefile.in index d6152a6..db98646 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -675,7 +675,7 @@ tclzipfile: ${TCL_ZIP_FILE} ${TCL_ZIP_FILE}: ${ZIP_INSTALL_OBJS} rm -rf ${TCL_VFS_ROOT} mkdir -p ${TCL_VFS_PATH} - cp -a ../library/* ${TCL_VFS_PATH} + cp -a $(TOP_DIR)/library/* ${TCL_VFS_PATH} cd ${TCL_VFS_ROOT} ; ${NATIVE_ZIP} ${ZIP_PROG_OPTIONS} ../${TCL_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} # The following target is configured by autoconf to generate either a shared diff --git a/unix/tcl.pc.in b/unix/tcl.pc.in index 846cb11..ca932d2 100644 --- a/unix/tcl.pc.in +++ b/unix/tcl.pc.in @@ -4,6 +4,8 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ +libfile=@TCL_LIB_FILE@ +zipfile=@TCL_ZIP_FILE@ Name: Tool Command Language Description: Tcl is a powerful, easy-to-learn dynamic programming language, suitable for a wide range of uses. diff --git a/win/Makefile.in b/win/Makefile.in index 49f0bfb..768178d 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -483,7 +483,7 @@ tclzipfile: ${TCL_ZIP_FILE} ${TCL_ZIP_FILE}: ${ZIP_INSTALL_OBJS} rm -rf ${TCL_VFS_ROOT} mkdir -p ${TCL_VFS_PATH} - cp -a ../library/* ${TCL_VFS_PATH} + $(COPY) -a $(TOP_DIR)/library/* ${TCL_VFS_PATH} cd ${TCL_VFS_ROOT} ; ${NATIVE_ZIP} ${ZIP_PROG_OPTIONS} ../${TCL_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} $(TCLSH): $(TCLSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) -- cgit v0.12 From 9215c2610ca2f4938aa0947bcbd1ecd19a8e5009 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 21 Nov 2017 14:59:04 +0000 Subject: Drop Windows CE support, since it doesn't appear to work anyway. --- generic/tclIntPlatDecls.h | 2 ++ generic/tclStubInit.c | 2 -- win/tclWin32Dll.c | 24 ++++++++---------------- win/tclWinInit.c | 12 ++---------- win/tclWinInt.h | 13 ------------- win/tclWinPipe.c | 45 ++++++++++++++------------------------------- 6 files changed, 26 insertions(+), 72 deletions(-) diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index ac06787..5003323 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -559,6 +559,8 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; # define TclWinGetServByName getservbyname # define TclWinGetSockOpt getsockopt # define TclWinSetSockOpt setsockopt +# undef TclWinGetPlatformId +# define TclWinGetPlatformId() (2) /* VER_PLATFORM_WIN32_NT */ #else # undef TclpGetPid # define TclpGetPid(pid) ((unsigned long) (pid)) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index b185f04..465dacc 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -118,8 +118,6 @@ TclpIsAtty(int fd) static int TclWinGetPlatformId() { - /* Don't bother to determine the real platform on cygwin, - * because VER_PLATFORM_WIN32_NT is the only supported platform */ return 2; /* VER_PLATFORM_WIN32_NT */; } diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 84c7a97..e482869 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -23,7 +23,6 @@ */ static HINSTANCE hInstance; /* HINSTANCE of this DLL. */ -static int platformId; /* Running under NT, or 95/98? */ /* * VC++ 5.x has no 'cpuid' assembler instruction, so we must emulate it @@ -186,18 +185,14 @@ TclWinInit( hInstance = hInst; os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); GetVersionExW(&os); - platformId = os.dwPlatformId; /* - * We no longer support Win32s or Win9x, so just in case someone manages - * to get a runtime there, make sure they know that. + * We no longer support Win32s or Win9x or Windows CE, so just in case + * someone manages to get a runtime there, make sure they know that. */ - if (platformId == VER_PLATFORM_WIN32s) { - Tcl_Panic("Win32s is not a supported platform"); - } - if (platformId == VER_PLATFORM_WIN32_WINDOWS) { - Tcl_Panic("Windows 9x is not a supported platform"); + if (os.dwPlatformId != VER_PLATFORM_WIN32_NT) { + Tcl_Panic("Windows NT is the only supported platform"); } TclWinResetInterfaces(); @@ -212,22 +207,19 @@ TclWinInit( * conditional code. * * Results: - * The return value is one of: - * VER_PLATFORM_WIN32s Win32s on Windows 3.1 (not supported) - * VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95, 98, ME (not supported) - * VER_PLATFORM_WIN32_NT Win32 on Windows NT, 2000, XP - * VER_PLATFORM_WIN32_CE Win32 on Windows CE + * The return value is: + * VER_PLATFORM_WIN32_NT Win32 on Windows NT, 2000, XP, 7, 8, 8.1, 10 * * Side effects: * None. * *---------------------------------------------------------------------- */ - +#undef TclWinGetPlatformId int TclWinGetPlatformId(void) { - return platformId; + return VER_PLATFORM_WIN32_NT; } /* diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 98c7ed5..ec5582c 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -84,15 +84,10 @@ TclWinProcs tclWinProcs; /* * The following arrays contain the human readable strings for the Windows - * platform and processor values. + * processor values. */ -#define NUMPLATFORMS 4 -static const char *const platforms[NUMPLATFORMS] = { - "Win32s", "Windows 95", "Windows NT", "Windows CE" -}; - #define NUMPROCESSORS 11 static const char *const processors[NUMPROCESSORS] = { "intel", "mips", "alpha", "ppc", "shx", "arm", "ia64", "alpha64", "msil", @@ -568,10 +563,7 @@ TclpSetVariables( Tcl_SetVar2(interp, "tcl_platform", "platform", "windows", TCL_GLOBAL_ONLY); - if (osInfo.dwPlatformId < NUMPLATFORMS) { - Tcl_SetVar2(interp, "tcl_platform", "os", - platforms[osInfo.dwPlatformId], TCL_GLOBAL_ONLY); - } + Tcl_SetVar2(interp, "tcl_platform", "os", "Windows NT", TCL_GLOBAL_ONLY); wsprintfA(buffer, "%d.%d", osInfo.dwMajorVersion, osInfo.dwMinorVersion); Tcl_SetVar2(interp, "tcl_platform", "osVersion", buffer, TCL_GLOBAL_ONLY); if (sys.oemId.wProcessorArchitecture < NUMPROCESSORS) { diff --git a/win/tclWinInt.h b/win/tclWinInt.h index 43799d0..d72cc43 100644 --- a/win/tclWinInt.h +++ b/win/tclWinInt.h @@ -40,19 +40,6 @@ typedef struct TclWinProcs { MODULE_SCOPE TclWinProcs tclWinProcs; -/* - * Some versions of Borland C have a define for the OSVERSIONINFO for - * Win32s and for NT, but not for Windows 95. - * Define VER_PLATFORM_WIN32_CE for those without newer headers. - */ - -#ifndef VER_PLATFORM_WIN32_WINDOWS -#define VER_PLATFORM_WIN32_WINDOWS 1 -#endif -#ifndef VER_PLATFORM_WIN32_CE -#define VER_PLATFORM_WIN32_CE 3 -#endif - #ifdef _WIN64 # define TCL_I_MODIFIER "I" #else diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 4b372a5..b4812ee 100644 --- a/win/tclWinPipe.c +++ b/win/tclWinPipe.c @@ -1095,40 +1095,23 @@ TclpCreateProcess( * detached processes. The GUI window will still pop up to the foreground. */ - if (TclWinGetPlatformId() == VER_PLATFORM_WIN32_NT) { - if (HasConsole()) { + if (HasConsole()) { createFlags = 0; - } else if (applType == APPL_DOS) { - /* - * Under NT, 16-bit DOS applications will not run unless they can - * be attached to a console. If we are running without a console, - * run the 16-bit program as an normal process inside of a hidden - * console application, and then run that hidden console as a - * detached process. - */ + } else if (applType == APPL_DOS) { + /* + * Under NT, 16-bit DOS applications will not run unless they can + * be attached to a console. If we are running without a console, + * run the 16-bit program as an normal process inside of a hidden + * console application, and then run that hidden console as a + * detached process. + */ - startInfo.wShowWindow = SW_HIDE; - startInfo.dwFlags |= STARTF_USESHOWWINDOW; - createFlags = CREATE_NEW_CONSOLE; - TclDStringAppendLiteral(&cmdLine, "cmd.exe /c"); - } else { - createFlags = DETACHED_PROCESS; - } + startInfo.wShowWindow = SW_HIDE; + startInfo.dwFlags |= STARTF_USESHOWWINDOW; + createFlags = CREATE_NEW_CONSOLE; + TclDStringAppendLiteral(&cmdLine, "cmd.exe /c"); } else { - if (HasConsole()) { - createFlags = 0; - } else { - createFlags = DETACHED_PROCESS; - } - - if (applType == APPL_DOS) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "DOS application process not supported on this platform", - -1)); - Tcl_SetErrorCode(interp, "TCL", "OPERATION", "EXEC", "DOS_APP", - NULL); - goto end; - } + createFlags = DETACHED_PROCESS; } /* -- cgit v0.12 From 8225859a93e2e55934b39855a9f4f736555bc474 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 21 Nov 2017 16:49:24 +0000 Subject: Eliminated the need for a preinit script in Tip 430's AppHook. tcl_findLibrary now knows to scan the dll offered up by [info loaded] to see if an attached zipfile could possibly contain the files the extension is looking for. --- generic/tclZipfs.c | 41 ++++++++--------------------------------- library/auto.tcl | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 33 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 03170a1..fa5b1a3 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -1013,7 +1013,6 @@ TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, Tcl_HashEntry *hPtr; Tcl_DString ds, fpBuf; unsigned char *q; - ReadLock(); if (!ZipFS.initialized) { if (interp != NULL) { @@ -1436,7 +1435,8 @@ static int ZipFSRootObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - return Tcl_NewStringObj(ZIPFS_VOLUME, -1); + Tcl_SetObjResult(interp,Tcl_NewStringObj(ZIPFS_VOLUME, -1)); + return TCL_OK; } /* @@ -3920,6 +3920,9 @@ ToUtf( static int TclZipfs_AppHook_FindTclInit(const char *archive){ Tcl_Obj *vfsinitscript; int found; + if(zipfs_literal_tcl_library) { + return TCL_ERROR; + } if(TclZipfs_Mount(NULL, archive, ZIPFS_ZIP_MOUNT, NULL)) { /* Either the file doesn't exist or it is not a zip archive */ return TCL_ERROR; @@ -3963,36 +3966,6 @@ int TclZipfs_AppHook(int *argc, char ***argv) ** and failing that, look for a file name CFG_RUNTIME_ZIPFILE adjacent to the ** executable */ - TclSetPreInitScript( -"foreach {path} {\n" -" {" ZIPFS_APP_MOUNT "/tcl_library}\n" -" {" ZIPFS_ZIP_MOUNT "/tcl_library}\n" -"} {\n" -" if {![file exists [file join $path init.tcl]]} continue\n" -" set ::tcl_library $path\n" -" break\n" -"}\n" -"if {![info exists ::tcl_library] || $::tcl_library eq {}} {\n" -" set zipfile [file join [file dirname [info nameofexecutable]] " CFG_RUNTIME_ZIPFILE "]\n" -" if {[file exists $zipfile]} {\n" -" zipfs mount $zipfile {" ZIPFS_ZIP_MOUNT "}\n" -" if {[file exists [file join {" ZIPFS_ZIP_MOUNT "} init.tcl]]} \{\n" -" set ::tcl_library {" ZIPFS_ZIP_MOUNT "}\n" -" } else {\n" -" zipfs unmount {" ZIPFS_ZIP_MOUNT "}\n" -" }\n" -" }\n" -"}\n" -"foreach {path} {\n" -" {" ZIPFS_APP_MOUNT "/tk_library}\n" -" {" ZIPFS_ZIP_MOUNT "/tk_library}\n" -" {" ZIPFS_VOLUME "lib/tk/tk_library}\n" -"} {\n" -" if {![file exists [file join $path init.tcl]]} continue\n" -" set ::tk_library $path\n" -" break\n" -"}\n" - ); if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { int found; Tcl_Obj *vfsinitscript; @@ -4062,7 +4035,9 @@ int TclZipfs_AppHook(int *argc, char ***argv) } Tcl_Obj *TclZipfs_TclLibrary(void) { - if(!zipfs_literal_tcl_library) { + if(zipfs_literal_tcl_library) { + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); + } else { #if defined(_WIN32) || defined(_WIN64) HMODULE hModule = TclWinGetTclInstance(); WCHAR wName[MAX_PATH + LIBRARY_SIZE]; diff --git a/library/auto.tcl b/library/auto.tcl index a7a8979..d8f9d88 100644 --- a/library/auto.tcl +++ b/library/auto.tcl @@ -74,6 +74,54 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} { lappend dirs $env($enVarName) } + catch { + set found 0 + set root [zipfs root] + set mountpoint [file join $root lib [string tolower $basename]] + lappend dirs [file join $root app ${basename}_library] + lappend dirs [file join $root lib $mountpoint ${basename}_library] + lappend dirs [file join $root lib $mountpoint] + if {![zipfs exists [file join $root app ${basename}_library]] && ![zipfs exists $mountpoint]} { + set found 0 + foreach pkgdat [info loaded] { + lassign $pkgdat dllfile dllpkg + if {[string tolower $dllpkg] ne [string tolower $basename]} continue + if {$dllfile eq {}} { + # Loaded statically + break + } + set found 1 + zipfs mount $dllfile $mountpoint + break + } + if {!$found} { + set paths {} + lappend paths [file join $root app] + lappend paths [::${basename}::pkgconfig get libdir,runtime] + lappend paths [::${basename}::pkgconfig get bindir,runtime] + if {[catch {::${basename}::pkgconfig get zipfile,runtime} zipfile]} { + set zipfile [string tolower "lib${basename}_[join [list {*}[split $version .] {*}$patch] _].zip"] + } + foreach path $paths { + set archive [file join $path $zipfile] + if {![file exists $archive]} continue + zipfs mount $archive $mountpoint + if {[zipfs exists [file join $mountpoint ${basename}_library $initScript]]} { + lappend dirs [file join $mountpoint ${basename}_library] + set found 1 + break + } elseif {[zipfs exists [file join $mountpoint $initScript]]} { + lappend dirs [file join $mountpoint $initScript] + set found 1 + break + } else { + catch {zipfs unmount $archive} + } + } + } + } + } + # 2. In the package script directory registered within the # configuration of the package itself. -- cgit v0.12 From d997aa477de14bc3128e4e5ac08713f7c40d647c Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 21 Nov 2017 18:57:31 +0000 Subject: Added additional functions to the "install" command in tclsh --- library/install.tcl | 231 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 231 insertions(+) diff --git a/library/install.tcl b/library/install.tcl index f126b37..e62226e 100644 --- a/library/install.tcl +++ b/library/install.tcl @@ -5,9 +5,240 @@ if {[llength $argv] < 2} { exit 0 } +namespace eval ::practcl {} +### +# Installer tools +### +proc ::practcl::_isdirectory name { + return [file isdirectory $name] +} +### +# Return true if the pkgindex file contains +# any statement other than "package ifneeded" +# and/or if any package ifneeded loads a DLL +### +proc ::practcl::_pkgindex_directory {path} { + set buffer {} + set pkgidxfile [file join $path pkgIndex.tcl] + if {![file exists $pkgidxfile]} { + # No pkgIndex file, read the source + foreach file [glob -nocomplain $path/*.tm] { + set file [file normalize $file] + set fname [file rootname [file tail $file]] + ### + # We used to be able to ... Assume the package is correct in the filename + # No hunt for a "package provides" + ### + set package [lindex [split $fname -] 0] + set version [lindex [split $fname -] 1] + ### + # Read the file, and override assumptions as needed + ### + set fin [open $file r] + set dat [read $fin] + close $fin + # Look for a teapot style Package statement + foreach line [split $dat \n] { + set line [string trim $line] + if { [string range $line 0 9] != "# Package " } continue + set package [lindex $line 2] + set version [lindex $line 3] + break + } + # Look for a package provide statement + foreach line [split $dat \n] { + set line [string trim $line] + if { [string range $line 0 14] != "package provide" } continue + set package [lindex $line 2] + set version [lindex $line 3] + break + } + append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n + } + foreach file [glob -nocomplain $path/*.tcl] { + if { [file tail $file] == "version_info.tcl" } continue + set fin [open $file r] + set dat [read $fin] + close $fin + if {![regexp "package provide" $dat]} continue + set fname [file rootname [file tail $file]] + # Look for a package provide statement + foreach line [split $dat \n] { + set line [string trim $line] + if { [string range $line 0 14] != "package provide" } continue + set package [lindex $line 2] + set version [lindex $line 3] + if {[string index $package 0] in "\$ \[ @"} continue + if {[string index $version 0] in "\$ \[ @"} continue + append buffer "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]" \n + break + } + } + return $buffer + } + set fin [open $pkgidxfile r] + set dat [read $fin] + close $fin + set trace 0 + #if {[file tail $path] eq "tool"} { + # set trace 1 + #} + set thisline {} + foreach line [split $dat \n] { + append thisline $line \n + if {![info complete $thisline]} continue + set line [string trim $line] + if {[string length $line]==0} { + set thisline {} ; continue + } + if {[string index $line 0] eq "#"} { + set thisline {} ; continue + } + if {[regexp "if.*catch.*package.*Tcl.*return" $thisline]} { + if {$trace} {puts "[file dirname $pkgidxfile] Ignoring $thisline"} + set thisline {} ; continue + } + if {[regexp "if.*package.*vsatisfies.*package.*provide.*return" $thisline]} { + if {$trace} { puts "[file dirname $pkgidxfile] Ignoring $thisline" } + set thisline {} ; continue + } + if {![regexp "package.*ifneeded" $thisline]} { + # This package index contains arbitrary code + # source instead of trying to add it to the master + # package index + if {$trace} { puts "[file dirname $pkgidxfile] Arbitrary code $thisline" } + return {source [file join $dir pkgIndex.tcl]} + } + append buffer $thisline \n + set thisline {} + } + if {$trace} {puts [list [file dirname $pkgidxfile] $buffer]} + return $buffer +} + + +proc ::practcl::_pkgindex_path_subdir {path} { + set result {} + foreach subpath [glob -nocomplain [file join $path *]] { + if {[file isdirectory $subpath]} { + lappend result $subpath {*}[_pkgindex_path_subdir $subpath] + } + } + return $result +} +### +# Index all paths given as though they will end up in the same +# virtual file system +### +proc ::practcl::pkgindex_path args { + set stack {} + set buffer { +lappend ::PATHSTACK $dir + } + foreach base $args { + set base [file normalize $base] + set paths {} + foreach dir [glob -nocomplain [file join $base *]] { + if {[file tail $dir] eq "teapot"} continue + lappend paths $dir {*}[::practcl::_pkgindex_path_subdir $dir] + } + set i [string length $base] + # Build a list of all of the paths + if {[llength $paths]} { + foreach path $paths { + if {$path eq $base} continue + set path_indexed($path) 0 + } + } else { + puts [list WARNING: NO PATHS FOUND IN $base] + } + set path_indexed($base) 1 + set path_indexed([file join $base boot tcl]) 1 + foreach teapath [glob -nocomplain [file join $base teapot *]] { + set pkg [file tail $teapath] + append buffer [list set pkg $pkg] + append buffer { +set pkginstall [file join $::g(HOME) teapot $pkg] +if {![file exists $pkginstall]} { + installDir [file join $dir teapot $pkg] $pkginstall +} +} + } + foreach path $paths { + if {$path_indexed($path)} continue + set thisdir [file_relative $base $path] + set idxbuf [::practcl::_pkgindex_directory $path] + if {[string length $idxbuf]} { + incr path_indexed($path) + append buffer "set dir \[set PKGDIR \[file join \[lindex \$::PATHSTACK end\] $thisdir\]\]" \n + append buffer [string map {$dir $PKGDIR} [string trimright $idxbuf]] \n + } + } + } + append buffer { +set dir [lindex $::PATHSTACK end] +set ::PATHSTACK [lrange $::PATHSTACK 0 end-1] +} + return $buffer +} + +### +# topic: 64319f4600fb63c82b2258d908f9d066 +# description: Script to build the VFS file system +### +proc ::practcl::installDir {d1 d2} { + + puts [format {%*sCreating %s} [expr {4 * [info level]}] {} [file tail $d2]] + file delete -force -- $d2 + file mkdir $d2 + + foreach ftail [glob -directory $d1 -nocomplain -tails *] { + set f [file join $d1 $ftail] + if {[file isdirectory $f] && [string compare CVS $ftail]} { + installDir $f [file join $d2 $ftail] + } elseif {[file isfile $f]} { + file copy -force $f [file join $d2 $ftail] + if {$::tcl_platform(platform) eq {unix}} { + file attributes [file join $d2 $ftail] -permissions 0644 + } else { + file attributes [file join $d2 $ftail] -readonly 1 + } + } + } + + if {$::tcl_platform(platform) eq {unix}} { + file attributes $d2 -permissions 0755 + } else { + file attributes $d2 -readonly 1 + } +} + +proc ::practcl::copyDir {d1 d2 {toplevel 1}} { + #if {$toplevel} { + # puts [list ::practcl::copyDir $d1 -> $d2] + #} + #file delete -force -- $d2 + file mkdir $d2 + + foreach ftail [glob -directory $d1 -nocomplain -tails *] { + set f [file join $d1 $ftail] + if {[file isdirectory $f] && [string compare CVS $ftail]} { + copyDir $f [file join $d2 $ftail] 0 + } elseif {[file isfile $f]} { + file copy -force $f [file join $d2 $ftail] + } + } +} + switch [lindex $argv 1] { mkzip { zipfs mkzip {*}[lrange $argv 2 end] } + mkzip { + zipfs mkimg {*}[lrange $argv 2 end] + } + default { + ::practcl::[lindex $argv 1] {*}[lrange $argv 2 end] + } } exit 0 -- cgit v0.12 From 2d811a0adff9b3a837a8bd2111d6f88742c9f5d5 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Thu, 23 Nov 2017 11:55:03 +0000 Subject: Fixing a goof, Zipfs was looking for the Dll where the installer put the file, which is not necessarily where the file will be found at runtime. --- generic/tclZipfs.c | 7 +++++-- unix/Makefile.in | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index fa5b1a3..2d475f0 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -4054,11 +4054,14 @@ Tcl_Obj *TclZipfs_TclLibrary(void) { } #else /* Mount zip file and dll before releasing to search */ - if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_DLLFILE)==TCL_OK) { + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_LIBDIR "/" CFG_RUNTIME_DLLFILE)==TCL_OK) { return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); } #endif - if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_PATH "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_LIBDIR "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); + } + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_SRCDIR "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); } } diff --git a/unix/Makefile.in b/unix/Makefile.in index db98646..3229934 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1409,7 +1409,8 @@ tclZipfs.o: $(GENERIC_DIR)/tclZipfs.c $(CC) -c $(CC_SWITCHES) \ -DCFG_RUNTIME_DLLFILE="\"$(TCL_LIB_FILE)\"" \ -DCFG_RUNTIME_ZIPFILE="\"$(TCL_ZIP_FILE)\"" \ - -DCFG_RUNTIME_PATH="\"$(DLL_INSTALL_DIR)\"" \ + -DCFG_RUNTIME_LIBDIR="\"$(libdir)\"" \ + -DCFG_RUNTIME_SCRDIR="\"$(TCL_LIBRARY)\"" \ $(ZLIB_INCLUDE) -I$(ZLIB_DIR)/contrib/minizip $(GENERIC_DIR)/tclZipfs.c tclTest.o: $(GENERIC_DIR)/tclTest.c $(IOHDR) $(TCLREHDRS) -- cgit v0.12 From dd0e9cf6b16cf0a4331b972cb7fac3786644587d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 23 Nov 2017 12:04:33 +0000 Subject: Remove more pre-XP stuff. --- generic/tclStubInit.c | 14 ++--- win/configure | 138 ++------------------------------------------------ win/tcl.m4 | 108 ++------------------------------------- win/tclWin32Dll.c | 24 --------- 4 files changed, 13 insertions(+), 271 deletions(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 1c11c61..808f5d3 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -105,6 +105,13 @@ static const char *TclGetStartupScriptFileName(void) static unsigned short TclWinNToHS(unsigned short ns) { return ntohs(ns); } +#undef TclWinGetPlatformId +#define TclWinGetPlatformId winGetPlatformId +static int +TclWinGetPlatformId() +{ + return 2; /* VER_PLATFORM_WIN32_NT */; +} #endif # define TclBNInitBignumFromWideUInt TclInitBignumFromWideUInt # define TclBNInitBignumFromWideInt TclInitBignumFromWideInt @@ -132,13 +139,6 @@ TclpIsAtty(int fd) return isatty(fd); } -#define TclWinGetPlatformId winGetPlatformId -static int -TclWinGetPlatformId() -{ - return 2; /* VER_PLATFORM_WIN32_NT */; -} - void *TclWinGetTclInstance() { void *hInstance = NULL; diff --git a/win/configure b/win/configure index fdd3adb..0ef82a5 100755 --- a/win/configure +++ b/win/configure @@ -706,7 +706,6 @@ CFLAGS_WARNING CFLAGS_OPTIMIZE CFLAGS_DEBUG DL_LIBS -CELIB_DIR CYGPATH TCL_THREADS SET_MAKE @@ -768,8 +767,6 @@ enable_threads with_encoding enable_shared enable_64bit -enable_wince -with_celib enable_symbols enable_embedded_manifest ' @@ -1392,7 +1389,6 @@ Optional Features: --enable-threads build with threads (default: on) --enable-shared build and link with shared libraries (default: on) --enable-64bit enable 64bit support (where applicable) - --enable-wince enable Win/CE support (where applicable) --enable-symbols build with debugging symbols (default: off) --enable-embedded-manifest embed manifest if possible (default: yes) @@ -1401,7 +1397,6 @@ 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 - --with-celib=DIR use Windows/CE support library from DIR Some influential environment variables: CC C compiler command @@ -3811,33 +3806,6 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $do64bit" >&5 $as_echo "$do64bit" >&6; } - # Cross-compiling options for Windows/CE builds - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Windows/CE build is requested" >&5 -$as_echo_n "checking if Windows/CE build is requested... " >&6; } - # Check whether --enable-wince was given. -if test "${enable_wince+set}" = set; then : - enableval=$enable_wince; doWince=$enableval -else - doWince=no -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doWince" >&5 -$as_echo "$doWince" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Windows/CE celib directory" >&5 -$as_echo_n "checking for Windows/CE celib directory... " >&6; } - -# Check whether --with-celib was given. -if test "${with_celib+set}" = set; then : - withval=$with_celib; CELIB_DIR=$withval -else - CELIB_DIR=NO_CELIB -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CELIB_DIR" >&5 -$as_echo "$CELIB_DIR" >&6; } - # Set some defaults (may get changed below) EXTRA_CFLAGS="" @@ -4112,7 +4080,7 @@ $as_echo_n "checking compiler flags... " >&6; } SHLIB_LD_LIBS='${LIBS}' LIBS="-lnetapi32 -lkernel32 -luser32 -ladvapi32 -luserenv -lws2_32" # mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't - LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32" + LIBS_GUI="-luxtheme -lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32" STLIB_LD='${AR} cr' RC_OUT=-o RC_TYPE= @@ -4336,107 +4304,7 @@ fi LINKBIN="link" fi - if test "$doWince" != "no" ; then - # Set defaults for common evc4/PPC2003 setup - # Currently Tcl requires 300+, possibly 420+ for sockets - CEVERSION=420; # could be 211 300 301 400 420 ... - TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ... - ARCH=ARM; # could be ARM MIPS X86EM ... - PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002" - if test "$doWince" != "yes"; then - # If !yes then the user specified something - # Reset ARCH to allow user to skip specifying it - ARCH= - eval `echo $doWince | awk -F "," '{ \ - if (length($1)) { printf "CEVERSION=\"%s\"\n", $1; \ - if ($1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \ - if (length($2)) { printf "TARGETCPU=\"%s\"\n", toupper($2) }; \ - if (length($3)) { printf "ARCH=\"%s\"\n", toupper($3) }; \ - if (length($4)) { printf "PLATFORM=\"%s\"\n", $4 }; \ - }'` - if test "x${ARCH}" = "x" ; then - ARCH=$TARGETCPU; - fi - fi - OSVERSION=WCE$CEVERSION; - if test "x${WCEROOT}" = "x" ; then - WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0" - if test ! -d "${WCEROOT}" ; then - WCEROOT="C:/Program Files/Microsoft eMbedded Tools" - fi - fi - if test "x${SDKROOT}" = "x" ; then - SDKROOT="C:/Program Files/Windows CE Tools" - if test ! -d "${SDKROOT}" ; then - SDKROOT="C:/Windows CE Tools" - fi - fi - # The space-based-path will work for the Makefile, but will - # not work if AC_TRY_COMPILE is called. - WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'` - SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'` - CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'` - if test ! -d "${CELIB_DIR}/inc"; then - as_fn_error $? "Invalid celib directory \"${CELIB_DIR}\"" "$LINENO" 5 - fi - if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"\ - -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then - as_fn_error $? "could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" "$LINENO" 5 - else - CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include" - if test -d "${CEINCLUDE}/${TARGETCPU}" ; then - CEINCLUDE="${CEINCLUDE}/${TARGETCPU}" - fi - CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" - fi - fi - - if test "$doWince" != "no" ; then - CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin" - if test "${TARGETCPU}" = "X86"; then - CC="${CEBINROOT}/cl.exe" - else - CC="${CEBINROOT}/cl${ARCH}.exe" - fi - CC="\"${CC}\" -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" - RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\"" - arch=`echo ${ARCH} | awk '{print tolower($0)}'` - defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _DLL _WINDOWS" - for i in $defs ; do - cat >>confdefs.h <<_ACEOF -#define $i 1 -_ACEOF - - done -# if test "${ARCH}" = "X86EM"; then -# AC_DEFINE_UNQUOTED(_WIN32_WCE_EMULATION) -# fi - cat >>confdefs.h <<_ACEOF -#define _WIN32_WCE $CEVERSION -_ACEOF - - cat >>confdefs.h <<_ACEOF -#define UNDER_CE $CEVERSION -_ACEOF - - CFLAGS_DEBUG="-nologo -Zi -Od" - CFLAGS_OPTIMIZE="-nologo -O2" - lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'` - lflags="-nodefaultlib -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" - LINKBIN="\"${CEBINROOT}/link.exe\"" - - if test "${CEVERSION}" -lt 400 ; then - LIBS="coredll.lib corelibc.lib winsock.lib" - else - LIBS="coredll.lib corelibc.lib ws2.lib" - fi - # celib currently stuck at wce300 status - #LIBS="$LIBS \${CELIB_DIR}/wince-${ARCH}-pocket-${OSVERSION}-release/celib.lib" - LIBS="$LIBS \"\${CELIB_DIR}/wince-${ARCH}-pocket-wce300-release/celib.lib\"" - LIBS_GUI="commctrl.lib commdlg.lib" - else - LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib" - fi + LIBS_GUI="gdi32.lib uxtheme.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib" SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}" SHLIB_LD_LIBS='${LIBS}' @@ -4467,7 +4335,7 @@ _ACEOF # Specify linker flags depending on the type of app being # built -- Console vs. Window. - if test "$doWince" != "no" -a "${TARGETCPU}" != "X86"; then + if test "${TARGETCPU}" != "X86"; then LDFLAGS_CONSOLE="-link ${lflags}" LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} else diff --git a/win/tcl.m4 b/win/tcl.m4 index b4fbcce..075cc47 100644 --- a/win/tcl.m4 +++ b/win/tcl.m4 @@ -544,17 +544,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no]) AC_MSG_RESULT($do64bit) - # Cross-compiling options for Windows/CE builds - - AC_MSG_CHECKING([if Windows/CE build is requested]) - AC_ARG_ENABLE(wince,[ --enable-wince enable Win/CE support (where applicable)], [doWince=$enableval], [doWince=no]) - AC_MSG_RESULT($doWince) - - AC_MSG_CHECKING([for Windows/CE celib directory]) - AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR], - CELIB_DIR=$withval, CELIB_DIR=NO_CELIB) - AC_MSG_RESULT([$CELIB_DIR]) - # Set some defaults (may get changed below) EXTRA_CFLAGS="" AC_DEFINE(MODULE_SCOPE, [extern], [No need to mark inidividual symbols as hidden]) @@ -675,7 +664,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ SHLIB_LD_LIBS='${LIBS}' LIBS="-lnetapi32 -lkernel32 -luser32 -ladvapi32 -luserenv -lws2_32" # mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't - LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32" + LIBS_GUI="-luxtheme -lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32" STLIB_LD='${AR} cr' RC_OUT=-o RC_TYPE= @@ -871,98 +860,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ LINKBIN="link" fi - if test "$doWince" != "no" ; then - # Set defaults for common evc4/PPC2003 setup - # Currently Tcl requires 300+, possibly 420+ for sockets - CEVERSION=420; # could be 211 300 301 400 420 ... - TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ... - ARCH=ARM; # could be ARM MIPS X86EM ... - PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002" - if test "$doWince" != "yes"; then - # If !yes then the user specified something - # Reset ARCH to allow user to skip specifying it - ARCH= - eval `echo $doWince | awk -F "," '{ \ - if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \ - if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \ - if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \ - if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \ - if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \ - }'` - if test "x${ARCH}" = "x" ; then - ARCH=$TARGETCPU; - fi - fi - OSVERSION=WCE$CEVERSION; - if test "x${WCEROOT}" = "x" ; then - WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0" - if test ! -d "${WCEROOT}" ; then - WCEROOT="C:/Program Files/Microsoft eMbedded Tools" - fi - fi - if test "x${SDKROOT}" = "x" ; then - SDKROOT="C:/Program Files/Windows CE Tools" - if test ! -d "${SDKROOT}" ; then - SDKROOT="C:/Windows CE Tools" - fi - fi - # The space-based-path will work for the Makefile, but will - # not work if AC_TRY_COMPILE is called. - WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'` - SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'` - CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'` - if test ! -d "${CELIB_DIR}/inc"; then - AC_MSG_ERROR([Invalid celib directory "${CELIB_DIR}"]) - fi - if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"\ - -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then - AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]]) - else - CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include" - if test -d "${CEINCLUDE}/${TARGETCPU}" ; then - CEINCLUDE="${CEINCLUDE}/${TARGETCPU}" - fi - CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" - fi - fi - - if test "$doWince" != "no" ; then - CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin" - if test "${TARGETCPU}" = "X86"; then - CC="${CEBINROOT}/cl.exe" - else - CC="${CEBINROOT}/cl${ARCH}.exe" - fi - CC="\"${CC}\" -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" - RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\"" - arch=`echo ${ARCH} | awk '{print tolower([$]0)}'` - defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _DLL _WINDOWS" - for i in $defs ; do - AC_DEFINE_UNQUOTED($i) - done -# if test "${ARCH}" = "X86EM"; then -# AC_DEFINE_UNQUOTED(_WIN32_WCE_EMULATION) -# fi - AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION) - AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION) - CFLAGS_DEBUG="-nologo -Zi -Od" - CFLAGS_OPTIMIZE="-nologo -O2" - lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'` - lflags="-nodefaultlib -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" - LINKBIN="\"${CEBINROOT}/link.exe\"" - AC_SUBST(CELIB_DIR) - if test "${CEVERSION}" -lt 400 ; then - LIBS="coredll.lib corelibc.lib winsock.lib" - else - LIBS="coredll.lib corelibc.lib ws2.lib" - fi - # celib currently stuck at wce300 status - #LIBS="$LIBS \${CELIB_DIR}/wince-${ARCH}-pocket-${OSVERSION}-release/celib.lib" - LIBS="$LIBS \"\${CELIB_DIR}/wince-${ARCH}-pocket-wce300-release/celib.lib\"" - LIBS_GUI="commctrl.lib commdlg.lib" - else - LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib" - fi + LIBS_GUI="gdi32.lib uxtheme.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib" SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}" SHLIB_LD_LIBS='${LIBS}' @@ -993,7 +891,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ # Specify linker flags depending on the type of app being # built -- Console vs. Window. - if test "$doWince" != "no" -a "${TARGETCPU}" != "X86"; then + if test "${TARGETCPU}" != "X86"; then LDFLAGS_CONSOLE="-link ${lflags}" LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} else diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 74e1d00..95b8193 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -199,30 +199,6 @@ TclWinInit( } /* - *---------------------------------------------------------------------- - * - * TclWinGetPlatformId -- - * - * Determines whether running under NT, 95, or Win32s, to allow runtime - * conditional code. - * - * Results: - * The return value is: - * VER_PLATFORM_WIN32_NT Win32 on Windows NT, 2000, XP, 7, 8, 8.1, 10 - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ -#undef TclWinGetPlatformId -int -TclWinGetPlatformId(void) -{ - return VER_PLATFORM_WIN32_NT; -} - -/* *------------------------------------------------------------------------- * * TclWinNoBackslash -- -- cgit v0.12 From 160a58238a314e252d6155d20c097f56f1e7738e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 23 Nov 2017 12:21:35 +0000 Subject: If compiled with -DTCL_NO_DEPRECATED, remove stub entry for TclWinGetPlatformId() --- generic/tclStubInit.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 808f5d3..355cb90 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -69,6 +69,7 @@ static int TclSockMinimumBuffersOld(int sock, int size) # define TclWinGetSockOpt 0 # define TclWinSetSockOpt 0 # define TclWinNToHS 0 +# define TclWinGetPlatformId 0 # define TclBNInitBignumFromWideUInt 0 # define TclBNInitBignumFromWideInt 0 # define TclBNInitBignumFromLong 0 @@ -101,17 +102,22 @@ static const char *TclGetStartupScriptFileName(void) #if defined(_WIN32) || defined(__CYGWIN__) #undef TclWinNToHS +#undef TclWinGetPlatformId +#ifndef TCL_NO_DEPRECATED #define TclWinNToHS winNToHS static unsigned short TclWinNToHS(unsigned short ns) { return ntohs(ns); } -#undef TclWinGetPlatformId #define TclWinGetPlatformId winGetPlatformId static int TclWinGetPlatformId() { return 2; /* VER_PLATFORM_WIN32_NT */; } +#else +#define TclWinNToHS 0 +#define TclWinGetPlatformId 0 +#endif #endif # define TclBNInitBignumFromWideUInt TclInitBignumFromWideUInt # define TclBNInitBignumFromWideInt TclInitBignumFromWideInt -- cgit v0.12 From 9b1ecce298fc120bc981d5182cc9c45bcfb0971d Mon Sep 17 00:00:00 2001 From: pooryorick Date: Thu, 23 Nov 2017 18:24:09 +0000 Subject: Move return type to its own line. --- generic/tclBasic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 2acd2e7..2f05425 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -2285,7 +2285,8 @@ Tcl_CreateObjCommand( proc, clientData, deleteProc); } -Tcl_Command TclCreateObjCommandInNs ( +Tcl_Command +TclCreateObjCommandInNs ( Tcl_Interp *interp, const char *cmdName, /* Name of command, without any namespace components */ Tcl_Namespace *namespace, /* The namespace to create the command in */ @@ -8210,7 +8211,8 @@ Tcl_NRCreateCommand( return (Tcl_Command) cmdPtr; } -Tcl_Command TclNRCreateCommandInNs ( +Tcl_Command +TclNRCreateCommandInNs ( Tcl_Interp *interp, const char *cmdName, Tcl_Namespace *nsPtr, -- cgit v0.12 From 2fcfa34fcf2d769d0421000f57d8601a3a712322 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Fri, 24 Nov 2017 10:32:10 +0000 Subject: Restoring whitespace to tclZipfs.c to improve legibility. --- generic/tclZipfs.c | 2927 +++++++++++++++++++++++++--------------------------- 1 file changed, 1426 insertions(+), 1501 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 2d475f0..b9d09f1 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -98,6 +98,10 @@ #define ZIP_PASSWORD_END_SIG 0x5a5a4b50 +/* Macro to report errors only if an interp is present */ +#define ZIPFS_ERROR(interp,errstr) \ + if(interp != NULL) Tcl_SetObjResult(interp, Tcl_NewStringObj(errstr, -1)); + /* * Macros to read and write 16 and 32 bit integers from/to ZIP archives. */ @@ -328,7 +332,7 @@ ReadLock(void) while (ZipFS.lock < 0) { ZipFS.waiters++; Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, NULL); - ZipFS.waiters--; + ZipFS.waiters--; } ZipFS.lock++; Tcl_MutexUnlock(&ZipFSMutex); @@ -341,7 +345,7 @@ WriteLock(void) while (ZipFS.lock != 0) { ZipFS.waiters++; Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, NULL); - ZipFS.waiters--; + ZipFS.waiters--; } ZipFS.lock = -1; Tcl_MutexUnlock(&ZipFSMutex); @@ -352,12 +356,12 @@ Unlock(void) { Tcl_MutexLock(&ZipFSMutex); if (ZipFS.lock > 0) { - --ZipFS.lock; + --ZipFS.lock; } else if (ZipFS.lock < 0) { - ZipFS.lock = 0; + ZipFS.lock = 0; } if ((ZipFS.lock == 0) && (ZipFS.waiters > 0)) { - Tcl_ConditionNotify(&ZipFSCond); + Tcl_ConditionNotify(&ZipFSCond); } Tcl_MutexUnlock(&ZipFSMutex); } @@ -396,8 +400,8 @@ DosTimeDate(int dosDate, int dosTime) tm.tm_sec = (dosTime & 0x1f) << 1; ret = mktime(&tm); if (ret == (time_t) -1) { - /* fallback to 1980-01-01T00:00:00+00:00 (DOS epoch) */ - ret = (time_t) 315532800; + /* fallback to 1980-01-01T00:00:00+00:00 (DOS epoch) */ + ret = (time_t) 315532800; } return ret; } @@ -481,10 +485,10 @@ CountSlashes(const char *string) const char *p = string; while (*p != '\0') { - if (*p == '/') { - count++; - } - p++; + if (*p == '/') { + count++; + } + p++; } return count; } @@ -515,131 +519,136 @@ CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr,int ZIPFSPA int i, j, c, isunc = 0, isvfs=0, n=0; #if HAS_DRIVES int zipfspath=1; - if ((tail[0] != '\0') && (strchr(drvletters, tail[0]) != NULL) && - (tail[1] == ':')) { - tail += 2; - zipfspath=0; + if ( + (tail[0] != '\0') + && (strchr(drvletters, tail[0]) != NULL) + && (tail[1] == ':') + ) { + tail += 2; + zipfspath=0; } /* UNC style path */ if (tail[0] == '\\') { - root = ""; - ++tail; - zipfspath=0; + root = ""; + ++tail; + zipfspath=0; } if (tail[0] == '\\') { - root = "/"; - ++tail; - zipfspath=0; + root = "/"; + ++tail; + zipfspath=0; } if(zipfspath) { #endif - /* UNC style path */ - if(root && strncmp(root,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN)==0) { - isvfs=1; - } else if (tail && strncmp(tail,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN) == 0) { - isvfs=2; - } - if(isvfs!=1) { - if ((root[0] == '/') && (root[1] == '/')) { - isunc = 1; - } - } + /* UNC style path */ + if(root && strncmp(root,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN)==0) { + isvfs=1; + } else if (tail && strncmp(tail,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN) == 0) { + isvfs=2; + } + if(isvfs!=1) { + if ((root[0] == '/') && (root[1] == '/')) { + isunc = 1; + } + } #if HAS_DRIVES } #endif if(isvfs!=2) { - if (tail[0] == '/') { - if(isvfs!=1) { - root = ""; - } - ++tail; - isunc = 0; - } - if (tail[0] == '/') { - if(isvfs!=1) { - root = "/"; - } - ++tail; - isunc = 1; - } + if (tail[0] == '/') { + if(isvfs!=1) { + root = ""; + } + ++tail; + isunc = 0; + } + if (tail[0] == '/') { + if(isvfs!=1) { + root = "/"; + } + ++tail; + isunc = 1; + } } i = strlen(root); j = strlen(tail); if(isvfs==1) { - if(i>ZIPFS_VOLUME_LEN) { - Tcl_DStringSetLength(dsPtr, i + j + 1); - path = Tcl_DStringValue(dsPtr); - memcpy(path, root, i); - path[i++] = '/'; - memcpy(path + i, tail, j); - } else { - Tcl_DStringSetLength(dsPtr, i + j); - path = Tcl_DStringValue(dsPtr); - memcpy(path, root, i); - memcpy(path + i, tail, j); - } + if(i>ZIPFS_VOLUME_LEN) { + Tcl_DStringSetLength(dsPtr, i + j + 1); + path = Tcl_DStringValue(dsPtr); + memcpy(path, root, i); + path[i++] = '/'; + memcpy(path + i, tail, j); + } else { + Tcl_DStringSetLength(dsPtr, i + j); + path = Tcl_DStringValue(dsPtr); + memcpy(path, root, i); + memcpy(path + i, tail, j); + } } else if(isvfs==2) { - Tcl_DStringSetLength(dsPtr, j); - path = Tcl_DStringValue(dsPtr); - memcpy(path, tail, j); + Tcl_DStringSetLength(dsPtr, j); + path = Tcl_DStringValue(dsPtr); + memcpy(path, tail, j); } else { - if (ZIPFSPATH) { - Tcl_DStringSetLength(dsPtr, i + j + ZIPFS_VOLUME_LEN); - path = Tcl_DStringValue(dsPtr); - memcpy(path, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN); - memcpy(path + ZIPFS_VOLUME_LEN + i , tail, j); - } else { - Tcl_DStringSetLength(dsPtr, i + j + 1); - path = Tcl_DStringValue(dsPtr); - memcpy(path, root, i); - path[i++] = '/'; - memcpy(path + i, tail, j); - } + if (ZIPFSPATH) { + Tcl_DStringSetLength(dsPtr, i + j + ZIPFS_VOLUME_LEN); + path = Tcl_DStringValue(dsPtr); + memcpy(path, ZIPFS_VOLUME, ZIPFS_VOLUME_LEN); + memcpy(path + ZIPFS_VOLUME_LEN + i , tail, j); + } else { + Tcl_DStringSetLength(dsPtr, i + j + 1); + path = Tcl_DStringValue(dsPtr); + memcpy(path, root, i); + path[i++] = '/'; + memcpy(path + i, tail, j); + } } #if HAS_DRIVES for (i = 0; path[i] != '\0'; i++) { - if (path[i] == '\\') { - path[i] = '/'; - } + if (path[i] == '\\') { + path[i] = '/'; + } } #endif if(ZIPFSPATH) { - n=ZIPFS_VOLUME_LEN; + n=ZIPFS_VOLUME_LEN; } else { - n=0; + n=0; } for (i = j = n; (c = path[i]) != '\0'; i++) { - if (c == '/') { - int c2 = path[i + 1]; - if (c2 == '/') { - continue; - } - if (c2 == '.') { - int c3 = path[i + 2]; - if ((c3 == '/') || (c3 == '\0')) { - i++; - continue; - } - if ((c3 == '.') && - ((path[i + 3] == '/') || (path [i + 3] == '\0'))) { - i += 2; - while ((j > 0) && (path[j - 1] != '/')) { - j--; - } - if (j > isunc) { - --j; - while ((j > 1 + isunc) && (path[j - 2] == '/')) { - j--; - } - } - continue; - } - } - } - path[j++] = c; + if (c == '/') { + int c2 = path[i + 1]; + if (c2 == '/') { + continue; + } + if (c2 == '.') { + int c3 = path[i + 2]; + if ((c3 == '/') || (c3 == '\0')) { + i++; + continue; + } + if ( + (c3 == '.') + && ((path[i + 3] == '/') || (path [i + 3] == '\0')) + ) { + i += 2; + while ((j > 0) && (path[j - 1] != '/')) { + j--; + } + if (j > isunc) { + --j; + while ((j > 1 + isunc) && (path[j - 2] == '/')) { + j--; + } + } + continue; + } + } + } + path[j++] = c; } if (j == 0) { - path[j++] = '/'; + path[j++] = '/'; } path[j] = 0; Tcl_DStringSetLength(dsPtr, j); @@ -709,13 +718,12 @@ ZipFSLookupMount(char *filename) int match = 0; hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); while (hPtr != NULL) { - if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { - if (strcmp(zf->mntpt, filename) == 0) { - match = 1; - break; - } - } - hPtr = Tcl_NextHashEntry(&search); + if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) == NULL) continue; + if (strcmp(zf->mntpt, filename) == 0) { + match = 1; + break; + } + hPtr = Tcl_NextHashEntry(&search); } return match; } @@ -743,21 +751,21 @@ ZipFSCloseArchive(Tcl_Interp *interp, ZipFile *zf) { #if defined(_WIN32) || defined(_WIN64) if ((zf->data != NULL) && (zf->tofree == NULL)) { - UnmapViewOfFile(zf->data); - zf->data = NULL; + UnmapViewOfFile(zf->data); + zf->data = NULL; } if (zf->mh != INVALID_HANDLE_VALUE) { - CloseHandle(zf->mh); + CloseHandle(zf->mh); } #else if ((zf->data != MAP_FAILED) && (zf->tofree == NULL)) { - munmap(zf->data, zf->length); - zf->data = MAP_FAILED; + munmap(zf->data, zf->length); + zf->data = MAP_FAILED; } #endif if (zf->tofree != NULL) { - Tcl_Free((char *) zf->tofree); - zf->tofree = NULL; + Tcl_Free((char *) zf->tofree); + zf->tofree = NULL; } Tcl_Close(interp, zf->chan); zf->chan = NULL; @@ -807,176 +815,138 @@ ZipFSOpenArchive(Tcl_Interp *interp, const char *zipname, int needZip, zf->pwbuf[0] = 0; zf->chan = Tcl_OpenFileChannel(interp, zipname, "r", 0); if (zf->chan == NULL) { - return TCL_ERROR; + return TCL_ERROR; } if (Tcl_GetChannelHandle(zf->chan, TCL_READABLE, &handle) != TCL_OK) { - if (Tcl_SetChannelOption(interp, zf->chan, "-translation", "binary") - != TCL_OK) { - goto error; - } - if (Tcl_SetChannelOption(interp, zf->chan, "-encoding", "binary") - != TCL_OK) { - goto error; - } - zf->length = Tcl_Seek(zf->chan, 0, SEEK_END); - if ((zf->length <= 0) || (zf->length > 64 * 1024 * 1024)) { - if (interp) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("illegal file size", -1)); - } - goto error; - } - Tcl_Seek(zf->chan, 0, SEEK_SET); - zf->tofree = zf->data = (unsigned char *) Tcl_AttemptAlloc(zf->length); - if (zf->tofree == NULL) { - if (interp) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("out of memory", -1)); - } - goto error; - } - i = Tcl_Read(zf->chan, (char *) zf->data, zf->length); - if (i != zf->length) { - if (interp) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("file read error", -1)); - } - goto error; - } - Tcl_Close(interp, zf->chan); - zf->chan = NULL; + if (Tcl_SetChannelOption(interp, zf->chan, "-translation", "binary") != TCL_OK) { + goto error; + } + if (Tcl_SetChannelOption(interp, zf->chan, "-encoding", "binary") != TCL_OK) { + goto error; + } + zf->length = Tcl_Seek(zf->chan, 0, SEEK_END); + if ((zf->length <= 0) || (zf->length > 64 * 1024 * 1024)) { + ZIPFS_ERROR(interp,"illegal file size"); + goto error; + } + Tcl_Seek(zf->chan, 0, SEEK_SET); + zf->tofree = zf->data = (unsigned char *) Tcl_AttemptAlloc(zf->length); + if (zf->tofree == NULL) { + ZIPFS_ERROR(interp,"out of memory") + goto error; + } + i = Tcl_Read(zf->chan, (char *) zf->data, zf->length); + if (i != zf->length) { + ZIPFS_ERROR(interp,"file read error"); + goto error; + } + Tcl_Close(interp, zf->chan); + zf->chan = NULL; } else { #if defined(_WIN32) || defined(_WIN64) - zf->length = GetFileSize((HANDLE) handle, 0); - if ((zf->length == INVALID_FILE_SIZE) || - (zf->length < ZIP_CENTRAL_END_LEN)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("invalid file size", -1)); - } - goto error; - } - zf->mh = CreateFileMapping((HANDLE) handle, 0, PAGE_READONLY, 0, - zf->length, 0); - if (zf->mh == INVALID_HANDLE_VALUE) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("file mapping failed", -1)); - } - goto error; - } - zf->data = MapViewOfFile(zf->mh, FILE_MAP_READ, 0, 0, zf->length); - if (zf->data == NULL) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("file mapping failed", -1)); - } - goto error; - } + zf->length = GetFileSize((HANDLE) handle, 0); + if ( + (zf->length == INVALID_FILE_SIZE) || + (zf->length < ZIP_CENTRAL_END_LEN) + ) { + ZIPFS_ERROR(interp,"invalid file size"); + goto error; + } + zf->mh = CreateFileMapping((HANDLE) handle, 0, PAGE_READONLY, 0, + zf->length, 0); + if (zf->mh == INVALID_HANDLE_VALUE) { + ZIPFS_ERROR(interp,"file mapping failed"); + goto error; + } + zf->data = MapViewOfFile(zf->mh, FILE_MAP_READ, 0, 0, zf->length); + if (zf->data == NULL) { + ZIPFS_ERROR(interp,"file mapping failed"); + goto error; + } #else - zf->length = lseek((int) (long) handle, 0, SEEK_END); - if ((zf->length == -1) || (zf->length < ZIP_CENTRAL_END_LEN)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("invalid file size", -1)); - } - goto error; - } - lseek((int) (long) handle, 0, SEEK_SET); - zf->data = (unsigned char *) mmap(0, zf->length, PROT_READ, - MAP_FILE | MAP_PRIVATE, - (int) (long) handle, 0); - if (zf->data == MAP_FAILED) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("file mapping failed", -1)); - } - goto error; - } + zf->length = lseek((int) (long) handle, 0, SEEK_END); + if ((zf->length == -1) || (zf->length < ZIP_CENTRAL_END_LEN)) { + ZIPFS_ERROR(interp,"invalid file size"); + goto error; + } + lseek((int) (long) handle, 0, SEEK_SET); + zf->data = (unsigned char *) mmap(0, zf->length, PROT_READ, + MAP_FILE | MAP_PRIVATE, + (int) (long) handle, 0); + if (zf->data == MAP_FAILED) { + ZIPFS_ERROR(interp,"file mapping failed"); + goto error; + } #endif } p = zf->data + zf->length - ZIP_CENTRAL_END_LEN; while (p >= zf->data) { - if (*p == (ZIP_CENTRAL_END_SIG & 0xFF)) { - if (zip_read_int(p) == ZIP_CENTRAL_END_SIG) { - break; - } - p -= ZIP_SIG_LEN; - } else { - --p; - } + if (*p == (ZIP_CENTRAL_END_SIG & 0xFF)) { + if (zip_read_int(p) == ZIP_CENTRAL_END_SIG) { + break; + } + p -= ZIP_SIG_LEN; + } else { + --p; + } } if (p < zf->data) { - if (!needZip) { - zf->baseoffs = zf->baseoffsp = zf->length; - return TCL_OK; - } - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("wrong end signature", -1)); - } - goto error; + if (!needZip) { + zf->baseoffs = zf->baseoffsp = zf->length; + return TCL_OK; + } + ZIPFS_ERROR(interp,"wrong end signature"); + goto error; } zf->nfiles = zip_read_short(p + ZIP_CENTRAL_ENTS_OFFS); if (zf->nfiles == 0) { - if (!needZip) { - zf->baseoffs = zf->baseoffsp = zf->length; - return TCL_OK; - } - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("empty archive", -1)); - } - goto error; + if (!needZip) { + zf->baseoffs = zf->baseoffsp = zf->length; + return TCL_OK; + } + ZIPFS_ERROR(interp,"empty archive"); + goto error; } q = zf->data + zip_read_int(p + ZIP_CENTRAL_DIRSTART_OFFS); p -= zip_read_int(p + ZIP_CENTRAL_DIRSIZE_OFFS); - if ((p < zf->data) || (p > (zf->data + zf->length)) || - (q < zf->data) || (q > (zf->data + zf->length))) { - if (!needZip) { - zf->baseoffs = zf->baseoffsp = zf->length; - return TCL_OK; - } - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("archive directory not found", -1)); - } - goto error; + if ( + (p < zf->data) || (p > (zf->data + zf->length)) || + (q < zf->data) || (q > (zf->data + zf->length)) + ) { + if (!needZip) { + zf->baseoffs = zf->baseoffsp = zf->length; + return TCL_OK; + } + ZIPFS_ERROR(interp,"archive directory not found"); + goto error; } zf->baseoffs = zf->baseoffsp = p - q; zf->centoffs = p - zf->data; q = p; for (i = 0; i < zf->nfiles; i++) { - int pathlen, comlen, extra; + int pathlen, comlen, extra; - if ((q + ZIP_CENTRAL_HEADER_LEN) > (zf->data + zf->length)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("wrong header length", -1)); - } - goto error; - } - if (zip_read_int(q) != ZIP_CENTRAL_HEADER_SIG) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("wrong header signature", -1)); - } - goto error; - } - pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); - comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); - extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); - q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; + if ((q + ZIP_CENTRAL_HEADER_LEN) > (zf->data + zf->length)) { + ZIPFS_ERROR(interp,"wrong header length"); + goto error; + } + if (zip_read_int(q) != ZIP_CENTRAL_HEADER_SIG) { + ZIPFS_ERROR(interp,"wrong header signature"); + goto error; + } + pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); + comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); + extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); + q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; } q = zf->data + zf->baseoffs; - if ((zf->baseoffs >= 6) && - (zip_read_int(q - 4) == ZIP_PASSWORD_END_SIG)) { - i = q[-5]; - if (q - 5 - i > zf->data) { - zf->pwbuf[0] = i; - memcpy(zf->pwbuf + 1, q - 5 - i, i); - zf->baseoffsp -= i ? (5 + i) : 0; - } + if ((zf->baseoffs >= 6) && (zip_read_int(q - 4) == ZIP_PASSWORD_END_SIG)) { + i = q[-5]; + if (q - 5 - i > zf->data) { + zf->pwbuf[0] = i; + memcpy(zf->pwbuf + 1, q - 5 - i, i); + zf->baseoffsp -= i ? (5 + i) : 0; + } } return TCL_OK; @@ -1004,9 +974,11 @@ error: */ int -TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, - const char *passwd) -{ +TclZipfs_Mount( + Tcl_Interp *interp, const char *zipname, + const char *mntpt, + const char *passwd +) { int i, pwlen, isNew; ZipFile *zf, zf0; ZipEntry *z; @@ -1015,49 +987,45 @@ TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, unsigned char *q; ReadLock(); if (!ZipFS.initialized) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("not initialized", -1)); - } - Unlock(); - return TCL_ERROR; + ZIPFS_ERROR(interp,"not initialized"); + Unlock(); + return TCL_ERROR; } if (zipname == NULL) { - Tcl_HashSearch search; - int ret = TCL_OK; - - i = 0; - hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); - while (hPtr != NULL) { - if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { - if (interp != NULL) { - Tcl_AppendElement(interp, zf->mntpt); - Tcl_AppendElement(interp, zf->name); - } - ++i; - } - hPtr = Tcl_NextHashEntry(&search); - } - if (interp == NULL) { - ret = (i > 0) ? TCL_OK : TCL_BREAK; - } - Unlock(); - return ret; + Tcl_HashSearch search; + int ret = TCL_OK; + + i = 0; + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { + if (interp != NULL) { + Tcl_AppendElement(interp, zf->mntpt); + Tcl_AppendElement(interp, zf->name); + } + ++i; + } + hPtr = Tcl_NextHashEntry(&search); + } + if (interp == NULL) { + ret = (i > 0) ? TCL_OK : TCL_BREAK; + } + Unlock(); + return ret; } if (mntpt == NULL) { - if (interp == NULL) { - Unlock(); - return TCL_OK; - } - hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, zipname); - if (hPtr != NULL) { - if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); - } - } - Unlock(); - return TCL_OK; + if (interp == NULL) { + Unlock(); + return TCL_OK; + } + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, zipname); + if (hPtr != NULL) { + if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { + Tcl_SetObjResult(interp,Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); + } + } + Unlock(); + return TCL_OK; } Unlock(); pwlen = 0; @@ -1072,7 +1040,7 @@ TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, } } if (ZipFSOpenArchive(interp, zipname, 1, &zf0) != TCL_OK) { - return TCL_ERROR; + return TCL_ERROR; } /* * Mount point can come from Tcl_GetNameOfExecutable() @@ -1082,236 +1050,235 @@ TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, WriteLock(); hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, zipname, &isNew); if (!isNew) { - zf = (ZipFile *) Tcl_GetHashValue(hPtr); - if (interp != NULL) { - Tcl_AppendResult(interp, "already mounted on \"", zf->mntptlen ? - zf->mntpt : "/", "\"", (char *) NULL); - } - Unlock(); - ZipFSCloseArchive(interp, &zf0); - return TCL_ERROR; + zf = (ZipFile *) Tcl_GetHashValue(hPtr); + if (interp != NULL) { + Tcl_AppendResult(interp, "already mounted on \"", zf->mntptlen ? + zf->mntpt : "/", "\"", (char *) NULL); + } + Unlock(); + ZipFSCloseArchive(interp, &zf0); + return TCL_ERROR; } if (strcmp(mntpt, "/") == 0) { - mntpt = ""; + mntpt = ""; } zf = (ZipFile *) Tcl_AttemptAlloc(sizeof (*zf) + strlen(mntpt) + 1); if (zf == NULL) { - if (interp != NULL) { - Tcl_AppendResult(interp, "out of memory", (char *) NULL); - } - Unlock(); - ZipFSCloseArchive(interp, &zf0); - return TCL_ERROR; - } - *zf = zf0; - zf->name = Tcl_GetHashKey(&ZipFS.zipHash, hPtr); - strcpy(zf->mntpt, mntpt); - zf->mntptlen = strlen(zf->mntpt); - zf->entries = NULL; - zf->topents = NULL; - zf->nopen = 0; - Tcl_SetHashValue(hPtr, (ClientData) zf); - if ((zf->pwbuf[0] == 0) && pwlen) { - int k = 0; - i = pwlen; - zf->pwbuf[k++] = i; - while (i > 0) { - zf->pwbuf[k] = (passwd[i - 1] & 0x0f) | - pwrot[(passwd[i - 1] >> 4) & 0x0f]; - k++; - i--; - } - zf->pwbuf[k] = '\0'; + if (interp != NULL) { + Tcl_AppendResult(interp, "out of memory", (char *) NULL); + } + Unlock(); + ZipFSCloseArchive(interp, &zf0); + return TCL_ERROR; + } + *zf = zf0; + zf->name = Tcl_GetHashKey(&ZipFS.zipHash, hPtr); + strcpy(zf->mntpt, mntpt); + zf->mntptlen = strlen(zf->mntpt); + zf->entries = NULL; + zf->topents = NULL; + zf->nopen = 0; + Tcl_SetHashValue(hPtr, (ClientData) zf); + if ((zf->pwbuf[0] == 0) && pwlen) { + int k = 0; + i = pwlen; + zf->pwbuf[k++] = i; + while (i > 0) { + zf->pwbuf[k] = (passwd[i - 1] & 0x0f) | + pwrot[(passwd[i - 1] >> 4) & 0x0f]; + k++; + i--; + } + zf->pwbuf[k] = '\0'; } if (mntpt[0] != '\0') { - z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); - z->name = NULL; - z->tnext = NULL; - z->depth = CountSlashes(mntpt); - z->zipfile = zf; - z->isdir = 1; - z->isenc = 0; - z->offset = zf->baseoffs; - z->crc32 = 0; - z->timestamp = 0; - z->nbyte = z->nbytecompr = 0; - z->cmeth = ZIP_COMPMETH_STORED; - z->data = NULL; - hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, mntpt, &isNew); - if (!isNew) { - /* skip it */ - Tcl_Free((char *) z); - } else { - Tcl_SetHashValue(hPtr, (ClientData) z); - z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); - z->next = zf->entries; - zf->entries = z; - } + z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); + z->name = NULL; + z->tnext = NULL; + z->depth = CountSlashes(mntpt); + z->zipfile = zf; + z->isdir = 1; + z->isenc = 0; + z->offset = zf->baseoffs; + z->crc32 = 0; + z->timestamp = 0; + z->nbyte = z->nbytecompr = 0; + z->cmeth = ZIP_COMPMETH_STORED; + z->data = NULL; + hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, mntpt, &isNew); + if (!isNew) { + /* skip it */ + Tcl_Free((char *) z); + } else { + Tcl_SetHashValue(hPtr, (ClientData) z); + z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); + z->next = zf->entries; + zf->entries = z; + } } q = zf->data + zf->centoffs; Tcl_DStringInit(&fpBuf); Tcl_DStringInit(&ds); for (i = 0; i < zf->nfiles; i++) { - int pathlen, comlen, extra, isdir = 0, dosTime, dosDate, nbcompr, offs; - unsigned char *lq, *gq = NULL; - char *fullpath, *path; - - pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); - comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); - extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); - Tcl_DStringSetLength(&ds, 0); - Tcl_DStringAppend(&ds, (char *) q + ZIP_CENTRAL_HEADER_LEN, pathlen); - path = Tcl_DStringValue(&ds); - if ((pathlen > 0) && (path[pathlen - 1] == '/')) { - Tcl_DStringSetLength(&ds, pathlen - 1); - path = Tcl_DStringValue(&ds); - isdir = 1; - } - if ((strcmp(path, ".") == 0) || (strcmp(path, "..") == 0)) { - goto nextent; - } - lq = zf->data + zf->baseoffs + - zip_read_int(q + ZIP_CENTRAL_LOCALHDR_OFFS); - if ((lq < zf->data) || (lq > (zf->data + zf->length))) { - goto nextent; - } - nbcompr = zip_read_int(lq + ZIP_LOCAL_COMPLEN_OFFS); - if (!isdir && (nbcompr == 0) && - (zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS) == 0) && - (zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS) == 0)) { - gq = q; - nbcompr = zip_read_int(gq + ZIP_CENTRAL_COMPLEN_OFFS); - } - offs = (lq - zf->data) - + ZIP_LOCAL_HEADER_LEN - + zip_read_short(lq + ZIP_LOCAL_PATHLEN_OFFS) - + zip_read_short(lq + ZIP_LOCAL_EXTRALEN_OFFS); - if ((offs + nbcompr) > zf->length) { - goto nextent; - } - if (!isdir && (mntpt[0] == '\0') && !CountSlashes(path)) { + int pathlen, comlen, extra, isdir = 0, dosTime, dosDate, nbcompr, offs; + unsigned char *lq, *gq = NULL; + char *fullpath, *path; + + pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); + comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); + extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); + Tcl_DStringSetLength(&ds, 0); + Tcl_DStringAppend(&ds, (char *) q + ZIP_CENTRAL_HEADER_LEN, pathlen); + path = Tcl_DStringValue(&ds); + if ((pathlen > 0) && (path[pathlen - 1] == '/')) { + Tcl_DStringSetLength(&ds, pathlen - 1); + path = Tcl_DStringValue(&ds); + isdir = 1; + } + if ((strcmp(path, ".") == 0) || (strcmp(path, "..") == 0)) { + goto nextent; + } + lq = zf->data + zf->baseoffs + zip_read_int(q + ZIP_CENTRAL_LOCALHDR_OFFS); + if ((lq < zf->data) || (lq > (zf->data + zf->length))) { + goto nextent; + } + nbcompr = zip_read_int(lq + ZIP_LOCAL_COMPLEN_OFFS); + if ( + !isdir && (nbcompr == 0) + && (zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS) == 0) + && (zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS) == 0) + ) { + gq = q; + nbcompr = zip_read_int(gq + ZIP_CENTRAL_COMPLEN_OFFS); + } + offs = (lq - zf->data) + + ZIP_LOCAL_HEADER_LEN + + zip_read_short(lq + ZIP_LOCAL_PATHLEN_OFFS) + + zip_read_short(lq + ZIP_LOCAL_EXTRALEN_OFFS); + if ((offs + nbcompr) > zf->length) { + goto nextent; + } + if (!isdir && (mntpt[0] == '\0') && !CountSlashes(path)) { #ifdef ANDROID - /* - * When mounting the ZIP archive on the root directory try - * to remap top level regular files of the archive to - * /assets/.root/... since this directory should not be - * in a valid APK due to the leading dot in the file name - * component. This trick should make the files - * AndroidManifest.xml, resources.arsc, and classes.dex - * visible to Tcl. - */ - Tcl_DString ds2; - - Tcl_DStringInit(&ds2); - Tcl_DStringAppend(&ds2, "assets/.root/", -1); - Tcl_DStringAppend(&ds2, path, -1); - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, Tcl_DStringValue(&ds2)); - if (hPtr != NULL) { - /* should not happen but skip it anyway */ - Tcl_DStringFree(&ds2); - goto nextent; - } - Tcl_DStringSetLength(&ds, 0); - Tcl_DStringAppend(&ds, Tcl_DStringValue(&ds2), - Tcl_DStringLength(&ds2)); - path = Tcl_DStringValue(&ds); - Tcl_DStringFree(&ds2); + /* + * When mounting the ZIP archive on the root directory try + * to remap top level regular files of the archive to + * /assets/.root/... since this directory should not be + * in a valid APK due to the leading dot in the file name + * component. This trick should make the files + * AndroidManifest.xml, resources.arsc, and classes.dex + * visible to Tcl. + */ + Tcl_DString ds2; + + Tcl_DStringInit(&ds2); + Tcl_DStringAppend(&ds2, "assets/.root/", -1); + Tcl_DStringAppend(&ds2, path, -1); + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, Tcl_DStringValue(&ds2)); + if (hPtr != NULL) { + /* should not happen but skip it anyway */ + Tcl_DStringFree(&ds2); + goto nextent; + } + Tcl_DStringSetLength(&ds, 0); + Tcl_DStringAppend(&ds, Tcl_DStringValue(&ds2), Tcl_DStringLength(&ds2)); + path = Tcl_DStringValue(&ds); + Tcl_DStringFree(&ds2); #else - /* - * Regular files skipped when mounting on root. - */ - goto nextent; + /* + * Regular files skipped when mounting on root. + */ + goto nextent; #endif - } - Tcl_DStringSetLength(&fpBuf, 0); - fullpath = CanonicalPath(mntpt, path, &fpBuf, 1); - z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); - z->name = NULL; - z->tnext = NULL; - z->depth = CountSlashes(fullpath); - z->zipfile = zf; - z->isdir = isdir; - z->isenc = (zip_read_short(lq + ZIP_LOCAL_FLAGS_OFFS) & 1) - && (nbcompr > 12); - z->offset = offs; - if (gq != NULL) { - z->crc32 = zip_read_int(gq + ZIP_CENTRAL_CRC32_OFFS); - dosDate = zip_read_short(gq + ZIP_CENTRAL_MDATE_OFFS); - dosTime = zip_read_short(gq + ZIP_CENTRAL_MTIME_OFFS); - z->timestamp = DosTimeDate(dosDate, dosTime); - z->nbyte = zip_read_int(gq + ZIP_CENTRAL_UNCOMPLEN_OFFS); - z->cmeth = zip_read_short(gq + ZIP_CENTRAL_COMPMETH_OFFS); - } else { - z->crc32 = zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS); - dosDate = zip_read_short(lq + ZIP_LOCAL_MDATE_OFFS); - dosTime = zip_read_short(lq + ZIP_LOCAL_MTIME_OFFS); - z->timestamp = DosTimeDate(dosDate, dosTime); - z->nbyte = zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS); - z->cmeth = zip_read_short(lq + ZIP_LOCAL_COMPMETH_OFFS); - } - z->nbytecompr = nbcompr; - z->data = NULL; - hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, fullpath, &isNew); - if (!isNew) { - /* should not happen but skip it anyway */ - Tcl_Free((char *) z); - } else { - Tcl_SetHashValue(hPtr, (ClientData) z); - z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); - z->next = zf->entries; - zf->entries = z; - if (isdir && (mntpt[0] == '\0') && (z->depth == 1)) { - z->tnext = zf->topents; - zf->topents = z; - } - if (!z->isdir && (z->depth > 1)) { - char *dir, *end; - ZipEntry *zd; - - Tcl_DStringSetLength(&ds, strlen(z->name) + 8); - Tcl_DStringSetLength(&ds, 0); - Tcl_DStringAppend(&ds, z->name, -1); - dir = Tcl_DStringValue(&ds); - end = strrchr(dir, '/'); - while ((end != NULL) && (end != dir)) { - Tcl_DStringSetLength(&ds, end - dir); - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, dir); - if (hPtr != NULL) { - break; - } - zd = (ZipEntry *) Tcl_Alloc(sizeof (*zd)); - zd->name = NULL; - zd->tnext = NULL; - zd->depth = CountSlashes(dir); - zd->zipfile = zf; - zd->isdir = 1; - zd->isenc = 0; - zd->offset = z->offset; - zd->crc32 = 0; - zd->timestamp = z->timestamp; - zd->nbyte = zd->nbytecompr = 0; - zd->cmeth = ZIP_COMPMETH_STORED; - zd->data = NULL; - hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, dir, &isNew); - if (!isNew) { - /* should not happen but skip it anyway */ - Tcl_Free((char *) zd); - } else { - Tcl_SetHashValue(hPtr, (ClientData) zd); - zd->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); - zd->next = zf->entries; - zf->entries = zd; - if ((mntpt[0] == '\0') && (zd->depth == 1)) { - zd->tnext = zf->topents; - zf->topents = zd; - } - } - end = strrchr(dir, '/'); - } - } - } + } + Tcl_DStringSetLength(&fpBuf, 0); + fullpath = CanonicalPath(mntpt, path, &fpBuf, 1); + z = (ZipEntry *) Tcl_Alloc(sizeof (*z)); + z->name = NULL; + z->tnext = NULL; + z->depth = CountSlashes(fullpath); + z->zipfile = zf; + z->isdir = isdir; + z->isenc = (zip_read_short(lq + ZIP_LOCAL_FLAGS_OFFS) & 1) && (nbcompr > 12); + z->offset = offs; + if (gq != NULL) { + z->crc32 = zip_read_int(gq + ZIP_CENTRAL_CRC32_OFFS); + dosDate = zip_read_short(gq + ZIP_CENTRAL_MDATE_OFFS); + dosTime = zip_read_short(gq + ZIP_CENTRAL_MTIME_OFFS); + z->timestamp = DosTimeDate(dosDate, dosTime); + z->nbyte = zip_read_int(gq + ZIP_CENTRAL_UNCOMPLEN_OFFS); + z->cmeth = zip_read_short(gq + ZIP_CENTRAL_COMPMETH_OFFS); + } else { + z->crc32 = zip_read_int(lq + ZIP_LOCAL_CRC32_OFFS); + dosDate = zip_read_short(lq + ZIP_LOCAL_MDATE_OFFS); + dosTime = zip_read_short(lq + ZIP_LOCAL_MTIME_OFFS); + z->timestamp = DosTimeDate(dosDate, dosTime); + z->nbyte = zip_read_int(lq + ZIP_LOCAL_UNCOMPLEN_OFFS); + z->cmeth = zip_read_short(lq + ZIP_LOCAL_COMPMETH_OFFS); + } + z->nbytecompr = nbcompr; + z->data = NULL; + hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, fullpath, &isNew); + if (!isNew) { + /* should not happen but skip it anyway */ + Tcl_Free((char *) z); + } else { + Tcl_SetHashValue(hPtr, (ClientData) z); + z->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); + z->next = zf->entries; + zf->entries = z; + if (isdir && (mntpt[0] == '\0') && (z->depth == 1)) { + z->tnext = zf->topents; + zf->topents = z; + } + if (!z->isdir && (z->depth > 1)) { + char *dir, *end; + ZipEntry *zd; + + Tcl_DStringSetLength(&ds, strlen(z->name) + 8); + Tcl_DStringSetLength(&ds, 0); + Tcl_DStringAppend(&ds, z->name, -1); + dir = Tcl_DStringValue(&ds); + end = strrchr(dir, '/'); + while ((end != NULL) && (end != dir)) { + Tcl_DStringSetLength(&ds, end - dir); + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, dir); + if (hPtr != NULL) { + break; + } + zd = (ZipEntry *) Tcl_Alloc(sizeof (*zd)); + zd->name = NULL; + zd->tnext = NULL; + zd->depth = CountSlashes(dir); + zd->zipfile = zf; + zd->isdir = 1; + zd->isenc = 0; + zd->offset = z->offset; + zd->crc32 = 0; + zd->timestamp = z->timestamp; + zd->nbyte = zd->nbytecompr = 0; + zd->cmeth = ZIP_COMPMETH_STORED; + zd->data = NULL; + hPtr = Tcl_CreateHashEntry(&ZipFS.fileHash, dir, &isNew); + if (!isNew) { + /* should not happen but skip it anyway */ + Tcl_Free((char *) zd); + } else { + Tcl_SetHashValue(hPtr, (ClientData) zd); + zd->name = Tcl_GetHashKey(&ZipFS.fileHash, hPtr); + zd->next = zf->entries; + zf->entries = zd; + if ((mntpt[0] == '\0') && (zd->depth == 1)) { + zd->tnext = zf->topents; + zf->topents = zd; + } + } + end = strrchr(dir, '/'); + } + } + } nextent: - q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; + q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; } Unlock(); Tcl_DStringFree(&fpBuf); @@ -1345,34 +1312,30 @@ TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) int ret = TCL_OK, unmounted = 0; WriteLock(); - if (!ZipFS.initialized) { - goto done; - } + if (!ZipFS.initialized) goto done; + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, zipname); - if (hPtr == NULL) { + /* don't report error */ - goto done; - } + if (hPtr == NULL) goto done; + zf = (ZipFile *) Tcl_GetHashValue(hPtr); if (zf->nopen > 0) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("filesystem is busy", -1)); - } - ret = TCL_ERROR; - goto done; + ZIPFS_ERROR(interp,"filesystem is busy"); + ret = TCL_ERROR; + goto done; } Tcl_DeleteHashEntry(hPtr); for (z = zf->entries; z; z = znext) { - znext = z->next; - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, z->name); - if (hPtr) { - Tcl_DeleteHashEntry(hPtr); - } - if (z->data != NULL) { - Tcl_Free((char *) z->data); - } - Tcl_Free((char *) z); + znext = z->next; + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, z->name); + if (hPtr) { + Tcl_DeleteHashEntry(hPtr); + } + if (z->data != NULL) { + Tcl_Free((char *) z->data); + } + Tcl_Free((char *) z); } ZipFSCloseArchive(interp, zf); Tcl_Free((char *) zf); @@ -1380,7 +1343,7 @@ TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) done: Unlock(); if (unmounted) { - Tcl_FSMountsChanged(NULL); + Tcl_FSMountsChanged(NULL); } return ret; } @@ -1402,13 +1365,13 @@ done: */ static int -ZipFSMountObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ +ZipFSMountObjCmd( + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[] +) { if (objc > 4) { - Tcl_WrongNumArgs(interp, 1, objv, - "?zipfile? ?mountpoint? ?password?"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, + "?zipfile? ?mountpoint? ?password?"); + return TCL_ERROR; } return TclZipfs_Mount(interp, (objc > 1) ? Tcl_GetString(objv[1]) : NULL, (objc > 2) ? Tcl_GetString(objv[2]) : NULL, @@ -1432,9 +1395,9 @@ ZipFSMountObjCmd(ClientData clientData, Tcl_Interp *interp, */ static int -ZipFSRootObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ +ZipFSRootObjCmd( + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[] +) { Tcl_SetObjResult(interp,Tcl_NewStringObj(ZIPFS_VOLUME, -1)); return TCL_OK; } @@ -1456,12 +1419,12 @@ ZipFSRootObjCmd(ClientData clientData, Tcl_Interp *interp, */ static int -ZipFSUnmountObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ +ZipFSUnmountObjCmd( + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[] +) { if (objc != 2) { - Tcl_WrongNumArgs(interp, 1, objv, "zipfile"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, "zipfile"); + return TCL_ERROR; } return TclZipfs_Unmount(interp, Tcl_GetString(objv[1])); } @@ -1484,32 +1447,31 @@ ZipFSUnmountObjCmd(ClientData clientData, Tcl_Interp *interp, */ static int -ZipFSMkKeyObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ +ZipFSMkKeyObjCmd( + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[] +) { int len, i = 0; char *pw, pwbuf[264]; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "password"); - return TCL_ERROR; + return TCL_ERROR; } pw = Tcl_GetString(objv[1]); len = strlen(pw); if (len == 0) { - return TCL_OK; + return TCL_OK; } if ((len > 255) || (strchr(pw, 0xff) != NULL)) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("illegal password", -1)); - return TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_NewStringObj("illegal password", -1)); + return TCL_ERROR; } while (len > 0) { - int ch = pw[len - 1]; + int ch = pw[len - 1]; - pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; - i++; - len--; + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + i++; + len--; } pwbuf[i] = i; ++i; @@ -1543,10 +1505,11 @@ ZipFSMkKeyObjCmd(ClientData clientData, Tcl_Interp *interp, */ static int -ZipAddFile(Tcl_Interp *interp, const char *path, const char *name, - Tcl_Channel out, const char *passwd, - char *buf, int bufsize, Tcl_HashTable *fileHash) -{ +ZipAddFile( + Tcl_Interp *interp, const char *path, const char *name, + Tcl_Channel out, const char *passwd, + char *buf, int bufsize, Tcl_HashTable *fileHash +) { Tcl_Channel in; Tcl_HashEntry *hPtr; ZipEntry *z; @@ -1559,67 +1522,66 @@ ZipAddFile(Tcl_Interp *interp, const char *path, const char *name, zpath = name; while (zpath != NULL && zpath[0] == '/') { - zpath++; + zpath++; } if ((zpath == NULL) || (zpath[0] == '\0')) { - return TCL_OK; + return TCL_OK; } zpathlen = strlen(zpath); if (zpathlen + ZIP_CENTRAL_HEADER_LEN > bufsize) { - Tcl_AppendResult(interp, "path too long for \"", path, "\"", - (char *) NULL); - return TCL_ERROR; + Tcl_AppendResult(interp, "path too long for \"", path, "\"", (char *) NULL); + return TCL_ERROR; } in = Tcl_OpenFileChannel(interp, path, "r", 0); - if ((in == NULL) || - (Tcl_SetChannelOption(interp, in, "-translation", "binary") - != TCL_OK) || - (Tcl_SetChannelOption(interp, in, "-encoding", "binary") - != TCL_OK)) { + if ( + (in == NULL) + || (Tcl_SetChannelOption(interp, in, "-translation", "binary") != TCL_OK) + || (Tcl_SetChannelOption(interp, in, "-encoding", "binary") != TCL_OK) + ) { #if defined(_WIN32) || defined(_WIN64) - /* hopefully a directory */ - if (strcmp("permission denied", Tcl_PosixError(interp)) == 0) { - Tcl_Close(interp, in); - return TCL_OK; - } + /* hopefully a directory */ + if (strcmp("permission denied", Tcl_PosixError(interp)) == 0) { + Tcl_Close(interp, in); + return TCL_OK; + } #endif - Tcl_Close(interp, in); - return TCL_ERROR; + Tcl_Close(interp, in); + return TCL_ERROR; } else { - Tcl_Obj *pathObj = Tcl_NewStringObj(path, -1); - Tcl_StatBuf statBuf; + Tcl_Obj *pathObj = Tcl_NewStringObj(path, -1); + Tcl_StatBuf statBuf; - Tcl_IncrRefCount(pathObj); - if (Tcl_FSStat(pathObj, &statBuf) != -1) { - mtime = statBuf.st_mtime; - } - Tcl_DecrRefCount(pathObj); + Tcl_IncrRefCount(pathObj); + if (Tcl_FSStat(pathObj, &statBuf) != -1) { + mtime = statBuf.st_mtime; + } + Tcl_DecrRefCount(pathObj); } Tcl_ResetResult(interp); crc = 0; nbyte = nbytecompr = 0; while ((len = Tcl_Read(in, buf, bufsize)) > 0) { - crc = crc32(crc, (unsigned char *) buf, len); - nbyte += len; + crc = crc32(crc, (unsigned char *) buf, len); + nbyte += len; } if (len == -1) { - if (nbyte == 0) { - if (strcmp("illegal operation on a directory", - Tcl_PosixError(interp)) == 0) { - Tcl_Close(interp, in); - return TCL_OK; - } - } - Tcl_AppendResult(interp, "read error on \"", path, "\"", - (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; + if (nbyte == 0) { + if (strcmp("illegal operation on a directory", + Tcl_PosixError(interp)) == 0) { + Tcl_Close(interp, in); + return TCL_OK; + } + } + Tcl_AppendResult(interp, "read error on \"", path, "\"", + (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; } if (Tcl_Seek(in, 0, SEEK_SET) == -1) { - Tcl_AppendResult(interp, "seek error on \"", path, "\"", - (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; + Tcl_AppendResult(interp, "seek error on \"", path, "\"", + (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; } pos[0] = Tcl_Tell(out); memset(buf, '\0', ZIP_LOCAL_HEADER_LEN); @@ -1632,56 +1594,55 @@ wrerr: return TCL_ERROR; } if ((len + pos[0]) & 3) { - char abuf[8]; - - /* - * Align payload to next 4-byte boundary using a dummy extra - * entry similar to the zipalign tool from Android's SDK. - */ - align = 4 + ((len + pos[0]) & 3); - zip_write_short(abuf, 0xffff); - zip_write_short(abuf + 2, align - 4); - zip_write_int(abuf + 4, 0x03020100); - if (Tcl_Write(out, abuf, align) != align) { - goto wrerr; - } + char abuf[8]; + + /* + * Align payload to next 4-byte boundary using a dummy extra + * entry similar to the zipalign tool from Android's SDK. + */ + align = 4 + ((len + pos[0]) & 3); + zip_write_short(abuf, 0xffff); + zip_write_short(abuf + 2, align - 4); + zip_write_int(abuf + 4, 0x03020100); + if (Tcl_Write(out, abuf, align) != align) { + goto wrerr; + } } if (passwd != NULL) { - int i, ch, tmp; - unsigned char kvbuf[24]; - Tcl_Obj *ret; - - init_keys(passwd, keys, crc32tab); - for (i = 0; i < 12 - 2; i++) { - if (Tcl_EvalEx(interp, "expr int(rand() * 256) % 256", -1, 0) != TCL_OK) { - Tcl_AppendResult(interp, "PRNG error", (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; - } - ret = Tcl_GetObjResult(interp); - if (Tcl_GetIntFromObj(interp, ret, &ch) != TCL_OK) { - Tcl_Close(interp, in); - return TCL_ERROR; - } - kvbuf[i + 12] = (unsigned char) zencode(keys, crc32tab, ch, tmp); - } - Tcl_ResetResult(interp); - init_keys(passwd, keys, crc32tab); - for (i = 0; i < 12 - 2; i++) { - kvbuf[i] = (unsigned char) zencode(keys, crc32tab, - kvbuf[i + 12], tmp); - } - kvbuf[i++] = (unsigned char) zencode(keys, crc32tab, crc >> 16, tmp); - kvbuf[i++] = (unsigned char) zencode(keys, crc32tab, crc >> 24, tmp); - len = Tcl_Write(out, (char *) kvbuf, 12); - memset(kvbuf, 0, 24); - if (len != 12) { - Tcl_AppendResult(interp, "write error", (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; - } - memcpy(keys0, keys, sizeof (keys0)); - nbytecompr += 12; + int i, ch, tmp; + unsigned char kvbuf[24]; + Tcl_Obj *ret; + + init_keys(passwd, keys, crc32tab); + for (i = 0; i < 12 - 2; i++) { + if (Tcl_EvalEx(interp, "expr int(rand() * 256) % 256", -1, 0) != TCL_OK) { + Tcl_AppendResult(interp, "PRNG error", (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + ret = Tcl_GetObjResult(interp); + if (Tcl_GetIntFromObj(interp, ret, &ch) != TCL_OK) { + Tcl_Close(interp, in); + return TCL_ERROR; + } + kvbuf[i + 12] = (unsigned char) zencode(keys, crc32tab, ch, tmp); + } + Tcl_ResetResult(interp); + init_keys(passwd, keys, crc32tab); + for (i = 0; i < 12 - 2; i++) { + kvbuf[i] = (unsigned char) zencode(keys, crc32tab, kvbuf[i + 12], tmp); + } + kvbuf[i++] = (unsigned char) zencode(keys, crc32tab, crc >> 16, tmp); + kvbuf[i++] = (unsigned char) zencode(keys, crc32tab, crc >> 24, tmp); + len = Tcl_Write(out, (char *) kvbuf, 12); + memset(kvbuf, 0, 24); + if (len != 12) { + Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + memcpy(keys0, keys, sizeof (keys0)); + nbytecompr += 12; } Tcl_Flush(out); pos[2] = Tcl_Tell(out); @@ -1690,12 +1651,11 @@ wrerr: stream.zalloc = Z_NULL; stream.zfree = Z_NULL; stream.opaque = Z_NULL; - if (deflateInit2(&stream, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) - != Z_OK) { - Tcl_AppendResult(interp, "compression init error on \"", path, "\"", - (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; + if (deflateInit2(&stream, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) != Z_OK) { + Tcl_AppendResult(interp, "compression init error on \"", path, "\"", + (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; } do { len = Tcl_Read(in, buf, bufsize); @@ -1714,25 +1674,25 @@ wrerr: stream.next_out = (unsigned char *) obuf; len = deflate(&stream, flush); if (len == Z_STREAM_ERROR) { - Tcl_AppendResult(interp, "deflate error on \"", path, "\"", - (char *) NULL); - deflateEnd(&stream); - Tcl_Close(interp, in); - return TCL_ERROR; + Tcl_AppendResult(interp, "deflate error on \"", path, "\"", + (char *) NULL); + deflateEnd(&stream); + Tcl_Close(interp, in); + return TCL_ERROR; } olen = sizeof (obuf) - stream.avail_out; if (passwd != NULL) { - int i, tmp; + int i, tmp; - for (i = 0; i < olen; i++) { - obuf[i] = (char) zencode(keys, crc32tab, obuf[i], tmp); - } + for (i = 0; i < olen; i++) { + obuf[i] = (char) zencode(keys, crc32tab, obuf[i], tmp); + } } if (olen && (Tcl_Write(out, obuf, olen) != olen)) { - Tcl_AppendResult(interp, "write error", (char *) NULL); - deflateEnd(&stream); - Tcl_Close(interp, in); - return TCL_ERROR; + Tcl_AppendResult(interp, "write error", (char *) NULL); + deflateEnd(&stream); + Tcl_Close(interp, in); + return TCL_ERROR; } nbytecompr += olen; } while (stream.avail_out == 0); @@ -1741,48 +1701,48 @@ wrerr: Tcl_Flush(out); pos[1] = Tcl_Tell(out); if (nbyte - nbytecompr <= 0) { - /* - * Compressed file larger than input, - * write it again uncompressed. - */ - if ((int) Tcl_Seek(in, 0, SEEK_SET) != 0) { - goto seekErr; - } - if ((int) Tcl_Seek(out, pos[2], SEEK_SET) != pos[2]) { + /* + * Compressed file larger than input, + * write it again uncompressed. + */ + if ((int) Tcl_Seek(in, 0, SEEK_SET) != 0) { + goto seekErr; + } + if ((int) Tcl_Seek(out, pos[2], SEEK_SET) != pos[2]) { seekErr: - Tcl_Close(interp, in); - Tcl_AppendResult(interp, "seek error", (char *) NULL); - return TCL_ERROR; - } - nbytecompr = (passwd != NULL) ? 12 : 0; - while (1) { - len = Tcl_Read(in, buf, bufsize); - if (len == -1) { - Tcl_AppendResult(interp, "read error on \"", path, "\"", - (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; - } else if (len == 0) { - break; - } - if (passwd != NULL) { - int i, tmp; + Tcl_Close(interp, in); + Tcl_AppendResult(interp, "seek error", (char *) NULL); + return TCL_ERROR; + } + nbytecompr = (passwd != NULL) ? 12 : 0; + while (1) { + len = Tcl_Read(in, buf, bufsize); + if (len == -1) { + Tcl_AppendResult(interp, "read error on \"", path, "\"", + (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } else if (len == 0) { + break; + } + if (passwd != NULL) { + int i, tmp; - for (i = 0; i < len; i++) { - buf[i] = (char) zencode(keys0, crc32tab, buf[i], tmp); - } - } - if (Tcl_Write(out, buf, len) != len) { - Tcl_AppendResult(interp, "write error", (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; - } - nbytecompr += len; - } - cmeth = ZIP_COMPMETH_STORED; - Tcl_Flush(out); - pos[1] = Tcl_Tell(out); - Tcl_TruncateChannel(out, pos[1]); + for (i = 0; i < len; i++) { + buf[i] = (char) zencode(keys0, crc32tab, buf[i], tmp); + } + } + if (Tcl_Write(out, buf, len) != len) { + Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; + } + nbytecompr += len; + } + cmeth = ZIP_COMPMETH_STORED; + Tcl_Flush(out); + pos[1] = Tcl_Tell(out); + Tcl_TruncateChannel(out, pos[1]); } Tcl_Close(interp, in); @@ -1802,14 +1762,14 @@ seekErr: z->data = NULL; hPtr = Tcl_CreateHashEntry(fileHash, zpath, &isNew); if (!isNew) { - Tcl_AppendResult(interp, "non-unique path name \"", path, "\"", - (char *) NULL); - Tcl_Free((char *) z); - return TCL_ERROR; + Tcl_AppendResult(interp, "non-unique path name \"", path, "\"", + (char *) NULL); + Tcl_Free((char *) z); + return TCL_ERROR; } else { - Tcl_SetHashValue(hPtr, (ClientData) z); - z->name = Tcl_GetHashKey(fileHash, hPtr); - z->next = NULL; + Tcl_SetHashValue(hPtr, (ClientData) z); + z->name = Tcl_GetHashKey(fileHash, hPtr); + z->next = NULL; } /* @@ -1827,23 +1787,23 @@ seekErr: zip_write_short(buf + ZIP_LOCAL_PATHLEN_OFFS, zpathlen); zip_write_short(buf + ZIP_LOCAL_EXTRALEN_OFFS, align); if ((int) Tcl_Seek(out, pos[0], SEEK_SET) != pos[0]) { - Tcl_DeleteHashEntry(hPtr); - Tcl_Free((char *) z); - Tcl_AppendResult(interp, "seek error", (char *) NULL); - return TCL_ERROR; + Tcl_DeleteHashEntry(hPtr); + Tcl_Free((char *) z); + Tcl_AppendResult(interp, "seek error", (char *) NULL); + return TCL_ERROR; } if (Tcl_Write(out, buf, ZIP_LOCAL_HEADER_LEN) != ZIP_LOCAL_HEADER_LEN) { - Tcl_DeleteHashEntry(hPtr); - Tcl_Free((char *) z); - Tcl_AppendResult(interp, "write error", (char *) NULL); - return TCL_ERROR; + Tcl_DeleteHashEntry(hPtr); + Tcl_Free((char *) z); + Tcl_AppendResult(interp, "write error", (char *) NULL); + return TCL_ERROR; } Tcl_Flush(out); if ((int) Tcl_Seek(out, pos[1], SEEK_SET) != pos[1]) { - Tcl_DeleteHashEntry(hPtr); - Tcl_Free((char *) z); - Tcl_AppendResult(interp, "seek error", (char *) NULL); - return TCL_ERROR; + Tcl_DeleteHashEntry(hPtr); + Tcl_Free((char *) z); + Tcl_AppendResult(interp, "seek error", (char *) NULL); + return TCL_ERROR; } return TCL_OK; } @@ -1868,9 +1828,9 @@ seekErr: */ static int -ZipFSMkZipOrImgObjCmd(ClientData clientData, Tcl_Interp *interp, - int isImg, int isList, int objc, Tcl_Obj *const objv[]) -{ +ZipFSMkZipOrImgObjCmd( + ClientData clientData, Tcl_Interp *interp,int isImg, int isList, int objc, Tcl_Obj *const objv[] +) { Tcl_Channel out; int len = 0, pwlen = 0, slen = 0, i, count, ret = TCL_ERROR, lobjc, pos[3]; Tcl_Obj **lobjv, *list = NULL; @@ -1881,161 +1841,160 @@ ZipFSMkZipOrImgObjCmd(ClientData clientData, Tcl_Interp *interp, char *strip = NULL, *pw = NULL, pwbuf[264], buf[4096]; if (isList) { - if ((objc < 3) || (objc > (isImg ? 5 : 4))) { - Tcl_WrongNumArgs(interp, 1, objv, isImg ? - "outfile inlist ?password infile?" : - "outfile inlist ?password?"); - return TCL_ERROR; - } + if ((objc < 3) || (objc > (isImg ? 5 : 4))) { + Tcl_WrongNumArgs(interp, 1, objv, isImg ? + "outfile inlist ?password infile?" : + "outfile inlist ?password?"); + return TCL_ERROR; + } } else { - if ((objc < 3) || (objc > (isImg ? 6 : 5))) { - Tcl_WrongNumArgs(interp, 1, objv, isImg ? - "outfile indir ?strip? ?password? ?infile?" : - "outfile indir ?strip? ?password?"); - return TCL_ERROR; - } + if ((objc < 3) || (objc > (isImg ? 6 : 5))) { + Tcl_WrongNumArgs(interp, 1, objv, isImg ? + "outfile indir ?strip? ?password? ?infile?" : + "outfile indir ?strip? ?password?"); + return TCL_ERROR; + } } pwbuf[0] = 0; if (objc > (isList ? 3 : 4)) { - pw = Tcl_GetString(objv[isList ? 3 : 4]); - pwlen = strlen(pw); - if ((pwlen > 255) || (strchr(pw, 0xff) != NULL)) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("illegal password", -1)); - return TCL_ERROR; - } + pw = Tcl_GetString(objv[isList ? 3 : 4]); + pwlen = strlen(pw); + if ((pwlen > 255) || (strchr(pw, 0xff) != NULL)) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal password", -1)); + return TCL_ERROR; + } } if (isList) { - list = objv[2]; - Tcl_IncrRefCount(list); + list = objv[2]; + Tcl_IncrRefCount(list); } else { - Tcl_Obj *cmd[3]; - - cmd[1] = Tcl_NewStringObj("::zipfs::find", -1); - cmd[2] = objv[2]; - cmd[0] = Tcl_NewListObj(2, cmd + 1); - Tcl_IncrRefCount(cmd[0]); - if (Tcl_EvalObjEx(interp, cmd[0], TCL_EVAL_DIRECT) != TCL_OK) { - Tcl_DecrRefCount(cmd[0]); - return TCL_ERROR; - } - Tcl_DecrRefCount(cmd[0]); - list = Tcl_GetObjResult(interp); - Tcl_IncrRefCount(list); + Tcl_Obj *cmd[3]; + + cmd[1] = Tcl_NewStringObj("::tcl::zipfs::find", -1); + cmd[2] = objv[2]; + cmd[0] = Tcl_NewListObj(2, cmd + 1); + Tcl_IncrRefCount(cmd[0]); + if (Tcl_EvalObjEx(interp, cmd[0], TCL_EVAL_DIRECT) != TCL_OK) { + Tcl_DecrRefCount(cmd[0]); + return TCL_ERROR; + } + Tcl_DecrRefCount(cmd[0]); + list = Tcl_GetObjResult(interp); + Tcl_IncrRefCount(list); } if (Tcl_ListObjGetElements(interp, list, &lobjc, &lobjv) != TCL_OK) { - Tcl_DecrRefCount(list); - return TCL_ERROR; + Tcl_DecrRefCount(list); + return TCL_ERROR; } if (isList && (lobjc % 2)) { - Tcl_DecrRefCount(list); - Tcl_SetObjResult(interp, - Tcl_NewStringObj("need even number of elements", -1)); - return TCL_ERROR; + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, + Tcl_NewStringObj("need even number of elements", -1)); + return TCL_ERROR; } if (lobjc == 0) { - Tcl_DecrRefCount(list); - Tcl_SetObjResult(interp, Tcl_NewStringObj("empty archive", -1)); - return TCL_ERROR; + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, Tcl_NewStringObj("empty archive", -1)); + return TCL_ERROR; } out = Tcl_OpenFileChannel(interp, Tcl_GetString(objv[1]), "w", 0755); - if ((out == NULL) || - (Tcl_SetChannelOption(interp, out, "-translation", "binary") - != TCL_OK) || - (Tcl_SetChannelOption(interp, out, "-encoding", "binary") - != TCL_OK)) { - Tcl_DecrRefCount(list); - Tcl_Close(interp, out); - return TCL_ERROR; - } - if (isImg) { - ZipFile zf0; - const char *imgName; - - if (isList) { - imgName = (objc > 4) ? Tcl_GetString(objv[4]) : - Tcl_GetNameOfExecutable(); - } else { - imgName = (objc > 5) ? Tcl_GetString(objv[5]) : - Tcl_GetNameOfExecutable(); - } - if (ZipFSOpenArchive(interp, imgName, 0, &zf0) != TCL_OK) { - Tcl_DecrRefCount(list); - Tcl_Close(interp, out); - return TCL_ERROR; - } - if ((pw != NULL) && pwlen) { - i = 0; - len = pwlen; - while (len > 0) { - int ch = pw[len - 1]; - - pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; - i++; - len--; - } - pwbuf[i] = i; - ++i; - pwbuf[i++] = (char) ZIP_PASSWORD_END_SIG; - pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 8); - pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 16); - pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 24); - pwbuf[i] = '\0'; - } - i = Tcl_Write(out, (char *) zf0.data, zf0.baseoffsp); - if (i != zf0.baseoffsp) { + if ( + (out == NULL) + || (Tcl_SetChannelOption(interp, out, "-translation", "binary") != TCL_OK) + || (Tcl_SetChannelOption(interp, out, "-encoding", "binary") != TCL_OK) + ) { Tcl_DecrRefCount(list); - Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); Tcl_Close(interp, out); - ZipFSCloseArchive(interp, &zf0); return TCL_ERROR; - } - ZipFSCloseArchive(interp, &zf0); - len = strlen(pwbuf); - if (len > 0) { - i = Tcl_Write(out, pwbuf, len); - if (i != len) { - Tcl_DecrRefCount(list); - Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); - Tcl_Close(interp, out); - return TCL_ERROR; - } - } - memset(pwbuf, 0, sizeof (pwbuf)); - Tcl_Flush(out); + } + if (isImg) { + ZipFile zf0; + const char *imgName; + + if (isList) { + imgName = (objc > 4) ? Tcl_GetString(objv[4]) : + Tcl_GetNameOfExecutable(); + } else { + imgName = (objc > 5) ? Tcl_GetString(objv[5]) : + Tcl_GetNameOfExecutable(); + } + if (ZipFSOpenArchive(interp, imgName, 0, &zf0) != TCL_OK) { + Tcl_DecrRefCount(list); + Tcl_Close(interp, out); + return TCL_ERROR; + } + if ((pw != NULL) && pwlen) { + i = 0; + len = pwlen; + while (len > 0) { + int ch = pw[len - 1]; + + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + i++; + len--; + } + pwbuf[i] = i; + ++i; + pwbuf[i++] = (char) ZIP_PASSWORD_END_SIG; + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 8); + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 16); + pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 24); + pwbuf[i] = '\0'; + } + i = Tcl_Write(out, (char *) zf0.data, zf0.baseoffsp); + if (i != zf0.baseoffsp) { + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); + Tcl_Close(interp, out); + ZipFSCloseArchive(interp, &zf0); + return TCL_ERROR; + } + ZipFSCloseArchive(interp, &zf0); + len = strlen(pwbuf); + if (len > 0) { + i = Tcl_Write(out, pwbuf, len); + if (i != len) { + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); + Tcl_Close(interp, out); + return TCL_ERROR; + } + } + memset(pwbuf, 0, sizeof (pwbuf)); + Tcl_Flush(out); } Tcl_InitHashTable(&fileHash, TCL_STRING_KEYS); pos[0] = Tcl_Tell(out); if (!isList && (objc > 3)) { - strip = Tcl_GetString(objv[3]); - slen = strlen(strip); + strip = Tcl_GetString(objv[3]); + slen = strlen(strip); } for (i = 0; i < lobjc; i += (isList ? 2 : 1)) { - const char *path, *name; + const char *path, *name; - path = Tcl_GetString(lobjv[i]); - if (isList) { - name = Tcl_GetString(lobjv[i + 1]); - } else { - name = path; - if (slen > 0) { - len = strlen(name); - if ((len <= slen) || (strncmp(strip, name, slen) != 0)) { - continue; - } - name += slen; - } - } - while (name[0] == '/') { - ++name; - } - if (name[0] == '\0') { - continue; - } - if (ZipAddFile(interp, path, name, out, pw, buf, sizeof (buf), - &fileHash) != TCL_OK) { - goto done; - } + path = Tcl_GetString(lobjv[i]); + if (isList) { + name = Tcl_GetString(lobjv[i + 1]); + } else { + name = path; + if (slen > 0) { + len = strlen(name); + if ((len <= slen) || (strncmp(strip, name, slen) != 0)) { + continue; + } + name += slen; + } + } + while (name[0] == '/') { + ++name; + } + if (name[0] == '\0') { + continue; + } + if (ZipAddFile(interp, path, name, out, pw, buf, sizeof (buf), &fileHash) != TCL_OK) { + goto done; + } } pos[1] = Tcl_Tell(out); count = 0; @@ -2048,11 +2007,11 @@ ZipFSMkZipOrImgObjCmd(ClientData clientData, Tcl_Interp *interp, } else { name = path; if (slen > 0) { - len = strlen(name); - if ((len <= slen) || (strncmp(strip, name, slen) != 0)) { - continue; - } - name += slen; + len = strlen(name); + if ((len <= slen) || (strncmp(strip, name, slen) != 0)) { + continue; + } + name += slen; } } while (name[0] == '/') { @@ -2084,9 +2043,10 @@ ZipFSMkZipOrImgObjCmd(ClientData clientData, Tcl_Interp *interp, zip_write_short(buf + ZIP_CENTRAL_IATTR_OFFS, 0); zip_write_int(buf + ZIP_CENTRAL_EATTR_OFFS, 0); zip_write_int(buf + ZIP_CENTRAL_LOCALHDR_OFFS, z->offset - pos[0]); - if ((Tcl_Write(out, buf, ZIP_CENTRAL_HEADER_LEN) != - ZIP_CENTRAL_HEADER_LEN) || - (Tcl_Write(out, z->name, len) != len)) { + if ( + (Tcl_Write(out, buf, ZIP_CENTRAL_HEADER_LEN) != ZIP_CENTRAL_HEADER_LEN) + || (Tcl_Write(out, z->name, len) != len) + ) { Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); goto done; } @@ -2103,24 +2063,24 @@ ZipFSMkZipOrImgObjCmd(ClientData clientData, Tcl_Interp *interp, zip_write_int(buf + ZIP_CENTRAL_DIRSTART_OFFS, pos[1] - pos[0]); zip_write_short(buf + ZIP_CENTRAL_COMMENTLEN_OFFS, 0); if (Tcl_Write(out, buf, ZIP_CENTRAL_END_LEN) != ZIP_CENTRAL_END_LEN) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); - goto done; + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); + goto done; } Tcl_Flush(out); ret = TCL_OK; done: if (ret == TCL_OK) { - ret = Tcl_Close(interp, out); + ret = Tcl_Close(interp, out); } else { - Tcl_Close(interp, out); + Tcl_Close(interp, out); } Tcl_DecrRefCount(list); hPtr = Tcl_FirstHashEntry(&fileHash, &search); while (hPtr != NULL) { - z = (ZipEntry *) Tcl_GetHashValue(hPtr); - Tcl_Free((char *) z); - Tcl_DeleteHashEntry(hPtr); - hPtr = Tcl_FirstHashEntry(&fileHash, &search); + z = (ZipEntry *) Tcl_GetHashValue(hPtr); + Tcl_Free((char *) z); + Tcl_DeleteHashEntry(hPtr); + hPtr = Tcl_FirstHashEntry(&fileHash, &search); } Tcl_DeleteHashTable(&fileHash); return ret; @@ -2144,16 +2104,16 @@ done: */ static int -ZipFSMkZipObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ +ZipFSMkZipObjCmd( + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[] +) { return ZipFSMkZipOrImgObjCmd(clientData, interp, 0, 0, objc, objv); } static int -ZipFSLMkZipObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ +ZipFSLMkZipObjCmd( + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[] +) { return ZipFSMkZipOrImgObjCmd(clientData, interp, 0, 1, objc, objv); } @@ -2207,34 +2167,34 @@ ZipFSLMkImgObjCmd(ClientData clientData, Tcl_Interp *interp, */ static int -ZipFSCanonicalObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ +ZipFSCanonicalObjCmd( + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[] +) { char *mntpoint=NULL; char *filename=NULL; char *result; Tcl_DString dPath; if (objc != 2 && objc != 3 && objc!=4) { - Tcl_WrongNumArgs(interp, 1, objv, "?mntpnt? filename ?ZIPFS?"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, "?mntpnt? filename ?ZIPFS?"); + return TCL_ERROR; } Tcl_DStringInit(&dPath); if(objc==2) { - filename = Tcl_GetString(objv[1]); - result=CanonicalPath("",filename,&dPath,1); + filename = Tcl_GetString(objv[1]); + result=CanonicalPath("",filename,&dPath,1); } else if (objc==3) { - mntpoint = Tcl_GetString(objv[1]); - filename = Tcl_GetString(objv[2]); - result=CanonicalPath(mntpoint,filename,&dPath,1); + mntpoint = Tcl_GetString(objv[1]); + filename = Tcl_GetString(objv[2]); + result=CanonicalPath(mntpoint,filename,&dPath,1); } else { - int zipfs=0; - if(Tcl_GetBooleanFromObj(interp,objv[3],&zipfs)) { - return TCL_ERROR; - } - mntpoint = Tcl_GetString(objv[1]); - filename = Tcl_GetString(objv[2]); - result=CanonicalPath(mntpoint,filename,&dPath,zipfs); + int zipfs=0; + if(Tcl_GetBooleanFromObj(interp,objv[3],&zipfs)) { + return TCL_ERROR; + } + mntpoint = Tcl_GetString(objv[1]); + filename = Tcl_GetString(objv[2]); + result=CanonicalPath(mntpoint,filename,&dPath,zipfs); } Tcl_SetObjResult(interp,Tcl_NewStringObj(result,-1)); return TCL_OK; @@ -2259,9 +2219,9 @@ ZipFSCanonicalObjCmd(ClientData clientData, Tcl_Interp *interp, */ static int -ZipFSExistsObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ +ZipFSExistsObjCmd( + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[] +) { char *filename; int exists; Tcl_DString ds; @@ -2306,27 +2266,27 @@ ZipFSExistsObjCmd(ClientData clientData, Tcl_Interp *interp, */ static int -ZipFSInfoObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ +ZipFSInfoObjCmd( + ClientData clientData, Tcl_Interp *interp,int objc, Tcl_Obj *const objv[] +) { char *filename; ZipEntry *z; if (objc != 2) { - Tcl_WrongNumArgs(interp, 1, objv, "filename"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, "filename"); + return TCL_ERROR; } filename = Tcl_GetStringFromObj(objv[1], 0); ReadLock(); z = ZipFSLookup(filename); if (z != NULL) { - Tcl_Obj *result = Tcl_GetObjResult(interp); + Tcl_Obj *result = Tcl_GetObjResult(interp); - Tcl_ListObjAppendElement(interp, result, - Tcl_NewStringObj(z->zipfile->name, -1)); - Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->nbyte)); - Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->nbytecompr)); - Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->offset)); + Tcl_ListObjAppendElement(interp, result, + Tcl_NewStringObj(z->zipfile->name, -1)); + Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->nbyte)); + Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->nbytecompr)); + Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(z->offset)); } Unlock(); return TCL_OK; @@ -2351,9 +2311,9 @@ ZipFSInfoObjCmd(ClientData clientData, Tcl_Interp *interp, */ static int -ZipFSListObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) -{ +ZipFSListObjCmd( + ClientData clientData, Tcl_Interp *interp,int objc, Tcl_Obj *const objv[] +) { char *pattern = NULL; Tcl_RegExp regexp = NULL; Tcl_HashEntry *hPtr; @@ -2361,57 +2321,61 @@ ZipFSListObjCmd(ClientData clientData, Tcl_Interp *interp, Tcl_Obj *result = Tcl_GetObjResult(interp); if (objc > 3) { - Tcl_WrongNumArgs(interp, 1, objv, "?(-glob|-regexp)? ?pattern?"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, "?(-glob|-regexp)? ?pattern?"); + return TCL_ERROR; } if (objc == 3) { - int n; - char *what = Tcl_GetStringFromObj(objv[1], &n); - - if ((n >= 2) && (strncmp(what, "-glob", n) == 0)) { - pattern = Tcl_GetString(objv[2]); - } else if ((n >= 2) && (strncmp(what, "-regexp", n) == 0)) { - regexp = Tcl_RegExpCompile(interp, Tcl_GetString(objv[2])); - if (regexp == NULL) { - return TCL_ERROR; - } - } else { - Tcl_AppendResult(interp, "unknown option \"", what, - "\"", (char *) NULL); - return TCL_ERROR; - } + int n; + char *what = Tcl_GetStringFromObj(objv[1], &n); + + if ((n >= 2) && (strncmp(what, "-glob", n) == 0)) { + pattern = Tcl_GetString(objv[2]); + } else if ((n >= 2) && (strncmp(what, "-regexp", n) == 0)) { + regexp = Tcl_RegExpCompile(interp, Tcl_GetString(objv[2])); + if (regexp == NULL) { + return TCL_ERROR; + } + } else { + Tcl_AppendResult(interp, "unknown option \"", what,"\"", (char *) NULL); + return TCL_ERROR; + } } else if (objc == 2) { - pattern = Tcl_GetStringFromObj(objv[1], 0); + pattern = Tcl_GetStringFromObj(objv[1], 0); } ReadLock(); if (pattern != NULL) { - for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); - hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); - - if (Tcl_StringMatch(z->name, pattern)) { - Tcl_ListObjAppendElement(interp, result, - Tcl_NewStringObj(z->name, -1)); - } - } + for ( + hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; + hPtr = Tcl_NextHashEntry(&search) + ) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + + if (Tcl_StringMatch(z->name, pattern)) { + Tcl_ListObjAppendElement(interp, result,Tcl_NewStringObj(z->name, -1)); + } + } } else if (regexp != NULL) { - for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); - hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); - - if (Tcl_RegExpExec(interp, regexp, z->name, z->name)) { - Tcl_ListObjAppendElement(interp, result, - Tcl_NewStringObj(z->name, -1)); - } - } + for ( + hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; + hPtr = Tcl_NextHashEntry(&search) + ) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + if (Tcl_RegExpExec(interp, regexp, z->name, z->name)) { + Tcl_ListObjAppendElement(interp, result,Tcl_NewStringObj(z->name, -1)); + } + } } else { - for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); - hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); - - Tcl_ListObjAppendElement(interp, result, - Tcl_NewStringObj(z->name, -1)); - } + for ( + hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; + hPtr = Tcl_NextHashEntry(&search) + ) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + + Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(z->name, -1)); + } } Unlock(); return TCL_OK; @@ -2438,6 +2402,7 @@ ZipFSTclLibraryObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *pResult; + pResult=TclZipfs_TclLibrary(); if(!pResult) { pResult=Tcl_NewObj(); @@ -2468,34 +2433,33 @@ ZipChannelClose(ClientData instanceData, Tcl_Interp *interp) ZipChannel *info = (ZipChannel *) instanceData; if (info->iscompr && (info->ubuf != NULL)) { - Tcl_Free((char *) info->ubuf); - info->ubuf = NULL; + Tcl_Free((char *) info->ubuf); + info->ubuf = NULL; } if (info->isenc) { - info->isenc = 0; - memset(info->keys, 0, sizeof (info->keys)); + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); } if (info->iswr) { - ZipEntry *z = info->zipentry; - unsigned char *newdata; - - newdata = (unsigned char *) - Tcl_AttemptRealloc((char *) info->ubuf, info->nread); - if (newdata != NULL) { - if (z->data != NULL) { - Tcl_Free((char *) z->data); - } - z->data = newdata; - z->nbyte = z->nbytecompr = info->nbyte; - z->cmeth = ZIP_COMPMETH_STORED; - z->timestamp = time(NULL); - z->isdir = 0; - z->isenc = 0; - z->offset = 0; - z->crc32 = 0; - } else { - Tcl_Free((char *) info->ubuf); - } + ZipEntry *z = info->zipentry; + unsigned char *newdata; + + newdata = (unsigned char *) Tcl_AttemptRealloc((char *) info->ubuf, info->nread); + if (newdata != NULL) { + if (z->data != NULL) { + Tcl_Free((char *) z->data); + } + z->data = newdata; + z->nbyte = z->nbytecompr = info->nbyte; + z->cmeth = ZIP_COMPMETH_STORED; + z->timestamp = time(NULL); + z->isdir = 0; + z->isenc = 0; + z->offset = 0; + z->crc32 = 0; + } else { + Tcl_Free((char *) info->ubuf); + } } WriteLock(); info->zipfile->nopen--; @@ -2527,26 +2491,26 @@ ZipChannelRead(ClientData instanceData, char *buf, int toRead, int *errloc) unsigned long nextpos; if (info->isdir) { - *errloc = EISDIR; - return -1; + *errloc = EISDIR; + return -1; } nextpos = info->nread + toRead; if (nextpos > info->nbyte) { - toRead = info->nbyte - info->nread; - nextpos = info->nbyte; + toRead = info->nbyte - info->nread; + nextpos = info->nbyte; } if (toRead == 0) { - return 0; + return 0; } if (info->isenc) { - int i, ch; + int i, ch; - for (i = 0; i < toRead; i++) { - ch = info->ubuf[i + info->nread]; - buf[i] = zdecode(info->keys, crc32tab, ch); - } + for (i = 0; i < toRead; i++) { + ch = info->ubuf[i + info->nread]; + buf[i] = zdecode(info->keys, crc32tab, ch); + } } else { - memcpy(buf, info->ubuf + info->nread, toRead); + memcpy(buf, info->ubuf + info->nread, toRead); } info->nread = nextpos; *errloc = 0; @@ -2577,21 +2541,21 @@ ZipChannelWrite(ClientData instanceData, const char *buf, unsigned long nextpos; if (!info->iswr) { - *errloc = EINVAL; - return -1; + *errloc = EINVAL; + return -1; } nextpos = info->nread + toWrite; if (nextpos > info->nmax) { - toWrite = info->nmax - info->nread; - nextpos = info->nmax; + toWrite = info->nmax - info->nread; + nextpos = info->nmax; } if (toWrite == 0) { - return 0; + return 0; } memcpy(info->ubuf + info->nread, buf, toWrite); info->nread = nextpos; if (info->nread > info->nbyte) { - info->nbyte = info->nread; + info->nbyte = info->nread; } *errloc = 0; return toWrite; @@ -2619,37 +2583,37 @@ ZipChannelSeek(ClientData instanceData, long offset, int mode, int *errloc) ZipChannel *info = (ZipChannel *) instanceData; if (info->isdir) { - *errloc = EINVAL; - return -1; + *errloc = EINVAL; + return -1; } switch (mode) { - case SEEK_CUR: - offset += info->nread; - break; - case SEEK_END: - offset += info->nbyte; - break; - case SEEK_SET: - break; - default: - *errloc = EINVAL; - return -1; + case SEEK_CUR: + offset += info->nread; + break; + case SEEK_END: + offset += info->nbyte; + break; + case SEEK_SET: + break; + default: + *errloc = EINVAL; + return -1; } if (offset < 0) { - *errloc = EINVAL; - return -1; - } - if (info->iswr) { - if ((unsigned long) offset > info->nmax) { *errloc = EINVAL; return -1; - } - if ((unsigned long) offset > info->nbyte) { - info->nbyte = offset; - } + } + if (info->iswr) { + if ((unsigned long) offset > info->nmax) { + *errloc = EINVAL; + return -1; + } + if ((unsigned long) offset > info->nbyte) { + info->nbyte = offset; + } } else if ((unsigned long) offset > info->nbyte) { - *errloc = EINVAL; - return -1; + *errloc = EINVAL; + return -1; } info->nread = (unsigned long) offset; return info->nread; @@ -2695,9 +2659,9 @@ ZipChannelWatchChannel(ClientData instanceData, int mask) */ static int -ZipChannelGetFile(ClientData instanceData, int direction, - ClientData *handlePtr) -{ +ZipChannelGetFile( + ClientData instanceData, int direction,ClientData *handlePtr +) { return TCL_ERROR; } @@ -2761,295 +2725,268 @@ ZipChannelOpen(Tcl_Interp *interp, char *filename, int mode, int permissions) int i, ch, trunc, wr, flags = 0; char cname[128]; - if ((mode & O_APPEND) || - ((ZipFS.wrmax <= 0) && (mode & (O_WRONLY | O_RDWR)))) { - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported open mode", -1)); - } - return NULL; + if ( + (mode & O_APPEND) + || ((ZipFS.wrmax <= 0) && (mode & (O_WRONLY | O_RDWR))) + ) { + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported open mode", -1)); + } + return NULL; } WriteLock(); z = ZipFSLookup(filename); if (z == NULL) { - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("file not found", -1)); - Tcl_AppendResult(interp, " \"", filename, "\"", NULL); - } - goto error; + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("file not found", -1)); + Tcl_AppendResult(interp, " \"", filename, "\"", NULL); + } + goto error; } trunc = (mode & O_TRUNC) != 0; wr = (mode & (O_WRONLY | O_RDWR)) != 0; - if ((z->cmeth != ZIP_COMPMETH_STORED) && - (z->cmeth != ZIP_COMPMETH_DEFLATED)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("unsupported compression method", -1)); - } - goto error; + if ((z->cmeth != ZIP_COMPMETH_STORED) && (z->cmeth != ZIP_COMPMETH_DEFLATED)) { + ZIPFS_ERROR(interp,"unsupported compression method"); + goto error; } if (wr && z->isdir) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("unsupported file type", -1)); - } - goto error; + ZIPFS_ERROR(interp,"unsupported file type"); + goto error; } if (!trunc) { - flags |= TCL_READABLE; - if (z->isenc && (z->zipfile->pwbuf[0] == 0)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("decryption failed", -1)); - } - goto error; - } else if (wr && (z->data == NULL) && (z->nbyte > ZipFS.wrmax)) { - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("file too large", -1)); - } - goto error; - } + flags |= TCL_READABLE; + if (z->isenc && (z->zipfile->pwbuf[0] == 0)) { + ZIPFS_ERROR(interp,"decryption failed"); + goto error; + } else if (wr && (z->data == NULL) && (z->nbyte > ZipFS.wrmax)) { + ZIPFS_ERROR(interp,"file too large"); + goto error; + } } else { - flags = TCL_WRITABLE; + flags = TCL_WRITABLE; } info = (ZipChannel *) Tcl_AttemptAlloc(sizeof (*info)); if (info == NULL) { - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("out of memory", -1)); - } - goto error; + ZIPFS_ERROR(interp,"out of memory"); + goto error; } info->zipfile = z->zipfile; info->zipentry = z; info->nread = 0; if (wr) { - flags |= TCL_WRITABLE; - info->iswr = 1; - info->isdir = 0; - info->nmax = ZipFS.wrmax; - info->iscompr = 0; - info->isenc = 0; - info->ubuf = (unsigned char *) Tcl_AttemptAlloc(info->nmax); - if (info->ubuf == NULL) { + flags |= TCL_WRITABLE; + info->iswr = 1; + info->isdir = 0; + info->nmax = ZipFS.wrmax; + info->iscompr = 0; + info->isenc = 0; + info->ubuf = (unsigned char *) Tcl_AttemptAlloc(info->nmax); + if (info->ubuf == NULL) { merror0: - if (info->ubuf != NULL) { - Tcl_Free((char *) info->ubuf); - } - Tcl_Free((char *) info); - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("out of memory", -1)); - } - goto error; - } - memset(info->ubuf, 0, info->nmax); - if (trunc) { - info->nbyte = 0; - } else { - if (z->data != NULL) { - unsigned int j = z->nbyte; + if (info->ubuf != NULL) { + Tcl_Free((char *) info->ubuf); + } + Tcl_Free((char *) info); + ZIPFS_ERROR(interp,"out of memory"); + goto error; + } + memset(info->ubuf, 0, info->nmax); + if (trunc) { + info->nbyte = 0; + } else { + if (z->data != NULL) { + unsigned int j = z->nbyte; - if (j > info->nmax) { - j = info->nmax; - } - memcpy(info->ubuf, z->data, j); - info->nbyte = j; - } else { - unsigned char *zbuf = z->zipfile->data + z->offset; - - if (z->isenc) { - int len = z->zipfile->pwbuf[0]; - char pwbuf[260]; - - for (i = 0; i < len; i++) { - ch = z->zipfile->pwbuf[len - i]; - pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; - } - pwbuf[i] = '\0'; - init_keys(pwbuf, info->keys, crc32tab); - memset(pwbuf, 0, sizeof (pwbuf)); - for (i = 0; i < 12; i++) { - ch = info->ubuf[i]; - zdecode(info->keys, crc32tab, ch); - } - zbuf += i; - } - if (z->cmeth == ZIP_COMPMETH_DEFLATED) { - z_stream stream; - int err; - unsigned char *cbuf = NULL; - - memset(&stream, 0, sizeof (stream)); - stream.zalloc = Z_NULL; - stream.zfree = Z_NULL; - stream.opaque = Z_NULL; - stream.avail_in = z->nbytecompr; - if (z->isenc) { - unsigned int j; - - stream.avail_in -= 12; - cbuf = (unsigned char *) - Tcl_AttemptAlloc(stream.avail_in); - if (cbuf == NULL) { - goto merror0; - } - for (j = 0; j < stream.avail_in; j++) { - ch = info->ubuf[j]; - cbuf[j] = zdecode(info->keys, crc32tab, ch); - } - stream.next_in = cbuf; - } else { - stream.next_in = zbuf; - } - stream.next_out = info->ubuf; - stream.avail_out = info->nmax; - if (inflateInit2(&stream, -15) != Z_OK) { - goto cerror0; - } - err = inflate(&stream, Z_SYNC_FLUSH); - inflateEnd(&stream); - if ((err == Z_STREAM_END) || - ((err == Z_OK) && (stream.avail_in == 0))) { - if (cbuf != NULL) { - memset(info->keys, 0, sizeof (info->keys)); - Tcl_Free((char *) cbuf); - } - goto wrapchan; - } + if (j > info->nmax) { + j = info->nmax; + } + memcpy(info->ubuf, z->data, j); + info->nbyte = j; + } else { + unsigned char *zbuf = z->zipfile->data + z->offset; + + if (z->isenc) { + int len = z->zipfile->pwbuf[0]; + char pwbuf[260]; + + for (i = 0; i < len; i++) { + ch = z->zipfile->pwbuf[len - i]; + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + } + pwbuf[i] = '\0'; + init_keys(pwbuf, info->keys, crc32tab); + memset(pwbuf, 0, sizeof (pwbuf)); + for (i = 0; i < 12; i++) { + ch = info->ubuf[i]; + zdecode(info->keys, crc32tab, ch); + } + zbuf += i; + } + if (z->cmeth == ZIP_COMPMETH_DEFLATED) { + z_stream stream; + int err; + unsigned char *cbuf = NULL; + + memset(&stream, 0, sizeof (stream)); + stream.zalloc = Z_NULL; + stream.zfree = Z_NULL; + stream.opaque = Z_NULL; + stream.avail_in = z->nbytecompr; + if (z->isenc) { + unsigned int j; + + stream.avail_in -= 12; + cbuf = (unsigned char *) + Tcl_AttemptAlloc(stream.avail_in); + if (cbuf == NULL) { + goto merror0; + } + for (j = 0; j < stream.avail_in; j++) { + ch = info->ubuf[j]; + cbuf[j] = zdecode(info->keys, crc32tab, ch); + } + stream.next_in = cbuf; + } else { + stream.next_in = zbuf; + } + stream.next_out = info->ubuf; + stream.avail_out = info->nmax; + if (inflateInit2(&stream, -15) != Z_OK) goto cerror0; + err = inflate(&stream, Z_SYNC_FLUSH); + inflateEnd(&stream); + if ((err == Z_STREAM_END) || ((err == Z_OK) && (stream.avail_in == 0))) { + if (cbuf != NULL) { + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) cbuf); + } + goto wrapchan; + } cerror0: - if (cbuf != NULL) { - memset(info->keys, 0, sizeof (info->keys)); - Tcl_Free((char *) cbuf); - } - if (info->ubuf != NULL) { - Tcl_Free((char *) info->ubuf); - } - Tcl_Free((char *) info); - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("decompression error", -1)); - } - goto error; - } else if (z->isenc) { - for (i = 0; i < z->nbyte - 12; i++) { - ch = zbuf[i]; - info->ubuf[i] = zdecode(info->keys, crc32tab, ch); - } - } else { - memcpy(info->ubuf, zbuf, z->nbyte); - } - memset(info->keys, 0, sizeof (info->keys)); - goto wrapchan; - } - } + if (cbuf != NULL) { + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) cbuf); + } + if (info->ubuf != NULL) { + Tcl_Free((char *) info->ubuf); + } + Tcl_Free((char *) info); + ZIPFS_ERROR(interp,"decompression error"); + goto error; + } else if (z->isenc) { + for (i = 0; i < z->nbyte - 12; i++) { + ch = zbuf[i]; + info->ubuf[i] = zdecode(info->keys, crc32tab, ch); + } + } else { + memcpy(info->ubuf, zbuf, z->nbyte); + } + memset(info->keys, 0, sizeof (info->keys)); + goto wrapchan; + } + } } else if (z->data != NULL) { - flags |= TCL_READABLE; - info->iswr = 0; - info->iscompr = 0; - info->isdir = 0; - info->isenc = 0; - info->nbyte = z->nbyte; - info->nmax = 0; - info->ubuf = z->data; + flags |= TCL_READABLE; + info->iswr = 0; + info->iscompr = 0; + info->isdir = 0; + info->isenc = 0; + info->nbyte = z->nbyte; + info->nmax = 0; + info->ubuf = z->data; } else { - flags |= TCL_READABLE; - info->iswr = 0; - info->iscompr = z->cmeth == ZIP_COMPMETH_DEFLATED; - info->ubuf = z->zipfile->data + z->offset; - info->isdir = z->isdir; - info->isenc = z->isenc; - info->nbyte = z->nbyte; - info->nmax = 0; - if (info->isenc) { - int len = z->zipfile->pwbuf[0]; - char pwbuf[260]; - - for (i = 0; i < len; i++) { - ch = z->zipfile->pwbuf[len - i]; - pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; - } - pwbuf[i] = '\0'; - init_keys(pwbuf, info->keys, crc32tab); - memset(pwbuf, 0, sizeof (pwbuf)); - for (i = 0; i < 12; i++) { - ch = info->ubuf[i]; - zdecode(info->keys, crc32tab, ch); - } - info->ubuf += i; - } - if (info->iscompr) { - z_stream stream; - int err; - unsigned char *ubuf = NULL; - unsigned int j; - - memset(&stream, 0, sizeof (stream)); - stream.zalloc = Z_NULL; - stream.zfree = Z_NULL; - stream.opaque = Z_NULL; - stream.avail_in = z->nbytecompr; - if (info->isenc) { - stream.avail_in -= 12; - ubuf = (unsigned char *) Tcl_AttemptAlloc(stream.avail_in); - if (ubuf == NULL) { - info->ubuf = NULL; - goto merror; - } - for (j = 0; j < stream.avail_in; j++) { - ch = info->ubuf[j]; - ubuf[j] = zdecode(info->keys, crc32tab, ch); - } - stream.next_in = ubuf; - } else { - stream.next_in = info->ubuf; - } - stream.next_out = info->ubuf = - (unsigned char *) Tcl_AttemptAlloc(info->nbyte); - if (info->ubuf == NULL) { + flags |= TCL_READABLE; + info->iswr = 0; + info->iscompr = z->cmeth == ZIP_COMPMETH_DEFLATED; + info->ubuf = z->zipfile->data + z->offset; + info->isdir = z->isdir; + info->isenc = z->isenc; + info->nbyte = z->nbyte; + info->nmax = 0; + if (info->isenc) { + int len = z->zipfile->pwbuf[0]; + char pwbuf[260]; + + for (i = 0; i < len; i++) { + ch = z->zipfile->pwbuf[len - i]; + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + } + pwbuf[i] = '\0'; + init_keys(pwbuf, info->keys, crc32tab); + memset(pwbuf, 0, sizeof (pwbuf)); + for (i = 0; i < 12; i++) { + ch = info->ubuf[i]; + zdecode(info->keys, crc32tab, ch); + } + info->ubuf += i; + } + if (info->iscompr) { + z_stream stream; + int err; + unsigned char *ubuf = NULL; + unsigned int j; + + memset(&stream, 0, sizeof (stream)); + stream.zalloc = Z_NULL; + stream.zfree = Z_NULL; + stream.opaque = Z_NULL; + stream.avail_in = z->nbytecompr; + if (info->isenc) { + stream.avail_in -= 12; + ubuf = (unsigned char *) Tcl_AttemptAlloc(stream.avail_in); + if (ubuf == NULL) { + info->ubuf = NULL; + goto merror; + } + for (j = 0; j < stream.avail_in; j++) { + ch = info->ubuf[j]; + ubuf[j] = zdecode(info->keys, crc32tab, ch); + } + stream.next_in = ubuf; + } else { + stream.next_in = info->ubuf; + } + stream.next_out = info->ubuf = (unsigned char *) Tcl_AttemptAlloc(info->nbyte); + if (info->ubuf == NULL) { merror: - if (ubuf != NULL) { - info->isenc = 0; - memset(info->keys, 0, sizeof (info->keys)); - Tcl_Free((char *) ubuf); - } - Tcl_Free((char *) info); - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("out of memory", -1)); - } - goto error; - } - stream.avail_out = info->nbyte; - if (inflateInit2(&stream, -15) != Z_OK) { - goto cerror; - } - err = inflate(&stream, Z_SYNC_FLUSH); - inflateEnd(&stream); - if ((err == Z_STREAM_END) || - ((err == Z_OK) && (stream.avail_in == 0))) { - if (ubuf != NULL) { - info->isenc = 0; - memset(info->keys, 0, sizeof (info->keys)); - Tcl_Free((char *) ubuf); - } - goto wrapchan; - } + if (ubuf != NULL) { + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) ubuf); + } + Tcl_Free((char *) info); + if (interp != NULL) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("out of memory", -1)); + } + goto error; + } + stream.avail_out = info->nbyte; + if (inflateInit2(&stream, -15) != Z_OK) { + goto cerror; + } + err = inflate(&stream, Z_SYNC_FLUSH); + inflateEnd(&stream); + if ((err == Z_STREAM_END) || ((err == Z_OK) && (stream.avail_in == 0))) { + if (ubuf != NULL) { + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) ubuf); + } + goto wrapchan; + } cerror: - if (ubuf != NULL) { - info->isenc = 0; - memset(info->keys, 0, sizeof (info->keys)); - Tcl_Free((char *) ubuf); - } - if (info->ubuf != NULL) { - Tcl_Free((char *) info->ubuf); - } - Tcl_Free((char *) info); - if (interp != NULL) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("decompression error", -1)); - } - goto error; - } + if (ubuf != NULL) { + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); + Tcl_Free((char *) ubuf); + } + if (info->ubuf != NULL) { + Tcl_Free((char *) info->ubuf); + } + Tcl_Free((char *) info); + ZIPFS_ERROR(interp,"decompression error"); + goto error; + } } wrapchan: sprintf(cname, "zipfs_%lx_%d", (unsigned long) z->offset, ZipFS.idCount++); @@ -3087,14 +3024,13 @@ ZipEntryStat(char *path, Tcl_StatBuf *buf) ReadLock(); z = ZipFSLookup(path); - if (z == NULL) { - goto done; - } + if (z == NULL) goto done; + memset(buf, 0, sizeof (Tcl_StatBuf)); if (z->isdir) { - buf->st_mode = S_IFDIR | 0555; + buf->st_mode = S_IFDIR | 0555; } else { - buf->st_mode = S_IFREG | 0555; + buf->st_mode = S_IFREG | 0555; } buf->st_size = z->nbyte; buf->st_mtime = z->timestamp; @@ -3128,9 +3064,7 @@ ZipEntryAccess(char *path, int mode) { ZipEntry *z; - if (mode & 3) { - return -1; - } + if (mode & 3) return -1; ReadLock(); z = ZipFSLookup(path); Unlock(); @@ -3154,11 +3088,8 @@ Zip_FSOpenFileChannelProc(Tcl_Interp *interp, Tcl_Obj *pathPtr, int mode, int permissions) { int len; - if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return NULL; - - return ZipChannelOpen(interp, Tcl_GetStringFromObj(pathPtr, &len), - mode, permissions); + return ZipChannelOpen(interp, Tcl_GetStringFromObj(pathPtr, &len), mode, permissions); } /* @@ -3182,9 +3113,7 @@ static int Zip_FSStatProc(Tcl_Obj *pathPtr, Tcl_StatBuf *buf) { int len; - if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; - return ZipEntryStat(Tcl_GetStringFromObj(pathPtr, &len), buf); } @@ -3209,9 +3138,7 @@ static int Zip_FSAccessProc(Tcl_Obj *pathPtr, int mode) { int len; - if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; - return ZipEntryAccess(Tcl_GetStringFromObj(pathPtr, &len), mode); } @@ -3273,7 +3200,7 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, if (!(normPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; if (types != NULL) { - dirOnly = (types->type & TCL_GLOB_TYPE_DIR) == TCL_GLOB_TYPE_DIR; + dirOnly = (types->type & TCL_GLOB_TYPE_DIR) == TCL_GLOB_TYPE_DIR; } /* the prefix that gets prepended to results */ @@ -3286,14 +3213,14 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, Tcl_DStringAppend(&dsPref, prefix, prefixLen); if (strcmp(prefix, path) == 0) { - prefix = NULL; + prefix = NULL; } else { - strip = len + 1; + strip = len + 1; } if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, "/", 1); - prefixLen++; - prefix = Tcl_DStringValue(&dsPref); + Tcl_DStringAppend(&dsPref, "/", 1); + prefixLen++; + prefix = Tcl_DStringValue(&dsPref); } ReadLock(); if ((types != NULL) && (types->type == TCL_GLOB_TYPE_MOUNT)) { @@ -3311,42 +3238,47 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, ZipFile *zf = (ZipFile *) Tcl_GetHashValue(hPtr); if (zf->mntptlen == 0) { - ZipEntry *z = zf->topents; - while (z != NULL) { - int lenz = strlen(z->name); - if ((lenz > len + 1) && - (strncmp(z->name, path, len) == 0) && - (z->name[len] == '/') && - (CountSlashes(z->name) == l) && - Tcl_StringCaseMatch(z->name + len + 1, pattern, 0)) { - if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, z->name, lenz); - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(Tcl_DStringValue(&dsPref), - Tcl_DStringLength(&dsPref))); - Tcl_DStringSetLength(&dsPref, prefixLen); - } else { - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(z->name, lenz)); - } - } - z = z->tnext; - } - } else if ((zf->mntptlen > len + 1) && - (strncmp(zf->mntpt, path, len) == 0) && - (zf->mntpt[len] == '/') && - (CountSlashes(zf->mntpt) == l) && - Tcl_StringCaseMatch(zf->mntpt + len + 1, pattern, 0)) { - if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, zf->mntpt, zf->mntptlen); - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(Tcl_DStringValue(&dsPref), - Tcl_DStringLength(&dsPref))); - Tcl_DStringSetLength(&dsPref, prefixLen); - } else { - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); - } + ZipEntry *z = zf->topents; + while (z != NULL) { + int lenz = strlen(z->name); + if ( + (lenz > len + 1) + && (strncmp(z->name, path, len) == 0) + && (z->name[len] == '/') + && (CountSlashes(z->name) == l) + && Tcl_StringCaseMatch(z->name + len + 1, pattern, 0) + ) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, z->name, lenz); + Tcl_ListObjAppendElement( + NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref)) + ); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(z->name, lenz)); + } + } + z = z->tnext; + } + } else if ( + (zf->mntptlen > len + 1) + && (strncmp(zf->mntpt, path, len) == 0) + && (zf->mntpt[len] == '/') + && (CountSlashes(zf->mntpt) == l) + && Tcl_StringCaseMatch(zf->mntpt + len + 1, pattern, 0) + ) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, zf->mntpt, zf->mntptlen); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); + } } hPtr = Tcl_NextHashEntry(&search); } @@ -3378,33 +3310,38 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, pat = Tcl_Alloc(len + l + 2); memcpy(pat, path, len); while ((len > 1) && (pat[len - 1] == '/')) { - --len; + --len; } if ((len > 1) || (pat[0] != '/')) { - pat[len] = '/'; - ++len; + pat[len] = '/'; + ++len; } memcpy(pat + len, pattern, l + 1); scnt = CountSlashes(pat); - for (hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); - hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); - if ((dirOnly >= 0) && - ((dirOnly && !z->isdir) || (!dirOnly && z->isdir))) { - continue; - } - if ((z->depth == scnt) && Tcl_StringCaseMatch(z->name, pat, 0)) { - if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, z->name + strip, -1); - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(Tcl_DStringValue(&dsPref), - Tcl_DStringLength(&dsPref))); - Tcl_DStringSetLength(&dsPref, prefixLen); - } else { - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(z->name + strip, -1)); - } - } + for ( + hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); + hPtr != NULL; + hPtr = Tcl_NextHashEntry(&search) + ) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + if ( + (dirOnly >= 0) && ((dirOnly && !z->isdir) || (!dirOnly && z->isdir)) + ) { + continue; + } + if ((z->depth == scnt) && Tcl_StringCaseMatch(z->name, pat, 0)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, z->name + strip, -1); + Tcl_ListObjAppendElement( + NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref)) + ); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(z->name + strip, -1)); + } + } } Tcl_Free(pat); end: @@ -3443,7 +3380,7 @@ Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr) path = Tcl_GetStringFromObj(pathPtr, &len); if(strncmp(path,ZIPFS_VOLUME,ZIPFS_VOLUME_LEN)!=0) { - return -1; + return -1; } len = strlen(path); @@ -3451,30 +3388,31 @@ Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr) ReadLock(); hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path); if (hPtr != NULL) { - ret = TCL_OK; - goto endloop; + ret = TCL_OK; + goto endloop; } hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); while (hPtr != NULL) { - zf = (ZipFile *) Tcl_GetHashValue(hPtr); - if (zf->mntptlen == 0) { - ZipEntry *z = zf->topents; - while (z != NULL) { - int lenz = strlen(z->name); - - if ((len >= lenz) && - (strncmp(path, z->name, lenz) == 0)) { + zf = (ZipFile *) Tcl_GetHashValue(hPtr); + if (zf->mntptlen == 0) { + ZipEntry *z = zf->topents; + while (z != NULL) { + int lenz = strlen(z->name); + if ( + (len >= lenz) && (strncmp(path, z->name, lenz) == 0) + ) { + ret = TCL_OK; + goto endloop; + } + z = z->tnext; + } + } else if ( + (len >= zf->mntptlen) && (strncmp(path, zf->mntpt, zf->mntptlen) == 0) + ) { ret = TCL_OK; goto endloop; - } - z = z->tnext; } - } else if ((len >= zf->mntptlen) && - (strncmp(path, zf->mntpt, zf->mntptlen) == 0)) { - ret = TCL_OK; - goto endloop; - } - hPtr = Tcl_NextHashEntry(&search); + hPtr = Tcl_NextHashEntry(&search); } endloop: Unlock(); @@ -3530,7 +3468,6 @@ Zip_FSFileAttrStringsProc(Tcl_Obj *pathPtr, Tcl_Obj** objPtrRef) "-permissions", NULL, }; - return attrs; } @@ -3563,40 +3500,35 @@ Zip_FSFileAttrsGetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, ZipEntry *z; if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; - path = Tcl_GetStringFromObj(pathPtr, &len); ReadLock(); z = ZipFSLookup(path); if (z == NULL) { - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("file not found", -1)); - } - ret = TCL_ERROR; - goto done; + ZIPFS_ERROR(interp,"file not found"); + ret = TCL_ERROR; + goto done; } switch (index) { - case 0: - *objPtrRef = Tcl_NewIntObj(z->nbyte); - goto done; - case 1: - *objPtrRef= Tcl_NewIntObj(z->nbytecompr); - goto done; - case 2: - *objPtrRef= Tcl_NewLongObj(z->offset); - goto done; - case 3: - *objPtrRef= Tcl_NewStringObj(z->zipfile->mntpt, -1); - goto done; - case 4: - *objPtrRef= Tcl_NewStringObj(z->zipfile->name, -1); - goto done; - case 5: - *objPtrRef= Tcl_NewStringObj("0555", -1); - goto done; - } - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("unknown attribute", -1)); - } + case 0: + *objPtrRef = Tcl_NewIntObj(z->nbyte); + goto done; + case 1: + *objPtrRef= Tcl_NewIntObj(z->nbytecompr); + goto done; + case 2: + *objPtrRef= Tcl_NewLongObj(z->offset); + goto done; + case 3: + *objPtrRef= Tcl_NewStringObj(z->zipfile->mntpt, -1); + goto done; + case 4: + *objPtrRef= Tcl_NewStringObj(z->zipfile->name, -1); + goto done; + case 5: + *objPtrRef= Tcl_NewStringObj("0555", -1); + goto done; + } + ZIPFS_ERROR(interp,"unknown attribute"); ret = TCL_ERROR; done: Unlock(); @@ -3621,11 +3553,10 @@ done: */ static int -Zip_FSFileAttrsSetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, - Tcl_Obj *objPtr) +Zip_FSFileAttrsSetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr,Tcl_Obj *objPtr) { if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported operation", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported operation", -1)); } return TCL_ERROR; } @@ -3685,7 +3616,7 @@ Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; if (loadFileProc != NULL) { - return loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); + return loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); } Tcl_SetErrno(ENOENT); return -1; @@ -3694,67 +3625,66 @@ Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, int ret = -1; if (Tcl_FSAccess(path, R_OK) == 0) { - /* - * EXDEV should trigger loading by copying to temp store. - */ - Tcl_SetErrno(EXDEV); - return ret; + /* + * EXDEV should trigger loading by copying to temp store. + */ + Tcl_SetErrno(EXDEV); + return ret; } else { - Tcl_Obj *objs[2] = { NULL, NULL }; - - objs[1] = TclPathPart(interp, path, TCL_PATH_DIRNAME); - if ((objs[1] != NULL) && (Zip_FSAccessProc(objs[1], R_OK) == 0)) { - const char *execName = Tcl_GetNameOfExecutable(); - - /* - * Shared object is not in ZIP but its path prefix is, - * thus try to load from directory where the executable - * came from. - */ - TclDecrRefCount(objs[1]); - objs[1] = TclPathPart(interp, path, TCL_PATH_TAIL); - /* - * Get directory name of executable manually to deal - * with cases where [file dirname [info nameofexecutable]] - * is equal to [info nameofexecutable] due to VFS effects. - */ - if (execName != NULL) { - const char *p = strrchr(execName, '/'); - - if (p > execName + 1) { - --p; - objs[0] = Tcl_NewStringObj(execName, p - execName); - } - } - if (objs[0] == NULL) { - objs[0] = TclPathPart(interp, TclGetObjNameOfExecutable(), - TCL_PATH_DIRNAME); - } - if (objs[0] != NULL) { - altPath = TclJoinPath(2, objs); - if (altPath != NULL) { - Tcl_IncrRefCount(altPath); - if (Tcl_FSAccess(altPath, R_OK) == 0) { - path = altPath; - } - } - } - } - if (objs[0] != NULL) { - Tcl_DecrRefCount(objs[0]); - } - if (objs[1] != NULL) { - Tcl_DecrRefCount(objs[1]); - } + Tcl_Obj *objs[2] = { NULL, NULL }; + + objs[1] = TclPathPart(interp, path, TCL_PATH_DIRNAME); + if ((objs[1] != NULL) && (Zip_FSAccessProc(objs[1], R_OK) == 0)) { + const char *execName = Tcl_GetNameOfExecutable(); + + /* + * Shared object is not in ZIP but its path prefix is, + * thus try to load from directory where the executable + * came from. + */ + TclDecrRefCount(objs[1]); + objs[1] = TclPathPart(interp, path, TCL_PATH_TAIL); + /* + * Get directory name of executable manually to deal + * with cases where [file dirname [info nameofexecutable]] + * is equal to [info nameofexecutable] due to VFS effects. + */ + if (execName != NULL) { + const char *p = strrchr(execName, '/'); + + if (p > execName + 1) { + --p; + objs[0] = Tcl_NewStringObj(execName, p - execName); + } + } + if (objs[0] == NULL) { + objs[0] = TclPathPart(interp, TclGetObjNameOfExecutable(),TCL_PATH_DIRNAME); + } + if (objs[0] != NULL) { + altPath = TclJoinPath(2, objs); + if (altPath != NULL) { + Tcl_IncrRefCount(altPath); + if (Tcl_FSAccess(altPath, R_OK) == 0) { + path = altPath; + } + } + } + } + if (objs[0] != NULL) { + Tcl_DecrRefCount(objs[0]); + } + if (objs[1] != NULL) { + Tcl_DecrRefCount(objs[1]); + } } loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; if (loadFileProc != NULL) { - ret = loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); + ret = loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); } else { - Tcl_SetErrno(ENOENT); + Tcl_SetErrno(ENOENT); } if (altPath != NULL) { - Tcl_DecrRefCount(altPath); + Tcl_DecrRefCount(altPath); } return ret; #endif @@ -3864,8 +3794,8 @@ TclZipfs_Init(Tcl_Interp *interp) {NULL, NULL, NULL, NULL, NULL, 0} }; static const char findproc[] = - "namespace eval zipfs {}\n" - "proc ::zipfs::find dir {\n" + "namespace eval ::tcl::zipfs::zipfs {}\n" + "proc ::tcl::zipfs::find dir {\n" " set result {}\n" " if {[catch {glob -directory $dir -tails -nocomplain * .*} list]} {\n" " return $result\n" @@ -3876,23 +3806,20 @@ TclZipfs_Init(Tcl_Interp *interp) " }\n" " set file [file join $dir $file]\n" " lappend result $file\n" - " foreach file [::zipfs::find $file] {\n" + " foreach file [::tcl::zipfs::find $file] {\n" " lappend result $file\n" " }\n" " }\n" " return [lsort $result]\n" "}\n"; Tcl_EvalEx(interp, findproc, -1, TCL_EVAL_GLOBAL); - Tcl_LinkVar(interp, "::zipfs::wrmax", (char *) &ZipFS.wrmax, - TCL_LINK_INT); + Tcl_LinkVar(interp, "::tcl::zipfs::wrmax", (char *) &ZipFS.wrmax,TCL_LINK_INT); TclMakeEnsemble(interp, "zipfs", initMap); Tcl_PkgProvide(interp, "zipfs", "2.0"); } return TCL_OK; #else - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("no zlib available", -1)); - } + ZIPFS_ERROR(interp,"no zlib available"); return TCL_ERROR; #endif } @@ -3963,8 +3890,6 @@ int TclZipfs_AppHook(int *argc, char ***argv) TclZipfs_Init(NULL); /* ** Look for init.tcl in one of the locations mounted later in this function - ** and failing that, look for a file name CFG_RUNTIME_ZIPFILE adjacent to the - ** executable */ if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { int found; @@ -4061,7 +3986,7 @@ Tcl_Obj *TclZipfs_TclLibrary(void) { if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_LIBDIR "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); } - if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_SRCDIR "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_SCRDIR "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); } } -- cgit v0.12 From b3ff8cc20cdc84f12b4b9a571092a340c591f216 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Fri, 24 Nov 2017 11:21:55 +0000 Subject: Pulling changes from Androwish --- generic/tclZipfs.c | 1098 +++++++++++++++++++++++++++++----------------------- 1 file changed, 610 insertions(+), 488 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index b9d09f1..668eee0 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -1,8 +1,8 @@ /* * tclZipfs.c -- * - * Implementation of the ZIP filesystem used in TIP 430 - * Adapted from the implentation for AndroWish. + * Implementation of the ZIP filesystem used in TIP 430 + * Adapted from the implentation for AndroWish. * * Coptright (c) 2016-2017 Sean Woods * Copyright (c) 2013-2015 Christian Werner @@ -26,6 +26,10 @@ #include #include +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif + #ifdef HAVE_ZLIB #include "zlib.h" #include "crypt.h" @@ -106,15 +110,15 @@ * Macros to read and write 16 and 32 bit integers from/to ZIP archives. */ -#define zip_read_int(p) \ +#define zip_read_int(p) \ ((p)[0] | ((p)[1] << 8) | ((p)[2] << 16) | ((p)[3] << 24)) -#define zip_read_short(p) \ +#define zip_read_short(p) \ ((p)[0] | ((p)[1] << 8)) -#define zip_write_int(p, v) \ - (p)[0] = (v) & 0xff; (p)[1] = ((v) >> 8) & 0xff; \ +#define zip_write_int(p, v) \ + (p)[0] = (v) & 0xff; (p)[1] = ((v) >> 8) & 0xff; \ (p)[2] = ((v) >> 16) & 0xff; (p)[3] = ((v) >> 24) & 0xff; -#define zip_write_short(p, v) \ +#define zip_write_short(p, v) \ (p)[0] = (v) & 0xff; (p)[1] = ((v) >> 8) & 0xff; /* @@ -163,7 +167,7 @@ typedef struct ZipFile { struct ZipEntry *entries; /* List of files in archive */ struct ZipEntry *topents; /* List of top-level dirs in archive */ #if HAS_DRIVES - int mntdrv; /* Drive letter of mount point */ + int mntdrv; /* Drive letter of mount point */ #endif int mntptlen; /* Length of mount point */ char mntpt[1]; /* Mount point */ @@ -180,8 +184,8 @@ typedef struct ZipEntry { int nbyte; /* Uncompressed size of the virtual file */ int nbytecompr; /* Compressed size of the virtual file */ int cmeth; /* Compress method */ - int isdir; /* Set to 1 if directory */ - int depth; /* Number of slashes in path. */ + int isdir; /* Set to 1 if directory, or -1 if root */ + int depth; /* Number of slashes in path. */ int crc32; /* CRC-32 */ int timestamp; /* Modification time */ int isenc; /* True if data is encrypted */ @@ -202,7 +206,7 @@ typedef struct ZipChannel { unsigned long nread; /* Pos of next byte to be read from the channel */ unsigned char *ubuf; /* Pointer to the uncompressed data */ int iscompr; /* True if data is compressed */ - int isdir; /* Set to 1 if directory */ + int isdir; /* Set to 1 if directory, or -1 if root */ int isenc; /* True if data is encrypted */ int iswr; /* True if open for writing */ unsigned long keys[3]; /* Key for decryption */ @@ -222,13 +226,13 @@ typedef struct ZipChannel { */ static struct { - int initialized; /* True when initialized */ - int lock; /* RW lock, see below */ - int waiters; /* RW lock, see below */ - int wrmax; /* Maximum write size of a file */ - int idCount; /* Counter for channel names */ - Tcl_HashTable fileHash; /* File name to ZipEntry mapping */ - Tcl_HashTable zipHash; /* Mount to ZipFile mapping */ + int initialized; /* True when initialized */ + int lock; /* RW lock, see below */ + int waiters; /* RW lock, see below */ + int wrmax; /* Maximum write size of a file */ + int idCount; /* Counter for channel names */ + Tcl_HashTable fileHash; /* File name to ZipEntry mapping */ + Tcl_HashTable zipHash; /* Mount to ZipFile mapping */ } ZipFS = { 0, 0, 0, 0, 0, }; @@ -309,12 +313,12 @@ const char *zipfs_literal_tcl_library=NULL; * * ReadLock, WriteLock, Unlock -- * - * POSIX like rwlock functions to support multiple readers - * and single writer on internal structs. + * POSIX like rwlock functions to support multiple readers + * and single writer on internal structs. * - * Limitations: - * - a read lock cannot be promoted to a write lock - * - a write lock may not be nested + * Limitations: + * - a read lock cannot be promoted to a write lock + * - a write lock may not be nested * *------------------------------------------------------------------------- */ @@ -330,9 +334,9 @@ ReadLock(void) { Tcl_MutexLock(&ZipFSMutex); while (ZipFS.lock < 0) { - ZipFS.waiters++; - Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, NULL); - ZipFS.waiters--; + ZipFS.waiters++; + Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, NULL); + ZipFS.waiters--; } ZipFS.lock++; Tcl_MutexUnlock(&ZipFSMutex); @@ -343,9 +347,9 @@ WriteLock(void) { Tcl_MutexLock(&ZipFSMutex); while (ZipFS.lock != 0) { - ZipFS.waiters++; - Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, NULL); - ZipFS.waiters--; + ZipFS.waiters++; + Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, NULL); + ZipFS.waiters--; } ZipFS.lock = -1; Tcl_MutexUnlock(&ZipFSMutex); @@ -356,21 +360,21 @@ Unlock(void) { Tcl_MutexLock(&ZipFSMutex); if (ZipFS.lock > 0) { - --ZipFS.lock; + --ZipFS.lock; } else if (ZipFS.lock < 0) { - ZipFS.lock = 0; + ZipFS.lock = 0; } if ((ZipFS.lock == 0) && (ZipFS.waiters > 0)) { - Tcl_ConditionNotify(&ZipFSCond); + Tcl_ConditionNotify(&ZipFSCond); } Tcl_MutexUnlock(&ZipFSMutex); } #else -#define ReadLock() do {} while (0) -#define WriteLock() do {} while (0) -#define Unlock() do {} while (0) +#define ReadLock() do {} while (0) +#define WriteLock() do {} while (0) +#define Unlock() do {} while (0) #endif @@ -379,8 +383,8 @@ Unlock(void) * * DosTimeDate, ToDosTime, ToDosDate -- * - * Functions to perform conversions between DOS time stamps - * and POSIX time_t. + * Functions to perform conversions between DOS time stamps + * and POSIX time_t. * *------------------------------------------------------------------------- */ @@ -467,13 +471,13 @@ ToDosDate(time_t when) * * CountSlashes -- * - * This function counts the number of slashes in a pathname string. + * This function counts the number of slashes in a pathname string. * * Results: - * Number of slashes found in string. + * Number of slashes found in string. * * Side effects: - * None. + * None. * *------------------------------------------------------------------------- */ @@ -498,15 +502,15 @@ CountSlashes(const char *string) * * CanonicalPath -- * - * This function computes the canonical path from a directory - * and file name components into the specified Tcl_DString. + * This function computes the canonical path from a directory + * and file name components into the specified Tcl_DString. * * Results: - * Returns the pointer to the canonical path contained in the - * specified Tcl_DString. + * Returns the pointer to the canonical path contained in the + * specified Tcl_DString. * * Side effects: - * Modifies the specified Tcl_DString. + * Modifies the specified Tcl_DString. * *------------------------------------------------------------------------- */ @@ -611,9 +615,9 @@ CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr,int ZIPFSPA } #endif if(ZIPFSPATH) { - n=ZIPFS_VOLUME_LEN; + n=ZIPFS_VOLUME_LEN; } else { - n=0; + n=0; } for (i = j = n; (c = path[i]) != '\0'; i++) { if (c == '/') { @@ -648,7 +652,7 @@ CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr,int ZIPFSPA path[j++] = c; } if (j == 0) { - path[j++] = '/'; + path[j++] = '/'; } path[j] = 0; Tcl_DStringSetLength(dsPtr, j); @@ -663,16 +667,16 @@ CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr,int ZIPFSPA * * ZipFSLookup -- * - * This function returns the ZIP entry struct corresponding to - * the ZIP archive member of the given file name. + * This function returns the ZIP entry struct corresponding to + * the ZIP archive member of the given file name. * * Results: - * Returns the pointer to ZIP entry struct or NULL if the - * the given file name could not be found in the global list - * of ZIP archive members. + * Returns the pointer to ZIP entry struct or NULL if the + * the given file name could not be found in the global list + * of ZIP archive members. * * Side effects: - * None. + * None. * *------------------------------------------------------------------------- */ @@ -697,14 +701,14 @@ ZipFSLookup(char *filename) * * ZipFSLookupMount -- * - * This function returns an indication if the given file name - * corresponds to a mounted ZIP archive file. + * This function returns an indication if the given file name + * corresponds to a mounted ZIP archive file. * * Results: - * Returns true, if the given file name is a mounted ZIP archive file. + * Returns true, if the given file name is a mounted ZIP archive file. * * Side effects: - * None. + * None. * *------------------------------------------------------------------------- */ @@ -734,14 +738,14 @@ ZipFSLookupMount(char *filename) * * ZipFSCloseArchive -- * - * This function closes a mounted ZIP archive file. + * This function closes a mounted ZIP archive file. * * Results: - * None. + * None. * * Side effects: - * A memory mapped ZIP archive is unmapped, allocated memory is - * released. + * A memory mapped ZIP archive is unmapped, allocated memory is + * released. * *------------------------------------------------------------------------- */ @@ -755,20 +759,22 @@ ZipFSCloseArchive(Tcl_Interp *interp, ZipFile *zf) zf->data = NULL; } if (zf->mh != INVALID_HANDLE_VALUE) { - CloseHandle(zf->mh); + CloseHandle(zf->mh); } #else if ((zf->data != MAP_FAILED) && (zf->tofree == NULL)) { - munmap(zf->data, zf->length); - zf->data = MAP_FAILED; + munmap(zf->data, zf->length); + zf->data = MAP_FAILED; } #endif if (zf->tofree != NULL) { - Tcl_Free((char *) zf->tofree); - zf->tofree = NULL; + Tcl_Free((char *) zf->tofree); + zf->tofree = NULL; + } + if(zf->chan != NULL) { + Tcl_Close(interp, zf->chan); + zf->chan = NULL; } - Tcl_Close(interp, zf->chan); - zf->chan = NULL; } /* @@ -776,27 +782,27 @@ ZipFSCloseArchive(Tcl_Interp *interp, ZipFile *zf) * * ZipFSOpenArchive -- * - * This function opens a ZIP archive file for reading. An attempt - * is made to memory map that file. Otherwise it is read into - * an allocated memory buffer. The ZIP archive header is verified - * and must be valid for the function to succeed. When "needZip" - * is zero an embedded ZIP archive in an executable file is accepted. + * This function opens a ZIP archive file for reading. An attempt + * is made to memory map that file. Otherwise it is read into + * an allocated memory buffer. The ZIP archive header is verified + * and must be valid for the function to succeed. When "needZip" + * is zero an embedded ZIP archive in an executable file is accepted. * * Results: - * TCL_OK on success, TCL_ERROR otherwise with an error message - * placed into the given "interp" if it is not NULL. + * TCL_OK on success, TCL_ERROR otherwise with an error message + * placed into the given "interp" if it is not NULL. * * Side effects: - * ZIP archive is memory mapped or read into allocated memory, - * the given ZipFile struct is filled with information about - * the ZIP archive file. + * ZIP archive is memory mapped or read into allocated memory, + * the given ZipFile struct is filled with information about + * the ZIP archive file. * *------------------------------------------------------------------------- */ static int ZipFSOpenArchive(Tcl_Interp *interp, const char *zipname, int needZip, - ZipFile *zf) + ZipFile *zf) { int i; ClientData handle; @@ -815,7 +821,7 @@ ZipFSOpenArchive(Tcl_Interp *interp, const char *zipname, int needZip, zf->pwbuf[0] = 0; zf->chan = Tcl_OpenFileChannel(interp, zipname, "r", 0); if (zf->chan == NULL) { - return TCL_ERROR; + return TCL_ERROR; } if (Tcl_GetChannelHandle(zf->chan, TCL_READABLE, &handle) != TCL_OK) { if (Tcl_SetChannelOption(interp, zf->chan, "-translation", "binary") != TCL_OK) { @@ -905,20 +911,20 @@ ZipFSOpenArchive(Tcl_Interp *interp, const char *zipname, int needZip, return TCL_OK; } ZIPFS_ERROR(interp,"empty archive"); - goto error; + goto error; } q = zf->data + zip_read_int(p + ZIP_CENTRAL_DIRSTART_OFFS); p -= zip_read_int(p + ZIP_CENTRAL_DIRSIZE_OFFS); if ( (p < zf->data) || (p > (zf->data + zf->length)) || - (q < zf->data) || (q > (zf->data + zf->length)) - ) { + (q < zf->data) || (q > (zf->data + zf->length)) + ) { if (!needZip) { zf->baseoffs = zf->baseoffsp = zf->length; return TCL_OK; } - ZIPFS_ERROR(interp,"archive directory not found"); - goto error; + ZIPFS_ERROR(interp,"archive directory not found"); + goto error; } zf->baseoffs = zf->baseoffsp = p - q; zf->centoffs = p - zf->data; @@ -961,14 +967,14 @@ error: * TclZipfs_Mount -- * * This procedure is invoked to mount a given ZIP archive file on - * a given mountpoint with optional ZIP password. + * a given mountpoint with optional ZIP password. * * Results: * A standard Tcl result. * * Side effects: * A ZIP archive file is read, analyzed and mounted, resources are - * allocated. + * allocated. * *------------------------------------------------------------------------- */ @@ -977,7 +983,7 @@ int TclZipfs_Mount( Tcl_Interp *interp, const char *zipname, const char *mntpt, - const char *passwd + const char *passwd ) { int i, pwlen, isNew; ZipFile *zf, zf0; @@ -1030,17 +1036,17 @@ TclZipfs_Mount( Unlock(); pwlen = 0; if (passwd != NULL) { - pwlen = strlen(passwd); - if ((pwlen > 255) || (strchr(passwd, 0xff) != NULL)) { - if (interp) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("illegal password", -1)); - } - return TCL_ERROR; - } + pwlen = strlen(passwd); + if ((pwlen > 255) || (strchr(passwd, 0xff) != NULL)) { + if (interp) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal password", -1)); + } + return TCL_ERROR; + } } if (ZipFSOpenArchive(interp, zipname, 1, &zf0) != TCL_OK) { - return TCL_ERROR; + return TCL_ERROR; } /* * Mount point can come from Tcl_GetNameOfExecutable() @@ -1097,7 +1103,7 @@ TclZipfs_Mount( z->tnext = NULL; z->depth = CountSlashes(mntpt); z->zipfile = zf; - z->isdir = 1; + z->isdir = (zf->baseoffs == 0) ? 1 : -1; /* root marker */ z->isenc = 0; z->offset = zf->baseoffs; z->crc32 = 0; @@ -1316,7 +1322,7 @@ TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, zipname); - /* don't report error */ + /* don't report error */ if (hPtr == NULL) goto done; zf = (ZipFile *) Tcl_GetHashValue(hPtr); @@ -1343,7 +1349,7 @@ TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) done: Unlock(); if (unmounted) { - Tcl_FSMountsChanged(NULL); + Tcl_FSMountsChanged(NULL); } return ret; } @@ -1374,8 +1380,8 @@ ZipFSMountObjCmd( return TCL_ERROR; } return TclZipfs_Mount(interp, (objc > 1) ? Tcl_GetString(objv[1]) : NULL, - (objc > 2) ? Tcl_GetString(objv[2]) : NULL, - (objc > 3) ? Tcl_GetString(objv[3]) : NULL); + (objc > 2) ? Tcl_GetString(objv[2]) : NULL, + (objc > 3) ? Tcl_GetString(objv[3]) : NULL); } /* @@ -1435,7 +1441,7 @@ ZipFSUnmountObjCmd( * ZipFSMkKeyObjCmd -- * * This procedure is invoked to process the "zipfs::mkkey" command. - * It produces a rotated password to be embedded into an image file. + * It produces a rotated password to be embedded into an image file. * * Results: * A standard Tcl result. @@ -1454,13 +1460,13 @@ ZipFSMkKeyObjCmd( char *pw, pwbuf[264]; if (objc != 2) { - Tcl_WrongNumArgs(interp, 1, objv, "password"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, "password"); + return TCL_ERROR; } pw = Tcl_GetString(objv[1]); len = strlen(pw); if (len == 0) { - return TCL_OK; + return TCL_OK; } if ((len > 255) || (strchr(pw, 0xff) != NULL)) { Tcl_SetObjResult(interp, Tcl_NewStringObj("illegal password", -1)); @@ -1490,16 +1496,16 @@ ZipFSMkKeyObjCmd( * ZipAddFile -- * * This procedure is used by ZipFSMkZipOrImgCmd() to add a single - * file to the output ZIP archive file being written. A ZipEntry - * struct about the input file is added to the given fileHash table - * for later creation of the central ZIP directory. + * file to the output ZIP archive file being written. A ZipEntry + * struct about the input file is added to the given fileHash table + * for later creation of the central ZIP directory. * * Results: * A standard Tcl result. * * Side effects: - * Input file is read and (compressed and) written to the output - * ZIP archive file. + * Input file is read and (compressed and) written to the output + * ZIP archive file. * *------------------------------------------------------------------------- */ @@ -1507,8 +1513,8 @@ ZipFSMkKeyObjCmd( static int ZipAddFile( Tcl_Interp *interp, const char *path, const char *name, - Tcl_Channel out, const char *passwd, - char *buf, int bufsize, Tcl_HashTable *fileHash + Tcl_Channel out, const char *passwd, + char *buf, int bufsize, Tcl_HashTable *fileHash ) { Tcl_Channel in; Tcl_HashEntry *hPtr; @@ -1522,10 +1528,10 @@ ZipAddFile( zpath = name; while (zpath != NULL && zpath[0] == '/') { - zpath++; + zpath++; } if ((zpath == NULL) || (zpath[0] == '\0')) { - return TCL_OK; + return TCL_OK; } zpathlen = strlen(zpath); if (zpathlen + ZIP_CENTRAL_HEADER_LEN > bufsize) { @@ -1545,8 +1551,8 @@ ZipAddFile( return TCL_OK; } #endif - Tcl_Close(interp, in); - return TCL_ERROR; + Tcl_Close(interp, in); + return TCL_ERROR; } else { Tcl_Obj *pathObj = Tcl_NewStringObj(path, -1); Tcl_StatBuf statBuf; @@ -1589,9 +1595,9 @@ ZipAddFile( len = zpathlen + ZIP_LOCAL_HEADER_LEN; if (Tcl_Write(out, buf, len) != len) { wrerr: - Tcl_AppendResult(interp, "write error", (char *) NULL); - Tcl_Close(interp, in); - return TCL_ERROR; + Tcl_AppendResult(interp, "write error", (char *) NULL); + Tcl_Close(interp, in); + return TCL_ERROR; } if ((len + pos[0]) & 3) { char abuf[8]; @@ -1658,44 +1664,44 @@ wrerr: return TCL_ERROR; } do { - len = Tcl_Read(in, buf, bufsize); - if (len == -1) { - Tcl_AppendResult(interp, "read error on \"", path, "\"", - (char *) NULL); - deflateEnd(&stream); - Tcl_Close(interp, in); - return TCL_ERROR; - } - stream.avail_in = len; - stream.next_in = (unsigned char *) buf; - flush = Tcl_Eof(in) ? Z_FINISH : Z_NO_FLUSH; - do { - stream.avail_out = sizeof (obuf); - stream.next_out = (unsigned char *) obuf; - len = deflate(&stream, flush); - if (len == Z_STREAM_ERROR) { + len = Tcl_Read(in, buf, bufsize); + if (len == -1) { + Tcl_AppendResult(interp, "read error on \"", path, "\"", + (char *) NULL); + deflateEnd(&stream); + Tcl_Close(interp, in); + return TCL_ERROR; + } + stream.avail_in = len; + stream.next_in = (unsigned char *) buf; + flush = Tcl_Eof(in) ? Z_FINISH : Z_NO_FLUSH; + do { + stream.avail_out = sizeof (obuf); + stream.next_out = (unsigned char *) obuf; + len = deflate(&stream, flush); + if (len == Z_STREAM_ERROR) { Tcl_AppendResult(interp, "deflate error on \"", path, "\"", (char *) NULL); deflateEnd(&stream); Tcl_Close(interp, in); return TCL_ERROR; - } - olen = sizeof (obuf) - stream.avail_out; - if (passwd != NULL) { + } + olen = sizeof (obuf) - stream.avail_out; + if (passwd != NULL) { int i, tmp; for (i = 0; i < olen; i++) { obuf[i] = (char) zencode(keys, crc32tab, obuf[i], tmp); } - } - if (olen && (Tcl_Write(out, obuf, olen) != olen)) { + } + if (olen && (Tcl_Write(out, obuf, olen) != olen)) { Tcl_AppendResult(interp, "write error", (char *) NULL); deflateEnd(&stream); Tcl_Close(interp, in); return TCL_ERROR; - } - nbytecompr += olen; - } while (stream.avail_out == 0); + } + nbytecompr += olen; + } while (stream.avail_out == 0); } while (flush != Z_FINISH); deflateEnd(&stream); Tcl_Flush(out); @@ -1814,23 +1820,23 @@ seekErr: * ZipFSMkZipOrImgObjCmd -- * * This procedure is creates a new ZIP archive file or image file - * given output filename, input directory of files to be archived, - * optional password, and optional image to be prepended to the - * output ZIP archive file. + * given output filename, input directory of files to be archived, + * optional password, and optional image to be prepended to the + * output ZIP archive file. * * Results: * A standard Tcl result. * * Side effects: - * A new ZIP archive file or image file is written. + * A new ZIP archive file or image file is written. * *------------------------------------------------------------------------- */ static int -ZipFSMkZipOrImgObjCmd( - ClientData clientData, Tcl_Interp *interp,int isImg, int isList, int objc, Tcl_Obj *const objv[] -) { +ZipFSMkZipOrImgObjCmd(ClientData clientData, Tcl_Interp *interp, + int isImg, int isList, int objc, Tcl_Obj *const objv[]) +{ Tcl_Channel out; int len = 0, pwlen = 0, slen = 0, i, count, ret = TCL_ERROR, lobjc, pos[3]; Tcl_Obj **lobjv, *list = NULL; @@ -1843,15 +1849,15 @@ ZipFSMkZipOrImgObjCmd( if (isList) { if ((objc < 3) || (objc > (isImg ? 5 : 4))) { Tcl_WrongNumArgs(interp, 1, objv, isImg ? - "outfile inlist ?password infile?" : - "outfile inlist ?password?"); + "outfile inlist ?password infile?" : + "outfile inlist ?password?"); return TCL_ERROR; } } else { if ((objc < 3) || (objc > (isImg ? 6 : 5))) { Tcl_WrongNumArgs(interp, 1, objv, isImg ? - "outfile indir ?strip? ?password? ?infile?" : - "outfile indir ?strip? ?password?"); + "outfile indir ?strip? ?password? ?infile?" : + "outfile indir ?strip? ?password?"); return TCL_ERROR; } } @@ -1861,7 +1867,7 @@ ZipFSMkZipOrImgObjCmd( pwlen = strlen(pw); if ((pwlen > 255) || (strchr(pw, 0xff) != NULL)) { Tcl_SetObjResult(interp, - Tcl_NewStringObj("illegal password", -1)); + Tcl_NewStringObj("illegal password", -1)); return TCL_ERROR; } } @@ -1890,7 +1896,7 @@ ZipFSMkZipOrImgObjCmd( if (isList && (lobjc % 2)) { Tcl_DecrRefCount(list); Tcl_SetObjResult(interp, - Tcl_NewStringObj("need even number of elements", -1)); + Tcl_NewStringObj("need even number of elements", -1)); return TCL_ERROR; } if (lobjc == 0) { @@ -1904,35 +1910,33 @@ ZipFSMkZipOrImgObjCmd( || (Tcl_SetChannelOption(interp, out, "-translation", "binary") != TCL_OK) || (Tcl_SetChannelOption(interp, out, "-encoding", "binary") != TCL_OK) ) { - Tcl_DecrRefCount(list); - Tcl_Close(interp, out); - return TCL_ERROR; + Tcl_DecrRefCount(list); + Tcl_Close(interp, out); + return TCL_ERROR; + } + if (pwlen <= 0) { + pw = NULL; + pwlen = 0; } if (isImg) { - ZipFile zf0; + ZipFile *zf, zf0; + int isMounted = 0; const char *imgName; if (isList) { - imgName = (objc > 4) ? Tcl_GetString(objv[4]) : - Tcl_GetNameOfExecutable(); + imgName = (objc > 4) ? Tcl_GetString(objv[4]) : Tcl_GetNameOfExecutable(); } else { - imgName = (objc > 5) ? Tcl_GetString(objv[5]) : - Tcl_GetNameOfExecutable(); - } - if (ZipFSOpenArchive(interp, imgName, 0, &zf0) != TCL_OK) { - Tcl_DecrRefCount(list); - Tcl_Close(interp, out); - return TCL_ERROR; + imgName = (objc > 5) ? Tcl_GetString(objv[5]) : Tcl_GetNameOfExecutable(); } - if ((pw != NULL) && pwlen) { + if (pwlen) { i = 0; len = pwlen; while (len > 0) { - int ch = pw[len - 1]; + int ch = pw[len - 1]; - pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; - i++; - len--; + pwbuf[i] = (ch & 0x0f) | pwrot[(ch >> 4) & 0x0f]; + i++; + len--; } pwbuf[i] = i; ++i; @@ -1942,23 +1946,108 @@ ZipFSMkZipOrImgObjCmd( pwbuf[i++] = (char) (ZIP_PASSWORD_END_SIG >> 24); pwbuf[i] = '\0'; } - i = Tcl_Write(out, (char *) zf0.data, zf0.baseoffsp); - if (i != zf0.baseoffsp) { - Tcl_DecrRefCount(list); - Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); - Tcl_Close(interp, out); - ZipFSCloseArchive(interp, &zf0); - return TCL_ERROR; + /* Check for mounted image */ + WriteLock(); + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { + if (strcmp(zf->name, imgName) == 0) { + isMounted = 1; + zf->nopen++; + break; + } + } + hPtr = Tcl_NextHashEntry(&search); + } + Unlock(); + if (!isMounted) { + zf = &zf0; + } + if (isMounted || + (ZipFSOpenArchive(interp, imgName, 0, zf) == TCL_OK)) { + i = Tcl_Write(out, (char *) zf->data, zf->baseoffsp); + if (i != zf->baseoffsp) { + memset(pwbuf, 0, sizeof (pwbuf)); + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); + Tcl_Close(interp, out); + if (zf == &zf0) { + ZipFSCloseArchive(interp, zf); + } else { + WriteLock(); + zf->nopen--; + Unlock(); + } + return TCL_ERROR; + } + if (zf == &zf0) { + ZipFSCloseArchive(interp, zf); + } else { + WriteLock(); + zf->nopen--; + Unlock(); + } + } else { + int k, n, m; + Tcl_Channel in; + const char *errMsg = "seek error"; + + /* + * Fall back to read it as plain file which + * hopefully is a static tclsh or wish binary + * with proper zipfs infrastructure built in. + */ + Tcl_ResetResult(interp); + in = Tcl_OpenFileChannel(interp, imgName, "r", 0644); + if (in == NULL) { + memset(pwbuf, 0, sizeof (pwbuf)); + Tcl_DecrRefCount(list); + Tcl_Close(interp, out); + return TCL_ERROR; + } + Tcl_SetChannelOption(interp, in, "-translation", "binary"); + Tcl_SetChannelOption(interp, in, "-encoding", "binary"); + i = Tcl_Seek(in, 0, SEEK_END); + if (i == -1) { +cperr: + memset(pwbuf, 0, sizeof (pwbuf)); + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, -1)); + Tcl_Close(interp, out); + Tcl_Close(interp, in); + return TCL_ERROR; + } + Tcl_Seek(in, 0, SEEK_SET); + k = 0; + while (k < i) { + m = i - k; + if (m > sizeof (buf)) { + m = sizeof (buf); + } + n = Tcl_Read(in, buf, m); + if (n == -1) { + errMsg = "read error"; + goto cperr; + } else if (n == 0) { + break; + } + m = Tcl_Write(out, buf, n); + if (m != n) { + errMsg = "write error"; + goto cperr; + } + k += m; + } + Tcl_Close(interp, in); } - ZipFSCloseArchive(interp, &zf0); len = strlen(pwbuf); if (len > 0) { i = Tcl_Write(out, pwbuf, len); if (i != len) { - Tcl_DecrRefCount(list); - Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); - Tcl_Close(interp, out); - return TCL_ERROR; + Tcl_DecrRefCount(list); + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); + Tcl_Close(interp, out); + return TCL_ERROR; } } memset(pwbuf, 0, sizeof (pwbuf)); @@ -1992,65 +2081,66 @@ ZipFSMkZipOrImgObjCmd( if (name[0] == '\0') { continue; } - if (ZipAddFile(interp, path, name, out, pw, buf, sizeof (buf), &fileHash) != TCL_OK) { + if (ZipAddFile(interp, path, name, out, pw, buf, sizeof (buf), + &fileHash) != TCL_OK) { goto done; } } pos[1] = Tcl_Tell(out); count = 0; for (i = 0; i < lobjc; i += (isList ? 2 : 1)) { - const char *path, *name; - - path = Tcl_GetString(lobjv[i]); - if (isList) { - name = Tcl_GetString(lobjv[i + 1]); - } else { - name = path; - if (slen > 0) { - len = strlen(name); - if ((len <= slen) || (strncmp(strip, name, slen) != 0)) { - continue; + const char *path, *name; + + path = Tcl_GetString(lobjv[i]); + if (isList) { + name = Tcl_GetString(lobjv[i + 1]); + } else { + name = path; + if (slen > 0) { + len = strlen(name); + if ((len <= slen) || (strncmp(strip, name, slen) != 0)) { + continue; + } + name += slen; } - name += slen; - } - } - while (name[0] == '/') { - ++name; - } - if (name[0] == '\0') { - continue; - } - hPtr = Tcl_FindHashEntry(&fileHash, name); - if (hPtr == NULL) { - continue; - } - z = (ZipEntry *) Tcl_GetHashValue(hPtr); - len = strlen(z->name); - zip_write_int(buf + ZIP_CENTRAL_SIG_OFFS, ZIP_CENTRAL_HEADER_SIG); - zip_write_short(buf + ZIP_CENTRAL_VERSIONMADE_OFFS, ZIP_MIN_VERSION); - zip_write_short(buf + ZIP_CENTRAL_VERSION_OFFS, ZIP_MIN_VERSION); - zip_write_short(buf + ZIP_CENTRAL_FLAGS_OFFS, z->isenc ? 1 : 0); - zip_write_short(buf + ZIP_CENTRAL_COMPMETH_OFFS, z->cmeth); - zip_write_short(buf + ZIP_CENTRAL_MTIME_OFFS, ToDosTime(z->timestamp)); - zip_write_short(buf + ZIP_CENTRAL_MDATE_OFFS, ToDosDate(z->timestamp)); - zip_write_int(buf + ZIP_CENTRAL_CRC32_OFFS, z->crc32); - zip_write_int(buf + ZIP_CENTRAL_COMPLEN_OFFS, z->nbytecompr); - zip_write_int(buf + ZIP_CENTRAL_UNCOMPLEN_OFFS, z->nbyte); - zip_write_short(buf + ZIP_CENTRAL_PATHLEN_OFFS, len); - zip_write_short(buf + ZIP_CENTRAL_EXTRALEN_OFFS, 0); - zip_write_short(buf + ZIP_CENTRAL_FCOMMENTLEN_OFFS, 0); - zip_write_short(buf + ZIP_CENTRAL_DISKFILE_OFFS, 0); - zip_write_short(buf + ZIP_CENTRAL_IATTR_OFFS, 0); - zip_write_int(buf + ZIP_CENTRAL_EATTR_OFFS, 0); - zip_write_int(buf + ZIP_CENTRAL_LOCALHDR_OFFS, z->offset - pos[0]); - if ( - (Tcl_Write(out, buf, ZIP_CENTRAL_HEADER_LEN) != ZIP_CENTRAL_HEADER_LEN) - || (Tcl_Write(out, z->name, len) != len) - ) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); - goto done; - } - count++; + } + while (name[0] == '/') { + ++name; + } + if (name[0] == '\0') { + continue; + } + hPtr = Tcl_FindHashEntry(&fileHash, name); + if (hPtr == NULL) { + continue; + } + z = (ZipEntry *) Tcl_GetHashValue(hPtr); + len = strlen(z->name); + zip_write_int(buf + ZIP_CENTRAL_SIG_OFFS, ZIP_CENTRAL_HEADER_SIG); + zip_write_short(buf + ZIP_CENTRAL_VERSIONMADE_OFFS, ZIP_MIN_VERSION); + zip_write_short(buf + ZIP_CENTRAL_VERSION_OFFS, ZIP_MIN_VERSION); + zip_write_short(buf + ZIP_CENTRAL_FLAGS_OFFS, z->isenc ? 1 : 0); + zip_write_short(buf + ZIP_CENTRAL_COMPMETH_OFFS, z->cmeth); + zip_write_short(buf + ZIP_CENTRAL_MTIME_OFFS, ToDosTime(z->timestamp)); + zip_write_short(buf + ZIP_CENTRAL_MDATE_OFFS, ToDosDate(z->timestamp)); + zip_write_int(buf + ZIP_CENTRAL_CRC32_OFFS, z->crc32); + zip_write_int(buf + ZIP_CENTRAL_COMPLEN_OFFS, z->nbytecompr); + zip_write_int(buf + ZIP_CENTRAL_UNCOMPLEN_OFFS, z->nbyte); + zip_write_short(buf + ZIP_CENTRAL_PATHLEN_OFFS, len); + zip_write_short(buf + ZIP_CENTRAL_EXTRALEN_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_FCOMMENTLEN_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_DISKFILE_OFFS, 0); + zip_write_short(buf + ZIP_CENTRAL_IATTR_OFFS, 0); + zip_write_int(buf + ZIP_CENTRAL_EATTR_OFFS, 0); + zip_write_int(buf + ZIP_CENTRAL_LOCALHDR_OFFS, z->offset - pos[0]); + if ( + (Tcl_Write(out, buf, ZIP_CENTRAL_HEADER_LEN) != ZIP_CENTRAL_HEADER_LEN) + || (Tcl_Write(out, z->name, len) != len) + ) { + Tcl_SetObjResult(interp, Tcl_NewStringObj("write error", -1)); + goto done; + } + count++; } Tcl_Flush(out); pos[2] = Tcl_Tell(out); @@ -2070,9 +2160,9 @@ ZipFSMkZipOrImgObjCmd( ret = TCL_OK; done: if (ret == TCL_OK) { - ret = Tcl_Close(interp, out); + ret = Tcl_Close(interp, out); } else { - Tcl_Close(interp, out); + Tcl_Close(interp, out); } Tcl_DecrRefCount(list); hPtr = Tcl_FirstHashEntry(&fileHash, &search); @@ -2080,7 +2170,7 @@ done: z = (ZipEntry *) Tcl_GetHashValue(hPtr); Tcl_Free((char *) z); Tcl_DeleteHashEntry(hPtr); - hPtr = Tcl_FirstHashEntry(&fileHash, &search); + hPtr = Tcl_NextHashEntry(&search); } Tcl_DeleteHashTable(&fileHash); return ret; @@ -2092,13 +2182,13 @@ done: * ZipFSMkZipObjCmd -- * * This procedure is invoked to process the "zipfs::mkzip" command. - * See description of ZipFSMkZipOrImgCmd(). + * See description of ZipFSMkZipOrImgCmd(). * * Results: * A standard Tcl result. * * Side effects: - * See description of ZipFSMkZipOrImgCmd(). + * See description of ZipFSMkZipOrImgCmd(). * *------------------------------------------------------------------------- */ @@ -2120,30 +2210,30 @@ ZipFSLMkZipObjCmd( /* *------------------------------------------------------------------------- * - * ZipFSMkImgObjCmd -- + * ZipFSZipFSOpenArchiveObjCmd -- * * This procedure is invoked to process the "zipfs::mkimg" command. - * See description of ZipFSMkZipOrImgCmd(). + * See description of ZipFSMkZipOrImgCmd(). * * Results: * A standard Tcl result. * * Side effects: - * See description of ZipFSMkZipOrImgCmd(). + * See description of ZipFSMkZipOrImgCmd(). * *------------------------------------------------------------------------- */ static int ZipFSMkImgObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) + int objc, Tcl_Obj *const objv[]) { return ZipFSMkZipOrImgObjCmd(clientData, interp, 1, 0, objc, objv); } static int ZipFSLMkImgObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) + int objc, Tcl_Obj *const objv[]) { return ZipFSMkZipOrImgObjCmd(clientData, interp, 1, 1, objc, objv); } @@ -2154,8 +2244,8 @@ ZipFSLMkImgObjCmd(ClientData clientData, Tcl_Interp *interp, * ZipFSExistsObjCmd -- * * This procedure is invoked to process the "zipfs::exists" command. - * It tests for the existence of a file in the ZIP filesystem and - * places a boolean into the interp's result. + * It tests for the existence of a file in the ZIP filesystem and + * places a boolean into the interp's result. * * Results: * Always TCL_OK. @@ -2206,8 +2296,8 @@ ZipFSCanonicalObjCmd( * ZipFSExistsObjCmd -- * * This procedure is invoked to process the "zipfs::exists" command. - * It tests for the existence of a file in the ZIP filesystem and - * places a boolean into the interp's result. + * It tests for the existence of a file in the ZIP filesystem and + * places a boolean into the interp's result. * * Results: * Always TCL_OK. @@ -2252,9 +2342,9 @@ ZipFSExistsObjCmd( * ZipFSInfoObjCmd -- * * This procedure is invoked to process the "zipfs::info" command. - * On success, it returns a Tcl list made up of name of ZIP archive - * file, size uncompressed, size compressed, and archive offset of - * a file in the ZIP filesystem. + * On success, it returns a Tcl list made up of name of ZIP archive + * file, size uncompressed, size compressed, and archive offset of + * a file in the ZIP filesystem. * * Results: * A standard Tcl result. @@ -2273,8 +2363,8 @@ ZipFSInfoObjCmd( ZipEntry *z; if (objc != 2) { - Tcl_WrongNumArgs(interp, 1, objv, "filename"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, "filename"); + return TCL_ERROR; } filename = Tcl_GetStringFromObj(objv[1], 0); ReadLock(); @@ -2298,8 +2388,8 @@ ZipFSInfoObjCmd( * ZipFSListObjCmd -- * * This procedure is invoked to process the "zipfs::list" command. - * On success, it returns a Tcl list of files of the ZIP filesystem - * which match a search pattern (glob or regexp). + * On success, it returns a Tcl list of files of the ZIP filesystem + * which match a search pattern (glob or regexp). * * Results: * A standard Tcl result. @@ -2321,8 +2411,8 @@ ZipFSListObjCmd( Tcl_Obj *result = Tcl_GetObjResult(interp); if (objc > 3) { - Tcl_WrongNumArgs(interp, 1, objv, "?(-glob|-regexp)? ?pattern?"); - return TCL_ERROR; + Tcl_WrongNumArgs(interp, 1, objv, "?(-glob|-regexp)? ?pattern?"); + return TCL_ERROR; } if (objc == 3) { int n; @@ -2340,7 +2430,7 @@ ZipFSListObjCmd( return TCL_ERROR; } } else if (objc == 2) { - pattern = Tcl_GetStringFromObj(objv[1], 0); + pattern = Tcl_GetStringFromObj(objv[1], 0); } ReadLock(); if (pattern != NULL) { @@ -2399,7 +2489,7 @@ ZipFSListObjCmd( static int ZipFSTclLibraryObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) + int objc, Tcl_Obj *const objv[]) { Tcl_Obj *pResult; @@ -2416,13 +2506,13 @@ ZipFSTclLibraryObjCmd(ClientData clientData, Tcl_Interp *interp, * * ZipChannelClose -- * - * This function is called to close a channel. + * This function is called to close a channel. * * Results: - * Always TCL_OK. + * Always TCL_OK. * * Side effects: - * Resources are free'd. + * Resources are free'd. * *------------------------------------------------------------------------- */ @@ -2433,12 +2523,12 @@ ZipChannelClose(ClientData instanceData, Tcl_Interp *interp) ZipChannel *info = (ZipChannel *) instanceData; if (info->iscompr && (info->ubuf != NULL)) { - Tcl_Free((char *) info->ubuf); - info->ubuf = NULL; + Tcl_Free((char *) info->ubuf); + info->ubuf = NULL; } if (info->isenc) { - info->isenc = 0; - memset(info->keys, 0, sizeof (info->keys)); + info->isenc = 0; + memset(info->keys, 0, sizeof (info->keys)); } if (info->iswr) { ZipEntry *z = info->zipentry; @@ -2473,13 +2563,13 @@ ZipChannelClose(ClientData instanceData, Tcl_Interp *interp) * * ZipChannelRead -- * - * This function is called to read data from channel. + * This function is called to read data from channel. * * Results: - * Number of bytes read or -1 on error with error number set. + * Number of bytes read or -1 on error with error number set. * * Side effects: - * Data is read and file pointer is advanced. + * Data is read and file pointer is advanced. * *------------------------------------------------------------------------- */ @@ -2490,17 +2580,35 @@ ZipChannelRead(ClientData instanceData, char *buf, int toRead, int *errloc) ZipChannel *info = (ZipChannel *) instanceData; unsigned long nextpos; + if (info->isdir < 0) { + /* + * Special case: when executable combined with ZIP archive file + * read data in front of ZIP, i.e. the executable itself. + */ + nextpos = info->nread + toRead; + if (nextpos > info->zipfile->baseoffs) { + toRead = info->zipfile->baseoffs - info->nread; + nextpos = info->zipfile->baseoffs; + } + if (toRead == 0) { + return 0; + } + memcpy(buf, info->zipfile->data, toRead); + info->nread = nextpos; + *errloc = 0; + return toRead; + } if (info->isdir) { - *errloc = EISDIR; - return -1; + *errloc = EISDIR; + return -1; } nextpos = info->nread + toRead; if (nextpos > info->nbyte) { - toRead = info->nbyte - info->nread; - nextpos = info->nbyte; + toRead = info->nbyte - info->nread; + nextpos = info->nbyte; } if (toRead == 0) { - return 0; + return 0; } if (info->isenc) { int i, ch; @@ -2510,7 +2618,7 @@ ZipChannelRead(ClientData instanceData, char *buf, int toRead, int *errloc) buf[i] = zdecode(info->keys, crc32tab, ch); } } else { - memcpy(buf, info->ubuf + info->nread, toRead); + memcpy(buf, info->ubuf + info->nread, toRead); } info->nread = nextpos; *errloc = 0; @@ -2522,40 +2630,40 @@ ZipChannelRead(ClientData instanceData, char *buf, int toRead, int *errloc) * * ZipChannelWrite -- * - * This function is called to write data into channel. + * This function is called to write data into channel. * * Results: - * Number of bytes written or -1 on error with error number set. + * Number of bytes written or -1 on error with error number set. * * Side effects: - * Data is written and file pointer is advanced. + * Data is written and file pointer is advanced. * *------------------------------------------------------------------------- */ static int ZipChannelWrite(ClientData instanceData, const char *buf, - int toWrite, int *errloc) + int toWrite, int *errloc) { ZipChannel *info = (ZipChannel *) instanceData; unsigned long nextpos; if (!info->iswr) { - *errloc = EINVAL; - return -1; + *errloc = EINVAL; + return -1; } nextpos = info->nread + toWrite; if (nextpos > info->nmax) { - toWrite = info->nmax - info->nread; - nextpos = info->nmax; + toWrite = info->nmax - info->nread; + nextpos = info->nmax; } if (toWrite == 0) { - return 0; + return 0; } memcpy(info->ubuf + info->nread, buf, toWrite); info->nread = nextpos; if (info->nread > info->nbyte) { - info->nbyte = info->nread; + info->nbyte = info->nread; } *errloc = 0; return toWrite; @@ -2566,13 +2674,13 @@ ZipChannelWrite(ClientData instanceData, const char *buf, * * ZipChannelSeek -- * - * This function is called to position file pointer of channel. + * This function is called to position file pointer of channel. * * Results: - * New file position or -1 on error with error number set. + * New file position or -1 on error with error number set. * * Side effects: - * File pointer is repositioned according to offset and mode. + * File pointer is repositioned according to offset and mode. * *------------------------------------------------------------------------- */ @@ -2581,27 +2689,36 @@ static int ZipChannelSeek(ClientData instanceData, long offset, int mode, int *errloc) { ZipChannel *info = (ZipChannel *) instanceData; + unsigned long end; - if (info->isdir) { + if (!info->iswr && (info->isdir < 0)) { + /* + * Special case: when executable combined with ZIP archive file, + * seek within front of ZIP, i.e. the executable itself. + */ + end = info->zipfile->baseoffs; + } else if (info->isdir) { *errloc = EINVAL; return -1; + } else { + end = info->nbyte; } switch (mode) { - case SEEK_CUR: + case SEEK_CUR: offset += info->nread; break; - case SEEK_END: - offset += info->nbyte; + case SEEK_END: + offset += end; break; - case SEEK_SET: + case SEEK_SET: break; - default: + default: *errloc = EINVAL; return -1; } if (offset < 0) { - *errloc = EINVAL; - return -1; + *errloc = EINVAL; + return -1; } if (info->iswr) { if ((unsigned long) offset > info->nmax) { @@ -2611,7 +2728,7 @@ ZipChannelSeek(ClientData instanceData, long offset, int mode, int *errloc) if ((unsigned long) offset > info->nbyte) { info->nbyte = offset; } - } else if ((unsigned long) offset > info->nbyte) { + } else if ((unsigned long) offset > end) { *errloc = EINVAL; return -1; } @@ -2624,13 +2741,13 @@ ZipChannelSeek(ClientData instanceData, long offset, int mode, int *errloc) * * ZipChannelWatchChannel -- * - * This function is called for event notifications on channel. + * This function is called for event notifications on channel. * * Results: - * None. + * None. * * Side effects: - * None. + * None. * *------------------------------------------------------------------------- */ @@ -2646,14 +2763,14 @@ ZipChannelWatchChannel(ClientData instanceData, int mask) * * ZipChannelGetFile -- * - * This function is called to retrieve OS handle for channel. + * This function is called to retrieve OS handle for channel. * * Results: - * Always TCL_ERROR since there's never an OS handle for a - * file within a ZIP archive. + * Always TCL_ERROR since there's never an OS handle for a + * file within a ZIP archive. * * Side effects: - * None. + * None. * *------------------------------------------------------------------------- */ @@ -2705,14 +2822,14 @@ static Tcl_ChannelType ZipChannelType = { * * ZipChannelOpen -- * - * This function opens a Tcl_Channel on a file from a mounted ZIP - * archive according to given open mode. + * This function opens a Tcl_Channel on a file from a mounted ZIP + * archive according to given open mode. * * Results: - * Tcl_Channel on success, or NULL on error. + * Tcl_Channel on success, or NULL on error. * * Side effects: - * Memory is allocated, the file from the ZIP archive is uncompressed. + * Memory is allocated, the file from the ZIP archive is uncompressed. * *------------------------------------------------------------------------- */ @@ -2732,7 +2849,7 @@ ZipChannelOpen(Tcl_Interp *interp, char *filename, int mode, int permissions) if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported open mode", -1)); } - return NULL; + return NULL; } WriteLock(); z = ZipFSLookup(filename); @@ -2746,12 +2863,12 @@ ZipChannelOpen(Tcl_Interp *interp, char *filename, int mode, int permissions) trunc = (mode & O_TRUNC) != 0; wr = (mode & (O_WRONLY | O_RDWR)) != 0; if ((z->cmeth != ZIP_COMPMETH_STORED) && (z->cmeth != ZIP_COMPMETH_DEFLATED)) { - ZIPFS_ERROR(interp,"unsupported compression method"); - goto error; + ZIPFS_ERROR(interp,"unsupported compression method"); + goto error; } if (wr && z->isdir) { ZIPFS_ERROR(interp,"unsupported file type"); - goto error; + goto error; } if (!trunc) { flags |= TCL_READABLE; @@ -2763,12 +2880,12 @@ ZipChannelOpen(Tcl_Interp *interp, char *filename, int mode, int permissions) goto error; } } else { - flags = TCL_WRITABLE; + flags = TCL_WRITABLE; } info = (ZipChannel *) Tcl_AttemptAlloc(sizeof (*info)); if (info == NULL) { ZIPFS_ERROR(interp,"out of memory"); - goto error; + goto error; } info->zipfile = z->zipfile; info->zipentry = z; @@ -3004,14 +3121,14 @@ error: * * ZipEntryStat -- * - * This function implements the ZIP filesystem specific version - * of the library version of stat. + * This function implements the ZIP filesystem specific version + * of the library version of stat. * * Results: - * See stat documentation. + * See stat documentation. * * Side effects: - * See stat documentation. + * See stat documentation. * *------------------------------------------------------------------------- */ @@ -3028,9 +3145,9 @@ ZipEntryStat(char *path, Tcl_StatBuf *buf) memset(buf, 0, sizeof (Tcl_StatBuf)); if (z->isdir) { - buf->st_mode = S_IFDIR | 0555; + buf->st_mode = S_IFDIR | 0555; } else { - buf->st_mode = S_IFREG | 0555; + buf->st_mode = S_IFREG | 0555; } buf->st_size = z->nbyte; buf->st_mtime = z->timestamp; @@ -3047,14 +3164,14 @@ done: * * ZipEntryAccess -- * - * This function implements the ZIP filesystem specific version - * of the library version of access. + * This function implements the ZIP filesystem specific version + * of the library version of access. * * Results: - * See access documentation. + * See access documentation. * * Side effects: - * See access documentation. + * See access documentation. * *------------------------------------------------------------------------- */ @@ -3085,7 +3202,7 @@ ZipEntryAccess(char *path, int mode) static Tcl_Channel Zip_FSOpenFileChannelProc(Tcl_Interp *interp, Tcl_Obj *pathPtr, - int mode, int permissions) + int mode, int permissions) { int len; if (!(pathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return NULL; @@ -3097,14 +3214,14 @@ Zip_FSOpenFileChannelProc(Tcl_Interp *interp, Tcl_Obj *pathPtr, * * Zip_FSStatProc -- * - * This function implements the ZIP filesystem specific version - * of the library version of stat. + * This function implements the ZIP filesystem specific version + * of the library version of stat. * * Results: - * See stat documentation. + * See stat documentation. * * Side effects: - * See stat documentation. + * See stat documentation. * *------------------------------------------------------------------------- */ @@ -3122,14 +3239,14 @@ Zip_FSStatProc(Tcl_Obj *pathPtr, Tcl_StatBuf *buf) * * Zip_FSAccessProc -- * - * This function implements the ZIP filesystem specific version - * of the library version of access. + * This function implements the ZIP filesystem specific version + * of the library version of access. * * Results: - * See access documentation. + * See access documentation. * * Side effects: - * See access documentation. + * See access documentation. * *------------------------------------------------------------------------- */ @@ -3147,16 +3264,16 @@ Zip_FSAccessProc(Tcl_Obj *pathPtr, int mode) * * Zip_FSFilesystemSeparatorProc -- * - * This function returns the separator to be used for a given path. The - * object returned should have a refCount of zero + * This function returns the separator to be used for a given path. The + * object returned should have a refCount of zero * * Results: - * A Tcl object, with a refCount of zero. If the caller needs to retain a - * reference to the object, it should call Tcl_IncrRefCount, and should - * otherwise free the object. + * A Tcl object, with a refCount of zero. If the caller needs to retain a + * reference to the object, it should call Tcl_IncrRefCount, and should + * otherwise free the object. * * Side effects: - * None. + * None. * *------------------------------------------------------------------------- */ @@ -3172,23 +3289,23 @@ Zip_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr) * * Zip_FSMatchInDirectoryProc -- * - * This routine is used by the globbing code to search a directory for - * all files which match a given pattern. + * This routine is used by the globbing code to search a directory for + * all files which match a given pattern. * * Results: - * The return value is a standard Tcl result indicating whether an - * error occurred in globbing. Errors are left in interp, good - * results are lappend'ed to resultPtr (which must be a valid object). + * The return value is a standard Tcl result indicating whether an + * error occurred in globbing. Errors are left in interp, good + * results are lappend'ed to resultPtr (which must be a valid object). * * Side effects: - * None. + * None. * *------------------------------------------------------------------------- */ static int Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, - Tcl_Obj *pathPtr, const char *pattern, - Tcl_GlobTypeData *types) + Tcl_Obj *pathPtr, const char *pattern, + Tcl_GlobTypeData *types) { Tcl_HashEntry *hPtr; Tcl_HashSearch search; @@ -3200,7 +3317,7 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, if (!(normPathPtr = Tcl_FSGetNormalizedPath(NULL, pathPtr))) return -1; if (types != NULL) { - dirOnly = (types->type & TCL_GLOB_TYPE_DIR) == TCL_GLOB_TYPE_DIR; + dirOnly = (types->type & TCL_GLOB_TYPE_DIR) == TCL_GLOB_TYPE_DIR; } /* the prefix that gets prepended to results */ @@ -3213,9 +3330,9 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, Tcl_DStringAppend(&dsPref, prefix, prefixLen); if (strcmp(prefix, path) == 0) { - prefix = NULL; + prefix = NULL; } else { - strip = len + 1; + strip = len + 1; } if (prefix != NULL) { Tcl_DStringAppend(&dsPref, "/", 1); @@ -3224,20 +3341,20 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, } ReadLock(); if ((types != NULL) && (types->type == TCL_GLOB_TYPE_MOUNT)) { - l = CountSlashes(path); - if (path[len - 1] == '/') { - len--; - } else { - l++; - } - if ((pattern == NULL) || (pattern[0] == '\0')) { - pattern = "*"; - } - hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); - while (hPtr != NULL) { - ZipFile *zf = (ZipFile *) Tcl_GetHashValue(hPtr); - - if (zf->mntptlen == 0) { + l = CountSlashes(path); + if (path[len - 1] == '/') { + len--; + } else { + l++; + } + if ((pattern == NULL) || (pattern[0] == '\0')) { + pattern = "*"; + } + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + ZipFile *zf = (ZipFile *) Tcl_GetHashValue(hPtr); + + if (zf->mntptlen == 0) { ZipEntry *z = zf->topents; while (z != NULL) { int lenz = strlen(z->name); @@ -3262,13 +3379,13 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, } z = z->tnext; } - } else if ( - (zf->mntptlen > len + 1) - && (strncmp(zf->mntpt, path, len) == 0) - && (zf->mntpt[len] == '/') - && (CountSlashes(zf->mntpt) == l) - && Tcl_StringCaseMatch(zf->mntpt + len + 1, pattern, 0) - ) { + } else if ( + (zf->mntptlen > len + 1) + && (strncmp(zf->mntpt, path, len) == 0) + && (zf->mntpt[len] == '/') + && (CountSlashes(zf->mntpt) == l) + && Tcl_StringCaseMatch(zf->mntpt + len + 1, pattern, 0) + ) { if (prefix != NULL) { Tcl_DStringAppend(&dsPref, zf->mntpt, zf->mntptlen); Tcl_ListObjAppendElement(NULL, result, @@ -3279,38 +3396,38 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); } - } - hPtr = Tcl_NextHashEntry(&search); - } - goto end; + } + hPtr = Tcl_NextHashEntry(&search); + } + goto end; } if ((pattern == NULL) || (pattern[0] == '\0')) { - hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path); - if (hPtr != NULL) { - ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); - - if ((dirOnly < 0) || - (!dirOnly && !z->isdir) || - (dirOnly && z->isdir)) { - if (prefix != NULL) { - Tcl_DStringAppend(&dsPref, z->name, -1); - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(Tcl_DStringValue(&dsPref), - Tcl_DStringLength(&dsPref))); - Tcl_DStringSetLength(&dsPref, prefixLen); - } else { - Tcl_ListObjAppendElement(NULL, result, - Tcl_NewStringObj(z->name, -1)); - } - } - } - goto end; + hPtr = Tcl_FindHashEntry(&ZipFS.fileHash, path); + if (hPtr != NULL) { + ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); + + if ((dirOnly < 0) || + (!dirOnly && !z->isdir) || + (dirOnly && z->isdir)) { + if (prefix != NULL) { + Tcl_DStringAppend(&dsPref, z->name, -1); + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(Tcl_DStringValue(&dsPref), + Tcl_DStringLength(&dsPref))); + Tcl_DStringSetLength(&dsPref, prefixLen); + } else { + Tcl_ListObjAppendElement(NULL, result, + Tcl_NewStringObj(z->name, -1)); + } + } + } + goto end; } l = strlen(pattern); pat = Tcl_Alloc(len + l + 2); memcpy(pat, path, len); while ((len > 1) && (pat[len - 1] == '/')) { - --len; + --len; } if ((len > 1) || (pat[0] != '/')) { pat[len] = '/'; @@ -3320,9 +3437,9 @@ Zip_FSMatchInDirectoryProc(Tcl_Interp* interp, Tcl_Obj *result, scnt = CountSlashes(pat); for ( hPtr = Tcl_FirstHashEntry(&ZipFS.fileHash, &search); - hPtr != NULL; - hPtr = Tcl_NextHashEntry(&search) - ) { + hPtr != NULL; + hPtr = Tcl_NextHashEntry(&search) + ) { ZipEntry *z = (ZipEntry *) Tcl_GetHashValue(hPtr); if ( (dirOnly >= 0) && ((dirOnly && !z->isdir) || (!dirOnly && z->isdir)) @@ -3355,14 +3472,14 @@ end: * * Zip_FSPathInFilesystemProc -- * - * This function determines if the given path object is in the - * ZIP filesystem. + * This function determines if the given path object is in the + * ZIP filesystem. * * Results: - * TCL_OK when the path object is in the ZIP filesystem, -1 otherwise. + * TCL_OK when the path object is in the ZIP filesystem, -1 otherwise. * * Side effects: - * None. + * None. * *------------------------------------------------------------------------- */ @@ -3424,13 +3541,13 @@ endloop: * * Zip_FSListVolumesProc -- * - * Lists the currently mounted ZIP filesystem volumes. + * Lists the currently mounted ZIP filesystem volumes. * * Results: - * The list of volumes. + * The list of volumes. * * Side effects: - * None + * None * *------------------------------------------------------------------------- */ @@ -3444,14 +3561,14 @@ Zip_FSListVolumesProc(void) { * * Zip_FSFileAttrStringsProc -- * - * This function implements the ZIP filesystem dependent 'file attributes' - * subcommand, for listing the set of possible attribute strings. + * This function implements the ZIP filesystem dependent 'file attributes' + * subcommand, for listing the set of possible attribute strings. * * Results: - * An array of strings + * An array of strings * * Side effects: - * None. + * None. * *------------------------------------------------------------------------- */ @@ -3460,13 +3577,13 @@ static const char *const * Zip_FSFileAttrStringsProc(Tcl_Obj *pathPtr, Tcl_Obj** objPtrRef) { static const char *const attrs[] = { - "-uncompsize", - "-compsize", - "-offset", - "-mount", - "-archive", - "-permissions", - NULL, + "-uncompsize", + "-compsize", + "-offset", + "-mount", + "-archive", + "-permissions", + NULL, }; return attrs; } @@ -3476,24 +3593,24 @@ Zip_FSFileAttrStringsProc(Tcl_Obj *pathPtr, Tcl_Obj** objPtrRef) * * Zip_FSFileAttrsGetProc -- * - * This function implements the ZIP filesystem specific - * 'file attributes' subcommand, for 'get' operations. + * This function implements the ZIP filesystem specific + * 'file attributes' subcommand, for 'get' operations. * * Results: - * Standard Tcl return code. The object placed in objPtrRef (if TCL_OK - * was returned) is likely to have a refCount of zero. Either way we must - * either store it somewhere (e.g. the Tcl result), or Incr/Decr its - * refCount to ensure it is properly freed. + * Standard Tcl return code. The object placed in objPtrRef (if TCL_OK + * was returned) is likely to have a refCount of zero. Either way we must + * either store it somewhere (e.g. the Tcl result), or Incr/Decr its + * refCount to ensure it is properly freed. * * Side effects: - * None. + * None. * *------------------------------------------------------------------------- */ static int Zip_FSFileAttrsGetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, - Tcl_Obj **objPtrRef) + Tcl_Obj **objPtrRef) { int len, ret = TCL_OK; char *path; @@ -3540,14 +3657,14 @@ done: * * Zip_FSFileAttrsSetProc -- * - * This function implements the ZIP filesystem specific - * 'file attributes' subcommand, for 'set' operations. + * This function implements the ZIP filesystem specific + * 'file attributes' subcommand, for 'set' operations. * * Results: - * Standard Tcl return code. + * Standard Tcl return code. * * Side effects: - * None. + * None. * *------------------------------------------------------------------------- */ @@ -3556,7 +3673,7 @@ static int Zip_FSFileAttrsSetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr,Tcl_Obj *objPtr) { if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported operation", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("unsupported operation", -1)); } return TCL_ERROR; } @@ -3585,50 +3702,53 @@ Zip_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr) * * Zip_FSLoadFile -- * - * This functions deals with loading native object code. If - * the given path object refers to a file within the ZIP - * filesystem, an approriate error code is returned to delegate - * loading to the caller (by copying the file to temp store - * and loading from there). As fallback when the file refers - * to the ZIP file system but is not present, it is looked up - * relative to the executable and loaded from there when available. + * This functions deals with loading native object code. If + * the given path object refers to a file within the ZIP + * filesystem, an approriate error code is returned to delegate + * loading to the caller (by copying the file to temp store + * and loading from there). As fallback when the file refers + * to the ZIP file system but is not present, it is looked up + * relative to the executable and loaded from there when available. * * Results: - * TCL_OK on success, -1 otherwise with error number set. + * TCL_OK on success, TCL_ERROR otherwise with error message left. * * Side effects: - * Loads native code into the process address space. + * Loads native code into the process address space. * *------------------------------------------------------------------------- */ static int Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, - Tcl_FSUnloadFileProc **unloadProcPtr, int flags) + Tcl_FSUnloadFileProc **unloadProcPtr, int flags) { Tcl_FSLoadFileProc2 *loadFileProc; #ifdef ANDROID /* * Force loadFileProc to native implementation since the - * package manger already extracted the shared libraries + * package manager already extracted the shared libraries * from the APK at install time. */ loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; if (loadFileProc != NULL) { - return loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); + return loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); } Tcl_SetErrno(ENOENT); - return -1; + ZIPFS_ERROR(interp,Tcl_PosixError(interp)); + return TCL_ERROR; #else Tcl_Obj *altPath = NULL; - int ret = -1; + int ret = TCL_ERROR; if (Tcl_FSAccess(path, R_OK) == 0) { /* * EXDEV should trigger loading by copying to temp store. */ + Tcl_SetErrno(EXDEV); + ZIPFS_ERROR(interp,Tcl_PosixError(interp)); return ret; } else { Tcl_Obj *objs[2] = { NULL, NULL }; @@ -3658,14 +3778,15 @@ Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, } } if (objs[0] == NULL) { - objs[0] = TclPathPart(interp, TclGetObjNameOfExecutable(),TCL_PATH_DIRNAME); + objs[0] = TclPathPart(interp, TclGetObjNameOfExecutable(), + TCL_PATH_DIRNAME); } if (objs[0] != NULL) { - altPath = TclJoinPath(2, objs); + altPath = TclJoinPath(2, objs); if (altPath != NULL) { Tcl_IncrRefCount(altPath); if (Tcl_FSAccess(altPath, R_OK) == 0) { - path = altPath; + path = altPath; } } } @@ -3679,12 +3800,13 @@ Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, } loadFileProc = (Tcl_FSLoadFileProc2 *) tclNativeFilesystem.loadFileProc; if (loadFileProc != NULL) { - ret = loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); + ret = loadFileProc(interp, path, loadHandle, unloadProcPtr, flags); } else { - Tcl_SetErrno(ENOENT); + Tcl_SetErrno(ENOENT); + ZIPFS_ERROR(interp,Tcl_PosixError(interp)); } if (altPath != NULL) { - Tcl_DecrRefCount(altPath); + Tcl_DecrRefCount(altPath); } return ret; #endif @@ -3740,14 +3862,14 @@ const Tcl_Filesystem zipfsFilesystem = { * * TclZipfs_Init -- * - * Perform per interpreter initialization of this module. + * Perform per interpreter initialization of this module. * * Results: - * The return value is a standard Tcl result. + * The return value is a standard Tcl result. * * Side effects: - * Initializes this module if not already initialized, and adds - * module related commands to the given interpreter. + * Initializes this module if not already initialized, and adds + * module related commands to the given interpreter. * *------------------------------------------------------------------------- */ @@ -3761,35 +3883,35 @@ TclZipfs_Init(Tcl_Interp *interp) Tcl_StaticPackage(interp, "zipfs", TclZipfs_Init, TclZipfs_Init); if (!ZipFS.initialized) { #ifdef TCL_THREADS - static const Tcl_Time t = { 0, 0 }; - /* - * Inflate condition variable. - */ - Tcl_MutexLock(&ZipFSMutex); - Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, &t); - Tcl_MutexUnlock(&ZipFSMutex); + static const Tcl_Time t = { 0, 0 }; + /* + * Inflate condition variable. + */ + Tcl_MutexLock(&ZipFSMutex); + Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, &t); + Tcl_MutexUnlock(&ZipFSMutex); #endif - Tcl_FSRegister(NULL, &zipfsFilesystem); - Tcl_InitHashTable(&ZipFS.fileHash, TCL_STRING_KEYS); - Tcl_InitHashTable(&ZipFS.zipHash, TCL_STRING_KEYS); - ZipFS.initialized = ZipFS.idCount = 1; + Tcl_FSRegister(NULL, &zipfsFilesystem); + Tcl_InitHashTable(&ZipFS.fileHash, TCL_STRING_KEYS); + Tcl_InitHashTable(&ZipFS.zipHash, TCL_STRING_KEYS); + ZipFS.initialized = ZipFS.idCount = 1; } Unlock(); if(interp != NULL) { static const EnsembleImplMap initMap[] = { - {"mount", ZipFSMountObjCmd, NULL, NULL, NULL, 0}, - {"unmount", ZipFSUnmountObjCmd, NULL, NULL, NULL, 0}, - {"mkkey", ZipFSMkKeyObjCmd, NULL, NULL, NULL, 0}, - {"mkimg", ZipFSMkImgObjCmd, NULL, NULL, NULL, 0}, - {"mkzip", ZipFSMkZipObjCmd, NULL, NULL, NULL, 0}, - {"lmkimg", ZipFSLMkImgObjCmd, NULL, NULL, NULL, 0}, - {"lmkzip", ZipFSLMkZipObjCmd, NULL, NULL, NULL, 0}, - {"exists", ZipFSExistsObjCmd, NULL, NULL, NULL, 1}, - {"info", ZipFSInfoObjCmd, NULL, NULL, NULL, 1}, - {"list", ZipFSListObjCmd, NULL, NULL, NULL, 1}, + {"mount", ZipFSMountObjCmd, NULL, NULL, NULL, 0}, + {"unmount", ZipFSUnmountObjCmd, NULL, NULL, NULL, 0}, + {"mkkey", ZipFSMkKeyObjCmd, NULL, NULL, NULL, 0}, + {"mkimg", ZipFSMkImgObjCmd, NULL, NULL, NULL, 0}, + {"mkzip", ZipFSMkZipObjCmd, NULL, NULL, NULL, 0}, + {"lmkimg", ZipFSLMkImgObjCmd, NULL, NULL, NULL, 0}, + {"lmkzip", ZipFSLMkZipObjCmd, NULL, NULL, NULL, 0}, + {"exists", ZipFSExistsObjCmd, NULL, NULL, NULL, 1}, + {"info", ZipFSInfoObjCmd, NULL, NULL, NULL, 1}, + {"list", ZipFSListObjCmd, NULL, NULL, NULL, 1}, {"canonical", ZipFSCanonicalObjCmd, NULL, NULL, NULL, 1}, {"root", ZipFSRootObjCmd, NULL, NULL, NULL, 1}, - {"tcl_library", ZipFSTclLibraryObjCmd, NULL, NULL, NULL, 0}, + {"tcl_library", ZipFSTclLibraryObjCmd, NULL, NULL, NULL, 0}, {NULL, NULL, NULL, NULL, NULL, 0} }; @@ -3825,7 +3947,7 @@ TclZipfs_Init(Tcl_Interp *interp) } #if defined(_WIN32) || defined(_WIN64) -#define LIBRARY_SIZE 64 +#define LIBRARY_SIZE 64 static int ToUtf( const WCHAR *wSrc, @@ -3835,8 +3957,8 @@ ToUtf( start = dst; while (*wSrc != '\0') { - dst += Tcl_UniCharToUtf(*wSrc, dst); - wSrc++; + dst += Tcl_UniCharToUtf(*wSrc, dst); + wSrc++; } *dst = '\0'; return (int) (dst - start); @@ -3916,7 +4038,7 @@ int TclZipfs_AppHook(int *argc, char ***argv) } else if (*argc>1) { #if defined(_WIN32) || defined(_WIN64) Tcl_DString ds; - strcpy(archive, Tcl_WinTCharToUtf((*argv)[1], -1, &ds)); + strcpy(archive, Tcl_WinTCharToUtf((*argv)[1], -1, &ds)); Tcl_DStringFree(&ds); #else archive=(*argv)[1]; @@ -4004,14 +4126,14 @@ Tcl_Obj *TclZipfs_TclLibrary(void) { * * TclZipfs_Mount, TclZipfs_Unmount -- * - * Dummy version when no ZLIB support available. + * Dummy version when no ZLIB support available. * *------------------------------------------------------------------------- */ int TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, - const char *passwd) + const char *passwd) { return TclZipfs_Init(interp, 1); } -- cgit v0.12 From 7154cc9c4777ae2394afa07b79adfb6680261293 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Fri, 24 Nov 2017 11:46:34 +0000 Subject: Tweak to ensure mount points for zipfs are corralled into the //zipfs:/ prefix space --- generic/tclZipfs.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 126 insertions(+), 14 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 668eee0..2370980 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -35,11 +35,10 @@ #include "crypt.h" /* -** On windows we need VFS to look like a volume -** On Unix we need it to look like a UNC path +** TIP430 style zipfs prefix */ #define ZIPFS_VOLUME "//zipfs:/" -#define ZIPFS_VOLUME_LEN 9 +#define ZIPFS_VOLUME_LEN 9 #define ZIPFS_APP_MOUNT "//zipfs:/app" #define ZIPFS_ZIP_MOUNT "//zipfs:/lib/tcl" /* @@ -659,8 +658,88 @@ CanonicalPath(const char *root, const char *tail, Tcl_DString *dsPtr,int ZIPFSPA result=Tcl_DStringValue(dsPtr); return result; } + +/* + *------------------------------------------------------------------------- + * + * AbsolutePath -- + * + * This function computes the absolute path from a given + * (relative) path name into the specified Tcl_DString. + * + * Results: + * Returns the pointer to the absolute path contained in the + * specified Tcl_DString. + * + * Side effects: + * Modifies the specified Tcl_DString. + * + *------------------------------------------------------------------------- + */ +static char * +AbsolutePath(const char *path, +#if HAS_DRIVES + int *drvPtr, +#endif + Tcl_DString *dsPtr) +{ + char *result; + +#if HAS_DRIVES + if (drvPtr != NULL) { + *drvPtr = 0; + } +#endif + if (*path == '~') { + Tcl_DStringAppend(dsPtr, path, -1); + return Tcl_DStringValue(dsPtr); + } + if ((*path != '/') +#if HAS_DRIVES + && (*path != '\\') && + (((*path != '\0') && (strchr(drvletters, *path) == NULL)) || + (path[1] != ':')) +#endif + ) { + Tcl_DString pwd; + + /* relative path */ + Tcl_DStringInit(&pwd); + Tcl_GetCwd(NULL, &pwd); + result = Tcl_DStringValue(&pwd); +#if HAS_DRIVES + if ((result[0] != '\0') && (strchr(drvletters, result[0]) != NULL) && + (result[1] == ':')) { + if (drvPtr != NULL) { + drvPtr[0] = result[0]; + if ((drvPtr[0] >= 'a') && (drvPtr[0] <= 'z')) { + drvPtr[0] -= 'a' - 'A'; + } + } + result += 2; + } +#endif + result = CanonicalPath(result, path, dsPtr, 0); + Tcl_DStringFree(&pwd); + } else { + /* absolute path */ +#if HAS_DRIVES + if ((path[0] != '\0') && (strchr(drvletters, path[0]) != NULL) && + (path[1] == ':')) { + if (drvPtr != NULL) { + drvPtr[0] = path[0]; + if ((drvPtr[0] >= 'a') && (drvPtr[0] <= 'z')) { + drvPtr[0] -= 'a' - 'A'; + } + } + } +#endif + result = CanonicalPath("", path, dsPtr, 0); + } + return result; +} /* *------------------------------------------------------------------------- @@ -985,12 +1064,17 @@ TclZipfs_Mount( const char *mntpt, const char *passwd ) { + char *realname, *p; int i, pwlen, isNew; ZipFile *zf, zf0; ZipEntry *z; Tcl_HashEntry *hPtr; - Tcl_DString ds, fpBuf; + Tcl_DString ds, dsm, fpBuf; unsigned char *q; +#if HAS_DRIVES + int drive = 0; +#endif + ReadLock(); if (!ZipFS.initialized) { ZIPFS_ERROR(interp,"not initialized"); @@ -1024,11 +1108,31 @@ TclZipfs_Mount( Unlock(); return TCL_OK; } - hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, zipname); + Tcl_DStringInit(&ds); +#if HAS_DRIVES + p = AbsolutePath(zipname, &drive, &ds); +#else + p = AbsolutePath(zipname, &ds); +#endif + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, p); if (hPtr != NULL) { +#if HAS_DRIVES + if (drive == zf->mntdrv) { + Tcl_Obj *string; + char drvbuf[3]; + + drvbuf[0] = zf->mntdrv; + drvbuf[1] = ':'; + drvbuf[2] = '\0'; + string = Tcl_NewStringObj(drvbuf, 2); + Tcl_AppendToObj(string, zf->mntpt, zf->mntptlen); + Tcl_SetObjResult(interp, string); + } +#else if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { Tcl_SetObjResult(interp,Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); } +#endif } Unlock(); return TCL_OK; @@ -1036,23 +1140,31 @@ TclZipfs_Mount( Unlock(); pwlen = 0; if (passwd != NULL) { - pwlen = strlen(passwd); - if ((pwlen > 255) || (strchr(passwd, 0xff) != NULL)) { - if (interp) { - Tcl_SetObjResult(interp, - Tcl_NewStringObj("illegal password", -1)); + pwlen = strlen(passwd); + if ((pwlen > 255) || (strchr(passwd, 0xff) != NULL)) { + if (interp) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal password", -1)); + } + return TCL_ERROR; } - return TCL_ERROR; - } } if (ZipFSOpenArchive(interp, zipname, 1, &zf0) != TCL_OK) { return TCL_ERROR; } + Tcl_DStringInit(&ds); +#if HAS_DRIVES + realname = AbsolutePath(zipname, NULL, &ds); +#else + realname = AbsolutePath(zipname, &ds); +#endif /* - * Mount point can come from Tcl_GetNameOfExecutable() - * which sometimes is a relative or otherwise denormalized path. + * Mount point sometimes is a relative or otherwise denormalized path. * But an absolute name is needed as mount point here. */ + Tcl_DStringInit(&dsm); + mntpt = CanonicalPath("",mntpt, &dsm, 1); + WriteLock(); hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, zipname, &isNew); if (!isNew) { -- cgit v0.12 From 99dc87a51d1e450b24f642aacbda0df262402a94 Mon Sep 17 00:00:00 2001 From: tne Date: Sat, 25 Nov 2017 10:54:15 +0000 Subject: Restoring the Makefile.in for the win/ directory after an unfortunate copy/paste error --- win/Makefile.in | 1444 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 835 insertions(+), 609 deletions(-) diff --git a/win/Makefile.in b/win/Makefile.in index 5f81b74..99c8b77 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -1,26 +1,21 @@ -# This file is a Makefile for Tk. 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. - -TCLVERSION = @TCL_VERSION@ -TCLPATCHL = @TCL_PATCH_LEVEL@ -VERSION = @TK_VERSION@ -PATCH_LEVEL = @TK_PATCH_LEVEL@ - -#---------------------------------------------------------------- -# 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 -# the configuration script). -#---------------------------------------------------------------- - -# Default top-level directories in which to install architecture- -# specific files (exec_prefix) and machine-independent files such -# as scripts (prefix). The values specified here may be overridden -# at configure-time with the --exec-prefix and --prefix options -# to the "configure" script. +# +# 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. + +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 the configuration script). +#-------------------------------------------------------------------------- + +# Default top-level directories in which to install architecture-specific +# files (exec_prefix) and machine-independent files such as scripts (prefix). +# The values specified here may be overridden at configure-time with the +# --exec-prefix and --prefix options to the "configure" script. prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -30,159 +25,164 @@ includedir = @includedir@ datarootdir = @datarootdir@ 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) +# 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 = -# Directory from which applications will reference the library of Tk -# scripts (note: you can set the TK_LIBRARY environment variable at -# run-time to override this value): -TK_LIBRARY = $(prefix)/lib/tk$(VERSION) +# Directory from which applications will reference the library of Tcl scripts +# (note: you can set the TCL_LIBRARY environment variable at run-time to +# override this value): +TCL_LIBRARY = $(prefix)/lib/tcl$(VERSION) # Path to use at runtime to refer to LIB_INSTALL_DIR: LIB_RUNTIME_DIR = $(libdir) -# Directory in which to install the program wish: +# Directory in which to install the program tclsh: BIN_INSTALL_DIR = $(INSTALL_ROOT)$(bindir) -# Directory in which to install the .a or .so binary for the Tk library: +# Directory in which to install the .a or .so binary for the Tcl library: LIB_INSTALL_DIR = $(INSTALL_ROOT)$(libdir) -# Path name to use when installing library scripts: -SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TK_LIBRARY) +# Path name to use when installing library scripts. +SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TCL_LIBRARY) -# Directory in which to install the include file tk.h: +# Directory in which to install the include file tcl.h: INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(includedir) -# Directory in which to (optionally) install the private tk headers: +# Directory in which to (optionally) install the private tcl headers: PRIVATE_INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(includedir) -# Top-level directory for manual entries: +# Top-level directory in which to install manual entries: MAN_INSTALL_DIR = $(INSTALL_ROOT)$(mandir) -# Directory in which to install manual entry for wish: -MAN1_INSTALL_DIR = $(MAN_INSTALL_DIR)/man1 +# Directory in which to install manual entry for tclsh: +MAN1_INSTALL_DIR = $(MAN_INSTALL_DIR)/man1 -# Directory in which to install manual entries for Tk's C library -# procedures: -MAN3_INSTALL_DIR = $(MAN_INSTALL_DIR)/man3 +# 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 -# Tk commands: -MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann +# Directory in which to install manual entries for the built-in Tcl commands: +MANN_INSTALL_DIR = $(MAN_INSTALL_DIR)/mann # Libraries built with optimization switches have this additional extension -TK_DBGX = @TK_DBGX@ - -# Directory in which to install the pkgIndex.tcl file for loadable Tk -PKG_INSTALL_DIR = $(LIB_INSTALL_DIR)/tk$(VERSION)$(TK_DBGX) - -# Package index file for loadable Tk -PKG_INDEX = $(PKG_INSTALL_DIR)/pkgIndex.tcl - -# The directory containing the Tcl source and header files. -TCL_SRC_DIR = @TCL_SRC_DIR@ +TCL_DBGX = @TCL_DBGX@ -# The directory containing the Tcl library archive file appropriate -# for this version of Tk: -TCL_BIN_DIR = @TCL_BIN_DIR@ +# warning flags +CFLAGS_WARNING = @CFLAGS_WARNING@ -# The directory containing the Tcl sources and headers appropriate -# for this version of Tk ("srcdir" will be replaced or has already -# been replaced by the configure script): -TCL_GENERIC_DIR = @TCL_SRC_DIR@/generic +# The default switches for optimization or debugging +CFLAGS_DEBUG = @CFLAGS_DEBUG@ +CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ -# The directory containing the platform specific Tcl sources and headers -# appropriate for this version of Tk: -TCL_PLATFORM_DIR = @TCL_SRC_DIR@/win +# To change the compiler switches, for example to change from optimization to +# debugging symbols, change the following line: +#CFLAGS = $(CFLAGS_DEBUG) +#CFLAGS = $(CFLAGS_OPTIMIZE) +#CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) +CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -DUNICODE -D_UNICODE -D_ATL_XP_TARGETING + +# To compile without backward compatibility and deprecated code uncomment the +# following +NO_DEPRECATED_FLAGS = +#NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED + +# To enable compilation debugging reverse the comment characters on one of the +# following lines. +COMPILE_DEBUG_FLAGS = +#COMPILE_DEBUG_FLAGS = -DTCL_COMPILE_DEBUG +#COMPILE_DEBUG_FLAGS = -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS -TCL_TOOL_DIR = @TCL_SRC_DIR@/tools +SRC_DIR = @srcdir@ +ROOT_DIR = @srcdir@/.. +TOP_DIR = $(shell cd @srcdir@/..; pwd -P) +GENERIC_DIR = $(TOP_DIR)/generic +TOMMATH_DIR = $(TOP_DIR)/libtommath +WIN_DIR = $(TOP_DIR)/win +COMPAT_DIR = $(TOP_DIR)/compat +PKGS_DIR = $(TOP_DIR)/pkgs +ZLIB_DIR = $(COMPAT_DIR)/zlib # Converts a POSIX path to a Windows native path. CYGPATH = @CYGPATH@ -# The name of the Tcl library. -TCL_LIB_FILE = "$(shell $(CYGPATH) '@TCL_BIN_DIR@/@TCL_LIB_FILE@')" -TCL_STUB_LIB_FILE = "$(shell $(CYGPATH) '@TCL_BIN_DIR@/@TCL_STUB_LIB_FILE@')" - -SRC_DIR = @srcdir@ -ROOT_DIR = $(SRC_DIR)/.. -WIN_DIR = $(SRC_DIR) -UNIX_DIR = $(SRC_DIR)/../unix -GENERIC_DIR = $(SRC_DIR)/../generic -TTK_DIR = $(GENERIC_DIR)/ttk -BITMAP_DIR = $(ROOT_DIR)/bitmaps -XLIB_DIR = $(ROOT_DIR)/xlib -RC_DIR = $(WIN_DIR)/rc - -ROOT_DIR_NATIVE = $(shell $(CYGPATH) '$(ROOT_DIR)' | sed 's!\\!/!g') -WIN_DIR_NATIVE = $(shell $(CYGPATH) '$(WIN_DIR)' | sed 's!\\!/!g') -GENERIC_DIR_NATIVE = $(shell $(CYGPATH) '$(GENERIC_DIR)' | sed 's!\\!/!g') -BITMAP_DIR_NATIVE = $(ROOT_DIR_NATIVE)/bitmaps -XLIB_DIR_NATIVE = $(ROOT_DIR_NATIVE)/xlib -RC_DIR_NATIVE = $(WIN_DIR_NATIVE)/rc -TCL_GENERIC_NATIVE = $(shell $(CYGPATH) '$(TCL_GENERIC_DIR)' | sed 's!\\!/!g') -TCL_PLATFORM_NATIVE = $(shell $(CYGPATH) '$(TCL_PLATFORM_DIR)' | sed 's!\\!/!g') -TCL_SRC_DIR_NATIVE = $(shell $(CYGPATH) '$(TCL_SRC_DIR)' | sed 's!\\!/!g') - +libdir_native = $(shell $(CYGPATH) '$(libdir)') +bindir_native = $(shell $(CYGPATH) '$(bindir)') +includedir_native = $(shell $(CYGPATH) '$(includedir)') +mandir_native = $(shell $(CYGPATH) '$(mandir)') +TCL_LIBRARY_NATIVE = $(shell $(CYGPATH) '$(TCL_LIBRARY)') +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)') +ZLIB_DIR_NATIVE = $(shell $(CYGPATH) '$(ZLIB_DIR)') +#GENERIC_DIR_NATIVE = $(GENERIC_DIR) +#TOMMATH_DIR_NATIVE = $(TOMMATH_DIR) +#WIN_DIR_NATIVE = $(WIN_DIR) +#ROOT_DIR_NATIVE = $(ROOT_DIR) + +# Fully qualify library path so that `make test` +# does not depend on the current directory. +LIBRARY_DIR1 = $(shell cd '$(ROOT_DIR_NATIVE)/library' ; pwd -P) +LIBRARY_DIR = $(shell $(CYGPATH) '$(LIBRARY_DIR1)') DLLSUFFIX = @DLLSUFFIX@ LIBSUFFIX = @LIBSUFFIX@ EXESUFFIX = @EXESUFFIX@ -TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@ -TK_LIB_FILE = @TK_LIB_FILE@ -TK_DLL_FILE = @TK_DLL_FILE@ -TEST_DLL_FILE = tktest$(VER)${DLLSUFFIX} -TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${LIBSUFFIX} - -SHARED_LIBRARIES = $(TK_DLL_FILE) $(TK_STUB_LIB_FILE) -STATIC_LIBRARIES = $(TK_LIB_FILE) - -WISH = wish$(VER)${EXESUFFIX} -TKTEST = tktest${EXEEXT} +VER = @TCL_MAJOR_VERSION@@TCL_MINOR_VERSION@ +DOTVER = @TCL_MAJOR_VERSION@.@TCL_MINOR_VERSION@ +DDEVER = @TCL_DDE_MAJOR_VERSION@@TCL_DDE_MINOR_VERSION@ +DDEDOTVER = @TCL_DDE_MAJOR_VERSION@.@TCL_DDE_MINOR_VERSION@ +REGVER = @TCL_REG_MAJOR_VERSION@@TCL_REG_MINOR_VERSION@ +REGDOTVER = @TCL_REG_MAJOR_VERSION@.@TCL_REG_MINOR_VERSION@ + +TCL_ZIP_FILE = @TCL_ZIP_FILE@ +TCL_VFS_PATH = libtcl.vfs/tcl_library +TCL_VFS_ROOT = libtcl.vfs + + +TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ +TCL_DLL_FILE = @TCL_DLL_FILE@ +TCL_LIB_FILE = @TCL_LIB_FILE@ +DDE_DLL_FILE = tcldde$(DDEVER)${DLLSUFFIX} +DDE_LIB_FILE = @LIBPREFIX@tcldde$(DDEVER)${LIBSUFFIX} +REG_DLL_FILE = tclreg$(REGVER)${DLLSUFFIX} +REG_LIB_FILE = @LIBPREFIX@tclreg$(REGVER)${LIBSUFFIX} +TEST_DLL_FILE = tcltest$(VER)${DLLSUFFIX} +TEST_LIB_FILE = @LIBPREFIX@tcltest$(VER)${LIBSUFFIX} +ZLIB_DLL_FILE = zlib1.dll + +SHARED_LIBRARIES = $(TCL_DLL_FILE) @ZLIB_DLL_FILE@ +STATIC_LIBRARIES = $(TCL_LIB_FILE) + +TCLSH = tclsh$(VER)${EXESUFFIX} CAT32 = cat32$(EXEEXT) MAN2TCL = man2tcl$(EXEEXT) -@SET_MAKE@ +# For cross-compiled builds, TCL_EXE is the name of a tclsh executable that is +# available *BEFORE* running make for the first time. Certain build targets +# (make genstubs, make install) need it to be available on the PATH. This +# executable should *NOT* be required just to do a normal build although +# it can be required to run make dist. +TCL_EXE = @TCL_EXE@ -# 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):$(TTK_DIR):$(WIN_DIR):$(UNIX_DIR):$(XLIB_DIR):$(RC_DIR) - -# warning flags -CFLAGS_WARNING = @CFLAGS_WARNING@ - -# The default switches for optimization or debugging -CFLAGS_DEBUG = @CFLAGS_DEBUG@ -CFLAGS_OPTIMIZE = @CFLAGS_OPTIMIZE@ - -# The default switches for optimization or debugging -LDFLAGS_DEBUG = @LDFLAGS_DEBUG@ -LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ +@SET_MAKE@ -# To change the compiler switches, for example to change from optimization to -# debugging symbols, change the following line: -#CFLAGS = $(CFLAGS_DEBUG) -#CFLAGS = $(CFLAGS_OPTIMIZE) -#CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) -CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -DUNICODE -D_UNICODE -D_ATL_XP_TARGETING +# Setting the VPATH variable to a list of paths will cause the Makefile to +# look into these paths when resolving .c to .obj dependencies. -# Special compiler flags to use when building man2tcl on Windows. -MAN2TCLFLAGS = @MAN2TCLFLAGS@ +VPATH = $(GENERIC_DIR):$(TOMMATH_DIR):$(WIN_DIR):$(COMPAT_DIR):$(ZLIB_DIR) AR = @AR@ RANLIB = @RANLIB@ CC = @CC@ RC = @RC@ RES = @RES@ -TK_RES = @TK_RES@ -AC_FLAGS = @EXTRA_CFLAGS@ @DEFS@ @TCL_DEFS@ +AC_FLAGS = @EXTRA_CFLAGS@ @DEFS@ CPPFLAGS = @CPPFLAGS@ +LDFLAGS_DEBUG = @LDFLAGS_DEBUG@ +LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ LDFLAGS = @LDFLAGS@ @LDFLAGS_DEFAULT@ LDFLAGS_CONSOLE = @LDFLAGS_CONSOLE@ LDFLAGS_WINDOW = @LDFLAGS_WINDOW@ @@ -193,323 +193,512 @@ SHLIB_LD = @SHLIB_LD@ SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ SHLIB_CFLAGS = @SHLIB_CFLAGS@ SHLIB_SUFFIX = @SHLIB_SUFFIX@ -VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@ -DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@ -LIBS = $(TCL_STUB_LIB_FILE) @LIBS@ @LIBS_GUI@ +LIBS = @LIBS@ $(shell $(CYGPATH) '@ZLIB_LIBS@') + RMDIR = rm -rf MKDIR = mkdir -p SHELL = @SHELL@ RM = rm -f COPY = cp -BUILD_TCLSH = @BUILD_TCLSH@ - -# Tk does not used deprecated Tcl constructs so it should -# compile fine with -DTCL_NO_DEPRECATED. To remove its own -# set of deprecated code uncomment the second line. -NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -#NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED +### +# Tip 430 - ZipFS Modifications +### -# TCL_EXE is the name of a tclsh executable that is available *BEFORE* -# running make for the first time. Certain build targets (make genstubs) -# need it to be available on the PATH. This executable should *NOT* be -# required just to do a normal build although it can be required to run -# make dist. -TCL_EXE = @TCLSH_PROG@ +TCL_ZIP_FILE = @TCL_ZIP_FILE@ +TCL_VFS_PATH = libtcl.vfs/tcl_library +TCL_VFS_ROOT = libtcl.vfs -CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ --I"${GENERIC_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \ --I"${XLIB_DIR_NATIVE}" -I"${BITMAP_DIR_NATIVE}" \ --I"${TCL_GENERIC_NATIVE}" -I"${TCL_PLATFORM_NATIVE}" \ -${AC_FLAGS} $(NO_DEPRECATED_FLAGS) -DUSE_TCL_STUBS +HOST_CC = @CC_FOR_BUILD@ +HOST_EXEEXT = @EXEEXT_FOR_BUILD@ +HOST_OBJEXT = @OBJEXT_FOR_BUILD@ +ZIPFS_BUILD = @ZIPFS_BUILD@ +NATIVE_ZIP = @ZIP_PROG@ +ZIP_PROG_OPTIONS = @ZIP_PROG_OPTIONS@ +ZIP_PROG_VFSSEARCH = @ZIP_PROG_VFSSEARCH@ +SHARED_BUILD = @SHARED_BUILD@ +INSTALL_MSGS = @INSTALL_MSGS@ +INSTALL_LIBRARIES = @INSTALL_LIBRARIES@ + +# Minizip +MINIZIP_OBJS = \ + adler32.$(HOST_OBJEXT) \ + compress.$(HOST_OBJEXT) \ + crc32.$(HOST_OBJEXT) \ + deflate.$(HOST_OBJEXT) \ + infback.$(HOST_OBJEXT) \ + inffast.$(HOST_OBJEXT) \ + inflate.$(HOST_OBJEXT) \ + inftrees.$(HOST_OBJEXT) \ + ioapi.$(HOST_OBJEXT) \ + iowin32.$(HOST_OBJEXT) \ + trees.$(HOST_OBJEXT) \ + uncompr.$(HOST_OBJEXT) \ + zip.$(HOST_OBJEXT) \ + zutil.$(HOST_OBJEXT) \ + minizip.$(HOST_OBJEXT) + +ZIP_INSTALL_OBJS = @ZIP_INSTALL_OBJS@ + +CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${TCL_SHLIB_CFLAGS} \ +-I"${ZLIB_DIR_NATIVE}" -I"${GENERIC_DIR_NATIVE}" \ +-DMP_PREC=4 -I"${TOMMATH_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \ +${AC_FLAGS} ${COMPILE_DEBUG_FLAGS} ${NO_DEPRECATED_FLAGS} CC_OBJNAME = @CC_OBJNAME@ CC_EXENAME = @CC_EXENAME@ -# Tk 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 = cp -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} - -WISH_OBJS = \ - winMain.$(OBJEXT) - -TKTEST_OBJS = \ - tkSquare.$(OBJEXT) \ - tkTest.$(OBJEXT) \ - tkOldTest.$(OBJEXT) \ - tkWinTest.$(OBJEXT) - -XLIB_OBJS = \ - xcolors.$(OBJEXT) \ - xdraw.$(OBJEXT) \ - xgc.$(OBJEXT) \ - ximage.$(OBJEXT) \ - xutil.$(OBJEXT) - -TK_OBJS = \ - tkConsole.$(OBJEXT) \ - tkUnixMenubu.$(OBJEXT) \ - tkUnixScale.$(OBJEXT) \ - $(XLIB_OBJS) \ - tkWin3d.$(OBJEXT) \ - tkWin32Dll.$(OBJEXT) \ - tkWinButton.$(OBJEXT) \ - tkWinClipboard.$(OBJEXT) \ - tkWinColor.$(OBJEXT) \ - tkWinConfig.$(OBJEXT) \ - tkWinCursor.$(OBJEXT) \ - tkWinDialog.$(OBJEXT) \ - tkWinDraw.$(OBJEXT) \ - tkWinEmbed.$(OBJEXT) \ - tkWinFont.$(OBJEXT) \ - tkWinImage.$(OBJEXT) \ - tkWinInit.$(OBJEXT) \ - tkWinKey.$(OBJEXT) \ - tkWinMenu.$(OBJEXT) \ - tkWinPixmap.$(OBJEXT) \ - tkWinPointer.$(OBJEXT) \ - tkWinRegion.$(OBJEXT) \ - tkWinScrlbr.$(OBJEXT) \ - tkWinSend.$(OBJEXT) \ - tkWinSendCom.$(OBJEXT) \ - tkWinWindow.$(OBJEXT) \ - tkWinWm.$(OBJEXT) \ - tkWinX.$(OBJEXT) \ - stubs.$(OBJEXT) \ - tk3d.$(OBJEXT) \ - tkArgv.$(OBJEXT) \ - tkAtom.$(OBJEXT) \ - tkBind.$(OBJEXT) \ - tkBitmap.$(OBJEXT) \ - tkBusy.$(OBJEXT) \ - tkButton.$(OBJEXT) \ - tkCanvArc.$(OBJEXT) \ - tkCanvBmap.$(OBJEXT) \ - tkCanvImg.$(OBJEXT) \ - tkCanvLine.$(OBJEXT) \ - tkCanvPoly.$(OBJEXT) \ - tkCanvPs.$(OBJEXT) \ - tkCanvText.$(OBJEXT) \ - tkCanvUtil.$(OBJEXT) \ - tkCanvWind.$(OBJEXT) \ - tkCanvas.$(OBJEXT) \ - tkClipboard.$(OBJEXT) \ - tkCmds.$(OBJEXT) \ - tkColor.$(OBJEXT) \ - tkConfig.$(OBJEXT) \ - tkCursor.$(OBJEXT) \ - tkEntry.$(OBJEXT) \ - tkError.$(OBJEXT) \ - tkEvent.$(OBJEXT) \ - tkFileFilter.$(OBJEXT) \ - tkFocus.$(OBJEXT) \ - tkFont.$(OBJEXT) \ - tkFrame.$(OBJEXT) \ - tkGC.$(OBJEXT) \ - tkGeometry.$(OBJEXT) \ - tkGet.$(OBJEXT) \ - tkGrab.$(OBJEXT) \ - tkGrid.$(OBJEXT) \ - tkImage.$(OBJEXT) \ - tkImgBmap.$(OBJEXT) \ - tkImgGIF.$(OBJEXT) \ - tkImgPNG.$(OBJEXT) \ - tkImgPPM.$(OBJEXT) \ - tkImgPhoto.$(OBJEXT) \ - tkImgPhInstance.$(OBJEXT) \ - tkImgUtil.$(OBJEXT) \ - tkListbox.$(OBJEXT) \ - tkMacWinMenu.$(OBJEXT) \ - tkMain.$(OBJEXT) \ - tkMain2.$(OBJEXT) \ - tkMenu.$(OBJEXT) \ - tkMenubutton.$(OBJEXT) \ - tkMenuDraw.$(OBJEXT) \ - tkMessage.$(OBJEXT) \ - tkPanedWindow.$(OBJEXT) \ - tkObj.$(OBJEXT) \ - tkOldConfig.$(OBJEXT) \ - tkOption.$(OBJEXT) \ - tkPack.$(OBJEXT) \ - tkPlace.$(OBJEXT) \ - tkPointer.$(OBJEXT) \ - tkRectOval.$(OBJEXT) \ - tkScale.$(OBJEXT) \ - tkScrollbar.$(OBJEXT) \ - tkSelect.$(OBJEXT) \ - tkStyle.$(OBJEXT) \ - tkText.$(OBJEXT) \ - tkTextBTree.$(OBJEXT) \ - tkTextDisp.$(OBJEXT) \ - tkTextImage.$(OBJEXT) \ - tkTextIndex.$(OBJEXT) \ - tkTextMark.$(OBJEXT) \ - tkTextTag.$(OBJEXT) \ - tkTextWind.$(OBJEXT) \ - tkTrig.$(OBJEXT) \ - tkUndo.$(OBJEXT) \ - tkUtil.$(OBJEXT) \ - tkVisual.$(OBJEXT) \ - tkStubInit.$(OBJEXT) \ - tkWindow.$(OBJEXT) \ - $(TTK_OBJS) - -TTK_OBJS = \ - ttkWinMonitor.$(OBJEXT) \ - ttkWinTheme.$(OBJEXT) \ - ttkWinXPTheme.$(OBJEXT) \ - ttkBlink.$(OBJEXT) \ - ttkButton.$(OBJEXT) \ - ttkCache.$(OBJEXT) \ - ttkClamTheme.$(OBJEXT) \ - ttkClassicTheme.$(OBJEXT) \ - ttkDefaultTheme.$(OBJEXT) \ - ttkElements.$(OBJEXT) \ - ttkEntry.$(OBJEXT) \ - ttkFrame.$(OBJEXT) \ - ttkImage.$(OBJEXT) \ - ttkInit.$(OBJEXT) \ - ttkLabel.$(OBJEXT) \ - ttkLayout.$(OBJEXT) \ - ttkManager.$(OBJEXT) \ - ttkNotebook.$(OBJEXT) \ - ttkPanedwindow.$(OBJEXT) \ - ttkProgress.$(OBJEXT) \ - ttkScale.$(OBJEXT) \ - ttkScrollbar.$(OBJEXT) \ - ttkScroll.$(OBJEXT) \ - ttkSeparator.$(OBJEXT) \ - ttkSquare.$(OBJEXT) \ - ttkState.$(OBJEXT) \ - ttkTagSet.$(OBJEXT) \ - ttkTheme.$(OBJEXT) \ - ttkTrace.$(OBJEXT) \ - ttkTrack.$(OBJEXT) \ - ttkTreeview.$(OBJEXT) \ - ttkWidget.$(OBJEXT) \ - ttkStubInit.$(OBJEXT) +STUB_CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ +-I"${GENERIC_DIR_NATIVE}" -DMP_PREC=4 -I"${TOMMATH_DIR_NATIVE}" \ +-I"${WIN_DIR_NATIVE}" ${AC_FLAGS} \ +${COMPILE_DEBUG_FLAGS} + +TCLTEST_OBJS = \ + tclTest.$(OBJEXT) \ + tclTestObj.$(OBJEXT) \ + tclTestProcBodyObj.$(OBJEXT) \ + tclThreadTest.$(OBJEXT) \ + tclWinTest.$(OBJEXT) + +GENERIC_OBJS = \ + regcomp.$(OBJEXT) \ + regexec.$(OBJEXT) \ + regfree.$(OBJEXT) \ + regerror.$(OBJEXT) \ + tclAlloc.$(OBJEXT) \ + tclAssembly.$(OBJEXT) \ + tclAsync.$(OBJEXT) \ + tclBasic.$(OBJEXT) \ + tclBinary.$(OBJEXT) \ + tclCkalloc.$(OBJEXT) \ + tclClock.$(OBJEXT) \ + tclCmdAH.$(OBJEXT) \ + tclCmdIL.$(OBJEXT) \ + tclCmdMZ.$(OBJEXT) \ + tclCompCmds.$(OBJEXT) \ + tclCompCmdsGR.$(OBJEXT) \ + tclCompCmdsSZ.$(OBJEXT) \ + tclCompExpr.$(OBJEXT) \ + tclCompile.$(OBJEXT) \ + tclConfig.$(OBJEXT) \ + tclDate.$(OBJEXT) \ + tclDictObj.$(OBJEXT) \ + tclDisassemble.$(OBJEXT) \ + tclEncoding.$(OBJEXT) \ + tclEnsemble.$(OBJEXT) \ + tclEnv.$(OBJEXT) \ + tclEvent.$(OBJEXT) \ + tclExecute.$(OBJEXT) \ + tclFCmd.$(OBJEXT) \ + tclFileName.$(OBJEXT) \ + tclGet.$(OBJEXT) \ + tclHash.$(OBJEXT) \ + tclHistory.$(OBJEXT) \ + tclIndexObj.$(OBJEXT) \ + tclInterp.$(OBJEXT) \ + tclIO.$(OBJEXT) \ + tclIOCmd.$(OBJEXT) \ + tclIOGT.$(OBJEXT) \ + tclIORChan.$(OBJEXT) \ + tclIORTrans.$(OBJEXT) \ + tclIOSock.$(OBJEXT) \ + tclIOUtil.$(OBJEXT) \ + tclLink.$(OBJEXT) \ + tclLiteral.$(OBJEXT) \ + tclListObj.$(OBJEXT) \ + tclLoad.$(OBJEXT) \ + tclMain.$(OBJEXT) \ + tclMain2.$(OBJEXT) \ + tclNamesp.$(OBJEXT) \ + tclNotify.$(OBJEXT) \ + tclOO.$(OBJEXT) \ + tclOOBasic.$(OBJEXT) \ + tclOOCall.$(OBJEXT) \ + tclOODefineCmds.$(OBJEXT) \ + tclOOInfo.$(OBJEXT) \ + tclOOMethod.$(OBJEXT) \ + tclOOStubInit.$(OBJEXT) \ + tclObj.$(OBJEXT) \ + tclOptimize.$(OBJEXT) \ + tclPanic.$(OBJEXT) \ + tclParse.$(OBJEXT) \ + tclPathObj.$(OBJEXT) \ + tclPipe.$(OBJEXT) \ + tclPkg.$(OBJEXT) \ + tclPkgConfig.$(OBJEXT) \ + tclPosixStr.$(OBJEXT) \ + tclPreserve.$(OBJEXT) \ + tclProc.$(OBJEXT) \ + tclRegexp.$(OBJEXT) \ + tclResolve.$(OBJEXT) \ + tclResult.$(OBJEXT) \ + tclScan.$(OBJEXT) \ + tclStringObj.$(OBJEXT) \ + tclStrToD.$(OBJEXT) \ + tclStubInit.$(OBJEXT) \ + tclThread.$(OBJEXT) \ + tclThreadAlloc.$(OBJEXT) \ + tclThreadJoin.$(OBJEXT) \ + tclThreadStorage.$(OBJEXT) \ + tclTimer.$(OBJEXT) \ + tclTomMathInterface.$(OBJEXT) \ + tclTrace.$(OBJEXT) \ + tclUtf.$(OBJEXT) \ + tclUtil.$(OBJEXT) \ + tclVar.$(OBJEXT) \ + tclZipfs.$(OBJEXT) \ + tclZlib.$(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_and.${OBJEXT} \ + bn_mp_clamp.${OBJEXT} \ + bn_mp_clear.${OBJEXT} \ + bn_mp_clear_multi.${OBJEXT} \ + bn_mp_cmp.${OBJEXT} \ + bn_mp_cmp_d.${OBJEXT} \ + bn_mp_cmp_mag.${OBJEXT} \ + bn_mp_cnt_lsb.${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_expt_d.${OBJEXT} \ + bn_mp_expt_d_ex.${OBJEXT} \ + bn_mp_get_int.${OBJEXT} \ + bn_mp_get_long.${OBJEXT} \ + bn_mp_get_long_long.${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_set_int.${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_neg.${OBJEXT} \ + bn_mp_or.${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_set_int.${OBJEXT} \ + bn_mp_set_long.${OBJEXT} \ + bn_mp_set_long_long.${OBJEXT} \ + bn_mp_shrink.${OBJEXT} \ + bn_mp_sqr.${OBJEXT} \ + bn_mp_sqrt.${OBJEXT} \ + bn_mp_sub.${OBJEXT} \ + bn_mp_sub_d.${OBJEXT} \ + bn_mp_to_unsigned_bin.${OBJEXT} \ + bn_mp_to_unsigned_bin_n.${OBJEXT} \ + bn_mp_toom_mul.${OBJEXT} \ + bn_mp_toom_sqr.${OBJEXT} \ + bn_mp_toradix_n.${OBJEXT} \ + bn_mp_unsigned_bin_size.${OBJEXT} \ + bn_mp_xor.${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) \ + tclWinFCmd.$(OBJEXT) \ + tclWinFile.$(OBJEXT) \ + tclWinInit.$(OBJEXT) \ + tclWinLoad.$(OBJEXT) \ + tclWinNotify.$(OBJEXT) \ + tclWinPipe.$(OBJEXT) \ + tclWinSock.$(OBJEXT) \ + tclWinThrd.$(OBJEXT) \ + tclWinTime.$(OBJEXT) + +DDE_OBJS = tclWinDde.$(OBJEXT) + +REG_OBJS = tclWinReg.$(OBJEXT) STUB_OBJS = \ - tkStubLib.$(OBJEXT) \ - ttkStubLib.$(OBJEXT) + tclStubLib.$(OBJEXT) \ + tclTomMathStubLib.$(OBJEXT) \ + tclOOStubLib.$(OBJEXT) -TCL_DOCS = "$(TCL_SRC_DIR_NATIVE)/doc/*.[13n]" -TK_DOCS = "$(ROOT_DIR_NATIVE)/doc/*.[13n]" -CORE_DOCS = $(TCL_DOCS) $(TK_DOCS) +TCLSH_OBJS = tclAppInit.$(OBJEXT) -DEMOPROGS = browse hello ixset rmt rolodex square tcolor timer widget +ZLIB_OBJS = \ + adler32.$(OBJEXT) \ + compress.$(OBJEXT) \ + crc32.$(OBJEXT) \ + deflate.$(OBJEXT) \ + infback.$(OBJEXT) \ + inffast.$(OBJEXT) \ + inflate.$(OBJEXT) \ + inftrees.$(OBJEXT) \ + trees.$(OBJEXT) \ + uncompr.$(OBJEXT) \ + zutil.$(OBJEXT) -SHELL_ENV = \ - @TCL_LIBRARY="$(TCL_SRC_DIR_NATIVE)/library"; export TCL_LIBRARY; \ - TK_LIBRARY="$(ROOT_DIR_NATIVE)/library"; export TK_LIBRARY; \ - PATH="$(TCL_BIN_DIR):$(PATH)"; export PATH; +TCL_OBJS = ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} @ZLIB_OBJS@ -### -# Tip 430 - ZipFS Modifications -### -TK_ZIP_FILE = libtk_${MAJOR_VERSION}_${MINOR_VERSION}_${PATCH_LEVEL}.zip -TK_VFS_PATH = libtk.vfs/tk_library -TK_VFS_ROOT = libtk.vfs -TCL_ZIPFS_SUPPORT = @TCL_ZIPFS_SUPPORT@ -TCL_ZIPFS_FLAG = @TCL_ZIPFS_FLAG@ -TCL_ZIPFS_OBJS = -ZIP_PROG = @ZIP_PROG@ -ZIP_PROG_OPTIONS = @ZIP_PROG_OPTIONS@ -ZIP_PROG_VFSSEARCH = @ZIP_PROG_VFSSEARCH@ -SHARED_BUILD = @SHARED_BUILD@ +TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n] -ifeq (${TCL_ZIPFS_SUPPORT},1) - TCL_ZIPFS_OBJS=${TK_ZIP_FILE} -endif -ifeq (${TCL_ZIPFS_SUPPORT},2) - TCL_ZIPFS_OBJS=${TK_ZIP_FILE} -endif +all: binaries libraries doc packages -# Main targets. The default target -- all -- builds the binaries, -# performs any post processing on libraries or documents. +tcltest: $(TCLSH) $(TEST_DLL_FILE) -all: binaries libraries doc +binaries: $(TCL_STUB_LIB_FILE) @LIBRARIES@ winextensions $(TCLSH) -binaries: @LIBRARIES@ $(WISH) +winextensions: ${DDE_DLL_FILE} ${REG_DLL_FILE} libraries: -$(ROOT_DIR)/doc/man.macros: - $(INSTALL_DATA) "$(TCL_SRC_DIR)/doc/man.macros" "$(ROOT_DIR)/doc/man.macros" +doc: + +tclzipfile: ${TCL_ZIP_FILE} -doc: $(ROOT_DIR)/doc/man.macros +${TCL_ZIP_FILE}: ${ZIP_INSTALL_OBJS} + rm -rf ${TCL_VFS_ROOT} + mkdir -p ${TCL_VFS_PATH} + $(COPY) -a $(TOP_DIR)/library/* ${TCL_VFS_PATH} + cd ${TCL_VFS_ROOT} ; ${NATIVE_ZIP} ${ZIP_PROG_OPTIONS} ../${TCL_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} -${TK_ZIP_FILE}: - $(RMDIR) ${TK_VFS_ROOT} - $(MKDIR) ${TK_VFS_PATH} - $(COPY) -a $(TOP_DIR)/library/* ${TK_VFS_PATH} - cd ${TK_VFS_ROOT} ; ${ZIP_PROG} ${ZIP_PROG_OPTIONS} ../${TK_ZIP_FILE} ${ZIP_PROG_VFSSEARCH} +$(TCLSH): $(TCLSH_OBJS) @LIBRARIES@ $(TCL_STUB_LIB_FILE) tclsh.$(RES) + $(CC) $(CFLAGS) $(TCLSH_OBJS) $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(LIBS) \ + tclsh.$(RES) $(CC_EXENAME) $(LDFLAGS_CONSOLE) + @VC_MANIFEST_EMBED_EXE@ +cat32.$(OBJEXT): cat.c + $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) -winhelp: $(TCL_SRC_DIR)/tools/man2help.tcl $(MAN2TCL) - $(TCL_EXE) "$(TCL_SRC_DIR_NATIVE)/tools/man2help.tcl" tcl "$(VER)" $(CORE_DOCS) - $(COPY) "$(TCL_BIN_DIR)/tcl.hpj" ./ - hcw /c /e tcl.hpj - $(COPY) ./tcl$(VER).cnt ./TCL$(VER).HLP "$(TCL_SRC_DIR_NATIVE)/tools/" +$(CAT32): cat32.$(OBJEXT) + $(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE) -$(MAN2TCL): $(TCL_SRC_DIR)/tools/man2tcl.c - $(CC) $(CFLAGS_OPTIMIZE) $(MAN2TCLFLAGS) -o $(MAN2TCL) "$(TCL_SRC_DIR_NATIVE)/tools/man2tcl.c" +# The following targets are configured by autoconf to generate either a shared +# library or static library -# Specifying TESTFLAGS on the command line is the standard way to pass -# args to tcltest, ie: -# % make test TESTFLAGS="-verbose bps -file fileName.test" +${TCL_STUB_LIB_FILE}: ${STUB_OBJS} + @$(RM) ${TCL_STUB_LIB_FILE} + @MAKE_STUB_LIB@ ${STUB_OBJS} + @POST_MAKE_LIB@ -test: test-classic test-ttk +${TCL_DLL_FILE}: ${TCL_OBJS} tcl.$(RES) @ZLIB_DLL_FILE@ ${TCL_ZIP_FILE} + @$(RM) ${TCL_DLL_FILE} $(TCL_LIB_FILE) + @MAKE_DLL@ ${TCL_OBJS} tcl.$(RES) $(SHLIB_LD_LIBS) + @VC_MANIFEST_EMBED_DLL@ +ifeq (${ZIPFS_BUILD},1) + cat ${TCL_ZIP_FILE} >> ${TCL_DLL_FILE} +endif -test-classic: binaries $(TKTEST) $(TEST_DLL_FILE) $(CAT32) - $(SHELL_ENV) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/all.tcl" \ - $(TESTFLAGS) | ./$(CAT32) +${TCL_LIB_FILE}: ${TCL_OBJS} ${DDE_OBJS} ${REG_OBJS} + @$(RM) ${TCL_LIB_FILE} + @MAKE_LIB@ ${TCL_OBJS} ${DDE_OBJS} ${REG_OBJS} + @POST_MAKE_LIB@ -test-ttk: binaries $(TKTEST) $(TEST_DLL_FILE) $(CAT32) - $(SHELL_ENV) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/ttk/all.tcl" \ - $(TESTFLAGS) | ./$(CAT32) +${DDE_DLL_FILE}: ${TCL_STUB_LIB_FILE} ${DDE_OBJS} + @MAKE_DLL@ ${DDE_OBJS} $(TCL_STUB_LIB_FILE) $(SHLIB_LD_LIBS) -runtest: binaries $(TKTEST) $(TEST_DLL_FILE) - $(SHELL_ENV) ./$(TKTEST) $(TESTFLAGS) $(SCRIPT) +${REG_DLL_FILE}: ${TCL_STUB_LIB_FILE} ${REG_OBJS} + @MAKE_DLL@ ${REG_OBJS} $(TCL_STUB_LIB_FILE) $(SHLIB_LD_LIBS) -# This target can be used to run wish from the build directory -# via `make shell` or `make shell SCRIPT=foo.tcl` -shell: binaries - $(SHELL_ENV) ./$(WISH) $(SCRIPT) +${TEST_DLL_FILE}: ${TCL_STUB_LIB_FILE} ${TCLTEST_OBJS} + @$(RM) ${TEST_DLL_FILE} ${TEST_LIB_FILE} + @MAKE_DLL@ ${TCLTEST_OBJS} $(TCL_STUB_LIB_FILE) $(SHLIB_LD_LIBS) -demo: $(WISH) - $(SHELL_ENV) ./$(WISH) $(ROOT_DIR)/library/demos/widget +# use pre-built zlib1.dll +${ZLIB_DLL_FILE}: ${TCL_STUB_LIB_FILE} + @if test "@ZLIB_LIBS@set" != "${ZLIB_DIR_NATIVE}/win32/zdll.libset" ; then \ + $(COPY) $(ZLIB_DIR)/win64/${ZLIB_DLL_FILE} ${ZLIB_DLL_FILE}; \ + else \ + $(COPY) $(ZLIB_DIR)/win32/${ZLIB_DLL_FILE} ${ZLIB_DLL_FILE}; \ + fi; -# This target can be used to run wish inside either gdb or insight -gdb: binaries - @echo "set env TCL_LIBRARY=$(TCL_SRC_DIR_NATIVE)/library" > gdb.run - @echo "set env TK_LIBRARY=$(ROOT_DIR_NATIVE)/library" >> gdb.run - PATH="$(TCL_BIN_DIR):$(PATH)"; export PATH; \ - gdb ./$(WISH) --command=gdb.run - @$(RM) gdb.run - - -# Tip 430 - When we bump Tk, offer up only zipfile bundled Tk -# For now, 8.6 needs to be able to load Tk, and it doesn't -# have zipfs facilities -#INSTALL_LIBRARIES = @INSTALL_LIBRARIES@ -INSTALL_LIBRARIES = install-libraries -INSTALL_BASE_TARGETS = install-binaries $(INSTALL_LIBRARIES) +# Add the object extension to the implicit rules. By default .obj is not +# automatically added. + +.SUFFIXES: .${OBJEXT} +.SUFFIXES: .$(RES) +.SUFFIXES: .rc + +# Special case object targets + +tclWinInit.${OBJEXT}: tclWinInit.c + $(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) + +tclWinPipe.${OBJEXT}: tclWinPipe.c + $(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) @DEPARG@ $(CC_OBJNAME) + +testMain.${OBJEXT}: tclAppInit.c + $(CC) -c $(CC_SWITCHES) -DTCL_TEST @DEPARG@ $(CC_OBJNAME) + +tclMain2.${OBJEXT}: tclMain.c + $(CC) -c $(CC_SWITCHES) -DBUILD_tcl -DTCL_ASCII_MAIN @DEPARG@ $(CC_OBJNAME) + +# TIP #430, ZipFS Support +tclZipfs.${OBJEXT}: $(GENERIC_DIR)/tclZipfs.c + $(CC) -c $(CC_SWITCHES) -DBUILD_tcl \ + -DCFG_RUNTIME_PATH=\"$(bindir_native)\" \ + -DCFG_RUNTIME_DLLFILE="\"$(TCL_DLL_FILE)\"" \ + -DCFG_RUNTIME_ZIPFILE="\"$(TCL_ZIP_FILE)\"" \ + -DCFG_RUNTIME_LIBDIR="\"$(bindir_native)\"" \ + -DCFG_RUNTIME_SCRDIR="\"$(TCL_LIBRARY_NATIVE)\"" \ + $(ZLIB_INCLUDE) -I$(ZLIB_DIR)/contrib/minizip @DEPARG@ $(CC_OBJNAME) + + +# TIP #59, embedding of configuration information into the binary library. +# +# Part of Tcl's configuration information are the paths where it was installed +# and where it will look for its libraries (which can be different). We derive +# this information from the variables which can be overridden by the user. As +# every path can be configured separately we do not remember one general +# prefix/exec_prefix but all the different paths individually. + +tclPkgConfig.${OBJEXT}: tclPkgConfig.c + $(CC) -c $(CC_SWITCHES) \ + -DCFG_INSTALL_LIBDIR=\"$(LIB_INSTALL_DIR_NATIVE)\" \ + -DCFG_INSTALL_BINDIR=\"$(BIN_INSTALL_DIR_NATIVE)\" \ + -DCFG_INSTALL_SCRDIR=\"$(SCRIPT_INSTALL_DIR_NATIVE)\" \ + -DCFG_INSTALL_INCDIR=\"$(INCLUDE_INSTALL_DIR_NATIVE)\" \ + -DCFG_INSTALL_DOCDIR=\"$(MAN_INSTALL_DIR)\" \ + \ + -DCFG_RUNTIME_LIBDIR=\"$(libdir_native)\" \ + -DCFG_RUNTIME_BINDIR=\"$(bindir_native)\" \ + -DCFG_RUNTIME_SCRDIR=\"$(TCL_LIBRARY_NATIVE)\" \ + -DCFG_RUNTIME_INCDIR=\"$(includedir_native)\" \ + -DCFG_RUNTIME_DOCDIR=\"$(mandir_native)\" \ + -DCFG_RUNTIME_DLLFILE="\"$(TCL_DLL_FILE)\"" \ + -DCFG_RUNTIME_ZIPFILE="\"$(TCL_ZIP_FILE)\"" \ + -DBUILD_tcl \ + @DEPARG@ $(CC_OBJNAME) + +# The following objects are part of the stub library and should not be built +# as DLL objects but none of the symbols should be exported + +tclStubLib.${OBJEXT}: tclStubLib.c + $(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD @DEPARG@ $(CC_OBJNAME) + +tclTomMathStubLib.${OBJEXT}: tclTomMathStubLib.c + $(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD @DEPARG@ $(CC_OBJNAME) + +tclOOStubLib.${OBJEXT}: tclOOStubLib.c + $(CC) -c $(CC_SWITCHES) -DSTATIC_BUILD @DEPARG@ $(CC_OBJNAME) + +# Implicit rule for all object files that will end up in the Tcl library + +%.${OBJEXT}: %.c + $(CC) -c $(CC_SWITCHES) -DBUILD_tcl @DEPARG@ $(CC_OBJNAME) + +.rc.$(RES): + $(RC) @RC_OUT@ $@ @RC_TYPE@ @RC_DEFINES@ @RC_INCLUDE@ "$(GENERIC_DIR_NATIVE)" @RC_INCLUDE@ "$(WIN_DIR_NATIVE)" @DEPARG@ + + + +#-------------------------------------------------------------------------- +# Minizip implementation +#-------------------------------------------------------------------------- +adler32.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/adler32.c + +compress.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/compress.c + +crc32.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/crc32.c + +deflate.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/deflate.c + +ioapi.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/ioapi.c + +iowin32.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/iowin32.c + +infback.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/infback.c + +inffast.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/inffast.c + +inflate.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/inflate.c + +inftrees.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/inftrees.c + +trees.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/trees.c + +uncompr.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/uncompr.c + +zip.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/zip.c + +zutil.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -c $(ZLIB_DIR)/zutil.c + +minizip.$(HOST_OBJEXT): + $(HOST_CC) -o $@ -I$(ZLIB_DIR) -I$(ZLIB_DIR)/contrib/minizip -c $(ZLIB_DIR)/contrib/minizip/minizip.c + +minizip${HOST_EXEEXT}: $(MINIZIP_OBJS) + $(HOST_CC) -o $@ $(MINIZIP_OBJS) + +# The following target generates the file generic/tclDate.c from the yacc +# grammar found in generic/tclGetDate.y. This is only run by hand as yacc is +# not available in all environments. The name of the .c file is different than +# the name of the .y file 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/tclTomMath.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)/tclTomMath.h" + +INSTALL_BASE_TARGETS = install-binaries $(INSTALL_LIBRARIES) $(INSTALL_MSGS) $(INSTALL_TZDATA) INSTALL_DOC_TARGETS = install-doc +INSTALL_PACKAGE_TARGETS = install-packages INSTALL_DEV_TARGETS = install-headers -INSTALL_DEMO_TARGETS = install-demos -INSTALL_TARGETS = $(INSTALL_BASE_TARGETS) $(INSTALL_DOC_TARGETS) \ - $(INSTALL_DEMO_TARGETS) +INSTALL_EXTRA_TARGETS = +INSTALL_TARGETS = $(INSTALL_BASE_TARGETS) $(INSTALL_DOC_TARGETS) $(INSTALL_DEV_TARGETS) \ + $(INSTALL_PACKAGE_TARGETS) $(INSTALL_EXTRA_TARGETS) install: $(INSTALL_TARGETS) install-binaries: binaries - @for i in $(LIB_INSTALL_DIR) $(BIN_INSTALL_DIR) $(PKG_INSTALL_DIR); \ + @for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" ; \ do \ if [ ! -d $$i ] ; then \ echo "Making directory $$i"; \ @@ -518,140 +707,133 @@ install-binaries: binaries else true; \ fi; \ done; - @for i in $(TK_DLL_FILE) $(WISH); \ + @for i in dde${DDEDOTVER} reg${REGDOTVER}; \ + do \ + if [ ! -d $(LIB_INSTALL_DIR)/$$i ] ; then \ + echo "Making directory $(LIB_INSTALL_DIR)/$$i"; \ + $(MKDIR) $(LIB_INSTALL_DIR)/$$i; \ + else true; \ + fi; \ + done; + @for i in $(TCL_DLL_FILE) $(ZLIB_DLL_FILE) $(TCLSH); \ do \ if [ -f $$i ]; then \ echo "Installing $$i to $(BIN_INSTALL_DIR)/"; \ $(COPY) $$i "$(BIN_INSTALL_DIR)"; \ fi; \ done - @echo "Creating package index $(PKG_INDEX)"; - @$(RM) $(PKG_INDEX); - @(\ - echo "if {[catch {package present Tcl 8.6.0}]} return";\ - echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\ - echo " || ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\ - echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtk$(VERSION).dll]] Tk]";\ - echo "} else {";\ - echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE)]] Tk]";\ - echo "}";\ - ) > $(PKG_INDEX); - @for i in tkConfig.sh $(TK_LIB_FILE) $(TK_STUB_LIB_FILE); \ + @for i in tclConfig.sh tclooConfig.sh $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE); \ do \ if [ -f $$i ]; then \ echo "Installing $$i to $(LIB_INSTALL_DIR)/"; \ $(COPY) $$i "$(LIB_INSTALL_DIR)"; \ fi; \ done + @if [ -f $(DDE_DLL_FILE) ]; then \ + echo Installing $(DDE_DLL_FILE); \ + $(COPY) $(DDE_DLL_FILE) $(LIB_INSTALL_DIR)/dde${DDEDOTVER}; \ + $(COPY) $(ROOT_DIR)/library/dde/pkgIndex.tcl \ + $(LIB_INSTALL_DIR)/dde${DDEDOTVER}; \ + fi + @if [ -f $(DDE_LIB_FILE) ]; then \ + echo Installing $(DDE_LIB_FILE); \ + $(COPY) $(DDE_LIB_FILE) $(LIB_INSTALL_DIR)/dde${DDEDOTVER}; \ + fi + @if [ -f $(REG_DLL_FILE) ]; then \ + echo Installing $(REG_DLL_FILE); \ + $(COPY) $(REG_DLL_FILE) $(LIB_INSTALL_DIR)/reg${REGDOTVER}; \ + $(COPY) $(ROOT_DIR)/library/reg/pkgIndex.tcl \ + $(LIB_INSTALL_DIR)/reg${REGDOTVER}; \ + fi + @if [ -f $(REG_LIB_FILE) ]; then \ + echo Installing $(REG_LIB_FILE); \ + $(COPY) $(REG_LIB_FILE) $(LIB_INSTALL_DIR)/reg${REGDOTVER}; \ + fi install-libraries-zipfs-shared: libraries - @for i in "$(SCRIPT_INSTALL_DIR)"; \ - do \ - if [ ! -d "$$i" ] ; then \ - echo "Making directory $$i"; \ - $(INSTALL_DATA_DIR) "$$i"; \ - else true; \ - fi; \ - done; - @echo "Installing library files to $(SCRIPT_INSTALL_DIR)/"; - @for i in \ - $(WIN_DIR)/tkAppInit.c; \ - do \ - $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"; \ - done; install-libraries-zipfs-static: install-libraries-zipfs-shared - $(INSTALL_DATA) ${TCL_ZIP_FILE} "$(LIB_INSTALL_DIR)" ;\ + $(INSTALL_DATA) ${TCL_ZIP_FILE} "$(LIB_INSTALL_DIR)" -install-libraries: libraries - @for i in $(INSTALL_ROOT)$(prefix)/lib \ - $(INCLUDE_INSTALL_DIR) $(INCLUDE_INSTALL_DIR)/X11 \ - $(SCRIPT_INSTALL_DIR) $(SCRIPT_INSTALL_DIR)/images \ - $(SCRIPT_INSTALL_DIR)/msgs $(SCRIPT_INSTALL_DIR)/ttk; \ +install-libraries: libraries install-tzdata install-msgs + @for i in "$$($(CYGPATH) $(prefix)/lib)" "$(INCLUDE_INSTALL_DIR)" \ + $(SCRIPT_INSTALL_DIR); \ do \ if [ ! -d $$i ] ; then \ echo "Making directory $$i"; \ $(MKDIR) $$i; \ - chmod 755 $$i; \ else true; \ fi; \ done; - @echo "Installing header files to $(INCLUDE_INSTALL_DIR)/"; - @for i in $(GENERIC_DIR)/tk.h $(GENERIC_DIR)/tkPlatDecls.h \ - $(GENERIC_DIR)/tkIntXlibDecls.h $(GENERIC_DIR)/tkDecls.h ; \ - do \ - $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR); \ - done; - @for i in $(XLIB_DIR)/X11/*.h; \ + @for i in http1.0 opt0.4 encoding ../tcl8 ../tcl8/8.4 ../tcl8/8.4/platform ../tcl8/8.5 ../tcl8/8.6; \ do \ - $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR)/X11; \ + if [ ! -d $(SCRIPT_INSTALL_DIR)/$$i ] ; then \ + echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \ + $(MKDIR) $(SCRIPT_INSTALL_DIR)/$$i; \ + else true; \ + fi; \ done; @echo "Installing library files to $(SCRIPT_INSTALL_DIR)"; - @for i in $(ROOT_DIR)/library/*.tcl $(ROOT_DIR)/library/tclIndex \ - $(UNIX_DIR)/tkAppInit.c; \ + @for i in $(ROOT_DIR)/library/*.tcl $(ROOT_DIR)/library/tclIndex; \ do \ - $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR); \ + $(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)"; \ done; - @echo "Installing library ttk directory"; - @for i in $(ROOT_DIR)/library/ttk/*.tcl; \ + @echo "Installing library http1.0 directory"; + @for j in $(ROOT_DIR)/library/http1.0/*.tcl; \ do \ - if [ -f $$i ] ; then \ - $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/ttk; \ - fi; \ + $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/http1.0"; \ done; - @echo "Installing library images directory"; - @for i in $(ROOT_DIR)/library/images/*; \ + @echo "Installing package http 2.8.12 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.6/http-2.8.12.tm; + @echo "Installing library opt0.4 directory"; + @for j in $(ROOT_DIR)/library/opt/*.tcl; \ do \ - if [ -f $$i ] ; then \ - $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/images; \ - fi; \ - done; - @echo "Installing translation directory"; - @for i in $(ROOT_DIR)/library/msgs/*.msg; \ - do \ - if [ -f $$i ] ; then \ - $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/msgs; \ - fi; \ + $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \ done; + @echo "Installing package msgcat 1.6.1 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.6.1.tm; + @echo "Installing package tcltest 2.4.0 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.4.0.tm; + @echo "Installing package platform 1.0.14 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform-1.0.14.tm; + @echo "Installing package platform::shell 1.1.4 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/platform/shell.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.4/platform/shell-1.1.4.tm; + @echo "Installing encodings"; + @for i in $(ROOT_DIR)/library/encoding/*.enc ; do \ + $(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)/encoding"; \ + done; + +install-tzdata: + @echo "Installing time zone data" + @$(TCL_EXE) "$(ROOT_DIR)/tools/installData.tcl" \ + "$(ROOT_DIR)/library/tzdata" "$(SCRIPT_INSTALL_DIR)/tzdata" + +install-msgs: + @echo "Installing message catalogs" + @$(TCL_EXE) "$(ROOT_DIR)/tools/installData.tcl" \ + "$(ROOT_DIR)/library/msgs" "$(SCRIPT_INSTALL_DIR)/msgs" -install-demos: - @for i in $(INSTALL_ROOT)$(prefix)/lib $(SCRIPT_INSTALL_DIR) \ - $(SCRIPT_INSTALL_DIR)/demos \ - $(SCRIPT_INSTALL_DIR)/demos/images ; \ +install-doc: doc + +install-headers: + @for i in "$(INCLUDE_INSTALL_DIR)"; \ do \ - if [ ! -d $$i ] ; then \ + if [ ! -d "$$i" ] ; then \ echo "Making directory $$i"; \ - $(MKDIR) $$i; \ - chmod 755 $$i; \ + $(INSTALL_DATA_DIR) "$$i"; \ else true; \ fi; \ done; - @echo "Installing demos to $(SCRIPT_INSTALL_DIR)/demos/"; - @for i in $(ROOT_DIR)/library/demos/*; \ - do \ - if [ -f $$i ] ; then \ - sed -e '3 s|exec wish|exec wish$(VER)|' \ - $$i > $(SCRIPT_INSTALL_DIR)/demos/`basename $$i`; \ - fi; \ - done; - @for i in $(DEMOPROGS); \ - do \ - if test $$i = "square"; then \ - rm -f $(SCRIPT_INSTALL_DIR)/demos/$$i; \ - else \ - chmod 755 $(SCRIPT_INSTALL_DIR)/demos/$$i; \ - fi; \ - done; - @echo "Installing demo images"; - @for i in $(ROOT_DIR)/library/demos/images/*; \ + @echo "Installing header files to $(INCLUDE_INSTALL_DIR)/"; + @for i in $(GENERIC_DIR)/tcl.h $(GENERIC_DIR)/tclDecls.h \ + $(GENERIC_DIR)/tclOO.h $(GENERIC_DIR)/tclOODecls.h \ + $(GENERIC_DIR)/tclPlatDecls.h \ + $(GENERIC_DIR)/tclTomMath.h \ + $(GENERIC_DIR)/tclTomMathDecls.h ; \ do \ - if [ -f $$i ] ; then \ - $(INSTALL_DATA) $$i $(SCRIPT_INSTALL_DIR)/demos/images; \ - fi; \ + $(COPY) $$i "$(INCLUDE_INSTALL_DIR)"; \ done; -install-doc: doc - # Optional target to install private headers install-private-headers: libraries @for i in $(PRIVATE_INCLUDE_INSTALL_DIR); \ @@ -659,153 +841,197 @@ install-private-headers: libraries if [ ! -d $$i ] ; then \ echo "Making directory $$i"; \ $(MKDIR) $$i; \ - chmod 755 $$i; \ else true; \ fi; \ done; - @echo "Installing private header files to $(PRIVATE_INCLUDE_INSTALL_DIR)/"; - @for i in $(GENERIC_DIR)/tkInt.h $(GENERIC_DIR)/tkIntDecls.h \ - $(GENERIC_DIR)/tkIntPlatDecls.h $(GENERIC_DIR)/tkPort.h \ - $(WIN_DIR)/tkWinPort.h $(WIN_DIR)/tkWinInt.h $(WIN_DIR)/tkWin.h; \ + @echo "Installing private header files"; + @for i in "$(GENERIC_DIR)/tclInt.h" "$(GENERIC_DIR)/tclIntDecls.h" \ + "$(GENERIC_DIR)/tclIntPlatDecls.h" "$(GENERIC_DIR)/tclPort.h" \ + "$(GENERIC_DIR)/tclOOInt.h" "$(GENERIC_DIR)/tclOOIntDecls.h" \ + "$(WIN_DIR)/tclWinPort.h" ; \ do \ - $(INSTALL_DATA) $$i $(PRIVATE_INCLUDE_INSTALL_DIR); \ + $(COPY) "$$i" "$(PRIVATE_INCLUDE_INSTALL_DIR)"; \ done; -$(WISH): $(WISH_OBJS) @LIBRARIES@ $(TK_STUB_LIB_FILE) wish.$(RES) - $(CC) $(CFLAGS) $(WISH_OBJS) $(TK_LIB_FILE) \ - $(TK_STUB_LIB_FILE) $(TCL_LIB_FILE) $(LIBS) \ - wish.$(RES) $(CC_EXENAME) $(LDFLAGS_WINDOW) - @VC_MANIFEST_EMBED_EXE@ - -tktest: $(TKTEST) - -$(TKTEST): testMain.$(OBJEXT) $(TEST_DLL_FILE) @LIBRARIES@ $(TK_STUB_LIB_FILE) wish.$(RES) - $(CC) $(CFLAGS) testMain.$(OBJEXT) $(TEST_LIB_FILE) $(TK_LIB_FILE) \ - $(TK_STUB_LIB_FILE) $(TCL_LIB_FILE) $(LIBS) \ - wish.$(RES) $(CC_EXENAME) $(LDFLAGS_WINDOW) - @VC_MANIFEST_EMBED_EXE@ - -${TEST_DLL_FILE}: ${TKTEST_OBJS} ${TK_STUB_LIB_FILE} - @MAKE_DLL@ ${TKTEST_OBJS} $(TK_STUB_LIB_FILE) $(SHLIB_LD_LIBS) - -# Msys make requires this next rule for some reason. -$(TCL_SRC_DIR)/win/cat.c: - -cat32.${OBJEXT}: $(TCL_SRC_DIR)/win/cat.c - $(CC) -c $(CC_SWITCHES) "$(TCL_SRC_DIR)/win/cat.c" $(CC_OBJNAME) - -$(CAT32): cat32.${OBJEXT} - $(CC) $(CFLAGS) cat32.$(OBJEXT) $(CC_EXENAME) $(LIBS) $(LDFLAGS_CONSOLE) - -# The following targets are configured by autoconf to generate either -# a shared library or static library - -${TK_STUB_LIB_FILE}: ${STUB_OBJS} - @$(RM) ${TK_STUB_LIB_FILE} - @MAKE_STUB_LIB@ ${STUB_OBJS} - @POST_MAKE_LIB@ - -${TK_DLL_FILE}: ${TK_OBJS} $(TK_RES) ${TCL_ZIPFS_OBJS} - @$(RM) ${TK_DLL_FILE} - @MAKE_DLL@ ${TK_OBJS} $(TK_RES) $(SHLIB_LD_LIBS) - @VC_MANIFEST_EMBED_DLL@ -ifeq (${TCL_ZIPFS_SUPPORT},1) - cat ${TK_ZIP_FILE} >> ${LIB_FILE} -endif - -${TK_LIB_FILE}: ${TK_OBJS} - @$(RM) ${TK_LIB_FILE} - @MAKE_LIB@ ${TK_OBJS} - @POST_MAKE_LIB@ - -# Special case object file targets - -winMain.$(OBJEXT): winMain.c - $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) - -testMain.$(OBJEXT): winMain.c - $(CC) -c $(CC_SWITCHES) @DEPARG@ -DTK_TEST $(CC_OBJNAME) - -tkTest.$(OBJEXT): tkTest.c - $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) - -tkOldTest.$(OBJEXT): tkOldTest.c - $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) - -tkWinTest.$(OBJEXT): tkWinTest.c - $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) - -tkSquare.$(OBJEXT): tkSquare.c - $(CC) -c $(CC_SWITCHES) @DEPARG@ $(CC_OBJNAME) - -tkMain2.$(OBJEXT): tkMain.c - $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DTK_ASCII_MAIN @DEPARG@ $(CC_OBJNAME) - -# Extra dependency info -tkConsole.$(OBJEXT): configure Makefile -tkMain.$(OBJEXT): configure Makefile -tkWindow.$(OBJEXT): configure Makefile +# Specifying TESTFLAGS on the command line is the standard way to pass args to +# tcltest, i.e.: +# % make test TESTFLAGS="-verbose bps -file fileName.test" -# Add the object extension to the implicit rules. By default .obj is not -# automatically added. +test: test-tcl test-packages -.SUFFIXES: .${OBJEXT} -.SUFFIXES: .$(RES) -.SUFFIXES: .rc +test-tcl: binaries $(TCLSH) $(CAT32) $(TEST_DLL_FILE) + TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \ + ./$(TCLSH) "$(ROOT_DIR_NATIVE)/tests/all.tcl" $(TESTFLAGS) \ + -load "package ifneeded Tcltest ${VERSION}@TCL_PATCH_LEVEL@ [list load [file normalize ${TEST_DLL_FILE}] Tcltest]; \ + package ifneeded dde 1.4.0 [list load [file normalize ${DDE_DLL_FILE}] dde]; \ + package ifneeded registry 1.3.2 [list load [file normalize ${REG_DLL_FILE}] registry]" | ./$(CAT32) -# Implicit rule for all object files that will end up in the Tk library +# Useful target to launch a built tclsh with the proper path,... +runtest: binaries $(TCLSH) $(TEST_DLL_FILE) + @TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \ + ./$(TCLSH) $(TESTFLAGS) -load "package ifneeded Tcltest ${VERSION}@TCL_PATCH_LEVEL@ [list load [file normalize ${TEST_DLL_FILE}] Tcltest]; \ + package ifneeded dde 1.4.0 [list load [file normalize ${DDE_DLL_FILE}] dde]; \ + package ifneeded registry 1.3.2 [list load [file normalize ${REG_DLL_FILE}] registry]" $(SCRIPT) -%.$(OBJEXT): %.c - $(CC) -c $(CC_SWITCHES) -DBUILD_tk -DBUILD_ttk @DEPARG@ $(CC_OBJNAME) +# This target can be used to run tclsh from the build directory via +# `make shell SCRIPT=foo.tcl` +shell: binaries + @TCL_LIBRARY="$(LIBRARY_DIR)"; export TCL_LIBRARY; \ + ./$(TCLSH) $(SCRIPT) -.rc.$(RES): - $(RC) @RC_OUT@ $@ @RC_TYPE@ @RC_DEFINES@ @RC_INCLUDE@ "$(GENERIC_DIR_NATIVE)" @RC_INCLUDE@ "$(TCL_GENERIC_NATIVE)" @RC_INCLUDE@ "$(RC_DIR_NATIVE)" @DEPARG@ +# This target can be used to run tclsh inside either gdb or insight +gdb: binaries + @echo "set env TCL_LIBRARY=$(LIBRARY_DIR)" > gdb.run + gdb ./$(TCLSH) --command=gdb.run + rm gdb.run depend: +Makefile: $(SRC_DIR)/Makefile.in + ./config.status + cleanhelp: - $(RM) *.hlp *.cnt *.hpj *.GID *.rtf man2tcl${EXEEXT} + $(RM) *.hlp *.cnt *.GID *.rtf man2tcl.exe -clean: cleanhelp - $(RM) *.lib *.a *.exp *.dll *.res *.${OBJEXT} *~ \#* TAGS a.out - $(RM) $(WISH) $(TKTEST) $(CAT32) +clean: cleanhelp clean-packages + $(RM) *.lib *.a *.exp *.dll *.$(RES) *.${OBJEXT} *~ \#* TAGS a.out + $(RM) $(TCLSH) $(CAT32) $(RM) *.pch *.ilk *.pdb + $(RM) minizip${HOST_EXEEXT} *.${HOST_OBJEXT} + $(RM) *.zip + $(RMDIR) *.vfs -distclean: clean - $(RM) Makefile config.status config.cache config.log tkConfig.sh \ - wish.exe.manifest +distclean: distclean-packages clean + $(RM) Makefile config.status config.cache config.log tclConfig.sh \ + tcl.hpj config.status.lineno tclsh.exe.manifest -Makefile: $(SRC_DIR)/Makefile.in - ./config.status +# +# Bundled package targets +# + +PKG_CFG_ARGS = @PKG_CFG_ARGS@ +PKG_DIR = ./pkgs + +packages: + @builddir=`$(CYGPATH) $$(pwd -P)`; \ + for i in $(PKGS_DIR)/*; do \ + if [ -d $$i ] ; then \ + if [ -x $$i/configure ] ; then \ + pkg=`basename $$i`; \ + mkdir -p $(PKG_DIR)/$$pkg; \ + if [ ! -f $(PKG_DIR)/$$pkg/Makefile ]; then \ + ( cd $(PKG_DIR)/$$pkg; \ + echo "Configuring package '$$i' wd = `$(CYGPATH) $$(pwd -P)`"; \ + $$i/configure --with-tcl=$$builddir --with-tclinclude=$(GENERIC_DIR_NATIVE) $(PKG_CFG_ARGS) --enable-shared --enable-threads; ) \ + fi ; \ + echo "Building package '$$pkg'"; \ + ( cd $(PKG_DIR)/$$pkg; $(MAKE); ) \ + fi; \ + fi; \ + done; \ + cd $$builddir + +install-packages: packages + @builddir=`pwd -P`; \ + for i in $(PKGS_DIR)/*; do \ + if [ -d $$i ]; then \ + pkg=`basename $$i`; \ + if [ -f $(PKG_DIR)/$$pkg/Makefile ]; then \ + echo "Installing package '$$pkg'"; \ + ( cd $(PKG_DIR)/$$pkg; $(MAKE) install "DESTDIR=$(INSTALL_ROOT)"; ) \ + fi; \ + fi; \ + done; \ + cd $$builddir + +test-packages: tcltest packages + @builddir=`pwd -P`; \ + for i in $(PKGS_DIR)/*; do \ + if [ -d $$i ]; then \ + pkg=`basename $$i`; \ + if [ -f $(PKG_DIR)/$$pkg/Makefile ]; then \ + echo "Testing package '$$pkg'"; \ + ( cd $(PKG_DIR)/$$pkg; $(MAKE) "LD_LIBRARY_PATH=$$builddir:${LD_LIBRARY_PATH}" "TCL_LIBRARY=${TCL_BUILDTIME_LIBRARY}" "TCLLIBPATH=$$builddir/pkgs" test "TCLSH_PROG=$$builddir/${TCLSH}"; ) \ + fi; \ + fi; \ + done; \ + cd $$builddir + +clean-packages: + @builddir=`pwd -P`; \ + for i in $(PKGS_DIR)/*; do \ + if [ -d $$i ]; then \ + pkg=`basename $$i`; \ + if [ -f $(PKG_DIR)/$$pkg/Makefile ]; then \ + ( cd $(PKG_DIR)/$$pkg; $(MAKE) clean; ) \ + fi; \ + fi; \ + done; \ + cd $$builddir + +distclean-packages: + @builddir=`pwd -P`; \ + for i in $(PKGS_DIR)/*; do \ + if [ -d $$i ]; then \ + pkg=`basename $$i`; \ + if [ -f $(PKG_DIR)/$$pkg/Makefile ]; then \ + ( cd $(PKG_DIR)/$$pkg; $(MAKE) distclean; ) \ + fi; \ + cd $$builddir; \ + rm -rf $(PKG_DIR)/$$pkg; \ + fi; \ + done; \ + rm -rf $(PKG_DIR) # # Regenerate the stubs files. # -$(GENERIC_DIR)/tkStubInit.c: $(GENERIC_DIR)/tk.decls \ - $(GENERIC_DIR)/tkInt.decls - @echo "Warning: tkStubInit.c may be out of date." +$(GENERIC_DIR)/tclStubInit.c: $(GENERIC_DIR)/tcl.decls \ + $(GENERIC_DIR)/tclInt.decls + @echo "Warning: tclStubInit.c may be out of date." @echo "Developers may want to run \"make genstubs\" to regenerate." @echo "This warning can be safely ignored, do not report as a bug!" genstubs: - $(TCL_EXE) "$(TCL_TOOL_DIR)/genStubs.tcl" \ + $(TCL_EXE) "$(ROOT_DIR_NATIVE)/tools/genStubs.tcl" \ + "$(GENERIC_DIR_NATIVE)" \ + "$(GENERIC_DIR_NATIVE)/tcl.decls" \ + "$(GENERIC_DIR_NATIVE)/tclInt.decls" \ + "$(GENERIC_DIR_NATIVE)/tclTomMath.decls" + $(TCL_EXE) "$(ROOT_DIR_NATIVE)/tools/genStubs.tcl" \ "$(GENERIC_DIR_NATIVE)" \ - "$(GENERIC_DIR_NATIVE)/tk.decls" \ - "$(GENERIC_DIR_NATIVE)/tkInt.decls" - $(TCL_EXE) "$(TTK_DIR)/ttkGenStubs.tcl" \ - "$(TTK_DIR)" \ - "$(TTK_DIR)/ttk.decls" + "$(GENERIC_DIR_NATIVE)/tclOO.decls" + +# +# 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. +# + +TOOL_DIR=$(ROOT_DIR)/tools +HTML_INSTALL_DIR=$(ROOT_DIR)/html +html: + $(MAKE) shell SCRIPT="$(TOOL_DIR)/tcltk-man2html.tcl --htmldir=$(HTML_INSTALL_DIR) --srcdir=$(ROOT_DIR)/.. $(BUILD_HTML_FLAGS)" + +html-tcl: $(TCLSH) + $(MAKE) shell SCRIPT="$(TOOL_DIR)/tcltk-man2html.tcl --htmldir=$(HTML_INSTALL_DIR) --srcdir=$(ROOT_DIR)/.. $(BUILD_HTML_FLAGS) --tcl" + +html-tk: $(TCLSH) + $(MAKE) shell SCRIPT="$(TOOL_DIR)/tcltk-man2html.tcl --htmldir=$(HTML_INSTALL_DIR) --srcdir=$(ROOT_DIR)/.. $(BUILD_HTML_FLAGS) --tk" # # The list of all the targets that do not correspond to real files. This stops # 'make' from getting confused when someone makes an error in a rule. # -.PHONY: all binaries libraries doc tkLibObjs objs tktest-real test test-classic -.PHONY: test-ttk testlang runtest shell demo gdb install install-strip -.PHONY: install-binaries install-libraries install-demos install-doc -.PHONY: install-private-headers clean distclean depend genstubs checkstubs -.PHONY: checkuchar checkexports rpm dist alldist allpatch html html-tcl html-tk +.PHONY: all tcltest binaries libraries doc gendate gentommath_h install +.PHONY: install-binaries install-libraries install-tzdata install-msgs +.PHONY: install-doc install-private-headers test test-tcl runtest shell +.PHONY: gdb depend cleanhelp clean distclean packages install-packages +.PHONY: test-packages clean-packages distclean-packages genstubs html +.PHONY: html-tcl html-tk +.PHONY: iinstall-libraries-zipfs-shared install-libraries-zipfs-static tclzipfile # DO NOT DELETE THIS LINE -- make depend depends on it. -- cgit v0.12 From 48fb6e2c88c4b6966e52e0a8d34274e91eef47f3 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Sat, 25 Nov 2017 16:36:22 +0000 Subject: Fix for issue [4f6a1ebd64]: ensemble: segmentation fault when -subcommand and -map values are the same object. --- generic/tclEnsemble.c | 14 +++++++++++++- tests/namespace.test | 18 +++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index f3e8187..392f430 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -2505,6 +2505,7 @@ BuildEnsembleConfig( int i, j, isNew; Tcl_HashTable *hash = &ensemblePtr->subcommandTable; Tcl_HashEntry *hPtr; + Tcl_Obj *subcmdDictCopy = NULL ; if (hash->numEntries != 0) { /* @@ -2553,7 +2554,15 @@ BuildEnsembleConfig( */ if (ensemblePtr->subcommandDict != NULL) { - Tcl_DictObjGet(NULL, ensemblePtr->subcommandDict, subcmdv[i], + if (subcmdDictCopy == NULL) { + if (ensemblePtr->subcmdList == ensemblePtr->subcommandDict) { + subcmdDictCopy = Tcl_DuplicateObj(ensemblePtr->subcommandDict); + } else { + subcmdDictCopy = ensemblePtr->subcommandDict; + } + Tcl_IncrRefCount(subcmdDictCopy); + } + Tcl_DictObjGet(NULL, subcmdDictCopy, subcmdv[i], &target); if (target != NULL) { Tcl_SetHashValue(hPtr, target); @@ -2578,6 +2587,9 @@ BuildEnsembleConfig( Tcl_SetHashValue(hPtr, cmdPrefixObj); Tcl_IncrRefCount(cmdPrefixObj); } + if (subcmdDictCopy != NULL) { + Tcl_DecrRefCount(subcmdDictCopy); + } } else if (ensemblePtr->subcommandDict != NULL) { /* * No subcmd list, but we do have a mapping dictionary so we should diff --git a/tests/namespace.test b/tests/namespace.test index f6f817b..623f06d 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -1785,7 +1785,10 @@ test namespace-42.7 {ensembles: nested} -body { } -cleanup { namespace delete ns } -result {{1 ::ns::x0::z} 1 2 3} -test namespace-42.8 {ensembles: [Bug 1670091]} -setup { +test namespace-42.8 { + ensembles: [Bug 1670091], panic due to pointer to a deallocated List + struct. +} -setup { proc demo args {} variable target [list [namespace which demo] x] proc trial args {variable target; string length $target} @@ -1800,6 +1803,19 @@ test namespace-42.8 {ensembles: [Bug 1670091]} -setup { rename foo {} } -result {} +test namespace-42.9 { + ensembles: [Bug 4f6a1ebd64], segmentation fault due to pointer to a + deallocated List struct. +} -setup { + namespace eval n {namespace ensemble create} + dict set list one ::two + namespace ensemble configure n -subcommands $list -map $list +} -body { + n one +} -cleanup { + namespace delete n +} -returnCodes error -match glob -result {invalid command name*} + test namespace-43.1 {ensembles: dict-driven} { namespace eval ns { namespace export x* -- cgit v0.12 From 811ec68434e9a83c37f1a0fd3ef0a8cae5baac91 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Sat, 25 Nov 2017 18:24:10 +0000 Subject: Add missing parenthesis to an expression in TclEnsureNamespace. --- generic/tclNamesp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index e7914ad..d661856 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -2444,7 +2444,7 @@ TclEnsureNamespace( Tcl_Namespace *namespacePtr) { Namespace *nsPtr = (Namespace *) namespacePtr; - if (!nsPtr->flags & NS_DYING) { + if (!(nsPtr->flags & NS_DYING)) { return namespacePtr; } return Tcl_CreateNamespace(interp, nsPtr->fullName, NULL, NULL); -- cgit v0.12 From 14c8dabffe826dcdad24dc755164175dc4e6226f Mon Sep 17 00:00:00 2001 From: pooryorick Date: Sat, 25 Nov 2017 21:40:19 +0000 Subject: merge (cherrypick): Add missing parenthesis to an expression in TclEnsureNamespace. --- generic/tclNamesp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index e7914ad..d661856 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -2444,7 +2444,7 @@ TclEnsureNamespace( Tcl_Namespace *namespacePtr) { Namespace *nsPtr = (Namespace *) namespacePtr; - if (!nsPtr->flags & NS_DYING) { + if (!(nsPtr->flags & NS_DYING)) { return namespacePtr; } return Tcl_CreateNamespace(interp, nsPtr->fullName, NULL, NULL); -- cgit v0.12 From 20dedcd841ef5caf05a104ccd36929080f8a5645 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 27 Nov 2017 13:52:18 +0000 Subject: Fix test-cases in safe.test, failing due to changes in min/max math functions. --- generic/tclInterp.c | 4 ---- tests/safe.test | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/generic/tclInterp.c b/generic/tclInterp.c index d9dfd37..d4bf465 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -3208,10 +3208,6 @@ Tcl_MakeSafe( (void) Tcl_EvalEx(interp, "namespace eval ::tcl {namespace eval mathfunc {}}", -1, 0); - (void) Tcl_CreateAlias(interp, "::tcl::mathfunc::min", master, - "::tcl::mathfunc::min", 0, NULL); - (void) Tcl_CreateAlias(interp, "::tcl::mathfunc::max", master, - "::tcl::mathfunc::max", 0, NULL); } iPtr->flags |= SAFE_INTERP; diff --git a/tests/safe.test b/tests/safe.test index e43ce12..33ee166 100644 --- a/tests/safe.test +++ b/tests/safe.test @@ -74,7 +74,7 @@ test safe-2.3 {creating safe interpreters, should have no unexpected aliases} -s lsort [a aliases] } -cleanup { interp delete a -} -result {::tcl::mathfunc::max ::tcl::mathfunc::min clock} +} -result {clock} test safe-3.1 {calling safe::interpInit is safe} -setup { catch {safe::interpDelete a} -- cgit v0.12 From d95ab0247a35a1a40f5e39186127a9f6ba4540a9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 27 Nov 2017 14:11:16 +0000 Subject: missed some more failing test-cases --- tests/interp.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/interp.test b/tests/interp.test index 1389304..4ea04e3 100644 --- a/tests/interp.test +++ b/tests/interp.test @@ -1847,7 +1847,7 @@ test interp-23.2 {testing hiding vs aliases: safe interp} -setup { lappend l [lsort [interp aliases a]] [lsort [interp hidden a]] } -cleanup { interp delete a -} -result [list $hidden_cmds {::tcl::mathfunc::max ::tcl::mathfunc::min bar clock} $hidden_cmds {::tcl::mathfunc::max ::tcl::mathfunc::min bar clock} [lsort [concat $hidden_cmds bar]] {::tcl::mathfunc::max ::tcl::mathfunc::min clock} $hidden_cmds] +} -result [list $hidden_cmds {bar clock} $hidden_cmds {bar clock} [lsort [concat $hidden_cmds bar]] {clock} $hidden_cmds] test interp-24.1 {result resetting on error} -setup { catch {interp delete a} -- cgit v0.12 From 293016951704770ca48af42b926e4fada4e2054a Mon Sep 17 00:00:00 2001 From: pooryorick Date: Mon, 27 Nov 2017 19:45:40 +0000 Subject: Streamline TclOO object cleanup routines. --- generic/tclOO.c | 484 ++++++++++++++++++++++------------------------------- generic/tclOOInt.h | 4 + 2 files changed, 208 insertions(+), 280 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index 7feeb5d..3fece42 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -4,6 +4,7 @@ * This file contains the object-system core (NB: not Tcl_Obj, but ::oo) * * Copyright (c) 2005-2012 by Donal K. Fellows + * Copyright (c) 2017 by Nathan Coulter * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -82,7 +83,6 @@ static void ObjectRenamedTrace(ClientData clientData, const char *newName, int flags); static void ReleaseClassContents(Tcl_Interp *interp,Object *oPtr); static inline void SquelchCachedName(Object *oPtr); -static void SquelchedNsFirst(ClientData clientData); static int PublicObjectCmd(ClientData clientData, Tcl_Interp *interp, int objc, @@ -583,8 +583,7 @@ AllocObject( */ if (nsNameStr != NULL) { - oPtr->namespacePtr = Tcl_CreateNamespace(interp, nsNameStr, oPtr, - ObjectNamespaceDeleted); + oPtr->namespacePtr = Tcl_CreateNamespace(interp, nsNameStr, oPtr, NULL); if (oPtr->namespacePtr != NULL) { creationEpoch = ++fPtr->tsdPtr->nsCount; goto configNamespace; @@ -596,8 +595,7 @@ AllocObject( char objName[10 + TCL_INTEGER_SPACE]; sprintf(objName, "::oo::Obj%d", ++fPtr->tsdPtr->nsCount); - oPtr->namespacePtr = Tcl_CreateNamespace(interp, objName, oPtr, - ObjectNamespaceDeleted); + oPtr->namespacePtr = Tcl_CreateNamespace(interp, objName, oPtr, NULL); if (oPtr->namespacePtr != NULL) { creationEpoch = fPtr->tsdPtr->nsCount; break; @@ -637,7 +635,7 @@ AllocObject( * access variables in it. [Bug 2950259] */ - ((Namespace *) oPtr->namespacePtr)->earlyDeleteProc = SquelchedNsFirst; + ((Namespace *) oPtr->namespacePtr)->earlyDeleteProc = ObjectNamespaceDeleted; /* * Fill in the rest of the non-zero/NULL parts of the structure. @@ -752,30 +750,6 @@ MyDeleted( /* * ---------------------------------------------------------------------- * - * SquelchedNsFirst -- - * - * This callback is triggered when the object's namespace is deleted by - * any mechanism. It deletes the object's public command if it has not - * already been deleted, so ensuring that destructors get run at an - * appropriate time. [Bug 2950259] - * - * ---------------------------------------------------------------------- - */ - -static void -SquelchedNsFirst( - ClientData clientData) -{ - Object *oPtr = clientData; - - if (oPtr->command) { - Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command); - } -} - -/* - * ---------------------------------------------------------------------- - * * ObjectRenamedTrace -- * * This callback is triggered when the object is deleted by any @@ -795,8 +769,6 @@ ObjectRenamedTrace( int flags) /* Why was the object deleted? */ { Object *oPtr = clientData; - Foundation *fPtr = oPtr->fPtr; - /* * If this is a rename and not a delete of the object, we just flush the * cache of the object name. @@ -808,87 +780,35 @@ ObjectRenamedTrace( } /* - * Oh dear, the object really is being deleted. Handle this by running the - * destructors and deleting the object's namespace, which in turn causes - * the real object structures to be deleted. - * - * Note that it is possible for the namespace to be deleted before the - * command. Because of that case, we must take care here to mark the - * command as being deleted so that if we return here we don't run into - * reentrancy problems. - * - * We also do not run destructors on the core class objects when the - * interpreter is being deleted; their incestuous nature causes problems - * in that case when the destructor is partially deleted before the uses - * of it have gone. [Bug 2949397] - */ - - AddRef(oPtr); - AddRef(fPtr->classCls); - AddRef(fPtr->objectCls); - AddRef(fPtr->classCls->thisPtr); - AddRef(fPtr->objectCls->thisPtr); - oPtr->command = NULL; - - if (!(oPtr->flags & DESTRUCTOR_CALLED) && !Tcl_InterpDeleted(interp)) { - CallContext *contextPtr = - TclOOGetCallContext(oPtr, NULL, DESTRUCTOR, NULL); - int result; - Tcl_InterpState state; - - oPtr->flags |= DESTRUCTOR_CALLED; - if (contextPtr != NULL) { - contextPtr->callPtr->flags |= DESTRUCTOR; - contextPtr->skip = 0; - state = Tcl_SaveInterpState(interp, TCL_OK); - result = Tcl_NRCallObjProc(interp, TclOOInvokeContext, - contextPtr, 0, NULL); - if (result != TCL_OK) { - Tcl_BackgroundException(interp, result); - } - Tcl_RestoreInterpState(interp, state); - TclOODeleteContext(contextPtr); - } - } - - /* - * OK, the destructor's been run. Time to splat the class data (if any) - * and nuke the namespace (which triggers the final crushing of the object - * structure itself). - * - * The class of objects needs some special care; if it is deleted (and - * we're not killing the whole interpreter) we force the delete of the - * class of classes now as well. Due to the incestuous nature of those two - * classes, if one goes the other must too and yet the tangle can - * sometimes not go away automatically; we force it here. [Bug 2962664] - */ - - if (!Tcl_InterpDeleted(interp) && IsRootObject(oPtr) - && !Deleted(fPtr->classCls->thisPtr)) { - Tcl_DeleteCommandFromToken(interp, fPtr->classCls->thisPtr->command); - } - - if (oPtr->classPtr != NULL) { - AddRef(oPtr->classPtr); - ReleaseClassContents(interp, oPtr); - } - - /* * The namespace is only deleted if it hasn't already been deleted. [Bug - * 2950259] + * 2950259]. If the namespace has already been deleted, then + * ObjectNamespaceDeleted() has already cleaned up this command. */ - if (oPtr->namespacePtr && ((Namespace *) oPtr->namespacePtr)->earlyDeleteProc != NULL) { - Tcl_DeleteNamespace(oPtr->namespacePtr); - } - if (oPtr->classPtr) { - DelRef(oPtr->classPtr); + if (oPtr->namespacePtr == NULL) { + /* + * ObjectNamespaceDeleted() has already done all the cleanup, but + * detected that the command was in the process of being deleted, and + * left the pointer allocated for us. + */ + DelRef(oPtr); + } else { + if (((Namespace *) oPtr->namespacePtr)->earlyDeleteProc == NULL) { + /* + * ObjectNamespaceDeleted() called us, and still has some work to + * do, so we leave the pointer allocated for it to finish, and then + * it will deallocate the pointer. + */ + } else { + Tcl_DeleteNamespace(oPtr->namespacePtr); + /* + * ObjectNamespaceDeleted() doesn't know it was us that just + * called, so it left the pointer allocated. + */ + DelRef(oPtr); + } } - DelRef(fPtr->classCls->thisPtr); - DelRef(fPtr->objectCls->thisPtr); - DelRef(fPtr->classCls); - DelRef(fPtr->objectCls); - DelRef(oPtr); + return; } /* @@ -960,7 +880,9 @@ ReleaseClassContents( int i; Class *clsPtr = oPtr->classPtr, *mixinSubclassPtr, *subclassPtr; Object *instancePtr; + Method *mPtr; Foundation *fPtr = oPtr->fPtr; + Tcl_Obj *variableObj; /* * Sanity check! @@ -1151,6 +1073,26 @@ ReleaseClassContents( ckfree(clsPtr->metadataPtr); clsPtr->metadataPtr = NULL; } + + ClearMixins(clsPtr); + ClearSuperclasses(clsPtr); + + FOREACH_HASH_VALUE(mPtr, &clsPtr->classMethods) { + TclOODelMethodRef(mPtr); + } + Tcl_DeleteHashTable(&clsPtr->classMethods); + TclOODelMethodRef(clsPtr->constructorPtr); + TclOODelMethodRef(clsPtr->destructorPtr); + + FOREACH(variableObj, clsPtr->variables) { + TclDecrRefCount(variableObj); + } + if (i) { + ckfree(clsPtr->variables.list); + } + + DelRef(clsPtr); + } /* @@ -1172,36 +1114,92 @@ ObjectNamespaceDeleted( * being deleted. */ { Object *oPtr = clientData; + Foundation *fPtr = oPtr->fPtr; FOREACH_HASH_DECLS; - Class *clsPtr = oPtr->classPtr, *mixinPtr; + Class *mixinPtr; Method *mPtr; Tcl_Obj *filterObj, *variableObj; - int deleteAlreadyInProgress = 0, i; + Tcl_Interp *interp = oPtr->fPtr->interp; + int finished = 0, i; + + + AddRef(fPtr->classCls); + AddRef(fPtr->objectCls); + AddRef(fPtr->classCls->thisPtr); + AddRef(fPtr->objectCls->thisPtr); /* - * Instruct everyone to no longer use any allocated fields of the object. - * Also delete the commands that refer to the object at this point (if - * they still exist) because otherwise their references to the object - * point into freed memory, allowing crashes. + * We do not run destructors on the core class objects when the + * interpreter is being deleted; their incestuous nature causes problems + * in that case when the destructor is partially deleted before the uses + * of it have gone. [Bug 2949397] */ - if (oPtr->command) { - if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) { - /* - * Namespace deletion must have been triggered by a trace on command - * deletion , meaning that ObjectRenamedTrace() is eventually going - * to be called . - */ - deleteAlreadyInProgress = 1; + if (!(oPtr->flags & DESTRUCTOR_CALLED) && !Tcl_InterpDeleted(interp)) { + CallContext *contextPtr = + TclOOGetCallContext(oPtr, NULL, DESTRUCTOR, NULL); + int result; + + Tcl_InterpState state; + + oPtr->flags |= DESTRUCTOR_CALLED; + if (contextPtr != NULL) { + contextPtr->callPtr->flags |= DESTRUCTOR; + contextPtr->skip = 0; + state = Tcl_SaveInterpState(interp, TCL_OK); + result = Tcl_NRCallObjProc(interp, TclOOInvokeContext, + contextPtr, 0, NULL); + if (result != TCL_OK) { + Tcl_BackgroundException(interp, result); + } + Tcl_RestoreInterpState(interp, state); + TclOODeleteContext(contextPtr); } + } + /* + * Instruct everyone to no longer use any allocated fields of the object. + * Also delete the command that refers to the object at this point (if + * it still exists) because otherwise its pointer to the object + * points into freed memory. + */ + + if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) { + /* + * Something has already started the command deletion process. We can + * go ahead and clean up the the namespace, + */ + } else { + /* + * The namespace must have been deleted directly. Delete the command + * as well. + */ Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command); + finished = 1; } + oPtr->command = NULL; + if (oPtr->myCommand) { Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->myCommand); } /* + * The class of objects needs some special care; if it is deleted (and + * we're not killing the whole interpreter) we force the delete of the + * class of classes now as well. Due to the incestuous nature of those two + * classes, if one goes the other must too and yet the tangle can + * sometimes not go away automatically; we force it here. [Bug 2962664] + */ + if (!Tcl_InterpDeleted(interp) && IsRootObject(oPtr) + && !Deleted(fPtr->classCls->thisPtr)) { + Tcl_DeleteCommandFromToken(interp, fPtr->classCls->thisPtr->command); + } + + if (oPtr->classPtr != NULL) { + ReleaseClassContents(interp, oPtr); + } + + /* * Splice the object out of its context. After this, we must *not* call * methods on the object. */ @@ -1260,77 +1258,27 @@ ObjectNamespaceDeleted( } /* - * If this was a class, there's additional deletion work to do. - */ - - if (clsPtr != NULL) { - Tcl_ObjectMetadataType *metadataTypePtr; - ClientData value; - - if (clsPtr->metadataPtr != NULL) { - FOREACH_HASH(metadataTypePtr, value, clsPtr->metadataPtr) { - metadataTypePtr->deleteProc(value); - } - Tcl_DeleteHashTable(clsPtr->metadataPtr); - ckfree(clsPtr->metadataPtr); - clsPtr->metadataPtr = NULL; - } - - FOREACH(filterObj, clsPtr->filters) { - TclDecrRefCount(filterObj); - } - if (i) { - ckfree(clsPtr->filters.list); - clsPtr->filters.num = 0; - } - - ClearMixins(clsPtr); - - ClearSuperclasses(clsPtr); - - if (clsPtr->subclasses.list) { - ckfree(clsPtr->subclasses.list); - clsPtr->subclasses.list = NULL; - clsPtr->subclasses.num = 0; - } - if (clsPtr->instances.list) { - ckfree(clsPtr->instances.list); - clsPtr->instances.list = NULL; - clsPtr->instances.num = 0; - } - if (clsPtr->mixinSubs.list) { - ckfree(clsPtr->mixinSubs.list); - clsPtr->mixinSubs.list = NULL; - clsPtr->mixinSubs.num = 0; - } - - FOREACH_HASH_VALUE(mPtr, &clsPtr->classMethods) { - TclOODelMethodRef(mPtr); - } - Tcl_DeleteHashTable(&clsPtr->classMethods); - TclOODelMethodRef(clsPtr->constructorPtr); - TclOODelMethodRef(clsPtr->destructorPtr); - - FOREACH(variableObj, clsPtr->variables) { - TclDecrRefCount(variableObj); - } - if (i) { - ckfree(clsPtr->variables.list); - } - - DelRef(clsPtr); - } - - /* * Delete the object structure itself. */ - if (deleteAlreadyInProgress) { - oPtr->classPtr = NULL; - oPtr->namespacePtr = NULL; - } else { + oPtr->classPtr = NULL; + oPtr->namespacePtr = NULL; + + DelRef(fPtr->classCls->thisPtr); + DelRef(fPtr->objectCls->thisPtr); + DelRef(fPtr->classCls); + DelRef(fPtr->objectCls); + if (finished) { + /* + * ObjectRenamedTrace called us, and not the other way around. + */ DelRef(oPtr); + } else { + /* + * ObjectRenamedTrace will call DelRef(oPtr). + */ } + return; } @@ -1424,7 +1372,7 @@ TclOOAddToInstances( void TclOORemoveFromSubclasses( Class *subPtr, /* The subclass to remove. */ - Class *superPtr) /* The superclass to (possibly) remove the + Class *superPtr) /* The superclass to possibly remove the * subclass reference from. */ { int i; @@ -1495,7 +1443,7 @@ TclOOAddToSubclasses( void TclOORemoveFromMixinSubs( Class *subPtr, /* The subclass to remove. */ - Class *superPtr) /* The superclass to (possibly) remove the + Class *superPtr) /* The superclass to possibly remove the * subclass reference from. */ { int i; @@ -1569,7 +1517,7 @@ AllocClass( * class. */ Object *useThisObj) /* Object that is to act as the class * representation, or NULL if a new object - * (with automatic name) is to be used. */ + * with automatic name is to be used. */ { Foundation *fPtr = GetFoundation(interp); Class *clsPtr = ckalloc(sizeof(Class)); @@ -1641,7 +1589,6 @@ AllocClass( * * ---------------------------------------------------------------------- */ - Tcl_Object Tcl_NewObjectInstance( Tcl_Interp *interp, /* Interpreter context. */ @@ -1658,54 +1605,14 @@ Tcl_NewObjectInstance( * constructor. */ { register Class *classPtr = (Class *) cls; - Foundation *fPtr = GetFoundation(interp); Object *oPtr; - /* - * Check if we're going to create an object over an existing command; - * that's not allowed. - */ - - if (nameStr && Tcl_FindCommand(interp, nameStr, NULL, - TCL_NAMESPACE_ONLY)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't create object \"%s\": command already exists with" - " that name", nameStr)); - Tcl_SetErrorCode(interp, "TCL", "OO", "OVERWRITE_OBJECT", NULL); - return NULL; - } - - /* - * Create the object. - */ - - oPtr = AllocObject(interp, nameStr, nsNameStr); - oPtr->selfCls = classPtr; - TclOOAddToInstances(oPtr, classPtr); - - /* - * Check to see if we're really creating a class. If so, allocate the - * class structure as well. - */ - - if (TclOOIsReachable(fPtr->classCls, classPtr)) { - /* - * Is a class, so attach a class structure. Note that the AllocClass - * function splices the structure into the object, so we don't have - * to. Once that's done, we need to repatch the object to have the - * right class since AllocClass interferes with that. - */ - - AllocClass(interp, oPtr); - oPtr->selfCls = classPtr; - TclOOAddToSubclasses(oPtr->classPtr, fPtr->objectCls); - } else { - oPtr->classPtr = NULL; - } + oPtr = TclNewObjectInstanceCommon(interp, classPtr, nameStr, nsNameStr); + if (oPtr == NULL) {return NULL;} /* - * Run constructors, except when objc < 0 (a special flag case used for - * object cloning only). + * Run constructors, except when objc < 0, which is a special flag case + * used for object cloning only. */ if (objc >= 0) { @@ -1733,9 +1640,8 @@ Tcl_NewObjectInstance( } /* - * It's an error if the object was whacked in the constructor. - * Force this if it isn't already an error (don't want to lose - * errors by accident...) [Bug 2903011] + * Ensure an error if the object was deleted in the constructor. + * Don't want to lose errors by accident. [Bug 2903011] */ if (result != TCL_ERROR && Deleted(oPtr)) { @@ -1786,7 +1692,6 @@ TclNRNewObjectInstance( * successful allocation. */ { register Class *classPtr = (Class *) cls; - Foundation *fPtr = GetFoundation(interp); CallContext *contextPtr; Tcl_InterpState state; Object *oPtr; @@ -1796,45 +1701,8 @@ TclNRNewObjectInstance( */ AddRef(classPtr); - /* - * Check if we're going to create an object over an existing command; - * that's not allowed. - */ - - if (nameStr && Tcl_FindCommand(interp, nameStr, NULL, - TCL_NAMESPACE_ONLY)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't create object \"%s\": command already exists with" - " that name", nameStr)); - Tcl_SetErrorCode(interp, "TCL", "OO", "OVERWRITE_OBJECT", NULL); - return TCL_ERROR; - } - - /* - * Create the object. - */ - - oPtr = AllocObject(interp, nameStr, nsNameStr); - oPtr->selfCls = classPtr; - TclOOAddToInstances(oPtr, classPtr); - - /* - * Check to see if we're really creating a class. If so, allocate the - * class structure as well. - */ - - if (TclOOIsReachable(fPtr->classCls, classPtr)) { - /* - * Is a class, so attach a class structure. Note that the AllocClass - * function splices the structure into the object, so we don't have - * to. Once that's done, we need to repatch the object to have the - * right class since AllocClass interferes with that. - */ - - AllocClass(interp, oPtr); - oPtr->selfCls = classPtr; - TclOOAddToSubclasses(oPtr->classPtr, fPtr->objectCls); - } + oPtr = TclNewObjectInstanceCommon(interp, classPtr, nameStr, nsNameStr); + if (oPtr == NULL) {return TCL_ERROR;} /* * Run constructors, except when objc < 0 (a special flag case used for @@ -1877,6 +1745,62 @@ TclNRNewObjectInstance( return TclOOInvokeContext(contextPtr, interp, objc, objv); } + +Object * +TclNewObjectInstanceCommon( + Tcl_Interp *interp, + Class *classPtr, + const char *nameStr, + const char *nsNameStr) +{ + Foundation *fPtr = GetFoundation(interp); + Object *oPtr; + + /* + * Disallow creation of an object over an existing command. + */ + + if (nameStr && Tcl_FindCommand(interp, nameStr, NULL, + TCL_NAMESPACE_ONLY)) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "can't create object \"%s\": command already exists with" + " that name", nameStr)); + Tcl_SetErrorCode(interp, "TCL", "OO", "OVERWRITE_OBJECT", NULL); + return NULL; + } + + /* + * Create the object. + */ + + oPtr = AllocObject(interp, nameStr, nsNameStr); + oPtr->selfCls = classPtr; + TclOOAddToInstances(oPtr, classPtr); + + /* + * Check to see if we're really creating a class. If so, allocate the + * class structure as well. + */ + + if (TclOOIsReachable(fPtr->classCls, classPtr)) { + /* + * Is a class, so attach a class structure. Note that the AllocClass + * function splices the structure into the object, so we don't have + * to. Once that's done, we need to repatch the object to have the + * right class since AllocClass interferes with that. + */ + + AllocClass(interp, oPtr); + oPtr->selfCls = classPtr; + TclOOAddToSubclasses(oPtr->classPtr, fPtr->objectCls); + } else { + oPtr->classPtr = NULL; + } + return oPtr; +} + + + static int FinalizeAlloc( ClientData data[], diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index 11ba698..83b4d58 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -495,6 +495,10 @@ MODULE_SCOPE int TclNRNewObjectInstance(Tcl_Interp *interp, const char *nsNameStr, int objc, Tcl_Obj *const *objv, int skip, Tcl_Object *objectPtr); +MODULE_SCOPE Object * TclNewObjectInstanceCommon(Tcl_Interp *interp, + Class *classPtr, + const char *nameStr, + const char *nsNameStr); MODULE_SCOPE int TclOODefineSlots(Foundation *fPtr); MODULE_SCOPE void TclOODeleteChain(CallChain *callPtr); MODULE_SCOPE void TclOODeleteChainCache(Tcl_HashTable *tablePtr); -- cgit v0.12 From a8a602d3ffaf67e797df3e1a1e9a57124c43e267 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Mon, 27 Nov 2017 23:30:57 +0000 Subject: Eliminate some duplicate code in tclOO.c/Tcl_NewObjectInstance(). --- generic/tclOO.c | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index 3fece42..07a96a7 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -1606,6 +1606,7 @@ Tcl_NewObjectInstance( { register Class *classPtr = (Class *) cls; Object *oPtr; + ClientData clientData[4]; oPtr = TclNewObjectInstanceCommon(interp, classPtr, nameStr, nsNameStr); if (oPtr == NULL) {return NULL;} @@ -1639,35 +1640,16 @@ Tcl_NewObjectInstance( TclResetRewriteEnsemble(interp, 1); } - /* - * Ensure an error if the object was deleted in the constructor. - * Don't want to lose errors by accident. [Bug 2903011] - */ + clientData[0] = contextPtr; + clientData[1] = oPtr; + clientData[2] = state; + clientData[3] = &oPtr; - if (result != TCL_ERROR && Deleted(oPtr)) { - Tcl_SetObjResult(interp, Tcl_NewStringObj( - "object deleted in constructor", -1)); - Tcl_SetErrorCode(interp, "TCL", "OO", "STILLBORN", NULL); - result = TCL_ERROR; - } - TclOODeleteContext(contextPtr); + AddRef(oPtr); + result = FinalizeAlloc(clientData, interp, result); if (result != TCL_OK) { - Tcl_DiscardInterpState(state); - - /* - * Take care to not delete a deleted object; that would be - * bad. [Bug 2903011] Also take care to make sure that we have - * the name of the command before we delete it. [Bug - * 9dd1bd7a74] - */ - - if (!Deleted(oPtr)) { - (void) TclOOObjectName(interp, oPtr); - Tcl_DeleteCommandFromToken(interp, oPtr->command); - } return NULL; } - Tcl_RestoreInterpState(interp, state); } } @@ -1726,7 +1708,7 @@ TclNRNewObjectInstance( contextPtr->skip = skip; /* - * Adjust the ensmble tracking record if necessary. [Bug 3514761] + * Adjust the ensemble tracking record if necessary. [Bug 3514761] */ if (TclInitRewriteEnsemble(interp, skip, skip, objv)) { @@ -1813,9 +1795,8 @@ FinalizeAlloc( Tcl_Object *objectPtr = data[3]; /* - * It's an error if the object was whacked in the constructor. Force this - * if it isn't already an error (don't want to lose errors by accident...) - * [Bug 2903011] + * Ensure an error if the object was deleted in the constructor. + * Don't want to lose errors by accident. [Bug 2903011] */ if (result != TCL_ERROR && Deleted(oPtr)) { -- cgit v0.12 From fe65a79d19b49f2cb167f72b3e422a71be69bead Mon Sep 17 00:00:00 2001 From: pooryorick Date: Tue, 28 Nov 2017 15:43:41 +0000 Subject: Minor refactoring of TclOO object reference count booking during object creation. --- generic/tclOO.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index 07a96a7..d7ae349 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -1678,11 +1678,6 @@ TclNRNewObjectInstance( Tcl_InterpState state; Object *oPtr; - /* - * Protect classPtr from getting cleaned up when the command is created. - */ - AddRef(classPtr); - oPtr = TclNewObjectInstanceCommon(interp, classPtr, nameStr, nsNameStr); if (oPtr == NULL) {return TCL_ERROR;} @@ -1693,13 +1688,11 @@ TclNRNewObjectInstance( if (objc < 0) { *objectPtr = (Tcl_Object) oPtr; - DelRef(classPtr); return TCL_OK; } contextPtr = TclOOGetCallContext(oPtr, NULL, CONSTRUCTOR, NULL); if (contextPtr == NULL) { *objectPtr = (Tcl_Object) oPtr; - DelRef(classPtr); return TCL_OK; } @@ -1723,7 +1716,6 @@ TclNRNewObjectInstance( TclNRAddCallback(interp, FinalizeAlloc, contextPtr, oPtr, state, objectPtr); TclPushTailcallPoint(interp); - DelRef(classPtr); return TclOOInvokeContext(contextPtr, interp, objc, objv); } @@ -1755,7 +1747,15 @@ TclNewObjectInstanceCommon( * Create the object. */ + /* + * The command for the object could have the same name as the command + * associated with classPtr, so protect the structure from deallocation + * here. + */ + AddRef(classPtr); + oPtr = AllocObject(interp, nameStr, nsNameStr); + DelRef(classPtr); oPtr->selfCls = classPtr; TclOOAddToInstances(oPtr, classPtr); -- cgit v0.12 From 8396e878da979c46691b73731c51888f05e7bb77 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Tue, 28 Nov 2017 23:33:14 +0000 Subject: Fix for issue [6cf568a21b]: Tcl_Eval() causes new segfault (TclOO object creation by qualified name). --- generic/tclOO.c | 60 +++++++++++++++++++++++++++++++-------------------------- tests/oo.test | 3 +++ 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index d7ae349..93abf3f 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -59,7 +59,7 @@ static const struct { static Class * AllocClass(Tcl_Interp *interp, Object *useThisObj); static Object * AllocObject(Tcl_Interp *interp, const char *nameStr, - const char *nsNameStr); + Namespace *nsPtr, const char *nsNameStr); static void ClearMixins(Class *clsPtr); static void ClearSuperclasses(Class *clsPtr); static int CloneClassMethod(Tcl_Interp *interp, Class *clsPtr, @@ -380,9 +380,9 @@ InitFoundation( */ fPtr->objectCls = AllocClass(interp, - AllocObject(interp, "::oo::object", NULL)); + AllocObject(interp, "object", (Namespace *)fPtr->ooNs, NULL)); fPtr->classCls = AllocClass(interp, - AllocObject(interp, "::oo::class", NULL)); + AllocObject(interp, "class", (Namespace *)fPtr->ooNs, NULL)); fPtr->objectCls->thisPtr->selfCls = fPtr->classCls; fPtr->objectCls->thisPtr->flags |= ROOT_OBJECT; fPtr->objectCls->flags |= ROOT_OBJECT; @@ -552,6 +552,8 @@ AllocObject( * if the OO system should pick the object * name itself (equal to the namespace * name). */ + Namespace *nsPtr, /* The namespace to create the object in, + or NULL if *nameStr is NULL */ const char *nsNameStr) /* The name of the namespace to create, or * NULL if the OO system should pick a unique * name itself. If this is non-NULL but names @@ -562,10 +564,7 @@ AllocObject( Object *oPtr; Command *cmdPtr; CommandTrace *tracePtr; - Namespace *nsPtr, *altNsPtr, *cxtNsPtr; - Tcl_Namespace *inNsPtr; int creationEpoch, ignored; - const char *simpleName; oPtr = ckalloc(sizeof(Object)); memset(oPtr, 0, sizeof(Object)); @@ -653,17 +652,11 @@ AllocObject( * command is deleted). */ - if (nameStr) { - inNsPtr = TclGetCurrentNamespace(interp); - } else { + if (!nameStr) { nameStr = oPtr->namespacePtr->name; - inNsPtr = oPtr->namespacePtr; + nsPtr = (Namespace *)oPtr->namespacePtr; } - - TclGetNamespaceForQualName(interp, nameStr, (Namespace *) inNsPtr, 0, - &nsPtr, &altNsPtr, &cxtNsPtr, &simpleName); - - oPtr->command = TclCreateObjCommandInNs(interp, simpleName, + oPtr->command = TclCreateObjCommandInNs(interp, nameStr, (Tcl_Namespace *)nsPtr, PublicObjectCmd, oPtr, NULL); /* @@ -1528,7 +1521,7 @@ AllocClass( memset(clsPtr, 0, sizeof(Class)); if (useThisObj == NULL) { - clsPtr->thisPtr = AllocObject(interp, NULL, NULL); + clsPtr->thisPtr = AllocObject(interp, NULL, NULL, NULL); } else { clsPtr->thisPtr = useThisObj; } @@ -1727,20 +1720,33 @@ TclNewObjectInstanceCommon( const char *nameStr, const char *nsNameStr) { + Tcl_HashEntry *hPtr; Foundation *fPtr = GetFoundation(interp); Object *oPtr; + const char *simpleName = NULL; + Namespace *nsPtr = NULL, *dummy, + *inNsPtr = (Namespace *)TclGetCurrentNamespace(interp); + int isNew; - /* - * Disallow creation of an object over an existing command. - */ + if (nameStr) { + TclGetNamespaceForQualName(interp, nameStr, inNsPtr, TCL_CREATE_NS_IF_UNKNOWN, + &nsPtr, &dummy, &dummy, &simpleName); - if (nameStr && Tcl_FindCommand(interp, nameStr, NULL, - TCL_NAMESPACE_ONLY)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't create object \"%s\": command already exists with" - " that name", nameStr)); - Tcl_SetErrorCode(interp, "TCL", "OO", "OVERWRITE_OBJECT", NULL); - return NULL; + /* + * Disallow creation of an object over an existing command. + */ + + hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, simpleName, &isNew); + if (isNew) { + /* Just kidding */ + Tcl_DeleteHashEntry(hPtr); + } else { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "can't create object \"%s\": command already exists with" + " that name", nameStr)); + Tcl_SetErrorCode(interp, "TCL", "OO", "OVERWRITE_OBJECT", NULL); + return NULL; + } } /* @@ -1754,7 +1760,7 @@ TclNewObjectInstanceCommon( */ AddRef(classPtr); - oPtr = AllocObject(interp, nameStr, nsNameStr); + oPtr = AllocObject(interp, simpleName, nsPtr, nsNameStr); DelRef(classPtr); oPtr->selfCls = classPtr; TclOOAddToInstances(oPtr, classPtr); diff --git a/tests/oo.test b/tests/oo.test index b6af1ee..c44ec18 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -128,6 +128,9 @@ test oo-1.3 {basic test of OO functionality: no classes} { test oo-1.4 {basic test of OO functionality} -body { oo::object create {} } -returnCodes 1 -result {object name must not be empty} +test oo-1.4.1 {fully-qualified nested name} -body { + oo::object create ::one::two::three +} -result {::one::two::three} test oo-1.5 {basic test of OO functionality} -body { oo::object doesnotexist } -returnCodes 1 -result {unknown method "doesnotexist": must be create, destroy or new} -- cgit v0.12 From 3af16acbcb63ea2935d71b905371252560dc4659 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 29 Nov 2017 08:59:49 +0000 Subject: Treat invalid UTF-8 characters in the range 0x80-0x9F as cp1252: See [https://en.wikipedia.org/wiki/UTF-8]. To be added to TIP #389 --- doc/Utf.3 | 3 +++ generic/tclInt.h | 2 +- generic/tclUtf.c | 17 +++++++++++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/doc/Utf.3 b/doc/Utf.3 index 638f349..de9545d 100644 --- a/doc/Utf.3 +++ b/doc/Utf.3 @@ -140,6 +140,9 @@ number of bytes read from \fIsrc\fR. The caller must ensure that the source buffer is long enough such that this routine does not run off the end and dereference non-existent or random memory; if the source buffer is known to be null-terminated, this will not happen. If the input is +a byte in the range 0x80 - 0x9F, \fBTcl_UtfToUniChar\fR assumes the +cp1252 encoding, stores the corresponding Tcl_UniChar in \fI*chPtr\fR +and returns 1. If the input is otherwise 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. diff --git a/generic/tclInt.h b/generic/tclInt.h index ef88bf5..d77889e 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4446,7 +4446,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, */ #define TclUtfToUniChar(str, chPtr) \ - ((((unsigned char) *(str)) < 0xC0) ? \ + ((((unsigned char) *(str)) < 0x80) ? \ ((*(chPtr) = (unsigned char) *(str)), 1) \ : Tcl_UtfToUniChar(str, chPtr)) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 4ed201f..aed332f 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -272,6 +272,13 @@ Tcl_UniCharToUtfDString( *--------------------------------------------------------------------------- */ +static const unsigned short cp1252[32] = { + 0x20ac, 0x81, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, + 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x8D, 0x017D, 0x8F, + 0x90, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, + 0x2DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x9D, 0x017E, 0x0178 +}; + int Tcl_UtfToUniChar( register const char *src, /* The UTF-8 string. */ @@ -288,11 +295,17 @@ Tcl_UtfToUniChar( 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 + * Treats naked trail bytes 0x80 to 0x9F as valid characters from + * the cp1252 table. See: + * Also treats \0 and other naked trail bytes 0xA0 to 0xBF as valid * characters representing themselves. */ - *chPtr = (Tcl_UniChar) byte; + if ((unsigned)(byte-0x80) < (unsigned) 0x20) { + *chPtr = (Tcl_UniChar) cp1252[byte-0x80]; + } else { + *chPtr = (Tcl_UniChar) byte; + } return 1; } else if (byte < 0xE0) { if ((src[1] & 0xC0) == 0x80) { -- cgit v0.12 From 03c66864aa2ffa9871ce216b00cd661eaf1be688 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 29 Nov 2017 09:49:31 +0000 Subject: Fix [8e1e31eac0fd6b6c4452bc108a98ab08c6b64588|8e1e31eac0]: lsort treats NUL chars strangely --- generic/tclCmdIL.c | 4 +-- generic/tclCmdMZ.c | 2 +- generic/tclInt.h | 1 + generic/tclUtf.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 80 insertions(+), 6 deletions(-) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 47076ec..b41d312 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2945,7 +2945,7 @@ Tcl_LsearchObjCmd( double patDouble, objDouble; SortInfo sortInfo; Tcl_Obj *patObj, **listv, *listPtr, *startPtr, *itemPtr; - SortStrCmpFn_t strCmpFn = strcmp; + SortStrCmpFn_t strCmpFn = TclUtfCmp; Tcl_RegExp regexp = NULL; static const char *const options[] = { "-all", "-ascii", "-bisect", "-decreasing", "-dictionary", @@ -4263,7 +4263,7 @@ SortCompare( int order = 0; if (infoPtr->sortMode == SORTMODE_ASCII) { - order = strcmp(elemPtr1->collationKey.strValuePtr, + order = TclUtfCmp(elemPtr1->collationKey.strValuePtr, elemPtr2->collationKey.strValuePtr); } else if (infoPtr->sortMode == SORTMODE_ASCII_NC) { order = TclUtfCasecmp(elemPtr1->collationKey.strValuePtr, diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ad1dd5f..a206cc5 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -3547,7 +3547,7 @@ TclNRSwitchObjCmd( OPT_LAST }; typedef int (*strCmpFn_t)(const char *, const char *); - strCmpFn_t strCmpFn = strcmp; + strCmpFn_t strCmpFn = TclUtfCmp; mode = OPT_EXACT; foundmode = 0; diff --git a/generic/tclInt.h b/generic/tclInt.h index d77889e..ad1d9c6 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3219,6 +3219,7 @@ MODULE_SCOPE int TclTrimLeft(const char *bytes, int numBytes, const char *trim, int numTrim); MODULE_SCOPE int TclTrimRight(const char *bytes, int numBytes, const char *trim, int numTrim); +MODULE_SCOPE int TclUtfCmp(const char *cs, const char *ct); MODULE_SCOPE int TclUtfCasecmp(const char *cs, const char *ct); MODULE_SCOPE int TclUtfCount(int ch); MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized(ClientData clientData); diff --git a/generic/tclUtf.c b/generic/tclUtf.c index aed332f..aff10c1 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -1108,6 +1108,15 @@ Tcl_UtfNcmp( cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); +#if TCL_UTF_MAX == 4 + /* map high surrogate characters to values > 0xffff */ + if ((ch1 & 0xFC00) == 0xD800) { + ch1 += 0x4000; + } + if ((ch2 & 0xFC00) == 0xD800) { + ch2 += 0x4000; + } +#endif if (ch1 != ch2) { return (ch1 - ch2); } @@ -1140,6 +1149,7 @@ Tcl_UtfNcasecmp( unsigned long numChars) /* Number of UTF chars to compare. */ { Tcl_UniChar ch1 = 0, ch2 = 0; + while (numChars-- > 0) { /* * n must be interpreted as chars, not bytes. @@ -1148,6 +1158,15 @@ Tcl_UtfNcasecmp( */ cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); +#if TCL_UTF_MAX == 4 + /* map high surrogate characters to values > 0xffff */ + if ((ch1 & 0xFC00) == 0xD800) { + ch1 += 0x4000; + } + if ((ch2 & 0xFC00) == 0xD800) { + ch2 += 0x4000; + } +#endif if (ch1 != ch2) { ch1 = Tcl_UniCharToLower(ch1); ch2 = Tcl_UniCharToLower(ch2); @@ -1158,11 +1177,56 @@ Tcl_UtfNcasecmp( } return 0; } + +/* + *---------------------------------------------------------------------- + * + * Tcl_UtfCmp -- + * + * Compare UTF chars of string cs to string ct case sensitively. + * Replacement for strcmp in Tcl core, in places where UTF-8 should + * be handled. + * + * Results: + * Return <0 if cs < ct, 0 if cs == ct, or >0 if cs > ct. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TclUtfCmp( + const char *cs, /* UTF string to compare to ct. */ + const char *ct) /* UTF string cs is compared to. */ +{ + Tcl_UniChar ch1 = 0, ch2 = 0; + + while (*cs && *ct) { + cs += TclUtfToUniChar(cs, &ch1); + ct += TclUtfToUniChar(ct, &ch2); +#if TCL_UTF_MAX == 4 + /* map high surrogate characters to values > 0xffff */ + if ((ch1 & 0xFC00) == 0xD800) { + ch1 += 0x4000; + } + if ((ch2 & 0xFC00) == 0xD800) { + ch2 += 0x4000; + } +#endif + if (ch1 != ch2) { + return ch1 - ch2; + } + } + return UCHAR(*cs) - UCHAR(*ct); +} + /* *---------------------------------------------------------------------- * - * Tcl_UtfNcasecmp -- + * TclUtfCasecmp -- * * Compare UTF chars of string cs to string ct case insensitively. * Replacement for strcasecmp in Tcl core, in places where UTF-8 should @@ -1182,11 +1246,20 @@ TclUtfCasecmp( const char *cs, /* UTF string to compare to ct. */ const char *ct) /* UTF string cs is compared to. */ { - while (*cs && *ct) { - Tcl_UniChar ch1 = 0, ch2 = 0; + Tcl_UniChar ch1 = 0, ch2 = 0; + while (*cs && *ct) { cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); +#if TCL_UTF_MAX == 4 + /* map high surrogate characters to values > 0xffff */ + if ((ch1 & 0xFC00) == 0xD800) { + ch1 += 0x4000; + } + if ((ch2 & 0xFC00) == 0xD800) { + ch2 += 0x4000; + } +#endif if (ch1 != ch2) { ch1 = Tcl_UniCharToLower(ch1); ch2 = Tcl_UniCharToLower(ch2); -- cgit v0.12 From 4fc9a4c991e75f3060fad431f5951cda27377a5a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 29 Nov 2017 11:04:20 +0000 Subject: Update some functions in tclUtf.c to handle surrogate pairs when TCL_UTF_MAX == 4. Also update documentation to distinguish better between "Tcl_UniChar" and "Unicode character": Those are not necessary the same when TCL_UTF_MAX == 4. No change when TCL_UTF_MAX == 4 or TCL_UTF_MAX == 6. --- doc/ToUpper.3 | 2 +- doc/UniCharIsAlpha.3 | 5 +--- doc/Utf.3 | 2 +- generic/tclUtf.c | 74 ++++++++++++++++++++++++++++++++++++++++------------ 4 files changed, 61 insertions(+), 22 deletions(-) diff --git a/doc/ToUpper.3 b/doc/ToUpper.3 index b933e9c..be614e7 100644 --- a/doc/ToUpper.3 +++ b/doc/ToUpper.3 @@ -33,7 +33,7 @@ int .SH ARGUMENTS .AS char *str in/out .AP int ch in -The Tcl_UniChar to be converted. +The Unicode character to be converted. .AP char *str in/out Pointer to UTF-8 string to be converted in place. .BE diff --git a/doc/UniCharIsAlpha.3 b/doc/UniCharIsAlpha.3 index 2336c34..5ba3fc9 100644 --- a/doc/UniCharIsAlpha.3 +++ b/doc/UniCharIsAlpha.3 @@ -53,14 +53,11 @@ The Tcl_UniChar to be examined. .SH DESCRIPTION .PP -All of the routines described examine Tcl_UniChars and return a +All of the routines described examine Unicode characters and return a boolean value. A non-zero return value means that the character does belong to the character class associated with the called routine. The rest of this document just describes the character classes associated with the various routines. -.PP -Note: A Tcl_UniChar is a Unicode character represented as an unsigned, -fixed-size quantity. .SH "CHARACTER CLASSES" .PP diff --git a/doc/Utf.3 b/doc/Utf.3 index 378c806..9d0c617 100644 --- a/doc/Utf.3 +++ b/doc/Utf.3 @@ -77,7 +77,7 @@ int 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. +The Unicode character 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 diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 3b39226..17f769d 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -404,7 +404,7 @@ Tcl_UtfToUniCharDString( * appended to this previously initialized * DString. */ { - Tcl_UniChar ch, *w, *wString; + Tcl_UniChar ch = 0, *w, *wString; const char *p, *end; int oldLength; @@ -528,13 +528,13 @@ Tcl_NumUtfChars( * * Tcl_UtfFindFirst -- * - * Returns a pointer to the first occurance of the given Tcl_UniChar in - * the NULL-terminated UTF-8 string. The NULL terminator is considered + * Returns a pointer to the first occurance of the given Unicode character + * in the NULL-terminated UTF-8 string. The NULL terminator is considered * part of the UTF-8 string. Equivalent to Plan 9 utfrune(). * * Results: - * As above. If the Tcl_UniChar does not exist in the given string, the - * return value is NULL. + * As above. If the Unicode character does not exist in the given string, + * the return value is NULL. * * Side effects: * None. @@ -545,14 +545,21 @@ Tcl_NumUtfChars( const char * Tcl_UtfFindFirst( const char *src, /* The UTF-8 string to be searched. */ - int ch) /* The Tcl_UniChar to search for. */ + int ch) /* The Unicode character to search for. */ { - int len; + int len, fullchar; Tcl_UniChar find = 0; while (1) { len = TclUtfToUniChar(src, &find); - if (find == ch) { + fullchar = find; +#if TCL_UTF_MAX == 4 + if (!len) { + len += TclUtfToUniChar(src, &find); + fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + } +#endif + if (find == fullchar) { return src; } if (*src == '\0') { @@ -567,8 +574,8 @@ Tcl_UtfFindFirst( * * Tcl_UtfFindLast -- * - * Returns a pointer to the last occurance of the given Tcl_UniChar in - * the NULL-terminated UTF-8 string. The NULL terminator is considered + * Returns a pointer to the last occurance of the given Unicode character + * in the NULL-terminated UTF-8 string. The NULL terminator is considered * part of the UTF-8 string. Equivalent to Plan 9 utfrrune(). * * Results: @@ -584,16 +591,23 @@ Tcl_UtfFindFirst( const char * Tcl_UtfFindLast( const char *src, /* The UTF-8 string to be searched. */ - int ch) /* The Tcl_UniChar to search for. */ + int ch) /* The Unicode character to search for. */ { - int len; + int len, fullchar; Tcl_UniChar find = 0; const char *last; last = NULL; while (1) { len = TclUtfToUniChar(src, &find); - if (find == ch) { + fullchar = find; +#if TCL_UTF_MAX == 4 + if (!len) { + len += TclUtfToUniChar(src, &find); + fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + } +#endif + if (find == fullchar) { last = src; } if (*src == '\0') { @@ -1058,6 +1072,15 @@ Tcl_UtfNcmp( cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); +#if TCL_UTF_MAX == 4 + /* map high surrogate characters to values > 0xffff */ + if ((ch1 & 0xFC00) == 0xD800) { + ch1 += 0x4000; + } + if ((ch2 & 0xFC00) == 0xD800) { + ch2 += 0x4000; + } +#endif if (ch1 != ch2) { return (ch1 - ch2); } @@ -1090,6 +1113,7 @@ Tcl_UtfNcasecmp( unsigned long numChars) /* Number of UTF chars to compare. */ { Tcl_UniChar ch1 = 0, ch2 = 0; + while (numChars-- > 0) { /* * n must be interpreted as chars, not bytes. @@ -1098,6 +1122,15 @@ Tcl_UtfNcasecmp( */ cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); +#if TCL_UTF_MAX == 4 + /* map high surrogate characters to values > 0xffff */ + if ((ch1 & 0xFC00) == 0xD800) { + ch1 += 0x4000; + } + if ((ch2 & 0xFC00) == 0xD800) { + ch2 += 0x4000; + } +#endif if (ch1 != ch2) { ch1 = Tcl_UniCharToLower(ch1); ch2 = Tcl_UniCharToLower(ch2); @@ -1112,7 +1145,7 @@ Tcl_UtfNcasecmp( /* *---------------------------------------------------------------------- * - * Tcl_UtfNcasecmp -- + * TclUtfCasecmp -- * * Compare UTF chars of string cs to string ct case insensitively. * Replacement for strcasecmp in Tcl core, in places where UTF-8 should @@ -1132,11 +1165,20 @@ TclUtfCasecmp( const char *cs, /* UTF string to compare to ct. */ const char *ct) /* UTF string cs is compared to. */ { - while (*cs && *ct) { - Tcl_UniChar ch1, ch2; + Tcl_UniChar ch1 = 0, ch2 = 0; + while (*cs && *ct) { cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); +#if TCL_UTF_MAX == 4 + /* map high surrogate characters to values > 0xffff */ + if ((ch1 & 0xFC00) == 0xD800) { + ch1 += 0x4000; + } + if ((ch2 & 0xFC00) == 0xD800) { + ch2 += 0x4000; + } +#endif if (ch1 != ch2) { ch1 = Tcl_UniCharToLower(ch1); ch2 = Tcl_UniCharToLower(ch2); -- cgit v0.12 From c032f5043e88e8f54ac32f526413a3b62c9a20f4 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 29 Nov 2017 12:01:21 +0000 Subject: Fix for [6bca38d59b], TclOO segmentation fault cleaning up objects that that have mixed themselves into themselves. --- generic/tclOO.c | 128 ++++++++++++++++++++++++++++++++------------------------ tests/oo.test | 33 +++++++++++++-- 2 files changed, 103 insertions(+), 58 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index 93abf3f..5404abc 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -913,28 +913,30 @@ ReleaseClassContents( } if (!IsRootClass(oPtr)) { FOREACH(instancePtr, clsPtr->instances) { - int j; - if (instancePtr->selfCls == clsPtr) { - instancePtr->flags |= CLASS_GONE; - } - for(j=0 ; jmixins.num ; j++) { - Class *mixin = instancePtr->mixins.list[j]; - Class *nextMixin = NULL; - if (mixin == clsPtr) { - if (j < instancePtr->mixins.num - 1) { - nextMixin = instancePtr->mixins.list[j+1]; - } - if (j == 0) { - instancePtr->mixins.num = 0; - instancePtr->mixins.list = NULL; - } else { - instancePtr->mixins.list[j-1] = nextMixin; + if (instancePtr != oPtr) { + int j; + if (instancePtr->selfCls == clsPtr) { + instancePtr->flags |= CLASS_GONE; + } + for(j=0 ; jmixins.num ; j++) { + Class *mixin = instancePtr->mixins.list[j]; + Class *nextMixin = NULL; + if (mixin == clsPtr) { + if (j < instancePtr->mixins.num - 1) { + nextMixin = instancePtr->mixins.list[j+1]; + } + if (j == 0) { + instancePtr->mixins.num = 0; + instancePtr->mixins.list = NULL; + } else { + instancePtr->mixins.list[j-1] = nextMixin; + } + instancePtr->mixins.num -= 1; } - instancePtr->mixins.num -= 1; } - } - if (instancePtr != NULL && !IsRoot(instancePtr)) { - AddRef(instancePtr); + if (instancePtr != NULL && !IsRoot(instancePtr)) { + AddRef(instancePtr); + } } } } @@ -944,13 +946,15 @@ ReleaseClassContents( */ FOREACH(mixinSubclassPtr, clsPtr->mixinSubs) { - if (!Deleted(mixinSubclassPtr->thisPtr)) { - Tcl_DeleteCommandFromToken(interp, - mixinSubclassPtr->thisPtr->command); + if (mixinSubclassPtr != clsPtr) { + if (!Deleted(mixinSubclassPtr->thisPtr)) { + Tcl_DeleteCommandFromToken(interp, + mixinSubclassPtr->thisPtr->command); + } + ClearMixins(mixinSubclassPtr); + DelRef(mixinSubclassPtr->thisPtr); + DelRef(mixinSubclassPtr); } - ClearMixins(mixinSubclassPtr); - DelRef(mixinSubclassPtr->thisPtr); - DelRef(mixinSubclassPtr); } if (clsPtr->mixinSubs.list != NULL) { ckfree(clsPtr->mixinSubs.list); @@ -985,19 +989,21 @@ ReleaseClassContents( if (!IsRootClass(oPtr)) { FOREACH(instancePtr, clsPtr->instances) { - if (instancePtr == NULL || IsRoot(instancePtr)) { - continue; - } - if (!Deleted(instancePtr)) { - Tcl_DeleteCommandFromToken(interp, instancePtr->command); - /* - * Tcl_DeleteCommandFromToken() may have done to whole - * job for us. Roll back and check again. - */ - i--; - continue; + if (instancePtr != oPtr) { + if (instancePtr == NULL || IsRoot(instancePtr)) { + continue; + } + if (!Deleted(instancePtr)) { + Tcl_DeleteCommandFromToken(interp, instancePtr->command); + /* + * Tcl_DeleteCommandFromToken() may have done to whole + * job for us. Roll back and check again. + */ + i--; + continue; + } + DelRef(instancePtr); } - DelRef(instancePtr); } } if (clsPtr->instances.list != NULL) { @@ -1084,6 +1090,10 @@ ReleaseClassContents( ckfree(clsPtr->variables.list); } + /* Tell oPtr that it's class is gone so that it doesn't try to remove + * itself from it's classe's list of instances + */ + oPtr->flags |= CLASS_GONE; DelRef(clsPtr); } @@ -1177,22 +1187,6 @@ ObjectNamespaceDeleted( } /* - * The class of objects needs some special care; if it is deleted (and - * we're not killing the whole interpreter) we force the delete of the - * class of classes now as well. Due to the incestuous nature of those two - * classes, if one goes the other must too and yet the tangle can - * sometimes not go away automatically; we force it here. [Bug 2962664] - */ - if (!Tcl_InterpDeleted(interp) && IsRootObject(oPtr) - && !Deleted(fPtr->classCls->thisPtr)) { - Tcl_DeleteCommandFromToken(interp, fPtr->classCls->thisPtr->command); - } - - if (oPtr->classPtr != NULL) { - ReleaseClassContents(interp, oPtr); - } - - /* * Splice the object out of its context. After this, we must *not* call * methods on the object. */ @@ -1202,7 +1196,7 @@ ObjectNamespaceDeleted( } FOREACH(mixinPtr, oPtr->mixins) { - if (mixinPtr) { + if (mixinPtr && mixinPtr != oPtr->classPtr) { TclOORemoveFromInstances(oPtr, mixinPtr); } } @@ -1251,6 +1245,30 @@ ObjectNamespaceDeleted( } /* + * Because an object can be a class that is an instance of itself, the + * A class object's class structure should only be cleaned after most of + * the cleanup on the object is done. + */ + + + /* + * The class of objects needs some special care; if it is deleted (and + * we're not killing the whole interpreter) we force the delete of the + * class of classes now as well. Due to the incestuous nature of those two + * classes, if one goes the other must too and yet the tangle can + * sometimes not go away automatically; we force it here. [Bug 2962664] + */ + if (!Tcl_InterpDeleted(interp) && IsRootObject(oPtr) + && !Deleted(fPtr->classCls->thisPtr)) { + Tcl_DeleteCommandFromToken(interp, fPtr->classCls->thisPtr->command); + } + + if (oPtr->classPtr != NULL) { + ReleaseClassContents(interp, oPtr); + } + + + /* * Delete the object structure itself. */ diff --git a/tests/oo.test b/tests/oo.test index c44ec18..556d529 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -1501,7 +1501,7 @@ test oo-11.5 {OO: cleanup} { test oo-11.6 { OO: cleanup ReleaseClassContents() where class is mixed into one of its instances -} { +} -body { oo::class create obj1 ::oo::define obj1 {self mixin [self]} @@ -1509,12 +1509,14 @@ test oo-11.6 { ::oo::objdefine obj2 {mixin [self]} ::oo::copy obj2 obj3 - trace add command obj3 delete [list obj3 dying] + rename obj3 {} rename obj2 {} # No segmentation fault return done -} done +} -cleanup { + rename obj1 {} +} -result done test oo-12.1 {OO: filters} { oo::class create Aclass @@ -3867,6 +3869,31 @@ test oo-35.5 {Bug 1a56550e96: introspectors must traverse mixin links correctly} } -cleanup { base destroy } -result {{c d e} {c d e}} +test oo-35.6 { + Bug : teardown of an object that is a class that is an instance of itself +} -setup { + oo::class create obj + + oo::copy obj obj1 obj1 + oo::objdefine obj1 { + mixin obj1 obj + } + oo::copy obj1 obj2 + oo::objdefine obj2 { + mixin obj2 obj1 + } +} -body { + rename obj2 {} + rename obj1 {} + # doesn't crash + return done +} -cleanup { + rename obj {} +} -result done + + + + test oo-36.1 {TIP #470: introspection within oo::define} { oo::define oo::object self } ::oo::object -- cgit v0.12 From e87d0bcdf463e1858295c83daaee867dd695dba0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 29 Nov 2017 12:27:22 +0000 Subject: Fix Tcl_UtfFindFirst()/Tcl_UtfFindLast(), which were broken by [83c0c569d6]. Not detected, because those functions aren't used anywhere in Tcl. So, added new test-cases, makeing sure this doesn't happen again. --- generic/tclTest.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ generic/tclUtf.c | 14 +++++++------- tests/utf.test | 11 +++++++++-- 3 files changed, 70 insertions(+), 9 deletions(-) diff --git a/generic/tclTest.c b/generic/tclTest.c index e8539e8..8a59b83 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -407,6 +407,12 @@ static Tcl_FSMatchInDirectoryProc SimpleMatchInDirectory; static int TestNumUtfCharsCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); +static int TestFindFirstCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); +static int TestFindLastCmd(ClientData clientData, + Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[]); static int TestHashSystemHashCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); @@ -668,6 +674,10 @@ Tcltest_Init( TestsetobjerrorcodeCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testnumutfchars", TestNumUtfCharsCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "testfindfirst", + TestFindFirstCmd, NULL, NULL); + Tcl_CreateObjCommand(interp, "testfindlast", + TestFindLastCmd, NULL, NULL); Tcl_CreateCommand(interp, "testsetplatform", TestsetplatformCmd, NULL, NULL); Tcl_CreateCommand(interp, "teststaticpkg", TeststaticpkgCmd, @@ -6680,6 +6690,50 @@ TestNumUtfCharsCmd( return TCL_OK; } +/* + * Used to check correct operation of Tcl_UtfFindFirst + */ + +static int +TestFindFirstCmd( + ClientData clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *const objv[]) +{ + if (objc > 1) { + int len = -1; + + if (objc > 2) { + (void) Tcl_GetIntFromObj(interp, objv[2], &len); + } + Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_UtfFindFirst(Tcl_GetString(objv[1]), len), -1)); + } + return TCL_OK; +} + +/* + * Used to check correct operation of Tcl_UtfFindLast + */ + +static int +TestFindLastCmd( + ClientData clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *const objv[]) +{ + if (objc > 1) { + int len = -1; + + if (objc > 2) { + (void) Tcl_GetIntFromObj(interp, objv[2], &len); + } + Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_UtfFindLast(Tcl_GetString(objv[1]), len), -1)); + } + return TCL_OK; +} + #if defined(HAVE_CPUID) || defined(_WIN32) /* *---------------------------------------------------------------------- diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 17f769d..c60e99e 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -100,7 +100,7 @@ static int UtfCount(int ch); static inline int UtfCount( - int ch) /* The Tcl_UniChar whose size is returned. */ + int ch) /* The Unicode character whose size is returned. */ { if ((unsigned)(ch - 1) < (UNICODE_SELF - 1)) { return 1; @@ -556,10 +556,10 @@ Tcl_UtfFindFirst( #if TCL_UTF_MAX == 4 if (!len) { len += TclUtfToUniChar(src, &find); - fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000; } #endif - if (find == fullchar) { + if (fullchar == ch) { return src; } if (*src == '\0') { @@ -579,7 +579,7 @@ Tcl_UtfFindFirst( * part of the UTF-8 string. Equivalent to Plan 9 utfrrune(). * * Results: - * As above. If the Tcl_UniChar does not exist in the given string, the + * As above. If the Unicode character does not exist in the given string, the * return value is NULL. * * Side effects: @@ -604,10 +604,10 @@ Tcl_UtfFindLast( #if TCL_UTF_MAX == 4 if (!len) { len += TclUtfToUniChar(src, &find); - fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000; + fullchar = (((fullchar & 0x3ff) << 10) | (find & 0x3ff)) + 0x10000; } #endif - if (find == fullchar) { + if (fullchar == ch) { last = src; } if (*src == '\0') { @@ -707,7 +707,7 @@ Tcl_UtfPrev( * * Tcl_UniCharAtIndex -- * - * Returns the Unicode character represented at the specified character + * Returns the Tcl_UniChar represented at the specified character * (not byte) position in the UTF-8 string. * * Results: diff --git a/tests/utf.test b/tests/utf.test index 45f9c0c..d0fa7be 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -86,6 +86,9 @@ test utf-3.1 {Tcl_UtfCharComplete} { } {} testConstraint testnumutfchars [llength [info commands testnumutfchars]] +testConstraint testfindfirst [llength [info commands testfindfirst]] +testConstraint testfindlast [llength [info commands testfindlast]] + test utf-4.1 {Tcl_NumUtfChars: zero length} testnumutfchars { testnumutfchars "" } {0} @@ -118,8 +121,12 @@ test utf-4.10 {Tcl_NumUtfChars: #u0000, calc len, overcomplete} {testnumutfchars testnumutfchars [testbytestring "\x00"] 2 } {2} -test utf-5.1 {Tcl_UtfFindFirsts} { -} {} +test utf-5.1 {Tcl_UtfFindFirst} {testfindfirst testbytestring} { + testfindfirst [testbytestring "abcbc"] 98 +} {bcbc} +test utf-5.1 {Tcl_UtfFindLast} {testfindlast testbytestring} { + testfindlast [testbytestring "abcbc"] 98 +} {bc} test utf-6.1 {Tcl_UtfNext} { } {} -- cgit v0.12 From e68b4918069d622ccc7f9f6f98e8432df3f3baad Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 29 Nov 2017 13:59:42 +0000 Subject: Cherry-picked test-cases from [046a5af026]: fix for issue [4f6a1ebd64]: ensemble: segmentation fault when -subcommand and -map values are the same object. --- tests/namespace.test | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/namespace.test b/tests/namespace.test index 71b6860..7d41258 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -1576,7 +1576,10 @@ test namespace-42.7 {ensembles: nested} { namespace delete ns set result } {{1 ::ns::x0::z} 1 2 3} -test namespace-42.8 {ensembles: [Bug 1670091]} -setup { +test namespace-42.8 { + ensembles: [Bug 1670091], panic due to pointer to a deallocated List + struct. +} -setup { proc demo args {} variable target [list [namespace which demo] x] proc trial args {variable target; string length $target} @@ -1591,6 +1594,19 @@ test namespace-42.8 {ensembles: [Bug 1670091]} -setup { rename foo {} } -result {} +test namespace-42.9 { + ensembles: [Bug 4f6a1ebd64], segmentation fault due to pointer to a + deallocated List struct. +} -setup { + namespace eval n {namespace ensemble create} + dict set list one ::two + namespace ensemble configure n -subcommands $list -map $list +} -body { + n one +} -cleanup { + namespace delete n +} -returnCodes error -match glob -result {invalid command name*} + test namespace-43.1 {ensembles: dict-driven} { namespace eval ns { namespace export x* -- cgit v0.12 From c47ba70f4545f7c961160a6beb0a466e3bfd5532 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 29 Nov 2017 18:35:51 +0000 Subject: Add TCL_CREATE_NS_IF_UNKNOWN back into Tcl_CreateEnsemble(). --- generic/tclEnsemble.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index c5ccd22..a981851 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -732,7 +732,6 @@ Tcl_CreateEnsemble( Tcl_Namespace *namespacePtr, int flags) { - Tcl_Obj *nameObj = NULL; Namespace *nsPtr = (Namespace *)namespacePtr, *foundNsPtr, *altNsPtr, *actualNsPtr; const char * simpleName; @@ -741,11 +740,8 @@ Tcl_CreateEnsemble( nsPtr = (Namespace *) TclGetCurrentNamespace(interp); } - TclGetNamespaceForQualName(interp, name, nsPtr, 0, + TclGetNamespaceForQualName(interp, name, nsPtr, TCL_CREATE_NS_IF_UNKNOWN, &foundNsPtr, &altNsPtr, &actualNsPtr, &simpleName); - if (nameObj != NULL) { - TclDecrRefCount(nameObj); - } return TclCreateEnsembleInNs(interp, simpleName, (Tcl_Namespace *) foundNsPtr, (Tcl_Namespace *) nsPtr, flags); } -- cgit v0.12 From 72998869a3be3534fec99499faabe2d1557d6bcb Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 30 Nov 2017 13:14:43 +0000 Subject: Fix [8e1e31eac0fd6b6c4452bc108a98ab08c6b64588|8e1e31eac0]: lsort treats NUL chars strangely. Also fix various initializations, which only make a difference when TCL_UTF_MAX == 4. Add new test-cases which demonstrate the fix. For TCL_UTF_MAX == 4, surrogates will now be handled as expected as well when sorting. --- doc/UniCharIsAlpha.3 | 2 +- generic/tclCmdIL.c | 4 +- generic/tclCmdMZ.c | 2 +- generic/tclInt.h | 3 +- generic/tclScan.c | 2 +- generic/tclStringObj.c | 10 ++--- generic/tclUtf.c | 103 +++++++++++++++++++++++++++++++++++-------------- generic/tclUtil.c | 10 ++--- tests/cmdIL.test | 13 +++++++ win/tclWinSerial.c | 2 +- 10 files changed, 105 insertions(+), 46 deletions(-) diff --git a/doc/UniCharIsAlpha.3 b/doc/UniCharIsAlpha.3 index 5ba3fc9..61490ed 100644 --- a/doc/UniCharIsAlpha.3 +++ b/doc/UniCharIsAlpha.3 @@ -48,7 +48,7 @@ int .SH ARGUMENTS .AS int ch .AP int ch in -The Tcl_UniChar to be examined. +The Unicode character to be examined. .BE .SH DESCRIPTION diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 47076ec..b41d312 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2945,7 +2945,7 @@ Tcl_LsearchObjCmd( double patDouble, objDouble; SortInfo sortInfo; Tcl_Obj *patObj, **listv, *listPtr, *startPtr, *itemPtr; - SortStrCmpFn_t strCmpFn = strcmp; + SortStrCmpFn_t strCmpFn = TclUtfCmp; Tcl_RegExp regexp = NULL; static const char *const options[] = { "-all", "-ascii", "-bisect", "-decreasing", "-dictionary", @@ -4263,7 +4263,7 @@ SortCompare( int order = 0; if (infoPtr->sortMode == SORTMODE_ASCII) { - order = strcmp(elemPtr1->collationKey.strValuePtr, + order = TclUtfCmp(elemPtr1->collationKey.strValuePtr, elemPtr2->collationKey.strValuePtr); } else if (infoPtr->sortMode == SORTMODE_ASCII_NC) { order = TclUtfCasecmp(elemPtr1->collationKey.strValuePtr, diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index ad1dd5f..a206cc5 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -3547,7 +3547,7 @@ TclNRSwitchObjCmd( OPT_LAST }; typedef int (*strCmpFn_t)(const char *, const char *); - strCmpFn_t strCmpFn = strcmp; + strCmpFn_t strCmpFn = TclUtfCmp; mode = OPT_EXACT; foundmode = 0; diff --git a/generic/tclInt.h b/generic/tclInt.h index ef88bf5..ad1d9c6 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3219,6 +3219,7 @@ MODULE_SCOPE int TclTrimLeft(const char *bytes, int numBytes, const char *trim, int numTrim); MODULE_SCOPE int TclTrimRight(const char *bytes, int numBytes, const char *trim, int numTrim); +MODULE_SCOPE int TclUtfCmp(const char *cs, const char *ct); MODULE_SCOPE int TclUtfCasecmp(const char *cs, const char *ct); MODULE_SCOPE int TclUtfCount(int ch); MODULE_SCOPE Tcl_Obj * TclpNativeToNormalized(ClientData clientData); @@ -4446,7 +4447,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, */ #define TclUtfToUniChar(str, chPtr) \ - ((((unsigned char) *(str)) < 0xC0) ? \ + ((((unsigned char) *(str)) < 0x80) ? \ ((*(chPtr) = (unsigned char) *(str)), 1) \ : Tcl_UtfToUniChar(str, chPtr)) diff --git a/generic/tclScan.c b/generic/tclScan.c index 7f71262..e0798df 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -889,7 +889,7 @@ Tcl_ScanObjCmd( i = (int)sch; #if TCL_UTF_MAX == 4 if (!offset) { - offset = Tcl_UtfToUniChar(string, &sch); + offset = TclUtfToUniChar(string, &sch); i = (((i<<10) & 0x0FFC00) + 0x10000) + (sch & 0x3FF); } #endif diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 547f7c6..b943095 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1869,20 +1869,20 @@ Tcl_AppendFormatToObj( } else if (ch == 'I') { if ((format[1] == '6') && (format[2] == '4')) { format += (step + 2); - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); #ifndef TCL_WIDE_INT_IS_LONG useWide = 1; #endif } else if ((format[1] == '3') && (format[2] == '2')) { format += (step + 2); - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } else { format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } } else if ((ch == 't') || (ch == 'z')) { format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); #ifndef TCL_WIDE_INT_IS_LONG if (sizeof(size_t) > sizeof(int)) { useWide = 1; @@ -1890,7 +1890,7 @@ Tcl_AppendFormatToObj( #endif } else if ((ch == 'q') ||(ch == 'j')) { format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); #ifndef TCL_WIDE_INT_IS_LONG useWide = 1; #endif diff --git a/generic/tclUtf.c b/generic/tclUtf.c index a72394d..43636b4 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -720,8 +720,7 @@ Tcl_UniCharAtIndex( { Tcl_UniChar ch = 0; - while (index >= 0) { - index--; + while (index-- >= 0) { src += TclUtfToUniChar(src, &ch); } return ch; @@ -751,8 +750,7 @@ Tcl_UtfAtIndex( { Tcl_UniChar ch = 0; - while (index > 0) { - index--; + while (index-- > 0) { src += TclUtfToUniChar(src, &ch); } return src; @@ -1066,16 +1064,17 @@ Tcl_UtfNcmp( cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); + if (ch1 != ch2) { #if TCL_UTF_MAX == 4 - /* map high surrogate characters to values > 0xffff */ - if ((ch1 & 0xFC00) == 0xD800) { - ch1 += 0x4000; - } - if ((ch2 & 0xFC00) == 0xD800) { - ch2 += 0x4000; - } + /* Surrogates always report higher than non-surrogates */ + if (((ch1 & 0xFC00) == 0xD800)) { + if ((ch2 & 0xFC00) != 0xD800) { + return ch1; + } + } else if ((ch2 & 0xFC00) == 0xD800) { + return -ch2; + } #endif - if (ch1 != ch2) { return (ch1 - ch2); } } @@ -1116,16 +1115,17 @@ Tcl_UtfNcasecmp( */ cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); + if (ch1 != ch2) { #if TCL_UTF_MAX == 4 - /* map high surrogate characters to values > 0xffff */ - if ((ch1 & 0xFC00) == 0xD800) { - ch1 += 0x4000; - } - if ((ch2 & 0xFC00) == 0xD800) { - ch2 += 0x4000; - } + /* Surrogates always report higher than non-surrogates */ + if (((ch1 & 0xFC00) == 0xD800)) { + if ((ch2 & 0xFC00) != 0xD800) { + return ch1; + } + } else if ((ch2 & 0xFC00) == 0xD800) { + return -ch2; + } #endif - if (ch1 != ch2) { ch1 = Tcl_UniCharToLower(ch1); ch2 = Tcl_UniCharToLower(ch2); if (ch1 != ch2) { @@ -1135,6 +1135,52 @@ Tcl_UtfNcasecmp( } return 0; } + +/* + *---------------------------------------------------------------------- + * + * Tcl_UtfCmp -- + * + * Compare UTF chars of string cs to string ct case sensitively. + * Replacement for strcmp in Tcl core, in places where UTF-8 should + * be handled. + * + * Results: + * Return <0 if cs < ct, 0 if cs == ct, or >0 if cs > ct. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TclUtfCmp( + const char *cs, /* UTF string to compare to ct. */ + const char *ct) /* UTF string cs is compared to. */ +{ + Tcl_UniChar ch1 = 0, ch2 = 0; + + while (*cs && *ct) { + cs += TclUtfToUniChar(cs, &ch1); + ct += TclUtfToUniChar(ct, &ch2); + if (ch1 != ch2) { +#if TCL_UTF_MAX == 4 + /* Surrogates always report higher than non-surrogates */ + if (((ch1 & 0xFC00) == 0xD800)) { + if ((ch2 & 0xFC00) != 0xD800) { + return ch1; + } + } else if ((ch2 & 0xFC00) == 0xD800) { + return -ch2; + } +#endif + return ch1 - ch2; + } + } + return UCHAR(*cs) - UCHAR(*ct); +} + /* *---------------------------------------------------------------------- @@ -1164,16 +1210,17 @@ TclUtfCasecmp( while (*cs && *ct) { cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); + if (ch1 != ch2) { #if TCL_UTF_MAX == 4 - /* map high surrogate characters to values > 0xffff */ - if ((ch1 & 0xFC00) == 0xD800) { - ch1 += 0x4000; - } - if ((ch2 & 0xFC00) == 0xD800) { - ch2 += 0x4000; - } + /* Surrogates always report higher than non-surrogates */ + if (((ch1 & 0xFC00) == 0xD800)) { + if ((ch2 & 0xFC00) != 0xD800) { + return ch1; + } + } else if ((ch2 & 0xFC00) == 0xD800) { + return -ch2; + } #endif - if (ch1 != ch2) { ch1 = Tcl_UniCharToLower(ch1); ch2 = Tcl_UniCharToLower(ch2); if (ch1 != ch2) { diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 8ebace5..51af016 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1665,6 +1665,7 @@ TclTrimRight( { const char *p = bytes + numBytes; int pInc; + Tcl_UniChar ch1 = 0, ch2 = 0; if ((bytes[numBytes] != '\0') || (trim[numTrim] != '\0')) { Tcl_Panic("TclTrimRight works only on null-terminated strings"); @@ -1683,7 +1684,6 @@ TclTrimRight( */ do { - Tcl_UniChar ch1; const char *q = trim; int bytesLeft = numTrim; @@ -1695,7 +1695,6 @@ TclTrimRight( */ do { - Tcl_UniChar ch2; int qInc = TclUtfToUniChar(q, &ch2); if (ch1 == ch2) { @@ -1745,6 +1744,7 @@ TclTrimLeft( int numTrim) /* ...and its length in bytes */ { const char *p = bytes; + Tcl_UniChar ch1 = 0, ch2 = 0; if ((bytes[numBytes] != '\0') || (trim[numTrim] != '\0')) { Tcl_Panic("TclTrimLeft works only on null-terminated strings"); @@ -1763,7 +1763,6 @@ TclTrimLeft( */ do { - Tcl_UniChar ch1; int pInc = TclUtfToUniChar(p, &ch1); const char *q = trim; int bytesLeft = numTrim; @@ -1773,7 +1772,6 @@ TclTrimLeft( */ do { - Tcl_UniChar ch2; int qInc = TclUtfToUniChar(q, &ch2); if (ch1 == ch2) { @@ -2107,7 +2105,7 @@ Tcl_StringCaseMatch( { int p, charLen; const char *pstart = pattern; - Tcl_UniChar ch1, ch2; + Tcl_UniChar ch1 = 0, ch2 = 0; while (1) { p = *pattern; @@ -2217,7 +2215,7 @@ Tcl_StringCaseMatch( */ if (p == '[') { - Tcl_UniChar startChar, endChar; + Tcl_UniChar startChar = 0, endChar = 0; pattern++; if (UCHAR(*str) < 0x80) { diff --git a/tests/cmdIL.test b/tests/cmdIL.test index 70ac6bb..df59e6e 100644 --- a/tests/cmdIL.test +++ b/tests/cmdIL.test @@ -19,6 +19,7 @@ catch [list package require -exact Tcltest [info patchlevel]] # Used for constraining memory leak tests testConstraint memory [llength [info commands memory]] testConstraint testobj [llength [info commands testobj]] +testConstraint fullutf [expr {[format %c 0x010000] != "\ufffd"}] test cmdIL-1.1 {Tcl_LsortObjCmd procedure} -returnCodes error -body { lsort @@ -147,6 +148,18 @@ test cmdIL-1.36 {lsort -stride and -index: Bug 2918962} { {{b i g} 12345} {{d e m o} 34512} } } {{{b i g} 12345} {{d e m o} 34512} {{c o d e} 54321} {{b l a h} 94729}} +test cmdIL-1.37 {Tcl_LsortObjCmd procedure, Bug 8e1e31eac0fd6b6c} { + lsort -ascii [list \0 \x7f \x80 \uffff] +} [list \0 \x7f \x80 \uffff] +test cmdIL-1.38 {Tcl_LsortObjCmd procedure, Bug 8e1e31eac0fd6b6c} { + lsort -ascii -nocase [list \0 \x7f \x80 \uffff] +} [list \0 \x7f \x80 \uffff] +test cmdIL-1.39 {Tcl_LsortObjCmd procedure, Bug 8e1e31eac0fd6b6c} fullutf { + lsort -ascii [list \0 \x7f \x80 \U01ffff \uffff] +} [list \0 \x7f \x80 \uffff \U01ffff] +test cmdIL-1.40 {Tcl_LsortObjCmd procedure, Bug 8e1e31eac0fd6b6c} fullutf { + lsort -ascii -nocase [list \0 \x7f \x80 \U01ffff \uffff] +} [list \0 \x7f \x80 \uffff \U01ffff] # Can't think of any good tests for the MergeSort and MergeLists procedures, # except a bunch of random lists to sort. diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index ed1a8e5..acfeecb 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -1738,7 +1738,7 @@ SerialSetOptionProc( dcb.XonChar = argv[0][0]; dcb.XoffChar = argv[1][0]; if (argv[0][0] & 0x80 || argv[1][0] & 0x80) { - Tcl_UniChar character; + Tcl_UniChar character = 0; int charLen; charLen = Tcl_UtfToUniChar(argv[0], &character); -- cgit v0.12 From d7d31d6041d72ace8e80d409c12749ab819499ec Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 30 Nov 2017 14:14:01 +0000 Subject: Don't provide the setFromAnyProc through the invalidRealType objType. This is a Tcl internal type, extensions shouldn't be able to convert their own Tcl_Obj to this. This shouldn't have been exposed to begin with. Tcl itself never calls it this way. --- generic/tclLink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclLink.c b/generic/tclLink.c index 7d1e3a8..6f75849 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -638,7 +638,7 @@ static Tcl_ObjType invalidRealType = { NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ NULL, /* updateStringProc */ - SetInvalidRealFromAny /* setFromAnyProc */ + NULL /* setFromAnyProc */ }; static int -- cgit v0.12 From 99798b2202f0a40a22c5d5e2d457759a5526005a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 30 Nov 2017 15:24:39 +0000 Subject: Fix build of test-suite, after previous commit --- generic/tclIntDecls.h | 63 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index f2654c0..c3ee084 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -1354,31 +1354,70 @@ extern const TclIntStubs *tclIntStubsPtr; # undef TclSetStartupScript # undef TclGetStartupScript # undef TclCreateNamespace -# define tcl_CreateNamespace tclCreateNamespace # undef TclDeleteNamespace -# define tcl_DeleteNamespace tclDeleteNamespace # undef TclAppendExportList -# define tcl_AppendExportList tclAppendExportList # undef TclExport -# define tcl_Export tclExport # undef TclImport -# define tcl_Import tclImport # undef TclForgetImport -# define tcl_ForgetImport tclForgetImport # undef TclGetCurrentNamespace_ -# define tcl_GetCurrentNamespace tclGetCurrentNamespace_ # undef TclGetGlobalNamespace_ -# define tcl_GetGlobalNamespace tclGetGlobalNamespace_ # undef TclFindNamespace -# define tcl_FindNamespace tclFindNamespace # undef TclFindCommand -# define tcl_FindCommand tclFindCommand # undef TclGetCommandFromObj -# define tcl_GetCommandFromObj tclGetCommandFromObj # undef TclGetCommandFullName -# define tcl_GetCommandFullName tclGetCommandFullName # undef TclCopyChannelOld # undef TclSockMinimumBuffersOld + +#if !defined(TCL_NO_DEPRECATED) +# undef Tcl_CreateNamespace +# define Tcl_CreateNamespace \ + (tclIntStubsPtr->tclCreateNamespace) /* 113 */ +# define tcl_CreateNamespace tclCreateNamespace +# undef Tcl_DeleteNamespace +# define Tcl_DeleteNamespace \ + (tclIntStubsPtr->tclDeleteNamespace) /* 114 */ +# define tcl_DeleteNamespace tclDeleteNamespace +# undef Tcl_AppendExportList +# define Tcl_AppendExportList \ + (tclIntStubsPtr->tclAppendExportList) /* 112 */ +# define tcl_AppendExportList tclAppendExportList +# undef Tcl_Export +# define Tcl_Export \ + (tclIntStubsPtr->tclExport) /* 115 */ +# define tcl_Export tclExport +# undef Tcl_Import +# define Tcl_Import \ + (tclIntStubsPtr->tclImport) /* 127 */ +# define tcl_Import tclImport +# undef Tcl_ForgetImport +# define Tcl_ForgetImport \ + (tclIntStubsPtr->tclForgetImport) /* 121 */ +# define tcl_ForgetImport tclForgetImport +# undef Tcl_GetCurrentNamespace +# define Tcl_GetCurrentNamespace \ + (tclIntStubsPtr->tclGetCurrentNamespace_) /* 124 */ +# define tcl_GetCurrentNamespace tclGetCurrentNamespace_ +# undef Tcl_GetGlobalNamespace +# define Tcl_GetGlobalNamespace \ + (tclIntStubsPtr->tclGetGlobalNamespace_) /* 125 */ +# define tcl_GetGlobalNamespace tclGetGlobalNamespace_ +# undef Tcl_FindNamespace +# define Tcl_FindNamespace \ + (tclIntStubsPtr->tclFindNamespace) /* 117 */ +# define tcl_FindNamespace tclFindNamespace +# undef Tcl_FindCommand +# define Tcl_FindCommand \ + (tclIntStubsPtr->tclFindCommand) /* 116 */ +# define tcl_FindCommand tclFindCommand +# undef Tcl_GetCommandFromObj +# define Tcl_GetCommandFromObj \ + (tclIntStubsPtr->tclGetCommandFromObj) /* 122 */ +# define tcl_GetCommandFromObj tclGetCommandFromObj +# undef Tcl_GetCommandFullName +# define Tcl_GetCommandFullName \ + (tclIntStubsPtr->tclGetCommandFullName) /* 123 */ +# define tcl_GetCommandFullName tclGetCommandFullName +#endif /* !defined(TCL_NO_DEPRECATED) */ #endif #endif /* _TCLINTDECLS */ -- cgit v0.12 From 0efada5548249fb9f61dcd3a5eea4ceb381e3e52 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 30 Nov 2017 16:03:01 +0000 Subject: Eliminate use of certain unnecessary struct names. Also white-spacing. Nothing functional. --- generic/tclEncoding.c | 8 ++++---- generic/tclEnsemble.c | 10 +++++----- generic/tclIORTrans.c | 6 +++--- generic/tclIOUtil.c | 2 +- generic/tclOO.c | 6 +++--- tests/oo.test | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 1f48a1c..e1e26d3 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -18,7 +18,7 @@ typedef size_t (LengthProc)(const char *src); * convert between various character sets and UTF-8. */ -typedef struct Encoding { +typedef struct { char *name; /* Name of encoding. Malloced because (1) hash * table entry that owns this encoding may be * freed prior to this encoding being freed, @@ -57,7 +57,7 @@ typedef struct Encoding { * encoding. */ -typedef struct TableEncodingData { +typedef struct { int fallback; /* Character (in this encoding) to substitute * when this encoding cannot represent a UTF-8 * character. */ @@ -91,7 +91,7 @@ typedef struct TableEncodingData { * for switching character sets. */ -typedef struct EscapeSubTable { +typedef struct { unsigned sequenceLen; /* Length of following string. */ char sequence[16]; /* Escape code that marks this encoding. */ char name[32]; /* Name for encoding. */ @@ -100,7 +100,7 @@ typedef struct EscapeSubTable { * yet. */ } EscapeSubTable; -typedef struct EscapeEncodingData { +typedef struct { int fallback; /* Character (in this encoding) to substitute * when this encoding cannot represent a UTF-8 * character. */ diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index a981851..972c33e 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -649,12 +649,12 @@ TclNamespaceEnsembleCmd( Tcl_Command TclCreateEnsembleInNs( - Tcl_Interp *interp, - + Tcl_Interp *interp, + const char *name, /* Simple name of command to create (no */ /* namespace components). */ - Tcl_Namespace /* Name of namespace to create the command in. */ - *nameNsPtr, + Tcl_Namespace /* Name of namespace to create the command in. */ + *nameNsPtr, Tcl_Namespace *ensembleNsPtr, /* Name of the namespace for the ensemble. */ int flags @@ -2591,7 +2591,7 @@ BuildEnsembleConfig( if (ensemblePtr->subcmdList == ensemblePtr->subcommandDict) { subcmdDictCopy = Tcl_DuplicateObj(ensemblePtr->subcommandDict); } else { - subcmdDictCopy = ensemblePtr->subcommandDict; + subcmdDictCopy = ensemblePtr->subcommandDict; } Tcl_IncrRefCount(subcmdDictCopy); } diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c index f198c69..fe2e458 100644 --- a/generic/tclIORTrans.c +++ b/generic/tclIORTrans.c @@ -87,7 +87,7 @@ static const Tcl_ChannelType tclRTransformType = { * layers upon reading from the channel, plus the functions to manage such. */ -typedef struct _ResultBuffer_ { +typedef struct { unsigned char *buf; /* Reference to the buffer area. */ int allocated; /* Allocated size of the buffer area. */ int used; /* Number of bytes in the buffer, @@ -253,7 +253,7 @@ typedef enum { * sharing problems. */ -typedef struct ForwardParamBase { +typedef struct { int code; /* O: Ok/Fail of the cmd handler */ char *msgStr; /* O: Error message for handler failure */ int mustFree; /* O: True if msgStr is allocated, false if @@ -298,7 +298,7 @@ typedef struct ForwardingResult ForwardingResult; * General event structure, with reference to operation specific data. */ -typedef struct ForwardingEvent { +typedef struct { Tcl_Event event; /* Basic event data, has to be first item */ ForwardingResult *resultPtr; ForwardedOperation op; /* Forwarded driver operation */ diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 4f2288e..8fb3aa8 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -245,7 +245,7 @@ static Tcl_ThreadDataKey fsDataKey; * code. */ -typedef struct FsDivertLoad { +typedef struct { Tcl_LoadHandle loadHandle; Tcl_FSUnloadFileProc *unloadProcPtr; Tcl_Obj *divertedFile; diff --git a/generic/tclOO.c b/generic/tclOO.c index 5404abc..84380e0 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -1091,8 +1091,8 @@ ReleaseClassContents( } /* Tell oPtr that it's class is gone so that it doesn't try to remove - * itself from it's classe's list of instances - */ + * itself from it's classe's list of instances + */ oPtr->flags |= CLASS_GONE; DelRef(clsPtr); @@ -1247,7 +1247,7 @@ ObjectNamespaceDeleted( /* * Because an object can be a class that is an instance of itself, the * A class object's class structure should only be cleaned after most of - * the cleanup on the object is done. + * the cleanup on the object is done. */ diff --git a/tests/oo.test b/tests/oo.test index 556d529..b9c5067 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -129,7 +129,7 @@ test oo-1.4 {basic test of OO functionality} -body { oo::object create {} } -returnCodes 1 -result {object name must not be empty} test oo-1.4.1 {fully-qualified nested name} -body { - oo::object create ::one::two::three + oo::object create ::one::two::three } -result {::one::two::three} test oo-1.5 {basic test of OO functionality} -body { oo::object doesnotexist @@ -3889,7 +3889,7 @@ test oo-35.6 { return done } -cleanup { rename obj {} -} -result done +} -result done -- cgit v0.12 From 4bbfdee3db6fbfb19e5d19f48bac51280d2e55fa Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 30 Nov 2017 17:10:37 +0000 Subject: [5808081213] Permit all bytearrays (including impure ones) to report length without shimmering --- generic/tclStringObj.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index d43cc45..0f238cf 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -418,12 +418,16 @@ Tcl_GetCharLength( int numChars; /* - * Optimize the case where we're really dealing with a bytearray object - * without string representation; we don't need to convert to a string to - * perform the get-length operation. + * Optimize the case where we're really dealing with a bytearray object; + * we don't need to convert to a string to perform the get-length operation. + * + * NOTE that we do not need the bytearray to be "pure". A ByteArray value + * with a string rep cannot be trusted to represent the same value as the + * string rep, but it *can* be trusted to have the same character length + * as the string rep, which is all this routine cares about. */ - if (TclIsPureByteArray(objPtr)) { + if (objPtr->typePtr == &tclByteArrayType) { int length; (void) Tcl_GetByteArrayFromObj(objPtr, &length); -- cgit v0.12 From 1a237e67df1f72fce66636d7efcd7cffa82bd0b8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 1 Dec 2017 10:38:04 +0000 Subject: Simpler solution for Itcl 3.4 build (compatibilty) problem. Thanks to Don Porter for bringing this to my attention! --- generic/tclIntDecls.h | 67 ++++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 51 deletions(-) diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index c3ee084..5848bb3 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -28,6 +28,22 @@ # endif #endif +#if !defined(TCL_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9) +/* Those macro's are especially for Itcl 3.4 compatibility */ +# define tclCreateNamespace tcl_CreateNamespace +# define tclDeleteNamespace tcl_DeleteNamespace +# define tclAppendExportList tcl_AppendExportList +# define tclExport tcl_Export +# define tclImport tcl_Import +# define tclForgetImport tcl_ForgetImport +# define tclGetCurrentNamespace_ tcl_GetCurrentNamespace +# define tclGetGlobalNamespace_ tcl_GetGlobalNamespace +# define tclFindNamespace tcl_FindNamespace +# define tclFindCommand tcl_FindCommand +# define tclGetCommandFromObj tcl_GetCommandFromObj +# define tclGetCommandFullName tcl_GetCommandFullName +#endif /* !defined(TCL_NO_DEPRECATED) */ + /* * WARNING: This file is automatically generated by the tools/genStubs.tcl * script. Any modifications to the function declarations below should be made @@ -1367,57 +1383,6 @@ extern const TclIntStubs *tclIntStubsPtr; # undef TclGetCommandFullName # undef TclCopyChannelOld # undef TclSockMinimumBuffersOld - -#if !defined(TCL_NO_DEPRECATED) -# undef Tcl_CreateNamespace -# define Tcl_CreateNamespace \ - (tclIntStubsPtr->tclCreateNamespace) /* 113 */ -# define tcl_CreateNamespace tclCreateNamespace -# undef Tcl_DeleteNamespace -# define Tcl_DeleteNamespace \ - (tclIntStubsPtr->tclDeleteNamespace) /* 114 */ -# define tcl_DeleteNamespace tclDeleteNamespace -# undef Tcl_AppendExportList -# define Tcl_AppendExportList \ - (tclIntStubsPtr->tclAppendExportList) /* 112 */ -# define tcl_AppendExportList tclAppendExportList -# undef Tcl_Export -# define Tcl_Export \ - (tclIntStubsPtr->tclExport) /* 115 */ -# define tcl_Export tclExport -# undef Tcl_Import -# define Tcl_Import \ - (tclIntStubsPtr->tclImport) /* 127 */ -# define tcl_Import tclImport -# undef Tcl_ForgetImport -# define Tcl_ForgetImport \ - (tclIntStubsPtr->tclForgetImport) /* 121 */ -# define tcl_ForgetImport tclForgetImport -# undef Tcl_GetCurrentNamespace -# define Tcl_GetCurrentNamespace \ - (tclIntStubsPtr->tclGetCurrentNamespace_) /* 124 */ -# define tcl_GetCurrentNamespace tclGetCurrentNamespace_ -# undef Tcl_GetGlobalNamespace -# define Tcl_GetGlobalNamespace \ - (tclIntStubsPtr->tclGetGlobalNamespace_) /* 125 */ -# define tcl_GetGlobalNamespace tclGetGlobalNamespace_ -# undef Tcl_FindNamespace -# define Tcl_FindNamespace \ - (tclIntStubsPtr->tclFindNamespace) /* 117 */ -# define tcl_FindNamespace tclFindNamespace -# undef Tcl_FindCommand -# define Tcl_FindCommand \ - (tclIntStubsPtr->tclFindCommand) /* 116 */ -# define tcl_FindCommand tclFindCommand -# undef Tcl_GetCommandFromObj -# define Tcl_GetCommandFromObj \ - (tclIntStubsPtr->tclGetCommandFromObj) /* 122 */ -# define tcl_GetCommandFromObj tclGetCommandFromObj -# undef Tcl_GetCommandFullName -# define Tcl_GetCommandFullName \ - (tclIntStubsPtr->tclGetCommandFullName) /* 123 */ -# define tcl_GetCommandFullName tclGetCommandFullName -#endif /* !defined(TCL_NO_DEPRECATED) */ #endif #endif /* _TCLINTDECLS */ -- cgit v0.12 From 92f8ce13dfb1299030dc844252d7478caaaa7687 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 4 Dec 2017 18:36:14 +0000 Subject: [4f6a1ebd64] Different fix for the problem. Re-order the filling of the subcommand table so there is no longer a conflict where multiple intreps of a single value are sought. If the mapDict and exportList are the same, then each key in the mapDict is known to be an element of the exportList without needing to check. --- generic/tclNamesp.c | 115 +++++++++++++++++++++++++-------------------------- tests/namespace.test | 19 ++++++++- 2 files changed, 73 insertions(+), 61 deletions(-) diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 4b72e03..18cd07c 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -6582,6 +6582,8 @@ BuildEnsembleConfig( int i, j, isNew; Tcl_HashTable *hash = &ensemblePtr->subcommandTable; Tcl_HashEntry *hPtr; + Tcl_Obj *mapDict = ensemblePtr->subcommandDict; + Tcl_Obj *exportList = ensemblePtr->subcmdList; if (hash->numEntries != 0) { /* @@ -6601,51 +6603,67 @@ BuildEnsembleConfig( Tcl_InitHashTable(hash, TCL_STRING_KEYS); } - /* - * See if we've got an export list. If so, we will only export exactly - * those commands, which may be either implemented by the prefix in the - * subcommandDict or mapped directly onto the namespace's commands. - */ - - if (ensemblePtr->subcmdList != NULL) { - Tcl_Obj **subcmdv, *target, *cmdObj, *cmdPrefixObj; - int subcmdc; + if (mapDict) { + /* + * We have a mapping dictionary to direct filling of the subcommand + * table. Every key, value in the dict should go into the table + * unless we have an export list that holds some of the keys back. + */ - TclListObjGetElements(NULL, ensemblePtr->subcmdList, &subcmdc, - &subcmdv); - for (i=0 ; isubcommandDict != NULL) { - Tcl_DictObjGet(NULL, ensemblePtr->subcommandDict, subcmdv[i], - &target); - if (target != NULL) { - Tcl_SetHashValue(hPtr, target); - Tcl_IncrRefCount(target); - continue; - } - } - - /* - * Not there, so map onto the namespace. Note in this case that we - * do not guarantee that the command is actually there; that is - * the programmer's responsibility (or [::unknown] of course). - */ - + /* Need to put entry in table, but it's not in mapDict */ cmdObj = Tcl_NewStringObj(ensemblePtr->nsPtr->fullName, -1); if (ensemblePtr->nsPtr->parentPtr != NULL) { Tcl_AppendStringsToObj(cmdObj, "::", name, NULL); @@ -6656,28 +6674,7 @@ BuildEnsembleConfig( Tcl_SetHashValue(hPtr, cmdPrefixObj); Tcl_IncrRefCount(cmdPrefixObj); } - } else if (ensemblePtr->subcommandDict != NULL) { - /* - * No subcmd list, but we do have a mapping dictionary so we should - * use the keys of that. Convert the dictionary's contents into the - * form required for the ensemble's internal hashtable. - */ - - Tcl_DictSearch dictSearch; - Tcl_Obj *keyObj, *valueObj; - int done; - - Tcl_DictObjFirst(NULL, ensemblePtr->subcommandDict, &dictSearch, - &keyObj, &valueObj, &done); - while (!done) { - char *name = TclGetString(keyObj); - - hPtr = Tcl_CreateHashEntry(hash, name, &isNew); - Tcl_SetHashValue(hPtr, valueObj); - Tcl_IncrRefCount(valueObj); - Tcl_DictObjNext(&dictSearch, &keyObj, &valueObj, &done); - } - } else { + } else if (mapDict == NULL) { /* * Discover what commands are actually exported by the namespace. * What we have is an array of patterns and a hash table whose keys diff --git a/tests/namespace.test b/tests/namespace.test index 7d41258..0ad8451 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -1599,14 +1599,29 @@ test namespace-42.9 { deallocated List struct. } -setup { namespace eval n {namespace ensemble create} - dict set list one ::two - namespace ensemble configure n -subcommands $list -map $list + set lst [dict create one ::two] + namespace ensemble configure n -subcommands $lst -map $lst } -body { n one } -cleanup { namespace delete n + unset -nocomplain lst } -returnCodes error -match glob -result {invalid command name*} +test namespace-42.10 { + ensembles: [Bug 4f6a1ebd64] segmentation fault due to pointer to a + deallocated List struct (this time with duplicate of one in "dict"). +} -setup { + namespace eval n {namespace ensemble create} + set lst [list one ::two one ::three] + namespace ensemble configure n -subcommands $lst -map $lst +} -body { + n one +} -cleanup { + namespace delete n + unset -nocomplain lst +} -returnCodes error -match glob -result {invalid command name *three*} + test namespace-43.1 {ensembles: dict-driven} { namespace eval ns { namespace export x* -- cgit v0.12 From 3e34d38b2d69b07bcdaf25c2935b750d829b4afb Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 5 Dec 2017 14:29:47 +0000 Subject: Use PRJ_PACKAGE_TCLNAME instead of PROJECT when generating TEA based pkgindex --- win/rules.vc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index af39a94..9b917b6 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1266,8 +1266,10 @@ COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE !endif # Like the TEA system only set this non empty for non-Tk extensions +# Note: some extensions use PACKAGE_NAME and others use PACKAGE_TCLNAME +# so we pass both !if !$(DOING_TCL) && !$(DOING_TK) -PKGNAMEFLAGS = -DPACKAGE_NAME="\"$(PROJECT)\"" \ +PKGNAMEFLAGS = -DPACKAGE_NAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ -DPACKAGE_TCLNAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \ -DMODULE_SCOPE=extern @@ -1459,7 +1461,7 @@ default-pkgindex: default-pkgindex-tea: @if exist $(ROOT)\pkgIndex.tcl.in nmakehlp -s << $(ROOT)\pkgIndex.tcl.in > $(OUT_DIR)\pkgIndex.tcl @PACKAGE_VERSION@ $(DOTVERSION) -@PACKAGE_NAME@ $(PROJECT) +@PACKAGE_NAME@ $(PRJ_PACKAGE_TCLNAME) @PACKAGE_TCLNAME@ $(PRJ_PACKAGE_TCLNAME) @PKG_LIB_FILE@ $(PRJLIBNAME) << -- cgit v0.12 From 8a44c35e8c34860fe2ea418899c8f62fc25e06bb Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 5 Dec 2017 14:36:33 +0000 Subject: Another revised fix, much closer to sebres' patch now. --- generic/tclNamesp.c | 152 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 90 insertions(+), 62 deletions(-) diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 18cd07c..1556ec9 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -6583,7 +6583,7 @@ BuildEnsembleConfig( Tcl_HashTable *hash = &ensemblePtr->subcommandTable; Tcl_HashEntry *hPtr; Tcl_Obj *mapDict = ensemblePtr->subcommandDict; - Tcl_Obj *exportList = ensemblePtr->subcmdList; + Tcl_Obj *subList = ensemblePtr->subcmdList; if (hash->numEntries != 0) { /* @@ -6603,78 +6603,106 @@ BuildEnsembleConfig( Tcl_InitHashTable(hash, TCL_STRING_KEYS); } - if (mapDict) { + if (subList) { + int subc; + Tcl_Obj **subv, *target, *cmdObj, *cmdPrefixObj; + char *name; + /* - * We have a mapping dictionary to direct filling of the subcommand - * table. Every key, value in the dict should go into the table - * unless we have an export list that holds some of the keys back. + * There is a list of exactly what subcommands go in the table. + * Must determine the target for each. */ - Tcl_DictSearch dictSearch; - Tcl_Obj *keyObj, *valueObj; - int done; - - Tcl_DictObjFirst(NULL, mapDict, &dictSearch, &keyObj, &valueObj, &done); - while (!done) { - int nameLen, insert = 1; - char *name = TclGetStringFromObj(keyObj, &nameLen); - - if (exportList && (exportList != mapDict)) { - Tcl_Obj **subv; - int subc; - - insert = 0; - TclListObjGetElements(NULL, exportList, &subc, &subv); - for (i = 0; i < subc; i++) { - int compareLen; - const char *compare - = TclGetStringFromObj(subv[i], &compareLen); - - if ((nameLen == compareLen) - && (memcmp(name, compare, (size_t)nameLen) == 0)) { - insert = 1; - break; - } + Tcl_ListObjGetElements(NULL, subList, &subc, &subv); + if (subList == mapDict) { + /* + * Strange case where explicit list of subcommands is same value + * as the dict mapping to targets. + */ + + for (i = 0; i < subc; i += 2) { + name = TclGetString(subv[i]); + hPtr = Tcl_CreateHashEntry(hash, name, &isNew); + if (!isNew) { + cmdObj = (Tcl_Obj *)Tcl_GetHashValue(hPtr); + Tcl_DecrRefCount(cmdObj); } - } - if (insert) { + Tcl_SetHashValue(hPtr, subv[i+1]); + Tcl_IncrRefCount(subv[i+1]); + + name = TclGetString(subv[i+1]); hPtr = Tcl_CreateHashEntry(hash, name, &isNew); - Tcl_SetHashValue(hPtr, valueObj); - Tcl_IncrRefCount(valueObj); + if (isNew) { + cmdObj = Tcl_NewStringObj(ensemblePtr->nsPtr->fullName, -1); + if (ensemblePtr->nsPtr->parentPtr != NULL) { + Tcl_AppendStringsToObj(cmdObj, "::", name, NULL); + } else { + Tcl_AppendStringsToObj(cmdObj, name, NULL); + } + cmdPrefixObj = Tcl_NewListObj(1, &cmdObj); + Tcl_SetHashValue(hPtr, cmdPrefixObj); + Tcl_IncrRefCount(cmdPrefixObj); + } } - Tcl_DictObjNext(&dictSearch, &keyObj, &valueObj, &done); - } - } - if (exportList) { - /* - * We have an export list. Put into the table each element that's - * not already there. - */ - int subc; - Tcl_Obj **subv, *cmdObj, *cmdPrefixObj; + } else { + /* Usual case where we can freely act on the list and dict. */ - TclListObjGetElements(NULL, exportList, &subc, &subv); - for (i=0 ; insPtr->fullName, -1); - if (ensemblePtr->nsPtr->parentPtr != NULL) { - Tcl_AppendStringsToObj(cmdObj, "::", name, NULL); - } else { - Tcl_AppendStringsToObj(cmdObj, name, NULL); + /* + * target was not in the dictionary so map onto the namespace. + * Note in this case that we do not guarantee that the + * command is actually there; that is the programmer's + * responsibility (or [::unknown] of course). + */ + cmdObj = Tcl_NewStringObj(ensemblePtr->nsPtr->fullName, -1); + if (ensemblePtr->nsPtr->parentPtr != NULL) { + Tcl_AppendStringsToObj(cmdObj, "::", name, NULL); + } else { + Tcl_AppendStringsToObj(cmdObj, name, NULL); + } + cmdPrefixObj = Tcl_NewListObj(1, &cmdObj); + Tcl_SetHashValue(hPtr, cmdPrefixObj); + Tcl_IncrRefCount(cmdPrefixObj); } - cmdPrefixObj = Tcl_NewListObj(1, &cmdObj); - Tcl_SetHashValue(hPtr, cmdPrefixObj); - Tcl_IncrRefCount(cmdPrefixObj); } - } else if (mapDict == NULL) { + } else if (mapDict) { + /* + * No subcmd list, but we do have a mapping dictionary so we should + * use the keys of that. Convert the dictionary's contents into the + * form required for the ensemble's internal hashtable. + */ + + Tcl_DictSearch dictSearch; + Tcl_Obj *keyObj, *valueObj; + int done; + + Tcl_DictObjFirst(NULL, ensemblePtr->subcommandDict, &dictSearch, + &keyObj, &valueObj, &done); + while (!done) { + char *name = TclGetString(keyObj); + + hPtr = Tcl_CreateHashEntry(hash, name, &isNew); + Tcl_SetHashValue(hPtr, valueObj); + Tcl_IncrRefCount(valueObj); + Tcl_DictObjNext(&dictSearch, &keyObj, &valueObj, &done); + } + } else { /* * Discover what commands are actually exported by the namespace. * What we have is an array of patterns and a hash table whose keys -- cgit v0.12 From 3eef9fcea1274b68161aa2c5ebfb6a975ac7143a Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 5 Dec 2017 15:12:05 +0000 Subject: Factor clearing of ensemble subcommand table into utility routine. --- generic/tclNamesp.c | 52 +++++++++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 1556ec9..a2e625e 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -6480,13 +6480,31 @@ MakeCachedEnsembleCommand( */ static void +ClearTable( + EnsembleConfig *ensemblePtr) +{ + Tcl_HashTable *hash = &ensemblePtr->subcommandTable; + + if (hash->numEntries != 0) { + Tcl_HashSearch search; + Tcl_HashEntry *hPtr = Tcl_FirstHashEntry(hash, &search); + + while (hPtr != NULL) { + Tcl_Obj *prefixObj = Tcl_GetHashValue(hPtr); + Tcl_DecrRefCount(prefixObj); + hPtr = Tcl_NextHashEntry(&search); + } + ckfree((char *) ensemblePtr->subcommandArrayPtr); + } + Tcl_DeleteHashTable(hash); +} + +static void DeleteEnsembleConfig( ClientData clientData) { EnsembleConfig *ensemblePtr = clientData; Namespace *nsPtr = ensemblePtr->nsPtr; - Tcl_HashSearch search; - Tcl_HashEntry *hEnt; /* * Unlink from the ensemble chain if it has not been marked as having been @@ -6519,17 +6537,8 @@ DeleteEnsembleConfig( * Kill the pointer-containing fields. */ - if (ensemblePtr->subcommandTable.numEntries != 0) { - ckfree((char *) ensemblePtr->subcommandArrayPtr); - } - hEnt = Tcl_FirstHashEntry(&ensemblePtr->subcommandTable, &search); - while (hEnt != NULL) { - Tcl_Obj *prefixObj = Tcl_GetHashValue(hEnt); + ClearTable(ensemblePtr); - Tcl_DecrRefCount(prefixObj); - hEnt = Tcl_NextHashEntry(&search); - } - Tcl_DeleteHashTable(&ensemblePtr->subcommandTable); if (ensemblePtr->subcmdList != NULL) { Tcl_DecrRefCount(ensemblePtr->subcmdList); } @@ -6585,23 +6594,8 @@ BuildEnsembleConfig( Tcl_Obj *mapDict = ensemblePtr->subcommandDict; Tcl_Obj *subList = ensemblePtr->subcmdList; - if (hash->numEntries != 0) { - /* - * Remove pre-existing table. - */ - - Tcl_HashSearch search; - - ckfree((char *) ensemblePtr->subcommandArrayPtr); - hPtr = Tcl_FirstHashEntry(hash, &search); - while (hPtr != NULL) { - Tcl_Obj *prefixObj = Tcl_GetHashValue(hPtr); - Tcl_DecrRefCount(prefixObj); - hPtr = Tcl_NextHashEntry(&search); - } - Tcl_DeleteHashTable(hash); - Tcl_InitHashTable(hash, TCL_STRING_KEYS); - } + ClearTable(ensemblePtr); + Tcl_InitHashTable(hash, TCL_STRING_KEYS); if (subList) { int subc; -- cgit v0.12 From 3f1dfde45f60e800df7a1ac981cf91fa2b25874b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 6 Dec 2017 12:17:33 +0000 Subject: Don't do same test twice --- generic/tclStringObj.c | 1 - 1 file changed, 1 deletion(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index da2f06f..a5b289c 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1968,7 +1968,6 @@ Tcl_AppendFormatToObj( ch = 'd'; } } - if (mp_cmp_d(&big, 0) == MP_EQ) gotHash = 0; #ifndef TCL_WIDE_INT_IS_LONG } else if (useWide) { if (TclGetWideIntFromObj(NULL, segment, &w) != TCL_OK) { -- cgit v0.12 From bb1c5fe83355d454d63db62da5797204c6cec06e Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 6 Dec 2017 13:02:32 +0000 Subject: [ce3a211dcb] Failed file normalize when tail is empty string. --- generic/tclPathObj.c | 5 ++--- tests/fileSystem.test | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index a306853..87ddfb7 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -1869,7 +1869,6 @@ Tcl_FSGetNormalizedPath( */ (void) Tcl_GetStringFromObj(dir, &cwdLen); - cwdLen += (Tcl_GetString(copy)[cwdLen] == '/'); /* Normalize the combined string. */ @@ -1890,13 +1889,13 @@ Tcl_FSGetNormalizedPath( * to a normalized head, we can more efficiently normalize the * combined path by passing over only the unnormalized tail * portion. When this is sufficient, prior developers claim - * this should be much faster. We use 'cwdLen-1' so that we are + * this should be much faster. We use 'cwdLen' so that we are * already pointing at the dir-separator that we know about. * The normalization code will actually start off directly * after that separator. */ - TclFSNormalizeToUniquePath(interp, copy, cwdLen-1); + TclFSNormalizeToUniquePath(interp, copy, cwdLen); } /* Now we need to construct the new path object. */ diff --git a/tests/fileSystem.test b/tests/fileSystem.test index d34de8f..1c507e1 100644 --- a/tests/fileSystem.test +++ b/tests/fileSystem.test @@ -508,6 +508,22 @@ test filesystem-1.52.1 {bug f9f390d0fa: file join where strep is not canonical} file normalize $x file join $x } -result /foo +test filesystem-1.53 {[Bug 3559678] - normalize when tail is empty} { + string match */ [file normalize [lindex [glob -dir [pwd] {{}}] 0]] +} 0 +test filesystem-1.54 {[Bug ce3a211dcb] - normalize when tail is empty} -setup { + set save [pwd] + cd [set home [makeDirectory ce3a211dcb]] + makeDirectory A $home + cd [lindex [glob */] 0] +} -body { + string match */A [pwd] +} -cleanup { + cd $home + removeDirectory A $home + cd $save + removeDirectory ce3a211dcb +} -result 1 test filesystem-2.0 {new native path} {unix} { foreach f [lsort [glob -nocomplain /usr/bin/c*]] { -- cgit v0.12 From 21877b851cd37a74cf2bff60aeea082cdfa0bafd Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 6 Dec 2017 13:28:12 +0000 Subject: Adapt the bytearray accommodation of Tcl_CharLength() for 8.7+. --- generic/tclStringObj.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 85cac83..385ce4f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -421,13 +421,14 @@ Tcl_GetCharLength( * Optimize the case where we're really dealing with a bytearray object; * we don't need to convert to a string to perform the get-length operation. * - * NOTE that we do not need the bytearray to be "pure". A ByteArray value - * with a string rep cannot be trusted to represent the same value as the - * string rep, but it *can* be trusted to have the same character length - * as the string rep, which is all this routine cares about. + * Starting in Tcl 8.7, we check for a "pure" bytearray, because the + * machinery behind that test is using a proper bytearray ObjType. We + * could also compute length of an improper bytearray without shimmering + * but there's no value in that. We *want* to shimmer an improper bytearray + * because improper bytearrays have worthless internal reps. */ - if (objPtr->typePtr == &tclByteArrayType) { + if (TclIsPureByteArray(objPtr)) { int length; (void) Tcl_GetByteArrayFromObj(objPtr, &length); -- cgit v0.12 From 3aab0c568ba1c8c0e1663fab50043b5ccaad90b7 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 6 Dec 2017 15:27:28 +0000 Subject: Start RC branch for Tcl 8.6.8 --- README | 2 +- generic/tcl.h | 4 ++-- library/init.tcl | 2 +- unix/configure | 2 +- unix/configure.in | 2 +- unix/tcl.spec | 2 +- win/configure | 3 ++- win/configure.in | 2 +- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README b/README index 57985d3..adfdf97 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ README: Tcl - This is the Tcl 8.6.7 source distribution. + This is the Tcl 8.6.8 source distribution. http://sourceforge.net/projects/tcl/files/Tcl/ You can get any source release of Tcl from the URL above. diff --git a/generic/tcl.h b/generic/tcl.h index a35dd5d..b43b2d7 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -55,10 +55,10 @@ extern "C" { #define TCL_MAJOR_VERSION 8 #define TCL_MINOR_VERSION 6 #define TCL_RELEASE_LEVEL TCL_FINAL_RELEASE -#define TCL_RELEASE_SERIAL 7 +#define TCL_RELEASE_SERIAL 8 #define TCL_VERSION "8.6" -#define TCL_PATCH_LEVEL "8.6.7" +#define TCL_PATCH_LEVEL "8.6.8" /* *---------------------------------------------------------------------------- diff --git a/library/init.tcl b/library/init.tcl index c31eea3..b0d567c 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -16,7 +16,7 @@ if {[info commands package] == ""} { error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]" } -package require -exact Tcl 8.6.7 +package require -exact Tcl 8.6.8 # Compute the auto path to use in this interpreter. # The values on the path come from several locations: diff --git a/unix/configure b/unix/configure index 888fe0c..3d7fbf4 100755 --- a/unix/configure +++ b/unix/configure @@ -1335,7 +1335,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL=".7" +TCL_PATCH_LEVEL=".8" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/configure.in b/unix/configure.in index 220a4aa..bfa2ef7 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -25,7 +25,7 @@ m4_ifdef([SC_USE_CONFIG_HEADERS], [ TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL=".7" +TCL_PATCH_LEVEL=".8" VERSION=${TCL_VERSION} EXTRA_INSTALL_BINARIES=${EXTRA_INSTALL_BINARIES:-"@:"} diff --git a/unix/tcl.spec b/unix/tcl.spec index 141511d..09920dd 100644 --- a/unix/tcl.spec +++ b/unix/tcl.spec @@ -4,7 +4,7 @@ Name: tcl Summary: Tcl scripting language development environment -Version: 8.6.7 +Version: 8.6.8 Release: 2 License: BSD Group: Development/Languages diff --git a/win/configure b/win/configure index 1480a57..be38dc3 100755 --- a/win/configure +++ b/win/configure @@ -1311,7 +1311,7 @@ SHELL=/bin/sh TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL=".7" +TCL_PATCH_LEVEL=".8" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 @@ -5271,6 +5271,7 @@ TCL_WIN_VERSION="$TCL_VERSION.$TCL_RELEASE_LEVEL.`echo $TCL_PATCH_LEVEL | tr -d + # win only diff --git a/win/configure.in b/win/configure.in index 0229e83..5fc17a3 100644 --- a/win/configure.in +++ b/win/configure.in @@ -14,7 +14,7 @@ SHELL=/bin/sh TCL_VERSION=8.6 TCL_MAJOR_VERSION=8 TCL_MINOR_VERSION=6 -TCL_PATCH_LEVEL=".7" +TCL_PATCH_LEVEL=".8" VER=$TCL_MAJOR_VERSION$TCL_MINOR_VERSION TCL_DDE_VERSION=1.4 -- cgit v0.12 From 7b04f399b059c4de76ed101728d5608247d96711 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 6 Dec 2017 15:30:27 +0000 Subject: Duplicate test names --- tests/scan.test | 2 +- tests/utf.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scan.test b/tests/scan.test index b36b412..98c581b 100644 --- a/tests/scan.test +++ b/tests/scan.test @@ -553,7 +553,7 @@ test scan-5.18 {bigint scanning underflow} -setup { list [scan "-207698809136909011942886895" \ %llu a] $a } -returnCodes 1 -result {unsigned bignum scans are invalid} -test scan-5.18 {bigint scanning invalid} -setup { +test scan-5.19 {bigint scanning invalid} -setup { set a {}; } -body { list [scan "207698809136909011942886895" \ diff --git a/tests/utf.test b/tests/utf.test index d0fa7be..95775a8 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -124,7 +124,7 @@ test utf-4.10 {Tcl_NumUtfChars: #u0000, calc len, overcomplete} {testnumutfchars test utf-5.1 {Tcl_UtfFindFirst} {testfindfirst testbytestring} { testfindfirst [testbytestring "abcbc"] 98 } {bcbc} -test utf-5.1 {Tcl_UtfFindLast} {testfindlast testbytestring} { +test utf-5.2 {Tcl_UtfFindLast} {testfindlast testbytestring} { testfindlast [testbytestring "abcbc"] 98 } {bc} -- cgit v0.12 From cf3348e41cba5b0d82271b5cd6f54df9912300a7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 6 Dec 2017 16:04:22 +0000 Subject: (cherry-pick from core-8-6-8-rc): Duplicate test names --- tests/scan.test | 2 +- tests/utf.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/scan.test b/tests/scan.test index b36b412..98c581b 100644 --- a/tests/scan.test +++ b/tests/scan.test @@ -553,7 +553,7 @@ test scan-5.18 {bigint scanning underflow} -setup { list [scan "-207698809136909011942886895" \ %llu a] $a } -returnCodes 1 -result {unsigned bignum scans are invalid} -test scan-5.18 {bigint scanning invalid} -setup { +test scan-5.19 {bigint scanning invalid} -setup { set a {}; } -body { list [scan "207698809136909011942886895" \ diff --git a/tests/utf.test b/tests/utf.test index d0fa7be..95775a8 100644 --- a/tests/utf.test +++ b/tests/utf.test @@ -124,7 +124,7 @@ test utf-4.10 {Tcl_NumUtfChars: #u0000, calc len, overcomplete} {testnumutfchars test utf-5.1 {Tcl_UtfFindFirst} {testfindfirst testbytestring} { testfindfirst [testbytestring "abcbc"] 98 } {bcbc} -test utf-5.1 {Tcl_UtfFindLast} {testfindlast testbytestring} { +test utf-5.2 {Tcl_UtfFindLast} {testfindlast testbytestring} { testfindlast [testbytestring "abcbc"] 98 } {bc} -- cgit v0.12 From 9ba4b4f90141907cd56d190574d5b1906fbbe23a Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 6 Dec 2017 19:57:59 +0000 Subject: [0e4d88b650] Added enough refcounting to stop `make valgrind` complaints about "Invalid read". This is not a complete fix. Things are still broken. A working system of Namespace lifetime management looks like an 8.7 project. --- generic/tclBasic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index acdcf41..79de61e 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3112,6 +3112,7 @@ Tcl_DeleteCommandFromToken( * traces. */ + cmdPtr->nsPtr->refCount++; if (cmdPtr->tracePtr != NULL) { CommandTrace *tracePtr; CallCommandTraces(iPtr,cmdPtr,NULL,NULL,TCL_TRACE_DELETE); @@ -3139,6 +3140,7 @@ Tcl_DeleteCommandFromToken( */ TclInvalidateNsCmdLookup(cmdPtr->nsPtr); + TclNsDecrRefCount(cmdPtr->nsPtr); /* * If the command being deleted has a compile function, increment the -- cgit v0.12 From cd525c7bb12f0758dcb87189fdb884697806cef7 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 6 Dec 2017 20:44:32 +0000 Subject: Plug memleak recently put into [package require]. --- generic/tclPkg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index d3dd584..349bda8 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -432,6 +432,8 @@ PkgRequireCore( * The version of the package sought is better than the * currently selected version. */ + ckfree(bestVersion); + bestVersion = NULL; goto newbest; } } else { @@ -460,6 +462,8 @@ PkgRequireCore( * This stable version of the package sought is better * than the currently selected stable version. */ + ckfree(bestStableVersion); + bestStableVersion = NULL; goto newstable; } } else { -- cgit v0.12 From bbaba520ab3333e53b984347c1841a9f8f264eca Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 6 Dec 2017 21:59:13 +0000 Subject: changes WIP --- changes | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/changes b/changes index d4be350..74c1146 100644 --- a/changes +++ b/changes @@ -8796,5 +8796,25 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) --- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details +2017-08-10 [array names -regexp] supports backrefs (goth) + +2017-08-10 Fix gcc build failures due to #pragma placement (cassoff,fellows) + +2017-08-29 (bug)[b50fb2] exec redir append stdout and stderr to file (coulter) + 2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann) => http 2.8.12 + +2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter) + +2017-10-19 (bug)[1a5655] [info * methods] includes mixins (fellows) + +2017-10-23 tzdata updated to Olson's tzdata2017c (jima) + +2017-10-24 (bug)[fc1409] segfault in method cloning, oo-15.15 (coulter,fellows) + +2017-11-03 (bug)[6f2f83] More robust [load] for ReactOS + + + +--- Released 8.6.8, December XX, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 6c313a58460ec101decbb59630caf788b4a1610c Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 7 Dec 2017 02:01:30 +0000 Subject: update changes --- changes | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/changes b/changes index 74c1146..7a85768 100644 --- a/changes +++ b/changes @@ -8813,8 +8813,16 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-10-24 (bug)[fc1409] segfault in method cloning, oo-15.15 (coulter,fellows) -2017-11-03 (bug)[6f2f83] More robust [load] for ReactOS +2017-11-03 (bug)[6f2f83] More robust [load] for ReactOS (werner) +2017-11-08 (bug)[3298012] Stop crash when hash tables overflow 32 bits (porter) +2017-11-14 (bug)[5d6de6] Close failing case of [package prefer stable] (kupries) + +2017-11-17 (bug)[fab924] Fix misleading [load] message on Windows (oehlmann) + +2017-12-05 (bug)[4f6a1e] Crash when ensemble map and list are same (sebres) + +2017-12-06 (bug)[ce3a21] file normalize failure when tail is empty (porter) --- Released 8.6.8, December XX, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 5cddfdcda6241cdb20f0b50fe2d10293063786b9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 9 Dec 2017 15:31:58 +0000 Subject: Undo latest change to tcl.rc, since the autoconf-based windows build doesn't know about PRJLIBNAME --- win/tcl.rc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/win/tcl.rc b/win/tcl.rc index 2ca6015..be5e0a7 100644 --- a/win/tcl.rc +++ b/win/tcl.rc @@ -4,6 +4,24 @@ #include #include +// +// build-up the name suffix that defines the type of build this is. +// +#if TCL_THREADS +#define SUFFIX_THREADS "t" +#else +#define SUFFIX_THREADS "" +#endif + +#if DEBUG && !UNCHECKED +#define SUFFIX_DEBUG "g" +#else +#define SUFFIX_DEBUG "" +#endif + +#define SUFFIX SUFFIX_THREADS SUFFIX_DEBUG + + LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */ VS_VERSION_INFO VERSIONINFO @@ -24,7 +42,7 @@ BEGIN BLOCK "040904b0" /* LANG_ENGLISH/SUBLANG_ENGLISH_US, Unicode CP */ BEGIN VALUE "FileDescription", "Tcl DLL\0" - VALUE "OriginalFilename", PRJLIBNAME + VALUE "OriginalFilename", "tcl" STRINGIFY(TCL_MAJOR_VERSION) STRINGIFY(TCL_MINOR_VERSION) SUFFIX ".dll\0" VALUE "CompanyName", "ActiveState Corporation\0" VALUE "FileVersion", TCL_PATCH_LEVEL VALUE "LegalCopyright", "Copyright \251 2001 by ActiveState Corporation, et al\0" -- cgit v0.12 From dfeacc8edb1494b531c9bdbe41a83aa89a557198 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 10 Dec 2017 14:35:02 +0000 Subject: Fix [040586323610be22f8617962377324f4ddc9bc02|0405863236]: wrong field checked in struct pollfd in TclUnixWaitForFile --- unix/tclUnixNotfy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 5bc753a..b7df740 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -532,13 +532,13 @@ TclUnixWaitForFile( numFound = poll(pollFds, 1, pollTimeout); if (numFound == 1) { result = 0; - if (pollFds[0].events & (POLLIN | POLLHUP)) { + if (pollFds[0].revents & (POLLIN | POLLHUP)) { result |= TCL_READABLE; } - if (pollFds[0].events & POLLOUT) { + if (pollFds[0].revents & POLLOUT) { result |= TCL_WRITABLE; } - if (pollFds[0].events & POLLERR) { + if (pollFds[0].revents & POLLERR) { result |= TCL_EXCEPTION; } if (result) { -- cgit v0.12 From 2555e0d7e6f980833f0369e83b81b0c37050c3f5 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Sun, 10 Dec 2017 21:45:26 +0000 Subject: Streamline TclOO object cleanup routines. --- generic/tclBasic.c | 2 + generic/tclOO.c | 619 ++++++++++++++++++---------------------------- generic/tclOOBasic.c | 5 - generic/tclOOCall.c | 4 +- generic/tclOODefineCmds.c | 62 ++++- generic/tclOOInt.h | 46 ++-- tests/oo.test | 13 +- 7 files changed, 326 insertions(+), 425 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index eceea31..a23100e 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3152,6 +3152,8 @@ Tcl_DeleteCommandFromToken( */ cmdPtr->nsPtr->refCount++; + + cmdPtr->nsPtr->refCount++; if (cmdPtr->tracePtr != NULL) { CommandTrace *tracePtr; CallCommandTraces(iPtr,cmdPtr,NULL,NULL,TCL_TRACE_DELETE); diff --git a/generic/tclOO.c b/generic/tclOO.c index 84380e0..ae1ae3f 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -60,8 +60,6 @@ static const struct { static Class * AllocClass(Tcl_Interp *interp, Object *useThisObj); static Object * AllocObject(Tcl_Interp *interp, const char *nameStr, Namespace *nsPtr, const char *nsNameStr); -static void ClearMixins(Class *clsPtr); -static void ClearSuperclasses(Class *clsPtr); static int CloneClassMethod(Tcl_Interp *interp, Class *clsPtr, Method *mPtr, Tcl_Obj *namePtr, Method **newMPtrPtr); @@ -73,6 +71,7 @@ static void DeletedHelpersNamespace(ClientData clientData); static Tcl_NRPostProc FinalizeAlloc; static Tcl_NRPostProc FinalizeNext; static Tcl_NRPostProc FinalizeObjectCall; +static void initClassPath(Tcl_Interp * interp, Class *clsPtr); static int InitFoundation(Tcl_Interp *interp); static void KillFoundation(ClientData clientData, Tcl_Interp *interp); @@ -82,6 +81,7 @@ static void ObjectRenamedTrace(ClientData clientData, Tcl_Interp *interp, const char *oldName, const char *newName, int flags); static void ReleaseClassContents(Tcl_Interp *interp,Object *oPtr); +static void DeleteDescendants(Tcl_Interp *interp,Object *oPtr); static inline void SquelchCachedName(Object *oPtr); static int PublicObjectCmd(ClientData clientData, @@ -96,6 +96,8 @@ static int PrivateObjectCmd(ClientData clientData, static int PrivateNRObjectCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); +static void RemoveClass(Class ** list, int num, int idx); +static void RemoveObject(Object ** list, int num, int idx); /* * Methods in the oo::object and oo::class classes. First, we define a helper @@ -228,10 +230,14 @@ MODULE_SCOPE const TclOOStubs tclOOStubs; * ROOT_CLASS respectively. */ -#define Deleted(oPtr) (((Object *)(oPtr))->command == NULL) +#define Deleted(oPtr) ((oPtr)->flags & OBJECT_DELETED) #define IsRootObject(ocPtr) ((ocPtr)->flags & ROOT_OBJECT) #define IsRootClass(ocPtr) ((ocPtr)->flags & ROOT_CLASS) #define IsRoot(ocPtr) ((ocPtr)->flags & (ROOT_OBJECT|ROOT_CLASS)) + +#define RemoveItem(type, lst, i) \ + Remove ## type ((lst).list, (lst).num, i); \ + (lst).num-- /* * ---------------------------------------------------------------------- @@ -313,6 +319,10 @@ InitFoundation( Tcl_GetThreadData(&tsdKey, sizeof(ThreadLocalData)); Foundation *fPtr = ckalloc(sizeof(Foundation)); Tcl_Obj *namePtr, *argsPtr, *bodyPtr; + + Class fakeCls; + Object fakeObject; + Tcl_DString buffer; Command *cmdPtr; int i; @@ -379,24 +389,43 @@ InitFoundation( * spliced manually. */ + /* Stand up a phony class for bootstrapping. */ + fPtr->objectCls = &fakeCls; + /* referenced in AllocClass to increment the refCount. */ + fakeCls.thisPtr = &fakeObject; + fPtr->objectCls = AllocClass(interp, AllocObject(interp, "object", (Namespace *)fPtr->ooNs, NULL)); fPtr->classCls = AllocClass(interp, AllocObject(interp, "class", (Namespace *)fPtr->ooNs, NULL)); + + /* Rewire bootstrapped objects. */ fPtr->objectCls->thisPtr->selfCls = fPtr->classCls; + fPtr->classCls->thisPtr->selfCls = fPtr->classCls; + + AddRef(fPtr->objectCls->thisPtr); + AddRef(fPtr->classCls->thisPtr); + AddRef(fPtr->classCls->thisPtr->selfCls->thisPtr); + AddRef(fPtr->objectCls->thisPtr->selfCls->thisPtr); + + /* special initialization for the primordial objects */ fPtr->objectCls->thisPtr->flags |= ROOT_OBJECT; fPtr->objectCls->flags |= ROOT_OBJECT; + + /* This is why it is unnecessary in this routine to make up for the + * incremented reference count of fPtr->objectCls that was sallwed by + * fakeObject. */ fPtr->objectCls->superclasses.num = 0; ckfree(fPtr->objectCls->superclasses.list); fPtr->objectCls->superclasses.list = NULL; - fPtr->classCls->thisPtr->selfCls = fPtr->classCls; + fPtr->classCls->thisPtr->flags |= ROOT_CLASS; fPtr->classCls->flags |= ROOT_CLASS; + + /* Standard initialization for new Objects */ TclOOAddToInstances(fPtr->objectCls->thisPtr, fPtr->classCls); TclOOAddToInstances(fPtr->classCls->thisPtr, fPtr->classCls); TclOOAddToSubclasses(fPtr->classCls, fPtr->objectCls); - AddRef(fPtr->objectCls->thisPtr); - AddRef(fPtr->objectCls); /* * Basic method declarations for the core classes. @@ -522,8 +551,6 @@ KillFoundation( { Foundation *fPtr = GetFoundation(interp); - DelRef(fPtr->objectCls->thisPtr); - DelRef(fPtr->objectCls); TclDecrRefCount(fPtr->unknownMethodNameObj); TclDecrRefCount(fPtr->constructorName); TclDecrRefCount(fPtr->destructorName); @@ -538,8 +565,11 @@ KillFoundation( * AllocObject -- * * Allocate an object of basic type. Does not splice the object into its - * class's instance list. The caller must set the classPtr on the object, - * either to a class or to NULL. + * class's instance list. The caller must set the classPtr on the object + * to either a class or NULL, call TclOOAddToInstances to add the object + * to the class's instance list, and if the object itself is a class, use + * call TclOOAddToSubclasses() to add it to the right class's list of + * subclasses. * * ---------------------------------------------------------------------- */ @@ -564,7 +594,7 @@ AllocObject( Object *oPtr; Command *cmdPtr; CommandTrace *tracePtr; - int creationEpoch, ignored; + int creationEpoch; oPtr = ckalloc(sizeof(Object)); memset(oPtr, 0, sizeof(Object)); @@ -641,9 +671,15 @@ AllocObject( */ oPtr->fPtr = fPtr; - oPtr->selfCls = fPtr->objectCls; oPtr->creationEpoch = creationEpoch; - oPtr->refCount = 1; + + /* + * An object starts life with a refCount of 2 to mark the two stages of + * destruction it occur: A call to ObjectRenamedTrace(), and a call to + * ObjectNamespaceDeleted(). + */ + oPtr->refCount = 2; + oPtr->flags = USE_CLASS_CACHE; /* @@ -655,6 +691,10 @@ AllocObject( if (!nameStr) { nameStr = oPtr->namespacePtr->name; nsPtr = (Namespace *)oPtr->namespacePtr; + if (nsPtr->parentPtr != NULL) { + nsPtr = nsPtr->parentPtr; + } + } oPtr->command = TclCreateObjCommandInNs(interp, nameStr, (Tcl_Namespace *)nsPtr, PublicObjectCmd, oPtr, NULL); @@ -673,26 +713,8 @@ AllocObject( tracePtr->nextPtr = NULL; tracePtr->refCount = 1; - /* - * Access the namespace command table directly when creating "my" to avoid - * a bottleneck in string manipulation. Another abstraction-buster. - */ - - cmdPtr = ckalloc(sizeof(Command)); - memset(cmdPtr, 0, sizeof(Command)); - cmdPtr->nsPtr = (Namespace *) oPtr->namespacePtr; - cmdPtr->hPtr = Tcl_CreateHashEntry(&cmdPtr->nsPtr->cmdTable, "my", - &ignored); - cmdPtr->refCount = 1; - cmdPtr->objProc = PrivateObjectCmd; - cmdPtr->deleteProc = MyDeleted; - cmdPtr->objClientData = cmdPtr->deleteData = oPtr; - cmdPtr->proc = TclInvokeObjectCommand; - cmdPtr->clientData = cmdPtr; - cmdPtr->nreProc = PrivateNRObjectCmd; - Tcl_SetHashValue(cmdPtr->hPtr, cmdPtr); - oPtr->myCommand = (Tcl_Command) cmdPtr; - + oPtr->myCommand = TclNRCreateCommandInNs(interp, "my", oPtr->namespacePtr, + PrivateObjectCmd, PrivateNRObjectCmd, oPtr, MyDeleted); return oPtr; } @@ -774,88 +796,20 @@ ObjectRenamedTrace( /* * The namespace is only deleted if it hasn't already been deleted. [Bug - * 2950259]. If the namespace has already been deleted, then - * ObjectNamespaceDeleted() has already cleaned up this command. + * 2950259]. */ - if (oPtr->namespacePtr == NULL) { - /* - * ObjectNamespaceDeleted() has already done all the cleanup, but - * detected that the command was in the process of being deleted, and - * left the pointer allocated for us. - */ - DelRef(oPtr); - } else { - if (((Namespace *) oPtr->namespacePtr)->earlyDeleteProc == NULL) { - /* - * ObjectNamespaceDeleted() called us, and still has some work to - * do, so we leave the pointer allocated for it to finish, and then - * it will deallocate the pointer. - */ - } else { - Tcl_DeleteNamespace(oPtr->namespacePtr); - /* - * ObjectNamespaceDeleted() doesn't know it was us that just - * called, so it left the pointer allocated. - */ - DelRef(oPtr); - } + if (!Deleted(oPtr)) { + Tcl_DeleteNamespace(oPtr->namespacePtr); } + oPtr->command = NULL; + TclOODecrRefCount(oPtr); return; } /* * ---------------------------------------------------------------------- * - * ClearMixins, ClearSuperclasses -- - * - * Utility functions for correctly clearing the list of mixins or - * superclasses of a class. Will ckfree() the list storage. - * - * ---------------------------------------------------------------------- - */ - -static void -ClearMixins( - Class *clsPtr) -{ - int i; - Class *mixinPtr; - - if (clsPtr->mixins.num == 0) { - return; - } - - FOREACH(mixinPtr, clsPtr->mixins) { - TclOORemoveFromMixinSubs(clsPtr, mixinPtr); - } - ckfree(clsPtr->mixins.list); - clsPtr->mixins.list = NULL; - clsPtr->mixins.num = 0; -} - -static void -ClearSuperclasses( - Class *clsPtr) -{ - int i; - Class *superPtr; - - if (clsPtr->superclasses.num == 0) { - return; - } - - FOREACH(superPtr, clsPtr->superclasses) { - TclOORemoveFromSubclasses(clsPtr, superPtr); - } - ckfree(clsPtr->superclasses.list); - clsPtr->superclasses.list = NULL; - clsPtr->superclasses.num = 0; -} - -/* - * ---------------------------------------------------------------------- - * * ReleaseClassContents -- * * Tear down the special class data structure, including deleting all @@ -865,122 +819,39 @@ ClearSuperclasses( */ static void -ReleaseClassContents( +DeleteDescendants( Tcl_Interp *interp, /* The interpreter containing the class. */ Object *oPtr) /* The object representing the class. */ { - FOREACH_HASH_DECLS; - int i; - Class *clsPtr = oPtr->classPtr, *mixinSubclassPtr, *subclassPtr; + Class *clsPtr = oPtr->classPtr, *subclassPtr, *mixinSubclassPtr; Object *instancePtr; - Method *mPtr; - Foundation *fPtr = oPtr->fPtr; - Tcl_Obj *variableObj; - - /* - * Sanity check! - */ - - if (!Deleted(oPtr)) { - if (IsRootClass(oPtr)) { - Tcl_Panic("deleting class structure for non-deleted %s", - "::oo::class"); - } else if (IsRootObject(oPtr)) { - Tcl_Panic("deleting class structure for non-deleted %s", - "::oo::object"); - } else { - Tcl_Panic("deleting class structure for non-deleted %s", - "general object"); - } - } - - /* - * Lock a number of dependent objects until we've stopped putting our - * fingers in them. - */ - - FOREACH(mixinSubclassPtr, clsPtr->mixinSubs) { - if (mixinSubclassPtr != NULL) { - AddRef(mixinSubclassPtr); - AddRef(mixinSubclassPtr->thisPtr); - } - } - FOREACH(subclassPtr, clsPtr->subclasses) { - if (subclassPtr != NULL && !IsRoot(subclassPtr)) { - AddRef(subclassPtr); - AddRef(subclassPtr->thisPtr); - } - } - if (!IsRootClass(oPtr)) { - FOREACH(instancePtr, clsPtr->instances) { - if (instancePtr != oPtr) { - int j; - if (instancePtr->selfCls == clsPtr) { - instancePtr->flags |= CLASS_GONE; - } - for(j=0 ; jmixins.num ; j++) { - Class *mixin = instancePtr->mixins.list[j]; - Class *nextMixin = NULL; - if (mixin == clsPtr) { - if (j < instancePtr->mixins.num - 1) { - nextMixin = instancePtr->mixins.list[j+1]; - } - if (j == 0) { - instancePtr->mixins.num = 0; - instancePtr->mixins.list = NULL; - } else { - instancePtr->mixins.list[j-1] = nextMixin; - } - instancePtr->mixins.num -= 1; - } - } - if (instancePtr != NULL && !IsRoot(instancePtr)) { - AddRef(instancePtr); - } - } - } - } + int i; /* * Squelch classes that this class has been mixed into. */ FOREACH(mixinSubclassPtr, clsPtr->mixinSubs) { - if (mixinSubclassPtr != clsPtr) { - if (!Deleted(mixinSubclassPtr->thisPtr)) { - Tcl_DeleteCommandFromToken(interp, - mixinSubclassPtr->thisPtr->command); - } - ClearMixins(mixinSubclassPtr); - DelRef(mixinSubclassPtr->thisPtr); - DelRef(mixinSubclassPtr); + /* This condition also covers the case where mixinSubclassPtr == + * clsPtr + */ + if (!Deleted(mixinSubclassPtr->thisPtr)) { + Tcl_DeleteCommandFromToken(interp, + mixinSubclassPtr->thisPtr->command); } + i -= TclOORemoveFromMixinSubs(mixinSubclassPtr, clsPtr); + TclOODecrRefCount(mixinSubclassPtr->thisPtr); } - if (clsPtr->mixinSubs.list != NULL) { - ckfree(clsPtr->mixinSubs.list); - clsPtr->mixinSubs.list = NULL; - clsPtr->mixinSubs.num = 0; - } - /* * Squelch subclasses of this class. */ FOREACH(subclassPtr, clsPtr->subclasses) { - if (IsRoot(subclassPtr)) { - continue; - } - if (!Deleted(subclassPtr->thisPtr)) { + if (!Deleted(subclassPtr->thisPtr) && !IsRoot(subclassPtr)) { Tcl_DeleteCommandFromToken(interp, subclassPtr->thisPtr->command); } - ClearSuperclasses(subclassPtr); - DelRef(subclassPtr->thisPtr); - DelRef(subclassPtr); - } - if (clsPtr->subclasses.list != NULL) { - ckfree(clsPtr->subclasses.list); - clsPtr->subclasses.list = NULL; - clsPtr->subclasses.num = 0; + i -= TclOORemoveFromSubclasses(subclassPtr, clsPtr); + TclOODecrRefCount(subclassPtr->thisPtr); } /* @@ -989,35 +860,43 @@ ReleaseClassContents( if (!IsRootClass(oPtr)) { FOREACH(instancePtr, clsPtr->instances) { - if (instancePtr != oPtr) { - if (instancePtr == NULL || IsRoot(instancePtr)) { - continue; - } - if (!Deleted(instancePtr)) { - Tcl_DeleteCommandFromToken(interp, instancePtr->command); - /* - * Tcl_DeleteCommandFromToken() may have done to whole - * job for us. Roll back and check again. - */ - i--; - continue; - } - DelRef(instancePtr); + /* This condition also covers the case where instancePtr == oPtr */ + if (!Deleted(instancePtr) && !IsRoot(instancePtr)) { + Tcl_DeleteCommandFromToken(interp, instancePtr->command); } + i -= TclOORemoveFromInstances(instancePtr, clsPtr); } } - if (clsPtr->instances.list != NULL) { - ckfree(clsPtr->instances.list); - clsPtr->instances.list = NULL; - clsPtr->instances.num = 0; - } +} + + +static void +ReleaseClassContents( + Tcl_Interp *interp, /* The interpreter containing the class. */ + Object *oPtr) /* The object representing the class. */ +{ + FOREACH_HASH_DECLS; + int i; + Class *clsPtr = oPtr->classPtr, *tmpClsPtr; + Method *mPtr; + Foundation *fPtr = oPtr->fPtr; + Tcl_Obj *variableObj; /* - * Special: We delete these after everything else. + * Sanity check! */ - if (IsRootClass(oPtr) && !Deleted(fPtr->objectCls->thisPtr)) { - Tcl_DeleteCommandFromToken(interp, fPtr->objectCls->thisPtr->command); + if (!Deleted(oPtr)) { + if (IsRootClass(oPtr)) { + Tcl_Panic("deleting class structure for non-deleted %s", + "::oo::class"); + } else if (IsRootObject(oPtr)) { + Tcl_Panic("deleting class structure for non-deleted %s", + "::oo::object"); + } else { + Tcl_Panic("deleting class structure for non-deleted %s", + "general object"); + } } /* @@ -1073,8 +952,12 @@ ReleaseClassContents( clsPtr->metadataPtr = NULL; } - ClearMixins(clsPtr); - ClearSuperclasses(clsPtr); + FOREACH(tmpClsPtr, clsPtr->mixins) { + TclOORemoveFromMixinSubs(clsPtr, tmpClsPtr); + } + FOREACH(tmpClsPtr, clsPtr->superclasses) { + TclOORemoveFromSubclasses(clsPtr, tmpClsPtr); + } FOREACH_HASH_VALUE(mPtr, &clsPtr->classMethods) { TclOODelMethodRef(mPtr); @@ -1090,12 +973,9 @@ ReleaseClassContents( ckfree(clsPtr->variables.list); } - /* Tell oPtr that it's class is gone so that it doesn't try to remove - * itself from it's classe's list of instances - */ - oPtr->flags |= CLASS_GONE; - DelRef(clsPtr); - + if (IsRootClass(oPtr) && !Deleted(fPtr->objectCls->thisPtr)) { + Tcl_DeleteCommandFromToken(interp, fPtr->objectCls->thisPtr->command); + } } /* @@ -1123,13 +1003,26 @@ ObjectNamespaceDeleted( Method *mPtr; Tcl_Obj *filterObj, *variableObj; Tcl_Interp *interp = oPtr->fPtr->interp; - int finished = 0, i; + int i; + if (Deleted(oPtr)) { + /* To do: Can ObjectNamespaceDeleted ever be called twice? If not, + * this guard could be removed. + */ + return; + } - AddRef(fPtr->classCls); - AddRef(fPtr->objectCls); - AddRef(fPtr->classCls->thisPtr); - AddRef(fPtr->objectCls->thisPtr); + /* + * One rule for the teardown routines is that if an object is in the + * process of being deleted, nothing else may modify its bookeeping + * records. This is the flag that + */ + oPtr->flags |= OBJECT_DELETED; + + /* Let the dominoes fall */ + if (oPtr->classPtr) { + DeleteDescendants(interp, oPtr); + } /* * We do not run destructors on the core class objects when the @@ -1137,15 +1030,14 @@ ObjectNamespaceDeleted( * in that case when the destructor is partially deleted before the uses * of it have gone. [Bug 2949397] */ - - if (!(oPtr->flags & DESTRUCTOR_CALLED) && !Tcl_InterpDeleted(interp)) { + if (!Tcl_InterpDeleted(interp) && !(oPtr->flags & DESTRUCTOR_CALLED)) { CallContext *contextPtr = TclOOGetCallContext(oPtr, NULL, DESTRUCTOR, NULL); int result; Tcl_InterpState state; - oPtr->flags |= DESTRUCTOR_CALLED; + if (contextPtr != NULL) { contextPtr->callPtr->flags |= DESTRUCTOR; contextPtr->skip = 0; @@ -1167,7 +1059,7 @@ ObjectNamespaceDeleted( * points into freed memory. */ - if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) { + if (((Command *)oPtr->command)->flags && CMD_IS_DELETED) { /* * Something has already started the command deletion process. We can * go ahead and clean up the the namespace, @@ -1178,9 +1070,7 @@ ObjectNamespaceDeleted( * as well. */ Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command); - finished = 1; } - oPtr->command = NULL; if (oPtr->myCommand) { Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->myCommand); @@ -1191,14 +1081,13 @@ ObjectNamespaceDeleted( * methods on the object. */ - if (!IsRootObject(oPtr) && !(oPtr->flags & CLASS_GONE)) { - TclOORemoveFromInstances(oPtr, oPtr->selfCls); - } + /* To do: Get dkf to weigh in on wether this should be protected with a + * !IsRoot() condition. + */ + TclOORemoveFromInstances(oPtr, oPtr->selfCls); FOREACH(mixinPtr, oPtr->mixins) { - if (mixinPtr && mixinPtr != oPtr->classPtr) { - TclOORemoveFromInstances(oPtr, mixinPtr); - } + i -= TclOORemoveFromInstances(oPtr, mixinPtr); } if (i) { ckfree(oPtr->mixins.list); @@ -1258,8 +1147,9 @@ ObjectNamespaceDeleted( * classes, if one goes the other must too and yet the tangle can * sometimes not go away automatically; we force it here. [Bug 2962664] */ - if (!Tcl_InterpDeleted(interp) && IsRootObject(oPtr) - && !Deleted(fPtr->classCls->thisPtr)) { + if (IsRootObject(oPtr) && !Deleted(fPtr->classCls->thisPtr) + && !Tcl_InterpDeleted(interp)) { + Tcl_DeleteCommandFromToken(interp, fPtr->classCls->thisPtr->command); } @@ -1267,35 +1157,59 @@ ObjectNamespaceDeleted( ReleaseClassContents(interp, oPtr); } - /* * Delete the object structure itself. */ - oPtr->classPtr = NULL; oPtr->namespacePtr = NULL; - - DelRef(fPtr->classCls->thisPtr); - DelRef(fPtr->objectCls->thisPtr); - DelRef(fPtr->classCls); - DelRef(fPtr->objectCls); - if (finished) { - /* - * ObjectRenamedTrace called us, and not the other way around. - */ - DelRef(oPtr); - } else { - /* - * ObjectRenamedTrace will call DelRef(oPtr). - */ - } + oPtr->selfCls = NULL; + TclOODecrRefCount(oPtr); return; - } /* * ---------------------------------------------------------------------- * + * TclOODecrRef -- + * + * Decrement the refcount of an object and deallocate storage then object + * is no longer referenced. Returns 1 if storage was deallocated, and 0 + * otherwise. + * + * ---------------------------------------------------------------------- + */ +int TclOODecrRefCount(Object *oPtr) { + if (oPtr->refCount-- <= 1) { + Class *clsPtr = oPtr->classPtr; + if (oPtr->classPtr != NULL) { + ckfree(clsPtr->superclasses.list); + ckfree(clsPtr->subclasses.list); + ckfree(clsPtr->instances.list); + ckfree(clsPtr->mixinSubs.list); + ckfree(clsPtr->mixins.list); + ckfree(oPtr->classPtr); + } + ckfree(oPtr); + return 1; + } + return 0; +} + +/* setting the "empty" location to NULL makes debugging a little easier */ +#define REMOVEBODY { \ + for (; idx < num - 1; idx++) { \ + list[idx] = list[idx+1]; \ + } \ + list[idx] = NULL; \ + return; \ +} +void RemoveClass(Class **list, int num, int idx) REMOVEBODY + +void RemoveObject(Object **list, int num, int idx) REMOVEBODY + +/* + * ---------------------------------------------------------------------- + * * TclOORemoveFromInstances -- * * Utility function to remove an object from the list of instances within @@ -1304,36 +1218,27 @@ ObjectNamespaceDeleted( * ---------------------------------------------------------------------- */ -void +int TclOORemoveFromInstances( Object *oPtr, /* The instance to remove. */ Class *clsPtr) /* The class (possibly) containing the * reference to the instance. */ { - int i; + int i, res = 0; Object *instPtr; + if (Deleted(clsPtr->thisPtr)) { + return res; + } FOREACH(instPtr, clsPtr->instances) { if (oPtr == instPtr) { - goto removeInstance; - } - } - return; - - removeInstance: - if (Deleted(clsPtr->thisPtr)) { - if (!IsRootClass(clsPtr)) { - DelRef(clsPtr->instances.list[i]); - } - clsPtr->instances.list[i] = NULL; - } else { - clsPtr->instances.num--; - if (i < clsPtr->instances.num) { - clsPtr->instances.list[i] = - clsPtr->instances.list[clsPtr->instances.num]; + RemoveItem(Object, clsPtr->instances, i); + TclOODecrRefCount(oPtr); + res++; + break; } - clsPtr->instances.list[clsPtr->instances.num] = NULL; } + return res; } /* @@ -1354,9 +1259,6 @@ TclOOAddToInstances( * assumed that the class is not already * present as an instance in the class. */ { - if (Deleted(clsPtr->thisPtr)) { - return; - } if (clsPtr->instances.num >= clsPtr->instances.size) { clsPtr->instances.size += ALLOC_CHUNK; if (clsPtr->instances.size == ALLOC_CHUNK) { @@ -1367,6 +1269,7 @@ TclOOAddToInstances( } } clsPtr->instances.list[clsPtr->instances.num++] = oPtr; + AddRef(oPtr); } /* @@ -1375,36 +1278,31 @@ TclOOAddToInstances( * TclOORemoveFromSubclasses -- * * Utility function to remove a class from the list of subclasses within - * another class. + * another class. Returns the number of removals performed. * * ---------------------------------------------------------------------- */ -void +int TclOORemoveFromSubclasses( Class *subPtr, /* The subclass to remove. */ Class *superPtr) /* The superclass to possibly remove the * subclass reference from. */ { - int i; + int i, res = 0; Class *subclsPtr; + if (Deleted(superPtr->thisPtr)) { + return res; + } FOREACH(subclsPtr, superPtr->subclasses) { if (subPtr == subclsPtr) { - goto removeSubclass; - } - } - return; - - removeSubclass: - if (!Deleted(superPtr->thisPtr)) { - superPtr->subclasses.num--; - if (i < superPtr->subclasses.num) { - superPtr->subclasses.list[i] = - superPtr->subclasses.list[superPtr->subclasses.num]; + RemoveItem(Class, superPtr->subclasses, i); + TclOODecrRefCount(subPtr->thisPtr); + res++; } - superPtr->subclasses.list[superPtr->subclasses.num] = NULL; } + return res; } /* @@ -1431,13 +1329,13 @@ TclOOAddToSubclasses( if (superPtr->subclasses.num >= superPtr->subclasses.size) { superPtr->subclasses.size += ALLOC_CHUNK; if (superPtr->subclasses.size == ALLOC_CHUNK) { - superPtr->subclasses.list = ckalloc(sizeof(Class*) * ALLOC_CHUNK); + superPtr->subclasses.list = ckalloc(sizeof(Class *) * ALLOC_CHUNK); } else { - superPtr->subclasses.list = ckrealloc(superPtr->subclasses.list, - sizeof(Class *) * superPtr->subclasses.size); + superPtr->subclasses.list = ckrealloc(superPtr->subclasses.list, sizeof(Class *) * superPtr->subclasses.size); } } superPtr->subclasses.list[superPtr->subclasses.num++] = subPtr; + AddRef(subPtr->thisPtr); } /* @@ -1451,31 +1349,28 @@ TclOOAddToSubclasses( * ---------------------------------------------------------------------- */ -void +int TclOORemoveFromMixinSubs( Class *subPtr, /* The subclass to remove. */ Class *superPtr) /* The superclass to possibly remove the * subclass reference from. */ { - int i; + int i, res = 0; Class *subclsPtr; - FOREACH(subclsPtr, superPtr->mixinSubs) { - if (subPtr == subclsPtr) { - goto removeSubclass; - } + if (Deleted(superPtr->thisPtr)) { + return res; } - return; - removeSubclass: - if (!Deleted(superPtr->thisPtr)) { - superPtr->mixinSubs.num--; - if (i < superPtr->mixinSubs.num) { - superPtr->mixinSubs.list[i] = - superPtr->mixinSubs.list[superPtr->mixinSubs.num]; + FOREACH(subclsPtr, superPtr->mixinSubs) { + if (subPtr == subclsPtr) { + RemoveItem(Class, superPtr->mixinSubs, i); + TclOODecrRefCount(subPtr->thisPtr); + res++; + break; } - superPtr->mixinSubs.list[superPtr->mixinSubs.num] = NULL; } + return res; } /* @@ -1509,6 +1404,7 @@ TclOOAddToMixinSubs( } } superPtr->mixinSubs.list[superPtr->mixinSubs.num++] = subPtr; + AddRef(subPtr->thisPtr); } /* @@ -1516,7 +1412,7 @@ TclOOAddToMixinSubs( * * AllocClass -- * - * Allocate a basic class. Does not splice the class object into its + * Allocate a basic class. Does not add class to its * class's instance list. * * ---------------------------------------------------------------------- @@ -1527,44 +1423,18 @@ AllocClass( Tcl_Interp *interp, /* Interpreter within which to allocate the * class. */ Object *useThisObj) /* Object that is to act as the class - * representation, or NULL if a new object - * with automatic name is to be used. */ + * representation. */ { Foundation *fPtr = GetFoundation(interp); Class *clsPtr = ckalloc(sizeof(Class)); - /* - * Make an object if we haven't been given one. - */ - memset(clsPtr, 0, sizeof(Class)); - if (useThisObj == NULL) { - clsPtr->thisPtr = AllocObject(interp, NULL, NULL, NULL); - } else { - clsPtr->thisPtr = useThisObj; - } + clsPtr->thisPtr = useThisObj; /* * Configure the namespace path for the class's object. */ - - if (fPtr->helpersNs != NULL) { - Tcl_Namespace *path[2]; - - path[0] = fPtr->helpersNs; - path[1] = fPtr->ooNs; - TclSetNsPath((Namespace *) clsPtr->thisPtr->namespacePtr, 2, path); - } else { - TclSetNsPath((Namespace *) clsPtr->thisPtr->namespacePtr, 1, - &fPtr->ooNs); - } - - /* - * Class objects inherit from the class of classes unless they inherit - * from some subclass of it. Enforce this right now. - */ - - clsPtr->thisPtr->selfCls = fPtr->classCls; + initClassPath(interp, clsPtr); /* * Classes are subclasses of oo::object, i.e. the objects they create are @@ -1574,6 +1444,7 @@ AllocClass( clsPtr->superclasses.num = 1; clsPtr->superclasses.list = ckalloc(sizeof(Class *)); clsPtr->superclasses.list[0] = fPtr->objectCls; + AddRef(fPtr->objectCls->thisPtr); /* * Finish connecting the class structure to the object structure. @@ -1586,10 +1457,22 @@ AllocClass( * fields. */ - clsPtr->refCount = 1; Tcl_InitObjHashTable(&clsPtr->classMethods); return clsPtr; } +static void +initClassPath(Tcl_Interp *interp, Class *clsPtr) { + Foundation *fPtr = GetFoundation(interp); + if (fPtr->helpersNs != NULL) { + Tcl_Namespace *path[2]; + path[0] = fPtr->helpersNs; + path[1] = fPtr->ooNs; + TclSetNsPath((Namespace *) clsPtr->thisPtr->namespacePtr, 2, path); + } else { + TclSetNsPath((Namespace *) clsPtr->thisPtr->namespacePtr, 1, + &fPtr->ooNs); + } +} /* * ---------------------------------------------------------------------- @@ -1640,7 +1523,7 @@ Tcl_NewObjectInstance( contextPtr->skip = skip; /* - * Adjust the ensmble tracking record if necessary. [Bug 3514761] + * Adjust the ensemble tracking record if necessary. [Bug 3514761] */ isRoot = TclInitRewriteEnsemble(interp, skip, skip, objv); @@ -1656,7 +1539,6 @@ Tcl_NewObjectInstance( clientData[2] = state; clientData[3] = &oPtr; - AddRef(oPtr); result = FinalizeAlloc(clientData, interp, result); if (result != TCL_OK) { return NULL; @@ -1723,7 +1605,6 @@ TclNRNewObjectInstance( * Fire off the constructors non-recursively. */ - AddRef(oPtr); TclNRAddCallback(interp, FinalizeAlloc, contextPtr, oPtr, state, objectPtr); TclPushTailcallPoint(interp); @@ -1771,18 +1652,9 @@ TclNewObjectInstanceCommon( * Create the object. */ - /* - * The command for the object could have the same name as the command - * associated with classPtr, so protect the structure from deallocation - * here. - */ - AddRef(classPtr); - oPtr = AllocObject(interp, simpleName, nsPtr, nsNameStr); - DelRef(classPtr); oPtr->selfCls = classPtr; TclOOAddToInstances(oPtr, classPtr); - /* * Check to see if we're really creating a class. If so, allocate the * class structure as well. @@ -1797,7 +1669,6 @@ TclNewObjectInstanceCommon( */ AllocClass(interp, oPtr); - oPtr->selfCls = classPtr; TclOOAddToSubclasses(oPtr->classPtr, fPtr->objectCls); } else { oPtr->classPtr = NULL; @@ -1829,7 +1700,6 @@ FinalizeAlloc( Tcl_SetErrorCode(interp, "TCL", "OO", "STILLBORN", NULL); result = TCL_ERROR; } - TclOODeleteContext(contextPtr); if (result != TCL_OK) { Tcl_DiscardInterpState(state); @@ -1843,12 +1713,14 @@ FinalizeAlloc( (void) TclOOObjectName(interp, oPtr); Tcl_DeleteCommandFromToken(interp, oPtr->command); } - DelRef(oPtr); + /* This decrements the refcount of oPtr */ + TclOODeleteContext(contextPtr); return TCL_ERROR; } Tcl_RestoreInterpState(interp, state); *objectPtr = (Tcl_Object) oPtr; - DelRef(oPtr); + /* This decrements the refcount of oPtr */ + TclOODeleteContext(contextPtr); return TCL_OK; } @@ -1956,8 +1828,7 @@ Tcl_CopyObjectInstance( */ o2Ptr->flags = oPtr->flags & ~( - OBJECT_DELETED | ROOT_OBJECT | ROOT_CLASS | FILTER_HANDLING); - + OBJECT_DELETED | ROOT_OBJECT | ROOT_CLASS | FILTER_HANDLING); /* * Copy the object's metadata. */ @@ -2969,7 +2840,7 @@ int Tcl_ObjectDeleted( Tcl_Object object) { - return Deleted(object) ? 1 : 0; + return Deleted((Object *)object) ? 1 : 0; } Tcl_Object diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index b2c06a7..84f414d 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -340,11 +340,6 @@ TclOO_Object_Destroy( Object *oPtr = (Object *) Tcl_ObjectContextObject(context); CallContext *contextPtr; - if (objc != Tcl_ObjectContextSkippedArgs(context)) { - Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, - NULL); - return TCL_ERROR; - } if (!(oPtr->flags & DESTRUCTOR_CALLED)) { oPtr->flags |= DESTRUCTOR_CALLED; contextPtr = TclOOGetCallContext(oPtr, NULL, DESTRUCTOR, NULL); diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index d4e1e34..c71425b 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -110,7 +110,8 @@ TclOODeleteContext( TclOODeleteChain(contextPtr->callPtr); if (oPtr != NULL) { TclStackFree(oPtr->fPtr->interp, contextPtr); - DelRef(oPtr); + /* Corresponding AddRef() in TclOO.c/TclOOObjectCmdCore */ + TclOODecrRefCount(oPtr); } } @@ -1171,6 +1172,7 @@ TclOOGetCallContext( returnContext: contextPtr = TclStackAlloc(oPtr->fPtr->interp, sizeof(CallContext)); contextPtr->oPtr = oPtr; + /* Corresponding TclOODecrRefCount() in TclOODeleteContext */ AddRef(oPtr); contextPtr->callPtr = callPtr; contextPtr->skip = 2; diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index b0bfd9c..7f3ea18 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -326,9 +326,7 @@ TclOOObjectSetMixins( if (numMixins == 0) { if (oPtr->mixins.num != 0) { FOREACH(mixinPtr, oPtr->mixins) { - if (mixinPtr) { - TclOORemoveFromInstances(oPtr, mixinPtr); - } + TclOORemoveFromInstances(oPtr, mixinPtr); } ckfree(oPtr->mixins.list); oPtr->mixins.num = 0; @@ -352,6 +350,10 @@ TclOOObjectSetMixins( FOREACH(mixinPtr, oPtr->mixins) { if (mixinPtr != oPtr->selfCls) { TclOOAddToInstances(oPtr, mixinPtr); + /* Corresponding TclOODecrRefCount() is in the caller of this + * function. + */ + TclOODecrRefCount(mixinPtr->thisPtr); } } } @@ -399,6 +401,10 @@ TclOOClassSetMixins( memcpy(classPtr->mixins.list, mixins, sizeof(Class *) * numMixins); FOREACH(mixinPtr, classPtr->mixins) { TclOOAddToMixinSubs(classPtr, mixinPtr); + /* Corresponding TclOODecrRefCount() is in the caller of this + * function + */ + TclOODecrRefCount(mixinPtr->thisPtr); } } BumpGlobalEpoch(interp, classPtr); @@ -914,7 +920,7 @@ TclOODefineObjCmd( } else { result = MagicDefinitionInvoke(interp, fPtr->defineNs, 2, objc, objv); } - DelRef(oPtr); + TclOODecrRefCount(oPtr); /* * Restore the previous "current" namespace. @@ -981,7 +987,7 @@ TclOOObjDefObjCmd( } else { result = MagicDefinitionInvoke(interp, fPtr->objdefNs, 2, objc, objv); } - DelRef(oPtr); + TclOODecrRefCount(oPtr); /* * Restore the previous "current" namespace. @@ -1048,7 +1054,7 @@ TclOODefineSelfObjCmd( } else { result = MagicDefinitionInvoke(interp, fPtr->objdefNs, 1, objc, objv); } - DelRef(oPtr); + TclOODecrRefCount(oPtr); /* * Restore the previous "current" namespace. @@ -1168,11 +1174,11 @@ TclOODefineClassObjCmd( if (oPtr->selfCls != clsPtr) { TclOORemoveFromInstances(oPtr, oPtr->selfCls); + + /* Reference count already incremented 3 lines up. */ oPtr->selfCls = clsPtr; + TclOOAddToInstances(oPtr, oPtr->selfCls); - if (!(clsPtr->thisPtr->flags & OBJECT_DELETED)) { - oPtr->flags &= ~CLASS_GONE; - } if (oPtr->classPtr != NULL) { BumpGlobalEpoch(interp, oPtr->classPtr); } else { @@ -1628,6 +1634,10 @@ TclOODefineMixinObjCmd( goto freeAndError; } mixins[i-1] = clsPtr; + /* Corresponding TclOODecrRefCount() is in TclOOObjectSetMixins, + * TclOOClassSetMixinsk, or just below if this function fails. + */ + AddRef(mixins[i-1]->thisPtr); } if (isInstanceMixin) { @@ -1640,6 +1650,9 @@ TclOODefineMixinObjCmd( return TCL_OK; freeAndError: + while (--i > 0) { + TclOODecrRefCount(mixins[i]->thisPtr); + } TclStackFree(interp, mixins); return TCL_ERROR; } @@ -2055,6 +2068,7 @@ ClassMixinSet( mixins[i] = GetClassInOuterContext(interp, mixinv[i], "may only mix in classes"); if (mixins[i] == NULL) { + i--; goto freeAndError; } if (TclOOIsReachable(oPtr->classPtr, mixins[i])) { @@ -2063,6 +2077,10 @@ ClassMixinSet( Tcl_SetErrorCode(interp, "TCL", "OO", "SELF_MIXIN", NULL); goto freeAndError; } + /* Corresponding TclOODecrRefCount() is in TclOOClassSetMixins, or just + * below if this function fails + */ + AddRef(mixins[i]->thisPtr); } TclOOClassSetMixins(interp, oPtr->classPtr, mixinc, mixins); @@ -2070,6 +2088,9 @@ ClassMixinSet( return TCL_OK; freeAndError: + while (i-- > 0) { + TclOODecrRefCount(mixins[i]->thisPtr); + } TclStackFree(interp, mixins); return TCL_ERROR; } @@ -2172,16 +2193,20 @@ ClassSuperSet( if (superc == 0) { superclasses = ckrealloc(superclasses, sizeof(Class *)); - superclasses[0] = oPtr->fPtr->objectCls; - superc = 1; if (TclOOIsReachable(oPtr->fPtr->classCls, oPtr->classPtr)) { superclasses[0] = oPtr->fPtr->classCls; + } else { + superclasses[0] = oPtr->fPtr->objectCls; } + superc = 1; + /* Corresponding TclOODecrRefCount is near the end of this function */ + AddRef(superclasses[0]->thisPtr); } else { for (i=0 ; i 0; i--) { + TclOODecrRefCount(superclasses[i]->thisPtr); + } ckfree(superclasses); return TCL_ERROR; } + /* Corresponding TclOODecrRefCount() is near the end of this + * function */ + AddRef(superclasses[i]->thisPtr); } } @@ -2221,6 +2252,8 @@ ClassSuperSet( oPtr->classPtr->superclasses.num = superc; FOREACH(superPtr, oPtr->classPtr->superclasses) { TclOOAddToSubclasses(oPtr->classPtr, superPtr); + /* To account for the AddRef() earlier in this function */ + TclOODecrRefCount(superPtr->thisPtr); } BumpGlobalEpoch(interp, oPtr->classPtr); @@ -2511,9 +2544,16 @@ ObjMixinSet( mixins[i] = GetClassInOuterContext(interp, mixinv[i], "may only mix in classes"); if (mixins[i] == NULL) { + while (i-- > 0) { + TclOODecrRefCount(mixins[i]->thisPtr); + } TclStackFree(interp, mixins); return TCL_ERROR; } + /* Corresponding TclOODecrRefCount() is in TclOOObjectSetMixins() or + * just above if this function fails. + */ + AddRef(mixins[i]->thisPtr); } TclOOObjectSetMixins(oPtr, mixinc, mixins); diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index 83b4d58..084c026 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -193,9 +193,10 @@ typedef struct Object { * destroyed. */ #define DESTRUCTOR_CALLED 2 /* Flag to say that the destructor has been * called. */ -#define CLASS_GONE 4 /* Indicates that the class of this object has - * been deleted, and so the object should not - * attempt to remove itself from its class. */ +#define CLASS_GONE 4 /* Obsolete. Indicates that the class of this + * object has been deleted, and so the object + * should not attempt to remove itself from its + * class. */ #define ROOT_OBJECT 0x1000 /* Flag to say that this object is the root of * the class hierarchy and should be treated * specially during teardown. */ @@ -222,10 +223,6 @@ typedef struct Object { typedef struct Class { Object *thisPtr; /* Reference to the object associated with * this class. */ - int refCount; /* Number of strong references to this class. - * Weak references are not counted; the - * purpose of this is to avoid Tcl_Preserve as - * that is quite slow. */ int flags; /* Assorted flags. */ LIST_STATIC(struct Class *) superclasses; /* List of superclasses, used for generation @@ -499,6 +496,7 @@ MODULE_SCOPE Object * TclNewObjectInstanceCommon(Tcl_Interp *interp, Class *classPtr, const char *nameStr, const char *nsNameStr); +MODULE_SCOPE int TclOODecrRefCount(Object *oPtr); MODULE_SCOPE int TclOODefineSlots(Foundation *fPtr); MODULE_SCOPE void TclOODeleteChain(CallChain *callPtr); MODULE_SCOPE void TclOODeleteChainCache(Tcl_HashTable *tablePtr); @@ -528,10 +526,10 @@ MODULE_SCOPE int TclNRObjectContextInvokeNext(Tcl_Interp *interp, MODULE_SCOPE void TclOONewBasicMethod(Tcl_Interp *interp, Class *clsPtr, const DeclaredClassMethod *dcm); MODULE_SCOPE Tcl_Obj * TclOOObjectName(Tcl_Interp *interp, Object *oPtr); -MODULE_SCOPE void TclOORemoveFromInstances(Object *oPtr, Class *clsPtr); -MODULE_SCOPE void TclOORemoveFromMixinSubs(Class *subPtr, +MODULE_SCOPE int TclOORemoveFromInstances(Object *oPtr, Class *clsPtr); +MODULE_SCOPE int TclOORemoveFromMixinSubs(Class *subPtr, Class *mixinPtr); -MODULE_SCOPE void TclOORemoveFromSubclasses(Class *subPtr, +MODULE_SCOPE int TclOORemoveFromSubclasses(Class *subPtr, Class *superPtr); MODULE_SCOPE Tcl_Obj * TclOORenderCallChain(Tcl_Interp *interp, CallChain *callPtr); @@ -546,18 +544,21 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr); #include "tclOOIntDecls.h" /* + * Alternatives to Tcl_Preserve/Tcl_EventuallyFree/Tcl_Release. + */ + +#define AddRef(ptr) ((ptr)->refCount++) + +/* * A convenience macro for iterating through the lists used in the internal - * memory management of objects. This is a bit gnarly because we want to do - * the assignment of the picked-out value only when the body test succeeds, - * but we cannot rely on the assigned value being useful, forcing us to do - * some nasty stuff with the comma operator. The compiler's optimizer should - * be able to sort it all out! - * + * memory management of objects. * REQUIRES DECLARATION: int i; */ #define FOREACH(var,ary) \ - for(i=0 ; (i<(ary).num?((var=(ary).list[i]),1):0) ; i++) + for(i=0 ; i<(ary).num; i++) if ((ary).list[i] == NULL) { \ + continue; \ + } else if (var = (ary).list[i], 1) /* * Convenience macros for iterating through hash tables. FOREACH_HASH_DECLS @@ -592,17 +593,6 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr); } \ } while(0) -/* - * Alternatives to Tcl_Preserve/Tcl_EventuallyFree/Tcl_Release. - */ - -#define AddRef(ptr) ((ptr)->refCount++) -#define DelRef(ptr) do { \ - if ((ptr)->refCount-- <= 1) { \ - ckfree(ptr); \ - } \ - } while(0) - #endif /* TCL_OO_INTERNAL_H */ /* diff --git a/tests/oo.test b/tests/oo.test index b9c5067..3be5f79 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -47,7 +47,7 @@ test oo-0.2 {basic test of OO's ability to clean up its initial state} { } {} test oo-0.3 {basic test of OO's ability to clean up its initial state} -body { leaktest { - [oo::object new] destroy + [oo::object new] destroy } } -constraints memory -result 0 test oo-0.4 {basic test of OO's ability to clean up its initial state} -body { @@ -131,6 +131,10 @@ test oo-1.4 {basic test of OO functionality} -body { test oo-1.4.1 {fully-qualified nested name} -body { oo::object create ::one::two::three } -result {::one::two::three} +test oo-1.4.2 {automatic command name has same name as namespace} -body { + set obj [oo::object new] + expr {[info object namespace $obj] == $obj} +} -result 1 test oo-1.5 {basic test of OO functionality} -body { oo::object doesnotexist } -returnCodes 1 -result {unknown method "doesnotexist": must be create, destroy or new} @@ -1514,9 +1518,9 @@ test oo-11.6 { # No segmentation fault return done -} -cleanup { +} -result done -cleanup { rename obj1 {} -} -result done +} test oo-12.1 {OO: filters} { oo::class create Aclass @@ -3891,9 +3895,6 @@ test oo-35.6 { rename obj {} } -result done - - - test oo-36.1 {TIP #470: introspection within oo::define} { oo::define oo::object self } ::oo::object -- cgit v0.12 From bf868c1c56292a44ff5faeef5b348408554cab1a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 11 Dec 2017 14:19:48 +0000 Subject: Initial implementation of TIP #491. Not tested yet. --- generic/tcl.h | 4 ++++ generic/tclInt.h | 4 ++++ unix/configure.ac | 6 ------ win/configure.ac | 6 ------ win/rules.vc | 43 ++++--------------------------------------- win/tcl.rc | 8 +------- win/tclsh.rc | 8 +------- 7 files changed, 14 insertions(+), 65 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index a6a8c94..b7d4e90 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -91,6 +91,10 @@ extern "C" { #endif #endif /* !TCL_NO_DEPRECATED */ +#ifndef TCL_THREADS +# define TCL_THREADS 1 +#endif + /* * A special definition used to allow this header file to be included from * windows resource files so that they can obtain version information. diff --git a/generic/tclInt.h b/generic/tclInt.h index ad1d9c6..1fd252f 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4149,6 +4149,10 @@ typedef const char *TclDTraceStr; } \ } +#if TCL_THREADS && !defined(USE_THREAD_ALLOC) +# define USE_THREAD_ALLOC 1 +#endif + #if defined(PURIFY) /* diff --git a/unix/configure.ac b/unix/configure.ac index e14d85e..5b982e8 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -120,12 +120,6 @@ if test -z "$no_pipe" && test -n "$GCC"; then fi #------------------------------------------------------------------------ -# Threads support -#------------------------------------------------------------------------ - -SC_ENABLE_THREADS - -#------------------------------------------------------------------------ # Embedded configuration information, encoding to use for the values, TIP #59 #------------------------------------------------------------------------ diff --git a/win/configure.ac b/win/configure.ac index d03695c..179f151 100644 --- a/win/configure.ac +++ b/win/configure.ac @@ -78,12 +78,6 @@ AC_PROG_MAKE_SET AC_OBJEXT AC_EXEEXT -#-------------------------------------------------------------------- -# Check whether --enable-threads or --disable-threads was given. -#-------------------------------------------------------------------- - -SC_ENABLE_THREADS - #------------------------------------------------------------------------ # Embedded configuration information, encoding to use for the values, TIP #59 #------------------------------------------------------------------------ diff --git a/win/rules.vc b/win/rules.vc index 9b917b6..890618c 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -626,7 +626,6 @@ LINKERFLAGS = $(LINKERFLAGS) -ltcg # The following macros are defined by this section based on OPTS # STATIC_BUILD - 0 -> Tcl is to be built as a shared library # 1 -> build as a static library and shell -# TCL_THREADS - legacy but always 1 on Windows since winsock requires it. # DEBUG - 1 -> debug build, 0 -> release builds # SYMBOLS - 1 -> generate PDB's, 0 -> no PDB's # PROFILE - 1 -> generate profiling info, 0 -> no profiling @@ -648,7 +647,6 @@ LINKERFLAGS = $(LINKERFLAGS) -ltcg # Default values for all the above STATIC_BUILD = 0 -TCL_THREADS = 1 DEBUG = 0 SYMBOLS = 0 PROFILE = 0 @@ -703,15 +701,6 @@ TCL_USE_STATIC_PACKAGES = 1 TCL_USE_STATIC_PACKAGES = 0 !endif -!if [nmakehlp -f $(OPTS) "nothreads"] -!message *** Compile explicitly for non-threaded tcl -TCL_THREADS = 0 -USE_THREAD_ALLOC= 0 -!else -TCL_THREADS = 1 -USE_THREAD_ALLOC= 1 -!endif - !if [nmakehlp -f $(OPTS) "symbols"] !message *** Doing symbols DEBUG = 1 @@ -747,12 +736,6 @@ PGO = 0 !message *** Warning: ignoring option "loimpact" - deprecated on modern Windows. !endif -# TBD - should get rid of this option -!if [nmakehlp -f $(OPTS) "thrdalloc"] -!message *** Doing thrdalloc -USE_THREAD_ALLOC = 1 -!endif - !if [nmakehlp -f $(OPTS) "tclalloc"] USE_THREAD_ALLOC = 0 !endif @@ -943,7 +926,6 @@ VERSION = $(DOTVERSION:.=) # different compilers, build configurations etc., # # Naming convention (suffixes): -# t = full thread support. # s = static library (as opposed to an import library) # g = linked to the debug enabled C run-time. # x = special static build when it links to the dynamic C run-time. @@ -965,7 +947,7 @@ VERSION = $(DOTVERSION:.=) # PRJSTUBLIB - output path of the generated project stubs library # RESFILE - output resource file (only if not static build) -SUFX = tsgx +SUFX = sgx !if $(DEBUG) BUILDDIRTOP = Debug @@ -984,7 +966,7 @@ BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER) SUFX = $(SUFX:g=) !endif -TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX +TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_DynamicStaticX !if !$(STATIC_BUILD) TMP_DIRFULL = $(TMP_DIRFULL:Static=) @@ -1001,11 +983,6 @@ SUFX = $(SUFX:x=) !endif !endif -!if !$(TCL_THREADS) -TMP_DIRFULL = $(TMP_DIRFULL:Threaded=) -SUFX = $(SUFX:t=) -!endif - !ifndef TMP_DIR TMP_DIR = $(TMP_DIRFULL) !ifndef OUT_DIR @@ -1049,9 +1026,6 @@ TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" !if $(TCLINSTALL) # Building against an installed Tcl TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe -!if !exist("$(TCLSH)") && $(TCL_THREADS) -TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe -!endif TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib TCL_LIBRARY = $(_TCLDIR)\lib @@ -1063,9 +1037,6 @@ TCL_INCLUDES = -I"$(_TCLDIR)\include" !else # Building against Tcl sources TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe -!if !exist($(TCLSH)) && $(TCL_THREADS) -TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe -!endif TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib TCL_LIBRARY = $(_TCLDIR)\library @@ -1205,11 +1176,8 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG !if $(TCL_COMPILE_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS !endif -!if $(TCL_THREADS) -OPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1 -!if $(USE_THREAD_ALLOC) -OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 -!endif +!if $(USE_THREAD_ALLOC)==0 +OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=0 !endif !if $(STATIC_BUILD) OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD @@ -1662,9 +1630,6 @@ TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake" !if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)" !error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)). !endif -!if defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC) -!message WARNING: Value of USE_THREAD_ALLOC ($(USE_THREAD_ALLOC)) does not match its Tcl core value ($(CORE_USE_THREAD_ALLOC)). -!endif !if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG) !message WARNING: Value of DEBUG ($(DEBUG)) does not match its Tcl library configuration ($(DEBUG)). !endif diff --git a/win/tcl.rc b/win/tcl.rc index be5e0a7..477512d 100644 --- a/win/tcl.rc +++ b/win/tcl.rc @@ -7,19 +7,13 @@ // // build-up the name suffix that defines the type of build this is. // -#if TCL_THREADS -#define SUFFIX_THREADS "t" -#else -#define SUFFIX_THREADS "" -#endif - #if DEBUG && !UNCHECKED #define SUFFIX_DEBUG "g" #else #define SUFFIX_DEBUG "" #endif -#define SUFFIX SUFFIX_THREADS SUFFIX_DEBUG +#define SUFFIX SUFFIX_DEBUG LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */ diff --git a/win/tclsh.rc b/win/tclsh.rc index 161da50..bd1a4da 100644 --- a/win/tclsh.rc +++ b/win/tclsh.rc @@ -8,12 +8,6 @@ // // build-up the name suffix that defines the type of build this is. // -#if TCL_THREADS -#define SUFFIX_THREADS "t" -#else -#define SUFFIX_THREADS "" -#endif - #if STATIC_BUILD #define SUFFIX_STATIC "s" #else @@ -26,7 +20,7 @@ #define SUFFIX_DEBUG "" #endif -#define SUFFIX SUFFIX_THREADS SUFFIX_STATIC SUFFIX_DEBUG +#define SUFFIX SUFFIX_STATIC SUFFIX_DEBUG LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */ -- cgit v0.12 From c220b0dcfab61bd6f1d633d56dafd78171b3a457 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Mon, 11 Dec 2017 16:26:24 +0000 Subject: Allow standard targets to be selectively disabled. Automatic install for extension stubs and public headers if present. Print installation dir, remove useless partial print of preprocessor defines. --- win/rules.vc | 2 +- win/targets.vc | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 9b917b6..10bc26e 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1681,8 +1681,8 @@ TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake" !message *** Intermediate directory will be '$(TMP_DIR)' !message *** Output directory will be '$(OUT_DIR)' +!message *** Installation, if selected, will be in '$(_INSTALLDIR)' !message *** Suffix for binaries will be '$(SUFX)' -!message *** Optional defines are '$(OPTDEFINES)' !message *** Compiler version $(VCVER). Target machine is $(MACHINE) !message *** Host architecture is $(NATIVE_ARCH) diff --git a/win/targets.vc b/win/targets.vc index ca227d8..7f1d388 100644 --- a/win/targets.vc +++ b/win/targets.vc @@ -36,17 +36,63 @@ $(PRJLIB): $(PRJ_OBJS) $(RESFILE) -@del $*.exp !endif -!ifndef DISABLE_STANDARD_TARGETS +!if "$(PRJ_HEADERS)" != "" && "$(PRJ_OBJS)" != "" +$(PRJ_OBJS): $(PRJ_HEADERS) +!endif + +# If parent makefile has defined stub objects, add their installation +# to the default install +!if "$(PRJ_STUBOBJS)" != "" +default-install: default-install-stubs +!endif + +# Unlike the other default targets, these cannot be in rules.vc because +# the executed command depends on existence of macro PRJ_HEADERS_PUBLIC +# that the parent makefile will not define until after including rules-ext.vc +!if "$(PRJ_HEADERS_PUBLIC)" != "" +default-install: default-install-headers +default-install-headers: + @echo Installing headers to '$(INCLUDE_INSTALL_DIR)' + @for %f in ($(PRJ_HEADERS_PUBLIC)) do @$(COPY) %f "$(INCLUDE_INSTALL_DIR)" +!endif + +!if "$(DISABLE_STANDARD_TARGETS)" == "" DISABLE_STANDARD_TARGETS = 0 !endif +!if "$(DISABLE_TARGET_setup)" == "" +DISABLE_TARGET_setup = 0 +!endif +!if "$(DISABLE_TARGET_install)" == "" +DISABLE_TARGET_install = 0 +!endif +!if "$(DISABLE_TARGET_clean)" == "" +DISABLE_TARGET_clean = 0 +!endif +!if "$(DISABLE_TARGET_test)" == "" +DISABLE_TARGET_test = 0 +!endif +!if "$(DISABLE_TARGET_shell)" == "" +DISABLE_TARGET_shell = 0 +!endif + !if !$(DISABLE_STANDARD_TARGETS) +!if !$(DISABLE_TARGET_setup) setup: default-setup +!endif +!if !$(DISABLE_TARGET_install) install: default-install +!endif +!if !$(DISABLE_TARGET_clean) clean: default-clean realclean: hose hose: default-hose distclean: realclean default-distclean +!endif +!if !$(DISABLE_TARGET_test) test: default-test +!endif +!if !$(DISABLE_TARGET_shell) shell: default-shell !endif +!endif # DISABLE_STANDARD_TARGETS -- cgit v0.12 From 0239e7e77f3f12c24179f6c021d3f7b40dfcf981 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Mon, 11 Dec 2017 23:50:22 +0000 Subject: Add the check for wrong arguments back to TclOO_Object_Destroy, remove inadvertant increment of Namespace->refCount. --- generic/tclBasic.c | 1 - generic/tclOO.c | 4 +++- generic/tclOOBasic.c | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index a23100e..ce46cd4 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3153,7 +3153,6 @@ Tcl_DeleteCommandFromToken( cmdPtr->nsPtr->refCount++; - cmdPtr->nsPtr->refCount++; if (cmdPtr->tracePtr != NULL) { CommandTrace *tracePtr; CallCommandTraces(iPtr,cmdPtr,NULL,NULL,TCL_TRACE_DELETE); diff --git a/generic/tclOO.c b/generic/tclOO.c index ae1ae3f..1a9bfc4 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -236,8 +236,10 @@ MODULE_SCOPE const TclOOStubs tclOOStubs; #define IsRoot(ocPtr) ((ocPtr)->flags & (ROOT_OBJECT|ROOT_CLASS)) #define RemoveItem(type, lst, i) \ + do { \ Remove ## type ((lst).list, (lst).num, i); \ - (lst).num-- + (lst).num-- \ + } while 0 /* * ---------------------------------------------------------------------- diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index 84f414d..b2c06a7 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -340,6 +340,11 @@ TclOO_Object_Destroy( Object *oPtr = (Object *) Tcl_ObjectContextObject(context); CallContext *contextPtr; + if (objc != Tcl_ObjectContextSkippedArgs(context)) { + Tcl_WrongNumArgs(interp, Tcl_ObjectContextSkippedArgs(context), objv, + NULL); + return TCL_ERROR; + } if (!(oPtr->flags & DESTRUCTOR_CALLED)) { oPtr->flags |= DESTRUCTOR_CALLED; contextPtr = TclOOGetCallContext(oPtr, NULL, DESTRUCTOR, NULL); -- cgit v0.12 From 8c866ee6be6f90cf26e2a1001319046bc2cd1bd6 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 12 Dec 2017 17:32:21 +0000 Subject: Add -L option to nmakehlp to locate directories --- win/nmakehlp.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 1 deletion(-) diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 0439d1c..16d89a1 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -39,7 +39,6 @@ #endif - /* protos */ static int CheckForCompilerFeature(const char *option); @@ -47,6 +46,7 @@ static int CheckForLinkerFeature(const char **options, int count); static int IsIn(const char *string, const char *substring); static int SubstituteFile(const char *substs, const char *filename); static int QualifyPath(const char *path); +static int LocateDependency(const char *keyfile); static const char *GetVersionFromFile(const char *filename, const char *match, int numdots); static DWORD WINAPI ReadFromPipe(LPVOID args); @@ -172,6 +172,18 @@ main( return 2; } return QualifyPath(argv[2]); + + case 'L': + if (argc != 3) { + chars = snprintf(msg, sizeof(msg) - 1, + "usage: %s -L keypath\n" + "Emit the fully qualified path of directory containing keypath\n" + "exitcodes: 0 == success, 1 == not found, 2 == error\n", argv[0]); + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, + &dwWritten, NULL); + return 2; + } + return LocateDependency(argv[2]); } } chars = snprintf(msg, sizeof(msg) - 1, @@ -701,6 +713,93 @@ QualifyPath( } /* + * Implements LocateDependency for a single directory. See that command + * for an explanation. + * Returns 0 if found after printing the directory. + * Returns 1 if not found but no errors. + * Returns 2 on any kind of error + * Basically, these are used as exit codes for the process. + */ +static int LocateDependencyHelper(const char *dir, const char *keypath) +{ + HANDLE hSearch; + char path[MAX_PATH+1]; + int dirlen, keylen, ret; + WIN32_FIND_DATA finfo; + + if (dir == NULL || keypath == NULL) + return 2; /* Have no real error reporting mechanism into nmake */ + dirlen = strlen(dir); + if ((dirlen + 3) > sizeof(path)) + return 2; + strncpy(path, dir, dirlen); + strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */ + keylen = strlen(keypath); + +#if 0 /* This function is not available in Visual C++ 6 */ + /* + * Use numerics 0 -> FindExInfoStandard, + * 1 -> FindExSearchLimitToDirectories, + * as these are not defined in Visual C++ 6 + */ + hSearch = FindFirstFileEx(path, 0, &finfo, 1, NULL, 0); +#else + hSearch = FindFirstFile(path, &finfo); +#endif + if (hSearch == INVALID_HANDLE_VALUE) + return 1; /* Not found */ + + /* Loop through all subdirs checking if the keypath is under there */ + ret = 1; /* Assume not found */ + do { + int sublen; + /* + * We need to check it is a directory despite the + * FindExSearchLimitToDirectories in the above call. See SDK docs + */ + if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) + continue; + sublen = strlen(finfo.cFileName); + if ((dirlen+1+sublen+1+keylen+1) > sizeof(path)) + continue; /* Path does not fit, assume not matched */ + strncpy(path+dirlen+1, finfo.cFileName, sublen); + path[dirlen+1+sublen] = '\\'; + strncpy(path+dirlen+1+sublen+1, keypath, keylen+1); + if (PathFileExists(path)) { + /* Found a match, print to stdout */ + path[dirlen+1+sublen] = '\0'; + QualifyPath(path); + ret = 0; + break; + } + } while (FindNextFile(hSearch, &finfo)); + FindClose(hSearch); + return ret; +} + +/* + * LocateDependency -- + * + * Locates a dependency for a package. + * keypath - a relative path within the package directory + * that is used to confirm it is the correct directory. + * The search path for the package directory is currently only + * the parent and grandparent of the current working directory. + * If found, the command prints + * name_DIRPATH= + * and returns 0. If not found, does not print anything and returns 1. + */ +static int LocateDependency(const char *keypath) +{ + int ret; + ret = LocateDependencyHelper("..", keypath); + if (ret != 0) + ret = LocateDependencyHelper("..\\..", keypath); + return ret; +} + + +/* * Local variables: * mode: c * c-basic-offset: 4 -- cgit v0.12 From 48549d55b04fb4d2eb8df460ffac8ea552676073 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Wed, 13 Dec 2017 10:03:54 +0000 Subject: Updated nmake system to make use of the new nmakehlp -L option for locating dependencies. --- win/nmakehlp.c | 12 +++++++---- win/rules-ext.vc | 19 +++++++++++----- win/rules.vc | 66 ++++++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 72 insertions(+), 25 deletions(-) diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 16d89a1..025bb99 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -791,10 +791,14 @@ static int LocateDependencyHelper(const char *dir, const char *keypath) */ static int LocateDependency(const char *keypath) { - int ret; - ret = LocateDependencyHelper("..", keypath); - if (ret != 0) - ret = LocateDependencyHelper("..\\..", keypath); + int i, ret; + static char *paths[] = {"..", "..\\..", "..\\..\\.."}; + + for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) { + ret = LocateDependencyHelper(paths[i], keypath); + if (ret == 0) + return ret; + } return ret; } diff --git a/win/rules-ext.vc b/win/rules-ext.vc index 3aba80d..58c70fa 100644 --- a/win/rules-ext.vc +++ b/win/rules-ext.vc @@ -28,6 +28,12 @@ macro to the name of the project makefile. !error The rules-ext.vc file is not intended for Tcl itself. !endif +# We extract version numbers using the nmakehlp program. For now use +# the local copy of nmakehlp. Once we locate Tcl, we will use that +# one if it is newer. +!if [$(CC) -nologo "nmakehlp.c" -link -subsystem:console > nul] +!endif + # First locate the Tcl directory that we are working with. !ifdef TCLDIR @@ -36,13 +42,20 @@ _RULESDIR = $(TCLDIR:/=\) !else # If an installation path is specified, that is also the Tcl directory. -# Also, tk never builds against an installed Tcl, it needs Tcl sources +# Also Tk never builds against an installed Tcl, it needs Tcl sources !if defined(INSTALLDIR) && "$(PROJECT)" != "tk" _RULESDIR=$(INSTALLDIR:/=\) !else +# Locate Tcl sources +!if [echo _RULESDIR = \> nmakehlp.out] \ + || [nmakehlp -L generic\tcl.h >> nmakehlp.out] _RULESDIR = ..\..\tcl +!else +!include nmakehlp.out !endif +!endif # defined(INSTALLDIR).... + !endif # ifndef TCLDIR # Now look for the targets.vc file under the Tcl root. Note we check this @@ -63,10 +76,6 @@ _RULESDIR = . !if exist("rules.vc") # The extension has its own copy -# We extract version numbers using the nmakehlp program. -!if [$(CC) -nologo "$(_RULESDIR)\nmakehlp.c" -link -subsystem:console > nul] -!endif - !if [echo TCL_RULES_MAJOR = \> versions.vc] \ && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MAJOR >> versions.vc] !endif diff --git a/win/rules.vc b/win/rules.vc index 10bc26e..7fc51c1 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -256,8 +256,13 @@ _TCL_H = ..\generic\tcl.h TCLINSTALL = 0 # Tk always builds against Tcl source, not an installed Tcl !if "$(TCLDIR)" == "" -TCLDIR = ../../tcl +!if [echo TCLDIR = \> nmakehlp.out] \ + || [nmakehlp -L generic\tcl.h >> nmakehlp.out] +!error *** Could not locate Tcl source directory. !endif +!include nmakehlp.out +!endif # TCLDIR == "" + _TCLDIR = $(TCLDIR:/=\) _TCL_H = $(_TCLDIR)\generic\tcl.h !if !exist("$(_TCL_H)") @@ -285,21 +290,32 @@ TCLINSTALL = 0 _TCL_H = $(_TCLDIR)\generic\tcl.h !endif -!else # TCLDIR is not defined +!else # # Case 2(c) for extensions with TCLDIR undefined + +# Need to locate Tcl depending on whether it needs Tcl source or not. +# If we don't, check the INSTALLDIR for an installed Tcl first + +!if exist("$(_INSTALLDIR)\include\tcl.h") && !$(NEED_TCL_SOURCE) -!if exist("$(_INSTALLDIR)\include\tcl.h") # Case 2(c) for extensions with TCLDIR undefined TCLINSTALL = 1 TCLDIR = $(_INSTALLDIR)\.. # NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions # later so the \.. accounts for the /lib _TCLDIR = $(_INSTALLDIR)\.. _TCL_H = $(_TCLDIR)\include\tcl.h -!elseif exist("..\..\tcl\generic\tcl.h") + +!else # exist(...) && ! $(NEED_TCL_SOURCE) + +!if [echo _TCLDIR = \> nmakehlp.out] \ + || [nmakehlp -L generic\tcl.h >> nmakehlp.out] +!error *** Could not locate Tcl source directory. +!endif +!include nmakehlp.out TCLINSTALL = 0 -TCLDIR = ..\..\tcl -_TCLDIR = $(TCLDIR) +TCLDIR = $(_TCLDIR) _TCL_H = $(_TCLDIR)\generic\tcl.h -!endif + +!endif # exist(...) && ! $(NEED_TCL_SOURCE) !endif # TCLDIR @@ -325,17 +341,30 @@ _TK_H = $(_TKDIR)\generic\tk.h !else # TKDIR not defined -!if exist("$(_INSTALLDIR)\..\include\tk.h") +# Need to locate Tcl depending on whether it needs Tcl source or not. +# If we don't, check the INSTALLDIR for an installed Tcl first + +!if exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE) + TKINSTALL = 1 +# NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions +# later so the \.. accounts for the /lib _TKDIR = $(_INSTALLDIR)\.. _TK_H = $(_TKDIR)\include\tk.h TKDIR = $(_TKDIR) -!elseif exist("$(_TCLDIR)\include\tk.h") -TKINSTALL = 1 -_TKDIR = $(_TCLDIR) -_TK_H = $(_TKDIR)\include\tk.h -TKDIR = $(_TKDIR) + +!else # exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE) + +!if [echo _TKDIR = \> nmakehlp.out] \ + || [nmakehlp -L generic\tk.h >> nmakehlp.out] +!error *** Could not locate Tk source directory. !endif +!include nmakehlp.out +TKINSTALL = 0 +TKDIR = $(_TKDIR) +_TK_H = $(_TKDIR)\generic\tk.h + +!endif # exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE) !endif # TKDIR @@ -1518,13 +1547,12 @@ default-clean: @if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc @if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc -default-hose: +default-hose: default-clean @echo Hosing $(OUT_DIR)\* ... @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR) +# Only for backward compatibility default-distclean: default-hose - @if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe - @if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj default-setup: @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) @@ -1679,6 +1707,12 @@ TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake" # Display stats being used. #---------------------------------------------------------- +!if !$(DOING_TCL) +!message *** Building against Tcl at '$(_TCLDIR)' +!endif +!if !$(DOING_TK) && $(NEED_TK) +!message *** Building against Tk at '$(_TKDIR)' +!endif !message *** Intermediate directory will be '$(TMP_DIR)' !message *** Output directory will be '$(OUT_DIR)' !message *** Installation, if selected, will be in '$(_INSTALLDIR)' -- cgit v0.12 From 3ddcb1cfb5dd70afa094e3113ab1946df9cbe222 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 13 Dec 2017 12:56:02 +0000 Subject: Fix syntax error in previous commit. --- generic/tclOO.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index 1a9bfc4..0243c15 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -238,8 +238,8 @@ MODULE_SCOPE const TclOOStubs tclOOStubs; #define RemoveItem(type, lst, i) \ do { \ Remove ## type ((lst).list, (lst).num, i); \ - (lst).num-- \ - } while 0 + (lst).num--; \ + } while (0) /* * ---------------------------------------------------------------------- -- cgit v0.12 From 556dc3036e36d2449fe4feaece94487adfd745b8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 14 Dec 2017 12:02:13 +0000 Subject: Fix (harmless) compiler warning with Visual Studio --- generic/tclStubInit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 544c28e..6c20340 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -110,7 +110,7 @@ static unsigned short TclWinNToHS(unsigned short ns) { } #define TclWinGetPlatformId winGetPlatformId static int -TclWinGetPlatformId() +TclWinGetPlatformId(void) { return 2; /* VER_PLATFORM_WIN32_NT */; } -- cgit v0.12 From 5c4f8d88b5491e7656dedeab904b42b437b83e01 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 14 Dec 2017 14:38:30 +0000 Subject: fix comment --- win/rules.vc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index f22a2dc..2ee8f0e 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -957,7 +957,7 @@ VERSION = $(DOTVERSION:.=) # different compilers, build configurations etc., # # Naming convention (suffixes): -# t = full thread support. (Not used for Tcl >= 8.6) +# t = full thread support. (Not used for Tcl >= 8.7) # s = static library (as opposed to an import library) # g = linked to the debug enabled C run-time. # x = special static build when it links to the dynamic C run-time. @@ -1048,7 +1048,7 @@ STUBPREFIX = $(PROJECT)stub # Set up paths to various Tcl executables and libraries needed by extensions !if $(DOING_TCL) -TCLSHNAME = $(PROJECT)sh$(TCL_VERSION)$(SUFX).exe +TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe TCLSH = $(OUT_DIR)\$(TCLSHNAME) TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) -- cgit v0.12 From 3f03f8189e6b4da3ff496bfbb4faa921124b76f9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 15 Dec 2017 13:04:15 +0000 Subject: Oops, couldn't build tclWinPanic.o. Fixed now. --- win/makefile.vc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/makefile.vc b/win/makefile.vc index 1d61f28..d270447 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -741,7 +741,7 @@ $(TMP_DIR)\tclTomMathStubLib.obj: $(GENERICDIR)\tclTomMathStubLib.c $(TMP_DIR)\tclOOStubLib.obj: $(GENERICDIR)\tclOOStubLib.c $(cc32) $(stubscflags) -Fo$@ $? -$(TMP_DIR)\tclWinPanic.obj: $(GENERICDIR)\tclWinPanic.c +$(TMP_DIR)\tclWinPanic.obj: $(WINDIR)\tclWinPanic.c $(cc32) $(stubscflags) -Fo$@ $? $(TMP_DIR)\tclsh.exe.manifest: $(WINDIR)\tclsh.exe.manifest.in -- cgit v0.12 From 4fb66d5d55a3239a342ae799da586966fe8326cf Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 15 Dec 2017 14:46:11 +0000 Subject: Mark TclPrecTraceProc() as deprecated, and remove it when compiling with -DTCL_NO_DEPRECATED. See TIP #488 --- generic/tclBasic.c | 2 ++ generic/tclInt.decls | 2 +- generic/tclIntDecls.h | 5 +++-- generic/tclStubInit.c | 1 + generic/tclUtil.c | 2 ++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index eceea31..406d0b1 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -954,9 +954,11 @@ Tcl_CreateInterp(void) Tcl_SetVar2(interp, "tcl_patchLevel", NULL, TCL_PATCH_LEVEL, TCL_GLOBAL_ONLY); Tcl_SetVar2(interp, "tcl_version", NULL, TCL_VERSION, TCL_GLOBAL_ONLY); +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 Tcl_TraceVar2(interp, "tcl_precision", NULL, TCL_GLOBAL_ONLY|TCL_TRACE_READS|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, TclPrecTraceProc, NULL); +#endif /* !TCL_NO_DEPRECATED */ TclpSetVariables(interp); #ifdef TCL_THREADS diff --git a/generic/tclInt.decls b/generic/tclInt.decls index 33bf0b3..175ea9c 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -355,7 +355,7 @@ declare 81 { # declare 87 { # void TclPlatformInit(Tcl_Interp *interp) # } -declare 88 { +declare 88 {deprecated {}} { char *TclPrecTraceProc(ClientData clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags) } diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index 5848bb3..bc8f7b8 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -233,7 +233,8 @@ EXTERN char * TclpRealloc(char *ptr, unsigned int size); /* Slot 86 is reserved */ /* Slot 87 is reserved */ /* 88 */ -EXTERN char * TclPrecTraceProc(ClientData clientData, +TCL_DEPRECATED("") +char * TclPrecTraceProc(ClientData clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); /* 89 */ @@ -743,7 +744,7 @@ typedef struct TclIntStubs { void (*reserved85)(void); void (*reserved86)(void); void (*reserved87)(void); - char * (*tclPrecTraceProc) (ClientData clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); /* 88 */ + TCL_DEPRECATED_API("") char * (*tclPrecTraceProc) (ClientData clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); /* 88 */ int (*tclPreventAliasLoop) (Tcl_Interp *interp, Tcl_Interp *cmdInterp, Tcl_Command cmd); /* 89 */ void (*reserved90)(void); void (*tclProcCleanupProc) (Proc *procPtr); /* 91 */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 6c20340..bd0971b 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -64,6 +64,7 @@ static int TclSockMinimumBuffersOld(int sock, int size) # define TclGetStartupScriptPath 0 # define TclSetStartupScriptFileName 0 # define TclGetStartupScriptFileName 0 +# define TclPrecTraceProc 0 # define TclpInetNtoa 0 # define TclWinGetServByName 0 # define TclWinGetSockOpt 0 diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 51af016..d84163c 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3298,6 +3298,7 @@ Tcl_PrintDouble( *---------------------------------------------------------------------- */ +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 /* ARGSUSED */ char * TclPrecTraceProc( @@ -3355,6 +3356,7 @@ TclPrecTraceProc( *precisionPtr = prec; return NULL; } +#endif /* !TCL_NO_DEPRECATED)*/ /* *---------------------------------------------------------------------- -- cgit v0.12 From 67f6f5cdb190d17b5178a5d5c8d090440bbc1005 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 15 Dec 2017 16:50:50 +0000 Subject: Revert the (int -> size_t) transition of the "cmdEpoch" field of the struct Command that was part of [ff3f6a12a8d099ef], and related changes. This change broke the ability of Itcl 3.4 built against Tcl 8.6 headers to successfully [load] into and operate in a Tcl 8.7 interp. "Command" is a private struct, and Itcl 3 should have respected that, but it has not, and changing the size of the cmdEpoch field broke the ability of Itcl 3 to operate on later fields of the struct, notably the deleteProc, which it makes extensive use of. I believe we should keep the change in the Tcl 9 sources. --- generic/tclBasic.c | 2 +- generic/tclInt.h | 2 +- generic/tclObj.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 406d0b1..292b466 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4789,7 +4789,7 @@ TEOV_RunEnterTraces( { Interp *iPtr = (Interp *) interp; Command *cmdPtr = *cmdPtrPtr; - size_t newEpoch, cmdEpoch = cmdPtr->cmdEpoch; + int newEpoch, cmdEpoch = cmdPtr->cmdEpoch; int length, traceCode = TCL_OK; const char *command = TclGetStringFromObj(commandPtr, &length); diff --git a/generic/tclInt.h b/generic/tclInt.h index ad1d9c6..49d88aa 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -1639,7 +1639,7 @@ typedef struct Command { * representing a command's name in a ByteCode * instruction sequence. This structure can be * freed when refCount becomes zero. */ - size_t cmdEpoch; /* Incremented to invalidate any references + int cmdEpoch; /* Incremented to invalidate any references * that point to this command when it is * renamed, deleted, hidden, or exposed. */ CompileProc *compileProc; /* Procedure called to compile command. NULL diff --git a/generic/tclObj.c b/generic/tclObj.c index 1a00011..1aa24f2 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -354,7 +354,7 @@ typedef struct ResolvedCmdName { * Before using the cached pointer, we check * if the namespace's epoch was incremented; * if so, this cached pointer is invalid. */ - size_t cmdEpoch; /* Value of the command's cmdEpoch when this + int cmdEpoch; /* Value of the command's cmdEpoch when this * pointer was cached. Before using the cached * pointer, we check if the cmd's epoch was * incremented; if so, the cmd was renamed, -- cgit v0.12 From aecff8b1e70292e4c7e77d9200b086f7af4cfa33 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 15 Dec 2017 21:27:14 +0000 Subject: Revert a few more (int -> size_t) transitions, which could effect extensions (such as Itcl 3.4) which use internal Tcl header files. Better wait until 9.0 for this. What we _can_ do is change some (internal) fields to 'unsigned': that doubles the epoch range without further danger. Thanks, Don, for pointing this out! --- generic/tclBasic.c | 2 +- generic/tclCompile.h | 2 +- generic/tclEncoding.c | 2 +- generic/tclEnsemble.c | 2 +- generic/tclExecute.c | 6 +++--- generic/tclInt.h | 22 +++++++++++----------- generic/tclNamesp.c | 2 +- generic/tclObj.c | 6 +++--- generic/tclUtil.c | 8 ++++---- unix/tclUnixInit.c | 2 +- unix/tclUnixSock.c | 2 +- win/tclWinInit.c | 6 +++--- win/tclWinSock.c | 2 +- 13 files changed, 32 insertions(+), 32 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 292b466..5fd9e28 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4789,7 +4789,7 @@ TEOV_RunEnterTraces( { Interp *iPtr = (Interp *) interp; Command *cmdPtr = *cmdPtrPtr; - int newEpoch, cmdEpoch = cmdPtr->cmdEpoch; + unsigned int newEpoch, cmdEpoch = cmdPtr->cmdEpoch; int length, traceCode = TCL_OK; const char *command = TclGetStringFromObj(commandPtr, &length); diff --git a/generic/tclCompile.h b/generic/tclCompile.h index bd7aaab..7f01436 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -425,7 +425,7 @@ typedef struct ByteCode { * compiled. If the code is executed if a * different namespace, it must be * recompiled. */ - size_t nsEpoch; /* Value of nsPtr->resolverEpoch when this + unsigned int nsEpoch; /* Value of nsPtr->resolverEpoch when this * ByteCode was compiled. Used to invalidate * code when new namespace resolution rules * are put into effect. */ diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index e1e26d3..46db12c 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -3609,7 +3609,7 @@ unilen( static void InitializeEncodingSearchPath( char **valuePtr, - size_t *lengthPtr, + unsigned int *lengthPtr, Tcl_Encoding *encodingPtr) { const char *bytes; diff --git a/generic/tclEnsemble.c b/generic/tclEnsemble.c index 580ea5c..e7bfbac 100644 --- a/generic/tclEnsemble.c +++ b/generic/tclEnsemble.c @@ -92,7 +92,7 @@ static const Tcl_ObjType ensembleCmdType = { */ typedef struct { - size_t epoch; /* Used to confirm when the data in this + unsigned int epoch; /* Used to confirm when the data in this * really structure matches up with the * ensemble. */ Command *token; /* Reference to the command for which this diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 95664d0..f2cda0c 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -9476,9 +9476,9 @@ PrintByteCodeInfo( Proc *procPtr = codePtr->procPtr; Interp *iPtr = (Interp *) *codePtr->interpHandle; - fprintf(stdout, "\nExecuting ByteCode 0x%p, refCt %" TCL_LL_MODIFIER "u, epoch %" TCL_LL_MODIFIER "u, interp 0x%p (epoch %" TCL_LL_MODIFIER "u)\n", - codePtr, (Tcl_WideInt)codePtr->refCount, (Tcl_WideInt)codePtr->compileEpoch, iPtr, - (Tcl_WideInt)iPtr->compileEpoch); + fprintf(stdout, "\nExecuting ByteCode 0x%p, refCt %" TCL_LL_MODIFIER "u, epoch %u, interp 0x%p (epoch %u)\n", + codePtr, (Tcl_WideInt)codePtr->refCount, codePtr->compileEpoch, iPtr, + iPtr->compileEpoch); fprintf(stdout, " Source: "); TclPrintSource(stdout, codePtr->source, 60); diff --git a/generic/tclInt.h b/generic/tclInt.h index 49d88aa..91deb9d 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -265,7 +265,7 @@ typedef struct Namespace { * strings; values have type (Namespace *). If * NULL, there are no children. */ #endif - size_t nsId; /* Unique id for the namespace. */ + unsigned long nsId; /* Unique id for the namespace. */ Tcl_Interp *interp; /* The interpreter containing this * namespace. */ int flags; /* OR-ed combination of the namespace status @@ -299,12 +299,12 @@ typedef struct Namespace { * registered using "namespace export". */ int maxExportPatterns; /* Mumber of export patterns for which space * is currently allocated. */ - size_t cmdRefEpoch; /* Incremented if a newly added command + unsigned int cmdRefEpoch; /* Incremented if a newly added command * shadows a command for which this namespace * has already cached a Command* pointer; this * causes all its cached Command* pointers to * be invalidated. */ - size_t resolverEpoch; /* Incremented whenever (a) the name + unsigned int resolverEpoch; /* Incremented whenever (a) the name * resolution rules change for this namespace * or (b) a newly added command shadows a * command that is compiled to bytecodes. This @@ -331,7 +331,7 @@ typedef struct Namespace { * LookupCompiledLocal to resolve variable * references within the namespace at compile * time. */ - size_t exportLookupEpoch; /* Incremented whenever a command is added to + unsigned int exportLookupEpoch; /* Incremented whenever a command is added to * a namespace, removed from a namespace or * the exports of a namespace are changed. * Allows TIP#112-driven command lists to be @@ -432,7 +432,7 @@ typedef struct EnsembleConfig { * if the command has been deleted (or never * existed; the global namespace never has an * ensemble command.) */ - size_t epoch; /* The epoch at which this ensemble's table of + unsigned int epoch; /* The epoch at which this ensemble's table of * exported commands is valid. */ char **subcommandArrayPtr; /* Array of ensemble subcommand names. At all * consistent points, this will have the same @@ -1634,12 +1634,12 @@ typedef struct Command { * recreated). */ Namespace *nsPtr; /* Points to the namespace containing this * command. */ - int refCount; /* 1 if in command hashtable plus 1 for each + unsigned int refCount; /* 1 if in command hashtable plus 1 for each * reference from a CmdName Tcl object * representing a command's name in a ByteCode * instruction sequence. This structure can be * freed when refCount becomes zero. */ - int cmdEpoch; /* Incremented to invalidate any references + unsigned int cmdEpoch; /* Incremented to invalidate any references * that point to this command when it is * renamed, deleted, hidden, or exposed. */ CompileProc *compileProc; /* Procedure called to compile command. NULL @@ -2626,7 +2626,7 @@ typedef Tcl_ObjCmdProc *TclObjCmdProcType; *---------------------------------------------------------------- */ -typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, size_t *lengthPtr, +typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, unsigned int *lengthPtr, Tcl_Encoding *encodingPtr); /* @@ -2638,9 +2638,9 @@ typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, size_t *lengthPtr, */ typedef struct ProcessGlobalValue { - size_t epoch; /* Epoch counter to detect changes in the + unsigned int epoch; /* Epoch counter to detect changes in the * master value. */ - size_t numBytes; /* Length of the master string. */ + unsigned int numBytes; /* Length of the master string. */ char *value; /* The master string value. */ Tcl_Encoding encoding; /* system encoding when master string was * initialized. */ @@ -3125,7 +3125,7 @@ MODULE_SCOPE int TclpThreadCreate(Tcl_ThreadId *idPtr, int stackSize, int flags); MODULE_SCOPE int TclpFindVariable(const char *name, int *lengthPtr); MODULE_SCOPE void TclpInitLibraryPath(char **valuePtr, - size_t *lengthPtr, Tcl_Encoding *encodingPtr); + unsigned int *lengthPtr, Tcl_Encoding *encodingPtr); MODULE_SCOPE void TclpInitLock(void); MODULE_SCOPE void TclpInitPlatform(void); MODULE_SCOPE void TclpInitUnlock(void); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index d661856..d212de1 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -32,7 +32,7 @@ */ typedef struct { - size_t numNsCreated; /* Count of the number of namespaces created + unsigned long numNsCreated; /* Count of the number of namespaces created * within the thread. This value is used as a * unique id for each namespace. Cannot be * per-interp because the nsId is used to diff --git a/generic/tclObj.c b/generic/tclObj.c index 1aa24f2..4ec0a57 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -344,17 +344,17 @@ typedef struct ResolvedCmdName { * reference (not the namespace that contains * the referenced command). NULL if the name * is fully qualified.*/ - size_t refNsId; /* refNsPtr's unique namespace id. Used to + unsigned long refNsId; /* refNsPtr's unique namespace id. Used to * verify that refNsPtr is still valid (e.g., * it's possible that the cmd's containing * namespace was deleted and a new one created * at the same address). */ - size_t refNsCmdEpoch; /* Value of the referencing namespace's + unsigned int refNsCmdEpoch; /* Value of the referencing namespace's * cmdRefEpoch when the pointer was cached. * Before using the cached pointer, we check * if the namespace's epoch was incremented; * if so, this cached pointer is invalid. */ - int cmdEpoch; /* Value of the command's cmdEpoch when this + unsigned int cmdEpoch; /* Value of the command's cmdEpoch when this * pointer was cached. Before using the cached * pointer, we check if the cmd's epoch was * incremented; if so, the cmd was renamed, diff --git a/generic/tclUtil.c b/generic/tclUtil.c index d84163c..15018de 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -4012,7 +4012,7 @@ TclSetProcessGlobalValue( Tcl_IncrRefCount(newValue); cacheMap = GetThreadHash(&pgvPtr->key); ClearHash(cacheMap); - hPtr = Tcl_CreateHashEntry(cacheMap, (void *)(pgvPtr->epoch), &dummy); + hPtr = Tcl_CreateHashEntry(cacheMap, (void *)(size_t)(pgvPtr->epoch), &dummy); Tcl_SetHashValue(hPtr, newValue); Tcl_MutexUnlock(&pgvPtr->mutex); } @@ -4038,7 +4038,7 @@ TclGetProcessGlobalValue( Tcl_Obj *value = NULL; Tcl_HashTable *cacheMap; Tcl_HashEntry *hPtr; - size_t epoch = pgvPtr->epoch; + unsigned int epoch = pgvPtr->epoch; if (pgvPtr->encoding) { Tcl_Encoding current = Tcl_GetEncoding(NULL, NULL); @@ -4072,7 +4072,7 @@ TclGetProcessGlobalValue( } } cacheMap = GetThreadHash(&pgvPtr->key); - hPtr = Tcl_FindHashEntry(cacheMap, (void *) (epoch)); + hPtr = Tcl_FindHashEntry(cacheMap, (void *)(size_t)epoch); if (NULL == hPtr) { int dummy; @@ -4105,7 +4105,7 @@ TclGetProcessGlobalValue( value = Tcl_NewStringObj(pgvPtr->value, pgvPtr->numBytes); hPtr = Tcl_CreateHashEntry(cacheMap, - (void *)(pgvPtr->epoch), &dummy); + (void *)(size_t)(pgvPtr->epoch), &dummy); Tcl_MutexUnlock(&pgvPtr->mutex); Tcl_SetHashValue(hPtr, value); Tcl_IncrRefCount(value); diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index feeffa6..e57136d 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -453,7 +453,7 @@ TclpInitPlatform(void) void TclpInitLibraryPath( char **valuePtr, - size_t *lengthPtr, + unsigned int *lengthPtr, Tcl_Encoding *encodingPtr) { #define LIBRARY_SIZE 32 diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 45abc01..980ab4d 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -217,7 +217,7 @@ printaddrinfo( static void InitializeHostName( char **valuePtr, - size_t *lengthPtr, + unsigned int *lengthPtr, Tcl_Encoding *encodingPtr) { const char *native = NULL; diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 9d37a41..dc8bba7 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -182,7 +182,7 @@ TclpInitPlatform(void) void TclpInitLibraryPath( char **valuePtr, - size_t *lengthPtr, + unsigned int *lengthPtr, Tcl_Encoding *encodingPtr) { #define LIBRARY_SIZE 64 @@ -345,7 +345,7 @@ AppendEnvironment( static void InitializeDefaultLibraryDir( char **valuePtr, - size_t *lengthPtr, + unsigned int *lengthPtr, Tcl_Encoding *encodingPtr) { HMODULE hModule = TclWinGetTclInstance(); @@ -396,7 +396,7 @@ InitializeDefaultLibraryDir( static void InitializeSourceLibraryDir( char **valuePtr, - size_t *lengthPtr, + unsigned int *lengthPtr, Tcl_Encoding *encodingPtr) { HMODULE hModule = TclWinGetTclInstance(); diff --git a/win/tclWinSock.c b/win/tclWinSock.c index ee6be96..1c004838 100644 --- a/win/tclWinSock.c +++ b/win/tclWinSock.c @@ -360,7 +360,7 @@ printaddrinfolist( void InitializeHostName( char **valuePtr, - size_t *lengthPtr, + unsigned int *lengthPtr, Tcl_Encoding *encodingPtr) { TCHAR tbuf[MAX_COMPUTERNAME_LENGTH + 1]; -- cgit v0.12 From 71cf0dba4023ab771a4923f6e741c5b6ac19217a Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sat, 16 Dec 2017 03:22:04 +0000 Subject: Re-arranging code and providing forward prototypes to allow the C infrastructure of Zipfs to be activated from withing the first call to TclZipfs_Mount(). This keeps up from having to expose TclZipfs_Init in the stubs table. --- generic/tclZipfs.c | 145 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 88 insertions(+), 57 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 2370980..ca10b4f 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -306,6 +306,73 @@ static const unsigned long crc32tab[256] = { const char *zipfs_literal_tcl_library=NULL; +/* Function prototypes */ +static int Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr); +static Tcl_Obj *Zip_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr); +static Tcl_Obj *Zip_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr); +static int Zip_FSStatProc(Tcl_Obj *pathPtr, Tcl_StatBuf *buf); +static int Zip_FSAccessProc(Tcl_Obj *pathPtr, int mode); +static Tcl_Channel Zip_FSOpenFileChannelProc( + Tcl_Interp *interp, Tcl_Obj *pathPtr, + int mode, int permissions +); +static int Zip_FSMatchInDirectoryProc( + Tcl_Interp* interp, Tcl_Obj *result, + Tcl_Obj *pathPtr, const char *pattern, + Tcl_GlobTypeData *types +); +static Tcl_Obj *Zip_FSListVolumesProc(void); +static const char *const *Zip_FSFileAttrStringsProc(Tcl_Obj *pathPtr, Tcl_Obj** objPtrRef); +static int Zip_FSFileAttrsGetProc( + Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, + Tcl_Obj **objPtrRef +); +static int Zip_FSFileAttrsSetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr,Tcl_Obj *objPtr); +static int Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, + Tcl_FSUnloadFileProc **unloadProcPtr, int flags); +static void TclZipfs_C_Init(void); + +/* + * Define the ZIP filesystem dispatch table. + */ + +MODULE_SCOPE const Tcl_Filesystem zipfsFilesystem; + +const Tcl_Filesystem zipfsFilesystem = { + "zipfs", + sizeof (Tcl_Filesystem), + TCL_FILESYSTEM_VERSION_2, + Zip_FSPathInFilesystemProc, + NULL, /* dupInternalRepProc */ + NULL, /* freeInternalRepProc */ + NULL, /* internalToNormalizedProc */ + NULL, /* createInternalRepProc */ + NULL, /* normalizePathProc */ + Zip_FSFilesystemPathTypeProc, + Zip_FSFilesystemSeparatorProc, + Zip_FSStatProc, + Zip_FSAccessProc, + Zip_FSOpenFileChannelProc, + Zip_FSMatchInDirectoryProc, + NULL, /* utimeProc */ + NULL, /* linkProc */ + Zip_FSListVolumesProc, + Zip_FSFileAttrStringsProc, + Zip_FSFileAttrsGetProc, + Zip_FSFileAttrsSetProc, + NULL, /* createDirectoryProc */ + NULL, /* removeDirectoryProc */ + NULL, /* deleteFileProc */ + NULL, /* copyFileProc */ + NULL, /* renameFileProc */ + NULL, /* copyDirectoryProc */ + NULL, /* lstatProc */ + (Tcl_FSLoadFileProc *) Zip_FSLoadFile, + NULL, /* getCwdProc */ + NULL, /* chdirProc*/ +}; + + /* *------------------------------------------------------------------------- @@ -1039,6 +1106,25 @@ error: ZipFSCloseArchive(interp, zf); return TCL_ERROR; } + +static void TclZipfs_C_Init(void) { + static const Tcl_Time t = { 0, 0 }; + if (!ZipFS.initialized) { +#ifdef TCL_THREADS + /* + * Inflate condition variable. + */ + Tcl_MutexLock(&ZipFSMutex); + Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, &t); + Tcl_MutexUnlock(&ZipFSMutex); +#endif + Tcl_FSRegister(NULL, &zipfsFilesystem); + Tcl_InitHashTable(&ZipFS.fileHash, TCL_STRING_KEYS); + Tcl_InitHashTable(&ZipFS.zipHash, TCL_STRING_KEYS); + ZipFS.initialized = ZipFS.idCount = 1; + } +} + /* *------------------------------------------------------------------------- @@ -1077,9 +1163,7 @@ TclZipfs_Mount( ReadLock(); if (!ZipFS.initialized) { - ZIPFS_ERROR(interp,"not initialized"); - Unlock(); - return TCL_ERROR; + TclZipfs_C_Init(); } if (zipname == NULL) { Tcl_HashSearch search; @@ -3924,47 +4008,6 @@ Zip_FSLoadFile(Tcl_Interp *interp, Tcl_Obj *path, Tcl_LoadHandle *loadHandle, #endif } - -/* - * Define the ZIP filesystem dispatch table. - */ - -MODULE_SCOPE const Tcl_Filesystem zipfsFilesystem; - -const Tcl_Filesystem zipfsFilesystem = { - "zipfs", - sizeof (Tcl_Filesystem), - TCL_FILESYSTEM_VERSION_2, - Zip_FSPathInFilesystemProc, - NULL, /* dupInternalRepProc */ - NULL, /* freeInternalRepProc */ - NULL, /* internalToNormalizedProc */ - NULL, /* createInternalRepProc */ - NULL, /* normalizePathProc */ - Zip_FSFilesystemPathTypeProc, - Zip_FSFilesystemSeparatorProc, - Zip_FSStatProc, - Zip_FSAccessProc, - Zip_FSOpenFileChannelProc, - Zip_FSMatchInDirectoryProc, - NULL, /* utimeProc */ - NULL, /* linkProc */ - Zip_FSListVolumesProc, - Zip_FSFileAttrStringsProc, - Zip_FSFileAttrsGetProc, - Zip_FSFileAttrsSetProc, - NULL, /* createDirectoryProc */ - NULL, /* removeDirectoryProc */ - NULL, /* deleteFileProc */ - NULL, /* copyFileProc */ - NULL, /* renameFileProc */ - NULL, /* copyDirectoryProc */ - NULL, /* lstatProc */ - (Tcl_FSLoadFileProc *) Zip_FSLoadFile, - NULL, /* getCwdProc */ - NULL, /* chdirProc*/ -}; - #endif /* HAVE_ZLIB */ @@ -3994,19 +4037,7 @@ TclZipfs_Init(Tcl_Interp *interp) WriteLock(); Tcl_StaticPackage(interp, "zipfs", TclZipfs_Init, TclZipfs_Init); if (!ZipFS.initialized) { -#ifdef TCL_THREADS - static const Tcl_Time t = { 0, 0 }; - /* - * Inflate condition variable. - */ - Tcl_MutexLock(&ZipFSMutex); - Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, &t); - Tcl_MutexUnlock(&ZipFSMutex); -#endif - Tcl_FSRegister(NULL, &zipfsFilesystem); - Tcl_InitHashTable(&ZipFS.fileHash, TCL_STRING_KEYS); - Tcl_InitHashTable(&ZipFS.zipHash, TCL_STRING_KEYS); - ZipFS.initialized = ZipFS.idCount = 1; + TclZipfs_C_Init(); } Unlock(); if(interp != NULL) { -- cgit v0.12 From 45a3c74a04c973ba863d5914abedb96b85d17e1b Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sat, 16 Dec 2017 03:24:21 +0000 Subject: Removing static package declaration of zipfs. --- generic/tclZipfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index ca10b4f..45ba8e2 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -4035,7 +4035,7 @@ TclZipfs_Init(Tcl_Interp *interp) #ifdef HAVE_ZLIB /* one-time initialization */ WriteLock(); - Tcl_StaticPackage(interp, "zipfs", TclZipfs_Init, TclZipfs_Init); + /* Tcl_StaticPackage(interp, "zipfs", TclZipfs_Init, TclZipfs_Init); */ if (!ZipFS.initialized) { TclZipfs_C_Init(); } -- cgit v0.12 From 7f1c241ea2bb3908c647d517e512816b219771dd Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Sat, 16 Dec 2017 03:30:58 +0000 Subject: Update the config.test with new keys needed for zipfs --- tests/config.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/config.test b/tests/config.test index d14837e..468a1df 100644 --- a/tests/config.test +++ b/tests/config.test @@ -19,7 +19,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} { test pkgconfig-1.1 {query keys} { lsort [::tcl::pkgconfig list] -} {64bit bindir,install bindir,runtime compile_debug compile_stats debug docdir,install docdir,runtime includedir,install includedir,runtime libdir,install libdir,runtime mem_debug optimized profiled scriptdir,install scriptdir,runtime threaded} +} {64bit bindir,install bindir,runtime compile_debug compile_stats debug dllfile,runtime docdir,install docdir,runtime includedir,install includedir,runtime libdir,install libdir,runtime mem_debug optimized profiled scriptdir,install scriptdir,runtime threaded zipfile,runtime} test pkgconfig-1.2 {query keys multiple times} { string compare [::tcl::pkgconfig list] [::tcl::pkgconfig list] } 0 -- cgit v0.12 From e0360a8c349d388e4090091098507da40848e83d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Dec 2017 11:41:31 +0000 Subject: Add win/rules-ext.vc and win/targets.vc to "make dist". Reported by Paul Overmeier. Thanks! --- unix/Makefile.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 4814ee0..29c051d 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -2018,8 +2018,7 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tclConfig.h.in $(UNIX_DIR)/tcl.pc.in $(M cp -p $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.ico $(TOP_DIR)/win/*.rc \ $(DISTDIR)/win cp -p $(TOP_DIR)/win/*.bat $(DISTDIR)/win - cp -p $(TOP_DIR)/win/makefile.* $(DISTDIR)/win - cp -p $(TOP_DIR)/win/rules.vc $(DISTDIR)/win + cp -p $(TOP_DIR)/win/*.vc $(DISTDIR)/win cp -p $(TOP_DIR)/win/coffbase.txt $(DISTDIR)/win cp -p $(TOP_DIR)/win/tcl.hpj.in $(DISTDIR)/win cp -p $(TOP_DIR)/win/tcl.ds* $(DISTDIR)/win -- cgit v0.12 From 0fb81cb5dd85b298db7f4efe9c3dbdca910cf1d5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Dec 2017 13:56:30 +0000 Subject: (cherry-pick): Added assoc, ftype and move as auto_execok shell built-ins on Windows. --- library/init.tcl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/init.tcl b/library/init.tcl index c31eea3..6a1f921 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -637,8 +637,8 @@ proc auto_execok name { } set auto_execs($name) "" - set shellBuiltins [list cls copy date del dir echo erase md mkdir \ - mklink rd ren rename rmdir start time type ver vol] + set shellBuiltins [list assoc cls copy date del dir echo erase ftype \ + md mkdir mklink move rd ren rename rmdir start time type ver vol] if {[info exists env(PATHEXT)]} { # Add an initial ; to have the {} extension check first. set execExtensions [split ";$env(PATHEXT)" ";"] -- cgit v0.12 From dbe18af9ea851bd0e954036eff3fcd21bccf5291 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 18 Dec 2017 14:33:11 +0000 Subject: No need any more to check for "Windows NT" here, since the minimum is XP now. --- library/init.tcl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/init.tcl b/library/init.tcl index 794b68b..530ce58 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -653,10 +653,7 @@ proc auto_execok name { set windir $env(WINDIR) } if {[info exists windir]} { - if {$tcl_platform(os) eq "Windows NT"} { - append path "$windir/system32;" - } - append path "$windir/system;$windir;" + append path "$windir/system32;$windir/system;$windir;" } foreach var {PATH Path path} { -- cgit v0.12 From f64bba0499c121428187fe686da131dca5905e50 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 19 Dec 2017 11:21:33 +0000 Subject: Minor simplification on Cygwin, since we only support Windows NT now --- unix/tclUnixInit.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index e57136d..cc66569 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -39,11 +39,6 @@ DLLIMPORT extern __stdcall void FreeLibrary(void *); DLLIMPORT extern __stdcall void *GetProcAddress(void *, const char *); DLLIMPORT extern __stdcall void GetSystemInfo(void *); -#define NUMPLATFORMS 4 -static const char *const platforms[NUMPLATFORMS] = { - "Win32s", "Windows 95", "Windows NT", "Windows CE" -}; - #define NUMPROCESSORS 11 static const char *const processors[NUMPROCESSORS] = { "intel", "mips", "alpha", "ppc", "shx", "arm", "ia64", "alpha64", "msil", @@ -890,10 +885,7 @@ TclpSetVariables( GetSystemInfo(&sysInfo); - if (osInfo.dwPlatformId < NUMPLATFORMS) { - Tcl_SetVar2(interp, "tcl_platform", "os", - platforms[osInfo.dwPlatformId], TCL_GLOBAL_ONLY); - } + Tcl_SetVar2(interp, "tcl_platform", "os", "Windows NT", TCL_GLOBAL_ONLY); sprintf(buffer, "%d.%d", osInfo.dwMajorVersion, osInfo.dwMinorVersion); Tcl_SetVar2(interp, "tcl_platform", "osVersion", buffer, TCL_GLOBAL_ONLY); if (sysInfo.wProcessorArchitecture < NUMPROCESSORS) { -- cgit v0.12 From ee66488c3683d1e2b6ac36f523638c42c5649433 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 19 Dec 2017 11:23:13 +0000 Subject: Make TclEnsureNamespace() MODULE_SCOPE. Also change some refCount fields from type "int" to "unsigned int" for increased range. --- generic/tclCompile.h | 4 ++-- generic/tclDisassemble.c | 4 ++-- generic/tclInt.h | 25 ++++++++++++------------- generic/tclNamesp.c | 4 ++-- generic/tclProc.c | 2 +- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/generic/tclCompile.h b/generic/tclCompile.h index 7f01436..f20ecfd 100644 --- a/generic/tclCompile.h +++ b/generic/tclCompile.h @@ -425,11 +425,11 @@ typedef struct ByteCode { * compiled. If the code is executed if a * different namespace, it must be * recompiled. */ - unsigned int nsEpoch; /* Value of nsPtr->resolverEpoch when this + unsigned int nsEpoch; /* Value of nsPtr->resolverEpoch when this * ByteCode was compiled. Used to invalidate * code when new namespace resolution rules * are put into effect. */ - int refCount; /* Reference count: set 1 when created plus 1 + unsigned int refCount; /* Reference count: set 1 when created plus 1 * for each execution of the code currently * active. This structure can be freed when * refCount becomes zero. */ diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index d61ed42..e07080a 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -254,7 +254,7 @@ DisassembleByteCodeObj( Tcl_Obj *bufferObj, *fileObj; TclNewObj(bufferObj); - if (codePtr->refCount <= 0) { + if (!codePtr->refCount) { return bufferObj; /* Already freed. */ } @@ -312,7 +312,7 @@ DisassembleByteCodeObj( int numCompiledLocals = procPtr->numCompiledLocals; Tcl_AppendPrintfToObj(bufferObj, - " Proc %p, refCt %d, args %d, compiled locals %d\n", + " Proc %p, refCt %u, args %d, compiled locals %d\n", procPtr, procPtr->refCount, procPtr->numArgs, numCompiledLocals); if (numCompiledLocals > 0) { diff --git a/generic/tclInt.h b/generic/tclInt.h index 91deb9d..de22924 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -274,7 +274,7 @@ typedef struct Namespace { * frames for this namespace that are on the * Tcl call stack. The namespace won't be * freed until activationCount becomes zero. */ - int refCount; /* Count of references by namespaceName + unsigned int refCount; /* Count of references by namespaceName * objects. The namespace can't be freed until * refCount becomes zero. */ Tcl_HashTable cmdTable; /* Contains all the commands currently @@ -299,7 +299,7 @@ typedef struct Namespace { * registered using "namespace export". */ int maxExportPatterns; /* Mumber of export patterns for which space * is currently allocated. */ - unsigned int cmdRefEpoch; /* Incremented if a newly added command + unsigned int cmdRefEpoch; /* Incremented if a newly added command * shadows a command for which this namespace * has already cached a Command* pointer; this * causes all its cached Command* pointers to @@ -545,7 +545,7 @@ typedef struct CommandTrace { struct CommandTrace *nextPtr; /* Next in list of traces associated with a * particular command. */ - int refCount; /* Used to ensure this structure is not + unsigned int refCount; /* Used to ensure this structure is not * deleted too early. Keeps track of how many * pieces of code have a pointer to this * structure. */ @@ -618,7 +618,7 @@ typedef struct Var { typedef struct VarInHash { Var var; - int refCount; /* Counts number of active uses of this + unsigned int refCount; /* Counts number of active uses of this * variable: 1 for the entry in the hash * table, 1 for each additional variable whose * linkPtr points here, 1 for each nested @@ -950,7 +950,7 @@ typedef struct CompiledLocal { typedef struct Proc { struct Interp *iPtr; /* Interpreter for which this command is * defined. */ - int refCount; /* Reference count: 1 if still present in + unsigned int refCount; /* Reference count: 1 if still present in * command table plus 1 for each call to the * procedure that is currently active. This * structure can be freed when refCount @@ -1067,7 +1067,7 @@ typedef struct AssocData { */ typedef struct LocalCache { - int refCount; + unsigned int refCount; int numVars; Tcl_Obj *varName0; } LocalCache; @@ -1229,7 +1229,7 @@ typedef struct CmdFrame { typedef struct CFWord { CmdFrame *framePtr; /* CmdFrame to access. */ int word; /* Index of the word in the command. */ - int refCount; /* Number of times the word is on the + unsigned int refCount; /* Number of times the word is on the * stack. */ } CFWord; @@ -1634,12 +1634,12 @@ typedef struct Command { * recreated). */ Namespace *nsPtr; /* Points to the namespace containing this * command. */ - unsigned int refCount; /* 1 if in command hashtable plus 1 for each + unsigned int refCount; /* 1 if in command hashtable plus 1 for each * reference from a CmdName Tcl object * representing a command's name in a ByteCode * instruction sequence. This structure can be * freed when refCount becomes zero. */ - unsigned int cmdEpoch; /* Incremented to invalidate any references + unsigned int cmdEpoch; /* Incremented to invalidate any references * that point to this command when it is * renamed, deleted, hidden, or exposed. */ CompileProc *compileProc; /* Procedure called to compile command. NULL @@ -2384,7 +2384,7 @@ typedef enum TclEolTranslation { */ typedef struct List { - int refCount; + unsigned int refCount; int maxElemCount; /* Total number of element array slots. */ int elemCount; /* Current number of list elements. */ int canonicalFlag; /* Set if the string representation was @@ -2640,7 +2640,7 @@ typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, unsigned int *leng typedef struct ProcessGlobalValue { unsigned int epoch; /* Epoch counter to detect changes in the * master value. */ - unsigned int numBytes; /* Length of the master string. */ + unsigned int numBytes; /* Length of the master string. */ char *value; /* The master string value. */ Tcl_Encoding encoding; /* system encoding when master string was * initialized. */ @@ -2960,8 +2960,7 @@ MODULE_SCOPE char * TclDStringAppendDString(Tcl_DString *dsPtr, MODULE_SCOPE Tcl_Obj * TclDStringToObj(Tcl_DString *dsPtr); MODULE_SCOPE Tcl_Obj *const * TclFetchEnsembleRoot(Tcl_Interp *interp, Tcl_Obj *const *objv, int objc, int *objcPtr); -Tcl_Namespace * TclEnsureNamespace( - Tcl_Interp *interp, +MODULE_SCOPE Tcl_Namespace * TclEnsureNamespace(Tcl_Interp *interp, Tcl_Namespace *namespacePtr); MODULE_SCOPE void TclFinalizeAllocSubsystem(void); diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index d212de1..269d06b 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -402,7 +402,7 @@ Tcl_PopCallFrame( } if (framePtr->numCompiledLocals > 0) { TclDeleteCompiledLocalVars(iPtr, framePtr); - if (--framePtr->localCachePtr->refCount == 0) { + if (framePtr->localCachePtr->refCount-- <= 1) { TclFreeLocalCache(interp, framePtr->localCachePtr); } framePtr->localCachePtr = NULL; @@ -1052,7 +1052,7 @@ Tcl_DeleteNamespace( * Otherwise, mark it as "dead" so that it can't be used. */ - if (nsPtr->refCount == 0) { + if (!nsPtr->refCount) { NamespaceFree(nsPtr); } else { nsPtr->flags |= NS_DEAD; diff --git a/generic/tclProc.c b/generic/tclProc.c index b89357c..70dc4dc 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -2380,7 +2380,7 @@ FreeLambdaInternalRep( Proc *procPtr = objPtr->internalRep.twoPtrValue.ptr1; Tcl_Obj *nsObjPtr = objPtr->internalRep.twoPtrValue.ptr2; - if (procPtr->refCount-- == 1) { + if (procPtr->refCount-- <= 1) { TclProcCleanupProc(procPtr); } TclDecrRefCount(nsObjPtr); -- cgit v0.12 From f4cc39572c905ad4837ec43edf9650d528e2b34d Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 19 Dec 2017 14:46:31 +0000 Subject: update changes --- changes | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/changes b/changes index 7a85768..48e4624 100644 --- a/changes +++ b/changes @@ -8825,4 +8825,6 @@ improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) 2017-12-06 (bug)[ce3a21] file normalize failure when tail is empty (porter) ---- Released 8.6.8, December XX, 2017 --- http://core.tcl.tk/tcl/ for details +2017-12-08 (new)[TIP 477] nmake build system reform (nadkarni) + +--- Released 8.6.8, December 22, 2017 --- http://core.tcl.tk/tcl/ for details -- cgit v0.12 From 07c71d17a255fb07143dbb73659a64a589a214f6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 19 Dec 2017 15:20:32 +0000 Subject: Somewhat better backwards compatibility on 64-bit platforms. --- generic/tclObj.c | 4 ++-- generic/tclTestObj.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/generic/tclObj.c b/generic/tclObj.c index 183ad7f..8ec95ce 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -262,10 +262,10 @@ const Tcl_ObjType tclDoubleType = { SetDoubleFromAny /* setFromAnyProc */ }; const Tcl_ObjType tclIntType = { -#if defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8 +#if defined(TCL_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8 || defined(TCL_WIDE_INT_IS_LONG) "int", /* name */ #else - "wideInt", /* name, keeping maximum compatibility with Tcl 8.6 */ + "wideInt", /* name, keeping maximum compatibility with Tcl 8.6 on 32-bit platforms*/ #endif NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index 6b08761..547792a 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -1088,7 +1088,9 @@ TestobjCmd( Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1)); } else { typeName = objv[2]->typePtr->name; +#ifndef TCL_WIDE_INT_IS_LONG if (!strcmp(typeName, "wideInt")) typeName = "int"; +#endif Tcl_SetObjResult(interp, Tcl_NewStringObj(typeName, -1)); } } else if (strcmp(subCmd, "refcount") == 0) { @@ -1116,9 +1118,11 @@ TestobjCmd( } if (varPtr[varIndex]->typePtr == NULL) { /* a string! */ Tcl_AppendToObj(Tcl_GetObjResult(interp), "string", -1); +#ifndef TCL_WIDE_INT_IS_LONG } else if (!strcmp(varPtr[varIndex]->typePtr->name, "wideInt")) { Tcl_AppendToObj(Tcl_GetObjResult(interp), "int", -1); +#endif } else { Tcl_AppendToObj(Tcl_GetObjResult(interp), varPtr[varIndex]->typePtr->name, -1); -- cgit v0.12 From e10cd2e0a52b97a25e6e05658f8f96b2f53bf45c Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 19 Dec 2017 20:48:52 +0000 Subject: [586e71dce4] Exeception handling at level #0 by EvalObjv --- generic/tclBasic.c | 2 +- tests/basic.test | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 79de61e..ddc828a 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4561,7 +4561,7 @@ TEOV_Exception( if (result == TCL_RETURN) { result = TclUpdateReturnInfo(iPtr); } - if ((result != TCL_ERROR) && !allowExceptions) { + if ((result != TCL_OK) && (result != TCL_ERROR) && !allowExceptions) { ProcessUnexpectedResult(interp, result); result = TCL_ERROR; } diff --git a/tests/basic.test b/tests/basic.test index 7ff0669..865814a 100644 --- a/tests/basic.test +++ b/tests/basic.test @@ -984,6 +984,16 @@ test basic-49.2 {Tcl_EvalEx: verify TCL_EVAL_GLOBAL operation} testevalex { set ::context } {global} +test basic-50.1 {[586e71dce4] EvalObjv level #0 exception handling} -setup { + interp create slave + interp alias {} foo slave return +} -body { + list [catch foo m] $m +} -cleanup { + unset -nocomplain m + interp delete slave +} -result {0 {}} + # Clean up after expand tests unset noComp l1 l2 constraints rename l3 {} -- cgit v0.12 From dc40e6f7975ff3abcea929e29493bdc7e44c1843 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 20 Dec 2017 11:28:25 +0000 Subject: Fix for issue [ba1419303b4c]: Delete a namespace for an ensemble having a deletion trace deletes its namespace: segmentation fault. --- generic/tclNamesp.c | 17 +++++++---------- tests/namespace.test | 13 +++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 269d06b..de10fae 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -916,6 +916,11 @@ Tcl_DeleteNamespace( Command *cmdPtr; /* + * Ensure that this namespace doesn't get deallocated in the meantime. + */ + nsPtr->refCount++; + + /* * Give anyone interested - notably TclOO - a chance to use this namespace * normally despite the fact that the namespace is going to go. Allows the * calling of destructors. Will only be called once (unless re-established @@ -1047,16 +1052,8 @@ Tcl_DeleteNamespace( #endif 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. - */ - - if (!nsPtr->refCount) { - NamespaceFree(nsPtr); - } else { - nsPtr->flags |= NS_DEAD; - } + nsPtr ->flags |= NS_DEAD; + TclNsDecrRefCount(nsPtr); } else { /* * Restore the ::errorInfo and ::errorCode traces. diff --git a/tests/namespace.test b/tests/namespace.test index 9fa9331..b9e6ead 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -196,6 +196,19 @@ test namespace-7.7 {Bug 1655305} -setup { interp delete slave } -result {} +test namespace-7.8 {Bug ba1419303b4c} -setup { + namespace eval ns1 { + namespace ensemble create + } + + trace add command ns1 delete { + namespace delete ns1 + } +} -body { + # No segmentation fault given --enable-symbols=mem. + namespace delete ns1 +} -result {} + test namespace-8.1 {TclTeardownNamespace, delete global namespace} { catch {interp delete test_interp} interp create test_interp -- cgit v0.12 From 5e11793221791b79a9aa3140e6a77c1fe64ec2e9 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 20 Dec 2017 18:25:08 +0000 Subject: Further fix for issue [ba1419303b4c]: Delete a namespace for an ensemble having a deletion trace deletes its namespace: segmentation fault. --- generic/tclNamesp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index de10fae..f82d23d 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -1053,7 +1053,6 @@ Tcl_DeleteNamespace( Tcl_DeleteHashTable(&nsPtr->cmdTable); nsPtr ->flags |= NS_DEAD; - TclNsDecrRefCount(nsPtr); } else { /* * Restore the ::errorInfo and ::errorCode traces. @@ -1070,6 +1069,7 @@ Tcl_DeleteNamespace( nsPtr->flags &= ~(NS_DYING|NS_KILLED); } } + TclNsDecrRefCount(nsPtr); } /* -- cgit v0.12 From c1f84789ba402e590faed95132cf3f621c9bd0bf Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 20 Dec 2017 18:26:40 +0000 Subject: Fix for issue [ba1419303b4c]: Delete a namespace for an ensemble having a deletion trace deletes its namespace: segmentation fault. --- generic/tclNamesp.c | 17 +++++++---------- tests/namespace.test | 13 +++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index a8d351f..542d648 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -916,6 +916,11 @@ Tcl_DeleteNamespace( Command *cmdPtr; /* + * Ensure that this namespace doesn't get deallocated in the meantime. + */ + nsPtr->refCount++; + + /* * Give anyone interested - notably TclOO - a chance to use this namespace * normally despite the fact that the namespace is going to go. Allows the * calling of destructors. Will only be called once (unless re-established @@ -1047,16 +1052,8 @@ Tcl_DeleteNamespace( #endif 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. - */ - - if (nsPtr->refCount == 0) { - NamespaceFree(nsPtr); - } else { - nsPtr->flags |= NS_DEAD; - } + nsPtr ->flags |= NS_DEAD; + TclNsDecrRefCount(nsPtr); } else { /* * Restore the ::errorInfo and ::errorCode traces. diff --git a/tests/namespace.test b/tests/namespace.test index ff8cd7d..f2d7061 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -196,6 +196,19 @@ test namespace-7.7 {Bug 1655305} -setup { interp delete slave } -result {} +test namespace-7.8 {Bug ba1419303b4c} -setup { + namespace eval ns1 { + namespace ensemble create + } + + trace add command ns1 delete { + namespace delete ns1 + } +} -body { + # No segmentation fault given --enable-symbols=mem. + namespace delete ns1 +} -result {} + test namespace-8.1 {TclTeardownNamespace, delete global namespace} { catch {interp delete test_interp} interp create test_interp -- cgit v0.12 From 28361a2bfe9fdba5dd0effa2c67390b21649e719 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 20 Dec 2017 18:28:10 +0000 Subject: Further fix for issue [ba1419303b4c]: Delete a namespace for an ensemble having a deletion trace deletes its namespace: segmentation fault. --- generic/tclNamesp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index 542d648..ba8e8ce 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -1053,7 +1053,6 @@ Tcl_DeleteNamespace( Tcl_DeleteHashTable(&nsPtr->cmdTable); nsPtr ->flags |= NS_DEAD; - TclNsDecrRefCount(nsPtr); } else { /* * Restore the ::errorInfo and ::errorCode traces. @@ -1070,6 +1069,7 @@ Tcl_DeleteNamespace( nsPtr->flags &= ~(NS_DYING|NS_KILLED); } } + TclNsDecrRefCount(nsPtr); } /* -- cgit v0.12 From 5a190dd003f0caaee265f6664bd1bbee842a2d66 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 21 Dec 2017 13:23:38 +0000 Subject: Remove use of compiler option "opt:nowin98". Don't use "t" as suffix any more when building extensions (but still use it for Tcl and Tk). --- win/rules.vc | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 7fc51c1..fac9af9 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -394,7 +394,7 @@ MSG = ^ # If INSTALLDIR set to tcl installation root dir then reset to the -# lib dir for installing extensions +# lib dir for installing extensions !if exist("$(_INSTALLDIR)\include\tcl.h") _INSTALLDIR=$(_INSTALLDIR)\lib !endif @@ -547,7 +547,7 @@ NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c # The following macros are set: # OPTIMIZATIONS - the compiler flags to be used for optimized builds # DEBUGFLAGS - the compiler flags to be used for debug builds -# LINKERFLAGS - Flags passed to the linker +# LINKERFLAGS - Flags passed to the linker # # Note that these are the compiler settings *available*, not those # that will be *used*. The latter depends on the OPTS macro settings @@ -1063,7 +1063,7 @@ STUBPREFIX = $(PROJECT)stub # Set up paths to various Tcl executables and libraries needed by extensions !if $(DOING_TCL) -TCLSHNAME = $(PROJECT)sh$(TCL_VERSION)$(SUFX).exe +TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe TCLSH = $(OUT_DIR)\$(TCLSHNAME) TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) @@ -1153,8 +1153,8 @@ tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)" !endif # $(DOING_TK) || $(NEED_TK) # Various output paths -PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib -PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) +PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX:t=).lib +PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX:t=).$(EXT) PRJLIB = $(OUT_DIR)\$(PRJLIBNAME) PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib @@ -1291,7 +1291,7 @@ USE_WIDECHAR_API = 0 !endif !if $(USE_WIDECHAR_API) -COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE +COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE !endif # Like the TEA system only set this non empty for non-Tk extensions @@ -1301,7 +1301,7 @@ COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE PKGNAMEFLAGS = -DPACKAGE_NAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ -DPACKAGE_TCLNAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \ -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \ - -DMODULE_SCOPE=extern + -DMODULE_SCOPE=extern !endif # crt picks the C run time based on selected OPTS @@ -1394,7 +1394,7 @@ pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT) # compiled with another VC version. Check for this and fix accordingly. stubscflags = $(cflags) $(PKGNAMEFLAGS) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(INCLUDES) -# Link flags +# Link flags !if $(DEBUG) ldebug = -debug -debugtype:cv @@ -1410,25 +1410,13 @@ ldebug = $(ldebug) -debug -debugtype:cv ldebug= $(ldebug) -profile !endif -### Declarations common to all linker versions +### Declarations common to all linker versions lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) !if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 lflags = $(lflags) -nodefaultlib:libucrt.lib !endif -# Old linkers (Visual C++ 6 in particular) will link for fast loading -# on Win98. Since we do not support Win98 any more, we specify nowin98 -# as recommended for NT and later. However, this is only required by -# IX86 on older compilers and only needed if we are not doing a static build. - -!if "$(MACHINE)" == "IX86" && !$(STATIC_BUILD) -!if [nmakehlp -l -opt:nowin98 $(LINKER_TESTFLAGS)] -# Align sections for PE size savings. -lflags = $(lflags) -opt:nowin98 -!endif -!endif - dlllflags = $(lflags) -dll conlflags = $(lflags) -subsystem:console guilflags = $(lflags) -subsystem:windows @@ -1473,9 +1461,9 @@ RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ -DCOMMAVERSION=$(DOTVERSION:.=,),0 \ -DDOTVERSION=\"$(DOTVERSION)\" \ -DVERSION=\"$(VERSION)\" \ - -DSUFX=\"$(SUFX)\" \ - -DPROJECT=\"$(PROJECT)\" \ - -DPRJLIBNAME=\"$(PRJLIBNAME)\" + -DSUFX=\"$(SUFX:t=)\" \ + -DPROJECT=\"$(PROJECT)\" \ + -DPRJLIBNAME=\"$(PRJLIBNAME)\" !ifndef DEFAULT_BUILD_TARGET DEFAULT_BUILD_TARGET = $(PROJECT) @@ -1572,7 +1560,7 @@ default-shell: default-setup $(PROJECT) @if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)" $(DEBUGGER) $(TCLSH) -# Generation of Windows version resource +# Generation of Windows version resource !ifdef RCFILE # Note: don't use $** in below rule because there may be other dependencies @@ -1611,7 +1599,7 @@ BEGIN VALUE "OriginalFilename", PRJLIBNAME VALUE "FileVersion", DOTVERSION VALUE "ProductName", "Package " PROJECT " for Tcl" - VALUE "ProductVersion", DOTVERSION + VALUE "ProductVersion", DOTVERSION END END BLOCK "VarFileInfo" -- cgit v0.12 From 189c6453b43325f74f5b004694c79c5786d918c1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 22 Dec 2017 15:45:05 +0000 Subject: Change a few (internal) refCount/mask variables to unsigned type. --- generic/tclInt.h | 9 ++++----- generic/tclLiteral.c | 23 ++++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index de22924..2ba0493 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -545,7 +545,7 @@ typedef struct CommandTrace { struct CommandTrace *nextPtr; /* Next in list of traces associated with a * particular command. */ - unsigned int refCount; /* Used to ensure this structure is not + size_t refCount; /* Used to ensure this structure is not * deleted too early. Keeps track of how many * pieces of code have a pointer to this * structure. */ @@ -1492,11 +1492,11 @@ typedef struct LiteralEntry { * NULL if end of chain. */ Tcl_Obj *objPtr; /* Points to Tcl object that holds the * literal's bytes and length. */ - int refCount; /* If in an interpreter's global literal + size_t refCount; /* If in an interpreter's global literal * table, the number of ByteCode structures * that share the literal object; the literal * entry can be freed when refCount drops to - * 0. If in a local literal table, -1. */ + * 0. If in a local literal table, (size_t)-1. */ Namespace *nsPtr; /* Namespace in which this literal is used. We * try to avoid sharing literal non-FQ command * names among different namespaces to reduce @@ -1516,7 +1516,7 @@ typedef struct LiteralTable { * table. */ int rebuildSize; /* Enlarge table when numEntries gets to be * this large. */ - int mask; /* Mask value used in hashing function. */ + unsigned int mask; /* Mask value used in hashing function. */ } LiteralTable; /* @@ -2962,7 +2962,6 @@ MODULE_SCOPE Tcl_Obj *const * TclFetchEnsembleRoot(Tcl_Interp *interp, Tcl_Obj *const *objv, int objc, int *objcPtr); MODULE_SCOPE Tcl_Namespace * TclEnsureNamespace(Tcl_Interp *interp, Tcl_Namespace *namespacePtr); - MODULE_SCOPE void TclFinalizeAllocSubsystem(void); MODULE_SCOPE void TclFinalizeAsync(void); MODULE_SCOPE void TclFinalizeDoubleConversion(void); diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c index 7acc9ad..003884d 100644 --- a/generic/tclLiteral.c +++ b/generic/tclLiteral.c @@ -186,7 +186,7 @@ TclCreateLiteral( { LiteralTable *globalTablePtr = &iPtr->literalTable; LiteralEntry *globalPtr; - int globalHash; + unsigned int globalHash; Tcl_Obj *objPtr; /* @@ -393,7 +393,8 @@ TclRegisterLiteral( LiteralEntry *globalPtr, *localPtr; Tcl_Obj *objPtr; unsigned hash; - int localHash, objIndex, new; + unsigned int localHash; + int objIndex, new; Namespace *nsPtr; if (length < 0) { @@ -537,7 +538,8 @@ TclHideLiteral( { LiteralEntry **nextPtrPtr, *entryPtr, *lPtr; LiteralTable *localTablePtr = &envPtr->localLitTable; - int localHash, length; + unsigned int localHash; + int length; const char *bytes; Tcl_Obj *newObjPtr; @@ -556,7 +558,7 @@ TclHideLiteral( lPtr->objPtr = newObjPtr; bytes = TclGetStringFromObj(newObjPtr, &length); - localHash = (HashString(bytes, length) & localTablePtr->mask); + localHash = HashString(bytes, length) & localTablePtr->mask; nextPtrPtr = &localTablePtr->buckets[localHash]; for (entryPtr=*nextPtrPtr ; entryPtr!=NULL ; entryPtr=*nextPtrPtr) { @@ -612,7 +614,7 @@ TclAddLiteralObj( lPtr = &envPtr->literalArrayPtr[objIndex]; lPtr->objPtr = objPtr; Tcl_IncrRefCount(objPtr); - lPtr->refCount = -1; /* i.e., unused */ + lPtr->refCount = (size_t)-1; /* i.e., unused */ lPtr->nextPtr = NULL; if (litPtrPtr) { @@ -809,7 +811,8 @@ TclReleaseLiteral( LiteralTable *globalTablePtr; register LiteralEntry *entryPtr, *prevPtr; const char *bytes; - int length, index; + int length; + unsigned int index; if (iPtr == NULL) { goto done; @@ -828,15 +831,13 @@ TclReleaseLiteral( for (prevPtr=NULL, entryPtr=globalTablePtr->buckets[index]; entryPtr!=NULL ; prevPtr=entryPtr, entryPtr=entryPtr->nextPtr) { if (entryPtr->objPtr == objPtr) { - entryPtr->refCount--; - /* * If the literal is no longer being used by any ByteCode, delete * the entry then remove the reference corresponding to the global * literal table entry (decrement the ref count of the object). */ - if (entryPtr->refCount == 0) { + if (entryPtr->refCount-- <= 1) { if (prevPtr == NULL) { globalTablePtr->buckets[index] = entryPtr->nextPtr; } else { @@ -954,8 +955,8 @@ RebuildLiteralTable( register LiteralEntry *entryPtr; LiteralEntry **bucketPtr; const char *bytes; - unsigned int oldSize; - int count, index, length; + unsigned int oldSize, index; + int count, length; oldSize = tablePtr->numBuckets; oldBuckets = tablePtr->buckets; -- cgit v0.12 From 71df313773a17633c53ba346987ded358542560a Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Sat, 23 Dec 2017 07:56:49 +0000 Subject: Look for Tcl and Tk import libraries with or without "t" suffix convention when building extensions. Bump nmake rules version to 1.1 accordingly. --- win/rules.vc | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 7fc51c1..543e959 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -24,7 +24,7 @@ _RULES_VC = 1 # For modifications that are not backward-compatible, you *must* change # the major version. RULES_VERSION_MAJOR = 1 -RULES_VERSION_MINOR = 0 +RULES_VERSION_MINOR = 1 # The PROJECT macro must be defined by parent makefile. !if "$(PROJECT)" == "" @@ -535,7 +535,6 @@ NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c # We always build nmakehlp even if it exists since we do not know # what source it was built from. -!message *** Using $(NMAKEHLPC) !if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul] !endif @@ -590,7 +589,6 @@ FPOPTS = $(FPOPTS) -QI0f OPTIMIZATIONS = $(FPOPTS) !if [nmakehlp -c -O2] -!message *** Compiler has 'Optimizations' OPTIMIZING = 1 OPTIMIZATIONS = $(OPTIMIZATIONS) -O2 !else @@ -1077,12 +1075,24 @@ TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" !if $(TCLINSTALL) # Building against an installed Tcl +# When building extensions, we need to locate tclsh. Depending on version +# of Tcl we are building against, this may or may not have a "t" suffix. +# Try various possibilities in turn. TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe !if !exist("$(TCLSH)") && $(TCL_THREADS) TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe !endif +!if !exist("$(TCLSH)") +TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:t=).exe +!endif + TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib +# When building extensions, may be linking against Tcl that does not add +# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. +!if !exist("$(TCLIMPLIB)") +TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX:t=).lib +!endif TCL_LIBRARY = $(_TCLDIR)\lib TCLREGLIB = $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib TCLDDELIB = $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib @@ -1095,8 +1105,16 @@ TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe !if !exist($(TCLSH)) && $(TCL_THREADS) TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe !endif +!if !exist($(TCLSH)) +TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:t=).exe +!endif TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib +# When building extensions, may be linking against Tcl that does not add +# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. +!if !exist("$(TCLIMPLIB)") +TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib +!endif TCL_LIBRARY = $(_TCLDIR)\library TCLREGLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib TCLDDELIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib @@ -1140,11 +1158,23 @@ TK_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" WISH = $(_TKDIR)\bin\$(WISHNAME) TKSTUBLIB = $(_TKDIR)\lib\$(TKSTUBLIBNAME) TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME) +# When building extensions, may be linking against Tk that does not add +# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. +!if !exist("$(TKIMPLIB)") +TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX:t=).lib +TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME) +!endif TK_INCLUDES = -I"$(_TKDIR)\include" !else # Building against Tk sources WISH = $(_TKDIR)\win\$(BUILDDIRTOP)\$(WISHNAME) TKSTUBLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME) TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME) +# When building extensions, may be linking against Tk that does not add +# "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. +!if !exist("$(TKIMPLIB)") +TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX:t=).lib +TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME) +!endif TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" !endif # TKINSTALL tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)" @@ -1717,7 +1747,6 @@ TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake" !message *** Output directory will be '$(OUT_DIR)' !message *** Installation, if selected, will be in '$(_INSTALLDIR)' !message *** Suffix for binaries will be '$(SUFX)' -!message *** Compiler version $(VCVER). Target machine is $(MACHINE) -!message *** Host architecture is $(NATIVE_ARCH) +!message *** Compiler version $(VCVER). Target $(MACHINE), host $(NATIVE_ARCH). !endif # ifdef _RULES_VC -- cgit v0.12 From 82cd662f00327eb89fa2951c3f343112b6150e36 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Tue, 26 Dec 2017 03:30:22 +0000 Subject: Safer to compare TCLDIR against "" rather than ifdef as recursive nmakes can pass TCLDIR as defined but with an empty value. --- win/rules-ext.vc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win/rules-ext.vc b/win/rules-ext.vc index 58c70fa..531e070 100644 --- a/win/rules-ext.vc +++ b/win/rules-ext.vc @@ -35,7 +35,7 @@ macro to the name of the project makefile. !endif # First locate the Tcl directory that we are working with. -!ifdef TCLDIR +!if "$(TCLDIR)" != "" _RULESDIR = $(TCLDIR:/=\) -- cgit v0.12 From 9a9b619c9f29470dab9e33b0c593b7e648224515 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Tue, 26 Dec 2017 12:27:14 +0000 Subject: TclOO: Remove unneeded name manipulation from TclOOCopyObjectCmd. --- generic/tclOOBasic.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index b2c06a7..d874cba 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.c @@ -1206,22 +1206,10 @@ TclOOCopyObjectCmd( o2Ptr = Tcl_CopyObjectInstance(interp, oPtr, NULL, NULL); } else { const char *name, *namespaceName; - Tcl_DString buffer; name = TclGetString(objv[2]); - Tcl_DStringInit(&buffer); if (name[0] == '\0') { name = NULL; - } else if (name[0]!=':' || name[1]!=':') { - Interp *iPtr = (Interp *) interp; - - if (iPtr->varFramePtr != NULL) { - Tcl_DStringAppend(&buffer, - iPtr->varFramePtr->nsPtr->fullName, -1); - } - TclDStringAppendLiteral(&buffer, "::"); - Tcl_DStringAppend(&buffer, name, -1); - name = Tcl_DStringValue(&buffer); } /* @@ -1243,7 +1231,6 @@ TclOOCopyObjectCmd( } o2Ptr = Tcl_CopyObjectInstance(interp, oPtr, name, namespaceName); - Tcl_DStringFree(&buffer); } if (o2Ptr == NULL) { -- cgit v0.12 From 9a7ce78e965b9066530810b359b0b968667de251 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 28 Dec 2017 18:45:16 +0000 Subject: Make Tcl_WinTCharToUtf/Tcl_WinUtfToTChar work when TCL_UTF_MAX > 3, mainly when sizeof(Tcl_UniChar) != 2. --- doc/Encoding.3 | 4 ---- generic/tclStubInit.c | 34 +++++++++++++++++++++++++++++- unix/tclUnixPort.h | 4 ++-- win/tclWin32Dll.c | 57 +++++++++++++++++++++++++++++++++++++++------------ 4 files changed, 79 insertions(+), 20 deletions(-) diff --git a/doc/Encoding.3 b/doc/Encoding.3 index 81ef508..79fca0f 100644 --- a/doc/Encoding.3 +++ b/doc/Encoding.3 @@ -260,10 +260,6 @@ Windows-only convenience functions for converting between UTF-8 and Windows strings based on the TCHAR type which is by convention a Unicode character on Windows NT. -These functions are essentially wrappers around -\fBTcl_UtfToExternalDString\fR and -\fBTcl_ExternalToUtfDString\fR that convert to and from the -Unicode encoding. .PP \fBTcl_GetEncodingName\fR is roughly the inverse of \fBTcl_GetEncoding\fR. Given an \fIencoding\fR, the return value is the \fIname\fR argument that diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index b185f04..679a12b 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -106,7 +106,9 @@ static unsigned short TclWinNToHS(unsigned short ns) { # define TclWinFlushDirtyChannels doNothing # define TclWinResetInterfaces doNothing +#if TCL_UTF_MAX < 4 static Tcl_Encoding winTCharEncoding; +#endif static int TclpIsAtty(int fd) @@ -127,7 +129,7 @@ void *TclWinGetTclInstance() { void *hInstance = NULL; GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, - (const char *)&winTCharEncoding, &hInstance); + (const char *)&TclpIsAtty, &hInstance); return hInstance; } @@ -186,11 +188,24 @@ Tcl_WinUtfToTChar( int len, Tcl_DString *dsPtr) { +#if TCL_UTF_MAX > 3 + WCHAR *wp; + int size = MultiByteToWideChar(CP_UTF8, 0, string, len, 0, 0); + + Tcl_DStringInit(dsPtr); + Tcl_DStringSetLength(dsPtr, 2*size+2); + wp = (WCHAR *)Tcl_DStringValue(dsPtr); + MultiByteToWideChar(CP_UTF8, 0, string, len, wp, size+1); + Tcl_DStringSetLength(dsPtr, 2*size); + wp[size] = 0; + return (char *)wp; +#else if (!winTCharEncoding) { winTCharEncoding = Tcl_GetEncoding(0, "unicode"); } return Tcl_UtfToExternalDString(winTCharEncoding, string, len, dsPtr); +#endif } char * @@ -199,11 +214,28 @@ Tcl_WinTCharToUtf( int len, Tcl_DString *dsPtr) { +#if TCL_UTF_MAX > 3 + char *p; + int size; + + if (len > 0) { + len /= 2; + } + size = WideCharToMultiByte(CP_UTF8, 0, string, len, 0, 0, NULL, NULL); + Tcl_DStringInit(dsPtr); + Tcl_DStringSetLength(dsPtr, size+1); + p = (char *)Tcl_DStringValue(dsPtr); + WideCharToMultiByte(CP_UTF8, 0, string, len, p, size, NULL, NULL); + Tcl_DStringSetLength(dsPtr, size); + p[size] = 0; + return p; +#else if (!winTCharEncoding) { winTCharEncoding = Tcl_GetEncoding(0, "unicode"); } return Tcl_ExternalToUtfDString(winTCharEncoding, string, len, dsPtr); +#endif } #if defined(TCL_WIDE_INT_IS_LONG) diff --git a/unix/tclUnixPort.h b/unix/tclUnixPort.h index ba56089..4819f10 100644 --- a/unix/tclUnixPort.h +++ b/unix/tclUnixPort.h @@ -87,8 +87,8 @@ typedef off_t Tcl_SeekOffset; typedef unsigned short WCHAR; __declspec(dllimport) extern __stdcall int GetModuleHandleExW(unsigned int, const char *, void *); __declspec(dllimport) extern __stdcall int GetModuleFileNameW(void *, const char *, int); - __declspec(dllimport) extern __stdcall int WideCharToMultiByte(int, int, const char *, int, - const char *, int, const char *, const char *); + __declspec(dllimport) extern __stdcall int WideCharToMultiByte(int, int, const void *, int, + char *, int, const char *, void *); __declspec(dllimport) extern __stdcall int MultiByteToWideChar(int, int, const char *, int, WCHAR *, int); __declspec(dllimport) extern __stdcall void OutputDebugStringW(const WCHAR *); diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 84c7a97..3add0d1 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -33,7 +33,9 @@ static int platformId; /* Running under NT, or 95/98? */ #define cpuid __asm __emit 0fh __asm __emit 0a2h #endif +#if TCL_UTF_MAX < 4 static Tcl_Encoding winTCharEncoding = NULL; +#endif /* * The following declaration is for the VC++ DLL entry point. @@ -49,7 +51,7 @@ BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, */ typedef struct MountPointMap { - const TCHAR *volumeName; /* Native wide string volume name. */ + TCHAR *volumeName; /* Native wide string volume name. */ TCHAR driveLetter; /* Drive letter corresponding to the volume * name. */ struct MountPointMap *nextPtr; @@ -266,7 +268,7 @@ TclWinNoBackslash( * * TclpSetInterfaces -- * - * A helper proc that initializes winTCharEncoding. + * A helper proc. * * Results: * None. @@ -280,8 +282,10 @@ TclWinNoBackslash( void TclpSetInterfaces(void) { +#if TCL_UTF_MAX < 4 TclWinResetInterfaces(); winTCharEncoding = Tcl_GetEncoding(NULL, "unicode"); +#endif } /* @@ -344,10 +348,12 @@ TclWinEncodingsCleanup(void) void TclWinResetInterfaces(void) { +#if TCL_UTF_MAX < 4 if (winTCharEncoding != NULL) { Tcl_FreeEncoding(winTCharEncoding); winTCharEncoding = NULL; } +#endif } /* @@ -532,13 +538,9 @@ TclWinDriveLetterForVolMountPoint( * (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); - * } + * encoding <- Tcl_GetEncoding("unicode"); + * nativeBuffer <- UtfToExternal(encoding, utfBuffer); + * Tcl_FreeEncoding(encoding); * * 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 @@ -561,26 +563,55 @@ TclWinDriveLetterForVolMountPoint( TCHAR * Tcl_WinUtfToTChar( const char *string, /* Source string in UTF-8. */ - int len, /* Source string length in bytes, or < 0 for + int len, /* Source string length in bytes, or -1 for * strlen(). */ Tcl_DString *dsPtr) /* Uninitialized or free DString in which the * converted string is stored. */ { +#if TCL_UTF_MAX > 3 + TCHAR *wp; + int size = MultiByteToWideChar(CP_UTF8, 0, string, len, 0, 0); + + Tcl_DStringInit(dsPtr); + Tcl_DStringSetLength(dsPtr, 2*size+2); + wp = (TCHAR *)Tcl_DStringValue(dsPtr); + MultiByteToWideChar(CP_UTF8, 0, string, len, wp, size+1); + Tcl_DStringSetLength(dsPtr, 2*size); + wp[size] = 0; + return wp; +#else return (TCHAR *) Tcl_UtfToExternalDString(winTCharEncoding, string, len, dsPtr); +#endif } char * Tcl_WinTCharToUtf( - const TCHAR *string, /* Source string in Unicode when running NT, - * ANSI when running 95. */ - int len, /* Source string length in bytes, or < 0 for + const TCHAR *string, /* Source string in Unicode. */ + int len, /* Source string length in bytes, or -1 for * platform-specific string length. */ Tcl_DString *dsPtr) /* Uninitialized or free DString in which the * converted string is stored. */ { +#if TCL_UTF_MAX > 3 + char *p; + int size; + + if (len > 0) { + len /= 2; + } + size = WideCharToMultiByte(CP_UTF8, 0, string, len, 0, 0, NULL, NULL); + Tcl_DStringInit(dsPtr); + Tcl_DStringSetLength(dsPtr, size+1); + p = (char *)Tcl_DStringValue(dsPtr); + WideCharToMultiByte(CP_UTF8, 0, string, len, p, size, NULL, NULL); + Tcl_DStringSetLength(dsPtr, size); + p[size] = 0; + return p; +#else return Tcl_ExternalToUtfDString(winTCharEncoding, (const char *) string, len, dsPtr); +#endif } /* -- cgit v0.12 From 301f6bcb839b301e1e3d3a92e3713696780c95ca Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 28 Dec 2017 18:49:24 +0000 Subject: Fix handling of surrogates (when TCL_UTF_MAX > 3) in Tcl_UtfNcmp()/Tcl_UtfNcasecmp()/TclUtfCasecmp(). Backported from core-8-branch, where this was fixed already. --- generic/tclPkg.c | 6 +++--- generic/tclUtf.c | 57 ++++++++++++++++++++++++++++---------------------------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 4f6faa8..6d826a9 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -414,7 +414,7 @@ PkgRequireCore( continue; } - + /* Check satisfaction of requirements before considering the current version further. */ if (reqc > 0) { satisfies = SomeRequirementSatisfied(availVersion, reqc, reqv); @@ -424,7 +424,7 @@ PkgRequireCore( continue; } } - + if (bestPtr != NULL) { int res = CompareVersions(availVersion, bestVersion, NULL); @@ -485,7 +485,7 @@ PkgRequireCore( /* * Clean up memorized internal reps, if any. */ - + if (bestVersion != NULL) { ckfree(bestVersion); bestVersion = NULL; diff --git a/generic/tclUtf.c b/generic/tclUtf.c index c60e99e..6255a4e 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -726,8 +726,7 @@ Tcl_UniCharAtIndex( { Tcl_UniChar ch = 0; - while (index >= 0) { - index--; + while (index-- >= 0) { src += TclUtfToUniChar(src, &ch); } return ch; @@ -757,8 +756,7 @@ Tcl_UtfAtIndex( { Tcl_UniChar ch = 0; - while (index > 0) { - index--; + while (index-- > 0) { src += TclUtfToUniChar(src, &ch); } return src; @@ -1072,16 +1070,17 @@ Tcl_UtfNcmp( cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); + if (ch1 != ch2) { #if TCL_UTF_MAX == 4 - /* map high surrogate characters to values > 0xffff */ - if ((ch1 & 0xFC00) == 0xD800) { - ch1 += 0x4000; - } - if ((ch2 & 0xFC00) == 0xD800) { - ch2 += 0x4000; - } + /* Surrogates always report higher than non-surrogates */ + if (((ch1 & 0xFC00) == 0xD800)) { + if ((ch2 & 0xFC00) != 0xD800) { + return ch1; + } + } else if ((ch2 & 0xFC00) == 0xD800) { + return -ch2; + } #endif - if (ch1 != ch2) { return (ch1 - ch2); } } @@ -1122,16 +1121,17 @@ Tcl_UtfNcasecmp( */ cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); + if (ch1 != ch2) { #if TCL_UTF_MAX == 4 - /* map high surrogate characters to values > 0xffff */ - if ((ch1 & 0xFC00) == 0xD800) { - ch1 += 0x4000; - } - if ((ch2 & 0xFC00) == 0xD800) { - ch2 += 0x4000; - } + /* Surrogates always report higher than non-surrogates */ + if (((ch1 & 0xFC00) == 0xD800)) { + if ((ch2 & 0xFC00) != 0xD800) { + return ch1; + } + } else if ((ch2 & 0xFC00) == 0xD800) { + return -ch2; + } #endif - if (ch1 != ch2) { ch1 = Tcl_UniCharToLower(ch1); ch2 = Tcl_UniCharToLower(ch2); if (ch1 != ch2) { @@ -1170,16 +1170,17 @@ TclUtfCasecmp( while (*cs && *ct) { cs += TclUtfToUniChar(cs, &ch1); ct += TclUtfToUniChar(ct, &ch2); + if (ch1 != ch2) { #if TCL_UTF_MAX == 4 - /* map high surrogate characters to values > 0xffff */ - if ((ch1 & 0xFC00) == 0xD800) { - ch1 += 0x4000; - } - if ((ch2 & 0xFC00) == 0xD800) { - ch2 += 0x4000; - } + /* Surrogates always report higher than non-surrogates */ + if (((ch1 & 0xFC00) == 0xD800)) { + if ((ch2 & 0xFC00) != 0xD800) { + return ch1; + } + } else if ((ch2 & 0xFC00) == 0xD800) { + return -ch2; + } #endif - if (ch1 != ch2) { ch1 = Tcl_UniCharToLower(ch1); ch2 = Tcl_UniCharToLower(ch2); if (ch1 != ch2) { -- cgit v0.12 From ad43c617e3fb81c44639a400b8a6d611aa52e3f2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 28 Dec 2017 21:14:40 +0000 Subject: Fix bug introduced in [0dd0d14489258621] (only for TCL_UTF_MAX > 3): If len parameter = -1, returned size includes terminating 0-byte. So, account for that. Also, fix some comments which were not accurate any more, now that Windows 95/98 is not supported any more. --- generic/tclStubInit.c | 2 ++ win/tclWin32Dll.c | 33 ++++++++++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 679a12b..b28d501 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -196,6 +196,7 @@ Tcl_WinUtfToTChar( Tcl_DStringSetLength(dsPtr, 2*size+2); wp = (WCHAR *)Tcl_DStringValue(dsPtr); MultiByteToWideChar(CP_UTF8, 0, string, len, wp, size+1); + if (len == -1) --size; /* account for 0-byte at string end */ Tcl_DStringSetLength(dsPtr, 2*size); wp[size] = 0; return (char *)wp; @@ -226,6 +227,7 @@ Tcl_WinTCharToUtf( Tcl_DStringSetLength(dsPtr, size+1); p = (char *)Tcl_DStringValue(dsPtr); WideCharToMultiByte(CP_UTF8, 0, string, len, p, size, NULL, NULL); + if (len == -1) --size; /* account for 0-byte at string end */ Tcl_DStringSetLength(dsPtr, size); p[size] = 0; return p; diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 3add0d1..6c973df 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -519,35 +519,32 @@ TclWinDriveLetterForVolMountPoint( * * Tcl_WinUtfToTChar, Tcl_WinTCharToUtf -- * - * Convert between UTF-8 and Unicode when running Windows NT or the - * current ANSI code page when running Windows 95. + * Convert between UTF-8 and Unicode when running Windows. * - * 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 Mac and Unix, 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" + * On Windows, 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 + * 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 + * Windows-specific code to convert between UTF-8 and Unicode strings. + * This saves you the trouble of writing the * following type of fragment over and over: * * encoding <- Tcl_GetEncoding("unicode"); * nativeBuffer <- UtfToExternal(encoding, utfBuffer); * Tcl_FreeEncoding(encoding); * - * 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. + * By convention, in Windows a TCHAR is a Unicode character. If you plan + * on targeting a Unicode interface when running on Windows, these + * functions should be used. If you plan on targetting a "char" oriented + * function on Windows, use Tcl_UtfToExternal() with an encoding of NULL. * * Results: * The result is a pointer to the string in the desired target encoding. @@ -576,6 +573,7 @@ Tcl_WinUtfToTChar( Tcl_DStringSetLength(dsPtr, 2*size+2); wp = (TCHAR *)Tcl_DStringValue(dsPtr); MultiByteToWideChar(CP_UTF8, 0, string, len, wp, size+1); + if (len == -1) --size; /* account for 0-byte at string end */ Tcl_DStringSetLength(dsPtr, 2*size); wp[size] = 0; return wp; @@ -605,6 +603,7 @@ Tcl_WinTCharToUtf( Tcl_DStringSetLength(dsPtr, size+1); p = (char *)Tcl_DStringValue(dsPtr); WideCharToMultiByte(CP_UTF8, 0, string, len, p, size, NULL, NULL); + if (len == -1) --size; /* account for 0-byte at string end */ Tcl_DStringSetLength(dsPtr, size); p[size] = 0; return p; -- cgit v0.12 From 0f6d3fd95989e7b5c22a40bbdc90631e3ae10bc1 Mon Sep 17 00:00:00 2001 From: pspjuth Date: Thu, 28 Dec 2017 23:54:57 +0000 Subject: Optimise lrange for unshared object. --- generic/tclExecute.c | 13 +++++++ tests/lrange.test | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f2cda0c..0f501b9 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5140,12 +5140,25 @@ TEBCresume( if (toIdx >= objc) { toIdx = objc-1; } + + /* + * If we are just removing the beginning or the end from an + * unshared object, Tcl_ListObjReplace is very efficient, and also + * guarantees a pure list. + */ + if (fromIdx == 0 && toIdx != objc-1 && !Tcl_IsShared(valuePtr)) { Tcl_ListObjReplace(interp, valuePtr, toIdx + 1, LIST_MAX, 0, NULL); TRACE_APPEND(("%.30s\n", O2S(valuePtr))); NEXT_INST_F(9, 0, 0); } + if (toIdx == objc-1 && !Tcl_IsShared(valuePtr)) { + Tcl_ListObjReplace(interp, valuePtr, + 0, fromIdx, 0, NULL); + TRACE_APPEND(("%.30s\n", O2S(valuePtr))); + NEXT_INST_F(9, 0, 0); + } objResultPtr = Tcl_NewListObj(toIdx-fromIdx+1, objv+fromIdx); } else { TclNewObj(objResultPtr); diff --git a/tests/lrange.test b/tests/lrange.test index 02b9c65..0b1a7ca 100644 --- a/tests/lrange.test +++ b/tests/lrange.test @@ -90,6 +90,108 @@ test lrange-3.1 {Bug 3588366: end-offsets before start} { lrange $l 0 end-5 }} {1 2 3 4 5} } {} + +test lrange-4.1 {lrange pure promise} -body { + set ll1 [list $tcl_version 2 3 4] + # Shared + set ll2 $ll1 + # With string rep + string length $ll1 + set rep1 [tcl::unsupported::representation $ll1] + # Get new pure object + set x [lrange $ll1 0 end] + set rep2 [tcl::unsupported::representation $x] + regexp {object pointer at (\S+)} $rep1 -> obj1 + regexp {object pointer at (\S+)} $rep2 -> obj2 + list $rep1 $rep2 [string equal $obj1 $obj2] + # Check for a new clean object +} -match glob -result {*value is *refcount of 3,*, string rep*value is*refcount of 2,* no string rep* 0} + +test lrange-4.2 {lrange pure promise} -body { + set ll1 [list $tcl_version 2 3 4] + # Shared + set ll2 $ll1 + # With string rep + string length $ll1 + set rep1 [tcl::unsupported::representation $ll1] + # Get new pure object, not compiled + set x [[string cat l range] $ll1 0 end] + set rep2 [tcl::unsupported::representation $x] + regexp {object pointer at (\S+)} $rep1 -> obj1 + regexp {object pointer at (\S+)} $rep2 -> obj2 + list $rep1 $rep2 [string equal $obj1 $obj2] + # Check for a new clean object +} -match glob -result {*value is *refcount of 3,*, string rep*value is*refcount of 2,* no string rep* 0} + +test lrange-4.3 {lrange pure promise} -body { + set ll1 [list $tcl_version 2 3 4] + # With string rep + string length $ll1 + set rep1 [tcl::unsupported::representation $ll1] + # Get pure object, unshared + set ll2 [lrange $ll1[set ll1 {}] 0 end] + set rep2 [tcl::unsupported::representation $ll2] + regexp {object pointer at (\S+)} $rep1 -> obj1 + regexp {object pointer at (\S+)} $rep2 -> obj2 + list $rep1 $rep2 [string equal $obj1 $obj2] + # Internal optimisations should keep the same object +} -match glob -result {*value is *refcount of 2,*, string rep*value is*refcount of 2,* no string rep* 1} + +test lrange-4.4 {lrange pure promise} -body { + set ll1 [list $tcl_version 2 3 4] + # With string rep + string length $ll1 + set rep1 [tcl::unsupported::representation $ll1] + # Get pure object, unshared, not compiled + set ll2 [[string cat l range] $ll1[set ll1 {}] 0 end] + set rep2 [tcl::unsupported::representation $ll2] + regexp {object pointer at (\S+)} $rep1 -> obj1 + regexp {object pointer at (\S+)} $rep2 -> obj2 + list $rep1 $rep2 [string equal $obj1 $obj2] + # Internal optimisations should keep the same object +} -match glob -result {*value is *refcount of 2,*, string rep*value is*refcount of 2,* no string rep* 1} + +# Testing for compiled vs non-compiled behaviour, and shared vs non-shared. +# Far too many variations to check with spelt-out tests. +# Note that this *just* checks whether the different versions are the same +# not whether any of them is correct. +apply {{} { + set lss {{} {a} {a b c} {a b c d}} + set idxs {-2 -1 0 1 2 3 end-3 end-2 end-1 end end+1 end+2} + set lrange lrange + + foreach ls $lss { + foreach a $idxs { + foreach b $idxs { + # Shared, uncompiled + set ls2 $ls + set expected [list [catch {$lrange $ls $a $b} m] $m] + # Shared, compiled + set tester [list lrange $ls $a $b] + set script [list catch $tester m] + set script "list \[$script\] \$m" + test lrange-5.[incr n].1 {lrange shared compiled} \ + [list apply [list {} $script]] $expected + # Unshared, uncompiled + set tester [string map [list %l [list $ls] %a $a %b $b] { + [string cat l range] [lrange %l 0 end] %a %b + }] + set script [list catch $tester m] + set script "list \[$script\] \$m" + test lrange-5.$n.2 {lrange unshared uncompiled} \ + [list apply [list {} $script]] $expected + # Unshared, compiled + set tester [string map [list %l [list $ls] %a $a %b $b] { + lrange [lrange %l 0 end] %a %b + }] + set script [list catch $tester m] + set script "list \[$script\] \$m" + test lrange-5.$n.3 {lrange unshared compiled} \ + [list apply [list {} $script]] $expected + } + } + } +}} # cleanup ::tcltest::cleanupTests -- cgit v0.12 From 6631e46bd3d3c18c60f319c4879ce8682f954229 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 29 Dec 2017 16:49:47 +0000 Subject: Remove handling of http 1.0 package files from Makefiles. --- unix/Makefile.in | 9 ++------- win/Makefile.in | 7 +------ win/makefile.vc | 3 --- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index f3b9782..244ad29 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -829,7 +829,7 @@ install-libraries: libraries else true; \ fi; \ done; - @for i in opt0.4 http1.0 encoding ../tcl8 ../tcl8/8.4 ../tcl8/8.4/platform ../tcl8/8.5 ../tcl8/8.6; \ + @for i in opt0.4 encoding ../tcl8 ../tcl8/8.4 ../tcl8/8.4/platform ../tcl8/8.5 ../tcl8/8.6; \ do \ if [ ! -d "$(SCRIPT_INSTALL_DIR)"/$$i ] ; then \ echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \ @@ -843,11 +843,6 @@ install-libraries: libraries do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"; \ done; - @echo "Installing package http1.0 files to $(SCRIPT_INSTALL_DIR)/http1.0/"; - @for i in $(TOP_DIR)/library/http1.0/*.tcl ; \ - do \ - $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/http1.0; \ - done; @echo "Installing package http 2.8.12 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/http/http.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.6/http-2.8.12.tm; @echo "Installing package opt0.4 files to $(SCRIPT_INSTALL_DIR)/opt0.4/"; @@ -2010,7 +2005,7 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tclConfig.h.in $(UNIX_DIR)/tcl.pc.in $(M @mkdir $(DISTDIR)/library cp -p $(TOP_DIR)/license.terms $(TOP_DIR)/library/*.tcl \ $(TOP_DIR)/library/tclIndex $(DISTDIR)/library - for i in http1.0 http opt msgcat reg dde tcltest platform; \ + for i in http opt msgcat reg dde tcltest platform; \ do \ mkdir $(DISTDIR)/library/$$i ;\ cp -p $(TOP_DIR)/library/$$i/*.tcl $(DISTDIR)/library/$$i; \ diff --git a/win/Makefile.in b/win/Makefile.in index a3275ba..5be7492 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -630,7 +630,7 @@ install-libraries: libraries install-tzdata install-msgs else true; \ fi; \ done; - @for i in http1.0 opt0.4 encoding ../tcl8 ../tcl8/8.4 ../tcl8/8.4/platform ../tcl8/8.5 ../tcl8/8.6; \ + @for i in opt0.4 encoding ../tcl8 ../tcl8/8.4 ../tcl8/8.4/platform ../tcl8/8.5 ../tcl8/8.6; \ do \ if [ ! -d $(SCRIPT_INSTALL_DIR)/$$i ] ; then \ echo "Making directory $(SCRIPT_INSTALL_DIR)/$$i"; \ @@ -652,11 +652,6 @@ install-libraries: libraries install-tzdata install-msgs do \ $(COPY) "$$i" "$(SCRIPT_INSTALL_DIR)"; \ done; - @echo "Installing library http1.0 directory"; - @for j in $(ROOT_DIR)/library/http1.0/*.tcl; \ - do \ - $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/http1.0"; \ - done; @echo "Installing package http 2.8.12 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/http/http.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.6/http-2.8.12.tm; @echo "Installing library opt0.4 directory"; diff --git a/win/makefile.vc b/win/makefile.vc index de80452..64717af 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -860,9 +860,6 @@ install-libraries: tclConfig tcl-nmake install-msgs install-tzdata @$(CPY) "$(WINDIR)\targets.vc" "$(LIB_INSTALL_DIR)\nmake\" @$(CPY) "$(WINDIR)\nmakehlp.c" "$(LIB_INSTALL_DIR)\nmake\" @$(CPY) "$(OUT_DIR)\tcl.nmake" "$(LIB_INSTALL_DIR)\nmake\" - @echo Installing library http1.0 directory - @$(CPY) "$(ROOT)\library\http1.0\*.tcl" \ - "$(SCRIPT_INSTALL_DIR)\http1.0\" @echo Installing library opt0.4 directory @$(CPY) "$(ROOT)\library\opt\*.tcl" \ "$(SCRIPT_INSTALL_DIR)\opt0.4\" -- cgit v0.12 From a922e9fd15daadaa80f131c7cb9884423e6873a3 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 29 Dec 2017 16:54:50 +0000 Subject: Remove http 1.0 files from fossil management. --- library/http1.0/http.tcl | 377 ------------------------------------------- library/http1.0/pkgIndex.tcl | 11 -- 2 files changed, 388 deletions(-) delete mode 100644 library/http1.0/http.tcl delete mode 100644 library/http1.0/pkgIndex.tcl diff --git a/library/http1.0/http.tcl b/library/http1.0/http.tcl deleted file mode 100644 index 8329de4..0000000 --- a/library/http1.0/http.tcl +++ /dev/null @@ -1,377 +0,0 @@ -# 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 http.n man page for documentation - -package provide http 1.0 - -array set http { - -accept */* - -proxyhost {} - -proxyport {} - -useragent {Tcl http client package 1.0} - -proxyfilter httpProxyRequired -} -proc http_config {args} { - global http - set options [lsort [array names http -*]] - set usage [join $options ", "] - if {[llength $args] == 0} { - set result {} - foreach name $options { - lappend result $name $http($name) - } - return $result - } - regsub -all -- - $options {} options - set pat ^-([join $options |])$ - if {[llength $args] == 1} { - set flag [lindex $args 0] - if {[regexp -- $pat $flag]} { - return $http($flag) - } else { - return -code error "Unknown option $flag, must be: $usage" - } - } else { - foreach {flag value} $args { - if {[regexp -- $pat $flag]} { - set http($flag) $value - } else { - return -code error "Unknown option $flag, must be: $usage" - } - } - } -} - - proc httpFinish { token {errormsg ""} } { - upvar #0 $token state - global errorInfo errorCode - if {[string length $errormsg] != 0} { - set state(error) [list $errormsg $errorInfo $errorCode] - set state(status) error - } - catch {close $state(sock)} - catch {after cancel $state(after)} - if {[info exists state(-command)]} { - if {[catch {eval $state(-command) {$token}} err]} { - if {[string length $errormsg] == 0} { - set state(error) [list $err $errorInfo $errorCode] - set state(status) error - } - } - unset state(-command) - } -} -proc http_reset { token {why reset} } { - upvar #0 $token state - set state(status) $why - catch {fileevent $state(sock) readable {}} - httpFinish $token - if {[info exists state(error)]} { - set errorlist $state(error) - unset state(error) - eval error $errorlist - } -} -proc http_get { url args } { - global http - if {![info exists http(uid)]} { - set http(uid) 0 - } - set token http#[incr http(uid)] - upvar #0 $token state - http_reset $token - array set state { - -blocksize 8192 - -validate 0 - -headers {} - -timeout 0 - state header - meta {} - currentsize 0 - totalsize 0 - type text/html - body {} - status "" - } - set options {-blocksize -channel -command -handler -headers \ - -progress -query -validate -timeout} - set usage [join $options ", "] - regsub -all -- - $options {} options - set pat ^-([join $options |])$ - foreach {flag value} $args { - if {[regexp $pat $flag]} { - # Validate numbers - if {[info exists state($flag)] && \ - [regexp {^[0-9]+$} $state($flag)] && \ - ![regexp {^[0-9]+$} $value]} { - return -code error "Bad value for $flag ($value), must be integer" - } - set state($flag) $value - } else { - return -code error "Unknown option $flag, can be: $usage" - } - } - if {! [regexp -nocase {^(http://)?([^/:]+)(:([0-9]+))?(/.*)?$} $url \ - x proto host y port srvurl]} { - error "Unsupported URL: $url" - } - if {[string length $port] == 0} { - set port 80 - } - if {[string length $srvurl] == 0} { - set srvurl / - } - if {[string length $proto] == 0} { - set url http://$url - } - set state(url) $url - if {![catch {$http(-proxyfilter) $host} proxy]} { - set phost [lindex $proxy 0] - set pport [lindex $proxy 1] - } - if {$state(-timeout) > 0} { - set state(after) [after $state(-timeout) [list http_reset $token timeout]] - } - if {[info exists phost] && [string length $phost]} { - set srvurl $url - set s [socket $phost $pport] - } else { - set s [socket $host $port] - } - set state(sock) $s - - # Send data in cr-lf format, but accept any line terminators - - fconfigure $s -translation {auto crlf} -buffersize $state(-blocksize) - - # The following is disallowed in safe interpreters, but the socket - # is already in non-blocking mode in that case. - - catch {fconfigure $s -blocking off} - set len 0 - set how GET - if {[info exists state(-query)]} { - set len [string length $state(-query)] - if {$len > 0} { - set how POST - } - } elseif {$state(-validate)} { - set how HEAD - } - puts $s "$how $srvurl HTTP/1.0" - puts $s "Accept: $http(-accept)" - puts $s "Host: $host" - puts $s "User-Agent: $http(-useragent)" - foreach {key value} $state(-headers) { - regsub -all \[\n\r\] $value {} value - set key [string trim $key] - if {[string length $key]} { - puts $s "$key: $value" - } - } - if {$len > 0} { - puts $s "Content-Length: $len" - puts $s "Content-Type: application/x-www-form-urlencoded" - puts $s "" - fconfigure $s -translation {auto binary} - puts -nonewline $s $state(-query) - } else { - puts $s "" - } - flush $s - fileevent $s readable [list httpEvent $token] - if {! [info exists state(-command)]} { - http_wait $token - } - return $token -} -proc http_data {token} { - upvar #0 $token state - return $state(body) -} -proc http_status {token} { - upvar #0 $token state - return $state(status) -} -proc http_code {token} { - upvar #0 $token state - return $state(http) -} -proc http_size {token} { - upvar #0 $token state - return $state(currentsize) -} - - proc httpEvent {token} { - upvar #0 $token state - set s $state(sock) - - if {[eof $s]} { - httpEof $token - return - } - if {$state(state) == "header"} { - set n [gets $s line] - if {$n == 0} { - set state(state) body - if {![regexp -nocase ^text $state(type)]} { - # Turn off conversions for non-text data - fconfigure $s -translation binary - if {[info exists state(-channel)]} { - fconfigure $state(-channel) -translation binary - } - } - if {[info exists state(-channel)] && - ![info exists state(-handler)]} { - # Initiate a sequence of background fcopies - fileevent $s readable {} - httpCopyStart $s $token - } - } elseif {$n > 0} { - if {[regexp -nocase {^content-type:(.+)$} $line x type]} { - set state(type) [string trim $type] - } - if {[regexp -nocase {^content-length:(.+)$} $line x length]} { - set state(totalsize) [string trim $length] - } - if {[regexp -nocase {^([^:]+):(.+)$} $line x key value]} { - lappend state(meta) $key $value - } elseif {[regexp ^HTTP $line]} { - set state(http) $line - } - } - } else { - if {[catch { - if {[info exists state(-handler)]} { - set n [eval $state(-handler) {$s $token}] - } else { - set block [read $s $state(-blocksize)] - set n [string length $block] - if {$n >= 0} { - append state(body) $block - } - } - if {$n >= 0} { - incr state(currentsize) $n - } - } err]} { - httpFinish $token $err - } else { - if {[info exists state(-progress)]} { - eval $state(-progress) {$token $state(totalsize) $state(currentsize)} - } - } - } -} - proc httpCopyStart {s token} { - upvar #0 $token state - if {[catch { - fcopy $s $state(-channel) -size $state(-blocksize) -command \ - [list httpCopyDone $token] - } err]} { - httpFinish $token $err - } -} - proc httpCopyDone {token count {error {}}} { - upvar #0 $token state - set s $state(sock) - incr state(currentsize) $count - if {[info exists state(-progress)]} { - eval $state(-progress) {$token $state(totalsize) $state(currentsize)} - } - if {([string length $error] != 0)} { - httpFinish $token $error - } elseif {[eof $s]} { - httpEof $token - } else { - httpCopyStart $s $token - } -} - proc httpEof {token} { - upvar #0 $token state - if {$state(state) == "header"} { - # Premature eof - set state(status) eof - } else { - set state(status) ok - } - set state(state) eof - httpFinish $token -} -proc http_wait {token} { - upvar #0 $token state - if {![info exists state(status)] || [string length $state(status)] == 0} { - vwait $token\(status) - } - if {[info exists state(error)]} { - set errorlist $state(error) - unset state(error) - eval error $errorlist - } - return $state(status) -} - -# Call http_formatQuery with an even number of arguments, where the first is -# a name, the second is a value, the third is another name, and so on. - -proc http_formatQuery {args} { - set result "" - set sep "" - foreach i $args { - append result $sep [httpMapReply $i] - if {$sep != "="} { - set sep = - } else { - set sep & - } - } - return $result -} - -# do x-www-urlencoded character mapping -# The spec says: "non-alphanumeric characters are replaced by '%HH'" -# 1 leave alphanumerics characters alone -# 2 Convert every other character to an array lookup -# 3 Escape constructs that are "special" to the tcl parser -# 4 "subst" the result, doing all the array substitutions - - proc httpMapReply {string} { - global httpFormMap - set alphanumeric a-zA-Z0-9 - if {![info exists httpFormMap]} { - - for {set i 1} {$i <= 256} {incr i} { - set c [format %c $i] - if {![string match \[$alphanumeric\] $c]} { - set httpFormMap($c) %[format %.2x $i] - } - } - # These are handled specially - array set httpFormMap { - " " + \n %0d%0a - } - } - regsub -all \[^$alphanumeric\] $string {$httpFormMap(&)} string - regsub -all \n $string {\\n} string - regsub -all \t $string {\\t} string - regsub -all {[][{})\\]\)} $string {\\&} string - return [subst $string] -} - -# Default proxy filter. - proc httpProxyRequired {host} { - global http - if {[info exists http(-proxyhost)] && [string length $http(-proxyhost)]} { - if {![info exists http(-proxyport)] || ![string length $http(-proxyport)]} { - set http(-proxyport) 8080 - } - return [list $http(-proxyhost) $http(-proxyport)] - } else { - return {} - } -} diff --git a/library/http1.0/pkgIndex.tcl b/library/http1.0/pkgIndex.tcl deleted file mode 100644 index ab6170f..0000000 --- a/library/http1.0/pkgIndex.tcl +++ /dev/null @@ -1,11 +0,0 @@ -# Tcl package index file, version 1.0 -# This file is generated by the "pkg_mkIndex" command -# and sourced either when an application starts up or -# by a "package unknown" script. It invokes the -# "package ifneeded" command to set up package-related -# information so that packages will be loaded automatically -# in response to "package require" commands. When this -# script is sourced, the variable $dir must contain the -# full path name of this file's directory. - -package ifneeded http 1.0 [list tclPkgSetup $dir http 1.0 {{http.tcl source {httpCopyDone httpCopyStart httpEof httpEvent httpFinish httpMapReply httpProxyRequired http_code http_config http_data http_formatQuery http_get http_reset http_size http_status http_wait}}}] -- cgit v0.12 From b0898beca68aa150062cb6eacc8daee6e6490f55 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 29 Dec 2017 17:38:10 +0000 Subject: Remove http 1.0 tests. --- tests/httpold.test | 300 ----------------------------------------------------- 1 file changed, 300 deletions(-) delete mode 100644 tests/httpold.test diff --git a/tests/httpold.test b/tests/httpold.test deleted file mode 100644 index dda0189..0000000 --- a/tests/httpold.test +++ /dev/null @@ -1,300 +0,0 @@ -# -*- tcl -*- -# Commands covered: http_config, http_get, http_wait, http_reset -# -# This file contains a collection of tests for the http script library. -# 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. - -if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest - namespace import -force ::tcltest::* -} - -if {[catch {package require http 1.0}]} { - if {[info exists httpold]} { - catch {puts "Cannot load http 1.0 package"} - ::tcltest::cleanupTests - return - } else { - catch {puts "Running http 1.0 tests in slave interp"} - set interp [interp create httpold] - $interp eval [list set httpold "running"] - $interp eval [list set argv $argv] - $interp eval [list source [info script]] - interp delete $interp - ::tcltest::cleanupTests - return - } -} - -if {$::tcl_platform(os) eq "Darwin"} { - # Name resolution often a problem on OSX; not focus of HTTP package anyway - set HOST localhost -} else { - set HOST [info hostname] -} - -set bindata "This is binary data\x0d\x0amore\x0dmore\x0amore\x00null" -catch {unset data} - -## -## The httpd script implement a stub http server -## -source [file join [file dirname [info script]] httpd] - -if [catch {httpd_init 0} listen] { - puts "Cannot start http server, http test skipped" - catch {unset port} - ::tcltest::cleanupTests - return -} - -test httpold-1.1 {http_config} { - http_config -} {-accept */* -proxyfilter httpProxyRequired -proxyhost {} -proxyport {} -useragent {Tcl http client package 1.0}} - -test httpold-1.2 {http_config} { - http_config -proxyfilter -} httpProxyRequired - -test httpold-1.3 {http_config} { - catch {http_config -junk} -} 1 - -test httpold-1.4 {http_config} { - http_config -proxyhost nowhere.come -proxyport 8080 -proxyfilter myFilter -useragent "Tcl Test Suite" - set x [http_config] - http_config -proxyhost {} -proxyport {} -proxyfilter httpProxyRequired \ - -useragent "Tcl http client package 1.0" - set x -} {-accept */* -proxyfilter myFilter -proxyhost nowhere.come -proxyport 8080 -useragent {Tcl Test Suite}} - -test httpold-1.5 {http_config} { - catch {http_config -proxyhost {} -junk 8080} -} 1 - -test httpold-2.1 {http_reset} { - catch {http_reset http#1} -} 0 - -test httpold-3.1 {http_get} { - catch {http_get -bogus flag} -} 1 -test httpold-3.2 {http_get} { - catch {http_get http:junk} err - set err -} {Unsupported URL: http:junk} - -set url ${::HOST}:$port -test httpold-3.3 {http_get} { - set token [http_get $url] - http_data $token -} "HTTP/1.0 TEST -

Hello, World!

-

GET /

-" - -set tail /a/b/c -set url ${::HOST}:$port/a/b/c -set binurl ${::HOST}:$port/binary - -test httpold-3.4 {http_get} { - set token [http_get $url] - http_data $token -} "HTTP/1.0 TEST -

Hello, World!

-

GET $tail

-" - -proc selfproxy {host} { - global port - return [list ${::HOST} $port] -} -test httpold-3.5 {http_get} { - http_config -proxyfilter selfproxy - set token [http_get $url] - http_config -proxyfilter httpProxyRequired - http_data $token -} "HTTP/1.0 TEST -

Hello, World!

-

GET http://$url

-" - -test httpold-3.6 {http_get} { - http_config -proxyfilter bogus - set token [http_get $url] - http_config -proxyfilter httpProxyRequired - http_data $token -} "HTTP/1.0 TEST -

Hello, World!

-

GET $tail

-" - -test httpold-3.7 {http_get} { - set token [http_get $url -headers {Pragma no-cache}] - http_data $token -} "HTTP/1.0 TEST -

Hello, World!

-

GET $tail

-" - -test httpold-3.8 {http_get} { - set token [http_get $url -query Name=Value&Foo=Bar] - http_data $token -} "HTTP/1.0 TEST -

Hello, World!

-

POST $tail

-

Query

-
-
Name
Value -
Foo
Bar -
-" - -test httpold-3.9 {http_get} { - set token [http_get $url -validate 1] - http_code $token -} "HTTP/1.0 200 OK" - - -test httpold-4.1 {httpEvent} { - set token [http_get $url] - upvar #0 $token data - array set meta $data(meta) - expr ($data(totalsize) == $meta(Content-Length)) -} 1 - -test httpold-4.2 {httpEvent} { - set token [http_get $url] - upvar #0 $token data - array set meta $data(meta) - string compare $data(type) [string trim $meta(Content-Type)] -} 0 - -test httpold-4.3 {httpEvent} { - set token [http_get $url] - http_code $token -} {HTTP/1.0 200 Data follows} - -test httpold-4.4 {httpEvent} { - set testfile [makeFile "" testfile] - set out [open $testfile w] - set token [http_get $url -channel $out] - close $out - set in [open $testfile] - set x [read $in] - close $in - removeFile $testfile - set x -} "HTTP/1.0 TEST -

Hello, World!

-

GET $tail

-" - -test httpold-4.5 {httpEvent} { - set testfile [makeFile "" testfile] - set out [open $testfile w] - set token [http_get $url -channel $out] - close $out - upvar #0 $token data - removeFile $testfile - expr $data(currentsize) == $data(totalsize) -} 1 - -test httpold-4.6 {httpEvent} { - set testfile [makeFile "" testfile] - set out [open $testfile w] - set token [http_get $binurl -channel $out] - close $out - set in [open $testfile] - fconfigure $in -translation binary - set x [read $in] - close $in - removeFile $testfile - set x -} "$bindata$binurl" - -proc myProgress {token total current} { - global progress httpLog - if {[info exists httpLog] && $httpLog} { - puts "progress $total $current" - } - set progress [list $total $current] -} -if 0 { - # This test hangs on Windows95 because the client never gets EOF - set httpLog 1 - test httpold-4.6 {httpEvent} { - set token [http_get $url -blocksize 50 -progress myProgress] - set progress - } {111 111} -} -test httpold-4.7 {httpEvent} { - set token [http_get $url -progress myProgress] - set progress -} {111 111} -test httpold-4.8 {httpEvent} { - set token [http_get $url] - http_status $token -} {ok} -test httpold-4.9 {httpEvent} { - set token [http_get $url -progress myProgress] - http_code $token -} {HTTP/1.0 200 Data follows} -test httpold-4.10 {httpEvent} { - set token [http_get $url -progress myProgress] - http_size $token -} {111} -test httpold-4.11 {httpEvent} { - set token [http_get $url -timeout 1 -command {#}] - http_reset $token - http_status $token -} {reset} -test httpold-4.12 {httpEvent} { - update - set x {} - after 500 {lappend x ok} - set token [http_get $url -timeout 1 -command {lappend x fail}] - vwait x - list [http_status $token] $x -} {timeout ok} - -test httpold-5.1 {http_formatQuery} { - http_formatQuery name1 value1 name2 "value two" -} {name1=value1&name2=value+two} - -test httpold-5.2 {http_formatQuery} { - http_formatQuery name1 ~bwelch name2 \xa1\xa2\xa2 -} {name1=%7ebwelch&name2=%a1%a2%a2} - -test httpold-5.3 {http_formatQuery} { - http_formatQuery lines "line1\nline2\nline3" -} {lines=line1%0d%0aline2%0d%0aline3} - -test httpold-6.1 {httpProxyRequired} { - update - http_config -proxyhost ${::HOST} -proxyport $port - set token [http_get $url] - http_wait $token - http_config -proxyhost {} -proxyport {} - upvar #0 $token data - set data(body) -} "HTTP/1.0 TEST -

Hello, World!

-

GET http://$url

-" - -# cleanup -catch {unset url} -catch {unset port} -catch {unset data} -close $listen -::tcltest::cleanupTests -return -- cgit v0.12 From daa36e9a1bc07b908f1f3fdb5e9fe52b699047e5 Mon Sep 17 00:00:00 2001 From: dgp Date: Fri, 29 Dec 2017 17:47:50 +0000 Subject: Use http 2 instead of http 1 for Safe Base testing. --- tests/safe.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/safe.test b/tests/safe.test index 33ee166..df60de6 100644 --- a/tests/safe.test +++ b/tests/safe.test @@ -180,17 +180,17 @@ test safe-6.3 {test safe interpreters knowledge of the world} { # leaking infos, but they still do... # high level general test -test safe-7.1 {tests that everything works at high level} { +test safe-7.1 {tests that everything works at high level} -body { set i [safe::interpCreate] # no error shall occur: # (because the default access_path shall include 1st level sub dirs so # package require in a slave works like in the master) - set v [interp eval $i {package require http 1}] + set v [interp eval $i {package require http 2}] # no error shall occur: - interp eval $i {http_config} + interp eval $i {http::config} safe::interpDelete $i set v -} 1.0 +} -match glob -result 2.* test safe-7.2 {tests specific path and interpFind/AddToAccessPath} -body { set i [safe::interpCreate -nostat -nested 1 -accessPath [list [info library]]] # should not add anything (p0) -- cgit v0.12 From 651697f7cd746dded1a031d4217376000a176037 Mon Sep 17 00:00:00 2001 From: pspjuth Date: Fri, 29 Dec 2017 18:58:01 +0000 Subject: Refactored lrange to common function. --- generic/tclCmdIL.c | 44 +--------------------------- generic/tclExecute.c | 40 ++------------------------ generic/tclInt.h | 2 ++ generic/tclListObj.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 80 deletions(-) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index b41d312..001b62d 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2543,7 +2543,6 @@ Tcl_LrangeObjCmd( register Tcl_Obj *const objv[]) /* Argument objects. */ { - Tcl_Obj **elemPtrs; int listLen, first, last, result; if (objc != 4) { @@ -2561,55 +2560,14 @@ Tcl_LrangeObjCmd( if (result != TCL_OK) { return result; } - if (first < 0) { - first = 0; - } result = TclGetIntForIndexM(interp, objv[3], /*endValue*/ listLen - 1, &last); if (result != TCL_OK) { return result; } - if (last >= listLen) { - last = listLen - 1; - } - - if (first > last) { - /* - * Returning an empty list is easy. - */ - - return TCL_OK; - } - - result = TclListObjGetElements(interp, objv[1], &listLen, &elemPtrs); - if (result != TCL_OK) { - return result; - } - - if (Tcl_IsShared(objv[1]) || - ((ListRepPtr(objv[1])->refCount > 1))) { - Tcl_SetObjResult(interp, Tcl_NewListObj(last - first + 1, - &elemPtrs[first])); - } else { - /* - * In-place is possible. - */ - - if (last < (listLen - 1)) { - Tcl_ListObjReplace(interp, objv[1], last + 1, listLen - 1 - last, - 0, NULL); - } - - /* - * This one is not conditioned on (first > 0) in order to preserve the - * string-canonizing effect of [lrange 0 end]. - */ - - Tcl_ListObjReplace(interp, objv[1], 0, first, 0, NULL); - Tcl_SetObjResult(interp, objv[1]); - } + Tcl_SetObjResult(interp, TclListObjRange(objv[1], first, last)); return TCL_OK; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 0f501b9..8568642 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5087,11 +5087,11 @@ TEBCresume( TclGetInt4AtPtr(pc+5))); /* - * Get the contents of the list, making sure that it really is a list + * Get the length of the list, making sure that it really is a list * in the process. */ - if (TclListObjGetElements(interp, valuePtr, &objc, &objv) != TCL_OK) { + if (TclListObjLength(interp, valuePtr, &objc) != TCL_OK) { TRACE_ERROR(interp); goto gotError; } @@ -5128,41 +5128,7 @@ TEBCresume( toIdx = objc; } - /* - * Check if we are referring to a valid, non-empty list range, and if - * so, build the list of elements in that range. - */ - - if (fromIdx<=toIdx && fromIdx=0) { - if (fromIdx < 0) { - fromIdx = 0; - } - if (toIdx >= objc) { - toIdx = objc-1; - } - - /* - * If we are just removing the beginning or the end from an - * unshared object, Tcl_ListObjReplace is very efficient, and also - * guarantees a pure list. - */ - - if (fromIdx == 0 && toIdx != objc-1 && !Tcl_IsShared(valuePtr)) { - Tcl_ListObjReplace(interp, valuePtr, - toIdx + 1, LIST_MAX, 0, NULL); - TRACE_APPEND(("%.30s\n", O2S(valuePtr))); - NEXT_INST_F(9, 0, 0); - } - if (toIdx == objc-1 && !Tcl_IsShared(valuePtr)) { - Tcl_ListObjReplace(interp, valuePtr, - 0, fromIdx, 0, NULL); - TRACE_APPEND(("%.30s\n", O2S(valuePtr))); - NEXT_INST_F(9, 0, 0); - } - objResultPtr = Tcl_NewListObj(toIdx-fromIdx+1, objv+fromIdx); - } else { - TclNewObj(objResultPtr); - } + objResultPtr = TclListObjRange(valuePtr, fromIdx, toIdx); TRACE_APPEND(("\"%.30s\"", O2S(objResultPtr))); NEXT_INST_F(9, 1, 1); diff --git a/generic/tclInt.h b/generic/tclInt.h index 2ba0493..8322095 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3069,6 +3069,8 @@ MODULE_SCOPE Tcl_Obj * TclLindexFlat(Tcl_Interp *interp, Tcl_Obj *listPtr, MODULE_SCOPE void TclListLines(Tcl_Obj *listObj, int line, int n, int *lines, Tcl_Obj *const *elems); MODULE_SCOPE Tcl_Obj * TclListObjCopy(Tcl_Interp *interp, Tcl_Obj *listPtr); +MODULE_SCOPE Tcl_Obj * TclListObjRange(Tcl_Obj *listPtr, int fromIdx, + int toIdx); MODULE_SCOPE Tcl_Obj * TclLsetList(Tcl_Interp *interp, Tcl_Obj *listPtr, Tcl_Obj *indexPtr, Tcl_Obj *valuePtr); MODULE_SCOPE Tcl_Obj * TclLsetFlat(Tcl_Interp *interp, Tcl_Obj *listPtr, diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 43d90ab..c4dafba 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -423,6 +423,87 @@ TclListObjCopy( /* *---------------------------------------------------------------------- * + * TclListObjRange -- + * + * Makes a slice of a list value. + * *listPtr must be known to be a valid list. + * + * Results: + * Returns a pointer to the sliced list. + * This may be a new object or the same object if not shared. + * + * Side effects: + * The possible conversion of the object referenced by listPtr + * to a list object. + * + *---------------------------------------------------------------------- + */ + +Tcl_Obj * +TclListObjRange( + Tcl_Obj *listPtr, /* List object to take a range from. */ + int fromIdx, /* Index of first element to include. */ + int toIdx) /* Index of last element to include. */ +{ + Tcl_Obj **elemPtrs; + int listLen, i, newLen; + List *listRepPtr; + + TclListObjGetElements(NULL, listPtr, &listLen, &elemPtrs); + + if (fromIdx < 0) { + fromIdx = 0; + } + if (toIdx >= listLen) { + toIdx = listLen-1; + } + if (fromIdx > toIdx) { + return Tcl_NewObj(); + } + + newLen = toIdx - fromIdx + 1; + + if (Tcl_IsShared(listPtr) || + ((ListRepPtr(listPtr)->refCount > 1))) { + return Tcl_NewListObj(newLen, &elemPtrs[fromIdx]); + } + + /* + * In-place is possible. + */ + + /* + * Even if nothing below cause any changes, we still want the + * string-canonizing effect of [lrange 0 end]. + */ + + TclInvalidateStringRep(listPtr); + + /* + * Delete elements that should not be included. + */ + + for (i = 0; i < fromIdx; i++) { + TclDecrRefCount(elemPtrs[i]); + } + for (i = toIdx + 1; i < listLen; i++) { + TclDecrRefCount(elemPtrs[i]); + } + + if (fromIdx > 0) { + memmove(elemPtrs, &elemPtrs[fromIdx], + (size_t) newLen * sizeof(Tcl_Obj*)); + } + + listRepPtr = ListRepPtr(listPtr); + listRepPtr->elemCount = newLen; + + return listPtr; +} + +/* + *---------------------------------------------------------------------- + * * Tcl_ListObjGetElements -- * * This function returns an (objc,objv) array of the elements in a list -- cgit v0.12 From 983b089edb6d9c4f233f21a1792393758dea4f65 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Fri, 29 Dec 2017 20:40:29 +0000 Subject: Removing the standalone pkgIndex.tcl. There is enough stuff that needs to be manually edited in the init.tcl script for new releases as it is, there is no sense in having yet another file to edit. Marking which distributed packages are safe to load in a safe interpreter --- library/init.tcl | 25 +++++++++++++++++++++---- library/pkgIndex.tcl | 16 ---------------- 2 files changed, 21 insertions(+), 20 deletions(-) delete mode 100644 library/pkgIndex.tcl diff --git a/library/init.tcl b/library/init.tcl index d4a66e2..e58dcfc 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -6,7 +6,10 @@ # 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. +# Copyright (c) 2004 by Kevin B. Kenny. +# Copyright (c) 2018 by Sean Woods +# +# All rights reserved. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -795,7 +798,21 @@ proc tcl::CopyDirectory {action src dest} { } return } -if {[file exists [file join $::tcl_library pkgIndex.tcl]]} { - set dir $::tcl_library - source [file join $::tcl_library pkgIndex.tcl] +set isafe [interp issafe] +### +# Package manifest for all Tcl packages included in the /library file system +### +set isafe [interp issafe] +set dir [file dirname [info script]] +foreach {safe package version file} { + 0 http 2.8.12 {http http.tcl} + 0 http 1.0 {http1.0 http.tcl} + 1 msgcat 1.6.1 {msgcat msgcat.tcl} + 1 opt 0.4.7 {opt optparse.tcl} + 0 platform 1.0.14 {platform platform.tcl} + 0 platform::shell 1.1.4 {platform shell.tcl} + 1 tcltest 2.4.1 {tcltest tcltest.tcl} +} { + if {$isafe && !$safe} continue + package ifneeded $package $version [list source [file join $dir {*}$file]] } diff --git a/library/pkgIndex.tcl b/library/pkgIndex.tcl deleted file mode 100644 index ff8d0f1..0000000 --- a/library/pkgIndex.tcl +++ /dev/null @@ -1,16 +0,0 @@ -### -# Package manifest for all Tcl packages included in the /library file system -### -foreach {package version file} { - http 2.8.12 {http http.tcl} - http 1.0 {http1.0 http.tcl} - msgcat 1.6.1 {msgcat msgcat.tcl} - opt 0.4.7 {opt optparse.tcl} - platform 1.0.14 {platform platform.tcl} - platform::shell 1.1.4 {platform shell.tcl} - tcltest 2.4.1 {tcltest tcltest.tcl} -} { - package ifneeded $package $version [list source [file join $dir {*}$file]] -} -# Opt is the odd man out -package ifneeded opt 0.4.7 [list source [file join $dir opt optparse.tcl]] -- cgit v0.12 From b533731c50bd2d75793771054f53afd96afbfd80 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Fri, 29 Dec 2017 21:41:00 +0000 Subject: Modifications to clean up warnings on compile --- generic/tclZipfs.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 45ba8e2..49f3b04 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -155,14 +155,14 @@ typedef struct ZipFile { long length; /* Length of memory mapped file */ unsigned char *tofree; /* Non-NULL if malloc'ed file */ int nfiles; /* Number of files in archive */ - int baseoffs; /* Archive start */ - int baseoffsp; /* Password start */ - int centoffs; /* Archive directory start */ - char pwbuf[264]; /* Password buffer */ + unsigned long baseoffs; /* Archive start */ + long baseoffsp; /* Password start */ + unsigned long centoffs; /* Archive directory start */ + unsigned char pwbuf[264]; /* Password buffer */ #if defined(_WIN32) || defined(_WIN64) HANDLE mh; #endif - int nopen; /* Number of open files on archive */ + unsigned long nopen; /* Number of open files on archive */ struct ZipEntry *entries; /* List of files in archive */ struct ZipEntry *topents; /* List of top-level dirs in archive */ #if HAS_DRIVES @@ -1796,7 +1796,7 @@ wrerr: return TCL_ERROR; } if ((len + pos[0]) & 3) { - char abuf[8]; + unsigned char abuf[8]; /* * Align payload to next 4-byte boundary using a dummy extra @@ -1806,7 +1806,7 @@ wrerr: zip_write_short(abuf, 0xffff); zip_write_short(abuf + 2, align - 4); zip_write_int(abuf + 4, 0x03020100); - if (Tcl_Write(out, abuf, align) != align) { + if (Tcl_Write(out, (const char *)abuf, align) != align) { goto wrerr; } } @@ -4151,7 +4151,7 @@ int TclZipfs_AppHook(int *argc, char ***argv) char *archive; Tcl_FindExecutable(*argv[0]); - archive=Tcl_GetNameOfExecutable(); + archive=(char *)Tcl_GetNameOfExecutable(); TclZipfs_Init(NULL); /* ** Look for init.tcl in one of the locations mounted later in this function -- cgit v0.12 From 54590627ee18ff872a23f3a37227324aed8d1fd8 Mon Sep 17 00:00:00 2001 From: pspjuth Date: Tue, 2 Jan 2018 22:03:02 +0000 Subject: Add -stride to lsearch. TIP#351 --- generic/tclCmdIL.c | 187 +++++++++++++++++++++++++++++++++++++++-------------- tests/lsearch.test | 158 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 287 insertions(+), 58 deletions(-) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index b41d312..c514f84 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2939,7 +2939,8 @@ Tcl_LsearchObjCmd( { const char *bytes, *patternBytes; int i, match, index, result, listc, length, elemLen, bisect; - int dataType, isIncreasing, lower, upper, offset; + int allocatedIndexVector = 0; + int dataType, isIncreasing, lower, upper, start, groupSize, groupOffset; Tcl_WideInt patWide, objWide; int allMatches, inlineReturn, negatedMatch, returnSubindices, noCase; double patDouble, objDouble; @@ -2951,7 +2952,7 @@ Tcl_LsearchObjCmd( "-all", "-ascii", "-bisect", "-decreasing", "-dictionary", "-exact", "-glob", "-increasing", "-index", "-inline", "-integer", "-nocase", "-not", - "-real", "-regexp", "-sorted", "-start", + "-real", "-regexp", "-sorted", "-start", "-stride", "-subindices", NULL }; enum options { @@ -2959,7 +2960,7 @@ Tcl_LsearchObjCmd( 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 + LSEARCH_START, LSEARCH_STRIDE, LSEARCH_SUBINDICES }; enum datatypes { ASCII, DICTIONARY, INTEGER, REAL @@ -2979,7 +2980,9 @@ Tcl_LsearchObjCmd( bisect = 0; listPtr = NULL; startPtr = NULL; - offset = 0; + groupSize = 1; + groupOffset = 0; + start = 0; noCase = 0; sortInfo.compareCmdPtr = NULL; sortInfo.isIncreasing = 1; @@ -2997,9 +3000,6 @@ Tcl_LsearchObjCmd( for (i = 1; i < objc-2; i++) { if (Tcl_GetIndexFromObj(interp, objv[i], options, "option", 0, &index) != TCL_OK) { - if (startPtr != NULL) { - Tcl_DecrRefCount(startPtr); - } result = TCL_ERROR; goto done; } @@ -3064,6 +3064,7 @@ Tcl_LsearchObjCmd( if (startPtr != NULL) { Tcl_DecrRefCount(startPtr); + startPtr = NULL; } if (i > objc-4) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -3084,25 +3085,47 @@ Tcl_LsearchObjCmd( startPtr = Tcl_DuplicateObj(objv[i]); } else { startPtr = objv[i]; - Tcl_IncrRefCount(startPtr); } + Tcl_IncrRefCount(startPtr); + break; + case LSEARCH_STRIDE: /* -stride */ + if (i > objc-4) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "\"-stride\" option must be " + "followed by stride length", -1)); + Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL); + result = TCL_ERROR; + goto done; + } + if (Tcl_GetIntFromObj(interp, objv[i+1], &groupSize) != TCL_OK) { + result = TCL_ERROR; + goto done; + } + if (groupSize < 2) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "stride length must be at least 2", -1)); + Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT", + "BADSTRIDE", NULL); + result = TCL_ERROR; + goto done; + } + i++; break; case LSEARCH_INDEX: { /* -index */ Tcl_Obj **indices; int j; - if (sortInfo.indexc > 1) { + if (allocatedIndexVector) { TclStackFree(interp, sortInfo.indexv); + allocatedIndexVector = 0; } if (i > objc-4) { - if (startPtr != NULL) { - Tcl_DecrRefCount(startPtr); - } Tcl_SetObjResult(interp, Tcl_NewStringObj( "\"-index\" option must be followed by list index", -1)); Tcl_SetErrorCode(interp, "TCL", "ARGUMENT", "MISSING", NULL); - return TCL_ERROR; + result = TCL_ERROR; + goto done; } /* @@ -3114,10 +3137,8 @@ Tcl_LsearchObjCmd( i++; if (TclListObjGetElements(interp, objv[i], &sortInfo.indexc, &indices) != TCL_OK) { - if (startPtr != NULL) { - Tcl_DecrRefCount(startPtr); - } - return TCL_ERROR; + result = TCL_ERROR; + goto done; } switch (sortInfo.indexc) { case 0: @@ -3129,6 +3150,8 @@ Tcl_LsearchObjCmd( default: sortInfo.indexv = TclStackAlloc(interp, sizeof(int) * sortInfo.indexc); + allocatedIndexVector = 1; /* Cannot use indexc field, as it + * might be decreased by 1 later. */ } /* @@ -3156,14 +3179,12 @@ Tcl_LsearchObjCmd( */ if (returnSubindices && sortInfo.indexc==0) { - if (startPtr != NULL) { - Tcl_DecrRefCount(startPtr); - } Tcl_SetObjResult(interp, Tcl_NewStringObj( "-subindices cannot be used without -index option", -1)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH", "BAD_OPTION_MIX", NULL); - return TCL_ERROR; + result = TCL_ERROR; + goto done; } if (bisect && (allMatches || negatedMatch)) { @@ -3171,7 +3192,8 @@ Tcl_LsearchObjCmd( "-bisect is not compatible with -all or -not", -1)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH", "BAD_OPTION_MIX", NULL); - return TCL_ERROR; + result = TCL_ERROR; + goto done; } if (mode == REGEXP) { @@ -3197,9 +3219,6 @@ Tcl_LsearchObjCmd( } if (regexp == NULL) { - if (startPtr != NULL) { - Tcl_DecrRefCount(startPtr); - } result = TCL_ERROR; goto done; } @@ -3212,24 +3231,67 @@ Tcl_LsearchObjCmd( result = TclListObjGetElements(interp, objv[objc - 2], &listc, &listv); if (result != TCL_OK) { - if (startPtr != NULL) { - Tcl_DecrRefCount(startPtr); - } goto done; } /* + * Check for sanity when grouping elements of the overall list together + * because of the -stride option. [TIP #351] + */ + + if (groupSize > 1) { + if (listc % groupSize) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "list size must be a multiple of the stride length", + -1)); + Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH", "BADSTRIDE", + NULL); + result = TCL_ERROR; + goto done; + } + if (sortInfo.indexc > 0) { + /* + * Use the first value in the list supplied to -index as the + * offset of the element within each group by which to sort. + */ + + groupOffset = sortInfo.indexv[0]; + if (groupOffset <= SORTIDX_END) { + groupOffset = (groupOffset - SORTIDX_END) + groupSize - 1; + } + if (groupOffset < 0 || groupOffset >= groupSize) { + Tcl_SetObjResult(interp, Tcl_NewStringObj( + "when used with \"-stride\", the leading \"-index\"" + " value must be within the group", -1)); + Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSEARCH", + "BADINDEX", NULL); + result = TCL_ERROR; + goto done; + } + if (sortInfo.indexc == 1) { + sortInfo.indexc = 0; + sortInfo.indexv = NULL; + } else { + sortInfo.indexc--; + + for (i = 0; i < sortInfo.indexc; i++) { + sortInfo.indexv[i] = sortInfo.indexv[i+1]; + } + } + } + } + + /* * Get the user-specified start offset. */ if (startPtr) { - result = TclGetIntForIndexM(interp, startPtr, listc-1, &offset); - Tcl_DecrRefCount(startPtr); + result = TclGetIntForIndexM(interp, startPtr, listc-1, &start); if (result != TCL_OK) { goto done; } - if (offset < 0) { - offset = 0; + if (start < 0) { + start = 0; } /* @@ -3237,16 +3299,21 @@ Tcl_LsearchObjCmd( * "did not match anything at all" result straight away. [Bug 1374778] */ - if (offset > listc-1) { - if (sortInfo.indexc > 1) { - TclStackFree(interp, sortInfo.indexv); - } + if (start > listc-1) { if (allMatches || inlineReturn) { Tcl_ResetResult(interp); } else { Tcl_SetObjResult(interp, Tcl_NewIntObj(-1)); } - return TCL_OK; + goto done; + } + + /* + * If start points within a group, it points to the start of the group. + */ + + if (groupSize > 1) { + start -= (start % groupSize); } } @@ -3305,18 +3372,23 @@ Tcl_LsearchObjCmd( * sense in doing this when the match sense is inverted. */ - lower = offset - 1; + /* + * With -stride, lower, upper and i are kept as multiples of groupSize. + */ + + lower = start - groupSize; upper = listc; - while (lower + 1 != upper && sortInfo.resultCode == TCL_OK) { + while (lower + groupSize != upper && sortInfo.resultCode == TCL_OK) { i = (lower + upper)/2; + i -= i % groupSize; if (sortInfo.indexc != 0) { - itemPtr = SelectObjFromSublist(listv[i], &sortInfo); + itemPtr = SelectObjFromSublist(listv[i+groupOffset], &sortInfo); if (sortInfo.resultCode != TCL_OK) { result = sortInfo.resultCode; goto done; } } else { - itemPtr = listv[i]; + itemPtr = listv[i+groupOffset]; } switch ((enum datatypes) dataType) { case ASCII: @@ -3405,10 +3477,10 @@ Tcl_LsearchObjCmd( if (allMatches) { listPtr = Tcl_NewListObj(0, NULL); } - for (i = offset; i < listc; i++) { + for (i = start; i < listc; i += groupSize) { match = 0; if (sortInfo.indexc != 0) { - itemPtr = SelectObjFromSublist(listv[i], &sortInfo); + itemPtr = SelectObjFromSublist(listv[i+groupOffset], &sortInfo); if (sortInfo.resultCode != TCL_OK) { if (listPtr != NULL) { Tcl_DecrRefCount(listPtr); @@ -3417,7 +3489,7 @@ Tcl_LsearchObjCmd( goto done; } } else { - itemPtr = listv[i]; + itemPtr = listv[i+groupOffset]; } switch (mode) { @@ -3507,15 +3579,20 @@ Tcl_LsearchObjCmd( */ if (returnSubindices && (sortInfo.indexc != 0)) { - itemPtr = SelectObjFromSublist(listv[i], &sortInfo); + itemPtr = SelectObjFromSublist(listv[i+groupOffset], + &sortInfo); + Tcl_ListObjAppendElement(interp, listPtr, itemPtr); + } else if (groupSize > 1) { + Tcl_ListObjReplace(interp, listPtr, LIST_MAX, 0, + groupSize, &listv[i]); } else { itemPtr = listv[i]; + Tcl_ListObjAppendElement(interp, listPtr, itemPtr); } - Tcl_ListObjAppendElement(interp, listPtr, itemPtr); } else if (returnSubindices) { int j; - itemPtr = Tcl_NewIntObj(i); + itemPtr = Tcl_NewIntObj(i+groupOffset); for (j=0 ; j 1) { + Tcl_SetObjResult(interp, Tcl_NewListObj(groupSize, &listv[index])); + } else { + Tcl_SetObjResult(interp, listv[index]); + } } result = TCL_OK; @@ -3563,7 +3647,10 @@ Tcl_LsearchObjCmd( */ done: - if (sortInfo.indexc > 1) { + if (startPtr != NULL) { + Tcl_DecrRefCount(startPtr); + } + if (allocatedIndexVector) { TclStackFree(interp, sortInfo.indexv); } return result; diff --git a/tests/lsearch.test b/tests/lsearch.test index b2c1812..4e4b206 100644 --- a/tests/lsearch.test +++ b/tests/lsearch.test @@ -59,7 +59,7 @@ test lsearch-2.9 {search modes} { } 1 test lsearch-2.10 {search modes} -returnCodes error -body { lsearch -glib {b.x bx xy bcx} b.x -} -result {bad option "-glib": must be -all, -ascii, -bisect, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices} +} -result {bad option "-glib": must be -all, -ascii, -bisect, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, -stride, or -subindices} test lsearch-2.11 {search modes with -nocase} { lsearch -exact -nocase {a b c A B C} A } 0 @@ -87,10 +87,10 @@ test lsearch-3.2 {lsearch errors} -returnCodes error -body { } -result {wrong # args: should be "lsearch ?-option value ...? list pattern"} test lsearch-3.3 {lsearch errors} -returnCodes error -body { lsearch a b c -} -result {bad option "a": must be -all, -ascii, -bisect, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices} +} -result {bad option "a": must be -all, -ascii, -bisect, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, -stride, or -subindices} test lsearch-3.4 {lsearch errors} -returnCodes error -body { lsearch a b c d -} -result {bad option "a": must be -all, -ascii, -bisect, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices} +} -result {bad option "a": must be -all, -ascii, -bisect, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, -stride, or -subindices} test lsearch-3.5 {lsearch errors} -returnCodes error -body { lsearch "\{" b } -result {unmatched open brace in list} @@ -435,21 +435,24 @@ test lsearch-18.5 {lsearch -index option, list as index basic functionality} { lsearch -all -index {0 0} -exact {{{a c} {a b} {d a}} {{a c} {a b} {d a}}} a } {0 1} -test lsearch-19.1 {lsearch -sunindices option} { +test lsearch-19.1 {lsearch -subindices option} { lsearch -subindices -index {0 0} {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a } {1 0 0} -test lsearch-19.2 {lsearch -sunindices option} { +test lsearch-19.2 {lsearch -subindices option} { lsearch -subindices -index {2 0} -exact {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a } {0 2 0} -test lsearch-19.3 {lsearch -sunindices option} { +test lsearch-19.3 {lsearch -subindices option} { lsearch -subindices -index {1 1} -glob {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} b* } {0 1 1} -test lsearch-19.4 {lsearch -sunindices option} { +test lsearch-19.4 {lsearch -subindices option} { lsearch -subindices -index {0 1} -regexp {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} {[cb]b} } {0 0 1} -test lsearch-19.5 {lsearch -sunindices option} { +test lsearch-19.5 {lsearch -subindices option} { lsearch -subindices -all -index {0 0} -exact {{{a c} {a b} {d a}} {{a c} {a b} {d a}}} a } {{0 0 0} {1 0 0}} +test lsearch-19.6 {lsearch -subindices option} { + lsearch -subindices -all -index {1 0} -exact {{{a c} {a b} {d a}} {{a c} {a b} {d a}}} a +} {{0 1 0} {1 1 0}} test lsearch-20.1 {lsearch -index option, index larger than sublists} -body { lsearch -index 2 {{a c} {a b} {a a}} a @@ -509,6 +512,145 @@ test lsearch-22.5 {lsearch -bisect, all equal} { test lsearch-22.6 {lsearch -sorted, all equal} { lsearch -sorted -integer {5 5 5 5} 5 } {0} + +test lsearch-23.1 {lsearch -stride option, errors} -body { + lsearch -stride {a b} a +} -returnCodes error -result {"-stride" option must be followed by stride length} +test lsearch-23.2 {lsearch -stride option, errors} -body { + lsearch -stride 0 {a b} a +} -returnCodes error -result {stride length must be at least 2} +test lsearch-23.3 {lsearch -stride option, errors} -body { + lsearch -stride 2 {a b c} a +} -returnCodes error -result {list size must be a multiple of the stride length} +test lsearch-23.4 {lsearch -stride option, errors} -body { + lsearch -stride 5 {a b c} a +} -returnCodes error -result {list size must be a multiple of the stride length} +test lsearch-23.5 {lsearch -stride option, errors} -body { + # Stride equal to length is ok + lsearch -stride 3 {a b c} a +} -result 0 + +test lsearch-24.1 {lsearch -stride option} -body { + lsearch -stride 2 {a b c d e f g h} d +} -result -1 +test lsearch-24.2 {lsearch -stride option} -body { + lsearch -stride 2 {a b c d e f g h} e +} -result 4 +test lsearch-24.3 {lsearch -stride option} -body { + lsearch -stride 3 {a b c d e f g h i} e +} -result -1 +test lsearch-24.4 {lsearch -stride option} -body { + # Result points first in group + lsearch -stride 3 -index 1 {a b c d e f g h i} e +} -result 3 +test lsearch-24.5 {lsearch -stride option} -body { + lsearch -inline -stride 2 {a b c d e f g h} d +} -result {} +test lsearch-24.6 {lsearch -stride option} -body { + # Inline result is a "single element" strided list + lsearch -inline -stride 2 {a b c d e f g h} e +} -result "e f" +test lsearch-24.7 {lsearch -stride option} -body { + lsearch -inline -stride 3 {a b c d e f g h i} e +} -result {} +test lsearch-24.8 {lsearch -stride option} -body { + lsearch -inline -stride 3 -index 1 {a b c d e f g h i} e +} -result "d e f" +test lsearch-24.9 {lsearch -stride option} -body { + lsearch -all -inline -stride 3 -index 1 {a b c d e f g e i} e +} -result "d e f g e i" +test lsearch-24.10 {lsearch -stride option} -body { + lsearch -all -inline -stride 3 -index 0 {a b c d e f a e i} a +} -result "a b c a e i" + +# 25* mimics 19* but with -inline added to -subindices +test lsearch-25.1 {lsearch -subindices option} { + lsearch -inline -subindices -index {0 0} {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a +} {a} +test lsearch-25.2 {lsearch -subindices option} { + lsearch -inline -subindices -index {2 0} -exact {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a +} {a} +test lsearch-25.3 {lsearch -subindices option} { + lsearch -inline -subindices -index {1 1} -glob {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} b* +} {bb} +test lsearch-25.4 {lsearch -subindices option} { + lsearch -inline -subindices -index {0 1} -regexp {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} {[cb]b} +} {cb} +test lsearch-25.5 {lsearch -subindices option} { + lsearch -inline -subindices -all -index {0 0} -exact {{{a c} {a b} {d a}} {{a c} {a b} {d a}}} a +} {a a} +test lsearch-25.6 {lsearch -subindices option} { + lsearch -inline -subindices -all -index {1 0} -exact {{{a c} {a b} {d a}} {{a c} {a b} {d a}}} a +} {a a} + +# 26* mimics 19* but with -stride added +test lsearch-26.1 {lsearch -stride + -subindices option} { + lsearch -stride 3 -subindices -index {0 0} {{x x} {x b} {a d} {a c} {a b} {a a}} a +} {3 0} +test lsearch-26.2 {lsearch -stride + -subindices option} { + lsearch -stride 3 -subindices -index {2 0} -exact {{x x} {x b} {a d} {a c} {a b} {a a}} a +} {2 0} +test lsearch-26.3 {lsearch -stride + -subindices option} { + lsearch -stride 3 -subindices -index {1 1} -glob {{ab cb} {ab bb} {ab ab} {ab cb} {ab bb} {ab ab}} b* +} {1 1} +test lsearch-26.4 {lsearch -stride + -subindices option} { + lsearch -stride 3 -subindices -index {0 1} -regexp {{ab cb} {ab bb} {ab ab} {ab cb} {ab bb} {ab ab}} {[cb]b} +} {0 1} +test lsearch-26.5 {lsearch -stride + -subindices option} { + lsearch -stride 3 -subindices -all -index {0 0} -exact {{a c} {a b} {d a} {a c} {a b} {d a}} a +} {{0 0} {3 0}} +test lsearch-26.6 {lsearch -stride + -subindices option} { + lsearch -stride 3 -subindices -all -index {1 0} -exact {{a c} {a b} {d a} {x c} {a b} {d a}} a +} {{1 0} {4 0}} + +# 27* mimics 25* but with -stride added +test lsearch-27.1 {lsearch -stride + -subindices option} { + lsearch -inline -stride 3 -subindices -index {0 0} {{x x} {x b} {a d} {a c} {a b} {a a}} a +} {a} +test lsearch-27.2 {lsearch -stride + -subindices option} { + lsearch -inline -stride 3 -subindices -index {2 0} -exact {{x x} {x b} {a d} {a c} {a b} {a a}} a +} {a} +test lsearch-27.3 {lsearch -stride + -subindices option} { + lsearch -inline -stride 3 -subindices -index {1 1} -glob {{ab cb} {ab bb} {ab ab} {ab cb} {ab bb} {ab ab}} b* +} {bb} +test lsearch-27.4 {lsearch -stride + -subindices option} { + lsearch -inline -stride 3 -subindices -index {0 1} -regexp {{ab cb} {ab bb} {ab ab} {ab cb} {ab bb} {ab ab}} {[cb]b} +} {cb} +test lsearch-27.5 {lsearch -stride + -subindices option} { + lsearch -inline -stride 3 -subindices -all -index {0 0} -exact {{a c} {a b} {d a} {a c} {a b} {d a}} a +} {a a} +test lsearch-27.6 {lsearch -stride + -subindices option} { + lsearch -inline -stride 3 -subindices -all -index {1 0} -exact {{a c} {a b} {d a} {x c} {a b} {d a}} a +} {a a} + +test lsearch-28.1 {lsearch -sorted with -stride} -body { + lsearch -sorted -stride 2 {5 3 7 8 9 2} 5 +} -result 0 +test lsearch-28.2 {lsearch -sorted with -stride} -body { + lsearch -sorted -stride 2 {5 3 7 8 9 2} 3 +} -result -1 +test lsearch-28.3 {lsearch -sorted with -stride} -body { + lsearch -sorted -stride 2 {5 3 7 8 9 2} 7 +} -result 2 +test lsearch-28.4 {lsearch -sorted with -stride} -body { + lsearch -sorted -stride 2 {5 3 7 8 9 2} 8 +} -result -1 +test lsearch-28.5 {lsearch -sorted with -stride} -body { + lsearch -sorted -stride 2 {5 3 7 8 9 2} 9 +} -result 4 +test lsearch-28.6 {lsearch -sorted with -stride} -body { + lsearch -sorted -stride 2 {5 3 7 8 9 2} 2 +} -result -1 +test lsearch-28.7 {lsearch -sorted with -stride} -body { + lsearch -sorted -stride 2 -index 0 -subindices {5 3 7 8 9 2} 9 +} -result 4 +test lsearch-28.8 {lsearch -sorted with -stride} -body { + lsearch -sorted -stride 2 -index 1 -subindices {3 5 8 7 2 9} 9 +} -result 5 +test lsearch-28.8 {lsearch -sorted with -stride} -body { + lsearch -sorted -stride 2 -index 1 -subindices -inline {3 5 8 7 2 9} 9 +} -result 9 + # cleanup catch {unset res} -- cgit v0.12 From fc03549d341d28a2158b38acb91c75be993d37d0 Mon Sep 17 00:00:00 2001 From: pspjuth Date: Tue, 2 Jan 2018 23:05:25 +0000 Subject: Doc for lsearch -stride --- doc/lsearch.n | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/lsearch.n b/doc/lsearch.n index c2644b8..2f956a5 100644 --- a/doc/lsearch.n +++ b/doc/lsearch.n @@ -148,6 +148,18 @@ or \fB\-not\fR. These options are used to search lists of lists. They may be used with any other options. .TP +\fB\-stride\0\fIstrideLength\fR +. +If this option is specified, the list is treated as consisting of +groups of \fIstrideLength\fR elements and the groups are searched by +either their first element or, if the \fB\-index\fR option is used, +by the element within each group given by the first index passed to +\fB\-index\fR (which is then ignored by \fB\-index\fR). The resulting +index always points to the first element in a group. +.PP +The list length must be an integer multiple of \fIstrideLength\fR, which +in turn must be at least 2. +.TP \fB\-index\fR\0\fIindexList\fR . This option is designed for use when searching within nested lists. @@ -208,6 +220,13 @@ It is also possible to search inside elements: \fBlsearch\fR -index 1 -all -inline {{a abc} {b bcd} {c cde}} *bc* \fI\(-> {a abc} {b bcd}\fR .CE +.PP +The same thing for a flattened list: +.PP +.CS +\fBlsearch\fR -stride 2 -index 1 -all -inline {a abc b bcd c cde} *bc* + \fI\(-> {a abc b bcd}\fR +.CE .SH "SEE ALSO" foreach(n), list(n), lappend(n), lindex(n), linsert(n), llength(n), lset(n), lsort(n), lrange(n), lreplace(n), -- cgit v0.12 From 7aa147800f9c40128417d41e350815b482d4a927 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 4 Jan 2018 02:23:37 +0000 Subject: Minimal fixes to stop the [package files] machinery writing to freed mem. This contribution needs a careful review from someone who actually knows how Tcl_Preserve, etc. work. --- generic/tclPkg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index cdf9a8b..288d5dc 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -948,6 +948,7 @@ Tcl_PackageObjCmd( Tcl_EventuallyFree(availPtr->script, TCL_DYNAMIC); if (availPtr->pkgIndex) { Tcl_EventuallyFree(availPtr->pkgIndex, TCL_DYNAMIC); + availPtr->pkgIndex = NULL; } ckfree(availPtr); } @@ -1001,6 +1002,7 @@ Tcl_PackageObjCmd( Tcl_EventuallyFree(availPtr->script, TCL_DYNAMIC); if (availPtr->pkgIndex) { Tcl_EventuallyFree(availPtr->pkgIndex, TCL_DYNAMIC); + availPtr->pkgIndex = NULL; } break; } @@ -1012,7 +1014,7 @@ Tcl_PackageObjCmd( } if (availPtr == NULL) { availPtr = ckalloc(sizeof(PkgAvail)); - availPtr->pkgIndex = 0; + availPtr->pkgIndex = NULL; DupBlock(availPtr->version, argv3, (unsigned) length + 1); if (prevPtr == NULL) { @@ -1384,6 +1386,7 @@ TclFreePackageInfo( Tcl_EventuallyFree(availPtr->script, TCL_DYNAMIC); if (availPtr->pkgIndex) { Tcl_EventuallyFree(availPtr->pkgIndex, TCL_DYNAMIC); + availPtr->pkgIndex = NULL; } ckfree(availPtr); } -- cgit v0.12 From 6c799d891d69e04b9e0f32ca59719b4b23dc311a Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 4 Jan 2018 02:32:46 +0000 Subject: Minimal fixes to stop the [package files] machinery writing to freed mem. This contribution needs a careful review from someone who actually knows how Tcl_Preserve, etc. work. --- generic/tclPkg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index cdf9a8b..288d5dc 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -948,6 +948,7 @@ Tcl_PackageObjCmd( Tcl_EventuallyFree(availPtr->script, TCL_DYNAMIC); if (availPtr->pkgIndex) { Tcl_EventuallyFree(availPtr->pkgIndex, TCL_DYNAMIC); + availPtr->pkgIndex = NULL; } ckfree(availPtr); } @@ -1001,6 +1002,7 @@ Tcl_PackageObjCmd( Tcl_EventuallyFree(availPtr->script, TCL_DYNAMIC); if (availPtr->pkgIndex) { Tcl_EventuallyFree(availPtr->pkgIndex, TCL_DYNAMIC); + availPtr->pkgIndex = NULL; } break; } @@ -1012,7 +1014,7 @@ Tcl_PackageObjCmd( } if (availPtr == NULL) { availPtr = ckalloc(sizeof(PkgAvail)); - availPtr->pkgIndex = 0; + availPtr->pkgIndex = NULL; DupBlock(availPtr->version, argv3, (unsigned) length + 1); if (prevPtr == NULL) { @@ -1384,6 +1386,7 @@ TclFreePackageInfo( Tcl_EventuallyFree(availPtr->script, TCL_DYNAMIC); if (availPtr->pkgIndex) { Tcl_EventuallyFree(availPtr->pkgIndex, TCL_DYNAMIC); + availPtr->pkgIndex = NULL; } ckfree(availPtr); } -- cgit v0.12 From 26b5bf3eca7b04ccab8b69c78ffd578425e8f6f0 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 4 Jan 2018 12:58:31 +0000 Subject: (cherry-pick): Use http 2 instead of http 1 for Safe Base testing. --- tests/safe.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/safe.test b/tests/safe.test index 6784bb9..5bed5ff 100644 --- a/tests/safe.test +++ b/tests/safe.test @@ -172,17 +172,17 @@ test safe-6.3 {test safe interpreters knowledge of the world} { # aren't leaking infos, but they still do... # high level general test -test safe-7.1 {tests that everything works at high level} { +test safe-7.1 {tests that everything works at high level} -body { set i [safe::interpCreate]; # no error shall occur: # (because the default access_path shall include 1st level sub dirs # so package require in a slave works like in the master) - set v [interp eval $i {package require http 1}] + set v [interp eval $i {package require http 2}] # no error shall occur: - interp eval $i {http_config}; + interp eval $i {http::config} safe::interpDelete $i set v -} 1.0 +} -match glob -result 2.* test safe-7.2 {tests specific path and interpFind/AddToAccessPath} -body { set i [safe::interpCreate -nostat -nested 1 -accessPath [list [info library]]]; # should not add anything (p0) -- cgit v0.12 From 7e4261e22c5e89d5591793bf264bdc35eb154653 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Mon, 8 Jan 2018 17:03:07 +0000 Subject: Rearrange a few lines TclRenameCommand to reduce operations. --- generic/tclBasic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 3ed3447..d2e96b8 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -2626,10 +2626,6 @@ TclRenameCommand( Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "COMMAND", oldName, 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 @@ -2638,10 +2634,14 @@ TclRenameCommand( if ((newName == NULL) || (*newName == '\0')) { Tcl_DeleteCommandFromToken(interp, cmd); - result = TCL_OK; - goto done; + return TCL_OK; } + cmdNsPtr = cmdPtr->nsPtr; + oldFullName = Tcl_NewObj(); + Tcl_IncrRefCount(oldFullName); + Tcl_GetCommandFullName(interp, cmd, oldFullName); + /* * Make sure that the destination command does not already exist. The * rename operation is like creating a command, so we should automatically -- cgit v0.12 From 4a5058fc1bd50653d1de1db7f43ed983b4c8fd72 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Mon, 8 Jan 2018 18:21:40 +0000 Subject: Udate Tcl_ObjectDeleted to reflect recent changes. --- generic/tclOO.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index 0243c15..7719f50 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -1083,9 +1083,7 @@ ObjectNamespaceDeleted( * methods on the object. */ - /* To do: Get dkf to weigh in on wether this should be protected with a - * !IsRoot() condition. - */ + /* To do: Should this be protected with a * !IsRoot() condition? */ TclOORemoveFromInstances(oPtr, oPtr->selfCls); FOREACH(mixinPtr, oPtr->mixins) { @@ -2842,7 +2840,7 @@ int Tcl_ObjectDeleted( Tcl_Object object) { - return Deleted((Object *)object) ? 1 : 0; + return ((Object *)object)->command == NULL; } Tcl_Object -- cgit v0.12 From 6d9902632c27a3a3a46f9ea9506555027acac8ac Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 9 Jan 2018 00:10:22 +0000 Subject: Some refactoring and tidying up of comments. --- generic/tclOO.c | 340 ++++++++++++++++++++++++++++++---------------- generic/tclOOCall.c | 13 +- generic/tclOODefineCmds.c | 95 +++++++++++-- 3 files changed, 318 insertions(+), 130 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index 7719f50..39e3fb2 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -71,7 +71,9 @@ static void DeletedHelpersNamespace(ClientData clientData); static Tcl_NRPostProc FinalizeAlloc; static Tcl_NRPostProc FinalizeNext; static Tcl_NRPostProc FinalizeObjectCall; -static void initClassPath(Tcl_Interp * interp, Class *clsPtr); +static inline void InitClassPath(Tcl_Interp * interp, Class *clsPtr); +static void InitClassSystemRoots(Tcl_Interp *interp, + Foundation *fPtr); static int InitFoundation(Tcl_Interp *interp); static void KillFoundation(ClientData clientData, Tcl_Interp *interp); @@ -82,6 +84,8 @@ static void ObjectRenamedTrace(ClientData clientData, const char *newName, int flags); static void ReleaseClassContents(Tcl_Interp *interp,Object *oPtr); static void DeleteDescendants(Tcl_Interp *interp,Object *oPtr); +static inline void RemoveClass(Class **list, int num, int idx); +static inline void RemoveObject(Object **list, int num, int idx); static inline void SquelchCachedName(Object *oPtr); static int PublicObjectCmd(ClientData clientData, @@ -96,8 +100,6 @@ static int PrivateObjectCmd(ClientData clientData, static int PrivateNRObjectCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const *objv); -static void RemoveClass(Class ** list, int num, int idx); -static void RemoveObject(Object ** list, int num, int idx); /* * Methods in the oo::object and oo::class classes. First, we define a helper @@ -236,14 +238,50 @@ MODULE_SCOPE const TclOOStubs tclOOStubs; #define IsRoot(ocPtr) ((ocPtr)->flags & (ROOT_OBJECT|ROOT_CLASS)) #define RemoveItem(type, lst, i) \ - do { \ - Remove ## type ((lst).list, (lst).num, i); \ - (lst).num--; \ + do { \ + Remove ## type ((lst).list, (lst).num, i); \ + (lst).num--; \ } while (0) /* * ---------------------------------------------------------------------- * + * RemoveClass, RemoveObject -- + * + * Helpers for the RemoveItem macro for deleting a class or object from a + * list. Setting the "empty" location to NULL makes debugging a little + * easier. + * + * ---------------------------------------------------------------------- + */ + +static inline void +RemoveClass( + Class **list, + int num, + int idx) +{ + for (; idx < num - 1; idx++) { + list[idx] = list[idx + 1]; + } + list[idx] = NULL; +} + +static inline void +RemoveObject( + Object **list, + int num, + int idx) +{ + for (; idx < num - 1; idx++) { + list[idx] = list[idx + 1]; + } + list[idx] = NULL; +} + +/* + * ---------------------------------------------------------------------- + * * TclOOInit -- * * Called to initialise the OO system within an interpreter. @@ -321,10 +359,6 @@ InitFoundation( Tcl_GetThreadData(&tsdKey, sizeof(ThreadLocalData)); Foundation *fPtr = ckalloc(sizeof(Foundation)); Tcl_Obj *namePtr, *argsPtr, *bodyPtr; - - Class fakeCls; - Object fakeObject; - Tcl_DString buffer; Command *cmdPtr; int i; @@ -387,47 +421,10 @@ InitFoundation( Tcl_CallWhenDeleted(interp, KillFoundation, NULL); /* - * Create the objects at the core of the object system. These need to be - * spliced manually. + * Create the special objects at the core of the object system. */ - /* Stand up a phony class for bootstrapping. */ - fPtr->objectCls = &fakeCls; - /* referenced in AllocClass to increment the refCount. */ - fakeCls.thisPtr = &fakeObject; - - fPtr->objectCls = AllocClass(interp, - AllocObject(interp, "object", (Namespace *)fPtr->ooNs, NULL)); - fPtr->classCls = AllocClass(interp, - AllocObject(interp, "class", (Namespace *)fPtr->ooNs, NULL)); - - /* Rewire bootstrapped objects. */ - fPtr->objectCls->thisPtr->selfCls = fPtr->classCls; - fPtr->classCls->thisPtr->selfCls = fPtr->classCls; - - AddRef(fPtr->objectCls->thisPtr); - AddRef(fPtr->classCls->thisPtr); - AddRef(fPtr->classCls->thisPtr->selfCls->thisPtr); - AddRef(fPtr->objectCls->thisPtr->selfCls->thisPtr); - - /* special initialization for the primordial objects */ - fPtr->objectCls->thisPtr->flags |= ROOT_OBJECT; - fPtr->objectCls->flags |= ROOT_OBJECT; - - /* This is why it is unnecessary in this routine to make up for the - * incremented reference count of fPtr->objectCls that was sallwed by - * fakeObject. */ - fPtr->objectCls->superclasses.num = 0; - ckfree(fPtr->objectCls->superclasses.list); - fPtr->objectCls->superclasses.list = NULL; - - fPtr->classCls->thisPtr->flags |= ROOT_CLASS; - fPtr->classCls->flags |= ROOT_CLASS; - - /* Standard initialization for new Objects */ - TclOOAddToInstances(fPtr->objectCls->thisPtr, fPtr->classCls); - TclOOAddToInstances(fPtr->classCls->thisPtr, fPtr->classCls); - TclOOAddToSubclasses(fPtr->classCls, fPtr->objectCls); + InitClassSystemRoots(interp, fPtr); /* * Basic method declarations for the core classes. @@ -494,6 +491,88 @@ InitFoundation( } return Tcl_EvalEx(interp, slotScript, -1, 0); } + +/* + * ---------------------------------------------------------------------- + * + * InitClassSystemRoots -- + * + * Creates the objects at the core of the object system. These need to be + * spliced manually. + * + * ---------------------------------------------------------------------- + */ + +static void +InitClassSystemRoots( + Tcl_Interp *interp, + Foundation *fPtr) +{ + Class fakeCls; + Object fakeObject; + + /* + * Stand up a phony class for bootstrapping. + */ + + fPtr->objectCls = &fakeCls; + + /* + * Referenced in AllocClass to increment the refCount. + */ + + fakeCls.thisPtr = &fakeObject; + + fPtr->objectCls = AllocClass(interp, + AllocObject(interp, "object", (Namespace *)fPtr->ooNs, NULL)); + fPtr->classCls = AllocClass(interp, + AllocObject(interp, "class", (Namespace *)fPtr->ooNs, NULL)); + + /* + * Rewire bootstrapped objects. + */ + + fPtr->objectCls->thisPtr->selfCls = fPtr->classCls; + fPtr->classCls->thisPtr->selfCls = fPtr->classCls; + + AddRef(fPtr->objectCls->thisPtr); + AddRef(fPtr->classCls->thisPtr); + AddRef(fPtr->classCls->thisPtr->selfCls->thisPtr); + AddRef(fPtr->objectCls->thisPtr->selfCls->thisPtr); + + /* + * Special initialization for the primordial objects. + */ + + fPtr->objectCls->thisPtr->flags |= ROOT_OBJECT; + fPtr->objectCls->flags |= ROOT_OBJECT; + + /* + * This is why it is unnecessary in this routine to make up for the + * incremented reference count of fPtr->objectCls that was sallwed by + * fakeObject. + */ + + fPtr->objectCls->superclasses.num = 0; + ckfree(fPtr->objectCls->superclasses.list); + fPtr->objectCls->superclasses.list = NULL; + + fPtr->classCls->thisPtr->flags |= ROOT_CLASS; + fPtr->classCls->flags |= ROOT_CLASS; + + /* + * Standard initialization for new Objects. + */ + + TclOOAddToInstances(fPtr->objectCls->thisPtr, fPtr->classCls); + TclOOAddToInstances(fPtr->classCls->thisPtr, fPtr->classCls); + TclOOAddToSubclasses(fPtr->classCls, fPtr->objectCls); + + /* + * THIS IS THE ONLY FUNCTION THAT DOES NON-STANDARD CLASS SPLICING. + * Everything else is careful to prohibit looping. + */ +} /* * ---------------------------------------------------------------------- @@ -584,8 +663,8 @@ AllocObject( * if the OO system should pick the object * name itself (equal to the namespace * name). */ - Namespace *nsPtr, /* The namespace to create the object in, - or NULL if *nameStr is NULL */ + Namespace *nsPtr, /* The namespace to create the object in, or + * NULL if *nameStr is NULL */ const char *nsNameStr) /* The name of the namespace to create, or * NULL if the OO system should pick a unique * name itself. If this is non-NULL but names @@ -678,10 +757,10 @@ AllocObject( /* * An object starts life with a refCount of 2 to mark the two stages of * destruction it occur: A call to ObjectRenamedTrace(), and a call to - * ObjectNamespaceDeleted(). + * ObjectNamespaceDeleted(). */ - oPtr->refCount = 2; + oPtr->refCount = 2; oPtr->flags = USE_CLASS_CACHE; /* @@ -716,7 +795,7 @@ AllocObject( tracePtr->refCount = 1; oPtr->myCommand = TclNRCreateCommandInNs(interp, "my", oPtr->namespacePtr, - PrivateObjectCmd, PrivateNRObjectCmd, oPtr, MyDeleted); + PrivateObjectCmd, PrivateNRObjectCmd, oPtr, MyDeleted); return oPtr; } @@ -786,6 +865,7 @@ ObjectRenamedTrace( int flags) /* Why was the object deleted? */ { Object *oPtr = clientData; + /* * If this is a rename and not a delete of the object, we just flush the * cache of the object name. @@ -812,7 +892,7 @@ ObjectRenamedTrace( /* * ---------------------------------------------------------------------- * - * ReleaseClassContents -- + * DeleteDescendants, ReleaseClassContents -- * * Tear down the special class data structure, including deleting all * dependent classes and objects. @@ -834,9 +914,11 @@ DeleteDescendants( */ FOREACH(mixinSubclassPtr, clsPtr->mixinSubs) { - /* This condition also covers the case where mixinSubclassPtr == + /* + * This condition also covers the case where mixinSubclassPtr == * clsPtr */ + if (!Deleted(mixinSubclassPtr->thisPtr)) { Tcl_DeleteCommandFromToken(interp, mixinSubclassPtr->thisPtr->command); @@ -844,6 +926,7 @@ DeleteDescendants( i -= TclOORemoveFromMixinSubs(mixinSubclassPtr, clsPtr); TclOODecrRefCount(mixinSubclassPtr->thisPtr); } + /* * Squelch subclasses of this class. */ @@ -862,7 +945,10 @@ DeleteDescendants( if (!IsRootClass(oPtr)) { FOREACH(instancePtr, clsPtr->instances) { - /* This condition also covers the case where instancePtr == oPtr */ + /* + * This condition also covers the case where instancePtr == oPtr + */ + if (!Deleted(instancePtr) && !IsRoot(instancePtr)) { Tcl_DeleteCommandFromToken(interp, instancePtr->command); } @@ -870,7 +956,6 @@ DeleteDescendants( } } } - static void ReleaseClassContents( @@ -878,7 +963,7 @@ ReleaseClassContents( Object *oPtr) /* The object representing the class. */ { FOREACH_HASH_DECLS; - int i; + int i; Class *clsPtr = oPtr->classPtr, *tmpClsPtr; Method *mPtr; Foundation *fPtr = oPtr->fPtr; @@ -1008,9 +1093,11 @@ ObjectNamespaceDeleted( int i; if (Deleted(oPtr)) { - /* To do: Can ObjectNamespaceDeleted ever be called twice? If not, - * this guard could be removed. + /* + * TODO: Can ObjectNamespaceDeleted ever be called twice? If not, this + * guard could be removed. */ + return; } @@ -1019,6 +1106,7 @@ ObjectNamespaceDeleted( * process of being deleted, nothing else may modify its bookeeping * records. This is the flag that */ + oPtr->flags |= OBJECT_DELETED; /* Let the dominoes fall */ @@ -1032,6 +1120,7 @@ ObjectNamespaceDeleted( * in that case when the destructor is partially deleted before the uses * of it have gone. [Bug 2949397] */ + if (!Tcl_InterpDeleted(interp) && !(oPtr->flags & DESTRUCTOR_CALLED)) { CallContext *contextPtr = TclOOGetCallContext(oPtr, NULL, DESTRUCTOR, NULL); @@ -1071,6 +1160,7 @@ ObjectNamespaceDeleted( * The namespace must have been deleted directly. Delete the command * as well. */ + Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command); } @@ -1083,7 +1173,10 @@ ObjectNamespaceDeleted( * methods on the object. */ - /* To do: Should this be protected with a * !IsRoot() condition? */ + /* + * TODO: Should this be protected with a * !IsRoot() condition? + */ + TclOORemoveFromInstances(oPtr, oPtr->selfCls); FOREACH(mixinPtr, oPtr->mixins) { @@ -1134,22 +1227,19 @@ ObjectNamespaceDeleted( } /* - * Because an object can be a class that is an instance of itself, the - * A class object's class structure should only be cleaned after most of - * the cleanup on the object is done. - */ - - - /* + * Because an object can be a class that is an instance of itself, the + * class object's class structure should only be cleaned after most of the + * cleanup on the object is done. + * * The class of objects needs some special care; if it is deleted (and * we're not killing the whole interpreter) we force the delete of the * class of classes now as well. Due to the incestuous nature of those two * classes, if one goes the other must too and yet the tangle can * sometimes not go away automatically; we force it here. [Bug 2962664] */ - if (IsRootObject(oPtr) && !Deleted(fPtr->classCls->thisPtr) - && !Tcl_InterpDeleted(interp)) { + if (IsRootObject(oPtr) && !Deleted(fPtr->classCls->thisPtr) + && !Tcl_InterpDeleted(interp)) { Tcl_DeleteCommandFromToken(interp, fPtr->classCls->thisPtr->command); } @@ -1170,7 +1260,7 @@ ObjectNamespaceDeleted( /* * ---------------------------------------------------------------------- * - * TclOODecrRef -- + * TclOODecrRefCount -- * * Decrement the refcount of an object and deallocate storage then object * is no longer referenced. Returns 1 if storage was deallocated, and 0 @@ -1178,9 +1268,14 @@ ObjectNamespaceDeleted( * * ---------------------------------------------------------------------- */ -int TclOODecrRefCount(Object *oPtr) { + +int +TclOODecrRefCount( + Object *oPtr) +{ if (oPtr->refCount-- <= 1) { Class *clsPtr = oPtr->classPtr; + if (oPtr->classPtr != NULL) { ckfree(clsPtr->superclasses.list); ckfree(clsPtr->subclasses.list); @@ -1195,18 +1290,6 @@ int TclOODecrRefCount(Object *oPtr) { return 0; } -/* setting the "empty" location to NULL makes debugging a little easier */ -#define REMOVEBODY { \ - for (; idx < num - 1; idx++) { \ - list[idx] = list[idx+1]; \ - } \ - list[idx] = NULL; \ - return; \ -} -void RemoveClass(Class **list, int num, int idx) REMOVEBODY - -void RemoveObject(Object **list, int num, int idx) REMOVEBODY - /* * ---------------------------------------------------------------------- * @@ -1226,6 +1309,7 @@ TclOORemoveFromInstances( { int i, res = 0; Object *instPtr; + if (Deleted(clsPtr->thisPtr)) { return res; } @@ -1291,6 +1375,7 @@ TclOORemoveFromSubclasses( { int i, res = 0; Class *subclsPtr; + if (Deleted(superPtr->thisPtr)) { return res; } @@ -1331,7 +1416,8 @@ TclOOAddToSubclasses( if (superPtr->subclasses.size == ALLOC_CHUNK) { superPtr->subclasses.list = ckalloc(sizeof(Class *) * ALLOC_CHUNK); } else { - superPtr->subclasses.list = ckrealloc(superPtr->subclasses.list, sizeof(Class *) * superPtr->subclasses.size); + superPtr->subclasses.list = ckrealloc(superPtr->subclasses.list, + sizeof(Class *) * superPtr->subclasses.size); } } superPtr->subclasses.list[superPtr->subclasses.num++] = subPtr; @@ -1418,6 +1504,25 @@ TclOOAddToMixinSubs( * ---------------------------------------------------------------------- */ +static inline void +InitClassPath( + Tcl_Interp *interp, + Class *clsPtr) +{ + Foundation *fPtr = GetFoundation(interp); + + if (fPtr->helpersNs != NULL) { + Tcl_Namespace *path[2]; + + path[0] = fPtr->helpersNs; + path[1] = fPtr->ooNs; + TclSetNsPath((Namespace *) clsPtr->thisPtr->namespacePtr, 2, path); + } else { + TclSetNsPath((Namespace *) clsPtr->thisPtr->namespacePtr, 1, + &fPtr->ooNs); + } +} + static Class * AllocClass( Tcl_Interp *interp, /* Interpreter within which to allocate the @@ -1434,7 +1539,8 @@ AllocClass( /* * Configure the namespace path for the class's object. */ - initClassPath(interp, clsPtr); + + InitClassPath(interp, clsPtr); /* * Classes are subclasses of oo::object, i.e. the objects they create are @@ -1460,19 +1566,6 @@ AllocClass( Tcl_InitObjHashTable(&clsPtr->classMethods); return clsPtr; } -static void -initClassPath(Tcl_Interp *interp, Class *clsPtr) { - Foundation *fPtr = GetFoundation(interp); - if (fPtr->helpersNs != NULL) { - Tcl_Namespace *path[2]; - path[0] = fPtr->helpersNs; - path[1] = fPtr->ooNs; - TclSetNsPath((Namespace *) clsPtr->thisPtr->namespacePtr, 2, path); - } else { - TclSetNsPath((Namespace *) clsPtr->thisPtr->namespacePtr, 1, - &fPtr->ooNs); - } -} /* * ---------------------------------------------------------------------- @@ -1503,7 +1596,9 @@ Tcl_NewObjectInstance( ClientData clientData[4]; oPtr = TclNewObjectInstanceCommon(interp, classPtr, nameStr, nsNameStr); - if (oPtr == NULL) {return NULL;} + if (oPtr == NULL) { + return NULL; + } /* * Run constructors, except when objc < 0, which is a special flag case @@ -1572,7 +1667,9 @@ TclNRNewObjectInstance( Object *oPtr; oPtr = TclNewObjectInstanceCommon(interp, classPtr, nameStr, nsNameStr); - if (oPtr == NULL) {return TCL_ERROR;} + if (oPtr == NULL) { + return TCL_ERROR; + } /* * Run constructors, except when objc < 0 (a special flag case used for @@ -1623,29 +1720,33 @@ TclNewObjectInstanceCommon( Foundation *fPtr = GetFoundation(interp); Object *oPtr; const char *simpleName = NULL; - Namespace *nsPtr = NULL, *dummy, - *inNsPtr = (Namespace *)TclGetCurrentNamespace(interp); + Namespace *nsPtr = NULL, *dummy; + Namespace *inNsPtr = (Namespace *) TclGetCurrentNamespace(interp); int isNew; if (nameStr) { - TclGetNamespaceForQualName(interp, nameStr, inNsPtr, TCL_CREATE_NS_IF_UNKNOWN, - &nsPtr, &dummy, &dummy, &simpleName); + TclGetNamespaceForQualName(interp, nameStr, inNsPtr, + TCL_CREATE_NS_IF_UNKNOWN, &nsPtr, &dummy, &dummy, &simpleName); /* * Disallow creation of an object over an existing command. */ hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, simpleName, &isNew); - if (isNew) { - /* Just kidding */ - Tcl_DeleteHashEntry(hPtr); - } else { + if (!isNew) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't create object \"%s\": command already exists with" " that name", nameStr)); Tcl_SetErrorCode(interp, "TCL", "OO", "OVERWRITE_OBJECT", NULL); return NULL; } + + /* + * We could make a hash entry! Don't actually want to do that here so + * nuke it immediately because we'll create it properly soon. + */ + + Tcl_DeleteHashEntry(hPtr); } /* @@ -1655,6 +1756,7 @@ TclNewObjectInstanceCommon( oPtr = AllocObject(interp, simpleName, nsPtr, nsNameStr); oPtr->selfCls = classPtr; TclOOAddToInstances(oPtr, classPtr); + /* * Check to see if we're really creating a class. If so, allocate the * class structure as well. @@ -1690,8 +1792,8 @@ FinalizeAlloc( Tcl_Object *objectPtr = data[3]; /* - * Ensure an error if the object was deleted in the constructor. - * Don't want to lose errors by accident. [Bug 2903011] + * Ensure an error if the object was deleted in the constructor. Don't + * want to lose errors by accident. [Bug 2903011] */ if (result != TCL_ERROR && Deleted(oPtr)) { @@ -1713,13 +1815,21 @@ FinalizeAlloc( (void) TclOOObjectName(interp, oPtr); Tcl_DeleteCommandFromToken(interp, oPtr->command); } - /* This decrements the refcount of oPtr */ + + /* + * This decrements the refcount of oPtr. + */ + TclOODeleteContext(contextPtr); return TCL_ERROR; } Tcl_RestoreInterpState(interp, state); *objectPtr = (Tcl_Object) oPtr; - /* This decrements the refcount of oPtr */ + + /* + * This decrements the refcount of oPtr. + */ + TclOODeleteContext(contextPtr); return TCL_OK; } @@ -1828,7 +1938,7 @@ Tcl_CopyObjectInstance( */ o2Ptr->flags = oPtr->flags & ~( - OBJECT_DELETED | ROOT_OBJECT | ROOT_CLASS | FILTER_HANDLING); + OBJECT_DELETED | ROOT_OBJECT | ROOT_CLASS | FILTER_HANDLING); /* * Copy the object's metadata. */ diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index c71425b..7da9da0 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -110,7 +110,11 @@ TclOODeleteContext( TclOODeleteChain(contextPtr->callPtr); if (oPtr != NULL) { TclStackFree(oPtr->fPtr->interp, contextPtr); - /* Corresponding AddRef() in TclOO.c/TclOOObjectCmdCore */ + + /* + * Corresponding AddRef() in TclOO.c/TclOOObjectCmdCore + */ + TclOODecrRefCount(oPtr); } } @@ -901,6 +905,7 @@ InitCallChain( * ---------------------------------------------------------------------- * * IsStillValid -- + * * Calculates whether the given call chain can be used for executing a * method for the given object. The condition on a chain from a cached * location being reusable is: @@ -1172,7 +1177,11 @@ TclOOGetCallContext( returnContext: contextPtr = TclStackAlloc(oPtr->fPtr->interp, sizeof(CallContext)); contextPtr->oPtr = oPtr; - /* Corresponding TclOODecrRefCount() in TclOODeleteContext */ + + /* + * Corresponding TclOODecrRefCount() in TclOODeleteContext + */ + AddRef(oPtr); contextPtr->callPtr = callPtr; contextPtr->skip = 2; diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index 7f3ea18..c08b350 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -123,6 +123,7 @@ static const struct DeclaredSlot slots[] = { * ---------------------------------------------------------------------- * * BumpGlobalEpoch -- + * * Utility that ensures that call chains that are invalid will get thrown * away at an appropriate time. Note that exactly which epoch gets * advanced will depend on exactly what the class is tangled up in; in @@ -167,6 +168,7 @@ BumpGlobalEpoch( * ---------------------------------------------------------------------- * * RecomputeClassCacheFlag -- + * * Determine whether the object is prototypical of its class, and hence * able to use the class's method chain cache. * @@ -189,6 +191,7 @@ RecomputeClassCacheFlag( * ---------------------------------------------------------------------- * * TclOOObjectSetFilters -- + * * Install a list of filter method names into an object. * * ---------------------------------------------------------------------- @@ -247,6 +250,7 @@ TclOOObjectSetFilters( * ---------------------------------------------------------------------- * * TclOOClassSetFilters -- + * * Install a list of filter method names into a class. * * ---------------------------------------------------------------------- @@ -309,6 +313,7 @@ TclOOClassSetFilters( * ---------------------------------------------------------------------- * * TclOOObjectSetMixins -- + * * Install a list of mixin classes into an object. * * ---------------------------------------------------------------------- @@ -350,9 +355,12 @@ TclOOObjectSetMixins( FOREACH(mixinPtr, oPtr->mixins) { if (mixinPtr != oPtr->selfCls) { TclOOAddToInstances(oPtr, mixinPtr); - /* Corresponding TclOODecrRefCount() is in the caller of this + + /* + * Corresponding TclOODecrRefCount() is in the caller of this * function. */ + TclOODecrRefCount(mixinPtr->thisPtr); } } @@ -364,6 +372,7 @@ TclOOObjectSetMixins( * ---------------------------------------------------------------------- * * TclOOClassSetMixins -- + * * Install a list of mixin classes into a class. * * ---------------------------------------------------------------------- @@ -401,9 +410,12 @@ TclOOClassSetMixins( memcpy(classPtr->mixins.list, mixins, sizeof(Class *) * numMixins); FOREACH(mixinPtr, classPtr->mixins) { TclOOAddToMixinSubs(classPtr, mixinPtr); - /* Corresponding TclOODecrRefCount() is in the caller of this - * function + + /* + * Corresponding TclOODecrRefCount() is in the caller of this + * function. */ + TclOODecrRefCount(mixinPtr->thisPtr); } } @@ -414,6 +426,7 @@ TclOOClassSetMixins( * ---------------------------------------------------------------------- * * RenameDeleteMethod -- + * * Core of the code to rename and delete methods. * * ---------------------------------------------------------------------- @@ -503,6 +516,7 @@ RenameDeleteMethod( * ---------------------------------------------------------------------- * * TclOOUnknownDefinition -- + * * Handles what happens when an unknown command is encountered during the * processing of a definition script. Works by finding a command in the * operating definition namespace that the requested command is a unique @@ -581,6 +595,7 @@ TclOOUnknownDefinition( * ---------------------------------------------------------------------- * * FindCommand -- + * * Specialized version of Tcl_FindCommand that handles command prefixes * and disallows namespace magic. * @@ -641,6 +656,7 @@ FindCommand( * ---------------------------------------------------------------------- * * InitDefineContext -- + * * Does the magic incantations necessary to push the special stack frame * used when processing object definitions. It is up to the caller to * dispose of the frame (with TclPopStackFrame) when finished. @@ -666,7 +682,9 @@ InitDefineContext( return TCL_ERROR; } - /* framePtrPtr is needed to satisfy GCC 3.3's strict aliasing rules */ + /* + * framePtrPtr is needed to satisfy GCC 3.3's strict aliasing rules. + */ (void) TclPushStackFrame(interp, (Tcl_CallFrame **) framePtrPtr, namespacePtr, FRAME_IS_OO_DEFINE); @@ -681,6 +699,7 @@ InitDefineContext( * ---------------------------------------------------------------------- * * TclOOGetDefineCmdContext -- + * * Extracts the magic token from the current stack frame, or returns NULL * (and leaves an error message) otherwise. * @@ -717,6 +736,7 @@ TclOOGetDefineCmdContext( * ---------------------------------------------------------------------- * * GetClassInOuterContext -- + * * Wrapper round Tcl_GetObjectFromObj to perform the lookup in the * context that called oo::define (or equivalent). Note that this may * have to go up multiple levels to get the level that we started doing @@ -759,6 +779,7 @@ GetClassInOuterContext( * ---------------------------------------------------------------------- * * GenerateErrorInfo -- + * * Factored out code to generate part of the error trace messages. * * ---------------------------------------------------------------------- @@ -797,6 +818,7 @@ GenerateErrorInfo( * ---------------------------------------------------------------------- * * MagicDefinitionInvoke -- + * * Part of the implementation of the "oo::define" and "oo::objdefine" * commands that is used to implement the more-than-one-argument case, * applying ensemble-like tricks with dispatch so that error messages are @@ -860,6 +882,7 @@ MagicDefinitionInvoke( * ---------------------------------------------------------------------- * * TclOODefineObjCmd -- + * * Implementation of the "oo::define" command. Works by effectively doing * the same as 'namespace eval', but with extra magic applied so that the * object to be modified is known to the commands in the target @@ -934,6 +957,7 @@ TclOODefineObjCmd( * ---------------------------------------------------------------------- * * TclOOObjDefObjCmd -- + * * Implementation of the "oo::objdefine" command. Works by effectively * doing the same as 'namespace eval', but with extra magic applied so * that the object to be modified is known to the commands in the target @@ -1001,6 +1025,7 @@ TclOOObjDefObjCmd( * ---------------------------------------------------------------------- * * TclOODefineSelfObjCmd -- + * * Implementation of the "self" subcommand of the "oo::define" command. * Works by effectively doing the same as 'namespace eval', but with * extra magic applied so that the object to be modified is known to the @@ -1068,6 +1093,7 @@ TclOODefineSelfObjCmd( * ---------------------------------------------------------------------- * * TclOODefineObjSelfObjCmd -- + * * Implementation of the "self" subcommand of the "oo::objdefine" * command. * @@ -1101,6 +1127,7 @@ TclOODefineObjSelfObjCmd( * ---------------------------------------------------------------------- * * TclOODefineClassObjCmd -- + * * Implementation of the "class" subcommand of the "oo::objdefine" * command. * @@ -1175,7 +1202,10 @@ TclOODefineClassObjCmd( if (oPtr->selfCls != clsPtr) { TclOORemoveFromInstances(oPtr, oPtr->selfCls); - /* Reference count already incremented 3 lines up. */ + /* + * Reference count already incremented a few lines up. + */ + oPtr->selfCls = clsPtr; TclOOAddToInstances(oPtr, oPtr->selfCls); @@ -1192,6 +1222,7 @@ TclOODefineClassObjCmd( * ---------------------------------------------------------------------- * * TclOODefineConstructorObjCmd -- + * * Implementation of the "constructor" subcommand of the "oo::define" * command. * @@ -1260,6 +1291,7 @@ TclOODefineConstructorObjCmd( * ---------------------------------------------------------------------- * * TclOODefineDeleteMethodObjCmd -- + * * Implementation of the "deletemethod" subcommand of the "oo::define" * and "oo::objdefine" commands. * @@ -1316,6 +1348,7 @@ TclOODefineDeleteMethodObjCmd( * ---------------------------------------------------------------------- * * TclOODefineDestructorObjCmd -- + * * Implementation of the "destructor" subcommand of the "oo::define" * command. * @@ -1380,6 +1413,7 @@ TclOODefineDestructorObjCmd( * ---------------------------------------------------------------------- * * TclOODefineExportObjCmd -- + * * Implementation of the "export" subcommand of the "oo::define" and * "oo::objdefine" commands. * @@ -1474,6 +1508,7 @@ TclOODefineExportObjCmd( * ---------------------------------------------------------------------- * * TclOODefineForwardObjCmd -- + * * Implementation of the "forward" subcommand of the "oo::define" and * "oo::objdefine" commands. * @@ -1534,6 +1569,7 @@ TclOODefineForwardObjCmd( * ---------------------------------------------------------------------- * * TclOODefineMethodObjCmd -- + * * Implementation of the "method" subcommand of the "oo::define" and * "oo::objdefine" commands. * @@ -1591,6 +1627,7 @@ TclOODefineMethodObjCmd( * ---------------------------------------------------------------------- * * TclOODefineMixinObjCmd -- + * * Implementation of the "mixin" subcommand of the "oo::define" and * "oo::objdefine" commands. * @@ -1634,9 +1671,12 @@ TclOODefineMixinObjCmd( goto freeAndError; } mixins[i-1] = clsPtr; - /* Corresponding TclOODecrRefCount() is in TclOOObjectSetMixins, + + /* + * Corresponding TclOODecrRefCount() is in TclOOObjectSetMixins, * TclOOClassSetMixinsk, or just below if this function fails. */ + AddRef(mixins[i-1]->thisPtr); } @@ -1661,6 +1701,7 @@ TclOODefineMixinObjCmd( * ---------------------------------------------------------------------- * * TclOODefineRenameMethodObjCmd -- + * * Implementation of the "renamemethod" subcommand of the "oo::define" * and "oo::objdefine" commands. * @@ -1717,6 +1758,7 @@ TclOODefineRenameMethodObjCmd( * ---------------------------------------------------------------------- * * TclOODefineUnexportObjCmd -- + * * Implementation of the "unexport" subcommand of the "oo::define" and * "oo::objdefine" commands. * @@ -1811,6 +1853,7 @@ TclOODefineUnexportObjCmd( * ---------------------------------------------------------------------- * * Tcl_ClassSetConstructor, Tcl_ClassSetDestructor -- + * * How to install a constructor or destructor into a class; API to call * from C. * @@ -1865,6 +1908,7 @@ Tcl_ClassSetDestructor( * ---------------------------------------------------------------------- * * TclOODefineSlots -- + * * Create the "::oo::Slot" class and its standard instances. Class * definition is empty at the stage (added by scripting). * @@ -1908,6 +1952,7 @@ TclOODefineSlots( * ---------------------------------------------------------------------- * * ClassFilterGet, ClassFilterSet -- + * * Implementation of the "filter" slot accessors of the "oo::define" * command. * @@ -1987,6 +2032,7 @@ ClassFilterSet( * ---------------------------------------------------------------------- * * ClassMixinGet, ClassMixinSet -- + * * Implementation of the "mixin" slot accessors of the "oo::define" * command. * @@ -2077,9 +2123,12 @@ ClassMixinSet( Tcl_SetErrorCode(interp, "TCL", "OO", "SELF_MIXIN", NULL); goto freeAndError; } - /* Corresponding TclOODecrRefCount() is in TclOOClassSetMixins, or just - * below if this function fails + + /* + * Corresponding TclOODecrRefCount() is in TclOOClassSetMixins, or + * just below if this function fails. */ + AddRef(mixins[i]->thisPtr); } @@ -2099,6 +2148,7 @@ ClassMixinSet( * ---------------------------------------------------------------------- * * ClassSuperGet, ClassSuperSet -- + * * Implementation of the "superclass" slot accessors of the "oo::define" * command. * @@ -2199,7 +2249,11 @@ ClassSuperSet( superclasses[0] = oPtr->fPtr->objectCls; } superc = 1; - /* Corresponding TclOODecrRefCount is near the end of this function */ + + /* + * Corresponding TclOODecrRefCount is near the end of this function. + */ + AddRef(superclasses[0]->thisPtr); } else { for (i=0 ; ithisPtr); } } @@ -2252,7 +2310,11 @@ ClassSuperSet( oPtr->classPtr->superclasses.num = superc; FOREACH(superPtr, oPtr->classPtr->superclasses) { TclOOAddToSubclasses(oPtr->classPtr, superPtr); - /* To account for the AddRef() earlier in this function */ + + /* + * To account for the AddRef() earlier in this function. + */ + TclOODecrRefCount(superPtr->thisPtr); } BumpGlobalEpoch(interp, oPtr->classPtr); @@ -2264,6 +2326,7 @@ ClassSuperSet( * ---------------------------------------------------------------------- * * ClassVarsGet, ClassVarsSet -- + * * Implementation of the "variable" slot accessors of the "oo::define" * command. * @@ -2406,6 +2469,7 @@ ClassVarsSet( * ---------------------------------------------------------------------- * * ObjectFilterGet, ObjectFilterSet -- + * * Implementation of the "filter" slot accessors of the "oo::objdefine" * command. * @@ -2473,6 +2537,7 @@ ObjFilterSet( * ---------------------------------------------------------------------- * * ObjectMixinGet, ObjectMixinSet -- + * * Implementation of the "mixin" slot accessors of the "oo::objdefine" * command. * @@ -2550,9 +2615,12 @@ ObjMixinSet( TclStackFree(interp, mixins); return TCL_ERROR; } - /* Corresponding TclOODecrRefCount() is in TclOOObjectSetMixins() or + + /* + * Corresponding TclOODecrRefCount() is in TclOOObjectSetMixins() or * just above if this function fails. */ + AddRef(mixins[i]->thisPtr); } @@ -2565,6 +2633,7 @@ ObjMixinSet( * ---------------------------------------------------------------------- * * ObjectVarsGet, ObjectVarsSet -- + * * Implementation of the "variable" slot accessors of the "oo::objdefine" * command. * -- cgit v0.12 From 48456596fff560a8a2e3bb709c7683d07874d306 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 9 Jan 2018 11:15:14 +0000 Subject: (partial) fix for [https://core.tcl.tk/tk/info/00a27923ee26437611e1ed83f96e15b6caabcd8b|00a27923ee]: text/entry dysfunctional when pasting an emoji on MacOSX. Don't handle incoming valid 4-byte UTF-8 characters as invalid byte sequences (since they aren't), but as being the Unicode replacement character. --- generic/tclUtf.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 6255a4e..f7ceaab 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -68,11 +68,7 @@ static const unsigned char totalBytes[256] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -#if TCL_UTF_MAX > 3 4,4,4,4,4,4,4,4, -#else - 1,1,1,1,1,1,1,1, -#endif 1,1,1,1,1,1,1,1 }; @@ -334,13 +330,22 @@ Tcl_UtfToUniChar( * represents itself. */ } -#if TCL_UTF_MAX > 3 else if (byte < 0xF8) { if (((src[1] & 0xC0) == 0x80) && ((src[2] & 0xC0) == 0x80) && ((src[3] & 0xC0) == 0x80)) { /* * Four-byte-character lead byte followed by three trail bytes. */ -#if TCL_UTF_MAX == 4 +#if TCL_UTF_MAX == 3 + byte = (((byte & 0x07) << 18) | ((src[1] & 0x3F) << 12) + | ((src[2] & 0x3F) << 6) | (src[3] & 0x3F)) - 0x10000; + if (byte & 0x100000) { + /* out of range, < 0x10000 or > 0x10ffff */ + } else { + /* produce replacement character, and advance source pointer */ + *chPtr = (Tcl_UniChar) 0xFFFD; + return 4; + } +#elif TCL_UTF_MAX == 4 Tcl_UniChar surrogate; byte = (((byte & 0x07) << 18) | ((src[1] & 0x3F) << 12) @@ -371,7 +376,6 @@ Tcl_UtfToUniChar( * represents itself. */ } -#endif *chPtr = (Tcl_UniChar) byte; return 1; @@ -505,13 +509,13 @@ Tcl_NumUtfChars( } if (i < 0) i = INT_MAX; /* Bug [2738427] */ } else { - register const char *endPtr = src + length - TCL_UTF_MAX; + register const char *endPtr = src + length - 4; while (src < endPtr) { src += TclUtfToUniChar(src, &ch); i++; } - endPtr += TCL_UTF_MAX; + endPtr += 4; while ((src < endPtr) && Tcl_UtfCharComplete(src, endPtr - src)) { src += TclUtfToUniChar(src, &ch); i++; @@ -683,7 +687,7 @@ Tcl_UtfPrev( int i, byte; look = --src; - for (i = 0; i < TCL_UTF_MAX; i++) { + for (i = 0; i < 4; i++) { if (look < start) { if (src < start) { src = start; -- cgit v0.12 From 37b48e808c43273e27f69fff6280a7a29f3b7c4d Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 9 Jan 2018 18:10:06 +0000 Subject: Fix tests dependent on other tests in zipfs.test Add a workaround for the fact that dynamic libraries called out from a non-install location can't be located and mounted in time to be a candidate for tcl_library when running under the constraints of "make test" --- tests/zipfs.test | 65 +++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/tests/zipfs.test b/tests/zipfs.test index abf888b..43aa48b 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -23,6 +23,10 @@ testConstraint zipfs [expr {[llength [info commands zlib]] && [regexp tcltest [i #} -result {} set ziproot [zipfs root] +set CWD [pwd] +set tmpdir [file join $CWD tmp] +file mkdir $tmpdir + test zipfs-0.1 {zipfs basics} -constraints zipfs -body { package require zipfs @@ -32,6 +36,22 @@ test zipfs-0.1 {zipfs basics} -constraints zipfs -body { expr {${ziproot} in [file volumes]} } -result 1 +if {![string match ${ziproot}* $tcl_library]} { + ### + # "make test" does not map tcl_library from the dynamic library on Unix + # + # Hack the environment to pretend we did pull tcl_library from a zip + # archive + ### + set tclzip [file join $CWD [::tcl::pkgconfig get zipfile,runtime]] + if {[file exists $tclzip]} { + zipfs mount $tclzip /lib/tcl + set ::tcl_library ${ziproot}lib/tcl/tcl_library + } else { + tcltest::skip zipfs-0.* + } +} + test zipfs-0.2 {zipfs basics} -constraints zipfs -body { string match ${ziproot}* $tcl_library } -result 1 @@ -116,25 +136,36 @@ test zipfs-1.10 {zipfs errors} -constraints zipfs -returnCodes error -body { zipfs list a b c d e f } -result {wrong # args: should be "zipfs list ?(-glob|-regexp)? ?pattern?"} +file mkdir tmp + test zipfs-2.1 {zipfs mkzip empty archive} -constraints zipfs -returnCodes error -body { - zipfs mkzip /tmp/abc.zip $tcl_library/xxxx ;# FIXME: test independence + zipfs mkzip [file join $tmpdir empty.zip] $tcl_library/xxxx } -result {empty archive} -test zipfs-2.2 {zipfs mkzip} -constraints zipfs -body { - set pwd [pwd] +### +# The 2.2 series of tests operate within +# a zipfile created a temporary directory +### +set zipfile [file join $tmpdir abc.zip] +if {[file exists $zipfile]} { + file delete $zipfile +} + +test zipfs-2.2.0 {zipfs mkzip} -constraints zipfs -body { cd $tcl_library/encoding - zipfs mkzip /tmp/abc.zip . - zipfs mount /tmp/abc.zip ${ziproot}abc ;# FIXME: test independence + zipfs mkzip $zipfile . + zipfs mount $zipfile ${ziproot}abc zipfs list -glob ${ziproot}abc/cp850.* } -cleanup { - cd $pwd + cd $CWD } -result "[zipfs root]abc/cp850.enc" -test zipfs-2.3 {zipfs info} -constraints zipfs -body { - zipfs info ${ziproot}abc/cp850.enc -} -result [list /tmp/abc.zip 1090 527 39318] ;# FIXME: result depends on content of encodings dir +test zipfs-2.2.1 {zipfs info} -constraints zipfs -body { + set r [zipfs info ${ziproot}abc/cp850.enc] + lrange $r 0 2 +} -result [list $zipfile 1090 527] ;# NOTE: Only the first 3 results are stable -test zipfs-2.4 {zipfs data} -constraints zipfs -body { +test zipfs-2.2.3 {zipfs data} -constraints zipfs -body { set zipfd [open ${ziproot}/abc/cp850.enc] ;# FIXME: leave open - see later test read $zipfd } -result {# Encoding file: cp850, single-byte @@ -159,21 +190,21 @@ S 00AD00B1201700BE00B600A700F700B800B000A800B700B900B300B225A000A0 } ;# FIXME: result depends on content of encodings dir -test zipfs-2.5 {zipfs exists} -constraints zipfs -body { +test zipfs-2.2.4 {zipfs exists} -constraints zipfs -body { zipfs exists /abc/cp850.enc } -result 1 -test zipfs-2.6 {zipfs unmount while busy} -constraints zipfs -body { - zipfs unmount /tmp/abc.zip +test zipfs-2.2.5 {zipfs unmount while busy} -constraints zipfs -body { + zipfs unmount $zipfile } -returnCodes error -result {filesystem is busy} -test zipfs-2.7 {zipfs unmount} -constraints zipfs -body { +test zipfs-2.2.6 {zipfs unmount} -constraints zipfs -body { close $zipfd - zipfs unmount /tmp/abc.zip + zipfs unmount $zipfile zipfs exists /abc/cp850.enc -} -cleanup { - file delete /tmp/abc.zip ;# FIXME: test independence } -result 0 + +file delete -force $tmpdir ::tcltest::cleanupTests return -- cgit v0.12 From 04d3db559246ee9e2ac2a5e20e52cf57b7af808b Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 10 Jan 2018 09:32:51 +0000 Subject: Don't use TclUtfToUniChar here: it doesn't give any advantage over Tcl_UtfToUniChar --- generic/tclUtil.c | 4 ++-- win/tclWinSerial.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 41795e8..15018de 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2223,7 +2223,7 @@ Tcl_StringCaseMatch( (nocase ? tolower(UCHAR(*str)) : UCHAR(*str)); str++; } else { - str += TclUtfToUniChar(str, &ch1); + str += Tcl_UtfToUniChar(str, &ch1); if (nocase) { ch1 = Tcl_UniCharToLower(ch1); } @@ -2252,7 +2252,7 @@ Tcl_StringCaseMatch( ? tolower(UCHAR(*pattern)) : UCHAR(*pattern)); pattern++; } else { - pattern += TclUtfToUniChar(pattern, &endChar); + pattern += Tcl_UtfToUniChar(pattern, &endChar); if (nocase) { endChar = Tcl_UniCharToLower(endChar); } diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c index 894f431..acfeecb 100644 --- a/win/tclWinSerial.c +++ b/win/tclWinSerial.c @@ -1741,12 +1741,12 @@ SerialSetOptionProc( Tcl_UniChar character = 0; int charLen; - charLen = TclUtfToUniChar(argv[0], &character); + charLen = Tcl_UtfToUniChar(argv[0], &character); if (argv[0][charLen]) { goto badXchar; } dcb.XonChar = (char) character; - charLen = TclUtfToUniChar(argv[1], &character); + charLen = Tcl_UtfToUniChar(argv[1], &character); if (argv[1][charLen]) { goto badXchar; } -- cgit v0.12 From 48d6a20861f95be856bef0e780c054757c9c3803 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 10 Jan 2018 14:02:03 +0000 Subject: Re-implement Tcl_WinTCharToUtf/Tcl_WinUtfToTChar in pure win32 api, even for TCL_UTF_MAX=3. We can do that now safely, because of the changed handling of valid 4-byte UTF-8 characters in the previous commit. --- generic/tclEvent.c | 1 - generic/tclIOUtil.c | 9 ------ generic/tclInt.h | 1 - generic/tclIntPlatDecls.h | 4 +++ generic/tclStubInit.c | 39 +++++++----------------- unix/tclUnixInit.c | 6 ---- win/tclWin32Dll.c | 76 ++--------------------------------------------- win/tclWinInit.c | 7 ----- 8 files changed, 17 insertions(+), 126 deletions(-) diff --git a/generic/tclEvent.c b/generic/tclEvent.c index 49fd2ae..93cf983 100644 --- a/generic/tclEvent.c +++ b/generic/tclEvent.c @@ -1057,7 +1057,6 @@ TclInitSubsystems(void) * mutexes. */ TclInitIOSubsystem(); /* Inits a tsd key (noop). */ TclInitEncodingSubsystem(); /* Process wide encoding init. */ - TclpSetInterfaces(); TclInitNamespaceSubsystem();/* Register ns obj type (mutexed). */ subsystemsInitialized = 1; } diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index 8fb3aa8..144bab0 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -830,15 +830,6 @@ TclResetFilesystem(void) if (++theFilesystemEpoch == 0) { ++theFilesystemEpoch; } - -#ifdef _WIN32 - /* - * Cleans up the win32 API filesystem proc lookup table. This must happen - * very late in finalization so that deleting of copied dlls can occur. - */ - - TclWinResetInterfaces(); -#endif } /* diff --git a/generic/tclInt.h b/generic/tclInt.h index 2ba0493..888adca 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3157,7 +3157,6 @@ MODULE_SCOPE Tcl_Obj * TclPathPart(Tcl_Interp *interp, Tcl_Obj *pathPtr, Tcl_PathPart portion); MODULE_SCOPE char * TclpReadlink(const char *fileName, Tcl_DString *linkPtr); -MODULE_SCOPE void TclpSetInterfaces(void); MODULE_SCOPE void TclpSetVariables(Tcl_Interp *interp); MODULE_SCOPE void * TclThreadStorageKeyGet(Tcl_ThreadDataKey *keyPtr); MODULE_SCOPE void TclThreadStorageKeySet(Tcl_ThreadDataKey *keyPtr, diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index 1222cee..ada1d2b 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -549,6 +549,10 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; #define TclWinConvertWSAError TclWinConvertError #undef TclpInetNtoa #define TclpInetNtoa inet_ntoa +#undef TclWinResetInterfaces +#define TclWinResetInterfaces() /* nop */ +#undef TclWinSetInterfaces +#define TclWinSetInterfaces(dummy) /* nop */ #if defined(_WIN32) # undef TclWinNToHS diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 227bf02..e25b148 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -104,6 +104,13 @@ static const char *TclGetStartupScriptFileName(void) #if defined(_WIN32) || defined(__CYGWIN__) #undef TclWinNToHS #undef TclWinGetPlatformId +#undef TclWinResetInterfaces +#undef TclWinSetInterfaces +static void +doNothing(void) +{ + /* dummy implementation, no need to do anything */ +} #if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 #define TclWinNToHS winNToHS static unsigned short TclWinNToHS(unsigned short ns) { @@ -115,9 +122,13 @@ TclWinGetPlatformId(void) { return 2; /* VER_PLATFORM_WIN32_NT */; } +#define TclWinResetInterfaces doNothing +#define TclWinSetInterfaces (void (*) (int)) doNothing #else #define TclWinNToHS 0 #define TclWinGetPlatformId 0 +#define TclWinResetInterfaces 0 +#define TclWinSetInterfaces 0 #endif #endif # define TclBNInitBignumFromWideUInt TclInitBignumFromWideUInt @@ -133,14 +144,8 @@ TclWinGetPlatformId(void) # define TclpIsAtty 0 #elif defined(__CYGWIN__) # define TclpIsAtty TclPlatIsAtty -# define TclWinSetInterfaces (void (*) (int)) doNothing # define TclWinAddProcess (void (*) (void *, unsigned int)) doNothing # define TclWinFlushDirtyChannels doNothing -# define TclWinResetInterfaces doNothing - -#if TCL_UTF_MAX < 4 -static Tcl_Encoding winTCharEncoding; -#endif static int TclpIsAtty(int fd) @@ -201,19 +206,12 @@ TclpGetPid(Tcl_Pid pid) return (int) (size_t) pid; } -static void -doNothing(void) -{ - /* dummy implementation, no need to do anything */ -} - char * Tcl_WinUtfToTChar( const char *string, int len, Tcl_DString *dsPtr) { -#if TCL_UTF_MAX > 3 WCHAR *wp; int size = MultiByteToWideChar(CP_UTF8, 0, string, len, 0, 0); @@ -225,13 +223,6 @@ Tcl_WinUtfToTChar( Tcl_DStringSetLength(dsPtr, 2*size); wp[size] = 0; return (char *)wp; -#else - if (!winTCharEncoding) { - winTCharEncoding = Tcl_GetEncoding(0, "unicode"); - } - return Tcl_UtfToExternalDString(winTCharEncoding, - string, len, dsPtr); -#endif } char * @@ -240,7 +231,6 @@ Tcl_WinTCharToUtf( int len, Tcl_DString *dsPtr) { -#if TCL_UTF_MAX > 3 char *p; int size; @@ -256,13 +246,6 @@ Tcl_WinTCharToUtf( Tcl_DStringSetLength(dsPtr, size); p[size] = 0; return p; -#else - if (!winTCharEncoding) { - winTCharEncoding = Tcl_GetEncoding(0, "unicode"); - } - return Tcl_ExternalToUtfDString(winTCharEncoding, - string, len, dsPtr); -#endif } #if defined(TCL_WIDE_INT_IS_LONG) diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index cc66569..630460a 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -577,12 +577,6 @@ TclpSetInitialEncodings(void) Tcl_DStringFree(&encodingName); } -void -TclpSetInterfaces(void) -{ - /* do nothing */ -} - static const char * SearchKnownEncodings( const char *encoding) diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index da1cdfe..599c126 100644 --- a/win/tclWin32Dll.c +++ b/win/tclWin32Dll.c @@ -32,10 +32,6 @@ static HINSTANCE hInstance; /* HINSTANCE of this DLL. */ #define cpuid __asm __emit 0fh __asm __emit 0a2h #endif -#if TCL_UTF_MAX < 4 -static Tcl_Encoding winTCharEncoding = NULL; -#endif - /* * The following declaration is for the VC++ DLL entry point. */ @@ -196,8 +192,6 @@ TclWinInit( if (os.dwPlatformId != VER_PLATFORM_WIN32_NT) { Tcl_Panic("Windows NT is the only supported platform"); } - - TclWinResetInterfaces(); } /* @@ -234,38 +228,10 @@ TclWinNoBackslash( /* *--------------------------------------------------------------------------- * - * TclpSetInterfaces -- - * - * A helper proc. - * - * Results: - * None. - * - * Side effects: - * None. - * - *--------------------------------------------------------------------------- - */ - -void -TclpSetInterfaces(void) -{ -#if TCL_UTF_MAX < 4 - TclWinResetInterfaces(); - winTCharEncoding = Tcl_GetEncoding(NULL, "unicode"); -#endif -} - -/* - *--------------------------------------------------------------------------- - * * TclWinEncodingsCleanup -- * - * Called during finalization to free up any encodings we use. - * - * 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. + * Called during finalization to clean up any memory allocated in our + * mount point map which is used to follow certain kinds of symlinks. * * Results: * None. @@ -281,8 +247,6 @@ TclWinEncodingsCleanup(void) { MountPointMap *dlIter, *dlIter2; - TclWinResetInterfaces(); - /* * Clean up the mount point map. */ @@ -299,32 +263,6 @@ TclWinEncodingsCleanup(void) } /* - *--------------------------------------------------------------------------- - * - * TclWinResetInterfaces -- - * - * Called during finalization to reset us to a safe state for reuse. - * - * Results: - * None. - * - * Side effects: - * None. - * - *--------------------------------------------------------------------------- - */ -void -TclWinResetInterfaces(void) -{ -#if TCL_UTF_MAX < 4 - if (winTCharEncoding != NULL) { - Tcl_FreeEncoding(winTCharEncoding); - winTCharEncoding = NULL; - } -#endif -} - -/* *-------------------------------------------------------------------- * * TclWinDriveLetterForVolMountPoint @@ -533,7 +471,6 @@ Tcl_WinUtfToTChar( Tcl_DString *dsPtr) /* Uninitialized or free DString in which the * converted string is stored. */ { -#if TCL_UTF_MAX > 3 TCHAR *wp; int size = MultiByteToWideChar(CP_UTF8, 0, string, len, 0, 0); @@ -545,10 +482,6 @@ Tcl_WinUtfToTChar( Tcl_DStringSetLength(dsPtr, 2*size); wp[size] = 0; return wp; -#else - return (TCHAR *) Tcl_UtfToExternalDString(winTCharEncoding, - string, len, dsPtr); -#endif } char * @@ -559,7 +492,6 @@ Tcl_WinTCharToUtf( Tcl_DString *dsPtr) /* Uninitialized or free DString in which the * converted string is stored. */ { -#if TCL_UTF_MAX > 3 char *p; int size; @@ -575,10 +507,6 @@ Tcl_WinTCharToUtf( Tcl_DStringSetLength(dsPtr, size); p[size] = 0; return p; -#else - return Tcl_ExternalToUtfDString(winTCharEncoding, - (const char *) string, len, dsPtr); -#endif } /* diff --git a/win/tclWinInit.c b/win/tclWinInit.c index dc8bba7..91f149b 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -487,18 +487,11 @@ TclpSetInitialEncodings(void) { Tcl_DString encodingName; - TclpSetInterfaces(); Tcl_SetSystemEncoding(NULL, Tcl_GetEncodingNameFromEnvironment(&encodingName)); Tcl_DStringFree(&encodingName); } -void TclWinSetInterfaces( - int dummy) /* Not used. */ -{ - TclpSetInterfaces(); -} - const char * Tcl_GetEncodingNameFromEnvironment( Tcl_DString *bufPtr) -- cgit v0.12 From 3b5858bcd23542b0ff0249a128808ef20922beb6 Mon Sep 17 00:00:00 2001 From: oehhar Date: Wed, 10 Jan 2018 23:17:43 +0000 Subject: TIP490: oo for msgcal: new solution enable any command for oo, new command mcpackagenamespacege --- changes | 2 ++ library/msgcat/msgcat.tcl | 49 ++++++++++++++++++++++-------- library/msgcat/pkgIndex.tcl | 2 +- tests/msgcat.test | 74 +++++++++++++++++++++++++++++++++++++++++++++ unix/Makefile.in | 4 +-- win/Makefile.in | 4 +-- 6 files changed, 118 insertions(+), 17 deletions(-) diff --git a/changes b/changes index f89704b..51c0477 100644 --- a/changes +++ b/changes @@ -8879,3 +8879,5 @@ in this changeset (new minor version) rather than bug fixes: 2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter) --- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tcl/ for details + +2017-12-11 (TIP 490) add oo support for msgcat => msgcat 1.6.2 (oehlmann) diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 646bc17..849adc6 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -14,12 +14,12 @@ package require Tcl 8.5- # When the version number changes, be sure to update the pkgIndex.tcl file, # and the installation directory in the Makefiles. -package provide msgcat 1.6.1 +package provide msgcat 1.6.2 namespace eval msgcat { namespace export mc mcexists mcload mclocale mcmax mcmset mcpreferences mcset\ mcunknown mcflset mcflmset mcloadedlocales mcforgetpackage\ - mcpackageconfig mcpackagelocale + mcpackagenamespaceget mcpackageconfig mcpackagelocale # Records the list of locales to search variable Loclist {} @@ -193,9 +193,6 @@ namespace eval msgcat { # format command. proc msgcat::mc {src args} { - # this may be replaced by: - # return [mcget -namespace [uplevel 1 [list ::namespace current]] --\ - # $src {*}$args] # Check for the src in each namespace starting from the local and # ending in the global. @@ -203,7 +200,7 @@ proc msgcat::mc {src args} { variable Msgs variable Loclist - set ns [uplevel 1 [list ::namespace current]] + set ns [PackageNamespaceGet] set loclist [PackagePreferences $ns] set nscur $ns @@ -245,7 +242,7 @@ proc msgcat::mcexists {args} { variable Loclist variable PackageConfig - set ns [uplevel 1 [list ::namespace current]] + set ns [PackageNamespaceGet] set loclist [PackagePreferences $ns] while {[llength $args] != 1} { @@ -462,7 +459,7 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { } set locale [string tolower $locale] } - set ns [uplevel 1 {::namespace current}] + set ns [PackageNamespaceGet] switch -exact -- $subcommand { get { return [lindex [PackagePreferences $ns] 0] } @@ -551,7 +548,7 @@ proc msgcat::mcforgetpackage {} { # todo: this may be implemented using an ensemble variable PackageConfig variable Msgs - set ns [uplevel 1 {::namespace current}] + set ns [PackageNamespaceGet] # Remove MC items dict unset Msgs $ns # Remove config items @@ -561,6 +558,15 @@ proc msgcat::mcforgetpackage {} { return } +# msgcat::mcgetmynamespace -- +# +# Return the package namespace of the caller +# This consideres to be called from a class or object. + +proc msgcat::mcpackagenamespaceget {} { + return [PackageNamespaceGet] +} + # msgcat::mcpackageconfig -- # # Get or modify the per caller namespace (e.g. packages) config options. @@ -616,7 +622,7 @@ proc msgcat::mcforgetpackage {} { proc msgcat::mcpackageconfig {subcommand option {value ""}} { variable PackageConfig # get namespace - set ns [uplevel 1 {::namespace current}] + set ns [PackageNamespaceGet] if {$option ni {"mcfolder" "loadcmd" "changecmd" "unknowncmd"}} { return -code error "bad option \"$option\": must be mcfolder, loadcmd,\ @@ -923,7 +929,7 @@ proc msgcat::mcset {locale src {dest ""}} { set dest $src } - set ns [uplevel 1 [list ::namespace current]] + set ns [PackageNamespaceGet] set locale [string tolower $locale] @@ -975,7 +981,7 @@ proc msgcat::mcmset {locale pairs} { } set locale [string tolower $locale] - set ns [uplevel 1 [list ::namespace current]] + set ns [PackageNamespaceGet] foreach {src dest} $pairs { dict set Msgs $ns $locale $src $dest @@ -1106,6 +1112,25 @@ proc msgcat::ConvertLocale {value} { return $ret } +# helper function to find package namespace of stack-frame -2 +# There are 3 possibilities: +# - called from a proc +# - called from a oo class +# - called from a classless oo object +proc ::msgcat::PackageNamespaceGet {} { + uplevel 2 { + # Check for no object + if {0 == [llength [info commands self]]} {return [namespace current]} + set Class [info object class [self]] + # Check for classless defined object + if {$Class eq {::oo::object}} { + return [namespace qualifiers [self]] + } + # Class defined object + return [namespace qualifiers $Class] + } +} + # Initialize the default locale proc msgcat::Init {} { global env diff --git a/library/msgcat/pkgIndex.tcl b/library/msgcat/pkgIndex.tcl index 72c5dc0..bc58cbe 100644 --- a/library/msgcat/pkgIndex.tcl +++ b/library/msgcat/pkgIndex.tcl @@ -1,2 +1,2 @@ if {![package vsatisfies [package provide Tcl] 8.5-]} {return} -package ifneeded msgcat 1.6.1 [list source [file join $dir msgcat.tcl]] +package ifneeded msgcat 1.6.2 [list source [file join $dir msgcat.tcl]] diff --git a/tests/msgcat.test b/tests/msgcat.test index 1c3ce58..9dc8b48 100644 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -1073,6 +1073,80 @@ namespace eval ::msgcat::test { } -returnCodes 1\ -result {fail} + + # Tests msgcat-15.*: tcloo coverage + + # There are 3 use-cases, where 2 must be tested now: + # - namespace defined, class defined oo, classless + + test msgcat-15.1 {mc in class} -setup { + namespace eval ::bar { + ::msgcat::mcset foo_BAR con2 con2bar + oo::class create ClassCur + oo::define ClassCur method method1 {} {::msgcat::mc con2} + } + namespace eval ::baz { + set ObjCur [::bar::ClassCur new] + } + variable locale [mclocale] + mclocale foo_BAR + } -cleanup { + mclocale $locale + namespace eval ::bar {::msgcat::mcforgetpackage} + namespace forget ::bar ::baz + } -body { + $::baz::ObjCur method1 + } -result con2bar + + test msgcat-15.2 {mc in classless object} -setup { + namespace eval ::bar { + ::msgcat::mcset foo_BAR con2 con2bar + oo::object create ObjCur + oo::objdefine ObjCur method method1 {} {::msgcat::mc con2} + } + variable locale [mclocale] + mclocale foo_BAR + } -cleanup { + mclocale $locale + namespace eval ::bar {::msgcat::mcforgetpackage} + namespace forget ::bar + } -body { + ::bar::ObjCur method1 + } -result con2bar + + # Test msgcat-16.*: command mcpackagenamespaceget + + test msgcat-16.1 {mcpackagenamespaceget in namespace procedure} -body { + namespace eval ::baz {msgcat::mcpackagenamespaceget} + } -result ::baz + + test msgcat-16.2 {mcpackagenamespaceget in class} -setup { + namespace eval ::bar { + oo::class create ClassCur + oo::define ClassCur method method1 {} {msgcat::mcpackagenamespaceget} + } + namespace eval ::baz { + set ObjCur [::bar::ClassCur new] + } + } -cleanup { + namespace forget ::bar ::baz + } -body { + $::baz::ObjCur method1 + } -result ::bar + + test msgcat-16.3 {mcpackagenamespaceget in classless object} -setup { + namespace eval ::bar { + oo::object create ObjCur + oo::objdefine ObjCur method method1 {} {msgcat::mcpackagenamespaceget} + } + } -cleanup { + namespace forget ::bar + } -body { + ::bar::ObjCur method1 + } -result ::bar + + + interp bgerror {} $bgerrorsaved cleanupTests diff --git a/unix/Makefile.in b/unix/Makefile.in index f3b9782..a343864 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -855,8 +855,8 @@ install-libraries: libraries do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/opt0.4; \ done; - @echo "Installing package msgcat 1.6.1 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.6.1.tm; + @echo "Installing package msgcat 1.6.2 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.6.2.tm; @echo "Installing package tcltest 2.4.1 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.4.1.tm; diff --git a/win/Makefile.in b/win/Makefile.in index a3275ba..f3e1bd6 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -664,8 +664,8 @@ install-libraries: libraries install-tzdata install-msgs do \ $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \ done; - @echo "Installing package msgcat 1.6.1 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.6.1.tm; + @echo "Installing package msgcat 1.6.2 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.6.2.tm; @echo "Installing package tcltest 2.4.0 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.4.0.tm; @echo "Installing package platform 1.0.14 as a Tcl Module"; -- cgit v0.12 From eb3422673ff62a7427f2e6d166840fce68237d74 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 11 Jan 2018 14:11:38 +0000 Subject: Add test-cases for bug [11ae2be95dac9417], and make a start fixing it. Almost works. --- generic/tclCmdMZ.c | 12 ++++++++++-- generic/tclStringObj.c | 33 +++++++++++++++++++++++++++++++-- tests/string.test | 7 +++++++ 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index a206cc5..a23f007 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1435,7 +1435,7 @@ StringIndexCmd( } /* - * Get the char length to calulate what 'end' means. + * Get the char length to calculate what 'end' means. */ length = Tcl_GetCharLength(objv[1]); @@ -1444,7 +1444,15 @@ StringIndexCmd( } if ((index >= 0) && (index < length)) { - Tcl_UniChar ch = Tcl_GetUniChar(objv[1], index); + int ch = Tcl_GetUniChar(objv[1], index); + + if (ch >= 0x10000) { + printf("HI: %x\n", ch); + } + if (ch == -1) { + printf("LO: %x\n", ch); + return TCL_OK; + } /* * If we have a ByteArray object, we're careful to generate a new diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 01f8d80..aa5aba3 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -460,7 +460,8 @@ Tcl_GetCharLength( * Tcl_GetUniChar -- * * Get the index'th Unicode character from the String object. The index - * is assumed to be in the appropriate range. + * is assumed to be in the appropriate range. If index references a lower + * surrogate preceded by a higher surrogate, the result = -1; * * Results: * Returns the index'th Unicode character in the Object. @@ -478,6 +479,7 @@ Tcl_GetUniChar( int index) /* Get the index'th Unicode character. */ { String *stringPtr; + int ch; /* * Optimize the case where we're really dealing with a bytearray object @@ -512,7 +514,23 @@ Tcl_GetUniChar( FillUnicodeRep(objPtr); stringPtr = GET_STRING(objPtr); } - return (int) stringPtr->unicode[index]; + + ch = stringPtr->unicode[index]; +#if TCL_UTF_MAX == 4 + /* See: bug [11ae2be95dac9417] */ + if ((ch&0xF800) == 0xD800) { + if (ch&0x400) { + if ((index > 0) && ((stringPtr->unicode[index-1]&0xFC00) == 0xD800)) { + ch = -1; /* low surrogate preceded by high surrogate */ + } + } else if ((++index < stringPtr->numChars) + && ((stringPtr->unicode[index]&0xFC00) == 0xDC00)) { + /* high surrogate followed by low surrogate */ + ch = (((ch & 0x3FF) << 10) | (stringPtr->unicode[index] & 0x3FF)) + 0x10000; + } + } +#endif + return ch; } /* @@ -656,6 +674,17 @@ Tcl_GetRange( stringPtr = GET_STRING(objPtr); } +#if TCL_UTF_MAX == 4 + /* See: bug [11ae2be95dac9417] */ + if ((first>0) && ((stringPtr->unicode[first]&0xFC00) == 0xDC00) + && ((stringPtr->unicode[first-1]&0xFC00) == 0xD800)) { + ++first; + } + if ((last+1numChars) && ((stringPtr->unicode[last+1]&0xFC00) == 0xDC00) + && ((stringPtr->unicode[last]&0xFC00) == 0xD800)) { + ++last; + } +#endif return Tcl_NewUnicodeObj(stringPtr->unicode + first, last-first+1); } diff --git a/tests/string.test b/tests/string.test index cebaf4c..58328bb 100644 --- a/tests/string.test +++ b/tests/string.test @@ -24,6 +24,7 @@ catch [list package require -exact Tcltest [info patchlevel]] testConstraint testobj [expr {[info commands testobj] != {}}] testConstraint testindexobj [expr {[info commands testindexobj] != {}}] +testConstraint fullutf [expr {[format %c 0x010000] != "\ufffd"}] # Used for constraining memory leak tests testConstraint memory [llength [info commands memory]] @@ -302,6 +303,9 @@ test string-5.19 {string index, bytearray object out of bounds} { test string-5.20 {string index, bytearray object out of bounds} { string index [binary format I* {0x50515253 0x52}] 20 } {} +test string-5.21 {string index, surrogates, bug [11ae2be95dac9417]} fullutf { + list [string index a\U100000b 1] [string index a\U100000b 2] [string index a\U100000b 3] +} [list \U100000 {} b] proc largest_int {} { @@ -1288,6 +1292,9 @@ test string-12.22 {string range, shimmering binary/index} { binary scan $s a* x string range $s $s end } 000000001 +test string-12.23 {string range, surrogates, bug [11ae2be95dac9417]} fullutf { + list [string range a\U100000b 1 1] [string range a\U100000b 2 2] [string range a\U100000b 3 3] +} [list \U100000 {} b] test string-13.1 {string repeat} { list [catch {string repeat} msg] $msg -- cgit v0.12 From 45e646472daf2fe6beb41555fe088b929cd2ce6c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 11 Jan 2018 15:44:05 +0000 Subject: Fix behavior of Tcl_GetRange() and "string range" regarding surrogates, when Tcl is compiled with -DTCL_UTF_MAX=4. Partial fix for bug [11ae2be95dac9417]. Also, fix typo. --- generic/tclStringObj.c | 13 ++++++++++++- tests/string.test | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 0f238cf..1b35c56 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -533,7 +533,7 @@ Tcl_GetUniChar( * * Get the Unicode form of the String object. If the object is not * already a String object, it will be converted to one. If the String - * object does not have a Unicode rep, then one is create from the UTF + * object does not have a Unicode rep, then one is created from the UTF * string format. * * Results: @@ -667,6 +667,17 @@ Tcl_GetRange( stringPtr = GET_STRING(objPtr); } +#if TCL_UTF_MAX == 4 + /* See: bug [11ae2be95dac9417] */ + if ((first>0) && ((stringPtr->unicode[first]&0xFC00) == 0xDC00) + && ((stringPtr->unicode[first-1]&0xFC00) == 0xD800)) { + ++first; + } + if ((last+1numChars) && ((stringPtr->unicode[last+1]&0xFC00) == 0xDC00) + && ((stringPtr->unicode[last]&0xFC00) == 0xD800)) { + ++last; + } +#endif return Tcl_NewUnicodeObj(stringPtr->unicode + first, last-first+1); } diff --git a/tests/string.test b/tests/string.test index bbba5eb..53f1cfb 100644 --- a/tests/string.test +++ b/tests/string.test @@ -24,6 +24,7 @@ catch [list package require -exact Tcltest [info patchlevel]] testConstraint testobj [expr {[info commands testobj] != {}}] testConstraint testindexobj [expr {[info commands testindexobj] != {}}] +testConstraint fullutf [expr {[format %c 0x010000] != "\ufffd"}] # Used for constraining memory leak tests testConstraint memory [llength [info commands memory]] @@ -1276,6 +1277,9 @@ test string-12.22 {string range, shimmering binary/index} { binary scan $s a* x string range $s $s end } 000000001 +test string-12.23 {string range, surrogates, bug [11ae2be95dac9417]} fullutf { + list [string range a\U100000b 1 1] [string range a\U100000b 2 2] [string range a\U100000b 3 3] +} [list \U100000 {} b] test string-13.1 {string repeat} { list [catch {string repeat} msg] $msg -- cgit v0.12 From 9947048fbda326ad65c7f4a163a00d1d51efd791 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Thu, 11 Jan 2018 16:45:52 +0000 Subject: Tweaks to zipfs.test --- tests/zipfs.test | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/zipfs.test b/tests/zipfs.test index 43aa48b..c9dd0ac 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -160,6 +160,13 @@ test zipfs-2.2.0 {zipfs mkzip} -constraints zipfs -body { cd $CWD } -result "[zipfs root]abc/cp850.enc" +skip [concat [skip] zipfs-2.2.*] + + +if {![zipfs exists /abc/cp850.enc]} { + tcltest::skip zipfs-2.2.* +} + test zipfs-2.2.1 {zipfs info} -constraints zipfs -body { set r [zipfs info ${ziproot}abc/cp850.enc] lrange $r 0 2 @@ -204,7 +211,7 @@ test zipfs-2.2.6 {zipfs unmount} -constraints zipfs -body { zipfs exists /abc/cp850.enc } -result 0 -file delete -force $tmpdir +catch {file delete -force $tmpdir} ::tcltest::cleanupTests return -- cgit v0.12 From 1fda13591a6eff53b73bfa288078edb56ab8a26c Mon Sep 17 00:00:00 2001 From: oehhar Date: Thu, 11 Jan 2018 16:46:09 +0000 Subject: Corrected test cleanups --- tests/msgcat.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/msgcat.test b/tests/msgcat.test index 9dc8b48..387ce85 100644 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -1093,7 +1093,7 @@ namespace eval ::msgcat::test { } -cleanup { mclocale $locale namespace eval ::bar {::msgcat::mcforgetpackage} - namespace forget ::bar ::baz + namespace delete ::bar ::baz } -body { $::baz::ObjCur method1 } -result con2bar @@ -1109,7 +1109,7 @@ namespace eval ::msgcat::test { } -cleanup { mclocale $locale namespace eval ::bar {::msgcat::mcforgetpackage} - namespace forget ::bar + namespace delete ::bar } -body { ::bar::ObjCur method1 } -result con2bar @@ -1129,7 +1129,7 @@ namespace eval ::msgcat::test { set ObjCur [::bar::ClassCur new] } } -cleanup { - namespace forget ::bar ::baz + namespace delete ::bar ::baz } -body { $::baz::ObjCur method1 } -result ::bar @@ -1140,7 +1140,7 @@ namespace eval ::msgcat::test { oo::objdefine ObjCur method method1 {} {msgcat::mcpackagenamespaceget} } } -cleanup { - namespace forget ::bar + namespace delete ::bar } -body { ::bar::ObjCur method1 } -result ::bar -- cgit v0.12 From c8219a9a2995c5658cd709f4bb7b5b933e6575e9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 12 Jan 2018 10:03:58 +0000 Subject: Fix [11ae2be95d]: tip-389 branch: string range errors with code points greater than U+FFFF --- generic/tclExecute.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f2cda0c..63281a8 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5445,7 +5445,7 @@ TEBCresume( valuePtr->bytes+index, 1); } else { char buf[TCL_UTF_MAX]; - Tcl_UniChar ch = Tcl_GetUniChar(valuePtr, index); + int ch = Tcl_GetUniChar(valuePtr, index); /* * This could be: Tcl_NewUnicodeObj((const Tcl_UniChar *)&ch, 1) @@ -5453,7 +5453,7 @@ TEBCresume( * practical use. */ - length = Tcl_UniCharToUtf(ch, buf); + length = (ch != -1) ? Tcl_UniCharToUtf(ch, buf) : 0; objResultPtr = Tcl_NewStringObj(buf, length); } -- cgit v0.12 From e9f2695255b873c200a7fc465f860b4fd5c97a02 Mon Sep 17 00:00:00 2001 From: oehhar Date: Fri, 12 Jan 2018 14:03:04 +0000 Subject: replace "return [uplevel 1 [list [namespace origin ..." by tailcall --- library/msgcat/msgcat.tcl | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 849adc6..885240f 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -216,7 +216,7 @@ proc msgcat::mc {src args} { # call package local or default unknown command set args [linsert $args 0 [lindex $loclist 0] $src] switch -exact -- [Invoke unknowncmd $args $ns result 1] { - 0 { return [uplevel 1 [linsert $args 0 [namespace origin mcunknown]]] } + 0 { tailcall mcunknown {*}$args } 1 { return [DefaultUnknown {*}$args] } default { return $result } } @@ -762,8 +762,7 @@ proc msgcat::ListComplement {list1 list2 {inlistname ""}} { # Returns the number of message catalogs that were loaded. proc msgcat::mcload {langdir} { - return [uplevel 1 [list\ - [namespace origin mcpackageconfig] set mcfolder $langdir]] + tailcall mcpackageconfig set mcfolder $langdir } # msgcat::LoadAll -- @@ -957,7 +956,7 @@ proc msgcat::mcflset {src {dest ""}} { return -code error "must only be used inside a message catalog loaded\ with ::msgcat::mcload" } - return [uplevel 1 [list [namespace origin mcset] $FileLocale $src $dest]] + tailcall mcset $FileLocale $src $dest } # msgcat::mcmset -- @@ -1008,7 +1007,7 @@ proc msgcat::mcflmset {pairs} { return -code error "must only be used inside a message catalog loaded\ with ::msgcat::mcload" } - return [uplevel 1 [list [namespace origin mcmset] $FileLocale $pairs]] + tailcal mcmset $FileLocale $pairs } # msgcat::mcunknown -- @@ -1030,7 +1029,7 @@ proc msgcat::mcflmset {pairs} { # Returns the translated value. proc msgcat::mcunknown {args} { - return [uplevel 1 [list [namespace origin DefaultUnknown] {*}$args]] + tailcall DefaultUnknown {*}$args } # msgcat::DefaultUnknown -- -- cgit v0.12 From 2cfe8bb5619eb9a1de655bda6a208e9e2fb8b81b Mon Sep 17 00:00:00 2001 From: oehhar Date: Fri, 12 Jan 2018 14:13:03 +0000 Subject: Use the test "[namespace which self] ne "::oo::Helpers::self"" to check if we are within an object (undocumented test proposed by dkf on clt 2018-01-12 --- library/msgcat/msgcat.tcl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 885240f..66cedea 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -1119,7 +1119,10 @@ proc msgcat::ConvertLocale {value} { proc ::msgcat::PackageNamespaceGet {} { uplevel 2 { # Check for no object - if {0 == [llength [info commands self]]} {return [namespace current]} + # (undocumented test proposed by dkf 2018-01-12) + if { [namespace which self] ne "::oo::Helpers::self"} { + return [namespace current] + } set Class [info object class [self]] # Check for classless defined object if {$Class eq {::oo::object}} { -- cgit v0.12 From e1ffd3f0057b68e75bce64f9c514b9993fb8a79c Mon Sep 17 00:00:00 2001 From: oehhar Date: Fri, 12 Jan 2018 14:52:25 +0000 Subject: Implement the "mcn" command as "mc" with explicit namespace. --- library/msgcat/msgcat.tcl | 32 ++++++++++++++++++++++++++++---- tests/msgcat.test | 12 ++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 66cedea..29ccf0a 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -17,7 +17,8 @@ package require Tcl 8.5- package provide msgcat 1.6.2 namespace eval msgcat { - namespace export mc mcexists mcload mclocale mcmax mcmset mcpreferences mcset\ + namespace export mc mcn mcexists mcload mclocale mcmax\ + mcmset mcpreferences mcset\ mcunknown mcflset mcflmset mcloadedlocales mcforgetpackage\ mcpackagenamespaceget mcpackageconfig mcpackagelocale @@ -192,7 +193,30 @@ namespace eval msgcat { # Returns the translated string. Propagates errors thrown by the # format command. -proc msgcat::mc {src args} { +proc msgcat::mc {args} { + tailcall mcn [PackageNamespaceGet] {*}$args +} + +# msgcat::mcn -- +# +# Find the translation for the given string based on the current +# locale setting. Check the passed namespace first, then look in each +# parent namespace until the source is found. If additional args are +# specified, use the format command to work them into the traslated +# string. +# If no catalog item is found, mcunknown is called in the caller frame +# and its result is returned. +# +# Arguments: +# ns Package namespace of the translation +# src The string to translate. +# args Args to pass to the format command +# +# Results: +# Returns the translated string. Propagates errors thrown by the +# format command. + +proc msgcat::mcn {ns src args} { # Check for the src in each namespace starting from the local and # ending in the global. @@ -200,7 +224,6 @@ proc msgcat::mc {src args} { variable Msgs variable Loclist - set ns [PackageNamespaceGet] set loclist [PackagePreferences $ns] set nscur $ns @@ -1072,8 +1095,9 @@ proc msgcat::DefaultUnknown {locale src args} { proc msgcat::mcmax {args} { set max 0 + set ns [PackageNamespaceGet] foreach string $args { - set translated [uplevel 1 [list [namespace origin mc] $string]] + set translated [uplevel 1 [list [namespace origin mcn] $ns $string]] set len [string length $translated] if {$len>$max} { set max $len diff --git a/tests/msgcat.test b/tests/msgcat.test index 387ce85..c8f325b 100644 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -1144,7 +1144,19 @@ namespace eval ::msgcat::test { } -body { ::bar::ObjCur method1 } -result ::bar + + + # Test msgcat-17.*: mcn command + test msgcat-17.1 {mcn} -setup { + namespace eval bar {::msgcat::mcset foo_BAR con1 con1bar} + variable locale [mclocale] + mclocale foo_BAR + } -cleanup { + mclocale $locale + } -body { + ::msgcat::mcn [namespace current]::bar con1 + } -result con1bar interp bgerror {} $bgerrorsaved -- cgit v0.12 From ecaec63f48c02c5bb7c0e7585ebc1d746b77ffd9 Mon Sep 17 00:00:00 2001 From: oehhar Date: Sat, 13 Jan 2018 15:23:38 +0000 Subject: Extended command msgcat::mcexists by switch "-namespace ns" to explicitly specify namespace --- library/msgcat/msgcat.tcl | 22 ++++++--- tests/msgcat.test | 120 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 109 insertions(+), 33 deletions(-) diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 29ccf0a..e57802b 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -265,23 +265,31 @@ proc msgcat::mcexists {args} { variable Loclist variable PackageConfig - set ns [PackageNamespaceGet] - set loclist [PackagePreferences $ns] - while {[llength $args] != 1} { set args [lassign $args option] switch -glob -- $option { - -exactnamespace { set exactnamespace 1 } - -exactlocale { set loclist [lrange $loclist 0 0] } + -exactnamespace - -exactlocale { set $option 1 } + -namespace { + if {[llength $args] < 2} { + return -code error\ + "Argument missing for switch \"-namespace\"" + } + set args [lassign $args ns] + } -* { return -code error "unknown option \"$option\"" } default { return -code error "wrong # args: should be\ \"[lindex [info level 0] 0] ?-exactnamespace?\ - ?-exactlocale? src\"" + ?-exactlocale? ?-namespace ns? src\"" } } } set src [lindex $args 0] + + if {![info exists ns]} { set ns [PackageNamespaceGet] } + + set loclist [PackagePreferences $ns] + if {[info exists -exactlocale]} { set loclist [lrange $loclist 0 0] } while {$ns ne ""} { foreach loc $loclist { @@ -289,7 +297,7 @@ proc msgcat::mcexists {args} { return 1 } } - if {[info exists exactnamespace]} {return 0} + if {[info exists -exactnamespace]} {return 0} set ns [namespace parent $ns] } return 0 diff --git a/tests/msgcat.test b/tests/msgcat.test index c8f325b..a99086d 100644 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -688,7 +688,7 @@ namespace eval ::msgcat::test { test msgcat-9.1 {mcexists no parameter} -body { mcexists } -returnCodes 1\ - -result {wrong # args: should be "mcexists ?-exactnamespace? ?-exactlocale? src"} + -result {wrong # args: should be "mcexists ?-exactnamespace? ?-exactlocale? ?-namespace ns? src"} test msgcat-9.2 {mcexists unknown option} -body { mcexists -unknown src @@ -724,12 +724,34 @@ namespace eval ::msgcat::test { mcset foo k1 v1 } -cleanup { mclocale $locale + namespace delete ::foo } -body { - namespace eval ::msgcat::test::sub { + namespace eval ::foo { list [::msgcat::mcexists k1]\ - [::msgcat::mcexists -exactnamespace k1] + [::msgcat::mcexists -namespace ::msgcat::test k1] } - } -result {1 0} + } -result {0 1} + + test msgcat-9.6 {mcexists -namespace - ns argument missing} -setup { + mcforgetpackage + variable locale [mclocale] + mclocale foo_bar + mcset foo k1 v1 + } -cleanup { + mclocale $locale + namespace delete ::foo + } -body { + namespace eval ::foo { + list [::msgcat::mcexists k1]\ + [::msgcat::mcexists -namespace ::msgcat::test k1] + } + } -result {0 1} + + test msgcat-9.1 {mcexists -namespace with no parameter} -body { + mcexists -namespace src + } -returnCodes 1\ + -result {Argument missing for switch "-namespace"} + # Tests msgcat-10.*: [mcloadedlocales] @@ -1080,26 +1102,29 @@ namespace eval ::msgcat::test { # - namespace defined, class defined oo, classless test msgcat-15.1 {mc in class} -setup { - namespace eval ::bar { + # full namespace is ::msgcat::test:bar + namespace eval bar { ::msgcat::mcset foo_BAR con2 con2bar oo::class create ClassCur oo::define ClassCur method method1 {} {::msgcat::mc con2} } - namespace eval ::baz { - set ObjCur [::bar::ClassCur new] + # full namespace is ::msgcat::test:baz + namespace eval baz { + set ObjCur [::msgcat::test::bar::ClassCur new] } variable locale [mclocale] mclocale foo_BAR } -cleanup { mclocale $locale - namespace eval ::bar {::msgcat::mcforgetpackage} - namespace delete ::bar ::baz + namespace eval bar {::msgcat::mcforgetpackage} + namespace delete bar baz } -body { - $::baz::ObjCur method1 + $baz::ObjCur method1 } -result con2bar test msgcat-15.2 {mc in classless object} -setup { - namespace eval ::bar { + # full namespace is ::msgcat::test:bar + namespace eval bar { ::msgcat::mcset foo_BAR con2 con2bar oo::object create ObjCur oo::objdefine ObjCur method method1 {} {::msgcat::mc con2} @@ -1108,42 +1133,85 @@ namespace eval ::msgcat::test { mclocale foo_BAR } -cleanup { mclocale $locale - namespace eval ::bar {::msgcat::mcforgetpackage} - namespace delete ::bar + namespace eval bar {::msgcat::mcforgetpackage} + namespace delete bar } -body { - ::bar::ObjCur method1 + bar::ObjCur method1 } -result con2bar + test msgcat-15.3 {mc in classless object with explicite namespace eval}\ + -setup { + # full namespace is ::msgcat::test:bar + namespace eval bar { + ::msgcat::mcset foo_BAR con2 con2bar + oo::object create ObjCur + oo::objdefine ObjCur method method1 {} { + namespace eval ::msgcat::test::baz { + ::msgcat::mc con2 + } + } + } + namespace eval baz { + ::msgcat::mcset foo_BAR con2 con2baz + } + variable locale [mclocale] + mclocale foo_BAR + } -cleanup { + mclocale $locale + namespace eval bar {::msgcat::mcforgetpackage} + namespace eval baz {::msgcat::mcforgetpackage} + namespace delete bar baz + } -body { + bar::ObjCur method1 + } -result con2baz + # Test msgcat-16.*: command mcpackagenamespaceget test msgcat-16.1 {mcpackagenamespaceget in namespace procedure} -body { - namespace eval ::baz {msgcat::mcpackagenamespaceget} - } -result ::baz + namespace eval baz {msgcat::mcpackagenamespaceget} + } -result ::msgcat::test::baz test msgcat-16.2 {mcpackagenamespaceget in class} -setup { - namespace eval ::bar { + namespace eval bar { oo::class create ClassCur oo::define ClassCur method method1 {} {msgcat::mcpackagenamespaceget} } - namespace eval ::baz { - set ObjCur [::bar::ClassCur new] + namespace eval baz { + set ObjCur [::msgcat::test::bar::ClassCur new] } } -cleanup { - namespace delete ::bar ::baz + namespace delete bar baz } -body { - $::baz::ObjCur method1 - } -result ::bar + $baz::ObjCur method1 + } -result ::msgcat::test::bar test msgcat-16.3 {mcpackagenamespaceget in classless object} -setup { - namespace eval ::bar { + namespace eval bar { oo::object create ObjCur oo::objdefine ObjCur method method1 {} {msgcat::mcpackagenamespaceget} } } -cleanup { - namespace delete ::bar + namespace delete bar + } -body { + bar::ObjCur method1 + } -result ::msgcat::test::bar + + test msgcat-16.4\ + {mcpackagenamespaceget in classless object with explicite namespace eval}\ + -setup { + namespace eval bar { + oo::object create ObjCur + oo::objdefine ObjCur method method1 {} { + namespace eval ::msgcat::test::baz { + msgcat::mcpackagenamespaceget + } + } + } + } -cleanup { + namespace delete bar baz } -body { - ::bar::ObjCur method1 - } -result ::bar + bar::ObjCur method1 + } -result ::msgcat::test::baz # Test msgcat-17.*: mcn command -- cgit v0.12 From eaacc9bb568b4c69d6a5bda83a9f11d9f0f46a80 Mon Sep 17 00:00:00 2001 From: oehhar Date: Sat, 13 Jan 2018 16:44:38 +0000 Subject: Changed msgcat version from 1.6.2 to 1.7.0 -> this is not a patch release --- changes | 2 +- library/msgcat/msgcat.tcl | 2 +- library/msgcat/pkgIndex.tcl | 2 +- unix/Makefile.in | 4 ++-- win/Makefile.in | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/changes b/changes index 51c0477..5b5a93e 100644 --- a/changes +++ b/changes @@ -8880,4 +8880,4 @@ in this changeset (new minor version) rather than bug fixes: --- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tcl/ for details -2017-12-11 (TIP 490) add oo support for msgcat => msgcat 1.6.2 (oehlmann) +2017-12-11 (TIP 490) add oo support for msgcat => msgcat 1.7.0 (oehlmann) diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index e57802b..4233005 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -14,7 +14,7 @@ package require Tcl 8.5- # When the version number changes, be sure to update the pkgIndex.tcl file, # and the installation directory in the Makefiles. -package provide msgcat 1.6.2 +package provide msgcat 1.7.0 namespace eval msgcat { namespace export mc mcn mcexists mcload mclocale mcmax\ diff --git a/library/msgcat/pkgIndex.tcl b/library/msgcat/pkgIndex.tcl index bc58cbe..fe3b3a1 100644 --- a/library/msgcat/pkgIndex.tcl +++ b/library/msgcat/pkgIndex.tcl @@ -1,2 +1,2 @@ if {![package vsatisfies [package provide Tcl] 8.5-]} {return} -package ifneeded msgcat 1.6.2 [list source [file join $dir msgcat.tcl]] +package ifneeded msgcat 1.7.0 [list source [file join $dir msgcat.tcl]] diff --git a/unix/Makefile.in b/unix/Makefile.in index a343864..a3c0e4c 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -855,8 +855,8 @@ install-libraries: libraries do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/opt0.4; \ done; - @echo "Installing package msgcat 1.6.2 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.6.2.tm; + @echo "Installing package msgcat 1.7.0 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.7.0.tm; @echo "Installing package tcltest 2.4.1 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.4.1.tm; diff --git a/win/Makefile.in b/win/Makefile.in index f3e1bd6..a97f1a1 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -664,8 +664,8 @@ install-libraries: libraries install-tzdata install-msgs do \ $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \ done; - @echo "Installing package msgcat 1.6.2 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.6.2.tm; + @echo "Installing package msgcat 1.7.0 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.7.0.tm; @echo "Installing package tcltest 2.4.0 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.4.0.tm; @echo "Installing package platform 1.0.14 as a Tcl Module"; -- cgit v0.12 From 87c12599bfbcd60c4b90780c1a7e653c95c2436c Mon Sep 17 00:00:00 2001 From: oehhar Date: Sat, 13 Jan 2018 17:14:22 +0000 Subject: Test numbering and naming corrected --- tests/msgcat.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/msgcat.test b/tests/msgcat.test index a99086d..a71ee3f 100644 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -732,7 +732,7 @@ namespace eval ::msgcat::test { } } -result {0 1} - test msgcat-9.6 {mcexists -namespace - ns argument missing} -setup { + test msgcat-9.6 {mcexists -namespace ns parameter} -setup { mcforgetpackage variable locale [mclocale] mclocale foo_bar @@ -747,7 +747,7 @@ namespace eval ::msgcat::test { } } -result {0 1} - test msgcat-9.1 {mcexists -namespace with no parameter} -body { + test msgcat-9.7 {mcexists -namespace - ns argument missing} -body { mcexists -namespace src } -returnCodes 1\ -result {Argument missing for switch "-namespace"} -- cgit v0.12 From e841295386a779136b49e7ca3843a43279a8c185 Mon Sep 17 00:00:00 2001 From: oehhar Date: Sat, 13 Jan 2018 17:17:39 +0000 Subject: Install msgcat 1.7 in library folder 8.6 instead 8.5. It uses tailcall and will not work with 8.5 --- unix/Makefile.in | 2 +- win/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index a3c0e4c..baaab95 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -856,7 +856,7 @@ install-libraries: libraries $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/opt0.4; \ done; @echo "Installing package msgcat 1.7.0 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.7.0.tm; + @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.6/msgcat-1.7.0.tm; @echo "Installing package tcltest 2.4.1 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.4.1.tm; diff --git a/win/Makefile.in b/win/Makefile.in index a97f1a1..131f22b 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -665,7 +665,7 @@ install-libraries: libraries install-tzdata install-msgs $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \ done; @echo "Installing package msgcat 1.7.0 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.7.0.tm; + @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.6/msgcat-1.7.0.tm; @echo "Installing package tcltest 2.4.0 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.4.0.tm; @echo "Installing package platform 1.0.14 as a Tcl Module"; -- cgit v0.12 From e89d1e331e09f13b01ad0436d00bf199214d4d46 Mon Sep 17 00:00:00 2001 From: oehhar Date: Tue, 16 Jan 2018 14:13:14 +0000 Subject: Solve case where msgcat is called within a class definition script (works only for 8.7) --- library/msgcat/msgcat.tcl | 29 +++++++++++++++++---------- tests/msgcat.test | 50 ++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 60 insertions(+), 19 deletions(-) diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 4233005..0b1079b 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -1151,17 +1151,26 @@ proc msgcat::ConvertLocale {value} { proc ::msgcat::PackageNamespaceGet {} { uplevel 2 { # Check for no object - # (undocumented test proposed by dkf 2018-01-12) - if { [namespace which self] ne "::oo::Helpers::self"} { - return [namespace current] - } - set Class [info object class [self]] - # Check for classless defined object - if {$Class eq {::oo::object}} { - return [namespace qualifiers [self]] + switch -exact -- [namespace which self] { + {::oo::define::self} { + # We are within a class definition + return [namespace qualifiers [self]] + } + {::oo::Helpers::self} { + # We are within an object + set Class [info object class [self]] + # Check for classless defined object + if {$Class eq {::oo::object}} { + return [namespace qualifiers [self]] + } + # Class defined object + return [namespace qualifiers $Class] + } + default { + # Not in object environment + return [namespace current] + } } - # Class defined object - return [namespace qualifiers $Class] } } diff --git a/tests/msgcat.test b/tests/msgcat.test index a71ee3f..7f872ed 100644 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -1098,10 +1098,26 @@ namespace eval ::msgcat::test { # Tests msgcat-15.*: tcloo coverage - # There are 3 use-cases, where 2 must be tested now: - # - namespace defined, class defined oo, classless + # There are 4 use-cases, where 3 must be tested now: + # - namespace defined, in class definition, class defined oo, classless - test msgcat-15.1 {mc in class} -setup { + test msgcat-15.1 {mc in class setup} -setup { + # full namespace is ::msgcat::test:bar + namespace eval bar { + ::msgcat::mcset foo_BAR con2 con2bar + oo::class create ClassCur + } + variable locale [mclocale] + mclocale foo_BAR + } -cleanup { + mclocale $locale + namespace eval bar {::msgcat::mcforgetpackage} + namespace delete bar + } -body { + oo::define bar::ClassCur msgcat::mc con2 + } -result con2bar + + test msgcat-15.2 {mc in class} -setup { # full namespace is ::msgcat::test:bar namespace eval bar { ::msgcat::mcset foo_BAR con2 con2bar @@ -1122,7 +1138,7 @@ namespace eval ::msgcat::test { $baz::ObjCur method1 } -result con2bar - test msgcat-15.2 {mc in classless object} -setup { + test msgcat-15.3 {mc in classless object} -setup { # full namespace is ::msgcat::test:bar namespace eval bar { ::msgcat::mcset foo_BAR con2 con2bar @@ -1139,7 +1155,7 @@ namespace eval ::msgcat::test { bar::ObjCur method1 } -result con2bar - test msgcat-15.3 {mc in classless object with explicite namespace eval}\ + test msgcat-15.4 {mc in classless object with explicite namespace eval}\ -setup { # full namespace is ::msgcat::test:bar namespace eval bar { @@ -1171,7 +1187,18 @@ namespace eval ::msgcat::test { namespace eval baz {msgcat::mcpackagenamespaceget} } -result ::msgcat::test::baz - test msgcat-16.2 {mcpackagenamespaceget in class} -setup { + test msgcat-16.2 {mcpackagenamespaceget in class setup} -setup { + namespace eval bar { + oo::class create ClassCur + oo::define ClassCur variable a + } + } -cleanup { + namespace delete bar + } -body { + oo::define bar::ClassCur msgcat::mcpackagenamespaceget + } -result ::msgcat::test::bar + + test msgcat-16.3 {mcpackagenamespaceget in class} -setup { namespace eval bar { oo::class create ClassCur oo::define ClassCur method method1 {} {msgcat::mcpackagenamespaceget} @@ -1185,7 +1212,7 @@ namespace eval ::msgcat::test { $baz::ObjCur method1 } -result ::msgcat::test::bar - test msgcat-16.3 {mcpackagenamespaceget in classless object} -setup { + test msgcat-16.4 {mcpackagenamespaceget in classless object} -setup { namespace eval bar { oo::object create ObjCur oo::objdefine ObjCur method method1 {} {msgcat::mcpackagenamespaceget} @@ -1196,7 +1223,7 @@ namespace eval ::msgcat::test { bar::ObjCur method1 } -result ::msgcat::test::bar - test msgcat-16.4\ + test msgcat-16.5\ {mcpackagenamespaceget in classless object with explicite namespace eval}\ -setup { namespace eval bar { @@ -1216,7 +1243,12 @@ namespace eval ::msgcat::test { # Test msgcat-17.*: mcn command - test msgcat-17.1 {mcn} -setup { + test msgcat-17.1 {mcn no parameters} -body { + mcn + } -returnCodes 1\ + -result {wrong # args: should be "mcn ns src ?arg ...?"} + + test msgcat-17.2 {mcn} -setup { namespace eval bar {::msgcat::mcset foo_BAR con1 con1bar} variable locale [mclocale] mclocale foo_BAR -- cgit v0.12 From 7c60d44ce6b8c71d89857ce711a3f7f62ce2de2c Mon Sep 17 00:00:00 2001 From: oehhar Date: Tue, 16 Jan 2018 14:53:41 +0000 Subject: Comment updated --- library/msgcat/msgcat.tcl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 0b1079b..33ff5cb 100644 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -1144,9 +1144,10 @@ proc msgcat::ConvertLocale {value} { } # helper function to find package namespace of stack-frame -2 -# There are 3 possibilities: +# There are 4 possibilities: # - called from a proc -# - called from a oo class +# - called within a class definition script +# - called from an class defined oo object # - called from a classless oo object proc ::msgcat::PackageNamespaceGet {} { uplevel 2 { -- cgit v0.12 From 3502aebe1064bb99245ba6117c80459cace5ac0c Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Tue, 16 Jan 2018 23:25:50 +0000 Subject: Tweaks to the tclZipfs.c file to allow the same C source to be used both in the core and as a static package for external shells (Via TEA) --- generic/tclZipfs.c | 112 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 75 insertions(+), 37 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 49f3b04..305fb7f 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -9,6 +9,10 @@ * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * This file is distributed in two ways: + * generic/tclZipfs.c file in the TIP430 enabled tcl cores + * compat/tclZipfs.c file in the tclconfig (TEA) file system, for pre-tip430 projects */ #include "tclInt.h" @@ -34,13 +38,27 @@ #include "zlib.h" #include "crypt.h" +#ifdef CFG_RUNTIME_DLLFILE /* +** We are compiling as part of the core. ** TIP430 style zipfs prefix */ #define ZIPFS_VOLUME "//zipfs:/" #define ZIPFS_VOLUME_LEN 9 #define ZIPFS_APP_MOUNT "//zipfs:/app" #define ZIPFS_ZIP_MOUNT "//zipfs:/lib/tcl" +#else +/* +** We are compiling from the /compat folder of tclconfig +** Pre TIP430 style zipfs prefix +** //zipfs:/ doesn't work straight out of the box on either windows or Unix +** without other changes made to tip 430 +*/ +#define ZIPFS_VOLUME "zipfs:/" +#define ZIPFS_VOLUME_LEN 7 +#define ZIPFS_APP_MOUNT "zipfs:/app" +#define ZIPFS_ZIP_MOUNT "zipfs:/lib/tcl" +#endif /* * Various constants and offsets found in ZIP archive files */ @@ -249,7 +267,7 @@ static const char pwrot[16] = { * Table to compute CRC32. */ -static const unsigned long crc32tab[256] = { +static const z_crc_t crc32tab[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, @@ -307,6 +325,8 @@ static const unsigned long crc32tab[256] = { const char *zipfs_literal_tcl_library=NULL; /* Function prototypes */ +int TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt,const char *passwd); +static int TclZipfs_AppHook_FindTclInit(const char *archive); static int Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr); static Tcl_Obj *Zip_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr); static Tcl_Obj *Zip_FSFilesystemSeparatorProc(Tcl_Obj *pathPtr); @@ -2667,6 +2687,60 @@ ZipFSListObjCmd( return TCL_OK; } + +Tcl_Obj *TclZipfs_TclLibrary(void) { + if(zipfs_literal_tcl_library) { + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); + } else { + Tcl_Obj *vfsinitscript; + int found=0; + + /* Look for the library file system within the executable */ + vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/tcl_library/init.tcl",-1); + Tcl_IncrRefCount(vfsinitscript); + found=Tcl_FSAccess(vfsinitscript,F_OK); + Tcl_DecrRefCount(vfsinitscript); + if(found==TCL_OK) { + zipfs_literal_tcl_library=ZIPFS_APP_MOUNT "/tcl_library"; + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); + } +#if defined(_WIN32) || defined(_WIN64) + HMODULE hModule = TclWinGetTclInstance(); + WCHAR wName[MAX_PATH + LIBRARY_SIZE]; + char dllname[(MAX_PATH + LIBRARY_SIZE) * TCL_UTF_MAX]; + + if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) { + GetModuleFileNameA(hModule, dllname, MAX_PATH); + } else { + ToUtf(wName, dllname); + } + /* Mount zip file and dll before releasing to search */ + if(TclZipfs_AppHook_FindTclInit(dllname)==TCL_OK) { + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); + } +#else +#ifdef CFG_RUNTIME_DLLFILE + /* Mount zip file and dll before releasing to search */ + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_LIBDIR "/" CFG_RUNTIME_DLLFILE)==TCL_OK) { + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); + } +#endif +#endif +#ifdef CFG_RUNTIME_ZIPFILE + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_LIBDIR "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); + } + if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_SCRDIR "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); + } +#endif + } + if(zipfs_literal_tcl_library) { + return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); + } + return NULL; +} + /* *------------------------------------------------------------------------- * @@ -4224,42 +4298,6 @@ int TclZipfs_AppHook(int *argc, char ***argv) return TCL_OK; } -Tcl_Obj *TclZipfs_TclLibrary(void) { - if(zipfs_literal_tcl_library) { - return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); - } else { -#if defined(_WIN32) || defined(_WIN64) - HMODULE hModule = TclWinGetTclInstance(); - WCHAR wName[MAX_PATH + LIBRARY_SIZE]; - char dllname[(MAX_PATH + LIBRARY_SIZE) * TCL_UTF_MAX]; - - if (GetModuleFileNameW(hModule, wName, MAX_PATH) == 0) { - GetModuleFileNameA(hModule, dllname, MAX_PATH); - } else { - ToUtf(wName, dllname); - } - /* Mount zip file and dll before releasing to search */ - if(TclZipfs_AppHook_FindTclInit(dllname)==TCL_OK) { - return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); - } -#else - /* Mount zip file and dll before releasing to search */ - if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_LIBDIR "/" CFG_RUNTIME_DLLFILE)==TCL_OK) { - return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); - } -#endif - if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_LIBDIR "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { - return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); - } - if(TclZipfs_AppHook_FindTclInit(CFG_RUNTIME_SCRDIR "/" CFG_RUNTIME_ZIPFILE)==TCL_OK) { - return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); - } - } - if(zipfs_literal_tcl_library) { - return Tcl_NewStringObj(zipfs_literal_tcl_library,-1); - } - return NULL; -} #ifndef HAVE_ZLIB -- cgit v0.12 From a866c42f19f6a9824006d8113367245c7df75b01 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Wed, 17 Jan 2018 01:09:07 +0000 Subject: Modifications to index zip file systems by mountpoint, and separate the process of mounting a zip archive from the process of indexing its contents. This work is progress towards being able to pass a data block to the zipfs system as a new file system to be mounted. --- doc/zipfs.3 | 6 +- doc/zipfs.n | 14 +-- generic/tclZipfs.c | 262 ++++++++++++++++++++++++++++------------------------- tests/zipfs.test | 9 +- 4 files changed, 155 insertions(+), 136 deletions(-) diff --git a/doc/zipfs.3 b/doc/zipfs.3 index b23afae..7514525 100644 --- a/doc/zipfs.3 +++ b/doc/zipfs.3 @@ -18,7 +18,7 @@ int \fBTclZipfs_AppHook(\fIint *argc, char ***argv\fR) .sp int -\fBTclzipfs_Mount\fR(\fIinterp, zipname, mntpt, passwd\fR) +\fBTclzipfs_Mount\fR(\fIinterp, mntpt, zipname, passwd\fR) .sp int \fBTclzipfs_Unmount\fR(\fIinterp, zipname\fR) @@ -55,12 +55,12 @@ or in the standard tcl install location. \fBTclzipfs_Mount()\fR mount the ZIP archive \fIzipname\fR on the mount point given in \fImntpt\fR using the optional ZIP password \fIpasswd\fR. Errors during that process are reported in the interpreter \fIinterp\fR. -If \fIzipname\fR is a NULL pointer, information on all currently mounted +If \fImountpoint\fR is a NULL pointer, information on all currently mounted ZIP file systems is written into \fIinterp\fR's result as a sequence of mount points and ZIP file names. .PP \fBTclzipfs_Unmount()\fR undoes the effect of \fBTclzipfs_Mount()\fR, -i.e. it unmounts the mounted ZIP archive file \fIzipname\fR. Errors are +i.e. it unmounts the mounted ZIP file system at \fImountpoint\fR. Errors are reported in the interpreter \fIinterp\fR. .SH KEYWORDS compress, filesystem, zip diff --git a/doc/zipfs.n b/doc/zipfs.n index a026b6d..31a0707 100644 --- a/doc/zipfs.n +++ b/doc/zipfs.n @@ -23,9 +23,9 @@ zipfs \- Mount and work with ZIP files within Tcl \fBzipfs mkimg\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR \fI?infile?\fR \fBzipfs mkkey\fR \fIpassword\fR \fBzipfs mkzip\fR \fIoutfile\fR \fIindir\fR \fI?strip?\fR \fI?password?\fR -\fBzipfs mount\fR \fI?zipfile?\fR \fI?mountpoint?\fR \fI?password?\fR +\fBzipfs mount\fR \fI?mountpoint?\fR \fI?zipfile?\fR \fI?password?\fR \fBzipfs root\fR -\fBzipfs unmount\fR \fIzipfile\fR +\fBzipfs unmount\fR \fImountpoint\fR .fi .BE .SH DESCRIPTION @@ -96,15 +96,15 @@ Caution: the choice of the \fIindir\fR parameter archive's content. .RE .TP -\fBzipfs mount ?\fIzipfile\fR? ?\fImountpoint\fR? ?\fIpassword\fR? +\fBzipfs mount ?\fImountpoint\fR? ?\fIzipfile\fR? ?\fIpassword\fR? . The \fBzipfs mount\fR command mounts a ZIP archive file as a VFS. After this command executes, files contained in \fIzipfile\fR will appear to Tcl to be regular files at the mount point. .RS .PP -With no \fImountpoint\fR, returns the mount point for \fIzipfile\fR. -With no \fIzipfile\fR, return all zipfile/mount pairs. +With no \fIzipfile\fR, returns the zipfile mounted at \fImountpoint\fR. +With no \fImountpoint\fR, return all zipfile/mount pairs. If \fImountpoint\fR is specified as an empty string, mount on file path. .RE .TP @@ -113,9 +113,9 @@ Returns a constant string which indicates the mount point for zipfs volumes for the current platform. On Windows, this value is zipfs:/. On Unux, //zipfs:/ .RE .TP -\fBzipfs unmount \fIzipfile\fR +\fBzipfs unmount \fImountpoint\fR . -Unmounts a previously mounted ZIP archive file \fIzipfile\fR. +Unmounts a previously mounted ZIP archive mounted to \fImountpoint\fR. .SH "SEE ALSO" tclsh(1), file(n), zlib(n) .SH "KEYWORDS" diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 305fb7f..5be25c3 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -186,8 +186,8 @@ typedef struct ZipFile { #if HAS_DRIVES int mntdrv; /* Drive letter of mount point */ #endif - int mntptlen; /* Length of mount point */ - char mntpt[1]; /* Mount point */ + char *mntpt; /* Mount point */ + size_t mntptlen; } ZipFile; /* @@ -325,7 +325,7 @@ static const z_crc_t crc32tab[256] = { const char *zipfs_literal_tcl_library=NULL; /* Function prototypes */ -int TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt,const char *passwd); +int TclZipfs_Mount(Tcl_Interp *interp, const char *mntpt, const char *zipname, const char *passwd); static int TclZipfs_AppHook_FindTclInit(const char *archive); static int Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr); static Tcl_Obj *Zip_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr); @@ -942,7 +942,105 @@ ZipFSCloseArchive(Tcl_Interp *interp, ZipFile *zf) zf->chan = NULL; } } - + +/* + *------------------------------------------------------------------------- + * + * ZipFSIndexArchive -- + * + * This function takes a memory mapped zip file and indexes the contents. + * When "needZip" is zero an embedded ZIP archive in an executable file is accepted. + * + * Results: + * TCL_OK on success, TCL_ERROR otherwise with an error message + * placed into the given "interp" if it is not NULL. + * + * Side effects: + * The given ZipFile struct is filled with information about the ZIP archive file. + * + *------------------------------------------------------------------------- + */ +static int +ZipFSIndexArchive(Tcl_Interp *interp, int needZip, ZipFile *zf) +{ + int i; + unsigned char *p, *q; + p = zf->data + zf->length - ZIP_CENTRAL_END_LEN; + while (p >= zf->data) { + if (*p == (ZIP_CENTRAL_END_SIG & 0xFF)) { + if (zip_read_int(p) == ZIP_CENTRAL_END_SIG) { + break; + } + p -= ZIP_SIG_LEN; + } else { + --p; + } + } + if (p < zf->data) { + if (!needZip) { + zf->baseoffs = zf->baseoffsp = zf->length; + return TCL_OK; + } + ZIPFS_ERROR(interp,"wrong end signature"); + goto error; + } + zf->nfiles = zip_read_short(p + ZIP_CENTRAL_ENTS_OFFS); + if (zf->nfiles == 0) { + if (!needZip) { + zf->baseoffs = zf->baseoffsp = zf->length; + return TCL_OK; + } + ZIPFS_ERROR(interp,"empty archive"); + goto error; + } + q = zf->data + zip_read_int(p + ZIP_CENTRAL_DIRSTART_OFFS); + p -= zip_read_int(p + ZIP_CENTRAL_DIRSIZE_OFFS); + if ( + (p < zf->data) || (p > (zf->data + zf->length)) || + (q < zf->data) || (q > (zf->data + zf->length)) + ) { + if (!needZip) { + zf->baseoffs = zf->baseoffsp = zf->length; + return TCL_OK; + } + ZIPFS_ERROR(interp,"archive directory not found"); + goto error; + } + zf->baseoffs = zf->baseoffsp = p - q; + zf->centoffs = p - zf->data; + q = p; + for (i = 0; i < zf->nfiles; i++) { + int pathlen, comlen, extra; + + if ((q + ZIP_CENTRAL_HEADER_LEN) > (zf->data + zf->length)) { + ZIPFS_ERROR(interp,"wrong header length"); + goto error; + } + if (zip_read_int(q) != ZIP_CENTRAL_HEADER_SIG) { + ZIPFS_ERROR(interp,"wrong header signature"); + goto error; + } + pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); + comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); + extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); + q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; + } + q = zf->data + zf->baseoffs; + if ((zf->baseoffs >= 6) && (zip_read_int(q - 4) == ZIP_PASSWORD_END_SIG)) { + i = q[-5]; + if (q - 5 - i > zf->data) { + zf->pwbuf[0] = i; + memcpy(zf->pwbuf + 1, q - 5 - i, i); + zf->baseoffsp -= i ? (5 + i) : 0; + } + } + return TCL_OK; + +error: + ZipFSCloseArchive(interp, zf); + return TCL_ERROR; +} + /* *------------------------------------------------------------------------- * @@ -967,12 +1065,10 @@ ZipFSCloseArchive(Tcl_Interp *interp, ZipFile *zf) */ static int -ZipFSOpenArchive(Tcl_Interp *interp, const char *zipname, int needZip, - ZipFile *zf) +ZipFSOpenArchive(Tcl_Interp *interp, const char *zipname, int needZip, ZipFile *zf) { int i; ClientData handle; - unsigned char *p, *q; #if defined(_WIN32) || defined(_WIN64) zf->data = NULL; @@ -1051,82 +1147,14 @@ ZipFSOpenArchive(Tcl_Interp *interp, const char *zipname, int needZip, } #endif } - p = zf->data + zf->length - ZIP_CENTRAL_END_LEN; - while (p >= zf->data) { - if (*p == (ZIP_CENTRAL_END_SIG & 0xFF)) { - if (zip_read_int(p) == ZIP_CENTRAL_END_SIG) { - break; - } - p -= ZIP_SIG_LEN; - } else { - --p; - } - } - if (p < zf->data) { - if (!needZip) { - zf->baseoffs = zf->baseoffsp = zf->length; - return TCL_OK; - } - ZIPFS_ERROR(interp,"wrong end signature"); - goto error; - } - zf->nfiles = zip_read_short(p + ZIP_CENTRAL_ENTS_OFFS); - if (zf->nfiles == 0) { - if (!needZip) { - zf->baseoffs = zf->baseoffsp = zf->length; - return TCL_OK; - } - ZIPFS_ERROR(interp,"empty archive"); - goto error; - } - q = zf->data + zip_read_int(p + ZIP_CENTRAL_DIRSTART_OFFS); - p -= zip_read_int(p + ZIP_CENTRAL_DIRSIZE_OFFS); - if ( - (p < zf->data) || (p > (zf->data + zf->length)) || - (q < zf->data) || (q > (zf->data + zf->length)) - ) { - if (!needZip) { - zf->baseoffs = zf->baseoffsp = zf->length; - return TCL_OK; - } - ZIPFS_ERROR(interp,"archive directory not found"); - goto error; - } - zf->baseoffs = zf->baseoffsp = p - q; - zf->centoffs = p - zf->data; - q = p; - for (i = 0; i < zf->nfiles; i++) { - int pathlen, comlen, extra; - - if ((q + ZIP_CENTRAL_HEADER_LEN) > (zf->data + zf->length)) { - ZIPFS_ERROR(interp,"wrong header length"); - goto error; - } - if (zip_read_int(q) != ZIP_CENTRAL_HEADER_SIG) { - ZIPFS_ERROR(interp,"wrong header signature"); - goto error; - } - pathlen = zip_read_short(q + ZIP_CENTRAL_PATHLEN_OFFS); - comlen = zip_read_short(q + ZIP_CENTRAL_FCOMMENTLEN_OFFS); - extra = zip_read_short(q + ZIP_CENTRAL_EXTRALEN_OFFS); - q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; - } - q = zf->data + zf->baseoffs; - if ((zf->baseoffs >= 6) && (zip_read_int(q - 4) == ZIP_PASSWORD_END_SIG)) { - i = q[-5]; - if (q - 5 - i > zf->data) { - zf->pwbuf[0] = i; - memcpy(zf->pwbuf + 1, q - 5 - i, i); - zf->baseoffsp -= i ? (5 + i) : 0; - } - } - return TCL_OK; + return ZipFSIndexArchive(interp,needZip,zf); error: ZipFSCloseArchive(interp, zf); return TCL_ERROR; } + static void TclZipfs_C_Init(void) { static const Tcl_Time t = { 0, 0 }; if (!ZipFS.initialized) { @@ -1166,8 +1194,9 @@ static void TclZipfs_C_Init(void) { int TclZipfs_Mount( - Tcl_Interp *interp, const char *zipname, + Tcl_Interp *interp, const char *mntpt, + const char *zipname, const char *passwd ) { char *realname, *p; @@ -1185,7 +1214,7 @@ TclZipfs_Mount( if (!ZipFS.initialized) { TclZipfs_C_Init(); } - if (zipname == NULL) { + if (mntpt == NULL) { Tcl_HashSearch search; int ret = TCL_OK; @@ -1207,36 +1236,26 @@ TclZipfs_Mount( Unlock(); return ret; } - if (mntpt == NULL) { + /* + * Mount point sometimes is a relative or otherwise denormalized path. + * But an absolute name is needed as mount point here. + */ + Tcl_DStringInit(&dsm); + mntpt = CanonicalPath("",mntpt, &dsm, 1); + + if (zipname == NULL) { if (interp == NULL) { Unlock(); return TCL_OK; } + Tcl_DStringInit(&ds); -#if HAS_DRIVES - p = AbsolutePath(zipname, &drive, &ds); -#else - p = AbsolutePath(zipname, &ds); -#endif - hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, p); + + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, mntpt); if (hPtr != NULL) { -#if HAS_DRIVES - if (drive == zf->mntdrv) { - Tcl_Obj *string; - char drvbuf[3]; - - drvbuf[0] = zf->mntdrv; - drvbuf[1] = ':'; - drvbuf[2] = '\0'; - string = Tcl_NewStringObj(drvbuf, 2); - Tcl_AppendToObj(string, zf->mntpt, zf->mntptlen); - Tcl_SetObjResult(interp, string); - } -#else if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { - Tcl_SetObjResult(interp,Tcl_NewStringObj(zf->mntpt, zf->mntptlen)); + Tcl_SetObjResult(interp,Tcl_NewStringObj(zf->name, -1)); } -#endif } Unlock(); return TCL_OK; @@ -1262,20 +1281,13 @@ TclZipfs_Mount( #else realname = AbsolutePath(zipname, &ds); #endif - /* - * Mount point sometimes is a relative or otherwise denormalized path. - * But an absolute name is needed as mount point here. - */ - Tcl_DStringInit(&dsm); - mntpt = CanonicalPath("",mntpt, &dsm, 1); WriteLock(); - hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, zipname, &isNew); + hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, mntpt, &isNew); if (!isNew) { zf = (ZipFile *) Tcl_GetHashValue(hPtr); if (interp != NULL) { - Tcl_AppendResult(interp, "already mounted on \"", zf->mntptlen ? - zf->mntpt : "/", "\"", (char *) NULL); + Tcl_AppendResult(interp, zf->name, " is already mounted on ", mntpt, (char *) NULL); } Unlock(); ZipFSCloseArchive(interp, &zf0); @@ -1294,9 +1306,9 @@ TclZipfs_Mount( return TCL_ERROR; } *zf = zf0; - zf->name = Tcl_GetHashKey(&ZipFS.zipHash, hPtr); - strcpy(zf->mntpt, mntpt); - zf->mntptlen = strlen(zf->mntpt); + zf->mntpt = Tcl_GetHashKey(&ZipFS.zipHash, hPtr); + zf->mntptlen=strlen(zf->mntpt); + zf->name = strdup(zipname); zf->entries = NULL; zf->topents = NULL; zf->nopen = 0; @@ -1526,17 +1538,24 @@ nextent: */ int -TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) +TclZipfs_Unmount(Tcl_Interp *interp, const char *mntpt) { ZipFile *zf; ZipEntry *z, *znext; Tcl_HashEntry *hPtr; + Tcl_DString dsm; int ret = TCL_OK, unmounted = 0; WriteLock(); if (!ZipFS.initialized) goto done; - - hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, zipname); + /* + * Mount point sometimes is a relative or otherwise denormalized path. + * But an absolute name is needed as mount point here. + */ + Tcl_DStringInit(&dsm); + mntpt = CanonicalPath("", mntpt, &dsm, 1); + + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, mntpt); /* don't report error */ if (hPtr == NULL) goto done; @@ -1560,6 +1579,7 @@ TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) Tcl_Free((char *) z); } ZipFSCloseArchive(interp, zf); + free(zf->name); //Allocated by strdup Tcl_Free((char *) zf); unmounted = 1; done: @@ -3906,7 +3926,7 @@ Zip_FSFileAttrsGetProc(Tcl_Interp *interp, int index, Tcl_Obj *pathPtr, *objPtrRef= Tcl_NewLongObj(z->offset); goto done; case 3: - *objPtrRef= Tcl_NewStringObj(z->zipfile->mntpt, -1); + *objPtrRef= Tcl_NewStringObj(z->zipfile->mntpt, z->zipfile->mntptlen); goto done; case 4: *objPtrRef= Tcl_NewStringObj(z->zipfile->name, -1); @@ -4189,7 +4209,7 @@ static int TclZipfs_AppHook_FindTclInit(const char *archive){ if(zipfs_literal_tcl_library) { return TCL_ERROR; } - if(TclZipfs_Mount(NULL, archive, ZIPFS_ZIP_MOUNT, NULL)) { + if(TclZipfs_Mount(NULL, ZIPFS_ZIP_MOUNT, archive, NULL)) { /* Either the file doesn't exist or it is not a zip archive */ return TCL_ERROR; } @@ -4230,7 +4250,7 @@ int TclZipfs_AppHook(int *argc, char ***argv) /* ** Look for init.tcl in one of the locations mounted later in this function */ - if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { + if(!TclZipfs_Mount(NULL, ZIPFS_APP_MOUNT, archive, NULL)) { int found; Tcl_Obj *vfsinitscript; vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/main.tcl",-1); @@ -4272,7 +4292,7 @@ int TclZipfs_AppHook(int *argc, char ***argv) } return TCL_OK; } else { - if(!TclZipfs_Mount(NULL, archive, ZIPFS_APP_MOUNT, NULL)) { + if(!TclZipfs_Mount(NULL, ZIPFS_APP_MOUNT, archive, NULL)) { int found; Tcl_Obj *vfsinitscript; vfsinitscript=Tcl_NewStringObj(ZIPFS_APP_MOUNT "/main.tcl",-1); @@ -4313,7 +4333,7 @@ int TclZipfs_AppHook(int *argc, char ***argv) */ int -TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, +TclZipfs_Mount(Tcl_Interp *interp, const char *mntpt, const char *zipname, const char *passwd) { return TclZipfs_Init(interp, 1); diff --git a/tests/zipfs.test b/tests/zipfs.test index c9dd0ac..060e4a6 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -27,7 +27,6 @@ set CWD [pwd] set tmpdir [file join $CWD tmp] file mkdir $tmpdir - test zipfs-0.1 {zipfs basics} -constraints zipfs -body { package require zipfs } -result {2.0} @@ -45,7 +44,7 @@ if {![string match ${ziproot}* $tcl_library]} { ### set tclzip [file join $CWD [::tcl::pkgconfig get zipfile,runtime]] if {[file exists $tclzip]} { - zipfs mount $tclzip /lib/tcl + zipfs mount /lib/tcl $tclzip set ::tcl_library ${ziproot}lib/tcl/tcl_library } else { tcltest::skip zipfs-0.* @@ -154,7 +153,7 @@ if {[file exists $zipfile]} { test zipfs-2.2.0 {zipfs mkzip} -constraints zipfs -body { cd $tcl_library/encoding zipfs mkzip $zipfile . - zipfs mount $zipfile ${ziproot}abc + zipfs mount ${ziproot}abc $zipfile zipfs list -glob ${ziproot}abc/cp850.* } -cleanup { cd $CWD @@ -202,12 +201,12 @@ test zipfs-2.2.4 {zipfs exists} -constraints zipfs -body { } -result 1 test zipfs-2.2.5 {zipfs unmount while busy} -constraints zipfs -body { - zipfs unmount $zipfile + zipfs unmount /abc } -returnCodes error -result {filesystem is busy} test zipfs-2.2.6 {zipfs unmount} -constraints zipfs -body { close $zipfd - zipfs unmount $zipfile + zipfs unmount /abc zipfs exists /abc/cp850.enc } -result 0 -- cgit v0.12 From 5fea88381c81c486e138059e2c86318935148e8f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 17 Jan 2018 10:06:30 +0000 Subject: typo's (found by Gustaf Neumann). Thanks! --- generic/tcl.h | 4 ++-- generic/tclInt.h | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/generic/tcl.h b/generic/tcl.h index b43b2d7..36001ca 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -1986,7 +1986,7 @@ typedef struct Tcl_Token { * TCL_TOKEN_OPERATOR - The token describes one expression operator. * An operator might be the name of a math * function such as "abs". A TCL_TOKEN_OPERATOR - * token is always preceeded by one + * token is always preceded by one * TCL_TOKEN_SUB_EXPR token for the operator's * subexpression, and is followed by zero or more * TCL_TOKEN_SUB_EXPR tokens for the operator's @@ -2622,7 +2622,7 @@ EXTERN void Tcl_GetMemoryInfo(Tcl_DString *dsPtr); #ifndef TCL_NO_DEPRECATED /* * These function have been renamed. The old names are deprecated, but we - * define these macros for backwards compatibilty. + * define these macros for backwards compatibility. */ # define Tcl_Ckalloc Tcl_Alloc diff --git a/generic/tclInt.h b/generic/tclInt.h index 91c8b96..4967cd3 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -413,7 +413,7 @@ struct NamespacePathEntry { */ typedef struct EnsembleConfig { - Namespace *nsPtr; /* The namspace backing this ensemble up. */ + Namespace *nsPtr; /* The namespace backing this ensemble up. */ Tcl_Command token; /* The token for the command that provides * ensemble support for the namespace, or NULL * if the command has been deleted (or never @@ -1813,7 +1813,7 @@ typedef struct Interp { * unused space in interp was repurposed for * pluggable bytecode optimizers. The core * contains one optimizer, which can be - * selectively overriden by extensions. */ + * selectively overridden by extensions. */ } extra; /* @@ -2228,7 +2228,7 @@ typedef struct Interp { * use the rand() or srand() functions. * SAFE_INTERP: Non zero means that the current interp is a safe * interp (i.e. it has only the safe commands installed, - * less priviledge than a regular interp). + * less privilege than a regular interp). * INTERP_DEBUG_FRAME: Used for switching on various extra interpreter * debug/info mechanisms (e.g. info frame eval/uplevel * tracing) which are performance intensive. @@ -2369,7 +2369,7 @@ typedef struct List { * be ignored if there is no string rep at * all.*/ Tcl_Obj *elements; /* First list element; the struct is grown to - * accomodate all elements. */ + * accommodate all elements. */ } List; #define LIST_MAX \ @@ -2491,13 +2491,13 @@ typedef struct List { * tip of the path, so duplication of shared objects should be done along the * way. * - * DICT_PATH_EXISTS indicates that we are performing an existance test and a + * DICT_PATH_EXISTS indicates that we are performing an existence test and a * lookup failure should therefore not be an error. If (and only if) this flag * is set, TclTraceDictPath() will return the special value * DICT_PATH_NON_EXISTENT if the path is not traceable. * * DICT_PATH_CREATE (which also requires the DICT_PATH_UPDATE bit to be set) - * indicates that we are to create non-existant dictionaries on the path. + * indicates that we are to create non-existent dictionaries on the path. */ #define DICT_PATH_READ 0 -- cgit v0.12 From 608373fcb170fe76512b46c7ce07cc0691720ae5 Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Wed, 17 Jan 2018 15:56:32 +0000 Subject: Modifications to allow the mounting of zip file systems from data blocks Added a new stubs entry to mount a data block as a zip file system --- generic/tcl.decls | 15 +- generic/tclDecls.h | 14 +- generic/tclStubInit.c | 1 + generic/tclZipfs.c | 493 +++++++++++++++++++++++++++++++++++++------------- tests/zipfs.test | 73 +++++++- 5 files changed, 458 insertions(+), 138 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 87beab3..8d03db1 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -2334,8 +2334,11 @@ declare 631 { # TIP #430 declare 632 { - int TclZipfs_Mount(Tcl_Interp *interp, const char *zipname, const char *mntpt, - const char *passwd) + int TclZipfs_Mount( + Tcl_Interp *interp, + const char *mntpt, + const char *zipname, + const char *passwd) } declare 633 { int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname) @@ -2343,6 +2346,14 @@ declare 633 { declare 634 { Tcl_Obj *TclZipfs_TclLibrary(void) } +declare 635 { + int TclZipfs_Mount_Buffer( + Tcl_Interp *interp, + const char *mntpt, + unsigned char *data, + size_t datalen, + int copy) +} ############################################################################## # Define the platform specific public Tcl interface. These functions are only diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 8ba9e5c..40fa7e2 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -1839,14 +1839,17 @@ EXTERN Tcl_Channel Tcl_OpenTcpServerEx(Tcl_Interp *interp, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 632 */ -EXTERN int TclZipfs_Mount(Tcl_Interp *interp, - const char *zipname, const char *mntpt, - const char *passwd); +EXTERN int TclZipfs_Mount(Tcl_Interp *interp, const char *mntpt, + const char *zipname, const char *passwd); /* 633 */ EXTERN int TclZipfs_Unmount(Tcl_Interp *interp, const char *zipname); /* 634 */ EXTERN Tcl_Obj * TclZipfs_TclLibrary(void); +/* 635 */ +EXTERN int TclZipfs_Mount_Buffer(Tcl_Interp *interp, + const char *mntpt, unsigned char *data, + size_t datalen, int copy); typedef struct { const struct TclPlatStubs *tclPlatStubs; @@ -2514,9 +2517,10 @@ typedef struct TclStubs { int (*tcl_FSUnloadFile) (Tcl_Interp *interp, Tcl_LoadHandle handlePtr); /* 629 */ void (*tcl_ZlibStreamSetCompressionDictionary) (Tcl_ZlibStream zhandle, Tcl_Obj *compressionDictionaryObj); /* 630 */ Tcl_Channel (*tcl_OpenTcpServerEx) (Tcl_Interp *interp, const char *service, const char *host, unsigned int flags, Tcl_TcpAcceptProc *acceptProc, ClientData callbackData); /* 631 */ - int (*tclZipfs_Mount) (Tcl_Interp *interp, const char *zipname, const char *mntpt, const char *passwd); /* 632 */ + int (*tclZipfs_Mount) (Tcl_Interp *interp, const char *mntpt, const char *zipname, const char *passwd); /* 632 */ int (*tclZipfs_Unmount) (Tcl_Interp *interp, const char *zipname); /* 633 */ Tcl_Obj * (*tclZipfs_TclLibrary) (void); /* 634 */ + int (*tclZipfs_Mount_Buffer) (Tcl_Interp *interp, const char *mntpt, unsigned char *data, size_t datalen, int copy); /* 635 */ } TclStubs; extern const TclStubs *tclStubsPtr; @@ -3817,6 +3821,8 @@ extern const TclStubs *tclStubsPtr; (tclStubsPtr->tclZipfs_Unmount) /* 633 */ #define TclZipfs_TclLibrary \ (tclStubsPtr->tclZipfs_TclLibrary) /* 634 */ +#define TclZipfs_Mount_Buffer \ + (tclStubsPtr->tclZipfs_Mount_Buffer) /* 635 */ #endif /* defined(USE_TCL_STUBS) */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index fdc8aec..28d26a6 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -1616,6 +1616,7 @@ const TclStubs tclStubs = { TclZipfs_Mount, /* 632 */ TclZipfs_Unmount, /* 633 */ TclZipfs_TclLibrary, /* 634 */ + TclZipfs_Mount_Buffer, /* 635 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 5be25c3..b81c58f 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -168,6 +168,8 @@ TCL_DECLARE_MUTEX(localtimeMutex) typedef struct ZipFile { char *name; /* Archive name */ + size_t namelen; + char is_membuf; /* When true, not a file but a memory buffer */ Tcl_Channel chan; /* Channel handle or NULL */ unsigned char *data; /* Memory mapped or malloc'ed file */ long length; /* Length of memory mapped file */ @@ -186,8 +188,8 @@ typedef struct ZipFile { #if HAS_DRIVES int mntdrv; /* Drive letter of mount point */ #endif - char *mntpt; /* Mount point */ - size_t mntptlen; + int mntptlen; + char *mntpt; /* Mount point */ } ZipFile; /* @@ -325,7 +327,19 @@ static const z_crc_t crc32tab[256] = { const char *zipfs_literal_tcl_library=NULL; /* Function prototypes */ -int TclZipfs_Mount(Tcl_Interp *interp, const char *mntpt, const char *zipname, const char *passwd); +int TclZipfs_Mount( + Tcl_Interp *interp, + const char *mntpt, + const char *zipname, + const char *passwd +); +int TclZipfs_Mount_Buffer( + Tcl_Interp *interp, + const char *mntpt, + unsigned char *data, + size_t datalen, + int copy +); static int TclZipfs_AppHook_FindTclInit(const char *archive); static int Zip_FSPathInFilesystemProc(Tcl_Obj *pathPtr, ClientData *clientDataPtr); static Tcl_Obj *Zip_FSFilesystemPathTypeProc(Tcl_Obj *pathPtr); @@ -919,6 +933,18 @@ ZipFSLookupMount(char *filename) static void ZipFSCloseArchive(Tcl_Interp *interp, ZipFile *zf) { + if(zf->namelen) { + free(zf->name); //Allocated by strdup + } + if(zf->is_membuf==1) { + /* Pointer to memory */ + if (zf->tofree != NULL) { + Tcl_Free((char *) zf->tofree); + zf->tofree = NULL; + } + zf->data = NULL; + return; + } #if defined(_WIN32) || defined(_WIN64) if ((zf->data != NULL) && (zf->tofree == NULL)) { UnmapViewOfFile(zf->data); @@ -946,7 +972,7 @@ ZipFSCloseArchive(Tcl_Interp *interp, ZipFile *zf) /* *------------------------------------------------------------------------- * - * ZipFSIndexArchive -- + * ZipFS_Find_TOC -- * * This function takes a memory mapped zip file and indexes the contents. * When "needZip" is zero an embedded ZIP archive in an executable file is accepted. @@ -961,7 +987,7 @@ ZipFSCloseArchive(Tcl_Interp *interp, ZipFile *zf) *------------------------------------------------------------------------- */ static int -ZipFSIndexArchive(Tcl_Interp *interp, int needZip, ZipFile *zf) +ZipFS_Find_TOC(Tcl_Interp *interp, int needZip, ZipFile *zf) { int i; unsigned char *p, *q; @@ -1034,6 +1060,7 @@ ZipFSIndexArchive(Tcl_Interp *interp, int needZip, ZipFile *zf) zf->baseoffsp -= i ? (5 + i) : 0; } } + return TCL_OK; error: @@ -1069,7 +1096,8 @@ ZipFSOpenArchive(Tcl_Interp *interp, const char *zipname, int needZip, ZipFile * { int i; ClientData handle; - + + zf->is_membuf=0; #if defined(_WIN32) || defined(_WIN64) zf->data = NULL; zf->mh = INVALID_HANDLE_VALUE; @@ -1147,61 +1175,33 @@ ZipFSOpenArchive(Tcl_Interp *interp, const char *zipname, int needZip, ZipFile * } #endif } - return ZipFSIndexArchive(interp,needZip,zf); + return ZipFS_Find_TOC(interp,needZip,zf); error: ZipFSCloseArchive(interp, zf); return TCL_ERROR; } - -static void TclZipfs_C_Init(void) { - static const Tcl_Time t = { 0, 0 }; - if (!ZipFS.initialized) { -#ifdef TCL_THREADS - /* - * Inflate condition variable. - */ - Tcl_MutexLock(&ZipFSMutex); - Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, &t); - Tcl_MutexUnlock(&ZipFSMutex); -#endif - Tcl_FSRegister(NULL, &zipfsFilesystem); - Tcl_InitHashTable(&ZipFS.fileHash, TCL_STRING_KEYS); - Tcl_InitHashTable(&ZipFS.zipHash, TCL_STRING_KEYS); - ZipFS.initialized = ZipFS.idCount = 1; - } -} - - /* *------------------------------------------------------------------------- * - * TclZipfs_Mount -- + * ZipFSRootNode -- * - * This procedure is invoked to mount a given ZIP archive file on - * a given mountpoint with optional ZIP password. + * This function generates the root node for a ZIPFS filesystem * * Results: - * A standard Tcl result. + * TCL_OK on success, TCL_ERROR otherwise with an error message + * placed into the given "interp" if it is not NULL. * * Side effects: - * A ZIP archive file is read, analyzed and mounted, resources are - * allocated. - * *------------------------------------------------------------------------- */ -int -TclZipfs_Mount( - Tcl_Interp *interp, - const char *mntpt, - const char *zipname, - const char *passwd -) { - char *realname, *p; +static int +ZipFS_Catalogue_Filesystem(Tcl_Interp *interp, ZipFile *zf0, const char *mntpt, const char *passwd, const char *zipname) +{ int i, pwlen, isNew; - ZipFile *zf, zf0; + ZipFile *zf; ZipEntry *z; Tcl_HashEntry *hPtr; Tcl_DString ds, dsm, fpBuf; @@ -1209,58 +1209,8 @@ TclZipfs_Mount( #if HAS_DRIVES int drive = 0; #endif - - ReadLock(); - if (!ZipFS.initialized) { - TclZipfs_C_Init(); - } - if (mntpt == NULL) { - Tcl_HashSearch search; - int ret = TCL_OK; - - i = 0; - hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); - while (hPtr != NULL) { - if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { - if (interp != NULL) { - Tcl_AppendElement(interp, zf->mntpt); - Tcl_AppendElement(interp, zf->name); - } - ++i; - } - hPtr = Tcl_NextHashEntry(&search); - } - if (interp == NULL) { - ret = (i > 0) ? TCL_OK : TCL_BREAK; - } - Unlock(); - return ret; - } - /* - * Mount point sometimes is a relative or otherwise denormalized path. - * But an absolute name is needed as mount point here. - */ - Tcl_DStringInit(&dsm); - mntpt = CanonicalPath("",mntpt, &dsm, 1); + WriteLock(); - if (zipname == NULL) { - if (interp == NULL) { - Unlock(); - return TCL_OK; - } - - Tcl_DStringInit(&ds); - - hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, mntpt); - if (hPtr != NULL) { - if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { - Tcl_SetObjResult(interp,Tcl_NewStringObj(zf->name, -1)); - } - } - Unlock(); - return TCL_OK; - } - Unlock(); pwlen = 0; if (passwd != NULL) { pwlen = strlen(passwd); @@ -1272,17 +1222,17 @@ TclZipfs_Mount( return TCL_ERROR; } } - if (ZipFSOpenArchive(interp, zipname, 1, &zf0) != TCL_OK) { - return TCL_ERROR; - } + /* + * Mount point sometimes is a relative or otherwise denormalized path. + * But an absolute name is needed as mount point here. + */ Tcl_DStringInit(&ds); -#if HAS_DRIVES - realname = AbsolutePath(zipname, NULL, &ds); -#else - realname = AbsolutePath(zipname, &ds); -#endif - - WriteLock(); + Tcl_DStringInit(&dsm); + if (strcmp(mntpt, "/") == 0) { + mntpt = ""; + } else { + mntpt = CanonicalPath("",mntpt, &dsm, 1); + } hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, mntpt, &isNew); if (!isNew) { zf = (ZipFile *) Tcl_GetHashValue(hPtr); @@ -1290,30 +1240,29 @@ TclZipfs_Mount( Tcl_AppendResult(interp, zf->name, " is already mounted on ", mntpt, (char *) NULL); } Unlock(); - ZipFSCloseArchive(interp, &zf0); + ZipFSCloseArchive(interp, zf0); return TCL_ERROR; } - if (strcmp(mntpt, "/") == 0) { - mntpt = ""; - } zf = (ZipFile *) Tcl_AttemptAlloc(sizeof (*zf) + strlen(mntpt) + 1); if (zf == NULL) { if (interp != NULL) { Tcl_AppendResult(interp, "out of memory", (char *) NULL); } Unlock(); - ZipFSCloseArchive(interp, &zf0); + ZipFSCloseArchive(interp, zf0); return TCL_ERROR; - } - *zf = zf0; - zf->mntpt = Tcl_GetHashKey(&ZipFS.zipHash, hPtr); - zf->mntptlen=strlen(zf->mntpt); - zf->name = strdup(zipname); - zf->entries = NULL; - zf->topents = NULL; - zf->nopen = 0; - Tcl_SetHashValue(hPtr, (ClientData) zf); - if ((zf->pwbuf[0] == 0) && pwlen) { + } + Unlock(); + *zf = *zf0; + zf->mntpt = Tcl_GetHashKey(&ZipFS.zipHash, hPtr); + zf->mntptlen=strlen(zf->mntpt); + zf->name = strdup(zipname); + zf->namelen= strlen(zipname); + zf->entries = NULL; + zf->topents = NULL; + zf->nopen = 0; + Tcl_SetHashValue(hPtr, (ClientData) zf); + if ((zf->pwbuf[0] == 0) && pwlen) { int k = 0; i = pwlen; zf->pwbuf[k++] = i; @@ -1352,7 +1301,6 @@ TclZipfs_Mount( } q = zf->data + zf->centoffs; Tcl_DStringInit(&fpBuf); - Tcl_DStringInit(&ds); for (i = 0; i < zf->nfiles; i++) { int pathlen, comlen, extra, isdir = 0, dosTime, dosDate, nbcompr, offs; unsigned char *lq, *gq = NULL; @@ -1514,12 +1462,229 @@ TclZipfs_Mount( nextent: q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN; } - Unlock(); Tcl_DStringFree(&fpBuf); Tcl_DStringFree(&ds); Tcl_FSMountsChanged(NULL); + Unlock(); return TCL_OK; } + +static void TclZipfs_C_Init(void) { + static const Tcl_Time t = { 0, 0 }; + if (!ZipFS.initialized) { +#ifdef TCL_THREADS + /* + * Inflate condition variable. + */ + Tcl_MutexLock(&ZipFSMutex); + Tcl_ConditionWait(&ZipFSCond, &ZipFSMutex, &t); + Tcl_MutexUnlock(&ZipFSMutex); +#endif + Tcl_FSRegister(NULL, &zipfsFilesystem); + Tcl_InitHashTable(&ZipFS.fileHash, TCL_STRING_KEYS); + Tcl_InitHashTable(&ZipFS.zipHash, TCL_STRING_KEYS); + ZipFS.initialized = ZipFS.idCount = 1; + } +} + + +/* + *------------------------------------------------------------------------- + * + * TclZipfs_Mount -- + * + * This procedure is invoked to mount a given ZIP archive file on + * a given mountpoint with optional ZIP password. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * A ZIP archive file is read, analyzed and mounted, resources are + * allocated. + * + *------------------------------------------------------------------------- + */ + +int +TclZipfs_Mount( + Tcl_Interp *interp, + const char *mntpt, + const char *zipname, + const char *passwd +) { + int i, pwlen; + ZipFile *zf; + + ReadLock(); + if (!ZipFS.initialized) { + TclZipfs_C_Init(); + } + if (mntpt == NULL) { + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + int ret = TCL_OK; + i = 0; + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { + if (interp != NULL) { + Tcl_AppendElement(interp, zf->mntpt); + Tcl_AppendElement(interp, zf->name); + } + ++i; + } + hPtr = Tcl_NextHashEntry(&search); + } + if (interp == NULL) { + ret = (i > 0) ? TCL_OK : TCL_BREAK; + } + Unlock(); + return ret; + } + + if (zipname == NULL) { + Tcl_HashEntry *hPtr; + if (interp == NULL) { + Unlock(); + return TCL_OK; + } + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, mntpt); + if (hPtr != NULL) { + if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { + Tcl_SetObjResult(interp,Tcl_NewStringObj(zf->name, -1)); + } + } + Unlock(); + return TCL_OK; + } + Unlock(); + pwlen = 0; + if (passwd != NULL) { + pwlen = strlen(passwd); + if ((pwlen > 255) || (strchr(passwd, 0xff) != NULL)) { + if (interp) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("illegal password", -1)); + } + return TCL_ERROR; + } + } + zf = (ZipFile *) Tcl_AttemptAlloc(sizeof (*zf) + strlen(mntpt) + 1); + if (zf == NULL) { + if (interp != NULL) { + Tcl_AppendResult(interp, "out of memory", (char *) NULL); + } + return TCL_ERROR; + } + if (ZipFSOpenArchive(interp, zipname, 1, zf) != TCL_OK) { + return TCL_ERROR; + } + return ZipFS_Catalogue_Filesystem(interp,zf,mntpt,passwd,zipname); +} + +/* + *------------------------------------------------------------------------- + * + * TclZipfs_Mount_Buffer -- + * + * This procedure is invoked to mount a given ZIP archive file on + * a given mountpoint with optional ZIP password. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * A ZIP archive file is read, analyzed and mounted, resources are + * allocated. + * + *------------------------------------------------------------------------- + */ + +int +TclZipfs_Mount_Buffer( + Tcl_Interp *interp, + const char *mntpt, + unsigned char *data, + size_t datalen, + int copy +) { + int i; + ZipFile *zf; + + ReadLock(); + if (!ZipFS.initialized) { + TclZipfs_C_Init(); + } + if (mntpt == NULL) { + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + int ret = TCL_OK; + + i = 0; + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { + if (interp != NULL) { + Tcl_AppendElement(interp, zf->mntpt); + Tcl_AppendElement(interp, zf->name); + } + ++i; + } + hPtr = Tcl_NextHashEntry(&search); + } + if (interp == NULL) { + ret = (i > 0) ? TCL_OK : TCL_BREAK; + } + Unlock(); + return ret; + } + + if (data == NULL) { + Tcl_HashEntry *hPtr; + + if (interp == NULL) { + Unlock(); + return TCL_OK; + } + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, mntpt); + if (hPtr != NULL) { + if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { + Tcl_SetObjResult(interp,Tcl_NewStringObj(zf->name, -1)); + } + } + Unlock(); + return TCL_OK; + } + Unlock(); + zf = (ZipFile *) Tcl_AttemptAlloc(sizeof (*zf) + strlen(mntpt) + 1); + if (zf == NULL) { + if (interp != NULL) { + Tcl_AppendResult(interp, "out of memory", (char *) NULL); + } + return TCL_ERROR; + } + zf->is_membuf=1; + zf->length=datalen; + if(copy) { + zf->data=(unsigned char *)Tcl_AttemptAlloc(datalen); + if (zf->data == NULL) { + if (interp != NULL) { + Tcl_AppendResult(interp, "out of memory", (char *) NULL); + } + return TCL_ERROR; + } + memcpy(zf->data,data,datalen); + zf->tofree=zf->data; + } else { + zf->data=data; + zf->tofree=NULL; + } + if(ZipFS_Find_TOC(interp,0,zf)!=TCL_OK) { + return TCL_ERROR; + } + return ZipFS_Catalogue_Filesystem(interp,zf,mntpt,NULL,"Memory Buffer"); +} /* *------------------------------------------------------------------------- @@ -1579,7 +1744,6 @@ TclZipfs_Unmount(Tcl_Interp *interp, const char *mntpt) Tcl_Free((char *) z); } ZipFSCloseArchive(interp, zf); - free(zf->name); //Allocated by strdup Tcl_Free((char *) zf); unmounted = 1; done: @@ -1612,13 +1776,88 @@ ZipFSMountObjCmd( ) { if (objc > 4) { Tcl_WrongNumArgs(interp, 1, objv, - "?zipfile? ?mountpoint? ?password?"); + "?mountpoint? ?zipfile? ?password?"); return TCL_ERROR; } return TclZipfs_Mount(interp, (objc > 1) ? Tcl_GetString(objv[1]) : NULL, (objc > 2) ? Tcl_GetString(objv[2]) : NULL, (objc > 3) ? Tcl_GetString(objv[3]) : NULL); } + +/* + *------------------------------------------------------------------------- + * + * ZipFSMountObjCmd -- + * + * This procedure is invoked to process the "zipfs::mount" command. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * A ZIP archive file is mounted, resources are allocated. + * + *------------------------------------------------------------------------- + */ + +static int +ZipFSMountBufferObjCmd( + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[] +) { + const char *mntpt; + unsigned char *data; + int length; + if (objc > 4) { + Tcl_WrongNumArgs(interp, 1, objv, "?mountpoint? ?data?"); + return TCL_ERROR; + } + if(objc<2) { + int i; + Tcl_HashEntry *hPtr; + Tcl_HashSearch search; + int ret = TCL_OK; + ZipFile *zf; + + ReadLock(); + i = 0; + hPtr = Tcl_FirstHashEntry(&ZipFS.zipHash, &search); + while (hPtr != NULL) { + if ((zf = (ZipFile *) Tcl_GetHashValue(hPtr)) != NULL) { + if (interp != NULL) { + Tcl_AppendElement(interp, zf->mntpt); + Tcl_AppendElement(interp, zf->name); + } + ++i; + } + hPtr = Tcl_NextHashEntry(&search); + } + if (interp == NULL) { + ret = (i > 0) ? TCL_OK : TCL_BREAK; + } + Unlock(); + return ret; + } + mntpt=Tcl_GetString(objv[1]); + if(objc<3) { + Tcl_HashEntry *hPtr; + ZipFile *zf; + + if (interp == NULL) { + Unlock(); + return TCL_OK; + } + hPtr = Tcl_FindHashEntry(&ZipFS.zipHash, mntpt); + if (hPtr != NULL) { + if ((zf = Tcl_GetHashValue(hPtr)) != NULL) { + Tcl_SetObjResult(interp,Tcl_NewStringObj(zf->name, -1)); + } + } + Unlock(); + return TCL_OK; + } + data=Tcl_GetByteArrayFromObj(objv[2],&length); + return TclZipfs_Mount_Buffer(interp, mntpt,data,length,1); +} /* *------------------------------------------------------------------------- @@ -2477,11 +2716,10 @@ ZipFSLMkImgObjCmd(ClientData clientData, Tcl_Interp *interp, /* *------------------------------------------------------------------------- * - * ZipFSExistsObjCmd -- + * ZipFSCanonicalObjCmd -- * - * This procedure is invoked to process the "zipfs::exists" command. - * It tests for the existence of a file in the ZIP filesystem and - * places a boolean into the interp's result. + * This procedure is invoked to process the "zipfs::canonical" command. + * It returns the canonical name for a file within zipfs * * Results: * Always TCL_OK. @@ -4137,6 +4375,7 @@ TclZipfs_Init(Tcl_Interp *interp) if(interp != NULL) { static const EnsembleImplMap initMap[] = { {"mount", ZipFSMountObjCmd, NULL, NULL, NULL, 0}, + {"mount_data", ZipFSMountBufferObjCmd, NULL, NULL, NULL, 0}, {"unmount", ZipFSUnmountObjCmd, NULL, NULL, NULL, 0}, {"mkkey", ZipFSMkKeyObjCmd, NULL, NULL, NULL, 0}, {"mkimg", ZipFSMkImgObjCmd, NULL, NULL, NULL, 0}, diff --git a/tests/zipfs.test b/tests/zipfs.test index 060e4a6..5f5b93c 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -105,7 +105,7 @@ test zipfs-0.12 {zipfs basics: join} -constraints zipfs -body { test zipfs-1.3 {zipfs errors} -constraints zipfs -returnCodes error -body { zipfs mount a b c d e f -} -result {wrong # args: should be "zipfs mount ?zipfile? ?mountpoint? ?password?"} +} -result {wrong # args: should be "zipfs mount ?mountpoint? ?zipfile? ?password?"} test zipfs-1.4 {zipfs errors} -constraints zipfs -returnCodes error -body { zipfs unmount a b c d e f @@ -159,11 +159,8 @@ test zipfs-2.2.0 {zipfs mkzip} -constraints zipfs -body { cd $CWD } -result "[zipfs root]abc/cp850.enc" -skip [concat [skip] zipfs-2.2.*] - - if {![zipfs exists /abc/cp850.enc]} { - tcltest::skip zipfs-2.2.* + skip [concat [skip] zipfs-2.2.*] } test zipfs-2.2.1 {zipfs info} -constraints zipfs -body { @@ -210,7 +207,73 @@ test zipfs-2.2.6 {zipfs unmount} -constraints zipfs -body { zipfs exists /abc/cp850.enc } -result 0 + +### +# Repeat the tests for a buffer mounted archive +### +test zipfs-2.3.0 {zipfs mkzip} -constraints zipfs -body { + cd $tcl_library/encoding + zipfs mkzip $zipfile . + set fin [open $zipfile r] + fconfigure $fin -translation binary + set dat [read $fin] + close $fin + zipfs mount_data def $dat + zipfs list -glob ${ziproot}def/cp850.* +} -cleanup { + cd $CWD +} -result "[zipfs root]def/cp850.enc" + +if {![zipfs exists /def/cp850.enc]} { + skip [concat [skip] zipfs-2.3.*] +} + +test zipfs-2.3.1 {zipfs info} -constraints zipfs -body { + set r [zipfs info ${ziproot}def/cp850.enc] + lrange $r 0 2 +} -result [list {Memory Buffer} 1090 527] ;# NOTE: Only the first 3 results are stable + +test zipfs-2.3.3 {zipfs data} -constraints zipfs -body { + set zipfd [open ${ziproot}/def/cp850.enc] ;# FIXME: leave open - see later test + read $zipfd +} -result {# Encoding file: cp850, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C700FC00E900E200E400E000E500E700EA00EB00E800EF00EE00EC00C400C5 +00C900E600C600F400F600F200FB00F900FF00D600DC00F800A300D800D70192 +00E100ED00F300FA00F100D100AA00BA00BF00AE00AC00BD00BC00A100AB00BB +2591259225932502252400C100C200C000A9256325512557255D00A200A52510 +25142534252C251C2500253C00E300C3255A25542569256625602550256C00A4 +00F000D000CA00CB00C8013100CD00CE00CF2518250C2588258400A600CC2580 +00D300DF00D400D200F500D500B500FE00DE00DA00DB00D900FD00DD00AF00B4 +00AD00B1201700BE00B600A700F700B800B000A800B700B900B300B225A000A0 +} ;# FIXME: result depends on content of encodings dir + +test zipfs-2.3.4 {zipfs exists} -constraints zipfs -body { + zipfs exists /def/cp850.enc +} -result 1 + +test zipfs-2.3.5 {zipfs unmount while busy} -constraints zipfs -body { + zipfs unmount /def +} -returnCodes error -result {filesystem is busy} + +test zipfs-2.3.6 {zipfs unmount} -constraints zipfs -body { + close $zipfd + zipfs unmount /def + zipfs exists /def/cp850.enc +} -result 0 + catch {file delete -force $tmpdir} + ::tcltest::cleanupTests return -- cgit v0.12 From e16df96d28704115312eee43ffc5019a766d2cfd Mon Sep 17 00:00:00 2001 From: hypnotoad Date: Fri, 19 Jan 2018 20:27:15 +0000 Subject: Fixed a problem where a Windows hack was occuring after it was called in the tclZipfs.c file, preventing it from compiling properly. --- generic/tclZipfs.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index b81c58f..bb9d45f 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -2945,6 +2945,24 @@ ZipFSListObjCmd( return TCL_OK; } +#if defined(_WIN32) || defined(_WIN64) +#define LIBRARY_SIZE 64 +static int +ToUtf( + const WCHAR *wSrc, + char *dst) +{ + char *start; + + start = dst; + while (*wSrc != '\0') { + dst += Tcl_UniCharToUtf(*wSrc, dst); + wSrc++; + } + *dst = '\0'; + return (int) (dst - start); +} +#endif Tcl_Obj *TclZipfs_TclLibrary(void) { if(zipfs_literal_tcl_library) { @@ -4422,26 +4440,6 @@ TclZipfs_Init(Tcl_Interp *interp) #endif } -#if defined(_WIN32) || defined(_WIN64) -#define LIBRARY_SIZE 64 -static int -ToUtf( - const WCHAR *wSrc, - char *dst) -{ - char *start; - - start = dst; - while (*wSrc != '\0') { - dst += Tcl_UniCharToUtf(*wSrc, dst); - wSrc++; - } - *dst = '\0'; - return (int) (dst - start); -} - -#endif - static int TclZipfs_AppHook_FindTclInit(const char *archive){ Tcl_Obj *vfsinitscript; int found; -- cgit v0.12 From 1c35ed873acea5b757b3236e5b04e551eba800aa Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 20 Jan 2018 16:02:31 +0000 Subject: Follow-up to previous commit (TIP #485 implementation). Actually remove Tcl_Backslash and Tcl_EvalTokens when compiling with -DTCL_NO_DEPRECATED. --- generic/tclBasic.c | 2 ++ generic/tclUtil.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 52f26a9..c23491c 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4937,6 +4937,7 @@ Tcl_EvalTokensStandard( NULL, NULL); } +#if !defined(TCL_NO_DEPRECATED) && TCL_MINOR_VERSION < 9 /* *---------------------------------------------------------------------- * @@ -4984,6 +4985,7 @@ Tcl_EvalTokens( Tcl_ResetResult(interp); return resPtr; } +#endif /* !TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 15018de..dcd0415 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1604,6 +1604,7 @@ Tcl_Merge( return result; } +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 /* *---------------------------------------------------------------------- * @@ -1637,6 +1638,7 @@ Tcl_Backslash( TclUtfToUniChar(buf, &ch); return (char) ch; } +#endif /* !TCL_NO_DEPRECATED */ /* *---------------------------------------------------------------------- -- cgit v0.12 From 03a71b070685eecb97de3d3cfe830823b056054e Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 22 Jan 2018 09:18:19 +0000 Subject: Put old "int" type back. Not used by Tcl anymore, but this restores compatibility with Tk < 8.6.9 and some extensions: "nsf", "tdbcload", "tclxml" and "VecTcl" (this workaround was used by "boolean" as well, when its internal implementation changed, there's still an oldBooleanType because of that) --- generic/tclInt.h | 1 + generic/tclObj.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/generic/tclInt.h b/generic/tclInt.h index 50d0469..d74cd0e 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2713,6 +2713,7 @@ MODULE_SCOPE const Tcl_ObjType tclByteCodeType; MODULE_SCOPE const Tcl_ObjType tclDoubleType; MODULE_SCOPE const Tcl_ObjType tclEndOffsetType; MODULE_SCOPE const Tcl_ObjType tclIntType; +MODULE_SCOPE const Tcl_ObjType tclOldIntType; MODULE_SCOPE const Tcl_ObjType tclListType; MODULE_SCOPE const Tcl_ObjType tclDictType; MODULE_SCOPE const Tcl_ObjType tclProcBodyType; diff --git a/generic/tclObj.c b/generic/tclObj.c index 8ec95ce..e02f6c4 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -210,6 +210,9 @@ static int SetDoubleFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetIntFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static void UpdateStringOfDouble(Tcl_Obj *objPtr); static void UpdateStringOfInt(Tcl_Obj *objPtr); +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && !defined(TCL_WIDE_INT_IS_LONG) +static void UpdateStringOfOldInt(Tcl_Obj *objPtr); +#endif static void FreeBignum(Tcl_Obj *objPtr); static void DupBignum(Tcl_Obj *objPtr, Tcl_Obj *copyPtr); static void UpdateStringOfBignum(Tcl_Obj *objPtr); @@ -272,6 +275,15 @@ const Tcl_ObjType tclIntType = { UpdateStringOfInt, /* updateStringProc */ SetIntFromAny /* setFromAnyProc */ }; +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && !defined(TCL_WIDE_INT_IS_LONG) +const Tcl_ObjType tclOldIntType = { + "int", /* name */ + NULL, /* freeIntRepProc */ + NULL, /* dupIntRepProc */ + UpdateStringOfOldInt, /* updateStringProc */ + SetIntFromAny /* setFromAnyProc */ +}; +#endif const Tcl_ObjType tclBignumType = { "bignum", /* name */ FreeBignum, /* freeIntRepProc */ @@ -400,6 +412,9 @@ TclInitObjSubsystem(void) /* For backward compatibility only ... */ #if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 Tcl_RegisterObjType(&tclIntType); +#if !defined(TCL_WIDE_INT_IS_LONG) + Tcl_RegisterObjType(&tclOldIntType); +#endif Tcl_RegisterObjType(&oldBooleanType); #endif @@ -2548,6 +2563,22 @@ UpdateStringOfInt( memcpy(objPtr->bytes, buffer, (unsigned) len + 1); objPtr->length = len; } + +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && !defined(TCL_WIDE_INT_IS_LONG) +static void +UpdateStringOfOldInt( + register Tcl_Obj *objPtr) /* Int object whose string rep to update. */ +{ + char buffer[TCL_INTEGER_SPACE]; + register int len; + + len = TclFormatInt(buffer, objPtr->internalRep.longValue); + + objPtr->bytes = ckalloc(len + 1); + memcpy(objPtr->bytes, buffer, (unsigned) len + 1); + objPtr->length = len; +} +#endif /* *---------------------------------------------------------------------- -- cgit v0.12 From fb10dc69eead85da6836ed1c28ee1269d1738337 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 22 Jan 2018 09:54:40 +0000 Subject: make the old "int" type "static", since it's just used in a single file. --- generic/tclInt.h | 1 - generic/tclObj.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index d74cd0e..50d0469 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2713,7 +2713,6 @@ MODULE_SCOPE const Tcl_ObjType tclByteCodeType; MODULE_SCOPE const Tcl_ObjType tclDoubleType; MODULE_SCOPE const Tcl_ObjType tclEndOffsetType; MODULE_SCOPE const Tcl_ObjType tclIntType; -MODULE_SCOPE const Tcl_ObjType tclOldIntType; MODULE_SCOPE const Tcl_ObjType tclListType; MODULE_SCOPE const Tcl_ObjType tclDictType; MODULE_SCOPE const Tcl_ObjType tclProcBodyType; diff --git a/generic/tclObj.c b/generic/tclObj.c index e02f6c4..ebe1450 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -276,7 +276,7 @@ const Tcl_ObjType tclIntType = { SetIntFromAny /* setFromAnyProc */ }; #if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && !defined(TCL_WIDE_INT_IS_LONG) -const Tcl_ObjType tclOldIntType = { +static const Tcl_ObjType oldIntType = { "int", /* name */ NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ @@ -413,7 +413,7 @@ TclInitObjSubsystem(void) #if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 Tcl_RegisterObjType(&tclIntType); #if !defined(TCL_WIDE_INT_IS_LONG) - Tcl_RegisterObjType(&tclOldIntType); + Tcl_RegisterObjType(&oldIntType); #endif Tcl_RegisterObjType(&oldBooleanType); #endif -- cgit v0.12 From 92c0d0a0116d9bf6af0b41c0206824f23953f9c2 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 22 Jan 2018 13:38:47 +0000 Subject: typo --- generic/tclBasic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index c23491c..fa54551 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -4937,7 +4937,7 @@ Tcl_EvalTokensStandard( NULL, NULL); } -#if !defined(TCL_NO_DEPRECATED) && TCL_MINOR_VERSION < 9 +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 /* *---------------------------------------------------------------------- * -- cgit v0.12 From 0abda82b1ef6d5a059df46d1706ae64157523fe7 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 23 Jan 2018 14:52:34 +0000 Subject: In Tcl 9.0, don't register oldBooleanType any more. And rename "booleanString" to "boolean" in tclBooleanType. Many extensions (e.g. [http://cyqlite.sourceforge.net/cgi-bin/sqlite/info/451bb2c1f8554eee|sqlite]) still test for "boolean", although that stopped working already for a long time. In Tcl 8.7, do the same when compiled with -DTCL_NO_DEPRECATED. --- generic/tclObj.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/generic/tclObj.c b/generic/tclObj.c index 4ec0a57..b922c39 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -242,6 +242,7 @@ static int SetCmdNameFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); * implementations. */ +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 static const Tcl_ObjType oldBooleanType = { "boolean", /* name */ NULL, /* freeIntRepProc */ @@ -249,8 +250,13 @@ static const Tcl_ObjType oldBooleanType = { NULL, /* updateStringProc */ TclSetBooleanFromAny /* setFromAnyProc */ }; +#endif const Tcl_ObjType tclBooleanType = { +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 "booleanString", /* name */ +#else + "boolean", /* name */ +#endif NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ NULL, /* updateStringProc */ @@ -406,7 +412,9 @@ TclInitObjSubsystem(void) Tcl_RegisterObjType(&tclProcBodyType); /* For backward compatibility only ... */ +#if !defined(TCL_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 Tcl_RegisterObjType(&oldBooleanType); +#endif #ifndef TCL_WIDE_INT_IS_LONG Tcl_RegisterObjType(&tclWideIntType); #endif -- cgit v0.12 From e403ff8f45f2d5327b449d9131d2a06896fe34f3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 24 Jan 2018 09:59:15 +0000 Subject: Documentation fix: there is no "O" conversion, just "o" for octal. Also, "b" conversions normally don't produce a sign. --- doc/format.n | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/format.n b/doc/format.n index ba044f2..1c511e8 100644 --- a/doc/format.n +++ b/doc/format.n @@ -83,7 +83,7 @@ Specifies that the number should be padded on the left with zeroes instead of spaces. .TP 10 \fB#\fR -Requests an alternate output form. For \fBo\fR and \fBO\fR +Requests an alternate output form. For \fBo\fR conversions it guarantees that the first digit is always \fB0\fR. For \fBx\fR or \fBX\fR conversions, \fB0x\fR or \fB0X\fR (respectively) will be added to the beginning of the result unless it is zero. @@ -169,7 +169,7 @@ for \fBx\fR and for \fBX\fR). .TP 10 \fBb\fR -Convert integer to binary string, using digits 0 and 1. +Convert integer to unsigned binary string, using digits 0 and 1. .TP 10 \fBc\fR Convert integer to the Unicode character it represents. -- cgit v0.12 From 83df36ac4194e2b04610ad61244a08b9b068a816 Mon Sep 17 00:00:00 2001 From: pspjuth Date: Thu, 25 Jan 2018 20:05:54 +0000 Subject: Allow -stride 1. --- doc/lsearch.n | 3 ++- generic/tclCmdIL.c | 4 ++-- tests/lsearch.test | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/lsearch.n b/doc/lsearch.n index 2f956a5..12c2786 100644 --- a/doc/lsearch.n +++ b/doc/lsearch.n @@ -158,7 +158,8 @@ by the element within each group given by the first index passed to index always points to the first element in a group. .PP The list length must be an integer multiple of \fIstrideLength\fR, which -in turn must be at least 2. +in turn must be at least 1. A \fIstrideLength\fR of 1 is the default and +indicates no grouping. .TP \fB\-index\fR\0\fIindexList\fR . diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index c514f84..e07b5ba 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -3101,9 +3101,9 @@ Tcl_LsearchObjCmd( result = TCL_ERROR; goto done; } - if (groupSize < 2) { + if (groupSize < 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "stride length must be at least 2", -1)); + "stride length must be at least 1", -1)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "LSORT", "BADSTRIDE", NULL); result = TCL_ERROR; diff --git a/tests/lsearch.test b/tests/lsearch.test index 4e4b206..a53a8be 100644 --- a/tests/lsearch.test +++ b/tests/lsearch.test @@ -518,7 +518,7 @@ test lsearch-23.1 {lsearch -stride option, errors} -body { } -returnCodes error -result {"-stride" option must be followed by stride length} test lsearch-23.2 {lsearch -stride option, errors} -body { lsearch -stride 0 {a b} a -} -returnCodes error -result {stride length must be at least 2} +} -returnCodes error -result {stride length must be at least 1} test lsearch-23.3 {lsearch -stride option, errors} -body { lsearch -stride 2 {a b c} a } -returnCodes error -result {list size must be a multiple of the stride length} @@ -562,6 +562,10 @@ test lsearch-24.9 {lsearch -stride option} -body { test lsearch-24.10 {lsearch -stride option} -body { lsearch -all -inline -stride 3 -index 0 {a b c d e f a e i} a } -result "a b c a e i" +test lsearch-24.11 {lsearch -stride option} -body { + # Stride 1 is same as no stride + lsearch -stride 1 {a b c d e f g h} d +} -result 3 # 25* mimics 19* but with -inline added to -subindices test lsearch-25.1 {lsearch -subindices option} { -- cgit v0.12 From f08ea445641489126720965930b2f1e96d44696c Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 25 Jan 2018 20:28:15 +0000 Subject: Dup test names --- tests/info.test | 2 +- tests/link.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/info.test b/tests/info.test index d30bf9a..fbc65ba 100644 --- a/tests/info.test +++ b/tests/info.test @@ -1818,7 +1818,7 @@ test info-38.2 {location information for uplevel, dl, direct-literal} -match glo * {type source line 1814 file info.test cmd etrace level 1} * {type source line 1812 file info.test cmd uplevel\\ \\\\ level 1}} -cleanup {interp delete sub} -test info-39.0 {Bug 4b61afd660} -setup { +test info-39.2 {Bug 4b61afd660} -setup { proc probe {} { return [dict get [info frame -1] line] } diff --git a/tests/link.test b/tests/link.test index 7bde482..22a1fc2 100644 --- a/tests/link.test +++ b/tests/link.test @@ -141,7 +141,7 @@ test link-2.8 {writing C variables from Tcl} -constraints {testlink} -setup { set uwide "0O" concat [testlink get] | $int $real $bool $string $wide $char $uchar $short $ushort $uint $long $ulong $float $uwide } -result {0 0.0 0 0 0 0 0 0 0 0 0 0 0.0 0 | 0x 0b 0 0 0O 0X 0B 0O 0x 0b 0o 0X 0B 0O} -test link-2.8 {writing C variables from Tcl} -constraints {testlink} -setup { +test link-2.9 {writing C variables from Tcl} -constraints {testlink} -setup { testlink delete } -body { testlink set 43 1.21 4 - 56785678 64 250 30000 60000 0xbaadbeef 12321 32123 3.25 1231231234 -- cgit v0.12 From 189d0a83d2df3b9f47e30232bdf377d4daeaba2b Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 25 Jan 2018 21:15:36 +0000 Subject: lifetime management of files generated by tests --- tests/chanio.test | 5 +++++ tests/exec.test | 1 - tests/io.test | 5 +++++ tests/ioCmd.test | 5 +---- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/chanio.test b/tests/chanio.test index 2f2540e..541c20d 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -5732,6 +5732,8 @@ test chan-io-47.6 {file events on shared files, deleting file events} {testfeven chan close $f set x } {{script 1} {}} +unset path(foo) +removeFile foo set path(bar) [makeFile {} bar] @@ -5834,6 +5836,9 @@ test chan-io-48.3 {testing readability conditions} {stdio unix nonBlockFiles ope chan close $f list $x $l } {done {0 1 0 1 0 1 0 1 0 1 0 1 0 0}} +unset path(bar) +removeFile bar + test chan-io-48.4 {lf write, testing readability, ^Z termination, auto read mode} {fileevent} { file delete $path(test1) set f [open $path(test1) w] diff --git a/tests/exec.test b/tests/exec.test index 810dfa6..7bb8579 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -287,7 +287,6 @@ test exec-6.3 {redirecting stderr through a pipeline} {exec stdio} { # I/O redirection: combinations. set path(gorp.file2) [makeFile {} gorp.file2] -file delete $path(gorp.file2) test exec-7.1 {multiple I/O redirections} {exec} { exec << "command input" > $path(gorp.file2) [interpreter] $path(cat) < $path(gorp.file) diff --git a/tests/io.test b/tests/io.test index 7275b42..5529881 100644 --- a/tests/io.test +++ b/tests/io.test @@ -6130,6 +6130,8 @@ test io-47.6 {file events on shared files, deleting file events} {testfevent fil close $f set x } {{script 1} {}} +unset path(foo) +removeFile foo set path(bar) [makeFile {} bar] @@ -6232,6 +6234,9 @@ test io-48.3 {testing readability conditions} {stdio unix nonBlockFiles openpipe close $f list $x $l } {done {0 1 0 1 0 1 0 1 0 1 0 1 0 0}} +unset path(bar) +removeFile bar + test io-48.4 {lf write, testing readability, ^Z termination, auto read mode} {fileevent} { file delete $path(test1) set f [open $path(test1) w] diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 5a76d48..1cb7c74 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -366,7 +366,6 @@ test iocmd-10.5 {fblocked command} { set path(test4) [makeFile {} test4] set path(test5) [makeFile {} test5] -file delete $path(test5) test iocmd-11.1 {I/O to command pipelines} {unixOrPc unixExecs} { set f [open $path(test4) w] close $f @@ -3643,8 +3642,6 @@ foreach file [list test1 test2 test3 test4] { } # delay long enough for background processes to finish after 500 -foreach file [list test5] { - removeFile $file -} +removeFile test5 cleanupTests return -- cgit v0.12 From 46e8af13b6ce6aaddd0d274991d58db7d44714ca Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 25 Jan 2018 22:11:34 +0000 Subject: Dup test name --- tests/lsearch.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lsearch.test b/tests/lsearch.test index a53a8be..a7efcdd 100644 --- a/tests/lsearch.test +++ b/tests/lsearch.test @@ -651,7 +651,7 @@ test lsearch-28.7 {lsearch -sorted with -stride} -body { test lsearch-28.8 {lsearch -sorted with -stride} -body { lsearch -sorted -stride 2 -index 1 -subindices {3 5 8 7 2 9} 9 } -result 5 -test lsearch-28.8 {lsearch -sorted with -stride} -body { +test lsearch-28.9 {lsearch -sorted with -stride} -body { lsearch -sorted -stride 2 -index 1 -subindices -inline {3 5 8 7 2 9} 9 } -result 9 -- cgit v0.12 From 2eba1ce11e24976640d99ae78cec26cc67508f15 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 26 Jan 2018 13:29:01 +0000 Subject: Rename (internal) TclNewWideObj macro to TclNewIntObj. Change Tcl_SetIntObj/Tcl_SetLongObj to macro's referencing Tcl_SetWideIntObj (since all of those do the same now) --- generic/tclBasic.c | 2 +- generic/tclCmdMZ.c | 2 +- generic/tclDecls.h | 6 ++++-- generic/tclExecute.c | 46 +++++++++++++++++++++++----------------------- generic/tclInt.h | 6 +++--- generic/tclObj.c | 11 ++++++----- generic/tclScan.c | 4 ++-- generic/tclStubInit.c | 1 + generic/tclZlib.c | 2 +- 9 files changed, 42 insertions(+), 38 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 51d9a64..e2879f1 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3686,7 +3686,7 @@ OldMathFuncProc( */ if (funcResult.type == TCL_INT) { - TclNewWideObj(valuePtr, funcResult.intValue); + TclNewIntObj(valuePtr, funcResult.intValue); } else if (funcResult.type == TCL_WIDE_INT) { valuePtr = Tcl_NewWideIntObj(funcResult.wideValue); } else { diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 8ae3f51..fd9858b 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -4303,7 +4303,7 @@ TclNRTryObjCmd( } info[0] = objv[i]; /* type */ - TclNewWideObj(info[1], code); /* returnCode */ + TclNewIntObj(info[1], code); /* returnCode */ if (info[2] == NULL) { /* errorCodePrefix */ TclNewObj(info[2]); } diff --git a/generic/tclDecls.h b/generic/tclDecls.h index 464609c..49f34e8 100644 --- a/generic/tclDecls.h +++ b/generic/tclDecls.h @@ -3935,7 +3935,6 @@ extern const TclStubs *tclStubsPtr; * without introducing a binary incompatibility. */ # undef Tcl_GetLongFromObj -# undef Tcl_SetLongObj # undef Tcl_ExprLong # undef Tcl_ExprLongObj # undef Tcl_UniCharNcmp @@ -3943,7 +3942,6 @@ extern const TclStubs *tclStubsPtr; # undef Tcl_UtfNcasecmp # undef Tcl_UniCharNcasecmp # define Tcl_GetLongFromObj ((int(*)(Tcl_Interp*,Tcl_Obj*,long*))Tcl_GetWideIntFromObj) -# define Tcl_SetLongObj ((void(*)(Tcl_Obj*,long))Tcl_SetWideIntObj) # define Tcl_ExprLong TclExprLong static inline int TclExprLong(Tcl_Interp *interp, const char *string, long *ptr){ int intValue; @@ -3975,6 +3973,10 @@ extern const TclStubs *tclStubsPtr; #define Tcl_NewIntObj(value) Tcl_NewWideIntObj((int)(value)) #undef Tcl_DbNewLongObj #define Tcl_DbNewLongObj(value, file, line) Tcl_DbNewWideIntObj((long)(value), file, line) +#undef Tcl_SetIntObj +#define Tcl_SetIntObj(objPtr, value) Tcl_SetWideIntObj(objPtr, (int)(value)) +#undef Tcl_SetLongObj +#define Tcl_SetLongObj(objPtr, value) Tcl_SetWideIntObj(objPtr, (long)(value)) /* * Deprecated Tcl procedures: diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 81f7fe7..eb730ce 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -325,7 +325,7 @@ VarHashCreateVar( NEXT_INST_F(((condition)? TclGetInt4AtPtr(pc+1) : 5), (cleanup), 0); \ default: \ if ((condition) < 0) { \ - TclNewWideObj(objResultPtr, -1); \ + TclNewIntObj(objResultPtr, -1); \ } else { \ objResultPtr = TCONST((condition) > 0); \ } \ @@ -346,7 +346,7 @@ VarHashCreateVar( NEXT_INST_V(((condition)? TclGetInt4AtPtr(pc+1) : 5), (cleanup), 0); \ default: \ if ((condition) < 0) { \ - TclNewWideObj(objResultPtr, -1); \ + TclNewIntObj(objResultPtr, -1); \ } else { \ objResultPtr = TCONST((condition) > 0); \ } \ @@ -357,7 +357,7 @@ VarHashCreateVar( #define JUMP_PEEPHOLE_F(condition, pcAdjustment, cleanup) \ do{ \ if ((condition) < 0) { \ - TclNewWideObj(objResultPtr, -1); \ + TclNewIntObj(objResultPtr, -1); \ } else { \ objResultPtr = TCONST((condition) > 0); \ } \ @@ -366,7 +366,7 @@ VarHashCreateVar( #define JUMP_PEEPHOLE_V(condition, pcAdjustment, cleanup) \ do{ \ if ((condition) < 0) { \ - TclNewWideObj(objResultPtr, -1); \ + TclNewIntObj(objResultPtr, -1); \ } else { \ objResultPtr = TCONST((condition) > 0); \ } \ @@ -851,9 +851,9 @@ TclCreateExecEnv( + (size_t) (size-1) * sizeof(Tcl_Obj *)); eePtr->execStackPtr = esPtr; - TclNewWideObj(eePtr->constants[0], 0); + TclNewIntObj(eePtr->constants[0], 0); Tcl_IncrRefCount(eePtr->constants[0]); - TclNewWideObj(eePtr->constants[1], 1); + TclNewIntObj(eePtr->constants[1], 1); Tcl_IncrRefCount(eePtr->constants[1]); eePtr->interp = interp; eePtr->callbackPtr = NULL; @@ -1849,7 +1849,7 @@ TclIncrObj( */ if (!Overflowing(w1, w2, sum)) { - Tcl_SetWideIntObj(valuePtr, sum); + TclSetIntObj(valuePtr, sum); return TCL_OK; } } @@ -3649,7 +3649,7 @@ TEBCresume( TRACE(("%u %ld => ", opnd, increment)); if (Tcl_IsShared(objPtr)) { objPtr->refCount--; /* We know it's shared. */ - TclNewWideObj(objResultPtr, sum); + TclNewIntObj(objResultPtr, sum); Tcl_IncrRefCount(objResultPtr); varPtr->value.objPtr = objResultPtr; } else { @@ -3687,7 +3687,7 @@ TEBCresume( } else { objResultPtr = objPtr; } - TclNewWideObj(incrPtr, increment); + TclNewIntObj(incrPtr, increment); if (TclIncrObj(interp, objResultPtr, incrPtr) != TCL_OK) { Tcl_DecrRefCount(incrPtr); TRACE_ERROR(interp); @@ -3701,7 +3701,7 @@ TEBCresume( * All other cases, flow through to generic handling. */ - TclNewWideObj(incrPtr, increment); + TclNewIntObj(incrPtr, increment); Tcl_IncrRefCount(incrPtr); doIncrScalar: @@ -4399,7 +4399,7 @@ TEBCresume( NEXT_INST_F(1, 0, 1); } case INST_INFO_LEVEL_NUM: - TclNewWideObj(objResultPtr, iPtr->varFramePtr->level); + TclNewIntObj(objResultPtr, iPtr->varFramePtr->level); TRACE_WITH_OBJ(("=> "), objResultPtr); NEXT_INST_F(1, 0, 1); case INST_INFO_LEVEL_ARGS: { @@ -4768,7 +4768,7 @@ TEBCresume( TRACE_ERROR(interp); goto gotError; } - TclNewWideObj(objResultPtr, length); + TclNewIntObj(objResultPtr, length); TRACE_APPEND(("%d\n", length)); NEXT_INST_F(1, 1, 1); @@ -5239,7 +5239,7 @@ TEBCresume( case INST_STR_LEN: valuePtr = OBJ_AT_TOS; length = Tcl_GetCharLength(valuePtr); - TclNewWideObj(objResultPtr, length); + TclNewIntObj(objResultPtr, length); TRACE(("\"%.20s\" => %d\n", O2S(valuePtr), length)); NEXT_INST_F(1, 1, 1); @@ -5594,7 +5594,7 @@ TEBCresume( TRACE(("%.20s %.20s => %d\n", O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match)); - TclNewWideObj(objResultPtr, match); + TclNewIntObj(objResultPtr, match); NEXT_INST_F(1, 2, 1); case INST_STR_FIND_LAST: @@ -5602,7 +5602,7 @@ TEBCresume( TRACE(("%.20s %.20s => %d\n", O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match)); - TclNewWideObj(objResultPtr, match); + TclNewIntObj(objResultPtr, match); NEXT_INST_F(1, 2, 1); case INST_STR_CLASS: @@ -5798,7 +5798,7 @@ TEBCresume( type1 = TCL_NUMBER_WIDE; } } - TclNewWideObj(objResultPtr, type1); + TclNewIntObj(objResultPtr, type1); TRACE(("\"%.20s\" => %d\n", O2S(OBJ_AT_TOS), type1)); NEXT_INST_F(1, 1, 1); @@ -5991,7 +5991,7 @@ TEBCresume( if (w1 > 0L) { objResultPtr = TCONST(0); } else { - TclNewWideObj(objResultPtr, -1); + TclNewIntObj(objResultPtr, -1); } TRACE(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 2, 1); @@ -6190,7 +6190,7 @@ TEBCresume( TRACE(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 2, 1); } - Tcl_SetWideIntObj(valuePtr, wResult); + TclSetIntObj(valuePtr, wResult); TRACE(("%s\n", O2S(valuePtr))); NEXT_INST_F(1, 1, 0); @@ -6298,7 +6298,7 @@ TEBCresume( if (type1 == TCL_NUMBER_WIDE) { w1 = *((const Tcl_WideInt *) ptr1); if (Tcl_IsShared(valuePtr)) { - TclNewWideObj(objResultPtr, ~w1); + TclNewIntObj(objResultPtr, ~w1); TRACE_APPEND(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 1, 1); } @@ -6336,7 +6336,7 @@ TEBCresume( w1 = *((const Tcl_WideInt *) ptr1); if (w1 != LLONG_MIN) { if (Tcl_IsShared(valuePtr)) { - TclNewWideObj(objResultPtr, -w1); + TclNewIntObj(objResultPtr, -w1); TRACE_APPEND(("%s\n", O2S(objResultPtr))); NEXT_INST_F(1, 1, 1); } @@ -6501,7 +6501,7 @@ TEBCresume( oldValuePtr = iterVarPtr->value.objPtr; if (oldValuePtr == NULL) { - TclNewWideObj(iterVarPtr->value.objPtr, -1); + TclNewIntObj(iterVarPtr->value.objPtr, -1); Tcl_IncrRefCount(iterVarPtr->value.objPtr); } else { TclSetIntObj(oldValuePtr, -1); @@ -6872,7 +6872,7 @@ TEBCresume( NEXT_INST_F(1, 0, -1); case INST_PUSH_RETURN_CODE: - TclNewWideObj(objResultPtr, result); + TclNewIntObj(objResultPtr, result); TRACE(("=> %u\n", result)); NEXT_INST_F(1, 0, 1); @@ -7973,7 +7973,7 @@ ExecuteExtendedBinaryMathOp( if (Tcl_IsShared(valuePtr)) { \ return Tcl_NewWideIntObj(w); \ } else { \ - Tcl_SetWideIntObj(valuePtr, w); \ + TclSetIntObj(valuePtr, w); \ return NULL; \ } #define BIG_RESULT(b) \ diff --git a/generic/tclInt.h b/generic/tclInt.h index b061ed0..d5f4c9b 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4583,7 +4583,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; * types, avoiding the corresponding function calls in time critical parts of * the core. The ANSI C "prototypes" for these macros are: * - * MODULE_SCOPE void TclNewWideObj(Tcl_Obj *objPtr, Tcl_WideInt w); + * MODULE_SCOPE void TclNewIntObj(Tcl_Obj *objPtr, Tcl_WideInt w); * MODULE_SCOPE void TclNewDoubleObj(Tcl_Obj *objPtr, double d); * MODULE_SCOPE void TclNewStringObj(Tcl_Obj *objPtr, const char *s, int len); * MODULE_SCOPE void TclNewLiteralStringObj(Tcl_Obj*objPtr, const char *sLiteral); @@ -4592,7 +4592,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; */ #ifndef TCL_MEM_DEBUG -#define TclNewWideObj(objPtr, i) \ +#define TclNewIntObj(objPtr, i) \ do { \ TclIncrObjsAllocated(); \ TclAllocObjStorage(objPtr); \ @@ -4625,7 +4625,7 @@ MODULE_SCOPE Tcl_PackageInitProc Procbodytest_SafeInit; } while (0) #else /* TCL_MEM_DEBUG */ -#define TclNewWideObj(objPtr, w) \ +#define TclNewIntObj(objPtr, w) \ (objPtr) = Tcl_NewWideIntObj(w) #define TclNewDoubleObj(objPtr, d) \ diff --git a/generic/tclObj.c b/generic/tclObj.c index b4dfc63..5f60d9d 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -1769,7 +1769,7 @@ Tcl_NewBooleanObj( { register Tcl_Obj *objPtr; - TclNewWideObj(objPtr, boolValue!=0); + TclNewIntObj(objPtr, boolValue!=0); return objPtr; } #endif /* TCL_MEM_DEBUG */ @@ -2416,7 +2416,7 @@ Tcl_NewIntObj( { register Tcl_Obj *objPtr; - TclNewWideObj(objPtr, intValue); + TclNewIntObj(objPtr, intValue); return objPtr; } #endif /* if TCL_MEM_DEBUG */ @@ -2630,7 +2630,7 @@ Tcl_NewLongObj( { register Tcl_Obj *objPtr; - TclNewWideObj(objPtr, longValue); + TclNewIntObj(objPtr, longValue); return objPtr; } #endif /* if TCL_MEM_DEBUG */ @@ -2722,6 +2722,7 @@ Tcl_DbNewLongObj( *---------------------------------------------------------------------- */ +#undef Tcl_SetLongObj void Tcl_SetLongObj( register Tcl_Obj *objPtr, /* Object whose internal rep to init. */ @@ -2891,7 +2892,7 @@ Tcl_NewWideIntObj( register Tcl_Obj *objPtr; TclNewObj(objPtr); - Tcl_SetWideIntObj(objPtr, wideValue); + TclSetIntObj(objPtr, wideValue); return objPtr; } #endif /* if TCL_MEM_DEBUG */ @@ -2943,7 +2944,7 @@ Tcl_DbNewWideIntObj( register Tcl_Obj *objPtr; TclDbNewObj(objPtr, file, line); - Tcl_SetWideIntObj(objPtr, wideValue); + TclSetIntObj(objPtr, wideValue); return objPtr; } diff --git a/generic/tclScan.c b/generic/tclScan.c index e0798df..1bdc3ef 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -942,7 +942,7 @@ Tcl_ScanObjCmd( (Tcl_WideUInt)wideValue); Tcl_SetStringObj(objPtr, buf, -1); } else { - Tcl_SetWideIntObj(objPtr, wideValue); + TclSetIntObj(objPtr, wideValue); } } else if (!(flags & SCAN_BIG)) { if (TclGetLongFromObj(NULL, objPtr, &value) != TCL_OK) { @@ -956,7 +956,7 @@ Tcl_ScanObjCmd( sprintf(buf, "%lu", value); /* INTL: ISO digit */ Tcl_SetStringObj(objPtr, buf, -1); } else { - Tcl_SetLongObj(objPtr, value); + TclSetIntObj(objPtr, value); } } objs[objIndex++] = objPtr; diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index d255e97..86406c1 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -43,6 +43,7 @@ #undef TclpGetPid #undef TclSockMinimumBuffers #undef Tcl_SetIntObj +#undef Tcl_SetLongObj #undef TclpInetNtoa #undef TclWinGetServByName #undef TclWinGetSockOpt diff --git a/generic/tclZlib.c b/generic/tclZlib.c index dc124f7..994bcef 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -373,7 +373,7 @@ ConvertErrorToList( default: TclNewLiteralStringObj(objv[2], "UNKNOWN"); - TclNewWideObj(objv[3], code); + TclNewIntObj(objv[3], code); return Tcl_NewListObj(4, objv); } } -- cgit v0.12 From a0c6bf8d922f9e7853a161b064103518dddd4612 Mon Sep 17 00:00:00 2001 From: dgp Date: Sat, 27 Jan 2018 01:38:21 +0000 Subject: Regression test for shimmering danger in [join]. --- tests/join.test | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/join.test b/tests/join.test index 4abe233..4aeb093 100644 --- a/tests/join.test +++ b/tests/join.test @@ -45,6 +45,11 @@ test join-3.1 {joinString is binary ok} { test join-3.2 {join is binary ok} { string length [join "a\0b a\0b a\0b"] } 11 + +test join-4.1 {shimmer segfault prevention} { + set l {0 0} + join $l $l +} {00 00} # cleanup ::tcltest::cleanupTests -- cgit v0.12 From fa7659336ca6c01fbed7cf8497b29e9191b0cb42 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Sat, 27 Jan 2018 18:17:09 +0000 Subject: Remove restriction on defining the class of a TclOO object not explicitly instantiated from ::oo::class. --- generic/tclOODefineCmds.c | 15 --------------- tests/oo.test | 4 ++-- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index c08b350..7c2a641 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -1143,7 +1143,6 @@ TclOODefineClassObjCmd( { Object *oPtr; Class *clsPtr; - Foundation *fPtr = TclOOGetFoundation(interp); /* * Parse the context to get the object to operate on. @@ -1180,20 +1179,6 @@ TclOODefineClassObjCmd( return TCL_ERROR; } - /* - * Apply semantic checks. In particular, classes and non-classes are not - * interchangable (too complicated to do the conversion!) so we must - * produce an error if any attempt is made to swap from one to the other. - */ - - if ((oPtr->classPtr==NULL) == TclOOIsReachable(fPtr->classCls, clsPtr)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "may not change a %sclass object into a %sclass object", - (oPtr->classPtr==NULL ? "non-" : ""), - (oPtr->classPtr==NULL ? "" : "non-"))); - Tcl_SetErrorCode(interp, "TCL", "OO", "TRANSMUTATION", NULL); - return TCL_ERROR; - } /* * Set the object's class. diff --git a/tests/oo.test b/tests/oo.test index 3be5f79..4f9490b 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -1707,13 +1707,13 @@ test oo-13.2 {OO: changing an object's class} -body { oo::objdefine foo class oo::class } -cleanup { foo destroy -} -returnCodes 1 -result {may not change a non-class object into a class object} +} -result {} test oo-13.3 {OO: changing an object's class} -body { oo::class create foo oo::objdefine foo class oo::object } -cleanup { foo destroy -} -returnCodes 1 -result {may not change a class object into a non-class object} +} -result {} test oo-13.4 {OO: changing an object's class} -body { oo::class create foo { method m {} { -- cgit v0.12 From 876f2d5b633933c4d5a652a0bc4e1742893cc458 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Sun, 28 Jan 2018 14:37:53 +0000 Subject: Change the signature of PkgRequireCore in preparation to provide TclNRPackageObjCmd. --- generic/tclPkg.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 288d5dc..2b842b4 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -85,7 +85,7 @@ static void AddRequirementsToResult(Tcl_Interp *interp, int reqc, static void AddRequirementsToDString(Tcl_DString *dstring, int reqc, Tcl_Obj *const reqv[]); static Package * FindPackage(Tcl_Interp *interp, const char *name); -static const char * PkgRequireCore(Tcl_Interp *interp, const char *name, +static int PkgRequireCore(Tcl_Interp *interp, const char *name, int reqc, Tcl_Obj *const reqv[], void *clientDataPtr); @@ -365,7 +365,10 @@ Tcl_PkgRequireEx( */ if (version == NULL) { - result = PkgRequireCore(interp, name, 0, NULL, clientDataPtr); + if (Tcl_PkgRequireProc(interp, name, 0, NULL, clientDataPtr) == TCL_OK) { + result = Tcl_GetStringResult(interp); + Tcl_ResetResult(interp); + } } else { if (exact && TCL_OK != CheckVersionAndConvert(interp, version, NULL, NULL)) { @@ -376,10 +379,12 @@ Tcl_PkgRequireEx( Tcl_AppendStringsToObj(ov, "-", version, NULL); } Tcl_IncrRefCount(ov); - result = PkgRequireCore(interp, name, 1, &ov, clientDataPtr); + if (Tcl_PkgRequireProc(interp, name, 1, &ov, clientDataPtr) == TCL_OK) { + result = Tcl_GetStringResult(interp); + Tcl_ResetResult(interp); + } TclDecrRefCount(ov); } - return result; } @@ -394,17 +399,14 @@ Tcl_PkgRequireProc( * available. */ void *clientDataPtr) { - const char *result = - PkgRequireCore(interp, name, reqc, reqv, clientDataPtr); - - if (result == NULL) { - return TCL_ERROR; + int code = CheckAllRequirements(interp, reqc, reqv); + if (code != TCL_OK) { + return code; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(result, -1)); - return TCL_OK; + return PkgRequireCore(interp, name, reqc, reqv, clientDataPtr); } -static const char * +int PkgRequireCore( Tcl_Interp *interp, /* Interpreter in which package is now * available. */ @@ -424,10 +426,6 @@ PkgRequireCore( char *script, *pkgVersionI; Tcl_DString command; - if (TCL_OK != CheckAllRequirements(interp, reqc, reqv)) { - return NULL; - } - /* * It can take up to three passes to find the package: one pass to run the * "package unknown" script, one to run the "package ifneeded" script for @@ -453,7 +451,7 @@ PkgRequireCore( name, (char *) pkgPtr->clientData, name)); AddRequirementsToResult(interp, reqc, reqv); Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "CIRCULARITY", NULL); - return NULL; + return TCL_ERROR; } /* @@ -678,7 +676,7 @@ PkgRequireCore( pkgPtr->version = NULL; } pkgPtr->clientData = NULL; - return NULL; + return code; } break; @@ -714,7 +712,7 @@ PkgRequireCore( if (code == TCL_ERROR) { Tcl_AddErrorInfo(interp, "\n (\"package unknown\" script)"); - return NULL; + return code; } Tcl_ResetResult(interp); } @@ -725,7 +723,7 @@ PkgRequireCore( "can't find package %s", name)); Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNFOUND", NULL); AddRequirementsToResult(interp, reqc, reqv); - return NULL; + return TCL_ERROR; } /* @@ -746,7 +744,7 @@ PkgRequireCore( Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "VERSIONCONFLICT", NULL); AddRequirementsToResult(interp, reqc, reqv); - return NULL; + return TCL_ERROR; } } @@ -755,7 +753,8 @@ PkgRequireCore( *ptr = pkgPtr->clientData; } - return pkgPtr->version; + Tcl_SetObjResult(interp, Tcl_NewStringObj(pkgPtr->version, -1)); + return TCL_OK; } /* -- cgit v0.12 From 1a988444125d7bee60784dbe4958d4a428c310b4 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Sun, 28 Jan 2018 18:21:09 +0000 Subject: Preparation to provide TclNRPackageObjectCmd: Eliminate the loop in PkgRequireCore so that TclNRAddCallback can be added at the needed spots. This checkin creates a crash in test package-3.12 . Pushing the work off the 8.7.* branch and onto a feature branch for now. --- generic/tclPkg.c | 553 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 277 insertions(+), 276 deletions(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 2b842b4..02f66f0 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -88,6 +88,8 @@ static Package * FindPackage(Tcl_Interp *interp, const char *name); static int PkgRequireCore(Tcl_Interp *interp, const char *name, int reqc, Tcl_Obj *const reqv[], void *clientDataPtr); +static int SelectPackage (Tcl_Interp *interp, const char *name, + Package *pkgPtr, int reqc, Tcl_Obj *const reqv[]); /* * Helper macros. @@ -417,343 +419,342 @@ PkgRequireCore( * available. */ void *clientDataPtr) { - Interp *iPtr = (Interp *) interp; Package *pkgPtr; - PkgAvail *availPtr, *bestPtr, *bestStablePtr; - char *availVersion, *bestVersion, *bestStableVersion; - /* Internal rep. of versions */ - int availStable, code, satisfies, pass; + int code, satisfies; char *script, *pkgVersionI; Tcl_DString command; + pkgPtr = FindPackage(interp, name); + if (pkgPtr->version == NULL) { + code = SelectPackage(interp, name, pkgPtr, reqc, reqv); + if (code != TCL_OK) { + return code; + } + if (pkgPtr->version == NULL) { + /* + * The package is not in the database. If there is a "package unknown" + * command, invoke it. + */ + + script = ((Interp *) interp)->packageUnknown; + if (script != NULL) { + Tcl_DStringInit(&command); + Tcl_DStringAppend(&command, script, -1); + Tcl_DStringAppendElement(&command, name); + AddRequirementsToDString(&command, reqc, reqv); + + code = Tcl_EvalEx(interp, Tcl_DStringValue(&command), + Tcl_DStringLength(&command), TCL_EVAL_GLOBAL); + Tcl_DStringFree(&command); + + if ((code != TCL_OK) && (code != TCL_ERROR)) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "bad return code: %d", code)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); + code = TCL_ERROR; + } + if (code == TCL_ERROR) { + Tcl_AddErrorInfo(interp, + "\n (\"package unknown\" script)"); + return code; + } + Tcl_ResetResult(interp); + } + /* pkgPtr may now be invalid, so refresh it. */ + pkgPtr = FindPackage(interp, name); + code = SelectPackage(interp, name, pkgPtr, reqc, reqv); + if (code != TCL_OK) { + return code; + } + } + } + + if (pkgPtr->version == NULL) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "can't find package %s", name)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNFOUND", NULL); + AddRequirementsToResult(interp, reqc, reqv); + return TCL_ERROR; + } + /* - * It can take up to three passes to find the package: one pass to run the - * "package unknown" script, one to run the "package ifneeded" script for - * a specific version, and a final pass to lookup the package loaded by - * the "package ifneeded" script. + * Ensure that the provided version meets the current requirements. */ - for (pass=1 ;; pass++) { - pkgPtr = FindPackage(interp, name); - if (pkgPtr->version != NULL) { - break; - } + if (reqc != 0) { + CheckVersionAndConvert(interp, pkgPtr->version, &pkgVersionI, NULL); + satisfies = SomeRequirementSatisfied(pkgVersionI, reqc, reqv); - /* - * Check whether we're already attempting to load some version of this - * package (circular dependency detection). - */ + ckfree(pkgVersionI); - if (pkgPtr->clientData != NULL) { + if (!satisfies) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "circular package dependency:" - " attempt to provide %s %s requires %s", - name, (char *) pkgPtr->clientData, name)); + "version conflict for package \"%s\": have %s, need", + name, pkgPtr->version)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "VERSIONCONFLICT", + NULL); AddRequirementsToResult(interp, reqc, reqv); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "CIRCULARITY", NULL); return TCL_ERROR; } + } - /* - * The package isn't yet present. Search the list of available - * versions and invoke the script for the best available version. We - * are actually locating the best, and the best stable version. One of - * them is then chosen based on the selection mode. - */ - - bestPtr = NULL; - bestStablePtr = NULL; - bestVersion = NULL; - bestStableVersion = NULL; + if (clientDataPtr) { + const void **ptr = (const void **) clientDataPtr; - for (availPtr = pkgPtr->availPtr; availPtr != NULL; - availPtr = availPtr->nextPtr) { - if (CheckVersionAndConvert(interp, availPtr->version, - &availVersion, &availStable) != TCL_OK) { - /* - * The provided version number has invalid syntax. This - * should not happen. This should have been caught by the - * 'package ifneeded' registering the package. - */ + *ptr = pkgPtr->clientData; + } + Tcl_SetObjResult(interp, Tcl_NewStringObj(pkgPtr->version, -1)); + return TCL_OK; +} + +int SelectPackage (Tcl_Interp *interp, const char *name, Package *pkgPtr, int reqc, Tcl_Obj *const reqv[]) { + PkgAvail *availPtr, *bestPtr, *bestStablePtr; + char *availVersion, *bestVersion, *bestStableVersion; + /* Internal rep. of versions */ + char *script; + int availStable, code, satisfies; + Interp *iPtr = (Interp *) interp; - continue; - } + /* + * Check whether we're already attempting to load some version of this + * package (circular dependency detection). + */ - /* Check satisfaction of requirements before considering the current version further. */ - if (reqc > 0) { - satisfies = SomeRequirementSatisfied(availVersion, reqc, reqv); - if (!satisfies) { - ckfree(availVersion); - availVersion = NULL; - continue; - } - } + if (pkgPtr->clientData != NULL) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "circular package dependency:" + " attempt to provide %s %s requires %s", + name, (char *) pkgPtr->clientData, name)); + AddRequirementsToResult(interp, reqc, reqv); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "CIRCULARITY", NULL); + return TCL_ERROR; + } - if (bestPtr != NULL) { - int res = CompareVersions(availVersion, bestVersion, NULL); + /* + * The package isn't yet present. Search the list of available + * versions and invoke the script for the best available version. We + * are actually locating the best, and the best stable version. One of + * them is then chosen based on the selection mode. + */ - /* - * Note: Used internal reps in the comparison! - */ + bestPtr = NULL; + bestStablePtr = NULL; + bestVersion = NULL; + bestStableVersion = NULL; - if (res > 0) { - /* - * The version of the package sought is better than the - * currently selected version. - */ - ckfree(bestVersion); - bestVersion = NULL; - goto newbest; - } - } else { - newbest: - /* We have found a version which is better than our max. */ + for (availPtr = pkgPtr->availPtr; availPtr != NULL; + availPtr = availPtr->nextPtr) { + if (CheckVersionAndConvert(interp, availPtr->version, + &availVersion, &availStable) != TCL_OK) { + /* + * The provided version number has invalid syntax. This + * should not happen. This should have been caught by the + * 'package ifneeded' registering the package. + */ - bestPtr = availPtr; - CheckVersionAndConvert(interp, bestPtr->version, &bestVersion, NULL); - } + continue; + } - if (!availStable) { + /* Check satisfaction of requirements before considering the current version further. */ + if (reqc > 0) { + satisfies = SomeRequirementSatisfied(availVersion, reqc, reqv); + if (!satisfies) { ckfree(availVersion); availVersion = NULL; continue; } + } - if (bestStablePtr != NULL) { - int res = CompareVersions(availVersion, bestStableVersion, NULL); + if (bestPtr != NULL) { + int res = CompareVersions(availVersion, bestVersion, NULL); + + /* + * Note: Used internal reps in the comparison! + */ + if (res > 0) { /* - * Note: Used internal reps in the comparison! + * The version of the package sought is better than the + * currently selected version. */ - - if (res > 0) { - /* - * This stable version of the package sought is better - * than the currently selected stable version. - */ - ckfree(bestStableVersion); - bestStableVersion = NULL; - goto newstable; - } - } else { - newstable: - /* We have found a stable version which is better than our max stable. */ - bestStablePtr = availPtr; - CheckVersionAndConvert(interp, bestStablePtr->version, &bestStableVersion, NULL); + ckfree(bestVersion); + bestVersion = NULL; + goto newbest; } + } else { + newbest: + /* We have found a version which is better than our max. */ - ckfree(availVersion); - availVersion = NULL; - } /* end for */ - - /* - * Clean up memorized internal reps, if any. - */ - - if (bestVersion != NULL) { - ckfree(bestVersion); - bestVersion = NULL; + bestPtr = availPtr; + CheckVersionAndConvert(interp, bestPtr->version, &bestVersion, NULL); } - if (bestStableVersion != NULL) { - ckfree(bestStableVersion); - bestStableVersion = NULL; + if (!availStable) { + ckfree(availVersion); + availVersion = NULL; + continue; } - /* - * Now choose a version among the two best. For 'latest' we simply - * take (actually keep) the best. For 'stable' we take the best - * stable, if there is any, or the best if there is nothing stable. - */ - - if ((iPtr->packagePrefer == PKG_PREFER_STABLE) - && (bestStablePtr != NULL)) { - bestPtr = bestStablePtr; - } + if (bestStablePtr != NULL) { + int res = CompareVersions(availVersion, bestStableVersion, NULL); - if (bestPtr != NULL) { /* - * We found an ifneeded script for the package. Be careful while - * executing it: this could cause reentrancy, so (a) protect the - * script itself from deletion and (b) don't assume that bestPtr - * will still exist when the script completes. + * Note: Used internal reps in the comparison! */ - char *versionToProvide = bestPtr->version; - PkgFiles *pkgFiles; - PkgName *pkgName; - script = bestPtr->script; - - pkgPtr->clientData = versionToProvide; - Tcl_Preserve(versionToProvide); - Tcl_Preserve(script); - pkgFiles = TclInitPkgFiles(interp); - /* Push "ifneeded" package name in "tclPkgFiles" assocdata. */ - pkgName = ckalloc(sizeof(PkgName) + strlen(name)); - pkgName->nextPtr = pkgFiles->names; - strcpy(pkgName->name, name); - pkgFiles->names = pkgName; - if (bestPtr->pkgIndex) { - TclPkgFileSeen(interp, bestPtr->pkgIndex); - } - code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); - /* Pop the "ifneeded" package name from "tclPkgFiles" assocdata*/ - pkgFiles->names = pkgName->nextPtr; - ckfree(pkgName); - Tcl_Release(script); - - pkgPtr = FindPackage(interp, name); - if (code == TCL_OK) { - Tcl_ResetResult(interp); - if (pkgPtr->version == NULL) { - code = TCL_ERROR; - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "attempt to provide package %s %s failed:" - " no version of package %s provided", - name, versionToProvide, name)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNPROVIDED", - NULL); - } else { - char *pvi, *vi; - - if (CheckVersionAndConvert(interp, pkgPtr->version, &pvi, - NULL) != TCL_OK) { - code = TCL_ERROR; - } else if (CheckVersionAndConvert(interp, - versionToProvide, &vi, NULL) != TCL_OK) { - ckfree(pvi); - code = TCL_ERROR; - } else { - int res = CompareVersions(pvi, vi, NULL); - - ckfree(pvi); - ckfree(vi); - if (res != 0) { - code = TCL_ERROR; - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "attempt to provide package %s %s failed:" - " package %s %s provided instead", - name, versionToProvide, - name, pkgPtr->version)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", - "WRONGPROVIDE", NULL); - } - } - } - } else if (code != TCL_ERROR) { - Tcl_Obj *codePtr = Tcl_NewIntObj(code); - - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "attempt to provide package %s %s failed:" - " bad return code: %s", - name, versionToProvide, TclGetString(codePtr))); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); - TclDecrRefCount(codePtr); - code = TCL_ERROR; - } - - if (code == TCL_ERROR) { - Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( - "\n (\"package ifneeded %s %s\" script)", - name, versionToProvide)); - } - Tcl_Release(versionToProvide); - - if (code != TCL_OK) { + if (res > 0) { /* - * Take a non-TCL_OK code from the script as an indication the - * package wasn't loaded properly, so the package system - * should not remember an improper load. - * - * This is consistent with our returning NULL. If we're not - * willing to tell our caller we got a particular version, we - * shouldn't store that version for telling future callers - * either. + * This stable version of the package sought is better + * than the currently selected stable version. */ - - if (pkgPtr->version != NULL) { - ckfree(pkgPtr->version); - pkgPtr->version = NULL; - } - pkgPtr->clientData = NULL; - return code; + ckfree(bestStableVersion); + bestStableVersion = NULL; + goto newstable; } - - break; - } - - /* - * The package is not in the database. If there is a "package unknown" - * command, invoke it (but only on the first pass; after that, we - * should not get here in the first place). - */ - - if (pass > 1) { - break; + } else { + newstable: + /* We have found a stable version which is better than our max stable. */ + bestStablePtr = availPtr; + CheckVersionAndConvert(interp, bestStablePtr->version, &bestStableVersion, NULL); } - script = ((Interp *) interp)->packageUnknown; - if (script != NULL) { - Tcl_DStringInit(&command); - Tcl_DStringAppend(&command, script, -1); - Tcl_DStringAppendElement(&command, name); - AddRequirementsToDString(&command, reqc, reqv); + ckfree(availVersion); + availVersion = NULL; + } /* end for */ - code = Tcl_EvalEx(interp, Tcl_DStringValue(&command), - Tcl_DStringLength(&command), TCL_EVAL_GLOBAL); - Tcl_DStringFree(&command); + /* + * Clean up memorized internal reps, if any. + */ - if ((code != TCL_OK) && (code != TCL_ERROR)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad return code: %d", code)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); - code = TCL_ERROR; - } - if (code == TCL_ERROR) { - Tcl_AddErrorInfo(interp, - "\n (\"package unknown\" script)"); - return code; - } - Tcl_ResetResult(interp); - } + if (bestVersion != NULL) { + ckfree(bestVersion); + bestVersion = NULL; } - if (pkgPtr->version == NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't find package %s", name)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNFOUND", NULL); - AddRequirementsToResult(interp, reqc, reqv); - return TCL_ERROR; + if (bestStableVersion != NULL) { + ckfree(bestStableVersion); + bestStableVersion = NULL; } /* - * At this point we know that the package is present. Make sure that the - * provided version meets the current requirements. + * Now choose a version among the two best. For 'latest' we simply + * take (actually keep) the best. For 'stable' we take the best + * stable, if there is any, or the best if there is nothing stable. */ - if (reqc != 0) { - CheckVersionAndConvert(interp, pkgPtr->version, &pkgVersionI, NULL); - satisfies = SomeRequirementSatisfied(pkgVersionI, reqc, reqv); + if ((iPtr->packagePrefer == PKG_PREFER_STABLE) + && (bestStablePtr != NULL)) { + bestPtr = bestStablePtr; + } - ckfree(pkgVersionI); + if (bestPtr != NULL) { + /* + * We found an ifneeded script for the package. Be careful while + * executing it: this could cause reentrancy, so (a) protect the + * script itself from deletion and (b) don't assume that bestPtr + * will still exist when the script completes. + */ + + char *versionToProvide = bestPtr->version; + PkgFiles *pkgFiles; + PkgName *pkgName; + script = bestPtr->script; + + pkgPtr->clientData = versionToProvide; + Tcl_Preserve(versionToProvide); + Tcl_Preserve(script); + pkgFiles = TclInitPkgFiles(interp); + /* Push "ifneeded" package name in "tclPkgFiles" assocdata. */ + pkgName = ckalloc(sizeof(PkgName) + strlen(name)); + pkgName->nextPtr = pkgFiles->names; + strcpy(pkgName->name, name); + pkgFiles->names = pkgName; + if (bestPtr->pkgIndex) { + TclPkgFileSeen(interp, bestPtr->pkgIndex); + } + code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); + /* Pop the "ifneeded" package name from "tclPkgFiles" assocdata*/ + pkgFiles->names = pkgName->nextPtr; + ckfree(pkgName); + Tcl_Release(script); + + pkgPtr = FindPackage(interp, name); + if (code == TCL_OK) { + Tcl_ResetResult(interp); + if (pkgPtr->version == NULL) { + code = TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "attempt to provide package %s %s failed:" + " no version of package %s provided", + name, versionToProvide, name)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNPROVIDED", + NULL); + } else { + char *pvi, *vi; + + if (CheckVersionAndConvert(interp, pkgPtr->version, &pvi, + NULL) != TCL_OK) { + code = TCL_ERROR; + } else if (CheckVersionAndConvert(interp, + versionToProvide, &vi, NULL) != TCL_OK) { + ckfree(pvi); + code = TCL_ERROR; + } else { + int res = CompareVersions(pvi, vi, NULL); + + ckfree(pvi); + ckfree(vi); + if (res != 0) { + code = TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "attempt to provide package %s %s failed:" + " package %s %s provided instead", + name, versionToProvide, + name, pkgPtr->version)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", + "WRONGPROVIDE", NULL); + } + } + } + } else if (code != TCL_ERROR) { + Tcl_Obj *codePtr = Tcl_NewIntObj(code); - if (!satisfies) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "version conflict for package \"%s\": have %s, need", - name, pkgPtr->version)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "VERSIONCONFLICT", - NULL); - AddRequirementsToResult(interp, reqc, reqv); - return TCL_ERROR; + "attempt to provide package %s %s failed:" + " bad return code: %s", + name, versionToProvide, TclGetString(codePtr))); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); + TclDecrRefCount(codePtr); + code = TCL_ERROR; } - } - if (clientDataPtr) { - const void **ptr = (const void **) clientDataPtr; + if (code == TCL_ERROR) { + Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( + "\n (\"package ifneeded %s %s\" script)", + name, versionToProvide)); + } + Tcl_Release(versionToProvide); - *ptr = pkgPtr->clientData; + if (code != TCL_OK) { + /* + * Take a non-TCL_OK code from the script as an indication the + * package wasn't loaded properly, so the package system + * should not remember an improper load. + * + * This is consistent with our returning NULL. If we're not + * willing to tell our caller we got a particular version, we + * shouldn't store that version for telling future callers + * either. + */ + + if (pkgPtr->version != NULL) { + ckfree(pkgPtr->version); + pkgPtr->version = NULL; + } + pkgPtr->clientData = NULL; + return code; + } } - Tcl_SetObjResult(interp, Tcl_NewStringObj(pkgPtr->version, -1)); return TCL_OK; } -- cgit v0.12 From 77821adfe89e6c3507ef12250dec40cf04ff8a0e Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 31 Jan 2018 00:07:22 +0000 Subject: Fix segmentation fault triggered by test package-3.12. Adapt signature of PkgRequireCore to conform to Tcl_ObjCmdProc, and call it in Tcl_PkgRequireProc on an NRE trampoline via Tcl_NRCallObjProc. Additional callbacks still needed to fully NRE-enable [package require]. --- generic/tclInt.h | 1 + generic/tclPkg.c | 83 ++++++++++++++++++++++++++++++++------------------------ 2 files changed, 49 insertions(+), 35 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index a3bd8ba..20d340e 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2782,6 +2782,7 @@ MODULE_SCOPE Tcl_ObjCmdProc TclNRForObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRForeachCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRIfObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRLmapCmd; +MODULE_SCOPE Tcl_ObjCmdProc TclNRPackageObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRSourceObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRSubstObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRSwitchObjCmd; diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 02f66f0..ce00fbf 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -65,6 +65,12 @@ typedef struct Package { const void *clientData; /* Client data. */ } Package; +typedef struct Require { + void * clientDataPtr; + const char *name; + Package *pkgPtr; +} Require; + /* * Prototypes for functions defined in this file: */ @@ -85,11 +91,10 @@ static void AddRequirementsToResult(Tcl_Interp *interp, int reqc, static void AddRequirementsToDString(Tcl_DString *dstring, int reqc, Tcl_Obj *const reqv[]); static Package * FindPackage(Tcl_Interp *interp, const char *name); -static int PkgRequireCore(Tcl_Interp *interp, const char *name, - int reqc, Tcl_Obj *const reqv[], - void *clientDataPtr); -static int SelectPackage (Tcl_Interp *interp, const char *name, - Package *pkgPtr, int reqc, Tcl_Obj *const reqv[]); +static int PkgRequireCore(ClientData clientData, Tcl_Interp *interp, + int reqc, Tcl_Obj *const reqv[]); +static int SelectPackage (Tcl_Interp *interp, Require *reqPtr, + int reqc, Tcl_Obj *const reqv[]); /* * Helper macros. @@ -402,35 +407,41 @@ Tcl_PkgRequireProc( void *clientDataPtr) { int code = CheckAllRequirements(interp, reqc, reqv); + Require require; if (code != TCL_OK) { return code; } - return PkgRequireCore(interp, name, reqc, reqv, clientDataPtr); + require.clientDataPtr = clientDataPtr; + require.name = name; + require.pkgPtr = NULL; + return Tcl_NRCallObjProc(interp, PkgRequireCore, &require, reqc, reqv); } int PkgRequireCore( + ClientData clientData, Tcl_Interp *interp, /* Interpreter in which package is now * available. */ - const char *name, /* Name of desired package. */ int reqc, /* Requirements constraining the desired * version. */ - Tcl_Obj *const reqv[], /* 0 means to use the latest version + Tcl_Obj *const reqv[] /* 0 means to use the latest version * available. */ - void *clientDataPtr) + ) { - Package *pkgPtr; int code, satisfies; - char *script, *pkgVersionI; Tcl_DString command; + Require *reqPtr = clientData; + char *script, *pkgVersionI; + const char *name = reqPtr->name /* Name of desired package. */; + void *clientDataPtr = reqPtr->clientDataPtr; - pkgPtr = FindPackage(interp, name); - if (pkgPtr->version == NULL) { - code = SelectPackage(interp, name, pkgPtr, reqc, reqv); + reqPtr->pkgPtr = FindPackage(interp, name); + if (reqPtr->pkgPtr->version == NULL) { + code = SelectPackage(interp, reqPtr, reqc, reqv); if (code != TCL_OK) { return code; } - if (pkgPtr->version == NULL) { + if (reqPtr->pkgPtr->version == NULL) { /* * The package is not in the database. If there is a "package unknown" * command, invoke it. @@ -459,17 +470,17 @@ PkgRequireCore( return code; } Tcl_ResetResult(interp); - } - /* pkgPtr may now be invalid, so refresh it. */ - pkgPtr = FindPackage(interp, name); - code = SelectPackage(interp, name, pkgPtr, reqc, reqv); - if (code != TCL_OK) { - return code; + /* pkgPtr may now be invalid, so refresh it. */ + reqPtr->pkgPtr = FindPackage(interp, name); + code = SelectPackage(interp, reqPtr, reqc, reqv); + if (code != TCL_OK) { + return code; + } } } } - if (pkgPtr->version == NULL) { + if (reqPtr->pkgPtr->version == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't find package %s", name)); Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNFOUND", NULL); @@ -482,7 +493,7 @@ PkgRequireCore( */ if (reqc != 0) { - CheckVersionAndConvert(interp, pkgPtr->version, &pkgVersionI, NULL); + CheckVersionAndConvert(interp, reqPtr->pkgPtr->version, &pkgVersionI, NULL); satisfies = SomeRequirementSatisfied(pkgVersionI, reqc, reqv); ckfree(pkgVersionI); @@ -490,7 +501,7 @@ PkgRequireCore( if (!satisfies) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "version conflict for package \"%s\": have %s, need", - name, pkgPtr->version)); + name, reqPtr->pkgPtr->version)); Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "VERSIONCONFLICT", NULL); AddRequirementsToResult(interp, reqc, reqv); @@ -501,18 +512,20 @@ PkgRequireCore( if (clientDataPtr) { const void **ptr = (const void **) clientDataPtr; - *ptr = pkgPtr->clientData; + *ptr = reqPtr->pkgPtr->clientData; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(pkgPtr->version, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(reqPtr->pkgPtr->version, -1)); return TCL_OK; } -int SelectPackage (Tcl_Interp *interp, const char *name, Package *pkgPtr, int reqc, Tcl_Obj *const reqv[]) { +int SelectPackage (Tcl_Interp *interp, Require *reqPtr, int reqc, Tcl_Obj *const reqv[]) { PkgAvail *availPtr, *bestPtr, *bestStablePtr; char *availVersion, *bestVersion, *bestStableVersion; /* Internal rep. of versions */ char *script; int availStable, code, satisfies; + const char *name = reqPtr->name; + Package *pkgPtr = reqPtr->pkgPtr; Interp *iPtr = (Interp *) interp; /* @@ -678,10 +691,10 @@ int SelectPackage (Tcl_Interp *interp, const char *name, Package *pkgPtr, int re ckfree(pkgName); Tcl_Release(script); - pkgPtr = FindPackage(interp, name); + reqPtr->pkgPtr = FindPackage(interp, name); if (code == TCL_OK) { Tcl_ResetResult(interp); - if (pkgPtr->version == NULL) { + if (reqPtr->pkgPtr->version == NULL) { code = TCL_ERROR; Tcl_SetObjResult(interp, Tcl_ObjPrintf( "attempt to provide package %s %s failed:" @@ -692,7 +705,7 @@ int SelectPackage (Tcl_Interp *interp, const char *name, Package *pkgPtr, int re } else { char *pvi, *vi; - if (CheckVersionAndConvert(interp, pkgPtr->version, &pvi, + if (CheckVersionAndConvert(interp, reqPtr->pkgPtr->version, &pvi, NULL) != TCL_OK) { code = TCL_ERROR; } else if (CheckVersionAndConvert(interp, @@ -710,7 +723,7 @@ int SelectPackage (Tcl_Interp *interp, const char *name, Package *pkgPtr, int re "attempt to provide package %s %s failed:" " package %s %s provided instead", name, versionToProvide, - name, pkgPtr->version)); + name, reqPtr->pkgPtr->version)); Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "WRONGPROVIDE", NULL); } @@ -747,11 +760,11 @@ int SelectPackage (Tcl_Interp *interp, const char *name, Package *pkgPtr, int re * either. */ - if (pkgPtr->version != NULL) { - ckfree(pkgPtr->version); - pkgPtr->version = NULL; + if (reqPtr->pkgPtr->version != NULL) { + ckfree(reqPtr->pkgPtr->version); + reqPtr->pkgPtr->version = NULL; } - pkgPtr->clientData = NULL; + reqPtr->pkgPtr->clientData = NULL; return code; } } -- cgit v0.12 From adf9cf554379da013088a310e2d9d4d8c8adec87 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Fri, 2 Feb 2018 06:07:26 +0000 Subject: Fixed def for INCLUDE_INSTALL_DIR when building against Tcl source. Bumped to 1.2. --- win/rules.vc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/win/rules.vc b/win/rules.vc index 543e959..8db4752 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -24,7 +24,7 @@ _RULES_VC = 1 # For modifications that are not backward-compatible, you *must* change # the major version. RULES_VERSION_MAJOR = 1 -RULES_VERSION_MINOR = 1 +RULES_VERSION_MINOR = 2 # The PROJECT macro must be defined by parent makefile. !if "$(PROJECT)" == "" @@ -393,7 +393,7 @@ MSG = ^ !endif -# If INSTALLDIR set to tcl installation root dir then reset to the +# If INSTALLDIR set to Tcl installation root dir then reset to the # lib dir for installing extensions !if exist("$(_INSTALLDIR)\include\tcl.h") _INSTALLDIR=$(_INSTALLDIR)\lib @@ -1209,7 +1209,7 @@ RESFILE = $(TMP_DIR)\$(PROJECT).res # SCRIPT_INSTALL_DIR - where scripts should be installed # INCLUDE_INSTALL_DIR - where C include files should be installed # DEMO_INSTALL_DIR - where demos should be installed -# PRJ_INSTALL_DIR - where package will be installed (not set for tcl and tk) +# PRJ_INSTALL_DIR - where package will be installed (not set for Tcl and Tk) !if $(DOING_TCL) || $(DOING_TK) LIB_INSTALL_DIR = $(_INSTALLDIR)\lib @@ -1231,7 +1231,7 @@ BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR) DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR) SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR) DEMO_INSTALL_DIR = $(PRJ_INSTALL_DIR)\demos -INCLUDE_INSTALL_DIR = $(_TCLDIR)\include +INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\..\include !endif -- cgit v0.12 From b618278c9fbbc7d48c2005ea9e71afd05425aa32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ignacio=20Mar=C3=ADn?= Date: Fri, 2 Feb 2018 09:19:41 +0000 Subject: Update TZ info to tzdata2018c. --- library/tzdata/Africa/Sao_Tome | 9 +- library/tzdata/America/Campo_Grande | 164 ++++++++++++++++++------------------ library/tzdata/America/Cuiaba | 164 ++++++++++++++++++------------------ library/tzdata/America/La_Paz | 2 +- library/tzdata/America/Sao_Paulo | 164 ++++++++++++++++++------------------ library/tzdata/Asia/Tokyo | 16 ++-- 6 files changed, 261 insertions(+), 258 deletions(-) diff --git a/library/tzdata/Africa/Sao_Tome b/library/tzdata/Africa/Sao_Tome index 078591d..fe08d89 100644 --- a/library/tzdata/Africa/Sao_Tome +++ b/library/tzdata/Africa/Sao_Tome @@ -1,5 +1,8 @@ # created by tools/tclZIC.tcl - do not edit -if {![info exists TZData(Africa/Abidjan)]} { - LoadTimeZoneFile Africa/Abidjan + +set TZData(:Africa/Sao_Tome) { + {-9223372036854775808 1616 0 LMT} + {-2713912016 -2205 0 LMT} + {-1830381795 0 0 GMT} + {1514768400 3600 0 WAT} } -set TZData(:Africa/Sao_Tome) $TZData(:Africa/Abidjan) diff --git a/library/tzdata/America/Campo_Grande b/library/tzdata/America/Campo_Grande index 77cb4d1..f8bfb67 100644 --- a/library/tzdata/America/Campo_Grande +++ b/library/tzdata/America/Campo_Grande @@ -91,167 +91,167 @@ set TZData(:America/Campo_Grande) { {1487473200 -14400 0 -04} {1508040000 -10800 1 -03} {1518922800 -14400 0 -04} - {1540094400 -10800 1 -03} + {1541304000 -10800 1 -03} {1550372400 -14400 0 -04} - {1571544000 -10800 1 -03} + {1572753600 -10800 1 -03} {1581822000 -14400 0 -04} - {1602993600 -10800 1 -03} + {1604203200 -10800 1 -03} {1613876400 -14400 0 -04} - {1634443200 -10800 1 -03} + {1636257600 -10800 1 -03} {1645326000 -14400 0 -04} - {1665892800 -10800 1 -03} + {1667707200 -10800 1 -03} {1677380400 -14400 0 -04} - {1697342400 -10800 1 -03} + {1699156800 -10800 1 -03} {1708225200 -14400 0 -04} - {1729396800 -10800 1 -03} + {1730606400 -10800 1 -03} {1739674800 -14400 0 -04} - {1760846400 -10800 1 -03} + {1762056000 -10800 1 -03} {1771729200 -14400 0 -04} - {1792296000 -10800 1 -03} + {1793505600 -10800 1 -03} {1803178800 -14400 0 -04} - {1823745600 -10800 1 -03} + {1825560000 -10800 1 -03} {1834628400 -14400 0 -04} - {1855195200 -10800 1 -03} + {1857009600 -10800 1 -03} {1866078000 -14400 0 -04} - {1887249600 -10800 1 -03} + {1888459200 -10800 1 -03} {1897527600 -14400 0 -04} - {1918699200 -10800 1 -03} + {1919908800 -10800 1 -03} {1928977200 -14400 0 -04} - {1950148800 -10800 1 -03} + {1951358400 -10800 1 -03} {1960426800 -14400 0 -04} - {1981598400 -10800 1 -03} + {1983412800 -10800 1 -03} {1992481200 -14400 0 -04} - {2013048000 -10800 1 -03} + {2014862400 -10800 1 -03} {2024535600 -14400 0 -04} - {2044497600 -10800 1 -03} + {2046312000 -10800 1 -03} {2055380400 -14400 0 -04} - {2076552000 -10800 1 -03} + {2077761600 -10800 1 -03} {2086830000 -14400 0 -04} - {2108001600 -10800 1 -03} + {2109211200 -10800 1 -03} {2118884400 -14400 0 -04} - {2139451200 -10800 1 -03} + {2140660800 -10800 1 -03} {2150334000 -14400 0 -04} - {2170900800 -10800 1 -03} + {2172715200 -10800 1 -03} {2181783600 -14400 0 -04} - {2202350400 -10800 1 -03} + {2204164800 -10800 1 -03} {2213233200 -14400 0 -04} - {2234404800 -10800 1 -03} + {2235614400 -10800 1 -03} {2244682800 -14400 0 -04} - {2265854400 -10800 1 -03} + {2267064000 -10800 1 -03} {2276132400 -14400 0 -04} - {2297304000 -10800 1 -03} + {2298513600 -10800 1 -03} {2307582000 -14400 0 -04} - {2328753600 -10800 1 -03} + {2329963200 -10800 1 -03} {2339636400 -14400 0 -04} - {2360203200 -10800 1 -03} + {2362017600 -10800 1 -03} {2371086000 -14400 0 -04} - {2391652800 -10800 1 -03} + {2393467200 -10800 1 -03} {2402535600 -14400 0 -04} - {2423707200 -10800 1 -03} + {2424916800 -10800 1 -03} {2433985200 -14400 0 -04} - {2455156800 -10800 1 -03} + {2456366400 -10800 1 -03} {2465434800 -14400 0 -04} - {2486606400 -10800 1 -03} + {2487816000 -10800 1 -03} {2497489200 -14400 0 -04} - {2518056000 -10800 1 -03} + {2519870400 -10800 1 -03} {2528938800 -14400 0 -04} - {2549505600 -10800 1 -03} + {2551320000 -10800 1 -03} {2560388400 -14400 0 -04} - {2580955200 -10800 1 -03} + {2582769600 -10800 1 -03} {2591838000 -14400 0 -04} - {2613009600 -10800 1 -03} + {2614219200 -10800 1 -03} {2623287600 -14400 0 -04} - {2644459200 -10800 1 -03} + {2645668800 -10800 1 -03} {2654737200 -14400 0 -04} - {2675908800 -10800 1 -03} + {2677118400 -10800 1 -03} {2686791600 -14400 0 -04} - {2707358400 -10800 1 -03} + {2709172800 -10800 1 -03} {2718241200 -14400 0 -04} - {2738808000 -10800 1 -03} + {2740622400 -10800 1 -03} {2749690800 -14400 0 -04} - {2770862400 -10800 1 -03} + {2772072000 -10800 1 -03} {2781140400 -14400 0 -04} - {2802312000 -10800 1 -03} + {2803521600 -10800 1 -03} {2812590000 -14400 0 -04} - {2833761600 -10800 1 -03} + {2834971200 -10800 1 -03} {2844039600 -14400 0 -04} - {2865211200 -10800 1 -03} + {2867025600 -10800 1 -03} {2876094000 -14400 0 -04} - {2896660800 -10800 1 -03} + {2898475200 -10800 1 -03} {2907543600 -14400 0 -04} - {2928110400 -10800 1 -03} + {2929924800 -10800 1 -03} {2938993200 -14400 0 -04} - {2960164800 -10800 1 -03} + {2961374400 -10800 1 -03} {2970442800 -14400 0 -04} - {2991614400 -10800 1 -03} + {2992824000 -10800 1 -03} {3001892400 -14400 0 -04} - {3023064000 -10800 1 -03} + {3024273600 -10800 1 -03} {3033946800 -14400 0 -04} - {3054513600 -10800 1 -03} + {3056328000 -10800 1 -03} {3065396400 -14400 0 -04} - {3085963200 -10800 1 -03} + {3087777600 -10800 1 -03} {3096846000 -14400 0 -04} - {3118017600 -10800 1 -03} + {3119227200 -10800 1 -03} {3128295600 -14400 0 -04} - {3149467200 -10800 1 -03} + {3150676800 -10800 1 -03} {3159745200 -14400 0 -04} - {3180916800 -10800 1 -03} + {3182126400 -10800 1 -03} {3191194800 -14400 0 -04} - {3212366400 -10800 1 -03} + {3213576000 -10800 1 -03} {3223249200 -14400 0 -04} - {3243816000 -10800 1 -03} + {3245630400 -10800 1 -03} {3254698800 -14400 0 -04} - {3275265600 -10800 1 -03} + {3277080000 -10800 1 -03} {3286148400 -14400 0 -04} - {3307320000 -10800 1 -03} + {3308529600 -10800 1 -03} {3317598000 -14400 0 -04} - {3338769600 -10800 1 -03} + {3339979200 -10800 1 -03} {3349047600 -14400 0 -04} - {3370219200 -10800 1 -03} + {3371428800 -10800 1 -03} {3381102000 -14400 0 -04} - {3401668800 -10800 1 -03} + {3403483200 -10800 1 -03} {3412551600 -14400 0 -04} - {3433118400 -10800 1 -03} + {3434932800 -10800 1 -03} {3444001200 -14400 0 -04} - {3464568000 -10800 1 -03} + {3466382400 -10800 1 -03} {3475450800 -14400 0 -04} - {3496622400 -10800 1 -03} + {3497832000 -10800 1 -03} {3506900400 -14400 0 -04} - {3528072000 -10800 1 -03} + {3529281600 -10800 1 -03} {3538350000 -14400 0 -04} - {3559521600 -10800 1 -03} + {3560731200 -10800 1 -03} {3570404400 -14400 0 -04} - {3590971200 -10800 1 -03} + {3592785600 -10800 1 -03} {3601854000 -14400 0 -04} - {3622420800 -10800 1 -03} + {3624235200 -10800 1 -03} {3633303600 -14400 0 -04} - {3654475200 -10800 1 -03} + {3655684800 -10800 1 -03} {3664753200 -14400 0 -04} - {3685924800 -10800 1 -03} + {3687134400 -10800 1 -03} {3696202800 -14400 0 -04} - {3717374400 -10800 1 -03} + {3718584000 -10800 1 -03} {3727652400 -14400 0 -04} - {3748824000 -10800 1 -03} + {3750638400 -10800 1 -03} {3759706800 -14400 0 -04} - {3780273600 -10800 1 -03} + {3782088000 -10800 1 -03} {3791156400 -14400 0 -04} - {3811723200 -10800 1 -03} + {3813537600 -10800 1 -03} {3822606000 -14400 0 -04} - {3843777600 -10800 1 -03} + {3844987200 -10800 1 -03} {3854055600 -14400 0 -04} - {3875227200 -10800 1 -03} + {3876436800 -10800 1 -03} {3885505200 -14400 0 -04} - {3906676800 -10800 1 -03} + {3907886400 -10800 1 -03} {3917559600 -14400 0 -04} - {3938126400 -10800 1 -03} + {3939940800 -10800 1 -03} {3949009200 -14400 0 -04} - {3969576000 -10800 1 -03} + {3971390400 -10800 1 -03} {3980458800 -14400 0 -04} - {4001630400 -10800 1 -03} + {4002840000 -10800 1 -03} {4011908400 -14400 0 -04} - {4033080000 -10800 1 -03} + {4034289600 -10800 1 -03} {4043358000 -14400 0 -04} - {4064529600 -10800 1 -03} + {4065739200 -10800 1 -03} {4074807600 -14400 0 -04} - {4095979200 -10800 1 -03} + {4097188800 -10800 1 -03} } diff --git a/library/tzdata/America/Cuiaba b/library/tzdata/America/Cuiaba index 57cd38c..69acddb 100644 --- a/library/tzdata/America/Cuiaba +++ b/library/tzdata/America/Cuiaba @@ -91,167 +91,167 @@ set TZData(:America/Cuiaba) { {1487473200 -14400 0 -04} {1508040000 -10800 1 -03} {1518922800 -14400 0 -04} - {1540094400 -10800 1 -03} + {1541304000 -10800 1 -03} {1550372400 -14400 0 -04} - {1571544000 -10800 1 -03} + {1572753600 -10800 1 -03} {1581822000 -14400 0 -04} - {1602993600 -10800 1 -03} + {1604203200 -10800 1 -03} {1613876400 -14400 0 -04} - {1634443200 -10800 1 -03} + {1636257600 -10800 1 -03} {1645326000 -14400 0 -04} - {1665892800 -10800 1 -03} + {1667707200 -10800 1 -03} {1677380400 -14400 0 -04} - {1697342400 -10800 1 -03} + {1699156800 -10800 1 -03} {1708225200 -14400 0 -04} - {1729396800 -10800 1 -03} + {1730606400 -10800 1 -03} {1739674800 -14400 0 -04} - {1760846400 -10800 1 -03} + {1762056000 -10800 1 -03} {1771729200 -14400 0 -04} - {1792296000 -10800 1 -03} + {1793505600 -10800 1 -03} {1803178800 -14400 0 -04} - {1823745600 -10800 1 -03} + {1825560000 -10800 1 -03} {1834628400 -14400 0 -04} - {1855195200 -10800 1 -03} + {1857009600 -10800 1 -03} {1866078000 -14400 0 -04} - {1887249600 -10800 1 -03} + {1888459200 -10800 1 -03} {1897527600 -14400 0 -04} - {1918699200 -10800 1 -03} + {1919908800 -10800 1 -03} {1928977200 -14400 0 -04} - {1950148800 -10800 1 -03} + {1951358400 -10800 1 -03} {1960426800 -14400 0 -04} - {1981598400 -10800 1 -03} + {1983412800 -10800 1 -03} {1992481200 -14400 0 -04} - {2013048000 -10800 1 -03} + {2014862400 -10800 1 -03} {2024535600 -14400 0 -04} - {2044497600 -10800 1 -03} + {2046312000 -10800 1 -03} {2055380400 -14400 0 -04} - {2076552000 -10800 1 -03} + {2077761600 -10800 1 -03} {2086830000 -14400 0 -04} - {2108001600 -10800 1 -03} + {2109211200 -10800 1 -03} {2118884400 -14400 0 -04} - {2139451200 -10800 1 -03} + {2140660800 -10800 1 -03} {2150334000 -14400 0 -04} - {2170900800 -10800 1 -03} + {2172715200 -10800 1 -03} {2181783600 -14400 0 -04} - {2202350400 -10800 1 -03} + {2204164800 -10800 1 -03} {2213233200 -14400 0 -04} - {2234404800 -10800 1 -03} + {2235614400 -10800 1 -03} {2244682800 -14400 0 -04} - {2265854400 -10800 1 -03} + {2267064000 -10800 1 -03} {2276132400 -14400 0 -04} - {2297304000 -10800 1 -03} + {2298513600 -10800 1 -03} {2307582000 -14400 0 -04} - {2328753600 -10800 1 -03} + {2329963200 -10800 1 -03} {2339636400 -14400 0 -04} - {2360203200 -10800 1 -03} + {2362017600 -10800 1 -03} {2371086000 -14400 0 -04} - {2391652800 -10800 1 -03} + {2393467200 -10800 1 -03} {2402535600 -14400 0 -04} - {2423707200 -10800 1 -03} + {2424916800 -10800 1 -03} {2433985200 -14400 0 -04} - {2455156800 -10800 1 -03} + {2456366400 -10800 1 -03} {2465434800 -14400 0 -04} - {2486606400 -10800 1 -03} + {2487816000 -10800 1 -03} {2497489200 -14400 0 -04} - {2518056000 -10800 1 -03} + {2519870400 -10800 1 -03} {2528938800 -14400 0 -04} - {2549505600 -10800 1 -03} + {2551320000 -10800 1 -03} {2560388400 -14400 0 -04} - {2580955200 -10800 1 -03} + {2582769600 -10800 1 -03} {2591838000 -14400 0 -04} - {2613009600 -10800 1 -03} + {2614219200 -10800 1 -03} {2623287600 -14400 0 -04} - {2644459200 -10800 1 -03} + {2645668800 -10800 1 -03} {2654737200 -14400 0 -04} - {2675908800 -10800 1 -03} + {2677118400 -10800 1 -03} {2686791600 -14400 0 -04} - {2707358400 -10800 1 -03} + {2709172800 -10800 1 -03} {2718241200 -14400 0 -04} - {2738808000 -10800 1 -03} + {2740622400 -10800 1 -03} {2749690800 -14400 0 -04} - {2770862400 -10800 1 -03} + {2772072000 -10800 1 -03} {2781140400 -14400 0 -04} - {2802312000 -10800 1 -03} + {2803521600 -10800 1 -03} {2812590000 -14400 0 -04} - {2833761600 -10800 1 -03} + {2834971200 -10800 1 -03} {2844039600 -14400 0 -04} - {2865211200 -10800 1 -03} + {2867025600 -10800 1 -03} {2876094000 -14400 0 -04} - {2896660800 -10800 1 -03} + {2898475200 -10800 1 -03} {2907543600 -14400 0 -04} - {2928110400 -10800 1 -03} + {2929924800 -10800 1 -03} {2938993200 -14400 0 -04} - {2960164800 -10800 1 -03} + {2961374400 -10800 1 -03} {2970442800 -14400 0 -04} - {2991614400 -10800 1 -03} + {2992824000 -10800 1 -03} {3001892400 -14400 0 -04} - {3023064000 -10800 1 -03} + {3024273600 -10800 1 -03} {3033946800 -14400 0 -04} - {3054513600 -10800 1 -03} + {3056328000 -10800 1 -03} {3065396400 -14400 0 -04} - {3085963200 -10800 1 -03} + {3087777600 -10800 1 -03} {3096846000 -14400 0 -04} - {3118017600 -10800 1 -03} + {3119227200 -10800 1 -03} {3128295600 -14400 0 -04} - {3149467200 -10800 1 -03} + {3150676800 -10800 1 -03} {3159745200 -14400 0 -04} - {3180916800 -10800 1 -03} + {3182126400 -10800 1 -03} {3191194800 -14400 0 -04} - {3212366400 -10800 1 -03} + {3213576000 -10800 1 -03} {3223249200 -14400 0 -04} - {3243816000 -10800 1 -03} + {3245630400 -10800 1 -03} {3254698800 -14400 0 -04} - {3275265600 -10800 1 -03} + {3277080000 -10800 1 -03} {3286148400 -14400 0 -04} - {3307320000 -10800 1 -03} + {3308529600 -10800 1 -03} {3317598000 -14400 0 -04} - {3338769600 -10800 1 -03} + {3339979200 -10800 1 -03} {3349047600 -14400 0 -04} - {3370219200 -10800 1 -03} + {3371428800 -10800 1 -03} {3381102000 -14400 0 -04} - {3401668800 -10800 1 -03} + {3403483200 -10800 1 -03} {3412551600 -14400 0 -04} - {3433118400 -10800 1 -03} + {3434932800 -10800 1 -03} {3444001200 -14400 0 -04} - {3464568000 -10800 1 -03} + {3466382400 -10800 1 -03} {3475450800 -14400 0 -04} - {3496622400 -10800 1 -03} + {3497832000 -10800 1 -03} {3506900400 -14400 0 -04} - {3528072000 -10800 1 -03} + {3529281600 -10800 1 -03} {3538350000 -14400 0 -04} - {3559521600 -10800 1 -03} + {3560731200 -10800 1 -03} {3570404400 -14400 0 -04} - {3590971200 -10800 1 -03} + {3592785600 -10800 1 -03} {3601854000 -14400 0 -04} - {3622420800 -10800 1 -03} + {3624235200 -10800 1 -03} {3633303600 -14400 0 -04} - {3654475200 -10800 1 -03} + {3655684800 -10800 1 -03} {3664753200 -14400 0 -04} - {3685924800 -10800 1 -03} + {3687134400 -10800 1 -03} {3696202800 -14400 0 -04} - {3717374400 -10800 1 -03} + {3718584000 -10800 1 -03} {3727652400 -14400 0 -04} - {3748824000 -10800 1 -03} + {3750638400 -10800 1 -03} {3759706800 -14400 0 -04} - {3780273600 -10800 1 -03} + {3782088000 -10800 1 -03} {3791156400 -14400 0 -04} - {3811723200 -10800 1 -03} + {3813537600 -10800 1 -03} {3822606000 -14400 0 -04} - {3843777600 -10800 1 -03} + {3844987200 -10800 1 -03} {3854055600 -14400 0 -04} - {3875227200 -10800 1 -03} + {3876436800 -10800 1 -03} {3885505200 -14400 0 -04} - {3906676800 -10800 1 -03} + {3907886400 -10800 1 -03} {3917559600 -14400 0 -04} - {3938126400 -10800 1 -03} + {3939940800 -10800 1 -03} {3949009200 -14400 0 -04} - {3969576000 -10800 1 -03} + {3971390400 -10800 1 -03} {3980458800 -14400 0 -04} - {4001630400 -10800 1 -03} + {4002840000 -10800 1 -03} {4011908400 -14400 0 -04} - {4033080000 -10800 1 -03} + {4034289600 -10800 1 -03} {4043358000 -14400 0 -04} - {4064529600 -10800 1 -03} + {4065739200 -10800 1 -03} {4074807600 -14400 0 -04} - {4095979200 -10800 1 -03} + {4097188800 -10800 1 -03} } diff --git a/library/tzdata/America/La_Paz b/library/tzdata/America/La_Paz index a245afd..ea2f711 100644 --- a/library/tzdata/America/La_Paz +++ b/library/tzdata/America/La_Paz @@ -3,6 +3,6 @@ set TZData(:America/La_Paz) { {-9223372036854775808 -16356 0 LMT} {-2524505244 -16356 0 CMT} - {-1205954844 -12756 1 BOST} + {-1205954844 -12756 1 BST} {-1192307244 -14400 0 -04} } diff --git a/library/tzdata/America/Sao_Paulo b/library/tzdata/America/Sao_Paulo index a61c638..93c524d 100644 --- a/library/tzdata/America/Sao_Paulo +++ b/library/tzdata/America/Sao_Paulo @@ -92,167 +92,167 @@ set TZData(:America/Sao_Paulo) { {1487469600 -10800 0 -03} {1508036400 -7200 1 -02} {1518919200 -10800 0 -03} - {1540090800 -7200 1 -02} + {1541300400 -7200 1 -02} {1550368800 -10800 0 -03} - {1571540400 -7200 1 -02} + {1572750000 -7200 1 -02} {1581818400 -10800 0 -03} - {1602990000 -7200 1 -02} + {1604199600 -7200 1 -02} {1613872800 -10800 0 -03} - {1634439600 -7200 1 -02} + {1636254000 -7200 1 -02} {1645322400 -10800 0 -03} - {1665889200 -7200 1 -02} + {1667703600 -7200 1 -02} {1677376800 -10800 0 -03} - {1697338800 -7200 1 -02} + {1699153200 -7200 1 -02} {1708221600 -10800 0 -03} - {1729393200 -7200 1 -02} + {1730602800 -7200 1 -02} {1739671200 -10800 0 -03} - {1760842800 -7200 1 -02} + {1762052400 -7200 1 -02} {1771725600 -10800 0 -03} - {1792292400 -7200 1 -02} + {1793502000 -7200 1 -02} {1803175200 -10800 0 -03} - {1823742000 -7200 1 -02} + {1825556400 -7200 1 -02} {1834624800 -10800 0 -03} - {1855191600 -7200 1 -02} + {1857006000 -7200 1 -02} {1866074400 -10800 0 -03} - {1887246000 -7200 1 -02} + {1888455600 -7200 1 -02} {1897524000 -10800 0 -03} - {1918695600 -7200 1 -02} + {1919905200 -7200 1 -02} {1928973600 -10800 0 -03} - {1950145200 -7200 1 -02} + {1951354800 -7200 1 -02} {1960423200 -10800 0 -03} - {1981594800 -7200 1 -02} + {1983409200 -7200 1 -02} {1992477600 -10800 0 -03} - {2013044400 -7200 1 -02} + {2014858800 -7200 1 -02} {2024532000 -10800 0 -03} - {2044494000 -7200 1 -02} + {2046308400 -7200 1 -02} {2055376800 -10800 0 -03} - {2076548400 -7200 1 -02} + {2077758000 -7200 1 -02} {2086826400 -10800 0 -03} - {2107998000 -7200 1 -02} + {2109207600 -7200 1 -02} {2118880800 -10800 0 -03} - {2139447600 -7200 1 -02} + {2140657200 -7200 1 -02} {2150330400 -10800 0 -03} - {2170897200 -7200 1 -02} + {2172711600 -7200 1 -02} {2181780000 -10800 0 -03} - {2202346800 -7200 1 -02} + {2204161200 -7200 1 -02} {2213229600 -10800 0 -03} - {2234401200 -7200 1 -02} + {2235610800 -7200 1 -02} {2244679200 -10800 0 -03} - {2265850800 -7200 1 -02} + {2267060400 -7200 1 -02} {2276128800 -10800 0 -03} - {2297300400 -7200 1 -02} + {2298510000 -7200 1 -02} {2307578400 -10800 0 -03} - {2328750000 -7200 1 -02} + {2329959600 -7200 1 -02} {2339632800 -10800 0 -03} - {2360199600 -7200 1 -02} + {2362014000 -7200 1 -02} {2371082400 -10800 0 -03} - {2391649200 -7200 1 -02} + {2393463600 -7200 1 -02} {2402532000 -10800 0 -03} - {2423703600 -7200 1 -02} + {2424913200 -7200 1 -02} {2433981600 -10800 0 -03} - {2455153200 -7200 1 -02} + {2456362800 -7200 1 -02} {2465431200 -10800 0 -03} - {2486602800 -7200 1 -02} + {2487812400 -7200 1 -02} {2497485600 -10800 0 -03} - {2518052400 -7200 1 -02} + {2519866800 -7200 1 -02} {2528935200 -10800 0 -03} - {2549502000 -7200 1 -02} + {2551316400 -7200 1 -02} {2560384800 -10800 0 -03} - {2580951600 -7200 1 -02} + {2582766000 -7200 1 -02} {2591834400 -10800 0 -03} - {2613006000 -7200 1 -02} + {2614215600 -7200 1 -02} {2623284000 -10800 0 -03} - {2644455600 -7200 1 -02} + {2645665200 -7200 1 -02} {2654733600 -10800 0 -03} - {2675905200 -7200 1 -02} + {2677114800 -7200 1 -02} {2686788000 -10800 0 -03} - {2707354800 -7200 1 -02} + {2709169200 -7200 1 -02} {2718237600 -10800 0 -03} - {2738804400 -7200 1 -02} + {2740618800 -7200 1 -02} {2749687200 -10800 0 -03} - {2770858800 -7200 1 -02} + {2772068400 -7200 1 -02} {2781136800 -10800 0 -03} - {2802308400 -7200 1 -02} + {2803518000 -7200 1 -02} {2812586400 -10800 0 -03} - {2833758000 -7200 1 -02} + {2834967600 -7200 1 -02} {2844036000 -10800 0 -03} - {2865207600 -7200 1 -02} + {2867022000 -7200 1 -02} {2876090400 -10800 0 -03} - {2896657200 -7200 1 -02} + {2898471600 -7200 1 -02} {2907540000 -10800 0 -03} - {2928106800 -7200 1 -02} + {2929921200 -7200 1 -02} {2938989600 -10800 0 -03} - {2960161200 -7200 1 -02} + {2961370800 -7200 1 -02} {2970439200 -10800 0 -03} - {2991610800 -7200 1 -02} + {2992820400 -7200 1 -02} {3001888800 -10800 0 -03} - {3023060400 -7200 1 -02} + {3024270000 -7200 1 -02} {3033943200 -10800 0 -03} - {3054510000 -7200 1 -02} + {3056324400 -7200 1 -02} {3065392800 -10800 0 -03} - {3085959600 -7200 1 -02} + {3087774000 -7200 1 -02} {3096842400 -10800 0 -03} - {3118014000 -7200 1 -02} + {3119223600 -7200 1 -02} {3128292000 -10800 0 -03} - {3149463600 -7200 1 -02} + {3150673200 -7200 1 -02} {3159741600 -10800 0 -03} - {3180913200 -7200 1 -02} + {3182122800 -7200 1 -02} {3191191200 -10800 0 -03} - {3212362800 -7200 1 -02} + {3213572400 -7200 1 -02} {3223245600 -10800 0 -03} - {3243812400 -7200 1 -02} + {3245626800 -7200 1 -02} {3254695200 -10800 0 -03} - {3275262000 -7200 1 -02} + {3277076400 -7200 1 -02} {3286144800 -10800 0 -03} - {3307316400 -7200 1 -02} + {3308526000 -7200 1 -02} {3317594400 -10800 0 -03} - {3338766000 -7200 1 -02} + {3339975600 -7200 1 -02} {3349044000 -10800 0 -03} - {3370215600 -7200 1 -02} + {3371425200 -7200 1 -02} {3381098400 -10800 0 -03} - {3401665200 -7200 1 -02} + {3403479600 -7200 1 -02} {3412548000 -10800 0 -03} - {3433114800 -7200 1 -02} + {3434929200 -7200 1 -02} {3443997600 -10800 0 -03} - {3464564400 -7200 1 -02} + {3466378800 -7200 1 -02} {3475447200 -10800 0 -03} - {3496618800 -7200 1 -02} + {3497828400 -7200 1 -02} {3506896800 -10800 0 -03} - {3528068400 -7200 1 -02} + {3529278000 -7200 1 -02} {3538346400 -10800 0 -03} - {3559518000 -7200 1 -02} + {3560727600 -7200 1 -02} {3570400800 -10800 0 -03} - {3590967600 -7200 1 -02} + {3592782000 -7200 1 -02} {3601850400 -10800 0 -03} - {3622417200 -7200 1 -02} + {3624231600 -7200 1 -02} {3633300000 -10800 0 -03} - {3654471600 -7200 1 -02} + {3655681200 -7200 1 -02} {3664749600 -10800 0 -03} - {3685921200 -7200 1 -02} + {3687130800 -7200 1 -02} {3696199200 -10800 0 -03} - {3717370800 -7200 1 -02} + {3718580400 -7200 1 -02} {3727648800 -10800 0 -03} - {3748820400 -7200 1 -02} + {3750634800 -7200 1 -02} {3759703200 -10800 0 -03} - {3780270000 -7200 1 -02} + {3782084400 -7200 1 -02} {3791152800 -10800 0 -03} - {3811719600 -7200 1 -02} + {3813534000 -7200 1 -02} {3822602400 -10800 0 -03} - {3843774000 -7200 1 -02} + {3844983600 -7200 1 -02} {3854052000 -10800 0 -03} - {3875223600 -7200 1 -02} + {3876433200 -7200 1 -02} {3885501600 -10800 0 -03} - {3906673200 -7200 1 -02} + {3907882800 -7200 1 -02} {3917556000 -10800 0 -03} - {3938122800 -7200 1 -02} + {3939937200 -7200 1 -02} {3949005600 -10800 0 -03} - {3969572400 -7200 1 -02} + {3971386800 -7200 1 -02} {3980455200 -10800 0 -03} - {4001626800 -7200 1 -02} + {4002836400 -7200 1 -02} {4011904800 -10800 0 -03} - {4033076400 -7200 1 -02} + {4034286000 -7200 1 -02} {4043354400 -10800 0 -03} - {4064526000 -7200 1 -02} + {4065735600 -7200 1 -02} {4074804000 -10800 0 -03} - {4095975600 -7200 1 -02} + {4097185200 -7200 1 -02} } diff --git a/library/tzdata/Asia/Tokyo b/library/tzdata/Asia/Tokyo index 10add1c..790df0a 100644 --- a/library/tzdata/Asia/Tokyo +++ b/library/tzdata/Asia/Tokyo @@ -3,12 +3,12 @@ set TZData(:Asia/Tokyo) { {-9223372036854775808 33539 0 LMT} {-2587712400 32400 0 JST} - {-683794800 36000 1 JDT} - {-672393600 32400 0 JST} - {-654764400 36000 1 JDT} - {-640944000 32400 0 JST} - {-620290800 36000 1 JDT} - {-609494400 32400 0 JST} - {-588841200 36000 1 JDT} - {-578044800 32400 0 JST} + {-683802000 36000 1 JDT} + {-672314400 32400 0 JST} + {-654771600 36000 1 JDT} + {-640864800 32400 0 JST} + {-620298000 36000 1 JDT} + {-609415200 32400 0 JST} + {-588848400 36000 1 JDT} + {-577965600 32400 0 JST} } -- cgit v0.12 From 98887219c2dcf8b1fd6debaf3c716f6a809d2a84 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Sat, 3 Feb 2018 18:15:06 +0000 Subject: Refine documentation for Tcl_NR* functions. --- doc/Eval.3 | 8 +- doc/NRE.3 | 260 ++++++++++++++++++++----------------------------------------- 2 files changed, 88 insertions(+), 180 deletions(-) diff --git a/doc/Eval.3 b/doc/Eval.3 index 191bace..e241794 100644 --- a/doc/Eval.3 +++ b/doc/Eval.3 @@ -176,10 +176,10 @@ it is faster to execute the script directly. .TP 23 \fBTCL_EVAL_GLOBAL\fR . -If this flag is set, the script is processed at global level. This -means that it is evaluated in the global namespace and its variable -context consists of global variables only (it ignores any Tcl -procedures that are active). +If this flag is set, the script is evaluated in the global namespace instead of +the current namespace and its variable context consists of global variables +only (it ignores any Tcl procedures that are active). +.\" TODO: document TCL_EVAL_INVOKE and TCL_EVAL_NOERR. .SH "MISCELLANEOUS DETAILS" .PP diff --git a/doc/NRE.3 b/doc/NRE.3 index ff0d108..6078a53 100644 --- a/doc/NRE.3 +++ b/doc/NRE.3 @@ -1,5 +1,6 @@ .\" .\" Copyright (c) 2008 by Kevin B. Kenny. +.\" Copyright (c) 2018 by Nathan Coulter. .\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -38,43 +39,39 @@ void .SH ARGUMENTS .AS Tcl_CmdDeleteProc *interp in .AP Tcl_Interp *interp in -Interpreter in which to create or evaluate a command. +The relevant Interpreter. .AP char *cmdName in -Name of a new command to create. +Name of the command to create. .AP Tcl_ObjCmdProc *proc in -Implementation of a command that will be called whenever \fIcmdName\fR -is invoked as a command in the unoptimized way. +Called in order to evaluate a command. Is often just a small wrapper that uses +\fBTcl_NRCallObjProc\fR to call \fInreProc\fR using a new trampoline. Behaves +in the same way as the \fIproc\fR argument to \fBTcl_CreateObjCommand\fR(3) +(\fIq.v.\fR). .AP Tcl_ObjCmdProc *nreProc in -Implementation of a command that will be called whenever \fIcmdName\fR -is invoked and requested to conserve the C stack. +Called instead of \fIproc\fR when a trampoline is already in use. .AP ClientData clientData in -Arbitrary one-word value that will be passed to \fIproc\fR, \fInreProc\fR, -\fIdeleteProc\fR and \fIobjProc\fR. +Arbitrary one-word value passed to \fIproc\fR, \fInreProc\fR, \fIdeleteProc\fR +and \fIobjProc\fR. .AP Tcl_CmdDeleteProc *deleteProc in/out -Procedure to call before \fIcmdName\fR is deleted from the interpreter. -This procedure allows for command-specific cleanup. If \fIdeleteProc\fR -is \fBNULL\fR, then no procedure is called before the command is deleted. +Called before \fIcmdName\fR is deleted from the interpreter, allowing for +command-specific cleanup. May be NULL. .AP int objc in -Count of parameters provided to the implementation of a command. +Number of items in \fIobjv\fR. .AP Tcl_Obj **objv in -Pointer to an array of Tcl values. Each value holds the value of a -single word in the command to execute. +Words in the command. .AP Tcl_Obj *objPtr in -Pointer to a Tcl_Obj whose value is a script or expression to execute. +A script or expression to evaluate. .AP int flags in -ORed combination of flag bits that specify additional options. -\fBTCL_EVAL_GLOBAL\fR is the only flag that is currently supported. -.\" TODO: This is a lie. But kbk didn't grasp TCL_EVAL_INVOKE and -.\" TCL_EVAL_NOERR well enough to document them. +As described for \fITcl_EvalObjv\fR. +.PP .AP Tcl_Command cmd in -Token for a command that is to be used instead of the currently -executing command. +Token to use instead of one derived from the first word of \fIobjv\fR in order +to evaluate a command. .AP Tcl_Obj *resultPtr out -Pointer to an unshared Tcl_Obj where the result of expression -evaluation is written. +Pointer to an unshared Tcl_Obj where the result of the evaluation is stored if +the return code is TCL_OK. .AP Tcl_NRPostProc *postProcPtr in -Pointer to a function that will be invoked when the command currently -executing in the interpreter designated by \fIinterp\fR completes. +A function to push. .AP ClientData data0 in .AP ClientData data1 in .AP ClientData data2 in @@ -84,98 +81,51 @@ to the function designated by \fIpostProcPtr\fR when it is invoked. .BE .SH DESCRIPTION .PP -This series of C functions provides an interface whereby commands that -are implemented in C can be evaluated, and invoke Tcl commands scripts -and scripts, without consuming space on the C stack. The non-recursive -evaluation is done by installing a \fItrampoline\fR, a small piece of -code that invokes a command or script, and then executes a series of -callbacks when the command or script returns. -.PP -The \fBTcl_NRCreateCommand\fR function creates a Tcl command in the -interpreter designated by \fIinterp\fR that is prepared to handle -nonrecursive evaluation with a trampoline. The \fIcmdName\fR argument -gives the name of the new command. If \fIcmdName\fR contains any -namespace qualifiers, then the new command is added to the specified -namespace; otherwise, it is added to the global namespace. \fIproc\fR -gives the procedure that will be called when the interpreter wishes to -evaluate the command in an unoptimized manner, and \fInreProc\fR is -the procedure that will be called when the interpreter wishes to -evaluate the command using a trampoline. \fIdeleteProc\fR is a -function that will be called before the command is deleted from the -interpreter. When any of the three functions is invoked, it is passed -the \fIclientData\fR parameter. -.PP -\fBTcl_NRCreateCommand\fR deletes any existing command -\fIname\fR already associated with the interpreter -(however see below for an exception where the existing command -is not deleted). -It returns a token that may be used to refer -to the command in subsequent calls to \fBTcl_GetCommandName\fR. -If \fBTcl_NRCreateCommand\fR is called for an interpreter that is in -the process of being deleted, then it does not create a new command, -does not delete any existing command of the same name, and returns NULL. -.PP -The \fIproc\fR and \fInreProc\fR function are expected to conform to -all the rules set forth for the \fIproc\fR argument to -\fBTcl_CreateObjCommand\fR(3) (\fIq.v.\fR). -.PP -When a command that is written to cope with evaluation via trampoline -is invoked without a trampoline on the stack, it will usually respond -to the invocation by creating a trampoline and calling the -trampoline-enabled implementation of the same command. This call is done by -means of \fBTcl_NRCallObjProc\fR. In the call to -\fBTcl_NRCallObjProc\fR, the \fIinterp\fR, \fIclientData\fR, -\fIobjc\fR and \fIobjv\fR parameters should be the same ones that were -passed to \fIproc\fR. The \fInreProc\fR parameter should designate the -trampoline-enabled implementation of the command. -.PP -\fBTcl_NREvalObj\fR arranges for the script contained in \fIobjPtr\fR -to be evaluated in the interpreter designated by \fIinterp\fR after -the current command (which must be trampoline-enabled) returns. It is -the method by which a command may invoke a script without consuming -space on the C stack. Similarly, \fBTcl_NREvalObjv\fR arranges to -invoke a single Tcl command whose words have already been separated -and substituted. The \fIobjc\fR and \fIobjv\fR parameters give the -words of the command to be evaluated when execution reaches the -trampoline. -.PP -\fBTcl_NRCmdSwap\fR allows for trampoline evaluation of a command whose -resolution is already known. The \fIcmd\fR parameter gives a -\fBTcl_Command\fR token (returned from \fBTcl_CreateObjCommand\fR or -\fBTcl_GetCommandFromObj\fR) identifying the command to be invoked in -the trampoline; this command must match the word in \fIobjv[0]\fR. -The remaining arguments are as for \fBTcl_NREvalObjv\fR. -.PP -\fBTcl_NREvalObj\fR, \fBTcl_NREvalObjv\fR and \fBTcl_NRCmdSwap\fR -all accept a \fIflags\fR parameter, which is an OR-ed-together set of -bits to control evaluation. At the present time, the only supported flag -available to callers is \fBTCL_EVAL_GLOBAL\fR. -.\" TODO: Again, this is a lie. Do we want to explain TCL_EVAL_INVOKE -.\" and TCL_EVAL_NOERR? -If the \fBTCL_EVAL_GLOBAL\fR flag is set, the script or command is -evaluated in the global namespace. If it is not set, it is evaluated -in the current namespace. -.PP -\fBTcl_NRExprObj\fR arranges for the expression contained in \fIobjPtr\fR -to be evaluated in the interpreter designated by \fIinterp\fR after -the current command (which must be trampoline-enabled) returns. It is -the method by which a command may evaluate a Tcl expression without consuming -space on the C stack. The argument \fIresultPtr\fR is a pointer to an -unshared Tcl_Obj where the result of expression evaluation is to be written. -If expression evaluation returns any code other than TCL_OK, the -\fIresultPtr\fR value is left untouched. -.PP -All of the routines return \fBTCL_OK\fR if command or expression invocation -has been scheduled successfully. If for any reason the scheduling cannot -be completed (for example, if the interpreter is unable to find -the requested command), they return \fBTCL_ERROR\fR with an -appropriate message left in the interpreter's result. -.PP -\fBTcl_NRAddCallback\fR arranges to have a C function called when the -current trampoline-enabled command in the Tcl interpreter designated -by \fIinterp\fR returns. The \fIpostProcPtr\fR argument is a pointer -to the callback function, which must have arguments and return value -consistent with the \fBTcl_NRPostProc\fR data type: +These functions provide an interface to the function stack that an interpreter +iterates through to evaluate commands. The routine behind a command is +implemented by an initial function and any additional functions that the +routine pushes onto the stack as it progresses. The interpreter itself pushes +functions onto the stack to react to the end of a routine and to exercise other +forms of control such as switching between in-progress stacks and the +evaluation of other scripts at additional levels without adding frames to the C +stack. To execute a routine, the initial function for the routine is called +and then a small bit of code called a \fItrampoline\fR iteratively takes +functions off the stack and calls them, using the value of the last call as the +value of the routine. +.PP +\fBTcl_NRCallObjProc\fR calls \fInreProc\fR using a new trampoline. +.PP +\fBTcl_NRCreateCommand\fR, an alternative to \fBTcl_CreateObjCommand\fR, +resolves \fIcmdName\fR, which may contain namespace qualifiers, relative to the +current namespace, creates a command by that name, and returns a token for the +command which may be used in subsequent calls to \fBTcl_GetCommandName\fR. +Except for a few cases noted below any existing command by the same name is +first deleted. If \fIinterp\fR is in the process of being deleted +\fBTcl_NRCreateCommand\fR does not create any command, does not delete any +command, and returns NULL. +.PP +\fBTcl_NREvalObj\fR pushes a function that is like \fBTcl_EvalObjEx\fR but +consumes no space on the C stack. +.PP +\fBTcl_NREvalObjv\fR pushes a function that is like \fBTcl_EvalObjv\fR but +consumes no space on the C stack. +.PP +\fBTcl_NRCmdSwap\fR is like \fBTcl_NREvalObjv\fR, but uses \fIcmd\fR, a token +previously returned by \fBTcl_CreateObjCommand\fR or +\fBTcl_GetCommandFromObj\fR, instead of resolving the first word of \fIobjv\fR. +. The name of this command must be the same as \fIobjv[0]\fR. +.PP +\fBTcl_NRExprObj\fR pushes a function that evaluates \fIobjPtr\fR as an +expression in the same manner as \fBTcl_ExprObj\fR but without consuming space +on the C stack. +.PP +All of the functions return \fBTCL_OK\fR if the evaluation of the script, +command, or expression has been scheduled successfully. Otherwise (for example +if the command name cannot be resolved), they return \fBTCL_ERROR\fR and store +a message as the interpreter's result. +.PP +\fBTcl_NRAddCallback\fR pushes \fIpostProcPtr\fR. The signature for +\fBTcl_NRPostProc\fR is: .PP .CS typedef int @@ -185,25 +135,13 @@ typedef int int \fIresult\fR); .CE .PP -When the trampoline invokes the callback function, the \fIdata\fR -parameter will point to an array containing the four one-word -quantities that were passed to \fBTcl_NRAddCallback\fR in the -\fIdata0\fR through \fIdata3\fR parameters. The Tcl interpreter will -be designated by the \fIinterp\fR parameter, and the \fIresult\fR -parameter will contain the result (\fBTCL_OK\fR, \fBTCL_ERROR\fR, -\fBTCL_RETURN\fR, \fBTCL_BREAK\fR or \fBTCL_CONTINUE\fR) that was -returned by the command evaluation. The callback function is expected, -in turn, either to return a \fIresult\fR to control further evaluation. -.PP -Multiple \fBTcl_NRAddCallback\fR invocations may request multiple -callbacks, which may be to the same or different callback -functions. If multiple callbacks are requested, they are executed in -last-in, first-out order, that is, the most recently requested -callback is executed first. +\fIdata\fR is a pointer to an array containing \fIdata0\fR through \fIdata3\fR. +\fIresult\fR is the value returned by the previous function implementing part +the routine. .SH EXAMPLE .PP -The usual pattern for Tcl commands that invoke other Tcl commands -is something like: +The following command uses \fBTcl_EvalObjEx\fR, which consumes space on the C +stack, to evalute a script: .PP .CS int @@ -228,28 +166,17 @@ int \fITheCmdOldObjProc\fR, clientData, TheCmdDeleteProc); .CE .PP -To enable a command like this one for trampoline-based evaluation, -it must be split into three pieces: -.IP \(bu -A non-trampoline implementation, \fITheCmdNewObjProc\fR, -which will simply create a trampoline -and invoke the trampoline-based implementation. -.IP \(bu -A trampoline-enabled implementation, \fITheCmdNRObjProc\fR. This -function will perform the initialization, request that the trampoline -call the postprocessing routine after command evaluation, and finally, -request that the trampoline call the inner command. -.IP \(bu -A postprocessing routine, \fITheCmdPostProc\fR. This function will -perform the postprocessing formerly done after the return from the -inner command in \fITheCmdObjProc\fR. -.PP -The non-trampoline implementation is simple and stylized, containing -a single statement: +To avoid consuming space on the C stack, \fITheCmdOldObjProc\fR is renamed to +\fITheCmdNRObjProc\fR and the postprocessing step is split into a separate +function, \fITheCmdPostProc\fR, which is pushed onto the function stack. +\fITcl_EvalObjEx\fR is replaced with \fITcl_NREvalObj\fR, which uses a +trampoline instead of consuming space on the C stack. A new version of +\fITheCmdOldObjProc\fR is just a a wrapper that uses \fBTcl_NRCallObjProc\fR to +call \fITheCmdNRObjProc\fR: .PP .CS int -\fITheCmdNewObjProc\fR( +\fITheCmdOldObjProc\fR( ClientData clientData, Tcl_Interp *interp, int objc, @@ -260,9 +187,6 @@ int } .CE .PP -The trampoline-enabled implementation requests postprocessing, -and returns to the trampoline requesting command evaluation. -.PP .CS int \fITheCmdNRObjProc\fR @@ -284,9 +208,6 @@ int } .CE .PP -The postprocessing procedure does whatever the original command did -upon return from the inner evaluation. -.PP .CS int \fITheCmdNRPostProc\fR( @@ -303,26 +224,13 @@ int } .CE .PP -If \fItheCommand\fR is a command that results in multiple commands or -scripts being evaluated, its postprocessing routine may schedule -additional postprocessing and then request another command evaluation -by means of \fBTcl_NREvalObj\fR or one of the other evaluation -routines. Looping and sequencing constructs may be implemented in this way. -.PP -Finally, to install a trampoline-enabled command in the interpreter, -\fBTcl_NRCreateCommand\fR is used in place of -\fBTcl_CreateObjCommand\fR. It accepts two command procedures instead -of one. The first is for use when no trampoline is yet on the stack, -and the second is for use when there is already a trampoline in place. +Any function comprising a routine can push other functions, making it possible +implement looping and sequencing constructs using the function stack. .PP -.CS -\fBTcl_NRCreateCommand\fR(interp, "theCommand", - \fITheCmdNewObjProc\fR, \fITheCmdNRObjProc\fR, clientData, - TheCmdDeleteProc); -.CE .SH "SEE ALSO" Tcl_CreateCommand(3), Tcl_CreateObjCommand(3), Tcl_EvalObjEx(3), Tcl_GetCommandFromObj(3), Tcl_ExprObj(3) .SH KEYWORDS stackless, nonrecursive, execute, command, global, value, result, script .SH COPYRIGHT -Copyright (c) 2008 by Kevin B. Kenny +Copyright (c) 2008 by Kevin B. Kenny. +Copyright (c) 2018 by Nathan Coulter. -- cgit v0.12 From da7f77f96f74cf57e80421226d7bf1e93d776f58 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 5 Feb 2018 13:33:21 +0000 Subject: Improved overflow prevention. --- generic/tclStringObj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index ae75e44..8437555 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -140,8 +140,8 @@ GrowStringBuffer( objPtr->bytes = NULL; } if (flag == 0 || stringPtr->allocated > 0) { - attempt = 2 * needed; - if (attempt >= 0) { + if (needed <= INT_MAX / 2) { + attempt = 2 * needed; ptr = attemptckrealloc(objPtr->bytes, attempt + 1); } if (ptr == NULL) { -- cgit v0.12 From 3be49723fced40ef581ccd12dbeb35b8cf346b12 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 5 Feb 2018 13:41:26 +0000 Subject: Improved overflow prevention. --- generic/tclStringObj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 8437555..c3a0192 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -190,8 +190,8 @@ GrowUnicodeBuffer( * Subsequent appends - apply the growth algorithm. */ - attempt = 2 * needed; - if (attempt >= 0 && attempt <= STRING_MAXCHARS) { + if (needed <= STRING_MAXCHARS / 2) { + attempt = 2 * needed; ptr = stringAttemptRealloc(stringPtr, attempt); } if (ptr == NULL) { -- cgit v0.12 From 836fa11775ae940ca572c7c330afbae5a7632d5b Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 5 Feb 2018 16:10:02 +0000 Subject: Revise TclStringRepeat() interface so that in place operations are done only by caller request. Establish a re-usable pattern. --- generic/tclCmdMZ.c | 9 +++++---- generic/tclInt.h | 15 +++++++++++++-- generic/tclStringObj.c | 31 +++++++++++++++---------------- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 1fc2d17..e0344ef 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -2294,11 +2294,12 @@ StringReptCmd( return TCL_OK; } - if (TCL_OK != TclStringRepeat(interp, objv[1], count, &resultPtr)) { - return TCL_ERROR; + resultPtr = TclStringRepeat(interp, objv[1], count, TCL_STRING_IN_PLACE); + if (resultPtr) { + Tcl_SetObjResult(interp, resultPtr); + return TCL_OK; } - Tcl_SetObjResult(interp, resultPtr); - return TCL_OK; + return TCL_ERROR; } /* diff --git a/generic/tclInt.h b/generic/tclInt.h index a3bd8ba..cee1d3a 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3201,8 +3201,6 @@ MODULE_SCOPE int TclStringMatch(const char *str, int strLen, MODULE_SCOPE int TclStringMatchObj(Tcl_Obj *stringObj, Tcl_Obj *patternObj, int flags); MODULE_SCOPE Tcl_Obj * TclStringObjReverse(Tcl_Obj *objPtr); -MODULE_SCOPE int TclStringRepeat(Tcl_Interp *interp, Tcl_Obj *objPtr, - int count, Tcl_Obj **objPtrPtr); MODULE_SCOPE void TclSubstCompile(Tcl_Interp *interp, const char *bytes, int numBytes, int flags, int line, struct CompileEnv *envPtr); @@ -4008,6 +4006,19 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp, struct CompileEnv *envPtr); /* + * Routines that provide the [string] ensemble functionality. Possible + * candidates for public interface. + */ + +MODULE_SCOPE Tcl_Obj * TclStringRepeat(Tcl_Interp *interp, Tcl_Obj *objPtr, + int count, int flags); + +/* Flag values for the [string] ensemble functions. */ + +#define TCL_STRING_MATCH_NOCASE TCL_MATCH_NOCASE /* (1<<0) in tcl.h */ +#define TCL_STRING_IN_PLACE (1<<1) + +/* * Functions defined in generic/tclVar.c and currently exported only for use * by the bytecode compiler and engine. Some of these could later be placed in * the public interface. diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index c3a0192..8bb76c1 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2708,23 +2708,24 @@ TclGetStringStorage( * Performs the [string repeat] function. * * Results: - * A standard Tcl result. + * A (Tcl_Obj *) pointing to the result value, or NULL in case of an + * error. * * Side effects: - * Writes to *objPtrPtr the address of Tcl_Obj that is concatenation - * of count copies of the value in objPtr. + * On error, when interp is not NULL, error information is left in it. * *--------------------------------------------------------------------------- */ -int +Tcl_Obj * TclStringRepeat( Tcl_Interp *interp, Tcl_Obj *objPtr, int count, - Tcl_Obj **objPtrPtr) + int flags) { Tcl_Obj *objResultPtr; + int inPlace = flags & TCL_STRING_IN_PLACE; int length = 0, unichar = 0, done = 1; int binary = TclIsPureByteArray(objPtr); @@ -2759,8 +2760,7 @@ TclStringRepeat( if (length == 0) { /* Any repeats of empty is empty. */ - *objPtrPtr = objPtr; - return TCL_OK; + return objPtr; } if (count > INT_MAX/length) { @@ -2769,13 +2769,13 @@ TclStringRepeat( "max size for a Tcl value (%d bytes) exceeded", INT_MAX)); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } - return TCL_ERROR; + return NULL; } if (binary) { /* Efficiently produce a pure byte array result */ - objResultPtr = Tcl_IsShared(objPtr) ? Tcl_DuplicateObj(objPtr) - : objPtr; + objResultPtr = (!inPlace || Tcl_IsShared(objPtr)) ? + Tcl_DuplicateObj(objPtr) : objPtr; Tcl_SetByteArrayLength(objResultPtr, count*length); /* PANIC? */ Tcl_SetByteArrayLength(objResultPtr, length); @@ -2788,7 +2788,7 @@ TclStringRepeat( (count - done) * length); } else if (unichar) { /* Efficiently produce a pure Tcl_UniChar array result */ - if (Tcl_IsShared(objPtr)) { + if (!inPlace || Tcl_IsShared(objPtr)) { objResultPtr = Tcl_NewUnicodeObj(Tcl_GetUnicode(objPtr), length); } else { TclInvalidateStringRep(objPtr); @@ -2803,7 +2803,7 @@ TclStringRepeat( (Tcl_WideUInt)STRING_SIZE(count*length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } - return TCL_ERROR; + return NULL; } Tcl_SetObjLength(objResultPtr, length); while (count - done > done) { @@ -2814,7 +2814,7 @@ TclStringRepeat( (count - done) * length); } else { /* Efficiently concatenate string reps */ - if (Tcl_IsShared(objPtr)) { + if (!inPlace || Tcl_IsShared(objPtr)) { objResultPtr = Tcl_NewStringObj(Tcl_GetString(objPtr), length); } else { TclFreeIntRep(objPtr); @@ -2827,7 +2827,7 @@ TclStringRepeat( count*length)); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } - return TCL_ERROR; + return NULL; } Tcl_SetObjLength(objResultPtr, length); while (count - done > done) { @@ -2837,8 +2837,7 @@ TclStringRepeat( Tcl_AppendToObj(objResultPtr, Tcl_GetString(objResultPtr), (count - done) * length); } - *objPtrPtr = objResultPtr; - return TCL_OK; + return objResultPtr; } /* -- cgit v0.12 From ca5e7c5b63ce1355c653763e82f8e75f7a38d333 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 5 Feb 2018 16:34:28 +0000 Subject: Revise the TclStringCat() interface to follow a common pattern. --- generic/tclCmdIL.c | 3 +-- generic/tclCmdMZ.c | 15 +++------------ generic/tclDictObj.c | 9 ++++++--- generic/tclExecute.c | 6 +++--- generic/tclInt.h | 5 ++--- generic/tclStringObj.c | 35 ++++++++++++++++------------------- 6 files changed, 31 insertions(+), 42 deletions(-) diff --git a/generic/tclCmdIL.c b/generic/tclCmdIL.c index 77b8434..fa32340 100644 --- a/generic/tclCmdIL.c +++ b/generic/tclCmdIL.c @@ -2193,8 +2193,7 @@ Tcl_JoinObjCmd( (void) Tcl_GetStringFromObj(joinObjPtr, &length); if (length == 0) { - TclStringCatObjv(interp, /* inPlace */ 0, listLen, elemPtrs, - &resObjPtr); + resObjPtr = TclStringCat(interp, listLen, elemPtrs, 0); } else { int i; diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index e0344ef..f9e404b 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -2847,7 +2847,6 @@ StringCatCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int code; Tcl_Obj *objResultPtr; if (objc < 2) { @@ -2857,23 +2856,15 @@ StringCatCmd( */ return TCL_OK; } - if (objc == 2) { - /* - * Other trivial case, single arg, just return it. - */ - Tcl_SetObjResult(interp, objv[1]); - return TCL_OK; - } - code = TclStringCatObjv(interp, /* inPlace */ 1, objc-1, objv+1, - &objResultPtr); + objResultPtr = TclStringCat(interp, objc-1, objv+1, TCL_STRING_IN_PLACE); - if (code == TCL_OK) { + if (objResultPtr) { Tcl_SetObjResult(interp, objResultPtr); return TCL_OK; } - return code; + return TCL_ERROR; } /* diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index 3b983e3..a0f6491 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -2309,9 +2309,12 @@ DictAppendCmd( if (objc == 4) { appendObjPtr = objv[3]; - } else if (TCL_OK != TclStringCatObjv(interp, /* inPlace */ 1, - objc-3, objv+3, &appendObjPtr)) { - return TCL_ERROR; + } else { + appendObjPtr = TclStringCat(interp, objc-3, objv+3, + TCL_STRING_IN_PLACE); + if (appendObjPtr == NULL) { + return TCL_ERROR; + } } } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index f2cda0c..a30ec89 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2682,9 +2682,9 @@ TEBCresume( case INST_STR_CONCAT1: opnd = TclGetUInt1AtPtr(pc+1); - - if (TCL_OK != TclStringCatObjv(interp, /* inPlace */ 1, - opnd, &OBJ_AT_DEPTH(opnd-1), &objResultPtr)) { + objResultPtr = TclStringCat(interp, opnd, &OBJ_AT_DEPTH(opnd-1), + TCL_STRING_IN_PLACE); + if (objResultPtr == NULL) { TRACE_ERROR(interp); goto gotError; } diff --git a/generic/tclInt.h b/generic/tclInt.h index cee1d3a..6cb9955 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3189,9 +3189,6 @@ MODULE_SCOPE void TclSpellFix(Tcl_Interp *interp, Tcl_Obj *bad, Tcl_Obj *fix); MODULE_SCOPE void * TclStackRealloc(Tcl_Interp *interp, void *ptr, int numBytes); -MODULE_SCOPE int TclStringCatObjv(Tcl_Interp *interp, int inPlace, - int objc, Tcl_Obj *const objv[], - Tcl_Obj **objPtrPtr); MODULE_SCOPE int TclStringFind(Tcl_Obj *needle, Tcl_Obj *haystack, int start); MODULE_SCOPE int TclStringLast(Tcl_Obj *needle, Tcl_Obj *haystack, @@ -4010,6 +4007,8 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp, * candidates for public interface. */ +MODULE_SCOPE Tcl_Obj * TclStringCat(Tcl_Interp *interp, int objc, + Tcl_Obj *const objv[], int flags); MODULE_SCOPE Tcl_Obj * TclStringRepeat(Tcl_Interp *interp, Tcl_Obj *objPtr, int count, int flags); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 8bb76c1..46162ff 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2843,40 +2843,39 @@ TclStringRepeat( /* *--------------------------------------------------------------------------- * - * TclStringCatObjv -- + * TclStringCat -- * * Performs the [string cat] function. * * Results: - * A standard Tcl result. + * A (Tcl_Obj *) pointing to the result value, or NULL in case of an + * error. * * Side effects: - * Writes to *objPtrPtr the address of Tcl_Obj that is concatenation - * of all objc values in objv. + * On error, when interp is not NULL, error information is left in it. * *--------------------------------------------------------------------------- */ -int -TclStringCatObjv( +Tcl_Obj * +TclStringCat( Tcl_Interp *interp, - int inPlace, int objc, Tcl_Obj * const objv[], - Tcl_Obj **objPtrPtr) + int flags) { Tcl_Obj *objResultPtr, * const *ov; int oc, length = 0, binary = 1; int allowUniChar = 1, requestUniChar = 0; int first = objc - 1; /* Index of first value possibly not empty */ int last = 0; /* Index of last value possibly not empty */ + int inPlace = flags & TCL_STRING_IN_PLACE; /* assert ( objc >= 0 ) */ if (objc <= 1) { /* Only one or no objects; return first or empty */ - *objPtrPtr = objc ? objv[0] : Tcl_NewObj(); - return TCL_OK; + return objc ? objv[0] : Tcl_NewObj(); } /* assert ( objc >= 2 ) */ @@ -3053,8 +3052,7 @@ TclStringCatObjv( if (last <= first /*|| length == 0 */) { /* Only one non-empty value or zero length; return first */ /* NOTE: (length == 0) implies (last <= first) */ - *objPtrPtr = objv[first]; - return TCL_OK; + return objv[first]; } objv += first; objc = (last - first + 1); @@ -3108,7 +3106,7 @@ TclStringCatObjv( (Tcl_WideUInt)STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } - return TCL_ERROR; + return NULL; } dst = Tcl_GetUnicode(objResultPtr) + start; } else { @@ -3125,7 +3123,7 @@ TclStringCatObjv( (Tcl_WideUInt)STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } - return TCL_ERROR; + return NULL; } dst = Tcl_GetUnicode(objResultPtr); } @@ -3156,7 +3154,7 @@ TclStringCatObjv( length)); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } - return TCL_ERROR; + return NULL; } dst = Tcl_GetString(objResultPtr) + start; @@ -3172,7 +3170,7 @@ TclStringCatObjv( length)); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } - return TCL_ERROR; + return NULL; } dst = Tcl_GetString(objResultPtr); } @@ -3187,8 +3185,7 @@ TclStringCatObjv( } } } - *objPtrPtr = objResultPtr; - return TCL_OK; + return objResultPtr; overflow: if (interp) { @@ -3196,7 +3193,7 @@ TclStringCatObjv( "max size for a Tcl value (%d bytes) exceeded", INT_MAX)); Tcl_SetErrorCode(interp, "TCL", "MEMORY", NULL); } - return TCL_ERROR; + return NULL; } /* -- cgit v0.12 From 2567185fd23306471a28bd33da7ddea94b0b44bc Mon Sep 17 00:00:00 2001 From: pooryorick Date: Tue, 6 Feb 2018 11:16:51 +0000 Subject: Add remaining wrapper to the NR functions, remaining calls to TCL_NRAddCallback, and a test for a package require script that yields. --- generic/tclBasic.c | 4 +- generic/tclPkg.c | 436 +++++++++++++++++++++++++++++++++-------------------- tests/package.test | 12 ++ 3 files changed, 288 insertions(+), 164 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index fa54551..366fd1f 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -238,7 +238,7 @@ static const CmdInfo builtInCmds[] = { {"lsearch", Tcl_LsearchObjCmd, NULL, NULL, CMD_IS_SAFE}, {"lset", Tcl_LsetObjCmd, TclCompileLsetCmd, NULL, CMD_IS_SAFE}, {"lsort", Tcl_LsortObjCmd, NULL, NULL, CMD_IS_SAFE}, - {"package", Tcl_PackageObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"package", Tcl_PackageObjCmd, NULL, TclNRPackageObjCmd, CMD_IS_SAFE}, {"proc", Tcl_ProcObjCmd, NULL, NULL, CMD_IS_SAFE}, {"regexp", Tcl_RegexpObjCmd, TclCompileRegexpCmd, NULL, CMD_IS_SAFE}, {"regsub", Tcl_RegsubObjCmd, TclCompileRegsubCmd, NULL, CMD_IS_SAFE}, @@ -4480,6 +4480,8 @@ TclNRRunCallbacks( (void) Tcl_GetObjResult(interp); } + /* This is the trampoline. */ + while (TOP_CB(interp) != rootPtr) { callbackPtr = TOP_CB(interp); procPtr = callbackPtr->procPtr; diff --git a/generic/tclPkg.c b/generic/tclPkg.c index ce00fbf..6c5b827 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -69,8 +69,14 @@ typedef struct Require { void * clientDataPtr; const char *name; Package *pkgPtr; + char *versionToProvide; } Require; +typedef struct RequireProcArgs { + const char *name; + void *clientDataPtr; +} RequireProcArgs; + /* * Prototypes for functions defined in this file: */ @@ -91,10 +97,15 @@ static void AddRequirementsToResult(Tcl_Interp *interp, int reqc, static void AddRequirementsToDString(Tcl_DString *dstring, int reqc, Tcl_Obj *const reqv[]); static Package * FindPackage(Tcl_Interp *interp, const char *name); -static int PkgRequireCore(ClientData clientData, Tcl_Interp *interp, - int reqc, Tcl_Obj *const reqv[]); -static int SelectPackage (Tcl_Interp *interp, Require *reqPtr, - int reqc, Tcl_Obj *const reqv[]); +static int PkgRequireCore(ClientData data[], Tcl_Interp *interp, int result); +static int PkgRequireCoreFinal(ClientData data[], Tcl_Interp *interp, int result); +static int PkgRequireCoreCleanup(ClientData data[], Tcl_Interp *interp, int result); +static int PkgRequireCoreStep1(ClientData data[], Tcl_Interp *interp, int result); +static int PkgRequireCoreStep2(ClientData data[], Tcl_Interp *interp, int result); +static int TclNRPkgRequireProc(ClientData clientData, Tcl_Interp *interp, int reqc, Tcl_Obj *const reqv[]); +static int SelectPackage(ClientData data[], Tcl_Interp *interp, int result); +static int SelectPackageFinal(ClientData data[], Tcl_Interp *interp, int result); +static int TclNRPackageObjCmdCleanup(ClientData data[], Tcl_Interp *interp, int result); /* * Helper macros. @@ -406,80 +417,116 @@ Tcl_PkgRequireProc( * available. */ void *clientDataPtr) { + RequireProcArgs args; + args.name = name; + args.clientDataPtr = clientDataPtr; + return Tcl_NRCallObjProc(interp, TclNRPkgRequireProc, (void *)&args, reqc, reqv); +} + +static int +TclNRPkgRequireProc( + ClientData clientData, + Tcl_Interp *interp, + int reqc, + Tcl_Obj *const reqv[]) { + RequireProcArgs *args = clientData; + Tcl_NRAddCallback(interp, PkgRequireCore, (void *)args->name, INT2PTR(reqc), (void *)reqv, args->clientDataPtr); + return TCL_OK; +} + +static int +PkgRequireCore(ClientData data[], Tcl_Interp *interp, int result) +{ + const char *name = data[0]; + int reqc = PTR2INT(data[1]); + Tcl_Obj *const *reqv = data[2]; int code = CheckAllRequirements(interp, reqc, reqv); - Require require; + Require *reqPtr; if (code != TCL_OK) { return code; } - require.clientDataPtr = clientDataPtr; - require.name = name; - require.pkgPtr = NULL; - return Tcl_NRCallObjProc(interp, PkgRequireCore, &require, reqc, reqv); + reqPtr = ckalloc(sizeof(Require)); + Tcl_NRAddCallback(interp, PkgRequireCoreCleanup, reqPtr, NULL, NULL, NULL); + reqPtr->clientDataPtr = data[3]; + reqPtr->name = name; + reqPtr->pkgPtr = FindPackage(interp, name); + if (reqPtr->pkgPtr->version == NULL) { + Tcl_NRAddCallback(interp, SelectPackage, reqPtr, INT2PTR(reqc), (void *)reqv, PkgRequireCoreStep1); + } else { + Tcl_NRAddCallback(interp, PkgRequireCoreFinal, reqPtr, INT2PTR(reqc), (void *)reqv, NULL); + } + return TCL_OK; } -int -PkgRequireCore( - ClientData clientData, - Tcl_Interp *interp, /* Interpreter in which package is now - * available. */ - int reqc, /* Requirements constraining the desired - * version. */ - Tcl_Obj *const reqv[] /* 0 means to use the latest version - * available. */ - ) -{ - int code, satisfies; +static int +PkgRequireCoreStep1(ClientData data[], Tcl_Interp *interp, int result) { Tcl_DString command; - Require *reqPtr = clientData; - char *script, *pkgVersionI; + char *script; + Require *reqPtr = data[0]; + int reqc = PTR2INT(data[1]); + Tcl_Obj **const reqv = data[2]; const char *name = reqPtr->name /* Name of desired package. */; - void *clientDataPtr = reqPtr->clientDataPtr; - - reqPtr->pkgPtr = FindPackage(interp, name); if (reqPtr->pkgPtr->version == NULL) { - code = SelectPackage(interp, reqPtr, reqc, reqv); - if (code != TCL_OK) { - return code; - } - if (reqPtr->pkgPtr->version == NULL) { - /* - * The package is not in the database. If there is a "package unknown" - * command, invoke it. - */ + /* + * The package is not in the database. If there is a "package unknown" + * command, invoke it. + */ - script = ((Interp *) interp)->packageUnknown; - if (script != NULL) { - Tcl_DStringInit(&command); - Tcl_DStringAppend(&command, script, -1); - Tcl_DStringAppendElement(&command, name); - AddRequirementsToDString(&command, reqc, reqv); - - code = Tcl_EvalEx(interp, Tcl_DStringValue(&command), - Tcl_DStringLength(&command), TCL_EVAL_GLOBAL); - Tcl_DStringFree(&command); - - if ((code != TCL_OK) && (code != TCL_ERROR)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad return code: %d", code)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); - code = TCL_ERROR; - } - if (code == TCL_ERROR) { - Tcl_AddErrorInfo(interp, - "\n (\"package unknown\" script)"); - return code; - } - Tcl_ResetResult(interp); - /* pkgPtr may now be invalid, so refresh it. */ - reqPtr->pkgPtr = FindPackage(interp, name); - code = SelectPackage(interp, reqPtr, reqc, reqv); - if (code != TCL_OK) { - return code; - } - } - } + script = ((Interp *) interp)->packageUnknown; + if (script == NULL) { + Tcl_NRAddCallback(interp, PkgRequireCoreFinal, reqPtr, INT2PTR(reqc), (void *)reqv, NULL); + } else { + Tcl_DStringInit(&command); + Tcl_DStringAppend(&command, script, -1); + Tcl_DStringAppendElement(&command, name); + AddRequirementsToDString(&command, reqc, reqv); + + Tcl_NRAddCallback(interp, PkgRequireCoreStep2, reqPtr, INT2PTR(reqc), (void *)reqv, NULL); + Tcl_NREvalObj(interp, + Tcl_NewStringObj(Tcl_DStringValue(&command), Tcl_DStringLength(&command)), + TCL_EVAL_GLOBAL + ); + Tcl_DStringFree(&command); + } + return TCL_OK; + } else { + Tcl_NRAddCallback(interp, PkgRequireCoreFinal, reqPtr, INT2PTR(reqc), (void *)reqv, NULL); } + return TCL_OK; +} +static int +PkgRequireCoreStep2(ClientData data[], Tcl_Interp *interp, int result) { + Require *reqPtr = data[0]; + int reqc = PTR2INT(data[1]); + Tcl_Obj **const reqv = data[2]; + const char *name = reqPtr->name /* Name of desired package. */; + if ((result != TCL_OK) && (result != TCL_ERROR)) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "bad return code: %d", result)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); + result = TCL_ERROR; + } + if (result == TCL_ERROR) { + Tcl_AddErrorInfo(interp, + "\n (\"package unknown\" script)"); + return result; + } + Tcl_ResetResult(interp); + /* pkgPtr may now be invalid, so refresh it. */ + reqPtr->pkgPtr = FindPackage(interp, name); + Tcl_NRAddCallback(interp, SelectPackage, reqPtr, INT2PTR(reqc), (void *)reqv, PkgRequireCoreFinal); + return TCL_OK; +} + +static int +PkgRequireCoreFinal(ClientData data[], Tcl_Interp *interp, int result) { + Require *reqPtr = data[0]; + int reqc = PTR2INT(data[1]), satisfies; + Tcl_Obj **const reqv = data[2]; + char *pkgVersionI; + void *clientDataPtr = reqPtr->clientDataPtr; + const char *name = reqPtr->name /* Name of desired package. */; if (reqPtr->pkgPtr->version == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't find package %s", name)); @@ -517,13 +564,23 @@ PkgRequireCore( Tcl_SetObjResult(interp, Tcl_NewStringObj(reqPtr->pkgPtr->version, -1)); return TCL_OK; } + +static int +PkgRequireCoreCleanup(ClientData data[], Tcl_Interp *interp, int result) { + ckfree(data[0]); + return result; +} + -int SelectPackage (Tcl_Interp *interp, Require *reqPtr, int reqc, Tcl_Obj *const reqv[]) { +static int +SelectPackage(ClientData data[], Tcl_Interp *interp, int result) { PkgAvail *availPtr, *bestPtr, *bestStablePtr; char *availVersion, *bestVersion, *bestStableVersion; /* Internal rep. of versions */ - char *script; - int availStable, code, satisfies; + int availStable, satisfies; + Require *reqPtr = data[0]; + int reqc = PTR2INT(data[1]); + Tcl_Obj **const reqv = data[2]; const char *name = reqPtr->name; Package *pkgPtr = reqPtr->pkgPtr; Interp *iPtr = (Interp *) interp; @@ -660,7 +717,9 @@ int SelectPackage (Tcl_Interp *interp, Require *reqPtr, int reqc, Tcl_Obj *const bestPtr = bestStablePtr; } - if (bestPtr != NULL) { + if (bestPtr == NULL) { + Tcl_NRAddCallback(interp, data[3], reqPtr, INT2PTR(reqc), (void *)reqv, NULL); + } else { /* * We found an ifneeded script for the package. Be careful while * executing it: this could cause reentrancy, so (a) protect the @@ -669,105 +728,118 @@ int SelectPackage (Tcl_Interp *interp, Require *reqPtr, int reqc, Tcl_Obj *const */ char *versionToProvide = bestPtr->version; - PkgFiles *pkgFiles; - PkgName *pkgName; - script = bestPtr->script; - - pkgPtr->clientData = versionToProvide; Tcl_Preserve(versionToProvide); - Tcl_Preserve(script); - pkgFiles = TclInitPkgFiles(interp); - /* Push "ifneeded" package name in "tclPkgFiles" assocdata. */ - pkgName = ckalloc(sizeof(PkgName) + strlen(name)); - pkgName->nextPtr = pkgFiles->names; - strcpy(pkgName->name, name); - pkgFiles->names = pkgName; + pkgPtr->clientData = versionToProvide; if (bestPtr->pkgIndex) { TclPkgFileSeen(interp, bestPtr->pkgIndex); } - code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); - /* Pop the "ifneeded" package name from "tclPkgFiles" assocdata*/ - pkgFiles->names = pkgName->nextPtr; - ckfree(pkgName); - Tcl_Release(script); + reqPtr->versionToProvide = versionToProvide; + Tcl_NRAddCallback(interp, SelectPackageFinal, reqPtr, INT2PTR(reqc), (void *)reqv, data[3]); + Tcl_NREvalObj(interp, Tcl_NewStringObj(bestPtr->script, -1), TCL_EVAL_GLOBAL); + } + return TCL_OK; +} + +static int +SelectPackageFinal(ClientData data[], Tcl_Interp *interp, int result) { + Require *reqPtr = data[0]; + int reqc = PTR2INT(data[1]); + Tcl_Obj **const reqv = data[2]; + const char *name = reqPtr->name; + char *versionToProvide = reqPtr->versionToProvide; - reqPtr->pkgPtr = FindPackage(interp, name); - if (code == TCL_OK) { - Tcl_ResetResult(interp); - if (reqPtr->pkgPtr->version == NULL) { - code = TCL_ERROR; - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "attempt to provide package %s %s failed:" - " no version of package %s provided", - name, versionToProvide, name)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNPROVIDED", - NULL); - } else { - char *pvi, *vi; - - if (CheckVersionAndConvert(interp, reqPtr->pkgPtr->version, &pvi, - NULL) != TCL_OK) { - code = TCL_ERROR; - } else if (CheckVersionAndConvert(interp, - versionToProvide, &vi, NULL) != TCL_OK) { - ckfree(pvi); - code = TCL_ERROR; - } else { - int res = CompareVersions(pvi, vi, NULL); - - ckfree(pvi); - ckfree(vi); - if (res != 0) { - code = TCL_ERROR; - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "attempt to provide package %s %s failed:" - " package %s %s provided instead", - name, versionToProvide, - name, reqPtr->pkgPtr->version)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", - "WRONGPROVIDE", NULL); - } - } - } - } else if (code != TCL_ERROR) { - Tcl_Obj *codePtr = Tcl_NewIntObj(code); + PkgFiles *pkgFiles; + PkgName *pkgName; + + pkgFiles = TclInitPkgFiles(interp); + /* Push "ifneeded" package name in "tclPkgFiles" assocdata. */ + pkgName = ckalloc(sizeof(PkgName) + strlen(name)); + pkgName->nextPtr = pkgFiles->names; + strcpy(pkgName->name, name); + pkgFiles->names = pkgName; + + /* Pop the "ifneeded" package name from "tclPkgFiles" assocdata*/ + pkgFiles->names = pkgName->nextPtr; + ckfree(pkgName); + reqPtr->pkgPtr = FindPackage(interp, name); + if (result == TCL_OK) { + Tcl_ResetResult(interp); + if (reqPtr->pkgPtr->version == NULL) { + result = TCL_ERROR; Tcl_SetObjResult(interp, Tcl_ObjPrintf( "attempt to provide package %s %s failed:" - " bad return code: %s", - name, versionToProvide, TclGetString(codePtr))); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); - TclDecrRefCount(codePtr); - code = TCL_ERROR; - } + " no version of package %s provided", + name, versionToProvide, name)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNPROVIDED", + NULL); + } else { + char *pvi, *vi; - if (code == TCL_ERROR) { - Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( - "\n (\"package ifneeded %s %s\" script)", - name, versionToProvide)); + if (CheckVersionAndConvert(interp, reqPtr->pkgPtr->version, &pvi, + NULL) != TCL_OK) { + result = TCL_ERROR; + } else if (CheckVersionAndConvert(interp, + versionToProvide, &vi, NULL) != TCL_OK) { + ckfree(pvi); + result = TCL_ERROR; + } else { + int res = CompareVersions(pvi, vi, NULL); + + ckfree(pvi); + ckfree(vi); + if (res != 0) { + result = TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "attempt to provide package %s %s failed:" + " package %s %s provided instead", + name, versionToProvide, + name, reqPtr->pkgPtr->version)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", + "WRONGPROVIDE", NULL); + } + } } - Tcl_Release(versionToProvide); + } else if (result != TCL_ERROR) { + Tcl_Obj *codePtr = Tcl_NewIntObj(result); - if (code != TCL_OK) { - /* - * Take a non-TCL_OK code from the script as an indication the - * package wasn't loaded properly, so the package system - * should not remember an improper load. - * - * This is consistent with our returning NULL. If we're not - * willing to tell our caller we got a particular version, we - * shouldn't store that version for telling future callers - * either. - */ + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "attempt to provide package %s %s failed:" + " bad return code: %s", + name, versionToProvide, TclGetString(codePtr))); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); + TclDecrRefCount(codePtr); + result = TCL_ERROR; + } - if (reqPtr->pkgPtr->version != NULL) { - ckfree(reqPtr->pkgPtr->version); - reqPtr->pkgPtr->version = NULL; - } - reqPtr->pkgPtr->clientData = NULL; - return code; + if (result == TCL_ERROR) { + Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( + "\n (\"package ifneeded %s %s\" script)", + name, versionToProvide)); + } + Tcl_Release(versionToProvide); + + if (result != TCL_OK) { + /* + * Take a non-TCL_OK code from the script as an indication the + * package wasn't loaded properly, so the package system + * should not remember an improper load. + * + * This is consistent with our returning NULL. If we're not + * willing to tell our caller we got a particular version, we + * shouldn't store that version for telling future callers + * either. + */ + + if (reqPtr->pkgPtr->version != NULL) { + ckfree(reqPtr->pkgPtr->version); + reqPtr->pkgPtr->version = NULL; } + reqPtr->pkgPtr->clientData = NULL; + return result; } + + Tcl_NRAddCallback(interp, data[3], reqPtr, INT2PTR(reqc), (void *)reqv, NULL); return TCL_OK; } @@ -874,10 +946,19 @@ Tcl_PkgPresentEx( * *---------------------------------------------------------------------- */ +int +Tcl_PackageObjCmd( + ClientData dummy, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ +{ + return Tcl_NRCallObjProc(interp, TclNRPackageObjCmd, NULL, objc, objv); +} /* ARGSUSED */ int -Tcl_PackageObjCmd( +TclNRPackageObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -894,7 +975,7 @@ Tcl_PackageObjCmd( PKG_VERSIONS, PKG_VSATISFIES }; Interp *iPtr = (Interp *) interp; - int optionIndex, exact, i, satisfies; + int optionIndex, exact, i, newobjc, satisfies; PkgAvail *availPtr, *prevPtr; Package *pkgPtr; Tcl_HashEntry *hPtr; @@ -903,6 +984,7 @@ Tcl_PackageObjCmd( const char *version; const char *argv2, *argv3, *argv4; char *iva = NULL, *ivb = NULL; + Tcl_Obj *objvListPtr, **newObjvPtr; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1148,7 +1230,6 @@ Tcl_PackageObjCmd( argv2 = TclGetString(objv[2]); if ((argv2[0] == '-') && (strcmp(argv2, "-exact") == 0)) { Tcl_Obj *ov; - int res; if (objc != 5) { goto requireSyntax; @@ -1165,20 +1246,42 @@ Tcl_PackageObjCmd( */ ov = Tcl_NewStringObj(version, -1); + Tcl_IncrRefCount(ov); Tcl_AppendStringsToObj(ov, "-", version, NULL); version = NULL; argv3 = TclGetString(objv[3]); + Tcl_IncrRefCount(objv[3]); - Tcl_IncrRefCount(ov); - res = Tcl_PkgRequireProc(interp, argv3, 1, &ov, NULL); - TclDecrRefCount(ov); - return res; + objvListPtr = Tcl_NewListObj(0, NULL); + Tcl_IncrRefCount(objvListPtr); + Tcl_ListObjAppendElement(interp, objvListPtr, ov); + Tcl_ListObjGetElements(interp, objvListPtr, &newobjc, &newObjvPtr); + + Tcl_NRAddCallback(interp, TclNRPackageObjCmdCleanup, objv[3], objvListPtr, NULL, NULL); + Tcl_NRAddCallback(interp, PkgRequireCore, (void *)argv3, INT2PTR(newobjc), newObjvPtr, NULL); + return TCL_OK; } else { + int i, newobjc = objc-3; + Tcl_Obj *const *newobjv = objv + 3; if (CheckAllRequirements(interp, objc-3, objv+3) != TCL_OK) { return TCL_ERROR; } + objvListPtr = Tcl_NewListObj(0, NULL); + Tcl_IncrRefCount(objvListPtr); + Tcl_IncrRefCount(objv[2]); + for (i = 0; i < newobjc; i++) { - return Tcl_PkgRequireProc(interp, argv2, objc-3, objv+3, NULL); + /* + * Tcl_Obj structures may have come from another interpreter, + * so duplicate them. + */ + + Tcl_ListObjAppendElement(interp, objvListPtr, Tcl_DuplicateObj(newobjv[i])); + } + Tcl_ListObjGetElements(interp, objvListPtr, &newobjc, &newObjvPtr); + Tcl_NRAddCallback(interp, TclNRPackageObjCmdCleanup, objv[2], objvListPtr, NULL, NULL); + Tcl_NRAddCallback(interp, PkgRequireCore, (void *)argv2, INT2PTR(newobjc), newObjvPtr, NULL); + return TCL_OK; } break; case PKG_UNKNOWN: { @@ -1318,6 +1421,13 @@ Tcl_PackageObjCmd( } return TCL_OK; } + +static int +TclNRPackageObjCmdCleanup(ClientData data[], Tcl_Interp *interp, int result) { + TclDecrRefCount((Tcl_Obj *)data[0]); + TclDecrRefCount((Tcl_Obj *)data[1]); + return result; +} /* *---------------------------------------------------------------------- diff --git a/tests/package.test b/tests/package.test index bb938b8..2843701 100644 --- a/tests/package.test +++ b/tests/package.test @@ -625,6 +625,18 @@ test pkg-3.53 {Tcl_PkgRequire procedure, picking best stable version} -constrain package require t set x } -result {1.1} +test package-3.54 {Tcl_PkgRequire procedure, coroutine support} -setup { + package forget t +} -body { + coroutine coro1 apply {{} { + package ifneeded t 2.1 { + yield + package provide t 2.1 + } + package require t 2.1 + }} + list [catch {coro1} msg] $msg +} -match glob -result {0 2.1} test package-4.1 {Tcl_PackageCmd procedure} -returnCodes error -body { -- cgit v0.12 From 25fcbf685dbd09f24d7d45c8c6b90ed3c33eab17 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Feb 2018 17:26:40 +0000 Subject: Rename TclStringFind to TclStringFirst. Repair its operations on bytearrays. Stop trying to operate on utf-8 until we nail that down better. --- generic/tclCmdMZ.c | 10 +------- generic/tclExecute.c | 2 +- generic/tclInt.h | 4 ++-- generic/tclStringObj.c | 63 +++++++++++++++++++++++--------------------------- 4 files changed, 33 insertions(+), 46 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index f9e404b..5d49d2a 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1335,16 +1335,8 @@ StringFirstCmd( if (TCL_OK != TclGetIntForIndexM(interp, objv[3], size - 1, &start)) { return TCL_ERROR; } - - if (start < 0) { - start = 0; - } - if (start >= size) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(-1)); - return TCL_OK; - } } - Tcl_SetObjResult(interp, Tcl_NewIntObj(TclStringFind(objv[1], + Tcl_SetObjResult(interp, Tcl_NewIntObj(TclStringFirst(objv[1], objv[2], start))); return TCL_OK; } diff --git a/generic/tclExecute.c b/generic/tclExecute.c index a30ec89..679b57a 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -5715,7 +5715,7 @@ TEBCresume( NEXT_INST_V(1, 3, 1); case INST_STR_FIND: - match = TclStringFind(OBJ_UNDER_TOS, OBJ_AT_TOS, 0); + match = TclStringFirst(OBJ_UNDER_TOS, OBJ_AT_TOS, 0); TRACE(("%.20s %.20s => %d\n", O2S(OBJ_UNDER_TOS), O2S(OBJ_AT_TOS), match)); diff --git a/generic/tclInt.h b/generic/tclInt.h index 6cb9955..f288a3a 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3189,8 +3189,6 @@ MODULE_SCOPE void TclSpellFix(Tcl_Interp *interp, Tcl_Obj *bad, Tcl_Obj *fix); MODULE_SCOPE void * TclStackRealloc(Tcl_Interp *interp, void *ptr, int numBytes); -MODULE_SCOPE int TclStringFind(Tcl_Obj *needle, Tcl_Obj *haystack, - int start); MODULE_SCOPE int TclStringLast(Tcl_Obj *needle, Tcl_Obj *haystack, int last); MODULE_SCOPE int TclStringMatch(const char *str, int strLen, @@ -4009,6 +4007,8 @@ MODULE_SCOPE int TclCompileAssembleCmd(Tcl_Interp *interp, MODULE_SCOPE Tcl_Obj * TclStringCat(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags); +MODULE_SCOPE int TclStringFirst(Tcl_Obj *needle, Tcl_Obj *haystack, + int start); MODULE_SCOPE Tcl_Obj * TclStringRepeat(Tcl_Interp *interp, Tcl_Obj *objPtr, int count, int flags); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 46162ff..bb72acd 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3199,7 +3199,7 @@ TclStringCat( /* *--------------------------------------------------------------------------- * - * TclStringFind -- + * TclStringFirst -- * * Implements the [string first] operation. * @@ -3215,20 +3215,20 @@ TclStringCat( */ int -TclStringFind( +TclStringFirst( Tcl_Obj *needle, Tcl_Obj *haystack, int start) { int lh, ln = Tcl_GetCharLength(needle); + if (start < 0) { + start = 0; + } if (ln == 0) { - /* - * We don't find empty substrings. Bizarre! - * - * TODO: When we one day make this a true substring - * finder, change this to "return 0" - */ + /* We don't find empty substrings. Bizarre! + * Whenever this routine is turned into a proper substring + * finder, change to `return start` after limits imposed. */ return -1; } @@ -3236,51 +3236,46 @@ TclStringFind( unsigned char *end, *try, *bh; unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln); + /* Find bytes in bytes */ bh = Tcl_GetByteArrayFromObj(haystack, &lh); end = bh + lh; try = bh + start; while (try + ln <= end) { - try = memchr(try, bn[0], end - try); - + /* + * Look for the leading byte of the needle in the haystack + * starting at try and stopping when there's not enough room + * for the needle left. + */ + try = memchr(try, bn[0], (end + 1 - ln) - try); if (try == NULL) { + /* Leading byte not found -> needle cannot be found. */ return -1; } + /* Leading byte found, check rest of needle. */ if (0 == memcmp(try+1, bn+1, ln-1)) { + /* Checks! Return the successful index. */ return (try - bh); } + /* Rest of needle match failed; Iterate to continue search. */ try++; } return -1; } /* - * Check if we have two strings of single-byte characters. If we have, we - * can use strstr() to do the search. Note that we can sometimes have - * multibyte characters when the string could be minimally represented - * using single byte characters; we can't assume that a mismatch here - * means no match. + * TODO: It might be nice to support some cases where it is not + * necessary to shimmer to &tclStringType to compute the result, + * and instead operate just on the objPtr->bytes values directly. + * However, we also do not want the answer to change based on the + * code pathway, or if it does we want that to be for some values + * we explicitly decline to support. Getting there will involve + * locking down in practice more firmly just what encodings produce + * what supported results for the objPtr->bytes values. For now, + * do only the well-defined Tcl_UniChar array search. */ - lh = Tcl_GetCharLength(haystack); - if (haystack->bytes && (lh == haystack->length) && needle->bytes - && (ln == needle->length)) { - /* - * Both haystack and needle are all single-byte chars. - */ - - char *found = strstr(haystack->bytes + start, needle->bytes); - - if (found) { - return (found - haystack->bytes); - } else { - return -1; - } - } else { - /* - * Do the search on the unicode representation for simplicity. - */ - + { Tcl_UniChar *try, *end, *uh; Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); -- cgit v0.12 From 99ca63a80a648b2e65a9b54be78022e5cd161307 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Feb 2018 18:33:41 +0000 Subject: TclStringLast fixed. --- generic/tclCmdMZ.c | 8 -------- generic/tclStringObj.c | 48 ++++++++++-------------------------------------- 2 files changed, 10 insertions(+), 46 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 5d49d2a..03b254d 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -1380,14 +1380,6 @@ StringLastCmd( if (TCL_OK != TclGetIntForIndexM(interp, objv[3], size - 1, &last)) { return TCL_ERROR; } - - if (last < 0) { - Tcl_SetObjResult(interp, Tcl_NewIntObj(-1)); - return TCL_OK; - } - if (last >= size) { - last = size - 1; - } } Tcl_SetObjResult(interp, Tcl_NewIntObj(TclStringLast(objv[1], objv[2], last))); diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index bb72acd..4481818 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3323,24 +3323,24 @@ TclStringLast( * We don't find empty substrings. Bizarre! * * TODO: When we one day make this a true substring - * finder, change this to "return 0" + * finder, change this to "return last", after limitation. */ return -1; } - if (ln > last + 1) { + lh = Tcl_GetCharLength(haystack); + if (last >= lh) { + last = lh - 1; + } + + if (last < ln - 1) { return -1; } if (TclIsPureByteArray(needle) && TclIsPureByteArray(haystack)) { - unsigned char *try, *bh; + unsigned char *try, *bh = Tcl_GetByteArrayFromObj(haystack, &lh); unsigned char *bn = Tcl_GetByteArrayFromObj(needle, &ln); - bh = Tcl_GetByteArrayFromObj(haystack, &lh); - - if (last + 1 > lh) { - last = lh - 1; - } try = bh + last + 1 - ln; while (try >= bh) { if ((*try == bn[0]) @@ -3352,38 +3352,10 @@ TclStringLast( return -1; } - lh = Tcl_GetCharLength(haystack); - if (last + 1 > lh) { - last = lh - 1; - } - if (haystack->bytes && (lh == haystack->length)) { - /* haystack is all single-byte chars */ - - if (needle->bytes && (ln == needle->length)) { - /* needle is also all single-byte chars */ - - char *try = haystack->bytes + last + 1 - ln; - while (try >= haystack->bytes) { - if ((*try == needle->bytes[0]) - && (0 == memcmp(try+1, needle->bytes + 1, ln - 1))) { - return (try - haystack->bytes); - } - try--; - } - return -1; - } else { - /* - * Cannot find substring with a multi-byte char inside - * a string with no multi-byte chars. - */ - return -1; - } - } else { - Tcl_UniChar *try, *uh; + { + Tcl_UniChar *try, *uh = Tcl_GetUnicodeFromObj(haystack, &lh); Tcl_UniChar *un = Tcl_GetUnicodeFromObj(needle, &ln); - uh = Tcl_GetUnicodeFromObj(haystack, &lh); - try = uh + last + 1 - ln; while (try >= uh) { if ((*try == un[0]) -- cgit v0.12 From fde3c52d294c62edfd6aa2735c4244bd1b763b83 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 6 Feb 2018 19:10:45 +0000 Subject: Rework TclStringReverse to consistent standard form. --- generic/tclCmdMZ.c | 2 +- generic/tclInt.h | 6 +++--- generic/tclStringObj.c | 20 +++++++++++--------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index 03b254d..ed4312e 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -2382,7 +2382,7 @@ StringRevCmd( return TCL_ERROR; } - Tcl_SetObjResult(interp, TclStringObjReverse(objv[1])); + Tcl_SetObjResult(interp, TclStringReverse(objv[1], TCL_STRING_IN_PLACE)); return TCL_OK; } diff --git a/generic/tclInt.h b/generic/tclInt.h index f288a3a..f8149be 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -3189,13 +3189,10 @@ MODULE_SCOPE void TclSpellFix(Tcl_Interp *interp, Tcl_Obj *bad, Tcl_Obj *fix); MODULE_SCOPE void * TclStackRealloc(Tcl_Interp *interp, void *ptr, int numBytes); -MODULE_SCOPE int TclStringLast(Tcl_Obj *needle, Tcl_Obj *haystack, - int last); MODULE_SCOPE int TclStringMatch(const char *str, int strLen, const char *pattern, int ptnLen, int flags); MODULE_SCOPE int TclStringMatchObj(Tcl_Obj *stringObj, Tcl_Obj *patternObj, int flags); -MODULE_SCOPE Tcl_Obj * TclStringObjReverse(Tcl_Obj *objPtr); MODULE_SCOPE void TclSubstCompile(Tcl_Interp *interp, const char *bytes, int numBytes, int flags, int line, struct CompileEnv *envPtr); @@ -4009,8 +4006,11 @@ MODULE_SCOPE Tcl_Obj * TclStringCat(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], int flags); MODULE_SCOPE int TclStringFirst(Tcl_Obj *needle, Tcl_Obj *haystack, int start); +MODULE_SCOPE int TclStringLast(Tcl_Obj *needle, Tcl_Obj *haystack, + int last); MODULE_SCOPE Tcl_Obj * TclStringRepeat(Tcl_Interp *interp, Tcl_Obj *objPtr, int count, int flags); +MODULE_SCOPE Tcl_Obj * TclStringReverse(Tcl_Obj *objPtr, int flags); /* Flag values for the [string] ensemble functions. */ diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 4481818..9526f7e 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -3371,14 +3371,14 @@ TclStringLast( /* *--------------------------------------------------------------------------- * - * TclStringObjReverse -- + * TclStringReverse -- * * Implements the [string reverse] operation. * * Results: - * An unshared Tcl value which is the [string reverse] of the argument - * supplied. When sharing rules permit, the returned value might be the - * argument with modifications done in place. + * A Tcl value which is the [string reverse] of the argument supplied. + * When sharing rules permit and the caller requests, the returned value + * might be the argument with modifications done in place. * * Side effects: * May allocate a new Tcl_Obj. @@ -3409,17 +3409,19 @@ ReverseBytes( } Tcl_Obj * -TclStringObjReverse( - Tcl_Obj *objPtr) +TclStringReverse( + Tcl_Obj *objPtr, + int flags) { String *stringPtr; Tcl_UniChar ch = 0; + int inPlace = flags & TCL_STRING_IN_PLACE; if (TclIsPureByteArray(objPtr)) { int numBytes; unsigned char *from = Tcl_GetByteArrayFromObj(objPtr, &numBytes); - if (Tcl_IsShared(objPtr)) { + if (!inPlace || Tcl_IsShared(objPtr)) { objPtr = Tcl_NewByteArrayObj(NULL, numBytes); } ReverseBytes(Tcl_GetByteArrayFromObj(objPtr, NULL), from, numBytes); @@ -3433,7 +3435,7 @@ TclStringObjReverse( Tcl_UniChar *from = Tcl_GetUnicode(objPtr); Tcl_UniChar *src = from + stringPtr->numChars; - if (Tcl_IsShared(objPtr)) { + if (!inPlace || Tcl_IsShared(objPtr)) { Tcl_UniChar *to; /* @@ -3462,7 +3464,7 @@ TclStringObjReverse( int numBytes = objPtr->length; char *to, *from = objPtr->bytes; - if (Tcl_IsShared(objPtr)) { + if (!inPlace || Tcl_IsShared(objPtr)) { objPtr = Tcl_NewObj(); Tcl_SetObjLength(objPtr, numBytes); } -- cgit v0.12 From 3f2c5cd5aa8381ad73336403f1ff98a52230726f Mon Sep 17 00:00:00 2001 From: oehhar Date: Wed, 7 Feb 2018 19:25:30 +0000 Subject: TIP 499: Custom locale search for msgcat --- changes | 3 + library/msgcat/msgcat.tcl | 130 ++++++++++++++++++++++++++++++++------------ library/msgcat/pkgIndex.tcl | 2 +- tests/msgcat.test | 53 +++++++++++++++++- unix/Makefile.in | 4 +- win/Makefile.in | 4 +- 6 files changed, 154 insertions(+), 42 deletions(-) mode change 100644 => 100755 changes mode change 100644 => 100755 library/msgcat/msgcat.tcl mode change 100644 => 100755 library/msgcat/pkgIndex.tcl mode change 100644 => 100755 tests/msgcat.test mode change 100644 => 100755 unix/Makefile.in mode change 100644 => 100755 win/Makefile.in diff --git a/changes b/changes old mode 100644 new mode 100755 index f89704b..120f9ff --- a/changes +++ b/changes @@ -8879,3 +8879,6 @@ in this changeset (new minor version) rather than bug fixes: 2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter) --- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tcl/ for details + +2018-02-07 (TIP 499) custom locale preference list (nijtmans) +=> msgcat 1.7.0 diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl old mode 100644 new mode 100755 index 646bc17..0f8f9b3 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -14,11 +14,11 @@ package require Tcl 8.5- # When the version number changes, be sure to update the pkgIndex.tcl file, # and the installation directory in the Makefiles. -package provide msgcat 1.6.1 +package provide msgcat 1.7.0 namespace eval msgcat { - namespace export mc mcexists mcload mclocale mcmax mcmset mcpreferences mcset\ - mcunknown mcflset mcflmset mcloadedlocales mcforgetpackage\ + namespace export mc mcexists mcload mclocale mcmax mcmset mcpreferences\ + mcset mcunknown mcflset mcflmset mcloadedlocales mcforgetpackage\ mcpackageconfig mcpackagelocale # Records the list of locales to search @@ -303,14 +303,7 @@ proc msgcat::mclocale {args} { return -code error "invalid newLocale value \"$newLocale\":\ could be path to unsafe code." } - if {[lindex $Loclist 0] ne $newLocale} { - set Loclist [GetPreferences $newLocale] - - # locale not loaded jet - LoadAll $Loclist - # Invoke callback - Invoke changecmd $Loclist - } + mcpreferences {*}[GetPreferences $newLocale] } return [lindex $Loclist 0] } @@ -349,16 +342,51 @@ proc msgcat::GetPreferences {locale} { # most preferred to least preferred. # # Arguments: -# None. +# New location list # # Results: # Returns an ordered list of the locales preferred by the user. -proc msgcat::mcpreferences {} { +proc msgcat::mcpreferences {args} { variable Loclist + + if {[llength $args] > 0} { + # args is the new loclist + if {![ListEqualString $args $Loclist]} { + set Loclist $args + + # locale not loaded jet + LoadAll $Loclist + # Invoke callback + Invoke changecmd $Loclist + } + } return $Loclist } +# msgcat::ListStringEqual -- +# +# Compare two strings for equal string contents +# +# Arguments: +# list1 first list +# list2 second list +# +# Results: +# 1 if lists of strings are identical, 0 otherwise + +proc msgcat::ListEqualString {list1 list2} { + if {[llength $list1] != [llength $list2]} { + return 0 + } + foreach item1 $list1 item2 $list2 { + if {$item1 ne $item2} { + return 0 + } + } + return 1 +} + # msgcat::mcloadedlocales -- # # Get or change the list of currently loaded default locales @@ -442,7 +470,7 @@ proc msgcat::mcloadedlocales {subcommand} { # Results: # Empty string, if not stated differently for the subcommand -proc msgcat::mcpackagelocale {subcommand {locale ""}} { +proc msgcat::mcpackagelocale {subcommand args} { # todo: implement using an ensemble variable Loclist variable LoadedLocales @@ -450,27 +478,39 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { variable PackageConfig # Check option # check if required item is exactly provided - if {[llength [info level 0]] == 2} { - # locale not given - unset locale - } else { - # locale given - if {$subcommand in - {"get" "isset" "unset" "preferences" "loaded" "clear"} } { - return -code error "wrong # args: should be\ - \"[lrange [info level 0] 0 1]\"" - } - set locale [string tolower $locale] + if { [llength $args] > 0 + && $subcommand in {"get" "isset" "unset" "loaded" "clear"} } { + return -code error "wrong # args: should be\ + \"[lrange [info level 0] 0 1]\"" } set ns [uplevel 1 {::namespace current}] switch -exact -- $subcommand { get { return [lindex [PackagePreferences $ns] 0] } - preferences { return [PackagePreferences $ns] } loaded { return [PackageLocales $ns] } - present { return [expr {$locale in [PackageLocales $ns]} ]} + present { + if {[llength $args] != 1} { + return -code error "wrong # args: should be\ + \"[lrange [info level 0] 0 1] locale\"" + } + return [expr {[string tolower [lindex $args 0]] + in [PackageLocales $ns]} ] + } isset { return [dict exists $PackageConfig loclist $ns] } - set { # set a package locale or add a package locale + set - preferences { + # set a package locale or add a package locale + set fSet [expr {$subcommand eq "set"}] + + # Check parameter + if {$fSet && 1 < [llength $args] } { + return -code error "wrong # args: should be\ + \"[lrange [info level 0] 0 1] ?locale?\"" + } + + # > Return preferences if no parameter + if {!$fSet && 0 == [llength $args] } { + return [PackagePreferences $ns] + } # Copy the default locale if no package locale set so far if {![dict exists $PackageConfig loclist $ns]} { @@ -478,25 +518,43 @@ proc msgcat::mcpackagelocale {subcommand {locale ""}} { dict set PackageConfig loadedlocales $ns $LoadedLocales } - # Check if changed - set loclist [dict get $PackageConfig loclist $ns] - if {! [info exists locale] || $locale eq [lindex $loclist 0] } { - return [lindex $loclist 0] + # No argument for set: return current package locale + # The difference to no argument and subcommand "preferences" is, + # that "preferences" does not set the package locale property. + # This case is processed above, so no check for fSet here + if { 0 == [llength $args] } { + return [lindex [dict get $PackageConfig loclist $ns] 0] + } + + # Get new loclist + if {$fSet} { + set loclist [GetPreferences [string tolower [lindex $args 0]]] + } else { + set loclist $args + } + + # Check if not changed to return imediately + if { [ListEqualString $loclist\ + [dict get $PackageConfig loclist $ns]] } { + if {$fSet} { + return [lindex $loclist 0] + } + return $loclist } # Change loclist - set loclist [GetPreferences $locale] - set locale [lindex $loclist 0] dict set PackageConfig loclist $ns $loclist # load eventual missing locales set loadedLocales [dict get $PackageConfig loadedlocales $ns] - if {$locale in $loadedLocales} { return $locale } set loadLocales [ListComplement $loadedLocales $loclist] dict set PackageConfig loadedlocales $ns\ [concat $loadedLocales $loadLocales] Load $ns $loadLocales - return $locale + if {$fSet} { + return [lindex $loclist 0] + } + return $loclist } clear { # Remove all locales not contained in Loclist if {![dict exists $PackageConfig loclist $ns]} { diff --git a/library/msgcat/pkgIndex.tcl b/library/msgcat/pkgIndex.tcl old mode 100644 new mode 100755 index 72c5dc0..fe3b3a1 --- a/library/msgcat/pkgIndex.tcl +++ b/library/msgcat/pkgIndex.tcl @@ -1,2 +1,2 @@ if {![package vsatisfies [package provide Tcl] 8.5-]} {return} -package ifneeded msgcat 1.6.1 [list source [file join $dir msgcat.tcl]] +package ifneeded msgcat 1.7.0 [list source [file join $dir msgcat.tcl]] diff --git a/tests/msgcat.test b/tests/msgcat.test old mode 100644 new mode 100755 index 1c3ce58..b0d2bd3 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -194,6 +194,28 @@ namespace eval ::msgcat::test { mclocale looks/ok/../../../../but/is/path/to/evil/code } -returnCodes error -match glob -result {invalid newLocale value *} + test msgcat-1.14 {mcpreferences, custom locale preferences} -setup { + variable locale [mclocale] + mclocale en + mcpreferences fr en {} + } -cleanup { + mclocale $locale + } -body { + mcpreferences + } -result {fr en {}} + + test msgcat-1.15 {mcpreferences, overwrite custom locale preferences}\ + -setup { + variable locale [mclocale] + mcpreferences fr en {} + mclocale en + } -cleanup { + mclocale $locale + } -body { + mcpreferences + } -result {en {}} + + # Tests msgcat-2.*: [mcset], [mcmset], namespace partitioning test msgcat-2.1 {mcset, global scope} { @@ -811,13 +833,18 @@ namespace eval ::msgcat::test { test msgcat-12.1 {mcpackagelocale no subcommand} -body { mcpackagelocale } -returnCodes 1\ - -result {wrong # args: should be "mcpackagelocale subcommand ?locale?"} + -result {wrong # args: should be "mcpackagelocale subcommand ?arg ...?"} test msgcat-12.2 {mclpackagelocale wrong subcommand} -body { mcpackagelocale junk } -returnCodes 1\ -result {unknown subcommand "junk": must be clear, get, isset, loaded, present, set, or unset} + test msgcat-12.2.1 {mclpackagelocale set multiple args} -body { + mcpackagelocale set a b + } -returnCodes 1\ + -result {wrong # args: should be "mcpackagelocale set ?locale?"} + test msgcat-12.3 {mcpackagelocale set} -setup { variable locale [mclocale] } -cleanup { @@ -922,6 +949,30 @@ namespace eval ::msgcat::test { list [mcpackagelocale present foo] [mcpackagelocale present bar] } -result {0 1} + test msgcat-12.11 {mcpackagelocale custom preferences} -setup { + variable locale [mclocale] + } -cleanup { + mclocale $locale + mcforgetpackage + } -body { + mclocale foo + set res [list [mcpackagelocale preferences]] + mcpackagelocale preferences bar {} + lappend res [mcpackagelocale preferences] + } -result {{foo {}} {bar {}}} + + test msgcat-12.12 {mcpackagelocale preferences -> no isset} -setup { + variable locale [mclocale] + } -cleanup { + mclocale $locale + mcforgetpackage + } -body { + mclocale foo + mcpackagelocale preferences + mcpackagelocale isset + } -result {0} + + # Tests msgcat-13.*: [mcpackageconfig subcmds] test msgcat-13.1 {mcpackageconfig no subcommand} -body { diff --git a/unix/Makefile.in b/unix/Makefile.in old mode 100644 new mode 100755 index 244ad29..4487ff5 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -850,8 +850,8 @@ install-libraries: libraries do \ $(INSTALL_DATA) $$i "$(SCRIPT_INSTALL_DIR)"/opt0.4; \ done; - @echo "Installing package msgcat 1.6.1 as a Tcl Module"; - @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.6.1.tm; + @echo "Installing package msgcat 1.7.0 as a Tcl Module"; + @$(INSTALL_DATA) $(TOP_DIR)/library/msgcat/msgcat.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/msgcat-1.7.0.tm; @echo "Installing package tcltest 2.4.1 as a Tcl Module"; @$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl "$(SCRIPT_INSTALL_DIR)"/../tcl8/8.5/tcltest-2.4.1.tm; diff --git a/win/Makefile.in b/win/Makefile.in old mode 100644 new mode 100755 index 5be7492..e5e2384 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -659,8 +659,8 @@ install-libraries: libraries install-tzdata install-msgs do \ $(COPY) "$$j" "$(SCRIPT_INSTALL_DIR)/opt0.4"; \ done; - @echo "Installing package msgcat 1.6.1 as a Tcl Module"; - @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.6.1.tm; + @echo "Installing package msgcat 1.7.0 as a Tcl Module"; + @$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/msgcat-1.7.0.tm; @echo "Installing package tcltest 2.4.0 as a Tcl Module"; @$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl $(SCRIPT_INSTALL_DIR)/../tcl8/8.5/tcltest-2.4.0.tm; @echo "Installing package platform 1.0.14 as a Tcl Module"; -- cgit v0.12 From 4cff9271ac34377ccf2717fcb47f3c0adc8b58ee Mon Sep 17 00:00:00 2001 From: oehhar Date: Thu, 8 Feb 2018 09:49:28 +0000 Subject: Add subcommand mcpreferences to export getpreferences and getsystemlocale functions --- library/msgcat/msgcat.tcl | 54 ++++++++++++++++++++++++----------------------- tests/msgcat.test | 35 ++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 26 deletions(-) diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 0f8f9b3..8fcbefb 100755 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -19,7 +19,7 @@ package provide msgcat 1.7.0 namespace eval msgcat { namespace export mc mcexists mcload mclocale mcmax mcmset mcpreferences\ mcset mcunknown mcflset mcflmset mcloadedlocales mcforgetpackage\ - mcpackageconfig mcpackagelocale + mcpackageconfig mcpackagelocale mcutil # Records the list of locales to search variable Loclist {} @@ -41,7 +41,13 @@ namespace eval msgcat { # namespace should be themselves dict values and the value is # the translated string. variable Msgs [dict create] +} +# create ensemble namespace for mcutil command +namespace eval msgcat::mcutil { + namespace export getsystemlocale getpreferences + namespace ensemble create + # Map of language codes used in Windows registry to those of ISO-639 if {[info sharedlibextension] eq ".dll"} { variable WinRegToISO639 [dict create {*}{ @@ -303,25 +309,27 @@ proc msgcat::mclocale {args} { return -code error "invalid newLocale value \"$newLocale\":\ could be path to unsafe code." } - mcpreferences {*}[GetPreferences $newLocale] + mcpreferences {*}[mcutil getpreferences $newLocale] } return [lindex $Loclist 0] } -# msgcat::GetPreferences -- +# msgcat::mcutil::getpreferences -- # # Get list of locales from a locale. # The first element is always the lowercase locale. # Other elements have one component separated by "_" less. # Multiple "_" are seen as one separator: de__ch_spec de__ch de {} # +# This method is part of the ensemble mcutil +# # Arguments: # Locale. # # Results: # Locale list -proc msgcat::GetPreferences {locale} { +proc msgcat::mcutil::getpreferences {locale} { set locale [string tolower $locale] set loclist [list $locale] while {-1 !=[set pos [string last "_" $locale]]} { @@ -528,7 +536,7 @@ proc msgcat::mcpackagelocale {subcommand args} { # Get new loclist if {$fSet} { - set loclist [GetPreferences [string tolower [lindex $args 0]]] + set loclist [mcutil getpreferences [lindex $args 0]] } else { set loclist $args } @@ -1137,7 +1145,7 @@ proc msgcat::mcmax {args} { # Convert the locale values stored in environment variables to a form # suitable for passing to [mclocale] -proc msgcat::ConvertLocale {value} { +proc msgcat::mcutil::ConvertLocale {value} { # Assume $value is of form: $language[_$territory][.$codeset][@modifier] # Convert to form: $language[_$territory][_$modifier] # @@ -1165,7 +1173,7 @@ proc msgcat::ConvertLocale {value} { } # Initialize the default locale -proc msgcat::Init {} { +proc msgcat::mcutil::getsystemlocale {} { global env # @@ -1173,10 +1181,8 @@ proc msgcat::Init {} { # foreach varName {LC_ALL LC_MESSAGES LANG} { if {[info exists env($varName)] && ("" ne $env($varName))} { - if {![catch { - mclocale [ConvertLocale $env($varName)] - }]} { - return + if {![catch { ConvertLocale $env($varName) } locale]} { + return $locale } } } @@ -1184,10 +1190,8 @@ proc msgcat::Init {} { # On Darwin, fallback to current CFLocale identifier if available. # if {[info exists ::tcl::mac::locale] && $::tcl::mac::locale ne ""} { - if {![catch { - mclocale [ConvertLocale $::tcl::mac::locale] - }]} { - return + if {![catch { ConvertLocale $::tcl::mac::locale] } locale]} { + return $locale } } # @@ -1196,8 +1200,7 @@ proc msgcat::Init {} { # if {([info sharedlibextension] ne ".dll") || [catch {package require registry}]} { - mclocale C - return + return C } # # On Windows or Cygwin, try to set locale depending on registry @@ -1228,8 +1231,8 @@ proc msgcat::Init {} { if {[dict exists $modifierDict $script]} { append locale @ [dict get $modifierDict $script] } - if {![catch {mclocale [ConvertLocale $locale]}]} { - return + if {![catch {ConvertLocale $locale} locale]} { + return $locale } } } @@ -1238,8 +1241,7 @@ proc msgcat::Init {} { if {[catch { set locale [registry get $key "locale"] }]} { - mclocale C - return + return C } # # Keep trying to match against smaller and smaller suffixes @@ -1254,15 +1256,15 @@ proc msgcat::Init {} { set locale [string tolower $locale] while {[string length $locale]} { if {![catch { - mclocale [ConvertLocale [dict get $WinRegToISO639 $locale]] - }]} { - return + ConvertLocale [dict get $WinRegToISO639 $locale] + } localeOut]} { + return $localeOut } set locale [string range $locale 1 end] } # # No translation known. Fall back on "C" locale # - mclocale C + return C } -msgcat::Init +msgcat::mclocale [msgcat::mcutil getsystemlocale] diff --git a/tests/msgcat.test b/tests/msgcat.test index b0d2bd3..7a095a6 100755 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -1126,6 +1126,41 @@ namespace eval ::msgcat::test { interp bgerror {} $bgerrorsaved + # Tests msgcat-15.*: [mcutil] + + test msgcat-15.1 {mcutil - no argument} -body { + mcutil + } -returnCodes 1\ + -result {wrong # args: should be "mcutil subcommand ?arg ...?"} + + test msgcat-15.2 {mcutil - wrong argument} -body { + mcutil junk + } -returnCodes 1\ + -result {unknown or ambiguous subcommand "junk": must be getpreferences, or getsystemlocale} + + test msgcat-15.3 {mcutil getpreferences - no argument} -body { + mcutil getpreferences + } -returnCodes 1\ + -result {wrong # args: should be "mcutil getpreferences locale"} + + test msgcat-15.4 {mcutil getpreferences - DE_de} -body { + mcutil getpreferences DE_de + } -result {de_de de {}} + + test msgcat-15.5 {mcutil getsystemlocale - wrong argument} -body { + mcutil getsystemlocale DE_de + } -returnCodes 1\ + -result {wrong # args: should be "mcutil getsystemlocale"} + + # The result is system dependent + # So just test if it runs + # The environment variable version was test with test 0.x + test msgcat-15.6 {mcutil getsystemlocale} -body { + mcutil getsystemlocale + set ok ok + } -result {ok} + + cleanupTests } namespace delete ::msgcat::test -- cgit v0.12 From ffae8c82da5227389ee81c50b5e22bc7678ed2f0 Mon Sep 17 00:00:00 2001 From: oehhar Date: Thu, 8 Feb 2018 12:45:50 +0000 Subject: Do not allow prefixed subcommands for mcutil --- library/msgcat/msgcat.tcl | 2 +- tests/msgcat.test | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl index 8fcbefb..3047e4d 100755 --- a/library/msgcat/msgcat.tcl +++ b/library/msgcat/msgcat.tcl @@ -46,7 +46,7 @@ namespace eval msgcat { # create ensemble namespace for mcutil command namespace eval msgcat::mcutil { namespace export getsystemlocale getpreferences - namespace ensemble create + namespace ensemble create -prefix 0 # Map of language codes used in Windows registry to those of ISO-639 if {[info sharedlibextension] eq ".dll"} { diff --git a/tests/msgcat.test b/tests/msgcat.test index 7a095a6..847836b 100755 --- a/tests/msgcat.test +++ b/tests/msgcat.test @@ -1136,18 +1136,23 @@ namespace eval ::msgcat::test { test msgcat-15.2 {mcutil - wrong argument} -body { mcutil junk } -returnCodes 1\ - -result {unknown or ambiguous subcommand "junk": must be getpreferences, or getsystemlocale} + -result {unknown subcommand "junk": must be getpreferences, or getsystemlocale} - test msgcat-15.3 {mcutil getpreferences - no argument} -body { + test msgcat-15.3 {mcutil - partial argument} -body { + mcutil getsystem + } -returnCodes 1\ + -result {unknown subcommand "getsystem": must be getpreferences, or getsystemlocale} + + test msgcat-15.4 {mcutil getpreferences - no argument} -body { mcutil getpreferences } -returnCodes 1\ -result {wrong # args: should be "mcutil getpreferences locale"} - test msgcat-15.4 {mcutil getpreferences - DE_de} -body { + test msgcat-15.5 {mcutil getpreferences - DE_de} -body { mcutil getpreferences DE_de } -result {de_de de {}} - test msgcat-15.5 {mcutil getsystemlocale - wrong argument} -body { + test msgcat-15.6 {mcutil getsystemlocale - wrong argument} -body { mcutil getsystemlocale DE_de } -returnCodes 1\ -result {wrong # args: should be "mcutil getsystemlocale"} @@ -1155,7 +1160,7 @@ namespace eval ::msgcat::test { # The result is system dependent # So just test if it runs # The environment variable version was test with test 0.x - test msgcat-15.6 {mcutil getsystemlocale} -body { + test msgcat-15.7 {mcutil getsystemlocale} -body { mcutil getsystemlocale set ok ok } -result {ok} -- cgit v0.12 From 4f65558ad0db79e70b4629d6f96d7cdd09e656a3 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 8 Feb 2018 14:02:15 +0000 Subject: win/nmakehlp.c: removed unneeded dependencies to shlwapi (the same is easily implemented by standard win-api) --- win/nmakehlp.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 025bb99..b759020 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -14,13 +14,8 @@ #define _CRT_SECURE_NO_DEPRECATE #include -#define NO_SHLWAPI_GDI -#define NO_SHLWAPI_STREAM -#define NO_SHLWAPI_REG -#include #pragma comment (lib, "user32.lib") #pragma comment (lib, "kernel32.lib") -#pragma comment (lib, "shlwapi.lib") #include #include @@ -74,7 +69,7 @@ main( char msg[300]; DWORD dwWritten; int chars; - char *s; + const char *s; /* * Make sure children (cl.exe and link.exe) are kept quiet. @@ -688,6 +683,17 @@ SubstituteFile( return 0; } +BOOL FileExists(LPCTSTR szPath) +{ +#ifndef INVALID_FILE_ATTRIBUTES + #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) +#endif + DWORD pathAttr = GetFileAttributes(szPath); + return (pathAttr != INVALID_FILE_ATTRIBUTES && + !(pathAttr & FILE_ATTRIBUTE_DIRECTORY)); +} + + /* * QualifyPath -- * @@ -701,13 +707,8 @@ QualifyPath( const char *szPath) { char szCwd[MAX_PATH + 1]; - char szTmp[MAX_PATH + 1]; - char *p; - GetCurrentDirectory(MAX_PATH, szCwd); - while ((p = strchr(szPath, '/')) && *p) - *p = '\\'; - PathCombine(szTmp, szCwd, szPath); - PathCanonicalize(szCwd, szTmp); + + GetFullPathName(szPath, sizeof(szCwd)-1, szCwd, NULL); printf("%s\n", szCwd); return 0; } @@ -765,7 +766,7 @@ static int LocateDependencyHelper(const char *dir, const char *keypath) strncpy(path+dirlen+1, finfo.cFileName, sublen); path[dirlen+1+sublen] = '\\'; strncpy(path+dirlen+1+sublen+1, keypath, keylen+1); - if (PathFileExists(path)) { + if (FileExists(path)) { /* Found a match, print to stdout */ path[dirlen+1+sublen] = '\0'; QualifyPath(path); -- cgit v0.12 From e2877119cdc85c1a33f3d1e63035343cd4db118e Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 8 Feb 2018 14:41:06 +0000 Subject: fixes [9280abbaf57fca3eb40a89403d9d891853209bb6]: compare of `LLONG_MAX == LONG_MAX` does not possible in preprocessor (because LLONG_MAX could be complex expression), use `defined(TCL_WIDE_INT_IS_LONG)` instead of. --- generic/tclInt.h | 2 +- generic/tclObj.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index fdbe839..e5f5c74 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2453,7 +2453,7 @@ typedef struct List { * WARNING: these macros eval their args more than once. */ -#if (LONG_MAX == LLONG_MAX) +#ifdef TCL_WIDE_INT_IS_LONG #define TclGetLongFromObj(interp, objPtr, longPtr) \ (((objPtr)->typePtr == &tclIntType) \ ? ((*(longPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \ diff --git a/generic/tclObj.c b/generic/tclObj.c index 5f60d9d..8d4c492 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -2764,7 +2764,7 @@ Tcl_GetLongFromObj( register long *longPtr) /* Place to store resulting long. */ { do { -#if (LONG_MAX == LLONG_MAX) +#ifdef TCL_WIDE_INT_IS_LONG if (objPtr->typePtr == &tclIntType) { *longPtr = objPtr->internalRep.wideValue; return TCL_OK; @@ -2827,7 +2827,7 @@ Tcl_GetLongFromObj( return TCL_OK; } } -#if (LONG_MAX != LLONG_MAX) +#ifndef TCL_WIDE_INT_IS_LONG tooLarge: #endif if (interp != NULL) { -- cgit v0.12 From 0031252bf124749bd39e94427d50a954cb3bc762 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 9 Feb 2018 10:09:42 +0000 Subject: small code review: resolve conversion warnings (possible loss of data, signed/unsigned comparison) --- generic/tclDisassemble.c | 4 ++-- generic/tclExecute.c | 2 +- generic/tclGet.c | 2 +- generic/tclInt.h | 4 ++-- generic/tclUtil.c | 2 +- generic/tclVar.c | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index 73b8fb9..7fe92ef 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -817,7 +817,7 @@ static void UpdateStringOfInstName( Tcl_Obj *objPtr) { - int inst = objPtr->internalRep.wideValue; + int inst = (int)objPtr->internalRep.wideValue; char *s, buf[20]; int len; @@ -825,7 +825,7 @@ UpdateStringOfInstName( sprintf(buf, "inst_%d", inst); s = buf; } else { - s = (char *) tclInstructionTable[objPtr->internalRep.wideValue].name; + s = (char *) tclInstructionTable[inst].name; } len = strlen(s); objPtr->bytes = ckalloc(len + 1); diff --git a/generic/tclExecute.c b/generic/tclExecute.c index d36d363..22c6cb5 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -6538,7 +6538,7 @@ TEBCresume( iterVarPtr = LOCAL(infoPtr->loopCtTemp); valuePtr = iterVarPtr->value.objPtr; - iterNum = valuePtr->internalRep.wideValue + 1; + iterNum = (int)valuePtr->internalRep.wideValue + 1; TclSetIntObj(valuePtr, iterNum); /* diff --git a/generic/tclGet.c b/generic/tclGet.c index 727db0a..2d611fa 100644 --- a/generic/tclGet.c +++ b/generic/tclGet.c @@ -142,7 +142,7 @@ Tcl_GetBoolean( Tcl_Panic("invalid sharing of Tcl_Obj on C stack"); } if (code == TCL_OK) { - *boolPtr = obj.internalRep.wideValue; + *boolPtr = (int)obj.internalRep.wideValue; } return code; } diff --git a/generic/tclInt.h b/generic/tclInt.h index e5f5c74..303bdcb 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2471,13 +2471,13 @@ typedef struct List { (((objPtr)->typePtr == &tclIntType \ && (objPtr)->internalRep.wideValue >= -(Tcl_WideInt)(UINT_MAX) \ && (objPtr)->internalRep.wideValue <= (Tcl_WideInt)(UINT_MAX)) \ - ? ((*(intPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \ + ? ((*(intPtr) = (int)(objPtr)->internalRep.wideValue), TCL_OK) \ : Tcl_GetIntFromObj((interp), (objPtr), (intPtr))) #define TclGetIntForIndexM(interp, objPtr, endValue, idxPtr) \ (((objPtr)->typePtr == &tclIntType \ && (objPtr)->internalRep.wideValue >= INT_MIN \ && (objPtr)->internalRep.wideValue <= INT_MAX) \ - ? ((*(idxPtr) = (objPtr)->internalRep.wideValue), TCL_OK) \ + ? ((*(idxPtr) = (int)(objPtr)->internalRep.wideValue), TCL_OK) \ : TclGetIntForIndex((interp), (objPtr), (endValue), (idxPtr))) /* diff --git a/generic/tclUtil.c b/generic/tclUtil.c index b96208e..9557aac 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3585,7 +3585,7 @@ TclGetIntForIndex( * be converted to one, use it. */ - *indexPtr = endValue + objPtr->internalRep.wideValue; + *indexPtr = endValue + (int)objPtr->internalRep.wideValue; return TCL_OK; } diff --git a/generic/tclVar.c b/generic/tclVar.c index 7c8bb73..9405fd5 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -280,7 +280,7 @@ CleanupVar( { if (TclIsVarUndefined(varPtr) && TclIsVarInHash(varPtr) && !TclIsVarTraced(varPtr) - && (VarHashRefCount(varPtr) == !TclIsVarDeadHash(varPtr))) { + && (VarHashRefCount(varPtr) == (unsigned)!TclIsVarDeadHash(varPtr))) { if (VarHashRefCount(varPtr) == 0) { ckfree(varPtr); } else { @@ -289,7 +289,7 @@ CleanupVar( } if (arrayPtr != NULL && TclIsVarUndefined(arrayPtr) && TclIsVarInHash(arrayPtr) && !TclIsVarTraced(arrayPtr) && - (VarHashRefCount(arrayPtr) == !TclIsVarDeadHash(arrayPtr))) { + (VarHashRefCount(arrayPtr) == (unsigned)!TclIsVarDeadHash(arrayPtr))) { if (VarHashRefCount(arrayPtr) == 0) { ckfree(arrayPtr); } else { -- cgit v0.12 From 5765c1e39239c149fc739e8e48b3d554901318e7 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Sun, 11 Feb 2018 19:19:46 +0000 Subject: Refine documentation for Tcl_NR* functions. --- doc/Eval.3 | 8 +- doc/NRE.3 | 260 ++++++++++++++++++++----------------------------------------- 2 files changed, 88 insertions(+), 180 deletions(-) diff --git a/doc/Eval.3 b/doc/Eval.3 index 191bace..e241794 100644 --- a/doc/Eval.3 +++ b/doc/Eval.3 @@ -176,10 +176,10 @@ it is faster to execute the script directly. .TP 23 \fBTCL_EVAL_GLOBAL\fR . -If this flag is set, the script is processed at global level. This -means that it is evaluated in the global namespace and its variable -context consists of global variables only (it ignores any Tcl -procedures that are active). +If this flag is set, the script is evaluated in the global namespace instead of +the current namespace and its variable context consists of global variables +only (it ignores any Tcl procedures that are active). +.\" TODO: document TCL_EVAL_INVOKE and TCL_EVAL_NOERR. .SH "MISCELLANEOUS DETAILS" .PP diff --git a/doc/NRE.3 b/doc/NRE.3 index ff0d108..6078a53 100644 --- a/doc/NRE.3 +++ b/doc/NRE.3 @@ -1,5 +1,6 @@ .\" .\" Copyright (c) 2008 by Kevin B. Kenny. +.\" Copyright (c) 2018 by Nathan Coulter. .\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -38,43 +39,39 @@ void .SH ARGUMENTS .AS Tcl_CmdDeleteProc *interp in .AP Tcl_Interp *interp in -Interpreter in which to create or evaluate a command. +The relevant Interpreter. .AP char *cmdName in -Name of a new command to create. +Name of the command to create. .AP Tcl_ObjCmdProc *proc in -Implementation of a command that will be called whenever \fIcmdName\fR -is invoked as a command in the unoptimized way. +Called in order to evaluate a command. Is often just a small wrapper that uses +\fBTcl_NRCallObjProc\fR to call \fInreProc\fR using a new trampoline. Behaves +in the same way as the \fIproc\fR argument to \fBTcl_CreateObjCommand\fR(3) +(\fIq.v.\fR). .AP Tcl_ObjCmdProc *nreProc in -Implementation of a command that will be called whenever \fIcmdName\fR -is invoked and requested to conserve the C stack. +Called instead of \fIproc\fR when a trampoline is already in use. .AP ClientData clientData in -Arbitrary one-word value that will be passed to \fIproc\fR, \fInreProc\fR, -\fIdeleteProc\fR and \fIobjProc\fR. +Arbitrary one-word value passed to \fIproc\fR, \fInreProc\fR, \fIdeleteProc\fR +and \fIobjProc\fR. .AP Tcl_CmdDeleteProc *deleteProc in/out -Procedure to call before \fIcmdName\fR is deleted from the interpreter. -This procedure allows for command-specific cleanup. If \fIdeleteProc\fR -is \fBNULL\fR, then no procedure is called before the command is deleted. +Called before \fIcmdName\fR is deleted from the interpreter, allowing for +command-specific cleanup. May be NULL. .AP int objc in -Count of parameters provided to the implementation of a command. +Number of items in \fIobjv\fR. .AP Tcl_Obj **objv in -Pointer to an array of Tcl values. Each value holds the value of a -single word in the command to execute. +Words in the command. .AP Tcl_Obj *objPtr in -Pointer to a Tcl_Obj whose value is a script or expression to execute. +A script or expression to evaluate. .AP int flags in -ORed combination of flag bits that specify additional options. -\fBTCL_EVAL_GLOBAL\fR is the only flag that is currently supported. -.\" TODO: This is a lie. But kbk didn't grasp TCL_EVAL_INVOKE and -.\" TCL_EVAL_NOERR well enough to document them. +As described for \fITcl_EvalObjv\fR. +.PP .AP Tcl_Command cmd in -Token for a command that is to be used instead of the currently -executing command. +Token to use instead of one derived from the first word of \fIobjv\fR in order +to evaluate a command. .AP Tcl_Obj *resultPtr out -Pointer to an unshared Tcl_Obj where the result of expression -evaluation is written. +Pointer to an unshared Tcl_Obj where the result of the evaluation is stored if +the return code is TCL_OK. .AP Tcl_NRPostProc *postProcPtr in -Pointer to a function that will be invoked when the command currently -executing in the interpreter designated by \fIinterp\fR completes. +A function to push. .AP ClientData data0 in .AP ClientData data1 in .AP ClientData data2 in @@ -84,98 +81,51 @@ to the function designated by \fIpostProcPtr\fR when it is invoked. .BE .SH DESCRIPTION .PP -This series of C functions provides an interface whereby commands that -are implemented in C can be evaluated, and invoke Tcl commands scripts -and scripts, without consuming space on the C stack. The non-recursive -evaluation is done by installing a \fItrampoline\fR, a small piece of -code that invokes a command or script, and then executes a series of -callbacks when the command or script returns. -.PP -The \fBTcl_NRCreateCommand\fR function creates a Tcl command in the -interpreter designated by \fIinterp\fR that is prepared to handle -nonrecursive evaluation with a trampoline. The \fIcmdName\fR argument -gives the name of the new command. If \fIcmdName\fR contains any -namespace qualifiers, then the new command is added to the specified -namespace; otherwise, it is added to the global namespace. \fIproc\fR -gives the procedure that will be called when the interpreter wishes to -evaluate the command in an unoptimized manner, and \fInreProc\fR is -the procedure that will be called when the interpreter wishes to -evaluate the command using a trampoline. \fIdeleteProc\fR is a -function that will be called before the command is deleted from the -interpreter. When any of the three functions is invoked, it is passed -the \fIclientData\fR parameter. -.PP -\fBTcl_NRCreateCommand\fR deletes any existing command -\fIname\fR already associated with the interpreter -(however see below for an exception where the existing command -is not deleted). -It returns a token that may be used to refer -to the command in subsequent calls to \fBTcl_GetCommandName\fR. -If \fBTcl_NRCreateCommand\fR is called for an interpreter that is in -the process of being deleted, then it does not create a new command, -does not delete any existing command of the same name, and returns NULL. -.PP -The \fIproc\fR and \fInreProc\fR function are expected to conform to -all the rules set forth for the \fIproc\fR argument to -\fBTcl_CreateObjCommand\fR(3) (\fIq.v.\fR). -.PP -When a command that is written to cope with evaluation via trampoline -is invoked without a trampoline on the stack, it will usually respond -to the invocation by creating a trampoline and calling the -trampoline-enabled implementation of the same command. This call is done by -means of \fBTcl_NRCallObjProc\fR. In the call to -\fBTcl_NRCallObjProc\fR, the \fIinterp\fR, \fIclientData\fR, -\fIobjc\fR and \fIobjv\fR parameters should be the same ones that were -passed to \fIproc\fR. The \fInreProc\fR parameter should designate the -trampoline-enabled implementation of the command. -.PP -\fBTcl_NREvalObj\fR arranges for the script contained in \fIobjPtr\fR -to be evaluated in the interpreter designated by \fIinterp\fR after -the current command (which must be trampoline-enabled) returns. It is -the method by which a command may invoke a script without consuming -space on the C stack. Similarly, \fBTcl_NREvalObjv\fR arranges to -invoke a single Tcl command whose words have already been separated -and substituted. The \fIobjc\fR and \fIobjv\fR parameters give the -words of the command to be evaluated when execution reaches the -trampoline. -.PP -\fBTcl_NRCmdSwap\fR allows for trampoline evaluation of a command whose -resolution is already known. The \fIcmd\fR parameter gives a -\fBTcl_Command\fR token (returned from \fBTcl_CreateObjCommand\fR or -\fBTcl_GetCommandFromObj\fR) identifying the command to be invoked in -the trampoline; this command must match the word in \fIobjv[0]\fR. -The remaining arguments are as for \fBTcl_NREvalObjv\fR. -.PP -\fBTcl_NREvalObj\fR, \fBTcl_NREvalObjv\fR and \fBTcl_NRCmdSwap\fR -all accept a \fIflags\fR parameter, which is an OR-ed-together set of -bits to control evaluation. At the present time, the only supported flag -available to callers is \fBTCL_EVAL_GLOBAL\fR. -.\" TODO: Again, this is a lie. Do we want to explain TCL_EVAL_INVOKE -.\" and TCL_EVAL_NOERR? -If the \fBTCL_EVAL_GLOBAL\fR flag is set, the script or command is -evaluated in the global namespace. If it is not set, it is evaluated -in the current namespace. -.PP -\fBTcl_NRExprObj\fR arranges for the expression contained in \fIobjPtr\fR -to be evaluated in the interpreter designated by \fIinterp\fR after -the current command (which must be trampoline-enabled) returns. It is -the method by which a command may evaluate a Tcl expression without consuming -space on the C stack. The argument \fIresultPtr\fR is a pointer to an -unshared Tcl_Obj where the result of expression evaluation is to be written. -If expression evaluation returns any code other than TCL_OK, the -\fIresultPtr\fR value is left untouched. -.PP -All of the routines return \fBTCL_OK\fR if command or expression invocation -has been scheduled successfully. If for any reason the scheduling cannot -be completed (for example, if the interpreter is unable to find -the requested command), they return \fBTCL_ERROR\fR with an -appropriate message left in the interpreter's result. -.PP -\fBTcl_NRAddCallback\fR arranges to have a C function called when the -current trampoline-enabled command in the Tcl interpreter designated -by \fIinterp\fR returns. The \fIpostProcPtr\fR argument is a pointer -to the callback function, which must have arguments and return value -consistent with the \fBTcl_NRPostProc\fR data type: +These functions provide an interface to the function stack that an interpreter +iterates through to evaluate commands. The routine behind a command is +implemented by an initial function and any additional functions that the +routine pushes onto the stack as it progresses. The interpreter itself pushes +functions onto the stack to react to the end of a routine and to exercise other +forms of control such as switching between in-progress stacks and the +evaluation of other scripts at additional levels without adding frames to the C +stack. To execute a routine, the initial function for the routine is called +and then a small bit of code called a \fItrampoline\fR iteratively takes +functions off the stack and calls them, using the value of the last call as the +value of the routine. +.PP +\fBTcl_NRCallObjProc\fR calls \fInreProc\fR using a new trampoline. +.PP +\fBTcl_NRCreateCommand\fR, an alternative to \fBTcl_CreateObjCommand\fR, +resolves \fIcmdName\fR, which may contain namespace qualifiers, relative to the +current namespace, creates a command by that name, and returns a token for the +command which may be used in subsequent calls to \fBTcl_GetCommandName\fR. +Except for a few cases noted below any existing command by the same name is +first deleted. If \fIinterp\fR is in the process of being deleted +\fBTcl_NRCreateCommand\fR does not create any command, does not delete any +command, and returns NULL. +.PP +\fBTcl_NREvalObj\fR pushes a function that is like \fBTcl_EvalObjEx\fR but +consumes no space on the C stack. +.PP +\fBTcl_NREvalObjv\fR pushes a function that is like \fBTcl_EvalObjv\fR but +consumes no space on the C stack. +.PP +\fBTcl_NRCmdSwap\fR is like \fBTcl_NREvalObjv\fR, but uses \fIcmd\fR, a token +previously returned by \fBTcl_CreateObjCommand\fR or +\fBTcl_GetCommandFromObj\fR, instead of resolving the first word of \fIobjv\fR. +. The name of this command must be the same as \fIobjv[0]\fR. +.PP +\fBTcl_NRExprObj\fR pushes a function that evaluates \fIobjPtr\fR as an +expression in the same manner as \fBTcl_ExprObj\fR but without consuming space +on the C stack. +.PP +All of the functions return \fBTCL_OK\fR if the evaluation of the script, +command, or expression has been scheduled successfully. Otherwise (for example +if the command name cannot be resolved), they return \fBTCL_ERROR\fR and store +a message as the interpreter's result. +.PP +\fBTcl_NRAddCallback\fR pushes \fIpostProcPtr\fR. The signature for +\fBTcl_NRPostProc\fR is: .PP .CS typedef int @@ -185,25 +135,13 @@ typedef int int \fIresult\fR); .CE .PP -When the trampoline invokes the callback function, the \fIdata\fR -parameter will point to an array containing the four one-word -quantities that were passed to \fBTcl_NRAddCallback\fR in the -\fIdata0\fR through \fIdata3\fR parameters. The Tcl interpreter will -be designated by the \fIinterp\fR parameter, and the \fIresult\fR -parameter will contain the result (\fBTCL_OK\fR, \fBTCL_ERROR\fR, -\fBTCL_RETURN\fR, \fBTCL_BREAK\fR or \fBTCL_CONTINUE\fR) that was -returned by the command evaluation. The callback function is expected, -in turn, either to return a \fIresult\fR to control further evaluation. -.PP -Multiple \fBTcl_NRAddCallback\fR invocations may request multiple -callbacks, which may be to the same or different callback -functions. If multiple callbacks are requested, they are executed in -last-in, first-out order, that is, the most recently requested -callback is executed first. +\fIdata\fR is a pointer to an array containing \fIdata0\fR through \fIdata3\fR. +\fIresult\fR is the value returned by the previous function implementing part +the routine. .SH EXAMPLE .PP -The usual pattern for Tcl commands that invoke other Tcl commands -is something like: +The following command uses \fBTcl_EvalObjEx\fR, which consumes space on the C +stack, to evalute a script: .PP .CS int @@ -228,28 +166,17 @@ int \fITheCmdOldObjProc\fR, clientData, TheCmdDeleteProc); .CE .PP -To enable a command like this one for trampoline-based evaluation, -it must be split into three pieces: -.IP \(bu -A non-trampoline implementation, \fITheCmdNewObjProc\fR, -which will simply create a trampoline -and invoke the trampoline-based implementation. -.IP \(bu -A trampoline-enabled implementation, \fITheCmdNRObjProc\fR. This -function will perform the initialization, request that the trampoline -call the postprocessing routine after command evaluation, and finally, -request that the trampoline call the inner command. -.IP \(bu -A postprocessing routine, \fITheCmdPostProc\fR. This function will -perform the postprocessing formerly done after the return from the -inner command in \fITheCmdObjProc\fR. -.PP -The non-trampoline implementation is simple and stylized, containing -a single statement: +To avoid consuming space on the C stack, \fITheCmdOldObjProc\fR is renamed to +\fITheCmdNRObjProc\fR and the postprocessing step is split into a separate +function, \fITheCmdPostProc\fR, which is pushed onto the function stack. +\fITcl_EvalObjEx\fR is replaced with \fITcl_NREvalObj\fR, which uses a +trampoline instead of consuming space on the C stack. A new version of +\fITheCmdOldObjProc\fR is just a a wrapper that uses \fBTcl_NRCallObjProc\fR to +call \fITheCmdNRObjProc\fR: .PP .CS int -\fITheCmdNewObjProc\fR( +\fITheCmdOldObjProc\fR( ClientData clientData, Tcl_Interp *interp, int objc, @@ -260,9 +187,6 @@ int } .CE .PP -The trampoline-enabled implementation requests postprocessing, -and returns to the trampoline requesting command evaluation. -.PP .CS int \fITheCmdNRObjProc\fR @@ -284,9 +208,6 @@ int } .CE .PP -The postprocessing procedure does whatever the original command did -upon return from the inner evaluation. -.PP .CS int \fITheCmdNRPostProc\fR( @@ -303,26 +224,13 @@ int } .CE .PP -If \fItheCommand\fR is a command that results in multiple commands or -scripts being evaluated, its postprocessing routine may schedule -additional postprocessing and then request another command evaluation -by means of \fBTcl_NREvalObj\fR or one of the other evaluation -routines. Looping and sequencing constructs may be implemented in this way. -.PP -Finally, to install a trampoline-enabled command in the interpreter, -\fBTcl_NRCreateCommand\fR is used in place of -\fBTcl_CreateObjCommand\fR. It accepts two command procedures instead -of one. The first is for use when no trampoline is yet on the stack, -and the second is for use when there is already a trampoline in place. +Any function comprising a routine can push other functions, making it possible +implement looping and sequencing constructs using the function stack. .PP -.CS -\fBTcl_NRCreateCommand\fR(interp, "theCommand", - \fITheCmdNewObjProc\fR, \fITheCmdNRObjProc\fR, clientData, - TheCmdDeleteProc); -.CE .SH "SEE ALSO" Tcl_CreateCommand(3), Tcl_CreateObjCommand(3), Tcl_EvalObjEx(3), Tcl_GetCommandFromObj(3), Tcl_ExprObj(3) .SH KEYWORDS stackless, nonrecursive, execute, command, global, value, result, script .SH COPYRIGHT -Copyright (c) 2008 by Kevin B. Kenny +Copyright (c) 2008 by Kevin B. Kenny. +Copyright (c) 2018 by Nathan Coulter. -- cgit v0.12 From ad022e6d3b0857ae1266961eb07a1c3459d6e1cf Mon Sep 17 00:00:00 2001 From: pooryorick Date: Sun, 11 Feb 2018 19:29:08 +0000 Subject: Remove restriction on defining the class of a TclOO object not explicitly instantiated from ::oo::class. --- generic/tclOODefineCmds.c | 15 --------------- tests/oo.test | 4 ++-- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c index e953dc0..47b34bb 100644 --- a/generic/tclOODefineCmds.c +++ b/generic/tclOODefineCmds.c @@ -1077,7 +1077,6 @@ TclOODefineClassObjCmd( { Object *oPtr; Class *clsPtr; - Foundation *fPtr = TclOOGetFoundation(interp); /* * Parse the context to get the object to operate on. @@ -1114,20 +1113,6 @@ TclOODefineClassObjCmd( return TCL_ERROR; } - /* - * Apply semantic checks. In particular, classes and non-classes are not - * interchangable (too complicated to do the conversion!) so we must - * produce an error if any attempt is made to swap from one to the other. - */ - - if ((oPtr->classPtr==NULL) == TclOOIsReachable(fPtr->classCls, clsPtr)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "may not change a %sclass object into a %sclass object", - (oPtr->classPtr==NULL ? "non-" : ""), - (oPtr->classPtr==NULL ? "" : "non-"))); - Tcl_SetErrorCode(interp, "TCL", "OO", "TRANSMUTATION", NULL); - return TCL_ERROR; - } /* * Set the object's class. diff --git a/tests/oo.test b/tests/oo.test index 61a5e01..8850ea5 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -1668,13 +1668,13 @@ test oo-13.2 {OO: changing an object's class} -body { oo::objdefine foo class oo::class } -cleanup { foo destroy -} -returnCodes 1 -result {may not change a non-class object into a class object} +} -result {} test oo-13.3 {OO: changing an object's class} -body { oo::class create foo oo::objdefine foo class oo::object } -cleanup { foo destroy -} -returnCodes 1 -result {may not change a class object into a non-class object} +} -result {} test oo-13.4 {OO: changing an object's class} -body { oo::class create foo { method m {} { -- cgit v0.12 From 568724e4687c000b9ec9e66512048d5c8d8174f7 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Sun, 11 Feb 2018 19:35:27 +0000 Subject: Change the signature of PkgRequireCore in preparation to provide TclNRPackageObjCmd. --- generic/tclPkg.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 6d826a9..6a246bb 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -69,7 +69,7 @@ static void AddRequirementsToResult(Tcl_Interp *interp, int reqc, static void AddRequirementsToDString(Tcl_DString *dstring, int reqc, Tcl_Obj *const reqv[]); static Package * FindPackage(Tcl_Interp *interp, const char *name); -static const char * PkgRequireCore(Tcl_Interp *interp, const char *name, +static int PkgRequireCore(Tcl_Interp *interp, const char *name, int reqc, Tcl_Obj *const reqv[], void *clientDataPtr); @@ -299,7 +299,10 @@ Tcl_PkgRequireEx( */ if (version == NULL) { - result = PkgRequireCore(interp, name, 0, NULL, clientDataPtr); + if (Tcl_PkgRequireProc(interp, name, 0, NULL, clientDataPtr) == TCL_OK) { + result = Tcl_GetStringResult(interp); + Tcl_ResetResult(interp); + } } else { if (exact && TCL_OK != CheckVersionAndConvert(interp, version, NULL, NULL)) { @@ -310,10 +313,12 @@ Tcl_PkgRequireEx( Tcl_AppendStringsToObj(ov, "-", version, NULL); } Tcl_IncrRefCount(ov); - result = PkgRequireCore(interp, name, 1, &ov, clientDataPtr); + if (Tcl_PkgRequireProc(interp, name, 1, &ov, clientDataPtr) == TCL_OK) { + result = Tcl_GetStringResult(interp); + Tcl_ResetResult(interp); + } TclDecrRefCount(ov); } - return result; } @@ -328,17 +333,14 @@ Tcl_PkgRequireProc( * available. */ void *clientDataPtr) { - const char *result = - PkgRequireCore(interp, name, reqc, reqv, clientDataPtr); - - if (result == NULL) { - return TCL_ERROR; + int code = CheckAllRequirements(interp, reqc, reqv); + if (code != TCL_OK) { + return code; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(result, -1)); - return TCL_OK; + return PkgRequireCore(interp, name, reqc, reqv, clientDataPtr); } -static const char * +int PkgRequireCore( Tcl_Interp *interp, /* Interpreter in which package is now * available. */ @@ -358,10 +360,6 @@ PkgRequireCore( char *script, *pkgVersionI; Tcl_DString command; - if (TCL_OK != CheckAllRequirements(interp, reqc, reqv)) { - return NULL; - } - /* * It can take up to three passes to find the package: one pass to run the * "package unknown" script, one to run the "package ifneeded" script for @@ -387,7 +385,7 @@ PkgRequireCore( name, (char *) pkgPtr->clientData, name)); AddRequirementsToResult(interp, reqc, reqv); Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "CIRCULARITY", NULL); - return NULL; + return TCL_ERROR; } /* @@ -598,7 +596,7 @@ PkgRequireCore( pkgPtr->version = NULL; } pkgPtr->clientData = NULL; - return NULL; + return code; } break; @@ -634,7 +632,7 @@ PkgRequireCore( if (code == TCL_ERROR) { Tcl_AddErrorInfo(interp, "\n (\"package unknown\" script)"); - return NULL; + return code; } Tcl_ResetResult(interp); } @@ -645,7 +643,7 @@ PkgRequireCore( "can't find package %s", name)); Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNFOUND", NULL); AddRequirementsToResult(interp, reqc, reqv); - return NULL; + return TCL_ERROR; } /* @@ -666,7 +664,7 @@ PkgRequireCore( Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "VERSIONCONFLICT", NULL); AddRequirementsToResult(interp, reqc, reqv); - return NULL; + return TCL_ERROR; } } @@ -675,7 +673,8 @@ PkgRequireCore( *ptr = pkgPtr->clientData; } - return pkgPtr->version; + Tcl_SetObjResult(interp, Tcl_NewStringObj(pkgPtr->version, -1)); + return TCL_OK; } /* -- cgit v0.12 From 4c79bcbe64fca55bf859f1fb9a78bf887d7c78dc Mon Sep 17 00:00:00 2001 From: pooryorick Date: Mon, 12 Feb 2018 10:14:02 +0000 Subject: Preparation to provide TclNRPackageObjectCmd: Eliminate the loop in PkgRequireCore so that TclNRAddCallback can be added at the needed spots. --- generic/tclInt.h | 1 + generic/tclPkg.c | 525 ++++++++++++++++++++++++++++--------------------------- 2 files changed, 264 insertions(+), 262 deletions(-) diff --git a/generic/tclInt.h b/generic/tclInt.h index 4967cd3..ac67ebd 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -2750,6 +2750,7 @@ MODULE_SCOPE Tcl_ObjCmdProc TclNRForObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRForeachCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRIfObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRLmapCmd; +MODULE_SCOPE Tcl_ObjCmdProc TclNRPackageObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRSourceObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRSubstObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRSwitchObjCmd; diff --git a/generic/tclPkg.c b/generic/tclPkg.c index 6a246bb..b48e71b 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -72,6 +72,8 @@ static Package * FindPackage(Tcl_Interp *interp, const char *name); static int PkgRequireCore(Tcl_Interp *interp, const char *name, int reqc, Tcl_Obj *const reqv[], void *clientDataPtr); +static int SelectPackage (Tcl_Interp *interp, const char *name, + Package *pkgPtr, int reqc, Tcl_Obj *const reqv[]); /* * Helper macros. @@ -351,329 +353,328 @@ PkgRequireCore( * available. */ void *clientDataPtr) { - Interp *iPtr = (Interp *) interp; Package *pkgPtr; - PkgAvail *availPtr, *bestPtr, *bestStablePtr; - char *availVersion, *bestVersion, *bestStableVersion; - /* Internal rep. of versions */ - int availStable, code, satisfies, pass; + int code, satisfies; char *script, *pkgVersionI; Tcl_DString command; + pkgPtr = FindPackage(interp, name); + if (pkgPtr->version == NULL) { + code = SelectPackage(interp, name, pkgPtr, reqc, reqv); + if (code != TCL_OK) { + return code; + } + if (pkgPtr->version == NULL) { + /* + * The package is not in the database. If there is a "package unknown" + * command, invoke it. + */ + + script = ((Interp *) interp)->packageUnknown; + if (script != NULL) { + Tcl_DStringInit(&command); + Tcl_DStringAppend(&command, script, -1); + Tcl_DStringAppendElement(&command, name); + AddRequirementsToDString(&command, reqc, reqv); + + code = Tcl_EvalEx(interp, Tcl_DStringValue(&command), + Tcl_DStringLength(&command), TCL_EVAL_GLOBAL); + Tcl_DStringFree(&command); + + if ((code != TCL_OK) && (code != TCL_ERROR)) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "bad return code: %d", code)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); + code = TCL_ERROR; + } + if (code == TCL_ERROR) { + Tcl_AddErrorInfo(interp, + "\n (\"package unknown\" script)"); + return code; + } + Tcl_ResetResult(interp); + } + /* pkgPtr may now be invalid, so refresh it. */ + pkgPtr = FindPackage(interp, name); + code = SelectPackage(interp, name, pkgPtr, reqc, reqv); + if (code != TCL_OK) { + return code; + } + } + } + + if (pkgPtr->version == NULL) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "can't find package %s", name)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNFOUND", NULL); + AddRequirementsToResult(interp, reqc, reqv); + return TCL_ERROR; + } + /* - * It can take up to three passes to find the package: one pass to run the - * "package unknown" script, one to run the "package ifneeded" script for - * a specific version, and a final pass to lookup the package loaded by - * the "package ifneeded" script. + * Ensure that the provided version meets the current requirements. */ - for (pass=1 ;; pass++) { - pkgPtr = FindPackage(interp, name); - if (pkgPtr->version != NULL) { - break; - } + if (reqc != 0) { + CheckVersionAndConvert(interp, pkgPtr->version, &pkgVersionI, NULL); + satisfies = SomeRequirementSatisfied(pkgVersionI, reqc, reqv); - /* - * Check whether we're already attempting to load some version of this - * package (circular dependency detection). - */ + ckfree(pkgVersionI); - if (pkgPtr->clientData != NULL) { + if (!satisfies) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "circular package dependency:" - " attempt to provide %s %s requires %s", - name, (char *) pkgPtr->clientData, name)); + "version conflict for package \"%s\": have %s, need", + name, pkgPtr->version)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "VERSIONCONFLICT", + NULL); AddRequirementsToResult(interp, reqc, reqv); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "CIRCULARITY", NULL); return TCL_ERROR; } + } - /* - * The package isn't yet present. Search the list of available - * versions and invoke the script for the best available version. We - * are actually locating the best, and the best stable version. One of - * them is then chosen based on the selection mode. - */ - - bestPtr = NULL; - bestStablePtr = NULL; - bestVersion = NULL; - bestStableVersion = NULL; + if (clientDataPtr) { + const void **ptr = (const void **) clientDataPtr; - for (availPtr = pkgPtr->availPtr; availPtr != NULL; - availPtr = availPtr->nextPtr) { - if (CheckVersionAndConvert(interp, availPtr->version, - &availVersion, &availStable) != TCL_OK) { - /* - * The provided version number has invalid syntax. This - * should not happen. This should have been caught by the - * 'package ifneeded' registering the package. - */ + *ptr = pkgPtr->clientData; + } + Tcl_SetObjResult(interp, Tcl_NewStringObj(pkgPtr->version, -1)); + return TCL_OK; +} + +int SelectPackage (Tcl_Interp *interp, const char *name, Package *pkgPtr, int reqc, Tcl_Obj *const reqv[]) { + PkgAvail *availPtr, *bestPtr, *bestStablePtr; + char *availVersion, *bestVersion, *bestStableVersion; + /* Internal rep. of versions */ + char *script; + int availStable, code, satisfies; + Interp *iPtr = (Interp *) interp; - continue; - } + /* + * Check whether we're already attempting to load some version of this + * package (circular dependency detection). + */ - /* Check satisfaction of requirements before considering the current version further. */ - if (reqc > 0) { - satisfies = SomeRequirementSatisfied(availVersion, reqc, reqv); - if (!satisfies) { - ckfree(availVersion); - availVersion = NULL; - continue; - } - } + if (pkgPtr->clientData != NULL) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "circular package dependency:" + " attempt to provide %s %s requires %s", + name, (char *) pkgPtr->clientData, name)); + AddRequirementsToResult(interp, reqc, reqv); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "CIRCULARITY", NULL); + return TCL_ERROR; + } - if (bestPtr != NULL) { - int res = CompareVersions(availVersion, bestVersion, NULL); + /* + * The package isn't yet present. Search the list of available + * versions and invoke the script for the best available version. We + * are actually locating the best, and the best stable version. One of + * them is then chosen based on the selection mode. + */ - /* - * Note: Used internal reps in the comparison! - */ + bestPtr = NULL; + bestStablePtr = NULL; + bestVersion = NULL; + bestStableVersion = NULL; - if (res > 0) { - /* - * The version of the package sought is better than the - * currently selected version. - */ - ckfree(bestVersion); - bestVersion = NULL; - goto newbest; - } - } else { - newbest: - /* We have found a version which is better than our max. */ + for (availPtr = pkgPtr->availPtr; availPtr != NULL; + availPtr = availPtr->nextPtr) { + if (CheckVersionAndConvert(interp, availPtr->version, + &availVersion, &availStable) != TCL_OK) { + /* + * The provided version number has invalid syntax. This + * should not happen. This should have been caught by the + * 'package ifneeded' registering the package. + */ - bestPtr = availPtr; - CheckVersionAndConvert(interp, bestPtr->version, &bestVersion, NULL); - } + continue; + } - if (!availStable) { + /* Check satisfaction of requirements before considering the current version further. */ + if (reqc > 0) { + satisfies = SomeRequirementSatisfied(availVersion, reqc, reqv); + if (!satisfies) { ckfree(availVersion); availVersion = NULL; continue; } + } - if (bestStablePtr != NULL) { - int res = CompareVersions(availVersion, bestStableVersion, NULL); + if (bestPtr != NULL) { + int res = CompareVersions(availVersion, bestVersion, NULL); + + /* + * Note: Used internal reps in the comparison! + */ + if (res > 0) { /* - * Note: Used internal reps in the comparison! + * The version of the package sought is better than the + * currently selected version. */ - - if (res > 0) { - /* - * This stable version of the package sought is better - * than the currently selected stable version. - */ - ckfree(bestStableVersion); - bestStableVersion = NULL; - goto newstable; - } - } else { - newstable: - /* We have found a stable version which is better than our max stable. */ - bestStablePtr = availPtr; - CheckVersionAndConvert(interp, bestStablePtr->version, &bestStableVersion, NULL); + ckfree(bestVersion); + bestVersion = NULL; + goto newbest; } + } else { + newbest: + /* We have found a version which is better than our max. */ - ckfree(availVersion); - availVersion = NULL; - } /* end for */ - - /* - * Clean up memorized internal reps, if any. - */ - - if (bestVersion != NULL) { - ckfree(bestVersion); - bestVersion = NULL; + bestPtr = availPtr; + CheckVersionAndConvert(interp, bestPtr->version, &bestVersion, NULL); } - if (bestStableVersion != NULL) { - ckfree(bestStableVersion); - bestStableVersion = NULL; + if (!availStable) { + ckfree(availVersion); + availVersion = NULL; + continue; } - /* - * Now choose a version among the two best. For 'latest' we simply - * take (actually keep) the best. For 'stable' we take the best - * stable, if there is any, or the best if there is nothing stable. - */ + if (bestStablePtr != NULL) { + int res = CompareVersions(availVersion, bestStableVersion, NULL); - if ((iPtr->packagePrefer == PKG_PREFER_STABLE) - && (bestStablePtr != NULL)) { - bestPtr = bestStablePtr; - } - - if (bestPtr != NULL) { /* - * We found an ifneeded script for the package. Be careful while - * executing it: this could cause reentrancy, so (a) protect the - * script itself from deletion and (b) don't assume that bestPtr - * will still exist when the script completes. + * Note: Used internal reps in the comparison! */ - char *versionToProvide = bestPtr->version; - script = bestPtr->script; - - pkgPtr->clientData = versionToProvide; - Tcl_Preserve(script); - Tcl_Preserve(versionToProvide); - code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); - Tcl_Release(script); - - pkgPtr = FindPackage(interp, name); - if (code == TCL_OK) { - Tcl_ResetResult(interp); - if (pkgPtr->version == NULL) { - code = TCL_ERROR; - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "attempt to provide package %s %s failed:" - " no version of package %s provided", - name, versionToProvide, name)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNPROVIDED", - NULL); - } else { - char *pvi, *vi; - - if (CheckVersionAndConvert(interp, pkgPtr->version, &pvi, - NULL) != TCL_OK) { - code = TCL_ERROR; - } else if (CheckVersionAndConvert(interp, - versionToProvide, &vi, NULL) != TCL_OK) { - ckfree(pvi); - code = TCL_ERROR; - } else { - int res = CompareVersions(pvi, vi, NULL); - - ckfree(pvi); - ckfree(vi); - if (res != 0) { - code = TCL_ERROR; - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "attempt to provide package %s %s failed:" - " package %s %s provided instead", - name, versionToProvide, - name, pkgPtr->version)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", - "WRONGPROVIDE", NULL); - } - } - } - } else if (code != TCL_ERROR) { - Tcl_Obj *codePtr = Tcl_NewIntObj(code); - - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "attempt to provide package %s %s failed:" - " bad return code: %s", - name, versionToProvide, TclGetString(codePtr))); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); - TclDecrRefCount(codePtr); - code = TCL_ERROR; - } - - if (code == TCL_ERROR) { - Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( - "\n (\"package ifneeded %s %s\" script)", - name, versionToProvide)); - } - Tcl_Release(versionToProvide); - - if (code != TCL_OK) { + if (res > 0) { /* - * Take a non-TCL_OK code from the script as an indication the - * package wasn't loaded properly, so the package system - * should not remember an improper load. - * - * This is consistent with our returning NULL. If we're not - * willing to tell our caller we got a particular version, we - * shouldn't store that version for telling future callers - * either. + * This stable version of the package sought is better + * than the currently selected stable version. */ - - if (pkgPtr->version != NULL) { - ckfree(pkgPtr->version); - pkgPtr->version = NULL; - } - pkgPtr->clientData = NULL; - return code; + ckfree(bestStableVersion); + bestStableVersion = NULL; + goto newstable; } - - break; - } - - /* - * The package is not in the database. If there is a "package unknown" - * command, invoke it (but only on the first pass; after that, we - * should not get here in the first place). - */ - - if (pass > 1) { - break; + } else { + newstable: + /* We have found a stable version which is better than our max stable. */ + bestStablePtr = availPtr; + CheckVersionAndConvert(interp, bestStablePtr->version, &bestStableVersion, NULL); } - script = ((Interp *) interp)->packageUnknown; - if (script != NULL) { - Tcl_DStringInit(&command); - Tcl_DStringAppend(&command, script, -1); - Tcl_DStringAppendElement(&command, name); - AddRequirementsToDString(&command, reqc, reqv); + ckfree(availVersion); + availVersion = NULL; + } /* end for */ - code = Tcl_EvalEx(interp, Tcl_DStringValue(&command), - Tcl_DStringLength(&command), TCL_EVAL_GLOBAL); - Tcl_DStringFree(&command); + /* + * Clean up memorized internal reps, if any. + */ - if ((code != TCL_OK) && (code != TCL_ERROR)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad return code: %d", code)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); - code = TCL_ERROR; - } - if (code == TCL_ERROR) { - Tcl_AddErrorInfo(interp, - "\n (\"package unknown\" script)"); - return code; - } - Tcl_ResetResult(interp); - } + if (bestVersion != NULL) { + ckfree(bestVersion); + bestVersion = NULL; } - if (pkgPtr->version == NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't find package %s", name)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNFOUND", NULL); - AddRequirementsToResult(interp, reqc, reqv); - return TCL_ERROR; + if (bestStableVersion != NULL) { + ckfree(bestStableVersion); + bestStableVersion = NULL; } /* - * At this point we know that the package is present. Make sure that the - * provided version meets the current requirements. + * Now choose a version among the two best. For 'latest' we simply + * take (actually keep) the best. For 'stable' we take the best + * stable, if there is any, or the best if there is nothing stable. */ - if (reqc != 0) { - CheckVersionAndConvert(interp, pkgPtr->version, &pkgVersionI, NULL); - satisfies = SomeRequirementSatisfied(pkgVersionI, reqc, reqv); + if ((iPtr->packagePrefer == PKG_PREFER_STABLE) + && (bestStablePtr != NULL)) { + bestPtr = bestStablePtr; + } - ckfree(pkgVersionI); + if (bestPtr != NULL) { + /* + * We found an ifneeded script for the package. Be careful while + * executing it: this could cause reentrancy, so (a) protect the + * script itself from deletion and (b) don't assume that bestPtr + * will still exist when the script completes. + */ + + char *versionToProvide = bestPtr->version; + script = bestPtr->script; + + pkgPtr->clientData = versionToProvide; + Tcl_Preserve(script); + Tcl_Preserve(versionToProvide); + code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); + Tcl_Release(script); + + pkgPtr = FindPackage(interp, name); + if (code == TCL_OK) { + Tcl_ResetResult(interp); + if (pkgPtr->version == NULL) { + code = TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "attempt to provide package %s %s failed:" + " no version of package %s provided", + name, versionToProvide, name)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNPROVIDED", + NULL); + } else { + char *pvi, *vi; + + if (CheckVersionAndConvert(interp, pkgPtr->version, &pvi, + NULL) != TCL_OK) { + code = TCL_ERROR; + } else if (CheckVersionAndConvert(interp, + versionToProvide, &vi, NULL) != TCL_OK) { + ckfree(pvi); + code = TCL_ERROR; + } else { + int res = CompareVersions(pvi, vi, NULL); + + ckfree(pvi); + ckfree(vi); + if (res != 0) { + code = TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "attempt to provide package %s %s failed:" + " package %s %s provided instead", + name, versionToProvide, + name, pkgPtr->version)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", + "WRONGPROVIDE", NULL); + } + } + } + } else if (code != TCL_ERROR) { + Tcl_Obj *codePtr = Tcl_NewIntObj(code); - if (!satisfies) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "version conflict for package \"%s\": have %s, need", - name, pkgPtr->version)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "VERSIONCONFLICT", - NULL); - AddRequirementsToResult(interp, reqc, reqv); - return TCL_ERROR; + "attempt to provide package %s %s failed:" + " bad return code: %s", + name, versionToProvide, TclGetString(codePtr))); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); + TclDecrRefCount(codePtr); + code = TCL_ERROR; } - } - if (clientDataPtr) { - const void **ptr = (const void **) clientDataPtr; + if (code == TCL_ERROR) { + Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( + "\n (\"package ifneeded %s %s\" script)", + name, versionToProvide)); + } + Tcl_Release(versionToProvide); - *ptr = pkgPtr->clientData; + if (code != TCL_OK) { + /* + * Take a non-TCL_OK code from the script as an indication the + * package wasn't loaded properly, so the package system + * should not remember an improper load. + * + * This is consistent with our returning NULL. If we're not + * willing to tell our caller we got a particular version, we + * shouldn't store that version for telling future callers + * either. + */ + + if (pkgPtr->version != NULL) { + ckfree(pkgPtr->version); + pkgPtr->version = NULL; + } + pkgPtr->clientData = NULL; + return code; + } } - Tcl_SetObjResult(interp, Tcl_NewStringObj(pkgPtr->version, -1)); return TCL_OK; } -- cgit v0.12 From f4babdb0acc66d9d4eda61a094f12f99a24b8915 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Mon, 12 Feb 2018 10:44:44 +0000 Subject: Adapt signature of PkgRequireCore to conform to Tcl_ObjCmdProc, and call it in Tcl_PkgRequireProc on an NRE trampoline via Tcl_NRCallObjProc. Additional callbacks still needed to fully NRE-enable [package require]. --- generic/tclPkg.c | 83 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 35 deletions(-) diff --git a/generic/tclPkg.c b/generic/tclPkg.c index b48e71b..ff8db13 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -49,6 +49,12 @@ typedef struct Package { const void *clientData; /* Client data. */ } Package; +typedef struct Require { + void * clientDataPtr; + const char *name; + Package *pkgPtr; +} Require; + /* * Prototypes for functions defined in this file: */ @@ -69,11 +75,10 @@ static void AddRequirementsToResult(Tcl_Interp *interp, int reqc, static void AddRequirementsToDString(Tcl_DString *dstring, int reqc, Tcl_Obj *const reqv[]); static Package * FindPackage(Tcl_Interp *interp, const char *name); -static int PkgRequireCore(Tcl_Interp *interp, const char *name, - int reqc, Tcl_Obj *const reqv[], - void *clientDataPtr); -static int SelectPackage (Tcl_Interp *interp, const char *name, - Package *pkgPtr, int reqc, Tcl_Obj *const reqv[]); +static int PkgRequireCore(ClientData clientData, Tcl_Interp *interp, + int reqc, Tcl_Obj *const reqv[]); +static int SelectPackage (Tcl_Interp *interp, Require *reqPtr, + int reqc, Tcl_Obj *const reqv[]); /* * Helper macros. @@ -336,35 +341,41 @@ Tcl_PkgRequireProc( void *clientDataPtr) { int code = CheckAllRequirements(interp, reqc, reqv); + Require require; if (code != TCL_OK) { return code; } - return PkgRequireCore(interp, name, reqc, reqv, clientDataPtr); + require.clientDataPtr = clientDataPtr; + require.name = name; + require.pkgPtr = NULL; + return Tcl_NRCallObjProc(interp, PkgRequireCore, &require, reqc, reqv); } int PkgRequireCore( + ClientData clientData, Tcl_Interp *interp, /* Interpreter in which package is now * available. */ - const char *name, /* Name of desired package. */ int reqc, /* Requirements constraining the desired * version. */ - Tcl_Obj *const reqv[], /* 0 means to use the latest version + Tcl_Obj *const reqv[] /* 0 means to use the latest version * available. */ - void *clientDataPtr) + ) { - Package *pkgPtr; int code, satisfies; - char *script, *pkgVersionI; Tcl_DString command; + Require *reqPtr = clientData; + char *script, *pkgVersionI; + const char *name = reqPtr->name /* Name of desired package. */; + void *clientDataPtr = reqPtr->clientDataPtr; - pkgPtr = FindPackage(interp, name); - if (pkgPtr->version == NULL) { - code = SelectPackage(interp, name, pkgPtr, reqc, reqv); + reqPtr->pkgPtr = FindPackage(interp, name); + if (reqPtr->pkgPtr->version == NULL) { + code = SelectPackage(interp, reqPtr, reqc, reqv); if (code != TCL_OK) { return code; } - if (pkgPtr->version == NULL) { + if (reqPtr->pkgPtr->version == NULL) { /* * The package is not in the database. If there is a "package unknown" * command, invoke it. @@ -393,17 +404,17 @@ PkgRequireCore( return code; } Tcl_ResetResult(interp); - } - /* pkgPtr may now be invalid, so refresh it. */ - pkgPtr = FindPackage(interp, name); - code = SelectPackage(interp, name, pkgPtr, reqc, reqv); - if (code != TCL_OK) { - return code; + /* pkgPtr may now be invalid, so refresh it. */ + reqPtr->pkgPtr = FindPackage(interp, name); + code = SelectPackage(interp, reqPtr, reqc, reqv); + if (code != TCL_OK) { + return code; + } } } } - if (pkgPtr->version == NULL) { + if (reqPtr->pkgPtr->version == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't find package %s", name)); Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNFOUND", NULL); @@ -416,7 +427,7 @@ PkgRequireCore( */ if (reqc != 0) { - CheckVersionAndConvert(interp, pkgPtr->version, &pkgVersionI, NULL); + CheckVersionAndConvert(interp, reqPtr->pkgPtr->version, &pkgVersionI, NULL); satisfies = SomeRequirementSatisfied(pkgVersionI, reqc, reqv); ckfree(pkgVersionI); @@ -424,7 +435,7 @@ PkgRequireCore( if (!satisfies) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "version conflict for package \"%s\": have %s, need", - name, pkgPtr->version)); + name, reqPtr->pkgPtr->version)); Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "VERSIONCONFLICT", NULL); AddRequirementsToResult(interp, reqc, reqv); @@ -435,18 +446,20 @@ PkgRequireCore( if (clientDataPtr) { const void **ptr = (const void **) clientDataPtr; - *ptr = pkgPtr->clientData; + *ptr = reqPtr->pkgPtr->clientData; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(pkgPtr->version, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(reqPtr->pkgPtr->version, -1)); return TCL_OK; } -int SelectPackage (Tcl_Interp *interp, const char *name, Package *pkgPtr, int reqc, Tcl_Obj *const reqv[]) { +int SelectPackage (Tcl_Interp *interp, Require *reqPtr, int reqc, Tcl_Obj *const reqv[]) { PkgAvail *availPtr, *bestPtr, *bestStablePtr; char *availVersion, *bestVersion, *bestStableVersion; /* Internal rep. of versions */ char *script; int availStable, code, satisfies; + const char *name = reqPtr->name; + Package *pkgPtr = reqPtr->pkgPtr; Interp *iPtr = (Interp *) interp; /* @@ -598,10 +611,10 @@ int SelectPackage (Tcl_Interp *interp, const char *name, Package *pkgPtr, int re code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); Tcl_Release(script); - pkgPtr = FindPackage(interp, name); + reqPtr->pkgPtr = FindPackage(interp, name); if (code == TCL_OK) { Tcl_ResetResult(interp); - if (pkgPtr->version == NULL) { + if (reqPtr->pkgPtr->version == NULL) { code = TCL_ERROR; Tcl_SetObjResult(interp, Tcl_ObjPrintf( "attempt to provide package %s %s failed:" @@ -612,7 +625,7 @@ int SelectPackage (Tcl_Interp *interp, const char *name, Package *pkgPtr, int re } else { char *pvi, *vi; - if (CheckVersionAndConvert(interp, pkgPtr->version, &pvi, + if (CheckVersionAndConvert(interp, reqPtr->pkgPtr->version, &pvi, NULL) != TCL_OK) { code = TCL_ERROR; } else if (CheckVersionAndConvert(interp, @@ -630,7 +643,7 @@ int SelectPackage (Tcl_Interp *interp, const char *name, Package *pkgPtr, int re "attempt to provide package %s %s failed:" " package %s %s provided instead", name, versionToProvide, - name, pkgPtr->version)); + name, reqPtr->pkgPtr->version)); Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "WRONGPROVIDE", NULL); } @@ -667,11 +680,11 @@ int SelectPackage (Tcl_Interp *interp, const char *name, Package *pkgPtr, int re * either. */ - if (pkgPtr->version != NULL) { - ckfree(pkgPtr->version); - pkgPtr->version = NULL; + if (reqPtr->pkgPtr->version != NULL) { + ckfree(reqPtr->pkgPtr->version); + reqPtr->pkgPtr->version = NULL; } - pkgPtr->clientData = NULL; + reqPtr->pkgPtr->clientData = NULL; return code; } } -- cgit v0.12 From 1553090bc312c0691df9549983c1d25542c16ef5 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Mon, 12 Feb 2018 12:40:34 +0000 Subject: Add remaining wrapper to the NR functions, remaining calls to TCL_NRAddCallback, and a test for a package require script that yields. DGP: This checkin introduces a memleak, detected by test compExpr-7.1. --- generic/tclBasic.c | 4 +- generic/tclPkg.c | 408 +++++++++++++++++++++++++++++++++-------------------- tests/package.test | 12 ++ 3 files changed, 273 insertions(+), 151 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index ddc828a..e2319d2 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -234,7 +234,7 @@ static const CmdInfo builtInCmds[] = { {"lsearch", Tcl_LsearchObjCmd, NULL, NULL, CMD_IS_SAFE}, {"lset", Tcl_LsetObjCmd, TclCompileLsetCmd, NULL, CMD_IS_SAFE}, {"lsort", Tcl_LsortObjCmd, NULL, NULL, CMD_IS_SAFE}, - {"package", Tcl_PackageObjCmd, NULL, NULL, CMD_IS_SAFE}, + {"package", Tcl_PackageObjCmd, NULL, TclNRPackageObjCmd, CMD_IS_SAFE}, {"proc", Tcl_ProcObjCmd, NULL, NULL, CMD_IS_SAFE}, {"regexp", Tcl_RegexpObjCmd, TclCompileRegexpCmd, NULL, CMD_IS_SAFE}, {"regsub", Tcl_RegsubObjCmd, TclCompileRegsubCmd, NULL, CMD_IS_SAFE}, @@ -4428,6 +4428,8 @@ TclNRRunCallbacks( (void) Tcl_GetObjResult(interp); } + /* This is the trampoline. */ + while (TOP_CB(interp) != rootPtr) { callbackPtr = TOP_CB(interp); procPtr = callbackPtr->procPtr; diff --git a/generic/tclPkg.c b/generic/tclPkg.c index ff8db13..e956a40 100644 --- a/generic/tclPkg.c +++ b/generic/tclPkg.c @@ -53,8 +53,14 @@ typedef struct Require { void * clientDataPtr; const char *name; Package *pkgPtr; + char *versionToProvide; } Require; +typedef struct RequireProcArgs { + const char *name; + void *clientDataPtr; +} RequireProcArgs; + /* * Prototypes for functions defined in this file: */ @@ -75,10 +81,15 @@ static void AddRequirementsToResult(Tcl_Interp *interp, int reqc, static void AddRequirementsToDString(Tcl_DString *dstring, int reqc, Tcl_Obj *const reqv[]); static Package * FindPackage(Tcl_Interp *interp, const char *name); -static int PkgRequireCore(ClientData clientData, Tcl_Interp *interp, - int reqc, Tcl_Obj *const reqv[]); -static int SelectPackage (Tcl_Interp *interp, Require *reqPtr, - int reqc, Tcl_Obj *const reqv[]); +static int PkgRequireCore(ClientData data[], Tcl_Interp *interp, int result); +static int PkgRequireCoreFinal(ClientData data[], Tcl_Interp *interp, int result); +static int PkgRequireCoreCleanup(ClientData data[], Tcl_Interp *interp, int result); +static int PkgRequireCoreStep1(ClientData data[], Tcl_Interp *interp, int result); +static int PkgRequireCoreStep2(ClientData data[], Tcl_Interp *interp, int result); +static int TclNRPkgRequireProc(ClientData clientData, Tcl_Interp *interp, int reqc, Tcl_Obj *const reqv[]); +static int SelectPackage(ClientData data[], Tcl_Interp *interp, int result); +static int SelectPackageFinal(ClientData data[], Tcl_Interp *interp, int result); +static int TclNRPackageObjCmdCleanup(ClientData data[], Tcl_Interp *interp, int result); /* * Helper macros. @@ -340,80 +351,116 @@ Tcl_PkgRequireProc( * available. */ void *clientDataPtr) { + RequireProcArgs args; + args.name = name; + args.clientDataPtr = clientDataPtr; + return Tcl_NRCallObjProc(interp, TclNRPkgRequireProc, (void *)&args, reqc, reqv); +} + +static int +TclNRPkgRequireProc( + ClientData clientData, + Tcl_Interp *interp, + int reqc, + Tcl_Obj *const reqv[]) { + RequireProcArgs *args = clientData; + Tcl_NRAddCallback(interp, PkgRequireCore, (void *)args->name, INT2PTR(reqc), (void *)reqv, args->clientDataPtr); + return TCL_OK; +} + +static int +PkgRequireCore(ClientData data[], Tcl_Interp *interp, int result) +{ + const char *name = data[0]; + int reqc = PTR2INT(data[1]); + Tcl_Obj *const *reqv = data[2]; int code = CheckAllRequirements(interp, reqc, reqv); - Require require; + Require *reqPtr; if (code != TCL_OK) { return code; } - require.clientDataPtr = clientDataPtr; - require.name = name; - require.pkgPtr = NULL; - return Tcl_NRCallObjProc(interp, PkgRequireCore, &require, reqc, reqv); + reqPtr = ckalloc(sizeof(Require)); + Tcl_NRAddCallback(interp, PkgRequireCoreCleanup, reqPtr, NULL, NULL, NULL); + reqPtr->clientDataPtr = data[3]; + reqPtr->name = name; + reqPtr->pkgPtr = FindPackage(interp, name); + if (reqPtr->pkgPtr->version == NULL) { + Tcl_NRAddCallback(interp, SelectPackage, reqPtr, INT2PTR(reqc), (void *)reqv, PkgRequireCoreStep1); + } else { + Tcl_NRAddCallback(interp, PkgRequireCoreFinal, reqPtr, INT2PTR(reqc), (void *)reqv, NULL); + } + return TCL_OK; } -int -PkgRequireCore( - ClientData clientData, - Tcl_Interp *interp, /* Interpreter in which package is now - * available. */ - int reqc, /* Requirements constraining the desired - * version. */ - Tcl_Obj *const reqv[] /* 0 means to use the latest version - * available. */ - ) -{ - int code, satisfies; +static int +PkgRequireCoreStep1(ClientData data[], Tcl_Interp *interp, int result) { Tcl_DString command; - Require *reqPtr = clientData; - char *script, *pkgVersionI; + char *script; + Require *reqPtr = data[0]; + int reqc = PTR2INT(data[1]); + Tcl_Obj **const reqv = data[2]; const char *name = reqPtr->name /* Name of desired package. */; - void *clientDataPtr = reqPtr->clientDataPtr; - - reqPtr->pkgPtr = FindPackage(interp, name); if (reqPtr->pkgPtr->version == NULL) { - code = SelectPackage(interp, reqPtr, reqc, reqv); - if (code != TCL_OK) { - return code; - } - if (reqPtr->pkgPtr->version == NULL) { - /* - * The package is not in the database. If there is a "package unknown" - * command, invoke it. - */ + /* + * The package is not in the database. If there is a "package unknown" + * command, invoke it. + */ - script = ((Interp *) interp)->packageUnknown; - if (script != NULL) { - Tcl_DStringInit(&command); - Tcl_DStringAppend(&command, script, -1); - Tcl_DStringAppendElement(&command, name); - AddRequirementsToDString(&command, reqc, reqv); - - code = Tcl_EvalEx(interp, Tcl_DStringValue(&command), - Tcl_DStringLength(&command), TCL_EVAL_GLOBAL); - Tcl_DStringFree(&command); - - if ((code != TCL_OK) && (code != TCL_ERROR)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad return code: %d", code)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); - code = TCL_ERROR; - } - if (code == TCL_ERROR) { - Tcl_AddErrorInfo(interp, - "\n (\"package unknown\" script)"); - return code; - } - Tcl_ResetResult(interp); - /* pkgPtr may now be invalid, so refresh it. */ - reqPtr->pkgPtr = FindPackage(interp, name); - code = SelectPackage(interp, reqPtr, reqc, reqv); - if (code != TCL_OK) { - return code; - } - } - } + script = ((Interp *) interp)->packageUnknown; + if (script == NULL) { + Tcl_NRAddCallback(interp, PkgRequireCoreFinal, reqPtr, INT2PTR(reqc), (void *)reqv, NULL); + } else { + Tcl_DStringInit(&command); + Tcl_DStringAppend(&command, script, -1); + Tcl_DStringAppendElement(&command, name); + AddRequirementsToDString(&command, reqc, reqv); + + Tcl_NRAddCallback(interp, PkgRequireCoreStep2, reqPtr, INT2PTR(reqc), (void *)reqv, NULL); + Tcl_NREvalObj(interp, + Tcl_NewStringObj(Tcl_DStringValue(&command), Tcl_DStringLength(&command)), + TCL_EVAL_GLOBAL + ); + Tcl_DStringFree(&command); + } + return TCL_OK; + } else { + Tcl_NRAddCallback(interp, PkgRequireCoreFinal, reqPtr, INT2PTR(reqc), (void *)reqv, NULL); + } + return TCL_OK; +} + +static int +PkgRequireCoreStep2(ClientData data[], Tcl_Interp *interp, int result) { + Require *reqPtr = data[0]; + int reqc = PTR2INT(data[1]); + Tcl_Obj **const reqv = data[2]; + const char *name = reqPtr->name /* Name of desired package. */; + if ((result != TCL_OK) && (result != TCL_ERROR)) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "bad return code: %d", result)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); + result = TCL_ERROR; } + if (result == TCL_ERROR) { + Tcl_AddErrorInfo(interp, + "\n (\"package unknown\" script)"); + return result; + } + Tcl_ResetResult(interp); + /* pkgPtr may now be invalid, so refresh it. */ + reqPtr->pkgPtr = FindPackage(interp, name); + Tcl_NRAddCallback(interp, SelectPackage, reqPtr, INT2PTR(reqc), (void *)reqv, PkgRequireCoreFinal); + return TCL_OK; +} +static int +PkgRequireCoreFinal(ClientData data[], Tcl_Interp *interp, int result) { + Require *reqPtr = data[0]; + int reqc = PTR2INT(data[1]), satisfies; + Tcl_Obj **const reqv = data[2]; + char *pkgVersionI; + void *clientDataPtr = reqPtr->clientDataPtr; + const char *name = reqPtr->name /* Name of desired package. */; if (reqPtr->pkgPtr->version == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't find package %s", name)); @@ -451,13 +498,23 @@ PkgRequireCore( Tcl_SetObjResult(interp, Tcl_NewStringObj(reqPtr->pkgPtr->version, -1)); return TCL_OK; } + +static int +PkgRequireCoreCleanup(ClientData data[], Tcl_Interp *interp, int result) { + ckfree(data[0]); + return result; +} + -int SelectPackage (Tcl_Interp *interp, Require *reqPtr, int reqc, Tcl_Obj *const reqv[]) { +static int +SelectPackage(ClientData data[], Tcl_Interp *interp, int result) { PkgAvail *availPtr, *bestPtr, *bestStablePtr; char *availVersion, *bestVersion, *bestStableVersion; /* Internal rep. of versions */ - char *script; - int availStable, code, satisfies; + int availStable, satisfies; + Require *reqPtr = data[0]; + int reqc = PTR2INT(data[1]); + Tcl_Obj **const reqv = data[2]; const char *name = reqPtr->name; Package *pkgPtr = reqPtr->pkgPtr; Interp *iPtr = (Interp *) interp; @@ -594,7 +651,9 @@ int SelectPackage (Tcl_Interp *interp, Require *reqPtr, int reqc, Tcl_Obj *const bestPtr = bestStablePtr; } - if (bestPtr != NULL) { + if (bestPtr == NULL) { + Tcl_NRAddCallback(interp, data[3], reqPtr, INT2PTR(reqc), (void *)reqv, NULL); + } else { /* * We found an ifneeded script for the package. Be careful while * executing it: this could cause reentrancy, so (a) protect the @@ -603,91 +662,102 @@ int SelectPackage (Tcl_Interp *interp, Require *reqPtr, int reqc, Tcl_Obj *const */ char *versionToProvide = bestPtr->version; - script = bestPtr->script; pkgPtr->clientData = versionToProvide; - Tcl_Preserve(script); Tcl_Preserve(versionToProvide); - code = Tcl_EvalEx(interp, script, -1, TCL_EVAL_GLOBAL); - Tcl_Release(script); + reqPtr->versionToProvide = versionToProvide; + Tcl_NRAddCallback(interp, SelectPackageFinal, reqPtr, INT2PTR(reqc), (void *)reqv, data[3]); + Tcl_NREvalObj(interp, Tcl_NewStringObj(bestPtr->script, -1), TCL_EVAL_GLOBAL); + } + return TCL_OK; +} + +static int +SelectPackageFinal(ClientData data[], Tcl_Interp *interp, int result) { + Require *reqPtr = data[0]; + int reqc = PTR2INT(data[1]); + Tcl_Obj **const reqv = data[2]; + const char *name = reqPtr->name; + char *versionToProvide = reqPtr->versionToProvide; - reqPtr->pkgPtr = FindPackage(interp, name); - if (code == TCL_OK) { - Tcl_ResetResult(interp); - if (reqPtr->pkgPtr->version == NULL) { - code = TCL_ERROR; - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "attempt to provide package %s %s failed:" - " no version of package %s provided", - name, versionToProvide, name)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNPROVIDED", - NULL); + reqPtr->pkgPtr = FindPackage(interp, name); + if (result == TCL_OK) { + Tcl_ResetResult(interp); + if (reqPtr->pkgPtr->version == NULL) { + result = TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "attempt to provide package %s %s failed:" + " no version of package %s provided", + name, versionToProvide, name)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "UNPROVIDED", + NULL); + } else { + char *pvi, *vi; + + if (CheckVersionAndConvert(interp, reqPtr->pkgPtr->version, &pvi, + NULL) != TCL_OK) { + result = TCL_ERROR; + } else if (CheckVersionAndConvert(interp, + versionToProvide, &vi, NULL) != TCL_OK) { + ckfree(pvi); + result = TCL_ERROR; } else { - char *pvi, *vi; - - if (CheckVersionAndConvert(interp, reqPtr->pkgPtr->version, &pvi, - NULL) != TCL_OK) { - code = TCL_ERROR; - } else if (CheckVersionAndConvert(interp, - versionToProvide, &vi, NULL) != TCL_OK) { - ckfree(pvi); - code = TCL_ERROR; - } else { - int res = CompareVersions(pvi, vi, NULL); - - ckfree(pvi); - ckfree(vi); - if (res != 0) { - code = TCL_ERROR; - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "attempt to provide package %s %s failed:" - " package %s %s provided instead", - name, versionToProvide, - name, reqPtr->pkgPtr->version)); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", - "WRONGPROVIDE", NULL); - } + int res = CompareVersions(pvi, vi, NULL); + + ckfree(pvi); + ckfree(vi); + if (res != 0) { + result = TCL_ERROR; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "attempt to provide package %s %s failed:" + " package %s %s provided instead", + name, versionToProvide, + name, reqPtr->pkgPtr->version)); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", + "WRONGPROVIDE", NULL); } } - } else if (code != TCL_ERROR) { - Tcl_Obj *codePtr = Tcl_NewIntObj(code); - - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "attempt to provide package %s %s failed:" - " bad return code: %s", - name, versionToProvide, TclGetString(codePtr))); - Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); - TclDecrRefCount(codePtr); - code = TCL_ERROR; } + } else if (result != TCL_ERROR) { + Tcl_Obj *codePtr = Tcl_NewIntObj(result); - if (code == TCL_ERROR) { - Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( - "\n (\"package ifneeded %s %s\" script)", - name, versionToProvide)); - } - Tcl_Release(versionToProvide); + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "attempt to provide package %s %s failed:" + " bad return code: %s", + name, versionToProvide, TclGetString(codePtr))); + Tcl_SetErrorCode(interp, "TCL", "PACKAGE", "BADRESULT", NULL); + TclDecrRefCount(codePtr); + result = TCL_ERROR; + } - if (code != TCL_OK) { - /* - * Take a non-TCL_OK code from the script as an indication the - * package wasn't loaded properly, so the package system - * should not remember an improper load. - * - * This is consistent with our returning NULL. If we're not - * willing to tell our caller we got a particular version, we - * shouldn't store that version for telling future callers - * either. - */ + if (result == TCL_ERROR) { + Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( + "\n (\"package ifneeded %s %s\" script)", + name, versionToProvide)); + } + Tcl_Release(versionToProvide); - if (reqPtr->pkgPtr->version != NULL) { - ckfree(reqPtr->pkgPtr->version); - reqPtr->pkgPtr->version = NULL; - } - reqPtr->pkgPtr->clientData = NULL; - return code; + if (result != TCL_OK) { + /* + * Take a non-TCL_OK code from the script as an indication the + * package wasn't loaded properly, so the package system + * should not remember an improper load. + * + * This is consistent with our returning NULL. If we're not + * willing to tell our caller we got a particular version, we + * shouldn't store that version for telling future callers + * either. + */ + + if (reqPtr->pkgPtr->version != NULL) { + ckfree(reqPtr->pkgPtr->version); + reqPtr->pkgPtr->version = NULL; } + reqPtr->pkgPtr->clientData = NULL; + return result; } + + Tcl_NRAddCallback(interp, data[3], reqPtr, INT2PTR(reqc), (void *)reqv, NULL); return TCL_OK; } @@ -794,10 +864,19 @@ Tcl_PkgPresentEx( * *---------------------------------------------------------------------- */ +int +Tcl_PackageObjCmd( + ClientData dummy, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ +{ + return Tcl_NRCallObjProc(interp, TclNRPackageObjCmd, NULL, objc, objv); +} /* ARGSUSED */ int -Tcl_PackageObjCmd( +TclNRPackageObjCmd( ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -814,7 +893,7 @@ Tcl_PackageObjCmd( PKG_VSATISFIES }; Interp *iPtr = (Interp *) interp; - int optionIndex, exact, i, satisfies; + int optionIndex, exact, i, newobjc, satisfies; PkgAvail *availPtr, *prevPtr; Package *pkgPtr; Tcl_HashEntry *hPtr; @@ -823,6 +902,7 @@ Tcl_PackageObjCmd( const char *version; const char *argv2, *argv3, *argv4; char *iva = NULL, *ivb = NULL; + Tcl_Obj *objvListPtr, **newObjvPtr; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1029,7 +1109,6 @@ Tcl_PackageObjCmd( argv2 = TclGetString(objv[2]); if ((argv2[0] == '-') && (strcmp(argv2, "-exact") == 0)) { Tcl_Obj *ov; - int res; if (objc != 5) { goto requireSyntax; @@ -1046,20 +1125,42 @@ Tcl_PackageObjCmd( */ ov = Tcl_NewStringObj(version, -1); + Tcl_IncrRefCount(ov); Tcl_AppendStringsToObj(ov, "-", version, NULL); version = NULL; argv3 = TclGetString(objv[3]); + Tcl_IncrRefCount(objv[3]); - Tcl_IncrRefCount(ov); - res = Tcl_PkgRequireProc(interp, argv3, 1, &ov, NULL); - TclDecrRefCount(ov); - return res; + objvListPtr = Tcl_NewListObj(0, NULL); + Tcl_IncrRefCount(objvListPtr); + Tcl_ListObjAppendElement(interp, objvListPtr, ov); + Tcl_ListObjGetElements(interp, objvListPtr, &newobjc, &newObjvPtr); + + Tcl_NRAddCallback(interp, TclNRPackageObjCmdCleanup, objv[3], objvListPtr, NULL, NULL); + Tcl_NRAddCallback(interp, PkgRequireCore, (void *)argv3, INT2PTR(newobjc), newObjvPtr, NULL); + return TCL_OK; } else { + int i, newobjc = objc-3; + Tcl_Obj *const *newobjv = objv + 3; if (CheckAllRequirements(interp, objc-3, objv+3) != TCL_OK) { return TCL_ERROR; } + objvListPtr = Tcl_NewListObj(0, NULL); + Tcl_IncrRefCount(objvListPtr); + Tcl_IncrRefCount(objv[2]); + for (i = 0; i < newobjc; i++) { + + /* + * Tcl_Obj structures may have come from another interpreter, + * so duplicate them. + */ - return Tcl_PkgRequireProc(interp, argv2, objc-3, objv+3, NULL); + Tcl_ListObjAppendElement(interp, objvListPtr, Tcl_DuplicateObj(newobjv[i])); + } + Tcl_ListObjGetElements(interp, objvListPtr, &newobjc, &newObjvPtr); + Tcl_NRAddCallback(interp, TclNRPackageObjCmdCleanup, objv[2], objvListPtr, NULL, NULL); + Tcl_NRAddCallback(interp, PkgRequireCore, (void *)argv2, INT2PTR(newobjc), newObjvPtr, NULL); + return TCL_OK; } break; case PKG_UNKNOWN: { @@ -1199,6 +1300,13 @@ Tcl_PackageObjCmd( } return TCL_OK; } + +static int +TclNRPackageObjCmdCleanup(ClientData data[], Tcl_Interp *interp, int result) { + TclDecrRefCount((Tcl_Obj *)data[0]); + TclDecrRefCount((Tcl_Obj *)data[1]); + return result; +} /* *---------------------------------------------------------------------- diff --git a/tests/package.test b/tests/package.test index 74415ae..bc73003 100644 --- a/tests/package.test +++ b/tests/package.test @@ -608,6 +608,18 @@ test pkg-3.53 {Tcl_PkgRequire procedure, picking best stable version} { package require t set x } {1.1} +test package-3.54 {Tcl_PkgRequire procedure, coroutine support} -setup { + package forget t +} -body { + coroutine coro1 apply {{} { + package ifneeded t 2.1 { + yield + package provide t 2.1 + } + package require t 2.1 + }} + list [catch {coro1} msg] $msg +} -match glob -result {0 2.1} test package-4.1 {Tcl_PackageCmd procedure} -returnCodes error -body { -- cgit v0.12 From 396c1a637c399fdb78e0d52ec4944859fa072e5c Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 13 Feb 2018 20:51:57 +0000 Subject: New test expr-32.7 for bignum modulus range. --- tests/expr.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/expr.test b/tests/expr.test index 5843b49..c49a9ff 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -5838,6 +5838,9 @@ test expr-32.5 {Bug 1585704} { test expr-32.6 {Bug 1585704} { expr -(1<<32)%(1<<63) } [expr (1<<63)-(1<<32)] +test expr-32.7 {bignum regression} { + expr {0%(1<<63)} +} 0 test expr-33.1 {parse largest long value} longIs32bit { set max_long_str 2147483647 -- cgit v0.12 From 4a6163c6a6a7f6e85f28f753e303caaa99b83a31 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 13 Feb 2018 20:59:36 +0000 Subject: test expr-32.7 for bignum modulus range. FAILING for now. Error in TIP 484. --- tests/expr.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/expr.test b/tests/expr.test index 0b3620a..4fac8b1 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -5799,6 +5799,9 @@ test expr-32.5 {Bug 1585704} { test expr-32.6 {Bug 1585704} { expr -(1<<32)%(1<<63) } [expr (1<<63)-(1<<32)] +test expr-32.7 {bignum regression} { + expr {0%(1<<63)} +} 0 test expr-33.1 {parse largest long value} longIs32bit { set max_long_str 2147483647 -- cgit v0.12 From ea6e8c9dcdd3f2e3fa35a81646981e384593aae0 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 14 Feb 2018 10:46:08 +0000 Subject: Fix for issue 9fd5c629c1, TclOO - aborts when a trace on command deletion deletes the object's namespace. --- generic/tclBasic.c | 8 ++++---- generic/tclFileName.c | 2 +- generic/tclOO.c | 35 ++++++++++++++++++++++++++--------- generic/tclOOCall.c | 8 ++++---- generic/tclOOInt.h | 16 ++++++++-------- tests/oo.test | 12 ++++++++++++ 6 files changed, 55 insertions(+), 26 deletions(-) diff --git a/generic/tclBasic.c b/generic/tclBasic.c index e2319d2..9720689 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -3100,7 +3100,7 @@ Tcl_DeleteCommandFromToken( /* * We must delete this command, even though both traces and delete procs * may try to avoid this (renaming the command etc). Also traces and - * delete procs may try to delete the command themsevles. This flag + * delete procs may try to delete the command themselves. This flag * declares that a delete is in progress and that recursive deletes should * be ignored. */ @@ -7704,8 +7704,8 @@ ExprRandFunc( 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) + * To ensure different seeds in different threads (bug #416643), + * take into consideration the thread this interp is running in. */ iPtr->randSeed = TclpGetClicks() + (PTR2INT(Tcl_GetCurrentThread())<<12); @@ -9073,7 +9073,7 @@ TclNRCoroutineObjCmd( TclNRAddCallback(interp, NRCoroutineExitCallback, corPtr, NULL, NULL, NULL); - /* insure that the command is looked up in the correct namespace */ + /* ensure that the command is looked up in the correct namespace */ iPtr->lookupNsPtr = lookupNsPtr; Tcl_NREvalObj(interp, Tcl_NewListObj(objc-2, objv+2), 0); iPtr->numLevels--; diff --git a/generic/tclFileName.c b/generic/tclFileName.c index 2136883..b566d7f 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -1904,7 +1904,7 @@ TclGlob( } /* - * To process a [glob] invokation, this function may be called multiple + * To process a [glob] invocation, this function may be called multiple * times. Each time, the previously discovered filenames are in the * interpreter result. We stash that away here so the result is free for * error messsages. diff --git a/generic/tclOO.c b/generic/tclOO.c index f236ac9..bae784a 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -880,7 +880,7 @@ ObjectRenamedTrace( * 2950259] */ - if (((Namespace *) oPtr->namespacePtr)->earlyDeleteProc != NULL) { + if (oPtr->namespacePtr && ((Namespace *) oPtr->namespacePtr)->earlyDeleteProc != NULL) { Tcl_DeleteNamespace(oPtr->namespacePtr); } if (oPtr->classPtr) { @@ -1168,7 +1168,7 @@ ObjectNamespaceDeleted( Class *clsPtr = oPtr->classPtr, *mixinPtr; Method *mPtr; Tcl_Obj *filterObj, *variableObj; - int i; + int deleteAlreadyInProgress = 0, i; /* * Instruct everyone to no longer use any allocated fields of the object. @@ -1178,6 +1178,14 @@ ObjectNamespaceDeleted( */ if (oPtr->command) { + if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) { + /* + * Namespace deletion must have been triggered by a trace on command + * deletion , meaning that + */ + deleteAlreadyInProgress = 1; + } + Tcl_DeleteCommandFromToken(oPtr->fPtr->interp, oPtr->command); } if (oPtr->myCommand) { @@ -1273,14 +1281,17 @@ ObjectNamespaceDeleted( if (clsPtr->subclasses.list) { ckfree(clsPtr->subclasses.list); + clsPtr->subclasses.list = NULL; clsPtr->subclasses.num = 0; } if (clsPtr->instances.list) { ckfree(clsPtr->instances.list); + clsPtr->instances.list = NULL; clsPtr->instances.num = 0; } if (clsPtr->mixinSubs.list) { ckfree(clsPtr->mixinSubs.list); + clsPtr->mixinSubs.list = NULL; clsPtr->mixinSubs.num = 0; } @@ -1305,7 +1316,13 @@ ObjectNamespaceDeleted( * Delete the object structure itself. */ - DelRef(oPtr); + if (deleteAlreadyInProgress) { + oPtr->classPtr = NULL; + oPtr->namespacePtr = NULL; + } else { + DelRef(oPtr); + } + } /* @@ -2435,7 +2452,7 @@ Tcl_ObjectSetMetadata( * * PublicObjectCmd, PrivateObjectCmd, TclOOInvokeObject -- * - * Main entry point for object invokations. The Public* and Private* + * Main entry point for object invocations. The Public* and Private* * wrapper functions (implementations of both object instance commands * and [my]) are just thin wrappers round the main TclOOObjectCmdCore * function. Note that the core is function is NRE-aware. @@ -2520,8 +2537,8 @@ TclOOInvokeObject( * * TclOOObjectCmdCore, FinalizeObjectCall -- * - * Main function for object invokations. Does call chain creation, - * management and invokation. The function FinalizeObjectCall exists to + * Main function for object invocations. Does call chain creation, + * management and invocation. The function FinalizeObjectCall exists to * clean up after the non-recursive processing of TclOOObjectCmdCore. * * ---------------------------------------------------------------------- @@ -2533,7 +2550,7 @@ TclOOObjectCmdCore( Tcl_Interp *interp, /* The interpreter containing the object. */ int objc, /* How many arguments are being passed in. */ Tcl_Obj *const *objv, /* The array of arguments. */ - int flags, /* Whether this is an invokation through the + int flags, /* Whether this is an invocation through the * public or the private command interface. */ Class *startCls) /* Where to start in the call chain, or NULL * if we are to start at the front with @@ -2722,7 +2739,7 @@ Tcl_ObjectContextInvokeNext( * call context while we process the body. However, need to adjust the * argument-skip control because we're guaranteed to have a single prefix * arg (i.e., 'next') and not the variable amount that can happen because - * method invokations (i.e., '$obj meth' and 'my meth'), constructors + * method invocations (i.e., '$obj meth' and 'my meth'), constructors * (i.e., '$cls new' and '$cls create obj') and destructors (no args at * all) come through the same code. */ @@ -2791,7 +2808,7 @@ TclNRObjectContextInvokeNext( * call context while we process the body. However, need to adjust the * argument-skip control because we're guaranteed to have a single prefix * arg (i.e., 'next') and not the variable amount that can happen because - * method invokations (i.e., '$obj meth' and 'my meth'), constructors + * method invocations (i.e., '$obj meth' and 'my meth'), constructors * (i.e., '$cls new' and '$cls create obj') and destructors (no args at * all) come through the same code. */ diff --git a/generic/tclOOCall.c b/generic/tclOOCall.c index 3e4f561..d4e1e34 100644 --- a/generic/tclOOCall.c +++ b/generic/tclOOCall.c @@ -233,7 +233,7 @@ FreeMethodNameRep( * TclOOInvokeContext -- * * Invokes a single step along a method call-chain context. Note that the - * invokation of a step along the chain can cause further steps along the + * invocation of a step along the chain can cause further steps along the * chain to be invoked. Note that this function is written to be as light * in stack usage as possible. * @@ -830,7 +830,7 @@ AddMethodToCallChain( * Call chain semantics states that methods come as *late* in the * call chain as possible. This is done by copying down the * following methods. Note that this does not change the number of - * method invokations in the call chain; it just rearranges them. + * method invocations in the call chain; it just rearranges them. */ Class *declCls = callPtr->chain[i].filterDeclarer; @@ -935,7 +935,7 @@ IsStillValid( * TclOOGetCallContext -- * * Responsible for constructing the call context, an ordered list of all - * method implementations to be called as part of a method invokation. + * method implementations to be called as part of a method invocation. * This method is central to the whole operation of the OO system. * * ---------------------------------------------------------------------- @@ -1517,7 +1517,7 @@ TclOORenderCallChain( /* * Do the actual construction of the descriptions. They consist of a list * of triples that describe the details of how a method is understood. For - * each triple, the first word is the type of invokation ("method" is + * each triple, the first word is the type of invocation ("method" is * normal, "unknown" is special because it adds the method name as an * extra argument when handled by some method types, and "filter" is * special because it's a filter method). The second word is the name of diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index b75ffdb..1eb787f 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -149,8 +149,8 @@ typedef struct Object { struct Foundation *fPtr; /* The basis for the object system. Putting * this here allows the avoidance of quite a * lot of hash lookups on the critical path - * for object invokation and creation. */ - Tcl_Namespace *namespacePtr;/* This object's tame namespace. */ + * for object invocation and creation. */ + Tcl_Namespace *namespacePtr;/* This object's namespace. */ Tcl_Command command; /* Reference to this object's public * command. */ Tcl_Command myCommand; /* Reference to this object's internal @@ -162,12 +162,12 @@ typedef struct Object { /* Classes mixed into this object. */ LIST_STATIC(Tcl_Obj *) filters; /* List of filter names. */ - struct Class *classPtr; /* All classes have this non-NULL; it points - * to the class structure. Everything else has - * this NULL. */ + struct Class *classPtr; /* This is non-NULL for all classes, and NULL + * for everything else. It points to the class + * structure. */ int refCount; /* Number of strong references to this object. * Note that there may be many more weak - * references; this mechanism is there to + * references; this mechanism exists to * avoid Tcl_Preserve. */ int flags; int creationEpoch; /* Unique value to make comparisons of objects @@ -323,7 +323,7 @@ typedef struct Foundation { } Foundation; /* - * A call context structure is built when a method is called. They contain the + * A call context structure is built when a method is called. It contains the * chain of method implementations that are to be invoked by a particular * call, and the process of calling walks the chain, with the [next] command * proceeding to the next entry in the chain. @@ -334,7 +334,7 @@ typedef struct Foundation { struct MInvoke { Method *mPtr; /* Reference to the method implementation * record. */ - int isFilter; /* Whether this is a filter invokation. */ + int isFilter; /* Whether this is a filter invocation. */ Class *filterDeclarer; /* What class decided to add the filter; if * NULL, it was added by the object. */ }; diff --git a/tests/oo.test b/tests/oo.test index 8850ea5..8face06 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -1482,6 +1482,18 @@ test oo-11.4 {OO: cleanup} { lappend result [bar0 destroy] [oo::object create foo] [foo destroy] \ [oo::object create bar2] [bar2 destroy] } {1 {can't create object "foo": command already exists with that name} destroyed {} ::foo {} ::bar2 {}} +test oo-11.5 {OO: cleanup} { + oo::class create obj1 + + trace add command obj1 delete {apply {{name1 name2 action} { + set namespace [info object namespace $name1] + namespace delete $namespace + }}} + + rename obj1 {} + # No segmentation fault + return done +} done test oo-12.1 {OO: filters} { oo::class create Aclass -- cgit v0.12 From a7c17bc224dea481e831d6da7f924d8e064a5506 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 14 Feb 2018 12:14:38 +0000 Subject: Fix bug 3c32a3f8bd, segmentation fault in TclOO.c/ReleaseClassContents() for a class mixed into one of its instances. --- generic/tclOO.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/generic/tclOO.c b/generic/tclOO.c index bae784a..8a852ff 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -1006,8 +1006,18 @@ ReleaseClassContents( } for(j=0 ; jmixins.num ; j++) { Class *mixin = instancePtr->mixins.list[j]; + Class *nextMixin = NULL; if (mixin == clsPtr) { - instancePtr->mixins.list[j] = NULL; + if (j < instancePtr->mixins.num - 1) { + nextMixin = instancePtr->mixins.list[j+1]; + } + if (j == 0) { + instancePtr->mixins.num = 0; + instancePtr->mixins.list = NULL; + } else { + instancePtr->mixins.list[j-1] = nextMixin; + } + instancePtr->mixins.num -= 1; } } if (instancePtr != NULL && !IsRoot(instancePtr)) { @@ -1181,7 +1191,8 @@ ObjectNamespaceDeleted( if ((((Command *)oPtr->command)->flags && CMD_IS_DELETED)) { /* * Namespace deletion must have been triggered by a trace on command - * deletion , meaning that + * deletion , meaning that ObjectRenamedTrace() is eventually going + * to be called . */ deleteAlreadyInProgress = 1; } -- cgit v0.12 From c6eb0cc51d7c4feece753d3536454bf43d7785a3 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 14 Feb 2018 12:31:33 +0000 Subject: Unit test for issue 3c32a3f8bd, Segmentation fault in TclOO.c/ReleaseClassContents() for a class mixed into one of its instances. --- tests/oo.test | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/oo.test b/tests/oo.test index 8face06..0ae46f8 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -1495,6 +1495,24 @@ test oo-11.5 {OO: cleanup} { return done } done +test oo-11.6 { + OO: cleanup ReleaseClassContents() where class is mixed into one of its + instances +} { + oo::class create obj1 + ::oo::define obj1 {self mixin [self]} + + ::oo::copy obj1 obj2 + ::oo::objdefine obj2 {mixin [self]} + + ::oo::copy obj2 obj3 + trace add command obj3 delete [list obj3 dying] + rename obj2 {} + + # No segmentation fault + return done +} done + test oo-12.1 {OO: filters} { oo::class create Aclass Aclass create Aobject -- cgit v0.12 From 40e9ab2e654ef81e10d38260c765346aca33077e Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 14 Feb 2018 12:52:06 +0000 Subject: More tests for bignum modules regressions. --- tests/expr.test | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/expr.test b/tests/expr.test index c49a9ff..fd11870 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -5841,6 +5841,12 @@ test expr-32.6 {Bug 1585704} { test expr-32.7 {bignum regression} { expr {0%(1<<63)} } 0 +test expr-32.8 {bignum regression} { + expr {0%-(1<<63)} +} 0 +test expr-32.9 {bignum regression} { + expr {0%-(1+(1<<63))} +} 0 test expr-33.1 {parse largest long value} longIs32bit { set max_long_str 2147483647 -- cgit v0.12 From 7d25e385a2b2816630b16fdfe293c0fddd5e33fe Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 14 Feb 2018 13:00:28 +0000 Subject: Modify test oo-11.6 to not use [self], which is not avaiable until 8.7. --- tests/oo.test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/oo.test b/tests/oo.test index 0ae46f8..3829763 100644 --- a/tests/oo.test +++ b/tests/oo.test @@ -1500,10 +1500,10 @@ test oo-11.6 { instances } { oo::class create obj1 - ::oo::define obj1 {self mixin [self]} + ::oo::define obj1 {self mixin [uplevel 1 {namespace which obj1}]} ::oo::copy obj1 obj2 - ::oo::objdefine obj2 {mixin [self]} + ::oo::objdefine obj2 {mixin [uplevel 1 {namespace which obj2}]} ::oo::copy obj2 obj3 trace add command obj3 delete [list obj3 dying] @@ -3868,5 +3868,5 @@ cleanupTests return # Local Variables: -# mode: tcl +# MODE: Tcl # End: -- cgit v0.12 From 1e854210b71ecee27e16ad922e8f4bb312605114 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 14 Feb 2018 13:37:27 +0000 Subject: Rewrite documentation in comments for brevity and clarity. --- generic/tclListObj.c | 593 +++++++++++++++++++++++++-------------------------- generic/tclObj.c | 31 +-- generic/tclUtil.c | 37 ++-- 3 files changed, 325 insertions(+), 336 deletions(-) diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 3a1555d..0d37821 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -55,20 +55,22 @@ const Tcl_ObjType tclListType = { * * NewListIntRep -- * - * Creates a list internal rep with space for objc elements. objc - * must be > 0. If objv!=NULL, initializes with the first objc values - * in that array. If objv==NULL, initalize list internal rep to have - * 0 elements, with space to add objc more. Flag value "p" indicates + * Creates a 'List' structure with space for 'objc' elements. 'objc' must + * be > 0. If 'objv' is not NULL, The list is initialized with first + * 'objc' values in that array. Otherwise the list is initialized to have + * 0 elements, with space to add 'objc' more. Flag value 'p' indicates * how to behave on failure. * - * Results: - * A new List struct with refCount 0 is returned. If some failure - * prevents this then if p=0, NULL is returned and otherwise the - * routine panics. + * Value * - * Side effects: - * The ref counts of the elements in objv are incremented since the - * resulting list now refers to them. + * A new 'List' structure with refCount 0. If some failure + * prevents this NULL is returned if 'p' is 0 , and 'Tcl_Panic' + * is called if it is not. + * + * Effect + * + * The refCount of each value in 'objv' is incremented as it is added + * to the list. * *---------------------------------------------------------------------- */ @@ -132,22 +134,10 @@ NewListIntRep( /* *---------------------------------------------------------------------- * - * AttemptNewList -- - * - * Creates a list internal rep with space for objc elements. objc - * must be > 0. If objv!=NULL, initializes with the first objc values - * in that array. If objv==NULL, initalize list internal rep to have - * 0 elements, with space to add objc more. - * - * Results: - * A new List struct with refCount 0 is returned. If some failure - * prevents this then NULL is returned, and an error message is left - * in the interp result, unless interp is NULL. - * - * Side effects: - * The ref counts of the elements in objv are incremented since the - * resulting list now refers to them. + * AttemptNewList -- * + * Like NewListIntRep, but additionally sets an error message on failure. + * *---------------------------------------------------------------------- */ @@ -179,23 +169,20 @@ AttemptNewList( * * Tcl_NewListObj -- * - * This function is normally called when not debugging: i.e., when - * TCL_MEM_DEBUG is not defined. It creates a new list object from an - * (objc,objv) array: that is, each of the objc elements of the array - * referenced by objv is inserted as an element into a new Tcl object. + * Creates a new list object and adds values to it. When TCL_MEM_DEBUG is + * defined, 'Tcl_DbNewListObj' is called instead. * - * When TCL_MEM_DEBUG is defined, this function just returns the result - * of calling the debugging version Tcl_DbNewListObj. + * Value * - * Results: - * A new list object is returned that is initialized from the object - * pointers in objv. If objc is less than or equal to zero, an empty - * object is returned. The new object's string representation is left - * NULL. The resulting new list object has ref count 0. + * A new list 'Tcl_Obj' to which is appended values from 'objv', or if + * 'objc' is less than or equal to zero, a list 'Tcl_Obj' having no + * elements. The string representation of the new 'Tcl_Obj' is set to + * NULL. The refCount of the list is 0. * - * Side effects: - * The ref counts of the elements in objv are incremented since the - * resulting list now refers to them. + * Effect + * + * The refCount of each elements in 'objv' is incremented as it is added + * to the list. * *---------------------------------------------------------------------- */ @@ -246,28 +233,14 @@ Tcl_NewListObj( /* *---------------------------------------------------------------------- * - * Tcl_DbNewListObj -- - * - * This function is normally called when debugging: i.e., when - * TCL_MEM_DEBUG is defined. It creates new list objects. It is the same - * as the Tcl_NewListObj function above except that it calls - * Tcl_DbCkalloc directly with the file name and line number from its - * caller. This simplifies debugging since then the [memory active] - * command will report the correct file name and line number when - * reporting objects that haven't been freed. - * - * When TCL_MEM_DEBUG is not defined, this function just returns the - * result of calling Tcl_NewListObj. - * - * Results: - * A new list object is returned that is initialized from the object - * pointers in objv. If objc is less than or equal to zero, an empty - * object is returned. The new object's string representation is left - * NULL. The new list object has ref count 0. - * - * Side effects: - * The ref counts of the elements in objv are incremented since the - * resulting list now refers to them. + * Tcl_DbNewListObj -- + * + * Like 'Tcl_NewListObj', but it calls Tcl_DbCkalloc directly with the + * file name and line number from its caller. This simplifies debugging + * since the [memory active] command will report the correct file + * name and line number when reporting objects that haven't been freed. + * + * When TCL_MEM_DEBUG is not defined, 'Tcl_NewListObj' is called instead. * *---------------------------------------------------------------------- */ @@ -328,19 +301,8 @@ Tcl_DbNewListObj( * * Tcl_SetListObj -- * - * Modify an object to be a list containing each of the objc elements of - * the object array referenced by objv. - * - * Results: - * None. - * - * Side effects: - * The object is made a list object and is initialized from the object - * pointers in objv. If objc is less than or equal to zero, an empty - * object is returned. The new object's string representation is left - * NULL. The ref counts of the elements in objv are incremented since the - * list now refers to them. The object's old string and internal - * representations are freed and its type is set NULL. + * Like 'Tcl_NewListObj', but operates on an existing 'Tcl_Obj'instead of + * creating a new one. * *---------------------------------------------------------------------- */ @@ -384,18 +346,20 @@ Tcl_SetListObj( * * TclListObjCopy -- * - * Makes a "pure list" copy of a list value. This provides for the C - * level a counterpart of the [lrange $list 0 end] command, while using - * internals details to be as efficient as possible. + * Creates a new 'Tcl_Obj' which is a pure copy of a list value. This + * provides for the C level a counterpart of the [lrange $list 0 end] + * command, while using internals details to be as efficient as possible. + * + * Value * - * Results: - * Normally returns a pointer to a new Tcl_Obj, that contains the same - * list value as *listPtr does. The returned Tcl_Obj has a refCount of - * zero. If *listPtr does not hold a list, NULL is returned, and if - * interp is non-NULL, an error message is recorded there. + * The address of the new 'Tcl_Obj' which shares its internal + * representation with 'listPtr', and whose refCount is 0. If 'listPtr' + * is not actually a list, the value is NULL, and an error message is left + * in 'interp' if it is not NULL. * - * Side effects: - * None. + * Effect + * + * 'listPtr' is converted to a list if it isn't one already. * *---------------------------------------------------------------------- */ @@ -425,27 +389,30 @@ TclListObjCopy( * * Tcl_ListObjGetElements -- * - * This function returns an (objc,objv) array of the elements in a list - * object. + * Retreive the elements in a list 'Tcl_Obj'. + * + * Value + * + * TCL_OK + * + * A count of list elements is stored, 'objcPtr', And a pointer to the + * array of elements in the list is stored in 'objvPtr'. * - * Results: - * The return value is normally TCL_OK; in this case *objcPtr is set to - * the count of list elements and *objvPtr is set to a pointer to an - * array of (*objcPtr) pointers to each list element. If listPtr does not - * refer to a list object and the object can not be converted to one, - * TCL_ERROR is returned and an error message will be left in the - * interpreter's result if interp is not NULL. + * The elements accessible via 'objvPtr' should be treated as readonly + * and the refCount for each object is _not_ incremented; the caller + * must do that if it holds on to a reference. Furthermore, the + * pointer and length returned by this function may change as soon as + * any function is called on the list object. Be careful about + * retaining the pointer in a local data structure. * - * The objects referenced by the returned array should be treated as - * readonly and their ref counts are _not_ incremented; the caller must - * do that if it holds on to a reference. Furthermore, the pointer and - * length returned by this function may change as soon as any function is - * called on the list object; be careful about retaining the pointer in a - * local data structure. + * TCL_ERROR * - * Side effects: - * The possible conversion of the object referenced by listPtr - * to a list object. + * 'listPtr' is not a valid list. An error message is left in the + * interpreter's result if 'interp' is not NULL. + * + * Effect + * + * 'listPtr' is converted to a list object if it isn't one already. * *---------------------------------------------------------------------- */ @@ -486,20 +453,27 @@ Tcl_ListObjGetElements( * * Tcl_ListObjAppendList -- * - * This function appends the elements in the list value referenced by - * elemListPtr to the list value referenced by listPtr. + * Appends the elements of elemListPtr to those of listPtr. + * + * Value + * + * TCL_OK + * + * Success. * - * Results: - * The return value is normally TCL_OK. If listPtr or elemListPtr do not - * refer to list values, TCL_ERROR is returned and an error message is - * left in the interpreter's result if interp is not NULL. + * TCL_ERROR * - * Side effects: - * The reference counts of the elements in elemListPtr are incremented - * since the list now refers to them. listPtr and elemListPtr are - * converted, if necessary, to list objects. Also, appending the new - * elements may cause listObj's array of element pointers to grow. - * listPtr's old string representation, if any, is invalidated. + * 'listPtr' or 'elemListPtr' are not valid lists. An error + * message is left in the interpreter's result if 'interp' is not NULL. + * + * Effect + * + * The reference count of each element of 'elemListPtr' as it is added to + * 'listPtr'. 'listPtr' and 'elemListPtr' are converted to 'tclListType' + * if they are not already. Appending the new elements may cause the + * array of element pointers in 'listObj' to grow. If any objects are + * appended to 'listPtr'. Any preexisting string representation of + * 'listPtr' is invalidated. * *---------------------------------------------------------------------- */ @@ -538,24 +512,27 @@ Tcl_ListObjAppendList( * * Tcl_ListObjAppendElement -- * - * This function is a special purpose version of Tcl_ListObjAppendList: - * it appends a single object referenced by objPtr to the list object - * referenced by listPtr. If listPtr is not already a list object, an - * attempt will be made to convert it to one. - * - * Results: - * The return value is normally TCL_OK; in this case objPtr is added to - * the end of listPtr's list. If listPtr does not refer to a list object - * and the object can not be converted to one, TCL_ERROR is returned and - * an error message will be left in the interpreter's result if interp is - * not NULL. - * - * Side effects: - * The ref count of objPtr is incremented since the list now refers to - * it. listPtr will be converted, if necessary, to a list object. Also, - * appending the new element may cause listObj's array of element - * pointers to grow. listPtr's old string representation, if any, is - * invalidated. + * Like 'Tcl_ListObjAppendList', but Appends a single value to a list. + * + * Value + * + * TCL_OK + * + * 'objPtr' is appended to the elements of 'listPtr'. + * + * TCL_ERROR + * + * listPtr does not refer to a list object and the object can not be + * converted to one. An error message will be left in the + * interpreter's result if interp is not NULL. + * + * Effect + * + * If 'listPtr' is not already of type 'tclListType', it is converted. + * The 'refCount' of 'objPtr' is incremented as it is added to 'listPtr'. + * Appending the new element may cause the the array of element pointers + * in 'listObj' to grow. Any preexisting string representation of + * 'listPtr' is invalidated. * *---------------------------------------------------------------------- */ @@ -706,23 +683,27 @@ Tcl_ListObjAppendElement( * * Tcl_ListObjIndex -- * - * This function returns a pointer to the index'th object from the list - * referenced by listPtr. The first element has index 0. If index is - * negative or greater than or equal to the number of elements in the - * list, a NULL is returned. If listPtr is not a list object, an attempt - * will be made to convert it to a list. + * Retrieve a pointer to the element of 'listPtr' at 'index'. The index + * of the first element is 0. + * + * Value + * + * TCL_OK * - * Results: - * The return value is normally TCL_OK; in this case objPtrPtr is set to - * the Tcl_Obj pointer for the index'th list element or NULL if index is - * out of range. This object should be treated as readonly and its ref - * count is _not_ incremented; the caller must do that if it holds on to - * the reference. If listPtr does not refer to a list and can't be - * converted to one, TCL_ERROR is returned and an error message is left - * in the interpreter's result if interp is not NULL. + * A pointer to the element at 'index' is stored in 'objPtrPtr'. If + * 'index' is out of range, NULL is stored in 'objPtrPtr'. This + * object should be treated as readonly and its 'refCount' is _not_ + * incremented. The caller must do that if it holds on to the + * reference. + * + * TCL_ERROR * - * Side effects: - * listPtr will be converted, if necessary, to a list object. + * 'listPtr' is not a valid list. An an error message is left in the + * interpreter's result if 'interp' is not NULL. + * + * Effect + * + * If 'listPtr' is not already of type 'tclListType', it is converted. * *---------------------------------------------------------------------- */ @@ -764,19 +745,20 @@ Tcl_ListObjIndex( * * Tcl_ListObjLength -- * - * This function returns the number of elements in a list object. If the - * object is not already a list object, an attempt will be made to - * convert it to one. + * Retrieve the number of elements in a list. + * + * Value + * + * TCL_OK + * + * A count of list elements is stored at the address provided by + * 'intPtr'. If 'listPtr' is not already of type 'tclListPtr', it is + * converted. * - * Results: - * The return value is normally TCL_OK; in this case *intPtr will be set - * to the integer count of list elements. If listPtr does not refer to a - * list object and the object can not be converted to one, TCL_ERROR is - * returned and an error message will be left in the interpreter's result - * if interp is not NULL. + * TCL_ERROR * - * Side effects: - * The possible conversion of the argument object to a list object. + * 'listPtr' is not a valid list. An error message will be left in + * the interpreter's result if 'interp' is not NULL. * *---------------------------------------------------------------------- */ @@ -812,35 +794,36 @@ Tcl_ListObjLength( * * Tcl_ListObjReplace -- * - * This function replaces zero or more elements of the list referenced by - * listPtr with the objects from an (objc,objv) array. The objc elements - * of the array referenced by objv replace the count elements in listPtr - * starting at first. - * - * If the argument first is zero or negative, it refers to the first - * element. If first is greater than or equal to the number of elements - * in the list, then no elements are deleted; the new elements are - * appended to the list. Count gives the number of elements to replace. - * If count is zero or negative then no elements are deleted; the new - * elements are simply inserted before first. - * - * The argument objv refers to an array of objc pointers to the new - * elements to be added to listPtr in place of those that were deleted. - * If objv is NULL, no new elements are added. If listPtr is not a list - * object, an attempt will be made to convert it to one. - * - * Results: - * The return value is normally TCL_OK. If listPtr does not refer to a - * list object and can not be converted to one, TCL_ERROR is returned and - * an error message will be left in the interpreter's result if interp is - * not NULL. - * - * Side effects: - * The ref counts of the objc elements in objv are incremented since the - * resulting list now refers to them. Similarly, the ref counts for - * replaced objects are decremented. listPtr is converted, if necessary, - * to a list object. listPtr's old string representation, if any, is - * freed. + * Replace values in a list. + * + * If 'first' is zero or negative, it refers to the first element. If + * 'first' outside the range of elements in the list, no elements are + * deleted. + * + * If 'count' is zero or negative no elements are deleted, and any new + * elements are inserted at the beginning of the list. + * + * Value + * + * TCL_OK + * + * The first 'objc' values of 'objv' replaced 'count' elements in 'listPtr' + * starting at 'first'. If 'objc' 0, no new elements are added. + * + * TCL_ERROR + * + * 'listPtr' is not a valid list. An error message is left in the + * interpreter's result if 'interp' is not NULL. + * + * Effect + * + * If 'listPtr' is not of type 'tclListType', it is converted if possible. + * + * The 'refCount' of each element appended to the list is incremented. + * Similarly, the 'refCount' for each replaced element is decremented. + * + * If 'listPtr' is modified, any previous string representation is + * invalidated. * *---------------------------------------------------------------------- */ @@ -1098,22 +1081,19 @@ Tcl_ListObjReplace( * * TclLindexList -- * - * This procedure handles the 'lindex' command when objc==3. + * Implements the 'lindex' command when objc==3. * - * Results: - * Returns a pointer to the object extracted, or NULL if an error - * occurred. The returned object already includes one reference count for - * the pointer returned. + * Implemented entirely as a wrapper around 'TclLindexFlat'. Reconfigures + * the argument format into required form while taking care to manage + * shimmering so as to tend to keep the most useful intreps + * and/or avoid the most expensive conversions. * - * Side effects: - * None. + * Value * - * Notes: - * This procedure is implemented entirely as a wrapper around - * TclLindexFlat. All it does is reconfigure the argument format into the - * form required by TclLindexFlat, while taking care to manage shimmering - * in such a way that we tend to keep the most useful intreps and/or - * avoid the most expensive conversions. + * A pointer to the specified element, with its 'refCount' incremented, or + * NULL if an error occurred. + * + * Notes * *---------------------------------------------------------------------- */ @@ -1185,25 +1165,20 @@ TclLindexList( /* *---------------------------------------------------------------------- * - * TclLindexFlat -- + * TclLindexFlat -- + * + * The core of the 'lindex' command, with all index + * arguments presented as a flat list. * - * This procedure is the core of the 'lindex' command, with all index - * arguments presented as a flat list. + * Value * - * Results: - * Returns a pointer to the object extracted, or NULL if an error - * occurred. The returned object already includes one reference count for - * the pointer returned. + * A pointer to the object extracted, with its 'refCount' incremented, or + * NULL if an error occurred. Thus, the calling code will usually do + * something like: * - * Side effects: - * None. + * Tcl_SetObjResult(interp, result); + * Tcl_DecrRefCount(result); * - * Notes: - * The reference count of the returned object includes one reference - * corresponding to the pointer returned. Thus, the calling code will - * usually do something like: - * Tcl_SetObjResult(interp, result); - * Tcl_DecrRefCount(result); * *---------------------------------------------------------------------- */ @@ -1279,23 +1254,16 @@ TclLindexFlat( * * TclLsetList -- * - * Core of the 'lset' command when objc == 4. Objv[2] may be either a + * The core of [lset] when objc == 4. Objv[2] may be either a * scalar index or a list of indices. * - * Results: - * Returns the new value of the list variable, or NULL if there was an - * error. The returned object includes one reference count for the - * pointer returned. + * Implemented entirely as a wrapper around 'TclLindexFlat', as described + * for 'TclLindexList'. * - * Side effects: - * None. + * Value * - * Notes: - * This procedure is implemented entirely as a wrapper around - * TclLsetFlat. All it does is reconfigure the argument format into the - * form required by TclLsetFlat, while taking care to manage shimmering - * in such a way that we tend to keep the most useful intreps and/or - * avoid the most expensive conversions. + * The new list, with the 'refCount' of 'valuPtr' incremented, or NULL if + * there was an error. * *---------------------------------------------------------------------- */ @@ -1357,36 +1325,39 @@ TclLsetList( * * Core engine of the 'lset' command. * - * Results: - * Returns the new value of the list variable, or NULL if an error - * occurred. The returned object includes one reference count for the - * pointer returned. - * - * Side effects: - * On entry, the reference count of the variable value does not reflect - * any references held on the stack. The first action of this function is - * to determine whether the object is shared, and to duplicate it if it - * is. The reference count of the duplicate is incremented. At this - * point, the reference count will be 1 for either case, so that the - * object will appear to be unshared. - * - * If an error occurs, and the object has been duplicated, the reference - * count on the duplicate is decremented so that it is now 0: this - * dismisses any memory that was allocated by this function. - * - * If no error occurs, the reference count of the original object is - * incremented if the object has not been duplicated, and nothing is done - * to a reference count of the duplicate. Now the reference count of an - * unduplicated object is 2 (the returned pointer, plus the one stored in - * the variable). The reference count of a duplicate object is 1, - * reflecting that the returned pointer is the only active reference. The - * caller is expected to store the returned value back in the variable - * and decrement its reference count. (INST_STORE_* does exactly this.) - * - * Surgery is performed on the unshared list value to produce the result. - * TclLsetFlat maintains a linked list of Tcl_Obj's whose string + * Value + * + * The resulting list + * + * The 'refCount' of 'valuePtr' is incremented. If 'listPtr' was not + * duplicated, its 'refCount' is incremented. The reference count of + * an unduplicated object is therefore 2 (one for the returned pointer + * and one for the variable that holds it). The reference count of a + * duplicate object is 1, reflecting that result is the only active + * reference. The caller is expected to store the result in the + * variable and decrement its reference count. (INST_STORE_* does + * exactly this.) + * + * NULL + * + * An error occurred. If 'listPtr' was duplicated, the reference + * count on the duplicate is decremented so that it is 0, causing any + * memory allocated by this function to be freed. + * + * + * Effect + * + * On entry, the reference count of 'listPtr' does not reflect any + * references held on the stack. The first action of this function is to + * determine whether 'listPtr' is shared and to create a duplicate + * unshared copy if it is. The reference count of the duplicate is + * incremented. At this point, the reference count is 1 in either case so + * that the object is considered unshared. + * + * The unshared list is altered directly to produce the result. + * 'TclLsetFlat' maintains a linked list of 'Tcl_Obj' values whose string * representations must be spoilt by threading via 'ptr2' of the - * two-pointer internal representation. On entry to TclLsetFlat, the + * two-pointer internal representation. On entry to 'TclLsetFlat', the * values of 'ptr2' are immaterial; on exit, the 'ptr2' field of any * Tcl_Obj that has been modified is set to NULL. * @@ -1601,26 +1572,38 @@ TclLsetFlat( * * TclListObjSetElement -- * - * Set a single element of a list to a specified value + * Set a single element of a list to a specified value. * - * Results: - * The return value is normally TCL_OK. If listPtr does not refer to a - * list object and cannot be converted to one, TCL_ERROR is returned and - * an error message will be left in the interpreter result if interp is - * not NULL. Similarly, if index designates an element outside the range - * [0..listLength-1], where 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. + * It is the caller's responsibility to invalidate the string + * representation of the 'listPtr'. * - * 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. + * Value + * + * TCL_OK + * + * Success. + * + * TCL_ERROR + * + * 'listPtr' does not refer to a list object and cannot be converted + * to one. An error message will be left in the interpreter result if + * interp is not NULL. + * + * TCL_ERROR + * + * An index designates an element outside the range [0..listLength-1], + * where 'listLength' is the count of elements in the list object + * designated by 'listPtr'. An error message is left in the + * interpreter result. + * + * Effect + * + * If 'listPtr' designates a shared object, 'Tcl_Panic' is called. If + * 'listPtr' is not already of type 'tclListType', it is converted and the + * internal representation is unshared. The 'refCount' of the element at + * 'index' is decremented and replaced in the list with the 'valuePtr', + * whose 'refCount' in turn is incremented. * - * It is the caller's responsibility to invalidate the string - * representation of the object. * *---------------------------------------------------------------------- */ @@ -1738,16 +1721,14 @@ TclListObjSetElement( * * FreeListInternalRep -- * - * Deallocate the storage associated with a list object's internal - * representation. + * Deallocate the storage associated with the internal representation of a + * a list object. * - * Results: - * None. + * Effect * - * Side effects: - * Frees listPtr's List* internal representation and sets listPtr's - * internalRep.twoPtrValue.ptr1 to NULL. Decrements the ref counts of all - * element objects, which may free them. + * The storage for the internal 'List' pointer of 'listPtr' is freed, the + * 'internalRep.twoPtrValue.ptr1' of 'listPtr' is set to NULL, and the 'refCount' + * of each element of the list is decremented. * *---------------------------------------------------------------------- */ @@ -1776,14 +1757,12 @@ FreeListInternalRep( * * DupListInternalRep -- * - * Initialize the internal representation of a list Tcl_Obj to share the + * Initialize the internal representation of a list 'Tcl_Obj' to share the * internal representation of an existing list object. * - * Results: - * None. + * Effect * - * Side effects: - * The reference count of the List internal rep is incremented. + * The 'refCount' of the List internal rep is incremented. * *---------------------------------------------------------------------- */ @@ -1803,16 +1782,20 @@ DupListInternalRep( * * SetListFromAny -- * - * Attempt to generate a list internal form for the Tcl object "objPtr". + * Convert any object to a list. + * + * Value * - * Results: - * The return value is TCL_OK or TCL_ERROR. If an error occurs during - * conversion, an error message is left in the interpreter's result - * unless "interp" is NULL. + * TCL_OK + * + * Success. The internal representation of 'objPtr' is set, and the type + * of 'objPtr' is 'tclListType'. + * + * TCL_ERROR + * + * An error occured during conversion. An error message is left in the + * interpreter's result if 'interp' is not NULL. * - * Side effects: - * If no error occurs, a list is stored as "objPtr"s internal - * representation. * *---------------------------------------------------------------------- */ @@ -1937,18 +1920,16 @@ SetListFromAny( * * UpdateStringOfList -- * - * Update the string representation for a list object. Note: This - * function does not invalidate an existing old string rep so storage - * will be lost if this has not already been done. + * Update the string representation for a list object. + * + * Any previously-exising string representation is not invalidated, so + * storage is lost if this has not been taken care of. * - * Results: - * None. + * Effect * - * Side effects: - * The object's string is set to a valid string that results from the - * list-to-string conversion. This string will be empty if the list has - * no elements. The list internal representation should not be NULL and - * we assume it is not NULL. + * The string representation of 'listPtr' is set to the resulting string. + * This string will be empty if the list has no elements. It is assumed + * that the list internal representation is not NULL. * *---------------------------------------------------------------------- */ diff --git a/generic/tclObj.c b/generic/tclObj.c index 3bf5b8e..a75ecdd 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -2467,23 +2467,26 @@ Tcl_SetIntObj( * * Tcl_GetIntFromObj -- * - * Attempt to return an int from the Tcl object "objPtr". If the object - * is not already an int, an attempt will be made to convert it to one. + * Retrieve the integer value of 'objPtr'. * - * Integer and long integer objects share the same "integer" type - * implementation. We store all integers as longs and Tcl_GetIntFromObj - * checks whether the current value of the long can be represented by an - * int. + * Value * - * Results: - * The return value is a standard Tcl object result. If an error occurs - * during conversion or if the long integer held by the object can not be - * represented by an int, an error message is left in the interpreter's - * result unless "interp" is NULL. + * TCL_OK * - * Side effects: - * If the object is not already an int, the conversion will free any old - * internal representation. + * Success. + * + * TCL_ERROR + * + * An error occurred during conversion or the integral value can not + * be represented as an integer (it might be too large). An error + * message is left in the interpreter's result if 'interp' is not + * NULL. + * + * Effect + * + * 'objPtr' is converted to an integer if necessary if it is not one + * already. The conversion frees any previously-existing internal + * representation. * *---------------------------------------------------------------------- */ diff --git a/generic/tclUtil.c b/generic/tclUtil.c index feee9c5..396f992 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3530,22 +3530,27 @@ TclFormatInt( * * TclGetIntForIndex -- * - * This function 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. - * + * Provides an integer corresponding to the list index held in a Tcl + * object. The string value 'objPtr' is expected have the format + * integer([+-]integer)? or end([+-]integer)?. + * + * Value + * TCL_OK + * + * The index is stored at the address given by by 'indexPtr'. If + * 'objPtr' has the value "end", the value stored is 'endValue'. + * + * TCL_ERROR + * + * The value of 'objPtr' does not have one of the expected formats. If + * 'interp' is non-NULL, an error message is left in the interpreter's + * result object. + * + * Effect + * + * The object referenced by 'objPtr' is converted, as needed, to an + * integer, wide integer, or end-based-index object. + * *---------------------------------------------------------------------- */ -- cgit v0.12 From 5d5bd4cd5514c5e0361bb9762e8e560384d4e8a6 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 14 Feb 2018 14:05:04 +0000 Subject: Modify TclCreateProc to handle arbitrary argument names, not just ASCII. --- generic/tclExecute.c | 4 +-- generic/tclInt.h | 2 +- generic/tclProc.c | 96 +++++++++++++++++++++++----------------------------- 3 files changed, 45 insertions(+), 57 deletions(-) diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 761a23e..93ed50b 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -1333,12 +1333,12 @@ TclStackAlloc( int numBytes) { Interp *iPtr = (Interp *) interp; - int numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *); + int numWords; if (iPtr == NULL || iPtr->execEnvPtr == NULL) { return (void *) ckalloc(numBytes); } - + numWords = (numBytes + (sizeof(Tcl_Obj *) - 1))/sizeof(Tcl_Obj *); return (void *) StackAllocWords(interp, numWords); } diff --git a/generic/tclInt.h b/generic/tclInt.h index ac67ebd..71a55cc 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -4433,7 +4433,7 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file, /* *---------------------------------------------------------------- - * Macro used by the Tcl core to increment a namespace's export export epoch + * Macro used by the Tcl core to increment a namespace's export epoch * counter. The ANSI C "prototype" for this macro is: * * MODULE_SCOPE void TclInvalidateNsCmdLookup(Namespace *nsPtr); diff --git a/generic/tclProc.c b/generic/tclProc.c index 5c68e17..9940f9d 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -393,13 +393,13 @@ TclCreateProc( Proc **procPtrPtr) /* Returns: pointer to proc data. */ { Interp *iPtr = (Interp *) interp; - const char **argArray = NULL; register Proc *procPtr; - int i, length, result, numArgs; - const char *args, *bytes, *p; + int i, result, numArgs, plen; + const char *bytes, *argname, *argnamei; + char argnamelast; register CompiledLocal *localPtr = NULL; - Tcl_Obj *defPtr; + Tcl_Obj *defPtr, *errorObj, **argArray; int precompiled = 0; if (bodyPtr->typePtr == &tclProcBodyType) { @@ -436,6 +436,7 @@ TclCreateProc( */ if (Tcl_IsShared(bodyPtr)) { + int length; Tcl_Obj *sharedBodyPtr = bodyPtr; bytes = TclGetStringFromObj(bodyPtr, &length); @@ -473,12 +474,9 @@ TclCreateProc( * argument specifier. If the body is precompiled, processing is limited * to checking that the parsed argument is consistent with the one stored * in the Proc. - * - * THIS FAILS IF THE ARG LIST OBJECT'S STRING REP CONTAINS NULS. */ - args = TclGetStringFromObj(argsPtr, &length); - result = Tcl_SplitList(interp, args, &numArgs, &argArray); + result = Tcl_ListObjGetElements(interp , argsPtr ,&numArgs ,&argArray); if (result != TCL_OK) { goto procError; } @@ -501,28 +499,28 @@ TclCreateProc( for (i = 0; i < numArgs; i++) { int fieldCount, nameLength, valueLength; - const char **fieldValues; + Tcl_Obj **fieldValues; /* * Now divide the specifier up into name and default. */ - result = Tcl_SplitList(interp, argArray[i], &fieldCount, + result = Tcl_ListObjGetElements(interp, argArray[i], &fieldCount, &fieldValues); if (result != TCL_OK) { goto procError; } if (fieldCount > 2) { - ckfree(fieldValues); - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "too many fields in argument specifier \"%s\"", - argArray[i])); + errorObj = Tcl_NewStringObj( + "too many fields in argument specifier \"", -1); + Tcl_AppendObjToObj(errorObj, argArray[i]); + Tcl_AppendToObj(errorObj, "\"", -1); + Tcl_SetObjResult(interp, errorObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "FORMALARGUMENTFORMAT", NULL); goto procError; } - if ((fieldCount == 0) || (*fieldValues[0] == 0)) { - ckfree(fieldValues); + if ((fieldCount == 0) || (fieldValues[0]->length == 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "argument with no name", -1)); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", @@ -530,9 +528,10 @@ TclCreateProc( goto procError; } - nameLength = strlen(fieldValues[0]); + nameLength = Tcl_NumUtfChars(Tcl_GetString(fieldValues[0]), fieldValues[0]->length); if (fieldCount == 2) { - valueLength = strlen(fieldValues[1]); + valueLength = Tcl_NumUtfChars(Tcl_GetString(fieldValues[1]), + fieldValues[1]->length); } else { valueLength = 0; } @@ -541,33 +540,29 @@ TclCreateProc( * Check that the formal parameter name is a scalar. */ - p = fieldValues[0]; - while (*p != '\0') { - if (*p == '(') { - const char *q = p; - do { - q++; - } while (*q != '\0'); - q--; - if (*q == ')') { /* We have an array element. */ + argname = Tcl_GetStringFromObj(fieldValues[0], &plen); + argnamei = argname; + argnamelast = argname[plen-1]; + while (plen--) { + if (argnamei[0] == '(') { + if (argnamelast == ')') { /* We have an array element. */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "formal parameter \"%s\" is an array element", - fieldValues[0])); - ckfree(fieldValues); + Tcl_GetString(fieldValues[0]))); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "FORMALARGUMENTFORMAT", NULL); goto procError; } - } else if ((*p == ':') && (*(p+1) == ':')) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "formal parameter \"%s\" is not a simple name", - fieldValues[0])); - ckfree(fieldValues); + } else if ((argnamei[0] == ':') && (argnamei[1] == ':')) { + errorObj = Tcl_NewStringObj("formal parameter \"", -1); + Tcl_AppendObjToObj(errorObj, fieldValues[0]); + Tcl_AppendToObj(errorObj, "\" is not a simple name", -1); + Tcl_SetObjResult(interp, errorObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "FORMALARGUMENTFORMAT", NULL); goto procError; } - p++; + argnamei = Tcl_UtfNext(argnamei); } if (precompiled) { @@ -583,7 +578,7 @@ TclCreateProc( */ if ((localPtr->nameLength != nameLength) - || (strcmp(localPtr->name, fieldValues[0])) + || (Tcl_UtfNcmp(localPtr->name, argname, nameLength)) || (localPtr->frameIndex != i) || !(localPtr->flags & VAR_ARGUMENT) || (localPtr->defValuePtr == NULL && fieldCount == 2) @@ -591,7 +586,6 @@ TclCreateProc( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "procedure \"%s\": formal parameter %d is " "inconsistent with precompiled body", procName, i)); - ckfree(fieldValues); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "BYTECODELIES", NULL); goto procError; @@ -607,12 +601,13 @@ TclCreateProc( &tmpLength); if ((valueLength != tmpLength) || - strncmp(fieldValues[1], tmpPtr, (size_t) tmpLength)) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "procedure \"%s\": formal parameter \"%s\" has " - "default value inconsistent with precompiled body", - procName, fieldValues[0])); - ckfree(fieldValues); + Tcl_UtfNcmp(Tcl_GetString(fieldValues[1]), tmpPtr, tmpLength)) { + errorObj = Tcl_ObjPrintf( + "procedure \"%s\": formal parameter \"" ,procName); + Tcl_AppendObjToObj(errorObj, fieldValues[0]); + Tcl_AppendToObj(errorObj, "\" has " + "default value inconsistent with precompiled body", -1); + Tcl_SetObjResult(interp, errorObj); Tcl_SetErrorCode(interp, "TCL", "OPERATION", "PROC", "BYTECODELIES", NULL); goto procError; @@ -632,7 +627,7 @@ TclCreateProc( * local variables for the argument. */ - localPtr = ckalloc(TclOffset(CompiledLocal, name) + nameLength+1); + localPtr = ckalloc(TclOffset(CompiledLocal, name) + fieldValues[0]->length +1); if (procPtr->firstLocalPtr == NULL) { procPtr->firstLocalPtr = procPtr->lastLocalPtr = localPtr; } else { @@ -640,19 +635,18 @@ TclCreateProc( procPtr->lastLocalPtr = localPtr; } localPtr->nextPtr = NULL; - localPtr->nameLength = nameLength; + localPtr->nameLength = Tcl_NumUtfChars(argname, fieldValues[0]->length); localPtr->frameIndex = i; localPtr->flags = VAR_ARGUMENT; localPtr->resolveInfo = NULL; if (fieldCount == 2) { - localPtr->defValuePtr = - Tcl_NewStringObj(fieldValues[1], valueLength); + localPtr->defValuePtr = fieldValues[1]; Tcl_IncrRefCount(localPtr->defValuePtr); } else { localPtr->defValuePtr = NULL; } - memcpy(localPtr->name, fieldValues[0], nameLength + 1); + memcpy(localPtr->name, argname, fieldValues[0]->length + 1); if ((i == numArgs - 1) && (localPtr->nameLength == 4) && (localPtr->name[0] == 'a') @@ -660,12 +654,9 @@ TclCreateProc( localPtr->flags |= VAR_IS_ARGS; } } - - ckfree(fieldValues); } *procPtrPtr = procPtr; - ckfree(argArray); return TCL_OK; procError: @@ -686,9 +677,6 @@ TclCreateProc( } ckfree(procPtr); } - if (argArray != NULL) { - ckfree(argArray); - } return TCL_ERROR; } -- cgit v0.12 -- cgit v0.12 From e6dd74e90e7f9d084758d64cd2be5a6138fef3a3 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Wed, 14 Feb 2018 19:07:16 +0000 Subject: Lift the restriction on command names names that begin with ":". --- .fossil-settings/binary-glob | 9 - .fossil-settings/crlf-glob | 17 - .fossil-settings/crnl-glob | 17 - .fossil-settings/encoding-glob | 9 - .fossil-settings/ignore-glob | 48 - .project | 11 - .settings/org.eclipse.core.resources.prefs | 2 - .settings/org.eclipse.core.runtime.prefs | 2 - ChangeLog | 8856 ----- ChangeLog.1999 | 2634 -- ChangeLog.2000 | 2539 -- ChangeLog.2001 | 3629 -- ChangeLog.2002 | 4741 --- ChangeLog.2003 | 3349 -- ChangeLog.2004 | 4619 --- ChangeLog.2005 | 3822 -- ChangeLog.2007 | 5921 --- ChangeLog.2008 | 3796 -- README | 185 - changes | 8843 ----- compat/README | 6 - compat/dirent.h | 21 - compat/dirent2.h | 53 - compat/dlfcn.h | 58 - compat/fake-rfc2553.c | 266 - compat/fake-rfc2553.h | 170 - compat/fixstrtod.c | 36 - compat/gettod.c | 30 - compat/memcmp.c | 64 - compat/mkstemp.c | 78 - compat/opendir.c | 110 - compat/stdlib.h | 36 - compat/string.h | 57 - compat/strncasecmp.c | 136 - compat/strstr.c | 70 - compat/strtod.c | 252 - compat/strtol.c | 77 - compat/strtoul.c | 214 - compat/unistd.h | 76 - compat/waitpid.c | 168 - compat/zlib/CMakeLists.txt | 249 - compat/zlib/ChangeLog | 1515 - compat/zlib/FAQ | 368 - compat/zlib/INDEX | 68 - compat/zlib/Makefile | 5 - compat/zlib/Makefile.in | 410 - compat/zlib/README | 115 - compat/zlib/adler32.c | 186 - compat/zlib/amiga/Makefile.pup | 69 - compat/zlib/amiga/Makefile.sas | 68 - compat/zlib/compress.c | 86 - compat/zlib/configure | 921 - compat/zlib/contrib/README.contrib | 78 - compat/zlib/contrib/ada/buffer_demo.adb | 106 - compat/zlib/contrib/ada/mtest.adb | 156 - compat/zlib/contrib/ada/read.adb | 156 - compat/zlib/contrib/ada/readme.txt | 65 - compat/zlib/contrib/ada/test.adb | 463 - compat/zlib/contrib/ada/zlib-streams.adb | 225 - compat/zlib/contrib/ada/zlib-streams.ads | 114 - compat/zlib/contrib/ada/zlib-thin.adb | 141 - compat/zlib/contrib/ada/zlib-thin.ads | 450 - compat/zlib/contrib/ada/zlib.adb | 701 - compat/zlib/contrib/ada/zlib.ads | 328 - compat/zlib/contrib/ada/zlib.gpr | 20 - compat/zlib/contrib/amd64/amd64-match.S | 452 - compat/zlib/contrib/asm686/README.686 | 51 - compat/zlib/contrib/asm686/match.S | 357 - compat/zlib/contrib/blast/Makefile | 8 - compat/zlib/contrib/blast/README | 4 - compat/zlib/contrib/blast/blast.c | 466 - compat/zlib/contrib/blast/blast.h | 83 - compat/zlib/contrib/blast/test.pk | Bin 8 -> 0 bytes compat/zlib/contrib/blast/test.txt | 1 - compat/zlib/contrib/delphi/ZLib.pas | 557 - compat/zlib/contrib/delphi/ZLibConst.pas | 11 - compat/zlib/contrib/delphi/readme.txt | 76 - compat/zlib/contrib/delphi/zlibd32.mak | 99 - compat/zlib/contrib/dotzlib/DotZLib.build | 33 - compat/zlib/contrib/dotzlib/DotZLib.chm | Bin 72726 -> 0 bytes compat/zlib/contrib/dotzlib/DotZLib.sln | 21 - .../zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs | 58 - .../zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs | 202 - .../zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs | 83 - compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs | 198 - compat/zlib/contrib/dotzlib/DotZLib/Deflater.cs | 106 - compat/zlib/contrib/dotzlib/DotZLib/DotZLib.cs | 288 - compat/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj | 141 - compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs | 301 - compat/zlib/contrib/dotzlib/DotZLib/Inflater.cs | 105 - compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs | 274 - compat/zlib/contrib/dotzlib/LICENSE_1_0.txt | 23 - compat/zlib/contrib/dotzlib/readme.txt | 58 - compat/zlib/contrib/gcc_gvmat64/gvmat64.S | 574 - compat/zlib/contrib/infback9/README | 1 - compat/zlib/contrib/infback9/infback9.c | 615 - compat/zlib/contrib/infback9/infback9.h | 37 - compat/zlib/contrib/infback9/inffix9.h | 107 - compat/zlib/contrib/infback9/inflate9.h | 47 - compat/zlib/contrib/infback9/inftree9.c | 324 - compat/zlib/contrib/infback9/inftree9.h | 61 - compat/zlib/contrib/inflate86/inffas86.c | 1157 - compat/zlib/contrib/inflate86/inffast.S | 1368 - compat/zlib/contrib/iostream/test.cpp | 24 - compat/zlib/contrib/iostream/zfstream.cpp | 329 - compat/zlib/contrib/iostream/zfstream.h | 128 - compat/zlib/contrib/iostream2/zstream.h | 307 - compat/zlib/contrib/iostream2/zstream_test.cpp | 25 - compat/zlib/contrib/iostream3/README | 35 - compat/zlib/contrib/iostream3/TODO | 17 - compat/zlib/contrib/iostream3/test.cc | 50 - compat/zlib/contrib/iostream3/zfstream.cc | 479 - compat/zlib/contrib/iostream3/zfstream.h | 466 - compat/zlib/contrib/masmx64/bld_ml64.bat | 2 - compat/zlib/contrib/masmx64/gvmat64.asm | 553 - compat/zlib/contrib/masmx64/inffas8664.c | 186 - compat/zlib/contrib/masmx64/inffasx64.asm | 396 - compat/zlib/contrib/masmx64/readme.txt | 31 - compat/zlib/contrib/masmx86/bld_ml32.bat | 2 - compat/zlib/contrib/masmx86/inffas32.asm | 1080 - compat/zlib/contrib/masmx86/match686.asm | 479 - compat/zlib/contrib/masmx86/readme.txt | 27 - compat/zlib/contrib/minizip/Makefile | 25 - compat/zlib/contrib/minizip/Makefile.am | 45 - compat/zlib/contrib/minizip/MiniZip64_Changes.txt | 6 - compat/zlib/contrib/minizip/MiniZip64_info.txt | 74 - compat/zlib/contrib/minizip/configure.ac | 32 - compat/zlib/contrib/minizip/crypt.h | 131 - compat/zlib/contrib/minizip/ioapi.c | 247 - compat/zlib/contrib/minizip/ioapi.h | 208 - compat/zlib/contrib/minizip/iowin32.c | 462 - compat/zlib/contrib/minizip/iowin32.h | 28 - compat/zlib/contrib/minizip/make_vms.com | 25 - compat/zlib/contrib/minizip/miniunz.c | 660 - compat/zlib/contrib/minizip/miniunzip.1 | 63 - compat/zlib/contrib/minizip/minizip.1 | 46 - compat/zlib/contrib/minizip/minizip.c | 520 - compat/zlib/contrib/minizip/minizip.pc.in | 12 - compat/zlib/contrib/minizip/mztools.c | 291 - compat/zlib/contrib/minizip/mztools.h | 37 - compat/zlib/contrib/minizip/unzip.c | 2125 -- compat/zlib/contrib/minizip/unzip.h | 437 - compat/zlib/contrib/minizip/zip.c | 2007 - compat/zlib/contrib/minizip/zip.h | 362 - compat/zlib/contrib/pascal/example.pas | 599 - compat/zlib/contrib/pascal/readme.txt | 76 - compat/zlib/contrib/pascal/zlibd32.mak | 99 - compat/zlib/contrib/pascal/zlibpas.pas | 276 - compat/zlib/contrib/puff/Makefile | 42 - compat/zlib/contrib/puff/README | 63 - compat/zlib/contrib/puff/puff.c | 840 - compat/zlib/contrib/puff/puff.h | 35 - compat/zlib/contrib/puff/pufftest.c | 165 - compat/zlib/contrib/puff/zeros.raw | Bin 2517 -> 0 bytes compat/zlib/contrib/testzlib/testzlib.c | 275 - compat/zlib/contrib/testzlib/testzlib.txt | 10 - compat/zlib/contrib/untgz/Makefile | 14 - compat/zlib/contrib/untgz/Makefile.msc | 17 - compat/zlib/contrib/untgz/untgz.c | 674 - compat/zlib/contrib/vstudio/readme.txt | 78 - compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj | 310 - .../contrib/vstudio/vc10/miniunz.vcxproj.filters | 22 - compat/zlib/contrib/vstudio/vc10/minizip.vcxproj | 307 - .../contrib/vstudio/vc10/minizip.vcxproj.filters | 22 - compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj | 420 - .../contrib/vstudio/vc10/testzlib.vcxproj.filters | 58 - .../zlib/contrib/vstudio/vc10/testzlibdll.vcxproj | 310 - .../vstudio/vc10/testzlibdll.vcxproj.filters | 22 - compat/zlib/contrib/vstudio/vc10/zlib.rc | 32 - compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj | 473 - .../contrib/vstudio/vc10/zlibstat.vcxproj.filters | 77 - compat/zlib/contrib/vstudio/vc10/zlibvc.def | 153 - compat/zlib/contrib/vstudio/vc10/zlibvc.sln | 135 - compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj | 657 - .../contrib/vstudio/vc10/zlibvc.vcxproj.filters | 118 - compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj | 314 - compat/zlib/contrib/vstudio/vc11/minizip.vcxproj | 311 - compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj | 426 - .../zlib/contrib/vstudio/vc11/testzlibdll.vcxproj | 314 - compat/zlib/contrib/vstudio/vc11/zlib.rc | 32 - compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj | 464 - compat/zlib/contrib/vstudio/vc11/zlibvc.def | 153 - compat/zlib/contrib/vstudio/vc11/zlibvc.sln | 117 - compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj | 688 - compat/zlib/contrib/vstudio/vc12/miniunz.vcxproj | 316 - compat/zlib/contrib/vstudio/vc12/minizip.vcxproj | 313 - compat/zlib/contrib/vstudio/vc12/testzlib.vcxproj | 430 - .../zlib/contrib/vstudio/vc12/testzlibdll.vcxproj | 316 - compat/zlib/contrib/vstudio/vc12/zlib.rc | 32 - compat/zlib/contrib/vstudio/vc12/zlibstat.vcxproj | 467 - compat/zlib/contrib/vstudio/vc12/zlibvc.def | 153 - compat/zlib/contrib/vstudio/vc12/zlibvc.sln | 119 - compat/zlib/contrib/vstudio/vc12/zlibvc.vcxproj | 692 - compat/zlib/contrib/vstudio/vc14/miniunz.vcxproj | 316 - compat/zlib/contrib/vstudio/vc14/minizip.vcxproj | 313 - compat/zlib/contrib/vstudio/vc14/testzlib.vcxproj | 430 - .../zlib/contrib/vstudio/vc14/testzlibdll.vcxproj | 316 - compat/zlib/contrib/vstudio/vc14/zlib.rc | 32 - compat/zlib/contrib/vstudio/vc14/zlibstat.vcxproj | 467 - compat/zlib/contrib/vstudio/vc14/zlibvc.def | 153 - compat/zlib/contrib/vstudio/vc14/zlibvc.sln | 119 - compat/zlib/contrib/vstudio/vc14/zlibvc.vcxproj | 692 - compat/zlib/contrib/vstudio/vc9/miniunz.vcproj | 565 - compat/zlib/contrib/vstudio/vc9/minizip.vcproj | 562 - compat/zlib/contrib/vstudio/vc9/testzlib.vcproj | 852 - compat/zlib/contrib/vstudio/vc9/testzlibdll.vcproj | 565 - compat/zlib/contrib/vstudio/vc9/zlib.rc | 32 - compat/zlib/contrib/vstudio/vc9/zlibstat.vcproj | 835 - compat/zlib/contrib/vstudio/vc9/zlibvc.def | 153 - compat/zlib/contrib/vstudio/vc9/zlibvc.sln | 144 - compat/zlib/contrib/vstudio/vc9/zlibvc.vcproj | 1156 - compat/zlib/crc32.c | 442 - compat/zlib/crc32.h | 441 - compat/zlib/deflate.c | 2163 -- compat/zlib/deflate.h | 349 - compat/zlib/examples/README.examples | 49 - compat/zlib/examples/enough.c | 572 - compat/zlib/examples/fitblk.c | 233 - compat/zlib/examples/gun.c | 702 - compat/zlib/examples/gzappend.c | 504 - compat/zlib/examples/gzjoin.c | 449 - compat/zlib/examples/gzlog.c | 1059 - compat/zlib/examples/gzlog.h | 91 - compat/zlib/examples/zlib_how.html | 545 - compat/zlib/examples/zpipe.c | 205 - compat/zlib/examples/zran.c | 409 - compat/zlib/gzclose.c | 25 - compat/zlib/gzguts.h | 218 - compat/zlib/gzlib.c | 637 - compat/zlib/gzread.c | 654 - compat/zlib/gzwrite.c | 665 - compat/zlib/infback.c | 640 - compat/zlib/inffast.c | 323 - compat/zlib/inffast.h | 11 - compat/zlib/inffixed.h | 94 - compat/zlib/inflate.c | 1561 - compat/zlib/inflate.h | 125 - compat/zlib/inftrees.c | 304 - compat/zlib/inftrees.h | 62 - compat/zlib/make_vms.com | 867 - compat/zlib/msdos/Makefile.bor | 115 - compat/zlib/msdos/Makefile.dj2 | 104 - compat/zlib/msdos/Makefile.emx | 69 - compat/zlib/msdos/Makefile.msc | 112 - compat/zlib/msdos/Makefile.tc | 100 - compat/zlib/nintendods/Makefile | 126 - compat/zlib/nintendods/README | 5 - compat/zlib/old/Makefile.emx | 69 - compat/zlib/old/Makefile.riscos | 151 - compat/zlib/old/README | 3 - compat/zlib/old/descrip.mms | 48 - compat/zlib/old/os2/Makefile.os2 | 136 - compat/zlib/old/os2/zlib.def | 51 - compat/zlib/old/visual-basic.txt | 160 - compat/zlib/os400/README400 | 48 - compat/zlib/os400/bndsrc | 119 - compat/zlib/os400/make.sh | 366 - compat/zlib/os400/zlib.inc | 527 - compat/zlib/qnx/package.qpg | 141 - compat/zlib/test/example.c | 602 - compat/zlib/test/infcover.c | 671 - compat/zlib/test/minigzip.c | 651 - compat/zlib/treebuild.xml | 116 - compat/zlib/trees.c | 1203 - compat/zlib/trees.h | 128 - compat/zlib/uncompr.c | 93 - compat/zlib/watcom/watcom_f.mak | 43 - compat/zlib/watcom/watcom_l.mak | 43 - compat/zlib/win32/DLL_FAQ.txt | 397 - compat/zlib/win32/Makefile.bor | 110 - compat/zlib/win32/Makefile.gcc | 182 - compat/zlib/win32/Makefile.msc | 163 - compat/zlib/win32/README-WIN32.txt | 103 - compat/zlib/win32/README.txt | 60 - compat/zlib/win32/USAGE.txt | 97 - compat/zlib/win32/VisualC.txt | 3 - compat/zlib/win32/zdll.lib | Bin 17152 -> 0 bytes compat/zlib/win32/zlib.def | 94 - compat/zlib/win32/zlib1.dll | Bin 105472 -> 0 bytes compat/zlib/win32/zlib1.rc | 40 - compat/zlib/win64/libz.dll.a | Bin 51638 -> 0 bytes compat/zlib/win64/zdll.lib | Bin 16740 -> 0 bytes compat/zlib/win64/zlib1.dll | Bin 116736 -> 0 bytes compat/zlib/zconf.h | 534 - compat/zlib/zconf.h.cmakein | 536 - compat/zlib/zconf.h.in | 534 - compat/zlib/zlib.3 | 149 - compat/zlib/zlib.3.pdf | Bin 19318 -> 0 bytes compat/zlib/zlib.h | 1912 - compat/zlib/zlib.map | 94 - compat/zlib/zlib.pc.cmakein | 13 - compat/zlib/zlib.pc.in | 13 - compat/zlib/zlib2ansi | 152 - compat/zlib/zutil.c | 325 - compat/zlib/zutil.h | 271 - doc/Access.3 | 71 - doc/AddErrInfo.3 | 312 - doc/Alloc.3 | 92 - doc/AllowExc.3 | 44 - doc/AppInit.3 | 83 - doc/AssocData.3 | 87 - doc/Async.3 | 161 - doc/BackgdErr.3 | 78 - doc/Backslash.3 | 47 - doc/BoolObj.3 | 95 - doc/ByteArrObj.3 | 91 - doc/CallDel.3 | 67 - doc/Cancel.3 | 74 - doc/ChnlStack.3 | 97 - doc/Class.3 | 237 - doc/CmdCmplt.3 | 34 - doc/Concat.3 | 51 - doc/CrtChannel.3 | 928 - doc/CrtChnlHdlr.3 | 89 - doc/CrtCloseHdlr.3 | 55 - doc/CrtCommand.3 | 143 - doc/CrtFileHdlr.3 | 91 - doc/CrtInterp.3 | 150 - doc/CrtMathFnc.3 | 162 - doc/CrtObjCmd.3 | 302 - doc/CrtSlave.3 | 236 - doc/CrtTimerHdlr.3 | 76 - doc/CrtTrace.3 | 191 - doc/DString.3 | 153 - doc/DetachPids.3 | 75 - doc/DictObj.3 | 234 - doc/DoOneEvent.3 | 106 - doc/DoWhenIdle.3 | 87 - doc/DoubleObj.3 | 64 - doc/DumpActiveMemory.3 | 68 - doc/Encoding.3 | 558 - doc/Ensemble.3 | 219 - doc/Environment.3 | 38 - doc/Eval.3 | 211 - doc/Exit.3 | 140 - doc/ExprLong.3 | 106 - doc/ExprLongObj.3 | 106 - doc/FileSystem.3 | 1644 - doc/FindExec.3 | 63 - doc/GetCwd.3 | 52 - doc/GetHostName.3 | 27 - doc/GetIndex.3 | 104 - doc/GetInt.3 | 104 - doc/GetOpnFl.3 | 58 - doc/GetStdChan.3 | 86 - doc/GetTime.3 | 109 - doc/GetVersion.3 | 48 - doc/Hash.3 | 334 - doc/Init.3 | 34 - doc/InitStubs.3 | 89 - doc/IntObj.3 | 152 - doc/Interp.3 | 134 - doc/Limit.3 | 192 - doc/LinkVar.3 | 231 - doc/ListObj.3 | 251 - doc/Load.3 | 70 - doc/Method.3 | 251 - doc/NRE.3 | 328 - doc/Namespace.3 | 165 - doc/Notifier.3 | 635 - doc/OOInitStubs.3 | 54 - doc/Object.3 | 352 - doc/ObjectType.3 | 256 - doc/OpenFileChnl.3 | 648 - doc/OpenTcp.3 | 183 - doc/Panic.3 | 89 - doc/ParseArgs.3 | 198 - doc/ParseCmd.3 | 467 - doc/PkgRequire.3 | 97 - doc/Preserve.3 | 110 - doc/PrintDbl.3 | 51 - doc/RecEvalObj.3 | 51 - doc/RecordEval.3 | 55 - doc/RegConfig.3 | 111 - doc/RegExp.3 | 383 - doc/SaveResult.3 | 120 - doc/SetChanErr.3 | 140 - doc/SetErrno.3 | 66 - doc/SetRecLmt.3 | 53 - doc/SetResult.3 | 255 - doc/SetVar.3 | 249 - doc/Signal.3 | 41 - doc/Sleep.3 | 34 - doc/SourceRCFile.3 | 32 - doc/SplitList.3 | 188 - doc/SplitPath.3 | 97 - doc/StaticPkg.3 | 70 - doc/StdChannels.3 | 120 - doc/StrMatch.3 | 49 - doc/StringObj.3 | 387 - doc/SubstObj.3 | 68 - doc/TCL_MEM_DEBUG.3 | 80 - doc/Tcl.n | 275 - doc/TclZlib.3 | 276 - doc/Tcl_Main.3 | 196 - doc/Thread.3 | 242 - doc/ToUpper.3 | 88 - doc/TraceCmd.3 | 150 - doc/TraceVar.3 | 380 - doc/Translate.3 | 71 - doc/UniCharIsAlpha.3 | 91 - doc/UpVar.3 | 74 - doc/Utf.3 | 259 - doc/WrongNumArgs.3 | 79 - doc/after.n | 151 - doc/append.n | 49 - doc/apply.n | 102 - doc/array.n | 187 - doc/bgerror.n | 93 - doc/binary.n | 908 - doc/break.n | 47 - doc/case.n | 60 - doc/catch.n | 125 - doc/cd.n | 43 - doc/chan.n | 850 - doc/class.n | 136 - doc/clock.n | 937 - doc/close.n | 108 - doc/concat.n | 59 - doc/continue.n | 47 - doc/copy.n | 76 - doc/coroutine.n | 205 - doc/dde.n | 189 - doc/define.n | 419 - doc/dict.n | 445 - doc/encoding.n | 115 - doc/eof.n | 61 - doc/error.n | 78 - doc/eval.n | 84 - doc/exec.n | 452 - doc/exit.n | 51 - doc/expr.n | 433 - doc/fblocked.n | 67 - doc/fconfigure.n | 289 - doc/fcopy.n | 182 - doc/file.n | 549 - doc/fileevent.n | 156 - doc/filename.n | 178 - doc/flush.n | 45 - doc/for.n | 87 - doc/foreach.n | 104 - doc/format.n | 287 - doc/gets.n | 71 - doc/glob.n | 267 - doc/global.n | 58 - doc/history.n | 102 - doc/http.n | 650 - doc/if.n | 88 - doc/incr.n | 61 - doc/info.n | 778 - doc/interp.n | 910 - doc/join.n | 44 - doc/lappend.n | 49 - doc/lassign.n | 60 - doc/library.n | 320 - doc/lindex.n | 125 - doc/linsert.n | 55 - doc/list.n | 56 - doc/llength.n | 55 - doc/lmap.n | 85 - doc/load.n | 196 - doc/lrange.n | 78 - doc/lrepeat.n | 38 - doc/lreplace.n | 86 - doc/lreverse.n | 34 - doc/lsearch.n | 220 - doc/lset.n | 146 - doc/lsort.n | 275 - doc/man.macros | 267 - doc/mathfunc.n | 305 - doc/mathop.n | 310 - doc/memory.n | 115 - doc/msgcat.n | 651 - doc/my.n | 56 - doc/namespace.n | 969 - doc/next.n | 208 - doc/object.n | 128 - doc/open.n | 430 - doc/package.n | 378 - doc/packagens.n | 50 - doc/pid.n | 48 - doc/pkgMkIndex.n | 233 - doc/platform.n | 86 - doc/platform_shell.n | 57 - doc/prefix.n | 116 - doc/proc.n | 128 - doc/puts.n | 98 - doc/pwd.n | 39 - doc/re_syntax.n | 858 - doc/read.n | 89 - doc/refchan.n | 411 - doc/regexp.n | 208 - doc/registry.n | 218 - doc/regsub.n | 266 - doc/rename.n | 45 - doc/return.n | 326 - doc/safe.n | 359 - doc/scan.n | 291 - doc/seek.n | 92 - doc/self.n | 152 - doc/set.n | 75 - doc/socket.n | 245 - doc/source.n | 71 - doc/split.n | 93 - doc/string.n | 485 - doc/subst.n | 164 - doc/switch.n | 186 - doc/tailcall.n | 69 - doc/tclsh.1 | 149 - doc/tcltest.n | 1259 - doc/tclvars.n | 566 - doc/tell.n | 48 - doc/throw.n | 48 - doc/time.n | 47 - doc/tm.n | 308 - doc/trace.n | 426 - doc/transchan.n | 160 - doc/try.n | 103 - doc/unknown.n | 91 - doc/unload.n | 172 - doc/unset.n | 68 - doc/update.n | 65 - doc/uplevel.n | 103 - doc/upvar.n | 122 - doc/variable.n | 105 - doc/vwait.n | 246 - doc/while.n | 65 - doc/zlib.n | 466 - generic/README | 3 - generic/regc_color.c | 856 - generic/regc_cvec.c | 147 - generic/regc_lex.c | 1195 - generic/regc_locale.c | 1267 - generic/regc_nfa.c | 3213 -- generic/regcomp.c | 2225 -- generic/regcustom.h | 154 - generic/rege_dfa.c | 805 - generic/regerror.c | 129 - generic/regerrs.h | 20 - generic/regex.h | 305 - generic/regexec.c | 1335 - generic/regfree.c | 60 - generic/regfronts.c | 91 - generic/regguts.h | 426 - generic/tcl.decls | 2399 -- generic/tcl.h | 2676 -- generic/tclAlloc.c | 759 - generic/tclAssembly.c | 4345 --- generic/tclAsync.c | 355 - generic/tclBasic.c | 166 +- generic/tclBinary.c | 3086 -- generic/tclCkalloc.c | 1330 - generic/tclClock.c | 2090 -- generic/tclCmdAH.c | 3232 -- generic/tclCmdIL.c | 4565 --- generic/tclCmdMZ.c | 4872 --- generic/tclCompCmds.c | 3599 -- generic/tclCompCmdsGR.c | 3188 -- generic/tclCompCmdsSZ.c | 4485 --- generic/tclCompExpr.c | 2803 -- generic/tclCompile.c | 4527 --- generic/tclCompile.h | 1890 - generic/tclConfig.c | 408 - generic/tclDTrace.d | 225 - generic/tclDate.c | 2914 -- generic/tclDecls.h | 3987 -- generic/tclDictObj.c | 3688 -- generic/tclDisassemble.c | 1630 - generic/tclEncoding.c | 3660 -- generic/tclEnsemble.c | 3696 -- generic/tclEnv.c | 745 - generic/tclEvent.c | 1627 - generic/tclExecute.c | 10546 ------ generic/tclFCmd.c | 1507 - generic/tclFileName.c | 2658 -- generic/tclFileSystem.h | 74 - generic/tclGet.c | 156 - generic/tclGetDate.y | 1130 - generic/tclHash.c | 1069 - generic/tclHistory.c | 229 - generic/tclIO.c | 11278 ------ generic/tclIO.h | 297 - generic/tclIOCmd.c | 2096 -- generic/tclIOGT.c | 1441 - generic/tclIORChan.c | 3313 -- generic/tclIORTrans.c | 3427 -- generic/tclIOSock.c | 330 - generic/tclIOUtil.c | 4881 --- generic/tclIndexObj.c | 1488 - generic/tclInt.decls | 1273 - generic/tclInt.h | 4922 --- generic/tclIntDecls.h | 1418 - generic/tclIntPlatDecls.h | 567 - generic/tclInterp.c | 4833 --- generic/tclLink.c | 758 - generic/tclListObj.c | 2040 - generic/tclLiteral.c | 1242 - generic/tclLoad.c | 1212 - generic/tclLoadNone.c | 129 - generic/tclMain.c | 946 - generic/tclNamesp.c | 5131 --- generic/tclNotify.c | 1141 - generic/tclOO.c | 3074 -- generic/tclOO.decls | 218 - generic/tclOO.h | 147 - generic/tclOOBasic.c | 1267 - generic/tclOOCall.c | 1576 - generic/tclOODecls.h | 234 - generic/tclOODefineCmds.c | 2658 -- generic/tclOOInfo.c | 1530 - generic/tclOOInt.h | 610 - generic/tclOOIntDecls.h | 166 - generic/tclOOMethod.c | 1764 - generic/tclOOStubInit.c | 78 - generic/tclOOStubLib.c | 71 - generic/tclObj.c | 4508 --- generic/tclOptimize.c | 444 - generic/tclPanic.c | 170 - generic/tclParse.c | 2513 -- generic/tclParse.h | 17 - generic/tclPathObj.c | 2708 -- generic/tclPipe.c | 1141 - generic/tclPkg.c | 2066 -- generic/tclPkgConfig.c | 135 - generic/tclPlatDecls.h | 122 - generic/tclPort.h | 43 - generic/tclPosixStr.c | 1211 - generic/tclPreserve.c | 473 - generic/tclProc.c | 60 +- generic/tclRegexp.c | 1081 - generic/tclRegexp.h | 52 - generic/tclResolve.c | 424 - generic/tclResult.c | 1784 - generic/tclScan.c | 1087 - generic/tclStrToD.c | 5070 --- generic/tclStringObj.c | 3852 -- generic/tclStringRep.h | 97 - generic/tclStringTrim.h | 43 - generic/tclStubInit.c | 1546 - generic/tclStubLib.c | 129 - generic/tclStubLibTbl.c | 58 - generic/tclTest.c | 7742 ---- generic/tclTestObj.c | 1526 - generic/tclTestProcBodyObj.c | 309 - generic/tclThread.c | 538 - generic/tclThreadAlloc.c | 1210 - generic/tclThreadJoin.c | 316 - generic/tclThreadStorage.c | 373 - generic/tclThreadTest.c | 1211 - generic/tclTimer.c | 1299 - generic/tclTomMath.decls | 256 - generic/tclTomMath.h | 813 - generic/tclTomMathDecls.h | 570 - generic/tclTomMathInt.h | 3 - generic/tclTomMathInterface.c | 190 - generic/tclTomMathStubLib.c | 79 - generic/tclTrace.c | 3277 -- generic/tclUniData.c | 1632 - generic/tclUtf.c | 2071 -- generic/tclUtil.c | 4478 --- generic/tclVar.c | 6319 ---- generic/tclZlib.c | 4058 -- generic/tommath.h | 1 - library/auto.tcl | 646 - library/clock.tcl | 4547 --- library/dde/pkgIndex.tcl | 7 - library/encoding/ascii.enc | 20 - library/encoding/big5.enc | 1516 - library/encoding/cp1250.enc | 20 - library/encoding/cp1251.enc | 20 - library/encoding/cp1252.enc | 20 - library/encoding/cp1253.enc | 20 - library/encoding/cp1254.enc | 20 - library/encoding/cp1255.enc | 20 - library/encoding/cp1256.enc | 20 - library/encoding/cp1257.enc | 20 - library/encoding/cp1258.enc | 20 - library/encoding/cp437.enc | 20 - library/encoding/cp737.enc | 20 - library/encoding/cp775.enc | 20 - library/encoding/cp850.enc | 20 - library/encoding/cp852.enc | 20 - library/encoding/cp855.enc | 20 - library/encoding/cp857.enc | 20 - library/encoding/cp860.enc | 20 - library/encoding/cp861.enc | 20 - library/encoding/cp862.enc | 20 - library/encoding/cp863.enc | 20 - library/encoding/cp864.enc | 20 - library/encoding/cp865.enc | 20 - library/encoding/cp866.enc | 20 - library/encoding/cp869.enc | 20 - library/encoding/cp874.enc | 20 - library/encoding/cp932.enc | 801 - library/encoding/cp936.enc | 2162 -- library/encoding/cp949.enc | 2128 -- library/encoding/cp950.enc | 1499 - library/encoding/dingbats.enc | 20 - library/encoding/ebcdic.enc | 19 - library/encoding/euc-cn.enc | 1397 - library/encoding/euc-jp.enc | 1353 - library/encoding/euc-kr.enc | 1533 - library/encoding/gb12345.enc | 1414 - library/encoding/gb1988.enc | 20 - library/encoding/gb2312-raw.enc | 1380 - library/encoding/gb2312.enc | 1397 - library/encoding/iso2022-jp.enc | 12 - library/encoding/iso2022-kr.enc | 7 - library/encoding/iso2022.enc | 14 - library/encoding/iso8859-1.enc | 20 - library/encoding/iso8859-10.enc | 20 - library/encoding/iso8859-13.enc | 20 - library/encoding/iso8859-14.enc | 20 - library/encoding/iso8859-15.enc | 20 - library/encoding/iso8859-16.enc | 20 - library/encoding/iso8859-2.enc | 20 - library/encoding/iso8859-3.enc | 20 - library/encoding/iso8859-4.enc | 20 - library/encoding/iso8859-5.enc | 20 - library/encoding/iso8859-6.enc | 20 - library/encoding/iso8859-7.enc | 20 - library/encoding/iso8859-8.enc | 20 - library/encoding/iso8859-9.enc | 20 - library/encoding/jis0201.enc | 20 - library/encoding/jis0208.enc | 1319 - library/encoding/jis0212.enc | 1159 - library/encoding/koi8-r.enc | 20 - library/encoding/koi8-u.enc | 20 - library/encoding/ksc5601.enc | 1516 - library/encoding/macCentEuro.enc | 20 - library/encoding/macCroatian.enc | 20 - library/encoding/macCyrillic.enc | 20 - library/encoding/macDingbats.enc | 20 - library/encoding/macGreek.enc | 20 - library/encoding/macIceland.enc | 20 - library/encoding/macJapan.enc | 785 - library/encoding/macRoman.enc | 20 - library/encoding/macRomania.enc | 20 - library/encoding/macThai.enc | 20 - library/encoding/macTurkish.enc | 20 - library/encoding/macUkraine.enc | 20 - library/encoding/shiftjis.enc | 690 - library/encoding/symbol.enc | 20 - library/encoding/tis-620.enc | 20 - library/history.tcl | 335 - library/http/http.tcl | 1584 - library/http/pkgIndex.tcl | 2 - library/http1.0/http.tcl | 377 - library/http1.0/pkgIndex.tcl | 11 - library/init.tcl | 838 - library/msgcat/msgcat.tcl | 1210 - library/msgcat/pkgIndex.tcl | 2 - library/msgs/af.msg | 49 - library/msgs/af_za.msg | 6 - library/msgs/ar.msg | 54 - library/msgs/ar_in.msg | 6 - library/msgs/ar_jo.msg | 39 - library/msgs/ar_lb.msg | 39 - library/msgs/ar_sy.msg | 39 - library/msgs/be.msg | 52 - library/msgs/bg.msg | 52 - library/msgs/bn.msg | 49 - library/msgs/bn_in.msg | 6 - library/msgs/ca.msg | 50 - library/msgs/cs.msg | 54 - library/msgs/da.msg | 52 - library/msgs/de.msg | 54 - library/msgs/de_at.msg | 35 - library/msgs/de_be.msg | 53 - library/msgs/el.msg | 52 - library/msgs/en_au.msg | 7 - library/msgs/en_be.msg | 7 - library/msgs/en_bw.msg | 6 - library/msgs/en_ca.msg | 7 - library/msgs/en_gb.msg | 7 - library/msgs/en_hk.msg | 8 - library/msgs/en_ie.msg | 7 - library/msgs/en_in.msg | 8 - library/msgs/en_nz.msg | 7 - library/msgs/en_ph.msg | 8 - library/msgs/en_sg.msg | 6 - library/msgs/en_za.msg | 6 - library/msgs/en_zw.msg | 6 - library/msgs/eo.msg | 54 - library/msgs/es.msg | 52 - library/msgs/es_ar.msg | 6 - library/msgs/es_bo.msg | 6 - library/msgs/es_cl.msg | 6 - library/msgs/es_co.msg | 6 - library/msgs/es_cr.msg | 6 - library/msgs/es_do.msg | 6 - library/msgs/es_ec.msg | 6 - library/msgs/es_gt.msg | 6 - library/msgs/es_hn.msg | 6 - library/msgs/es_mx.msg | 6 - library/msgs/es_ni.msg | 6 - library/msgs/es_pa.msg | 6 - library/msgs/es_pe.msg | 6 - library/msgs/es_pr.msg | 6 - library/msgs/es_py.msg | 6 - library/msgs/es_sv.msg | 6 - library/msgs/es_uy.msg | 6 - library/msgs/es_ve.msg | 6 - library/msgs/et.msg | 52 - library/msgs/eu.msg | 47 - library/msgs/eu_es.msg | 7 - library/msgs/fa.msg | 47 - library/msgs/fa_in.msg | 52 - library/msgs/fa_ir.msg | 9 - library/msgs/fi.msg | 50 - library/msgs/fo.msg | 47 - library/msgs/fo_fo.msg | 7 - library/msgs/fr.msg | 52 - library/msgs/fr_be.msg | 7 - library/msgs/fr_ca.msg | 7 - library/msgs/fr_ch.msg | 7 - library/msgs/ga.msg | 47 - library/msgs/ga_ie.msg | 7 - library/msgs/gl.msg | 47 - library/msgs/gl_es.msg | 6 - library/msgs/gv.msg | 47 - library/msgs/gv_gb.msg | 6 - library/msgs/he.msg | 52 - library/msgs/hi.msg | 39 - library/msgs/hi_in.msg | 6 - library/msgs/hr.msg | 50 - library/msgs/hu.msg | 54 - library/msgs/id.msg | 47 - library/msgs/id_id.msg | 6 - library/msgs/is.msg | 50 - library/msgs/it.msg | 54 - library/msgs/it_ch.msg | 6 - library/msgs/ja.msg | 44 - library/msgs/kl.msg | 47 - library/msgs/kl_gl.msg | 7 - library/msgs/ko.msg | 55 - library/msgs/ko_kr.msg | 8 - library/msgs/kok.msg | 39 - library/msgs/kok_in.msg | 6 - library/msgs/kw.msg | 47 - library/msgs/kw_gb.msg | 6 - library/msgs/lt.msg | 52 - library/msgs/lv.msg | 52 - library/msgs/mk.msg | 52 - library/msgs/mr.msg | 39 - library/msgs/mr_in.msg | 6 - library/msgs/ms.msg | 47 - library/msgs/ms_my.msg | 6 - library/msgs/mt.msg | 27 - library/msgs/nb.msg | 52 - library/msgs/nl.msg | 50 - library/msgs/nl_be.msg | 7 - library/msgs/nn.msg | 52 - library/msgs/pl.msg | 52 - library/msgs/pt.msg | 50 - library/msgs/pt_br.msg | 7 - library/msgs/ro.msg | 52 - library/msgs/ru.msg | 52 - library/msgs/ru_ua.msg | 6 - library/msgs/sh.msg | 52 - library/msgs/sk.msg | 52 - library/msgs/sl.msg | 52 - library/msgs/sq.msg | 54 - library/msgs/sr.msg | 52 - library/msgs/sv.msg | 52 - library/msgs/sw.msg | 49 - library/msgs/ta.msg | 39 - library/msgs/ta_in.msg | 6 - library/msgs/te.msg | 47 - library/msgs/te_in.msg | 8 - library/msgs/th.msg | 54 - library/msgs/tr.msg | 50 - library/msgs/uk.msg | 52 - library/msgs/vi.msg | 50 - library/msgs/zh.msg | 55 - library/msgs/zh_cn.msg | 7 - library/msgs/zh_hk.msg | 28 - library/msgs/zh_sg.msg | 8 - library/msgs/zh_tw.msg | 8 - library/opt/optparse.tcl | 1072 - library/opt/pkgIndex.tcl | 12 - library/package.tcl | 747 - library/parray.tcl | 28 - library/platform/pkgIndex.tcl | 3 - library/platform/platform.tcl | 397 - library/platform/shell.tcl | 241 - library/reg/pkgIndex.tcl | 9 - library/safe.tcl | 1133 - library/tclIndex | 75 - library/tcltest/pkgIndex.tcl | 12 - library/tcltest/tcltest.tcl | 3420 -- library/tm.tcl | 375 - library/tzdata/Africa/Abidjan | 6 - library/tzdata/Africa/Accra | 52 - library/tzdata/Africa/Addis_Ababa | 5 - library/tzdata/Africa/Algiers | 39 - library/tzdata/Africa/Asmara | 5 - library/tzdata/Africa/Asmera | 5 - library/tzdata/Africa/Bamako | 5 - library/tzdata/Africa/Bangui | 5 - library/tzdata/Africa/Banjul | 5 - library/tzdata/Africa/Bissau | 7 - library/tzdata/Africa/Blantyre | 5 - library/tzdata/Africa/Brazzaville | 5 - library/tzdata/Africa/Bujumbura | 5 - library/tzdata/Africa/Cairo | 132 - library/tzdata/Africa/Casablanca | 230 - library/tzdata/Africa/Ceuta | 258 - library/tzdata/Africa/Conakry | 5 - library/tzdata/Africa/Dakar | 5 - library/tzdata/Africa/Dar_es_Salaam | 5 - library/tzdata/Africa/Djibouti | 5 - library/tzdata/Africa/Douala | 5 - library/tzdata/Africa/El_Aaiun | 219 - library/tzdata/Africa/Freetown | 5 - library/tzdata/Africa/Gaborone | 5 - library/tzdata/Africa/Harare | 5 - library/tzdata/Africa/Johannesburg | 11 - library/tzdata/Africa/Juba | 39 - library/tzdata/Africa/Kampala | 5 - library/tzdata/Africa/Khartoum | 40 - library/tzdata/Africa/Kigali | 5 - library/tzdata/Africa/Kinshasa | 5 - library/tzdata/Africa/Lagos | 6 - library/tzdata/Africa/Libreville | 5 - library/tzdata/Africa/Lome | 5 - library/tzdata/Africa/Luanda | 5 - library/tzdata/Africa/Lubumbashi | 5 - library/tzdata/Africa/Lusaka | 5 - library/tzdata/Africa/Malabo | 5 - library/tzdata/Africa/Maputo | 6 - library/tzdata/Africa/Maseru | 5 - library/tzdata/Africa/Mbabane | 5 - library/tzdata/Africa/Mogadishu | 5 - library/tzdata/Africa/Monrovia | 8 - library/tzdata/Africa/Nairobi | 9 - library/tzdata/Africa/Ndjamena | 8 - library/tzdata/Africa/Niamey | 5 - library/tzdata/Africa/Nouakchott | 5 - library/tzdata/Africa/Ouagadougou | 5 - library/tzdata/Africa/Porto-Novo | 5 - library/tzdata/Africa/Sao_Tome | 5 - library/tzdata/Africa/Timbuktu | 5 - library/tzdata/Africa/Tripoli | 34 - library/tzdata/Africa/Tunis | 39 - library/tzdata/Africa/Windhoek | 59 - library/tzdata/America/Adak | 276 - library/tzdata/America/Anchorage | 275 - library/tzdata/America/Anguilla | 5 - library/tzdata/America/Antigua | 5 - library/tzdata/America/Araguaina | 60 - library/tzdata/America/Argentina/Buenos_Aires | 67 - library/tzdata/America/Argentina/Catamarca | 68 - library/tzdata/America/Argentina/ComodRivadavia | 5 - library/tzdata/America/Argentina/Cordoba | 67 - library/tzdata/America/Argentina/Jujuy | 67 - library/tzdata/America/Argentina/La_Rioja | 69 - library/tzdata/America/Argentina/Mendoza | 68 - library/tzdata/America/Argentina/Rio_Gallegos | 68 - library/tzdata/America/Argentina/Salta | 66 - library/tzdata/America/Argentina/San_Juan | 69 - library/tzdata/America/Argentina/San_Luis | 68 - library/tzdata/America/Argentina/Tucuman | 69 - library/tzdata/America/Argentina/Ushuaia | 68 - library/tzdata/America/Aruba | 5 - library/tzdata/America/Asuncion | 259 - library/tzdata/America/Atikokan | 12 - library/tzdata/America/Atka | 5 - library/tzdata/America/Bahia | 68 - library/tzdata/America/Bahia_Banderas | 222 - library/tzdata/America/Barbados | 15 - library/tzdata/America/Belem | 35 - library/tzdata/America/Belize | 60 - library/tzdata/America/Blanc-Sablon | 12 - library/tzdata/America/Boa_Vista | 40 - library/tzdata/America/Bogota | 9 - library/tzdata/America/Boise | 281 - library/tzdata/America/Buenos_Aires | 5 - library/tzdata/America/Cambridge_Bay | 252 - library/tzdata/America/Campo_Grande | 257 - library/tzdata/America/Cancun | 47 - library/tzdata/America/Caracas | 10 - library/tzdata/America/Catamarca | 5 - library/tzdata/America/Cayenne | 7 - library/tzdata/America/Cayman | 5 - library/tzdata/America/Chicago | 369 - library/tzdata/America/Chihuahua | 221 - library/tzdata/America/Coral_Harbour | 5 - library/tzdata/America/Cordoba | 5 - library/tzdata/America/Costa_Rica | 15 - library/tzdata/America/Creston | 8 - library/tzdata/America/Cuiaba | 257 - library/tzdata/America/Curacao | 7 - library/tzdata/America/Danmarkshavn | 39 - library/tzdata/America/Dawson | 256 - library/tzdata/America/Dawson_Creek | 64 - library/tzdata/America/Denver | 291 - library/tzdata/America/Detroit | 270 - library/tzdata/America/Dominica | 5 - library/tzdata/America/Edmonton | 284 - library/tzdata/America/Eirunepe | 41 - library/tzdata/America/El_Salvador | 10 - library/tzdata/America/Ensenada | 5 - library/tzdata/America/Fort_Nelson | 151 - library/tzdata/America/Fort_Wayne | 5 - library/tzdata/America/Fortaleza | 48 - library/tzdata/America/Glace_Bay | 273 - library/tzdata/America/Godthab | 246 - library/tzdata/America/Goose_Bay | 338 - library/tzdata/America/Grand_Turk | 246 - library/tzdata/America/Grenada | 5 - library/tzdata/America/Guadeloupe | 5 - library/tzdata/America/Guatemala | 14 - library/tzdata/America/Guayaquil | 9 - library/tzdata/America/Guyana | 8 - library/tzdata/America/Halifax | 361 - library/tzdata/America/Havana | 285 - library/tzdata/America/Hermosillo | 21 - library/tzdata/America/Indiana/Indianapolis | 234 - library/tzdata/America/Indiana/Knox | 285 - library/tzdata/America/Indiana/Marengo | 236 - library/tzdata/America/Indiana/Petersburg | 247 - library/tzdata/America/Indiana/Tell_City | 234 - library/tzdata/America/Indiana/Vevay | 213 - library/tzdata/America/Indiana/Vincennes | 234 - library/tzdata/America/Indiana/Winamac | 240 - library/tzdata/America/Indianapolis | 5 - library/tzdata/America/Inuvik | 249 - library/tzdata/America/Iqaluit | 250 - library/tzdata/America/Jamaica | 29 - library/tzdata/America/Jujuy | 5 - library/tzdata/America/Juneau | 276 - library/tzdata/America/Kentucky/Louisville | 314 - library/tzdata/America/Kentucky/Monticello | 279 - library/tzdata/America/Knox_IN | 5 - library/tzdata/America/Kralendijk | 5 - library/tzdata/America/La_Paz | 8 - library/tzdata/America/Lima | 16 - library/tzdata/America/Los_Angeles | 317 - library/tzdata/America/Louisville | 5 - library/tzdata/America/Lower_Princes | 5 - library/tzdata/America/Maceio | 52 - library/tzdata/America/Managua | 21 - library/tzdata/America/Manaus | 39 - library/tzdata/America/Marigot | 5 - library/tzdata/America/Martinique | 9 - library/tzdata/America/Matamoros | 219 - library/tzdata/America/Mazatlan | 222 - library/tzdata/America/Mendoza | 5 - library/tzdata/America/Menominee | 274 - library/tzdata/America/Merida | 216 - library/tzdata/America/Metlakatla | 212 - library/tzdata/America/Mexico_City | 228 - library/tzdata/America/Miquelon | 234 - library/tzdata/America/Moncton | 342 - library/tzdata/America/Monterrey | 218 - library/tzdata/America/Montevideo | 96 - library/tzdata/America/Montreal | 5 - library/tzdata/America/Montserrat | 5 - library/tzdata/America/Nassau | 279 - library/tzdata/America/New_York | 369 - library/tzdata/America/Nipigon | 264 - library/tzdata/America/Nome | 276 - library/tzdata/America/Noronha | 48 - library/tzdata/America/North_Dakota/Beulah | 279 - library/tzdata/America/North_Dakota/Center | 279 - library/tzdata/America/North_Dakota/New_Salem | 279 - library/tzdata/America/Ojinaga | 222 - library/tzdata/America/Panama | 7 - library/tzdata/America/Pangnirtung | 252 - library/tzdata/America/Paramaribo | 9 - library/tzdata/America/Phoenix | 17 - library/tzdata/America/Port-au-Prince | 215 - library/tzdata/America/Port_of_Spain | 6 - library/tzdata/America/Porto_Acre | 5 - library/tzdata/America/Porto_Velho | 35 - library/tzdata/America/Puerto_Rico | 10 - library/tzdata/America/Punta_Arenas | 122 - library/tzdata/America/Rainy_River | 264 - library/tzdata/America/Rankin_Inlet | 248 - library/tzdata/America/Recife | 48 - library/tzdata/America/Regina | 58 - library/tzdata/America/Resolute | 248 - library/tzdata/America/Rio_Branco | 37 - library/tzdata/America/Rosario | 5 - library/tzdata/America/Santa_Isabel | 5 - library/tzdata/America/Santarem | 36 - library/tzdata/America/Santiago | 289 - library/tzdata/America/Santo_Domingo | 21 - library/tzdata/America/Sao_Paulo | 258 - library/tzdata/America/Scoresbysund | 246 - library/tzdata/America/Shiprock | 5 - library/tzdata/America/Sitka | 275 - library/tzdata/America/St_Barthelemy | 5 - library/tzdata/America/St_Johns | 372 - library/tzdata/America/St_Kitts | 5 - library/tzdata/America/St_Lucia | 5 - library/tzdata/America/St_Thomas | 5 - library/tzdata/America/St_Vincent | 5 - library/tzdata/America/Swift_Current | 29 - library/tzdata/America/Tegucigalpa | 12 - library/tzdata/America/Thule | 224 - library/tzdata/America/Thunder_Bay | 272 - library/tzdata/America/Tijuana | 285 - library/tzdata/America/Toronto | 365 - library/tzdata/America/Tortola | 5 - library/tzdata/America/Vancouver | 320 - library/tzdata/America/Virgin | 5 - library/tzdata/America/Whitehorse | 256 - library/tzdata/America/Winnipeg | 316 - library/tzdata/America/Yakutat | 276 - library/tzdata/America/Yellowknife | 252 - library/tzdata/Antarctica/Casey | 11 - library/tzdata/Antarctica/Davis | 12 - library/tzdata/Antarctica/DumontDUrville | 8 - library/tzdata/Antarctica/Macquarie | 97 - library/tzdata/Antarctica/Mawson | 7 - library/tzdata/Antarctica/McMurdo | 5 - library/tzdata/Antarctica/Palmer | 87 - library/tzdata/Antarctica/Rothera | 6 - library/tzdata/Antarctica/South_Pole | 5 - library/tzdata/Antarctica/Syowa | 6 - library/tzdata/Antarctica/Troll | 196 - library/tzdata/Antarctica/Vostok | 6 - library/tzdata/Arctic/Longyearbyen | 5 - library/tzdata/Asia/Aden | 5 - library/tzdata/Asia/Almaty | 57 - library/tzdata/Asia/Amman | 246 - library/tzdata/Asia/Anadyr | 72 - library/tzdata/Asia/Aqtau | 58 - library/tzdata/Asia/Aqtobe | 58 - library/tzdata/Asia/Ashgabat | 31 - library/tzdata/Asia/Ashkhabad | 5 - library/tzdata/Asia/Atyrau | 58 - library/tzdata/Asia/Baghdad | 59 - library/tzdata/Asia/Bahrain | 5 - library/tzdata/Asia/Baku | 74 - library/tzdata/Asia/Bangkok | 7 - library/tzdata/Asia/Barnaul | 73 - library/tzdata/Asia/Beirut | 270 - library/tzdata/Asia/Bishkek | 58 - library/tzdata/Asia/Brunei | 7 - library/tzdata/Asia/Calcutta | 5 - library/tzdata/Asia/Chita | 72 - library/tzdata/Asia/Choibalsan | 56 - library/tzdata/Asia/Chongqing | 5 - library/tzdata/Asia/Chungking | 5 - library/tzdata/Asia/Colombo | 13 - library/tzdata/Asia/Dacca | 5 - library/tzdata/Asia/Damascus | 280 - library/tzdata/Asia/Dhaka | 13 - library/tzdata/Asia/Dili | 9 - library/tzdata/Asia/Dubai | 6 - library/tzdata/Asia/Dushanbe | 29 - library/tzdata/Asia/Famagusta | 256 - library/tzdata/Asia/Gaza | 278 - library/tzdata/Asia/Harbin | 5 - library/tzdata/Asia/Hebron | 277 - library/tzdata/Asia/Ho_Chi_Minh | 14 - library/tzdata/Asia/Hong_Kong | 75 - library/tzdata/Asia/Hovd | 55 - library/tzdata/Asia/Irkutsk | 72 - library/tzdata/Asia/Istanbul | 5 - library/tzdata/Asia/Jakarta | 13 - library/tzdata/Asia/Jayapura | 8 - library/tzdata/Asia/Jerusalem | 272 - library/tzdata/Asia/Kabul | 7 - library/tzdata/Asia/Kamchatka | 71 - library/tzdata/Asia/Karachi | 16 - library/tzdata/Asia/Kashgar | 5 - library/tzdata/Asia/Kathmandu | 7 - library/tzdata/Asia/Katmandu | 5 - library/tzdata/Asia/Khandyga | 73 - library/tzdata/Asia/Kolkata | 12 - library/tzdata/Asia/Krasnoyarsk | 71 - library/tzdata/Asia/Kuala_Lumpur | 13 - library/tzdata/Asia/Kuching | 23 - library/tzdata/Asia/Kuwait | 5 - library/tzdata/Asia/Macao | 5 - library/tzdata/Asia/Macau | 46 - library/tzdata/Asia/Magadan | 72 - library/tzdata/Asia/Makassar | 9 - library/tzdata/Asia/Manila | 15 - library/tzdata/Asia/Muscat | 5 - library/tzdata/Asia/Nicosia | 257 - library/tzdata/Asia/Novokuznetsk | 71 - library/tzdata/Asia/Novosibirsk | 73 - library/tzdata/Asia/Omsk | 71 - library/tzdata/Asia/Oral | 58 - library/tzdata/Asia/Phnom_Penh | 5 - library/tzdata/Asia/Pontianak | 13 - library/tzdata/Asia/Pyongyang | 9 - library/tzdata/Asia/Qatar | 7 - library/tzdata/Asia/Qyzylorda | 57 - library/tzdata/Asia/Rangoon | 5 - library/tzdata/Asia/Riyadh | 6 - library/tzdata/Asia/Saigon | 5 - library/tzdata/Asia/Sakhalin | 73 - library/tzdata/Asia/Samarkand | 31 - library/tzdata/Asia/Seoul | 26 - library/tzdata/Asia/Shanghai | 23 - library/tzdata/Asia/Singapore | 13 - library/tzdata/Asia/Srednekolymsk | 71 - library/tzdata/Asia/Taipei | 46 - library/tzdata/Asia/Tashkent | 31 - library/tzdata/Asia/Tbilisi | 60 - library/tzdata/Asia/Tehran | 229 - library/tzdata/Asia/Tel_Aviv | 5 - library/tzdata/Asia/Thimbu | 5 - library/tzdata/Asia/Thimphu | 7 - library/tzdata/Asia/Tokyo | 14 - library/tzdata/Asia/Tomsk | 73 - library/tzdata/Asia/Ujung_Pandang | 5 - library/tzdata/Asia/Ulaanbaatar | 55 - library/tzdata/Asia/Ulan_Bator | 5 - library/tzdata/Asia/Urumqi | 6 - library/tzdata/Asia/Ust-Nera | 71 - library/tzdata/Asia/Vientiane | 5 - library/tzdata/Asia/Vladivostok | 71 - library/tzdata/Asia/Yakutsk | 71 - library/tzdata/Asia/Yangon | 9 - library/tzdata/Asia/Yekaterinburg | 72 - library/tzdata/Asia/Yerevan | 70 - library/tzdata/Atlantic/Azores | 345 - library/tzdata/Atlantic/Bermuda | 259 - library/tzdata/Atlantic/Canary | 247 - library/tzdata/Atlantic/Cape_Verde | 9 - library/tzdata/Atlantic/Faeroe | 5 - library/tzdata/Atlantic/Faroe | 245 - library/tzdata/Atlantic/Jan_Mayen | 5 - library/tzdata/Atlantic/Madeira | 346 - library/tzdata/Atlantic/Reykjavik | 73 - library/tzdata/Atlantic/South_Georgia | 6 - library/tzdata/Atlantic/St_Helena | 5 - library/tzdata/Atlantic/Stanley | 75 - library/tzdata/Australia/ACT | 5 - library/tzdata/Australia/Adelaide | 273 - library/tzdata/Australia/Brisbane | 23 - library/tzdata/Australia/Broken_Hill | 275 - library/tzdata/Australia/Canberra | 5 - library/tzdata/Australia/Currie | 273 - library/tzdata/Australia/Darwin | 15 - library/tzdata/Australia/Eucla | 25 - library/tzdata/Australia/Hobart | 281 - library/tzdata/Australia/LHI | 5 - library/tzdata/Australia/Lindeman | 28 - library/tzdata/Australia/Lord_Howe | 245 - library/tzdata/Australia/Melbourne | 272 - library/tzdata/Australia/NSW | 5 - library/tzdata/Australia/North | 5 - library/tzdata/Australia/Perth | 25 - library/tzdata/Australia/Queensland | 5 - library/tzdata/Australia/South | 5 - library/tzdata/Australia/Sydney | 272 - library/tzdata/Australia/Tasmania | 5 - library/tzdata/Australia/Victoria | 5 - library/tzdata/Australia/West | 5 - library/tzdata/Australia/Yancowinna | 5 - library/tzdata/Brazil/Acre | 5 - library/tzdata/Brazil/DeNoronha | 5 - library/tzdata/Brazil/East | 5 - library/tzdata/Brazil/West | 5 - library/tzdata/CET | 265 - library/tzdata/CST6CDT | 278 - library/tzdata/Canada/Atlantic | 5 - library/tzdata/Canada/Central | 5 - library/tzdata/Canada/East-Saskatchewan | 5 - library/tzdata/Canada/Eastern | 5 - library/tzdata/Canada/Mountain | 5 - library/tzdata/Canada/Newfoundland | 5 - library/tzdata/Canada/Pacific | 5 - library/tzdata/Canada/Saskatchewan | 5 - library/tzdata/Canada/Yukon | 5 - library/tzdata/Chile/Continental | 5 - library/tzdata/Chile/EasterIsland | 5 - library/tzdata/Cuba | 5 - library/tzdata/EET | 251 - library/tzdata/EST | 5 - library/tzdata/EST5EDT | 278 - library/tzdata/Egypt | 5 - library/tzdata/Eire | 5 - library/tzdata/Etc/GMT | 5 - library/tzdata/Etc/GMT+0 | 5 - library/tzdata/Etc/GMT+1 | 5 - library/tzdata/Etc/GMT+10 | 5 - library/tzdata/Etc/GMT+11 | 5 - library/tzdata/Etc/GMT+12 | 5 - library/tzdata/Etc/GMT+2 | 5 - library/tzdata/Etc/GMT+3 | 5 - library/tzdata/Etc/GMT+4 | 5 - library/tzdata/Etc/GMT+5 | 5 - library/tzdata/Etc/GMT+6 | 5 - library/tzdata/Etc/GMT+7 | 5 - library/tzdata/Etc/GMT+8 | 5 - library/tzdata/Etc/GMT+9 | 5 - library/tzdata/Etc/GMT-0 | 5 - library/tzdata/Etc/GMT-1 | 5 - library/tzdata/Etc/GMT-10 | 5 - library/tzdata/Etc/GMT-11 | 5 - library/tzdata/Etc/GMT-12 | 5 - library/tzdata/Etc/GMT-13 | 5 - library/tzdata/Etc/GMT-14 | 5 - library/tzdata/Etc/GMT-2 | 5 - library/tzdata/Etc/GMT-3 | 5 - library/tzdata/Etc/GMT-4 | 5 - library/tzdata/Etc/GMT-5 | 5 - library/tzdata/Etc/GMT-6 | 5 - library/tzdata/Etc/GMT-7 | 5 - library/tzdata/Etc/GMT-8 | 5 - library/tzdata/Etc/GMT-9 | 5 - library/tzdata/Etc/GMT0 | 5 - library/tzdata/Etc/Greenwich | 5 - library/tzdata/Etc/UCT | 5 - library/tzdata/Etc/UTC | 5 - library/tzdata/Etc/Universal | 5 - library/tzdata/Etc/Zulu | 5 - library/tzdata/Europe/Amsterdam | 310 - library/tzdata/Europe/Andorra | 237 - library/tzdata/Europe/Astrakhan | 71 - library/tzdata/Europe/Athens | 268 - library/tzdata/Europe/Belfast | 5 - library/tzdata/Europe/Belgrade | 250 - library/tzdata/Europe/Berlin | 274 - library/tzdata/Europe/Bratislava | 5 - library/tzdata/Europe/Brussels | 316 - library/tzdata/Europe/Bucharest | 268 - library/tzdata/Europe/Budapest | 282 - library/tzdata/Europe/Busingen | 5 - library/tzdata/Europe/Chisinau | 272 - library/tzdata/Europe/Copenhagen | 264 - library/tzdata/Europe/Dublin | 359 - library/tzdata/Europe/Gibraltar | 328 - library/tzdata/Europe/Guernsey | 5 - library/tzdata/Europe/Helsinki | 248 - library/tzdata/Europe/Isle_of_Man | 5 - library/tzdata/Europe/Istanbul | 140 - library/tzdata/Europe/Jersey | 5 - library/tzdata/Europe/Kaliningrad | 85 - library/tzdata/Europe/Kiev | 251 - library/tzdata/Europe/Kirov | 70 - library/tzdata/Europe/Lisbon | 351 - library/tzdata/Europe/Ljubljana | 5 - library/tzdata/Europe/London | 372 - library/tzdata/Europe/Luxembourg | 313 - library/tzdata/Europe/Madrid | 292 - library/tzdata/Europe/Malta | 299 - library/tzdata/Europe/Mariehamn | 5 - library/tzdata/Europe/Minsk | 75 - library/tzdata/Europe/Monaco | 315 - library/tzdata/Europe/Moscow | 83 - library/tzdata/Europe/Nicosia | 5 - library/tzdata/Europe/Oslo | 271 - library/tzdata/Europe/Paris | 314 - library/tzdata/Europe/Podgorica | 5 - library/tzdata/Europe/Prague | 272 - library/tzdata/Europe/Riga | 258 - library/tzdata/Europe/Rome | 302 - library/tzdata/Europe/Samara | 73 - library/tzdata/Europe/San_Marino | 5 - library/tzdata/Europe/Sarajevo | 5 - library/tzdata/Europe/Saratov | 71 - library/tzdata/Europe/Simferopol | 82 - library/tzdata/Europe/Skopje | 5 - library/tzdata/Europe/Sofia | 258 - library/tzdata/Europe/Stockholm | 250 - library/tzdata/Europe/Tallinn | 254 - library/tzdata/Europe/Tirane | 263 - library/tzdata/Europe/Tiraspol | 5 - library/tzdata/Europe/Ulyanovsk | 73 - library/tzdata/Europe/Uzhgorod | 254 - library/tzdata/Europe/Vaduz | 5 - library/tzdata/Europe/Vatican | 5 - library/tzdata/Europe/Vienna | 271 - library/tzdata/Europe/Vilnius | 252 - library/tzdata/Europe/Volgograd | 71 - library/tzdata/Europe/Warsaw | 296 - library/tzdata/Europe/Zagreb | 5 - library/tzdata/Europe/Zaporozhye | 252 - library/tzdata/Europe/Zurich | 250 - library/tzdata/GB | 5 - library/tzdata/GB-Eire | 5 - library/tzdata/GMT | 5 - library/tzdata/GMT+0 | 5 - library/tzdata/GMT-0 | 5 - library/tzdata/GMT0 | 5 - library/tzdata/Greenwich | 5 - library/tzdata/HST | 5 - library/tzdata/Hongkong | 5 - library/tzdata/Iceland | 5 - library/tzdata/Indian/Antananarivo | 5 - library/tzdata/Indian/Chagos | 7 - library/tzdata/Indian/Christmas | 6 - library/tzdata/Indian/Cocos | 6 - library/tzdata/Indian/Comoro | 5 - library/tzdata/Indian/Kerguelen | 6 - library/tzdata/Indian/Mahe | 6 - library/tzdata/Indian/Maldives | 7 - library/tzdata/Indian/Mauritius | 10 - library/tzdata/Indian/Mayotte | 5 - library/tzdata/Indian/Reunion | 6 - library/tzdata/Iran | 5 - library/tzdata/Israel | 5 - library/tzdata/Jamaica | 5 - library/tzdata/Japan | 5 - library/tzdata/Kwajalein | 5 - library/tzdata/Libya | 5 - library/tzdata/MET | 265 - library/tzdata/MST | 5 - library/tzdata/MST7MDT | 278 - library/tzdata/Mexico/BajaNorte | 5 - library/tzdata/Mexico/BajaSur | 5 - library/tzdata/Mexico/General | 5 - library/tzdata/NZ | 5 - library/tzdata/NZ-CHAT | 5 - library/tzdata/Navajo | 5 - library/tzdata/PRC | 5 - library/tzdata/PST8PDT | 278 - library/tzdata/Pacific/Apia | 188 - library/tzdata/Pacific/Auckland | 285 - library/tzdata/Pacific/Bougainville | 10 - library/tzdata/Pacific/Chatham | 258 - library/tzdata/Pacific/Chuuk | 6 - library/tzdata/Pacific/Easter | 268 - library/tzdata/Pacific/Efate | 26 - library/tzdata/Pacific/Enderbury | 8 - library/tzdata/Pacific/Fakaofo | 7 - library/tzdata/Pacific/Fiji | 191 - library/tzdata/Pacific/Funafuti | 6 - library/tzdata/Pacific/Galapagos | 9 - library/tzdata/Pacific/Gambier | 6 - library/tzdata/Pacific/Guadalcanal | 6 - library/tzdata/Pacific/Guam | 8 - library/tzdata/Pacific/Honolulu | 11 - library/tzdata/Pacific/Johnston | 5 - library/tzdata/Pacific/Kiritimati | 8 - library/tzdata/Pacific/Kosrae | 8 - library/tzdata/Pacific/Kwajalein | 8 - library/tzdata/Pacific/Majuro | 7 - library/tzdata/Pacific/Marquesas | 6 - library/tzdata/Pacific/Midway | 5 - library/tzdata/Pacific/Nauru | 9 - library/tzdata/Pacific/Niue | 8 - library/tzdata/Pacific/Norfolk | 10 - library/tzdata/Pacific/Noumea | 12 - library/tzdata/Pacific/Pago_Pago | 7 - library/tzdata/Pacific/Palau | 6 - library/tzdata/Pacific/Pitcairn | 7 - library/tzdata/Pacific/Pohnpei | 6 - library/tzdata/Pacific/Ponape | 5 - library/tzdata/Pacific/Port_Moresby | 7 - library/tzdata/Pacific/Rarotonga | 32 - library/tzdata/Pacific/Saipan | 5 - library/tzdata/Pacific/Samoa | 5 - library/tzdata/Pacific/Tahiti | 6 - library/tzdata/Pacific/Tarawa | 6 - library/tzdata/Pacific/Tongatapu | 16 - library/tzdata/Pacific/Truk | 5 - library/tzdata/Pacific/Wake | 6 - library/tzdata/Pacific/Wallis | 6 - library/tzdata/Pacific/Yap | 5 - library/tzdata/Poland | 5 - library/tzdata/Portugal | 5 - library/tzdata/ROC | 5 - library/tzdata/ROK | 5 - library/tzdata/Singapore | 5 - library/tzdata/SystemV/AST4 | 5 - library/tzdata/SystemV/AST4ADT | 5 - library/tzdata/SystemV/CST6 | 5 - library/tzdata/SystemV/CST6CDT | 5 - library/tzdata/SystemV/EST5 | 5 - library/tzdata/SystemV/EST5EDT | 5 - library/tzdata/SystemV/HST10 | 5 - library/tzdata/SystemV/MST7 | 5 - library/tzdata/SystemV/MST7MDT | 5 - library/tzdata/SystemV/PST8 | 5 - library/tzdata/SystemV/PST8PDT | 5 - library/tzdata/SystemV/YST9 | 5 - library/tzdata/SystemV/YST9YDT | 5 - library/tzdata/Turkey | 5 - library/tzdata/UCT | 5 - library/tzdata/US/Alaska | 5 - library/tzdata/US/Aleutian | 5 - library/tzdata/US/Arizona | 5 - library/tzdata/US/Central | 5 - library/tzdata/US/East-Indiana | 5 - library/tzdata/US/Eastern | 5 - library/tzdata/US/Hawaii | 5 - library/tzdata/US/Indiana-Starke | 5 - library/tzdata/US/Michigan | 5 - library/tzdata/US/Mountain | 5 - library/tzdata/US/Pacific | 5 - library/tzdata/US/Pacific-New | 5 - library/tzdata/US/Samoa | 5 - library/tzdata/UTC | 5 - library/tzdata/Universal | 5 - library/tzdata/W-SU | 5 - library/tzdata/WET | 251 - library/tzdata/Zulu | 5 - library/word.tcl | 142 - libtommath/LICENSE | 29 - libtommath/README.md | 15 - libtommath/astylerc | 27 - libtommath/bn_error.c | 47 - libtommath/bn_fast_mp_invmod.c | 149 - libtommath/bn_fast_mp_montgomery_reduce.c | 172 - libtommath/bn_fast_s_mp_mul_digs.c | 107 - libtommath/bn_fast_s_mp_mul_high_digs.c | 98 - libtommath/bn_fast_s_mp_sqr.c | 114 - libtommath/bn_mp_2expt.c | 47 - libtommath/bn_mp_abs.c | 42 - libtommath/bn_mp_add.c | 53 - libtommath/bn_mp_add_d.c | 112 - libtommath/bn_mp_addmod.c | 40 - libtommath/bn_mp_and.c | 57 - libtommath/bn_mp_clamp.c | 43 - libtommath/bn_mp_clear.c | 43 - libtommath/bn_mp_clear_multi.c | 34 - libtommath/bn_mp_cmp.c | 42 - libtommath/bn_mp_cmp_d.c | 44 - libtommath/bn_mp_cmp_mag.c | 55 - libtommath/bn_mp_cnt_lsb.c | 53 - libtommath/bn_mp_copy.c | 67 - libtommath/bn_mp_count_bits.c | 44 - libtommath/bn_mp_div.c | 300 - libtommath/bn_mp_div_2.c | 68 - libtommath/bn_mp_div_2d.c | 86 - libtommath/bn_mp_div_3.c | 78 - libtommath/bn_mp_div_d.c | 102 - libtommath/bn_mp_dr_is_modulus.c | 43 - libtommath/bn_mp_dr_reduce.c | 95 - libtommath/bn_mp_dr_setup.c | 31 - libtommath/bn_mp_exch.c | 33 - libtommath/bn_mp_export.c | 87 - libtommath/bn_mp_expt_d.c | 28 - libtommath/bn_mp_expt_d_ex.c | 82 - libtommath/bn_mp_exptmod.c | 112 - libtommath/bn_mp_exptmod_fast.c | 322 - libtommath/bn_mp_exteuclid.c | 125 - libtommath/bn_mp_fread.c | 69 - libtommath/bn_mp_fwrite.c | 54 - libtommath/bn_mp_gcd.c | 107 - libtommath/bn_mp_get_int.c | 45 - libtommath/bn_mp_get_long.c | 41 - libtommath/bn_mp_get_long_long.c | 41 - libtommath/bn_mp_grow.c | 57 - libtommath/bn_mp_import.c | 71 - libtommath/bn_mp_init.c | 46 - libtommath/bn_mp_init_copy.c | 37 - libtommath/bn_mp_init_multi.c | 56 - libtommath/bn_mp_init_set.c | 32 - libtommath/bn_mp_init_set_int.c | 31 - libtommath/bn_mp_init_size.c | 48 - libtommath/bn_mp_invmod.c | 43 - libtommath/bn_mp_invmod_slow.c | 176 - libtommath/bn_mp_is_square.c | 110 - libtommath/bn_mp_jacobi.c | 119 - libtommath/bn_mp_karatsuba_mul.c | 174 - libtommath/bn_mp_karatsuba_sqr.c | 127 - libtommath/bn_mp_lcm.c | 60 - libtommath/bn_mp_lshd.c | 67 - libtommath/bn_mp_mod.c | 47 - libtommath/bn_mp_mod_2d.c | 54 - libtommath/bn_mp_mod_d.c | 26 - libtommath/bn_mp_montgomery_calc_normalization.c | 59 - libtommath/bn_mp_montgomery_reduce.c | 117 - libtommath/bn_mp_montgomery_setup.c | 58 - libtommath/bn_mp_mul.c | 67 - libtommath/bn_mp_mul_2.c | 82 - libtommath/bn_mp_mul_2d.c | 85 - libtommath/bn_mp_mul_d.c | 78 - libtommath/bn_mp_mulmod.c | 40 - libtommath/bn_mp_n_root.c | 30 - libtommath/bn_mp_n_root_ex.c | 132 - libtommath/bn_mp_neg.c | 40 - libtommath/bn_mp_or.c | 51 - libtommath/bn_mp_prime_fermat.c | 63 - libtommath/bn_mp_prime_is_divisible.c | 50 - libtommath/bn_mp_prime_is_prime.c | 84 - libtommath/bn_mp_prime_miller_rabin.c | 106 - libtommath/bn_mp_prime_next_prime.c | 172 - libtommath/bn_mp_prime_rabin_miller_trials.c | 52 - libtommath/bn_mp_prime_random_ex.c | 138 - libtommath/bn_mp_radix_size.c | 78 - libtommath/bn_mp_radix_smap.c | 24 - libtommath/bn_mp_rand.c | 79 - libtommath/bn_mp_read_radix.c | 91 - libtommath/bn_mp_read_signed_bin.c | 41 - libtommath/bn_mp_read_unsigned_bin.c | 55 - libtommath/bn_mp_reduce.c | 100 - libtommath/bn_mp_reduce_2k.c | 63 - libtommath/bn_mp_reduce_2k_l.c | 64 - libtommath/bn_mp_reduce_2k_setup.c | 47 - libtommath/bn_mp_reduce_2k_setup_l.c | 44 - libtommath/bn_mp_reduce_is_2k.c | 52 - libtommath/bn_mp_reduce_is_2k_l.c | 44 - libtommath/bn_mp_reduce_setup.c | 34 - libtommath/bn_mp_rshd.c | 72 - libtommath/bn_mp_set.c | 29 - libtommath/bn_mp_set_int.c | 48 - libtommath/bn_mp_set_long.c | 24 - libtommath/bn_mp_set_long_long.c | 24 - libtommath/bn_mp_shrink.c | 41 - libtommath/bn_mp_signed_bin_size.c | 27 - libtommath/bn_mp_sqr.c | 59 - libtommath/bn_mp_sqrmod.c | 40 - libtommath/bn_mp_sqrt.c | 147 - libtommath/bn_mp_sqrtmod_prime.c | 124 - libtommath/bn_mp_sub.c | 58 - libtommath/bn_mp_sub_d.c | 93 - libtommath/bn_mp_submod.c | 41 - libtommath/bn_mp_to_signed_bin.c | 33 - libtommath/bn_mp_to_signed_bin_n.c | 31 - libtommath/bn_mp_to_unsigned_bin.c | 48 - libtommath/bn_mp_to_unsigned_bin_n.c | 31 - libtommath/bn_mp_toom_mul.c | 286 - libtommath/bn_mp_toom_sqr.c | 227 - libtommath/bn_mp_toradix.c | 75 - libtommath/bn_mp_toradix_n.c | 88 - libtommath/bn_mp_unsigned_bin_size.c | 28 - libtommath/bn_mp_xor.c | 51 - libtommath/bn_mp_zero.c | 36 - libtommath/bn_prime_tab.c | 61 - libtommath/bn_reverse.c | 38 - libtommath/bn_s_mp_add.c | 108 - libtommath/bn_s_mp_exptmod.c | 254 - libtommath/bn_s_mp_mul_digs.c | 90 - libtommath/bn_s_mp_mul_high_digs.c | 80 - libtommath/bn_s_mp_sqr.c | 84 - libtommath/bn_s_mp_sub.c | 88 - libtommath/bncore.c | 36 - libtommath/callgraph.txt | 13188 ------- libtommath/changes.txt | 438 - libtommath/libtommath.dsp | 572 - libtommath/libtommath.pc.in | 10 - libtommath/libtommath_VS2005.sln | 20 - libtommath/libtommath_VS2005.vcproj | 2847 -- libtommath/libtommath_VS2008.sln | 20 - libtommath/libtommath_VS2008.vcproj | 2813 -- libtommath/makefile | 154 - libtommath/makefile.bcc | 46 - libtommath/makefile.cygwin_dll | 57 - libtommath/makefile.icc | 117 - libtommath/makefile.msvc | 40 - libtommath/makefile.shared | 88 - libtommath/makefile_include.mk | 117 - libtommath/tommath.h | 572 - libtommath/tommath_class.h | 1058 - libtommath/tommath_private.h | 123 - libtommath/tommath_superclass.h | 76 - license.terms | 40 - macosx/GNUmakefile | 208 - macosx/README | 174 - macosx/Tcl-Common.xcconfig | 37 - macosx/Tcl-Debug.xcconfig | 20 - macosx/Tcl-Info.plist.in | 36 - macosx/Tcl-Release.xcconfig | 20 - macosx/Tcl.xcode/default.pbxuser | 200 - macosx/Tcl.xcode/project.pbxproj | 2935 -- macosx/Tcl.xcodeproj/default.pbxuser | 211 - macosx/Tcl.xcodeproj/project.pbxproj | 3041 -- macosx/Tclsh-Info.plist.in | 36 - macosx/configure.ac | 11 - macosx/tclMacOSXBundle.c | 312 - macosx/tclMacOSXFCmd.c | 721 - macosx/tclMacOSXNotify.c | 2036 - pkgs/README | 57 - pkgs/package.list.txt | 35 - tests/README | 107 - tests/aaa_exit.test | 54 - tests/all.tcl | 22 - tests/append.test | 323 - tests/appendComp.test | 476 - tests/apply.test | 321 - tests/assemble.test | 3378 -- tests/assemble1.bench | 84 - tests/assocd.test | 68 - tests/async.test | 216 - tests/autoMkindex.test | 372 - tests/basic.test | 1002 - tests/binary.test | 2874 -- tests/case.test | 94 - tests/chan.test | 275 - tests/chanio.test | 7744 ---- tests/clock.test | 36953 ------------------- tests/cmdAH.test | 1665 - tests/cmdIL.test | 745 - tests/cmdInfo.test | 107 - tests/cmdMZ.test | 355 - tests/compExpr-old.test | 677 - tests/compExpr.test | 396 - tests/compile.test | 1056 - tests/concat.test | 57 - tests/config.test | 60 - tests/coroutine.test | 792 - tests/dcall.test | 43 - tests/dict.test | 2065 -- tests/dstring.test | 439 - tests/encoding.test | 635 - tests/env.test | 349 - tests/error.test | 1211 - tests/eval.test | 89 - tests/event.test | 961 - tests/exec.test | 716 - tests/execute.test | 1088 - tests/expr-old.test | 1208 - tests/expr.test | 7203 ---- tests/fCmd.test | 2606 -- tests/fileName.test | 1636 - tests/fileSystem.test | 966 - tests/for-old.test | 71 - tests/for.test | 1360 - tests/foreach.test | 294 - tests/format.test | 621 - tests/get.test | 119 - tests/history.test | 309 - tests/http.test | 693 - tests/http11.test | 675 - tests/httpd | 252 - tests/httpd11.tcl | 255 - tests/httpold.test | 300 - tests/if-old.test | 162 - tests/if.test | 1282 - tests/incr-old.test | 92 - tests/incr.test | 534 - tests/indexObj.test | 166 - tests/info.test | 2421 -- tests/init.test | 205 - tests/interp.test | 3679 -- tests/io.test | 8670 ----- tests/ioCmd.test | 3843 -- tests/ioTrans.test | 2093 -- tests/iogt.test | 955 - tests/join.test | 55 - tests/lindex.test | 458 - tests/link.test | 415 - tests/linsert.test | 119 - tests/list.test | 134 - tests/listObj.test | 209 - tests/llength.test | 41 - tests/lmap.test | 471 - tests/load.test | 255 - tests/lrange.test | 100 - tests/lrepeat.test | 84 - tests/lreplace.test | 240 - tests/lsearch.test | 528 - tests/lset.test | 481 - tests/lsetComp.test | 431 - tests/macOSXFCmd.test | 181 - tests/macOSXLoad.test | 33 - tests/main.test | 1297 - tests/mathop.test | 1340 - tests/misc.test | 74 - tests/msgcat.test | 1085 - tests/namespace-old.test | 861 - tests/namespace.test | 3294 -- tests/notify.test | 327 - tests/nre.test | 453 - tests/obj.test | 647 - tests/oo.test | 3980 -- tests/ooNext2.test | 1065 - tests/opt.test | 245 - tests/package.test | 1384 - tests/parse.test | 1138 - tests/parseExpr.test | 1078 - tests/parseOld.test | 552 - tests/pid.test | 57 - tests/pkgMkIndex.test | 698 - tests/platform.test | 86 - tests/proc-old.test | 517 - tests/proc.test | 396 - tests/pwd.test | 31 - tests/reg.test | 1229 - tests/regexp.test | 1198 - tests/regexpComp.test | 997 - tests/registry.test | 691 - tests/remote.tcl | 159 - tests/rename.test | 192 - tests/resolver.test | 318 - tests/result.test | 147 - tests/safe.test | 846 - tests/scan.test | 877 - tests/security.test | 45 - tests/set-old.test | 947 - tests/set.test | 568 - tests/socket.test | 2477 -- tests/source.test | 312 - tests/split.test | 91 - tests/stack.test | 62 - tests/string.test | 2066 -- tests/stringComp.test | 801 - tests/stringObj.test | 494 - tests/subst.test | 311 - tests/switch.test | 772 - tests/tailcall.test | 696 - tests/tcltest.test | 1837 - tests/thread.test | 1443 - tests/timer.test | 605 - tests/tm.test | 245 - tests/trace.test | 2686 -- tests/unixFCmd.test | 441 - tests/unixFile.test | 65 - tests/unixForkEvent.test | 45 - tests/unixInit.test | 407 - tests/unixNotfy.test | 102 - tests/unknown.test | 65 - tests/unload.test | 313 - tests/uplevel.test | 305 - tests/upvar.test | 588 - tests/utf.test | 485 - tests/util.test | 4095 -- tests/var.test | 1023 - tests/while-old.test | 119 - tests/while.test | 702 - tests/winConsole.test | 48 - tests/winDde.test | 491 - tests/winFCmd.test | 1443 - tests/winFile.test | 220 - tests/winNotify.test | 162 - tests/winPipe.test | 454 - tests/winTime.test | 66 - tests/zlib.test | 1014 - tools/Makefile.in | 67 - tools/README | 25 - tools/checkLibraryDoc.tcl | 293 - tools/configure | 2869 -- tools/configure.ac | 35 - tools/encoding/Makefile | 110 - tools/encoding/README | 5 - tools/encoding/ascii.txt | 95 - tools/encoding/big5.txt | 13904 ------- tools/encoding/cjk.inf | 4467 --- tools/encoding/cp1250.txt | 274 - tools/encoding/cp1251.txt | 274 - tools/encoding/cp1252.txt | 274 - tools/encoding/cp1253.txt | 274 - tools/encoding/cp1254.txt | 274 - tools/encoding/cp1255.txt | 274 - tools/encoding/cp1256.txt | 274 - tools/encoding/cp1257.txt | 274 - tools/encoding/cp1258.txt | 274 - tools/encoding/cp437.txt | 273 - tools/encoding/cp737.txt | 273 - tools/encoding/cp775.txt | 274 - tools/encoding/cp850.txt | 273 - tools/encoding/cp852.txt | 273 - tools/encoding/cp855.txt | 274 - tools/encoding/cp857.txt | 274 - tools/encoding/cp860.txt | 274 - tools/encoding/cp861.txt | 274 - tools/encoding/cp862.txt | 274 - tools/encoding/cp863.txt | 274 - tools/encoding/cp864.txt | 274 - tools/encoding/cp865.txt | 274 - tools/encoding/cp866.txt | 274 - tools/encoding/cp869.txt | 274 - tools/encoding/cp874.txt | 274 - tools/encoding/cp932.txt | 7998 ---- tools/encoding/cp936.txt | 22065 ----------- tools/encoding/cp949.txt | 17322 --------- tools/encoding/cp950.txt | 13777 ------- tools/encoding/dingbats.txt | 250 - tools/encoding/ebcdic.txt | 289 - tools/encoding/gb12345.txt | 7604 ---- tools/encoding/gb1988.txt | 158 - tools/encoding/gb2312.txt | 7513 ---- tools/encoding/iso2022-jp.esc | 10 - tools/encoding/iso2022-kr.esc | 5 - tools/encoding/iso2022.esc | 12 - tools/encoding/iso8859-1.txt | 303 - tools/encoding/iso8859-10.txt | 303 - tools/encoding/iso8859-13.txt | 299 - tools/encoding/iso8859-14.txt | 301 - tools/encoding/iso8859-15.txt | 303 - tools/encoding/iso8859-16.txt | 299 - tools/encoding/iso8859-2.txt | 303 - tools/encoding/iso8859-3.txt | 296 - tools/encoding/iso8859-4.txt | 303 - tools/encoding/iso8859-5.txt | 303 - tools/encoding/iso8859-6.txt | 260 - tools/encoding/iso8859-7.txt | 302 - tools/encoding/iso8859-8.txt | 270 - tools/encoding/iso8859-9.txt | 307 - tools/encoding/jis0201.txt | 202 - tools/encoding/jis0208.txt | 6940 ---- tools/encoding/jis0212.txt | 6141 --- tools/encoding/koi8-r.txt | 302 - tools/encoding/ksc5601.txt | 8262 ----- tools/encoding/macCentEuro.txt | 319 - tools/encoding/macCroatian.txt | 347 - tools/encoding/macCyrillic.txt | 344 - tools/encoding/macDingbats.txt | 260 - tools/encoding/macGreek.txt | 338 - tools/encoding/macIceland.txt | 365 - tools/encoding/macJapan.txt | 7598 ---- tools/encoding/macRoman.txt | 364 - tools/encoding/macRomania.txt | 285 - tools/encoding/macThai.txt | 299 - tools/encoding/macTurkish.txt | 334 - tools/encoding/macUkraine.txt | 279 - tools/encoding/shiftjis.txt | 7096 ---- tools/encoding/symbol.txt | 265 - tools/encoding/tis-620.txt | 263 - tools/encoding/txt2enc.c | 251 - tools/eolFix.tcl | 80 - tools/feather.bmp | Bin 2102 -> 0 bytes tools/findBadExternals.tcl | 53 - tools/fix_tommath_h.tcl | 103 - tools/genStubs.tcl | 1202 - tools/index.tcl | 199 - tools/installData.tcl | 50 - tools/loadICU.tcl | 622 - tools/makeTestCases.tcl | 1180 - tools/man2help.tcl | 141 - tools/man2help2.tcl | 1033 - tools/man2html.tcl | 185 - tools/man2html1.tcl | 258 - tools/man2html2.tcl | 927 - tools/man2tcl.c | 424 - tools/mkdepend.tcl | 420 - tools/regexpTestLib.tcl | 263 - tools/str2c | 59 - tools/tcl.hpj.in | 19 - tools/tclZIC.tcl | 1373 - tools/tclsh.svg | 67 - tools/tcltk-man2html-utils.tcl | 1641 - tools/tcltk-man2html.tcl | 749 - tools/tsdPerf.c | 59 - tools/tsdPerf.tcl | 24 - tools/uniClass.tcl | 130 - tools/uniParse.tcl | 411 - tools/white.bmp | Bin 20522 -> 0 bytes unix/Makefile.in | 2149 -- unix/README | 169 - unix/aclocal.m4 | 1 - unix/configure | 11601 ------ unix/configure.ac | 1028 - unix/dltest/Makefile.in | 110 - unix/dltest/README | 4 - unix/dltest/pkga.c | 137 - unix/dltest/pkgb.c | 190 - unix/dltest/pkgc.c | 162 - unix/dltest/pkgd.c | 162 - unix/dltest/pkge.c | 45 - unix/dltest/pkgooa.c | 141 - unix/dltest/pkgua.c | 332 - unix/install-sh | 528 - unix/installManPage | 117 - unix/ldAix | 58 - unix/tcl.m4 | 3018 -- unix/tcl.pc.in | 15 - unix/tcl.spec | 52 - unix/tclAppInit.c | 169 - unix/tclConfig.h.in | 505 - unix/tclConfig.sh.in | 169 - unix/tclEpollNotfy.c | 809 - unix/tclKqueueNotfy.c | 842 - unix/tclLoadAix.c | 630 - unix/tclLoadDl.c | 274 - unix/tclLoadDyld.c | 719 - unix/tclLoadNext.c | 217 - unix/tclLoadOSF.c | 235 - unix/tclLoadShl.c | 224 - unix/tclSelectNotfy.c | 1117 - unix/tclUnixChan.c | 1776 - unix/tclUnixCompat.c | 1022 - unix/tclUnixEvent.c | 95 - unix/tclUnixFCmd.c | 2515 -- unix/tclUnixFile.c | 1244 - unix/tclUnixInit.c | 1087 - unix/tclUnixNotfy.c | 575 - unix/tclUnixPipe.c | 1327 - unix/tclUnixPort.h | 722 - unix/tclUnixSock.c | 1821 - unix/tclUnixTest.c | 781 - unix/tclUnixThrd.c | 815 - unix/tclUnixThrd.h | 19 - unix/tclUnixTime.c | 548 - unix/tclXtNotify.c | 667 - unix/tclXtTest.c | 134 - unix/tclooConfig.sh | 19 - win/Makefile.in | 888 - win/README | 99 - win/aclocal.m4 | 1 - win/buildall.vc.bat | 103 - win/cat.c | 41 - win/coffbase.txt | 43 - win/configure | 6465 ---- win/configure.ac | 465 - win/makefile.vc | 1257 - win/nmakehlp.c | 711 - win/rules.vc | 708 - win/tcl.dsp | 1559 - win/tcl.dsw | 29 - win/tcl.hpj.in | 19 - win/tcl.m4 | 1299 - win/tcl.rc | 57 - win/tclAppInit.c | 338 - win/tclConfig.sh.in | 181 - win/tclWin32Dll.c | 801 - win/tclWinChan.c | 1605 - win/tclWinConsole.c | 1427 - win/tclWinDde.c | 1888 - win/tclWinError.c | 428 - win/tclWinFCmd.c | 1966 - win/tclWinFile.c | 3202 -- win/tclWinInit.c | 734 - win/tclWinInt.h | 164 - win/tclWinLoad.c | 430 - win/tclWinNotify.c | 618 - win/tclWinPipe.c | 3459 -- win/tclWinPort.h | 571 - win/tclWinReg.c | 1545 - win/tclWinSerial.c | 2236 -- win/tclWinSock.c | 3565 -- win/tclWinTest.c | 663 - win/tclWinThrd.c | 1096 - win/tclWinTime.c | 1191 - win/tclooConfig.sh | 19 - win/tclsh.exe.manifest.in | 53 - win/tclsh.ico | Bin 57022 -> 0 bytes win/tclsh.rc | 82 - 2021 files changed, 121 insertions(+), 964342 deletions(-) delete mode 100644 .fossil-settings/binary-glob delete mode 100644 .fossil-settings/crlf-glob delete mode 100644 .fossil-settings/crnl-glob delete mode 100644 .fossil-settings/encoding-glob delete mode 100644 .fossil-settings/ignore-glob delete mode 100644 .project delete mode 100644 .settings/org.eclipse.core.resources.prefs delete mode 100644 .settings/org.eclipse.core.runtime.prefs delete mode 100644 ChangeLog delete mode 100644 ChangeLog.1999 delete mode 100644 ChangeLog.2000 delete mode 100644 ChangeLog.2001 delete mode 100644 ChangeLog.2002 delete mode 100644 ChangeLog.2003 delete mode 100644 ChangeLog.2004 delete mode 100644 ChangeLog.2005 delete mode 100644 ChangeLog.2007 delete mode 100644 ChangeLog.2008 delete mode 100644 README delete mode 100644 changes delete mode 100644 compat/README delete mode 100644 compat/dirent.h delete mode 100644 compat/dirent2.h delete mode 100644 compat/dlfcn.h delete mode 100644 compat/fake-rfc2553.c delete mode 100644 compat/fake-rfc2553.h delete mode 100644 compat/fixstrtod.c delete mode 100644 compat/gettod.c delete mode 100644 compat/memcmp.c delete mode 100644 compat/mkstemp.c delete mode 100644 compat/opendir.c delete mode 100644 compat/stdlib.h delete mode 100644 compat/string.h delete mode 100644 compat/strncasecmp.c delete mode 100644 compat/strstr.c delete mode 100644 compat/strtod.c delete mode 100644 compat/strtol.c delete mode 100644 compat/strtoul.c delete mode 100644 compat/unistd.h delete mode 100644 compat/waitpid.c delete mode 100644 compat/zlib/CMakeLists.txt delete mode 100644 compat/zlib/ChangeLog delete mode 100644 compat/zlib/FAQ delete mode 100644 compat/zlib/INDEX delete mode 100644 compat/zlib/Makefile delete mode 100644 compat/zlib/Makefile.in delete mode 100644 compat/zlib/README delete mode 100644 compat/zlib/adler32.c delete mode 100644 compat/zlib/amiga/Makefile.pup delete mode 100644 compat/zlib/amiga/Makefile.sas delete mode 100644 compat/zlib/compress.c delete mode 100755 compat/zlib/configure delete mode 100644 compat/zlib/contrib/README.contrib delete mode 100644 compat/zlib/contrib/ada/buffer_demo.adb delete mode 100644 compat/zlib/contrib/ada/mtest.adb delete mode 100644 compat/zlib/contrib/ada/read.adb delete mode 100644 compat/zlib/contrib/ada/readme.txt delete mode 100644 compat/zlib/contrib/ada/test.adb delete mode 100644 compat/zlib/contrib/ada/zlib-streams.adb delete mode 100644 compat/zlib/contrib/ada/zlib-streams.ads delete mode 100644 compat/zlib/contrib/ada/zlib-thin.adb delete mode 100644 compat/zlib/contrib/ada/zlib-thin.ads delete mode 100644 compat/zlib/contrib/ada/zlib.adb delete mode 100644 compat/zlib/contrib/ada/zlib.ads delete mode 100644 compat/zlib/contrib/ada/zlib.gpr delete mode 100644 compat/zlib/contrib/amd64/amd64-match.S delete mode 100644 compat/zlib/contrib/asm686/README.686 delete mode 100644 compat/zlib/contrib/asm686/match.S delete mode 100644 compat/zlib/contrib/blast/Makefile delete mode 100644 compat/zlib/contrib/blast/README delete mode 100644 compat/zlib/contrib/blast/blast.c delete mode 100644 compat/zlib/contrib/blast/blast.h delete mode 100644 compat/zlib/contrib/blast/test.pk delete mode 100644 compat/zlib/contrib/blast/test.txt delete mode 100644 compat/zlib/contrib/delphi/ZLib.pas delete mode 100644 compat/zlib/contrib/delphi/ZLibConst.pas delete mode 100644 compat/zlib/contrib/delphi/readme.txt delete mode 100644 compat/zlib/contrib/delphi/zlibd32.mak delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib.build delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib.chm delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib.sln delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib/Deflater.cs delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib/DotZLib.cs delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib/Inflater.cs delete mode 100644 compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs delete mode 100644 compat/zlib/contrib/dotzlib/LICENSE_1_0.txt delete mode 100644 compat/zlib/contrib/dotzlib/readme.txt delete mode 100644 compat/zlib/contrib/gcc_gvmat64/gvmat64.S delete mode 100644 compat/zlib/contrib/infback9/README delete mode 100644 compat/zlib/contrib/infback9/infback9.c delete mode 100644 compat/zlib/contrib/infback9/infback9.h delete mode 100644 compat/zlib/contrib/infback9/inffix9.h delete mode 100644 compat/zlib/contrib/infback9/inflate9.h delete mode 100644 compat/zlib/contrib/infback9/inftree9.c delete mode 100644 compat/zlib/contrib/infback9/inftree9.h delete mode 100644 compat/zlib/contrib/inflate86/inffas86.c delete mode 100644 compat/zlib/contrib/inflate86/inffast.S delete mode 100644 compat/zlib/contrib/iostream/test.cpp delete mode 100644 compat/zlib/contrib/iostream/zfstream.cpp delete mode 100644 compat/zlib/contrib/iostream/zfstream.h delete mode 100644 compat/zlib/contrib/iostream2/zstream.h delete mode 100644 compat/zlib/contrib/iostream2/zstream_test.cpp delete mode 100644 compat/zlib/contrib/iostream3/README delete mode 100644 compat/zlib/contrib/iostream3/TODO delete mode 100644 compat/zlib/contrib/iostream3/test.cc delete mode 100644 compat/zlib/contrib/iostream3/zfstream.cc delete mode 100644 compat/zlib/contrib/iostream3/zfstream.h delete mode 100644 compat/zlib/contrib/masmx64/bld_ml64.bat delete mode 100644 compat/zlib/contrib/masmx64/gvmat64.asm delete mode 100644 compat/zlib/contrib/masmx64/inffas8664.c delete mode 100644 compat/zlib/contrib/masmx64/inffasx64.asm delete mode 100644 compat/zlib/contrib/masmx64/readme.txt delete mode 100644 compat/zlib/contrib/masmx86/bld_ml32.bat delete mode 100644 compat/zlib/contrib/masmx86/inffas32.asm delete mode 100644 compat/zlib/contrib/masmx86/match686.asm delete mode 100644 compat/zlib/contrib/masmx86/readme.txt delete mode 100644 compat/zlib/contrib/minizip/Makefile delete mode 100644 compat/zlib/contrib/minizip/Makefile.am delete mode 100644 compat/zlib/contrib/minizip/MiniZip64_Changes.txt delete mode 100644 compat/zlib/contrib/minizip/MiniZip64_info.txt delete mode 100644 compat/zlib/contrib/minizip/configure.ac delete mode 100644 compat/zlib/contrib/minizip/crypt.h delete mode 100644 compat/zlib/contrib/minizip/ioapi.c delete mode 100644 compat/zlib/contrib/minizip/ioapi.h delete mode 100644 compat/zlib/contrib/minizip/iowin32.c delete mode 100644 compat/zlib/contrib/minizip/iowin32.h delete mode 100644 compat/zlib/contrib/minizip/make_vms.com delete mode 100644 compat/zlib/contrib/minizip/miniunz.c delete mode 100644 compat/zlib/contrib/minizip/miniunzip.1 delete mode 100644 compat/zlib/contrib/minizip/minizip.1 delete mode 100644 compat/zlib/contrib/minizip/minizip.c delete mode 100644 compat/zlib/contrib/minizip/minizip.pc.in delete mode 100644 compat/zlib/contrib/minizip/mztools.c delete mode 100644 compat/zlib/contrib/minizip/mztools.h delete mode 100644 compat/zlib/contrib/minizip/unzip.c delete mode 100644 compat/zlib/contrib/minizip/unzip.h delete mode 100644 compat/zlib/contrib/minizip/zip.c delete mode 100644 compat/zlib/contrib/minizip/zip.h delete mode 100644 compat/zlib/contrib/pascal/example.pas delete mode 100644 compat/zlib/contrib/pascal/readme.txt delete mode 100644 compat/zlib/contrib/pascal/zlibd32.mak delete mode 100644 compat/zlib/contrib/pascal/zlibpas.pas delete mode 100644 compat/zlib/contrib/puff/Makefile delete mode 100644 compat/zlib/contrib/puff/README delete mode 100644 compat/zlib/contrib/puff/puff.c delete mode 100644 compat/zlib/contrib/puff/puff.h delete mode 100644 compat/zlib/contrib/puff/pufftest.c delete mode 100644 compat/zlib/contrib/puff/zeros.raw delete mode 100644 compat/zlib/contrib/testzlib/testzlib.c delete mode 100644 compat/zlib/contrib/testzlib/testzlib.txt delete mode 100644 compat/zlib/contrib/untgz/Makefile delete mode 100644 compat/zlib/contrib/untgz/Makefile.msc delete mode 100644 compat/zlib/contrib/untgz/untgz.c delete mode 100644 compat/zlib/contrib/vstudio/readme.txt delete mode 100644 compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters delete mode 100644 compat/zlib/contrib/vstudio/vc10/minizip.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc10/minizip.vcxproj.filters delete mode 100644 compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters delete mode 100644 compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters delete mode 100644 compat/zlib/contrib/vstudio/vc10/zlib.rc delete mode 100644 compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters delete mode 100644 compat/zlib/contrib/vstudio/vc10/zlibvc.def delete mode 100644 compat/zlib/contrib/vstudio/vc10/zlibvc.sln delete mode 100644 compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.filters delete mode 100644 compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc11/minizip.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc11/zlib.rc delete mode 100644 compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc11/zlibvc.def delete mode 100644 compat/zlib/contrib/vstudio/vc11/zlibvc.sln delete mode 100644 compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc12/miniunz.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc12/minizip.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc12/testzlib.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc12/testzlibdll.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc12/zlib.rc delete mode 100644 compat/zlib/contrib/vstudio/vc12/zlibstat.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc12/zlibvc.def delete mode 100644 compat/zlib/contrib/vstudio/vc12/zlibvc.sln delete mode 100644 compat/zlib/contrib/vstudio/vc12/zlibvc.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc14/miniunz.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc14/minizip.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc14/testzlib.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc14/testzlibdll.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc14/zlib.rc delete mode 100644 compat/zlib/contrib/vstudio/vc14/zlibstat.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc14/zlibvc.def delete mode 100644 compat/zlib/contrib/vstudio/vc14/zlibvc.sln delete mode 100644 compat/zlib/contrib/vstudio/vc14/zlibvc.vcxproj delete mode 100644 compat/zlib/contrib/vstudio/vc9/miniunz.vcproj delete mode 100644 compat/zlib/contrib/vstudio/vc9/minizip.vcproj delete mode 100644 compat/zlib/contrib/vstudio/vc9/testzlib.vcproj delete mode 100644 compat/zlib/contrib/vstudio/vc9/testzlibdll.vcproj delete mode 100644 compat/zlib/contrib/vstudio/vc9/zlib.rc delete mode 100644 compat/zlib/contrib/vstudio/vc9/zlibstat.vcproj delete mode 100644 compat/zlib/contrib/vstudio/vc9/zlibvc.def delete mode 100644 compat/zlib/contrib/vstudio/vc9/zlibvc.sln delete mode 100644 compat/zlib/contrib/vstudio/vc9/zlibvc.vcproj delete mode 100644 compat/zlib/crc32.c delete mode 100644 compat/zlib/crc32.h delete mode 100644 compat/zlib/deflate.c delete mode 100644 compat/zlib/deflate.h delete mode 100644 compat/zlib/examples/README.examples delete mode 100644 compat/zlib/examples/enough.c delete mode 100644 compat/zlib/examples/fitblk.c delete mode 100644 compat/zlib/examples/gun.c delete mode 100644 compat/zlib/examples/gzappend.c delete mode 100644 compat/zlib/examples/gzjoin.c delete mode 100644 compat/zlib/examples/gzlog.c delete mode 100644 compat/zlib/examples/gzlog.h delete mode 100644 compat/zlib/examples/zlib_how.html delete mode 100644 compat/zlib/examples/zpipe.c delete mode 100644 compat/zlib/examples/zran.c delete mode 100644 compat/zlib/gzclose.c delete mode 100644 compat/zlib/gzguts.h delete mode 100644 compat/zlib/gzlib.c delete mode 100644 compat/zlib/gzread.c delete mode 100644 compat/zlib/gzwrite.c delete mode 100644 compat/zlib/infback.c delete mode 100644 compat/zlib/inffast.c delete mode 100644 compat/zlib/inffast.h delete mode 100644 compat/zlib/inffixed.h delete mode 100644 compat/zlib/inflate.c delete mode 100644 compat/zlib/inflate.h delete mode 100644 compat/zlib/inftrees.c delete mode 100644 compat/zlib/inftrees.h delete mode 100644 compat/zlib/make_vms.com delete mode 100644 compat/zlib/msdos/Makefile.bor delete mode 100644 compat/zlib/msdos/Makefile.dj2 delete mode 100644 compat/zlib/msdos/Makefile.emx delete mode 100644 compat/zlib/msdos/Makefile.msc delete mode 100644 compat/zlib/msdos/Makefile.tc delete mode 100644 compat/zlib/nintendods/Makefile delete mode 100644 compat/zlib/nintendods/README delete mode 100644 compat/zlib/old/Makefile.emx delete mode 100644 compat/zlib/old/Makefile.riscos delete mode 100644 compat/zlib/old/README delete mode 100644 compat/zlib/old/descrip.mms delete mode 100644 compat/zlib/old/os2/Makefile.os2 delete mode 100644 compat/zlib/old/os2/zlib.def delete mode 100644 compat/zlib/old/visual-basic.txt delete mode 100644 compat/zlib/os400/README400 delete mode 100644 compat/zlib/os400/bndsrc delete mode 100644 compat/zlib/os400/make.sh delete mode 100644 compat/zlib/os400/zlib.inc delete mode 100644 compat/zlib/qnx/package.qpg delete mode 100644 compat/zlib/test/example.c delete mode 100644 compat/zlib/test/infcover.c delete mode 100644 compat/zlib/test/minigzip.c delete mode 100644 compat/zlib/treebuild.xml delete mode 100644 compat/zlib/trees.c delete mode 100644 compat/zlib/trees.h delete mode 100644 compat/zlib/uncompr.c delete mode 100644 compat/zlib/watcom/watcom_f.mak delete mode 100644 compat/zlib/watcom/watcom_l.mak delete mode 100644 compat/zlib/win32/DLL_FAQ.txt delete mode 100644 compat/zlib/win32/Makefile.bor delete mode 100644 compat/zlib/win32/Makefile.gcc delete mode 100644 compat/zlib/win32/Makefile.msc delete mode 100644 compat/zlib/win32/README-WIN32.txt delete mode 100644 compat/zlib/win32/README.txt delete mode 100644 compat/zlib/win32/USAGE.txt delete mode 100644 compat/zlib/win32/VisualC.txt delete mode 100755 compat/zlib/win32/zdll.lib delete mode 100644 compat/zlib/win32/zlib.def delete mode 100755 compat/zlib/win32/zlib1.dll delete mode 100644 compat/zlib/win32/zlib1.rc delete mode 100644 compat/zlib/win64/libz.dll.a delete mode 100644 compat/zlib/win64/zdll.lib delete mode 100755 compat/zlib/win64/zlib1.dll delete mode 100644 compat/zlib/zconf.h delete mode 100644 compat/zlib/zconf.h.cmakein delete mode 100644 compat/zlib/zconf.h.in delete mode 100644 compat/zlib/zlib.3 delete mode 100644 compat/zlib/zlib.3.pdf delete mode 100644 compat/zlib/zlib.h delete mode 100644 compat/zlib/zlib.map delete mode 100644 compat/zlib/zlib.pc.cmakein delete mode 100644 compat/zlib/zlib.pc.in delete mode 100755 compat/zlib/zlib2ansi delete mode 100644 compat/zlib/zutil.c delete mode 100644 compat/zlib/zutil.h delete mode 100644 doc/Access.3 delete mode 100644 doc/AddErrInfo.3 delete mode 100644 doc/Alloc.3 delete mode 100644 doc/AllowExc.3 delete mode 100644 doc/AppInit.3 delete mode 100644 doc/AssocData.3 delete mode 100644 doc/Async.3 delete mode 100644 doc/BackgdErr.3 delete mode 100644 doc/Backslash.3 delete mode 100644 doc/BoolObj.3 delete mode 100644 doc/ByteArrObj.3 delete mode 100644 doc/CallDel.3 delete mode 100644 doc/Cancel.3 delete mode 100644 doc/ChnlStack.3 delete mode 100644 doc/Class.3 delete mode 100644 doc/CmdCmplt.3 delete mode 100644 doc/Concat.3 delete mode 100644 doc/CrtChannel.3 delete mode 100644 doc/CrtChnlHdlr.3 delete mode 100644 doc/CrtCloseHdlr.3 delete mode 100644 doc/CrtCommand.3 delete mode 100644 doc/CrtFileHdlr.3 delete mode 100644 doc/CrtInterp.3 delete mode 100644 doc/CrtMathFnc.3 delete mode 100644 doc/CrtObjCmd.3 delete mode 100644 doc/CrtSlave.3 delete mode 100644 doc/CrtTimerHdlr.3 delete mode 100644 doc/CrtTrace.3 delete mode 100644 doc/DString.3 delete mode 100644 doc/DetachPids.3 delete mode 100644 doc/DictObj.3 delete mode 100644 doc/DoOneEvent.3 delete mode 100644 doc/DoWhenIdle.3 delete mode 100644 doc/DoubleObj.3 delete mode 100644 doc/DumpActiveMemory.3 delete mode 100644 doc/Encoding.3 delete mode 100644 doc/Ensemble.3 delete mode 100644 doc/Environment.3 delete mode 100644 doc/Eval.3 delete mode 100644 doc/Exit.3 delete mode 100644 doc/ExprLong.3 delete mode 100644 doc/ExprLongObj.3 delete mode 100644 doc/FileSystem.3 delete mode 100644 doc/FindExec.3 delete mode 100644 doc/GetCwd.3 delete mode 100644 doc/GetHostName.3 delete mode 100644 doc/GetIndex.3 delete mode 100644 doc/GetInt.3 delete mode 100644 doc/GetOpnFl.3 delete mode 100644 doc/GetStdChan.3 delete mode 100644 doc/GetTime.3 delete mode 100644 doc/GetVersion.3 delete mode 100644 doc/Hash.3 delete mode 100644 doc/Init.3 delete mode 100644 doc/InitStubs.3 delete mode 100644 doc/IntObj.3 delete mode 100644 doc/Interp.3 delete mode 100644 doc/Limit.3 delete mode 100644 doc/LinkVar.3 delete mode 100644 doc/ListObj.3 delete mode 100644 doc/Load.3 delete mode 100644 doc/Method.3 delete mode 100644 doc/NRE.3 delete mode 100644 doc/Namespace.3 delete mode 100644 doc/Notifier.3 delete mode 100644 doc/OOInitStubs.3 delete mode 100644 doc/Object.3 delete mode 100644 doc/ObjectType.3 delete mode 100644 doc/OpenFileChnl.3 delete mode 100644 doc/OpenTcp.3 delete mode 100644 doc/Panic.3 delete mode 100644 doc/ParseArgs.3 delete mode 100644 doc/ParseCmd.3 delete mode 100644 doc/PkgRequire.3 delete mode 100644 doc/Preserve.3 delete mode 100644 doc/PrintDbl.3 delete mode 100644 doc/RecEvalObj.3 delete mode 100644 doc/RecordEval.3 delete mode 100644 doc/RegConfig.3 delete mode 100644 doc/RegExp.3 delete mode 100644 doc/SaveResult.3 delete mode 100644 doc/SetChanErr.3 delete mode 100644 doc/SetErrno.3 delete mode 100644 doc/SetRecLmt.3 delete mode 100644 doc/SetResult.3 delete mode 100644 doc/SetVar.3 delete mode 100644 doc/Signal.3 delete mode 100644 doc/Sleep.3 delete mode 100644 doc/SourceRCFile.3 delete mode 100644 doc/SplitList.3 delete mode 100644 doc/SplitPath.3 delete mode 100644 doc/StaticPkg.3 delete mode 100644 doc/StdChannels.3 delete mode 100644 doc/StrMatch.3 delete mode 100644 doc/StringObj.3 delete mode 100644 doc/SubstObj.3 delete mode 100644 doc/TCL_MEM_DEBUG.3 delete mode 100644 doc/Tcl.n delete mode 100644 doc/TclZlib.3 delete mode 100644 doc/Tcl_Main.3 delete mode 100644 doc/Thread.3 delete mode 100644 doc/ToUpper.3 delete mode 100644 doc/TraceCmd.3 delete mode 100644 doc/TraceVar.3 delete mode 100644 doc/Translate.3 delete mode 100644 doc/UniCharIsAlpha.3 delete mode 100644 doc/UpVar.3 delete mode 100644 doc/Utf.3 delete mode 100644 doc/WrongNumArgs.3 delete mode 100644 doc/after.n delete mode 100644 doc/append.n delete mode 100644 doc/apply.n delete mode 100644 doc/array.n delete mode 100644 doc/bgerror.n delete mode 100644 doc/binary.n delete mode 100644 doc/break.n delete mode 100644 doc/case.n delete mode 100644 doc/catch.n delete mode 100644 doc/cd.n delete mode 100644 doc/chan.n delete mode 100644 doc/class.n delete mode 100644 doc/clock.n delete mode 100644 doc/close.n delete mode 100644 doc/concat.n delete mode 100644 doc/continue.n delete mode 100644 doc/copy.n delete mode 100644 doc/coroutine.n delete mode 100644 doc/dde.n delete mode 100644 doc/define.n delete mode 100644 doc/dict.n delete mode 100644 doc/encoding.n delete mode 100644 doc/eof.n delete mode 100644 doc/error.n delete mode 100644 doc/eval.n delete mode 100644 doc/exec.n delete mode 100644 doc/exit.n delete mode 100644 doc/expr.n delete mode 100644 doc/fblocked.n delete mode 100644 doc/fconfigure.n delete mode 100644 doc/fcopy.n delete mode 100644 doc/file.n delete mode 100644 doc/fileevent.n delete mode 100644 doc/filename.n delete mode 100644 doc/flush.n delete mode 100644 doc/for.n delete mode 100644 doc/foreach.n delete mode 100644 doc/format.n delete mode 100644 doc/gets.n delete mode 100644 doc/glob.n delete mode 100644 doc/global.n delete mode 100644 doc/history.n delete mode 100644 doc/http.n delete mode 100644 doc/if.n delete mode 100644 doc/incr.n delete mode 100644 doc/info.n delete mode 100644 doc/interp.n delete mode 100644 doc/join.n delete mode 100644 doc/lappend.n delete mode 100644 doc/lassign.n delete mode 100644 doc/library.n delete mode 100644 doc/lindex.n delete mode 100644 doc/linsert.n delete mode 100644 doc/list.n delete mode 100644 doc/llength.n delete mode 100644 doc/lmap.n delete mode 100644 doc/load.n delete mode 100644 doc/lrange.n delete mode 100644 doc/lrepeat.n delete mode 100644 doc/lreplace.n delete mode 100644 doc/lreverse.n delete mode 100644 doc/lsearch.n delete mode 100644 doc/lset.n delete mode 100644 doc/lsort.n delete mode 100644 doc/man.macros delete mode 100644 doc/mathfunc.n delete mode 100644 doc/mathop.n delete mode 100644 doc/memory.n delete mode 100644 doc/msgcat.n delete mode 100644 doc/my.n delete mode 100644 doc/namespace.n delete mode 100644 doc/next.n delete mode 100644 doc/object.n delete mode 100644 doc/open.n delete mode 100644 doc/package.n delete mode 100644 doc/packagens.n delete mode 100644 doc/pid.n delete mode 100644 doc/pkgMkIndex.n delete mode 100644 doc/platform.n delete mode 100644 doc/platform_shell.n delete mode 100644 doc/prefix.n delete mode 100644 doc/proc.n delete mode 100644 doc/puts.n delete mode 100644 doc/pwd.n delete mode 100644 doc/re_syntax.n delete mode 100644 doc/read.n delete mode 100644 doc/refchan.n delete mode 100644 doc/regexp.n delete mode 100644 doc/registry.n delete mode 100644 doc/regsub.n delete mode 100644 doc/rename.n delete mode 100644 doc/return.n delete mode 100644 doc/safe.n delete mode 100644 doc/scan.n delete mode 100644 doc/seek.n delete mode 100644 doc/self.n delete mode 100644 doc/set.n delete mode 100644 doc/socket.n delete mode 100644 doc/source.n delete mode 100644 doc/split.n delete mode 100644 doc/string.n delete mode 100644 doc/subst.n delete mode 100644 doc/switch.n delete mode 100644 doc/tailcall.n delete mode 100644 doc/tclsh.1 delete mode 100644 doc/tcltest.n delete mode 100644 doc/tclvars.n delete mode 100644 doc/tell.n delete mode 100644 doc/throw.n delete mode 100644 doc/time.n delete mode 100644 doc/tm.n delete mode 100644 doc/trace.n delete mode 100644 doc/transchan.n delete mode 100644 doc/try.n delete mode 100644 doc/unknown.n delete mode 100644 doc/unload.n delete mode 100644 doc/unset.n delete mode 100644 doc/update.n delete mode 100644 doc/uplevel.n delete mode 100644 doc/upvar.n delete mode 100644 doc/variable.n delete mode 100644 doc/vwait.n delete mode 100644 doc/while.n delete mode 100644 doc/zlib.n delete mode 100644 generic/README delete mode 100644 generic/regc_color.c delete mode 100644 generic/regc_cvec.c delete mode 100644 generic/regc_lex.c delete mode 100644 generic/regc_locale.c delete mode 100644 generic/regc_nfa.c delete mode 100644 generic/regcomp.c delete mode 100644 generic/regcustom.h delete mode 100644 generic/rege_dfa.c delete mode 100644 generic/regerror.c delete mode 100644 generic/regerrs.h delete mode 100644 generic/regex.h delete mode 100644 generic/regexec.c delete mode 100644 generic/regfree.c delete mode 100644 generic/regfronts.c delete mode 100644 generic/regguts.h delete mode 100644 generic/tcl.decls delete mode 100644 generic/tcl.h delete mode 100644 generic/tclAlloc.c delete mode 100644 generic/tclAssembly.c delete mode 100644 generic/tclAsync.c delete mode 100644 generic/tclBinary.c delete mode 100644 generic/tclCkalloc.c delete mode 100644 generic/tclClock.c delete mode 100644 generic/tclCmdAH.c delete mode 100644 generic/tclCmdIL.c delete mode 100644 generic/tclCmdMZ.c delete mode 100644 generic/tclCompCmds.c delete mode 100644 generic/tclCompCmdsGR.c delete mode 100644 generic/tclCompCmdsSZ.c delete mode 100644 generic/tclCompExpr.c delete mode 100644 generic/tclCompile.c delete mode 100644 generic/tclCompile.h delete mode 100644 generic/tclConfig.c delete mode 100644 generic/tclDTrace.d delete mode 100644 generic/tclDate.c delete mode 100644 generic/tclDecls.h delete mode 100644 generic/tclDictObj.c delete mode 100644 generic/tclDisassemble.c delete mode 100644 generic/tclEncoding.c delete mode 100644 generic/tclEnsemble.c delete mode 100644 generic/tclEnv.c delete mode 100644 generic/tclEvent.c delete mode 100644 generic/tclExecute.c delete mode 100644 generic/tclFCmd.c delete mode 100644 generic/tclFileName.c delete mode 100644 generic/tclFileSystem.h delete mode 100644 generic/tclGet.c delete mode 100644 generic/tclGetDate.y delete mode 100644 generic/tclHash.c delete mode 100644 generic/tclHistory.c delete mode 100644 generic/tclIO.c delete mode 100644 generic/tclIO.h delete mode 100644 generic/tclIOCmd.c delete mode 100644 generic/tclIOGT.c delete mode 100644 generic/tclIORChan.c delete mode 100644 generic/tclIORTrans.c delete mode 100644 generic/tclIOSock.c delete mode 100644 generic/tclIOUtil.c delete mode 100644 generic/tclIndexObj.c delete mode 100644 generic/tclInt.decls delete mode 100644 generic/tclInt.h delete mode 100644 generic/tclIntDecls.h delete mode 100644 generic/tclIntPlatDecls.h delete mode 100644 generic/tclInterp.c delete mode 100644 generic/tclLink.c delete mode 100644 generic/tclListObj.c delete mode 100644 generic/tclLiteral.c delete mode 100644 generic/tclLoad.c delete mode 100644 generic/tclLoadNone.c delete mode 100644 generic/tclMain.c delete mode 100644 generic/tclNamesp.c delete mode 100644 generic/tclNotify.c delete mode 100644 generic/tclOO.c delete mode 100644 generic/tclOO.decls delete mode 100644 generic/tclOO.h delete mode 100644 generic/tclOOBasic.c delete mode 100644 generic/tclOOCall.c delete mode 100644 generic/tclOODecls.h delete mode 100644 generic/tclOODefineCmds.c delete mode 100644 generic/tclOOInfo.c delete mode 100644 generic/tclOOInt.h delete mode 100644 generic/tclOOIntDecls.h delete mode 100644 generic/tclOOMethod.c delete mode 100644 generic/tclOOStubInit.c delete mode 100644 generic/tclOOStubLib.c delete mode 100644 generic/tclObj.c delete mode 100644 generic/tclOptimize.c delete mode 100644 generic/tclPanic.c delete mode 100644 generic/tclParse.c delete mode 100644 generic/tclParse.h delete mode 100644 generic/tclPathObj.c delete mode 100644 generic/tclPipe.c delete mode 100644 generic/tclPkg.c delete mode 100644 generic/tclPkgConfig.c delete mode 100644 generic/tclPlatDecls.h delete mode 100644 generic/tclPort.h delete mode 100644 generic/tclPosixStr.c delete mode 100644 generic/tclPreserve.c delete mode 100644 generic/tclRegexp.c delete mode 100644 generic/tclRegexp.h delete mode 100644 generic/tclResolve.c delete mode 100644 generic/tclResult.c delete mode 100644 generic/tclScan.c delete mode 100644 generic/tclStrToD.c delete mode 100644 generic/tclStringObj.c delete mode 100644 generic/tclStringRep.h delete mode 100644 generic/tclStringTrim.h delete mode 100644 generic/tclStubInit.c delete mode 100644 generic/tclStubLib.c delete mode 100644 generic/tclStubLibTbl.c delete mode 100644 generic/tclTest.c delete mode 100644 generic/tclTestObj.c delete mode 100644 generic/tclTestProcBodyObj.c delete mode 100644 generic/tclThread.c delete mode 100644 generic/tclThreadAlloc.c delete mode 100644 generic/tclThreadJoin.c delete mode 100644 generic/tclThreadStorage.c delete mode 100644 generic/tclThreadTest.c delete mode 100644 generic/tclTimer.c delete mode 100644 generic/tclTomMath.decls delete mode 100644 generic/tclTomMath.h delete mode 100644 generic/tclTomMathDecls.h delete mode 100644 generic/tclTomMathInt.h delete mode 100644 generic/tclTomMathInterface.c delete mode 100644 generic/tclTomMathStubLib.c delete mode 100644 generic/tclTrace.c delete mode 100644 generic/tclUniData.c delete mode 100644 generic/tclUtf.c delete mode 100644 generic/tclUtil.c delete mode 100644 generic/tclVar.c delete mode 100644 generic/tclZlib.c delete mode 100644 generic/tommath.h delete mode 100644 library/auto.tcl delete mode 100644 library/clock.tcl delete mode 100644 library/dde/pkgIndex.tcl delete mode 100644 library/encoding/ascii.enc delete mode 100644 library/encoding/big5.enc delete mode 100644 library/encoding/cp1250.enc delete mode 100644 library/encoding/cp1251.enc delete mode 100644 library/encoding/cp1252.enc delete mode 100644 library/encoding/cp1253.enc delete mode 100644 library/encoding/cp1254.enc delete mode 100644 library/encoding/cp1255.enc delete mode 100644 library/encoding/cp1256.enc delete mode 100644 library/encoding/cp1257.enc delete mode 100644 library/encoding/cp1258.enc delete mode 100644 library/encoding/cp437.enc delete mode 100644 library/encoding/cp737.enc delete mode 100644 library/encoding/cp775.enc delete mode 100644 library/encoding/cp850.enc delete mode 100644 library/encoding/cp852.enc delete mode 100644 library/encoding/cp855.enc delete mode 100644 library/encoding/cp857.enc delete mode 100644 library/encoding/cp860.enc delete mode 100644 library/encoding/cp861.enc delete mode 100644 library/encoding/cp862.enc delete mode 100644 library/encoding/cp863.enc delete mode 100644 library/encoding/cp864.enc delete mode 100644 library/encoding/cp865.enc delete mode 100644 library/encoding/cp866.enc delete mode 100644 library/encoding/cp869.enc delete mode 100644 library/encoding/cp874.enc delete mode 100644 library/encoding/cp932.enc delete mode 100644 library/encoding/cp936.enc delete mode 100644 library/encoding/cp949.enc delete mode 100644 library/encoding/cp950.enc delete mode 100644 library/encoding/dingbats.enc delete mode 100644 library/encoding/ebcdic.enc delete mode 100644 library/encoding/euc-cn.enc delete mode 100644 library/encoding/euc-jp.enc delete mode 100644 library/encoding/euc-kr.enc delete mode 100644 library/encoding/gb12345.enc delete mode 100644 library/encoding/gb1988.enc delete mode 100644 library/encoding/gb2312-raw.enc delete mode 100644 library/encoding/gb2312.enc delete mode 100644 library/encoding/iso2022-jp.enc delete mode 100644 library/encoding/iso2022-kr.enc delete mode 100644 library/encoding/iso2022.enc delete mode 100644 library/encoding/iso8859-1.enc delete mode 100644 library/encoding/iso8859-10.enc delete mode 100644 library/encoding/iso8859-13.enc delete mode 100644 library/encoding/iso8859-14.enc delete mode 100644 library/encoding/iso8859-15.enc delete mode 100644 library/encoding/iso8859-16.enc delete mode 100644 library/encoding/iso8859-2.enc delete mode 100644 library/encoding/iso8859-3.enc delete mode 100644 library/encoding/iso8859-4.enc delete mode 100644 library/encoding/iso8859-5.enc delete mode 100644 library/encoding/iso8859-6.enc delete mode 100644 library/encoding/iso8859-7.enc delete mode 100644 library/encoding/iso8859-8.enc delete mode 100644 library/encoding/iso8859-9.enc delete mode 100644 library/encoding/jis0201.enc delete mode 100644 library/encoding/jis0208.enc delete mode 100644 library/encoding/jis0212.enc delete mode 100644 library/encoding/koi8-r.enc delete mode 100644 library/encoding/koi8-u.enc delete mode 100644 library/encoding/ksc5601.enc delete mode 100644 library/encoding/macCentEuro.enc delete mode 100644 library/encoding/macCroatian.enc delete mode 100644 library/encoding/macCyrillic.enc delete mode 100644 library/encoding/macDingbats.enc delete mode 100644 library/encoding/macGreek.enc delete mode 100644 library/encoding/macIceland.enc delete mode 100644 library/encoding/macJapan.enc delete mode 100644 library/encoding/macRoman.enc delete mode 100644 library/encoding/macRomania.enc delete mode 100644 library/encoding/macThai.enc delete mode 100644 library/encoding/macTurkish.enc delete mode 100644 library/encoding/macUkraine.enc delete mode 100644 library/encoding/shiftjis.enc delete mode 100644 library/encoding/symbol.enc delete mode 100644 library/encoding/tis-620.enc delete mode 100644 library/history.tcl delete mode 100644 library/http/http.tcl delete mode 100644 library/http/pkgIndex.tcl delete mode 100644 library/http1.0/http.tcl delete mode 100644 library/http1.0/pkgIndex.tcl delete mode 100644 library/init.tcl delete mode 100644 library/msgcat/msgcat.tcl delete mode 100644 library/msgcat/pkgIndex.tcl delete mode 100644 library/msgs/af.msg delete mode 100644 library/msgs/af_za.msg delete mode 100644 library/msgs/ar.msg delete mode 100644 library/msgs/ar_in.msg delete mode 100644 library/msgs/ar_jo.msg delete mode 100644 library/msgs/ar_lb.msg delete mode 100644 library/msgs/ar_sy.msg delete mode 100644 library/msgs/be.msg delete mode 100644 library/msgs/bg.msg delete mode 100644 library/msgs/bn.msg delete mode 100644 library/msgs/bn_in.msg delete mode 100644 library/msgs/ca.msg delete mode 100644 library/msgs/cs.msg delete mode 100644 library/msgs/da.msg delete mode 100644 library/msgs/de.msg delete mode 100644 library/msgs/de_at.msg delete mode 100644 library/msgs/de_be.msg delete mode 100644 library/msgs/el.msg delete mode 100644 library/msgs/en_au.msg delete mode 100644 library/msgs/en_be.msg delete mode 100644 library/msgs/en_bw.msg delete mode 100644 library/msgs/en_ca.msg delete mode 100644 library/msgs/en_gb.msg delete mode 100644 library/msgs/en_hk.msg delete mode 100644 library/msgs/en_ie.msg delete mode 100644 library/msgs/en_in.msg delete mode 100644 library/msgs/en_nz.msg delete mode 100644 library/msgs/en_ph.msg delete mode 100644 library/msgs/en_sg.msg delete mode 100644 library/msgs/en_za.msg delete mode 100644 library/msgs/en_zw.msg delete mode 100644 library/msgs/eo.msg delete mode 100644 library/msgs/es.msg delete mode 100644 library/msgs/es_ar.msg delete mode 100644 library/msgs/es_bo.msg delete mode 100644 library/msgs/es_cl.msg delete mode 100644 library/msgs/es_co.msg delete mode 100644 library/msgs/es_cr.msg delete mode 100644 library/msgs/es_do.msg delete mode 100644 library/msgs/es_ec.msg delete mode 100644 library/msgs/es_gt.msg delete mode 100644 library/msgs/es_hn.msg delete mode 100644 library/msgs/es_mx.msg delete mode 100644 library/msgs/es_ni.msg delete mode 100644 library/msgs/es_pa.msg delete mode 100644 library/msgs/es_pe.msg delete mode 100644 library/msgs/es_pr.msg delete mode 100644 library/msgs/es_py.msg delete mode 100644 library/msgs/es_sv.msg delete mode 100644 library/msgs/es_uy.msg delete mode 100644 library/msgs/es_ve.msg delete mode 100644 library/msgs/et.msg delete mode 100644 library/msgs/eu.msg delete mode 100644 library/msgs/eu_es.msg delete mode 100644 library/msgs/fa.msg delete mode 100644 library/msgs/fa_in.msg delete mode 100644 library/msgs/fa_ir.msg delete mode 100644 library/msgs/fi.msg delete mode 100644 library/msgs/fo.msg delete mode 100644 library/msgs/fo_fo.msg delete mode 100644 library/msgs/fr.msg delete mode 100644 library/msgs/fr_be.msg delete mode 100644 library/msgs/fr_ca.msg delete mode 100644 library/msgs/fr_ch.msg delete mode 100644 library/msgs/ga.msg delete mode 100644 library/msgs/ga_ie.msg delete mode 100644 library/msgs/gl.msg delete mode 100644 library/msgs/gl_es.msg delete mode 100644 library/msgs/gv.msg delete mode 100644 library/msgs/gv_gb.msg delete mode 100644 library/msgs/he.msg delete mode 100644 library/msgs/hi.msg delete mode 100644 library/msgs/hi_in.msg delete mode 100644 library/msgs/hr.msg delete mode 100644 library/msgs/hu.msg delete mode 100644 library/msgs/id.msg delete mode 100644 library/msgs/id_id.msg delete mode 100644 library/msgs/is.msg delete mode 100644 library/msgs/it.msg delete mode 100644 library/msgs/it_ch.msg delete mode 100644 library/msgs/ja.msg delete mode 100644 library/msgs/kl.msg delete mode 100644 library/msgs/kl_gl.msg delete mode 100644 library/msgs/ko.msg delete mode 100644 library/msgs/ko_kr.msg delete mode 100644 library/msgs/kok.msg delete mode 100644 library/msgs/kok_in.msg delete mode 100644 library/msgs/kw.msg delete mode 100644 library/msgs/kw_gb.msg delete mode 100644 library/msgs/lt.msg delete mode 100644 library/msgs/lv.msg delete mode 100644 library/msgs/mk.msg delete mode 100644 library/msgs/mr.msg delete mode 100644 library/msgs/mr_in.msg delete mode 100644 library/msgs/ms.msg delete mode 100644 library/msgs/ms_my.msg delete mode 100644 library/msgs/mt.msg delete mode 100644 library/msgs/nb.msg delete mode 100644 library/msgs/nl.msg delete mode 100644 library/msgs/nl_be.msg delete mode 100644 library/msgs/nn.msg delete mode 100644 library/msgs/pl.msg delete mode 100644 library/msgs/pt.msg delete mode 100644 library/msgs/pt_br.msg delete mode 100644 library/msgs/ro.msg delete mode 100644 library/msgs/ru.msg delete mode 100644 library/msgs/ru_ua.msg delete mode 100644 library/msgs/sh.msg delete mode 100644 library/msgs/sk.msg delete mode 100644 library/msgs/sl.msg delete mode 100644 library/msgs/sq.msg delete mode 100644 library/msgs/sr.msg delete mode 100644 library/msgs/sv.msg delete mode 100644 library/msgs/sw.msg delete mode 100644 library/msgs/ta.msg delete mode 100644 library/msgs/ta_in.msg delete mode 100644 library/msgs/te.msg delete mode 100644 library/msgs/te_in.msg delete mode 100644 library/msgs/th.msg delete mode 100644 library/msgs/tr.msg delete mode 100644 library/msgs/uk.msg delete mode 100644 library/msgs/vi.msg delete mode 100644 library/msgs/zh.msg delete mode 100644 library/msgs/zh_cn.msg delete mode 100644 library/msgs/zh_hk.msg delete mode 100644 library/msgs/zh_sg.msg delete mode 100644 library/msgs/zh_tw.msg delete mode 100644 library/opt/optparse.tcl delete mode 100644 library/opt/pkgIndex.tcl delete mode 100644 library/package.tcl delete mode 100644 library/parray.tcl delete mode 100644 library/platform/pkgIndex.tcl delete mode 100644 library/platform/platform.tcl delete mode 100644 library/platform/shell.tcl delete mode 100755 library/reg/pkgIndex.tcl delete mode 100644 library/safe.tcl delete mode 100644 library/tclIndex delete mode 100644 library/tcltest/pkgIndex.tcl delete mode 100644 library/tcltest/tcltest.tcl delete mode 100644 library/tm.tcl delete mode 100644 library/tzdata/Africa/Abidjan delete mode 100644 library/tzdata/Africa/Accra delete mode 100644 library/tzdata/Africa/Addis_Ababa delete mode 100644 library/tzdata/Africa/Algiers delete mode 100644 library/tzdata/Africa/Asmara delete mode 100644 library/tzdata/Africa/Asmera delete mode 100644 library/tzdata/Africa/Bamako delete mode 100644 library/tzdata/Africa/Bangui delete mode 100644 library/tzdata/Africa/Banjul delete mode 100644 library/tzdata/Africa/Bissau delete mode 100644 library/tzdata/Africa/Blantyre delete mode 100644 library/tzdata/Africa/Brazzaville delete mode 100644 library/tzdata/Africa/Bujumbura delete mode 100644 library/tzdata/Africa/Cairo delete mode 100644 library/tzdata/Africa/Casablanca delete mode 100644 library/tzdata/Africa/Ceuta delete mode 100644 library/tzdata/Africa/Conakry delete mode 100644 library/tzdata/Africa/Dakar delete mode 100644 library/tzdata/Africa/Dar_es_Salaam delete mode 100644 library/tzdata/Africa/Djibouti delete mode 100644 library/tzdata/Africa/Douala delete mode 100644 library/tzdata/Africa/El_Aaiun delete mode 100644 library/tzdata/Africa/Freetown delete mode 100644 library/tzdata/Africa/Gaborone delete mode 100644 library/tzdata/Africa/Harare delete mode 100644 library/tzdata/Africa/Johannesburg delete mode 100644 library/tzdata/Africa/Juba delete mode 100644 library/tzdata/Africa/Kampala delete mode 100644 library/tzdata/Africa/Khartoum delete mode 100644 library/tzdata/Africa/Kigali delete mode 100644 library/tzdata/Africa/Kinshasa delete mode 100644 library/tzdata/Africa/Lagos delete mode 100644 library/tzdata/Africa/Libreville delete mode 100644 library/tzdata/Africa/Lome delete mode 100644 library/tzdata/Africa/Luanda delete mode 100644 library/tzdata/Africa/Lubumbashi delete mode 100644 library/tzdata/Africa/Lusaka delete mode 100644 library/tzdata/Africa/Malabo delete mode 100644 library/tzdata/Africa/Maputo delete mode 100644 library/tzdata/Africa/Maseru delete mode 100644 library/tzdata/Africa/Mbabane delete mode 100644 library/tzdata/Africa/Mogadishu delete mode 100644 library/tzdata/Africa/Monrovia delete mode 100644 library/tzdata/Africa/Nairobi delete mode 100644 library/tzdata/Africa/Ndjamena delete mode 100644 library/tzdata/Africa/Niamey delete mode 100644 library/tzdata/Africa/Nouakchott delete mode 100644 library/tzdata/Africa/Ouagadougou delete mode 100644 library/tzdata/Africa/Porto-Novo delete mode 100644 library/tzdata/Africa/Sao_Tome delete mode 100644 library/tzdata/Africa/Timbuktu delete mode 100644 library/tzdata/Africa/Tripoli delete mode 100644 library/tzdata/Africa/Tunis delete mode 100644 library/tzdata/Africa/Windhoek delete mode 100644 library/tzdata/America/Adak delete mode 100644 library/tzdata/America/Anchorage delete mode 100644 library/tzdata/America/Anguilla delete mode 100644 library/tzdata/America/Antigua delete mode 100644 library/tzdata/America/Araguaina delete mode 100644 library/tzdata/America/Argentina/Buenos_Aires delete mode 100644 library/tzdata/America/Argentina/Catamarca delete mode 100644 library/tzdata/America/Argentina/ComodRivadavia delete mode 100644 library/tzdata/America/Argentina/Cordoba delete mode 100644 library/tzdata/America/Argentina/Jujuy delete mode 100644 library/tzdata/America/Argentina/La_Rioja delete mode 100644 library/tzdata/America/Argentina/Mendoza delete mode 100644 library/tzdata/America/Argentina/Rio_Gallegos delete mode 100644 library/tzdata/America/Argentina/Salta delete mode 100644 library/tzdata/America/Argentina/San_Juan delete mode 100644 library/tzdata/America/Argentina/San_Luis delete mode 100644 library/tzdata/America/Argentina/Tucuman delete mode 100644 library/tzdata/America/Argentina/Ushuaia delete mode 100644 library/tzdata/America/Aruba delete mode 100644 library/tzdata/America/Asuncion delete mode 100644 library/tzdata/America/Atikokan delete mode 100644 library/tzdata/America/Atka delete mode 100644 library/tzdata/America/Bahia delete mode 100644 library/tzdata/America/Bahia_Banderas delete mode 100644 library/tzdata/America/Barbados delete mode 100644 library/tzdata/America/Belem delete mode 100644 library/tzdata/America/Belize delete mode 100644 library/tzdata/America/Blanc-Sablon delete mode 100644 library/tzdata/America/Boa_Vista delete mode 100644 library/tzdata/America/Bogota delete mode 100644 library/tzdata/America/Boise delete mode 100644 library/tzdata/America/Buenos_Aires delete mode 100644 library/tzdata/America/Cambridge_Bay delete mode 100644 library/tzdata/America/Campo_Grande delete mode 100644 library/tzdata/America/Cancun delete mode 100644 library/tzdata/America/Caracas delete mode 100644 library/tzdata/America/Catamarca delete mode 100644 library/tzdata/America/Cayenne delete mode 100644 library/tzdata/America/Cayman delete mode 100644 library/tzdata/America/Chicago delete mode 100644 library/tzdata/America/Chihuahua delete mode 100644 library/tzdata/America/Coral_Harbour delete mode 100644 library/tzdata/America/Cordoba delete mode 100644 library/tzdata/America/Costa_Rica delete mode 100644 library/tzdata/America/Creston delete mode 100644 library/tzdata/America/Cuiaba delete mode 100644 library/tzdata/America/Curacao delete mode 100644 library/tzdata/America/Danmarkshavn delete mode 100644 library/tzdata/America/Dawson delete mode 100644 library/tzdata/America/Dawson_Creek delete mode 100644 library/tzdata/America/Denver delete mode 100644 library/tzdata/America/Detroit delete mode 100644 library/tzdata/America/Dominica delete mode 100644 library/tzdata/America/Edmonton delete mode 100644 library/tzdata/America/Eirunepe delete mode 100644 library/tzdata/America/El_Salvador delete mode 100644 library/tzdata/America/Ensenada delete mode 100644 library/tzdata/America/Fort_Nelson delete mode 100644 library/tzdata/America/Fort_Wayne delete mode 100644 library/tzdata/America/Fortaleza delete mode 100644 library/tzdata/America/Glace_Bay delete mode 100644 library/tzdata/America/Godthab delete mode 100644 library/tzdata/America/Goose_Bay delete mode 100644 library/tzdata/America/Grand_Turk delete mode 100644 library/tzdata/America/Grenada delete mode 100644 library/tzdata/America/Guadeloupe delete mode 100644 library/tzdata/America/Guatemala delete mode 100644 library/tzdata/America/Guayaquil delete mode 100644 library/tzdata/America/Guyana delete mode 100644 library/tzdata/America/Halifax delete mode 100644 library/tzdata/America/Havana delete mode 100644 library/tzdata/America/Hermosillo delete mode 100644 library/tzdata/America/Indiana/Indianapolis delete mode 100644 library/tzdata/America/Indiana/Knox delete mode 100644 library/tzdata/America/Indiana/Marengo delete mode 100644 library/tzdata/America/Indiana/Petersburg delete mode 100644 library/tzdata/America/Indiana/Tell_City delete mode 100644 library/tzdata/America/Indiana/Vevay delete mode 100644 library/tzdata/America/Indiana/Vincennes delete mode 100644 library/tzdata/America/Indiana/Winamac delete mode 100644 library/tzdata/America/Indianapolis delete mode 100644 library/tzdata/America/Inuvik delete mode 100644 library/tzdata/America/Iqaluit delete mode 100644 library/tzdata/America/Jamaica delete mode 100644 library/tzdata/America/Jujuy delete mode 100644 library/tzdata/America/Juneau delete mode 100644 library/tzdata/America/Kentucky/Louisville delete mode 100644 library/tzdata/America/Kentucky/Monticello delete mode 100644 library/tzdata/America/Knox_IN delete mode 100644 library/tzdata/America/Kralendijk delete mode 100644 library/tzdata/America/La_Paz delete mode 100644 library/tzdata/America/Lima delete mode 100644 library/tzdata/America/Los_Angeles delete mode 100644 library/tzdata/America/Louisville delete mode 100644 library/tzdata/America/Lower_Princes delete mode 100644 library/tzdata/America/Maceio delete mode 100644 library/tzdata/America/Managua delete mode 100644 library/tzdata/America/Manaus delete mode 100644 library/tzdata/America/Marigot delete mode 100644 library/tzdata/America/Martinique delete mode 100644 library/tzdata/America/Matamoros delete mode 100644 library/tzdata/America/Mazatlan delete mode 100644 library/tzdata/America/Mendoza delete mode 100644 library/tzdata/America/Menominee delete mode 100644 library/tzdata/America/Merida delete mode 100644 library/tzdata/America/Metlakatla delete mode 100644 library/tzdata/America/Mexico_City delete mode 100644 library/tzdata/America/Miquelon delete mode 100644 library/tzdata/America/Moncton delete mode 100644 library/tzdata/America/Monterrey delete mode 100644 library/tzdata/America/Montevideo delete mode 100644 library/tzdata/America/Montreal delete mode 100644 library/tzdata/America/Montserrat delete mode 100644 library/tzdata/America/Nassau delete mode 100644 library/tzdata/America/New_York delete mode 100644 library/tzdata/America/Nipigon delete mode 100644 library/tzdata/America/Nome delete mode 100644 library/tzdata/America/Noronha delete mode 100644 library/tzdata/America/North_Dakota/Beulah delete mode 100644 library/tzdata/America/North_Dakota/Center delete mode 100644 library/tzdata/America/North_Dakota/New_Salem delete mode 100644 library/tzdata/America/Ojinaga delete mode 100644 library/tzdata/America/Panama delete mode 100644 library/tzdata/America/Pangnirtung delete mode 100644 library/tzdata/America/Paramaribo delete mode 100644 library/tzdata/America/Phoenix delete mode 100644 library/tzdata/America/Port-au-Prince delete mode 100644 library/tzdata/America/Port_of_Spain delete mode 100644 library/tzdata/America/Porto_Acre delete mode 100644 library/tzdata/America/Porto_Velho delete mode 100644 library/tzdata/America/Puerto_Rico delete mode 100644 library/tzdata/America/Punta_Arenas delete mode 100644 library/tzdata/America/Rainy_River delete mode 100644 library/tzdata/America/Rankin_Inlet delete mode 100644 library/tzdata/America/Recife delete mode 100644 library/tzdata/America/Regina delete mode 100644 library/tzdata/America/Resolute delete mode 100644 library/tzdata/America/Rio_Branco delete mode 100644 library/tzdata/America/Rosario delete mode 100644 library/tzdata/America/Santa_Isabel delete mode 100644 library/tzdata/America/Santarem delete mode 100644 library/tzdata/America/Santiago delete mode 100644 library/tzdata/America/Santo_Domingo delete mode 100644 library/tzdata/America/Sao_Paulo delete mode 100644 library/tzdata/America/Scoresbysund delete mode 100644 library/tzdata/America/Shiprock delete mode 100644 library/tzdata/America/Sitka delete mode 100644 library/tzdata/America/St_Barthelemy delete mode 100644 library/tzdata/America/St_Johns delete mode 100644 library/tzdata/America/St_Kitts delete mode 100644 library/tzdata/America/St_Lucia delete mode 100644 library/tzdata/America/St_Thomas delete mode 100644 library/tzdata/America/St_Vincent delete mode 100644 library/tzdata/America/Swift_Current delete mode 100644 library/tzdata/America/Tegucigalpa delete mode 100644 library/tzdata/America/Thule delete mode 100644 library/tzdata/America/Thunder_Bay delete mode 100644 library/tzdata/America/Tijuana delete mode 100644 library/tzdata/America/Toronto delete mode 100644 library/tzdata/America/Tortola delete mode 100644 library/tzdata/America/Vancouver delete mode 100644 library/tzdata/America/Virgin delete mode 100644 library/tzdata/America/Whitehorse delete mode 100644 library/tzdata/America/Winnipeg delete mode 100644 library/tzdata/America/Yakutat delete mode 100644 library/tzdata/America/Yellowknife delete mode 100644 library/tzdata/Antarctica/Casey delete mode 100644 library/tzdata/Antarctica/Davis delete mode 100644 library/tzdata/Antarctica/DumontDUrville delete mode 100644 library/tzdata/Antarctica/Macquarie delete mode 100644 library/tzdata/Antarctica/Mawson delete mode 100644 library/tzdata/Antarctica/McMurdo delete mode 100644 library/tzdata/Antarctica/Palmer delete mode 100644 library/tzdata/Antarctica/Rothera delete mode 100644 library/tzdata/Antarctica/South_Pole delete mode 100644 library/tzdata/Antarctica/Syowa delete mode 100644 library/tzdata/Antarctica/Troll delete mode 100644 library/tzdata/Antarctica/Vostok delete mode 100644 library/tzdata/Arctic/Longyearbyen delete mode 100644 library/tzdata/Asia/Aden delete mode 100644 library/tzdata/Asia/Almaty delete mode 100644 library/tzdata/Asia/Amman delete mode 100644 library/tzdata/Asia/Anadyr delete mode 100644 library/tzdata/Asia/Aqtau delete mode 100644 library/tzdata/Asia/Aqtobe delete mode 100644 library/tzdata/Asia/Ashgabat delete mode 100644 library/tzdata/Asia/Ashkhabad delete mode 100644 library/tzdata/Asia/Atyrau delete mode 100644 library/tzdata/Asia/Baghdad delete mode 100644 library/tzdata/Asia/Bahrain delete mode 100644 library/tzdata/Asia/Baku delete mode 100644 library/tzdata/Asia/Bangkok delete mode 100644 library/tzdata/Asia/Barnaul delete mode 100644 library/tzdata/Asia/Beirut delete mode 100644 library/tzdata/Asia/Bishkek delete mode 100644 library/tzdata/Asia/Brunei delete mode 100644 library/tzdata/Asia/Calcutta delete mode 100644 library/tzdata/Asia/Chita delete mode 100644 library/tzdata/Asia/Choibalsan delete mode 100644 library/tzdata/Asia/Chongqing delete mode 100644 library/tzdata/Asia/Chungking delete mode 100644 library/tzdata/Asia/Colombo delete mode 100644 library/tzdata/Asia/Dacca delete mode 100644 library/tzdata/Asia/Damascus delete mode 100644 library/tzdata/Asia/Dhaka delete mode 100644 library/tzdata/Asia/Dili delete mode 100644 library/tzdata/Asia/Dubai delete mode 100644 library/tzdata/Asia/Dushanbe delete mode 100644 library/tzdata/Asia/Famagusta delete mode 100644 library/tzdata/Asia/Gaza delete mode 100644 library/tzdata/Asia/Harbin delete mode 100644 library/tzdata/Asia/Hebron delete mode 100644 library/tzdata/Asia/Ho_Chi_Minh delete mode 100644 library/tzdata/Asia/Hong_Kong delete mode 100644 library/tzdata/Asia/Hovd delete mode 100644 library/tzdata/Asia/Irkutsk delete mode 100644 library/tzdata/Asia/Istanbul delete mode 100644 library/tzdata/Asia/Jakarta delete mode 100644 library/tzdata/Asia/Jayapura delete mode 100644 library/tzdata/Asia/Jerusalem delete mode 100644 library/tzdata/Asia/Kabul delete mode 100644 library/tzdata/Asia/Kamchatka delete mode 100644 library/tzdata/Asia/Karachi delete mode 100644 library/tzdata/Asia/Kashgar delete mode 100644 library/tzdata/Asia/Kathmandu delete mode 100644 library/tzdata/Asia/Katmandu delete mode 100644 library/tzdata/Asia/Khandyga delete mode 100644 library/tzdata/Asia/Kolkata delete mode 100644 library/tzdata/Asia/Krasnoyarsk delete mode 100644 library/tzdata/Asia/Kuala_Lumpur delete mode 100644 library/tzdata/Asia/Kuching delete mode 100644 library/tzdata/Asia/Kuwait delete mode 100644 library/tzdata/Asia/Macao delete mode 100644 library/tzdata/Asia/Macau delete mode 100644 library/tzdata/Asia/Magadan delete mode 100644 library/tzdata/Asia/Makassar delete mode 100644 library/tzdata/Asia/Manila delete mode 100644 library/tzdata/Asia/Muscat delete mode 100644 library/tzdata/Asia/Nicosia delete mode 100644 library/tzdata/Asia/Novokuznetsk delete mode 100644 library/tzdata/Asia/Novosibirsk delete mode 100644 library/tzdata/Asia/Omsk delete mode 100644 library/tzdata/Asia/Oral delete mode 100644 library/tzdata/Asia/Phnom_Penh delete mode 100644 library/tzdata/Asia/Pontianak delete mode 100644 library/tzdata/Asia/Pyongyang delete mode 100644 library/tzdata/Asia/Qatar delete mode 100644 library/tzdata/Asia/Qyzylorda delete mode 100644 library/tzdata/Asia/Rangoon delete mode 100644 library/tzdata/Asia/Riyadh delete mode 100644 library/tzdata/Asia/Saigon delete mode 100644 library/tzdata/Asia/Sakhalin delete mode 100644 library/tzdata/Asia/Samarkand delete mode 100644 library/tzdata/Asia/Seoul delete mode 100644 library/tzdata/Asia/Shanghai delete mode 100644 library/tzdata/Asia/Singapore delete mode 100644 library/tzdata/Asia/Srednekolymsk delete mode 100644 library/tzdata/Asia/Taipei delete mode 100644 library/tzdata/Asia/Tashkent delete mode 100644 library/tzdata/Asia/Tbilisi delete mode 100644 library/tzdata/Asia/Tehran delete mode 100644 library/tzdata/Asia/Tel_Aviv delete mode 100644 library/tzdata/Asia/Thimbu delete mode 100644 library/tzdata/Asia/Thimphu delete mode 100644 library/tzdata/Asia/Tokyo delete mode 100644 library/tzdata/Asia/Tomsk delete mode 100644 library/tzdata/Asia/Ujung_Pandang delete mode 100644 library/tzdata/Asia/Ulaanbaatar delete mode 100644 library/tzdata/Asia/Ulan_Bator delete mode 100644 library/tzdata/Asia/Urumqi delete mode 100644 library/tzdata/Asia/Ust-Nera delete mode 100644 library/tzdata/Asia/Vientiane delete mode 100644 library/tzdata/Asia/Vladivostok delete mode 100644 library/tzdata/Asia/Yakutsk delete mode 100644 library/tzdata/Asia/Yangon delete mode 100644 library/tzdata/Asia/Yekaterinburg delete mode 100644 library/tzdata/Asia/Yerevan delete mode 100644 library/tzdata/Atlantic/Azores delete mode 100644 library/tzdata/Atlantic/Bermuda delete mode 100644 library/tzdata/Atlantic/Canary delete mode 100644 library/tzdata/Atlantic/Cape_Verde delete mode 100644 library/tzdata/Atlantic/Faeroe delete mode 100644 library/tzdata/Atlantic/Faroe delete mode 100644 library/tzdata/Atlantic/Jan_Mayen delete mode 100644 library/tzdata/Atlantic/Madeira delete mode 100644 library/tzdata/Atlantic/Reykjavik delete mode 100644 library/tzdata/Atlantic/South_Georgia delete mode 100644 library/tzdata/Atlantic/St_Helena delete mode 100644 library/tzdata/Atlantic/Stanley delete mode 100644 library/tzdata/Australia/ACT delete mode 100644 library/tzdata/Australia/Adelaide delete mode 100644 library/tzdata/Australia/Brisbane delete mode 100644 library/tzdata/Australia/Broken_Hill delete mode 100644 library/tzdata/Australia/Canberra delete mode 100644 library/tzdata/Australia/Currie delete mode 100644 library/tzdata/Australia/Darwin delete mode 100644 library/tzdata/Australia/Eucla delete mode 100644 library/tzdata/Australia/Hobart delete mode 100644 library/tzdata/Australia/LHI delete mode 100644 library/tzdata/Australia/Lindeman delete mode 100644 library/tzdata/Australia/Lord_Howe delete mode 100644 library/tzdata/Australia/Melbourne delete mode 100644 library/tzdata/Australia/NSW delete mode 100644 library/tzdata/Australia/North delete mode 100644 library/tzdata/Australia/Perth delete mode 100644 library/tzdata/Australia/Queensland delete mode 100644 library/tzdata/Australia/South delete mode 100644 library/tzdata/Australia/Sydney delete mode 100644 library/tzdata/Australia/Tasmania delete mode 100644 library/tzdata/Australia/Victoria delete mode 100644 library/tzdata/Australia/West delete mode 100644 library/tzdata/Australia/Yancowinna delete mode 100644 library/tzdata/Brazil/Acre delete mode 100644 library/tzdata/Brazil/DeNoronha delete mode 100644 library/tzdata/Brazil/East delete mode 100644 library/tzdata/Brazil/West delete mode 100644 library/tzdata/CET delete mode 100644 library/tzdata/CST6CDT delete mode 100644 library/tzdata/Canada/Atlantic delete mode 100644 library/tzdata/Canada/Central delete mode 100644 library/tzdata/Canada/East-Saskatchewan delete mode 100644 library/tzdata/Canada/Eastern delete mode 100644 library/tzdata/Canada/Mountain delete mode 100644 library/tzdata/Canada/Newfoundland delete mode 100644 library/tzdata/Canada/Pacific delete mode 100644 library/tzdata/Canada/Saskatchewan delete mode 100644 library/tzdata/Canada/Yukon delete mode 100644 library/tzdata/Chile/Continental delete mode 100644 library/tzdata/Chile/EasterIsland delete mode 100644 library/tzdata/Cuba delete mode 100644 library/tzdata/EET delete mode 100644 library/tzdata/EST delete mode 100644 library/tzdata/EST5EDT delete mode 100644 library/tzdata/Egypt delete mode 100644 library/tzdata/Eire delete mode 100644 library/tzdata/Etc/GMT delete mode 100644 library/tzdata/Etc/GMT+0 delete mode 100644 library/tzdata/Etc/GMT+1 delete mode 100644 library/tzdata/Etc/GMT+10 delete mode 100644 library/tzdata/Etc/GMT+11 delete mode 100644 library/tzdata/Etc/GMT+12 delete mode 100644 library/tzdata/Etc/GMT+2 delete mode 100644 library/tzdata/Etc/GMT+3 delete mode 100644 library/tzdata/Etc/GMT+4 delete mode 100644 library/tzdata/Etc/GMT+5 delete mode 100644 library/tzdata/Etc/GMT+6 delete mode 100644 library/tzdata/Etc/GMT+7 delete mode 100644 library/tzdata/Etc/GMT+8 delete mode 100644 library/tzdata/Etc/GMT+9 delete mode 100644 library/tzdata/Etc/GMT-0 delete mode 100644 library/tzdata/Etc/GMT-1 delete mode 100644 library/tzdata/Etc/GMT-10 delete mode 100644 library/tzdata/Etc/GMT-11 delete mode 100644 library/tzdata/Etc/GMT-12 delete mode 100644 library/tzdata/Etc/GMT-13 delete mode 100644 library/tzdata/Etc/GMT-14 delete mode 100644 library/tzdata/Etc/GMT-2 delete mode 100644 library/tzdata/Etc/GMT-3 delete mode 100644 library/tzdata/Etc/GMT-4 delete mode 100644 library/tzdata/Etc/GMT-5 delete mode 100644 library/tzdata/Etc/GMT-6 delete mode 100644 library/tzdata/Etc/GMT-7 delete mode 100644 library/tzdata/Etc/GMT-8 delete mode 100644 library/tzdata/Etc/GMT-9 delete mode 100644 library/tzdata/Etc/GMT0 delete mode 100644 library/tzdata/Etc/Greenwich delete mode 100644 library/tzdata/Etc/UCT delete mode 100644 library/tzdata/Etc/UTC delete mode 100644 library/tzdata/Etc/Universal delete mode 100644 library/tzdata/Etc/Zulu delete mode 100644 library/tzdata/Europe/Amsterdam delete mode 100644 library/tzdata/Europe/Andorra delete mode 100644 library/tzdata/Europe/Astrakhan delete mode 100644 library/tzdata/Europe/Athens delete mode 100644 library/tzdata/Europe/Belfast delete mode 100644 library/tzdata/Europe/Belgrade delete mode 100644 library/tzdata/Europe/Berlin delete mode 100644 library/tzdata/Europe/Bratislava delete mode 100644 library/tzdata/Europe/Brussels delete mode 100644 library/tzdata/Europe/Bucharest delete mode 100644 library/tzdata/Europe/Budapest delete mode 100644 library/tzdata/Europe/Busingen delete mode 100644 library/tzdata/Europe/Chisinau delete mode 100644 library/tzdata/Europe/Copenhagen delete mode 100644 library/tzdata/Europe/Dublin delete mode 100644 library/tzdata/Europe/Gibraltar delete mode 100644 library/tzdata/Europe/Guernsey delete mode 100644 library/tzdata/Europe/Helsinki delete mode 100644 library/tzdata/Europe/Isle_of_Man delete mode 100644 library/tzdata/Europe/Istanbul delete mode 100644 library/tzdata/Europe/Jersey delete mode 100644 library/tzdata/Europe/Kaliningrad delete mode 100644 library/tzdata/Europe/Kiev delete mode 100644 library/tzdata/Europe/Kirov delete mode 100644 library/tzdata/Europe/Lisbon delete mode 100644 library/tzdata/Europe/Ljubljana delete mode 100644 library/tzdata/Europe/London delete mode 100644 library/tzdata/Europe/Luxembourg delete mode 100644 library/tzdata/Europe/Madrid delete mode 100644 library/tzdata/Europe/Malta delete mode 100644 library/tzdata/Europe/Mariehamn delete mode 100644 library/tzdata/Europe/Minsk delete mode 100644 library/tzdata/Europe/Monaco delete mode 100644 library/tzdata/Europe/Moscow delete mode 100644 library/tzdata/Europe/Nicosia delete mode 100644 library/tzdata/Europe/Oslo delete mode 100644 library/tzdata/Europe/Paris delete mode 100644 library/tzdata/Europe/Podgorica delete mode 100644 library/tzdata/Europe/Prague delete mode 100644 library/tzdata/Europe/Riga delete mode 100644 library/tzdata/Europe/Rome delete mode 100644 library/tzdata/Europe/Samara delete mode 100644 library/tzdata/Europe/San_Marino delete mode 100644 library/tzdata/Europe/Sarajevo delete mode 100644 library/tzdata/Europe/Saratov delete mode 100644 library/tzdata/Europe/Simferopol delete mode 100644 library/tzdata/Europe/Skopje delete mode 100644 library/tzdata/Europe/Sofia delete mode 100644 library/tzdata/Europe/Stockholm delete mode 100644 library/tzdata/Europe/Tallinn delete mode 100644 library/tzdata/Europe/Tirane delete mode 100644 library/tzdata/Europe/Tiraspol delete mode 100644 library/tzdata/Europe/Ulyanovsk delete mode 100644 library/tzdata/Europe/Uzhgorod delete mode 100644 library/tzdata/Europe/Vaduz delete mode 100644 library/tzdata/Europe/Vatican delete mode 100644 library/tzdata/Europe/Vienna delete mode 100644 library/tzdata/Europe/Vilnius delete mode 100644 library/tzdata/Europe/Volgograd delete mode 100644 library/tzdata/Europe/Warsaw delete mode 100644 library/tzdata/Europe/Zagreb delete mode 100644 library/tzdata/Europe/Zaporozhye delete mode 100644 library/tzdata/Europe/Zurich delete mode 100644 library/tzdata/GB delete mode 100644 library/tzdata/GB-Eire delete mode 100644 library/tzdata/GMT delete mode 100644 library/tzdata/GMT+0 delete mode 100644 library/tzdata/GMT-0 delete mode 100644 library/tzdata/GMT0 delete mode 100644 library/tzdata/Greenwich delete mode 100644 library/tzdata/HST delete mode 100644 library/tzdata/Hongkong delete mode 100644 library/tzdata/Iceland delete mode 100644 library/tzdata/Indian/Antananarivo delete mode 100644 library/tzdata/Indian/Chagos delete mode 100644 library/tzdata/Indian/Christmas delete mode 100644 library/tzdata/Indian/Cocos delete mode 100644 library/tzdata/Indian/Comoro delete mode 100644 library/tzdata/Indian/Kerguelen delete mode 100644 library/tzdata/Indian/Mahe delete mode 100644 library/tzdata/Indian/Maldives delete mode 100644 library/tzdata/Indian/Mauritius delete mode 100644 library/tzdata/Indian/Mayotte delete mode 100644 library/tzdata/Indian/Reunion delete mode 100644 library/tzdata/Iran delete mode 100644 library/tzdata/Israel delete mode 100644 library/tzdata/Jamaica delete mode 100644 library/tzdata/Japan delete mode 100644 library/tzdata/Kwajalein delete mode 100644 library/tzdata/Libya delete mode 100644 library/tzdata/MET delete mode 100644 library/tzdata/MST delete mode 100644 library/tzdata/MST7MDT delete mode 100644 library/tzdata/Mexico/BajaNorte delete mode 100644 library/tzdata/Mexico/BajaSur delete mode 100644 library/tzdata/Mexico/General delete mode 100644 library/tzdata/NZ delete mode 100644 library/tzdata/NZ-CHAT delete mode 100644 library/tzdata/Navajo delete mode 100644 library/tzdata/PRC delete mode 100644 library/tzdata/PST8PDT delete mode 100644 library/tzdata/Pacific/Apia delete mode 100644 library/tzdata/Pacific/Auckland delete mode 100644 library/tzdata/Pacific/Bougainville delete mode 100644 library/tzdata/Pacific/Chatham delete mode 100644 library/tzdata/Pacific/Chuuk delete mode 100644 library/tzdata/Pacific/Easter delete mode 100644 library/tzdata/Pacific/Efate delete mode 100644 library/tzdata/Pacific/Enderbury delete mode 100644 library/tzdata/Pacific/Fakaofo delete mode 100644 library/tzdata/Pacific/Fiji delete mode 100644 library/tzdata/Pacific/Funafuti delete mode 100644 library/tzdata/Pacific/Galapagos delete mode 100644 library/tzdata/Pacific/Gambier delete mode 100644 library/tzdata/Pacific/Guadalcanal delete mode 100644 library/tzdata/Pacific/Guam delete mode 100644 library/tzdata/Pacific/Honolulu delete mode 100644 library/tzdata/Pacific/Johnston delete mode 100644 library/tzdata/Pacific/Kiritimati delete mode 100644 library/tzdata/Pacific/Kosrae delete mode 100644 library/tzdata/Pacific/Kwajalein delete mode 100644 library/tzdata/Pacific/Majuro delete mode 100644 library/tzdata/Pacific/Marquesas delete mode 100644 library/tzdata/Pacific/Midway delete mode 100644 library/tzdata/Pacific/Nauru delete mode 100644 library/tzdata/Pacific/Niue delete mode 100644 library/tzdata/Pacific/Norfolk delete mode 100644 library/tzdata/Pacific/Noumea delete mode 100644 library/tzdata/Pacific/Pago_Pago delete mode 100644 library/tzdata/Pacific/Palau delete mode 100644 library/tzdata/Pacific/Pitcairn delete mode 100644 library/tzdata/Pacific/Pohnpei delete mode 100644 library/tzdata/Pacific/Ponape delete mode 100644 library/tzdata/Pacific/Port_Moresby delete mode 100644 library/tzdata/Pacific/Rarotonga delete mode 100644 library/tzdata/Pacific/Saipan delete mode 100644 library/tzdata/Pacific/Samoa delete mode 100644 library/tzdata/Pacific/Tahiti delete mode 100644 library/tzdata/Pacific/Tarawa delete mode 100644 library/tzdata/Pacific/Tongatapu delete mode 100644 library/tzdata/Pacific/Truk delete mode 100644 library/tzdata/Pacific/Wake delete mode 100644 library/tzdata/Pacific/Wallis delete mode 100644 library/tzdata/Pacific/Yap delete mode 100644 library/tzdata/Poland delete mode 100644 library/tzdata/Portugal delete mode 100644 library/tzdata/ROC delete mode 100644 library/tzdata/ROK delete mode 100644 library/tzdata/Singapore delete mode 100644 library/tzdata/SystemV/AST4 delete mode 100644 library/tzdata/SystemV/AST4ADT delete mode 100644 library/tzdata/SystemV/CST6 delete mode 100644 library/tzdata/SystemV/CST6CDT delete mode 100644 library/tzdata/SystemV/EST5 delete mode 100644 library/tzdata/SystemV/EST5EDT delete mode 100644 library/tzdata/SystemV/HST10 delete mode 100644 library/tzdata/SystemV/MST7 delete mode 100644 library/tzdata/SystemV/MST7MDT delete mode 100644 library/tzdata/SystemV/PST8 delete mode 100644 library/tzdata/SystemV/PST8PDT delete mode 100644 library/tzdata/SystemV/YST9 delete mode 100644 library/tzdata/SystemV/YST9YDT delete mode 100644 library/tzdata/Turkey delete mode 100644 library/tzdata/UCT delete mode 100644 library/tzdata/US/Alaska delete mode 100644 library/tzdata/US/Aleutian delete mode 100644 library/tzdata/US/Arizona delete mode 100644 library/tzdata/US/Central delete mode 100644 library/tzdata/US/East-Indiana delete mode 100644 library/tzdata/US/Eastern delete mode 100644 library/tzdata/US/Hawaii delete mode 100644 library/tzdata/US/Indiana-Starke delete mode 100644 library/tzdata/US/Michigan delete mode 100644 library/tzdata/US/Mountain delete mode 100644 library/tzdata/US/Pacific delete mode 100644 library/tzdata/US/Pacific-New delete mode 100644 library/tzdata/US/Samoa delete mode 100644 library/tzdata/UTC delete mode 100644 library/tzdata/Universal delete mode 100644 library/tzdata/W-SU delete mode 100644 library/tzdata/WET delete mode 100644 library/tzdata/Zulu delete mode 100644 library/word.tcl delete mode 100644 libtommath/LICENSE delete mode 100644 libtommath/README.md delete mode 100644 libtommath/astylerc delete mode 100644 libtommath/bn_error.c delete mode 100644 libtommath/bn_fast_mp_invmod.c delete mode 100644 libtommath/bn_fast_mp_montgomery_reduce.c delete mode 100644 libtommath/bn_fast_s_mp_mul_digs.c delete mode 100644 libtommath/bn_fast_s_mp_mul_high_digs.c delete mode 100644 libtommath/bn_fast_s_mp_sqr.c delete mode 100644 libtommath/bn_mp_2expt.c delete mode 100644 libtommath/bn_mp_abs.c delete mode 100644 libtommath/bn_mp_add.c delete mode 100644 libtommath/bn_mp_add_d.c delete mode 100644 libtommath/bn_mp_addmod.c delete mode 100644 libtommath/bn_mp_and.c delete mode 100644 libtommath/bn_mp_clamp.c delete mode 100644 libtommath/bn_mp_clear.c delete mode 100644 libtommath/bn_mp_clear_multi.c delete mode 100644 libtommath/bn_mp_cmp.c delete mode 100644 libtommath/bn_mp_cmp_d.c delete mode 100644 libtommath/bn_mp_cmp_mag.c delete mode 100644 libtommath/bn_mp_cnt_lsb.c delete mode 100644 libtommath/bn_mp_copy.c delete mode 100644 libtommath/bn_mp_count_bits.c delete mode 100644 libtommath/bn_mp_div.c delete mode 100644 libtommath/bn_mp_div_2.c delete mode 100644 libtommath/bn_mp_div_2d.c delete mode 100644 libtommath/bn_mp_div_3.c delete mode 100644 libtommath/bn_mp_div_d.c delete mode 100644 libtommath/bn_mp_dr_is_modulus.c delete mode 100644 libtommath/bn_mp_dr_reduce.c delete mode 100644 libtommath/bn_mp_dr_setup.c delete mode 100644 libtommath/bn_mp_exch.c delete mode 100644 libtommath/bn_mp_export.c delete mode 100644 libtommath/bn_mp_expt_d.c delete mode 100644 libtommath/bn_mp_expt_d_ex.c delete mode 100644 libtommath/bn_mp_exptmod.c delete mode 100644 libtommath/bn_mp_exptmod_fast.c delete mode 100644 libtommath/bn_mp_exteuclid.c delete mode 100644 libtommath/bn_mp_fread.c delete mode 100644 libtommath/bn_mp_fwrite.c delete mode 100644 libtommath/bn_mp_gcd.c delete mode 100644 libtommath/bn_mp_get_int.c delete mode 100644 libtommath/bn_mp_get_long.c delete mode 100644 libtommath/bn_mp_get_long_long.c delete mode 100644 libtommath/bn_mp_grow.c delete mode 100644 libtommath/bn_mp_import.c delete mode 100644 libtommath/bn_mp_init.c delete mode 100644 libtommath/bn_mp_init_copy.c delete mode 100644 libtommath/bn_mp_init_multi.c delete mode 100644 libtommath/bn_mp_init_set.c delete mode 100644 libtommath/bn_mp_init_set_int.c delete mode 100644 libtommath/bn_mp_init_size.c delete mode 100644 libtommath/bn_mp_invmod.c delete mode 100644 libtommath/bn_mp_invmod_slow.c delete mode 100644 libtommath/bn_mp_is_square.c delete mode 100644 libtommath/bn_mp_jacobi.c delete mode 100644 libtommath/bn_mp_karatsuba_mul.c delete mode 100644 libtommath/bn_mp_karatsuba_sqr.c delete mode 100644 libtommath/bn_mp_lcm.c delete mode 100644 libtommath/bn_mp_lshd.c delete mode 100644 libtommath/bn_mp_mod.c delete mode 100644 libtommath/bn_mp_mod_2d.c delete mode 100644 libtommath/bn_mp_mod_d.c delete mode 100644 libtommath/bn_mp_montgomery_calc_normalization.c delete mode 100644 libtommath/bn_mp_montgomery_reduce.c delete mode 100644 libtommath/bn_mp_montgomery_setup.c delete mode 100644 libtommath/bn_mp_mul.c delete mode 100644 libtommath/bn_mp_mul_2.c delete mode 100644 libtommath/bn_mp_mul_2d.c delete mode 100644 libtommath/bn_mp_mul_d.c delete mode 100644 libtommath/bn_mp_mulmod.c delete mode 100644 libtommath/bn_mp_n_root.c delete mode 100644 libtommath/bn_mp_n_root_ex.c delete mode 100644 libtommath/bn_mp_neg.c delete mode 100644 libtommath/bn_mp_or.c delete mode 100644 libtommath/bn_mp_prime_fermat.c delete mode 100644 libtommath/bn_mp_prime_is_divisible.c delete mode 100644 libtommath/bn_mp_prime_is_prime.c delete mode 100644 libtommath/bn_mp_prime_miller_rabin.c delete mode 100644 libtommath/bn_mp_prime_next_prime.c delete mode 100644 libtommath/bn_mp_prime_rabin_miller_trials.c delete mode 100644 libtommath/bn_mp_prime_random_ex.c delete mode 100644 libtommath/bn_mp_radix_size.c delete mode 100644 libtommath/bn_mp_radix_smap.c delete mode 100644 libtommath/bn_mp_rand.c delete mode 100644 libtommath/bn_mp_read_radix.c delete mode 100644 libtommath/bn_mp_read_signed_bin.c delete mode 100644 libtommath/bn_mp_read_unsigned_bin.c delete mode 100644 libtommath/bn_mp_reduce.c delete mode 100644 libtommath/bn_mp_reduce_2k.c delete mode 100644 libtommath/bn_mp_reduce_2k_l.c delete mode 100644 libtommath/bn_mp_reduce_2k_setup.c delete mode 100644 libtommath/bn_mp_reduce_2k_setup_l.c delete mode 100644 libtommath/bn_mp_reduce_is_2k.c delete mode 100644 libtommath/bn_mp_reduce_is_2k_l.c delete mode 100644 libtommath/bn_mp_reduce_setup.c delete mode 100644 libtommath/bn_mp_rshd.c delete mode 100644 libtommath/bn_mp_set.c delete mode 100644 libtommath/bn_mp_set_int.c delete mode 100644 libtommath/bn_mp_set_long.c delete mode 100644 libtommath/bn_mp_set_long_long.c delete mode 100644 libtommath/bn_mp_shrink.c delete mode 100644 libtommath/bn_mp_signed_bin_size.c delete mode 100644 libtommath/bn_mp_sqr.c delete mode 100644 libtommath/bn_mp_sqrmod.c delete mode 100644 libtommath/bn_mp_sqrt.c delete mode 100644 libtommath/bn_mp_sqrtmod_prime.c delete mode 100644 libtommath/bn_mp_sub.c delete mode 100644 libtommath/bn_mp_sub_d.c delete mode 100644 libtommath/bn_mp_submod.c delete mode 100644 libtommath/bn_mp_to_signed_bin.c delete mode 100644 libtommath/bn_mp_to_signed_bin_n.c delete mode 100644 libtommath/bn_mp_to_unsigned_bin.c delete mode 100644 libtommath/bn_mp_to_unsigned_bin_n.c delete mode 100644 libtommath/bn_mp_toom_mul.c delete mode 100644 libtommath/bn_mp_toom_sqr.c delete mode 100644 libtommath/bn_mp_toradix.c delete mode 100644 libtommath/bn_mp_toradix_n.c delete mode 100644 libtommath/bn_mp_unsigned_bin_size.c delete mode 100644 libtommath/bn_mp_xor.c delete mode 100644 libtommath/bn_mp_zero.c delete mode 100644 libtommath/bn_prime_tab.c delete mode 100644 libtommath/bn_reverse.c delete mode 100644 libtommath/bn_s_mp_add.c delete mode 100644 libtommath/bn_s_mp_exptmod.c delete mode 100644 libtommath/bn_s_mp_mul_digs.c delete mode 100644 libtommath/bn_s_mp_mul_high_digs.c delete mode 100644 libtommath/bn_s_mp_sqr.c delete mode 100644 libtommath/bn_s_mp_sub.c delete mode 100644 libtommath/bncore.c delete mode 100644 libtommath/callgraph.txt delete mode 100644 libtommath/changes.txt delete mode 100644 libtommath/libtommath.dsp delete mode 100644 libtommath/libtommath.pc.in delete mode 100644 libtommath/libtommath_VS2005.sln delete mode 100644 libtommath/libtommath_VS2005.vcproj delete mode 100644 libtommath/libtommath_VS2008.sln delete mode 100644 libtommath/libtommath_VS2008.vcproj delete mode 100644 libtommath/makefile delete mode 100644 libtommath/makefile.bcc delete mode 100644 libtommath/makefile.cygwin_dll delete mode 100644 libtommath/makefile.icc delete mode 100644 libtommath/makefile.msvc delete mode 100644 libtommath/makefile.shared delete mode 100644 libtommath/makefile_include.mk delete mode 100644 libtommath/tommath.h delete mode 100644 libtommath/tommath_class.h delete mode 100644 libtommath/tommath_private.h delete mode 100644 libtommath/tommath_superclass.h delete mode 100644 license.terms delete mode 100644 macosx/GNUmakefile delete mode 100644 macosx/README delete mode 100644 macosx/Tcl-Common.xcconfig delete mode 100644 macosx/Tcl-Debug.xcconfig delete mode 100644 macosx/Tcl-Info.plist.in delete mode 100644 macosx/Tcl-Release.xcconfig delete mode 100644 macosx/Tcl.xcode/default.pbxuser delete mode 100644 macosx/Tcl.xcode/project.pbxproj delete mode 100644 macosx/Tcl.xcodeproj/default.pbxuser delete mode 100644 macosx/Tcl.xcodeproj/project.pbxproj delete mode 100644 macosx/Tclsh-Info.plist.in delete mode 100644 macosx/configure.ac delete mode 100644 macosx/tclMacOSXBundle.c delete mode 100644 macosx/tclMacOSXFCmd.c delete mode 100644 macosx/tclMacOSXNotify.c delete mode 100644 pkgs/README delete mode 100644 pkgs/package.list.txt delete mode 100644 tests/README delete mode 100644 tests/aaa_exit.test delete mode 100644 tests/all.tcl delete mode 100644 tests/append.test delete mode 100644 tests/appendComp.test delete mode 100644 tests/apply.test delete mode 100644 tests/assemble.test delete mode 100644 tests/assemble1.bench delete mode 100644 tests/assocd.test delete mode 100644 tests/async.test delete mode 100644 tests/autoMkindex.test delete mode 100644 tests/basic.test delete mode 100644 tests/binary.test delete mode 100644 tests/case.test delete mode 100644 tests/chan.test delete mode 100644 tests/chanio.test delete mode 100644 tests/clock.test delete mode 100644 tests/cmdAH.test delete mode 100644 tests/cmdIL.test delete mode 100644 tests/cmdInfo.test delete mode 100644 tests/cmdMZ.test delete mode 100644 tests/compExpr-old.test delete mode 100644 tests/compExpr.test delete mode 100644 tests/compile.test delete mode 100644 tests/concat.test delete mode 100644 tests/config.test delete mode 100644 tests/coroutine.test delete mode 100644 tests/dcall.test delete mode 100644 tests/dict.test delete mode 100644 tests/dstring.test delete mode 100644 tests/encoding.test delete mode 100644 tests/env.test delete mode 100644 tests/error.test delete mode 100644 tests/eval.test delete mode 100644 tests/event.test delete mode 100644 tests/exec.test delete mode 100644 tests/execute.test delete mode 100644 tests/expr-old.test delete mode 100644 tests/expr.test delete mode 100644 tests/fCmd.test delete mode 100644 tests/fileName.test delete mode 100644 tests/fileSystem.test delete mode 100644 tests/for-old.test delete mode 100644 tests/for.test delete mode 100644 tests/foreach.test delete mode 100644 tests/format.test delete mode 100644 tests/get.test delete mode 100644 tests/history.test delete mode 100644 tests/http.test delete mode 100644 tests/http11.test delete mode 100644 tests/httpd delete mode 100644 tests/httpd11.tcl delete mode 100644 tests/httpold.test delete mode 100644 tests/if-old.test delete mode 100644 tests/if.test delete mode 100644 tests/incr-old.test delete mode 100644 tests/incr.test delete mode 100644 tests/indexObj.test delete mode 100644 tests/info.test delete mode 100644 tests/init.test delete mode 100644 tests/interp.test delete mode 100644 tests/io.test delete mode 100644 tests/ioCmd.test delete mode 100644 tests/ioTrans.test delete mode 100644 tests/iogt.test delete mode 100644 tests/join.test delete mode 100644 tests/lindex.test delete mode 100644 tests/link.test delete mode 100644 tests/linsert.test delete mode 100644 tests/list.test delete mode 100644 tests/listObj.test delete mode 100644 tests/llength.test delete mode 100644 tests/lmap.test delete mode 100644 tests/load.test delete mode 100644 tests/lrange.test delete mode 100644 tests/lrepeat.test delete mode 100644 tests/lreplace.test delete mode 100644 tests/lsearch.test delete mode 100644 tests/lset.test delete mode 100644 tests/lsetComp.test delete mode 100644 tests/macOSXFCmd.test delete mode 100644 tests/macOSXLoad.test delete mode 100644 tests/main.test delete mode 100644 tests/mathop.test delete mode 100644 tests/misc.test delete mode 100644 tests/msgcat.test delete mode 100644 tests/namespace-old.test delete mode 100644 tests/namespace.test delete mode 100644 tests/notify.test delete mode 100644 tests/nre.test delete mode 100644 tests/obj.test delete mode 100644 tests/oo.test delete mode 100644 tests/ooNext2.test delete mode 100644 tests/opt.test delete mode 100644 tests/package.test delete mode 100644 tests/parse.test delete mode 100644 tests/parseExpr.test delete mode 100644 tests/parseOld.test delete mode 100644 tests/pid.test delete mode 100644 tests/pkgMkIndex.test delete mode 100644 tests/platform.test delete mode 100644 tests/proc-old.test delete mode 100644 tests/proc.test delete mode 100644 tests/pwd.test delete mode 100644 tests/reg.test delete mode 100644 tests/regexp.test delete mode 100644 tests/regexpComp.test delete mode 100644 tests/registry.test delete mode 100644 tests/remote.tcl delete mode 100644 tests/rename.test delete mode 100644 tests/resolver.test delete mode 100644 tests/result.test delete mode 100644 tests/safe.test delete mode 100644 tests/scan.test delete mode 100644 tests/security.test delete mode 100644 tests/set-old.test delete mode 100644 tests/set.test delete mode 100644 tests/socket.test delete mode 100644 tests/source.test delete mode 100644 tests/split.test delete mode 100644 tests/stack.test delete mode 100644 tests/string.test delete mode 100644 tests/stringComp.test delete mode 100644 tests/stringObj.test delete mode 100644 tests/subst.test delete mode 100644 tests/switch.test delete mode 100644 tests/tailcall.test delete mode 100644 tests/tcltest.test delete mode 100644 tests/thread.test delete mode 100644 tests/timer.test delete mode 100644 tests/tm.test delete mode 100644 tests/trace.test delete mode 100644 tests/unixFCmd.test delete mode 100644 tests/unixFile.test delete mode 100644 tests/unixForkEvent.test delete mode 100644 tests/unixInit.test delete mode 100644 tests/unixNotfy.test delete mode 100644 tests/unknown.test delete mode 100644 tests/unload.test delete mode 100644 tests/uplevel.test delete mode 100644 tests/upvar.test delete mode 100644 tests/utf.test delete mode 100644 tests/util.test delete mode 100644 tests/var.test delete mode 100644 tests/while-old.test delete mode 100644 tests/while.test delete mode 100644 tests/winConsole.test delete mode 100644 tests/winDde.test delete mode 100644 tests/winFCmd.test delete mode 100644 tests/winFile.test delete mode 100644 tests/winNotify.test delete mode 100644 tests/winPipe.test delete mode 100644 tests/winTime.test delete mode 100644 tests/zlib.test delete mode 100644 tools/Makefile.in delete mode 100644 tools/README delete mode 100755 tools/checkLibraryDoc.tcl delete mode 100755 tools/configure delete mode 100644 tools/configure.ac delete mode 100644 tools/encoding/Makefile delete mode 100644 tools/encoding/README delete mode 100644 tools/encoding/ascii.txt delete mode 100644 tools/encoding/big5.txt delete mode 100644 tools/encoding/cjk.inf delete mode 100644 tools/encoding/cp1250.txt delete mode 100644 tools/encoding/cp1251.txt delete mode 100644 tools/encoding/cp1252.txt delete mode 100644 tools/encoding/cp1253.txt delete mode 100644 tools/encoding/cp1254.txt delete mode 100644 tools/encoding/cp1255.txt delete mode 100644 tools/encoding/cp1256.txt delete mode 100644 tools/encoding/cp1257.txt delete mode 100644 tools/encoding/cp1258.txt delete mode 100644 tools/encoding/cp437.txt delete mode 100644 tools/encoding/cp737.txt delete mode 100644 tools/encoding/cp775.txt delete mode 100644 tools/encoding/cp850.txt delete mode 100644 tools/encoding/cp852.txt delete mode 100644 tools/encoding/cp855.txt delete mode 100644 tools/encoding/cp857.txt delete mode 100644 tools/encoding/cp860.txt delete mode 100644 tools/encoding/cp861.txt delete mode 100644 tools/encoding/cp862.txt delete mode 100644 tools/encoding/cp863.txt delete mode 100644 tools/encoding/cp864.txt delete mode 100644 tools/encoding/cp865.txt delete mode 100644 tools/encoding/cp866.txt delete mode 100644 tools/encoding/cp869.txt delete mode 100644 tools/encoding/cp874.txt delete mode 100644 tools/encoding/cp932.txt delete mode 100644 tools/encoding/cp936.txt delete mode 100644 tools/encoding/cp949.txt delete mode 100644 tools/encoding/cp950.txt delete mode 100644 tools/encoding/dingbats.txt delete mode 100644 tools/encoding/ebcdic.txt delete mode 100644 tools/encoding/gb12345.txt delete mode 100644 tools/encoding/gb1988.txt delete mode 100644 tools/encoding/gb2312.txt delete mode 100644 tools/encoding/iso2022-jp.esc delete mode 100644 tools/encoding/iso2022-kr.esc delete mode 100644 tools/encoding/iso2022.esc delete mode 100644 tools/encoding/iso8859-1.txt delete mode 100644 tools/encoding/iso8859-10.txt delete mode 100644 tools/encoding/iso8859-13.txt delete mode 100644 tools/encoding/iso8859-14.txt delete mode 100644 tools/encoding/iso8859-15.txt delete mode 100644 tools/encoding/iso8859-16.txt delete mode 100644 tools/encoding/iso8859-2.txt delete mode 100644 tools/encoding/iso8859-3.txt delete mode 100644 tools/encoding/iso8859-4.txt delete mode 100644 tools/encoding/iso8859-5.txt delete mode 100644 tools/encoding/iso8859-6.txt delete mode 100644 tools/encoding/iso8859-7.txt delete mode 100644 tools/encoding/iso8859-8.txt delete mode 100644 tools/encoding/iso8859-9.txt delete mode 100644 tools/encoding/jis0201.txt delete mode 100644 tools/encoding/jis0208.txt delete mode 100644 tools/encoding/jis0212.txt delete mode 100644 tools/encoding/koi8-r.txt delete mode 100644 tools/encoding/ksc5601.txt delete mode 100644 tools/encoding/macCentEuro.txt delete mode 100644 tools/encoding/macCroatian.txt delete mode 100644 tools/encoding/macCyrillic.txt delete mode 100644 tools/encoding/macDingbats.txt delete mode 100644 tools/encoding/macGreek.txt delete mode 100644 tools/encoding/macIceland.txt delete mode 100644 tools/encoding/macJapan.txt delete mode 100644 tools/encoding/macRoman.txt delete mode 100644 tools/encoding/macRomania.txt delete mode 100644 tools/encoding/macThai.txt delete mode 100644 tools/encoding/macTurkish.txt delete mode 100644 tools/encoding/macUkraine.txt delete mode 100644 tools/encoding/shiftjis.txt delete mode 100644 tools/encoding/symbol.txt delete mode 100644 tools/encoding/tis-620.txt delete mode 100644 tools/encoding/txt2enc.c delete mode 100644 tools/eolFix.tcl delete mode 100644 tools/feather.bmp delete mode 100755 tools/findBadExternals.tcl delete mode 100755 tools/fix_tommath_h.tcl delete mode 100644 tools/genStubs.tcl delete mode 100644 tools/index.tcl delete mode 100644 tools/installData.tcl delete mode 100755 tools/loadICU.tcl delete mode 100755 tools/makeTestCases.tcl delete mode 100644 tools/man2help.tcl delete mode 100644 tools/man2help2.tcl delete mode 100644 tools/man2html.tcl delete mode 100644 tools/man2html1.tcl delete mode 100644 tools/man2html2.tcl delete mode 100644 tools/man2tcl.c delete mode 100644 tools/mkdepend.tcl delete mode 100644 tools/regexpTestLib.tcl delete mode 100644 tools/str2c delete mode 100644 tools/tcl.hpj.in delete mode 100755 tools/tclZIC.tcl delete mode 100644 tools/tclsh.svg delete mode 100644 tools/tcltk-man2html-utils.tcl delete mode 100755 tools/tcltk-man2html.tcl delete mode 100644 tools/tsdPerf.c delete mode 100644 tools/tsdPerf.tcl delete mode 100644 tools/uniClass.tcl delete mode 100644 tools/uniParse.tcl delete mode 100644 tools/white.bmp delete mode 100644 unix/Makefile.in delete mode 100644 unix/README delete mode 100644 unix/aclocal.m4 delete mode 100755 unix/configure delete mode 100644 unix/configure.ac delete mode 100644 unix/dltest/Makefile.in delete mode 100644 unix/dltest/README delete mode 100644 unix/dltest/pkga.c delete mode 100644 unix/dltest/pkgb.c delete mode 100644 unix/dltest/pkgc.c delete mode 100644 unix/dltest/pkgd.c delete mode 100644 unix/dltest/pkge.c delete mode 100644 unix/dltest/pkgooa.c delete mode 100644 unix/dltest/pkgua.c delete mode 100755 unix/install-sh delete mode 100755 unix/installManPage delete mode 100755 unix/ldAix delete mode 100644 unix/tcl.m4 delete mode 100644 unix/tcl.pc.in delete mode 100644 unix/tcl.spec delete mode 100644 unix/tclAppInit.c delete mode 100644 unix/tclConfig.h.in delete mode 100644 unix/tclConfig.sh.in delete mode 100644 unix/tclEpollNotfy.c delete mode 100644 unix/tclKqueueNotfy.c delete mode 100644 unix/tclLoadAix.c delete mode 100644 unix/tclLoadDl.c delete mode 100644 unix/tclLoadDyld.c delete mode 100644 unix/tclLoadNext.c delete mode 100644 unix/tclLoadOSF.c delete mode 100644 unix/tclLoadShl.c delete mode 100644 unix/tclSelectNotfy.c delete mode 100644 unix/tclUnixChan.c delete mode 100644 unix/tclUnixCompat.c delete mode 100644 unix/tclUnixEvent.c delete mode 100644 unix/tclUnixFCmd.c delete mode 100644 unix/tclUnixFile.c delete mode 100644 unix/tclUnixInit.c delete mode 100644 unix/tclUnixNotfy.c delete mode 100644 unix/tclUnixPipe.c delete mode 100644 unix/tclUnixPort.h delete mode 100644 unix/tclUnixSock.c delete mode 100644 unix/tclUnixTest.c delete mode 100644 unix/tclUnixThrd.c delete mode 100644 unix/tclUnixThrd.h delete mode 100644 unix/tclUnixTime.c delete mode 100644 unix/tclXtNotify.c delete mode 100644 unix/tclXtTest.c delete mode 100644 unix/tclooConfig.sh delete mode 100644 win/Makefile.in delete mode 100644 win/README delete mode 100644 win/aclocal.m4 delete mode 100644 win/buildall.vc.bat delete mode 100644 win/cat.c delete mode 100644 win/coffbase.txt delete mode 100755 win/configure delete mode 100644 win/configure.ac delete mode 100644 win/makefile.vc delete mode 100644 win/nmakehlp.c delete mode 100644 win/rules.vc delete mode 100644 win/tcl.dsp delete mode 100644 win/tcl.dsw delete mode 100644 win/tcl.hpj.in delete mode 100644 win/tcl.m4 delete mode 100644 win/tcl.rc delete mode 100644 win/tclAppInit.c delete mode 100644 win/tclConfig.sh.in delete mode 100644 win/tclWin32Dll.c delete mode 100644 win/tclWinChan.c delete mode 100644 win/tclWinConsole.c delete mode 100644 win/tclWinDde.c delete mode 100644 win/tclWinError.c delete mode 100644 win/tclWinFCmd.c delete mode 100644 win/tclWinFile.c delete mode 100644 win/tclWinInit.c delete mode 100644 win/tclWinInt.h delete mode 100644 win/tclWinLoad.c delete mode 100644 win/tclWinNotify.c delete mode 100644 win/tclWinPipe.c delete mode 100644 win/tclWinPort.h delete mode 100644 win/tclWinReg.c delete mode 100644 win/tclWinSerial.c delete mode 100644 win/tclWinSock.c delete mode 100644 win/tclWinTest.c delete mode 100644 win/tclWinThrd.c delete mode 100644 win/tclWinTime.c delete mode 100644 win/tclooConfig.sh delete mode 100644 win/tclsh.exe.manifest.in delete mode 100644 win/tclsh.ico delete mode 100644 win/tclsh.rc diff --git a/.fossil-settings/binary-glob b/.fossil-settings/binary-glob deleted file mode 100644 index ec574be..0000000 --- a/.fossil-settings/binary-glob +++ /dev/null @@ -1,9 +0,0 @@ -compat/zlib/win32/zdll.lib -compat/zlib/win32/zlib1.dll -compat/zlib/win64/zdll.lib -compat/zlib/win64/zlib1.dll -compat/zlib/win64/libz.dll.a -compat/zlib/zlib.3.pdf -*.bmp -*.gif -*.png \ No newline at end of file diff --git a/.fossil-settings/crlf-glob b/.fossil-settings/crlf-glob deleted file mode 100644 index 2041cb6..0000000 --- a/.fossil-settings/crlf-glob +++ /dev/null @@ -1,17 +0,0 @@ -compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs -compat/zlib/contrib/vstudio/readme.txt -compat/zlib/contrib/vstudio/*/zlib.rc -compat/zlib/win32/*.txt -compat/zlib/win64/*.txt -libtommath/*.dsp -libtommath/*.sln -libtommath/*.vcproj -tools/tcl.hpj.in -tools/tcl.wse.in -win/buildall.vc.bat -win/coffbase.txt -win/makefile.vc -win/rules.vc -win/tcl.dsp -win/tcl.dsw -win/tcl.hpj.in \ No newline at end of file diff --git a/.fossil-settings/crnl-glob b/.fossil-settings/crnl-glob deleted file mode 100644 index 2041cb6..0000000 --- a/.fossil-settings/crnl-glob +++ /dev/null @@ -1,17 +0,0 @@ -compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs -compat/zlib/contrib/vstudio/readme.txt -compat/zlib/contrib/vstudio/*/zlib.rc -compat/zlib/win32/*.txt -compat/zlib/win64/*.txt -libtommath/*.dsp -libtommath/*.sln -libtommath/*.vcproj -tools/tcl.hpj.in -tools/tcl.wse.in -win/buildall.vc.bat -win/coffbase.txt -win/makefile.vc -win/rules.vc -win/tcl.dsp -win/tcl.dsw -win/tcl.hpj.in \ No newline at end of file diff --git a/.fossil-settings/encoding-glob b/.fossil-settings/encoding-glob deleted file mode 100644 index 8582dd4..0000000 --- a/.fossil-settings/encoding-glob +++ /dev/null @@ -1,9 +0,0 @@ -tools/tcl.hpj.in -tools/tcl.wse.in -win/buildall.vc.bat -win/coffbase.txt -win/makefile.vc -win/rules.vc -win/tcl.dsp -win/tcl.dsw -win/tcl.hpj.in \ No newline at end of file diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob deleted file mode 100644 index c85b488..0000000 --- a/.fossil-settings/ignore-glob +++ /dev/null @@ -1,48 +0,0 @@ -*.a -*.dll -*.dylib -*.exe -*.exp -*.lib -*.o -*.obj -*.pdb -*.res -*.sl -*.so -*/Makefile -*/config.cache -*/config.log -*/config.status -*/tclConfig.sh -*/tclsh* -*/tcltest* -*/versions.vc -*/version.vc -html -libtommath/bn.ilg -libtommath/bn.ind -libtommath/pretty.build -libtommath/tommath.src -libtommath/*.pdf -libtommath/*.pl -libtommath/*.sh -libtommath/tombc/* -libtommath/pre_gen/* -libtommath/pics/* -libtommath/mtest/* -libtommath/logs/* -libtommath/etc/* -libtommath/demo/* -libtommath/*.out -libtommath/*.tex -unix/autoMkindex.tcl -unix/dltest.marker -unix/tcl.pc -unix/tclIndex -unix/pkgs/* -win/Debug* -win/Release* -win/pkgs/* -win/tcl.hpj -win/nmhlp-out.txt diff --git a/.project b/.project deleted file mode 100644 index eddd834..0000000 --- a/.project +++ /dev/null @@ -1,11 +0,0 @@ - - - tcl8 - - - - - - - - diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0..0000000 --- a/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/.settings/org.eclipse.core.runtime.prefs b/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22..0000000 --- a/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index e2881a0..0000000 --- a/ChangeLog +++ /dev/null @@ -1,8856 +0,0 @@ -A NOTE ON THE CHANGELOG: -Starting in early 2011, Tcl source code has been under the management of -fossil, hosted at http://core.tcl.tk/tcl/ . Fossil presents a "Timeline" -view of changes made that is superior in every way to a hand edited log file. -Because of this, many Tcl developers are now out of the habit of maintaining -this log file. You may still find useful things in it, but the Timeline is -a better first place to look now. -============================================================================ - -2013-09-19 Don Porter - - *** 8.6.1 TAGGED FOR RELEASE *** - - * generic/tcl.h: Bump version number to 8.6.1. - * library/init.tcl: - * unix/configure.in: - * win/configure.in: - * unix/tcl.spec: - * README: - - * unix/configure: autoconf-2.59 - * win/configure: - -2013-09-19 Donal Fellows - - * doc/next.n (METHOD SEARCH ORDER): Bug [3606943]: Corrected - description of method search order. - -2013-09-18 Donal Fellows - - Bump TclOO version to 1.0.1 for release. - -2013-09-17 Donal Fellows - - * generic/tclBinary.c (BinaryEncodeUu, BinaryDecodeUu): [Bug 2152292]: - Corrected implementation of the core of uuencode handling so that the - line length processing is correctly applied. - ***POTENTIAL INCOMPATIBILITY*** - Existing code that was using the old versions and working around the - limitations will now need to do far less. The -maxlen option now has - strict limits on the range of supported lengths; this is a limitation - of the format itself. - -2013-09-09 Donal Fellows - - * generic/tclOOMethod.c (CloneProcedureMethod): [Bug 3609693]: Strip - the internal representation of method bodies during cloning in order - to ensure that any bound references to instance variables are removed. - -2013-09-01 Donal Fellows - - * generic/tclBinary.c (BinaryDecodeHex): [Bug b98fa55285]: Ensure that - whitespace at the end of a string don't cause the decoder to drop the - last decoded byte. - -2013-08-03 Donal Fellows - - * library/auto.tcl: [Patch 3611643]: Allow TclOO classes to be found - by the autoloading mechanism. - -2013-08-02 Donal Fellows - - * generic/tclOODefineCmds.c (ClassSuperSet): Bug [9d61624b3d]: Stop - crashes when emptying the superclass slot, even when doing elaborate - things with metaclasses. - -2013-08-01 Harald Oehlmann - - * tclUnixNotify.c (Tcl_InitNotifier): Bug [a0bc856dcd]: Start notifier - thread again if we were forked, to solve Rivet bug 55153. - -2013-07-05 Kevin B. Kenny - - * library/tzdata/Africa/Casablanca: - * library/tzdata/America/Asuncion: - * library/tzdata/Antarctica/Macquarie: - * library/tzdata/Asia/Gaza: - * library/tzdata/Asia/Hebron: - * library/tzdata/Asia/Jerusalem: - http://www.iana.org/time-zones/repository/releases/tzdata2013d.tar.gz - -2013-07-03 Jan Nijtmans - - * unix/tclXtNotify.c: Bug [817249]: bring tclXtNotify.c up to date with - Tcl_SetNotifier() change. - -2013-07-02 Jan Nijtmans - - * unix/tcl.m4: Bug [32afa6e256]: dirent64 check is incorrect in tcl.m4 - * unix/configure: (thanks to Brian Griffin) - -2013-06-27 Jan Nijtmans - - * generic/tclConfig.c: Bug [9b2e636361]: Tcl_CreateInterp() needs - * generic/tclMain.c: initialized encodings. - -2013-06-18 Jan Nijtmans - - * generic/tclEvent.c: Bug [3611974]: InitSubsystems multiple thread - issue. - -2013-06-17 Jan Nijtmans - - * generic/regc_locale.c: Bug [a876646efe]: re_expr character class - [:cntrl:] should contain \u0000 - \u001f - -2013-06-09 Donal K. Fellows - - * generic/tclCompCmdsSZ.c (TclCompileTryCmd): [Bug 779d38b996]: - Rewrote the [try] compiler to generate better code in some cases and - to behave correctly in others; when an error happens during the - processing of an exception-trap clause or a finally clause, the - *original* return options are now captured in a -during option, even - when fully compiled. - -2013-06-05 Donal K. Fellows - - * generic/tclExecute.c (INST_EXPAND_DROP): [Bugs 2835313, 3614226]: - New opcode to allow resetting the stack to get rid of an expansion, - restoring the stack to a known state in the process. - * generic/tclCompile.c, generic/tclCompCmds.c: Adjusted the compilers - for [break] and [continue] to get stack cleanup right in the majority - of cases. - * tests/for.test (for-7.*): Set of tests for these evil cases. - -2013-06-04 Jan Nijtmans - - * unix/tcl.m4: Eliminate NO_VIZ macro as current zlib uses HAVE_HIDDEN - instead. One more last-moment fix for FreeBSD by Pietro Cerutti - -2013-06-03 Miguel Sofer - - * generic/tclExecute.c: fix for perf bug detected by Kieran - (https://groups.google.com/forum/?fromgroups#!topic/comp.lang.tcl/vfpI3bc-DkQ), - diagnosed by dgp to be a close relative of [Bug 781585], which was - fixed by commit [f46fb50cb3]. This bug was introduced by myself in - commit [cbfe055d8c]. - -2013-06-03 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileBreakCmd, TclCompileContinueCmd): - Added code to allow [break] and [continue] to be issued as a jump (in - the most common cases) rather than using the more expensive exception - processing path in the bytecode engine. [Bug 3614226]: Partial fix for - the issues relating to cleaning up the stack when dealing with [break] - and [continue]. - -2013-05-27 Harald Oehlmann - - * library/msgcat/msgcat.tcl: [Bug 3036566]: Also get locale from - registry key HCU\Control Panel\Desktop : PreferredUILanguages to honor - installed language packs on Vista+. - Bumped msgcat version to 1.5.2 - -2013-05-22 Andreas Kupries - - * tclCompile.c: Removed duplicate const qualifier causing the HP - native cc to error out. - -2013-05-22 Donal K. Fellows - - * generic/tclUtf.c (TclUtfCasecmp): [Bug 3613609]: Replace problematic - uses of strcasecmp with a proper UTF-8-aware version. Affects both - [lsearch -nocase] and [lsort -nocase]. - -2013-05-22 Donal K. Fellows - - * doc/file.n: [Bug 3613671]: Added note to portability section on the - fact that [file owned] does not produce useful results on Windows. - -2013-05-20 Donal K. Fellows - - * unix/tclUnixFCmd.c (DefaultTempDir): [Bug 3613567]: Corrected logic - for checking return code of access() system call, which was inverted. - -2013-05-19 Jan Nijtmans - - * unix/tcl.m4: Fix for FreeBSD, and remove support for older - * unix/configure: FreeBSD versions. Patch by Pietro Cerutti. - -2013-05-18 Donal K. Fellows - - * generic/tclCompCmdsGR.c: Split tclCompCmds.c again to keep size of - code down. - -2013-05-16 Jan Nijtmans - - * generic/tclBasic.c: Add panic in order to detect incompatible - mingw32 sys/stat.h and sys/time.h headers. - -2013-05-13 Jan Nijtmans - - * compat/zlib/*: Upgrade to zlib 1.2.8 - -2013-05-10 Donal K. Fellows - - Optimizations and general bytecode generation improvements. - * generic/tclCompCmds.c (TclCompileAppendCmd, TclCompileLappendCmd): - (TclCompileReturnCmd): Make these generate bytecode in more cases. - (TclCompileListCmd): Make this able to push a literal when it can. - * generic/tclCompile.c (TclSetByteCodeFromAny, PeepholeOptimize): - Added checks to see if we can apply some simple cross-command-boundary - optimizations, and defined a small number of such optimizations. - (TclCompileScript): Added the special ability to compile the list - command with expansion ([list {*}blah]) into bytecode that does not - call an external command. - -2013-05-06 Jan Nijtmans - - * generic/tclStubInit.c: Add support for Cygwin64, which has a 64-bit - * generic/tclDecls.h: "long" type. Binary compatibility with win64 - requires that all stub entries use 32-bit long's, therefore the need - for various wrapper functions/macros. For Tcl 9 a better solution is - needed, but that cannot be done without introducing binary - incompatibility. - -2013-04-30 Andreas Kupries - - * library/platform/platform.tcl (::platform::LibcVersion): - * library/platform/pkgIndex.tcl: Followup to the 2013-01-30 change. - The RE become too restrictive again. SuSe added a timestamp after the - version. Loosened up a bit. Bumped package to version 1.0.12. - -2013-04-29 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileArraySetCmd): Generate better code - when the list of things to set is a literal. - -2013-04-25 Jan Nijtmans - - * generic/tclDecls.h: Implement Tcl_NewBooleanObj, Tcl_DbNewBooleanObj - and Tcl_SetBooleanObj as macros using Tcl_NewIntObj, Tcl_DbNewLongObj - and Tcl_SetIntObj. Starting with Tcl 8.5, this is exactly the same, it - only eliminates code duplication. - * generic/tclInt.h: Eliminate use of NO_WIDE_TYPE everywhere: It's - exactly the same as TCL_WIDE_INT_IS_LONG - -2013-04-19 Jan Nijtmans - - * generic/tclDecls.h: Implement many Tcl_*Var* functions and - Tcl_GetIndexFromObj as (faster/stack-saving) macros around resp their - Tcl_*Var*2 equivalent and Tcl_GetIndexFromObjStruct. - -2013-04-12 Jan Nijtmans - - * generic/tclDecls.h: Implement Tcl_Pkg* functions as - (faster/stack-saving) macros around Tcl_Pkg*Ex functions. - -2013-04-08 Don Porter - - * generic/regc_color.c: [Bug 3610026]: Stop crash when the number of - * generic/regerrs.h: "colors" in a regular expression overflows a - * generic/regex.h: short int. Thanks to Heikki Linnakangas for - * generic/regguts.h: the report and the patch. - * tests/regexp.test: - -2013-04-04 Reinhard Max - - * library/http/http.tcl (http::geturl): Allow URLs that don't have a - path, but a query query, e.g. http://example.com?foo=bar - * Bump the http package to 2.8.7. - -2013-03-22 Venkat Iyer - * library/tzdata/Africa/Cairo: Update to tzdata2013b. - * library/tzdata/Africa/Casablanca: - * library/tzdata/Africa/Gaborone: - * library/tzdata/Africa/Tripoli: - * library/tzdata/America/Asuncion: - * library/tzdata/America/Barbados: - * library/tzdata/America/Bogota: - * library/tzdata/America/Costa_Rica: - * library/tzdata/America/Curacao: - * library/tzdata/America/Nassau: - * library/tzdata/America/Port-au-Prince: - * library/tzdata/America/Santiago: - * library/tzdata/Antarctica/Palmer: - * library/tzdata/Asia/Aden: - * library/tzdata/Asia/Hong_Kong: - * library/tzdata/Asia/Muscat: - * library/tzdata/Asia/Rangoon: - * library/tzdata/Asia/Shanghai: - * library/tzdata/Atlantic/Bermuda: - * library/tzdata/Europe/Vienna: - * library/tzdata/Pacific/Easter: - * library/tzdata/Pacific/Fiji: - * library/tzdata/Asia/Khandyga: (new) - * library/tzdata/Asia/Ust-Nera: (new) - * library/tzdata/Europe/Busingen: (new) - -2013-03-21 Don Porter - - * library/auto.tcl: [Bug 2102614]: Add ensemble indexing support to - * tests/autoMkindex.test: [auto_mkindex]. Thanks Brian Griffin. - -2013-03-19 Don Porter - - * generic/tclFCmd.c: [Bug 3597000]: Consistent [file copy] result. - * tests/fileSystem.test: - -2013-03-19 Jan Nijtmans - - * win/tclWinFile.c: [Bug 3608360]: Incompatible behaviour of "file - exists". - -2013-03-18 Donal K. Fellows - - * tests/cmdAH.test (cmdAH-19.12): [Bug 3608360]: Added test to ensure - that we never ever allow [file exists] to do globbing. - -2013-03-12 Jan Nijtmans - - * unix/tcl.m4: Patch by Andrew Shadura, providing better support for - three architectures they have in Debian. - -2013-03-11 Don Porter - - * generic/tclCompile.c: [Bugs 3607246,3607372]: Unbalanced refcounts - * generic/tclLiteral.c: of literals in the global literal table. - -2013-03-06 Don Porter - - * generic/regc_nfa.c: [Bugs 3604074,3606683]: Rewrite of the - * generic/regcomp.c: fixempties() routine (and supporting routines) - to completely eliminate the infinite loop hazard. Thanks to Tom Lane - for the much improved solution. - -2013-02-28 Don Porter - - * generic/tclLiteral.c: Revise TclReleaseLiteral() to tolerate a NULL - interp argument. - - * generic/tclCompile.c: Update callers and revise mistaken comments. - * generic/tclProc.c: - -2013-02-27 Jan Nijtmans - - * generic/regcomp.c: [Bug 3606139]: missing error check allows - * tests/regexp.test: regexp to crash Tcl. Thanks to Tom Lane for - providing the test-case and the patch. - -2013-02-26 Donal K. Fellows - - * tests/chanio.test (chan-io-28.7): [Bug 3605120]: Stop test from - hanging when run standalone. - -2013-02-26 Jan Nijtmans - - * generic/tclObj.c: Don't panic if Tcl_ConvertToType is called for a - type that doesn't have a setFromAnyProc, create a proper error message. - -2013-02-25 Donal K. Fellows - - * tests/binary.test (binary-41.*): [Bug 3605721]: Test independence - fixes. Thanks to Rolf Ade for pointing out the problem. - -2013-02-25 Don Porter - - * tests/assocd.test: [Bugs 3605719,3605720]: Test independence. - * tests/basic.test: Thanks Rolf Ade for patches. - -2013-02-23 Jan Nijtmans - - * compat/fake-rfc2553.c: [Bug 3599194]: compat/fake-rfc2553.c is - broken. - -2013-02-22 Don Porter - - * generic/tclAssembly.c: Shift more burden of smart cleanup - * generic/tclCompile.c: onto the TclFreeCompileEnv() routine. - Stop crashes when the hookProc raises an error. - -2013-02-20 Don Porter - - * generic/tclNamesp.c: [Bug 3605447]: Make sure the -clear option - * tests/namespace.test: to [namespace export] always clears, whether - or not new export patterns are specified. - -2013-02-20 Jan Nijtmans - - * win/tclWinDde.c: [Bug 3605401]: Compiler error with latest mingw-w64 - headers. - -2013-02-19 Jan Nijtmans - - * generic/tclTrace.c: [Bug 2438181]: Incorrect error reporting in - * tests/trace.test: traces. Test-case and fix provided by Poor - Yorick. - -2013-02-15 Don Porter - - * generic/regc_nfa.c: [Bug 3604074]: Fix regexp optimization to - * tests/regexp.test: stop hanging on the expression - ((((((((a)*)*)*)*)*)*)*)* . Thanks to Bjørn Grathwohl for discovery. - -2013-02-14 Harald Oehlmann - - * library/msgcat/msgcat.tcl: [Bug 3604576]: Catch missing registry - entry "HCU\Control Panel\International". - Bumped msgcat version to 1.5.1 - -2013-02-11 Donal K. Fellows - - * generic/tclZlib.c (ZlibTransformOutput): [Bug 3603553]: Ensure that - data gets written to the underlying stream by compressing transforms - when the amount of data to be written is one buffer's-worth; problem - was particularly likely to occur when compressing large quantities of - not-very-compressible data. Many thanks to Piera Poggio (vampiera) for - reporting. - -2013-02-09 Donal K. Fellows - - * generic/tclOOBasic.c (TclOO_Object_VarName): [Bug 3603695]: Change - the way that the 'varname' method is implemented so that there are no - longer problems with interactions due to the resolver. Thanks to - Taylor Venable for identifying the problem. - -2013-02-08 Donal K. Fellows - - * generic/regc_nfa.c (duptraverse): [Bug 3603557]: Increase the - maximum depth of recursion used when duplicating an automaton in - response to encountering a "wild" RE that hit the previous limit. - Allow the limit (DUPTRAVERSE_MAX_DEPTH) to be set by defining its - value in the Makefile. Problem reported by Jonathan Mills. - -2013-02-05 Don Porter - - * win/tclWinFile.c: [Bug 3603434]: Make sure TclpObjNormalizePath() - properly declares "a:/" to be normalized, even when no "A:" drive is - present on the system. - -2013-02-05 Donal K. Fellows - - * generic/tclLoadNone.c (TclpLoadMemory): [Bug 3433012]: Added dummy - version of this function to use in the event that a platform thinks it - can load from memory but cannot actually do so due to it being - disabled at configuration time. - -2013-02-04 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileArraySetCmd): [Bug 3603163]: Stop - crash in weird case where [eval] is used to make [array set] get - confused about whether there is a local variable table or not. Thanks - to Poor Yorick for identifying a reproducible crashing case. - -2013-01-30 Andreas Kupries - - * library/platform/platform.tcl (::platform::LibcVersion): See - * library/platform/pkgIndex.tcl: [Bug 3599098]: Fixed the RE - * unix/Makefile.in: extracting the version to avoid issues with - * win/Makefile.in: recent changes to the glibc banner. Now targeting a - less variable part of the string. Bumped package to version 1.0.11. - -2013-01-28 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileArraySetCmd) - (TclCompileArrayUnsetCmd, TclCompileDictAppendCmd) - (TclCompileDictCreateCmd, CompileDictEachCmd, TclCompileDictIncrCmd) - (TclCompileDictLappendCmd, TclCompileDictMergeCmd) - (TclCompileDictUnsetCmd, TclCompileDictUpdateCmd) - (TclCompileDictWithCmd, TclCompileInfoCommandsCmd): - * generic/tclCompCmdsSZ.c (TclCompileStringMatchCmd) - (TclCompileStringMapCmd): Improve the code generation in cases where - full compilation is impossible but a full ensemble invoke is provably - not necessary. - -2013-01-26 Jan Nijtmans - - * unix/tclUnixCompat.c: [Bug 3601804]: platformCPUID segmentation - fault on Darwin. - -2013-01-23 Donal K. Fellows - - * library/http/http.tcl (http::geturl): [Bug 2911139]: Do not do vwait - for connect to avoid reentrancy problems (except when operating - without a -command option). Internally, this means that all sockets - created by the http package will always be operated in asynchronous - mode. - -2013-01-21 Jan Nijtmans - - * generic/tclInt.decls: Put back Tcl[GS]etStartupScript(Path|FileName) - in private stub table, so extensions using this (like Tk 8.4) will - continue to work in all Tcl 8.x versions. Extensions using this - still cannot be compiled against Tcl 8.6 headers. - -2013-01-18 Jan Nijtmans - - * generic/tclPort.h: [Bug 3598300]: unix: tcl.h does not include - sys/stat.h - -2013-01-17 Donal K. Fellows - - * generic/tclCompCmds.c (PushVarName): [Bug 3600328]: Added mechanism - for suppressing compilation of variables when we couldn't cope with - the results. Useful for some [array] subcommands. - * generic/tclEnsemble.c (CompileToCompiledCommand): Must restore the - compilation environment when a command compiler fails. - -2013-01-16 Donal K. Fellows - - * generic/tclZlib.c (TclZlibInit): [Bug 3601086]: Register the config - info in the iso8859-1 encoding as that is guaranteed to be present. - -2013-01-16 Jan Nijtmans - - * Makefile.in: Allow win32 build with -DTCL_NO_DEPRECATED, just as - * generic/tcl.h: in the UNIX build. Define Tcl_EvalObj and - * generic/tclDecls.h: Tcl_GlobalEvalObj as macros, even when - * generic/tclBasic.c: TCL_NO_DEPRECATED is defined, so Tk can benefit - from it too. - -2013-01-14 Jan Nijtmans - - * win/tcl.m4: More flexible search for win32 tclConfig.sh, backported - from TEA (not actually used in Tcl, only for Tk) - -2013-01-14 Jan Nijtmans - - * generic/tclInt.decls: Put back Tcl_[GS]etStartupScript in internal - stub table, so extensions using this, compiled against 8.5 headers - still run in Tcl 8.6. - -2013-01-13 Alexandre Ferrieux - - * doc/fileevent.n: [Bug 3436609]: Clarify readable fileevent "false - positives" in the case of multibyte encodings/transforms. - -2013-01-13 Jan Nijtmans - - * generic/tclIntDecls.h: If TCL_NO_DEPRECATED is defined, make sure - that TIP #139 functions all are taken from the public stub table, even - if the inclusion is through tclInt.h. - -2013-01-12 Jan Nijtmans - - * generic/tclInt.decls: Put back TclBackgroundException in internal - stub table, so extensions using this, compiled against 8.5 headers - still run in Tcl 8.6. - -2013-01-09 Jan Nijtmans - - * library/http/http.tcl: [Bug 3599395]: http assumes status line is a - proper Tcl list. - -2013-01-08 Jan Nijtmans - - * win/tclWinFile.c: [Bug 3092089]: [file normalize] can remove path - components. [Bug 3587096]: win vista/7: "can't find init.tcl" when - called via junction without folder list access. - -2013-01-07 Jan Nijtmans - - * generic/tclOOStubLib.c: Restrict the stub library to only use - * generic/tclTomMathStubLib.c: Tcl_PkgRequireEx, Tcl_ResetResult and - Tcl_AppendResult, not any other function. This puts least restrictions - on eventual Tcl 9 stubs re-organization, and it works on the widest - range of Tcl versions. - -2013-01-06 Jan Nijtmans - - * library/http/http.tcl: Don't depend on Spencer-specific regexp - * tests/env.test: syntax (/u and /U) any more in unrelated places. - * tests/exec.test: - Bump http package to 2.8.6. - -2013-01-04 Donal K. Fellows - - * generic/tclEnsemble.c (CompileBasicNArgCommand): Added very simple - compiler (which just compiles to a normal invoke of the implementation - command) for many ensemble subcommands where we can prove that there - is no way for scripts to detect the difference even through error - handling or [info level]/[info frame]. This improves the code produced - from some ensembles (e.g., [info], [string]) to the point where the - ensemble is now not normally seen at the bytecode level at all. - -2013-01-04 Miguel Sofer - - * generic/tclInt.h: Insure that PURIFY builds cannot exploit the - * generic/tclExecute.c: Tcl stack to hide mem defects. - -2013-01-03 Donal K. Fellows - - * doc/fconfigure.n, doc/CrtChannel.3: Updated to reflect the fact that - the minimum buffer size is one byte, not ten. Identified by Schelte - Bron on the Tcler's Chat. - - * generic/tclExecute.c (TEBCresume:INST_INVOKE_REPLACE): - * generic/tclEnsemble.c (TclCompileEnsemble): Added new mechanism to - allow for more efficient dispatch of non-bytecode-compiled subcommands - of bytecode-compiled ensembles. This can provide substantial speed - benefits in some cases. - -2013-01-02 Miguel Sofer - - * generic/tclEnsemble.c: Remove stray calls to Tcl_Alloc and friends: - * generic/tclExecute.c: the core should only use ckalloc to allow - * generic/tclIORTrans.c: MEM_DEBUG to work properly. - * generic/tclTomMathInterface.c: - -2012-12-31 Donal K. Fellows - - * doc/string.n: Noted the obsolescence of the 'bytelength', - 'wordstart' and 'wordend' subcommands, and moved them to later in the - file. - -2012-12-27 Jan Nijtmans - - * generic/tclListObj.c: [Bug 3598580]: Tcl_ListObjReplace may release - deleted elements too early. - -2012-12-22 Alexandre Ferrieux - - * generic/tclUtil.c: [Bug 3598150]: Stop leaking allocated space when - objifying a zero-length DString. Spotted by afredd. - -2012-12-21 Jan Nijtmans - - * unix/dltest/pkgb.c: Inline compat Tcl_GetDefaultEncodingDir. - * generic/tclStubLib.c: Eliminate unnecessary static HasStubSupport() - and isDigit() functions, just do the same inline. - -2012-12-18 Donal K. Fellows - - * generic/tclCompCmdsSZ.c (TclSubstCompile): Improved the sequence of - instructions issued for [subst] when dealing with simple variable - references. - -2012-12-14 Don Porter - - *** 8.6.0 TAGGED FOR RELEASE *** - - * changes: updates for 8.6.0 - -2012-12-13 Don Porter - - * generic/tclZlib.c: Repair same issue with misusing the - * tests/zlib.test: 'fire and forget' nature of Tcl_ObjSetVar2 - in the new TIP 400 implementation. - -2012-12-13 Miguel Sofer - - * generic/tclCmdAH.c: (CatchObjCmdCallback): do not decrRefCount - * tests/cmdAH.test: the newValuePtr sent to Tcl_ObjSetVar2: - TOSV2 is 'fire and forget', it decrs on its own. - Fix for [Bug 3595576], found by andrewsh. - -2012-12-13 Jan Nijtmans - - * generic/tcl.h: Fix Tcl_DecrRefCount macro such that it doesn't - access its objPtr parameter twice any more. - -2012-12-11 Don Porter - - * generic/tcl.h: Bump version number to 8.6.0. - * library/init.tcl: - * unix/configure.in: - * win/configure.in: - * unix/tcl.spec: - * README: - - * unix/configure: autoconf-2.59 - * win/configure: - -2012-12-10 Donal K. Fellows - - * tools/tcltk-man2html.tcl (plus-pkgs): Increased robustness of - version number detection code to deal with packages whose names are - prefixes of other packages. - * unix/Makefile.in (dist): Added pkgs/package.list.txt to distribution - builds to ensure that 'make html' will work better. - -2012-12-09 Alexandre Ferrieux - - * tests/chan.test: Clean up unwanted eofchar side-effect of chan-4.6 - leading to a spurious "'" at end of chan.test under certain conditions - (see [Bug 3389289] and [Bug 3389251]). - - * doc/expr.n: [Bug 3594188]: Clarifications about commas. - -2012-12-08 Alexandre Ferrieux - - * generic/tclIO.c: Fix busyloop at exit under TCL_FINALIZE_ON_EXIT - when there are unflushed nonblocking channels. Thanks Miguel for - spotting. - -2012-12-07 Jan Nijtmans - - * unix/dltest/pkgb.c: Turn pkgb.so into a Tcl9 interoperability test - library: Whatever Tcl9 looks like, loading pkgb.so in Tcl 9 should - either result in an error-message, either succeed, but never crash. - -2012-11-28 Donal K. Fellows - - * generic/tclZlib.c (ZlibStreamSubcmd): [Bug 3590483]: Use a mechanism - for complex option resolution that has fewer problems with more - finicky compilers. - -2012-11-26 Reinhard Max - - * unix/tclUnixSock.c: Factor out creation of the -sockname and - -peername lists from TcpGetOptionProc() to TcpHostPortList(). Make it - robust against implementations of getnameinfo() that error out if - reverse mapping fails instead of falling back to the numeric - representation. - -2012-11-20 Donal K. Fellows - - * generic/tclBinary.c (BinaryDecode64): [Bug 3033307]: Corrected - handling of trailing whitespace when decoding base64. Thanks to Anton - Kovalenko for reporting, and Andy Goth for the fix and tests. - -2012-11-19 Donal K. Fellows - - * generic/tclExecute.c (INST_STR_RANGE_IMM): [Bug 3588366]: Corrected - implementation of bounds restriction for end-indexed compiled [string - range]. Thanks to Emiliano Gavilan for diagnosis and fix. - -2012-11-15 Jan Nijtmans - - IMPLEMENTATION OF TIP#416 - - New Options for 'load': -global and -lazy - - * generic/tcl.h: - * generic/tclLoad.c - * unix/tclLoadDl.c - * unix/tclLoadDyld.c - * tests/load.test - * doc/Load.3 - * doc/load.n - -2012-11-14 Donal K. Fellows - - * unix/tclUnixFCmd.c (TclUnixOpenTemporaryFile): [Bug 2933003]: Factor - out all the code to do temporary file creation so that it is possible - to make it correct in one place. Allow overriding of the back-stop - default temporary file location at compile time by setting the - TCL_TEMPORARY_FILE_DIRECTORY #def to a string containing the directory - name (defaults to "/tmp" as that is the most common default). - -2012-11-13 Joe Mistachkin - - * win/tclWinInit.c: also search for the library directory (init.tcl, - encodings, etc) relative to the build directory associated with the - source checkout. - -2012-11-10 Miguel Sofer - - * generic/tclBasic.c: re-enable bcc-tailcall, after fixing an - * generic/tclExecute.c: infinite loop in the TCL_COMPILE_DEBUG mode - - -2012-11-07 Kevin B. Kenny - - * library/tzdata/Africa/Casablanca: - * library/tzdata/America/Araguaina: - * library/tzdata/America/Bahia: - * library/tzdata/America/Havana: - * library/tzdata/Asia/Amman: - * library/tzdata/Asia/Gaza: - * library/tzdata/Asia/Hebron: - * library/tzdata/Asia/Jerusalem: - * library/tzdata/Pacific/Apia: - * library/tzdata/Pacific/Fakaofo: - * library/tzdata/Pacific/Fiji: Import tzdata2012i. - -2012-11-06 Donal K. Fellows - - * library/http/http.tcl (http::Finish): [Bug 3581754]: Ensure that - callbacks are done at most once to prevent problems with timeouts on a - keep-alive connection (combined with reentrant http package use) - causing excessive stack growth. Not a fix for the underlying problem, - but ensures that pain will be mostly kept away from users. - Bump http package to 2.8.5. - -2012-11-05 Donal K. Fellows - - Added bytecode compilation of many Tcl commands. Some of these are - total compilations and some are only partial (i.e., only compile in - some cases). The (sub-)commands affected are: - * array: exists, set, unset - * dict: create, exists, merge - * format: (simple cases only) - * info: commands, coroutine, level, object - * info object: class, isa object, namespace - * namespace: current, code, qualifiers, tail, which - * regsub: (only cases convertable to simple [string map]) - * self: (only no-argument and [self object] cases) - * string: first, last, map, range - * tailcall: - * yield: - - [This was work originally done on the 'dkf-compile-misc-info' branch.] - -2012-11-05 Jan Nijtmans - - IMPLEMENTATION OF TIP#413 - - Align the [string trim] and [string is space] commands, such that - [string trim] by default trims all characters for which [string is - space] returns 1, augmented with the NUL character. - - * generic/tclUtf.c: Add NEL, BOM and two more characters to [string is - space] - * generic/tclCmdMZ.c: Modify [string trim] for Unicode modifications. - * generic/regc_locale.c: Regexp engine must match [string is space] - * doc/string.n - * tests/string.test - ***POTENTIAL INCOMPATIBILITY*** - Code that relied on characters not previously trimmed being not - removed will notice a difference; it is believed that this is rare, - but a workaround to get the behavior in Tcl 8.5 is to use " \t\n\r" as - an explicit trim set. - -2012-10-31 Jan Nijtmans - - * win/Makefile.in: Dde version number to 1.4.0, ready for Tcl 8.6.0rc1 - * win/makefile.vc - * win/tclWinDde.c - * library/dde/pkgIndex.tcl - * tests/winDde.test - -2012-10-24 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileDictUnsetCmd): Added compilation of - the [dict unset] command (for scalar var in LVT only). - -2012-10-23 Jan Nijtmans - - * generic/tclInt.h: Add "flags" parameter from Tcl_LoadFile to - * generic/tclIOUtil.c: to various internal functions, so these - * generic/tclLoadNone.c: flags are available through the whole - * unix/tclLoad*.c: filesystem for (future) internal use. - * win/tclWinLoad.c: - -2012-10-17 Miguel Sofer - - * generic/tclBasic.c (TclNRCoroutineObjCmd): insure that numlevels - are properly set, fix bug discovered by dkf and reported at - http://code.activestate.com/lists/tcl-core/12213/ - -2012-10-16 Donal K. Fellows - - IMPLEMENTATION OF TIP#405 - - New commands for applying a transformation to the elements of a list - to produce another list (the [lmap] command) and to the mappings of a - dictionary to produce another dictionary (the [dict map] command). In - both cases, a [continue] will cause the skipping of an element/pair, - and a [break] will terminate the construction early and successfully. - - * generic/tclCmdAH.c (Tcl_LmapObjCmd, TclNRLmapCmd): Implementation of - the new [lmap] command, based on (and sharing much of) [foreach]. - * generic/tclDictObj.c (DictMapNRCmd): Implementation of the new [dict - map] subcommand, based on (and sharing much of) [dict for]. - * generic/tclCompCmds.c (TclCompileLmapCmd, TclCompileDictMapCmd): - Compilation engines for [lmap] and [dict map]. - - IMPLEMENTATION OF TIP#400 - - * generic/tclZlib.c: Allow the specification of a compression - dictionary (a binary blob used to seed the compression engine) in both - streams and channel transformations. Also some reorganization to allow - for getting gzip header dictionaries and controlling buffering levels - in channel transformations (allowing a trade-off between formal - correctness and speed). - (Tcl_ZlibStreamSetCompressionDictionary): New C API to allow setting - the compression dictionary without using a Tcl script. - -2012-10-14 Jan Nijtmans - - * generic/tclDictObj.c: [Bug 3576509]: ::tcl::Bgerror crashes with - * generic/tclEvent.c: invalid arguments. Better fix, which helps - for all Tcl_DictObjGet() calls in Tcl's source code. - -2012-10-13 Jan Nijtmans - - * generic/tclEvent.c: [Bug 3576509]: tcl::Bgerror crashes with invalid - arguments - -2012-10-06 Jan Nijtmans - - * win/Makefile.in: [Bug 2459774]: tcl/win/Makefile.in not compatible - with msys 0.8. - -2012-10-03 Don Porter - - * generic/tclIO.c: When checking for std channels being closed, - compare the channel state, not the channel itself so that stacked - channels do not cause trouble. - -2012-09-26 Reinhard Max - - * generic/tclIOSock.c (TclCreateSocketAddress): Work around a bug in - getaddrinfo() on OSX that caused name resolution to fail for [socket - -server foo -myaddr localhost 0]. - -2012-09-20 Jan Nijtmans - - * win/configure.in: New import libraries for zlib 1.2.7, usable for - * win/configure: all win32/win64 compilers - * compat/zlib/win32/zdll.lib: - * compat/zlib/win64/zdll.lib: - - * win/tclWinDde.c: [FRQ 3527238]: Full unicode support for dde. Dde - version is now 1.4.0b2. - ***POTENTIAL INCOMPATIBILITY*** - -2012-09-19 Jan Nijtmans - - * generic/tcl.h: Make Tcl_Interp a fully opaque structure if - TCL_NO_DEPRECATED is set (TIP 330 and 336). - * win/nmakehlp.c: Let "nmakehlp -V" start searching digits after the - found match (suggested by Harald Oehlmann). - -2012-09-19 Harald Oehlmann - - IMPLEMENTATION OF TIP#412. - - * library/msgcat/msgcat.tcl: dynamic locale change with mc file - * library/clock.tcl: load on locale change. - clock uses new msgcat features. - -2012-09-07 Harald Oehlmann - - *** 8.6b3 TAGGED FOR RELEASE *** - - IMPLEMENTATION OF TIP#404. - - * library/msgcat/msgcat.tcl: [FRQ 3544988]: New commands [mcflset] - * library/msgcat/pkgIndex.tcl: and [mcflmset] to set mc entries with - * unix/Makefile.in: implicit message file locale. - * win/Makefile.in: Bump to 1.5.0. - -2012-08-25 Donal K. Fellows - - * library/msgs/uk.msg: [Bug 3561330]: Use the correct full name of - March in Ukrainian. Thanks to Mikhail Teterin for reporting. - -2012-08-23 Jan Nijtmans - - * generic/tclBinary.c: [Bug 3496014]: Unecessary memset() in - Tcl_SetByteArrayObj(). - -2012-08-20 Don Porter - - * generic/tclPathObj.c: [Bug 3559678]: Fix bad filename normalization - when the last component is the empty string. - -2012-08-20 Jan Nijtmans - - * win/tclWinPort.h: Remove wrapper macro for ntohs(): unnecessary, - because it doesn't require an initialized winsock_2 library. See: - - * win/tclWinSock.c: - * generic/tclStubInit.c: - -2012-08-17 Jan Nijtmans - - * win/nmakehlp.c: Add "-V" option, in order to be able to detect - partial version numbers. - -2012-08-15 Jan Nijtmans - - * win/buildall.vc.bat: Only build the threaded builds by default - * win/rules.vc: Some code cleanup - -2010-08-13 Stuart Cassoff - - * unix/tclUnixCompat.c: [Bug 3555454]: Rearrange a bit to quash - 'declared but never defined' compiler warnings. - -2012-08-13 Jan Nijtmans - - * compat/zlib/win64/zlib1.dll: Add 64-bit build of zlib1.dll, and use - * compat/zlib/win64/zdll.lib: it for the dynamic mingw-w64 build. - * win/Makefile.in: - * win/configure.in: - * win/configure: - -2012-08-09 Reinhard Max - - * tests/http.test: Fix http-3.29 for machines without IPv6 support. - -2010-08-08 Stuart Cassoff - - * unix/tclUnixCompat.c: Change one '#ifdef' to '#if defined()' for - improved consistency within the file. - -2012-08-08 Jan Nijtmans - - * generic/tclfileName.c: [Bug #1536227]: Cygwin network pathname - * tests/fileName.test: support - -2012-08-07 Don Porter - - * generic/tclIOUtil.c: [Bug 3554250]: Overlooked one field of cleanup - in the thread exit handler for the filesystem subsystem. - -2012-07-31 Donal K. Fellows - - * generic/tclInterp.c (Tcl_GetInterpPath): - * unix/tclUnixPipe.c (TclGetAndDetachPids, Tcl_PidObjCmd): - * win/tclWinPipe.c (TclGetAndDetachPids, Tcl_PidObjCmd): - Purge use of Tcl_AppendElement, and corrected conversion of PIDs to - integer objects. - -2012-07-31 Jan Nijtmans - - * win/nmakehlp.c: Add -Q option from sampleextension. - * win/Makefile.in: [FRQ 3544967]: Missing objectfiles in static lib - * win/makefile.vc: (Thanks to Jos Decoster). - -2012-07-29 Jan Nijtmans - - * win/Makefile.in: No longer build tcltest.exe to run the tests, - but use tclsh86.exe in combination with tcltest86.dll to do that. - * tests/*.test: load tcltest86.dll if necessary. - -2012-07-28 Jan Nijtmans - - * tests/clock.test: [Bug 3549770]: Multiple test failures running - * tests/registry.test: tcltest outside build tree - * tests/winDde.test: - -2012-07-27 Jan Nijtmans - - * generic/tclUniData.c: Support Unicode 6.2 (Add Turkish lira sign) - * generic/regc_locale.c: - -2012-07-25 Alexandre Ferrieux - - * win/tclWinPipe.c: [Bug 3547994]: Abandon the synchronous Windows - pipe driver to its fate when needed to honour TIP#398. - -2012-07-24 Trevor Davel - - * win/tclWinSock.c: [Bug: 3545363]: Loop over multiple underlying file - descriptors for a socket where required (TcpCloseProc, SocketProc). - Refactor socket/descriptor setup to manage linked list operations in - one place. Fix memory leak in socket close (TcpCloseProc) and related - dangling pointers in SocketEventProc. - -2012-07-19 Reinhard Max - - * win/tclWinSock.c (TcpAccept): [Bug: 3545363]: Use a large enough - buffer for accept()ing IPv6 connections. Fix conversion of host and - port for passing to the accept proc to be independent of the IP - version. - -2012-07-23 Alexandre Ferrieux - - * generic/tclIO.c: [Bug 3545365]: Never try a bg-flush on a dead - channel, just like before 2011-08-17. - -2012-07-19 Joe Mistachkin - - * generic/tclTest.c: Fix several more missing mutex-locks in - TestasyncCmd. - -2012-07-19 Alexandre Ferrieux - - * generic/tclTest.c: [Bug 3544685]: Missing mutex-lock in - TestasyncCmd since 2011-08-19. Unbounded gratitude to Stuart - Cassoff for spotting it. - -2012-07-17 Jan Nijtmans - - * win/makefile.vc: [Bug 3544932]: Visual studio compiler check fails - -2012-07-16 Donal K. Fellows - - * generic/tclUtil.c (UpdateStringOfEndOffset): [Bug 3544658]: Stop - 1-byte overrun in memcpy, that object placement rules made harmless - but which still caused compiler complaints. - -2012-07-16 Jan Nijtmans - - * library/reg/pkgIndex.tcl: Make registry 1.3 package dynamically - loadable when ::tcl::pkgconfig is available. - -2012-07-11 Jan Nijtmans - - * win/tclWinReg.c: [Bug 3362446]: registry keys command fails - with 8.5/8.6. Follow Microsofts example better in order to prevent - problems when using HKEY_PERFORMANCE_DATA. - -2012-07-10 Jan Nijtmans - - * unix/tclUnixNotfy.c: [Bug 3541646]: Don't panic on triggerPipe - overrun. - -2012-07-10 Donal K. Fellows - - * win/tclWinSock.c (InitializeHostName): Corrected logic that - extracted the name of the computer from the gethostname call so that - it would use the name on success, not failure. Also ensured that the - buffer size is exactly that recommended by Microsoft. - -2012-07-08 Reinhard Max - - * library/http/http.tcl: [Bug 3531209]: Add fix and test for URLs that - * tests/http.test: contain literal IPv6 addresses. - -2012-07-05 Don Porter - - * unix/tclUnixPipe.c: [Bug 1189293]: Make "<<" binary safe. - * win/tclWinPipe.c: - -2012-07-03 Donal K. Fellows - - * generic/tclUtil.c (TclDStringAppendObj, TclDStringAppendDString): - * generic/tclInt.h (TclDStringAppendLiteral, TclDStringClear): - * generic/tclCompile.h (TclDStringAppendToken): Added wrappers to make - common cases of appending to Tcl_DStrings simpler to write. Prompted - by looking at [FRQ 1357401] (these are an _internal_ implementation of - that FRQ). - -2012-06-29 Jan Nijtmans - - * library/msgcat/msgcat.tcl: Add tn, ro_MO and ru_MO to msgcat. - -2012-06-29 Harald Oehlmann - - * library/msgcat/msgcat.tcl: [Bug 3536888]: Locale guessing of - * library/msgcat/pkgIndex.tcl: msgcat fails on (some) Windows 7. Bump - * unix/Makefile.in: to 1.4.5 - * win/Makefile.in: - -2012-06-29 Donal K. Fellows - - * doc/GetIndex.3: Reinforced the description of the requirement for - the tables of names to index over to be static, following posting to - tcl-core by Brian Griffin about a bug caused by Tktreectrl not obeying - this rule correctly. This does not represent a functionality change, - merely a clearer documentation of a long-standing constraint. - -2012-06-26 Jan Nijtmans - - * unix/tcl.m4: Let Cygwin shared build link with - * unix/configure.in: zlib1.dll, not cygz.dll (two less - * unix/configure: dependencies on cygwin-specific dll's) - * unix/Makefile.in: - -2012-06-26 Reinhard Max - - * generic/tclIOSock.c: Use EAI_SYSTEM only if it exists. - * unix/tclUnixSock.c: - -2012-06-25 Don Porter - - * generic/tclFileSystem.h: [Bug 3024359]: Make sure that the - * generic/tclIOUtil.c: per-thread cache of the list of file systems - * generic/tclPathObj.c: currently registered is only updated at times - when no active loops are traversing it. Also reduce the amount of - epoch storing and checking to where it can make a difference. - -2012-06-25 Donal K. Fellows - - * generic/tclCmdAH.c (EncodingDirsObjCmd): [Bug 3537605]: Do the right - thing when reporting errors with the number of arguments. - -2012-06-25 Jan Nijtmans - - * generic/tclfileName.c: [Patch 1536227]: Cygwin network pathname - * tests/fileName.test: support. - -2012-06-23 Jan Nijtmans - - * unix/tclUnixNotfy.c: [Bug 3508771]: Cygwin notifier for handling - win32 events. - -2012-06-22 Reinhard Max - - * generic/tclIOSock.c: Rework the error message generation of [socket], - * unix/tclUnixSock.c: so that the error code of getaddrinfo is used - * win/tclWinSock.c: instead of errno unless it is EAI_SYSTEM. - -2012-06-21 Jan Nijtmans - - * win/tclWinReg.c: [Bug 3362446]: registry keys command fails - * tests/registry.test: with 8.5/8.6 - -2012-06-11 Don Porter - - * generic/tclBasic.c: [Bug 3532959]: Make sure the lifetime - * generic/tclProc.c: management of entries in the linePBodyPtr - * tests/proc.test: hash table can tolerate either order of - teardown, interp first, or Proc first. - -2012-06-08 Don Porter - - * unix/configure.in: Update autogoo for gettimeofday(). - * unix/tclUnixPort.h: Thanks Joe English. - * unix/configure: autoconf 2.13 - - * unix/tclUnixPort.h: [Bug 3530533]: Centralize #include - * unix/tclUnixThrd.c: in the tclUnixPort.h header so that old unix - systems that need inclusion in all compilation units are supported. - -2012-06-08 Jan Nijtmans - - * win/tclWinDde.c: Revise the "null data" check: null strings are - possible, but empty binary arrays are not. - * tests/winDde.test: Add test-case (winDde-9.4) for transferring - null-strings with dde. Convert tests to tcltest-2 syntax. - -2012-06-06 Donal K. Fellows - - * generic/tclZlib.c (TclZlibInit): Declare that Tcl is publishing the - zlib package (version 2.0) as part of its bootstrap process. This will - have an impact on tclkit (which includes zlib 1.1) but otherwise be - very low impact. - -2012-06-06 Jan Nijtmans - - * unix/tclUnixInit.c: On Cygwin, use win32 API in stead of uname() - to determine the tcl_platform variables. - -2012-05-31 Jan Nijtmans - - * generic/tclZlib.c: [Bug 3530536]: zlib-7.4 fails on IRIX64 - * tests/zlib.test: - * doc/zlib.n: Document that [stream checksum] doesn't do - what's expected for "inflate" and "deflate" formats - -2012-05-31 Donal K. Fellows - - * library/safe.tcl (safe::AliasFileSubcommand): Don't assume that - slaves have corresponding commands, as that is not true for - sub-subinterpreters (used in Tk's test suite). - - * doc/safe.n: [Bug 1997845]: Corrected formatting so that generated - HTML can link properly. - - * tests/socket.test (socket*-13.1): Prevented intermittent test - failure due to race condition. - -2012-05-29 Donal K. Fellows - - * doc/expr.n, doc/mathop.n: [Bug 2931407]: Clarified semantics of - division and remainder operators. - -2012-05-29 Jan Nijtmans - - * win/tclWinDde.c: [Bug 3525762]: Encoding handling in dde. - * win/Makefile.in: Fix "make genstubs" when cross-compiling on UNIX - -2012-05-28 Donal K. Fellows - - * library/safe.tcl (safe::AliasFileSubcommand): [Bug 3529949]: Made a - more sophisticated method for preventing information leakage; it - changes references to "~user" into "./~user", which is safe. - -2012-05-25 Donal K. Fellows - - * doc/namespace.n, doc/Ensemble.3: [Bug 3528418]: Document what is - going on with respect to qualification of command prefixes in ensemble - subcommand maps. - - * generic/tclIO.h (SYNTHETIC_EVENT_TIME): Factored out the definition - of the amount of time that should be waited before firing a synthetic - event on a channel. - -2012-05-25 Jan Nijtmans - - * win/tclWinDde.c: [Bug 473946]: Special characters were not correctly - sent, now for XTYP_EXECUTE as well as XTYP_REQUEST. - * win/Makefile.in: Fix "make genstubs" when cross-compiling on UNIX - -2012-05-24 Jan Nijtmans - - * tools/genStubs.tcl: Take cygwin handling of X11 into account. - * generic/tcl*Decls.h: re-generated - * generic/tclStubInit.c: Implement TclpIsAtty, Cygwin only. - * doc/dde.n: Doc fix: "dde execute iexplore" doesn't work - without -async, because iexplore doesn't return a value - -2012-05-24 Jan Nijtmans - - * tools/genStubs.tcl: Let cygwin share stub table with win32 - * win/tclWinSock.c: implement TclpInetNtoa for win32 - * generic/tclInt.decls: Revert most of [3caedf05df], since when - we let cygwin share the win32 stub table this is no longer necessary - * generic/tcl*Decls.h: re-generated - * doc/dde.n: 1.3 -> 1.4 - -2012-05-23 Donal K. Fellows - - * generic/tclZlib.c (ZlibTransformInput): [Bug 3525907]: Ensure that - decompressed input is flushed through the transform correctly when the - input stream gets to the end. Thanks to Alexandre Ferrieux and Andreas - Kupries for their work on this. - -2012-05-21 Don Porter - - * generic/tclFileName.c: When using Tcl_SetObjLength() calls to - * generic/tclPathObj.c: grow and shrink the objPtr->bytes - buffer, care must be taken that the value cannot possibly become pure - Unicode. Calling Tcl_AppendToObj() has the possibility of making such - a conversion. Bug found while valgrinding the trunk. - -2012-05-21 Jan Nijtmans - - IMPLEMENTATION OF TIP#106 - - * win/tclWinDde.c: Added encoding-related abilities to - * library/dde/pkgIndex.tcl: the [dde] command. The dde package's - * tests/winDde.test: version is now 1.4.0. - * doc/dde.n: - -2012-05-20 Donal K. Fellows - - * generic/tclOOBasic.c (TclOO_Class_Constructor): [Bug 2023112]: Cut - the amount of hackiness in class constructors, and refactor some of - the error message handling from [oo::define] to be saner in the face - of odd happenings. - -2012-05-17 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): [Bug 3106532]: Corrected - resulting indexes from -indexvar option to be usable with [string - range]; this was always the intention (and is consistent with [regexp - -indices] too). - ***POTENTIAL INCOMPATIBILITY*** - Uses of [switch -regexp -indexvar] that previously compensated for the - wrong offsets (by subtracting 1 from the end indices) now do not need - to do so as the value is correct. - - * library/safe.tcl (safe::InterpInit): Ensure that the module path is - constructed in the correct order. - (safe::AliasGlob): [Bug 2964715]: More extensive handling of what - globbing is required to support package loading. - - * doc/expr.n: [Bug 3525462]: Corrected statement about what happens - when comparing "0y" and "0x12"; the previously documented behavior was - actually a subtle bug (now long-corrected). - -2012-05-16 Donal K. Fellows - - * generic/tclCmdAH.c (TclMakeFileCommandSafe): [Bug 3445787]: Improve - the compatibility of safe interpreters' version of 'file' with that of - unsafe interpreters. - * library/safe.tcl (::safe::InterpInit): Teach the safe-interp scripts - about how to expose 'file' properly. - -2012-05-13 Jan Nijtmans - - * win/tclWinDde.c: Protect against receiving strings without ending - \0, as external applications (or Tcl with TIP #106) could generate - that. - -2012-05-10 Jan Nijtmans - - * win/tclWinDde.c: [Bug 473946]: Special characters not correctly sent - * library/dde/pkgIndex.tcl: Increase version to 1.3.3 - -2012-05-10 Alexandre Ferrieux - - * {win,unix}/configure{,.in}: [Bug 2812981]: Clean up bundled - packages' build directory from within Tcl's ./configure, to avoid - stale configuration. - -2012-05-09 Andreas Kupries - - * generic/tclIORChan.c: [Bug 3522560]: Fixed the crash, enabled the - test case. Modified [chan postevent] to properly inject the event(s) - into the owner thread's event queue for execution in the correct - context. Renamed the ForwardOpTo...Thread() function to match with our - terminology. - - * tests/ioCmd.test: [Bug 3522560]: Added a test which crashes the core - if it were not disabled as knownBug. For a reflected channel - transfered to a different thread the [chan postevent] run in the - handler thread tries to execute the owner threads's fileevent scripts - by itself, wrongly reaching across thread boundaries. - -2012-04-28 Alexandre Ferrieux - - * generic/tclIO.c: Properly close nonblocking channels even when - not flushing them. - -2012-05-03 Jan Nijtmans - - * compat/zlib/*: Upgrade to zlib 1.2.7 (pre-built dll is still 1.2.5, - will be upgraded as soon as the official build is available) - -2012-05-03 Don Porter - - * tests/socket.test: [Bug 3428754]: Test socket-14.2 tolerate - [socket -async] connection that connects synchronously. - - * unix/tclUnixSock.c: [Bug 3428753]: Fix [socket -async] connections - that manage to connect synchronously. - -2012-05-02 Jan Nijtmans - - * generic/configure.in: Better detection and implementation for - * generic/configure: cpuid instruction on Intel-derived - * generic/tclUnixCompat.c: processors, both 32-bit and 64-bit. - * generic/tclTest.c: Move cpuid testcase from win-specific to - * win/tclWinTest.c: generic tests, as it should work on all - * tests/platform.test: Intel-related platforms now. - -2012-04-30 Alexandre Ferrieux - - * tests/ioCmd.test: [Bug 3522560]: Tame deadlocks in broken refchan - tests. - -2012-04-28 Alexandre Ferrieux - - IMPLEMENTATION OF TIP#398 - - * generic/tclIO.c: Quickly Exit with Non-Blocking Blocked Channels - * tests/io.test : *** POTENTIAL INCOMPATIBILITY *** - * doc/close.n : (compat flag available) - -2012-04-27 Jan Nijtmans - - * generic/tclPort.h: Move CYGWIN-specific stuff from tclPort.h to - * generic/tclEnv.c: tclUnixPort.h, where it belongs. - * unix/tclUnixPort.h: - * unix/tclUnixFile.c: - -2012-04-27 Donal K. Fellows - - * library/init.tcl (auto_execok): Allow shell builtins to be detected - even if they are upper-cased. - -2012-04-26 Jan Nijtmans - - * generic/tclStubInit.c: Get rid of _ANSI_ARGS_ and CONST - * generic/tclIO.c: - * generic/tclIOCmd.c: - * generic/tclTest.c: - * unix/tclUnixChan.c: - -2012-04-25 Donal K. Fellows - - * generic/tclUtil.c (TclDStringToObj): Added internal function to make - the fairly-common operation of converting a DString into an Obj a more - efficient one; for long strings, it can just transfer the ownership of - the buffer directly. Replaces this: - obj=Tcl_NewStringObj(Tcl_DStringValue(&ds),Tcl_DStringLength(&ds)); - Tcl_DStringFree(&ds); - with this: - obj=TclDStringToObj(&ds); - -2012-04-24 Jan Nijtmans - - * generic/tclInt.decls: [Bug 3508771]: load tclreg.dll in cygwin - tclsh - * generic/tclIntPlatDecls.h: Implement TclWinGetSockOpt, - * generic/tclStubInit.c: TclWinGetServByName and TclWinCPUID for - * generic/tclUnixCompat.c: Cygwin. - * unix/configure.in: - * unix/configure: - * unix/tclUnixCompat.c: - -2012-04-18 Kevin B. Kenny - - * library/tzdata/Africa/Casablanca: - * library/tzdata/America/Port-au-Prince: - * library/tzdata/Asia/Damascus: - * library/tzdata/Asia/Gaza: - * library/tzdata/Asia/Hebron: tzdata2012c - -2012-04-16 Donal K. Fellows - - * doc/FileSystem.3 (Tcl_FSOpenFileChannelProc): [Bug 3518244]: Fixed - documentation of this filesystem callback function; it must not - register its created channel - that's the responsibility of the caller - of Tcl_FSOpenFileChannel - as that leads to reference leaks. - -2012-04-15 Donal K. Fellows - - * generic/tclEnsemble.c (NsEnsembleImplementationCmdNR): - * generic/tclIOUtil.c (Tcl_FSEvalFileEx): Cut out levels of the C - stack by going direct to the relevant internal evaluation function. - - * generic/tclZlib.c (ZlibTransformSetOption): [Bug 3517696]: Make - flushing work correctly in a pushed compressing channel transform. - -2012-04-12 Jan Nijtmans - - * generic/tclInt.decls: [Bug 3514475]: Remove TclpGetTimeZone and - * generic/tclIntDecls.h: TclpGetTZName - * generic/tclIntPlatDecls.h: - * generic/tclStubInit.c: - * unix/tclUnixTime.c: - * unix/tclWinTilemc: - -2012-04-11 Jan Nijtmans - - * win/tclWinInit.c: [Bug 3448512]: clock scan "1958-01-01" fails - * win/tcl.m4: only in debug compilation. - * win/configure: - * unix/tcl.m4: Use NDEBUG consistantly meaning: no debugging. - * unix/configure: - * generic/tclBasic.c: - * library/dde/pkgIndex.tcl: Use [::tcl::pkgconfig get debug] instead - * library/reg/pkgIndex.tcl: of [info exists ::tcl_platform(debug)] - -2012-04-10 Donal K. Fellows - - * generic/tcl.h (TCL_DEPRECATED_API): [Bug 2458976]: Added macro that - can be used to mark parts of Tcl's API as deprecated. Currently only - used for fields of Tcl_Interp, which TIPs 330 and 336 have deprecated - with a migration strategy; we want to encourage people to move away - from those fields. - -2012-04-09 Donal K. Fellows - - * generic/tclOODefineCmds.c (ClassVarsSet, ObjVarsSet): [Bug 3396896]: - Ensure that the lists of variable names used to drive variable - resolution will never have the same name twice. - - * generic/tclVar.c (AppendLocals): [Bug 2712377]: Fix problem with - reporting of declared variables in methods. It's really a problem with - how [info vars] interacts with variable resolvers; this is just a bit - of a hack so it is no longer a big problem. - -2012-04-04 Donal K. Fellows - - * generic/tclOO.c (Tcl_NewObjectInstance, TclNRNewObjectInstance): - [Bug 3514761]: Fixed bogosity with automated argument description - handling when constructing an instance of a class that is itself a - member of an ensemble. Thanks to Andreas Kupries for identifying that - this was a problem case at all! - (Tcl_CopyObjectInstance): Fix potential bleed-over of ensemble - information into [oo::copy]. - -2012-04-04 Jan Nijtmans - - * win/tclWinSock.c: [Bug 510001]: TclSockMinimumBuffers needs - * generic/tclIOSock.c: platform implementation. - * generic/tclInt.decls: - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - -2012-04-03 Jan Nijtmans - - * generic/tclStubInit.c: Remove the TclpGetTZName implementation for - * generic/tclIntDecls.h: Cygwin (from 2012-04-02 commit), re-generated - * generic/tclIntPlatDecls.h: - -2012-04-02 Donal K. Fellows - - IMPLEMENTATION OF TIP#396. - - * generic/tclBasic.c (builtInCmds, TclNRYieldToObjCmd): Convert the - formerly-unsupported yieldm and yieldTo commands into [yieldto]. - -2012-04-02 Jan Nijtmans - - * generic/tclInt.decls: [Bug 3508771]: load tclreg.dll in cygwin tclsh - * generic/tclIntPlatDecls.h: Implement TclWinGetTclInstance, - * generic/tclStubInit.c: TclpGetTZName, and various more - win32-specific internal functions for Cygwin, so win32 extensions - using those can be loaded in the cygwin version of tclsh. - -2012-03-30 Jan Nijtmans - - * unix/tcl.m4: [Bug 3511806]: Compiler checks too early - * unix/configure.in: This change allows to build the cygwin and - * unix/tclUnixPort.h: mingw32 ports of Tcl/Tk to build out-of-the-box - * win/tcl.m4: using a native or cross-compiler. - * win/configure.in: - * win/tclWinPort.h: - * win/README Document how to build win32 or win64 executables - with Linux, Cygwin or Darwin. - -2012-03-29 Jan Nijtmans - - * generic/tclCmdMZ.c (StringIsCmd): Faster mem-leak free - implementation of [string is entier]. - -2012-03-27 Donal K. Fellows - - IMPLEMENTATION OF TIP#395. - - * generic/tclCmdMZ.c (StringIsCmd): Implementation of the [string is - entier] check. Code by Jos Decoster. - -2012-03-27 Jan Nijtmans - - * generic/tcl.h: [Bug 3508771]: Wrong Tcl_StatBuf used on MinGW. - * generic/tclFCmd.c: [Bug 2015723]: Duplicate inodes from file stat - * generic/tclCmdAH.c: on windows (but now for cygwin as well). - * generic/tclOODefineCmds.c: minor gcc warning - * win/tclWinPort.h: Use lower numbers, preventing integer overflow. - Remove the workaround for mingw-w64 [Bug 3407992]. It's long fixed. - -2012-03-27 Donal K. Fellows - - IMPLEMENTATION OF TIP#397. - - * generic/tclOO.c (Tcl_CopyObjectInstance): [Bug 3474460]: Make the - target object name optional when copying classes. [RFE 3485060]: Add - callback method ("") so that scripted control over copying is - easier. - ***POTENTIAL INCOMPATIBILITY*** - If you'd previously been using the "" method name, this now - has a standard semantics and call interface. Only a problem if you are - also using [oo::copy]. - -2012-03-26 Donal K. Fellows - - IMPLEMENTATION OF TIP#380. - - * doc/define.n, doc/object.n, generic/tclOO.c, generic/tclOOBasic.c: - * generic/tclOOCall.c, generic/tclOODefineCmds.c, generic/tclOOInt.h: - * tests/oo.test: Switch definitions of lists of things in objects and - classes to a slot-based approach, which gives a lot more flexibility - and programmability at the script-level. Introduce new [::oo::Slot] - class which is the implementation of these things. - - ***POTENTIAL INCOMPATIBILITY*** - The unknown method handler now may be asked to deal with the case - where no method name is provided at all. The default implementation - generates a compatible error message, and any override that forces the - presence of a first argument (i.e., a method name) will continue to - function as at present as well, so this is a pretty small change. - - * generic/tclOOBasic.c (TclOO_Object_Destroy): Made it easier to do a - tailcall inside a normally-invoked destructor; prevented leakage out - to calling command. - -2012-03-25 Jan Nijtmans - - * generic/tclInt.decls: [Bug 3508771]: load tclreg.dll in cygwin - * generic/tclIntPlatDecls.h: tclsh. Implement TclWinConvertError, - * generic/tclStubInit.c: TclWinConvertWSAError, and various more - * unix/Makefile.in: win32-specific internal functions for - * unix/tcl.m4: Cygwin, so win32 extensions using those - * unix/configure: can be loaded in the cygwin version of - * win/tclWinError.c: tclsh. - -2012-03-23 Jan Nijtmans - - * generic/tclInt.decls: Revert some cygwin-related signature - * generic/tclIntPlatDecls.h: changes from [835f8e1e9d] (2010-01-22). - * win/tclWinError.c: They were an attempt to make the cygwin - port compile again, but since cygwin is - based on unix this serves no purpose any - more. - * win/tclWinSerial.c: Use EAGAIN in stead of EWOULDBLOCK, - * win/tclWinSock.c: because in VS10+ the value of - EWOULDBLOCK is no longer the same as - EAGAIN. - * unix/Makefile.in: Add tclWinError.c to the CYGWIN build. - * unix/tcl.m4: - * unix/configure: - -2012-03-20 Jan Nijtmans - - * generic/tcl.decls: [Bug 3508771]: load tclreg.dll in cygwin - * generic/tclInt.decls: tclsh. Implement TclWinGetPlatformId, - * generic/tclIntPlatDecls.h: Tcl_WinUtfToTChar, Tcl_WinTCharToUtf (and - * generic/tclPlatDecls.h: a dummy TclWinCPUID) for Cygwin, so win32 - * generic/tclStubInit.c: extensions using those can be loaded in - * unix/tclUnixCompat.c: the cygwin version of tclsh. - -2012-03-19 Venkat Iyer - - * library/tzdata/America/Atikokan: Update to tzdata2012b. - * library/tzdata/America/Blanc-Sablon: - * library/tzdata/America/Dawson_Creek: - * library/tzdata/America/Edmonton: - * library/tzdata/America/Glace_Bay: - * library/tzdata/America/Goose_Bay: - * library/tzdata/America/Halifax: - * library/tzdata/America/Havana: - * library/tzdata/America/Moncton: - * library/tzdata/America/Montreal: - * library/tzdata/America/Nipigon: - * library/tzdata/America/Rainy_River: - * library/tzdata/America/Regina: - * library/tzdata/America/Santiago: - * library/tzdata/America/St_Johns: - * library/tzdata/America/Swift_Current: - * library/tzdata/America/Toronto: - * library/tzdata/America/Vancouver: - * library/tzdata/America/Winnipeg: - * library/tzdata/Antarctica/Casey: - * library/tzdata/Antarctica/Davis: - * library/tzdata/Antarctica/Palmer: - * library/tzdata/Asia/Yerevan: - * library/tzdata/Atlantic/Stanley: - * library/tzdata/Pacific/Easter: - * library/tzdata/Pacific/Fakaofo: - * library/tzdata/America/Creston: (new) - -2012-03-19 Reinhard Max - - * unix/tclUnixSock.c (Tcl_OpenTcpServer): Use the values returned - by getaddrinfo() for all three arguments to socket() instead of - only using ai_family. Try to keep the most meaningful error while - iterating over the result list, because using the last error can - be misleading. - -2012-03-15 Jan Nijtmans - - * generic/tcl.h: [Bug 3288345]: Wrong Tcl_StatBuf used on Cygwin - * unix/tclUnixFile.c: - * unix/tclUnixPort.h: - * win/cat.c: Remove cygwin stuff no longer needed - * win/tclWinFile.c: - * win/tclWinPort.h: - -2012-03-12 Jan Nijtmans - - * win/tclWinFile.c: [Bug 3388350]: mingw64 compiler warnings - -2012-03-11 Donal K. Fellows - - * doc/*.n, doc/*.3: A number of small spelling and wording fixes. - -2012-03-08 Donal K. Fellows - - * doc/info.n: Various minor fixes (prompted by Andreas Kupries - * doc/socket.n: detecting a spelling mistake). - -2012-03-07 Andreas Kupries - - * library/http/http.tcl: [Bug 3498327]: Generate upper-case - * library/http/pkgIndex.tcl: hexadecimal output for compliance - * tests/http.test: with RFC 3986. Bumped version to 2.8.4. - * unix/Makefile.in: - * win/Makefile.in: - -2012-03-06 Jan Nijtmans - - * win/tclWinPort.h: Compatibility with older Visual Studio versions. - -2012-03-04 Jan Nijtmans - - * generic/tclLoad.c: Patch from the cygwin folks - * unix/tcl.m4: - * unix/configure: (re-generated) - -2012-03-02 Donal K. Fellows - - * generic/tclBinary.c (Tcl_SetByteArrayObj): [Bug 3496014]: Only zero - out the memory block if it is not being immediately overwritten. (Our - caller might still overwrite, but we should at least avoid - known-useless work.) - -2012-02-29 Jan Nijtmans - - * generic/tclIOUtil.c: [Bug 3466099]: BOM in Unicode - * generic/tclEncoding.c: - * tests/source.test: - -2012-02-23 Donal K. Fellows - - * tests/reg.test (14.21-23): Add tests relating to Bug 1115587. Actual - bug is characterised by test marked with 'knownBug'. - -2012-02-17 Jan Nijtmans - - * generic/tclIOUtil.c: [Bug 2233954]: AIX: compile error - * unix/tclUnixPort.h: - -2012-02-16 Donal K. Fellows - - * generic/tclExecute.c (INST_LIST_RANGE_IMM): Enhance implementation - so that shortening a (not multiply-referenced) list by lopping the end - off with [lrange] or [lreplace] is efficient. - -2012-02-15 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileLreplaceCmd): Added a compilation - strategy for [lreplace] that tackles the cases which are equivalent to - a static [lrange]. - (TclCompileLrangeCmd): Add compiler for [lrange] with constant indices - so we can take advantage of existing TCL_LIST_RANGE_IMM opcode. - (TclCompileLindexCmd): Improve coverage of constant-index-style - compliation using technique developed for [lrange] above. - - (TclCompileDictForCmd): [Bug 3487626]: Fix crash in compilation of - [dict for] when its implementation command is used directly rather - than through the ensemble. - -2012-02-09 Don Porter - - * generic/tclStringObj.c: Converted the memcpy() calls in append - operations to memmove() calls. This adds safety in the case of - overlapping copies, and improves performance on some benchmarks. - -2012-02-06 Don Porter - - * generic/tclEnsemble.c: [Bug 3485022]: TclCompileEnsemble() avoid - * tests/trace.test: compile when exec traces set. - -2012-02-06 Miguel Sofer - - * generic/tclTrace.c: [Bug 3484621]: Ensure that execution traces on - * tests/trace.test: bytecoded commands bump the interp's compile - epoch. - -2012-02-02 Jan Nijtmans - - * generic/tclUniData.c: [FRQ 3464401]: Support Unicode 6.1 - * generic/regc_locale.c: - -2012-02-02 Don Porter - - * win/tclWinFile.c: [Bugs 2974459,2879351,1951574,1852572, - 1661378,1613456]: Revisions to the NativeAccess() routine that queries - file permissions on Windows native filesystems. Meant to fix numerous - bugs where [file writable|readable|executable] "lies" about what - operations are possible, especially when the file resides on a Samba - share. - -2012-02-01 Donal K. Fellows - - * doc/AddErrInfo.3: [Bug 3482614]: Documentation nit. - -2012-01-30 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileCatchCmd): Added a more efficient - bytecode generator for the case where 'catch' is used without any - variable arguments; don't capture the result just to discard it. - -2012-01-26 Don Porter - - * generic/tclCmdAH.c: [Bug 3479689]: New internal routine - * generic/tclFCmd.c: TclJoinPath(). Refactor all the - * generic/tclFileName.c: *Join*Path* routines to give them more - * generic/tclInt.h: useful interfaces that are easier to - * generic/tclPathObj.c: manage getting the refcounts right. - -2012-01-26 Don Porter - - * generic/tclPathObj.c: [Bug 3475569]: Add checks for unshared values - before calls demanding them. [Bug 3479689]: Stop memory corruption - when shimmering 0-refCount value to "path" type. - -2012-01-25 Donal K. Fellows - - * generic/tclOO.c (Tcl_CopyObjectInstance): [Bug 3474460]: When - copying an object, make sure that the configuration of the variable - resolver is also duplicated. - -2012-01-22 Jan Nijtmans - - * tools/uniClass.tcl: [FRQ 3473670]: Various Unicode-related - * tools/uniParse.tcl: speedups/robustness. Enhanced tools to be - * generic/tclUniData.c: able to handle characters > 0xffff. Done in - * generic/tclUtf.c: all branches in order to simplify merges for - * generic/regc_locale.c: new Unicode versions (such as 6.1) - -2012-01-22 Donal K. Fellows - - * generic/tclDictObj.c (DictExistsCmd): [Bug 3475264]: Ensure that - errors only ever happen when insufficient arguments are supplied, and - not when a path doesn't exist or a dictionary is poorly formatted (the - two cases can't be easily distinguished). - -2012-01-21 Jan Nijtmans - - * generic/tcl.h: [Bug 3474726]: Eliminate detection of struct - * generic/tclWinPort.h: _stat32i64, just use _stati64 in combination - * generic/tclFCmd.c: with _USE_32BIT_TIME_T, which is the same - * generic/tclTest.c: then. Only keep _stat32i64 usage for cygwin, - * win/configure.in: so it will not conflict with cygwin's own - * win/configure: struct stat. - -2012-01-21 Don Porter - - * generic/tclCmdMZ.c: [Bug 3475667]: Prevent buffer read overflow. - Thanks to "sebres" for the report and fix. - -2012-01-17 Donal K. Fellows - - * doc/dict.n (dict with): [Bug 3474512]: Explain better what is going - on when a dictionary key and the dictionary variable collide. - -2012-01-13 Donal K. Fellows - - * library/http/http.tcl (http::Connect): [Bug 3472316]: Ensure that we - only try to read the socket error exactly once. - -2012-01-12 Donal K. Fellows - - * doc/tclvars.n: [Bug 3466506]: Document more environment variables. - -2012-01-09 Jan Nijtmans - - * generic/tclUtf.c: [Bug 3464428]: [string is graph \u0120] was - * generic/regc_locale.c: wrong. Add table for Unicode [:cntrl:] class. - * tools/uniClass.tcl: Generate Unicode [:cntrl:] class table. - * tests/utf.test: - -2012-01-08 Kevin B. Kenny - - * library/clock.tcl (ReadZoneinfoFile): [Bug 3470928]: Corrected a bug - * tests/clock.test (clock-56.4): where loading zoneinfo would - fail if one timezone abbreviation was a proper tail of another, and - zic used the same bytes of the file to represent both of them. Added a - test case for the bug, using the same data that caused the observed - failure "in the wild." - -2011-12-30 Venkat Iyer - - * library/tzdata/America/Bahia: Update to Olson's tzdata2011n - * library/tzdata/America/Havana: - * library/tzdata/Europe/Kiev: - * library/tzdata/Europe/Simferopol: - * library/tzdata/Europe/Uzhgorod: - * library/tzdata/Europe/Zaporozhye: - * library/tzdata/Pacific/Fiji: - -2011-12-23 Jan Nijtmans - - * generic/tclUtf.c: [Bug 3464428]: [string is graph \u0120] is wrong. - * generic/tclUniData.c: - * generic/regc_locale.c: - * tests/utf.test: - * tools/uniParse.tcl: Clean up some unused stuff, and be more robust - against changes in UnicodeData.txt syntax - -2011-12-13 Andreas Kupries - - * generic/tclCompile.c (TclInitAuxDataTypeTable): Extended to register - the DictUpdateInfo structure as an AuxData type. For use by tbcload, - tclcompiler. - -2011-12-11 Jan Nijtmans - - * generic/regc_locale.c: [Bug 3457031]: Some Unicode 6.0 chars not - * tests/utf.test: in [:print:] class - -2011-12-07 Jan Nijtmans - - * tools/uniParse.tcl: [Bug 3444754]: string tolower \u01c5 is wrong - * generic/tclUniData.c: - * tests/utf.test: - -2011-11-30 Jan Nijtmans - - * library/tcltest/tcltest.tcl: [Bug 967195]: Make tcltest work - when tclsh is compiled without using the setargv() function on mingw. - -2011-11-29 Jan Nijtmans - - * win/Makefile.in: don't install tommath_(super)?class.h - * unix/Makefile.in: don't install directories like 8.2 and 8.3 - * generic/tclTomMath.h: [Bug 2991415]: move include tclInt.h from - * generic/tclTomMathInt.h: tclTomMath.h to tclTomMathInt.h - -2011-11-25 Donal K. Fellows - - * library/history.tcl (history): Simplify the dance of variable - management used when chaining to the implementation command. - -2011-11-22 Donal K. Fellows - - * generic/tclExecute.c (TclCompileObj): Simplify and de-indent the - logic so that it is easier to comprehend. - -2011-11-22 Jan Nijtmans - - * win/tclWinPort.h: [Bug 3354324]: Windows: [file mtime] sets wrong - * win/tclWinFile.c: time (VS2005+ only). - * generic/tclTest.c: - -2011-11-20 Joe Mistachkin - - * tests/thread.test: Remove unnecessary [after] calls from the thread - tests. Make error message matching more robust for tests that may - have built-in race conditions. Test thread-7.26 must first unset all - thread testing related variables. Revise results of the thread-7.28 - through thread-7.31 tests to account for the fact they are canceled - via a script sent to the thread asynchronously, which then impacts the - error message handling. Attempt to manually drain the event queue for - the main thread after joining the test thread to make sure no stray - events are processed at the wrong time on the main thread. Revise all - the synchronization and comparison semantics related to the thread id - and error message. - -2011-11-18 Joe Mistachkin - - * tests/thread.test: Remove all use of thread::release from the thread - 7.x tests, replacing it with a script that can easily cause "stuck" - threads to self-destruct for those test cases that require it. Also, - make the error message handling far more robust by keeping track of - every asynchronous error. - -2011-11-17 Joe Mistachkin - - * tests/thread.test: Refactor all the remaining thread-7.x tests that - were using [testthread]. Note that this test file now requires the - very latest version of the Thread package to pass all tests. In - addition, the thread-7.18 and thread-7.19 tests have been flagged as - knownBug because they cannot pass without modifications to the [expr] - command, persuant to TIP #392. - -2011-11-17 Joe Mistachkin - - * generic/tclThreadTest.c: For [testthread cancel], avoid creating a - new Tcl_Obj when the default script cancellation result is desired. - -2011-11-11 Donal K. Fellows - - * win/tclWinConsole.c: Refactor common thread handling patterns. - -2011-11-11 Alexandre Ferrieux - - * tests/zlib.test: [Bug 3428756]: Use nonblocking writes in - single-threaded IO tests to avoid deadlocks when going beyond OS - buffers. Tidy up [chan configure] flags across zlib.test. - -2011-11-03 Donal K. Fellows - - * unix/tclUnixCompat.c (TclpGetPwNam, TclpGetPwUid, TclpGetGrNam) - (TclpGetGrGid): Use the elaborate memory management scheme outlined on - http://www.opengroup.org/austin/docs/austin_328.txt to handle Tcl's - use of standard reentrant versions of the passwd/group access - functions so that everything can work on all BSDs. Problem identified - by Stuart Cassoff. - -2011-10-20 Don Porter - - * library/http/http.tcl: Bump to version 2.8.3 - * library/http/pkgIndex.tcl: - * unix/Makefile.in: - * win/Makefile.in: - - * changes: Updates toward 8.6b3 release. - -2011-10-20 Donal K. Fellows - - * generic/tclLiteral.c (TclInvalidateCmdLiteral): [Bug 3418547]: - Additional code for handling the invalidation of literals. - * generic/tclBasic.c (Tcl_CreateObjCommand, Tcl_CreateCommand) - (TclRenameCommand, Tcl_ExposeCommand): The four additional places that - need extra care when dealing with literals. - * generic/tclTest.c (TestInterpResolverCmd): Additional test machinery - for interpreter resolvers. - -2011-10-18 Reinhard Max - - * library/clock.tcl (::tcl::clock::GetSystemTimeZone): Cache the time - zone only if it was detected by one of the expensive methods. - Otherwise after unsetting TCL_TZ or TZ the previous value will still - be used. - -2011-10-15 Venkat Iyer - - * library/tzdata/America/Sitka: Update to Olson's tzdata2011l - * library/tzdata/Pacific/Fiji: - * library/tzdata/Asia/Hebron: (New) - -2011-10-11 Jan Nijtmans - - * win/tclWinFile.c: [Bug 2935503]: Incorrect mode field returned by - [file stat] command. - -2011-10-09 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileDictWithCmd): Corrected handling of - qualified names, and added spacial cases for empty bodies (used when - [dict with] is just used for extracting variables). - -2011-10-07 Jan Nijtmans - - * generic/tcl.h: Fix gcc warnings (discovered with latest - * generic/tclIORChan.c: mingw, based on gcc 4.6.1) - * tests/env.test: Fix env.test, when running under wine 1.3. - -2011-10-06 Donal K. Fellows - - * generic/tclDictObj.c (TclDictWithInit, TclDictWithFinish): - * generic/tclCompCmds.c (TclCompileDictWithCmd): Experimental - compilation for the [dict with] subcommand, using parts factored out - from the interpreted version of the command. - -2011-10-05 Jan Nijtmans - - * win/tclWinInt.h: Remove tclWinProcs, as it is no longer - * win/tclWin32Dll.c: being used. - -2011-10-03 Venkat Iyer - - * library/tzdata/Africa/Dar_es_Salaam: Update to Olson's tzdata2011k - * library/tzdata/Africa/Kampala: - * library/tzdata/Africa/Nairobi: - * library/tzdata/Asia/Gaza: - * library/tzdata/Europe/Kaliningrad: - * library/tzdata/Europe/Kiev: - * library/tzdata/Europe/Minsk: - * library/tzdata/Europe/Simferopol: - * library/tzdata/Europe/Uzhgorod: - * library/tzdata/Europe/Zaporozhye: - * library/tzdata/Pacific/Apia: - -2011-09-29 Donal K. Fellows - - * tools/tcltk-man2html.tcl, tools/tcltk-man2html-utils.tcl: More - refactoring so that more of the utility code is decently out of the - way. Adjusted the header-material generator so that version numbers - are only included in locations where there is room. - -2011-09-28 Jan Nijtmans - - * generic/tclOO.h: [RFE 3010352]: make all TclOO API functions - * generic/tclOODecls.h: MODULE_SCOPE - * generic/tclOOIntDecls.h: - -2011-09-27 Donal K. Fellows - - * generic/tclIndexObj.c (Tcl_ParseArgsObjv): [Bug 3413857]: Corrected - the memory management for the code parsing arguments when returning - "large" numbers of arguments. Also unbroke the TCL_ARGV_AUTO_REST - macro in passing. - -2011-09-26 Donal K. Fellows - - * generic/tclCmdAH.c (TclMakeFileCommandSafe): [Bug 3211758]: Also - make the main [file] command hidden by default in safe interpreters, - because that's what existing code expects. This will reduce the amount - which the code breaks, but not necessarily eliminate it... - -2011-09-23 Don Porter - - * generic/tclIORTrans.c: More revisions to get finalization of - ReflectedTransforms correct, including adopting a "dead" field as was - done in tclIORChan.c. - - * tests/thread.test: Stop using the deprecated thread management - commands of the tcltest package. The test suite ought to provide - these tools for itself. They do not belong in a testing harness. - -2011-09-22 Don Porter - - * generic/tclCmdIL.c: Revise [info frame] so that it stops creating - cycles in the iPtr->cmdFramePtr stack. - -2011-09-22 Donal K. Fellows - - * doc/re_syntax.n: [Bug 2903743]: Add more magic so that we can do at - least something sane on Solaris. - * tools/tcltk-man2html-utils.tcl (process-text): Teach the HTML - generator how to handle this magic. - -2011-09-21 Don Porter - - * generic/tclThreadTest.c: Revise the thread exit handling of the - [testthread] command so that it properly maintains the per-process - data structures even when the thread exits for reasons other than the - [testthread exit] command. - -2011-09-21 Alexandre Ferrieux - - * unix/tclIO.c: [Bug 3412487]: Now short reads are allowed in - synchronous fcopy, avoid mistaking them as nonblocking ones. - -2011-09-21 Andreas Kupries - - * generic/tclIORTrans.c (ForwardOpToOwnerThread): Fixed the missing - initialization of the 'dsti' field. Reported by Don Porter, on chat. - -2011-09-20 Don Porter - - * generic/tclIORChan.c: Re-using the "interp" field to signal a dead - channel (via NULL value) interfered with conditional cleanup tasks - testing for "the right interp". Added a new field "dead" to perform - the dead channel signalling task so the corrupted logic is avoided. - - * generic/tclIORTrans.c: Revised ReflectClose() and - FreeReflectedTransform() so that we stop leaking ReflectedTransforms, - yet free all Tcl_Obj values in the same thread that alloced them. - -2011-09-19 Don Porter - - * tests/ioTrans.test: Conversion from [testthread] to Thread package - stops most memory leaks. - - * tests/thread.test: Plug most memory leaks in thread.test. - Constrain the rest to be skipped during `make valgrind'. Tests using - the [testthread cancel] testing command are leaky. Corrections wait - for either addition of [thread::cancel] to the Thread package, or - improvements to the [testthread] testing command to make leak-free - versions of these tests possible. - - * generic/tclIORChan.c: Plug all memory leaks in ioCmd.test exposed - * tests/ioCmd.test: by `make valgrind'. - * unix/Makefile.in: - -2011-09-16 Jan Nijtmans - - IMPLEMENTATION OF TIP #388 - - * doc/Tcl.n: - * doc/re_syntax.n: - * generic/regc_lex.c: - * generic/regcomp.c: - * generic/regcustom.h: - * generic/tcl.h: - * generic/tclParse.c: - * tests/reg.test: - * tests/utf.test: - -2011-09-16 Donal K. Fellows - - * generic/tclProc.c (ProcWrongNumArgs): [Bugs 3400658,3408830]: - Corrected the handling of procedure error messages (found by TclOO). - -2011-09-16 Jan Nijtmans - - * generic/tcl.h: Don't change Tcl_UniChar type when - * generic/regcustom.h: TCL_UTF_MAX == 4 (not supported anyway) - -2011-09-16 Donal K. Fellows - - * generic/tclProc.c (ProcWrongNumArgs): [Bugs 3400658,3408830]: - Ensemble-like rewriting of error messages is complex, and TclOO (in - combination with iTcl) hits the most tricky cases. - - * library/http/http.tcl (http::geturl): [Bug 3391977]: Ensure that the - -headers option overrides the -type option (important because -type - has a default that is not always appropriate, and the header must not - be duplicated). - -2011-09-15 Don Porter - - * generic/tclCompExpr.c: [Bug 3408408]: Partial improvement by sharing - as literals the computed values of constant subexpressions when we can - do so without incurring the cost of string rep generation. - -2011-09-13 Don Porter - - * generic/tclUtil.c: [Bug 3390638]: Workaround broken Solaris - Studio cc optimizer. Thanks to Wolfgang S. Kechel. - - * generic/tclDTrace.d: [Bug 3405652]: Portability workaround for - broken system DTrace support. Thanks to Dagobert Michelson. - -2011-09-12 Jan Nijtmans - - * win/tclWinPort.h: [Bug 3407070]: tclPosixStr.c won't build with - EOVERFLOW==E2BIG - -2011-09-11 Don Porter - - * tests/thread.test: Convert [testthread] use to Thread package use - in thread-6.1. Eliminates a memory leak in `make valgrind`. - - * tests/socket.test: [Bug 3390699]: Convert [testthread] use to - Thread package use in socket_*-13.1. Eliminates a memory leak in - `make valgrind`. - -2011-09-09 Don Porter - - * tests/chanio.test: [Bug 3389733]: Convert [testthread] use to - * tests/io.test: Thread package use in *io-70.1. Eliminates a - memory leak in `make valgrind`. - -2011-09-07 Don Porter - - * generic/tclCompExpr.c: [Bug 3401704]: Allow function names like - * tests/parseExpr.test: influence(), nanobot(), and 99bottles() that - have been parsed as missing operator syntax errors before with the - form NUMBER + FUNCTION. - ***POTENTIAL INCOMPATIBILITY*** - -2011-09-06 Venkat Iyer - - * library/tzdata/America/Goose_Bay: Update to Olson's tzdata2011i - * library/tzdata/America/Metlakatla: - * library/tzdata/America/Resolute: - * library/tzdata/America/St_Johns: - * library/tzdata/Europe/Kaliningrad: - * library/tzdata/Pacific/Apia: - * library/tzdata/Pacific/Honolulu: - * library/tzdata/Africa/Juba: (new) - -2011-09-06 Jan Nijtmans - - * generic/tcl.h: [RFE 1711975]: Tcl_MainEx() (like Tk_MainEx()) - * generic/tclDecls.h: - * generic/tclMain.c: - -2011-09-02 Don Porter - - * tests/http.test: Convert [testthread] use to Thread package use. - Eliminates memory leak seen in `make valgrind`. - -2011-09-01 Alexandre Ferrieux - - * unix/tclUnixSock.c: [Bug 3401422]: Cache script-level changes to the - nonblocking flag of an async client socket in progress, and commit - them on completion. - -2011-09-01 Don Porter - - * generic/tclStrToD.c: [Bug 3402540]: Corrections to TclParseNumber() - * tests/binary.test: to make it reject invalid Nan(Hex) strings. - - * tests/scan.test: [scan Inf %g] is portable; remove constraint. - -2011-08-30 Donal K. Fellows - - * generic/tclInterp.c (SlaveCommandLimitCmd, SlaveTimeLimitCmd): - [Bug 3398794]: Ensure that low-level conditions in the limit API are - enforced at the script level through errors, not a Tcl_Panic. This - means that interpreters cannot read their own limits (writing already - did not work). - -2011-08-30 Reinhard Max - - * unix/tclUnixSock.c (TcpWatchProc): [Bug 3394732]: Put back the check - for server sockets. - -2011-08-29 Don Porter - - * generic/tclIORTrans.c: Leak of ReflectedTransformMap. - -2011-08-27 Don Porter - - * generic/tclStringObj.c: [RFE 3396731]: Revise the [string reverse] - * tests/string.test: implementation to operate on the representation - that comes in, avoid conversion to other reps. - -2011-08-23 Don Porter - - * generic/tclIORChan.c: [Bug 3396948]: Leak of ReflectedChannelMap. - -2011-08-19 Don Porter - - * generic/tclIORTrans.c: [Bugs 3393279, 3393280]: ReflectClose(.) is - missing Tcl_EventuallyFree() calls at some of its exits. - - * generic/tclIO.c: [Bugs 3394654, 3393276]: Revise FlushChannel() to - account for the possibility that the ChanWrite() call might recycle - the buffer out from under us. - - * generic/tclIO.c: Preserve the chanPtr during FlushChannel so that - channel drivers don't yank it away before we're done with it. - -2011-08-19 Alexandre Ferrieux - - * generic/tclTest.c: [Bug 2981154]: async-4.3 segfault. - * tests/async.test: [Bug 1774689]: async-4.3 sometimes fails. - -2011-08-18 Alexandre Ferrieux - - * generic/tclIO.c: [Bug 3096275]: Sync fcopy buffers input. - -2011-08-18 Jan Nijtmans - - * generic/tclUniData.c: [Bug 3393714]: Overflow in toupper delta - * tools/uniParse.tcl: - * tests/utf.test: - -2011-08-17 Alexandre Ferrieux - - * generic/tclIO.c: [Bug 2946474]: Consistently resume backgrounded - * tests/ioCmd.test: flushes+closes when exiting. - -2011-08-17 Alexandre Ferrieux - - * doc/interp.n: Document TIP 378's one-way-ness. - -2011-08-17 Don Porter - - * generic/tclGet.c: [Bug 3393150]: Overlooked free of intreps. - (It matters for bignums!) - -2011-08-16 Don Porter - - * generic/tclCompile.c: [Bug 3392070]: More complete prevention of - Tcl_Obj reference cycles when producing an intrep of ByteCode. - -2011-08-16 Donal K. Fellows - - * generic/tclListObj.c (TclLindexList, TclLsetFlat): Silence warnings - about (unreachable) cases of uninitialized variables. - * generic/tclCmdIL.c (SelectObjFromSublist): Improve the generation of - * generic/tclIndexObj.c (Tcl_ParseArgsObjv): messages through the use - * generic/tclVar.c (ArrayStartSearchCmd): of Tcl_ObjPrintf. - -2011-08-15 Don Porter - - * generic/tclBasic.c: [Bug 3390272]: Leak of [info script] value. - -2011-08-15 Jan Nijtmans - - * generic/tclPosixStr.c: [Bug 3388350]: mingw64 compiler warnings - * win/tclWinPort.h: - * win/configure.in: - * win/configure: - -2011-08-14 Jan Nijtmans - - * doc/FindExec.3: [Patch 3124554]: Move WishPanic from Tk to Tcl - * doc/Panic.3 Added Documentation - -2011-08-12 Don Porter - - * generic/tclPathObj.c: [Bug 3389764]: Eliminate possibility that dup - of a "path" value can create reference cycle. - -2011-08-12 Donal K. Fellows - - * generic/tclZlib.c (ZlibTransformOutput): [Bug 3390073]: Return the - correct length of written data for a compressing transform. - -2011-08-10 Alexandre Ferrieux - - * generic/tclTestObj.c: [Bug 3386721]: Allow multiple [load]ing of the - Tcltest package. - -2011-08-09 Alexandre Ferrieux - - * generic/tclBasic.c: [Bug 2919042]: Restore "valgrindability" of Tcl - * generic/tclEvent.c: that was lost by the streamlining of [exit], by - * generic/tclExecute.c: conditionally forcing a full Finalize: - * generic/tclInt.h: use -DPURIFY or ::env(TCL_FINALIZE_ON_EXIT) - -2011-08-09 Alexandre Ferrieux - - * generic/tclCompCmds.c: [Bug 3386417]: Avoid a reference loop between - * generic/tclInt.h: the bytecode and its companion errostack - * generic/tclResult.c: when compiling a syntax error. - -2011-08-09 Jan Nijtmans - - * win/tclWinConsole.c: [Bug 3388350]: mingw64 compiler warnings - * win/tclWinDde.c: - * win/tclWinPipe.c: - * win/tclWinSerial.c: - -2011-08-09 Jan Nijtmans - - * generic/tclInt.h: Change the signature of TclParseHex(), such that - * generic/tclParse.c: it can now parse up to 8 hex characters. - -2011-08-08 Donal K. Fellows - - * generic/tclZlib.c (ZlibStreamCmd): Make the -buffersize option to - '$zstream add' function correctly instead of having its value just be - discarded unceremoniously. Also generate error codes from more of the - code, not just the low-level code but also the Tcl infrastructure. - -2011-08-07 Donal K. Fellows - - * generic/tclOOInfo.c (InfoClassCallCmd): [Bug 3387082]: Plug memory - leak in call chain introspection. - -2011-08-06 Kevin B, Kenny - - * generic/tclAssemnbly.c: [Bug 3384840]: Plug another memory leak. - * generic/tclStrToD.c: [Bug 3386975]: Plug another memory leak. - -2011-08-05 Kevin B. Kenny - - * generic/tclStrToD.c: [Bug 3386975]: Plugged a memory leak in - double->string conversion. - -2011-08-05 Don Porter - - *** 8.6b2 TAGGED FOR RELEASE *** - - * changes: Updates for 8.6b2 release. - -2011-08-05 Donal K. Fellows - - * generic/tclAssembly.c (AssembleOneLine): Ensure that memory isn't - leaked when an unknown instruction is encountered. Also simplify code - through use of Tcl_ObjPrintf in error message generation. - - * generic/tclZlib.c (ZlibTransformClose): [Bug 3386197]: Plug a memory - leak found by Miguel with valgrind, and ensure that the correct - direction's buffers are released. - -2011-08-04 Miguel Sofer - - * generic/tclVar.c (TclPtrSetVar): Fix valgrind-detected error when - newValuePtr is the interp's result obj. - -2011-08-04 Donal K. Fellows - - * generic/tclAssembly.c (FreeAssemblyEnv): [Bug 3384840]: Plug another - possible memory leak due to over-complex code for freeing the table of - labels. - -2011-08-04 Reinhard Max - - * generic/tclIOSock.c (TclCreateSocketAddress): Don't bother using - AI_ADDRCONFIG for now, as it was causing problems in various - situations. - -2011-08-04 Donal K. Fellows - - * generic/tclAssembly.c (AssembleOneLine, GetBooleanOperand) - (GetIntegerOperand, GetListIndexOperand, FindLocalVar): [Bug 3384840]: - A Tcl_Obj is allocated by GetNextOperand, so callers of it must not - hold a reference to one in the 'out' parameter when calling it. This - was causing a great many memory leaks. - * tests/assemble.test (assemble-51.*): Added group of memory leak - tests. - -2011-08-02 Don Porter - - * changes: Updates for 8.6b2 release. - * tools/tcltk-man2html.tcl: Variable substitution botch. - -2011-08-02 Donal K. Fellows - - * generic/tclObj.c (Tcl_DbIncrRefCount, Tcl_DbDecrRefCount) - (Tcl_DbIsShared): [Bug 3384007]: Fix the panic messages so they share - what should be shared and have the right number of spaces. - -2011-08-01 Miguel Sofer - - * generic/tclProc.c (TclProcCompileProc): [Bug 3383616]: Fix for leak - of resolveInfo when recompiling procs. Thanks go to Gustaf Neumann for - detecting the bug and providing the fix. - -2011-08-01 Donal K. Fellows - - * doc/tclvars.n (EXAMPLES): Added some examples of how some of the - standard global variables can be used, following prompting by a - request by Robert Hicks. - - * tools/tcltk-man2html.tcl (plus-pkgs): [Bug 3382474]: Added code to - determine the version number of contributed packages from their - directory names so that HTML documentation builds are less confusing. - -2011-07-29 Donal K. Fellows - - * tools/tcltk-man2html.tcl (ensemble_commands, remap_link_target): - Small enhancements to improve cross-linking with contributed packages. - * tools/tcltk-man2html-utils.tcl (insert-cross-references): Enhance to - cope with contributed packages' C API. - -2011-07-28 Reinhard Max - - * unix/tcl.m4 (SC_TCL_IPV6): Fix AC_DEFINE invocation for - NEED_FAKE_RFC2553. - * unix/configure: autoconf-2.59 - -2011-07-28 Don Porter - - * changes: Updates for 8.6b2 release. - - * library/tzdata/Asia/Anadyr: Update to Olson's tzdata2011h - * library/tzdata/Asia/Irkutsk: - * library/tzdata/Asia/Kamchatka: - * library/tzdata/Asia/Krasnoyarsk: - * library/tzdata/Asia/Magadan: - * library/tzdata/Asia/Novokuznetsk: - * library/tzdata/Asia/Novosibirsk: - * library/tzdata/Asia/Omsk: - * library/tzdata/Asia/Sakhalin: - * library/tzdata/Asia/Vladivostok: - * library/tzdata/Asia/Yakutsk: - * library/tzdata/Asia/Yekaterinburg: - * library/tzdata/Europe/Kaliningrad: - * library/tzdata/Europe/Moscow: - * library/tzdata/Europe/Samara: - * library/tzdata/Europe/Volgograd: - * library/tzdata/America/Kralendijk: (new) - * library/tzdata/America/Lower_Princes: (new) - -2011-07-26 Donal K. Fellows - - * generic/tclOO.c (initScript): Ensure that TclOO is properly found by - all the various package mechanisms (by adding a dummy ifneeded script) - and not just some of them. - -2011-07-21 Jan Nijtmans - - * win/tclWinPort.h: [Bug 3372130]: Fix hypot math function with MSVC10 - -2011-07-19 Don Porter - - * generic/tclUtil.c: [Bug 3371644]: Repair failure to properly handle - * tests/util.test: (length == -1) scanning in TclConvertElement(). - Thanks to Thomas Sader and Alexandre Ferrieux. - -2011-07-19 Donal K. Fellows - - * doc/*.3, doc/*.n: Many small fixes to documentation as part of - project to improve quality of generated HTML docs. - - * tools/tcltk-man2html.tcl (remap_link_target): More complete set of - definitions of link targets, especially for major C API types. - * tools/tcltk-man2html-utils.tcl (output-IP-list, cross-reference): - Update to generation to produce proper HTML bulleted and enumerated - lists. - -2011-07-19 Alexandre Ferrieux - - * doc/upvar.n: Undocument long gone limitation of [upvar]. - -2011-07-18 Don Porter - - * generic/tcl.h: Bump version number to 8.6b2. - * library/init.tcl: - * unix/configure.in: - * win/configure.in: - * unix/tcl.spec: - * tools/tcl.wse.in: - * README: - - * unix/configure: autoconf-2.59 - * win/configure: - -2011-07-15 Don Porter - - * generic/tclCompile.c: Avoid segfaults when RecordByteCodeStats() is - called in a deleted interp. - - * generic/tclCompile.c: [Bug 467523, 3357771]: Prevent circular - references in values with ByteCode intreps. They can lead to memory - leaks. - -2011-07-14 Donal K. Fellows - - * generic/tclOOCall.c (TclOORenderCallChain): [Bug 3365156]: Remove - stray refcount bump that caused a memory leak. - -2011-07-12 Don Porter - - * generic/tclUnixSock.c: [Bug 3364777]: Stop segfault caused by - reading from struct after it had been freed. - -2011-07-11 Joe Mistachkin - - * generic/tclExecute.c: [Bug 3339502]: Correct cast for CURR_DEPTH to - silence compiler warning. - -2011-07-08 Donal K. Fellows - - * doc/http.n: [FRQ 3358415]: State what RFC defines HTTP/1.1. - -2011-07-07 Miguel Sofer - - * generic/tclBasic.c: Add missing INT2PTR - -2011-07-03 Donal K. Fellows - - * doc/FileSystem.3: Corrected statements about ctime field of 'struct - stat'; that was always the time of the last metadata change, not the - time of creation. - -2011-07-02 Kevin B. Kenny - - * generic/tclStrToD.c: - * generic/tclTomMath.decls: - * generic/tclTomMathDecls.h: - * macosx/Tcl.xcode/project.pbxproj: - * macosx/Tcl.xcodeproj/project.pbxproj: - * tests/util.test: - * unix/Makefile.in: - * win/Makefile.in: - * win/Makefile.vc: - [Bug 3349507]: Fix a bug where bignum->double conversion is "round up" - and not "round to nearest" (causing expr double(1[string repeat 0 23]) - not to be 1e+23). - -2011-06-28 Reinhard Max - - * unix/tclUnixSock.c (CreateClientSocket): [Bug 3325339]: Fix and - simplify posting of the writable fileevent at the end of an - asynchronous connection attempt. Improve comments for some of the - trickery around [socket -async]. - - * tests/socket.test: Adjust tests to the async code changes. Add more - tests for corner cases of async sockets. - -2011-06-22 Andreas Kupries - - * library/platform/pkgIndex.tcl: Updated to platform 1.0.10. Added - * library/platform/platform.tcl: handling of the DEB_HOST_MULTIARCH - * unix/Makefile.in: location change for libc. - * win/Makefile.in: - - * generic/tclInt.h: Fixed the inadvertently committed disabling of - stack checks, see my 2010-11-15 commit. - -2011-06-22 Reinhard Max - - Merge from rmax-ipv6-branch: - * unix/tclUnixSock.c: Fix [socket -async], so that all addresses - returned by getaddrinfo() are tried, not just the first one. This - requires the event loop to be running while the async connection is in - progress. ***POTENTIAL INCOMPATIBILITY*** - * tests/socket.test: Add a test for the above. - * doc/socket: Document the fact that -async needs the event loop - * generic/tclIOSock.c: AI_ADDRCONFIG is broken on HP-UX - -2011-06-21 Don Porter - - * generic/tclLink.c: [Bug 3317466]: Prevent multiple links to a - single Tcl variable when calling Tcl_LinkVar(). - -2011-06-13 Don Porter - - * generic/tclStrToD.c: [Bug 3315098]: Mem leak fix from Gustaf - Neumann. - -2011-06-08 Andreas Kupries - - * generic/tclExecute.c: Reverted the fix for [Bug 3274728] committed - on 2011-04-06 and replaced with one which is 64bit-safe. The existing - fix crashed tclsh on Windows 64bit. - -2011-06-08 Donal K. Fellows - - * tests/fileSystem.test: Reduce the amount of use of duplication of - complex code to perform common tests, and convert others to do the - test result check directly using Tcltest's own primitives. - -2011-06-06 Jan Nijtmans - - * tests/socket.test: Add test constraint, so 6.2 and 6.3 don't fail - when the machine does not have support for ip6. Follow-up to checkin - from 2011-05-11 by rmax. - -2011-06-02 Don Porter - - * generic/tclBasic.c: Removed TclCleanupLiteralTable(), and old - * generic/tclInt.h: band-aid routine put in place while a fix for - * generic/tclLiteral.c: [Bug 994838] took shape. No longer needed. - -2011-06-02 Donal K. Fellows - - * generic/tclInt.h (TclInvalidateNsCmdLookup): [Bug 3185407]: Extend - the set of epochs that are potentially bumped when a command is - created, for a slight performance drop (in some circumstances) and - improved semantics. - -2011-06-01 Miguel Sofer - - * generic/tclBasic.c: Using the two free data elements in NRCommand to - store objc and objv - useful for debugging. - -2011-06-01 Jan Nijtmans - - * generic/tclUtil.c: Fix for [Bug 3309871]: Valgrind finds: invalid - read in TclMaxListLength(). - -2011-05-31 Don Porter - - * generic/tclInt.h: Use a complete growth algorithm for lists so - * generic/tclListObj.c: that length limits do not overconstrain by a - * generic/tclStringObj.c: factor of 2. [Bug 3293874]: Fix includes - * generic/tclUtil.c: rooting all growth routines by default on a - common tunable parameter TCL_MIN_GROWTH. - -2011-05-25 Don Porter - - * library/msgcat/msgcat.tcl: Bump to msgcat 1.4.4. - * library/msgcat/pkgIndex.tcl: - * unix/Makefile.in: - * win/Makefile.in: - -2011-05-25 Donal K. Fellows - - * generic/tclOO.h (TCLOO_VERSION): Bump version. - - IMPLEMENTATION OF TIP#381. - - * doc/next.n, doc/ooInfo.n, doc/self.n, generic/tclOO.c, - * generic/tclOOBasic.c, generic/tclOOCall.c, generic/tclOOInfo.c, - * generic/tclOOInt.h, tests/oo.test, tests/ooNext2.test: Added - introspection of call chains ([self call], [info object call], [info - class call]) and ability to skip ahead in chain ([nextto]). - -2011-05-24 Venkat Iyer - - * library/tzdata/Africa/Cairo: Update to Olson tzdata2011g - -2011-05-24 Donal K. Fellows - - * library/msgcat/msgcat.tcl (msgcat::mcset, msgcat::mcmset): Remove - some useless code; [dict set] builds dictionary levels for us. - -2011-05-17 Andreas Kupries - - * generic/tclCompile.c (TclFixupForwardJump): Tracked down and fixed - * generic/tclBasic.c (TclArgumentBCEnter): the cause of a violation of - my assertion that 'ePtr->nline == objc' in TclArgumentBCEnter. When a - bytecode was grown during jump fixup the pc -> command line mapping - was not updated. When things aligned just wrong the mapping would - direct command A to the data for command B, with a different number of - arguments. - -2011-05-11 Reinhard Max - - * unix/tclUnixSock.c (TcpWatchProc): No need to check for server - sockets here, as the generic server code already takes care of that. - * tests/socket.test (accept): Add tests to make sure that this remains - so. - -2011-05-10 Don Porter - - * generic/tclInt.h: New internal routines TclScanElement() and - * generic/tclUtil.c: TclConvertElement() are rewritten guts of - machinery to produce string rep of lists. The new routines avoid and - correct [Bug 3173086]. See comments for much more detail. - - * generic/tclDictObj.c: Update all callers. - * generic/tclIndexObj.c: - * generic/tclListObj.c: - * generic/tclUtil.c: - * tests/list.test: - -2011-05-09 Donal K. Fellows - - * generic/tclNamesp.c (NamespacePathCmd): Convert to use Tcl_Obj API - * generic/tclPkg.c (Tcl_PackageObjCmd): for result generation in - * generic/tclTimer.c (Tcl_AfterObjCmd): [after info], [namespace - path] and [package versions]. - -2011-05-09 Don Porter - - * generic/tclListObj.c: Revise empty string tests so that we avoid - potentially expensive string rep generations, especially for dicts. - -2011-05-07 Donal K. Fellows - - * generic/tclLoad.c (TclGetLoadedPackages): Convert to use Tcl_Obj API - for result generation. - -2011-05-07 Miguel Sofer - - * generic/tclInt.h: Fix USE_TCLALLOC so that it can be enabled without - * unix/Makefile.in: editing the Makefile. - -2011-05-05 Don Porter - - * generic/tclListObj.c: Stop generating string rep of dict when - converting to list. Tolerate NULL interps more completely. - -2011-05-03 Don Porter - - * generic/tclUtil.c: Tighten Tcl_SplitList(). - * generic/tclListObj.c: Tighten SetListFromAny(). - * generic/tclDictObj.c: Tighten SetDictFromAny(). - * tests/join.test: - * tests/mathop.test: - -2011-05-02 Don Porter - - * generic/tclCmdMZ.c: Revised TclFindElement() interface. The final - * generic/tclDictObj.c: argument had been bracePtr, the address of a - * generic/tclListObj.c: boolean var, where the caller can be told - * generic/tclParse.c: whether or not the parsed list element was - * generic/tclUtil.c: enclosed in braces. In practice, no callers - really care about that. What the callers really want to know is - whether the list element value exists as a literal substring of the - string being parsed, or whether a call to TclCopyAndCollpase() is - needed to produce the list element value. Now the final argument is - changed to do what callers actually need. This is a better fit for the - calls in tclParse.c, where now a good deal of post-processing checking - for "naked backslashes" is no longer necessary. - ***POTENTIAL INCOMPATIBILITY*** - For any callers calling in via the internal stubs table who really do - use the final argument explicitly to check for the enclosing brace - scenario. Simply looking for the braces where they must be is the - revision available to those callers, and it will backport cleanly. - - * tests/parse.test: Tests for expanded literals quoting detection. - - * generic/tclCompCmdsSZ.c: New TclFindElement() is also a better - fit for the [switch] compiler. - - * generic/tclInt.h: Replace TclCountSpaceRuns() with - * generic/tclListObj.c: TclMaxListLength() which is the function we - * generic/tclUtil.c: actually want. - * generic/tclCompCmdsSZ.c: - - * generic/tclCompCmdsSZ.c: Rewrite of parts of the switch compiler to - better use the powers of TclFindElement() and do less parsing on its - own. - -2011-04-28 Don Porter - - * generic/tclInt.h: New utility routines: - * generic/tclParse.c: TclIsSpaceProc() and TclCountSpaceRuns() - * generic/tclUtil.c: - - * generic/tclCmdMZ.c: Use new routines to replace calls to isspace() - * generic/tclListObj.c: and their /* INTL */ risk. - * generic/tclStrToD.c: - * generic/tclUtf.c: - * unix/tclUnixFile.c: - - * generic/tclStringObj.c: Improved reaction to out of memory. - -2011-04-27 Don Porter - - * generic/tclCmdMZ.c: TclFreeIntRep() correction & cleanup. - * generic/tclExecute.c: - * generic/tclIndexObj.c: - * generic/tclInt.h: - * generic/tclListObj.c: - * generic/tclNamesp.c: - * generic/tclResult.c: - * generic/tclStringObj.c: - * generic/tclVar.c: - - * generic/tclListObj.c: FreeListInternalRep() cleanup. - -2011-04-21 Don Porter - - * generic/tclInt.h: Use macro to set List intreps. - * generic/tclListObj.c: - - * generic/tclCmdIL.c: Limits on list length were too strict. - * generic/tclInt.h: Revised panics to errors where possible. - * generic/tclListObj.c: - * tests/lrepeat.test: - - * generic/tclCompile.c: Make sure SetFooFromAny routines react - * generic/tclIO.c: reasonably when passed a NULL interp. - * generic/tclIndexObj.c: - * generic/tclListObj.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclProc.c: - * macosx/tclMacOSXFCmd.c: - -2011-04-21 Jan Nijtmans - - * generic/tcl.h: fix for [Bug 3288345]: Wrong Tcl_StatBuf - * generic/tclInt.h: used on MinGW. Make sure that all _WIN32 - * win/tclWinFile.c: compilers use exactly the same layout - * win/configure.in: for Tcl_StatBuf - the one used by MSVC6 - - * win/configure: in all situations. - -2011-04-19 Don Porter - - * generic/tclConfig.c: Reduce internals access in the implementation - of [::pkgconfig list]. - -2011-04-18 Don Porter - - * generic/tclCmdIL.c: Use ListRepPtr(.) and other cleanup. - * generic/tclConfig.c: - * generic/tclListObj.c: - - * generic/tclInt.h: Define and use macros that test whether a Tcl - * generic/tclBasic.c: list value is canonical. - * generic/tclUtil.c: - -2011-04-18 Donal K. Fellows - - * doc/dict.n: [Bug 3288696]: Command summary was confusingly wrong - when it came to [dict filter] with a 'value' filter. - -2011-04-16 Donal K. Fellows - - * generic/tclFCmd.c (TclFileAttrsCmd): Add comments to make this code - easier to understand. Added a panic to handle the case where the VFS - layer does something odd. - -2011-04-13 Don Porter - - * generic/tclUtil.c: [Bug 3285375]: Rewrite of Tcl_Concat*() - routines to prevent segfaults on buffer overflow. Build them out of - existing primitives already coded to handle overflow properly. Uses - the new TclTrim*() routines. - - * generic/tclCmdMZ.c: New internal utility routines TclTrimLeft() - * generic/tclInt.h: and TclTrimRight(). Refactor the - * generic/tclUtil.c: [string trim*] implementations to use them. - -2011-04-13 Miguel Sofer - - * generic/tclVar.c: [Bug 2662380]: Fix crash caused by appending to a - variable with a write trace that unsets it. - -2011-04-13 Donal K. Fellows - - * generic/tclUtil.c (Tcl_ConcatObj): [Bug 3285375]: Make the crash - less mysterious through the judicious use of a panic. Not yet properly - fixed, but at least now clearer what the failure mode is. - -2011-04-12 Don Porter - - * tests/string.test: Test for [Bug 3285472]. Not buggy in trunk. - -2011-04-12 Venkat Iyer - - * library/tzdata/Atlantic/Stanley: Update to Olson tzdata2011f - -2011-04-12 Miguel Sofer - - * generic/tclBasic.c: Fix for [Bug 2440625], kbk's patch - -2011-04-11 Miguel Sofer - - * generic/tclBasic.c: - * tests/coroutine.test: [Bug 3282869]: Ensure that 'coroutine eval' - runs the initial command in the proper context. - -2011-04-11 Jan Nijtmans - - * generic/tcl.h: Fix for [Bug 3281728]: Tcl sources from 2011-04-06 - * unix/tcl.m4: do not build on GCC9 (RH9) - * unix/configure: - -2011-04-08 Jan Nijtmans - - * win/tclWinPort.h: Fix for [Bug 3280043]: win2k: unresolved DLL - * win/configure.in: imports. - * win/configure - -2011-04-06 Miguel Sofer - - * generic/tclExecute.c (TclCompileObj): Earlier return if Tip280 - gymnastics not needed. - - * generic/tclExecute.c: Fix for [Bug 3274728]: making *catchTop an - unsigned long. - -2011-04-06 Jan Nijtmans - - * unix/tclAppInit.c: Make symbols "main" and "Tcl_AppInit" - MODULE_SCOPE: there is absolutely no reason for exporting them. - * unix/tcl.m4: Don't use -fvisibility=hidden with static - * unix/configure libraries (--disable-shared) - -2011-04-06 Donal K. Fellows - - * generic/tclFCmd.c, macosx/tclMacOSXFCmd.c, unix/tclUnixChan.c, - * unix/tclUnixFCmd.c, win/tclWinChan.c, win/tclWinDde.c, - * win/tclWinFCmd.c, win/tclWinLoad.c, win/tclWinPipe.c, - * win/tclWinReg.c, win/tclWinSerial.c, win/tclWinSock.c: More - generation of error codes (most platform-specific parts not already - using Tcl_PosixError). - -2011-04-05 Venkat Iyer - - * library/tzdata/Africa/Casablanca: Update to Olson's tzdata2011e - * library/tzdata/America/Santiago: - * library/tzdata/Pacific/Easter: - * library/tzdata/America/Metlakatla: (new) - * library/tzdata/America/North_Dakota/Beulah: (new) - * library/tzdata/America/Sitka: (new) - -2011-04-04 Donal K. Fellows - - * generic/tclOO.c, generic/tclOOBasic.c, generic/tclOODefineCmds.c - * generic/tclOOInfo.c, generic/tclOOMethod.c: More generation of - error codes (TclOO miscellany). - - * generic/tclCmdAH.c, generic/tclCmdIL.c: More generation of error - codes (miscellaneous commands mostly already handled). - -2011-04-04 Don Porter - - * README: [Bug 3202030]: Updated README files, repairing broken - * macosx/README:URLs and removing other bits that were clearly wrong. - * unix/README: Still could use more eyeballs on the detailed build - * win/README: advice on various plaforms. - -2011-04-04 Donal K. Fellows - - * library/init.tcl (tcl::mathfunc::rmmadwiw): Disable by default to - make test suite work. - - * generic/tclBasic.c, generic/tclStringObj.c, generic/tclTimer.c, - * generic/tclTrace.c, generic/tclUtil.c: More generation of error - codes ([format], [after], [trace], RE optimizer). - -2011-04-04 Jan Nijtmans - - * generic/tclCmdAH.c: Better error-message in case of errors - * generic/tclCmdIL.c: related to setting a variable. This fixes - * generic/tclDictObj.c: a warning: "Why make your own error - * generic/tclScan.c: message? Why?" - * generic/tclTest.c: - * test/error.test: - * test/info.test: - * test/scan.test: - * unix/tclUnixThrd.h: Remove this unused header file. - -2011-04-03 Donal K. Fellows - - * generic/tclNamesp.c, generic/tclObj.c, generic/tclPathObj.c: - * generic/tclPipe.c, generic/tclPkg.c, generic/tclProc.c: - * generic/tclScan.c: More generation of error codes (namespace - creation, path normalization, pipeline creation, package handling, - procedures, [scan] formats) - -2011-04-02 Kevin B. Kenny - - * generic/tclStrToD.c (QuickConversion): Replaced another couple - of 'double' declarations with 'volatile double' to work around - misrounding issues in mingw-gcc 3.4.5. - -2011-04-02 Donal K. Fellows - - * generic/tclInterp.c, generic/tclListObj.c, generic/tclLoad.c: - More generation of errorCodes ([interp], [lset], [load], [unload]). - - * generic/tclEvent.c, generic/tclFileName.c: More generation of - errorCode information (default [bgerror] and [glob]). - -2011-04-01 Reinhard Max - - * library/init.tcl: TIP#131 implementation. - -2011-03-31 Donal K. Fellows - - * generic/tclGetDate.y, generic/tclDate.c (TclClockOldscanObjCmd): - More generation of errorCode information. - -2011-03-28 Donal K. Fellows - - * generic/tclCmdMZ.c, generic/tclConfig.c, generic/tclUtil.c: More - generation of errorCode information, notably when lists are mis-parsed - - * generic/tclCmdMZ.c (Tcl_RegexpObjCmd, Tcl_RegsubObjCmd): Use the - error messages generated by the variable management code rather than - creating our own. - -2011-03-27 Miguel Sofer - - * generic/tclBasic.c (TclNREvalObjEx): fix performance issue, notably - apparent in tclbench's "LIST lset foreach". Many thanks to Twylite for - patiently researching the issue and explaining it to me: a missing - Tcl_ResetObjResult that causes unwanted sharing of the current result - Tcl_Obj. - -2011-03-26 Donal K. Fellows - - * generic/tclNamesp.c (Tcl_Export, Tcl_Import, DoImport): More - generation of errorCode information. - - * generic/tclCompExpr.c, generic/tclCompile.c, generic/tclExecute.c: - * generic/tclListObj.c, generic/tclNamesp.c, generic/tclObj.c: - * generic/tclStringObj.c, generic/tclUtil.c: Reduce the number of - casts used to manage Tcl_Obj internal representations. - -2011-03-24 Don Porter - - * generic/tcl.h (ckfree,etc.): Restored C++ usability to the memory - allocation and free macros. - -2011-03-24 Donal K. Fellows - - * generic/tclFCmd.c (TclFileAttrsCmd): Ensure that any reference to - temporary index tables is squelched immediately rather than hanging - around to trip us up in the future. - -2011-03-23 Miguel Sofer - - * generic/tclObj.c: Exploit HAVE_FAST_TSD for the deletion context in - TclFreeObj() - -2011-03-22 Miguel Sofer - - * generic/tclThreadAlloc.c: Simpler initialization of Cache under - HAVE_FAST_TSD, from mig-alloc-reform. - -2011-03-21 Jan Nijtmans - - * unix/tclLoadDl.c: [Bug 3216070]: Loading extension libraries - * unix/tclLoadDyld.c: from embedded Tcl applications. - ***POTENTIAL INCOMPATIBILITY*** - For extensions which rely on symbols from other extensions being - present in the global symbol table. For an example and some discussion - of workarounds, see http://stackoverflow.com/q/8330614/301832 - -2011-03-21 Miguel Sofer - - * generic/tclCkAlloc.c: - * generic/tclInt.h: Remove one level of allocator indirection in - non-memdebug builds, imported from mig-alloc-reform. - -2011-03-20 Miguel Sofer - - * generic/tclThreadAlloc.c: Imported HAVE_FAST_TSD support from - mig-alloc-reform. The feature has to be enabled by hand: no autoconf - support has been added. It is not clear how universal a build using - this will be: it also requires some loader support. - -2011-03-17 Donal K. Fellows - - * generic/tclCompExpr.c (ParseExpr): Generate errorCode information on - failure to parse expressions. - -2011-03-17 Jan Nijtmans - - * generic/tclMain.c: [Patch 3124683]: Reorganize the platform-specific - stuff in (tcl|tk)Main.c. - -2011-03-16 Jan Nijtmans - - * generic/tclCkalloc.c: [Bug 3197864]: Pointer truncation on Win64 - TCL_MEM_DEBUG builds. - -2011-03-16 Don Porter - - * generic/tclBasic.c: Some rewrites to eliminate calls to isspace() - * generic/tclParse.c: and their /* INTL */ risk. - * generic/tclProc.c: - -2011-03-16 Jan Nijtmans - - * unix/tcl.m4: Make SHLIB_LD_LIBS='${LIBS}' the default and - * unix/configure: set to "" on per-platform necessary basis. - Backported from TEA, but kept all original platform code which was - removed from TEA. - -2011-03-14 Kevin B. Kenny - - * tools/tclZIC.tcl (onDayOfMonth): Allow for leading zeroes in month - and day so that tzdata2011d parses correctly. - * library/tzdata/America/Havana: - * library/tzdata/America/Juneau: - * library/tzdata/America/Santiago: - * library/tzdata/Europe/Istanbul: - * library/tzdata/Pacific/Apia: - * library/tzdata/Pacific/Easter: - * library/tzdata/Pacific/Honolulu: tzdata2011d - - * generic/tclAssembly.c (BBEmitInstInt1): Changed parameter data types - in an effort to silence a MSVC warning reported by Ashok P. Nadkarni. - Unable to test, since both forms work on my machine in VC2005, 2008, - 2010, in both release and debug builds. - * tests/tclTest.c (TestdstringCmd): Restored MSVC buildability broken - by [5574bdd262], which changed the effective return type of 'ckalloc' - from 'char*' to 'void*'. - -2011-03-13 Miguel Sofer - - * generic/tclExecute.c: remove TEBCreturn() - -2011-03-12 Donal K. Fellows - - * generic/tcl.h (ckalloc,ckfree,ckrealloc): Moved casts into these - macro so that they work with VOID* (which is a void* on all platforms - which Tcl actually builds on) and unsigned int for the length - parameters, removing the need for MANY casts across the rest of Tcl. - Note that this is a strict source-level-only change, so size_t cannot - be used (would break binary compatibility on 64-bit platforms). - -2011-03-12 Jan Nijtmans - - * win/tclWinFile.c: [Bug 3185609]: File normalization corner case - of ... broken with -DUNICODE - -2011-03-11 Donal K. Fellows - - * tests/unixInit.test: Make better use of tcltest2. - -2011-03-10 Donal K. Fellows - - * generic/tclBasic.c, generic/tclCompCmds.c, generic/tclEnsemble.c: - * generic/tclInt.h, generic/tclNamesp.c, library/auto.tcl: - * tests/interp.test, tests/namespace.test, tests/nre.test: - Converted the [namespace] command into an ensemble. This has the - consequence of making it vital for Tcl code that wishes to work with - namespaces to _not_ delete the ::tcl namespace. - ***POTENTIAL INCOMPATIBILITY*** - - * library/tcltest/tcltest.tcl (loadIntoSlaveInterpreter): Added this - command to handle connecting tcltest to a slave interpreter. This adds - in the hook (inside the tcltest namespace) that allows the tests run - in the child interpreter to be reported as part of the main sequence - of test results. Bumped version of tcltest to 2.3.3. - * tests/init.test, tests/package.test: Adapted these test files to use - the new feature. - - * generic/tclAlloc.c, generic/tclCmdMZ.c, generic/tclCompExpr.c: - * generic/tclCompile.c, generic/tclEnv.c, generic/tclEvent.c: - * generic/tclIO.c, generic/tclIOCmd.c, generic/tclIORChan.c: - * generic/tclIORTrans.c, generic/tclLiteral.c, generic/tclNotify.c: - * generic/tclParse.c, generic/tclStringObj.c, generic/tclUtil.c: - * generic/tclZlib.c, unix/tclUnixFCmd.c, unix/tclUnixNotfy.c: - * unix/tclUnixPort.h, unix/tclXtNotify.c: Formatting fixes, mainly to - comments, so code better fits the style in the Engineering Manual. - -2011-03-09 Donal K. Fellows - - * tests/incr.test: Update more of the test suite to use Tcltest 2. - -2011-03-09 Don Porter - - * generic/tclNamesp.c: [Bug 3202171]: Tighten the detector of nested - * tests/namespace.test: [namespace code] quoting that the quoted - scripts function properly even in a namespace that contains a custom - "namespace" command. - - * doc/tclvars.n: Formatting fix. Thanks to Pat Thotys. - -2011-03-09 Donal K. Fellows - - * tests/dstring.test, tests/init.test, tests/link.test: Update more of - the test suite to use Tcltest 2. - -2011-03-08 Jan Nijtmans - - * generic/tclBasic.c: Fix gcc warnings: variable set but not used - * generic/tclProc.c: - * generic/tclIORChan.c: - * generic/tclIORTrans.c: - * generic/tclAssembly.c: Fix gcc warning: comparison between signed - and unsigned integer expressions - -2011-03-08 Don Porter - - * generic/tclInt.h: Remove TclMarkList() routine, an experimental - * generic/tclUtil.c: dead-end from the 8.5 alpha days. - - * generic/tclResult.c (ResetObjResult): [Bug 3202905]: Correct failure - to clear invalid intrep. Thanks to Colin McDonald. - -2011-03-08 Donal K. Fellows - - * generic/tclAssembly.c, tests/assemble.test: Migrate to use a style - more consistent with the rest of Tcl. - -2011-03-06 Don Porter - - * generic/tclBasic.c: More replacements of Tcl_UtfBackslash() calls - * generic/tclCompile.c: with TclParseBackslash() where possible. - * generic/tclCompCmdsSZ.c: - * generic/tclParse.c: - * generic/tclUtil.c: - - * generic/tclUtil.c (TclFindElement): [Bug 3192636]: Guard escape - sequence scans to not overrun the string end. - -2011-03-05 Don Porter - - * generic/tclParse.c (TclParseBackslash): [Bug 3200987]: Correct - * tests/parse.test: trunction checks in \x and \u substitutions. - -2011-03-05 Miguel Sofer - - * generic/tclExecute.c (TclStackFree): insure that the execStack - satisfies "at most one free stack after the current one" when - consecutive reallocs caused the creation of intervening stacks. - -2011-03-05 Kevin B. Kenny - - * generic/tclAssembly.c (new file): - * generic/tclBasic.c (Tcl_CreateInterp): - * generic/tclInt.h: - * tests/assemble.test (new file): - * unix/Makefile.in: - * win/Makefile.in: - * win/makefile.vc: Merged dogeen-assembler-branch into HEAD. Since - all functional changes are in the tcl::unsupported namespace, there's - no reason to sequester this code on a separate branch. - -2011-03-05 Miguel Sofer - - * generic/tclExecute.c: Cleaner mem management for TEBCdata - - * generic/tclExecute.c: - * tests/nre.test: Renamed BottomData to TEBCdata, so that the name - refers to what it is rather than to its storage location. - - * generic/tclBasic.c: Renamed struct TEOV_callback to the more - * generic/tclCompExpr.c: descriptive NRE_callback. - * generic/tclCompile.c: - * generic/tclExecute.c: - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclTest.c: - -2011-03-04 Donal K. Fellows - - * generic/tclOOMethod.c (ProcedureMethodCompiledVarConnect) - (ProcedureMethodCompiledVarDelete): [Bug 3185009]: Keep references to - resolved object variables so that an unset doesn't leave any dangling - pointers for code to trip over. - -2011-03-01 Miguel Sofer - - * generic/tclBasic.c (TclNREvalObjv): Missing a variable declaration - in commented out non-optimised code, left for ref in checkin - [b97b771b6d] - -2011-03-03 Don Porter - - * generic/tclResult.c (Tcl_AppendResultVA): Use the directive - USE_INTERP_RESULT [TIP 330] to force compat with interp->result - access, instead of the improvised hack USE_DIRECT_INTERP_RESULT_ACCESS - from releases past. - -2011-03-01 Miguel Sofer - - * generic/tclCompCmdsSZ.c (TclCompileThrowCmd, TclCompileUnsetCmd): - fix leaks - - * generic/tclBasic.c: This is [Patch 3168398], - * generic/tclCompCmdsSZ.c: Joe Mistachkin's optimisation - * generic/tclExecute.c: of Tip #285 - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclInterp.c: - * generic/tclOODecls.h: - * generic/tclStubInit.c: - * win/makefile.vc: - - * generic/tclExecute.c (ExprObjCallback): Fix object leak - - * generic/tclExecute.c (TEBCresume): Store local var array and - constants in automatic vars to reduce indirection, slight perf - increase - - * generic/tclOOCall.c (TclOODeleteContext): Added missing '*' so that - trunk compiles. - - * generic/tclBasic.c (TclNRRunCallbacks): [Patch 3168229]: Don't do - the trampoline dance for commands that do not have an nreProc. - -2011-03-01 Donal K. Fellows - - * generic/tclOO.c (Tcl_NewObjectInstance, TclNRNewObjectInstance) - (TclOOObjectCmdCore, FinalizeObjectCall): - * generic/tclOOBasic.c (TclOO_Object_Destroy, AfterNRDestructor): - * generic/tclOOCall.c (TclOODeleteContext, TclOOGetCallContext): - Reorganization of call context reference count management so that code - is (mostly) simpler. - -2011-01-26 Donal K. Fellows - - * doc/RegExp.3: [Bug 3165108]: Corrected documentation of description - of subexpression info in Tcl_RegExpInfo structure. - -2011-01-25 Jan Nijtmans - - * generic/tclPreserve.c: Don't miss 64-bit address bits in panic - message. - * win/tclWinChan.c: Fix various gcc-4.5.2 64-bit warning - * win/tclWinConsole.c: messages, e.g. by using full 64-bits for - * win/tclWinDde.c: socket fd's - * win/tclWinPipe.c: - * win/tclWinReg.c: - * win/tclWinSerial.c: - * win/tclWinSock.c: - * win/tclWinThrd.c: - -2011-01-19 Jan Nijtmans - - * tools/genStubs.tcl: [FRQ 3159920]: Tcl_ObjPrintf() crashes with - * generic/tcl.decls bad format specifier. - * generic/tcl.h: - * generic/tclDecls.h: - -2011-01-18 Donal K. Fellows - - * generic/tclOOMethod.c (PushMethodCallFrame): [Bug 3001438]: Make - sure that the cmdPtr field of the procPtr is correct and relevant at - all times so that [info frame] can report sensible information about a - frame after a return to it from a recursive call, instead of probably - crashing (depending on what else has overwritten the Tcl stack!) - -2011-01-18 Jan Nijtmans - - * generic/tclBasic.c: Various mismatches between Tcl_Panic - * generic/tclCompCmds.c: format string and its arguments, - * generic/tclCompCmdsSZ.c: discovered thanks to [Bug 3159920] - * generic/tclCompExpr.c: - * generic/tclEnsemble.c: - * generic/tclPreserve.c: - * generic/tclTest.c: - -2011-01-17 Jan Nijtmans - - * generic/tclIOCmd.c: [Bug 3148192]: Commands "read/puts" incorrectly - * tests/chanio.test: interpret parameters. Improved error-message - * tests/io.test regarding legacy form. - * tests/ioCmd.test - -2011-01-15 Kevin B. Kenny - - * doc/tclvars.n: - * generic/tclStrToD.c: - * generic/tclUtil.c (Tcl_PrintDouble): - * tests/util.test (util-16.*): [Bug 3157475]: Restored full Tcl 8.4 - compatibility for the formatting of floating point numbers when - $::tcl_precision is not zero. Added compatibility tests to make sure - that excess trailing zeroes are suppressed for all eight major code - paths. - -2011-01-12 Jan Nijtmans - - * win/tclWinFile.c: Use _vsnprintf in stead of vsnprintf, because - MSVC 6 doesn't have it. Reported by andreask. - * win/tcl.m4: handle --enable-64bit=ia64 for gcc - * win/configure.in: more accurate test for correct - * win/configure: (autoconf-2.59) - * win/tclWin32Dll.c: VS 2005 64-bit does not have intrin.h, and - * generic/tclPanic.c: does not need it. - -2011-01-07 Kevin B. Kenny - - * tests/util.test (util-15.*): Added test cases for floating point - conversion of the largest denormal and the smallest normal number, to - avoid any possibility of the failure suffered by PHP in the last - couple of days. (They didn't fail, so no actual functional change.) - -2011-01-05 Donal K. Fellows - - * tests/package.test, tests/pkg.test: Coalesce these tests into one - file that is concerned with the package system. Convert to use - tcltest2 properly. - * tests/autoMkindex.test, tests/pkgMkIndex.test: Convert to use - tcltest2 properly. - -2011-01-01 Donal K. Fellows - - * tests/cmdAH.test, tests/cmdMZ.test, tests/compExpr.test, - * tests/compile.test, tests/concat.test, tests/eval.test, - * tests/fileName.test, tests/fileSystem.test, tests/interp.test, - * tests/lsearch.test, tests/namespace-old.test, tests/namespace.test, - * tests/oo.test, tests/proc.test, tests/security.test, - * tests/switch.test, tests/unixInit.test, tests/var.test, - * tests/winDde.test, tests/winPipe.test: Clean up of tests and - conversion to tcltest 2. Target has been to get init and cleanup code - out of the test body and into the -setup/-cleanup stanzas. - - * tests/execute.test (execute-11.1): [Bug 3142026]: Added test that - fails (with a crash) in an unfixed memdebug build on 64-bit systems. - -2010-12-31 Donal K. Fellows - - * generic/tclCmdIL.c (SortElement): Use unions properly in the - definition of this structure so that there is no need to use nasty - int/pointer type punning. Made it clearer what the purposes of the - various parts of the structure are. - -2010-12-31 Jan Nijtmans - - * unix/dltest/*.c: [Bug 3148192]: Fix broken [load] tests by ensuring - that the affected files are never compiled with -DSTATIC_BUILD. - -2010-12-30 Miguel Sofer - - * generic/tclExecute.c (GrowEvaluationStack): Off-by-one error in - sizing the new allocation - was ok in comment but wrong in the code. - Triggered by [Bug 3142026] which happened to require exactly one more - than what was in existence. - -2010-12-26 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Fix crash when multiple -index - options are used. Simplified memory handling logic. - -2010-12-20 Jan Nijtmans - - * win/tclWin32Dll.c: [Patch 3059922]: fixes for mingw64 - gcc4.5.1 - tdm64-1: completed for all environments. - -2010-12-20 Jan Nijtmans - - * win/configure.in: Explicitely test for intrinsics support in - compiler, before assuming only MSVC has it. - * win/configure: (autoconf-2.59) - * generic/tclPanic.c: - -2010-12-19 Jan Nijtmans - - * win/tclWin32Dll.c: [Patch 3059922]: fixes for mingw64 - gcc4.5.1 - tdm64-1: Fixed for gcc, not yet for MSVC 64-bit. - -2010-12-17 Stuart Cassoff - - * unix/Makefile.in: Remove unwanted/obsolete 'ddd' target. - -2010-12-17 Stuart Cassoff - - * unix/Makefile.in: Clean up '.PHONY:' targets: Arrange those - common to Tcl and Tk as in Tk's Makefile.in, - add any missing ones and remove duplicates. - -2010-12-17 Stuart Cassoff - - * unix/Makefile.in: [Bug 2446711]: Remove 'allpatch' target. - -2010-12-17 Stuart Cassoff - - * unix/Makefile.in: [Bug 2537626]: Use 'rpmbuild', not 'rpm'. - -2010-12-16 Jan Nijtmans - - * generic/tclPanic.c: [Patch 3124554]: Move WishPanic from Tk to Tcl - * win/tclWinFile.c: Better communication with debugger, if present. - -2010-12-15 Kevin B. Kenny - - [dogeen-assembler-branch] - - * tclAssembly.c: - * assemble.test: Reworked beginCatch/endCatch handling to - enforce the more severe (but more correct) restrictions on catch - handling that appeared in the discussion of [Bug 3098302] and in - tcl-core traffic beginning about 2010-10-29. - -2010-12-15 Jan Nijtmans - - * generic/tclPanic.c: Restore abort() as it was before. - * win/tclWinFile.c: [Patch 3124554]: Use ExitProcess() here, like - in wish. - -2010-12-14 Jan Nijtmans - - * generic/tcl.h: [Bug 3137454]: Tcl CVS HEAD does not build on GCC 3. - -2010-12-14 Reinhard Max - - * win/tclWinSock.c (CreateSocket): Swap the loops over - * unix/tclUnixSock.c (CreateClientSocket): local and remote addresses, - so that the system's address preference for the remote side decides - which family gets tried first. Cleanup and clarify some of the - comments. - -2010-12-13 Jan Nijtmans - - * generic/tcl.h: [Bug 3135271]: Link error due to hidden - * unix/tcl.m4: symbols (CentOS 4.2) - * unix/configure: (autoconf-2.59) - * win/tclWinFile.c: Undocumented feature, only meant to be used by - Tk_Main. See [Patch 3124554]: Move WishPanic from Tk to Tcl - -2010-12-12 Stuart Cassoff - - * unix/tcl.m4: Better building on OpenBSD. - * unix/configure: (autoconf-2.59) - -2010-12-10 Jan Nijtmans - - * generic/tcl.h: [Bug 3129448]: Possible over-allocation on - * generic/tclCkalloc.c: 64-bit platforms, part 2 - * generic/tclCompile.c: - * generic/tclHash.c: - * generic/tclInt.h: - * generic/tclIO.h: - * generic/tclProc.c: - -2010-12-10 Alexandre Ferrieux - - * generic/tclIO.c: Make sure [fcopy -size ... -command ...] always - * tests/io.test: calls the callback asynchronously, even for size - zero. - -2010-12-10 Jan Nijtmans - - * generic/tclBinary.c: Fix gcc -Wextra warning: missing initializer - * generic/tclCmdAH.c: - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclDictObj.c: - * generic/tclIndexObj.c: - * generic/tclIOCmd.c: - * generic/tclVar.c: - * win/tcl.m4: Fix manifest-generation for 64-bit gcc - (mingw-w64) - * win/configure.in: Check for availability of intptr_t and - uintptr_t - * win/configure: (autoconf-2.59) - * generic/tclInt.decls: Change 1st param of TclSockMinimumBuffers - * generic/tclIntDecls.h: to ClientData, and TclWin(Get|Set)SockOpt - * generic/tclIntPlatDecls.h:to SOCKET, because on Win64 those are - * generic/tclIOSock.c: 64-bit, which does not fit. - * win/tclWinSock.c: - * unix/tclUnixSock.c: - -2010-12-09 Donal K. Fellows - - * tests/fCmd.test: Improve sanity of constraints now that we don't - support anything before Windows 2000. - - * generic/tclCmdAH.c (TclInitFileCmd, TclMakeFileCommandSafe, ...): - Break up [file] into an ensemble. Note that the ensemble is safe in - itself, but the majority of its subcommands are not. - * generic/tclFCmd.c (FileCopyRename,TclFileDeleteCmd,TclFileAttrsCmd) - (TclFileMakeDirsCmd): Adjust these subcommand implementations to work - inside an ensemble. - (TclFileLinkCmd, TclFileReadLinkCmd, TclFileTemporaryCmd): Move these - subcommand implementations from tclCmdAH.c, where they didn't really - belong. - * generic/tclIOCmd.c (TclChannelNamesCmd): Move to more appropriate - source file. - * generic/tclEnsemble.c (TclMakeEnsemble): Start of code to make - partially-safe ensembles. Currently does not function as expected due - to various shortcomings in how safe interpreters are constructed. - * tests/cmdAH.test, tests/fCmd.test, tests/interp.test: Test updates - to take into account systematization of error messages. - - * tests/append.test, tests/appendComp.test: Clean up tests so that - they don't leave things in the global environment (detected when doing - -singleproc testing). - -2010-12-07 Donal K. Fellows - - * tests/fCmd.test, tests/safe.test, tests/uplevel.test, - * tests/upvar.test, tests/var.test: Convert more tests to tcltest2 and - factor them to be easier to understand. - - * generic/tclStrToD.c: Tidy up code so that more #ifdef-fery is - quarantined at the front of the file and function headers follow the - modern Tcl style. - -2010-12-06 Jan Nijtmans - - * generic/tclBinary.c: [Bug 3129448]: Possible over-allocation on - * generic/tclCkalloc.c: 64-bit platforms. - * generic/tclTrace.c: - -2010-12-05 Jan Nijtmans - - * unix/tcl.m4: [Patch 3116490]: Cross-compile support for unix - * unix/configure: (autoconf-2.59) - -2010-12-03 Jeff Hobbs - - * generic/tclUtil.c (TclReToGlob): Add extra check for multiple inner - *s that leads to poor recursive glob matching, defer to original RE - instead. tclbench RE var backtrack. - -2010-12-03 Jan Nijtmans - - * generic/tclUtil.c: Silence gcc warning when using -Wwrite-strings - * generic/tclStrToD.c: Silence gcc warning for non-IEEE platforms - * win/Makefile.in: [Patch 3116490]: Cross-compile Tcl mingw32 on unix - * win/tcl.m4: This makes it possible to cross-compile Tcl/Tk for - * win/configure.in: Windows (either 32-bit or 64-bit) out-of-the-box - * win/configure: on UNIX, using mingw-w64 build tools (If Itcl, - tdbc and Thread take over the latest tcl.m4, they can do that too). - -2010-12-01 Kevin B. Kenny - - * generic/tclStrToD.c (SetPrecisionLimits, TclDoubleDigits): - [Bug 3124675]: Added meaningless initialization of 'i', 'ilim' and - 'ilim1' to silence warnings from the C compiler about possible use of - uninitialized variables, Added a panic to the 'switch' that assigns - them, to assert that the 'default' case is impossible. - -2010-12-01 Jan Nijtmans - - * generic/tclBasic.c: Fix gcc 64-bit warnings: cast from pointer to - * generic/tclHash.c: integer of different size. - * generic/tclTest.c: - * generic/tclThreadTest.c: - * generic/tclStrToD.c: Fix gcc(-4.5.2) warning: 'static' is not at - beginning of declaration. - * generic/tclPanic.c: Allow Tcl_Panic() to enter the debugger on win32 - * generic/tclCkalloc.c: Use Tcl_Panic() in stead of duplicating the - code. - -2010-11-30 Jeff Hobbs - - * generic/tclInt.decls, generic/tclInt.h, generic/tclIntDecls.h: - * generic/tclStubInit.c: TclFormatInt restored at slot 24 - * generic/tclUtil.c (TclFormatInt): restore TclFormatInt func from - 2005-07-05 macro-ization. Benchmarks indicate it is faster, as a key - int->string routine (e.g. int-indexed arrays). - -2010-11-29 Alexandre Ferrieux - - * generic/tclBasic.c: Patch by Miguel, providing a - [::tcl::unsupported::inject coroname command args], which prepends - ("injects") arbitrary code to a suspended coro's future resumption. - Neat for debugging complex coros without heavy instrumentation. - -2010-11-29 Kevin B. Kenny - - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclStrToD.c: - * generic/tclTest.c: - * generic/tclTomMath.decls: - * generic/tclUtil.c: - * tests/util.test: - * unix/Makefile.in: - * win/Makefile.in: - * win/makefile.vc: Rewrite of Tcl_PrintDouble and TclDoubleDigits that - (a) fixes a severe performance problem with floating point shimmering - reported by Karl Lehenbauer, (b) allows TclDoubleDigits to generate - the digit strings for 'e' and 'f' format, so that it can be used for - tcl_precision != 0 (and possibly later for [format]), (c) fixes [Bug - 3120139] by making TclPrintDouble inherently locale-independent, (d) - adds test cases to util.test for correct rounding in difficult cases - of TclDoubleDigits where fixed- precision results are requested. (e) - adds test cases to util.test for the controversial aspects of [Bug - 3105247]. As a side effect, two more modules from libtommath - (bn_mp_set_int.c and bn_mp_init_set_int.c) are brought into the build, - since the new code uses them. - - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - * generic/tclTomMathDecls.h: Regenerated. - -2010-11-24 Donal K. Fellows - - * tests/chanio.test, tests/iogt.test, tests/ioTrans.test: Convert more - tests to tcltest2 and factor them to be easier to understand. - -2010-11-20 Donal K. Fellows - - * tests/chanio.test: Converted many tests to tcltest2 by marking the - setup and cleanup parts as such. - -2010-11-19 Jan Nijtmans - - * win/tclWin32Dll.c: Fix gcc warnings: unused variable 'registration' - * win/tclWinChan.c: - * win/tclWinFCmd.c: - -2010-11-18 Jan Nijtmans - - * win/tclAppInit.c: [FRQ 491789]: "setargv() doesn't support a unicode - cmdline" now implemented for cygwin and mingw32 too. - * tests/main.test: No longer disable tests Tcl_Main-1.4 and 1.6 on - Windows, because those now work on all supported platforms. - * win/configure.in: Set NO_VIZ=1 when zlib is compiled in libtcl, - this resolves compiler warnings in 64-bit and static builds. - * win/configure (regenerated) - -2010-11-18 Donal K. Fellows - - * doc/file.n: [Bug 3111298]: Typofix. - - * tests/oo.test: [Bug 3111059]: Added testing that neatly trapped this - issue. - -2010-11-18 Miguel Sofer - - * generic/tclNamesp.c: [Bug 3111059]: Fix leak due to bad looping - construct. - -2010-11-17 Jan Nijtmans - - * win/tcl.m4: [FRQ 491789]: "setargv() doesn't support a unicode - cmdline" now implemented for mingw-w64 - * win/configure (re-generated) - -2010-11-16 Jan Nijtmans - - * win/tclAppInit.c:Bring compilation under mingw-w64 a bit closer - * win/cat.c: to reality. See for what's missing: - * win/tcl.m4: - * win/configure: (re-generated) - * win/tclWinPort.h: [Bug 3110161]: Extensions using TCHAR don't - compile on VS2005 SP1 - -2010-11-15 Andreas Kupries - - * doc/interp.n: [Bug 3081184]: TIP #378. - * doc/tclvars.n: Performance fix for TIP #280. - * generic/tclBasic.c: - * generic/tclExecute.c: - * generic/tclInt.h: - * generic/tclInterp.c: - * tests/info.test: - * tests/interp.test: - -2010-11-10 Andreas Kupries - - * changes: Updates for 8.6b2 release. - -2010-11-09 Donal K. Fellows - - * generic/tclOOMethod.c (ProcedureMethodVarResolver): [Bug 3105999]: - * tests/oo.test: Make sure that resolver structures that are - only temporarily needed get squelched. - -2010-11-05 Jan Nijtmans - - * generic/tclMain.c: Thanks, Kevin, for the fix, but this how it was - supposed to be (TCL_ASCII_MAIN is only supposed to be defined on - WIN32). - -2010-11-05 Kevin B. Kenny - - * generic/tclMain.c: Added missing conditional on _WIN32 around code - that messes around with the definition of _UNICODE, to correct a badly - broken Unix build from Jan's last commit. - -2010-11-04 Jan Nijtmans - - * generic/tclDecls.h: [FRQ 491789]: "setargv() doesn't support a - * generic/tclMain.c: unicode cmdline" implemented for Tcl on MSVC++ - * doc/Tcl_Main.3: - * win/tclAppInit.c: - * win/makefile.vc: - * win/Makefile.in: - * win/tclWin32Dll.c: Eliminate minor MSVC warning TCHAR -> char - conversion - -2010-11-04 Reinhard Max - - * tests/socket.test: Run the socket tests three times with the address - family set to any, inet, and inet6 respectively. Use constraints to - skip the tests if a family is found to be unsupported or not - configured on the local machine. Adjust the tests to dynamically adapt - to the address family that is being tested. - - Rework some of the tests to speed them up by avoiding (supposedly) - unneeded [after]s. - -2010-11-04 Stuart Cassoff - - * unix/Makefile.in: [Patch 3101127]: Installer Improvements. - * unix/install-sh: - -2010-11-04 Donal K. Fellows - - * tests/error.test (error-19.13): Another variation on testing for - issues in [try] compilation. - - * doc/Tcl.n (Variable substitution): [Bug 3099086]: Increase clarity - of explanation of what characters are actually permitted in variable - substitutions. Note that this does not constitute a change of - behavior; it is just an improvement of explanation. - -2010-11-04 Don Porter - - * changes: Updates for 8.6b2 release. (Thanks Andreas Kupries) - -2010-11-03 Jan Nijtmans - - * win/tclWinFcmd.c: [FRQ 2965056]: Windows build with -DUNICODE - * win/tclWinFile.c: (more clean-ups for pre-win2000 stuff) - * win/tclWinReg.c: - -2010-11-03 Donal K. Fellows - - * generic/tclCmdMZ.c (TryPostBody): Ensure that errors when setting - * tests/error.test (error-19.1[12]): message/opt capture variables get - reflected properly to the caller. - -2010-11-03 Kevin B. Kenny - - * generic/tclCompCmds.c (TclCompileCatchCmd): [Bug 3098302]: - * tests/compile.test (compile-3.6): Reworked the compilation of the - [catch] command so as to avoid placing any code that might throw an - exception (specifically, any initial substitutions or any stores to - result or options variables) between the BEGIN_CATCH and END_CATCH but - outside the exception range. Added a test case that panics on a stack - smash if the change is not made. - -2010-11-01 Stuart Cassoff - - * library/safe.tcl: Improved handling of non-standard module path - * tests/safe.test: lists, empty path lists in particular. - -2010-11-01 Kevin B. Kenny - - * library/tzdata/Asia/Hong_Kong: - * library/tzdata/Pacific/Apia: - * library/tzdata/Pacific/Fiji: Olson's tzdata2010o. - -2010-10-29 Alexandre Ferrieux - - * generic/tclTimer.c: [Bug 2905784]: Stop small [after]s from - wasting CPU while keeping accuracy. - -2010-10-28 Kevin B. Kenny - - [dogeen-assembler-branch] - * generic/tclAssembly.c: - * tests/assembly.test (assemble-31.*): Added jump tables. - -2010-10-28 Don Porter - - * tests/http.test: [Bug 3097490]: Make http-4.15 pass in - isolation. - - * unix/tclUnixSock.c: [Bug 3093120]: Prevent calls of - freeaddrinfo(NULL) which can crash some - systems. Thanks Larry Virden. - -2010-10-26 Reinhard Max - - * Changelog.2008: Split off from Changelog. - * generic/tclIOSock.c (TclCreateSocketAddress): The interp != NULL - check is needed for ::tcl::unsupported::socketAF as well. - -2010-10-26 Donal K. Fellows - - * unix/tclUnixSock.c (TcpGetOptionProc): Prevent crash if interp is - * win/tclWinSock.c (TcpGetOptionProc): NULL (a legal situation). - -2010-10-26 Reinhard Max - - * unix/tclUnixSock.c (TcpGetOptionProc): Added support for - ::tcl::unsupported::noReverseDNS, which if set to any value, prevents - [fconfigure -sockname] and [fconfigure -peername] from doing - reverse DNS queries. - -2010-10-24 Kevin B. Kenny - - [dogeen-assembler-branch] - * generic/tclAssembly.c: - * tests/assembly.test (assemble-17.15): Reworked branch handling so - that forward branches can use jump1 (jumpTrue1, jumpFalse1). Added - test cases that the forward branches will expand to jump4, jumpTrue4, - jumpFalse4 when needed. - -2010-10-23 Kevin B. Kenny - - [dogeen-assembler-branch] - * generic/tclAssembly.h (removed): - Removed file that was included in only one - source file. - * generictclAssembly.c: Inlined tclAssembly.h. - -2010-10-17 Alexandre Ferrieux - - * doc/info.n: [Patch 2995655]: - * generic/tclBasic.c: Report inner contexts in [info errorstack] - * generic/tclCompCmds.c: - * generic/tclCompile.c: - * generic/tclCompile.h: - * generic/tclExecute.c: - * generic/tclInt.h: - * generic/tclNamesp.c: - * tests/error.test: - * tests/result.test: - -2010-10-20 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileDictForCmd): Update the compilation - * generic/tclCompile.c (tclInstructionTable): of [dict for] so that - * generic/tclExecute.c (TEBCresume): it no longer makes any - use of INST_DICT_DONE now that's not needed, and make it clearer in - the implementation of the instruction that it's just a deprecated form - of unset operation. Followup to my commit of 2010-10-16. - -2010-10-19 Donal K. Fellows - - * generic/tclZlib.c (Tcl_ZlibStreamGet): [Bug 3081008]: Ensure that - when a bytearray gets its internals entangled with zlib for more than - a passing moment, that bytearray will never be shimmered away. This - increases the amount of copying but is simple to get right, which is a - reasonable trade-off. - - * generic/tclStringObj.c (Tcl_AppendObjToObj): Added some special - cases so that most of the time when you build up a bytearray by - appending, it actually ends up being a bytearray rather than - shimmering back and forth to string. - - * tests/http11.test (check_crc): Use a simpler way to express the - functionality of this procedure. - - * generic/tclZlib.c: Purge code that wrote to the object returned by - Tcl_GetObjResult, as we don't want to do that anti-pattern no more. - -2010-10-18 Jan Nijtmans - - * tools/uniParse.tcl: [Bug 3085863]: tclUniData was 9 years old; - Ignore non-BMP characters and fix comment about UnicodeData.txt file. - * generic/regcomp.c: Fix comment - * tests/utf.test: Add some Unicode 6 testcases - -2010-10-17 Alexandre Ferrieux - - * doc/info.n: Document [info errorstack] faithfully. - -2010-10-16 Donal K. Fellows - - * generic/tclExecute.c (ReleaseDictIterator): Factored out the release - of the bytecode-level dictionary iterator information so that the - side-conditions on instruction issuing are simpler. - -2010-10-15 Jan Nijtmans - - * generic/reg_locale.c: [Bug 3085863]: tclUniData 9 years old: Updated - * generic/tclUniData.c: Unicode tables to latest UnicodeData.txt, - * tools/uniParse.tcl: corresponding with Unicode 6.0 (except for - out-of-range chars > 0xFFFF) - -2010-10-13 Don Porter - - * generic/tclCompile.c: Alternative fix for [Bugs 467523,983660] where - * generic/tclExecute.c: sharing of empty scripts is allowed again. - -2010-10-13 Jan Nijtmans - - * win/tclWinThrd.h: (removed) because it is just empty en used nowhere - * win/tcl.dsp - -2010-10-12 Jan Nijtmans - - * tools/uniClass.tcl: Spacing and comments: let uniClass.tcl - * generic/regc_locale.c: generation match better the current - (hand-modified) regc_locale.c - * tools/uniParse.tcl: Generate proper const qualifiers for - * generic/tclUniData.c: tclUniData.c - -2010-10-12 Reinhard Max - - * unix/tclUnixSock.c (CreateClientSocket): [Bug 3084338]: Fix a - memleak and refactor the calls to freeaddrinfo(). - -2010-10-11 Jan Nijtmans - - * win/tclWinDde.c: [FRQ 2965056]: Windows build with -DUNICODE - * win/tclWinReg.c: - * win/tclWinTest.c: More cleanups - * win/tclWinFile.c: Add netapi32 to the link line, so we no longer - * win/tcl.m4: have to use LoadLibrary to access those - functions. - * win/makefile.vc: - * win/configure: (Re-generate with autoconf-2.59) - * win/rules.vc Update for VS10 - -2010-10-09 Miguel Sofer - - * generic/tclExecute.c: Fix overallocation of exec stack in TEBC (due - to mixing numwords and numbytes) - -2010-10-08 Jan Nijtmans - - * generic/tclIOSock.c: On Windows, use gai_strerrorA - -2010-10-06 Don Porter - - * tests/winPipe.test: Test hygiene with makeFile and removeFile. - - * generic/tclCompile.c: [Bug 3081065]: Prevent writing to the intrep - * tests/subst.test: fields of a freed Tcl_Obj. - -2010-10-06 Kevin B. Kenny - - [dogeen-assembler-branch] - - * generic/tclAssembly.c: - * generic/tclAssembly.h: - * tests/assemble.test: Added catches. Still needs a lot of testing. - -2010-10-02 Kevin B. Kenny - - [dogeen-assembler-branch] - - * generic/tclAssembly.c: - * generic/tclAssembly.h: - * tests/assemble.test: Added dictAppend, dictIncrImm, dictLappend, - dictSet, dictUnset, nop, regexp, nsupvar, upvar, and variable. - -2010-10-02 Donal K. Fellows - - * generic/tclExecute.c (TEBCresume): [Bug 3079830]: Added invalidation - of string representations of dictionaries in some cases. - -2010-10-01 Jeff Hobbs - - * generic/tclExecute.c (EvalStatsCmd): change 'evalstats' to return - data to interp by default, or if given an arg, use that as filename to - output to (accepts 'stdout' and 'stderr'). Fix output to print used - inst count data. - * generic/tclCkalloc.c: Change TclDumpMemoryInfo sig to allow objPtr - * generic/tclInt.decls: as well as FILE* as output. - * generic/tclIntDecls.h: - -2010-10-01 Donal K. Fellows - - * generic/tclBasic.c, generic/tclClock.c, generic/tclEncoding.c, - * generic/tclEnv.c, generic/tclLoad.c, generic/tclNamesp.c, - * generic/tclObj.c, generic/tclRegexp.c, generic/tclResolve.c, - * generic/tclResult.c, generic/tclUtil.c, macosx/tclMacOSXFCmd.c: - More purging of strcpy() from locations where we already know the - length of the data being copied. - -2010-10-01 Kevin B. Kenny - - [dogeen-assembler-branch] - - * tests/assemble.test: - * generic/tclAssemble.h: - * generic/tclAssemble.c: Added listIn, listNotIn, and dictGet. - -2010-09-30 Kevin B. Kenny - - [dogeen-assembler-branch] - - * tests/assemble.test: Added tryCvtToNumeric and several more list - * generic/tclAssemble.c: operations. - * generic/tclAssemble.h: - -2010-09-29 Kevin B. Kenny - - [dogeen-assembler-branch] - - * tests/assemble.test: Completed conversion of tests to a - * generic/tclAssemble.c: "white box" structure that follows the - C code. Added missing safety checks on the operands of 'over' and - 'reverse' so that negative operand counts don't smash the stack. - -2010-09-29 Jan Nijtmans - - * unix/configure: Re-generate with autoconf-2.59 - * win/configure: - * generic/tclMain.c: Make compilable with -DUNICODE as well - -2010-09-28 Reinhard Max - - TIP #162 IMPLEMENTATION - - * doc/socket.n: Document the changes to the [socket] and - [fconfigure] commands. - - * generic/tclInt.h: Introduce TclCreateSocketAddress() as a - * generic/tclIOSock.c: replacement for the platform-dependent - * unix/tclUnixSock.c: TclpCreateSocketAddress() functions. Extend - * unix/tclUnixChan.c: the [socket] and [fconfigure] commands to - * unix/tclUnixPort.h: behave as proposed in TIP #162. This is the - * win/tclWinSock.c: core of what is required to support the use of - * win/tclWinPort.h: IPv6 sockets in Tcl. - - * compat/fake-rfc2553.c: A compat implementation of the APIs defined - * compat/fake-rfc2553.h: in RFC-2553 (getaddrinfo() and friends) on - top of the existing gethostbyname() etc. - * unix/configure.in: Test whether the fake-implementation is - * unix/tcl.m4: needed. - * unix/Makefile.in: Add a compile target for fake-rfc2553. - - * win/configure.in: Allow cross-compilation by default. - - * tests/socket.test: Improve the test suite to make more use of - * tests/remote.tcl: randomized ports to reduce interference with - tests running in parallel or other services on - the machine. - -2010-09-28 Kevin B. Kenny - - [dogeen-assembler-branch] - - * tests/assemble.test: Added more "white box" tests. - * generic/tclAssembly.c: Added the error checking and reporting - for undefined labels. Revised code so that no pointers into the - bytecode sequence are held (because the sequence can move!), - that no Tcl_HashEntry pointers are held (because the hash table - doesn't guarantee their stability!) and to eliminate the BBHash - table, which is merely additional information indexed by jump - labels and can just as easily be held in the 'label' structure. - Renamed shared structures to CamelCase, and renamed 'label' to - JumpLabel because other types of labels may eventually be possible. - -2010-09-27 Kevin B. Kenny - - [dogeen-assembler-branch] - - * tests/assemble.test: Added more "white box" tests. - * generic/tclAssembly.c: Fixed bugs exposed by the new tests. - (a) [eval] and [expr] had incorrect stack balance computed if - the arg was not a simple word. (b) [concat] accepted a negative - operand count. (c) [invoke] accepted a zero or negative operand - count. (d) more misspelt error messages. - Also replaced a funky NRCallTEBC with the new call - TclNRExecuteByteCode, necessitated by a merge with changes on the - HEAD. - -2010-09-26 Miguel Sofer - - * generic/tclBasic.c: [Patch 3072080] (minus the itcl - * generic/tclCmdIL.c: update): a saner NRE. - * generic/tclCompExpr.c: - * generic/tclCompile.c: This makes TclNRExecuteByteCode (ex TEBC) - * generic/tclCompile.h: to be a normal NRE citizen: it loses its - * generic/tclExecute.c: special status. - * generic/tclInt.decls: The logic flow within the BC engine is - * generic/tclInt.h: simplified considerably. - * generic/tclIntDecls.h: - * generic/tclObj.c: - * generic/tclProc.c: - * generic/tclTest.c: - - * generic/tclVar.c: Use the macro HasLocalVars everywhere - -2010-09-26 Miguel Sofer - - * generic/tclOOMethod.c (ProcedureMethodVarResolver): avoid code - duplication, let the runtime var resolver call the compiled var - resolver. - -2010-09-26 Kevin B. Kenny - - [dogeen-assembler-branch] - - * tests/assemble.test: Added many new tests moving toward a more - comprehensive test suite for the assembler. - * generic/tclAssembly.c: Fixed bugs exposed by the new tests: - (a) [bitnot] and [not] had incorrect operand counts. (b) - INST_CONCAT cannot concatenate zero objects. (c) misspelt error - messages. (d) the "assembly code" internal representation lacked - a duplicator, which caused double-frees of the Bytecode object - if assembly code ever was duplicated. - -2010-09-25 Kevin B. Kenny - - [dogeen-assembler-branch] - - * generic/tclAssembly.c: Massive refactoring of the assembler - * generic/tclAssembly.h: to use a Tcl-like syntax (and use - * tests/assemble.test: Tcl_ParseCommand to parse it). The - * tests/assemble1.bench: refactoring also ensures that - Tcl_Tokens in the assembler have string ranges inside the source - code, which allows for [eval] and [expr] assembler directives - that simply call TclCompileScript and TclCompileExpr recursively. - -2010-09-24 Jeff Hobbs - - * tests/stringComp.test: improved string eq/cmp test coverage - * generic/tclExecute.c (TclExecuteByteCode): merge INST_STR_CMP and - INST_STR_EQ/INST_STR_NEQ paths. Speeds up eq/ne/[string eq] with - obj-aware comparisons and eq/==/ne/!= with length equality check. - -2010-09-24 Andreas Kupries - - * tclWinsock.c: [Bug 3056775]: Fixed race condition between thread and - internal co-thread access of a socket's structure because of the - thread not using the socketListLock in TcpAccept(). Added - documentation on how the module works to the top. - -2010-09-23 Jan Nijtmans - - * generic/tclDecls.h: Make Tcl_SetPanicProc and Tcl_GetStringResult - * unix/tclAppInit.c: callable without stubs, just as Tcl_SetVar. - * win/tclAppInit.c: - -2010-09-23 Don Porter - - * generic/tclCmdAH.c: Fix cases where value returned by - * generic/tclEvent.c: Tcl_GetReturnOptions() was leaked. - * generic/tclMain.c: Thanks to Jeff Hobbs for discovery of the - anti-pattern to seek and destroy. - -2010-09-23 Jan Nijtmans - - * unix/tclAppInit.c: Make compilable with -DUNICODE (not activated - * win/tclAppInit.c: yet), many clean-ups in comments. - -2010-09-22 Miguel Sofer - - * generic/tclExecute: [Bug 3072640]: One more DECACHE_STACK_INFO() was - missing. - - * tests/execute.test: Added execute-10.3 for [Bug 3072640]. The test - causes a mem failure. - - * generic/tclExecute: Protect all possible writes to ::errorInfo or - ::errorCode with DECACHE_STACK_INFO(), as they could run traces. The - new calls to be protected are Tcl_ResetResult(), Tcl_SetErrorCode(), - IllegalExprOperandType(), TclExprFloatError(). The error was triggered - by [Patch 3072080]. - -2010-09-22 Jan Nijtmans - - * win/tcl.m4: Add kernel32 to LIBS, so the link line for - * win/configure: mingw is exactly the same as for MSVC++. - -2010-09-21 Jeff Hobbs - - * generic/tclExecute.c (TclExecuteByteCode): - * generic/tclOOMethod.c (ProcedureMethodCompiledVarConnect): - * generic/tclVar.c (TclLookupSimpleVar, CompareVarKeys): - * generic/tclPathObj.c (Tcl_FSGetNormalizedPath, Tcl_FSEqualPaths): - * generic/tclIOUtil.c (TclFSCwdPointerEquals): peephole opt - * generic/tclResult.c (TclMergeReturnOptions): Use memcmp where - applicable as possible speedup on some libc variants. - -2010-09-21 Kevin B. Kenny - - [BRANCH: dogeen-assembler-branch] - - * generic/tclAssembly.c (new file): - * generic/tclAssembly.h: - * generic/tclBasic.c (builtInCmds, Tcl_CreateInterp): - * generic/tclInt.h: - * tests/assemble.test (new file): - * tests/assemble1.bench (new file): - * unix/Makefile.in: - * win/Makefile.in: - * win/Makefile.vc: - Initial commit of Ozgur Dogan Ugurlu's (SF user: dogeen) - assembler for the Tcl bytecode language. - -2010-09-21 Jan Nijtmans - - * win/tclWinFile.c: Fix declaration after statement. - * win/tcl.m4: Add -Wdeclaration-after-statement, so this - * win/configure: mistake cannot happen again. - * win/tclWinFCmd.c: [Bug 3069278]: Breakage on head Windows - * win/tclWinPipe.c: triggered by install-tzdata, final fix - -2010-09-20 Jan Nijtmans - - * win/tclWinFCmd.c: Eliminate tclWinProcs->useWide everywhere, since - * win/tclWinFile.c: the value is always "1" on platforms >win95 - * win/tclWinPipe.c: - -2010-09-19 Donal K. Fellows - - * doc/file.n (file readlink): [Bug 3070580]: Typofix. - -2010-09-18 Jan Nijtmans - - * win/tclWinFCmd.c [Bug 3069278]: Breakage on head Windows triggered - by install-tzdata. Temporary don't compile this with -DUNICODE, while - investigating this bug. - -2010-09-16 Jeff Hobbs - - * win/tclWinFile.c: Remove define of FINDEX_INFO_LEVELS as all - supported versions of compilers should now have it. - - * unix/Makefile.in: Do not pass current build env vars when using - NATIVE_TCLSH in targets. - -2010-09-16 Jan Nijtmans - - * generic/tclDecls.h: Make Tcl_FindExecutable() work in UNICODE - * generic/tclEncoding.c: compiles (windows-only) as well as ASCII. - * generic/tclStubInit.c: Needed for [FRQ 491789]: setargv() doesn't - support a unicode cmdline. - -2010-09-15 Donal K. Fellows - - * generic/tclBinary.c (TclAppendBytesToByteArray): [Bug 3067036]: Make - sure we never try to double zero repeatedly to get a buffer size. Also - added a check for sanity on the size of buffer being appended. - -2010-09-15 Don Porter - - * unix/Makefile.in: Revise `make dist` target to tolerate the - case of zero bundled packages. - -2010-09-15 Jan Nijtmans - - * tools/genStubs.tcl: [Patch 3034251]: Backport ttkGenStubs.tcl - * generic/tcl.decls: features to genStubs.tcl. Make the "generic" - * generic/tclInt.decls: argument in the *.decls files optional - * generic/tclOO.decls: (no change to any tcl*Decls.h files) - * generic/tclTomMath.decls: - This allows genStubs.tcl to generate the ttk stub files as well, while - keeping full compatibility with existing *.decls files. - -2010-09-14 Jan Nijtmans - - * win/tclWinPort.h: Allow all Win2000+ API entries in Tcl - * win/tclWin32Dll.c: Eliminate dynamical loading of advapi23 and - kernel32 symbols. - -2010-09-13 Jan Nijtmans - - * win/tclWinChan.c: Various clean-ups, converting from - * win/tclWinConsole.c: tclWinProc->xxxProc directly to Xxx - * win/tclWinInit.c: (no change in functionality) - * win/tclWinLoad.c: - * win/tclWinSerial.c: - * win/tclWinSock.c: - * tools/genStubs.tcl: Add scspec feature from ttkGenStubs.tcl - (no change in output for *Decls.h files) - -2010-09-10 Jan Nijtmans - - * win/tclWin32Dll.c: Partly revert yesterday's change, to make it work - on VC++ 6.0 again. - -2010-09-10 Donal K. Fellows - - * doc/regsub.n: [Bug 3063568]: Fix for gotcha in example due to Tcl's - special handling of backslash-newline. Makes example slightly less - pure, but more useful. - -2010-09-09 Jan Nijtmans - - * win/makefile.vc: Mingw should always link with -ladvapi32. - * win/tcl.m4: - * win/configure: (regenerated) - * win/tclWinInt.h: Remove ascii variant of tkWinPocs table, it is - * win/tclWin32Dll.c: no longer necessary. Fix CreateProcess signature - * win/tclWinPipe.c: and remove unused GetModuleFileName and lstrcpy. - * win/tclWinPort.h: Mingw/cygwin fixes: should always be - included, and fix conflict in various macro values: Always force the - same values as in VC++. - -2010-09-08 Don Porter - - * win/tclWinChan.c: [Bug 3059922]: #ifdef protections to permit - * win/tclWinFCmd.c: builds with mingw on amd64 systems. Thanks to - "mescalinum" for reporting and testing. - -2010-09-08 Andreas Kupries - - * doc/tm.n: Added underscore to the set of characters accepted in - module names. This is true for quite some time in the code, this - change catches up the documentation. - -2010-09-03 Donal K. Fellows - - * tools/tcltk-man2html.tcl (plus-pkgs): Improve the package - documentation search pattern to support the doctoos-generated - directory structure. - * tools/tcltk-man2html-utils.tcl (output-name): Made this more - resilient against misformatted NAME sections, induced by import of - Thread package documentation into Tcl doc tree. - -2010-09-02 Andreas Kupries - - * doc/glob.n: Fixed documentation ambiguity regarding the handling - of -join. - - * library/safe.tcl (safe::AliasGlob): Fixed another problem, the - option -join does not stop option processing in the core builtin, so - the emulation must not do that either. - -2010-09-01 Andreas Kupries - - * library/safe.tcl (safe::AliasGlob): Moved the command extending the - actual glob command with a -directory flag to when we actually have a - proper untranslated path, - -2010-09-01 Andreas Kupries - - * generic/tclExecute.c: [Bug 3057639]: Applied patch by Jeff to make - * generic/tclVar.c: the behaviour of lappend in bytecompiled mode - * tests/append.test: consistent with direct-eval and 'append' - * tests/appendComp.test: generally. Added tests (append*-9.*) - showing the difference. - -2010-08-31 Jan Nijtmans - - * win/rules.vc: Typo (thanks to Twylite discovering - this) - * generic/tclStubLib.c: Revert to previous version: MSVC++ 6.0 - * generic/tclTomMathStubLib.c:cannot handle the new construct. - * generic/tcl.decls [Patch 2997642]: Many type casts needed - * generic/tclDecls.h: when using Tcl_Pkg* API. Remaining part. - * generic/tclPkg.c: - * generic/tclBasic.c: - * generic/tclTomMathInterface.c: - * doc/PkgRequire.3 - -2010-08-31 Andreas Kupries - - * win/tcl.m4: Applied patch by Jeff fixing issues with the manifest - handling on Win64. - * win/configure: Regenerated. - -2010-08-30 Miguel Sofer - - * generic/tclBasic.c: [Bugs 3046594,3047235,3048771]: New - * generic/tclCmdAH.c: implementation for [tailcall] command: it now - * generic/tclCmdMZ.c: schedules the command and returns TCL_RETURN. - * generic/tclExecute.c: This fixes all issues with [catch] and [try]. - * generic/tclInt.h: Thanks dgp for exploring the dark corners. - * generic/tclNamesp.c: More thorough testing is required. - * tests/tailcall.test: - -2010-08-30 Jan Nijtmans - - * win/Makefile.in: [FRQ 2965056]: Windows build with -DUNICODE - * win/rules.vc: - * win/tclWinFCmd.c: Make sure that allocated TCHAR arrays are - * win/tclWinFile.c: always properly aligned as wchar_t, and - * win/tclWinPipe.c: not bigger than necessary. - * win/tclWinSock.c: - * win/tclWinDde.c: Those 3 files are not converted yet to be - * win/tclWinReg.c: built with -DUNICODE, so add a TODO. - * win/tclWinTest.c: - * generic/tcl.decls: [Patch 2997642]: Many type casts needed when - * generic/tclDecls.h: using Tcl_Pkg* API. Partly. - * generic/tclPkg.c: - * generic/tclStubLib.c: Demonstration how this change can benefit - code. - * generic/tclTomMathStubLib.c: - * doc/PkgRequire.3: - -2010-08-29 Donal K. Fellows - - * doc/dict.n: [Bug 3046999]: Corrected cross reference to array - manpage to refer to (correct) existing subcommand. - -2010-08-26 Jeff Hobbs - - * unix/configure, unix/tcl.m4: SHLIB_LD_LIBS='${LIBS}' for OSF1-V*. - Add /usr/lib64 to set of auto-search dirs. [Bug 1230554] - (SC_PATH_X): Correct syntax error when xincludes not found. - - * win/Makefile.in (VC_MANIFEST_EMBED_DLL VC_MANIFEST_EMBED_EXE): - * win/configure, win/configure.in, win/tcl.m4: SC_EMBED_MANIFEST - macro and --enable-embedded-manifest configure arg added to support - manifest embedding where we know the magic. Help prevents DLL hell - with MSVC8+. - -2010-08-24 Jan Nijtmans - - * generic/tcl.decls: [Bug 3007895]: Tcl_(Find|Create)HashEntry - * generic/tclHash.c: stub entries can never be called. - * generic/tclDecls.h: - * generic/tclStubInit.c: [Patch 2994165]: Change signature of - Tcl_FSGetNativePath and TclpDeleteFile follow-up: move stub entry back - to original location. - -2010-08-23 Kevin B. Kenny - - * library/tzdata/Africa/Cairo: - * library/tzdata/Asia/Gaza: Olson's tzdata2010l. - -2010-08-22 Jan Nijtmans - - * generic/tclBasic.c: [Patch 3009403]: Signature of Tcl_GetHashKey, - * generic/tclBinary.c: Tcl_(Create|Find)HashEntry follow-up: - * generic/tclCmdIL.c: Remove many type casts which are no longer - * generic/tclCompile.c:necessary as a result of this signature change. - * generic/tclDictObj.c: - * generic/tclEncoding.c: - * generic/tclExecute.c: - * generic/tclInterp.c: - * generic/tclIOCmd.c: - * generic/tclObj.c: - * generic/tclProc.c: - * generic/tclTest.c: - * generic/tclTrace.c: - * generic/tclUtil.c: - * generic/tclVar.c: - -2010-08-21 Donal K. Fellows - - * doc/linsert.n: [Bug 3045123]: Make description of what is actually - happening more accurate. - -2010-08-21 Jan Nijtmans - - * tools/genStubs.tcl: [Patch 3034251]: Backport ttkGenStubs.tcl - features to genStubs.tcl, partly: Use void (*reserved$i)(void) = 0 - instead of void *reserved$i = NULL for unused stub entries, in case - pointer-to-function and pointer-to-object are different sizes. - * generic/tcl*Decls.h: (regenerated) - * generic/tcl*StubInit.c:(regenerated) - -2010-08-20 Jan Nijtmans - - * doc/Method.3: Fix definition of Tcl_MethodType. - -2010-08-19 Donal K. Fellows - - * generic/tclTrace.c (TraceExecutionObjCmd, TraceCommandObjCmd) - (TraceVariableObjCmd): [Patch 3048354]: Use memcpy() instead of - strcpy() to avoid buffer overflow; we have the correct length of data - to copy anyway since we've just allocated the target buffer. - -2010-08-18 Jan Nijtmans - - * tools/genStubs.tcl: [Patch 3034251]: Backport ttkGenStubs.tcl - features to genStubs.tcl, partly: remove unneeded ifdeffery and put - C++ guard around stubs pointer definition. - * generic/*Decls.h: (regenerated) - -2010-08-18 Miguel Sofer - - * generic/tclBasic.c: New redesign of [tailcall]: find - * generic/tclExecute.c: errors early on, so that errorInfo - * generic/tclInt.h: contains the proper info [Bug 3047235] - * generic/tclNamesp.c: - - * generic/tclCmdAH.c (TclNRTryObjCmd): [Bug 3046594]: Block - tailcalling out of the body of a non-bc'ed [try]. - - * generic/tclBasic.c: Redesign of [tailcall] to - * generic/tclCmdAH.c: (a) fix [Bug 3047235] - * generic/tclCompile.h: (b) enable fix for [Bug 3046594] - * generic/tclExecute.c: (c) enable recursive tailcalls - * generic/tclInt.h: - * generic/tclNamesp.c: - * tests/tailcall.test: - -2010-08-18 Donal K. Fellows - - * library/safe.tcl (AliasGlob): [Bug 3004191]: Restore safe [glob] to - working condition. - -2010-08-15 Donal K. Fellows - - * generic/tclProc.c (ProcWrongNumArgs): [Bug 3045010]: Make the - handling of passing the wrong number of arguments to [apply] somewhat - less verbose when a lambda term is present. - -2010-08-14 Jan Nijtmans - - * compat/unicows: Remove completely, see [FRQ 2819611]. - * doc/FileSystem.3: [Patch 2994165]: Change signature of - * generic/tcl.decls Tcl_FSGetNativePath and TclpDeleteFile - * generic/tclDecls.h: - * generic/tclIOUtil.c: - * generic/tclStubInit.c: - * generic/tclInt.h: - * unix/tclUnixFCmd.c: - * win/tclWinFCmd.c: - * doc/Hash.3: [Patch 3009403]: Signature of Tcl_GetHashKey, - * generic/tcl.h: Tcl_(Create|Find)HashEntry - -2010-08-11 Jeff Hobbs - - * unix/ldAix: Remove ancient (pre-4.2) AIX support - * unix/configure: Regen with ac-2.59 - * unix/configure.in, unix/tclConfig.sh.in, unix/Makefile.in: - * unix/tcl.m4 (AIX): Remove the need for ldAIX, replace with - -bexpall/-brtl. Remove TCL_EXP_FILE (export file) and other baggage - that went with it. Remove pre-4 AIX build support. - -2010-08-11 Miguel Sofer - - * generic/tclBasic.c (TclNRYieldToObjCmd): - * tests/coroutine.test: Fixed bad copypasta snafu. Thanks to Andy Goth - for finding the bug. - -2010-08-10 Jeff Hobbs - - * generic/tclUtil.c (TclByteArrayMatch): Patterns may not be - null-terminated, so account for that. - -2010-08-09 Don Porter - - * changes: Updates for 8.6b2 release. - -2010-08-04 Jeff Hobbs - - * win/Makefile.in, win/makefile.bc, win/makefile.vc, win/tcl.dsp: - * win/tclWinPipe.c (TclpCreateProcess): - * win/stub16.c (removed): Removed Win9x tclpip8x.dll build and 16-bit - application loader stub support. Win9x is no longer supported. - - * win/tclWin32Dll.c (TclWinInit): Hard-enforce Windows 9x as an - unsupported platform with a panic. Code to support it still exists in - other files (to go away in time), but new APIs are being used that - don't exist on Win9x. - - * unix/tclUnixFCmd.c: Adjust license header as per - ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change - - * license.terms: Fix DFARs note for number-adjusted rights clause - - * win/tclWin32Dll.c (asciiProcs, unicodeProcs): - * win/tclWinLoad.c (TclpDlopen): 'load' use LoadLibraryEx with - * win/tclWinInt.h (TclWinProcs): LOAD_WITH_ALTERED_SEARCH_PATH to - prefer dependent DLLs in same dir as loaded DLL. - - * win/Makefile.in (%.${OBJEXT}): better implicit rules support - -2010-08-04 Andreas Kupries - - * generic/tclIORChan.c: [Bug 3034840]: Fixed reference counting in - * generic/tclIORTrans.c: InvokeTclMethod and callers. - * tests/ioTrans.test: - -2010-08-03 Andreas Kupries - - * tests/var.test (var-19.1): [Bug 3037525]: Added test demonstrating - the local hashtable deletion crash and fix. - - * tests/info.test (info-39.1): Added forward copy of test in 8.5 - branch about [Bug 2933089]. Should not fail, and doesn't, after - updating the line numbers to the changed position. - -2010-08-02 Kevin B. Kenny - - * library/tzdata/America/Bahia_Banderas: - * library/tzdata/Pacific/Chuuk: - * library/tzdata/Pacific/Pohnpei: - * library/tzdata/Africa/Cairo: - * library/tzdata/Europe/Helsinki: - * library/tzdata/Pacific/Ponape: - * library/tzdata/Pacific/Truk: - * library/tzdata/Pacific/Yap: Olson's tzdata2010k. - -2010-08-02 Miguel Sofer - - * generic/tclVar.c: Correcting bad port of [Bug 3037525] fix - -2010-07-28 Miguel Sofer - - * generic/tclVar.c: [Bug 3037525]: Lose fickle optimisation in - TclDeleteVars (used for runtime-created locals) that caused crash. - -2010-07-29 Jan Nijtmans - - * compat/zlib/win32/README.txt: Official build of zlib1.dll 1.2.5 is - * compat/zlib/win32/USAGE.txt: finally available, so put it in. - * compat/zlib/win32/zlib1.dll: - -2010-07-25 Donal K. Fellows - - * doc/http.n: Corrected description of location of one of the entries - in the state array. - -2010-07-24 Jan Nijtmans - - * generic/tclDecls.h: [Bug 3029891]: Functions that don't belong in - * generic/tclTest.c: the stub table. - * generic/tclBasic.c: From [Bug 3030870] make itcl 3.x built with - pre-8.6 work in 8.6: Relax the relation between Tcl_CallFrame and - CallFrame. - -2010-07-16 Donal K. Fellows - - * generic/tclBasic.c: Added more errorCode setting. - -2010-07-15 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Ensure that [dict get] - * generic/tclDictObj.c (DictGetCmd): always generates an errorCode on - a failure to look up an entry. - -2010-07-11 Pat Thoyts - - * unix/configure: (regenerated) - * unix/configure.in: For the NATIVE_TCLSH variable use the autoconf - * unix/Makefile.in: SC_PROG_TCLSH to try and find a locally installed - native binary. This avoids manually fixing up when cross compiling. If - there is not one, revert to using the build product. - -2010-07-02 Don Porter - - * generic/tclInt.decs: Reverted to the original TIP 337 - implementation on what to do with the obsolete internal stub for - TclBackgroundException() (eliminate it!) - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - -2010-07-02 Jan Nijtmans - - * generic/tclInt.decls: [Bug 803489]: Tcl_FindNamespace problem in - * generic/tclIntDecls.h: the Stubs table - * generic/tclStubInit.c: - -2010-07-02 Donal K. Fellows - - * generic/tclExecute.c (IllegalExprOperandType): [Bug 3024379]: Made - sure that errors caused by an argument to an operator being outside - the domain of the operator all result in ::errorCode being ARITH - DOMAIN and not NONE. - -2010-07-01 Jan Nijtmans - - * win/rules.vc: [Bug 3020677]: wish can't link reg1.2 - * tools/checkLibraryDoc.tcl: formatting, spacing, cleanup unused - * tools/eolFix.tcl: variables; no change in generated output - * tools/fix_tommath_h.tcl: - * tools/genStubs.tcl: - * tools/index.tcl: - * tools/man2help2.tcl: - * tools/regexpTestLib.tcl: - * tools/tsdPerf.tcl: - * tools/uniClass.tcl: - * tools/uniParse.tcl: - -2010-07-01 Donal K. Fellows - - * doc/mathop.n: [Bug 3023165]: Fix typo that was preventing proper - rendering of the exclusive-or operator. - -2010-06-28 Jan Nijtmans - - * generic/tclPosixStr.c: [Bug 3019634]: errno.h and tclWinPort.h have - conflicting definitions. Added messages for ENOTRECOVERABLE, EOTHER, - ECANCELED and EOWNERDEAD, and fixed various typing mistakes in other - messages. - -2010-06-25 Reinhard Max - - * tests/socket.test: Prevent a race condition during shutdown of the - remote test server that can cause a hang when the server is being run - in verbose mode. - -2010-06-24 Jan Nijtmans - - * win/tclWinPort.h: [Bug 3019634]: errno.h and tclWinPort.h have - conflicting definitions. - - ***POTENTIAL INCOMPATIBILITY*** - On win32, the correspondence between errno and the related error - message, as handled by Tcl_ErrnoMsg() changes. The error message is - kept the same, but the corresponding errno value might change. - -2010-06-22 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsetObjCmd): [Bug 3019351]: Corrected wrong - args message. - -2010-06-21 Jan Nijtmans - - * unix/tclLoadDl.c: Eliminate various unnecessary type casts, use - * unix/tclLoadNext.c: function typedefs whenever possible - * unix/tclUnixChan.c: - * unix/tclUnixFile.c: - * unix/tclUnixNotfy.c: - * unix/tclUnixSock.c: - * unix/tclUnixTest.c: - * unix/tclXtTest.c: - * generic/tclZlib.c: Remove hack needed for zlib 1.2.3 on win32 - -2010-06-18 Donal K. Fellows - - * library/init.tcl (auto_execok): [Bug 3017997]: Add .cmd to the - default list of extensions that we can execute interactively. - -2010-06-16 Jan Nijtmans - - * tools/loadICU.tcl: [Bug 3016135]: Traceback using clock format - * library/msgs/he.msg: with locale of he_IL. - - * generic/tcl.h: Simplify Tcl_AppInit and *_Init definitions, - * generic/tclInt.h: spacing. Change TclpThreadCreate and - * generic/tcl.decls: Tcl_CreateThread signature, making clear that - * generic/tclDecls.h: "proc" is a function pointer, as in all other - * generic/tclEvent.c: "proc" function parameters. - * generic/tclTestProcBodyObj.c: - * win/tclWinThrd.c: - * unix/tclUnixThrd.c: - * doc/Thread.3: - * doc/Class.3: Fix Tcl_ObjectMetadataType definition. - -2010-06-14 Jan Nijtmans - - * unix/Makefile.in: Fix compilation of xttest with 8.6 changes - * unix/tclXtNotify.c: - * unix/tclXtTest.c: - * generic/tclPipe.c: Fix gcc warning (with -fstrict-aliasing=2) - * library/auto.tcl: Spacing and style fixes. - * library/history.tcl: - * library/init.tcl: - * library/package.tcl: - * library/safe.tcl: - * library/tm.tcl: - -2010-06-13 Donal K. Fellows - - * tools/tcltk-man2html.tcl (make-man-pages): [Bug 3015327]: Make the - title of a manual page be stored relative to its resulting directory - name as well as its source filename. This was caused by both Tcl and a - contributed package ([incr Tcl]) defining an Object.3. Also corrected - the joining of strings in titles to avoid extra braces. - -2010-06-09 Andreas Kupries - - * library/platform/platform.tcl: Added OSX Intel 64bit - * library/platform/pkgIndex.tcl: Package updated to version 1.0.9. - * unix/Makefile.in: - * win/Makefile.in: - -2010-06-09 Jan Nijtmans - - * tools/tsdPerf.c: Fix export of symbol Tsdperf_Init, when using - -fvisibility=hidden. Make two functions static, eliminate some - unnecessary type casts. - * tools/configure.in: Update to Tcl 8.6 - * tools/configure: (regenerated) - * tools/.cvsignore new file - -2010-06-07 Alexandre Ferrieux - - * generic/tclExecute.c: Ensure proper reset of [info errorstack] even - * generic/tclNamesp.c: when compiling constant expr's with errors. - -2010-06-05 Miguel Sofer - - * generic/tclBasic.c: [Bug 3008307]: make callerPtr chains be - * generic/tclExecute.c: traversable accross coro boundaries. Add the - special coroutine CallFrame (partially reverting commit of - 2009-12-10), as it is needed for coroutines that do not push a CF, eg, - those with [eval] as command. Thanks to Colin McCormack (coldstore) - and Alexandre Ferrieux for the hard work on this. - -2010-06-03 Alexandre Ferrieux - - * generic/tclNamesp.c: Safer (and faster) computation of [uplevel] - * tests/error.test: offsets in TIP 348. Toplevel offsets no longer - * tests/result.test: overestimated. - -2010-06-02 Jan Nijtmans - - * generic/tclOO.h: BUILD_tcloo is never defined (leftover) - * win/makefile.bc: Don't set BUILD_tcloo (leftover) - See also entry below: 2008-06-01 Joe Mistachkin - -2010-06-01 Alexandre Ferrieux - - * generic/tclNamesp.c: Fix computation of [uplevel] offsets in TIP 348 - * tests/error.test: Only depend on callerPtr chaining now. - * tests/result.test: Needed for upcoming coro patch. - -2010-05-31 Jan Nijtmans - - * generic/tclVar.c: Eliminate some casts to (Tcl_HashTable *) - * generic/tclExecute.c: - * tests/fileSystem.test: Fix filesystem-5.1 test failure on CYGWIN - -2010-05-28 Jan Nijtmans - - * generic/tclInt.h: [Patch 3008541]: Order of TIP #348 fields in - Interp structure - -2010-05-28 Donal K. Fellows - - * generic/tclCompCmdsSZ.c (IssueTryFinallyInstructions): [3007374]: - Corrected error in handling of catch contexts to prevent crash with - chained handlers. - - * generic/tclExecute.c (TclExecuteByteCode): Restore correct operation - of instruction-level execution tracing (had been broken by NRE). - -2010-05-27 Jan Nijtmans - - * library/opt/optParse.tcl: Don't generate spaces at the end of a - * library/opt/pkgIndex.tcl: line, eliminate ';' at line end, bump to - * tools/uniParse.tcl: v0.4.6 - * generic/tclUniData.c: - * tests/opt.test: - * tests/safe.test: - -2010-05-21 Jan Nijtmans - - * tools/installData.tcl: Make sure that copyDir only receives - normalized paths, otherwise it might result in a crash on CYGWIN. - Restyle according to the Tcl style guide. - * generic/tclStrToD.c: [Bug 3005233]: Fix for build on OpenBSD vax - -2010-05-19 Alexandre Ferrieux - - * tests/dict.test: Add missing tests for [Bug 3004007], fixed under - the radar on 2010-02-24 (dkf): EIAS violation in list-dict conversions - -2010-05-19 Jan Nijtmans - - * generic/regcomp.c: Don't use arrays of length 1, just use a - * generic/tclFileName.c: single element then, it makes code more - * generic/tclLoad.c: readable. (Here it even prevents a type cast) - -2010-05-17 Jan Nijtmans - - * generic/tclStrToD.c: [Bug 2996549]: Failure in expr.test on Win32 - -2010-05-17 Donal K. Fellows - - * generic/tclCmdIL.c (TclInfoFrame): Change this code to use - Tcl_GetCommandFullName rather than rolling its own. Discovered during - the hunting of [Bug 3001438] but unlikely to be a fix. - -2010-05-11 Jan Nijtmans - - * win/tclWinConsole.c: [Patch 2997087]: Unnecessary type casts. - * win/tclWinDde.c: - * win/tclWinLoad.c: - * win/tclWinNotify.c: - * win/tclWinSerial.c: - * win/tclWinSock.c: - * win/tclWinTime.c: - * win/tclWinPort.h: Don't duplicate CYGWIN timezone #define from - tclPort.h - -2010-05-07 Andreas Kupries - - * library/platform/platform.tcl: Fix cpu name for Solaris/Intel 64bit. - * library/platform/pkgIndex.tcl: Package updated to version 1.0.8. - * unix/Makefile.in: - * win/Makefile.in: - -2010-05-06 Jan Nijtmans - - * generic/tclPkg.c: Unnecessary type casts, see [Patch 2997087] - -2010-05-04 Jan Nijtmans - - * win/tclWinNotify.c: TCHAR-related fixes, making those two files - * win/tclWinSock.c: compile fine when TCHAR != char. Please see - comments in [FRQ 2965056] (2965056-1.patch). - -2010-05-03 Jan Nijtmans - - * generic/tclIORChan.c: Use "tclIO.h" and "tclTomMathDecls.h" - * generic/tclIORTrans.c: everywhere - * generic/tclTomMath.h: - * tools/fix_tommath_h.tcl: - * libtommath/tommath.h: Formatting (# should always be first char on - line) - * win/tclAppInit.c: For MINGW/CYGWIN, use GetCommandLineA - explicitly. - * unix/.cvsignore: Add pkg, *.dll - - * libtommath/tommath.h: CONSTify various useful internal - * libtommath/bn_mp_cmp_d.c: functions (TclBignumToDouble, TclCeil, - * libtommath/bn_mp_cmp_mag.c: TclFloor), and related tommath functions - * libtommath/bn_mp_cmp.c: - * libtommath/bn_mp_copy.c: - * libtommath/bn_mp_count_bits.c: - * libtommath/bn_mp_div_2d.c: - * libtommath/bn_mp_mod_2d.c: - * libtommath/bn_mp_mul_2d.c: - * libtommath/bn_mp_neg.c: - * generic/tclBasic.c: Handle TODO: const correctness ? - * generic/tclInt.h: - * generic/tclStrToD.c: - * generic/tclTomMath.decls: - * generic/tclTomMath.h: - * generic/tclTomMathDecls.h: - -2010-04-30 Don Porter - - * generic/tcl.h: Bump patchlevel to 8.6b1.2 to distinguish - * library/init.tcl: CVS snapshots from earlier snapshots as well - * unix/configure.in: as the 8.6b1 and 8.6b2 releases. - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - - * generic/tclBinary.c (TclAppendBytesToByteArray): Add comments - * generic/tclInt.h (TclAppendBytesToByteArray): placing overflow - protection responsibility on caller. Convert "len" argument to signed - int which any value already vetted for overflow issues will fit into. - * generic/tclStringObj.c: Update caller; standardize panic msg. - - * generic/tclBinary.c (UpdateStringOfByteArray): [Bug 2994924]: Add - panic when the generated string representation would grow beyond Tcl's - size limits. - -2010-04-30 Donal K. Fellows - - * generic/tclBinary.c (TclAppendBytesToByteArray): Add extra armour - against buffer overflows. - - * generic/tclBasic.c (NRInterpCoroutine): Corrected handling of - * tests/coroutine.test (coroutine-6.4): arguments to deal with - trickier cases. - -2010-04-30 Miguel Sofer - - * tests/coroutine.test: testing coroutine arguments after [yield]: - check that only 0/1 allowed - -2010-04-30 Donal K. Fellows - - * generic/tclBasic.c (NRInterpCoroutine): Corrected handling of - arguments to deal with trickier cases. - - * generic/tclCompCmds.c (TclCompileVariableCmd): Slightly tighter - issuing of instructions. - - * generic/tclExecute.c (TclExecuteByteCode): Add peephole optimization - of the fact that INST_DICT_FIRST and INST_DICT_NEXT always have a - conditional jump afterwards. - - * generic/tclBasic.c (TclNRYieldObjCmd, TclNRYieldmObjCmd) - (NRInterpCoroutine): Replace magic values for formal argument counts - for coroutine command implementations with #defines, for an increase - in readability. - -2010-04-30 Jan Nijtmans - - * generic/tclMain.c: Unnecessary TCL_STORAGE_CLASS re-definition. It - was used for an ancient dummy reference to Tcl_LinkVar(), but that's - already gone since 2002-05-29. - -2010-04-29 Miguel Sofer - - * generic/tclCompExpr.c: Slight change in the literal sharing - * generic/tclCompile.c: mechanism to avoid shimmering of - * generic/tclCompile.h: command names. - * generic/tclLiteral.c: - -2010-04-29 Andreas Kupries - - * library/platform/platform.tcl: Another stab at getting the /lib, - * library/platform/pkgIndex.tcl: /lib64 difference right for linux. - * unix/Makefile.in: Package updated to version 1.0.7. - * win/Makefile.in: - -2010-04-29 Kevin B. Kenny - - * library/tzdata/Antarctica/Macquarie: - * library/tzdata/Africa/Casablanca: - * library/tzdata/Africa/Tunis: - * library/tzdata/America/Santiago: - * library/tzdata/America/Argentina/San_Luis: - * library/tzdata/Antarctica/Casey: - * library/tzdata/Antarctica/Davis: - * library/tzdata/Asia/Anadyr: - * library/tzdata/Asia/Damascus: - * library/tzdata/Asia/Dhaka: - * library/tzdata/Asia/Gaza: - * library/tzdata/Asia/Kamchatka: - * library/tzdata/Asia/Karachi: - * library/tzdata/Asia/Taipei: - * library/tzdata/Europe/Samara: - * library/tzdata/Pacific/Apia: - * library/tzdata/Pacific/Easter: - * library/tzdata/Pacific/Fiji: Olson's tzdata2010i. - -2010-04-29 Donal K. Fellows - - * generic/tclBinary.c (TclAppendBytesToByteArray): [Bug 2992970]: Make - * generic/tclStringObj.c (Tcl_AppendObjToObj): an append of a byte - array to another into an efficent operation. The problem was the (lack - of) a proper growth management strategy for the byte array. - -2010-04-29 Jan Nijtmans - - * compat/dirent2.h: Include "tcl.h", not , like everywhere - * compat/dlfcn.h: else, to ensure that the version in the Tcl - * compat/stdlib.h: distribution is used, not some version from - * compat/string.h: somewhere else. - * compat/unistd.h: - -2010-04-28 Jan Nijtmans - - * win/Makefile.in: Remove unused @MAN2TCLFLAGS@ - * win/tclWinPort.h: Move include from tclInt.h to - * generic/tclInt.h: tclWinPort.h, and eliminate unneeded - * generic/tclEnv.c: , and , which - are already in tclInt.h - * generic/regcustom.h: Move "tclInt.h" from regcustom.h up to - * generic/regex.h: regex.h. - * generic/tclAlloc.c: Unneeded include. - * generic/tclExecute.c: Fix gcc warning: comparison between signed and - unsigned. - -2010-04-28 Donal K. Fellows - - * generic/tclInt.h (TclIsVarDirectUnsettable): Corrected flags so that - deletion of traces is not optimized out... - - * generic/tclExecute.c (ExecuteExtendedBinaryMathOp) - (TclCompareTwoNumbers,ExecuteExtendedUnaryMathOp,TclExecuteByteCode): - [Patch 2981677]: Move the less common arithmetic operations (i.e., - exponentiation and operations on non-longs) out of TEBC for a big drop - in the overall size of the stack frame for most code. Net effect on - speed is minimal (slightly faster overall in tclbench). Also extended - the number of places where TRESULT handling is replaced with a jump to - dedicated code. - -2010-04-27 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Rearrange location of an - assignment to shorten the object code. - -2010-04-27 Jan Nijtmans - - * generic/tclIOUtil.c (Tcl_FSGetNativePath): [Bug 2992292]: - tclIOUtil.c assignment type mismatch compiler warning - * generic/regguts.h: If tclInt.h or tclPort.h is already - * generic/tclBasic.c: included, don't include - * generic/tclExecute.c: again. Follow-up to [Bug 2991415]: - * generic/tclIORChan.c: tclport.h #included before limits.h - * generic/tclIORTrans.c: See comments in [Bug 2991415] - * generic/tclObj.c: - * generic/tclOOInt.h: - * generic/tclStrToD.c: - * generic/tclTomMath.h: - * generic/tclTomMathInterface.c: - * generic/tclUtil.c: - * compat/strtod.c: - * compat/strtol.c: - -2010-04-27 Kevin B. Kenny - - * unix/tclLoadDl.c (FindSymbol): [Bug 2992295]: Simplified the logic - so that the casts added in Donal Fellows's change for the same bug are - no longer necessary. - -2010-04-26 Donal K. Fellows - - * unix/tclLoadDl.c (FindSymbol): [Bug 2992295]: Added an explicit cast - because auto-casting between function and non-function types is never - naturally warning-free. - - * generic/tclStubInit.c: Add a small amount of gcc-isms (with #ifdef - * generic/tclOOStubInit.c: guards) to ensure that warnings are issued - when these files are older than the various *.decls files. - -2010-04-25 Miguel Sofer - - * generic/tclBasic.c: Add unsupported [yieldm] command. Credit - * generic/tclInt.h: Lars Hellstrom for the basic idea. - -2010-04-24 Miguel Sofer - - * generic/tclBasic.c: Modify api of TclSpliceTailcall() to fix - * generic/tclExecute.c: [yieldTo], which had not survived the latest - * generic/tclInt.h: mods to tailcall. Thanks kbk for detecting - the problem. - -2010-04-23 Jan Nijtmans - - * unix/tclUnixPort.h: [Bug 2991415]: tclport.h #included before - limits.h - -2010-04-22 Jan Nijtmans - - * generic/tclPlatDecls.h: Move TCHAR fallback typedef from tcl.h to - * generic/tcl.h: tclPlatDecls.h (as suggested by dgp) - * generic/tclInt.h: fix typo - * generic/tclIOUtil.c: Eliminate various unnecessary - * unix/tclUnixFile.c: type casts. - * unix/tclUnixPipe.c: - * win/tclWinChan.c: - * win/tclWinFCmd.c: - * win/tclWinFile.c: - * win/tclWinLoad.c: - * win/tclWinPipe.c: - -2010-04-20 Jan Nijtmans - - * generic/tclTest.c: Use function prototypes from the FS API. - * compat/zlib/*: Upgrade to zlib 1.2.5 - -2010-04-19 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Improve commenting and - reduce indentation for the Invocation Block. - -2010-04-18 Donal K. Fellows - - * doc/unset.n: [Bug 2988940]: Fix typo. - -2010-04-15 Jan Nijtmans - - * win/tclWinPort.h: Move inclusion of from - * generic/tcl.h: tclPlatDecls.h to tclWinPort.h, where it - * generic/tclPlatDecls.h: belongs. Add fallback in tcl.h, so TCHAR is - available in win32 always. - -2010-04-15 Donal K. Fellows - - * doc/try.n: [Bug 2987551]: Fix typo. - -2010-04-14 Andreas Kupries - - * library/platform/platform.tcl: Linux platform identification: - * library/platform/pkgIndex.tcl: Check /lib64 for existence of files - * unix/Makefile.in: matching libc* before accepting it as base - * win/Makefile.in: directory. This can happen on weirdly installed - 32bit systems which have an empty or partially filled /lib64 without - an actual libc. Bumped to version 1.0.6. - -2010-04-13 Jan Nijtmans - - * win/tclWinPort.h: Fix [Patch 2986105]: conditionally defining - * win/tclWinFile.c: strcasecmp/strncasecmp - * win/tclWinLoad.c: Fix gcc warning: comparison of unsigned expression - >= 0 is always true - -2010-04-08 Donal K. Fellows - - * generic/tclCompCmdsSZ.c (TclSubstCompile): If the first token does - not result in a *guaranteed* push of a Tcl_Obj on the stack, we must - push an empty object. Otherwise it is possible to get to a 'concat1' - or 'done' without enough values on the stack, resulting in a crash. - Thanks to Joe Mistachkin for identifying a script that could trigger - this case. - -2010-04-07 Donal K. Fellows - - * doc/catch.n, doc/info.n, doc/return.n: Formatting. - -2010-04-06 Donal K. Fellows - - * doc/Load.3: Minor corrections of formatting and cross links. - -2010-04-06 Jan Nijtmans - - * win/configure: (regenerate with autoconf-2.59) - * unix/configure: - * unix/installManPage: [Bug 2982540]: configure and install* script - * unix/install-sh: files should always have LF line ending. - * doc/Load.3: Fix signature of Tcl_LoadFile in documentation. - -2010-04-05 Alexandre Ferrieux - - TIP #348 IMPLEMENTATION - - * generic/tclBasic.c: [Patch 2868499]: Substituted error stack - * generic/tclCmdIL.c: - * generic/tclInt.h: - * generic/tclNamesp.c: - * generic/tclResult.c: - * doc/catch.n: - * doc/info.n: - * doc/return.n: - * tests/cmdMZ.test: - * tests/error.test: - * tests/execute.test: - * tests/info.test: - * tests/init.test: - * tests/result.test: - -2010-04-05 Donal K. Fellows - - * unix/tcl.m4 (SC_ENABLE_THREADS): Flip the default for whether to - * win/tcl.m4 (SC_ENABLE_THREADS): build in threaded mode. Part of - * win/rules.vc: TIP #364. - - * unix/tclLoadDyld.c (FindSymbol): Better human-readable error message - generation to match code in tclLoadDl.c. - -2010-04-04 Donal K. Fellows - - * generic/tclIOUtil.c, unix/tclLoadDl.c: Minor changes to enforce - Engineering Manual style rules. - - * doc/FileSystem.3, doc/Load.3: Documentation for TIP#357. - - * macosx/tclMacOSXBundle.c (OpenResourceMap): [Bug 2981528]: Only - define this function when HAVE_COREFOUNDATION is defined. - -2010-04-02 Jan Nijtmans - - * generic/tcl.decls (Tcl_LoadFile): Add missing "const" in signature, - * generic/tclIOUtil.c (Tcl_LoadFile): and some formatting fixes - * generic/tclDecls.h: (regenerated) - -2010-04-02 Donal K. Fellows - - * generic/tclIOUtil.c (Tcl_LoadFile): Corrections to previous commit - * unix/tclLoadDyld.c (TclpDlopen): to make it build on OSX. - -2010-04-02 Kevin B. Kenny - - TIP #357 IMPLEMENTATION - TIP #362 IMPLEMENTATION - - * generic/tclStrToD.c: [Bug 2952904]: Defer creation of the smallest - floating point number until it is actually used. (This change avoids a - bogus syslog message regarding a 'floating point software assist - fault' on SGI systems.) - - * library/reg/pkgIndex.tcl: [TIP #362]: Fixed first round of bugs - * tests/registry.test: resulting from the recent commits of - * win/tclWinReg.c: changes in support of the referenced - TIP. - - * generic/tcl.decls: [TIP #357]: First round of changes - * generic/tclDecls.h: to export Tcl_LoadFile, - * generic/tclIOUtil.c: Tcl_FindSymbol, and Tcl_FSUnloadFile - * generic/tclInt.h: to the public API. - * generic/tclLoad.c: - * generic/tclLoadNone.c: - * generic/tclStubInit.c: - * tests/fileSystem.test: - * tests/load.test: - * tests/unload.test: - * unix/tclLoadDl.c: - * unix/tclLoadDyld.c: - * unix/tclLoadNext.c: - * unix/tclLoadOSF.c: - * unix/tclLoadShl.c: - * unix/tclUnixPipe.c: - * win/Makefile.in: - * win/tclWinLoad.c: - -2010-03-31 Donal K. Fellows - - * doc/registry.n: Added missing documentation of TIP#362 flags. - - * doc/package.n: [Bug 2980210]: Document the arguments taken by - the [package present] command correctly. - - * doc/Thread.3: Added some better documentation of how to create and - use a thread using the C-level thread API, based on realization that - no such tutorial appeared to exist. - -2010-03-31 Jan Nijtmans - - * test/cmdMZ.test: [FRQ 2974744]: share exception codes (ObjType?): - * test/error.test: Revised test cases, making sure that abbreviated - * test/proc-old.test: codes are checked resulting in an error, and - checking for the exact error message. - -2010-03-30 Andreas Kupries - - * generic/tclIORChan.c (ReflectClose, ReflectInput, ReflectOutput, - (ReflectSeekWide, ReflectWatch, ReflectBlock, ReflectSetOption, - (ReflectGetOption, ForwardProc): [Bug 2978773]: Preserve - ReflectedChannel* structures across handler invokations, to avoid - crashes when the handler implementation induces nested callbacks and - destruction of the channel deep inside such a nesting. - -2010-03-30 Don Porter - - * generic/tclObj.c (Tcl_GetCommandFromObj): [Bug 2979402]: Reorder - the validity tests on internal rep of a "cmdName" value to avoid - invalid reads reported by valgrind. - -2010-03-30 Jan Nijtmans - - * generic/tclIndexObj: [FRQ 2974744]: share exception codes - * generic/tclResult.c: further optimization, making use of indexType. - * generic/tclZlib.c: [Bug 2979399]: uninitialized value troubles - -2010-03-30 Donal K. Fellows - - TIP #362 IMPLEMENTATION - - * win/tclWinReg.c: [Patch 2960976]: Apply patch from Damon Courtney to - * tests/registry.test: allow the registry command to be told to work - * win/Makefile.in: with both 32-bit and 64-bit registries. Bump - * win/configure.in: version of registry package to 1.3. - * win/makefile.bc: - * win/makefile.vc: - * win/configure: autoconf-2.59 - -2010-03-29 Jan Nijtmans - - * unix/tcl.m4: Only test for -visibility=hidden with gcc - (Second remark in [Bug 2976508]) - * unix/configure: regen - -2010-03-29 Don Porter - - * generic/tclStringObj.c: Fix array overrun in test format-1.12 - caught by valgrind testing. - -2010-03-27 Jan Nijtmans - - * generic/tclInt.h: [FRQ 2974744]: share exception codes - * generic/tclResult.c: (ObjType?) - * generic/tclCmdMZ.c: - * generic/tclCompCmdsSZ.c: - -2010-03-26 Jan Nijtmans - - * generic/tclExecute.c: [Bug 2976508]: Tcl HEAD fails on HP-UX - -2010-03-25 Donal K. Fellows - - * unix/tclUnixFCmd.c (TclUnixCopyFile): [Bug 2976504]: Corrected - number of arguments to fstatfs() call. - - * macosx/tclMacOSXBundle.c, macosx/tclMacOSXFCmd.c: - * macosx/tclMacOSXNotify.c: Reduce the level of ifdeffery in the - functions of these files to improve readability. They need to be - audited for whether complexity can be removed based on the minimum - supported version of OSX, but that requires a real expert. - -2010-03-24 Don Porter - - * generic/tclResult.c: [Bug 2383005]: Revise [return -errorcode] so - * tests/result.test: that it rejects illegal non-list values. - -2010-03-24 Donal K. Fellows - - * generic/tclOOInfo.c (InfoObjectMethodTypeCmd) - (InfoClassMethodTypeCmd): Added introspection of method types so that - it is possible to find this info out without using errors. - * generic/tclOOMethod.c (procMethodType): Now that introspection can - reveal the name of method types, regularize the name of normal methods - to be the name of the definition type used to create them. - - * tests/async.test (async-4.*): Reduce obscurity of these tests by - putting the bulk of the code for them inside the test body with the - help of [apply]. - - * generic/tclCmdMZ.c (TryPostBody, TryPostHandler): Make sure that the - [try] command does not trap unwinding due to limits. - -2010-03-23 Don Porter - - * generic/tclCmdMZ.c: [Bug 2973361]: Revised fix for computing - indices of script arguments to [try]. - -2010-03-23 Jan Nijtmans - - * generic/tclCmdMZ.c: Make error message in "try" implementation - * generic/tclCompCmdsSZ.c: exactly the same as the one in "return" - * tests/error.test: - * libtommath/mtests/mpi.c: Single "const" addition - -2010-03-22 Don Porter - - * generic/tclCmdMZ.c: [Bug 2973361]: Compute the correct integer - values to identify the argument indices of the various script - arguments to [try]. Passing in -1 led to invalid memory reads. - -2010-03-20 Donal K. Fellows - - * doc/exec.n: Make it a bit clearer that there is an option to run a - pipeline in the background. - - * generic/tclIOCmd.c (Tcl_FcopyObjCmd): Lift the restriction - * generic/tclIO.c (TclCopyChannel, CopyData): on the [fcopy] command - * generic/tclIO.h (CopyState): that forced it to only - copy up to 2GB per script-level callback. Now it is anything that can - fit in a (signed) 64-bit integer. Problem identified by Frederic - Bonnet on comp.lang.tcl. Note that individual low-level reads and - writes are still smaller as the optimal buffer size is smaller. - -2010-03-20 Jan Nijtmans - - * win/stub16.c: Don't hide that we use the ASCII API here. - (does someone still use that?) - * win/tclWinPipe.c: 2 unnecessary type casts. - -2010-03-19 Donal K. Fellows - - * generic/tclCompCmdsSZ.c (TclCompileThrowCmd): Added compilation for - the [throw] command. - -2010-03-18 Don Porter - - * generic/tclListObj.c: [Bug 2971669]: Prevent in overflow trouble in - * generic/tclTestObj.c: ListObjReplace operations. Thanks to kbk for - * tests/listObj.test: fix and test. - -2010-03-18 Donal K. Fellows - - * generic/tclCompCmdsSZ.c (IssueTryFinallyInstructions): - [Bug 2971921]: Corrected jump so that it doesn't skip into the middle - of an instruction! Tightened the instruction issuing. Moved endCatch - calls closer to their point that they guard, ensuring correct ordering - of result values. - -2010-03-17 Andreas Kupries - - * generic/tclIORTrans.c (ReflectInput, ReflectOutput) - (ReflectSeekWide): [Bug 2921116]: Added missing TclEventuallyFree - calls for preserved ReflectedTransform* structures. Reworked - ReflectInput to preserve the structure for its whole life, not only in - InvokeTclMethod. - - * generic/tclIO.c (Tcl_GetsObj): [Bug 2921116]: Regenerate topChan, - may have been changed by a self-modifying transformation. - - * tests/ioTrans/test (iortrans-4.8, iortrans-4.9, iortrans-5.11) - (iortrans-7.4, iortrans-8.3): New test cases. - -2010-03-16 Jan Nijtmans - - * compat/zlib/*: Upgrade zlib to version 1.2.4. - * win/makefile.vc: - * unix/Makefile.in: - * win/tclWinChan.c: Don't cast away "const" without reason. - -2010-03-12 Jan Nijtmans - - * win/makefile.vc: [Bug 2967340]: Static build was failing. - * win/.cvsignore: - -2010-03-10 Jan Nijtmans - - * generic/tclTest.c: Remove unnecessary '&' decoration for - * generic/tclIOUtil.c: function pointers - * win/tclWin32Dll.c: Double declaration of TclNativeDupInternalRep - * unix/tclIOUtil.c: - * unix/dltest/.cvsignore: Ignore *.so here - -2010-03-09 Andreas Kupries - - * generic/tclIORChan.c: [Bug 2936225]: Thanks to Alexandre Ferrieux - * doc/refchan.n: for debugging and - * tests/ioCmd.test: fixing the problem. It is the write-side - equivalent to the bug fixed 2009-08-06. - -2010-03-09 Don Porter - - * library/tzdata/America/Matamoros: New locale - * library/tzdata/America/Ojinaga: New locale - * library/tzdata/America/Santa_Isabel: New locale - * library/tzdata/America/Asuncion: - * library/tzdata/America/Tijuana: - * library/tzdata/Antarctica/Casey: - * library/tzdata/Antarctica/Davis: - * library/tzdata/Antarctica/Mawson: - * library/tzdata/Asia/Dhaka: - * library/tzdata/Pacific/Fiji: - Olson tzdata2010c. - -2010-03-07 Jan Nijtmans - - * generic/tclTest.c: Test that tclOO stubs are present in stub - library - * generic/tclOOMethod.c: Applied missing part of [Patch 2961556] - * win/tclWinInt.h: Change all tclWinProcs signatures to use - * win/tclWin32Dll.c: TCHAR* in stead of WCHAR*. This is meant - * win/tclWinDde.c: as preparation to make [Enh 2965056] - * win/tclWinFCmd.c: possible at all. - * win/tclWinFile.c: - * win/tclWinPipe.c: - * win/tclWinSock.c: - -2010-03-06 Jan Nijtmans - - * generic/tclStubLib.c: Remove presence of tclTomMathStubsPtr here. - * generic/tclTest.c: Test that tommath stubs are present in stub - library. - -2010-03-05 Donal K. Fellows - - * generic/tclIORTrans.c (ForwardProc): [Bug 2964425]: When cleaning - the stables, it is sometimes necessary to do more than the minimum. In - this case, rationalizing the variables for a forwarded limit? method - required removing an extra Tcl_DecrRefCount too. - - * generic/tclOO.h, generic/tclOOInt.h: [Patch 2961556]: Change TclOO - to use the same style of function typedefs as Tcl, as this is about - the last chance to get this right. - - ***POTENTIAL INCOMPATIBILITY*** - Source code that uses function typedefs from TclOO will need to update - variables and argument definitions so that pointers to the function - values are used instead. Binary compatibility is not affected. - - * generic/*.c, generic/tclInt.h, unix/*.c, macosx/*.c: Applied results - of doing a Code Audit. Principal changes: - * Use do { ... } while (0) in macros - * Avoid shadowing one local variable with another - * Use clearer 'foo.bar++;' instead of '++foo.bar;' where result not - required (i.e., semantically equivalent); clarity is increased - because it is bar that is incremented, not foo. - * Follow Engineering Manual rules on spacing and declarations - -2010-03-04 Donal K. Fellows - - * generic/tclOO.c (ObjectRenamedTrace): [Bug 2962664]: Add special - handling so that when the class of classes is deleted, so is the class - of objects. Immediately. - - * generic/tclOOInt.h (ROOT_CLASS): Add new flag for specially marking - the root class. Simpler and more robust than the previous technique. - -2010-03-04 Jan Nijtmans - - * generic/tclGetDate.y: 3 unnecessary MODULE_SCOPE - * generic/tclDate.c: symbols - * generic/tclStubLib.c: Split tommath stub lib - * generic/tclTomMathStubLib.c: in separate file. - * win/makefile.bc: - * win/Makefile.in: - * win/makefile.vc: - * win/tcl.dsp: - * unix/Makefile.in: - * unix/tcl.m4: Cygwin only gives warning - * unix/configure: using -fvisibility=hidden - * compat/strncasecmp.c: A few more const's - * compat/strtod.c: - * compat/strtoul.c: - -2010-03-03 Andreas Kupries - - * doc/refchan.n: Followup to ChangeLog entry 2009-10-07 - (generic/tclIORChan.c). Fixed the documentation to explain that errno - numbers are operating system dependent, and reworked the associated - example. - -2010-03-02 Jan Nijtmans - - * unix/tcl.m4: [FRQ 2959069]: Support for -fvisibility=hidden - * unix/configure (regenerated with autoconf-2.59) - -2010-03-01 Alexandre Ferrieux - - * unix/tclUnixSock.c: Refrain from a possibly lengthy reverse-DNS - lookup on 0.0.0.0 when calling [fconfigure -sockname] on an - universally-bound (default) server socket. - - * generic/tclIndexObj.c: fix [AT 86258]: special-casing of empty - tables when generating error messages for [::tcl::prefix match]. - -2010-02-28 Donal K. Fellows - - * generic/tclCmdIL.c: More additions of {TCL LOOKUP} error-code - generation to various subcommands of [info] as part of long-term - project to classify all Tcl's generated errors. - -2010-02-28 Jan Nijtmans - - * generic/tclStubInit.c: [Bug 2959713]: Link error with gcc 4.1 - -2010-02-27 Donal K. Fellows - - * generic/tclCmdMZ.c (StringFirstCmd, StringLastCmd): [Bug 2960021]: - Only search for the needle in the haystack when the needle isn't - larger than the haystack. Prevents an odd crash from sometimes - happening when things get mixed up (a common programming error). - - * generic/tclMain.c (Tcl_Main): [Bug 801429]: Factor out the holding - of the client-installed main loop function into thread-specific data. - - ***POTENTIAL INCOMPATIBILITY*** - Code that previously tried to set the main loop from another thread - will now fail. On the other hand, there is a fairly high probability - that such programs would have been failing before due to the lack of - any kind of inter-thread memory barriers guarding accesses to this - part of Tcl's state. - -2010-02-26 Donal K. Fellows - - * generic/tclCompCmds.c: Split this file into two pieces to make it - * generic/tclCompCmdsSZ.c: easier to work with. It's still two very - long files even after the split. - -2010-02-26 Reinhard Max - - * doc/safe.n: Name the installed file after the command it documents. - Use "Safe Tcl" instead of the "Safe Base", "Safe Tcl" mixture. - -2010-02-26 Donal K. Fellows - - * unix/Makefile.in (NATIVE_TCLSH): Added this variable to allow for - better control of what tclsh to use for various scripts when doing - cross compiling. An imperfect solution, but works. - - * unix/installManPage: Remap non-alphanumeric sequences in filenames - to single underscores (especially colons). - -2010-02-26 Pat Thoyts - - * tests/zlib.test: Add tests for [Bug 2818131] which was crashing with - mismatched zlib algorithms used in combination with gets. This issue - has been fixed by Andreas's last commit. - -2010-02-25 Jan Nijtmans - - * generic/tclHash.c: [FRQ 2958832]: Further speed-up of the - * generic/tclLiteral.c: ouster-hash function. - * generic/tclObj.c: - * generic/tclCkalloc.c: Eliminate various unnecessary (ClientData) - * generic/tclTest.c: type casts. - * generic/tclTestObj.c: - * generic/tclTestProcBodyObj.c: - * unix/tclUnixTest.c: - * unix/tclUnixTime.c: - * unix/tclXtTest.c: - -2010-02-24 Donal K. Fellows - - * generic/tclDictObj.c (SetDictFromAny): Prevent the list<->dict - * generic/tclListObj.c (SetListFromAny): conversion code from taking - too many liberties. Stops loss of duplicate keys in some scenarios. - Many thanks to Jean-Claude Wippler for finding this. - - * generic/tclExecute.c (TclExecuteByteCode): Reduce ifdef-fery and - size of activation record. More variables shared across instructions - than before. - - * doc/socket.n: [Bug 2957688]: Clarified that [socket -server] works - with a command prefix. Extended example to show this in action. - -2010-02-22 Andreas Kupries - - * generic/tclZlib.c (ZlibTransformInput): [Bug 2762041]: Added a hack - to work around the general problem, early EOF recognition based on the - base-channel, instead of the data we have ready for reading in the - transform. Long-term we need a proper general fix (likely tracking EOF - on each level of the channel stack), with attendant complexity. - Furthermore, Z_BUF_ERROR can be ignored, and must be when feeding the - zlib code with single characters. - -2010-02-22 Jan Nijtmans - - * unix/tclUnixPort.h: Remove unnecessary EXTERN's, which already are - in the global stub table. - * unix/configure.in: Use @EXEEXT@ in stead of @EXT_SUFFIX@ - * unix/tcl.m4: - * unix/Makefile.in: Use -DBUILD_tcl for CYGWIN - * unix/configure: (regenerated) - * unix/dltest/pkg*.c: Use EXTERN to control CYGWIN exported symbols - * generic/tclCmdMZ.c: Remove some unnecessary type casts. - * generic/tclCompCmds.c: - * generic/tclTest.c: - * generic/tclUtil.c: - -2010-02-21 Mo DeJong - - * tests/regexp.test: Add test cases back ported from Jacl regexp work. - -2010-02-21 Jan Nijtmans - - * generic/tclDate.c: Some more const tables. - * generic/tclGetDate.y: - * generic/regc_lex.c: - * generic/regerror.c: - * generic/tclStubLib.c: - * generic/tclBasic.c: Fix [Bug 2954959] expr abs(0.0) is -0.0 - * tests/expr.test: - -2010-02-20 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileStringLenCmd): Make [string length] - of a constant string be handled better (i.e., handle backslashes too). - -2010-02-19 Stuart Cassoff - - * tcl.m4: Correct compiler/linker flags for threaded builds on - OpenBSD. - * configure: (regenerated). - -2010-02-19 Donal K. Fellows - - * unix/installManPage: [Bug 2954638]: Correct behaviour of manual page - installer. Also added armouring to check that assumptions about the - initial state are actually valid (e.g., look for existing input file). - -2010-02-17 Donal K. Fellows - - * generic/tclHash.c (HashStringKey): Restore these hash functions - * generic/tclLiteral.c (HashString): to use the classic algorithm. - * generic/tclObj.c (TclHashObjKey): Community felt normal case - speed to be more important than resistance to malicious cases. For - now, hashes that need to deal with the malicious case can use a custom - hash table and install their own hash function, though that is not - functionality exposed to the script level. - - * generic/tclCompCmds.c (TclCompileDictUpdateCmd): Stack depth must be - correctly described when compiling a body to prevent crashes in some - debugging modes. - -2010-02-16 Jan Nijtmans - - * generic/tclInt.h: Change order of various struct members, - fixing potential binary incompatibility with Tcl 8.5 - -2010-02-16 Donal K. Fellows - - * unix/configure.in, generic/tclIOUtil.c (Tcl_Stat): Updated so that - we do not assume that all unix systems have the POSIX blkcnt_t type, - since OpenBSD apparently does not. - - * generic/tclLiteral.c (HashString): Missed updating to FNV in one - place; the literal table (a copy of the hash table code...) - -2010-02-15 Jan Nijtmans - - * tools/genStubs.tcl: Reverted earlier rename from tcl*Stubs to - * generic/tclBasic.c: tcl*ConstStubs, it's not necessary at all. - * generic/tclOO.c: - * generic/tclTomMathInterface.c: - * generic/tclStubInit.c: (regenerated) - * generic/tclOOStubInit.c: (regenerated) - * generic/tclEnsemble.c:Fix signed-unsigned mismatch - * win/tclWinInt.h: make tclWinProcs "const" - * win/tclWin32Dll.c: - * win/tclWinFCmd.c: Eliminate all internal Tcl_WinUtfToTChar - * win/tclWinFile.c: and Tcl_WinTCharToUtf calls, needed - * win/tclWinInit.c: for mslu support. - * win/tclWinLoad.c: - * win/tclWinPipe.c: - * win/tclWinSerial.c: - * win/.cvsignore: - * compat/unicows/readme.txt: [FRQ 2819611]: Add first part of MSLU - * compat/unicows/license.txt: support. - * compat/unicows/unicows.lib: - -2010-02-15 Donal K. Fellows - - * generic/tclOO.c (AllocObject, SquelchedNsFirst, ObjectRenamedTrace): - * generic/tclNamesp.c (Tcl_DeleteNamespace): [Bug 2950259]: Revised - the namespace deletion code to provide an additional internal callback - that gets triggered early enough in namespace deletion to allow TclOO - destructors to run sanely. Adjusted TclOO to take advantage of this, - so making tearing down an object by killing its namespace appear to - work seamlessly, which is needed for Itcl. (Note that this is not a - feature that will ever be backported to 8.5, and it remains not a - recommended way of deleting an object.) - -2010-02-13 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileSwitchCmd): Divided the [switch] - compiler into three pieces (after the model of [try]): a parser, an - instruction-issuer for chained tests, and an instruction-issuer for - jump tables. - - * generic/tclEnsemble.c: Split the ensemble engine out into its own - file rather than keeping it mashed together with the namespace code. - -2010-02-12 Jan Nijtmans - - * win/tcl.m4: Use -pipe for gcc on win32 - * win/configure: (mingw/cygwin) (regenerated) - * win/.cvsignore: Add .lib, .exp and .res here - -2010-02-11 Mo DeJong - - * tests/list.test: Add tests for explicit \0 in a string argument to - the list command. - -2010-02-11 Donal K. Fellows - - * generic/tclIOCmd.c (Tcl_OpenObjCmd): [Bug 2949740]: Make sure that - we do not try to put a NULL pipeline channel into binary mode. - -2010-02-11 Mo DeJong - - [Bug 2826551, Patch 2948425]: Assorted regexp bugs related to -all, - -line and -start options and newlines. - * generic/tclCmdMZ.c (Tcl_RegexpObjCmd): If -offset is given, treat it - as the start of the line if the previous character was a newline. Fix - nasty edge case where a zero length match would not advance the index. - * tests/regexp.test: Add regression tests back ported from Jacl. - Checks for a number of issues related to -line and newline handling. A - few of tests were broken before the patch and continue to be broken, - marked as knownBug. - -2010-02-11 Donal K. Fellows - - * generic/tclOO.c (ObjectRenamedTrace): [Bug 2949397]: Prevent - destructors from running on the two core class objects when the whole - interpreter is being destroyed. - -2010-02-09 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileTryCmd, IssueTryInstructions) - (IssueTryFinallyInstructions): Added compiler for the [try] command. - It is split into three pieces that handle the parsing of the tokens, - the issuing of instructions for finally-free [try], and the issuing of - instructions for [try] with finally; there are enough differences - between the all cases that it was easier to split the code rather than - have a single function do the whole thing. - -2010-02-09 Alexandre Ferrieux - - * tools/genStubs.tcl: Remove dependency on 8.5+ idiom "in" in - expressions. - -2010-02-08 Donal K. Fellows - - * generic/tclZlib.c (Tcl_ZlibDeflate, Tcl_ZlibInflate): [Bug 2947783]: - Make sure that the result is an unshared object before appending to it - so that nothing crashes if it is shared (use in Tcl code was not - affected by this, but use from C was an issue). - -2010-02-06 Donal K. Fellows - - * generic/tclHash.c (HashStringKey): Replace Tcl's crusty old hash - * generic/tclObj.c (TclHashObjKey): function with the algorithm - due to Fowler, Noll and Vo. This is slightly faster (assuming the - presence of hardware multiply) and has somewhat better distribution - properties of the resulting hash values. Note that we only ever used - the 32-bit version of the FNV algorithm; Tcl's core hash engine - assumes that hash values are simple unsigned ints. - - ***POTENTIAL INCOMPATIBILITY*** - Code that depends on hash iteration order (especially tests) may well - be disrupted by this. Where a definite order is required, the fix is - usually to just sort the results after extracting them from the hash. - Where this is insufficient, the code that has ceased working was - always wrong and was only working by chance. - -2010-02-05 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileErrorCmd): Added compilation of the - [error] command. No new bytecodes. - -2010-02-05 Jan Nijtmans - - * tools/genStubs.tcl: Follow-up to earlier commit today: - Eliminate the need for an extra Stubs Pointer for adressing - a static stub table: Just change the exported table from - static to MODULE_SCOPE. - * generic/tclBasic.c - * generic/tclOO.c - * generic/tclTomMathInterface.c - * generic/tcl*Decls.h (regenerated) - * generic/tclStubInit.c (regenerated) - * generic/tclOOStubInit.c (regenerated) - * generic/tclTest.c (minor formatting) - -2010-02-05 Donal K. Fellows - - * generic/tclVar.c: More consistency in errorcode generation. - - * generic/tclOOBasic.c (TclOO_Object_Destroy): Rewrote to be NRE-aware - when calling destructors. Note that there is no guarantee that - destructors will always be called in an NRE context; that's a feature - of the 'destroy' method only. - - * generic/tclEncoding.c: Add 'const' to many function-internal vars - that are never pointing to things that are written to. - -2010-02-05 Jan Nijtmans - - * tools/genStubs.tcl: Follow-up to [2010-01-29] commit: - prevent space within stub table function parameters if the - parameter type is a pointer. - * win/tclWinInt.h: Minor Formatting - * generic/tcl.h: VOID -> void and other formatting - * generic/tclInt.h: Minor formatting - * generic/tclInt.decls: Change signature of TclNRInterpProcCore, - * generic/tclOO.decls: and TclOONewProc(Instance|)MethodEx, - * generic/tclProc.c: indicating that errorProc is a function, - * generic/tclOOMethod.c:pointer, and other formatting - * generic/tcl*Decls.h: (regenerated) - * generic/tclVar.c: gcc warning(line 3703): 'pattern' may be used - uninitialized in this function - gcc warning(line 3788): 'matched' may be used - uninitialized in this function - -2010-02-04 Donal K. Fellows - - * generic/tclVar.c: Added more use of error-codes and reduced the - stack overhead of older interfaces. - (ArrayGetCmd): Stop silly crash when using a trivial pattern due to - error in conversion to ensemble. - (ArrayNamesCmd): Use the object RE interface for faster matching. - -2010-02-03 Donal K. Fellows - - * generic/tclVar.c (ArrayUnsetCmd): More corrections. - -2010-02-02 Donal K. Fellows - - * generic/tclVar.c: Turned the [array] command into a true ensemble. - - * generic/tclOO.c (AllocObject, MyDeleted): A slightly faster way to - handle the deletion of [my] is with a standard delete callback. This - is because it doesn't require an additional memory allocation during - object creation. Also reduced the amount of string manipulation - performed during object creation to further streamline memory - handling; this is not backported to the 8.5 package as it breaks a - number of abstractions. - - * generic/tclOOBasic.c (TclOO_Object_Destroy): [Bug 2944404]: Do not - crash when a destructor deletes the object that is executing that - destructor. - -2010-02-01 Donal K. Fellows - - * generic/tclVar.c (Tcl_ArrayObjCmd): [Bug 2939073]: Stop the [array - unset] command from having dangling pointer problems when an unset - trace deletes the element that is going to be processed next. Many - thanks to Alexandre Ferrieux for the bulk of this fix. - - * generic/regexec.c (ccondissect, crevdissect): [Bug 2942697]: Rework - these functions so that certain pathological patterns are matched much - more rapidly. Many thanks to Tom Lane for dianosing this issue and - providing an initial patch. - -2010-01-30 Donal K. Fellows - - * generic/tclCompile.c (tclInstructionTable): Bytecode instructions - * generic/tclCompCmds.c (TclCompileUnsetCmd): to allow the [unset] - * generic/tclExecute.c (TclExecuteByteCode): command to be compiled - with the compiler being a complete compilation for all compile-time - decidable uses. - - * generic/tclVar.c (TclPtrUnsetVar): Var reference version of the code - to unset a variable. Required for INST_UNSET bytecodes. - -2010-01-29 Jan Nijtmans - - * generic/tcl.h: [Bug 2942081]: Reverted Tcl_ThreadDataKey type change - Changed some Tcl_CallFrame fields from "char *" - to "void *". This saves unnecessary space on - Cray's (and it's simply more correct). - - * tools/genStubs.tcl: No longer generate a space after "*" and - immediately after a function name, so the - format of function definitions in tcl*Decls.h - match all other tcl*.h header files. - * doc/ParseArgs.3: Change Tcl_ArgvFuncProc, Tcl_ArgvGenFuncProc - * generic/tcl.h: and GetFrameInfoValueProc to be function - * generic/tclInt.h: definitions, not pointers, for consistency - * generic/tclOOInt.h: with all other Tcl function definitions. - * generic/tclIndexObj.c: - * generic/regguts.h: CONST -> const - * generic/tcl.decls: Formatting - * generic/tclTomMath.decls: Formatting - * generic/tclDecls.h: (regenerated) - * generic/tclIntDecls.h: - * generic/tclIntPlatDecls.h: - * generic/tclOODecls.h: - * generic/tclOOIntDecls.h: - * generic/tclPlatDecls.h: - * generic/tclTomMathDecls.h: - -2010-01-28 Donal K. Fellows - - * generic/tclOOBasic.c (TclOO_Object_Destroy): Move the execution of - destructors to a point where they can produce an error. This will not - work for all destructors, but it does mean that more failing calls of - them will be caught. - * generic/tclOO.c (AllocObject, MyDeletedTrace, ObjectRenamedTrace): - (ObjectNamespaceDeleted): Stop various ways of getting at commands - with dangling pointers to the object. Also increases the reliability - of calling of destructors (though most destructors won't benefit; when - an object is deleted namespace-first, its destructors are not run in a - nice state as the namespace is partially gone). - -2010-01-25 Jan Nijtmans - - * generic/tclOOStubInit.c: Remove double includes (which causes a - * generic/tclOOStubLib.c: warning in CYGWIN compiles) - * unix/.cvsignore: add confdefs.h - -2010-01-22 Donal K. Fellows - - * doc/proc.n: [Bug 1970629]: Define a bit better what the current - namespace of a procedure is. - -2010-01-22 Jan Nijtmans - - * generic/tclInt.decls: Don't use DWORD and HANDLE here. - * generic/tclIntPlatDecls.h: - * generic/tcl.h: Revert [2009-12-21] change, instead - * generic/tclPort.h: resolve the CYGWIN inclusion problems by - * win/tclWinPort.h: re-arranging the inclusions at other - places. - * win/tclWinError.c - * win/tclWinPipe.c - * win/tcl.m4: Make cygwin configuration error into - * win/configure.in: a warning: CYGWIN compilation works - * win/configure: although there still are test failures. - -2010-01-22 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Improve error code - generation from some of the tailcall-related bits of TEBC. - -2010-01-21 Miguel Sofer - - * generic/tclCompile.h: [Bug 2910748]: NRE-enable direct eval on BC - * generic/tclExecute.c: spoilage. - * tests/nre.test: - -2010-01-19 Donal K. Fellows - - * doc/dict.n: [Bug 2929546]: Clarify just what [dict with] and [dict - update] are doing with variables. - -2010-01-18 Andreas Kupries - - * generic/tclIO.c (CreateScriptRecord): [Bug 2918110]: Initialize - the EventScriptRecord (esPtr) fully before handing it to - Tcl_CreateChannelHandler for registration. Otherwise a reflected - channel calling 'chan postevent' (== Tcl_NotifyChannel) in its - 'watchProc' will cause the function 'TclChannelEventScriptInvoker' - to be run on an uninitialized structure. - -2010-01-18 Donal K. Fellows - - * generic/tclStringObj.c (Tcl_AppendFormatToObj): [Bug 2932421]: Stop - the [format] command from causing argument objects to change their - internal representation when not needed. Thanks to Alexandre Ferrieux - for this fix. - -2010-01-13 Donal K. Fellows - - * tools/tcltk-man2html.tcl: More factoring out of special cases - * tools/tcltk-man2html-utils.tcl: so that they are described outside - the engine file. Now there is only one real set of special cases in - there, to handle the .SO/.OP/.SE directives. - -2010-01-13 Jan Nijtmans - - * generic/tcl.h: Fix TCL_LL_MODIFIER for Cygwin - * generic/tclEnv.c: Fix CYGWIN compilation problems, - * generic/tclInt.h: and remove some unnecessary - * generic/tclPort.h: double includes. - * generic/tclPlatDecls.h: - * win/cat.c: - * win/tclWinConsole.c: - * win/tclWinFCmd.c: - * win/tclWinFile.c: - * win/tclWinPipe.c: - * win/tclWinSerial.c: - * win/tclWinThrd.c: - * win/tclWinPort.h: Put win32 includes first - * unix/tclUnixChan.c: Forgot one CONST change - -2010-01-12 Donal K. Fellows - - * tools/tcltk-man2html.tcl: Make the generation of the list of things - to process the docs from simpler and more flexible. Also factored out - the lists of special cases. - -2010-01-10 Jan Nijtmans - - * win/tclWinDde.c: VC++ 6.0 doesn't have - * win/tclWinReg.c: PDWORD_PTR - * win/tclWinThrd.c: Fix various minor gcc warnings. - * win/tclWinTime.c: - * win/tclWinConsole.c: Put channel type definitions - * win/tclWinChan.c: in static const memory - * win/tclWinPipe.c: - * win/tclWinSerial.c: - * win/tclWinSock.c: - * generic/tclIOGT.c: - * generic/tclIORChan.c: - * generic/tclIORTrans.c: - * unix/tclUnixChan.c: - * unix/tclUnixPipe.c: - * unix/tclUnixSock.c: - * unix/configure: (regenerated with autoconf 2.59) - * tests/info.test: Make test independant from - tcltest implementation. - -2010-01-10 Donal K. Fellows - - * tests/namespace.test (namespace-51.17): [Bug 2898722]: Demonstrate - that there are still bugs in the handling of resolution epochs. This - bug is not yet fixed. - - * tools/tcltk-man2html.tcl: Split the man->html converter into - * tools/tcltk-man2html-utils.tcl: two pieces for easier maintenance. - Also made it much less verbose in its printed messages by default. - -2010-01-09 Donal K. Fellows - - * tools/tcltk-man2html.tcl: Added basic support for building the docs - for contributed packages into the HTML versions. Prompted by question - on Tcler's Chat by Tom Krehbiel. Note that there remain problems in - the documentation generated due to errors in the contributed docs. - -2010-01-05 Don Porter - - * generic/tclPathObj.c (TclPathPart): [Bug 2918610]: Correct - * tests/fileName.test (filename-14.31): inconsistency between the - string rep and the intrep of a path value created by [file rootname]. - Thanks to Vitaly Magerya for reporting. - -2010-01-03 Donal K. Fellows - - * unix/tcl.m4 (SC_CONFIG_CFLAGS): [Bug 1636685]: Use the configuration - for modern FreeBSD suggested by the FreeBSD porter. - -2010-01-03 Miguel Sofer - - * generic/tclBasic.c: [Bug 2724403]: Fix leak of coroutines on - * generic/tclCompile.h: namespace deletion. Added a test for this - * generic/tclNamesp.c: leak, and also a test for leaks on namespace - * tests/coroutine.test: deletion. - * tests/namespace.test: - -2009-12-30 Donal K. Fellows - - * library/safe.tcl (AliasSource): [Bug 2923613]: Make the safer - * tests/safe.test (safe-8.9): [source] handle a [return] at the - end of the file correctly. - -2009-12-30 Miguel Sofer - - * library/init.tcl (unknown): [Bug 2824981]: Fix infinite recursion of - ::unknown when [set] is undefined. - -2009-12-29 Donal K. Fellows - - * generic/tclHistory.c (Tcl_RecordAndEvalObj): Reduce the amount of - allocation and deallocation of memory by caching objects in the - interpreter assocData table. - - * generic/tclObj.c (Tcl_GetCommandFromObj): Rewrite the logic so that - it does not require making assignments part way through an 'if' - condition, which was deeply unclear. - - * generic/tclInterp.c (Tcl_MakeSafe): [Bug 2895741]: Make sure that - the min() and max() functions are supported in safe interpreters. - -2009-12-29 Pat Thoyts - - * generic/tclBinary.c: [Bug 2922555]: Handle completely invalid input - * tests/binary.test: to the decode methods. - -2009-12-28 Donal K. Fellows - - * unix/Makefile.in (trace-shell, trace-test): [FRQ 1083288]: Added - targets to allow easier tracing of shell and test invokations. - - * unix/configure.in: [Bug 942170]: Detect the st_blocks field of - * generic/tclCmdAH.c (StoreStatData): 'struct stat' correctly. - * generic/tclFileName.c (Tcl_GetBlocksFromStat): - * generic/tclIOUtil.c (Tcl_Stat): - - * generic/tclInterp.c (TimeLimitCallback): [Bug 2891362]: Ensure that - * tests/interp.test (interp-34.13): the granularity ticker is - reset when we check limits because of the time limit event firing. - -2009-12-27 Donal K. Fellows - - * doc/namespace.n (SCOPED SCRIPTS): [Bug 2921538]: Updated example to - not be quite so ancient. - -2009-12-25 Jan Nijtmans - - * generic/tclCmdMZ.c: CONST -> const - * generic/tclParse.c - -2009-12-23 Donal K. Fellows - - * library/safe.tcl (AliasSource, AliasExeName): [Bug 2913625]: Stop - information about paths from leaking through [info script] and [info - nameofexecutable]. - -2009-12-23 Jan Nijtmans - - * unix/tcl.m4: Install libtcl8.6.dll in bin directory - * unix/Makefile.in: - * unix/configure: (regenerated) - -2009-12-22 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): [Bug 2918962]: Stop crash when - -index and -stride are used together. - -2009-12-21 Jan Nijtmans - - * generic/tclThreadStorage.c: Fix gcc warning, using gcc-4.3.4 on - cygwin: missing initializer - * generic/tclOOInt.h: Prevent conflict with DUPLICATE - definition in WINAPI's nb30.h - * generic/rege_dfa.c: Fix macro conflict on CYGWIN: don't use - "small". - * generic/tcl.h: Include before on - CYGWIN - * generic/tclPathObj.c - * generic/tclPort.h - * tests/env.test: Don't unset WINDIR and TERM, it has a - special meaning on CYGWIN (both in UNIX - and WIN32 mode!) - * generic/tclPlatDecls.h: Include through tclPlatDecls.h - * win/tclWinPort.h: stricmp -> strcasecmp - * win/tclWinDde.c: _wcsicmp -> wcscasecmp - * win/tclWinFile.c - * win/tclWinPipe.c - * win/tclWinSock.c - * unix/tcl.m4: Add dynamic loading support to CYGWIN - * unix/configure (regenerated) - * unix/Makefile.in - -2009-12-19 Miguel Sofer - - * generic/tclBasic.c: [Bug 2917627]: Fix for bad cmd resolution by - * tests/coroutine.test: coroutines. Thanks to schelte for finding it. - -2009-12-16 Donal K. Fellows - - * library/safe.tcl (::safe::AliasGlob): Upgrade to correctly support a - larger fraction of [glob] functionality, while being stricter about - directory management. - -2009-12-11 Jan Nijtmans - - * generic/tclTest.c: Fix gcc warning: ignoring return value of - * unix/tclUnixNotify.c: "write", declared with attribute - * unix/tclUnixPipe.c: warn_unused_result. - * generic/tclInt.decls: CONSTify functions TclpGetUserHome and - * generic/tclIntDecls.h:TclSetPreInitScript (TIP #27) - * generic/tclInterp.c: - * win/tclWinFile.c: - * unix/tclUnixFile.c: - -2009-12-16 Donal K. Fellows - - * doc/tm.n: [Bug 1911342]: Formatting rewrite to avoid bogus crosslink - to the list manpage when generating HTML. - - * library/msgcat/msgcat.tcl (Init): [Bug 2913616]: Do not use platform - tests that are not needed and which don't work in safe interpreters. - -2009-12-14 Donal K. Fellows - - * doc/file.n (file tempfile): [Bug 2388866]: Note that this only ever - creates files on the native filesystem. This is a design feature. - -2009-12-13 Miguel Sofer - - * generic/tclBasic.c: Release TclPopCallFrame() from its - * generic/tclExecute.c: tailcall-management duties - * generic/tclNamesp.c: - - * generic/tclBasic.c: Moving TclBCArgumentRelease call from - * generic/tclExecute.c: TclNRTailcallObjCmd to TEBC, so that the - pairing of the Enter and Release calls is clearer. - -2009-12-12 Donal K. Fellows - - * generic/tclTest.c (TestconcatobjCmd): [Bug 2895367]: Stop memory - leak when testing. We don't need extra noise of this sort when - tracking down real problems! - -2009-12-11 Jan Nijtmans - - * generic/tclBinary.c: Fix gcc warning, using gcc-4.3.4 on cygwin - * generic/tclCompExpr.c:warning: array subscript has type 'char' - * generic/tclPkg.c: - * libtommath/bn_mp_read_radix.c: - * win/makefile.vc: [Bug 2912773]: Revert to version 1.203 - * unix/tclUnixCompat.c: Fix gcc warning: signed and unsigned type - in conditional expression. - -2009-12-11 Donal K. Fellows - - * tools/tcltk-man2html.tcl (long-toc, cross-reference): [FRQ 2897296]: - Added cross links to sections within manual pages. - -2009-12-11 Miguel Sofer - - * generic/tclBasic.c: [Bug 2806407]: Full nre-enabling of coroutines - * generic/tclExecute.c: - - * generic/tclBasic.c: Small cleanup - - * generic/tclExecute.c: Fix panic in http11.test caused by buggy - earlier commits in coroutine management. - -2009-12-10 Andreas Kupries - - * generic/tclObj.c (TclContinuationsEnter): [Bug 2895323]: Updated - comments to describe when the function can be entered for the same - Tcl_Obj* multiple times. This is a continuation of the 2009-11-10 - entry where a memory leak was plugged, but where not sure if that was - just a band-aid to paper over some other error. It isn't, this is a - legal situation. - -2009-12-10 Miguel Sofer - - * generic/tclBasic.c: Reducing the # of moving parts for coroutines - * generic/tclExecute.c: by delegating more to tebc; eliminate the - special coroutine CallFrame. - -2009-12-09 Andreas Kupries - - * generic/tclIO.c: [Bug 2901998]: Applied Alexandre Ferrieux's patch - fixing the inconsistent buffered I/O. Tcl's I/O now flushes buffered - output before reading, discards buffered input before writing, etc. - -2009-12-09 Miguel Sofer - - * generic/tclBasic.c: Ensure right lifetime of varFrame's (objc,objv) - for coroutines. - - * generic/tclExecute.c: Code regrouping - -2009-12-09 Donal K. Fellows - - * generic/tclBasic.c: Added some of the missing setting of errorcode - values. - -2009-12-08 Miguel Sofer - - * generic/tclExecute.c (TclStackFree): Improved panic msg. - -2009-12-08 Miguel Sofer - - * generic/tclBasic.c: Partial nre-enabling of coroutines. The - * generic/tclExecute.c: initial call still requires its own - * generic/tclInt.h: instance of tebc, but on resume coros can - execute in the caller's tebc. - - * generic/tclExecute.c (TEBC): Silence warning about pcAdjustment. - -2009-12-08 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Make the dict opcodes - more sparing in their use of C variables, to reduce size of TEBC - activiation record a little bit. - -2009-12-07 Miguel Sofer - - * generic/tclExecute.c (TEBC): Grouping "slow" variables into structs, - to reduce register pressure and help the compiler with variable - allocation. - -2009-12-07 Miguel Sofer - - * generic/tclExecute.c: Start cleaning the TEBC stables - * generic/tclInt.h: - - * generic/tclCmdIL.c: [Bug 2910094]: Fix by aku - * tests/coroutine.test: - - * generic/tclBasic.c: Arrange for [tailcall] to be created with the - other builtins: was being created in a separate call, leftover from - pre-tip days. - -2009-12-07 Don Porter - - * generic/tclStrToD.c: [Bug 2902010]: Correct conditional compile - directives to better detect the toolchain that needs extra work for - proper underflow treatment instead of merely detecting the MIPS - platform. - -2009-12-07 Miguel Sofer - - * generic/tclBasic.c: [Patch 2910056]: Add ::tcl::unsupported::yieldTo - * generic/tclInt.h: - -2009-12-07 Donal K. Fellows - - * generic/tclCmdMZ.c (TryPostBody): [Bug 2910044]: Close off memory - leak in [try] when a variable-free handler clause is present. - -2009-12-05 Miguel Sofer - - * generic/tclBasic.c: Small changes for clarity in tailcall - * generic/tclExecute.c: and coroutine code. - * tests/coroutine.test: - - * tests/tailcall.test: Remove some old unused crud; improved the - stack depth tests. - - * generic/tclBasic.c: Fixed things so that you can tailcall - * generic/tclNamesp.c: properly out of a coroutine. - * tests/tailcall.test: - - * generic/tclInterp.c: Fixed tailcalls for same-interp aliases (no - test) - -2009-12-03 Donal K. Fellows - - * library/safe.tcl (::safe::AliasEncoding): Make the safe encoding - command behave more closely like the unsafe one (for safe ops). - (::safe::AliasGlob): [Bug 2906841]: Clamp down on evil use of [glob] - in safe interpreters. - * tests/safe.test: Rewrite to use tcltest2 better. - -2009-12-02 Jan Nijtmans - - * tools/genStubs.tcl: Add support for win32 CALLBACK functions and - remove obsolete "emitStubs" and "genStubs" functions. - * win/Makefile.in: Use tcltest86.dll for all tests, and add - .PHONY rules to preemptively stop trouble that plagued Tk from hitting - Tcl too. - -2009-11-30 Jan Nijtmans - - * generic/tcl.h: Don't use EXPORT for Tcl_InitStubs - * win/Makefile.in: Better dependancies in case of static build. - -2009-11-30 Donal K. Fellows - - * doc/Tcl.n: [Bug 2901433]: Improved description of expansion to - mention that it is using list syntax. - -2009-11-27 Kevin B. Kenny - - * win/tclAppInit.c (Tcl_AppInit): [Bug 2902965]: Reverted Jan's change - that added a call to Tcl_InitStubs. The 'tclsh' and 'tcltest' programs - are providers, not consumers of the Stubs table, and should not link - with the Stubs library, but only with the main Tcl library. (In any - case, the presence of Tcl_InitStubs broke the build.) - -2009-11-27 Donal K. Fellows - - * doc/BoolObj.3, doc/Class.3, doc/CrtChannel.3, doc/DictObj.3: - * doc/DoubleObj.3, doc/Ensemble.3, doc/Environment.3: - * doc/FileSystem.3, doc/Hash.3, doc/IntObj.3, doc/Limit.3: - * doc/Method.3, doc/NRE.3, doc/ObjectType.3, doc/PkgRequire.3: - * doc/SetChanErr.3, doc/SetResult.3: [Patch 2903921]: Many small - spelling fixes from Larry Virden. - - BUMP VERSION OF TCLOO TO 0.6.2. Too many people need accumulated small - versions and bugfixes, so the version-bump removes confusion. - - * generic/tclOOBasic.c (TclOO_Object_LinkVar): [Bug 2903811]: Remove - unneeded restrictions on who can usefully call this method. - -2009-11-26 Donal K. Fellows - - * unix/Makefile.in: Add .PHONY rules and documentation to preemptively - stop trouble that plagued Tk from hitting Tcl too, and to make the - overall makefile easier to understand. Some reorganization too to move - related rules closer together. - -2009-11-26 Jan Nijtmans - - * win/Makefile.in: [Bug 2902965]: Fix stub related changes that - * win/makefile.vc: caused tclkit build to break. - * win/tclAppInit.c - * unix/tcl.m4 - * unix/Makefile.in - * unix/tclAppInit.c - * unix/configure: (regenerated) - -2009-11-25 Kevin B. Kenny - - * win/Makefile.in: Added a 'test-tcl' rule that is identical to - 'test' except that it does not go spelunking in 'pkgs/'. (This rule - has existed in unix/Makefile.in for some time.) - -2009-11-25 Stuart Cassoff - - * unix/configure.in: [Patch 2892871]: Remove unneeded - * unix/tcl.m4: AC_STRUCT_TIMEZONE and use - * unix/tclConfig.h.in: AC_CHECK_MEMBERS([struct stat.st_blksize]) - * unix/tclUnixFCmd.c: instead of AC_STRUCT_ST_BLKSIZE. - * unix/configure: Regenerated with autoconf-2.59. - -2009-11-24 Andreas Kupries - - * library/tclIndex: Manually redone the part of tclIndex dealing with - safe.tcl and tm.tcl. This part passes the testsuite. Note that - automatic regeneration of this part is not possible because it wrongly - puts 'safe::Setup' on the list, and wrongly leaves out 'safe::Log' - which is more dynamically created than the generator expects. - - Further note that the file "clock.tcl" is explicitly loaded by - "init.tcl", the first time the clock command is invoked. The relevant - code can be found at line 172ff, roughly, the definition of the - procedure 'clock'. This means none of the procedures of this file - belong in the tclIndex. Another indicator that automatic regeneration - of tclIndex is ill-advised. - -2009-11-24 Donal K. Fellows - - * generic/tclOO.c (FinalizeAlloc, Tcl_NewObjectInstance): - [Bug 2903011]: Make it an error to destroy an object in a constructor, - and also make sure that an object is not deleted twice in the error - case. - -2009-11-24 Pat Thoyts - - * tests/fCmd.test: [Bug 2893771]: Teach [file stat] to handle locked - * win/tclWinFile.c: files so that [file exists] no longer lies. - -2009-11-23 Kevin Kenny - - * tests/fCmd.test (fCmd-30.1): Changed registry location of the 'My - Documents' folder to the one that's correct for Windows 2000, XP, - Server 2003, Vista, Server 2008, and Windows 7. (See - http://support.microsoft.com/kb/310746) - -2009-11-23 Jan Nijtmans - - * win/tclWinDde.c: #undef STATIC_BUILD, in order to make sure - * win/tclWinReg.c: that Xxxxx_Init is always exported even when - * generic/tclTest.c: Tcl is built static (otherwise we cannot - create a DLL). - * generic/tclThreadTest.c: Make all functions static, except - TclThread_Init. - * tests/fCmd.test: Enable fCmd-30.1 when registry is available. - * win/tcl.m4: Fix ${SHLIB_LD_LIBS} definition, fix conflicts - * win/Makefile.in: Simplifications related to tcl.m4 changes. - * win/configure.in: Between static libraries and import library on - windows. - * win/configure: (regenerated) - * win/makefile.vc: Add stub library to necessary link lines. - -2009-11-23 Kevin B. Kenny - - * generic/tclThreadTest.c (NewTestThread): [Bug 2901803]: Further - machinations to get NewTestThread actually to launch the thread, not - just compile. - -2009-11-22 Donal K. Fellows - - * generic/tclThreadTest.c (NewTestThread): [Bug 2901803]: Fix small - error in function naming which blocked a threaded test build. - -2009-11-19 Jan Nijtmans - - * win/Makefile.in: Create tcltest86.dll as dynamic Tcltest - package. - * generic/tclTest.c: Remove extraneous prototypes, follow-up to - * generic/tclTestObj.c: [Bug 2883850] - * tests/chanio.test: Test-cases for fixed [Bug 2849797] - * tests/io.test: - * tests/safe.test: Fix safe-10.1 and safe-10.4 test cases, making - the wrong assumption that Tcltest is a static - package. - * generic/tclEncoding.c:[Bug 2857044]: Updated freeIntRepProc routines - * generic/tclVar.c: so that they set the typePtr field to NULL so - that the Tcl_Obj is not left in an - inconsistent state. - * unix/tcl.m4: [Patch 2883533]: tcl.m4 support for Haiku OS - * unix/configure: autoconf-2.59 - -2009-11-19 Don Porter - - * unix/tclAppInit.c: [Bug 2883850, 2900542]: Repair broken build of - * win/tclAppInit.c: the tcltest executable. - -2009-11-19 Donal K. Fellows - - * library/auto.tcl (tcl_findLibrary): - * library/clock.tcl (MakeUniquePrefixRegexp, MakeParseCodeFromFields) - (SetupTimeZone, ProcessPosixTimeZone): Restored the use of a literal - * library/history.tcl (HistAdd): 'then' when following a multi- - * library/safe.tcl (interpConfigure): line test expresssion. It's an - * library/tm.tcl (UnknownHandler): aid to readability then. - -2009-11-19 Jan Nijtmans - - * generic/tclInt.h: Make all internal initialization - * generic/tclTest.c: routines MODULE_SCOPE - * generic/tclTestObj.c: - * generic/tclTestProcBodyObj.c: - * generic/tclThreadTest.c: - * unix/Makefile.in: Fix [Bug 2883850]: pkgIndex.tcl doesn't - * unix/tclAppInit.c: get created with static Tcl build - * unix/tclXtTest.c: - * unix/tclXtNotify.c: - * unix/tclUnixTest.c: - * win/Makefile.in: - * win/tcl.m4: - * win/configure: (regenerated) - * win/tclAppInit.c: - * win/tclWinDde.c: Always compile with Stubs. - * win/tclWinReg.c: - * win/tclWinTest.c: - -2009-11-18 Jan Nijtmans - - * doc/CrtChannel.3: [Bug 2849797]: Fix channel name inconsistences - * generic/tclIORChan.c: as suggested by DKF. - * generic/tclIO.c: Minor *** POTENTIAL INCOMPATIBILITY *** - because Tcl_CreateChannel() and derivatives - now sometimes ignore their "chanName" - argument. - - * generic/tclAsync.c: Eliminate various gcc warnings (with -Wextra) - * generic/tclBasic.c - * generic/tclBinary.c - * generic/tclCmdAH.c - * generic/tclCmdIL.c - * generic/tclCmdMZ.c - * generic/tclCompile.c - * generic/tclDate.c - * generic/tclExecute.c - * generic/tclDictObj.c - * generic/tclIndexObj.c - * generic/tclIOCmd.c - * generic/tclIOUtil.c - * generic/tclIORTrans.c - * generic/tclOO.c - * generic/tclZlib.c - * generic/tclGetDate.y - * win/tclWinInit.c - * win/tclWinChan.c - * win/tclWinConsole.c - * win/tclWinNotify.c - * win/tclWinReg.c - * library/auto.tcl: Eliminate "then" keyword - * library/clock.tcl - * library/history.tcl - * library/safe.tcl - * library/tm.tcl - * library/http/http.tcl: Eliminate unnecessary spaces - * library/http1.0/http.tcl - * library/msgcat/msgcat.tcl - * library/opt/optparse.tcl - * library/platform/platform.tcl - * tools/tcltk-man2html.tcl - * tools/tclZIC.tcl - * tools/tsdPerf.c - -2009-11-17 Andreas Kupries - - * unix/tclUnixChan.c (TtyParseMode): Partial undo of Donal's tidy-up - from a few days ago (2009-11-9, not in ChangeLog). It seems that - strchr is apparently a macro on AIX and reacts badly to pre-processor - directives in its arguments. - -2009-11-16 Alexandre Ferrieux - - * generic/tclEncoding.c: [Bug 2891556]: Fix and improve test to - * generic/tclTest.c: detect similar manifestations in the future. - * tests/encoding.test: Add tcltest support for finalization. - -2009-11-15 Mo DeJong - - * win/tclWinDde.c: Avoid gcc compiler warning by explicitly casting - DdeCreateStringHandle argument. - -2009-11-12 Andreas Kupries - - * generic/tclIO.c (CopyData): [Bug 2895565]: Dropped bogosity which - * tests/io.test: used the number of _written_ bytes or character to - update the counters for the read bytes/characters. New test io-53.11. - This is a forward port from the 8.5 branch. - -2009-11-11 Don Porter - - * generic/tclClock.c (TclClockInit): Do not create [clock] support - commands in safe interps. - -2009-11-11 Jan Nijtmans - - * library/http/http.tcl (http::geturl): [Bug 2891171]: URL checking - too strict when using multiple question marks. - * tests/http.test - * library/http/pkgIndex.tcl: Bump to http 2.8.2 - * unix/Makefile.in: - * win/Makefile.in: - -2009-11-11 Alexandre Ferrieux - - * generic/tclIO.c: Fix [Bug 2888099] (close discards ENOSPC error) by - saving the errno from the first of two FlushChannel()s. Uneasy to - test; might need specific channel drivers. Four-hands with aku. - -2009-11-10 Pat Thoyts - - * tests/winFCmd.test: Cleanup directories that have been set chmod - 000. On Windows7 and Vista we really have no access and these were - getting left behind. - A few tests were changed to reflect the intent of the test where - setting a directory chmod 000 should prevent any modification. This - restriction was ignored on XP but is honoured on Vista - -2009-11-10 Andreas Kupries - - * generic/tclBasic.c: Plug another leak in TCL_EVAL_DIRECT evaluation. - Forward port from Tcl 8.5 branch, change by Don Porter. - - * generic/tclObj.c: [Bug 2895323]: Plug memory leak in - TclContinuationsEnter(). Forward port from Tcl 8.5 branch, change by - Don Porter. - -2009-11-09 Stuart Cassoff - - * win/README: [bug 2459744]: Removed outdated Msys + Mingw info. - -2009-11-09 Andreas Kupries - - * generic/tclBasic.c (TclEvalObjEx): Moved the #280 decrement of - refCount for the file path out of the branch after the whole - conditional, closing a memory leak. Added clause on structure type to - prevent seg.faulting. Forward port from valgrinding the Tcl 8.5 - branch. - - * tests/info.test: Resolve ambiguous resolution of variable "res". - Forward port from 8.5 - -2009-11-08 Donal K. Fellows - - * doc/string.n (bytelength): Noted that this command is not a good - thing to use, and suggested a better alternatve. Also factored out the - description of the indices into its own section. - -2009-11-07 Pat Thoyts - - * tests/fCmd.test: [Bug 2891026]: Exclude tests using chmod 555 - directories on vista and win7. The current user has access denied and - so cannot rename the directory without admin privileges. - -2009-11-06 Andreas Kupries - - * library/safe.tcl (::safe::Setup): Added documentation of the - contents of the state array. Also killed the 'InterpState' procedure - with its upleveled variable/upvar combination, and replaced all uses - with 'namespace upvar'. - -2009-11-05 Andreas Kupries - - * library/safe.tcl: A series of patches which bring the SafeBase up to - date with code guidelines, Tcl's features, also eliminating a number - of inefficiencies along the way. - (1) Changed all procedure names to be fully qualified. - (2) Moved the procedures out of the namespace eval. Kept their - locations. IOW, broke the namespace eval apart into small sections not - covering the procedure definitions. - (3) Reindented the code. Just lots of whitespace changes. - Functionality unchanged. - (4) Moved the multiple namespace eval's around. Command export at the - top, everything else (var decls, argument parsing setup) at the - bottom. - (5) Moved the argument parsing setup into a procedure called when the - code is loaded. Easier management of temporary data. - (6) Replaced several uses of 'Set' with calls to the new procedure - 'InterpState' and direct access to the per-slave state array. - (7) Replaced the remaining uses of 'Set' and others outside of the - path/token handling, and deleted a number of procedures related to - state array access which are not used any longer. - (8) Converted the path token system to cache normalized paths and path - <-> token conversions. Removed more procedures not used any longer. - Removed the test cases 4.3 and 4.4 from safe.test. They were testing - the now deleted command "InterpStateName". - (9) Changed the log command setup so that logging is compiled out - completely when disabled (default). - (10) Misc. cleanup. Inlined IsInterp into CheckInterp, its only user. - Consistent 'return -code error' for error reporting. Updated to use - modern features (lassign, in/ni, dicts). The latter are used to keep a - reverse path -> token map and quicker check of existence. - (11) Fixed [Bug 2854929]: Recurse into all subdirs under all TM root - dirs and put them on the access path. - -2009-11-02 Kevin B. Kenny - - * library/tzdata/Asia/Novokuznetsk: New tzdata locale for Kemerovo - oblast', which now keeps Novosibirsk time and not Kranoyarsk time. - * library/tzdata/Asia/Damascus: Syrian DST changes. - * library/tzdata/Asia/Hong_Kong: Hong Kong historic DST corrections. - Olson tzdata2009q. - -2009-11-02 Donal K. Fellows - - * doc/object.n (DESCRIPTION): Substantive revision to make it clearer - what the fundamental semantics of an object actually are. - -2009-11-01 Joe Mistachkin - - * doc/Cancel.3: Minor cosmetic fixes. - * win/makefile.vc: Make htmlhelp target work again. An extra set of - double quotes around the definition of the HTML help compiler tool - appears to be required. Previously, there was one set of double - quotes around the definition of the tool and one around the actual - invocation. This led to confusion because it was the only such tool - path to include double quotes around its invocation. Also, it was - somewhat inflexible in the event that somebody needed to override the - tool command to include arguments. Therefore, even though it may look - "wrong", there are now two double quotes on either side of the tool - path definition. This fixes the problem that currently prevents the - htmlhelp target from building and maintains flexibility in case - somebody needs to override it via the command line or an environment - variable. - -2009-11-01 Joe English - - * doc/Eval.3, doc/Cancel.3: Move TIP#285 routines out of Eval.3 into - their own manpage. - -2009-10-31 Donal K. Fellows - - * generic/tclBasic.c (ExprRoundFunc): [Bug 2889593]: Correctly report - the expected number of arguments when generating an error for round(). - -2009-10-30 Pat Thoyts - - * tests/tcltest.test: When creating the notwritabledir we deny the - current user access to delete the file. We must grant this right when - we cleanup. Required on Windows 7 when the user does not automatically - have administrator rights. - -2009-10-29 Don Porter - - * generic/tcl.h: Changed the typedef for the mp_digit type - from: - typedef unsigned long mp_digit; - to: - typedef unsigned int mp_digit; - For 32-bit builds where "long" and "int" are two names for the same - thing, this is no change at all. For 64-bit builds, though, this - causes the dp[] array of an mp_int to be made up of 32-bit elements - instead of 64-bit elements. This is a huge improvement because - details elsewhere in the mp_int implementation cause only 28 bits of - each element to be actually used storing number data. Without this - change bignums are over 50% wasted space on 64-bit systems. [Bug - 2800740]. - - ***POTENTIAL INCOMPATIBILITY*** - For 64-bit builds, callers of routines with (mp_digit) or (mp_digit *) - arguments *will*, and callers of routines with (mp_int *) arguments - *may* suffer both binary and stubs incompatibilities with Tcl releases - 8.5.0 - 8.5.7. Such possibilities should be checked, and if such - incompatibilities are present, suitable [package require] requirements - on the Tcl release should be put in place to keep such built code - [load]-ing only in Tcl interps that are compatible. - -2009-10-29 Donal K. Fellows - - * tests/dict.test: Make variable-clean and simplify tests by utilizing - the fact that dictionaries have defined orders. - - * generic/tclZlib.c (TclZlibCmd): Remove accidental C99-ism which - reportedly makes the AIX native compiler choke. - -2009-10-29 Kevin B. Kenny - - * library/clock.tcl (LocalizeFormat): - * tests/clock.test (clock-67.1): - [Bug 2819334]: Corrected a problem where '%%' followed by a letter in - a format group could expand recursively: %%R would turn into %%H:%M:%S - -2009-10-28 Don Porter - - * generic/tclLiteral.c: [Bug 2888044]: Fixed 2 bugs. - * tests/info.test: First, as noted in the comments of the - TclCleanupLiteralTable routine, since the teardown of the intrep of - one Tcl_Obj can cause the teardown of others in the same table, the - full table cleanup must be done with care, but the code did not - contain the same care demanded in the comment. Second, recent - additions to the info.test file had poor hygiene, leaving an array - variable ::a lying around, which breaks later interp.test tests during - a -singleproc 1 run of the test suite. - -2009-10-28 Kevin B. Kenny - - * tests/fileName.test (fileName-20.[78]): Corrected poor test - hygiene (failure to save and restore the working directory) that - caused these two tests to fail on Windows (and [Bug 2806250] to be - reopened). - -2009-10-27 Don Porter - - * generic/tclPathObj.c: [Bug 2884203]: Missing refcount on cached - normalized path caused crashes. - -2009-10-27 Kevin B. Kenny - - * library/clock.tcl (ParseClockScanFormat): [Bug 2886852]: Corrected a - problem where [clock scan] didn't load the timezone soon enough when - processing a time format that lacked a complete date. - * tests/clock.test (clock-66.1): - Added a test case for the above bug. - * library/tzdata/America/Argentina/Buenos_Aires: - * library/tzdata/America/Argentina/Cordoba: - * library/tzdata/America/Argentina/San_Luis: - * library/tzdata/America/Argentina/Tucuman: - New DST rules for Argentina. (Olson's tzdata2009p.) - -2009-10-26 Don Porter - - * unix/Makefile.in: Remove $(PACKAGE).* and prototype from the - `make distclean` target. Completes 2009-10-20 commit. - -2009-10-24 Kevin B. Kenny - - * library/clock.tcl (ProcessPosixTimeZone): - Corrected a regression in the fix to [Bug 2207436] that caused - [clock] to apply EU daylight saving time rules in the US. - Thanks to Karl Lehenbauer for reporting this regression. - * tests/clock.test (clock-52.4): - Added a regression test for the above bug. - * library/tzdata/Asia/Dhaka: - * library/tzdata/Asia/Karachi: - New DST rules for Bangladesh and Pakistan. (Olson's tzdata2009o.) - -2009-10-23 Andreas Kupries - - * generic/tclIO.c (FlushChannel): Skip OutputProc for low-level - 0-length writes. When closing pipes which have already been closed - not skipping leads to spurious SIG_PIPE signals. Reported by - Mikhail Teterin . - -2009-10-22 Donal K. Fellows - - * generic/tclOOBasic.c (TclOO_Object_VarName): [Bug 2883857]: Allow - the passing of array element names through this method. - -2009-10-21 Donal K. Fellows - - * generic/tclPosixStr.c: [Bug 2882561]: Work around oddity on Haiku OS - where SIGSEGV and SIGBUS are the same value. - - * generic/tclTrace.c (StringTraceProc): [Bug 2881259]: Added back cast - to work around silly bug in MSVC's handling of auto-casting. - -2009-10-20 Don Porter - - * unix/Makefile.in: Removed the long outdated and broken targets - package-* that were for building Solaris packages. Appears that the - pieces needed for these targets to function have never been present in - the current era of Tcl development and belong completely to Tcl - pre-history. - -2009-10-19 Don Porter - - * generic/tclIO.c: [Patch 2107634]: Revised ReadChars and - FilterInputBytes routines to permit reads to continue up to the string - limits of Tcl values. Before revisions, large read attempts could - panic when as little as half the limiting value length was reached. - Thanks to Sean Morrison and Bob Parker for their roles in the fix. - -2009-10-18 Joe Mistachkin - - * generic/tclObj.c (TclDbDumpActiveObjects, TclDbInitNewObj) - (Tcl_DbIncrRefCount, Tcl_DbDecrRefCount, Tcl_DbIsShared): - [Bug 2871908]: Enforce separation of concerns between the lineCLPtr - and objThreadMap thread specific data members. - -2009-10-18 Joe Mistachkin - - * tests/thread.test (thread-4.[345]): [Bug 1565466]: Correct tests to - save their error state before the final call to threadReap just in - case it triggers an "invalid thread id" error. This error can occur - if one or more of the target threads has exited prior to the attempt - to send it an asynchronous exit command. - -2009-10-17 Donal K. Fellows - - * generic/tclVar.c (UnsetVarStruct, TclDeleteNamespaceVars) - (TclDeleteCompiledLocalVars, DeleteArray): - * generic/tclTrace.c (Tcl_UntraceVar2): [Bug 2629338]: Stop traces - that are deleted part way through (a feature used by tdom) from - causing freed memory to be accessed. - -2009-10-08 Donal K. Fellows - - * generic/tclDictObj.c (DictIncrCmd): [Bug 2874678]: Don't leak any - bignums when doing [dict incr] with a value. - * tests/dict.test (dict-19.3): Memory leak detection code. - -2009-10-07 Andreas Kupries - - * generic/tclObj.c: [Bug 2871908]: Plug memory leaks of objThreadMap - and lineCLPtr hashtables. Also make the names of the continuation - line information initialization and finalization functions more - consistent. Patch supplied by Joe Mistachkin . - - * generic/tclIORChan.c (ErrnoReturn): Replace hardwired constant 11 - with proper errno #define, EAGAIN. What was I thinking? The BSD's have - a different errno assignment and break with the hardwired number. - Reported by emiliano on the chat. - -2009-10-06 Don Porter - - * generic/tclInterp.c (SlaveEval): Agressive stomping of internal reps - was added as part of the NRE patch of 2008-07-13. This doesn't appear - to actually be needed, and it hurts quite a bit when large lists lose - their intreps and require reparsing. Thanks to Ashok Nadkarni for - reporting the problem. - - * generic/tclTomMathInt.h (new): Public header tclTomMath.h had - * generic/tclTomMath.h: dependence on private headers, breaking use - * generic/tommath.h: by extensions [Bug 1941434]. - -2009-10-05 Andreas Kupries - - * library/safe.tcl (AliasGlob): Fixed conversion of catch to - try/finally, it had an 'on ok msg' branch missing, causing a silent - error immediately, and bogus glob results, breaking search for Tcl - modules. - -2009-10-04 Daniel Steffen - - * macosx/tclMacOSXBundle.c: [Bug 2569449]: Workaround CF memory - * unix/tclUnixInit.c: managment bug in Mac OS X 10.4 & - earlier. - -2009-10-02 Kevin B. Kenny - - * library/tzdata/Africa/Cairo: - * library/tzdata/Asia/Gaza: - * library/tzdata/Asia/Karachi: - * library/tzdata/Pacific/Apia: Olson's tzdata2009n. - -2009-09-29 Don Porter - - * generic/tclDictObj.c: [Bug 2857044]: Updated freeIntRepProc - * generic/tclExecute.c: routines so that they set the typePtr - * generic/tclIO.c: field to NULL so that the Tcl_Obj is - * generic/tclIndexObj.c: not left in an inconsistent state. - * generic/tclInt.h: - * generic/tclListObj.c: - * generic/tclNamesp.c: - * generic/tclOOCall.c: - * generic/tclObj.c: - * generic/tclPathObj.c: - * generic/tclProc.c: - * generic/tclRegexp.c: - * generic/tclStringObj.c: - - * generic/tclAlloc.c: Cleaned up various routines in the - * generic/tclCkalloc.c: call stacks for memory allocation to - * generic/tclInt.h: guarantee that any size values computed - * generic/tclThreadAlloc.c: are within the domains of the routines - they get passed to. [Bugs 2557696 and 2557796]. - -2009-09-28 Don Porter - - * generic/tclCmdMZ.c: Replaced TclProcessReturn() calls with - * tests/error.test: Tcl_SetReturnOptions() calls as a simple fix - for [Bug 2855247]. Thanks to Anton Kovalenko for the report and fix. - Additional fixes for other failures demonstrated by new tests. - -2009-09-27 Don Porter - - * tests/error.test (error-15.8.*): Coverage tests illustrating - flaws in the propagation of return options by [try]. - -2009-09-26 Donal K. Fellows - - * unix/tclooConfig.sh, win/tclooConfig.sh: [Bug 2026844]: Added dummy - versions of tclooConfig.sh that make it easier to build extensions - against both Tcl8.5+TclOO-standalone and Tcl8.6. - -2009-09-24 Don Porter - - TIP #356 IMPLEMENTATION - - * generic/tcl.decls: Promote internal routine TclNRSubstObj() - * generic/tclCmdMZ.c: to public Tcl_NRSubstObj(). Still needs docs. - * generic/tclCompile.c: - * generic/tclInt.h: - - * generic/tclDecls.h: make genstubs - * generic/tclStubInit.c: - -2009-09-23 Miguel Sofer - - * doc/namespace.n: the description of [namespace unknown] failed - to mention [namespace path]: fixed. Thx emiliano. - -2009-09-21 Mo DeJong - - * tests/regexp.test: Added check for error message from - unbalanced [] in regexp. Added additional simple test cases - of basic regsub command. - -2009-09-21 Don Porter - - * generic/tclCompile.c: Correct botch in the conversion of - Tcl_SubstObj(). Thanks to Kevin Kenny for detection and report. - -2009-09-17 Don Porter - - * generic/tclCompile.c: Re-implement Tcl_SubstObj() as a simple - * generic/tclParse.c: wrapper around TclNRSubstObj(). This has - * tests/basic.test: the effect of caching compiled bytecode in - * tests/parse.test: the value to be substituted. Note that - Tcl_SubstObj() now exists only for extensions. Tcl itself no longer - makes any use of it. Note also that TclSubstTokens() is now reachable - only by Tcl_EvalEx() and Tcl_ParseVar() so tests aiming to test its - functioning needed adjustment to still have the intended effect. - -2009-09-16 Alexandre Ferrieux - - * generic/tclObj.c: Extended ::tcl::unsupported::representation. - -2009-09-11 Don Porter - - * generic/tclBasic.c: Completed the NR-enabling of [subst]. - * generic/tclCmdMZ.c: [Bug 2314561]. - * generic/tclCompCmds.c: - * generic/tclCompile.c: - * generic/tclInt.h: - * tests/coroutine.test: - * tests/parse.test: - -2009-09-11 Donal K. Fellows - - * tests/http.test: Added in cleaning up of http tokens for each test - to reduce amount of global-variable pollution. - -2009-09-10 Donal K. Fellows - - * library/http/http.tcl (http::Event): [Bug 2849860]: Handle charset - names in double quotes; some servers like generating them like that. - -2009-09-07 Don Porter - - * generic/tclParse.c: [Bug 2850901]: Corrected line counting error - * tests/into.test: in multi-command script substitutions. - -2009-09-07 Daniel Steffen - - * generic/tclExecute.c: Fix potential uninitialized variable use and - * generic/tclFCmd.c: null dereference flagged by clang static - * generic/tclProc.c: analyzer. - * generic/tclTimer.c: - * generic/tclUtf.c: - - * generic/tclExecute.c: Silence false positives from clang static - * generic/tclIO.c: analyzer about potential null dereference. - * generic/tclScan.c: - * generic/tclCompExpr.c: - -2009-09-04 Don Porter - - * generic/tclCompCmds.c (TclCompileSubstCmd): [Bug 2314561]: - * generic/tclBasic.c: Added a bytecode compiler routine for the - * generic/tclCmdMZ.c: [subst] command. This is a partial solution to - * generic/tclCompile.c: the need to NR-enable [subst] since bytecode - * generic/tclCompile.h: execution is already NR-enabled. Two new - * generic/tclExecute.c: bytecode instructions, INST_NOP and - * generic/tclInt.h: INST_RETURN_CODE_BRANCH were added to support - * generic/tclParse.c: the new routine. INST_RETURN_CODE_BRANCH is - * tests/basic.test: likely to be useful in any future effort to - * tests/info.test: add a bytecode compiler routine for [try]. - * tests/parse.test: - -2009-09-03 Donal K. Fellows - - * doc/LinkVar.3: [Bug 2844962]: Added documentation of issues relating - to use of this API in a multi-threaded environment. - -2009-09-01 Andreas Kupries - - * generic/tclIORTrans.c (ReflectInput): Remove error response to - 0-result from method 'limit?' of transformations. Return the number of - copied bytes instead, which is possibly nothing. The latter then - triggers EOF handling in the higher layers, making the 0-result of - limit? the way to inject artificial EOF's into the data stream. - -2009-09-01 Don Porter - - * library/tcltest/tcltest.tcl: Bump to tcltest 2.3.2 after revision - * library/tcltest/pkgIndex.tcl: to verbose error message. - * unix/Makefile.in: - * win/Makefile.in: - -2009-08-27 Don Porter - - * generic/tclStringObj.c: [Bug 2845535]: A few more string - overflow cases in [format]. - -2009-08-25 Andreas Kupries - - * generic/tclBasic.c (Tcl_CreateInterp, Tcl_EvalTokensStandard) - (Tcl_EvalEx, TclEvalEx, TclAdvanceContinuations, TclNREvalObjEx): - * generic/tclCmdMZ.c (Tcl_SwitchObjCmd, TclListLines): - * generic/tclCompCmds.c (*): - * generic/tclCompile.c (TclSetByteCodeFromAny, TclInitCompileEnv) - (TclFreeCompileEnv, TclCompileScript, TclCompileTokens): - * generic/tclCompile.h (CompileEnv): - * generic/tclInt.h (ContLineLoc, Interp): - * generic/tclObj.c (ThreadSpecificData, ContLineLocFree) - (TclThreadFinalizeObjects, TclInitObjSubsystem, TclContinuationsEnter, - (TclContinuationsEnterDerived, TclContinuationsCopy, TclFreeObj) - (TclContinuationsGet): - * generic/tclParse.c (TclSubstTokens, Tcl_SubstObj): - * generic/tclProc.c (TclCreateProc): - * generic/tclVar.c (TclPtrSetVar): - * tests/info.test (info-30.0-24): - - Extended the parser, compiler, and execution engine with code and - attendant data structures tracking the position of continuation lines - which are not visible in the resulting script Tcl_Obj*'s, to properly - account for them while counting lines for #280. - -2009-08-24 Daniel Steffen - - * generic/tclInt.h: Annotate Tcl_Panic as noreturn for clang static - analyzer in PURIFY builds, replacing preprocessor/assert technique. - - * macosx/tclMacOSXNotify.c: Fix multiple issues with nested event loops - when CoreFoundation notifier is running in embedded mode. (Fixes - problems in TkAqua Cocoa reported by Youness Alaoui on tcl-mac) - -2009-08-21 Don Porter - - * generic/tclFileName.c: Correct regression in [Bug 2837800] fix. - * tests/fileName.test: - -2009-08-20 Don Porter - - * generic/tclFileName.c: [Bug 2837800]: Correct the result produced by - [glob */test] when * matches something like ~foo. - - * generic/tclPathObj.c: [Bug 2806250]: Prevent the storage of strings - starting with ~ in the "tail" part (normPathPtr field) of the path - intrep when PATHFLAGS != 0. This establishes the assumptions relied - on elsewhere that the name stored there is a relative path. Also - refactored to make an AppendPath() routine instead of the cut/paste - stanzas that were littered throughout. - -2009-08-20 Donal K. Fellows - - * generic/tclCmdIL.c (TclNRIfObjCmd): [Bug 2823276]: Make [if] - NRE-safe on all arguments when interpreted. - (Tcl_LsortObjCmd): Close off memory leak. - -2009-08-19 Donal K. Fellows - - * generic/tclCmdAH.c (TclNRForObjCmd, etc.): [Bug 2823276]: Make [for] - and [while] into NRE-safe commands, even when interpreted. - -2009-08-18 Don Porter - - * generic/tclPathObj.c: [Bug 2837800]: Added NULL check to prevent - * tests/fileName.test: crashes during [glob]. - -2009-08-16 Jan Nijtmans - - * unix/dltest/pkge.c: const addition - * unix/tclUnixThrd.c: Use in stead of "pthread.h" - * win/tclWinDde.c: Eliminate some more gcc warnings - * win/tclWinReg.c: - * generic/tclInt.h: Change ForIterData, make it const-safe. - * generic/tclCmdAH.c: - -2009-08-12 Don Porter - - TIP #353 IMPLEMENTATION - - * doc/NRE.3: New public routine Tcl_NRExprObj() permits - * generic/tcl.decls: extension commands to evaluate Tcl expressions - * generic/tclBasic.c: in NR-enabled command procedures. - * generic/tclCmdAH.c: - * generic/tclExecute.c: - * generic/tclInt.h: - * generic/tclObj.c: - * tests/expr.test: - - * generic/tclDecls.h: make genstubs - * generic/tclStubInit.c: - -2009-08-06 Andreas Kupries - - * doc/refchan.n [Bug 2827000]: Extended the implementation of - * generic/tclIORChan.c: reflective channels (TIP 219, method - * tests/ioCmd.test: 'read'), enabling handlers to signal EAGAIN to - indicate 'no data, but not at EOF either', and other system - errors. Updated documentation, extended testsuite (New test cases - iocmd*-23.{9,10}). - -2009-08-02 Miguel Sofer - - * tests/coroutine.test: fix testfile cleanup - -2009-08-02 Donal K. Fellows - - * generic/tclObj.c (Tcl_RepresentationCmd): Added an unsupported - command for reporting the representation of an object. Result string - is deliberately a bit obstructive so that people are not encouraged to - make code that depends on it; it's a debugging tool only! - - * unix/tclUnixFCmd.c (GetOwnerAttribute, SetOwnerAttribute) - (GetGroupAttribute, SetGroupAttribute): [Bug 1942222]: Stop calling - * unix/tclUnixFile.c (TclpGetUserHome): endpwent() and endgrent(); - they've been unnecessary for ages. - -2009-08-02 Jan Nijtmans - - * win/tclWin32Dll.c: Eliminate TclWinResetInterfaceEncodings, since it - * win/tclWinInit.c: does exactly the same as TclWinEncodingsCleanup, - * win/tclWinInt.h: make sure that tclWinProcs and - tclWinTCharEncoding are always set and reset - concurrently. - * win/tclWinFCmd.c: Correct check for win95 - -2009-07-31 Don Porter - - * generic/tclStringObj.c: [Bug 2830354]: Corrected failure to - * tests/format.test: grow buffer when format spec request - large width floating point values. Thanks to Clemens Misch. - -2009-07-26 Donal K. Fellows - - * library/auto.tcl (tcl_findLibrary, auto_mkindex): - * library/package.tcl (pkg_mkIndex, tclPkgUnknown, MacOSXPkgUnknown): - * library/safe.tcl (interpAddToAccessPath, interpDelete, AliasGlob): - (AliasSource, AliasLoad, AliasEncoding): - * library/tm.tcl (UnknownHandler): Simplify by swapping some [catch] - gymnastics for use of [try]. - -2009-07-26 Alexandre Ferrieux - - * tools/genStubs.tcl: Forced LF translation when generating .h's to - avoid spurious diffs when regenerating on a Windows box. - -2009-07-26 Jan Nijtmans - - * win/Makefile.in: [Bug 2827066]: msys build --enable-symbols broken - * win/tcl.m4: And modified the same for unicows.dll, as a - * win/configure: preparation for [Enh 2819611]. - -2009-07-25 Donal K. Fellows - - * library/history.tcl (history): Reworked the history mechanism in - terms of ensembles, rather than the ad hoc ensemble-lite mechanism - used previously. - -2009-07-24 Donal K. Fellows - - * doc/self.n (self class): [Bug 2704302]: Add some text to make it - clearer how to get the name of the current object's class. - -2009-07-23 Andreas Kupries - - * generic/tclIO.c (Tcl_GetChannelHandle): [Bug 2826248]: Do not crash - * generic/tclPipe.c (FileForRedirect): for getHandleProc == NULL, this - is allowed. Provide a nice error message in the bypass area. Updated - caller to check the bypass for a mesage. Bug reported by Andy - Sonnenburg - -2009-07-23 Joe Mistachkin - - * generic/tclNotify.c: [Bug 2820349]: Ensure that queued events are - freed once processed. - -2009-07-22 Jan Nijtmans - - * macosx/tclMacOSXFCmd.c: CONST -> const - * generic/tclGetDate.y: - * generic/tclDate.c: - * generic/tclLiteral.c: (char *) cast in ckfree call - * generic/tclPanic.c: [Feature Request 2814786]: remove TclpPanic - * generic/tclInt.h - * unix/tclUnixPort.h - * win/tclWinPort.h - -2009-07-22 Alexandre Ferrieux - - * generic/tclEvent.c: [Bug 2001201 again]: Refined the 20090617 patch - on [exit] streamlining, so that it now correctly calls thread exit - handlers for the calling thread, including bindings in Tk. - -2009-07-21 Kevin B. Kenny - - * library/tzdata/Asia/Dhaka: - * library/tzdata/Indian/Mauritius: Olson's tzdata2009k. - -2009-07-20 Donal K. Fellows - - * generic/tclCmdMZ.c (StringIsCmd): Reorganize so that [string is] is - more efficient when parsing things that are correct, at a cost of - making the empty string test slightly more costly. With this, the cost - of doing [string is integer -strict $x] matches [catch {expr {$x+0}}] - in the successful case, and greatly outstrips it in the failing case. - -2009-07-19 Donal K. Fellows - - * generic/tclOO.decls, generic/tclOO.c (Tcl_GetObjectName): Expose a - function for efficiently returning the current name of an object. - -2009-07-18 Daniel Steffen - - * unix/Makefile.in: Define NDEBUG in optimized (non-symbols) build to - disable NRE assert()s and threaded allocator range checks. - -2009-07-16 Don Porter - - * generic/tclBinary.c: Removed unused variables. - * generic/tclCmdIL.c: - * generic/tclCompile.c: - * generic/tclExecute.c: - * generic/tclHash.c: - * generic/tclIOUtil.c: - * generic/tclVar.c: - - * generic/tclBasic.c: Silence compiler warnings about ClientData. - * generic/tclProc.c: - - * generic/tclScan.c: Typo in ACCEPT_NAN configuration. - - * generic/tclStrToD.c: [Bug 2819200]: Set floating point control - register on MIPS systems so that the gradual underflow expected by Tcl - is in effect. - -2009-07-15 Donal K. Fellows - - * generic/tclInt.h (Namespace): Added machinery to allow - * generic/tclNamesp.c (many functions): reduction of memory used - * generic/tclResolve.c (BumpCmdRefEpochs): by namespaces. Currently - #ifdef'ed out because of compatibility concerns. - - * generic/tclInt.decls: Added four functions for better integration - with itcl-ng. - -2009-07-14 Kevin B. Kenny - - * generic/tclInt.h (TclNRSwitchObjCmd): - * generic/tclBasic.c (builtInCmds): - * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): - * tests/switch.test (switch-15.1): - [Bug 2821401]: Make non-bytecoded [switch] command aware of NRE. - -2009-07-13 Andreas Kupries - - * generic/tclCompile.c (TclInitCompileEnv, EnterCmdWordIndex) - (TclCleanupByteCode, TclCompileScript): - * generic/tclExecute.c (TclCompileObj, TclExecuteByteCode): - * tclCompile.h (ExtCmdLoc): - * tclInt.h (ExtIndex, CFWordBC, CmdFrame): - * tclBasic.c (DeleteInterpProc, TclArgumentBCEnter) - (TclArgumentBCRelease, TclArgumentGet, SAVE_CONTEXT) - (RESTORE_CONTEXT, NRCoroutineExitCallback, TclNRCoroutineObjCmd): - * generic/tclCmdAH.c (TclNRForObjCmd, TclNRForIterCallback, - (ForNextCallback): - * generic/tclCmdMZ.c (TclNRWhileObjCmd): - - Extended the bytecode compiler initialization to recognize the - compilation of whole files (NRE enabled 'source' command) and switch - to the counting of absolute lines in that case. - - Further extended the bytecode compiler to track the start line in the - generated information, and modified the bytecode execution to - recompile an object if the location as per the calling context doesn't - match the location saved in the bytecode. This part could be optimized - more by using more memory to keep all possibilities which occur - around, or by just adjusting the location information instead of a - total recompile. - - Reworked the handling of literal command arguments in bytecode to be - saved (compiler) and used (execution) per command (See the - TCL_INVOKE_STK* instructions), and not per the whole bytecode. This, - and the previous change remove the problems with location data caused - by literal sharing (across whole files, but also proc bodies). - Simplified the associated datastructures (ExtIndex is gone, as is the - function EnterCmdWordIndex). - - The last change causes the hashtable 'lineLABCPtr' to be state which - has to be kept per coroutine, like the CmdFrame stack. Reworked the - coroutine support code to create, delete and switch the information as - needed. Further reworked the tailcall command as well, it has to pop - its own arguments when run in a bytecode context to keep a proper - stack in 'lineLABCPtr'. - - Fixed the mishandling of line information in the NRE-enabled 'for' and - 'while' commands introduced when both were made to share their - iteration callbacks without taking into account that the loop body is - found in different words of the command. Introduced a separate data - structure to hold all the callback information, as we went over the - limit of 4 direct client-data values for NRE callbacks. - - The above fixes [Bug 1605269]. - -2009-07-12 Donal K. Fellows - - * generic/tclCmdMZ.c (StringIndexCmd, StringEqualCmd, StringCmpCmd): - * generic/tclExecute.c (TclExecuteByteCode): [Bug 2637173]: Factor out - * generic/tclInt.h (TclIsPureByteArray): the code to determine if - * generic/tclUtil.c (TclStringMatchObj): it is safe to work with - byte arrays directly, so that we get the check correct _once_. - - * generic/tclOOCall.c (TclOOGetCallContext): [Bug 1895546]: Changed - * generic/tclOO.c (TclOOObjectCmdCore): the way that the cache is - managed so that when itcl does cunning things, those cunning things - can be cached properly. - -2009-07-11 Donal K. Fellows - - * doc/vwait.n: Substantially increased the discussion of issues and - work-arounds relating to nested vwaits, following discussion on the - tcl-core mailing list on the topic. - -2009-07-10 Pat Thoyts - - * tests/zlib.test: ZlibTransformClose may be called with a NULL - * generic/tclZlib.c: interpreter during finalization and - Tcl_SetChannelError requires a list. Added some tests to ensure error - propagation from the zlib library to the interp. - -2009-07-09 Pat Thoyts - - * tests/zlib.test: [Bug 2818131]: Added tests and fixed a typo that - broke [zlib push] for deflate format. - -2009-07-09 Donal K. Fellows - - * compat/mkstemp.c (mkstemp): [Bug 2819227]: Use rand() for random - numbers as it is more portable. - -2009-07-05 Donal K. Fellows - - * generic/tclZlib.c (ZlibTransformWatch): Correct the handling of - events so that channel transforms work with things like an asynch - [chan copy]. Problem reported by Pat Thoyts. - -2009-07-01 Pat Thoyts - - * win/tclWinInt.h: [Bug 2806622]: Handle the GetUserName API call - * win/tclWin32Dll.c: via the tclWinProcs indirection structure. This - * win/tclWinInit.c: fixes a problem obtaining the username when the - USERNAME environment variable is unset. - -2009-06-30 Daniel Steffen - - * generic/tclInt.h: Add assert macros for clang static - * generic/tclPanic.c: analyzer and redefine Tcl_Panic to - * generic/tclStubInit.c: assert after panic in clang PURIFY - builds. - - * generic/tclCmdIL.c: Add clang assert for false positive - from static analyzer. - -2009-06-26 Daniel Steffen - - * macosx/Tcl-Common.xcconfig: Update projects for Xcode 3.1 and - * macosx/Tcl.xcode/*: 3.2, standardize on gcc 4.2, remove - * macosx/Tcl.xcodeproj/*: obsolete configurations and pre-Xcode - * macosx/Tcl.pbproj/* (removed): project. - - * macosx/README: Update project docs, cleanup. - - * unix/Makefile.in: Update dist target for project - changes. - -2009-06-24 Donal K. Fellows - - * tests/oo.test (oo-19.1): [Bug 2811598]: Make more resilient. - -2009-06-24 Pat Thoyts - - * tests/http11.test: [Bug 2811492]: Clean up procs after testing. - -2009-06-18 Donal K. Fellows - - * generic/tclCkalloc.c (MemoryCmd): [Bug 988703]: - * generic/tclObj.c (ObjData, TclFinalizeThreadObjects): Add mechanism - for discovering what Tcl_Objs are allocated when built for memory - debugging. Developed by Joe Mistachkin. - -2009-06-17 Alexandre Ferrieux - - * generic/tclEvent.c: Applied a patch by George Peter Staplin - drastically reducing the ambition of [exit] wrt finalization, and - thus solving many multi-thread teardown issues. [Bugs 2001201, - 486399, and possibly 597575, 990457, 1437595, 2750491] - -2009-06-15 Don Porter - - * generic/tclStringObj.c: sprintf() -> Tcl_ObjPrintf() conversion. - -2009-06-15 Reinhard Max - - * unix/tclUnixPort.h: Move all socket-related code from tclUnixChan.c - * unix/tclUnixChan.c: to tclUnixSock.c. - * unix/tclUnixSock.c: - -2009-06-15 Donal K. Fellows - - * tools/tcltk-man2html.tcl (make-man-pages): [Patch 557486]: Apply - last remaining meaningful part of this patch, a clean up of some - closing tags. - -2009-06-13 Don Porter - - * generic/tclCompile.c: [Bug 2802881]: The value stashed in - * generic/tclProc.c: iPtr->compiledProcPtr when compiling a proc - * tests/execute.test: survives too long. We only need it there long - enough for the right TclInitCompileEnv() call to re-stash it into - envPtr->procPtr. Once that is done, the CompileEnv controls. If we - let the value of iPtr->compiledProcPtr linger, though, then any other - bytecode compile operation that takes place will also have its - CompileEnv initialized with it, and that's not correct. The value is - meant to control the compile of the proc body only, not other compile - tasks that happen along. Thanks to Carlos Tasada for discovering and - reporting the problem. - -2009-06-10 Don Porter - - * generic/tclStringObj.c: [Bug 2801413]: Revised [format] to not - overflow the integer calculations computing the length of the %ll - formats of really big integers. Also added protections so that - [format]s that would produce results overflowing the maximum string - length of Tcl values throw a normal Tcl error instead of a panic. - - * generic/tclStringObj.c: [Bug 2803109]: Corrected failures to - deal with the "pure unicode" representation of an empty string. - Thanks to Julian Noble for reporting the problem. - -2006-06-09 Kevin B. Kenny - - * generic/tclGetDate.y: Fixed a thread safety bug in the generated - * library/clock.tcl: Bison parser (needed a %pure-parser - * tests/clock.test: declaration to avoid static variables). - Discovered that the %pure-parser declaration - allowed for returning the Bison error message - to the Tcl caller in the event of a syntax - error, so did so. - * generic/tclDate.c: bison 2.3 - -2006-06-08 Kevin B. Kenny - - * library/tzdata/Asia/Dhaka: New DST rule for Bangladesh. (Olson's - tzdata2009i.) - -2009-06-08 Donal K. Fellows - - * doc/copy.n: Fix error in example spotted by Venkat Iyer. - -2009-06-02 Don Porter - - * generic/tclExecute.c: Replace dynamically-initialized table with a - table of static constants in the lookup table for exponent operator - computations that fit in a 64 bit integer result. - - * generic/tclExecute.c: [Bug 2798543]: Corrected implementations and - selection logic of the INST_EXPON instruction. - -2009-06-01 Don Porter - - * tests/expr.test: [Bug 2798543]: Added many tests demonstrating - the broken cases. - -009-05-30 Kevin B. Kenny - - * library/tzdata/Africa/Cairo: - * library/tzdata/Asia/Amman: Olson's tzdata2009h. - -2009-05-29 Andreas Kupries - - * library/platform/platform.tcl: Fixed handling of cpu ia64, - * library/platform/pkgIndex.tcl: taking ia64_32 into account - * unix/Makefile.in: now. Bumped version to 1.0.5. Updated the - * win/Makefile.in: installation commands. - -2009-05-26 Alexandre Ferrieux - - * doc/expr.n: Fixed documentation of the right-associativity of - the ** operator. (spotted by kbk) - -2009-05-14 Donal K. Fellows - - * generic/tclOOInfo.c (InfoObjectNsCmd): Added introspection mechanism - for finding out what an object's namespace is. Experience suggests - that it is just too useful to be able to do without it. - -2009-05-12 Donal K. Fellows - - * doc/vwait.n: Added more words to make it clear just how bad it is to - nest [vwait]s. - - * compat/mkstemp.c: Add more headers to make this file build on IRIX - 6.5. Thanks to Larry McVoy for this. - -2009-05-08 Donal K. Fellows - - * generic/tclOO.c (TclNRNewObjectInstance): [Bug 2414858]: Add a - * generic/tclBasic.c (TclPushTailcallPoint): marker to the stack of - NRE callbacks at the right point so that tailcall works correctly in a - constructor. - - * tests/exec.test (cat): [Bug 2788468]: Adjust the scripted version of - cat so that it does not perform transformations on the data it is - working with, making it more like the standard Unix 'cat' program. - -2009-05-07 Miguel Sofer - - * generic/tclObj.c (Tcl_GetCommandFromObj): [Bug 2785893]: Ensure that - a command in a deleted namespace can't be found through a cached name. - - * generic/tclBasic.c: Let coroutines start with a much smaller - * generic/tclCompile.h: stack: 200 words (previously was 2000, the - * generic/tclExecute.c: same as interps). - -2009-05-07 Donal K. Fellows - - * tests/env.test (printenvScript, env-4.3, env-4.5): [Bug 1513659]: - * tests/exec.test (exec-2.6): These tests had subtle dependencies on - being on platforms that were either ISO 8859-1 or UTF-8. Stabilized - the results by forcing the encoding. - -2009-05-06 Don Porter - - * generic/tclCmdMZ.c: [Bug 2582327]: Improve overflow error message - from [string repeat]. - - * tests/interp.test: interp-20.50 test for Bug 2486550. - -2009-05-04 Donal K. Fellows - - * generic/tclOO.c (InitFoundation, AllocObject, AllocClass): - * generic/tclOODefineCmds.c (InitDefineContext): Make sure that when - support namespaces are deleted, nothing bad can subsequently happen. - Issue spotted by Don Porter. - -2009-05-03 Donal K. Fellows - - * doc/Tcl.n: [Bug 2538432]: Clarified exact treatment of ${arr(idx)} - form of variable substitution. This is not a change of behavior, just - an improved description of the current situation. - -2009-04-30 Miguel Sofer - - * generic/tclBasic.c (TclObjInvoke): [Bug 2486550]: Make sure that a - null objProc is not used, use Tcl_NRCallObjProc instead. - -2009-05-01 Jan Nijtmans - - * win/configure.in Fix 64-bit detection for zlib on Win64 - * win/configure (regenerated) - -2009-04-28 Jeff Hobbs - - * unix/tcl.m4, unix/configure (SC_CONFIG_CFLAGS): harden the check to - add _r to CC on AIX with threads. - -2009-04-27 Donal K. Fellows - - * doc/concat.n (EXAMPLES): [Bug 2780680]: Rewrote so that the spacing - of result messages is correct. (The exact way they were wrong was - different when rendered through groff or as HTML, but it was still - wrong both ways.) - -2009-04-27 Jan Nijtmans - - * generic/tclIndexObj.c: Reset internal INTERP_ALTERNATE_WRONG_ARGS - * generic/tclIOCmd.c: flag inside the Tcl_WrongNumArgs function, - so the caller no longer has to do the reset. - -2009-04-24 Stuart Cassoff - - * unix/Makefile.in: [Patch 2769530]: Don't chmod/exec installManPage. - -2009-04-19 Pat Thoyts - - * library/http/http.tcl: [Bug 2715421]: Removed spurious newline added - * tests/http11.test: after POST and added tests to detect excess - * tests/httpd11.tcl: bytes being POSTed. - * library/http/pkgIndex.tcl: - * makefiles: package version now 2.8.1 - -2009-04-15 Donal K. Fellows - - * doc/chan.n, doc/close.n: Tidy up documentation of TIP #332. - -2009-04-14 Kevin B. Kenny - - * library/tzdata/Asia/Karachi: Updated rules for Pakistan Summer - Time (Olson's tzdata2009f) - -2009-04-11 Donal K. Fellows - - * generic/tclOOMethod.c (InvokeForwardMethod): Clarify the resolution - behaviour of the name of the command that is forwarded to: it's now - resolved using the object's namespace as context, which is much more - useful than the previous (somewhat random) behaviour of using the - caller's current namespace. - -2009-04-10 Pat Thoyts - - * library/http/http.tcl: Improved HTTP/1.1 support and added - * library/http/pkgIndex.tcl: specific HTTP/1.1 testing to ensure - * tests/http11.test: we handle chunked+gzip for the various - * tests/httpd11.test: modes (normal, -channel and -handler) - * makefiles: package version set to 2.8.0 - -2009-04-10 Daniel Steffen - - * unix/tclUnixChan.c: TclUnixWaitForFile(): use FD_* macros - * macosx/tclMacOSXNotify.c: to manipulate select masks (Cassoff). - [FRQ 1960647] [Bug 3486554] - - * unix/tclLoadDyld.c: Use RTLD_GLOBAL instead of RTLD_LOCAL. - [Bug 1961211] - - * macosx/tclMacOSXNotify.c: revise CoreFoundation notifier to allow - embedding into applications that - already have a CFRunLoop running and - want to run the tcl event loop via - Tcl_ServiceModeHook(TCL_SERVICE_ALL). - - * macosx/tclMacOSXNotify.c: add CFRunLoop based Tcl_Sleep() and - * unix/tclUnixChan.c: TclUnixWaitForFile() implementations - * unix/tclUnixEvent.c: and disable select() based ones in - CoreFoundation builds. - - * unix/tclUnixNotify.c: simplify, sync with tclMacOSXNotify.c. - - * generic/tclInt.decls: add TclMacOSXNotifierAddRunLoopMode() - * generic/tclIntPlatDecls.h: internal API, regen. - * generic/tclStubInit.c: - - * unix/configure.in (Darwin): use Darwin SUSv3 extensions if - available; remove /Network locations - from default tcl package search path - (NFS mounted locations and thus slow). - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - - * macosx/tclMacOSXBundle.c: on Mac OS X 10.4 and later, replace - deprecated NSModule API by dlfcn API. - -2009-04-10 Donal K. Fellows - - * doc/StringObj.3: [Bug 2089279]: Corrected example so that it works - on 64-bit machines as well. - -2009-04-10 Pat Thoyts - - * tests/http.test: [Bug 26245326]: Added specific check for problem - * tests/httpd: (return incomplete HTTP response header). - -2009-04-08 Kevin B. Kenny - - * tools/tclZIC.tcl: Always emit files with Unix line termination. - * library/tzdata: Olson's tzdata2009e - -2009-04-09 Don Porter - - * library/http/http.tcl: [Bug 26245326]: Handle incomplete - lines in the "connecting" state. Thanks to Sergei Golovan. - -2009-04-08 Andreas Kupries - - * library/platform/platform.tcl: Extended the darwin sections to add - * library/platform/pkgIndex.tcl: a kernel version number to the - * unix/Makefile.in: identifier for anything from Leopard (10.5) on up. - * win/Makefile.in: Extended patterns for same. Extended cpu - * doc/platform.n: recognition for 64bit Tcl running on a 32bit kernel - on a 64bit processor (By Daniel Steffen). Bumped version to 1.0.4. - Updated Makefiles. - -2009-04-08 Don Porter - - * library/tcltest/tcltest.tcl: [Bug 2570363]: Converted [eval]s (some - * library/tcltest/pkgIndex.tcl: unsafe!) to {*} in tcltest package. - * unix/Makefile.in: => tcltest 2.3.1 - * win/Makefile.in: - -2009-04-07 Don Porter - - * generic/tclStringObj.c: Correction so that value of - TCL_GROWTH_MIN_ALLOC is everywhere expressed in bytes as comment - claims. - -2009-04-04 Donal K. Fellows - - * doc/vwait.n: [Bug 1910136]: Extend description and examples to make - it clearer just how this command interprets variable names. - -2009-03-30 Don Porter - - * doc/Alloc.3: [Bug 2556263]: Size argument is "unsigned int". - -2009-03-27 Don Porter - - * generic/tclPathObj.c (TclPathPart): [Bug 2710920]: TclPathPart() - * tests/fileName.test: was computing the wrong results for both [file - dirname] and [file tail] on "path" arguments with the PATHFLAGS != 0 - intrep and with an empty string for the "joined-on" part. - -2009-03-25 Jan Nijtmans - - * doc/tclsh.1: Bring doc and tools in line with - * tools/installData.tcl: http://wiki.tcl.tk/812 - * tools/str2c - * tools/tcltk-man2html.tcl - -2009-03-25 Donal K. Fellows - - * doc/coroutine.n: [Bug 2152285]: Added basic documentation for the - coroutine and yield commands. - -2009-03-24 Donal K. Fellows - - * generic/tclOOBasic.c (TclOOSelfObjCmd): [Bug 2704302]: Make 'self - class' better defined in the context of objects that change class. - - * generic/tclVar.c (Tcl_UpvarObjCmd): [Bug 2673163] (ferrieux) - * generic/tclProc.c (TclObjGetFrame): Make the upvar command more able - to handle its officially documented syntax. - -2009-03-22 Miguel Sofer - - * generic/tclBasic.c: [Bug 2502037]: NR-enable the handling of unknown - commands. - -2009-03-21 Miguel Sofer - - * generic/tclBasic.c: Fixed "leaks" in aliases, imports and - * generic/tclInt.h: ensembles. Only remaining known leak is in - * generic/tclInterp.c: ensemble unknown dispatch (as it not - * generic/tclNamesp.c: NR-enabled) - * tests/tailcall.test: - - * tclInt.h: comments - - * tests/tailcall.test: Added tests to show that [tailcall] does not - currently always execute in constant space: interp-alias, ns-imports - and ensembles "leak" as of this commit. - - * tests/nre.test: [foreach] has been NR-enabled for a while, the test - was marked 'knownBug': unmark it. - - * generic/tclBasic.c: Fix for (among others) [Bug 2699087] - * generic/tclCmdAH.c: Tailcalls now perform properly even from - * generic/tclExecute.c: within [eval]ed scripts. - * generic/tclInt.h: More tests missing, as well as proper - exploration and testing of the interaction with "redirectors" like - interp-alias (suspect that it does not happen in constant space) - and pure-eval commands. - - * generic/tclExecute.c: Proper fix for [Bug 2415422]. Reenabled - * tests/nre.test: the failing assertion that was disabled on - 2008-12-18: the assertion is correct, the fault was in the - management of expansions. - - * generic/tclExecute.c: Fix both test and code for tailcall - * tests/tailcall.test: from within a compiled [eval] body. - - * tests/tailcall.test: Slightly improved tests - -2009-03-20 Don Porter - - * tests/stringObj.test: [Bug 2597185]: Test stringObj-6.9 - checks that Tcl_AppendStringsToObj() no longer crashes when operating - on a pure unicode value. - - * generic/tclExecute.c (INST_CONCAT1): [Bug 2669109]: Panic when - appends overflow the max length of a Tcl value. - -2009-03-19 Miguel Sofer - - * generic/tcl.h: - * generic/tclInt.h: - * generic/tclBasic.c: - * generic/tclExecute.c: - * generic/tclNamesp.c (Tcl_PopCallFrame): Rewritten tailcall - implementation, ::unsupported::atProcExit is (temporarily?) gone. The - new approach is much simpler, and also closer to being correct. This - commit fixes [Bug 2649975] and [Bug 2695587]. - - * tests/coroutine.test: Moved the tests to their own files, - * tests/tailcall.test: removed the unsupported.test. Added - * tests/unsupported.test: tests for the fixed bugs. - -2009-03-19 Donal K. Fellows - - * doc/tailcall.n: Added documentation for tailcall command. - -2009-03-18 Don Porter - - * win/tclWinFile.c (TclpObjNormalizePath): [Bug 2688184]: - Corrected Tcl_Obj leak. Thanks to Joe Mistachkin for detection and - patch. - - * generic/tclVar.c (TclLookupSimpleVar): [Bug 2689307]: Shift - all calls to Tcl_SetErrorCode() out of TclLookupSimpleVar and onto its - callers, where control with TCL_LEAVE_ERR_MSG flag is more easily - handled. - -2009-03-16 Donal K. Fellows - - * generic/tclCmdMZ.c (TryPostBody): [Bug 2688063]: Extract information - from list before getting rid of last reference to it. - -2009-03-15 Joe Mistachkin - - * generic/tclThread.c: [Bug 2687952]: Modify fix for TSD leak to match - * generic/tclThreadStorage.c: Tcl 8.5 (and prior) allocation semantics - -2009-03-15 Donal K. Fellows - - * generic/tclThreadStorage.c (TSDTableDelete): [Bug 2687952]: Ensure - * generic/tclThread.c (Tcl_GetThreadData): that structures in - Tcl's TSD system are all freed. Use the correct matching allocator. - - * generic/tclPosixStr.c (Tcl_SignalId,Tcl_SignalMsg): [Patch 1513655]: - Added support for SIGINFO, which is present on BSD platforms. - -2009-03-14 Donal K. Fellows - - * unix/tcl.pc.in (new file): [Patch 2243948] (hat0) - * unix/configure.in, unix/Makefile.in: Added support for reporting - Tcl's public build configuration via the pkg-config system. TEA is - still the official mechanism though, in part because pkg-config is not - universally supported across all Tcl's supported platforms. - -2009-03-11 Miguel Sofer - - * generic/tclBasic.c (TclNRCoroutineObjCmd): fix Tcl_Obj leak. - Diagnosis and fix thanks to GPS. - -2009-03-09 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_TryObjCmd, TclNRTryObjCmd): Moved the - implementation of [try] from Tcl code into C. Still lacks a bytecode - version, but should be better than what was before. - -2009-03-04 Donal K. Fellows - - * generic/tclZlib.c (TclZlibCmd): Checksums are defined to be unsigned - 32-bit integers, use Tcl_WideInt to pass to scripts. [Bug 2662434] - (ZlibStreamCmd, ChanGetOption): A few other related corrections. - -2009-02-27 Jan Nijtmans - - * generic/tcl.decls: [Bug 218977]: Tcl_DbCkfree needs return value - * generic/tclCkalloc.c - * generic/tclDecls.h: (regenerated) - * generic/tclInt.decls: don't use CONST84/CONST86 here - * generic/tclCompile.h: don't use CONST86 here, comment fixing. - * generic/tclIO.h: don't use CONST86 here, comment fixing. - * generic/tclIntDecls.h (regenerated) - -2009-02-25 Don Porter - - * generic/tclUtil.c (TclStringMatchObj): [Bug 2637173]: Revised - the branching on the strObj->typePtr so that untyped values get - converted to the "string" type and pass through the Unicode matcher. - [Bug 2613766]: Also added checks to only perform "bytearray" - optimization on pure bytearray values. - - * generic/tclCmdMZ.c: Since Tcl_GetCharLength() has its own - * generic/tclExecute.c: optimizations for the tclByteArrayType, stop - having the callers do them. - -2009-02-24 Donal K. Fellows - - * doc/clock.n, doc/fblocked.n, doc/format.n, doc/lsort.n, - * doc/pkgMkIndex.n, doc/regsub.n, doc/scan.n, doc/tclvars.n: - General minor documentation improvements. - - * library/http/http.tcl (geturl, Eof): Added support for 8.6's built - in zlib routines. - -2009-02-22 Alexandre Ferrieux - - * tests/lrange.test: Revert commits of 2008-07-23. Those were speed - * tests/binary.test: tests, that are inherently brittle. - -2009-02-21 Don Porter - - * generic/tclStringObj.c: Several revisions to the shimmering - patterns between Unicode and UTF string reps. Most notably the - call: objPtr = Tcl_NewUnicodeObj(...,0); followed by a loop of calls: - Tcl_AppendUnicodeToObj(objPtr, u, n); will now grow and append to - the Unicode representation. Before this commit, the sequence would - convert each append to UTF and perform the append to the UTF rep. - This is puzzling and likely a bug. The performance of [string map] - is significantly improved by this change (according to the MAP - collection of benchmarks in tclbench). Just in case there was some - wisdom in the old ways that I missed, I left in the ability to restore - the old patterns with a #define COMPAT 1 at the top of the file. - -2009-02-20 Don Porter - - * generic/tclPathObj.c: [Bug 2571597]: Fixed mistaken logic in - * tests/fileName.test: TclFSGetPathType() that assumed (not - "absolute") => "relative". This is a false assumption on Windows, - where "volumerelative" is another possibility. - -2009-02-18 Don Porter - - * generic/tclStringObj.c: Simplify the logic of the - Tcl_*SetObjLength() routines. - - * generic/tclStringObj.c: Rewrite GrowStringBuffer() so that it - has parallel structure with GrowUnicodeBuffer(). The revision permits - allocation attempts to continue all the way up to failure, with no - gap. It also directly manipulates the String and Tcl_Obj internals - instead of inefficiently operating via Tcl_*SetObjLength() with all of - its extra protections and underdocumented special cases. - - * generic/tclStringObj.c: Another round of simplification on - the allocation macros. - -2009-02-17 Jeff Hobbs - - * win/tcl.m4, win/configure: Check if cl groks _WIN64 already to - avoid CC manipulation that can screw up later configure checks. - Use 'd'ebug runtime in 64-bit builds. - -2009-02-17 Don Porter - - * generic/tclStringObj.c: Pare back the length of the unicode - array in a non-extended String struct to one Tcl_UniChar, meant to - hold the terminating NUL character. Non-empty unicode strings are - then stored by extending the String struct by stringPtr->maxChars - additional slots in that array with sizeof(Tcl_UniChar) bytes per - slot. This revision makes the allocation macros much simpler. - - * generic/tclStringObj.c: Factor out common GrowUnicodeBuffer() - and solve overflow and growth algorithm fallbacks in it. - - * generic/tclStringObj.c: Factor out common GrowStringBuffer(). - - * generic/tclStringObj.c: Convert Tcl_AppendStringsToObj into - * tests/stringObj.test: a radically simpler implementation - where we just loop over calls to Tcl_AppendToObj. This fixes [Bug - 2597185]. It also creates a *** POTENTIAL INCOMPATIBILITY *** in - that T_ASTO can now allocate more space than is strictly required, - like all the other Tcl_Append* routines. The incompatibility was - detected by test stringObj-6.5, which I've updated to reflect the - new behavior. - - * generic/tclStringObj.c: Revise buffer growth implementation - in ExtendStringRepWithUnicode. Use cheap checks to determine that - no reallocation is necessary without cost of computing the precise - number of bytes needed. Also make use of the string growth algortihm - in the case of repeated appends. - -2009-02-16 Jan Nijtmans - - * generic/tclZlib.c: Hack needed for official zlib1.dll build. - * win/configure.in: fix [Feature Request 2605263] use official - * win/Makefile.in: zlib build. - * win/configure: (regenerated) - * compat/zlib/zdll.lib: new files - * compat/zlib/zlib1.dll: - - * win/Makefile.in: [Bug 2605232]: tdbc doesn't build when Tcl is - compiled with --disable-shared. - -2009-02-15 Don Porter - - * generic/tclStringObj.c: [Bug 2603158]: Added protections from - * generic/tclTestObj.c: invalid memory accesses when we append - * tests/stringObj.test: (some part of) a Tcl_Obj to itself. - Added the appendself and appendself2 subcommands to the - [teststringobj] testing command and added tests to the test suite. - - * generic/tclStringObj.c: Factor out duplicate code from - Tcl_AppendObjToObj. - - * generic/tclStringObj.c: Replace the 'size_t uallocated' field - of the String struct, storing the number of bytes allocated to store - the Tcl_UniChar array, with an 'int maxChars' field, storing the - number of Tcl_UniChars that may be stored in the allocated space. - This reduces memory requirement a small bit, and makes some range - checks simpler to code. - * generic/tclTestObj.c: Replace the [teststringobj ualloc] testing - * tests/stringObj.test: command with [teststringobj maxchars] and - update the tests. - - * generic/tclStringObj.c: Removed limitation in - Tcl_AppendObjToObj where the char length of the result was only - computed if the appended string was all single byte characters. - This limitation was in place to dodge a bug in Tcl_GetUniChar. - With that bug gone, we can take advantage of always recording the - length of append results when we know it. - -2009-02-14 Don Porter - - * generic/tclStringObj.c: Revisions so that we avoid creating - the strange representation of an empty string with - objPtr->bytes == NULL and stringPtr->hasUnicode == 0. Instead in - the situations where that was being created, create a traditional - two-legged stork representation (objPtr->bytes = tclEmptyStringRep - and stringPtr->hasUnicode = 1). In the situations where the strange - rep was treated differently, continue to do so by testing - stringPtr->numChars == 0 to detect it. These changes make the code - more conventional so easier for new maintainers to pick up. Also - sets up further simplifications. - - * generic/tclTestObj.c: Revise updates to [teststringobj] so we don't - get blocked by MODULE_SCOPE limits. - -2009-02-12 Don Porter - - * generic/tclStringObj.c: Rewrites of the routines - Tcl_GetCharLength, Tcl_GetUniChar, Tcl_GetUnicodeFromObj, - Tcl_GetRange, and TclStringObjReverse to use the new macro, and - to more simply and clearly split the cases depending on whether - a valid unicode rep is present or needs to be created. - New utility routine UnicodeLength(), to compute the length of unicode - buffer arguments when no length is passed in, with built-in - overflow protection included. Update three callers to use it. - - * generic/tclInt.h: New macro TclNumUtfChars meant to be a faster - replacement for a full Tcl_NumUtfChars() call when the string has all - single-byte characters. - - * generic/tclStringObj.c: Simplified Tcl_GetCharLength by - * generic/tclTestObj.c: removing code that did nothing. - Added early returns from Tcl_*SetObjLength when the desired length - is already present; adapted test command to the change. - - * generic/tclStringObj.c: Re-implemented AppendUtfToUnicodeRep - so that we no longer pass through Tcl_DStrings which have their own - sets of problems when lengths overflow the int range. Now AUTUR and - FillUnicodeRep share a common core routine. - -2009-02-12 Donal K. Fellows - - * generic/tclOODefineCmds.c (TclOOGetDefineCmdContext): Use the - correct field in the Interp structure for retrieving the frame to get - the context object so that people can extend [oo::define] without deep - shenanigans. Bug found by Federico Ferri. - -2009-02-11 Don Porter - - * generic/tclStringObj.c: Re-implemented AppendUnicodeToUtfRep - so that we no longer pass through Tcl_DStrings which have their own - sets of problems when lengths overflow the int range. Now AUTUR and - UpdateStringOfString share a common core routine. - - * generic/tclStringObj.c: Changed type of the 'allocated' field - * generic/tclTestObj.c: of the String struct (and the - TestString counterpart) from size_t to int since only int values are - ever stored in it. - -2009-02-10 Jan Nijtmans - - * generic/tclEncoding.c: Eliminate some unnessary type casts - * generic/tclEvent.c: some internal const decorations - * generic/tclExecute.c: spacing - * generic/tclIndexObj.c: - * generic/tclInterp.c: - * generic/tclIO.c: - * generic/tclIOCmd.c: - * generic/tclIORChan.c: - * generic/tclIOUtil.c: - * generic/tclListObj.c: - * generic/tclLiteral.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclOOBasic.c: - * generic/tclPathObj.c: - * generic/tclPkg.c: - * generic/tclProc.c: - * generic/tclRegexp.c: - * generic/tclScan.c: - * generic/tclStringObj.c: - * generic/tclTest.c: - * generic/tclTestProcBodyObj.c: - * generic/tclThread.c: - * generic/tclThreadTest.c: - * generic/tclTimer.c: - * generic/tclTrace.c: - * generic/tclUtil.c: - * generic/tclVar.c: - * generic/tclStubInit.c: (regenerated) - -2009-02-10 Jan Nijtmans - - * unix/tcl.m4: [Bug 2502365]: Building of head on HPUX is broken when - using the native CC. - * unix/configure: (autoconf-2.59) - -2009-02-10 Don Porter - - * generic/tclObj.c (Tcl_GetString): Added comments and validity - checks following the call to an UpdateStringProc. - - * generic/tclStringObj.c: Reduce code duplication in Tcl_GetUnicode*. - Restrict AppendUtfToUtfRep to non-negative length appends. - Convert all Tcl_InvalidateStringRep() calls into macros. - Simplify Tcl_AttemptSetObjLength by removing unreachable code. - Simplify SetStringFromAny() by removing unreachable and duplicate code. - Simplify Tcl_SetObjLength by removing unreachable code. - Removed handling of (objPtr->bytes != NULL) from UpdateStringOfString, - which is only called when objPtr->bytes is NULL. - -2009-02-09 Jan Nijtmans - - * generic/tclCompile.c: [Bug 2555129]: const compiler warning (as - error) in tclCompile.c - -2009-02-07 Donal K. Fellows - - * generic/tclZlib.c (TclZlibCmd): [Bug 2573172]: Ensure that when - invalid subcommand name is given, the list of valid subcommands is - produced. This gives a better experience when using the command - interactively. - -2009-02-05 Joe Mistachkin - - * generic/tclInterp.c: [Bug 2544618]: Fix argument checking for - [interp cancel]. - * unix/Makefile.in: Fix build issue with zlib on FreeBSD (and possibly - other platforms). - -2009-02-05 Donal K. Fellows - - * generic/tclCmdMZ.c (StringIndexCmd, StringRangeCmd, StringLenCmd): - Simplify the implementation of some commands now that the underlying - string API knows more about bytearrays. - - * generic/tclExecute.c (TclExecuteByteCode): [Bug 2568434]: Make sure - that INST_CONCAT1 will not lose string reps wrongly. - - * generic/tclStringObj.c (Tcl_AppendObjToObj): Special-case the - appending of one bytearray to another, which can be extremely rapid. - Part of scheme to address [Bug 1665628] by making the basic string - operations more efficient on byte arrays. - (Tcl_GetCharLength, Tcl_GetUniChar, Tcl_GetRange): More special casing - work for bytearrays. - -2009-02-04 Don Porter - - * generic/tclStringObj.c: [Bug 2561794]: Added overflow protections to - the AppendUtfToUtfRep routine to either avoid invalid arguments and - crashes, or to replace them with controlled panics. - - * generic/tclCmdMZ.c: [Bug 2561746]: Prevent crashes due to int - overflow of the length of the result of [string repeat]. - -2009-02-03 Jan Nijtmans - - * macosx/tclMacOSXFCmd.c: Eliminate some unnessary type casts - * unix/tclLoadDyld.c: some internal const decorations - * unix/tclUnixCompat.c: spacing - * unix/tclUnixFCmd.c - * unix/tclUnixFile.c - * win/tclWinDde.c - * win/tclWinFCmd.c - * win/tclWinInit.c - * win/tclWinLoad.c - * win/tclWinPipe.c - * win/tclWinReg.c - * win/tclWinTest.c - * generic/tclBasic.c - * generic/tclBinary.c - * generic/tclCmdAH.c - * generic/tclCmdIL.c - * generic/tclCmdMZ.c - * generic/tclCompCmds.c - * generic/tclDictObj.c - -2009-02-03 Donal K. Fellows - - * generic/tclObj.c (tclCmdNameType): [Bug 2558422]: Corrected the type - of this structure so that extensions that write it (yuk!) will still - be able to function correctly. - -2009-02-03 Don Porter - - * generic/tclStringObj.c (SetUnicodeObj): [Bug 2561488]: - Corrected failure of Tcl_SetUnicodeObj() to panic on a shared object. - Also factored out common code to reduce duplication. - - * generic/tclObj.c (Tcl_GetStringFromObj): Reduce code duplication. - -2009-02-02 Don Porter - - * generic/tclInterp.c: Reverted the conversion of [interp] into an - * tests/interp.test: ensemble. Such conversion is not necessary - * tests/nre.test: (or even all that helpful) in the NRE-enabling - of [interp invokehidden], and it has other implications -- including - significant forkage of the 8.5 and 8.6 implementations -- that are - better off avoided if there's no gain. - - * generic/tclStringObj.c (STRING_NOMEM): [Bug 2494093]: Add missing - cast of NULL to (char *) that upsets some compilers. - - * generic/tclStringObj.c (Tcl_(Attempt)SetObjLength): [Bug 2553906]: - Added protections against callers asking for negative lengths. It is - likely when this happens that an integer overflow is to blame. - -2009-02-01 David Gravereaux - - * win/makefile.vc: Allow nmake flags such as -a (rebuild all) to pass - down to the pkgs targets, too. - -2009-01-30 Donal K. Fellows - - * doc/chan.n: [Bug 1216074]: Added another extended example. - - * doc/refchan.n: Added an example of how to build a scripted channel. - -2009-01-29 Donal K. Fellows - - * tests/stringObj.test: [Bug 2006888]: Remove non-ASCII chars from - non-comment locations in the file, making it work more reliably in - locales with a non-Latin-1 default encoding. - - * generic/tclNamesp.c (Tcl_FindCommand): [Bug 2519474]: Ensure that - the path is not searched when the TCL_NAMESPACE_ONLY flag is given. - - * generic/tclOODecls.h (Tcl_OOInitStubs): [Bug 2537839]: Make the - declaration of this macro work correctly in the non-stub case. - -2009-01-29 Don Porter - - * generic/tclInterp.c: Convert the [interp] command into a - * tests/interp.test: [namespace ensemble]. Work in progress - * tests/nre.test: to NRE-enable the [interp invokehidden] - subcommand. - -2009-01-29 Donal K. Fellows - - * generic/tclNamesp.c (TclMakeEnsemble): [Bug 2529117]: Make this - function behave more sensibly when presented with a fully-qualified - name, rather than doing strange stuff. - -2009-01-28 Donal K. Fellows - - * generic/tclBasic.c (TclInvokeObjectCommand): Made this understand - what to do if it ends up being used on a command with no objProc; that - shouldn't happen, but... - - * generic/tclNamesp.c (TclMakeEnsemble): [Bug 2529157]: Made this - understand NRE command implementations better. - * generic/tclDictObj.c (DictForCmd): Eliminate unnecessary command - implementation. - -2009-01-27 Donal K. Fellows - - * generic/tclOODefineCmds.c (Tcl_ClassSetConstructor): - [Bug 2531577]: Ensure that caches of constructor chains are cleared - when the constructor is changed. - -2009-01-26 Alexandre Ferrieux - - * generic/tclInt.h: [Bug 1028264]: WSACleanup() too early. - * generic/tclEvent.c: The fix introduces "late exit handlers" for - * win/tclWinSock.c: similar late process-wide cleanups. - -2009-01-26 Alexandre Ferrieux - - * win/tclWinSock.c: [Bug 2446662]: Resync Win behavior on RST with - that of unix (EOF). - -2009-01-26 Donal K. Fellows - - * generic/tclZlib.c (ChanClose): [Bug 2536400]: Only generate error - messages in the interpreter when the thread is not being closed down. - -2009-01-23 Donal K. Fellows - - * doc/zlib.n: Added a note that 'zlib push' is reversed by 'chan pop'. - -2009-01-22 Jan Nijtmans - - * generic/tclCompile.h: CONSTify TclPrintInstruction (TIP #27) - * generic/tclCompile.c - * generic/tclInt.h: CONSTify TclpNativeJoinPath (TIP #27) - * generic/tclFileName.c - * generic/tcl.decls: {unix win} is equivalent to {generic} - * generic/tclInt.decls - * generic/tclDecls.h: (regenerated) - * generic/tclIntDecls.h - * generic/tclGetDate.y: Single internal const decoration. - * generic/tclDate.c: - -2009-01-22 Kevin B. Kenny - - * unix/tcl.m4: Corrected a typo ($(SHLIB_VERSION) should be - ${SHLIB_VERSION}). - * unix/configure: Autoconf 2.59 - -2009-01-21 Andreas Kupries - - * generic/tclIORChan.c (ReflectClose): [Bug 2458202]: - * generic/tclIORTrans.c (ReflectClose): Closing a channel may supply - NULL for the 'interp'. Test for finalization needs to be different, - and one place has to pull the interp out of the channel instead. - -2009-01-21 Don Porter - - * generic/tclStringObj.c: New fix for [Bug 2494093] replaces the - flawed attempt committed 2009-01-09. - -2009-01-19 Kevin B. Kenny - - * unix/Makefile.in: [Patch 907924]:Added a CONFIG_INSTALL_DIR - * unix/tcl.m4: parameter so that distributors can control where - tclConfig.sh goes. Made the installation of 'ldAix' conditional upon - actually being on an AIX system. Allowed for downstream packagers to - customize SHLIB_VERSION on BSD-derived systems. Thanks to Stuart - Cassoff for his help. - * unix/configure: Autoconf 2.59 - -2009-01-19 David Gravereaux - - * win/build.vc.bat: Improved tools detection and error message - * win/makefile.vc: Reorganized the $(TCLOBJ) file list into seperate - parts for easier maintenance. Matched all sources built using -GL to - both $(lib) and $(link) to use -LTCG and avoid a warning message. - Addressed the over-building nature of the htmlhelp target by moving - from a pseudo target to a real target dependent on the entire docs/ - directory contents. - * win/nmakehlp.c: Removed -g option and GrepForDefine() func as it - isn't being used anymore. The -V option method is much better. - -2009-01-16 Don Porter - - * generic/tcl.h: Bump patchlevel to 8.6b1.1 to distinguish - * library/init.tcl: CVS snapshots from the 8.6b1 and 8.6b2 releases - * unix/configure.in: and to deal with the fact that the 8.6b1 - * win/configure.in: version of init.tcl will not [source] in the - HEAD version of Tcl. - - * unix/configure: autoconf-2.59 - * win/configure: - -2009-01-14 Don Porter - - * generic/tclBasic.c (Tcl_DeleteCommandFromToken): Reverted most - of the substance of my 2009-01-12 commit. NULLing the objProc field of - a Command when deleting it is important so that tests for certain - classes of commands don't return false positives when applied to - deleted command tokens. Overall change is now just replacement of a - false comment with a true one. - -2009-01-13 Jan Nijtmans - - * unix/tcl.m4: [Bug 2502365]: Building of head on HPUX is broken when - using the native CC. - * unix/configure (autoconf-2.59) - -2009-01-13 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_ThrowObjCmd): Move implementation of [throw] - * library/init.tcl (throw): to C from Tcl. - -2009-01-12 Don Porter - - * generic/tclBasic.c (Tcl_DeleteCommandFromToken): One consequence of - the NRE rewrite is that there are now situations where a NULL objProc - field in a Command struct is perfectly normal. Removed an outdated - comment in Tcl_DeleteCommandFromToken that claimed we use - cmdPtr->objPtr==NULL as a test of command validity. In fact we use - cmdPtr->flags&CMD_IS_DELETED to perform that test. Also removed the - setting to NULL, since any extension following the advice of the old - comment is going to be broken by NRE anyway, and needs to shift to - flag-based testing (or stop intruding into such internal matters). - Part of [Bug 2486550]. - -2009-01-09 Don Porter - - * generic/tclStringObj.c (STRING_SIZE): [Bug 2494093]: Corrected - failure to limit memory allocation requests to the sizes that can be - supported by Tcl's memory allocation routines. - -2009-01-09 Donal K. Fellows - - * generic/tclNamesp.c (NamespaceEnsembleCmd): [Bug 1558654]: Error out - when someone gives wrong # of args to [namespace ensemble create]. - -2009-01-08 Don Porter - - * generic/tclStringObj.c (STRING_UALLOC): [Bug 2494093]: Added missing - parens required to get correct results out of things like - STRING_UALLOC(num + append). - -2009-01-08 Donal K. Fellows - - * generic/tclDictObj.c, generic/tclIndexObj.c, generic/tclListObj.c, - * generic/tclObj.c, generic/tclStrToD.c, generic/tclUtil.c, - * generic/tclVar.c: Generate errorcodes for the error cases which - approximate to "I can't interpret that string as one of those" and - "You gave me the wrong number of arguments". - -2009-01-07 Donal K. Fellows - - * doc/dict.n: [Tk Bug 2491235]: Added more examples. - - * tests/oo.test (oo-22.1): Adjusted test to be less dependent on the - specifics of how [info frame] reports general frame information, and - instead to focus on what methods add to it; that's really what the - test is about anyway. - -2009-01-06 Don Porter - - * tests/stringObj.test: Revise tests that demand a NULL Tcl_ObjType - in certain values to construct those values with [testdstring] so - there's no lack of robustness depending on the shimmer history of - shared literals. - -2009-01-06 Donal K. Fellows - - * generic/tclDictObj.c (DictIncrCmd): Corrected twiddling in internals - of dictionaries so that literals can't get destroyed. - - * tests/expr.test: [Bug 2006879]: Eliminate non-ASCII char. - - * generic/tclOOInfo.c (InfoObjectMethodsCmd,InfoClassMethodsCmd): - [Bug 2489836]: Only delete pointers that were actually allocated! - - * generic/tclOO.c (TclNRNewObjectInstance, Tcl_NewObjectInstance): - [Bug 2481109]: Perform search for existing commands in right context. - -2009-01-05 Donal K. Fellows - - * generic/tclCmdMZ.c (TclNRSourceObjCmd): [Bug 2412068]: Make - * generic/tclIOUtil.c (TclNREvalFile): implementation of the - [source] command be NRE enabled so that [yield] inside a script - sourced in a coroutine can work. - -2009-01-04 Donal K. Fellows - - * generic/tclCmdAH.c: Tidy up spacing and code style. - -2009-01-03 Kevin B. Kenny - - * library/clock.tcl (tcl::clock::add): Fixed error message formatting - in the case where [clock add] is presented with a bad switch. - * tests/clock.test (clock-65.1) Added a test case for the above - problem [Bug 2481670]. - -2009-01-02 Donal K. Fellows - - * unix/tcl.m4 (SC_CONFIG_CFLAGS): [Bug 878333]: Force the use of the - compatibility version of mkstemp() on IRIX. - * unix/configure.in, unix/Makefile.in (mkstemp.o): - * compat/mkstemp.c (new file): [Bug 741967]: Added a compatibility - implementation of the mkstemp() function, which is apparently needed - on some platforms. - - ****************************************************************** - *** CHANGELOG ENTRIES FOR 2008 IN "ChangeLog.2008" *** - *** CHANGELOG ENTRIES FOR 2006-2007 IN "ChangeLog.2007" *** - *** CHANGELOG ENTRIES FOR 2005 IN "ChangeLog.2005" *** - *** CHANGELOG ENTRIES FOR 2004 IN "ChangeLog.2004" *** - *** CHANGELOG ENTRIES FOR 2003 IN "ChangeLog.2003" *** - *** CHANGELOG ENTRIES FOR 2002 IN "ChangeLog.2002" *** - *** CHANGELOG ENTRIES FOR 2001 IN "ChangeLog.2001" *** - *** CHANGELOG ENTRIES FOR 2000 IN "ChangeLog.2000" *** - *** CHANGELOG ENTRIES FOR 1999 AND EARLIER IN "ChangeLog.1999" *** - ****************************************************************** diff --git a/ChangeLog.1999 b/ChangeLog.1999 deleted file mode 100644 index 3bf4e9a..0000000 --- a/ChangeLog.1999 +++ /dev/null @@ -1,2634 +0,0 @@ -1999-12-22 Jeff Hobbs - - * changes: updated changes file - * tools/tclSplash.bmp: updated to show 8.3 - -1999-12-21 Jeff Hobbs - - * README: - * generic/tcl.h: - * mac/README: - * unix/configure.in: - * tools/tcl.wse.in: - * win/README.binary: - * win/configure.in: updated to patch level 8.3b1 - - * unix/Makefile.in: added -srcdir=... for 'make html' - - * doc/Hash.3: fixed reference to ckfree [Bug 3912] - * doc/RegExp.3: fixed calling params for Tcl_RegExecFromObj - * doc/open.n: fixed minor formatting errors - * doc/string.n: fixed minor formatting errors - - * doc/lsort.n: added -unique docs - * tests/cmdIL.test: - * generic/tclCmdIL.c: added -unique option to lsort - - * generic/tclThreadTest.c: changed thread ids to longs [Bug 3902] - - * mac/tclMacOSA.c: fixed applescript for I18N [Bug 3644] - - * win/mkd.bat: - * win/rmd.bat: removed necessity of tag.txt [Bug 3874] - - * win/tclWinThrd.c: changed CreateThread to _beginthreadex and - ExitThread to _endthreadex - -1999-12-12 Jeff Hobbs - - * doc/glob.n: - * tests/fileName.test: - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - * generic/tclEncoding.c: - * generic/tclFileName.c: - * mac/tclMacFile.c: - * unix/tclUnixFile.c: - * win/tclWinFile.c: enhanced the glob command with the new options - -types -path -directory and -join. Deprecated TclpMatchFiles with - TclpMatchFilesTypes, extended TclGlob and TclDoGlob and added - GlobTypeData structure. [Bug 2363] - -1999-12-10 Jeff Hobbs - - * tests/var.test: - * generic/tclCompile.c: fixed problem where setting to {} array would - intermittently not work. [Bug 3339] (Fontaine) - - * generic/tclCmdMZ.c: - * generic/tclExecute.c: optimized INST_TRY_CVT_TO_NUMERIC to recognize - boolean objects. [Bug 2815] (Spjuth) - - * tests/info.test: - * tests/parseOld.test: - * generic/tclCmdAH.c: - * generic/tclProc.c: changed Tcl_UplevelObjCmd (uplevel) and - Tcl_EvalObjCmd (eval) to use TCL_EVAL_DIRECT in the single arg case as - well, to take advantage of potential pure list input optimization. - This means that it won't get byte compiled though, which should be - acceptable. - * generic/tclBasic.c: made Tcl_EvalObjEx pure list object aware in the - TCL_EVAL_DIRECT case for efficiency. - * generic/tclUtil.c: made Tcl_ConcatObj pure list object aware, and - return a list object in that case [Bug 2098 2257] - - * generic/tclMain.c: changed Tcl_Main to not constantly reuse the - commandPtr object (interactive case) as it could be shared. (Fellows) - - * unix/configure.in: - * unix/tcl.m4: - * unix/tclUnixPipe.c: removed checking for compatible vfork function - and use of the vfork function. Modern VM systems rarely suffer any - performance degradation when fork is used, and it solves multiple - problems with vfork. Users that still want vfork can add -Dfork=vfork - to the compile flags. [Bug 942 2228 1312] - -1999-12-09 Jeff Hobbs - - * win/aclocal.m4: made it just include tcl.m4 - - * doc/exec.n: - * doc/open.n: - * win/tclWin32Dll.c: - * win/tclWinChan.c: - * win/tclWinFCmd.c: - * win/tclWinInit.c: - * win/tclWinPipe.c: - * win/tclWinSock.c: removed all code that supported Win32s. It was no - longer officially supported, and likely didn't work anyway. - * win/makefile.vc: removed 16 bit stuff, cleaned up. - - * win/tcl16.rc: - * win/tclWin16.c: - * win/winDumpExts.c: these files have been removed from the source - tree (no longer necessary to build) - -1999-12-07 Jeff Hobbs - - * tests/io.test: removed 'knownBug' tests that were for unsupported0, - which is now fcopy (that already has tests) - - * mac/tclMacPort.h: added utime.h include - - * generic/tclDate.c: - * unix/Makefile.in: fixed make gendate to swap const with CONST so it - uses the Tcl defined CONST type [Bug 3521] - - * generic/tclIO.c: removed panic that could occur in FlushChannel when - a "blocking" channel would receive EAGAIN, instead treating it the - same as non-blocking. [Bug 3773] - - * generic/tclUtil.c: fixed Tcl_ScanCountedElement to not step beyond - the end of the counted string. [Bug 3336] - -1999-12-03 Jeff Hobbs - - * doc/load.n: added note about NT's buggy handling of './' with - LoadLibrary - - * library/http2.1/http.tcl: fixed error handling in http::Event. [Bug - 3752] - - * tests/env.test: removed knownBug limitation from working test - * tests/all.tcl: ensured that ::tcltest::testsDirectory would be set - to an absolute path - - * tests/expr-old.test: - * tests/parseExpr.test: - * tests/string.test: - * generic/tclGet.c: - * generic/tclInt.h: - * generic/tclObj.c: - * generic/tclParseExpr.c: - * generic/tclUtil.c: - * generic/tclExecute.c: added TclCheckBadOctal routine to enhance - error message checking for when users use invalid octal numbers (like - 08), as well as replumbed the Expr*Funcs with a new VerifyExprObjType - to simplify type handling. [Bug 2467] - - * tests/expr.test: - * generic/tclCompile.c: fixed 'bad code length' error for 'expr + - {[incr]}' case, with new test case [Bug 3736] and seg fault on 'expr - + {[error]}' (different cause) that was caused by a correct - optimization that didn't correctly track how it was modifying the - source string in the opt. The optimization was removed, which means - that: - expr 1 + {[string length abc]} - will be not be compiled inline as before, but this should be written: - expr {1 + [string length abc]} - which will be compiled inline for speed. This prevents: - expr 1 + {[mindless error]} - from seg faulting, and only affects optimizations for degenerate cases - [Bug 3737] - -1999-12-01 Scott Redman - - * generic/tcl.decls: - * generic/tclMain.c: - * unix/tclAppInit.c: - * win/tclAppInit.c: Added two new internal functions, - TclSetStartupScriptFileName() and TclGetStartupScriptFileName() and - added hooks into the main() code for supporting TclPro and other "big" - shells more easily without requiring a copy of the main() code. - - * generic/tclEncoding.c: - * generic/tclEvent.c: Moved encoding-related startup code from - tclEvent.c into the more appropriate tclEncoding.c. - -1999-11-30 Jeff Hobbs - - * generic/tclIO.c: fix from Kupries for Tcl_UnstackChannel that - correctly handles resetting translation and encoding. - - * generic/tclLoad.c: #def'd out the unloading of DLLs at finalize time - for Unix in TclFinalizeLoad. [Bug 2560 3373] Should be parametrized - to allow for user to specify unload or not. - - * win/tclWinTime.c: fixed handling of %Z on NT for time zones that - don't have DST. - -1999-11-29 Jeff Hobbs - - * library/dde1.1/pkgIndex.tcl: - * library/reg1.0/pkgIndex.tcl: added supported for debugged versions - of the libraries - - * unix/tclUnixPipe.c: fixed PipeBlockModeProc to properly set - isNonBlocking flag on pipe. [Bug 1356 710] - removed spurious fcntl call from PipeBlockModeProc - - * tests/scan.test: - * generic/tclScan.c: fixed scan where %[..] didn't match anything and - added test case. [Bug 3700] - -1999-11-24 Jeff Hobbs - - * doc/open.n: - * win/tclWinSerial.c: adopted patch from Schroedter to handle - fconfigure $sock -lasterror on Windows. [RFE 3368] - - * generic/tclCmdIL.c: made SORTMODE_INTEGER work with Longs [Bug 3652] - -1999-11-23 Scott Stanton - - * library/tcltest1.0/tcltest.tcl: Fixed bug where tcltest output went - to stdout instead of the specified output file in some cases. - -1999-11-19 Jeff Hobbs - - * generic/tclProc.c: backed out change from 1999-11-18 as it could - affect return string from upvar as well. - - * tools/tcl.wse.in: added tcltest1.0 library to distribution list - - * doc/http.n: - * library/http2.1/http.tcl: - * library/http2.1/pkgIndex.tcl: updated http package to 2.2 - -1999-11-18 Jeff Hobbs - - * unix/tcl.m4: added defined for _THREAD_SAFE in --enable-threads - case; added check for pthread_mutex_init in libc; in AIX case, with - --enable-threads ${CC}_r is used; fixed flags when using gcc on SCO - - * generic/tclProc.c: corrected error reporting for default case at the - global level for uplevel command. - - * generic/tclIOSock.c: changed int to size_t type for len in - TclSockMinimumBuffers. - - * generic/tclCkalloc.c: fixed Tcl_DbCkfree to return a value on NULL - input. [Bug 3400] - - * generic/tclStringObj.c: fixed support for passing in negative length - to Tcl_SetUnicodeObj, et al handling routines. [Bug 3380] - - * doc/scan.n: - * tests/scan.test: - * generic/tclScan.c: finished support for inline scan by supporting - XPG identifiers. - - * doc/http.n: - * library/http2.1/http.tcl: added register and unregister commands to - http:: package (better support for tls/SSL), as well as -type argument - to http::geturl. [RFE 2617] - - * generic/tclBasic.c: removed extra decr of numLevels in Tcl_EvalObjEx - that could cause seg fault. (mjansen@wendt.de) - - * generic/tclEvent.c: fixed possible lack of MutexUnlock in - Tcl_DeleteExitHandler. [Bug 3545] - - * unix/tcl.m4: Added better pthreads library check and inclusion of - _THREAD_SAFE in --enable-threads case - Added support for gcc config on SCO - - * doc/glob.n: added note about ..../ glob behavior on Win9* - * doc/tcltest.n: fixed minor example errors. [Bug 3551] - -1999-11-17 Brent Welch - - * library/http2.1/http.tcl: Correctly fixed the -timeout problem - mentioned in the 10-29 change. Also added error handling for failed - writes on the socket during the protocol. - -1999-11-09 Jeff Hobbs - - * doc/open.n: corrected docs for 'a' open mode. - - * generic/tclIOUtil.c: changed Tcl_Alloc to ckalloc - - * generic/tclInt.h: - * generic/tclObj.c: rolled back changes from 1999-10-29 - Purify noted new leaks with that code - - * generic/tclParse.c: added code in Tcl_ParseBraces to test for - possible unbalanced open brace in a comment - - * library/init.tcl: removed the installed binary directory from the - auto_path variable - - * tools/tcl.wse.in: updated to 8.3a1, fixed install of twind.tcl and - koi8-r.enc files - - * unix/tcl.m4: added recognition of pthreads library for AIX - -1999-10-29 Brent Welch - - * generic/tclInt.h: Modified the TclNewObj and TclDecrRefCount in two - ways. First, in the case of TCL_THREADS, we do not use the special - Tcl_Obj allocator because that is a source of lock contention. Second, - general code cleanup to eliminate duplicated code. In particular, - TclDecrRefCount now uses TclFreeObj instead of duplicating that code, - so it is now identical to Tcl_DecrRefCount. - - * generic/tclObj.c: Changed Tcl_NewObj so it uses the TclNewObj macro - instead of duplicating the code. Adjusted TclFreeObj so it understands - the TCL_THREADS case described above. - - * library/http2.1/http.tcl: Fixed a bug in the handling of the - state(status) variable when the -timeout flag is specified. Previously - it was possible to leave the status undefined instead of empty, which - caused errors in http::status - -1999-10-28 Jeff Hobbs - - * unix/aclocal.m4: made it just include tcl.m4 - - * library/tcltest1.0/tcltest.tcl: updated makeFile to return full - pathname of file created - - * generic/tclStringObj.c: fixed Tcl_AppendStringsToObjVA so it only - iterates once over the va_list (avoiding a memcpy of it, which is not - portable). - - * generic/tclEnv.c: fixed possible ABR error in environ array - - * tests/scan.test: - * generic/tclScan.c: added support for use of inline scan, XPG3 - currently not included - - * tests/incr.test: - * tests/set.test: - * generic/tclCompCmds.c: fixed improper bytecode handling of 'eval - {set array($unknownvar) 5}' (also for incr). [Bug 3184] - - * win/tclWinTest.c: added testvolumetype command, as atime is - completely ignored for Windows FAT file systems - * win/tclWinPort.h: added sys/utime.h to includes - * unix/tclUnixPort.h: added utime.h to includes - * doc/file.n: - * tests/cmdAH.test: - * generic/tclCmdAH.c: added time arguments to atime and mtime file - command methods (support 'touch' functionality) - -1999-10-20 Jeff Hobbs - - * unix/tclUnixNotfy.c: fixed event/io threading problems by making - triggerPipe non-blocking. [Bug 2792] - - * library/tcltest1.0/tcltest.tcl: - * generic/tclThreadTest.c: fixed mem leaks in threads - - * generic/tclResult.c: fixed Tcl_AppendResultVA so it only iterates - once over the va_list (avoiding a memcpy of it, which is not - portable). - - * generic/regc_color.c: fixed mem leak and assertion, from HS - - * generic/tclCompile.c: removed savedChar trick that appeared to be - causing a segv when the literal table was released - - * tests/string.test: - * generic/tclCmdMZ.c: fixed [string index] to return ByteArrayObj when - indexing into one (test case string-5.16). [Bug 2871] - - * library/http2.1/http.tcl: protected gets with catch. [Bug 2665] - -1999-10-19 Jennifer Hom - - * tests/tcltest.test: - * doc/tcltest.n: - * library/tcltest1.0/tcltest.tcl: Removed the extra return at the end - of the tcltest.tcl file, added version information about tcl. - - Applied patches sent in by Andreas Kupries to add helper procs for - debug output, add 3 new flags (-testsdir, -load, -loadfile), and - internally refactors common code for dealing with paths into separate - procedures. [Bug 2838, 2842] - - Merged code from core-8-2-1 branch that changes the checks for the - value of tcl_interactive to also incorporate a check for the existence - of the variable. - - * tests/autoMkindex.test: - * tests/pkgMkIndex.test: Explicitly cd to ::tcltest::testsDirectory at - the beginning of the test run - - * tests/basic.test: Use version information defined in tcltest instead - of hardcoded version number - - * tests/socket.test: package require tcltest before attempting to use - variable defined in tcltest namespace - - * tests/unixInit.test: - * tests/unixNotfy.test: Added explicit exits needed to avoid problems - when the tests area run in wish. - -1999-10-12 Jim Ingham - - * mac/tclMacLoad.c: Stupid bug - we converted the filename to - external, but used the unconverted version. - * mac/tclMacFCmd.c: Fix a merge error in the bug fix for [Bug 2869] - -1999-10-12 Jeff Hobbs - - * generic/regc_color.c: - * generic/regc_cvec.c: - * generic/regc_lex.c: - * generic/regc_locale.c: - * generic/regcomp.c: - * generic/regcustom.h: - * generic/regerrs.h: - * generic/regex.h: - * generic/regexec.c: - * generic/regguts.h: - * generic/tclRegexp.c: - * generic/tclTest.c: - * tests/reg.test: updated to Henry Spencer's new regexp engine - (mid-Sept 99). Should greatly reduce stack space reqs. - - * library/tcltest1.0/pkgIndex.tcl: fixed procs in pkgIndex.tcl file - - * generic/tclEnv.c: fixed mem leak with putenv and DStrings - * doc/Encoding.3: corrected docs - * tests/basic.test: updated test cases for 8.3 - * tests/encoding.test: fixed test case that change system encoding to - a double-byte one (this causes a bogus mem read error for purify) - * unix/Makefile.in: purify has to use -best-effort to instrument - * unix/tclAppInit.c: identified potential mem leak when compiling - tcltest (not critical) - * unix/tclUnixPipe.c: fixed mem leak in TclpCreateProcess when doing - alloc between vfork and execvp. - * unix/tclUnixTest.c: fixed mem leak in findexecutable test command - -1999-10-05 Jeff Hobbs - - * {win,mac,unix,tools,}/README: - * win/README.binary: - * win/makefile.vc: - * {win,unix}/configure.in: - * generic/tcl.h: - * library/init.tcl: updated to 8.3a1 from 8.2.0. - - * library/http2.1/http.tcl: fixed possible use of global c var. - - * win/tclWinReg.c: fixed registry command to properly 'get' - HKEY_PERFORMANCE_DATA root key data. Needs more work. - - * generic/tclNamesp.c: - * generic/tclVar.c: - * generic/tclCmdIL.c: fixed comment typos - - * mac/tclMacFCmd.c: fixed filename stuff to support UTF-8. [Bug 2869] - - * win/tclWinSerial.c: changed SerialSetOptionProc to return TCL_OK by - default. (patch from Rolf Schroedter) - -1999-09-21 Jennifer Hom - - * library/tcltest1.0/tcltest.tcl: Applied patches sent in by Andreas - Kupries to fix typos in comments and ::tcltest::grep, fix hook - redefinition problems, and change "string compare" to "string equal". - [Bug 2836, 2837, 2839, 2840] - -1999-09-20 Jeff Hobbs - - * tests/env.test: - * unix/Makefile.in: added support for AIX LIBPATH env var. [Bug 2793] - removed second definition of INCLUDE_INSTALL_DIR (the one that - referenced @includedir@) [Bug 2805] - * unix/dltest/Makefile.in: added -lc to LIBS. [Bug 2794] - -1999-09-16 Jeff Hobbs - - * tests/timer.test: changed after delay in timer test 6.29 from 1 to - 10. [Bug 2796] - - * tests/pkg.test: - * generic/tclPkg.c: fixed package version check to disallow 1.2..3 - [Bug 2539] - - * unix/Makefile.in: fixed gendate target - this never worked since RCS - was intro'd. - * generic/tclGetDate.y: updated to reflect previous changes to - tclDate.c (leap year calc) and added CEST and UCT time zone - recognition. Fixed 4 missing UCHAR() casts. [Bug 2717, 954, 1245, - 1249] - - * generic/tclCkalloc.c: changed Tcl_DumpActiveMemory to really dump to - stderr and close it [Bug 725] and changed Tcl_Ckrealloc and - Tcl_Ckfree to not bomb when NULL was passed in [Bug 1719] and changed - Tcl_Alloc, et al to not panic when a alloc request for zero came - through and NULL was returned (valid on AIX, Tru64) [Bug 2795, etc] - - * tests/clock.test: - * doc/clock.n: - * generic/tclClock.c: added -milliseconds switch to clock clicks to - guarantee that the return value of clicks is in the millisecs - granularity. [Bug 2682, 1332] - -1999-09-15 Jeff Hobbs - - * generic/tclIOCmd.c: fixed potential core dump in conjunction with - stacked channels with result obj manipulation in Tcl_ReadChars. [Bug - 2623] - - * tests/format.test: - * generic/tclCmdAH.c: fixed translation of %0#s in format. [Bug 2605] - - * doc/msgcat.n: fixed \\ bug in example. [Bug 2548] - - * unix/tcl.m4: - * unix/aclocal.m4: added fix for FreeBSD-[1-2] recognition [Bug 2070] - and fix for IRIX SHLIB_LB_LIBS. [Bug 2610] - - * doc/array.n: - * tests/var.test: - * tests/set.test: - * generic/tclVar.c: added an array unset operation, with docs and - tests. Variation of [Bug 1775]. Added fix in TclArraySet to check - when trying to set in a non-existent namespace. [Bug 2613] - -1999-09-14 Jeff Hobbs - - * tests/linsert.test: - * doc/linsert.n: - * generic/tclCmdIL.c: fixed end-int interpretation of linsert to - correctly calculate value for end, added test and docs. [Bug 2693] - - * doc/regexp.n: - * doc/regsub.n: - * tests/regexp.test: - * generic/tclCmdMZ.c: add -start switch to regexp and regsub with docs - and tests - - * doc/switch.n: added proper use of comments to example. - * generic/tclCmdMZ.c: changed switch to complain when an error occurs - that seems to be due to a misplaced comment. - - * generic/tclCmdMZ.c: fixed illegal ref for \[0-9] substitutions in - regsub. [Bug 2723] - - * generic/tclCmdMZ.c: changed [string equal] to return an Int type - object (was a Boolean) - -1999-09-01 Jennifer Hom - - * library/tcltest1.0/tcltest.tcl: Process command-line arguments only - ::tcltest doesn't have a child namespace (requires that command-line - args are processed in that namespace) - -1999-09-01 Jeff Hobbs - - * generic/tclParseExpr.c: changed '"' to '\"' to make FreeBSD happy. - [Bug 2625] - * generic/tclProc.c: moved static buf to better location and changed - static msg that would overflow in ProcessProcResultCode [Bug 2483] - and added Tcl_DStringFree to Tcl_ProcObjCmd. Also reworked size of - static buffers. - * tests/stringObj.test: added test 9.11 - * generic/tclStringObj.c: changed Tcl_AppendObjToObj to properly - handle the 1-byte dest and mixed src case where both had had Unicode - string len checks made on them. [Bug 2678] - * unix/aclocal.m4: - * unix/tcl.m4: adjusted fix from 8-21 to add -bnoentry to the AIX-* - case and readjusted the range - -1999-08-31 Jennifer Hom - - * library/tcltest1.0/tcltest.tcl: - * doc/tcltest.n: - * tests/README: Modified testConstraints variable so that it isn't - unset every time ::tcltest::initConstraints is called and cleaned up - documentation in the README file and the man page. - -1999-08-27 Jennifer Hom - - * tests/env.test: - * tests/exec.test: - * tests/io.test: - * tests/event.test: - * tests/tcltest.test: Added 'exit' calls to scripts that the tests - themselves write, and removed accidental checkin of knownBugThreaded - constraints for Solaris and Linux. - - * library/tcltest1.0/tcltest.tcl: Modified tcltest so that variables - are only initialized to their default values if they did not - previously exist. - -1999-08-26 Jennifer Hom - - * tests/tcltest.test: - * library/tcltest1.0/tcltest.tcl: Added a -args flag that sets a - variable named ::tcltest::parameters based on whatever's being sent in - as the argument to the -args flag. - -1999-08-23 Jennifer Hom - - * tests/tcltest.test: Added additional tests for -tmpdir, marked all - tests that use exec as unixOrPc. - - * tests/encoding.test: - * tests/interp.test: - * tests/macFCmd.test: - * tests/parseOld.test: - * tests/regexp.test: Applied patches from Jim Ingham to add encoding - to a Mac only interp test, change an error message in macFCmd.tet, put - a comment in parseOld.test, fix tests using the testencoding path - command, and put unixOrPc constraints on tests that use exec. - -1999-08-21 Jeff Hobbs - - * unix/aclocal.m4: Changed AIX-4.[2-9] check to AIX-4.[1-9] [Bug 1909] - -1999-08-20 Jeff Hobbs - - * generic/tclPosixStr.c: fixed typo. [Bug 2592] - - * doc/*: fixed various nroff bugs in man pages. [Bug 2503 2588] - -1999-08-19 Jeff Hobbs - - * win/README.binary: fixed version info and some typos. [Bug 2561] - - * doc/interp.n: updated list of commands available in a safe - interpreter. [Bug 2526] - - * generic/tclIO.c: changed Tcl_GetChannelNames* to use style guide - headers (pleases HP cc) - -1999-08-18 Jeff Hobbs - - * doc/Eval.3: fixed doc on input args. [Bug 2114] - - * doc/OpenFileChnl.3: - * doc/file.n: - * tests/cmdAH.test: - * tclIO.c: - * tclCmdAH.c: added "file channels ?pattern?" tcl command, with - associated Tcl_GetChannelNames and Tcl_GetChannelNamesEx public C APIs - (added to tcl.decls as well), with docs and tests. - - * tests/expr.test: - * generic/tclCompile.c: add TCL_TOKEN_VARIABLE to the part types that - cause differed compilation for exprs, to correct the expr - double-evaluation problem for vars. Added test cases. Related to [Bug - 732] - - * unix/Makefile.in: changed the dependency structure so that install-* - is dependent on * (ie - install-binaries is dependent on binaries). - - * library/auto.tcl: - * library/init.tcl: - * library/ldAout.tcl: - * library/package.tcl: - * library/safe.tcl: - * library/word.tcl: - * library/http2.1/http.tcl: - * library/msgcat1.0/msgcat.tcl: updated libraries to better Tcl style - guide (no more string comparisons with == or !=, spacing changes). - -1999-08-05 Jim Ingham - - * mac/tclMacProjects.sea.hqx: Rearrange the projects so that the build - directory is separate from the sources. Much more convenient! - -1999-08-13 Scott Redman - - * /: 8.2.0 tagged for final release - -1999-08-12 Scott Stanton - - * win/Makefile.in: Added COMPILE_DEBUG_FLAGS macro to make it easier - to turn on compiler tracing. - - * tests/parse.test: - * generic/tclParse.c: Fixed bug in Tcl_EvalEx where the termOffset was - not being updated in cases where the evaluation returned a non TCL_OK - error code. [Bug 2535] - -1999-08-12 Scott Redman - - * win/tclWinSerial.c: Applied patch from Petteri Kettunen to remove - compiler warning. - -1999-08-10 Scott Redman - - * generic/tclAlloc.c: - * generic/tclCmdIL.c: - * generic/tclIO.c: - * generic/tclThread.c: - * win/tclWinThrd.c: - * unix/tclUnixThrd.c: Fixed Brent's changes so that they work on - Windows (and he fixed the bug in the Unix thread implementation). - -1999-08-09 Brent Welch - - * generic/tcl.decls: - * generic/tclAlloc.c: - * generic/tclCkalloc.c: - * generic/tclCmdIL.c: - * generic/tclDecls.h: - * generic/tclIO.c: - * generic/tclInt.decls: - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - * generic/tclVar.c: - * mac/tclMacThrd.c: - * unix/tclUnixThrd.c: - * win/tclWinThrd.c: Added use of Tcl_GetAllocMutex to tclAlloc.c and - tclCkalloc.c so they can be linked against alternate thread packages. - Added Tcl_GetChannelNames to tclIO.c. Added TclVarTraceExists hook so - "info exists" triggers read traces exactly like it did in Tcl 7.6. - Stubs table changes to reflect new internal and external APIs. - -1999-08-09 Jeff Hobbs - - * tests/string.test: added largest_int proc to adapt for >32 bit - machines and int overflow testing. - * tests/tcltest.test: fixed minor error in 8.2 result (from dgp) - - * doc/Object.3: clarified Tcl_DecrRefCount docs. [Bug 1952] - * doc/array.n: clarified array pattern docs. [Bug 1330] - * doc/clock.n: fixed clock docs. [Bug 693] - * doc/lindex.n: clarified to account for new end-int behavior. - * doc/string.n: fixed formatting errors. [Bug 2188 2189] - * doc/tclvars.n: fixed doc error. [Bug 2042] - * library/init.tcl: fixed path handling in auto_execok (it could miss - including the normal path on some Windows machines). [Bug 1276] - -1999-08-05 Jeff Hobbs - - * doc/tclvars.n: Made it clear that tcl_pkgPath was not set for - Windows (already mentioned in init.tcl). [Bug 2455] - * generic/tclLiteral.c: fixed reference to bytes that might not be - null terminated (using objPtr->bytes, which is). [Bug 2496] - * library/http2.1/http.tcl: Made use of "i" in init section use local - var and start at 0 (was 1). [Bug 2502] - -1999-08-04 Scott Stanton - - * tests/reg.test: Added test for REG_EXPECT bug fixed by Henry's - patch. - - * generic/regc_nfa.c: - * generic/regcomp.c: - * generic/rege_dfa.c: - * generic/regexec.c: - * generic/regguts.h: Applied patches supplied by Henry Spencer to - greatly enhance the performance of certain classes of regular - expressions. [Bug 2440, 2447] - -1999-08-03 Scott Redman - - * win/tclWinInt.h: Remove function declarations in header that was - moved to tclInt.decls file in previous changes. - -1999-08-02 Scott Redman - - * unix/configure.in: - * win/configure.in: Change beta level to b2. - - * generic/tcl.h: - * generic/tcl.decls: - * generic/tclDecls.h: - * generic/tclInt.h: - * generic/tclInt.decls: - * generic/tclIntDecls.h: - * generic/tclRegexp.h: - * generic/tclStubInit.c: Move some exported public and internal - functions to the stub tables. Removed functions that are in the stub - tables (from this and previous changes) from the original header - files. - -1999-08-01 Scott Redman - - * win/tclWinSock.c: Added comment block to SocketThread() function. - Added code to avoid calling TerminateThread(), but instead to send a - message to the socket event window to tell it to terminate its thread. - -1999-07-30 Jennifer Hom - - * tests/tcltest.test: - * library/tcltest1.0/tcltest.tcl: Exit with non-zero status if there - were problems with the way the test suite was started (e.g. wrong # - arguments). - -1999-07-30 Jeff Hobbs - - * generic/tclInt.decls: added declaractions necessary for the Tcl test - code to work wth stubs. [Bug 2445] - -1999-07-30 Scott Redman - - * win/tclWinPipe.c: - * win/Makefile.in: Fixing launching of 16-bit apps on Win9x from wish. - The command line was primed with tclpip82.dll, but it was ignored. - Fixed that, then fixed the gmake makefile to build tclpip82.dll as an - executable. - - * win/tclWinSock.c: Applied small patch to get thread-specific data - after initializing the socket driver. - - * unix/tclUnixThrd.c: Applied patch to fix threads on Irix 6.5. Patch - from James Dennett. [Bug 2450] - - * tests/info.test: Enable test for tclParse.c change (info complete). - -1999-07-30 Jeff Hobbs - - * tclIO.c: added fix for Kupries' trf patch. [Bug 2386] - - * tclParse.c: fixed bug in info complete regarding nested square - brackets. [Bug 2382, 2466] - -1999-07-29 Scott Redman - - * win/tclWinChan.c: Allow tcl to open CON and NUL, even for std - channels. Checking for bad/unusable std channels was moved to Tk since - its only purpose was to check whether to use the Tk Console Window for - the std channels. [Bug 2393 2392 2209 2458] - - * unix/mkLinks.tcl: Applied patch to avoid linking pack.n to - pack-old.n. Patch from Don Porter. [Bug 2469] - - * doc/Encoding.n: Applied patch to fix typo in .SH NAME line. Patch - from Don Porter. [Bug 2451] - - * win/tclWinSock.c: Free Win32 Event handles when destroying the - socket helper thread. - -1999-07-28 Jennifer Hom - - * tests/tcltest.test: - * library/tcltest1.0/tcltest.tcl: Fixed the condition under which - ::tcltest::PrintError had an infinite loop problem and added a test - case for it. Added an optional argument to ::tcltest::getMatchingFiles - telling it where to search for test files. - -1999-07-27 Scott Redman - - * tools/tclSplash.bmp: Updated Windows installer bitmap to ready - Tcl/Tk Version 8.2. - -1999-07-26 Scott Redman - - * tests/tcltest.test: Need to close the new core file, there seems to - be a hang in threaded WinNT if the file isn't closed. Open issue, need - to fix that hang. - - * tests/httpold.test: Add time delay in response from Http server so - that test cases can properly detect timeout conditions with threads - enabled on multi-CPU WinNT. - - * tests/winFCmd.test: Test case winFcmd-1.33 was looking for - c:\windows, which may not exist. Instead, create a new directory on - c:\ and use it for the test. - - * win/tclWinConsole.c: - * win/tclWinPipe.c: - * win/tclWinSock.c: Fix terminating helper threads by holding any - mutexes from the primary thread while waiting for the helper thread to - terminate. Without these changes, the test suite hangs on WinNT with 2 - CPUs and threads enabled. Open issue, seems to be a sporadic hang on - dual CPU systems still (very rare). - -1999-07-26 Jennifer Hom - - * tests/tcltest.test: - * library/tcltest1.0/tcltest.tcl: - * doc/tcltest.n: Cleaned up code in ::tcltest::PrintError, revised - documentation, and added tests for the tcltest package. - -1999-07-23 Scott Redman - - * tests/info.test: - * generic/tclParse.c: Removed patch for info command, breaks test - cases on Unix. Patch was bad and needs to be redone properly. [Bug - 2382] - -1999-07-22 Scott Redman - - * Changed version to 8.2b2. - - * win/tclWinSock.c: Fixed hang with threads enabled, fixed semaphores - with threads disabled. - - * win/safe.test: Fixed safe-6.3 with threads enabled. - - * win/Makefile.in: Fixed calling of tcltest to fix safe.test failures - due to path TCL_LIBRARY path. - - * win/tclWinPort.h: Block out include of sys/*.h in order to build - extensions with MetroWerks compiler for Win32. [Bug 2385] - - * generic/tclCmdMZ.c: - * generic/tclIO.c: Fix ANSI-style prototypes based on patch from - Ulrich Ring. [Bug 2391] - - * unix/Makefile.in: Need to make install-sh executable before calling - (with chmod +x). [Bug 2413] - - * tests/var.test: - * generic/tclVar.c: Fixed bug that caused a seg. fault when using - "array set a(b) {}", which is a bad array name anyway. Now the "array - set" command will return an error in this case. Added test case and - fixed existing test. [Bug 2427] - -1999-07-21 Scott Redman - - * tests/info.test: - * generic/tclParse.c: Applied patch to fix "info complete" for the - string {[a [b]}. Patch from Peter Spjuth. [Bug 2382] - - * doc/Utf.3: - * generic/tcl.decls: - * generic/tclDecls.h: - * generic/tclUtf.c: Changed function declarations in - non-platform-specific public APIs to use "unsigned long" instead of - "size_t", which may not be defined on certain compilers (rather than - include sys/types.h, which may not exist). - - * unix/Makefile.in: Added the Windows configure script to the - distribution file list, already shipping configure.in and the .m4 - files, but needed the configure script itself. - - * win/makefile.vc: Changed version number of DDE package in VC++ - makefile to use 1.1 instead of 1.0. - - * doc/open.n: Added documentation of \\.\comX notation for opening - serial ports on Windows (alternative to comX:). - - * tests/ioCmd.test: - * doc/open.n: - * win/tclWinSerial.c: Applied patch from Rolf Schroedter to add - -pollinterval option to fconfigure to modify the maxblocktime used in - the fileevent polling. Added documentation and fixed the test case as - well. - - * win/tclWinSock.c: Modified 8.1.0 version of the Win32 socket driver - to move the handling of the socket event window in a separate thread. - It also turned out that Win95 & Win98 were, in some cases, getting - multiple FD_ACCEPTs but only handling one. Added a count for the - FD_ACCEPT to take care of this. Tested on NT4 SP3, NT4 SP4, Win95, and - Win98. [Bug 2178 2256 2259 2329 2323 2355] - -1999-07-21 Jerry Peek - - * README: Small tweaks to clean up typos and wording. - -1999-07-20 Melissa Hirschl - - * generic/tclInitScript.h: - * unix/tclUnixInit.c: merged code with 8.0.5. We now use an - intermediate global tcl var "tclDefaultLibrary" to keep the - "tcl_library" var from being set by the default value in the Makefile. - Also fixed a bug in which caused the value of TCL_LIBRARY env var to - be ignored. - * unix/tclWinInit.c: just updated some comments. - -1999-07-19 Melissa Hirschl - - * library/http2.1/http.tcl: updated -useragent text to say version - 2.1. - -1999-07-16 Scott Redman - - * generic/tcl.decls: - * generic/tclDecls.h: - * generic/tclStubInit.c: Add Tcl_SetNotifier to stub table. [Bug 2364] - - * unix/aclocal.m4: - * unix/tcl.m4: Add check for Alpha/Linux to correct the IEEE floating - flag to the compiler, should be -mieee. Patch from Don Porter. - - * tools/tcl.hpj.in: Change version number of .cnt file referenced in - .HPJ file. - -1999-07-15 Scott Redman - - * tools/tcl.wse.in: Fixed naming of target files for Windows. - -1999-07-14 Jerry Peek - - * doc/re_syntax.n: Deleted sentence as suggested by Scott S. - -1999-07-12 Jerry Peek - - * doc/re_syntax.n: Removed two notes to myself (oops), cleaned up - wording, fixed changebars, made two examples easier to read. - -1999-07-11 Scott Redman - - * win/makefile.vc: Since the makefile.vc should continue to work while - we're working out bugs/issues in the new TEA-style - autoconf/configure/gmake build mechanism for Windows, the version - numbers of the Tcl libraries need to remain in sync. Modified the - version numbers in the makefile to reflect the change to 8.2b1. - -1999-07-09 Scott Redman - - * win/configure.in: Eval DLLSUFFIX, LIBSUFFIX, and EXESUFFIX in the - configure script so that substitutions get expanded before being - placed in the Makefile. The "d" portion for debug libraries and DLLs - was not being set properly. - -1999-07-08 Scott Stanton - - * tests/string.test: - * generic/tclCmdMZ.c: Fixed bug in string range bounds checking code. - -1999-07-08 Jennifer Hom - - * doc/tcltest.n: - * library/tcltest1.0/tcltest.tcl: Removed -asidefromdir and - -relateddir flags, removed unused ::tcltest::dotests proc, cleaned up - implementation of core file checking, and fixed the code that checks - for 1-letter flag abbreviations. - -1999-07-08 Scott Stanton - - * win/Makefile.in: Added tcltest target so runtest works properly. - Added missing names to the clean/distclean targets. - - * tests/reg.test: - * generic/rege_dfa.c: Applied fix supplied by Henry Spencer for bug in - DFA state caching under lookahead conditions. [Bug 2318] - -1999-07-07 Scott Stanton - - * doc/fconfigure.n: Clarified default buffering behavior for the - standard channels. [Bug 2335] - -1999-07-06 Scott Redman - - * win/tclWinSerial.c: New implementation of serial port driver from - Rolf Shroedter (Rolf.Schroedter@dlr.de) that allows more than one byte - to be read from the port. Implemented using polling instead of - threads, there is a max. 10ms latency between checking the port for - file events. [Bug 1980 2217] - -1999-07-06 Brent Welch - - * library/http2.0/http.tcl: Fixed the -timeout option so it handles - timeouts that occur during connection attempts to hosts that are down - (the only case that really matters!) - -1999-07-03 Brent Welch - - * doc/ChnlStack.3: - * generic/tcl.decls: - * generic/tclIO.c: Added a new variant of the "Trf patch" from Andreas - Kupres that adds new C APIs Tcl_StackChannel, Tcl_UnstackChannel, and - Tcl_GetStackedChannel. - -1999-07-03 Brent Welch - - * generic/tclNotify.c: - * unix/tclUnixNotfy.c: - * unix/tclXtTest.c: - * unix/tclXtNotify.c: - * win/tclWinNotify.c: - * mac/tclMacNotify.c: Added Tcl_SetNotifier and the associated hook - points in the notifiers to be able to replace the notifier calls at - runtime. The Xt notifier and test program use this hook. - -1999-07-03 Brent Welch - - * generic/tclParse.c: Changed parsing of variable names to allow empty - array names. Now "$(foo)" is a variable reference! Previous you had to - use something like $::(foo), which is slower. This change is requested - by Jean-Luc Fontaine for his STOOOP package. - -1999-07-01 Scott Redman - - * generic/tclCmdAH.c: - * generic/tclFCmd.c: Call TclStat instead of TclpStat in order to - allow Tcl_Stat hooks to work properly. - -1999-06-29 Jennifer Hom - - * library/tcltest1.0/pkgIndex.tcl: - * library/tcltest1.0/tcltest.tcl: - * doc/tcltest.n: - * tests/all.tcl: Added -preservecore, -limitconstraints, -help, -file, - -notfile, -relateddir and -asidefromdir flags to the tcltest package - along with exported proc ::tcltest::getMatchingFiles. The - documentation was modified to match and all.tcl was modified to use - the new functionality instead of implementing -file itself. - -1999-06-28 Scott Redman - - * generic/tclIndexObj.c: - * doc/GetIndex.3: - * tests/binary.test: - * tests/winDde.test: Applied patch from Peter Hardie (with changes) to - fix problem with Tcl_GetIndexFromObj() when the key being passed is - the empty string. It used to match "" and return TCL_OK, but it should - have returned TCL_ERROR instead. Added test case to "binary" and "dde" - commands to check the behavior. Added documentation note as well. - -1999-06-26 Scott Redman - - * win/tclWinDde.c: Applied patch from Peter Hardie to add poke command - to dde. Also rev'd version of dde package to 1.1. [Bug 1738] - -1999-06-25 Jennifer Hom - - * unix/Makefile.in: - * win/Makefile.in: - * library/tcltest1.0/pkgIndex.tcl: - * library/tcltest1.0/tcltest.tcl: - * library/tcltest1.0: Added initial implementation of the Tcl test - harness package. This package was based on the defs.tcl file that was - part of the tests directory. Reversed the way that tests were - evaluated to fix a problem with false passes. - - * doc/tcltest.n: Added documentation for the tcltest package. - - * tests/README: - * tests/defs.tcl: - * tests/all.tcl: Modified all test files (tests/*.test) and all.tcl to - use the new tcltest package and removed references to the defs.tcl - file. Modified the README file to point to the man page for tcltest. - -1999-06-25 Scott Stanton - - * tests/reg.test: - * generic/regexec.c: Fixed bugs in non-greedy quantifiers. - -1999-06-23 Jerry Peek - - * doc/re_syntax.n: - * doc/switch.n: - * doc/lsearch.n: - * doc/RegExp.3: - * doc/regexp.n: - * doc/regsub.n: Moved information about syntax of 8.1 regular - expressions from regexp(n) manpage into new re_syntax(n) page. Added - pointers from other manpages to new re_syntax(n) page. - -1999-06-23 Scott Stanton - - * unix/Makefile.in: Changed install-doc to install-man. - - * tools/uniParse.tcl: - * tools/uniClass.tcl: - * tools/README: - * tests/string.test: - * generic/regc_locale.c: - * generic/tclUniData.c: - * generic/tclUtf.c: - * doc/string.n: Updated Unicode character tables to reflect latest - Unicode 2.1 data. Also rationalized "regexp" and "string is" - definitions of character classes. - -1999-06-21 Scott Stanton - - * unix/tclUnixThrd.c (TclpThreadCreate): Fixed memory leak where - thread attributes were not being released. [Bug 2254] - -1999-06-17 Scott Stanton - - * tests/regexp.test: - * generic/tclCmdMZ.c: - * generic/tclCmdIL.c: Changed to use new regexp interfaces. Added - -expanded, -line, -linestop, and -lineanchor switches to regsub. - - * doc/RegExp.3: Documented the new regexp interfaces and the - compile/execute flags. - - * generic/tclTest.c: - * generic/tclRegexp.h: - * generic/tclRegexp.c: - * generic/tcl.h: - * generic/tcl.decls: Renamed Tcl_RegExpMatchObj to Tcl_RegExpExecObj - and added a new Tcl_RegExpMatchObj that is equivalent to - Tcl_RegExpMatch. Added public macros for the regexp compile/execute - flags. Changed to store either an object pointer or a string pointer - in the TclRegexp structure. Changed to avoid adding a reference to the - object or copying the string. - - * generic/regcomp.c: lint - - * tests/reg.test: - * generic/regex.h: - * generic/regc_lex.c: Added REG_BOSONLY flag to allow Expect to - iterate through a string an only find matches that start at the - current position within the string. - -1999-06-16 Michael Thomas - - * unix/configure.in: - * unix/Makefile.in: - * unix/tcl.m4: - * unix/aclocal.m4: Numerous build changes to make Tcl conform to the - proposed TEA spec - -1999-06-16 Melissa Hirschl - - * generic/tclVar.c (Tcl_VariableObjCmd): fixed premature increment in - loop that was causing out-of-bounds reads on array "varName". - -1999-06-16 Scott Stanton - - * tests/execute.test: - * generic/tclExecute.c (TclExecuteByteCode): Fixed crash caused by a - bug in INST_LOAD_SCALAR1 where the scalar index was read as a signed 1 - byte value instead of unsigned. [Bug 2243] - -1999-06-14 Melissa Hirschl - - * doc/StringObj.3 - * test/stringObj.test - * unix/Makefile.in - * win/Makefile.in - * win/makefile.vc - * generic/tclStringObj.c: - Merged String and Unicode object types. Added new functions to the - puplic API: Tcl_NewUnicodeObj, Tcl_SetUnicodeObj, Tcl_GetUnicode, - Tcl_GetUniChar, Tcl_GetCharLength, Tcl_GetRange, - Tcl_AppendUnicodeToObj. - -1999-06-09 Scott Stanton - - * generic/tclUnicodeObj.c: Lots of cleanup and simplification. Fixed - several memory bugs. Added TclAppendUnicodeToObj. - - * generic/tclInt.h: Added declarations for various Unicode string - functions. - - * generic/tclRegexp.c: - * generic/tclCmdMZ.c: Changed to use new Unicode string interfaces for - better performance. - - * generic/tclRegexp.h: - * generic/tclRegexp.c: - * generic/tcl.h: - * generic/tcl.decls: Added Tcl_RegExpMatchObj and Tcl_RegExpGetInfo - calls to access lower level regexp API. These features are needed by - Expect. This is a preliminary implementation pending final review and - cleanup. - - * generic/tclCmdMZ.c: - * tests/string.test: Fixed bug where string map failed on null strings - - * generic/regexec.c: - * unix/tclUnixNotfy.c: lint - - * tools/genStubs.tcl: Changed to always write output in LF mode. - -1999-06-08 Scott Stanton - - * win/tclWinSock.c: Rolled back to the 8.1.0 implementation because of - serious problems with the new driver. Basically no incoming socket - connections would be reported to a server port. The 8.1.1 code needs - to be redesigned and fixed correctly. - -1999-06-07 Melissa Hirschl - - * tests/string.test: - * generic/tclVar.c (Tcl_SetVar2Ex): - * generic/tclStringObj.c (Tcl_AppendObjToObj): - * generic/tclCmdMZ.c (Tcl_StringObjCmd): optimized the string index, - string length, string range, and append command in cases where the - object's internal rep is a bytearray. Objects with other internal reps - are converted to have the new unicode internal rep. - - * unix/Makefile.in: - * win/Makefile.in: - * win/Makefile.vc: - * tests/unicode.test: - * generic/tclInt.h: - * generic/tclObj.c: - * generic/tclUnicodeObj.c: added a new object type to store the - unicode representation of a string. - - * generic/tclTestObj.c: added the objtype option to the testobj - command. This option returns the name of the type of internal rep an - object has. - -1999-06-04 Scott Stanton - - * win/configure.in: - * win/Makefile.in: Windows build now handles static/dynamic - debug/nodebug builds and supports the standard targets using Cygwin - user tools plus GNU make and autoconf. - -1999-06-03 Scott Stanton - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): - * tests/string.test: Fixed bug where string equal/compare -nocase - reported wrong result on null strings. [Bug 2138] - -1999-06-02 Scott Stanton - - * generic/tclUtf.c (Tcl_UtfNcasecmp): Fixed incorrect computation of - relative ordering. [Bug 2135] - -1999-06-01 Scott Stanton - - * unix/configure.in: Fixed various small configure.in patches - submitted by Jan Nijtmans. [Bug 2121] - - * tests/reg.test: - * generic/regc_color.c: - * generic/regc_cvec.c: - * generic/regc_lex.c: - * generic/regc_locale.c: - * generic/regc_nfa.c: - * generic/regcomp.c: - * generic/regcustom.h: - * generic/rege_dfa.c: - * generic/regerror.c: - * generic/regerrs.h: - * generic/regex.h: - * generic/regexec.c: - * generic/regfree.c: - * generic/regfronts.c: - * generic/regguts.h: - * generic/tclCmdMZ.c: - * generic/tclRegexp.c: - * generic/tclRegexp.h: - * generic/tclTest.c: Applied Henry Spencer's latest regexp patches - that fix an infinite loop bug and add support for testing whether a - string could match with additional input. [Bug 2117] - -1999-05-28 Scott Stanton - - * generic/tclObj.c: Changed to eliminate use of isupper/tolower in - favor of the Unicode versions. - - * win/Makefile.in: - * win/configure.in: Added preliminary TEA implementation. - - * win/tclWinDde.c: Fixed bug where dde calls were being passed an - invalid dde handle because Initialize had not been called. [Bug 2124] - -1999-05-26 Scott Redman - - * generic/tclThreadTest.c: Fixed race condition in testthread code - that showed up in the WinNT test suite intermittently. - - * win/tclWinSock.c: Fixed a hang in the WinNT socket driver, wake up - the socket thread every 100ms to check for events on the sockets that - did not wake up the thread (race condition). - -1999-05-24 Scott Stanton - - * tools/genStubs.tcl: Changed to allow a list of platforms instead of - just one at a time. - - * generic/tcl.decls: - * generic/tclCmdMZ.c: - * generic/tclDecls.h: - * generic/tclInt.decls: - * generic/tclIntDecls.h: - * generic/tclPort.h: - * generic/tclStubInit.c: - * generic/tclStubLib.c: Various header file related changes and other - lint to try to get the Mac builds working. - -1999-05-21 Scott Redman - - * win/tclWinPipe.c: Fix bug when launching command.com on Win95/98. - Need to wait for the procInfo.hProcess of the process that was - created, not the hProcess of the current process. [Bug 2105] - -1999-05-20 Scott Redman - - * library/init.tcl: Add the directory where the executable is, and the - ../lib directory relative to that, to the auto_path variable. - -1999-05-19 Scott Stanton - - Merged in various changes submitted by Jeff Hobbs: - - * generic/tcl.decls: - * generic/tclUtf.c: Added Tcl_UniCharIs* functions for control, graph, - print, and punct classes. - - * generic/tclUtil.c: - * doc/StrMatch.3: Added Tcl_StringCaseMatch() implementation to - support case-insensitive globbing. - - * doc/string.n: - * unix/mkLinks: - * tests/string.test: - * generic/tclCmdMZ.c: Added additional character class tests, added - -nocase switch to "string match", changed string first/last to use - offsets. - -1999-05-19 Scott Redman - - * generic/tcl.h: Add extern "C" block around entire header file for - C++ compilers to fix linkage issues. Submitted by Don Porter and Paul - Duffin. - - * generic/tclRegexp.c: Fix bug when the regexp cache is empty and an - empty pattern is used in regexp ( such as {} or "" ). - -1999-05-18 Scott Stanton - - * win/tclWinChan.c: Modified initialization code to avoid inherenting - closed or invalid channels. If the standard input is anything other - than a console, file, serial port, or pipe, then we fall back to the - standard Tk window console. - -1999-05-14 Scott Stanton - - * generic/tclCmdAH.c (Tcl_ForObjCmd): Fixed crash caused by failure to - reset the result before evaluating the test expression. - -1999-05-14 Bryan Surles - - * generic/tclBasic.c (Tcl_CreateInterp): Added introspection variable - for threaded interps. If the interp was compiled with threads enabled, - the tcl_platform(threaded) variable will exist. - -1999-05-14 Scott Redman - - * generic/tclDate.c: Applied patch to fix 100-year and 400-year - boundaries in leap year code, from Isaac Hollander. [Bug 2066] - -1999-05-13 Scott Stanton - - * unix/Makefile.in: - * unix/tclAppInit.c: Minor cleanup related to Xt notifier. - - * unix/tclUnixInit.c (TclpSetInitialEncodings): Tcl now looks for an - encoding subfield in the LANG/LC_ALL variables in cases where the - locale is not found in the locale table. Ensure that setlocale() is - called at least once so X11 will initialize properly. Also, forces the - LC_NUMERIC locale to be "C" so numeric processing in scripts is not - affected by the current locale setting. [Bug 1989] - - * generic/tclRegexp.c: Increased per-thread regexp cache to 30 slots. - This seems to be about the right number for larger applications like - exmh. [Bug 1063] - -1999-05-12 Scott Stanton - - * doc/tclsh.1: Updated references to rc script names to accurately - reflect the platform differences on Windows. - - * tests/regexp.test: - * generic/tclInt.h: - * generic/tclBasic.c: - * generic/tclRegexp.h: - * generic/tclRegexp.c: Replaced the per-interpreter regexp cache with - a per-thread cache. Changed the Regexp object to take advantage of - this extra cache. Added a reference count to the TclRegexp type so - regexps can be shared by multiple objects. Removed the per-interp - regexp cache from the interpreter. Now regexps can be used with no - need for an interpreter. [Bug 1063] - - * win/tclWinInit.c (TclpSetVariables): Avoid calling GetUserName if - the value can be determined from the USERNAME environment variable. - GetUserName is very slow. - -1999-05-07 Scott Stanton - - * win/winDumpExts.c: - * win/makefile.vc: Removed incorrect patch. [Bug 1998] - - * generic/tcl.decls: Replaced const with CONST. - - * generic/tclResult.c (Tcl_AppendResultVA): - * generic/tclStringObj.c (Tcl_AppendStringsToObjVA): Fixed to copy - arglist using memcpy instead of assignment so it works properly on - OS/390. [Bug 1997] - - * generic/tclLoadNone.c: Updated to use current interfaces, added - TclpUnloadFile. [Bug 2003] - - * win/winDumpExts.c: - * win/makefile.vc: Changed to emit library name in defs file. [Bug - 1998] - - * unix/configure.in: Added fix for OS/390. [Bug 1976] - -1999-05-06 Scott Stanton - - * tests/string.test: - * generic/tclCmdMZ.c: - * doc/string.n: Fixed bug in string equal/compare code when using - -length option. Cleaned up docs a bit more. - - * tests/http.test: Unset "data" array before running tests to avoid - failures due to previous tests. - - * doc/string.n: - * tests/cmdIL.test: - * tests/cmdMZ.test: - * tests/error.test: - * tests/ioCmd.test: - * tests/lindex.test: - * tests/linsert.test: - * tests/lrange.test: - * tests/lreplace.test: - * tests/string.test: - * tests/cmdIL.test: - * generic/tclUtil.c: - * generic/tclCmdMZ.c: Replaced "string icompare/iequal" with -nocase - and -length switches to "string compare/equal". Added a -nocase option - to "string map". Changed index syntax to allow integer or - end?-integer? instead of a full expression. This is much simpler with - safeTcl scripts since it avoids double substitution issues. - - * doc/Utf.3: - * generic/tclStubInit.c: - * generic/tclDecls.h: - * generic/tclUtf.c: - * generic/tcl.decls: Added Tcl_UtfNcmp and Tcl_UtfNcasecmp. - -1999-05-05 Scott Stanton - - * win/makefile.vc: Added encoding directory to install-libraries - target. - -1999-05-03 Scott Stanton - - * doc/string.n: - * tests/cmdMZ.test: - * tests/string.test: - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Changed "string length" to - avoid regenerating the string rep of a ByteArray object. - - * tests/cmdIL.test: - * tests/cmdMZ.test: - * tests/error.test: - * tests/lindex.test: - * tests/linsert.test: - * tests/lrange.test: - * tests/lreplace.test: - * tests/string.test: - * generic/tclCmdMZ.c (Tcl_StringObjCmd): - * generic/tclUtil.c (TclGetIntForIndex): Applied Jeff Hobbs's string - patch which includes the following changes [Bug 1845]: - - string compare now takes optional length arg (for strncmp behavior) - - added string equal (just a few lines of code blended in with string - compare) - - added string icompare/iequal for case-insensitive comparisons - - string index's index can now be ?end[+-]?expression - I made this change in the private TclGetIntForIndex, which means - that the list commands also benefit, as well as string range, et al. - - added [string repeat string count] - Repeats given string number of times - - added string replace, string equiv to lreplace - (quasi opposite of string range): - string replace first last ?string? - Example of use, replacing end of string with ... should the string - be more than 16 chars long: - string replace $string 16 end "..." - This just returns the string len < 16, so it will only affect the - long strings. - - added optional first and last args to string to* - This allows you to just affect certain regions of a string with the - command (like just capping the first letter). I found the original - totitle to be too draconian to be useful. - - added [string map charMap string] - where charMap is a {from to from to} list that equates to what one - might get from [array get]. Each and can be multiple chars (or none - at all). For Tcl/CGI users, this is a MAJOR speed booster. - - * generic/tclParse.c (Tcl_ParseCommand): Changed to avoid modifying - eval'ed strings that are already null terminated. [Bug 1793] - - * tests/binary.test: - * generic/tclBinary.c (DupByteArrayInternalRep): Fixed bug where type - was not being set in duplicated object. [Bug 1975, 2047] - -1999-04-30 Scott Stanton - - * Changed version to 8.1.1. - -1999-04-30 Scott Stanton - - * Merged changes from 8.1.0 branch: - - * generic/tclParse.c: Fixed memory leak in CommandComplete. - - * generic/tclPlatDecls.h: - * generic/tclIntPlatDecls.h: - * generic/tclIntDecls.h: - * generic/tclDecls.h: - * tools/genStubs.tcl: Added 'extern "C" {}' block around the stub - table pointer declaration so the stub library can be used from C++. - [Bug 1934] - - * Lots of documentation and other release engineering fixes. - -1999-04-28 Scott Stanton - - * mac/tclMacResource.c: - * generic/tclListObj.c: - * generic/tclObj.c: - * generic/tclStringObj.c: Changed to avoid freeing the string - representation before freeing the internal rep. This helps with - debugging since the string rep will still be valid when the free proc - is invoked. - -1999-04-27 Scott Stanton - - * generic/tclLiteral.c (TclHideLiteral): Fixed so hidden literals get - duplicated to avoid accidental sharing in the global object table. - -1999-04-23 Scott Stanton - - * generic/tclStubInit.c: - * tools/genStubs.tcl: Changed to avoid the need for forward - declarations in stub initializers. - -1999-04-23 Scott Stanton - - * library/encoding/koi8-r.enc: - * tools/encoding/koi8-r.txt: Added support for the koi8-r Cyrillic - encoding. [Bug 1771] - -1999-04-22 Scott Stanton - - * win/tclWinFCmd.c: - * win/tclWin32Dll.c: Changed uses of "try" to "__try", since that is - the actual keyword. This eliminates the need for some -D flags from - the makefile. - - * generic/tclPort.h: Added include of tcl.h since it defines various - Windows macros that are needed before deciding which platform porting - file to use. - - * generic/tclEvent.c: lint - - * win/tclWinInit.c (TclpInitPlatform): Added call to TclWinInit when - building a static library since DllMain will not be invoked. This - could break old code that explicitly called TclWinInit, but should be - simpler in the long run. - -1999-04-22 Scott Stanton - - * generic/tclInt.h: - * generic/tclInt.decls: - * generic/tclCompile.c: Added TclSetByteCodeFromAny that takes a hook - procedure to invoke after compilation but before the byte codes are - emitted. This makes it possible to do postprocessing on the compiled - byte codes before the ByteCode is generated. - - * generic/tclLiteral.c: Added TclHideLiteral and TclAddLiteralObj to - make it possible to create local unshared literal objects. - - * win/tclWinInit.c: - * unix/tclUnixInit.c: Changed initial search path to match that - found used by tcl_findLibrary. - -1999-04-22 Scott Redman - - * win/tclWinPort.h: - * win/tclWinSock.c: Added code to use WinSock 2.0 API on NT to avoid - creating a window to handle sockets. API not available on Win95 and - needs to be fixed on Win98, until then continue to use the older - (window-based) scheme on those two OSes. - -1999-04-15 Scott Stanton - - * Merged 8.1 back into the main trunk - -1999-04-13 Scott Stanton - - * library/encoding/gb2312.enc: - * library/encoding/euc-cn.enc: - * tools/encoding/gb2312.txt: - * tools/encoding/cp950.txt: - * tools/encoding/Makefile: Restored the double byte definition of - GB2312 and added the EUC-CN encoding. EUC-CN is a variant of GB2312 - that shifts the characters into bytes with the high bit set and - includes ASCII as a subset. [Bug 632] - -1999-04-13 Scott Redman - - * win/tclWinSock.c: Apply patch to allow write access to a socket if - FD_WRITE is sent but FD_CONNECT is not. Some strange problem with - either Win32 or a socket driver. [Bug 1664 1776] - -1999-04-09 Scott Redman - - * unix/tclUnixNotfy.c: Fixed notifier deadlock situation when the pipe - used to talk back notifier thread is filled with data. When calling - the write() function to feed data down that pipe, unlock the - notifierMutex to allow the notifier to wake up again. Found as a - result of the focus.test for Tk hanging. [Bug 1700] - -1999-04-06 Scott Stanton - - * tests/unixNotfy.test: Fixed hang in tests when built with thread - support. - - * tests/httpold.test: Fixed broken test that didn't wait long enough - for events to arrive. - - * tests/unixInit.test: Fixed race condition in test. - - * tests/unixInit.test: - * tests/fileName.test: Minor test nits. - - * unix/tclUnixInit.c (TclpSetInitialEncodings): Fixed bad initial - encoding string. - -1999-04-06 Bryan Surles - - * generic/tclVar.c: - * generic/tclEnv.c: Moved the "array set" C level code into a common - routine (TclArraySet). The TclSetupEnv routine now uses this API to - create an env array w/ no elements. - - * generic/tclEnv.c: - * generic/tclWinInit.h: - * generic/tclUnixInit.h: - * generic/tclInt.h: Made the Env module I18N compliant. Changed the - FindVariable routine to TclpFindVariable, that now does a case - insensitive string comparison on Windows, and not on UNIX. [Bug 1299, - 1500] - -1999-04-05 Scott Stanton - - * tests/io.test: Minor test cleanup. - - * generic/tclEncoding.c (Tcl_CreateEncoding): Minor lint to make it - easier to compile on Digital-unix. [Bug 1659] - - * unix/configure.in: - * unix/tclUnixPort.h: Applied patch for OS/390 to handle lack of - sys/param.h. [Bug 1725] - - * unix/configure.in: Fixed BSD/OS 4.* configuration to support shared - libraries properly. [Bug 1730] - -1999-04-05 Scott Redman - - * win/tclWinDde.c: decrease timeout value for DDE calls to 30k. [Bug - 1639] - - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclDecls.h: - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - * generic/tclUtil.c: Added more functions to the Tcl stubs table, - including all Tcl_ functions not already in it (except Cmd functions) - and Tcl_GetCwd() and Tcl_Chdir() (new functions). - - * tests/safe.test: - * doc/safe.n: - * generic/tclBasic.c: - * library/safe.tcl: The encoding command is not safe as-is, so create - a safe alias to mask out the "encoding system " but allow all - other uses including "encoding system". Added test cases and updated - the man page for Safe Tcl. - -1999-04-05 Scott Stanton - - * tests/winTime.test: - * win/tclWinTime.c: Fixed crash in clock command that occurred when - manipulating negative time values in timezones east of GMT. [Bug - 1142, 1458] - - * tests/platform.test: - * tests/fileName.test: Fixed broken tests. - - * generic/tclFileName.c: Moved global regexps into thread local - storage. - - * tests/socket.test: Changed so tests don't reuse sockets, since - Windows is slow to release sockets. - - * win/tclWinConsole.c: - * win/tclWinPipe.c: - * win/tclWinSerial.c: Fixed race condition where background threads - were terminated while they still held a lock in the notifier. - -1999-04-02 Scott Stanton - - * tests/http.test: Fixed bad test initialization code. - - * generic/tclThreadTest.c (ThreadExitProc): Fixed bug where static - memory was being returned instead of a dynamically allocated result in - error cases. - -1999-04-02 Scott Redman - - * doc/dde.n: - * tools/tcl.wse.in: - * win/makefile.vc: - * win/pkgIndex.tcl: - * win/tclWinDde.c: Add new DDE package, code removed from Tk now - separated into its own package. Changed DDE-based send code into "dde - eval" command. Can be loaded into tclsh (not just wish). Windows only. - -1999-04-02 Scott Stanton - - * tests/expr.test: - * tests/for-old.test: - * tests/for.test: - * tests/foreach.test: - * tests/format.test: - * tests/httpold.test: - * tests/if.test: - * tests/init.test: - * tests/interp.test: - * tests/while.test: Added some tests for known bugs (marked with - knownBug constraint), and cleaned up a few bad tests. - - * generic/regc_locale.c: - * generic/regcustom.h: - * generic/tcl.decls: - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclInt.h: - * generic/tclRegexp.c: - * generic/tclScan.c: - * generic/tclTest.c: - * generic/tclUtf.c: - * win/tclWinFCmd.c: - * win/tclWinFile.c: Made various Unicode utility functions public. The - following functions were made public and added to the stubs table: - Tcl_UtfToUniCharDString, Tcl_UniCharToUtfDString, - Tcl_UniCharLen, Tcl_UniCharNcmp, Tcl_UniCharIsAlnum, - Tcl_UniCharIsAlpha, Tcl_UniCharIsDigit, Tcl_UniCharIsLower, - Tcl_UniCharIsSpace, Tcl_UniCharIsUpper, Tcl_UniCharIsWordChar - -1999-04-01 Scott Stanton - - * tests/registry.test: - * win/tclWinReg.c: Internationalized the registry code. It now uses - Unicode interfaces on NT. [Bug 1197] - - * tests/parse.test: - * generic/tclParse.c: Fixed crash due to multiple frees in parser - during error cleanup when parsing commands with more tokens than will - fit in the static area of the parse structure. [Bug 1681] - - * generic/tclInt.h: Removed duplicate declarations. - - * generic/tclInt.decls: - * generic/tcl.decls: Added Tcl_WinUtfToTChar and Tcl_WinTCharToUtf to - the tclPlat table. - -1999-04-01 Scott Redman - - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclBasic.c: - * generic/tclDecls.h: - * generic/StubInit.c: - * tools/genStubs.tcl: - * unix/Makefile.in: - * win/makefile.vc: Applied patch from Jan Nijtmans to fix Ultrix - multiple symbol definition problem. Now, even Tcl includes a copy of - the Tcl stub library. Also fixed TCL_MEM_DEBUG mode (for Tk). - -1999-03-31 Scott Redman - - * win/tclWinConsole.c: WinNT has a bug when reading a single character - from the console. Rewrote the code for the console to read an entire - line at a time using the reader thread. - -1999-03-30 Scott Stanton - - * unix/Makefile.in: Removed trailing backslash that broke the "depend" - target. - - * unix/tclUnixInit.c (TclpSetInitialEncodings): Changed to avoid - calling setlocale(). We now look directly at env(LANG) and - env(LC_CTYPE) instead. [Bug 1636] - - * generic/tclFileName.c: - * generic/tclDecls.h: - * generic/tcl.decls: Removed CONST from Tcl_JoinPath and - Tcl_TranslateFileName because it changes the signature of Tcl_JoinPath - in an incompatible manner. - - * generic/tclInt.h: - * generic/tclLoad.c (TclFinalizeLoad): - * generic/tclEvent.c (Tcl_Finalize): Defer unloading of loadable - modules until all exit handlers have been invoked. [Bug 998, 1273, - 1573, 1593] - -1999-03-29 Scott Stanton - - * generic/tclFileName.c: - * generic/tclDecls.h: - * generic/tcl.decls: Added CONST to Tcl_JoinPath and - Tcl_TranslateFileName. - -1999-03-29 Scott Redman - - * tools/genStubs.tcl: - * unix/configure.in: - * unix/Makefile.in: - * win/makefile.vc: - * generic/tcl.h: - * generic/tclBasic.c: - * generic/tclDecls.h: - * generic/tclIntDecls.h: - * generic/tclPlatDecls.h: - * generic/tclIntPlatDecls.h: Removed the stub functions and changed - the stub macros to just use the name without params. Pass &tclStubs - into the interp (don't use tclStubsPtr because of collisions with the - stubs on Solaris). - -1999-03-27 Scott Redman - - * win/makefile.bc: Removed makefile for Borland compiler, no longer - supported. - -1999-03-26 Scott Redman - - * win/tclWinSerial.c: - * win/tclWinConsole.c: - * win/tclWinPipe.c: Don't close the Win32 handle for a channel if it's - a stdio handle (GetStdHandle()) during shutdown of a thread to prevent - it from destroying the stdio of other threads. - -1999-03-26 Suresh Ankolekar - - * unix/configure.in: --nameble-shared is now the default and build Tcl - as a shared library; specify --disable-shared to build a static Tcl - library and shell. - -1999-03-25 Scott Stanton - - * tests/interp.test: - * generic/tclInterp.c (AliasObjCmd): Changed so aliases are invoked at - current scope in the target interpreter instead of at the global - scope. This was an incompatibility introduced in 8.1 that is being - removed. [Bug 1153, 1556] - - * library/encoding/big5.enc: - * library/encoding/gb2312.enc: - * tools/encoding/big5.enc: - * tools/encoding/gb2312.enc: Added ASCII to big5 and gb2312 encodings. - [Bug 632] - - * generic/tclPkg.c (Tcl_PkgRequireEx): Fixed broken clientData - initialization in package code. - - * unix/Makefile.in (dist): Added tcl.decls and tclInt.decls to source - distribution. [Bug 1571] - - * doc/Thread.3: Updated documentation of Tcl_MutexLock to indicate - that the recursive locking behavior is undefined. On Windows, it does - not block, on Unix it deadlocks. [Bug 1275] - -1999-03-24 Scott Stanton - - * tests/execute.test: - * generic/tclExecute.c (TclExecuteByteCode): Fixed expression code - that incorrectly returned floating point values for integers if the - internal rep happened to be a double. Now we check to see if the - object has a string rep that looks like an integer before using the - double internal rep. [Bug 1516] - -1999-03-24 Scott Redman - - * generic/tclAlloc.c: - * generic/tclEncoding.c: - * generic/tclProc.c: - * unix/tclUnixTime.c: - * win/tclWinSerial.c: Fixed compilation warnings/errors for VC++ 5.0 - and 6.0 and HP-UX native compiler without -Aa or -Ae. [Bug 1323 1518 - 1324 1583 1585 1586] - - * win/tclWinSock.c: Make sockets thread-safe on Windows. The current - implementation uses windows to handle events on the socket, one for - each thread (thread local storage). Previously, there was only one - window shared between threads, which didn't work. [Bug 1326] - -1999-03-23 Scott Stanton - - * tools/tcl.wse: Fixed file association to look in the right place for - the wish icon. [Bug 1544] - - * tests/winNotify.test: - * tests/ioCmd.test: - * tests/event.test: Changed to use new style conditionals. - - * tests/encoding.test: Fixed nonportable test. - - * unix/dltest/configure.in: - * unix/dltest/Makefile.in: Added missing DBGX macros. [Bug 1564] - - * tests/winNotify.test: - * mac/tclMacNotify.c: - * win/tclWinNotify.c: - * unix/tclUnixNotfy.c: - * generic/tclNotify.c: Added a new Tcl_ServiceModeHook interface that - is invoked whenever the service mode changes. This is needed to allow - the Windows notifier to create a communication window the first time - Tcl is about to enter an external modal event loop instead of at - startup time. This will avoid the various problems that people have - been seeing where the system hangs when tclsh is running outside of - the event loop. [Bug 783] - - * generic/tclInt.h: - * generic/tcl.decls: Renamed TclpAlertNotifier back to - Tcl_AlertNotifier since it is part of the public notifier driver API. - -1999-03-23 Scott Redman - - * win/tclWinSerial.c: Fixed problem with fileevent on the serial port - and nonblocking mode. Gets no longer hangs, fileevents fire whenever - there is any character data on the port. - - * tests/winConsole.test: - * win/tclWinConsole.c: Fixed problem with fileevents and gets from a - console stdin. Previously, fileevents were firing before an entire - line was available for reading, which meant that when you did a gets - or read, it blocked (even in nonblocking mode). Now, it should work - the same as Unix: fileevents fire when an entire line is ready, and - gets and read do not block in non-blocking mode. Added an interactive - test case to check for this. - -1999-03-22 Scott Stanton - - * tests/reg.test: - * generic/regc_color.c: Applied regexp bug fix from Henry Spencer. - -1999-03-19 Scott Redman - - * generic/tclCmdIL.c: Fixed the initialization of an array so that the - Sun 5.0 C compiler wouldn't complain. - - * unix/configure.in: Added support for --enable-64bit. For now, this - is only supported on Solaris 7 64bit (SunOS 5.7) using the Sun - compiler (not gcc). - -1999-03-18 Scott Stanton - - * win/tclWinChan.c (TclpOpenFileChannel, Tcl_MakeFileChannel): Changed - to only test for console or comm handles when the type is - FILE_TYPE_CHAR to avoid useless tests on simple files. Also reordered - tests so consoles are tested first as this is more common. - - * win/makefile.vc: Regularized usage of mkd and rmd and rm. - - * library/encoding/shiftjis.enc: - * tools/encoding/shiftjis.txt: Missing/incorrect characters in - shift-jis table. [Bug 1008, 1526] - - * generic/tclInt.decls: - * generic/tcl.decls: Eliminated use of "string" and "list" from - argument lists to avoid conflicts with C++ STL. [Bug 1181] - - * win/tclWinFile.c (TclpMatchFiles): Changed to ignore the - FS_CASE_IS_PRESERVED bit and always return exactly what we get from - the system. - -1999-03-17 Scott Stanton - - * win/README.binary: - * win/README: - * unix/configure.in: - * generic/tcl.h: - * README: Updated version to 8.1b3. - -1999-03-14 Scott Stanton - - * win/tclWinConsole.c: - * win/tclWinPipe.c: - * win/tclWinSerial.c: Changed so channel drivers wait for the - reader/writer threads to exit before returning during a close - operation. This ensures that the main thread is the last thread to - exit, so the process return value is set properly. - - * generic/tclIntDecls.h: - * generic/tclIntPlatDecls.h: - * generic/tclIntPlatStubs.c: - * generic/tclIntStubs.c: - * generic/tclPlatDecls.h: - * generic/tclPlatStubs.c: - * generic/tclStubInit.c: - * generic/tclStubs.c: Fixed bad eol characters. - - * generic/tclInt.decls: Changed "const" to "CONST" in declarations for - better portability. - - * generic/tcl.decls: Renamed panic and panicVA to Tcl_Panic and - Tcl_PanicVA in the stub files. - - * generic/tclInterp.c (Tcl_MakeSafe): Remove tcl_platform(user) from - safe interps. - -1999-03-11 Scott Stanton - - * unix/Makefile.in: - * unix/configure.in: Include compat files in the stub library in - addition to the main library. Compat files are now built for dynamic - use in all cases. - - * generic/tcl.h: Changed magic number so it doesn't match the plus - patch, at Jan's request. - - * unix/tclConfig.sh.in: - * unix/dltest/Makefile.in: - * unix/dltest/configure.in: - * unix/dltest/pkga.c: - * unix/dltest/pkgb.c: - * unix/dltest/pkgc.c: - * unix/dltest/pkgd.c: - * unix/dltest/pkge.c: - * unix/dltest/pkgf.c: Changed package tests to build against the stubs - library. - -1999-03-10 Scott Stanton - - * generic/tcl.h: - * generic/tcl.decls: Changed Tcl_ReleaseType from an enum to macros so - it can be used in .rc files. Added Tcl_GetString. - - * mac/tclMacNotify.c: - * generic/tclNotify.c: - * generic/tclInt.h: - * win/tclWinNotify.c: - * generic/tcl.h: Renamed Tcl_AlertNotifier to TclpAlertNotifier. - - * generic/tclInt.decls: Added TclWinAddProcess to make it possible for - expect to use Tcl_WaitForPid(). This patch is from Gordon Chaffee. - - * mac/tclMacPort.h: - * win/tclWinInit.c: - * unix/tclUnixPort.h: - * generic/tclAsync.c: Added TclpAsyncMark to fix bug in async handling - on Windows where async events don't wake up the event loop. This patch - comes from Gordon Chaffee. - - * generic/tcl.decls: Fixed declarations of reserved slots. - -1999-03-10 Scott Redman - - * generic/tclCompile.h: Ensure that the ByteCode struct is binary - compatible with the version in 8.0.6. - - * generic/tcl.h: - * generic/tclBasic.c: Add Tcl_GetVersion() function to the public C - API to allow programs to check the version number of the Tcl library - at runtime. Also added an enum to clarify the release level (alpha, - beta, final). - -1999-03-09 Scott Stanton - - * Integrated changes from Tcl 8.0 including: - stubs mechanism - configure patches from Jan Nijtmans - rename of panic to Tcl_Panic - -1999-03-08 Lee Bernhard - - * win/tclWin32Dll.c: Removed Dll instance from thread-local storage. - -1999-03-08 Scott Stanton - - * generic/tcl.h: Moved Tcl_Mutex, etc. macros above the inclusion of - tclDecls.h to avoid macro conflicts. - - * generic/tclInt.h: - * generic/regc_color.c: - * generic/regcomp.c: - * generic/tclCmdIL.c: - * generic/tclCmdAH.c: - * generic/tclIOCmd.c: - * generic/tclParse.c: - * generic/tclStringObj.c: - * unix/tclUnixNotfy.c: Cleaned up various compiler warnings, - eliminated UCHAR bugs. - - * unix/tclUnixNotfy.c: - * unix/tclUnixThrd.c: - * generic/tclThreadTest.c: - * mac/tclMacThrd.c: Changed TclpCondition*() to Tcl_Condition*(). - - * INTEGRATED PATCHES FROM 8.0.6: - - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclBasic.c: - * generic/tclDecls.h: - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclIntPlatDecls.h: - * generic/tclIntPlatStubs.c: - * generic/tclIntStubs.c: - * generic/tclPlatDecls.h: - * generic/tclPlatStubs.c: - * generic/tclStubInit.c: - * generic/tclStubLib.c: - * generic/tclStubs.c: - * tools/genStubs.tcl: - * unix/configure.in: - * unix/Makefile.in: - * unix/tclConfig.sh.in: - * win/makefile.vc: - * win/tclWinPort.h: Added Tcl stubs implementation. There are now two - new macros USE_TCL_STUBS and USE_TCL_STUB_PROCS that enable use of - stubs and disable stub macros respectively. All of the public and - private function declarations from tcl.h and tclInt.h have moved into - the *.decls files and the *Stubs.c and *Decls.h files are generated - using the genStubs.tcl script. - - * unix/Makefile.in: - * unix/configure.in: - * unix/ldAix: Enhanced AIX shared library support. - - * win/tclWinSock.c: Removed a bunch of extraneous PASCAL FAR - attributes from internal functions. - - * win/tclWinReg.c: Changed registry package to use stubs mechanism so - it no longer depends on the specific version of Tcl. - - * doc/AddErrInfo.3: - * doc/Eval.3: - * doc/PkgRequire.3: - * doc/SetResult.3: - * doc/StringObj.3: - * generic/tcl.h: - * generic/tclBasic.c: - * generic/tclPanic.c: - * generic/tclStringObj.c: - * generic/tclUtil.c: - * unix/mkLinks: Added va_list versions of all VARARGS functions so - they can be invoked from the stub functions. - - * doc/package.n: - * doc/PkgRequire.3: - * generic/tclPkg.c: Added Tcl_PkgProvideEx, Tcl_RequireEx, - Tcl_PresentEx, and Tcl_PkgPresent. Added "package present" command. - - * generic/tclFileName.c: - * mac/tclMacFile.c: - * mac/tclMacShLib.exp: - * unix/tclUnixFile.c: - * win/tclWinFile.c: Changed so TclGetUserHome is defined on all - platforms, even though it is currently a noop on mac and windows, and - renamed it to TclpGetUserHome. - - * generic/tclPanic.c: - * generic/panic.c: Renamed panic to Tcl_Panic. - -1999-02-25 Scott Redman - - * win/makefile.vc: Added tclWinConsole.c and tclWinSerial.c - - * win/tclWinConsole.c: New code to properly deal with fileevents and - nonblocking mode on consoles. - - * win/tclWinSerial.c: New code to properly deal with fileevents and - nonblocking mode on serial ports. - - * win/tclWinPipe.c: - * win/tclWinPort.h: Exported functions to allow creation of pipe - channels from tclWinChan.c - - * win/tclWinChan.c: Check the type of a channel, including for the - standard (stdin/stdout/stderr), and use the correct channel type to - create the channel (file, serial, console, or pipe). - -1999-02-11 Scott Stanton - - * README: - * generic/tcl.h: - * win/README.binary: - * win/README: - * unix/configure.in: - * mac/README: Updated version numbers to 8.1b2. - -1999-02-10 Scott Stanton - - * library/auto.tcl: Fixed auto_mkindex so it handles .tbc files. Did - some general cleanup to handle bad eval statements that didn't use - "list". - - * unix/mkLinks: - * doc/SetVar.3: - * generic/tcl.h: - * generic/tclVar.c: Restored Tcl_ObjGetVar2 and Tcl_ObjSetVar2 from - 8.0. Renamed Tcl_Get/SetObjVar2 to Tcl_GetVar2Ex and Tcl_SetVar2Ex. - -1999-02-10 Scott Stanton - - INTEGRATED PATCHES FROM 8.0.5b2: - - * test/winPipe.test: Changed to remove echoArgs.tcl temporary file - when done. - - * tests/cmdAH.test: - * generic/tclFileName.c (TclGetExtension): Changed behavior so the - split happens at the last period in the name instead of the first - period of the last run of periods. So, "foo..o" is split into "foo." - and ".o" now. [Bug 1126] - - * win/makefile.vc: Added better support for paths with spaces in the - name. Added .lib and support .dlls to the install-binaries target. - Added generate of a pkgIndex.tcl script to the install-libraries - target. - - * win/tclAppInit.c: - * unix/tclAppInit.c: - * mac/tclMacAppInit.c: - * generic/tclTest.c: Changed some EXTERN declarations to extern since - they are not defining exported interfaces. This avoids generating - useless declspec() attributes and makes the windows makefile simpler. - - * generic/tcl.h: Moved Tcl_AppInit declaration to end and cleared out - TCL_STORAGE_CLASS so it is not declared with a declspec(). - - * tests/interp.test: - * generic/tclInterp.c (DeleteAlias): Changed to use - Tcl_DeleteCommandFromToken so we handle renames properly. This avoids - senseless panic. [Bug 736] - - * unix/tclUnixChan.c: - * win/tclWinSock.c: - * doc/socket.n: Applied Gordon Chaffee's patch to handle failures - during asynchronous socket connection operations. This adds a new - "-error" fconfgure option to socket channels. [Bug 893] - - * generic/tclProc.c: - * generic/tclNamesp.c: - * generic/tclInt.h: - * generic/tclCmdIL.c: - * generic/tclBasic.c: - * generic/tclVar.c: Applied patch from Viktor Dukhovni to rationalize - TCL_LEAVE_ERR_MSG behavior when creating variables. - - * generic/tclVar.c: Fixed bug in namespace tail computation. Fixed bug - where upvar could resurrect a namespace variable whose namespace had - been deleted. - - * generic/tclCompile.c (TclCompileExprCmd): Eliminated yet another - bogus optimization in expression compilation. - - * unix/configure.in: Added branch for BSD/OS-4* to shared library case - statement. [Bug 975] - Fixed to correctly handle IRIX 6.5 n32 library support. [Bug 1117] - - * win/winDumpExts.c: Patched to be pickier about stripping @'s. [Bug - 920] - - * library/http2.0/http.tcl: Added catch around eof test in CopyDone - since the user may have already called http::reset. [Bug 1108] - - * unix/configure.in: Changed Linux and IRIX to set SHLIB_LIBS to LIBS - so shared libraries are linked with the system libraries. [Bug 1018] - - * generic/tclCompile.c (CompileExprWord): Fixed exception stack - overflow bug caused by missing statement. [Bug 928] - - * generic/tclIOCmd.c: - * generic/tclBasic.c: Objectified the "open" command. [Bug 1113] - - * generic/tclPosixStr.c (Tcl_ErrnoId, Tcl_ErrnoMsg): When using egcs, - ENOTSUP and EOPNOTSUPP are the same, so now we handle that case. [Bug - 1137] - - * library/init.tcl: Various small changes requested by Jan Nijtmans. - - If the variable $tcl_library contains the empty string, this empty - string will be put in $auto_path. This is not useful at all, it only - slows down later package processing. - - If the variable tcl_pkgPath is not set, the "unset __dir" fails. - Thich makes init.tcl totally unusable. Better put a "catch" around - it. - - In the function tcl_findLibraries, the "string match" function only - works correctly if $tcl_patchLevel is in one of the forms "?.?a?", - "?.?b?" or "?.?.?". Could a "regexp" be used instead, then it allows - anything to be appended to the patchLevel string. And it is more - efficient. - - The tclPkgSetup function assumes that if $type != "load" then the - type must be "source". This needn't be true. Some users want to add - their own setup types. - [RFE 1138] [Bug 978] - - * win/tclWinReg.c: - * doc/registry.n: Added support for HKEY_PERFORMANCE_DATA and - HKEY_DYN_DATA keys. [Bug 1109] - - * win/tclWinInit.c (TclPlatformInit): Added code to ensure tcl_pkgPath - is set to "" when no registry entry is found. [Bug 978] - -1999-02-01 Scott Stanton - - * generic/tclBasic.c: - * generic/tclCmdAH.c: - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclExecute.c: - * generic/tclHistory.c: - * generic/tclIO.c: - * generic/tclIOUtil.c: - * generic/tclInterp.c: - * generic/tclMain.c: - * generic/tclNamesp.c: - * generic/tclParse.c: - * generic/tclProc.c: - * generic/tclTest.c: - * generic/tclTimer.c: - * generic/tcl.h: Made eval interfaces compatible with 8.0 by renaming - Tcl_EvalObj to Tcl_EvalObjEx, renaming Tcl_Eval2 to Tcl_EvalEx and - restoring Tcl_EvalObj and Tcl_GlobalEvalObj interfaces so they match - Tcl 8.0. - -1999-01-28 Scott Stanton - - * Merged Tcl 8.0.5b1 changes. - - * generic/tclUtil.c (Tcl_DStringSetLength): Changed so the buffer - overallocates in a manner similar to Tcl_DStringAppend. This should - improve performance for TclUniCharToUtfDString. - -1998-12-11 === Tcl 8.1b1 Release === - -1998-12-10 Scott Stanton - - * Fixed lots of files that used TCL_THREAD instead of TCL_THREADS. - - * generic/tclEncoding.c (Tcl_FreeEncoding): Moved most of the code - into a static FreeEncoding routine that does not grab the - encodingMutex to avoid deadlocks/races when called from other routines - that already have the mutex. - -1998-12-09 Scott Stanton - - * library/msgcat1.0/msgcat.tcl: Fixed bad export list, fixed so all - locale strings are converted to lower case, including file names. - - * generic/regcomp.c (makescan): Fixed bug in longest match case that - caused anchored patterns to fail. [Bug 897] - -1998-12-08 Scott Stanton - - * library/msgcat1.0/msgcat.tcl: changed mc to invoke mcunknown in the - calling context, changed locale lookups to be case insensitive - -1998-12-07 Scott Stanton - - * generic/tclAlloc.c (TclpRealloc): Fixed a memory allocation bug - where big blocks that were reallocated into a different heap location - were not being placed into the bigBlocks list. [Bug 933] - - * tests/msgcat.test: Added message catalog test suite. - - * library/msgcat1.0/msgcat.tcl: minor bug fixes, integrated latest - changes from Mark Harrison. - -1998-12-04 Scott Stanton - - * library/msgcat1.0/msgcat.tcl: Changed code to conform to Tcl coding - standards. Changed to use file join for portability. - - * library/msgcat1.0: Added initial implementaion of Tcl message - catalog package contributed by Mark Harrison. - -1998-12-03 Scott Stanton - - * win/tclWinPipe.c (BuildCommandLine): Fixed bug that kept arguments - containing spaces from being properly quoted. - - * tests/defs: Changed so auto_path is set to only contain the Tcl - library directory. This keeps the tests from accidentally picking up - stuff in installed packages. - - * generic/tclUtil.c (Tcl_StringMatch): Changed to match 8.0 behavior - in corner case where there is no closing bracket. - -1998-12-02 Scott Stanton - - * win/tclWinPipe.c (TclpCreateCommandChannel): Changed reader/writer - threads to have THREAD_PRIORITY_HIGHEST so they will have a chance to - run whenever there is something to do. - - * generic/tclIO.c (WriteBytes, WriteChars): Fixed so extraneous - flushes do not happen in line mode. - (TranslateOutputEOL): Made translation more efficient in line mode and - fixed a buffer overflow bug in CRLF translation. [Bug 887] - -1998-12-02 Brent Welch - - * Updated patchlevel to 8.1b1 - -1998-12-02 Scott Stanton - - * generic/regc_color.c (subcolor): Added check for error case to avoid - an out of bounds array reference. - - * generic/tclCmdAH.c (Tcl_EncodingObjCmd): Changed to avoid using - Tcl_DStringResult because it is not binary clean. - - * generic/tclParse.c (Tcl_ParseCommand): Fixed bug in comment parsing - where a trailing comment looked like an incomplete command. - -1998-12-02 Brent Welch - - * Merged changes from 8.0.4, especially the new pkg_mkIndex - -1998-12-01 Scott Stanton - - * generic/tclIO.c (Tcl_ReadChars): Added a call to UpdateInterest so - we don't block when there is data sitting in the buffers. - - * generic/tclTest.c (TestevalobjvObjCmd): Updated for EvalObjv change. - - * tests/parse.test: Updated tests for EvalObjv change. - - * generic/tclParse.c (EvalObjv, Tcl_EvalObjv): Changed Tcl_EvalObjv - interface to remove string and length arguments, preserved original - interface as EvalObjv for internal use. - - * generic/tcl.h: Changed Tcl_EvalObjv interface to remove string and - length arguments. - - * doc/Eval.3: Updated documentation for Tcl_EvalObjv to remove string - and length arguments. - - * generic/tclCompCmds.c (TclCompileForeachCmd): Fixed code that - corrupted the exceptDepth value in the compile environment when - foreach failed to compile inline. [Bug 884] - - * library/encoding/euc-kr.enc: - * library/encoding/ksc5601.enc: - * tools/encoding/ksc5601.txt: - * unix/tclUnixInit.c: Added support for Korean EUC. - - * win/tclWinChan.c (TclpGetDefaultStdChannel): added check for a - failure during Tcl_MakeFileChannel. - -1998-11-30 Scott Stanton - - * unix/tclUnixNotfy.c (Tcl_WaitForEvent): Fixed hang that occurs when - trying to close a pipe that is currently being waited on by the - notifier thread. [Bug 607] - - * unix/tclUnixFCmd.c (GetPermissionsAttribute): Increase size of - returnString buffer to avoid overflow. [Bug 584] - - * generic/tclThreadTest.c (TclThreadSend): Fixed memory leak due to - use of TCL_VOLATILE instead of TCL_DYNAMIC. - - * generic/tclThread.c (TclRememberSyncObject): Fixed memory leak - caused by failure to reuse condition variables. - - * unix/tclUnixNotfy.c (Tcl_AlertNotifier, Tcl_WaitForEvent, - (NotifierThreadProc, Tcl_InitNotifier): Fixed race condition caused by - incorrect use of condition variables when sending messages between - threads. [Bug 607] - - * generic/tclTestObj.c (TeststringobjCmd): MAX_STRINGS was off by one - so the strings array was too small. - - * generic/tclCkalloc.c (Tcl_DbCkfree): Moved mutex lock so - ValidateMemory is done inside the mutex to avoid a race condition when - validate_memory is enabled. [Bug 880] - -1998-11-23 Scott Stanton - - * regexec.c: more performance tuning from Henry Spencer. - -1998-11-17 Scott Stanton - - * tclScan.c: moved "scan" implementation out of tclCmdMZ.c and added - Unicode support. This required a complete reimplementation of the - command to avoid using scanf(), which isn't Unicode aware. Two new - features were added in the process: %n to return the current number of - characters consumed, and XPG3-style %n$ argument order specifiers - similar to those provided by the "format" command. [Bug 833] - - * tclAlloc.c: changed so allocated memory is always 8-byte aligned to - improve memory performance and to ensure that it will work on systems - that don't like accessing 4-byte aligned values (e.g. Solaris and - HP-UX). [Bug 834] - -1998-11-06 Scott Stanton - - * tclVar.c (TclGetIndexedScalar): Fixed bug 796, var name was getting - lost before being passed to CallTraces. - -1998-10-21 Scott Stanton - - * added "encoding" command - - * Moved internal regexp declarations from tclInt.h to tclRegexp.h - - * integrated regexp updates from Henry Spencer - -1998-10-15 Scott Stanton - - * tclUtf.c: added Unicode character table support - - * tclInt.h: added TclUniCharIsWordChar - - * tclCmdMZ.c (Tcl_StringObjCmd): added "totitle" subcommand, changed - "wordend" and "wordstart" to properly handle Unicode word characters - and connector punctuation - -1998-10-05 Scott Stanton - - * auto.tcl, package.tcl: fixed SCCS strings - - * tclIndex: updated index to reflect 8.1 files - - * tclCompile.c (TclCompileScript): changed to avoid modifying the - input string in place because name lookup operations could have - arbitrary side effects - - * tclInterp.c: added guard against deleting current interpreter - - * tclMacFile.c, tclUnixFile.c, tclWinFile.c, tclFileName.c: added - warnings around code that modifies strings in place - - * tclExecute.c: fixed off-by-one copying error, fixed merge bugs - - * tclEvent.c: changed so USE_TCLALLOC is tested for value instead of - definition - - * tclCompCmds.c: replaced SCCS strings, added warnings around code - that modifies strings in place - - * interp.test: added test for interp deleting itself - -1998-09-30 Scott Stanton - - * makefile.vc: fixed so TCL_LIBRARY is set before running tcltest - - * tclWin32Dll.c: removed TclpFinalize, cleanup of merges diff --git a/ChangeLog.2000 b/ChangeLog.2000 deleted file mode 100644 index 5b62351..0000000 --- a/ChangeLog.2000 +++ /dev/null @@ -1,2539 +0,0 @@ -2000-12-14 Don Porter - - * generic/tclExecute.c: - * tests/expr-old.test: Re-wrote Tcl's [expr rand()] and [expr - srand($seed)] implementations, fixing a range error on some 64-bit - platforms. Added tests that detect the bug. The rewrite changes the - seed -> sequence map on 64-bit platforms, only for seed >= 2^31, a - slight incompatibility. [Bug 121072, Patch 102781] - -2000-12-10 Don Porter - - * library/init.tcl: - * library/msgcat/msgcat.tcl: - * library/msgcat/pkgIndex.tcl: - * library/opt/optparse.tcl: - * library/opt/pkgIndex.tcl: Where [uplevel] is used in a proc to - evaluate a Tcl built-in command in the caller's context, the built-in - commands are now fully namespace-qualified. This prevents problems - when the caller context is in a namespace where the built-in command - name has been used by a command in the namespace. (For example, - [::ns::set] might be called instead of the intended [::set]). [Bug - 119422, Patch 102545] - -2000-12-09 Jeff Hobbs - - * win/tclWinTime.c (CalibrationThread): added lint return value to - prevent compiler warning. [Bug 125005] - - * docs/scan.n: - * tests/scan.test: - * generic/tclScan.c (Tcl_ScanObjCmd): changed %o and %x to use strtoul - instead of strtol to correctly preserve scan<>format conversion of - large integers. [Patch 102663, Bug 124600] - - * generic/tclExecute.c (TclExecuteByteCode): Commited patch fixing - handling of {!} in expressions. [Patch 102702] - -2000-12-08 Jeff Hobbs - - * library/init.tcl: Added support for PATHEXT variable in auto_execok, - recognizing the proper set of executable extensions on Windows. [Patch - 102719] - -2000-12-08 Andreas Kupries - - * generic/tclEncoding.c (LoadTableEncoding): Changed dangerous code to - something less critical. This fixes [Bug 119417], part A without - affecting the speed when loading encodings. - -2000-12-08 Donal K. Fellows - - * doc/open.n: Added xref to fconfigure and advice on the opening of - binary files. Should help prevent a recurrence of bugs like [Bug - 124558] - -2000-12-07 Jeff Hobbs - - * generic/tcl.h: added note about need to updated - library/dde/pkgIndex.tcl with minor version increment. - - * library/dde/pkgIndex.tcl: updated to use 84 version to reflect the - makefile. Should probably be updated to use its real version at some - point. [Patch 102560, Bug 119421] - -2000-12-06 Eric Melski - - * generic/tcl.h (attemptckalloc): Fixed typo for #define of - attemptckalloc (was defined to Tcl_AttempDbCkalloc, should have been - Tcl_AttemptDbCkalloc). [Bug 124384] - - * generic/tclCkalloc.c: Added TCL_MEM_DEBUG versions of - Tcl_AttemptDbCkrealloc and Tcl_AttemptDbCkalloc. [Bug 124384]. - -2000-11-24 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Logical negation "!" can - now handle string booleans, provided those values are placed in - variables. - - * tests/expr.test (expr-13.17): Check that [expr {!$var}] can negate - the string-versions of booleans "yes", "false", etc. - - * library/tcltest/tcltest.tcl (getMatchingFiles, - (getMatchingDirectories): - * tools/man2html.tcl (doDir): - * tools/man2help.tcl (doDir): - * library/package.tcl (tclPkgUnknown,tclMacPkgSearch): - * library/safe.tcl (AddSubDirs): [glob] uses -directory instead of - unsafe [file join]. [Bug 123313] - - * generic/tclIndexObj.c: - * generic/tclTestObj.c (TestindexobjCmd): Changed internal - representation of index objects to fix [Bug 119082]; fix shouldn't be - visible to outside world... - - * generic/tclTest.c (TestGetIndexFromObjStructObjCmd): - * tests/indexObj.test: (indexObj-6.*) Added to test for presence of - [Bug 119082]. - -2000-11-23 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Fixed memory leak from [Bug - 119398] - - * library/init.tcl (unknown): Added specific level parameters to - all uplevel invokations to boost performance; didn't dare touch - the "namespace inscope" stuff though, since it looks sensitive - to me! Should fix [Bug 123217], though testing is tricky... - -2000-11-21 Andreas Kupries - - All of the changes below are described in TIP #7 ~ Specification and - result from the application of the patch contained therein. Creator of - the patch is Kevin Kenny . The patch used here is - actually a bit different. Two MS specific constant values (format - FOOui64) were replaced with a more portable formatting of the values - and an additional cast to LONGLONG. My cross-compiling gcc was unable - to process the original form. [Patch 102459] - - * tclWinTime.c: Add to the static data a set of variables that manage - the phase-locked techniques, including a ''CRITICAL_SECTION'' to guard - them so that multi-threaded code is stable. - - * tclWinTime.c: Modify ''TclpGetSeconds'' to call ''TclpGetTime'' and - return the 'seconds' portion of the result. This change is necessary - to make sure that the two times are consistent near the rollover from - one second to another. - - * tclWinTime.c: Modify ''TclpGetClicks'' to use TclpGetTime to - determine the click count as a number of microseconds. - - * tclWinTime.c: Modify ''TclpGetTime'' to return the time as M*Q+B, - where Q is the result of ''QueryPerformanceCounter'', and M and B are - variables maintained by the phase-locked loop to keep the result as - close as possible to the system clock. The ''TclpGetTime'' call will - also launch the phase-lock management in a separate thread the first - time that it is invoked. If the performance counter is unavailable, or - if its frequency is not one of the two common 8254-compatible rates, - then ''TclpGetTime'' will return the result of ''ftime'' as it does in - Tcl 8.3.2. - - * tclWinTime.c: Add the clock calibration procedure. The calibration - is somewhat complex; to save space, the reader is referred to the - reference implementation for the details of how the time base and - frequency are maintained. - - * tclWinNotify.c: Modify ''Tcl_Sleep'' to test that the process has, - in fact, slept for the requisite time by calling ''TclpGetTime'' and - comparing with the desired time. Otherwise, roundoff errors may cause - the process to awaken early. - - * tclWinTest.c: Add a ''testwinclock'' command. This command returns a - four element list comprising the seconds and microseconds portions of - the system clock and the seconds and microseconds portions of the Tcl - clock. - - * winTime.test: Add to the test suite a test that makes sure that the - Tcl clock stays within 1.1 ms of the system clock over the duration of - the test. - -2000-11-21 Donal K. Fellows - - * doc/global.n: - * doc/upvar.n: - * doc/variable.n: Improved documentation to mention that variables so - created are listed in [info locals] and added a few more cross-links - between these commands. [Bug 119387] - -2000-11-17 Donal K. Fellows - - * tests/safe.test: (safe-4.3): - * generic/tclVar.c (TclLookupVar): Changed again. Now passes all the - tests, though one needed modifying since it required the wrong answer. - (Why on earth do we have inline modification of argument strings? This - sort of thing is horrendous to debug and doesn't work well in a - multithreaded environment!) [Bug 119192] - - * tests/var.test: (var-1.19) If my attempts to fix the problem aren't - right yet, my attempts to describe it look pretty good to me... - -2000-11-16 Andreas Kupries - - * win/tclWinPort.h (line 69): Changed reference to winsock2.h into - winsock.h. This was a leftover from a foray into using winsock version - 2 (History lesson from Scott Redman and Jeff Hobbs). This code was no - problem when compiling Tcl itself, but could trip extensions. [Bug - 122568] - -2000-11-15 Jeff Hobbs - - * unix/Makefile.in: removed bp.c references (hasn't existed in a long - time). Corrected 'make dist' to make dist with unversioned library - directories (same as out of cvs), so make install works correctly with - either source tree. - -2000-11-15 Jeff Hobbs - - * generic/tclVar.c (TclLookupVar): reverted fix below as it broke all - other array unset error reporting. Bug 119192 is still open. - -2000-11-15 Donal K. Fellows - - * generic/tclVar.c (TclLookupVar): Changed references to part2 to use - elName instead in various error message generating spots. [Bug 119192] - -2000-11-03 David Gravereaux - - * win/.cvsignore: Removed 'configure' from the glob list now that it's - included. - -2000-11-03 Jeff Hobbs - - 8.4a2 RELEASE - - * unix/Makefile.in (install-libraries, dist): - * win/makefile.vc (install-libraries): - * win/Makefile.in (install-libraries): updated to install unversioned - library directories into versioned directories. - - * tools/tcl.wse.in: updated for unversioning of library dirs - - * unix/mkLinks: updated mkLinks with latest doc updates - - * doc/Tcl_Main.3: added docs for Tcl_SetMainLoop - - * generic/tclStubInit.c: - * generic/tclDecls.h: - * generic/tcl.decls: added Tcl_SetMainLoop proc that allows people to - set a main loop that will run for tclsh. - * generic/tcl.h: added Tcl_MainLoopProc typedef - * generic/tclMain.c (Tcl_SetMainLoop, StdinProc, Prompt): new - StdinProc and Prompt static procs and Tcl_SetMainLoop stubs proc. The - first two handle a fileevent based prompt (taken from tkMain.c). - Tcl_SetMainLoop enables the interactive setting of a main loop - procedure. This enables Tk to be a loadable package. - -2000-11-02 David Gravereaux - - * generic/tclEvent.c: tclLibraryPath Tcl_Obj didn't have a way to - share its data among threads. This caused Tcl_Init() to always fail in - threads. Added a way to pass the data around with a global char*. - [BUG: 5301] - -2000-11-02 Jeff Hobbs - - * unix/configure: - * unix/dltest/configure: - * win/configure: - * tools/configure: checked in configure scripts so people doing CVS - checkouts aren't required to have autoconf. Changes to configure.in in - the future will require the corresponding configure script to also be - re-autoconf'ed and checked in. - - * win/makefile.vc: - * win/tcl.m4: makefile fixes for Win64 support - - * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): minor cast - changes. - -2000-11-01 Jeff Hobbs - - * unix/tcl.m4: removed use of -lbsd and -ldl for AIX-5. - - * tests/subst.test: added tests for non-zero return code handling by - subst. - * generic/tclParse.c (Tcl_EvalEx): corrected handling of non-zero, - non-error return code cases for subst. [Bug 119829] - - * generic/tclVar.c (TclVarTraceExists): Corrected excessive mem use - when info exists was called on a non-existent array element. [Bug - 119213, 119336] - -2000-10-30 David Gravereaux - - * win/configure.in: - * win/Makefile.in: - * win/makefile.vc: - * win/tcl.rc: - * win/tclsh.rc: Added logic to derive filenames better in the resource - scripts based on compile options. - -2000-10-30 Jeff Hobbs - - * unix/tclUnixInit.c: added default encoding map from "ja_JP.eucJP" to - "euc-jp". (takahashi) - - * tests/clock.test: corrected clock-2.* test numbering - - * unix/configure.in (SC_TCL_LINK_LIBS): removed code that was - commented out (it had been moved to tcl.m4's SC_TCL_LINK_LIBS - already). - - * unix/tcl.m4: consolidated gettimeofday check for AIX. - -2000-10-27 Jeff Hobbs - - * unix/configure.in: - * unix/tcl.m4: added support for AIX-5. - - * generic/tclIO.c (Tcl_NotifyChannel): removed #ifdef around code for - old channel structures, placed preserve/release around statePtr - * generic/tclIO.c (CloseChannel): the statePtr for a channel was not - being freed when the last channel in a stack was freed, causing a mem - leak. - - * unix/tclUnixChan.c: updated channel types to strict - TCL_CHANNEL_VERSION_2 style to avoid compiler warnings. They work - either way, but this avoids compiler warnings (that worries people). - -2000-10-27 Jennifer Hom - - * library/tcltest1.0/tcltest.tcl: Removed a cd into the test directory - in runAllTests that screwed up the temporary directory setting, - effectively preventing users from running tests on multiple platforms - at the same time. - -2000-10-26 David Gravereaux - - * win/tclWinFile.c (TclpMatchFilesTypes): NULL was being set to "attr" - which was a DWORD. Changed NULL to zero because a 'void *' can't be - set to a DWORD to avoid the compiler warning. - -2000-10-24 Jennifer Hom - - * tests/all.tcl: Removed support for tcltest 1.0. - - * tests/tcltest.test: - * library/tcltest1.0/tcltest.tcl: - * library/tcltest1.0/pkgIndex.tcl: - * docs/tcltest.n: Moved tcltest2 code so that it's the standard - version of tcltest. Removed all tcltest2 files (tests/tcltest2.test, - library/tcltest1.0/tcltest2.tcl, docs/tcltest2.n). - -2000-10-20 Jeff Hobbs - - * win/tclWinFile.c (TclpMatchFilesTypes): made the stat call only - occur when necessary (for 'glob' command). Significantly speeds up - glob command from 8.3. [BUG: 6216] - -2000-10-19 Jennifer Hom - - * library/tcltest1.0/tcltest2.tcl: - * tests/tcltest2 - * doc/tcltest2.n: Code and documentation cleanup. Modified -verbose to - take list of keywords as well as string of letters. Removed Tcl - version information from tcltest. Removed tcltest::grep from tcltest - package. Added optional 3rd directory argument to - makeFile/makeDirectory and removeFile/removeDirectory. - - * tests/basic.test: Changed references to tcltest::tclVersion to - hardcoded numbers. - * generic/tcl.h: Changed reference to tcltest2.tcl and tcltest.tcl in - comments to tests/basic.test. - -2000-10-06 David Gravereaux - - * win/tclWinChan.c: moved Win2K bug case test with GetStdHandle() from - TclpGetDefaultStdChannel into Tcl_MakeFileChannel to enable a more - general method in detecting invalid OS handles rather than just a - specific known case. [BUG: 5971] - -2000-10-06 Jeff Hobbs - - * tests/cmdAH.test: extra tests for 'file channels' that include - multiple interpreter tests and channel sharing - * generic/tclIO.c (Tcl_GetChannelNamesEx): corrected function (and - consequently 'file channels') to return channels that are actually - registered for this specific interp, rather than this thread. - - * doc/CrtChannel.3: fixed spelling mistakes - -2000-09-29 Jennifer Hom - - * library/tcltest1.0/tcltest2.tcl: - * tests/tcltest2.test: - * doc/tcltest2.n: Modified the new form of the test command to accept - both attribute-value pairs and command line options. Updated the tests - and the documentation for this new format. Also changed the option - names for the test command. - -2000-09-29 Jeff Hobbs - - * win/tclWinSerial.c (SerialGetOptionProc): corrected reporting of - space parity on Windows (Eason) [Bug 6057]. - - * win/Makefile.in: commented use of TESTFLAGS - * unix/Makefile.in: added TESTFLAGS to test target to conform with - Windows makefile and TEA style. - - * tests/stack.test: prevented possible crash on systems with low - default stacksize (Tru64, AIX) in infinite recursion test. A solution - to check remaining stack space in the core is best, but hard to do in - a cross-platform manner. - - * generic/tclIOGT.c (FLUSH_DELAY): renamed DELAY define to FLUSH_DELAY - to avoid defn conflict using Tru64's cc. - -2000-09-28 Jeff Hobbs - - * tools/tcl.wse.in: added tclPlatDecls.h and tkPlatDecls.h to the - Windows .exe install. - - * tests/fCmd.test (fCmd-6.20): corrected test to remove c:/tcl8975@ - after creating it. - - * tests/fileName.test: cleaned up the testing of glob patterns for - c:/globTest (Windows) to directly create/remove directory. - -2000-09-27 Jeff Hobbs - - * generic/tcl.decls: - * generic/tclIO.c: updated Tcl_IsChannelShared, - Tcl_IsChannelRegistered, Tcl_CutChannel, Tcl_SpliceChannel, - Tcl_IsChannelExisting, and Tcl_ClearChannelHandlers to conform to the - new stacked channel implementation. Their stub slots were also moved - to give preference to the new 8.3.2 stub functions. This will cause an - incompatibility with 8.4a1 only. - (StopCopy): fixed a bug introduced by a partial fix in 8.3.2 that - didn't set nonBlocking correctly when resetting the flags for the - write side. [Bug: 6261] - - * doc/ChnlStack.3: - * doc/CrtChannel.3: - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclDecls.h: - * generic/tclIO.c: - * generic/tclIO.h: - * generic/tclIOGT.c: - * generic/tclInt.decls: - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - * generic/tclTest.c: - * tests/iogt.test: - * unix/Makefile.in: - * win/Makefile.in: - * win/makefile.vc: - * win/tclConfig.sh.in: - * win/tclWinChan.c: - * win/tclWinConsole.c: - * win/tclWinPipe.c: - * win/tclWinSerial.c: - * win/tclWinSock.c: Up-port of changes made in 8.3.2 to 8.4a2 code - base. Most of these changes relate to the rewrite of the stacked - channel implementation, with a few config related fixes. - - Following is an asynchronous include of the applicable ChangeLog - entries from 8.3.2. - - ******************************************************** - ** START OF ASYNCHRONOUS UP-PORT LOG (8.3.2 -> 8.4a2) ** - ******************************************************** - -2000-08-07 Jeff Hobbs - - * doc/ChnlStack.3: - * doc/CrtChannel.3: updated the docs to be aware of the - TCL_CHANNEL_VERSION_2 style of Tcl channels. - - * generic/tclIO.c (Tcl_CreateChannel): added assertion to verify that - the new channel versioning will be binary compatible with older - channel drivers. - -2000-08-05 Jeff Hobbs - - * generic/tclIOGT.c (TclChannelTransform): fixed segfault that would - occur when transforming a channel with a proc that did not yet exist. - (Kupries) - - * generic/tclTest.c (TestChannelCmd): added some lint init'ing of - statePtr and chan vars. - -2000-07-26 Jeff Hobbs - - Merged core-8-3-1-io-rewrite back into core-8-3-1-branch. The - core-8-3-1-io-rewrite branch should now be considered defunct. - - * generic/tclStubInit.c: - * generic/tclDecls.h: - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclIO.c: moved the Tcl_Channel* macros from tcl.h to tclIO.c - and made them proper stubbed functions. These are: Tcl_ChannelName, - Tcl_ChannelVersion, Tcl_ChannelBlockModeProc, Tcl_ChannelCloseProc, - Tcl_ChannelClose2Proc, Tcl_ChannelInputProc, Tcl_ChannelOutputProc, - Tcl_ChannelSeekProc, Tcl_ChannelSetOptionProc, - Tcl_ChannelGetOptionProc, Tcl_ChannelWatchProc, - Tcl_ChannelGetHandleProc, Tcl_ChannelFlushProc, and - Tcl_ChannelHandlerProc. These should be used to access the - Tcl_ChannelType structure instead of direct pointer dereferencing. - - * tests/iogt.test: added RCS string, marked tests 2.* to be unixOnly - due to underlying system differences. - -2000-07-25 Andreas Kupries - - * tests/iogt.test: (line 866f) New tests iogt-6.[01], highlighting - buffering trouble when stacking and unstacking transformations. - iogt-6.0 is solved, see the changes below. iogt-6.1 remains, for now, - due to the perceived complexity of solutions. - - * generic/tclIO.h: (line 139f) struct Channel, added a buffer queue, - to hold data pushed back when stacking a transformation. - - * generic/tclIO.c: - (line 91f, line 7434f) New internal function 'CopyBuffer'. Derived - from 'CopyAndTranslateBuffer', with translation removed. - (line 1025f, line 1212f): Initialization of new queue. - (line 1164f, Tcl_StackChannel): Pushback of input queue. - (line 1293f, Tcl_UnstackChannel): Discard input and pushback. - (line 3748f, Tcl_ReadRaw): Modified to use data in the push back area - before going to the driver. Uses 'CopyBuffer', s.a. - (line 4702f, GetInput): Modified to use data in the push back area - before going to the driver. - (line 4867f, Tcl_Seek): Modified to take pushback of the topmost - channel in a stack into account. - (line 5620f, Tcl_InputBuffered): See above. Added - 'Tcl_ChannelBuffered'. Analog to 'Tcl_InputBuffered' but for the - buffer area in the channel. - - * generic/tcl.decls: New public API 'Tcl_ChannelBuffered'. S.a. - -2000-07-17 Jeff Hobbs - - * unix/Makefile.in: - * win/Makefile.in: - * win/makefile.vc: added tclIOGT.c to objects list to compile. - - * generic/tclStubInit.c: - * generic/tclIntDecls.h: - * generic/tclInt.decls: commented out internal decls for - TclTestChannelCmd and TclTestChannelEventCmd as they were moved to - tclTest.c. Added new decls for TclChannelEventScriptInvoker and - TclChannelTransform. - - * generic/tclIO.c (CloseChannel): stopped masking out of the - TCL_READABLE|TCL_WRITABLE bits from the state flags in CloseChannel, - instead adding extra intelligence to CheckChannelErrors with a new - CHANNEL_RAW_MODE bit for special behavior when called from Raw channel - APIs. - -2000-07-13 Jeff Hobbs - - * generic/tclIO.c (StackSetBlockMode): moved set of chanPtr outside of - blockModeProc check to avoid infinite loop when blockModeProc was - NULL. Updated TransformSeekProc to not call Tcl_Seek directly - (Kupries). - - * win/tclWinChan.c: updated fileChannelType to v2 channel struct - * win/tclWinConsole.c: updated consoleChannelType to v2 channel struct - * win/tclWinPipe.c: updated pipeChannelType to v2 channel struct - * win/tclWinSerial.c: updated serialChannelType to v2 channel struct - * win/tclWinSock.c: updated tcpChannelType to v2 channel struct - -2000-07-11 Brent Welch - - * win/tclConfig.sh.in (TCL_LIBS): Cleaned up unix-specific autoconf - variables. - -2000-07-11 Jeff Hobbs - - * tests/iogt.test: made tests [345].0 not run by default as they were - failing in the new design, but I'm not convinced that the returned - result isn't correct. - - * generic/tclDecls.h: - * generic/tclStubInit.c: - * generic/tcl.decls: added Tcl_GetTopChannel C API that returns the - current top channel of a channel stack. Tcl_GetChannel was changed - earlier to return the bottommost channel of a stack because that is - the one that is guaranteed to stay around the longest, and this was - needed to compensate for certain operations that want to look at the - state of the main channel. Most channel APIs already compensate for - grabbing the top, so it shouldn't be needed often. - - * generic/tclIO.c (Tcl_StackChannel, Tcl_UnstackChannel): Added - flushing of buffers (Kupries), removed use of DownChannel macro, added - Tcl_GetTopChannel public API to get to the top channel of the channel - stack (necessary for TLS). Rewrote Tcl_NotifyChannel for new channel - design (Kupries). Did some code cleanup in the transform code. - tclIO.c must still be broken into bits (separate out test code and - giot code, create tclIO.h). - -2000-07-10 Andreas Kupries - - * tests/iogt.test: Reverted some earlier changes as a fix by Jeff - revived the original and correct behaviour. IOW, the tests showed a - genuine error and I didn't see it :(. - - * generic/tclIO.c (Tcl_Read|Write_Raw): Changed to directly use the - drivers and not DoRead|DoWrite. The latter use the buffering system, - encoding and eol-translation and this wreaks havoc with the data going - through the transformations. Both procedures use CheckForchannelErrors - and let it believe that there is no background copy in progress or - else stacked channels could not be used for that. - - * generic/tclIO.c (TclCopyChannel, CopyData): Moved access to the - topmost channel from the first to the second procedure to make the - decision about that at the last possible time (Callbacks can change - the stacking). - - test suite: failures of iogt-[345].0 - -2000-07-06 Jeff Hobbs - - * tests/iogt.test: new tests for stacked channel stuff based off new - 'testchannel transform|unstack' code (Kupries IOGT extension). - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclDecls.h: - * generic/tclStubsInit.c: - * generic/tclIO.c: complete rewrite of Tcl Channel code for stacked - channels. Channels are now designed to work in a more stacked fashion - with a shared ChannelState data structure. - -2000-06-02 Jeff Hobbs - - * generic/tclIO.c (CloseChannel): removed the &ing out of - (TCL_READABLE|TCL_WRITABLE) from the flags, as CloseChannel does this - on the next pass through for the top channel, and it appeared to be - causing hangs by not allowing the final flush. - -2000-06-01 Jeff Hobbs - - * generic/tclIO.c (CloseChannel): Rewrote CloseChannel code to unstack - a channel during the close process. Fixed a refcount bug in - Tcl_UnstackChannel. [Bug: 5623] - (CloseChannel): further extended CloseChannel in the stacked case to - effect certain operations on the next channel that would have been - done in Tcl_Close. Also added CHANNEL_CLOSED and removed - (TCL_READABLE|TCL_WRITABLE) bits from chanPtr->flags. Changed final - reset of the WatchProc to check the chanDownPtr's (next) interestMask. - - ****************************************************** - ** END OF ASYNCHRONOUS UP-PORT LOG (8.3.2 -> 8.4a2) ** - ****************************************************** - -2000-09-20 Jeff Hobbs - - * tests/socket.test: removed doTestsWithRemoteServer constraint from - socket-12.*. It requires 'exec', not a remote server. Cleaned up some - coding errors. - -2000-09-20 Jennifer Hom - - * library/tcltest1.0/pkgIndex.tcl: Updated to load tcltest 2.0. - * library/tcltest1.0/tcltest2.tcl: New version of tcltest. - Cleanup of command line parsing: allows users to specify command line - arguments through an environment variable named TCLTEST_OPTIONS [RFE: - 3748], does not respond to incorrect arguments, and forces usage of - entire flag name when using command line arguments. Defines accessor - procs for all tcltest variables. Allows users to use 'return' in test - scripts. Allow users to specify whether test files should be sourced - or run in a separate process. 'all.tcl' code moved to tcltest package. - 'test' proc modified to use attribute-value pairs. Allow users to - specify what return codes, output, and errors can be compared and - whether these values should be compared using regexp, glob, or exact - matching. makeDirectory & removeDirectory now operate with respect to - temporaryDirectory [Bug: 6001]. Test results from tests run in slave - interpreters are now included in test totals [Bug: 1493]. Test files - that return error values are now reported. - * tests/all.tcl: Added code to check for the tcltest version loaded; - modified to figure out which tests to run based on the tcltest version - loaded. - * tests/tcltest.test: Modified to explicitly load version 1.0 of - tcltest. - * tests/tcltest2.test: New test suite for tcltest; includes all of the - old tests plus new ones reflecting changes made for version 2.0. - * tests/cmdAH.test: Added singleTestInterp constraint to cmdAH-31.2; - this test does not run if tests aren't sourced into a single - interpreter. - * tests/socket.test: Fixed two tests that were referencing variables - outside of scope. - - * tools/tcl.wse.in: Added code to install tcltest2.tcl. - - * doc/tcltest2.n: New documentation for tcltest version 2.0. Removes - documentation for tcltest namespace variables. Adds documentation for - new tcltest procs. - - * unix/mkLinks: Added code to link to tcltest2.n. - - * generic/tcl.h: Added comment to modify tcltest2.tcl as well as - tcltest.tcl for version changes. - -2000-09-19 Eric Melski - - * generic/tclCmdMZ.c (Tcl_RegexpObjCmd): When using -all, all attempts - after the first to match the regexp against the string should include - the TCL_REG_NOTBOL flag, to avoid erroneously matching ^ in the middle - of the string. Added code to set this flag after the first pass - through the matching loop. [Bug: 6284]. - -2000-09-19 David Gravereaux - - * doc/Eval.3: Added a note about the script argument to Tcl_Eval() - should be in UTF-8 or risk implied conversion errors when possible - combinations of upper ascii can be valid UTF-8 special codes. - -2000-09-17 Eric Melski - - * tests/cmdIL.test: Added a test for fix for [Bug: 6212]. - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Applied patch from [Bug: - 6212], which corrected an error in the handling of the -index option. - -2000-09-14 Eric Melski - - * doc/Alloc.3: Added entries for Tcl_AttemptAlloc, Tcl_AttempRealloc. - - * doc/StringObj.3: Added entry for Tcl_AttemptSetObjLength. - - * generic/tclDecls.h: - * generic/tclStubInit.c: Regen'ed stubs files from new tcl.decls. - - * generic/tcl.decls: Added stubs for the Tcl_Attempt* memory - allocators and for Tcl_AttemptSetObjLength. - - * generic/tcl.h: Added #define's for attemptckalloc, attemptckrealloc, - which map to the Tcl_Attempt* memory allocators. - - * generic/tclCkalloc.c: Added non-panic'ing versions of Tcl_Alloc, - Tcl_Realloc, etc.; these are called Tcl_AttemptAlloc, - Tcl_AttemptRealloc, etc. These are used by Tcl_AttemptSetObjLength and - the string obj append functions. - - * generic/tclStringObj.c: Modified string growth algorithm to use - doubling algorithm as long as possible, and only fall back when that - fails. Added Tcl_AttemptSetObjLength, and modified - AppendUnicodeToUnicodeRep, AppendUtfToUtfRep, and - Tcl_AppendStringsToObjVA to support this. - -2000-09-07 David Gravereaux - - * win/.cvsignore: changed the glob patterns a bit to exclude VC++ - project conversion backups. - - * win/tclWinPipe.c: Stage-1 bug fix for TR#2460 "exec leaks memory". - Added more logic around the close-down of the pipe reader thread so as - to avoid, at all cost, a TerminateThread. Most cases with exec are - fixed, but I don't consider 2460 done yet. Closing down the read side - of a pipe before the child process, doesn't really fit the windows - model. [BUG: 2460] - -2000-09-07 Jeff Hobbs - - * doc/trace.n: minor doc cleanup - -2000-09-06 André Pönitz - - * doc/*.n: added or changed "SEE ALSO:" section - -2000-09-06 Jeff Hobbs - - * win/tclWinLoad.c (TclpLoadFile): added special message for - ERROR_PROC_NOT_FOUND exception in loading a dll. - * win/tclWinError.c: changed ERROR_PROC_NOT_FOUND to map from ESRCH - (POSIX: no such process) to EINVAL because there is no good mapping - for "procedure not found". - - * README: - * generic/tcl.h: - * library/tcltest1.0/tcltest.tcl: - * tools/tcl.wse.in: - * tools/tcltk-man2html.tcl: - * unix/configure.in: - * unix/tcl.spec: - * win/README.binary: - * win/configure.in: updated patchlevel to 8.4a2 - - * unix/tclUnixPipe.c (TclpCreateProcess): Removed WNOHANG from - Tcl_WaitPid call in error case of process creation on Unix, as it - would lead to defunct processes. [Bug: 6148] - - * tests/string.test: extended string repeat tests - * generic/tclCmdMZ.c (Tcl_StringObjCmd): changed STR_REPEAT to - preallocate the full space of the final string, avoided repeated - appends. - - * doc/source.n: - * doc/Eval.3: added extra note about how to safe use ^Z in code, as it - is now a cross-platform (was just Windows) EOF char. - -2000-09-05 Jeff Hobbs - - * generic/tclHash.c: fixed pedantic warning of incorrectly placed - #endif - - * generic/tclExecute.c (TclExecuteByteCode): INST_STR_INDEX fixed - pedantic cast warning. - Corrected support for building with -DTCL_COMPILE_STATS. - Added efficiency check of object equality. - -2000-08-29 Eric Melski - - * generic/tclStringObj.c: Applied patch from Gerhard Hintermayer to - provide a more conservative string growth algorithm for strings larger - than one megabyte; this allows more efficient use of memory for very - large strings. - -2000-08-25 Eric Melski - - * tests/trace.test: Extended array tracing tests. - - * doc/trace.n: Clarified information about when array traces will be - fired. - - * generic/tclVar.c (Tcl_ArrayObjCmd): Corrected call to CallTraces - (for TCL_TRACE_ARRAY) to only be called when the variable is either an - array or is undefined, to ensure that array traces do not fire for - scalar variables. - -2000-08-24 Eric Melski - - * doc/man.macros: Tweaked tab settings for .SO (Standard Options) - sections, based on suggestion from Peter Spjuth. - -2000-08-24 Mo DeJong - - * unix/README: Update to account for removal of --enable-gcc. - * unix/configure.in: - * unix/tcl.m4 (SC_ENABLE_GCC): Remove --enable-gcc option. - * win/README: Add note about building with Cygwin. - * win/configure.in: - * win/tcl.m4 (SC_ENABLE_GCC): Remove --enable-gcc option. Remove quick - hack that provided cross compile support for windows builds. - -2000-08-24 Eric Melski - - Overall change: Added support for command rename/delete traces and new - trace syntax, from patch from Vince Darley. Added support for array - traces for variables. [RFE: 5048, 5967]. - - * doc/trace.n: Updated documentation for new syntax; flagged old - syntax as deprecated; added documentation for command rename/delete - traces and variable array traces. - - * tests/trace.test: Updated tests for new trace syntax; new tests for - command rename/delete traces; new tests for array traces. - - * generic/tclVar.c: Support for new trace syntax; support for - TCL_TRACE_ARRAY. - - * generic/tclStubInit.c: - * generic/tclDecls.h: - * generic/tcl.decls: Stub functions for command rename/delete traces. - - * generic/tcl.h: - * generic/tclInt.h: - * generic/tclBasic.c: Support for command traces. - - * generic/tclCmdMZ.c (TclTraceVariableObjCmd): Patched to support new - [trace] syntax: - trace {add|remove|list} {variable|command} name ops command - Added support for command traces (rename, delete operations). - Added support for TCL_TRACE_ARRAY at Tcl level (array operation for - variable traces). - -2000-08-20 Eric Melski - - * generic/tclVar.c: Added check for non-arrays for [array statistics] - command (patch from Mark Patton). - -2000-08-19 David Gravereaux - - * generic/tclPlatDecls.h: without a previous '#include ', - tclPlatDecls.h can't be parsed due to a missing definition of TCHAR. - Added a check to include it when not defined. - - ***POSSIBLE OBSCURE BUG*** could be caused when the compile flags for - the core happen to be different than a project who uses these publics - regarding -D_MBCS and -D_UNICODE. This added check might have to be - revisited later with a better understanding of the reprocusions. I - think TCHAR should be replaced with it's expansion. - -2000-08-18 David Gravereaux - - * win/.cvsignore (added): provides a cleaner build environment with - graphical CVS clients. - -2000-08-15 Eric Melski - - * library/tcltest1.0/tcltest.tcl: Set debug level in - tcltest::restoreState to 2, for consistancy with the debug level in - tcltest::saveState [Bug: 4505]. - -2000-08-14 Eric Melski - - * win/makefile.vc: - * win/Makefile.in: - * unix/Makefile.in: Added tclPlatDecls.h to the list of installed - headers, for more complete stubs support. [Bug: 5241]. - - * generic/tcl.h: Added #include "tclPlatDecls.h" to get - platform-specific stubs declarations (Tcl_WinTCharToUtf, etc) - [Bug: 5241]. - - * README: Updated link for instructions on compiling Tcl from sources - to point to correct location (http://dev.scriptics.com/doc/... instead - of http://dev.scriptics.com/support/...). - -2000-08-11 Eric Melski - - * generic/tclEnv.c (TclUnsetEnv): Changed declaration of length - variable from "unsigned int" to "int", to match usage when passed to - TclpFindVariable [Bug: 6126]. - -2000-08-10 Eric Melski - - * library/msgcat1.0/pkgIndex.tcl: Bumped version number to 1.2 [Bug: - 6100]. - - * library/msgcat1.0/msgcat.tcl: Removed erroneous [package forget] in - msgcat namespace initializer. Bumped version number to 1.2 [Bug: 6100] - -2000-08-10 David Gravereaux - - * generic/tclObj.c: r1.15 accidentally changed a global mutex name - tclObjMutex to ObjMutex. Put the correct name back. - -2000-08-07 Eric Melski - - * tests/indexObj.test: Added tests using the [testwrongnumargs] - command to test Tcl_WrongNumArgs. - - * generic/tclTest.c (TestWrongNumArgsObjCmd): Added test function for - the Tcl_WrongNumArgs function. - - * generic/tclIndexObj.c (Tcl_WrongNumArgs): Corrected algorithm to not - insert a space before the message component when objc == 0 [Bug: 6078] - -2000-07-27 Mo DeJong - - * win/configure.in: TCL_STUB_LIB_FLAG should not include ${TCL_DBGX} - in win/tclConfig.sh, fix that. - -2000-07-25 David Gravereaux - - * doc/Async.3: - * generic/tclAsync.c: - * generic/tclInt.decls: - * generic/tclIntPlatDecls.h: - * generic/tclStubInit.c: - * generic/tclTest.c: - * mac/tclMacPort.h: - * unix/tclUnixPort.h: - * win/tclWinInit.c: Thread-safe rewrite for tclAsync.c. Added notifier - alerting on all platforms as it was only working on Win before. - Removed older Win hacks that would end-up waking the wrong notifier in - the presence of a threaded build. All tests pass as before. New test - cases will be added soon for the new behavior. [BUG: 5791] - -2000-07-25 Eric Melski - - * generic/tclVar.c (CallTraces): Added check for VAR_TRACE_ACTIVE on - the array containing the variable before executing traces on that - array, to conform with normal variable traces and the documentation, - which states that while executing a trace, other traces on that - variable are disabled. [Bug: 6049]. - - * win/tclWinPipe.c (BuildCommandLine): Added Tcl_DStringFree call to - prevent potential memory leaks [Bug: 6041]. - -2000-07-24 Eric Melski - - * doc/msgcat.n: Added documentation about the selection of the default - locale on Windows. - -2000-07-23 Joe English - - * doc/AddErrInfo.3: - * doc/ChnlStack.3: - * doc/Exit.3: - * doc/GetIndex.3: - * doc/Notifier.3: - * doc/Object.3: - * doc/RegExp.3: - * doc/SetResult.3: - * doc/SplitList.3: - * doc/Thread.3: Added missing entries to NAME section. - - * doc/AddErrInfo.3: - * doc/CrtObjCmd.3: - * doc/RecEvalObj.3: Changed Tcl_EvalObj to Tcl_EvalObjEx - -2000-07-21 Eric Melski - - * generic/tclStubInit.c: - * generic/tclObj.c: - * generic/tclInt.h: - * generic/tclHash.c: - * generic/tclDecls.h: - * generic/tcl.h: - * generic/tcl.decls: - * doc/Hash.3: Reapplied patch from Paul Duffin to extend hash tables - to allow custom key types, such as Tcl_Obj *'s, and others. - - * doc/binary.n: Noted that the example in the introduction assumes a - 32-bit system [Bug: 6035]. - -2000-07-21 Mo DeJong - - * win/configure.in: Define ${prefix} and ${exec_prefix} like - unix/configure.in. Fix or add TCL_SRC_DIR, TCL_STUB_LIB_FILE, - TCL_STUB_LIB_FLAG, TCL_BUILD_STUB_LIB_SPEC, TCL_STUB_LIB_SPEC, - TCL_BUILD_STUB_LIB_PATH, TCL_STUB_LIB_PATH. - -2000-07-20 Eric Melski - - * generic/tclStubInit.c: - * generic/tclObj.c: - * generic/tclInt.h: - * generic/tclHash.c: - * generic/tclDecls.h: - * generic/tcl.h: - * generic/tcl.decls: - * doc/Hash.3: Reverted patch from Paul Duffin to extend hash tables to - allow custom key types, such as Tcl_Obj *'s, and others; it seems to - break Tk. - -2000-07-19 Eric Melski - - * generic/tclStubInit.c: - * generic/tclObj.c: - * generic/tclInt.h: - * generic/tclHash.c: - * generic/tclDecls.h: - * generic/tcl.h: - * generic/tcl.decls: - * doc/Hash.3: Applied patch from Paul Duffin to extend hash tables to - allow custom key types, such as Tcl_Obj *'s, and others. - - * tests/pkgMkIndex.test: Added tests for pkg_compareExtension. - - * library/package.tcl: Enhanced pkg_compareExtension to handle Unixes - which tack the version number on to the end of library names (eg, - foo.so.1.2); such filenames will be correctly matched. (Patch from - Vince Darley). - - * win/makefile.vc: Applied patch from Don Porter to provide better - nmake support for NT/Alpha [RFE: 5938]. - -2000-07-18 Mo DeJong - - * unix/configure.in: - * unix/tcl.m4: - * win/tcl.m4: Properly quote arguments to m4 macros. This allows Tcl - to work with the new version of autoconf. - -2000-07-18 Eric Melski - - * tests/opt.test: Removed references to Lfirst, Lrest functions. - - * library/opt0.4/optparse.tcl: Applied patch from Chris Nelson, which - replaces the [Lfirst] function with an inline [lindex ... 0] and - [Lrest] with [lrange ... 1 end], for better performance. [RFE: 6019] - -2000-07-18 Eric Melski - - * compat/string.h: Fixed function prototypes for strpbrk and strtok - [Bug: 6020]. - -2000-07-17 David Gravereaux - - * win/tclWinChan.c: Win2K OS bug with GetStdHandle(STD_OUTPUT_HANDLE) - giving the wrong answer. This made TclpGetDefaultStdChannel grab what - it thought was a valid native stdout handle. Added a new WriteFile() - test to make sure it's really valid. This OS bug doesn't affect the - shells. Only -subsystem:windows (aka WinMain) application that - dynamically load tclXX.dll [BUG: 5971] - -2000-07-17 Eric Melski - - * library/msgcat1.0/msgcat.tcl: - * doc/msgcat.n: - * tests/msgcat.test: Applied patches from Chris Nelson, to provide the - mcmset function, which allows the translator to set multiple string - translations in a single function call, rather than requiring many - calls to mcset. [RFE: 6000, 5993]. In addition, these patches correct - mcload to use utf-8 encoding on when reading message catalog files, - and provides for better default behavior for determining the locale on - a Windows system. - -2000-07-17 Mo DeJong - - * unix/tcl.m4 (SC_ENABLE_GCC): Don't set CC=gcc before running - AC_PROG_CC if CC is already set. - -2000-07-13 André Pönitz - - * doc/lappend.n: - * doc/lindex.n: - * doc/linsert.n: - * doc/list.n: - * doc/llength.n: - * doc/lrange.n: - * doc/lreplace.n: - * doc/lsearch.n: - * doc/lsort.n: Added SEE ALSO sections. - -2000-07-07 Mo DeJong - - * win/configure.in: Fix definition of TCL_SRC_DIR so that it matches - the Unix version. - * win/tclConfig.sh.in: Removed duplicate variables. - -2000-07-06 Eric Melski - - * tests/msgcat.test: - * library/msgcat1.0/msgcat.tcl: Applied patch from Christian Krone, to - provide extended args support for msgcat::unknown, which is used for - strings without a known translation in the current locale [Bug: 5984]. - -2000-06-29 Eric Melski - - * doc/msgcat.n: Doc's for mcmax function. - - * library/msgcat1.0/msgcat.tcl: Applied patches from Laurent Duperval, - to add mcmax function, which computes the length of the longest of - several translated strings. Bumped version number to 1.1. - -2000-06-27 Eric Melski - - * tests/stringObj.test: Tweaked tests to avoid hardcoded high-ASCII - characters (which will fail in multibyte locales); instead used \uXXXX - syntax. [Bug: 3842]. - -2000-06-26 Eric Melski - - * doc/package.n: Corrected information about [package forget] - arguments [Bug: 5418]. - -2000-06-23 Eric Melski - - * doc/Hash.3: Added documentation patch for Tcl_Obj *'s as keys in Tcl - hash tables [RFE: 5934]. - - * generic/tcl.h: - * generic/tclHash.c: Applied patch from [RFE: 5934], which extends Tcl - hash tables to allow Tcl_Obj *'s as the key. - -2000-06-20 Eric Melski - - * tests/opt.test: - * library/opt0.4/optparse.tcl: Applied patch from [Bug: 5922], which - corrected an incorrect use of [string match]. - - * unix/tclConfig.sh.in: - * win/tclConfig.sh.in: Applied patch from [Bug: 5921], which corrects a - typo in the comments in these files. - -2000-06-19 Eric Melski - - * doc/RegExp.3: Replaced instances of "Tcl_GetRegExpInfo" with - "Tcl_RegExpGetInfo", the correct name of the function [Bug: 5901]. - -2000-06-13 Eric Melski - - * win/tcl.m4: - * win/configure.in: - * win/Makefile.in: Applied patch from [RFE: 5844], to extend support - for mingw compile environment on Windows. - - * win/tclWinDde.c: - * win/tclWinInit.c: - * win/tclWinNotify.c: - * win/tclWinPipe.c: - * win/tclWinReg.c: - * win/tclWinThrd.c: Applied patch from [Bug: 5794], to fix compiler - warnings when using mingw on Windows. - -2000-05-31 Jeff Hobbs - - * tests/set-old.test: - * doc/unset.n: - * generic/tclVar.c (Tcl_UnsetObjCmd): added -nocomplain and -- options - to unset, to allow for a silent unset operation. - -2000-05-31 Eric Melski - - * generic/tclVar.c (Tcl_ArrayObjCmd): Added support for regexp and - exact matching for [array names] command. [RFE: 3684]. - - * doc/array.n: Added documentation for [array names - -exact/-regexp/-glob] [RFE: 3684]. - - * tests/set-old.test: Added tests for [array names - -exact/-regexp/-glob] [RFE: 3684]. - -2000-06-06 Jeff Hobbs - - 8.4a1 RELEASE - - * generic/tclExecute.c (TclExecuteByteCode INST_STR_CMP): added test - of iResult return from memcmp, as memcmp isn't required to return only - -1,0,1. - -2000-06-03 Jeff Hobbs - - * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): Corrected caching - of the index ptr to account for offsets != sizeof(char *). [Bug: 5153] - -2000-05-29 Sandeep Tamhankar - - * tests/http.test - * doc/http.n - * library/http2.3/http.tcl: Fixed bug 5741, where unsuccessful geturl - calls sometimes leaked memory and resources (sockets). Also, switched - around some of the logic so that http::wait never throws an exception. - This is because in an asynchronous geturl, the command callback will - probably end up doing all the error handling anyway, and in an - asynchronous situation, the user expects to check the state when the - transaction completes, as opposed to being thrown an exception. For - the http package, this menas the user can check http::status for - "error" and http::error for the error message after doing the - http::wait. - -2000-05-27 Jeff Hobbs - - * tests/info.test: - * doc/info.n: - * generic/tclIOUtil.c (Tcl_EvalFile): - * generic/tclCmdIL.c (InfoScriptCmd): added ability to set the info - script return value [info script ?newFileName?]. This will be - beneficial for virtual file system programs. [Bug: 4225] - -2000-05-26 Jeff Hobbs - - * generic/tclCmdMZ.c (Tcl_RegsubObjCmd): reworked to operate in - Unicode, tweaked for performance. - (Tcl_StringObjCmd) changed STR_FIRST/STR_LAST error message to - something more understandable, reworked STR_FIRST, STR_LAST, STR_MAP, - STR_MATCH, STR_RANGE, STR_REPLACE to operate in Unicode. Removed - inneffectual STR_RANGE "special" ByteArray support. Optimized STR_MAP - algorithm, especially optimized for one-pair case. Fixed possible mem - overrun in STR_INDEX bytearray case. - - * generic/tclCompExpr.c: changed INST_STREQ -> INST_STR_EQ, - INST_STRNEQ -> INST_STR_NEQ - * generic/tclCompile.c: added streq, strneq, strcmp, strlen & - strmatch to the compiled stats instructionTable - * generic/tclCompile.h: added instructions INST_STR_CMP, - INST_STR_INDEX, INST_STR_MATCH - * generic/tclCompCmds.c: added byte compiler support for [string - compare|match|index]. - * generic/tclExecute.c: Changed INST_STR_(N)EQ to return an Int object - and not bother trying to reuse the top stack object. Added - INST_STR_CMP, INST_STR_INDEX, INST_STR_MATCH bytecode ops. Extended - evalstats output info with Tcl_IsShared stat info. - - * generic/tclInt.h: - * generic/tclObj.c (Tcl_DbIsShared): added support for checking result - of Tcl_IsShared in evalstats (TCL_COMPILE_STATS). - - * generic/tclStringObj.c (Tcl_AppendUnicodeToObj): removed dead code. - (AppendUnicodeToUnicodeRep) removed overallocation by extra - sizeof(Tcl_UniChar) multiplier. - - * tests/string.test: added string map tests for the one-pair case, - corrected tests to reflect improved error messages in first/last. - Added tests against mem overrun in string index bytearray case. - -2000-05-23 Eric Melski - - * generic/tclInt.h: Added function prototypes for TclCompileStringCmd - and TclCompileReturnCmd. - - * generic/tclCompile.h: Added definition of INST_STRLEN opcode and - updated LAST_INST_OPCODE value. - - * generic/tclBasic.c: Added information about TclCompileStringCmd and - TclCompileReturnCmd to BuiltInCmds table. - - * generic/tclExecute.c (TclExecuteByteCode): Added support for the - INST_STRLEN opcode. - - * generic/tclCompCmds.c (TclCompileStringCmd): Basic implementation of - byte-compiled [string] command. Not all subcommands are implemented; - those that are not an out-line compiled. - - (TclCompileReturnCmd): Byte-compiled implementation of [return] - command. Only "simple" returns are byte-compiled; in particular, if - the -code, -errorinfo or -errorcode flags are used, the command is not - byte-compiled. - -2000-05-22 Jeff Hobbs - - * doc/scan.n: - * doc/array.n: minor doc fixes [Bug: 5396] - - * generic/tclEnv.c: cast cleanup [Bug: 5624] - * win/tclWinConsole.c: cast and header cleanup [Bug: 5625] - * win/tclWinSerial.c: cast cleanup [Bug: 5626] - * win/tclWinFCmd.c: cast cleanup [Bug: 5627] - -2000-05-19 Jeff Hobbs - - * generic/tclTest.c: - * generic/tclIO.c: moved channel test commands from tclIO.c to - tclTest.c. - * generic/tclIO.h: new file, split out from tclIO.c to allow test - commands to be moved to tclTest.c. - - * generic/tclStubInit.c: - * generic/tclIntDecls.h: - * generic/tclInt.decls: removed TclTestChannel*Cmd from internal stubs - table and added TclChannelEventScriptInvoker to the internal stubs - table so it can be used from the test code. - -2000-05-18 Eric Melski - - * tests/clock.test: Added test for "2 days 2 hours ago" style - specifications. - - * generic/tclDate.c: Regenerated from tclGetDate.y. - - * generic/tclGetDate.y: Tweaked grammar to properly handle the "ago" - keyword when it follows multiple relative unit specifiers, as in "2 - days 2 hours ago". [Bug: 5497] - -2000-05-18 Jeff Hobbs - - * win/{tcl.m4,Makefile.in,configure.in}: added support for mingw - compile env and cross-compiling. [Bug: 5499] - - * generic/tclClock.c (FormatClock): correct code to handle locale - specific return values from strftime, if any. [Bug: 3345] - - * unix/tclUnixInit.c (TclpSetInitialEncodings): attempt to correct - setlocale calls for XIM support and locale issues. [BUG: 5422 3345 - 4236 2522 2521] - -2000-05-17 Jeff Hobbs - - * library/init.tcl (auto_import): added check to see if a valid - pattern was coming in, to avoid simple error cases [Bug: 3326] - - * doc/regsub.n: correct regsub docs [Bug: 5346] - -2000-05-15 Eric Melski - - * library/history.tcl: Corrected an off-by-one error in HistIndex, - which was causing [history redo] to start its search at the wrong - event index. [Bug: 1269]. - -2000-05-10 Jeff Hobbs - - * generic/tclPosixStr.c (Tcl_SignalMsg): clarified #defines for Linux - on Sparc to compile correctly. [Bug: 5364] - - * doc/namespace.n: - * tests/namespace.test: - * generic/tclNamesp.c (Tcl_NamespaceObjCmd): added 'namespace exists' - command. [Bug: 4665] - - * doc/source.n: - * doc/Eval.3: - * tests/source.test: - * generic/tclIOUtil.c (Tcl_EvalFile): added explicit \32 (^Z) eofchar - (affects Tcl_EvalFile in C, "source" in Tcl). This was implicit on - Windows already, and is now cross-platform to allow for scripted - documents. - -2000-05-09 Andreas Kupries - operating as proxy for David Gravereaux - - * win/tclWinThrd.c (TclpInitLock, TclpMasterLock): Added missing - initialization of joinLock. - -2000-05-09 Eric Melski - - * tests/lsearch.test: - * doc/lsearch.n: - * generic/tclCmdIL.c (Tcl_LsearchObjCmd): Extended [lsearch] to - support sorted list searching and typed list searching. [RFE: 4098]. - -2000-05-08 Jeff Hobbs - - * doc/expr.n: - * tests/expr.test: - * tests/expr-old.test: added tests for 'eq' and 'ne' - * generic/tclExecute.c: - * generic/tclCompile.h: added INST_STREQ and INST_STRNEQ opcodes that - do strict string comparisons. - * generic/tclCompExpr.c: added 'eq' and 'ne' string comparison - operators. - * generic/tclParseExpr.c (GetLexeme): added 'eq' and 'ne' expr parse - terms (string (in)equality check). - - * generic/tclCmdIL.c (Tcl_LinsertObjCmd): made use of - Tcl_DuplicateObj where code was otherwise duplicated. Made special - case of inserting one element at the end work again (where index == - len). - (Tcl_LreplaceObjCmd): moved Tcl_DuplicateObj call lower and cleaned - up use of other arguments. - - * generic/tclObj.c (Tcl_DuplicateObj): simplified code to call - TclInitStringRep, which the code was just duplicating in part. - - * doc/Utf.3: - * generic/tclStubInit.c: - * generic/tcl.decls: - * generic/tclDecls.h: - * generic/tclUtf.c: Added new functions Tcl_UniCharNcasecmp and - Tcl_UniCharCaseMatch (unicode parallel to Tcl_StringCaseMatch) - * generic/tclUtil.c: rewrote Tcl_StringCaseMatch algorithm for - optimization and made Tcl_StringMatch just call Tcl_StringCaseMatch - * tests/string.test: extended string match tests - -2000-05-08 Eric Melski - - * tests/set-old.test: - * doc/array.n: - * generic/tclVar.c: Added [array statistics] command [RFE: 4557] - -2000-05-06 Andreas Kupries - operating as proxy for David Gravereaux - - * tclThreadJoin.c: Fixed several places with missing a & in arguments - to calls of Tcl_Mutex(Un)lock and Tcl_ConditionNotify functions. - -2000-05-02 Jeff Hobbs - - * README: - * generic/tcl.h: - * library/init.tcl: - * library/reg1.0/pkgIndex.tcl: - * library/tcltest1.0/tcltest.tcl: - * mac/README: - * tools/tcl.hpj.in: - * tools/tcl.wse.in: - * unix/README: - * unix/configure.in: - * unix/tcl.spec: - * win/README: - * win/README.binary: - * win/configure.in: - * win/makefile.vc: - * win/tcl.m4: updated patchlevel to 8.4a1 - - * tests/compile.test: - * tests/init.test: - * tests/proc.test: - * tests/proc-old.test: - * tests/rename.test: - * generic/tclProc.c: reworked error return for procedures with - incorrect args to be like the C Tcl_WrongNumArgs, where a "wrong # - args: ..." message is printed out with the args list. - - * unix/Makefile.in: add tclsh.ico and tcl.spec to dist target - -2000-05-02 Andreas Kupries - - Overall changes: - (1) Implementation of joinable threads for all platforms. - (2) Additional API's for channels. Required to allow the thread - extension to move channels between threads. - - * generic/tcl.decls (lines 1360f): Added Tcl_JoinThread, - Tcl_IsChannelShared, Tcl_IsChannelRegistered, Tcl_CutChannel, - Tcl_SpliceChannel, Tcl_IsChannelExisting and Tcl_ClearChannelHandlers - (slots 394 to 400). - - * generic/tclIO.c: Implemented Tcl_IsChannelRegistered, - Tcl_IsChannelShared, Tcl_CutChannel, Tcl_SpliceChannel, - Tcl_IsChannelExisting and Tcl_ClearChannelHandlers. Tcl_CutChannel - uses code from CloseChannel. Replaced this code by a call to - Tcl_CutChannel. Replaced several code fragments adding channels to - the channel list with calls to Tcl_SpliceChannel. Removed now unused - variables from CloseChannel and Tcl_UnstackChannel. - Tcl_ClearChannelHandlers uses code from Tcl_Close. Replaced this code - by a call to Tcl_ClearChannelHandlers. Removed now unused variables - from Tcl_Close. Added the subcommands 'cut', 'forgetch', 'splice' and - 'isshared' to the test code (TclTestChannelCmd). - - * unix/tclUnixThread.c: Implemented Tcl_JoinThread using the - pthread-functionality. - - * win/tclWinThrd.c: Fixed several small typos in comments. - Implemented Tcl_JoinThread using a platform independent emulation - layer (see generic/tclThreadJoin.c below). Added 'joinLock' to - serialize Tcl_CreateThread and TclpExitThread to prevent a race for - joinable threads. - - * mac/tclMacThrd.c: Implemented Tcl_JoinThread using a platform - independent emulation layer (see generic/tclThreadJoin.c below). Due - to the cooperative nature of threading on this platform the race - mentioned above is not present. - - * generic/tclThreadJoin.c: New file. Contains a platform independent - emulation layer helping in the implementation of joinable threads for - the win and mac platforms. - - * generic/tclInt.h: Added declarations for TclJoinThread, - TclRememberJoinableThread and TclSignalExitThread. These procedures - define the API of the emulation layer for joinable threads (see - generic/tclThreadJoin.c above). - - * win/Makefile.in: - * win/makefile.vc: Added generic/tclTheadJoin.o to the rules. - - * mac/: I don't know to which file generic/tclTheadJoin.o has to be - added to so that it compiles. Sorry. - - * unix/tclUnixChan.c: #ifdef'd the thread-local list of file channels - as it prevents us from transfering channels. To restore this we may - need an extended interface to drivers in the future. Target: - 9.0. Found while testing the new transfer of channels. The information - in this list for a channel was left behind and then crashed the system - during finalization. - - * generic/tclThreadTest.c: Added -joinable flag to 'testthread - create'. Added subcommand 'testthread join'. - - * doc/CrtChannel.3: Added documentation for Tcl_IsChannelRegistered, - Tcl_IsChannelShared, Tcl_CutChannel, Tcl_SpliceChannel, - Tcl_IsChannelExisting and Tcl_ClearChannelHandlers. - - * doc/Thread.3: Added documentation for Tcl_JoinThread. - - * tests/thread.test: Added tests for joining of threads. - -2000-04-27 Eric Melski - - * doc/library.n: Added entries for auto_qualify and auto_import - [Bug: 1271]. - - * doc/Init.3: Manual entry for Tcl_Init [Bug: 1820]. - - * doc/expr.n: Added documentation for each of the math library - functions that expr supports [Bug: 1054]. - -2000-04-26 Eric Melski - - * doc/memory.n: Man page for Tcl "memory" command, which is created - when TCL_MEM_DEBUG is defined at compile time. - - * doc/TCL_MEM_DEBUG.3: Man page with overall information about - TCL_MEM_DEBUG usage. - - * doc/DumpActiveMemory.3: Man page for Tcl_DumpActiveMemory, - Tcl_InitMemory, and Tcl_ValidateAllMemory [Bug: 1816, 1835]. - - * generic/tclCkalloc.c: Fixed some function headers. - - * unix/mkLinks: Regen'd with new mkLinks.tcl. - - * unix/mkLinks.tcl: Fixed indentation, made link setup more - intelligent (only do one existance test per man page, instead of one - per function). - - * doc/library.n: Fixed .SH NAME macro to include each function - documented on the page, so that mkLinks will know about the functions - listed there, and so that the Windows help file index will get set up - correctly [Bug: 1898, 5273]. - -2000-04-26 Jeff Hobbs - - 8.3.1 RELEASE - - * README: - * mac/README: - * tools/tcl.wse.in: - * unix/README: - * unix/tcl.spec: - * win/README: - * win/README.binary: Updating URLs to reference dev.scriptics.com - -2000-04-25 Jeff Hobbs - - * unix/Makefile.in: - * win/Makefile.in: - * win/makefile.vc: updated for http change and some cleanup - * library/http2.[13]: moved dir http2.1 to http2.3 to match version - - * doc/Utf.3: clarified docs for Tcl_(UniChar|Utf)AtIndex - - * unix/tclUnixThrd.c: removed {}s around PTHREAD_MUTEX_INITIALIZER - [Bug: 5254] - - * unix/tclLoadDyld.c (TclpLoadFile): removed use of interp->result - -2000-04-25 Eric Melski - - * unix/mkLinks: - * doc/AddErrInfo.3: Added information about Tcl_LogCommandInfo - [Bug: 1818]. - -2000-04-24 Eric Melski - - * unix/mkLinks: - * doc/OpenFileChnl.3: Added man entry for Tcl_Ungets [Bug: 1834]. - - * unix/mkLinks: - * doc/SourceRCFile.3: Man page for Tcl_SourceRCFile [Bug: 1833]. - - * unix/mkLinks: - * doc/ParseCmd.3: Added documentation for Tcl_ParseVar [Bug: 1828]. - -2000-04-24 Jeff Hobbs - - * unix/tclUnixNotfy.c (Tcl_FinalizeNotifier, NotifierThreadProc): - added write of 'q' into triggerPipe for notifier in threaded case, so - that Tcl doesn't hang when children are still running [Bug: 4139] - - * unix/tclUnixThrd.c (Tcl_MutexLock): minor comment fixes. - -2000-04-23 Jim Ingham - - These changes make some error handling marginally better for Mac - sockets. It is still somewhat flakey, however. - - * mac/tclMacSock.c (TcpClose): Add timeouts to the close - these don't - seem to be honored, however. Use a separate PB for the release, since - an async connect socket will still be using the original buffer. Make - sure TCPRelease returns noErr before freeing the recvBuff. If the call - returns an error, then the buffer is not right. - * mac/tclMacSock.c (CreateSocket): Add timeouts to the async create. - These don't seem to trigger, however. Sigh... - * mac/tclMacSock.c (WaitForSocketEvent): If an TCP_ASYNC_CONNECT - socket errors out, then return EWOULDBLOCK & error out. - * mac/tclMacSock.c (NotifyRoutine): Added a NotifyRoutine for - experimenting with MacTCP. - -2000-04-22 Jim Ingham - - * library/package.tcl (tclPkgUnknown): Fixed a typo in the Mac package - search part of tclPkgUnknown. - -2000-04-21 Sandeep Tamhankar - - * library/http2.1/http.tcl: Fixed a newly introduced bug where if - there's a -command callback and something goes wrong, geturl threw an - exception, called the callback, and unset the token. I changed it so - that it will not call the callback when throwing an exception (so the - caller only finds out about a given error from one place). Also, - fixed http::ncode so that it actually gives you back the http return - code (i.e. 200, 404, etc.) instead of the first digit of the version - of HTTP being used (i.e. 1). - -2000-04-21 Brent Welch - - * library/http2.1/http.tcl: More thrashing with the "server closes - without reading post data" scenario. Reverted to the previous filevent - configuratiuon, which seems to work better with small amounts of post - data. - -2000-04-20 Jeff Hobbs - - * generic/tclAlloc.c: wrapped caddr_t define to not be done on Unix - * unix/tclUnixPort.h: added Tclp*Alloc defines to allow the use of - USE_TCLALLOC on Unix. [Bug: 4731] - -2000-04-19 Jeff Hobbs - - * library/dde1.1/pkgIndex.tcl: - * library/reg1.0/pkgIndex.tcl: - * win/tclWinChan.c: - * win/tclWinThrd.c: converted CRLF to LF the */tcl.hpj.in files were - not converted, as it confuses hcw locally. [Bug: 5096] - - * win/Makefile.in: expanded cleanup target for help files - - * doc/Thread.3: minor macro cleanup - - * generic/tclFileName.c (SplitUnixPath): added support for QNX node - ids. - -2000-04-18 Jeff Hobbs - - * README: - * generic/tcl.h: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - * win/README.binary: bumped version to 8.3.1 - - * win/tcl.hpj.in: updated copyright date - - * generic/tclEnv.c: environment support for Mac OS/X - * unix/tclUnixPort.h: environment support for Mac OS/X - * unix/tclLoadDyld.c: new file for Mac OS/X dl functions - * unix/Makefile.in: added install-strip target; bindir, libdir, - mandir, includedir vars; tclLoadDyld.c target [Bug: 2527] - - * unix/tclUnixChan.c (CreateSocket): force a socket back into blocking - mode (default state) after a -async connect succeeds. [Bug: 4388] - - * generic/tclEvent.c (TclInitSubsystems): Moved tclLibraryPath to - thread-local storage to prevent thread-related race condition. - [Bug: 5033] - * unix/tclAppInit.c (main): removed #ifdef TCL_TEST that sets the - library path as it was unnecessary and conflicts with move of - tclLibraryPath to thread-local storage. - -2000-04-18 Scott Redman - - * win/Makefile.in: - * win/tcl.rc: - * win/tclsh.rc: - * win/tclsh.ico: Modified copyright dates in Windows resource files. - Added an icon for tclsh.exe. - -2000-04-17 Brent Welch - - * generic/tcl.h, generic/tclThreadTest.c, unix/tclUnixThrd.c, - * win/tclWinThread.c, mac/tclMacThread.c: Added Tcl_CreateThreadType - and TCL_RETURN_THREAD_TYPE macros for declaring the NewThread callback - proc. - -2000-04-14 Jeff Hobbs - - * unix/tclUnixChan.c (TtyParseMode): Only allow setting mark/space - parity on platforms that support it [Bug: 5089] - - * generic/tclBasic.c (Tcl_GetVersion): adjusted use of major/minor to - not conflict with global decl on some systems [Bug: 2882] - - * doc/AppInit.3: - * doc/Async.3: - * doc/BackgdErr.3: - * doc/CrtChannel.3: - * doc/CrtInterp.3: - * doc/CrtMathFnc.3: - * doc/DString.3: - * doc/Eval.3: - * doc/ExprLong.3: - * doc/GetInt.3: - * doc/GetOpnFl.3: - * doc/Interp.3: - * doc/LinkVar.3: - * doc/OpenFileChnl.3: - * doc/OpenTcp.3: - * doc/PkgRequire.3: - * doc/RecordEval.3: - * doc/SetResult.3: - * doc/SplitList.3: - * doc/StaticPkg.3: - * doc/TraceVar.3: - * doc/Translate.3: - * doc/UpVar.3: - * doc/load.n: removed or updated references to interp->result use. - -2000-04-13 Jeff Hobbs - - * doc/regexp.n: doc clarification [Bug: 5037] - * doc/update.n: typo fix [Bug: 4996] - - * unix/tcl.m4 (SC_ENABLE_THREADS): enhanced the detection of - pthread_mutex_init [Bug: 4359] and (SC_CONFIG_CFLAGS) added - --enable-64bit-vis switch for Sparc VIS compilation [Bug: 4995] - -2000-04-12 Jeff Hobbs - - * doc/dde.n: corrected dde poke docs. [Bug: 4991] - -2000-04-11 Eric Melski - - * win/tclWinPipe.c: Added "CONST" keyword to declaration of char - *native in TclpCreateTempFile, to supress compiler warnings. - -2000-04-10 Brent Welch - - * generic/tcl.h: Fixed Tcl_CreateThread declaration. - * library/tcltest1.0/tcltest.tcl: Fixed the "mainThread" - initialization to work with either testthread or the thread extension - * unix/tclUnixThrd.c: Fixed compiler warning when compiling with - -DTCL_THREADS - -2000-04-10 Eric Melski - - * win/tclWinPipe.c (TclpCreateTempFile): Added conversion of contents - string from UTF to native encoding [Bug: 4030]. - - * tests/regexp.test: Added tests for infinite looping in [regexp - -all]. - - * generic/tclCmdMZ.c: Fixed infinite loop bug with [regexp -all] - [Bug: 4981]. - - * tests/*.test: Changed all occurances of "namespace import - ::tcltest" to "namespace import -force ::tcltest" [Bug: 3948]. - -2000-04-09 Brent Welch - - * lib/httpd2.1/http.tcl: Worked on the "server closes before reading - post data" case, which unfortunately causes different error cases on - Solaris, which can read the reply, and Linux and Windows, which cannot - read anything. This is all in the loop-back case - client and server - on the same host. Also unified the error handling so the "ioerror" - status goes away and errors are reflected in a more uniform way. - Updated the man page to document the behavior. - -2000-04-09 Jeff Hobbs - - * tests/reg.test (matchexpected): corrected tests to use tcltest - constraint types to skip certain tests. - - * generic/tclBasic.c (Tcl_SetCommandInfo): comment fix - - * unix/tclUnixThrd.c (Tcl_CreateThread): moved TCL_THREADS ifdef - inside of func as it is declared for non-threads builds as well. In - the non-threads case, it always returns TCL_ERROR (couldn't create - thread). - -2000-04-08 Andreas Kupries - - * Overall change: Definition of a public API for the creation of - new threads. - - * generic/tclInt.h (line 1802f): Removed the definition of - 'TclpThreadCreate'. (line 793f) Removed the definition of - 'Tcl_ThreadCreateProc'. - - * generic/tcl.h (line 388f): Readded the definition of - 'Tcl_ThreadCreateProc'. Added Win32 stuff send in by David Graveraux - to that too (__stdcall, ...). Added macros for - the default stacksize and allowed flags. - - * generic/tcl.decls (line 1356f): Added definition of - 'Tcl_CreateThread', slot 393 of the stub table. Two new arguments in - the public API, for stacksize and flags. - - * win/tclWinThrd.c: - * mac/tclMacThrd.c: Renamed TclpThreadCreate to Tcl_CreateThread, - added handling of the stacksize. Flags are currently ignored. - - * unix/tclUnixThrd.c: See above, but handles joinable flag. Ignores - the specified stacksize if the macro HAVE_PTHREAD_ATTR_SETSTACKSIZE is - not defined. - - * generic/tclThreadTest.c (line 363): See below. - - * unix/tclUnixNotfy.c (line 210): Adapted to the changes above. Uses - default stacksize and no flags now. - - * unic/tcl.m4 (line 382f): Added a check for - 'pthread_attr_setstacksize' to detect platforms not implementing this - feature of pthreads. If it is implemented, configure will define the - macro HAVE_PTHREAD_ATTR_SETSTACKSIZE (See unix/tclUnixThrd.c too). - - * doc/Thread.3: Added Tcl_CreateThread and its arguments to the list - of described functions. Removed stuff about not providing a public - C-API for thread-creation. - -2000-04-07 Jeff Hobbs - - * doc/binary.n: clarified docs on sign extension in binary scan [Bug: - 3466] - - * library/tcltest1.0/tcltest.tcl (initConstraints): removed win32s - references (no longer supported) - - * tests/fCmd.test: marked test 8.1 knownBug because it is dangerous on - poorly configured systems [Bug: 3881] and added 8.2 to keep essence of - 8.1 tested. - -2000-04-05 Andreas Kupries - - * generic/tclIO.c (Tcl_UnstackChannel, line 1831): Forcing interest - mask to the correct value after an unstack and re-initialization of - the notifier via the watchProc. Without this the first fileevent after - an unstack will come through and be processed, but no more. [Bug: ??]. - -2000-03-04 Brent Welch - - * {win,unix}/Makefile.in: added dependency of tclStubInit.c on - tcl.decls and tclInt.decls - * generic/tclThread.c: Tweak so this compiles w/out TCL_THREADS - * generic/{tcl.decls,tclStubInit.c}: Just touched the tcl.decls and - regenerated the tclStubInit.c file - -2000-03-29 Sandeep Tamhankar - - * library/http2.1/http.tcl: For the -querychannel option, fconfigure - the socket to be binary so that we don't translate anything while - reading the data. This is because we determine the content length of - the data on the channel by using seek (to the end of the file) and - tell on the file handle, and we need the content-length to match the - amount of data actually sent, and translation can affect the number of - bytes posted. - -2000-04-03 Andreas Kupries - - * Overall change: Definition of public API's for the finalization of - conditions and mutexes. [Bug: 4199]. - - * generic/tclInt.h: Removed definitions of TclFinalizeMutex and - TclFinalizeCondition. - - * generic/tcl.decls: Added declarations of Tcl_MutexFinalize and - Tcl_ConditionFinalize. - - * generic/tclThread.c: Renamed TclFinalizeMutex to Tcl_MutexFinalize. - Renamed TclFinalizeCondition to Tcl_ConditionFinalize. - - * generic/tclNotify.c: Changed usage of TclFinalizeMutex to - Tcl_MutexFinalize. - - * unix/tclUnixNotfy.c: - * generic/tclThreadTest.c: Changed usages of TclFinalizeCondition to - Tcl_ConditionFinalize. - - * generic/tcl.h: Added empty macros for Tcl_MutexFinalize and - Tcl_ConditionFinalize, to be used when the core is compiled without - threads. - - * doc/Thread.3: Added description the new API's. - -2000-04-03 Jeff Hobbs - - * generic/tclCmdIL.c (InfoVarsCmd): checked for non-NULL procPtr to - prevent itcl info override crash [Bug: 4064] - - * tests/foreach.test: - * tests/namespace.test: - * tests/var.test: Added lsorts to avoid random sorted return - problems. [Bug: 2682] - - * tests/fileName.test: fixed 14.1 test fragility [Bug: 1482] - - * tools/man2help2.tcl: fixed winhelp cross-linking error [Bug: 4156] - improved translation to winhelp [Bug: 3679] - - * unix/Makefile.in (MAN_INSTALL_DIR): patch to accept --mandir - correctly [Bug: 4085] - - * unix/dltest/pkg[a-e].c: Cleaned up test packages [Bug: 2293] - -2000-04-03 Eric Melski - - * unix/tclUnixFCmd.c (SetGroupAttribute): - * unix/tclUnixFCmd.c (SetOwnerAttribute): Added (uid_t) and (gid_t) - casts to avoid compiler warnings. - -2000-03-31 Eric Melski - - * generic/tclGet.c (Tcl_GetDouble): Added additional conditions to - error test (previously only errno was checked, but the return value of - strtod() should be checked as well). [Bug: 4118] - - * tests/exec.test: Added test for proper conversion of UTF data when - used with "<< $dataWithUTF" on exec's. - - * unix/tclUnixPipe.c (TclpCreateTempFile): Added - Tcl_UtfToExternalDString call, so that if there is UTF content in the - string it will be properly converted to the system encoding before - being written [Bug: 4030]. - (TclpCreateTempFile): Added a check on the return value of tmpnam; - some systems (Linux, for example) will start to return NULL after - tmpnam has been called TMP_MAX times; not checking for this can have - bad results (overwriting temp files, core dumps, etc.) - -2000-03-30 Jeff Hobbs - - * generic/tclBasic.c (Tcl_DeleteCommandFromToken): Added comments - noting the need to pair ckalloc with ckfree. [Bug: 4262] - - * generic/tclInt.decls: - * generic/tclIntPlatDecls.h: - * generic/tclStubInit.c: - * win/tclWin32Dll.c: removed TclWinSynchSpawn (vestige of Win32s - support). - - * win/tclWinReg.c: made use of TclWinGetPlatformId instead of getting - info again - - * win/tclWinPort.h: - * win/Makefile.in: - * win/configure.in: - * win/tcl.m4: Added support for gcc/mingw on Windows [Bug: 4234] - -2000-03-29 Jeff Hobbs - - * generic/tclCompile.c (TclCleanupByteCode): made ByteCode cleanup - more aware of TCL_BYTECODE_PRECOMPILED flagged structs (gen'd by - tbcload), to correctly clean them up. - - * generic/tclClock.c (FormatClock): moved check for empty format - earlier, commented 0 result return value - -2000-03-29 Sandeep Tamhankar - - * library/http2.1/http.tcl: Removed an unnecessary fileevent statement - from the error processing part of the Write method. Also, fixed two - potential memory leaks in wait and reset, in which the state array - wasn't being unset before throwing an exception. Prior to this - version, Brent checked in a fix to catch a fileevent statement that - was sometimes causing a stack trace when geturl was called with - -timeout. I believe Brent's fix is necessary because TLS closes bad - sockets for secure connections, and the fileevent was trying to act on - a socket that no longer existed. - -2000-03-27 Jeff Hobbs - - * tests/httpd: removed unnecessary 'puts stderr "Post Dispatch"' - - * tests/namespace.test: - * generic/tclNamesp.c (Tcl_Export): added a uniq'ing test to the - export list so only one instance of each export pattern would exist in - the list. - - * generic/tclExecute.c (TclExecuteByteCode): optimized case for the - empty string in ==/!= comparisons - -2000-03-27 Eric Melski - - * unix/tclUnixChan.c: Added (off_t) type casts in lseek() call [Bug: - 4409]. - - * unix/tclLoadAout.c: - * unix/tclUnixPipe.c: Added (off_t) type casts in lseek() calls [Bug: - 4410]. - -2000-03-22 Sandeep Tamhankar - - * library/http2.1/http.tcl: Fixed a bug where string query data that - was bigger than queryblocksize would get duplicate characters at block - boundaries. - -2000-03-22 Sandeep Tamhankar - - * library/http2.1/http.tcl: Fixed bug 4463, where we were getting a - stack trace if we tried to publish a project to a good host but a port - where there was no server listening. It turned out the problem was a - stray fileevent that needed to be cleared. Also, fixed a bug where - http::code could stack trace if called on a bad token (one which - didn't represent a successful geturl) by adding an http element to the - state array in geturl. - -2000-03-21 Eric Melski - - * tests/clock.test: Modified some tests that were not robust with - respect to the time zone in which they were run and were thus failing. - - * doc/clock.n: Clarified meaning of -gmt with respect to -base when - used with [clock scan] (-gmt does not affect the interpretation of - -base). - -2000-03-19 Sandeep Tamhankar - - * library/http2.1/http.tcl: geturl used to throw an exception when the - connection failed; I accidentally returned a token with the error - info, breaking backwards compatibility. I changed it back to throwing - an exception, but unsetting the state array first (thus still - eliminating the original memory leak problem). - -2000-03-19 Sandeep Tamhankar - - * library/http2.1/http.tcl: Added -querychannel option and altered - some of Brent's modifications to allow asynchronous posts (via - -command). Also modified -queryprogress so that it calls the query - callback as to be - consistent with -progress. Added -queryblocksize option with default - 8192 bytes for post blocksize. Fixed a bunch of potential memory leaks - for the case when geturl receives bad args or can't open a socket, - etc. Overall, the package really rocks now. - - * doc/http.n: Added -queryblocksize, -querychannel, and - -queryprogress. Also, changed the description of -blocksize, which - states that the -progress callback will be called for each block, to - now qualify that with an "if -progress is specified". - - * tests/http.test: Added a querychannel test for synchronous and - asynchronous posts, altered the queryprogress test such that the - callback conforms to the -progress format. Also, had to use the - -queryblocksize option to do the post 16K at a time to match Brent's - expected results (and to test that -queryblocksize works). - -2000-03-15 Brent Welch - - * library/http2.1/http.tcl: Added -queryprogress callback to - http::geturl and also changed it so that writing the post data is - event driven if the queryprogress callback or a timeout is given. - This allows a timeout to occur when writing lots of post data. The - queryprogress callback is called after each block of query data is - posted. It has the same signature as the -progress callback. - -2000-03-06 Eric Melski - - * library/package.tcl: Applied patch from Bug: 2570; rather than - setting geometry of slave interp to 0x0 when Tk was loaded, it now - does "wm withdraw .". Both remove the main window from the display, - but the former caused some internal structures to get initialized to - zero, which caused crashes with some extensions. - -2000-03-02 Jeff Hobbs - - * library/package.tcl (tclPkgUnknown): extended to allow recognizes - changes in the auto_path while sourcing in other pkgIndex.tcl files - - * doc/FindExec.3: fixed doc for declaration of Tcl_FindExecutable - [Bug: 4275] - - * generic/tclFileName.c (Tcl_TranslateFileName): Applied patch from - Newman to significantly speedup file split/join on Windows (replaces - regexp with custom parser). [Bug: 2867] - - * win/README.binary: change mailing lists from @consortium.org to - @scriptics.com [Bug: 4173] - -2000-02-28 Eric Melski - - * tests/clock.test: Added test for ISO bases < 100000 - - * generic/tclDate.c: (generated on Solaris) - * generic/tclGetDate.y: Changed condition for deciding if a number is - an ISO 8601 base from number >= 100000 to numberOfDigits >= 6. - Previously it would fail to recognize 000000 as an ISO base. - -2000-02-14 Eric Melski - - * unix/Makefile.in: Added rpm target to generate Tcl binary RPM. - - * unix/tcl.spec: RPM specification file for a Tcl binary RPM for - Linux. - -2000-02-10 Jeff Hobbs - - 8.3.0 RELEASE - - * changes: updated for 8.3.0 release - - * doc/load.n: added notes about dll load errors on Windows - - * unix/README: - * unix/Makefile.in (dist): removed porting.notes and porting.old from - distribution and CVS. The information was very outdated. Now refer to - http://dev.scriptics.com/services/support/platforms.html - - * tests/unixInit.test: fixed japanese LANG encoding test [Bug: 3549] - - * unix/configure.in: - * unix/tcl.m4: correct CFLAG_WARNING setting, fixed gcc config for - AIX, added -export-dynamic to LDFLAGS for FreeBSD-3+ [Bug: 2998] - - * win/tclWinLoad.c (TclpLoadFile): improved error message for load - failures, could perhaps be even more intelligent. - -2000-02-09 Jim Ingham - - * mac/tclMacSock.c: Don't panic when you get an error closing an async - socket. This doesn't seem to hurt anything, and we return the error so - the caller can do the right thing. - - New Files: - * mac/MW_TclHeader.h: - * mac/MW_TclTestHeader.h: - * mac/MW_TclTestHeader.pch: - * mac/MW_TclAppleScriptHeader.h: More convenient to use .h prefix - files in the preference panels... - - The above are curtesy of Daniel Steffen (steffen@math.mq.edu.au) - -2000-02-08 Eric Melski - - * tests/clock.test: Added tests for "next monthname" constructs. - * generic/tclDate.c: - * generic/tclGetDate.y (Message): Added a grammar rule for "next - monthname" so that we can handle "next january" and similar constructs - (bug #4146). - -2000-02-08 Jeff Hobbs - - * README: - * tools/tcl.wse.in: - * unix/configure.in: - * win/configure.in: - * win/README: - * win/README.binary: - * generic/tcl.h (TCL_RELEASE_SERIAL): Moved to 8.3.0 patchlevel - - * doc/library.n: - * library/auto.tcl: fixed crufty puts code and docs [Bug: 4122] - - * library/tcltest1.0/tcltest.tcl: correctly protected searchDirectory - list to allow dirnames with spaces - - * unix/tcl.m4: changed all -fpic to -fPIC - - * generic/tclDecls.h: - * generic/tcl.decls: change Tcl_GetOpenFile to use decl of 'int - forWriting' instead of 'int write' to avoid shadowing [Bug: 4121] - - * tests/httpold.test: changed test script to source in the httpd - server procs from httpd instead of having its own set. - - * tests/httpd: improved query support in test httpd to handle fix in - http.tcl. [Bug: 4089 change 2000-02-01] - - * unix/README: fixed notes about --enable-shared and add note about - --disable-shared. - -2000-02-07 Eric Melski - - * tests/package.test: - * library/tclIndex: - * library/package.tcl: Renamed ::package namespace to ::pkg. - -2000-02-03 Eric Melski - - * doc/Package.n: - * doc/packagens.n: Renamed Package.n -> packagens.n because Windows - can't deal with case-sensitive names. - -2000-02-02 Jeff Hobbs - - * tests/regexp.test: added tests for -all and -inline switches - * doc/regexp.n: added docs for -all and -inline switches - * generic/tclCmdMZ.c (Tcl_RegexpObjCmd): added extra comments for new - -all and -inline switches to regexp command - -2000-02-01 Eric Melski - - * library/init.tcl: Applied patch from rfe 1734 regarding auto_load - errors not setting error message and errorInfo properly. - -2000-02-01 Jeff Hobbs - - * win/Makefile.in (install-*): reduced verbosity of install - - * generic/tclFileName.c (Tcl_JoinPath): improved support for special - QNX node id prefixes in pathnames [Bug: 4053] - - * library/http1.0/http.tcl: - * library/http2.1/http.tcl: The query data POSTed was newline - terminated when it shouldn't be altered [Bug: 4089] - -2000-01-31 Eric Melski - - * tests/package.test: - * library/tclIndex: - * library/package.tcl: Added ::package namespace and ::package::create - function. - - * library/init.tcl: Fixed problem with auto_load and determining if - commands were loaded. - - * library/auto.tcl: "Fixed" issues with $ in files to be auto indexed. - - * doc/Package.n: New man page for package::create function. - - * doc/pkgMkIndex.n: Added additional information. - - * doc/library.n: Added additional qualification regarding auto_mkindex. - -2000-01-28 Eric Melski - - * tests/pkg/magicchar2.tcl: - * tests/autoMkindex.test: Test for auto loader fix (bug #2480). - - * library/init.tcl: auto_load was using [info commands $name] to - determine if a given command was available; if the command name had * - or [] it, this would fail because info commands uses glob-style - matching. This is fixed. (Bug #2480). - - * tests/pkg/spacename.tcl: - * tests/pkgMkIndex.test: Tests for fix for bug #2360. - - * library/package.tcl: Fixed to extract only the first element of the - list returned by auto_qualify (bug #2360). - - * tests/pkg/magicchar.tcl: - * tests/autoMkindex.test: Test for fix for bug #2611. - - * library/auto.tcl: Fixed the regular expression that performs $ - escaping before sourcing a file to index. It was erroneously adding \ - escapes even to $'s that were already escaped, effectively - "un-escaping" those $'s. (bug #2611). - -2000-01-27 Eric Melski - - * tests/autoMkindex.test: - * library/auto.tcl: Applied patch (with slight modification) from bug - #2701: auto_mkIndex uses platform dependent file paths. Added test for - fix. - -2000-01-27 Jennifer Hom - - * library/tcltest1.0/tcltest.tcl: Changed NormalizePath to - normalizePath and exported it as a public proc. This proc creates an - absolute path given the name of the variable containing the path to - modify. The path is modified in place. - * library/tcltest1.0/pkgIndex.tcl: Added normalizePath. - * tests/all.tcl: Changed code to use normalizePath. - -2000-01-27 Eric Melski - - * tests/pkg/samename.tcl: test file for bug #1983 - - * tests/pkgMkIndex.test: - * doc/pkgMkIndex.n: - * library/package.tcl: Per rfe #4097, optimized creation of direct - load packages to bypass computing the list of commands added by the - new package. Also made direct loading the default, and added a -lazy - option. - Fixed bug #1983, dealing with pkg_mkIndex incorrectly handling - situations with two procs by the same name but in different namespaces - (ie, foo::baz and bar::baz). - -2000-01-26 Eric Melski - - * generic/tclNamesp.c: Undid fix for #956, which broke backwards - compatibility. - - * doc/variable.n: - * doc/trace.n: - * doc/namespace.n: - * doc/info.n: Added further information about differences between - "namespace which" and "info exists". - - * doc/SetErrno.3: Added descriptions of ErrnoId() and ErrnoMsg() - functions. - -2000-01-25 Jeff Hobbs - - * unix/tcl.m4: modified EXTRA_CFLAGS to add -DHAVE_TZSET for OSF1-V* - and ULTRIX-4.* when not using gcc. Also added higher min stack size - for OSF1-V* when building with threads. [Bug: 4063] - - * generic/tclClock.c (FormatClock): inlined resultPtr, as it - conflicted with var creation for HAVE_TZSET #def [Bug: 4063] - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): fixed potential leak when - calling lsort -command with bad command [Bug: 4067] - - * generic/tclFileName.c (Tcl_JoinPath): added support for special QNX - node id prefixes in pathnames [Bug: 4053] - - * doc/ListObj.3: clarified Tcl_ListObjGetElements docs [Bug: 4080] - - * doc/glob.n: clarified Mac path separator determination docs. - - * win/makefile.vc: added some support for building helpfile on Windows - -2000-01-23 Jeff Hobbs - - * library/init.tcl (auto_execok): added 'start' to list of recognized - built-in commands for COMSPEC on NT. [Bug: 2858] - - * unix/tclUnixPort.h: moved include of lower since some - systems (UTS) require sys/types.h to be included first [Bug: 4031] - - * unix/tclUnixChan.c (CreateSocketAddress): changed comparison with -1 - to 0xFFFFFFFF, to ensure 32 bit comparison even on 64 bit systems. - [Bug: 3878] - - * generic/tclFileName.c: improved guessing of path separator for the - Mac. (Darley) - - * generic/tclInt.h: - * generic/tcl.decls: moved Tcl_ProcObjCmd to stubs table [Bug: 3827] - and removed 'register' from stub definition of - Tcl_AppendUnicodeToObj [Bug: 4038] - -2000-01-21 Eric Melski - - * unix/mkLinks: - * doc/GetHostName.3: Man page for Tcl_GetHostName (bug #1817). - - * doc/lreplace.n: Corrected man page with respect to treatment of - empty lists, and "prettied up" the page. (bug #1705). - -2000-01-20 Eric Melski - - * tests/namespace.test: Added test for undefined variables with - namespace which (bug #956). - - * generic/tclNamesp.c: Added check for undefined variables in - NamespaceWhichCmd (bug #956). - - * tests/var.test: Added tests for corrected variable behavior (bug - #981). - - * doc/upvar.n: Expanded explanation of upvar behavior with respect to - variable traces. (bugs 3917 1433 2110). - - * generic/tclVar.c: Changed behavior of variable command when name - refers to an element in an array (ie, "variable foo(x)") to always - return an error, regardless of existance of that element in the array - (now behavior is consistant with docs too) (bug #981). - -2000-01-20 Jeff Hobbs - - * generic/tclCmdIL.c (InfoBodyCmd): made [info body] return a string - if the body has been bytecompiled. - * generic/tclBasic.c (Tcl_EvalObjEx): added pedantic check for - originating proc body of bytecompiled code, #def'd out as the change - for [info body] should make it unnecessary - - * unix/tclUnixNotfy.c (Tcl_InitNotifier): added cast for tsdPtr - - * tests/set.test: added test for complex array elem name compiling - * generic/tclCompCmds.c (TclCompileSetCmd): Fixed parsing of array - elements during compiling, and slightly optimised same [Bug: 3889] - - * doc/tclvars.n: added definitions for tcl_(non)wordchars - - * doc/vwait.n: added notes about requirement for vwait var being - globally scoped [Bug: 3329] - - * library/word.tcl: changed tcl_(non)wordchars settings to use new - unicode regexp char class escapes instead of char sequences - -2000-01-14 Eric Melski - - * tests/var.test: Added a test for the array multiple delete - protection in Tcl_UnsetVar2. - - * generic/tclVar.c: Added protection in Tcl_UnsetVar2 against attempts - to multiply delete arrays when unsetting them (bug #3453). This could - happen if there was an unset trace on an array element and the trace - proc made a global or upvar link to the array, and then the array was - unset at the global level. See the bug reference for more information. - - * unix/tclUnixTime.c: New clock format format. - - * compat/strftime.c: New clock format format. - - * generic/tclGetDate.y: New clock scan format. - -2000-01-13 Jeff Hobbs - - * changes: updated changes file to reflect 8.3b2 mods - - * README: - * generic/tcl.h: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.m4: - * win/README.binary: - * win/configure.in: updated to patchlevel 8.3b2 - - * generic/regexec.c: added var initialization to prevent compiler - warning - -2000-01-13 Eric Melski - - * tests/cmdIL.test: Added tests for lsort -dictionary with characters - that occur between Z and a in ASCII. - - * generic/tclCmdIL.c: Modified DictionaryCompare function (used by - lsort -dictionary) to do upper/lower case equivalency before doing - character comparisons, instead of after. This fixes bug #1357, in - which lsort -dictionary [list ` AA c CC] and lsort -dictionary [list - AA c ` CC] gave different (and both wrong) results. - -2000-01-12 Eric Melski - - * tests/clock.test: Added tests for "next " and - "" - Added tests for "monday 1 week ago", etc, from RFE #3671. - - * doc/tests/clock.test: Added numerous tests for clock scan. - - * doc/generic/tclGetDate.y: Fixed some shift/reduce conflicts in clock - grammar. - - * doc/doc/clock.n: Added documentation for new supported clock scan - formats and additional explanation of daylight savings time correction - algorithm. - -2000-01-12 Jeff Hobbs - - * doc/file.n: - * tests/unixFCmd.test: - * unix/tclUnixFCmd.c: added support for symbolic permissions setting - in SetPermissionsAttribute (file attr $file -perm ...) [Bug: 3970] - - * generic/tclClock.c: fixed support for 64bit handling of clock values - [Bug: 1806] - - * generic/tclThreadTest.c: upped a buffer size to hold double - - * tests/info.test: - * generic/tclCmdIL.c: fixed 'info procs ::namesp::*' behavior (Dejong) - - * generic/tclNamesp.c: made imported commands also import their - compile proc [Bug: 2100] - - * tests/expr.test: - * unix/Makefile.in: - * unix/configure.in: - * unix/tcl.m4: recognize strtod bug on Tru64 v5.0 [Bug: 3378] and - added tests to prevent unnecessary chmod +x in sources while - installing, as well as more intelligent setsockopt/gethostbyname - checks [Bug: 3366, 3389] - - * unix/tclUnixThrd.c: added compile time support (through use of the - TCL_THREAD_STACK_MIN define) for increasing the default stack size for - a thread. [Bug: 3797, 1966] - -2000-01-11 Eric Melski - - * generic/tclGetDate.y: Added comments for the Convert function. Added - a fix for daylight savings time handling for relative time spans of - days, weeks or fortnights. (bug 3441, 3868). - - * generic/tclDate.c: Fixed compiler warning issues. - -2000-01-10 Jeff Hobbs - - * compat/waitpid.c: use pid_t type instead of int [Bug: 3999] - - * tests/utf.test: fixed test that allowed \8 as octal value - * generic/tclUtf.c: changed Tcl_UtfBackslash to not allow non-octal - digits (8,9) in \ooo substs. [Bug: 3975] - - * generic/tcl.h: noted need to change win/tcl.m4 and - tools/tclSplash.bmp for minor version changes - - * library/http2.1/http.tcl: trim value for $state(meta) key - - * unix/tclUnixFile.c: fixed signature style on functions - - * unix/Makefile.in: made sure tcl.m4 would be installed with dist - - * unix/tcl.m4: added ELF support for NetBSD [Bug: 3959] - -2000-01-10 Eric Melski - - * generic/tclGetDate.y: Added rules for ISO 8601 formats (BUG #847): - CCYY-MM-DD - CCYYMMDD - YY-MM-DD - YYMMDD - CCYYMMDDTHHMMSS - CCYYMMDD HHMMSS - CCYYMMDDTHH:MM:SS - Fixed "clock scan " to scan the number as an hour for the - current day, rather than a minute after 00:00 for the current day - (bug #2732). - -2000-01-07 Eric Melski - - * generic/tclClock.c: Changed switch in Tcl_ClockObjCmd to use - enumerated values instead of constants. (ie, COMMAND_SCAN instead of - 3). diff --git a/ChangeLog.2001 b/ChangeLog.2001 deleted file mode 100644 index 06e7c36..0000000 --- a/ChangeLog.2001 +++ /dev/null @@ -1,3629 +0,0 @@ -2001-12-28 Jeff Hobbs - - * library/init.tcl: make sure env(COMSPEC) on Windows is executed with - the right case, as it may otherwise fail inexplicably. - -2001-12-28 Don Porter - - * generic/tclCkalloc.c (MemoryCmd, TclFinalizeMemorySubsystem): Added - the [memory onexit] command, intended to replace [checkmem]. - - * doc/DumpActiveMemory.3: - * doc/memory.n: Updated documentation for [memory] and related - matters. [Bug 487677] - - * mac/tclMacBOAMain.c (Tcl_Main, CheckmemCmd): Removed all the - machinery for the [checkmem] command that is completely duplicated by - code in generic/tclCkalloc.c. - - * generic/tclBinary.c: - * generic/tclListObj.c: - * generic/tclObj.c: - * generic/tclStringObj.c: Removed references to [checkmem] in - comments, referencing [memory active] instead, since it is - documented. - -2001-12-28 Daniel Steffen - - * mac/tclMacInit.c: - * mac/tclMacTclCode.r: synced up tclInit features to unix/win: - implemented TclSetPreInitScript support, use of existing tclInit proc - if defined, check of default encoding dir if set. Changed script - library resource names to lowercase (i.e. same as corresponding - files). Used Tcl_JoinPath instead of string append. Check that system - encoding could be loaded before utf translating the LibraryPath. - * mac/tclMacApplication.r: - * mac/tclMacLibrary.r: - * mac/tclMacOSA.r: - * mac/tclMacResource.r: minor version resources cleanup - -2001-12-21 Mo DeJong - - * unix/tcl.m4 (SC_PATH_TCLCONFIG, SC_PATH_TKCONFIG): - Search for config file using exec_prefix instead of prefix when no - --with-tcl or --with-tk argument is used. [Bug 492418] - -2001-12-21 Daniel Steffen - - * unix/tcl.m4: fixed incorrect SHLIB_LD_LIBS setting for MacOSX / - Darwin. - * unix/configure: Regen. - * unix/mkLinks.tcl: improved case-insensitive filesystem support. - * unix/mkLinks: Regen. - -2001-12-19 Don Porter - - * unix/Makefile.in (dist): corrected use of eolFix.tcl on working - files. It should operate on distributed files. [Bug 495120] - -2001-12-19 David Gravereaux - - * tools/tcl.wse.in: Fix for [Bug 495120]. tcl.wse.in was stored in cvs - with improper . This resulted in corrupted when checked-out - on translating CVS clients such as windows (CRCRLF) and mac (CRCR). - -2001-12-19 Mo DeJong - - * unix/configure: - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Update SunOS 5.[0-6] target so that - correct linker options are passed to gcc or ld. [Tk Bug 220863] - -2001-12-19 Mo DeJong - - * unix/README: Update to account for changes in the unix/dltest - directory, the way autoconf is run, and the new "make shell" target. - -2001-12-19 Mo DeJong - - * unix/Makefile.in: Rename dltest to dlpkgs to fix problem where lib - files were not getting built because dltest/ directory already - existed. - -2001-12-19 Jeff Hobbs - - * win/tclWinSerial.c (SerialCheckProc): corrected time calculations to - be unsigned. (schroedter) - -2001-12-18 Mo DeJong - - * unix/Makefile.in: Define new dltest target that simply does a cd to - dltest/ before running make. There is no need for the separate - configure script that was previously being used. - * unix/configure: Regen. - * unix/configure.in: Subst into dltest/Makefile. - * unix/dltest/Makefile.in: Define LIBS using DL_LIBS, LIBS, and - MATH_LIBS variables instead of TCL_LIBS variable from tclConfig.sh. - * unix/dltest/README: Update readme to account for new configure free - implementation. - * unix/dltest/configure: Removed. - * unix/dltest/configure.in: Removed. - -2001-12-18 Donal K. Fellows - - * generic/tcl.h (TCL_STUB_MAGIC): Added cast to force type to be an - int and get rid of a persistent and pointless warning with SunPro - compiler. - - * generic/tclCkalloc.c (Tcl_AttemptDbCkalloc,Tcl_AttemptDbCkrealloc): - * generic/tcl.decls (Tcl_AttemptDbCkalloc,Tcl_AttemptDbCkrealloc): - Made the file parameters to these functions into CONST char *, like - they always should have been to match the other Tcl*Db* API functions. - -2001-12-17 Andreas Kupries - - * Applied [Bug 219311] on behalf of Rolf Schroedter - to prevent fcopy on serial ports - from flooding the event queue. - -2001-12-11 Miguel Sofer - - * doc/CrtInterp.3: - * generic/tclBasic.c: docs and comments corrections. [Bug 493412] - Bug & patch by Don Porter. - -2001-12-14 Donal K. Fellows - - * win/tclWinNotify.c (Tcl_FinalizeNotifier): Stop Tcl on Windows from - crashing when shutdown from a non-Tcl thread. Fixes [Bug 217982] - [orig. 5804] reported by Hugh Vu and Gene Leache. I'm not convinced - that the shutdown process is right even with this, but it was - definitely wrong without... - -2001-12-13 Andreas Kupries - - * win/tclWinSock.c (TcpGetOptionProc): Fix for [Bug 478565] reported - by an unknown person. Bypasses all calls to "gethostbyaddr" for - address "0.0.0.0" to prevent delays on Win/NT. - -2001-12-12 Jeff Hobbs - - * doc/Preserve.3: doc'd TCL_DYNAMIC use. [Patch 483989] (porter) - -2001-12-12 Andreas Kupries - - * generic/tclIO.c (Tcl_GetsObj): Applied patch for [Bug 491341] as - provided by Don Porter . Fixes the - assumption of having an empty Tcl_Obj to work with. - -2001-12-11 Miguel Sofer - - * generic/tclCompCmds.c: - * generic/tclCompile.c: - * generic/tclExecute.c: consistency patch, to make all instructions - that pop a variable number of Tcl_Obj's off the execution stack take - the number of popped objects as first operand. Modified *only* the new - instructions INST_LIST_INDEX_MULTI and INST_LSET_FLAT, so this has no - effect on bytecodes generated up to tcl8.4a3 inclusive. - - * generic/tclExecute.c: fix debug messages in INST_LSET_LIST. - - * generic/tclCompCmds.c (TclCompileLindexCmd): - * generic/tclCompExpr.c (CompileMathFuncCall): removed the last two - overestimates of the necessary stack depth for bytecodes in the fix of - [Bug 483611] - -2001-12-10 Andreas Kupries - - * unix/tclUnixPipe.c (TclpCreateProcess): Applied Don Porter's patch - fixing [Bug 437489]. - -2001-12-10 Miguel Sofer - - * generic/tclEvent.c: - * tests/event.test: fix background error reporting in the absence of a - bgerror proc [Bug 219142]. - -2001-12-10 Don Porter - - * doc/Access.3: - * doc/CrtChannel.3: - * doc/DString.3: - * doc/ExprLong.3: - * doc/FileSystem.3: - * doc/GetStdChan.3: - * doc/OpenFileChnl.3: - * doc/StdChannels.3: - * doc/TCL_MEM_DEBUG.3: - * doc/Tcl_Main.3: - * doc/Utf.3: - * doc/file.n: - * doc/tclsh.1: Several typo and formatting corrections discovered - during conversion to TMML. Thanks to Joe English. [Patch 490514] - * unix/mkLinks: 'make mklinks' - -2001-12-10 Miguel Sofer - - * generic/tclCompCmds.c: - * generic/tclCompExpr.c: - * generic/tclCompile.c: - * generic/tclCompile.h: - * generic/tclExecute.c: - * generic/tclProc.c: fixed the calculation of the maximal stack depth - required by bytecodes. [Bug 483611] - -2001-12-07 Miguel Sofer - - * generic/tclVar.c: - * tests/trace.test: restored consistency in refCount accounting by - array traces [Bug 4484339], submitted by Don Porter. - -2001-12-06 Donal K. Fellows - - * tests/parseExpr.test, tests/for.test, tests/expr.test: - * tests/expr-old.test, tests/compile.test, tests/compExpr.test - * tests/compExpr-old.test: Kept up to date with syntax errors. - * generic/tclParseExpr.c (ParsePrimaryExpr): Rewrote to give even - better syntax errors in the fairly common case of an identifier - without decorations by guessing based on the currently available - functions. Also made messages consistent between memdebug and ordinary - builds. - -2001-12-05 Miguel Sofer - - * generic/tclVar.c: - * tests/trace.test: new algorithm for [array get], safe when there are - traces that modify the array. [Bug 449893] - -2001-12-04 Donal K. Fellows - - * tests/compExpr-old.test, tests/compExpr.test, tests/compile.test: - * tests/expr-old.test, tests/expr.test, tests/for.test: - * tests/while.test, tests/if.test: Rewrite to handle more specific - syntax errors. - * tests/parseExpr.test: Rewrite to get rid of dup test numbers and - handle more specific syntax errors. - * generic/tclParseExpr.c (LogSyntaxError): Added a detail message - argument to help explain what the syntax error is. - (Tcl_ParseExpr, ParseCondExpr, ParsePrimaryExpr): Added detail - messages. - (UNKNOWN_CHAR): New lexeme for characters that are always illegal in - expressions outside strings. - -2001-12-03 Donal K. Fellows - - * doc/expr.n: Various documentation improvements in relation to the - function calls. Includes fix for [Bug 487704] submitted by Devin Eyre. - -2001-12-03 David Gravereaux - - * win/makefile.vc: Some install target bugs repaired along with - $(TCLSTUBLIB) added to the dependencies rather than implicit through - the dde and reg extensions which don't happen to always require it for - some build types. - -2001-11-30 Miguel Sofer - - * generic/tclVar.c: Tcl_Preserve'ing VarTrace structures to avoid - memory corruption. Patch for [Bug 484334] provided by Don Porter - -2001-11-29 Miguel Sofer - - * tests/namespace.test: modified namespace-41.2, added 41.3 - {knownbug} after discussion with Don Porter and Kevin Kenny. - -2001-11-29 Miguel Sofer - - * tests/namespace.test: added namespace-41.2, a simpler test for - [Bug 231259] - -2001-11-29 Donal K. Fellows - - * generic/tclBinary.c (BINARY_SCAN_MAX_CACHE, Tcl_BinaryObjCmd, - (ScanNumber): Added caching scheme to reduce number of object - allocations when doing scans of large repetitive binary strings. See - comments in file for reasoning behind implementation. Suggested by - Miguel Sofer in [Patch 429916], but independently implemented. - -2001-11-28 Donal K. Fellows - - * doc/regsub.n, doc/regexp.n: Converted dangling references to - METASYNTAX section into references to the re_syntax manual page. - -2001-11-27 D. Richard Hipp - - * win/tclWinFCmd.c: Fix a coredump in the filename normalizer code for - Win95/98. - -2001-11-27 David Gravereaux - - * win/makefile.vc: Removed the Tk reference for the 'winhelp' target. - Converge at install will need to be the solution for Tk and all other - extensions. - -2001-11-27 Donal K. Fellows - - * tests/cmdAH.test (cmdAH-24.2): Made test less sensitive to OS - preemption, but perfection isn't practical. [Bug 463189, reported by - Don Porter] - - * tests/switch.test (switch-9.*): Added tests to exercise more of the - argument checking. (switch-7.2,switch-7.3): Test changed behaviour - slightly. - * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): Reworked argument parsing to - be stricter about what it accepts. This should make uses of the - [switch] command be more maintainable. [Bug 475397, reported by Don - Porter] - -2001-11-26 Don Porter - - * generic/tclIntPlatDecls.h: 'make genstubs' after changes in - 2001-11-23 commit from Daniel Steffen. - -2001-11-24 Mo DeJong - - * unix/Makefile.in: Add comments to better describe TCL_EXE and when - it should be available. - * win/Makefile.in: Add TCL_EXE variable to be used by rules like `make - genstubs`. Don't set TCL_LIBRARY before running `make genstubs` since - we will be running with a tclsh from the PATH not the one we build. - -2001-11-24 Mo DeJong - - * win/configure: Regen. - * win/tcl.m4 (SC_CONFIG_CFLAGS): Add comctl32.lib to wish link libs. - This change was originally added to Tk on 2001-11-09 but was not - committed to Tcl. - -2001-11-23 Daniel Steffen - - * unix/Makefile.in: - * unix/configure.in: - * unix/install-sh: - * unix/mkLinks: - * unix/mkLinks.tcl: - * unix/tclLoadDyld.c: - * unix/tclMtherr.c: Mac OSX support: build system, dynamic code loading - and support for case-insensitive filesystems in mkLinks. [Patch 435258] - -2001-11-23 Daniel Steffen - - Up-port to 8.4 of mac code changes for 8.3.3 & various new changes for - 8.4, some already backported to 8.3.4. [Patch 435658] - - * generic/tclObj.c: added #include to fix missing prototype errors - - * generic/tcl.h: MAC_TCL: addition of ConditionalMacros.h and use of - DLLIMPORT and DLLEXPORT like on other platforms. ( => no longer need - the .exp files and can remove use of #pragma export that never worked - well) - removed line continuation in #if clause as this breaks the mac - resource compiler (note that *.r files include tcl.h) - - * mac/tclMacFile.c: fixed bug in permission checking code - - * mac/tclMacLoad.c: corrected utf8 handling, comparison of package - names to code fragment names changed to only match on the length of - package name, this allows for fragment names with version numbers - appended. - - * mac/tclMacInt.h: - * generic/tclInt.h: - * mac/tclMacTime.c: - * generic/tclIOUtil.c: moved declaration of TclpGetGMTOffset() - - * mac/tclMacShLib.exp: - * mac/tclMacOSA.exp: - * mac/tclMacMSLPrefix.h: removed files - - * unix/Makefile.in: removed reference to .exp files - - * mac/MW_TclBuildLibHeader.h: - * mac/MW_TclBuildLibHeader.pch: - * mac/MW_TclHeaderCommon.h: - * mac/MW_TclStaticHeader.h: - * mac/MW_TclStaticHeader.pch: new precompiled header files - - * mac/MW_TclAppleScriptHeader.pch: - * mac/MW_TclHeader.pch: - * mac/MW_TclTestHeader.pch: - * mac/tclMacCommonPch.h: revised precompiled header handling: now - include a common header file 'MW_TclHeaderCommon.h' from all .pch - files, the .pch files themselves now only setup #defines (e.g. - BUILD_tcl, STATIC_BUILD, TCL_DEBUG, TCL_THREADS) like in makefiles on - other platforms. - - * mac/tclMac.h: - * mac/tclMacPort.h: - * mac/tclMacInt.h: use of BUILD_tcl and TCL_STORAGE_CLASS like on other - platforms, standardize #include'd files to what's done on other - platforms, removed use of #pragma export. - - * mac/tcltkMacBuildSupport.sea.hqx: new archive of mac build support - files & suggested build environment directory hierarchy: - 'Building MacTclTk' & 'CW Pro6 changes' readme's. - projects for MoreFiles 1.5.2 static & shared libraries. - project & sources for 'pseudoCarbonSupport', see below. - included XML versions of the projects for CW Pro5 or Pro7 users. - - * mac/tclMacProjects.sea.hqx: updated mac build project files: - build support for CodeWarrior Pro6, UnivIntf 3.4 & shared runtime - libraries: the MSL libraries and MoreFiles are no longer compiled into - Tcl.shlb, all non-static binaries now use the Pro6 shared runtime - libraries and MoreFiles.shlb. These shlbs are merged into the standard - Wish and TclShell, but 3rd party applications linking with Tcl.shlb or - Tk.shlb need to setup access to them. (see the "(sh-ppc)" targets - for how to do this.) - included XML versions of the projects for CW Pro5 or Pro7 users. - use compat/strtod.c instead of MSL's strtod() - use WASTE versions of MSL for tcl test target to avoid text buffer - cutoff at 32k. - Merging the full MSL.shlb and the other shlbs into Wish & TclShell - makes them a bit larger than before, use unmerged binaries to avoid - copying the shared code with every application, e.g. when deploying - numerous Wish based droplets. - Note that using CW Pro5 to compile extensions is in principle still - possible, but need to link with Pro6 runtime libraries. - Tclapplescript now loads and runs on CFM68k. - Highly experimental "pseudoCarbon" support for Tcl only on OS 8/9: - binaries in "Build:(Carbon):" link against CarbonLib instead of - InterfaceLib, however the actual code has not been carbonized! i.e. it - will not run on OSX and may not even run properly with CarbonLib. - This should in principle allow you to build & test OS9 CFM Carbon - binaries that need to link with Tcl.shlb. On OSX you can use the - native Tcl.framework, but you have to build a MachO binary as there - is no CFM glue lib for Tcl.framework. - the library pseudoCarbonSupport.shlb manually loads the symbols from - InterfaceLib that are not in CarbonLib but are needed by the - uncarbonized code in Tcl.shlb and TclShell. - - * generic/tclMain.c: MAC_TCL: workaround for broken/non-standard isatty - on MW Pro6, #include instead of defining isatty - - * mac/tclMacPort.h: MW Pro6 changes for MSL fcntl.h, stat.h & isatty - - * mac/tclMacAppInit.c: add EXTERN to InstallConsole to enable DLL - export via the TCL_STORAGE_CLASS mechanism. - - * mac/tclMacFCmd.c: fix for FSpDirectoryCopy API change - - * mac/tclMacLibrary.c: emit compile time error when - TCL_REGISTER_LIBRARY and USE_TCL_STUBS are both defined at the same - time in an extension, this use is not currently supported and will - result in a crash when dynamically loading the extension. - - * mac/tclMacApplication.r: - * mac/tclMacLibrary.r: - * mac/tclMacOSA.r: - * mac/tclMacResource.r: fixed obsolete copyrights/dates in version - strings; updated version strings to standard usage; added support for - '(Support Libraries)' subfolder for shared runtime libraries in - unmerged binaries; commented out demo setting of "Tcl Environment - Variables"; reorganized resources among these files to avoid multiple - copies in applications and shared libraries, the script libraries are - now no longer duplicated in Tclsh but are only included in the - resources of Tcl.shlb. - - * mac/tclMacChan.c: - * mac/tclMacSock.c: cast for *BlockMode - - * mac/tclMacUtil.c: - * mac/tclMacMath.h: removed obsolete hypot() definition - - * generic/tclIntPlatDecls.h: - * generic/tclInt.decls: - * generic/tclStubInit.c: - * mac/tclMacNotify.c: - * mac/tclMacOSA.c: - * mac/tclMacUtil.c: - * generic/tclThreadTest.c: renamed routines conflicting with standard - Apple or MoreFiles headers (at compile or link time): - GetGlobalMouse -> GetGlobalMouseTcl - FSpGetDirectoryID -> FSpGetDirectoryIDTcl - FSpOpenResFileCompat -> FSpOpenResFileCompatTcl - FSpCreateResFileCompat -> FSpCreateResFileCompatTcl - NewThread -> NewTestThread - the renamed MoreFiles *Tcl routines are just wrappers calling into the - MoreFiles DLL. - - * mac/tclMacCommonPch.h: - * mac/tclMacThrd.c: - * mac/tclMacPanic.c: removed OLDROUTINENAMES define, renamed obsolete - apple API names to modern equivalents; UH3.4 support: added #include - , updated New*Proc() calls to New*UPP(). - - * mac/tclMacUnix.c: added missing (Tcl_Obj ***) cast to - Tcl_ListObjGetElements call - - * mac/tclMacAlloc.c: modernized TclpSysAlloc() to use temporary memory - instead of system heap memory when available (MacOS >= 7.5 and - possibly earlier, use of system heap has been discouraged for a long - time and has many disadvantages, e.g. memory isn't paged out, and - errors can very easily bring the system down); fixed crashing bug in - TclpSysRealloc() and CleanUpExitProc() where memory was being accessed - after having been deallocated; fixed memory leak in (de)allocation - code (for every block ever allocated with TclpSysAlloc, a Ptr was - leaked), if temporary memory is available, don't track allocated - memory, instead use RecoverHandle() to get Handle from Ptr, otherwise - use doubly linked list to correctly track memory and free all - allocated memory; added new option for ConfigureMemory: - MEMORY_DONT_USE_TEMPMEM, disables use of temporary memory even when it - would be available, only necessary when writing e.g. a driver (using - tcl??); increased fraction of application heap reserved for OS - routines to 512K - - * compat/strftime.c: - * mac/tclMacTime.c: - * mac/tclMacPort.h: - * generic/tclInt.decls: - * generic/tclIntPlatDecls.h: - * generic/tclStubInit.c: timezone support for mac via TclpGetTZName() - like on windows, using an inverse timezone table adapted from - tclDate.c to map gmtoffset in seconds gotten from the MacOS APIs to a - timezone string, as there is no good way to get this info from MacOS. - I had to make up some unusual timezones and arbitrarily decide on the - most standard of the multiple choices available for every timezone. - - * generic/tclExecute.c: workaround for a MSL bug/misfeature: for very - small floats, MSL can return errno ERANGE but a non-zero value (< - LDBL_MIN however) - - * mac/tclMacAppInit.c: support for WASTE text library using temporary - memory, setting has no effect if WASTE is not used. - - * mac/tclMacPanic.c: removed duplicate code from generic/tclPanic.c - and added that file to projects instead. - - * tests/all.tcl: set tcltest::singleProcess 1 as multiple processes - are not available on the mac. - - * tests/cmdAH.test: access time not available on the mac, skip the - atime touch test - - * tests/appendComp.test: - * tests/cmdMZ.test: - * tests/compile.test: - * tests/exec.test: - * tests/fileName.test: - * tests/lset.test: - * tests/namespace.test: - * tests/tcltest.test: added missing cleanups/tests/catches that caused - tests to fail on the mac. - - * doc/tclvars.n: doc bug, env(PWD) should be env(HOME) [Bug 463834] - -2001-11-21 Don Porter - - * tests/trace.test (trace-8.8): Corrected test for Bug 219393. - - * generic/tclBasic.c (Tcl_DeleteCommandFromToken,CallCommandTraces): - * generic/tclCmdMZ>c (Tcl_UntraceCommand): Added Tcl_Preserve and - Tcl_Release calls to prevent deletion of CommandTrace structures until - all callers are done using them, preventing memory corruption. [Bug - 453805] - -2001-11-20 Kevin B. Kenny - - * doc/GetTime.3 (Tcl_GetTime): - * generic/tcl.decls (Tcl_GetTime): - * generic/tclClock.c (Tcl_ClockObjCmd): - * generic/tclCompile.c (TclCleanupByteCode, TclInitByteCodeObj): - * generic/tclCmdMZ.c (Tcl_TimeObjCmd): - * generic/tclUtil.c (TclpGetTime): - * generic/tclTest.c (GetTimesCmd): - * generic/tclTimer.c (Tcl_CreateTimerHandler, TimerSetupProc, - (TimerCheckProc, TimerHandlerEventProc): - * mac/tclMacNotify.c (Tcl_SetTimer): - * mac/tclMacShLib.exp (Tcl_GetTime): - * mac/tclMacTime.c (Tcl_GetTime): - * unix/tclUnixChan.c (TclUnixWaitForFile): - * unix/tclUnixEvent.c (Tcl_Sleep): - * unix/tclUnixThrd.c (Tcl_ConditionWait): - * unix/tclUnixTime.c (Tcl_GetTime): - * win/tclWinNotify.c (Tcl_Sleep): - * win/tclWinTest.c (TestwinclockCmd): - * win/tclWinTime.c (TclpGetSeconds, TclpGetClicks, Tcl_GetTime): - Changed all uses of TclpGetTime to Tcl_GetTime. Added Tcl_GetTime to - the Stubs table and the library documentation. Added a TclpGetTime in - tclUtil.c for backward compatibility of extensions. [Patch 483500, - TIP#73] - - * generic/tclCmdMZ.c (Tcl_TimeObjCmd): Corrected an error in the - [time] command that caused incorrect results to be returned if the - total duration of all iterations exceeded 2**31 microseconds. [Bug - 478847] - - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclStubInit.h: Reran 'make genstubs' - -2001-11-20 Miguel Sofer - - * generic/tclBasic.c - * generic/tclCompile.h: - * generic/tclExecute.c: moving all code relative to bytecodes from - tclBasic.c to tclExecute.c - the functions RecordTracebackInfo and - Tcl_ExprObj went to tclExecute.c, and new interface function was - defined (TclCompEvalObj). - The final objective of this sequence of moves is to provide a clean, - clear-cut interface between Tcl's core and the compiler/engine - subsystem. - -2001-11-20 Miguel Sofer - - * generic/tclBasic.c - * generic/tclCompile.h: - * generic/tclExecute.c: factoring out of common code in tclBasic.c - (new function TclInterpReady defined: it resets the interp's result, - then checks that it hasn't been deleted and that the nesting level is - acceptable). Passed the responsibility of calling it to the *callers* - of TclEvalObjvInternal. - -2001-11-20 Miguel Sofer - - * generic/tclBasic.c - * generic/tclExecute.c: a better variant of the previous-to-last - commit (restoring numLevels computations). The managing of the levels - now has to be done by the *callers* of TclEvalObjvInternal - -2001-11-20 Miguel Sofer - - * generic/tclExecute.c: missing variable declaration under - TCL_COMPILE_DEBUG. - -2001-11-20 Miguel Sofer - - * generic/tclExecute.c: - * generic/tclProc.c: restoring the computations of iPtr->numLevels to - the original logic (previous to buggy modifs on 2001-11-16). - -2001-11-20 Jeff Hobbs - - * tools/eolFix.tcl (new-file): - * unix/Makefile.in: added EOL correction for Windows bat files to - dist target. [Bug 219409] (davygrvy) - - * unix/tclUnixInit.c (TclpSetInitialEncodings): update of patch from - 2001-11-16 that uses the old Tcl encoding check mechanism as a - fallback to the original. Also added a TCL_DEFAULT_ENCODING #define - (defaults to iso8859-1). Tcl will first try setlocale and nl_langinfo, - and if that fails, guess based on certain LANG|LC_* env vars. [Patch - 418645] - -2001-11-19 David Gravereaux - - * win/buildall.vc.bat: Added useful comments. - -2001-11-19 Miguel Sofer - - * tests/compile.test: added a test for bug [Bug 483309] - -2001-11-19 Vince Darley - - * win/tclWinFile.c: - * win/tclWinFCmd.c: - * win/tclWin32Dll.c: - * doc/file.n: - * tests/winFCmd.test: improved speed of file normalization for - Win95/98, and clarified docs on differences in file normalization - between NT/2000 and the older operating systems. Added test to ensure - normalization is correct. - -2001-11-19 Miguel Sofer - - * generic/tclBasic.c: - * generic/tclParse.c: Code reorganisation. Moved all evaluation - functions from tclParse.c to tclBasic.c, so that now tclParse.c deals - exclusively with parsing and all evaluations are done by code in - tclBasic.c. The functions moved are: TclEvalObjvInternal, - Tcl_EvalObjv, Tcl_LogCommandInfo, Tcl_EvalTokensStandard, - Tcl_EvalTokens, Tcl_EvalEx, Tcl_Eval, Tcl_EvalObj and - Tcl_GlobalEvalObj. - -2001-11-19 Donal K. Fellows - - * tests/trace.test (trace-8.8): Added adapted version of [Bug 219393] - as new test; the test won't reliably show up the old problem unless it - is being run under something like Purify, but something is better than - nothing... - - * generic/tclVar.c (Tcl_TraceVar2, Tcl_UntraceVar2): Added missing - mask bits for trace result type and a check for a nonsense flag - combination. - * generic/tclCmdMZ.c (TraceVarProc): Added missing test for NULL when - deleting a trace that doesn't cause an error. - - * doc/TraceVar.3: Added documentation for change due to TIP#68. - - * generic/tclCmdMZ.c (TraceVarInfo): Removed problematic errMsg field - from structure. - (TraceVarProc): Removed references to errMsg field and changed - handling of errors so that they returned a Tcl_Obj* containing the - error string. This minimizes the number of calls to the memory - management subsystem. - (TclTraceCommandObjCmd, TraceCommandProc): Removed references to - errMsg field which was never used in command traces in any case. - (Tcl_TraceObjCmd, TclTraceVariableObjCmd): Removed references to - errMsg field and made variable traces register with - TCL_TRACE_RESULT_OBJECT bit set. - - * generic/tcl.h (TCL_TRACE_RESULT_DYNAMIC,TCL_TRACE_RESULT_OBJECT): - New constants to define how to handle the strings returned from trace - callbacks [TIP#68] - * generic/tclVar.c (CallTraces, Tcl_GetVar2Ex, TclGetIndexedScalar, - (TclGetElementOfIndexedArray, Tcl_SetVar2Ex, TclSetIndexedScalar, - (TclSetElementOfIndexedArray, Tcl_UnsetVar2, Tcl_ArrayObjCmd, - (TclDeleteVars, TclDeleteCompiledLocalVars, DeleteArray, - (TclVarTraceExists): Support for those new trace flags. - -2001-11-19 Miguel Sofer - - * generic/tclCompCmds.c: patch for [Bug 483309] (petasis). - -2001-11-16 Kevin B. Kenny - - * generic/tclListObj.c: removed a C++-style comment that was - inadvertently left in the source code. - -2001-11-16 Jeff Hobbs - - * tests/interp.test: - * generic/tclInterp.c (SlaveObjCmd): Corrected argument checking for - '$interp alias|aliases|issafe'. [Patch 479560] (thoyts, hobbs) - - * unix/tclUnixInit.c: added HAVE_LANGINFO code block. - * unix/configure: regened - * unix/configure.in: added SC_ENABLE_LANGINFO call - * unix/tcl.m4: made SHLIB_LD_LIBS='${LIBS}' for FreeBSD* (meyer) - Added modified version of Wagner patch to make use of nl_langinfo - where possible to determine Unix platform encoding, instead of the - inflexible built-in system. This is used by default when possible, and - can be disabled with --enable-langinfo=no. [Patch 418645] (hobbs, - wagner) - -2001-11-16 Miguel Sofer - - * generic/tclCompile.h: - * generic/tclExecute.c: - * generic/tclObj.c: moved Tcl_GetCommandFromObj and all defining code - for tclCmdNameType objects to tclObj.c (from tclExecute.c). This code - has nothing to do with bytecodes. - -2001-11-16 Miguel Sofer - - * generic/tclBasic.c: - * generic/tclCompile.h: - * generic/tclExecute.c: - * generic/tclParse.c: - * generic/tclProc.c: - * tests/stack.test: consolidation of duplicated code (in - TclExecuteByteCode and EvalObjv); renaming of EvalObjv to TclEvalObjv - as it is not static anymore; restored consistency of level counts - between compiled and directly evaled code. [Bug 480896] - -2001-11-12 David Gravereaux - - * win/makefile.vc: - * win/rules.vc: Small bug fixes. - - * win/README: added some docs pointing to the docs in makefile.vc for - it's use. - -2001-10-17 Kevin B. Kenny - - * doc/lappend.n: - * doc/lindex.n: - * doc/linsert.n: - * doc/list.n: - * doc/llength.n: - * doc/lrange.n: - * doc/lsearch.n: - * doc/lset.n (new-file): - * doc/lsort.n: - * generic/tclBasic.c (builtInCmds, Tcl_EvalObjEx): - * generic/tclCmdIL.c (Tcl_LindexObjCmd, Tcl_LindexList): - (Tcl_LindexFlat, Tcl_LsetObjCmd): - * generic/tclCompCmds.c (Tcl_CompileLindexCmd, Tcl_CompileLsetCmd): - * generic/tclCompile.c: - * generic/tclCompile.h: - * generic/tclExecute.c (TclExecuteByteCode): - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclListObj.c (TclLsetList, TclLsetFlat, TclSetListElement): - * generic/tclObj.c (TclInitObjSubsystem): - * generic/tclStubInit.c: - * generic/tclTestObj.c (TestobjCmd): - * generic/tclUtil.c (TclGetIntForIndex, SetEndOffsetFromAny): - * generic/tclVar.c (Tcl_LappendObjCmd): - * tests/lindex.test: - * tests/lset.test (new-file): - * tests/lsetComp.test (new-file): - * tests/obj.test: - * tests/string.test: - * tests/stringComp.test: - Reference implementation of TIP's #22, #33 and #45. Adds the ability - of the [lindex] command to have multiple index arguments, and adds the - [lset] command. Both commands are byte-code compiled. [Patch 471874] - (work by Kenny, commited by Hobbs) - -2001-11-12 David Gravereaux - - * win/buildall.vc.bat(new): - * win/makefile.vc: Small fix with deriving the "OriginalFilename" - string in the .rc scripts. Added a quick batchfile for building the - entire thing. - -2001-11-12 Jeff Hobbs - - * doc/FileSystem.3: - * doc/file.n: - * doc/tcltest.n: converted use of \' to more reasonable format. - -2001-11-10 Mo DeJong - - * unix/Makefile.in: - * win/Makefile.in: Add "make gdb" target. This target can run tclsh - inside either gdb or insight. - -2001-11-10 David Gravereaux - - * win/makefile.vc: Added a check to make sure one runs the makefile - from the /win directory only. - - * win/mkd.bat: - * win/rmd.bat: Changes from Llyod Lim for better stability. - [Patch 456759] - -2001-11-09 David Gravereaux - - * win/makefile.vc: - * win/tcl.dsp: winhelp target fixes for non-NT systems. It seems - NMAKE under these remembers changed directories during commands. A new - tcltest feature from Peter Spjuth to specify a - pattern file from the commandline and redirecting output to a file - when not under NT with it's scrollback console. Then it replays it, - piped through more. Added 2 new static "configurations" to tcl.dsp. - I could keep adding more, but I think we should leave it up to the - user for customizing it. - - Sticky-points left: 'profile' option. - -2001-11-09 Jeff Hobbs - - * doc/FileSystem.3: - * doc/StdChannels.3: - * doc/file.n: - * doc/tcltest.n: - * tools/man2help.tcl: - * tools/man2help2.tcl: fixed winhelp generation problems - [Patch 480268] - - * unix/configure: - * unix/tcl.m4: added -lc to AIX libs, fixed path to ldAix - -2001-11-09 Don Porter - - * tests/var.test: - * generic/tclVar.c: Corrected bug in [global] when dealing with - variable names matching :*. [Bug 480176] - -2001-11-08 Mo DeJong - - Fixup stack size under OSF1. [Patch 474790] - - * unix/configure: Regen. - * unix/tcl.m4: Add HAVE_PTHREAD_ATTR_SETSTACKSIZE define to - EXTRA_CFLAGS to adjust initial stack size. - -2001-11-08 Mo DeJong - - Enable thread support under FreeBSD. [Bug 473708] - - * unix/configure: Regen. - * unix/tcl.m4 (SC_ENABLE_THREADS): Check for pthread functions in - libc_r and enable thread support if found. - * unix/dltest/Makefile.in: Set SHLIB_LD_LIBS and use it in the - Makefile to properly link a shared library. - -2001-11-08 Mo DeJong - - * unix/Makefile.in: - * unix/dltest/Makefile.in: Avoid adding libc to the LIBS variable - since it is not needed when linking with CC. If required when linking - with LD it should be done on a case by case basis in tcl.m4. - -2001-11-08 David Gravereaux - - * win/rules.vc: - * win/makefile.vc: Fixed install target to adjust for the different - build types. Added a 'linkexten' option to link the win extensions - inside the shell when built static. Placed win/tclAppInit.c patch in - SF patch DB for approval. 'profile' option not hooked in yet. - Everything else know is done. - - * win/tcl.dsp(new): - * win/tcl.dsw(new): Simple MsDev stub project files that calls - makefile.vc. Will help run Tcl in the debugger easier without - confusing MsDev for where the .pdb files are. - -2001-11-07 Mo DeJong - - * unix/Makefile.in: - * win/Makefile.in: Print a message indicating that the user should run - "make genstubs" when the generated tclStubInit.c file is out of date. - We can't regenerate automatically since there may be no tclsh on the - system and that would cause bootstrap problems. [Bug 465874] - -2001-11-07 Mo DeJong - - Define TCL_INCLUDE_SPEC in tclConfig.sh. It should be included by - extensions that need to find Tcl include headers in the install - location. The user can override the include install dir with - --includedir so we need to record this information for extensions. - [Bug 421835] - - * unix/configure: Regen. - * unix/configure.in: Define TCL_INCLUDE_SPEC. - * unix/tclConfig.sh.in: Define TCL_INCLUDE_SPEC. - * win/configure: Regen. - * win/configure.in: Define TCL_INCLUDE_SPEC. - * win/tclConfig.sh.in: Define TCL_INCLUDE_SPEC. - -2001-11-07 David Gravereaux - - * win/rules.vc: - * win/makefile.vc: Dropped the NOMSVCRT macro and put it on the option - list instead. It makes more sense to me this way as NOMSVCRT=0 would - only be the valid setting. Fixed the dde and reg extension for - building static. Improved, but not perfected, the winhelp target. - -2001-11-07 Mo DeJong - - * win/README: Change minimum VC++ version to 5.X since 4.X is known - not to work. - Indicate that Mingw is required and building with Cygwin gcc is not - supported. Include instructions that indicate how to install Mingw and - what URLs folks should use to download the supported version of Mingw. - * win/configure: Regen. - * win/configure.in: Error out if user tries to compile the Windows - version of Tcl with Cygwin gcc. Users should compile with Mingw gcc - instead. - -2001-11-06 Andreas Kupries - - * generic/tclIO.c (ReadChars): Fixed [Bug 478856] reported by Stuart - Cassoff . The bug caused loss of - fileevents when [read]ing less data from the channel than buffered. - Due to an empty input buffer the flag CHANNEL_NEED_MORE_DATA was set - but never reset, causing the I/O system to wait for more data instead - of using a timer to synthesize fileevents and to flush the pending - data out of the buffers. - -2001-11-06 David Gravereaux - - * win/rules.vc (new): - * win/makefile.vc: Complete over/under rewrite to support numerous - build options all from the commandline itself without needing to edit - the makefile. Now requires vcvars32.bat to be run prior to running - nmake for bootstraping the environment. Fully doc'd usage for it is in - makefile.vc. Commentary welcome. Sticky points left are: - - 1) winhelp target shows errors in the converting script. - 2) .rc scripts aren't getting the right #defines to build the correct - "OriginalFilename" strings. (have patch, won't commit yet) - 3) Naming convention with suffixes describing the buildtype are 'tsdx' - which will need public acceptance. ie. tclsh84tsx.exe is a (t) - threaded shell (s) statically linked to the core and (x) uses - msvcrt instead of libcmt. - -2001-11-04 Vince Darley - - * library/init.tcl: made filesystem fallback proc ::tcl::CopyDirectory - more robust to vagaries of non-native filesystems. - -2001-11-02 Vince Darley - - * doc/file.n: - * generic/tclIOUtil.c: updated documentation and comments to clarify - behaviour of 'file copy' wrt soft links. - -2001-10-29 Vince Darley - - * win/tclWinFile.c: fix to '-types {f r}' bug in TclpMatchInDirectory - (which could cause a UMR, as well as returning wrong results). Also - improved API for 'stat' to resolve [Bug 219258]. - * win/tclWin32Dll.c - * win/tclWinInt.h: addition of improved stat API to internal lookup - table. - * tests/fileName.test: two new tests for the above bug. - * generic/tclIOUtil.c: some cleanup of comments and #ifdefs - -2001-10-29 Donal K. Fellows - - * unix/tclUnixFile.c (TclpMatchInDirectory): Argument to access() was - entryPtr->d_name instead of nativeEntry which failed when trying to - check access for files in other than the current directory. [Bug - 475941, reported by Georgios Petasis] - -2001-10-25 Donal K. Fellows - - * unix/tclUnixChan.c: Added stateUpdated member to struct TtyState. - (TtyCloseProc,TtySetOptionProc,TtyInit): Use stateUpdated member of - TtyState to decide whether it is necessary to reset a serial port when - Tcl closes it. Blindly resetting can cause Tcl to be sent an - unexpected SIGTSTP when it is executing in the background [Bug 471374, - reported by Chris Nelson] - -2001-10-22 Andreas Kupries - - * doc/ObjectType.3: Minor documentation fix, reported by David N. - Welton directly to me. - -2001-10-22 Vince Darley - - * win/tclWinFCmd.c: fix to stop test suite from hanging process under - some versions of WinNT. [Bug 466102] (Kevin Kenny) - -2001-10-18 Jeff Hobbs - - * tests/clock.test (clock-8.1): - * generic/tclDate.c (RelativeMonth): - * generic/tclGetDate.y (RelativeMonth): corrected off-by-one-day error - in clock scan with relative months and years during swing hours. [Bug - 413397, Patch 414024] (lavana) - -2001-10-18 Vince Darley - - * generic/tclIOUtil.c: fix to bug in Tcl_FSChdir shown up by recent - tclkit builds. - -2001-10-17 Jeff Hobbs - - * unix/tclUnixPipe.c (PipeInputProc, PipeOutputProc): do immediate - retry when error is returned with errno == EINTR. [Bug 415131] (leger) - -2001-10-16 Jeff Hobbs - - * unix/tclLoadAout.c (TclGuessPackageName): removed unused vars and - fixed warnings. [Bug 446622] (lim) - -2001-10-15 Miguel Sofer - - * generic/tclProc.c: changing a memcmp to strncmp to avoid a memory - error detected by purify (thanks Jeff); modify style to agrre with the - style guide. - -2001-10-15 Andreas Kupries - - * generic/tclInt.decls (TclExpandCodeArray,TclGetInstructionTable): - Added to internal stubs table. Tclcompiler (Tclpro project) needs them - if used as loadable package under Windows. Changed signatures. We - don't want to describe compiler internal structures in "tclInt.h". - - * generic/tclCompile.h: S.a. Removed function declarations. - * generic/tclCompile.c: S.a. Adapted to changed signatures. - -2001-10-15 Jeff Hobbs - - * unix/configure: - * unix/configure.in: - * win/configure: - * win/configure.in: - * win/tcl.m4: reworked to be a little cleaner in comparison to each - other, and to AC_SUBST even empty vars for win/tclConfig.sh - - * generic/tclFileName.c: minor code cleanup - - * generic/tcl.h: moved #define of WIN32 to tcl.h where __WIN32__ is - defined and added #ifndef check. - - * doc/open.n: moved all fconfigure option docs to fconfigure.n - * doc/fconfigure.n: added serial config options - - * win/tclWinChan.c: - * win/tclWinPort.h: - * win/tclWinSerial.c: added TIP #35 Windows enhancements for serial - configuration. [Patch 438509] (schroedter) - -2001-10-15 Vince Darley - - * generic/tclFCmd.c: fix to memory leak in TclFileDeleteCmd on - certain error conditions. - * doc/FileSystem.3: fix to typo. - -2001-10-12 Jeff Hobbs - - * library/encoding/ebcdic.enc: - * tools/encoding/ebcdic.txt: EBCDIC charset mapping. - [Patch 219323] (nijtmans) - - * library/encoding/tis-620.enc: - * tools/encoding/tis-620.txt: TIS-620 charset mapping. - [Patch 467423] (poonlap) - - * tests/http.test: added removeFile for outdata - - * tests/ioCmd.test: added catch around file removal, as Windows file - locking throws errors. - - * tests/socket.test (socket-7.2): corrected to work on Win2K. - -2001-10-12 Miguel Sofer - - * tests/compile.test: new tests for [Bug 467523]; they are only - effective if TCL_MEM_DEBUG was set during compilation. - -2001-10-11 Miguel Sofer - - * generic/tclLiteral.c (TclReleaseLiteral): insured that - self-referential bytecodes are properly cleaned up on interpreter - deletion [Bug 467523] (Ronnie Brunner) - -2001-10-10 David Gravereaux - - * win/tclWinPort.h: #include needed to get moved to - after #include or wierd misunderstandings took place when - -D_WIN32_WINNT=0x0400 is set for outside code that requires knowledge - of Tcl innards. General header macro magic applied liberally... - -2001-10-10 Don Porter - - * tests/unixInit.test: Corrected restore of ::env(LANG). - -2001-10-09 Jeff Hobbs - - * generic/tclFileName.c (Tcl_SplitPath): corrected mem leak intro'd - with VFS code where the result obj from Tcl_FSSplitPath was not - getting freed. - -2001-10-09 Miguel Sofer - - * generic/tclLiteral.c: (TclReleaseLiteral) reverted previous patch - for [Bug 467523] - cure is worse than the illness. - -2001-10-05 Miguel Sofer - - * generic/tclLiteral.c: (TclReleaseLiteral) insured that - self-referential bytecodes are properly cleaned up on interpreter - deletion. [Bug 467523] (Ronnie Brunner) - -2001-10-04 Jeff Hobbs - - * tools/configure: - * tools/configure.in: noted 8.4 as default Tcl version - - * library/encoding/cp936.enc: - * library/encoding/cp949.enc: - * library/encoding/cp950.enc: - * library/encoding/iso8859-16.enc: - * library/encoding/macCroatian.enc: - * library/encoding/macCyrillic.enc: - * library/encoding/macGreek.enc: - * library/encoding/macIceland.enc: - * library/encoding/macRoman.enc: - * library/encoding/macTurkish.enc: - * tools/encoding/cp1250.txt: - * tools/encoding/cp1251.txt: - * tools/encoding/cp1252.txt: - * tools/encoding/cp1253.txt: - * tools/encoding/cp1254.txt: - * tools/encoding/cp1255.txt: - * tools/encoding/cp1256.txt: - * tools/encoding/cp1257.txt: - * tools/encoding/cp1258.txt: - * tools/encoding/cp874.txt: - * tools/encoding/cp932.txt: - * tools/encoding/cp936.txt: - * tools/encoding/cp949.txt: - * tools/encoding/cp950.txt: - * tools/encoding/iso8859-1.txt: - * tools/encoding/iso8859-10.txt: - * tools/encoding/iso8859-13.txt: - * tools/encoding/iso8859-14.txt: - * tools/encoding/iso8859-15.txt: - * tools/encoding/iso8859-16.txt: - * tools/encoding/iso8859-2.txt: - * tools/encoding/iso8859-3.txt: - * tools/encoding/iso8859-4.txt: - * tools/encoding/iso8859-5.txt: - * tools/encoding/iso8859-6.txt: - * tools/encoding/iso8859-7.txt: - * tools/encoding/iso8859-8.txt: - * tools/encoding/iso8859-9.txt: - * tools/encoding/koi8-r.txt: - * tools/encoding/macCentEuro.txt: - * tools/encoding/macCroatian.txt: - * tools/encoding/macCyrillic.txt: - * tools/encoding/macGreek.txt: - * tools/encoding/macIceland.txt: - * tools/encoding/macRoman.txt: - * tools/encoding/macTurkish.txt: - Updated encodings with latest mappings from www.unicode.org. This did - not include some Mac encodings that have special multi-unichar - translations now (like symbols, dingbats and japanese). Also does not - include big5, gb or euc* as those have different formats in the latest - Unicode version that need new conversion tools. Not all related .enc - files changed as some had been updates separately. - -2001-10-03 Jeff Hobbs - - * generic/tclEvent.c (Tcl_FinalizeThread): moved freeing of - tclLibraryPath to before the thread exit handlers are called. Slight - modification to change on 2001-09-24. - -2001-10-01 Jeff Hobbs - - * win/configure: regen'ed - * win/tcl.m4: - * win/makefile.vc: added Win64 SDK RC1 compilation support - * win/Makefile.in: added $(LDFLAGS_CONSOLE) to TCLSH, TCLTEST and - PIPE_DLL_FILE targets to get the link flags - - * win/tclWinInit.c: minor 64bit casts - -2001-10-01 Miguel Sofer - - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclParseExpr.c: removed unnecessary inclusion of - tclCompile.h and made a small modification in (InfoBodyCmd) to improve - the isolation of the compiler/engine subsystem. - -2001-09-29 Vince Darley - - * generic/tclIOUtil.c: - * doc/FileSystem.3: corrected and clarified documentation for - 'Tcl_FSListVolumes(Proc)'. No code changes. - -2001-09-28 Miguel Sofer - - * doc/FindExec.3: added a comment not to change the working directory - before calling Tcl_GetNameOfExecutable. [Bug 219215] - -2001-09-28 Kevin Kenny - - * generic/tclIO.c: added two more '(ClientData)' casts on calls to - Tcl_Preserve and Tcl_Release -- ones that Vince apparently missed. - -2001-09-28 Donal K. Fellows - - * doc/lsort.n: Improved doc... - * generic/tclCmdIL.c (Tcl_LsortObjCmd, SortCompare): Made - offset-from-end indexing work, and factored out some "magic numbers" - for easier understanding. [Bug 465674] - * tests/cmdIL.test (cmdIL-1.26): Added test for offset-from-end - indexing for lsort. - -2001-09-28 Vince Darley - - * win/tclWinFCmd.c: - * unix/tclUnixFCmd.c: fix to performance issue reported by jcw in - which 'access("")' is called unnecessarily when normalizing any - absolute path. - * generic/tclIO.c: added '(ClientData)' cast to calls to - Tcl_(Preserve|Release) newly introduced, fixing compile error on - Windows. - -2001-09-27 Don Porter - - * doc/FileSystem.3 (Tcl_FSLoadFile): - * generic/tcl.decls (Tcl_FSLoadFile): - * generic/tcl.h (Tcl_FSLoadFileProc): - * generic/tclInt.h (TclpLoadFile): - * generic/tclIOUtil.c (Tcl_FSLoadFile): - * generic/tclLoadNone.c (TclpLoadFile): - * generic/tclTest.c (TestReportLoadFile): - * library/ldAout.tcl: - * mac/tclMacLoad.c (TclpLoadFile): - * unix/tclLoadAix.c (TclpLoadFile): - * unix/tclLoadAout.c (TclpLoadFile): - * unix/tclLoadDl.c (TclpLoadFile): - * unix/tclLoadDld.c (TclpLoadFile): - * unix/tclLoadDyld.c (TclpLoadFile): - * unix/tclLoadNext.c (TclpLoadFile): - * unix/tclLoadOSF.c (TclpLoadFile): - * unix/tclLoadShl.c (TclpLoadFile): - * win/tclWinLoad.c (TclpLoadFile): - * win/tclWinFCmd.c (DoRemoveJustDirectory): More CONST poisoning - fixes from the 2001-09-24 TIP 27 changes. CONST-ified Tcl_FSLoadFile - and TclpLoadFile. Report and patch from Kevin Kenny. [Bug 465833] - - * generic/tclIO.c (ChannelTimerProc): Added Tcl_Preserve() and - Tcl_Release() to fix segfault introduced by the 2001-09-26 changes. - [Bug 465494] - - * doc/TCL_MEM_DEBUG.3: Updated out-of-date reference to #define - GUARD_SIZE. - - * doc/UpVar.3 (Tcl_UpVar,Tcl_UpVar2): - * generic/tcl.decls (Tcl_UpVar,Tcl_UpVar2): - * generic/tclInt.decls (TclFindProc,TclGetFrame): - * generic/tclInt.h (TclFindProc,TclGetFrame,TclLookupVar, - (TclPrecTraceProc,TclProcInterpProc}): - * generic/tclProc.c (TclGetFrame,TclFindProc): - * generic/tclVar.c (Tcl_UpVar,Tcl_UpVar2,MakeUpvar): Updated APIs in - generic/tclProc.c and generic/tclVar.c according to the guidelines of - TIP 27. [Patch 465442] - - * generic/tclDecls.h: - * generic/tclIntDecls.h: make genstubs - -2001-09-26 Andreas Kupries - - * doc/fileevent.n: Accepted [Patch 465279] adding an example to the - fileevent manpage. Minor modifications to get a better formatting. - Report and patch by David N. Welton . - - * The changes below fix [Bug 462317] where Expect tried to read more - than was in the buffers and then blocked in the OS call as its pty - channel driver provides no blockmodeproc through which the OS could be - notified of blocking-behaviour. Because of this the general I/O core - has to take more care than usual to preserve the semantics of - non-blocking channels. - - The problem was reported by "Kevin O'Gorman" . - - * generic/tclIO.c (Tcl_ReadRaw): Do not read from the driver if the - channel is non-blocking and the fileevent causing the read was - generated by a timer. We do not know if there is data available from - the OS. Instead of going to the OS for more and potentially blocking - we simply signal EWOULDBLOCK to the higher levels to cause the system - to wait for true fileevents. - (GetInput): Same as before. - (ChannelTimerProc): Added set and clear of CHANNEL_TIMER_FEV. - - * generic/tclIO.h (CHANNEL_TIMER_FEV): New flag for channels. Is set - if a fileevent was generated by a timer, the channel is not blocking - and the driver did not provide a blockmodeproc. In that case the I/O - core has to be especially careful about going to the driver for more - data. - -2001-09-26 Don Porter - - * doc/SplitPath.3 (Tcl_GetPathType): - * generic/tcl.decls (Tcl_GetPathType): - * generic/tclFileName.c (Tcl_GetPathType): - * win/tclWinFile.c (TclpMatchInDirectory, NativeStat): Vince Darley - reports the 2001-09-24 TIP 27 changes left the win directory CONST - poisoned. These changes should fix that. - - * generic/tclDecls.h: make genstubs - -2001-09-25 Don Porter - - * doc/GetInt.3: - * generic/tclInt.h (TclGetLong deleted): - * generic/tcl.decls: - * generic/tclInt.decls: - * generic/tclGet.c: Updated APIs in generic/tclGet.c according to the - guidelines of TIP 27. [Patch 464674] - - * generic/tclDecls.h: - * generic/tclIntDecls.h: make genstubs - -2001-09-25 Miguel Sofer - - * generic/tclVar.c: removed comments referring to unused flag - TCL_PARSE_PART1. - -2001-09-24 Don Porter - - * doc/Concat.3: - * doc/DString.3: - * doc/SplitList.3: - * generic/tclInt.h (TclCheckBadOctal): - * generic/tcl.decls: - * generic/tclInt.decls: - * generic/tclEncoding.c (OpenEncodingFile): - * generic/tclMain.c (Tcl_Main): - * generic/tclUtil.c: - * unix/tclLoadDl.c (TclpLoadFile): Updated APIs in generic/tclUtil.c - according to the guidelines of TIP 27. [Patch 464553] - - * generic/tclDecls.h: - * generic/tclIntDecls.h: make genstubs - -2001-09-24 Andreas Kupries - - The change below fixes [Bug 464380]. The bug was reported by Ronnie - Brunner . He also provided the patch. - - * generic/tclEvent.c (Tcl_Finalize): Moved release of 'tclLibraryPath' - to Tcl_FinalizeThread. - (Tcl_FinalizeThread): See above, new place for release of - 'tclLibraryPath'. - -2001-09-24 Donal K. Fellows - - * tools/encoding/cp1252.txt: File was missing part of the encoding - [euro, ZCaron and zcaron]. - - * doc/OpenFileChnl.3: Add docs for Tcl_OutputBuffered; remove some old - changebars. - -2001-09-21 Jeff Hobbs - - * generic/tclExecute.c (TclExecuteByteCode): corrected INST_STR_CMP - else case for strings to pass true utf char length to Tcl_UtfNCmp. - -2001-09-20 Jeff Hobbs - - * win/tclWinInit.c: added extra processor definitions. (mstacy) - - * win/tclWinSock.c (SocketThread): corrected pointer cast for _WIN64. - - * win/tclWinNotify.c: removed unnecessary winsock include (it is - already in from tclWinPort.h). - - * win/tclWinPort.h: changed winsock.h include to winsock2.h. Reverses - change from 2000-11-16, but is necessary for WIN64. Extensions should - comply with defined OS words, or use #ifndef. - -2001-09-20 Donal K. Fellows - - * tests/socket.test: removed dependence on being run from same dir as - remote.tcl, which only now needs to be in the same dir as this file. - [Bug 219326] - -2001-09-19 Jeff Hobbs - - * generic/tclTest.c (TestcmdtokenCmd): corrected pointer - storage/retrieval for 64bit machines. - - * generic/tclCmdAH.c (Tcl_FormatObjCmd): - * generic/tclScan.c (Tcl_ScanObjCmd): corrected handling of format and - scan on 64-bit machines. [Bug 412696] (rmax) - - * unix/configure: regen'ed - * unix/tcl.m4: added --enable-64bit support for HP-11 with the 64-bit - kernel. - - * tests/basic.test: - * tests/cmdInfo.test: improved skip reporting of missing commands - - * tests/winFCmd.test: simplified error check for winFCmd-7.9 - - * tests/winPipe.test: removed obsolete cat16 tests - - * generic/tclExecute.c (TclExecuteByteCode): fixed invalid usage of - valuePtr in TRACE_WITH_OBJ in INST_EVAL_STK case. [Bug 462594] Changed - INST_STR_CMP instruction to promote to Unicode strings only when one - of the strings is already of Unicode type. - - * generic/tclExecute.c (TclExecuteByteCode): - * generic/tclCompile.c (instructionTable): - * generic/tclCompCmds.c (TclCompileStringCmd): INST_STR_MATCH - - Updated to Int1 instruction type and added special case to use - INST_STR_EQ instead when no glob chars are specified in a static - string. - - * tests/{for.test,foreach.test,if.test,while.test}: - * generic/tclCompCmds.c (TclCompileForCmd, TclCompileForeachCmd, - TclCompileIfCmd, TclCompileWhileCmd): Corrected the overaggressive - compiling of loop bodies enclosed in ""s. [Bug 219166] (msofer) - -2001-09-19 Miguel Sofer - - * generic/tclExecute.c: insured that execution stack errors are also - detected at abnormal returns. - -2001-09-19 Donal K. Fellows - - * doc/socket.n: Added documentation to mention what happens when a - server socket is created with port=0. Removed an old change bar, and - no new change bar because Tcl has always behaved this way as it is - really a poorly-documented standards-defined OS feature. - - * tests/util.test (util-8.1): Test derived from code to detect the - problem, but the test always works in the C locale, so beware if you - are maintaining the code. - * generic/tclUtil.c (TclNeedSpace): Rewrote to be UTF-8 aware. [Bug - 411825, but not that patch which would have added extra spaces if - there was a real non-ASCII space involved.] - -2001-09-18 Andreas Kupries - - * generic/tclIOCmd.c (Tcl_PutsObjCmd): Rewritten to have saner and - faster argument handling. [Bug 123552], [Patch 402564] (fellows) - -2001-09-18 Don Porter - - * unix/configure: Regen. - * unix/tcl.m4 (SC_CONFIG_CFLAGS): On Linux, disable inlining when one - of the compat/*.c routines is to be linked in. [Patch 440891] - -2001-09-17 Jeff Hobbs - - * generic/tcl.h: removed forced #define USE_TCLALLOC 1 for Windows. - This means the native system allocator will be used by default. This - should be binary and source compatible with extensions, as Tcl_Alloc - is a properly stubbed function. - -2001-09-17 Miguel Sofer - - * generic/tclExecute.c: corrected small bug in [Patch 456668] - the - varFramePtr was not restored in one possible exit. - -2001-09-17 Miguel Sofer - - * doc/tclvars.n: - * generic/tclCompile.c: - * generic/tclCompile.h: - * generic/tclExecute.c: - * generic/tclProc.c: disabled all compile and execution tracing - functionality in standard builds; TCL_COMPILE_DEBUG is now necessary - to enable it. [Bug 451858] - -2001-09-14 Andreas Kupries - - * doc/gets.n: - * doc/read.n: - * doc/puts.n: - * doc/flush.n: - * doc/fconfigure.n: - * doc/flush.n: - * doc/eof.n: - * doc/seek.n: - * doc/tell.n: - * doc/close.n: - * doc/fileevent.n: Added references to the Tcl standard channels. Item - [219250], reported by David LeBlanc . Thanks to - Christopher Nelson for doing editorial work. - -2001-09-13 Andreas Kupries - - * win/Makefile.in: - * win/configure.in: - * win/makefile.bc: - * win/makefile.vc: - * library/dde/pkgIndex.tcl: Fixed version numbers from bogus tcl - versions to independent versions for dde and registry packages. - -2001-09-13 Jeff Hobbs - - * tests/regexp.test (regexp-20.1): - * generic/tclCmdMZ.c (Tcl_RegsubObjCmd): had to adjust fix from - 2001-08-06 to actually duplicate the objects in certain cases. This is - really a place where feather would have been essential. [Bug 461322] - - * generic/tclUtf.c (Tcl_UtfPrev): corrected to return the proper - location when the middle of a UTF-8 byte was passed in [Tk Bug 450504] - - * ChangeLog.1999: - * ChangeLog: broke changes from 199x into ChangeLog.1999 to reduce - size of the main ChangeLog. - -2001-09-13 Andreas Kupries - - * tests/ioCmd.test: Changed the computation of the result for - iocmd-8.1[123] so that the tests work for single- and multi-process - execution of the testsuite. Depending on the choice of the user stdout - is a tty or not and thus reports different channel options. Fixes - [460993] reported by Don Porter. - -2001-09-13 Miguel Sofer - - * doc/ParseCmd.3: - * generic/tcl.decls: - * generic/tclCmdMZ.c (Tcl_SubstObjCmd): - * generic/tclDecls.h: - * generic/tclParse.c: - * generic/tclStubInit.c: - * tests/parse.test: Deprecate the use of Tcl_EvalTokens, replaced by - the new Tcl_EvalTokensStandard. The new function performs the same - duties but adheres to the standard return convention for Tcl - evaluations; the deprecated function could only return TCL_OK or - TCL_ERROR, which caused [Bug 219384] and [Bug 455151]. This patch - implements [TIP 56]. - -2001-09-12 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4: Invert the logic that checks for $GCC. Instead of - checking for "$GCC" = "no" we check for "$GCC" != "yes" or simply swap - the true and false blocks of code in an if statement. That way if GCC - is set to "" everything will still work. [Bug 460991] - -2001-09-12 Don Porter - - * tests/appendComp.test: - * tests/lsearch.test: - * tests/namespace.test: - * tests/rename.test: - * tests/split.test: Corrected tests to better isolate tests in one - file from influencing tests in other files. [Bug 460591] - -2001-09-12 Miguel Sofer - - * generic/tcl.decls: reserved stub #481 for the implementation of - [TIP 56] - -2001-09-11 Andreas Kupries - - * doc/OpenFileChnl.3: Added documentation for Tcl_WriteRaw and - Tcl_ReadRaw [Bug 414929]. - - * doc/CrtChannel.3: Added documentation for Tcl_ChannelBuffered and - Tcl_GetTopChannel [Bug 414929]. - - * The changes below are a fix for [Bug 219253]. - - * tests/socket.test: Removed _most_ instances of hardwired port - numbers for listening sockets. Remaining are the ports in all tests - with constraint 'doTestsWithRemoteServer'. These seem to be designed - for a more controlled environment and are usually skipped when running - the testsuite. - - * tests/io.test: Removed all instances of hardwired port numbers for - listening sockets. - -2001-09-10 Jeff Hobbs - - * generic/tclEvent.c (TclInExit): Corrected handling of tsd in late - stages of finalization. [Bug 419449] (darley) - - * tests/stack.test: - * generic/tclInterp.c (AliasObjCmd): Check the numLevels to ensure - that we aren't hitting some alias loop condition. [Bug 443184] - -2001-09-10 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Don't include . characters in the - Tcl library name when building on FreeBSD 3.X and later systems. - [Patch 450725] - -2001-09-10 Andreas Kupries - - * doc/tclsh.1: - * doc/Tcl_Main.3: - * doc/CrtChannel.3: - * doc/OpenFileChnl.3: - * doc/GetStdChan.3: Enhanced the manpages with cross-references to - the new manpage and more explanations how these functions deal with - the standard channels in various situations. - - * doc/StdChannels.3: New manpage describing handling of the standard - channels by the Tcl library. [Bug 402725] - -2001-09-10 Don Porter - - * unix/mkLinks (Tcl_FSLink): Updated to reflect 2001-08-23 file system - changes. - - * unix/tclLoadShl.c: Added #include of tclInt.h; access to Tcl - internals, notably TclpUnloadFile(), is required. Thanks to Bob - Techentin for report and patch. [Bug 459305] - - * generic/tclInitScript.h (initScript): - * win/tclWinInit.c (TCL_REGISTRY_KEY, TclpSetVariables): Removed - vestiges of Tcl's old initialization from registry variables. [Bug - 455645] - -2001-09-10 Andreas Kupries - - * generic/tclInt.decls: Also added 'TclWinFlushDirtyChannels' to the - internal platform specific stub table. - - * win/tclWinFile.c (TclpObjStat): Now added the call to - 'TclWinFlushDirtyChannels' to this function. I don't know where my - head was last thursday (2001-09-06), but the call was actually added - to 'TclpObjChdir', i.e. the implementation of [cd]. Corrected this - now. Thanks to Vince Darley for spotting this. - -2001-09-10 Miguel Sofer - - * generic/tclProc.c: - * tests/proc.test: made [proc] bytecompile a no-op for procs defined - with _args_ as single argument and an empty body. [FRQ 451441] - -2001-09-09 Mo DeJong - - * unix/Makefile.in: - * win/Makefile.in: Use () around variable name instead of {}. Use - TCLTEST variable directly instead of depending on the tcltest alias. - -2001-09-09 David Gravereaux - - * generic/tcl.h: - * generic/tclPlatDecls.h: Reminder from David Cuthbert - that I hadn't finished the Borland compatibility - stuff. [Patch 436116] - -2001-09-09 Mo DeJong - - * tests/cmdAH.test: Modify cmdAH-20.5 and cmdAH-24.8 to display the - file atime or mtime results if the test fails. - -2001-09-08 David Gravereaux - - * win/mkd.bat: - * win/rmd.bat: made these text files, text files again. [Patch 451333] - -2001-09-08 Mo DeJong - - * win/mkd.bat: - * win/rmd.bat: Apply binary property (cvs admin -kb) to files and - convert to CRLF linefeed format to fix the VC++ build. [Bug 219409] - -2001-09-08 Vince Darley - - * generic/tclInt.h: - * generic/tclFCmd.c: - * doc/FileSystem.3: - * generic/tclIOUtil.c: removed Tcl_FSCopyFile fallback to channel - copying, since the channels will not have access to interpreters and - the channel copying currently requires an interp. Code which required - cross-platform copies always has interpreters, so that solves the - problem. Fixes bug in TclKit. - -2001-09-07 David Gravereaux - - * win/tcl.m4: Added -link50compat option so a VC6 linker makes a VC5 - (pre sp3) compatible import library. [Bug 219257] - -2001-09-07 Mo DeJong - - * win/tclWinThrd.c (TclpThreadExit): Cast status argument to - _endthreadex to unsigned instead of DWORD to match the Win32 function - prototype. - -2001-09-06 Andreas Kupries - - * All the changes below serve to fix bug [219148] which reports a 80x - performance hit for file I/O on Win* systems. On my system it was - closer to a 120x hit. Problem report by Uwe Traum . - - The fix goes like this: The obstacle is 'FlushFileBuffers', executed - whenever Tcl writes data to the OS, as Tcl has to wait for the disk to - complete I/O, and disks are slow. We remove that obstacle. This opens - another problem, [file size] reports back wrong numbers. So for [file - size] we add the call back in. As optimization we keep track of the - channels which were written to and flush only these. - - * win/tclWinFile.c (TclpObjStat): Added a call to - 'TclWinFlushDirtyChannels'. This ensures that [file size] and related - commands report the correct size of a file even if Tcl has recently - written to it. Unixoid OS's always report the correct size even for - files with pending data, but Win* syssystem don't. They only report - what is actually on disk. - - * win/tclWinInt.h: Added declaration of 'TclWinFlushDirtyChannels', - making it available to other parts of the tcl core. - - * win/tclWinChan.c (TclWinFlushDirtyChannels): New, internal, - procedure. Goes through the list of open file channels and forces the - OS to flush its file buffers for all which were written to since the - last call of this function. This is an expensive operation as Tcl has - to wait for the OS to complete actual writes to the disk. - - (FileInfo): Added dirty flag required by the procedure above. - - (FileOutputProc): Removed flushing of file buffers, setting the dirty - flag instead. This means that the previously incurred delays do not - happen anymore. - - (TclWinOpenFileChannel): Added initialization of 'dirty' flag. - -2001-09-06 Jeff Hobbs - - * doc/http.n: noted -binary, charset and coding state keys. - * tests/http.test: - * library/http/pkgIndex.tcl: - * library/http/http.tcl (geturl): correctly get charset parameter - and convert text according to specified encoding (if known). RFC - iso8859-1 is used by default. Also recognize Content-encoding to see - if we should do binary translation. Added a CYA -binary switch for the - cases that were missed. [Bugs 219211, 219399] - - * tests/ioUtil.test: changed to make better use of constraints and - remove knownBug constraints that weren't valid. - -2001-09-06 Don Porter - - * tests/unixInit.test (unixInit-3.2): Updated test to support newer - HP-UX releases that properly report euc-jp as the system encoding for - Japanese. Bug report and patch verification by Bob Techentin. [Bug - 453883] - - * doc/http.n: - * library/http/*.tcl: - * tools/tcl.wse.in: - * tools/tclmin.wse: - * unix/Makefile.in: - * win/{Mm}akefile.*: Updated http package to version 2.4, reflecting - the new features just added. - -2001-09-06 Vince Darley - - * generic/tclTest.c: tests of old-fs hooks no longer cause problems in - threaded builds. Also removed unused unload proc. - * generic/tcl.decls: - * generic/tclIOUtilc: added Tcl_FSMountsChanged so that a vfs can - inform the filesystem that the filesystem epoch must be changed (since - cached filesystems may now be incorrect). Fixes problem running tclvfs - extension. - * library/tcltest/tcltest.tcl: if tests aren't in a native filesystem, - then don't use pipes to run them. [Bug 458741] - -2001-09-06 Donal K. Fellows - - * generic/tcl.decls (479 generic): - * generic/tclIO.c (Tcl_Seek,Tcl_Tell,Tcl_OutputBuffered): Added public - function to return the size of the output buffer and reworked other - channel functions to use this shared functionality and that of - Tcl_InputBuffered() too. [TIP#49, Rolf Schroedter] - -2001-09-05 David Gravereaux - - * generic/tclPlatDecls.h: Another small trim finalizing Borland - support. - - * win/tclWinPipe.c: - * win/tclWinPort.h: More Borland compatibility fixes. Changed EDQUOT - #define from 49 to 69. Borland had a clash as it was already using - this number. Upon advice from Helmut Giese, EDQUOT has been found in - other header files #defined as 69. [Patch 436116] - - * win/.cvsignore: A few more glob patterns added. - - * win/makefile.bc (new): Borland lives once more! rejoice.. - * generic/tclAlloc.c: Small Borland compatibility fix. - * win/tclWinTime.c: More Borland compatibility fixes. [Patch 436116] - -2001-09-05 Vince Darley - - * tests/winFCmd.test: made notWin2000 constraint false if not running - on Windows at all. - -2001-09-04 David Gravereaux - - * win/tclWinThrd.c: Revisited _beginthreadex() stuff. Instead of - assuming a c-runtime implimentation of _beginthreadex normal, I - reversed the logic to not assume, and use when is by explicitly - needing to add runtimes that support it such as Borland. - - * generic/tcl.h: - * generic/tclPlatDecls.h: Borland compatibility change so ClientData - was properly typed as a void* and TCHAR would not be defined twice. - - * generic/tcl.h: Removed a small mistake from before. Changes to the - EXTERN macro for proper Borland compatibility will have to see a TIP. - What's this with the MS compiler: - - __declspec(dllexport) int func (int a, int b); - - will have to be this with Borland: - - int __cdecl __export func (int a, int b); - - The order of the attribute needs to be after the return type. - -2001-09-04 Don Porter - - * compat/strtod.c (strtod): Fixed failure to handle expressions like - 3eq2 and failure to set errno on overflow. [Bug 440894] - -2001-09-04 Miguel Sofer - - * generic/tclProc.c: - * tests/proc.test: made [proc] check that formal args have simple - names. [Bug 458548] - -2001-09-04 Vince Darley - - Minor bug fixes in filesystem, plus small vfs changes as a result of - enabling the test filesystem to work properly. - * tests/fileName.test: ensure new test cleans up after itself - * doc/filename.n: - * generic/tclFileName.c: improved Mac path handling and document why - [Bug 421842] on Windows handling of UNC paths is not valid. - Documentation and code now much clearer on what is and is not a UNC - path. - * doc/FileSystem.3: - * unix/tclUnixPipe.c: - * generic/tclFCmd.c: - * generic/tclIOUtil.c: fixed error message, fixed [Bug 453512] about - dangerous use of tmpnam, replaced with mkstemp. Documented all the - changes. - * generic/tclTest.c: made test vfs fully functional as a 'reporting - filesystem'. - * generic/tcl.stubs: - * generic/tcl.h: - * generic/tclInt.h: - * generic/tclIOUtil.c: - * doc/file.n: - * various platform-specific 'TclpLoadFile': fixed comments about - unload behaviour, and completed objectification of loading. Required - change to Tcl_Filesystem lookup table, so incompatible with 8.4a3, but - not older versions of Tcl. The change also allows 'link' and - 'reporting' filesystems to function correctly when loading files. - Implementation of 'file delete -force' copes with case where cwd is - inside the directory. Moved overlooked Tcl_FSGetPathType from internal - to external API. Made sure filesystems which are registered and then - unregistered are only freed when all references to them are gone. - Documented changes. - * unix/tclUnixFCmd.c: when deleting directories recursively, make sure - permissions are ok. Together with the above, this fixes [Bug 219139] - * tests/winFCmd.test: differentiated test results for win2k versus - not. This fixes [Bug: 219239] - * tests/fCmd.test: added tests for 'file delete -force' where the cwd - is inside, and when permissions are inadequate. - -2001-09-04 Miguel Sofer - - * generic/tclCompile.c: fixed incorrect operands for INST_LIST [Bug - 458241] (David Cuthbert, dacut@users.sourceforge.net) - -2001-09-03 Jeff Hobbs - - * generic/tclExecute.c (TclExecuteByteCode): fixed missing comma in - debug macro. - -2001-09-03 Donal K. Fellows - - * doc/ExprLongObj.3: Fixed error in documentation of argument type to - Tcl_ExprObj [Bug 457435] - -2001-09-02 David Gravereaux - - * win/tclWinThrd.c: Portability fix for Cygwin who's c-runtime, - not surprisingly, doesn't have the MSVCRT specific _beginthreadex / - _endthreadex pair. This might have to be revisited for proper Borland, - lcc32, Watcom and other support as well. [Patch 444255] - - * win/tclWinThrd.c: Moved FinalizeConditionEvent() proto to within - the main #ifdef TCL_THREADS block to avoid mingw warning about it - being there but unused. - - * win/makefile.vc: Added -Zl (zee el) to tclStubLib.c compile line to - make sure the tclstub84.lib static library is built without requiring - a specific C-runtime library at link-time for the end-use developer. - It has been noted on c.l.t that this trips many first time users - trying to make extensions. [Patch 403533] - -2001-08-31 Jeff Hobbs - - * generic/tclInt.h: added TclCompileListCmd header - * generic/tclBasic.c: added TclCompileListCmd compile proc - * generic/tclCompCmds.c (TclCompileListCmd): function to compile the - 'list' command at parse time. - * generic/tclExecute.c (TclExecuteByteCode): definition of INST_LIST - bytecode. - - * doc/StringObj.3: added words of warning to use Tcl_ResetResult with - the Tcl_Append* functions. - - * tests/compile.test: added compile-11.* interp result checks - * generic/tclUtil.c (TclGetIntForIndex): added Tcl_ResetResult before - Tcl_AppendStringsToObj to prevent shared object crash when called from - bcc instruction. The Tcl_Append* calls that append to the result - object that are invoked by bcc insts must remember to call - Tcl_ResetResult because the bcc doesn't do this for us. [Bug 456892] - -2001-08-30 Jeff Hobbs - - * generic/tclIndexObj.c: fixed some casting problems that upset Crays. - [Bug 419528] (andreasen) - -2001-08-30 Don Porter - - * generic/tcl.h: Silence warning from Sun compiler. [Bug 454374] - -2001-08-30 Miguel Sofer - - * generic/tclExecute.c: allow cached fully-qualified command names to - be usable from different namespaces within the same interpreter - without forcing a new lookup. This speeds up scripts that pass command - names in variables ("this" in some OO packages). [Patch 456668] - -2001-08-30 Vince Darley - - Further fs updates. After examining the most common Tcl extensions - (TclX, BLT, Tk, TclPro, Mktclapp), it has been determined that only - TclpGetCwd and the Access/Stat/Open insert/delete hooks of the - internal fs functions are ever used. The remaining functions from - Tcl's internal interfaces have therefore been removed, since Tcl now - exports a more suitable public API (Tcl_FS...) - - * generic/tclInt.stubs: - * generic/tclInt.h: updated for removed internal functions. Some new - internal functions have been put in tclInt.h (and not exported in the - stub table because good public equivalents exist). - * generic/tclTest.c: some test functions used the internal private - APIs. These tests have been retained, but modified to use public APIs. - Also objectified the internal filesystem tests. - * win/tclWinFile.c: removed TclpStat, TclpAccess and refactored code - to use NativeAccess, NativeStat. This should speed up stat, access and - glob commands. - * win/tclWinFCmd.c: removed all TclpCopy/Rename/Delete File/Directory - string-based procedures which aren't used any more. Improved - efficiency of some other procedures. Ensure that filename conversions - with a NULL interp do not crash Tcl. - * mac/tclMacFCmd.c: wrapped long lines and cleaned up - TclpObjNormalizePath, removed all TclpCopy/Rename/Delete - File/Directory string-based procedures which aren't used any more. - * mac/tclMacFile.c: removed obsolete TclpStat, TclpAccess, TclpChdir, - etc. - * unix/tclUnixFCmd.c: removed use of TclpAccess, removed all - TclpCopy/Rename/Delete File/Directory string-based procedures which - aren't used any more. - * unix/tclUnixFile.c: removed obsolete TclpStat, TclpAccess, - TclpChdir, etc. - * tcl(Unix|Mac|Win)Chan.c: objectified TclpOpenFileChannel. - * various 'load' implementations all objectified. - * generic/tclFileName.c: removed redundant code. - * generic/tclIOUtil.c: removed TclStat, TclAccess, TclpListVolumes. - Fix to MatchInDirectory at the root of a volume. Also improved some - documentation, and improved default path joining behaviour for virtual - filesystems, especially regarding '~'. - * tests/fileName.test: added tests to check for bugs fixed above. - * doc/FileName.3: improved documentation - -2001-08-30 David Gravereaux - - * generic/tclAsync.c: - * generic/tclEvent.c: - * generic/tclInt.h: Improper cleanup of asyncMutex in tclAsync.c - repaired. TclFinalizeSynchronization() was trying to remove a - registered mutex that was dumped earlier when the TSD it was stored in - was cleared. This was only surfacing on *nix. Windows was being masked - by mutexes not actually being returned to the system! That was - repaired in a previous patch. Needed to add a private - TclFinalizeAsync() to tclAsync.c and called from Tcl_FinalizeThread(). - Pheww.. Is this done yet? [Bug 414419] requested by Rob Ratcliff - - -2001-08-28 Jeff Hobbs - - * generic/tclCompCmds.c (TclPushVarName): noted 'static' defn. - [Bug 453872] - -2001-08-26 Don Porter - - * library/auto.tcl (tcl_findLibrary): - * tests/unixInit.test (unixInit-2.{1,9}): - * unix/tclUnixInit.c (TclpInitLibraryPath): - * win/tclWinInit.c (TclpInitLibraryPath): Corrected inconsistency - between the search path for script libraries and the directory name - $DISTNAME into which distributions built by 'make test' unpack. [Bug - 455642] - -2001-08-24 Jeff Hobbs - - * tests/stringComp.test: added string-1.3 - * generic/tclCompCmds.c (TclCompileStringCmd): changed to return - TCL_OUT_LINE_COMPILE instead of TCL_ERROR when compiling and an - unknown string method is called. This is necessary as the string - command may be never called, or not until 'string' is redefined. - -2001-08-24 Vince Darley - - * doc/glob.n: documented windows-style path issue with glob. - [Bug 219392] - * doc/filename.n: documented windows path/file length limitation. - [Bug 454597] - -2001-08-24 Don Porter - - * tests/unixInit.test (unixInit-2.9): Corrected expected result to - match Tcl's quirky construction of its init library path. - -2001-08-23 Andreas Kupries - - * win/tclWinPipe.c (BuildCommandLine): Fixed [Bug 432499]. Part of the - code used the non-absolute path to the executable to determine - quoting. This failed if the absolute path contained spaces, but the - application name itself not. This bug caused no trouble on Win NT 5, - but does for other variants in the Win* family. Report and fix due to - Ken Poole . - -2001-08-23 Jeff Hobbs - - * unix/configure: - * unix/tcl.m4: added QNX-6 build support. [Bug 219410] (loverso) - - * unix/tclUnixFCmd.c: - * generic/tclIOUtil.c: - * generic/tclFileName.c: corrected minor compiler warnings. - -2001-08-23 Vince Darley - - Variety of small filesystem and vfs issues fixed or improved. The new - fs code allows many new opportunities for efficiency improvements - through the objectified API. The main changes integrated here are such - efficiency improvements. Some limitations of the original - implementation have also now been lifted. Meanwhile a variety of fs - bugs (some old, some new) have also been fixed. - - * generic/tclFileName.c: Made Tcl_FSSplitPath more efficient, and - removed some static string-based procedures which are no longer used. - Much more objectification. Tcl_FSJoinPath is now very efficient and - more aware of virtual filesystems. Clarified where the Mac-specific - code attempts to interpret Unix-style paths. Modified TclDoGlob to use - lstat not access to fix [Bug 434876] (L. Virden) - - * tcl(Win|Unix|Mac)FCmd.c: - * tcl(Win|Unix|Mac)File.c: replaced TclpListVolumes with - TclpObjListVolumes with different signature, updated code due to more - efficient signature of Tcl_FSGetTranslatedPath. Used cached native - paths where possible to improve efficiency -- this was completed on - MacOS, but on Unix and Win the traversal functions make the task much - more complex, so there are still some improvements possible there. - Removed unused TclpNormalizePath which had been left in tclWinFCmd.c. - Objectified all 'file attributes' functions. Fixed the new [Bug - 451571, Bruce Stephens] which is most obvious on Unix, but could occur - on MacOS or Windows. This bug actually existed in Tcl 8.3.x but was - only made obvious by the recent filesystem overhaul when the code was - exercised more heavily. - * tests/fileName.test: Three new tests to exercise the above bug, and - make sure it is fixed correctly. - * unix/tclUnixFile.c: avoid panic in glob when a link doesn't point - anywhere. It would probably be good to define exactly what Tcl should - do in circumstances like these, and make sure mac/win/unix all behave - accordingly. [Bug 417111] (Hemang Lavana). Also fixed - misleading/obsolete comment in the code. - * generic/tcl.stubs: changed signature of Tcl_FSGetTranslatedPath and - added Tcl_FSGetTranslatedStringPath. - These changes allow further optimisations in the FS code. - * generic/tcl.h: changed signature of Tcl_FSListVolumes so that it - doesn't require a Tcl interpreter plus result. Renamed Tcl_FSReadLink - to Tcl_FSLink with additional argument so we can support making links - in the future. [Patch: 450340] - * generic/tclInt.h: added declaration for TclpObjListVolumes. - Objectified internal call signatures for 'file attributes' functions, - and added an internal objectified get path type function. - * generic/tclIOUtil.c: added the moved function TclpListVolumes which - calls platform specific code (needed for backwards compatibility), and - improved efficiency of parts of the FS (particularly file - normalization). Much less copying and memory allocation is required - now. added new GetPathType so that changes in 'file volumes' can - actually affect files' types, and objectified more code. Made current - code work with test suite artificially changing current platform. - Added 'static' keywords where required. - * generic/tclIO.c: - * generic/tclTest.c: Added 'static' keywords, fixing [Bug 453872] (Bob - Techentin) - * generic/tclCmdAH.c: file command implementation updated for API - changes, removed unnecessary special-case SplitPath static function, - since it no longer helps prevent code duplication. Moved setting of - interpreter result to each individual location that actually required - it, to avoid very large code separation between reading and setting - the result. - * doc/FileSystem.3: updated documentation for the new or changed APIs, - and clarified some issues. - * doc/SplitPath.3: added pointer to newer APIs in FileSystem.3 - * doc/filename.n: clarified current implementation of tilde support on - Mac/Win. [Bug 453514] (Sergey Kuzmin) - * doc/glob.n: improved documentation for '-directory' and '-path' - options. - - There are now many private, obsolete, platform-specific 'Tclp' - string-based filesystem APIs which could be removed. We should check - whether any of these are used by extensions and, at least in Tcl 9, - remove them. - - The above changes signify a ***POTENTIAL INCOMPATIBILITY*** with - 8.4a3, since signatures of two functions in the new API have changed, - but not with older versions of Tcl. - -2001-08-23 Donal K. Fellows - - * generic/tclBinary.c (FormatNumber): Extract a long from the object - and not an int, to stop [binary format] from being unable to format - some input numbers on architectures where sizeof(int) is less than - sizeof(long) (particularly Alpha). [tiprender Bug 441861] - - * tests/format.test: Converted conditional execution of tests into a - test constraint. - -2001-08-22 Jeff Hobbs - - * win/Makefile.in: - * win/makefile.vc: updated install target for dde1.2 - * doc/dde.n: fixed dde man page (which was totally incorrect). - * tests/winDde.test: - * win/tclWinDde.c (Tcl_DdeObjCmd): added -binary option to dde request - command to allow for returning binary data. [Bug 227482] - Updated dde to 1.2 - - * tests/tcltest.test: added unixExecs constraint to files that used - 'grep' in the test. [Bug 453143] - - * library/tcltest/tcltest.tcl: fixed stdio constraint test. [Patch - 454050] (stanton) - Simplified unixExecs constraint test. - -2001-08-22 Don Porter - - * tests/ioUtil.test (ioUtil-3.*): Corrected errors in tests revealed - by fix of overagressive compiler. [Bug 451200] - -2001-08-21 Miguel Sofer - - * generic/tclCompCmds.c: - * tests/compile.test: Fixed overagressive compilation of [catch]: it - was catching errors at substitution time. [Bug 219184] - -2001-08-21 Jeff Hobbs - - * tests/tcltest.test (tcltest-12.2): fixed test that would break when - env vars weren't Tcl list friendly [Patch 454046] (stanton) - -2001-08-20 Jeff Hobbs - - * library/http/http.tcl (geturl): added port number to Host: header to - comply with HTTP/1.1 spec (RFC 2068). [Bug 452217] - -2001-08-16 David Gravereaux - - * tools/tcl.wse.in: - * tools/tcl.hpj.in: - * win/tcl.hpj.in: Removed -kb storage in CVS to ensure these text - files are checked-out in the translation mode CVS is in. Setting these - as binary as part of an effort to make sure they are always in CRLF, - no matter what the CVS translation, is bypassing how CVS works and is - confusing. - - * tools/genStubs.tcl: Removed LF-only output. Having to reconvert - back to CRLF before committing to CVS was giving me a headache. [Bug - 451333] - - * win/makefile.vc: replaced $(WINDIR) with $(include32) for the - .rc.res inference rule. winver.h wasn't getting included. [Bug 445630] - -2001-08-14 Miguel Sofer - - * generic/tclBasic.c: make the intial maxNestingDepth of an - interpreter be MAX_NESTING_DEPTH instead of a hardwired value. [Bug - 232564] - -2001-08-13 Miguel Sofer - - * tests/trace.test: Corrected test numbers. [Bug 449794] - -2001-08-12 Mo DeJong - - * unix/configure: Regen. - * unix/configure.in: - * unix/tcl.m4: Use GCC variable set by AC_PROG_CC instead of defining - our own using_gcc variable. - -2001-08-11 Vince Darley - - Variety of small issues introduced by the vfs code fixed: - * generic/tclIOUtil.c: uninitialised read. - * generic/tclFCmd.c: possible memory leak in file delete with error - condition. - -2001-08-10 Miguel Sofer - - * generic/tclVar.c: - * tests/trace.test: Insure that [array] traces work correctly for - undefined variables. [Bug 449094] - -2001-08-09 Mo DeJong - - * unix/Makefile.in: Delete the unused getcwd.o target. [Bug 440942] - -2001-08-08 Don Porter - - * library/dde/pkgIndex.tcl: - * library/http/http.tcl: - * library/http/pkgIndex.tcl: - * library/msgcat/msgcat.tcl: - * library/msgcat/pkgIndex.tcl: - * library/opt/optparse.tcl: - * library/opt/pkgIndex.tcl: - * library/reg/pkgIndex.tcl: - * library/tcltest/tcltest.tcl: - * library/tcltest/pkgIndex.tcl: Added checks for package dependencies. - Bumped patchlevels of changed packages: http 2.3.2, msgcat 1.2.2, - opt 0.4.3, tcltest 2.0.1. [Patch 448931] - - * README: - * generic/tcl.h: - * tools/tcl.wse.in: - * unix/configure: - * unix/configure.in: - * unix/tcl.spec: - * win/README.binary: - * win/configure: - * win/configure.in: Bumped up patchlevel to 8.4a4 to distinguish CVS - snapshots from the 8.4a3 release. This does not necessarily mean there - will be an 8.4a4 release. [Bug 448938] - -2001-08-06 Jeff Hobbs - - 8.4a3 RELEASE - - * changes: - * README: - * mac/README: - * unix/README: - * win/README.binary: updated for 8.4a3 release - - * generic/tclFileName.c (Tcl_FSSplitPath): update to Tcl style guide. - - * generic/tclFCmd.c (FileCopyRename): fixed mem leak in introduction - of vfs code where a new Tcl_Obj wasn't freed. - - * generic/tclCmdMZ.c (Tcl_RegexpObjCmd, Tcl_RegsubObjCmd): reordered - the retrieval of arguments to avoid shimmering bug when the pattern - and string referenced the same object. - - * unix/configure: regenerated - * unixE/tcl.m4: added GNU (HURD) configuration target. - [Patch 442974] (brinkmann) - - * win/README: made note of URL for Windows compilation notes - - * win/tclWinThrd.c (TclpFinalizeMutex, TclpFinalizeCondition): added - DeleteCriticalSection calls for cleanup [Patch 419683] - - * unix/tclUnixPipe.c (TclpCreateTempFile): fixed use of tmpnam, - which is dangerous. [Patch 442636] (lim) - The use of tmpnam in TclpTempFileName must still be changed. - - * tests/http.test (http-4.14): fixed variable error return. - [Bug 424252] - -2001-08-03 Jeff Hobbs - - * win/configure: regenerated - * win/tcl.m4: fixed DLLSUFFIX definition to always be ${DBGX}.dll. - This is necessary for TEA compliant builds that build shared against a - static-built Tcl. - * win/Makefile.in ($(TCLSH)): added $(TCL_STUB_LIB_FILE) to build - target, otherwise it wouldn't get generated in a static build. - -2001-08-06 Andreas Kupries - - * generic/tclIOCmd.c (Tcl_GetsObjCmd): Applied patch from [Bug 442665] - to fix the bug reported by it. The function can corrupt a freed object - if it is called with objc == 3. This is because it retrieves resultPtr - and does not increment its reference count, but then calls - Tcl_ObjSetVar2, which causes the retrieved resultPtr object to be - released. - -2001-08-06 Don Porter - - * doc/tclsh.1: Added note that the tclsh program is frequently - installed with the Tcl version numer as part of the name. [Patch - 402725] - - * generic/tclPkg.c: - * tests/pkg.test: [package forget] now forgets all of the package - arguments it receives, not stopping when a package is not found. [Bug - 415273] - -2001-08-02 Jeff Hobbs - - * generic/tclIOUtil.c (Tcl_FSMatchInDirectory): corrected - uninitialized value. - -2001-08-02 Mo DeJong - - * generic/tclPlatDecls.h: - * win/tclWinPort.h: Revert related changes made to improve - Cygwin support on 2001-07-18. This change ended up breaking the VC++ - build because of conflicts between Windows APIs and internal Tk APIs. - -2001-08-01 Jeff Hobbs - - * unix/tclUnixFCmd.c: minor casts to eliminate warnings. (lim) - [Patch 440218] - - * tests/parseOld.test: changed some tests that required testwordend to - exist to skip in a proper tcltest manner. [Bug 442663] - - * library/http/http.tcl (http::mapReply): the regsub'ing of \n and \t - to escape them was unnecessary. - -2001-07-31 Vince Darley - - Changes from TIP#17 "Redo Tcl's filesystem" - The following files were impacted: - * doc/Access.3: - * doc/FileSystem.3: - * doc/OpenFileChnl.3: - * doc/file.n: - * doc/glob.n: - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclCmdAH.c: - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclDate.c: - * generic/tclDecls.h: - * generic/tclEncoding.c: - * generic/tclFCmd.c: - * generic/tclFileName.c: - * generic/tclGetDate.y: - * generic/tclIO.c: - * generic/tclIOCmd.c: - * generic/tclIOUtil.c: - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclLoad.c: - * generic/tclStubInit.c: - * generic/tclTest.c: - * generic/tclUtil.c: - * library/init.tcl: - * mac/tclMacFCmd.c: - * mac/tclMacFile.c: - * mac/tclMacInit.c: - * mac/tclMacPort.h: - * mac/tclMacResource.c: - * mac/tclMacTime.c: - * tests/cmdAH.test: - * tests/event.test: - * tests/fCmd.test: - * tests/fileName.test: - * tests/io.test: - * tests/ioCmd.test: - * tests/proc-old.test: - * tests/registry.test: - * tests/unixFCmd.test: - * tests/winDde.test: - * tests/winFCmd.test: - * unix/mkLinks: - * unix/tclUnixFCmd.c: - * unix/tclUnixFile.c: - * unix/tclUnixInit.c: - * unix/tclUnixPipe.c: - * win/tclWinFCmd.c: - * win/tclWinFile.c: - * win/tclWinInit.c: - * win/tclWinPipe.c: - -2001-07-24 Mo DeJong - - * win/tclWinThrd.c (Tcl_CreateThread): Close Windows HANDLE returned - by _beginthreadex. The MS documentation states that this handle is not - closed by a later call to _endthreadex. - -2001-07-21 Don Porter - - * doc/pkgMkindex.n: - * library/package.tcl: Corrected documentation and usage message of - [pkg_mkIndex]. - -2001-07-18 Mo DeJong - - * generic/tclPlatDecls.h: Define TCHAR by including windows.h instead - of tchar.h since Cygwin does not support the tchar.h header. Include - CHECK_UNICODE_CALLS logic from tclWinPort.h. - * win/tclWinPort.h: Remove CHECK_UNICODE_CALLS logic. Remove include - of windows.h since this now done it tclPlatDecls.h. - * win/tclWinReg.c: Remove duplicate include of windows.h. - -2001-07-18 Andreas Kupries - - * generic/tclIO.c: Aftermath to [Bug 427196]. Squash empty buffers if - they are smaller than the requested buffersize, to prevent reusage of - old buffers and to honor changes in the requested buffersize made by - the user. - -2001-07-17 Mo DeJong - - * win/tclWinFile.c (TclpReadlink): Add Cygwin specific definition for - the TclpReadlink function. This method implements reading of symbolic - links when build with Cygwin. - -2001-07-17 Mo DeJong - - * win/tclWinPort.h: Add Cygwin specific defines for environ and - timezone variables. - -2001-07-17 Andreas Kupries - - * generic/tclIO.c (GetInput): Fixed [Bug 427196]. Memory was - overwritten because a buffer was used after a change of the requested - buffersize together with that requested buffersize and not its actual - size, which was smaller. Note that the continous reuse of the smaller - buffer negatively impacts performance. The system never allocates a - buffer with the newly requested bigger buffersize. - -2001-07-16 Mo DeJong - - * generic/tcl.h: Define __WIN32__ when __CYGWIN__ or __MINGW32__ is - defined. - * generic/tclAlloc.c: Define caddr_t when compiling with VC++ or - mingw. This type is already defined when compiling with Cygwin. - -2001-07-16 Mo DeJong - - * win/tclWinConsole.c: - * win/tclWinPipe.c: - * win/tclWinPort.h: - * win/tclWinSerial.c: - * win/tclWinThrd.c: - Remove unnecessary #includes of dos.h, direct.h, and tchar.h. This - will help the Cygwin porting effort since these headers do not exist - under Cygwin. - -2001-07-16 Jeff Hobbs - - * win/tclWinPipe.c (PipeClose2Proc): constrained the mutex lock to - just the TerminateThread call and waiting for termination. (jsmith) - - * generic/tclCmdMZ.c: Removed extra copy of the SCAN_* macros - #defined in generic/tclScan.c. [Bug 441230] (porter) - -2001-07-12 Donal K. Fellows - - * tests/unixInit.test (unixInit-2.8): Added extra constraint, - notInstalledInTmp, to stop this test from damaging installations in - /tmp; not much fun to have to reinstall the Tcl library every time you - run the test suite! - - * tests/subst.test (subst-10.*): Updated tests to check new behaviour - for 'break' in command substitutions. - (subst-1.2,subst-7.1): Error messages changed. - * doc/SubstObj.3: New file, to document Tcl_SubstObj. - * doc/subst.n: Improved and updated documentation for 'subst' to help - support the changed behaviour. - * generic/tcl.decls (generic-437): Declaration for Tcl_SubstObj - * generic/tcl.h (TCL_SUBST_*): Added flags for Tcl_SubstObj. - * generic/tclCmdMZ.c (Tcl_SubstObj,Tcl_SubstObjCmd): Divided into two - parts to allow people to access the innards of 'subst' and changed the - behaviour when command substitutions do a 'break' to be different from - 'continue'. Also now works with objects, which allows for some nifty - optimisations with variable substitutions and a slight improvement - with command substitutions. [TIP#36] - -2001-07-10 Mo DeJong - - * unix/Makefile.in: Add AR variable for use in STLIB_LD. - * unix/configure: Regen. - * unix/configure.in: Use STLIB_LD when defining MAKE_LIB and - MAKE_STUB_LIB. Subst RANLIB and AR. - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Add doc comment about STLIB_LD - command. Check ${AR} env var when setting STLIB_LD and delay - evaluation until make time. - * win/configure: Regen. - * win/tcl.m4 (SC_CONFIG_CFLAGS): Delay evaluation of ${AR} in STLIB_LD - and add flags to better match the Unix implementation. Don't bother - defining AR when using VC++ since it is not used. - -2001-07-06 Mo DeJong - - * win/configure: Regen. - * win/tcl.m4 (SC_CONFIG_CFLAGS): Pass -e _WinMain@16 in addition to - the -mwindows flag to work around a problem with ld when it - incorrectly use main() as the executable entry point when both - WinMain() and main() are available. - -2001-07-06 Donal K. Fellows - - * tests/cmdAH.test: Added leading zero to file modes to work around - fault in HPUX strtol() which ignores the base parameter. [Bug 438808] - -2001-07-05 Mo DeJong - - * win/Makefile.in: Subst DEPARG directly instead of relying on a - variable. This will make Cygwin builds faster since an extra exec will - be avoided. - * win/configure: Regen. - * win/configure.in: Subst DEPARG. - * win/tcl.m4 (SC_CONFIG_CFLAGS): Move AC_MSG_CHECKING after the - AC_CHECK_PROG so that status messages do not get mixed together. Set - DEPARG based on the results of the cygpath check so that we avoid - using an extra exec when it is not needed. Use ac_cv_cygwin status - flag instead of looking at the output of gcc -v, which works in the - case where -mno-cygwin is set in the CFLAGS. - -2001-07-04 Jeff Hobbs - - * README: - * mac/README: - * unix/README: - * win/README: - * win/README.binary: updated READMEs with purls - -2001-07-03 Mo DeJong - - * win/Makefile.in: Remove PATHTYPE variable. - * win/configure: Regen. - * win/configure.in: Don't subst PATHTYPE. - * win/tcl.m4 (SC_CONFIG_CFLAGS): Remove PATHTYPE variable. Set CYGPATH - to "cygpath -w" if the cygpath executable is found on the path. This - approach works for native Cygwin builds and cross compiles. - -2001-07-03 Jeff Hobbs - - * tests/var.test: - * generic/tclVar.c (Tcl_VariableObjCmd): added patch to check for - number of args. [Patch 426038] - - * generic/tclVar.c (Tcl_GetVar2Ex): added ability to recognize - TCL_TRACE_READS flags to cause creation of part1 in TclLookupVar to - make sure newly created array will get read traces triggered - appropriately. This is called by Tcl_ObjGetVar2, Tcl_GetVar, and - Tcl_GetVar2. - (TclSetIndexedScalar, TclSetElementOfIndexedArray): added read trace - triggering for lappend case. - (Tcl_LappendObjCmd): pass TCL_TRACE_READS to Tcl_ObjGetVar2 to trigger - possible read traces for new arrays. - - * generic/tclExecute.c (TclExecuteByteCode): added TCL_TRACE_READS - flag to INST_LAPPEND(_ARRAY)_STK case to trigger read traces for newly - created arrays. Removed unnecessary #ifdef for TCL_COMPILE_DEBUG in - INST_LOAD_SCALAR1 case. - - * tests/append.test: - * tests/appendComp.test: added tests for read trace triggering for - append and lappend. - -2001-07-03 Mo DeJong - - * tests/clock.test (clock-2.5): Adjust test so that it passes when the - time slice is 60 msecs, now passes under Windows 98. - -2001-07-03 Mo DeJong - - * win/tcl.m4 (SC_CONFIG_CFLAGS): Don't pass the v flag to ${AR} when - using gcc, verbose output is not needed. - -2001-07-03 Don Porter - - * tests/unixInit.test (unixInit-2.8): Changed test back to using - installation layout, adding comments explaining why the test writes to - the directories it does, and checks to avoid destroying other files in - /tmp. - -2001-07-03 Donal K. Fellows - - * tests/unixInit.test (unixInit-1.2): Fixed faults reported in - [Bug 438070] - well, at least enough to work on Solaris - and added - comments that should make what is going on in the test clearer. - -2001-07-02 Jeff Hobbs - - * tests/util.test: added util-4.6 - * generic/tclUtil.c (Tcl_ConcatObj): Corrected walking backwards over - utf-8 chars. [Bug 227512] - -2001-07-02 Don Porter - - * tests/unixInit.test (unixInit-2.8): Corrected test for all absolute - pathnames in library path when executable is installed near root - directory to use correct development directory layout. [Bug 438014] - - * tests/unixInit.test (unixInit-2.9): - * unix/tclUnixInit.c (TclpInitLibraryPath): - * win/tclWinInit.c (TclpInitLibraryPath): Corrected buggy - construction of search path entries relative to executable. Added test - for bad construction. [Bug 438014] - -2001-06-28 Miguel Sofer - - * generic/tclNamesp.c: Correction to faulty patch from [Bug 231259] - -2001-06-28 Donal K. Fellows - - * tests/unixInit.test (unixInit-1.2): Modified so as not to require a - local echo service, which fails on many systems which have that turned - off for security reasons... - -2001-06-27 Jeff Hobbs - - * generic/tclInt.h: - * generic/tclObj.c: - * unix/Makefile.in: added a -DPURIFY mode that makes Tcl_Obj's - allocated and free singularly (instead of in alloc in blocks and never - free) to allow checkers like Purify to operate better. - - * library/encoding/koi8-u.enc: added koi8-u (Ukranian variant) - encoding. - - * tests/subst.test: - * generic/tclUtf.c (Tcl_UtfBackslash): Corrected backslash handling of - multibyte utf-8 chars. [Bug 217987] - - * generic/tclCmdIL.c (InfoProcsCmd): fixed potential mem leak in info - procs that created objects without using them. - - * generic/tclCompCmds.c (TclCompileStringCmd): fixed mem leak when - string command failed to parse the subcommand. - - * doc/interp.n: - * doc/unknown.n: updated notes about what is in a safe interp. [Bug - 218605] - -2001-06-27 Donal K. Fellows - - * tests/event.test (event-11.5): Removed hard-coded port number which - could fail on some systems. [Bug 436727] - -2001-06-26 Mo DeJong - - * unix/Makefile.in: - * win/Makefile.in: Add `make shell` target. This target will set the - proper env vars before invoking tclsh from the build directory. - -2001-06-26 Mo DeJong - - * win/Makefile.in: Use : to separate VPATH entries. This works for - both Cygwin builds and cross builds, the VPSEP variable is simply - unneeded complexity. - * win/configure: Regen. - * win/configure.in: Don't subst VPSEP. - * win/tcl.m4 (SC_CONFIG_CFLAGS): Remove VPSEP variable. - -2001-06-26 Mo DeJong - - * unix/configure: Regen. - * unix/configure.in: Fix last checkin by removing export since that - only works in bash. - * win/configure: Regen. - * win/configure.in: Ditto. - -2001-06-26 Mo DeJong - - * unix/configure: Regen. - * unix/configure.in: Set CFLAGS to "" if the user did not set CFLAGS - in the env. This keeps AC_PROG_CC from adding "-g -O2" to the CFLAGS - by default. - * win/configure: Regen. - * win/configure.in: Ditto. - -2001-06-25 Mo DeJong - - * win/configure: Regen. - * win/configure.in: Use RC_DEFINE flag from tcl.m4. - * win/tcl.m4 (SC_CONFIG_CFLAGS): Set RC_DEFINE flag based on the - compiler in use. - -2001-06-25 Mo DeJong - - * win/tcl.m4 (SC_CONFIG_CFLAGS): Link to the imm32 library when - building with mingw gcc. - -2001-06-25 Mo DeJong - - * win/configure: Regen. - * win/tcl.m4 (SC_CONFIG_CFLAGS): When building with gcc, don't attempt - to link with LD or support dllwrap. Simply require a recent version of - Cygwin gcc or Mingw gcc that supports -shared. When linking, use gcc - instead of ld since gcc automatically includes libs like -lmsvcrt. - -2001-06-22 Mo DeJong - - * win/configure: Regen. - * win/configure.in: Add resource compiler fix from 8.3.3 to fix - compiling with mingw. - -2001-06-22 Mo DeJong - - * win/configure: Regen. - * win/tcl.m4: Fix silly typo in last checkin. - -2001-06-22 Mo DeJong - - * unix/Makefile.in: Set CFLAGS to @CFLAGS@ and @CFLAGS_DEFAULT@. Set - LDFLAGS to @LDFLAGS@ and @LDFLAGS_DEFAULT@. Add LDFLAGS_DEBUG and - LDFLAGS_OPTIMIZE to match the way CFLAGS_DEFAULT works. This will - support user set CFLAGS or LDFLAGS at configure time. - * unix/configure: Regen. - * unix/configure.in: Don't set CFLAGS to CFLAGS_DEFAULT, instead - subst CFLAGS_DEFAULT into the Makefile. Add AC_SUBST for - CFLAGS_DEFAULT, LDFLAGS_DEFAULT, LDFLAGS_DEBUG, and LDFLAGS_OPTIMIZE. - * unix/tcl.m4 (SC_ENABLE_SYMBOLS): Modify LDFLAGS_DEFAULT so that it - uses a Makefile variable just like CFLAGS_DEFAULT. - * win/Makefile.in: Set CFLAGS to @CFLAGS@ and @CFLAGS_DEFAULT@. Set - LDFLAGS to @LDFLAGS@ and @LDFLAGS_DEFAULT@. This will support user set - CFLAGS or LDFLAGS at configure time. - * win/configure: Regen. - * win/configure.in: Don't set CFLAGS or LDFLAGS, instead subst - CFLAGS_DEFAULT and LDFLAGS_DEFAULT into the Makefile. - * win/tcl.m4 (SC_ENABLE_SYMBOLS): Modify LDFLAGS_DEFAULT so that it - uses a Makefile variable just like CFLAGS_DEFAULT. - -2001-06-22 Mo DeJong - - * win/configure: - * win/tcl.m4 (SC_CONFIG_CFLAGS): Don't set LDFLAGS_DEBUG to -g or - LDFLAGS_OPTIMIZE to -O when compiling with gcc. These flags are not - needed and can cause problems with the Cygwin version of ld. - -2001-06-18 Donal K. Fellows - - * tests/unixInit.test (unixInit-1.2,unixInit-2.8): Added test for code - described below, and fixed a couple of errors that caused problems - during testing; the code to determine the installedTcl constraint was - wrong, and test unixInit-2.8 assumed that /tmp/lib was free for use - and could be deleted, which clashed nastily with my installation and - made other tests fail unnecessarily! - - * unix/tclUnixChan.c (TtyInit,TclpOpenFileChannel, - (Tcl_MakeFileChannel,TclpGetDefaultStdChannel): Alterations so that - the standard channels - stdin, stdout and stderr - have the correct - type and fconfigure options. This required making the initialisation - of serial lines a little more sophisticated to make the console behave - correctly in interactive mode... [Bug 219137 and duplicates] - -2001-06-16 Don Porter - - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclPanic.c (Tcl_PanicVA): - * mac/tclMacAppInit.c (main): - * mac/tclMacPanic.c (TclpPanic): - * unix/tclUnixPort.h: - * win/tclWinPort.h: Replaced TclMacSetPanic with TclpPanic for setting - a platform-specific panic handler. TclpPanic is NULL on Unix and - Windows. Fixes broken wish on Mac due to earlier patches. [Patch - 415648] - - * generic/tclIntPlatDecls.h: - * generic/tclStubInit.c: `make gentubs` after above changes. - -2001-06-13 Don Porter - - * mac/tclMacAppInit.c (main, Macintosh_Init): - * mac/tclMacBOAAppInit.c (main): - * mac/tclMacPanic.c: Applied patches from Dan Steffen correcting - problems on the Macintosh in the 2001-06-08 changes. - -2001-06-12 Donal K. Fellows - - * tests/regexp.test (regexp-18.12): - * generic/tclCmdMZ.c (Tcl_RegexpObjCmd): Fixed so that submatches - that do not match always have index pair {-1 -1} [Bug 219232] - -2001-06-08 Don Porter - - * generic/tcl.h: - * generic/tcl.decls: - * generic/tclPanic.c: Added CONST to Tcl_*Panic* public interfaces. - [Patch 415648, TIP 27] - - * generic/tclInt.decls: - * mac/tclMacAppInit.c (main): - * mac/tclMacBOAAppInit.c (main): - * mac/tclMacPanic.c: Modified special Mac implementations of - Tcl_*Panic* to be exact copies of the generic implementations. Added - TclMacSetPanic. The generic implementations should be used directly, - rather than copies, but that requires further changes by someone - familiar with the Mac build systems. [Patch 415648] - - * generic/tclDecls.h: - * generic/tclIntPlatDecls.h: - * generic/tclStubInit.c: `make gentubs` after above changes. - - * doc/Panic.3: - * unix/mkLinks: New file documenting Tcl_*Panic* public interfaces, - followed by `make mklinks`. [Patch 415648, Bug 219170, Bug 414936] - -2001-06-03 Jeff Hobbs - - * generic/tclUtil.c (Tcl_DStringAppendElement): patch to save an - extra strlen call. [Bug 428572] - -2001-05-30 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Added two casts to - INST_STR_CMP implementation to get rid of a couple warnings from the - SUNWspro C compiler. - - * generic/tclBasic.c (Tcl_GetMathFuncInfo,Tcl_ListMathFuncs): - * generic/tclCmdIL.c (Tcl_InfoObjCmd,InfoFunctionsCmd): - * generic/tcl.decls (generic table, positions 435+436): - * tests/info.test: - * doc/CrtMathFnc.3: - * doc/info.n: Changes due to TIP #15 "Functions to List and Detail - Math Functions" - -2001-05-28 Jeff Hobbs - - * library/init.tcl (unknown): removed errant " in error message - -2001-05-27 Jeff Hobbs - - * generic/regc_locale.c: updated character class range data for - Unicode v3.1.0 compliance. - * generic/tclUniData.c: regenerated from Unicode v3.1.0 data file (new - as of 2001-05-16). This brings Tcl to current unicode compliance. - - * tests/utf.test: added tests to check unicode 3 compliance - - * unix/Makefile.in (tclUtf.o): added tclUniData.c dependency. - - * tools/uniClass.tcl: added comments to output format and the script - for clarification. - - * tools/uniParse.tcl: corrected filename output and GetDelta macro to - use 'info' as param (was 'infO') - -2001-05-26 Donal K. Fellows - - * generic/tclVar.c (tclArraySearchType,SetArraySearchObj, - (ParseSearchId): Added code to speed up array searching by reducing - the amount of parsing needed for searchIds. - - * generic/tclObj.c (TclInitObjSubsystem): - * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): - * generic/tclNamesp.c (TclInitNamespaceSubsystem): - * generic/tclInt.h: Moved some Tcl_ObjType initialisation to - TclInitObjSubsystem to be with the bulk of the rest. [Patch 424851] - Committed by Miguel Sofer - -2001-05-23 Jeff Hobbs - - * tests/io.test: changed io-52.[9-11] to not be platform sensitive - with EOL translation. - - * library/encoding/cp1250.enc: - * library/encoding/cp1251.enc: - * library/encoding/cp1252.enc: - * library/encoding/cp1253.enc: - * library/encoding/cp1254.enc: - * library/encoding/cp1255.enc: - * library/encoding/cp1256.enc: - * library/encoding/cp1257.enc: - * library/encoding/cp1258.enc: - * library/encoding/cp874.enc: - * library/encoding/iso8859-6.enc: - * library/encoding/iso8859-7.enc: - * library/encoding/iso8859-8.enc: - * library/encoding/iso8859-10.enc (new): - * library/encoding/iso8859-13.enc (new): - * library/encoding/iso8859-14.enc (new): updated encoding tables based - on http://www.unicode.org/Public/MAPPINGS/. (kuhn) - -2001-05-23 Mo DeJong - - * unix/tcl.m4 (SC_PATH_TCLCONFIG): Fix comments, and typo in cached - variable name. - -2001-05-23 Mo DeJong - - * unix/tcl.m4 (SC_LOAD_TKCONFIG): Remove use of undefined TCLCONFIG - variable and call AC_MSG_RESULT to print the checking result. - * win/tcl.m4: Ditto. - -2001-05-22 Jeff Hobbs - - * generic/tclObj.c (TclAllocateFreeObjects): simplified - objSizePlusPadding to use sizeof(Tcl_Obj) (max) Corrected use of - tclObjsAlloced/Freed/Shared in TCL_MEM_DEBUG compile. - -2001-05-22 Miguel Sofer - - * generic/tclExecute.c: removed Tcl_DuplicateObj in INST_DUP - -2001-05-21 Jeff Hobbs - - * tests/tcltest.test (tcltest-19.1): fixed failing test that was - getting affected by Windows env handling of empty valued elements. - - * unix/tcl.m4: added more common install directories in which to - search for *Config.sh. [Bug 419812] - - * tests/cmdMZ.test (cmdMZ-1.4): added notLinux constraint to test to - prevent failure message on Linux due to OS caching bug. - - * tests/httpd (httpdRespond): added response to timeout value in query - string. - - * tests/http.test: removed unused notLinux constraint setting - - * generic/tclRegexp.c (Tcl_RegExpExecObj): added use of - Tcl_GetUnicodeFromObj. - -2001-05-19 Andreas Kupries - - * Note that "tclbench" (see project "tcllib") was extended with - performance benchmarks for [fcopy] too. - - * doc/fcopy.n: Updated to reflect the extended behaviour of 'fcopy'. - - * tests/io.test: Added tests 'io-52.9', 'io-52.10' and 'io-52.11' to - test the handling of encodings by 'fcopy' / 'TclCopychannel'. [Bug - 209210] - - * generic/tclIO.c: Split of both 'Tcl_ReadChars' and 'Tcl_WriteChars' - into a public error checking and an internal working part. The public - functions now use the new internal ones. The new functions are - 'DoReadChars' and 'DoWriteChars'. Extended 'CopyData' to use the new - functions 'DoXChars' when required by the encodings on the input and - output channels. [Bug 209210] - -2001-05-16 Jeff Hobbs - - * library/history.tcl (tcl::HistAdd): prevent empty calls from being - added to the history (arndt) - - * tests/error.test: updated error-1.3 message to account for string - index being compiled at toplevel. - * tests/appendComp.test: - * tests/stringComp.test: new files for extended bytecode testing - - * generic/tclBasic.c: added new CompileProc invocations to basic - command initialization. - * generic/tclCompCmds.c: added new compile commands for append, - lappend, lindex and llength. Refactored set and incr compile commands - to use new TclPushVarName function for handling the varname component - during compilation (also used by append and lappend). Changed string - compile command to compile toplevel code as well (when possible). - * generic/tclCompile.c: added new instruction enums - * generic/tclCompile.h: added debug info for new instructions - * generic/tclExecute.c (TclExecuteByteCode): moved elemPtr to toplevel - var (oft-used). Added definitions for new bytecode instructions - INST_LIST_INDEX, INST_LIST_LENGTH, INST_APPEND_SCALAR1, - INST_APPEND_SCALAR4, INST_APPEND_ARRAY1, INST_APPEND_ARRAY4, - INST_APPEND_ARRAY_STK, INST_APPEND_STK, INST_LAPPEND_SCALAR1, - INST_LAPPEND_SCALAR4, INST_LAPPEND_ARRAY1, INST_LAPPEND_ARRAY4, - INST_LAPPEND_ARRAY_STK, INST_LAPPEND_STK. - Refactored repititious code for reuse with INST_LOAD_STK (same as - INST_LOAD_SCALAR_STK), INST_STORE_STK (same as INST_STORE_SCALAR_STK). - Updated INST_STR_CMP with style of fix of 2001-04-06 Fellows - [Bug 219201] as that fix only affected the runtime eval'ed "string" - (string compare is normally byte-compiled now). We may want to back - these out for speed in the future, noting the problems with \x00 - comparisons in the docs. - * generic/tclInt.h: declarations for new compile commands. - * generic/tclVar.c: change TclGetIndexedScalar, - TclGetElementOfIndexedArray, TclSetElementOfIndexedArray and - TclSetIndexedScalar to use flags. The Set functions now support - TCL_APPEND_ELEMENT and TCL_LIST_ELEMENT as well. - * generic/tclInt.decls: - * generic/tclIntDecls.h: minor signature changes for above. - - * generic/tclCmdMZ.c: made use of new Tcl_GetUnicodeFromObj. - -2001-05-16 Donal K. Fellows - - * doc/console.n: Deleted. Put it in the wrong source tree! D'oh! - -2001-05-15 Jeff Hobbs - - * generic/tcl.decls: - * generic/tclDecls.h: - * generic/tclStubInit.c: - * generic/tclStringObj.c (Tcl_GetUnicodeFromObj): new function to - parallel Tcl_GetStringFromObj (fix of an API oversight). - - * unix/tclUnixPipe.c: updated pipeChannelType to TCL_CHANNEL_VERSION_2 - type specification. - - * tests/fileName.test: corrected tests not to fail on win when a - C:/test dir exists. - - * generic/tclFileName.c (ExtractWinRoot): corrected ABR error - -2001-05-15 Miguel Sofer - - * tests/lindex.test: added test for nested braces [Patch 423617] - -2001-05-15 Miguel Sofer - - * generic/tclInt.h: - * generic/tclNamesp.c: invalidate all bytecodes in a namespace if a - new command shadows a bytecoded command. - * tests/namespace.test: - Patched from [Bug 231259] - -2001-05-15 Donal K. Fellows - - * doc/console.n: Created. It seems very odd to me that the console - implementation is part of the Tcl distribution and not part of Tk, but - given the location of the source, the documentation must obviously - match up... - -2001-05-14 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): - * tests/string.test (string-4.14): Negative string indices should not - be added as offsets to the result of [string first] but instead be - treated as referring to the start of the string. [Bug 423581] - -2001-05-11 Mo DeJong - - * unix/Makefile.in: Add a LDFLAGS variable to the Makefile instead of - directly substing @LDFLAGS@. - * unix/configure: Regen. - * unix/tcl.m4: Fix CFLAGS_DEFAULT so that the name of a Makefile - variable is passed as @CFLAGS@. - * win/Makefile.in: Move the setting of CFLAGS higher up in the - Makefile. - * win/configure: Regen. - * win/configure.in: Use dnl to comment out macros so that they are not - accidently expanded. - * win/tcl.m4: Fix CFLAGS_DEFAULT so that the name of a Makefile - variable is passed as @CFLAGS@. - -2001-05-07 Miguel Sofer - - * generic/tclExecute.c: insure different rand() seeds in different - threads. [Bug 416643] - -2001-05-03 Jeff Hobbs - - * tests/tcltest.test: removed extraneous 'c' (doh!) [Bug: 414031] - - * tools/tcltk-man2html.tcl: removed use of 'exec' for portability and - fixed up code. - -2001-05-03 Don Porter - - * doc/library.n: - * library/init.tcl: - * tests/autoMkindex.t*: Modified [auto_import] to apply pattern - matching in the [namespace import] style. [Bug 420186] - ***POTENTIAL INCOMPATIBILITY*** for any callers of [auto_import] from - outside Tcl that expect the pattern matching to be like that of - [string match]. - -2001-05-03 Miguel Sofer - - * generic/tclParse.c: - * tests/namespace.test: Insure consistent behaviour of the [unknown] - command: when a command is unknown, it is always processed by - [::unknown], ignoring any namespace proc which happens to be called - "unknown" [Patch 421166, Bug 420507] - -2001-05-02 Don Porter - - * tools/genStubs.tcl: Add a package require of Tcl 8 at the beginning - of the script so that the script will print a descriptive error - message when run in an old Tcl 7 shell. - -2001-04-27 Kevin Kenny - - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclCmdIL.c: - * generic/tclProc.c: - * generic/tclVar.c: Added another collection of missing CONSTs related - to TclGetNamespaceForQualName. - * generic/tclIntDecls.h: Regenerated. - -2001-04-25 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4: Subst TCL_THREADS into tclConfig.sh. - * unix/tclConfig.sh.in: Add TCL_THREADS variable. - * win/configure: Regen. - * win/tcl.m4: Subst TCL_THREADS into tclConfig.sh. - * win/tclConfig.sh.in: Add TCL_THREADS variable. - -2001-04-25 Mo DeJong - - * unix/configure: Regen. - * unix/configure.in: Use $@ in MAKE_LIB and MAKE_STUB_LIB commands - instead of using a delayed subst variable. Replace instances of - STUB_LIB_FILE with TCL_STUB_LIB_FILE. - -2001-04-25 Mo DeJong - - * unix/Makefile.in: Use TCL_STUB_LIB_FILE instead of STUB_LIB_FILE. - * unix/configure: Regen. - * unix/configure.in: Don't subst STUB_LIB_FILE, use TCL_STUB_LIB_FILE - instead. - -2001-04-25 Donal K. Fellows - - * tools/encoding/iso8859-15.txt: - * library/encoding/iso8859-15.enc: Oops! Got the full encoding wrong. - Should be fixed now... - - * tools/encoding/iso8859-15.txt: - * library/encoding/iso8859-15.enc: - * tools/tcl.wse.in: Added ISO 8859-15 (a.k.a. Latin-1 + Euro currency - symbol) support. - - * generic/tclNamesp.c: - * generic/tclBasic.c (TclRenameCommand): Missing CONST from several - declarations relating to use of TclGetNamespaceForQualName - -2001-04-24 Kevin B. Kenny - - * doc/AssocData.3: - * doc/CrtCommand.3: - * doc/CrtMathFnc.3: - * doc/CrtObjCmd.3: - * doc/ExprLong.3: - * generic/tclBasic.c: - * generic/tclCmdMZ.c: - * doc/CrtSlave.3: - * generic/tclNamesp.c: - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclInt.decls: - * generic/tclInt.h: (TIP #27) Another round of CONST changes, this - time adding CONST to the API's exported from tclBasic.c. [Patch - 415179] - ***POTENTIAL INCOMPATIBILITY*** from 8.4a2, in which Vince Darley's - changes to command tracing were added. A const has been added to the - type signature of one of the parameters to Tcl_CommandTraceProc. - -2001-04-10 Kevin B. Kenny - - * unix/tclUnixTime.c: Altered code to use memcpy instead of - structure assigments in an effort to achieve better K&R - compatibility. - -2001-04-10 Kevin B. Kenny - - * unix/tclUnixTime.c: Fixed silly typo in calls to 'gmtime' and - 'localtime' that broke the Linux build. - -2001-04-09 Kevin B. Kenny - - * unix/tclLoadShl.c: Added DYNAMIC_PATH to the load flags so that the - SHLIB_PATH will be searched for other libraries. [Bug 219140] - -2001-04-09 Kevin B. Kenny - - * unix/tcl.m4: Added _REENTRANT to Solaris build so that thread safe - library routines are included. - * unix/configure: Re-ran 'autoconf' with changed tcl.m4 - * tclUnixTime.c: Modified for thread safety of 'gmtime' and - 'localtime' system calls. [Bugs 219136 and 232558] - -2001-04-09 Donal K. Fellows - - * tests/expr.test (expr-21.*): Tests to check below fix. - * generic/tclParseExpr.c (GetLexeme): Now recognises the - non-numeric boolean literals for what they are. It no longer makes - sense for anyone to create functions with the same name as one of - them, but this was true in 7.* as well [Bug 217777; finally!] - -2001-04-07 Miguel Sofer - - * generic/tclExecute.c: Avoid panic when there are extra items in the - tcl stack. [Bug 406709, Patch 414470] - * tests/foreach.test: test to exercise the patch - -2001-04-07 Miguel Sofer - - * doc/namespace.n: document correct functionality - * generic/tclNamesp.c: corrected behaviour of [namespace code] - [Bug 219385, Patch 403530] - * library/init.tcl: - * tests/namespace-old.test: test correct functionality - * tests/namespace.test: test correct functionality - -2001-04-07 Andreas Kupries - - * unix/Makefile.in (checkdoc): New target, checking the definitions as - found in the compiled library against the manpages to find - undocumented public functionality. - - * unix/mkLinks: Updated to include the new manpage. - - * doc/UniCharIsAlpha.3: New manpage documenting the Unicode - character classification APIs. [Bug 218720] - -2001-04-07 Andreas Kupries - - * unix/mkLinks: Updated to incorporate the changes below. - - * doc/StringObj.3: Added 'Tcl_AttemptSetObjLength' to the NAME - section. [Bug 414435] - - * doc/Alloc.3: Added both 'Tcl_AttemptAlloc' and 'Tcl_AttemptRealloc' - to the NAME section. [Bug 414435] - - * doc/Utf.3: Added both 'Tcl_UniCharCaseMatch' and - 'Tcl_UniCharNcasecmp' to the NAME section. [Bug 414435] - -2001-04-06 Don Porter - - * library/init.tcl: - * tests/init.test: Modified processing of $::errorInfo by [unknown] - when the auto-loaded command throws an error to better cover the - tracks of auto-loading. [Bug 219280, Patch 403551] - -2001-04-06 Donal K. Fellows - - * doc/read.n: Added section on "USE WITH SERIAL PORTS" to resolve - [Bug 219402] - - * tests/string.test (string-2.30): Test for this case - * generic/tclCmdMZ.c (Tcl_StringObjCmd, STR_COMPARE branch): Fixed - problem caused by Utf-rep of \x00 being more than Utf-rep of \x01 - fooling memcmp by forcing everything through Utf-based comparisons. - Added optimizations for case where objects have a string/unicode-rep - or a bytearray-rep (i.e. where we can perform comparisons on - fixed-size units). [Bug 219201] - * generic/tclUtf.c (Tcl_UtfNcmp): Corrected seriously erroneous - comment. - -2001-04-05 Andreas Kupries - - * doc/Macintosh.3: Removed duplicates from .SH line. [Bug 413983] - -2001-04-05 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Fixed so will compile - with K&R compilers. [Patch 413844, Bug 413847] - -2001-04-04 Don Porter - - * generic/tclMain.c: Patch from Kevin Kenny to restore support of - pre-ANSI compilers. [Bug 413846, Patch 413842] - -2001-04-04 Andreas Kupries - - * unix/mkLinks: Updated to contain the new manpage. - - * doc/Environment.3: New manpage, describes Tcl_PutEnv. [Bug 219171] - - * doc/Macintosh.3: New manpage describing the macintosh specific parts - of the public API. [Bug 219169] - -2001-04-04 Jeff Hobbs - - * unix/configure: - * unix/tcl.m4: extended test of termios vs. termio vs. sgtty to - better detect result on Linux and when certain configure - redirections are being used. [Patch 402923; Bug 227412, 219194] (max) - -2001-04-04 Andreas Kupries - - * generic/tclTest.c: - * tests/io.tests: TIP #10 followup correcting a problem with the - original patch because of the lack of 'testthread id' for a - non-threaded compilation. - -2001-04-04 Kevin Kenny - - * doc/ByteArrObj.3: - * doc/DumpActiveMemory.3: - * doc/InitStubs.3: - * doc/PkgRequire.3: - * doc/StringObj.3: - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclBinary.c: - * generic/tclCkalloc.c: - * generic/tclDecls.h: - * generic/tclListObj.c: - * generic/tclObj.c: - * generic/tclPkg.c: - * generic/tclStringObj.c: - * generic/tclStubLib.c: (TIP#27) Changed a number of Tcl API's to - accept "CONST char*" in place of simple "char*". (kennykb) [Patch - 404026] - -2001-04-04 Jeff Hobbs - - * generic/tclListObj.c (Tcl_SetListObj): set objPtr->length = 0 in - empty object case to maintain sanctity of Tcl_Obj bytes/length - pairing. [Patch 405998] (porter) - -2001-04-03 Andreas Kupries - - * unix/mkLinks: Added 'Signal.3', 'Tcl_WaitPid'. - - * doc/DetachPids.3: Added description of 'Tcl_WaitPid' [Bug 219173]. - - * doc/Signal.3: New man page describing the public API procedures - 'Tcl_SignalId' and 'Tcl_SignalMsg'. [Bug 219172] - -2001-04-02 Jeff Hobbs - - * README: - * win/README: - * win/README.binary: further notes corrections. - - * win/configure: - * win/tcl.m4 (SHLIB_LD): added -incremental:no. [Bug 219381] - -2001-04-01 Jeff Hobbs - - * README: - * mac/README: - * win/README: - * win/README.binary: - * unix/README: updated patchlevel information to 8.4a3 and updated - links and notes. - - * generic/tcl.h: - * tools/tcl.wse.in: - * win/configure.in (VER): - * win/configure: - * unix/configure: - * unix/configure.in (VER): - * unix/tcl.spec: updated patchlevel information to 8.4a3 - -2001-03-30 Jeff Hobbs - - * generic/tclCkalloc.c (TclFinalizeMemorySubsystem): set curTagPtr - to NULL to allow for reuse. - * generic/tclEvent.c (Tcl_Finalize): moved the tsdPtr initialization - inside the subsystemsInitialized check to prevent it potentially - getting called twice during finalization. - [Patch 403532, Bug 219391] (wu) - - * generic/tclThreadTest.c (Tcl_ThreadObjCmd): cast fixes - * generic/tclTest.c (TestChannelCmd): added cast to mollify Windows - debug build. - - * win/tclWinSock.c (SocketEventProc): Fixed race condition in - readability of socket on Windows. [Patch 410674, Bug 219205, 219333] - - * win/tcl.m4: added imm32.lib to LIBS_GUI for Tk IME support. - - * win/Makefile.in (install-libraries): removed extra \s that broke - the target. - (install-doc): improved install-* targets to use their base build - dependency. - -2001-03-30 Andreas Kupries - - * All of the changes below belong to TIP #10 [Tcl I/O Enhancement: - Thread-Aware Channels]. See also [Patch 403358] at SF. - - * generic/tclIO.h (struct ChannelState, line 236f): Extended the - structure with a new field of type 'Tcl_ThreadId' to hold the id of - the thread currently managing all channels with this state. - - Note: This structure is shared by all channels in a stack of - transformations. - - * generic/tclIO.c (Tcl_CreateChannel, lines 1058-1065): Modified to - store the Id of the current thread in the 'ChannelState' of the new - channel. - - * generic/tclIO.c (Tcl_SpliceChannel, lines 2265-2270): Modified in - the same manner as 'Tcl_CreateChannel' as the channel will be managed - by the current thread afterward. - - * generic/tclIO.c (Tcl_GetChannelThread, lines 1478-1503): - * generic/tcl.decls (Tcl_GetChannelThread, lines 1504-1506): New API - function to retrieve the Id of the managing thread from a channel. - Implementation and declaration. - - * generic/tclTest.c (TestChannelCmd, lines 4520-4532): Added - subcommand 'mthread' to query a channel about its managing thread. - -2001-03-29 Mo DeJong - - * tests/interp.test: Print out warning when testinterpdelete command - is not defined. Add tests that checks to make sure a child interp - inherits the parent's cwd. - -2001-03-29 Jeff Hobbs - - * doc/tcltest.n: corrected incorrect macro usage. - - * doc/lsort.n: corrected unbalanced nroff macros. - - * unix/tclUnixPipe.c (TclpCreateTempFile): prevent potential race - condition and security leak in tmp filename creation. - [Patch 402924] (max) - - * unix/configure: - * unix/tcl.m4: corrected IRIX-5.x config to not use -n32. - [Patch 403626] (english) - - * unix/tclUnixThrd.c (Tcl_ConditionWait): fixed handling of timeout - for threads (corrects excessive CPU usage issue for Tk on Unix in - threaded Tcl environment). [Bug 411603] (ruppert) - -2001-03-29 Donal K. Fellows - - * doc/lsort.n: Added some notes that clarify the behaviour of - [lsort] as well as a whole bunch of examples. [Bug 219202] - -2001-03-27 Jeff Hobbs - - * doc/Alloc.3: corrected docs to note that Tcl_Attempt* return char - *'s, not ints. [Bug 411388] - - * tests/regexp.test (regexp-19.1): - * generic/tclCmdMZ.c (Tcl_RegsubObjCmd): fixed handling of nulls in - subspec value. - -2001-03-26 Don Porter - - * generic/tclDecls.h (Tcl_InitCustomHashTable): Correction to patch - from 2001-01-18; tclDecls.h was not generated using 'make genstubs'. - -2001-03-26 Donal K. Fellows - - * win/tclWinInt.h (tclWinTCharEncoding): Removed as now a static - variable in win/tclWin32Dll.c instead. - -2001-03-23 Jeff Hobbs - - * generic/tclVar.c (Tcl_ArrayObjCmd): Corrected retrieval of resultPtr - to prevent possible corruption. - - * generic/tclNamesp.c (Tcl_Import): Correctly freed a DString. - [Patch 403755] (lavana) - -2001-03-15 Donal K. Fellows - - * tests/set-old.test (set-old-7.2): Changed error behaviour of - [unset] to agree with documentation, so must change test as well. - -2001-03-14 Don Porter - - * library/package.tcl (pkg_mkIndex): Added patch from Vince Darley to - make [pkg_mkIndex -verbose] even more verbose. [Bug 219349, Patch - 403529] - -2001-03-13 Donal K. Fellows - - * doc/info.n: Improved documentation for [info hostname]. [Bug 403840] - - * generic/tclVar.c (Tcl_UnsetObjCmd): Made command behave as - documented [issue remaining from Bug 405769] - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): A missing {return TCL_OK;} - was causing memory corruption. [Bug 408002] - - * generic/tclExecute.c (TclDeleteExecEnv, GrowEvaluationStack, - (TclExecuteByteCode): Added some casts to ClientData that are - apparently needed on some architectures. - -2001-03-12 Donal K. Fellows - - * tests/string.test: Fixed some test numberings and added a test. - [Patch 403229] - -2001-03-06 Donal K. Fellows - - * generic/tclVar.c (Tcl_UnsetObjCmd): Rewrote argument parser to avoid - a read off the end of the argument array that could occur when - executing something like [unset -nocomplain] was executed. Improved - the error message given when too few arguments are given (-nocomplain - should obviously be *before* --, not after it) and also modified the - test suite to take account of that and the documentation to use the - same improvement. [Bug 405769] - -2001-03-02 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Fixed bug that could pass - pointers to freed memory to command implementations, which most - obviously caused some weird behaviour with [info level], but could - have caused problems with user code and command traces too. [Bug - 404865, Patch 405436] - -2001-02-23 msofer - - * no changes; fixing up the missing comment in the previous one. - Sorry. - -2001-02-23 msofer - - * /cvsroot/tcl/tcl/tests/execute.test: added test for evaluation of an - expression in a variable; evals once by compiling, second time using - the previous compilation - -2001-02-18 Kevin B. Kenny - - * doc/clock.n: Updated documentation to reflect the addition of - compat/strftime.c, including the correct formatting of ISO-8601:1988 - fiscal week number (%V). - -2001-02-15 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_SplitObjCmd): Improved efficiency of - splitting strings into individual characters by adding hash so that - only one Tcl_Obj per character is created. Improves performance of - splitting of short strings and makes a huge difference to splitting of - long strings, such as is done in the mime package in tcllib. [Bug - 131523] - -2001-01-31 Don Porter - - * win/makefile.vc (install-libraries): Corrected misdirected install - directory for the msgcat 1.2 package. - -2001-01-30 Don Porter - - * generic/tclIO.c (CopyData): Moved code that updates the count of how - many bytes are left to copy. Corrects bug that when writing occurs in - the background, the copy loop could be escaped without updating the - count, causing CopyData() to try to copy more bytes than the toRead - value originally passed to TclCopyChannel(), leading to hangs and - misreporting of number of bytes copied. [Bug 118203, Patch 103432] - -2001-01-18 Andreas Kupries - - Everything below belongs together, it fixes [Bug 123153] - - * generic/tcl.h (line 342): A bit more explanation about the default - value for TCL_PRESERVE_BINARY_COMPATABILITY. - - * generic/tcl.h (line 1208): Define the macro 'Tcl_InitHashTable' only - when TCL_PRESERVE_BINARY_COMPATIBILITY is not set as it kills binary - compatibility to 8.3 and earlier versions. This is the main part of - the patch/change. - - * generic/tcl.decls (line 1469): - * generic/tclHash.c (Tcl_InitHashTable): - * generic/tclHash.c (Tcl_InitHashTableEx): - * generic/tclObj.c (Tcl_InitObjHashTable): Changed - 'Tcl_InitHashTableEx' to 'Tcl_InitCustomHashTable'. This change is - more of an estethical nature, replacing the ubiquitous 'Ex' suffix - with a more meaningful name. The introduced binary incompatibility is - deemed acceptable as it is between alpha versions. Updated callers. - - * doc/Hash.3: - * unix/mkLinks: Changed 'Tcl_InitHashTableEx' to - 'Tcl_InitCustomHashTable'. - -2001-01-10 Donal K. Fellows - - * tests/winPipe.test (winpipe-1.20): - * tests/winDde.test (createChildProcess): - * tests/pkgMkIndex.test (pkgtest::createIndex): Removed assumption - that paths contain no spaces which causes problems with both [eval] - and [open |...] due to the well-known differences between lists and - strings. Fixes [Bug 119406] - -2001-01-04 Don Porter - - * tests/unixInit.test: - * unix/tclUnixInit.c (TclpInitLibraryPath): - * win/tclWinInit.c (TclpInitLibraryPath): Several entries in the - library path ($tcl_libPath) are determined relative to the absolute - path of the executable. When the executable is installed in or near - the root directory of the file system, relative pathnames were being - incorrectly generated, and in the worst case, memory access violations - were crashing the program. [Bug 119416, Patch 102972] - - ****************************************************************** - *** CHANGELOG ENTRIES FOR 2000 IN "ChangeLog.2000" *** - *** CHANGELOG ENTRIES FOR 1999 AND EARLIER IN "ChangeLog.1999" *** - ****************************************************************** diff --git a/ChangeLog.2002 b/ChangeLog.2002 deleted file mode 100644 index 9931657..0000000 --- a/ChangeLog.2002 +++ /dev/null @@ -1,4741 +0,0 @@ -2002-12-18 David Gravereaux - - * win/makefile.vc: some uses of xcopy swapped to the @$(CPY) macro. - Reported by Joe Mistachkin . - -2002-12-17 Jeff Hobbs - - * generic/tclNotify.c (TclFinalizeNotifier, Tcl_SetServiceMode): - (Tcl_ThreadAlert): Check that the stub functions are non-NULL before - calling them. They could be set to NULL by Tcl_SetNotifier. - -2002-12-16 David Gravereaux - - * generic/tclPipe.c (TclCleanupChildren): - * tests/winPipe.test: - * win/tclWinPipe.c (Tcl_WaitPid): - * win/tclWinTest.c: Gave Tcl_WaitPid the ability to return a Win32 - exception code translated into a posix style SIG*. This allows [close] - to report "CHILDKILLED" without the meaning getting lost in a - truncated exit code. In TclCleanupChildren(), TclpGetPid() had to get - moved to before Tcl_WaitPid() as the the handle is removed from the - list taking away the ability to get the process id after the wait is - done. This shouldn't effect the unix implimentaion unless waitpid is - called with a pid of zero, meaning "any". I don't think it is.. - -2002-12-13 Don Porter - - * unix/configure.in: Updated configure of CVS snapshots to reflect - * win/configure.in: the 8.4.1.1 patchlevel. - - * unix/configure: autoconf - * win/configure autoconf - -2002-12-11 Don Porter - - * generic/tclProc.c (ProcessProcResultCode): Fix failure to propagate - negative return codes up the call stack. [Bug 647307] - * tests/proc.test (proc-6.1): Test for Bug 647307 - - * generic/tclParseExpr.c (TclParseInteger): Return 1 for the string - "0x" (recognize leading "0" as an integer). [Bug 648441] - * tests/parseExpr.test (parseExpr-19.1): Test for Bug 648441. - -2002-12-09 Jeff Hobbs - - * win/tclWinThrd.c (TclpMasterUnlock): - * generic/tclThread.c (TclFinalizeThreadData): TclpMasterUnlock must - exist and be called unconditional of TCL_THREADS. [Bug 651139] - -2002-12-08 David Gravereaux - - * win/tclWinSock.c (SocketThreadExitHandler, InitSockets): Check - that the tsdPtr is valid before dereferencing as we call it from the - exit handler, too [Bug 650353]. Another WSAStartup() loaded version - comparison byte swap issue fixed. Although 0x0101 byte swapped is - still 0x0101, properly claiming which is major/minor is more correct. - -2002-12-06 Jeff Hobbs - - * generic/tclStubInit.c: regen - * generic/tclIntPlatDecls.h: regen - * generic/tclInt.decls: added TclWinResetInterface - - * win/tclWin32Dll.c (TclWinResetInterfaces): - * win/tclWinInit.c (TclpSetInitialEncodings, WinEncodingsCleanup): - add exit handler that resets the encoding information to a state where - we can reuse Tcl. Following these changes, it is possible to reuse Tcl - (following Tcl_FindExecutable or Tcl_CreateInterp) following a - Tcl_Finalize. - - * generic/tclIOUtil.c (TclFinalizeFilesystem): reset statics to their - original values on finalize to allow reuse of the library. - -2002-12-04 David Gravereaux - - * win/tclWinPipe.c: reverted back to -r1.27 due to numerous test - failures that need to be resolved first. The idea was good, but the - details aren't. - -2002-12-04 David Gravereaux - - * win/tclWinPipe.c (Tcl_WaitPid): When a process exits with an - exception, pass this notice on to the caller with a SIG* code rather - than truncating the exit code and missing the meaning. This allows - TclCleanupChildren() to report "CHILDKILLED". - - This has a different behavior than unix in that closing the read pipe - to a process sends the SIGPIPE signal which is returned as a SIGPIPE - exit status. On windows, we send the process a CTRL_BREAK_EVENT and - get back a CONTROL_C_EXIT which is documented to mean a SIGINT which - seems wrong as a system, but is the correct exit status. - -2002-12-04 Vince Darley - - * generic/tclIOUtil.c: fix to redirected 'load' in virtual filesystem - for some Unix systems. - - * generic/tclEvent.c: the filesystem must be cleaned up before the - encoding subsystem because it needs access to encodings. Fixes crash - on exit observed in embedded applications. - - * generic/tclTestObj.c: patch omitted from previous change of - 2002-11-13 - -2002-12-03 Jeff Hobbs - - * generic/tclStubLib.c (Tcl_InitStubs): prevent the cached check of - tclStubsPtr to allow for repeated load/unload of the Tcl dll by - hosting apps. [Bug 615304] - -2002-12-03 David Gravereaux - - * win/tclAppInit.c (sigHandler): Protect from trying to close a NULL - handle. - - * win/tclWinPipe.c (PipeClose2Proc, TclpCreateProcess): Send a real - Win32 signal (CTRL_C_EVENT) when the read channel is brought down to - alert the child to close on its side. Start the process with - CREATE_NEW_PROCESS_GROUP to allow the ability to send these signals. - The following test case now brings down the child without the use of - an external [kill] command. - - % set p [open "|[info name]" w+] - file8d5380 - % pid $p - 2876 - % close $p <- now doesn't block in Tcl_WaitPid() - % - - * win/tclWinPipe.c (PipeClose2Proc): Changed CTRL_C_EVENT to - CTRL_BREAK_EVENT as it can't be ignored by the child and proved to - work on [open "|netstat 1" w+] where CTRL_C_EVENT didn't. - -2002-11-27 David Gravereaux - - * win/tclWinPort.h: Don't turn off winsock prototypes! TclX didn't - like it. Even though the core doesn't use the prototypes, do offer - them. - - * win/tclWinSock.c: Removed shutdown() from the function table as it - wasn't referenced anywhere and cleaned-up some casting that that - wasn't needed. - - * win/tclWinSock.c: WSAStartup() loaded version comparison error which - resulted in 2.0 looking less than 1.1. - - * win/tclWinChan.c (Tcl_MakeFileChannel): return of DuplicateHandle() - incorrectly used. [Bug 618852] - -2002-11-26 Jeff Hobbs - - * generic/tclEncoding.c (TclFinalizeEncodingSubsystem): properly - cleanup all encodings by using Tcl_FirstHashEntry in the while loop. - - * unix/Makefile.in (valgrind): add simple valgrind target - - * tests/exec.test: unset path var to allow singleproc testing - - * generic/tclInterp.c (AliasCreate): preserve/release interps to - prevent possible FMR error in bad alias cases. - -2002-11-26 David Gravereaux - - * win/tclWinPort.h: - * win/tclWinSock.c: This patch does two things: - - 1) Cleans-up the winsock typedefs by using the typedefs provided by - winsock2.h. This has no effect on how winsock is initialized; just - makes the source code easier to read. [Patch 561305 561301] - - 2) Revamps how the socket message handler thread is brought up and - down to allow for cleaner exits without the use of TerminateThread(). - TerminateThread is evil. No attempt has been made to resolve [Bug - 593810] which may need a new channel driver version for adding a - registering function within the transfered thread to init the handler - thread. IOW, initialization of the TSD structure is getting bypassed - through the thread extension's [thread::transfer] command. - -2002-11-26 David Gravereaux - - * win/tclWinConsole.c: - * win/tclWinPipe.c: - * win/tclWinSerial.c: - * win/tclWinSock.c: - * win/tclWinThrd.c: - * win/tclWinTime.c: General cleanup of all worker threads used by the - channel drivers. Eliminates the normal case where the worker thread is - terminated ('cept the winsock one). Instead, use kernel events to - signal a clean exit. Only when the worker thread is blocked on an I/O - call is the thread terminated. Essentially, this makes all other - channel worker threads behave like the PipeReaderThread() function for - it's cleaner exit behavior. This appears to fix [Bug 597924] but needs - 3rd party confirmation to close the issue. - -2002-11-26 Mo DeJong - - * win/README: Update msys build env URL. This release #4 build both - tcl and tk without problems. - -2002-11-22 Jeff Hobbs - - * library/init.tcl: code cleanup to reduce use of - * library/opt/optparse.tcl: string compare - - * tests/interp.test: interp-14.4 - * generic/tclInterp.c (TclPreventAliasLoop): prevent seg fault when - creating an alias command over the interp name. [Bug 641195] - -2002-11-18 Jeff Hobbs - - * generic/tclUtil.c (SetEndOffsetFromAny): handle integer offset - after the "end-" prefix. - - * generic/get.test: - * generic/string.test: - * generic/tclObj.c (SetIntFromAny, SetWideIntFromAny): - * generic/tclGet.c (TclGetLong, Tcl_GetInt): simplify sign handling - before calling strtoul(l). [Bug 634856] - -2002-11-18 David Gravereaux - - * win/tclWinThrd.c (Tcl_CreateThread/TclpThreadExit): Fixed improper - compiler macros that missed the VC++ compiler. This resulted in VC++ - builds using CreateThread()/ExitThread() in place of the proper - _beginthreadex()/_endthreadex(). This was a large error and am - surprised I missed seeing it earlier. - -2002-11-13 Jeff Hobbs - - * generic/regexpComp.test: added tests 22.* - * generic/tclCompCmds.c (TclCompileRegexpCmd): add left and right - anchoring (^ and $) recognition and check starting or ending .* to - extend the number of REs that can be compiled to string match or - string equal. - -2002-11-13 Vince Darley - - * generic/tclCmdMZ.c: - * tests/trace.test: applied patch from Hemang Levana to fix [Bug - 615043] in execution traces with 'return -code error'. - - * generic/tclTestObj.c: - * tests/stringObj.test: added 'knownBug' test for [Bug 635200] - * generic/tclStringObj.c: corrected typos in comments - - * generic/tclFileName.c: - * tests/fileName.test: applied patch for bug reported against tclvfs - concerning handling of Windows serial ports like 'com1', 'lpt3' by the - virtual filesystem code. - - * doc/RegExp.3: clarification of the 'extendMatch' return values. - -2002-11-11 Jeff Hobbs - - * generic/tclUtil.c (Tcl_Backslash): use TclUtfToUniChar. - (Tcl_StringCaseMatch): use TclUtfToUniChar and add further - optimizations for the one-byte/char case. - - * generic/tclUtf.c: make use of TclUtfToUniChar macro throughout the - functions, and add extra optimization to Tcl_NumUtfChars for - one-byte/char case. - - * generic/tclVar.c (DisposeTraceResult, CallVarTraces): add proper - static declarations. - - * generic/tclStringObj.c (Tcl_GetCharLength): optimize for the ascii - char case. - (Tcl_GetUniChar): remove unnecessary use of Tcl_UtfToUniChar. - (FillUnicodeRep): Use TclUtfToUniChar. - - * generic/tclHash.c (HashStringKey): move string++ lower to save an - instruction. - - * generic/tclExecute.c (TclExecuteByteCode): improve INST_STR_CMP to - use memcmp in the one-byte/char case, also use direct index for - INST_STR_INDEX in that case. - - * generic/tclEncoding.c (UtfToUtfProc, UtfToUnicodeProc): - (TableFromUtfProc, EscapeFromUtfProc): Use TclUtfToUniChar. - (UnicodeToUtfProc, TableToUtfProc): add 1-byte char optimizations for - Tcl_UniCharToUtf call. These improve encoded channel conversion speeds - by up to 20%. - - * tests/split.test: added 1-char string split tests - * generic/tclCmdMZ.c (Tcl_SplitObjCmd): Use TclUtfToUniChar. Also - added a special case for single-ascii-char splits. - (Tcl_StringObjCmd): Use TclUtfToUniChar. For STR_RANGE, support - getting ranges of ByteArrays (reverts change from 2000-05-26). - (TraceExecutionProc) add proper static declaration. - - * generic/tclInt.h: add macro version of Tcl_UtfToUniChar - (TclUtfToUniChar) that does the one-byte utf-char check without - calling Tcl_UtfToUniChar, for use by the core. This brings notable - speedups for primarily ascii string handling. - - * generic/tcl.h (TCL_PATCH_LEVEL): bump to 8.4.1.1 for patchlevel - only. This interim number will only be reflected by [info patchlevel]. - -2002-11-11 Kevin Kenny - - * doc/Tcl.n: Corrected indentation of the new language. Oops. - -2002-11-10 Kevin Kenny - - * doc/Tcl.n: Added language to the Endekalogue to make it clear that - substitutions always take place from left to right. [Bug 635644] - -2002-11-06 Mo DeJong - - * changes: Note TclInExit TclInThreadExit changes. - * generic/tclEvent.c (TclInExit, TclInThreadExit): Split out - functionality of TclInExit to make it clear which one should be called - in each situation. - * generic/tclInt.decls: Declare TclInThreadExit. - * generic/tclIntDecls.h: Regen. - * generic/tclStubInit.c: Regen. - * mac/tclMacChan.c (StdIOClose): - * unix/tclUnixChan.c (FileCloseProc): - * win/tclWinChan.c (FileCloseProc): - * win/tclWinConsole.c (ConsoleCloseProc): - * win/tclWinPipe.c (TclpCloseFile): - * win/tclWinSerial.c (SerialCloseProc): Invoke the new TclInThreadExit - method instead of TclInExit. - -2002-11-06 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Generate a fatal configure error if - no ar program can be found on the path. [Bug 582039] - * win/configure: Regen. - * win/configure.in: Check that AR, RANLIB, and RC are found on the - path when building with gcc. - -2002-11-03 David Gravereaux - - * win/tclAppInit.c: Calls Registry_Init() and Dde_Init() when - STATIC_BUILD and TCL_USE_STATIC_PACKAGES macros are set. - - * win/makefile.vc: - * win/rules.vc: linkexten option now sets the TCL_USE_STATIC_PACKAGES - macro which also adds the registry and dde object files to the link - of the shell. [Patch 479697] Also factored some additional macros that - will be helpful for extension authors. Version grepping of tcl.h will - need to be added to complete this. - - * win/buildall.vc.bat: Added more descriptive commentary. - -2002-11-01 David Gravereaux - - * win/tclWinReg.c: Changed the Tcl_PkgProvide() line to declare the - registry extension at version 1.1 from 1.0. - -2002-10-31 Andreas Kupries - - * library/word.tcl: Changed $tcl_platform to $::tcl_platform to avoid - possible scope trouble. - -2002-10-29 Vince Darley - - * win/tclWinInt.h: - * win/tclWin32Dll.c: added comments about certain NULL function - pointers which will be filled in when Tcl_FindExecutable is called, so - that users don't report invalid bugs on this topic. (No code changes - at all). - -2002-10-29 Daniel Steffen - - * unix/tclLoadDyld.c (TclpFindSymbol): pass all dyld error messages - upstream [Bug 627546]. - -2002-10-28 Andreas Kupries - - * library/dde/pkgIndex.tcl: - * library/reg/pkgIndex.tcl: Changed the hardwired debug suffix (d) to - the correct suffix (g). - -2002-10-28 Don Porter - - * library/auto.tcl: Converted the Mac-specific [package unknown] - * library/init.tcl: behavior to use a chaining mechanism to extend - * library/package.tcl: the default [tclPkgUnknown]. [Bug 627660] - * library/tclIndex: [Patch 624509] (steffen) - -2002-10-26 David Gravereaux - - * win/makefile.vc: xcopy on NT 4.0 doesn't support the /Y switch - (overwrite). Added logic to handle this. [Bug 618019] - -2002-10-23 Donal K. Fellows - - * generic/tclInt.h: Removed definitions of obsolete HistoryEvent and - HistoryRev structures (the history mechanism has been written in Tcl - for some time now.) - -2002-10-22 Jeff Hobbs - - *** 8.4.1 TAGGED FOR RELEASE *** - - * changes: updated for 8.4.1 release - - * win/Makefile.in: removed @MEM_DEBUG_FLAGS@ subst. - * win/configure: regen - * win/configure.in: removed SC_ENABLE_MEMDEBUG call - * win/tcl.m4: replaced SC_ENABLE_MEMDEBUG with a more intelligent - SC_ENABLE_SYMBOLS that takes yes|no|mem|compile|all as options now. - -2002-10-22 Daniel Steffen - - * library/auto.tcl (tcl_findLibrary): - * library/package.tcl (tclPkgUnknown): on macosx, search inside the - Resources/Scripts subdirectory of any potential package directory. - * macosx/Tcl.pbproj/project.pbxproj: add standard Frameworks dirs to - TCL_PACKAGE_PATH make argument. - * unix/tclUnixInit.c (TclpSetVariables): on macosx, add embedded - framework dirs to tcl_pkgPath: @executable_path/../Frameworks and - @executable_path/../PrivateFrameworks (if they exist), as well as the - dirs in DYLD_FRAMEWORK_PATH (if set). [Patch 624509] - use standard MAXPATHLEN instead of literal 1024 - -2002-10-22 Donal K. Fellows - - * doc/StringObj.3, doc/Object.3: Documented that Tcl_Obj's standard - string form is a modified UTF-8; apparently, this was not mentioned - anywhere in the main docs, and lead to [Bug 624919]. - -2002-10-21 Daniel Steffen - - * macosx/Tcl.pbproj/project.pbxproj: bumped version to 8.4.1 - * generic/tcl.h: Added reminder comment to edit - macosx/Tcl.pbproj/project.pbxproj when version number changes. - -2002-10-18 Jeff Hobbs - - * library/reg/pkgIndex.tcl: - * win/configure: - * win/configure.in: - * win/Makefile.in: - * win/makefile.vc: - * win/makefile.bc: Updated to reg1.1 - - * doc/registry.n: Added support for broadcasting changes to the - * tests/registry.test: registry Environment. Noted proper code in the - * win/tclWinReg.c: docs. [Patch 625453] - - * unix/Makefile.in (dist): add any mac/tcl*.sea.hqx files - -2002-10-17 Don Porter - - * generic/tclVar.c: Fixed code that check for proper # of args to - * tests/var.test: [array names]. Added test. [Bug 624755] - -2002-10-16 Jeff Hobbs - - * win/configure: add workaround for cygwin windres - * win/tcl.m4 (SC_CONFIG_CFLAGS): problem. [Patch 624010] (howell) - -2002-10-15 Jeff Hobbs - - * README: added archives.tcl.tk note - - * unix/configure: - * unix/tcl.m4: Correct AIX-5 ppc build flags. Correct HP 11 64-bit gcc - building. [Patch 601051] (martin) - -2002-10-15 Vince Darley - - * generic/tclCmdMZ.c: - * tests/trace.test: applied patch from Hemang Levana to fix [Bug - 615043] in execution traces with idle tasks firing. - -2002-10-14 Jeff Hobbs - - * generic/tclEnv.c (Tcl_PutEnv): correct possible mem leak. [Patch - 623269] (brouwers) - -2002-10-11 Donal K. Fellows - - * generic/tcl.h: Need a different strategy through the maze of - #defines to let people building with Cygwin build correctly. Also made - some comments less misleading... - -2002-10-10 Jeff Hobbs - - * README: fixed minor nits [Bug 607776] (virden) - - * win/configure: - * win/tcl.m4: enable USE_THREAD_ALLOC (new threaded allocator) by - default in cygwin configure on Windows. - -2002-10-10 Don Porter - - * doc/Tcl.n: Clarified that namespace separators are legal in the - variable names during $-subtitution. [Bug 615139] - - * doc/regexp.n: Typo correction. Thanks Ronnie Brunner. [Bug 606826] - -2002-10-10 Vince Darley - - * unix/tclLoadAout.c - * unix/tclLoadDl.c - * unix/tclLoadDld.c - * unix/tclLoadDyld.c - * unix/tclLoadNext.c - * unix/tclLoadOSF.c - * unix/tclLoadShl.c - * win/tclWinLoad.c: allow either full paths or simply dll names to be - specified when loading files (the latter will be looked up by the OS - on your PATH/LD_LIBRARY_PATH as appropriate). Fixes [Bug 611108] - -2002-10-09 Jeff Hobbs - - * unix/README: doc'ed --enable-symbols options. - * unix/Makefile.in: removed @MEM_DEBUG_FLAGS@ subst. - * unix/configure: regen - * unix/configure.in: removed SC_ENABLE_MEMDEBUG call - * unix/tcl.m4: replaced SC_ENABLE_MEMDEBUG with a more intelligent - SC_ENABLE_SYMBOLS that takes yes|no|mem|compile|all as options now. - -2002-10-09 Kevin B. Kenny - - * win/tclWinTime.c: Added code to set an exit handler that terminates - the thread that calibrates the performance counter, so that the thread - won't outlive unloading the Tcl DLL. [Bug 620735] - -2002-10-09 Donal K. Fellows - - * doc/binary.n: More clarification of [binary scan]'s behaviour. - -2002-10-09 Daniel Steffen - - * generic/tclIntDecls.h: fixed botched regen. - -2002-10-09 Daniel Steffen - - * generic/tclInt.decls: made TclSetPreInitScript() declaration - generic as it is used on mac & aqua as well. - * generic/tclIntDecls.h: - * generic/tclStubInit.c: regen. - * generic/tclCompile.h: added prototype for TclCompileVariableCmd. - - * mac/tclMacPort.h: removed incorrect definitions and - obsolete definitions. - * mac/tclMacChan.c: removed obsolete GetOpenMode() and replaced - associated constants with the analogues (they existing defs - were inconsistent with which was causing havoc when - Tcl_GetOpenMode was used instead of private GetOpenMode). - - * mac/tclMacFCmd.c: removed GenerateUniqueName(), use equivalent (and - identically named) routine from MoreFiles instead. - - * mac/tclMacLoad.c: CONSTification, fixes to Vince's last changes. - - * mac/tclMacFile.c: - * mac/tclMacTest.c: - * mac/tclMacUnix.c: CONSTification. - - * mac/tclMacOSA.c: CONSTification, sprintf fixes, UH 3.4.x changes; - fix for missing autoname token from TclOSACompileCmd. (bdesgraupes) - * mac/AppleScript.html(AppleScript delete): doc fix. (bdesgraupes) - - * mac/tcltkMacBuildSupport.sea.hqx: updated MoreFiles to 1.5.3, - updated build instructions for 8.4. - * mac/tclMacProjects.sea.hqx: rebuilt archive. - -2002-10-09 Donal K. Fellows - - * doc/Alloc.3: Added a note to mention that attempting to allocate a - zero-length block can return NULL. [Tk Bug 619544] - -2002-10-04 Donal K. Fellows - - * doc/binary.n: Doc improvements [Patch 616480] - - * tests/fCmd.test, tests/winFCmd.test: - * tools/eolFix.tcl, tools/genStubs.tcl: [file exist] -> [file exists] - Thanks to David Welton. - -2002-10-03 Don Porter - - * doc/tcltest.n: fixed typo [Bug 618018]. Thanks to "JJM". - -2002-10-03 Donal K. Fellows - - * tools/man2help2.tcl: - * tests/http.test, tests/httpd, tests/httpold.test: - * tests/env.test, tests/binary.test, tests/autoMkindex.test: - * library/init.tcl, library/http/http.tcl: [info exist] should really - be [info exists]. [Bug 602566] - - * doc/lsearch.n: Better specification of what happens when -sorted is - mixed with other options. [Bug 617816] - -2002-10-01 Jeff Hobbs - - * generic/tclProc.c (TclCreateProc): mask out VAR_UNDEFINED for - precompiled locals to support 8.3 precompiled code. - (Tcl_ProcObjCmd): correct 2002-09-26 fix to look for tclProcBodyType. - -2002-10-01 Donal K. Fellows - - * doc/socket.n: Mentioned that ports may be specified as serivce names - as well as integers. [Bug 616843] - -2002-09-30 Jeff Hobbs - - * generic/tclCompCmds.c (TclCompileRegexpCmd): correct the checking - for bad re's that didn't terminate the re string. Resultant compiles - were correct, but much slower than necessary. - -2002-09-29 David Gravereaux - - * win/tclAppInit.c: Added proper exiting conditions using Win32 - console signals. This handles the existing lack of a Ctrl+C exit to - call exit handlers when built for thread support. Also, properly - handles exits from other conditions such as CTRL_CLOSE_EVENT, - CTRL_LOGOFF_EVENT, and CTRL_SHUTDOWN_EVENT signals. In all cases, - exit handlers will be called. [Bug 219355] - - * win/makefile.vc: Added missing tclThreadAlloc.c to the build rules - and defines USE_THREAD_ALLOC when TCL_THREADS is defined to get the - new behavior by default. - -2002-09-27 Don Porter - - * README: Bumped to version 8.4.1 to avoid confusion of - * generic/tcl.h: CVS snapshots with the actual 8.4.0 release. - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf - * win/configure: - -2002-09-26 Jeff Hobbs - - * unix/configure: regen. - * unix/tcl.m4: improve AIX-4/5 64bit compilation support. - - * generic/tclProc.c (Tcl_ProcObjCmd): correct overeager optimization - of noop proc to handle the precompiled case. (sofer) - - * unix/ldAix (nmopts): add -X32_64 to make it work for 32 or 64bit - mode compilation. - - * library/encoding/koi8-u.enc: removed extraneous spaces that confused - encoding reader. [Bug 615115] - - * unix/Makefile.in: generate source dists with -src designator and do - not generate .Z anymore (just .gz and .zip). - -2002-09-18 Mumit Khan - - Added basic Cygwin support. - - * win/tcl.m4 (SC_PATH_TCLCONFIG): Support one-tree build. - (SC_PATH_TKCONFIG): Likewise. - (SC_PROG_TCLSH): Likewise. - (SC_CONFIG_CFLAGS): Assume real Cygwin port and remove -mno-cygwin - flags. Add -mwin32 to extra_cflags and extra_ldflags. Remove ``-e - _WinMain@16'' from LDFLAGS_WINDOW. - * win/configure.in: Allow Cygwin build. - (SEH test): Define to be 1 instead of empty value. - (EXCEPTION_DISPOSITION): Add test. - * win/configure: Regenerate. - - * generic/tcl.h: Don't explicitly define __WIN32__ for Cygwin, let the - user decide whether to use Windows or POSIX personality. - (TCL_WIDE_INT_TYPE, TCL_LL_MODIFIER, struct Tcl_StatBuf): Define for - Cygwin. - * generic/tclEnv.c (Tcl_CygwinPutenv): putenv replacement for Cygwin. - * generic/tclFileName.c (Tcl_TranslateFileName): Convert POSIX to - native format. - (TclDoGlob): Likewise. - * generic/tclPlatDecls.h (TCHAR): Define for Cygwin. - * win/tclWinPort.h (putenv, TclpSysAlloc, TclpSysFree, - (TclpSysRealloc): Define for Cygwin. - -2002-09-26 Daniel Steffen - - * macosx/Makefile: preserve environment value of INSTALL_ROOT. When - embedding only use deployment build. Force relink before embedded - build to ensure new linker flags are picked up. - - * macosx/Tcl.pbproj/project.pbxproj: add symbolic links to debug lib, - stub libs and tclConfig.sh in framework toplevel. Configure target - dependency fix. Fix to 'clean' action. Added private tcl headers to - framework. Install tclsh symbolic link. Html doc build works when no - installed tclsh available. Made html doc structure in framework more - like in Apple frameworks. - -2002-09-24 Donal K. Fellows - - * unix/tcl.m4 (SC_TCL_64BIT_FLAGS): Yet more robust 64-bit value - detection to close [Bug 613117] on more systems. - - * generic/tclCompile.c (TclPrintSource): More CONSTifying. - * generic/tclExecute.c (EvalStatsCmd): Object-ify to reduce warnings. - Thanks to 'CoderX2' on the chat for bringing this to my attention... - - * unix/tcl.m4: Forgot to define TCL_WIDE_INT_IS_LONG at the - appropriate moment. I believe this is the cause of [Bug 613117] - - * doc/lset.n: Changed 'list' to 'varName' for consistency with lappend - documentation. Thanks to Glenn Jackman [Bug 611719] - -2002-09-22 Don Porter - - * library/tcltest/tcltest.tcl: Corrected [puts -nonewline] within - test bodies. Thanks to Harald Kirsch. [Bug 612786, Patch 612788] Also - corrected reporting of body return code. Thanks to David Taback [Bug - 611922] - * library/tcltest/pkgIndex.tcl: Bump to version 2.2.1. - * tests/tcltest.test: added tests for these bugs. - -2002-09-15 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Add PEEK_XCLOSEIM define under - Linux. This is used by Tk to double check that an X input context is - cleaned up before it is closed. - -2002-09-12 David Gravereaux - - * win/coffbase.txt: Added BLT to the virtual base address listings - table should BLT's build tools decide to use it. - -2002-09-12 Daniel Steffen - - * generic/tcl.h: - * mac/tclMacApplication.r: - * mac/tclMacLibrary.r: - * mac/tclMacResource.r: unified use of the two equivalent resource - compiler header inclusion defines RC_INVOKED and RESOURCE_INCLUDED, - now use RC_INVOKED throughout. - -2002-09-10 Mo DeJong - - * unix/README: Add note about building extensions with the same - compiler Tcl was built with. [Tk Bug 592096] - -2002-09-10 Daniel Steffen - - * macosx/Tcl.pbproj/project.pbxproj: disabled building html - documentation during embedded build. - -2002-09-10 Daniel Steffen - - * unix/Makefile.in: added DYLIB_INSTALL_DIR variable for macosx and - set it to default value ${LIB_RUNTIME_DIR} - * unix/tcl.m4 (Darwin): use DYLIB_INSTALL_DIR instead of - LIB_RUNTIME_DIR in the -install_name argument to ld. - * unix/configure: regen. - - * macosx/Tcl.pbproj/project.pbxproj: - * macosx/Makefile: added support for building Tcl as an embedded - framework, i.e. using an dyld install_name containing - @executable_path/../Frameworks via the new DYLIB_INSTALL_DIR - unix/Makefile variable. - -2002-09-10 Jeff Hobbs - - *** 8.4.0 TAGGED FOR RELEASE *** - -2002-09-06 Don Porter - - * doc/file.n: Format correction, and clarified [file normalize] - returns an absolute path. - - * doc/tcltest.n: Added examples section, as long promised. - -2002-09-06 Reinhard Max - - * tests/tcltest.test: Added nonRoot flag to tests 8.3, 8.4, and 8.12. - -2002-09-05 Don Porter - - * doc/tcltest.n: Clarified phrasing. - - * generic/tclBasic.c (TclRenameCommand,CallCommandTraces): - * tests/trace.test (trace-27.1): Corrected memory leak when a rename - trace deleted the command being traced. Test added. Thanks to Hemang - Lavana for the fix. [Bug 604609] - - * generic/tclVar.c (TclDeleteVars): Corrected logic for setting the - TCL_INTERP_DESTROYED flag when calling variable traces. [Tk Bug 605121] - -2002-09-04 Miguel Sofer - - * generic/tclVar.c (DeleteArray): leak plug [Bug 604239]. Thanks to - dkf and dgp for the long and difficult discussion in the chat. - -2002-09-03 Jeff Hobbs - - * generic/tclVar.c (Tcl_UpVar2): code cleanup to not use goto - - * unix/configure: remove -pthread from LIBS on FreeBSD in thread - * unix/tcl.m4: enabled build. [Bug 602849] - -2002-09-03 Miguel Sofer - - * generic/tclInterp.c (AliasCreate): a Tcl_Obj was leaked on error - return from TclPreventAliasLoop. - -2002-09-03 Daniel Steffen - - * macosx/Tcl.pbproj/project.pbxproj: Bumped version number to 8.4.0 - and updated copyright info. - -2002-09-03 Miguel Sofer - - * generic/tclVar.c (Tcl_UpVar2): a Tcl_Obj was being leaked on error - return from TclGetFrame. - -2002-09-03 Don Porter - - * changes: Updated changes for 8.4.0 release. - -2002-09-02 Jeff Hobbs - - * unix/tclUnixFile.c (TclpObjLink): removed unnecessary/unfreed extra - native char*. - - * unix/tclUnixChan.c (Tcl_MakeTcpClientChannel): make sure to init - flags field of TcpState ptr to 0. - - * unix/configure: - * unix/tcl.m4: added 64-bit gcc compilation support on HP-11. - [Patch 601051] (martin) - - * README: Bumped version number to 8.4.0 - * generic/tcl.h: - * tools/tcl.wse.in: - * unix/configure: - * unix/configure.in: - * unix/tcl.spec: - * win/README.binary: - * win/configure: - * win/configure.in: - - * generic/tclInterp.c (SlaveCreate): make sure that the memory and - checkmem commands are initialized in non-safe slave interpreters when - TCL_MEM_DEBUG is used. [Bug 583445] - - * win/tclWinConsole.c (ConsoleCloseProc): only wait on writable pipe - if there was something to write. This may prevent infinite wait on - exit. - - * tests/exec.test: marked exec-18.1 unixOnly until the Windows - incompatibility (in the test, not the core) can be resolved. - - * tests/http.test (http-3.11): added close $fp that was causing an - error on Windows because the file was not closed before deleting. - - * unix/tclUnixInit.c (Tcl_MacOSXGetLibraryPath): made this static - function only appear when HAVE_CFBUNDLE is defined. - -2002-08-31 Daniel Steffen - - * unix/tcl.m4: added TK_SHLIB_LD_EXTRAS analogue of existing - TCL_SHLIB_LD_EXTRAS for linker settings only used when linking Tk. - - * unix/configure: regen - -2002-08-31 Daniel Steffen - - *** macosx-8-4-branch merged into the mainline [Patch 602770] *** - - * generic/tcl.decls: added new macosx specific entry to stubs table. - - * tools/genStubs.tcl: added generation of platform guards for - macosx. This is a little more complex than it seems, because MacOS X - IS "unix" plus a little bit, for the purposes of Tcl. BUT - unfortunately, Tk uses "unix" to mean X11. So added platform keys for - macosx (the little added to "unix"), "aqua" and "x11" to distinguish - these for Tk. - - * generic/tcl.h: added a #ifnded RESOURCE_INCLUDED so that tcl.h can - be passed to the resource compiler. - - * generic/tcl.h: - * generic/tclNotify.c: added a few Notifier procs, to be able to - modify more bits of the Tcl notifier dynamically. Required to get Mac - OS X Tk to live on top of the Tcl Unix threaded notifier. Changes the - size of the Tcl_NotifierProcs structure, but doesn't move any elements - around. - - * unix/tclUnixNotfy.c: moved the call to Tcl_ConditionNotify till - AFTER we are done mucking with the pointer swap. Fixes cases where the - thread waiting on the condition wakes & accesses the waitingListPtr - before it gets reset, causing a hang. - - * library/auto.tcl (tcl_findLibrary): added checking the directories - in the tcl_pkgPath for library files on macosx to enable support of - the standard Mac OSX library locations. - - * unix/Makefile.in: - * unix/configure.in: - * unix/tcl.m4: added MAC_OSX_DIR. Added PLAT_OBJS to the OBJS: there - are some MacOS X specific files now for Tcl, and when I get the - resource & applescript stuff ported over, and restore support for - FindFiles, etc, there will be a few more. Added LD_LIBRARY_PATH_VAR - configure variable to avoid having to set all possible LD_LIBRARY_PATH - analogues on all platforms. LD_LIBRARY_PATH_VAR is "LD_LIBRARY_PATH" - by default, "LIBPATH" on AIX, "SHLIB_PATH" on HPUX and - "DYLD_LIBRARY_PATH" on Mac OSX. Added configure option to package Tcl - as a framework on Mac OSX. - - * macosx/tclMacOSXBundle.c (new): support for finding Tcl extension - packaged as 'bundles' in the standard Mac OSX library locations. - - * unix/tclUnixInit.c: added support for findig the tcl script library - inside Tcl packaged as a framework on Mac OSX. - - * macosx/Tcl.pbproj/jingham.pbxuser (new): - * macosx/Tcl.pbproj/project.pbxproj (new): project for Apple's - ProjectBuilder IDE. - - * macosx/Makefile (new): simple makefile for building the project from - the command line via the ProjectBuilder tool 'pbxbuild'. - - * unix/configure: - * generic/tclStubInit.c: - * generic/tclPlatDecls.h: regen - -2002-08-29 Andreas Kupries - - * win/tclWinThrd.c (TclpFinalizeThreadData, TclWinFreeAllocCache): - Applied patch for [Bug 599428], provided by Miguel Sofer - . - -2002-08-28 David Gravereaux - - * generic/tclEnv.c: - * unix/configure.in: - * win/tclWinPort.h: putenv() on some systems copies the buffer rather - than taking reference to it. This causes memory leaks and is know to - effect mswindows (msvcrt) and NetBSD 1.5.2 . This patch tests for this - behavior and turns on -DHAVE_PUTENV_THAT_COPIES=1 when approriate. - Thanks to David Welton for assistance. [Bug 414910] - - * unix/configure: regen'd - -2002-08-28 Donal K. Fellows - - * doc/eval.n: Added mention of list command and corrected "SEE ALSO". - - * unix/configure.in: Cache handling of ac_cv_type_socklen_t was wrong. - [Bug 600931] reported by John Ellson. Fixed by putting the brackets - where they belong. - -2002-08-26 Miguel Sofer - - * generic/tclCompCmds.c: fix for [Bug 599788] (error in element name - causing segfault), reported by Tom Wilkason. Fixed by copying the - tokens instead of the source string. - -2002-08-26 Miguel Sofer - - * generic/tclThreadAlloc.c: small optimisation, reducing the new - allocator's overhead. - -2002-08-23 Miguel Sofer - - * generic/tclObj.c (USE_THREAD_ALLOC): fixed leak [Bug 597936]. Thanks - to Zoran Vasiljevic. - -2002-08-23 Miguel Sofer - - * generic/tclThreadAlloc.c (USE_THREAD_ALLOC): moving objects between - caches as a block, instead of one-by-one. - -2002-08-22 Miguel Sofer - - * generic/tclBasic.c: - * generic/tclCmdMZ.c: fix for freed memory r/w in delete traces [Bug - 589863], patch by Hemang Lavana. - -2002-08-20 Andreas Kupries - - * win/Makefile.in (CFLAGS): - * unix/Makefile.in (MEM_DEBUG_FLAGS): Added usage of @MEM_DEBUG_FLAGS@. - * win/configure.in: - * unix/configure.in: Added usage of SC_ENABLE_MEMDEBUG. - * win/tcl.m4: - * unix/tcl.m4: Added macro SC_ENABLE_MEMDEBUG. Allows a user of - configure to (de)activate memory validation and debugging - (TCL_MEM_DEBUG). No need to modify the makefile anymore. - -2002-08-20 Don Porter - - * generic/tclCkalloc.c: CONSTified MemoryCmd and CheckmemCmd. - - * README: Bumped version number to 8.4b3 to distinguish - * generic/tcl.h: HEAD from the 8.4b2 release. - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/README.binary: - * win/configure.in: - - * unix/configure: autoconf - * win/configure: - - * library/http/http.tcl: Corrected installation directory of - * library/msgcat/msgcat.tcl: the package tcltest 2.2. Added - * library/opt/optparse.tcl: comments in other packages to remind - * library/tcltest/tcltest.tcl: that installation directories need - * unix/Makefile.in: updates to match increasing version - * win/Makefile.in: numbers. [Bug 597450] - * win/makefile.bc: - * win/makefile.vc: - -2002-08-19 Andreas Kupries - - * unix/tclUnixTest.c (TestfilehandlerCmd): Changed readable/writable - to the more common readable|writable. Fixes [Bug 596034] reported by - Larry Virden . - -2002-08-16 Donal K. Fellows - - * tests/fCmd.test: Added test to make sure that the cause of the - problem is detectable with an unpatched Tcl. - * doc/ObjectType.3: Added note on the root cause of this problem to - the documentation, since it is possible for user code to trigger this - sort of behaviour too. - * generic/tclIOUtil.c (SetFsPathFromAny): Objects should only have - their old representation deleted when we know that we are about to - install a new one. This stops a weird TclX bug under Linux with - certain kinds of memory debugging enabled which essentally came down - to a double-free of a string. - -2002-08-14 Miguel Sofer - - * generic/tclInt.h: - * generic/tclObj.c: (code cleanup) factored the parts in the macros - TclNewObj() / TclDecrRefCount() into a common part for all - memory allocators and two new macros TclAllocObjStorage() / - TclFreeObjStorage() that are specific to each allocator and fully - describe the differences. Removed allocator-specific code from - tclObj.c by using the macros. - -2002-08-12 Miguel Sofer - - * generic/tclCmdMZ.c: fixing UMR in delete traces, [Bug 589863]. - -2002-08-08 David Gravereaux - - * tools/man2help.tcl: Fixed $argv handling bug where if -bitmap wasn't - specified $argc was off by one. - -2002-08-08 Miguel Sofer - - * tests/uplevel.test: added 6.1 to test [uplevel] with shadowed - commands [Bug 524383] - - * tests/subst.test: added 5.8-10 as further tests for [Bug 495207] - -2002-08-08 Don Porter - - * tests/README: Noted removal of defs.tcl. - -2002-08-08 Jeff Hobbs - - * doc/lsearch.n: corrected lsearch docs to use -inline in examples. - - *** 8.4b2 TAGGED FOR RELEASE *** - - * tests/fCmd.test: - * tests/unixFCmd.test: updated tests for new link copy behavior. - * generic/tclFCmd.c (CopyRenameOneFile): changed the behavior to - follow links to endpoints and copy that file/directory instead of just - copying the surface link. This means that trying to copy a link that - has no endpoint (danling link) is an error. [Patch 591647] (darley) - (CopyRenameOneFile): this is currently disabled by default until - further issues with such behavior (like relative links) can be - handled correctly. - - * tests/README: slight wording improvements - -2002-08-07 Miguel Sofer - - * docs/BoolObj.3: added description of valid string reps for a - boolean object. [Bug 584794] - * generic/tclObj.c: optimised Tcl_GetBooleanFromObj and - SetBooleanFromAny to avoid parsing the string rep when it can be - avoided. [Bugs 584650, 472576] - -2002-08-07 Miguel Sofer - - * generic/tclCompile.h: - * generic/tclObj.c: making tclCmdNameType static ([Bug 584567], Don - Porter). - -2002-08-07 Miguel Sofer - - * generic/tclObj.c (Tcl_NewObj): added conditional code for - USE_THREAD_ALLOC; objects allocated through Tcl_NewObj() were - otherwise being leaked. [Bug 587488] reported by Sven Sass. - -2002-08-06 Daniel Steffen - - * generic/tclInt.decls: - * unix/tclUnixThrd.c: Added stubs and implementations for - non-threaded build for the tclUnixThrd.c procs TclpReaddir, - TclpLocaltime, TclpGmtime and TclpInetNtoa. Fixes link errors in - stubbed & threaded extensions that include tclUnixPort.h and use any - of the procs readdir, localtime, gmtime or inet_ntoa (e.g. TclX 8.4) - [Bug 589526] - * generic/tclIntPlatDecls.h: - * generic/tclStubInit.c: Regen. - -2002-08-05 Don Porter - - * library/tcltest/tcltest.tcl: The setup and cleanup scripts are now - * library/tcltest/pkgIndex.tcl: skipped when a test is skipped, fixing - * tests/tcltest.test: [Bug 589859]. Test for bug added, and - corrected tcltest package bumped to version 2.2. - - * generic/tcl.decls: Restored Tcl_Concat to return (char *). Like - * generic/tclDecls.h: Tcl_Merge, it transfers ownership of a dynamic - * generic/tclUtil.c: allocated string to the caller. - -2002-08-04 Don Porter - - * doc/CmdCmplt.3: Applied Patch 585105 to fully CONST-ify all - * doc/Concat.3: remaining public interfaces of Tcl. Notably, - * doc/CrtCommand.3: the parser no longer writes on the string it - * doc/CrtSlave.3: is parsing, so it is no longer necessary for - * doc/CrtTrace.3: Tcl_Eval() to be given a writable string. Also - * doc/Eval.3: the refactoring of the Tcl_*Var* routines by - * doc/ExprLong.3: by Miguel Sofer is included, so that the - * doc/LinkVar.3: "part1" argument for them no longer needs to - * doc/ParseCmd.3: be writable either. - * doc/SetVar.3: - * doc/TraceVar.3: - * doc/UpVar.3: Compatibility support has been enhanced so - * generic/tcl.decls: that a #define of USE_NON_CONST will remove - * generic/tcl.h: all possible source incompatibilities with the - * generic/tclBasic.c: 8.3 version of the header file(s). The new - * generic/tclCmdMZ.c: #define of USE_COMPAT_CONST now does what - * generic/tclCompCmds.c:USE_NON_CONST used to do -- disable only those - * generic/tclCompExpr.c:new CONST's that introduce irreconcilable - * generic/tclCompile.c: incompatibilities. - * generic/tclCompile.h: - * generic/tclDecls.h: Several bugs are also fixed by this patch. - * generic/tclEnv.c: [Bugs 584051,580433] [Patches 585105,582429] - * generic/tclEvent.c: - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclInterp.c: - * generic/tclLink.c: - * generic/tclObj.c: - * generic/tclParse.c: - * generic/tclParseExpr.c: - * generic/tclProc.c: - * generic/tclTest.c: - * generic/tclUtf.c: - * generic/tclUtil.c: - * generic/tclVar.c: - * mac/tclMacTest.c: - * tests/expr-old.test: - * tests/parseExpr.test: - * unix/tclUnixTest.c: - * unix/tclXtTest.c: - * win/tclWinTest.c: - -2002-08-01 Miguel Sofer - - * generic/tclExecute.c: bugfix (reading freed memory). Testsuite - passed on linux/i386, compile-13.1 hung on linux/alpha. - -2002-08-01 Miguel Sofer - - * generic/tclExecute.c: added a reference count for the complete - execution stack, instead of Tcl_Preserve/Tcl_Release. - -2002-08-01 Mo DeJong - - * generic/tclCkalloc.c (TclFinalizeMemorySubsystem): Don't lock the - ckalloc mutex before invoking the Tcl_DumpActiveMemory function since - it also locks the same mutex. This code is only executed when "memory - onexit filename" has been executed and Tcl is compiled with - -DTCL_MEM_DEBUG. - -2002-08-01 Reinhard Max - - * win/tclWinPort.h: The windows headers don't provide socklen_t, so we - have to do it. - -2002-07-31 Miguel Sofer - - * generic/tclInt.h (USE_THREAD_ALLOC): for unshared objects, - TclDecrRefCount now frees the internal rep before the string rep - - just like the non-macro Tcl_DecrRefCount/TclFreeObj [Bug 524802]. For - the other allocators the fix was done on 2002-03-06. - -2002-07-31 Miguel Sofer - - * generic/tclInterp.c: signed/unsigned comparison warning fixed - (Vince Darley). - -2002-07-31 Donal K. Fellows - - * unix/tcl.m4 (SC_BUGGY_STRTOD): Enabled caching of test results. - - * unix/tcl.m4 (SC_BUGGY_STRTOD): Solaris 2.8 still has a buggy - strtod() implementation; make sure we detect it. - - * tests/expr.test (expr-22.*): Marked as non-portable because it seems - that these tests have an annoying tendency to fail in unexpected ways. - [Bugs 584825, 584950, 585986] - -2002-07-30 Andreas Kupries - - * tests/io.test: - * generic/tclIO.c (WriteChars): Added flag to break out of loop if - nothing of the input is consumed at all, to prevent infinite looping - of called with a non-UTF-8 string. Fixes Bug 584603 (partially). Added - new test "io-60.1". Might need additional changes to Tcl_Main so that - unprintable results are printed as binary data. - -2002-07-29 Mo DeJong - - * unix/Makefile.in: Use CC_SEARCH_FLAGS instead of LD_SEARCH_FLAGS - when linking with ${CC}. - * unix/configure: Regen. - * unix/configure.in: Don't subst CC_SEARCH_FLAGS or LD_SEARCH_FLAGS - since this is now done in tcl.m4. - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Document and set CC_SEARCH_FLAGS - whenever LD_SEARCH_FLAGS is set. [Patch 588290] - -2002-07-29 Reinhard Max - - * unix/tcl.m4 (SC_SERIAL_PORT): Fixed detection for cases when - configure's stdin is not a tty. - - * unix/tclUnixPort.h: - * generic/tclIOSock.c: Changed size_t to socklen_t in - socket-related function calls. - - * unix/configure.in: Added test and fallback definition - for socklen_t. - - * unix/configure: generated. - -2002-07-29 Miguel Sofer - - * generic/tclObj.c: fixed a comment - - * generic/tcl.h: - * generic/tclBasic.c: - * generic/tclInterp.c: added the new flag TCL_EVAL_INVOKE to the - interface of the Tcl_Eval* functions, removing the - TCL_EVAL_NO_TRACEBACK added yesterday: alias invocations not only - require no tracebacks, but also look up the command name in the global - scope - see new test interp-9.4 - * tests/interp.test: added 9.3 to test for safety of aliases to hidden - commands, 9.4 to test for correct command lookup scope. - -2002-07-29 Donal K. Fellows - - * generic/regc_locale.c (cclass): [[:xdigit:]] is only a defined - concept on western characters, so should not allow any unicode digit, - and hence number of ranges in [[:xdigit:]] is fixed. - * tests/reg.test: Added test to detect the bug. - * generic/regc_cvec.c (newcvec): Corrected initial size value in - character vector structure. [Bug 578363] Many thanks to - pvgoran@users.sf.net for tracking this down. - -2002-07-28 Miguel Sofer - - * generic/tcl.h: - * generic/tclBasic.c: added the new flag TCL_EVAL_NO_TRACEBACK to the - interface of the Tcl_Eval* functions. Modified the error message for - too many nested evaluations. - * generic/tclInterp.h: changed the Alias struct to be of variable - length and store the prefix arguments directly (instead of a pointer - to a Tcl_Obj list). Made AliasObjCmd call Tcl_EvalObjv instead of - TclObjInvoke - thus making aliases trigger execution traces [Bug - 582522]. - * tests/interp.test: - * tests/stack.test: adapted to the new error message. - * tests/trace.test: added tests for aliases firing the exec traces. - -2002-07-27 Mo DeJong - - * unix/Makefile.in: Revert fix for Tcl bug 529801 since it was - incorrect and broke the build on other systems. Fix [Bug 587299]. Add - MAJOR_VERSION, MINOR_VERSION, PATCH_LEVEL, SHLIB_LD_FLAGS, - SHLIB_LD_LIBS, CC_SEARCH_FLAGS, LD_SEARCH_FLAGS, and LIB_FILE - variables to support more generic library build/install rules. - * unix/configure: Regen. - * unix/configure.in: Move AC_PROG_RANLIB into tcl.m4. Move shared - build test and setting of MAKE_LIB and MAKE_STUB_LIB into tcl.m4. Move - subst of a number of variables into tcl.m4 where they are defined. - * unix/tcl.m4 (SC_ENABLE_SYMBOLS, SC_CONFIG_CFLAGS): Subst vars where - they are defined. Add MAKE_LIB, MAKE_STUB_LIB, INSTALL_LIB, and - INSTALL_STUB_LIB rules to deal with the ugly details of running ranlib - on static libs at build and install time. Replace TCL_SHLIB_LD_EXTRAS - with SHLIB_LD_FLAGS and use it when building a shared library. - * unix/tclConfig.sh.in: Add TCL_CC_SEARCH_FLAGS. - -2002-07-26 Miguel Sofer - - * generic/tclExecute.c: fixed Tcl_Obj leak in code corresponding to - the macro NEXT_INST_V(x, 0, 1) [Bug 587495]. - -2002-07-26 Miguel Sofer - - * generic/tclVar.c (TclObjLookupVar): leak fix and improved comments. - -2002-07-26 Jeff Hobbs - - * generic/tclVar.c (TclLookupVar): removed early returns that - prevented the parens from being restored. Also removed goto label as - it was not necessary. - -2002-07-24 Miguel Sofer - - * generic/tclExecute.c: - * tests/expr-old.test: fix for erroneous error messages in [expr], - [Bug 587140] reported by Martin Lemburg. - -2002-07-25 Joe English - - * generic/tclProc.c: fix for [Tk Bug 219218] "error handling with - bgerror in Tk" - -2002-07-24 Miguel Sofer - - * generic/tclExecute.c: restoring full TCL_COMPILE_DEBUG - functionality. - -2002-07-24 Don Porter - - * tests/unixInit.test: relaxed unixInit-3.1 to accept iso8859-15 as a - valid C encoding. [Bug 575336] - -2002-07-24 Miguel Sofer - - * generic/tclExecute.c: restoring the tcl_traceCompile functionality - while I repair tcl_traceExec. The core now compiles and runs also - under TCL_COMPILE_DEBUG, but execution in the bytecode engine can - still not be traced. - -2002-07-24 Daniel Steffen - - * unix/Makefile.in: - * unix/configure.in: corrected fix for [Bug 529801]: ranlib only - needed for static builds on Mac OS X. - * unix/configure: Regen. - * unix/tclLoadDyld.c: fixed small bugs introduced by Vince, - implemented library unloading correctly (needs OS X 10.2). - -2002-07-23 Joe English - - * doc/OpenFileChnl.3: (Updates from Larry Virden) - * doc/open.n: - * doc/tclsh.1: Fix section numbers in Unix man page references. - * doc/lset.n: In EXAMPLES section, include command to set the initial - value used in subsequent examples. - * doc/http.n: Package version updated to 2.4. - -2002-07-23 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Enable 64 bit compilation when using - the native compiler on a 64 bit version of IRIX. [Bug 219220] - -2002-07-23 Mo DeJong - - * unix/Makefile.in: Combine ranlib tests and avoid printing unless - ranlib is actually run. - -2002-07-23 Mo DeJong - - * unix/tcl.m4 (SC_PATH_X): Set XINCLUDES to "" instead of "# no - special path needed" or "# no include files found" when x headers - cannot be located. - -2002-07-22 Vince Darley - - * generic/tclIOUtil.c: made tclNativeFilesystem static (since 07-19 - changes removed its usage elsewhere), and added comments about its - usage. - * generic/tclLoad.c: - * generic/tcl.h: - * generic/tcl.decls: - * doc/FileSystem.3: converted last load-related ClientData parameter - to Tcl_LoadHandle opaque structure, removing a couple of casts in the - process. - - * generic/tclInt.h: removed tclNativeFilesystem declaration since it - is now static again. - -2002-07-22 Donal K. Fellows - - * tests/expr.test (expr-22.*): Added tests to help detect the - corrected handling. - * generic/tclExecute.c (IllegalExprOperandType): Improved error - message generated when attempting to manipulate Inf and NaN values. - * generic/tclParseExpr.c (GetLexeme): Allowed parser to recognise - 'Inf' as a floating-point number. [Bug 218000] - -2002-07-21 Don Porter - - * tclIOUtil.c: Silence compiler warning. [Bug 584408]. - -2002-07-19 Vince Darley - - * generic/tclIOUtil.c: fix to GetFilesystemRecord - * win/tclWinFile.c: - * unix/tclUnixFile.c: fix to subtle problem with links shown up by - latest tclkit builds. - -2002-07-19 Mo DeJong - - * unix/configure: - * unix/configure.in: - * win/configure: - * win/configure.in: Add AC_PREREQ(2.13) in an attempt to make it more - clear that the configure scripts must be generated with autoconf - version 2.13. [Bug 583573] - -2002-07-19 Vince Darley - - * unix/Makefile.in: fix to build on MacOS X [Bug 529801], bug report - and fix from jcw. - -2002-07-19 Donal K. Fellows - - * win/tclWinSerial.c (no_timeout): Made this variable static. - - * generic/tclExecute.c, generic/tclCompile.c, generic/tclBasic.c: - * generic/tclCompile.h (builtinFuncTable, instructionTable): Added - prefix to these symbols because they are visible outside the Tcl - library. - - * generic/tclCompExpr.c (operatorTable): - * unix/tclUnixTime.c (tmKey): - * generic/tclIOUtil.c (theFilesystemEpoch, filesystemWantToModify, - filesystemIteratorsInProgress, filesystemOkToModify): Made these - variables static. - - * unix/tclUnixFile.c: Renamed nativeFilesystem to - * win/tclWinFile.c: tclNativeFilesystem and declared - * generic/tclIOUtil.c: it properly in tclInt.h - * generic/tclInt.h: - - * generic/tclUtf.c (totalBytes): Made this array static and const. - - * generic/tclParse.c (typeTable): Made this array static and const. - (Tcl_ParseBraces): Simplified error handling case so that scans are - only performed when needed, and flags are simpler too. - - * license.terms: Added AS to list of copyright holders; it's only - fair for the current gatekeepers to be listed here! - - * tests/cmdMZ.test: Renamed constraint for clarity. [Bug 583427] - Added tests for the [time] command, which was previously only - indirectly tested! - -2002-07-18 Vince Darley - - * generic/tclInt.h: - * generic/tcl.h: - * */*Load*.c: added comments on changes of 07/17 and replaced - clientData with Tcl_LoadHandle in all locations. - - * generic/tclFCmd.c: - * tests/fileSystem.test: fixed a 'knownBug' with 'file attributes ""' - * tests/winFCmd.test: - * tests/winPipe.test: - * tests/fCmd.test: - * tessts/winFile.test: added 'pcOnly' constraint to some tests to make - for more useful 'tests skipped' log from running all tests on - non-Windows platforms. - -2002-07-17 Miguel Sofer - - * generic/tclBasic.c (CallCommandTraces): delete traces now receive - the FQ old name of the command. [Bug 582532] (Don Porter) - -2002-07-18 Vince Darley - - * tests/ioUtil.test: added constraints to 1.4,2.4 so they don't run - outside of tcltest. [Bugs 583276, 583277] - -2002-07-17 Miguel Sofer - - * generic/tclVar.c (DupParsedVarName): nasty bug fixed, reported by - Vince Darley. - -2002-07-17 Miguel Sofer - - * generic/tclVar.c (TclPtrIncrVar): missing CONST in declarations, - inconsistent with tclInt.h. Thanks to Vince Darley for reporting, boo - to gcc for not complaining. - -2002-07-17 Vince Darley - - * generic/tclInt.h: - * generic/tclIOUtil.c: - * generic/tclLoadNone.c: - * unix/tclLoadAout.c: - * unix/tclLoadDl.c: - * unix/tclLoadDld.c: - * unix/tclLoadDyld.c: - * unix/tclLoadNext.c: - * unix/tclLoadOSF.c: - * unix/tclLoadShl.c: - * mac/tclMacLoad.c: - * win/tclWinLoad.c: modified to move more functionality to the generic - code and avoid duplication. Partial replacement of internal uses of - clientData with opaque Tcl_LoadHandle. A little further work still - needed, but significant changes are done. - -2002-07-17 D. Richard Hipp - - * library/msgcat/msgcat.tcl: fix a comment that was causing problems - for programs (ex: mktclapp) that embed the initialization scripts in - strings. - -2002-07-17 Miguel Sofer - - * generic/tclInt.decls: - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - * generic/tclVar.c: removing the now redundant functions to access - indexed variables: Tcl(Get|Set|Incr)IndexedScalar() and - Tcl(Get|Set|Incr)ElementOfIndexedArray(). - -2002-07-17 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Minor fixes to make this - file compile with SunPro CC... - -2002-07-17 Miguel Sofer - - * generic/tclExecute.c: modified to do variable lookup explicitly, and - then either inlining the variable access or else calling the new - TclPtr(Set|Get|Incr)Var functions in tclVar.c - * generic/tclInt.h: declare some functions previously local to - tclVar.c for usage by TEBC. - * generic/tclVar.c: removed local declarations; moved all special - accessor functions for indexed variables to the end of the file - - they are unused and ready for removal, but left there for the time - being as they are in the internal stubs table. - - ** WARNING FOR BYTECODE MAINTAINERS ** - TCL_COMPILE_DEBUG is currently not functional; will be fixed ASAP. - -2002-07-16 Mo DeJong - - * unix/Makefile.in: - * win/Makefile.in: Add a more descriptive warning in the event `make - genstubs` needs to be rerun. - -2002-07-16 Mo DeJong - - * unix/Makefile.in: Use dltest.marker file to keep track of when the - dltest package is up to date. This fixes [Bug 575768] since tcltest is - no longer linked every time. - * unix/dltest/Makefile.in: Create ../dltest.marker after a successful - `make all` run in dltest. - -2002-07-16 Mo DeJong - - * unix/configure: Regen. - * unix/configure.in: Remove useless subst of TCL_BIN_DIR. - -2002-07-15 Miguel Sofer - - * generic/tclVar.c: inaccurate comment fixed - -2002-07-15 Miguel Sofer - - * generic/tclBasic.c (Tcl_AddObjErrorInfo): - * generic/tclExecute.c (TclUpdateReturnInfo): - * generic/tclInt.h: - * generic/tclProc.c: - Added two Tcl_Obj to the ExecEnv structure to hold the fully qualified - names "::errorInfo" and "::errorCode" to cache the addresses of the - corresponding variables. The two most frequent setters of these - variables now profit from the new variable name caching. - -2002-07-15 Miguel Sofer - - * generic/tclVar.c: refactorisation to reuse already looked-up Var - pointers; definition of three new Tcl_Obj types to cache variable name - parsing and lookup for later reuse; modification of internal functions - to profit from the caching. - - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclNamesp.c: adding CONST qualifiers to variable names - passed to Tcl_FindNamespaceVar and to variable resolvers; adding CONST - qualifier to the 'msg' argument to TclLookupVar. Needed to avoid code - duplication in the new tclVar.c code. - - * tests/set-old.test: - * tests/var.test: slight modification of error messages due to the - modifications in the tclVar.c code. - -2002-07-15 Don Porter - - * tests/unixInit.test: Improved constraints to protect /tmp. [Bug - 581403] - -2002-07-15 Vince Darley - - * tests/winFCmd.test: renamed 'win2000' and 'notWin2000' to more - appropriate constraint names. - * win/tclWinFile.c: updated comments to reflect 07-11 changes. - * win/tclWinFCmd.c: made ConvertFileNameFormat static again, since no - longer used in tclWinFile.c - * mac/tclMacFile.c: completed TclpObjLink implementation which was - previously lacking. - * generic/tclIOUtil.c: comment cleanup and code speedup. - -2002-07-14 Don Porter - - * generic/tclInt.h: Removed declarations that duplicated entries - in the (internal) stub table. - - * library/tcltest/tcltest.tcl: Corrected errors in handling of - configuration options -constraints and -limitconstraints. - - * README: Bumped HEAD to version 8.4b2 so we can - * generic/tcl.h: distinguish it from the 8.4b1 release. - * tools/tcl.wse.in: - * unix/configure*: - * unix/tcl.spec: - * win/README.binary: - * win/configure*: - -2002-07-11 Vince Darley - - * doc/file.n: - * win/tclWinFile.c: on Win 95/98/ME the long form of the path is used - as a normalized form. This is required because short forms are not a - robust representation. The file normalization function has been sped - up, but more performance gains might be possible, if speed is still an - issue on these platforms. - -2002-07-11 Don Porter - - * library/tcltest/tcltest.tcl: Corrected reaction to existing but - false ::tcl_interactive. - - * doc/Hash.3: Overlooked CONST documentation update. - -2002-07-11 Donal K. Fellows - - * generic/tclCkalloc.c: ckalloc() and friends take the block size as - an unsigned, so we should use %ud when reporting it in fprintf() and - panic(). - -2002-07-11 Miguel Sofer - - * generic/tclCompile.c: now setting local vars undefined at compile - time, instead of waiting until the proc is initialized. - * generic/tclProc.c: use macro TclSetVarUndefined instead of directly - setting the flag. - -2002-07-11 Donal K. Fellows - - * tests/cmdAH.test: [file attr -perm] is Unix-only, so add [catch] - when not inside a suitably-protected test. - -2002-07-10 Donal K. Fellows - - * tests/unixFCmd.test, tests/fileName.test: - * tests/fCmd.test: Removed [exec] of Unix utilities that have - equivalents in standard Tcl. [Bug 579268] Also simplified some of - unixFCmd.test while I was at it. - -2002-07-10 Don Porter - - * tests/tcltest.test: Greatly reduced the number of [exec]s, using - slave interps instead. - * library/tcltest/tcltest.tcl: Fixed bug uncovered in the conversion - where a message was written to stdout instead of [outputChannel]. - - * tests/basic.test: Cleaned up, constrained, and reduced the - * tests/compile.test: amount of [exec] usage in the test suite. - * tests/encoding.test: - * tests/env.test: - * tests/event.test: - * tests/exec.test: - * tests/io.test: - * tests/ioCmd.test: - * tests/regexp.test: - * tests/regexpComp.test: - * tests/socket.test: - * tests/tcltest.test: - * tests/unixInit.test: - * tests/winDde.test: - * tests/winPipe.test: - -2002-07-10 Donal K. Fellows - - * tests/cmdAH.test: Removed [exec] of Unix utilities. [Bug 579211] - - * tests/expr.test: Added tests to make sure that this works. - * generic/tclExecute.c (ExprCallMathFunc): Functions should also be - able to return wide-ints. [Bug 579284] - -2002-07-08 Andreas Kupries - - * tests/socket.test: Fixed [Bug 578164]. The original reason for the - was a DNS outage while running the testsuite. Changed [info hostname] - to 127.0.0.1 to bypass DNS, knowing that we operate on the local host. - -2002-07-08 Don Porter - - * doc/tcltest.n: Fixed incompatibility in [viewFile]. - * library/tcltest/tcltest.tcl: Corrected docs. Bumped to 2.2.1. - * library/tcltest/pkgIndex.tcl: [Bug 578163] - -2002-07-08 Vince Darley - - * tests/cmdAH.test: - * tests/fCmd.test: - * tests/fileName.test: tests which rely on 'file link' need a - constraint so they don't run on older Windows OS. [Bug 578158] - * generic/tclIOUtil.c: - * generic/tcl.h: - * generic/tclInt.h: - * generic/tclTest.c: - * mac/tclMacChan.c: - * unix/tclUnixChan.c: - * win/tclWinChan.c: - * doc/FileSystem.3: cleaned up internal handling of - Tcl_FSOpenFileChannel to remove duplicate code, and make writing - external vfs's clearer and easier. No functionality change. Also - clarify that objects with refCount zero should not be passed in to the - Tcl_FS API, and prevent segfaults from occuring on such user errors. - [Bug 578617] - -2002-07-06 Don Porter - - * tests/pkgMkIndex.test: Constrained tests of [load] package indexing - to those platforms where the testing shared libraries have been built. - [Bug 578166] - -2002-07-05 Don Porter - - * changes: added recent changes - -2002-07-05 Reinhard Max - - * generic/tclClock.c (FormatClock): Convert the format string to UTF8 - before calling TclpStrftime, so that non-ASCII characters don't get - mangled when the result string is being converted back. - * tests/clock.test: Added a test for that. - -2002-07-05 Donal K. Fellows - - * unix/Makefile.in (ro-test,ddd,GDB,DDD): Created new targets to - allow running the test suite with a read-only current directory, - running under ddd instead of gdb, and factored out some executable - names for broken sites (like mine) where gdb and ddd are installed - with non-standard names... - - * tests/httpold.test: Altered test names to httpold-* to avoid clashes - with http.test, and stopped tests from failing when the current - directory is not writable... - - * tests/event.test: Stop these tests from failing when the - * tests/ioUtil.test: current directory is not writable... - * tests/regexp.test: - * tests/regexpComp.test: - * tests/source.test: - * tests/unixFile.test: - * tests/unixNotfy.test: - - * tests/unixFCmd.test: Trying to make these test-files not - * tests/macFCmd.test: bomb out with an error when the - * tests/http.test: current directory is not writable... - * tests/fileName.test: - * tests/env.test: - -2002-07-05 Jeff Hobbs - - *** 8.4b1 TAGGED FOR RELEASE *** - -2002-07-04 Donal K. Fellows - - * tests/cmdMZ.test (cmdMZ-1.4): - * tests/cmdAH.test: More fixing of writable-current-dir assumption. - [Bug 575824] - -2002-07-04 Miguel Sofer - - * tests/basic.test: Same issue as below; fixed [Bug 575817] - -2002-07-04 Andreas Kupries - - * tests/socket.test: - * tests/winPipe.test: - * tests/pid.test: Fixed [Bug 575848]. See below for a description the - general problem. - - * All the bugs below are instances of the same problem: The testsuite - assumes [pwd] = [temporaryDirectory] and writable. - - * tests/iogt.test: Fixed [Bug 575860]. - * tests/io.test: Fixed [Bug 575862]. - * tests/exec.test: - * tests/ioCmd.test: Fixed [Bug 575836]. - -2002-07-03 Don Porter - - * tests/pkg1/direct1.tcl: removed - * tests/pkg1/pkgIndex.tcl: removed - * tests/pkgMkIndex.test: Imported auxilliary files from tests/pkg1 - into the test file pkgMkIndex.test itself. Formatting fixes. - - * unix/Makefile.in: removed tests/pkg/* from `make dist` - - * tests/pkg/circ1.tcl: removed - * tests/pkg/circ2.tcl: removed - * tests/pkg/circ3.tcl: removed - * tests/pkg/global.tcl: removed - * tests/pkg/import.tcl: removed - * tests/pkg/pkg1.tcl: removed - * tests/pkg/pkg2_a.tcl: removed - * tests/pkg/pkg2_b.tcl: removed - * tests/pkg/pkg3.tcl: removed - * tests/pkg/pkg4.tcl: removed - * tests/pkg/pkg5.tcl: removed - * tests/pkg/pkga.tcl: removed - * tests/pkg/samename.tcl: removed - * tests/pkg/simple.tcl: removed - * tests/pkg/spacename.tcl: removed - * tests/pkg/std.tcl: removed - * tests/pkgMkIndex.test: Fixed [Bug 575857] where this test file - expected to be able to write to [file join [testsDirectory] pkg]. Part - of the fix was to import several auxilliary files into the test file - itself. - - * tests/main.test: Cheap fix for [Bugs 575851, 575858]. Avoid - * tests/tcltest.test: non-writable . by [cd [temporaryDirectory]]. - - * library/auto.tcl: Fix [tcl_findLibrary] to be sure it sets $varName - only if a successful library script is found. [Bug 577033] - -2002-07-03 Miguel Sofer - - * generic/tclCompCmds.c (TclCompileCatchCmd): return - TCL_OUT_LINE_COMPILE instead of TCL_ERROR: let the failure happen at - runtime so that it can be caught [Bug 577015]. - -2002-07-02 Joe English - - * doc/tcltest.n: Markup fixes, spellcheck. - -2002-07-02 Don Porter - - * doc/tcltest.n: more refinements of the documentation. - - * library/tcltest/tcltest.tcl: Added trace to be sure the stdio - constraint is updated whenever the [interpreter] changes. - - * doc/tcltest.n: Reverted [makeFile] and [viewFile] to - * library/tcltest/tcltest.tcl: their former behavior, and documented - * tests/cmdAH.test: it. Corrected misspelling of hook - * tests/event.test: procedure. Restored tests. - * tests/http.test: - * tests/io.test: - - * library/tcltest/tcltest.tcl: Simplified logic of [GetMatchingFiles] - and [GetMatchingDirectories], removing special case processing. - - * doc/tcltest.n: More documentation updates. Reference sections are - complete. Only examples need adding. - -2002-07-02 Vince Darley - - * tests/fCmd.test: - * generic/tclCmdAH.c: clearer error msgs for 'file link', as per the - man page. - -2002-07-01 Joe English - - * doc/Access.3: - * doc/AddErrInfo.3: - * doc/Alloc.3: - * doc/Backslash.3: - * doc/CrtChannel.3: - * doc/CrtSlave.3: - * doc/Encoding.3: - * doc/Eval.3: - * doc/FileSystem.3: - * doc/Notifier.3: - * doc/OpenFileChnl.3: - * doc/ParseCmd.3: - * doc/RegExp.3: - * doc/Tcl_Main.3: - * doc/Thread.3: - * doc/TraceCmd.3: - * doc/Utf.3: - * doc/WrongNumArgs.3: - * doc/binary.n: - * doc/clock.n: - * doc/expr.n: - * doc/fconfigure.n: - * doc/glob.n: - * doc/http.n: - * doc/interp.n: - * doc/lsearch.n: - * doc/lset.n: - * doc/msgcat.n: - * doc/packagens.n: - * doc/pkgMkIndex.n: - * doc/registry.n: - * doc/resource.n: - * doc/safe.n: - * doc/scan.n: - * doc/tclvars.n: Spell-check, fixed typos (Updates from Larry Virden). - -2002-07-01 Donal K. Fellows - - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Made Solaris use gcc for linking - when building with gcc to resolve problems with undefined symbols - being present when tcl library used with non-gcc linker at later - stage. Symbols were compiler-generated, so it is the compiler's - business to define them. [Bug 541181] - -2002-07-01 Don Porter - - * doc/tcltest.n: more work in progress updating tcltest docs. - - * library/tcltest/tcltest.tcl: Change [configure -match] to stop - treating an empty list as a list of the single pattern "*". Changed - the default value to [list *] so default operation remains the same. - - * tests/pkg/samename.tcl: restored. needed by pkgMkIndex.test. - - * library/tcltest/tcltest.tcl: restored writeability testing of - -tmpdir, augmented by a special exception for the deafault value. - -2002-07-01 Donal K. Fellows - - * doc/concat.n: Documented the *real* behaviour of [concat]! - -2002-06-30 Don Porter - - * doc/tcltest.n: more work in progress updating tcltest docs. - - * tests/README: Updated the instructions on running and - * tests/cmdMZ.test: adding to the test suite. Also updated - * tests/encoding.test: several tests, mostly to correctly create - * tests/fCmd.test: and destroy any temporary files in the - * tests/info.test: [temporaryDirectory] of tcltest. - * tests/interp.test: - - * library/tcltest/tcltest.tcl: Stopped checking for writeability of - -tmpdir value because no default directory can be guaranteed to be - writeable. - - * tests/autoMkindex.tcl: removed. - * tests/pkg/samename.tcl: removed. - * tests/pkg/magicchar.tcl: removed. - * tests/pkg/magicchar2.tcl: removed. - * tests/autoMkindex.test: Updated auto_mkIndex tests to use [makeFile] - and [removeFile] so tests are done in [temporaryDirecotry] where write - access is guaranteed. - - * library/tcltest/tcltest.tcl: Fixed [makeFile] and [viewFile] to - * tests/cmdAH.test: accurately reflect a file's contents. - * tests/event.test: Updated tests that depended on buggy - * tests/http.test: behavior. Also added warning messages - * tests/io.test: to "-debug 1" operations to debug test - * tests/iogt.test: calls to (make|remove)(File|Directory) - - * unix/mkLinks: `make mklinks` on 6-27 commits. - -2002-06-28 Miguel Sofer - - * generic/tclCompile.h: modified the macro TclEmitPush to not call its - first argument repeatedly or pass it to other macros, [Bug 575194] - reported by Peter Spjuth. - -2002-06-28 Don Porter - - * docs/tcltest.n: Doc revisions in progress. - * library/tcltest/tcltest.tcl: Corrected -testdir default value. Was - not reliable, and disagreed with docs! Thanks to Hemang Lavana. [Bug - 575150] - -2002-06-28 Donal K. Fellows - - * unix/tclUnixThrd.c: Renamed the Tcl_Platform* #defines to TclOS* - * unix/tclUnixPipe.c: because they are only used internally. Also - * unix/tclUnixFile.c: stopped double-#def of TclOSlstat [Bug 566099, - * unix/tclUnixFCmd.c: post-rename] - * unix/tclUnixChan.c: - * unix/tclUnixPort.h: - - * doc/string.n: Improved documentation for [string last] along lines - described in [Bug 574799] so it indicates that the supplied index - marks the end of the search space. - -2002-06-27 Don Porter - - * doc/dde.n: Work in progress updating the documentation - * doc/http.n: of the packages that come bundled with - * doc/msgcat.n: the Tcl source distribution, notably tcltest. - * doc/registry.n: - * doc/tcltest.n: - - * library/tcltest/tcltest.tcl: Made sure that the TCLTEST_OPTIONS - environment variablle configures tcltest at package load time. - -2002-06-26 Vince Darley - - * tests/fileSystem.test: - * generic/tclIOUtil.c: fix to handling of empty paths "" which are not - claimed by any filesystem [Bug 573758]. Ensure good error messages - are given in all cases. - * tests/cmdAH.test: - * unix/tclUnixFCmd.c: fix to bug reported as part of [Patch 566669]. - Thanks to Taguchi, Takeshi for the report. - -2002-06-26 Reinhard Max - - * unix/tclUnixTime.c: Make [clock format] respect locale settings. - * tests/clock.test: [Bug 565880]. ***POTENTIAL INCOMPATIBILITY*** - -2002-06-26 Miguel Sofer - - * doc/CrtInterp.3: - * doc/StringObj.3: clarifications by Don Porter, [Bug 493995] and [Bug - 500930]. - -2002-06-24 Don Porter - - * library/tcltest/tcltest.tcl: Corrected suppression of -verbose skip - * tests/tcltest.test: and start by [test -output]. Also - corrected test suite errors exposed by corrected code. [Bug 564656] - -2002-06-25 Reinhard Max - - * unix/tcl.m4: New macro SC_CONFIG_MANPAGES. - * unix/configure.in: Added support for symlinks and compression when - * unix/Makefile.in: installing the manpages. [Patch 518052] - * unix/mkLinks.tcl: Default is still hardlinks and no compression. - - * unix/mkLinks: generated - * unix/configure: - - * unix/README: Added documentation for the new features. - - * unix/tcl.m4 (SC_PATH_TCLCONFIG): Replaced ${exec_prefix}/lib by - ${libdir}. - -2002-06-25 Donal K. Fellows - - * generic/tclUtil.c (TclGetIntForIndex): Fix of critical [Bug 533364] - generated when the index is bad and the result is a shared object. The - T_ASTO(T_GOR, ...) idiom likely exists elsewhere though. Also removed - some cruft that just complicated things to no advantage. - (SetEndOffsetFromAny): Same fix, though this wasn't on the path - excited by the bug. - -2002-06-24 Don Porter - - * library/tcltest/tcltest.tcl: Implementation of TIP 101. Adds abd - * tests/parseOld.test: exports a [configure] command from - * tests/tcltest.test: tcltest. - -2002-06-22 Don Porter - - * changes: updated changes file for 8.4b1 release. - - * library/tcltest/tcltest.tcl: Corrections to tcltest and the Tcl - * tests/basic.test: test suite so that a test with options - * tests/cmdInfo.test: -constraints knownBug - * tests/compile.test: -limitConstraints 1 only tests the - * tests/encoding.test: knownBug tests. Mostly involves - * tests/env.test: replacing direct access to the - * tests/event.test: testConstraints array with calls to - * tests/exec.test: the testConstraint command (which - * tests/execute.test: requires tcltest version 2) - * tests/fCmd.test: - * tests/format.test: - * tests/http.test: - * tests/httpold.test: - * tests/ioUtil.test: - * tests/link.test: - * tests/load.test: - * tests/namespace.test: - * tests/pkgMkIndex.test: - * tests/reg.test: - * tests/result.test: - * tests/scan.test: - * tests/stack.test: - -2002-06-22 Donal K. Fellows - - * tools/tcl.wse.in (Disk Label), unix/tcl.spec (version): - * win/README.binary, README, win/configure.in, unix/configure.in: - * generic/tcl.h (TCL_RELEASE_*, TCL_PATCH_LEVEL): Bump to beta1. - -2002-06-21 Joe English - - * generic/tclCompExpr.c: - * generic/tclParseExpr.c: LogSyntaxError() should reset the - interpreter result [Bug 550142 "Tcl_ExprObj -> abort"] - -2002-06-21 Don Porter - - * unix/Makefile.in: Updated all package install directories - * win/Makefile.in: to match current Major.minor versions - * win/makefile.bc: of the packages. Added tcltest package - * win/makefile.vc: to installation on Windows. - - * library/init.tcl: Corrected comments and namespace style issues. - Thanks to Bruce Stephens. [Bug 572025] - -2002-06-21 Vince Darley - - * tests/cmdAH.test: Added TIP#99 implementation of 'file - * tests/fCmd.test: link'. Supports creation of symbolic and - * tests/fileName.test: hard links in the native filesystems and - * tests/fileSystem.test: in vfs's, when the individual filesystem - * generic/tclTest.c: supports the concept. - * generic/tclCmdAH.c: - * generic/tclIOUtil.c: - * generic/tcl.h: - * generic/tcl.decls: - * doc/FileSystem.3: - * doc/file.n: - * mac/tclMacFile.c: - * unix/tclUnixFile.c: - * win/tclWinFile.c: Also enhanced speed of 'file normalize' on - Windows. - -2002-06-20 Miguel Sofer - - * generic/tclBasic.c (TclEvalObjvInternal): fix for [Bug 571385] in - the implementation of TIP#62 (command tracing). Vince Darley, Hemang - Lavana & Don Porter: thanks. - -2002-06-20 Miguel Sofer - - * generic/tclExecute.c (TclCompEvalObj): clarified and simplified the - logic for compilation/recompilation. - -2002-06-19 Joe English - - * doc/file.n: Fixed indentation. No substantive changes. - -2002-06-19 Jeff Hobbs - - * generic/tclCmdMZ.c (Tcl_RegexpObjCmd): get the resultPtr again as - the Tcl_ObjSetVar2 may cause the result to change. [Patch 558324] - (watson) - -2002-06-19 Miguel Sofer - - * generic/tclExecute.c (TEBC): removing unused "for(;;)" loop; - improved comments; re-indentation. - -2002-06-18 Miguel Sofer - - * generic/tclExecute.c (TEBC): - - elimination of duplicated code in the non-immediate INST_INCR - instructions. - - elimination of 103 (!) TclDecrRefCount macros. The different - instructions now jump back to a common "DecrRefCount zone" at the - top of the loop. The macro "ADJUST_PC" was replaced by two macros - "NEXT_INST_F" and "NEXT_INST_V" that take three params - (pcAdjustment, # of stack objects to discard, resultObjPtr handling - flag). The only instructions that retain a TclDecrRefCount are - INST_POP (for speed), the common code for the non-immediate - INST_INCR, INST_FOREACH_STEP and the two INST_LSET. - - The object size of tclExecute.o was reduced by approx 20% since the - start of the consolidation drive, while making room for some peep-hole - optimisation at runtime. - -2002-06-18 Miguel Sofer - - * generic/tclExecute.c (TEBC, INST_DONE): small bug in the panic code - for tcl-stack corruption. - -2002-06-17 David Gravereaux - - Trims to support the removal of RESOURCE_INCLUDED from rc scripts from - [FRQ 565088]. - - * generic/tcl.h: moved the #ifndef RC_INVOKED start block up in the - file. rc scripts don't need to know thread mutexes. - - * win/tcl.rc: - * win/tclsh.rc: removed the #define RESOURCE_INCLUDED to let the - built-in -DRC_INVOKED to the work. - -2002-06-17 Jeff Hobbs - - * doc/CrtTrace.3: Added TIP#62 implementation of command - * doc/trace.n: execution tracing [FRQ 462580] (lavana). - * generic/tcl.h: This includes enter/leave tracing as well - * generic/tclBasic.c: as inter-procedure stepping. - * generic/tclCmdMZ.c: - * generic/tclCompile.c: - * generic/tclExecute.c: - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - * generic/tclVar.c: - * tests/trace.test: - -2002-06-17 Andreas Kupries - - * win/tclWinPipe.c (BuildCommandLine): Fixed [Bug 554068] ([exec] on - windows did not treat { in filenames well.). Bug reported by Vince - Darley , patch provided by Vince - too. - -2002-06-17 Joe English - - * generic/tcl.h: #ifdef logic for K&R C backwards compatibility - changed to assume modern C by default. See [FRQ 565088] for full - details. - -2002-06-17 Don Porter - - * doc/msgcat.n: Corrected en_UK references to en_GB. UK is not a - country designation recognized in ISO 3166. - - * library/msgcat/msgcat.tcl: More Windows Registry locale codes from - Bruno Haible. - - * doc/msgcat.n: - * library/msgcat/msgcat.tcl: - * library/msgcat/pkgIndex.tcl: - * tests/msgcat.test: Revised locale initialization to interpret - environment variable locale values according to XPG4, and to recognize - the LC_ALL and LC_MESSAGES values over that of LANG. Also added many - Windows Registry locale values to those recognized by msgcat. Revised - tests and docs. Bumped to version 1.3. Thanks to Bruno Haible for the - report and assistance crafting the solution. [Bug 525522, 525525] - -2002-06-16 Miguel Sofer - - * generic/tclCompile.c (TclCompileTokens): a better algorithm for the - previous bug fix. - -2002-06-16 Miguel Sofer - - * generic/tclCompile.c (TclCompileTokens): - * tests/compile.test: [Bug 569438] in the processing of dollar - variables; report by Georgios Petasis. - -2002-06-16 Miguel Sofer - - * generic/tclExecute.c: bug in the consolidation of the INCR_..._STK - instructions; the bug could not be exercised as the (faulty) - instruction INST_INCR_ARRAY_STK was never compiled-in (related to [Bug - 569438]). - -2002-06-14 Miguel Sofer - - * generic/tclExecute.c (TclExecuteByteCode): runtime peep-hole - optimisation of variables (INST_STORE, INST_INCR) and commands - (INST_INVOKE); faster check for the existence of a catch. - (TclExecuteByteCode): runtime peep-hole optimisation of comparisons. - (TclExecuteByteCode): runtime peep-hole optimisation of INST_FOREACH - - relies on peculiarities of the code produced by the bytecode compiler. - -2002-06-14 David Gravereaux - - * win/rules.vc: The test for compiler optimizations was in error. - Thanks goes to Roy Terry for his assistance - with this. - -2002-06-14 Donal K. Fellows - - * doc/trace.n, tests/trace.test: - * generic/tclCmdMZ.c (Tcl_TraceObjCmd,TclTraceCommandObjCmd) - (TclTraceVariableObjCmd): Changed references to "trace list" to - "trace info" as mandated by TIP#102. - -2002-06-13 Miguel Sofer - - * generic/tclExecute.c (TclExecuteByteCode): consolidated code for the - conditional branch instructions. - -2002-06-13 Miguel Sofer - - * generic/tclExecute.c (TclExecuteByteCode): fixed the previous patch; - wouldn't compile with TCL_COMPILE_DEBUG set. - -2002-06-13 Miguel Sofer - - * generic/tclExecute.c (TclExecuteByteCode): consolidated the handling - of exception returns to INST_INVOKE and INST_EVAL, as well as most of - the code for INST_CONTINUE and INST_BREAK, in the new jump target - "processExceptionReturn". - -2002-06-13 Miguel Sofer - - * generic/tclExecute.c (TclExecuteByteCode): consolidated variable - handling opcodes, replaced redundant code with some 'goto'. All - store/append/lappend opcodes on the same data type now share the main - code; same with incr opcodes. - * generic/tclVar.c: added the bit TCL_TRACE_READS to the possible - flags to Tcl_SetVar2Ex - it causes read traces to be fired prior to - setting the variable. This is used in the core for [lappend]. - - ***NOTE*** the usage of TCL_TRACE_READS in Tcl_(Obj)?GetVar.* is not - documented; there, it causes the call to create the variable if it - does not exist. The new usage in Tcl_(Obj)?SetVar.* remains - undocumented too ... - -2002-06-13 Vince Darley - - * tests/fCmd.test: - * tests/winFile.test: - * tests/fileSystem.test: - * generic/tclTest.c: - * generic/tclCmdAH.c: - * generic/tclIOUtil.c: - * doc/FileSystem.3: - * mac/tclMacFile.c: - * unix/tclUnixFile.c: - * win/tclWinFile.c: fixed up further so both compiles and actually - works with VC++ 5 or 6. - * win/tclWinInt.h: - * win/tclWin32Dll.c: cleaned up code and vfs tests and added tests for - the internal changes of 2002-06-12, to see whether WinTcl on NTFS can - coexist peacefully with links in the filesystem. Added new test - command 'testfilelink' to enable the newer code to be tested. - * tests/fCmd.test: (made certain tests of 'testfilelink' not run on - unix). - -2002-06-12 Miguel Sofer - - * tclBasic.c (Tcl_DeleteTrace): fixed [Bug 568123] (thanks to Hemang - Lavana) - -2002-06-12 Jeff Hobbs - - * win/tclWinFile.c: corrected the symbolic link handling code to allow - it to compile. Added real definition of REPARSE_DATA_BUFFER (found in - winnt.h). Most of the added definitions appear to have correct, - cross-Win-version equivalents in winnt.h and should be removed, but - just making things "work" for now. - -2002-06-12 Vince Darley - - * generic/tclIOUtil.c: - * generic/tcl.decls: - * generic/tclDecls.h: made code for Tcl_FSNewNativePath agree with man - pages. - - * doc/FileSystem.3: clarified the circumstances under which certain - functions are called in the presence of symlinks. - - * win/tclWinFile.c: - * win/tclWinPort.h: - * win/tclWinInt.h: - * win/tclWinFCmd.c: Fix for Windows to allow 'file lstat', 'file - type', 'glob -type l', 'file copy', 'file delete', 'file normalize', - and all VFS code to work correctly in the presence of symlinks - (previously Tcl's behaviour was not very well defined). This also - fixes possible serious problems in all versions of WinTcl where 'file - delete' on a NTFS symlink could delete the original, not the symlink. - Note: symlinks cannot yet be created in pure Tcl. - -2002-06-11 Miguel Sofer - - * generic/tclBasic.c: - * generic/tclCompCmds.c: - * generic/tclInt.h: reverted the new compilation functions; replaced - by a more general approach described below. - - * generic/tclCompCmds.c: - * generic/tclCompile.c: made *all* compiled variable access attempts - create an indexed variable - even get or incr without previous set. - This allows indexed access to local variables that are created and set - at runtime, for example by [global], [upvar], [variable], [regexp], - [regsub]. - -2002-06-11 Miguel Sofer - - * doc/global.n: - * doc/info.n: - * test/info.test: - * generic/tclCmdIL.c: fix for [Bug 567386], [info locals] was - reporting some linked variables. - - * generic/tclBasic.c: - * generic/tclCompCmds.c: - * generic/tclInt.h: added compile functions for [global], [variable] - and [upvar]. They just declare the new local variables, the commands - themselves are not compiled-in. This gives a notably faster read - access to these linked variables. - -2002-06-11 Miguel Sofer - - * generic/tclExecute.c: optimised algorithm for exception range - lookup; part of [Patch 453709]. - -2002-06-10 Vince Darley - - * unix/tclUnixFCmd.c: fixed [Bug 566669] - * generic/tclIOUtil.c: improved and sped up handling of native paths - (duplication and conversion to normalized paths), particularly on - Windows. - * modified part of above commit, due to problems on Linux. Will - re-examine bug report and evaluate more closely. - -2002-06-07 Don Porter - - * tests/tcltest.test: More corrections to test suite so that tests of - failing [test]s don't show up themselves as failing tests. - -2002-06-07 Donal K. Fellows - - * generic/tclExecute.c: Tidied up headers in relation to float.h to - cut the cruft and ensure DBL_MAX is defined since doubles seem to be - the same size everywhere; if the assumption isn't true, the variant - platforms had better have run configure... - - * unix/tclUnixPort.h (EOVERFLOW): Added code to define it if it - wasn't previously defined. Also some other general tidying and adding - of comments. [Bugs 563122, 564595] - * compat/tclErrno.h: Added definition for EOVERFLOW copied from - Solaris headers; I've been unable to find any uses of EFTYPE, which - was the error code previously occupying the slot, in Tcl, or any - definition of it in the Solaris headers. - -2002-06-06 Mo DeJong - - * unix/dltest/Makefile.in: Remove hard coded CFLAGS=-g and add - CFLAGS_DEBUG, CFLAGS_OPTIMIZE, and CFLAGS_DEFAULT varaibles. [Bug - 565488] - -2002-06-06 Don Porter - - * tests/tcltest.test: Corrections to test suite so that tests of - failing [test]s don't show up themselves as failing tests. - - * tests/io.test: Fixed up namespace variable resolution issues - revealed by running test suite with "-singleproc 1". - - * doc/tcltest.n: - * library/tcltest/tcltest.tcl: - * tests/tcltest.test: Several updates to tcltest. - 1) changed to lazy initialization of test constraints - 2) deprecated [initConstraintsHook] - 3) repaired badly broken [limitConstraints]. - 4) deprecated [threadReap] and [mainThread] - [Patch 512214, Bug 558742, Bug 461000, Bug 534903] - -2002-06-06 Daniel Steffen - - * unix/tclUnixThrd.c (TclpReaddir, TclpLocaltime, TclpGmtime): added - mutex wrapped calls to readdir, localtime & gmtime in case their - thread-safe *_r counterparts are not available. - * unix/tcl.m4: added configure check for readdir_r - * unix/tcl.m4 (Darwin): set TCL_DEFAULT_ENCODING to utf-8 on MacOSX - (where posix file apis expect utf-8, not iso8859-1). - * unix/configure: regen - * unix/Makefile.in: set DYLD_LIBRARY_PATH in parallel to - LD_LIBRARY_PATH for MacOSX dynamic linker. - * generic/tclEnv.c (TclSetEnv): fix env var setting on MacOSX (adapted - from [Patch 524352] by jkbonfield). - -2002-06-05 Don Porter - - * doc/Tcl_Main.3: Documented $tcl_rcFileName and added more - clarifications about the intended use of Tcl_Main(). [Bug 505651] - -2002-06-05 Daniel Steffen - - * generic/tclFileName.c (TclGlob): mac specific fix to recent changes - in 'glob -tails' handling. - * mac/tclMacPort.h: - * mac/tclMacChan.c: fixed TIP#91 bustage. - * mac/tclMacResource.c (Tcl_MacConvertTextResource): added utf - conversion of text resource contents. - * tests/macFCmd.test (macFCmd-1.2): allow CWIE creator. - -2002-06-04 Don Porter - - * library/tcltest/tcltest.tcl: - * tests/init.test: - * tests/tcltest.test: Added more TIP 85 tests from Arjen Markus. - Converted tcltest.test to use a private namespace. Fixed bugs in - [tcltest::Eval] revealed by calling [tcltest::test] from a non-global - namespace, and namespace errors in init.test. - -2002-06-04 Mo DeJong - - * win/README: Update msys+mingw URL. - -2002-06-03 Don Porter - - * doc/tcltest.n: - * library/tcltest/tcltest.tcl: - * library/tcltest/pkgIndex.tcl: - * tests/tcltest.test: Implementation of TIP 85. Allows tcltest users - to add new legal values of the -match option to [test], associating - each with a Tcl command that does the matching of expected results - with actual results of tests. Thanks to Arjen Markus. => tcltest 2.1 - [Patch 521362] - -2002-06-03 Miguel Sofer - - * doc/namespace.n: added description of [namepace forget] behaviour - for unqualified patterns. [Bug 559268] - -2002-06-03 Miguel Sofer - - * generic/tclExecute.c: reverting an accidental modification in the - last commit. - -2002-06-03 Miguel Sofer - - * doc/Tcl.n: clarify the empty variable name issue ([Bug 549285] - reported by Tom Krehbiel, patch by Don Porter). - -2002-05-31 Don Porter - - * library/package.tcl: Fixed leak of slave interp in [pkg_mkIndex]. - Thanks to Helmut for report. [Bug 550534] - - * tests/io.test: - * tests/main.test: Use the "stdio" constraint to control whether an - [open "|[interpreter]"] is attempted. - - * generic/tclExecute.c (TclMathInProgress,TclExecuteByteCode - (ExprCallMathFunc): - * generic/tclInt.h (TclMathInProgress): - * unix/Makefile.in (tclMtherr.*): - * unix/configure.in (NEED_MATHERR): - * unix/tclAppInit.c (matherr): - * unix/tclMtherr.c (removed file): - * win/tclWinMtherr.c (_matherr): Removed internal routine - TclMathInProgress and Unix implementation of matherr(). These are now - obsolete, dealing with very old versions of the C math library. - Windows version is retained in case Borland compilers require it, but - it is inactive. Thanks to Joe English. [Bug 474335, Patch 555635] - - * unix/configure: regen - -2002-05-30 Miguel Sofer - - * generic/tclCompExpr.c: - * generic/tclCompile.c: - * generic/tclCompile.h: removed exprIsJustVarRef and - exprIsComparison from the ExprInfo and CompileEnv structs. These - were set, but not used since dec 1999 [Bug 562383]. - -2002-05-30 Vince Darley - - * generic/tclFileName.c (TclGlob): fix to longstanding 'knownBug' in - fileName tests 15.2-15.4, and fix to a new Tcl 8.4 bug in certain uses - of 'glob -tails'. - * tests/fileName.test: removed 'knownBug' flag from some tests, added - some new tests for above bugs. - -2002-05-29 Jeff Hobbs - - * unix/configure: regen'ed - * unix/configure.in: replaced bigendian check with autoconf standard - AC_C_BIG_ENDIAN, which defined WORDS_BIGENDIAN on bigendian systems. - * generic/tclUtf.c (Tcl_UniCharNcmp): - * generic/tclInt.h (TclUniCharNcmp): use WORDS_BIGENDIAN instead of - TCL_OPTIMIZE_UNICODE_COMPARE to enable memcmp alternative. - - * generic/tclExecute.c (TclExecuteByteCode INST_STR_CMP): - * generic/tclCmdMZ.c (Tcl_StringObjCmd): changed the case for choosing - the Tcl_UniCharNcmp compare to when both objs are of StringType, as - benchmarks show that is the optimal check (both bigendian and - littleendian systems). - -2002-05-29 Don Porter - - * generic/tclMain.c: Removed "dummy" reference to Tcl_LinkVar. It is - no longer needed since Tcl_Main() now actually calls Tcl_LinkVar(). - Thanks to Joe English for pointing that out. - -2002-05-29 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Use the macro version. - * generic/tclInt.h (TclUniCharNcmp): Optimised still further with a - macro for use in sensitive places like tclExecute.c - - * generic/tclUtf.c (Tcl_UniCharNcmp): Use new flag to figure out when - we can use an optimal comparison scheme, and default to the old scheme - in other cases which is at least safe. - * unix/configure.in (TCL_OPTIMIZE_UNICODE_COMPARE): New optional flag - that indicates when we can use memcmp() to compare Unicode strings - (i.e. when the high-byte of a Tcl_UniChar precedes the low-byte.) - -2002-05-29 Jeff Hobbs - - * generic/tclInt.decls: - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - * generic/tclUtf.c: added TclpUtfNcmp2 private command that - mirrors Tcl_UtfNcmp, but takes n in bytes, not utf-8 chars. This - provides a faster alternative for comparing utf strings internally. - (Tcl_UniCharNcmp, Tcl_UniCharNcasecmp): removed the explicit end of - string check as it wasn't correct for the function (by doc and logic). - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): reworked the string equal - comparison code to use TclpUtfNcmp2 as well as short-circuit for - equal objects or unequal length strings in the equal case. - Removed the use of goto and streamlined the other parts. - - * generic/tclExecute.c (TclExecuteByteCode): added check for object - equality in the comparison instructions. Added short-circuit for != - length strings in INST_EQ, INST_NEQ and INST_STR_CMP. Reworked - INST_STR_CMP to use TclpUtfNcmp2 where appropriate, and only use - Tcl_UniCharNcmp when at least one of the objects is a Unicode obj with - no utf bytes. - - * generic/tclCompCmds.c (TclCompileStringCmd): removed error creation - in code that no longer throws an error. - - * tests/string.test: - * tests/stringComp.test: added more string comparison checks. - - * tests/clock.test: better qualified 9.1 constraint check for %s. - -2002-05-28 Jeff Hobbs - - * generic/tclThreadAlloc.c (TclpRealloc, TclpFree): protect - against the case when NULL is based. - - * tests/clock.test: added clock-9.1 - * compat/strftime.c: - * generic/tclClock.c: - * generic/tclInt.decls: - * generic/tclIntDecls.h: - * unix/tclUnixTime.c: fix for Windows msvcrt mem leak caused by using - an env(TZ) setting trick for in clock format -gmt 1. This also makes - %s seem to work correctly with -gmt 1 as well as making it a lot - faster by avoid the env(TZ) hack. TclpStrftime now takes useGMT as an - arg. [Bug 559376] - -2002-05-28 Vince Darley - - * generic/tclIOUtil.c: fixes to Tcl_FSLoadFile when called on a file - inside a vfs. This should avoid leaving temporary files sitting - around on exit. [Bug 545579] - -2002-05-27 Donal K. Fellows - - * win/tclWinError.c: Added comment on conversion of - ERROR_NEGATIVE_SEEK because that is a mapping that really belongs, - and not a catch-all case. - * win/tclWinPort.h (EOVERFLOW): Should be either EFBIG or EINVAL - * generic/tclPosixStr.c (Tcl_ErrnoId, Tcl_ErrnoMsg): EOVERFLOW can - potentially be a synonym for EINVAL. - -2002-05-24 Donal K. Fellows - - === Changes due to TIP#91 === - - * win/tclWinPort.h: Added declaration of EOVERFLOW. - * doc/CrtChannel.3: Added documentation of wideSeekProc. - * generic/tclIOGT.c (TransformSeekProc, TransformWideSeekProc): - Adapted to use the new channel mechanism. - * unix/tclUnixChan.c (FileSeekProc, FileWideSeekProc): Renamed - FileSeekProc to FileWideSeekProc and created new FileSeekProc which - has the old-style interface and which errors out with EOVERFLOW when - the returned file position can't fit into the return type (int for - historical reasons). - * win/tclWinChan.c (FileSeekProc, FileWideSeekProc): Renamed - FileSeekProc to FileWideSeekProc and created new FileSeekProc which - has the old-style interface and which errors out with EOVERFLOW when - the returned file position can't fit into the return type (int for - historical reasons). - * mac/tclMacChan.c (FileSeek): Reverted to old interface; Macs lack - large-file support because I can't see how to add it. - * generic/tclIO.c (Tcl_Seek, Tcl_Tell): Given these functions - knowledge of the new arrangement of channel types. - (Tcl_ChannelVersion): Added recognition of new version code. - (HaveVersion): New function to do version checking. - (Tcl_ChannelBlockModeProc, Tcl_ChannelFlushProc) - (Tcl_ChannelHandlerProc): Made these functions use HaveVersion for - ease of future maintainability. - (Tcl_ChannelBlockModeProc): Obvious lookup function. - * generic/tcl.h (Tcl_ChannelType): New wideSeekProc field, and - seekProc type restored to old interpretation. - (TCL_CHANNEL_VERSION_3): New channel version. - -2002-05-24 Andreas Kupries - - * tests/winPipe.test: Applied patch for [Bug 549617]. Patch and bug - report by Kevin Kenny . - - * win/tclWinSock.c (TcpWatchProc): Fixed [Bug 557878]. We are not - allowed to mess with the watch mask if the socket is a server socket. - I believe that the original reporter is George Peter Staplin. - -2002-05-21 Mo DeJong - - * unix/configure: Regen. - * unix/configure.in: Invoke SC_ENABLE_SHARED before calling - SC_CONFIG_CFLAGS so that the SHARED_BUILD variable can be checked - inside SC_CONFIG_CFLAGS. - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Pass -non_shared instead of -shared - to ld when configured with --disable-shared under OSF. [Bug 540390] - -2002-05-20 Daniel Steffen - - * generic/tclInt.h: added prototype for TclpFilesystemPathType(). - * mac/tclMacChan.c: use MSL provided creator type if available instead - of the default 'MPW '. - -2002-05-16 Joe English - - * doc/CrtObjCmd.3: Added Tcl_GetCommandFromObj, Tcl_GetCommandFullName - [Bugs 547987, 414921] - -2002-05-14 Donal K. Fellows - - * unix/tclUnixChan.c (TtyOutputProc): #if/#endif-ed this function out - to stop compiler warnings. Also much general tidying of comments in - this file and removal of whitespace from blank lines. - -2002-05-13 Donal K. Fellows - - * unix/tclUnixChan.c (SETBREAK): Solaris thinks ioctl() takes a signed - second argument, and Linux thinks ioctl() takes an unsigned second - argument. So need a longer definition of this macro to get neither to - spew warnings... - -2002-05-13 Vince Darley - - * generic/tclEvent.c: - * generic/tclIOUtil.c: - * generic/tclInt.h: clean up all memory allocated by the filesystem, - via introduction of 'TclFinalizeFilesystem'. - Move TclFinalizeLoad into TclFinalizeFilesystem so we can be sure it - is called at just the right time. - Fix bad comment also. [Bug 555078 and 'fs' part of 543549] - * win/tclWinChan.c: fix comment referring to wrong function. - -2002-05-10 Don Porter - - * tests/load.test: - * tests/safe.test: - * tests/tcltest.test: Corrected some list-quoting issues and other - matters that cause tests to fail when the patch includes special - characters. Report from Vince Darley. [Bug 554068] - -2002-05-08 David Gravereaux - - * doc/file.n: - * tools/man2tcl.c: - * tools/man2help2.tcl: Thanks to Peter Spjuth - , again. My prior fix for single-quote macro - mis-understanding was wrong. Reverted to reimpliment the 'macro2' proc - which handles single-quote macros and restored file.n text arrangement - to avoid single-quotes on the first line. Sorry for all the confusion. - -2002-05-08 David Gravereaux - - * tools/man2tcl.c: - * tools/man2help2.tcl: Proper source of macro error misunderstanding - single-quote as the leading macro command found and repaired. - - * doc/file.n: Reverted to prior state before I messed with it. - -2002-05-08 Don Porter - - * library/tcltest/tcltest.tcl: Corrected [uplevel] quoting when - [source]-ing test script in subdirectories. - * tests/fileName.test: - * tests/load.test: - * tests/main.test: - * tests/tcltest.test: - * tests/unixInit.test: Fixes to test suite when there's a space in the - working path. Thanks to Kevin Kenny. - -2002-05-07 David Gravereaux - - -- Changes from Peter Spjuth - * tools/man2tcl.c: Increased line buffer size and a bail-out if that - should ever be over-run. - * tools/man2help.tcl: Include Courier New font in rtf header. - * tools/man2help2.tcl: Improved handling of CS/CE fields. Use Courier - New for code samples and indent better. - - * doc/file.n: - * doc/TraceCmd.3: winhelp conversion tools where understanding - a ' as the first character on a line to be an unknown macro. - Not knowing how to repair tools/man2tcl.c, I decided to rearrange - the text in the docs instead. - -2002-05-07 Vince Darley - - * generic/tclFileName.c: fix to similar segfault when using 'glob - -types nonsense -dir dirname -join * *'. [Bug 553320] - - * doc/FileSystem.3: further documentation on vfs. - * tests/cmdAH.test: - * tests/fileSystem.test: - * tests/pkgMkindex.test: Fix to testsuite bugs when running out of - directory whose name contains '{' or '['. - -2002-05-07 Miguel Sofer - - * tests/basic.test: Fix for [Bug 549607] - * tests/encoding.test: Fix for [Bug 549610] - These are testsuite bugs that caused failures when the filename - contained spaces. Report & fix by Kevin Kenny. - -2002-05-02 Vince Darley - - * generic/tclFileName.c: fix to freeing a bad object (i.e. segfault) - when using 'glob -types nonsense -dir dirname'. - * generic/tclWinFile.c: fix to [Bug 551306], also wrapped some long - lines. - * tests/fileName.test: added several tests for the above bugs. - * doc/FileSystem.3: clarified documentation on refCount requirements - of the object returned by the path type function. - * generic/tclIOUtil.c: - * win/tclWinFile.c: - * unix/tclUnixFile.c: - * mac/tclMacFile.c: moved TclpFilesystemPathType to the platform- - specific directories, so we can add missing platform-specific - implementations. On Windows, 'file system' now returns useful results - like "native NTFS", "native FAT" for that system. Unix and MacOS still - only return "native". - * doc/file.n: clarified documentation. - * tests/winFile.test: test for 'file system' returning correct values. - * tests/fileSystem.test: test for 'file system' returning correct - values. Clean up after failed previous test run. - -2002-04-26 Jeff Hobbs - - * unix/configure: - * unix/tcl.m4: change HP-11 SHLIB_LD_LIBS from "" to ${LIBS} so that - the .sl knows its dependent libs. - -2002-04-26 Donal K. Fellows - - * tests/obj.test (obj-11.[56]): Test conversion to boolean more - thoroughly. - * generic/tclObj.c (SetBooleanFromAny): Was not calling an integer - parsing function on native 64-bit platforms! [Bug 548686] - -2002-04-24 Jeff Hobbs - - * generic/tclInt.h: corrected TclRememberJoinableThread decl to use - VOID instead of void. - * generic/tclThreadJoin.c: noted that this code isn't needed on Unix. - -2002-04-23 Jeff Hobbs - - * doc/exec.n: - * doc/tclvars.n: doc updates [Patch 509426] (gravereaux) - -2002-04-24 Daniel Steffen - - * mac/tclMacResource.r: added check of TCLTK_NO_LIBRARY_TEXT_RESOURCES - #define to allow disabling the inclusion of the tcl library code in - the resource fork of Tcl executables and shared libraries. - -2002-04-23 Donal K. Fellows - - * doc/TraceCmd.3: New file that documents Tcl_CommandTraceInfo, - Tcl_TraceCommand and Tcl_UntraceCommand [Bug 414927] - -2002-04-22 Jeff Hobbs - - * generic/tclAlloc.c: - * generic/tclInt.h: - * generic/tclThreadAlloc.c (new): - * unix/Makefile.in: - * unix/tclUnixThrd.c: - * win/Makefile.in: - * win/tclWinInt.h: - * win/tclWinThrd.c: added new threaded allocator contributed by AOL - that significantly reduces lock contention when multiple threads are - in use. Only Windows and Unix implementations are ready, and the - Windows one may need work. It is only used by default on Unix for now, - and requires that USE_THREAD_ALLOC be defined (--enable-threads on - Unix will define this). - - * generic/tclIOUtil.c (Tcl_FSRegister, Tcl_FSUnregister): corrected - calling of Tcl_ConditionWait to ensure that there would be a condition - to wait upon. - - * generic/tclCmdAH.c (Tcl_FileObjCmd): added cast in FILE_SIZE. - - * win/tclWinFCmd.c (DoDeleteFile): check return of setattr API calls - in file deletion for correct Win32 API handling. - - * win/Makefile.in: correct dependencies for shell, gdb, runtest - targets. - - * doc/clock.n: - * compat/strftime.c (_fmt): change strftime to correctly handle - localized %c, %x and %X on Windows. Added some notes about how the - other values could be further localized. - -2002-04-19 Don Porter - - * generic/tclMain.c (Tcl_Main): Free the memory allocated for the - startup script path. [Bug 543549] - - * library/msgcat/msgcat.tcl: [mcmax] wasn't using the caller's - namespace when determining the max translated length. Also made - revisions for better use of namespace variables and more efficient - [uplevel]s. - - * doc/msgcat.n: - * library/msgcat/msgcat.tcl: - * library/msgcat/pkgIndex.tcl: Added [mcload] to the export list of - msgcat; bumped to 1.2.3. [Bug 544727] - -2002-04-20 Daniel Steffen - - * generic/tclInt.decls: - * generic/tclIntPlatDecls.h: - * generic/tclStubInit.c: - * mac/tclMacFCmd.c: - * mac/tclMacFile.c: - * mac/tclMacUtil.c: Modified TclpObjNormalizePath to be alias file - aware, and replaced various calls to FSpLocationFrom*Path by calls to - new alias file aware versions FSpLLocationFrom*Path. The alias file - aware routines don't resolve the last component of a path if it is an - alias. This allows [file copy/delete] etc. to act correctly on alias - files. (c.f. discussion in [Bug 511666]) - -2002-04-19 Donal K. Fellows - - * tests/lindex.test (lindex-3.7): - * generic/tclUtil.c (TclGetIntForIndex): Stopped indexes from hitting - wide ints. [Bug 526717] - -2002-04-18 Miguel Sofer - - * generic/tclNamesp.c: - * tests/info.test: [Bug 545325] info level didn't report namespace - eval, bug report by Richard Suchenwirth. - -2002-04-18 Don Porter - - * doc/subst.n: Clarified documentation on handling unusual return - codes during substitution, and on variable substitutions implied by - command substitution, and vice versa. [Bug 536838] - -2002-04-18 Donal K. Fellows - - * generic/tclCmdIL.c (InfoBodyCmd): - * tests/info.test (info-2.6): Proc bodies without string reps would - report as empty. [Bug 545644] - - * generic/tclCmdMZ.c (Tcl_SubstObj): More clarification for comment on - behaviour when substitutions are not well-formed, prompted by [Bug - 536831]; alas, removing the ill-defined behaviour is a lot of work. - -2002-04-18 Miguel Sofer - - * generic/tclExecute.c: - * tests/expr-old.test: fix for [Bug 542588] (Phil Ehrens), where "too - large integers" were reported as "floating-point value" in [expr] - error messages. - -2002-04-17 Jeff Hobbs - - * generic/tclEncoding.c (EscapeFromUtfProc): - * generic/tclIO.c (WriteChars, Tcl_Close): corrected the handling of - outputting end escapes for escape-based encodings. - [Bug 526524] (yamamoto) - -2002-04-17 Don Porter - - * doc/tcltest.n: Removed [saveState] and [restoreState] from tcltest - 2 documentation, effectively deprecating them. [Bug 495660] - * library/tcltest/tcltest.tcl: Made separate export for commands kept - only for tcltest 1 compatibility. - - * tests/iogt.test: Revised to run tests in a namespace, rather than - use the useless and buggy [saveState] and [restoreState] commands of - tcltest. Updated to use tcltest 2 as well. [Patch 544911] - -2002-04-16 Don Porter - - * tests/io.test: Revised to run tests in a namespace, rather than use - the useless and buggy [saveState] and [restoreState] commands of - tcltest. Updated to use tcltest 2 as well. [Patch 544546] - -2002-04-15 Miguel Sofer - - * generic/tclProc.c: - * tests/proc-old.test: Improved stack trace for TCL_BREAK and - TCL_CONTINUE returns from procs. Patch by Don Porter [Bug 536955]. - - * generic/tclExecute.c: - * tests/compile.test: made bytecodes check for a catch before - returning; the compiled [return] is otherwise non-catchable. [Bug - 542142] reported by Andreas Kupries. - -2002-04-15 Don Porter - - * tests/socket.test: Increased timeout values so that tests have - time to successfully complete even on slow/busy machines. [Bug 523470] - - * doc/tcltest.n: - * library/tcltest/tcltest.tcl: - * tests/tcltest.test: Revised [tcltest::test] to return errors when - called with invalid syntax and to accept exactly two arguments as - documented. Improved error messages. [Bug 497446, Patch 513983] - ***POTENTIAL INCOMPATIBILITY***: Incompatible with previous tcltest - 2.* releases, found only in alpha releases of Tcl 8.4. - -2002-04-11 Jeff Hobbs - - * generic/tclNotify.c (TclFinalizeNotifier): remove remaining - unserviced events on finalization. - - * win/tcl.m4: Enabled COFF as well as CV style debug info with - --enable-symbols to allow Dr. Watson users to see function info. More - info on debugging levels can be obtained at: - http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp - - * tests/ioCmd.test: fixed iocmd-8.15 to have mac and unixPc variants. - - * generic/tclParse.c (Tcl_ParseVar): conditionally incr obj refcount - to prevent possible mem leak. - -2002-04-08 Daniel Steffen - - * generic/tcl.h: no on mac. - * mac/tclMacFile.c: minor fixes to Vince's changes from 03-24. - * mac/tclMacOSA.c: - * mac/tclMacResource.c: added missing Tcl_UtfToExternalDString - conversions of resource file names. - * mac/tclMacSock.c (TcpGetOptionProc): fixed bug introduced by Andreas - on 02-25; changed strcmp's to strncmp's so that option comparison - behaves like on other platforms. - * mac/tcltkMacBuildSupport.sea.hqx (CW Pro6 changes): added support to - allow Tk to hookup C library stderr/stdout to TkConsole. - * tests/basic.test: - * tests/cmdAH.test: - * tests/encoding.test: - * tests/fileSystem.test: - * tests/ioCmd.test: fixed tests failing on mac: check for existence of - [exec], changed some result strings. - -2002-04-06 Jeff Hobbs - - * unix/tclUnixFCmd.c (Realpath): added a little extra code to - initialize a realpath arg when compiling in PURIFY mode in order to - prevent spurious purify warnings. We should really create our own - realpath implementation, but this will at least quiet purify for now. - -2002-04-05 Don Porter - - * generic/tclCmdMZ.c (Tcl_SubstObj): - * tests/subst.test: Corrected [subst] so that return codes TCL_BREAK - and TCL_CONTINUE returned by variable substitution have the same - effect as when those codes are returned by command substitution. [Bug - 536879] - -2002-04-03 Jeff Hobbs - - * library/tcltest/tcltest.tcl: added getMatchingFiles back (alias to - GetMatchingFiles), which was a public function in tcltest 1.0. - -2002-04-01 Vince Darley - - * generic/tclEnv.c: - * generic/tclIOUtil.c: invalidate filesystem cache when the user - changes env(HOME). Fixes [Bug 535621]. Also cleaned up some of the - documentation. - * tests/fileSystem.test: added test for bug just fixed. - -2002-04-01 Kevin Kenny - - * win/tclWinTime.c (Tcl_GetTime): made the checks of clock frequency - more permissive to cope with the fact that Win98SE is observed to - return 1.19318 in place of 1.193182 for the performance counter - frequency. - -2002-03-29 Jeff Hobbs - - * generic/tclCmdMZ.c (Tcl_TraceObjCmd, TraceVarProc) - (TraceCommandProc, TclTraceCommandObjCmd): corrected potential - double-free of traces on variables by flagging in Trace*Proc that it - will free the var in case the eval wants to delete the var trace as - well. [Bug 536937] Also converted Tcl_UntraceVar -> Tcl_UntraceVar2 - and Tcl_Eval to Tcl_EvalEx in Trace*Proc for slight efficiency - improvement. - -2002-03-29 Don Porter - - * doc/AllowExc.3: - * generic/tclBasic.c (Tcl_EvalObjv,Tcl_EvalEx,Tcl_EvalObjEx): - * generic/tclCompile.h (TclCompEvalObj): - * generic/tclExecute.c (TclCompEvalObj,TclExecuteByteCode): - * tests/basic.test: Corrected problems with Tcl_AllowExceptions having - influence over the wrong scope of Tcl_*Eval* calls. Patch from Miguel - Sofer. Report from Jean-Claude Wippler. [Bug 219181] - -2002-03-28 Don Porter - - * generic/tclVar.c: Refactored CallTraces to collect repeated handling - of its returned value into CallTraces itself. - -2002-03-28 David Gravereaux - - * tools/feather.bmp: - * tools/man2help.tcl: - * tools/man2help2.tcl: - * win/makefile.vc: More winhelp target fixups. Added a feather bitmap - to the non-scrollable area and changed the color to be yellow from a - plain white. The colors can be whatever we want them to be, but - thought I would start with something bold. [Bug 527941] - - * doc/SetVar.3: - * doc/TraceVar.3: - * doc/UpVar.3: .AP macro syntax repair. - -2002-03-27 David Gravereaux - - * tools/man2help.tcl: - * win/makefile.vc: winhelp target now copies all needed files from - tools/ to a workarea under $(OUT_DIR) and builds it from there. No - build cruft is left in tools/ anymore. All paths used in man2help.tcl - are now relative to where the script is. [Bug 527941] - -2002-03-27 David Gravereaux - - * win/.cvsignore: - * win/buildall.vc.bat: - * win/coffbase.txt: - * win/makefile.vc: - * win/nmakehlp.c (new): - * win/rules.vc: First draft fix for [Bug 527941]. More changes need - to done to the makehelp target to get to stop leaving build files in - the tools/ directory. This does not address the syntax errors in the - man files. Having the contents of tcl.hpj(.in) inside makefile.vc - allows for version numbers to be replaced with macros. - - The new nmakehlp.c is built by rules.vc in preprocessing and removes - the need to use tricky shell syntax that wasn't compatible on Win9x - systems. Clean targets made Win9x complient. This is a first draft - repair for [Bug 533862]. - -2002-03-28 Miguel Sofer - - * generic/tclBasic.c (Tcl_EvalEx): passing the correct commandSize to - TclEvalObjvInternal. [Bug 219362], fix by David Knoll. - -2002-03-28 Miguel Sofer - - * generic/tclBasic.c (Tcl_EvalEx): - * tests/basic.test: avoid exceptional returns at level 0. [Bug 219181] - -2002-03-27 Don Porter - - * doc/tcltest.n ([mainThread]): - * library/tcltest/tcltest.tcl: - * tests/tcltest.test: Major code cleanup to deal with whitespace, - coding conventions, and namespace issues, with several minor bugs - fixed in the process. - - * tests/main.test: Added missing [after cancel]s. - -2002-03-25 Don Porter - - * tests/main.test: Removed workarounds for Bug 495977. - - * library/tcltest/tcltest.tcl: Keep the value of $::auto_path - unchanged, so that the tcltest package can test code that depends on - auto-loading. If a testing application needs $::auto_path pruned, it - should do that itself. [Bug 495726] - Improve the processing of the -constraints option to [test] so that - constraint lists can have arbitrary whitespace, and non-lists don't - blow things up. [Bug 495977] - Corrected faulty variable initialization. [Bug 534845] - -2002-03-25 Miguel Sofer - - * doc/CrtTrace.3: small doc correction - * generic/tclBasic.c (Tcl_DeleteTrace): Allow NULL callback on trace - deletions. [Bug 534728] (Hemang Lavana) - -2002-03-24 Miguel Sofer - - * generic/tclBasic.c (Tcl_EvalObjv): replaced obscure, incorrect code - as described in [Bug 533907] (Don Porter). - -2002-03-24 Don Porter - - * library/tcltest/tcltest.tcl: Use [interpreter] to set/query the - executable currently running the tcltest package. [Bug 454050] - - * library/tcltest/tcltest.tcl: Allow non-proc commands to be used as - the customization hooks. [Bug 495662] - -2002-03-24 Vince Darley - - * generic/tclFilename.c: - * generic/tclFCmd.c: - * generic/tclTest.c: - * generic/tcl.h: - * generic/tclIOUtil.c: - * win/tclWinFile.c: - * win/tclWinFCmd.c: - * win/tclWinPipe.c: - * unix/tclUnixFile.c: - * unix/tclUnixFCmd.c: - * mac/tclMacFile.c: - * doc/FileSystem.3: - * doc/file.n: - * tests/cmdAH.test: - * tests/fileName.test: - * tests/fileSystem.test: (new file) - * tests/winFCmd.test: fix [Bug 511666] and [Bug 511658], and improved - documentation of some aspects of the filesystem, particularly - 'Tcl_FSMatchInDirectory' which now might match a single file/directory - only, and 'file normalize' which wasn't very clear before. Removed - inconsistency betweens docs and the Tcl_Filesystem structure. Also - fixed [Bug 523217] and corrected file normalization on Unix so that - it expands symbolic links. Added some new tests of the filesystem - code (in the new file 'fileSystem.test'), and some extra tests for - correct handling of symbolic links. Fix to [Bug 530960] which shows up - on Win98. Made comparison with ".com" case insensitive in tclWinPipe.c - - ***POTENTIAL INCOMPATIBILITY***: But only between alpha releases - (users of the new Tcl_Filesystem lookup table in Tcl 8.4a4 need to - handle the new way in which Tcl may call Tcl_FSMatchInDirectory, and - 'file normalize' on unix now behaves correctly). Only known impact is - with the 'tclvfs' extension. - -2002-03-22 Miguel Sofer - - * tests/basic.test (basic-46.1): adding test for [Bug 533758], fixed - earlier today. - -2002-03-22 Jeff Hobbs - - * win/tclWinInt.h: moved undef of TCL_STORAGE_CLASS. [Bug 478579] - -2002-03-22 Miguel Sofer - - * generic/tclBasic.c (Tcl_EvalObjEx): - * generic/tclExecute.c (TclCompEvalObj): fixed the errorInfo for - return codes other than (TCL_OK, TCL_ERROR) to runLevel 0.[Bug 533758] - Removed the static RecordTracebackInfo(), as its functionality is - easily replicated by Tcl_LogCommandInfo. Bug and redundancy noted by - Don Porter. - -2002-03-21 Donal K. Fellows - - * doc/expr.n: Improved documentation for ceil and floor. [Bug 530535] - -2002-03-20 Don Porter - - * doc/SetVar.3: - * doc/TraceVar.3: - * doc/UpVar.3: - * generic/tcl.h (Tcl_VarTraceProc): - * generic/tcl.decls (Tcl_GetVar2, Tcl_SetVar2, Tcl_TraceVar2, - (Tcl_UnsetVar2, Tcl_UntraceVar2, Tcl_UpVar2, Tcl_VarTraceInfo2, - (Tcl_GetVar2Ex, TclSetVar2Ex): - * generic/tclCmdMZ.c (TraceVarProc): - * generic/tclEnv.c (EnvTraceProc): - * generic/tclEvent.c (VwaitVarProc): - * generic/tclInt.decls (TclLookupVar,TclPrecTraceProc): - * generic/tclLink.c (LinkTraceProc): - * generic/tclUtil.c (TclPrecTraceProc): - * generic/tclVar.c (CallTraces, MakeUpvar, VarErrMsg, TclLookupVar, - (Tcl_GetVar2, Tcl_SetVar2, Tcl_TraceVar2, Tcl_UnsetVar2, - (Tcl_UntraceVar2, Tcl_UpVar2, Tcl_VarTraceInfo2, Tcl_GetVar2Ex, - (TclSetVar2Ex): Updated interfaces of generic/tclVar.c according to - TIP 27. In particular, the "part2" arguments were CONSTified. [Patch - 532642] - * generic/tclDecls.h: - * generic/tclIntDecls.h: make genstubs - -2002-03-15 Donal K. Fellows - - * tests/compile.test (compile-12.3): Test to detect bug 530320. - * generic/tclCompile.c (TclCompileTokens): Fixed buffer overrun - reported in bug 530320. - -2002-03-14 Mo DeJong - - * win/configure: Regen. - * win/configure.in: Add configure time test for SEH support in the - compiler. - * win/tclWin32Dll.c (ESP, EBP, TclpCheckStackSpace, - (_except_checkstackspace_handler): - * win/tclWinChan.c (ESP, EBP, Tcl_MakeFileChannel, - (_except_makefilechannel_handler): - * win/tclWinFCmd.c (ESP, EBP, DoRenameFile, DoCopyFile, - (_except_dorenamefile_handler, _except_docopyfile_handler): - Implement SEH support under gcc using inline asm. Tcl and Tk should - now compile with Mingw 1.1. [Patch 525746] - -2002-03-14 Mo DeJong - - * win/tclWinFCmd.c (DoRenameFile, DoCopyFile): Handle an SEH exception - with EXCEPTION_EXECUTE_HANDLER instead of restarting the faulting - instruction with EXCEPTION_CONTINUE_EXECUTION. [Bug 466102] provides - an example of how restarting could send Tcl into an infinite loop. - [Patch 525746] - -2002-03-11 Mo DeJong - - * win/tclWinFCmd.c (DoRenameFile, DoCopyFile, DoDeleteFile, - (DoRemoveJustDirectory): Make sure we don't pass NULL or "" as a path - name to Win32 API functions since this was crashing under Windows 98. - -2002-03-11 Don Porter - - * library/tcltest/tcltest.tcl: - * library/tcltest/pkgIndex.tcl: Bumped tcltest package to 2.0.2. - -2002-03-11 Mo DeJong - - * library/tcltest/tcltest.tcl (getMatchingFiles): Pass a proper list - to foreach to avoid munging a Windows patch like D:\Foo\Bar into - D:FooBar before the glob. - -2002-03-11 Mo DeJong - - * generic/tclEncoding.c: Fix typo in comment. - * generic/tclIO.c (DoReadChars, ReadBytes, ReadChars): Use NULL value - instead of pointer set to NULL to make things more clear. Reorder - arguments so that they match the function signatures. Cleanup little - typos and add more descriptive comment. - -2002-03-08 Mo DeJong - - * win/README: Update to indicate that Mingw 1.1 is required to build - Tcl. Add section describing new msys based build process. Update - Cygwin build instructions so users know where to find Mingw 1.1. - -2002-03-08 Jeff Hobbs - - * win/tclWinFCmd.c (DoCopyFile): correctly set retval to TCL_OK. - -2002-03-07 Mo DeJong - - * win/tclWin32Dll.c (TclpCheckStackSpace): - * win/tclWinFCmd.c (DoRenameFile, DoCopyFile): Replace hard coded - constants with Win32 symbolic names. Move control flow statements out - of __try blocks since the documentation indicates it is frowned upon. - -2002-03-07 Don Porter - - * doc/interp.n: - * generic/tclInterp.c (Tcl_InterpObjCmd, SlaveObjCmd, - (SlaveRecursionLimit): - * generic/tclTest.c: - * tests/interp.test: Added the [interp recursionlimit] command to - set/query the recursion limit of an interpreter. Proposal and - implementation from Stephen Trier. [TIP 87, Patch 522849] - -2002-03-06 Donal K. Fellows - - * generic/tcl.h, tools/tcl.wse.in, unix/configure.in, - * unix/tcl.spec, win/README.binary, win/configure.in, README: - Bumped patchlevel; this might need to change in the future, but it - will help us distinguish between the CVS version and the most recent - released version. - -2002-03-06 Miguel Sofer - - * generic/tclInt.h: for unshared objects, TclDecrRefCount now frees - the internal rep before the string rep - just like the non-macro - Tcl_DecrRefCount/TclFreeObj. [Bug 524802] - -2002-03-06 Donal K. Fellows - - * doc/lsearch.n: Documentation of new features, plus examples. - * tests/lsearch.test: Tests of new features. - * generic/tclCmdIL.c (Tcl_LsearchObjCmd): TIP#80 support. See - http://purl.org/tcl/tip/80 for details. - -2002-03-05 Jeff Hobbs - - *** 8.4a4 TAGGED FOR RELEASE *** - - * unix/tclUnixChan.c: initial remedy for [Bug 525783] flush problem - introduced by TIP #35. This may not satisfy true serial channels, but - it restores the correct flushing of std* channels on exit. - - * unix/README: added --enable-langinfo doc. - - * unix/tcl.spec: - * tools/tcl.wse.in: fixed URL refs to use www.tcl.tk or SF. - -2002-03-04 Jeff Hobbs - - * README: - * mac/README: - * unix/Makefile.in: - * unix/README: - * win/README: - * win/README.binary: updated to use www.tcl.tk URL. - - * unix/Makefile.in: added older ChangeLogs to dist target. - - * tests/io.test: - * tests/encoding.test: corrected iso2022 encoding results. - added encoding-24.* - * generic/tclEncoding.c (EscapeFromUtfProc): corrected output of - escape codes as per RFC 1468. [Patch 474358] (taguchi) - (TclFinalizeEncodingSubsystem): corrected potential double-free - when encodings were finalized on exit. [Bugs 219314, 524674] - -2002-03-01 Jeff Hobbs - - * library/encoding/iso2022-jp.enc: - * library/encoding/iso2022.enc: - * tools/encoding/iso2022-jp.esc: - * tools/encoding/iso2022.esc: gave $B precedence over $@, - based on comments (point 1) in [Bug 219283] (rfc 1468) - - * tests/encoding.test: added encoding-23.* tests - * generic/tclIO.c (FilterInputBytes): reset the TCL_ENCODING_START - flags in the ChannelState when using 'gets'. [Bug 523988] - Also reduced the value of ENCODING_LINESIZE from 30 to 20 as this - seems to improve the performance of 'gets' according to tclbench. - -2002-02-28 Jeff Hobbs - - * generic/tclCmdMZ.c (TraceCommandProc): ensure that TraceCommandInfo - structure was also deleted when a command was deleted to prevent a - mem leak. - - * generic/tclBasic.c (Tcl_CreateObjTrace): set tracePtr->flags - correctly. - - * generic/tclTimer.c (TimerExitProc): remove remaining events in - tls on thread exit. - -2002-02-28 Miguel Sofer - - * generic/tclNamesp.c: allow cached fully-qualified namespace names to - be usable from different namespaces within the same interpreter - without forcing a new lookup [Patch 458872]. - -2002-02-28 Miguel Sofer - - * generic/tclExecute.c: Replaced a few direct stack accesses with the - POP_OBJECT() macro [Bug 507181] (Don Porter). - -2002-02-27 Don Porter - - * doc/GetIndex.3: - * generic/tcl.decls (Tcl_GetIndexFromObjStruct): - * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): Revised the - prototype of the Tcl_GetIndexFromObjStruct to take its struct table as - a (CONST VOID *) argument, better describing what it is, maintaining - source compatibility, and adding CONST correctness according to TIP - 27. Thanks to Joe English for an elegant solution. [Bug 520304] - - * generic/tclDecls.h: make genstubs - - * generic/tclMain.c (Tcl_Main,StdinProc): Corrected some reference - count management errors on the interactive command Tcl_Obj found by - Purify. Thanks to Jeff Hobbs for the report and assistance. - -2002-02-27 Jeff Hobbs - - * generic/tclBasic.c (Tcl_EvalTokensStandard): corrected mem leak in - error case. - - * generic/tclTest.c (TestStatProc[123]): correct harmless UMRs. - - * generic/tclLink.c (Tcl_LinkVar): correct mem leak in error case. - -2002-02-27 Andreas Kupries - - * tests/socket.test (2.7): Accepted and applied patch for [Bug 523470] - provided by Don Porter to avoid timing - problems in that test. - - * unix/tclUnixChan.c (TclpOpenFileChannel): Added code to regonize - "/dev/tty" (by name) and to not handle it as tty / serial line. This - is the controlling terminal and is special. Setting it into raw mode - as is done for other tty's is a bad idea. This is a hackish fix for - expect [Bug 520624]. The fix has limitation: Tcl_MakeFileChannel - handles tty's specially too, but is unable to recognize /dev/tty as it - only gets a file descriptor, and no name for it. - -2002-02-26 Jeff Hobbs - - * generic/tclCmdAH.c (StoreStatData): corrected mem leak. - - * generic/tclCmdMZ.c (Tcl_RegsubObjCmd): prevent obj leak in - remedial regsub case. - - * generic/tclFileName.c (Tcl_TranslateFileName): decr refcount for - error case to prevent mem leak. - - * generic/tclVar.c (Tcl_ArrayObjCmd): removed extra obj allocation. - - * unix/tclUnixSock.c (Tcl_GetHostName): added an extra - gethostbyname check to guard against failure with truncated - names returned by uname. - - * unix/configure: - * unix/tcl.m4 (SC_SERIAL_PORT): added sys/modem.h check and defined - _XOPEN_SOURCE_EXTENDED for HP-11 to get updated header decls. - - * unix/tclUnixChan.c: added Unix implementation of TIP #35, serial - port support. [Patch 438509] (schroedter) - -2002-02-26 Miguel Sofer - - * generic/tclCmpCmds.c: (bugfix to the bugfix, hopefully the last) - Bugfix to the new [for] compiling code: was setting a exceptArray - parameter using another param which wasn't yet initialised, thus - filling it with noise. - -2002-02-25 Andreas Kupries - - * mac/tclMacSock.c (TcpGetOptionProc): Changed to recognize the option - "-error". Essentially ignores the option, always returning an empty - string. - -2002-02-25 Jeff Hobbs - - * doc/Alloc.3: - * doc/LinkVar.3: - * doc/ObjectType.3: - * doc/PkgRequire.3: - * doc/Preserve.3: - * doc/TCL_MEM_DEBUG.3: Updated documentation to describe the ckalloc, - ckfree, ckrealloc, attemptckalloc, and attemptckrealloc macros, and - to accurately describe when and how they are used. [Bug 497459] (dgp) - - * generic/tclHash.c (AllocArrayEntry, AllocStringEntry): - Before invoking ckalloc when creating a Tcl_HashEntry, - check that the amount of memory being allocated is - at least as large as sizeof(Tcl_HashEntry). The previous - code was allocating memory regions that were one - or two bytes short. [Bug 521950] (dejong) - -2002-02-25 Miguel Sofer - - * generic/tclBasic.c (Tcl_EvalEx): avoiding a buffer overrun - reported by Joe English, and restoring tcl7.6 behaviour for - [subst]: badly terminated nested scripts will raise an error - and not be evaluated. [Bug 495207] - -2002-02-25 Don Porter - - * unix/tclUnixPort.h: corrected strtoll prototype mismatch on Tru64. - * compat/strtod.c (strtod): simplified #includes - * compat/strtol.c (strtol): gather result in a long before returning - as a long: necessary on platforms where sizeof(int) != sizeof(long). - -2002-02-25 Daniel Steffen - - * unix/tclLoadDyld.c: updated to use Mac OS X 10.1 dyld APIs that - have more libdl-like semantics. [Bug 514392] - -2002-02-25 Miguel Sofer - - * generic/tclCompCmds: fixing a bug in patch dated 2002-02-22, in the - code for [for] and [while]. Under certain conditions, for long bodies, - the exception range parameters were badly computed. Tests forthcoming: - I still can't reproduce the conditions in the testsuite (!), although - the bug (with assorted segfault or panic!) can be triggered from the - console or with the new parse.bench in tclbench. - -2002-02-25 Donal K. Fellows - - * compat/strtoul.c, compat/strtol.c, compat/strtod.c: Added UCHAR, - CONST and #includes to clean up GCC output. - -2002-02-23 Don Porter - - * compat/strtoull.c (strtoull): - * compat/strtoll.c (strtoll): - * compat/strtoul.c (strtoul): Fixed failure to handle leading - sign symbols '+' and '-' and '0X' and raise overflow errors. - [Bug 440916] Also corrects prototype and errno problems. - -2002-02-23 Mo DeJong - - * configure: Regen. - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Link with -n32 instead of -32 when - building on IRIX64-6.* system. [Bug 521707] - -2002-02-22 Don Porter - - * generic/tclInt.h: - * generic/tclObj.c: renamed global variable emptyString -> - tclEmptyString because it is no longer static. - * generic/tclPkg.c: Fix for panic when library is loaded on a - platform without backlinking without proper use of stubs. [Bug 476537] - -2002-02-22 Jeff Hobbs - - * tests/regexpComp.test: updated regexp-11.[1-4] to match changes in - regexp.test for new regsub syntax - - * unix/configure: - * unix/tcl.m4: added --enable-64bit support for AIX-4 (using -q64 - flag) when using IBM's xlc compiler. - - * tests/safe.test: updated safe-8.5 and safe-8.7 - * library/safe.tcl (CheckFileName): removed the limit on - sourceable file names (was only *.tcl or tclIndex files with no more - than one dot and 14 chars). There is enough internal protection in a - safe interpreter already. [Tk Bug 521560] - -2002-02-22 Miguel Sofer - - * generic/tclCompCmds: [FR 465811]. Optimising [if], [for] and [while] - for constant conditions; in addition, [for] and [while] are now - compiled with the "loop rotation" optimisation (thanks to Kevin - Kenny). - -2002-02-22 Donal K. Fellows - - --- TIP#76 CHANGES --- - * generic/tclCmdMZ.c (Tcl_RegsubObjCmd): Final-argument-less - [regsub] returns the modified string. - * doc/regsub.n: Updated docs. - * tests/regexp.test: Updated and added tests. - - * compat/strtoll.c (strtoll): - * compat/strtoull.c (strtoull): - * unix/tclUnixPort.h: - * win/tclWinPort.h: Const-ing 64-bit compatibility declarations. Note - that the return pointer is non-const because it is entirely legal for - the functions to be called from somewhere that owns the string being - passed. Fixes problem reported by Larry Virden. - -2002-02-21 David Gravereaux - - * win/mkd.bat (removed): - * win/coffbase.txt (new): - * win/makefile.bc: - * win/makefile.vc: Changed the 'setup' target to stop using the - mkd.bat file and just make the directory right in the rule. Same - change to makefile.bc. Neither configure.in nor Makefile.in use it. - - coffbase.txt will be the master list for our "prefered base addresses" - set by the linker. This should improve load-time (NT only) by avoiding - relocations. Submissions to the list by extension authors are - encouraged. - - Added a 'tidy' target to compliment 'clean' and 'hose' to remove just - the outputs. Also removed the $(winlibs) macro as it wasn't being - used. - - Stuff left to do: - 1) get the winhelp target to stop building in the tools/ directory. - 2) stop using rmd.bat - 3) add more dependacy rules. - - * win/tclAppInit.c: Reverted back to -r1.6, as the header file change - to tclPort.h won't allow for easy embedded support outside of the - source dist. Thanks to Don Porter for pointing this out to me. - -2002-02-21 David Gravereaux - - * win/makefile.vc: - * win/rules.vc: Added a new "loimpact" option that sets the - -ws:aggressive linker option. Off by default. It's said to keep the - heap use low at the expense of alloc speed. - - * win/tclAppInit.c: Changed #include "tcl.h" to be tclPort.h to remove - the raw windows.h include. tclPort.h brings in windows.h already and - lessens the pre-compiled-header mush and the randomly useless #pragma - comment (lib,...) references throughout the big windows.h tree (as - observed at high linker warning levels). - -2002-02-21 Donal K. Fellows - - * generic/tcl.h: Better guessing of LP64/ILP32 architecture, but now - sensitive to presence of (suitable) - -2002-02-20 Don Porter - - * generic/tcl.decls (Tcl_RegExpRange,Tcl_GetIndexFromObjStruct): - Overlooked a few source incompatibilities. Now using CONST84. - * generic/tclDecls.h: make genstubs - * generic/tcl.h (Tcl_CmdObjTraceProc): silence warning from Sun - Workshop compiler. - -2002-02-20 David Gravereaux - - * win/buildall.vc.bat: - * win/makefile.vc: - * win/rules.vc: General clean-ups. Added compiler and linker tests for - a) the pentium 0x0F errata, b) optimizing (not all have this), and c) - linker v6 section alignment confusion. All these are tested first to - make sure any D4002 or LNK1117 warnings aren't displayed. The pentium - 0x0F errata is a recommended switch. The v5 linker's section alignment - default is 512, but the v6 linker was changed to 4096 in an attempt to - speed loading on Win98. I changed the default to always be 512 across - both linkers, unless linking statically, then 4096 is used for the - claimed speed effect. Using a 512 alignment saves 12k bytes of dead - space in the DLL. - - Added IA64 B-stepping errata switch when the compiler supports it. - - Added profiling to $(lflags) when requested and also removed the - explict -entry option as the default works fine as is. - - Removed win/tclWinInit.c from the special case section to let it use - the common implicit rule as the $(EXTFLAGS) macro it had was never - referenced anywhere. - -2002-02-20 Donal K. Fellows - - * generic/tcl.h: Added code to guess the correct settings for - TCL_WIDE_INT_IS_LONG and TCL_WIDE_INT_TYPE when configure doesn't tell - us them, as can happen with extensions. - -2002-02-19 Donal K. Fellows - - * doc/format.n: Updated docs to list the specification. - * generic/tclCmdAH.c (Tcl_FormatObjCmd): Made behaviour on 64-bit - platforms correctly meet the specification, that %d works with the - native word-sized integer, instead of trying to guess (wrongly) - from the value being passed. - -2002-02-19 Don Porter - - * changes: First draft of updated changes for 8.4a4 release. - -2002-02-15 Jeff Hobbs - - * unix/tclUnixPort.h: add strtoll/strtoull declarations for - platforms that do not define them. - - * generic/tclIndexObj.c (STRING_AT): removed ptrdiff_t cast and - use of VOID* in default case (GNU-ism). - -2002-02-15 Kevin Kenny - - * compat/strtoll.c: - * compat/strtoul.c: - * compat/strtoull.c: - * generic/tclIOUtil.c: - * generic/tclPosixStr.c: - * generic/tclTest.c: - * generic/tclTestObj.c: - * tests/get.test: - * win/Makefile.vc: Further tweaks to the TIP 72 patch to make it - compile under VC++. - -2002-02-15 Andreas Kupries - - * tclExecute.c: - * tclIOGT.c: - * tclIndexObj.c: Touchups to the TIP 72 patch to make it compileable - under Windows again. The changes are not complete, there is one nasty - regarding _stati64 - -2002-02-15 Donal K. Fellows - - +----------------------+ - | TIP #72 IMPLEMENTED. | - +----------------------+ - - There are a lot of changes from this TIP, so please see - http://purl.org/tcl/tip/72.html for discussion of - backward-compatibility issues, but the main ones modifications are in: - - * generic/tcl.h: New types. - * generic/tcl.decls: New public functions. - * generic/tclExecute.c: 64-bit aware bytecode engine. - * generic/tclBinary.c: 64-bit handling in [binary] command. - * generic/tclScan.c: 64-bit handling in [scan] command. - * generic/tclCmdAH.c: 64-bit handling in [file] and [format] - commands. - * generic/tclBasic.c: New "wordSize" entry in ::tcl_platform. - * generic/tclFCmd.c: Large-file support (with many consequences.) - * generic/tclIO.c: Large-file support (with many consequences.) - * compat/strtoll.c, compat/strtoull.c: New support functions. - * unix/tcl.m4, unix/configure: 64-bit support and greatly enhanced - cacheing. - - Most other changes, including all those in doc/* and test/* as well as - the majority in the platform directories, follow on from these. - - Also coming out of the woodwork: - * generic/tclIndex.c: Better support for Cray PVP. - * win/tclWinMtherr.c: Better Borland support. - - Note that, in a number of places through the Unix part of the platform - support, there are Tcl_Platform* references. These are expanded into - the correct way to call that particular underlying function, i.e. with - or without a '64' suffix, and should be used by people working on the - core in preference to the API functions they overlay so that the code - remains portable depending on the presence or absence of 64-bit - support on the underlying platform. - - ***POTENTIAL INCOMPATIBILITY***: Extracted from the TIP - - SUMMARY OF INCOMPATIBILITIES AND FIXES - ====================================== - - The behaviour of expressions containing constants that appear positive - but which have a negative internal representation will change, as - these will now usually be interpreted as wide integers. This is always - fixable by replacing the constant with int(constant). - - Extensions creating new channel types will need to be altered as - different types are now in use in those areas. The change to the - declaration of Tcl_FSStat and Tcl_FSLstat (which are the new preferred - API in any case) are less serious as no non-alpha releases have been - made yet with those API functions. - - Scripts that are lax about the use of the l modifier in format and - scan will probably need to be rewritten. This should be very uncommon - though as previously it had absolutely no effect. - - Extensions that create new math functions that take more than one - argument will need to be recompiled (the size of Tcl_Value changes), - and functions that accept arguments of any type (TCL_EITHER) will need - to be rewritten to handle wide integer values. (I do not expect this - to affect many extensions at all.) - -2002-02-14 Andreas Kupries - - * generic/tclIOCmd.c (Tcl_GetsObjCmd): Trivial fix for [Bug 517503], a - memory leak reported by Miguel Sofer . The leak - happens if an error occurs for "set var [gets $chan]" and leak one - empty object. - -2002-02-12 David Gravereaux - - * djgpp/ (new directory) - * djgpp/Makefile (new): - * unix/tclAppInit.c: - * unix/tclMtherr.c: - * unix/tclUnixFCmd.c: - * unix/tclUnixFile.c: - * unix/tclUnixInit.c: - * unix/tclUnixPort.h: Early stage of DJGPP support for building Tcl - on DOS. Dynamic loading isn't working, yet. Requires watt32 for the - TCP/IP stack. No autoconf, yet. Barely tested, but makes a working exe - that runs Tcl in protected-mode, flat memory. [exec] and pipes will - need the most work as multi-tasking on DOS has to be carefully. - -2002-02-10 Kevin Kenny - - * doc/CrtObjCmd.3: - * doc/CrtTrace.3: - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclBasic.c: - * generic/tclInt.h: - * generic/tclTest.c: - * tests/basic.test: Added Tcl_CreateObjTrace, - Tcl_GetCommandInfoFromToken and Tcl_SetCommandInfoFromToken. - (TIPs #32 and #79.) - - * generic/tclDecls.h: - * generic/tclStubInit.c: Regenerated Stubs tables. - -2002-02-08 Jeff Hobbs - - * unix/configure: - * unix/tcl.m4: added -pthread for FreeBSD to EXTRA_CFLAGS and - LDFLAGS. Also triggered nodots only for FreeBSD-3. Added - AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) for Solaris. - - * unix/tclUnixPort.h: - * unix/tclUnixThrd.c: added thread-safe versions of readdir, - localtime, gmtime and inet_ntoa for threaded build. (jgdavidson) - - * generic/tclScan.c (Tcl_ScanObjCmd): prevented ckfree being called on - a pointer to NULL. - -2002-02-07 Don Porter - - * doc/DString.3: - * doc/Encoding.3: - * doc/GetCwd.3: - * doc/SplitPath.3: - * doc/Translate.3: - * doc/Utf.3: - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclEncoding.c: - * generic/tclEnv.c: - * generic/tclFileName.c: - * generic/tclIOUtil.c: - * generic/tclUtf.c: - * generic/tclUtil.c: - * mac/tclMacInit.c: - * unix/tclUnixFile.c: - * unix/tclUnixInit.c: - * unix/tclUnixPipe.c: - * win/tclWin32Dll.c: - * win/tclWinFCmd.c: - * win/tclWinFile.c: - * win/tclWinInit.c: Partial TIP 27 rollback. Following routines - restored to return (char *): Tcl_DStringAppend, - Tcl_DStringAppendElement, Tcl_JoinPath, Tcl_TranslateFileName, - Tcl_ExternalToUtfDString, Tcl_UtfToExternalDString, - Tcl_UniCharToUtfDString, Tcl_GetCwd, Tcl_WinTCharToUtf. Also restored - Tcl_WinUtfToTChar to return (TCHAR *) and Tcl_UtfToUniCharDString to - return (Tcl_UniChar *). Modified some callers. This change recognizes - that Tcl_DStrings are de-facto white-box objects. - - * generic/tclDecls.h: - * generic/tclPlatDecls.h: make genstubs - - * generic/tclCmdMZ.c: corrected use of C++-style comment. - -2002-02-06 Jeff Hobbs - - * tests/scan.test: - * generic/tclScan.c (Tcl_ScanObjCmd): corrected scan 0x... %x handling - that didn't accept the 0x as a prelude to a base 16 number. [Bug - 495213] - - * generic/tclCompCmds.c (TclCompileRegexpCmd): made early check for - bad RE to stop checking further. - - * generic/tclCmdMZ.c (Tcl_RegsubObjCmd): added special case to search - for simple 'string map' style regsub calls. Delayed creation of - resultPtr object until an initial match is made, as the input string - object can then be reused for no matches. - (Tcl_StringObjCmd): optimization improvements to the STR_MAP - algorithm for zero-length and nocase cases. - - * tests/regexp.test: - * tests/regexpComp.test: extra code coverage tests. - - * tests/string.test: added 10.18 and 10.19 extra tests. - - * generic/regc_locale.c (casecmp): slight performance improvement. - -2002-02-05 Don Porter - - * library/http/http.tcl: - * library/http/pkgIndex.tcl: Corrected use of http::error when - ::error was intended. Bump to http 2.4.2. - -2002-02-04 Andreas Kupries - - * unix/tclUnixChan.c (FileOutputProc): Fixed [bug 465765] reported by - Dale Talcott . Avoid writing - nothing into a file as STREAM based implementations will consider this - a EOF (if the file is a pipe). Not done in the generic layer as this - type of writing is actually useful to check the state of a socket. - - * doc/open.n: Fixed [Bug 511540], added cross-reference to 'pid' as - the command to use to retrieve the pid of a command pipeline created - via 'open'. - -2002-02-01 Jeff Hobbs - - * generic/tclCmdMZ.c (Tcl_RegexpObjCmd): handle quirky about case - earlier to avoid shimmering problem. - -2002-02-01 Andreas Kupries - - * tests/io.test: io-39.22 split into two tests, one platform - dependent, the other not. -eofchar is not empty on the windows - platform. - -2002-02-01 Vince Darley - - * generic/tclTest.c: fix to picky windows compiler problem with the - 'MainLoop' function declaration. - -2002-01-31 Andreas Kupries - - * win/tclWinFCmd.c: TIP 27: Applied patch fixing CONST warnings on - behalf of Don Porter . - -2002-01-30 Don Porter - - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclInt.h: For each interface identified in the TIP 27 - changes below as a POTENTIAL INCOMPATIBILITY, the source of the - incompatibility has been parameterized so that it can be removed. When - compiling extension code against the Tcl header files, use the - compiler flag -DUSE_NON_CONST to remove the irresolvable source - incompatibilities introduced by the TIP 27 changes. Resolvable changes - are left for extension authors to resolve. - * generic/tclDecls.h: make genstubs - -2002-01-30 Vince Darley - - * doc/FileSystem.3: added documentation for 3 public functions which - had been overlooked. [Bug 507701] - * unix/mkLinks: make mklinks - -2002-01-29 Jeff Hobbs - - * tests/regexpComp.test: - * generic/tclCompCmds.c (TclCompileRegexpCmd): enhanced to support - -nocase and -- options. - -2002-01-28 Mo DeJong - - * unix/tcl.m4 (SC_LOAD_TCLCONFIG): - * win/tcl.m4 (SC_LOAD_TCLCONFIG): Set TCL_LIB_SPEC, TCL_STUB_LIB_SPEC, - and TCL_STUB_LIB_PATH to the values of TCL_BUILD_LIB_SPEC, - TCL_BUILD_STUB_LIB_SPEC, and TCL_BUILD_STUB_LIB_PATH when tclConfig.sh - is loaded from the build directory. A Tcl extension should make use of - the non-build versions of these variables since they will work in both - cases. This modification was described in TIP 34. - -2002-01-28 Jeff Hobbs - - * win/tclWinReg.c (regConnectRegistryProc,RecursiveDeleteKey) - (DeleteKey,GetKeyNames,GetType,GetValue,OpenSubKey,SetValue): - redid the CONSTification as previous changes caused failing tests. - - * tests/regexpComp.test (new): - * generic/tclInt.h: - * generic/tclBasic.c: added TclCompileRegexpCmd entry - * generic/tclCompCmds.c (TclCompileStringCmd): corrected to return - TCL_OUT_LINE_COMPILE instead of TCL_ERROR for parsing errors, so - it only throws the error for runtime compile, in case the user - modifies 'string'. - (TclCompileRegexpCmd): first try at a byte-compiled regexp command. It - handles static strings and ^$ bounded static strings. - (TclCompileAppendCmd): made TclPushVarName call always use - TCL_CREATE_VAR as numWords is always > 2 at that point. - - * generic/tclExecute.c (TclExecuteByteCode:INST_LIST): correct - possibly dangerous decr in macro call. - - * win/tclWinInit.c (TclpFindVariable): CONSTification touch-up - - * win/tclWinReg.c (OpenSubKey): corrected bug introduced in - CONSTification that dropped pointer reference. - - * ChangeLog.2000 (new file): - * ChangeLog: broke changes from 2000 into ChangeLog.2000 to reduce - size of the main ChangeLog. - -2002-01-28 David Gravereaux - - * generic/tclPlatDecls.h: Added preprocessor logic to force a - typedef of TCHAR when __STDC__ is defined when using the uncommon - -Za compiler switch with the microsoft compiler. - -2002-01-27 Don Porter - - * doc/package.n: Documented global namespace context for script - evaluation by [package require]. - -2002-01-27 Daniel Steffen - - * generic/tclInt.decls: - * generic/tclIntPlatDecls.h: - * mac/tclMacChan.c: - * mac/tclMacFCmd.c: - * mac/tclMacFile.c: - * mac/tclMacInit.c: - * mac/tclMacLoad.c: - * mac/tclMacResource.c: - * mac/tclMacSock.c: TIP 27 CONSTification induced changes - - * tests/event.test: - * tests/main.test: added catches/constraints to test that - use features that don't exist on the mac. - -2002-01-25 Mo DeJong - - Make -eofchar and -translation options read only for server sockets. - [Bug 496733] - - * generic/tclIO.c (Tcl_GetChannelOption, Tcl_SetChannelOption): - Instead of returning nothing for the -translation option on a server - socket, always return "auto". Return the empty string enclosed in - quotes for the -eofchar option on a server socket. Fixup -eofchar - usage message so that it matches the implementation. - * tests/io.test: Add -eofchar tests and -translation tests to ensure - options are read only on server sockets. - * tests/socket.test: Update tests to account for -eofchar and - -translation option changes. - -2002-01-25 Don Porter - - * compat/strstr.c (strstr): - * generic/tclCmdAH.c (Tcl_FormatObjCmd): - * generic/tclCmdIL.c (InfoNameOfExecutableCmd): - * generic/tclEnv.c (ReplaceString): - * generic/tclFileName.c (ExtractWinRoot): - * generic/tclIO.c (FlushChannel,Tcl_BadChannelOption): - * generic/tclStringObj.c (AppendUnicodeToUtfRep): - * generic/tclThreadTest.c (TclCreateThread): - * generic/tclUtf.c (Tcl_UtfPrev): - * mac/tclMacFCmd.c (TclpObjListVolumes): - * mac/tclMacResource.c (TclMacRegisterResourceFork, - (BuildResourceForkList): - * win/tclWinInit.c (AppendEnvironment): Sought out and eliminated - instances of CONST-casting that are no longer needed after the - TIP 27 effort. - - * Following is [Patch 501006] - * generic/tclInt.decls (Tcl_AddInterpResolvers, Tcl_Export, - (Tcl_FindNamespace, Tcl_GetInterpResolvers, Tcl_ForgetImport, - (Tcl_Import, Tcl_RemoveInterpResolvers): - * generic/tclNamesp.c (Tcl_Export, Tcl_Import, Tcl_ForgetImport, - (Tcl_FindNamespace): - * generic/tclResolve.c (Tcl_AddInterpResolvers,Tcl_GetInterpResolvers, - (Tcl_RemoveInterpResolvers): Updated APIs in generic/tclResolve.c and - generic/tclNamesp.c according to the guidelines of TIP 27. - * generic/tclIntDecls.h: make genstubs - - * Following is [Patch 505630] - * doc/AddErrorInfo.3: - * generic/tcl.decls (Tcl_LogCommandInfo): - * generic/tclBasic.c (Tcl_LogCommandInfo): Updated interfaces - of generic/tclBasic.cc according to TIP 27. - * generic/tclDecls.h: make genstubs - - * Following is [Patch 506818] - * doc/Hash.3: - * generic/tcl.decls (Tcl_HashStats): - * generic/tclHash.c (Tcl_HashStats): Updated APIs of generic/tclHash.c - according to guidelines of TIP 27. - * generic/tclDecls.h: make genstubs - * generic/tclVar.c (Tcl_ArrayObjCmd): Updated callers. - - * Following is [Patch 506807] - * doc/ObjectType.3: - * generic/tcl.decls (Tcl_GetObjType): - * generic/tclObj.c (Tcl_GetObjType): Updated APIs of generic/tclObj.c - according to guidelines of TIP 27. - * generic/tclDecls.h: make genstubs - - * Following is [Patch 507304] - * doc/Encoding.3: - * generic/tcl.decls (Tcl_WinUtfToTChar,Tcl_WinTCharToUtf): - * win/tclWin32Dll.c (Tcl_WinUtfToTChar,Tcl_WinTCharToUtf): - Updated interfaces in win/tclWin32Dll.c according to TIP 27. - * generic/tclPlatDecls.h: make genstubs - * generic/tclIOUtil.c (TclpNativeToNormalized): - * win/tclWinFCmd.c (TclpObjNormalizePath): - * win/tclWinFile.c (TclpFindExecutable,TclpMatchInDirectory, - (NativeIsExec,NativeStat): - * win/tclWinLoad.c (TclpLoadFile): - * win/tclWinPipe.c (TclpOpenFile,ApplicationType): - * win/tclWinReg.c (regConnectRegistryProc,RecursiveDeleteKey,DeleteKey, - (GetKeyNames,GetType,GetValue,OpenSubKey,SetValue): - * win/tclWinSerial.c (SerialSetOptionProc): Update callers. - - * Following is [Patch 505072] - * doc/Concat.3: - * doc/Encoding.3: - * doc/Filesystem.3: - * doc/Macintosh.3: - * doc/OpenFileChnl.3 - * doc/SetResult.3: - * doc/SetVar.3: - * doc/SplitList.3: - * doc/SplitPath.3: - * doc/Translate.3: - * generic/tcl.h (Tcl_FSMatchInDirectoryProc): - * generic/tclInt.h (TclpMatchInDirectory): - * generic/tcl.decls (Tcl_Concat,Tcl_GetStringResult,Tcl_GetVar, - (Tcl_GetVar2,Tcl_JoinPath,Tcl_Merge,Tcl_OpenCommandChannel,Tcl_SetVar, - (Tcl_SetVar2,Tcl_SplitList,Tcl_SplitPath,Tcl_TranslateFileName, - (Tcl_ExternalToUtfDString,Tcl_GetEncodingName,Tcl_UtfToExternalDString, - (Tcl_GetDefaultEncodingDir,Tcl_SetDefaultEncodingDir, - (Tcl_FSMatchInDirectory,Tcl_MacEvalResource,Tcl_MacFindResource): - * generic/tclInt.decls (TclCreatePipeline,TclGetEnv,TclpGetCwd, - (TclpCreateProcess): - * mac/tclMacFile.c (TclpGetCwd): - * generic/tclEncoding.c (Tcl_GetDefaultEncodingDir, - (Tcl_SetDefaultEncodingDir,Tcl_GetEncodingName, - (Tcl_ExternalToUtfDString,Tcl_UtfToExternalDString, OpenEncodingFile, - (LoadEscapeEncoding): - * generic/tclFileName.c (DoTildeSubst,Tcl_JoinPath,Tcl_SplitPath, - (Tcl_TranslateFileName): - * generic/tclIOUtil.c (Tcl_FSMatchInDirectory): - * generic/tclPipe.c (FileForRedirect,TclCreatePipeline, - (Tcl_OpenCommandChannel): - * generic/tclResult.c (Tcl_GetStringResult): - * generic/tclUtil.c (Tcl_Concat,Tcl_SplitList,Tcl_Merge): - * generic/tclVar.c (Tcl_GetVar,Tcl_GetVar2,Tcl_SetVar,Tcl_SetVar2): - * mac/tclMacResource.c (Tcl_MacEvalResource,Tcl_MacFindResource): - Updated interfaces of generic/tclEncoding, generic/tclFilename.c, - generic/tclIOUtil.c, generic/tclPipe.c, generic/tclResult.c, - generic/tclUtil.c, generic/tclVar.c and mac/tclMacResource.c according - to TIP 27. Tcl_TranslateFileName rewritten as wrapper around VFS-aware - version. - ***POTENTIAL INCOMPATIBILITY*** - Includes source incompatibilities: argv arguments of Tcl_Concat, - Tcl_JoinPath, Tcl_OpenCommandChannel, Tcl_Merge; argvPtr arguments of - Tcl_SplitList and Tcl_SplitPath. - * generic/tclDecls.h: - * generic/tclIntDecls.h: make genstubs - - * generic/tclCkalloc.c (MemoryCmd): - * generic/tclClock.c (FormatClock): - * generic/tclCmdAH.c (Tcl_CaseObjCmd,Tcl_EncodingObjCmd,Tcl_FileObjCmd): - * generic/tclCmdIL.c (InfoLibraryCmd,InfoPatchLevelCmd, - (InfoTclVersionCmd): - * generic/tclCompCmds.c (TclCompileForeachCmd): - * generic/tclCompCmds.h (TclCompileForeachCmd): - * generic/tclCompile.c (TclFindCompiledLocal): - * generic/tclEnv.c (TclSetupEnv,TclSetEnv,Tcl_PutEnv,TclGetEnv, - (EnvTraceProc): - * generic/tclEvent.c (Tcl_BackgroundError): - * generic/tclIO.c (Tcl_BadChannelOption,Tcl_SetChannelOption): - * generic/tclIOCmd.c (Tcl_ExecObjCmd,Tcl_OpenObjCmd): - * generic/tclIOSock.c (TclSockGetPort): - * generic/tclIOUtil.c (SetFsPathFromAny): - * generic/tclLink.c (LinkTraceProc): - * generic/tclMain.c (Tcl_Main): - * generic/tclNamesp.c (TclTeardownNamespace): - * generic/tclProc.c (TclCreateProc): - * generic/tclTest.c (TestregexpObjCmd,TesttranslatefilenameCmd, - (TestchmodCmd,GetTimesCmd,TestsetCmd,TestOpenFileChannelProc1, - (TestOpenFileChannelProc2,TestOpenFileChannelProc3,AsyncHandlerProc, - (TestpanicCmd): - * generic/tclThreadTest.c (ThreadErrorProc,ThreadEventProc): - * generic/tclUtil.c (TclPrecTraceProc): - * mac/tclMacFCmd.c (GetFileSpecs): - * mac/tclMacFile.c (TclpMatchInDirectory): - * mac/tclMacInit.c (TclpInitLibraryPath,Tcl_SourceRCFile): - * mac/tclMacOSA.c (tclOSAStore,tclOSALoad): - * mac/tclMacResource.c (Tcl_MacEvalResource): - * unix/tclUnixFCmd.c (TclpObjNormalizePath): - * unix/tclUnixFile.c (TclpMatchInDirectory,TclpGetUserHome,TclpGetCwd, - (TclpReadLink): - * unix/tclUnixInit.c (TclpInitLibraryPath,TclpSetVariables, - (Tcl_SourceRCFile): - * unix/tclUnixPipe.c (TclpOpenFile,TclpCreateTempFile, - (TclpCreateProcess): - * win/tclWinFile.c (TclpGetCwd,TclpMatchInDirectory): - * win/tclWinInit.c (TclpInitLibraryPath,Tcl_SourceRCFile, - (TclpSetVariables): - * win/tclWinPipe.c (TclpCreateProcess): Updated callers. - -2002-01-24 Don Porter - - * generic/tclIOUtil.c (SetFsPathFromAny): Corrected tilde-substitution - of pathnames where > 1 separator follows the ~. [Bug 504950] - -2002-01-24 Jeff Hobbs - - * library/http/pkgIndex.tcl: - * library/http/http.tcl: don't add port in default case to handle - broken servers. http bumped to 2.4.1 [Bug 504508] - -2002-01-23 Andreas Kupries - - * unix/mkLinks: Regenerated. - * doc/CrtChannel.3: - * doc/ChnlStack.3: Moved documentation for 'Tcl_GetTopChannel' from - 'CrtChannel' to 'ChnlStack'. Added documentation of - 'Tcl_GetStackedChannel'. [Bug 506147] reported by Mark Patton - . - -2002-01-23 Don Porter - - * win/tclWinFile.c (NativeAccess,NativeStat,NativeIsExec, - (TclpGetUserHome): - * win/tclWinPort.h (TclWinSerialReopen): - * win/tclWinSerial.c (TclWinSerialReopen): - * win/tclWinSock.c (Tcl_OpenTcpServer): Corrections to earlier TIP 27 - changes. Thanks to Andreas Kupries for the feedback. - * generic/tclPlatDecls.h: make genstubs - - * doc/GetHostName.3: - * doc/GetOpnFl.3: - * doc/OpenTcp.3: - * tcl.decls (Tcl_GetHostName,Tcl_GetOpenFile,Tcl_OpenTcpClient, - (Tcl_OpenTclServer): - * mac/tclMacSock.c (CreateSocket,Tcl_OpenTcpClient,Tcl_OpenTcpServer, - (Tcl_GetHostName,GetHostFromString): - * unix/tclUnixChan.c (CreateSocket,CreateSocketAddress, - (Tcl_OpenTcpClient,Tcl_OpenTcpServer,Tcl_GetOpenFile): - * unix/tclUnixSock.c (Tcl_GetHostName): - * win/tclWinSock.c (CreateSocket,CreateSocketAddress, - (Tcl_OpenTcpClient,Tcl_OpenTcpServer,Tcl_GetHostName): - Updated socket interfaces according to TIP 27. - * generic/tclCmdIL.c (InfoHostnameCmd): Updated callers. - * generic/tclDecls.h: make genstubs - -2002-01-21 David Gravereaux - - * generic/tclLoadNone.c: TclpLoadFile() didn't match proto of typedef - Tcl_FSLoadFileProc. OK'd by vincentdarley. [Patch 502488] - -2002-01-21 Andreas Kupries - - * generic/tclIO.c (WriteChars): Fix for [Bug 506297], reported by - Martin Forssen . The encoding chosen in - the script exposing the bug writes out three intro characters when - TCL_ENCODING_START is set, but does not consume any input as - TCL_ENCODING_END is cleared. As some output was generated the - enclosing loop calls UtfToExternal again, again with START set. Three - more characters in the out and still no use of input ... To break this - infinite loop we remove TCL_ENCODING_START from the set of flags after - the first call (no condition is required, the later calls remove an - unset flag, which is a no-op). This causes the subsequent calls to - UtfToExternal to consume and convert the actual input. - -2002-01-21 Don Porter - - * generic/tclTest.c: Converted declarations of TestReport file system - to more portable form. [Bug 501417] - - * generic/tcl.decls (Tcl_TraceCommand,Tcl_UntraceCommand, - (Tcl_CommandTraceInfo): - * generic/tclCmdMZ.c (Tcl_TraceCommand,Tcl_UntraceCommand, - (Tcl_CommandTraceInfo): Updated APIs in generic/tclCmdMZ.c according - to the guidelines of TIP 27. - * generic/tclDecls.h: make genstubs - -2002-01-18 Don Porter - - * win/tclWinChan.c: - * win/tclWinFCmd.c: - * win/tclWinFile.c: Overlooked callers of Tcl_FSGetNativePath - - * win/tclWinDde.c: - * win/tclWinReg.c: Overlooked callers of Tcl_GetIndexFromObj - -2002-01-18 Daniel Steffen - - * generic/tclThreadTest.c: - * mac/tclMacChan.c: - * mac/tclMacFCmd.c: - * mac/tclMacFile.c: - * mac/tclMacLoad.c: - * mac/tclMacResource.c: TIP 27 CONSTification broke the mac build in a - number of places. - -2002-01-17 Andreas Kupries - - * generic/tclIOCmd.c (Tcl_GetsObjCmd): Fixed [Bug 504642] as reported - by Brian Griffin , using his - patch. Before the patch the generic I/O layer held an unannounced - reference to the interp result to store the read line into. This - unfortunately has disastrous results if the channel driver executes a - tcl script to perform its operation, this freeing the interp - result. In that case we are dereferencing essentially a dangling - reference. It is not truly dangling because the object is in the free - list, but this only causes us to smash the free list and have the - error occur later somewhere else. The patch simply creates a new - object for the line and later sets it into the interp result when we - are done with reading. - -2002-01-16 Mo DeJong - - * unix/tcl.m4 (SC_LOAD_TCLCONFIG): - * win/tcl.m4 (SC_LOAD_TCLCONFIG): Subst TCL_DBGX into - TCL_STUB_LIB_FILE and TCL_STUB_LIB_FLAG variables so that an extension - does not need to subst TCL_DBGX into its makefile. [Tk Bug 504356] - -2002-01-16 Don Porter - - * doc/FileSystem.3: - * doc/GetCwd.3: - * doc/GetIndex.3: - * generic/tcl.decls (Tcl_GetIndexFromObj, Tcl_GetIndexFromObjStruct, - (Tcl_GetCwd, Tcl_FSFileAttrStrings, Tcl_FSGetNativePath, - (Tcl_FSGetTranslatedStringPath): - * generic/tcl.h (Tcl_FSFileAttrStringsProc): - * generic/tclFCmd.c (TclFileAttrsCmd): - * generic/tclIOUtil.c (Tcl_GetCwd,NativeFileAttrStrings, - (Tcl_FSFileAttrStrings,Tcl_FSGetTranslatedStringPath, - (Tcl_FSGetNativePath): - * generic/tclIndexObj.c (Tcl_GetIndexFromObj, - (Tcl_GetIndexFromObjStruct): - More TIP 27 updates in tclIOUtil.c and tclIndexObj.c that were - overlooked before. [Patch 504671] - ***POTENTIAL INCOMPATIBILITY*** - Includes a source incompatibility in the tablePtr arguments of the - Tcl_GetIndexFromObj* routines. - * generic/tclDecls.h: make genstubs - - * generic/tclBinary.c (Tcl_BinaryObjCmd): - * generic/tclClock.c (Tcl_ClockObjCmd): - * generic/tclCmdAH.c (Tcl_EncodingObjCmd, Tcl_FileObjCmd): - * generic/tclCmdIL.c (Tcl_InfoObjCmd,Tcl_LsearchObjCmd,Tcl_LsortObjCmd): - * generic/tclCmdMZ.c (Tcl_TraceObjCmd,Tcl_RegexpObjCmd,Tcl_RegsubObjCmd, - (Tcl_StringObjCmd,Tcl_SubstObjCmd,Tcl_SwitchObjCmd, - (TclTraceCommandObjCmd,TclTraceVariableObjCmd): - * generic/tclCompCmds.c (TclCompileStringCmd): - * generic/tclEvent.c (Tcl_UpdateObjCmd): - * generic/tclFileName.c (Tcl_GlobObjCmd): - * generic/tclIO.c (Tcl_FileEventObjCmd): - * generic/tclIOCmd.c (Tcl_SeekObjCmd,Tcl_ExecObjCmd,Tcl_SocketObjCmd, - (Tcl_FcopyObjCmd): - * generic/tclInterp.c (Tcl_InterpObjCmd,SlaveObjCmd): - * generic/tclNamesp.c (Tcl_NamespaceObjCmd): - * generic/tclPkg.c (Tcl_PackageObjCmd): - * generic/tclTest.c (Tcltest_Init,TestencodingObjCmd,TestgetplatformCmd, - (TestlocaleCmd,TestregexpObjCmd,TestsaveresultCmd, - (TestGetIndexFromObjStructObjCmd,TestReportFileAttrStrings): - * generic/tclTestObj.c (TestindexObjCmd,TeststringObjCmd): - * generic/tclTimer.c (Tcl_AfterObjCmd): - * generic/tclVar.c (Tcl_ArrayObjCmd): - * mac/tclMacFCmd.c (SetFileFinderAttributes): - * unix/tclUnixChan.c (TclpOpenFileChannel): - * unix/tclUnixFCmd.c (tclpFileAttrStrings): - * unix/tclUnixFile.c (TclpObjAccess,TclpObjChdir,TclpObjStat, - (TclpObjLstat): - * win/tclWinFCmd.c (tclpFileAttrStrings): Updated callers. - - * doc/RegExp.3: - * doc/Utf.3: - * generic/tcl.decls: - * generic/tclInt.decls: - * generic/tclRegexp.c: - * generic/tclUtf.c: Updated APIs in generic/tclUtf.c and - generic/tclRegexp.c according to the guidelines of TIP 27. - [Patch 471509] - - * generic/regc_locale.c (element,cclass): - * generic/tclCmdMZ.c (Tcl_StringObjCmd): - * generic/tclFileName.c (TclpGetNativePathType,SplitMacPath): - * generic/tclIO.c (ReadChars): - * mac/tclMacLoad.c (TclpLoadFile): - * win/tclWinFile.c (TclpGetUserHome): Updated callers. - - * generic/tclDecls.h: - * generic/tclIntDecls.h: make genstubs - - * doc/ParseCmd.3 (Tcl_ParseVar): - * generic/tcl.decls (Tcl_ParseVar): - * generic/tclParse.c (Tcl_ParseVar): - * generic/tclTest.c (TestparsevarObjCmd): Updated APIs in - generic/tclParse.c according to the guidelines of TIP 27. Updated - callers. [Patch 501046] - * generic/tclDecls.h: make genstubs - - * generic/tcl.decls (Tcl_RecordAndEval): - * generic/tclDecls.h: make genstubs - * generic/tclHistory.c (Tcl_RecordAndEval): Updated APIs in - generic/tclHistory.c according to the guidelines of TIP 27. - [Patch 504091] - - * doc/CrtSlave.3: - * generic/tcl.decls (Tcl_CreateAlias, Tcl_CreateAliasObj, - (Tcl_CreateSlave, Tcl_GetAlias, Tcl_GetAliasObj, Tcl_GetSlave): - * generic/tclInterp.c (Tcl_CreateAlias, Tcl_CreateAliasObj, - (Tcl_CreateSlave, Tcl_GetAlias, Tcl_GetAliasObj, Tcl_GetSlave): - Updated APIs in the file generic/tclInterp.c according to the - guidelines of TIP 27. [Patch 501371] - ***POTENTIAL INCOMPATIBILITY*** - Includes a source incompatibility in the targetCmdPtr arguments of the - Tcl_GetAlias* routines. - - * generic/tclDecls.h: make genstubs - -2002-01-15 Don Porter - - * doc/SetErrno.3 (Tcl_ErrnoMsg): Corrected documentation for - Tcl_ErrnoMsg; it takes an integer argument. Thanks to Georgios - Petasis. [Bug 468183] - - * doc/AddErrInfo.3 (Tcl_PosixError): - * doc/Eval.3 (Tcl_EvalFile): - * doc/FileSystem.c (Tcl_FSOpenFileChannel,Tcl_FSOpenFileChannelProc): - * doc/OpenFileChnl.3 (Tcl_OpenFileChannel): - * doc/SetErrno.3 (Tcl_ErrnoId,Tcl_ErrnoMsg): - * doc/Signal.3 (Tcl_SignalId,Tcl_SignalMsg): - * generic/tcl.decls (Tcl_ErrnoId,TclErrnoMsg,Tcl_EvalFile, - (Tcl_OpenFileChannel,Tcl_PosixError,Tcl_SignalId,Tcl_SignalMsg, - (Tcl_FSOpenFileChannel): - * generic/tcl.h (Tcl_FSOpenFileChannelProc): - * generic/tclIO.c (FlushChannel): - * generic/tclIOUtil.c (Tcl_OpenFileChannel,Tcl_EvalFile,TclGetOpenMode, - (Tcl_PosixError,Tcl_FSOpenFileChannel): - * generic/tclInt.decls (TclGetOpenMode): - * generic/tclInt.h (TclOpenFileChannelProc_,TclGetOpenMode, - (TclpOpenFileChannel): - * generic/tclPipe.c (TclCleanupChildren): - * generic/tclPosixStr.c (Tcl_ErrnoId,Tcl_ErrnoMsg,Tcl_SignalId, - (Tcl_SignalMsg): - * generic.tclTest.c (PretendTclpOpenFileChannel, - (TestOpenFileChannelProc1,TestOpenFileChannelProc2, - (TestOpenFileChannelProc3,TestReportOpenFileChannel): - * mac/tclMacChan.c (TclpOpenFileChannel): - * unix/tclUnixChan.c (TclpOpenFileChannel): - * win/tclWinChan.c (TclpOpenFileChannel): Updated APIs in - generic/tclIOUtil.c and generic/tclPosixStr.c according to the - guidelines of TIP 27. Updated callers. [Patch 499196] - - * generic/tclDecls.h: - * generic/tclIntDecls.h: make genstubs - - * doc/CrtChannel.3: - * doc/OpenFileChnl.3: - * generic/tcl.decls: - * generic/tclIO.h: - * generic/tclIO.c (DoWrite, Tcl_RegisterChannel, Tcl_GetChannel, - (Tcl_CreateChannel, Tcl_GetChannelName, CloseChannel, Tcl_Write, - (Tcl_WriteRaw, Tcl_Ungets, Tcl_BadChannelOption, Tcl_GetChannelOption, - (Tcl_SetChannelOption, Tcl_GetChannelNamesEx, Tcl_ChannelName): - Updated APIs in the file generic/tclIO.c according to the guidelines - of TIP 27. Several minor documentation corrections as well. - [Patch 503565] - * generic/tclDecls.h: make genstubs - - * generic/tcl.h (Tcl_DriverOutputProc, Tcl_DriverGetOptionProc, - (Tcl_DriverSetOptionProc): - * generic/tclIOGT.c (TransformOutputProc, TransformGetOptionProc, - (TransformSetOptionProc): - * mac/tclMacChan.c (FileOutput, StdIOOutput): - * man/tclMacSock.c (TcpGetOptionProc, TcpOutput): - * unix/tclUnixChan.c (FileOutputProc, TcpGetOptionProc, TcpOutputProc, - (TtyGetOptionProc, TtySetOptionProc): - * unix/tclUnixPipe.c (PipeOuputProc): - * win/tclWinChan.c (FileOutputProc): - * win/tclWinConsole.c (ConsleOutputProc): - * win/tclWinPipe.c (PipeOuputProc): - * win/tclWinSerial.c (SerialOutputProc, SerialGetOptionProc, - (SerialSetOptionProc): - * win/tclWinSock.c (TcpGetOptionProc, TcpOutput): Updated channel - driver interface according to the guidelines of TIP 27. See also - [Bug 500348]. - - * doc/CrtChannel.3: - * generic/tcl.h: - * generic/tclIO.c: - * generic/tclIO.h: - * generic/tclInt.h: - * tools/checkLibraryDoc.tcl: - Moved Tcl_EolTranslation enum declaration from generic/tcl.h to - generic/tclInt.h (renamed to TclEolTranslation). It is not used - anywhere in Tcl's public interface. - -2002-01-14 Don Porter - - * doc/GetIndex.3: - * doc/WrongNumArgs.3: - * generic/tcl.decls (Tcl_GetIndexFromObj, Tcl_GetIndexFromObjStruct, - (Tcl_WrongNumArgs): - * generic/tclIndexObj.c (Tcl_GetIndexFromObj,Tcl_GetIndexFromObjStruct, - (Tcl_WrongNumArgs): Updated APIs in the file generic/tclIndexObj.c - according to the guidelines of TIP 27. [Patch 501491] - * generic/tclDecls.h: make genstubs - -2002-01-11 Mo DeJong - - * unix/configure: Regen. - * unix/configure.in: - * win/configure: Regen. - * win/configure.in: Use ${libdir} instead of ${exec_prefix}/lib - to properly support the --libdir option to configure. [Bug 489370] - -2002-01-11 Andreas Kupries - - * win/tclWinSerial.c (SerialSetOptionProc): Applied patch for [Bug - 500348] supplied by Rolf Schroedter . The - function modified the contents of the the 'value' string and now does - not do this anymore. This is a followup to the change made on - 2001-12-17. - -2002-01-11 David Gravereaux - - * win/makefile.vc: Removed -GD compiler option. It was intended for - future use, but MS is again changing the future at their whim. The - D4002 warning was harmless though, but someone using VC .NET logged it - as a concern. [Bug 501565] - -2002-01-11 Mo DeJong - - * unix/Makefile.in: Burn Tcl build directory into tcltest executable - to avoid crashes caused by ld loading a previously installed version - of the tcl shared library. [Bug 218110] - -2002-01-10 Don Porter , - Kevin Kenny - - * unix/tclLoadDld.c (TclpLoadFile): syntax error: unbalanced parens. - Kevin notes that it's far from clear that this file is ever included - in an actual build; Linux without dlopen appears to be a nonexistent - configuration. - -2002-01-08 Don Porter , - Kevin Kenny - - * doc/StaticPkg.3 (Tcl_StaticPackage): - * generic/tcl.decls (Tcl_StaticPackage): - * generic/tclDecls.h (Tcl_StaticPackage): - * generic/tclInt.decls (TclGuessPackageName): - * generic/tclInt.h (TclGuessPackageName): - * generic/tclLoad.c (Tcl_StaticPackage): - * generic/tclLoadNone.c (TclGuessPackageName): - * mac/tclMacLoad.c (TclGuessPackageName): - * unix/tclLoadAout.c (TclGuessPackageName): - * unix/tclLoadDl.c (TclGuessPackageName): - * unix/tclLoadDld.c (TclGuessPackageName): - * unix/tclLoadDyld.c (TclGuessPackageName): - * unix/tclLoadNext.c (TclGuessPackageName): - * unix/tclLoadOSF.c (TclGuessPackageName): - * unix/tclLoadShl.c (TclGuessPackageName): - * win/tclWinLoad.c (TclGuessPackageName): Updated APIs in the files - */tcl*Load*.c according to the guidelines of TIP 27. [Patch 501096] - -2002-01-09 Don Porter - - * generic/tclTest.c (MainLoop): - * tests/main.test (Tcl_Main-1.{3,4,5,6}): Corrected some non-portable - tests from the new Tcl_Main changes. Thanks to Kevin Kenny. - -2002-01-07 Don Porter - - * generic/tclEvent.c (TclInExit): - * generic/tclIOUtil.c (SetFsPathFromAbsoluteNormalized, - (SetFsPathFromAny,Tcl_FSNewNativePath,DupFsPathInternalRep): - * generic/tclListObj.c (TclLsetList,TclLsetFlat): Added some type - casts to satisfy picky compilers. - - * generic/tclMain.c: Bug fix: neglected the NULL case in - TclGetStartupScriptFileName(). Broke Tk/wish. - -2002-01-05 Don Porter - - * doc/Tcl_Main.3: - * generic/tclMain.c: Substantial rewrite and expanded documentation - of Tcl_Main to correct a number of bugs and flaws: - - - Interactive Tcl_Main can now enter a main loop, exit that loop and - continue interactive operations. The loop may even exit in the - midst of interactive command typing without loss of the partial - command. [Bugs 486453, 474131] - - Tcl_Main now gracefully handles deletion of its master - interpreter. - - Interactive Tcl_Main can now operate with non-blocking stdin - - Interactive Tcl_Main can now detect EOF on stdin even in - mid-command. [Bug 491341] - - Added VFS-aware internal routines for managing the startup script - selection. - - Tcl variable 'tcl_interactive' is now linked to C variable 'tty' - so that one can disable/enable interactive prompts at the script - level when there is no startup script. This is meant for use by - the test suite. - - Consistent use of the Tcl libraries standard channels as returned - by Tcl_GetStdChannel(); as opposed to the channels named 'stdin', - 'stdout', and 'stderr' in the master interp, which can be - different or unavailable. - - Tcl_Main now calls Tcl_Exit() if evaluation of [exit] in the - master interpreter returns, assuring Tcl_Main does not return. - - Documented Tcl_Main's absence from public stub table - - Documented that Tcl_Main does not return. - - Documented Tcl variables set by Tcl_Main. - - All prompts are done from a single procedure, Prompt. - - Use of Tcl_Obj-enabled interfaces everywhere. - - * generic/tclInt.decls (TclGetStartupScriptPath, - (TclSetStartupScriptPath): New internal VFS-aware routines for - managing the startup script of Tcl_Main. - * generic/tclIntDecls.h: - * generic/tclStubInit.c: make genstubs - - * generic/tclTest.c (TestsetmainloopCmd,TestexitmainloopCmd, - (Tcltest_Init,TestinterpdeleteCmd): - * tests/main.test (new): Added new file to test suite that thoroughly - tests generic/tclMain.c; added some new test commands for testing - Tcl_SetMainLoop(). - -2002-01-04 Don Porter - - * doc/Alloc.3: - * doc/Concat.3: - * doc/CrtMathFnc.3: - * doc/Hash.3: - * doc/Interp.3: - * doc/LinkVar.3: - * doc/ObjectType.3: - * doc/PkgRequire.3: - * doc/Preserve.3: - * doc/SetResult.3: - * doc/SplitList.3: - * doc/SplitPath.3: - * doc/TCL_MEM_DEBUG.3: Updated documentation to describe the ckalloc, - ckfree, ckrealloc, attemptckalloc, and attemptckrealloc macros, and - to accurately describe when and how they are used. [Bug 497459] - - * generic/tclThreadJoin.c (TclRememberJoinableThread,TclJoinThread): - Replaced Tcl_Alloc and Tcl_Free calls with ckalloc and ckfree so that - memory debugging is supported. - -2002-01-04 Daniel Steffen - - * mac/tclMacTime.c (TclpGetTZName): fix for daylight savings TZName bug - -2002-01-03 Don Porter - - * doc/FileSystem.3: - * generic/tclIOUtil.c: Updated some old uses of "fileName" to - new VFS terminology, "pathPtr". - -2002-01-03 Donal K. Fellows - - * tests/basic.test (basic-39.4): Greatly simplified test while - still leaving it so that it crashes when run without the fix to - the [foreach] implementation. - * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Stopped [Bug 494348] from - happening by not trying to be so clever with cacheing; if nothing - untoward is happening anyway, the less efficient technique will - only add a few instruction cycles (one function call and a few - derefs/assigns per list per iteration, with no change in the - number of tests) and if something odd *is* going on, the code is - now far more robust. - - * tests/basic.test (basic-39.4): Reproducable script from [Bug 494348] - -2002-01-02 Donal K. Fellows - - * tests/util.test (Wrapper_Tcl_StringMatch,util-5.*): Rewrote so the - test is performed with the right internal function since [string - match] no longer uses Tcl_StringCaseMatch internally. - - * tests/string.test (string-11.51): - * generic/tclUtf.c (Tcl_UniCharCaseMatch): - * generic/tclUtil.c (Tcl_StringCaseMatch): Fault with matching - case-insensitive non-ASCII patterns containing upper case characters. - [Bug 233257] - - ****************************************************************** - *** CHANGELOG ENTRIES FOR 2001 IN "ChangeLog.2001" *** - *** CHANGELOG ENTRIES FOR 2000 IN "ChangeLog.2000" *** - *** CHANGELOG ENTRIES FOR 1999 AND EARLIER IN "ChangeLog.1999" *** - ****************************************************************** diff --git a/ChangeLog.2003 b/ChangeLog.2003 deleted file mode 100644 index 3c3ee11..0000000 --- a/ChangeLog.2003 +++ /dev/null @@ -1,3349 +0,0 @@ -2003-12-25 Mo DeJong - - * win/tclWin32Dll.c (DllMain): Add HAVE_NO_SEH blocks in place of - __try and __except statements to support gcc builds. This is needed - after David's changes on 2003-12-21. [Patch 858493] - -2003-12-23 David Gravereaux - - * generic/tclAlloc.c: All uses of 'panic' (the macro) changed to - * generic/tclBasic.c: 'Tcl_Panic' (the function). The #define of - * generic/tclBinary.c: panic in tcl.h clearly states it is deprecated - * generic/tclCkalloc.c: in the comments. [Patch 865264] - * generic/tclCmdAH.c: - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclCompCmds.c: - * generic/tclCompExpr.c: - * generic/tclCompile.c: - * generic/tclConfig.c: - * generic/tclDictObj.c: - * generic/tclEncoding.c: - * generic/tclEvent.c: - * generic/tclExecute.c: - * generic/tclHash.c: - * generic/tclInterp.c: - * generic/tclIO.c: - * generic/tclIOCmd.c: - * generic/tclIOUtil.c: - * generic/tclListObj.c: - * generic/tclLiteral.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclParse.c: - * generic/tclPathObj.c: - * generic/tclPkg.c: - * generic/tclPreserve.c: - * generic/tclProc.c: - * generic/tclStringObj.c: - * generic/tclTest.c: - * generic/tclThreadAlloc.c: - * generic/tclTimer.c: - * generic/tclTrace.c: - * generic/tclVar.c: - * mac/tclMacChan.c: - * mac/tclMacOSA.c: - * mac/tclMacResource.c: - * mac/tclMacSock.c - * mac/tclMacThrd.c: - * unix/tclUnixChan.c: - * unix/tclUnixNotfy.c: - * unix/tclUnixThrd.c: - * unix/tclXtNotify.c: - * win/tclWin32Dll.c: - * win/tclWinChan.c: - * win/tclWinFCmd.c: - * win/tclWinNotify.c: - * win/tclWinPipe.c: - * win/tclWinSock.c: - * win/tclWinThrd.c: - - * generic/tclInt.h: Deprecated use of Tcl_Ckalloc changed to - Tcl_Alloc in the TclAllocObjStorage macro. - -2003-12-22 David Gravereaux - - * win/nmakehlp.c: - * win/rules.vc: New feature for extensions that use rules.vc. Now - reads header files for version strings. No more hard coding - TCL_VERSION = 8.5 and having to edit it when you swap cores. - - * win/makefile.vc: VERSION macro now set by reading tcl.h for it. - - * generic/tcl.h: Removed note that makefile.vc needs to have a version - number changed. - -2003-12-21 David Gravereaux - - * win/tclWin32Dll.c: Structured Exception Handling added around - Tcl_Finalize called from DllMain's DLL_PROCESS_DETACH. We can't be - 100% assured that Tcl is being unloaded by the OS in a stable - condition and we need to protect the exit handlers should the stack be - in a hosed state. AT&T style assembly for SEH under MinGW has not been - added yet. This is a first part change for [Patch 858493] - -2003-12-17 Daniel Steffen - - * generic/tclBinary.c (DeleteScanNumberCache): fixed crashing bug when - numeric scan-value cache contains NULL value. - -2003-12-17 Vince Darley - - * generic/tclCmdAH.c: - * unix/tclUnixFile.c: - * win/tclWinFCmd.c: - * tests/fCmd.test: - * tests/fileSystem.test: - * doc/file.n: final fix to support for relative links and its - implications on normalization and other parts of the filesystem code. - Fixes [Bug 859251] and some Windows problems with recursive file - delete/copy and symbolic links. - -2003-12-17 Vince Darley - - * generic/tclPathObj.c: - * tests/fileSystem.test: fix and tests for [Bug 860402] in new file - normalization code. - -2003-12-17 Zoran Vasiljevic - - * generic/tclIOUtil.c: fixed 2 memory (object) leaks. [Bug 839519] - - * generic/tclPathObj.c: fixed Tcl_FSGetTranslatedPath to always return - properly refcounted path object. [Bug 861515] - -2003-12-16 Vince Darley - - * tests/fCmd.test: marking fCmd-9.14.2, as nonPortable, since on - Solaris one can change the name of the current directory with 'file - rename'. - * doc/FileSystem.3: clarified documentation on ownership of return - objects/strings of some Tcl_FS* calls. - -2003-12-16 Donal K. Fellows - - * generic/tclThreadAlloc.c (binfo): Made variable file-local. - -2003-12-15 David Gravereaux - - * win/tcl.rc: - * win/tclsh.rc: Slight modification to the STRINGIFY macro to support - Borland's rc tool. - - * win/tclWinFile.c (TclpUtime) : utimbuf struct not a problem with - Borland. - - * win/tclWinTime.c (TclpGetDate) : Borland's localtime() has a slight - behavioral difference. - - From Helmut Giese [Patch 758097]. - -2003-12-14 David Gravereaux - - * generic/tclInt.decls: commented-out entry for TclpCheckStackSpace, - removing it from the Stubs table. It's already declared in tclInt.h - and labeled as a function that is not to be exported. Regened tables. - -2003-12-14 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): TIP#75 Implementation - * tests/switch.test: Can now get submatch information when using - * doc/switch.n: -regexp matching in [switch]. - -2003-12-14 Vince Darley - - * generic/tclPathObj.c: complete rewrite of generic file normalization - code to cope with links followed by '..'. [Bug 849514], and parts of - [Bug 859251] - -2003-12-12 David Gravereaux - - * win/tclWinChan.c: Win32's SetFilePointer() takes LONGs not DWORDs (a - signed/unsigned mismatch). Redid local vars to avoid all casting - except where truly required. - -2003-12-12 Vince Darley - - * generic/tclCmdAH.c: fix to normalization of non-existent user name - ('file normalize ~nobody') [Bug 858937] - * doc/file.n: clarify behaviour of 'file link' when the target is not - an absolute path. - * doc/filename.n: correct documentation to say that Windows Tcl does - handle '~user', for recent Windows releases, and clarified distinction - between MacOS 'classic' and MacOS X. - * doc/glob.n: clarification of glob's behaviour when returning - filenames starting with a '~'. - - * tests/fileSystem.test: - * tests/fileName.test: new tests added for the normalization problem - above and other recentlt reported issues. - - * win/tclWinFile.c: corrected unclear comments - - * unix/tclUnixFile.c: allow creation of relative links. [Bug 833713] - -2003-12-11 David Gravereaux - - * win/tclWinSock.c (SocketThreadExitHandler) : added a TerminateThread - fallback just in case the socket handler thread is really in a paused - state. This can happen when Tcl is being unloaded by the OS from an - exception handler. See MSDN docs on DllMain, it states this behavior. - -2003-12-09 Jeff Hobbs - - * unix/configure: - * unix/tcl.m4: updated OpenBSD build configuration based on - [Patch #775246] (cassoff) - -2003-12-09 Donal K. Fellows - - * unix/tclUnixPort.h: #ifdef'd out declarations of errno which are - * tools/man2tcl.c: known to cause problems with recent glibc. - [Bug 852369] - -2003-12-09 Vince Darley - - * win/tclWinFile.c: fix to NT file permissions code [Bug 855923] - * tests/winFile.test: added tests for NT file permissions - patch and - test scripts supplied by Benny. - - * tests/winFCmd.test: fixed one test for when not running in C:/ - -2003-12-02 Donal K. Fellows - - * generic/tclBinary.c (DeleteScanNumberCache, ScanNumber): Made the - numeric scan-value cache have proper references to the objects within - it so strange patterns of writes won't cause references to freed - objects. Thanks to Paul Obermeir for the report. [Bug 851747] - -2003-12-01 Miguel Sofer - - * doc/lset.n: fix typo [Bug 852224] - -2003-11-24 Don Porter - - * generic/tclParse.c: Corrected faulty check for trailing white - space in {expand} parsing. Thanks Andreas Leitgeb. [Bug 848262] - * tests/parse.test: New tests for the bug. - -2003-11-24 Vince Darley - - * generic/tclPathObj.c: fix to [Bug 845778] - Infinite recursion on - [cd] (Windows only bug), for which new tests have just been added. - -2003-11-21 Don Porter - - * tests/winFCmd.test (winFCmd-16.10,11): Merged new tests from - core-8-4-branch. - -2003-11-20 Miguel Sofer - - * generic/tclVar.c: fix flag bit collision between LOOKUP_FOR_UPVAR - and TCL_PARSE_PART1 (deprecated) [Bug 835020] - -2003-11-19 Don Porter - - * tests/compile.test (compile-16.22.0): Improved test for the recent - fix for Bug 845412. - -2003-11-19 Donal K. Fellows - - * generic/tclCompile.c (TclCompileScript): Added a guard for the - expansion code so that long non-expanding commands don't get expansion - infrastructure inserted in them, especially when that infrastructure - isn't initialised. [Bug 845412] - -2003-11-18 David Gravereaux - - * contrib/djgpp/Makefile: Changes from Victor Wagner - * contrib/djgpp/langinfo.c (new): for better - * contrib/djgpp/langinfo.h (new): DJGPP support. - * unix/tclUnixInit.c: . - * unix/tclUnixChan.c: . - * unix/tclUnixFCmd.c: . - -2003-11-17 Don Porter - - * tests/reg.test: Added tests for [Bugs 230589, 504785, 505048, 840258] - recently fixed by 2003-11-15 commit to regcomp.c by Pavel Goran. His - notes on the fix: This bug results from an error in code that splits - states into "progress" and "no-progress" ones. This error causes an - interesting situation with the pre-collected single-linked list of - states to be splitted: many items were added to the list, but only - several of them are accessible from the list beginning, since the - "tmp" member of struct state (which is used here to hold a pointer to - the next list item) gets overwritten, which results in a "looped" - chain. As a result, not all of states are splitted, and one state is - splitted two times, causing incorrect "no-progress" flag values. - -2003-11-16 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Make sure that - Tcl_AsyncInvoke is called regularly when processing bytecodes. - * generic/tclTest.c (AsyncThreadProc, TestasyncCmd): Extended testing - harness to send an asynchronous marking without relying on UNIX - signals. - * tests/async.test (async-4.*): Tests to check that async events are - handled by the bytecode core. [Bug 746722] - -2003-11-15 Donal K. Fellows - - * generic/tclTest.c (TestHashSystemHashCmd): Removed 'const' modifier - from hash type structure; it should be const and the hash code assumes - it behaves like const, but that's not how the API is defined. Like - this, we are following in the same footsteps as Tcl_RegisterObjType() - which has the same conditions on its argument. Stops VC++5.2 warning. - [Bug 842511] - -2003-11-14 Donal K. Fellows - - * generic/tclHash.c (Tcl_DeleteHashTable,Tcl_HashStats,RebuildTable): - * generic/tclTest.c (TestHashSystemHashCmd): TIP#138 implementation, - * tests/misc.test: plus a new chunk of stuff to test the hash - functions more thoroughly in the test suite. - [Patch 731356, modified] - - * doc/Tcl.n: Updated Tcl version number and changebars. - -2003-11-14 Don Porter - - * doc/ParseCmd.3: Implementation of TIP 157. Adds recognition - * doc/Tcl.n: of the new leading {expand} syntax on words. - * generic/tcl.h: Parses such words as the new Tcl_Token type - * generic/tclBasic.c: TCL_TOKEN_EXPAND_WORD. Updated Tcl_EvalEx and - * generic/tclCompile.c: the bytecode compiler/execution engine to - * generic/tclCompile.h: recognize the new token type. New opcodes - * generic/tclExecute.c: INST_LIST_VERIFY and INST_INVOKE_EXP and a new - * generic/tclParse.c: operand type OPERAND_ULIST1 are defined. Docs - * generic/tclTest.c: and tests are included. - * tests/basic.test: - * tests/compile.test: - * tests/parse.test: - - * library/auto.tcl: Replaced several [eval]s used to perform - * library/package.tcl: argument expansion with the new syntax. In the - * library/safe.tcl: test files lindex.test and lset.test, replaced - * tests/cmdInfo.test: use of [eval] to force direct string - * tests/encoding.test: evaluation with use of [testevalex] which more - * tests/execute.test: directly and robustly serves the same purpose. - * tests/fCmd.test: - * tests/http.test: - * tests/init.test: - * tests/interp.test: - * tests/io.test: - * tests/ioUtil.test: - * tests/iogt.test: - * tests/lindex.test: - * tests/lset.test: - * tests/namespace-old.test: - * tests/namespace.test: - * tests/pkg.test: - * tests/pkgMkIndex.test: - * tests/proc.test: - * tests/reg.test: - * tests/trace.test: - * tests/upvar.test: - * tests/winConsole.test: - * tests/winFCmd.test: - -2003-11-12 Jeff Hobbs - - * tests/cmdMZ.test (cmdMZ-1.4): change to nonPortable as more systems - are using permissions caching, and this isn't really a Tcl controlled - issue. - -2003-11-11 Jeff Hobbs - - * unix/configure: - * unix/tcl.m4: improve AIX --enable-64bit handling - remove -D__NO_STRING_INLINES -D__NO_MATH_INLINES from CFLAGS_OPTIMIZE - on Linux. Make default opt -O2 (was -O). - -2003-11-11 David Gravereaux - - * contrib/djgpp/Makefile: Suggested changes from vitus@45.free.net - (Victor Wagner) - - * unix/tclUnixPort.h: added socklen_t typedef for DJGPP - -2003-11-10 Don Porter - - * unix/tclUnixInit.c (TclpInitLibraryPath): - * win/tclWinInit.c (TclpInitLibraryPath): Fix for [Bug 832657] - that should not run afoul of startup constraints. - - * library/dde/pkgIndex.tcl: Added safeguards so that registry and - * library/reg/pkgIndex.tcl: dde packages are not offered on - * win/tclWinDde.c: non-Windows platforms. Bumped to - * win/tclWinReg.c: registry 1.1.3 and dde 1.3. - * win/Makefile.in: - * win/configure.in: - * win/makefile.bc: - * win/makefile.vc: - - * win/configure: autoconf (2.57) - -2003-11-10 Donal K. Fellows - - * tests/cmdIL.test: Stopped cmdIL-5.5 from stomping over the test - command, and updated the tests to use some tcltest2 features in - relation to cleanup. [Bug 838384] - -2003-11-10 Vince Darley - - * generic/tclCmdAH.c: - * tests/fCmd.test: fix to misleading error message in 'file link'. - [Bug 836208] - -2003-11-07 Vince Darley - - * generic/tclIOUtil.c: fix to compiler warning/error with some - compilers. [Bug 835918] - -2003-11-07 Daniel Steffen - - * macosx/Makefile: optimized builds define NDEBUG to turn off - ThreadAlloc range checking. - -2003-11-05 Don Porter - - * tests/unixInit.test (unixInit-2.10): New test to expose [Bug 832657] - failure of TclpInitLibraryPath() to properly handle .. in the path - of the executable. - -2003-11-04 Daniel Steffen - - * macosx/Makefile: added 'test' target. - -2003-11-03 Vince Darley - - * generic/tclIOUtil.c - * generic/tclInt.h: added comments and re-arranged code to clarify - distinction between Tcl_LoadHandle, ClientData for 'load'ed code, and - point out limitations of the design introduced with Tcl 8.4. - - * unix/tclUnixFile.c: fix to memory leak - - * generic/tclCmdIL.c: removed warning on Windows. - -2003-11-01 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LrepeatObjCmd): Check for sensible list - lengths and allow for soft failure of the memory subsystem in the - [lconcat] command [Bug 829027]. Uses direct list creation to avoid - extra copies when working near the limit of available memory. Also - reorganized to encourage optimizing compilers to optimize heavily. - * generic/tclListObj.c (TclNewListObjDirect): New list constructor - that does not copy the array of objects. Useful for creating - potentially very large lists or where you are about to throw away the - array argument which is being used in its entirety. - -2003-10-28 Miguel Sofer - - * generic/tclExecute.c (NEXT_INST macros): replaced macro variable - "result" by "resultHandling" to avoid confusion. - -2003-10-23 Andreas Kupries - - * unix/tclUnixChan.c (Tcl_MakeFileChannel): Applied [Patch 813606] - fixing [Bug 813087]. Detection of sockets was off for Mac OS X which - implements pipes as local sockets. The new code ensures that only IP - sockets are detected as such. - - * win/tclWinSock.c (TcpWatchProc): Watch for FD_CLOSE too when asked - for writable events by the generic layer. - (SocketEventProc): Generate a writable event too when a close is - detected. - - Together the changes fix [Bug 599468]. - -2003-10-23 Vince Darley - - * tests/resource.test: - * mac/tclMacResource.c: fix to resource freeing problem in 'resource' - command reported by Bernard Desgraupes. - - * doc/FileSystem.3: updated documentation for 'glob' fix on 2003-10-13 - below - -2003-10-22 Donal K. Fellows - - * generic/tclCmdAH.c (Tcl_FileObjCmd): Changed FILE_ prefix to FCMD_ - to stop symbol/#def clashes on Cygwin/Mingw32 on NT. [Bug 822528] - -2003-10-21 Daniel Steffen - - * tools/tcltk-man2html.tcl: fixed incorrect html generated for - .IP/.TP lists, now use
...
...

...
...
- instead of illegal

...
...

...
...
. - Added skipping of directives directly after .TP to avoid them being - used as item descriptions, e.g. .TP\n.VS in clock.n. - -2003-10-21 Andreas Kupries - - * win/tclWinPipe.c (BuildCommandLine): Applied the patch coming with - [Bug 805605] to the code, fixing the incorrect use of ispace noted by - Ronald Dauster . - -2003-10-20 Kevin B. Kenny - - * doc/msgcat.n: - * library/msgcat/msgcat.tcl (mclocale,mcload): - * tools/tcl.wse.in: - * unix/Makefile.in: Implementation of TIP#156, add a "root locale" - * win/makefile.bc: to the 'msgcat' package. Advanced msgcat - * win/Makefile.in: version number to 1.4 - * win/Makefile.vc: - -2003-10-15 Donal K. Fellows - - * generic/tclCmdIL.c (SortInfo,etc): Reorganized so that SortInfo - carries an array of integer indices instead of a Tcl list. This nips - shimmering problems in the bud and simplifies SelectObjFromSublist at - the cost of making setup slightly more complex. [Bug 823768] - -2003-10-14 David Gravereaux - - * win/tclAppInit.c (sigHandler): Punt gracefully if exitToken has - already been destroyed. - -2003-10-14 Vince Darley - - * generic/tclCmdMZ.c: - * tests/regexp.test: fix to [Bug 823524] in regsub; added three new - tests. - -2003-10-14 Don Porter - - * generic/tclBasic.c (TclAppendObjToErrorInfo): New internal routine - that appends a Tcl_Obj to the errorInfo, saving the caller the trouble - of extracting the string rep. - - * generic/tclStringObj.c (TclAppendLimitedToObj): New internal - routine that supports truncated appends with optional ellipsis marking. - This single routine supports UTF-8-safe truncated appends needed in - several places throughout the Tcl source code, mostly for error and - stack messages. Clean fix for [Bug 760872]. - - * generic/tclInt.h: Declarations for new internal routines. - - * generic/tclCmdMZ.c: Updated callers to use the new routines. - * generic/tclCompExpr.c: - * generic/tclCompile.c: - * generic/tclExecute.c: - * generic/tclIOUtil.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclParseExpr.c: - * generic/tclProc.c: - * generic/tclStringObj.c: - * mac/tclMacResource.c: - - * library/init.tcl: Updated ::errorInfo cleanup in [unknown] to - reflect slight modifications to Tcl_LogCommandInfo(). Corrects failing - init-4.* tests. - -2003-10-14 Donal K. Fellows - - TIP#127 IMPLEMENTATION FROM JOE MICHAEL SCHLENKER - - * generic/tclCmdIL.c (SelectObjFromSublist): Element selection engine. - * generic/tclCmdIL.c (Tcl_LsearchObjCmd, Tcl_LsortObjCmd): - * tests/lsearch.test: Set up and use of element selection engine, - * tests/cmdIL.test: plus tests and documentation. - * doc/lsearch.n: Based on [Patch 693836] - * doc/lsort.n: - -2003-10-13 Vince Darley - - * generic/tcl.h: - * generic/tclFileName.c: - * generic/tclIOUtil.c: - * generic/tclPathObj.c: - * generic/tclTest.c: - * mac/tclMacFile.c: - * tests/fileName.test: better tests for [Bug 813273] - * unix/tclUnixFCmd.c: - * unix/tclUnixFile.c: - * win/tclWin32Dll.c: - * win/tclWinFCmd.c: - * win/tclWinFile.c: - * win/tclFileInt.h: - - Fixed [Bug 800106] in which 'glob' was incapable of merging the - results of a directory listing (real or virtual) and any virtual - filesystem mountpoints in that directory (the latter were ignored). - This meant boundaries between different filesystems were not seamless - (e.g. 'glob */*' across a filesystem boundary was wrong). Added new - entry to Tcl_GlobTypeData in a totally backwards compatible way. To - allow listing of mounts, registered filesystems must support the - 'TCL_GLOB_TYPE_MOUNT' flag. If this is not supported (e.g. in tclvfs - 1.2) then mounts will simply not be listed for that filesystem. - - Fixed [Bug 749876] 'file writable/readable/etc' (NativeAccess) using - correct permission checking code for Windows NT/2000/XP where more - complex user-based security/access priveleges are available, - particularly on shared volumes. The performance impact of this extra - checking will need further investigation. Note: Win 95,98,ME have no - support for this. - - Also made better use of normalized rather than translated paths in the - platform specific code. - -2003-10-12 Jeff Hobbs - - * unix/tclUnixTest.c (TestalarmCmd): don't bother checking return - value of alarm. [Bug #664755] (english) - -2003-10-09 Pat Thoyts - - * win/makefile.vc: Applied patches for bug #801467 by Joe Mistachkin - * win/tclAppInit.c: to fix incompatible TCL_MEM_DEBUG handling in - * generic/tclObj.c: Win32 VC builds. - -2003-10-08 Don Porter - - * generic/tclBasic.c: Save and restore the iPtr->flag bits that - control the state of errorCode and errorInfo management when calling - "leave" execution traces, so that all error information of the traced - command is still available whether traced or not. [Bug 760947] - Thanks to Yahalom Emet. - -2003-10-08 Donal K. Fellows - - * generic/tclTest.c (TestNumUtfCharsCmd): Command to allow finer - access to Tcl_NumUtfChars for testing. - * generic/tclUtf.c (Tcl_NumUtfChars): Corrected string length - determining when the length parameter is negative; the terminator is a - zero byte, not (necessarily) a \u0000 character. [Bug 769812] - -2003-10-07 Don Porter - - * tests/cmdAH.test: - * tests/exec.test: Corrected temporary file management - * tests/fileSystem.test: issues uncovered by -debug 1 test - * tests/io.test: operations. Also backported some - * tests/ioCmd.test: other fixes from the HEAD. - * tests/main.test: - * tests/pid.test: [Bugs 675605, 675655, 675659] - * tests/socket.test: - * tests/source.test: - - * tests/fCmd.test: Run tests with the [temporaryDirectory] as the - current directory, so that tests can depend on ability to write files. - [Bug 575837] - - * doc/OpenFileChnl.3: Updated Tcl_Tell and Tcl_Seek documentation to - reflect that they now return Tcl_WideInt (TIP 72). [Bug 787537] - - * tests/io.test: Corrected several tests that failed when paths - * tests/ioCmd.test: included regexp-special chars. [Bug 775394] - -2003-10-06 Jeff Hobbs - - * win/configure: - * win/tcl.m4: removed incorrect checks for existence of optimization. - TCL_CFG_OPTIMIZED is now defined whenever the user does not build with - --enable-symbols. - -2003-10-06 Don Porter - - * tests/regexp.test: Matched [makeFile] with [removeFile]. - * tests/regexpComp.test: [Bug 675652] - - * tests/fCmd.test (fCmd-8.2): Test only that tilde-substitution - happens, not for any particular result. [Bug 685991] - - * unix/tcl.m4 (SC_PATH_TCLCONFIG): Corrected search path so that - alpha and beta releases of Tcl are not favored. [Bug 608698] - - * tests/reg.test: Corrected duplicate test names. - * tests/resource.test: [Bugs 710370, 710358] - * tests/dict.test: - - * tests/dict.test: Updated [package require tcltest] lines to - * tests/fileSystem.test: indiciate that these test files - * tests/lrepeat.test: use features of tcltest 2. [Bug 706114] - * tests/notify.test: - * tests/parseExpr.test: - * tests/unixNotfy.test: - * tests/winDde.test: - -2003-10-04 Miguel Sofer - - * generic/tclExecute.c (TEBC): - * tests/execute.test (execute-8.2): fix for [Bug 816641] - faulty - execution and catch stack management. - -2003-10-03 Don Porter - - * generic/tclBasic.c: Fixed error in ref count management of command - * generic/tclCmdMZ.c: and execution traces that caused access to - freed memory in trace-32.1. [Bug 811483] - -2003-10-02 Don Porter - - * generic/tclTrace.c: Corrected comingling of introspection results of - [trace info command] and [trace info execution]. [Bug 807243] - Thanks to Mark Saye. - -2003-10-01 Daniel Steffen - - * macosx/Makefile: fixed redo prebinding bug when DESTDIR="". - * mac/tclMacResource.c: fixed possible NULL dereference (bdesgraupes). - -2003-09-29 Vince Darley - - * generic/tclPathObj.c: - * tests/fileName.test: fix to inconsistent handling of backslash - path separators on Windows in 'file join' [Bug 813273] - -2003-09-29 Donal K. Fellows - - * generic/tclPathObj.c (TclNativePathInFilesystem,TclFSGetPathType): - * generic/tclIOUtil.c (TclNativeDupInternalRep,TclGetPathType): Rename - to make sure function names won't interfere with other non-Tcl code - (reported by George Staplin) - - TIP#121 IMPLEMENTATION FROM JOE MISTACHKIN - - * generic/tclEvent.c (Tcl_SetExitProc,Tcl_Exit): Implementation of - application exit handler scheme. - * generic/tcl.decls (Tcl_SetExitProc): Public declaration. - * doc/Exit.3: Documentation of new API function. - - TIP#112 IMPLEMENTATION - - * generic/tclNamesp.c: Core of implementation. - * generic/tclInt.h (Namespace,TclInvalidateNsCmdLookup): Add command - list epoch counter and list of ensembles to namespace structure, and - define a macro to ease update of the epoch counter. - * generic/tclBasic.c (Tcl_CreateObjCommand,etc.): Update epoch counter - when list of commands in a namespace changes. - * generic/tclObj.c (TclInitObjSubsystem): Register ensemble subcommand - type. - * tests/namespace.test (42.1-47.6): Tests. - * doc/namespace.n: Documentation. - - * library/http/http.tcl (geturl): Correctly check the type of - boolean-valued options. [Bug 811170] - - * unix/tcl.m4 (SC_ENABLE_FRAMEWORK): Added note to make it clearer - that this is an OSX feature, not a general Unix feature. [Bug 619440] - -2003-09-28 David Gravereaux - - * win/tclWinPipe.c: The windows port of expect can call - TclWinAddProcess before any of the other pipe functions. Added a - missing PipeInit() call to make sure the initialization happens. - -2003-09-25 Daniel Steffen - - * macosx/Makefile: ensure SYMROOT exists if OBJROOT is overridden on - command line. Replaced explict use of /usr/bin by ${BINDIR}. - -2003-09-24 Vince Darley - - * library/package.tcl (tcl::MacPkgUnknown, tcl::MacOSXPkgUnknown): - Minor performance tweaks to reduce the number of [file] invocations. - Meant to improve startup times, at least a little bit. (The generic - equivalent patch was applied on 2003-02-21). - -2003-09-24 Vince Darley - - * trace.test: removed 'knownBug' from a test which doesn't illustrate - a bug, just a bad test. - -2003-09-23 Miguel Sofer - - * generic/tclExecute.c: - * generic/tclInt.h: changed the evaluation-stack addressing mode, from - array-style to pointer-style; the catch stack and evaluation stack are - now contiguous in memory. [Patch 457449] - -2003-09-23 Don Porter - - * tests/trace.test (trace-31,32-*): Added tests for [Bug 807243] and - [Bug 811483]. - - * library/init.tcl (auto_load, auto_import): Expanded Eric Melski's - 2000-01-28 fix for [Bug 218871] to all potentially troubled uses of - [info commands] on input data, where glob-special characters could - cause problems. - -2003-09-20 Donal K. Fellows - - * tests/expr.test (expr-23.4): Prevented accidental wrapping round of - exponential operation; it isn't portable, and not what I intended to - test either. [Bug 808244] - -2003-09-19 Miguel Sofer - - * generic/tclExecute.c: adding (DE)CACHE_STACK_INFO() pairs to protect - all calls that may cause traces on ::errorInfo or ::errorCode to - corrupt the stack. [Bug 804681] - -2003-09-17 Vince Darley - - * tclPathObj.c: fix to test-suite problem introduced by the bug fix - below. No problem in ordinary code, just test suite code which - manually adjusts tclPlatform. [Bug 808247] - -2003-09-16 Vince Darley - - * doc/filename.n: documentation of Windows-specific feature as - discussed in [Bug 541989] - * generic/tclPathObj.c: fix for normalization of volume-relative paths - [Bug 767834] - * tests/winFCmd.test: new tests for both of the above. - * tests/cmdAH.test: fix for AFS problem in test suite [Bug 748960] - -2003-09-13 Donal K. Fellows - - TIP#123 IMPLEMENTATION BASED ON WORK BY ARJEN MARKUS - - * generic/tclCompile.h (INST_EXPON): Implementation of - * generic/tclCompile.c (tclInstructionTable): exponential operator. - * generic/tclCompExpr.c (operatorTable): - * generic/tclParseExpr.c (ParseExponentialExpr, GetLexeme): - * generic/tclExecute.c (TclExecuteByteCode, ExponWide, ExponLong): - (IllegalExprOperandType): - * tests/expr.test: - * tests/compExpr-old.test: - * doc/expr.n: - -2003-09-10 Don Porter - - * library/opt/optparse.tcl: Latest revisions caused [OptGuessType] - to guess "int" instead of "string" for empty strings. Missed the - required "-strict" option to [string is]. Thanks to Revar Desmera. - [Bug 803968] - -2003-09-08 David Gravereaux - - * win/tclWinLoad.c (TclpDlopen): Changed the error message for - ERROR_PROC_NOT_FOUND to be a bit more helpful in giving us clues. - "can't find specified procedure" means a function in the import table, - for implicit loading, couldn't be resolved and that's why the load - failed. - -2003-09-04 Don Porter - - * doc/Tcl_Main.3: - * doc/FileSystem.3: Implementation of - * doc/source.n: TIPs 137/151. Adds a - * doc/tclsh.1: -encoding option to - * generic/tcl.decls: the [source] command - * generic/tclCmdMZ.c (Tcl_SourceObjCmd): and a new C routine, - * generic/tclIOUtil.c (Tcl_FSEvalFileEx): Tcl_FSEvalFileEx(), - * generic/tclMain.c (Tcl_Main): that provides C access - * mac/tclMacResource.c (Tcl_MacSourceObjCmd): to the same function. - * tests/cmdMZ.test: Also adds command line - * tests/main.test: option handling in Tcl_Main() so that tclsh - * tests/source.test: and other apps built on Tcl_Main() respect a - -encoding command line option before a script filename. Docs and tests - updated as well. [Patch 742683] - This is a ***POTENTIAL INCOMPATIBILITY*** only for those C programs - that embed Tcl, build on Tcl_Main(), and make use of Tcl_Main's former - ability to pass a leading "-encoding" option to interactive shell - operations. - - * generic/tclInt.decls: Added internal stub - * generic/tclMain.c (Tcl*StartupScript*): table entries for two - new functions Tcl_SetStartupScript() and Tcl_GetStartupScript() that - set/get the path and encoding for the startup script to be evaluated - by either Tcl_Main() or Tk_Main(). Given public names in anticipation - of their exposure by a followup TIP. - - * generic/tclDecls.h: make genstubs - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - -2003-09-04 Don Porter - - * doc/SplitList.3: Implementation of TIP 148. Fixes [Bug 489537]. - * generic/tcl.h: Updated Tcl_ConvertCountedElement() to quote - * generic/tclUtil.c: the leading "#" character of all list elements - unless the TCL_DONT_QUOTE_HASH flag is passed in. - - * generic/tclDictObj.c: Updated Tcl_ConvertCountedElement() callers - * generic/tclListObj.c: to pass in the TCL_DONT_QUOTE_HASH flags - * generic/tclResult.c: when appropriate. - -2003-08-31 Don Porter - - * doc/return.n: Updated [return] docs to cover new TIP 90 features. - - * doc/break.n: Added SEE ALSO references to return.n - * doc/continue.n: - -2003-09-01 Donal K. Fellows - - * doc/Namespace.3: Basic documentation for the TIP#139 functions. This - will need improving, but the basic bits are there at least. - -2003-08-31 Don Porter - - * doc/catch.n: Updated [catch] docs to cover new TIP 90 features. - -2003-08-29 Don Porter - - * generic/tclCmdAH.c: Corrected bug in TIP 90 implementation where - * tests/cmdMZ.test: the default -errorcode NONE value was not - copied into the return options dictionary. This correction modified - one test result. - -2003-08-27 David Gravereaux - - * compat/strftime.c (_fmt): Removed syst array intializer that - couldn't take variables within it under the watcom compiler: - 'Initializers must be constant'. I believe Borland has this strictness - as well. VC++ must be non-standard about this. - - Changed Win32 platform #ifdef from 'WIN32' to '__WIN32__' as this is - the correct one to use across the Tcl sources. Even though we do force - it in tcl.h, the true parent one is __WIN32__. - - Added missing CONST'ification usage to match prototype listed in - tclInt.decls. - - * win/tclWinPort.h: Added a block for OpenWatcom adjustments that - fixes 1) the same issue Mo did for MinGW lack of missing LPFN_* - typedefs in their WINE derived and 2) The need to be - strict about how the char type needs to be signed by default. - - * win/tclWinSock.c: Added OpenWatcom to the commentary about the - #ifdef HAVE_NO_LPFN_DECLS block. - - * win/tclWinTime.c: Changed use of '_timezone' to 'timezone' as this - difference is already adjusted for in tclWinPort.h. Removed - unreferenced posixEpoch file-scope global. - - * win/tclWinFile.c (WinReadLinkDirectory): Fix for 'Initializers must - be constant' with the driveSpec array using OpenWatcom. - -2003-08-27 Don Porter - - * generic/tclUtil.c: Corrected [Bug 411825] and other bugs in - TclNeedSpace() where non-breaking space (\u00A0) and backslash-escaped - spaces were handled incorrectly. - * tests/util.test: Added new tests util-8.[2-6]. - -2003-08-26 David Gravereaux - - * generic/tcl.h: Added some support for the LCC-Win32 compiler. - Unfortunetly, this compiler has a bug in its preprocessor and can't - build Tcl even with this minor patch. Also added some support for the - OpenWatcom compiler. A new win/makefile.wc to follow soon. - -2003-08-25 Donal K. Fellows - - * tools/genStubs.tcl (genStubs::makeDecl): A more subtle way of - generating stubbed declarations allows us to have declarations of a - function in multiple interfaces simultaneously. - - * generic/tcl.decls: Duplicated some namespace declarations from - tclInt.decls here, as mandated by TIP #139. This is OK since the - declarations match and will end up using the declarations in the - public code from now on because of #include ordering. Keeping the old - declarations in tclInt.decls; there's no need to gratuitously break - compatibility for those extensions which are already clients of the - namespace code. - -2003-08-23 Zoran Vasiljevic - - * generic/tclIOUtil.c: merged fixes for thread-unsafe handling of - filesystem records [Bug 753315]. This also fixed the [Bug 788780] - * generic/tclPathObj.c: merged fixes for thread-unsafe handling of - filesystem records. [Bug 753315] - - * generic/tclFileSystem.h: merged fixes for thread-unsafe handling of - filesystem records. [Bug 753315] - -2003-08-19 Pat Thoyts - - * win/tclWinSerial.c (SerialErrorStr): Fixed a syntax error created in - the previous code cleanup. - -2003-08-19 Donal K. Fellows - - * win/tclWinSerial.c: Adjusted commenting and spacing usage to follow - the principles of the Style Guide better. - -2003-08-18 Mo DeJong - - * win/configure: Regen. - * win/tcl.m4 (SC_ENABLE_SYMBOLS): Use test instead of -eq, which does - not work. [Bug 781109] - -2003-08-13 Chengye Mao - - * win/tclWinPipe.c: fixed a bug in BuildCommandLine. This bug built a - command line with a missing space between tclpipe.dll and the - following arguments. It caused error in Windows 98 when exec - command.com (e.g. dir). [Bug 789040] - -2003-08-11 Donal K. Fellows - - TIP #136 IMPLEMENTATION from Simon Geard - * generic/tclCmdIL.c (Tcl_LrepeatObjCmd): Adapted version of Simon's - * doc/lrepeat.n: patch, updated to the HEAD - * tests/lrepeat.test: and matching the core style. - * generic/tclBasic.c (buildIntCmds): Splice into core. - * generic/tclInt.h: - * doc/list.n: Cross-reference. - -2003-08-06 Jeff Hobbs - - * win/tclWinInit.c: recognize amd64 and ia32_on_win64 cpus. - -2003-08-06 Don Porter - - * library/msgcat/msgcat.tcl: Added escape so that non-Windows - * library/msgcat/pkgIndex.tcl: platforms do not try to use the - registry package. This can save a costly and pointless package search. - Bumped to 1.3.1. Thanks to Dave Bodenstab. [Bug 781609] - -2003-08-05 Miguel Sofer - - * generic/tclExecute.c (INST_INVOKE, INST_EVAL, INST_PUSH_RESULT): - added a Tcl_ResetResult(interp) at each point where the interp's - result is pushed onto the stack, to avoid keeping an extra reference - that may cause costly Tcl_Obj duplication. Detected by Franco Violi, - analyzed by Peter Spjuth and Donal Fellows. [Bug 781585] - -2003-07-28 Vince Darley - - * doc/FileSystem.3: - * doc/Translate.3: better documentation of Tcl_TranslateFileName and - related functions. [Bug 775220] - -2003-07-24 Mo DeJong - - * generic/tcl.h: Revert change made on 2003-07-21 since it made the - sizeof(Tcl_Obj) different for regular vs mem debug builds. - * generic/tclInt.h: Define TclDecrRefCount in terms of - Tcl_DbDecrRefCount which removes one layer of inderection. - * generic/tclObj.c (TclDbInitNewObj, Tcl_DbIncrRefCount, - (Tcl_DbDecrRefCount, Tcl_DbIsShared): Define ThreadSpecificData that - contains a hashtable. The table is used to ensure that a Tcl_Obj is - only acted upon in the thread that allocated it. This checking code is - enabled only when mem debug and threads are enabled. - -2003-07-24 Don Porter - - * tests/async.test: Added several tests that demonstrate [Bug - * tests/basic.test: 489537], Tcl's longstanding failure to - * tests/dict.test: properly quote any leading '#' character when - * tests/dstring.test: generating the string rep of a list so that - * tests/list.test: the comment-power of that character is hidden - * tests/parse.test: from any [eval], in order to satisfy the - * tests/util.test: documentation that [list] does [eval]-safe - quoting. - -2003-07-24 Reinhard Max - - * library/package.tcl: Fixed a typo that broke pkg_mkIndex -verbose. - * tests/pkgMkIndex.test: Added a test for [pkg_mkIndex -verbose]. - - * ChangeLog.2002 (new file): - * ChangeLog: broke changes from 2002 into ChangeLog.2002 to reduce - size of the main ChangeLog. - -2003-07-23 Daniel Steffen - - * unix/Makefile.in: changes to html-tcl & html-tk targets for - compatibility with non-gnu makes. - - * unix/Makefile.in: added macosx/README to dist target. - -2003-07-23 Pat Thoyts - - * win/tclWinReg.c (OpenSubKey): Fixed bug 775976 which causes the - registry set command to fail when built with VC7. - * library/reg/pkgIndex.tcl: Incremented the version to 1.1.2. - -2003-07-21 Mo DeJong - - Check that the thread incrementing or decrementing the ref count of a - Tcl_Obj is the thread that originally allocated the thread. This fail - fast behavior will catch programming errors that allow a single - Tcl_Obj to be accessed from multiple threads. - - * generic/tcl.h (Tcl_Obj): Add allocThread member to Tcl_Obj. This - member records the thread id the Tcl_Obj was allocated. It is used to - check that any future ref count incr or decr is done from the same - thread that allocated the Tcl_Obj. This member is defined only when - threads and mem debug are enabled. - * generic/tclInt.h (TclNewObj, TclDbNewObj, TclDecrRefCount): - Define TclNewObj and TclDbNewObj using TclDbInitNewObj when mem debug - is enabled. This fixes a problem where TclNewObj calls did not work - the same as TclDbNewObj when mem debug was enabled. - * generic/tclObj.c (TclDbInitNewObj, Tcl_DbIncrRefCount, - (Tcl_DbDecrRefCount): Add new helper to init Tcl_Obj members when mem - debug is enabled. Init the allocThread member in TclDbInitNewObj and - check it in Tcl_DbIncrRefCount and Tcl_DbDecrRefCount to make sure a - Tcl_Obj allocated in one thread is not being acted upon in another - thread. - -2003-07-21 Vince Darley - - * test/cmdAH.test: ensure certain tests run in local filesystem. [Bug - 748960] - -2003-07-18 Daniel Steffen - - * macosx/Makefile: added option to allow installing manpages in - addition to default html help. - -2003-07-18 Donal K. Fellows - - * doc/Utf.3: Tightened up documentation of Tcl_UtfNext and Tcl_UtfPrev - to better match the behaviour. [Bug 769895] - -2003-07-18 Jeff Hobbs - - * library/http/pkgIndex.tcl: upped to http v2.4.4 - * library/http/http.tcl: add support for user:pass info in URL. - * tests/http.test: [Bug 759888] (shiobara) - -2003-07-18 Don Porter - - * doc/tcltest.n: Restored the [Eval] proc to replace - * library/tcltest/tcltest.tcl: the [::puts] command when either the - -output or -error option for [test] is in use, in order to capture - data written to the output or error channels for comparison against - what is expected. This is easier to document and agrees better with - most user expectations than the previous attempt to replace [puts] - only in the caller's namespace. Documentation made more precise on - the subject. [Bug 706359] - - * doc/AddErrInfo.3: Improved consistency of documentation by - * doc/CrtTrace.3: using "null" everywhere to refer to the - * doc/Encoding.3: character '\0', and using "NULL" everywhere - * doc/Eval.3: to refer to the value of a pointer that points - * doc/GetIndex.3: to nowhere. Also dropped references to ASCII - * doc/Hash.3: that are no longer true, and standardized on - * doc/LinkVar.3: the hyphenated spelling of "null-terminated". - * doc/Macintosh.3: - * doc/OpenFileChnl.3: - * doc/SetVar.3: - * doc/StringObj.3: - * doc/Utf.3: - - * doc/CrtSlave.3 (Tcl_MakeSafe): Removed warning about possible - deprecation (no TIP on that). - -2003-07-17 Daniel Steffen - - * unix/tclUnixFCmd.c: fix for compilation errors on platforms where - configure detects non-functional chflags(). [Bug 748946] - - * macosx/Makefile: Rewrote buildsystem for Mac OS X framework build - to be purely make driven; in order to become independent of Apple's - closed-source IDE and build tool. The changes are intended to be - transparent to the Makefile user, all existing make targets and cmd - line variable overrides should continue to work. Changed build to only - include tcl specific html help in Tcl.framework, the tk specific html - help is now included in Tk.framework. Added var to allow overriding of - tclsh used during html help building (Landon Fuller). - - * macosx/Tcl.pbproj/project.pbxproj: - * macosx/Tcl.pbproj/jingham.pbxuser: Changed to purely call through to - the make driven buildsystem; Tcl.framework is no longer assembled by - ProjectBuilder. - Set default SYMROOT in target options to simplify setting up PB - (manually setting common build folder for tcl & tk no longer needed). - - * tools/tcltk-man2html.tcl: Added options to allow building only the - tcl or tk html help files; the default behaviour with none of the new - options is to build both, as before. - - * unix/Makefile.in: Added targets for building only the tcl or tk help - - * macosx/README (new): Tcl specific excerpts of tk/macosx/README. - - * generic/tcl.h: Updated reminder comment about editing - macosx/Tcl.pbproj/project.pbxproj when version number changes. - -2003-07-16 Mumit Khan - - * generic/tclPathObj.c (SetFsPathFromAny): Add Cygwin specific code to - convert POSIX filename to native format. - * generic/tclFileName.c (Tcl_TranslateFileName): And remove from here. - (TclDoGlob): Adjust for cygwin and append / for dirs instead of \ - * win/tclWinFile.c (TclpObjChdir): Use chdir on Cygwin. - [Patch 679315] - -2003-07-16 Jeff Hobbs - - * library/safe.tcl (FileInAccessPath): normalize paths before - comparison. [Bug 759607] (myers) - - * unix/tclUnixNotfy.c (NotifierThreadProc): correct size of found and - word vars from int to long. [Bug 767578] (hgo) - - * generic/tcl.h: Add recognition of -DTCL_UTF_MAX=6 on the make - * generic/regcustom.h: line to support UCS-4 mode. No config arg at - this time, as it is not the recommended build mode. - - * generic/tclPreserve.c: In Result and Preserve'd routines, do not - * generic/tclUtil.c: assume that ckfree == free, as that is not - * generic/tclResult.c: always true. [Bug 756791] (fuller) - -2003-07-16 Donal K. Fellows - - * doc/CrtSlave.3 (Tcl_MakeSafe): Updated documentation to strongly - discourage use. IMHO code outside the core that uses this function is - a bug... [Bug 655300] - -2003-07-16 Don Porter - - * generic/tclFileName.c (Tcl_GlobObjCmd): [Bug 771840] - * generic/tclPathObj.c (Tcl_FSConvertToPathType):[Bug 771947] - * unix/tclUnixFCmd.c (GetModeFromPermString): [Bug 771949] - Silence compiler warnings about unreached lines. - - * library/tcltest/tcltest.tcl (ProcessFlags): Corrected broken call - * library/tcltest/pkgIndex.tcl: to [lrange]. Bumped to - version 2.2.4. [Bug 772333] - -2003-07-15 Mo DeJong - - * unix/dltest/pkga.c (Pkga_EqObjCmd): Fix typo that was causing a - crash in load.test. - -2003-07-15 Donal K. Fellows - - * doc/array.n: Make sure docs are synched with the 8.4 release. - -2003-07-15 Don Porter - - * doc/http.n: Updated SYNOPSIS to match actual syntax of commands. - [Bug 756112] - - * unix/dltest/pkga.c: Updated to not use Tcl_UtfNcmp and counted - strings instead of strcmp (not defined in any #include'd header) and - presumed NULL-terminated strings. - - * generic/tclCompCmds.c (TclCompileIfCmd): Prior fix of Bug 711371 on - 2003-04-07 introduced a buffer overflow. Corrected. [Bug 771613] - -2003-07-15 Kevin B. Kenny - - * win/rules.vc: Added a missing $(OPTDEFINES) which broke the build if - STATS=memdbg was specified. - -2003-07-15 Donal K. Fellows - - * generic/tclCmdIL.c (SortCompare): Cleared up confusing error - message. [Bug 771539] - -2003-07-11 Donal K. Fellows - - * tests/binary.test (binary-46.*): Tests to help enforce the current - behaviour. - * doc/binary.n: Documented that [binary format a] and [binary scan a] - do encoding conversion by dropping high bytes, unlike the rest of the - core. [Bug 735364] - -2003-07-11 Don Porter - - * library/package.tcl: Corrected [pkg_mkIndex] bug reported on - comp.lang.tcl. The indexer was searching for newly indexed packages - instead of newly provided packages. - -2003-07-08 Vince Darley - - * tests/winFCmd.test: fix for five tests under win98 [Bug 767679] - -2003-07-07 Jeff Hobbs - - * doc/array.n: add examples from Welton - -2003-06-23 Vince Darley - - * doc/file.n: clarification of 'file tail' behaviour [Bug 737977] - -2003-07-04 Donal K. Fellows - - * doc/expr.n: Tighten up the wording of some operations. [Bug 758488] - - * tests/cmdAH.test: Made tests of [file mtime] work better on FAT - filesystems. [Patch 760768] Also a little general cleanup. - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Made [string map] accept - dictionaries for maps. This is much trickier than it looks, since map - entry ordering is significant. [Bug 759936] - - * generic/tclVar.c (Tcl_ArrayObjCmd, TclArraySet): Made [array get] - and [array set] work with dictionaries, producing them and consuming - them. Note that for compatibility reasons, you will never get a dict - from feeding a string literal to [array set] since that alters the - trace behaviour of "multi-key" sets. [Bug 759935] - -2003-06-23 Vince Darley - - * generic/tclTrace.c: fix to Window debug build compilation error. - -2003-06-27 Don Porter - - * tests/init.test: Added [cleanupTests] to report results of tests - * tests/pkg.test: that run in slave interps. [Bugs 761334,761344] - - * tests/http.test: Used more reliable path to find httpd script. - -2003-06-25 Don Porter - - * tests/init.test: Added tests init-4.6.* to illustrate [Bug 760872] - -2003-06-25 Donal K. Fellows - - * generic/tclTrace.c: New file, factoring out of virtually all the - various trace-related things from tclBasic.c and tclCmdMZ.c with the - goal of making this a separate maintenance area. - -2003-06-25 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Add -ieee when compiling with cc and - add -mieee when compiling with gcc under OSF1-V5 "Tru64" systems. [Bug - 748957] - -2003-06-24 Donal K. Fellows - - * doc/encoding.n: Corrected the docs to say that [source] uses the - system encoding, which it always did anyway (since 8.1) [Bug 742100] - -2003-06-24 Donal K. Fellows - - * generic/tclHash.c (Tcl_HashStats): Prevented occurrence of - division-by-zero problems. [Bug 759749] - -2003-06-24 Mo DeJong - - * unix/tclUnixPort.h: #undef inet_ntoa before #define to avoid - compiler warning under freebsd. [Bug 745844] - -2003-06-23 Pat Thoyts - - * doc/dde.n: Committed TIP #135 which changes the - * win/tclWinDde.c: -exact option to -force. Also cleaned a - * tests/winDde.test: bug in the tests. - * library/dde/pkgIndex.tcl: Incremented version to 1.2.5 - - * doc/dde.n: Committed TIP #120 which provides the - * win/tclWinDde.c: dde package for safe interpreters. - * tests/winDde.test: Incremented package version to 1.2.4 - * library/dde/pkgIndex.tcl: - -2003-06-23 Vince Darley - - * generic/tclFCmd.c: fix to bad error message when trying to do 'file - copy foo ""'. [Bug 756951] - * tests/fCmd.test: added two new tests for the bug. - - * win/tclWinFile.c: - * win/tclWin32Dll.c: recommitted some filesystem globbing speed-ups, - but disabled some on the older Win 95/98/ME where they don't seem to - work. - - * doc/FileSystem.3: documentation fix [Bug 720634] - -2003-06-18 Miguel Sofer - - * generic/tclNamesp.c (Tcl_Export): removed erroneous comments. [Bug - 756744] - -2003-06-17 Vince Darley - - * win/makefile.vc: fixes to check-in below so compilation now works - again on Windows. - - * generic/tclCmdMZ.c: - * tests/regexp.test: fixing of bugs related to regexp and regsub - matching of empty strings. Addition of a number of new tests. [Bug - 755335] - -2003-06-16 Andreas Kupries - - * win/Makefile.in: Haven't heard back from David for a week. Now - * win/configure: committing the remaining changes. - * win/configure.in: Note: In active contact with Helmut Giese about - * win/makefile.vc: the borland relatedchanges. This part will see - * win/rules.vc: future updates. - * win/tcl.m4: - * win/makefile.bc: - -2003-06-10 Andreas Kupries - - * generic/tclConfig.c (ASSOC_KEY): Changed the key to - "tclPackageAboutDict" (tcl prefix) to make collisions with the keys of - other packages more unlikely. - -2003-06-10 Miguel Sofer - - * generic/tclBasic.c: - * generic/tclExecute.c: let TclExecuteObjvInternal call - TclInterpReady instead of relying on its callers to do so; fix for the - part of [Bug 495830] that is new in 8.4. - * tests/interp.test: Added tests 18.9 (knownbug) and 18.10 - -2003-06-09 Andreas Kupries - - * generic/tcl.decls: Ported the changes from the - * generic/tcl.h: 'tip-59-implementation' branch into the CVS - * generic/tclBasic.c: head. Regenerated stub table. Regenerated the - * generic/tclInt.h: configure's scripts, with help from Joe English. - * generic/tclDecls.h: - * generic/tclStubInit.c: - * generic/tclConfig.c: - * generic/tclPkgConfig.c: - * unix/Makefile.in: - * unix/configure.in: The changes in the windows section are not yet - * unix/tcl.m4: committed, they await feedback from David - * unix/mkLinks: Gravereaux. - * doc/RegConfig.3: - * mac/tclMacPkgConfig.c: - * tests/config.test: - -2003-06-09 Don Porter - - * string.test (string-4.15): Added test for [string first] bug - reported in Tcl 8.3, where test for all-single-byte-encoded strings - was not reliable. - -2003-06-04 Joe Mistachkin - - * tools/man2help.tcl: Added duplicate help section checking and - * tools/index.tcl: corrected a comment typo for the getTopics proc - in index.tcl. [Bug 748700] - -2003-06-02 Vince Darley - - * win/tclWinFCmd.c: - * tests/fCmd.test: fix to [Bug #747575] in which a bad error message - is given when trying to rename a busy directory to one with the same - prefix, but not the same name. Added three new tests. - -2003-05-23 D. Richard Hipp - - * win/tclWinTime.c: Add tests to detect and avoid a division by zero - in the windows precision timer calibration logic. - -2003-05-23 Don Porter - - * generic/tclObj.c (tclCmdNameType): Converted internal rep - management of the cmdName Tcl_ObjType the opposite way, to always use - the twoPtrValue instead of always using the otherValuePtr. Previous - fix on 2003-05-12 broke several extensions that wanted to poke around - with the twoPtrValue.ptr2 value of a cmdName Tcl_Obj, like TclBlend - and e4graph. [Bug 726018] - Thanks to George Petasis for the bug report and Jacob Levy for testing - assistance. - -2003-05-23 Mo DeJong - - * unix/mkLinks: Set the var S to "" at the top of the file to avoid - error when user has set S to something. [Tk Bug 739833] - -2003-05-22 Daniel Steffen - - * macosx/Tcl.pbproj/project.pbxproj: added missing references to new - source files tclPathObj.c and tclMacOSXFCmd.c. - - * macosx/tclMacOSXBundle.c: fixed a problem that caused only the first - call to Tcl_MacOSXOpenVersionedBundleResources() for a given bundle - identifier to succeed. This caused the tcl runtime library not to be - found in all interps created after the inital one. - -2003-05-19 Kevin B. Kenny - - * unix/tclUnixTime.c: Corrected a bug in conversion of non-ASCII - chars in the format string. - -2003-05-19 Daniel Steffen - - * macosx/Tcl.pbproj/project.pbxproj: changed tclConfig.sh location in - versioned framework subdirectories to be identical to location in - framework toplevel; fixed stub library symbolic links to be tcl - version specific. - - * unix/tclUnixTime.c: fixed typo. - -2003-05-18 Kevin Kenny - - * compat/strftime.c: Modified TclpStrftime to return its result in - * generic/tclClock.c: UTF-8 encoding, and removed the conversion from - * mac/tclMacTime.c: system encoding to UTF-8 from [clock format]. - * unix/tclUnixTime.c: Needed to avoid double conversion of the - * win/tclWinTime.c: timezone name on Windows systems. [Bug 624408] - -2003-05-16 Pat Thoyts - - * library/dde/pkgIndex.tcl: Applied TIP #130 which provides for - * tests/winDde.test: unique dde server names. Added some more - * win/tclWinDde.c: tests. Fixes [Bug 219293] - - * doc/dde.n: Updated documentation re TIP #130. - * tests/winDde.test: Applied patch for [Bug 738929] by KKB and changed - to new-style tests. - -2003-05-16 Kevin B. Kenny - - * unix/Makefile.in: Removed one excess source file tclDToA.c - -2003-05-16 Daniel Steffen - - * macosx/Tcl.pbproj/project.pbxproj: updated copyright year. - -2003-05-15 Kevin B. Kenny - - * generic/tclGetDate.y: added further hackery to the yacc - * generic/tclDate.c: post-processing to arrange for the code to set - * unix/Makefile.in: up exit handlers to free the stacks. [Bug - 736425] - -2003-05-15 Jeff Hobbs - - * win/tclWinFile.c (TclpMatchInDirectory): revert glob code to r1.44 - as 2003-04-11 optimizations broke Windows98 glob'ing. - - * doc/socket.n: nroff font handling correction - - * library/encoding/gb2312-raw.enc (new): This is the original - gb2312.enc renamed to allow for it to still be used. This is needed by - Tk (unix) because X fonts with gb2312* charsets really do want the - original gb2312 encoding. [Bug 557030] - -2003-05-14 Donal K. Fellows - - * generic/tclCmdAH.c (Tcl_FormatObjCmd): Stop unwarranted demotion of - wide values to longs by formatting of int values. [Bug 699060] - -2003-05-14 Jeff Hobbs - - * library/encoding/gb2312.enc: copy euc-cn.enc over original - gb2312.enc. gb2312.enc appeared to not work as expected, and most uses - of gb2312 really mean euc-cn (which may be the cause of the problem). - [Bug 557030] - -2003-05-14 Daniel Steffen - - Implementation of TIP 118: - - * generic/tclFCmd.c (TclFileAttrsCmd): return the list of attributes - that can be retrieved without error for a given file, instead of - aborting the whole command when any error occurs. - - * unix/tclUnixFCmd.c: added support for new file attributes and for - copying Mac OS X file attributes & resource fork during [file copy]. - - * generic/tclInt.decls: added declarations of new external commands - needed by new file attributes support in tclUnixFCmd.c. - - * macosx/tclMacOSXFCmd.c (new): Mac OS X specific implementation of - new file attributes and of attribute & resource fork copying. - - * mac/tclMacFCmd.c: added implementation of -rsrclength attribute & - fixes to other attributes for consistency with OSX implementation. - - * mac/tclMacResource.c: fixes to OSType handling. - - * doc/file.n: documentation of [file attributes] changes. - - * unix/configure.in: check for APIs needed by new file attributes. - - * unix/Makefile.in: - * unix/tcl.m4: added new platform specifc tclMacOSXFCmd.c source. - - * unix/configure: - * generic/tclStubInit.c: - * generic/tclIntPlatDecls.h: regen. - - * tools/genStubs.tcl: fixes to completely broken code trying to - prevent overlap of "aqua", "macosx", "x11" and "unix" stub entries. - - * tests/unixFCmd.test: added tests of -readonly attribute. - - * tests/macOSXFCmd.test (new): tests of macosx file attributes and of - preservation of attributes & resource fork during [file copy]. - - * tests/macFCmd.test: restore -readonly attribute of test dir, as - otherwise its removal can fail on unices supporting -readonly. - -2003-05-13 David Gravereaux - - * generic/tclEnv.c: Another putenv() copy behavior problem repaired - when compiling on windows and using microsoft's runtime. [Bug 736421] - -2003-05-13 Jeff Hobbs - - * generic/tclIOUtil.c: ensure cd is thread-safe. - [Bug 710642] (vasiljevic) - -2003-05-13 Donal K. Fellows - - * generic/tclEvent.c (Tcl_Finalize): Removed unused variable to reduce - compiler warnings. [Bug 664745] - -2003-05-13 Joe Mistachkin - - * generic/tcl.decls: Changed Tcl_JoinThread parameter name from - * generic/tclDecls.h: "id" to "threadId". [Bug 732477] - * unix/tclUnixThrd.c: - * win/tclWinThrd.c: - * mac/tclMacThrd.c: - -2003-05-13 Daniel Steffen - - * generic/tcl.decls: - * macosx/tclMacOSXBundle.c: added extended version of the - Tcl_MacOSXOpenBundleResources() API taking an extra version number - argument: Tcl_MacOSXOpenVersionedBundleResources(). This is needed to - be able to access bundle resources in versioned frameworks such as Tcl - and Tk, otherwise if multiple versions were installed, only the latest - version's resources could be accessed. [Bug 736774] - - * unix/tclUnixInit.c (Tcl_MacOSXGetLibraryPath): use new versioned - bundle resource API to get tcl runtime library for TCL_VERSION. [Bug - 736774] - - * generic/tclPlatDecls.h: - * generic/tclStubInit.c: regen. - - * unix/tclUnixPort.h: worked around the issue of realpath() not - being thread-safe on Mac OS X by defining NO_REALPATH for threaded - builds on Mac OS X. [Bug 711232] - -2003-05-12 Donal K. Fellows - - * tests/cmdAH.test: General clean-up of tests so that all - tcltest-specific commands are protected by constraints and all - platforms see the same number of tests. [Bug 736431] - -2003-05-12 Don Porter - - * generic/tclInterp.c: (AliasObjCmd): Added refCounting of the words - * tests/interp.test (interp-33.1): of the target of an interp - alias during its execution. Also added test. [Bug 730244] - - * generic/tclBasic.c (TclInvokeObjectCommand): objv[argc] is no - longer set to NULL (Tcl_CreateObjCommand docs already say that it - should not be accessed). - - * tests/cmdMZ.test: Forgot to import [temporaryDirectory]. - - * generic/tclObj.c (tclCmdNameType): Corrected variable use of the - otherValuePtr or the twoPtrValue.ptr1 fields to store a - (ResolvedCmdName *) as the internal rep. [Bug 726018] - - * doc/Eval.3: Corrected prototype for Tcl_GlobalEvalObj [Bug 727622]. - -2003-05-12 Miguel Sofer - - * generic/tclVar.c (TclObjLookupVar): [Bug 735335] temporary fix, - disabling usage of tclNsVarNameType. - * tests/var.test (var-15.1): test for [Bug 735335] - -2003-05-10 Jeff Hobbs - - * win/tclWinSerial.c (SerialCloseProc): correct mem leak on closing a - Windows serial port [Bug 718002] (schroedter) - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): prevent string repeat crash - when overflow sizes were given (throws error). [Bug 714106] - -2003-05-09 Joe Mistachkin - - * generic/tclThreadAlloc.c (TclFreeAllocCache): Fixed memory leak - caused by treating cachePtr as a TLS index. [Bug 731754] - - * win/tclAppInit.c (Tcl_AppInit): Fixed memory leaks caused by not - freeing the memory allocated by setargv and the async handler created - by Tcl_AppInit. An exit handler has been created that takes care of - both leaks. In addition, Tcl_AppInit now uses ckalloc instead of - Tcl_Alloc to allow for easier leak tracking and to be more consistent - with the rest of the Tcl core. [Bugs 733156, 733221] - - * tools/encoding/txt2enc.c (main): Fixed memory leak caused by failing - to free the memory used by the toUnicode array of strings [Bug 733221] - -2003-05-09 Miguel Sofer - - * generic/tclCompile.c (TclCompileScript): - * tests/compile.test (compile-3.5): corrected wrong test and - behaviour in the earlier fix for [Bug 705406]; Don Porter reported - this as [Bug 735055], and provided the solution. - -2003-05-09 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_ReturnObjCmd): The array of strings passed - to Tcl_GetIndexFromObj must be NULL terminated. [Bug 735186] - Thanks to Joe Mistachkin for spotting this. - -2003-05-07 Donal K. Fellows - - * doc/trace.n: Fixed very strange language in the documentation for - 'trace add execution'. [Bug 729821] - - * generic/tclCmdMZ.c (Tcl_TraceObjCmd): Made error message for 'trace - info' more consistent with documentation. [Bug 706961] - - * generic/tclDictObj.c (DictInfoCmd): Fixed memory leak caused by - confusion about string ownership. [Bug 731706] - -2003-05-05 Don Porter - - * generic/tclBasic.c: Implementation of TIP 90, which - * generic/tclCmdAH.c: extends the [catch] and [return] - * generic/tclCompCmds.c: commands to enable creation of a - * generic/tclExecute.c: proc that is a replacement for - * generic/tclInt.h: [return]. [Patch 531640] - * generic/tclProc.c: - * generic/tclResult.c: - * tests/cmdAH.test: - * tests/cmdMZ.test: - * tests/error.test: - * tests/proc-old.test: - - * library/tcltest/tcltest.tcl: The -returnCodes option to [test] - failed to recognize the symbolic name "ok" for return code 0. - -2003-05-05 Donal K. Fellows - - * generic/tclBasic.c (Tcl_HideCommand): Fixed error message for - grammar and spelling. - -2003-04-28 Donal K. Fellows - - * generic/tclDictObj.c (DictIncrCmd): Updated to reflect the behaviour - with wide increments of the normal [incr] command. - * generic/tclInt.decls: Added TclIncrWideVar2 to internal stub table - and cleaned up. - * tests/incr.test (incr-3.*): - * generic/tclVar.c (TclIncrWideVar2, TclPtrIncrWideVar): - * generic/tclExecute.c (TclExecuteByteCode): - * generic/tclCmdIL.c (Tcl_IncrObjCmd): Make [incr] work when trying to - increment by wide values. [Bug 728838] - - * generic/tclCompCmds.c (TclCompileSwitchCmd): Default mode of - operation of [switch] is exact matching. [Bug 727563] - -2003-04-25 Don Porter - - * generic/tclBasic.c: Tcl_EvalObjv() failed to honor the - TCL_EVAL_GLOBAL flag when resolving command names. Tcl_EvalEx passed a - string rep including leading whitespace and comments to - TclEvalObjvInternal(). - -2003-04-25 Andreas Kupries - - * win/tclWinThrd.c: Applied SF patch #727271. This patch changes the - code to catch any errors returned by the windows functions handling - TLS ASAP instead of waiting to get some mysterious crash later on due - to bogus pointers. Patch provided by Joe Mistachkin. - - This is a stop-gap measure to deal with the low number of ?TLS slots - provided by some of the variants of Windows (60-80). - -2003-04-24 Vince Darley - - * generic/tclFileName.c: fix to bug reported privately by Jeff where, - for example, 'glob -path {[tcl]} *' gets confused by the leading - special character (which is escaped internally), and instead lists - files in '/'. Bug only occurs on Windows where '\' is also a directory - separator. - * tests/fileName.test: added test for the above bug. - -2003-04-22 Andreas Kupries - - * The changes below fix SF bugs [593810], and [718045]. - - * generic/tclIO.c (Tcl_CutChannel, Tcl_SpliceChannel): Invoke - TclpCutSockChannel and TclpSpliceSockChannel. - - * generic/tclInt.h: Declare TclpCutSockChannel and - TclpSpliceSockChannel. - - * unix/tclUnixSock.c (TclpCutSockChannel, TclpSpliceSockChannel): - Dummy functions, on unix the sockets are _not_ handled specially. - - * mac/tclMacSock.c (TclpCutSockChannel, TclpSpliceSockChannel): - * win/tclWinSock.c (TclpCutSockChannel, TclpSpliceSockChannel): New - functions to handle socket specific cut/splice operations: auto-init - of socket system for thread on splice, management of the module - internal per-thread list of sockets, management of association of - sockets with HWNDs for event notification. - - * win/tclWinSock.c (NewSocketInfo): Extended initialization - assignments to cover all items of the structure. During debugging of - the new code mentioned above I found that two fileds could contain - bogus data. - - * win/tclWinFile.c: Added #undef HAVE_NO_FINDEX_ENUMS before - definition because when compiling in debug mode the compiler complains - about a redefinition, and this warning is also treated as an error. - -2003-04-21 Don Porter - - * library/tcltest/tcltest.tcl: When the return code of a test does - not meet expectations, report that as the reason for test failure, and - do not attempt to check the test result for correctness. [Bug 725253] - -2003-04-18 Jeff Hobbs - - * win/tclWinInt.h (VER_PLATFORM_WIN32_CE): conditionally define. - * win/tclWinInit.c: recognize Windows CE as a Win platform. This just - recognizes CE - full support will come later. - - * win/configure: regen - * win/configure.in (SHELL): force it to /bin/sh as autoconf 2.5x - uses /bin/bash, which can fail to find exes in the path (ie: lib). - - * generic/tclExecute.c (ExprCallMathFunc): remove incorrect - extraneous cast from Tcl_WideAsDouble. - -2003-04-18 Donal K. Fellows - - * doc/open.n: Moved serial port options from [fconfigure] to - * doc/fconfigure.n: [open] as it is up to the creator of a channel - to describe the channel's special config - options. [Bug 679010] - -2003-04-16 Don Porter - - * generic/tcl.h: Made changes so that the "wideInt" Tcl_ObjType - * generic/tclObj.c: is defined on all platforms, even those where - * generic/tclPort.h: TCL_WIDE_INT_IS_LONG is defined. Also made the - Tcl_Value struct have a wideValue field on all platforms. This is a - ***POTENTIAL INCOMPATIBILITY*** for TCL_WIDE_INT_IS_LONG platforms - because that struct changes size. This is the same TIP 72 - incompatibility that was seen on other platforms at the 8.4.0 release, - when this change should have happened as well. [Bug 713562] - - * generic/tclInt.h: New internal macros TclGetWide() and - TclGetLongFromWide() to deal with both forms of the "wideInt" - Tcl_ObjType, so that conditional TCL_WIDE_INT_IS_LONG code is confined - to the header file. - - * generic/tclCmdAH.c: Replaced most coding that was conditional - * generic/tclCmdIL.c: on TCL_WIDE_INT_IS_LONG with code that - * generic/tclExecute.c: works across platforms, sometimes using - * generic/tclTest.c: the new macros above to do it. - * generic/tclUtil.c: - * generic/tclVar.c: - -2003-04-17 Donal K. Fellows - - * doc/socket.n: Added a paragraph to remind people to specify their - encodings when using sockets. [Bug 630621] - -2003-04-16 Donal K. Fellows - - * doc/CrtMathFnc.3: Functions also have to deal with wide ints, but - this was not documented. [Bug 709720] - -2003-04-16 Vince Darley - - * generic/tclPathObj.c: removed undesired 'static' for function which - is now shared (previously it was duplicated). - -2003-04-15 Joe English - - * doc/namespace.n: added example section "SCOPED SCRIPTS", supplied by - Kevin Kenny. [Bug 219183] - -2003-04-15 Kevin Kenny - - * makefile.vc: Updated makefile.vc to conform with Mo DeJong's changes - to Makefile.in and tclWinPipe.c on 2003-04-14. Now passes TCL_PIPE_DLL - in place of TCL_DBGX. - * win/tclWinTime.c: Corrected use of types to make compilation - compatible with VC++5. - -2003-04-15 Vince Darley - - * generic/tclIOUtil.c: finished check-in from yesterday, removing - duplicate function definition. - -2003-04-14 Don Porter - - * generic/tclClock.c: Corrected compiler warnings. - * generic/tclTest.c: - -2003-04-14 Mo DeJong - - * win/Makefile.in: Don't define TCL_DBGX symbol for every compile. - Instead, define TCL_PIPE_DLL only when compiling tclWinPipe.c. This - will break other build systems, so they will need to remove the - TCL_DBGX define and replace it with a define for TCL_PIPE_DLL. - * win/tclWinPipe.c (TclpCreateProcess): Remove PREFIX_IDENT and - DEBUG_IDENT from top of file. Use TCL_PIPE_DLL passed in from build - env instead of trying to construct the dll name from already defined - symbols. This approach is more flexible and better in the long run. - -2003-04-14 Kevin Kenny - - * win/tclWinFile.c: added conditionals to restore compilation on - VC++6, which was broken by recent changes. - -2003-04-14 Vince Darley - - * generic/tclIOUtil.c: - * generic/tclPathObj.c: - * generic/tclFileSystem.h: overlooked one function which was - duplicated, so this is now shared between modules. - * win/tclWinFile.c: allow this file to compile with VC++ 5.2 again - since Mingw build fixes broke that. - -2003-04-13 Mo DeJong - - * win/configure: Regen. - * win/configure.in: Add check for FINDEX_INFO_LEVELS from winbase.h, - known to be a problem in VC++ 5.2. Define HAVE_NO_FINDEX_ENUMS if the - define does not exist. - * win/tclWinFile.c: Put declarations for FINDEX_INFO_LEVELS and - FINDEX_SEARCH_OPS inside a check for HAVE_NO_FINDEX_ENUMS so that - these are not declared twice. This fixes the Mingw build. - * win/tclWinTime.c: Rework the init of timeInfo so that the number or - initializers matches the declaration. This was broken under Mingw. Add - cast to avoid compile warning when calling the AccumulateSample - function. - -2003-04-12 Jeff Hobbs - - * win/Makefile.in (GENERIC_OBJS): add missing tclPathObj.c - -2003-04-12 Kevin Kenny - - * doc/clock.n: - * generic/tclClock.c (Tcl_ClockObjCmd): - * tests/clock.test: Implementation of TIP #124. Also renumbered test - cases to avoid duplicates. [Bug 710310] - * tests/winTime.test: - * win/tclWinTest.c (TestwinclockCmd, TestwinsleepCmd): - * win/tclWinTime.c (Tcl_WinTime, UpdateTimeEachSecond, - (ResetCounterSamples, AccumulateSample, SAMPLES, TimeInfo): Made - substantial changes to the phase-locked loop (replaced an IIR filter - with an FIR one) in a quest for improved loop stability (Bug not - logged at SF, but cited in private communication from Jeff Hobbs). - -2003-04-11 Don Porter - - * generic/tclCmdMZ.c (Tcl_StringObjCmd,STR_IS_INT): Corrected - inconsistent results of [string is integer] observed on systems where - sizeof(long) != sizeof(int). [Bug 718878] - * tests/string.test: Added tests for Bug 718878. - * doc/string.n: Clarified that [string is integer] accepts 32-bit - integers. - -2003-04-11 Andreas Kupries - - * generic/tclIO.c (UpdateInterest): When dropping interest in - TCL_READABLE now dropping interest in TCL_EXCEPTION too. This fixes a - bug where Expect detects eof on a file prematurely on solaris 2.6 and - higher. A much more complete explanation is in the code itself (40 - lines of comments for a one-line change :) - -2003-04-11 Vince Darley - - * tests/cmdAH.test: fix test suite problem if /home is a symlink. [Bug - 703264] - * generic/tclIOUtil.c: fix bad error message with 'cd ""'. [Bug - 704917] - * win/tclWinFile.c, win/tclWin32Dll.c: - * win/tclWinInt.h: allow Tcl to differentiate between reparse points - which are symlinks and mounted volumes, and correctly handle the - latter. This involves some elaborate code to find the actual drive - letter (if possible) corresponding to a mounted volume. [Bug 697862] - * tests/fileSystem.test: add constraints to stop tests running in - ordinary tcl interpreter. [Bug 705675] - - * generic/tclIOUtil.c: - * generic/tclPathObj.c: (new file) - * generic/tclFileSystem.h: (new file) - * win/makefile.vc: - Split path object handling out of the virtual filesystem layer, into - tclPathObj.c. This refactoring cleans up the internal filesystem code, - and will make any future optimisations and forthcoming better - thread-safety much easier. - - * generic/tclTest.c: - * tests/reg.test: added some 'knownBug' tests for problems in Tcl's - regexp code with the TCL_REG_CAN_MATCH flag (see Bug 703709). Code too - impenetrable to fix right now, but a fix is needed for tip113 to work - correctly. - - * tests/fCmd.test - * win/tclWinFile.c: added some filesystem optimisation to the 'glob' - implementation, and some new tests. - - * generic/tclCmdMZ.c: fix typo in comment - - * tests/winFile.test: - * tests/ioUtil.test: - * tests/unixFCmd.test: renumbered tests with duplicate numbers. [Bug - 710361] - -2003-04-10 Donal K. Fellows - - * doc/binary.n: Fixed typo in [binary format w] desc. [Bug 718543] - -2003-04-08 Donal K. Fellows - - * generic/tclCmdAH.c (Tcl_ErrorObjCmd): Strings are only empty if - they have zero length, not if their first byte is zero, so fix test - guarding Tcl_AddObjErrorInfo to take this into account. [Bug - reported by Don Porter; no bug-id.] - -2003-04-07 Don Porter - - * generic/tclCompCmds.c (TclCompileIfCmd): Corrected string limits of - arguments interpolated in error messages. [Bug 711371] - - * generic/tclCmdMZ.c (TraceExecutionProc): Added missing - Tcl_DiscardResult() call to avoid memory leak. - -2003-04-07 Donal K. Fellows - - * generic/tclDictObj.c (Tcl_DictObjCmd): Stopped compilers from - moaning about switch fall-through. [Bug 716327] - (DictFilterCmd): Yet more warning killing, this time reported by - Miguel Sofer by private chat. - -2003-04-07 Donal K. Fellows - - * tests/dict.test (dict-2.6): - * generic/tclDictObj.c (Tcl_NewDictObj, Tcl_DbNewDictObj): Oops! - Failed to fully initialise the Dict structure. - (DictIncrCmd): Moved valueAlreadyInDictionary label to stop compiler - complaints. [Bug 715751] - - * generic/tclDictObj.c (DictIncrCmd): Followed style in the rest of - the core by commenting out wide-specific operations on platforms where - wides are longs, and used longs more thoroughly than ints through - [dict incr] anyway to forestall further bugs. - * generic/tclObj.c: Made sure there's always a tclWideIntType - implementation available, not that it is always useful. [Bug 713562] - -2003-04-05 Donal K. Fellows - - * generic/tclDictObj.c: Removed commented out notes on declarations to - be moved to elsewhere in the Tcl core. - - * generic/tclInt.h: Final stages of plumbing in. - * generic/tclBasic.c: - * generic/tclObj.c (TclInitObjSubsystem): - - * unix/Makefile.in, win/Makefile.in, win/makefile.[bv]c: Build support. - * generic/tcl.decls: Added dict public API to stubs table. - * generic/tcl.h (Tcl_DictSearch): Added declaration of structure to - allow user code to iterate over dictionaries. - - * doc/DictObj.3: New files containing dictionary implementation - * doc/dict.n: documentation and tests as as mandated by TIP - * generic/tclDictObj.c: #111. - * tests/dict.test: - -2003-04-03 Mo DeJong - - * unix/configure: - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Don't set TCL_LIBS if it is already - set to support use of TCL_LIBS var from tclConfig.sh in the Tk - configure script. - -2003-04-03 Mo DeJong - - * unix/Makefile.in: Don't subst MATH_LIBS, LIBS, and DL_LIBS - separately. Instead, just subst TCL_LIBS since it includes the - others. - * unix/configure: Regen. - * unix/tcl.m4 (SC_CONFIG_CFLAGS, SC_TCL_LINK_LIBS): Set and subst - TCL_LIBS in SC_CONFIG_CFLAGS instead of SC_TCL_LINK_LIBS. Don't subst - MATH_LIBS since it is now covered by TCL_LIBS. - * unix/tclConfig.sh.in: Use TCL_LIBS instead of DL_LIBS, LIBS, and - MATH_LIBS. - * unix/dltest/Makefile.in: Ditto. - -2003-04-03 Don Porter - - * generic/tclCompCmds.c (TclCompileReturnCmd): Now that [return] - compiles to INST_RETURN, it is safe to compile even outside a proc. - -2003-04-02 Mo DeJong - - * win/configure: Regen. - * win/configure.in: Set stub lib flag based on new LIBFLAGSUFFIX - variable. - * win/tcl.m4 (SC_CONFIG_CFLAGS): Set new LIBFLAGSUFFIX that works like - LIBSUFFIX, it is used when creating library names. The previous - implementation would generate -ltclstub85 instead of -ltclstub85s when - configured with --disable-shared. - -2003-04-02 Don Porter - - * generic/tclParse.c (TclSubstTokens): Moved declaration of - utfCharBytes to beginning of procedure so that it does not go out of - scope (get free()d) while append is still pointing to it. [Bugs - 703167, 713754] - -2003-04-01 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Check for inet_ntoa in -lbind inside - the BeOS block since doing it later broke the build under SuSE 7.3. - [Bug 713128] - -2003-04-01 Don Porter - - * tests/README: Direct [source] of *.test files is no longer - recommended. The tests/*.test files should only be evaluated under the - control of the [runAllTests] command in tests/all.tcl. - - * generic/tclExecute.c (INST_RETURN): Bytecompiled [return] failed to - reset iPtr->returnCode, causing tests parse-18.17 and parse-18.21 to - fail strangely. - * tests/parse.test (parse-18.21): Corrected now functioning test. - Added further coverage tests. - -2003-03-31 Don Porter - - * tests/parse.test (parse-18.*): Coverage tests for the new - implementation of Tcl_SubstObj(). Note that tests parse-18.17 and - parse-18.21 demonstrate some bugs left to fix in the current code. - -2003-03-27 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Use -Wl,--export-dynamic instead of - -rdynamic for LDFLAGS. The -rdynamic is not documented so it seems - better to pass the --export-dynamic flag to the linker. [Patch 573395] - -2003-03-27 Miguel Sofer - - * tests/encoding.test: - * tests/proc-old.test: - * tests/set-old.test: Altered test numers to eliminate duplicates, - [Bugs 710313, 710320, 710352] - -2003-03-27 Donal K. Fellows - - * tests/parseOld.test: Altered test numers to eliminate duplicates. - * tests/parse.test: [Bugs 710365, 710369] - * tests/expr-old.test: - * tests/expr.test: - - * tests/utf.test: Altered test numers to eliminate duplicates. - * tests/trace.test: [Bugs 710322, 710327, 710349, 710363] - * tests/lsearch.test: - * tests/list.test: - * tests/info.test: - * tests/incr-old.test: - * tests/if-old.test: - * tests/format.test: - * tests/foreach.test: - -2003-03-26 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4 (SC_CONFIG_CFLAGS, SC_TCL_LINK_LIBS): Add BeOS system to - SC_CONFIG_CFLAGS. Check for inet_ntoa in -lbind, needed for BeOS. - -2003-03-26 Don Porter - - * doc/tcltest.n: - * library/tcltest/tcltest.tcl: Added reporting during [configure - -debug 1] operations to warn about multiple uses of the same test - name. [FRQ 576693] - - * tests/msgcat.test (msgcat-2.2.1): changed test name to avoid - duplication. [Bug 710356] - - * unix/dltest/pkg?.c: Changed all Tcl_InitStubs calls to pass - argument exact = 0, so that rebuilds are not required when Tcl - bumps to a new version. [Bug 701926] - -2003-03-24 Miguel Sofer - - * generic/tclVar.c: - * tests/var.test: fixing ObjMakeUpvar's lookup algorithm for the - created local variable. [Bug 631741] (Chris Darroch) and [Bug 696893] - (David Hilker) - -2003-03-24 Pat Thoyts - - * library/dde/pkgIndex.tcl: bumped version to 1.2.2 in tclWinDde.c, - now adding here too. - -2003-03-22 Kevin Kenny - - * library/dde/pkgIndex.tcl: - * library/reg/pkgIndex.tcl: Fixed a bug where [package require dde] - or [package require registry] attempted to load the release version - of the DLL into a debug build. [Bug 708218] Thanks to Joe Mistachkin - for the patch. - * win/makefile.vc: Added quoting around the script name in the 'test' - target; Joe Mistachkin insists that he has a configuration that fails - to launch tcltest without it, and it appears harmless otherwise. - -2003-03-22 Pat Thoyts - - * win/tclWinDde.c: Make dde services conform the the documentation - such that giving only a topic name really returns all services with - that topic. [Bug 219155] - Prevent hangup caused by dde server applications failing to process - messages. [Bug 707822] - * tests/winDde.test: Corrected labels and added a test for search by - topic name. - -2003-03-20 Don Porter - - * generic/tclInt.h (tclOriginalNotifier): - * generic/tclStubInit.c (tclOriginalNotifier): - * mac/tclMacNotify.c (Tcl_SetTimer,Tcl_WaitForEvent): - * unix/tclUnixNotfy.c (Tcl_SetTimer,Tcl_WaitForEvent, - (Tcl_CreateFileHandler,Tcl_DeleteFileHandler): - * win/tclWinNotify.c (Tcl_SetTimer,Tcl_WaitForEvent): Some linkers - apparently use a different representation for a pointer to a function - within the same compilation unit and a pointer to a function in a - different compilation unit. This causes checks like those in the - original notifier procedures to fall into infinite loops. The fix is - to store pointers to the original notifier procedures in a struct - defined in the same compilation unit as the stubs tables, and compare - against those values. [Bug 707174] - - * generic/tclInt.h: Removed definition of ParseValue struct that is - no longer used. - -2003-03-19 Miguel Sofer - - * generic/tclCompile.c: - * tests/compile.test: bad command count on TCL_OUT_LINE_COMPILE. - [Bug 705406] (Don Porter) - -2003-03-19 Don Porter - - * library/auto.tcl: Replaced [regexp] and [regsub] with - * library/history.tcl: [string map] where possible. Thanks - * library/ldAout.tcl: to David Welton. [Bugs 667456,667558] - * library/safe.tcl: Bumped to http 2.4.3, opt 0.4.5, and - * library/http/http.tcl: tcltest 2.2.3. - * library/http/pkgIndex.tcl: - * library/opt/optparse.tcl: - * library/opt/pkgIndex.tcl: - * library/tcltest/tcltest.tcl: - * library/tcltest/pkgIndex.tcl: - * tools/genStubs.tcl: - * tools/tcltk-man2html.tcl: - * unix/mkLinks.tcl: - - * doc/Eval.3 (Tcl_EvalObjEx): Corrected CONST and - * doc/ParseCmd.3 (Tcl_EvalTokensStandard): return type errors in - documentation. [Bug 683994] - - * generic/tclCompCmds.c (TclCompileReturnCmd): Alternative fix for - * generic/tclCompile.c (INST_RETURN): [Bug 633204] that uses a new - * generic/tclCompile.h (INST_RETURN): bytecode INST_RETURN to - * generic/tclExecute.c (INST_RETURN): properly bytecode the [return] - command to something that returns TCL_RETURN. - -2003-03-18 Mo DeJong - - * win/configure: Regen. - * win/configure.in: Don't run the AC_CYGWIN macro since it uses - AC_CANONICAL_HOST under autoconf 2.5X. Just check to see if __CYGWIN__ - is defined by the compiler and set the ac_cv_cygwin variable based on - that. [Bug 705912] - -2003-03-18 Kevin Kenny - - * tests/registry.test: Changed the conditionals to avoid an abort if - [testlocale] is missing, as when running the test in tclsh rather than - tcltest. [Bug 705677] - -2003-03-18 Daniel Steffen - - * tools/tcltk-man2html.tcl: added support for building 'make html' - from inside distribution directories named with 8.x.x version numbers. - tcltk-man2html now uses the latest tcl8.x.x resp. tk8.x.x directories - found inside its --srcdir argument. - -2003-03-17 Mo DeJong - - * tests/format.test: Renumber tests, a bunch of tests all had the same - id. - -2003-03-17 Donal K. Fellows - - * doc/lsearch.n: Altered documentation of -ascii options so - * doc/lsort.n: they don't specify that they operate on ASCII - strings, which they never did anyway. [Bug - 703807] - -2003-03-14 Donal K. Fellows - - * generic/tclCmdAH.c (Tcl_FormatObjCmd): Only add the modifier that - indicates we've got a wide int when we're formatting in an integer - style. Stops some libc's from going mad. [Bug 702622] Also tidied - whitespace. - -2003-03-13 Mo DeJong - - * win/tcl.m4 (SC_WITH_TCL): Port version number fix that was made in - tk instead of tcl sources. - -2003-03-13 Mo DeJong - - Require autoconf 2.57 or newer, see TIP 34 for a detailed explanation - of why this is good. This will no doubt break the build on some - platforms, let the flaming begin. - - * tools/configure: Regen with autoconf 2.57. - * tools/configure.in: Require autoconf 2.57. - * unix/configure: Regen with autoconf 2.57. - * unix/configure.in: Require autoconf 2.57. - Apply AC_LIBOBJ changes from patch 529884. - * unix/tcl.m4: Ditto. - * win/configure: Regen with autoconf 2.57. - * win/configure.in: Require autoconf 2.57. - Don't subst LIBOBJS since this happens by default, this avoids an - autoconf error. - -2003-03-12 Don Porter - - * generic/tclBasic.c (Tcl_EvalTokensStandard): - * generic/tclCmdMZ.c (Tcl_SubstObj): - * generic/tclCompCmds.c (TclCompileSwitchCmd): - * generic/tclCompExpr.c (CompileSubExpr): - * generic/tclCompile.c (TclSetByteCodeFromAny,TclCompileScript, - (TclCompileTokens,TclCompileCmdWord): - * generic/tclCompile.h (TclCompileScript): - * generic/tclExecute.c (TclCompEvalObj): - * generic/tclInt.h (Interp,TCL_BRACKET_TERM,TclSubstTokens): - * generic/tclParse.c (ParseTokens,Tcl_SubstObj,TclSubstTokens): - * tests/subst.test (2.4, 8.7, 8.8, 11.4, 11.5): - Substantial refactoring of Tcl_SubstObj to make use of the same - parsing and substitution procedures as normal script evaluation. - Tcl_SubstObj() moved to tclParse.c. New routine TclSubstTokens() - created in tclParse.c which implements all substantial functioning of - Tcl_EvalTokensStandard(). TclCompileScript() loses its "nested" - argument, the Tcl_Interp struct loses its termOffset field and the - TCL_BRACKET_TERM flag in the evalFlags field, all of which were only - used (indirectly) by Tcl_SubstObj(). Tests subst-8.7,8.8,11.4,11.5 - modified to accomodate the only behavior change: reporting of parse - errors now takes precedence over [return] and [continue] exceptions. - All other behavior should remain compatible. [RFE 536831,684982] [Bug - 685106] - - * generic/tcl.h: Removed TCL_PREFIX_IDENT and TCL_DEBUG_IDENT - * win/tclWinPipe.c: from tcl.h -- they are not part of Tcl's - public interface. Put them in win/tclWinPipe.c where they are used. - - * generic/tclInterp.c (Tcl_InterpObjCmd): Corrected and added - * tests/interp.test (interp-2.13): test for option - parsing beyond objc for [interp create --]. Thanks to Marco Maggi. - [Bug 702383] - -2003-03-11 Kevin Kenny - - * win/makefile.vc: Added two missing uses of $(DBGX) so that - tclpip8x.dll loads without panicking on Win9x. - -2003-03-09 Kevin Kenny - - * generic/tclTest.c (TestChannelCmd): Removed an unused local variable - that caused compilation problems on some platforms. - -2003-03-08 Don Porter - - * doc/tcltest.n: Added missing "-body" to example. Thanks to Helmut - Giese. [Bug 700011] - -2003-03-07 Mo DeJong - - * tests/io.test: - * tests/ioCmd.test: Define a fcopy constraint and add it to the - constraint list of any test that depends on the fcopy command. This is - only useful to Jacl which does not support fcopy. - -2003-03-07 Mo DeJong - - * tests/encoding.test: Name temp files *.tcltestout instead of *.out - so that when they are removed later, we don't accidently toast any - files named *.out that the user has created in the build directory. - -2003-03-07 Donal K. Fellows - - * generic/tclCmdAH.c (Tcl_FileObjCmd): Fix the setting of a file's - mtime and atime on 64-bit platforms. [Bug 698146] - -2003-03-06 Mo DeJong - - * tests/io.test: Doh! Undo accidental commenting out of a couple of - tests. - -2003-03-06 Mo DeJong - - * tests/io.test: Define a fileevent constraint and add it to the - constraint list of any test that depends on the fileevent command. - This is only useful to Jacl which does not support fileevent. - -2003-03-06 Mo DeJong - - * tests/io.test: Define an openpipe constraint and add it to the - constraint list of any test that creates a pipe using the open - command. This is only useful to Jacl which does not support pipes. - -2003-03-06 Don Porter - - * generic/TclUtf.c (Tcl_UniCharNcasecmp): Corrected failure to - * tests/utf.test (utf-25.*): properly compare Unicode strings of - different case in a case insensitive manner. [Bug 699042] - -2003-03-06 Kevin Kenny - - * generic/tclCompCmds.c (TclCompileSwitchCmd): - Replaced a non-portable 'bzero' with a portable 'memset'. [Bug 698442] - -2003-03-06 Mo DeJong - - * generic/tclIO.c (Tcl_Seek, Tcl_OutputBuffered): If there is data - buffered in the statePtr->curOutPtr member then set the BUFFER_READY - flag in Tcl_Seek. This is needed so that the next call to FlushChannel - will write any buffered bytes before doing the seek. The existing code - would set the BUFFER_READY flag inside the Tcl_OutputBuffered - function. This was a programming error made when Tcl_OutputBuffered - was originally created in CVS revision 1.35. The setting of the - BUFFER_READY flag should not have been included in the - Tcl_OutputBuffered function. - * generic/tclTest.c (TestChannelCmd): Use the Tcl_InputBuffered and - Tcl_OutputBuffered util methods to query the amount of buffered input - and output. - -2003-03-06 Mo DeJong - - * generic/tclIO.c (Tcl_Flush): Compare the nextAdded member of the - ChannelBuffer to the nextRemoved member to determine if any output has - been buffered. The previous check against the value 0 seems to have - just been a coding error. See other methods like Tcl_OutputBuffered - for examples where nextAdded is compared to nextRemoved to find the - number of bytes buffered. - -2003-03-06 Mo DeJong - - * generic/tclIO.c (Tcl_GetsObj): Check that the eol pointer has not - gone past the end of the string when in auto translation mode and the - INPUT_SAW_CR flag is set. The previous code worked because the end of - string value \0 was being compared to \n, this patch just skips that - pointless check. - -2003-03-06 Mo DeJong - - * generic/tclIO.c (WriteBytes, WriteChars, Tcl_GetsObj, ReadBytes): - Rework calls to TranslateOutputEOL to make it clear that a boolean - value is being returned. Add some comments in an effort to make the - code more clear. This patch makes no functional changes. - -2003-03-06 Mo DeJong - - * generic/tclIO.c (Tcl_SetChannelOption): Invoke the - Tcl_SetChannelBufferSize method as a result of changing the - -buffersize option to fconfigure. The previous implementation used - some inlined code that reset the buffer size to the default size - instead of ignoring the request as implemented in - Tcl_SetChannelBufferSize. - * tests/io.test: Update test case so that it actually checks the - implementation of Tcl_SetChannelBufferSize. - -2003-03-05 David Gravereaux - - * win/rules.vc: updated default tcl version to 8.5. - -2003-03-05 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileSwitchCmd): First attempt at a - bytecode-compiled switch command. It only handles the most common case - of switching, but that should be enough for this to speed up a lot of - people's code. It is expected that the speed gains come from two - things: better handling of the switch itself, and integrated - compilation of the arms instead of embedding separate bytecode - sequences (i.e. better local variable handling.) - * tests/switch.test (switch-10.*): Tests of both uncompiled and - compiled switch behaviour. [Patch #644819] - - * generic/tclCompile.h (TclFixupForwardJumpToHere): Additional macro - to make the most common kind of jump fixup a bit easier. - -2003-03-04 Don Porter - - * README: Bumped version number of - * generic/tcl.h: Tcl to 8.5a0. - * library/init.tcl: - * mac/README: - * macosx/Tcl.pbproj/project.pbxproj: - * tests/basic.test: - * tools/configure.in: - * tools/tcl.hpj.in: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/README: - * win/README.binary: - * win/configure.in: - * win/makefile.bc: - * win/makefile.vc: - * win/tcl.m4: - - * tools/configure: autoconf - * unix/configure: - * win/configure: - -2003-03-03 Jeff Hobbs - - *** 8.4.2 TAGGED FOR RELEASE *** - -2003-03-03 Daniel Steffen - - Mac OS Classic specific fixes: - * generic/tclIOUtil.c (TclNewFSPathObj): on TCL_PLATFORM_MAC, skip - potential directory separator at the beginning of addStrRep. - * mac/tclMacChan.c (OpenFileChannel, CommonWatch): followup fixes to - cut and splice implementation for file channels. - * mac/tclMacFile.c (TclpUtime): pass native path to utime(). - * mac/tclMacFile.c (TclpObjLink): correctly implemented creation of - alias files via new static proc CreateAliasFile(). - * mac/tclMacPort.h: define S_ISLNK macro to fix stat'ing of links. - * mac/tclMacUtil.c (FSpLocationFromPathAlias): fix to enable stat'ing - of broken links. - -2003-03-03 Kevin Kenny - - * win/Makefile.vc: corrected bug introduced by 'g' for debug builds. - -2003-03-03 Don Porter - - * library/dde/pkgIndex.tcl: dde bumped to version 1.2.1 for - * win/tclWinDde.c: bundled release with Tcl 8.4.2 - - * library/reg/pkgIndex.tcl: registry bumped to version 1.1.1 for - * win/tclWinReg.c: bundled release with Tcl 8.4.2 - - * library/opt/pkgIndex.tcl: updated package index to version 0.4.4 - -2003-02-28 Jeff Hobbs - - * win/configure: - * win/configure.in: check for 'g' for debug build type, not 'd'. - * win/rules.vc (DBGX): correct to use 'g' for nmake win makefile to - match the cygwin makefile for debug builds. [Bug 635107] - -2003-02-28 Vince Darley - - * doc/file.n: subcommand is 'file volumes' not 'file volume' - -2003-02-27 Jeff Hobbs - - * generic/tclIOUtil.c (MakeFsPathFromRelative): removed dead code - check of typePtr (darley). - - * tests/winTime.test: added note about PCI hardware dependency issues - with high performance clock. - -2003-02-27 Donal K. Fellows - - * tests/lsearch.test (lsearch-10.7): - * generic/tclCmdIL.c (Tcl_LsearchObjCmd): Stopped -start option from - causing an option when used with an empty list. [Bug 694232] - -2003-02-26 Chengye Mao - - * win/tclWinInit.c: fixed a bug in TclpSetVariables by initializing - dwUserNameLen with the sizeof(szUserName) before calling GetUserName. - Don't know if this bug has been recorded: it caused crash in starting - Tcl or wish in Windows. - -2003-02-26 Jeff Hobbs - - * generic/tclCmdMZ.c (TraceCommandProc): Fix mem leak when deleting a - command that had trace on it. [Bug 693564] (sofer) - -2003-02-25 Don Porter - - * doc/pkgMkIndex.n: Modified [pkg_mkIndex] to use -nocase matching - * library/package.tcl: of -load patterns, to better accomodate common - user errors due to confusion between [package names] names and [info - loaded] names. - -2003-02-25 Andreas Kupries - - * tests/pid.test: See below [Bug 678412]. - * tests/io.test: Made more robust against spaces in paths [Bug 678400] - -2003-02-25 Miguel Sofer - - * tests/execute.test: cleaning up testobj's at the end, to avoid - leak warning by valgrind. - -2003-02-22 Zoran Vasiljevic - - * generic/tclEvent.c (Tcl_FinalizeThread): Fix [Bug 571002] - -2003-02-21 Donal K. Fellows - - * tests/binary.test (binary-44.[34]): - * generic/tclBinary.c (ScanNumber): Fixed problem with unwanted - sign-bit propagation when scanning wide ints. [Bug 690774] - -2003-02-21 Daniel Steffen - - * mac/tclMacChan.c (TclpCutFileChannel, TclpSpliceFileChannel): - Implemented missing cut and splice procs for file channels. - -2003-02-21 Don Porter - - * library/package.tcl (tclPkgUnknown): Minor performance tweaks to - reduce the number of [file] invocations. Meant to improve startup - times, at least a little bit. [Patch 687906] - -2003-02-20 Daniel Steffen - - * unix/tcl.m4: - * unix/tclUnixPipe.c: (macosx) use vfork() instead of fork() to create - new processes, as recommended by Apple (vfork can be up to 100 times - faster thank fork on macosx). - * unix/configure: regen. - -2003-02-20 Jeff Hobbs - - * generic/tclEncoding.c (LoadTableEncoding): - * library/encoding/cp932.enc: Correct jis round-trip encoding - * library/encoding/euc-jp.enc: by adding 'R' type to .enc files. - * library/encoding/iso2022-jp.enc: [Patch 689341] (koboyasi, taguchi) - * library/encoding/jis0208.enc: - * library/encoding/shiftjis.enc: - * tests/encoding.test: - - * unix/tclUnixChan.c (Tcl_MakeTcpClientChannel): add - MakeTcpClientChannelMode that takes actual mode flags to avoid hang on - OS X (may be OS X bug, but patch works x-plat). [Bug 689835] (steffen) - -2003-02-20 Donal K. Fellows - - * doc/regsub.n: Typo fix [Bug 688943] - -2003-02-19 Jeff Hobbs - - * unix/tclUnixThrd.c (TclpReaddir): - * unix/tclUnixPort.h: update to Bug 689100 patch to ensure that there - is a defined value of MAXNAMLEN (aka NAME_MAX in POSIX) and that we - have some buffer allocated. - -2003-02-19 Daniel Steffen - - * generic/tclStringObj.c: restored Tcl_SetObjLength() side-effect of - always invalidating unicode rep (if the obj has a string rep). Added - hasUnicode flag to String struct, allows decoupling of validity of - unicode rep from buffer size allocated to it (improves memory - allocation efficiency). [Bugs 686782, 671138, 635200] - - * macosx/Tcl.pbproj/project.pbxproj: - * macosx/Makefile: reworked embedded build to no longer require - relinking but to use install_name_tool instead to change the - install_names for embedded frameworks. [Bug 644510] - - * macosx/Tcl.pbproj/project.pbxproj: preserve mod dates when running - 'make install' to build framework (avoids bogus rebuilds of dependent - frameworks because tcl headers appear changed). - - * tests/ioCmd.test (iocmd-1.8): fix failure when system encoding is - utf-8: use iso8859-1 encoding explicitly. - -2003-02-18 Miguel Sofer - - * generic/tclCompile.c (TclCompileExprWords): remove unused variable - "range" [Bug 664743] - * generic/tclExecute.c (ExprSrandFunc): remove unused variable - "result" [Bug 664743] - * generic/tclStringObj.c (UpdateStringOfString): remove unused - variable "length" [Bug 664751] - * tests/execute.test (execute-7.30): fix for [Bug 664775] - -2003-02-18 Andreas Kupries - - * unix/tcl.m4: [Bug #651811] Added definition of _XOPEN_SOURCE and - linkage of 'xnet' library to HP 11 branch. This kills a lot of - socket-related failures in the testsuite when Tcl was compiled in 64 - bit mode (both PA-RISC 2.0W, and IA 64). - - * unix/configure: Regenerated. - -2003-02-18 Jeff Hobbs - - * generic/tclIO.c (HaveVersion): correctly decl static - - * unix/tclUnixThrd.c (TclpReaddir): reduce size of name string in tsd - to NAME_MAX instead of PATH_MAX. [Bug 689100] (waters) - -2003-02-18 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4 (SC_ENABLE_THREADS): Make sure -lpthread gets passed on - the link line when checking for the pthread_attr_setstacksize symbol. - -2003-02-18 Vince Darley - - * generic/tclTest.c: cleanup of new 'simplefs' test code, and better - documentation. - -2003-02-17 Miguel Sofer - - * generic/tclBasic.c (TclRenameCommand): fixing error in previous - commit. - -2003-02-17 Jeff Hobbs - - * generic/tclExecute.c (TclExecuteByteCode INST_STR_MATCH): - * generic/tclCmdMZ.c (Tcl_StringObjCmd STR_MATCH): - * generic/tclUtf.c (TclUniCharMatch): - * generic/tclInt.decls: add private TclUniCharMatch function that - * generic/tclIntDecls.h: does string match on counted unicode - * generic/tclStubInit.c: strings. Tcl_UniCharCaseMatch has the failing - * tests/string.test: that it can't handle strings or patterns with - * tests/stringComp.test: embedded NULLs. Added tests that actually try - strings/pats with NULLs. TclUniCharMatch should be TIPed and made - public in the next minor version rev. - -2003-02-17 Miguel Sofer - - * generic/tclBasic.c (TclRenameCommand): 'oldFullName' object was not - being freed on all function exits, causing a memory leak. [Bug 684756] - -2003-02-17 Mo DeJong - - * generic/tclIO.c (Tcl_GetsObj): Minor change so that eol is only - assigned at the top of the TCL_TRANSLATE_AUTO case block. The other - cases assign eol so this does not change any functionality. - -2003-02-17 Kevin Kenny - - * tests/notify.test: Removed Windows line terminators. [Bug 687913]. - -2003-02-15 Miguel Sofer - - * generic/tclBasic.c (Tcl_EvalEx): - * generic/tclCompExpr.c (CompileSubExpr): - * generic/tclCompile.c (TclCompileScript): - * generic/tclParse.c (Tcl_ParseCommand, ParseTokens): - * generic/tclParseExpr.c (ParsePrimaryExpr): - * tests/basic.test (47.1): - * tests/main.test (3.4): - * tests/misc.test (1.2): - * tests/parse.test (6.18): - * tests/parseExpr.test (15.35): - * tests/subst.test (8.6): Don Porter's fix for bad parsing of nested - scripts. [Bug 681841] - -2003-02-15 Kevin Kenny - - * tests/notify.test (new-file): - * generic/tclTest.c (TclTest_Init, EventtestObjCmd, EventtestProc, - (EventTestDeleteProc): - * generic/tclNotify.c (Tcl_DeleteEvents): Fixed Tcl_DeleteEvents not - to get a pointer smash when deleting the last event in the queue. - Added test code in 'tcltest' and a new file of test cases - 'notify.test' to exercise this functionality; several of the new test - cases fail for the original code and pass for the corrected code. [Bug - 673714] - - * unix/tclUnixTest.c (TestfilehandlerCmd): Corrected a couple of typos - in error messages. [Bug 596027] - -2003-02-14 Jeff Hobbs - - * README: Bumped to version 8.4.2. - * generic/tcl.h: - * tools/tcl.wse.in: - * unix/configure: - * unix/configure.in: - * unix/tcl.m4: - * unix/tcl.spec: - * win/README.binary: - * win/configure: - * win/configure.in: - * macosx/Tcl.pbproj/project.pbxproj: - - * generic/tclStringObj.c (Tcl_GetCharLength): perf tweak - - * unix/tcl.m4: correct HP-UX ia64 --enable-64bit build flags - -2003-02-14 Kevin Kenny - - * win/tclWinTime.c: Added code to test and compensate for forward - leaps of the performance counter. See the MSDN Knowledge Base article - Q274323 for the hardware problem that makes this necessary on certain - machines. - * tests/winTime.test: Revised winTime-2.1 - it had a tolerance of - thousands of seconds, rather than milliseconds. (What's six orders of - magnitude among friends?) Both the above changes are triggered by a - problem reported at: - http://aspn.activestate.com/ASPN/Mail/Message/ActiveTcl/1536811 - although the developers find it difficult to believe that it accounts - for the observed behavior and suspect a fault in the RTC chip. - -2003-02-13 Kevin Kenny - - * win/tclWinInit.c: Added conversion from the system encoding to - tcl_platform(user), so that it works with non-ASCII7 user names. [Bug - 685926] - - * doc/tclsh.1: Added language to describe the handling of the - end-of-file character \u001a embedded in a script file. [Bug 685485] - -2003-02-11 Vince Darley - - * tests/fileName.test: - * unix/tclUnixFile.c: fix for [Bug 685445] when using 'glob -l' on - broken symbolic links. Added two new tests for this bug. - -2003-02-11 Kevin Kenny - - * tests/http.test: Corrected a problem where http-4.14 would fail when - run in an environment with a proxy server. Replaced references to - scriptics.com by tcl.tk. - -2003-02-11 Jeff Hobbs - - * tests/lsearch.test: - * generic/tclCmdIL.c (Tcl_LsearchObjCmd): protect against the case - that lsearch -regepx list and pattern objects are equal. - - * tests/stringObj.test: - * generic/tclStringObj.c (Tcl_GetCharLength): correct ascii char opt - of 2002-11-11 to not stop early on \x00. [Bug 684699] - - * tests.parse.test: remove excess EOF whitespace - - * generic/tclParse.c (CommandComplete): more paranoid check to break - on (p >= end) instead of just (p == end). - -2003-02-11 Miguel Sofer - - * generic/tclParse.c (CommandComplete): - * tests/parse.test: fix for [Bug 684744], by Don Porter. - -2003-02-11 Jeff Hobbs - - * generic/tclIOUtil.c (Tcl_FSJoinPath, Tcl_FSGetNormalizedPath): - (UpdateStringOfFsPath): revert the cwdLen == 0 check and instead - follow a different code path in Tcl_FSJoinPath. - (Tcl_FSConvertToPathType, Tcl_FSGetNormalizedPath): - (Tcl_FSGetFileSystemForPath): Update string rep of path objects before - freeing the internal object. (darley) - - * tests/fileSystem.test: added test 8.3 - * generic/tclIOUtil.c (Tcl_FSGetNormalizedPath): - (UpdateStringOfFsPath): handle the cwdLen == 0 case - - * unix/tclUnixFile.c (TclpMatchInDirectory): simplify the hidden file - match check. - -2003-02-10 Mo DeJong - - * win/configure: - * win/configure.in: Generate error when attempting to build under - Cygwin. The Cygwin port of Tcl/Tk does not build and people are filing - bug reports under the mistaken impression that someone is actually - maintaining the Cygwin port. A post to comp.lang.tcl asking someone to - volunteer as an area maintainer has generated no results. Closing bugs - 680840, 630199, and 634772 and marking as "Won't fix". - -2003-02-10 Donal K. Fellows - - * doc/append.n: Return value was not documented. [Bug 683188] - -2003-02-10 Vince Darley - - * doc/FileSystem.3: - * generic/tclIOUtil.c: - * generic/tclInt.h: - * tests/fileSystem.test: - * unix/tclUnixFCmd.c: - * unix/tclUnixFile.c: - * win/tclWinFile.c: further filesystem optimization, applying [Patch - 682500]. In particular, these code examples are faster now: - foreach f $flist { if {[file exists $f]} {file stat $f arr;...}} - foreach f [glob -dir $dir *] { # action and/or recursion on $f } - cd $dir - foreach f [glob *] { # action and/or recursion on $f } - cd .. - - * generic/tclTest.c: Fix for [Bug 683181] where test suite left files - in 'tmp'. - -2003-02-08 Jeff Hobbs - - * library/safe.tcl: code cleanup of eval and string comp use. - -2003-02-07 Vince Darley - - * win/tclWinFCmd.c: cleanup long lines - * win/tclWinFile.c: sped up pure 'glob' by a factor of 2.5 - ('foreach f [glob *] { file exists $f }' is still slow) - * tests/fileSystem.text: - * tests/fileName.test: added new tests to ensure correct behaviour in - optimized filesystem code. - -2003-02-07 Vince Darley - - * generic/tclTest.c: - * tests/fileSystem.text: fixed test 7.2 to avoid a possible crash, and - not change the pwd. - - * tests/http.text: added comment to test 4.15, that it may fail if you - use a proxy server. - -2003-02-06 Mo DeJong - - * generic/tclCompCmds.c (TclCompileIncrCmd): - * tests/incr.test: Don't include the text "(increment expression)" in - the errorInfo generated by the compiled version of the incr command - since it does not match the message generated by the non-compiled - version of incr. It is also not possible to match this error output - under Jacl, which does not support a compiler. - -2003-02-06 Mo DeJong - - * generic/tclExecute.c (TclExecuteByteCode): When an error is - encountered reading the increment value during a compiled call to - incr, add a "(reading increment)" error string to the errorInfo - variable. This makes the errorInfo variable set by the compiled incr - command match the value set by the non-compiled version. - * tests/incr-old.test: Change errorInfo result for the compiled incr - command case to match the modified implementation. - * tests/incr.test: Add tests to make sure the compiled and - non-compiled errorInfo messages are the same. - -2003-02-06 Don Porter - - * library/tcltest/tcltest.tcl: Filename arguments to [outputChannel] - and [errorChannel] (also -outfile and -errfile) were [open]ed but - never [closed]. Also, [cleanupTests] could remove output or error - files. [Bug 676978]. - * library/tcltest/pkgIndex.tcl: Bumped to version 2.2.2. - -2003-02-05 Mo DeJong - - * tests/interp.test: - * tests/set-old.test: Run test cases that depend on hash order through - lsort so that the tests also pass under Jacl. Does not change test - results under Tcl. - -2003-02-04 Vince Darley - - * generic/tclIOUtil.c: - * generic/tclEvent.c: - * generic/tclInt.h: - * mac/tclMacFCmd.c: - * unix/tclUnixFCmd.c: - * win/tclWin32Dll.c: - * win/tclWinFCmd.c: - * win/tclWinInit.c: - * win/tclWinInt.h: - * tests/fileSystem.test: fix to finalization/unloading/encoding issues - to make filesystem much less dependent on encodings for its cleanup, - and therefore allow it to be finalized later in the exit process. This - fixes fileSystem.test-7.1. Also fixed one more bug in setting of - modification dates of files which have undergone cross-platform - copies. [Patch 676271] - - * tests/basic.test: - * tests/exec.test: - * tests/fileName.test: - * tests/io.test: fixed some test failures when tests are run from a - directory containing spaces. - - * tests/fileSystem.test: - * generic/tclTest.c: added regression test for the modification date - setting of cross-platform file copies. - -2003-02-03 Kevin Kenny - - * generic/tclBasic.c: Changed [trace add command] so that 'rename' - callbacks get fully qualified names of the command. [Bug 651271]. - ***POTENTIAL INCOMPATIBILITY*** - * tests/trace.test: Modified the test cases for [trace add command] to - expect fully qualified names on the 'rename' callbacks. Added a case - for renaming a proc within a namespace. - * doc/trace.n: Added language about use of fully qualified names in - trace callbacks. - -2003-02-01 Kevin Kenny - - * generic/tclCompCmds.c: Removed an unused variable that caused - compiler warnings on SGI. [Bug 664379] - - * generic/tclLoad.c: Changed the code so that if Tcl_StaticPackage is - called to report the same package as being loaded in two interps, it - shows up in [info loaded {}] in both of them (previously, it didn't - appear in the static package list in the second). - - * tests/load.test Added regression test for the above bug. [Bug - 670042] - - * generic/tclClock.c: Fixed a bug that incorrectly allowed [clock - clicks {}] and [clock clicks -] to be accepted as if they were [clock - clicks -milliseconds]. - - * tests/clock.test: Added regression tests for the above bug. [Bug - 675356] - - * tests/unixNotfy.test: Added cleanup of working files. [Bug 675609] - - * doc/Tcl.n: Added headings to the eleven paragraphs, to improve - formatting in the tools that attempt to extract tables of contents - from the manual pages. [Bug 627455] - - * generic/tclClock.c: Expanded mutex protection around the setting of - env(TZ) and the thread-unsafe call to tzset(). [Bug 656660] - -2003-01-31 Don Porter - - * tests/tcltest.test: Cleaned up management of file/directory - creation/deletion to improve "-debug 1" output. [Bug 675614] - The utility [slave] command failed to properly [list]-quote a - constructed [open] command, causing failure when the pathname - contained whitespace. [Bug 678415] - - * tests/main.test: Stopped main.test from deleting existing file. Test - suite should not delete files that already exist. [Bug 675660] - -2003-01-28 Don Porter - - * tests/main.test: Constrain tests that do not work on Windows. [Bug - 674387] - -2003-01-28 Vince Darley - - * generic/tclIOUtil.c: fix to setting modification date in - TclCrossFilesystemCopy. Also added 'panic' in - Tcl_FSGetFileSystemForPath under illegal calling circumstances which - lead to hard-to-track-down bugs. - - * generic/tclTest.c: added test suite code to allow exercising a - vfs-crash-on-exit bug in Tcl's finalization caused by the encodings - being cleaned up before unloading occurs. - * tests/fileSystem.test: added new 'knownBug' test 7.1 to demonstrate - the crash on exit. - -2003-01-28 Mo DeJong - - * generic/tcl.h: Add TCL_PREFIX_IDENT and TCL_DEBUG_IDENT, used only - by TclpCreateProcess. - * unix/Makefile.in: Define TCL_DBGX. - * win/Makefile.in: Define TCL_DBGX. - * win/tclWinPipe.c (TclpCreateProcess): Check that the Tcl pipe dll - actually exists in the Tcl bin directory and panic if it is not found. - Incorporate TCL_DBGX into the Tcl pipe dll name. This fixes a really - mysterious error that would show up when exec'ing a 16 bit application - under Win95 or Win98 when Tcl was compiled with symbols. The error - seemed to indicate that the executable could not be found, but it was - actually the Tcl pipe dll that could not be found. - -2003-01-26 Mo DeJong - - * win/README: Update msys+mingw URL to release 6. This version bundles - gcc 3. - -2003-01-26 Mo DeJong - - * win/configure: Regen. - * win/configure.in: Add test that checks to see if the compiler can - cast to a union type. - * win/tclWinTime.c: Squelch compiler warning about union initializer - by casting to union type when compiling with gcc. - -2003-01-25 Mo DeJong - - * generic/tclIO.c (Tcl_CutChannel, Tcl_SpliceChannel): Invoke - TclpCutFileChannel and TclpSpliceFileChannel. - * generic/tclInt.h: Declare TclpCutFileChannel and - TclpSpliceFileChannel. - * unix/tclUnixChan.c (FileCloseProc, TclpOpenFileChannel, - (Tcl_MakeFileChannel, TclpCutFileChannel, TclpSpliceFileChannel): - Implement thread load data cut and splice for file channels. This - avoids an invalid memory ref when compiled with -DDEPRECATED. - * win/tclWinChan.c (FileCloseProc, TclpCutFileChannel, - (TclpSpliceFileChannel): Implement thread load data cut and splice for - file channels. This avoids an invalid memory ref that was showing up - in the thread extension. - -2003-01-25 Mo DeJong - - * win/tclWin32Dll.c (TclpCheckStackSpace, squelch_warnings): - * win/tclWinChan.c (Tcl_MakeFileChannel, squelch_warnings): - * win/tclWinFCmd.c (DoRenameFile, DoCopyFile, squelch_warnings): - Re-implement inline ASM SEH handlers for gcc. The esp and ebp - registers are now saved on the stack instead of in global variables so - that the code is thread safe. Add additional checks when TCL_MEM_DEBUG - is defined to be sure the values were recovered from the stack - properly. Remove squelch_warnings functions and add a dummy call in - the handler methods to squelch compiler warnings. - -2003-01-25 Mo DeJong - - * win/configure: - * win/configure.in: Define HAVE_ALLOCA_GCC_INLINE when we detect that - no alloca function is found in malloc.h and we are compiling with GCC. - Remove HAVE_NO_ALLOC_DECL define. - * win/tclWin32Dll.c (TclpCheckStackSpace): Don't define alloca as a - cdecl function. Doing this caused a tricky runtime bug because the - _alloca function expects the size argument to be passed in a register - and not on the stack. To fix this problem, we use inline ASM when - compiling with gcc to invoke _alloca with the size argument loaded - into a register. - -2003-01-24 Jeff Hobbs - - * win/tclWinDde.c (Dde_Init): clarified use of tsdPtr. - (DdeServerProc): better refcount handling of returnPackagePtr. - - * generic/tclEvent.c (Tcl_Finalize): revert finalize change on - 2002-12-04 to correct the issue with extensions that have TSD needing - to finalize that before they are unloaded. This issue needs further - clarification. - - * tests/unixFCmd.test: only do groups check on unix - -2003-01-24 Vince Darley - - * generic/tclStringObj.c: proper fixes for Tcl_SetObjLength and - Tcl_AttemptSetObjectLength dealing with string objects with both - pure-unicode and normal internal representations. Previous fix didn't - handle all cases correctly. - * generic/tclIO.c: Add 'Tcl_GetString()' to ensure the object has a - valid 'objPtr->bytes' field before manipulating it directly. - - This fixes [Bug 635200] and [Bug 671138], but may reduce performance - of Unicode string handling in some cases. A further patch will be - applied to address this, once the code is known to be correct. - -2003-01-24 Mo DeJong - - * win/configure: Regen. - * win/configure.in: Add test to see if alloca is undefined in - malloc.h. - * win/tclWin32Dll.c (TclpCheckStackSpace): Rework the SEH exception - handler logic to avoid using the stack since alloca will modify the - stack. This was causing a nasty bug that would set the exception - handler to 0 because it tried to pop the previous exception handler - off the top of the stack. - -2003-01-23 Donal K. Fellows - - * doc/lset.n: Fixed fault in return values from lset in documentation - examples [SF Bug #658463] and tidied up a bit at the same time. - -2003-01-21 Joe English - - * doc/namespace.n (namespace inscope): Clarified documentation - [Patch 670110] - -2003-01-21 Mo DeJong - - * win/configure: Regen. - * win/tcl.m4 (SC_CONFIG_CFLAGS): Set SHLIB_SUFFIX so that - TCL_SHLIB_SUFFIX will be set to a useful value in the generated - tclConfig.sh. Set SHLIB_LD_LIBS to "" or '${LIBS}' based on the - --enable-shared flag. This matches the UNIX implementation. - -2003-01-18 Jeff Hobbs - - * generic/tclCkalloc.c: change %ud to %u as appropriate. - -2003-01-17 Mo DeJong - - * win/tclWinDde.c (DdeServerProc): Deallocate the Tcl_Obj returned by - ExecuteRemoteObject if it was not saved in a connection object. - -2003-01-17 Mo DeJong - - * generic/tcl.h: Revert earlier change that defined TCL_WIDE_INT_TYPE - as long long and TCL_LL_MODIFIER as L when compiling with mingw. This - change ended up causing some test case failures when compiling with - mingw. - * generic/tclObj.c (UpdateStringOfWideInt): Describe the warning - generated by mingw and why it needs to be ignored so that someone is - not tempted to "fix" this problem again in the future. - -2003-01-16 Vince Darley - - * generic/tclStringObj.c: Tcl_SetObjLength fix for when the object has - a unicode string rep. [Bug 635200] - * tests/stringObj.test: removed 'knownBug' constraint from test 14.1 - now that this bug is fixed. - - * generic/tclInt.h: - * generic/tclBasic.c: - * generic/tclCmdMZ.z: - * tests/trace.test: execution and command tracing bug fixes and - cleanup. In particular fixed [Bug 655645], [Bug 615043], [Bug 571385] - - fixed some subtle cleanup problems with tracing. This required - replacing Tcl_Preserve/Tcl_Release with a more robust refCount - approach. Solves at least one known crash caused by memory - corruption. - - fixed some confusion in the code between new style traces (Tcl - 8.4) and the very limited 'Tcl_CreateTrace' which existed before. - - made behaviour consistent with documentation (several tests even - contradicted the documentation before). - - fixed some minor error message details - - added a number of new tests - -2003-01-16 Jeff Hobbs - - * win/tclWinSerial.c (SerialOutputProc): add casts for bytesWritten to - allow strict compilation (no warnings). - - * tests/winDde.test: - * win/tclWinDde.c (Tcl_DdeObjCmd): Prevent crash when empty service - name is passed to 'dde eval' and goto errorNoResult in request and - poke error cases to free up any allocated data. - -2003-01-16 Mo DeJong - - * win/tclWin32Dll.c (squelch_warnings): Squelch compiler warnings from - SEH ASM code. - * win/tclWinChan.c (squelch_warnings): Squelch compiler warnings from - SEH ASM code. - * win/tclWinDde.c: Add casts to avoid compiler warnings. Pass pointer - to DWORD instead of int to avoid compiler warnings. - * win/tclWinFCmd.c (squelch_warnings): Add casts and fixup decls to - avoid compiler warnings. Squelch compiler warnings from SEH ASM code. - * win/tclWinFile.c: Add casts and fixup decls to avoid compiler - warnings. Remove unused variable. - * win/tclWinNotify.c: Declare as DWORD instead of int to avoid - compiler warning. - * win/tclWinReg.c: Add casts to avoid compiler warning. Fix assignment - in if expression bug. - * win/tclWinSerial.c: Add casts to avoid compiler warnings. Remove - unused variable. - * win/tclWinSock.c: Add casts and fixup decls to avoid compiler - warnings. - -2003-01-14 Jeff Hobbs - - * generic/tclClock.c (FormatClock): corrected typo that incorrectly - conditionally defined savedTZEnv and savedTimeZone. - -2003-01-13 Mo DeJong - - Fix mingw build problems and compiler warnings. - - * generic/tcl.h: Add if defined(__MINGW32__) check to code that sets - the TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER. - * generic/tclClock.c (FormatClock): Don't define savedTimeZone and - savedTZEnv if we are not going to use them. - * generic/tclEnv.c: Add cast to avoid warning. - * win/tclWinChan.c: Use DWORD instead of int to avoid compiler warning - * win/tclWinThrd.c: Only define allocLock, allocLockPtr, and dataKey - when TCL_THREADS is defined. This avoid a compiler warning about - unused variables. - -2003-01-12 Mo DeJong - - * win/README: Update msys + mingw URL, the new release includes the - released 1.0.8 version of msys which includes a number of bug fixes. - -2003-01-12 Mo DeJong - - * win/configure: Regen. - * win/tcl.m4 (SC_CONFIG_CFLAGS): Pull in addition of shell32.lib to - LIBS_GUI that was added to the Tk tcl.m4 but never made it back into - the Tcl version. - -2003-01-12 Mo DeJong - - * generic/tcl.h: Skip Tcl's define of CHAR, SHORT, and LONG when - HAVE_WINNT_IGNORE_VOID is defined. This avoids a bunch of compiler - warnings when building with Cygwin or Mingw. - * win/configure: Regen. - * win/configure.in: Define HAVE_WINNT_IGNORE_VOID when we detect a - winnt.h that still defines CHAR, SHORT, and LONG when VOID has already - been defined. - * win/tcl.m4 (SC_LOAD_TCLCONFIG): Subst the TCL_DEFS loaded from - tclConfig.sh so that Tcl defines can make it into the Tk Makefile. - -2003-01-12 Mo DeJong - - * win/configure: Regen. - * win/configure.in: Check for typedefs like LPFN_ACCEPT in winsock2.h - and define HAVE_NO_LPFN_DECLS if not found. - * win/tclWinSock.c: Define LPFN_* typedefs if HAVE_NO_LPFN_DECLS is - defined. This fixes the build under Mingw and Cygwin, it was broken by - the changes made on 2002-11-26. - -2003-01-10 Vince Darley - - * generic/tclIOUtil.c: - * win/tclWinInt.h: - * win/tclWinInit.c: fix to new WinTcl crash on exit with vfs, - introduced on 2002-12-06. Encodings must be cleaned up after the - filesystem. - - * win/makefile.vc: fix to minor VC++ 5.2 syntax problem - -2003-01-09 Don Porter - - * generic/tclCompCmds.c (TclCompileReturnCmd): Corrected off-by-one - problem with recent commit. [Bug 633204] - -2003-01-09 Vince Darley - - * generic/tclFileName.c: remove unused variable 'macSpecialCase' - [Bug 664749] - - * generic/tclIOUtil.c: - * generic/tclInt.h: - * unix/tclUnixFile.c: - * mac/tclMacFile.c: - * win/tclWinFile.c: - * win/tclWinInt.h: - * win/tclWin32Dll.c: - * tests/cmdAH.test: fix to non-ascii chars in paths when setting mtime - and atime through 'file (a|m)time $path $time'. [Bug 634151] - -2003-01-08 Don Porter - - * generic/tclExecute.c (TclExprFloatError): Use the IS_NAN macro for - greater clarity of code. - -2003-01-07 Don Porter - - * generic/tclCompCmds.c (TclCompileReturnCmd): - * tests/compile.test: Corrects failure of bytecompiled [catch - {return}] to have result TCL_RETURN (not TCL_OK) [Bug 633204]. This - patch is a workaround for 8.4.X. A new opcode INST_RETURN is a better - long term solution for 8.5 and later. - -2003-01-04 David Gravereaux - - * win/makefile.vc: - * win/rules.vc: Fixed INSTALLDIR macro problem that blanked itself by - accident causing the install target to put the tree at the root of the - drive built on. Whoops.. - - Renamed the 'linkexten' option to be 'staticpkg'. Added 'thrdalloc' to - allow the switching _on_ of the thread allocator. Under testing, I - found it not to be benificial under windows for the purpose of the - application I was using it for. It was more important for this app - that resources for tcl threads be returned to the system rather than - saved/moved to the global recycler. Be extra clean or extra fast for - the default threaded build? Let's move to clean and allow it to be - switched on for users who find it benificial for their use of threads. - - ****************************************************************** - *** CHANGELOG ENTRIES FOR 2002 IN "ChangeLog.2002" *** - *** CHANGELOG ENTRIES FOR 2001 IN "ChangeLog.2001" *** - *** CHANGELOG ENTRIES FOR 2000 IN "ChangeLog.2000" *** - *** CHANGELOG ENTRIES FOR 1999 AND EARLIER IN "ChangeLog.1999" *** - ****************************************************************** diff --git a/ChangeLog.2004 b/ChangeLog.2004 deleted file mode 100644 index daf124f..0000000 --- a/ChangeLog.2004 +++ /dev/null @@ -1,4619 +0,0 @@ -2004-12-29 Jeff Hobbs - - * win/tcl.m4, win/configure: update MSVC CFLAGS_OPT to -O2, remove -Gs - (included in -O2) and -GD (outdated). Use "link -lib" instead of "lib" - binary and remove -YX for MSVC7 portability. Add -fomit-frame-pointer - for gcc OPT compiles. [Bug 1092952, 1091967] Align LIBS_GUI with Tk - head needs. - -2004-12-29 Kevin B. Kenny - - * 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 to - * win/Makefile.in: help constrain the number of diffs in a cvs checkin - -2004-12-24 Miguel Sofer - - * generic/tclCompile.c: - * generic/tclCompile.h: - * generic/tclExecute.c: - * generic/tclInt.h: - * generic/tclLiteral.c: - * generic/tclProc.c: - Avoid sharing cmdName literals accross namespaces, and generalise - usage of the TclRegisterNewLiteral macro. [Patch 1090905] - -2004-12-20 Miguel Sofer - - * generic/tclCompile.c: moved TclInitCompiledLocals to tclProc.c - * generic/tclProc.c: new static InitCompiledLocals to allow for a - single pass over the proc's arguments at proc load time (instead of - two as previously). TclObjInterpProc() now allocates the - compiledLocals on the tcl execution stack, using the new - TclStackAlloc/Free functions. - -2004-12-16 Donal K. Fellows - - * generic/tclInterp.c (Tcl_LimitSetTime, TimeLimitCallback): - (TclLimitRemoveAllHandlers, TclInitLimitSupport): Set a timer event to - trigger when the time limit runs out. All the time limit actually does - is check to see if the time limit has been exceeded, but this is - enough to fix [Bug 1085023]. - * generic/tclInt.h (struct Interp): Added a field to hold the token - for the timer event handler associated with the current time limit. - * generic/tclEvent.c (Tcl_UpdateObjCmd, Tcl_VwaitObjCmd): Add error - message when limit exceeded. - * tests/interp.test (interp-34.[89]): Check that time limits handle - the two cases reported in [Bug 1085023] - - * generic/tclTimer.c (TclCreateAbsoluteTimerHandler): New internal - function that allows setting a timer handler that will be triggered at - (or after) a specific time instead of at some number of milliseconds - in the future. This is a candidate for future exposure via a TIP. - -2004-12-15 Miguel Sofer - - * generic/tclBasic.c: - * generic/tclExecute.c: - * generic/tclInt.decls: - * generic/tclIntDecls.h: - * generic/tclNamesp.c: - * generic/tclProc.c: - * generic/tclStubInit.c: - * generic/tclTest.c: Added two new functions to allocate memory from - the execution stack (TclStackAlloc, TclStackFree). Added functions - TclPushStackFrame and TclPopStackFrame that do the work of - Tcl_PushCallFrame and Tcl_PopCallFrame, but using frames allocated in - the execution stack - i.e., heap instead of C-stack. The core uses - these two new functions exclusively; the old ones remain for backwards - compat, as at least two popular extensions (itcl, xotcl) are known to - use them. - -2004-12-14 Miguel Sofer - - * generic/tclCmdIL.c: - * generic/tclInt.h: - * generic/tclProc.c: - * generic/tclVar.c: changing the isProcCallFrame field of the - CallFrame struct from a 0/1 field to flags. Should be perfectly - backwards compatible. - -2004-12-14 Don Porter - - * unix/configure.in: Added special processing to remove "$U" from - libraries in the LIBOBJS value. This is an auto-make-ism we need to - avoid. [Bug 1081541] - - * unix/configure: autoconf-2.57 - -2004-12-13 Don Porter - - * generic/tcl.h: Restored extern "C" guards so that C++ code sees - function pointer typedef linkage consistent with earlier Tcl releases. - [Bug 1082349] - - * generic/tclEncoding.c: Plugged some memory leaks. Thanks to Rolf Ade - * generic/tclUtil.c: for reports and testing [Bug 1083082] - -2004-12-13 Kevin B. Kenny - - * doc/clock.n: Clarify that the [clock scan] command does not accept - the full range of ISO8601 point-in-time formats. [Bug 1075433] - -2004-12-12 Miguel Sofer - - * generic/tclVar.c (TclArrayObjCmd - ARRAY_NAMES): leaking an object - [Bug 1084111] - thanks to Rolf Ade. - -2004-12-12 Miguel Sofer - - * generic/tclObj.c (TclSetCmdNameObj): special handling for fully - qualified command names (as in fix [Patch 456668]). - -2004-12-11 Miguel Sofer - - * generic/tclInt.h: - * generic/tclNamesp.c: converting the static function - GetNamespaceFromObj() to MODULE_SCOPE TclGetNamespaceFromObj(). - -2004-12-10 Donal K. Fellows - - * tools/tcl.wse.in, unix/tcl.spec, win/README.binary, README: - * win/configure.in, unix/configure.in, generic/tcl.h: - Bumped version number to 8.5a3 to distinguish HEAD of CVS development - from the recent 8.5a2 release. - -2004-12-10 Miguel Sofer - - * generic/tclCompile.c (TclInitCompiledLocals): - * generic/tclCompile.h: - * generic/tclInt.h: - * generic/tclProc.c (TclObjInterpProc, TclCreateProc): optimised - loops that initialise a proc's arguments and compiled local - variables, removing tests from inner loops. - -2004-12-10 Donal K. Fellows - - * generic/tclInt.h: Move ensemble API decls here from tclNamesp.c - -2004-12-09 Donal K. Fellows - - * generic/tclNamesp.c (TclMakeEnsembleCmd, TclSetEnsemble*) - (TclSetEnsemble*, TclFindEnsemble): Build an internal API for creating - and manipulating ensembles; they can be deleted using the normal - command-deletion API. - - * doc/Async.3: Reword for better grammar, better nroff and get the - flag name right. (Reported by David Welton.) - -2004-12-07 Don Porter - - * tests/unixInit.test (2.1-4): Added constraints so that when a value - of TCL_LIBRARY is required for process initialization, we skip the - tests that mess with that value. - -2004-12-07 Donal K. Fellows - - *** 8.5a2 TAGGED FOR RELEASE *** - - * unix/Makefile.in: add library/{tzdata,msgs} to dist target (kbk) - - * doc/foreach.n: Adjust tabs to be friendlier to some HTML - converters. [Bug 1078760] - -2004-12-06 Jeff Hobbs - - * unix/tclUnixNotfy.c (NotifierThreadProc): init numFdBits - [Bug 1079286] - - * doc/error.n, doc/SaveResult.3, doc/Thread.3: minor nroff typos - -2004-12-06 Don Porter - - * tests/safe.test: Trim auto_path to improve performance [1080039] - - * tests/msgcat.test: makeFile/removeFile cleanup [1079117] - -2004-12-04 Don Porter - - * generic/tclEncoding.c: Different fix for [Bug 1077005]. - * generic/tclEvent.c: Broke apart TclpSetInitialEncodings() on - * generic/tclInt.h: Windows into TclpSetInterfaces(), that is - * unix/tclUnixInit.c: fundamentally essential, and the initialization - * win/tclWinInit.c: of the system encoding, which is not. Made - the TclpSetInterfaces call part of TclInitSubsystems so it cannot be - overlooked. - -2004-12-03 Jeff Hobbs - - * changes: updated for 8.5a2 release - -2004-12-02 Don Porter - - * generic/tclUtil.c (TclSetProcessGlobalValue): Handle the case where - a ProcessGlobalValue might be assigned to itself. - - * generic/tclEncoding.c (MakeFileMap): Correct refcounting errors - managing values returned by TclPathPart (with refCount of 1!) that led - to a memory leak. [Bug 1077474]. - -2004-12-02 Vince Darley - - * generic/tclPathObj.c: fix and new tests for [Bug 1074671] to ensure - * tests/fileSystem.test: tilde paths are not returned specially by - 'glob'. - -2004-12-02 Kevin B. Kenny - - * win/Makefile.in: Added a 'sed' in the setting of ROOT_DIR_NATIVE to - compensate for a bug in cygpath (at least version 1.36) that leaves a - trailing backslash on the end of the converted path. - -2004-12-02 Donal K. Fellows - - * generic/tclInterp.c (Alias,Target,Master): Rewrote these so that the - aliases that refer to an interpreter are stored in a list and not a - hashtable (which was only ever a convenience, and forced the use of a - global mutex to generate keys!) [FRQ 1077210] - * generic/tclNamesp.c (numNsCreated): Moved into thread-local storage - to remove a global mutex. [FRQ 1077210] - -2004-12-01 Don Porter - - * generic/tclUtil.c (TclGetProcessGlobalValue): Narrowed the scope of - mutex locks. - - * generic/tclUtil.c: Updated Tcl_GetNameOfExecutable() to - * generic/tclEncoding.c: make use of a ProcessGlobalValue for - * generic/tclEvent.c: storing the executable name. Added - internal routines Tcl(Get|Set)ObjNameOfExecutable() to access that - storage in Tcl_Obj, rather than string format. - - * unix/tclUnixFile.c: Rewrote TclpFindExecutable() to use - * win/tclWinFile.c: TclSetObjNameOfExecutable to store the - executable name it computes. - - * generic/tclInt.h: Added internal stub entries for - * generic/tclInt.decls: TclpFindExecutable and - Tcl(Get|Set)ObjNameOfExecutable. - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclCmdIL.c: Retrieve executable name in Tcl_Obj form - * win/tclWinPipe.c: instead of string form. - - * unix/tclUnixTest.c: Update [testfindexecutable] command to use new - internal interfaces. - - * generic/tclEncoding.c: Moved TclpSetInitialEncodings() call - from Tcl_FindExecutable() into TclInitEncodingSubsystem(). This is - important on Windows where it establishes whether the "ascii" or - "unicode" set of system routines will be used, and that needs to be - done earlier to support filesystem operations. [Bug 1077005] - -2004-12-01 Donal K. Fellows - - * tests/winDde.test: Rewritten to use tcltest2 features more - thoroughly (reducing the [catch] count!) and fix the problem with - winDde-6.1 being out of synch with the implementation. - -2004-11-30 Don Porter - - * library/init.tcl ([unknown]): Restored the save/restore of the - variables ::errorCode and ::errorInfo. This is needed when the - [::bgerror] command is auto-loaded (as it is by Tk). - - Patch 976520 reworks several of the details involved with - startup/initialization of the Tcl library, focused on the activities - of Tcl_FindExecutable(). - - * generic/tclIO.c: Removed bogus claim in comment that encoding - "iso8859-1" is "built-in" to Tcl. - - * generic/tclInt.h: Created a new struct ProcessGlobalValue, - * generic/tclUtil.c: routines Tcl(Get|Set)ProcessGlobalValue, and - function type TclInitProcessGlobalValueProc. Together, these take care - of the housekeeping for "values" (things that can be held in a - Tcl_Obj) that are global across a whole process. That is, they are - shared among multiple threads, and epoch and mutex protection must - govern the validity of cached copies maintained in each thread. - - * generic/tclNotify.c: Modified TclInitNotifier() to tolerate being - called multiple times in the same thread. - * generic/tclEvent.c: Dropped the unused argv0 argument to - TclInitSubsystems(). Removed machinery to unsure only one - TclInitNotifier() call per thread, now that that is safe. Converted - Tcl(Get|Set)LibraryPath to use a ProcessGlobalValue, and moved them to - tclEncoding.c. - * generic/tclBasic.c: Updated caller. - - * generic/tclInt.h: TclpFindExecutable now returns void. - * unix/tclUnixFile.c: - * win/tclWinFile.c: - * win/tclWinPipe.c: - - * generic/tclEncoding.c: Built new encoding search initialization on a - foundation of ProcessGlobalValues, exposing new routines - Tcl(Get|Set)EncodingSearchPath. A cache of a map from encoding name to - directory pathname keeps track of where encodings are available for - loading. Tcl_FindExecutable greatly simplified into just three - function calls. The "library path" is now misnamed, as its only - remaining purpose is as a foundation for the default encoding search - path. - - * generic/tclInterp.c: Inlined the initScript that is evaluated by - Tcl_Init(). Added verification after initScript evaluation that Tcl - can find its installed *.enc files, and that it has initialized - [encoding system] in agreement with what the environment expects. - [tclInit] no longer driven by the value of $::tcl_libPath; it largely - constructs its own search path now, rather than attempt to share one - with the encoding system. - - * unix/tclUnixInit.c: TclpSetInitialEncodings factored so that a new - * win/tclWinInit.c: routine TclpGetEncodingNameFromEnvironment can - reveal that Tcl thinks the [encoding system] should be, even when an - incomplete encoding search path, or a missing *.enc file won't allow - that initialization to succeed. TclpInitLibraryPath 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: - - * generic/tclTest.c: Updated [testencoding] to use - * tests/encoding.test: Tcl(Get|Set)EncodingSearchPath. Updated tests. - -2004-11-30 Kevin B. Kenny - - * library/clock.tcl: Corrected the regular expressions that match a - time zone to allow for time zones specified as +HH or -HH. - * tests/clock.test: Added regression test case for the above issue. - Thanks to Rolf Ade for reporting this issue [http://wiki.tcl.tk/13094] - * win/tclWinDde.c (Tcl_DdeObjCmd): Corrected a typo that caused a - compilation failure on VC++. - -2004-11-29 Andreas Kupries - - * win/Makefile.in (install-libraries): Brought entry '2004-10-26 Don - Porter (Tcl Modules)' into the windows world, actually the - win/configure buildsystem. The other windows buildsystems (.vc, .bc) - still have to be updated as well. - -2004-11-26 Andreas Kupries - - * win/tclWinDde.c (ExecuteRemoteObject): Removed bogus semicolon found - at the end of the header for the function definition, terminating it - early and preventing a compile. This is likely a fix for '2004-11-25 - Donal'. I have to conclude that it is also unknown if the other - changes to this file actually pass the testsuite. Running testsuite - ... They don't. winDde-6.1 fails. This is only a message discrepance, - i.e. not too bad. Leaving resolution of that to Pat and Donal. - -2004-11-26 Don Porter - - * library/auto.tcl (tcl_findLibrary): Made sure the uniquifying - operations on the search path does not also normalize. [Bug 1072136] - -2004-11-26 Donal K. Fellows - - * unix/configure.in: Simplify the code to check for correctness of - strstr, strtoul and strtod. - * unix/tcl.m4 (SC_TCL_CHECK_BROKEN_FUNC): Split a complex stanza out - of configure.in into its own function. Also force it to do the right - thing with cacheing of results of AC_TRY_RUN to deal with issue raised - in [Patch 1073524] - - * doc/foreach.n: Added simple example. [FRQ 1073334] - -2004-11-25 Donal K. Fellows - - * generic/tclProc.c (TclObjInterpProc): Make it so that only - * generic/tclIndexObj.c (Tcl_WrongNumArgs): [proc] instances do - * tests/indexObj.test (indexObj-5.7): quoting of their first - arguments, so keeping [Bug 942757] fixed and making [Bug 1066837] be - fixed as well. Done with a load of #ifdef-ery because this hack is so - ugly nobody should keep it around once Itcl's fixed. - -2004-11-25 Reinhard Max - - * tests/tcltest.test: The order in which [glob] returns the file names - is undefined, so tests should not depend on it. - -2004-11-25 Zoran Vasiljevic - - * doc/Thread.3: - * doc/Notifier.3: Added changes from the core-8-4-branch - -2004-11-25 Donal K. Fellows - - * doc/dde.n: Synchronized the documentation of the commands with the - header of the docs and what the package actually does. Thanks to - Andreas Kupries for spotting this. - * win/tclWinDde.c (Tcl_DdeObjCmd): Much cleanup of argument parsing - code. - -2004-11-24 David Gravereaux - - * generic/tclPort.h: Relative include of tclWinPort.h returned as it - was requiring me set -I$(tcl_root)/win for my extensions that need to - include tclInt.h and doesn't appear to serve any purpose for windows - builds. - -2004-11-24 Kevin B. Kenny - - * unix/tcl.m4 (SC_ENABLE_THREADS): Corrected bad check for 3-argument - readdir_r [Bug 1001325]. - * unix/configure: Regenerated. - * unix/tclUnixNotfy.c: Corrected all uses of 'select' to manage their - masks using the FD_CLR, FD_ISSET, FD_SET, and FD_ZERO macros rather - than bit-whacking that failed under Solaris-Sparc-64. [Bug 1071807] - * win/tclWinInit.c (TclpInitLibraryPath): Removed unused vars 'pathc' - and 'pathv' that caused compilation problems on VC++ with - --enable-symbols. - -2004-11-24 Don Porter - - * unix/tcl.m4 (SC_ENABLE_THREADS): Corrected failure to determine the - number of arguments for readdir_r on SunOS systems. [Bug 1071701] - - * unix/configure: autoconf-2.57 - - * generic/tclCmdIL.c (InfoVarsCmd): Corrected segfault in new - * tests/info.test (info-19.6): trivial matching branch [Bug 1072654] - -2004-11-24 Donal K. Fellows - - * tools/man2html.tcl, tools/man2html1.tcl: Update to use Tcl 8.4. - * tools/man2html2.tcl: Fix broken .SS handling. - -2004-11-23 Donal K. Fellows - - * unix/Makefile.in: Add (commented-out) code to integrate tclConfig.h - into the dependency tree and 'make distclean'. [Bug 1068171] - - * generic/tclResult.c (Tcl_AppendResultVA): Remove call to - Tcl_GetStringResult to speed up repeated calls to Tcl_AppendResult - with the side effect that code that wants to access interp->result - should always call Tcl_GetStringResult first. See [Patch 1041072] - discussion for more details. - -2004-11-22 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4 (SC_TCL_64BIT_FLAGS): Define HAVE_TYPE_OFF64_T only when - off64_t, open64(), and lseek64() are defined. IRIX 5.3 is known to not - include an open64 function. [Bug 1030465] - -2004-11-22 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4 (SC_ENABLE_THREADS): Check for a 2 argument version of - readdir_r that is known to exists under IRIX 5.3. - * unix/tclUnixThrd.c (TclpReaddir): Use either 2 arg or 3 arg version - of readdir_r. [Bug 1001325] - -2004-11-22 Don Porter - - * unix/tclUnixInit.c (TclpInitLibraryPath): Purged dead code that used - * win/tclWinInit.c (TclpInitLibraryPath): to extend the "library - path". Search path construction for init.tcl is now done within the - [tclInit] proc. - * generic/tclInterp.c: Restored several directories to the search - * tests/unixInit.test: path used to locate init.tcl within [tclInit]. - This change does not restore any directories to the encoding search - path, so should still avoid the price of an unreasonably large number - of filesystem accesses during encoding initialization at startup - [Bug 976438] - -2004-11-22 Vince Darley - - * generic/tclPathObj.c: fix and new test for [Bug 1043129] in the - * tests/fileSystem.test: treatment of backslashes in file join on - Windows. - -2004-11-21 Don Porter - - * doc/AddErrInfo.3: Typo corrections (Thanks Daniel South). - * doc/interp.n: - -2004-11-19 Don Porter - - * doc/AddErrInfo.3: Docs for Tcl_(Get|Set)ReturnOptions. [TIP 227] - - * doc/AddErrInfo.3: - * doc/Async.3: Documentation updates to replace references - * doc/BackgdErr.3: to global variable ::errorInfo and ::errorCode - * doc/SaveResult.3: and to the ::bgerror command with references - * doc/after.n: to their preferred replacements, the - * doc/bgerror.n: -errorinfo and -errorcode return options, - * doc/error.n: the Tcl_*InterpState routines, and the - * doc/exec.n: [interp bgerror] command. - * doc/exit.n: - * doc/fileevent.n: - * doc/interp.n: - * doc/return.n: - * doc/tclvars.n: - * doc/update.n: - - * tests/unixInit.test: Removed "knownBug" constraints to prompt bug - fixing before 8.5a2 release. - -2004-11-19 Daniel Steffen - - * macosx/Makefile: - * unix/configure.in: - * unix/tclUnixInit.c (MacOSXGetLibraryPath): changed detection of tcl - framework build when determining tclLibPath from overloaded - TCL_LIBRARY to configuration define TCL_FRAMEWORK. [Bug 1068088] - - * unix/configure: autoconf-2.57 - * unix/tclConfig.h.in: autoheader-2.57 - -2004-11-18 Don Porter - - * doc/SaveResult.3: Documentation for Tcl_*InterpState (TIP 226). - - * generic/tclEvent.c (HandleBgErrors): Simplified program flow. - - * tests/basic.test: Updated functional (not testing) uses of - * tests/io.test: [bgerror] to make use of [interp bgerror]. - * tests/socket.test: - * tests/timer.test: - - * tests/interp.test (interp-36.*): [interp bgerror] tests. - - * generic/tclInterp.c: Corrected [interp bgerror] error messages. - -2004-11-18 Reinhard Max - - * unix/tcl.m4 (SC_CONFIG_MANPAGES): Applied an improved version of - * unix/configure.in: [Patch 996085], that introduces - * unix/Makefile.in: --enable-man-suffix. - - * unix/installManPage: added - * unix/mkLinks.tcl: removed - * unix/mkLinks: removed - * unix/configure: generated - - * unix/Makefile.in: Don't install tclConfig.h . - -2004-11-17 Don Porter - - * unix/configure.in: The change below reveals that the public data - type Tcl_StatBuf relies on config information. For now, disabled the - use of the tclConfig.h file until its full impact on Tcl's interface - can be assessed. - - * unix/configure: autoconf-2.57 - - * generic/tcl.h: Moved the #include "tclConfig.h" out of - * generic/tclInt.h: tcl.h. The config settings are not part of - * generic/tclPort.: the public interface, and having it there - breaks compiled against uninstalled Tcl and extensions using - autoconf-2.5*. - -2004-11-16 Jeff Hobbs - - * unix/tclUnixChan.c (TtySetOptionProc): fixed crash configuring - -ttycontrol on a channel. [Bug 1067708] - -2004-11-16 Don Porter - - * generic/tclIOUtil.c (TclFSEpochOk): There were two code paths via - which the thread copy of filesystemEpoch could be synched with the - master copy, but only one kept the filesystem list cache up to date. - Fix routes everything through a single code path. [Bug 1035775]. - -2004-11-16 Donal K. Fellows - - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Stop architecture flags to 'ld' from - getting lost when [load] is disabled. [Bug 1016796] - -2004-11-16 Daniel Steffen - - * generic/tcl.h: - * unix/configure.in: changed HAVE_CONFIG_H to HAVE_TCL_CONFIG_H. - - * unix/configure: autoconf-2.57 - -2004-11-15 Don Porter - - * generic/tclInt.h: Added comment warning that the old ERR_IN_PROGRESS - and ERROR_CODE_SET flag values should not be re-used for the sake of - those extensions that have accessed them. - - * generic/tclCmdMZ.c (Tcl_TraceObjCmd): Fixed Bug 1065378 which failed - * tests/trace.test (trace-33.1): to permit a variable trace - created with [trace variable] to be destroyed with [trace remove]. - Thanks to Keith Vetter for the report. - -2004-11-15 Donal K. Fellows - - * doc/tclvars.n: Added section to documentation on global variables - that are specific to tclsh and wish. [Patch 1065732] - -2004-11-12 Jeff Hobbs - - * generic/tclEncoding.c (TableFromUtfProc): correct crash condition - when TCL_UTF_MAX == 6. [Bug 1004065] - -2004-11-12 Donal K. Fellows - - * doc/interp.n: Basic documentation of the TIP#221 API. - -2004-11-12 Don Porter - - TIP #221 IMPLEMENTATION - * generic/tclBasic.c: Define [::tcl::Bgerror] in new interps. - * generic/tclEvent.c: Update Tcl_BackgroundError to make use of the - registered [interp bgerror] command. - * generic/tclInterp.c: New [interp bgerror] subcommand. - * tests/interp.test: syntax tests updated. - - TIP #226 IMPLEMENTATION - * generic/tcl.decls: Stubs for Tcl_(Save|Restore|Discard)InterpState - * generic/tcl.h: New public opaque type, Tcl_InterpState. - * generic/tclInt.h: Drop old private declarations. Add - Tcl(Get|Set)BgErrorHandler - * generic/tclResult.c: Tcl_*InterpState implementations. - * generic/tclDictObj.c: Update callers. - * generic/tclIOGT.c: - * generic/tclTrace.c: - - TIP #227 IMPLEMENTATION - * generic/tcl.decls: Stubs for Tcl_(Get|Set)ReturnOptions. - * generic/tclInt.h: Drop old private declarations. - * generic/tclResult.c: Tcl_*ReturnOptions implementations. - * generic/tclCmdAH.c: Update callers. - * generic/tclMain.c: - - * generic/tclDecls.h: make genstubs - * generic/tclStubInit.c: - - * unix/tclAppInit.c: Removed tclConfig.h #include, now that tcl.h - takes care of it for us. - - * generic/tclInt.h: Moved verification of ptrdiff_t typedef from - * generic/tclExecute.c: multiple .c files into one common header where - * generic/tclVar.c: it is verifiably after tclConfig.h inclusion. - -2004-11-12 Daniel Steffen - - * generic/tcl.h: - * generic/tclInt.h: - * unix/Makefile.in: include tclConfig.h from tcl.h and install it as a - public header. Normalized compiler include path order to - -I${BUILD_DIR} -I${UNIX_DIR} -I${GENERIC_DIR}. - - * unix/dltest/Makefile.in: add ${BUILD_DIR}/.. to include path to pick - up tclConfig.h. - - * unix/tclUnixInit.c: moved check for HAVE_CFBUNDLE define after - #include "tclInt.h" to ensure tclConfig.h has been included. - -2004-11-12 Reinhard Max - - * unix/config.h.in: - * unix/tclConfig.h.in: renamed - - * unix/Makefile.in: Completed support for config header, - * unix/configure.in: fixed building outside of the unix dir, - * unix/tclAppinit.c: and reflected the name change of config.h. - * generic/tclInt.h: - - * unix/configure: generated - -2004-11-12 Donal K. Fellows - - * unix/config.h.in: Allow configure to put all the C #defs into - * unix/configure.in: a file (called config.h) so that Unix builds - * unix/tcl.m4: now take far fewer lines of scrollback to - * unix/Makefile.in: proceed (making it less likely that any errors - * generic/tclInt.h: or warnings will get missed). - * unix/tclAppInit.c: Part of the TIP#34 upgrades. - - * unix/tcl.m4, unix/tclUnixPort.h: Check for pthread_attr_get_np in - before forcing the use of to make things - work on NetBSD 2.0. [Bug 1064882] - - * doc/binary.n, doc/upvar.n: More minor fixes. - -2004-11-12 Daniel Steffen - - * doc/CrtChannel.3: - * doc/Interp.3: - * doc/Limit.3: - * doc/binary.n: - * doc/dict.n: - * doc/tm.n: - * doc/upvar.n: fixed *roff errors uncovered by running 'make html'. - - * tools/tcltk-man2html.tcl: added faked support for bullet point - lists, i.e. *nroff ".IP \(bu" syntax. - -2004-11-11 Daniel Steffen - - * tests/fCmd.test: - * unix/tclUnixFCmd.c (TraverseUnixTree): added option to rewind() the - readdir() loop whenever the source hierarchy has been modified by - traverseProc (e.g. by deleting files); this is required to ensure - complete traversal of the source hierarchy on certain filesystems like - HFS+. Added test for failing recursive delete on Mac OS X that was due - to this. [Bug 1034337] - - * generic/tclListObj.c (Tcl_ListObjReplace): use memmove() instead of - manual copy loop to shift list elements. Decreases time spent in - Tcl_ListObjReplace() from 5.2% to 1.7% of overall runtime of tclbench - on a ppc 7455 (i.e. 200% speed increase). [Patch 1064243] - - * generic/tclHash.c: hoisted some constant pointer dereferences out of - loops to eliminate redundant loads that the gcc optimizer didn't deal - with. Decreases time spend in Tcl_FindHashEntry() by 10% over a full - run of the tcl testuite on a ppc 7455. [Patch 1064243] - - * tests/fileName.test: - * tests/fileSystem.test: - * tests/io.test: - * tests/msgcat.test: - * tests/tcltest.test: - * tests/unixInit.test: fixed bugs causing failures when running tests - with -tmpdir arg not set to working dir. - - * macosx/Makefile: corrected path to html help inside framework. - Prevent parallel make from building several targets at the same time. - - * macosx/tclMacOSXFCmd.c (struct fileinfobuf): force struct to be - packed to prevent failures when builing with -malign=natural. - -2004-11-10 Andreas Kupries - - * unix/tclUnixChan.c: [Bug 727786]. Exterminated the code marked - DEPRECATED. This code has not been used in over a year now, and we - have no complaints. - -2004-11-08 David Gravereaux - - * win/tclWinPipe.c: The pipe channel driver now respects the -blocking - option when closing is the same way the UNIX side works. This is to - avoid a hung shell when exiting due to open pipes that refuse to close - in a graceful manner. - * doc/open.n: Added a note about -blocking 0 and lack of exit status - as it had never been documented. [Bug 947693] - - ***POTENTIAL INCOMPATIBILITY*** - - Scripts that use async pipes on windows, must (like the UNIX side) set - -blocking to 1 before calling [close] to receive the exit status. - -2004-11-07 David Gravereaux - - * tests/winFile.test: added contraint to winFile-4.0 to prevent it - being run on NT4 [Bug 981829] - -2004-11-05 Donal K. Fellows - - * tests/reg.test: Major reorganization so that this file is much - easier for a normal Tcl maintainer to comprehend. The test flags are - still very cryptic, but they appear to have to be that way. The number - of skipped tests has increased, but now the skipped tests have much - more meaningful content. - - * tests/tm.test (genpaths): Add a [file normalize] so we pick up - Windows drive letters, etc. [Bug 1053568] - -2004-11-04 Don Porter - - * changes: Updates toward an 8.5a2 release. - -2004-11-03 Kevin B. Kenny - - * library/clock.tcl (FreeScan): Fixed a bug where scanning "Monday" - with a base time other than midnight incorrectly carried the base time - forward. - - * test/clock.test (clock-33.{5,5a}): Made the test failure more - informative. - - * tests/clock.test (clock-34.{28,44,45,46}): Removed 'knownBug' - constraints from tests that no longer fail. - - Thanks to Don Porter for reporting these. - -2004-11-03 David Gravereaux - - * generic/tcl.h: Moved the preprocessor logic - * generic/tclDecls.h: from tclInt.h of setting the - * generic/tclInt.h: TCL_STORAGE_CLASS macro to the - * generic/tclIntDecls.h: tcl*Decls.h files now that no - * generic/tclIntPlatDecls.h: use of EXTERN is left in tclInt.h. - * generic/tclPlatDecls.h: Proto for Tcl_Main moved in tcl.h - * win/tclWinPort.h: to prior the inclusion of the Stubs - headers as they are now resetting TCL_STORAGE_CLASS. Removed - extraineous reset from tclWinPort.h. [Patch 1055668] - - * generic/tclCompile.h: Removed extrainious reset of TCL_STORAGE_CLASS - missed in my last edit. - -2004-11-03 Don Porter - - * library/init.tcl ([unknown]): Corrections to the 2004-10-25 mods to - Aunt ??? in [unknown]. Flaws revealed by Itcl test suite, which still - apparently relies on this brokenness. Also added comment suggesting - the error message that any code using this hack *ought* to receive in - reply. - - * generic/tclTrace.c (TclCallVarTraces): Improved ability to debug - * tests/incr-old.test (incr-old-2.6): errors during variable - * tests/incr.test (incr-{1,2}.28): traces by preserving the - * tests/set.test (set-{2,4}.4): -errorinfo data. - * tests/trace.test (trace-33.1): [Bug 527164] - -2004-11-02 David Gravereaux - - * generic/tclInt.h: added a check for #ifdef __cplusplus around the - #define of MODULE_SCOPE. About the only time it would be problem is - when someone is statically linking to Tcl and accessing internals from - a C++ file and has name mangling issues from the lack of "C" after - 'extern' [Patch 1055668]. - * generic/tclCompile.h: Exchanged use of the EXTERN macro to the new - MODULE_SCOPE macro. Lowered exported internals count by 35. [Patch - 1055668] - * win/tclWinInt.h: - * win/tclWinPort.h: exported internals dropped by a count of 14. - * generic/tclFileSystem.h: Added use of MODULE_SCOPE on protos. - * generic/tclRegexp.h: manipulating TCL_STORAGE_CLASS unnecessary. - -2004-11-02 Don Porter - - * library/tcltest/tcltest.tcl: Corrected some misleading - * tests/tcltest.test (tcltest-26.1,2): displays of ::errorInfo and - ::errorCode information when the -setup, -body, and/or -cleanup scripts - return an unexpected return code. Thanks to Robert Seeger for the fix. - [RFE 1017151]. - -2004-11-02 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Improved version of the - NaN fix from Miguel Sofer. [Bug 761471] - -2004-11-02 Kevin Kenny - - * library/tzdata/America/Cuiaba: Change to DST rules for - * library/tzdata/America/Havana: autumn of 2004. - [ftp://elsie.nci.nih.gov/pub/tzdata2004g.tar.gz] - - * tools/tclZIC.tcl: Updated to be compatible with recent changes in - library/clock.tcl. - -2004-11-02 Vince Darley - - * win/tclWinFile.c: Simplify TclpUtime to use Tcl_FSGetNativePath, and - add comments. - -2004-11-02 Donal K. Fellows - - * generic/tclInt.h: Change uses of EXTERN to MODULE_SCOPE (defined in - this file too to be 'extern' if not overridden) as nothing declared in - tclInt.h is supposed to be visible outside the Tcl core. If there *is* - anything that extensions are actually using, we can open this up later - on. [Patch 1055668] - - * doc/CrtChannel.3 (Tcl_GetChannelMode): Add synopsis. [Bug 1058446] - -2004-11-01 Kevin B. Kenny - - * win/tclWinFile.c (FromCTime, TclpUtime): Replaced a call to the - Posix 'utime' function with calls to Windows-API equivalents, to avoid - a bug where the VC++ versions misconvert times across a Daylight - Saving Time boundary. [Bug 926106] - * win/tclWinInt.h (TclWinProcs): - * win/tclWin32Dll.c (asciiProcs, unicodeProcs): Removed now-unused - reference to 'utime'. - * tests/cmdAH.test (cmdAH-24.12): Added test case for the above bug. - -2004-11-01 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Make INST_EQ and friends - handle NaN correctly in all cases. [Bug 761471] - - * generic/tclNamesp.c (NamespaceInscopeCmd): Make the error message - generation the same as in NamespaceEvalCmd(). - (Tcl_Import): Rationalized to use Tcl_EvalObjv(). - -2004-10-31 Donal K. Fellows - - * tests/io.test (io-40.3): Convert umask2 test constraint into a form - that most people will be able to satisfy. - - * tests/cmdAH.test (cmdAH-8.45): Removed broken test constraint. It - didn't do what it was intended to do, and it implied the other correct - constraint. [Bug 1053908] - - * generic/tclCmdIL.c (InfoGlobalsCmd): - * tests/info.test (info-8.4): Strip leading global-namespace - specifiers from the pattern argument. [Bug 1057461] - -2004-10-30 Kevin Kenny - - * generic/clock.c: Replaced WIN32 macro with __WIN32__. [Bug 1054357]. - Thanks to David Gravereaux for the patch. - * win/tclWinFile.c: Removed a long-standing bug that causes incorrect - conversion between file time and UTC time if the file time is recorded - in a different Daylight Saving Time status than the current one. [Bug - 926106] - -2004-10-29 Don Porter - - * library/tcltest/tcltest.tcl: Correct reaction to errors in the - obsolete processCmdLineArgsHook. [Bug 1055673] - * library/tcltest/pkgIndex.tcl: Bump to tcltest 2.2.7 - * unix/Makefile.in: - * tests/all.tcl: Update to use [tcltest::configure]. - -2004-10-29 Donal K. Fellows - - * library/tm.tcl (::tcl::tm::*): Use the core proc engine to generate - the wrong-num-args error messages for the path ensemble. - - Ensembles can now (sometimes) rewrite the error messages of their - subcommands so they appear more like the arguments that the user - passed to the ensemble. Below is a description of changes involved in - doing this. - - * tests/namespace.test (namespace-50.*): Tests of ensemble subcommand - error message rewriting. - * generic/tclProc.c (TclObjInterpProc): Make procedures implement - their wrong-num-args message using Tcl_WrongNumArgs instead of - something baked-at-home. - * generic/tclNamesp.c (TclIsEnsemble, NsEnsembleImplementationCmd): - Added test of ensemble-hood (available to rest of core) and made - ensembles set up the rewriting for Tcl_WrongNumArgs to take advantage - of. - * generic/tclInt.h (Interp.ensembleRewrite): Extra fields. - * generic/tclIndexObj.c (Tcl_WrongNumArgs): Add knowledge of what is - going on in ensembles' command rewriting so this command can generate - the right error message itself. - * generic/tclBasic.c (Tcl_CreateInterp, TclEvalObjvInternal): Added - code to initialize (as empty) the rewriting fields and reset them when - we leak outside an ensemble implementation. - -2004-10-28 Miguel Sofer - - * generic/tclExecute.c (INST_START_CMD): - * tests/execute.test (execute-8.3): fix for execution stack corruption - [Bug 1055676]. Credit dgp for detective work and fix. - -2004-10-27 Don Porter - - * tests/socket.test (socket-13.1): Balanced [makeFile] and - [removeFile] commands. - - * tests/clock.test: Correct duplicate test names. - * tests/namespace.test: - * tests/string.test: - * tests/io.test (io-50.4): Use namespace variables. - -2004-10-27 David Gravereaux - - * generic/tclInt.decls: The following 9 functions were moved from - * generic/tclInt.h: tclInt.h to the private/int Stubs table for - * generic/tclIntDecls.h: use by the test suite. As tclTest.obj is - * generic/tclStubInit.c: linked to the shell, these functions need - "blessed" status so as to always be exported from the library. Being - placed in the Stubs table guarantees this [Bug 1054748]: - TclpObjRemoveDirectory, TclpObjCopyDirectory, - TclpObjCreateDirectory, TclpObjDeleteFile, - TclpObjCopyFile, TclpObjRenameFile, - TclpObjStat, TclpObjAccess, - TclpOpenFileChannel - - * tests/registry.test: Fixed test files to load the correct - * tests/winDde.test: registry and dde packages by using the info - * win/Makefile.in: from makefiles to tell tcltest where to load - * win/makefile.vc: them from. This avoids grabbing the wrong - package from $auto_path which might be the install point rather than - the dev location. Kudos to Jennifer Hom for adding -load and - -loadfile to the tcltest package. [Bug 926088] - - * win/tclWinThrd.c (TclFinalizeLock): release the critical section - before deleting it. [Bug 731778] - - * generic/tcl.h: Removed the file level 'extern "C" {' and the - coresponding closing block as it serves no purpose given that all the - function prototypes have the proper extern usage already. - - * unix/tclAppInit.c: When built as tcltest, TclThread_Init was - * win/tclAppInit.c: getting called twice. First by Tcltest_Init, - then again in Tcl_AppInit. The call from Tcl_AppInit is now removed. - -2004-10-27 Andreas Kupries - - * 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 - - * tests/format.test (format-19.1): Additional regression test for [Bug - 868489]. - -2004-10-27 Donal K. Fellows - - * doc/*.n: Many small general documentation fixes. - -2004-10-26 David Gravereaux - - * generic/tclPipe.c (TclCleanupChildren): bad cast of resolvedPid - caused PIDs on win95 to go negative. winpipe-4.2 brought this to the - surface. Fixed with sprintf in place of TclFormatInt. Thanks to hgiese - [Patch 767676] - -2004-10-26 Andreas Kupries - - * library/tm.tcl (::tcl::tm::Defaults): Added a second [file dirname] - around the location of the executable. This fixes [Bug 1038705]. - Instable of a bogus "foo/bin/lib" we now have the correct "foo/lib" as - a base path for modules. - -2004-10-26 Don Porter - - * generic/tclParse.c (Tcl_SubstObj): Fix for failed subst-12.3 test - * tests/subst.test (subst-12.3-5): More tests for Bug 1036649. - - * unix/Makefile.in (install-libraries): Updated the installation of - the http, msgcat, and tcltest packages to install as Tcl Modules on - Unix systems. Other platform Makefiles still need updating. [Patch - 1054370] - - * tests/basic.test: Added missing constraints. - * tests/compile.test: - * tests/fileSystem.test: - - * tests/init.test (init-2.8): Updated to not rely on http package. - -2004-10-26 Miguel Sofer - - * generic/tclInt.h: - * generic/tclVar.c: removed more direct references to the VAR flags, - replaced with access macros. - -2004-10-26 Donal K. Fellows - - * doc/expr.n: Clarified that non-num/non-bool literals require - quoting. [Bug 1027849]. Also listed booleans as acceptable values. - -2004-10-26 Kevin B. Kenny - - * library/clock.tcl (FreeScan): Fixed a bug that caused relative days - of the week in free-form [clock scan] to be evaluated in the wrong - time zone. - * tests/clock.test (clock-31.[456]): Made sure that there isn't an - env(TZ) or env(TCL_TZ) lying around that will override the time zone - that we're trying to establish with the simulated registry. - Both problems reported as [Bug 1054101]. - -2004-10-25 Donal K. Fellows - - * doc/string.n (map): Rewrote to clarify that we don't just map single - characters. [Bug 1048005] - * doc/info.n (procs): Clarified that the pattern argument may have - namespace separators in it. [Bug 1047928] - - * tests/cmdAH.test (cmdAH-8.45): Simplify in the hope that the reasons - for [Bug 1053908] will become clearer. - -2004-10-25 Don Porter - - * generic/tclExecute.c (IllegalExprOperandType,TclExecuteByteCode): - Removed several DECACHE_INFO/CACHE_INFO pairs that are no longer - needed for protection because routines like Tcl_SetErrorCode() and - Tcl_AddErrorInfo() can no longer re-enter bytecode execution. - - * generic/tclResult.c (TclProcessReturn): Bug fix. Be sure that a - missing -errorinfo option when code == TCL_ERROR causes the errorInfo - field to get reset. - - * tests/thread.test (thread-4.4): Test depended on a ::errorInfo value - initialized to "". Added code to test to setup that requirement. - - * library/auto.tcl: Purged Tcl's script library of all - * library/clock.tcl: remaining references to global vars - * library/init.tcl: ::errorInfo and ::errorCode. - - * generic/tclMain.c (Tcl_Main): Updated to make use of - TclGetReturnOptions instead of ::errorInfo variable. - - * generic/tclInterp.c (tclInit): Bug fix. Access dict variables with - [dict get], not array syntax. - -2004-10-25 Donal K. Fellows - - * tests/tm.test: Rewrote the tests to actually perform syntax checks - on the public API. Added a new test (currently failing) to indicate - that the test suite is not complete yet. - * library/tm.tcl (path): Rewrote to turn this command into an ensemble - to make it faster and simpler. - -2004-10-24 Miguel Sofer - - * generic/tclCmdIL.c: - * generic/tclExecute.c: - * generic/tclInt.h: - * generic/tclTrace.c: defined new macros to get/set the flags of - variables. The only files that still access the flag values directly - are tclCompCmds.c, tclCompile.c, tclProc.c and tclVar.c - -2004-10-24 Don Porter - - * generic/tclBasic.c (Tcl_LogCommandInfo,Tcl_AddObjErrorInfo): Shift - the initialization of errorCode to NONE to more central location. - - * generic/tclEvent.c (BgError,Tcl_BackgroundError,HandleBgErrors): - Rewrite to build on the new TclGet/SetReturnOptions routines. - - * generic/tclResult.c (TclGetReturnOptions): Add call to - Tcl_AddObjErrorInfo to be sure error fields are initialized. - - * generic/tclResult.c (TclTransferResult): Rewrite to build on the new - TclGet/SetReturnOptions routines. - -2004-10-22 Donal K. Fellows - - * doc/tm.n: Tightened up the documentation. - * tests/tm.test: Created (with partially dummy content) so TIP#189 can - be marked Final. - - * generic/tclNamesp.c (NsEnsembleImplementationCmd): Make ensembles - cut their implementations out of error traces. This is the right thing - to do more often than not. - -2004-10-22 Kevin B. Kenny - - * library/clock.tcl: Fixed a typo where the fallback time zone became - ::localtime instead of :localtime. Fixed a bug where time zone names - containing hyphens could not be loaded. - * tests/clock.test: Added regression test cases that covers both bugs. - Thanks to Todd M. Helfter for finding - these bugs. - -2004-10-22 Donal K. Fellows - - * generic/tclExecute.c (TclCompEvalObj, Tcl_ExprObj): - * generic/tclProc.c (TclProcCompileProc): Always call object - freeIntRepProc's in the same way. - -2004-10-22 Miguel Sofer - - * generic/tclVar.c: fixed bug in commit of 2004-07-23, which was - causing a leak of Proc structures and failure of compile-12.1. Two - lines were 'zombies' from the previous way localVarNames worked. - Credit dgp for finding this. - -2004-10-21 Don Porter - - * generic/tclInt.h (Interp): - * generic/tclBasic.c (Tcl_CreateInterp,Tcl_DeleteInterp): - * generic/tclResult.c (GetKeys,ReleaseKeys,etc.): Moved the key values - of the return options dictionary out of private fields of the Interp - struct and into thread-static values managed in tclResult.c. - - * generic/tclCmdAH.c (Tcl_CatchObjCmd, Tcl_ErrorObjCmd): Updated to - call the new TclGet/SetReturnOptions routines to do much of their - work. - - * generic/tclInt.h (TclGetReturnOptions,TclSetReturnOptions): - * generic/tclResult.c (TclGetReturnOptions,TclSetReturnOptions): New - utility routines to get/set the return options of an interp. Intent is - that these routines will be converted to public routines after TIP - approval. - - * generic/tclCmdMZ.c (TclProcessReturn,TclMergeReturnOptions): - * generic/tclResult.c (TclProcessReturn,TclMergeReturnOptions): Move - internal utility routines from tclCmdMZ.c to tclResult.c. - - * generic/tclBasic.c (Tcl_CreateInterp, Tcl_DeleteInterp): - * generic/tclResult.c (TclTransferResult): Rework so that - iPtr->returnOpts can be NULL when there are no special options. - - * generic/tclResult.c (TclRestoreInterpState): Plug potential memory - leak. - -2004-10-21 Kevin B. Kenny - - * generic/tclBasic.c: Various changes to [clock format] that, - * generic/tclClock.c: together, make it roughly twice as fast - * generic/tclInt.h: while all tests in the test suite - * library/clock.tcl: continue to pass. - -2004-10-20 Andreas Kupries - - * win/Makefile.in (install-msgs): Fixed a problem with the - * win/Makefile.in (install-tzdata): installation of timezone data and - message catalogs. They used the installed tcl library directory, not - the source library. Before it was installed. Switched to source lib - dir. Thanks to Kevin for the help in figuring this out. - -2004-10-20 Don Porter - - * generic/tclThreadTest.c (ThreadEventProc): Corrected subtle bug - where the returned (char *) from Tcl_GetStringResult(interp) continued - to be used without copying or refcounting, while activity on the - interp continued. That's not safe, and recent changes demonstrated the - lack of safety with failing tests thread-4.3 and thread-4.5. - -2004-10-19 Donal K. Fellows - - * generic/tclDictObj.c (DictWithCmd): Make sure all paths (that are - not themselves error paths) do not lose the result code. - -2004-10-19 Don Porter - - * generic/tclInt.h (Tcl*InterpState): New internal routines - * generic/tclResult.c (Tcl*InterpState): TclSaveInterpState, - TclRestoreInterpState, and TclDiscardInterpState are superior - replacements for Tcl_(Save|Restore|Discard)Result. Intent is that - these routines will be converted to public routines after TIP - approval. Interfaces for these routines were shamelessly stolen from - Itcl. - - * generic/tclBasic.c (TclEvalObjvInternal): - * generic/tclDictObj.c (DictUpdateCmd, DictWithCmd): - * generic/tclIOGT.c (ExecuteCallback): - * generic/tclTrace.c (Trace*Proc,TclCheck*Traces,TclCallVarTraces): - Callers of Tcl_*Result updated to call the new routines. The calls - were relocated in several cases to perform save/restore operations - only when needed. - - * generic/tclEvent.c (HandleBgErrors): - * generic/tclFCmd.c (CopyRenameOneFile): Calls to Tcl_*Result that - were eliminated because they appeared to serve no useful purpose, - typically saving/restoring an error message, only to throw it away. - -2004-10-18 Don Porter - - * generic/tclBasic.c (Tcl_CreateInterp,Tcl_DeleteInterp): - * generic/tclCmdAH.c (Tcl_CatchObjCmd): - * generic/tclCmdMZ.c (TclMergeReturnOptions,TclProcessReturn): - * generic/tclCompCmds.c (TclCompileReturnCmd): - * generic/tclExecute.c (TclCompEvalObj): - * generic/tclInt.h (Interp): - * generic/tclProc.c (TclUpdateReturnInfo): Place primary storage of - the -level and -code information in private fields of the Interp - struct, rather than in a DictObj. This should significantly improve - performance of TclUpdateReturnInfo. - -2004-10-17 Miguel Sofer - - * generic/tclResult.c: removed unused variable [Bug 1048588]. Thanks - to Daniel South. - -2004-10-15 Don Porter - - * generic/tclCmdMZ.c (TclProcessReturn): Now that primary - * generic/tclProc.c (TclUpdateReturnInfo): storage for the - errorInfo and errorCode values are internal fields, we can set them at - the time of the [return] command, and not have to wait until the - specified number of "-level"s have popped. - - * generic/tclBasic.c (Tcl_CreateInterp, Tcl_DeleteInterp) - (TclEvalObjvInternal, Tcl_LogCommandInfo, TclAddObjErrorInfo): - * generic/tclCmdAH.c (Tcl_CatchObjCmd): - * generic/tclEvent.c (BgError, ErrAssocData, Tcl_BackgroundError) - (HandleBgErrors, BgErrorDeleteProc): - * generic/tclExecute.c (TclCreateExecEnv, TclDeleteExecEnv): - * generic/tclIOUtil.c (comments only): - * generic/tclInt.h (ExecEnv,Interp, ERR_IN_PROGRESS): - * generic/tclInterp.c ([tclInit]): - * generic/tclMain.c (comments only): - * generic/tclNamesp.c (Tcl_CreateNamespace, Tcl_DeleteNamespace) - (TclTeardownNamespace): - * generic/tclProc.c (TclUpdateReturnInfo): - * generic/tclResult.c (Tcl_ResetResult, TclTransferResult): - * generic/tclTrace.c (CallVarTraces): - Reworked management of the "errorInfo" data of an interp. That - information is now primarily stored in a new private (Tcl_Obj *) field - of the Interp struct, rather than using a global variable ::errorInfo - as the primary storage. The ERR_IN_PROGRESS flag bit value is no - longer required to manage the value in its new location, and is - removed. Variable traces are established to support compatibility for - any code expecting the ::errorInfo variable to hold the information. - - ***POTENTIAL INCOMPATIBILITY*** - Code that sets traces on the ::errorInfo variable may notice a - difference in timing of the firing of those traces. Code that uses the - value ERR_IN_PROGRESS. - -2004-10-14 Donal K. Fellows - - TIP#217 IMPLEMENTATION - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Add -indices option from James - Salsman. [Patch 1017532] - - * generic/tclUtil.c (TclMatchIsTrivial): Detect degenerate cases of - glob matching that let us avoid scanning through hash tables. - * generic/tclCmdIL.c (InfoCommandsCmd, InfoGlobalsCmd, InfoProcsCmd): - (InfoVarsCmd): Use this to speed up some [info] subcommands. - -2004-10-12 Kevin B. Kenny - - * library/tzdata/America/Campo_Grande: - * library/tzdata/America/Cuiaba: - * library/tzdata/America/Sao_Paulo - * library/tzdata/America/Argentina/Mendoza: - * library/tzdata/America/Argentina/San_Juan: - Synchronized to Olson's 'tzdata2004e'. - -2004-10-08 Donal K. Fellows - - TIP#201 AND TIP#212 IMPLEMENTATIONS - - * doc/dict.n, doc/expr.n: Documentation for new functionality. - * tests/expr.test: Basic tests of 'in' and 'ni' behaviour. - * tests/dict.test (dict-21.*,dict-22.*): Tests for [dict update] and - [dict with]. - * generic/tclExecute.c (TclExecuteByteCode): Implementation of the - INST_LIST_IN and INST_LIST_NOT_IN bytecodes. - * generic/tclParseExpr.c (GetLexeme): Parse the 'in' and 'ni' - operators for TIP#201. - * generic/tclDictObj.c (DictUpdateCmd,DictWithCmd): Core of - implementation of TIP#212; docs and tests still to do... - -2004-10-07 Don Porter - - * generic/tclTest.c (TestsetobjerrorcodeCmd): Simplified. - -2004-10-07 Vince Darley - - * generic/tclFileName.c: - * generic/tclFileSystem.h: - * generic/tclIOUtil.c: - * generic/tclPathObj.c: - * unix/tclUnixFile.c: - * win/tclWinFile.c: - * tests/fileName.test: - * tests/winFCmd.test: code reorganization for better generic/platform - code splitting [Bug 925620] removing the need for several #ifdef's, - and tests and fix for an unreported Windows glob problem ('glob -dir - C: -tails *'). - -2004-10-07 Donal K. Fellows - - * *.3: Convert CONST to const and VOID to void so we document how - people should actually use the Tcl API and not the compatibility hacks - that it has to have. - - * doc/man.macros, *.3: Update .AS macro so it can know how wide to - make the third column of the argument list. Update documentation for C - API (only users) to take advantage of this. - - * doc/FileSystem.3: Formatting fixes for greater documentation - clarity. - -2004-10-06 Donal K. Fellows - - * generic/tclFileName.c (DoGlob, TclGlob): Stop messy sharing of - interpreter result and instead use a private object for collecting the - result of the glob. This simplifies TclGlob quite a lot. - * generic/tclIOUtil.c (Tcl_FSMatchInDirectory): Simplify by removing - some nesting. Also standardize variable names. - (FsAddMountsToGlobResult): Force updates to the list to be done - in-place, putting a side-condition of non-shared-ness on the resultPtr - argument to Tcl_FSMatchInDirectory, but everything would have broken - before if that was shared *anyway*. - - * generic/tclEncoding.c (LoadTableEncoding): Removed reference to Tcl - interpreter; it wasn't needed as direct object use is more efficient. - - * generic/tclPathObj.c: Made this file follow the style rules in the - Engineering Manual more closely, and also take advantage of the - internal object manipulation macros more. - - * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): Reorganized to have fewer - magic flag variables and to separate the code that scans for a match - from the code that processes a match body. - -2004-10-06 Don Porter - - * generic/tclBasic.c: - * generic/tclBinary.c: - * generic/tclCmdAH.c: - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclCompExpr.c: - * generic/tclDictObj.c: - * generic/tclEncoding.c: - * generic/tclExecute.c: - * generic/tclFCmd.c: - * generic/tclHistory.c: - * generic/tclIndexObj.c: - * generic/tclInterp.c: - * generic/tclIO.c: - * generic/tclIOCmd.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclPkg.c: - * generic/tclResult.c: - * generic/tclScan.c: - * generic/tclTimer.c: - * generic/tclTrace.c: - * generic/tclUtil.c: - * generic/tclVar.c: - * unix/tclUnixFCmd.c: - * unix/tclUnixPipe.c: - * win/tclWinDde.c: - * win/tclWinFCmd.c: - * win/tclWinPipe.c: - * win/tclWinReg.c: - It is a poor practice to directly set or append to the value of the - objResult of an interp, because that value might be shared, and in - that circumstance a Tcl_Panic() will be the result. Searched for - example of this practice and replaced with safer alternatives, often - using the Tcl_AppendResult() routine that dkf just rehabilitated. - * library/dde/pkgIndex.tcl: Bump to dde 1.3.1 - * library/reg/pkgIndex.tcl: Bump to registry 1.1.5 - -2004-10-06 Donal K. Fellows - - * doc/SetResult.3: Made Tcl_AppendResult non-deprecated; better that - people use it than most of the common alternatives! - * generic/tclResult.c (Tcl_AppendResultVA): Make this work better with - Tcl_Objs. [Patch 1041072] - (Tcl_SetResult, Tcl_AppendElement): Change string to stringPtr to - avoid C++ keywords. - -2004-10-05 Don Porter - - * generic/tclBasic.c (TclObjInvoke): More simplification of the - TclObjInvoke routine toward unification with the rest of the - evaluation stack. - - * generic/tclBasic.c (Tcl_CreateInterp, Tcl_DeleteInterp) - (TclEvalObjvInternal, Tcl_LogCommandInfo): - * generic/tclCmdAH.c (Tcl_CatchObjCmd): - * generic/tclEvent.c (BgError, Tcl_BackgroundError, HandleBgErrors): - * generic/tclInt.h (Interp, ERROR_CODE_SET): - * generic/tclNamesp.c (Tcl_CreateNamespace, Tcl_DeleteNamespace) - (TclTeardownNamespace): - * generic/tclResult.c (Tcl_ResetResult, Tcl_SetObjErrorCode) - (TclTransferResult): - * generic/tclTrace.c (CallVarTraces): - Reworked management of the "errorCode" data of an interp. That - information is now primarily stored in a new private (Tcl_Obj *) field - of the Interp struct, rather than using a global variable ::errorCode - as the primary storage. The ERROR_CODE_SET flag bit value is no longer - required to manage the value in its new location, and is removed. - Variable traces are established to support compatibility for any code - expecting the ::errorCode variable to hold the information. - - ***POTENTIAL INCOMPATIBILITY*** - Code that sets traces on the ::errorCode variable may notice a - difference in timing of the firing of those traces. - - * generic/tclNamesp.c (Tcl_PopCallFrame): Removed Bug 1038021 - workaround. That bug is now fixed. - -2004-10-04 Kevin B. Kenny - - * tests/clock.test (clock-34.*): Removed an antibug that forced - comparison of [clock scan] results with the :localtime time zone. Now - that [clock scan] uses the current time zone instead, the antibug - caused several tests to fail. [Bug 1038554] - -2004-10-04 Donal K. Fellows - - * generic/tclParseExpr.c (GetLexeme): Ensure that the 'eq' and 'ne' - operators are followed by non-alphabetic characters so lexemes can't - run together. [Bug 884830] - - * doc/DictObj.3, doc/dict.n: Clarified that a dictionary is not - order-preserving. [Bug 1032243] Also added another example to show off - more ways of using a dictionary and a few other formatting - improvements. - -2004-10-02 Donal K. Fellows - - * generic/tclDictObj.c (TraceDictPath, Tcl_DictObjPutKeyList): Add - support for automatic creation of dictionary paths since that is what - everyone seems to actually expect of the API! [Bug 1037235] - (Tcl_DictObjNext): Make calling this after Tcl_DictObjDone non-fatal - as that simplifies a number of internal APIs. This doesn't break any - existing working code as it is a case which previously caused a panic. - -2004-10-02 Don Porter - - * tests/namespace.test (namespace-8.7): Another test for save/restore - of ::errorInfo and ::errorCode during global namespace teardown. - -2004-10-01 Donal K. Fellows - - * generic/tclProc.c (TclObjGetFrame, Tcl_UplevelObjCmd): - * generic/tclVar.c (Tcl_UpvarObjCmd): Cache stackframe level - references in the level object for speed. - -2004-09-30 Don Porter - - * generic/tclBasic.c (Tcl_CreateInterp): - * generic/tclInt.h (Interp): Removed the flag bit value - EXPR_INITIALIZED. It was set during interp creation and never tested. - Whatever purpose it had is in the past. - - * generic/tclBasic.c (Tcl_EvalObjEx): Removed the flag bit value - * generic/tclInt.h (Interp): USE_EVAL_DIRECT. It was used - * generic/tcLTest.c (TestevalexObjCmd): only in the testing command - * tests/parser.test (parse-9.2): [testevalex] and nothing in - the test suite made use of the capability it enabled. - - * generic/tclBasic.c (Tcl_AddObjErrorInfo): More re-organization - * generic/tclCmdAH.c (Tcl_ErrorObjCmd): of the management of - * generic/tclCmdMZ.c (TclProcessReturn): the errorCode value. - * tests/error.test (error-6.4-9): - - * generic/tclNamespace.c (TclTeardownNamespace): Tcl_Obj-ified - * tests/namespace.test (namespace-8.5,6): the save/restore of - ::errorInfo and ::errorCode during global namespace teardown. Revised - the comment to clarify why this is done, and added tests that will - fail if this is not done. - - * generic/tclResult.c (TclTransferResult): Added safety checks so that - unexpected undefined ::errorInfo or ::errorCode will not lead to a - segfault. - - * generic/tclTrace.c (TclCallVarTraces): Save/restore the flag values - * tests/var.test (var-16.1): that define part of the - interpreter state during variable traces. [Bug 1038021]. - -2004-09-30 Miguel Sofer - - * tests/subst.test (12.1-2): added tests for [Bug 1036649] - -2004-09-29 Don Porter - - * tests/basic.test (49.*): New tests for TCL_EVAL_GLOBAL. - -2004-09-29 Donal K. Fellows - - * generic/tclVar.c (TclObjLookupVar, TclObjLookupVar): - (TclObjUnsetVar2, SetArraySearchObj): - * generic/tclUtil.c (SetEndOffsetFromAny): - * generic/tclStringObj.c (Tcl_SetStringObj): - (Tcl_SetUnicodeObj, SetStringFromAny): - * generic/tclResult.c (ResetObjResult): - * generic/tclRegexp.c (Tcl_GetRegExpFromObj): - * generic/tclPathObj.c (TclFSMakePathRelative, SetFsPathFromAny): - (TclFSMakePathFromNormalized, Tcl_FSNewNativePath): - * generic/tclObj.c (TclFreeObj, Tcl_SetBooleanObj, SetBooleanFromAny): - (Tcl_SetDoubleObj, SetDoubleFromAny, Tcl_SetIntObj): - (SetIntOrWideFromAny, Tcl_SetLongObj, SetWideIntFromAny): - (Tcl_SetWideIntObj, TclSetCmdNameObj, SetCmdNameFromAny): - * generic/tclNamesp.c (SetNsNameFromAny, MakeCachedEnsembleCommand): - * generic/tclListObj.c (Tcl_SetListObj, SetListFromAny): - * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): - * generic/tclDictObj.c (SetDictFromAny): - * generic/tclCompile.c (TclInitByteCodeObj): - * generic/tclBinary.c (Tcl_SetByteArrayObj, SetByteArrayFromAny): - * generic/tclInt.h (TclFreeIntRep): Factorize out deletion of object - internal representation to a shared macro, so simplifying much code. - -2004-09-27 Miguel Sofer - - * generic/tclBasic.c (TclObjInvoke): fix for bogus gcc warning about - uninitialised variable. - -2004-09-27 Don Porter - - * generic/tclBasic.c: Removed internal routines TclInvoke, - * generic/tclInt.decls: TclGlobalInvoke, TclObjInvokeGlobal and the - * tests/basic.test: portion of TclObjInvoke that handles calls - without TCL_INVOKE_HIDDEN enabled. None of this code is called any - longer within the core, and the superior public interface, - Tcl_EvalObjv, is available for any external callers. - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclEvent.c (HandleBgErrors): Updated [bgerror] invocations - to make use of Tcl_Obj based routines, dropping the calls to - TclGlobalInvoke() - -2004-09-27 Vince Darley - - * generic/tclFileName.c: - * generic/tclFileSystem.h: - * generic/tclIOUtil.c: - * generic/tclPathObj.c: - * tests/cmdAH.test: - * tests/fileSystem.test: - * tests/winFCmd.test: fix to bad error message with 'cd' on windows, - when permissions are inadequate [Bug 1035462] and to treatment of a - volume-relative pwd on Windows [Bug 1018980]. - - * doc/FileSystem.3: added missing Tcl_GlobTypeData documentation [Bug - 935853] - -2004-09-27 Kevin Kenny - - * compat/strftime.c (Removed): - * generic/tclClock.c (removed TclClockOldscanObjCmd): - * generic/tclDate.c (Regenerated): - * generic/tclGetDate.y: - * generic/tclInt.decls (removed TclGetDate and TclpStrftime): - * generic/tclInt.h (removed TclGetDateInfo): - * generic/tclIntDecls.h (Regenerated): - * generic/tclStubInit.c (Regenerated): - * library/clock.tcl: - * unix/tclUnixTime.c (removed TclpStrftime): - * win/Makefile.in: - * win/makefile.bc: - * win/makefile.bc: - * win/tcl.dsp: - Continued refactoring of [clock] for TIP 173 changes. Broke the - free-form parser apart so that the Bison parser is responsible for - only parsing, while clock.tcl handles relative times like "next - Thursday", "next January". This change is needed to make timezones - other than :localtime and :Etc/UTC work with free-form scanning. This - change closes out the issue identified as being "for another day" in - my log message of 2004-09-08. The refactored code also eliminates the - last known references to TclpStrftime and TclGetDate, so those - routines (including compat/strftime.c) have been removed. The - refactoring also has the benefit 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 - - * doc/FileSystem.3: fix to small typo. - -2004-09-26 Miguel Sofer - - * generic/tclCompCmds.c: - * generic/tclCompExpr.c: - * generic/tclCompile.c: - * generic/tclCompile.h: - * generic/tclInt.h: - * generic/tclProc.c: - * tests/compExpr-old.test: - * tests/compExpr.test: - * tests/expr.test: - * tests/for.test: - * tests/if.test: - * tests/incr.test: - * tests/while.test: - Report compilation errors at runtime, [Patch 1033689] by dgp. - -2004-09-23 Mo DeJong - - * unix/dltest/Makefile.in (clean): Fixup make clean rule so that it - does not delete all files when SHLIB_SUFFIX is set to the empty string - in a static build. [Bug 1016726] - -2004-09-23 Don Porter - - * generic/tclBasic.c: Corrections to the 2004-09-21 commit - * generic/tclExecute.c: regarding ERR_ALREADY_LOGGED. That commit - * generic/tclNamesp.c: caused Tk test send-10.7 to fail. Added - * tests/namespace.test (25.7,8): tests in the Tcl test suite - * tests/pkg.test (2.25,26): to catch this error without the aid - of Tk in the future. - - * generic/tclCmdAH.c (Tcl_ExprObjCmd): Simplified the TclObjCmdProc - of [expr] with a call to Tcl_ConcatObj. - -2004-09-22 Don Porter - - * generic/tclCmdMZ.c (TclProcessReturn): Support the -errorline - * generic/tclCompile.c (TclCompileScript): option to [return]. - * tests/compile.test (16.23.*): Use that capability to defer reporting - * tests/misc.test (1.2): of parse errors until runtime. Updated - tests to reflect change. [Bug 1032805] - -2004-09-22 Miguel Sofer - - * generic/tclExecute.c (INST_START_CMD): - * tests/proc.test (7.2-3): fix for [Bug 729692] was incorrect whenever - a loop exception was returned. - -2004-09-22 Kevin B. Kenny - - * library/tzdata/America/Montevideo: Updated to reflect - ftp://elsie.nci.nih.gov/pub/tzdata2004d.tar.gz. (Changes to - Asia/Jerusalem were in the comments only.) [Routine maintenance - no - bug] Spanish-language description of the change at - http://www.presidencia.gub.uy/decretos/2004091502.htm - -2004-09-21 Don Porter - - * generic/tclCompCmds.c: Tolerate [append] syntax errors - * tests/appendComp.test (8.1): at compile time, and allow runtime to - raise the error (or succeed if a redefined [append] allows). - - * generic/tclBasic.c: Reworked management of the interp flag - * generic/tclCompile.c: ERR_ALREADY_LOGGED, to reduce its exposure. - * generic/tclExecute.c: Still left several referebces that are just - * generic/tclNamesp.c: too nice on performace to do away with. These - changes also resolve an inconsistency in the ::errorInfo values - produced by [namespace eval x error foo bar] and [namespace eval x - {error foo bar}]. - - * generic/tclExecute.c (TclCompEvalObj): Simplified the - TclCompEvalObj routine. Much housekeeping now reliably happens - elsewhere. [Patch 1031949] - -2004-09-21 Donal K. Fellows - - * doc/interp.n: Tighten up wording on how [interp eval] and [interp - invokehidden] operate w.r.t. stack frames. [Bug 926590] - -2004-09-20 Don Porter - - * tests/error.test (error-6.2,3): Added more tests to verify - ::errorCode setting by/after a [catch]. - -2004-09-19 Miguel Sofer - - * generic/tclCmdAH.c: removed outdated comment [Bug 1029518]. - -2004-09-18 David Gravereaux - - * win/tclAppInit.c: Dde package can load into a safe interp. Claim - this fact for the Tcl_StaticPackage() call when the shell is built - with the TCL_USE_STATIC_PACKAGES option. - -2004-09-18 Donal K. Fellows - - * generic/tclExecute.c (TEBC-INST_LSHIFT,INST_RSHIFT): Ensure that - large shifts end up shifting correctly. [Bug 868467] - - * doc/FileSystem.3, doc/OpenFileChnl.3: More documentation fixes from - Mikhail Kolesnitchenko. [Patch 1022527] - * doc/*: Standardize highlighting of symbols defined in tcl.h - -2004-09-17 Don Porter - - * generic/tclBasic.c (Tcl_AddObjErrorInfo, Tcl_LogCommandInfo): - * generic/tclCmdAH.c ([catch], [error]): - * generic/tclCmdMZ.c ([return]): - * generic/tclProc.c (TclUpdateReturnInfo): - * generic/tclResult.c (Tcl_SetErrorCodeVA, Tcl_SetObjErrorCode) - (TclTransferResult): Refactored so that all errorCode setting flows - through Tcl_SetObjErrorCode(). This greatly reduces the number of - different places in the code that need to know details about an - internal bitflag field of the Interp struct. Also places errorCode - setting in one place for easier future mods. - -2004-09-17 Kevin B.Kenny - - * generic/tclDate.c: Revised tclGetDate.y to use bison instead of - * generic/tclGetDate.y: yacc to build the parser, eliminating all the - * generic/tclInt.h: complicated hackery involving 'sed' - * unix/Makefile.in: postprocessing. Rebuilt the parser. - -2004-09-14 Kevin B. Kenny - - * generic/tclClock.c (ClockOldscanObjCmd): Silenced a compiler warning - (long passed as a param where unsigend long was expected). 'Unsigned - long' is wrong, but the fix is really to change the signature of - TclGetDate to return a structure of its 'yy' variables and then do the - remaining work inside clock.tcl. But, as I said on 2004-09-08, that's - a job for another day. [Bug 1027993] - -2004-09-10 Miguel Sofer - - * doc/interp.n: - * generic/tclInterp.c (TclPreventAliasLoop, AliasCreate): - * tests/interp.test (17.4-6, 19.3-4): fixing problems with renaming of - aliases [Bugs 707104 1026493]. Fix designed by dgp. - -2004-09-13 Donal K. Fellows - - * generic/tclNamesp.c (NsEnsembleImplementationCmd): Add token field - to internal rep of EnsembleCmdRep structure so that we can check it to - see if the subcommand object is really being used with the same - ensemble. [Bug 1026903] - -2004-09-11 Kevin B. Kenny - - * generic/tclClock.c (TclMktimeObjCmd): Corrected a bad check for - error return from 'mktime'. - * generic/tclObj.c (Tcl_GetIntFromObj): Corrected a problem where - demoting a wide to an int failed on a big-endian machine. [Bug - 1026125]. - * tests/clock.test (clock-43.1): Added regression test for error - return from 'mktime'. - -2004-09-11 Miguel Sofer - - * generic/tclExecute.c (INST_CONCAT1): fix for [Bug 1025834]; avoid - unnecessary string copies. - -2004-09-10 David Gravereaux - - * tests/tcltest.test: tcltest-12.3-4 needed to have - ::tcltest::loadScript set to empty in their -setup - -2004-09-10 Donal K. Fellows - - * generic/tclObj.c (SetIntOrWideFromAny): Rewritten integral value - parsing code so that values do not flip so easily between numeric - representations. Thanks to KBK for this! [Bug 868489] - - * generic/tclIO.c (Tcl_Seek): Make sure wide seeks do not fail to set - ::errorCode on error. [Bug 1025359] - -2004-09-10 Andreas Kupries - - * generic/tcl.h: Micro formatting fixes. - * generic/tclIOGT.c: Channel version fixed, must be 3, to have - wideseekProc. Thanks to David Graveraux . - -2004-09-11 Don Porter - - * generic/tclNamespace.c (TclGetNamespaceForQualName): Resolved - longstanding inconsistency in the treatment of the TCL_NAMESPACE_ONLY - flag revealed by testing the 2004-09-09 commits against Itcl. - TCL_NAMESPACE_ONLY now acts as specified in the pre-function comment, - forcing resolution in the passed in context namespace. It has been - incorrectly forcing resolution in the interp's current namespace. - -2004-09-10 Kevin Kenny - - * library/clock.tcl: Fixed a bug where %z always put a plus sign on - the time zone in :localtime. - * tests/clock.test: Added test case for the above bug. - -2004-09-10 Miguel Sofer - - * generic/tclExecute.c (INST_CONCAT1): added a peephole optimisation - for concatting an empty string. This enables replacing the idiom 'K $x - [set x {}]' by '$x[set x {}]' for fastest execution. - -2004-09-09 David Gravereaux - - * win/tclWinConsole.c: Calls to WriteFile and WriteConsoleA changed to - WriteConsole for simplicity. - -2004-09-09 Don Porter - - * generic/tclNamesp.c (Tcl_ForgetImport): Corrected faulty - - * tests/namespace.test: logic that relied exclusively on string - matching and failed in the presence of [rename]s. [Bug 560297] Also - corrected faulty prevention of [namespace import] cycles. [Bug 1017299] - -2004-09-08 Don Porter - - * generic/tclBasic.c (Tcl_CreateInterp): Removed obsolete field - for storing the string-based command procedure of built-in commands. - We no longer have any string-based built-in commands! - -2004-09-08 Kevin B. Kenny - - * compat/strftime.c (_conv): Corrected a problem where hour 0 would - format as a blank format group with %k. - * doc/clock.n: Corrected a buglet in the header information. [Bug - 1024058] - * generic/tclClock.c (TclClockMktimeObjCmd): Fixed a bug where the - month was scanned incorrectly in -timezone :localtime. - * tests/clock.test (clock-34.*,clock-40.1, clock-41.1): Adjusted the - clock-34.* test cases so that the consistency check is performed in - :localtime rather than the current time zone. This change allows - dealing with issues where the C library has a different idea of DST - conversion than Tcl. (Real fix would be to break TclGetDate into - separate parser and time converter, and do the time conversion in - clock.tcl. That's for another day.) Added regression test case for the - bug where month was scanned incorrectly in -timezone :localtime. [Bug - 1023779] Added regression test case for %k at the zero hour. - -2004-09-07 David Gravereaux - - * win/makefile.vc: some quoting needed to be removed as it was - breaking with VC7. [Bug 1023150] - -2004-09-07 Kevin B. Kenny - - * doc/clock.n: Documented the default -format, and changed references - to a (nonexistent) msgcat command to refer to the msgcat package. [Bug - 1023870] - * generic/tclTimer.c: Removed a premature optimisation that attempted - to store the assoc data in the client data; the optimisation caused a - bug that [after] would overwrite its imports. [Bug 1016167] - * library/clock.tcl (InitTZData, ClearCaches): Changed so that the - in-memory time zone :UTC (and its aliases) always gets reinitialised, - in case tzdata is absent. [Bug 1019537, 1023779] - * library/tzdata/*: Regenerated. - * tests/clock.test (clock-31.*, clock-39.1): Corrected a problem where - the 'system' locale tests fail on a non-English Windows machine. [Bug - 1023761]. Added a test to make sure that alias time zones load - correctly. [Bug 1023779]. - * tests/timer.test (timer-1.1, timer-2.1): Changed to (one hopes!) be - more resilient on an overloaded system, if [after 200] sleeps for 300 - ms or longer. - * tools/tclZIC.tcl (writeLinks): Corrected a problem where alias time - zone names were written incorrectly, causing them to fail to load at - run time. [Bug 1023779]. - * win/tclWinTime.c (Tcl_GetTime): Eliminated CPUID tests on Win64 - - assuming that HAL vendors now do a better job of keeping the - performance counters synchronized among CPU's. [Bug 1020445] - -2004-09-06 Donal K. Fellows - - * doc/tclvars.n, doc/tcltest.n, doc/tclsh.1, doc/safe.n, doc/expr.n - * doc/WrongNumArgs.3, doc/Utf.3, doc/TraceVar.3, doc/Thread.3 - * doc/TCL_MEM_DEBUG.3, doc/SubstObj.3, doc/StdChannels.3 - * doc/SetResult.3, doc/RegExp.3, doc/RegConfig.3, doc/RecEvalObj.3 - * doc/PrintDbl.3, doc/ParseCmd.3, doc/Panic.3, doc/ObjectType.3 - * doc/Object.3, doc/Namespace.3, doc/Interp.3, doc/IntObj.3 - * doc/Hash.3, doc/GetOpnFl.3, doc/GetIndex.3, doc/Eval.3 - * doc/Encoding.3, doc/DoubleObj.3, doc/DictObj.3, doc/CrtTimerHdlr.3 - * doc/CrtObjCmd.3, doc/CrtMathFnc.3, doc/CrtCommand.3, doc/CrtChannel.3 - * doc/ChnlStack.3, doc/ByteArrObj.3, doc/AssocData.3, doc/Alloc.3: - More documentation fixes from Mikhail Kolesnitchenko. [Patch 1022527] - -2004-09-03 Donal K. Fellows - - * unix/tclUnixFCmd.c: Stop NULL interp arguments from triggering a - crash when an error happens. [Bug 1020538] - -2004-09-02 Donal K. Fellows - - * doc/lsearch.n: Clarified meaning of -dictionary. [Bug 759545] - -2004-09-02 Vince Darley - - * win/makefile.vc: clock.tcl needs to be installed. - -2004-09-01 Jeff Hobbs - - * win/tclWinReg.c (BroadcastValue): WIN64 cast corrections - - * win/tclWinDde.c (DdeClientWindowProc): - (DdeServicesOnAck, DdeEnumWindowsCallback): WIN64 corrections - - * win/tclWin32Dll.c (TclWinCPUID): need _asm for WIN64 (Itanium), - until we have it, just return unknown. [Bug 1020445] - -2004-09-01 Donal K. Fellows - - * doc/regsub.n, doc/RegConfig.3, doc/Environment.3: - * doc/CrtChannel.3, doc/safe.n: Use correct abbreviations. - -2004-08-31 Donal K. Fellows - - * doc/trace.n, doc/socket.n, doc/registry.n, doc/pid.n: - * doc/namespace.n, doc/msgcat.n, doc/lsort.n, doc/lsearch.n: - * doc/linsert.n, doc/info.n, doc/http.n, doc/history.n: - * doc/format.n, doc/file.n, doc/exec.n, doc/dde.n, doc/clock.n: - * doc/catch.n, doc/binary.n: More spelling and grammar fixes from - Mikhail Kolesnitchenko. [Patch 1018486] - -2004-08-31 Vince Darley - - * doc/FileSystem.3: - * generic/tclIOUtil.c: Clarified documentation regarding ability of a - filesystem to say that it doesn't support a given operation using the - EXDEV posix error code (copyFileProc, renameFileProc, etc), and - updated one piece of code to ensure correct behaviour when an - operation is not supported [Bug 1017072] - - * tests/fCmd.test: fix to test suite problem [Bug 1002884] - -2004-08-31 Daniel Steffen - - * unix/Makefile.in (install-libraries): portable sh fix. - -2004-08-30 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Stop [string map] from - crashing when its map and input string are the same object. - -2004-08-27 Donal K. Fellows - - * generic/tclNamesp.c (FindEnsemble): Factor out the code to convert a - command name into an ensemble configuration and add support for - ignoring [namespace import] link chains. [Bug 1017022] - (NamespaceWhichCmd): Rework to use newer option parsing API. - -2004-08-27 Daniel Steffen - - * unix/Makefile.in: added customization of default module path roots - via TCL_MODULE_PATH makefile variable. - * macosx/Makefile: add platform standard locations to default module - path roots. [Patch 942881] - - * tests/env.test: macosx fixes. - -2004-08-25 Don Porter - - * tests/timer.test (timer-10.1): Test for Bug 1016167. - * generic/tclTimer.c: Workaround for situation when a [namespace - import] causes the objv[0] value to be something other than what - Tcl_AfterObjCmd expects. [Bug 1016167]. - -2004-08-25 Donal K. Fellows - - * generic/tclNamesp.c (NsEnsembleImplementationCmd): Use the ensemble - command token to get the name of the ensemble for passing to the - -unknown handler instead of relying on objv[0], which may contain - useless info in the presence of [namespace import]. Problem found by - Don Porter when investigating [Bug 1016167]. - -2004-08-24 Don Porter - - * generic/tclProc.c: The routine TclProcInterpProc was a - * generic/tclTestProcBodyObj.c: specific instance of the general - service already provided by TclObjInvokeProc. Removed - TclProcInterpProc and TclGetInterpProc from the code... - - * generic/tclInt.decls: ...and from the internal stubs table. - * generic/tclIntDecls.h - * generic/tclStubInit.c - -2004-08-24 Donal K. Fellows - - * doc/string.n: Added clarifying note. - -2004-08-23 Don Porter - - * library/auto.tcl: Updated [tcl_findLibrary] search path to - include any [::pkgconfig get scriptdir,runtime] directory, as - well as the $::auto_path. [RFE 695441] - -2004-08-21 Kevin B. Kenny - - * tests/clock.test (clock-38.1): Changed TZ setting to specify CET in - excruciating detail to deal with systems that lack the Posix defaults - for DST changes (and to be formally correct with the change dates for - CET). - -2004-08-19 Donal K. Fellows - - * generic/tclScan.c (Tcl_ScanObjCmd, ValidateFormat): Ensure that the - %ld conversion works correctly on 64-bit platforms. [Bug 1011860] - -2004-08-19 Kevin Kenny - - * library/clock.tcl (format): Changed default timezone format from - alphabetic to numeric to produce scannable times in more locales. - * tests/clock.test (clock-37.1): Removed now-unused 'needPST' - constraint and the comments that refer to it. - -2004-08-18 Andreas Kupries - - * library/init.tcl: Integrated TIP #189. We source a separate file - (see below), instead of inlining the contents of that file. This - should beeasier to maintain, and easier to backport/install in 8.4 - installations. - - Note: Usage of Tcl Modules is restricted to non-safe interps. It - cannot be loaded into a safe interp. - - * library/tm.tcl: New file, the v2 reference implementation for TIP - #189, Tcl Modules. - - * doc/tm.n: New file, documentation for Tcl Modules, based on the TIP. - - * unix/mkLinks: Regenerated. - * win/makefile.vc: Added tm.tcl to list of files to install. - -2004-08-18 Kevin Kenny - - * tests/httpd (httpdRespond): Corrected an abuse of the [clock] - command that caused test failures for some values of [clock clicks]. - - * doc/clock.n - * generic/tclBasic.c (Tcl_CreateInterp, Tcl_HideUnsafeCommands): - * generic/tclClock.c (all): - * generic/tclInt.h: - * generic/tclInterp.c (CreateSlave): - * library/clock.tcl: (new file) - * library/init.tcl (clock): - * library/msgs/*.msg:(new files) - * library/tzdata/*: - * library/tzdata/*/*: - * library/tzdata/*/*/*: (new files) - * tools/installData.tcl: (new file) - * tools/loadICU.tcl: (new file) - * tools/makeTestCases.tcl: (new file) - * tools/tclZIC.tcl: (new file) - * unix/Makefile.in: - * unix/configure: (regenerated) - * unix/tcl.m4: - * tests/clock.test (all): - * win/Makefile.in: - * win/Makefile.vc: - Implementation of TIPs #173 and #209. - - The [clock] command is now a Tcl ensemble, with most of its - functionality written in Tcl and callouts to C code only to access - low-level functions such as localtime, mktime and tzset. - - In addition to the functionality changes called out in the two TIPs, - it is worth noting that the [clock] command in a safe slave - interpreter is now an alias to the [clock] command in the master, and - that [clock] is otherwise not expected to function entirely correctly - in safe interps. C code that simply does Tcl_MakeSafe needs to be - aware that [clock] may need special handling. (It appears unlikely - that such code actually exists.) - - One incompatibility of note is that if the time zone cannot be - determined from the TZ, TCL_TZ environment variables, or from the - Windows control panel, so that the C library must be used for date and - time conversions, then times outside the range of time_t will fail; - they used to return bad data silently. - - Many thanks to all the many people who assisted with testing, - debugging, criticism of the specification, and localisation. Deserving - of particular mention are Joe English, Clif Flynt, Donal K. Fellows, - Jeff Hobbs, Cameron Laird, Arjen Markus, Reinhard Max, Christopher - Nelson, Steve Offutt, Donald G. Porter, Pascal Scheffers, Peter da - Silva and Richard Suchenwirth-Bauersachs. - - *** POTENTIAL INCOMPATIBILITY *** - -2004-08-16 Miguel Sofer - - * doc/SetVar.3: - * generic/tclTest.c (TestseterrorcodeCmd): - * generic/tclVar.c (TclPtrSetVar): - * tests/result.test (result-4.*, result-5.*): [Bug 1008314] detected - and fixed by dgp. - -2004-08-13 Don Porter - - * library/msgcat/msgcat.tcl: Added checks to prevent [mclocale] - * tests/msgcat.test: from registering filesystem paths to possibly - malicious code to be evaluated by a later [mcload]. - -2004-08-10 Zoran Vasiljevic - - * unix/tclUnixThrd.c (TclpThreadCreate): changed handling of the - returned thread ID since broken on 64-bit systems (Cray). Thanks to - Rob Ratcliff for reporting the bug. - -2004-08-03 Donal K. Fellows - - * generic/tclNamesp.c (MakeCachedEnsembleCommand): Initialize the - epoch field cached in the subcommand. [Bug 989298] - (NsEnsembleImplementationCmd): Plug a leak (thanks to Miguel Sofer for - spotting it with valgrind) and reduce the number of goto labels to - make the code clearer. - -2004-08-02 Don Porter - - * library/package.tcl (pkg_mkIndex): Updated [pkg_mkIndex] to make - use of [glob -directory $dir -tails] and return options. - - TIP#207 IMPLEMENTATION - - * doc/interp.n: Added support for a -namespace option to the - * generic/tclBasic.c: [interp invokehidden] command. Also added an - * generic/tclInt.h: internal routine TclObjInvokeNamespace() and - * generic/tclInterp.c: corrected the flag names TCL_FIND_ONLY_NS and - * generic/tclNamesp.c: TCL_CREATE_NS_IF_UNKNOWN that are passed to the - * generic/tclTrace.c: internal routine TclGetNamespaceForQualName(). - * tests/interp.test: [Patch 981841] - - * generic/tclLiteral.c (TclCleanupLiteralTable): Corrected - * tests/compile.test (compile-12.4): flawed deletion of literal - internal reps that could lead to accessing of freed memory. Thanks to - Kevin Kenny for test case and fix [Bug 1001997]. - -2004-07-30 Don Porter - - * tests/safe.test (safe-2.1): Disabled senseless test. [Bug 999612] - - * library/auto.tcl (auto_reset): Removed "protected" list of commands - from [auto_reset]. All entries in the auto_index can be re-loaded. - * library/package.tcl: Updated comment to reflect 2004-07-28 commit. - - * generic/tclEvent.c (Tcl_Finalize): Re-organized Tcl_Finalize so - that Tcl_ExitProc's that call Tcl_Finalize recursively do not cause - deadlock. [Patch 999084 fixes Tk Bug 714956] - -2004-07-30 Daniel Steffen - - * unix/configure: - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Darwin: instead of setting PLAT_OBJS - to explict object files in tcl.m4, refer to MAC_OSX_OBJS makefile var. - * unix/Makefile.in: added MAC_OSX_OBJS variable. - -2004-07-29 Don Porter - - * library/package.tcl: [::pkg::create] is now an alias. Test safe-2.1 - will now fail until Bug 999612 is corrected. - -2004-07-28 Don Porter - - * library/package.tcl: Moved private command - * library/tclIndex: [pkg_compareExtension] into ::tcl::Pkg. - * tests/pkg_mkIndex.test: Also moved implementation of - [::pkg::create] to [::tcl::Pkg::Create]. - -2004-07-25 Pat Thoyts - - * tests/io.test: Make io-61.1 create file as binary to pass on Win32 - -2004-07-23 Miguel Sofer - - * generic/tclVar.c: simplify tclLocalVarNameType, removing the - reference to the corresponding proc. The reference is now seen as - unnecessary, and it may cause leaking circular references under some - circumstances (see for example [Bug 994838]). - -2004-07-22 Don Porter - - * tests/eofchar.data (removed): Test io-61.1 now generates its own - * tests/io.test: file of test data as needed. - -2004-07-20 Jeff Hobbs - - * generic/tclEvent.c: Correct threaded obj allocator to - * generic/tclInt.h: fully cleanup on exit and allow for - * generic/tclThreadAlloc.c: reinitialization. [Bug 736426] - * unix/tclUnixThrd.c: (mistachkin, kenny) - * win/tclWinThrd.c: - -2004-07-21 Kevin Kenny - - * generic/tclBasic.c (DeleteInterpProc): - * generic/tclLiteral.c (TclCleanupLiteralTable): - * generic/tclInt.h: added a TclCleanupLiteralTable function, called - from DeleteInterpProc, that frees internal representations of shared - literals early when an interpreter is being deleted. This change - corrects a number of memory mismanagement issues in the cases where - the internal representation of one literal contains a reference to - another, and avoids conditions such as resolved variable names - referring to procedure and namespace contexts that no longer exist. - [Bug 994838] - -2004-07-20 Daniel Steffen - - * unix/Makefile.in: - * win/Makefile.in: added 'install-private-headers' makefile target to - allow optionally installing private tcl headers. [FR 922727] - - * macosx/Makefile: use new 'install-private-headers' target to install - private headers into framework. [FR 922727] - - * unix/tclUnixFile.c (NativeMatchType): added support for readonly - matching of user immutable files (where available). - - * macosx/tclMacOSXBundle.c: dynamically acquire address for - CFBundleOpenBundleResourceMap symbol, since it is only present in full - CoreFoundation on Mac OS X and not in CFLite on pure Darwin. - -2004-07-19 Zoran Vasiljevic - - * win/tclwinThrd.c: redefined MASTER_LOCK to call TclpMasterLock. - Fixes [Bug 987967] - -2004-07-17 Vince Darley - - * generic/tclIOUtil.c: fix to rare 'cd' infinite loop in normalization - with vfs [Bug 991420]. - * tests/fileSystem.test: added test for above bug. - - * doc/FileSystem.3: clarified documentation of posix error codes in - 'remove directory' FS proc - 'EEXIST' is used to signify a non-empty - directory error (bug reported against tclvfs). - -2004-07-16 Jeff Hobbs - - * unix/Makefile.in, unix/tcl.m4: move (C|LD)FLAGS after their - * unix/configure.in, unix/configure: _DEFAULT to allow for env setting - to override m4 switches. Move SC_MISSING_POSIX_HEADERS up and - consolidate calls to limit redundancy in configure. - (CFLAGS_WARNING): Remove -Wconversion - (SC_ENABLE_THREADS): Set m4 to force threaded build when built against - a threaded Tcl core. - -2004-07-16 Andreas Kupries - - * generic/tclIOCmd.c (Tcl_FcopyObjCmd): Corrected a typo in the - generation of error messages and simplified by reusing data in a - variable instead of retrieving the string again. Fixes [Bug 835289]. - - * doc/OpenFileChnl.3: Added description of the behaviour of - Tcl_ReadChars when its 'charsToRead' argument is set to -1. Fixes [Bug - 934511]. - - * doc/CrtCommand.3: Added note that the arguments given to the command - proc of a Tcl_CreateCommand are in utf8 since Tcl 8.1. Closing [Patch - 414778]. - - * doc/ChnlStack.3: Removed the declaration that the interp argument to - Tcl_(un)StackChannel can be NULL. This fixes [Bug 881220], reported by - Marco Maggi . - - * tests/socket.test: Accepted two new testcases by Stuart Casoff - checking that -server and -async don't go - together [Bug 796534]. - - * unix/tclUnixNotfy.c (NotifierThreadProc): Accepted Joe Mistachkin's - patch for [Bug 990500], properly closing the notifier thread when its - exits. - -2004-07-15 Andreas Kupries - - * unix/tclUnixThrd.c (TclpFinalizeMutex): Accepted Joe Mistachkin's - patch for [Bug 990453], closing leakage of mutexes. They were not - destroyed properly upon finalization. - -2004-07-15 Andreas Kupries - - * generic/tclIO.h (CHANNEL_INCLOSE): New flag. Set in - * generic/tclIO.c (Tcl_UnregisterChannel): 'Tcl_Close' while the - * generic/tclIO.c (Tcl_Close): close callbacks are - run. Checked in 'Tcl_Close' and 'Tcl_Unregister' to prevent recursive - call of 'close' in the close-callbacks. This is a possible error made - by implementors of virtual filesystems based on 'tclvfs', thinking - that they have to close the channel in the close handler for the - filesystem. - -2004-07-14 Andreas Kupries - - * generic/tclIO.c: - * generic/tclIO.h: - * Not reverting, but #ifdef'ing the changes from May 19, 2004 out of - the core. This removes the ***POTENTIAL INCOMPATIBILITY*** for channel - drivers it introduced. This has become possible due to Expect gaining - a BlockModeProc and now handling blockingg and non-blocking modes - correctly. Thus [SF Tcl Bug 943274] is still fixed if a recent enough - version of Expect is used. - - * doc/CrtChannel.3: Added warning about usage of a channel without a - BlockModeProc. - -2004-07-15 Andreas Kupries - - * generic/tclIOCmd.c (Tcl_PutsObjCmd): Added length check to the old - depreceated newline syntax, to ensure that only "nonewline" is - accepted. [Tcl SF Bug 985869], reported by Joe Mistachkin - . - -2004-07-15 Zoran Vasiljevic - - * generic/tclEvent.c (Tcl_Finalize): stuffed memory leak incurred by - re-initializing of TSD slots after the last call to - TclFinalizeThreadData (done from within Tcl_FinalizeThread()). We - basically just repeat the TclFinalizeThreadData() once more before - tearing down TSD keys in TclFinalizeSynchronization(). There should be - more elaborate mechanism in place for handling such issues, based on - thread cleanup handlers registered on the OS level. Such change - requires much more work and would also require TIP because some - visible parts of Tcl API would have to be modified. In the meantime, - this will do. - - * generic/tclNotify.c (TclFinalizeNotifier): Added conditional - notifier finalization based on the fact that an TclInitNotifier has - been called for the current thread. This fixes the [Bug 770053] again. - Hopefully this time w/o unwanted side-effects. - -2004-07-15 Kevin Kenny - - * generic/tclLiteral.c (TclReleaseLiteral): Removed unused variable - 'codePtr' to silence a message from VC++. - -2004-07-15 Miguel Sofer - - * generic/tclCompile.c (TclCompileScript): - * generic/tclLiteral.c (TclReleaseLiteral): fix for [Bug 467523], - which resurfaced with the latest changes. The previous strategy was to - have special code in TclReleaseLiteral to handle the self-references - generated by empty scripts. The new approach avoids the self-reference - altogether, by having empty scripts return an unshared literal. - -2004-07-15 Zoran Vasiljevic - - * generic/tclEvent.c (NewThreadProc): Backout of changes to fix the - [Bug 770053]. See SF bugreport for more info. - -2004-07-11 Miguel Sofer - - * generic/tclBasic.c (Tcl_EvalEx): leak fix by dgp, release - objv[objectsUsed] on error. - -2004-07-11 Miguel Sofer - - * generic/tclParse.c (Tcl_SubstObj): leak fix by dgp, release result - on error. - -2004-07-11 Donal K. Fellows - - * generic/tclNamesp.c (BuildEnsembleConfig): Don't forget to clean out - references when deleting the hash table. - * generic/tclDictObj.c (Tcl_DictObjRemoveKeyList): Oops, forgot to - delete value object when removing the hash entry. [Bug 989093 in part] - -2004-07-11 Miguel Sofer - - * generic/tclExecute.c (TEBC): fixed leak of expandNestList objs when - there is an error while an expansion is in progress (code added at - checkForCatch). - -2004-07-11 Vince Darley - - * generic/tclIOUtil.c: fix to 'cd' bug when vfs is active [tclvfs Bug - 986944] - this bug recently introduced by some threading fixes. Need - to work out how to add tests for this. - -2004-07-10 Kevin Kenny - - * tests/clock.test (clock-2.11): Changed the test so that it isn't an - infinite loop when run under valgrind on a slow virtual machine. - Thanks to Miguel Sofer for the bug report. Also put in code to restore - env(LC_TIME) after tests complete, silencing a warning from 'make - TESTFLAGS="-debug 1" test'. - -2004-07-08 Miguel Sofer - - * generic/tclBasic.c (DeleteInterpProc): reverted the modification of - 3 days ago, as the leak of [Bug 983660] is now handled by the change - in TclCleanupByteCode. - * generic/tclCompile.c (TclCleanupByteCode): let each bytecode remove - its references to literals at interp deletion, without updating the - dying literal table. - * generic/tclLiteral.c (TclDeleteLiteralTable): with the above change - to TclCleanupByteCode, this function now removes a single reference to - the literal object and cleans up its own structures. - -2004-07-08 Kevin Kenny - - * win/tclWinInit.c (AppendEnvironment): Silenced a compilation warning - about a type mismatch. - -2004-07-07 Miguel Sofer - - * generic/tclCompile.c (TclCompileScript): fix for [Bug 458361]. - Single-word scripts are compiled with an unshared cmdName to avoid - shimmering between bytecode and cmdName reps. - -2004-07-07 Don Porter - - * generic/tclCmdMZ.c (TclMergeReturnOptions): Simplified logic and - removed potential memory leak. [Bug 986257]. - -2004-07-07 Donal K. Fellows - - * tools/man2help2.tcl (setTabs, IPmacro): Added support for the more - advanced *roff macros used in Tk's doc/bind.n - - * generic/tclObj.c (TclInitObjSubsystem): Declare all current object - types. - -2004-07-06 Don Porter - - * tests/cmdMZ.test (cmdMZ-return-2.17): Added a test that a word - containing backslash-quoted value is treated correctly. - - * generic/tclCompile.c (TclWordKnownAtCompileTime): [Bug 986196] - Corrected flaw above and the flaw that caused TCL_TOKEN_SIMPLE_WORDs - to have their original word value copied ( "{a b}" ) rather than the - actual value ( "a b" ). Thanks to Kevin Kenny for report and tests. - -2004-07-06 Kevin B. Kenny - - * tests/cmdMZ.test (cmdMZ-return-2.15,cmdMZ-return-2.16): Added a test - that a return code containing spaces is correctly returned. - -2004-07-06 Donal K. Fellows - - * tools/man2html2.tcl (IPmacro, setTabs): Added support for the more - advanced *roff macros used in Tk's doc/bind.n - -2004-07-05 Miguel Sofer - - * generic/tclBasic.c (DeleteInterpProc): fix for [Bug 983660], found - by pspjuth. Tear down the global namespace before freeing the interp - handle, to allow the bytecodes to free their non-shared literals. - * generic/tclLiteral.c (TclReleaseLiteral): moved special code for - self-ref so that it is also used for non-shared literals. Possible bug - found by inspection. - -2004-07-03 Miguel Sofer - - * generic/tclExecute.c (ExprRoundFunc): - * tests/expr-old.test (39.1): added support for wide integers to - round(); [Bug 908375], reported by Hemang Lavana. - -2004-07-03 Miguel Sofer - - * generic/tclCompile.h: - * generic/tclInt.decls: - * generic/tclIntDecls.h: - * generic/tclStubInit.c: Moved declaration of TclCompEvalObj() from - tclCompile.h to the internal stubs table, for compiler - experimentation. - -2004-07-02 Jeff Hobbs - - * generic/regcomp.c (stid): correct minor pointer size error - - * generic/tclPipe.c (TclCreatePipeline): applied TIP #202 patch that - * doc/exec.n, tests/exec.test: adds 2>@1 as a special case - redirection of stderr to the result output. - -2004-07-02 Kevin B. Kenny - - * tests/io.test: Changed several tests to run the event loop rather - than just calling [update] periodically, avoiding intermittent - failures (usually in io-29.32) that stemmed from unreaped processes on - Windows. - * tests/winPipe.test (winpipe-1.11): Fixed a bug that caused test to - fail if the path name of the working directory contained whitespace - [Bug 678430] - -2004-07-01 Vince Darley - - * tests/fileSystem.test: Added test for [Bug 970529] - -2004-07-01 Donal K. Fellows - - * win/README.binary, win/README: Updated references to Tcl and Tk 8.4 - to point to 8.5 instead. Thanks to Theo Verelst for spotting this. - * generic/tcl.h: Added note to help prevent those changes from getting - missed in the future. - - * doc/Namespace.3, doc/load.n, doc/Limit.3: Typo fixes and remove - duplicate documentation. [Bug 983146] - -2004-06-30 Don Porter - - * tests/fileSystem.test: Minor correction to new fileSystem-9.X tests - so that they clean up temporary directories correctly. - -2004-06-30 Vince Darley - - * doc/filename.n: clarified behaviour concerning trailing slashes in - filenames [Bug 971976] - - * win/tclWinFile.c: - * tests/fileSystem.test: fix and tests for [Bug 979879] - -2004-06-30 Donal K. Fellows - - TIP#188 IMPLEMENTATION - - * doc/string.n, tests/string.test: Add 'wideinteger' to things - * generic/tclCmdMZ.c (Tcl_StringObjCmd): that can be tested for with - the [string is] subcommand. [Patch 940915, by Kevin Kenny] - -2004-06-29 Don Porter - - * win/tclWinInit.c: Corrected reference counting flaw in recent - changes. Thanks to Pat Thoyts. [Bug 981893]. - -2004-06-29 Vince Darley - - * win/tclWin32Dll.c: fix to compilation with VC++ 5.2 - -2004-06-29 Donal K. Fellows - - * library/safe.tcl: Make sure that the temporary variable is local to - the namespace and not inadvertently global. [Bug 981733] - -2004-06-24 Donal K. Fellows - - * tests/unixNotfy.test: Modified constraints so that testing with a - threaded tclsh (not tcltest) will not hang. - -2004-06-23 Don Porter - - * generic/tclThreadStorage.c: Corrected type casting errors that led - to calculation of a negative index value, thus accesses outside the - threadStorageCache array, thus memory corruption. Crash observed on - Mac OS X platform. - -2004-06-23 Joe Mistachkin - - * generic/tclThread.c: Implements platform independent thread storage - * generic/tclThreadStorage.c: mechanism and fixes associated bugs on - platforms where there is limited thread local storage space - (Win98/WinNT4). [Patch 976496] - - * generic/tclInt.decls: - * generic/tclIntDecls.h: Added thread storage functions to the - * generic/tclStubInit.c: internal stubs table. - - * unix/Makefile.in: - * unix/configure: - * unix/tcl.m4: - * win/makefile.vc: - * win/rules.vc: - * win/Makefile.in: Modified the unix, VC++, and Cygwin build systems - * win/configure: to include the new "tclThreadStorage.c" and the new - * win/tcl.m4: USE_THREAD_STORAGE define. - -2004-06-23 Pat Thoyts - - * tests/io.test: Added -force to 18.1 and 18.2. This was failing on - WinXP. - - * tests/winFCmd.test: Added a cleanup to winFCmd-16.11 to avoid a - failure in 16.12. - - * tests/eofchar.data: Added -kb option to ensure a binary checkout to - win32 systems. This fixes a failure in io-61.1 - - * win/makefile.vc: fix for [Bug 977369] about launching tclsh to - generate a tclConfig.sh with the nmake build system - -2004-06-23 Kevin B. Kenny - - * tests/winDde.test (createChildProcess): Added a 200-ms delay (with - the event loop live) when shutting down the test DDE server process. - With the delay in place, nuisance failures of tests winDde-4.2, -6.5, - and -6.6 appear to be much less frequent. [Bug 957449] - -2004-06-23 Donal K. Fellows - - * tests/*.test: Standardize use of platform constraints. - - * unix/tclUnixInit.c (GetStackSize, TclpCheckStackSpace): - * unix/tclUnixThrd.c (TclpThreadGetStackSize): Added code to check - whether the C stack is about to be exceeded, from [Patch 746378] by - Joe Mistachkin but with substantial revisions. - -2004-06-22 Kevin Kenny - - * generic/tclEvent.c (NewThreadProc): Fixed broken build on Windows - caused by missing TCL_THREAD_CREATE_RETURN. - - * tests/stack.test (stack-3.1): Corrected nuisance error in threaded - builds. - -2004-06-22 Zoran Vasiljevic - - * generic/tclEvent.c: - * generic/tclInt.h: - * unix/tclUnixNotfy.c: - * unix/tclUnixThrd.c: - * win/tclWinThrd.c: [Bug 770053]. See bug report for more information - about what it does. - - * tests/unixNotfy.test: rewritten to use tcltest::threadReap to - gracefully wait for the test thread to exit. Otherwise we got a race - condition with main thread exiting before the test thread. This - exposed the long-standing Tcl lib issue with resource - garbage-collection on application exit. - -2004-06-21 Mo DeJong - - * win/tclWin32Dll.c (DllMain, _except_dllmain_detach_handler) - (TclpCheckStackSpace, _except_checkstackspace_handler) - (TclWinCPUID, _except_TclWinCPUID_detach_handler): - * win/tclWinChan.c (Tcl_MakeFileChannel) - (_except_makefilechannel_handler): - * win/tclWinFCmd.c (DoRenameFile, _except_dorenamefile_handler) - (DoCopyFile, _except_docopyfile_handler): - Rework pushing of exception handler function pointer so that compiling - with gcc -O3 works. Remove empty function call to avoid compiler - warning. Mark the DllMain function as noinline to avoid compiler error - from duplicated asm labels in generated code. - -2004-06-21 Donal K. Fellows - - * generic/tclThreadAlloc.c (Ptr2Block): Rewrote so as to maximize the - chance of detecting and reporting a memory inconsistency without - relying on things being consistent. [Bug 975895] - -2004-06-18 Don Porter - - * tests/load.test: Relaxed strictness of error message matching - for test load-2.3 so that it will pass on Mac OSX. - - * generic/tclEncoding.c: Static TclFindEncodings -> FindEncodings. - * generic/tclInt.h: Updated TclpFindExecutable() so that failed - * generic/tclUtil.c: attempts to find the executable are saved - * unix/tclUnixFile.c: just as successful finds are. [Patch 966053] - * unix/tclUnixTest.c: - -2004-06-18 Kevin B. Kenny - - * tests/winFCmd.test (winFCmd-16.12): Changed test to compute the - target directory, so as not to fail if the user's HOME isn't the root. - -2004-06-19 Daniel Steffen - - * unix/tcl.m4: autoconf 2.5 fixes in Darwin section. - * unix/configure: autoconf-2.57 - -2004-06-18 Donal K. Fellows - - * unix/tclUnixInit.c (localeTable): Added some more locale to encoding - mapping info from Jim Huang - - * generic/tclInt.h (PendingObjData,TclFreeObjMacro,etc): - * generic/tclObj.c (TclFreeObj): Added scheme for making TclFreeObj() - avoid blowing up the C stack when freeing up very large object trees. - [Bug 886231] - - * win/tclWinInit.c (SetDefaultLibraryDir): Fix logic, simplify and add - comments. - -2004-06-17 Don Porter - - * generic/tclObj.c: Added missing space in panic message. - - * win/tclWinInit.c: Inform [tclInit] about the default library - directory via the ::tclDefaultLibrary variable. This should correct a - problem with my 2004-06-11 commit. Better solutions still in the - works. Thanks to Joe Mistachkin for pointing out the breakage. - -2004-06-16 Don Porter - - * doc/library.n: Moved variables ::auto_oldpath and - * library/auto.tcl: ::unknown_pending into ::tcl namespace. - * library/init.tcl: [Bugs 808319, 948794] - -2004-06-15 Donal K. Fellows - - * doc/binary.n: Added some notes to the documentation of the 'a' - format to address the point raised in [RFE 768852]. - -2004-06-15 Jeff Hobbs - - * unix/tclConfig.sh.in (TCL_EXTRA_CFLAGS): set to @CFLAGS@, which is - the configure-time CFLAGS. Addendum to m4 change on 2004-05-26. - -2004-06-14 Kevin Kenny - - * win/Makefile.in: Corrected compilation flags for tclPkgConfig.c so - that it doesn't require Stubs. - * generic/tclBasic.c (Tcl_CreateInterp): Removed comment stating that - TclInitEmbeddedConfigurationInformation needs Stubs; with the change - above, the comment is now erroneous. - -2004-06-11 Don Porter - - * doc/Encoding.3: Removed bogus claims about tcl_libPath. - - * generic/tclInterp.c (Tcl_Init): Stopped setting the - tcl_libPath variable. [tclInit] can get all its directories without it. - - * tests/unixInit.test: Modified test code that made use of - tcl_libPath variable. - - * unix/tclUnixInit.c: Stopped setting the tclDefaultLibrary variable, - execept on the Mac OS X platform with HAVE_CFBUNDLE. In that - configuration we should seek some way to make use of the TIP 59 - facilities and get rid of that usage of tclDefaultLibrary as well. - - * generic/tclInterp.c: Updated [tclInit] to make $env(TCL_LIBRARY) an - absolute path, and to include the scriptdir,runtime configuration value - on the search path for init.tcl. - - * unix/tclUnixInit.c: The routines Tcl_Init() and TclSourceRCFile() - * win/tclWinInit.c: had identical implementations for both win and - * generic/tclInterp.c: unix. Moved to a single generic implementation. - * generic/tclMain.c: - * library/init.tcl: - * generic/tclInitScript.h (removed): - * unix/Makefile.in: - * win/tcl.dsp: - - * unix/configure.in: Updated TCL_PACKAGE_PATH value to handle - * win/configure.in: --libdir configuration. - - * unix/configure.in: autoconf-2.57 - * win/configure.in: - - * generic/tclBasic.c (Tcl_CreateInterp): Moved call to - TclInitEmbeddedConfigurationInformation() earlier in - Tcl_CreateInterp() so that other parts of interp creation and - initialization may access and use the config values. - -2004-06-11 Kevin Kenny - - * win/tclAppInit.c: Restored the 'setargv' procedure when compiling - with mingw. Apparently, the command line parsing in mingw doesn't work - as well as that in vc++, and the result was (1) that winPipe-8.19 - failed, and (2) that 'make test' would work at all only with - TESTFLAGS='-singleproc 1'. [Bug 967195] - -2004-06-10 Zoran Vasiljevic - - * generic/tclIOUtil.c: removed forceful setting of the private cached - current working directory rep from within the Tcl_FSChdir(). We - delegate this task to the Tcl_FSGetCwd() which does this task anyway. - The relevant code is still present but disabled temporarily until the - change proves correct. The Tcl test suite passes all test with the - given change so I suppose it is good enough. - -2004-06-10 Don Porter - - * unix/tclUnixInit.c (TclpInitLibraryPath): Disabled addition of - * win/tclWinInit.c (TclpInitLibraryPath): relative-to-executable - directories to the library search path. A first step in reform of - Tcl's startup process. - - ***POTENTIAL INCOMPATIBILITY*** - Attempts to directly run ./tclsh or ./tcltest out of a build directory - will either fail, or will make use of an installed script library in - preference to the one in the source tree. Use `make shell` or `make - runtest` instead. - - * tests/unixInit.test: Modified tests to suit above changes. - - * generic/tclPathObj.c: Corrected [file tail] results when operating - on a path produced by TclNewFSPathObj(). [Bug 970529] - -2004-06-09 Zoran Vasiljevic - - * generic/tclIOUtil.c: partially corrected [Bug 932314]. Also - corrected return values of Tcl_FSChdir() to reflect those of the - underlying platform-specific call. Originally, return codes were mixed - with those of Tcl. - -2004-06-08 Miguel Sofer - - * generic/tclCompile.c: - * generic/tclExecute.c: handle warning [Bug 969066] - -2004-06-08 Donal K. Fellows - - * generic/tclHash.c (RebuildTable): Move declaration of variable so it - is only declared when it is used. [Bug 969068] - -2004-06-07 Donal K. Fellows - - * doc/lsearch.n: Added correct option to example. [Bug 968219] - -2004-06-05 Kevin B. Kenny - - * generic/tcl.h: Corrected Tcl_WideInt declarations so that the mingw - build works again. - * generic/tclDecls.h: Changes to the tests for clock - * generic/tclInt.decls: frequency in Tcl_WinTime so - * generic/tclIntDecls.h: that any clock frequency is - * generic/tclIntPlatDecls.h: accepted provided that all - * generic/tclPlatDecls.h: CPU's in the system share a - * generic/tclStubInit.c: common chip, and hence, - * tests/platform.test (platform-1.3): presumably, a common clock. - * win/tclWin32Dll.c (TclWinCPUID): This change necessitated a - * win/tclWinTest.c (TestwincpuidCmd) small burst of assembly code - * win/tclWinTime.c (Tcl_GetTime): to read CPU ID information, - which was added as TclWinCPUID in the internal Stubs. To test this - code in the common case of a single-processor machine, a - 'testwincpuid' command was added to tclWinTest.c, and a test case in - platform.test. Thanks to Jeff Godfrey and Richard Suchenwirth for - reporting this bug. [Bug 976722] - -2004-06-04 Don Porter - - * generic/tcl.h: Restored #include to tcl.h, - rejecting the "fix" for "Bug" 945570. Tcl_FSSeek() needs the values of - SEEK_SET, etc. and too many extensions rely on tcl.h providing stdio.h - for them. - -2004-06-02 Jeff Hobbs - - * win/tclWinFile.c (TclpFindExecutable): when using GetModuleFileNameA - (Win9x), convert from CP_ACP to WCHAR then convert back to utf8. - Adjunct to 2004-04-07 fix. - -2004-06-02 David Gravereaux - - * tests/winPipe.test (winpipe-6.1): blocking set to 1 before closing - to ensure we get an exitcode. The windows pipe channel driver doesn't - differentiate between a blocking and non-blocking close just yet, but - will soon. Part of [Bug 947693] - -2004-06-02 Vince Darley - - * doc/file.n: fix to documentation of 'file volumes' (Bug 962435) - -2004-06-01 David Gravereaux - - * win/makefile.vc: check for either MSDEVDIR or MSVCDIR being in the - environment, for VC7. [Bug 942214] - - * generic/tclIO.c (Tcl_SetChannelOption): -buffersize wasn't - understanding hexidecimal notation nor was reporting number conversion - errors. The behavior to silently ignore settings outside the - acceptable range of Tcl_SetChannelBufferSize (<10 or >1M) is - unchanged. This silent ignoring behavior might be up for review soon. - -2004-05-30 David Gravereaux - - * win/tclWinPipe.c: - * win/tclWinPort.h: Reworked the win implementation of Tcl_WaitPid to - support exitcodes in the 'signed short' range. Even though this range - is non-portable, it is valid on windows. Detection of exception codes - are now more accurate. Previously, an application that exited with - ExitProcess((DWORD)-1); was improperly reported as exiting with - SIGABRT. - -2004-05-30 Donal K. Fellows - - * generic/tclInterp.c: Added comments describing the purposes of each - function in the limit implementation and rewrote the names of some - non-public functions for greater clarity of purpose. - * doc/interp.n: Added note about what happens when a limited - interpreter creates a slave interpreter. - * doc/Limit.3: Added manual page for the resource limit subsystem's C - API. [Bug 953903] - -2004-05-29 Joe English - - * doc/global.n, doc/interp.n, doc/lrange.n: Fix minor markup errors. - -2004-05-28 Donal K. Fellows - - * doc/*.n: Added examples to many (too many to list) more man pages. - -2004-05-25 Miguel Sofer - - * generic/tclExecute.c: - * generic/tclVar.c: using (ptrdiff_t) instead of (int) casting to - correct compiler warnings [Bug 961657], reported by Bob Techentin. - -2004-05-27 Kevin B. Kenny - - * tests/clock.test: Added a single test for the presence of %G in - [clock format], and conditioned out the clock-10.x series if they're - all going to fail because of a broken strftime() call. [Bug 961714] - -2004-05-27 Donal K. Fellows - - * generic/tclHash.c (CompareStringKeys): Added #ifdef to allow people - to instruct this function to use strcmp(). [FRQ 951168] - - * generic/tclVar.c: Moved declarations into #if guards so they only - happen when required. - * unix/tclUnixPort.h: Guard declaration of strtod() so it is only - enabled when we don't have a declaration in stdlib.h - * unix/tclUnixThrd.c (Tcl_CreateThread): Added declarations - * unix/tclUnixTest.c (AlarmHandler): and casts so that - * unix/tclUnixChan.c (TtyModemStatusStr): all functions are - * generic/tclScan.c (Tcl_ScanObjCmd): defined before use - * generic/tclDictObj.c (InvalidateDictChain): and no cross-type - * generic/tclCmdMZ.c (Tcl_StringObjCmd): uses are performed. - - The overall effect is to make building with gcc with the additional - flags -Wstrict-prototypes -Wmissing-prototypes produce no increase in - the total number of warnings (except for main(), which is undeclared - for traditional reasons.) - -2004-05-26 Jeff Hobbs - - * unix/Makefile.in: Rework configure ordering to TCL_LINK_LIBS, - * unix/tcl.m4: ENABLE_SHARED, CONFIG_CFLAGS, & ENABLE_SYMBOLS - * unix/configure: before TCL_EARLY_FLAGS and TCL_64BIT_FLAGS - * unix/configure.in: (about 400 lines earlier) in configure.in. This - forces CFLAGS configuration to be done before many tests, which is - needed for 64-bit builds and may affect other builds. Also make - CONFIG_CFLAGS append to CFLAGS directly instead of using EXTRA_CFLAGS, - and have LDFLAGS append to any existing value. [Bug 874058] - * unix/dltest/Makefile.in: change EXTRA_CFLAGS to DEFS - -2004-05-26 Don Porter - - * library/tcltest/tcltest.tcl: Correction to debug prints and testing - * library/tcltest/pkgIndex.tcl: if TCLTEST_OPTIONS value. Corrected - * tests/tcltest.test: double increment of numTestFiles in - -singleproc 1 configurations. Updated tcltest-19.1 to tcltest 2.1 - behavior. Corrected tcltest-25.3 to not falsely report a failure in - tcltest.test. Bumped to tcltest 2.2.6. [Bugs 960560, 960926] - -2004-05-25 Jeff Hobbs - - * doc/http.n (http::config): add -urlencoding option (default utf-8) - * library/http/http.tcl: that specifies encoding conversion of - * library/http/pkgIndex.tcl: args for http::formatQuery. Previously - * tests/http.test: undefined, RFC 2718 says it should be - utf-8. 'http::config -urlencoding {}' returns previous behavior, which - will throw errors processing non-latin-1 chars. Bumped http package to - 2.5.0. - -2004-05-25 Donal K. Fellows - - * generic/tclInterp.c (DeleteScriptLimitCallback): Move all deletion - of script callback hash table entries to happen here so the entries - are correctly removed at the right time. [Bug 960410] - -2004-05-25 Miguel Sofer - - * docs/global.n: added details for qualified variable names [Bug - 959831] - -2004-05-25 Miguel Sofer - - * generic/tclNamesp.c (Tcl_FindNamespaceVar): - * tests/namespace.test (namespace-17.10-12): reverted commit of - 2004-05-23 and removed the tests, as it interferes with the varname - resolver and there are apps that break (AlphaTk). A fix will have to - wait for Tcl9. - - * generic/tclVar.c: Caching of namespace variables disabled: no simple - way was found to avoid interfering with the resolver's idea of - variable existence. A cached varName may keep a variable's name in the - namespace's hash table, which is the resolver's criterion for - existence. - - * tests/namespace.c (namespace-17.10): testing for interference - between varname caching and name resolver. - -2004-05-25 Kevin Kenny - - * 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 - - * 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. - * tests/stringComp.test: stop re-use of string.test test names - * tests/regexpComp.test: stop re-use of regexp.test test names - * tests/namespace.test (namespace-46.3): Verify [p] does not exist. - * tests/http.test: Clear away the custom [bgerror] when done. - * tests/io.test: Take care to use namespace variables. - * tests/autoMkindex.test (autoMkindex-5.2): Use variable "result" - that gets cleaned up. - * tests/exec.test: Clean up the "path" array. - * tests/interp.test (interp-9.3): Initialize res, so prior values - cannot make the test fail. - * tests/execute.test (execute-8.1): Updated to remove the trace set - on ::errorInfo. When left in place, that trace can cause later tests - to fail. - -2004-05-25 Donal K. Fellows - - * generic/tclBasic.c: Removed references to Tcl_RenameCommand from - * generic/tcl.h: comments. [Bug 848440, second part] - - * tests/fCmd.test: Rewrote tests that failed consistently on NFS so - they either succeed (through slightly more liberal matching of the - results) or are constrained to not run. [Bug 931312] - - * doc/bgerror.n: Use idiomatic open flags for working with log - files. [Bug 959602] - -2004-05-24 Jeff Hobbs - - * generic/tclExecute.c (VerifyExprObjType): use GET_WIDE_OR_INT to - properly have tclIntType used for smaller values. This corrects [TclX - Bug 896727] and any other 3rd party extension that created math - functions but was not yet WIDE_INT aware in them. - -2004-05-24 Donal K. Fellows - - * generic/tclInterp.c (TclInitLimitSupport): Made limits work on - platforms where sizeof(void*)!=sizeof(int). [Bug 959193] - -2004-05-24 Miguel Sofer - - * doc/set.n: accurate description of name resolution process, - referring to namespace.n for details [Bug 959180] - -2004-05-23 Miguel Sofer - - * generic/tclNamesp.c (Tcl_FindNamespaceVar): [Bug 959052] fixed, - insuring that no "zombie" variables are found. - * generic/tclVar.c (TclLookupSimpleVar): comments re [Bug 736729] - (predecessor of [Bug 959052]) removed. - * tests/namespace.test: added tests 17.10-12 - - The patch modifies non-documented behaviour, and passes every test in - the testsuite. However, scripts relying on the old behaviour may - break. - Note that the only behaviour change concerns the creative writing of - unset variables. More precisely, which variable will be created when - neither a namespace variable nor a global variable by that name - exists, as defined by [info vars]. The new behaviour is that the - namespace resolution process deems a variable to exist exactly when - [info vars] finds it - ie, either it has value, or else it was "fixed" - by a call to [variable]. - Note: this patch was removed on 2002-05-25. - -2004-05-22 Miguel Sofer - - * generic/tclVar.c (TclObjLookupVar, TclObjUnsetVar2): fix for new (in - tcl8.4) exteriorisations of [Bug 736729] due to the use of - tclNsVarNameType obj types. Reenabling the use of this objType ("VAR - ref absolute" benchmark down to 66 ms, from 230). Added comments in - TclLookupSimpleVar explaining my current understanding of [Bug - 736729]. - -2004-05-22 Miguel Sofer - - * generic/tclVar.c: fix for [Bug 735335]. The use of tclNsVarNameType - objs is still disabled, pending resolution of [Bug 736729]. - -2004-05-21 Miguel Sofer - - * tests/namespace.test (namespace-41.3): removed the {knownBug} - constraint: [Bug 231259] is closed since nov 2001, and the fix of [Bug - 729692] (INST_START_CMD) makes the test succeed. - -2004-05-21 Donal K. Fellows - - * generic/tclExecute.c (TclExecuteByteCode): Move a few declarations a - short distance so pre-C99 compilers can cope. Also fix so - TCL_COMPILE_DEBUG path compiles... - -2004-05-21 Miguel Sofer - - * generic/tclExecute.c (TclExecuteByteCode): reorganised TEBC - automatic variables, defining them in tight blocks instead of at the - function level. This has three purposes: - - it simplifies the analysis of individual instructions - - it is preliminary work to the non-recursive engine - - it allows a better register allocation by the optimiser; under - gcc3.3, this results in up to 10% runtime in some tests - -2004-05-20 Donal K. Fellows - - * generic/tclInterp.c (TclLimitRemoveAllHandlers): - * generic/tclBasic.c (DeleteInterpProc): - * tests/interp.test (interp-34.7): Ensure that all limit callbacks are - deleted when their interpreters are deleted. [Bug 956083] - -2004-05-19 Kevin B. Kenny - - * win/tclWinFile.c (TclpMatchInDirectory): fix for an issue where - there was a sneak path from Tcl_DStringFree to SetErrorCode(0). The - result was that the error code could be reset between a call to - FindFirstFileEx and the check of its status return, leading to a - bizarre error return of {POSIX unknown {No error}}. (Found in - unplanned test - no incident logged at SourceForge.) - -2004-05-19 Donal K. Fellows - - * tests/interp.test (interp-34.3): Rewrite this test to see if a time - limit can catch a tight bytecode loop, a maximally aggressive - denial-of-service attack. - * generic/tclInterp.c (Tcl_LimitCheck): Fix the sense of checks to see - whether a time limit has been extended. - - * tests/*.test: Many minor fixes, including ensuring that every test - is run (so constraints control whether the test is doing anything) and - making sure that constraints are always set using the API instead of - poking around inside tcltest's internal datastructures. Also got rid - of all trailing whitespace lines from the test suite! - -2004-05-19 Andreas Kupries - - * 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 - - * generic/tclPathObj.c: fix to (Bug 956063) in 'file dirname'. - * tests/cmdAH.test: added test for this bug. - - * doc/FileSystem.3: better documentation of refCount requirements of - some FS functions (Bug 956126) - -2004-05-19 Donal K. Fellows - - * generic/tclTest.c (TestgetintCmd): Made the tests in get.test check - * tests/get.test: Tcl_GetInt() since the core now - avoids that function. - -2004-05-18 Kevin B. Kenny - - * compat/strftime.c (_fmt, ISO8601Week): - * doc/clock.n: - * tests/clock.test: Major rework to the handling of ISO8601 week - numbers. Now passes all the %G and %V test cases on Windows, Linux and - Solaris [Bugs 500285, 500389, and 852944] - -2004-05-18 Donal K. Fellows - - * doc/append.n, doc/upvar.n: Added example. - -2004-05-18 David Gravereaux - - * win/makefile.vc: now generates a tclConfig.sh from Pat Thoyts [Patch - 909911] - -2004-05-18 Donal K. Fellows - - * doc/lsearch.n: Improve clarity (based on [Patch 955361] by Peter - Spjuth) - - * tools/man2help2.tcl (macro,SHmacro): Added support for subsection - (.SS) header macros. - - * doc/interp.n: Added user documentation for the TIP#143 resource - limits and some examples. - - * generic/tclInterp.c (Tcl_LimitCheck, Tcl_LimitTypeReset): Reset the - limit-exceeded flag when removing a limit. - -2004-05-18 Miguel Sofer - - * generic/tclExecute.c (TclExecuteByteCode): added comments to - classify the variables according to their use in TEBC. - -2004-05-17 Donal K. Fellows - - * doc/global.n, doc/uplevel.n: Added an example. - - * tests/info.test (info-3.1): Corrected test result back to what it - used to be in Tcl 7.* now that command counts are being correctly kept - - * generic/tclExecute.c (TEBC:INST_START_CMD): Make sure that the - command-count is always advanced. Allows TIP#143 limits to tell that - work is being done. - - * doc/list.n: Updated example to fit with the unified format. - * doc/seek.n: Added some examples. - -2004-05-17 Vince Darley - - * win/tclWinFile.c: - * tests/cmdAH.test: fix to (Bug 954263) where 'file executable' was - case-sensitive. - -2004-05-17 Donal K. Fellows - - * doc/OpenFileChnl.3: Documented type of 'offset' argument to Tcl_Seek - was wrong. [Bug 953374] - -2004-05-16 Miguel Sofer - - * generic/tclExecute.c (TclExecuteByteCode): remove one level of - indirection for compiledLocals addressing. - -2004-05-16 Miguel Sofer - - * generic/tclExecute.c (INST_CALL_FUNC1): bugfix; restored - (DE)CACHE_STACK_INFO pair around the call - the user defined math - function could cause a recursive call to TEBC. - -2004-05-16 Miguel Sofer - - * generic/tclBasic.c (Tcl_DeleteInterp): - * generic/tclExecute.c (INST_START_CMD): interp deletion now modifies - the compileEpoch, eliminating the need for the check for interp - deletion in INST_START_CMD. - -2004-05-16 Miguel Sofer - - * generic/tclCompile.h: - * generic/tclCompile.c: - * generic/tclExecute.c: changed implementation of {expand}, last - chance while in alpha as ... - - ***POTENTIAL INCOMPATIBILITY*** - Scripts precompiled with ProComp under previous tcl8.5a versions may - malfunction due to changed instruction numbers for - INST_LIST_INDEX_IMM, INST_LIST_RANGE_IMM and INST_START_CMD. - -2004-05-14 Kevin B. Kenny - - * 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] - - * tests/clock.test (clock-3.14): Added test to make sure that changes - to $env(TZ) take effect immediately. - - * win/tclWinTime.c (TclpLocaltime, TclpGmtime): Added porting layer - for 'localtime' and 'gmtime' calls. - -2004-05-14 Miguel Sofer - - * generic/tclExecute.c: - * generic/tclCompile.h: the math functions receive a pointer to top of - the stack (tosPtr) instead of the execution environment (eePtr). First - step towards a change in the execution stack management - it is now - only used within TEBC. - -2004-05-13 Donal K. Fellows - - TIP#143 IMPLEMENTATION - - * generic/tclExecute.c (TclCompEvalObj, TclExecuteByteCode): - * generic/tclBasic.c (TclEvalObjvInternal): Enable limit checking. - * generic/tclInterp.c (Tcl_Limit*): Public limit API. - * generic/tcl.decls: - * tests/interp.test: Basic tests of command limits. - - * doc/binary.n: TIP#129 IMPLEMENTATION [Patch 858211] - * generic/tclBinary.c: Note that the test suite probably has many more - * tests/binary.test: failures now due to alterations in constraints. - -2004-05-12 Miguel Sofer - - Optimisations for INST_START_CMD [Bug 926164]. - * generic/tclCompile.c (TclCompileScript): avoid emitting - INST_START_CMD as the first instruction in a bytecoded Tcl_Obj. It is - not needed, as the checks are done before calling TEBC. - * generic/tclExecute.c (TclExecuteByteCode): runtime peephole - optimisation: check at INST_POP if the next instruction is - INST_START_CMD, in which case we fall through. - -2004-05-11 Donal K. Fellows - - * doc/split.n, doc/join.n: Updated examples and added more. - -2004-05-11 Vince Darley - - * doc/glob.n: documented behaviour of symbolic links with 'glob -types - d' (Bug 951489) - -2004-05-11 Donal K. Fellows - - * doc/scan.n: Updated the examples to be clearer about their relevance - to the scan command. - -2004-05-10 Donal K. Fellows - - * doc/scan.n: Added examples. - -2004-05-10 David Gravereaux - - * win/tclWinPipe.c (BuildCommandLine): Moved non-obvious appending - logic to outside the loop and added commentary for its purpose. Also - use the existence of contents in the linePtr rather than the scratch - DString post the append, as this more clear. - - (TclpCreateProcess): When under NT, with no console, and executing a - DOS application, the path priming does not need an ending space as - BuildCommandLine() will do this for us. - -2004-05-08 Vince Darley - - * generic/tclFileName.c: - * generic/tclIOUtil.c: remove some compiler warnings on MacOS X. - -2004-05-07 Chengye Mao - - * win/tclWinPipe.c: refixed bug 789040 re-entered in rev 1.41. Let's - be careful and don't re-enter previously fixed bugs. - -2004-05-08 Donal K. Fellows - - * doc/format.n: Added examples. - -2004-05-07 Miguel Sofer - - * doc/unset.n: added upvar.n to the "see also" list - -2004-05-07 Reinhard Max - - * generic/tclEncoding.c: - * tests/encoding.test: added support and tests for translating - embedded null characters between real nullbytes and the internal - representation on input/output [Bug 949905]. - -2004-05-07 Vince Darley - - * generic/tclFileName.c: - * generic/tclIOUtil.c: - * generic/tclFileSystem.h: - * tests/fileSystem.test: fix for [Bug 943995], in which vfs-registered - root volumes were not handled correctly as glob patterns in all - circumstances. - -2004-05-06 Miguel Sofer - - * generic/tclInt.h: - * generic/tclObj.c (TclFreeObj): made TclFreeObj use the new macro - TclFreeObjMacro(), so that the allocation and freeing of Tcl_Obj is - defined in a single spot (the macros in tclInt.h), with the exception - of the TCL_MEM_DEBUG case. - The #ifdef logic for the corresponding macros has been reformulated to - make it clearer. - -2004-05-05 Donal K. Fellows - - * doc/break.n, doc/continue.n, doc/for.n, doc/while.n: More examples. - -2004-05-05 Don Porter - - * tests/unixInit.test (unixInit-2.10): Test correction for Mac OSX. - Be sure to consistently compare normalized path names. Thanks to - Steven Abner (tauvan). [Bug 948177] - -2004-05-05 Donal K. Fellows - - * doc/CrtObjCmd.3: Remove reference to Tcl_RenameCommand; there is no - such API. [Bug 848440] - -2004-05-05 David Gravereaux - - * win/tclWinSock.c (SocketEventProc) : connect errors should fire both - the readable and writable handlers because this is how it works on - UNIX [Bug 794839] - - * generic/tclEncoding.c (TclFinalizeEncodingSubsystem): - FreeEncoding(systemEncoding); moved to before the hash table iteration - as it was causing a double free attempt under some conditions. - - * win/coffbase.txt: Added the tls extension to the list of preferred - load addresses. - -2004-05-04 Jeff Hobbs - - * tests/fileSystem.test (filesystem-1.39): replace 'file volumes' - * tests/fileName.test (filename-12.9,10): lindex with direct C:/ - hard-coded because A:/ was being used and that is empty for most. - - * tests/winFCmd.test (winFCmd-16.12): test volumerelative $HOME - -2004-05-04 Don Porter - - * generic/tclAlloc.c: Make sure Tclp*Alloc* routines get - * generic/tclInt.h: declared in the TCL_MEM_DEBUG and - * generic/tclThreadAlloc.c: TCL_THREADS configuration. [Bug 947564] - - * tests/tcltest.test: Test corrections for Mac OSX. Thanks to Steven - Abner (tauvan). [Bug 947440] - -2004-05-04 Donal K. Fellows - - * generic/tclEvent.c (TclSetLibraryPath): Suppress a warning. - -2004-05-03 Andreas Kupries - - * Applied [Patch 868853], fixing a mem leak in TtySetOptionProc. - Report and Patch provided by Stuart Cassoff . - -2004-05-03 Miguel Sofer - - * generic/tclProc.c (TclCreateProc): comments corrected. - -2004-05-03 Miguel Sofer - - * generic/tclCompile.c (TclCompileScript): setting the compilation - namespace outside of the loop. - -2004-05-03 Miguel Sofer - - * generic/tclCompile.c: - * generic/tclInt.h: reverted fix for [Bug 926445] of 2004-04-02, - restoring TCL_ALIGN to the header file. Todd Helfter reported that the - macro is required by tbcload. - -2004-05-03 Kevin Kenny - - * win/tclWin32Dll.c (TclpCheckStackSpace): - * tests/stack.test (stack-3.1): Fix for undetected stack overflow in - TclReExec on Windows. [Bug 947070] - -2004-05-03 Don Porter - - * library/init.tcl: Corrected unique prefix matching of - interactive command completion in [unknown]. [Bug 946952] - -2004-05-02 Miguel Sofer - - * generic/tclProc.c (TclObjInvokeProc): - * tests/proc.test (proc-3.6): fix for bad quoting of multi-word proc - names in error messages [Bug 942757] - -2004-04-30 Donal K. Fellows - - * doc/glob.n, doc/incr.n, doc/set.n: More examples. - * doc/if.n, doc/rename.n, doc/time.n: - -2004-04-30 Don Porter - - * generic/tclInt.h: Replaced Kevin Kenny's temporary - * generic/tclThreadAlloc.c: fix for Bug 945447 with a cleaner, - more permanent replacement. - -2004-04-30 Kevin B. Kenny - - * generic/tclThreadAlloc.c: Added a temporary (or so I hope!) - inclusion of "tclWinInt.h" to avoid problems when compiling on - Win32-VC++ with --enable-threads. [Bug 945447] - -2004-04-30 Donal K. Fellows - - * doc/puts.n: Added a few examples. - -2004-04-29 Don Porter - - * tests/execute.test (execute-8.2): Avoid crashes when there is - limited system stack space (threads-enabled). - -2004-04-28 Miguel Sofer - - * doc/global.n: - * doc/upvar.n: - * generic/tclVar.c (ObjMakeUpvar): - * tests/upvar.test (upvar-8.11): - * tests/var.test (var-3.11): Avoid creation of unusable variables: - [Bug 600812] [TIP 184]. - -2004-04-28 Donal K. Fellows - - * doc/lsearch.n: Fixed fault in documentation of -index option [943448] - -2004-04-26 Don Porter - - * unix/tclUnixFCmd.c (TclpObjNormalizePath): Corrected improper - positioning of returned checkpoint. [Bug 941108] - -2004-04-26 Donal K. Fellows - - * doc/open.n, doc/close.n: Updated (thanks to David Welton) to be - clearer about pipeline errors and added example to open(n) that shows - simple pipeline use. [Patches 941377,941380] - - * doc/DictObj.3: Added warning about the use of Tcl_DictObjDone and an - example of use of iteration. [Bug 940843] - - * doc/Thread.3: Reworked to remove references to testing interfaces - and instead promote the use of the Thread package. [Patch 932527] - Also reworked and reordered the page for better readability. - -2004-04-25 Don Porter - - * generic/tcl.h: Removed obsolete declarations and #include's. - * generic/tclInt.h: [Bugs 926459, 926486] - -2004-04-24 David Gravereaux - - * win/tclWin32Dll.c (DllMain): Added DisableThreadLibraryCalls() for - the DLL_PROCESS_ATTACH case. We're not interested in knowing about - DLL_THREAD_ATTACH, so disable the notices. - -2004-04-24 Daniel Steffen - - * generic/tclPort.h: - * macosx/Makefile: - * unix/Makefile.in: followup on tcl header reform [FR 922727]: removed - use of relative #include paths in tclPort.h to allow installation of - private headers outside of tcl source tree; added 'unix' dir to - compiler header search path; add newly required tcl private headers to - Tcl.framework on Mac OSX. - -2004-04-23 Andreas Kupries - - * generic/tclIO.c (Tcl_SetChannelOption): Fixed [SF Tcl Bug 930851]. - When changing the eofchar we have to zap the related flags to prevent - them from prematurely aborting the next read. - -2004-04-25 Vince Darley - - * generic/tclPathObj.c: fix to [Bug 940281]. Tcl_FSJoinPath will now - always return a valid Tcl_Obj when the input is valid. - * generic/tclIOUtil.c: fix to [Bug 931823] for a more consistent - Tcl_FSPathSeparator() implementation which allows filesystems not to - implement their Tcl_FSFilesystemSeparatorProc if they wish to use the - default '/'. Also fixed associated memory leak seen with, e.g., tclvfs - package. - * doc/FileSystem.3: documented Tcl_FSJoinPath return values more - clearly, and Tcl_FSFilesystemSeparatorProc requirements. - -2004-04-23 David Gravereaux - - * win/tclWin32Dll.c: Removed my mistake from 4/19 of adding an exit - handler to TclWinInit. TclWinEncodingsCleanup called from - TclFinalizeFilesystem does the Tcl_FreeEncoding for us. - - * win/tclWinChan.c (Tcl_MakeFileChannel): Case for CloseHandle - returning zero and not throwing a - RaiseException(EXCEPTION_INVALID_HANDLE) now being done. - -2004-04-22 David Gravereaux - - * generic/tclEvent.c: TclSetLibraryPath's use of caching the stringrep - of the pathPtr object to TclGetLibraryPath called from another thread - was ineffective if the original's stringrep had been invalidated as - what happens when it gets muted to a list. - - * win/tclWinTime.c: If the Tcl_ExitProc (StopCalibration) is called - from the stack frame of DllMain's PROCESS_DETACH, the wait operation - should timeout and continue. - - * generic/tclInt.h: - * generic/tclThread.c: - * generic/tclEvent.c: - * unix/tclUnixThrd.c: - * win/tclWinThrd.c: Provisions made so masterLock, initLock, allocLock - and joinLock mutexes can be recovered during Tcl_Finalize. - -2004-04-22 Donal K. Fellows - - * doc/switch.n: Reworked the examples to be more systematically named - and to cover some TIP#75 capabilities. - - * doc/cd.n: Documentation clarification from David Welton. - - * doc/exec.n: Added some examples, Windows ones from Arjen Markus and - Unix ones by myself. - -2004-04-21 Donal K. Fellows - - * doc/Hash.3: Added note to Tcl_{First,Next}HashEntry docs that - deleting the element they return is supported (and is in fact the only - safe update you can do to the structure of a hashtable while an - iteration is going over it.) - - * doc/bgerror.n: Added example from David Welton. [Patch 939473] - - * doc/after.n: Added examples from David Welton. [Patch 938820] - -2004-04-19 David Gravereaux - - * win/tclWin32Dll.c: Added an exit handler in TclWinInit() so - tclWinTCharEncoding could be freed during Tcl_Finalize(). - - * generic/tclEncoding.c: Added FreeEncoding(systemEncoding) in - TclFinalizeEncodingSubsystem because its ref count was incremented in - TclInitEncodingSubsystem. - -2004-04-19 Donal K. Fellows - - * doc/read.n: Added example from David Welton. [Patch 938056] - -2004-04-19 Kevin B. Kenny - - * generic/tclObj.c (Tcl_GetDoubleFromObj) Corrected "short circuit" - conversion of int to double. Reported by Jeff Hobbs on the Tcl'ers - Chat. - -2004-04-16 Donal K. Fellows - - * doc/lreplace.n, doc/lrange.n, doc/llength.n: More examples for - * doc/linsert.n, doc/lappend.n: the documentation. - -2004-04-16 Vince Darley - - * doc/FileSystem.3: Corrected documentation of Tcl_FSUtime, and the - corresponding filesystem driver Tcl_FSUtimeProc. [Bug 935838] - -2004-04-16 Donal K. Fellows - - * doc/socket.n: Added example from [Patch 936245]. - * doc/gets.n: Added example based on [Patch 935911]. - -2004-04-15 Donal K. Fellows - - * generic/tclClock.c (Tcl_ClockObjCmd): Minor fault in a [clock - clicks] error message. - -2004-04-07 Jeff Hobbs - - * win/tclWinInit.c (TclpSetInitialEncodings): note that WIN32_CE is - also a unicode platform. - * generic/tclEncoding.c (TclFindEncodings, Tcl_FindExecutable): - * generic/tclInt.h: Correct handling of UTF - * unix/tclUnixInit.c (TclpInitLibraryPath): data that is actually - * win/tclWinFile.c (TclpFindExecutable): "clean", allowing the - * win/tclWinInit.c (TclpInitLibraryPath): loading of Tcl from paths - that contain multi-byte chars on Windows [Bug 920667] - - * win/configure: define TCL_LIB_FLAG, TCL_BUILD_LIB_SPEC, - * win/configure.in: TCL_LIB_SPEC, TCL_PACKAGE_PATH in tclConfig.sh. - -2004-04-06 Don Porter - - Patch 922727 committed. Implements three changes: - - * generic/tclInt.h: Reworked the Tcl header files into a clean - * unix/tclUnixPort.h: hierarchy where tcl.h < tclPort.h < tclInt.h - * win/tclWinInt.h: and every C source file should #include - * win/tclWinPort.h: at most one of those files to satisfy its - declaration needs. tclWinInt.h and tclWinPort.h also better organized - so that tclWinPort.h includes the Windows implementation of - cross-platform declarations, while tclWinInt.h makes declarations that - are available on Windows only. - - * generic/tclBinary.c (TCL_NO_MATH): Deleted the generic/tclMath.h - * generic/tclMath.h (removed): header file. The internal Tcl - * macosx/Makefile (PRIVATE_HEADERS): header, tclInt.h, has a - * win/tcl.dsp: #include directly, - and file external to Tcl needing libm should do the same. - - * win/Makefile.in (WIN_OBJS): Deleted the win/tclWinMtherr.c file. - * win/makefile.bc (TCLOBJS): It's a vestige from matherr() days - * win/makefile.vc (TCLOBJS): gone by. - * win/tcl.dsp: - * win/tclWinMtherr.c (removed): - - End Patch 922727. - - * tests/unixInit.test (unixInit-3.1): Default encoding on Darwin - systems is utf-8. Thanks to Steven Abner (tauvan). [Bug 928808] - -2004-04-06 Donal K. Fellows - - * tests/cmdAH.test (cmdAH-18.2): Added constraint because - access(...,X_OK) is defined to be permitted to be meaningless when - running as root, and OSX exhibits this. [Bug 929892] - -2004-04-02 Miguel Sofer - - * generic/tclCompile.c: - * generic/tclInt.h: removed the macro TCL_ALIGN() from tclInt.h, - replaced by the static macro ALIGN() in tclCompile.c [Bug 926445] - -2004-04-02 Miguel Sofer - - * generic/tclCompile.h: removed redundant #ifdef _TCLINT [Bug 928415], - reported by tauvan. - -2004-04-02 Don Porter - - * tests/tcltest.test: Corrected constraint typos: "nonRoot" -> - "notRoot". Thanks to Steven Abner (tauvan). [Bug 928353] - -2004-04-01 Don Porter - - * generic/tclInt.h: Removed obsolete tclBlockTime* declarations. [Bug - 926454] - -2004-04-01 Vince Darley - - * generic/tclIOUtil.c: Fix to privately reported vfs bug with 'glob - -type d -dir . *' across a vfs boundary. No tests for this are - currently possible without effectively moving tclvfs into Tcl's test - suite. - -2004-03-31 Don Porter - - * doc/msgcat.n: Clarified message catalog file encodings. [Bug 811457] - * library/msgcat/msgcat.tcl: Updated internals to make use of [dict]s - to store message catalog data and to use [source -encoding utf-8] to - access catalog files. Thanks to Michael Sclenker. [Patch 875055, RFE - 811459] Corrected [mcset] to be able to successfully set a translation - to the empty string. [mcset $loc $src {}] was incorrectly set the $loc - translation of $src back to $src. Also changed [ConvertLocale] to - minimally require a non-empty "language" part in the locale value. If - not, an error raised prompts [Init] to keep looking for a valid locale - value, or ultimately fall back on the "C" locale. [Bug 811461]. - * library/msgcat/pkgIndex.tcl: Bump to msgcat 1.4.1. - -2004-03-30 Donal K. Fellows - - * generic/tclHash.c (HashStringKey): Cleaned up. This function is not - faster, but it is a little bit clearer. - * generic/tclLiteral.c (HashString): Applied logic from HashObjKey. - * generic/tclObj.c (HashObjKey): Rewrote to fix fault which hashed - every single-character object to the same hash bucket. The new code is - shorter, simpler, clearer, and (happily) faster. - -2004-03-30 Miguel Sofer - - * generic/tclExecute.c (TEBC): reverting to the previous method for - async tests in TEBC, as the new method turned out to be too costly. - Async tests now run every 64 instructions. - -2004-03-30 Miguel Sofer - - * generic/tclCompile.c: New instruction code INST_START_CMD that - * generic/tclCompile.h: allows checking the bytecode's validity - * generic/tclExecute.c: [Bug 729692] and the interp's readyness - * tests/interp.test (18.9): [Bug 495830] before running the command. - * tests/proc.test (7.1): It also changes the mechanics of the async - * tests/rename.test (6.1): tests in TEBC, doing it now at command - start instead of every 16 instructions. - -2004-03-30 Vince Darley - - * generic/tclFileName.c: Fix to Windows glob where the pattern is a - * generic/tclIOUtil.c: volume relative path or a network share [Bug - * tests/fileName.test: 898238]. On windows 'glob' will now return - * tests/fileSystem.test: the results of 'glob /foo/bar' and 'glob - \\foo\\bar' as 'C:/foo/bar', i.e. a correct absolute path (rather than - a volume relative path). - - Note that the test suite does not test commands like - 'glob //Machine/Shared/*' (on a network share). - -2004-03-30 Vince Darley - - * generic/tclPathObj.c: Fix to filename bugs recently - * tests/fileName.test: introduced [Bug 918320]. - -2004-03-29 Don Porter - - * generic/tclMain.c (Tcl_Main, StdinProc): Append newline only - * tests/basic.test (basic-46.1): to incomplete scripts - as part of multi-line script construction. Do not add an extra - trailing newline to the complete script. [Bug 833150] - -2004-03-28 Miguel Sofer - - * generic/tclCompile.c (TclCompileScript): corrected possible segfault - when a compilation returns TCL_OUTLINE_COMPILE after having grown the - compile environment [Bug 925121]. - -2004-03-27 Miguel Sofer - - * doc/array.n: added documentation for trace-realted behaviour of - 'array get' [Bug 449893] - -2004-03-26 Don Porter - - * README: Bumped version number to 8.5a2 to distinguish - * tools/tcl.wse.in: HEAD of CVS development from the recent 8.5a1 - * unix/configure.in: release. - * unix/tcl.spec: - * win/README.binary: - * win/configure.in: - - * unix/configure: autoconf-2.57 - * win/configure: - -2004-03-26 Vince Darley - - * generic/tclPathObj.c: Fix to Windows-only volume relative path - * tests/fileSystem.test: normalization. [Bug 923568]. Also fixed - another volume relative bug found while testing. - -2004-03-24 Donal K. Fellows - - * generic/tclNamesp.c (NsEnsembleImplementationCmd): Fix messed up - handling of strncmp result which just happened to work in some libc - implementations. [Bug 922752] - -2004-03-23 Donal K. Fellows - - * doc/StringObj.3: Inverted the sense of the documentation of how the - bytes parameter is documented to match behaviour. [Bug 921464] - -2004-03-19 Kevin B. Kenny - - * compat/strtoll.c: - * compat/strtoull.c: - * generic/tclIntDecls.h: - * generic/tclMain.c: - * generic/tclObj.c: - * win/tclWinDde.c: - * win/tclWinReg.c: - * win/tclWinTime.c: Made HEAD build on Windows VC++ again. - -2004-03-19 Donal K. Fellows - - * generic/tclIntDecls.h: Made HEAD build on Solaris again by applying - fix recommended by Don Porter. - -2004-03-18 Reinhard Max - - * generic/tclIntDecls.h: Removed TclpTime_t. It wasn't really needed, - * generic/tclInt.h: but caused warnings related to - * generic/tclInt.decls: strict aliasing with GCC 3.3. - * generic/tclClock.c: - * generic/tclDate.c: - * generic/tclGetDate.y: - * win/tclWinTime.c: - * unix/tclUnixTime.c: - - * generic/tclNamesp.c: Added temporary pointer variables to work - * generic/tclStubLib.c: around warnings related to - * unix/tclUnixChan.c: strict aliasing with GCC 3.3. - - * unix/tcl.m4: Removed -Wno-strict-aliasing. - -2004-03-18 Daniel Steffen - - Removed support for Mac OS Classic platform [Patch 918142] - - * README: - * compat/string.h: - * doc/Encoding.3: - * doc/FileSystem.3: - * doc/Init.3: - * doc/Macintosh.3 (removed): - * doc/OpenFileChnl.3: - * doc/OpenTcp.3: - * doc/SourceRCFile.3: - * doc/Thread.3: - * doc/clock.n: - * doc/exec.n: - * doc/fconfigure.n: - * doc/file.n: - * doc/filename.n: - * doc/glob.n: - * doc/open.n: - * doc/puts.n: - * doc/resource.n (removed): - * doc/safe.n: - * doc/source.n: - * doc/tclvars.n: - * doc/unload.n: - * generic/README: - * generic/tcl.decls: - * generic/tcl.h: - * generic/tclAlloc.c: - * generic/tclBasic.c: - * generic/tclCmdAH.c: - * generic/tclDate.c: - * generic/tclDecls.h: - * generic/tclFCmd.c: - * generic/tclFileName.c: - * generic/tclGetDate.y: - * generic/tclIOCmd.c: - * generic/tclIOUtil.c: - * generic/tclInitScript.h: - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclIntPlatDecls.h: - * generic/tclMain.c: - * generic/tclMath.h: - * generic/tclNotify.c: - * generic/tclPathObj.c: - * generic/tclPlatDecls.h: - * generic/tclPort.h: - * generic/tclStubInit.c: - * generic/tclTest.c: - * generic/tclThreadJoin.c: - * library/auto.tcl: - * library/init.tcl: - * library/package.tcl: - * library/safe.tcl: - * library/tclIndex: - * mac/AppleScript.html (removed): - * mac/Background.doc (removed): - * mac/MW_TclAppleScriptHeader.h (removed): - * mac/MW_TclAppleScriptHeader.pch (removed): - * mac/MW_TclBuildLibHeader.h (removed): - * mac/MW_TclBuildLibHeader.pch (removed): - * mac/MW_TclHeader.h (removed): - * mac/MW_TclHeader.pch (removed): - * mac/MW_TclHeaderCommon.h (removed): - * mac/MW_TclStaticHeader.h (removed): - * mac/MW_TclStaticHeader.pch (removed): - * mac/MW_TclTestHeader.h (removed): - * mac/MW_TclTestHeader.pch (removed): - * mac/README (removed): - * mac/bugs.doc (removed): - * mac/libmoto.doc (removed): - * mac/morefiles.doc (removed): - * mac/porting.notes (removed): - * mac/tclMac.h (removed): - * mac/tclMacAETE.r (removed): - * mac/tclMacAlloc.c (removed): - * mac/tclMacAppInit.c (removed): - * mac/tclMacApplication.r (removed): - * mac/tclMacBOAAppInit.c (removed): - * mac/tclMacBOAMain.c (removed): - * mac/tclMacChan.c (removed): - * mac/tclMacCommonPch.h (removed): - * mac/tclMacDNR.c (removed): - * mac/tclMacEnv.c (removed): - * mac/tclMacExit.c (removed): - * mac/tclMacFCmd.c (removed): - * mac/tclMacFile.c (removed): - * mac/tclMacInit.c (removed): - * mac/tclMacInt.h (removed): - * mac/tclMacInterupt.c (removed): - * mac/tclMacLibrary.c (removed): - * mac/tclMacLibrary.r (removed): - * mac/tclMacLoad.c (removed): - * mac/tclMacMath.h (removed): - * mac/tclMacNotify.c (removed): - * mac/tclMacOSA.c (removed): - * mac/tclMacOSA.r (removed): - * mac/tclMacPanic.c (removed): - * mac/tclMacPkgConfig.c (removed): - * mac/tclMacPort.h (removed): - * mac/tclMacProjects.sea.hqx (removed): - * mac/tclMacResource.c (removed): - * mac/tclMacResource.r (removed): - * mac/tclMacSock.c (removed): - * mac/tclMacTclCode.r (removed): - * mac/tclMacTest.c (removed): - * mac/tclMacThrd.c (removed): - * mac/tclMacThrd.h (removed): - * mac/tclMacTime.c (removed): - * mac/tclMacUnix.c (removed): - * mac/tclMacUtil.c (removed): - * mac/tcltkMacBuildSupport.sea.hqx (removed): - * tests/all.tcl: - * tests/binary.test: - * tests/cmdAH.test: - * tests/cmdMZ.test: - * tests/fCmd.test: - * tests/fileName.test: - * tests/fileSystem.test: - * tests/interp.test: - * tests/io.test: - * tests/ioCmd.test: - * tests/load.test: - * tests/macFCmd.test (removed): - * tests/osa.test (removed): - * tests/resource.test (removed): - * tests/socket.test: - * tests/source.test: - * tests/unload.test: - * tools/cvtEOL.tcl (removed): - * tools/genStubs.tcl: - * unix/Makefile.in: - * unix/README: - * unix/mkLinks: - * unix/tcl.spec: - * win/README.binary: - * win/tcl.dsp: - -2004-03-17 Donal K. Fellows - - * doc/lsearch.n: Improved examples on the advanced capabilities of - lsearch (with the right options, set element removal can be done) - following discussion on tkchat. - -2004-03-16 Don Porter - - * doc/catch.n: Compiled [catch] no longer fails to catch syntax - errors. Removed the claims in the documentation that it does. - * doc/return.n: Updated example to use [dict merge]. - -2004-03-16 Jeff Hobbs - - * unix/configure, unix/tcl.m4: add -Wno-strict-aliasing for GCC to - suppress useless type puning warnings. - -2004-03-16 Donal K. Fellows - - * doc/file.n: *roff formatting fix. [Bug 917171] - -2004-03-15 David Gravereaux - - * win/tclWinNotify.c: Fixed a mistake where the return value of - MsgWaitForMultipleObjectsEx for "a message is in the queue" wasn't - accurate. I removed the check on the case result==(WAIT_OBJECT_0 + 1) - This was having the error of falling into GetMessage and waiting there - by accident, which wasn't alertable through Tcl_AlertNotifier. I'll do - some more study on this and try to find-out why. - -2004-03-12 Donal K. Fellows - - IMPLEMENTATION OF TIP#163 - * generic/tclDictObj.c (DictMergeCmd): This is based on work by Joe - * tests/dict.test (dict-20.*): English in Tcl [FRQ 745851] - * doc/dict.n: but not exactly. - -2004-03-10 Kevin B. Kenny - - * generic/tclGetDate.y (TclGetDate): Fix so that [clock scan - -gmt true] uses the GMT base date instead of the local - one. [Bug 913513] - * tests/clock.test: Added test cases for wrong ISO8601 week number - [Bug 500285] and wrong GMT base date [Bug 913513]. Several tests still - fail on Windows, and these are actual faults in [clock scan]. Fix is - still pending. - * generic/tclDate.c: Regenerated. - -2004-03-08 Vince Darley - - * generic/tclFileName.c: Fix to 'glob -path' near the root - * tests/fileName.test: of the filesystem. [Bug 910525] - -2004-03-08 Don Porter - - * generic/tclParse.c (TclParseInit): Modified TclParseInit so - * generic/tclTest.c ([testexprparser]): that Tcl_Parse initialization - conforms to documented promised about what fields will not be - modified by what Tcl_Parse* routines. [Bug 910595] - -2004-03-05 Mo DeJong - - * win/configure: Regen. - * win/configure.in: Check for define of MWMO_ALERTABLE in winuser.h. - * win/tclWinPort.h: If MWMO_ALERTABLE is not defined in winuser.h then - define it. This is needed for Mingw. - -2004-03-05 Kevin B. Kenny - - * generic/tclTest.c: Modified TesteventObjCmd to use a - Tcl_QueuePosition in place of an 'int' for the enumerated queue - position, to avoid a compiler warning on SGI. [Bug 771960] - -2004-03-05 Kevin B. Kenny - - * tests/registry.test: Applied fix from [Patch 910174] to make the test - for an English-language system include any country code, rather than - just English-United States.1252. Thanks to Pat Thoyts for the changes. - -2004-03-04 Pat Thoyts - - * tests/registry.test: Applied fixed from [Bug 766159] to skip two - tests on Win98 that depend on a Unicode registry (NT specific). - -2004-03-04 Don Porter - - * generic/tclInt.h (TclParseInit): Factored the common code - * generic/tclParse.c (TclParseInit): for initializing a Tcl_Parse - * generic/tclParseExpr.c: struct into one routine. - -2004-03-04 Pat Thoyts - - * library/reg/pkgIndex.tcl: Added TIP #100 support to the - * win/tclWinReg.c: registry package [patch 903831] - This provides a Windows test of the TIP #100 mechanism and a sample to - show how unloading an extension can be done. - -2004-03-04 Donal K. Fellows - - * unix/dltest/pkgua.c: Fix minor syntax problems. [Bug 909288] - -2004-03-03 Jeff Hobbs - - *** 8.5a1 TAGGED FOR RELEASE *** - - * changes: updated for 8.5a1 - -2004-03-03 David Gravereaux - - * win/makefile.vc: default environment variable for VC++ is %MSDevDir% - not %MSVCDir%, although vcvars32.bat sets both. - - * win/tclWinNotify.c (Tcl_WaitForEvent) : Allows an idling notifier to - service "Asynchronous Procedure Calls" from its wait state. Only - useful for extension authors who decide they might want to try - "completion routines" with WriteFileEx(), as an example. From - experience, I recommend that "completion ports" should be used instead - as the execution of the callbacks are more managable. - -2004-03-01 Jeff Hobbs - - * README: update patchlevel to 8.5a1 - * generic/tcl.h: - * tools/tcl.wse.in, tools/tclSplash.bmp: - * unix/configure, unix/configure.in, unix/tcl.spec: - * win/README.binary, win/configure, win/configure.in: - - * unix/tcl.m4: update HP-11 build libs setup - -2004-03-01 Don Porter - - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Allow 64-bit enabling on - IRIX64-6.5* systems. [Bug 218561] - * unix/configure: autoconf-2.57 - - * generic/tclTrace.c (TclCheckInterpTraces): The TIP 62 - * generic/tclTest.c (TestcmdtraceCmd): implementation introduced a - * tests/trace.test (trace-29.10): bug by testing the CallFrame - level instead of the iPtr->numLevels level when deciding what traces - created by Tcl_Create(Obj)Trace to call. Added test to expose the - error, and made fix. [FRQ 462580] - -2004-02-28 Vince Darley - - * tests/fileSystem.test: fix to Tcl Bug 905163. - * tests/fileName.test: fix to Tcl Bug 904705. - - * doc/{various}.n: removed 'the the' typos. - -2004-02-26 Daniel Steffen - - * macosx/Makefile: fixed copyright year in Tcl.framework Info.plist - -2004-02-25 Don Porter - - * tests/basic.test: Made several tests more robust to the - * tests/cmdMZ.test: list-quoting of path names that might contain - * tests/exec.test: Tcl-special chars like { or [. Should help us - * tests/io.test: sort out [Bug 554068] - * tests/pid.test: - * tests/socket.test: - * tests/source.test: - * tests/unixInit.test: - -2004-02-25 Donal K. Fellows - - * generic/tclLoad.c (Tcl_LoadObjCmd): Missing dereference caused - segfault with non-loadable extension. [Bug 904307] - - * unix/tclUnixChan.c (TcpGetOptionProc): Stop memory leak with very - long hostnames. [Bug 888777] - -2004-02-25 Pat Thoyts - - * win/tclWinDde.c: Removed some gcc warnings - except for the - -Wconversion warning for GetGlobalAtomName. gcc is just wrong about - this. - -2004-02-24 Donal K. Fellows - - IMPLEMENTATION OF TIP#100 FROM GEORGIOS PETASIS - * generic/tclLoad.c (Tcl_UnloadObjCmd): Implementation. - * tests/unload.test: Test suite. - * unix/dltest/pkgua.c: Helper for test suite. - * doc/unload.n: Documentation. - Also assorted changes (mostly small) to several other files. - -2004-02-23 Donal K. Fellows - - * generic/regc_locale.c (cclass): Buffer was having its size reset - instead of being released => memleak. [Bug 902562] - -2004-02-21 Donal K. Fellows - - * generic/tclLoad.c (Tcl_LoadObjCmd): Fixed memory leak due to an - improper error exit route. - -2004-02-20 David Gravereaux - - * win/tclWinSock.c (SocketThreadExitHandler): Don't call - TerminateThread when WaitForSingleObject returns a timeout. - Tcl_Finalize called from DllMain will pause all threads. Trust that - the thread will get the close notice at a later time if it does ever - wake up before being cleaned up by the system anyway. - -2004-02-17 Don Porter - - * doc/tcltest.n: - * library/tcltest/tcltest.tcl: Changed -verbose default value to - {body error} so that detailed information on unexpected errors in - tests is provided by default, even after the fix for [Bug 725253] - -2004-02-17 Jeff Hobbs - - * tests/unixInit.test (unixInit-7.1): - * unix/tclUnixInit.c (TclpInitPlatform): ensure the std fds exist to - prevent crash condition [Bug 772288] - -2004-02-17 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileSwitchCmd): Bozo mistake in memory - releasing order when in an error case. [Bug 898910] - -2004-02-16 Jeff Hobbs - - * generic/tclTrace.c (TclTraceExecutionObjCmd) - (TclTraceCommandObjCmd): fix possible mem leak in trace info. - -2004-02-12 Mo DeJong - - * win/tclWinInit.c (AppendEnvironment): Use the tail component of the - passed in lib path instead of just blindly using lib+4. That worked - when lib was "lib/..." but fails for other values. Thanks go to - Patrick Samson for pointing this out. - -2004-02-10 David Gravereaux - - * win/nmakehlp.c: better macro grepping logic. - -2004-02-07 David Gravereaux - - * win/makefile.vc: - * win/rules.vc: - * win/tcl.rc: - * win/tclsh.rc: Added an 'unchecked' option to the OPTS macro so a - core built with symbols can be linked to the non-debug enabled C - run-time. As per discussion with Kevin Kenny. Called like this: - - nmake -af makefile.vc OPTS=unchecked,symbols - - This clarifies the meaning of the 'g' naming suffix to mean only that - the binary requires the debug enabled C run-time. Whether the binary - contains symbols or not is a different condition. - -2004-02-06 Don Porter - - * doc/clock.n: Removed reference to non-existent [file ctime]. - -2004-02-05 David Gravereaux - - * docs/tclvars.n: Added clarification of the tcl_platform(debug) var - that it only refers to the flavor of the C run-time, and not whether - the core contains symbols. - -2004-02-05 Don Porter - - * generic/tclFileName.c (SkipToChar): Corrected CONST and type-casting - issues that caused compiler warnings. - -2004-02-04 Don Porter - - * generic/tclCmdAH.c (StoreStatData): Removed improper refcount - decrement of the varName parameter. This error was causing segfaults - following test cmdAH-28.7. - - * library/tcltest/tcltest.tcl: Corrected references to non-existent - $name variable in [cleanupTests]. [Bug 833637] - -2004-02-03 Don Porter - - * library/tcltest/tcltest.tcl: Corrected parsing of single command - line argument (option with missing value) [Bug 833910] - * library/tcltest/pkgIndex.tcl: Bump to version 2.2.5. - -2004-02-02 David Gravereaux - - * generic/tclIO.c (Tcl_Ungets): Fixes improper filling of the channel - buffer. This is the buffer before the splice. [Bug 405995] - -2004-02-01 David Gravereaux - - * tests/winPipe.test: more pass-thru commandline verifications. - * win/tclWinPipe.c (BuildCommandLine): Special case quoting for '{' - not required by the c-runtimes's parse_cmdline(). - * win/tclAppInit.c: Removed our custom setargv() in favor of the work - provided by the c-runtime. [Bug 672938] - - * win/nmakehlp.c: defensive techniques to avoid static buffer - overflows and a couple envars upsetting invokations of cl.exe and - link.exe. [Bug 885537] - - * tests/winPipe.test: Added proof that BuildCommandLine() is not doing - the "N backslashes followed a quote -> insert N * 2 + 1 backslashes - then a quote" rule needed for the crt's parse_cmdline(). - * win/tclWinPipe.c: Fixed BuildCommandLine() to pass the new cases. - -2004-01-30 David Gravereaux - - * win/makefile.vc: Use the -GZ compiler switch when building for - symbols. This is supposed to emulate the release build better to avoid - hiding problems that only show themselves in a release build. - -2004-01-29 Vince Darley - - * generic/tclPathObj.c: fix to [Bug 883143] in file normalization - -2004-01-29 Vince Darley - - * doc/file.n: - * generic/tclFCmd.c - * generic/tclTest.c - * library/init.tcl - * mac/tclMacFile.c - * tests/fileSystem.test: fix to [Bug 886352] where 'file copy -force' - had inconsistent behaviour wrt target files with insufficient - permissions, particular from vfs->native fs. Behaviour of '-force' is - now always consistent (and now consistent with behaviour of 'file - delete -force'). Added new tests and documentation and cleaned up the - 'simplefs' test filesystem. - - * generic/tclIOUtil.c - * unix/tclUnixFCmd.c - * unix/tclUnixFile.c - * win/tclWinFile.c: made native filesystems more robust to C code - which asks for mount lists. - - * generic/tclPathObj.c: fix to [Bug 886607] removing warning/error - with some compilers. - -2004-01-28 Donal K. Fellows - - * generic/tclObj.c (SetBooleanFromAny): Rewrite to do more efficient - string->bool conversion. - Many other minor whitespace/style fixes to this file too. - -2004-01-27 David Gravereaux - - * win/nmakehlp.c: Use '.\nul' as the sourcefile name instead of 'nul' - so VC 5.2 doesn't try searching the path for it and failing with a - possible dialogbox popping up about having to add a CD to an empty - drive. Also added a SetErrorMode() call to disable any dialogs that - cl.exe or link.exe might create. [Bug 885537] - -2004-01-22 Vince Darley - - * doc/file.n: clarified documentation of 'file system' [Bug 883825] - * tests/fCmd.test: improved test result in failure case. - -2004-01-22 Vince Darley - - * tests/fileSystem.test: 3 new tests - * generic/tclPathObj.c: fix to [Bug 879555] in file normalization. - * doc/filename.n: small clarification to Windows behaviour with - filenames like '.....', 'a.....', '.....a'. - - * generic/tclIOUtil.c: slight improvement to native cwd caching on - Windows. - -2004-01-21 David Gravereaux - - * doc/Panic.3: Mentions of 'panic' and 'panicVA' removed from the - documentation. - -2004-01-21 Vince Darley - - * doc/FileSystem.3: - * generic/tcl.decls: - * generic/tclCmdAH.c - * generic/tclDecls.h - * generic/tclFCmd.c - * generic/tclFileName.c - * generic/tclFileSystem.h - * generic/tclIOUtil.c - * generic/tclInt.decls - * generic/tclInt.h - * generic/tclIntDecls.h - * generic/tclPathObj.c - * generic/tclStubInit.c - * generic/tclTest.c - * mac/tclMacFile.c - * tests/fileName.test - * tests/fileSystem.test - * tests/winFCmd.test - * unix/tclUnixFile.c - * win/tclWin32Dll.c - * win/tclWinFCmd.c - * win/tclWinFile.c - * win/tclWinInt.h - - Three main issues accomplished: (1) cleaned up variable names in the - filesystem code so that 'pathPtr' is used throughout. (2) applied a - round of filesystem optimisation with better handling and caching of - relative and absolute paths, requiring fewer conversions. (3) - clarifications to the documentation, particularly regarding the - acceptable refCounts of objects. Some new tests added. Tcl benchmarks - show a significant improvement over 8.4.5, and on Windows typically a - small improvement over 8.3.5 (Unix still appears to require - optimisation). TCL_FILESYSTEM_VERSION_2 introduced, but for internal - use only. There should be no public incompatibilities from these - changes. Thanks to dgp for extensive testing. - -2004-01-19 David Gravereaux - - * win/tclWinPipe.c (Tcl_WaitPid): Fixed a thread-safety problem with - the process list. The delayed cut operation after the wait was going - stale by being outside the list lock. It now cuts within the lock and - does a locked splice for when it needs to instead. [Bug 859820] - -2004-01-18 Donal K. Fellows - - * generic/tclCompile.c, generic/tclCompile.h: Two new opcodes, - INST_LIST_INDEX_IMM and INST_LIST_RANGE_IMM, that have operand(s) of - new type OPERAND_IDX4 which represents indexes into things like lists - (and perhaps other things eventually.) - * generic/tclExecute.c (TclExecuteByteCode): Implementation of the new - opcodes. INST_LIST_INDEX_IMM does a simple [lindex] with either front- - or end-based simple indexing. INST_LIST_RANGE_IMM does an [lrange] - with front- or end-based simple indexing for both the reference to the - first and last items in the range. - * generic/tclCompCmds.c (TclCompileLassignCmd): Generate bytecode for - the [lassign] command. - -2004-01-17 David Gravereaux - - * win/tclWinInit.c: added #pragma comment(lib, "advapi32.lib") when - compiling under VC++ so we don't need to specify it when linking. - -2004-01-17 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LassignObjCmd): Add more shimmering - protection for when the list is also one of the variables. - - BASIC IMPLEMENTATION OF TIP#57 - * generic/tclCmdIL.c (Tcl_LassignObjCmd): Implementation of the - [lassign] command that takes full advantage of Tcl's object API. - * doc/lassign.n: New file documenting the command. - * tests/cmdIL.test (cmdIL-6.*): Test suite for the command. - -2004-01-15 David Gravereaux - - * win/tclWinReg.c: Placed the requirement for advapi.lib into the - object file itself with #pragma comment (lib, ...) when built with - VC++. This will simplify linking for users of the static library. - - * win/rules.vc: Added new 'fullwarn' to the CHECKS commandline macro; - sets $(FULLWARNINGS). - - * win/makefile.vc: Removed 'advapi.lib' from $(baselibs). Added new - logic to crank-up the warning levels for both compile and link when - $(FULLWARNINGS) is set. Some clean-up with how the resource files are - built and how -DTCL_USE_STATIC_PACKAGES is sent when compiling the - shells. - - * win/tclAppInit.c: Small change in how TCL_USE_STATIC_PACKAGES is - used. - - * win/tcl.rc: - * win/tclsh.rc: Some clean-up with how the resource files are built. - Fixed 'OriginalFilename' problem that still thought a debug suffix was - still 'd', now is 'g'. - -2004-01-14 Donal K. Fellows - - * generic/tclDictObj.c (TraceDictPath, DictExistsCmd): Adjusted - behaviour of [dict exists] so a failure to look up a dictionary along - the path of dicts doesn't trigger an error. This is how it was - documented to behave previously... [Bug 871387] - - * generic/tclDictObj.c: Assorted dict fixes from Peter Spjuth relating - to [Bug 876170]. - (SetDictFromAny): Make sure that lists retain their ordering even when - converted to dictionaries and back. - (TraceDictPath): Correct object reference count handling! - (DictReplaceCmd, DictRemoveCmd): Stop object leak. - (DictIncrCmd,DictLappendCmd,DictAppendCmd,DictSetCmd,DictUnsetCmd): - Simpler handling of reference counts when assigning to variables. - * tests/dict.test (dict-19.2): Memory leak stress test - -2004-01-13 Don Porter - - * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): Silence compiler warnings. - - Patch 876451: restores performance of [return]. Also allows forms such - as [return -code error $msg] to be bytecompiled. - - * generic/tclInt.h: Factored Tcl_ReturnObjCmd() into two pieces: - * generic/tclCmdMZ.c: TclMergeReturnOptions(), which can parse the - options to [return], check their validity, and create the - corresponding return options dictionary, and TclProcessReturn(), which - takes that return options dictionary and performs the [return] - operation. - - * generic/tclCompCmds.c: Rewrote TclCompileReturnCmd() to call - TclMergeReturnOptions() at compile time so the return options - dictionary is computed at compile time (when it is fully known). The - dictionary is pushed on the stack along with the result, and the code - and level values are included in the bytecode as operands. Also - supports optimized compilation of un-[catch]ed [return]s from procs - with default options into the INST_DONE instruction. - - * generic/tclExecute.c: Rewrote INST_RETURN instruction to retrieve - the code and level operands, pop the return options from the stack, - and call TclProcessReturn() to perform the [return] operation. - - * generic/tclCompile.h: New utilities include TclEmitInt4 macro - * generic/tclCompile.c: and TclWordKnownAtCompileTime(). - - End Patch 876451. - - * generic/tclFileName.c (Tcl_GlobObjCmd): Latest changes to management - of the interp result by Tcl_GetIndexFromObj() exposed improper interp - result management in the [glob] command procedure. Corrected by - adopting the Tcl_SetObjResult(Tcl_NewStringObj) pattern. This stopped - a segfault in test filename-11.36. [Bug 877677] - -2004-01-13 Donal K. Fellows - - * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct, Tcl_WrongNumArgs): - Create fresh objects instead of using the one currently in the - interpreter, which isn't guaranteed to be fresh and unshared. The cost - for the core will be minimal because of the object cache, and this - fixes [Bug 875395]. - -2004-01-12 Miguel Sofer - - * generic/tclCompExpr.c (CompileLandOrLorExpr): cosmetic changes. - -2004-01-12 Miguel Sofer - - * generic/tclCompExpr.c (CompileLandOrLorExpr): new logic, fewer - instructions. As a side effect, the instructions INST_LOR and - INST_LAND are now never used. - * generic/tclExecute.c (INST_JUMP*): small optimisation; fix a bug in - debug code. - -2004-01-11 David Gravereaux - - * win/tclWinThrd.c (Tcl_ConditionNotify): condPtr must be dereferenced - to see if there are waiters else uninitialized datum is manipulated. - [Bug 849007 789338 745068] - -2004-01-09 David Gravereaux - - * generic/tcl.h: Renamed and deprecated #defines moved to within the - #ifndef TCL_NO_DEPRECATED block. This allows us to build Tcl to check - for deprecated functions in use, such as panic() and Tcl_Ckalloc(). By - request from DKF. Extensions that build with -DTCL_NO_DEPRECATED now - have these macros as restricted. - ***POTENTIAL INCOMPATIBILITY*** - - * win/makefile.vc: - * win/rules.vc: Added -DTCL_NO_DEPRECATED usage to makefile.vc. - Called like this: nmake -af makefile.vc CHECKS=nodep - -2004-01-09 Vince Darley - - * generic/tclIOUtil.c: fix to infinite loop in TclFinalizeFilesystem - [Bug 873311] - - ****************************************************************** - *** CHANGELOG ENTRIES FOR 2003 IN "ChangeLog.2003" *** - *** CHANGELOG ENTRIES FOR 2002 IN "ChangeLog.2002" *** - *** CHANGELOG ENTRIES FOR 2001 IN "ChangeLog.2001" *** - *** CHANGELOG ENTRIES FOR 2000 IN "ChangeLog.2000" *** - *** CHANGELOG ENTRIES FOR 1999 AND EARLIER IN "ChangeLog.1999" *** - ****************************************************************** diff --git a/ChangeLog.2005 b/ChangeLog.2005 deleted file mode 100644 index 0d1d7cf..0000000 --- a/ChangeLog.2005 +++ /dev/null @@ -1,3822 +0,0 @@ -2005-12-30 Kevin B. Kenny - - * generic/tclStubLib.c: Corrected a typo in "missing Stubs table - pointer." - -2005-12-27 Kevin B. Kenny - - * generic/tcl.decls: Destubbed TclTomMathInitializeStubs - it is in - * generic/tcl.h: the stub library, not the main shared - * generic/tclBasic.c: library. Exported Tcl_InitBignumFromDouble. - * generic/tclExecute.c: - * generic/tclInt.h: - * generic/tclStrToD.c: - - * generic/tclDecls.h: - * generic/tclStubLib.c: - * generic/tclStubInit.c: Regenerated. - - * generic/clock.tcl: Reverted to using the time zone abbreviation and - not its name to "stop the bleeding" on [Bug 1386377]. This is *not* a - good long-term solution, but there may not be one. - - * libtommath/bn_mp_sqrt.c: Improved the initial approximation to the - square root, roughly doubling the speed of the routine. (This is a - local change that needs to be communicated to Tom.) - - * win/Makefile.in: Corrected a bug where tommath_class.h and - tommath_superclass.h were not installed, making it impossible for - client code to compile against the tommath stubs. - - * library/tzdata: Updated to Olson's tzdata2005r. (Latest changes to - Daylight Saving Time in Canada, plus redefinition of the Posix-style - zones [e.g., EST5EDT] to be locale-independent.) - - * libtommath: Updated to Tom St.Denis's release 0.37. - -2005-12-20 Donal K. Fellows - - * generic/tclThreadAlloc.c (Tcl_GetMemoryInfo): Format values as longs - and not ints, so they are less likely to wrap on 64-bit machines. - -2005-12-19 Don Porter - - * generic/tclCmdMZ.c: Modified [string is double] to use - * tests/string.test: TclParseNumber() to parse trailing whitespace. - Ensures consistency, and makes it easier to cleanup after invalid - internal reps left behind by parsing [Bugs 1360532 1382287]. - - * generic/tclParseExpr.c: Added TCL_PARSE_NO_WHITESPACE to - * generic/tclScan.c: TclParseNumber() calls since [scan] and [expr] - * tests/scan.test: parsing don't want spaces in parsed numbers. - - * generic/tclInt.h: Added TCL_PARSE_NO_WHITESPACE flag to the - * generic/tclStrToD.c: TclParseNumber() interface. - -2005-12-19 Donal K. Fellows - - * doc/Tcl.n: Clarify what is going on in variable substitution - following thread on comp.lang.tcl. - -2005-12-18 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileDictCmd): Ensure that we only do an - 'endCatch' when there's a preceding 'beginCatch'. [Bug 1382528] Many - thanks to Anton Kovalenko for finding this and pointing out that it was - a catch stack handling problem! - -2005-12-14 Daniel Steffen - - * generic/tclIOUtil.c: workaround gcc warning "comparison is always - * generic/tclTest.c: false due to limited range of data type". - - * macosx/Tcl.xcode/project.pbxproj: - * macosx/Tcl.xcodeproj/project.pbxproj: - * unix/Makefile.in: add new tclTomMath* files. - - * generic/tclBasic.c: replace panic with Tcl_Panic. - -2005-12-13 Kevin B. Kenny - - * generic/tcl.decls: Added changes to export an additional stubs - * generic/tclBasic.c: table to represent the 'libtommath' routines - * generic/tclDecls.h: that Tcl uses and export them to callers. - * generic/tclInt.decls: Reran 'genstubs' - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclIntPlatDecls.h: - * generic/tclStubInit.c: - * generic/tclStubLib.c: - * generic/tclTomMath.decls: - * generic/tclTomMath.h: - * generic/tclTomMathDecls.h: - * generic/tclTomMathInterface.c: - * generic/tommath.h: - * tools/fix_tommath_h.tcl: - * unix/Makefile.in: - * win/Makefile.in: - * win/makefile.vc: - - * generic/tclClock.c: Made changes to silence a number of compiler - * generic/tclIO.c: warnings when building with mingw. - * generic/tclIORChan.c: - * generic/tclLink.c: - * generic/tclListObj.c: - * generic/tclObj.c: - * generic/tclParseExpr.c: - * generic/tclProc.c: - * generic/tclTimer.c: - * win/tclWinChan.c: - * win/tclWinConsole.c: - * win/tclWinDde.c: - * win/tclWinFCmd.c: - * win/tclWinFile.c: - * win/tclWinReg.c: - * win/tclWinSock.c: - -2005-12-13 Donal K. Fellows - - * generic/tclExecute.c (TEBC:DICT_FIRST,DICT_DONE): Only decrease the - references to the dictionary once the iteration completes. Do this by - storing the dict in the iterator context variable. [Bug 1379349] Thanks - to Ulrich Ring and Tobias Hippler for finding this. - -2005-12-12 Jeff Hobbs - - * unix/tcl.m4, unix/configure: Fix sh quoting error reported in - bash-3.1+ [Bug 1377619] (schafer) - -2005-12-12 Kevin B. Kenny - - * doc/mathfunc.n: Changed two examples from the incorrect 'tcl::math::' - to 'tcl::mathfunc::' [Bug 1378818] - -2005-12-09 Mo DeJong - - * win/configure: Regen. - * win/tcl.m4 (SC_CONFIG_CFLAGS): Define MACHINE for gcc builds. The - lack of a definition of this variable in the manifest file was causing - a runtime error in wish built with gcc. - -2005-12-09 Donal K. Fellows - - * tests/lsearch.test (lsearch-10.8..10): If the -start is off the end, - * generic/tclCmdIL.c (Tcl_LsearchObjCmd): searching should find nothing - at all. [Bug 1374778] - -2005-12-08 Jeff Hobbs - - * win/Makefile.in, win/makefile.vc: Add Win x64 and CE build support - * win/tcl.m4, win/configure: CE still requires C code fixes. - - * generic/tcl.h: use struct __stat64 (not _stat64) for MSC_VER >= 1400 - (i.e. latest Platform SDK). - -2005-12-07 Donal K. Fellows - - * doc/socket.n: Cross-referenced the socket documentation better to the - fconfigure documentation on the topic of asynch sockets. - * doc/fconfigure.n: Added keyword to documentation of -blocking option - so that people looking for "asynch" can find it as well. - -2005-12-05 Daniel Steffen - - * unix/tclUnixPort.h (Darwin): fix incorrect __DARWIN_UNIX03 configure - overrides that were originally copied from Darwin CVS (rdar://3693001) - -2005-12-05 Kevin B. Kenny - - * tools/tclZIC.tcl: Updated to reflect changes in calling sequence when - GetJulianDateFromEraYearMonthDay moved to C. - * library/tzdata: Regenerated from Olson's tzdata2005p.tar.gz - the - 'systemv' changes appear not to affect Tcl's processing of the dates. - -2005-12-05 Daniel Steffen - - * unix/configure.in: move check for fts API to configure.in and run it - * unix/tcl.m4: on all platforms, since Linux glibc2 and *BSDs - also have this; using fts is more efficient than a recursive - opendir/readdir. - * unix/tclUnixFCmd.c (TraverseUnixTree): add support to fts code for - platforms with stat64. - * unix/configure: - * unix/tclConfig.h.in: regen. - -2005-12-05 Jeff Hobbs - - * unix/configure: Use fts file API on Darwin if available. - * unix/tcl.m4: Addresses file delete issues in readdir noted - * unix/tclUnixFCmd.c: in [Bug 1034337]. (steffen) - Remove redundant stat call for each file in DoCopyFile. (steffen) - -2005-12-02 Kevin B. Kenny - - * generic/tclClock.c: Moved a tiny bit more of [clock format] from run - * library/clock.tcl: time to compile time, and fixed a l10n bug in the - process. [Bug 1371446]. Also, conditoned the call to SetupTimeZone to - speed the common case where TZData($timezone) already exists, and - achieved a puny speedup by making ::tcl::clock::getenv not throw - errors. - * unix/Makefile.in: Made some changes to support a 'make' command that - is present on some antiquated versions of Solaris. - -2005-12-01 Kevin B. Kenny - - * library/clock.tcl: Continued rationalizing the code, eliminating - numerous redundant [mc] calls. Added another time boost by precompiling - a [::format] command to do the bulk of the work of [clock format]. - -2005-12-01 Donal K. Fellows - - * unix/Makefile.in: Add remaining dependency info. While automated - maintenance of this information would be good, having it at all is much - better than a poke in the eye with a sharp stick... - -2005-12-01 Daniel Steffen - - * generic/tclClock.c: fix warning. - - * unix/tcl.m4 (Darwin): fix error when MACOSX_DEPLOYMENT_TARGET unset - * unix/configure: regen. - -2005-11-30 Donal K. Fellows - - * unix/Makefile.in: Add dependency information relating to tclCompile.h - since when the list of opcodes changes it is usually useful to rebuild - everything that depends on it (but which is nonetheless a small - fraction of the total set of Tcl source files). - - ***POTENTIAL INCOMPATIBILITY*** for bytecode savers/loaders. See below - - * generic/tclCompCmds.c (TclCompileSwitchCmd): Arrange for very simple - [switch] invokations to be compiled into hash lookups into jump tables; - only a very specific kind of [switch] can be safely compiled this way, - but that happens to be the most common kind. This makes around 5-10% - difference to the speed of execution of clock.test. - * generic/tclExecute.c (TEBC:INST_JUMP_TABLE): New instruction to allow - for jumps to locations looked up in a hashtable. Requires a new AuxData - type, tclJumptableInfoType (supported by the functions DupJumptableInfo - and FreeJumptableInfo in tclCompCmds.c) so anything that saves bytecode - containing this *must* be updated! - -2005-11-30 Kevin Kenny - - * generic/tclClock.c: Fixed a bad refcount in previous commit that led - to a corrupted heap. Also silenced a warning that some compilers gave - about the excessively long constant for JULIAN_SEC_POSIX_EPOCH. Also - fixed a bug where [clock format] would fail in the :localtime zone for - times before the Posix Epoch. Thanks to Miguel Sofer for pointing out - all of these. Also rationalized the code a little bit by moving parts - of [clock scan] into C, eliminating some code that was duplicated in - the C and Tcl layers. - -2005-11-29 Kevin Kenny - - * generic/tclBasic.c: Moved a big part of [clock format] down - * generic/tclClock.c: to the C level in order to make it go faster. - * generic/tclInt.h: Preliminary measurements suggest that it - * generic/clock.tcl: more than doubles in speed with this change. - -2005-11-29 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsearchObjCmd): Allow [lsearch -regexp] to - process REs that contain backreferences. This expensive mode of - operation is only used if the RE would otherwise cause a compilation - failure. [Bug 1366683] - -2005-11-28 Kevin Kenny - - * tools/tclZIC.tcl (convertTimeOfDay): Corrected a typo that caused - wrong DST transitions in any time zone where the transition is - specified as local Standard Time (as opposed to wall-clock or UTC). - (Also updated the code to be bignum-safe.) - * tests/clock.test (clock-51.1): Added regression test for the above. - * library/tzdata: Updated to Olson's 'tzdata2005o' (changes for Cuba, - Nicaragua, Jordan, and Georgia) and regenerated. Thanks to Paul - Mackerras for reporting this problem. - -2005-11-27 Daniel Steffen - - * unix/tcl.m4 (Darwin): add 64bit support, check for Tiger copyfile(), - add CFLAGS to SHLIB_LD to support passing -isysroot in env(CFLAGS) to - configure (flag can't be present twice, so can't be in both CFLAGS and - LDFLAGS during configure), don't use -prebind when deploying on 10.4, - define TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING (rdar://3171542). - (SC_ENABLE_LANGINFO, SC_TIME_HANDLER): add/fix caching, fix obsolete - autoconf macros. Sync with tk/unix/tcl.m4. - - * unix/configure.in: fix obsolete autoconf macros, sync gratuitous - formatting/ordering differences with tk/unix/configure.in. - - * unix/Makefile.in: add CFLAGS to tclsh/tcltest link to make executable - linking the same as during configure (needed to avoid losing any linker - relevant flags in CFLAGS, in particular flags that cannot be in - LDFLAGS). Avoid concurrent linking of tclsh and compiling of - tclTestInit.o or xtTestInit.o during parallel make. - (checkstubs, checkdoc, checkexports): dependency and Darwin fixes - (dist): add new macosx files. - - * unix/tclLoadDyld.c (TclpDlopen): use NSADDIMAGE_OPTION_WITH_SEARCHING - on second NSAddImage only. [Bug 1204237] - (TclGuessPackageName): should not be MODULE_SCOPE. - (TclpLoadMemory): ppc64 and endian (i386) fixes, add support for - loading universal (fat) bundles from memory. - - * unix/tclUnixFCmd.c: - * macosx/tclMacOSXFCmd.c: ppc64 and endian (i386) fixes. - (TclMacOSXCopyFileAttributes): add support for new Tiger copyfile() API - to enable copying of xattrs & ACLs by [file copy]. - - * generic/tcl.h: add Darwin specifc configure overrides for TCL_WIDE - defines to support fat compiles of ppc and ppc64 at the same time, - (replaces Darwin CVS fix by emoy, rdar://3693001). add/correct location - of version numbers in macosx files. - - * generic/tclInt.h: clarify fat compile comment. - - * unix/tclUnixPort.h: add Darwin specifc configure overrides to support - fat compiles, where configure runs only once for multiple architectures - (replaces Darwin CVS fix by emoy, rdar://3693001). - - * macosx/tclMacOSXBundle.c: - * macosx/tclMacOSXNotify.c: - * unix/tclUnixNotfy.c: - * unix/tclUnixPort.h: fix #include order to support compile time - override of HAVE_COREFOUNDATION in tclUnixPort.h when building for - ppc64 - - * macosx/Tcl.pbproj/default.pbxuser (new file): - * macosx/Tcl.pbproj/jingham.pbxuser: - * macosx/Tcl.pbproj/project.pbxproj: - * macosx/Tcl.xcode/default.pbxuser (new file): - * macosx/Tcl.xcode/project.pbxproj (new file): - * macosx/Tcl.xcodeproj/default.pbxuser (new file): - * macosx/Tcl.xcodeproj/project.pbxproj (new file): new/updated - projects for Xcode 2.2 on 10.4, Xcode 1.5 on 10.3 & ProjectBuilder on - 10.2, with native tcltest targets and support for universal (fat) - compiles. - - * macosx/README: clarification/cleanup, document new Xcode projects and - universal (fat) builds via CFLAGS (i.e. all of ppc ppc64 i386 at once). - - * unix/Makefile.in: - * unix/aclocal.m4: - * unix/configure.in: - * unix/dltest/Makefile.in: - * macosx/configure.ac (new file): add support for inclusion of - unix/configure.in by macosx/configure.ac, allows generation of a config - headers enabled configure script in macosx (required by Xcode - projects). - - * macosx/GNUmakefile: rename from Makefile to avoid overwriting by - configure run in tcl/macosx, add support for reusing configure cache, - build target fixes, remove GENERIC_FLAGS override now handled by - tcl.m4. - - * generic/tcl.decls: add Tcl_Main declaration as comment to avoid - 'checkstubs' target complaining about it missing from stubs. - - * generic/regex.h: - * generic/tclDate.c: - * generic/tclEnv.c: - * generic/tclGetDate.y: - * generic/tclIOUtil.c: - * generic/tclObj.c: - * generic/tclStubInit.c: - * generic/tclStubLib.c: - * generic/tclPathObj.c: - * generic/tclThreadAlloc.c: - * generic/tclThreadStorage.c: - * generic/tclTrace.c: - * generic/tclVar.c: - * generic/tommath.h: - * tools/fix_tommath_h.tcl: - * unix/tclUnixFCmd.c: ensure externally visible symbols not contained - in stubs table are declared as MODULE_SCOPE (or as static if not used - outside of own source file). These changes allow 'make checkstubs' to - complete without error on Darwin with gcc 4. - - * generic/rege_dfa.c (getvacant): - * generic/regexec.c (cfind): - * generic/tclCompExpr.c (CompileSubExpr): - * generic/tclNamesp.c (NamespaceEnsembleCmd): - * unix/tclUnixChan.c (TclUnixWaitForFile): initialise variables to - silence gcc 4 warnings. - - * generic/tclExecute.c (TclExecuteByteCode): fix unused variable - warning when NO_WIDE_TYPE is defined. - - * generic/regguts.h: only #define NDEBUG if not already #defined. - - * unix/tclUnixNotfy.c: - * macosx/tclMacOSXNotify.c: sync whitespace & comments. - - * unix/tclUnixPort.h: - * win/tclWinPort.h: remove declaration of obsolete&unused TclpMutex - API. - - * unix/configure: - * unix/tclConfig.h.in: regen. - -2005-11-21 Andreas Kupries - - * unix/Makefile.in (install-libraries): Updated Makefile to new - * win/Makefile.in (install-libraries): version of the http package. - This fixes the ifneeded/provide mismatch reported when trying to - require http. Should we maybe try to automatically extract the version - number from the http code to prevent future breakage ? - - This follows the update of the version number by dgp on Nov 15 (No - entry found in the ChangeLog). - -2005-11-20 Joe English - - * generic/tclStubLib.c: Don't set tclStubsPtr to 0 when - Tcl_PkgRequireEx() fails [Fix for [Bug 1091431] "Tcl_InitStubs failure - crashes wish"] - -2005-11-18 Miguel Sofer - - * tests/trace.test (trace-34.5): [Bug 1047286], added a second test - illustrating the role of "ns in callStack" in the ns's visibility - during deletion traces. - -2005-11-18 Kevin B. Kenny - - * doc/clock.n: Restored several missing lines near the %w format group - so that %w and %W are documented with their actual behaviour. [Bug - 1359183] - -2005-11-18 Jeff Hobbs - - * generic/tclIO.c (TclFinalizeIOSubsystem): preserve statePtr until we - retrieve the next statePtr from it. - -2005-11-18 Miguel Sofer - - * generic/tclObj.c (GetBignumFromObj): replace NULL with - tclEmptyStringRep to stop memcpy from complaining in a debug build - (the corresponding branch is eliminated by the optimiser otherwise). - -2005-11-18 Andreas Kupries - - * generic/tclIO.c (TclFinalizeIOSubsystem): Applied Pat Thoyts' patch - for [Bug 1359094]. This moves the retrieval of the next channel state - to the end of the loop, as the called closeproc may close other - channels, i.e. modify the list we are iterating, invalidating any - pointer retrieved earlier. - -2005-11-18 Don Porter - - * generic/tclListObj.c: Restored the SetListFromAny routine to the - * generic/tclObj.c: "list" Tcl_ObjType, and restored the - Tcl_RegisterObjType() call for "list". This addresses the needs of some - "bridge" extensions to examine whether the Tcl_ObjType of a Tcl_Obj is - that of the "list" Tcl_ObjType. - -2005-11-18 Donal K. Fellows - - * library/http/http.tcl (http::geturl): Improved syntactic validation - of URLs, and better error messages in some cases. [Bug 1358369] - -2005-11-17 Miguel Sofer - - * tests/namespace.test: fix comment - -2005-11-14 Don Porter - - * generic/tclStrToD.c: More data in the "can't happen" Tcl_Panic to - aid debugging. - - * generic/tclBasic.c (CallCommandTraces): Save/restore the interp - result during traces to fix [Bug 1355342]. - -2005-11-13 Miguel Sofer - - * generic/tclInt.h: - * generic/tclNamesp.c: - * tests/namespace.test: fix for [Bug 1354540] and [Bug 1355942]. The - new tests 7.3-6 and the modified 51.13 fail due to the unrelated [Bug - 1355342] - - * tests/trace.test: added tests 20.13-16 for [Bug 1355342] - -2005-11-12 Miguel Sofer - - * generic/tclBasic.c (Tcl_DeleteCommandFromToken): - * generic/tclObj.c (Tcl_GetCommandFromObj): more partial fixes for - [Bug 1354540] - making sure that cached references to a command being - deleted cannot be made reusable by a delete trace. - -2005-11-12 Donal K. Fellows - - * generic/tclNamesp.c (Tcl_FindCommand): Do not find commands in dead - namespaces on the path. Partial fix for [Bug 1354540]. - -2005-11-11 Don Porter - - * generic/tclInt.h: Revised TclParseNumber interface to enable - * generic/tclScan.c: revision to the [scan] command implementation - * generic/tclStrToD.c: to permit tests scan-4.44,55 to pass again. - [Bug 1348067]. - -2005-11-11 Miguel Sofer - - * generic/tclBasic.c (Tcl_DeleteCommandFromToken): - * generic/tclObj.c (Tcl_GetCommandFromObj): bump the cmd epoch early - to insure that cached references to this command are invalidated. - Partial fix for [Bug 1352734] - at least insures that namespace-51.13 - does not cause a panic. The test is still marked as knownbug, pending - resolution of what is actually the correct return value ([Bug - 1354540]) - -2005-11-09 Kevin B. Kenny - - * generic/tclTimer.c: Changed [after] so that it behaves correctly - * tests/timer.test: with negative arguments [Bug 1350293] and - arguments that overflow a 32-bit word. [Bug 1350291] - -2005-11-08 Don Porter - - * tests/compile.test: Updated tests with changed behavior - * tests/execute.test: due to addition of bignums. - * tests/expr-old.test: - * tests/expr.test: - * tests/parseExpr.test: - * tests/platform.test: - * tests/string.test: - -2005-11-08 Jeff Hobbs - - * unix/tclUnixFCmd.c (MAX_READDIR_UNLINK_THRESHOLD): reduce to 130 - based on errors seen on OS X 10.3 with lots of links in a dir. - [Bug 1034337 followup] - -2005-11-09 Donal K. Fellows - - * unix/Makefile.in (gdb-test): Added a new target to make it easier to - run the test suite inside a debugger. - -2005-11-08 Don Porter - - * tests/compExpr-old.test: Updated tests with changed behavior due - to addition of bignums. - - * tests/expr.test: Portable tests expr-46.13-18 [Bug 1341368] - - * generic/tclPkg.c: Corrected inconsistencies in the value returned - * tests/pkg.test: by Tcl_PkgRequire(Ex) so that the returned - values will always agree with what is stored in the package database. - This way repeated calls to Tcl_PkgRequire(Ex) have the same results. - Thanks to Hemang Lavana. [Bug 1162286]. - -2005-11-08 Donal K. Fellows - - * generic/tclTrace.c (TraceVarEx): Factor out heart of Tcl_TraceVar2 - (TclTraceVariableObjCmd,TraceVarProc): Use the new internal API to - arrange for the clientData to be cleaned up at the same time as the - rest of the main trace record. This simplifies the code a bit at the - same time. - -2005-11-07 Miguel Sofer - - * tests/trace.test (trace-13.2-4): added tests to detect leak, see [Bug - 1348775]. The recently added trace-8.9 test is now 13.4. - -2005-11-07 Donal K. Fellows - - * tests/dict.test (dict-19.2): arrange for the stress testing code to - only stress test the dict code and not the trace code as well. [Bug - 1342858] - -2005-11-05 Miguel Sofer - - * tests/trace.test (trace-8.9): added test to detect leak, see [Bug - 1348775]. - -2005-11-04 Pat Thoyts - - * win/tclWinPort.h: Applied [Patch 1267871] by Matt Newman for - * win/tclWinPipe.c: extended error code support on Windows. - * tests/exec.test: Tests for extended error codes. - * generic/tclPipe.c: Permit long codes (platform macros permitting). - -2005-11-04 Miguel Sofer - - * generic/tclBinary.c: - * generic/tclCmdAH.c: - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclDictObj.c: - * generic/tclExecute.c: - * generic/tclIOCmd.c: - * generic/tclLink.c: - * generic/tclTest.c: - * generic/tclVar.c: fix for [Bug 1334947]. The functions TclPtrSetVar, - Tcl_ObjSetVar2 and Tcl_SetVar2Ex now always consume the newValuePtr - argument - i.e., they will free a 0-refCount object if they failed to - set the variable. Fixed all callers in the core. - -2005-11-04 Kevin Kenny - - * generic/tclGetDate.y: Added abbreviations for the Korean - * library/clock.tcl: timezone. [Patch 1298737] - * generic/tclDate.c: Regenerated. - - * tools/findBadExternals.tcl: Added this script, which locates external - symbols that do not begin with 'Tcl' or 'tcl' and hence might be in - conflict with other link libraries. Thanks to George Peter Staplin for - the idea and the initial version of the script. [Bug 1263012] - - * unix/Makefile.in: Trimmed a bunch of fat out of the tommath/ - directory in 'make dist'. [RFE 1333318] - - * unix/tcl.m4: Added code to enable [load] on LynxOS. Thanks to - heidibr@users.sf.net for the patch. [Bug 1163896]. Removed the last - vestiges of GNU dld from the Unix build [RFE 1071992]. - - * unix/tclLoadDld.c: Removed. - * unix/configure: Regenerated. - -2005-11-04 Miguel Sofer - - * generic/tclInt.h: - * generic/tclNamesp.c: - * generic/tclVar.c: - * tests/trace.test: fix for [Bugs 1338280/1337229]; changed to use the - same approach as the 8.4 patch in the ticket (i.e., removed the patch - committed on 2005-31-10). - -2005-11-03 Pat Thoyts - - * win/tclWin32Dll.c: Applied [Patch 1256872] to provide unicode - * win/tclWinConsole.c: support in the console on suitable systems. - * win/tclWinInt.h: Patch by Anton Kovalenko - -2005-11-02 Pat Thoyts - - Applied [Patch 1096916] to support building with MSVC 8. - * generic/regerror.c: Avoid use of reserved word. - * generic/tcl.h: Select the right Tcl_Stat structure - * generic/tclDate.c: Casts to handle 64 bit time_t case. - * tests/env.test: Include essential envvar on Win32 - * win/nmakehlp.c: Handle new return codes. - * win/makefile.vc: Use the selected options. - * win/rules.vc: Check options are applicable - * win/tclWinPort.h: Disable deprecated function warnings - * win/tclWinSock.c: Provide default value to avoid warning. - * win/tclWinTime.c: Add casts to handle 64bit time_t type. - -2005-11-01 Don Porter - - * generic/tclTrace.c (TclCheckExecutionTraces): Corrected mistaken - assumption that all command traces are set at the script level. - Report/fix from Jacques H. de Villiers. [Bug 1337941] - - * tests/unixNotfy.test (1.1,2): Update error message whitespace to - match changes in code. - - * tests/expr-old.test (expr-32.52): Use int(.) to restrict result of - left shift to the C long range. - - * expr.test (expr-46.13): Added test that illustrates shortcoming of - [Patch 1340260]. - -2005-10-31 Miguel Sofer - - * generic/tclNamesp.c: fix for [Bugs 1338280/1337229]. Thanks Don. - * tests/trace.test: fix duplicate test numbers - -2005-10-31 Donal K. Fellows - - * win/tclWinSerial.c (SerialSetOptionProc): Cleaned up option parsing - to produce more informative error messages and separate error and - non-error code paths better. - * tests/ioCmd.test (iocmd-8-19): Updated. - -2005-10-29 Miguel Sofer - - * generic/tclTrace.c (TraceVarProc): [Bug 1337229], partial fix. Ensure - that a second call with TCL_TRACE_DESTROYED does not lead to a second - call to Tcl_EventuallyFree(). It is still true that that second call - should not happen, so the bug is not completely fixed. - * tests/trace.test (test-18.3-4): added tests for [Bug 1337229] and - [Bug 1338280]. - -2005-10-23 Vince Darley - - * generic/tclFileName.c: fix to memory leak in glob [Bug 1335006] Obj - leak detection and patch by Eric Melbardis. - - * tests/fCmd.test: - * win/tclWinFile.c: where appropriate windows API is available, try to - set 'nlink' and 'ino' stat fields (previously they were always 0). [Bug - 1325803] - -2005-10-22 Miguel Sofer - - * tests/foreach.test (foreach-8.1): added test for [Bug 1189274] - -2005-10-22 Miguel Sofer - - * generic/tclExecute.c (INST_INCR_*): fixed [Bug 1334570]. Obj leak - detection and patch by Eric Melbardis. - -2005-10-21 Kevin B. Kenny - - * generic/tclStrToD.c (RefineApproximation): Plugged a memory leak - where two intermediate results were not freed on one return path. [Bug - 1334461]. Thanks to Eric Melbardis for the patch. - -2005-10-21 Donal K. Fellows - - * doc/binary.n: Clarify that virtually all code that uses the 'h' - format in [binary scan] should be using the 'H' format instead. It is - nearly always a bug to use the other! - -2005-10-20 Miguel Sofer - - * generic/tclListObj.c (TclLsetFlat): - * tests/lset.test (lset-10.3): fixed handling of unshared lists with - shared sublists, [Bug 1333036] reported by neuronstorm. - -2005-10-19 Donal K. Fellows - - * generic/tclIORChan.c (PassReceivedError,PassReceivedErrorInterp): - Fix crash caused by passing -1 as the length to TclNewStringObj(). Only - Tcl_NewStringObj (the function call, not the macro) handles that sort - of thing correctly. This makes ioCmd.test pass again. - -2005-10-19 Don Porter - - * generic/tclClock.c: Removed some dead code. - * generic/tclCmdIL.c: - * generic/tclCompCmds.c: - * generic/tclDictObj.c: - * generic/tclExecute.c: - * generic/tclLiteral.c: - * generic/tclParseExpr.c: - * generic/tclScan.c: - * generic/tclUtil.c: - * generic/tclVar.c: - -2005-10-19 Donal K. Fellows - - * generic/tclIORChan.c: General cleanup, removing checks that are - unnecessary due to the general contracts of other functions in the - core, converting to using ANSI declarations, etc. Note that nearly the - whole file has changed, but it is often just cosmetic. - -2005-10-19 Miguel Sofer - - * generic/tclExecute.c (INST_DICT_APPEND, INST_DICT_LAPPEND): fixed - faulty peephole optimisation that can cause crashes, [Bug 1331475] - reported by Aric Bills. - -2005-10-18 Don Porter - - * generic/tclExecute.c: Added optimization for I32L64 systems to avoid - using bignums to perform int multiplies. The improvement shows up most - dramatically in tclbench's matrix.bench. - -2005-10-15 Don Porter - - * generic/tclExecute.c: Restored some optimizations of the - INST_INCR_SCALAR1_IMM opcode. - -2005-10-14 Zoran Vasiljevic - - * generic/tclIO.c (Tcl_ClearChannelHandlers): removed change dated - 2005-10-04 (see below). Look into [Bug 1323992] for detailed - discussion. - - * generic/tcl.h: Fixed bad definition of CRTEXPORT which should have - been CRTIMPORT rather. This broke compilation of generic/tclMain.c and - was probably introduced by mistake while applying the fix for [Bug - 1256937] below. - -2005-10-14 Kevin Kenny - - * generic/tclExecute.c (TclIncrObj, TclExecuteByteCode): Tidied up a - couple of infelicitous do {...} while(0) constructs. - -2005-10-14 Pat Thoyts - - * generic/tcl.h: Fix for [Bug 1256937] - correctly decorate - * generic/tclMain.c: imported functions from msvcrt in static builds. - -2005-10-13 Donal K. Fellows - - * tests/format.test: "Forward"-port of test updates relating to [Bug - 1284178]. The bug itself was fixed by TIP#237. - -2005-10-13 Zoran Vasiljevic - - * generic/tclIO.c (Tcl_ClearChannelHandlers): temporary ifdef - TCL_THREADS changes done to de-activate pending event processing when - channel is being closed/cutted. - -2005-10-13 Don Porter - - * generic/tclExecute.c: Removed obsolete use of NO_ERRNO_H. - * tools/man2tcl.c: - * unix/tcl.m4: - * unix/tclConfig.h.in: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - - * compat/tclErrno.h: Removed obsolete file. - - * generic/tclStrToD.c (TclParseNumber): Missing goto caused crash when - parsing "Na". [Bug 1325833] - -2005-10-12 Don Porter - - * generic/tclExecute.c (GetNumberFromObj): Restored some lost - optimizations for empty string values. We avoid cost of a call to - TclParseNumber just to tell us an empty string isn't a number. - -2005-10-12 Donal K. Fellows - - * generic/tclPathObj.c (SetFsPathFromAny): TclGetString macro must not - be combined with post-increment arguments. [Bug 1325099] - -2005-10-12 Kevin Kenny - - * generic/tclExecute.c (Tcl_ExecuteByteCode, TclIncrObj): Several - common cases inlined in hopes of gaining a little performance in [incr] - -2005-10-10 Miguel Sofer - - * generic/tclCompCmds.c: New convenience macro CompileTokens(). - -2005-10-10 Don Porter - - * generic/tclExecute.c: Corrections to the NO_WIDE_TYPE build. Also - added missing "break" to a switch that broke wide XOR operations. - -2005-10-10 Donal K. Fellows - - * generic/tclInterp.c (DeleteScriptLimitCallback) - (SetScriptLimitCallback): Improve the interlocking between the script - limit callback record and the hash table of current such records, to - prevent crashes in callbacks that create callbacks. - (Tcl_LimitSetTime): Reset the correct flag. Problem reported by - Nicolas Castagne on comp.lang.tcl - -2005-10-10 Miguel Sofer - - * generic/tclExecute.c: Fixing errors in last commit. (Two commits, the - second removes wrong comment). - -2005-10-09 Miguel Sofer - - * generic/tclBasic.c: - * generic/tclExecute.c: - * generic/tclStrToD.c: - * generic/tclStringObj.c: Initialise variables to avoid compiler - warnings ([Bug 1320818] among others). - -2005-10-08 Don Porter - - TIP#237 IMPLEMENTATION - - [kennykb-numerics-branch] Resynchronized with the HEAD; at this - checkpoint [-rkennykb-numerics-branch-20051008], the HEAD and - kennykb-numerics-branch contain identical code. - - [kennykb-numerics-branch] Merge updates from HEAD - - * generic/tclExecute.c: More performance macros and special handling of - the wide integer type for performance on 32-bit systems. - -2005-10-07 Don Porter - - [kennykb-numerics-branch] - - * generic/tclExecute.c: Macro GetNumberFromObj() is version of - TclGetNumberFromObj() that saves a function call for common uses. - - * generic/tclInt.h: Made #undef NO_WIDE_TYPE the default on 32-bit - systems. Being able to use 64-bit values without leaping to mp_int - should help with performance. - - * generic/tclObj.c: Bug fixes in the #undef NO_WIDE_TYPE - * generic/tclExecute.c: configuration. - - * generic/tclExecute.c: Improved performance of comparison opcodes and - bitwise operations and removed yet more dead code. - -2005-10-07 Jeff Hobbs - - * unix/tclUnixFCmd.c (TraverseUnixTree): Adjust 2004-11-11 change to - * tests/fCmd.test (fCmd-20.2): account for NFS special files - with a readdir rewind threshold. [Bug 1034337] - -2005-10-06 Don Porter - - [kennykb-numerics-branch] - - * generic/tclExecute.c: Improved performance of INST_RSHIFT and - INST_LSHIFT. - -2005-10-05 Don Porter - - [kennykb-numerics-branch] - - * generic/tclExecute.c: Improved performance of INST_MULT, INST_DIV, - INST_ADD, and INST_SUB and replaced a "goto... label" with a "break - from loop" in TclIncrObj() and removed some dead code. - -2005-10-05 Andreas Kupries - - * generic/tclPipe.c (TclCreatePipeline): Fixed [Bug 1109294]. Applied - the patch provided by David Gravereaux. - - * doc/CrtChannel.3: Fixed [Bug 1104682], by application of David - Welton's patch for it, and added a note about wideSeekProc. - - * generic/tclIORChan.c (RcClose): Removed unreachable panic/return - statements. This fixes the remainder of [Bug 1286256]. - -2005-10-05 Jeff Hobbs - - * tests/env.test (env-6.1): - * win/tclWinPort.h: define USE_PUTENV_FOR_UNSET 1 - * generic/tclEnv.c (TclSetEnv, TclUnsetEnv): add USE_PUTENV_FOR_UNSET - to existing USE_PUTENV define to account for various systems that have - putenv(), but can't unset env vars with it. Note difference between - Windows and Linux for actually unsetting the env var (use of '='). - Correct the resizing of the environ array. We assume that we are in - full ownership, but that's not correct.[Bug 979640] - -2005-10-04 Don Porter - - [kennykb-numerics-branch] - * generic/tclExecute.c: Updated TclIncrObj() to more efficiently add - native long integers. Also updated IllegalExprOperandType and the - INST_UMINUS, INST_UPLUS, INST_BITNOT, and INST_TRY_CVT_TO_NUMERIC - sections for performance. - - * generic/tclBasic.c: Updated more callers to make use of - TclGetNumberFromObj. Removed some dead code. - -2005-10-04 Jeff Hobbs - - * win/tclWinSerial.c (SerialSetOptionProc): free argv [Bug 1067708] - - * tests/http.test: do not URI encode -._~ according - * library/http/http.tcl (init): to RFC3986. [Bug 1182373] (aho) - - * unix/tclLoadShl.c (TclpDlopen): use DYNAMIC_PATH on second shl_load - only. [Bug 1204237] - - * doc/scan.n: scan %[] requires "one or more chars" [Bug 1277503] - - * tests/winFile.test (getuser): allow valid Windows usernames. [Bug - 1311285] - - * generic/tclParse.c (Tcl_ParseCommand): add code that recognizes {} in - addition to {expand} for word expansion (make with - -DALLOW_EMPTY_EXPAND). - -2005-10-04 Zoran Vasiljevic - - * generic/tclIO.c (Tcl_ClearChannelHandlers): now deletes any - outstanding timer for the channel. Also, prevents events still in the - event queue from triggering on the current channel. - - * generic/tclTimer.c (Tcl_DeleteTimerHandler): bail out early if passed - NULL argument. - -2005-10-03 Don Porter - - [kennykb-numerics-branch] - - * generic/tclBasic.c: Re-implemented ExprRoundFunc and - ExprEntierFunc to use TclGetNumberFromObj. - - * generic/tclInt.h: Added new routine TclGetNumberFromObj to - * generic/tclObj.c: provide efficient access to the actual - internal rep of a numeric Tcl_Obj without conversions. - -2005-10-03 Kevin Kenny - - * tools/loadICU.tcl: Changed the file names of message catalogs to - lowercase. - * tools/makeTestCases.tcl: - * library/tzdata/*: Olson's tzdata2005n.tar.gz. Includes new DST - rules for USA and a number of changes to other locales. - * tests/clock.test: Regenerated for new US DST rules. - -2005-09-30 Don Porter - - * generic/tclMain.c: Separate encoding conversion of command line - arguments from list formatting. [Bug 1306162]. - -2005-09-30 Don Porter - - [kennykb-numerics-branch] - - * generic/tclStringObj.c: Bug fix: Missing cast to large enough - integral size before << operations led to broken [format %llx] results. - Thanks to Robert Henry for reporting the bug. - -2005-09-29 Jeff Hobbs - - * doc/mathfunc.n: implementation for TIP #255, expr min/max - * library/init.tcl: - * tests/info.test, tests/expr-old.test: - -2005-09-27 Don Porter - - [kennykb-numerics-branch] - - * generic/tcl.h: Changed name of the new Tcl_Obj intrep field - * generic/tclObj.c: from "bignumValue" to "ptrAndLongRep" as - * generic/tclProc.c: described in TIP 237, and more suitable for - other more general uses. - -2005-09-27 Donal K. Fellows - - * tests/binary.test (binary-14.18): Added test for [Bug 1116542] though - the bug itself was already fixed by unrelated changes. - -2005-09-26 Kevin Kenny - - [kennykb-numerics-branch] Merge updates from HEAD. - -2005-09-26 Kevin Kenny - - * libtommath/: Updated to release 0.36. - * generic/tommath.h: Regenerated. - * generic/tclTomMathInterface.h: Added ten missing aliases for mp_* - functions to avoid namespace pollution in Tcl's exported symbols. [Bug - 1263012] - -2005-09-23 Don Porter - - [kennykb-numerics-branch] - - * unix/Makefile.in: Added -DMP_PREC=4 switch to all compiles so - * win/Makefile.in: that minimum memory requirements of mp_int's - * win/makefile.vc: will not be quite so large. [Bug 1299153]. - - * generic/tclStrToD.c: Fixed memory leak. [Bug 1299803]. - * generic/tclObj.c: - -2005-09-20 Don Porter - - [kennykb-numerics-branch] - - * generic/tclExecute.c: Revise TclIncrObj() to call - Tcl_GetBignumAndClearObj. - - * generic/tcl.decls: Add Tcl_GetBignumAndClearObj. - * generic/tclObj.c: - - * generic/tclDecls.h: make genstubs - * generic/tclStubInit.c: - -2005-09-16 Don Porter - - [kennykb-numerics-branch] - - * generic/tclInt.h: Added TclBNInitBigNumFromWideInt() so - * generic/tclTomMathInterface.c: that every caller isn't required to - duplicate the sign logic to use the unsigned interface. - - * generic/tclBasic.c: Reduce the number of places where Tcl intrudes - * generic/tclExecute.c: into the internal format details of the mp_int - * generic/tclObj.c: struct. - * generic/tclStrToD.c: - * generic/tcLStringObj.c: - - * generic/tclTomMath.h: Added mp_cmp_d to routines from libtommath - * unix/Makefile.in: used by Tcl. - * win/Makefile.in: - * win/makefile.vc: - - * libtommath/bn_mp_add_d.c: Bug fix. For mp_add_d(&a, d, &c), when &a - has the value -d, then the value &c computed should be zero, but - mp_add_d was producing an inconsistent zero value with a sign field of - MP_NEG, something like a value of -0, which other routines in - libtommath can't handle. - - * generic/tclExecute.c: Dropped all creation of "bigOne" values and - just use tommath routines that accept the value "1" directly. - -2005-09-15 Miguel Sofer - - * doc/ParseCmd.3: copy/paste fix [Bug 1292427] - -2005-09-15 Don Porter - - [kennykb-numerics-branch] Merge updates from HEAD. - - * generic/tclStringObj.c (TclAppendFormattedObjs): Revision to - eliminate one round of string copying. - - * generic/tclBasic.c: More callers of TclObjPrintf and - * generic/tclCkalloc.c: TclFormatToErrorInfo. - * generic/tclCmdMZ.c: - * generic/tclExecute.c: - * generic/tclIORChan.c: - * generic/tclMain.c: - * generic/tclProc.c: - * generic/tclTimer.c: - * generic/tclUtil.c: - * unix/tclUnixFCmd.c - - * unix/configure: autoconf-2.59 - -2005-09-15 Donal K. Fellows - - * unix/tcl.m4 (SC_TCL_EARLY_FLAGS): Added extra hack to allow Tcl to - transparently open large files on RHEL 3. [Bug 1287638] - -2005-09-14 Don Porter - - * generic/tclStringObj.c: Bug fixes: ObjPrintfVA needed to - support "*" fields and needed to interpret precision limits on %s - conversions as a maximum number of bytes, not Tcl_UniChars, to take - from the (char *) argument. - - * generic/tclBasic.c: Updated several callers to use - * generic/tclCkalloc.c: TclFormatToErrorInfo() and/or - * generic/tclCmdAH.c: TclObjPrintf(). - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclDictObj.c: - * generic/tclExecute.c: - * generic/tclIORChan.c: - * generic/tclIOUtil.c: - * generic/tclNamesp.c: - * generic/tclProc.c: - - * library/init.tcl: Keep [unknown] in sync with errorInfo - formatting rules. - -2005-09-13 Don Porter - - * generic/tclBasic.c: First caller of TclFormatToErrorInfo. - - * generic/tclInt.h: Using stdarg.h conventions, add more - * generic/tclStringObj.c: fixed arguments to TclFormatObj() and - TclObjPrintf(). Added new routine TclFormatToErrorInfo(). - - * generic/tcl.h: Explicitly standardized on the use of stdarg.h - * generic/tclBasic.c: conventions for functions with variable number - * generic/tclInt.h: of arguments. Support for varargs.h has been - * generic/tclPanic.c: implicitly gone for some time now. All - * generic/tclResult.c: TCL_VARARGS* macros purged from Tcl sources, - * generic/tclStringObj.c: leaving only some deprecated #define's - * tools/genStubs.tcl: in tcl.h for the sake of older extensions. - - * generic/tclDecls.h: make genstubs - - * doc/AddErrInfo.3: Replaced all documented requirement for use of - * doc/Eval.3: TCL_VARARGS_START() with requirement for use of - * doc/Panic.3: va_start(). - * doc/SetResult.3: - * doc/StringObj.3: - -2005-09-12 Don Porter - - [kennykb-numerics-branch] Merge updates from HEAD. - - * generic/tclCmdAH.c: Added support for the "ll" width - * generic/tclStringObj.c: specifier to [format]. - - * generic/tclStringObj.c (TclAppendFormattedObjs): Bug fix: make - sure %ld formats force the collection of a wide value, when the value - could be a different long. - -2005-09-09 Andreas Kupries - - * generic/tclIORChan.c (RcDecodeEventMask): Added missing type - declaration for the parameter 'mask'. This fixes the [Bug 1286256]. The - other warning can be removed only by removing the panic/return code. - -2005-09-09 Don Porter - - [kennykb-numerics-branch] Merge updates from HEAD. - -2005-09-09 Kevin Kenny - - * generic/tclStringObj.c: Added two missing casts to silence messages - from MSVC6. - -2005-09-09 Don Porter - - * generic/tclInt.h: New internal routine TclObjPrintf() - * generic/tclStringObj.c: is similar to TclFormatObj() but - accepts arguments in non-Tcl_Obj format. - - * generic/tclInt.h: New internal routines TclFormatObj() - * generic/tclStringObj.c: and TclAppendFormattedObjs() to offer - sprintf()-like means to append to Tcl_Obj. Work in progress toward - [RFE 572392]. - - * generic/tclCmdAH.c: Compiler directive NEW_FORMAT when #define'd - directs the [format] command to be implemented in terms of the new - TclAppendFormattedObjs() routine. - -2005-09-08 Donal K. Fellows - - TIP#254 IMPLEMENTATION - - * generic/tclLink.c (LinkTraceProc,ObjValue): Added many new of C var - * generic/tcl.h: to link to, making it - * doc/LinkVar.3: easier to seamlessly - * generic/tclTest.c (TestlinkCmd): couple C code and Tcl - * tests/link.test: scripts in an - application. [Patch 1242844] - -2005-09-07 Don Porter - - * generic/tclUtf.c (Tcl_UniCharToUtf): Corrected handling of negative - * tests/utf.test (utf-1.5): Tcl_UniChar input value. Incorrect - handling was producing byte sequences outside of Tcl's legal internal - encoding. [Bug 1283976]. - -2005-09-06 Donal K. Fellows - - * generic/tclInt.h (List): Added flag to keep track of whether a list - * generic/tclListObj.c: with a string rep is provably canonical. - * generic/tclUtil.c (Tcl_ConcatObj): Do efficient concatenation and - * generic/tclBasic.c (Tcl_EvalObjEx): evaluation when the list is - canonical, and not just when the list is pure. This should make the - "pure list" hacking introduced in 8.3 much more robust. - -2005-09-05 Donal K. Fellows - - * generic/tclObj.c (pendingObjDataKey): Added missing 'static' to stop - symbol from leaking outside the Tcl library. [Bug 1263012] - -2005-09-02 Don Porter - - [kennykb-numerics-branch] - - * generic/tclScan.c: Bug fix: The %o, %x, %i formats of [scan] must - not accept any 0b or 0o prefixes. [scan $s %o] must continue to work - even with KILL_OCTAL enabled. - - * generic/tclInt.h: Added TCL_PARSE_SCAN_PREFIXES to the flags - * generic/tclStrToD.c: accepted by TclParseNumber. - -2005-09-01 Andreas Kupries - - * unix/tclUnixSock.c (InitializeHostName): Synchronized use of static - modifier in declaration and definition of function. - - * unix/tclUnixChan.c (FileTruncateProc): Synchronized use of static - modifier in declaration and definition of function. - - * generic/tclResult.c (ReleaseKeys): Synchronized use of static - modifier in declaration and definition of function. - - * generic/tclListObj.c (NewListIntRep): Synchronized use of static - modifier in declaration and definition of function. - - * generic/tclEncoding.c (InitializeEncodingSearchPath): Synchronized - use of static modifier in declaration and definition of function. - - * generic/tclEncoding.c (FillEncodingFileMap): Synchronized use of - static modifier in declaration and definition of function. - - * generic/tclIORChan.c (RcNewHandle): Synchronized use of static - modifier in declaration and definition of function. - -2005-09-01 Don Porter - - [kennykb-numerics-branch] - - * generic/tclObj.c: TclParseNumber calls meant to parse an integer - value now pass the TCL_PARSE_INTEGER_ONLY flag. - - * generic/tclScan.c: Extended [scan] to accept the %lld, %llo, %llx, - and %lli formats. Numeric scanning is now done via TclParseNumber calls - - * generic/tclInt.h: Extended TclParseNumber to accept new flag - * generic/tclStrToD.c: values TCL_PARSE_INTEGER_ONLY, - TCL_PARSE_OCTAL_ONLY, and TCL_PARSE_HEXIDECIMAL_ONLY, to give caller - more control over the parsing rules. - -2005-08-31 Vince Darley - - * doc/FileSystem.3: - * unix/tclUnixFile.c: - * windows/tclWinFile.c: clarify that Tcl_FSMatchInDirectory may be - called with a NULL interpreter, and fix the code so this is allowed. - Tcl's core itself (tclEncoding.c:FillEncodingFileMap()) calls this - with a NULL interpreter. - -2005-08-30 Don Porter - - [kennykb-numerics-branch] - - * generic/tclObj.c: Extended bignum support to include bignums so - large they will not pack into a Tcl_Obj. When they outgrow Tcl's string - rep length limits, a panic will result. - - * generic/tclTomMath.h: Added mp_sqrt to routines from - * unix/Makefile.in: libtommath used by Tcl. - * win/Makefile.in: - * win/makefile.vc: - - * generic/tclBasic.c: Extended sqrt(.) so that range covers the - entire double range, accepting as many bignums in the domain as that - will allow. - -2005-08-29 Andreas Kupries - - * library/tm.tcl (::tcl::tm::roots): Accepted Don Porter's patch for - [Bug 1189657]. Syncs the implementation to the specification (TIP #189) - -2005-08-29 Don Porter - - [kennykb-numerics-branch] Merge updates from HEAD. - - * generic/tclBasic.c: Restored round(.) to the Tcl 8.4 rules. - -2005-08-29 Kevin Kenny - - * generic/tclBasic.c (ExprMathFunc): Restored "round away from zero" - * tests/expr.test (expr-46.*): behaviour to the "round" function. - Added test cases for the behavior, including the awkward case of a - number whose fractional part is 1/2-1/2ulp. [Bug 1275043] - -2005-08-26 Andreas Kupries - - * generic/tclIO.c: Moved Tcl_{Cut,Splice}Channel to - {Cut,Splice}Channel for internal use, and created new public functions - for Tcl_{Cut,Splice}Channel which walk the whole stack of - transformations and invoke the necessary thread actions. Added code to - Tcl_(Un)StackChannel to properly invoke the thread actions when pushing - and popping transformations on/from a channel. - -2005-08-26 Donal K. Fellows - - * generic/tclNamesp.c (NamespaceEnsembleCmd): Reset the result after - creating an ensemble to clear any result object sharing (potentially - caused by delete traces) so that we can safely return the name of the - ensemble. Previously, this caused crashes in Snit's test suite. - -2005-08-25 Donal K. Fellows - - * generic/tclListObj.c (UpdateStringOfList): Stop uncontrolled and - unsafe crashes from happening when working with very large string - representations. [Bug 1267380] - - * generic/tclExecute.c (TEBC:INST_DICT_LAPPEND): Stop dropping a - duplicated object on the floor, which was a memory leak (and a wrong - result too). Thanks to Andreas Kupries for reporting this. - -2005-08-25 Don Porter - - [kennykb-numerics-branch] Merge updates from HEAD - - * generic/tclExecute.c: Bug fix. INST_RSHIFT: shift of negative values - produced incorrect results. - - * generic/tclExecute.c: Bug fix. INST_*SHIFT opcodes stack management. - [expr 0<<6] should be 0, not 6. - - * generic/tclBasic.c: Extended the domain of round(.) to all non-Inf, - non-NaN doubles, using bignums for the result as needed. - -2005-08-24 Andreas Kupries - - TIP#219 IMPLEMENTATION - - * doc/SetChanErr.3: ** New File **. Documentation of the new channel - API functions. - * generic/tcl.decls: Stub declarations of the new channel API. - * generic/tclDecls.h: Regenerated - * generic/tclStubInit.c: - - * tclIORChan.c: ** New File **. Implementation of the reflected - channel. - * generic/tclInt.h: Integration of reflected channel and new error - * generic/tclIO.c: propagation into the generic I/O core. - * generic/tclIOCmd.c: - * generic/tclIO.h: - * library/init.tcl: - - * tests/io.test: Extended testsuite. - * tests/ioCmd.test: - * tests/chan.test: - * generic/tclTest.c: - * generic/tclThreadTest.c: - - * unix/Makefile.in: Integration into the build machinery. - * win/Makefile.in: - * win/Makefile.vc: - -2005-08-24 Kevin Kenny - - * generic/tclStrToD.c (Tcl_DoubleDigits): Fixed the corner cases of - * tests/binary.test (binary-65.*) formatting floating point - numbers with the largest and smallest possible significands, and added - test cases for them. - -2005-08-24 Kevin Kenny - - [kennykb-numerics-branch] - - * generic/tclExecute.c: Corrected some TRACE bugs that prevented - compilation with --enable-symbols=all. - * generic/tclStrToD.c: Revised commentary to prepare for a renaming of - the file, removed some dead code, and fixed a bug where - TclBignumToDouble failed on huge negative numbers. - * tests/binary.test (binary-65.*): Added missing 'ieeeFloatingPoint' - to large/small significand tests. - * tests/expr.test (expr-45.*) Added missing braces around expressions. - -2005-08-24 Don Porter - - [kennykb-numerics-branch] - - * generic/tclBasic.c: Revised implementation of the ceil(.) and - * generic/tclInt.h: floor(.) math functions in light of the - * generic/tclStrToD.c: revised comparison operators, so that it is - always true that ($x <= ceil($x)) and ($x >= floor($x)). The simple - approach of "convert to double and call ceil() or floor()" could not - guarantee that. - - * generic/tclExecute.c: Bug fix: TclBignumToDouble return -Inf when - appropriate. Removed declarations of removed routines. - - * generic/tclExecute.c: Revised the type promotion rules of the - comparison operators so that they form proper equivalence classes over - the set of numeric strings. - -2005-08-23 Mo DeJong - - * unix/configure.in: - * win/configure: Regen. - * win/configure.in: Update minimum autoconf version to 2.59. - -2005-08-23 Kevin Kenny - - [kennykb-numerics-branch] - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): - * generic/tclInt.h: - * generic/tclObj.c (Tcl_GetBooleanFromObj, SetDoubleFromAny, - Tcl_GetLongFromObj, Tcl_GetWideIntFromObj, Tcl_GetBignumFromObj): - * generic/tclParseExpr.c (GetLexeme): - * generic/tclScan.c (Tcl_ScanObjCmd): - * generic/tclStrToD.c (TclParseNumber): - * tests/binary.test (binary-62.1-65.7): - * tests/expr.test (expr-40.1-42.1): - * scan.test (scan-14.1,14.2): - Modified Tcl_ParseNumber to accept an argument to force interpretation - as decimal, and modified [scan] to use it. Corrected a bug where Not a - Number with hexadecimal information bits returned consistently - incorrect values. #ifdef-ed out some code that is needed only for IBM - hexadecimal floating point. Fixed bugs in code to handle the corner - cases of smallest and largest significands. Added test cases to improve - test coverage in generic/tclStrToD.c. Added test cases for 0b notation - (TIP #114). Removed TclStrToD, and the static functions that it calls, - which are now dead code (TclParseNumber now does all input - floating-point conversions.) - -2005-08-23 Don Porter - - [kennykb-numerics-branch] - - * generic/tclStrToD.c: Bug fix: set shift magnitude properly whether - we're expanding to mp_int type or not. - - * generic/tclExecute.c: Bug fix: ACCEPT_NAN under INST_UMINUS. - - * generic/tclStrToD.c: New macros TIP_114_FORMATS and KILL_OCTAL to - configure acceptance of 0o and 0b numbers and rejection of "leading - zero as octal". - - * generic/tclBasic.c: Re-used the guts of int(.) and wide(.) math - functions to perform conversions in OldMathFuncProc. - - * generic/tclBasic.c: Support for ACCEPT_NAN. - * generic/tclExecute.c: - - * generic/tclInt.decls: Restored TclExprFloatError to internal stubs - * generic/tclBasic.c: table, and moved definition back to - * generic/tclExecute.c: tclExecute.c from tclBasic.c to handle #undef - ACCEPT_NAN. - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclInt.h: New internal macros TclIsNaN and TclIsInfinite - * generic/tclBasic.c: replace the IS_NAN and IS_INF macros scattered - * generic/tclExecute.c: here and there. - * generic/tclObj.c: - * generic/tclStrToD.c: - * generic/tclUtil.c: - -2005-08-22 Daniel Steffen - - * unix/tclConfig.h.in: autoheader-2.59. - -2005-08-22 Don Porter - - [kennykb-numerics-branch] - - * generic/tclInt.h: New ACCEPT_NAN macro to mark code that - * generic/tclCmdAH.c: supports or disables accepting of the NaN - * generic/tclExecute.c: value at various points. - * generic/tclLink.c: - - * generic/tclStrToD.c: Bug fix. Parsing of +/- Infinity was reversed. - - * generic/tclTestObj.c: Disabled unused [testconvertobj] command. - - * generic/tclBasic: Added [expr {entier(.)}]. Rewrote int(.) and - wide(.) to use the same guts, accepting all non-Inf doubles as - arguments. - - * generic/tclInt.h: New routine TclInitBignumFromDouble. - * generic/tclStrToD.c: Modified to return code and write error - message. - - * generic/tclInt.h: TCL_WIDE_INT_IS_LONG implies NO_WIDE_TYPE. - * generic/tclObj.c: Removed now unnecessary tests of the - * generic/tclStrToD.c: TCL_WIDE_INT_IS_LONG definition. - - * generic/tclInt.h: New internal routine TclSetBignumIntRep - * generic/tclObj.c: consolidates packing of bignum value into a - * generic/tclStrToD.c: Tcl_Obj within one source code file. - - * tests/expr.test: Corrected the wideIs64bit constraint. - * tests/format.test: - * tests/scan.test: - -2005-08-21 Don Porter - - [kennykb-numerics-branch] - - * generic/tclInt.h: Moved TclParseInteger to tclUtil.c and - * generic/tclParseExpr.c: made it static. - * generic/tclUtil.c: - - * generic/tclInt.decls: Moved TclExprFloatError to tclBasic.c and made - * generic/tclBasic.c: it static. - * generic/tclExecute.c: - - * generitc/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclExecute.c: errno, IS_NAN, IS_INF, LLD no longer called in - this file; dropped/disabled support for them. - - * generic/tclCompExpr.c: errno no longer used in these files; - * generic/tclParseExpr.c: dropped support "hack" for it. - - * generic/tclStrToD.c: Disabled out of date support "hack" for errno. - - * generic/tclBasic.c: Eliminated VerifyExprObjType. Initialize errno - to zero in OldMathFuncProc. - -2005-08-19 Don Porter - - [kennykb-numerics-branch] - - * generic/tclBasic.c: Updated OldMathFuncProc and ExprAbsFunc to do - less invasion into numeric Tcl_Obj internals. Made ExprDoubleFunc, - ExprIntFunc, ExprWideFunc, and ExprRoundFunc bignum-aware. Revised - ExprSrandFunc error message. - - * generic/tclProc.c: Wrapped a few tclWideIntType uses in - * generic/tclCmdMZ.c: #ifndef NO_WIDE_TYPE. - - * generic/tclInt.h: #define'd NO_WIDE_TYPE. - - * generic/tclVar.c: Replaced TclPtrIncrVar and TclPtrIncrWideVar - * generic/tclInt.h: with TclPtrIncrObjVar and replaced TclIncrVar2 - * generic/tclInt.decls: and TclIncrWideVar2 with TclIncrObjVar2. New - routines call on TclIncrObj to do the work. - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclCmdIL.c: Rework Tcl_IncrObjCmd and the INST_*INCR* - * generic/tclExecute.c: opcodes to use the new routines. - -2005-08-18 Don Porter - - [kennykb-numerics-branch] - - * generic/tclExecute.c: Fixed string rep invalidation bug in - * tests/dict.test (dict-11.17): INST_DICT_INCR_IMM rewrite. - - * generic/tclDictObj.c: DictIncrCmd rewrite to use TclIncrObj. - - * generic/tclInt.h: TclIncrObj static -> internal - * generic/tclExecute.c: - -2005-08-17 George Peter Staplin - - * generic/tclBasic.c: eliminate a namespace clash caused by - BuiltinFuncTable not being static. - - * generic/tclObj.c: fix a namespace clash caused by a missing - static for pendingObjData. - -2005-08-17 Kevin Kenny - - * generic/tclEvent.c (Tcl_Finalize): Removed a copy-and-paste accident - that caused a (mostly harmless) double finalize of the load and - filesystem subsystems. - * tests/clock.test: Eliminated the bad test clock-43.1, and split - clock-50.1 into two tests, with a more permissive check on the error - message for an out-of-range value. - -2005-08-17 Kevin Kenny - - [kennykb-numerics-branch] - - * generic/tclBasic.c (Tcl_Expr{Long,Double}{,Obj}): Updated to - * generic/tclTest.c: deal with - * tests/expr-old.test: bignums (well, - * tests/expr.test: mostly). - Added a missing "errno=0;" in ExprUnaryFunc so that spurious error - returns aren't detected. - Added test cases for Tcl_Expr* and Tcl_Expr*Obj because there was very - poor test coverage in those areas. - * generic/tclParseExpr.c: Reworked parsing of numbers to call - TclParseNumber rather than trying to do things locally. - * generic/tclStrToD.c: Corrected a comment. Changed so that *endPtrPtr - does not include any trailing whitespace. - -2005-08-17 Don Porter - - [kennykb-numerics-branch] - - * generic/tclExecute.c: New routine TclIncrObj to centralize the - increment operation needed in many places. Updated INST_DICT_INCR_IMM - to make use of it. - -2005-08-16 Don Porter - - [kennykb-numerics-branch] - - * generic/tclExecute.c: Made bit shifting opcodes and INST_MOD - bignum-aware. - - * tests/scan.test: Making << bignum-aware means that repeated - * tests/string.test: left shifting cannot turn a positive into a - negative. Revised [int_range] and [largest_int] utility commands in the - test suite that relied on that happening. Without revision they became - infinite loops. - - * generic/tclExecute.c: Made binary bitwise opcodes bignum-aware. - - * generic/tclTomMath.h: Added mp_or and mp_xor to routines from - * unix/Makefile.in: libtommath used by Tcl. - * win/Makefile.in: - * win/makefile.vc: - -2005-08-15 Don Porter - - [kennykb-numerics-branch] Updates from HEAD. - * generic/tclExecute.c: More revisions to IllegalExprOperandType. - Merged INST_BITNOT with INST_UMINUS and make it bignum-aware according - to the rule: ~a = -a - 1. Disabled unused code and noted more TODOs. - - * generic/tclInt.decls: Disabled TclLooksLikeInt() and all callers. - * generic/tclUtil.c: - * generic/tclCompCmds.c: - - * generic/tclBasic.c: Rewrite of VerifyExprObjType(). - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclExecute.c: Updated execution of comparison bytecodes to - be bignum-aware, routing string compares through INST_STR_CMP. - -2005-08-14 Don Porter - - [kennykb-numerics-branch] - - * generic/tclExecute.c: Updated execution of arithmetic bytecodes to - be bignum-aware, and to allow calculations on NaN to produce a NaN - result. INST_UMINUS updated to call mp_neg. - - * generic/tclTomMath.h: Added mp_and, mp_expt_d, and mp_neg to - * unix/Makefile.in: routines from libtommath used by Tcl. - * win/Makefile.in: - * win/makefile.vc: - -2005-08-13 Don Porter - - [kennykb-numerics-branch] - - * generic/tclObj.c: Extended Bignum auto-narrowing to auto-narrow - to tclWideIntType when appropriate; this helps keep things working as - the bytecode execution code is migrated to supporting bignums. - - * generic/tclExecute.c: Major overhaul of IllegalExprOperandType. - Changed several TclNewFooObj() calls to more logically appropriate - ones. Added several TODO comments marking opportunies for future work. - Made more use of the eePtr->constants. Made INST_UMINUS bignum aware. - -2005-08-12 Don Porter - - [kennykb-numerics-branch] - - * generic/tclExecute.c: Simplify doCondJump. Use eePtr->constants as - result of INST_DICT_NEXT, INST_LAND, and INST_LOR. Separate INST_LNOT - from INST_UMINUS and simplify. - -2005-08-12 Kevin Kenny - - * generic/tclClock.c (MktimeObjCmd): - * library/clock.tcl (GetSystemTimeZone, LoadZoneinfoFile) - (ReadZoneinfoFile): - * tests/clock.test (clock-50.1): - Added functionality to read /etc/localtime if it exists, so that Tcl's - time can track system time on Linux even if TZ is not set. Changed - ::tcl::clock::Mktime to check for failure, and added a test case that - mimics failure but is really success. - -2005-08-11 Don Porter - - [kennykb-numerics-branch] - - * generic/tclExecute.c: Rewrite of INST_LAND/INST_LOR to take advantage - of loss of "pure double" issues. Merged INST_UPLUS with - INST_TRY_CVT_TO_NUMERIC and updated to use improved rules for impure - "double"s as well. - - * generic/tclStrToD.c: Restored conditional generation of - tclWideIntType values by TclParseNumber so that Tcl's not completely - broken while bignum calculation support is incomplete. The NO_WIDE_TYPE - macro can be used to disable this. - - * generic/tclBasic.c (ExprAbsFunc): First pass making [expr abs(.)] - bignum-aware. - -2005-08-11 Kevin Kenny - - * generic/tclEvent.c: Eliminated the USE_THREAD_STORAGE option - * generic/tclInt.h: (which is on in every build generated by - * generic/tclThread.c: by the standard configurator). - * generic/tclThreadStorage.c: Eliminated the code for thread specific - * unix/configure: data without USE_THREAD_STORAGE and - * unix/tcl.m4: radically refactored the code for - * unix/tclConfig.h.in: USE_THREAD_STORAGE so that it has fewer - * unix/tclUnixThrd.c: dependencies on the order of - * win/configure: finalization. (Also, made 'make - * win/Makefile.in: distclean' on Windows clean just a little - * win/rules.vc: bit cleaner.) - * win/tcl.m4: - * win/tclWinThrd.c: - -2005-08-10 Don Porter - - [kennykb-numerics-branch] - - * generic/tclTomMath.h: Added mp_shrink, mp_to_unsigned_bin, - * unix/Makefile.in: mp_to_unsigned_bin_n, and mp_unsigned_bin_size - * win/Makefile.in: to routines from libtommath used by Tcl. - * win/makefile.vc: - - * generic/tommath.h: make gentommath_h - - * generic/tclObj.c: Substantial rewrite to make all number parsing - flow through TclParseNumber(). Also established the NO_WIDE_TYPE and - BIGNUM_AUTO_NARROW #ifdef's to help track the assumptions of different - portions of the code. - - * generic/tclInt.h: Added NO_WIDE_TYPE #ifdefs - -2005-08-10 Kevin Kenny - - * generic/tclEvent.c (Tcl_Finalize): Pushed Tcl_FinalizeLoad and - Tcl_ResetFilesystem down after Tcl_FinalizeThreadAlloc because we can't - unload DLL's until after their TSD keys are finalized. (Note that we'll - still see aborts if an unloaded DLL has TSD - that still needs to be - fixed. - - * tests/compExpr-old.test (compExpr-3.8): Made tests conditional on - * tests/expr.test (expr-3.8): 'unix' because they get - stack overflows on Win32 threaded builds, - -2005-08-09 Vince Darley - - * generic/tclPathObj.c: fix to [file rootname] bug in optimized code - path reported on comp.lang.tcl. - -2005-08-08 Don Porter - - [kennykb-numerics-branch] - - * generic/tclObj.c: Replaced some goto's with loops and started - use of BIGNUM_AUTO_NARROW and NO_WIDE_TYPE. - -2005-08-06 Donal K. Fellows - - * generic/tclThreadStorage.c: Stop exposing the guts of the thread - storage system through the internal stubs table. Client code should - always use the standard API. - -2005-08-05 Don Porter - - [kennykb-numerics-branch] - * generic/tclObj.c: Rewrote Tcl_GetDoubleFromObj(). - -2005-08-05 Donal K. Fellows - - * unix/tclUnixInit.c (localeTable): Solaris uses a non-standard name - for the cp1251 charset. Thanks to Victor Wagner for reporting this. - [Bug 1252475] - -2005-08-05 Kevin Kenny - - * win/makefile.vc: Removed unused file ldAout.tcl. - * win/makefile.bc: [Bug 1244361] - - * tests/binary.test: Cleaned up testing for scanning of NaN. [Bug - 1246264] - - * generic/tclBasic.c (ExprAbsFunc): Added code to handle the corner - * tests/expr.test (expr-38.1): case of applying 'abs' to the - smallest 32-bit integer. [Bug 1241572] - -2005-08-04 Andreas Kupries - - * generic/tclIO.c (CloseChannel): Fixed comment nit, added apparently - missing word to complete a sentence. - - * generic/tclObj.c (Tcl_DbDecrRefCount): Fixed whitespace nit in panic - message. - -2005-08-04 Don Porter - - [kennykb-numerics-branch] Updated from HEAD - - * generic/tclObj.c: Rewrote Tcl_GetBooleanFromObj() and supporting - routines to make use of TclParseNumber. This reduces the potential - number of times a string value must be scanned. - - * generic/tclObj.c: Simplified routines that manage the typeTable. - Deleted the UpdateStringOfBoolean() routine, that can never be called. - -2005-08-03 Don Porter - - * generic/tclCompExpr.c: Untangled some dependencies in the - * generic/tclEvent.c: order of finalization routines. - * generic/tclInt.h: [Bug 1251399] - * generic/tclObj.c: - -2005-08-02 Don Porter - - [kennykb-numerics-branch] Updated from HEAD - -2005-07-30 Daniel Steffen - - * unix/tclLoadDyld.c (TclpDlopen, TclpLoadMemory): workarounds for - bugs/changes in behaviour in Mac OS X 10.4 Tiger. - -2005-07-29 Donal K. Fellows - - * generic/tclCmdIL.c (InfoGlobalsCmd): Even in high-speed mode, still - have to take care with non-existant variables. [Bug 1247135] - -2005-07-28 Mo DeJong - - * win/README: Update link to msys_mingw8.zip. - -2005-07-28 Don Porter - - * tests/compExpr-old.test: Still more conversion of "nonPortable" - * tests/error.test: tests into tests with constraints that - * tests/expr-old.test: describe the limits of their - * tests/expr.test: portability. Also more consolidation - * tests/fileName.test: of constraint synonyms. - * tests/format.test: wideis64bit, 64bitInts => wideIs64bit - * tests/get.test: wideIntegerUnparsed => wideIs32bit - * tests/load.test: wideIntExpressions => wideBiggerThanInt - * tests/obj.test: - * tests/parseExpr.test: Dropped "roundOffBug" constraint that - * tests/string.test: protected from buggy sprintf. - -2005-07-28 Donal K. Fellows - - * generic/tclPipe.c (TclCreatePipeline): Arrange for POSIX systems to - * unix/tclUnixPipe.c (TclpOpenFile): use the O_APPEND flag for - * tests/exec.test (exec-19.1): files opened in a pipeline - like ">>this". Note that Windows cannot support such access; there is - no equivalent flag on the handle that can be set at the kernel-call - level. The test is unix-specific in every way. [Bug 1245953] - -2005-07-27 Don Porter - - * generic/tclUtil.c: Converted the $::tcl_precision value to be kept - per-thread to prevent different threads from stomping on each others' - formatting prescriptions. - - ***POTENTIAL INCOMPATIBILITY*** Multi-threaded programs that set the - value of ::tcl_precision will now have to set it in each thread. - - * tests/expr.test: Consolidated equivalent constraints into - * tests/fileName.test: single definitions and (more precise) names: - * tests/get.test: longis32bit, 32bit, !intsAre64bit => longIs32bit - * tests/listObj.test: empty => emptyTest; winOnly => win - * tests/obj.test: intsAre64bit => longIs64bit - Also updated some "nonPortable" tests to use constraints that mark - precisely what about them isn't portable, so the tests can run where - they work. - - * library/init.tcl ([unknown]): Corrected return code handling in the - portions of [unknown] that expand incomplete commands during - interactive operations. [Bug 1214462]. - -2005-07-26 Mo DeJong - - * unix/configure: Regen. - * unix/configure.in: Check for a $prefix/share directory and add it the - the package if found. This will check for Tcl packages in - /usr/local/share when Tcl is configured with the default dist install. - [Patch 1231015] - -2005-07-26 Don Porter - - * generic/tclBasic.c (Tcl_CallWhenDeleted): Converted to use - per-thread counter, rather than a process global one that required - mutex protection. [RFE 1077194] - - * generic/tclNamesp.c (TclTeardownNamespace): Re-ordering so that - * tests/trace.test (trace-34.4): command delete traces fire - while the command still exists. [Bug 1047286] - -2005-07-24 Mo DeJong - - * unix/configure: Regen. - * unix/tcl.m4 (SC_PROG_TCLSH, SC_BUILD_TCLSH): - * win/configure: Regen. - * win/tcl.m4 (SC_PROG_TCLSH, SC_BUILD_TCLSH): Split confused search - for tclsh on PATH and build and install locations into two macros. - SC_PROG_TCLSH searches just the PATH. SC_BUILD_TCLSH determines the - name of the tclsh executable in the Tcl build directory. [Bug 1160114] - [Patch 1244153] - -2005-07-23 Don Porter - - * library/auto.tcl: Updates to the Tcl script library to make use - * library/history.tcl: of Tcl 8.4 features. Forward port of - * library/init.tcl: appropriate portions of [Patch 1237755]. - * library/package.tcl: - * library/safe.tcl: - * library/word.tcl: - -2005-07-23 Mo DeJong - - * tests/string.test: Add string is tests for functionality that was not - tested. - * win/README: Update msys + mingw URL. Remove old Cygwin + mingw info. - -2005-07-23 Miguel Sofer - - * generic/tclExecute.c (INST_DICT_*): stop 2 compiler warnings for - uninitialised variables. - -2005-07-23 Donal K. Fellows - - * generic/tclExecute.c (TEBC:INST_DICT_INCR_IMM): Fix the incrementor - to work correctly with wide values. - -2005-07-21 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileDictCmd): First run at a compiler - * generic/tclExecute.c (TclExecuteByteCode): for dictionaries. Also - added an instruction to support 'finally'-like clauses, exposed more of - the dict guts to the rest of the core, and defined a few tests to - exercise more obscure parts of the compiler's operation that were bugs - during development. - -2005-07-21 Kevin B. Kenny - - * library/ldAout.tcl (***REMOVED***): Removed support for ancient - * unix/configure: BSD's, IRIX 4, RISCos and - * unix/Makefile.in: Ultrix. Removed two files whose - * unix/tcl.m4: code is used only on those - * unix/tclLoadAout.c (***REMOVED***): antique platforms. - - ***POTENTIAL INCOMPATIBILITY*** if anyone actually uses those - platforms; it is to be noted though, that an error in the installer has - actually not caused a necessary file to be installed on those platforms - in several releases, and nobody's complained. - -2005-07-16 Kevin B. Kenny - - * generic/tclStrToD.c (RefineResult): Plugged a stupid memory leak in - RefineResult (called from Tcl_StrToD). [Tk Bug 1227781] - -2005-07-15 Kevin B. Kenny - - * generic/tclClock.c (TclClockLocaltimeObjCmd,ThreadSafeLocalTime): - * library/clock.tcl (GuessWindowsTimeZone, ClearCaches): - * tests/clock.test (clock-49.1, clock-49.2): - Handle correctly the case where localtime() returns NULL to report a - conversion error. Also handle the case where the Windows registry - contains timezone values that can be mapped to a tzdata file name but - the corresponding file does not exist or is corrupted, by falling back - on a Posix timezone string instead; this last case will avoid calls to - localtime() in starpacks on Windows. [Bug 1237907] - -2005-07-14 Donal K. Fellows - - * generic/tclCompile.c: Update to follow style guidelines. - (TclPrintInstruction): Reorganize to do better printing out of bytecode - with far fewer "special hacks" for particular opcodes. - * generic/tclCompile.h: Requires two new opcode types. - -2005-07-13 Don Porter - - * unix/tclUnixSock.c: Use a ProcessGlobalValue to store the value - * win/tclWinSock.c: returned by Tcl_GetHostName() ([info - hostname]). Also re-order initialization of the value on Windows to - favor GetComputerName() over gethostname() as a source of the - information. - -2005-07-12 Kevin Kenny - - [kennykb-numerics-branch] Updated from HEAD - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): - * generic/tclInt.h: - * generic/tclObj.c (Tcl_GetDoubleFromObj, SetDoubleFromAny) - (Tcl_GetIntFromObj, SetIntOrWideFromAny): - * generic/tclStrToD.c (TclParseNumber, etc.): - * tclTomMathInterface.c (TclBNInitBignumFromWideUInt): - * tests/obj.test (obj-1.1, obj-2.2, obj-3.1, obj-3.2): - - Initial attempt at an implementation of TIP #249, comprising a unified - parser and modifications to the Tcl_Get*FromObj routines to use it. - Further integration of the parser is necessary and planned. - -2005-07-12 Donal K. Fellows - - * doc/lsearch.n: Clarify documentation of -exact option; wording was - open to misinterpretation by non-English speakers. - -2005-07-11 Donal K. Fellows - - * generic/tclExecute.c: General style cleanup. - -2005-07-08 Mo DeJong - - * generic/tclExecute.c (TclExecuteByteCode): Reimplement long and wide - type integer division and modulus operations so that the smallest and - largest integer values are handled properly. The divide operation is - more efficient since it no longer does a modulus or negation and only - checks for a remainder when the quotient will be a negative number. - The modulus operation is now a bit more complex because of a number of - special cases dealing with the smallest and largest integers. - * tests/expr.test: Add test cases for division and modulus operations - on the smallest and largest integer values for 32 and 64 bit types. - [Patch 1230205] - -2005-07-06 Don Porter - - * generic/tclLink.c: Simplified LinkTraceProc [Bug 1208108]. - -2005-07-05 Don Porter - - * unix/Makefile.in: Purged use of TCLTESTARGS [RFE 1161550]. - - * generic/tclUtil.c: Converted TclFormatInt() into a macro. - * generic/tclInt.decls: [RFE 1194015] - * generic/tclInt.h: - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclNamesp.c: Allow for [namespace import] of a command - * tests/namespace.test: over a previous [namespace import] of itself - without throwing an error. [RFE 1230597] - -2005-07-04 Donal K. Fellows - - * generic/tclDictObj.c (DictForCmd, DictFilterCmd): Interlocking of - dictionary internal representations is now done in the core of the dict - iterator. Purge the last attempts at doing it at a higher level as they - didn't work and were no longer needed. - -2005-07-01 Zoran Vasiljevic - - * unix/tclUnixNotfy.c: protect against spurious wake-ups while waiting - on the condition variable when tearing down the notifier thread [Bug - 1222872]. - -2005-06-28 Mo DeJong - - * generic/tclExecute.c (TclExecuteByteCode): When parsing an integer - operand for a unary minus expression operator, check for a wide integer - that is actually LONG_MIN. If found, convert back to a long int type. - * tests/expr.test: Add constraint for 32bit long int type and 64bit - wide int type. Add tests that parse the smallest/largest long int and - wide int values. - -2005-06-24 Kevin Kenny - - * generic/tclEvent.c (Tcl_Finalize): - * generic/tclInt.h: - * generic/tclPreserve.c (TclFinalizePreserve): Changed the finalization - logic so that Tcl_Preserve finalizes after exit handlers run; a lot of - code called from Tk's exit handlers presumes that Tcl_Preserve will - still work even from an exit handler. - -2005-06-24 Don Porter - - * library/auto.tcl: Make file safe to re-[source] without - destroying registered auto_mkindex_parser hooks. - -2005-06-23 Kevin Kenny - - * win/tclWinChan.c: More rewriting of __asm__ blocks that implement - * win/tclWinFCmd.c: SEH in GCC, because mingw's gcc 3.4.2 is not as - forgiving of violations committed by the old code and caused panics. - [Bug 1225957] - -2005-06-23 Daniel Steffen - - * tools/tcltk-man2html.tcl: fixed useversion glob pattern to accept - multi-digit patchlevels. - -2005-06-22 Don Porter - - * win/tclWinFile.c: Potential buffer overflow. [Bug 1225571] Thanks to - Pat Thoyts for discovery and fix. - -2005-06-22 Kevin Kenny - - * generic/tclInt.h: Changed the finalization - * generic/tclEvent.c (Tcl_Finalize): logic to defer the - * generic/tclIO.c (TclFinalizeIOSubsystem): shutdown of the pipe - * unix/tclUnixPipe.c (TclFinalizePipes): management until after all - * win/tclWinPipe.c (TclFinalizePipes): channels have been closed, - in order to avoid a situation where the Windows PipeCloseProc2 would - re-establish the exit handler after exit handlers had already run, - corrupting the heap. [Bug 1225727] Also corrected a potential read of - uninitialized memory in PipeClose2Proc [Bug 1225044] - -2005-06-21 Andreas Kupries - - * generic/tclInt.h: Followup to change made on 2005-06-18 by Daniel - Steffen. There are compilers (*) who error out on the redefinition of - WORDS_BIGENDIAN. We have to undef the previous definition (on the - command line) first to make this acceptable. (*): AIX native. - -2005-06-21 Kevin B. Kenny - - * generic/tclFileName.c: Changed [file split] and [file join] to treat - Windows drive letters similarly to ~ syntax and make sure that they - appear with "./" in front when they are in intermediate components of - the path. [Bug 1194458] - * tests/fileName.test: Added test for the above bug. - -2005-06-21 Don Porter - - * generic/tclBasic.c: Added missing walk of the list of active - * generic/tclTrace.c: traces to cleanup references to traces being - * generic/tclInt.h: deleted. [Bug 1201035] Made the walk of the - * tests/trace.test (trace-34.*): active trace list aware of the - direction of trace scanning, so the proper correction can be made. - [Bug 1224585] - -2005-06-21 Donal K. Fellows - - * unix/tcl.m4 (SC_ENABLE_SYMBOLS): Only enable the 'compile' special - debugging feature when requested in configure.in; removes irrelevant - junk from the configure files of extensions that use Tcl's tcl.m4. - -2005-06-20 Donal K. Fellows - - * generic/tclCompile.h (INST_PUSH_RETURN_OPTIONS): New opcode to allow - * generic/tclCompCmds.c (TclCompileCatchCmd): compilation of - * generic/tclCompile.c: TIP#90 catch [Bug - * generic/tclExecute.c (TclExecuteByteCode): 1219112] - - * generic/tclCompCmds.c (TclCompileSwitchCmd): Ensure we spill to the - command form in all cases where it generates an error. - -2005-06-20 Mo DeJong - - * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): Generate an error if a mode - argument like -exact is passed more than once to the switch command. - The previous implementation silently accepted invalid switch - invocations like [switch -exact -glob $str ...]. - * tests/for.test: Check some error cases when invoking continue and - break inside a for loop next script. - * tests/switch.test: Add checks for shortened version of a mode - argument like -exact. Add test for more than one mode argument. Add - test for odd case of passing a variable as a body script. - -2005-06-18 Daniel Steffen - - * generic/tclInt.h: ensure WORDS_BIGENDIAN is defined correctly with - fat compiles on Darwin (i.e. ppc and i386 at the same time), the - configure AC_C_BIGENDIAN check is not sufficient in this case because a - single run of the compiler builds for two architectures with different - endianness. - - * unix/tcl.m4 (Darwin): add -headerpad_max_install_names to LDFLAGS to - ensure we can always relocate binaries with install_name_tool. - - * unix/configure: autoconf-2.59 - -2005-06-18 Donal K. Fellows - - * generic/tclCmdAH.c (Tcl_FormatObjCmd): Fix for [Bug 1154163]; only - * tests/format.test: insert 'l' modifier when it is needed. - -2005-06-17 Donal K. Fellows - - * generic/tclTimer.c (AfterDelay): Split out the code to manage - synchronous-delay [after] commands. - * tests/interp.test (interp-34.10): Time limits and synch-delay [after] - did not mix well... [Bug 1221395] - -2005-06-14 Donal K. Fellows - - * generic/tclBasic.c (Tcl_DeleteCommandFromToken): Only delete a - * tests/namespace.test (namespace-49.2): command from the hashtable on - reentrant processing if it has not been already deleted; at least three - deletes of the same command are possible. [Bug 1220058] - * generic/tclTrace.c (TraceCommandProc): Remove bogus error message - creation when traces trigger in situations where the command has - already been deleted. - -2005-06-13 Vince Darley - - * generic/tclFCmd.c: correct fix to file mkdir 2005-06-09 [Bug 1219176] - -2005-06-12 Donal K. Fellows - - * generic/tclCompCmds.c: Factor out some common idioms into named forms - for greater clarity. - -2005-06-10 Donal K. Fellows - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - *** 8.5a3 TAGGED FOR RELEASE *** - - * unix/Makefile.in (dist): add libtommath - -2005-06-03 Donal K. Fellows - - * 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 - - * macosx/Makefile: fixed 'embedded' target. - -2005-06-02 Jeff Hobbs - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 [Bug 1082283]. - -2005-05-30 Zoran Vasiljevic - - * win/tclWinThrd.c: Fixed [Bug 1204064] - -2005-05-30 Donal K. Fellows - - 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 - - * 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 - - * generic/tclCmdMZ.c (Tcl_TimeObjCmd): add necessary cast - -2005-05-25 Don Porter - - 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 that - * generic/tclObj.c: only string values like "yes" and "false" are - * tests/obj.test: 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 - - * 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 - - * 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 - - * 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 during - 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 - - * 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 - - * generic/tclBasic.c: Dropped the TCL_NO_MATH configuration. It's - * generic/tclBinary.c: believed this has not been working in a long - * generic/tclExecute.c: time. Tcl needs math.h. [RFE 1200680] - * unix/Makefile.in: - -2005-05-12 Kevin Kenny - - * doc/mathfunc.n: Changed NAME line to match the name of the page. - -2005-05-11 Kevin Kenny - - [kennykb-numerics-branch] Resynchronized with the HEAD; at this - checkpoint [-rkennykb-numerics-branch-20050511], the HEAD and - kennykb-numerics-branch contain identical code. - -2005-05-11 Kevin Kenny - - * 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 - - * 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 - - * 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 - - 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-numerics-branch] Merged changes from HEAD. - -2005-05-10 Miguel Sofer - - * 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-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-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-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 - - * 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-numerics-branch] Merged with HEAD. - -2005-05-05 Kevin B. Kenny - - * win/tclWinThrd.c: Corrected a compilation error on the - --enable-threads configuration. - -2005-05-05 Don Porter - - * 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 a - * generic/tclCmdIL.c: search can be done more efficiently when it is - * generic/tclCompCmds.c:recognized that a pattern match is really an - * generic/tclDictObj.c: 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 - - * 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 - - * 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 - - * unix/tclUnixNotfy.c: applied dkf's tkMacOSXNotify.c cleanup changes. - -2005-04-29 Don Porter - - 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 - - * tests/unixInit.test (7.1): Alternative fix for the 2004-11-11 commit. - -2005-04-27 Don Porter - - * 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 - - * 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-numerics-branch] Merged with HEAD. - - * doc/CrtMathFunc.n: Revised documentation for TIP 232 - -2005-04-25 Daniel Steffen - - * 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 - - * 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 - - * library/init.tcl: Use "ni" and "in" operators. - -2005-04-25 Miguel Sofer - - * generic/tclExecute.c: fix for [Bug 1189274]. - -2005-04-24 Don Porter - - * generic/tclLiteral.c: Silence compiler warnings. - * generic/tclObj.c: [Bug 1188863]. - -2005-04-22 Don Porter - - 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 - - * 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-numerics-branch] - * doc/expr.n: - * doc/mathfunc.n (new file): Revised documentation for TIP 232 - -2005-04-20 Don Porter - - * 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 - - * generic/tclFileName.c: Silenced a compiler warning about '/*' within - a comment. - -2005-04-19 Don Porter - - * 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 - - * 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 - - * generic/Var.c (Tcl_ArrayObjCmd - ARRAY_NAMES): fix Tcl_Obj leak. [Bug - 1084111] - -2005-04-16 Zoran Vasiljevic - - * 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 [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 - - * 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 support - * library/tclIndex: as needed. This reduces startup time by - * library/tm.tcl: delaying this initialization to a later time. - -2005-04-15 Miguel Sofer - - * generic/tclExecute.c: missing semicolons caused failure to compile - with TCL_COMPILE_DEBUG. - -2005-04-13 David Gravereaux - - * generic/tclIO.c (Tcl_SetChannelBufferSize): Lowest size limit - * tests/io.test: changed from ten bytes to one byte. Need for - * tests/iogt.test: this change was proven by Ross Cartlidge - 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 - - * 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. - -2005-04-13 Kevin B. Kenny - - * library/clock.n: Added a missing '--' on several [switch] commands to - improve performance of [clock format] and related operations. [FRQ - 1182459] - -2005-04-13 Donal K. Fellows - - * 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 - on comp.lang.tcl that the current documentation was not clear. - -2005-04-13 Miguel Sofer - - * 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 - - * 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 - - * 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 - - * 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-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 - - * 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 - - * generic/tclBasic.c (TclObjInvoke): Plug memory leak. [Bug 1180368] - -2005-04-09 Miguel Sofer - - * generic/tclExecute.c: fix possible leak of expansion Tcl_Objs - -2005-04-09 Daniel Steffen - - * macosx/README: updated requirements for OS & developer tool versions - and 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * 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 - - * generic/tclExecute.c: small opts in obj handling - -2005-04-02 Miguel Sofer - - * generic/tclVar.c: converted a few function calls to macros. - -2005-04-01 Miguel Sofer - - * 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 - - * generic/tclExecute.c (INST_JUMP_TRUE/FALSE): replaced "test and - branch" with "compute index into table" - -2005-03-30 Donal K. Fellows - - * doc/FileSystem.3: Defined loadHandle argument. [Bug 1172401] - -2005-03-29 Jeff Hobbs - - * win/tcl.m4, win/configure: do not require cygpath in macros to allow - msys alone as an alternative. - -2005-03-24 Don Porter - - * 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 - - * 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 - - * 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 - - * unix/tcl.m4: Updated the OpenBSD configuration and regenerated - * unix/configure: the configure script. - -2005-03-15 Kevin B. Kenny - - [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 - - * generic/tclExecute.c: fixed INST_PUSH1's debugging code (wrong obj - ref passed to TRACE_WITH_OBJ). - -2005-03-14 Miguel Sofer - - * generic/tclCompile.c: fixed INST_RETURN's stack effect in - tclInstructionTable (-1 instead of -2) - -2005-03-10 Miguel Sofer - - * generic/tclCompCmds.c: removed debugging line - -2005-03-10 Don Porter - - * 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-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 - - * win/makefile.vc: clarify necessary defined vars that can come from - MSVC or the Platform SDK. - -2005-03-07 Donal K. Fellows - - * doc/string.n: Minor typo. [Bug 1158247] - -2005-03-07 Miguel Sofer - - * 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-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-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-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 - - * doc/CrtSlave.3: Changed to Tcl_Object to Tcl_Obj in the man page. - -2005-02-24 Don Porter - - * library/tcltest/tcltest.tcl: Better use of [glob -types] to avoid - * tests/tcltest.test: failed attempts to [source] a directory, and - similar matters. Thanks to "mpettigr". [Bug 1119798] - - * library/tcltest/pkgIndex.tcl: Bump to tcltest 2.2.8 - * unix/Makefile.in: - * win/Makefile.in: - -2005-02-23 Donal K. Fellows - - * doc/CrtChannel.3 (THREADACTIONPROC): Formatting fix. [Bug 1149605] - -2005-02-17 Jeff Hobbs - - * win/tclWinFCmd.c (TraverseWinTree): use wcslen on wchar, not - Tcl_UniCharLen. - -2005-02-16 Miguel Sofer - - * doc/variable.n: fix for [Bug 1124160], variables are detected by - [info vars] but not by [info locals]. - -2005-02-11 Jeff Hobbs - - * unix/Makefile.in: remove SHLIB_LD_FLAGS (only for AIX, inlined into - * unix/tcl.m4: SHLIB_LD). Combine AIX-* and AIX-5 branches in - * unix/configure: SC_CONFIG_CFLAGS. Correct gcc builds for AIX-4+ - and HP-UX-11. autoconf-2.59 gen'd. - -2005-02-11 Miguel Sofer - - * tests/basic.test (basic-26.3): new test - -2005-02-10 Miguel Sofer - - * generic/tclBasic.c (Tcl_EvalObjEx): - * tests/basic.test (basic-26.2): preserve the arguments passed to TEOV - in the pure-list branch, in case the list shimmers away. Fix for [Bug - 1119369], reported by Peter MacDonald. - -2005-02-10 Vince Darley - - * generic/tclFileName.c: fix for test failures introduced on 2005-01-17 - [Bug 1119092] - -2005-02-10 Donal K. Fellows - - * doc/binary.n: Made the documentation of sign bit masking and [binary - scan] consistent. [Bug 1117017] - -2005-02-08 David N. Welton - - * doc/CrtChannel.3: Typo: return->returns. - -2005-02-06 Kevin B. Kenny - - [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 - - * doc/Thread.3: One-word grammar fix. - -2005-02-05 David N. Welton - - * 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-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 - - * 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-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' throughout 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 - - * generic/tclExecute.c (TclCompEvalObj): Removed stray statement left - behind in prior code reorganization. - -2005-01-31 Don Porter - - * unix/configure: autoconf-2.57 - -2005-01-30 Joe English - - * unix/configure.in: Restored two double-evals that were removed in the - DBGX purge; these are still needed on some platforms to account for - TCL_TRIM_DOTS. [Bug 1112654] - - * unix/configure: NOT REGENERATED: only have autoconf 2.59 here, need - to find someone with autoconf 2.57. - -2005-01-28 Jeff Hobbs - - * unix/configure, unix/tcl.m4: add solaris 64-bit gcc build support. - [Bug 1021871] - -2005-01-28 Donal K. Fellows - - * tests/expr-old.test (expr-old-37.2): Added test for [Bug 1109484] - -2005-01-27 Jeff Hobbs - - * generic/tclBasic.c (Tcl_ExprBoolean, Tcl_ExprDouble) - (Tcl_ExprLong): Fix to recognize Tcl_WideInt type. [Bug 1109484] - -2005-01-26 Andreas Kupries - - TIP#218 IMPLEMENTATION - - * generic/tclDecls.h: Regenerated from tcl.decls. - * generic/tclStubInit.c: - - * doc/CrtChannel.3: Documentation of extended API, - * generic/tcl.decls: extended testsuite, and - * generic/tcl.h: implementation. Removal of old - * generic/tclIO.c: driver-specific TclpCut/Splice - * generic/tclInt.h: functions. Replaced with generic - * tests/io.test: thread-action calls through the - * unix/tclUnixChan.c: new hooks. Update of all builtin - * unix/tclUnixPipe.c: channel drivers to version 4. - * unix/tclUnixSock.c: Windows drivers extended to - * win/tclWinChan.c: manage thread state in a thread - * win/tclWinConsole.c: action handler. - * win/tclWinPipe.c: - * win/tclWinSerial.c: - * win/tclWinSock.c: - -2005-01-25 Don Porter - - * library/auto.tcl: Updated [auto_reset] to clear auto-loaded - commands in namespaces other than :: and to clear auto-loaded commands - that do not happen to be procs. [Bug 1101670] - ***POTENTIAL INCOMPATIBILITY*** - -2005-01-25 Daniel Steffen - - * unix/tcl.m4 (Darwin): fixed bug with static build linking to dynamic - library in /usr/lib etc instead of linking to static library earlier in - search path. [Bug 956908] Removed obsolete references to Rhapsody. - * unix/configure: autoconf-2.57 - -2005-01-21 Andreas Kupries - - * generic/tclStubInit.c: Regenerated the stubs support code from the - * generic/tclDecls.h: modified tcl.decls (TIP #233, see below). - - * doc/GetTime.3: Implemented TIP #233, i.e. the - * generic/tcl.decls: 'Virtualization of Tcl's Sense of Time'. - * generic/tcl.h: Declared, implemented, and documented the - * generic/tclInt.h: specified new API functions. Moved the - * unix/tclUnixEvent.c: native (OS) access to time information - * unix/tclUnixNotfy.c: into standard handler functions. Inserted - * unix/tclUnixTime.c: hooks calling on the handlers where native - * win/tclWinNotify.c: access was done before, and where scaling - * win/tclWinTime.c: between domains (real/virtual) is required. - -2005-01-21 Andreas Kupries - - * generic/tclThread.c: Typo police. Fixed some nits - * generic/tclCmdAH.c: in header comments of functions. - * generic/tclBasic.c: (Missing --). - * generic/tclFileName.c: - -2005-01-21 Donal K. Fellows - - * doc/FileSystem.3: Add missing ARGUMENTS section definitions for - arguments to Tcl_FSLink. [Bug 1106272] - -2005-01-21 Kevin B. Kenny - - [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-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 - - 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. - -2005-01-19 Mo DeJong - - * win/tclWinChan.c (FileCloseProc): Invoke TclpCutFileChannel() to - remove a FileInfo from the thread local list before deallocating it. - This should have been done via an earlier call to Tcl_CutChannel, but I - was running into a crash in the next call to Tcl_CutChannel during the - I/O finalization stage. - -2005-01-18 Kevin Kenny - - * library/tzdata/GMT+0: - * library/tzdata/GMT-0: - * library/tzdata/GMT0: - * library/tzdata/Greenwich: - * library/tzdata/Navajo: - * library/tzdata/Universal: - * library/tzdata/Zulu: - * library/tzdata/America/Asuncion: - * library/tzdata/America/Rosario: - * library/tzdata/Asia/Jerusalem: - * library/tzdata/Brazil/Acre: - Routine update per Olson's tzdata2005c. Removed links to links - (Greenwich in several aliases; Navajo; Acre). Updated Paraguayan DST - rules and "best guess" at this year's Israeli rules. - -2005-01-17 Vince Darley - - * generic/tclFileName.c: fix for glob failure on Windows shares [Bug - 1100542]. - - * doc/pkgMkIndex.n: added documentation that 'pkg_mkIndex -lazy' is not - a good idea. [Bug 1101678] - -2005-01-14 Donal K. Fellows - - * tests/compile.test (compile-17.1): Document known issue with binding - time of compiled command interpretations in [expr]. - - * generic/tclIOUtil.c (TclFSFileAttrIndex): New helper function so that - we don't need to hard-code attribute indexes. [Bug 1100671] - -2005-01-13 Donal K. Fellows - - * doc/string.n: Removed the term 'set' from the documentation of the - [string trim] commands, as it caused confusion. - -2005-01-12 Donal K. Fellows - - * unix/tcl.m4 (SC_PATH_{TCL,TK}CONFIG): Added code to detect the case - when the --with-tcl/--with-tk arguments point to the config scripts - themselves and not their directory. If this is the case, they now - complain but keep working. [FRQ 951247] - * unix/configure: autoconf-2.57 - -2005-01-10 Joe English - - * unix/Makefile.in, unix/configure.in, unix/tcl.m4, - * unix/tclConfig.sh.in, unix/dltest/Makefile.in: - Remove ${DBGX}, ${TCL_DBGX} from Tcl build system [Patch 1081595]. - * unix/configure: regenerated - -2005-01-10 Donal K. Fellows - - * unix/tclUnixFCmd.c (TclUnixCopyFile): Convert u_int to unsigned to - make clashes with types in standard C headers less of a problem. [Bug - 1098829] - -2005-01-09 Joe English - - * unix/tclUnixThrd.c, unix/tclUnixPort.h: Remove readdir_r() and - related #ifdeffery (see [Bug 1095909]). - * unix/tcl.m4, unix/tclConfig.h.in: Don't check for HAVE_READDIR_R. - * unix/configure: Regenerated. - -2005-01-06 Donal K. Fellows - - * library/http/http.tcl (http::mapReply): Significant performance - enhancement by using [string map] instead of [regsub]/[subst], and - update version requirement to Tcl8.4. [Bug 1020491] - -2005-01-05 Donal K. Fellows - - * doc/lsearch.n, doc/re_syntax.n: Convert to other form of emacs mode - control comment to prevent problems with old versions of man. [Bug - 1085127] - -2005-01-05 Pat Thoyts - - * tests/winDde.test: Fixed broken test result. - -2005-01-05 Donal K. Fellows - - * generic/tclInt.h, generic/tclPort.h: Move the #include of tclConfig.h - *first* before any reference to tcl.h so that the build configuration - is loaded before the first reference to any system headers. Issue - reported by Art Haas on tcl-core. - -2005-01-04 Don Porter - - * tests/fCmd.test (fCmd-18.10): Added notNetworkFilesystem constraint. - [Bug 456665] - - ****************************************************************** - *** CHANGELOG ENTRIES FOR 2004 IN "ChangeLog.2004" *** - *** CHANGELOG ENTRIES FOR 2003 IN "ChangeLog.2003" *** - *** CHANGELOG ENTRIES FOR 2002 IN "ChangeLog.2002" *** - *** CHANGELOG ENTRIES FOR 2001 IN "ChangeLog.2001" *** - *** CHANGELOG ENTRIES FOR 2000 IN "ChangeLog.2000" *** - *** CHANGELOG ENTRIES FOR 1999 AND EARLIER IN "ChangeLog.1999" *** - ****************************************************************** diff --git a/ChangeLog.2007 b/ChangeLog.2007 deleted file mode 100644 index 5995956..0000000 --- a/ChangeLog.2007 +++ /dev/null @@ -1,5921 +0,0 @@ -2007-12-31 Donal K. Fellows - - * doc/dict.n: Clarified meaning of dictionary values following - discussion on comp.lang.tcl. - -2007-12-26 Miguel Sofer - - * generic/tclCmdIL.c: More [lsort] data handling streamlines. The - function MergeSort is gone, essentially inlined into Tcl_LsortObjCmd. - It is not a straight inlining, two loops over all lists elements where - merged in the process: the linked list elements are now built and - merged into the temporary sublists in the same pass. - -2007-12-25 Miguel Sofer - - * generic/tclCmdIL.c: More [lsort] data handling streamlines. Extra - mem reqs of latest patches removed, restored to previous mem profile. - Improved -unique handling, now eliminating repeated elems immediately - instead of marking them to avoid reinsertion at the end. - -2007-12-23 Jeff Hobbs - - * generic/tclCompCmds.c (TclCompileRegexpCmd): TCL_REG_NOSUB cannot - * tests/regexp.test (regexp-22.2): be used because it - * tests/regexpComp.test: [Bug 1857126] disallows backrefs. - -2007-12-21 Miguel Sofer - - * generic/tclCmdIL.c: Speed patch for lsort. [Patch 1856994] - -2007-12-21 Miguel Sofer - - * generic/tclCmdIL.c (Tcl_LsortObjCmd, Tcl_LsearchObjCmd): Avoid - calling SelectObjFromSublist when there are no sublists. - -2007-12-21 Miguel Sofer - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Preallocate a listObj of - sufficient length for the sorted list instead of growing it. Second - commit replaces calls to Tcl_ListObjAppenElement with direct access to - the internal rep. - -2007-12-19 Don Porter - - *** 8.5.0 TAGGED FOR RELEASE *** - - * changes: Updated for 8.5.0 release. - -2007-12-19 Jeff Hobbs - - * generic/tclCompCmds.c (TclCompileSwitchCmd): update switch -regexp - * tests/switch.test-14.*: compilation to pass - the cflags to INST_REGEXP (changed on 12-07). Added tests for switch - -regexp compilation (need more). [Bug 1854399] - -2007-12-18 Don Porter - - * changes: Updated for 8.5.0 release. - -2007-12-18 Donal K. Fellows - - * generic/regguts.h, generic/regc_color.c, generic/regc_nfa.c: - Fixes for problems created when processing regular expressions that - generate very large automata. An enormous number of thanks to Will - Drewry , Tavis Ormandy , - and Tom Lane from the Postgresql crowd for - their help in tracking these problems down. [Bug 1810264] - -2007-12-17 Don Porter - - * changes: Updated for 8.5.0 release. - -2007-12-17 Miguel Sofer - - * generic/tclAlloc.c: - * generic/tclExecute.c: - * generic/tclInt.h: - * generic/tclThreadAlloc.c: Fix alignment for memory returned by - TclStackAlloc; insure that all memory allocators align to 16-byte - boundaries on 64 bit platforms [Bug 1851832, 1851524] - -2007-12-14 Jeff Hobbs - - * generic/tclIOUtil.c (FsAddMountsToGlobResult): fix the tail - conversion of vfs mounts. [Bug 1602539] - - * win/README: updated notes - -2007-12-14 Pat Thoyts - - * tests/winFile.test: Fixed tests for win2k with long machine name - -2007-12-14 Pat Thoyts - - * win/nmakehlp.c: Support compilation with MSVC9 for AMD64. - * win/makefile.vc: - -2007-12-13 Donal K. Fellows - - * doc/trace.n: Clarified documentation of enterstep and leavestep - traces, including adding example. [Bug 614282, 1701540, 1755984] - -2007-12-12 Don Porter - - * doc/IntObj.3: Update docs for the Tcl_GetBignumAndClearObj() -> - Tcl_TakeBignumFromObj() revision [TIP 298]. Added docs for the - Tcl_InitBignumFromDouble() routine. [Bug 1446971] - - * changes: Updated for 8.5.0 release. - -2007-12-10 Jeff Hobbs - - * generic/tclUtil.c (TclReToGlob): reduce escapes in conversion - when not necessary - - * generic/tclInt.decls: move TclByteArrayMatch and TclReToGlob - * generic/tclIntDecls.h: to tclInt.h from stubs. - * generic/tclStubInit.c: Add flags var to TclByteArrayMatch for - * generic/tclInt.h: future extensibility - * generic/tcl.h: define TCL_MATCH_EXACT doc for Tcl_StringCaseMatch. - * doc/StrMatch.3: It is compatible with existing usage. - * generic/tclExecute.c (INST_STR_MATCH): flag for TclByteArrayMatch - * generic/tclUtil.c (TclByteArrayMatch, TclStringMatchObj): - * generic/tclRegexp.c (Tcl_RegExpExecObj): - * generic/tclCmdMZ.c (StringMatchCmd): Use TclStringMatchObj - * tests/string.test (11.9.* 11.10.*): more tests - -2007-12-10 Joe English - - * doc/string.n, doc/UniCharIsAlpha.3: Fix markup errors. - * doc/CrtCommand.3, doc/CrtMathFnc.3, doc/FileSystem.3, - * doc/GetStdChan.3, doc/OpenFileChnl.3, doc/SetChanErr.3, - * doc/eval.n, doc/filename.n: Consistency: Move "KEYWORDS" section - after "SEE ALSO". - -2007-12-10 Daniel Steffen - - * tools/genStubs.tcl: fix numerous issues handling 'macosx', - 'aqua' or 'x11' entries interleaved - with 'unix' entries [Bug 1834288]; add - genStubs::export command - [Tk FR 1716117]; cleanup formatting. - - * generic/tcl.decls: use new genstubs 'export' command to - * generic/tclInt.decls: mark exported symbols not in stubs - * generic/tclTomMath.decls: table [Tk FR 1716117]; cleanup - formatting. - - * generic/tclDecls.h: regen with new genStubs.tcl. - * generic/tclIntDecls.h: [Bug 1834288] - * generic/tclIntPlatDecls.h: - * generic/tclPlatDecls.h: - * generic/tclStubInit.c: - -2007-12-09 Jeff Hobbs - - * tests/io.test, tests/chanio.test (io-73.1): Make sure to invalidate - * generic/tclIO.c (SetChannelFromAny): internal rep only after - validating channel rep. [Bug 1847044] - -2007-12-08 Donal K. Fellows - - * doc/expr.n, doc/mathop.n: Improved the documentation of the - operators. [Bug 1823622] - - * generic/tclBasic.c (builtInCmds): Corrected list of hidden and - * doc/interp.n (SAFE INTERPRETERS): exposed commands so that the - documentation and reality now match. [Bug 1662436] - -2007-12-07 Jeff Hobbs - - * generic/tclExecute.c (TclExecuteByteCode INST_REGEXP): - * generic/tclCompCmds.c (TclCompileRegexpCmd): Pass correct RE - compile flags at compile time, and use TCL_REG_NOSUB. - - * generic/tclIOCmd.c (FinalizeIOCmdTSD, Tcl_PutsObjCmd): cache - stdout channel object for [puts $str] calls. - -2007-12-06 Don Porter - - * README: Remove mention of dead comp.lang.tcl.announce - newsgroup. [Bug 1846433] - - * unix/README: Mention the stub library created by `make` and warn - about the effect of embedded paths in the installed binaries. - Thanks to Larry Virden. [Bug 1794084] - - * doc/AddErrInfo.3: Documentation for the new routines in TIP 270. - * doc/Interp.3: - * doc/StringObj.3: - -2007-12-06 Don Porter - - * doc/namespace.n: Documentation for zero-argument form of - [namespace import] (TIP 261) [Bug 1596416] - -2007-12-06 Jeff Hobbs - - * generic/tclInt.h: add TclGetChannelFromObj decl - (TclMatchIsTrivial): simplify TclMatchIsTrivial to remove ] check. - -2007-12-06 Donal K. Fellows - - - * generic/tclBasic.c (Tcl_CreateInterp): Simplify the setting up of - * generic/tclIOCmd.c (TclInitChanCmd): the [chan] ensemble. This - * library/init.tcl: gets rid of quite a bit of - code and makes it possible to understand the whole with less effort. - - * generic/tclCompCmds.c (TclCompileEnsemble): Ensure that the right - number of tokens are copied. [Bug 1845320] - - * generic/tclNamesp.c (TclMakeEnsemble): Added missing release of a - DString. [Bug 1845397] - -2007-12-05 Jeff Hobbs - - * generic/tclIO.h: Create Tcl_Obj for Tcl channels to reduce - * generic/tclIO.c: overhead in lookup by Tcl_GetChannel. New - * generic/tclIOCmd.c: TclGetChannelFromObj for internal use. - * generic/tclIO.c (WriteBytes, WriteChars): add opt check to avoid - EOL translation when not linebuffered or using lf. [Bug 1845092] - -2007-12-05 Miguel Sofer - - * tests/stack.test: made the tests for stack overflow not care - about which mechanism caused the error (interp's recursion limit - or C-stack depth detector). - -2007-12-05 Jeff Hobbs - - * win/configure, win/tcl.m4 (LIBS_GUI): mingw needs -lole32 - -loleaut32 but not msvc for Tk's [send]. [Bug 1844749] - -2007-12-05 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsearchObjCmd): Prevent shimmering crash - when -exact and -integer/-real are mixed. [Bug 1844789] - -2007-12-03 Donal K. Fellows - - * unix/tclUnixChan.c (CreateSocketAddress): Add extra #ifdef-fery to - make code compile on BSD 5. [Bug 1618235, again] - -2007-12-03 Don Porter - - * library/tcltest/tcltest.tcl: Bump tcltest to version 2.3.0 so that - * library/tcltest/pkgIndex.tcl: we release a stable tcltest with a - * unix/Makefile.in: stable Tcl. - * win/Makefile.in: - -2007-12-03 Jeff Hobbs - - * win/configure, win/tcl.m4 (LIBS_GUI): remove ole32.lib oleaut32.lib - -2007-12-03 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileSwitchCmd): Adjusted the [switch] - * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): command so that when - passed two arguments, no check for options are performed. This is OK - since in the two-arg case, detecting an option would definitely lead - to a syntax error. [Patch 1836519] - -2007-11-29 Jeff Hobbs - - * win/makefile.vc: add ws2_32.lib to baselibs - * win/configure, win/tcl.m4: add ws2_32.lib / -lws2_32 to build. - * win/tclWinSock.c: remove dyn loading of winsock, assume that it is - always available now. - -2007-11-29 Don Porter - - * generic/tclWinSock.c (InitializeHostName): Correct error in - buffer length tracking. After gethostname() writes into a buffer, - convert only the written string to internal encoding, not the whole - buffer. - -2007-11-28 Don Porter - - * generic/tclConfig.c: Corrected failure of the [::foo::pkgconfig] - command to clean up registered configuration data when the query - command is deleted from the interp. [Bug 983501] - - * generic/tclNamesp.c (Tcl_SetEnsembleMappingDict): Added checks - that the dict value passed in is in the format required to make the - internals of ensembles work. [Bug 1436096] - - * generic/tclIO.c: Simplify test and improve accuracy of error - message in latest changes. - -2007-11-28 Pat Thoyts - - * generic/tclIO.c: -eofchar must support no eofchar. - -2007-11-27 Miguel Sofer - - * generic/tclBasic.c: remove unneeded call in Tcl_CreateInterp, add - comments. - -2007-11-27 Don Porter - - * win/tclWinSock.c: Add mising encoding conversion of the [info - hostname] value from the system encoding to Tcl's internal encoding. - - * doc/chan.n: "Fix" the limitation on channel -eofchar - * doc/fconfigure.n: values to single byte characters by - * generic/tclIO.c: documenting it and making it fail loudly. - * tests/chan.test: Thanks to Stuart Cassoff for contributing the - fix. [Bug 800753] - -2007-11-26 Miguel Sofer - - * generic/tclBasic.c: - * generic/tclInt.h: - * unix/tclUnixInit.c: - * unix/tclUnixThrd.c: Fix stack checking via workaround for bug in - glibc's pthread_attr_get_np, patch from [Bug 1815573]. Many thanks to - Sergei Golovan (aka Teo) for detecting the bug and helping diagnose - and develop the fix. - -2007-11-24 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileDictAppendCmd): Fix bug in [dict - append] compiler which caused strange stack corruption. [Bug 1837392] - -2007-11-23 Andreas Kupries - - * generic/tclIORChan.c: Fixed a problem with reflected channels. 'chan - postevent' is defined to work only from within the interpreter - containing the handler command. Sensible, we want only handler - commands to use it. It identifies the channel by handle. The channel - moves to a different interpreter or thread. The interpreter containing - the handler command doesn't know the channel any longer. 'chan - postevent' fails, not finding the channel any longer. Uhm. - - Fixed by creating a second per-interpreter channel table, just for - reflected channels, where each interpreter remembers for which - reflected channels it has the handler command. This info does not move - with the channel itself. The table is updated by 'chan create', and - used by 'chan postevent'. - - * tests/ioCmd.test: Updated the testsuite. - -2007-11-23 Jeff Hobbs - - * generic/tclVar.c (Tcl_ArrayObjCmd): handle the right data for - * tests/var.test (var-14.2): [array names $var -glob $ptn] - -2007-11-23 Donal K. Fellows - - * generic/tclCmdMZ.c (String*Cmd, TclInitStringCmd): Rebuilt [string] - * generic/tclCompCmds.c (TclCompileString*Cmd): as an ensemble. - -2007-11-22 Donal K. Fellows - - * generic/tclDictObj.c (Dict*Cmd,TclInitDictCmd): Rebuilt the [dict] - * generic/tclCompCmds.c (TclCompileDict*Cmd): command as an ensemble. - -2007-11-22 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Rewrote the [string] and - * generic/tclDictObj.c (Tcl_DictObjCmd): [dict] implementations to be - ready for conversion to ensembles. - - * tests/string.test (string-12.22): Flag shimmering bug found in - [string range]. - -2007-11-21 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileEnsemble): Rewrote the ensemble - compiler to remove many of the limitations. Can now compile scripts - that use unique prefixes of subcommands, and which have mappings of a - command to multiple words (provided the first is a compilable command - of course). - -2007-11-21 Donal K. Fellows - - * generic/tclNamesp.c (TclMakeEnsemble): Factor out the code to set up - a core ensemble from a table of information about subcommands, ready - for reuse within the core. - - * generic/various: Start to return more useful Error codes, currently - mainly on assorted lookup failures. - -2007-11-20 Donal K. Fellows - - * generic/tclDictObj.c: Changed the underlying implementation of the - hash table used in dictionaries to additionally keep all entries in - the hash table in a linked list, which is only ever added to at the - end. This makes iteration over all entries in the dictionary in - key insertion order a trivial operation, and so cleans up a great deal - of complexity relating to dictionary representation and stability of - iteration order. - - ***POTENTIAL INCOMPATIBILITY*** - For any code that depended on the (strange) old iteration order. - - * generic/tclConfig.c (QueryConfigObjCmd): Correct usage of - Tcl_WrongNumArgs. - -2007-11-19 Don Porter - - *** 8.5b3 TAGGED FOR RELEASE *** - - * README: Bump version number to 8.5b3. - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf (2.59) - * win/configure: - - * changes: Updated for 8.5b3 release. - -2007-11-19 Kevin Kenny - - * library/tzdata/Africa/Cairo: - * library/tzdata/America/Campo_Grande: - * library/tzdata/America/Caracas: - * library/tzdata/America/Cuiaba: - * library/tzdata/America/Havana: - * library/tzdata/America/Sao_Paulo: - * library/tzdata/Asia/Damascus: - * library/tzdata/Asia/Gaza: - * library/tzdata/Asia/Tehran: Olson's tzdata2007i imported. - -2007-11-18 Daniel Steffen - - * generic/tclExecute.c (TclExecuteByteCode:INST_EXIST_*): Fix read - traces not firing on non-existent array elements. [Bug 1833522] - -2007-11-16 Donal K. Fellows - - * generic/tclCmdIL.c (TclInitInfoCmd): Rename the implementation - commands for [info] to be something more "expected". - - * generic/tclCompCmds.c (TclCompileInfoExistsCmd): Compiler for the - [info exists] subcommand. - (TclCompileEnsemble): Cleaned up version of ensemble compiler that was - in TclCompileInfoCmd, but which is now much more generally applicable. - - * generic/tclInt.h (ENSEMBLE_COMPILE): Added flag to allow for cleaner - turning on and off of ensemble bytecode compilation. - - * generic/tclCompile.c (TclCompileScript): Add the cmdPtr to the list - of arguments passed to command compilers. - -2007-11-15 Don Porter - - * generic/regc_nfa.c: Fixed infinite loop in the regexp compiler. - [Bug 1810038] - - * generic/regc_nfa.c: Corrected looping logic in fixempties() to - avoid wasting time walking a list of dead states. [Bug 1832612] - -2007-11-15 Donal K. Fellows - - * generic/tclNamesp.c (NamespaceEnsembleCmd): Must pass a non-NULL - interp to Tcl_SetEnsemble* functions. - - * doc/re_syntax.n: Try to make this easier to read. It's still a very - difficult manual page! - - * unix/tcl.m4 (SC_CONFIG_CFLAGS): Allow people to turn off the -rpath - option to their linker if they so desire. This is a configuration only - recommended for (some) vendors. Relates to [Patch 1231022]. - -2007-11-15 Pat Thoyts - - * win/tclWin32Dll.c: Prefer UINT_PTR to DWORD_PTR when casting - pointers to integer types for greater portability. [Bug 1831253] - -2007-11-15 Daniel Steffen - - * macosx/Tcl.xcodeproj/project.pbxproj: add new chanio.test. - * macosx/Tcl.xcode/project.pbxproj: - -2007-11-14 Donal K. Fellows - - * generic/tclCompile.c (TclCompileScript): Ensure that we get our - count in our INST_START_CMD calls right, even when there's a failure - to compile a command directly. - - * generic/tclNamesp.c (Tcl_SetEnsembleSubcommandList) - (Tcl_SetEnsembleMappingDict): Special code to make sure that - * generic/tclCmdIL.c (TclInitInfoCmd): [info exists] is compiled - right while not allowing changes to the ensemble to cause havok. - - * generic/tclCompCmds.c (TclCompileInfoCmd): Simple compiler for the - [info] command that only handles [info exists]. - - * generic/tclExecute.c (TclExecuteByteCode:INST_EXIST_*): New - instructions to allow the testing of whether a variable exists. - -2007-11-14 Andreas Kupries - - * tests/chanio.test: New file. This is essentially a duplicate of - 'io.test', with all channel commands converted to their 'chan xxx' - notation. - * tests/io.test: Fixed typo in test description. - -2007-11-14 Donal K. Fellows - - * generic/regc*.c: Eliminate multi-char collating element code - completely. Simplifies the code quite a bit. If people still want the - full code, it will remain on the 8.4 branch. [Bug 1831425] - -2007-11-13 Jeff Hobbs - - * generic/tclCompCmds.c (TclCompileRegexpCmd): clean up comments, only - free dstring on OK from TclReToGlob. - (TclCompileSwitchCmd): simplify TclReToGlob usage. - -2007-11-14 Donal K. Fellows - - * generic/regc*.c: #ifdef/comment out the code that deals with - multi-character collating elements, which have never been supported. - Cuts the memory consumption of the RE compiler. [Bug 1831425] - -2007-11-13 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileSwitchCmd, TclCompileRegexpCmd): - Extend [switch] compiler to handle regular expressions as long as - things are not too complex. Fix [regexp] compiler so that non-trivial - literal regexps get fed to INST_REGEXP. - - * doc/mathop.n: Clarify definitions of some operations. - -2007-11-13 Miguel Sofer - - * unix/tclUnixInit.c: the TCL_NO_STACK_CHECK was being incorrectly - undefined here; this should be set (or not) in the compile options, it - is used elsewhere and needs to be consistent. - -2007-11-13 Pat Thoyts - - * unix/tcl.m4: Added autoconf goo to detect and make use of - * unix/configure.in: getaddrinfo and friends. - * unix/configure: (regenerated) - -2007-11-13 Donal K. Fellows - - * unix/tclUnixCompat.c (TclpGetHostByName): The six-argument form of - getaddressbyname_r() uses the fifth argument to indicate whether the - lookup succeeded or not on at least one platform. [Bug 1618235] - -2007-11-13 Don Porter - - * generic/regcomp.c: Convert optst() from expensive no-op to a - cheap no-op. - -2007-11-13 Donal K. Fellows - - * unix/tclUnixChan.c (CreateSocketAddress): Rewrote to use the - thread-safe version of gethostbyname() by forward-porting the code - used in 8.4, and added rudimentary support for getaddrinfo() (not - enabled by default, as no autoconf-ery written). Part of fix for [Bug - 1618235]. - -2007-11-12 Jeff Hobbs - - * generic/tclGet.c (Tcl_Get, Tcl_GetInt): revert use of TclGet* macros - due to compiler warning. These cases won't save time either. - - * generic/tclUtil.c (TclReToGlob): add more comments, set interp - result if specified on error. - -2007-11-12 Miguel Sofer - - * generic/tclBasic.c: New macro TclResetResult, new iPtr - * generic/tclExecute.c: flag bit INTERP_RESULT_UNCLEAN: - * generic/tclInt.h: shortcut for Tcl_ResetResult for the - * generic/tclProc.c: "normal" case: TCL_OK, no return - * generic/tclResult.c: options, no errorCode nor errorInfo, - * generic/tclStubLib.c: return at normal level. [Patch - * generic/tclUtil.c: 1830184] - - THIS PATCH WAS REVERTED: initial (mis)measurements overstated the - perfomance wins, which turn out to be tiny. Not worth the - complication. - -2007-11-11 Jeff Hobbs - - * generic/tclCompCmds.c, generic/tclCompile.c, generic/tclCompile.h: - * generic/tclExecute.c, generic/tclInt.decls, generic/tclIntDecls.h: - * generic/tclRegexp.c, generic/tclRegexp.h: Add INST_REGEXP and fully - * generic/tclStubInit.c, generic/tclUtil.c: compiled [regexp] for the - * tests/regexpComp.test: [Bug 1830166] simple cases. Also added - TclReToGlob function to convert RE to glob patterns and use these in - the possible cases. - -2007-11-11 Miguel Sofer - - * generic/tclResult.c (ResetObjResult): clarify the logic. - - * generic/tclBasic.c: Increased usage of macros to detect - * generic/tclBinary.c: and take advantage of objTypes. Added - * generic/tclClock.c: macros TclGet(Int|Long)FromObj, - * generic/tclCmdAH.c: TclGetIntForIndexM & TclListObjLength, - * generic/tclCmdIL.c: modified TclListObjGetElements. - * generic/tclCmdMZ.c: - * generic/tclCompCmds.c: The TclGetInt* macros are only a - * generic/tclCompExpr.c: shortcut on platforms where 'long' is - * generic/tclCompile.c: 'int'; it may be worthwhile to extend - * generic/tclDictObj.c: their functionality to other cases. - * generic/tclExecute.c: - * generic/tclGet.c: As this patch touches many files it - * generic/tclIO.c: has been recorded as [Patch 1830038] - * generic/tclIOCmd.c: in order to facilitate reviewing. - * generic/tclIOGT.c: - * generic/tclIndexObj.c: - * generic/tclInt.h: - * generic/tclInterp.c: - * generic/tclListObj.c: - * generic/tclLiteral.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclParse.c: - * generic/tclProc.c: - * generic/tclRegexp.c: - * generic/tclResult.c: - * generic/tclScan.c: - * generic/tclStringObj.c: - * generic/tclUtil.c: - * generic/tclVar.c: - -2007-11-11 Daniel Steffen - - * unix/tclUnixTime.c (TclpWideClicksToNanoseconds): Fix issues with - * generic/tclInt.h: int64_t overflow. - - * generic/tclBasic.c: Fix stack check failure case if stack grows up - * unix/tclUnixInit.c: Simplify non-crosscompiled case. - - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2007-11-10 Miguel Sofer - - * generic/tclExecute.c: Fast path for INST_LIST_INDEX when the index - is not a list. - - * generic/tclBasic.c: - * unix/configure.in: - * unix/tclUnixInit.c: Detect stack grwoth direction at compile time, - only fall to runtime detection when crosscompiling. - - * unix/configure: autoconf 2.61 - - * generic/tclBasic.c: - * generic/tclInt.h: - * tests/interp.test: - * unix/tclUnixInit.c: - * win/tclWin32Dll.c: Restore simpler behaviour for stack checking, not - adaptive to stack size changes after a thread is launched. Consensus - is that "nobody does that", and so it is not worth the cost. Improved - failure comments (mistachkin). - -2007-11-10 Kevin Kenny - - * win/tclWin32Dll.c: Rewrote the Windows stack checking algorithm to - use information from VirtualQuery to determine the bound of the stack. - This change fixes a bug where the guard page of the stack was never - restored after an overflow. It also eliminates a nasty piece of - assembly code for structured exception handling on mingw. It - introduces an assumption that the stack is a single memory arena - returned from VirtualAlloc, but the code in MSVCRT makes the same - assumption, so it should be fairly safe. - -2007-11-10 Miguel Sofer - - * generic/tclBasic.c: - * generic/tclInt.h: - * unix/tclUnixInit.c: - * unix/tclUnixPort.h: - * win/tclWin32Dll.c: Modify the stack checking algorithm to recheck in - case of failure. The working assumptions are now that (a) a thread's - stack is never moved, and (b) a thread's stack can grow but not - shrink. Port to windows - could be more efficient, but is already - cheaper than it was. - -2007-11-09 Miguel Sofer - - * generic/tclResult.c (ResetObjResult): new shortcut. - - * generic/tclAsync.c: - * generic/tclBasic.c: - * generic/tclExecute.c: - * generic/tclInt.h: - * generic/tclUnixInit.c: - * generic/tclUnixPort.h: New fields in interp (ekeko!) to cache TSD - data that is accessed at each command invocation, access macros to - replace Tcl_AsyncReady and TclpCheckStackSpace by much faster variants - [Patch 1829248] - -2007-11-09 Jeff Hobbs - - * generic/tclInt.decls, generic/tclIntDecls.h: Use unsigned char for - * generic/tclExecute.c, generic/tclUtil.c: TclByteArrayMatch and - don't allow a nocase option. [Bug 1828296] - For INST_STR_MATCH, ignore pattern type for TclByteArrayMatch case. - - * generic/tclBinary.c (Tcl_GetByteArrayFromObj): check type before - func jump (perf). - -2007-11-07 Jeff Hobbs - - * generic/tclStubInit.c: Added TclByteArrayMatch - * generic/tclInt.decls: for efficient glob - * generic/tclIntDecls.h: matching of ByteArray - * generic/tclUtil.c (TclByteArrayMatch): Tcl_Objs, used in - * generic/tclExecute.c (TclExecuteByteCode): INST_STR_MATCH. [Bug - 1827996] - - * generic/tclIO.c (TclGetsObjBinary): Add an efficient binary path for - [gets]. - (DoWriteChars): Special case for 1-byte channel write. - -2007-11-06 Miguel Sofer - - * generic/tclEncoding.c: Version of the embedded iso8859-1 encoding - handler that is faster (functions to do the encoding know exactly what - they're doing instead of pulling it from a table, though the table - itself has to be retained for use by shift encodings that depend on - iso8859-1). [Patch 1826906], committing for dkf. - -2007-11-05 Andreas Kupries - - * generic/tclConfig.c (Tcl_RegisterConfig): Modified to not extend the - config database if the encoding provided by the user is not found - (venc == NULL). Scripts expecting the data will error out, however we - neither crash nor provide bogus information. See [Bug 983509] for more - discussion. - - * unix/tclUnixChan.c (TtyGetOptionProc): Accepted [Patch 1823576] - provided by Stuart Cassof . The patch adds - the necessary utf/external conversions to the handling of the - arguments of option -xchar which will allow the use of \0 and similar - characters. - -2007-11-03 Miguel Sofer - - * generic/tclTest.c (TestSetCmd2): - * generic/tclVar.c (TclObjLookupVarEx): - * tests/set.test (set-5.1): Fix error branch when array name looks - like array element (code not normally exercised). - -2007-11-01 Donal K. Fellows - - * tools/tcltk-man2html.tcl (output-directive): Convert .DS/.DE pairs - into tables since that is now all that they are used for. - - * doc/RegExp.3: Clarified documentation of RE flags. [Bug 1167840] - - * doc/refchan.n: Adjust internal name to be consistent with the file - name for reduced user confusion. After comment by Dan Steffen. - - * generic/tclCmdMZ.c (Tcl_StringObjCmd, UniCharIsAscii): Remember, the - NUL character is in ASCII too. [Bug 1808258] - - * doc/file.n: Clarified use of [file normalize]. [Bug 1185154] - -2007-10-30 Don Porter - - * generic/tcl.h: Bump version number to 8.5b2.1 to distinguish - * library/init.tcl: CVS development snapshots from the 8.5b2 - * unix/configure.in: release. - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf (2.59) - * win/configure: - -2007-10-30 Donal K. Fellows - - * doc/expr.n, doc/mathfunc.n: Improve documentation to try to make - clearer what is going on. - - * doc/interp.n: Shorten the basic descriptive text for some interp - subcommands so Solaris nroff doesn't truncate them. [Bug 1822268] - -2007-10-30 Donal K. Fellows - - * tools/tcltk-man2html.tcl (output-widget-options): Enhance the HTML - generator so that it can produce multi-line option descriptions. - -2007-10-28 Miguel Sofer - - * generic/tclUtil.c (Tcl_ConcatObj): optimise for some of the - concatenees being empty objs. [Bug 1447328] - -2007-10-28 Donal K. Fellows - - * generic/tclEncoding.c (TclInitEncodingSubsystem): Hard code the - iso8859-1 encoding, as it's needed for more than just text (especially - binary encodings...) Note that other encodings rely on the encoding - being a table encoding (!) so we can't use more efficient encoding - mapping functions. - -2007-10-27 Donal K. Fellows - - * generic/regc_lex.c (lexescape): Close off one of the problems - mentioned in [Bug 1810264]. - -2007-10-27 Miguel Sofer - - * generic/tclNamesp.c (Tcl_FindCommand): insure that FQ command names - are searched from the global namespace, ie, bypassing resolvers of the - current namespace. [Bug 1114355] - - * doc/apply.n: fixed example [Bug 1811791] - * doc/namespace.n: improved example [Bug 1788984] - * doc/AddErrInfo.3: typo [Bug 1715087] - * doc/CrtMathFnc.3: fixed Tcl_ListMathFuncs entry [Bug 1672219] - - * generic/tclCompile.h: - * generic/tclInt.h: moved declaration of TclSetCmdNameObj from - tclCompile.h to tclInt.h, reverting linker [Bug 1821159] caused by - commit of 2007-10-11 (both I and gcc missed one dep). - - * generic/tclVar.c: try to preserve Tcl_Objs when doing variable - lookups by name, partially addressing [Bug 1793601]. - -2007-10-27 Donal K. Fellows - - * tools/tcltk-man2html.tcl (make-man-pages, htmlize-text) - (process-text): Make the man->HTML scraper work better. - -2007-10-26 Don Porter - - *** 8.5b2 TAGGED FOR RELEASE *** - - * changes: Updated for 8.5b2 release. - - * doc/*.1: Revert doc changes that broke - * doc/*.3: `make html` so we can get the release - * doc/*.n: out the door. - - * README: Bump version number to 8.5b2. - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf (2.59) - * win/configure: - -2007-10-26 Donal K. Fellows - - * tools/man2help2.tcl, tools/man2tcl.c: Made some of the tooling code - to do man->other formats work better with current manpage set. Long - way still to go. - -2007-10-25 Zoran Vasiljevic - - * generic/tclThread.c: Added TclpMasterLock/Unlock arround calls to - ForgetSyncObject in Tcl_MutexFinalize and Tcl_ConditionFinalize to - prevent from garbling the internal lists that track sync objects. [Bug - 1726873] - -2007-10-24 Donal K. Fellows - - * tools/man2html2.tcl (macro): Added support for converting the new - macros into HTML. - - * doc/man.macros (QW,PQ,QR,MT): New macros that hide the ugly mess - needed to get proper GOOBE quoting in the manual pages. - * doc/*.n, doc/*.3, doc/*.1: Lots of changes to take advantage of the - new macros. - -2007-10-20 Miguel Sofer - - * generic/tclCompile.c: Fix comments. - * generic/tclExecute.c: - -2007-10-18 David Gravereaux - - * tools/mkdepend.tcl: sort the dep list for a more humanly readable - output. - -2007-10-18 Don Porter - - * generic/tclResult.c (TclMergeReturnOptions): Make sure any -code - values get pulled out of the dictionary, even if they are integer - valued. - - * generic/tclCompCmds.c (TclCompileReturnCmd): Added code to more - optimally compile [return -level 0 $x] to "push $x". [RFE 1794073] - - * compat/tmpnam.c (removed): The routine tmpnam() is no longer - * unix/Makefile.in: called by Tcl source code. Remove autogoo the - * unix/configure.in: supplied a replacement version on systems - * win/tcl.dsp: where the routine was not available. [RFE - 1811848] - - * unix/configure: autoconf-2.59 - - * generic/tcl.h: Remove TCL_LL_MODIFIER_SIZE. [RFE 1811837] - -2007-10-17 David Gravereaux - - * tools/mkdepend.tcl: Improved defense from malformed object list - infile. - -2007-10-17 Donal K. Fellows - - * tools/man2html2.tcl: Convert .DS/.DE into HTML tables, not - preformatted text. - -2007-10-17 Kevin B. Kenny - - * generic/tclCompExpr.c: Moved a misplaced declaration that blocked - compilation on VC++. - * generic/tclExecute.c: Silenced several VC++ compiler warnings about - converting 'long' to 'unsigned short'. - -2007-10-16 David Gravereaux - - * win/makefile.vc: removed old dependency cruft that is no longer - needed. - -2007-10-15 Don Porter - - * generic/tclIOCmd.c: Revise [open] so that it interprets leading - zero strings passed as the "permissions" argument as octal numbers, - even if Tcl itself no longer parses integers in that way. - - * unix/tclUnixFCmd.c: Revise the "-permissions" [file attribute] so - that it interprets leading zero strings as octal numbers, even if Tcl - itself no longer parses integers in that way. - - * generic/tclCompExpr.c: Corrections to code that produces - * generic/tclUtil.c: extended "bad octal" error messages. - - * tests/cmdAH.test: Test revisions so that tests pass whether or - * tests/cmdIL.test: not Tcl parses leading zero strings as octal. - * tests/compExpr-old.test: - * tests/compExpr.test: - * tests/compile.test: - * tests/expr-old.test: - * tests/expr.test: - * tests/incr.test: - * tests/io.test: - * tests/lindex.test: - * tests/link.test: - * tests/mathop.test: - * tests/parseExpr.test: - * tests/set.test: - * tests/string.test: - * tests/stringComp.test: - -2007-10-15 David Gravereaux - - * tools/mkdepend.tcl: Produces usable output. Include path problem - * win/makefile.vc: fixed. Never fight city hall when it comes to - levels of quoting issues. - -2007-10-15 Miguel Sofer - - * generic/tclParse.c (Tcl_ParseBraces): fix for possible read after - the end of buffer. [Bug 1813528] (Joe Mistachkin) - -2007-10-14 David Gravereaux - - * tools/mkdepend.tcl (new): Initial stab at generating automatic - * win/makefile.vc: dependencies. - -2007-10-12 Pat Thoyts - - * win/makefile.vc: Mine all version information from headers. - * win/rules.vc: Sync tcl and tk and bring extension versions - * win/nmakehlp.c: closer together. Try and avoid using tclsh to do - substitutions as we may cross compile. - * win/coffbase.txt: Added offsets for snack dlls. - -2007-10-11 David Gravereaux - - * win/makefile.vc: Fixed my bad spelling mistakes from years back. - Dedependency, duh! Rather funny. - -2007-10-11 Don Porter - - * generic/tclCmdMZ.c: Correct [string is (wide)integer] failure - * tests/string.test: to report correct failindex values for - non-decimal integer strings. [Bug 1805887] - - * compat/strtoll.c (removed): The routines strtoll() and strtoull() - * compat/strtoull.c (removed): are no longer called by the Tcl source - * generic/tcl.h: code. (Their functionality has been replaced - * unix/Makefile.in: by TclParseNumber().) Remove outdated comments - * unix/configure.in: and mountains of configury autogoo that - * unix/tclUnixPort.h: allegedly support the mythical systems where - * win/Makefile.in: these routines might not have been available. - * win/makefile.bc: - * win/makefile.vc: - * win/tclWinPort.h: - - * unix/configure: autoconf-2.59 - -2007-10-11 Miguel Sofer - - * generic/tclObj.c: remove superfluous #include of tclCompile.h - -2007-10-08 George Peter Staplin - - * doc/Hash.3: Correct the valid usage of the flags member for the - Tcl_HashKeyType. It should be 0 or more of the flags mentioned. - -2007-10-02 Jeff Hobbs - - * generic/tcl.h (Tcl_DecrRefCount): Update change from 2006-05-29 to - make macro more warning-robust in unbraced if code. - -2007-10-02 Don Porter - - [core-stabilizer-branch] - - * README: Bump version number to 8.5.0 - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf (2.59) - * win/configure: - -2007-10-02 Andreas Kupries - - * library/tclIndex: Added 'tcl::tm::path' to the tclIndex. This fixes - [Bug 1806422] reported by Don Porter. - -2007-09-25 Donal K. Fellows - - * generic/tclProc.c (Tcl_DisassembleObjCmd): Define a command, - ::tcl::unsupported::disassemble, which can disassemble procedures, - lambdas and general scripts. - * generic/tclCompile.c (TclDisassembleByteCodeObj): Split apart the - code to print disassemblies of bytecode so that there is reusable code - that spits it out in a Tcl_Obj and then that code is used when doing - tracing. - -2007-09-20 Don Porter - - *** 8.5b1 TAGGED FOR RELEASE *** - - * changes: updates for 8.5b1 release. - -2007-09-19 Don Porter - - * README: Bump version number to 8.5b1 - * generic/tcl.h: Merge from core-stabilizer-branch. - * library/init.tcl: Stabilizing toward 8.5b1 release now done on - * tools/tcl.wse.in: the HEAD. core-stabilizer-branch is now - * unix/configure.in: suspended. - * unix/tcl.spec: - * win/configure.in: - -2007-09-19 Pat Thoyts - - * generic/tclStubLib.: Replaced isdigit with internal implementation. - -2007-09-18 Don Porter - - * generic/tclStubLib.c: Remove C library calls from Tcl_InitStubs() so - * win/makefile.vc: that we don't need the C library linked in to - libtclStub. - -2007-09-17 Pat Thoyts - - * win/makefile.vc: Add crt flags for tclStubLib now it uses C-library - functions. - -2007-09-17 Joe English - - * tcl.m4: use '${CC} -shared' instead of 'ld -Bshareable' to build - shared libraries on current NetBSDs. [Bug 1749251] - * unix/configure: regenerated (autoconf-2.59). - -2007-09-17 Don Porter - - * unix/Makefile.in: Update `make dist` so that tclDTrace.d is - included in the source code distribution. - - * generic/tcl.h: Revised Tcl_InitStubs() to restore Tcl 8.4 - * generic/tclPkg.c: source compatibility with callers of - * generic/tclStubLib.c: Tcl_InitStubs(interp, TCL_VERSION, 1). [Bug - 1578344] - -2007-09-17 Donal K. Fellows - - * generic/tclTrace.c (Tcl_TraceObjCmd, TraceExecutionObjCmd) - (TraceCommandObjCmd, TraceVariableObjCmd): Generate literal values - * generic/tclNamesp.c (NamespaceCodeCmd): more efficiently using - * generic/tclFCmd.c (CopyRenameOneFile): TclNewLiteralStringObj - * generic/tclEvent.c (TclSetBgErrorHandler): macro. - -2007-09-15 Daniel Steffen - - * unix/tcl.m4: replace all direct references to compiler by ${CC} to - enable CC overriding at configure & make time; run - check for visibility "hidden" with all compilers; - quoting fixes from TEA tcl.m4. - (SunOS-5.1x): replace direct use of '/usr/ccs/bin/ld' in SHLIB_LD by - 'cc' compiler driver. - * unix/configure: autoconf-2.59 - -2007-09-14 Donal K. Fellows - - * generic/tclBasic.c (Tcl_CreateObjCommand): Only invalidate along the - namespace path once; that is enough. [Bug 1519940] - -2007-09-14 Daniel Steffen - - * generic/tclDTrace.d (new file): Add DTrace provider for Tcl; allows - * generic/tclCompile.h: tracing of proc and command entry & - * generic/tclBasic.c: return, bytecode execution, object - * generic/tclExecute.c: allocation and more; with - * generic/tclInt.h: essentially zero cost when tracing - * generic/tclObj.c: is inactive; enable with - * generic/tclProc.c: --enable-dtrace configure arg - * unix/Makefile.in: (disabled by default, will only - * unix/configure.in: enable if DTrace is present). [Patch - 1793984] - - * macosx/GNUmakefile: Enable DTrace support. - * macosx/Tcl-Common.xcconfig: - * macosx/Tcl.xcodeproj/project.pbxproj: - - * generic/tclCmdIL.c: Factor out core of InfoFrameCmd() into - internal TclInfoFrame() for use by DTrace - probes. - - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2007-09-12 Don Porter - - * unix/Makefile.in: Perform missing updates of the tcltest Tcl - * win/Makefile.in: Module installed filename that should have - been part of the bump to tcltest 2.3b1. Thanks Larry Virden. - -2007-09-12 Pat Thoyts - - * win/makefile.vc, win/rules.vc, win/nmakehlp.c: Use nmakehlp to - substitute values for tclConfig.sh (helps cross-compiling). - -2007-09-11 Don Porter - - * library/tcltest/tcltest.tcl: Accept underscores and colons in - * library/tcltest/pkgIndex.tcl: constraint names. Properly handle - constraint expressions that return non-numeric boolean results like - "false". Bump to tcltest 2.3b1. [Bug 1772989; RFE 1071322] - * tests/info.test: Disable fragile tests. - - * doc/package.n: Restored the functioning of [package require - * generic/tclPkg.c: -exact] to be compatible with Tcl 8.4. [Bug - * tests/pkg.test: 1578344] - -2007-09-11 Miguel Sofer - - * generic/tclCompCmds.c (TclCompileDictCmd-update): - * generic/tclCompile.c (tclInstructionTable): - * generic/tclExecute.c (INST_DICT_UPDATE_END): fix stack management in - compiled [dict update]. [Bug 1786481] - - ***POTENTIAL INCOMPATIBILITY*** - Scripts that were precompiled on earlier versions of 8.5 and use [dict - update] will crash. Workaround: recompile. - -2007-09-11 Kevin B. Kenny - - * generic/tclExecute.c: Corrected an off-by-one error in the setting - of MaxBaseWide for certain powers. [Bug 1767293 - problem reported in - comments when bug was reopened] - -2007-09-10 Jeff Hobbs - - * generic/tclLink.c (Tcl_UpdateLinkedVar): guard against var being - unlinked. [Bug 1740631] (maros) - -2007-09-10 Miguel Sofer - - * generic/tclCompile.c: fix tclInstructionTable entry for - dictUpdateEnd - - * generic/tclExecute.c: remove unneeded setting of 'cleanup' variable - before jumping to checkForCatch. - -2007-09-10 Don Porter - - * doc/package.n: Restored the document parallel syntax of the - * generic/tclPkg.c: [package present] and [package require] - * tests/pkg.test: commands. [Bug 1723675] - -2007-09-09 Don Porter - - * generic/tclInt.h: Removed the "nsName" Tcl_ObjType from the - * generic/tclNamesp.c: registered set. Revised the management of the - * generic/tclObj.c: intrep of that Tcl_ObjType. Revised the - * tests/obj.test: TclGetNamespaceFromObj() routine to return - TCL_ERROR and write a consistent error message when a namespace is not - found. [Bug 1588842. Patch 1686862] - - ***POTENTIAL INCOMPATIBILITY*** - For callers of Tcl_GetObjType() on the name "nsName". - - * generic/tclExecute.c: Update TclGetNamespaceFromObj() callers. - * generic/tclProc.c: - - * tests/apply.test: Updated tests to expect new consistent - * tests/namespace-old.test: error message when a namespace is not - * tests/namespace.test: found. - * tests/upvar.test: - - * generic/tclCompCmds.c: Use the new INST_REVERSE instruction - * tests/mathop.test: to correct the compiled versions of math - operator commands. [Bug 1724437] - - * generic/tclCompile.c: New bytecode instruction INST_REVERSE to - * generic/tclCompile.h: reverse the order of N items at the top of - * generic/tclExecute.c: stack. - - * generic/tclCompCmds.c (TclCompilePowOpCmd): Make a separate - routine to compile ** to account for its different associativity. - -2007-09-08 Miguel Sofer - - * generic/tclVar.c (Tcl_SetVar2, TclPtrSetVar): [Bug 1710710] fixed - correctly, reverted fix of 2007-05-01. - -2007-09-08 Donal K. Fellows - - * generic/tclDictObj.c (DictUpdateCmd, DictWithCmd): Plug a hole that - * generic/tclExecute.c (TEBC,INST_DICT_UPDATE_END): allowed a careful - * tests/dict.test (dict-21.16,21.17,22.11): attacker to craft a dict - containing a recursive link to itself, violating one of Tcl's - fundamental datatype assumptions and causing a stack crash when the - dict was converted to a string. [Bug 1786481] - -2007-09-07 Don Porter - - * generic/tclEvent.c ([::tcl::Bgerror]): Corrections to Tcl's - * tests/event.test: default [interp bgerror] handler so that when - it falls back to a hidden [bgerror] in a safe interp, it gets the - right error context data. [Bug 1790274] - -2007-09-07 Miguel Sofer - - * generic/tclProc.c (TclInitCompiledLocals): the refCount of resolved - variables was being managed without checking if they were Var or - VarInHash: itcl [Bug 1790184] - -2007-09-06 Don Porter - - * generic/tclResult.c (Tcl_GetReturnOptions): Take care that a - * tests/init.test: non-TCL_ERROR code doesn't cause existing - -errorinfo, -errorcode, and -errorline entries to be omitted. - * generic/tclEvent.c: With -errorInfo no longer lost, generate more - complete ::errorInfo when calling [bgerror] after a non-TCL_ERROR - background exception. - -2007-09-06 Don Porter - - * generic/tclInterp.c (Tcl_Init): Removed constraint on ability - to define a custom [tclInit] before calling Tcl_Init(). Until now the - custom command had to be a proc. Now it can be any command. - - * generic/tclInt.decls: New internal routine TclBackgroundException() - * generic/tclEvent.c: that for the first time permits non-TCL_ERROR - exceptions to trigger [interp bgerror] handling. Closes a gap in TIP - 221. When falling back to [bgerror] (which is designed only to handle - TCL_ERROR), convert exceptions into errors complaining about the - exception. - - * generic/tclInterp.c: Convert Tcl_BackgroundError() callers to call - * generic/tclIO.c: TclBackgroundException(). - * generic/tclIOCmd.c: - * generic/tclTimer.c: - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - -2007-09-06 Daniel Steffen - - * macosx/Tcl.xcode/project.pbxproj: discontinue unmaintained support - * macosx/Tcl.xcode/default.pbxuser: for Xcode 1.5; replace by Xcode2 - project for use on Tiger (with Tcl.xcodeproj to be used on Leopard). - - * macosx/Tcl.xcodeproj/project.pbxproj: updates for Xcode 2.5 and 3.0. - * macosx/Tcl.xcodeproj/default.pbxuser: - * macosx/Tcl.xcode/project.pbxproj: - * macosx/Tcl.xcode/default.pbxuser: - * macosx/Tcl-Common.xcconfig: - - * macosx/README: document project changes. - -2007-09-05 Don Porter - - * generic/tclBasic.c: Removed support for the unmaintained - * generic/tclExecute.c: -DTCL_GENERIC_ONLY configuration. [Bug - * unix/Makefile.in: 1264623] - -2007-09-04 Don Porter - - * unix/Makefile.in: It's unreliable to count on the release - manager to remember to `make genstubs` before `make dist`. Let the - Makefile remember the dependency for us. - - * unix/Makefile.in: Corrections to `make dist` dependencies to be - sure that macosx/configure gets generated whenever it does not exist. - -2007-09-03 Kevin B, Kenny - - * library/tzdata/Africa/Cairo: - * library/tzdata/America/Grand_Turk: - * library/tzdata/America/Port-au-Prince: - * library/tzdata/America/Indiana/Petersburg: - * library/tzdata/America/Indiana/Tell_City: - * library/tzdata/America/Indiana/Vincennes: - * library/tzdata/Antarctica/McMurdo: - * library/tzdata/Australia/Adelaide: - * library/tzdata/Australia/Broken_Hill: - * library/tzdata/Australia/Currie: - * library/tzdata/Australia/Hobart: - * library/tzdata/Australia/Lord_Howe: - * library/tzdata/Australia/Melbourne: - * library/tzdata/Australia/Sydney: - * library/tzdata/Pacific/Auckland: - * library/tzdata/Pacific/Chatham: Olson's tzdata2007g. - - * generic/tclListObj.c (TclLindexFlat): - * tests/lindex.test (lindex-17.[01]): Added code to detect the error - when a script does [lindex {} end foo]; an overaggressive optimisation - caused this call to return an empty object rather than an error. - -2007-09-03 Daniel Steffen - - * generic/tclObj.c (TclInitObjSubsystem): restore registration of the - "wideInt" Tcl_ObjType for compatibility with 8.4 extensions that - access the tclWideIntType Tcl_ObjType; add setFromAnyProc for - tclWideIntType. - -2007-09-02 Donal K. Fellows - - * doc/lsearch.n: Added note that order of results with the -all option - is that of the input list. It always was, but this makes it crystal. - -2007-08-30 Don Porter - - * generic/tclCompile.c: Added fflush() calls following all callers of - * generic/tclExecute.c: TclPrintByteCodeObj() so that tcl_traceCompile - output is less likely to get mangled when writes to stdout interleave - with other code. - -2007-08-28 Don Porter - - * generic/tclCompExpr.c: Use a table lookup in ParseLexeme() to - determine lexemes with single-byte representations. - - * generic/tclBasic.c: Used unions to better clarify overloading of - * generic/tclCompExpr.c: the fields of the OpCmdInfo and - * generic/tclCompile.h: TclOpCmdClientData structs. - -2007-08-27 Don Porter - - * generic/tclCompExpr.c: Call TclCompileSyntaxError() when - expression syntax errors are found when compiling expressions. With - this in place, convert TclCompileExpr to return void, since there's no - longer any need to report TCL_ERROR. - * generic/tclCompile.c: Update callers. - * generic/tclExecute.c: - - * generic/tclCompCmds.c: New routine TclCompileSyntaxError() - * generic/tclCompile.h: to directly compile bytecodes that report a - * generic/tclCompile.c: syntax error, rather than (ab)use a call to - TclCompileReturnCmd. Also, undo the most recent commit that papered - over some issues with that (ab)use. New routine produces a new opcode - INST_SYNTAX, which is a minor variation of INST_RETURN_IMM. Also a bit - of constification. - - * generic/tclCompile.c: Move the deallocation of local LiteralTable - * generic/tclCompExpr.c: entries into TclFreeCompileEnv(). - * generic/tclExecute.c: Update callers. - - * generic/tclCompExpr.c: Force numeric and boolean literals in - expressions to register with their intreps intact, even if that means - overwriting existing intreps in already registered literals. - -2007-08-25 Kevin B. Kenny - - * generic/tclExecute.c (TclExecuteByteCode): Added code to handle - * tests/expr.test (expr-23.48-53) integer exponentiation - that results in 32- and 64-bit integer results, avoiding calls to wide - integer exponentiation routines in this common case. [Bug 1767293] - - * library/clock.tcl (ParseClockScanFormat): Modified code to allow - * tests/clock.test (clock-60.*): case-insensitive matching - of time zone and month names. [Bug 1781282] - -2007-08-24 Don Porter - - * generic/tclCompExpr.c: Register literals found in expressions - * tests/compExpr.test: to restore literal sharing. Preserve numeric - intreps when literals are created for the first time. Correct memleak - in ExecConstantExprTree() and add test for the leak. - -2007-08-24 Miguel Sofer - - * generic/tclCompile.c: replaced copy loop that tripped some compilers - with memmove. [Bug 1780870] - -2007-08-23 Don Porter - - * library/init.tcl ([auto_load_index]): Delete stray "]" that created - an expr syntax error (masked by a [catch]). - - * generic/tclCompCmds.c (TclCompileReturnCmd): Added crash protection - to handle callers other than TclCompileScript() failing to meet the - initialization assumptions of the TIP 280 code in CompileWord(). - - * generic/tclCompExpr.c: Suppress the attempt to convert to - numeric when pre-compiling a constant expresion indicates an error. - -2007-08-22 Miguel Sofer - - * generic/tclExecute.c (TEBC): disable the new shortcut to frequent - INSTs for debug builds. REVERTED (collision with alternative fix) - -2007-08-21 Don Porter - - * generic/tclMain.c: Corrected the logic of dropping the last - * tests/main.test: newline from an interactively typed command. - [Bug 1775878] - -2007-08-21 Pat Thoyts - - * tests/thread.test: thread-4.4: clear ::errorInfo in the thread as a - message is left here from init.tcl on windows due to no tcl_pkgPath. - -2007-08-20 Miguel Sofer - - * generic/tclExecute.c (INST_SUB): fix usage of the new macro for - overflow detection in sums, adapt to subtraction. Lengthy comment - added. - -2007-08-19 Donal K. Fellows - - * generic/tclExecute.c (Overflowing, TclIncrObj, TclExecuteByteCode): - Encapsulate Miguel's last change in a more mnemonic macro. - -2007-08-19 Miguel Sofer - - * generic/tclExecute.c: changed the check for overflow in sums, - reducing objsize, number of branches and cache misses (according to - cachegrind). Non-overflow for s=a+b: - previous - ((a >= 0 || b >= 0 || s < 0) && (s >= 0 || b < 0 || a < 0)) - now - (((a^s) >= 0) || ((a^b) < 0)) - This expresses: "a and s have the same sign or else a and b have - different sign". - -2007-08-19 Donal K. Fellows - - * doc/interp.n (RESOURCE LIMITS): Added text to better explain why - time limits are described using absolute times. [Bug 1752148] - -2007-08-16 Miguel Sofer - - * generic/tclVar.c: improved localVarNameType caching to leverage - the new availability of Tcl_Obj in variable names, avoiding string - comparisons to verify that the cached value is usable. - - * generic/tclExecute.c: check the two most frequent instructions - before the switch. Reduces both runtime and obj size a tiny bit. - -2007-08-16 Don Porter - - * generic/tclCompExpr.c: Added a "constant" field to the OpNode - struct (again "free" due to alignment requirements) to mark those - subexpressions that are completely known at compile time. Enhanced - CompileExprTree() and its callers to precompute these constant - subexpressions at compile time. This resolves the issue raised in [Bug - 1564517]. - -2007-08-15 Donal K. Fellows - - * generic/tclIOUtil.c (TclGetOpenModeEx): Only set the O_APPEND flag - * tests/ioUtil.test (ioUtil-4.1): on a channel for the 'a' - mode and not for 'a+'. [Bug 1773127] - -2007-08-14 Miguel Sofer - - * generic/tclExecute.c (INST_INVOKE*): peephole opt, do not get the - interp's result if it will be pushed/popped. - -2007-08-14 Don Porter - - * generic/tclBasic.c: Use fully qualified variable names for - * tests/thread.test: ::errorInfo and ::errorCode so that string - * tests/trace.test: reported to variable traces are fully - qualified in agreement with Tcl 8.4 operations. - -2007-08-14 Daniel Steffen - - * unix/tclLoadDyld.c: use dlfcn API on Mac OS X 10.4 and later; fix - issues with loading from memory on intel and 64bit; add debug messages - - * tests/load.test: add test load-10.1 for loading from vfs. - - * unix/dltest/pkga.c: whitespace & comment cleanup, remove - * unix/dltest/pkgb.c: unused pkgf.c. - * unix/dltest/pkgc.c: - * unix/dltest/pkge.c: - * unix/dltest/pkgf.c (removed): - * unix/dltest/pkgua.c: - * macosx/Tcl.xcodeproj/project.pbxproj: - -2007-08-13 Don Porter - - * generic/tclExecute.c: Provide DECACHE/CACHE protection to the - * tests/trace.test: Tcl_LogCommandInfo() call. [Bug 1773040] - -2007-08-12 Miguel Sofer - - * generic/tclCmdMZ.c (Tcl_SplitObjCmd): use TclNewStringObj macro - instead of calling the function. - - * generic/tcl_Obj.c (TclAllocateFreeObjects): remove unneeded memset - to 0 of all allocated objects. - -2007-08-10 Miguel Sofer - - * generic/tclInt.h: remove redundant ops in TclNewStringObj macro. - -2007-08-10 Miguel Sofer - - * generic/tclInt.h: fix the TclSetVarNamespaceVar macro, was causing a - leak. - -2007-08-10 Don Porter - - * generic/tclCompExpr.c: Revise CompileExprTree() to use the - OpNode mark field scheme of tree traversal. This eliminates the need - to use magic values in the left and right fields for that purpose. - Also stop abusing the left field within ParseExpr() to store the - number of arguments in a parsed function call. CompileExprTree() now - determines that for itself at compile time. Then reorder code to - eliminate duplication. - -2007-08-09 Miguel Sofer - - * generic/tclProc.c (TclCreateProc): better comments on the required - varflag values when loading precompiled procs. - - * generic/tclExecute.c (INST_STORE_ARRAY): - * tests/trace.test (trace-2.6): whole array write traces on compiled - local variables were not firing. [Bug 1770591] - -2007-08-08 Jeff Hobbs - - * generic/tclProc.c (InitLocalCache): reference firstLocalPtr via - procPtr. codePtr->procPtr == NULL exposed by tbcload. - -2007-08-08 Don Porter - - * generic/tclExecute.c: Corrected failure to compile/link in the - -DNO_WIDE_TYPE configuration. - - * generic/tclExecute.c: Corrected improper use of bignum arguments to - * tests/expr.test: *SHIFT operations. [Bug 1770224] - -2007-08-07 Miguel Sofer - - * generic/tclInt.h: remove comments refering to VAR_SCALAR, as that - flag bit does not exist any longer. - * generic/tclProc.c (InitCompiledLocals): removed optimisation for - non-resolved case, as the function is never called in that case. - Renamed the function to InitResolvedLocals to calrify the point. - - * generic/tclInt.decls: Exporting via stubs to help xotcl adapt to - * generic/tclInt.h: VarReform. - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - -2007-08-07 Daniel Steffen - - * generic/tclEnv.c: improve environ handling on Mac OS X (adapted - * unix/tclUnixPort.h: from Apple changes in Darwin tcl-64). - - * unix/Makefile.in: add support for compile flags specific to - object files linked directly into executables. - - * unix/configure.in (Darwin): only use -seg1addr flag when prebinding; - use -mdynamic-no-pic flag for object files linked directly into exes; - support overriding TCL_PACKAGE_PATH/TCL_MODULE_PATH in environment. - - * unix/configure: autoconf-2.59 - -2007-08-06 Don Porter - - * tests/parseExpr.test: Update source file name of expr parser code. - - * generic/tclCompExpr.c: Added a "mark" field to the OpNode - struct, which is used to guide tree traversal. This field costs - nothing since alignement requirements used the memory already. - Rewrote ConvertTreeToTokens() to use the new field, which permitted - consolidation of utility routines CopyTokens() and - GenerateTokensForLiteral(). - -2007-08-06 Kevin B. Kenny - - * generic/tclGetDate.y: Added a cast to the definition of YYFREE to - silence compiler warnings. - * generic/tclDate.c: Regenerated - * win/tclWinTest.c: Added a cast to GetSecurityDescriptorDacl call - to silence compiler warnings. - -2007-08-04 Miguel Sofer - - * generic/tclInt.decls: Exporting via stubs to help itcl adapt to - * generic/tclInt.h: VarReform. Added localCache initialization - * generic/tclIntDecls.h: to TclInitCompiledLocals (which only exists - * generic/tclProc.c: for itcl). - * generic/tclStubInit.c: - * generic/tclVar.c: - -2007-08-01 Donal K. Fellows - - * library/word.tcl: Rewrote for greater efficiency. [Bug 1764318] - -2007-08-01 Pat Thoyts - - * generic/tclInt.h: Added a TclOffset macro ala Tk_Offset to - * generic/tclVar.c: abstract out 'offsetof' which may not be - * generic/tclExceute.c: defined (eg: msvc6). - -2007-08-01 Miguel Sofer - - * generic/tclVar.c (TclCleanupVar): fix [Bug 1765225], thx Larry - Virden. - -2007-07-31 Miguel Sofer - - * doc/Hash.3: - * generic/tclHash.c: - * generic/tclObj.c: - * generic/tclThreadStorage.c: (changes part of the patch below) - Stop Tcl_CreateHashVar from resetting hPtr->clientData to NULL after - calling the allocEntryProc for a custom table. - - * generic/tcl.h: - * generic/tclBasic.c: - * generic/tclCmdIL.c: - * generic/tclCompCmds.c: - * generic/tclCompile.c: - * generic/tclCompile.h: - * generic/tclExecute.c: - * generic/tclHash.c: - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclLiteral.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclProc.c: - * generic/tclThreadStorage.c: - * generic/tclTrace.c: - * generic/tclVar.c: VarReform [Patch 1750051] - - *** POTENTIAL INCOMPATIBILITY *** (tclInt.h and tclCompile.h) - Extensions that access internals defined in tclInt.h and/or - tclCompile.h may lose both binary and source compatibility. The - relevant changes are: - 1. 'struct Var' is completely changed, all acceses to its internals - (either direct or via the TclSetVar* and TclIsVar* macros) will - malfunction. Var flag values and semantics changed too. - 2. 'struct Bytecode' has an additional field that has to be - initialised to NULL - 3. 'struct Namespace' is larger, as the varTable is now one pointer - larger than a Tcl_HashTable. Direct access to its fields will - malfunction. - 4. 'struct CallFrame' grew one more field (the second such growth with - respect to Tcl8.4). - 5. API change for the functions TclFindCompiledLocal, TclDeleteVars - and many internal functions in tclVar.c - - Additionally, direct access to variable hash tables via the standard - Tcl_Hash* interface is to be considered as deprecated. It still works - in the present version, but will be broken by further specialisation - of these hash tables. This concerns especially the table of array - elements in an array, as well as the varTable field in the Namespace - struct. - -2007-07-31 Miguel Sofer - - * unix/configure.in: allow use of 'inline' in Tcl sources. [Patch - * win/configure.in: 1754128] - * win/makefile.vc: Regen with autoconf 2.61 - -2007-07-31 Donal K. Fellows - - * unix/tclUnixInit.c (TclpSetVariables): Use the thread-safe getpwuid - replacement to fill the tcl_platform(user) field as it is not subject - to spoofing. [Bug 681877] - - * unix/tclUnixCompat.c: Simplify the #ifdef logic. - - * unix/tclUnixChan.c (FileWatchProc): Fix test failures. - -2007-07-30 Donal K. Fellows - - * unix/tclUnixChan.c (SET_BITS, CLEAR_BITS): Added macros to make this - file clearer. - -2007-07-24 Miguel Sofer - - * generic/tclBasic.c (TEOvI, GetCommandSource): - * generic/tclExecute.c (TEBC, TclGetSrcInfoForCmd): - * generic/tclInt.h: - * generic/tclTrace.c (TclCheck(Interp|Execution)Traces): - Removed the need for TEBC to inspect the command before calling TEOvI, - leveraging the TIP 280 infrastructure. Moved the generation of a - correct nul-terminated command string away from the trace code, back - into TEOvI/GetCommandSource. - -2007-07-20 Andreas Kupries - - * library/platform/platform.tcl: Fixed bug in 'platform::patterns' - * library/platform/pkgIndex.tcl: where identifiers not matching - * unix/Makefile.in: the special linux and solaris forms would not - * win/Makefile.in: get 'tcl' as an acceptable platform added to - * doc/platform.n: the result. Bumped package to version 1.0.3 and - * doc/platform_shell.n: updated documentation and Makefiles. Also - fixed bad version info in the documentation of platform::shell. - -2007-07-19 Don Porter - - * generic/tclParse.c: In contexts where interp and parsePtr->interp - might be different, be sure to use the latter for error reporting. - Also pulled the interp argument back out of ParseTokens() since we - already had a parsePtr->interp to work with. - -2007-07-18 Don Porter - - * generic/tclCompExpr.c: Removed unused arguments and variables - -2007-07-17 Don Porter - - * generic/tclCompExpr.c (ParseExpr): While adding comments to - explain the operations of ParseExpr(), made significant revisions to - the code so it would be easier to explain, and in the process made the - code simpler and clearer as well. - -2007-07-15 Don Porter - - * generic/tclCompExpr.c: More commentary. - * tests/parseExpr.test: Several tests of syntax error messages - to check that when expression substrings are truncated they leave - visible the context relevant to the reported error. - -2007-07-12 Don Porter - - * generic/tclCompExpr.c: Factored out, corrected, and commented - common code for reporting syntax errors in LEAF elements. - -2007-07-11 Miguel Sofer - - * generic/tclCompCmds.c (TclCompileWhileCmd): - * generic/tclCompile.c (TclCompileScript): - Corrected faulty avoidance of INST_START_CMD when the first opcode in - a script is within a loop (as produced by 'while 1'), so that the - corresponding command is properly counted. [Bug 1752146] - -2007-07-11 Don Porter - - * generic/tclCompExpr.c: Added a "parseOnly" flag argument to - ParseExpr() to indicate whether the caller is Tcl_ParseExpr(), with an - end goal of filling a Tcl_Parse with Tcl_Tokens representing the - parsed expression, or TclCompileExpr() with the goal of compiling and - executing the expression. In the latter case, more aggressive - conversion of QUOTED and BRACED lexeme to literals is done. In the - former case, all such conversion is avoided, since Tcl_Token - production would revert it anyway. This enables simplifications to the - GenerateTokensForLiteral() routine as well. - -2007-07-10 Don Porter - - * generic/tclCompExpr.c: Added a field for operator precedence - to be stored directly in the parse tree. There's no memory cost to - this addition, since that memory would have been lost to alignment - issues anyway. Also, converted precedence definitions and lookup - tables to use symbolic constants instead of raw number for improved - readability, and continued extending/improving/correcting comments. - Removed some unused counter variables. Renamed some variables for - clarity and replaced some cryptic logic with more readable macros. - -2007-07-09 Don Porter - - * generic/tclCompExpr.c: Revision so that the END lexeme never - gets inserted into the parse tree. Later tree traversal never reaches - it since its location in the tree is not variable. Starting and - stopping with the START lexeme (node 0) is sufficient. Also finished - lexeme code commentary. - - * generic/tclCompExpr.c: Added missing creation and return of - the Tcl_Parse fields that indicate error conditions. [Bug 1749987] - -2007-07-05 Don Porter - - * library/init.tcl (unknown): Corrected inconsistent error message - in interactive [unknown] when empty command is invoked. [Bug 1743676] - -2007-07-05 Miguel Sofer - - * generic/tclNamesp.c (SetNsNameFromAny): - * generic/tclObj.c (SetCmdNameFromAny): Avoid unnecessary - ckfree/ckalloc when the old structs can be reused. - -2007-07-04 Miguel Sofer - - * generic/tclNamesp.c: Fix case where a FQ cmd or ns was being cached - * generic/tclObj.c: in a different interp, tkcon. [Bug 1747512] - -2007-07-03 Don Porter - - * generic/tclCompExpr.c: Revised #define values so that there - is now more expansion room to define more BINARY operators. - -2007-07-02 Donal K. Fellows - - * generic/tclHash.c (CompareStringKeys): Always use the strcmp() - version; the operation is functionally equivalent, the speed is - identical (up to measurement limitations), and yet the code is - simpler. [FRQ 951168] - -2007-07-02 Don Porter - - * generic/tcl.h: Removed TCL_PRESERVE_BINARY_COMPATIBILITY and - * generic/tclHash.c: any code enabled when it is set to 0. We will - * generic/tclStubInit.c: always want to preserve binary compat - of the structs that appear in the interface through the 8.* series of - releases, so it's pointless to drag around this never-enabled - alternative. - - * generic/tclIO.c: Removed dead code. - * unix/tclUnixChan.c: - - * generic/tclCompExpr.c: Removed dead code, old implementations - * generic/tclEvent.c: of expr parsing and compiling, including the - * generic/tclInt.h: routine TclFinalizeCompilation(). - -2007-06-30 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Plug a memory leak caused by a - missing Tcl_DecrRefCount on an error path. [Bug 1717186] - -2007-06-30 Zoran Vasiljevic - - * generic/tclThread.c: Prevent RemeberSyncObj() from growing the sync - object lists by reusing already free'd slots, if possible. See - discussion on Bug 1726873 for more information. - -2007-06-29 Donal K. Fellows - - * doc/DictObj.3 (Tcl_DictObjDone): Improved documentation of this - function to make it clearer how to use it. [Bug 1710795] - -2007-06-29 Daniel Steffen - - * generic/tclAlloc.c: on Darwin, ensure memory allocated by - * generic/tclThreadAlloc.c: the custom TclpAlloc()s is aligned to - 16 byte boundaries (as is the case with the Darwin system malloc). - - * generic/tclGetDate.y: use ckalloc/ckfree instead of malloc/free. - * generic/tclDate.c: bison 1.875e - - * generic/tclBasic.c (TclEvalEx): fix warnings. - - * macosx/Tcl.xcodeproj/project.pbxproj: better support for renamed tcl - * macosx/Tcl.xcodeproj/default.pbxuser: source dir; add 10.5 SDK build - * macosx/Tcl-Common.xcconfig: config; remove tclMathOp.c. - - * macosx/README: document Tcl.xcodeproj changes. - -2007-06-28 Don Porter - - * generic/tclBasic.c: Removed dead code, including the - * generic/tclExecute.c: entire file tclMathOp.c. - * generic/tclInt.h: - * generic/tclMathOp.c (removed): - * generic/tclTestObj.c: - * win/tclWinFile.c: - - * unix/Makefile.in: Updated to reflect deletion of tclMathOp.c. - * win/Makefile.in: - * win/makefile.bc: - * win/makefile.vc: - -2007-06-28 Pat Thoyts - - * generic/tclBasic.c: Silence constness warnings for TclStackFree - * generic/tclCompCmds.c: when building with msvc. - * generic/tclFCmd.c: - * generic/tclIOCmd.c: - * generic/tclTrace.c: - -2007-06-28 Miguel Sofer - - * generic/tclVar.c (UnsetVarStruct): fix possible segfault. - -2007-06-27 Don Porter - - * generic/tclTrace.c: Corrected broken trace reversal logic in - * generic/tclTest.c: TclCheckInterpTraces that led to infinite loop - * tests/trace.test: when multiple Tcl_CreateTrace traces were set - and one of them did not fire due to level restrictions. [Bug 1743931] - -2007-06-26 Don Porter - - * generic/tclBasic.c (TclEvalEx): Moved some arrays from the C - stack to the Tcl stack. - -2007-06-26 Miguel Sofer - - * generic/tclVar.c (UnsetVarStruct): more streamlining. - -2007-06-25 Don Porter - - * generic/tclExecute.c: Safety checks to avoid crashes in the - TclStack* routines when called with an incompletely initialized - interp. [Bug 1743302] - -2007-06-25 Miguel Sofer - - * generic/tclVar.c (UnsetVarStruct): fixing incomplete change, more - streamlining. - -2007-06-24 Miguel Sofer - - * generic/tclVar.c (TclDeleteCompiledLocalVars): removed inlining that - ended up not really optimising (limited benchmarks). Now calling - UnsetVarStruct (streamlined old code is #ifdef'ed out, in case better - benchmarks do show a difference). - - * generic/tclVar.c (UnsetVarStruct): fixed a leak introduced in last - commit. - -2007-06-23 Miguel Sofer - - * generic/tclVar.c (UnsetVarStruct, TclDeleteVars): made the logic - slightly clearer, eliminated some duplicated code. - - *** POTENTIAL INCOMPATIBILITY *** (tclInt.h and Var struct users) - The core never builds VAR_LINK variable to have traces. Such a - "monster", should one exist, will now have its unset traces called - *before* it is unlinked. - -2007-06-23 Daniel Steffen - - * macosx/tclMacOSXNotify.c (AtForkChild): don't call CoreFoundation - APIs after fork() on systems where that would lead to an abort(). - -2007-06-22 Don Porter - - * generic/tclExecute.c: Revised TclStackRealloc() signature to better - * generic/tclInt.h: parallel (and fall back on) Tcl_Realloc. - - * generic/tclNamesp.c (TclResetShadowesCmdRefs): Replaced - ckrealloc based allocations with TclStackRealloc allocations. - - * generic/tclCmdIL.c: More conversions to use TclStackAlloc. - * generic/tclScan.c: - -2007-06-21 Don Porter - - * generic/tclBasic.c: Move most instances of the Tcl_Parse struct - * generic/tclCompExpr.c: off the C stack and onto the Tcl stack. This - * generic/tclCompile.c: is a rather large struct (> 3kB). - * generic/tclParse.c: - -2007-06-21 Miguel Sofer - - * generic/tclBasic.c (TEOvI): Made sure that leave traces - * generic/tclExecute.c (INST_INVOKE): that were created during - * tests/trace.test (trace-36.2): execution of an originally - untraced command do not fire [Bug 1740962], partial fix. - -2007-06-21 Donal K. Fellows - - * generic/tcl.h, generic/tclCompile.h, generic/tclCompile.c: Remove - references in comments to obsolete {expand} notation. [Bug 1740859] - -2007-06-20 Miguel Sofer - - * generic/tclVar.c: streamline namespace vars deletion: only compute - the variable's full name if the variable is traced. - -2007-06-20 Don Porter - - * generic/tclInt.decls: Revised the interfaces of the routines - * generic/tclExecute.c: TclStackAlloc and TclStackFree to make them - easier for callers to use (or more precisely, harder to misuse). - TclStackFree now takes a (void *) argument which is the pointer - intended to be freed. TclStackFree will panic if that's not actually - the memory the call will free. TSA/TSF also now tolerate receiving - (interp == NULL), in which case they simply fall back to be calls to - Tcl_Alloc/Tcl_Free. - - * generic/tclIntDecls.h: make genstubs - - * generic/tclBasic.c: Updated callers - * generic/tclCmdAH.c: - * generic/tclCmdIL.c: - * generic/tclCompCmds.c: - * generic/tclCompExpr.c: - * generic/tclCompile.c: - * generic/tclFCmd.c: - * generic/tclFileName.c: - * generic/tclIOCmd.c: - * generic/tclIndexObj.c: - * generic/tclInterp.c: - * generic/tclNamesp.c: - * generic/tclProc.c: - * generic/tclTrace.c: - * unix/tclUnixPipe.c: - -2007-06-20 Jeff Hobbs - - * tools/tcltk-man2html.tcl: revamp of html doc output to use CSS, - standardized headers, subheaders, dictionary sorting of names. - -2007-06-18 Jeff Hobbs - - * tools/tcltk-man2html.tcl: clean up copyright merging and output. - clean up coding constructs. - -2007-06-18 Miguel Sofer - - * generic/tclCmdIL.c (InfoFrameCmd): - * generic/tclCmdMZ.c (Tcl_SwitchObjCmd): - * generic/tclCompile.c (TclInitCompileEnv): - * generic/tclProc.c (Tcl_ProcObjCmd, SetLambdaFromAny): Moved the - CmdFrame off the C stack and onto the Tcl stack. - - * generic/tclExecute.c (TEBC): Moved the CmdFrame off the C stack and - onto the Tcl stack, between the catch and the execution stacks - -2007-06-18 Don Porter - - * generic/tclBasic.c (TclEvalEx,TclEvalObjEx): Moved the CmdFrame off - the C stack and onto the Tcl stack. - -2007-06-17 Donal K. Fellows - - * generic/tclProc.c (TclObjInterpProcCore): Minor fixes to make - * generic/tclExecute.c (TclExecuteByteCode): compilation debugging - builds work again. [Bug 1738542] - -2007-06-16 Donal K. Fellows - - * generic/tclProc.c (TclObjInterpProcCore): Use switch instead of a - chain of if's for a modest performance gain and a little more clarity. - -2007-06-15 Miguel Sofer - - * generic/tclCompCmds.c: Simplified [variable] compiler and executor. - * generic/tclExecute.c: Missed updates to "there is always a valid - frame". - - * generic/tclCompile.c: reverted TclEvalObjvInternal and INST_INVOKE - * generic/tclExecute.c: to essentially what they were previous to the - * generic/tclBasic.c: commit of 2007-04-03 [Patch 1693802] and the - subsequent optimisations, as they break the new trace tests described - below. - - * generic/trace.test: added tests 36 to 38 for dynamic trace creation - and addition. These tests expose a change in dynamics due to a recent - round of optimisations. The "correct" behaviour is not described in - docs nor TIP 62. - -2007-06-14 Miguel Sofer - - * generic/tclInt.decls: Modif to the internals of TclObjInterpProc - * generic/tclInt.h: to reduce stack consumption and improve task - * generic/tclIntDecls.h: separation. Changes the interface of - * generic/tclProc.c: TclObjInterpProcCore (patching TclOO - simultaneously). - - * generic/tclProc.c (TclObjInterpProcCore): simplified obj management - in wrongNumArgs calls. - -2007-06-14 Don Porter - - * generic/tclCompile.c: SetByteCodeFromAny() can no longer return any - * generic/tclExecute.c: code other than TCL_OK, so remove code that - * generic/tclProc.c: formerly handled exceptional codes. - -2007-06-13 Miguel Sofer - - * generic/tclExecute.c (TclCompEvalObj): missed update to "there is - always a valid frame". - - * generic/tclProc.c (TclObjInterpProcCore): call TEBC directly instead - of going through TclCompEvalObj - no need to check the compilation's - freshness, this has already been done. This improves speed and should - also provide some relief to [Bug 1066755]. - -2007-06-12 Donal K. Fellows - - * generic/tclBasic.c (Tcl_CreateInterp): Turn the [info] command into - * generic/tclCmdIL.c (TclInitInfoCmd): an ensemble, making it easier - for third-party code to plug into. - - * generic/tclIndexObj.c (Tcl_WrongNumArgs): - * generic/tclNamesp.c, generic/tclInt.h (tclEnsembleCmdType): Make - Tcl_WrongNumArgs do replacement correctly with ensembles and other - sorts of complex replacement strategies. - -2007-06-11 Miguel Sofer - - * generic/tclExecute.c: comments added to explain iPtr->numLevels - management. - - * generic/tclNamesp.c: tweaks to Tcl_GetCommandFromObj and - * generic/tclObj.c: TclGetNamespaceFromObj; modified the usage of - structs ResolvedCmdName and ResolvedNsname so that the field refNsPtr - is NULL for fully qualified names. - -2007-06-10 Miguel Sofer - - * generic/tclBasic.c: Further TEOvI split, creating a new - * generic/tclCompile.h: TclEvalObjvKnownCommand() function to handle - * generic/tclExecute.c: commands that are already known and are not - traced. INST_INVOKE now calls into this function instead of inlining - parts of TEOvI. Same perf, better isolation. - - ***POTENTIAL INCOMPAT*** There is a subtle issue with the timing of - execution traces that is changed here - first change appeared in my - commit of 2007-04-03 [Patch 1693802], which caused some divergence - between compiled and non-compiled code. - ***THIS CHANGE IS UNDER REVIEW*** - -2007-06-10 Jeff Hobbs - - * README: updated links. [Bug 1715081] - - * generic/tclExecute.c (TclExecuteByteCode): restore support for - INST_CALL_BUILTIN_FUNC1 and INST_CALL_FUNC1 bytecodes to support 8.4- - precompiled sources (math functions). [Bug 1720895] - -2007-06-10 Miguel Sofer - - * generic/tclInt.h: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclvar.c: new macros TclGetCurrentNamespace() and - TclGetGlobalNamespace(); Tcl_GetCommandFromObj and - TclGetNamespaceFromObj rewritten to make the logic clearer; slightly - faster too. - -2007-06-09 Miguel Sofer - - * generic/tclExecute.c (INST_INVOKE): isolated two vars to the small - block where they are actually used. - - * generic/tclObj.c (Tcl_GetCommandFromObj): rewritten to make the - logic clearer; slightly faster too. - - * generic/tclBasic.c: Split TEOv in two, by separating a processor - for non-TCL_OK returns. Also split TEOvI in a full version that - handles non-existing and traced commands, and a separate shorter - version for the regular case. - - * generic/tclBasic.c: Moved the generation of command strings for - * generic/tclTrace.c: traces: previously in Tcl_EvalObjv(), now in - TclCheck[Interp|Execution]Traces(). Also insured that the strings are - properly NUL terminated at the correct length. [Bug 1693986] - - ***POTENTIAL INCOMPATIBILITY in internal API*** - The functions TclCheckInterpTraces() and TclCheckExecutionTraces() (in - internal stubs) used to be noops if the command string was NULL, this - is not true anymore: if the command string is NULL, they generate an - appropriate string from (objc,objv) and use it to call the traces. The - caller might as well not call them with a NULL string if he was - expecting a noop. - - * generic/tclBasic.c: Extend usage of TclLimitReady() and - * generic/tclExecute.c: (new) TclLimitExceeded() macros. - * generic/tclInt.h: - * generic/tclInterp.c: - - * generic/tclInt.h: New TclCleanupCommandMacro for core usage. - * generic/tclBasic.c: - * generic/tclExecute.c: - * generic/tclObj.c: - -2007-06-09 Daniel Steffen - - * macosx/Tcl.xcodeproj/project.pbxproj: add new Tclsh-Info.plist.in. - -2007-06-08 Donal K. Fellows - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Changed [string first] and - * doc/string.n: [string last] so that they have clearer descriptions - for those people who know the adage about needles and haystacks. This - follows suggestions on comp.lang.tcl... - -2007-06-06 Miguel Sofer - - * generic/tclParse.c: fix for uninit read. [Bug 1732414] - -2007-06-06 Daniel Steffen - - * macosx/Tcl.xcodeproj/project.pbxproj: add settings for Fix&Continue. - - * unix/configure.in (Darwin): add plist for tclsh; link the - * unix/Makefile.in (Darwin): Tcl and tclsh plists into - * macosx/Tclsh-Info.plist.in (new): their binaries in all cases. - * macosx/Tcl-Common.xcconfig: - - * unix/tcl.m4 (Darwin): fix CF checks in fat 32&64bit builds. - * unix/configure: autoconf-2.59 - -2007-06-05 Don Porter - - * generic/tclBasic.c: Added interp flag value ERR_LEGACY_COPY to - * generic/tclInt.h: control the timing with which the global - * generic/tclNamesp.c: variables ::errorCode and ::errorInfo get - * generic/tclProc.c: updated after an error. This keeps more - * generic/tclResult.c: precise compatibility with Tcl 8.4. - * tests/result.test (result-6.2): [Bug 1649062] - -2007-06-05 Miguel Sofer - - * generic/tclInt.h: - * generic/tclExecute.c: Tcl-stack reform, [Patch 1701202] - -2007-06-03 Daniel Steffen - - * unix/Makefile.in: add datarootdir to silence autoconf-2.6x warning. - -2007-05-30 Don Porter - - * generic/tclBasic.c: Removed code that dealt with - * generic/tclCompile.c: TCL_TOKEN_EXPAND_WORD tokens representing - * generic/tclCompile.h: expanded literal words. These sections were - mostly in place to enable [info frame] to discover line information in - expanded literals. Since the parser now generates a token for each - post-expansion word referring to the right location in the original - script string, [info frame] gets all the data it needs. - - * generic/tclInt.h: Revised the parser so that it never produces - * generic/tclParse.c: TCL_TOKEN_EXPAND_WORD tokens when parsing an - * tests/parse.test: expanded literal word; that is, something like - {*}{x y z}. Instead, generate the series of TCL_TOKEN_SIMPLE_WORD - tokens to represent the words that expansion of the literal string - produces. [RFE 1725186] - -2007-05-29 Jeff Hobbs - - * unix/tclUnixThrd.c (Tcl_JoinThread): fix for 64-bit handling of - pthread_join exit return code storage. [Bug 1712723] - -2007-05-22 Don Porter - - [core-stabilizer-branch] - - * unix/configure: autoconf-2.59 (FC6 fork) - * win/configure: - - * README: Bump version number to 8.5b1 - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - -2007-05-18 Don Porter - - * unix/configure: autoconf-2.59 (FC6 fork) - * win/configure: - - * README: Bump version number to 8.5a7 - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * generic/tclParse.c: Disable and remove the ALLOW_EXPAND sections - * tests/info.test: that continued to support the deprecated - * tests/mathop.test: {expand} syntax. Updated the few remaining - users of that syntax in the test suite. - -2007-05-17 Donal K. Fellows - - * generic/tclExecute.c (TclLimitReady): Created a macro version of - Tcl_LimitReady just for TEBC, to reduce the amount of times that the - bytecode engine calls out to external functions on the critical path. - * generic/tclInterp.c (Tcl_LimitReady): Added note to remind anyone - doing maintenance that there is a macro version to update. - -2007-05-17 Daniel Steffen - - * generic/tcl.decls: workaround 'make checkstubs' failures from - tclStubLib.c MODULE_SCOPE revert. [Bug 1716117] - -2007-05-16 Joe English - - * generic/tclStubLib.c: Change Tcl_InitStubs(), tclStubsPtr, and the - auxilliary stubs table pointers back to public visibility. - - These symbols need to be exported so that stub-enabled extensions may - be statically linked into an extended tclsh or Big Wish with a - dynamically-linked libtcl. [Bug 1716117] - -2007-05-15 Don Porter - - * win/configure: autoconf-2.59 (FC6 fork) - - * library/reg/pkgIndex.tcl: Bump to registry 1.2.1 to account for - * win/configure.in: [Bug 1682211] fix. - * win/makefile.bc: - * win/tclWinReg.c: - -2007-05-11 Pat Thoyts - - * generic/tclInt.h: Removed TclEvalObjEx and TclGetSrcInfoForPc from - tclInt.h now they are in the internal stubs table. - -2007-05-09 Don Porter - - * generic/tclInt.h: TclFinalizeThreadAlloc() is always defined, so - make sure it is also always declared (with MODULE_SCOPE). - -2007-05-09 Daniel Steffen - - * generic/tclInt.h: fix warning when building threaded with -DPURIFY. - - * macosx/Tcl.xcodeproj/project.pbxproj: add 'DebugUnthreaded' & - * macosx/Tcl.xcodeproj/default.pbxuser: 'DebugLeaks' configs and env - var settings needed to run the 'leaks' tool. - -2007-05-07 Don Porter - - [Tcl Bug 1706140] - - * generic/tclLink.c (LinkTraceProc): Update Tcl_VarTraceProcs so - * generic/tclNamesp.c (Error*Read): they call Tcl_InterpDeleted() - * generic/tclTrace.c (Trace*Proc): for themselves, and do not - * generic/tclUtil.c (TclPrecTraceProc): rely on (frequently buggy) - setting of the TCL_INTERP_DESTROYED flag by the trace core. - - * generic/tclVar.c: Update callers of TclCallVarTraces to not pass - in the TCL_INTERP_DESTROYED flag. Also apply filters so that public - routines only pass documented flag values down to lower level routines - - * generic/tclTrace.c (TclCallVarTraces): The setting of the - TCL_INTERP_DESTROYED flag is now done entirely within the - TclCallVarTraces routine, the only place it can be done right. - -2007-05-06 Donal K. Fellows - - * generic/tclInt.h (ExtraFrameInfo): Create a new mechanism for - * generic/tclCmdIL.c (InfoFrameCmd): conveying what information needs - to be added to the results of [info frame] to replace the hack that - was there before. - * generic/tclProc.c (Tcl_ApplyObjCmd): Use the new mechanism for the - [apply] command, the only part of Tcl itself that needs it (so far). - - * generic/tclInt.decls (TclEvalObjEx, TclGetSrcInfoForPc): Expose - these two functions through the internal stubs table, necessary for - extensions that need to integrate deeply with TIP#280. - -2007-05-05 Donal K. Fellows - - * win/tclWinFile.c (TclpGetUserHome): Squelch type-pun warnings in - * win/tclWinInit.c (TclpSetVariables): Win-specific code not found - * win/tclWinReg.c (AppendSystemError): during earlier work on Unix. - -2007-05-04 Kevin B. Kenny - - * generic/tclIO.c (TclFinalizeIOSubsystem): Added an initializer to - silence a spurious gcc warning about use of an uninitialized - variable. - * tests/encoding.test: Modified so that encoding tests happen in a - private namespace, to avoid polluting the global one. This problem was - discovered when running the test suite '-singleproc 1 -skip exec.test' - because the 'path' variable in encoding.test conflicted with the one - in io.test. - * tests/io.test: Made more of the working variables private to the - namespace. - -2007-05-02 Kevin B. Kenny - - * generic/tclTest.c (SimpleMatchInDirectory): Corrected a refcount - imbalance that affected the filesystem-[147]* tests in the test suite. - Thanks to Don Porter for the patch. [Bug 1710707] - * generic/tclPathObj.c (Tcl_FSJoinPath, Tcl_FSGetNormalizedPath): - Corrected several memory leaks that caused refcount imbalances - resulting in memory leaks on Windows. Thanks to Joe Mistachkin for the - patch. - -2007-05-01 Miguel Sofer - - * generic/tclVar.c (TclPtrSetVar): fixed leak whenever newvaluePtr had - refCount 0 and was used for appending (but not lappending). Thanks to - mistachkin and kbk. [Bug 1710710] - -2007-05-01 Kevin B. Kenny - - * generic/tclIO.c (DeleteChannelTable): Made changes so that - DeleteChannelTable tries to close all open channels, not just the - first. [Bug 1710285] - * generic/tclThread.c (TclFinalizeSynchronization): Make sure that TSD - blocks get freed on non-threaded builds. [Bug 1710825] - * tests/utf.test (utf-25.1--utf-25.4): Modified tests to clean up - after the 'testobj' extension to avoid spurious reports of memory - leaks. - -2007-05-01 Don Porter - - * generic/tclCmdMZ.c (STR_MAP): When [string map] has a pure dict map, - a missing Tcl_DictObjDone() call led to a memleak. [Bug 1710709] - -2007-04-30 Daniel Steffen - - * unix/Makefile.in: add 'tclsh' dependency to install targets that - rely on tclsh, fixes parallel 'make install' from empty build dir. - -2007-04-30 Andreas Kupries - - * generic/tclIO.c (FixLevelCode): Corrected reference count - mismanagement of newlevel, newcode. Changed to allocate the Tcl_Obj's - as late as possible, and only when actually needed. [Bug 1705778, leak - K29] - -2007-04-30 Kevin B. Kenny - - * generic/tclProc.c (Tcl_ProcObjCmd, SetLambdaFromAny): Corrected - reference count mismanagement on the name of the source file in the - TIP 280 code. [Bug 1705778, leak K02 among other manifestations] - -2007-04-25 Donal K. Fellows - - *** 8.5a6 TAGGED FOR RELEASE *** - - * generic/tclProc.c (TclObjInterpProcCore): Only allocate objects for - error message generation when associated with argument names that are - really used. [Bug 1705778, leak K15] - -2007-04-25 Kevin B. Kenny - - * generic/tclIOUtil.c (Tcl_FSChdir): Changed the memory management so - that the path returned from Tcl_FSGetNativePath is not duplicated - before being stored as the current directory, to avoid a memory leak. - [Bug 1705778, leak K01 among other manifestations] - -2007-04-25 Don Porter - - * generic/tclCompExpr.c (ParseExpr): Revised to be sure that an - error return doesn't prevent all literals getting placed on the - litList to be returned to the caller for freeing. Corrects some - memleaks. [Bug 1705778, leak K23] - -2007-04-25 Daniel Steffen - - * unix/Makefile.in (dist): add macosx/*.xcconfig files to src dist; - copy license.terms to dist macosx dir; fix autoheader bits. - -2007-04-24 Miguel Sofer - - * generic/tclListObj.c: reverting [Patch 738900] (committed on - 2007-04-20). Causes some Tk test breakage of unknown importance, but - the impact of the patch itself is likely to be so small that it does - not warrant investigation at this time. - -2007-04-24 Donal K. Fellows - - * generic/tclDictObj.c (DictKeysCmd): Rewrote so that the lock on the - internal representation of a dict is only set when necessary. [Bug - 1705778, leak K04] - (DictFilterCmd): Added code to drop the lock in the trivial match - case. [Bug 1705778, leak K05] - -2007-04-24 Kevin B. Kenny - - * generic/tclBinary.c: Addressed several code paths where the error - return from the 'binary format' command leaked the result buffer. - * generic/tclListObj.c (TclLsetFlat): Fixed a bug where the new list - under construction was leaked in the error case. [Bug 1705778, leaks - K13 and K14] - -2007-04-24 Jeff Hobbs - - * unix/Makefile.in (dist): add platform library package to src dist - -2007-04-24 Don Porter - - * generic/tclCompExpr.c (ParseExpr): Memory leak in error case; the - literal Tcl_Obj was not getting freed. [Bug 1705778, leak #1 (new)] - - * generic/tclNamesp.c (Tcl_DeleteNamespace): Corrected flaw in the - flag marking scheme to be sure that global namespaces are freed when - their interp is deleted. [Bug 1705778] - -2007-04-24 Kevin B. Kenny - - * generic/tclExecute.c (TclExecuteByteCode): Plugged six memory leaks - in bignum arithmetic. - * generic/tclIOCmd.c (Tcl_ReadObjCmd): Plugged a leak of the buffer - object if the physical read returned an error and the bypass area had - no message. - * generic/tclIORChan.c (TclChanCreateObjCmd): Plugged a leak of the - return value from the "initialize" method of a channel handler. - (All of the above under [Bug 1705778]) - -2007-04-23 Daniel Steffen - - * generic/tclCkalloc.c: fix warnings from gcc build configured with - * generic/tclCompile.c: --enable-64bit --enable-symbols=all. - * generic/tclExecute.c: - - * unix/tclUnixFCmd.c: add workaround for crashing bug in fts_open() - * unix/tclUnixInit.c: without FTS_NOSTAT on 64bit Darwin 8 or earlier. - - * unix/tclLoadDyld.c (TclpLoadMemory): fix (void*) arithmetic. - - * macosx/Tcl-Common.xcconfig: enable more warnings. - - * macosx/Tcl.xcodeproj/project.pbxproj: add 'DebugMemCompile' build - configuration that calls configure with --enable-symbols=all; override - configure check for __attribute__((__visibility__("hidden"))) in Debug - configuration to restore availability of ZeroLink. - - * macosx/tclMacOSXNotify.c: fix warnings. - - * macosx/tclMacOSXFCmd.c: const fixes. - - * macosx/Tcl-Common.xcconfig: fix whitespace. - * macosx/Tcl-Debug.xcconfig: - * macosx/Tcl-Release.xcconfig: - * macosx/README: - - * macosx/GNUmakefile: fix/add copyright and license refs. - * macosx/tclMacOSXBundle.c: - * macosx/Tcl-Info.plist.in: - * macosx/Tcl.xcode/project.pbxproj: - * macosx/Tcl.xcodeproj/project.pbxproj: - - * unix/configure.in: install license.terms into Tcl.framework. - * unix/configure: autoconf-2.59 - -2007-04-23 Don Porter - - * generic/tclVar.c (UnsetVarStruct): Make sure the - TCL_INTERP_DESTROYED flags gets passed to unset trace routines so they - can respond appropriately. [Bug 1705778, leak #9] - -2007-04-23 Miguel Sofer - - * generic/tclCompile.c (TclFreeCompileEnv): Tip 280's new field - extCmdMapPtr was not being freed. [Bug 1705778, leak #1] - -2007-04-23 Kevin B. Kenny - - * generic/tclCompCmds.c (TclCompileUpvarCmd): Plugged a memory leak in - 'upvar' when compiling (a) upvar outside a proc, (b) upvar with a - syntax error, or (c) upvar where the frame index is not known at - compile time. - * generic/tclCompExpr.c (ParseExpr): Plugged a memory leak when - parsing expressions that contain syntax errors. - * generic/tclEnv.c (ReplaceString): Clear memory correctly when - growing the cache to avoid reads of uninitialised data. - * generic/tclIORChan.c (TclChanCreateObjCmd, FreeReflectedChannel): - Plugged two memory leaks. - * generic/tclStrToD.c (AccumulateDecimalDigit): Fixed a mistake where - we'd run beyond the end of the 'pow10_wide' array if a number begins - with a string of more than 'maxpow10_wide' zeroes. - * generic/tclTest.c (Testregexpobjcmd): Removed an invalid access - beyond the end of 'objv' in 'testregexp -about'. - All of these issues reported under [Bug 1705778] - detected with the - existing test suite, no new regression tests required. - -2007-04-22 Miguel Sofer - - * generic/tclVar.c (TclDeleteNamespaceVars): fixed access to freed - memory detected by valgrind: Tcl_GetCurrentNamespace was being - called after freeing root CallFrame (on interp deletion). - -2007-04-20 Miguel Sofer - - * generic/tclListObj.c (SetListFromAny): avoid discarding internal - reps of objects converted to singleton lists. [Patch 738900] - -2007-04-20 Kevin B. Kenny - - * doc/clock.n: Corrected a silly error (transposed 'uppercase' and - 'lowercase' in clock.n. [Bug 1656002] - Clarified that [clock scan] does not recognize a locale's alternative - calendar. - Deleted an entirely superfluous (and also incorrect) remark about the - effect of Daylight Saving Time on relative times in [clock scan]. [Bug - 1582951] - * library/clock.tcl: Corrected an error in skipping over the %Ey field - on input. - * library/msgs/ja.msg: - * tools/loadICU.tcl: Corrected several localisation faults in the - Japanese locale (most notably, incorrect dates for the Emperors' - eras). Many thanks to SourceForge user 'nyademo' for pointing this out - and developing a fix. [Bug 1637471] - * generic/tclPathObj.c: Corrected a 'const'ness fault that caused - bitter complaints from MSVC. - * tests/clock.test (clock-40.1, clock-58.1, clock-59.1): Corrected a - test case that depended on ":localtime" being able to handle dates - prior to the Posix epoch. [Bug 1618445] Added a test case for the - dates of the Japanese emperors. [Bug 1637471] Added a regression test - for military time zone input conversion. [Bug 1586828] - * generic/tclGetDate.y (MilitaryTable): Fixed an ancient bug where the - military NZA time zones had the signs reversed. [Bug 1586828] - * generic/tclDate.c: Regenerated. - * doc/Notifier.3: Documented Tcl_SetNotifier and Tcl_ServiceModeHook. - Quite against my better judgment. [Bug 414933] - * generic/tclBasic.c, generic/tclCkalloc.c, generic/tclClock.c: - * generic/tclCmdIL.c, generic/tclCmdMZ.c, generic/tclFCmd.c: - * generic/tclFileName.c, generic/tclInterp.c, generic/tclIO.c: - * generic/tclIOUtil.c, generic/tclNamesp.c, generic/tclObj.c: - * generic/tclPathObj.c, generic/tclPipe.c, generic/tclPkg.c: - * generic/tclResult.c, generic/tclTest.c, generic/tclTestObj.c: - * generic/tclVar.c, unix/tclUnixChan.c, unix/tclUnixTest.c: - * win/tclWinLoad.c, win/tclWinSerial.c: Replaced commas in varargs - with string concatenation where possible. [Patch 1515234] - * library/tzdata/America/Tegucigalpa: - * library/tzdata/Asia/Damascus: Olson's tzdata 2007e. - -2007-04-19 Donal K. Fellows - - * generic/regcomp.c, generic/regc_cvec.c, generic/regc_lex.c, - * generic/regc_locale.c: Improve the const-correctness of the RE - compiler. - -2007-04-18 Miguel Sofer - - * generic/tclExecute.c (INST_LSHIFT): fixed a mistake introduced in - version 1.266 ('=' became '=='), which effectively turned the block - that handles native shifts into dead code. This explains why the - testsuite did not pick this mistake. Rewrote to make the intention - clear. - - * generic/tclInt.h (TclDecrRefCount): change the order of the - branches, use empty 'if ; else' to handle use in unbraced outer - if/else conditions (as already done in tcl.h) - - * generic/tclExecute.c: slight changes in Tcl_Obj management. - -2007-04-17 Kevin B. Kenny - - * library/clock.tcl: Fixed the naming of - ::tcl::clock::ReadZoneinfoFile because (yoicks!) it was in the global - namespace. - * doc/clock.n: Clarified the cases in which legacy time zone is - recognized. [Bug 1656002] - -2007-04-17 Miguel Sofer - - * generic/tclExecute.c: fixed checkInterp logic [Bug 1702212] - -2007-04-16 Donal K. Fellows - - * various (including generic/tclTest.c): Complete the purge of K&R - function definitions from manually-written code. - -2007-04-15 Kevin B. Kenny - - * generic/tclCompCmds.c: added a cast to silence a compiler error on - VC2005. - * library/clock.tcl: Restored unique-prefix matching of keywords on - the [clock] command. [Bug 1690041] - * tests/clock.test: Added rudimentary test cases for unique-prefix - matching of keywords. - -2007-04-14 Miguel Sofer - - * generic/tclExecute.c: removed some code at INST_EXPAND_SKTOP that - duplicates functionality already present at checkForCatch. - -2007-04-12 Miguel Sofer - - * generic/tclExecute.c: new macros OBJ_AT_TOS, OBJ_UNDER_TOS, - OBJ_AT_DEPTH(n) and CURR_DEPTH that remove all direct references to - tosPtr from TEBC (after initialisation and the code at the label - cleanupV_pushObjResultPtr). - -2007-04-11 Miguel Sofer - - * generic/tclCompCmds.c: moved all exceptDepth management to the - macros - the decreasing half was managed by hand. - -2007-04-10 Donal K. Fellows - - * generic/tclInt.h (TclNewLiteralStringObj): New macro to make - allocating literal string objects (i.e. objects whose value is a - constant string) easier and more efficient, by allowing the omission - of the length argument. Based on [Patch 1529526] (afredd) - * generic/*.c: Make use of this (in many files). - -2007-04-08 Miguel Sofer - - * generic/tclCompile (tclInstructionTable): Fixed bugs in description - of dict instructions. - -2007-04-07 Miguel Sofer - - * generic/tclCompile (tclInstructionTable): Fixed bug in description - of INST_START_COMMAND. - - * generic/tclExecute.c (TEBC): Small code reduction. - -2007-04-06 Miguel Sofer - - * generic/tclExecute.c (TEBC): - * generic/tclNamespace.c (NsEnsembleImplementationCmd): - * generic/tclProc.c (InitCompiledLocals, ObjInterpProcEx) - (TclObjInterpProcCore, ProcCompileProc): Code reordering to reduce - branching and improve branch prediction (assume that forward branches - are typically not taken). - -2007-04-03 Miguel Sofer - - * generic/tclExecute.c: INST_INVOKE optimisation. [Patch 1693802] - -2007-04-03 Don Porter - - * generic/tclNamesp.c: Revised ErrorCodeRead and ErrorInfoRead trace - routines so they guarantee the ::errorCode and ::errorInfo variable - always appear to exist. [Bug 1693252] - -2007-04-03 Miguel Sofer - - * generic/tclInt.decls: Moved TclGetNamespaceFromObj() to the - * generic/tclInt.h: internal stubs table; regen. - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - -2007-04-02 Miguel Sofer - - * generic/tclBasic.c: Added bytecode compilers for the variable - * generic/tclCompCmds.c: linking commands: 'global', 'variable', - * generic/tclCompile.h: 'upvar', 'namespace upvar' [Patch 1688593] - * generic/tclExecute.c: - * generic/tclInt.h: - * generic/tclVar.c: - -2007-04-02 Don Porter - - * generic/tclBasic.c: Replace arrays on the C stack and ckalloc - * generic/tclExecute.c: calls with TclStackAlloc calls to use memory - * generic/tclFCmd.c: on Tcl's evaluation stack. - * generic/tclFileName.c: - * generic/tclIOCmd.c: - * generic/tclIndexObj.c: - * generic/tclInterp.c: - * generic/tclNamesp.c: - * generic/tclTrace.c: - * unix/tclUnixPipe.c: - -2007-04-01 Donal K. Fellows - - * generic/tclCompile.c (TclCompileScript, TclPrintInstruction): - * generic/tclExecute.c (TclExecuteByteCode): Changed the definition of - INST_START_CMD so that it knows how many commands start at the current - location. This makes the interpreter command counter correct without - requiring a large number of instructions to be issued. (See my change - from 2007-01-19 for what triggered this.) - -2007-03-30 Don Porter - - * generic/tclCompile.c: - * generic/tclCompExpr.c: - * generic/tclCompCmds.c: Replace arrays on the C stack and - ckalloc calls with TclStackAlloc calls to use memory on Tcl's - evaluation stack. - - * generic/tclCmdMZ.c: Revised [string to* $s $first $last] - implementation to reduce number of allocs/copies. - - * tests/string.test: More [string reverse] tests. - -2007-03-30 Miguel Sofer - - * generic/tclExecute.c: optimise the lookup of elements of indexed - arrays. - -2007-03-29 Miguel Sofer - - * generic/tclProc.c (Tcl_ApplyObjCmd): - * tests/apply.test (9.3): Fixed Tcl_Obj leak on error return; an - unneeded ref to lambdaPtr was being set and not released on an error - return path. - -2007-03-28 Don Porter - - * generic/tclCmdMZ.c (STR_REVERSE): Implement the actual [string - reverse] command in terms of the new TclStringObjReverse() routine. - - * generic/tclInt.h (TclStringObjReverse): New internal routine - * generic/tclStringObj.c (TclStringObjReverse): that implements the - [string reverse] operation, making use of knowledge/surgery of the - String intrep to minimize the number of allocs and copies needed to do - the job. - -2007-03-27 Don Porter - - * generic/tclCmdMZ.c (STR_MAP): Replace ckalloc calls with - TclStackAlloc calls. - -2007-03-24 Zoran Vasiljevic - - * win/tclWinThrd.c: Thread exit handler marks the current thread as - un-initialized. This allows exit handlers that are registered later to - re-initialize this subsystem in case they need to use some sync - primitives (cond variables) from this file again. - -2007-03-23 Miguel Sofer - - * generic/tclBasic.c (DeleteInterpProc): pop the root frame pointer - before deleting the global namespace [Bug 1658572] - -2007-03-23 Kevin B. Kenny - - * win/Makefile.in: Added code to keep a Cygwin path name from leaking - into LIBRARY_DIR when doing 'make test' or 'make runtest'. - -2007-03-22 Don Porter - - * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Replaced arrays on the - C stack and ckalloc calls with TclStackAlloc calls to use memory on - Tcl's evaluation stack. - - * generic/tclExecute.c: Revised GrowEvaluationStack to take an - argument specifying the growth required by the caller, so that a - single reallocation / copy is the most that will ever be needed even - when required growth is large. - -2007-03-21 Don Porter - - * generic/tclExecute.c: More ckalloc -> ckrealloc conversions. - * generic/tclLiteral.c: - * generic/tclNamesp.c: - * generic/tclParse.c: - * generic/tclPreserve.c: - * generic/tclStringObj.c: - * generic/tclUtil.c: - -2007-03-20 Don Porter - - * generic/tclEnv.c: Some more ckalloc -> ckrealloc replacements. - * generic/tclLink.c: - -2007-03-20 Kevin B. Kenny - - * generic/tclDate.c: Rebuilt, despite Donal Fellows's comment when - committing it that no rebuild was required. - * generic/tclGetDate.y: According to Donal Fellows, "Introduce modern - formatting standards; no need for rebuild of tclDate.c." - - * library/tzdata/America/Cambridge_Bay: - * library/tzdata/America/Havana: - * library/tzdata/America/Inuvik: - * library/tzdata/America/Iqaluit: - * library/tzdata/America/Pangnirtung: - * library/tzdata/America/Rankin_Inlet: - * library/tzdata/America/Resolute: - * library/tzdata/America/Yellowknife: - * library/tzdata/Asia/Choibalsan: - * library/tzdata/Asia/Dili: - * library/tzdata/Asia/Hovd: - * library/tzdata/Asia/Jakarta: - * library/tzdata/Asia/Jayapura: - * library/tzdata/Asia/Makassar: - * library/tzdata/Asia/Pontianak: - * library/tzdata/Asia/Ulaanbaatar: - * library/tzdata/Europe/Istanbul: Upgraded to Olson's tzdata2007d. - - * generic/tclListObj.c (TclLsetList, TclLsetFlat): - * tests/lset.test: Changes to deal with shared internal representation - for lists passed to the [lset] command. Thanks to Don Porter for - fixing this issue. [Bug 1677512] - -2007-03-19 Don Porter - - * generic/tclCompile.c: Revise the various expansion routines for - CompileEnv fields to use ckrealloc() where appropriate. - - * generic/tclBinary.c (Tcl_SetByteArrayLength): Replaced ckalloc() / - memcpy() sequence with ckrealloc() call. - - * generic/tclBasic.c (Tcl_CreateMathFunc): Replaced some calls to - * generic/tclEvent.c (Tcl_CreateThread): Tcl_Alloc() with calls - * generic/tclObj.c (UpdateStringOfBignum): to ckalloc(), which - * unix/tclUnixTime.c (SetTZIfNecessary): better supports memory - * win/tclAppInit.c (setargv): debugging. - -2007-03-19 Donal K. Fellows - - * doc/regsub.n: Corrected example so that it doesn't recommend - potentially unsafe practice. Many thanks to Konstantin Kushnir - for reporting this. - -2007-03-17 Kevin B. Kenny - - * win/tclWinReg.c (GetKeyNames): Size the buffer for enumerating key - names correctly, so that Unicode names exceeding 127 chars can be - retrieved without crashing. [Bug 1682211] - * tests/registry.test (registry-4.9): Added test case for the above - bug. - -2007-03-15 Mo DeJong - - * generic/tclIOUtil.c (Tcl_Stat): Reimplement workaround to avoid gcc - warning by using local variables. When the macro argument is of type - long long instead of long, the incorrect warning is not generated. - -2007-03-15 Mo DeJong - - * win/Makefile.in: Fully qualify LIBRARY_DIR so that `make test` does - not depend on working dir. - -2007-03-15 Mo DeJong - - * tests/parse.test: Add two backslash newline parse tests. - -2007-03-12 Don Porter - - * generic/tclExecute.c (INST_FOREACH_STEP4): Make private copy of - * tests/foreach.test (foreach-10.1): value list to be assigned to - variables so that shimmering of that list doesn't lead to invalid - pointers. [Bug 1671087] - - * generic/tclEvent.c (HandleBgErrors): Make efficient private copy - * tests/event.test (event-5.3): of the command prefix for the interp's - background error handling command to avoid panics due to pointers to - memory invalid after shimmering. [Bug 1670155] - - * generic/tclNamesp.c (NsEnsembleImplementationCmd): Make efficient - * tests/namespace.test (namespace-42.8): private copy of the - command prefix as we invoke the command appropriate to a particular - subcommand of a particular ensemble to avoid panic due to shimmering - of the List intrep. [Bug 1670091] - - * generic/tclVar.c (TclArraySet): Make efficient private copy of - * tests/var.test (var-17.1): the "list" argument to [array set] to - avoid crash due to shimmering invalidating pointers. [Bug 1669489] - -2007-03-12 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Fix problems with declaration - positioning and memory leaks. [Bug 1679072] - -2007-03-11 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LreverseObjCmd): Ensure that a list is - correctly reversed even if its internal representation is shared - without the object itself being shared. [Bug 1675044] - -2007-03-10 Miguel Sofer - - * generic/tclCmdIL (Tcl_LsortObjCmd): changed fix to [Bug 1675116] to - use the cheaper TclListObjCopy() instead of Tcl_DuplicateObj(). - -2007-03-09 Andreas Kupries - - * library/platform/shell.tcl: Made more robust if an older platform - * library/platform/pkgIndex.tcl: package is present in the inspected - * unix/Makefile.in: shell. Package forget it to prevent errors. Bumped - * win/Makefile.in: package version to 1.1.3, and updated the Makefiles - installing it as Tcl Module. - -2007-03-09 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Handle tricky case with loss - * tests/cmdIL.test (cmdIL-1.29): of list rep during sorting due - to shimmering. [Bug 1675116] - -2007-03-09 Kevin B. Kenny - - * library/clock.tcl (ReadZoneinfoFile): Added Y2038 compliance to the - code for version-2 'zoneinfo' files. - * tests/clock.test (clock-56.3): Added a test case for Y2038 and - 'zoneinfo'. Modified test initialisation to use the - 'loadTestedCommands' function of tcltest to bring in the correct path - for the registry library. - -2007-03-08 Don Porter - - * generic/tclListObj.c (TclLsetList): Rewrite so that the routine - itself does not do any direct intrep surgery. Better isolates those - things into the implementation of the "list" Tcl_ObjType. - -2007-03-08 Donal K. Fellows - - * generic/tclListObj.c (TclLindexList, TclLindexFlat): Moved these - functions to tclListObj.c from tclCmdIL.c to mirror the way that the - equivalent functions for [lset]'s guts are arranged. - -2007-03-08 Kevin B. Kenny - - * library/clock.tcl: Further tweaks to the Windows time zone table - (restoring missing Mexican time zones). Added rudimentary handling of - version-2 'zoneinfo' files. Update US DST rules so that zones such as - 'EST5EDT' get the correct transition dates. - * tests/clock.test: Added rudimentary test cases for 'zoneinfo' - parsing. Adjusted several tests that depended on obsolete US DST - transition rules. - -2007-03-07 Daniel Steffen - - * macosx/tclMacOSXNotify.c: add spinlock debugging and sanity checks. - - * macosx/Tcl.xcodeproj/project.pbxproj: ensure gcc version used by - * macosx/Tcl.xcodeproj/default.pbxuser: Xcode and configure/make are - * macosx/Tcl-Common.xcconfig: consistent and independent of - gcc_select default and CC env var; fixes for Xcode 3.0. - - * unix/tcl.m4 (Darwin): s/CFLAGS/CPPFLAGS/ in macosx-version-min check - * unix/configure: autoconf-2.59 - -2007-03-07 Don Porter - - * generic/tclCmdIL.c (TclLindex*): Rewrites to make efficient - private copies of the list and indexlist arguments, so we can operate - on the list elements directly with no fear of shimmering effects. - Replaces defensive coding schemes that are otherwise required. End - result is that TclLindexList is entirely a wrapper around - TclLindexFlat, which is now the core engine of all [lindex] - operations. - - * generic/tclObj.c (Tcl_AppendAllObjTypes): Converted to simpler - list validity test. - -2007-03-07 Donal K. Fellows - - * generic/tclRegexp.c (TclRegAbout): Generate information about a - regexp as a Tcl_Obj instead of as a string, which is more efficient. - -2007-03-07 Kevin B. Kenny - - * library/clock.tcl: Adjusted Windows time zone table to handle new US - DST rules by locale rather than as Posix time zone spec. - * tests/clock.test (clock-39.6, clock-49.2, testclock::registry): - Adjusted tests to simulate new US rules. - * library/tzdata/America/Indiana/Winamac: - * library/tzdata/Europe/Istanbul: - * library/tzdata/Pacific/Easter: - Olson's tzdata2007c. - -2007-03-05 Andreas Kupries - - * library/platform/shell.tcl (::platform::shell::RUN): In the case of - * library/platform/pkgIndex.tcl: a failure put the captured stderr - * unix/Makefile.in: into the error message to aid in debugging. Bumped - * win/Makefile.in: package version to 1.1.2, and updated the makefiles - installing it as Tcl Module. - -2007-03-03 Donal K. Fellows - - * generic/tclLink.c (LinkedVar): Added macro to conceal at least some - of the pointer hackery. - -2007-03-02 Don Porter - - * generic/tclCmdIL.c (Tcl_LreverseObjCmd): Added missing - TclInvalidateStringRep() call when we directly manipulate the intrep - of an unshared "list" Tcl_Obj. [Bug 1672585] - - * generic/tclCmdIL.c (Tcl_JoinObjCmd): Revised [join] implementation - to append Tcl_Obj's instead of strings. [RFE 1669420] - - * generic/tclCmdIL.c (Info*Cmd): Code simplifications and - optimizations. - -2007-03-02 Donal K. Fellows - - * generic/tclCompile.c (TclPrintInstruction): Added a scheme to allow - * generic/tclCompile.h (AuxDataPrintProc): aux-data to be printed - * generic/tclCompCmds.c (Print*Info): out for debugging. For - this to work, immediate operands referring to aux-data must be - identified as such in the instruction descriptor table using - OPERAND_AUX4 (all are always 4 bytes). - - * generic/tclExecute.c (TclExecuteByteCode): Rewrote the compiled - * generic/tclCompCmds.c (TclCompileDictCmd): [dict update] so that it - * generic/tclCompile.h (DictUpdateInfo): stores critical - * tests/dict.test (dict-21.{14,15}): non-varying data in an - aux-data value instead of a (shimmerable) literal. [Bug 1671001] - -2007-03-01 Don Porter - - * generic/tclCmdIL.c (Tcl_LinsertObjCmd): Code simplifications - and optimizations. - - * generic/tclCmdIL.c (Tcl_LreplaceObjCmd): Code simplifications - and optimizations. - - * generic/tclCmdIL.c (Tcl_LrangeObjCmd): Rewrite in the same - spirit; avoid shimmer effects rather than react to them. - - * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Stop throwing away - * tests/foreach.test (foreach-1.14): useful error information when - loop variable sets fail. - - * generic/tclCmdIL.c (Tcl_LassignObjCmd): Rewrite to make an - efficient private copy of the list argument, so we can operate on the - list elements directly with no fear of shimmering effects. Replaces - defensive coding schemes that are otherwise required. - - * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Rewrite to make - efficient private copies of the variable and value lists, so we can - operate on them without any special shimmer defense coding schemes. - -2007-03-01 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileForeachCmd): Prevent an unexpected - * tests/foreach.test (foreach-9.1): infinite loop when the - variable list is empty and the foreach is compiled. [Bug 1671138] - -2007-02-26 Andreas Kupries - - * generic/tclIORChan.c (FreeReflectedChannel): Added the missing - refcount release between NewRC and FreeRC for the channel handle - object, spotted by Don Porter. [Bug 1667990] - -2007-02-26 Don Porter - - * generic/tclCmdAH.c (Tcl_ForeachObjCmd): Removed surplus - copying of the objv array that used to be a workaround for [Bug - 404865]. That bug is long fixed. - -2007-02-24 Don Porter - - * generic/tclBasic.c: Use new interface in Tcl_EvalObjEx so that the - recounting logic of the List internal rep need not be repeated there. - Better encapsulation of internal details. - - * generic/tclInt.h: New internal routine TclListObjCopy() used - * generic/tclListObj.c: to efficiently do the equivalent of [lrange - $list 0 end]. After some experience with this, might be a good - candidate for exposure as a public interface. It's useful for callers - of Tcl_ListObjGetElements() who want to control the ongoing validity - of the returned objv pointer. - -2007-02-22 Andreas Kupries - - * tests/pkg.test: Added tests for the case of an alpha package - satisfying a require for the regular package, demonstrating a corner - case specified in TIP#280. More notes in the comments to the test. - -2007-02-20 Jan Nijtmans - - * generic/tclInt.decls: Added "const" specifiers in TclSockGetPort - * generic/tclIntDecls.h: regenerated - * generic/*.c: - * unix/tclUnixChan.c - * unix/tclUnixPipe.c - * win/tclWinPipe.c - * win/tclWinSock.c: Added many "const" specifiers in implementation. - -2007-02-20 Don Porter - - * doc/tcltest.n: Typo fix. [Bug 1663539] - -2007-02-20 Pat Thoyts - - * generic/tclFileName.c: Handle extended paths on Windows NT and - * generic/tclPathObj.c: above. These have a \\?\ prefix. [Bug - * win/tclWinFile.c: 1479814] - * tests/winFCmd.test: Tests for extended path handling. - -2007-02-19 Jeff Hobbs - - * unix/tcl.m4: use SHLIB_SUFFIX=".so" on HP-UX ia64 arch. - * unix/configure: autoconf-2.59 - - * generic/tclIOUtil.c (Tcl_FSEvalFileEx): safe incr of objPtr ref. - -2007-02-18 Donal K. Fellows - - * doc/chan.n, doc/clock.n, doc/eval.n, doc/exit.n, doc/expr.n: - * doc/interp.n, doc/open.n, doc/platform_shell.n, doc/pwd.n: - * doc/refchan.n, doc/regsub.n, doc/scan.n, doc/tclvars.n, doc/tm.n: - * doc/unload.n: Apply [Bug 1610310] to fix typos. Thanks to Larry - Virden for spotting them. - - * doc/interp.n: Partial fix of [Bug 1662436]; rest requires some - policy decisions on what should and shouldn't be safe commands from - the "new in 8.5" set. - -2007-02-13 Kevin B. Kenny - - * tools/fix_tommath_h.tcl: Further tweaking for the x86-64. The change - is to make 'mp_digit' be an 'unsigned int' on that platform; since - we're using only 32 bits of it, there's no reason to make it a 64-bit - 'unsigned long.' - * generic/tclTomMath.h: Regenerated. - -2007-02-13 Donal K. Fellows - - * doc/re_syntax.n: Corrected description of 'print' class [Bug - 1614687] and enhanced description of 'graph' class. - -2007-02-12 Kevin B. Kenny - - * tools/fix_tommath_h.tcl: Added code to patch out a check for - __x86_64__ that caused Tommath to use __attributes(TI)__ for the - mp_word type. Tetra-int's simply fail on too many gcc-glibc-OS - combinations to be ready for shipment today, even if they work for - some of us. This change allows reversion of das's change of 2006-08-18 - that accomplised the same thing on Darwin. [Bugs 1601380, 1603737, - 1609936, 1656265] - * generic/tclTomMath.h: Regenerated. - * library/tzdata/Africa/Asmara: - * library/tzdata/Africa/Asmera: - * library/tzdata/America/Nassau: - * library/tzdata/Atlantic/Faeroe: - * library/tzdata/Atlantic/Faroe: - * library/tzdata/Australia/Eucla: - * library/tzdata/Pacific/Easter: Rebuilt from Olson's tzdata2007b. - -2007-02-09 Joe Mistachkin - - * win/nmakehlp.c: Properly cleanup after nmakehlp, including the - * win/makefile.vc: vcX0.pch file. - -2007-02-08 Jeff Hobbs - - * unix/tclUnixInit.c (TclpCheckStackSpace): do stack size checks with - unsigned size_t to correctly validate stackSize in the 2^31+ range. - [Bug 1654104] - -2007-02-08 Don Porter - - * generic/tclNamesp.c: Corrected broken logic in Tcl_DeleteNamespace - * tests/namespace.test: introduced in Patch 1577278 that caused - [namespace delete ::] to be effective only at level #0. New test - namespace-7.7 should prevent similar error in the future [Bug 1655305] - -2007-02-06 Don Porter - - * generic/tclNamesp.c: Corrected broken implementation of the - * tests/namespace.test: TclMatchIsTrivial optimization on [namespace - children $namespace $pattern]. - -2007-02-04 Daniel Steffen - - * unix/tcl.m4: use gcc4's __attribute__((__visibility__("hidden"))) if - available to define MODULE_SCOPE effective on all platforms. - * unix/configure.in: add caching to -pipe and zoneinfo checks. - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2007-02-03 Joe Mistachkin - - * win/rules.vc: Fix platform specific file copy macros for downlevel - Windows. - -2007-01-29 Don Porter - - * generic/tclResult.c: Added optimization case to TclTransferResult to - cover common case where there's big savings over the fully general - path. Thanks to Peter MacDonald. [Bug 1626518] - - * generic/tclLink.c: Broken linked float logic corrected. Thanks to - Andy Goth. [Bug 1602538] - - * doc/fcopy.n: Typo fix. [Bug 1630627] - -2007-01-28 Daniel Steffen - - * macosx/Tcl.xcodeproj/project.pbxproj: extract build settings that - * macosx/Tcl.xcodeproj/default.pbxuser: were common to multiple - * macosx/Tcl-Common.xcconfig (new file): configurations into external - * macosx/Tcl-Debug.xcconfig (new file): xcconfig files; add extra - * macosx/Tcl-Release.xcconfig (new file): configurations for building - with SDKs and 64bit; convert legacy jam-based 'Tcl' target to native - target with single script phase; correct syntax of build setting - references to use $() throughout. - - * macosx/README: document new Tcl.xcodeproj configurations; other - minor updates/corrections. - - * generic/tcl.h: update location of version numbers in macosx files. - - * macosx/Tcl.xcode/project.pbxproj: restore 'tcltest' target to - * macosx/Tcl.xcode/default.pbxuser: working order by replicating - applicable changes to Tcl.xcodeproj since 2006-07-20. - -2007-01-25 Daniel Steffen - - * unix/tcl.m4: integrate CPPFLAGS into CFLAGS as late as possible and - move (rather than duplicate) -isysroot flags from CFLAGS to CPPFLAGS - to avoid errors about multiple -isysroot flags from some older gcc - builds. - - * unix/configure: autoconf-2.59 - -2007-01-22 Donal K. Fellows - - * compat/memcmp.c (memcmp): Reworked so that arithmetic is never - performed upon void pointers, since that is illegal. [Bug 1631017] - -2007-01-19 Donal K. Fellows - - * generic/tclCompile.c (TclCompileScript): Reduce the frequency with - which we issue INST_START_CMD, making bytecode both more compact and - somewhat faster. The optimized case is where we would otherwise be - issuing a sequence of those instructions; in those cases, it is only - ever the first one encountered that could possibly trigger. - -2007-01-19 Joe Mistachkin - - * tools/man2tcl.c: Include stdlib.h for exit() and improve comment - detection. - * win/nmakehlp.c: Update usage. - * win/makefile.vc: Properly build man2tcl.c for MSVC8. - -2007-01-19 Daniel Steffen - - * macosx/tclMacOSXFCmd.c (TclMacOSXSetFileAttribute): on some versions - of Mac OS X, truncate() fails on resource forks, in that case use - open() with O_TRUNC instead. - - * macosx/tclMacOSXNotify.c: accommodate changes to prototypes of - OSSpinLock(Un)Lock API. - - * macosx/Tcl.xcodeproj/project.pbxproj: ensure HOME and USER env vars - * macosx/Tcl.xcodeproj/default.pbxuser: are defined when running - testsuite from Xcode. - - * tests/env.test: add extra system env vars that need to be preserved - on some Mac OS X versions for testsuite to work. - - * unix/Makefile.in: Move libtommath defines into configure.in to - * unix/configure.in: avoid replicating them across multiple - * macosx/Tcl.xcodeproj/project.pbxproj: buildsystems. - - * unix/tcl.m4: ensure CPPFLAGS env var is used when set. [Bug 1586861] - (Darwin): add -isysroot and -mmacosx-version-min flags to CPPFLAGS - when present in CFLAGS to avoid discrepancies between what headers - configure sees during preprocessing tests and compiling tests. - - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2007-01-18 Donal K. Fellows - - * generic/tclCompile.c (TclCompileScript): Make sure that when parsing - an expanded literal fails, a correct bytecode sequence is still - issued. [Bug 1638414]. Also make sure that the start of the expansion - bytecode sequence falls inside the span of bytecodes for a command. - * tests/compile.test (compile-16.24): Added test for [Bug 1638414] - -2007-01-17 Donal K. Fellows - - * generic/tclIO.c: Added macros to make usage of ChannelBuffers - clearer. - -2007-01-11 Joe English - - * win/tcl.m4(CFLAGS_WARNING): Remove "-Wconversion". This was removed - from unix/tcl.m4 2004-07-16 but not from here. - * win/configure: Regenerated. - -2007-01-11 Pat Thoyts - - * win/makefile.vc: Fixes to work better on Win98. Read version numbers - * win/nmakehlp.c: from package index file to avoid keeping numbers in - * win/rules.vc: the makefile where they may become de-synchronized. - -2007-01-10 Donal K. Fellows - - * generic/regcomp.c (compile, freev): Define a strategy for - * generic/regexec.c (exec): managing the internal - * generic/regguts.h (AllocVars, FreeVars): vars of the RE engine to - * generic/regcustom.h (AllocVars, FreeVars): reduce C stack usage. - This will make Tcl as a whole much less likely to run out of stack - space... - -2007-01-09 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileLindexCmd): - * tests/lindex.test (lindex-9.2): Fix silly bug that ended up - sometimes compiling list arguments in the wrong order. [Bug 1631364] - -2007-01-03 Kevin B. Kenny - - * generic/tclDate.c: Regenerated to recover a lost fix from patthoyts. - [Bug 1618523] - -2006-12-26 Mo DeJong - - * generic/tclIO.c (Tcl_GetsObj): Avoid checking for for the LF in a - possible CRLF sequence when EOF has already been found. - -2006-12-26 Mo DeJong - - * generic/tclEncoding.c (EscapeFromUtfProc): Clear the - TCL_ENCODING_END flag when end bytes are written. This fix keep this - method from writing escape bytes for an encoding like iso2022-jp - multiple times when the escape byte overlap with the end of the IO - buffer. - * tests/io.test: Add test for escape byte overlap issue. - -2006-12-19 Donal K. Fellows - - * unix/tclUnixThrd.c (Tcl_GetAllocMutex, TclpNewAllocMutex): Add - intermediate variables to shut up unwanted warnings. [Bug 1618838] - -2006-12-19 Daniel Steffen - - * unix/tclUnixThrd.c (TclpInetNtoa): fix for 64 bit. - - * unix/tcl.m4 (Darwin): --enable-64bit: verify linking with 64bit - -arch flag succeeds before enabling 64bit build. - * unix/configure: autoconf-2.59 - -2006-12-17 Daniel Steffen - - * tests/macOSXLoad.test (new file): add testing of .bundle loading and - * tests/load.test: unloading on Darwin (in addition - * tests/unload.test: to existing tests of .dylib - loading). - * macosx/Tcl.xcodeproj/project.pbxproj: add building of dltest - binaries so that testsuite run from Xcode can use them; fix testsuite - run script - * unix/configure.in: add support for building dltest binaries as - * unix/dltest/Makefile.in: .bundle (in addition to .dylib) on Darwin. - * unix/Makefile.in: add stub lib dependency to dltest target. - * unix/configure: autoconf-2.59 - - * tests/append.test: fix cleanup failure when all tests are skipped. - - * tests/chan.test (chan-16.9): cleanup chan event handler to avoid - causing error in event.test when running testsuite with -singleproc 1. - - * tests/info.test: add !singleTestInterp constraint to tests that fail - when running testsuite with -singleproc 1. [Bug 1605269] - -2006-12-14 Donal K. Fellows - - * doc/string.n: Fix example. [Bug 1615277] - -2006-12-12 Don Porter - - * generic/tclCompExpr.c: Now that the new internal structs are - in use to support operator commands, might as well make them the - default for [expr] as well and avoid passing every parsed expression - through the inefficient Tcl_Token array format. This addresses most - issues in [RFE 1517602]. Assuming no performance disasters result from - this, much dead code supporting the other implementation might now be - removed. - - * generic/tclBasic.c: Final step routing all direct evaluation forms - * generic/tclCompExpr.c: of the operator commands through TEBC, - * generic/tclCompile.h: dropping all the routines in tclMathOp.c. - * generic/tclMathOp.c: Still needs Engineering Manual attention. - -2006-12-11 Don Porter - - * generic/tclBasic.c: Another step with all sorting operator - * generic/tclCompExpr.c: commands now routing through TEBC via - * generic/tclCompile.h: TclSortingOpCmd(). - -2006-12-08 Don Porter - - * generic/tclBasic.c: Another step down the path of re-using - * generic/tclCompExpr.c: TclExecuteByteCode to implement the TIP 174 - * generic/tclCompile.h: commands instead of using a mass of code - * generic/tclMathOp.c: duplication. Now all operator commands that - * tests/mathop.test: demand exactly one operation are implemented - via TclSingleOpCmd and a call to TEBC. - - * generic/tclCompExpr.c: Revised implementation of TclInvertOpCmd to - * generic/tclMathOp.c: perform a bytecode compile / execute sequence. - This demonstrates a path toward avoiding mountains of code duplication - in tclMathOp.c and tclExecute.c. - - * generic/tclCompile.h: Change TclExecuteByteCode() from static to - * generic/tclExecute.c: MODULE_SCOPE so all files including - tclCompile.h may call it. - - * generic/tclMathOp.c: More revisions to make tests pass. - * tests/mathop.test: - -2006-12-08 Donal K. Fellows - - * generic/tclNamesp.c (TclTeardownNamespace): Ensure that dying - namespaces unstitch themselves from their referents. [Bug 1571056] - (NsEnsembleImplementationCmd): Silence GCC warning. - - * tests/mathop.test: Full tests for & | and ^ operators - -2006-12-08 Daniel Steffen - - * library/tcltest/tcltest.tcl: use [info frame] for "-verbose line". - -2006-12-07 Don Porter - - * generic/tclCompCmds.c: Additional commits correct most - * generic/tclExecute.c: failing tests illustrating bugs - * generic/tclMathOp.c: uncovered in [Patch 1578137]. - - * generic/tclBasic.c: Biggest source of TIP 174 failures was that - the commands were not [namespace export]ed from the ::tcl::mathop - namespace. More bits from [Patch 1578137] correct that. - - * tests/mathop.test: Commmitted several new tests from Peter Spjuth - found in [Patch 1578137]. Many failures now demonstrate issues to fix - in the TIP 174 implementation. - -2006-12-07 Donal K. Fellows - - * tests/mathop.test: Added tests for ! ~ eq operators. - * generic/tclMathOp.c (TclInvertOpCmd): Add in check for non-integral - numeric values. - * generic/tclCompCmds.c (CompileCompareOpCmd): Factor out the code - generation for the chained comparison operators. - -2006-12-07 Pat Thoyts - - * tests/exec.test: Fixed line endings (caused win32 problems). - -2006-12-06 Don Porter - - * generic/tclCompCmds.c: Revised and consolidated into utility - * tests/mathop.test: routines some of routines that compile - the new TIP 174 commands. This corrects some known bugs. More to come. - -2006-12-06 Kevin B. Kenny - - * tests/expr.test (expr-47.12): Improved error reporting in hopes of - having more information to pursue [Bug 1609936]. - -2006-12-05 Andreas Kupries - - TIP#291 IMPLEMENTATION - - * generic/tclBasic.c: Define tcl_platform element for pointerSize. - * doc/tclvars.n: - - * win/Makefile.in: Added installation instructions for the platform - * win/makefile.vc: package. Added the platform package. - * win/makefile.bc: - * unix/Makefile.in: - - * tests/platform.test: - * tests/safe.test: - - * library/platform/platform.tcl: - * library/platform/shell.tcl: - * library/platform/pkgIndex.tcl: - - * doc/platform.n: - * doc/platform_shell.n: - -2006-12-05 Don Porter - - * generic/tclPkg.c: When no requirements are supplied to a - * tests/pkg.test: [package require $pkg] and [package unknown] - is invoked to find a satisfying package, pass the requirement argument - "0-" (which means all versions are acceptable). This permits a - registered [package unknown] command to call [package vsatisfies - $testVersion {*}$args] without any special handling of the empty $args - case. This fixes/avoids a bug in [::tcl::tm::UnknownHandler] that was - causing old TM versions to be provided in preference to newer TM - versions. Thanks to Julian Noble for discovering the issue. - -2006-12-04 Donal K. Fellows - - TIP#267 IMPLEMENTATION - - * generic/tclIOCmd.c (Tcl_ExecObjCmd): Added -ignorestderr option, - * tests/exec.test, doc/exec.n: loosely from [Patch 1476191] - -2006-12-04 Don Porter - - * generic/tclCompExpr.c: Added implementation for the - CompileExprTree() routine that can produce expression bytecode - directly from internal structures with no need to pass through the - Tcl_Token array representation. Still disabled by default. #undef - USE_EXPR_TOKENS to try it out. - -2006-12-03 Don Porter - - * generic/tclCompExpr.c: Added expr parsing routines that - produce a different set of internal structures representing the parsed - expression, as well as routines that go on to convert those structures - into the traditional Tcl_Token array format. Use of these routines is - currently disabled. #undef PARSE_DIRECT_EXPR_TOKENS to enable them. - These routines will only become really useful when more routines that - compile directly from the new internal structures are completed. - -2006-12-02 Donal K. Fellows - - * doc/file.n: Clarification of [file pathtype] docs. [Bug 1606454] - -2006-12-01 Kevin B. Kenny - - * libtommath/bn_mp_add.c: Corrected the effects of a - * libtommath/bn_mp_div.c: bollixed 'cvs merge' operation - * libtommath/bncore.c: that inadvertently committed some - * libtommath/tommath_class.h: half-developed code. - - TIP#299 IMPLEMENTATION - - * doc/mathfunc.n: Added isqrt() function to docs - * generic/tclBasic.c: Added isqrt() math function (ExprIsqrtFunc) - * tests/expr.test (expr-47.*): Added tests for isqrt() - * tests/info.test (info-20.2): Added isqrt() to expected math funcs. - -2006-12-01 Don Porter - - * tests/chan.test: Correct timing sensitivity in new test. [Bug - 1606860] - - TIP#287 IMPLEMENTATION - - * doc/chan.n: New subcommand [chan pending]. - * generic/tclBasic.c: Thanks to Michael Cleverly for proposal - * generic/tclInt.h: and implementation. - * generic/tclIOCmd.c: - * library/init.tcl: - * tests/chan.test: - * tests/ioCmd.test: - - TIP#298 IMPLEMENTATION - - * generic/tcl.decls: Tcl_GetBignumAndClearObj -> Tcl_TakeBignumFromObj - * generic/tclObj.c: - - * generic/tclDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclExecute.c: Update callers. - * generic/tclMathOp.c: - -2006-11-30 Kevin B. Kenny - - * library/tzdata: Olson's tzdata2006p. - * libtommath/bn_mp_sqrt.c: Fixed a bug where the initial approximation - to the square root could be on the wrong side, causing failure of - convergence. - -2006-11-29 Don Porter - - * generic/tclBasic.c (Tcl_AppendObjToErrorInfo): Added - Tcl_DecrRefCount() on the objPtr argument to plug memory leaks. This - makes the routine a consumer, which makes it easiest to use. - -2006-11-28 Andreas Kupries - - * generic/tclBasic.c: TIP #280 implementation. - * generic/tclCmdAH.c: - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclCompCmds.c: - * generic/tclCompExpr.c: - * generic/tclCompile.c: - * generic/tclCompile.h: - * generic/tclExecute.c: - * generic/tclIOUtil.c: - * generic/tclInt.h: - * generic/tclInterp.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclProc.c: - * tests/compile.test: - * tests/info.test: - * tests/platform.test: - * tests/safe.test: - -2006-11-27 Kevin B. Kenny - - * unix/tclUnixChan.c (TclUnixWaitForFile): - * tests/event.test (event-14.*): Corrected a bug where - TclUnixWaitForFile would present select() with the wrong mask on an - LP64 machine if a fd number exceeds 32. Thanks to Jean-Luc Fontaine - for reporting and diagnosing. [Bug 1602208] - -2006-11-27 Don Porter - - * generic/tclExecute.c (TclIncrObj): Correct failure to detect - floating-point increment values. Thanks to William Coleda [Bug - 1602991] - -2006-11-26 Donal K. Fellows - - * tests/mathop.test, doc/mathop.n: More bits and pieces of the TIP#174 - implementation. Note that the test suite is not yet complete. - -2006-11-26 Daniel Steffen - - * unix/tcl.m4 (Linux): --enable-64bit support. [Patch 1597389] - * unix/configure: autoconf-2.59 [Bug 1230558] - -2006-11-25 Donal K. Fellows - - TIP#174 IMPLEMENTATION - - * generic/tclMathOp.c (new file): Completed the implementation of the - interpreted versions of all the tcl::mathop commands. Moved to a new - file to make tclCompCmds.c more focused in purpose. - -2006-11-23 Donal K. Fellows - - * generic/tclCompCmds.c (Tcl*OpCmd, TclCompile*OpCmd): - * generic/tclBasic.c (Tcl_CreateInterp): Partial implementation of - TIP#174; the commands are compiled, but (mostly) not interpreted yet. - -2006-11-22 Donal K. Fellows - - TIP#269 IMPLEMENTATION - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Implementation of the [string - * tests/string.test (string-25.*): is list] command, based on - * doc/string.n: work by Joe Mistachkin, with - enhancements by Donal Fellows for better failindex behaviour. - -2006-11-22 Don Porter - - * tools/genWinImage.tcl (removed): Removed two files used in - * win/README.binary (removed): production of binary distributions - for Windows, a task we no longer perform. [Bug 1476980] - * generic/tcl.h: Remove mention of win/README.binary in comment - - * generic/tcl.h: Moved TCL_REG_BOSONLY #define from tcl.h to - * generic/tclInt.h: tclInt.h. Only know user is Expect, which - already #include's tclInt.h. No need to continue greater exposure. - [Bug 926500] - -2006-11-20 Donal K. Fellows - - * generic/tclBasic.c (Tcl_CreateInterp, TclHideUnsafeCommands): - * library/init.tcl: Refactored the [chan] command's guts so that it - does not use aliases to global commands, making the code more robust. - -2006-11-17 Don Porter - - * generic/tclExecute.c (INST_EXPON): Corrected crash on - [expr 2**(1<<63)]. Was operating on cleared bignum Tcl_Obj. - -2006-11-16 Donal K. Fellows - - * doc/apply.n, doc/chan.n: Added examples. - -2006-11-15 Don Porter - - TIP#270 IMPLEMENTATION - - * generic/tcl.decls: New public routines Tcl_ObjPrintf, - * generic/tclStringObj.c: Tcl_AppendObjToErrorInfo, Tcl_Format, - * generic/tclInt.h: Tcl_AppendLimitedToObj, - Tcl_AppendFormatToObj and Tcl_AppendPrintfToObj. Former internal - versions removed. - - * generic/tclDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclBasic.c: Updated callers. - * generic/tclCkalloc.c: - * generic/tclCmdAH.c: - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclCompExpr.c: - * generic/tclCompile.c: - * generic/tclDictObj.c: - * generic/tclExecute.c: - * generic/tclIORChan.c: - * generic/tclIOUtil.c: - * generic/tclMain.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclPkg.c: - * generic/tclProc.c: - * generic/tclStrToD.c: - * generic/tclTimer.c: - * generic/tclUtil.c: - * unix/tclUnixFCmd.c: - - * tools/genStubs.tcl: Updated script to no longer produce the - _ANSI_ARGS_ wrapper in generated declarations. Also revised to accept - variadic prototypes with more than one fixed argument. (This is - possible since TCL_VARARGS and its limitations are no longer in use). - * generic/tcl.h: Some reordering so that macro definitions do - not interfere with the now _ANSI_ARGS_-less stub declarations. - - * generic/tclDecls.h: make genstubs - * generic/tclIntDecls.h: - * generic/tclIntPlatDecls.h: - * generic/tclPlatDecls.h: - * generic/tclTomMathDecls.h: - -2006-11-15 Donal K. Fellows - - * doc/ChnlStack.3, doc/CrtObjCmd.3, doc/GetIndex.3, doc/OpenTcp.3: - * doc/chan.n, doc/fconfigure.n, doc/fcopy.n, doc/foreach.n: - * doc/history.n, doc/http.n, doc/library.n, doc/lindex.n: - * doc/lrepeat.n, doc/lreverse.n, doc/pkgMkIndex.n, doc/re_syntax.n: - Convert \fP to \fR so that man-page scrapers have an easier time. - -2006-11-14 Don Porter - - TIP#261 IMPLEMENTATION - - * generic/tclNamesp.c: [namespace import] with 0 arguments - introspects the list of imported commands. - -2006-11-13 Kevin B. Kenny - - * generic/tclThreadStorage.c (Tcl_InitThreadStorage): - (Tcl_FinalizeThreadStorage): Silence a compiler warning about - presenting a volatile pointer to 'memset'. - -2006-11-13 Don Porter - - * generic/tclIO.c: When [gets] on a binary channel needs to use - the "iso8859-1" encoding, save a copy of that encoding per-thread to - avoid repeated freeing and re-loading of it from the file system. This - replaces the cached copy of this encoding that the platform - initialization code used to keep in pre-8.5 releases. - -2006-11-13 Daniel Steffen - - * generic/tclCompExpr.c: Fix gcc warnings about 'cast to/from - * generic/tclEncoding.c: pointer from/to integer of different - * generic/tclEvent.c: size' on 64-bit platforms by casting - * generic/tclExecute.c: to intermediate types - * generic/tclHash.c: intptr_t/uintptr_t via new PTR2INT(), - * generic/tclIO.c: INT2PTR(), PTR2UINT() and UINT2PTR() - * generic/tclInt.h: macros. [Patch 1592791] - * generic/tclProc.c: - * generic/tclTest.c: - * generic/tclThreadStorage.c: - * generic/tclTimer.c: - * generic/tclUtil.c: - * unix/configure.in: - * unix/tclUnixChan.c: - * unix/tclUnixPipe.c: - * unix/tclUnixPort.h: - * unix/tclUnixTest.c: - * unix/tclUnixThrd.c: - - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2006-11-12 Donal K. Fellows - - * generic/tclInt.h, generic/tclInt.decls: Transfer TclPtrMakeUpvar and - TclObjLookupVar to the internal stubs table. - -2006-11-10 Daniel Steffen - - * tests/fCmd.test (fCmd-6.26): fix failure when env(HOME) path - contains symlinks. - - * macosx/Tcl.xcodeproj/project.pbxproj: remove tclParseExpr.c; when - running testsuite from inside Xcdoe, skip stack-3.1 (it only fails - under those circumstances). - - * unix/tcl.m4 (Darwin): suppress linker arch warnings when building - universal for both 32 & 64 bit and no 64bit CoreFoundation is - available; sync with tk tcl.m4 change. - * unix/configure.in: whitespace. - * unix/configure: autoconf-2.59 - -2006-11-09 Don Porter - - * generic/tclParseExpr.c (removed): Moved all the code of - * generic/tclCompExpr.c: tclParseExpr.c into tclCompExpr.c. - * unix/Makefile.in: This sets the stage for expr compiling to work - * win/Makefile.in: directly with the full parse tree structures, - * win/makefile.bc: and not have to pass through the information - * win/makefile.vc: lossy format of an array of Tcl_Tokens. - * win/tcl.dsp: - -2006-11-09 Donal K. Fellows - - TIP#272 IMPLEMENTATION - - * generic/tclCmdMZ.c (Tcl_StringObjCmd): Implementation of the - * tests/string.test, tests/stringComp.test: [string reverse] command - * doc/string.n: from TIP#272. - - * generic/tclCmdIL.c (Tcl_LreverseObjCmd): Implementation of the - * generic/tclBasic.c, generic/tclInt.h: [lreverse] command from - * tests/cmdIL.test (cmdIL-7.*): TIP#272. - * doc/lreverse.n: - -2006-11-08 Donal K. Fellows - - * generic/tclIO.c, generic/tclPkg.c: Style & clarity rewrites. - -2006-11-07 Andreas Kupries - - * unix/tclUnixFCmd.c (CopyFile): Added code to fall back to a - hardwired default block size should the filesystem report a bogus - value. [Bug 1586470] - -2006-11-04 Don Porter - - * generic/tclStringObj.c: Changed Tcl_ObjPrintf() response to an - invalid format specifier string. No longer panics; now produces an - error message as output. - - TIP#274 IMPLEMENTATION - - * generic/tclParseExpr.c: Exponentiation operator is now right - * tests/expr.test: associative. [Patch 1556802] - -2006-11-03 Miguel Sofer - - * generic/tclBasic.c (TEOVI): fix por possible leak of a Command in - the presence of execution traces that delete it. - - * generic/tclBasic.c (TEOVI): - * tests/trace.test (trace-21.11): fix for [Bug 1590232], execution - traces may cause a second command resolution in the wrong namespace. - -2006-11-03 Donal K. Fellows - - * tests/event.test (event-11.5): Rewrote tests to stop Tcl from - * tests/io.test (multiple tests): opening sockets that are - * tests/ioCmd.test (iocmd-15.1,16,17): reachable from outside hosts - * tests/iogt.test (__echo_srv__.tcl): where not necessary. This is - * tests/socket.test (multiple tests): noticably annoying on some - * tests/unixInit.test (unixInit-1.2): systems (e.g., Windows). - -2006-11-02 Daniel Steffen - - * macosx/Tcl.xcodeproj/project.pbxproj: check autoconf/autoheader exit - status and stop build if they fail. - -2006-11-02 Jeff Hobbs - - * doc/ParseCmd.3, doc/Tcl.n, doc/eval.n, doc/exec.n: - * doc/fconfigure.n, doc/interp.n, doc/unknown.n: - * library/auto.tcl, library/init.tcl, library/package.tcl: - * library/safe.tcl, library/tm.tcl, library/msgcat/msgcat.tcl: - * tests/all.tcl, tests/basic.test, tests/cmdInfo.test: - * tests/compile.test, tests/encoding.test, tests/execute.test: - * tests/fCmd.test, tests/http.test, tests/init.test: - * tests/interp.test, tests/io.test, tests/ioUtil.test: - * tests/iogt.test, tests/namespace-old.test, tests/namespace.test: - * tests/parse.test, tests/pkg.test, tests/pkgMkIndex.test: - * tests/proc.test, tests/reg.test, tests/trace.test: - * tests/upvar.test, tests/winConsole.test, tests/winFCmd.test: - * tools/tclZIC.tcl: - * generic/tclParse.c (Tcl_ParseCommand): Replace {expand} with {*} - officially (TIP #293). Leave -DALLOW_EXPAND=0|1 option to keep - {expand} syntax for transition users. [Bug 1589629] - -2006-11-02 Donal K. Fellows - - * generic/tclBasic.c, generic/tclInterp.c, generic/tclProc.c: Silence - warnings from gcc over signed/unsigned and TclStackAlloc(). - * generic/tclCmdMZ.c: Update to more compact and clearer coding style. - -2006-11-02 Don Porter - - * generic/tclCmdAH.c: Further revisions to produce the routines - * generic/tclInt.h: TclFormat() and TclAppendFormatToObj() that - * generic/tclNamesp.c: accept (objc, objv) arguments rather than - * generic/tclStringObj.c: any varargs stuff. - - * generic/tclBasic.c: Further revised TclAppendPrintToObj() and - * generic/tclCkalloc.c: TclObjPrintf() routines to panic when unable - * generic/tclCmdAH.c: to complete their formatting operations, - * generic/tclCmdIL.c: rather than report an error message. This - * generic/tclCmdMZ.c: means an interp argument for error message - * generic/tclDictObj.c: recording is no longer needed, further - * generic/tclExecute.c: simplifying the interface for callers. - * generic/tclIORChan.c: - * generic/tclIOUtil.c: - * generic/tclInt.h: - * generic/tclMain.c: - * generic/tclNamesp.c: - * generic/tclParseExpr.c: - * generic/tclPkg.c: - * generic/tclProc.c: - * generic/tclStringObj.c: - * generic/tclTimer.c: - * generic/tclUtil.c: - * unix/tclUnixFCmd.c: - -2006-11-02 Donal K. Fellows - - * tests/winPipe.test (winpipe-4.[2345]): Made robust when run in - directory with spaces in its name. - - * generic/tclCmdAH.c: Clean up uses of cast NULLs. - - * generic/tclInterp.c (AliasObjCmd): Added more explanatory comments. - - * generic/tclBasic.c (TclEvalObjvInternal): Rewrote so that comments - are relevant and informative once more. Also made the unknown handler - processing use the Tcl execution stack for working space, and not the - general heap. - -2006-11-01 Daniel Steffen - - * unix/tclUnixPort.h: ensure MODULE_SCOPE is defined before use, so - that tclPort.h can once again be included without tclInt.h. - - * generic/tclEnv.c (Darwin): mark _environ symbol as unexported even - when MODULE_SCOPE != __private_extern__. - -2006-10-31 Don Porter - - * generic/tclBasic.c: Refactored and renamed the routines - * generic/tclCkalloc.c: TclObjPrintf, TclFormatObj, and - * generic/tclCmdAH.c: TclFormatToErrorInfo to a new set of routines - * generic/tclCmdIL.c: TclAppendPrintfToObj, TclAppendFormatToObj, - * generic/tclCmdMZ.c: TclObjPrintf, and TclObjFormat, with the - * generic/tclDictObj.c: intent of making the latter list, plus - * generic/tclExecute.c: TclAppendLimitedToObj and - * generic/tclIORChan.c: TclAppendObjToErrorInfo, public via a revised - * generic/tclIOUtil.c: TIP 270. - * generic/tclInt.h: - * generic/tclMain.c: - * generic/tclNamesp.c: - * generic/tclParseExpr.c: - * generic/tclPkg.c: - * generic/tclProc.c: - * generic/tclStringObj.c: - * generic/tclTimer.c: - * generic/tclUtil.c: - * unix/tclUnixFCmd.c: - -2006-10-31 Miguel Sofer - - * generic/tclBasic.c, generic/tcl.h, generic/tclInterp.c: - * generic/tclNamesp.c: removing the flag bit TCL_EVAL_NOREWRITE, the - last remnant of the callObjc/v fiasco. It is not needed, as it is now - always set and checked or'ed with TCL_EVAL_INVOKE. - -2006-10-31 Pat Thoyts - - * win/rules.vc: Fix for [Bug 1582769] - options conflict with VC2003. - -2006-10-31 Donal K. Fellows - - * generic/tclBasic.c, generic/tclNamesp.c, generic/tclProc.c: - * generic/tclInt.h: Removed the callObjc and callObjv fields from the - Interp structure. They did not function correctly and made other parts - of the core amazingly complex, resulting in a substantive change to - [info level] behaviour. [Bug 1587618] - * library/clock.tcl: Removed use of [info level 0] for calculating the - command name as used by the user and replace with a literal. What's - there now is sucky, but at least appears to be right to most users. - * tests/namespace.test (namespace-42.7,namespace-47.1): Reverted - changes to these tests. - * tests/info.test (info-9.11,info-9.12): Added knownBug constraint - since these tests require a different behaviour of [info level] than - is possible because of other dependencies. - -2006-10-30 Jeff Hobbs - - * tools/tcltk-man2html.tcl (option-toc): handle any kind of options - defined toc section (needed for ttk docs) - -2006-10-30 Miguel Sofer - - * generic/tclBasic.c (TEOVI): insured that the interp's callObjc/v - fields are restored after traces run, as they be spoiled. This was - causing a segfault in tcllib's profiler tests. - -2006-10-30 Don Porter - - * generic/tclExecute.c (INST_MOD): Corrected improper testing of the - * tests/expr.test: sign of bignums when applying Tcl's - division rules. Thanks to Peter Spjuth. [Bug 1585704] - -2006-10-29 Miguel Sofer - - * generic/tclNamesp.c (EnsembleImplementationCmd): - * tests/namespace.test (47.7-8): reverted a wrong "optimisation" that - completely broke snit; added two tests. - -2006-10-28 Donal K. Fellows - - * generic/tclProc.c (ObjInterpProcEx, TclObjInterpProcCore): Split the - core of procedures to make it easier to build procedure-like code - without going through horrible contortions. This is the last critical - component to make advanced OO systems workable as simple loadable - extensions. TOIPC is now in the internal stub table. - (MakeProcError, MakeLambdaError): Refactored ProcessProcResultCode to - be simpler, some of which goes to TclObjInterpProcCore, and the rest - of which is now in these far simpler routines which just do errorInfo - stack generation for different types of procedure-like entity. - * tests/apply.test (apply-5.1): Updated to expect the more informative - form of message. - -2006-10-27 Donal K. Fellows - - * generic/tclVar.c (HasLocalVars): New macro to make various bits and - pieces cleaner. - - * generic/tclNamesp.c (TclSetNsPath): Expose SetNsPath() through - internal stubs table with semi-external name. - - * generic/tclInt.h (CallFrame): Add a field for handling context data - for extensions (like object systems) that should be tied to a call - frame (and not a command or interpreter). - - * generic/tclBasic.c (TclRenameCommand): Change to take CONST args; - they were only ever used in a constant way anyway, so this appears to - be a spot that was missed during TIP#27 work. - -2006-10-26 Miguel Sofer - - * generic/tclProc.c (SetLambdaFromAny): minor change, eliminate - redundant call to Tcl_GetString (thanks aku). - - * generic/tclInterp.c (ApplyObjCmd): - * generic/tclNamesp.c (EnsembleImplementationCmd): replaced ckalloc - (heap) with TclStackAlloc (execution stack). - -2006-10-24 Miguel Sofer - - * tests/info.test (info-9.11-12): tests for [Bug 1577492] - * tests/apply.test (apply-4.3-5): tests for [Bug 1574835] - - * generic/tclProc.c (ObjInterpProcEx): disable itcl hacks for calls - from ApplyObjCmd (islambda==1), as they mess apply's error messages - [Bug 1583266] - -2006-10-23 Miguel Sofer - - * generic/tclProc.c (ApplyObjCmd): fix wrong#args for apply by using - the ensemble rewrite engine. [Bug 1574835] - * generic/tclInterp.c (AliasObjCmd): previous commit missed usage of - TCL_EVAL_NOREWRITE for aliases. - - * generic/tclBasic.c (TclEvalObjvInternal): removed redundant check - for ensembles. [Bug 1577628] - - * library/clock.tcl (format, scan): corrected wrong # args messages to - * tests/clock.test (3.1, 34.1): make use of the new rewrite - capabilities of [info level] - - * generic/tcl.h: Lets TEOV update the iPtr->callObj[cv] new - * generic/tclBasic.c: fields, except when the flag bit - * generic/tclInt.h: TCL_EVAL_NOREWRITE is present. These values - * generic/tclNamesp.c: are used by Tcl_PushCallFrame to initialise - * generic/tclProc.c: the frame's obj[cv] fields, and allows - * tests/namespace.test: [info level] to know and use ensemble - rewrites. [Bug 1577492] - - ***POTENTIAL INCOMPATIBILITY*** - The return value from [info level 0] on interp alias calls is changed: - previously returned the target command (including curried values), now - returns the source - what was actually called. - -2006-10-23 Miguel Sofer - - * generic/tcl.h: Modified the Tcl call stack so there is - * generic/tclBasic.c: always a valid CallFrame, even at level 0 - * generic/tclCmdIL.c: [Patch 1577278]. Most of the changes - * generic/tclInt.h: involve removing tests for a NULL - * generic/tclNamesp.c: iPtr->(var)framePtr. There is now a - * generic/tclObj.c: CallFrame pushed at interp creation with a - * generic/tclProc.c: pointer to it stored in iPtr->rootFramePtr. - * generic/tclTrace.c: A second unused field in Interp is - * generic/tclVar.c: hijacked to enable further functionality, - currently unused (but with several FRQs depending on it). - - ***POTENTIAL INCOMPATIBILITY*** - Any user that includes tclInt.h and needs to determine if it is - running at level 0 should change (iPtr->varFramePtr == NULL) to - (iPtr->varFramePtr == iPtr->rootFramePtr). - -2006-10-23 Don Porter - - * README: Bump version number to 8.5a6 - * generic/tcl.h: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/README.binary: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - -2006-10-21 Miguel Sofer - - * generic/tcl.h, generic/tclHash.c: Tcl_FindHashEntry now calls - Tcl_CreateHashEntry with a newPtr set to NULL: this would have caused - a segfault previously and eliminates duplicated code. A macro has been - added to tcl.h (only used when TCL_PRESERVE_BINARY_COMPATABALITY is - not set - i.e., not by default). - -2006-10-20 Reinhard Max - - * unix/configure.in: Added autodetection for OS-supplied timezone - * unix/Makefile.in: files and configure switches to override the - * unix/configure: detected default. - -2006-10-20 Daniel Steffen - - *** 8.5a5 TAGGED FOR RELEASE *** - - * tools/tcltk-man2html.tcl: add support for alpha & beta versions to - useversion glob pattern. [Bug 1579941] - -2006-10-18 Don Porter - - * changes: 8.5a5 release date set - - * doc/Encoding.3: Missing doc updates (mostly Table of - * doc/Ensemble.3: Contents) exposed by `make checkdoc` - * doc/FileSystem.3: - * doc/GetTime.3: - * doc/PkgRequire.3: - -2006-10-17 Miguel Sofer - - * generic/tclInterp.c (ApplyObjCmd): fixed bad error in 2006-10-12 - commit: interp released too early. Spotted by mistachkin. - -2006-10-16 Miguel Sofer - - * tclProc.c (SetLambdaFromAny): - * tests/apply.test (9.1-9.2): plugged intrep leak [Bug 1578454], - found by mjanssen. - -2006-10-16 Andreas Kupries - - * generic/tclBasic.c: Moved TIP#219 cleanup to DeleteInterpProc. - -2006-10-16 Daniel Steffen - - * changes: updates for 8.5a5 release. - - * unix/tclUnixThrd.c (TclpThreadGetStackSize): Darwin: fix for main - thread, where pthread_get_stacksize_np() returns incorrect info. - - * macosx/GNUmakefile: don't redo prebinding of non-prebound binaires. - -2006-10-16 Don Porter - - * generic/tclPkg.c (ExactRequirement): Plugged memory leak. Also - changed Tcl_Alloc()/Tcl_Free() calls to ckalloc()/ckfree() for easier - memory debugging in the future. [Bug 1568373] - - * library/tcltest/tcltest.tcl: Revise tcltest bump to 2.3a1. - * library/tcltest/pkgIndex.tcl: This permits more features to be - * unix/Makefile.in: added to tcltest before we reach version 2.3.0 - * win/Makefile.in: best timed to match the release of Tcl 8.5.0. - * win/makefile.vc: This also serves as a demo of TIP 268 features - -2006-10-13 Colin McCormack - - * win/tclWinFile.c: corrected erroneous attempt to protect against - NULL return from Tcl_FSGetNormalizedPath per [Bug 1548263] causing - [Bug 1575837]. - * win/tclWinFile.c: alfredd supplied patch to fix [Bug 1575837] - -2006-10-13 Daniel Steffen - - * unix/tclUnixThrd.c (TclpThreadGetStackSize): on Darwin, use - * unix/tcl.m4: pthread_get_stacksize_np() API to get thread stack size - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2006-10-12 Miguel Sofer - - * generic/tclInterp.c (ApplyObjCmd): - * tests/interp.test (interp-14.5-10): made [interp alias] use the - ensemble rewrite machinery to produce better error messages [Bug - 1576006] - -2006-10-12 David Gravereaux - - * win/nmakehlp.c: Replaced all wnsprintf() calls with snprintf(). - wnsprintf was not in my shwlapi header file (VC++6) - -2006-10-11 Don Porter - - * generic/tclPkg.c (Tcl_PackageRequireEx): Corrected crash when - argument version=NULL passed in. - -2006-10-10 Don Porter - - * changes: Updates for 8.5a5 release. - - * generic/tclNamespace.c (TclTeardownNamespace): After the - commandPathSourceList of a namespace is cleared, set the - commandPathSourceList to NULL so we don't try to walk the list a - second time, possibly after it is freed. [Bug 1566526] - * tests/namespace.test (namespace-51.16): Added test. - -2006-10-09 Miguel Sofer - - * doc/UpVar.3: brough the docs in accordance to the code. Ever since - 8.0, Tcl_UpVar(2)? accepts TCL_NAMESPACE_ONLY as a flag value, and - var-3.4 tests for proper behaviour. The docs only allowed 0 and - TCL_GLOBAL_ONLY. [Bug 1574099] - -2006-10-09 Miguel Sofer - - * tests/*.test: updated all tests to refer explicitly to the global - variables ::errorInfo, ::errorCode, ::env and ::tcl_platform: many - were relying on the alternative lookup in the global namespace, that - feature is tested specifically in namespace and variable tests. - - The modified testfiles are: apply.test, basic.test, case.test, - cmdIL.test, cmdMZ.test, compExpr-old.test, error.test, eval.test, - event.test, expr.test, fileSystem.test, for.test, http.test, if.test, - incr-old.test, incr.test, interp.test, io.test, ioCmd.test, load.test, - misc.test, namespace.test, parse.test, parseOld.test, pkg.test, - proc-old.test, set.test, switch.test, tcltest.test, thread.test, - var.test, while-old.test, while.test. - -2006-10-06 Pat Thoyts - - * win/rules.vc: [Bug 1571954] avoid /RTCc flag with MSVC8 - -2006-10-06 Pat Thoyts - - * doc/binary.n: TIP #275: Support unsigned values in binary - * generic/tclBinary.c: command. Tests and documentation updated. - * tests/binary.test: - -2006-10-05 Andreas Kupries - - * library/tm.tcl: Fixed bug in TIP #189 implementation, now allowing - '_' in module names. - -2006-10-05 Jeff Hobbs - - * library/http/http.tcl (http::geturl): only do geturl url rfc 3986 - validity checking if $::http::strict is true (default true for 8.5). - [Bug 1560506] - - * generic/tcl.h: note limitation on changing Tcl_UniChar size - * generic/tclEncoding.c (UtfToUnicodeProc, UnicodeToUtfProc): - * tests/encoding.test (encoding-16.1): fix alignment issues in - unicode <> utf conversion procs. [Bug 1122671] - -2006-10-05 Miguel Sofer - - * generic/tclVar.c (Tcl_LappendObjCmd): - * tests/append.test(4.21-22): fix for longstanding [Bug 1570718], - lappending nothing to non-list. Reported by lvirden - -2006-10-04 Kevin B. Kenny - - * tzdata/: Olson's tzdata2006m. - -2006-10-01 Kevin B. Kenny - - * tests/clock.test (clock-49.2): Removed a locale dependency that - caused a spurious failure in the German locale. [Bug 1567956] - -2006-10-01 Miguel Sofer - - * doc/Eval.3 (TclEvalObjv): added note on refCount management for the - elements of objv. [Bug 730244] - -2006-10-01 Pat Thoyts - - * win/tclWinFile.c: Handle possible missing define. - - * win/tclWinFile.c (TclpUtime): [Bug 1420432] file mtime fails for - * tests/cmdAH.test: directories on windows - - * tests/winFile.test: Handle Msys environment a little differently in - getuser function. [Bug 1567956] - -2006-09-30 Miguel Sofer - - * generic/tclUtil.c (Tcl_SplitList): optimisation, [Patch 1344747] by - dgp. - - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclObj.c: - * generic/tclStubInit.c: added an internal function TclObjBeingDeleted - to provide info as to the reason for the loss of an internal rep. [FR - 1512138] - - * generic/tclCompile.c: - * generic/tclHistory.c: - * generic/tclInt.h: - * generic/tclProc.c: made Tcl_RecordAndEvalObj not call "history" if - it has been redefined to an empty proc, in order to reduce the noise - when debugging [FR 1190441]. Moved TclCompileNoOp from tclProc.c to - tclCompile.c - -2006-09-28 Andreas Kupries - - * generic/tclPkg.c (CompareVersions): Bugfix. Check string lengths - * tests/pkg.test: before comparison. The shorter string is the smaller - number. Added testcases as well. Interestingly all existing test cases - for vcompare compared numbers of the same length with each other. [Bug - 1563836] - -2006-09-28 Miguel Sofer - - * generic/tclIO.c (Tcl_GetsObj): added two test'n'panic guards for - possible NULL derefs, [Bug 1566382] and coverity #33. - -2006-09-27 Don Porter - - * generic/tclExecute.c: Corrected error in INST_LSHIFT in the - * tests/expr.test: calculation done to determine whether a shift - in the (long int) type is possible. The calculation had literal value - "1" where it needed a value "1L" to compute the correct result. Error - detected via testing with the math::bigfloat package [Bug 1567222] - - * generic/tclPkg.c (CompareVersion): Flatten strcmp() results to - {-1, 0, 1} to match expectations of CompareVersion() callers. - -2006-09-27 Miguel Sofer - - * generic/regc_color.c (singleton): - * generic/regc_cvec.c (addmcce): - * generic/regcomp.c (compile, dovec): the static function addmcce does - nothing when called with two NULL pointers; the only call is by - compile with two NULL pointers (regcomp.c #includes regc_cvec.c). - Large parts (all?) the code for mcce (multi character collating - element) that we do not use is ifdef'ed out with the macro - REGEXP_MCCE_ENABLE. - This silences coverity bugs 7, 16, 80 - - * generic/regc_color.c (uncolorchain): - * generic/regc_nfa.c (freearc): changed tests and asserts to - equivalent formulation, designed to avoid an explicit comparison to - NULL and satisfy coverity that 6 and 9 are not bugs. - -2006-09-27 Andreas Kupries - - * tests/pkg.test: Added test for version comparison at the 32bit - boundary. [Bug 1563836] - - * generic/tclPkg.c: Rewrote CompareVersion to perform string - comparison instead of numeric. This breaks through the 32bit limit on - version numbers. See code for details (handling of leading zeros, - signs, etc.). un-CONSTed some arguments of CompareVersions, - RequirementSatisfied, and AllRequirementsSatisfied. The new compare - modifies the string (temporary string terminators). All callers use - heap-allocated ver-intreps, so we are good with that. [Bug 1563836] - -2006-09-27 Miguel Sofer - - * generic/tclFileName.c (TclGlob): added a panic for a call with - TCL_GLOBMODE_TAILS and pathPrefix==NULL. This would cause a segfault, - as found by coverity #26. - -2006-09-26 Kevin B. Kenny - - * doc/Encoding.3: Added covariant 'const' qualifier for the - * generic/tcl.decls: Tcl_EncodingType argument to - * generic/tclEncoding.c: Tcl_CreateEncoding. [Further TIP#27 work.] - * generic/tclDecls.h: Reran 'make genstubs'. - -2006-09-26 Pat Thoyts - - * win/makefile.vc: Additional compiler flags and amd64 support. - * win/nmakehlp.c: - * win/rules.vc: - -2006-09-26 Don Porter - - * generic/tcl.h: As 2006-09-22 commit from Donal K. Fellows - demonstrates, "#define NULL 0" is just wrong, and as a quotable chat - figure observed, "If NULL isn't defined, we're not using a C compiler" - Improper fallback definition of NULL removed. - -2006-09-25 Pat Thoyts - - * generic/tcl.h: More fixing which struct stat to refer to. - * generic/tclGetDate.y: Some casts from time_t to int required. - * generic/tclTimer.c: Tcl_Time structure members are longs. - * win/makefile.vc: Support for varying compiler options - * win/rules.vc: and build to platform-specific subdirs. - -2006-09-25 Andreas Kupries - - * generic/tclIO.c (Tcl_StackChannel): Fixed [Bug 1564642], aka - coverity #51. Extended loop condition, added checking for NULL to - prevent seg.fault. - -2006-09-25 Andreas Kupries - - * doc/package.n: Fixed nits reported by Daniel Steffen in the TIP#268 - changes. - -2006-09-25 Kevin B. Kenny - - * generic/tclNotify.c (Tcl_DeleteEvents): Simplified the code in hopes - of making the invariants clearer and proving to Coverity that the - event queue memory is managed correctly. - -2006-09-25 Donal K. Fellows - - * generic/tclNotify.c (Tcl_DeleteEvents): Make it clear what happens - when the event queue is mismanaged. [Bug 1564677], coverity bug #10. - -2006-09-24 Miguel Sofer - - * generic/tclParse.c (Tcl_ParseCommand): also return an error if - start==NULL and numBytes<0. This is coverity's bug #20 - - * generic/tclStringObj.c (STRING_SIZE): fix allocation for 0-length - strings. This is coverity's bugs #54-5 - -2006-09-22 Andreas Kupries - - * generic/tclInt.h: Moved TIP#268's field 'packagePrefer' to the end - of the structure, for better backward compatibility. - -2006-09-22 Andreas Kupries - - TIP#268 IMPLEMENTATION - - * generic/tclDecls.h: Regenerated from tcl.decls. - * generic/tclStubInit.c: - - * doc/PkgRequire.3: Documentation of extended API, extended testsuite. - * doc/package.n: - * tests/pkg.test: - - * generic/tcl.decls: Implementation. - * generic/tclBasic.c: - * generic/tclConfig.c: - * generic/tclInt.h: - * generic/tclPkg.c: - * generic/tclTest.c: - * generic/tclTomMathInterface.c: - * library/init.tcl: - * library/package.tcl: - * library/tm.tcl: - -2006-09-22 Donal K. Fellows - - * generic/tclThreadTest.c (TclCreateThread): Use NULL instead of 0 as - end-of-strings marker to Tcl_AppendResult; the difference matters on - 64-bit machines. [Bug 1562528] - -2006-09-21 Don Porter - - * generic/tclUtil.c: Dropped ParseInteger() routine. TclParseNumber - covers the task just fine. - -2006-09-19 Donal K. Fellows - - * generic/tclEvent.c (Tcl_VwaitObjCmd): Rewrite so that an exceeded - limit trapped in a vwait cannot cause a dangerous dangling trace. - -2006-09-19 Don Porter - - * generic/tclExecute.c (INST_EXPON): Native type overflow detection - * tests/expr.test: was completely broken. Falling back on use of - bignums for all non-trivial ** calculations until - native-type-constrained special cases can be done carefully and - correctly. [Bug 1561260] - -2006-09-15 Jeff Hobbs - - * library/http/http.tcl: Change " " -> "+" url encoding mapping - * library/http/pkgIndex.tcl: to " " -> "%20" as per RFC 3986. - * tests/http.test (http-5.1): bump http to 2.5.3 - * unix/Makefile.in: - * win/Makefile.in: - -2006-09-12 Andreas Kupries - - * unix/configure.in (HAVE_MTSAFE_GETHOST*): Modified to recognize - HP-UX 11.00 and beyond as having mt-safe implementations of the - gethost functions. - * unix/configure: Regenerated, using autoconf 2.59 - - * unix/tclUnixCompat.c (PadBuffer): Fixed bug in calculation of the - increment needed to align the pointer, and added documentation - explaining why the macro is implemented as it is. - -2006-09-11 Pat Thoyts - - * win/rules.vc: Updated to install http, tcltest and msgcat as - * win/makefile.vc: Tcl Modules (as per Makefile.in). - * win/makefile.vc: Added tommath_(super)class headers. - -2006-09-11 Andreas Kupries - - * unix/Makefile.in (install-libraries): Fixed typo tcltest 2.3.9 -> - 2.3.0. - -2006-09-11 Daniel Steffen - - * unix/tclUnixCompat.c: make compatLock static and only declare it - when it will actually be used; #ifdef parts of TSD that are not always - needed; adjust #ifdefs to cover all possible cases; fix whitespace. - -2006-09-11 Andreas Kupries - - * tests/msgcat.test: Bumped version in auxiliary files as well. - * doc/msgcat.n: - -2006-09-11 Kevin B. Kenny - - * unix/Makefile.in: Bumped msgcat version to 1.4.2 to be - * win/Makefile.in: consistent with dgp's commits of 2006-09-10. - -2006-09-11 Don Porter - - * library/msgcat/msgcat.tcl: Removed some unneeded [uplevel]s. - -2006-09-10 Don Porter - - * generic/tclExecute.c: Corrected INST_EXPON flaw that treated - * tests/expr.test: $x**1 as $x**3. [Bug 1555371] - - * doc/tcltest.n: Bump to version tcltest 2.3.0 to - * library/tcltest/pkgIndex.tcl: account for new "-verbose line" - * library/tcltest/tcltest.tcl: feature. - * unix/Makefile.in: - * win/Makefile.in: - * win/makefile.bc: - * win/makefile.vc: - - * library/msgcat/msgcat.tcl: Bump to version msgcat 1.4.2 to - * library/msgcat/pkgIndex.tcl: account for modifications. - -2006-09-10 Daniel Steffen - - * library/msgcat/msgcat.tcl (msgcat::Init): on Darwin, add fallback of - * tests/msgcat.test: default msgcat locale to - * unix/tclUnixInit.c (TclpSetVariables): current CFLocale - identifier if available (via private ::tcl::mac::locale global, set at - interp init when on Mac OS X 10.3 or later with CoreFoundation). - - * library/tcltest/tcltest.tcl: add 'line' verbose level: prints source - * doc/tcltest.n: file line information of failing tests. - - * macosx/Tcl.xcodeproj/project.pbxproj: add new tclUnixCompat.c file; - revise tests target to use new tcltest 'line' verbose level. - - * unix/configure.in: add descriptions to new AC_DEFINEs for MT-safe. - * unix/tcl.m4: add caching to new SC_TCL_* macros for MT-safe wrappers - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2006-09-08 Zoran Vasiljevic - - * unix/tclUnixCompat.c: Added fallback to gethostbyname() and - gethostbyaddr() if the implementation is known to be MT-safe - (currently for Darwin 6 or later only). - - * unix/configure.in: Assume gethostbyname() and gethostbyaddr() are - MT-safe starting with Darwin 6 (Mac OSX 10.2). - - * unix/configure: Regenerated with autoconf V2.59 - -2006-09-08 Andreas Kupries - - * unix/tclUnixCompat.c: Fixed conditions for CopyArray/CopyString, and - CopyHostent. Also fixed bad var names in TclpGetHostByName. - -2006-09-07 Zoran Vasiljevic - - * unix/tclUnixCompat.c: Added fallback to MT-unsafe library calls if - TCL_THREADS is not defined. - Fixed alignment of arrays copied by CopyArray() to be on the - sizeof(char *) boundary. - -2006-09-07 Zoran Vasiljevic - - * unix/tclUnixChan.c: Rewritten MT-safe wrappers to return ptrs to - * unix/tclUnixCompat.c: TSD storage making them all look like their - * unix/tclUnixFCmd.c: MT-unsafe pendants API-wise. - * unix/tclUnixPort.h: - * unix/tclUnixSock.c: - -2006-09-06 Zoran Vasiljevic - - * unix/tclUnixChan.c: Added TCL_THREADS ifdef'ed usage of MT-safe - * unix/tclUnixFCmd.c: calls like: getpwuid, getpwnam, getgrgid, - * unix/tclUnixSock.c: getgrnam, gethostbyname and gethostbyaddr. - * unix/tclUnixPort.h: See [Bug 999544] - * unix/Makefile.in: - * unix/configure.in: - * unix/tcl.m4: - * unix/configure: Regenerated. - - * unix/tclUnixCompat.c: New file containing MT-safe implementation of - some library calls. - -2006-09-04 Don Porter - - * generic/tclCompExpr.c: Removed much complexity that is no - longer needed. - - * tests/main.text (Tcl_Main-4.4): Test corrected to not be - timing sensitive to the Bug 1481986 fix. [Bug 1550858] - -2006-09-04 Jeff Hobbs - - * doc/package.n: correct package example - -2006-08-31 Don Porter - - * generic/tclCompExpr.c: Corrected flawed logic for disabling - the INST_TRY_CVT_TO_NUMERIC instruction at the end of an expression - when function arguments contain operators. [Bug 1541274] - - * tests/expr-old.test: The remaining failing tests reported in - * tests/expr.test: [Bug 1381715] are all new in Tcl 8.5, so - there's really no issue of compatibility with Tcl 8.4 result to deal - with. Fixed by updating tests to expect 8.5 results. - -2006-08-29 Don Porter - - * generic/tclParseExpr.c: Dropped the old expr parser. - -2006-08-30 Jeff Hobbs - - * generic/tclBasic.c (Tcl_CreateInterp): init iPtr->threadId - - * win/tclWinChan.c [Bug 819667] Improve logic for identifying COM - ports. - - * generic/tclIOGT.c (ExecuteCallback): - * generic/tclPkg.c (Tcl_PkgRequireEx): replace Tcl_GlobalEval(Obj) - with more efficient Tcl_Eval(Obj)Ex - - * unix/Makefile.in (valgrindshell): add valgrindshell target and - update default VALGRINDARGS. User can override, or add to it with - VALGRIND_OPTS env var. - - * generic/tclFileName.c (DoGlob): match incrs with decrs. - -2006-08-29 Don Porter - - * generic/tclParseExpr.c: Use the "parent" field of orphan - ExprNodes to store the closure of left pointers. This lets us avoid - repeated re-scanning leftward for the left boundary of subexpressions, - which in worst case led to near O(N^2) runtime. - -2006-08-29 Joe Mistachkin - - * unix/tclUnixInit.c: Fixed the issue (typo) that was causing - * unix/tclUnixThrd.c (TclpThreadGetStackSize): stack.test to fail on - FreeBSD (and possibly other Unix platforms). - -2006-08-29 Colin McCormack - - * generic/tclIOUtil.c: Added test for NULL return from - * generic/tclPathObj.c: Tcl_FSGetNormalizedPath which was causing - * unix/tclUnixFile.c: segv's per [Bug 1548263] - * win/tclWinFCmd.c: - * win/tclWinFile.c: - -2006-08-28 Kevin B. Kenny - - * library/tzdata/America/Havana: Regenerated from Olson's - * library/tzdata/America/Tegucigalpa: tzdata2006k. - * library/tzdata/Asia/Gaza: - -2006-08-28 Don Porter - - * generic/tclStringObj.c: Revised ObjPrintfVA to take care to - * generic/tclParseExpr.c: copy only whole characters when doing - %s formatting. This relieves callers of TclObjPrintf() and - TclFormatToErrorInfo() from needing to fix arguments to character - boundaries. Tcl_ParseExpr() simplified by taking advantage. [Bug - 1547786] - - * generic/tclStringObj.c: Corrected TclFormatObj's failure to - count up the number of arguments required by examining the format - string. [Bug 1547681] - -2006-08-27 Joe Mistachkin - - * generic/tclClock.c (ClockClicksObjCmd): Fix nested macro breakage - with TCL_MEM_DEBUG enabled. [Bug 1547662] - -2006-08-26 Miguel Sofer - - * doc/namespace.n: - * generic/tclNamesp.c: - * tests/upvar.test: bugfix, docs clarification and new tests for - [namespace upvar] as follow up to [Bug 1546833], reported by Will - Duquette. - -2006-08-24 Kevin B. Kenny - - * library/tzdata: Regenerated, including several new files, from - Olson's tzdata2006j. - * library/clock.tcl: - * tests/clock.test: Removed an early testing hack that allowed loading - 'registry' from the build tree rather than an installed one. This is a - workaround for [Bug 15232730], which remains open because it's a - symptom of a deeper underlying problem. - -2006-08-23 Don Porter - - * generic/tclParseExpr.c: Minimal collection of new tests - * tests/parseExpr.test: testing the error messages of the new - expr parser. Several bug fixes and code simplifications that appeared - during that effort. - -2006-08-21 Don Porter - - * generic/tclIOUtil.c: Revisions to complete the thread finalization - of the cwdPathPtr. [Bug 1536142] - - * generic/tclParseExpr.c: Revised mistaken call to - TclCheckBadOctal(), so both [expr 08] and [expr 08z] have same - additional info in error message. - - * tests/compExpr-old.test: Update existing tests to not fail with - * tests/compExpr.test: the new expr parser. - * tests/compile.test: - * tests/expr-old.test: - * tests/expr.test: - * tests/for.test: - * tests/if.test: - * tests/parseExpr.test: - * tests/while.test: - -2006-08-21 Donal K. Fellows - - * win/Makefile.in (gdb): Make this target work so that debugging an - msys build is possible. - -2006-08-21 Daniel Steffen - - * macosx/tclMacOSXNotify.c (Tcl_WaitForEvent): if the run loop is - already running (e.g. if Tcl_WaitForEvent was called recursively), - re-run it in a custom run loop mode containing only the source for the - notifier thread, otherwise wakeups from other sources added to the - common run loop modes might get lost. - - * unix/tclUnixNotfy.c (Tcl_WaitForEvent): on 64-bit Darwin, - pthread_cond_timedwait() appears to have a bug that causes it to wait - forever when passed an absolute time which has already been exceeded - by the system time; as a workaround, when given a very brief timeout, - just do a poll on that platform. [Bug 1457797] - - * generic/tclClock.c (ClockClicksObjCmd): add support for Darwin - * generic/tclCmdMZ.c (Tcl_TimeObjCmd): nanosecond resolution timer - * generic/tclInt.h: to [clock clicks] and [time] - * unix/configure.in (Darwin): when TCL_WIDE_CLICKS defined - * unix/tclUnixTime.c (TclpGetWideClicks, TclpWideClicksToNanoseconds): - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - - * unix/tclUnixPort.h (Darwin): override potentially faulty configure - detection of termios availability in all cases, since termios is known - to be present on all Mac OS X releases since 10.0. [Bug 497147] - -2006-08-18 Daniel Steffen - - * unix/tcl.m4 (Darwin): add support for --enable-64bit on x86_64, for - universal builds including x86_64, for 64-bit CoreFoundation on - Leopard and for use of -mmacosx-version-min instead of - MACOSX_DEPLOYMENT_TARGET - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - - * generic/tcl.h: add fixes for building on Leopard and - * unix/tclUnixPort.h: support for 64-bit CoreFoundation on Leopard - * macosx/tclMacOSXFCmd.c: - - * unix/tclUnixPort.h: on Darwin x86_64, disable use of vfork as it - causes execve to fail intermittently. (rdar://4685553) - - * generic/tclTomMath.h: on Darwin 64-bit, for now disable use of - 128-bit arithmetic through __attribute__ ((mode(TI))), as it leads to - link errors due to missing fallbacks. (rdar://4685527) - - * macosx/Tcl.xcodeproj/project.pbxproj: add x86_64 to universal build, - switch native release targets to use DWARF with dSYM, Xcode 3.0 - changes - * macosx/README: updates for x86_64 and Xcode 2.4. - - * macosx/Tcl.xcodeproj/default.pbxuser: add test suite target that - * macosx/Tcl.xcodeproj/project.pbxproj: runs the tcl test suite at - build time and shows clickable test suite errors in the GUI build - window. - - * tests/macOSXFCmd.test: fix use of deprecated resource fork paths. - - * unix/tclUnixInit.c (TclpInitLibraryPath): move code that is only - needed when TCL_LIBRARY is defined to run only in that case. - - * generic/tclLink.c (LinkTraceProc): fix 64-bit signed-with-unsigned - comparison warning from gcc4 -Wextra. - - * unix/tclUnixChan.c (TclUnixWaitForFile): with timeout < 0, if - select() returns early (e.g. due to a signal), call it again instead - of returning a timeout result. Fixes intermittent event-13.8 failures. - -2006-08-17 Don Porter - - * generic/tclCompile.c: Revised the new set of expression - * generic/tclParseExpr.c: parse error messages. - -2006-08-16 Don Porter - - * generic/tclParseExpr.c: Replace PrecedenceOf() function with - prec[] static array. - -2006-08-14 Donal K. Fellows - - * library/clock.tcl (::tcl::clock::add): Added missing braces to - clockval validation code. Pointed out on comp.lang.tcl. - -2006-08-11 Donal K. Fellows - - * generic/tclNamesp.c: Improvements in buffer management to make - namespace creation faster. Plus selected other minor improvements to - code quality. [Patch 1352382] - -2006-08-10 Donal K. Fellows - - Misc patches to make code more efficient. [Bug 1530474] (afredd) - * generic/*.c, macosx/tclMacOSXNotify.c, unix/tclUnixNotfy.c, - * win/tclWinThrd.c: Tidy up invokations of Tcl_Panic() to promote - string constant sharing and consistent style. - * generic/tclBasic.c (Tcl_CreateInterp): More efficient handling of - * generic/tclClock.c (TclClockInit): registration of commands not - in global namespace. - * generic/tclVar.c (Tcl_UnsetObjCmd): Remove unreachable clause. - -2006-08-09 Don Porter - - * generic/tclEncoding.c: Replace buffer copy in for loop with - call to memcpy(). Thanks to afredd. [Patch 1530262] - -2006-08-09 Donal K. Fellows - - * generic/tclCmdIL.c (Tcl_LassignObjCmd): Make the wrong#args message - a bit more consistent with those used elsewhere. [Bug 1534628] - - * generic/tclDictObj.c (DictForCmd): Stop crash when attempting to - iterate over an invalid dictionary. [Bug 1531184] - - * doc/ParseCmd.3, doc/expr.n, doc/set.n, doc/subst.n, doc/switch.n: - * doc/tclvars.n: Ensure that uses of [expr] in documentation examples - are also good style (with braces) unless otherwise necessary. [Bug - 1526581] - -2006-08-03 Daniel Steffen - - * unix/tclUnixPipe.c (TclpCreateProcess): for USE_VFORK: ensure - standard channels are initialized before vfork() so that the child - doesn't potentially corrupt global state in the parent's address space - - * tests/compExpr-old.test: add 'oldExprParser' constraint to all tests - * tests/compExpr.test: that depend on the exact format of the - * tests/compile.test: error messages of the pre-2006-07-05 - * tests/expr-old.test: expression parser. The constraint is on by - * tests/expr.test: default (i.e those tests still fail), but - * tests/for.test: can be turned off by passing '-constraints - * tests/if.test: newExprParser' to tcltest, which will skip - * tests/parseExpr.test: the 196 failing tests in the testsuite that - * tests/while.test: are caused by the new expression parser - error messages. - -2006-07-31 Kevin B. Kenny - - * generic/tclClock.c (ConvertLocalToUTCUsingC): Corrected a regression - that caused dates before 1969 to be one day off in the :localtime time - zone if TZ is not set. [Bug 1531530] - -2006-07-30 Kevin B. Kenny - - * generic/tclClock.c (GetJulianDayFromEraYearMonthDay): Corrected - several errors in converting dates before the Common Era [Bug 1426279] - * library/clock.tcl: Corrected syntax errors in generated code for %EC - %Ey, and %W format groups [Bug 1505383]. Corrected a bug in cache - management for format strings containing [glob] metacharacters [Bug - 1494664]. Corrected several errors in formatting/scanning of years - prior to the Common Era, and added the missing %EE format group to - indicate the era. - * tools/makeTestCases.tcl: Added code to make sure that %U and %V - format groups are included in the tests. (The code depends on %U and - %V formatting working correctly when 'makeTestCases.tcl' is run, - rather than making a completely independent check.) Added tests for - [glob] metacharacters in strings. Added tests for years prior to the - Common Era. - * tests/clock.test: Rebuilt with new test cases for all the above. - -2006-07-30 Joe English - - * doc/AppInit.3: Fix typo [Bug 1496886] - -2006-07-26 Don Porter - - * generic/tclExecute.c: Corrected flawed overflow detection in - * tests/expr.test: INST_EXPON that caused [expr 2**64] to return - 0 instead of the same value as [expr 1<<64]. - -2006-07-24 Don Porter - - * win/tclWinSock.c: Correct un-initialized Tcl_DString. Thanks to - afredd. [Bug 1518166] - -2006-07-21 Miguel Sofer - - * generic/tclExecute.c: - * tests/execute.test (execute-9.1): dgp's fix for [Bug 1522803]. - -2006-07-20 Daniel Steffen - - * macosx/tclMacOSXNotify.c (Tcl_InitNotifier, Tcl_WaitForEvent): - create notifier thread lazily upon first call to Tcl_WaitForEvent() - rather than in Tcl_InitNotifier(). Allows calling exeve() in processes - where the event loop has not yet been run (Darwin's execve() fails in - processes with more than one thread), in particular allows embedders - to call fork() followed by execve(), previously the pthread_atfork() - child handler's call to Tcl_InitNotifier() would immediately recreate - the notifier thread in the child after a fork. - - * macosx/tclMacOSXFCmd.c (TclMacOSXCopyFileAttributes): add support - * macosx/tclMacOSXNotify.c (Tcl_InitNotifier): for weakly - * unix/tclUnixInit.c (Tcl_GetEncodingNameFromEnvironment): importing - symbols not available on OSX 10.2 or 10.3, enables binaires built on - later OSX versions to run on earlier ones. - * macosx/Tcl.xcodeproj/project.pbxproj: enable weak-linking; turn on - extra warnings. - * macosx/README: document how to enable weak-linking; cleanup. - * unix/tclUnixPort.h: add support for weak-linking; conditionalize - AvailabilityMacros.h inclusion; only disable realpath on 10.2 or - earlier when threads are enabled. - * unix/tclLoadDyld.c (TclpLoadMemoryGetBuffer): change runtime Darwin - * unix/tclUnixInit.c (TclpInitPlatform): release check to use - global initialized - once - * unix/tclUnixFCmd.c (DoRenameFile, TclpObjNormalizePath): add runtime - Darwin release check to determine if realpath is threadsafe. - * unix/configure.in: add check on Darwin for compiler support of weak - * unix/tcl.m4: import and for AvailabilityMacros.h header; move - Darwin specific checks & defines that are only relevant to the tcl - build out of tcl.m4; restrict framework option to Darwin; clean up - quoting and help messages. - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - - * generic/regc_locale.c (cclass): - * generic/tclExecute.c (TclExecuteByteCode): - * generic/tclIOCmd.c (Tcl_ExecObjCmd): - * generic/tclListObj.c (NewListIntRep): - * generic/tclObj.c (Tcl_GetLongFromObj, Tcl_GetWideIntFromObj) - (FreeBignum, Tcl_SetBignumObj): - * generic/tclParseExpr.c (Tcl_ParseExpr): - * generic/tclStrToD.c (TclParseNumber): - * generic/tclStringObj.c (TclAppendFormattedObjs): - * unix/tclLoadDyld.c (TclpLoadMemory): - * unix/tclUnixPipe.c (TclpCreateProcess): fix signed-with-unsigned - comparison and other warnings from gcc4 -Wextra. - -2006-07-13 Andreas Kupries - - * unix/tclUnixPort.h: Added the inclusion of . - The missing header caused the upcoming #if conditions to wrongly - exclude realpath, causing file normalize to ignore symbolic links in - the path. - -2006-07-11 Zoran Vasiljevic - - * generic/tclAsync.c: Made Tcl_AsyncDelete() more tolerant when called - after all thread TSD has been garbage-collected. - -2006-07-05 Don Porter - - * generic/tclParseExpr.c: Completely new expression parser that - builds a parse tree instead of operating with deep recursion. This - corrects reports of stack-blowing crashes parsing long expressions - [Bug 906201] and replaces a fundamentally O(N^2) algorithm with an - O(N) one [RFE 903765]. The new parser is better able to generate error - messages that clearly report both the nature and context of the syntax - error [Bugs 1029267, 1381715]. For now, the code for the old parser is - still present and can be activated with a "#define OLD_EXPR_PARSER - 1". This is for the sake of a clean implementation patch, and for ease - of benchmarking. The new parser is non-recursive, so much lighter in - stack consumption, but it does use more heap, so there may be cases - where parsing of long expressions that succeeded with the old parser - will lead to out of memory panics with the new one. There are still - more improvements possible on that point, though significant progress - may require changes to the Tcl_Token specifications documented for the - public Tcl_Parse*() routines. - ***POTENTIAL INCOMPATIBILITY*** for any callers that rely on the exact - (usually terrible) error messages generated by the old parser. This - includes a large number of tests in the test suite. - - * generic/tclInt.h: Replaced TclParseWhiteSpace() with - * generic/tclParse.c: TclParseAllWhiteSpace() which is what - * generic/tclParseExpr.c: all the callers really needed. - Breaking whitespace runs at newlines is useful only to the command - parsing function, and it can call the file scoped routine - ParseWhiteSpace() to do that. - - * tests/expr-old.test: Removed knownBug constraints that masked - * tests/expr.test: failures due to revised error messages. - * tests/parseExpr.test: - -2006-06-20 Don Porter - - * generic/tclIOUtil.c: Changed default configuration to - * generic/tclInt.decls: #undef USE_OBSOLETE_FS_HOOKS which disables - * generic/tclTest.c: access to the Tcl 8.3 internal routines for - hooking into filesystem operations. Everyone ought to have migrated to - Tcl_Filesystems by now. - ***POTENTIAL INCOMPATIBILITY*** for any code still stuck in the - pre-Tcl_Filesystem era. - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - - * generic/tclStrToD.c: Removed dead code that permitted disabling of - recognition of the new 0b and 0o numeric formats. - - * generic/tclExecute.c: Removed dead code that implemented alternative - * generic/tclObj.c: design where numeric values did not - automatically narrow to the smallest Tcl_ObjType required to hold them - - * generic/tclCmdAH.c: Removed dead code that was old implementation - of [format]. - -2006-06-14 Daniel Steffen - - * unix/tclUnixPort.h (Darwin): support MAC_OS_X_VERSION_MAX_ALLOWED - define from AvailabilityMacros.h: override configure detection and - only use API available in the indicated OS version or earlier. - -2006-06-14 Donal K. Fellows - - * doc/format.n, doc/scan.n: Added examples for converting between - characters and their numeric interpretations following user prompting. - -2006-06-13 Donal K. Fellows - - * unix/tclLoadDl.c (TclpDlopen): Workaround for a compiler bug in Sun - Forte 6. [Bug 1503729] - -2006-06-06 Don Porter - - * doc/GetStdChan.3: Added recommendation that each call to - Tcl_SetStdChannel() be accompanied by a call to Tcl_RegisterChannel(). - -2006-06-05 Donal K. Fellows - - * doc/Alloc.3: Added documentation of promise that Tcl_Realloc(NULL,x) - is the same as Tcl_Alloc(x), as discussed in comp.lang.tcl. Also fixed - nonsense sentence to say something meaningful. - -2006-05-29 Jeff Hobbs - - * generic/tcl.h (Tcl_DecrRefCount): use if/else construct to allow - placement in unbraced outer if/else conditions. (jcw) - -2006-05-27 Daniel Steffen - - * macosx/tclMacOSXNotify.c: implemented pthread_atfork() handler that - * unix/tcl.m4 (Darwin): recreates CoreFoundation state and - notifier thread in the child after a fork(). Note that pthread_atfork - is available starting with Tiger only. Because vfork() is used by the - core on Darwin, [exec]/[open] are not affected by this fix, only - extensions or embedders that call fork() directly (such as TclX). - However, this only makes fork() safe from corefoundation tcl with - --disable-threads; as on all platforms, forked children may deadlock - in threaded tcl due to the potential for stale locked mutexes in the - child. [Patch 923072] - - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2006-05-24 Donal K. Fellows - - * unix/tcl.m4 (SC_CONFIG_SYSTEM): Fixed quoting of command script to - awk; it was a rarely used branch, but it was wrong. [Bug 1494160] - -2006-05-23 Donal K. Fellows - - * doc/chan.n, doc/refchan.n: Tighten up the documentation to follow a - slightly more consistent style with regard to argument capitalization. - -2006-05-13 Don Porter - - * generic/tclProc.c (ProcCompileProc): When a bump of the compile - epoch forces the re-compile of a proc body, take care not to overwrite - any Proc struct that may be referred to on the active call stack. Note - that the fix will not be effective for code that calls the private - routine TclProcCompileProc() directly. [Bug 1482718] - -2006-05-13 Daniel Steffen - - * generic/tclEvent.c (HandleBgErrors): fix leak. [Coverity issue 86] - -2006-05-05 Don Porter - - * generic/tclMain.c (Tcl_Main): Corrected flaw that required - * tests/main.test: (Tcl_Main-4.5): processing of one interactive - command before passing control to the loop routine registered with - Tcl_SetMainLoop(). [Bug 1481986] - -2006-05-04 Don Porter - - * README: Bump version number to 8.5a5 - * generic/tcl.h: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/README.binary: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - - * generic/tclBasic.c (ExprSrandFunc): Restore acceptance of wide/big - * doc/mathfunc.n: integer values by srand(). [Bug 1480509] - -2006-04-26 Don Porter - - *** 8.5a4 TAGGED FOR RELEASE *** - - * changes: Updates for another RC. - - * generic/tclBinary.c: Revised the handling of the Q and q format - * generic/tclInt.h: specifiers for [binary] to account for the - * generic/tclStrToD.c: "middle endian" floating point format used in - Nokia N770. - -2006-04-25 Don Porter - - * doc/DoubleObj.3: More doc updates for TIP 237. - * doc/expr.n: - * doc/format.n: - * doc/mathfunc.n: - * doc/scan.n: - * doc/string.n: - - * generic/tclScan.c: [scan $s %u] is documented to accept only - * tests/scan.test: decimal formatted integers. Fixed to match. - -2006-04-19 Kevin B. Kenny - - * generic/tclStrToD.c: Added code to support the "middle endian" - floating point format used in the Nokia N770's software-based floating - point. Thanks to Bruce Johnson for reporting this bug, originally on - http://wiki.tcl.tk/15408. - * library/clock.tcl: Fixed a bug with Daylight Saving Time and Posix - time zone specifiers reported by Martin Lemburg in - http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/9a8b15a4dfc0b7a0 - (and not at SourceForge). - * tests/clock.test: Added test case for the above bug. - -2006-04-18 Donal K. Fellows - - * doc/IntObj.3: Minor review fixes, including better documentation of - the behaviour of Tcl_GetBignumAndClearObj. - -2006-04-17 Don Porter - - * doc/IntObj.3: Documentation changes to account for TIP 237 changes. - * doc/Object.3: [Bug 1446971] - -2006-04-12 Donal K. Fellows - - * generic/regc_locale.c (cclass): Redefined the meaning of [:print:] - to be exactly UNICODE letters, numbers, punctuation, symbols and - spaces (*not* whitespace). [Bug 1376892] - -2006-04-11 Don Porter - - * generic/tclTrace.c: Stop some interference between enter traces - * tests/trace.test: and enterstep traces. [Bug 1458266] - -2006-04-07 Don Porter - - * generic/tclPathObj.c: Yet another revised fix for the [Bug 1379287] - * tests/fileSystem.test: family of path normalization bugs. - -2006-04-06 Jeff Hobbs - - * generic/tclRegexp.c (FinalizeRegexp): full reset data to indicate - readiness for reinitialization. - -2006-04-06 Don Porter - - * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): It seems there - * tests/indexObj.test: are extensions that rely on the prior behavior - * doc/GetIndex.3: that the empty string cannot succeed as a - unique prefix matcher, so I'm restoring Donal Fellows's solution. - Added mention of this detail to the documentation. [Bug 1464039] - - * tests/compExpr-old.test: Updated testmathfunctions constraint - * tests/compExpr.test: to post-TIP-232 world. - * tests/expr-old.test: - * tests/expr.test: - * tests/info.test: - - * tests/indexObj.test: Corrected other test errors revealed by - * tests/upvar.test: testing outside the tcltest application. - - * generic/tclPathObj.c: Revised fix for the [Bug 1379287] family of - path normalization bugs. - -2006-04-06 Daniel Steffen - - * unix/tcl.m4: removed TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING - define on Darwin. [Bug 1457515] - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2006-04-05 Don Porter - - * win/tclWinInit.c: More careful calls to Tcl_DStringSetLength() - * win/tclWinSock.c: to avoid creating invalid DString states. Bump - * win/tclWinDde.c: to version 1.3.2. [RFE 1366195] - * library/dde/pkgIndex.tcl: - - * library/reg/pkgIndex.tcl: Bump to registry 1.2 because - * win/tclWinReg.c: Registry_Unload() is a new public routine - * win/Makefile.in: compared to the 1.1.* releases. - - * win/configure.in: Bump package version numbers. - * win/configure: autoconf 2.59 - -2006-04-05 Donal K. Fellows - - * generic/tclIndexObj.c (Tcl_GetIndexFromObjStruct): Allow empty - strings to be matched by the Tcl_GetIndexFromObj machinery, in the - same manner as any other key. [Bug 1464039] - -2006-04-03 Andreas Kupries - - * generic/tclIO.c (ReadChars): Added check, panic and commentary to a - piece of code which relies on BUFFER_PADDING to create enough space at - the beginning of each buffer for the insertion of partial multibyte - data at the beginning of a buffer. Commentary explains why this code - is OK, and the panic is as a precaution if someone twiddled the - BUFFER_PADDING into uselessness. - - * generic/tclIO.c (ReadChars): Temporarily suppress the use of - TCL_ENCODING_END set when EOF was reached while the buffer we are - converting is not truly the last buffer in the queue. Together with - the Utf bug below it was possible to completely wreck the buffer data - structures, eventually crashing Tcl. [Bug 1462248] - - * generic/tclEncoding.c (UtfToUtfProc): Stop accessing memory beyond - the end of the input buffer when TCL_ENCODING_END is set and the last - bytes of the buffer start a multi-byte sequence. This bug contributed - to [Bug 1462248]. - -2006-03-30 Miguel Sofer - - * generic/tclExecute.c: remove unused var and silence gcc warning - -2006-03-29 Jeff Hobbs - - * win/Makefile.in: convert _NATIVE paths to use / to avoid ".\" - path-as-escape issue. - -2006-03-29 Don Porter - - * changes: Updates for another RC. - - * generic/tclPathObj.c: More fixes for path normalization when /../ - * tests/fileSystem.test: tries to go beyond root.[Bug 1379287] - - * generic/tclExecute.c: Revised INST_MOD implementation to do - calculations in native types as much as possible, moving to mp_ints - only when necessary. - -2006-03-28 Jeff Hobbs - - * win/tclWinPipe.c (TclpCreateProcess): change panics to Tcl errors - and do proper refcounting of noe objPtr. [Bug 1194429] - - * unix/tcl.m4, win/tcl.m4: []-quote AC_DEFUN functions. - -2006-03-28 Daniel Steffen - - * macosx/Tcl.xcode/default.pbxuser: add '-singleproc 1' cli arg to - * macosx/Tcl.xcodeproj/default.pbxuser: tcltest to ease test debugging - - * macosx/Tcl.xcode/project.pbxproj: removed $prefix/share from - * macosx/Tcl.xcodeproj/project.pbxproj: TCL_PACKAGE_PATH as per change - to unix/configure.in of 2006-03-13. - - * unix/tclUnixFCmd.c (TclpObjNormalizePath): deal with *BSD/Darwin - realpath() converting relative paths into absolute paths [Bug 1064247] - -2006-03-28 Vince Darley - - * generic/tclIOUtil.c: fix to nativeFilesystemRecord comparisons - (lesser part of [Bug 1064247]) - -2006-03-27 Pat Thoyts - - * win/tclWinTest.c: Fixes for [Bug 1456373] (mingw-gcc issue) - -2006-03-27 Andreas Kupries - - * doc/CrtChannel.3: Added TCL_CHANNEL_VERSION_5, made it the - * generic/tcl.h: version where the "truncateProc" is defined at, - * generic/tclIO.c: and moved all channel drivers of Tcl to v5. - * generic/tclIOGT.c, generic/tclIORChan.c, unix/tclUnixChan.c: - * unix/tclUnixPipe.c, win/tclWinChan.c, win/tclWinConsole.c: - * win/tclWinPipe.c, win/tclWinSerial.c, win/tclWinSock.c: - -2006-03-27 Don Porter - - * generic/tclExecute.c: Merge INST_MOD computation in with the - INST_?SHIFT instructions, which also operate only on two integral - values. Also corrected flaw that made INST_BITNOT of wide values - require mp_int calculations. Also corrected type that missed optimized - handling of the tclBooleanType by the TclGetBooleanFromObj macro. - - * changes: Updates for another RC. - -2006-03-25 Don Porter - - * generic/tclExecute.c: Corrections to INST_EXPON detection of - overflow to use mp_int calculations. - -2006-03-24 Kevin B. Kenny - - * generic/tclExecute.c (TclExecuteByteCode): Added a couple of missing - casts to 'int' that were affecting compilablity on VC6. - -2006-03-24 Don Porter - - * generic/tclEncoding.c: Reverted latest change [Bug 506653] since it - reportedly killed test performance on Windows. - - * generic/tclExecute.c: Revised INST_EXPON implementation to do - calculations in native types as much as possible, moving to mp_ints - only when necessary. - -2006-03-23 Don Porter - - * generic/tclExecute.c: Merged INST_EXPON handling in with the other - binary operators that operate on all number types (INST_ADD, etc.). - - * tests/env.test: With case preserved (see 2006-03-21 commit) be sure - to do case-insensitive filtering. [Bug 1457065] - -2006-03-23 Reinhard Max - - * unix/tcl.spec: Cleaned up and completed the spec file. An RPM can - now be built from the tcl source distribution with "rpmbuild -tb - " - -2006-03-22 Reinhard Max - - * tests/stack.test: Run the stack tests in subshells, so that they are - reported as failed tests rather than bugs in the test suite if the - recursion causes a segfault. - -2006-03-21 Don Porter - - * changes: Updates for another RC. - - * generic/tclStrToD.c: One of the branches of AccumulateDecimalDigit - * tests/parseExpr.test: did not. [Bug 1451233] - - * tests/env.test: Preserve case of saved env vars. [Bug 1409272] - -2006-03-21 Daniel Steffen - - * generic/tclInt.decls: implement globbing for HFS creator & type - * macosx/tclMacOSXFCmd.c:codes and 'hidden' flag, as documented in - * tests/macOSXFCmd.test: glob.n; objectified OSType handling in [glob] - * unix/tclUnixFile.c: and [file attributes]; fix globbing for - hidden files with pattern==NULL arg. [Bug 823329] - * generic/tclIntPlatDecls.h: - * generic/tclStubInit.c: make genstubs - -2006-03-20 Andreas Kupries - - * win/Makefile.in (install-libraries): Generate tcl8/8.4 directory - under Windows as well (cygwin Makefile). Related entry: 2006-03-07, - dgp. This moved the installation of http from 8.2 to 8.4, partially. A - fix of the required directory creation was done for unix on Mar 10, - without entry in the Changelog. This entry is for the fix of the - directory creation under Windows. - - * unix/installManPage: There is always one even more broken "sed". - Moved the # comment starting character in the sed script to the - beginning of their respective lines. The AIX sed will not recognize - them as comments otherwise :( The actual text stays indented for - better association with the commands they belong to. - -2006-03-20 Donal K. Fellows - - * tests/cmdAH.test, tests/fCmd.test, tests/unixFCmd.test: - * tests/winFCmd.test: Cleanup of some test constraint handling, and a - few other minor issues. - -2006-03-18 Vince Darley - - * generic/tclFileName.c: - * doc/FileSystem.3: - * tests/fileName.test: Fix to [Bug 1084705] so that 'glob -nocomplain' - finally agrees with its documentation and doesn't swallow genuine - errors. - - ***POTENTIAL INCOMPATIBILITY*** for scripts that assumed '-nocomplain' - removes the need for 'catch' to deal with non-understood path names. - - Small optimisation to implementation of pattern==NULL case of TclGlob, - and clarification to the documentation. [Tclvfs bug 1405317] - -2006-03-18 Vince Darley - - * tests/fCmd.test: added knownBug test case for [Bug 1394972] - - * tests/winFCmd.test: - * tests/tcltest.test: corrected tests to better account for behaviour - of writable/non-writable directories on Windows 2000/XP. This, with - the previous patches, closes [Bug 1193497] - -2006-03-17 Andreas Kupries - - * doc/chan.n: Updated with documentation for the commands 'chan - create' and 'chan postevent' (TIP #219). - - * doc/refchan.n: New file. Documentation of the command handler API - for reflected channels (TIP #219). - -2006-03-17 Joe Mistachkin - - * unix/tclUnixPort.h: Include pthread.h prior to pthread_np.h [Bug - 1444692] - - * win/tclWinTest.c: Corrected typo of 'initializeMutex' that prevented - successful compilation. - -2006-03-16 Andreas Kupries - - * doc/open.n: Documented the changed behaviour of 'a'ppend mode. - - * tests/io.test (io-43.1 io-44.[1234]): Rewritten to be self-contained - with regard to setup and cleanup. [Bug 681793] - - * generic/tclIOUtil.c (TclGetOpenMode): Added the flag O_APPEND to the - list of POSIX modes used when opening a file for 'a'ppend. This - enables the proper automatic seek-to-end-on-write by the OS. See [Bug - 680143] for longer discussion. - - * tests/ioCmd.test (iocmd-13.7.*): Extended the testsuite to check the - new handling of 'a'. - -2006-03-15 Andreas Kupries - - * tests/socket.test: Extended the timeout in socket-11.11 from 10 to - 40 seconds to allow for really slow machines. Also extended - actual/expected results with value of variable 'done' to make it - clearer when a test fails due to a timeout. [Bug 792159] - -2006-03-15 Vince Darley - - * win/fCmd.test: add proper test constraints so the new tests don't - run on Unix. - -2006-03-14 Andreas Kupries - - * generic/tclPipe.c (TclCreatePipeline): Modified the processing of - pipebars to fail if the last bar is followed only by redirections. - [Bug 768659] - -2006-03-14 Andreas Kupries - - * doc/fconfigure.n: Clarified that -translation is binary is reported - as lf when queried, because it is identical to lf, except for the - special additional behaviour when setting it. [Bug 666770] - -2006-03-14 Andreas Kupries - - * doc/clock.n: Removed double-quotes around section title NAME; not - needed. - * unix/installManpage: Reverted part to handle double-quotes in - section NAME, chokes older sed installations. - -2006-03-14 Andreas Kupries - - * library/tm.tcl (::tcl::tm::Defaults): Fixed handling of environment - variable TCLX.y_TM_PATH, bad variable reference. Thanks to Julian - Noble. [Bug 1448251] - -2006-03-14 Vince Darley - - * win/tclWinFile.c: updated patch to deal with 'file writable' issues - on Windows XP/2000. - * generic/tclTest.c: - * unix/tclUnixTest.c: - * win/tclWinTest.c: - * tests/fCmd.test: updated test suite to deal with correct permissions - setting and differences between XP/2000 and 95/98 3 tests still fail; - to be dealt with shortly - -2006-03-13 Don Porter - - * generic/tclEncoding.c: Report error when an escape encoding is - missing one of its sub-encodings. [Bug 506653] - - * unix/configure.in: Revert change from 2005-07-26 that sometimes - * unix/configure: added $prefix/share to the tcl_pkgPath. See - [Patch 1231015]. autoconf-2.59. - -2006-03-10 Miguel Sofer - - * generic/tclProc.c (ObjInterpProcEx): - * tests/apply.test (apply-5.1): Fix [apply] error messages so that - they quote the lambda expression. [Bug 1447355] - -2006-03-10 Zoran Vasiljevic - - -- Summary of changes fixing [Bug 1437595] -- - - * generic/tclEvent.c: Cosmetic touches and identation - * generic/tclInt.h: Added TclpFinalizeSockets() call. - - * generic/tclIO.c: Calls TclpFinalizeSockets() as part of the - TclFinalizeIOSubsystem(). - - * unix/tclUnixSock.c: Added no-op TclpFinalizeSockets(). - - * win/tclWinPipe.c, win/tclWinSock.c: Finalization of sockets/pipes is - now solely done in TclpFinalizeSockets() and TclpFinalizePipes() and - not over the thread-exit handler, because the order of actions the Tcl - generic core will impose may result in cores/hangs if the thread exit - handler tears down corresponding subsystem(s) too early. - -2006-03-10 Vince Darley - - * win/tclWinFile.c: previous patch breaks tests, so removed. - -2006-03-09 Vince Darley - - * win/tclWinFile.c: fix to 'file writable' in certain XP directories. - Thanks to fvogel and jfg. [Patch 1344540] Modified patch to make use - of existing use of getSecurityProc. - -2006-03-08 Don Porter - - * generic/tclExecute.c: Complete missing bit of TIP 215 implementation - * tests/incr.test: - -2006-03-07 Joe English - - * unix/tcl.m4: Set SHLIB_LD_FLAGS='${LIBS}' on NetBSD, as per the - other *BSD variants. [Bug 1334613] - * unix/configure: Regenerated. - -2006-03-07 Don Porter - - * changes: Update in prep. for 8.5a4 release. - - * unix/Makefile.in: Package http 2.5.2 requires Tcl 8.4, so the - * win/Makefile.in: *.tm installation has to be placed in an "8.4" - directory, not an "8.2" directory. - -2006-03-06 Don Porter - - * generic/tclBasic.c: Revised handling of TCL_EVAL_* flags to - * tests/parse.test: simplify TclEvalObjvInternal and to correct - the auto-loading of alias targets (parse-8.12). [Bug 1444291] - -2006-03-03 Don Porter - - * generic/tclPathObj.c: Revised yesterday's fix for [Bug 1379287] to - work on Windows. - - * generic/tclObj.c: Compatibility support for existing code that - calls Tcl_GetObjType("boolean"). - -2006-03-02 Don Porter - - * generic/tclPathObj.c: Fix for failed normalization of paths - * tests/fileSystem.test: with /../ that lead back to the root - of the filesystem, like /foo/.. [Bug 1379287] - -2006-03-01 Reinhard Max - - * unix/installManPage: Fix the script for manpages that have quotes - around the .SH arguments, as doctools produces them. [Bug 1292145] - Some minor cleanups and improvements. - -2006-02-28 Don Porter - - * generic/tclBasic.c: Corrections to be sure that TCL_EVAL_GLOBAL - * tests/namespace.test: evaluations act the same as [uplevel #0] - * tests/parse.test: evaluations, even when execution traces or - * tests/trace.test: invocations of [::unknown] are present. [Bug - 1439836] - -2006-02-22 Don Porter - - * generic/tclBasic.c: Corrected a few bugs in how [namespace - * tests/namespace.test: unknown] interacts with TCL_EVAL_* flags. - [Patch 958222] - -2006-02-17 Don Porter - - * generic/tclIORChan.c: Revised error message generation and handling - * tests/ioCmd.test: of exceptional return codes in the channel - reflection layer. [Bug 1372348] - -2006-02-16 Don Porter - - * generic/tclIndexObj.c: Disallow the "ambiguous" error message - * tests/indexObj.test: when TCL_EXACT matching is requested. - * tests/ioCmd.test: - -2006-02-15 Don Porter - - * generic/tclIO.c: Made several routines tolerant of - * generic/tclIORChan.c: interp == NULL arguments. [Bug 1380662] - * generic/tclIOUtil.c: - -2006-02-09 Don Porter - - TIP#215 IMPLEMENTATION - - * doc/incr.n: Revised [incr] to auto-initialize when varName - * generic/tclExecute.c: argument is unset. [Patch 1413115] - * generic/tclVar.c: - * tests/compile.test: - * tests/incr-old.test: - * tests/incr.test: - * tests/set.test: - - * tests/main.test (Tcl_Main-6.7): Improved robustness of - command auto-completion test. [Bug 1422736] - -2006-02-08 Donal K. Fellows - - * doc/Encoding.3, doc/encoding.n: Updates due to review at request of - Don Porter. Mostly minor changes. - -2006-02-08 Don Porter - - TIP#258 IMPLEMENTATION - - * doc/Encoding.3: New subcommand [encoding dirs]. - * doc/encoding.n: New routine Tcl_GetEncodingNameFromEnvironment - * generic/tcl.decls: Made public: - * generic/tclBasic.c: TclGetEncodingFromObj - * generic/tclCmdAH.c: -> Tcl_GetEncodingFromObj - * generic/tclEncoding.c:TclGetEncodingSearchPath - * generic/tclInt.decls: -> Tcl_GetEncodingSearchPath - * generic/tclInt.h: TclSetEncodingSearchPath - * generic/tclTest.c: -> Tcl_SetEncodingSearchPath - * library/init.tcl: Removed commands: - * tests/cmdAH.test: [tcl::unsupported::EncodingDirs] - * tests/encoding.test: [testencoding path] (Tcltest) - * unix/tclUnixInit.c: [Patch 1413934] - * win/tclWinInit.c: - - * generic/tclDecls.h: make genstubs - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - -2006-02-01 Miguel Sofer - - * generic/tclProc.c: minor improvements to [apply] - * tests/apply.test: new tests; apply-5.1 currently fails to indicate - missing work in error reporting - -2006-02-01 Don Porter - - TIP#194 IMPLEMENTATION - - * doc/apply.n: (New file) New command [apply]. [Patch 944803] - * doc/uplevel.n: - * generic/tclBasic.c: - * generic/tclInt.h: - * generic/tclProc.c: - * tests/apply.test: (New file) - * tests/proc-old.test: - * tests/proc.test: - - TIP#181 IMPLEMENTATION - - * doc/Namespace.3: New command [namespace unknown]. New public C - * doc/namespace.n: routines Tcl_(Get|Set)NamespaceUnknownHandler. - * doc/unknown.n: [Patch 958222] - * generic/tcl.decls: - * generic/tclBasic.c: - * generic/tclInt.h: - * generic/tclNamesp.c: - * tests/namespace.test: - - * generic/tclDecls.h: make genstubs - * generic/tclStubInit.c: - - TIP#250 IMPLEMENTATION - - * doc/namespace.n: New command [namespace upvar]. [Patch 1275435] - * generic/tclInt.h: - * generic/tclNamesp.c: - * generic/tclVar.c: - * tests/namespace.test: - * tests/upvar.test: - -2006-01-26 Donal K. Fellows - - * doc/dict.n: Fixed silly bug in example. Thanks to Heiner Marxen - for catching this! [Bug 1415725] - -2006-01-26 Donal K. Fellows - - * unix/tclUnixChan.c (TclpOpenFileChannel): Tidy up and comment the - mess to do with setting up serial channels. This (deliberately) breaks - a broken FreeBSD port, indicates what we're really doing, and reduces - the amount of conditional compilation sections for better maintenance. - -2006-01-25 Donal K. Fellows - - * unix/tclUnixInit.c (TclpInitPlatform): Improved conditions on when - to update the FP rounding mode on FreeBSD, taken from FreeBSD port. - -2006-01-23 Donal K. Fellows - - * tests/string.test (string-12.21): Added test for [Bug 1410553] based - on original bug report. - -2006-01-23 Miguel Sofer - - * generic/tclStringObj.c: fixed incorrect handling of internal rep in - Tcl_GetRange. Thanks to twylite and Peter Spjuth. [Bug 1410553] - - * generic/tclProc.c: fixed args handling for precompiled bodies [Bug - 1412695]; thanks to Uwe Traum. - -2006-01-16 Reinhard Max - - * generic/tclPipe.c (FileForRedirect): Prevent nameString from being - freed without having been initialized. - * tests/exec.test: Added a test for the above. - -2006-01-12 Zoran Vasiljevic - - * generic/tclPathObj.c (Tcl_FSGetInternalRep): backported patch from - core-8-4-branch. A freed pointer has been overwritten causing all - sorts of coredumps. - -2006-01-12 Vince Darley - - * win/tclWinFile.c: fix to sharing violation [Bug 1366227] - -2006-01-11 Don Porter - - * generic/tclBasic.c: Moved Tcl_LogCommandInfo from tclBasic.c to - * generic/tclNamesp.c: tclNamesp.c to get access to identifier with - * tests/error.test (error-7.0): file scope. Added check for traces on - ::errorInfo, and when present fall back to contruction of the stack - trace in the variable so that write trace notification timings are - compatible with earlier Tcl releases. This reduces, but does not - completely eliminate the ***POTENTIAL INCOMPATIBILITY*** created by - the 2004-10-15 commit. [Bug 1397843] - -2006-01-10 Daniel Steffen - - * unix/configure: add caching, use AC_CACHE_CHECK instead of - * unix/configure.in: AC_CACHE_VAL where possible, consistent message - * unix/tcl.m4: quoting, sync relevant tclconfig/tcl.m4 changes - and gratuitous formatting differences, fix SC_CONFIG_MANPAGES with - default argument, Darwin improvements to SC_LOAD_*CONFIG. - -2006-01-09 Don Porter - - * generic/tclNamesp.c (NamespaceInscopeCmd): [namespace inscope] - * tests/namespace.test: commands were not reported by [info level]. - [Bug 1400572] - -2006-01-09 Donal K. Fellows - - * generic/tclTrace.c: Stop exporting the guts of the trace command; - nothing outside this file needs to see it. [Bug 971336] - -2006-01-05 Donal K. Fellows - - * unix/tcl.m4 (TCL_CONFIG_SYSTEM): Factor out the code to determine - the operating system version number, as it was replicated in several - places. - -2006-01-04 David Gravereaux - - * win/tclAppInit.c: WIN32 native console signal handler removed. This - was found to be interfering with TWAPI extension one. IMO, special - services such as signal handlers should best be done with extensions - to the core after discussions on c.l.t. about Roy Terry's tclsh - children of a real windows service shell. - - ****************************************************************** - *** CHANGELOG ENTRIES FOR 2005 IN "ChangeLog.2005" *** - *** CHANGELOG ENTRIES FOR 2004 IN "ChangeLog.2004" *** - *** CHANGELOG ENTRIES FOR 2003 IN "ChangeLog.2003" *** - *** CHANGELOG ENTRIES FOR 2002 IN "ChangeLog.2002" *** - *** CHANGELOG ENTRIES FOR 2001 IN "ChangeLog.2001" *** - *** CHANGELOG ENTRIES FOR 2000 IN "ChangeLog.2000" *** - *** CHANGELOG ENTRIES FOR 1999 AND EARLIER IN "ChangeLog.1999" *** - ****************************************************************** diff --git a/ChangeLog.2008 b/ChangeLog.2008 deleted file mode 100644 index 9c4e951..0000000 --- a/ChangeLog.2008 +++ /dev/null @@ -1,3796 +0,0 @@ -2008-12-31 Don Porter - - * unix/Makefile.in: Set TCLLIBPATH in SHELL_ENV so that targets - like `make shell` have access to builds of bundled packages. - -2008-12-28 Donal K. Fellows - - * generic/tclZlib.c (Tcl_ZlibStreamPut): Plug a memory leak. - -2008-12-27 Donal K. Fellows - - * generic/tclZlib.c (ZlibStreamCmd): Fix compilation consistency. [Bug - * generic/tcl.decls: 2470237] - - * generic/tclZlib.c (Tcl_ZlibStreamGet): Corrected the semantics of - this function to be useful to the PNG implementation. If the argument - object is empty, this gives the previous semantics. - (Tcl_ZlibStreamChecksum): Corrected name to be less misleading; it - only produced Adler-32 checksums when the stream was processing the - right type of compressed data format. - (Tcl_ZlibAdler32, Tcl_ZlibCRC32): Corrected types so that they work - naturally with the results of Tcl_GetByteArrayFromObj(). - *** POTENTIAL INCOMPATIBILITY *** for all above changes, but very - unlikely to be difficult for anyone to deal with. - -2008-12-26 Donal K. Fellows - - * generic/tcl.decls: Tidy up the commenting style, adding markers for - each of the big release points under TCT stewardship and noting the - general purpose of each TIP that added C API. Overall effect is to - make this file much more informative to read without having to spend - effort correlating with TIPs and ChangeLogs. - -2008-12-23 Jan Nijtmans - - * win/Makefile.in: Fix build of zlib objects with msvc - * win/tcl.m4: - * win/configure: autoconf-2.59 - -2008-12-23 Donal K. Fellows - - * win/Makefile.in: Handle file extensions correctly. [Bug 2459725] - -2008-12-22 Pat Thoyts - - *** 8.6b1 TAGGED FOR RELEASE *** - - * win/makefile.vc: Ensure pkgs directories are suitable and quote the - paths. [Bug 2458395] - -2008-12-22 Joe Mistachkin - - * tools/man2help2.tcl: Added support for "\(mi" nroff macro. [Bug - 2330040] - -2008-12-22 Pat Thoyts - - * win/makefile.vc: Support the pkgs tree in the NMAKE builds. - -2008-12-21 Daniel Steffen - - * unix/Makefile.in: Fix broken build of bundled packages when path - to build dir contains spaces by switching to - relative paths to toplevel build dir. - - * unix/configure.in: Preserve configure environment variables for - sub-configures of bundled packages; reuse - configure cache file for sub-configures. - - * unix/configure: autoconf-2.59 - -2008-12-21 Donal K. Fellows - - * doc/TclZlib.3: Fix minor typo. [Bug 2455165] - -2008-12-20 Kevin B. Kenny - - * win/Makefile.in: Renamed the static library libtcl86s.a to - * win/configure.in: have a name distinct from the import library - libtcl86.a. This renaming dodges an ancient - bug in the Makefile revealed by the last - commit where the $(TCL_LIB_FILE) rule can - fire to try to build the static library in a - --enable-shared build (and create a static - library that subsequently fails to link). - Revised the zlib objects so that they are - built directly into the build dir, without - building an intermediate static library. - *** POTENTIAL INCOMPATIBILITY *** for - embedders who link to the static library, but - I couldn't figure out how to sort this out - any other way. - * win/configure: Autoconf 2.59 - -2008-12-20 Donal K. Fellows - - * win/Makefile.in: Minor updates to make building work better with - msys on Windows. (Apparently the gcc used doesn't like a / at the end - of a -I argument...) - -2008-12-20 Don Porter - - * changes: Updates for 8.6b1 release. - -2008-12-20 Daniel Steffen - - * unix/Makefile.in: Make package install directory of bundled - * unix/configure.in: packages configurable via PACKAGE_DIR makefile - variable (set to platform-specific default). - - * unix/Makefile.in (*-packages): Ensure toplevel targets fail if - sub-make/configure fails; fix quoting when - builddir path contains spaces. - - * macosx/GNUmakefile: Add install-packages to install targets. - - * unix/configure: autoconf-2.59 - -2008-12-19 Don Porter - - * doc/NRE.3: Formatting errors found by `make html` - * doc/Tcl_Main.3: - * doc/zlib.n: - - * tests/chanio.test: Add missing [removeFile] cleanups. - * tests/io.test: Add missing [close $f] to io-73.2. - - * unix/Makefile.in: Update `make dist' target to include the files - from the compat/zlib directory as well as all the bundled packages - found under the pkgs directory, according to their individual `make - dist' targets. Change includes breaking a `configure-packages' target - out of the `packages` target. - - * README: Bump version number to 8.6b1 - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - -2008-12-19 Jan Nijtmans - - * generic/tclInt.decls: CONSTify TclGetLoadedPackages second param - * generic/tclLoad.c - * generic/tclIntDecls.h (regenerated) - -2008-12-19 Kevin Kenny - - * generic/tclExecute.c: Fix compile warnings when --enable-symbols=all - - * win/configure.in: - * win/Makefile.in: Added build of packages in the 'pkgs/' directory. - * win/configure: Autoconf 2.59 - -2008-12-19 Pat Thoyts - - * win/makefile.vc: Added build of compat/zlib - -2008-12-18 Andreas Kupries - - * generic/tclIO.c (Tcl_CloseEx, CloseWrite, CloseChannelPart) - (ChanCloseHalf): Rewrite the half-close to properly flush the channel, - like is done for a full close, going through FlushChannel, and using - the flag BG_FLUSH_SCHEDULED (async flush during close). New functions - CloseWrite, CloseChannelPart, new flag CHANNEL_CLOSEDWRITE. - - * tests/chanio.test (chanio-28.[67]): Reactivated these tests. - Replaced tclsh -> [interpreter] to get correct executable for the pipe - process, and added after cancel to kill the fail timers when we are - done. Removed the explicits calls to [flush], now that [close] handles - this correctly. - -2008-12-18 Don Porter - - * tests/chanio.test: Replaced [chan event] handlers that returned - TCL_RETURN return code, with more conventional ones that return TCL_OK - to suppress otherwise strange writes of outdated $::errorInfo values - to stderr. [Bug 2444274] - - * generic/tclExecute.c: Disabled apparently faulty assertion. [Bug - 2415422] - -2008-12-18 Donal K. Fellows - - * unix/configure.in, unix/Makefile.in: Autoconf wizardry. - * compat/zlib/*: Import of zlib 1.2.3. The license is directly - compatible with Tcl's. This import omits the obsolete and contributed - parts (i.e. selected directories) and the supplied examples. - - * generic/tclZlib.c: First implementation of the compressing and - * doc/zlib.n: decompressing channel transformations. - * tests/zlib.test (zlib-8.*): - -2008-12-18 Jan Nijtmans - - * generic/tcl.decls: VOID -> void - * generic/tclInt.decls: - * compat/dlfcn.h: - * generic/tclDecls.h: (regenerated) - * generic/tclIntDecls.h: - -2008-12-18 Alexandre Ferrieux - - TIP #332 IMPLEMENTATION - Half-Close for Bidirectional Channels - - * doc/close.n, generic/tclIO.c, generic/tclIOCmd.c: - * unix/tclUnixChan.c, unix/tclUnixPipe.c, win/tclWinSock.c: - * generic/tcl.decls, generic/tclDecls.h, generic/tclStubInit.c: - * tests/chan.test, tests/chanio.test, tests/ioCmd.test: - -2008-12-17 Donal K. Fellows - - * doc/SetChanErr.3: General improvements in nroff rendering and some - corrections to language issues. - -2008-12-17 Jan Nijtmans - - * generic/tclResult.c: Move variable "length" inside if() - * generic/tclStringObj.c: Don't use ckfree((void *)...) but - * generic/tclVar.c: ckfree((char *)...) - * generic/tclZlib.c - * generic/tclBasic.c - -2008-12-17 Donal K. Fellows - - * tests/namespace.test (namespace-28.1): Make tests not - * tests/namespace-old.test (namespace-old-9.5): dependent on the - global namespace's particular imports. [Bug 2433936] - -2008-12-17 Don Porter - - * unix/Makefile.in: Modify the distclean-packages target so that - empty build directories are deleted. - - * unix/Makefile.in: Add build support for collections of TEA - * unix/configure.in: packages found under the pkgs directory. - [Patch 1163406]. Still needs porting to Windows. - - * unix/configure: autoconf-2.59 - -2008-12-17 Donal K. Fellows - - * generic/tcl.h, generic/tclZlib.c: Removed undocumented flag. - -2008-12-16 Jan Nijtmans - - * generic/tclThreadTest.c: Eliminate -Wwrite-strings warnings in - --enable-threads build. - * generic/tclExecute.c: Use TclNewLiteralStringObj() - * unix/tclUnixFCmd.c: Use TclNewLiteralStringObj() - * win/tclWinFCmd.c: Use TclNewLiteralStringObj() - -2008-12-16 Donal K. Fellows - - TIP #329 IMPLEMENTATION - - * tests/error.test: Tests for the new commands. - * doc/throw.n, doc/try.n: Documentation of the new commands. - * library/init.tcl (throw, try): Implementation of commands documented - in TIP. This implementation is in Tcl and is a stop-gap until - higher-performance ones can be written. - -2008-12-16 Don Porter - - * generic/tcl.h: Add TIP 338 routines to stub table. - * generic/tcl.decls: [Bug 2431338] - - * generic/tclDecls.h: make genstubs - * generic/tclStubInit.c: - -2008-12-15 Donal K. Fellows - - * generic/tclExecute.c (TEBC:INST_DICT_GET): Make sure that the result - is empty when generating an error message. [Bug 2431847] - -2008-12-15 Alexandre Ferrieux - - * generic/tclBinary.c: Redefine non-strict decoding to ignore only - * doc/binary.n: whitespace. [Bug 2380293] - * tests/binary.test: - -2008-12-15 Don Porter - - * doc/AddErrInfo.3: Documented Tcl_(Set|Get)ErrorLine (TIP 336). - * doc/CrtCommand.3: Various other documentation updates to - * doc/CrtInterp.3: reflect the lack of access to Tcl_Interp - * doc/Interp.3: fields by default. - * doc/SetResult.3: - * doc/tcl.decls: - - TIP #338 IMPLEMENTATION - - * doc/AppInit.c: Made routines Tcl_SetStartupScript and - * doc/Tcl_Main.3: Tcl_GetStartupScript public. Removed all - * generic/tcl.h: internal stub access to Tcl*Startup* routines, - * generic/tclInt.decls: and removed their implementations. Their - * generic/tclMain.c: function can now be completely performed with - the new public interface. - *** POTENTIAL INCOMPATIBILITY for callers of the internal - Tcl*Startup* routines. *** - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - * generic/tclDecls.h: - -2008-12-14 Donal K. Fellows - - * tests/zlib.test: Added constraint so that tests don't fail where - they cannot work due to zlib support being missing. - - * unix/configure.in, win/configure.in: Improve the autodetection code. - * win/tcl.m4 (SC_CONFIG_CFLAGS): Remove the assumption of the presence - of zlib library on Windows. - * win/makefile.vc, win/makefile.bc: Add support for building tclZlib.o - but only in stubbed-out mode for now. - -2008-12-13 Donal K. Fellows - - * doc/TclZlib.3: Basic documentation of the C-level API. - * doc/zlib.n: Substantially improve documentation of Tcl-level API. - * generic/tclZlib.c (ZlibCmd): Flesh out the argument parsing for the - command to integrate with channels. - -2008-12-12 Jan Nijtmans - - * generic/tclZlib.c (Tcl_ZlibInflate): Change PATH_MAX to MAXPATHLEN, - since MSVC doesn't have PATH_MAX. - - * doc/clock.n: Document new DST fallback rules. - * library/clock.tcl (ProcessPosixTimeZone): Fix time change in Eastern - Europe (not 3:00 but 4:00 local time). [Bug 2207436] - -2008-12-12 Donal K. Fellows - - * generic/tclZlib.c, unix/configure.in: Added stubs to use when the - version of zlib is not capable enough, and automagic to detect when - that is the case. [Bug 2421265] - -2008-12-12 Alexandre Ferrieux - - * unix/tclUnixNotfy.c: Fix missing CLOEXEC on internal pipes [2417695] - * unix/tclUnixPipe.c: Fix missing CLOEXEC on [chan pipe] fds. - -2008-12-12 Donal K. Fellows - - * generic/tclZlib.c (Tcl_ZlibDeflate): Add a bit of extra space for - the gzip header. [Bug 2419061] - (Tcl_ZlibInflate): Ensure that gzip header extraction is done - correctly. - -2008-12-12 Kevin Kenny - - TIP #322 IMPLEMENTATION - - * doc/NRE.3 (new file): Added documentation of the published API for - Non-Recursive Evaluation (NRE). - -2008-12-11 Jan Nijtmans - - * generic/tclZlib.c: Eliminate warning: different 'const' qualifiers - with msvc compiler. A few more 'const' optimizations. - * win/tcl.m4: Fix Windows build (msvc) for TIP #234 implementation - * win/Makefile.in: - * win/configure: - -2008-12-11 Andreas Kupries - - * generic/tclIO.c (SetChannelFromAny and related): Modified the - * tests/io.test: internal representation of the tclChannelType to - contain not only the ChannelState pointer, but also a reference to - the interpreter it was made in. Invalidate and recompute the - internal representation when it is used in a different interpreter, - like cmdName intrep's. Added testcase. [Bug 2407783] - -2008-12-11 Donal K. Fellows - - * generic/tclZlib.c (ConvertError): Factor out code to turn zlib - errors into Tcl errors. - - * doc/zlib.n: Added a start at the documentation. Still very rough. - -2008-12-11 Jan Nijtmans - - * win/Makefile.in: Fix Windows build (mingw) for TIP #234 - implementation (additionally, first make sure that zlib is available, - and rename the standard zdll.lib to libz.a, but at least this works so - far). - -2008-12-11 Donal K. Fellows - - * tests/zlib.test: Start of test suite for zlib command. - -2008-12-11 Jan Nijtmans - - * library/clock.tcl (ProcessPosixTimeZone): Fallback to European time - zone DST rules, when the timezone is between 0 and -12. [Bug 2207436] - * tests/clock.test (clock-52.[23]): Test cases for [Bug 2207436] - -2008-12-11 Donal K. Fellows - - TIP #234 IMPLEMENTATION - - * generic/tclZlib.c: A very preliminary hack at an interface to the - zlib library, based on code from Pascal Scheffers. - WARNING! The C API may be subect to change without much warning! USE - AT YOUR OWN RISK! - -2008-12-10 Kevin B. Kenny - - * library/tzdata/*: Update from Olson's tzdata2008i. - -2008-12-10 Alexandre Ferrieux - - TIP #343 IMPLEMENTATION - A Binary Specifier for [format/scan] - - * doc/format.n - * doc/scan.n - * generic/tclInt.h - * generic/tclScan.c - * generic/tclStrToD.c - * generic/tclStringObj.c - * tests/format.test - * tests/scan.test - -2008-12-10 Donal K. Fellows - - TIP #341 IMPLEMENTATION - - * generic/tclDictObj.c (DictFilterCmd): Made key and value filtering - * tests/dict.test, doc/dict.n: accept arbitrary numbers of - glob arguments. - -2008-12-09 Jan Nijtmans - - * generic/tclInt.decls: Restore source and binary compatibility for - TIP #337 implementation. (When it is _that_ - simple, there is no excuse not to do it! :-)) - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - -2008-12-09 Don Porter - - TIP #337 IMPLEMENTATION - - * doc/BackgdErr.3: Converted internal routine - * doc/interp.n: TclBackgroundException() into public routine - * generic/tcl.decls: Tcl_BackgroundException(). - * generic/tclEvent.c: - * generic/tclInt.decls: - - * generic/tclDecls.h: make genstubs - * generic/tclIntDecls.h: - * generic/tclStubInit.c: - - * generic/tclIO.c: Update callers. - * generic/tclIOCmd.c: - * generic/tclInterp.c: - * generic/tclTimer.c: - *** POTENTIAL INCOMPATIBILITY only for extensions using the converted - internal routine *** - -2008-12-09 Donal K. Fellows - - * generic/tclIO.c (ChanClose,ChanRead,...): Factored out some of the - code to connect to channel drivers that was common in multiple - locations so as to make code more readable. - -2008-12-06 Donal K. Fellows - - * generic/tclCmdAH.c (FileTempfileCmd): Force temporary files to be - created in the native filesystem. Attempting to provide a template - that puts it elsewhere will result in the directory part of the - template being ignored. Partial address of [Bug 2388866] concerns. - -2008-12-05 Donal K. Fellows - - TIP #335 IMPLEMENTATION - - * generic/tclBasic.c (Tcl_InterpActive): Added function for working - * doc/CrtInterp.3: out if an interp is in use. - - TIP #307 IMPLEMENTATION - - * generic/tclResult.c (Tcl_TransferResult): Renamed function from - * generic/tcl.decls: TclTransferResult. Added - * doc/SetResult.3: to public stubs table. - -2008-12-04 Don Porter - - * generic/tclPathObj.c (Tcl_FSGetNormalizedPath): Added another - flag value TCLPATH_NEEDNORM to mark those intreps which need more - complete normalization attention for correct results. [Bug 2385549] - -2008-12-03 Donal K. Fellows - - * win/tclWinPipe.c (TclpOpenTemporaryFile): Avoid an infinite loop due - to GetTempFileName/CreateFile interaction. [Bug 2380318] - -2008-12-03 Don Porter - - * generic/tclFileName.c (DoGlob): One of the Tcl_FSMatchInDirectory - calls did not have its return code checked. This caused error messages - returned by some Tcl_Filesystem drivers to be swallowed. - -2008-12-02 Don Porter - - TIP #336 IMPLEMENTATION - - * generic/tcl.decls: New routines Tcl_(Get|Set)ErrorLine. - * generic/tcl.h: Dropped default access to interp->errorLine. - * generic/tclCmdAH.c: Restore it with -DUSE_INTERP_ERRORLINE. - * generic/tclCmdMZ.c: Updated callers. - * generic/tclDictObj.c: - * generic/tclIOUtil.c: - * generic/tclNamesp.c: - * generic/tclOOBasic.c: - * generic/tclOODefinedCmds.c: - * generic/tclOOMethod.c: - * generic/tclProc.c: - * generic/tclResult.c: - *** POTENTIAL INCOMPATIBILITY for C code directly using the - interp->errorLine field *** - - * generic/tclDecls.h: make genstubs - * generic/tclStubInit.c: - -2008-12-02 Andreas Kupries - - * generic/tclIO.c (TclFinalizeIOSubsystem): Replaced Alexandre - Ferrieux's first patch for [Bug 2270477] with a gentler version, also - supplied by him. - -2008-12-01 Don Porter - - * generic/tclParse.c: Coding standards fixups. - -2008-12-01 Donal K. Fellows - - * tests/cmdAH.test (cmdAH-32.6): Test was not portable; depended on a - C API function not universally available. [Bug 2371623] - -2008-11-30 Kevin B. Kenny - - * library/clock.tcl (format, ParseClockScanFormat): Added a [string - map] to get rid of namespace delimiters before caching a scan or - format procedure. [Bug 2362156] - * tests/clock.test (clock-64.[12]): Added test cases for the bug that - was tickled by a namespace delimiter inside a format string. - -2008-11-29 Donal K. Fellows - - TIP #210 IMPLEMENTATION - - * generic/tclCmdAH.c (FileTempfileCmd): - * unix/tclUnixFCmd.c (TclpOpenTemporaryFile, DefaultTempDir): - * win/tclWinPipe.c (TclpOpenTemporaryFile): - * doc/file.n, tests/cmdAH.test: Implementation of [file tempfile]. I - do not claim that this is a brilliant implementation, especially on - Windows, but it covers the main points. - - * generic/tclThreadStorage.c: General revisions to make code clearer - and more like the style used in the rest of the core. Includes adding - more comments and explanation of what is going on. Reduce the amount - of locking required. - -2008-11-27 Alexandre Ferrieux - - * generic/tcl.h: Alternate fix for [Bug 2251175]: missing - * generic/tclCompile.c: backslash substitution on expanded literals. - * generic/tclParse.c: - * generic/tclTest.c: - * tests/parse.test: - -2008-11-26 Jan Nijtmans - - * generic/tclIndexObj.c: Eliminate warning: unused variable - * generic/tclTest.c: A few more (harmless) Tcl_SetResult - eliminations. - -2008-11-26 Kevin B. Kenny - - * library/tclIndex: Removed reference to no-longer-extant procedure - 'tclLdAout'. - * doc/library.n: Corrected mention of 'auto_exec' to 'auto_execok'. - [Patch 2114900] thanks to Stuart Cassoff - -2008-11-25 Jan Nijtmans - - * generic/tclIndexObj.c: Eliminate 3 calls to Tcl_SetResult, as - * generic/tclIO.c: examples how it should have been done. - * generic/tclTestObj.c: purpose: contribute in the TIP #340 - discussion. - -2008-11-25 Andreas Kupries - - * generic/tclIO.c (TclFinalizeIOSubsystem): Applied Alexandre - Ferrieux's patch for [Bug 2270477] to prevent infinite looping during - finalization of channels not bound to interpreters. - -2008-11-25 Jan Nijtmans - - * generic/tclTest.c: Don't assume that Tcl_SetResult sets - interp->result, especially not in a DString test, in preparation for - TIP #340 - -2008-11-24 Donal K. Fellows - - * tools/tcltk-man2html.tcl: Improvements to tackle tricky aspects of - cross references and new entities to map. [Bug 2330040] - -2008-11-19 Jan Nijtmans - - * generic/tclThreadTest.c: Convert Tcl_SetResult(......, TCL_DYNAMIC) - to Tcl_SetResult(......, TCL_VOLATILE), in preparation for TIP #340 - -2008-11-17 Jan Nijtmans - - * generic/tcl.decls: Fix signature and implementation of - * generic/tclDecls.h: Tcl_HashStats, such that it conforms to the - * generic/tclHash.c: documentation. [Bug 2308236] - * generic/tclVar.c: - * doc/Hash.3: - * generic/tclDictObj.c: Convert Tcl_SetResult call to - Tcl_SetObjResult. - -2008-11-17 Alexandre Ferrieux - - * tests/for.test: Check for uncompiled-for-continue [Bug 2186888] - fixed earlier. - - * generic/tcl.h: Fix [Bug 2251175]: missing backslash - * generic/tclCompCmds.c: substitution on expanded literals. - * generic/tclCompile.c - * generic/tclParse.c - * generic/tclTest.c - * tests/compile.test - * tests/parse.test - -2008-11-16 Jan Nijtmans - - * generic/tclTest.c: Replace two times Tcl_SetResult with - Tcl_SetObjResult, a little simplification in preparation for the TIP - #340 patch. - -2008-11-13 Jan Nijtmans - - * generic/tclInt.h: Rename static function FSUnloadTempFile to - * generic/tclIOUtil.c: TclFSUnloadTempFile, needed in tclLoad.c - - * generic/tclLoad.c: Fixed [Bug 2269431]: Load of shared - objects leaves temporary files on windows. - -2008-11-12 Pat Thoyts - - * tests/registry.test: Use HKCU to avoid requiring admin access for - registry testing on Vista/Server2008 - -2008-11-11 Jan Nijtmans - - * generic/tclNamesp.c: Eliminate warning: passing arg 4 of - Tcl_SplitList from incompatible pointer type. - * win/tcl.m4: Reverted change from 2008-11-06 (was under the - impression that "-Wno-implicit-int" added an extra - warning) - * win/configure: (regenerated) - * unix/tcl.m4: Use -O2 as gcc optimization compiler flag, and get rid - of -Wno-implicit-int for UNIX. - * unix/configure: (regenerated) - -2008-11-10 Andreas Kupries - - * doc/platform_shell.n: Fixed [Bug 2255235], reported by Ulrich - * library/platform/pkgIndex.tcl: Ring . - * library/platform/shell.tcl: Updated the LOCATE command in the - * library/tm.tcl: package 'platform::shell' to handle the new form - * unix/Makefile.in: of 'provide' commands generated by tm.tcl. Bumped - * win/Makefile.in: package to version 1.1.4. Added cross-references - to the relevant parts of the code to avoid future desynchronization. - -2008-11-07 Pat Thoyts - - * generic/tclInt.h: Applied [Patch 2215022] from Duoas to clean up - * generic/tclBinary.c: the binary ensemble initiailization code. - * generic/tclNamesp.c: Extends the TclMakeEnsemble to do - * doc/ByteArrObj.3: sub-ensembles from tables. - -2008-11-06 Jan Nijtmans - - * win/tcl.m4: Add "-Wno-implicit-int" flag for gcc, as on UNIX - * win/configure: (regenerated) - * generic/tclIO.c: Eliminate an 'array index out of bounds' warning - on HP-UX. - -2008-11-04 Jeff Hobbs - - * generic/tclPort.h: Remove the ../win/ header dir as the build system - already has it, and it confuses builds when used with private headers - installed. - -2008-11-01 Donal K. Fellows - - * generic/tclOO.h (TCLOO_VERSION): Bump version of TclOO. - -2008-10-31 Donal K. Fellows - - * generic/tclOOBasic.c (TclOONRUpcatch): Reworked the code that does - * generic/tclOO.c (InitFoundation): class constructor handling so - that it is more robust and runs the constructor call in the context of - the caller of the class's constructor method. Needed because the - previously used code did not work at all after applying the fix below; - no Tcl existing command could reliably do what was needed any more. - - * generic/tclOODefineCmds.c (GetClassInOuterContext): Rework and - factor out the code to resolve class names in definitions so that - classes are resolved from the perspective of the caller of the - [oo::define] command, rather than from the oo::define namespace! This - makes much code simpler by reducing how often fully-qualified names - are required (previously always in practice, so no back-compat issues - exist). [Bug 2200824] - -2008-10-28 Jan Nijtmans - - * generic/tclCompile.h: CONSTify TclDTraceInfo - * generic/tclBasic.c: - * generic/tclProc.c: - * generic/tclEnv.c: Eliminate some -Wwrite-strings warnings - * generic/tclLink.c: - -2008-10-27 Don Porter - - * generic/tclEncoding.c: Use "iso8859-1" and not "identity" as - the default and original [encoding system] value. Since "iso8859-1" is - built in to the C source code for Tcl now, there's no availability - issue, and it has the good feature of "identity" that we must have - ("bytes in" == "bytes out") without the bad feature of "identity" - ("broken as designed") that makes us want to abandon it. [RFE 2008609] - *** POTENTIAL INCOMPATIBILITY for older releases of Tclkit and any - other code expecting a particular value for Tcl's default system - encoding *** - -2008-10-24 Pat Thoyts - - * library/http/http.tcl: Fixed a failure to read SHOUTcast streams - with the new 2.7 package. Introduced a new intial state as the first - response may not be HTTP*. - -2008-10-23 Miguel Sofer - - * generic/tclCmdAH.c (ForNextCallback): handle TCL_CONTINUE in the for - body. [Bug 2186888] - -2008-10-22 Jan Nijtmans - - * generic/tcl.h: CONST -> const and white-spacing - * generic/tclCompile.h: - * generic/tclEncoding.c: - * generic/tclStubInit.c: - * generic/tclStubLib.c: - * generic/tcl.decls - * generic/tclInt.decls - * generic/tclTomMath.decls - * generic/tclDecls.h: (regenerated) - * generic/tclIntDecls.h: (regenerated) - * generic/tclIntPlatDecls.h: (regenerated) - * generic/tclOODecls.h: (regenerated) - * generic/tclOOIntDecls.h: (regenerated) - * generic/tclPlatDecls.h: (regenerated) - * generic/tclTomMathDecls.h: (regenerated) - * generic/tclIntDecls.h: (regenerated) - * tools/genStubs.tcl: CONST -> const and white-spacing - -2008-10-19 Don Porter - - * generic/tclProc.c: Reset -level and -code values to defaults - after they are used. [Bug 2152286] - -2008-10-19 Donal K. Fellows - - * generic/tclBasic.c (TclInfoCoroutineCmd): Added code to make this - check for being invoked in a syntactically correct way. - - * doc/info.n: Added documentation of [info coroutine]. - - * doc/prefix.n: Improved the documentation by fixing formatting, - adding good-practice recommendations and cross-references, etc. - -2008-10-17 Jan Nijtmans - - * generic/tclOO.decls: CONST -> const. - * generic/tclOODecls.h: (regenerated) - * generic/tclOOIntDecls.h: (regenerated) - -2008-10-17 Andreas Kupries - - * generic/tclIORTrans.c (DeleteReflectedTransformMap): Removed debug - output in C++ comment. - -2008-10-17 Don Porter - - * generic/tclCompile.h: Declare the internal tclInstructionTable to - * generic/tclExecute.c: simply be "const", not CONST86. - - * generic/tclCmdAH.c: whitespace. - * generic/tclCmdIL.c: Uninitialized variable warning. - * generic/tclTest.c: const correctness warning. - -2008-10-17 Donal K. Fellows - - * doc/*: Many very small formatting fixes. - * doc/{glob,http,if}.n: More substantial reformatting for clarity. - * doc/split.n: Remove mention of defunct c.l.t.announce - -2008-10-16 Jan Nijtmans - - * generic/regc_locale.c: Add "const" to many internal const tables. - * generic/tclClock.c: No functional or API change. - * generic/tclCmdIL.c - * generic/tclConfig.c - * generic/tclDate.c - * generic/tclEncoding.c - * generic/tclEvent.c - * generic/tclExecute.c - * generic/tclFileName.c - * generic/tclGetDate.y - * generic/tclInterp.c - * generic/tclIO.c - * generic/tclIOCmd.c - * generic/tclIORChan.c - * generic/tclIORTrans.c - * generic/tclLoad.c - * generic/tclObj.c - * generic/tclOOBasic.c - * generic/tclOOCall.c - * generic/tclOOInfo.c - * generic/tclPathObj.c - * generic/tclPkg.c - * generic/tclResult.c - * generic/tclStringObj.c - * generic/tclTest.c - * generic/tclTestObj.c - * generic/tclThreadTest.c - * generic/tclTimer.c - * generic/tclTrace.c - * macosx/tclMacOSXFCmd.c - * win/cat.c - * win/tclWinInit.c - * win/tclWinTest.c - -2008-10-16 Don Porter - - * library/init.tcl: Revised [unknown] so that it carefully - preserves the state of the ::errorInfo and ::errorCode variables at - the start of auto-loading and restores that state before the - autoloaded command is evaluated. [Bug 2140628] - -2008-10-15 Jan Nijtmans - - * generic/tclInt.h: Add "const" to many internal const tables, so - * generic/tclBinary.c: those will be put by the C-compiler in the - * generic/tclCompile.c: TEXT segment in stead of the DATA segment. - * generic/tclDictObj.c: This makes those tables sharable in shared - * generic/tclHash.c: libraries. - * generic/tclListObj.c: - * generic/tclNamesp.c: - * generic/tclObj.c: - * generic/tclProc.c: - * generic/tclRegexp.c: - * generic/tclStringObj.c: - * generic/tclUtil.c: - * generic/tclVar.c: - -2008-10-14 Jan Nijtmans - - * generic/tclCmdAH.c: Fix minor compiler warnings when compiling - * generic/tclCmdMZ.c: with -Wwrite-strings. - * generic/tclIndexObj.c: - * generic/tclProc.c: - * generic/tclStubLib.c: - * generic/tclUtil.c: - * win/tclWinChan.c: - * win/tclWinDde.c: - * win/tclWinInit.c: - * win/tclWinReg.c: - * win/tclWinSerial.c: - -2008-10-14 Donal K. Fellows - - * doc/binary.n: Formatting fix. - -2008-10-14 Don Porter - - * README: Bump version number to 8.6a4 - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - - * generic/tclExecute.c: Fix compile warnings when --enable-symbols=all - - * generic/tclCmdIL.c: Fix write to unallocated memory whenever - [lrepeat] returns an empty list. - -2008-10-14 Donal K. Fellows - - * doc/chan.n, doc/fconfigure.n: Added even more emphatic text to - direct people to the correct manual pages for specific channel types, - suitable for the hard-of-reading. Following discussion on tcl-core. - -2008-10-13 Pat Thoyts - - * win/tclWinThrd.c (TclpThreadCreate): We need to initialize the - thread id variable to 0 as on 64 bit windows this is a pointer sized - field while windows only fills it with a 32 bit value. The result is - an inability to join the threads as the ids cannot be matched. - - * generic/tclTest.c (TestNRELevels): Set array to the right size. - -2008-10-13 Donal K. Fellows - - * generic/tclOOInfo.c (InfoClassDestrCmd): Handle error case. - - * generic/tclOOInt.h: Added macro magic to make things work with - Objective C. [Bug 2163447] - -2008-10-12 Miguel Sofer - - * generic/tclCompile.c: Fix bug in srcDelta encoding within ByteCodes. - The bug can only be triggered under conditions that cannot happen in - Tcl, but were met during development of L. Thanks go to Robert Netzer - for diagnosis and fix. - -2008-10-10 Don Porter - - *** 8.6a3 TAGGED FOR RELEASE *** - - * changes: Updates for 8.6a3 release. - -2008-10-10 Donal K. Fellows - - * generic/tclOODefineCmds.c (TclOODefineUnexportObjCmd) - (TclOODefineExportObjCmd): Corrected export/unexport record synthesis. - [Bug 2155658] - -2008-10-08 Jan Nijtmans - - * unix/tclUnixChan.c: Fix minor compiler warning. - * unix/tcl.m4: Fix for [Bug 2073255] - * unix/configure: Regenerated - -2008-10-08 Miguel Sofer - - * generic/tclBasic (TclInfoCoroutineCmd): - * tests/unsupported.test: Arrange for [info coroutine] to return {} - when a coroutine is running but the resume command has been deleted. - [Bug 2153080] - -2008-10-08 Don Porter - - * generic/tclTrace.c: Corrected handling of errors returned by - variable traces so that the errorInfo value contains the original - error message. [Bug 2151707] - - * generic/tclVar.c: Revised implementation of TclObjVarErrMsg so - that error message construction does not disturb an existing - iPtr->errorInfo that may be in progress. - -2008-10-07 Donal K. Fellows - - * doc/binary.n: Added better documentation of the [binary encode] and - [binary decode] subcommands. - -2008-10-07 Miguel Sofer - - TIP #327,#328 IMPLEMENTATIONS - - * generic/tclBasic.c: Move [tailcall], [coroutine] and - * generic/tclCmdIL.c: [yield] out of ::tcl::unsupported - * tclInt.h: - * tests/info.test: and into global scope: TIPs #327 - * tests/unsupported.test: and #328 - -2008-10-07 Donal K. Fellows - - * doc/chan.n, doc/transchan.n: Documented the channel transformation - API of TIP #230. - -2008-10-06 Pat Thoyts - - * tests/winFCmd.test: Fixed some erroneous tests on Vista+. - * generic/tclFCmd.c: Fix constness for msvc of last commit - -2008-10-06 Joe Mistachkin - - * tools/man2tcl.c: Added missing line from patch by Harald Oehlmann. - [Bug 1934200] - -2008-10-05 Jan Nijtmans - - * doc/FileSystem.3: CONSTified Tcl_FSFileAttrStringsProc - * generic/tclFCmd.c: and tclpFileAttrStrings. This allows - * generic/tclIOUtil.c: FileSystems to report their attributes - * generic/tclTest.c: as const strings, without worrying that - * unix/tclUnixFCmd.c: Tcl modifies them (which Tcl should not - * win/tclWinFCmd.c: do anyway, but the API didn't indicate that) - * generic/tcl.decls - * generic/tclDecls.h: regenerated - * generic/tcl.h: Make sure that if CONST84 is defined as empty, - CONST86 should be defined as empty as well - (unless overridden). This change complies with - TIP #27 - *** POTENTIAL INCOMPATIBILITY *** - -2008-10-05 Kevin B, Kenny - - * libtommath/bn_mp_sqrt.c (bn_mp_sqrt): Handle the case where a - * tests/expr.test (expr-47.13): number's square root is - between n< - - * generic/tclInt.decls: CONSTified the AuxDataType argument - * generic/tclCompCmds.c: of TclCreateAuxData and - * generic/tclCompile.c: TclRegisterAuxDataType and the return - * generic/tclCompile.h: values of TclGetAuxDataType and - * generic/tclExecute.c: TclGetInstructionTable - * generic/tclIntDecls.h: regenerated - This change complies with TIP #27 (even though it only involves - internal function, so this is not even necessary). - -2008-10-05 Donal K. Fellows - - * generic/tclIndexObj.c (TclInitPrefixCmd): Make the [tcl::prefix] - into an exported command. [Bug 2144595] - -2008-10-04 Donal K. Fellows - - * generic/tclCmdIL.c (InfoFrameCmd): Improved hygiene of result - * generic/tclRegexp.c (TclRegAbout): handling. - -2008-10-04 Jan Nijtmans - - * generic/tclLoad.c: Make sure that any library which doesn't have an - unloadproc is only really unloaded when no library code is executed - yet. [Bug 2059262] - -2008-10-04 Donal K. Fellows - - * generic/tclOOInfo.c (GetClassFromObj): Factor out the code to parse - a Tcl_Obj and get a class. Also make result handling hygienic. - * generic/tclOOBasic.c (TclOOSelfObjCmd): Better hygiene of results, - and stop allocating quite so much memory by sharing special "method" - names. - -2008-10-04 Jan Nijtmans - - * doc/ChnlStack.3: CONSTified the typePtr argument - * doc/CrtChannel.3: of Tcl_CreateChannel and Tcl_StackChannel - * generic/tcl.decls: and the return value of Tcl_GetChannelType - * generic/tcl.h - * generic/tclIO.h - * generic/tclIO.c - * generic/tclDecls.h: regenerated - This change complies with TIP #27. - - * doc/Hash.3: CONSTified the typePtr argument - * generic/tcl.decls: of Tcl_InitCustomHashTable. - * generic/tcl.h - * generic/tclHash.c - * generic/tclDecls.h: regenerated - This change complies with TIP #27. - - * doc/RegConfig.3: CONSTified the configuration argument - * generic/tcl.decls: of Tcl_RegisterConfig. - * generic/tcl.h - * generic/tclConfig.c - * generic/tclPkgConfig.c - * generic/tclDecls.h: regenerated - This change complies with TIP #27. - - * doc/GetIndex.3: CONSTified the tablePtr argument - * generic/tcl.decls: of Tcl_GetIndexFromObj. - * generic/tclIndexObj.c - * generic/tclDecls.h: regenerated - This change complies with TIP #27. - -2008-10-03 Miguel Sofer - - * tests/stack.test: - * unix/tclUnixTest.c: Removed test command teststacklimit and the - corresponding constraint: it is not needed with NRE - -2008-10-03 Donal K. Fellows - - TIP #195 IMPLEMENTATION - - * generic/tclIndexObj.c (TclGetIndexFromObjList, PrefixMatchObjCmd) - * doc/prefix.n, tests/string.test: Added [tcl::prefix] command for - working with prefixes of strings at the Tcl level. [Patch 1040206] - - TIP #265 IMPLEMENTATION - - * generic/tclIndexObj.c (Tcl_ParseArgsObjv, PrintUsage): - * generic/tcl.h (Tcl_ArgvInfo): Added function for simple parsing of - * doc/ParseArgs.3 (new file): optional arguments to commands. Still - needs tests and the like. [FRQ 1446696] Note that some of the type - signatures are changed a bit from the proposed implementation so that - they better reflect codified good practice for argument order. - -2008-10-02 Andreas Kupries - - * tests/info.test (info-23.3): Updated output of the test to handle - the NRE-enabled eval and the proper propagation of location - information through it. [Bug 2017632] - - * doc/info.n: Rephrased the documentation of 'info frame' for positive - numbers as level argument. [Bug 2134049] - - * tests/info.test (info-22.8): Made pattern for file containing - tcltest less specific to accept both .tcl and .tm variants of the file - during matching. [Bug 2129828] - -2008-10-02 Don Porter - - TIP #330 IMPLEMENTATION - - * generic/tcl.h: Remove the "result" and "freeProc" fields - * generic/tclBasic.c: from the default public declaration of the - * generic/tclResult.c: Tcl_Interp struct. Code should no longer - * generic/tclStubLib.c: be accessing these fields. Access can be - * generic/tclTest.c: restored by defining USE_INTERP_RESULT, but - * generic/tclUtil.c: that should only be a temporary migration aid. - *** POTENTIAL INCOMPATIBILITY *** - -2008-10-02 Joe Mistachkin - - * doc/info.n: Fix unmatched font change. - * doc/tclvars.n: Fix unmatched font change. - * doc/variable.n: Fix unmatched font change. - * tools/man2help2.tcl: Integrated patch from Harald Oehlmann. - [Bug 1934272] - * tools/man2tcl.c: Increase MAX_LINE_SIZE to fix "Too long line" error. - * win/buildall.vc.bat: Prefer the HtmlHelp target over the WinHelp - target. [Bug 2072891] - * win/makefile.vc: Fix the HtmlHelp and WinHelp targets to not be - mutually exclusive. - -2008-09-29 Don Porter - - TIP #323 IMPLEMENTATION (partial) - - * doc/glob.n: Revise [glob] to accept zero patterns. - * generic/tclFileName.c: - * tests fileName.test: - - * doc/linsert.n: Revise [linsert] to accept zero elements. - * generic/tclCmdIL.c: - * tests/linsert.test: - -2008-09-29 Donal K. Fellows - - TIP #326 IMPLEMENTATION - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Added -stride option to carry - * doc/lsort.n, tests/cmdIL.test: out sorting of lists where the - elements are grouped. Adapted from [Patch 2082681] - - TIP #313 IMPLEMENTATION - - * generic/tclCmdIL.c (Tcl_LsearchObjCmd): Added -bisect option to - * doc/lsearch.n, tests/lsearch.test: allow the finding of the - place to insert an element in a sorted list when that element is - not already there. [Patch 1894241] - - TIP #318 IMPLEMENTATION - - * generic/tclCmdMZ.c (StringTrimCmd,StringTrimLCmd,StringTrimRCmd): - Update the default set of trimmed characters to include some from the - larger UNICODE space. Factor out the default trim set into a macro so - that it is easier to keep them in synch. - -2008-09-28 Donal K. Fellows - - TIP #314 IMPLEMENTATION - - * generic/tclCompCmds.c (TclCompileEnsemble) - * generic/tclNamesp.c (NamespaceEnsembleCmd) - (Tcl_SetEnsembleParameterList, Tcl_GetEnsembleParameterList) - (NsEnsembleImplementationCmdNR): - * generic/tcl.decls, doc/Ensemble.3, doc/namespace.n - * tests/namespace.test: Allow the handling of a (fixed) number of - formal parameters between an ensemble's command and subcommand at - invokation time. [Patch 1901783] - -2008-09-28 Miguel Sofer - - * generic/tclBasic.c: Fix the numLevels computations on - * generic/tclInt.h: coroutine yield/resume - * tests/unsupported.test: - -2008-09-27 Donal K. Fellows - - * generic/tclFileName.c (Tcl_GetBlock*FromStat): Made this work - acceptably when working with OSes that don't support reporting the - block size from the stat() call. [Bug 2130726] - - * generic/tclCmdIL.c (Tcl_LrepeatObjCmd): Improve the handling of the - case where the combination of number of elements and repeat count - causes the resulting list to be too large. [Bug 2130992] - -2008-09-26 Don Porter - - TIP #323 IMPLEMENTATION (partial) - - * doc/lrepeat.n: Revise [lrepeat] to accept both zero - * generic/tclCmdIL.c: repetitions and zero elements to be repeated. - * tests/lrepeat.test: - - * doc/object.n: Revise standard oo method [my variable] to - * generic/tclOOBasic.c: accept zero variable names. - * tests/oo.test: - - * doc/tm.n: Revise [tcl::tm::path add] and - * library/tm.tcl: [tcl::tm::path remove] to accept zero paths. - * tests/tm.test: - - * doc/namespace.n: Revise [namespace upvar] to accept zero - * generic/tclNamesp.c: variable names. - * tests/upvar.test: - - * doc/lassign.n: Revise [lassign] to accept zero variable names. - * generic/tclCmdIL.c: - * tests/cmdIL.test: - -2008-09-26 Donal K. Fellows - - * generic/tclOO.h (TCLOO_VERSION): Bump the version. - -2008-09-25 Don Porter - - TIP #323 IMPLEMENTATION (partial) - - * doc/global.n: Revise [global] to accept zero variable names. - * doc/variable.n: Revise [variable] likewise. - * generic/tclVar.c: - * tests/proc-old.test: - * tests/var.test: - - * doc/global.n: Correct false claim about [info locals]. - -2008-09-25 Donal K. Fellows - - TIP #315 IMPLEMENTATION - - * tests/platform.test: Update tests to expect revised results - * tests/safe.test: corresponding to the TIP 315 change. - - * unix/tclUnixInit.c, win/tclWinInit.c (TclpSetVariables): - * doc/tclvars.n (tcl_platform): Define what character is used for - separating PATH-like lists. Forms part of the tcl_platform array. - - * generic/tclOOCall.c (InitCallChain, IsStillValid): - * tests/oo.test (oo-25.2): Revise call chain cache management so that - it takes into account class-wide caching correctly. [Bug 2120903] - -2008-09-24 Don Porter - - TIP #323 IMPLEMENTATION (partial) - - * doc/file.n: Revise [file delete] and [file mkdir] to - * generic/tclCmdAH.c: accept zero "pathname" arguments (the - * generic/tclFCmd.c: no-op case). - * tests/cmdAH.test: - * tests/fCmd.test: - -2008-09-24 Donal K. Fellows - - * generic/tclOOMethod.c (DBPRINT): Remove obsolete debugging macro. - [Bug 2124814] - - TIP #316 IMPLEMENTATION - - * generic/tcl.decls, generic/tclFileName.c (Tcl_GetSizeFromStat, etc): - * doc/FileSystem.3: Added reader functions for Tcl_StatBuf. - -2008-09-23 Donal K. Fellows - - * doc/Method.3: Corrected documentation. [Patch 2082450] - - * doc/lreverse.n, mathop.n, regexp.n, regsub.n: Make sure that the - initial line of the manpage includes nothing that chokes old versions - of man. [Bug 2118123] - -2008-09-22 Donal K. Fellows - - TIP #320 IMPLEMENTATION - - * generic/tclOODefineCmds.c (TclOODefineVariablesObjCmd): - * generic/tclOOInfo.c (InfoObjectVariablesCmd, InfoClassVariablesCmd): - * generic/tclOOMethod.c (TclOOSetupVariableResolver, etc): - * doc/define.n, doc/ooInfo.n, benchmarks/cps.tcl: - * tests/oo.test (oo-26.*): Allow the declaration of the common - variables used in methods of a class or object. These are then mapped - in using a variable resolver. This makes many class declarations much - simpler overall, encourages good usage of variable names, and also - boosts speed a bit. - - * generic/tclOOMethod.c (TclOOGetMethodBody): Factor out the code to - get the body of a procedure-like method. Reduces the amount of "poking - inside the abstraction" that is done by the introspection code. - -2008-09-22 Alexandre Ferrieux - - * doc/chan.n: Clean up paragraph order. - -2008-09-18 Miguel Sofer - - * generic/tclExecute.c (NEXT_INST_F): - * generic/tclInt.h (TCL_CT_ASSERT): New compile-time assertions, - adapted from www.pixelbeat.org/programming/gcc/static_assert.html - -2008-09-17 Don Porter - - * generic/tclInt.h: Correct the TclGetLongFromObj, TclGetIntFromObj, - and TclGetIntForIndexM macros so that they retrieve the longValue - field from the internalRep instead of casting the otherValuePtr field - to type long. - -2008-09-17 Miguel Sofer - - * library/init.tcl: Export min and max commands from the mathfunc - namespace. [Bug 2116053] - -2008-09-16 Joe Mistachkin - - * generic/tclParse.c: Move TclResetCancellation to be called on - returning to level 0, as opposed to it being called on starting a - substitution at level 0. - -2008-09-16 Miguel Sofer - - * generic/tclBasic.c: Move TclResetCancellation to be called on - returning to level 0, as opposed to it being called on starting a - command at level 0. Add a call on returning via Tcl_EvalObjEx to fix - [Bug 2114165]. - -2008-09-10 Donal K. Fellows - - * doc/binary.n: Added partial documentation of [binary encode] and - [binary decode]. - - * tests/binary.test,cmdAH.test,cmdIL.test,cmdMZ.test,fileSystem.test: - More use of tcltest2 to simplify the tests as exposed to people. - * tests/compile.test (compile-18.*): Added *some* tests of the - disassmbler, though not of its output format. - -2008-09-10 Miguel Sofer - - * tests/nre.test: Add missing constraints; enable test of foreach - recursion. - - * generic/tclBasic.c: - * generic/tclCompile.h: - * generic/tclExecute.c (INST_EVAL_STK): Wrong numLevels when evaling a - canonical list. [Bug 2102930] - -2008-09-10 Donal K. Fellows - - * generic/tclListObj.c (Tcl_ListObjGetElements): Make this list->dict - transformation - encountered when using [foreach] with dicts - not as - expensive as it was before. Spotted by Kieran Elby and reported on - tcl-core. - -2008-09-08 Donal K. Fellows - - * tests/append.test, appendComp.test, cmdAH.test: Use the powers of - tcltest2 to make these files simpler. - -2008-09-07 Miguel Sofer - - * generic/tclCompile.c (TclCompileTokens): - * generic/tclExecute.c (CompileExprObj): Fix a perf bug (found by Alex - Ferrieux) where some variables in the LVT where not being accessed by - index. Fix missing localCache management in compiled expressions found - while analyzing the bug. - -2008-09-07 Miguel Sofer - - * doc/namespace.n: Fix [Bug 2098441] - -2008-09-04 Miguel Sofer - - * generic/tclTrace.test (TraceVarProc): - * generic/unsupported.test: Insure that unset traces are run even when - the coroutine is unwinding. [Bug 2093947] - - * generic/tclExecute.c (CACHE_STACK_INFO): - * tests/unsupported.test: Restore execEnv's bottomPtr. [Bug 2093188] - -2008-09-02 Don Porter - - * generic/tcl.h: Stripped "callers" of the _ANSI_ARGS_ macro - * compat/dirent2.h: to support a TCL_NO_DEPRECATED build. - * compat/dlfcn.h: - * unix/tclUnixPort.h: - - * generic/tcl.h: Removed the conditional #define of - _ANSI_ARGS_ that would support pre-prototype C compilers. Since - _ANSI_ARGS_ is no longer used in tclDecls.h, it's clear no one - compiling against Tcl 8.5 headers is making use of a -DNO_PROTOTYPES - configuration. - -2008-09-02 Donal K. Fellows - - * tests/socket.test: Rewrote so as to use tcltest2 better. - -2008-09-01 Miguel Sofer - - * generic/tclCmdAH.c: NRE-enabling [eval]; eval scripts are now - * generic/tclOOBasic.c: bytecompiled. Adapted recursion limit tests - * tests/interp.test: that were relying on eval not being - * tests/nre.test: compiled. Part of the [Bug 2017632] project. - * tests/unsupported.test: - -2008-09-01 Donal K. Fellows - - * generic/tclOOMethod.c (InvokeProcedureMethod): - * generic/tclOO.c (ObjectRenamedTrace): Arrange for only methods that - involve callbacks into the Tcl interpreter to be skipped when the - interpreter is being torn down. Allows the semantics of destructors in - a dying interpreter to be more useful when they're implemented in C. - -2008-08-29 Donal K. Fellows - - * unix/Makefile.in: Ensure that all TclOO headers get installed. - * win/Makefile.in: [Bug 2082299] - * win/makefile.bc: - * win/makefile.vc: - -2008-08-28 Don Porter - - * README: Bump version number to 8.6a3 - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - -2008-08-27 Donal K. Fellows - - * doc/tclvars.n, doc/library.n: Ensured that these two manual pages - properly cross-reference each other. Issue reported on Tcler's Chat. - -2008-08-26 Miguel Sofer - - * generic/tclBasic.c (InfoCoroutine): - * tests/unsupported.test: New command that returns the FQN of the - currently executing coroutine. Lives as infoCoroutine under - unsupported, but is designed to become a subcommand of [info] - -2008-08-23 Miguel Sofer - - * generic/tclBasic.c (NRInterpCoroutine): Store the caller's eePtr, - stop assuming the coroutine is invoked from the same execEnv where it - was created. - -2008-08-24 Donal K. Fellows - - * generic/tclCmdAH.c (TclNRForeachCmd): Converted the [foreach] - command to have an NRE-aware non-compiled implementation. Part of the - [Bug 2017632] project. Also restructured the code so as to manage its - temporary memory more efficiently. - -2008-08-23 Miguel Sofer - - * generic/tclBasic.c: Removed unused var; fixed function pointer - * generic/tclOOInt.h: declarations (why did gcc start complaining - * generic/tclOOMethod.c: all of a sudden?) - * generic/tclProc.c: - -2008-08-23 Donal K. Fellows - - * generic/tclInt.h (EnsembleImplMap): Added extra field to make it - * generic/tclNamesp.c (TclMakeEnsemble): easier to build non-recursive - ensembles in the core. - - * generic/tclDictObj.c (DictForNRCmd): Converted the [dict for] - command to have an NRE-aware non-compiled implementation. Part of the - [Bug 2017632] project. - -2008-08-22 Miguel Sofer - - * generic/tclBasic.c: - * generic/tclExecute.c: Set special errocodes: COROUTINE_BUSY, - COROUTINE_CANT_YIELD, COROUTINE_ILLEGAL_YIELD. - -2008-08-22 Don Porter - - *** 8.6a2 TAGGED FOR RELEASE *** - - * changes: Updates for 8.6a2 release. - - * generic/tcl.h: Drop use of USE_COMPAT85_CONST. That added - indirection without value. Use -DCONST86="" to engage source compat - support for code written for 8.5 headers. - - * generic/tclUtil.c (TclReToGlob): Added missing set of the - *exactPtr value to really fix [Bug 2065115]. Also avoid possible - DString overflow. - * tests/regexpComp.test: Correct duplicate test names. - -2008-08-21 Miguel Sofer - - * generic/tclBasic.c: Previous fix, now done right. - * generic/tclCmdIL.c: - * generic/tclInt.h: - * tests/unsupported.test: - -2008-08-21 Jeff Hobbs - - * tests/regexp.test, tests/regexpComp.test: Correct re2glob ***= - * generic/tclUtil.c (TclReToGlob): translation from exact - to anywhere-in-string match. [Bug 2065115] - -2008-08-21 Don Porter - - * generic/tcl.h: Reduced the use of CONST86 and eliminated - * generic/tcl.decls: the use of CONST86_RETURN to support source - code compatibility with Tcl 8.5 on those public routines passing - (Tcl_Filesystem *), (Tcl_Timer *), and (Tcl_Objtype *) values which - have been const-ified. What remains is the minimum configurability - needed to support code written for pre-8.6 headers via the new - -DUSE_COMPAT85_CONST compiler directive. - *** POTENTIAL INCOMPATIBILITY *** - - * generic/tclDecls.h: make genstubs - -2008-08-21 Miguel Sofer - - * generic/tclBasic.c: Fix the cmdFrame level count in - * generic/tclCmdIL.c: coroutines. Fix small bug on coroutine - * generic/tclInt.h: rewind. - -2008-08-21 Donal K. Fellows - - * generic/tclProc.c (Tcl_DisassembleObjCmd): Added ability to - disassemble TclOO methods. The code to do this is very ugly. - -2008-08-21 Pat Thoyts - - * generic/tclOOMethod.c: Added casts to make MSVC happy - * generic/tclBasic.c: - -2008-08-20 Donal K. Fellows - - * generic/tclOO.c (AllocObject): Suppress compilation of commands in - the namespace allocated for each object. - * generic/tclOOMethod.c (PushMethodCallFrame): Restore some of the - hackery that makes calling methods of classes fast. Fixes performance - problem introduced by the fix of [Bug 2037727]. - - * generic/tclCompile.c (TclCompileScript): Allow the suppression of - * generic/tclInt.h (NS_SUPPRESS_COMPILATION): compilation of commands - * generic/tclNamesp.c (Tcl_CreateNamespace): from a namespace or its - children. - -2008-08-20 Daniel Steffen - - * generic/tclTest.c (TestconcatobjCmd): Fix use of internal-only - TclInvalidateStringRep macro. [Bug 2057479] - -2008-08-17 Miguel Sofer - - * generic/tclBasic.c: Implementation of [coroutine] and [yield] - * generic/tclCmdAH.c: commands (in tcl::unsupported). - * generic/tclCompile.h: - * generic/tclExecute.c: - * generic/tclInt.h: - * tests/unsupported.test: - - * generic/tclTest.c (TestconcatobjCmd): - * generic/tclUtil.c (Tcl_ConcatObj): - * tests/util.test (util-4.7): - Fix [Bug 1447328]; the original "fix" turned Tcl_ConcatObj() into a - hairy monster. This was exposed by [Bug 2055782]. Additionally, - Tcl_ConcatObj could corrupt its input under certain conditions! - - *** NASTY BUG FIXED *** - -2008-08-16 Miguel Sofer - - * generic/tclExecute.c: Better cmdFrame management - -2008-08-14 Don Porter - - * tests/fileName.test: Revise new tests for portability to case - insensitive filesystems. - -2008-08-14 Daniel Steffen - - * generic/tclBasic.c (TclNREvalObjv, Tcl_NRCallObjProc): - * generic/tclProc.c (TclNRInterpProcCore, InterpProcNR2): - DTrace probes for NRE. [Bug 2017160] - - * generic/tclBasic.c (TclDTraceInfo): Add two extra arguments to - * generic/tclCompile.h: DTrace 'info' probes for tclOO - * generic/tclDTrace.d: method & class/object info. - - * generic/tclCompile.h: Add support for debug logging of DTrace - * generic/tclBasic.c: 'proc', 'cmd' and 'inst' probes (does _not_ - require a platform with DTrace). - - * generic/tclCmdIL.c (TclInfoFrame): Check fPtr->line before - dereferencing as line info may - not exists when TclInfoFrame() - is called from a DTrace probe. - - * tests/fCmd.test (fCmd-6.23): Made result matching robust when test - workdir and /tmp are not on same FS. - - * unix/tclUnixThrd.c: Remove unused TclpThreadGetStackSize() - * generic/tclInt.h: and related ifdefs and autoconf tests. - * unix/tclUnixPort.h: [Bug 2017264] (jenglish) - * unix/tcl.m4: - - * unix/Makefile.in: Ensure Makefile shell is /bin/bash for - * unix/configure.in (SunOS): DTrace-enabled build on Solaris. - (followup to 2008-06-12) [Bug 2016584] - - * unix/tcl.m4 (SC_PATH_X): Check for libX11.dylib in addition to - libX11.so et al. - - * unix/configure: autoconf-2.59 - * unix/tclConfig.h.in: autoheader-2.59 - -2008-08-13 Miguel Sofer - - * tests/nre.test: Added test for large {*}-expansion effects - -2008-08-13 Don Porter - - * generic/tclFileName.c: Fix for errors handling -types {} - * tests/fileName.test: option to [glob]. [Bug 1750300] - Thanks to Matthias Kraft and George Peter Staplin. - -2008-08-12 Jeff Hobbs - - * generic/tclOOInfo.c (InfoObjectDefnCmd, InfoObjectMixinsCmd): - Fix # args displayed. [Bug 2048676] - -2008-08-08 Don Porter - - * generic/tclOOMethod.c (PushMethodCallFrame): Added missing check - for bytecode validity. [Bug 2037727] - - * generic/tclProc.c (TclProcCompileProc): On recompile of a - proc, clear away any entries on the CompiledLocal list from the - previous compile. This will prevent compile of temporary variables in - the proc body from growing the localCache arbitrarily large. - - * README: Bump version number to 8.6a2 - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - - * changes: Updates for 8.6a2 release. - -2008-08-11 Pat Thoyts - - * library/http/http.tcl: Remove 8.5 requirement. - * library/http/pkgIndex.tcl: - * unix/Makefile.in: - * win/Makefile.in: - * win/makefile.vc: - -2008-08-11 Andreas Kupries - - * library/tm.tcl: Added a 'package provide' command to the generated - ifneeded scripts of Tcl Modules, for early detection of conflicts - between the version specified through the file name and a 'provide' - command in the module implementation, if any. Note that this change - also now allows Tcl Modules to not provide a 'provide' command at all, - and declaring their version only through their filename. - - * generic/tclProc.c (Tcl_ProcObjCmd): Fixed memory leak triggered by - * tests/proc.test: procbody::test::proc. See [Bug 2043636]. Added a - test case demonstrating the leak before the fix. Fixed a few spelling - errors in test descriptions as well. - -2008-08-11 Don Porter - - * library/http/http.tcl: Bump http version to 2.7.1 to account - * library/http/pkgIndex.tcl: for [Bug 2046486] bug fix. This - * unix/Makefile.in: release of http now requires a - * win/Makefile.in: dependency on Tcl 8.5 to be able to - * win/makefile.bc: use the unsigned formats in the - * win/makefile.vc: [binary scan] command. - -2008-08-11 Pat Thoyts - - * library/http/http.tcl: CRC field from zlib data should be treated as - unsigned for 64bit support. [Bug 2046846] - -2008-08-10 Miguel Sofer - - * generic/tclProc.c: Completely removed ProcCompileProc, which was a - fix for [Bug 1482718]. This is not needed at least since varReform, - where the local variable data at runtime is read from the CallFrame - and/or the LocalCache. - -2008-08-09 Miguel Sofer - - * generic/tclBasic.c: Slight cleanup - * generic/tclCompile.h: - * generic/tclExecute.c: - -2008-08-09 Daniel Steffen - - * generic/tclExecute.c: Fix warnings. - - * generic/tclOOMethod.c (PushMethodCallFrame): Fix uninitialized efi - name field. - - * tests/lrange.test (lrange-1.17): Add test cleanup; whitespace. - -2008-08-08 Don Porter - - * changes: Updates for 8.6a2 release. - -2008-08-08 Kevin Kenny - - * library/tzdata/CET: - * library/tzdata/MET: - * library/tzdata/Africa/Casablanca: - * library/tzdata/America/Eirunepe: - * library/tzdata/America/Rio_Branco: - * library/tzdata/America/Santarem: - * library/tzdata/America/Argentina/San_Luis: - * library/tzdata/Asia/Karachi: - * library/tzdata/Europe/Belgrade: - * library/tzdata/Europe/Berlin: - * library/tzdata/Europe/Budapest: - * library/tzdata/Europe/Sofia: - * library/tzdata/Indian/Mauritius: Olson's tzdata2008e. - -2008-08-07 Miguel Sofer - - * generic/tclBasic.c: Fix tailcalls falling out of tebc into - * generic/tclExecute.c: Tcl_EvalEx. [Bug 2017946] - * generic/tclInt.h: - -2008-08-06 Don Porter - - * generic/tclOO.c: Revised TclOO's check for an interp being - deleted during handling of object command deletion. The old code was - relying on documented features of command delete traces that do not in - fact work. [Bug 2039178] - - * tests/oo.test (oo-26.*): Added tests that demonstrate failure - of TclOO to check for various kinds of invalid bytecode during method - dispatch. [Bug 2037727] - -2008-08-06 Miguel Sofer - - * generic/tclVar.c (TclLookupSimpleVar): Fix bug that the core could - not trigger before TclOO: the number of locals was being read from the - Proc, which can under some circumstance be out of sync with the - localCache's. Found by dgp while investigating [Bug 2037727]. - - * library/init.tcl (::unknown): Removed the [namespace inscope] - hack that was maintained for Itcl - - *** POTENTIAL INCOMPATIBILITY *** for Itcl - Itcl users will need a new release with Itcl's [Patch 2040295], or - else load the tiny script in that patch by themselves (rewrite - ::unknown). Note that it is a script-only patch. - -2008-08-05 Joe English - - * unix/tclUnixChan.c: Streamline async connect logic [Patch 1994512] - -2008-08-05 Miguel Sofer - - * generic/tclExecute.c: Fix for [Bug 2038069] by dgp. - * tests/execute.test: - -2008-08-04 Miguel Sofer - - * tests/nre.test: Added tests for [if], [while] and [for]. A test - for [foreach] has been added and marked as knownbug, awaiting for it - to be NR-enabled. - - * generic/tclBasic.c: Made atProcExit commands run - * generic/tclCompile.h: unconditionally, streamlined - * generic/tclExecute.c: atProcExit/tailcall processing in TEBC. - * generic/tclProc.c: - * tests/unsupported.test: - -2008-08-04 Don Porter - - * generic/tclExecute.c: Stopped faulty double-logging of errors to - * tests/execute.test: stack trace when a compile epoch bump triggers - fallback to direct evaluation of commands in a compiled script. - [Bug 2037338] - -2008-08-03 Miguel Sofer - - * generic/tclBasic.c: New unsupported command atProcExit that - * generic/tclCompile.h: shares the implementation with tailcall. - * generic/tclExecute.c: Fixed a segfault in tailcalls. Tests added. - * generic/tclInt.h: - * generic/tclInterp.c: - * generic/tclNamesp.c: - * tests/unsupported.test: - -2008-08-02 Miguel Sofer - - * tests/NRE.test (removed): Migrated tests to standard locations, - * tests/nre.test (new): separating core functionality from the - * tests/unsupported.test (new): experimental commands. - -2008-08-01 Jeff Hobbs - - * doc/Exit.3: Do not call Tcl_Finalize implicitly - * generic/tclEvent.c: on DLL_PROCESS_DETACH as it may lead - * win/tclWin32Dll.c (DllMain): to issues and the user should be - explicitly calling Tcl_Finalize before unloading regardless. Clarify - the docs to note the explicit need in embedded use. - -2008-08-01 Don Porter - - * generic/tclBasic.c: Revised timing of the CmdFrame stack - * tests/info.test: management in TclEvalEx so that the CmdFrame - will still be on the stack at the time Tcl_LogCommandInfo is called to - append another level of -errorinfo information. Sets the stage to add - file and line data to the stack trace. Added test to check that [info - frame] functioning remains unchanged by the revision. - -2008-07-31 Miguel Sofer - - * tests/NRE.test: Replaced all deep-recursing tests by shallower - tests that actually measure the C-stack depth. This makes them - bearable again (even under memdebug) and avoid crashing on failure. - - * generic/tclBasic.c: NR-enabling [catch], [if] and [for] and - * generic/tclCmdAH.c: [while] (the script, not the tests) - * generic/tclCmdIL.c: - * generic/tclCmdMZ.c: - * generic/tclInt.h: - * tests/NRE.test: - - * generic/tclBasic.c: Moved the few remaining defs from tclNRE.h to - * generic/tclDictObj.c: tclInt.h, eliminated inclusion of tclNRE.h - * generic/tclExecute.c: everywhere. - * generic/tclInt.h: - * generic/tclInterp.c: - * generic/tclNRE.h (removed): - * generic/tclNamesp.c: - * generic/tclOOBasic.c: - * generic/tclOOInt.h: - * generic/tclProc.c: - * generic/tclTest.c: - * unix/Makefile.in: - -2008-07-30 Miguel Sofer - - * generic/tclBasic.c: Improved tailcalls. - * generic/tclCompile.h: - * generic/tclExecute.c: - * generic/tclTest.c: - * tests/NRE.test: - - * generic/tclBasic.c (TclNREvalObjEx): New comments and code reorg - to clarify what is happening. - - * generic/tclBasic.c: Guard against the value of iPtr->evalFlags - changing between the times where TEOV and TEOV_exception run. Thanks - dgp for catching this. - -2008-07-29 Miguel Sofer - - * tests/NRE.test: New tests that went MIA in the NRE revamping - - * generic/tclBasic.c: Clean up - * generic/tclNRE.h: - * generic/tclExecute.c: - - * generic/tclBasic.c: Made use of the thread's alloc cache stored in - * generic/tclInt.h: the ekeko at interp creation to avoid hitting - * generic/tclNRE.h: the TSD each time an NRE callback is pushed or - * generic/tclThreadAlloc.c: pulled; the approach is suitably general - to extend to every other obj allocation where an interp is know; this - is left for some other time, requires a lot of grunt work. - - * generic/tclExecute.c: Fix [Bug 2030670] that cause TclStackRealloc - to panic on rare corner cases. Thx ajpasadyn for diagnose and patch. - - * generic/tcl.decls: Completely revamped NRE implementation, with - * generic/tclBasic.c: (almost) unchanged API. - * generic/tclCompile.h: - * generic/tclExecute.c: TEBC will require a bit of a facelift, but - * generic/tclInt.decls: TEOV at least looks great now. There are new - * generic/tclInt.h: tests (incomplete!) to verify that execution - * generic/tclInterp.c: is indeed in the same TEBC instance, at the - * generic/tclNRE.h: same level in all stacks involved. Tailcalls - * generic/tclNamesp.c: are still a bit leaky, still deserving to be - * generic/tclOOBasic.c: in tcl::unsupported. - * generic/tclOOMethod.c: - * generic/tclProc.c: Uninit'd var warnings in TEBC with -O2, no - * generic/tclTest.c: warnings otherwise. - -2008-07-28 Jan Nijtmans - - * doc/FileSystem.3: CONSTified many functions using - * generic/tcl.decls: Tcl_FileSystem which all are supposed - * generic/tclDecls.h: to be a constant, but this was not - * generic/tclFileSystem.h: reflected in the API: Tcl_FSData, - * generic/tclIOUtil.c: Tcl_FSGetInternalRep, Tcl_FSRegister, - * generic/tclPathObj.c: Tcl_FSNewNativePath, Tcl_FSUnregister, - * generic/tclTest.c: Tcl_FSGetFileSystemForPath ... - This change complies with TIP #27. - ***POTENTIAL INCOMPATIBILITY*** - -2008-07-28 Andreas Kupries - - * generic/tclBasic.c: Added missing ref count when creating an empty - string as path (TclEvalEx). In 8.4 the missing code caused panics in - the testsuite. It doesn't in 8.5. I am guessing that the code path - with the missing the incr-refcount is not invoked any longer. Because - the bug in itself is certainly the same. - -2008-07-27 Donal K. Fellows - - * generic/tclOOMethod.c (PushMethodCallFrame): Remove hack that should - have gone when this code was merged into Tcl. - -2008-07-27 Jan Nijtmans - - * doc/Object.3: CONSTified 3 functions using Tcl_ObjType - * doc/ObjectType.3: which all are supposed to be a constant, but - * generic/tcl.decls: this was not reflected in the API: - * generic/tcl.h: Tcl_RegisterObjType, Tcl_ConvertToType, - * generic/tclDecls.h: Tcl_GetObjType - * generic/tclObj.c: Introduced a CONST86_RETURN, so extensions - * generic/tclCompCmds.c: which use Tcl_ObjType directly can be - * generic/tclOOMethod.c: modified to compile against both Tcl 8.5 and - * generic/tclTestobj.c: Tcl 8.6. tclDecls.h regenerated - This change complies with TIP #27. - ***POTENTIAL INCOMPATIBILITY*** - -2008-07-25 Andreas Kupries - - * test/info.test: More work on singleTestInterp usability. [1605269] - - * tests/info.test: Tests 38.* added, exactly testing the tracking of - location for uplevel scripts. Resolved merge conflict on info-37.0, - switched !singleTestInterp constraint to glob matching instead. Ditto - info-22.8, removed constraint, more glob matching, and reduced the - depth of the stack we check. More is coming, right now I want to - commit the bug fixes. - - * tests/oo.test: Updated oo-22.1 for expanded location tracking. - - * generic/tclCompile.c (TclInitCompileEnv): Reorganized the - initialization of the #280 location information to match the flow in - TclEvalObjEx to get more absolute contexts. - - * generic/tclBasic.c (TclEvalObjEx): Added missing cleanup of extended - location information. - -2008-07-25 Daniel Steffen - - * tests/info.test (info-37.0): Add !singleTestInterp constraint; - (info-22.8, info-23.0): switch to glob matching to avoid sensitivity - to tcltest.tcl line number changes, remove knownBug constraint, fix - expected result. [Bug 1605269] - -2008-07-24 Jan Nijtmans - - * doc/Notifier.3: CONSTified 4 functions in the Notifier which - * doc/Thread.3: all have a Tcl_Time* in it which is supposed - * generic/tcl.decls: to be a constant, but this was not reflected - * generic/tcl.h: reflected in the API: - * generic/tclDecls.h: Tcl_SetTimer, Tcl_WaitForEvent, - * generic/tclNotify.c: Tcl_ConditionWait, Tcl_SetMaxBlockTime - * macosx/tclMacOSXNotify.c: - * generic/tclThread.c: Introduced a CONST86, so extensions which have - * unix/tclUnixNotfy.c: have their own Notifier (are there any?) can - * unix/tclUnixThrd.c: can be modified to compile against both Tcl - * win/tclWinNotify.c: Tcl 8.5 and Tcl 8.6 - * win/tclWinThrd.c: Regenerated tclDecls.h with "make stubs". - This change complies with TIP #27 - ***POTENTIAL INCOMPATIBILITY*** - -2008-07-23 Alexandre Ferrieux - - * tests/lrange.test: Added relative speed test to check for lrange - in-place optimization committed 2008-06-30. - * tests/binary.test: Added relative speed test to check for pure byte - array CONCAT1 optimization committed 2008-06-30. - -2008-07-23 Andreas Kupries - - * tests/info.test: Reordered the tests to have monotonously increasing - numbers. - - * generic/tclBasic.c: Modified TclArgumentGet to reject pure lists - * generic/tclCmdIL.c: immediately, without search. Reworked setup of - * generic/tclCompile.c: eoFramePtr, doesn't need the line information, - * tests/info.test: more sensible to have everything on line 1 when - eval'ing a pure list. Updated the users of the line information to - special case this based on the frame type (i.e. - TCL_LOCATION_EVAL_LIST). Added a testcase demonstrating the new - behaviour. - -2008-07-23 Miguel Sofer - - * generic/tclBasic.c (GetCommandSource): Added comment with - explanation and warning for waintainers. - -2008-07-22 Andreas Kupries - - * generic/tclCompile.c: Made the new TclEnterCmdWordIndex static, and - * generic/tclCompile.h: ansified. - - * generic/tclBasic.c: Ansified the new functions. Added missing - function comments. - - * generic/tclBasic.c: Reworked the handling of bytecode literals for - * generic/tclCompile.c: #280 to fix the abysmal performance for deep - * generic/tclCompile.h: recursion, replaced the linear search through - * generic/tclExecute.c: the whole stack with another hashtable and - * generic/tclInt.h: simplified the data structure used by the compiler - by using an array instead of a hashtable. Incidentially this also - fixes the memory leak reported via [Bug 2024937]. - -2008-07-22 Miguel Sofer - - * generic/tclBasic.c: Added numLevels field to CommandFrame, let - * generic/tclExecute.c: GetCommandSource use it. This solves [Bug - * generic/tclInt.h: 2017146]. Thx dgp for the analysis. - -2008-07-21 Andreas Kupries - - * generic/tclBasic.c: Extended the existing TIP #280 system (info - * generic/tclCmdAH.c: frame), added the ability to track the absolute - * generic/tclCompCmds.c: location of literal procedure arguments, and - * generic/tclCompile.c: making this information available to uplevel - * generic/tclCompile.h: eval, and siblings. This allows proper - * generic/tclInterp.c: tracking of absolute location through custom - * generic/tclInt.h: (Tcl-coded) control structures based on uplevel, - * generic/tclNamesp.c: etc. - * generic/tclProc.c: - * tests/info.test: - -2008-07-21 Jan Nijtmans - - * generic/*.c: Fix [2021443] inconsistant "wrong # args" messages - * win/tclWinReg.c - * win/tclWinTest.c - * tests/*.test - -2008-07-21 Alexandre Ferrieux - - TIP #304 IMPLEMENTATION - - * generic/tcl.decls: Public API - * generic/tclIOCmds.c: Generic part - * unix/tclUnixPipe.c: OS part - * win/tclWinPipe.c: OS part - * tests/chan.test: [chan pipe] tests - * tests/ioCmd.test: Modernized checks - * tests/ioTrans.test: - -2008-07-21 Pat Thoyts - - * generic/tclFCmd.c: Inodes on windows are unreliable. [Bug 2015723] - * tests/winFCmd.test: test rename with inode collision - -2008-07-21 Miguel Sofer - - * generic/tcl.decls: Changed the implementation of - * generic/tclBasic.c: [namespace import]; removed - * generic/tclDecls.h: Tcl_NRObjProc, replaced with - * generic/tclExecute.c: Tcl_NRCmdSwap (proposed public - * generic/tclInt.h: NRE API). This should fix - * generic/tclNRE.h: [Bug 582506]. - * generic/tclNamesp.c: - * generic/tclStubInit.c: - - * generic/tclBasic.c: NRE: enabled calling NR commands - * generic/tclExecute.c: from the callbacks. Completely - * generic/tclInt.h: redone tailcall implementation - * generic/tclNRE.h: using the new feature. [Bug 2021489] - * generic/tclProc.c: - * tests/NRE.test: - -2008-07-20 Kevin B. Kenny - - * tests/fileName.test: Repaired the failing test fileName-15.7 from - dkf's commit earlier today. - -2008-07-20 Donal K. Fellows - - * generic/tclDictObj.c (SetDictFromAny): Make the list->dict - transformation a bit more efficient; modern dicts are ordered and so - we can round-trip through lists without needing the string rep at all. - * generic/tclListObj.c (SetListFromAny): Make the dict->list - transformation not lossy of internal representations and hence more - efficient. [Bug 2008248] (ajpasadyn) but using a more efficient patch. - - * tests/fileName.test: Revise to reduce the obscurity of tests. In - particular, all tests should now produce informative messages on - failure and the quantity of [catch]-based obscurity is now greatly - reduced; non-erroring is now checked for directly. - -2008-07-19 Donal K. Fellows - - * tests/env.test: Add LANG to the list of variables that are not - touched by the environment variable tests, so that subprocesses can - get their system encoding correct. - - * tests/exec.test, tests/env.test: Rewrite so that non-ASCII - characters are not used in the final comparison. Part of fixing [Bug - 1513659]. - -2008-07-18 Miguel Sofer - - * generic/tclBasic.c: Optimization: replace calls to - * generic/tclDictObj.c: Tcl_NRAddCallback with the macro - * generic/tclExecute.c: TclNRAddCallback. - * generic/tclInterp.c: - * generic/tclNRE.h: - * generic/tclNamesp.c: - * generic/tclOO.c: - * generic/tclOOBasic.c: - * generic/tclOOCall.c: - * generic/tclOOInt.h: - * generic/tclOOMethod.c: - * generic/tclProc.c: - -2008-07-18 Donal K. Fellows - - * generic/tclOO.c (TclNRNewObjectInstance, FinalizeAlloc): - * generic/tclOOBasic.c (TclOO_Class_Create, TclOO_Class_CreateNs) - (TclOO_Class_New, FinalizeConstruction, AddConstructionFinalizer): - NRE-enablement of the class construction methods. - -2008-07-18 Miguel Sofer - - * tests/NRE.test: Added basic tests for deep TclOO calls - - * generic/tcl.decls: Change the public api prefix from - * generic/tcl.h: TclNR_foo to Tcl_NRfoo - * generic/tclBasic.c: - * generic/tclDecls.h: - * generic/tclDictObj.c: - * generic/tclExecute.c: - * generic/tclInterp.c: - * generic/tclNRE.h: - * generic/tclNamesp.c: - * generic/tclOO.c: - * generic/tclOOBasic.c: - * generic/tclOOCall.c: - * generic/tclOOMethod.c: - * generic/tclProc.c: - * generic/tclStubInit.c: - -2008-07-18 Donal K. Fellows - - * generic/tclOOBasic.c (TclOO_Object_Eval, FinalizeEval): NRE-enable - the oo::object.eval method. - -2008-07-18 Miguel Sofer - - * generic/tclDictObj.c (DictWithCmd, DictUpdateCmd): Fix refcounting - bugs that caused crashes [Bug 2017857]. - - * generic/tclBasic.c (TclNREvalObjEx): Streamline the management of - the command frame (opt). - -2008-07-17 Donal K. Fellows - - * generic/tclDictObj.c (DictWithCmd, FinalizeDictWith): Split the - implementation of [dict with] so that it works with NRE. - (DictUpdateCmd, FinalizeDictUpdate): Similarly for the non-compiled - version of [dict update]. - -2008-07-16 George Peter Staplin - - * win/tclWinThrd.c: Test for TLS_OUT_OF_INDEXES to make certain that - thread key creation is successful. - -2008-07-16 Donal K. Fellows - - * generic/tclOO.c, generic/tclOOInt.h, generic/tclOOBasic.c: - * generic/tclOOCall.c, generic/tclOOMethod.c: NRE-enable the TclOO - implementation in Tcl. No change to public APIs, except that method - implementations can now be NRE-aware if they choose (which normal - methods and forwards are). On the other hand, callers of - TclOOInvokeObject (which is only in the internal stub table) will need - to deal with the fact that it's only safe to call inside an NRE-aware - context. - ***POTENTIAL INCOMPATIBILITY*** - -2008-07-15 Miguel Sofer - - * tests/NRE.test: Better constraint for testing the existence of - * tests/stack.test: teststacklimit, to insure that the test suite - runs under tclsh. - - * generic/tclParse.c: Fixing incomplete reversion of "fix" for [Bug - 2017583], missing TclResetCancellation call. - -2008-07-15 Donal K. Fellows - - * generic/tclBasic.c (Tcl_CancelEval): Fix blunder. [Bug 2018603] - - * doc/DictObj.3: Fix error in example. [Bug 2016740] - - * generic/tclNamesp.c (EnsembleUnknownCallback): Factor out some of - the more complex parts of the ensemble code to make it easier to - understand and hence to permit tighter compilation of code on the - critical path. - -2008-07-14 Miguel Sofer - - * generic/tclParse.c: Reverting the "fix" for [Bug 2017583], numLevel - * tests/parse.test: management and TclInterpReady check seems to be - necessary after all. - -2008-07-14 Donal K. Fellows - - * generic/tclProc.c (TclNRApplyObjCmd, TclObjInterpProcCore): - * generic/tclBasic.c (TclNR_AddCallback, TclEvalObjv_NR2): - * generic/tclNRE.h (TEOV_callback): Change the callback storage type - to use an array, so guaranteeing correct inter-member spacing and - memory layout. - -2008-07-14 Miguel Sofer - - * generic/tclExecute.c: Remove unneeded TclInterpReady calls - * generic/tclParse.c: - - * generic/tclBasic.c.: Embedded Tcl_Canceled() calls into - * generic/tclExecute.c: TclInterpReady(). - * generic/tclParse.c: - - * generic/tclVar.c: Fix error message - - * generic/tclParse.c: Remove unnecessary numLevel management - * tests/parse.test: [Bug 2017583] - - * generic/tclBasic.c.: NRE left too many calls to - * generic/tclExecute.c: TclResetCancellation lying around: it - * generic/tclProc.c: only needs to be called prior to any - iPtr->numLevels++. Thanks mistachkin. - - * generic/tclBasic.c: TclResetCancellation() calls were misplaced - (merge mishap); stray //. Thanks patthoyts. - - * generic/tclInt.h: The new macros TclSmallAlloc and TclSmallFree - were badly defined under mem debugging [Bug 2017240] (thx das) - -2008-07-13 Miguel Sofer - - NRE implementation [Patch 2017110] - - * generic/tcl.decls: The NRE infrastructure - * generic/tcl.h: - * generic/tclBasic.c: - * generic/tclCmdAH.c: - * generic/tclCompile.h: - * generic/tclDecls.h: - * generic/tclExecute.c: - * generic/tclHistory.c: - * generic/tclInt.decls: - * generic/tclInt.h: - * generic/tclIntDecls.h: - * generic/tclNRE.h: - * generic/tclStubInit.c: - * unix/Makefile.in: - - * generic/tclInterp.c: NRE-enabling: procs, lambdas, uplevel, - * generic/tclNamesp.c: same-interp aliases, ensembles, imports - * generic/tclProc.c: and namespace_eval. - - * generic/tclTestProcBodyObj.c: New NRE specific tests (few, but - * tests/NRE.test: note that the thing is actually - tested by the whole testsuite. - - * tests/interp.test: Fixed numLevel counting. - * tests/parse.test: - * tests/stack.test: - - * unix/configure: Removing support for the hacky nonportable - * unix/configure.in: stack check: it is not needed anymore, Tcl - * unix/tclConfig.h.in: is very thrifty on the C stack. - * unix/tclUnixInit.c: - * unix/tclUnixTest.c: - * win/tclWin32Dll.c: - -2008-07-08 Don Porter - - * generic/tclGet.c: Corrected out of date comments and removed - * generic/tclInt.decls: internal routine TclGetLong() that's no - longer used. If an extension is using this from the internal stubs - table, it can shift to the public routine Tcl_GetLongFromObj() or - can request addition of a public Tcl_GetLong(). - ***POTENTIAL INCOMPATIBILITY*** - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - -2008-07-08 Donal K. Fellows - - * doc/CrtInterp.3: Tighten up the descriptions of behaviour to make - this page easier to read for a "Tcl 8.6" audience. - -2008-07-07 Andreas Kupries - - * generic/tclCmdIL.c (InfoFrameCmd): Fixed unsafe idiom of setting - the interp result found by Don Porter. - -2008-07-07 Donal K. Fellows - - * doc/regexp.n, doc/regsub.n: Correct examples. [Bug 1982642] - -2008-07-06 Donal K. Fellows - - * doc/lindex.n: Improve examples. - -2008-07-03 Andreas Kupries - - * generic/tclIORChan.c (InvokeTclMethod): Fixed the memory leak - reported in [Bug 1987821]. Thanks to Miguel for the report and Don - Porter for tracking the cause down. - -2008-07-03 Don Porter - - * library/package.tcl: Removed [file readable] testing from - [tclPkgUnknown] and friends. We find out soon enough whether a file is - readable when we try to [source] it, and not testing before allows us - to workaround the bugs on some common filesystems where [file - readable] lies to us. [Patch 1969717] - -2008-07-01 Donal K. Fellows - - * generic/regc_nfa.c (duptraverse): Impose a maximum stack depth on - the single most recursive part of the RE engine. The actual maximum - may need tuning, but that needs a system with a small stack to carry - out. [Bug 1905562] - - * tests/string.test: Eliminate non-ASCII characters from the actual - test script. [Bug 2006884] - -2008-06-30 Donal K. Fellows - - * doc/ObjectType.3: Clean up typedef formatting. - -2008-06-30 Don Porter - - * doc/ObjectType.3: Updated documentation of the Tcl_ObjType - struct to match expectations of Tcl 8.5. [Bug 1917650] - -2008-06-30 Alexandre Ferrieux - - * generic/tclCmdIL.c: Lrange cleanup and in-place optimization. [Patch - 1890831] - - * generic/tclExecute.c: Avoid useless String conversion for CONCAT1 of - pure byte arrays. [Patch 1953758] - -2008-06-29 Donal K. Fellows - - * doc/*.1, doc/*.3, doc/*.n: Many small updates, purging out of date - change bars and cleaning up the formatting of typedefs. Added a few - missing bits of documentation in the process. - -2008-06-29 Don Porter - - * generic/tclPathObj.c: Plug memory leak in [Bug 1999176] fix. Thanks - to Rolf Ade for detecting. - -2008-06-29 Donal K. Fellows - - * doc/interp.n: Corrected order of subcommands. [Bug 2004256] - Removed obsolete (i.e. 8.5) .VS/.VE pairs. - - * doc/object.n (EXAMPLES): Fix incorrect usage of oo::define to be - done with oo::objdefine instead. [Bug 2004480] - -2008-06-28 Don Porter - - * generic/tclPathObj.c: Plug memory leak in [Bug 1972879] fix. Thanks - to Rolf Ade for detecting and Dan Steffen for the fix. [Bug 2004654] - -2008-06-26 Andreas Kupries - - * unix/Makefile.in: Followup to my change of 2008-06-25, make code - generated by the Makefile and put into the installed tm.tcl - conditional on interpreter safeness as well. Thanks to Daniel Steffen - for reminding me of that code. - -2008-06-25 Don Porter - - *** 8.6a1 TAGGED FOR RELEASE *** - - * changes: Updates for 8.6a1 release. - - * generic/tclOO.h: Bump to TclOO 0.5. - -2008-06-25 Andreas Kupries - - * library/tm.tcl: Modified the handling of Tcl Modules and of the - * library/safe.tcl: Safe Base to interact nicely with each other, - * library/init.tcl: enabling requiring Tcl Modules in safe - * tests/safe.test: interpreters. [Bug 1999119] - -2008-06-25 Pat Thoyts - - * win/rules.vc: Fix versions of dde and registry dlls - * win/makefile.vc: Fix problem building with staticpkg option - -2008-06-24 Don Porter - - * generic/tclPathObj.c: Fixed some internals management in the "path" - Tcl_ObjType for the empty string value. Problem led to a crash in the - command [glob -dir {} a]. [Bug 1999176] - -2008-06-24 Pat Thoyts - - * doc/fileevent.n: Fix examples and comment on eof use. [Bug 1995063] - -2008-06-23 Don Porter - - * generic/tclPathObj.c: Fixed bug in Tcl_GetTranslatedPath() when - operating on the "Special path" variant of the "path" Tcl_ObjType - intrep. A full normalization was getting done, in particular, coercing - relative paths to absolute, contrary to what the function of producing - the "translated path" is supposed to do. [Bug 1972879] - -2008-06-20 Don Porter - - * changes: Updates for 8.6a1 release. - - * generic/tclInterp.c: Fixed completely boneheaded mistake that - * tests/interp.test: [interp bgerror $slave] and [$slave bgerror] - would always act like [interp bgerror {}]. [Bug 1999035] - - * tests/chanio.test: Corrected flawed tests revealed by a -debug 1 - * tests/cmdAH.test: -singleproc 1 test suite run. - * tests/event.test: - * tests/interp.test: - * tests/io.test: - * tests/ioTrans.test: - * tests/namespace.test: - - * tests/encoding.test: Make failing tests pass again. [Bug 1972867] - -2008-06-19 Donal K. Fellows - - * generic/tclOO.c (Tcl_ObjectContextInvokeNext): Corrected 'next' (at - * tests/oo.test (oo-7.8): end of a call chain) to make it - * doc/next.n: consistent with the TIP. [Bug 1998244] - - * generic/tclOOCall.c (AddSimpleClassChainToCallContext): Make sure - * tests/oo.test (oo-14.8): that class mixins are processed in the - documented order. [Bug 1998221] - -2008-06-19 Don Porter - - * changes: Updates for 8.6a1 release. - - * README: Bump version number to 8.6a1 - * generic/tcl.h: - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - -2008-06-17 Andreas Kupries - - * generic/tclClock.c (ClockConvertlocaltoutcObjCmd): Removed left - over debug output. - -2008-06-17 Andreas Kupries - - * doc/tm.n: Followup to changelog entry 2008-03-18 regarding - ::tcl::tm::Defaults. Updated the documentation to not only mention the - new (underscored) form of environment variable names, but make it the - encouraged form as well. [Bug 1914604] - -2008-06-17 Kevin Kenny - - * generic/tclClock.c (ConvertLocalToUTC): - * tests/clock.test (clock-63.1): Fixed a bug where the internal - ConvertLocalToUTC command segfaulted if passed a dictionary without - the 'localSeconds' key. To the best of my knowledge, the bug was not - observable in the [clock] command itself. - -2008-06-16 Andreas Kupries - - * generic/tclCmdIL.c (TclInfoFrame): Moved the code looking up the - * tests/info.test: information for key 'proc' out of the - TCL_LOCATION_BC branch to after the switch, this is common to all - frame types. Updated the testsuite to match. This was exposed by the - 2008-06-08 commit (Miguel), switching uplevel from direct eval to - compilation. [Bug 1987851] - -2008-06-16 Andreas Kupries - - * tests/ioTrans.test (iortrans-11.*): Fixed same issue as for - iortrans.tf-11.*, cleanup of temp file, making this a followup to the - entry on 2008-06-10 by myself. - -2008-06-13 David Gravereaux - - * win/rules.vc: SYMBOLS macro is now being set to zero when $(OPTS) is - not available. - * win/makefile.vc: The Stubs source files (tclStubLib.c and - tclOOStubLib.c) should not be compiled with the -GL flag. - -2008-06-13 Joe Mistachkin - - TIP #285 IMPLEMENTATION - - * doc/Eval.3: Added documentation for the Tcl_CancelEval and - Tcl_Canceled functions and the TCL_CANCEL_UNWIND flag bit. - * doc/after.n: Corrected the spelling of 'canceled' in the - documentation. - * doc/interp.n: Added documentation for [interp cancel]. - * generic/tcl.decls: Added the Tcl_CancelEval and Tcl_Canceled - functions to the stubs table. - * generic/tcl.h: Added the TCL_CANCEL_UNWIND flag bit. - * generic/tclBasic.c: The bulk of the script cancellation - functionality is defined here. Added code to initialize and manage the - script cancellation hash table in a thread-safe manner. Reset script - cancellation flags prior to increasing the nesting level (if the - nesting level is currently zero) and always cooperatively check for - script cancellation near the start of TclEvalObjvInternal and after - invoking async handlers. - * generic/tclDecls.h: Regenerated. - * generic/tclEvent.c: Call TclFinalizeEvaluation during finalization - to cleanup the script cancellation hash table. During [vwait], always - cooperatively check for script cancellation. Corrected the spelling of - 'canceled' in comments to be consistent with the documentation. - * generic/tclExecute.c: Reset script cancellation flags prior to - increasing the nesting level (if the nesting level is currently zero) - and always cooperatively check for script cancellation after invoking - async handlers. Prevent [catch] from catching script cancellation when - the TCL_CANCEL_UNWIND flag is set (similar to the manner used by TIP - 143 when a limit has been exceeded). - * generic/tclInt.decls: Added TclResetCancellation to the internal - stubs table. - * generic/tclInt.h: Added asyncCancel and asyncCancelMsg fields to the - private Interp structure. Added private interp flag value CANCELED to - help control script cancellation. - * generic/tclIntDecls.h: Regenerated. - * generic/tclInterp.c (Tcl_InterpObjCmd): Added [interp cancel] - subcommand. - * generic/tclNotify.c (Tcl_DeleteEventSource): Corrected the spelling - of 'canceled' in comments to be consistent with the documentation. - * generic/tclParse.c: Reset script cancellation flags prior to - * generic/tclProc.c: increasing the nesting level (if the nesting - level is currently zero) and cooperatively check for script - cancellation prior to evaluating commands. - * generic/tclStubInit.c: Regenerated. - * generic/tclThreadTest.c (Tcl_ThreadObjCmd): Added script - cancellation support ([testthread cancel]). - Modified [testthread id] to allow querying of the 'main' thread ID. - Corrected comments to reflect the actual command syntax. Made - [testthread wait] cooperatively check for script cancellation. Added - [testthread event] to allow for processing one pending event without - blocking. - * generic/tclTimer.c: Delay for a maximum of 500 milliseconds prior to - checking for async handlers and script cancellation. - * tests/cmdAH.test: Changed [interp c] to [interp create]. - * tests/interp.test: Added and fixed tests for [interp cancel]. - * tests/thread.test: Added tests for script cancellation via - [testthread cancel]. - * tools/man2help2.tcl: Fixed problems with WinHelp target (see - * tools/man2tcl.c: [Bug 1934200], [Bug 1934265], and [Bug 1934272]). - * win/makefile.vc: Added 'pdbs' option for Windows build rules to - * win/rules.vc: allow for non-debug builds with full symbols. - * win/tcl.hpj.in: Corrected version for WinHelp target. - * win/tclWinNotify.c: Used SleepEx and WaitForSingleObjectEx on - * win/tclWinThrd.c: Windows because they are alertable. - -2008-06-12 Daniel Steffen - - * unix/Makefile.in: Add complete deps on tclDTrace.h. - - * generic/tclOO.c: Use TclOOStubs hooks field to retrieve - * generic/tclOODecls.h: TclOOIntStubs pointer. [Bug 1980953] - * generic/tclOOIntDecls.h: - * generic/tclOOStubInit.c: - * generic/tclOOStubLib.c: - - * generic/tclIORTrans.c: Fix signed <-> unsigned cast warnings. - - * unix/Makefile.in: Clean generated tclDTrace.h file. - * unix/configure.in (SunOS): Fix static DTrace-enabled build. - - * unix/tcl.m4 (SunOS-5.11): Fix 64bit amd64 support with gcc & Sun cc. - * unix/configure: autoconf-2.59 - - * macosx/Tcl.xcodeproj/project.pbxproj: Add tclIORTrans.c; updates and - cleanup for Xcode 3.1/Leopard. - * macosx/Tcl.xcode/project.pbxproj: Sync Tcl.xcodeproj changes. - * macosx/README: Document new build configs. - -2008-06-10 Joe English - - * generic/tclEncoding.c(UtfToUtfProc): Avoid unwanted sign extension - when converting incomplete UTF-8 sequences. See [Bug 1908443] for - details. - -2008-06-10 Andreas Kupries - - * tests/ioTrans.test (iortrans.tf-6.1): Fixed the [Bug 1988552], - reported by Kevin. Have to close the channel before removal of the - file. Fixed same bug in test 'iortrans.tf-11.0', after fixing missing - cleanup of the file in 'iortrans.tf-11.*'. Lastly fixed the names of - the threaded tests 'iortrans-8.*' to the correct 'iortrans.tf-8.*'. - -2008-06-09 Andreas Kupries - - * generic/tclIORTrans.c (ReflectInput): Fixed a bug triggered by Pat - Thoyts . Reset the EOF flag after - draining the Tcl level into the result buffer, to make sure that the - result buffer will be drained as well by repeated calls to - ReflectInput should it contain more than one buffer-full of data. - Without that reset the higher I/O system will not call on ReflectInput - anymore due to the assumed EOF, thus losing the data which did not fit - in the buffer of the call which caused the eof and drain. - -2008-06-09 Donal K. Fellows - - * generic/tclOOCall.c (TclOOGetSortedMethodList): Plug memory leak - that occurred when all methods were hidden. [Bug 1987817] - -2008-06-08 Miguel Sofer - - * generic/tclBasic.c: Compilation of uplevel scripts, allow - * generic/tclCompCmds.c: non-body compiled scripts to access the - * generic/tclCompile.c: LVT (but not to extend it) and enable the - * generic/tclCompile.h: canonical list opt to sidestep the - * generic/tclExecute.c: compiler. [Patch 1973096] - * generic/tclProc.c: - * tests/uplevel.test: - -2008-06-06 Andreas Kupries - - TIP #230 IMPLEMENTATION - - * generic/tclIOCmd.c: Integration of transform commands into 'chan' - ensemble. - * generic/tclInt.h: Definitions of the transform commands. - * generic/tclIORTrans.c: Implementation of the reflection transforms. - * tests/chan.test: Tests updated for new sub-commands of 'chan'. - * tests/ioCmd.test: Tests updated for new sub-commands of 'chan'. - * tests/ioTrans.test: Whole new set of tests for the reflection - transform. - * unix/Makefile.in: Integration of new files into build rules. - * win/Makefile.in: Integration of new files into build rules. - * win/makefile.vc: Integration of new files into build rules. - - NOTE: The file 'tclIORTrans.c' has a lot of code in common with the - file 'tclIORChan.c', as that made it much easier to develop the - reference implementation as a separate module. Now that the - transforms have been committed the one thing left to do is to go - over both modules and see which of the common parts we can - factor out and share. - -2008-06-04 Pat Thoyts - - * generic/tclBinary.c: TIP #317 implementation - * tests/binary.test: - -2008-06-02 Kevin B. Kenny - - * generic/tclOO.c (ReleaseClassContents): Fix the one remaining - valgrind complaint about oo.test, caused by failing to protect the - Object as well as the Class corresponding to a subclass being deleted - and hence getting a freed-memory read when attempting to delete the - class command. [Bug 1981001] - -2008-06-01 Donal K. Fellows - - * generic/tclOOMethod.c (Tcl_NewMethod): Complete the fix of [Bug - 1981001], previous fix was incomplete though helpful in telling me - where to look. - -2008-06-01 Joe Mistachkin - - * win/Makefile.in: Add tclOO genstubs to Windows makefiles and remove - * win/makefile.vc: -DBUILD_tcloo because it is no longer required. - -2008-06-01 Kevin B. Kenny - - * generic/tclOODecls.h: Added the swizzling of DLLEXPORT and - * generic/tclOOIntDecls.h: DLLIMPORT needed to make EXTERN work. - - * generic/tclDictObj.c: Added missing initializers to the ensemble - map to silence a compiler warning. Thanks to - George Peter Staplin for the report. - - * generic/tclOOMethod.c: Fix a bug where the refcount of a method was - reset if the method was redefined while there - was an active invocation. [Bug 1981001] - -2008-06-01 Donal K. Fellows - - * generic/tclOO.decls, unix/Makefile.in (genstubs): Make generation of - stub tables correct. - * generic/tclOO{Decls.h,IntDecls.h,StubInit.c,StubLib.c}: Fixes to - make the generation work correctly, removing subtle differences - between output of different versions of stub generator. - -2008-06-01 Daniel Steffen - - * generic/tclOOStubLib.c: Ensure use of tcl stubs; include in - * unix/Makefile.in: stub lib; disable broken tclOO - genstubs - - * generic/tclOO.c: Make tclOO stubs tables 'static const' - * generic/tclOODecls.h: and stub table pointers MODULE_SCOPE - * generic/tclOOIntDecls.h: (change generated files manually - * generic/tclOOStubInit.c: pending genstubs support for tclOO). - * generic/tclOOStubLib.c: - - * generic/tclOO.c: Fix warnings for 'int<->ptr - * generic/tclOOCall.c: conversion' and 'signed vs unsigned - * generic/tclOOMethod.c: comparison'. - - * tests/msgcat.test: Fix for ::tcl::mac::locale with @modifier. - - * tools/tsdPerf.tcl: Use [info sharedlibextension] - - * unix/tclConfig.h.in: autoheader-2.59 - - * macosx/Tcl.xcodeproj/project.pbxproj: Add new tclOO files; add debug - * macosx/README: configs with corefoundation - disabled and with gcov; update - to Xcode 3.1. - -2008-05-31 Donal K. Fellows - - * generic/tclOO.c (InitFoundation): Correct reference counting for - strings used when creating the constructor for classes. - * generic/tclOOMethod.c (TclOODelMethodRef): Correct fencepost error - in reference counting of method implementation structures. - * tests/oo.test (oo-0.5): Added a test to detect a memory leak problem - relating to disposal of the core object system. - - TIP#257 IMPLEMENTATION - - * generic/tclBasic.c, generic/tclOOInt.h: Correct declarations. - * win/Makefile.in, win/makefile.bc, win/makefile.vc: Build support for - Win32, from Joe Mistachkin. [Patch 1980861] - - * generic/tclOO*, doc/*, tests/oo.test: Port of implementation of - TclOO to sit directly inside Tcl. Note that this is incomplete (e.g. - no build support yet for Windows). - -2008-05-26 Jeff Hobbs - - * tests/io.test (io-53.9): Need to close chan before removing file. - -2008-05-26 Donal K. Fellows - - * win/makefile.bc: Remove deprecated winhelp target. - * win/Makefile.in, win/makefile.vc: It didn't work correctly anyway. - -2008-05-23 Andreas Kupries - - * win/tclWinChan.c (FileWideSeekProc): Accepted a patch by Alexandre - Ferrieux to fix the [Bug 1965787]. - 'tell' now works for locations > 2 GB as well instead of going - negative. - - * generic/tclIO.c (Tcl_SetChannelBufferSize): Accepted a patch by - * tests/io.test: Alexandre Ferrieux - * tests/chanio.test: to fix the [Bug 1969953]. Buffersize outside of - the supported range are now clipped to nearest boundary instead of - ignored. - -2008-05-22 Don Porter - - * generic/tclNamesp.c (Tcl_LogCommandInfo): Restored ability to - handle the argument value length = -1. Thanks to Chris Darroch for - discovering the bug and providing the fix. [Bug 1968245] - -2008-05-21 Don Porter - - * generic/tclParse.c (ParseComment): The new TclParseAllWhiteSpace - * tests/parse.test (parse-15.60): routine has no mechanism to - return the "incomplete" status of "\\\n" so calling this routine - anywhere that can be reached within a Tcl_ParseCommand() call is a - mistake. In particular, ParseComment() must not use it. [Bug 1968882] - -2008-05-20 Donal K. Fellows - - * generic/tclNamesp.c (Tcl_SetNamespaceUnknownHandler): Corrected odd - logic for handling installation of namespace unknown handlers which - could lead too very strange things happening in the error case. - -2008-05-16 Miguel Sofer - - * generic/tclCompile.c: Fix crash with tcl_traceExec. Found and fixed - by Alexander Pasadyn. [Bug 1964803] - -2008-05-15 Pat Thoyts - - * win/makefile.vc: We should use the thread allocator for threaded - * win/rules.vc: builds. Added 'tclalloc' option to disable. - -2008-05-09 George Peter Staplin - - * tools/tsdPerf.c: A loadable Tcl extension for testing TSD - performance. - * tools/tsdPerf.tcl: A simplistic tool that uses the thread - extension and tsdPerf.so to get some performance metrics by, - simulating, simple TSD contention. - -2008-05-09 George Peter Staplin - - * generic/tcl.h: Make Tcl_ThreadDataKey a void *. - * generic/tclInt.h: Change around some function names and add some - new per-platform declarations for thread-specific data functions. - * generic/tclThread.c: Make use of of the new function names that no - longer have a Tclp prefix. - * generic/tclThreadStorage.c: Replace the core thread-specific data - (TSD) mechanism with an array offset solution that eliminates the hash - tables, and only uses one slot of native TSD. Many thanks to Kevin B. - Kenny for his help with this. - - * unix/tclUnixThrd.c: Add platform-specific TSD functions for use by - * win/tclWinThrd.c: tclThreadStorage.c. - -2008-05-09 Kevin B. Kenny - - * tests/dict.test (dict-19.2): Corrected a bug where the test was - changed to use [apply] instead of a temporary proc, but the cleanup - script still attempted to delete the temporary proc. - -2008-05-07 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileDictAppendCmd): Fix silly off-by - one error that caused a crash every time a compiled 'dict append' with - more than one argument was used. Found by Colin McCormack. - -2008-05-02 Pat Thoyts - - * generic/tclBasic.c: Converted the [binary] command into an - * generic/tclBinary.c: ensemble. - * generic/tclInt.h: - * test/binary.test: Updated the error tests for ensemble errors. - - * generic/tclFileName.c: Reverted accidental commit of TIP 316 APIs. - -2008-04-27 Donal K. Fellows - - * */*.c: A large tranche of getting rid of pre-C89-isms; if your - compiler doesn't support things like proper function declarations, - 'void' and 'const', borrow a proper one when building Tcl. (The header - files allow building things that link against Tcl with really ancient - compilers still; the requirement is just when building Tcl itself.) - -2008-04-26 Zoran Vasiljevic - - * generic/tclAsync.c: Tcl_AsyncDelete(): panic if attempt to locate - handler token fails. Happens when some other thread attempts to delete - somebody else's token. - - Also, panic early if we find out the wrong thread attempting to delete - the async handler (common trap). As, only the one that created the - handler is allowed to delete it. - -2008-04-24 Andreas Kupries - - * tests/ioCmd.test: Extended testsuite for reflected channel - implementation. Added test cases about how it handles if the rug is - pulled out from under a channel (= killing threads, interpreters - containing the tcl command for a channel, and channel sitting in a - different interpreter/thread.) - - * generic/tclIORChan.c: Fixed the bugs exposed by the new testcases, - redone most of the cleanup and exit handling. - -2008-04-21 Don Porter - - * generic/tclIOUtil.c: Removed all code delimited by - * generic/tclTest.c: USE_OBSOLETE_FS_HOOKS, completing - * tests/ioCmd.test: the deprecation path for these - * tests/ioUtil.test (removed): obsolete interfaces. (Code was active - in Tcl 8.4, present but enabled only by customized compile switch in - Tcl 8.5, and now completely gone for Tcl 8.6). Also removed all tests - relevant only to the removed interfaces. - -2008-04-19 George Peter Staplin - - * doc/Ensemble.3: Fix a typo: s/defiend/defined/ - Thanks to hat0 for spotting this. - -2008-04-16 Daniel Steffen - - * generic/tclInt.h: Make stubs tables 'static const' and - * generic/tclStubInit.c: export only module-scope pointers to - * generic/tclStubLib.c: the main stubs tables (for package - * tools/genStubs.tcl: initialization). [Patch 1938497] - * generic/tclBasic.c (Tcl_CreateInterp): - * generic/tclTomMathInterface.c (TclTommath_Init): - - * generic/tclInt.h: Revise Tcl_SetNotifier() to use a - * generic/tclNotify.c: module-scope hooks table instead of - * generic/tclStubInit.c: runtime stubs-table modification; - * macosx/tclMacOSXNotify.c: ensure all hookable notifier functions - * win/tclWinNotify.c: check for hooks; remove hook checks in - * unix/tclUnixNotfy.c: notifier API callers. [Patch 1938497] - -2008-04-15 Andreas Kupries - - * generic/tclIO.c (CopyData): Applied another patch by Alexandre - * io.test (io-53.8a): Ferrieux , - * chanio.test (chan-io-53.8a): to shift EOF handling to the async - part of the command if a callback is specified, should the channel be - at EOF already when fcopy is called. Testcase by myself. - -2008-04-15 Daniel Steffen - - * unix/Makefile.in: Adjust tclDTrace.h dependencies for removal - of tclStubLib.o from TCL_OBJS. [Bug 1942795] - -2008-04-14 Kevin B. Kenny - - * unix/tclUnixTime.c (NativeGetTime): Removed obsolete use of - 'struct timezone' in the call to 'gettimeofday'. [Bug 1942197] - - * tests/clock.test (clock-33.5, clock-33.5a, clock-33.8, clock-33.8a): - Added comments to the test that it can fail on a heavily loaded - system. - -2008-04-10 Andreas Kupries - - * generic/tclIOCmd.c (Tcl_FcopyObjCmd): Keeping check for negative - values, changed to not be an error, but behave like the special value - -1 (copy all, default). - - * tests/iocmd.test (iocmd-15.{12,13}): Removed. - - * tests/io.test (io-52.5{,a,b}): Reverted last change, added - * tests/chanio.test (chan-io-52.5{,a,b}): comment regarding the - meaning of -1, added two more testcases for other negative values, - and input wrapped to negative. - -2008-04-09 Donal K. Fellows - - * tests/{fCmd,unixFCmd,winFCmd,winFile}.test: Tidying up of the test - suite to make better use of tcltest2 and be clearer about what is - being tested. - - * win/Makefile.in (html): Added target for doing convenient - documentation builds, mirroring the one from unix/Makefile. - -2008-04-09 Andreas Kupries - - * tests/chanio.test (chan-io-52.5): Removed '-size -1' from test, - * tests/io.test (io-52.5): does not seem to have any bearing, and was - an illegal value. Test case is not affected by the value of -size, - test flag restoration and that evrything was properly copied. - - * generic/tclIOCmd.c (Tcl_FcopyObjCmd): Added checking of -size value - * tests/ioCmd.test (iocmd-15.{13,14}): to reject negative values, and - values overflowing 32-bit signed. Basic patch by Alexandre Ferrieux - , with modifications from me to - separate overflow from true negative value. Extended testsuite. [Bug - 1557855] - -2008-04-09 Daniel Steffen - - * tests/chanio.test (chan-io-53.8,53.9,53.10): Fix typo & quoting for - * tests/io.test (io-53.8,53.9,53.10): spaces in builddir path - -2008-04-08 Miguel Sofer - - * generic/tclExecute.c: Added comments to the alignment macros used in - GrowEvaluationStack() and friends. - -2008-04-08 Daniel Steffen - - * tools/genStubs.tcl: Revert erroneous 2008-04-02 change marking - *StubsPtr as EXTERN instead of extern. - - * generic/tclDecls.h: make genstubs - * generic/tclIntDecls.h: - * generic/tclIntPlatDecls.h: - * generic/tclPlatDecls.h: - * generic/tclTomMathDecls.h: - -2008-04-07 Andreas Kupries - - * tests/io.test (io-53.10): Testcase for bi-directional fcopy. - * tests/chanio.test: - * generic/tclIO.c: Additional changes to data structures for fcopy and - * generic/tclIO.h: channels to perform proper cleanup in case of a - channel having two background copy operations running as is now - possible. - - * generic/tclIO.c (BUSY_STATE, CheckChannelErrors, TclCopyChannel): - New macro, and the places using it. This change allows for - bi-directional fcopy on channels. Thanks to Alexandre Ferrieux - for the patch. [Bug 1350564] - -2008-04-07 Reinhard Max - - * generic/tclStringObj.c (Tcl_AppendFormatToObj): Fix [format {% d}] - so that it behaves the same way as in 8.4 and as C's printf(). - * tests/format.test: Add a test for '% d' and '%+d'. - -2008-04-05 Kevin B. Kenny - - * win/tclWinFile.c: (WinSymLinkDirectory): Fixed a problem that Tcl - was creating an NTFS junction point (IO_REPARSE_TAG_MOUNT_POINT) but - filling in the union member for a Vista symbolic link. We had gotten - away with this error because the union member - (SymbolicLinkReparseBuffer) was misdefined in this file and in the - 'winnt.h' in early versions of MinGW. MinGW 3.4.2 has the correct - definition of SymbolicLinkReparseBuffer, exposing the mismatch, and - making tests cmdAH-19.4.1, fCmd-28.*, and filename-11.* fail. - * tests/chanio.test (chan-io-53.9): - * tests/io.test (io-53.9): Made test cleanup robust against the - possibility of slow process shutdown on Windows. - - * win/tcl.m4: Added -D_CRT_SECURE_NO_DEPRECATE and - -DCRT_NONSTDC_NO_DEPRECATE to the MSVC compilation flags so that the - compilation doesn't barf on perfectly reasonable Posix system calls. - * win/configure: Manually patched (don't have the right autoconf to - hand). - -2008-04-04 Andreas Kupries - - * tests/io.test (io-53.9): Added testcase for [Bug 780533], based - * tests/chanio.test: on Alexandre's test script. Also fixed problem - with timer in preceding test, was not canceled properly in the ok case - -2008-04-04 Andreas Kupries - - * generic/tclIORChan.c (ReflectOutput): Allow zero return from write - when input was zero-length anyway. Otherwise keept it an error, and - separate the message from 'written too much'. - - * tests/ioCmd.test (iocmd-24.6): Testcase updated for changed message. - - * generic/tclIORChan.c (ReflectClose): Added missing removal of the - now closed channel from the reflection map. Before we could crash the - system by invoking 'chan postevent' on a closed reflected channel, - dereferencing the dangling pointer in the map. - - * tests/ioCmd.test (iocmd-31.8): Testcase for the above. - -2008-04-03 Andreas Kupries - - * generic/tclIO.c (CopyData): Applied patch [Bug 1932639] to - * tests/io.test: prevent fcopy from calling -command synchronously - * tests/chanio.test: the first time. Thanks to Alexandre Ferrieux - for report and patch. - -2008-04-02 Daniel Steffen - - * generic/tcl.decls: Remove 'export' declarations of symbols now - only in libtclstub and no longer in libtcl. - - * generic/tclStubLib.c: Make symbols in libtclstub.a MODULE_SCOPE to - * tools/genStubs.tcl: avoid exporting them from libraries that link - with -ltclstub; constify tcl*StubsPtr and stub - table hook pointers. [Bug 1819422] - - * generic/tclDecls.h: make genstubs - * generic/tclIntDecls.h: - * generic/tclIntPlatDecls.h: - * generic/tclPlatDecls.h: - * generic/tclStubInit.c: - * generic/tclTomMathDecls.h: - -2008-04-02 Andreas Kupries - - * generic/tclIO.c (CopyData): Applied patch for fcopy problem [Bug - 780533], with many thanks to Alexandre Ferrieux - for tracking it down and providing a - solution. Still have to convert his test script into a proper test - case. - -2008-04-01 Andreas Kupries - - * generic/tclStrToD.c: Applied patch for [Bug 1839067] (fp rounding - * unix/tcl.m4: setup on solaris x86, native cc), provided by - Michael Schlenker. - -2008-04-01 Don Porter - - * generic/tclStubLib.c: Removed needless #ifdef complexity. - - * generic/tclStubLib.c (Tcl_InitStubs): Added missing error message. - * generic/tclPkg.c (Tcl_PkgInitStubsCheck): - - * README: Bump version number to 8.6a0 - * generic/tcl.h: - * library/init.tcl: - * macosx/Tcl-Common.xcconfig: - * macosx/Tcl.pbproj/default.pbxuser: - * macosx/Tcl.pbproj/project.pbxproj: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/README: - * win/configure.in: - * win/makefile.bc: - * win/tcl.m4: - - * unix/configure: autoconf-2.59 - * win/configure: - - * generic/tclBasic.c: Revised stubs-generation tool and interp - * tools/genStubs.tcl: creation so that "tclStubsPtr" is not present - * unix/Makefile.in: in libtcl.so, but is present only in - * win/Makefile.in: libtclstub.a. This tightens up the rules for - * win/makefile.bc: users of the stubs interfaces. [Bug 1819422] - * win/makefile.vc: - - * generic/tclDecls.h: make genstubs - * generic/tclIntDecls.h: - * generic/tclIntPlatDecls.h: - * generic/tclPlatDecls.h: - * generic/tclTomMathDecls.h: - -2008-03-30 Kevin Kenny - - * generic/tclInt.h (TclIsNaN): - * unix/configure.in: Added code to the configurator to check for a - standard isnan() macro and use it if one is - found. This change avoids bugs where the test of - ((d) != (d)) is optimized away by an - overaggressive compiler. [Bug 1783544] - * generic/tclObj.c: Added missing #include needed to locate - isnan() after the above change. - - * unix/configure: autoconf-2.61 - - * tests/mathop.test (mathop-25.9, mathop-25.14): Modified tests to - deal with (slightly buggy) math libraries in which pow() returns an - incorrectly rounded result. [Bug 1808174] - -2008-03-26 Don Porter - - *** 8.5.2 TAGGED FOR RELEASE *** - - * generic/tcl.h: Bump to 8.5.2 for release. - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - - * changes: Updated for 8.5.2 release. - -2008-03-28 Donal K. Fellows - - * tests/fCmd.test: Substantial rewrite to use many more tcltest - features. Great reduction in quantity of [catch] gymnastics. Several - buggy tests fixed, including one where the result of the previous test - was being checked! - -2008-03-27 Kevin B. Kenny - - * library/tzdata/America/Marigot: - * library/tztata/America/St_Barthelemy: - * library/tzdata/America/Argentina/San_Luis: - * library/tzdata/Asia/Ho_Chi_Minh: - * library/tzdata/Asia/Kolkata: (new files) - * library/tzdata/America/Caracas: - * library/tzdata/America/Havana: - * library/tzdata/America/Santiago: - * library/tzdata/America/Argentina/Buenos_Aires: - * library/tzdata/America/Argentina/Catamarca: - * library/tzdata/America/Argentina/Cordoba: - * library/tzdata/America/Argentina/Jujuy: - * library/tzdata/America/Argentina/La_Rioja: - * library/tzdata/America/Argentina/Mendoza: - * library/tzdata/America/Argentina/Rio_Gallegos: - * library/tzdata/America/Argentina/San_Juan: - * library/tzdata/America/Argentina/Tucuman: - * library/tzdata/America/Argentina/Ushuaia: - * library/tzdata/Asia/Baghdad: - * library/tzdata/Asia/Calcutta: - * library/tzdata/Asia/Damascus: - * library/tzdata/Asia/Saigon: - * library/tzdata/Pacific/Easter: - Changes up to and including Olson's tzdata2008b. - -2008-03-27 Daniel Steffen - - * unix/tcl.m4 (SunOS-5.1x): Fix 64bit support for Sun cc. [Bug - 1921166] - - * unix/configure: autoconf-2.59 - -2008-03-26 Don Porter - - * changes: Updated for 8.5.2 release. - -2008-03-24 Pat Thoyts - - * generic/tclBinary.c: [Bug 1923966] - crash in binary format - * tests/binary.test: Added tests for the above crash condition. - -2008-03-21 Donal K. Fellows - - * doc/switch.n: Clarified documentation in respect of two-argument - invokation. [Bug 1899962] - - * tests/switch.test: Added more tests of regexp-mode compilation of - the [switch] command. [Bug 1854435] - -2008-03-20 Donal K. Fellows - - * generic/tcl.h, generic/tclThreadAlloc.c: Tidied up the declarations - of Tcl_GetMemoryInfo so that it is always defined. Will panic when - called against a Tcl that was previously built without it at all, - which is OK because that also indicates a serious mismatch between - memory configuration options. - -2008-03-19 Donal K. Fellows - - * generic/tcl.h, generic/tclThreadAlloc.c (Tcl_GetMemoryInfo): Make - sure this function is available when direct linking. [Bug 1868171] - - * tests/reg.test (reg-33.14): Marked nonPortable because some - environments have small default stack sizes. [Bug 1905562] - -2008-03-18 Andreas Kupries - - * library/tm.tcl (::tcl::tm::UnknownHandler): Changed 'source' to - 'source -encoding utf-8'. This fixes a portability problem of Tcl - Modules pointed out by Don Porter. By using plain 'source' we were at - the mercy of 'encoding system', making modules less portable than they - could be. The exact scenario: A writes a TM in some weird encoding - which is A's system encoding, distributes it, and somewhere else it - cannot be read/used because the system encoding is different. Forcing - the use of utf-8 makes the module portable. - - ***INCOMPATIBILITY*** for all Tcl Modules already written in non-utf-8 - compatible encodings. - -2008-03-18 Don Porter - - * generic/tclExecute.c: Patch from Miguel Sofer to correct the - alignment of memory allocated by GrowEvaluationStack(). [Bug 1914503] - -2008-03-18 Andreas Kupries - - * library/tm.tcl (::tcl::tm::Defaults): Modified handling of - environment variables. Solution slightly different than proposed in - the report. Using the underscored form TCLX_y_TM_PATH even if - TCLX.y_TM_PATH exists. Also using a loop to cut prevent code - replication. [Bug 1914604] - -2008-03-16 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileDictForCmd): Correct the handling - of stack space calculation (the jump pattern used was confusing the - simple-minded code doing the calculations). [Bug 1903325] - - * doc/lreplace.n: Clarified documentation of what happens with - negative indices. [Bug 1905809] Added example, tidied up formatting. - -2008-03-14 Don Porter - - * generic/tclBasic.c (OldMathFuncProc): Same workaround protection - from bad TclStackAlloc() alignment. Thanks George Peter Staplin. - - * generic/tclCmdIL.c (Tcl_LsortObjCmd): Use ckalloc() to allocate - SortElement arrays instead of TclStackAlloc() which isn't getting - alignment right. Workaround for [Bug 1914503]. - -2008-03-14 Reinhard Max - - * generic/tclTest.c: Ignore the return value of write() when we are - * unix/tclUnixPipe.c: about to exit anyways. - -2008-03-13 Daniel Steffen - - * unix/configure.in: Use backslash-quoting instead of double-quoting - * unix/tcl.m4: for lib paths in tclConfig.sh. [Bug 1913622] - * unix/configure: autoconf-2.59 - -2008-03-13 Don Porter - - * changes: Updated for 8.5.2 release. - - * generic/tclStrToD.c: Resolve identifier conflict over "pow10" with - libm in Cygwin and DJGPP. Thanks to Gordon Schumacher and Philip - Moore. [Patch 1800636] - -2008-03-12 Daniel Steffen - - * macosx/Tcl.xcodeproj/project.pbxproj: Add support for Xcode 3.1 - * macosx/Tcl.xcodeproj/default.pbxuser: CODE_SIGN_IDENTITY and - * macosx/Tcl-Common.xcconfig: 'xcodebuild install'. - -2008-03-12 Andreas Kupries - - * doc/info.n: Replaced {expand} with {*}. - -2008-03-12 Jeff Hobbs - - * unix/Makefile.in (install-libraries): Bump http to 2.7 - * win/Makefile.in (install-libraries): Added -myaddr option to allow - * library/http/http.tcl (http::geturl): control of selected socket - * library/http/pkgIndex.tcl: interface. [Bug 559898] - * doc/http.n, tests/http.test: Added -keepalive and - -protocol 1.1 with chunked transfer encoding support. [Bug 1063703, - 1470377, 219225] (default keepalive is 0) - Added ability to override Host in -headers. [Bug 928154] - Added -strict option to control URL validation on per-call basis. - [Bug 1560506] - -2008-03-11 Jeff Hobbs - - * library/http/http.tcl (http::geturl): Add -method option to support - * tests/http.test (http-3.1): http PUT and DELETE requests. - * doc/http.n: [Bug 1599901, 862554] - - * library/http/http.tcl: Whitespace changes, code cleanup. Allow http - to be re-sourced without overwriting http state. - -2008-03-11 Daniel Steffen - - * generic/tclEncoding.c (LoadEscapeEncoding): Avoid leaking escape - sub-encodings, fixes encoding-11.1 failing after iso2022-jp loaded. - [Bug 1893053] - - * macosx/tclMacOSXNotify.c: Avoid using CoreFoundation after fork() on - Darwin 9 even when TclpCreateProcess() uses vfork(). - - * macosx/Tcl.xcodeproj/project.pbxproj: Add support for Xcode 3.1 and - * macosx/Tcl.xcodeproj/default.pbxuser: configs for building with - * macosx/Tcl-Common.xcconfig: gcc-4.2 and llvm-gcc-4.2. - - * unix/tclUnixPort.h: Workaround vfork() problems in - llvm-gcc-4.2.1 -O4 build. - - * unix/tclUnixPort.h: Move MODULE_SCOPE compat - define to top. [Bug 1911102] - - * macosx/GNUmakefile: Fix quoting to allow paths - * macosx/Tcl-Common.xcconfig: to ${builddir} and - * unix/Makefile.in: ${INSTALL_ROOT} to contain - * unix/configure.in: spaces. - * unix/install-sh: - * unix/tcl.m4: - * tests/ioCmd.test: - - * unix/configure: autoconf-2.59 - - * unix/Makefile.in (install-strip): Strip non-global symbols from - dynamic library. - - * unix/tclUnixNotfy.c: Fix warning. - - * tests/exec.test (exec-9.7): Reduce timing sensitivity - * tests/socket.test (socket-2.11): (esp. on multi-proc machines). - - * tests/fCmd.test (fCmd-9.4): Skip on Darwin 9 (xfail). - -2008-03-11 Miguel Sofer - - * generic/tclVar.c (TclDeleteNamespaceVars): - * tests/var.test (var-8.2): Unset traces on vars should be called with - a FQ named during namespace deletion. This was causing infinite loops - when unset traces recreated the var, as reported by Julian Noble. [Bug - 1911919] - -2008-03-10 Don Porter - - * changes: Updated for 8.5.2 release. - - * doc/http.n: Revised to indicate that [package require http 2.5.5] - is needed to get all the documented commands ([http::meta]). - - * generic/tclEvent.c (TclDefaultBgErrorHandlerObjCmd): Added error - * tests/event.test (event-5.*): checking to protect against callers - passing invalid return options dictionaries. [Bug 1901113] - - * generic/tclBasic.c (ExprAbsFunc): Revised so that the abs() - * tests/expr.test: function and the [::tcl::mathfunc::abs] - command do not return the value of -0, or equivalent values with more - alarming string reps like -1e-350. [Bug 1893815] - -2008-03-07 Andreas Kupries - - * generic/tclResult.c (ReleaseKeys): Workaround for [Bug 1904907]. - Reset the return option keys to NULL to allow full re-initialization - by GetKeys(). This introduces a memory leak for the key objects, but - gets us around a crash in the finalization of reflected channels when - handling returns, either at compile- or runtime. In both cases we - access the keys after they have been released by their thread exit - handler. A proper fix is entangled with the untangling of the - finalization ordering and attendant issues. For now we choose the - lesser evil. - -2008-03-07 Don Porter - - * generic/tclExecute.c (Tcl_ExprObj): Revised expression bytecode - compiling so that bytecodes invalid due to changing context or due to - the difference between expressions and scripts are not reused. [Bug - 1899164] - - * generic/tclCmdAH.c: Revised direct evaluation implementation of - [expr] so that [expr $e] caches compiled bytecodes for the expression - as the intrep of $e. - - * tests/execute.test (execute-6.*): More tests checking that - script bytecode is invalidated in the right situations. - -2008-03-07 Donal K. Fellows - - * win/configure.in: Add AC_HEADER_STDC to support msys/win64. - -2008-03-06 Donal K. Fellows - - * doc/namespace.n: Minor tidying up. [Bug 1909019] - -2008-03-04 Don Porter - - * tests/execute.test (6.3,4): Added tests for [Bug 1899164]. - -2008-03-03 Reinhard Max - - * unix/tclUnixChan.c: Fix mark and space parity on Linux, which uses - CMSPAR instead of PAREXT. - -2008-03-02 Miguel Sofer - - * generic/tclNamesp.c (GetNamespaceFromObj): - * tests/interp.test (interp-28.2): Spoil the intrep of an nsNameType - obj when the reference crosses interpreter boundaries. - -2008-02-29 Don Porter - - * generic/tclResult.c (Tcl_SetReturnOptions): Revised the refcount - management of Tcl_SetReturnOptions to become that of a conventional - Consumer routine. Thanks to Peter Spjuth for pointing out the - difficulties calling Tcl_SetReturnOptions with non-0-count value for - options. - * generic/tclExecute.c (INST_RETURN_STK): Revised the one caller - within Tcl itself which passes a non-0-count value to - Tcl_SetReturnOptions(). - - * generic/tclBasic.c (Tcl_AppendObjToErrorInfo): Revised the - refcount management of Tcl_AppendObjToErrorInfo to become that of a - conventional Consumer routine. This preserves the ease of use for the - overwhelming common callers who pass in a 0-count value, but makes the - proper call with a non-0-count value less surprising. - * generic/tclEvent.c (TclDefaultBgErrorHandlerObjCmd): Revised the - one caller within Tcl itself which passes a non-0-count value to - Tcl_AppendObjToErrorInfo(). - -2008-02-28 Joe English - - * unix/tclPort.h, unix/tclCompat.h, unix/tclUnixChan.h: Reduce scope - of and #includes. [Patch 1903339] - -2008-02-28 Joe English - - * unix/tclUnixChan.c, unix/tclUnixNotfy.c, unix/tclUnixPipe.c: - Consolidate all code conditionalized on -DUSE_FIONBIO into one place. - * unix/tclUnixPort.h, unix/tclUnixCompat.c: New routine - TclUnixSetBlockingMode(). [Patch 1903339] - -2008-02-28 Don Porter - - * generic/tclBasic.c (TclEvalObjvInternal): Plug memory leak when - an enter trace deletes or changes the command, prompting a reparsing. - Don't let the second pass lose commandPtr value allocated during the - first pass. - - * generic/tclCompExpr.c (ParseExpr): Plug memory leak in error - message generation. - - * generic/tclStringObj.c (Tcl_AppendFormatToObj): [format %llx $big] - leaked an mp_int. - - * generic/tclCompCmds.c (TclCompileReturnCmd): The 2007-10-18 commit - to optimize compiled [return -level 0 $x] [RFE 1794073] introduced a - memory leak of the return options dictionary. Fixing that. - -2008-02-27 Pat Thoyts - - * library/http/http.tcl: [Bug 705956] - fix inverted logic when - cleaning up socket error in geturl. - -2008-02-27 Kevin B. Kenny - - * doc/clock.n: Corrected minor indentation gaffe in the penultimate - paragraph. [Bug 1898025] - * generic/tclClock.c (ParseClockFormatArgs): Changed to check that the - clock value is in the range of a 64-bit integer. [Bug 1862555] - * library/clock.tcl (::tcl::clock::format, ::tcl::clock::scan, - (::tcl::clock::add, ::tcl::clock::LocalizeFormat): Fixed bugs in - caching of localized strings that caused weird results when localized - date/time formats were used. [Bug 1902423] - * tests/clock.test (clock-61.*, clock-62.1): Regression tests for [Bug - 1862555] and [Bug 1902423]. - -2008-02-26 Joe English - - * generic/tclIOUtil.c, unix/tclUnixPort.h, unix/tclUnixChan.c: - Remove dead/unused portability-related #defines and unused conditional - code. See [Patch 1901828] for discussion. - -2008-02-26 Joe English - - * generic/tclIORChan.c (enum MethodName), - * generic/tclCompExpr.c (enum Marks): More stray trailing ","s - -2008-02-26 Joe English - - * unix/configure.in(socklen_t test): Define socklen_t as "int" if - missing, not "unsigned". Use AC_TRY_COMPILE instead of - AC_EGREP_HEADER. - * unix/configure: regenerated. - -2008-02-26 Joe English - - * generic/tclCompile.h: Remove stray trailing "," from enum - InstOperandType definition (C99ism). - -2008-02-26 Jeff Hobbs - - * generic/tclUtil.c (TclReToGlob): Fix the handling of the last star - * tests/regexpComp.test: possibly being escaped in - determining right anchor. [Bug 1902436] - -2008-02-26 Pat Thoyts - - * library/http/pkgIndex.tcl: Set version 2.5.5 - * library/http/http.tcl: It is better to do the [eof] check after - trying to read from the socket. No clashes found in testing. Added - http::meta command to access the http headers. [Bug 1868845] - -2008-02-22 Pat Thoyts - - * library/http/pkgIndex.tcl: Set version 2.5.4 - * library/http/http.tcl: Always check that the state array exists - in the http::status command. [Bug 1818565] - -2008-02-13 Don Porter - - * generic/tcl.h: Bump version number to 8.5.2b1 to distinguish - * library/init.tcl: CVS development snapshots from the 8.5.1 and - * unix/configure.in: 8.5.2 releases. - * unix/tcl.spec: - * win/configure.in: - * README - - * unix/configure: autoconf (2.59) - * win/configure: - -2008-02-12 Donal K. Fellows - - * generic/tclCompCmds.c (TclCompileSwitchCmd): Corrected logic for - * tests/switch.test (switch-10.15): handling -nocase compilation; the - -exact -nocase option cannot be compiled currently. [Bug 1891827] - - * unix/README: Documented missing configure flags. [Bug 1799011] - -2008-02-06 Kevin B. Kenny - - * doc/clock.n (%N): Corrected an error in the explanation of the %N - format group. - * generic/tclClock.c (ClockParseformatargsObjCmd): - * library/clock.tcl (::tcl::clock::format): - * tests/clock.test (clock-1.0, clock-1.4): - Performance enhancements in [clock format] (moving the analysis of - $args into C code, holding on to Tcl_Objs with resolved command names, - [lassign] in place of [foreach], avoiding [namespace which] for - command resolution). - -2008-02-04 Don Porter - - *** 8.5.1 TAGGED FOR RELEASE *** - - * changes: Updated for 8.5.1 release. - - * generic/tcl.h: Bump to 8.5.1 for release. - * library/init.tcl: - * tools/tcl.wse.in: - * unix/configure.in: - * unix/tcl.spec: - * win/configure.in: - - * unix/configure: autoconf-2.59 - * win/configure: - -2008-02-04 Miguel Sofer - - * generic/tclExecute.c (INST_CONCAT1): Fix optimisation for in-place - concatenation (was going over String type) - -2008-02-02 Daniel Steffen - - * unix/configure.in (Darwin): Correct Info.plist year substitution - in non-framework builds. - - * unix/configure: autoconf-2.59 - -2008-01-30 Miguel Sofer - - * generic/tclInterp.c (Tcl_GetAlias): Fix for [Bug 1882373], thanks go - to an00na. - -2008-01-30 Donal K. Fellows - - * tools/tcltk-man2html.tcl: Reworked manual page scraper to do a - proper job of handling references to Ttk options. [Tk Bug 1876493] - -2008-01-29 Donal K. Fellows - - * doc/man.macros (SO, SE): Adjusted macros so that it is possible for - Ttk to have its "standard options" on a manual page that is not called - "options". [Tk Bug 1876493] - -2008-01-25 Don Porter - - * changes: Updated for 8.5.1 release. - -2008-01-23 Don Porter - - * generic/tclInt.h: New macro TclGrowParseTokenArray() to - * generic/tclCompCmds.c: simplify code that might need to grow - * generic/tclCompExpr.c: an array of Tcl_Tokens in the parsePtr - * generic/tclParse.c: field of a Tcl_Parse. Replaces the - TclExpandTokenArray() routine via replacing: - int needed = parsePtr->numTokens + growth; - while (needed > parsePtr->tokensAvailable) { - TclExpandTokenArray(parsePtr); - } - with: - TclGrowParseTokenArray(parsePtr, growth); - This revision merged over from dgp-refactor branch. - - * generic/tclCompile.h: Demote TclCompEvalObj() from internal stubs to - * generic/tclInt.decls: a MODULE_SCOPE routine declared in - tclCompile.h. - - * generic/tclIntDecls.h: make genstubs - * generic/tclStubInit.c: - -2008-01-22 Don Porter - - * generic/tclTimer.c (AfterProc): Replace Tcl_EvalEx() with - Tcl_EvalObjEx() to evaluate [after] callbacks. Part of trend to favor - compiled execution over direct evaluation. - -2008-01-22 Miguel Sofer - - * generic/tclCmdIl.c (Tcl_LreverseObjCmd): - * tests/cmdIL.test (cmdIL-7.7): Fix crash on reversing an empty list. - [Bug 1876793] - -2008-01-20 Jeff Hobbs - - * unix/README: Minor typo fixes [Bug 1853072] - - * generic/tclIO.c (TclGetsObjBinary): Operate on topmost channel. - [Bug 1869405] (Ficicchia) - -2008-01-17 Don Porter - - * generic/tclCompExpr.c: Revision to preserve parsed intreps of - numeric and boolean literals when compiling expressions with (optimize - == 1). - -2008-01-15 Miguel Sofer - - * generic/tclCompExpr.c: Add an 'optimize' argument to - * generic/tclCompile.c: TclCompileExpr() to profit from better - * generic/tclCompile.h: literal management according to usage. - * generic/tclExecute.c: - - * generic/tclCompExpr.c: Fix literal leak in exprs [Bug 1869989] (dgp) - * generic/tclExecute.c: - * tests/compExpr.test: - - * doc/proc.n: Changed wording for access to non-local variables; added - mention to [namespace upvar]. Lame attempt at dealing with - documentation. [Bug 1872708] - -2008-01-15 Miguel Sofer - - * generic/tclBasic.c: Replacing 'operator' by 'op' in the def of - * generic/tclCompExpr.c: struct TclOpCmdClientData to accommodate C++ - * generic/tclCompile.h: compilers. [Bug 1855644] - -2008-01-13 Jeff Hobbs - - * win/tclWinSerial.c (SerialCloseProc, TclWinOpenSerialChannel): Use - critical section for read & write side. [Bug 1353846] (newman) - -2008-01-11 Miguel Sofer - - * unix/tclUnixThrd.c (TclpThreadGetStackSize): Restore stack checking - functionality in freebsd. [Bug 1850424] - - * unix/tclUnixThrd.c (TclpThreadGetStackSize): Fix for crash in - freebsd. [Bug 1860425] - -2008-01-10 Don Porter - - * generic/tclStringObj.c (Tcl_AppendFormatToObj): Correct failure to - * tests/format.test: account for big.used == 0 corner case in the - %ll(idox) format directives. [Bug 1867855] - -2008-01-09 George Peter Staplin - - * doc/vwait.n: Add a missing be to fix a typo. - -2008-01-04 Jeff Hobbs - - * tools/tcltk-man2html.tcl (make-man-pages): Make man page title use - more specific info on lhs to improve tabbed browser view titles. - -2008-01-02 Donal K. Fellows - - * doc/binary.n: Fixed documentation bug reported on tcl-core, and - reordered documentation to discourage people from using the hex - formatter that is hardly ever useful. - -2008-01-02 Don Porter - - * generic/tcl.h: Bump version number to 8.5.1b1 to distinguish - * library/init.tcl: CVS development snapshots from the 8.5.0 and - * unix/configure.in: 8.5.1 releases. - * unix/tcl.spec: - * win/configure.in: - * README - - * unix/configure: autoconf (2.59) - * win/configure: - - ****************************************************************** - *** CHANGELOG ENTRIES FOR 2006-2007 IN "ChangeLog.2007" *** - *** CHANGELOG ENTRIES FOR 2005 IN "ChangeLog.2005" *** - *** CHANGELOG ENTRIES FOR 2004 IN "ChangeLog.2004" *** - *** CHANGELOG ENTRIES FOR 2003 IN "ChangeLog.2003" *** - *** CHANGELOG ENTRIES FOR 2002 IN "ChangeLog.2002" *** - *** CHANGELOG ENTRIES FOR 2001 IN "ChangeLog.2001" *** - *** CHANGELOG ENTRIES FOR 2000 IN "ChangeLog.2000" *** - *** CHANGELOG ENTRIES FOR 1999 AND EARLIER IN "ChangeLog.1999" *** - ****************************************************************** diff --git a/README b/README deleted file mode 100644 index 322666a..0000000 --- a/README +++ /dev/null @@ -1,185 +0,0 @@ -README: Tcl - This is the Tcl 8.7a2 source distribution. - http://sourceforge.net/projects/tcl/files/Tcl/ - You can get any source release of Tcl from the URL above. - -Contents --------- - 1. Introduction - 2. Documentation - 3. Compiling and installing Tcl - 4. Development tools - 5. Tcl newsgroup - 6. The Tcler's Wiki - 7. Mailing lists - 8. Support and Training - 9. Tracking Development - 10. Thank You - -1. Introduction ---------------- -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, and Mac OS X. -Tcl can also be used for a variety of web-related tasks and for creating -powerful command languages for applications. - -Tcl is maintained, enhanced, and distributed freely by the Tcl community. -Source code development and tracking of bug reports and feature requests -takes place at: - - http://core.tcl.tk/ - -Tcl/Tk release and mailing list services are hosted by SourceForge: - - http://sourceforge.net/projects/tcl/ - -with the Tcl Developer Xchange hosted at: - - http://www.tcl.tk/ - -Tcl is a freely available open source package. You can do virtually -anything you like with it, such as modifying it, redistributing it, -and selling it either in whole or in part. See the file -"license.terms" for complete information. - -2. Documentation ----------------- - -Extensive documentation is available at our website. -The home page for this release, including new features, is - http://www.tcl.tk/software/tcltk/8.7.html - -Detailed release notes can be found at the file distributions page -by clicking on the relevant version. - http://sourceforge.net/projects/tcl/files/Tcl/ - -Information about Tcl itself can be found at - http://www.tcl.tk/about/ - -There have been many Tcl books on the market. Many are mentioned in the Wiki: - http://wiki.tcl.tk/_/ref?N=25206 - -To view the complete set of reference manual entries for Tcl 8.7 online, -visit the URL: - http://www.tcl.tk/man/tcl8.7/ - -2a. Unix Documentation ----------------------- - -The "doc" subdirectory in this release contains a complete set of -reference manual entries for Tcl. Files with extension ".1" are for -programs (for example, tclsh.1); files with extension ".3" are for C -library procedures; and files with extension ".n" describe Tcl -commands. The file "doc/Tcl.n" gives a quick summary of the Tcl -language syntax. To print any of the man pages on Unix, cd to the -"doc" directory and invoke your favorite variant of troff using the -normal -man macros, for example - - ditroff -man Tcl.n - -to print Tcl.n. If Tcl has been installed correctly and your "man" program -supports it, you should be able to access the Tcl manual entries using the -normal "man" mechanisms, such as - - man Tcl - -2b. Windows Documentation -------------------------- - -The "doc" subdirectory in this release contains a complete set of Windows -help files for Tcl. Once you install this Tcl release, a shortcut to the -Windows help Tcl documentation will appear in the "Start" menu: - - Start | Programs | Tcl | Tcl Help - -3. Compiling and installing Tcl -------------------------------- - -There are brief notes in the unix/README, win/README, and macosx/README about -compiling on these different platforms. There is additional information -about building Tcl from sources at - - http://www.tcl.tk/doc/howto/compile.html - -4. Development tools ---------------------------- - -ActiveState produces a high quality set of commercial quality development -tools that is available to accelerate your Tcl application development. -Tcl Dev Kit builds on the earlier TclPro toolset and provides a debugger, -static code checker, single-file wrapping utility, bytecode compiler and -more. More information can be found at - - http://www.ActiveState.com/Tcl - -5. Tcl newsgroup ----------------- - -There is a USENET news group, "comp.lang.tcl", intended for the exchange of -information about Tcl, Tk, and related applications. The newsgroup is a -great place to ask general information questions. For bug reports, please -see the "Support and bug fixes" section below. - -6. Tcl'ers Wiki ---------------- - -A Wiki-based open community site covering all aspects of Tcl/Tk is at: - - http://wiki.tcl.tk/ - -It is dedicated to the Tcl programming language and its extensions. A -wealth of useful information can be found there. It contains code -snippets, references to papers, books, and FAQs, as well as pointers to -development tools, extensions, and applications. You can also recommend -additional URLs by editing the wiki yourself. - -7. Mailing lists ----------------- - -Several mailing lists are hosted at SourceForge to discuss development or -use issues (like Macintosh and Windows topics). For more information and -to subscribe, visit: - - http://sourceforge.net/projects/tcl/ - -and go to the Mailing Lists page. - -8. Support and Training ------------------------- - -We are very interested in receiving bug reports, patches, and suggestions -for improvements. We prefer that you send this information to us as -tickets entered into our tracker at: - - http://core.tcl.tk/tcl/reportlist - -We will log and follow-up on each bug, although we cannot promise a -specific turn-around time. Enhancements may take longer and may not happen -at all unless there is widespread support for them (we're trying to -slow the rate at which Tcl/Tk turns into a kitchen sink). It's very -difficult to make incompatible changes to Tcl/Tk at this point, due to -the size of the installed base. - -The Tcl community is too large for us to provide much individual support -for users. If you need help we suggest that you post questions to -comp.lang.tcl. We read the newsgroup and will attempt to answer esoteric -questions for which no one else is likely to know the answer. In addition, -see the following Web site for links to other organizations that offer -Tcl/Tk training: - - http://wiki.tcl.tk/training - -9. Tracking Development ------------------------ - -Tcl is developed in public. To keep an eye on how Tcl is changing, see - http://core.tcl.tk/ - -10. Thank You -------------- - -We'd like to express our thanks to the Tcl community for all the -helpful suggestions, bug reports, and patches we have received. -Tcl/Tk has improved vastly and will continue to do so with your help. diff --git a/changes b/changes deleted file mode 100644 index ec8beb1..0000000 --- a/changes +++ /dev/null @@ -1,8843 +0,0 @@ -Recent user-visible changes to Tcl: - -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 -at the end of each line but the last. - -4. "Var" command has been changed to "set". - -5. Double-quotes now available as an argument grouping character. - -6. "Return" may be used at top-level. - -7. More backslash sequences available now. In particular, backslash-newline -may be used to join lines in command files. - -8. New or modified built-in commands: case, return, for, glob, info, -print, return, set, source, string, uplevel. - -9. After an error, the variable "errorInfo" is filled with a stack -trace showing what was being executed when the error occurred. - -10. Command abbreviations are accepted when parsing commands, but -are not recommended except for purely-interactive commands. - -11. $, set, and expr all complain now if a non-existent variable is -referenced. - -12. History facilities exist now. See Tcl.man and Tcl_RecordAndEval.man. - -13. Changed to distinguish between empty variables and those that don't -exist at all. Interfaces to Tcl_GetVar and Tcl_ParseVar have changed -(NULL return value is now possible). *** POTENTIAL INCOMPATIBILITY *** - -14. Changed meaning of "level" argument to "uplevel" command (1 now means -"go up one level", not "go to level 1"; "#1" means "go to level 1"). -*** POTENTIAL INCOMPATIBILITY *** - -15. 3/19/90 Added "info exists" option to see if variable exists. - -16. 3/19/90 Added "noAbbrev" variable to prohibit command abbreviations. - -17. 3/19/90 Added extra errorInfo option to "error" command. - -18. 3/21/90 Double-quotes now only affect space: command, variable, -and backslash substitutions still occur inside double-quotes. -*** POTENTIAL INCOMPATIBILITY *** - -19. 3/21/90 Added support for \r. - -20. 3/21/90 List, concat, eval, and glob commands all expect at least -one argument now. *** POTENTIAL INCOMPATIBILITY *** - -21. 3/22/90 Added "?:" operators to expressions. - -22. 3/25/90 Fixed bug in Tcl_Result that caused memory to get trashed. - -------------------- Released version 3.1 --------------------- - -23. 3/29/90 Fixed bug that caused "file a.b/c ext" to return ".b/c". - -24. 3/29/90 Semi-colon is not treated specially when enclosed in -double-quotes. - -------------------- Released version 3.2 --------------------- - -25. 4/16/90 Rewrote "exec" not to use select or signals anymore. -Should be more Sys-V compatible, and no slower in the normal case. - -26. 4/18/90 Rewrote "glob" to eliminate GNU code (there's no GNU code -left in Tcl, now), and added Tcl_TildeSubst procedure. Added automatic -tilde-substitution in many commands, including "glob". - -------------------- Released version 3.3 --------------------- - -27. 7/11/90 Added "Tcl_AppendResult" procedure. - -28. 7/20/90 "History" with no options now defaults to "history info" -rather than to "history redo". Although this is a backward incompatibility, -it should only be used interactively and thus shouldn't present any -compatibility problems with scripts. - -29. 7/20/90 Added "Tcl_GetInteger", "Tcl_GetDouble", and "Tcl_GetBoolean" -procedures. - -30. 7/22/90 Removed "Tcl_WatchInterp" procedure: doesn't seem to be -necessary, since the same effect can be achieved with the deletion -callbacks on individual commands. *** POTENTIAL INCOMPATIBILITY *** - -31. 7/23/90 Added variable tracing: Tcl_TraceVar, Tcl_UnTraceVar, -and Tcl_VarTraceInfo procedures, "trace" command. - -32. 8/9/90 Mailed out list of all bug fixes since 3.3 release. - -33. 8/29/90 Fixed bugs in Tcl_Merge relating to backslashes and -semi-colons. Mailed out patch. - -34. 9/3/90 Fixed bug in tclBasic.c: quotes weren't quoting ]'s. -Mailed out patch. - -35. 9/19/90 Rewrote exec to always use files both for input and -output to the process. The old pipe-based version didn't work if -the exec'ed process forked a child and then exited: Tcl waited -around for stdout to get closed, which didn't happen until the -grandchild exited. - -36. 11/5/90 ERR_IN_PROGRESS flag wasn't being cleared soon enough -in Tcl_Eval, allowing error messages from different commands to -pile up in $errorInfo. Fixed by re-arranging code in Tcl_Eval that -re-initializes result and ERR_IN_PROGRESS flag. Didn't mail out -patch: changes too complicated to describe. - -37. 12/19/90 Added Tcl_VarEval procedure as a convenience for -assembling and executing Tcl commands. - -38. 1/29/91 Fixed core leak in Tcl_AddErrorInfo. Also changed procedure -and Tcl_Eval so that first call to Tcl_AddErrorInfo need not come from -Tcl_Eval. - ------------------ Released version 5.0 with Tk ------------------ - -39. 4/3/91 Removed change bars from manual entries, leaving only those -that came after version 3.3 was released. - -40. 5/17/91 Changed tests to conform to Mary Ann May-Pumphrey's approach. - -41. 5/23/91 Massive revision to Tcl parser to simplify the implementation -of string and floating-point support in expressions. Newlines inside -[] are now treated as command separators rather than word separators -(this makes newline treatment consistent throughout Tcl). -*** POTENTIAL INCOMPATIBILITY *** - -42. 5/23/91 Massive rewrite of expression code to support floating-point -values and simple string comparisons. The C interfaces to expression -routines have changed (Tcl_Expr is replaced by Tcl_ExprLong, Tcl_ExprDouble, -etc.), but all old Tcl expression strings should be accepted by the new -expression code. -*** POTENTIAL INCOMPATIBILITY *** - -43. 5/23/91 Modified tclHistory.c to check for negative "keep" value. - -44. 5/23/91 Modified Tcl_Backslash to handle backslash-newline. It now -returns 0 to indicate that a backslash sequence should be replaced by -no character at all. -*** POTENTIAL INCOMPATIBILITY *** - -45. 5/29/91 Modified to use ANSI C function prototypes. Must set -"USE_ANSI" switch when compiling to get prototypes. - -46. 5/29/91 Completed test suite by providing tests for all of the -built-in Tcl commands. - -47. 5/29/91 Changed Tcl_Concat to eliminate leading and trailing -white-space in each of the things it concatenates and to ignore -elements that are empty or have only white space in them. This -produces cleaner output from the "concat" command. -*** POTENTIAL INCOMPATIBILITY *** - -48. 5/31/91 Changed "set" command and Tcl_SetVar procedure to return -new value of variable. - -49. 6/1/91 Added "while" and "cd" commands. - -50. 6/1/91 Changed "exec" to delete the last character of program -output if it is a newline. In most cases this makes it easier to -process program-generated output. -*** POTENTIAL INCOMPATIBILITY *** - -51. 6/1/91 Made sure that pointers are never used after freeing them. - -52. 6/1/91 Fixed bug in TclWordEnd where it wasn't dealing with -[] inside quotes correctly. - -53. 6/8/91 Fixed exec.test to accept return values of either 1 or -255 from "false" command. - -54. 7/6/91 Massive overhaul of variable management. Associative -arrays now available, along with "unset" command (and Tcl_UnsetVar -procedure). Variable traces have been completely reworked: -interfaces different both from Tcl and C, and multiple traces may -exist on same variable. Can no longer redefine existing local -variable to be global. Calling sequences have changed slightly -for Tcl_GetVar and Tcl_SetVar ("global" is now "flags"). Tcl_SetVar -can fail and return a NULL result. New forms of variable-manipulation -procedures: Tcl_GetVar2, Tcl_SetVar2, etc. Syntax of variable -$-notation changed to support array indexing. -*** POTENTIAL INCOMPATIBILITY *** - -55. 7/6/91 Added new list-manipulation procedures: Tcl_ScanElement, -Tcl_ConvertElement, Tcl_AppendElement. - -56. 7/12/91 Created new procedure Tcl_EvalFile, which does most of the -work of the "source" command. - -57. 7/20/91 Major reworking of "exec" command to allow pipelines, -more redirection, background. Added new procedures Tcl_Fork, -Tcl_WaitPids, Tcl_DetachPids, and Tcl_CreatePipeline. The old -"< input" notation has been replaced by "<< input" ("<" is for -redirection from a file). Also handles error returns and abnormal -terminations (e.g. signals) differently. -*** POTENTIAL INCOMPATIBILITY *** - -58. 7/21/91 Added "append" and "lappend" commands. - -59. 7/22/91 Reworked error messages and manual entries to use -?x? as the notation for an optional argument x, instead of [x]. The -bracket notation was often confused with the use of brackets for -command substitution. Also modified error messages to be more -consistent. - -60. 7/23/91 Tcl_DeleteCommand now returns an indication of whether -or not the command actually existed, and the "rename" command uses -this information to return an error if an attempt is made to delete -a non-existent command. -*** POTENTIAL INCOMPATIBILITY *** - -61. 7/25/91 Added new "errorCode" mechanism, along with procedures -Tcl_SetErrorCode, Tcl_UnixError, and Tcl_ResetResult. Renamed -Tcl_Return to Tcl_SetResult, but left a #define for Tcl_Return to -avoid compatibility problems. - -62. 7/26/91 Extended "case" command with alternate syntax where all -patterns and commands are together in a single list argument: makes -it easier to write multi-line case statements. - -63. 7/27/91 Changed "print" command to perform tilde-substitution on -the file name. - -64. 7/27/91 Added "tolower", "toupper", "trim", "trimleft", and "trimright" -options to "string" command. - -65. 7/29/91 Added "atime", "mtime", "size", and "stat" options to "file" -command. - -66. 8/1/91 Added "split" and "join" commands. - -67. 8/11/91 Added commands for file I/O, including "open", "close", -"read", "gets", "puts", "flush", "eof", "seek", and "tell". - -68. 8/14/91 Switched to use a hash table for command lookups. Command -abbreviations no longer have direct support in the Tcl interpreter, but -it should be possible to simulate them with the auto-load features -described below. The "noAbbrev" variable is no longer used by Tcl. -*** POTENTIAL INCOMPATIBILITY *** - -68.5 8/15/91 Added support for "unknown" command, which can be used to -complete abbreviations, auto-load library files, auto-exec shell -commands, etc. - -69. 8/15/91 Added -nocomplain switch to "glob" command. - -70. 8/20/91 Added "info library" option and TCL_LIBRARY #define. Also -added "info script" option. - -71. 8/20/91 Changed "file" command to take "option" argument as first -argument (before file name), for consistency with other Tcl commands. -*** POTENTIAL INCOMPATIBILITY *** - -72. 8/20/91 Changed format of information in $errorInfo variable: -comments such as - ("while" body line 1) -are now on separate lines from commands being executed. -*** POTENTIAL INCOMPATIBILITY *** - -73. 8/20/91 Changed Tcl_AppendResult so that it (eventually) frees -large buffers that it allocates. - -74. 8/21/91 Added "linsert", "lreplace", "lsearch", and "lsort" -commands. - -75. 8/28/91 Added "incr" and "exit" commands. - -76. 8/30/91 Added "regexp" and "regsub" commands. - -77. 9/4/91 Changed "dynamic" field in interpreters to "freeProc" (procedure -address). This allows for alternative storage managers. -*** POTENTIAL INCOMPATIBILITY *** - -78. 9/6/91 Added "index", "length", and "range" options to "string" -command. Added "lindex", "llength", and "lrange" commands. - -79. 9/8/91 Removed "index", "length", "print" and "range" commands. -"Print" is redundant with "puts", but less general, and the other -commands are replaced with the new commands described in change 78 -above. -*** POTENTIAL INCOMPATIBILITY *** - -80. 9/8/91 Changed history revision to occur even when history command -is nested; needed in order to allow "history" to be invoked from -"unknown" procedure. - -81. 9/13/91 Changed "panic" not to use vfprintf (it's uglier and less -general now, but makes it easier to run Tcl on systems that don't -have vfprintf). Also changed "strerror" not to redeclare sys_errlist. - -82. 9/19/91 Lots of changes to improve portability to different UNIX -systems, including addition of "config" script to adapt Tcl to the -configuration of the system it's being compiled on. - -83. 9/22/91 Added "pwd" command. - -84. 9/22/91 Renamed manual pages so that their filenames are no more -than 14 characters in length, moved to "doc" subdirectory. - -85. 9/24/91 Redid manual entries so they contain the supplemental -macros that they need; can just print with "troff -man" or "man" -now. - -86. 9/26/91 Created initial version of script library, including -a version of "unknown" that does auto-loading, auto-execution, and -abbreviation expansion. This library is used by tclTest -automatically. See the "library" manual entry for details. - ------------------ Released version 6.0, 9/26/91 ------------------ - -87. 9/30/91 Made "string tolower" and "string toupper" check case -before converting: on some systems, "tolower" and "toupper" assume -that character already has particular case. - -88. 9/30/91 Fixed bug in Tcl_SetResult: wasn't always setting freeProc -correctly when called with NULL value. This tended to cause memory -allocation errors later. - -89. 10/3/91 Added "upvar" command. - -90. 10/4/91 Changed "format" so that internally it converts %D to %ld, -%U to %lu, %O to %lo, and %F to %f. This eliminates some compatibility -problems on some machines without affecting behavior. - -91. 10/10/91 Fixed bug in "regsub" that caused core dumps with the -all -option when the last match wasn't at the end of the string. - -92. 10/17/91 Fixed problems with backslash sequences: \r support was -incomplete and \f and \v weren't supported at all. - -93. 10/24/91 Added Tcl_InitHistory procedure. - -94. 10/24/91 Changed "regexp" to store "-1 -1" in subMatchVars that -don't match, rather than returning an error. - -95. 10/27/91 Modified "regexp" to return actual strings in matchVar -and subMatchVars instead of indices. Added "-indices" switch to cause -indices to be returned. -*** POTENTIAL INCOMPATIBILITY *** - -96. 10/27/91 Fixed bug in "scan" where it used hardwired constants for -sizes of floats and doubles instead of using "sizeof". - -97. 10/31/91 Fixed bug in tclParse.c where parse-related error messages -weren't being storage-managed correctly, causing spurious free's. - -98. 10/31/91 Form feed and vertical tab characters are now considered -to be space characters by the parser. - -99. 10/31/91 Added TCL_LEAVE_ERR_MSG flag to procedures like Tcl_SetVar. - -100. 11/7/91 Fixed bug in "case" where "in" argument couldn't be omitted -if all case branches were embedded in a single list. - -101. 11/7/91 Switched to use "pid_t" and "uid_t" and other official -POSIC types and function prototypes. - ------------------ Released version 6.1, 11/7/91 ------------------ - -102. 12/2/91 Modified Tcl_ScanElement and Tcl_ConvertElement in several -ways. First, allowed caller to request that only backslashes be used -(no braces). Second, made Tcl_ConvertElement more aggressive in using -backslashes for braces and quotes. - -103. 12/5/91 Added "type", "lstat", and "readlink" options to "file" -command, plus added new "type" element to output of "stat" and "lstat" -options. - -104. 12/10/91 Manual entries had first lines that caused "man" program -to try weird preprocessor. Added blank comment lines to fix problem. - -105. 12/16/91 Fixed a few bugs in auto_mkindex proc: wasn't handling -errors properly, and hadn't been upgraded for new "regexp" syntax. - -106. 1/2/92 Fixed bug in "file" command where it didn't properly handle -a file names containing tildes where the indicated user doesn't exist. - -107. 1/2/92 Fixed lots of cases in tclUnixStr.c where two different -errno symbols (e.g. EWOULDBLOCK and EAGAIN) have the same number; Tcl -will only use one of them. - -108. 1/2/92 Lots of changes to configuration script to handle many more -systems more gracefully. E.g. should now detect the bogus strtoul that -comes with AIX and substitute Tcl's own version instead. - ------------------ Released version 6.2, 1/10/92 ------------------ - -109. 1/20/92 Config didn't have code to actually use "uid_t" variable -to set TCL_UIT_T #define. - -110. 2/10/92 Tcl_Eval didn't properly reset "numLevels" variable when -too-deep recursion occurred. - -111. 2/29/92 Added "on" and "off" to keywords accepted by Tcl_GetBoolean. - -112. 3/19/92 Config wasn't installing default version of strtod.c for -systems that don't have one in libc.a. - -113. 3/23/92 Fixed bug in tclExpr.c where numbers with leading "."s, -like 0.75, couldn't be properly substituted into expressions with -variable or command substitution. - -114. 3/25/92 Fixed bug in tclUnixAZ.c where "gets" command wasn't -checking to make sure that it was able to write the variable OK. - -115. 4/16/92 Fixed bug in tclUnixAZ.c where "read" command didn't -compute file size right for device files. - -116. 4/23/92 Fixed but in tclCmdMZ.c where "trace vinfo" was overwriting -the trace command. - ------------------ Released version 6.3, 5/1/92 ------------------ - -117. 5/1/92 Added Tcl_GlobalEval. - -118. 6/1/92 Changed auto-load facility to source files at global level. - -119. 6/8/92 Tcl_ParseVar wasn't always setting termPtr after errors, which -sometimes caused core dumps. - -120. 6/21/92 Fixed bug in initialization of regexp pattern cache. This -bug caused segmentation violations in regexp commands under some conditions. - -121. 6/22/92 Changed implementation of "glob" command to eliminate -trailing slashes on directory names: they confuse some systems. There -shouldn't be any user-visible changes in functionality except for names -in error messages not having trailing slashes. - -122. 7/2/92 Fixed bug that caused 'string match ** ""' to return 0. - -123. 7/2/92 Fixed bug in Tcl_CreateCmdBuf where it wasn't initializing -the buffer to an empty string. - -124. 7/6/92 Fixed bug in "case" command where it used NULL pattern string -after errors in the "default" clause. - -125. 7/25/92 Speeded up auto_load procedure: don't reread all the index -files unless the path has changed. - -126. 8/3/92 Changed tclUnix.h to define MAXPATHLEN from PATH_MAX, not -_POSIX_PATH_MAX. - ------------------ Released version 6.4, 8/7/92 ------------------ - -127. 8/10/92 Changed tclBasic.c so that comment lines can be continued by -putting a backslash before the newline. - -128. 8/21/92 Modified "unknown" to allow the source-ing of a file for -an auto-load to trigger other nested auto-loads, as long as there isn't -any recursion on the same command name. - -129. 8/25/92 Modified "format" command to allow " " and "+" flags, and -allow flags in any order. - -130. 9/14/92 Modified Tcl_ParseVar so that it doesn't actually attempt -to look up the variable if "noEval" mode is in effect in the interpreter -(it just parses the name). This avoids the errors that used to occur -in statements like "expr {[info exists foo] && $foo}". - -131. 9/14/92 Fixed bug in "uplevel" command where it didn't output the -correct error message if a level was specified but no command. - -132. 9/14/92 Renamed manual entries to have extensions like .3 and .n, -and added "install" target to Makefile. - -133. 9/18/92 Modified "unknown" command to emulate !!, !, and -^^ csh history substitutions. - -134. 9/21/92 Made the config script cleverer about figuring out which -switches to pass to "nm". - -135. 9/23/92 Fixed tclVar.c to be sure to copy flags when growing variables. -Used to forget about traces in progress and make extra recursive calls -on trace procs. - -136. 9/28/92 Fixed bug in auto_reset where it was unsetting variables -that might not exist. - -137. 10/7/92 Changed "parray" library procedure to print any array -accessible to caller, local or global. - -138. 10/15/92 Fixed bug where propagation of new environment variable -values among interpreters took N! time if there exist N interpreters. - -139. 10/16/92 Changed auto_reset procedure so that it also deletes any -existing procedures that are in the auto_load index (the assumption is -that they should be re-loaded to get the latest versions). - -140. 10/21/92 Fixed bug that caused lists to be incorrectly generated -for elements that contained backslash-newline sequences. - -141. 12/9/92 Added support for TCL_LIBRARY environment variable: use -it as library location if it's present. - -142. 12/9/92 Added "info complete" command, Tcl_CommandComplete procedure. - -143. 12/16/92 Changed the Makefile to check to make sure "config" has been -run (can't run config directly from the Makefile because it modifies the -Makefile; thus make has to be run again after running config). - ------------------ Released version 6.5, 12/17/92 ------------------ - -144. 12/21/92 Changed config to look in several places for libc file. - -145. 12/23/92 Added "elseif" support to if. Also, "then", "else", and -"elseif" may no longer be abbreviated. -*** POTENTIAL INCOMPATIBILITY *** - -146. 12/28/92 Changed "puts" and "read" to support initial "-nonewline" -switch instead of additional "nonewline" argument. The old form is -still supported, but it is discouraged and is no longer documented. -Also changed "puts" to make the file argument default to stdout: e.g. -"puts foo" will print foo on standard output. - -147. 1/6/93 Fixed bug whereby backslash-newline wasn't working when -typed interactively, or in "info complete". - -148. 1/22/93 Fixed bugs in "lreplace" and "linsert" where close -quotes were being lost from last element before replacement or -insertion. - -149. 1/29/93 Fixed bug in Tcl_AssembleCmd where it wasn't requiring -a newline at the end of a line before considering a command to be -complete. The bug caused some very long lines in script files to -be processed as multiple separate commands. - -150. 1/29/93 Various changes in Makefile to add more configuration -options, simplify installation, fix bugs (e.g. don't use -f switch -for cp), etc. - -151. 1/29/93 Changed "name1" and "name2" identifiers to "part1" and -"part2" to avoid name conflicts with stupid C++ implementations that -use "name1" and "name2" in a reserved way. - -152. 2/1/93 Added "putenv" procedure to replace the standard system -version so that it will work correctly with Tcl's environment handling. - ------------------ Released version 6.6, 2/5/93 ------------------ - -153. 2/10/93 Fixed bugs in config script: missing "endif" in libc loop, -and tried to use strncasecmp.c instead of strcasecmp.c. - -154. 2/10/93 Makefile improvements: added RANLIB variable for easier -Sys-V configuration, added SHELL variable for SGI systems. - ------------------ Released version 6.7, 2/11/93 ------------------ - -153. 2/6/93 Changes in backslash processing: - - \Cx, \Mx, \CMx, \e sequences no longer special - - \ also eats up any space after the newline, replacing - the whole sequence with a single space character - - Hex sequences like \x24 are now supported, along with ANSI C's \a. - - "format" no longer does backslash processing on its format string - - there is no longer any special meaning to a 0 return value from - Tcl_Backslash - - unknown backslash sequences, like (e.g. \*), are replaced with - the following character (e.g. *), instead of just treating the - backslash as an ordinary character. -*** POTENTIAL INCOMPATIBILITY *** - -154. 2/6/93 Updated all copyright notices. The meaning hasn't changed -at all but the wording does a better job of protecting U.C. from -liability (according to U.C. lawyers, anyway). - -155. 2/6/93 Changed "regsub" so that it overwrites the result variable -in all cases, even if there is no match. -*** POTENTIAL INCOMPATIBILITY *** - -156. 2/8/93 Added support for XPG3 %n$ conversion specifiers to "format" -command. - -157. 2/17/93 Fixed bug in Tcl_Eval where errors due to infinite -recursion could result in core dumps. - -158. 2/17/93 Improved the auto-load mechanism to deal gracefully (i.e. -return an error) with a situation where a library file that supposedly -defines a procedure doesn't actually define it. - -159. 2/17/93 Renamed Tcl_UnixError procedure to Tcl_PosixError, and -changed errorCode variable usage to use POSIX as keyword instead of -UNIX. -*** POTENTIAL INCOMPATIBILITY *** - -160. 2/19/93 Changes to exec and process control: - - Added support for >>, >&, >>&, |&, <@, >@, and >&@ forms of redirection. - - When exec puts processes into background, it returns a list of - their pids as result. - - Added support for file, etc. (i.e. no space between - ">" and file name. - - Added -keepnewline option. - - Deleted Tcl_Fork and Tcl_WaitPids procedures (just use fork and - waitpid instead). - - Added waitpid compatibility procedure for systems that don't have - it. - - Added Tcl_ReapDetachedProcs procedure. - - Changed "exec" to return an error if there is stderr output, even - if the command returns a 0 exit status (it's always been documented - this way, but the implementation wasn't correct). - - If a process returns a non-zero exit status but doesn't generate - any diagnostic output, then Tcl generates an error message for it. -*** POTENTIAL INCOMPATIBILITY *** - -161. 2/25/93 Fixed two memory-management problems having to do with -managing the old result during variable trace callbacks. - -162. 3/1/93 Added dynamic string library: Tcl_DStringInit, Tcl_DStringAppend, -Tcl_DStringFree, Tcl_DStringResult, etc. - -163. 3/1/93 Modified glob command to only return the names of files that -exist, and to only return names ending in "/" if the file is a directory. -*** POTENTIAL INCOMPATIBILITY *** - -164. 3/19/93 Modified not to use system calls like "read" directly, -but instead to use special Tcl procedures that retry automatically -if interrupted by signals. - -165. 4/3/93 Eliminated "noSep" argument to Tcl_AppendElement, plus -TCL_NO_SPACE flag for Tcl_SetVar and Tcl_SetVar2. -*** POTENTIAL INCOMPATIBILITY *** - -166. 4/3/93 Eliminated "flags" and "termPtr" arguments to Tcl_Eval. -*** POTENTIAL INCOMPATIBILITY *** - -167. 4/3/93 Changes to expressions: - - The "expr" command now accepts multiple arguments, which are - concatenated together with space separators. - - Integers aren't automatically promoted to floating-point if they - overflow the word size: errors are generated instead. - - Tcl can now handle "NaN" and other special values if the underlying - library procedures handle them. - - When printing floating-point numbers, Tcl ensures that there is a "." - or "e" in the number, so it can't be treated as an integer accidentally. - The procedure Tcl_PrintDouble is available to provide this function - in other contexts. Also, the variable "tcl_precision" can be used - to set the precision for printing (must be a decimal number giving - digits of precision). - - Expressions now support transcendental and other functions, e.g. sin, - acos, hypot, ceil, and round. Can add new math functions with - Tcl_CreateMathFunc(). - - Boolean expressions can now have any of the string values accepted - by Tcl_GetBoolean, such as "yes" or "no". -*** POTENTIAL INCOMPATIBILITY *** - -168. 4/5/93 Changed Tcl_UnsetVar and Tcl_UnsetVar2 to return TCL_OK -or TCL_ERROR instead of 0 or -1. -*** POTENTIAL INCOMPATIBILITY *** - -169. 4/5/93 Eliminated Tcl_CmdBuf structure and associated procedures; -can use Tcl_DStrings instead. -*** POTENTIAL INCOMPATIBILITY *** - -170. 4/8/93 Changed interface to Tcl_TildeSubst to use a dynamic -string for buffer space. This makes the procedure re-entrant and -thread-safe, whereas it wasn't before. -*** POTENTIAL INCOMPATIBILITY *** - -171. 4/14/93 Eliminated tclHash.h, and moved everything from it to -tcl.h -*** POTENTIAL INCOMPATIBILITY *** - -172. 4/15/93 Eliminated Tcl_InitHistory, made "history" command always -be part of interpreter. -*** POTENTIAL INCOMPATIBILITY *** - -173. 4/16/93 Modified "file" command so that "readable" option always -exists, even on machines that don't support symbolic links (always returns -same error as if the file wasn't a symbolic link). - -174. 4/26/93 Fixed bugs in "regsub" where ^ patterns didn't get handled -right (pretended not to match when it really did, and looped infinitely -if -all was specified). - -175. 4/29/93 Various improvements in the handling of variables: - - Can create variables and array elements during a read trace. - - Can delete variables during traces (note: unset traces will be - invoked when this happens). - - Can upvar to array elements. - - Can retarget an upvar to another variable by re-issuing the - upvar command with a different "other" variable. - -176. 5/3/93 Added Tcl_GetCommandInfo, which returns info about a Tcl -command such as whether it exists and its ClientData. Also added -Tcl_SetCommandInfo, which allows any of this information to be modified -and also allows a command's delete procedure to have a different -ClientData value than its command procedure. - -177. 5/5/93 Added Tcl_RegExpMatch procedure. - -178. 5/6/93 Fixed bug in "scan" where it didn't properly handle -%% conversion specifiers. Also changed "scan" to use Tcl_PrintDouble -for printing real values. - -179. 5/7/93 Added "-exact", "-glob", and "-regexp" options to "lsearch" -command to allow different kinds of pattern matching. - -180. 5/7/93 Added many new switches to "lsort" to control the sorting -process: "-ascii", "-integer", "-real", "-command", "-increasing", -and "-decreasing". - -181. 5/10/93 Changes to file I/O: - - Modified "open" command to support a list of POSIX access flags - like {WRONLY CREAT TRUNC} in addition to current fopen-style - access modes. Also added "permissions" argument to set permissions - of newly-created files. - - Fixed Scott Bolte's bug (can close stdin etc. in application and - then re-open them with Tcl commands). - - Exported access to Tcl's file table with new procedures Tcl_EnterFile - and Tcl_GetOpenFile. - -182. 5/15/93 Added new "pid" command, which can be used to retrieve -either the current process id or a list of the process ids in a -pipeline opened with "open |..." - -183. 6/3/93 Changed to use GNU autoconfig for configuration instead of -the home-brew "config" script. Also made many other configuration-related -changes, such as using instead of explicitly declaring system -calls in tclUnix.h. - -184. 6/4/93 Fixed bug where core-dumps could occur if a procedure -redefined itself (the memory for the procedure's body could get -reallocated in the middle of evaluating the body); implemented -simple reference count mechanism. - -185. 6/5/93 Changed tclIndex file format in two ways: (a) it's now -eval-ed instead of parsed, which makes it 3-4x faster; (b) the entries -in auto_index are now commands to evaluate, which allows commands to -be loaded in different ways such as dynamic-loading of C code. The -old tclIndex file format is still supported. - -186. 6/7/93 Eliminated tclTest program, added new "tclsh" program -that is more like wish (allows script files to be invoked automatically -using "#!/usr/local/bin/tclsh", makes arguments available to script, -etc.). Added support for Tcl_AppInit plus default version; this -allows new Tcl applications to be created without modifying the -main program for tclsh. - -187. 6/7/93 Fixed bug in TclWordEnd that kept backslash-newline from -working correctly in some cases during interactive input. - -188. 6/9/93 Added Tcl_LinkVar and related procedures, which automatically -keep a Tcl variable in sync with a C variable. - -189. 6/16/93 Increased maximum nesting depth from 100 to 1000. - -190. 6/16/93 Modified "trace var" command so that error messages from -within traces are returned properly as the result of the variable -access, instead of the generic "access disallowed by trace command" -message. - -191. 6/16/93 Added Tcl_CallWhenDeleted to provide callbacks when an -interpreter is deleted (same functionality as Tcl_WatchInterp, which -used to exist in versions before 6.0). - -193. 6/16/93 Added "-code" argument to "return" command; it's there -primarily for completeness, so that procedures implementing control -constructs can reflect exceptional conditions back to their callers. - -194. 6/16/93 Split up Tcl.n to make separate manual entries for each -Tcl command. Tcl.n now contains a summary of the language syntax. - -195. 6/17/93 Added new "switch" command to replace "case": allows -alternate forms of pattern matching (exact, glob, regexp), replaces -pattern lists with single patterns (but you can use "-" bodies to -share one body among several patterns), eliminates "in" noise word. -"Case" command is now obsolete. - -196. 6/17/93 Changed the "exec", "glob", "regexp", and "regsub" commands -to include a "--" switch. All initial arguments starting with "-" are now -treated as switches unless a "--" switch is present to end the list. -*** POTENTIAL INCOMPATIBILITY *** - -197. 6/17/93 Changed auto-exec so that the subprocess gets stdin, stdout, -and stderr from the parent. This allows truly interactive sub-processes -(e.g. vi) to be auto-exec'ed from a tcl shell command line. - -198. 6/18/93 Added patchlevel.h, for use in coordinating future patch -releases, and also added "info patchlevel" command to make the patch -level available to Tcl scripts. - -199. 6/19/93 Modified "glob" command so that a leading "//" in a name -gets left as is (this is needed for systems like Apollos where "//" is -the super-root; Tcl used to collapse the two slashes into a single -slash). - -200. 7/7/93 Added Tcl_SetRecursionLimit procedure so that the maximum -allowable nesting depth can be controlled for an interpreter from C. - ------------------ Released version 7.0 Beta 1, 7/9/93 ------------------ - -201. 7/12/93 Modified Tcl_GetInt and tclExpr.c so that full-precision -unsigned integers can be specified without overflow errors. - -202. 7/12/93 Configuration changes: eliminate leading blank line in -configure script; provide separate targets in Makefile for installing -binary and non-binary information; check for size_t and a few other -potentially missing typedefs; don't put tclAppInit.o into libtcl.a; -better checks for matherr support. - -203. 7/14/93 Changed tclExpr.c to check the termination pointer before -errno after strtod calls, to avoid problems with some versions of -strtod that set errno in unexpected ways. - -204. 7/16/93 Changed "scan" command to be more ANSI-conformant: -eliminated %F, %D, etc., added code to ignore "l", "h", and "L" -modifiers but always convert %e, %f, and %g with implicit "l"; -also added support for %u and %i. Also changed "format" command -to eliminate %D, %U, %O, and add %i. -*** POTENTIAL INCOMPATIBILITY *** - -205. 7/17/93 Changed "uplevel" and "upvar" so that they can be used -from global level to global level: this used to generate an error. - -206. 7/19/93 Renamed "setenv", "putenv", and "unsetenv" procedures -to avoid conflicts with system procedures with the same names. If -you want Tcl's procedures to override the system procedures, do it -in the Makefile (instructions are in the Makefile). -*** POTENTIAL INCOMPATIBILITY *** - ------------------ Released version 7.0 Beta 2, 7/21/93 ------------------ - -207. 7/21/93 Fixed bug in tclVar.c where freed memory was accidentally -used if a procedure returned an element of a local array. - -208. 7/22/93 Fixed bug in "unknown" where it didn't properly handle -errors occurring in the "auto_load" procedure, leaving its state -inconsistent. - -209. 7/23/93 Changed exec's ">2" redirection operator to "2>" for -consistency with sh. This is incompatible with earlier beta releases -of 7.0 but not with pre-7.0 releases, which didn't support either -operator. - -210. 7/28/93 Changed backslash-newline handling so that the resulting -space character *is* treated as a word separator unless the backslash -sequence is in quotes or braces. This is incompatible with 7.0b1 -and 7.0b2 but is more compatible with pre-7.0 versions that the b1 -and b2 releases were. - -211. 7/28/93 Eliminated Tcl_LinkedVarWritable, added TCL_LINK_READ_ONLY to -Tcl_LinkVar to accomplish same purpose. This change is incompatible -with earlier beta releases, but not with releases before Tcl 7.0. - -212. 7/29/93 Renamed regexp C functions so they won't clash with POSIX -regexp functions that use the same name. - -213. 8/3/93 Added "-errorinfo" and "-errorcode" options to "return" -command: these allow for much better handling of the errorInfo -and errorCode variables in some cases. - -214. 8/12/93 Changed "expr" so that % always returns a remainder with -the same sign as the divisor and absolute value smaller than the -divisor. - -215. 8/14/93 Turned off auto-exec in "unknown" unless the command -was typed interactively. This means you must use "exec" when -invoking subprocesses, unless it's a command that's typed interactively. -*** POTENTIAL INCOMPATIBILITY *** - -216. 8/14/93 Added support for tcl_prompt1 and tcl_prompt2 variables -to tclMain.c: makes prompts user-settable. - -217. 8/14/93 Added asynchronous handlers (Tcl_AsyncCreate etc.) so -that signals can be taken cleanly by Tcl applications. - -218. 8/16/93 Moved information about open files from the interpreter -structure to global variables so that a file can be opened in one -interpreter and read or written in another. - -219. 8/16/93 Removed ENV_FLAGS from Makefile, so that there's no -official support for overriding setenv, unsetenv, and putenv. - -220. 8/20/93 Various configuration improvements: coerce chars -to unsigned chars before using macros like isspace; source ~/.tclshrc -file during initialization if it exists and program is running -interactively; allow there to be directories in auto_path that don't -exist or don't have tclIndex files (ignore them); added Tcl_Init -procedure and changed Tcl_AppInit to call it. - -221. 8/21/93 Fixed bug in expr where "+", "-", and " " were all -getting treated as integers with value 0. - -222. 8/26/93 Added "tcl_interactive" variable to tclsh. - -223. 8/27/93 Added procedure Tcl_FilePermissions to return whether a -given file can be read or written or both. Modified Tcl_EnterFile -to take a permissions mask rather than separate read and write arguments. - -224. 8/28/93 Fixed performance bug in "glob" command (unnecessary call -to "access" for each file caused a 5-10x slow-down for big directories). - ------------------ Released version 7.0 Beta 3, 8/28/93 ------------------ - -225. 9/9/93 Renamed regexp.h to tclRegexp.h to avoid conflicts with system -include file by same name. - -226. 9/9/93 Added Tcl_DontCallWhenDeleted. - -227. 9/16/93 Changed not to call exit C procedure directly; instead -always invoke "exit" Tcl command so that application can redefine the -command to do additional cleanup. - -228. 9/17/93 Changed auto-exec to handle names that contain slashes -(i.e. don't use PATH for them). - -229. 9/23/93 Fixed bug in "read" and "gets" commands where they didn't -clear EOF conditions. - ------------------ Released version 7.0, 9/29/93 ------------------ - -230. 10/7/93 "Scan" command wasn't properly aligning things in memory, -so segmentation faults could arise under some circumstances. - -231. 10/7/93 Fixed bug in Tcl_ConvertElement where it forgot to -backslash leading curly brace when creating lists. - -232. 10/7/93 Eliminated dependency of tclMain.c on tclInt.h and -tclUnix.h, so that people can copy the file out of the Tcl source -directory to make modified private versions. - -233. 10/8/93 Fixed bug in auto-loader that reversed the priority order -of entries in auto_path for new-style index files. Now things are -back to the way they were before 3.0: first in auto_path is always -highest priority. - -234. 10/13/93 Fixed bug where Tcl_CommandComplete didn't recognize -comments and treat them as such. Thus if you typed the line - # { -interactively, Tcl would think that the command wasn't complete and -wait for more input before evaluating the script. - -235. 10/14/93 Fixed bug where "regsub" didn't set the output variable -if the input string was empty. - -236. 10/23/93 Fixed bug where Tcl_CreatePipeline didn't close off enough -file descriptors in child processes, causing children not to exit -properly in some cases. - -237. 10/28/93 Changed "list" and "concat" commands not to generate -errors if given zero arguments, but instead to just return an empty -string. - ------------------ Released version 7.1, 11/4/93 ------------------ - -Note: there is no 7.2 release. It was flawed and was thus withdrawn -shortly after it was released. - -238. 11/10/93 TclMain.c didn't compile on some systems because of -R_OK in call to "access". Changed to eliminate call to "access". - ------------------ Released version 7.3, 11/26/93 ------------------ - -239. 11/6/93 Modified "lindex", "linsert", "lrange", and "lreplace" -so that "end" can be specified as an index. - -240. 11/6/93 Modified "append" and "lappend" to allow only two -words total (i.e., nothing to append) without generating an error. - -241. 12/2/93 Changed to use EAGAIN as the errno for non-blocking -I/O instead of EWOULDBLOCK: this should fix problem where non-blocking -I/O didn't work correctly on System-V systems. - -242. 12/22/93 Fixed bug in expressions where cancelled evaluation -wasn't always working correctly (e.g. "set one 1; eval {1 || 1/$one}" -failed with a divide by zero error). - -243. 1/6/94 Changed TCL_VOLATILE definition from -1 to the address of -a dummy procedure Tcl_Volatile, since -1 causes portability problems on -some machines (e.g., Crays). - -244. 2/4/94 Added support for unary plus. - -245. 2/17/94 Changed Tcl_RecordAndEval and "history" command to -call Tcl_GlobalEval instead of Tcl_Eval. Otherwise, invocation of -these facilities in nested procedures can cause unwanted results. - -246. 2/17/94 Fixed bug in tclExpr.c where an expression such as -"expr {"12398712938788234-1298379" != ""}" triggers an integer -overflow error for the number in quotes, even though it isn't really -a proper integer anyway. - -247. 2/19/94 Added new procedure Tcl_DStringGetResult to move result -from interpreter to a dynamic string. - -248. 2/19/94 Fixed bug in Tcl_DStringResult that caused it to overwrite -the contents of a static result in some situations. This can cause -bizarre errors such as variables suddenly having empty values. - -249. 2/21/94 Fixed bug in Tcl_AppendElement, Tcl_DStringAppendElement, -and the "lappend" command that caused improper omission of a separator -space in some cases. For example, the script - set x "abc{"; lappend x "def" -used to return the result "abc{def" instead of "abc{ def". - -250. 3/3/94 Tcl_ConvertElement was outputting empty elements as \0 if -TCL_DONT_USE_BRACES was set. This depends on old pre-7.0 meaning of -\0, which is no longer in effect, so it didn't really work. Changed -to output empty elements as {} always. - -251. 3/3/94 Renamed Tcl_DStringTrunc to Tcl_DStringSetLength and extended -it so that it can be used to lengthen a string as well as shorten it. -Tcl_DStringTrunc is defined as a macro for backward compatibility, but -it is deprecated. - -252. 3/3/94 Added Tcl_AllowExceptions procedure. - -253. 3/13/94 Fixed bug in Tcl_FormatCmd that could cause "format" -to mis-behave on 64-bit Big-Endian machines. - -254. 3/13/94 Changed to use vfork instead of fork on systems where -vfork exists. - -255. 3/23/94 Fixed bug in expressions where ?: didn't associate -right-to-left as they should. - -256. 4/3/94 Fixed "exec" to flush any files used in >@ or >&@ -redirection in exec, so that data buffered for them is written -before any new data added by the subprocess. - -257. 4/3/94 Added "subst" command. - -258. 5/20/94 The tclsh main program is now called Tcl_Main; tclAppInit.c -has a "main" procedure that calls Tcl_Main. This makes it easier to use -Tcl with C++ programs, which need their own main programs, and it also -allows an application to prefilter the argument list before calling -Tcl_Main. -*** POTENTIAL INCOMPATIBILITY *** - -259. 6/6/94 Fixed bug in procedure returns where the errorInfo variable -could get truncated if an unset trace was invoked as part of returning -from the procedure. - -260. 6/13/94 Added "wordstart" and "wordend" options to "string" command. - -261. 6/27/94 Fixed bug in expressions where they didn't properly cancel -the evaluation of math functions in &&, ||, and ?:. - -262. 7/11/94 Incorrect boolean values, like "ogle", weren't being -handled properly. - -263. 7/15/94 Added Tcl_RegExpCompile, Tcl_RegExpExec, and Tcl_RegExpRange, -which provide lower-level access to regular expression pattern matching. - -264. 7/22/94 Fixed bug in "glob" command where "glob -nocomplain ~bad_user" -would complain about a missing user. Now it doesn't complain anymore. - -265. 8/4/94 Fixed bug with linked variables where they didn't behave -correctly when accessed via upvars. - -266. 8/17/94 Fixed bug in Tcl_EvalFile where it didn't clear interp->result. - -267. 8/31/94 Modified "open" command so that errors in exec-ing -subprocesses are returned by the open immediately, rather than -being delayed until the "close" is executed. - -268. 9/9/94 Modified "expr" command to generate errors for integer -overflow (includes addition, subtraction, negation, multiplication, -division). - -269. 9/23/94 Modified "regsub" to return a count of the number of -matches and replacements, rather than 0/1. - -279. 10/4/94 Added new features to "array" command: - - added "get" and "set" commands for easy conversion between arrays - and lists. - - added "exists" command to see if a variable is an array, changed - "names" and "size" commands to treat a non-existent array (or scalar - variable) just like an empty one. - - added pattern option to "names" command. - -280. 10/6/94 Modified Tcl_SetVar2 so that read traces on variables get -called during append operations. - -281. 10/20/94 Fixed bug in "read" command where reading from stdin -required two control-D's to stop the reading. - -282. 11/3/94 Changed "expr" command to use longs for division just like -all other expr operators; it previously used ints for division. - -283. 11/4/94 Fixed bugs in "unknown" procedure: it wasn't properly -handling exception returns from commands that were executed after -being auto-loaded. - ------------------ Released version 7.4b1, 12/23/94 ------------------ - -284. 12/26/94 Fixed "install" target in Makefile (couldn't always -find install program). - -285. 12/26/94 Added strcncasecmp procedure to compat directory. - -286. 1/3/95 Fixed all procedure calls to explicitly cast arguments: -implicit conversions from prototypes (especially integer->double) -don't work when compiling under non-ANSI compilers. Tcl is now clean -under gcc -Wconversion. - -287. 1/4/95 Fixed problem in Tcl_ArrayCmd where same name was used for -both a label and a variable; caused problems on several older compilers, -making array command misbehave and causing many errors in Tcl test suite. - ------------------ Released version 7.4b2, 1/12/95 ------------------ - -288. 2/9/95 Modified Tcl_CreateCommand to return a token, and added -Tcl_GetCommandName procedure. Together, these procedures make it possible -to track renames of a command. - -289. 2/13/95 Fixed bug in expr where "089" was interpreted as a -floating-point number rather than a bogus octal number. -*** POTENTIAL INCOMPATIBILITY *** - -290. 2/14/95 Added code to Tcl_GetInt and Tcl_GetDouble to check for -overflows when reading in numbers. - -291. 2/18/95 Changed "array set" to stop after first error, rather than -continuing after error. - -292. 2/20/95 Upgraded to use autoconf version 2.2. - -293. 2/20/95 Fixed core dump that could occur in "scan" command if a -close bracket was omitted. - -294. 2/27/95 Changed Makefile to always use install-sh for installations: -there's just too much variation among "install" system programs, which -makes installation flakey. - ------------------ Released version 7.4b3, 3/24/95 ------------------ - -3/25/95 (bug fix) Changed "install" to "./install" in Makefile so that -"make install" will work even when "." isn't in the search path. - -3/29/95 (bug fix) Fixed bug where the auto-loading mechanism wasn't -protecting the values of the errorCode and errorInfo variables. - -3/29/95 (new feature) Added optional pattern argument to "parray" procedure. - -3/29/95 (bug fix) Made the full functionality of - "return -code ... -errorcode ..." -work not just inside procedures, but also in sourced files and at -top level. - -4/6/95 (new feature) Added "pattern" option to "array names" command. - -4/18/95 (bug fix) Fixed bug in parser where it didn't allow backslash-newline -immediately after an argument in braces or quotes. - -4/19/95 (new feature) Added tcl_library variable, which application can -set to override default library directory. - -4/30/95 (bug fix) During trace callbacks for array elements, the variable -name used in the original reference would be temporarily modified to -separate the array name and element name; if the trace callback used -the same name string, it would get the wrong name (the array name without -element). Fixed to restore the variable name before making trace -callbacks. - -4/30/95 (new feature) Added -nobackslashes, -nocommands, and -novariables -switches to "subst" command. - -5/4/95 (new feature) Added TCL_EVAL_GLOBAL flag to Tcl_RecordAndEval. - -5/5/95 (bug fix) Format command would overrun memory when printing -integers with very large precision, as in "format %.1000d 0". - -5/5/95 (portability improvement) Changed to use BSDgettimeofday on -IRIX machines, to avoid compilation problems with the gettimeofday -declaration. - -5/6/95 (bug fix) Changed manual entries to use the standard .TH -macro instead of a custom .HS macro; the .HS macro confuses index -generators like makewhatis. - -5/9/95 (bug fix) Modified configure script to check for Solaris bug -that makes vfork unreliable (core dumps result if vforked child -changes a signal handler); will use fork instead of vfork if the -bug is present. - -6/5/95 (bug fix) Modified "lsort" command to disallow recursive calls -to lsort from a comparison function. This is needed because qsort -is not reentrant. - -6/5/95 (bug fix) Undid change 243 above: changed TCL_VOLATILE and -TCL_DYNAMIC back to integer constants rather than procedure addresses. -This was needed because procedure addresses can have multiple values -under some dynamic loading systems (e.g. SunOS 4.1 and Windows). - -6/8/95 (feature change) Modified interface to Tcl_Main to pass in the -address of the application-specific initialization procedure. -Tcl_AppInit is no longer hardwired into Tcl_Main. This is needed -in order to make Tcl a shared library. - -6/8/95 (feature change) Modified Makefile so that the installed versions -of tclsh and libtcl.a have version number in them (e.g. tclsh7.4 and -libtcl7.4.a) and the library directory name also has an embedded version -number (e.g., /usr/local/lib/tcl7.4). This should make it easier for -Tcl 7.4 to coexist with earlier versions. - ------------------ Released version 7.4b4, 6/16/95 ------------------ - -6/19/95 (bug fix) Fixed bugs in tclCkalloc.c that caused core dumps -if TCL_MEM_DEBUG was enabled on word-addressed machines such as Crays. - -6/21/95 (feature removal) Removed overflow checks for integer arithmetic: -they just cause too much trouble (e.g. for random number generators). - -6/28/95 (new features) Added tcl_patchLevel and tcl_version variables, -for consistency with Tk. - -6/29/95 (bug fix) Fixed problem in Tcl_Eval where it didn't record -the right termination character if a script ended with a comment. This -caused erroneous output for the following command, among others: -puts "[ -expr 1+1 -# duh! -]" - -6/29/95 (message change) Changed the error message for ECHILD slightly -to provide a hint about why the problem is occurring. - ------------------ Released version 7.4, 7/1/95 ------------------ - -7/18/95 (bug fix) Changed "lreplace" so that nothing is deleted if -the last index is less than the first index or if the last index -is < 0. - -7/18/95 (bug fix) Fixed bugs with backslashes in comments: -Tcl_CommandComplete (and "info complete") didn't properly handle -strings ending in backslash-newline, and neither Tcl_CommandComplete -nor the Tcl parser handled other backslash sequences right, such -as two backslashes before a newline. - -7/19/95 (bug fix) Modified Tcl_DeleteCommand to delete the hash table -entry for the command before invoking its callback. This is needed in -order to deal with reentrancy. - -7/22/95 (bug fix) "exec" wasn't reaping processes correctly after -certain errors (e.g. if the name of the executable was bogus, as -in "exec foobar"). - -7/27/95 (bug fix) Makefile.in wasn't using the LIBS variable provided -by the "configure" script. This caused problems on some SCO systems. - -7/27/95 (bug fix) The version of strtod in fixstrtod.c didn't properly -handle the case where endPtr == NULL. - ------------------ Released patch 7.4p1, 7/29/95 ----------------------- - -8/4/95 (bug fix) C-level trace callbacks for variables were sometimes -receiving the PART1_NOT_PARSED flag, which could cause errors in -subsequent Tcl library calls using the flags. (JO) - -8/4/95 (bug fix) Calls to toupper and tolower weren't using the -UCHAR macros, which caused trouble in non-U.S. locales. (JO) - -8/10/95 (new feature) Added the "load" command for dynamic loading of -binary packages, and the Tcl_PackageInitProc prototype for package -initialization procedures. (JO) - -8/23/95 (new features) Added "info sharedlibextension" and -"info nameofexecutable" commands, plus Tcl_FindExtension procedure. (JO) - -8/25/95 (bug fix) If the target of an "upvar" was non-existent but -had traces set, the traces were silently lost. Change to generate -an error instead. (JO) - -8/25/95 (bug fix) Undid change from 7/19, so that commands can stay -around while their deletion callbacks execute. Added lots of code to -handle all of the reentrancy problems that this opens up. (JO) - -8/25/95 (bug fix) Fixed core dump that could occur in TclDeleteVars -if there was an upvar from one entry in the table to the next entry -in the same table. (JO) - -8/28/95 (bug fix) Exec wasn't handling bad user names properly, as -in "exec ~bogus_user/foo". (JO) - -8/29/95 (bug fixes) Changed backslash-newline handling to correct two -problems: - - Only spaces and tabs following the backslash-newline are now - absorbed as part of the backslash-newline. Newlinew are no - longer absorbed (add another backslash if you want to absorb - another newline). - - TclWordEnd returns the character just before the backslash in - the sequence as the end of the sequence; it used to not consider - the backslash-newline as a word separator. (JO) - -8/31/95 (new feature) Changed man page installation (with "mkLinks" -script) to create additional links for manual pages corresponding to -each of the procedure and command names described in the pages. (JO) - -9/10/95 Reorganized Tcl sources for Windows and Mac ports. All sources -are now in subdirectories: "generic" contains sources that work on all -platforms, "windows", "mac", and "unix" directories contain platform- -specific sources. Some UNIX sources are also used on other platforms. (SS) - -9/10/95 (feature change) Eliminated exported global variables (they -don't work with Windows DLLs). Replaced tcl_AsyncReady and -tcl_FileCloseProc with procedures Tcl_AsyncReady() and -Tcl_SetFileCloseProc(). Replaced C variable tcl_RcFileName with -a Tcl variable tcl_rcFileName. (SS) -*** POTENTIAL INCOMPATIBILITY *** - -9/11/95 (new feature) Added procedure Tcl_SetPanicProc to override -the default implementation of "panic". (SS) - -9/11/95 (new feature) Added "interp" command to allow creation of -new interpreters and execution of untrusted scripts. Added many new -procedures, such as Tcl_CreateSlave, Tcl_CreateAlias,and Tcl_MakeSafe, -to provide C-level access to the interpreter facility. This mechanism -now provides almost all of the generic functions of Borenstein's and -Rose's Safe-Tcl (but not any Tk or email-related stuff). (JL) - -9/11/95 (feature change) Changed file management so that files are -no longer shared between interpreters: a file cannot normally be -referenced in one interpreter if it was opened in another. This -feature is needed to support safe interpreters. Added Tcl_ShareHandle() -procedure for allowing files to be shared, and added "interp" argument -to Tcl_FilePermissions procedure. (JL) -*** POTENTIAL INCOMPATIBILITY *** - -9/11/95 (new feature) Added "AssocData" mechanism, whereby extensions -can associate their own data with an interpreter and get called back -when the interpreter is deleted. This is visible at C level via the -procedures Tcl_SetAssocData and Tcl_GetAssocData. (JL) - -9/11/95 (new feature) Added Tcl_ErrnoMsg to translate an errno value -into a human-readable string. This is now used instead of calling -strerror because strerror mesages vary dramatically from platform -to platform, which messes up Tcl tests. Tcl_ErrnoMsg uses the standard -POSIX messages for all the common signals, and calls strerror for -signals it doesn't understand. - ------------------ Released patch 7.4p2, 9/15/95 ----------------------- - ------------------ Released 7.5a1, 9/15/95 ----------------------- - -9/22/95 (bug fix) Changed auto_mkindex to create tclIndex files that -handle directories whose paths might contain spaces. (RJ) - -9/27/95 (bug fix) The "format" command didn't check for huge or negative -width specifiers, which could cause core dumps. (JO) - -9/27/95 (bug fix) Core dumps could occur if an interactive command typed -to tclsh returned a very long result for tclsh to print out. The bug is -actually in printf (in Solaris 2.3 and 2.4, at least); switched to use -puts instead. (JO) - -9/28/95 (bug fix) Changed makefile.bc to eliminate a false dependency -for tcl1675.dll on the Borland run time library. (SS) - -9/28/95 (bug fix) Fixed tcl75.dll so it looks for tcl1675.dll instead -of tcl16.dll. (SS) - -9/28/95 (bug fix) Tcl was not correctly detecting the difference -between Win32s and Windows '95. (SS) - -9/28/95 (bug fix) "exec" was not passing environment changes to child -processes under Windows. (SS) - -9/28/95 (bug fix) Changed Tcl to ensure that open files are not passed -to child processes under Windows. (SS) - -9/28/95 (bug fix) Fixed Windows '95 and NT versions of exec so it can -handle both console and windows apps. (SS) - -9/28/95 (bug fix) Fixed Windows version of exec so it no longer leaves -temp files lying around. Also changed it so the temp files are -created in the appropriate system dependent temp directory. (SS) - -9/28/95 (bug fix) Eliminated source dependency on the Win32s Universal -Thunk header file, since it is not bundled with VC++. (SS) - -9/28/95 (bug fix) Under Windows, Tcl now constructs the HOME -environment variable from HOMEPATH and HOMEDRIVE when HOME is not -already set. (SS) - -9/28/95 (bug fix) Added support for "info nameofexecutable" and "info -sharedlibextension" to the Windows version. (SS) - -9/28/95 (bug fix) Changed tclsh to correctly parse command line -arguments so that backslashes are preserved under Windows. (SS) - -9/29/95 (bug fix) Tcl 7.5a1 treated either return or newline as end -of line in "gets", which caused lines ending in CRLF to be treated as -two separate lines. Changed to allow only character as end-of-line: -carriage return on Macs, newline elsewhere. (JO) - -9/29/95 (new feature) Changed to install "configInfo" file in same -directory as library scripts. It didn't used to get installed. (JO) - -9/29/95 (bug fix) Tcl was not converting Win32 errors into POSIX -errors under some circumstances. (SS) - -10/2/95 (bug fix) Safe interpreters no longer get initialized with -a call to Tcl_Init(). (JL) - -10/1/95 (new feature) Added "tcl_platform" global variable to provide -environment information such as the instruction set and operating -system. (JO) - -10/1/95 (bug fix) "exec" command wasn't always generating the -"child process exited abnormally" message when it should have. (JO) - -10/2/95 (bug fix) Changed "mkLinks.tcl" so that the scripts it generates -won't create links that overwrite original manual entries (there was -a problem where pack-old.n was overwriting pack.n). (JO) - -10/2/95 (feature change) Changed to use -ldl for dynamic loading under -Linux if it is available, but fall back to -ldld if it isn't. (JO) - -10/2/95 (bug fix) File sharing was causing refcounts to reach 0 -prematurely for stdin, stdout and stderr, under some circumstances. (JL) - -10/2/95 (platform support) Added support for Visual C++ compiler on -Windows, Windows '95 and Windows NT, code donated by Gordon Chaffee. (JL) - -10/3/95 (bug fix) Tcl now frees any libraries that it loads before it -exits. (SS) - -10/03/95 (bug fix) Fixed bug in Macintosh ls command where the -l -and -C options would fail in anything but the HOME directory. (RJ) - ------------------ Released 7.5a2, 10/6/95 ----------------------- - -10/10/95 (bug fix) "file dirnam /." was returning ":" on UNIX instead -of "/". (JO) - -10/13/95 (bug fix) Eliminated dependency on MKS toolkit for generating -the tcl.def file from Borland object files. (SS) - -10/17/95 (new features) Moved the event loop from Tcl to Tk, made major -revisions along the way: - - New Tcl commands: after, update, vwait (replaces "tkwait variable"). - - "tkerror" is now replaced with "bgerror". - - The following procedures are similar to their old Tk counterparts: - Tcl_DoOneEvent, Tcl_Sleep, Tcl_DoWhenIdle, Tcl_CancelIdleCall, - Tcl_CreateFileHandler, Tcl_DeleteFileHandler, Tcl_CreateTimerHandler, - Tcl_DeleteTimerHandler, Tcl_BackgroundError. - - Revised notifier, add new concept of "event source" with the following - procedures: Tcl_CreateEventSource, Tcl_DeleteEventSource, - Tcl_WatchFile, Tcl_SetMaxBlockTime, Tcl_FileReady, Tcl_QueueEvent, - Tcl_WaitForEvent. (JO) - -10/31/95 (new features) Implemented cross platform file name support to make -it easier to write cross platform scripts. Tcl now understands 4 file naming -conventions: Windows (both DOS and UNC), Mac, Unix, and Network. The network -convention is a new naming mechanism that can be used to paths in a platform -independent fashion. See the "file" command manual page for more details. -The primary interfaces changes are: - - All Tcl commands that expect a file name now accept both network and - native form. - - Two new "file" subcommands, "nativename" and "networkname", provide a - way to convert between network and native form. - - Renamed Tcl_TildeSubst to Tcl_TranslateFileName, and changed it so that - it always returns a filename in native form. Tcl_TildeSubst is defined - as a macro for backward compatibility, but it is deprecated. (SS) - -11/5/95 (new feature) Made "tkerror" and "bgerror" synonyms, so that -either name can be used to manipulate the command (provides temporary -backward compatibility for existing scripts that use tkerror). (JO) - -11/5/95 (new feature) Added exit handlers and new C procedures -Tcl_CreateExitHandler, Tcl_DeleteExitHandler, and Tcl_Exit. (JO) - -11/6/95 (new feature) Added pid command for Macintosh version of -Tcl (it didn't previously exist on the Mac). (RJ) - -11/7/95 (new feature) New generic IO facility and support for IO to -files, pipes and sockets based on a common buffering scheme. Support -for asynchronous (non-blocking) IO and for event driver IO. Support -for automatic (background) asynchronous flushing and asynchronous -closing of channels. (JL) - -11/7/95 (new feature) Added new commands "fconfigure" and "fblocked" -to support new I/O features such as nonblocking I/O. Added "socket" -command for creating TCP client and server sockets. (JL). - -11/7/95 (new feature) Complete set of C APIs to the new generic IO -facility: - - Opening channels: Tcl_OpenFileChannel, Tcl_OpenCommandChannel, - Tcl_OpenTcpClient, Tcl_OpenTcpServer. - - I/O procedures on channels, which roughly mirror the ANSI C stdio - library: Tcl_Read, Tcl_Gets, Tcl_Write, Tcl_Flush, Tcl_Seek, - Tcl_Tell, Tcl_Close, Tcl_Eof, Tcl_InputBlocked, Tcl_GetChannelOption, - Tcl_SetChannelOption. - - Extension mechanism for creating new kinds of channels: - Tcl_CreateChannel, Tcl_GetChannelInstanceData, Tcl_GetChannelType, - Tcl_GetChannelName, Tcl_GetChannelFile, Tcl_RegisterChannel, - Tcl_UnregisterChannel, Tcl_GetChannel. - - Event-driven I/O on channels: Tcl_CreateChannelHandler, - Tcl_DeleteChannelHandler. (JL) - -11/7/95 (new feature) Channel driver interface specification to allow -new types of channels to be added easily to Tcl. Currently being used -in three drivers - for files, pipes and TCP-based sockets. (JL). - -11/7/95 (new feature) interp delete now takes any number of path -names of interpreters to delete, including zero. (JL). - -11/8/95 (new feature) implemented 'info hostname' and Tcl_GetHostName -command to get host name of machine on which the Tcl process is running. (JL) - -11/9/95 (new feature) Implemented file APIs for access to low level files -on each system. The APIs are: Tcl_CloseFile, Tcl_OpenFile, Tcl_ReadFile, -Tcl_WriteFile and Tcl_SeekFile. Also implemented Tcl_WaitPid which waits -in a system dependent manner for a child process. (JL) - -11/9/95 (new feature) Added Tcl_UpdateLinkedVar procedure to force a -Tcl variable to be updated after its C variable changes. (JO) - -11/9/95 (bug fix) The glob command has been totally reimplemented so -that it can support different file name conventions. It now handles -Windows file names (both UNC and drive-relative) properly. It also -supports nested braces correctly now. (SS) - -11/13/95 (bug fix) Fixed Makefile.in so that configure can be run -from a clean directory separate from the Tcl source tree, and compilations -can be performed there. (JO) - -11/14/95 (bug fix) Fixed file sharing between interpreters and file -transferring between interpreters to correctly manage the refcount so that -files are closed when the last reference to them is discarded. (JL) - -11/14/95 (bug fix) Fixed gettimeofday implementation for the -Macintosh. This fixes several timing related bugs. (RJ) - -11/17/95 (new feature) Added missing support for info nameofexecutable -on the Macintosh. (RJ) - -11/17/95 (bug fix) The Tcl variables argc argv and argv0 now return -something reasonable on the Mac. (RJ) - -11/22/95 (new feature) Implemented "auto-detect" mode for end of line -translations. On input, standalone "\r" mean MAC mode, standalone "\n" -mean Unix mode and "\r\n" means Windows mode. On output, the mode is -modified to whatever the platform specific mode for that platform is. (JL) - -11/24/95 (feature change) Replaced "configInfo" file with tclConfig.sh, -which is more complete and uses slightly different names. Also -arranged for tclConfig.sh to be installed in the platform-specific -library directory instead of Tcl's script library directory. (JO) -*** POTENTIAL INCOMPATIBILITY with Tcl 7.5a2, but not with Tcl 7.4 *** - ------------------ Released patch 7.4p3, 11/28/95 ----------------------- - -12/5/95 (new feature) Added Tcl_File facility to support platform- -independent file handles. Changed all interfaces that used Unix- -style integer fd's to use Tcl_File's instead. (SS) -*** POTENTIAL INCOMPATIBILITY *** - -12/5/95 (new feature) Added a new "clock" command to Tcl. The command -allows you to get the current "clicks" or seconds & allows you to -format or scan human readable time/date strings. (RJ) - -12/18/95 (new feature) Moved Tk_Preserve, Tk_Release, and Tk_EventuallyFree -to Tcl, renamed to Tcl_Preserve, Tcl_Release, and Tcl_EventuallyFree. (JO) - -12/18/95 (new feature) Added new "package" command and associated -procedures Tcl_PkgRequire and Tcl_PkgProvide. Also wrote -pkg_mkIndex library procedure to create index files from binaries -and scripts. (JO) - -12/20/95 (new feature) Added Tcl_WaitForFile procedure. (JO) - -12/21/95 (new features) Made package name argument to "load" optional -(Tcl will now attempt to guess the package name if necessary). Also -added Tcl_StaticPackage and support in "load" for statically linked -packages. (JO) - -12/22/95 (new feature) Upgraded the foreach command to accept multiple -loop variables and multiple value lists. This lets you iterate over -multiple lists in parallel, and/or assign multiple loop variables from -one value list during each iteration. The only potential compatibility -problem is with scripts that used loop variables with a name that could be -construed to be a list of variable names (i.e. contained spaces). (BW) - -1/5/96 (new feature) Changed tclsh so it builds as a console mode -application under Windows. Now tclsh can be used from the command -line with pipes or interactively. Note that this only works under -Windows 95 or NT. (SS) - -1/17/96 (new feature) Modified Makefile and configure script to allow -Tcl to be compiled as a shared library: use the --enable-shared option -when configuing. (JO) - -1/17/96 (removed obsolete features) Removed the procedures Tcl_EnterFile -and Tcl_GetOpenFile: these no longer make sense with the new I/O system. (JL) -*** POTENTIAL INCOMPATIBILITY *** - -1/19/96 (bug fixes) Prevented formation of circular aliases, through the -Tcl 'interp alias' command and through the 'rename' command, as well as -through the C API Tcl_CreateAlias. (JL) - -1/19/96 (bug fixes) Fixed several bugs in direct deletion of interpreters -with Tcl_DeleteInterp when the interpreter is a slave; fixes based on a -patch received from Viktor Dukhovni of ESM. (JL) - -1/19/96 (new feature) Implemented on-close handlers for channels; added -the C APIs Tcl_CreateCloseHandler and Tcl_DeleteCloseHandler. (JL) - -1/19/96 (new feature) Implemented portable error reporting mechanism; added -the C APIs Tcl_SetErrno and Tcl_GetErrno. (JL) - -1/24/96 (bug fix) Unknown command processing properly invokes external -commands under Windows NT and Windows '95 now. (SS) - -1/23/96 (bug fix) Eliminated extremely long startup times under Windows '95. -The problem was a result of the option database initialization code that -concatenated $HOME with /.Xdefaults, resulting in a // in the middle of the -file name. Under Windows '95, this is incorrectly interpreted as a UNC -path. They delays came from the network timeouts needed to determine that -the file name was invalid. Tcl_TranslateFileName now suppresses duplicate -slashes that aren't at the beginning of the file name. (SS) - -1/25/96 (bug fix) Changed exec and open to create children so they are -attached to the application's console if it exists. (SS) - -1/31/96 (bug fix) Fixed command line parsing to handle embedded -spaces under Windows. (SS) - ------------------ Released 7.5b1, 2/1/96 ----------------------- - -2/7/96 (bug fix) Fixed off by one error in argument parsing code under -Windows. (SS) - -2/7/96 (bug fix) Fixed bugs in VC++ makefile that improperly -initialized the tcl75.dll. Fixed bugs in Borland makefile that caused -build failures under Windows NT. (SS) - -2/9/96 (bug fix) Fixed deadlock problem in AUTO end of line translation -mode which would cause a socket server with several concurrent clients -writing in CRLF mode to hang. (JL) - -2/9/96 (API change) Replaced -linemode option to fconfigure with a -new -buffering option, added "none" setting to enable immediate write. (JL) -*** INCOMPATIBILITY with b1 *** - -2/9/96 (new feature) Added C API Tcl_InputBuffered which returns the count -of bytes currently buffered in the input buffer of a channel, and o for -output only channels. (JL) - -2/9/96 (new feature) Implemented asynchronous connect for sockets. (JL) - -2/9/96 (new feature) Added C API Tcl_SetDefaultTranslation to set (per -channel) the default end of line translation mode. This is the mode that -will be installed if an output operation is done on the channel while it is -still in AUTO mode. (JL) - -2/9/96 (bug fix) Changed Tcl_OpenCommandChannel interface to properly -handle all of the combinations of stdio inheritance in background -pipelines. See the Tcl_OpenFileChannel(3) man page for more -info. This change fixes the bug where exec of a background pipeline -was not getting passed the stdio handles properly. (SS) - -2/9/96 (bug fix) Removed the new Tcl_CreatePipeline interface, and -restored the old version for Unix platforms only. All new code should -use Tcl_CreateCommandChannel instead. (SS) - -2/9/96 (bug fix) Changed Makefile.in to use -L and -ltcl7.5 for Tcl -library so that shared libraries are more likely to be found correctly -on more platforms. (JO) - -2/13/96 (new feature) Added C API Tcl_SetNotifierData and -Tcl_GetNotifierData to allow notifier and channel driver writers to -associate data with a Tcl_File. The result of this change is that -Tcl_GetFileInfo now always returns an OS file handle, and Tcl_GetFile -can be used to construct a Tcl_File for an externally constructed OS -handle. (SS) - -2/13/96 (bug fix) Changed Windows socket implementation so it doesn't -set SO_REUSEADDR on server sockets. Now attempts to create a server -socket on a port that is already in use will be properly identified -and an error will be generated. (SS) - -2/13/96 (bug fix) Fixed problems with DLL initialization under Visual -C++ that left the C run time library uninitialized. (SS) - -2/13/96 (bug fix) Fixed Windows socket initialization so it loads -winsock the first time it is used, rather than at the time tcl75.dll -is loaded. This should fix the bug where the modem immediately starts -trying to connect to a service provider when wish or tclsh are -started. (SS) - -2/13/96 (new feature) Added C APIs Tcl_MakeFileChannel and -Tcl_MakeTcpClientChannel to wrap up existing fds and sockets into -channels. Provided implementations on Unix and Windows. (JL) - -2/13/96 (bug fix) Fixed bug with seek leaving EOF and BLOCKING set. (JL) - -2/14/96 (bug fix) Fixed reentrancy problem in fileevent handling -and made it more robust in the face of errors. (JL) - -2/14/96 (feature change) Made generic IO level emulate blocking mode if the -channel driver is unable to provide it, e.g. if the low level device is -always nonblocking. Thus, now blocking behavior is an advisory setting for -channel drivers and can be ignored safely if the channel driver is unable -to provide it. (JL) - -2/15/96 (new feature) Added "binary" end of line translation mode, which is -a synonym of "lf" mode. (JL) - -2/15/96 (bug fix) Fixed reentrancy problem in fileevent handling vs -deletion of channel event handlers. (JL) - -2/15/96 (bug fix) Fixed bug in event handling which would cause a -nonblocking channel to not see further readable events after the first -readable event that had insufficient input. (JL) - -2/17/96 (bug fix) "info complete" didn't properly handle comments -in nested commands. (JO) - -2/21/96 (bug fix) "exec" under Windows NT/95 did not properly handle -very long command lines (>200 chars). (SS) - -2/21/96 (bug fix) Sockets could get into an infinite loop if a read -event arrived after all of the available data had been read. (SS) - -2/22/96 (bug fix) Added cast of st_size elements to (long) before -sprintf-ing in "file size" command. This is needed to handle systems -like NetBSD with 64-bit file offsets. (JO) - ------------------ Released 7.5b2, 2/23/96 ----------------------- - -2/23/96 (bug fix) TCL_VARARGS macro in tcl.h wasn't defined properly -when compiling with C++. (JO) - -2/24/96 (bug fix) Removed dependencies on Makefile in the UNIX Makefile: -this caused problems on some platforms (like Linux?). (JO) - -2/24/96 (bug fix) Fixed configuration bug that made Tcl not compile -correctly on Linux machines with neither -ldl or -ldld. (JO) - -2/24/96 (new feature) Added a block of comments and definitions to -Makefile.in to make it easier to have Tcl's TclSetEnv etc. replace -the library procedures setenv etc, so that calls to setenv etc. in -the application automatically update the Tcl "env" variable. (JO) - -2/27/96 (feature change) Added optional Tcl_Interp * argument (may be NULL) -to C API Tcl_Close and simplified closing of command channels. (JL) -*** INCOMPATIBILITY with Tcl 7.5b2, but not with Tcl 7.4 *** - -2/27/96 (feature change) Added optional Tcl_Interp * argument (may be NULL) -to C type definition Tcl_DriverCloseProc; modified all channel drivers to -implement close procedures that accept the additional argument. (JL) -*** INCOMPATIBILITY with Tcl 7.5b2, but not with Tcl 7.4 *** - -2/28/96 (bug fix) Fixed memory leak that could occur if an upvar -referred to an element of an array in the same stack frame as the -upvar. (JO) - -2/29/96 (feature change) Modified both Tcl_DoOneEvent and Tcl_WaitForEvent -so that they return immediately in cases where they would otherwise -block forever (e.g. if there are no event handlers of any sort). (JO) - -2/29/96 (new feature) Added C APIs Tcl_GetChannelBufferSize and -Tcl_SetChannelBufferSize to set and retrieve the size, in bytes, for -buffers allocated to store input or output in a channel. (JL) - -2/29/96 (new feature) Added option -buffersize to Tcl fconfigure command -to allow Tcl scripts to query and set the size of channel buffers. (JL) - -2/29/96 (feature removed) Removed channel driver function to specify -the buffer size to use when allocating a buffer. Removed the C typedef -for Tcl_DriverBufferSizeProc. Channels are now created with a default -buffer size of 4K. (JL) -*** INCOMPATIBILITY with Tcl 7.5b2, but not with Tcl 7.4 *** - -2/29/96 (feature change) The channel driver function for setting blocking -mode on the device may now be NULL. If the generic code detects that the -function is NULL, operations that set the blocking mode on the channel -simply succeed. (JL) - -3/2/96 (bug fix) Fixed core dump that could occur if a syntax error -(such as missing close paren) occurred in an array reference with a -very long array name. (JO) - -3/4/96 (bug fix) Removed code in the "auto_load" procedure that deletes -all existing auto-load information whenever the "auto_path" variable -is changed. Instead, new information adds to what was already there. -Otherwise, changing the "auto_path" variable causes all package- -related information to be lost. If you really want to get rid of -existing auto-load information, use auto_reset before setting auto_path. (JO) - -3/5/96 (new feature) Added version suffix to shared library names so that -Tcl will compile under NetBSD and FreeBSD (I hope). (JO) - -3/6/96 (bug fix) Cleaned up error messages in new I/O system to correspond -more closely to old I/O system. (JO) - -3/6/96 (new feature) Added -myaddr and -myport options to the socket -command, removed -tcp and -- options. This lets clients and servers -choose a particular interface. Also changed the default server address -from the hostname to INADDR_ANY. The server accept callback now gets -passed the client's port as well as IP address. The C interfaces for -Tcl_OpenTcpClient and Tcl_OpenTcpServer have changed to support the -above changes. (BW) -*** POTENTIAL INCOMPATIBILITY with Tcl 7.5b2, but not with Tcl 7.4 *** - -3/6/96 (changed feature) The library function auto_mkindex will now -default to using the pattern "*.tcl" if no pattern is given. (RJ) - -3/6/96 (bug fix) The socket channel code for the Macintosh has been -rewritten to use native MacTcp. (RJ) - -3/7/96 (new feature) Added Tcl_SetStdChannel and Tcl_GetStdChannel -interfaces to allow applications to explicitly set and get the global -standard channels. (SS) - -3/7/96 (bug fix) Tcl did close not the file descriptors associated -with "stdout", etc. when the corresponding channels were closed. (SS) - -3/7/96 (bug fix) Reworked shared library and dynamic loading stuff to -try to get it working under AIX. Added new @SHLIB_LD_LIBS@ autoconf -symbol as part of this. AIX probably doesn't work yet, but it should -be a lot closer. (JO) - -3/7/96 (feature change) Added Tcl_ChannelProc typedef and changed the -signature of Tcl_CreateChannelHandler and Tcl_DeleteChannelHandler to take -Tcl_ChannelProc arguments instead of Tcl_FileProc arguments. This change -should not affect any code outside Tcl because the signatures of -Tcl_ChannelProc and Tcl_FileProc are compatible. (JL) - -3/7/96 (API change) Modified signature of Tcl_GetChannelOption to return -an int instead of char *, and to take a Tcl_DString * argument. Modified -the implementation so that the option name can be NULL, to mean that the -call should retrieve a list of alternating option names and values. (JL) -*** INCOMPATIBILITY with Tcl 7.5b2, but not with Tcl 7.4 *** - -3/7/96 (API change) Added Tcl_DriverSetOptionProc, Tcl_DriverGetOptionProc -typedefs, added two slots setOptionProc and getOptionProc to the channel -type structure. These may be NULL to indicate that the channel type does -not support any options. (JL) -*** INCOMPATIBILITY with Tcl 7.5b2, but not with Tcl 7.4 *** - -3/7/96 (feature change) stdin, stdout and stderr can now be put into -nonblocking mode. (JL) - -3/8/96 (feature change) Eliminated dependence on the registry for -finding the Tcl library files. (SS) - ------------------ Released 7.5b3, 3/8/96 ----------------------- - -3/12/96 (feature improvement) Modified startup script to look in several -different places for the Tcl library directory. This should allow Tcl -to find the libraries under all but the weirdest conditions, even without -the TCL_LIBRARY environment variable being set. (JO) - -3/13/96 (bug fix) Eliminated use of the "linger" option from the Windows -socket implementation. (JL) - -3/13/96 (new feature) Added -peername and -sockname options for fconfigure -for socket channels. Code contributed by John Haxby of HP. (JL) - -3/13/96 (bug fix) Fixed panic and core dump that would occur if the accept -callback script on a server socket encountered an error. (JL) - -3/13/96 (feature change) Added -async option to the Tcl socket command. -If the command is creating a client socket and the flag is present, the -client is connected asynchronously. If the option is absent (the default), -the client socket is connected synchronously, and the command returns only -when the connection has been completed or failed. This change was suggested -by Mark Diekhans. (JL) - -3/13/96 (feature change) Modified the signature of Tcl_OpenTcpClient to -take an additional int argument, async. If nonzero, the client is connected -to the server asynchronously. If the value is zero, the connection is made -synchronously, and the call to Tcl_OpenTcpClient returns only when the -connection fails or succeeds. This change was suggested by Mark Diekhans. (JL) -*** INCOMPATIBILITY with Tcl 7.5b3, but not with Tcl 7.4 *** - -3/14/96 (bug fix) "tclsh bogus_file_name" didn't print an error message. (JO) - -3/14/96 (bug fix) Added new procedures to tclCkalloc.c so that libraries -and applications can be compiled with TCL_MEM_DEBUG even if Tcl isn't -(however, the converse is still not true). Patches provided by Jan -Nijtmans. (JO) - -3/15/96 (bug fix) Marked standard IO handles of a process as close-on-exec -to fix bug in Ultrix where exec was not sharing standard IO handles with -subprocesses. Fix suggested by Mark Diekhans. (JL) - -3/15/96 (bug fix) Fixed asynchronous close mechanism so that it closes the -channel instead of leaking system resources. The manifestation was that Tcl -would eventually run out of file descriptors if it was handling a large -number of nonblocking sockets or pipes with high congestion. (JL) - -3/15/96 (bug fix) Fixed tests so that they no longer leak file descriptors. -The manifestation was that Tcl would eventually run out of file descriptors -if the tests were rerun many times (> a hundred times on Solaris). (JL) - -3/15/96 (bug fix) Fixed channel creation code so that it never creates -unnamed channels. This would cause a panic and core dump when the channel -was closed. (JL) - -3/16/96 (bug fixes) Made lots of changes in configuration stuff to get -Tcl working under AIX (finally). Tcl should now support the "load" -command under AIX and should work either with or without shared -libraries for Tcl and Tk. (JO) - -3/21/96 (configuration improvement) Changed configure script so it -doesn't use version numbers (as in -ltcl7.5 and libtcl7.5.so) under -SunOS 4.1, where they don't work anyway. (JO) - -3/22/96 (new feature) Added C API Tcl_InterpDeleted that allows extension -writers to discover when an interpreter is being deleted. (JL) - -3/22/96 (bug fix) The standard IO channels are now added to each -trusted interpreter as soon as the interpreter is created. This ensures -against the bug where a child would do IO before the master had done any, -and then the child is destroyed - the standard IO channels would be then -closed and the master would be unable to do any IO. (JL) - -3/22/96 (bug fix) Made Tcl more robust against interpreter deletion, by -using Tcl_Preserve, Tcl_Release and Tcl_EventuallyFree to split the process -of interpreter deletion into two distinct phases. Also went through all of -Tcl and added calls to Tcl_Preserve and Tcl_Delete where needed. (JL) - -3/22/96 (bug fix) Fixed several places where C code was reading and writing -into freed memory, especially during interpreter deletion. (JL) - -3/22/96 (bug fix) Fixed very deep bug in Tcl_Release that caused memory to -be freed twice if the release callback did Tcl_Preserve and Tcl_Release on -the same memory as the chunk currently being freed. (JL) - -3/22/96 (bug fix) Removed several memory leaks that would cause memory -buildup on half-K chunks in the generic IO level. (JL) - -3/22/96 (bug fix) Fixed several core dumps which occurred when new -AssocData was being created during the cleanups in interpreter deletion. -The solution implemented now is to loop repeatedly over the AssocData until -none is left to clean up. (JL) - -3/22/96 (bug fix) Fixed a bug in event handling which caused an infinite -loop if there were no files being watched and no timer. Fix suggested by -Jan Nijtmans. (JL) - -3/22/96 (bug fix) Fixed Tcl_CreateCommand, Tcl_DeleteCommand to be more -robust if the interpreter is being deleted. Also fixed several order -dependency bugs in Tcl_DeleteCommand which kicked in when an interpreter -was being deleted. (JL) - -3/26/96 (bug fix) Upon a "short read", the generic code no longer calls -the driver for more input. Doing this caused blocking on some platforms -even on nonblocking channels. Bug and fix courtesy Mark Roseman. (JL) - -3/26/96 (new feature) Added 'package Tcltest' which is present only in -test versions of Tcl; this allows the testing commands to be loaded into -new interpreters besides the main one. (JL) - -3/26/96 (restored feature) Recreated the Tcl_GetOpenFile C API. You can -now get a FILE * from a registered channel; Unix only. (JL) - -3/27/96 (bug fix) The regular expression code did not support more -than 9 subexpressions. It now supports up to 20. (SS) - -4/1/96 (bug fixes) The CHANNEL_BLOCKED bit was being left on on a short -read, so that fileevents wouldn't fire correctly. Bug reported by Mark -Roseman.(JL, RJ) - -4/1/96 (bug fix) Moved Tcl_Release to match Tcl_Preserve exactly, in -tclInterp.c; previously interpreters were being freed only conditionally -and sometimes not at all. (JL) - -4/1/96 (bug fix) Fixed error reporting in slave interpreters when the -error message was being generated directly by C code. Fix suggested by -Viktor Dukhovni of ESM. (JL) - -4/2/96 (bug fixes) Fixed a series of bugs in Windows sockets that caused -events to variously get lost, to get sent multiple times, or to be ignored -by the driver. The manifestation was blocking if the channel is blocking, -and either getting EAGAIN or infinite loops if the channel is nonblocking. -This series of bugs was found by Ian Wallis of Cisco. Now all tests (also -those that were previously commented out) in socket.test pass. (JL, SS) - -4/2/96 (feature change/bug fix) Eliminated network name support in -favor of better native name support. Added "file split", "file join", -and "file pathtype" commands. See the "file" man page for more -details. (SS) -*** INCOMPATIBILITY with Tcl 7.5b3, but not with Tcl 7.4 *** - -4/2/96 (bug fix) Changed implementation of auto_mkindex so tclIndex -files will properly handle path names in a cross platform context. (SS) - -4/5/96 (bug fix) Fixed Tcl_ReadCmd to use the channel buffer size as the -chunk size it reads, instead of a fixed 4K size. Thus, on large reads, the -user can set the channel buffer size to a large size and the read will -occur orders of magnitude faster. For example, on a 2MB file, reading in 4K -chunks took 34 seconds, while reading in 1MB chunks took 1.5 seconds (on a -SS-20). Problem identified and fix suggested by John Haxby of HP. (JL) - -4/5/96 (bug fix) Fixed socket creation code to invoke gethostbyname only if -inet_addr failed (very unlikely). Before this change the order was reversed -and this made things much slower than they needed to be (gethostbyname -generally requires an RPC, which is slow). Problem identified and fix -suggested by John Loverso of OSF. (JL) - -4/9/96 (feature change) Modified "auto" translation mode so that it -recognizes any of "\n", "\r" and "\r\n" in input as end of line, so -that a file can have mixed end-of-line sequences. It now outputs -the platform specific end of line sequence on each platform for files and -pipes, and for sockets it produces crlf in output on all platforms. (JL) -*** INCOMPATIBILITY with Tcl 7.5b3, but not with Tcl 7.4 *** - -4/11/96 (new feature) Added -eofchar option to Tcl_SetChannelOption to allow -setting of an end of file character for input and output. If an input eof -char is set, it is recognized as EOF and further input from the channel is -not presented to the caller. If an output eof char is set, on output, that -byte is appended to the channel when it is closed. On Unix and Macintosh, -all channels start with no eof char set for input or output. On Windows, -files and pipes start with input and output eof chars set to Crlt-Z (ascii -26), and sockets start with no input or output eof char. (JL) -*** INCOMPATIBILITY with Tcl 7.5b3, but not with Tcl 7.4 *** - -4/17/96 (bug fix) Fixed series of bugs with handling of crlf sequence split -across buffer boundaries in input, in AUTO mode. (JL, BW) - -4/17/96 (test suite improvement) Fixed test suite so that tests that -depend on the availability of Unix commands such as echo, cat and others -are not run if these commands are not present. (JL) - -4/17/96 (test suite improvement) The socket test now automatically starts, -on platformst that support exec, a separate process for remote testsing. (JL) - ------------------ Released 7.5, 4/21/96 ----------------------- - -5/1/96 (bug fix) "file tail ~" did not correctly return the tail -portion of the user's home directory. (SS) - -5/1/96 (bug fix) Fixed bug in TclGetEnv where it didn't lookup environment -variables correctly: could confuse "H" and "HOME", for example. (JO) - -5/1/96 (bug fix) Changed to install tclConfig.sh under "make install-binaries", -not "make install-libraries". (JO) - -5/2/96 (bug fix) Changed pkg_mkIndex not to attempt to "load" a file unless -it has the standard shared library extension. On SunOS, attempts to load -Tcl scripts cause the whole application to be aborted (there's no way to -get the error back into Tcl). (JO) - -5/7/96 (bug fix) Moved initScript in tclUnixInit.c to writable memory to -avoid potential core dumps. (JO) - -5/7/96 (bug fix) Auto_reset procedure was removing procedure from init.tcl, -such as pkg_mkIndex. (JO) - -5/7/96 (bug fix) Fixed cast on socket address resolution code that -would cause a failure to connect on Dec Alphas. (JL) - -5/7/96 (bug fix) Added "time", "subst" and "fileevent" commands to set of -commands available in a safe interpreter. (JL) - -5/13/96 (bug fix) Preventing OS level handles for stdin, stdout and stderr -from being implicitly closed when the last reference to the standard -channel containing that handle is discarded when an interpreter is deleted. -Explicitly closing standard channels by using "close" still works. (JL) - -5/21/96 (bug fix) Do not create channels for stdin, stdout and stderr on -Unix if the devices are closed. This prevents a duplicate channel name -panic later on when the fd is used to open a channel and the channel is -registered in an interpreter. (JL) - -5/23/96 (bug fix) Fixed bug that prevented the use of standard channels in -interpreters created after the last interpreter was destroyed. In the sequence - - interp = Tcl_CreateInterp(); - Tcl_DeleteInterp(interp); - interp = Tcl_CreateInterp(); - -channels for stdio would not be available in the second interpreter. (JL) - -5/23/96 (bug fix) Fixed bug that allowed Tcl_MakeFileChannel to create new -channels with Tcl_Files in them that are already used by another channel. -This would cause core dumps when the Tcl_Files were being freed twice. (JL) - -5/23/96 (bug fix) Fixed a logical timing bug that caused a standard channel -to be removed from the standard channel table too early when the channel -was being closed. If the channel was being flushed asynchronously, it could -get recreated before being actually destroyed, and the recreated channel -would contain the same Tcl_File as the one being closed, leading to -dangling pointers and core dumps. (JL) - -5/27/96 (bug fix) Fixed a bug in Tcl_GetChannelOption which caused it to -always return a list of one element, a list of the settings, for --translation and -eofchar options. Now correctly returns the value -described by the documentation (Mark Diekhans found this, thanks!). (JL) - -5/30/96 (bug fix) Fixed a couple of syntax errors in io.test. (JL) - -5/30/96 (bug fix) If a fileevent scripts gets an error, delete it before -causing a background error. This is to allow the error handler to reinstall -the fileevent and to prevent infinite loops if the event loop is reentered -in the error handler. (JL) - -5/31/96 (bug fix) Channels now will get properly flushed on exit. (JL) - -6/5/96 (bug fix) Changed Tcl_Ckalloc, Tcl_Ckfree, and Tcl_Ckrealloc to -Tcl_Alloc, Tcl_Free, and Tcl_Realloc. Added documentation for these -routines now that they are officially supported. Extension writers -should use these routines instead of free() and malloc(). (SS) - -6/10/96 (bug fix) Changes the Tcl close command so that it no longer -waits on nonblocking pipes for the piped processes to exit; instead it -reaps them in the background. (JL) - -6/11/96 (bug fix) Increased the length of the listen queue for server -sockets on Unix from 5 to 100. Some OSes will disregard this and reset it -to 5, but we should try to get as long a queue as we can, for performance -reasons. (JL) - -6/11/96 (bug fix) Fixed windows sockets bug that caused a cascade of events -if the fileevent script read less than was available. Now reading less than -is available does not cause a flood of Tcl events. (JL, SS) - -6/11/96 (bug fix) Fixed bug in background flushing on closed channels that -would prevent the last buffer from getting flushed. (JL) - -6/13/96 (bug fix) Fixed bug in Windows sockets that caused a core dump if -a DLL linked with tcl.dll and referred to e.g. ntohs() without opening a -Tcl socket. The problem was that the indirection table was not being -initialized. (JL) - -6/13/96 (bug fix) Fixed OS level resource leak that would occur when a -Tcl channel was still registered in some interpreter when the process -exits. Previously the channel was not being closed and the OS level handles -were not being released; the output was being flushed but the device was -not being closed. Now the device is properly closed. This was only a -problem on Win3.1 and MacOS. (JL, SS) - -6/28/96 (bug fix) Fixed bug where transient errors were leaving an error -code around, so that it would erroneously get reported later. This bug was -exercised intermittently by closing a channel to a file on a very loaded -NFS server, or to a socket whose other end blocked. (JL, BW) - -7/3/96 (bug fix) Fileevents declared in an interpreter are now deleted -when the channel is closed in that interpreter. Before this fix, the -fileevent would hang around until the channel is completely closed, and -would cause errors if events happened before the channel was closed. This -could happen in two cases: first if the channel is shared between several -interpreters, and second if an async flush is in progress that prevents the -channel from being closed until the flush finishes. (JL) - -7/10/96 (bug fix) Fixed bugs in both "lrange" and "lreplace" commands -where too much white space was being removed. For example, the command - lreplace {\}\ hello} end end -was returning "\}\", losing the significant space in the first list -element and corrupting the list. (JO) - -7/20/96 (bug fix) The procedure pkg_mkIndex didn't work properly for -extensions that depend on Tk, because it didn't load Tk into the child -interpreter before loading the extension. Now it loads Tk if Tk is -present in the parent. (JO) - -7/23/96 (bug fix) Added compat version of strftime to fix crashes -resulting from bad implementations under Windows. (SS) - -7/23/96 (bug fix) Standard implementations of gmtime() and localtime() -under Windows did not handle dates before 1970, so they were replaced -with a revised implementation. (SS) - -7/23/96 (bug fix) Tcl would crash on exit under Borland 5.0 because -the global environ pointer was left pointing to freed memory. (SS) - -7/29/96 (bug fix) Fixed memory leak in Tcl_LoadCmd that could occur if -a package's AppInit procedure called Tcl_StaticPackage to register -static packages. (JO) - -8/1/96 (bug fix) Fixed a series of bugs in Windows sockets so that async -writebehind in the presence of read event handlers now works, and so that -async writebehind also works on sockets for which a read event handler was -declared and whose channels were then closed before the async write -finished. The bug was reported by John Loverso and Steven Wahl, -independently, test case supplied by John Loverso. (JL) - ------------------ Released patch 7.5p1, 8/2/96 ----------------------- - -5/8/96 (new feature) Added Tcl_GetChannelMode C API for retrieving whether -a channel is open for reading and writing. (JL) - -5/8/96 (API changes) Revised C APIs for channel drivers: - - Removed all Tcl_Files from channel driver interface; you can now have - channels that are not based on Tcl_Files. - - Added channelReadyProc and watchChannelProc procedures to interface; - these are used to implement event notification for channels. - - Added getFileProc to channel driver, to allow the generic IO code - to retrieve a Tcl_File from a channel (presumably if the channel - uses Tcl_Files they will be stored inside its instanceData). (JL) -*** INCOMPATIBILITY with Tcl 7.5 *** - -5/8/96 (API change) The Tcl_CreateChannel C API was modified to not take -Tcl_File arguments, and instead to take a mask specifying whether the -channel is readable and/or writable. (JL) -*** INCOMPATIBILITY with Tcl 7.5 *** - -6/3/96 (bug fix) Made Tcl_SetVar2 robust against the case where the value -of the variable is a NULL pointer instead of "". (JL) - -6/17/96 (bug fix) Fixed "reading uninitialized memory" error reported by -Purify, in Tcl_Preserve/Tcl_Release. (JL) - -8/9/96 (bug fix) Fixed bug in init.tcl that caused incorrect error message -if the act of autoloading a procedure caused the procedure to be invoked -again. (JO) - -8/9/96 (bug fix) Configure script produced bad library names and extensions -under SunOS and a few other platforms if the --disable-load switch was used. -(JO) - -8/9/96 (bug fix) Tcl_UpdateLinkedVar generated an error if the variable -being updated was read-only. (JO) - -8/14/96 (bug fix) The macintosh now supports synchronous socket -connections. Other minor bugs were also fixed. (RJ) - -8/15/96 (configuration improvement) Changed the file patchlevel.h -to be tclPatch.h. This avoids conflict with the Tk file and is now -in 8.3 format on the Windows platform. (RJ) - -8/20/96 (bug fix) Fixed core dump in interp alias command for interpreters -created with Tcl_CreateInterp (as opposed to with Tcl_CreateSlave). (JL) - -8/20/96 (bug fix) No longer masking ECONNRESET on Windows sockets so -that the higher level of the IO mechanism sees the error instead of -entering an infinite loop. (JL) - -8/20/96 (bug fix) Destroying the last interpreter no longer closes the -standard channels. (JL) - -8/20/96 (bug fix) Closing one of the stdin, stdout or stderr channels and -then opening a new channel now correctly assigns the new channel as the -standard channel that was closed. (JL) - -8/20/96 (bug fix) Added code to unix/tclUnixChan.c for using ioctl with -FIONBIO instead of fcntl with O_NONBLOCK, for those versions of Unix where -either O_NONBLOCK is not supported or implemented incorrectly. (JL) - -8/21/96 (bug fix) Fixed "file extension" so it correctly returns the -extension on files like "foo..c" as "..c" instead of ".c". (SS) - -8/22/96 (bug fix) If environ[] contains static strings, Tcl would core -dump in TclSetupEnv because it was trying to write NULLs into the actual -data in environ[]. Now we instead copy as appropriate. (JL) - -8/22/96 (added impl) Added missing implementation of Tcl_MakeTcpClientChannel -for Windows platform. Code contributed by Mark Diekhans. (JL) - -8/22/96 (new feature) Added a new memory allocator for the Macintosh -version of Tcl. It's quite a bit faster than MetroWerk's version. (RJ) - -8/26/96 (documentation update) Removed old change bars (for all changes -in Tcl 7.5 and earlier releases) from manual entries. (JO) - -8/27/96 (enhancement) The exec and open commands behave better and work in -more situations under Windows NT and Windows 95. Documentation describes -what is still lacking. (CS) - -8/27/96 (enhancement) The Windows makefiles will now compile even if the -compiler is not in the path and/or the compiler's environment variables -have not been set up. (CS) - -8/27/96 (configuration improvement) The Windows resource files are -automatically updated when the version/patch level changes. The header file -now has a comment that reminds the user which other files must be manually -updated when the version/patch level changes. (CS) - -8/28/96 (new feature) Added file manipulation features (copy, rename, delete, -mkdir) that are supported on all platforms. They are implemented as -subcommands to the "file" command. See the documentation for the "file" -command for more information. (JH) - ------------------ Released 7.6b1, 8/30/96 ----------------------- - -9/3/96 (bug fix) Simplified code so that standard channels are created -lazily, they are added to an interpreter lazily, and they are never added -to a safe interpreter. (JL) - -9/3/96 (bug fix) Closing a channel after closing a standard channel, e.g. -stdout, would cause the implicit recreation of that standard channel. (JL) - -9/3/96 (new feature) Now calling Tcl_RegisterChannel with a NULL -interpreter increments the refcount so that code outside any interpreter -can use channels that are also registered in interpreters, without worrying -that the channel may turn into a dangling pointer at any time. Calling -Tcl_UnregisterChannel with a NULL interpreter only decrements the recount -so that code outside any interpreter can safely declare it is no longer -interested in a channel. (JL) - -9/4/96 (new features) Two changes to dynamic loading: - - If the file name is empty in the "load" command and there is no - statically loaded version of the package, a dynamically loaded - version will be used if there is one. - - Tcl_StaticPackage ignores redundant calls for the same package. (JO) - -9/6/96 (bug fix) Platform specific procedures for manipulating files are -no longer macros and have been prefixed with "Tclp", such as TclpRenameFile. -Unix file code now handles symbolic links and other special files correctly. -The semantics of file copy and file rename has been changed so that if -a target directory exists, the source files will NOT be merged with the -existing files. (JH) - -9/6/96 (bug fix) If standard channel is NULL, because Tcl cannot connect -to the standard channel, do not increment the refcount. The channel can -be NULL if there is for example no standard input. (JL) - -9/6/96 (portability improvement) Changed parsing of backslash sequences -like \n to translate directly to absolute values like 0xa instead of -letting the compiler do the translation. This guarantees that the -translation is done the same everywhere. (JO) - -9/9/96 (bug fix) If channel is opened and not associated with any -interpreter, but Tcl decides to use it as one of the standard channels, it -became impossible to close the channel with Tcl_Close -- instead you had -to call Tcl_UnregisterChannel. Fixed now so that it's safe to call -Tcl_Close even when Tcl is using the channel as one of the standard ones. (JL) - -9/11/96 (feature change) The Tcl library is now placed in the Tcl -shared libraries resource. You no longer need to place the Tcl files -in your applications explicitly. (RJ) - -9/11/96 (feature change) Extensions no longer automatically have the -resource fork of the extension opened for it. Instead you need to -use the tclMacLibrary.c file in your extension. (RJ) -*** POTENTIAL INCOMPATIBILITY *** - -9/12/96 (bug fix) The extension loading mechanism on the Macintosh now -looks at the 'cfrg' resource to determine where to load the code -fragment from. This means FAT fragments should now work. (RJ) - -9/18/96 (enhancement) The exec and open commands behave better and work in -more situations under Windows 3.X. Documentation describes what is still -lacking. (CS) - -9/19/96 (bug fix) Fixed a panic which would occur if you delete a -non-existent alias before any aliases are created. Now instead correctly -returns an error that the alias is not found. (JL) - -9/19/96 (bug fix) Slave interpreters could rename aliases and they would -not get deleted when the alias was being redefined. This led to dangling -pointers etc. (JL) - -9/19/96 (bug fix) Fixed a panic where a hash table entry was being deleted -twice during alias management operations. (JL) - -9/19/96 (bug fix) Fixed bug in event loop that could cause the input focus -in Tk to get confused during menu traversal, among other problems. The -problem was related to handling of the "marker" when its event was -deleted. (JO) - -9/26/96 (bug fix) Windows was losing EOF on a socket if the FD_CLOSE event -happened to precede any left over FD_READ events. Now correctly remembers -seeing FD_CLOSE, so that trailing FD_READ events are not discarded if they -do not contain any data. This allows Tcl to correctly get a zero read and -notice EOF. (JL) - -9/26/96 (bug fix) Was not resetting READABLE state properly on sockets -under Windows if the driver discarded an FD_READ event because no data was -present. Now correctly resets the state. (JL) - -9/30/96 (bug fix) Made EOF sticky on Windows sockets, so that fileevent -readable will fire repeatedly until the socket is closed. Previously the -fileevent fired only once. This could lead to never-closed connections if -the Tcl script in the fileevent wasn't closing the socket immediately. (JL) - -10/2/96 (new feature) Improved the package loader: - - Added new variable tcl_pkgPath, which holds the default - directories under which packages are normally installed (each - package goes in a separate subdirectory of a directory in - $tcl_pkgPath). These directories are included in auto_path by - default. - - Changed the package auto-loader to look for pkgIndex.tcl files - not only in the auto_path directories but also in their immediate - children. This should make it easier to install and uninstall - packages (don't have to change auto_path or merge pkgIndex.tcl - files). (JO) - -10/3/96 (bug fix) Changed tclsh to look for tclshrc.tcl instead of -tclsh.rc on startup under Windows. This is more consistent with wish and -uses the right extension. (SS) -*** POTENTIAL INCOMPATIBILITY *** - -10/8/96 (bug fix) Convertclock does not parse 24-hour times of the -form "hhmm" correctly when hour = 00. In the parse code, hour must be ->= 100 for minutes to be non-zero. Thanks to Lint LaCour for this -bug fix. (RJ) - -10/11/96 (bug fix) Under Windows, the pid command returned the process -handle instead of the process id. (SS) - ------------------ Released 7.6, 10/16/96 ----------------------- - -10/29/96 (bug fix) Under Windows, sockets would consume 100% CPU time after -the first accept(), due to a typo. (JL) - -10/29/96 (bug fix) Incorrect refcount management caused standard channels -not to get deleted at process exit or DLL unload time, causing a memory -leak of upwards of 20K each time. (JL) - -11/7/96 (bug fix) Auto-exec didn't work on file names that contained -spaces. (JO) - -11/8/96 (bug fix) Fixed core dump that would occur if more than one call -to Tcl_DeleteChannelHandler was made to delete a given channel handler. (JL) - -11/8/96 (bug fix) Fixed test for return value in Tcl_Seek and Tcl_SeekCmd -to only treat -1 as error, instead of all negative numbers. (JL) - -11/12/96 (bug fix) Do not blocking waiting for processes at the end of a -pipe during exit cleanup. (JL) - -11/12/96 (bug fix) If we are in exit cleanup, do not close the system level -file descriptors 0, 1 and 2. Previously they were being closed which is -incorrect, in the embedded case. This led to weird behavior for programs -that want to interpose on I/O through the standard file descriptors (e.g. -Netscape Navigator). (JL) - -11/15/96 (bug fix) Fixed core dump on Windows sockets due to dependency on -deletion order at exit. Now all socket functions check to see if sockets -are (still) initialized, before calling through function pointers. Before, -they would call and might end up calling unloaded object code. (JL) - -11/15/96 (bug fix) Fixed core dump in Windows socket initialization routine -if sockets were not installed on the system. Before, it was not properly -checking the result of attempting to load the socket DLL, so it would call -through uninitialized function pointers. (JL) - -11/15/96 (bug fix) Fixed memory leak in Windows sockets which left socket -DLL handle open and could hold the socket DLL in memory uneccessarily, -until a reboot. (JL) - -12/4/96 (bug fix) Fixed bug in Macintosh socket code that could result -in lost data if a client was closed too soon after sending data. (RJ) - -12/17/96 (bug fix) Fixed deadlock bug in Windows sockets due to losing an -event. This was happening because of an interaction between buffering and -nonblocking mode on sockets. Now switched to sockets being blocking by -default, so we are also no longer emulating blocking through a private -event loop. (JL) - -1/21/97 (performance bug fix) Client TCP connections were slow to create -because getservbyname was always called on the port. Now this is only -done if Tcl_GetInt fails. (BW) - -1/21/97 (configuration fix) Made it possible to override TCL_PACKAGE_PATH -during make. Previously it was only set during autoconf process. - -1/29/97 (bug fix) Fixed some problems with the clock command that -impacted how dates were scaned after the year 2000. (RJ) - ------------------ Released 7.6p2, 1/31/97 ----------------------- - -2/5/97 (bug fix) Fixed a bug where in CR-LF translation mode, \r bytes -in the input stream were not being handled correctly. (JL) - -2/24/97 (bug fix) Fix bug with exec under Win32s not being able to create -stderr file which caused all execs to fail. Fixed temp file leak under -Win32s. Fixed optional parameter bug with SearchPath that only happened -under Win32s 1.25. (CCS) - ----------------------------------------------------------- -Changes for Tcl 7.6 go above this line. -Changes for Tcl 7.7 go below this line. ----------------------------------------------------------- - -5/8/96 (new feature) Added Tcl_Ungets C API for putting a sequence of bytes -into a channel's input buffer. This can be used for "push" model channels -where the input is obtained via callbacks instead of by request of the -generic IO code. No Tcl procedure yet. (JL) - -11/15/96 (new feature) Implemented hidden commands. New C APIs: - Tcl_HideCommand -- hides an existing exposed command. - Tcl_ExposeCommand -- exposes an existing hidden command. -New tcl APIs: - interp invokehidden -- invokes a hidden command in a slave. - interp hide -- hides an existing exposed command. - interp expose -- exposes an existing hidden command. - interp hidden -- returns a list of hidden commands. -The implementation of Safe Tcl now uses the new hidden commands facility -to implement the safe base, instead of deleting the commands from a safe -interpreter. (JL) - -11/15/96 (new feature) Implemented the safe base, a mechanism for -installing and requesting security policies, purely in Tcl code. Overloads -the package command to also allow an interpreter to "require" a policy. The -following new library commands are provided: - tcl_safeCreateInterp -- creates a slave an initializes the - policy mechanism. - tcl_safeInitInterp -- initializes an existing slave with the - policy mechanism. - tcl_safeDeleteInterp -- deletes a slave and deinitializes the - policy mechanism. -Added a new file to the library, safeinit.tcl, to hold implementation. (JL) -On 7/9/97, removed the policy loading mechanism from the Safe Base. Left -only the Safe Base aliases dealing with auto-loading and source. (JL) - -12/6/96 (new feature) Implemented Tcl_Finalize, an API that should be -called by a process when it is done using Tcl. This API runs all the exit -handlers to allow them to clean up resources etc. (JL) - -12/17/96 (new feature) Add an http Tcl script package to the Tcl library. -This package implements the client side of HTTP/1.0; the GET, HEAD, -and POST requests. (BW) - -1/21/97 (new feature) Added a "marktrusted" subcommand to the "interp" and -to the interpreter object command. It removes the "safe" mark on an -interpreter and disables hard-wired checks for safety in the C sources. (JL) - -1/21/97 (removed feature) Removed "vwait" from set of commands available in -a safe interpreter. (JL) - -2/11/97 (new feature, bug fix) http package. Added -accept to http_config -so you can set the Accept header. Added -handler option to http_get so -you can supply your own data handler. Also fixed POST operation to -set the correct MIME type on the request. (BW) - ----------------------------------------------------------- -Changes for Tcl 7.7 go above this line. -Changes for Tcl 8.0 go below this line. ----------------------------------------------------------- - -9/17/96 (bug fix) Using "upvar" it was possible to turn an array element -into an array itself. Changed to disallow this; it was quirky and didn't -really work correctly anyway. (JO) - -10/21/96 (new feature) The core of the Tcl interpreter has been replaced -with an on-the-fly compiler that translates Tcl scripts to bytecoded -instructions; a new interpreter then executes the bytecodes. The compiler -introduces only a few minor changes at the level of Tcl scripts. The biggest -changes are to expressions and lists. - - A second level of substitutions is no longer done for expressions. - This substantially improves their execution time. This means that - the expression "$x*4" produces a different result than in the past - if x is "$y+2". Fortunately, not much code depends on the old - two-level semantics. Some expressions that do, such as - "expr [join $list +]" can be recoded to work in Tcl8.0 by adding - an eval: e.g., "eval expr [join $list +]". - - Lists are now completely parsed on the first list operation to - create a faster internal representation. In the past, if you had a - misformed list but the erroneous part was after the point you - inserted or extracted an element, then you never saw an error. - In Tcl8.0 an error will be reported. This should only effect - incorrect programs that took advantage of behavior of the old - implementation that was not documented in the man pages. -Other changes to Tcl scripts are discussed in the web page at -http://www.scriptics.com/doc/compiler.html. (BL) -*** POTENTIAL INCOMPATIBILITY *** - -10/21/96 (new feature) In earlier versions of Tcl, strings were used as a -universal representation; in Tcl 8.0 strings are replaced with Tcl_Obj -structures ("objects") that can hold both a string value and an internal -form such as a binary integer or compiled bytecodes. The new objects make it -possible to store information in efficient internal forms and avoid the -constant translations to and from strings that occurred with the old -interpreter. There are new many new C APIs for managing objects. Some of the -new library procedures for objects (such as Tcl_EvalObj) resemble existing -string-based procedures (such as Tcl_Eval) but take advantage of the -internal form stored in Tcl objects for greater speed. Other new procedures -manage objects and allow extension writers to define new kinds of objects. -See the manual entries doc/*Obj*.3 (BL) - -10/24/96 (bug fix) Fixed memory leak on exit caused by some IO related -data structures not being deallocated on exit because their refcount was -artificially boosted. (JL) - -10/24/96 (bug fix) Fixed core dump in Tcl_Close if called with NULL -Tcl_Channel. (JL) - -11/19/96 (new feature) Added library procedures for finding word -breaks in strings in a platform specific manner. See the library.n -manual entry for more information. (SS) - -11/22/96 (feature improvements) Added support for different levels of -tracing during bytecode compilation and execution. This should help in -tracking down suspected problems with the compiler or with converting -existing code to use Tcl8.0. Two global Tcl variables, traceCompile -and traceExec, can be set to generate tracing information in stdout: - - traceCompile: 0 no tracing (default) - 1 trace compilations of top level commands and procs - 2 trace and display instructions for all compilations - - traceExec: 0 no tracing - 1 trace only calls to Tcl procs - 2 trace invocations of all commands including procs - 3 detailed trace showing the result of each instruction -traceExec >= 2 provides a one line summary of each called command and -its arguments. Commands that have been "compiled away" such as set are -not shown. (BL) - -11/30/96 (bug fix) The command "info nameofexecutable" could sometimes -return the name of a directory. (JO) - -11/30/96 (feature improvements) Changed the code in library/init.tcl -that reads in pkgIndex.tcl so that (a) it reads the files from child -directories before those in the parent, so that the parent gets -precedence, and (b) it doesn't quit if there is an error in a -pkgIndex.tcl file; instead, it prints an error message on standard -error and continues. (JO) - -10/5/96 (feature improvements) Partial implementation of binary string -support: the ability for Tcl string values to contain embedded null bytes. -Changed the Tcl object-based APIs to take a byte pointer and length pair -instead of a null-terminated C string. Modified several object type managers -to support binary strings but not, for example, the list type manager. -Existing string-based C APIs are unchanged and will truncate binary -strings. Compiled scripts containing nulls are also truncated. (BL) - -12/12/96 (feature change) Removed the commands "cp", "mkdir", "mv", -"rm", and "rmdir" from the Macintosh version of Tcl. They were never -officially supported and their functionality is now available via -the file command. (RJ) - ------------------ Released 8.0a1, 12/20/96 ----------------------- - -1/7/97 (bug fix) Under Windows, "file stat c:" was returning error instead -of stat for current dir on c: drive. - -1/10/97 (new feature) Added Tcl_GetIndexFromObj procedure for quick -lookups of keyword arguments. (JO) - -1/12/97 (new feature) Serial IO channel drivers for Windows and Unix, -available by using Tcl open command to open pseudo-files like "com1:" or -"/dev/ttya". New option to Tcl fconfigure command for serial files: -"-mode baud,parity,data,stop" to specify baud rate, parity, data bits, and -stop bits. Serial IO is not yet available on Mac. - -1/16/97 (feature change) Restored the Tcl7.x "two level substitution -semantics" for expressions. Expressions not enclosed in braces are -implemented, in general, by calling the expr command procedure -(Tcl_ExprObjCmd) at runtime after the Tcl interpreter has already done a -first round of substitutions. This is slow (about Tcl7.x speed) because new -code for the expression is generally compiled each time. However, if the -expression has only variable substitutions (and not command substitutions), -"optimistic" fast code is generated inline. This inline code will fail if a -second round of substitutions is needed (i.e., if the value of a substituted -variable itself requires more substitutions). The optimistic code will -catch the error and back off to call the slower but guaranteed correct -expr command procedure. (BL) - -1/16/97 (feature improvements) Added Tcl_ExprLongObj and Tcl_ExprDoubleObj -to round out expression-related procedures. (BL) - -1/16/97 (feature change) Under Windows, at startup the environment variables -"path", "comspec", and "windir" in any capitalization are converted -automatically to upper case. The PATH variable could be spelled as path, -Path, PaTh, etc. and it makes programming rather annoying. All other -environment variables are left alone. (CS) - -1/20/97 (new features) Rewrote the "lsort" command: - - The new version is based on reentrant merge sort code provided - by Richard Hipp, so it eliminates the reentrancy and stability - problems with the old qsort-based implementation. - - The new version supports a -dictionary option for sorting, and - it also supports a -index option for sorting lists using one - element for comparison. - - The new version is an object command, so it works well with the - Tcl compiler, especially in conjunction with the new -index - option. When the -index option is used, this version of lsort - is more than 100 times faster than the Tcl 7.6 lsort, which had - to use the -command option to get the same effect. (JO) - -1/20/97 (feature improvements) Added the improved debugging support for Tcl -objects prototyped by Karl Lehenbauer . -If TCL_MEM_DEBUG is defined, the object creation calls use Tcl_DbCkalloc -directly in order to record the caller's source file name and line -number. (BL) - -1/21/97 (removed feature) Desupported the tcl_precision variable: if -set, it is ignored. Tcl now uses the full 17 digits of precision when -converting real numbers to strings (with the new object system real -numbers are rarely converted to strings so there is no efficiency -disadvantage to printing all 17 digits; the new scheme improves -accuracy and simplifies several APIs). (JO) -*** POTENTIAL INCOMPATIBILITY *** - -1/21/97 (feature change) Removed the "interp" argument for the -procedures Tcl_GetStringFromObj, Tcl_StringObjAppend, and -Tcl_StringObjAppendObj. Also removed the "interp" argument for -the updateStringProc procedure in Tcl_ObjType structures. With -the tcl_precision changes above, these are no longer needed. (JO) -*** POTENTIAL INCOMPATIBILITY with Tcl 8.0a1, but not with Tcl 7.6 *** - -1/22/97 (bug fix) Fixed http.tcl so that http_reset does not result in -an extra call to the command callback. In addition, if the transaction -gets a premature eof, the state(status) is "eof", not "ok". (BW) - ------------------ Released 8.0a2, 1/24/97 ----------------------- - -1/29/97 (feature change) Changed how two digit years are parsed in the -clock command. The old interface just added 1900 which will seem -broken by the year 2000. The new scheme follows the POSIX standard -and treats dates 70-99 as 1970-1999 and dates 00-38 as 2000-2038. All -other two digit dates are undefined. (RJ) -*** POTENTIAL INCOMPATIBILITY *** - -2/4/97 (bug fix) Fixed bug in clock code that dealt with relative -dates. Using the relative month code you could get an invalid date -because it jumped into a non-existant day. (For example, Jan 31 -to Feb 31.) The code now will return the last valid day of the -month in these situations. Thanks to Hume Smith for sending in -this bug fix. (RJ) - -2/10/97 (feature change) Eliminated Tcl_StringObjAppend and -Tcl_StringObjAppendObj procedures, replaced them with Tcl_AppendToObj -and Tcl_AppendStringsToObj procedures. Added new procedure -Tcl_SetObjLength. (JO) -*** POTENTIAL INCOMPATIBILITY with Tcl 8.0a2, but not with Tcl 7.6 *** - -2/10/97 (new feature) Added Tcl_WrongNumArgs procedure for generating -error messages about incorrect number of arguments. (JO) - -2/11/97 (new feature, bug fix) http package. Added -accept to http_config -so you can set the Accept header. Added -handler option to http_get so -you can supply your own data handler. Also fixed POST operation to -set the correct MIME type on the request. (BW) - -2/22/97 (bug fix) Fixed bug that caused $tcl_platform(osVersion) to be -computed incorrectly under AIX. (JO) - -2/25/97 (new feature, feature change) Added support for both int and long -integer objects. Added Tcl_NewLongObj/Tcl_GetLongFromObj/Tcl_SetLongFromObj -procedures and renamed the Tcl_Obj internalRep intValue member to -longValue. Tcl_GetIntFromObj now checks for integer values too large to -represent as non-long integers. Changed Tcl_GetAllObjTypes to -Tcl_AppendAllObjTypes. (BL) - -3/5/97 (new feature) Added new Tcl_SetListObj procedure to round out -collection of procedures that set the type and value of existing Tcl -objects. (BL) - -3/6/97 (new feature) Added -global flag for interp invokehidden. (JL) - -3/6/97 (new feature, feature change) Added isNativeObjectProc field to the -Tcl_CmdInfo structure to indicate (when 1) if the command has an -object-based command procedure. Removed the nameLength arg from -Tcl_CreateObjCommand since command names can't contain null characters. (BL) - -3/6/97 (bug fix) Fixed bug in "unknown" procedure that caused auto- -loading to fail on commands whose names begin with digits. (JO) - -3/7/97 (bug fix) Auto-loading now works in Safe Base. Safe interpreters -only accept the Version 2 and onwards tclIndex files. (JL) - -3/13/97 (bug fix) Fixed core dump due to interaction between aliases and -hidden commands. Bug found by Lindsay Marshall. (JL) - -3/14/97 (bug fix) Fixed mac bugs relating to time. The -gmt option -now adjusts the time in the correct direction. (Thanks to Ed Hume for -reporting a fix to this problem.) Also fixed file "mtime" etc. to -return times from GMT rather than local time zone. (RJ) - -3/18/97 (feature change) Declaration of objv in Tcl_ObjCmdProc function -changed from "Tcl_Obj *objv[]" to "Tcl_Obj *CONST objv[]". All Tcl object -commands changed to use new declaration of objv. Naive translation of -string-based command procs to object-based command procs could very easily -have yielded code where the contents of the objv array were changed. This -is not a problem with string-based command procs, but doing something as -simple as objv[2] = objv[3] would corrupt the runtime stack and cause Tcl to -crash. Introduced CONST in declaration of objv so that attempted assignment -of new pointer values to elements of the objv array will be caught by the -compiler. (CCS) -*** POTENTIAL INCOMPATIBILITY with Tcl 8.0a2 *** - -3/19/97 (bug fix) Fixed panic due to object sharing. The root cause was -that old code was using Tcl_ResetResult instead of Tcl_ResetObjResult. (JL) - -3/20/97 (new feature) Added a new subcommand for the file -command. file attributes filename can give a list of platform-specific -options (such as file/creator type on the Mac, permissions on Unix) or -set the values of them. Added a new subcommand for the file -command. file nativename name gives back the platform-specific form -for the file. This is useful when the filename is needed to pass to -the OS, such as exec under Windows 95 or AppleScript on the Mac. For -more info, see file.n. (SRP) - -3/24/97 (removed feature) Removed the tcl_safePolicyPath procedure. Now -the policy path is computed from the auto_path by appending the directory -'policies' to each element. Also fixed several bugs in automatic tracking -of auto_path by computed policy path. (JL) -*** POTENTIAL INCOMPATIBILITY with Tcl 8.0a2 but not with Tcl 7.6 *** - -4/8/97 (new feature) If the variable whose name is passed to lappend doesn't -already exist, and there are no value arguments, lappend now creates the -variable with an empty value instead of returning an error. Change suggested -by Tom Tromey. (BL) - -4/9/97 (feature change) Changed the name of the TCL_PART1_NOT_PARSED flag to -TCL_PARSE_PART1. (BL) -*** POTENTIAL INCOMPATIBILITY with Tcl 8.0a2 but not with Tcl 7.6 *** - -4/10/97 (bug fixes) Fixed various compilation-related bugs: - - "UpdateStringOfCmdName should never be invoked" panic. - - Bad code generated for expressions not in {}'s inside catch commands. - - Segmentation fault in some command procedures when two argument - object pointers refer to the same object. - - Second level of substitutions were never done for expressions not - in {}'s that consist of a single variable reference: e.g., - "set x 27; set bool {$x}; if $bool {puts foo}" would fail with error. - - Bad code generated when code storage was grown while compiling some - expressions: ones with compilation errors or consisting of only a - variable reference. - - Bugs involving multiple interpreters: wasn't checking that a - procedure's code was compiled for the same interpreter as the one - executing it, and didn't invalidate code on hidden-exposed command - transitions. - - "Bad stack top" panic when executing scripts that require a huge - amount of stack space. - - Incorrect sharing of code for procedure bodies, and procedure code - deallocated before last execution of the procedure finished. - - Fixed compilation of expression words in quotes. For example, - if "0 < 3" {puts foo}. - - Fixed performance bug in array set command with large assignments. - - Tcl_SetObjLength segmentation fault setting length of empty object. - - If Tcl_SetObjectResult was passed the same object as the interpreter's - result object, it freed the object instead of doing nothing. Bug fix - by Michael J. McLennan. - - Tcl_ListObjAppendList inserted elements from the wrong list. Bug fix - by Michael J. McLennan. - - Segmentation fault if empty variable list was specified in a foreach - command. Bug fix by Jan Nijtmans. - - NULL command name was always passed to Tcl_CreateTrace callback - procedure. - - Wrong string representation generated for the value LONG_MIN. - For example, expr 1<<31 printed incorrectly on a 32 bit machine. - - "set {a($x)} 1" stored value in wrong variable. - - Tcl_GetBooleanFromObj was not checking for garbage after a numeric - value. - - Garbled "bad operand type" error message when evaluating expressions - not surrounded by {}'s. (BL) - -4/16/97 (new feature) The expr command now has the "rand()" and -"srand()" functions for getting random numbers in expr. (RJ) - -4/23/97 (bug fix) Fixed core dump in bgerror when the error handler command -deletes the current interpreter. Found by Juergen Schoenwald. (JL) - -4/23/97 (feature change) The notifier interfaces have been redesigned -to make embedding in applications with external event loops possible. -A number of interfaces in the notifier and the channel drivers have -changed. Refer to the Notifier.3 and CrtChannel.3 manual entries for -more details. (SS) -*** POTENTIAL INCOMPATIBILITY *** - -4/23/97 (removed feature) The Tcl_File interfaces have been removed. -The Tcl_CreateFileHandler/Tcl_DeleteFileHandler interfaces now take -Unix fd's and are only supported on the Unix platform. -Tcl_GetChannelFile has been replaced with Tcl_GetChannelHandle. -Tcl_MakeFileChannel now takes a platform specific file handle. (SS) -*** POTENTIAL INCOMPATIBILITY *** - -4/23/97 (removed feature) The modal timeout interface has been -removed (Tcl_CreateModalTimeout/Tcl_DeleteModalTimeout) (SS) -*** POTENTIAL INCOMPATIBILITY *** - -4/23/97 (feature change) Channel drivers are now required to correctly -implement blocking behavior when they are in blocking mode. (SS) -*** POTENTIAL INCOMPATIBILITY *** - -4/23/97 (new feature) Added the "binary" command for manipulating -binary strings. Also, changed the "puts", "gets", and "read" commands -to preserve embedded nulls. (SS) - -4/23/97 (new feature) Added tcl_platform(byteOrder) element to the -tcl_platform array to identify the native byte order for the current -host. (SS) - -4/23/97 (bug fix) Fixed bug in date parsing around year boundaries. (SS) - -4/24/97 (bug fix) In the process of copying a file owned by another user, -Tcl was changing the owner of the copy back to the owner of the original -file, therefore causing further file operations to fail because the current -user didn't own the copy anymore. The owner of the copy is now left as the -current user. (CCS) - -4/24/97 (feature change) Under Windows, don't automatically uppercase the -environment variable "windir" -- it's supposed to be lower case. (CCS) - -4/29/97 (new feature) Added namespace support based on a namespace -implementation by Michael J. McLennan of Lucent Technologies. A namespace -encapsulates a collection of commands and variables to ensure that they -won't interfere the commands and variables of other namespaces. The global -namespace holds all global variables and commands. Additional namespaces are -created with the new namespace command. The new variable command lets you -create Tcl variables inside a namespace. The names of Tcl variables and -commands may now be qualified by the name of the namespace containing them. -The key namespace-related commands are summarized below: - - namespace ?eval? name arg ?arg...? - Used to define the commands and variables in a namespace. - Optionally creates the namespace. - - namespace export ?-clear? ?pattern pattern...? - Specifies which commands are exported from a namespace. These - are the ones that can be imported into another namespace. - - namespace import ?-force? ?pattern pattern...? - Makes the specified commands accessible in the current namespace. - - namespace current - Returns the name of the current namespace. - - variable name ?value? ?name ?value?...? - Creates one or more namespace variables. (BTL) - -5/1/97 (bug fix) Under Windows, file times were reported in GMT. Should be -reported in local time. (CCS) - -5/2/97 (feature change) Changed the name of the two Tcl variables used for -tracing bytecode compilation and execution to tcl_traceCompile and -tcl_traceExec respectively. These variables are now documented in the -tclvars man page. (BL) - -5/5/97 (new feature) Support "end" as the index for "lsort -index". (BW) - -5/5/97 (bug fixes) Cleaned up the way the http package resets connections (BW) - -5/8/97 (feature change) Newly created Tcl objects now have a reference count -of zero instead of one. This simplifies C code that stores newly created -objects in Tcl variables or in data structures such as list objects. That C -code must increment the new object's reference count since the variable or -data structure will contain a long-term reference to the object. Formerly, -when new objects started out with reference count one, it was necessary to -decrement the new object's reference count after the store to make sure it -was left with the correct value; this is no longer necessary. (BL) - -5/9/97 (new feature) Added the Tcl_GetsObj interface that takes an -object reference instead of a dynamic string (as in Tcl_Gets). (SS) - -5/12/97 (new feature) Added Tcl_CreateAliasObj and Tcl_GetAliasObj C APIs -to allow an alias command to be created with a vector of Tcl_Obj structures -and to get the vector back later. (JL) - -5/12/97 (feature change) Changed Tcl_ExposeCommand and Tcl_HideCommand to -leave an object result instead of a string result. (JL) - -5/14/97 (feature change) Improved the handling of the interpreter result. -This is still either an object or a string, but the two values are now kept -consistent unless some C code reads or writes interp->result directly. See -the SetResult man page for details. Removed the Tcl_ResetObjResult -procedure. (BL) -*** POTENTIAL INCOMPATIBILITY with Tcl 8.0a2 *** - -5/16/97 (new feature) Added "fcopy" command to move data between -channels. Refer to the manual page for more information. Removed the -"unsupported0" command since it is obsolete now. (SS) - -5/16/97 (new feature) Added Tcl_GetStringResult procedure to allow programs -to get an interpreter's result as a string. If the result was previously set -to an object, this procedure will convert the object to a string. Use of -Tcl_GetStringResult is intended to replace direct access to interp->result, -which is not safe. (BL) - -5/20/97 (new features) Fixed "fcopy" to return the number of bytes -transferred in the blocking case. Updated the http package to use -fcopy instead of unsupported0. Added -timeout and -handler options to -http_get. http_get is now blocking by default. It is only non-blocking -if you supply a -command argument. (BW) - -5/22/97 (bug fix) Fixed several bugs in the "lsort" command having to do -with the -dictionary option and the presence of numbers embedded in the -strings. (JO) - ------------------ Released 8.0b1, 5/27/97 ----------------------- - -6/2/97 (bug fix) Fixed bug in startup code that caused a problem in -finding the library files when they are installed in a directory -containing a space in the name. (SS) - -6/2/97 (bug fix) Fixed bug in Unix notifier where the select mask was -not being cleared under some circumstances. (SS) - -6/4/97 (bug fix) Fixed bug that prevented creation of Tk widgets in -namespaces. Tcl_CreateObjCommand and Tcl_CreateCommand now always create -commands in the global namespace unless the command names are qualified. Tcl -procedures continue to be created in the current namespace by default. (BL) - -6/6/97 (new features) Added new namespace API procedures -Tcl_AppendExportList and Tcl_Export to allow C code to get and set a -namespace's export list. (BL) - -6/11/97 (new feature) Added Tcl_ConcatObj. This object-based routine -parallels the string-based routine Tcl_Concat. (SRP) - -6/11/97 (new feature) Added Tcl_SetObjErrorCode. This object-based -routines parallels the string-based routine Tcl_SetErrorCode. (SRP) - -6/12/97 (bug fix) Fix the "unknown" procedure so that wish under Windows -will exec an external program, instead of always complaining "console1 not -opened for writing". (CCS) - -6/12/97 (bug fix) Fixed core dump experienced by the following simple -script: - interp create x - x alias exec exec - interp delete x -This panic was caused by not installing the new CmdDeleteProc when exec -got redefined by the alias creation step. Reported by Lindsay Marshal (JL) - -6/13/97 (new features) Tcl objects newly created by Tcl_NewObj now have a -string representation that points to a shared heap string of length 1. (They -used to have NULL bytes and typePtr fields. This was treated as a special -case to indicate an empty string, but made type manager implementations -complex and error prone.) The new procedure Tcl_InvalidateStringRep is used -to mark an object's string representation invalid and to free any storage -associated with the old string representation. (BL) -*** POTENTIAL INCOMPATIBILITY with Tcl 8.0b1, but not with Tcl7.6 *** - -6/16/97 (bug fix) Tcl_ScanCountedElement could leave braces unmatched -if the string ended with a backslash. (JO) - -6/17/97 (bug fix) Fixed channel event bug where readable events would be -lost during recursive events loops if the input buffers contained -data. (SS) - -6/17/97 (bug fix) Fixed bug in Windows socket code that didn't -reenable read events in the case where an external entity is also -reading from the socket. (SS) - -6/18/97 (bug fix) Changed initial setting of the notifier service mode -to TCL_SERVICE_NONE to avoid unexpected event handling during -initialization. (SS) - -6/19/97 (bug fix/feature change) The command callback to fcopy is now -called in case of errors during the background copy. This adds a second, -optional argument to the callback that is the error string. The callback -in case of errors is required for proper cleanup by the user of fcopy. (BW) -*** POTENTIAL INCOMPATIBILITY with Tcl 8.0b1, but not with Tcl 7.6 *** - -6/19/97 (bug fix) Fixed a panic due to the following four line script: - interp create x - x alias foo bar - x eval rename foo blotz - x alias foo {} -The problem was that the interp code was not using the actual current name -of the command to be deleted as a result of un-aliasing foo. (JL) - -6/19/97 (feature change) Pass interp down to the ChannelOption and -driver specific calls so system errors can be differentiated from syntax -ones. Changed Tcl_DriverGetOptionProc type. Affects Tcl_GetChannelOption, -TcpGetOptionProc, TtyGetOptionProc, etc. (DL) -*** POTENTIAL INCOMPATIBILITY *** - -6/19/97 (new feature) Added Tcl_BadChannelOption for use by by driver -specific option procedures (Set and Get) to return a complete and -meaningful error message. (DL) - -6/19/97 (bug fixes) If a system call error occurs while doing an -fconfigure on tcp or tty/com channel: return the appropriate error -message (instead of the syntax error one or none). (Fixed for Unix and -most of the Win and Mac drivers). (DL) - -6/20/97 (feature change) Eval is no longer assumed as the subcommand name -in namespace commands: you must now write "namespace eval nsName {...}". -Abbreviations of namespace subcommand names are now allowed. (BL) -*** POTENTIAL INCOMPATIBILITY with Tcl 8.0b1, but not with Tcl7.6 *** - -6/20/97 (feature change) Changed the errorInfo traceback message for -compilation errors from "invoked from within" to "while compiling". (BL) - -6/20/97 (bug fixes) Fixed various compilation-related bugs: - - "UpdateStringOfCmdName should never be called" and - "UpdateStringOfByteCode should never be called" panics. - - Segfault in TclObjInterpProc getting procedure name after evaluation - stack is reallocated (grown). - - Could not use ":" at end of variable and command names. - - Bad code generated for while and for commands with test expressions - enclosed in quotes: e.g., "set i 0; while "$i > 5" {}". - - Command trace procedures would crash if they did a Tcl_EvalObj that - reallocated the evaluation stack. - - Break and continue commands did not reset the interpreter result. - - The Tcl_ExprXXX routines, both string- or object-based, always - modified the interpreter result even if there was no error. - - The argument parsing procedure used by several compile procedures - always treated "]" as end of a command: e.g., "set a ]" would fail. - - Changed errorInfo traceback message for compilation errors from - "invoked from within" to "while compiling". - - Problem initializing Tcl object managers during interpreter creation. - - Added check and error message if formal parameter to a procedure is - an array element. (BL) - -6/23/97 (new feature) Added "registry" package to allow manipulation -of the Windows system registry. See manual entry for details. (SS) - -6/24/97 (feature change) Converted http to a package and added the -http1.0 subdirectory of the Tcl script library. This means you have -to do a "package require http" to use this, as advertised in the man page. (BW) -*** POTENTIAL INCOMPATIBILITY with Tcl 8.0b1, but not with Tcl 7.6 *** - -6/24/97 (bug fix) Ensure that Tcl_Set/GetVar C APIs, when called without -TCL_LEAVE_ERR_MSG, don't touch the interp result. (DL) - -6/26/97 (feature change) Changed name of Tcl_ExprStringObj to -Tcl_ExprObj. (BL) -*** POTENTIAL INCOMPATIBILITY with Tcl 8.0b1, but not with Tcl 7.6 *** - ------------------ Released 8.0b2, 6/30/97 ----------------------- - -7/1/97 (new feature) TCL_BUILD_SHARED flag set in tclConfig.sh -when Tcl has been built with --enable-shared. A new tclLibObjs -make target, echoing the list of the .o's needed to build a tcl -library, is now provided. (DL) - -7/1/97 (feature change) compat/getcwd.c removed and changed the -only place where getcwd is used so a new USEGETWD flag selects -the use of the replacement "getwd". Adding this flag is recommended -for SunOS 4 (because getcwd on SunOS 4 uses a pipe to pwd(1)!). (DL) - -7/7/97 (feature change) The split command now supports binary data (i.e., -null characters in strings). (BL) - -7/7/97 (bug fix) string first returned the wrong result if the first -argument string was empty. (BL) - -7/8/97 (bug fix) Fixed core dump in fcopy that could occur when a command -callback was supplied and an error or eof condition caused no background -activity. A refcount bug triggered a panic in Tcl_ListObjAppendElement. (BW) - -7/8/97 (bug fix) Relaxed the pattern matching on http_get so you do not -need a trailing path component. You can now get away with just -http_get www.scriptics.com (BW) - -7/9/97 (bug fix) Creating anonymous interpreters no longer smashes existing -commands with names similar to the generated name. Previously creating an -anonymous interpreter could smash an existing command, now it skips until -it finds a command name that isn't being used. (JL) - -7/9/97 (feature change) Removed the policy management mechanism from the -Safe Base; left the aliases to source and load modules, and to do a limited -form of the "file" command. See entry of 11/15/96. (JL) - -7/9/97 (bug fixes) Fixed various compilation-related bugs: - - Line numbers in errorInfo now are the same as those in Tcl7.6 unless -there are compilation errors. Compilation error messages now include the -entire command in error. - - Trailing ::s after namespace names weren't being ignored. - - Could not refer to an namespace variable with an empty name using a -name of the form "n::". (BL) - -7/9/97 (bug fix) Fixed bug in Tcl_Export that prevented you from exporting -from other than the current namespace. (BL) - -7/9/97 (bug fix) env.test was removing env var needed for proper finding -of libraries in child process. (DL) - -7/10/97 (bug fixes/new feature) Cleanup in Tcl_MakeSafe. Less information -is leaked to safe interps. Error message fixes for interp sub commands. -Likewise changes in safealias.tcl; tcl_safeCreateInterp can now be called -without argument to generate the slave name (like in interp create). (DL) - -7/10/97 (bug fixes) Bytecode compiler now generates more detailed -command location information: subcommands as well as commands now have -location information. This means command trace procedures now get the -correct source string for each command in their command parameter. (BL) - -7/22/97 (bug fixes) Performance improvement in Safe interpreters -handling. Added new mask value to (tclInt.h) Interp.flags record. (DL) - -7/22/97 (bug fix) Fixed panic in 'interp target {} foo'. This bug -was present since Tcl 7.6. (JL) - -7/22/97 (bug fix) Fixed bug in compilation of procedures in namespaces: the -procedure's namespace must be used to look up compile procedures, not the -current namespace. (BL) - -7/22/97 (bug fix) Use of the -channel option of http_get was not setting -the end of line translations mode on the channel, so copying binary data -with the -channel option was corrupting the result on non-unix platforms. (BW) - -7/22/97 (bug fixes) file commands and ~user (seg fault and other -improper returns). (DL) - -7/23/97 (feature change) Reenabled "vwait" in Safe Base. (JL) - -7/23/97 (bug fixes) Fixed two bugs involving read traces on array variables -in procedures: trace procedures were sometimes not called, and reading -nonexistant array elements didn't create undefined element variables that -could later be defined by trace procedures. (BL) - -7/24/97 (bug fix) Windows memory allocation performance was -superlinear in some cases. Made the Mac allocator generic and changed -both the Mac and Windows platforms to use the new allocator instead of -malloc and free. (SS) - -7/24/97 - 8/12/97 (bug fixes/change of features) Completely revamped safe -sourcing/loading (see safe.n) to hide pathnames, use virtual -paths tokens instead, improved security in several respects and made it -more tunable. Multi level interp loading can work too now. Package auto -loading now works in safe interps as long as the package directory is in -the auto_path (no deep crawling allowed in safe interps). (DL) -*** POTENTIAL INCOMPATIBILITY with previous alpha and beta releases *** - -7/24/97 (bug fixes) Made Tcl_SetVar* and Tcl_NewString* treat a NULL value -as an empty string. (This fixes hairy crash case where you would crash -because load command for other interps assumed presence of -errorInfo...). (DL) - -7/28/97 (bug fix) Fixed pkg_mkIndex to understand namespaces. It will -use the export list of a namespace and create auto_index entries for -all export commands. Those names are in their fully qualified form in the -auto_index. Therefore, I tweaked unknown to try both $cmd and ::$cmd. -Also fixed pkg_mkIndex so you can have "package require" commands inside -your packages. These commands are ignored, which is mostly ok except -when you must load another package before loading yours because of -linking dependencies. (BW) - -7/28/97 (bug fix) A variable created by the variable command now persists -until the namespace is destroyed or the variable is unset. This is true even -if the variable has not been initialized; these variables used to be -destroyed if an error occurred when accessing them. In addition, the "info -vars" command lists uninitialized namespace variables, while the "info -exists" command returns 0 for them. (BL) - -7/29/97 (feature change) Changed the http package to use the ::http -namespace. http_get renamed to http::geturl, http_config renamed to -http::config, http_formatQuery renamed to http::formatQuery. -It now provides the 2.0 version of the package. -The 1.0 version is still available with the old names. -*** POTENTIAL INCOMPATIBILITY with Tcl 8.0b2 but not with Tcl 7.6 *** - -7/29/97 (bug fix, new feature) Tcl_Main now uses Tcl objects internally to -preserve NULLs in commands and command output. Added new API procedure -Tcl_RecordAndEvalObj that resembles Tcl_RecordAndEval but takes an object -containing a command. (BL) - -7/30/97 (bug fix) Tcl freed strings in the environ array even if it -did not allocate them. (SS) - -7/30/97 (bug fix) If a procedure is renamed into a different namespace, it -now executes in the context of that namespace. (BL) - -7/30/97 (bug fix) Prevent renaming of commands into and from namespaces as -part of hiding them. (JL) - -7/31/97 (feature change) Moved the history command from C to tcl. -This uses the ::history namespace. The "words" and "substitute" options -are no longer supported. In addition, the "keep" option without a value -returns the current keep limit. There is a new "clear" option. -The unknown command now supports !! again. (BW) -*** POTENTIAL INCOMPATIBILTY *** - -7/30/97 (bug fix) Made sure that a slave can not fool the master into -hiding the wrong command. Made sure we don't crash in hiding + namespaces -issues. (DL) - -8/4/97 (bug fix) Concat, eval, uplevel, and similar commands were -incorrectly trimming trailing space characters from their arguments -even when the space characters were preceded by a backslash. (JO) - -8/4/97 (bug fix) Removed the hard link between bgerror and tkerror. -Only bgerror is supported in tcl core. Tk will still look for a -tkerror but using regular tcl code for that feature. (DL) -*** POTENTIAL INCOMPATIBILTY with code relying on the hard link *** - -8/6/97 (bug fix) Reduced size required for compiled bytecodes by using a -more compact encoding for the command pc-to-source map. (BL) - -8/6/97 (new feature) Added support for additional compilation and execution -statistics when Tcl is compiled with the TCL_COMPILE_STATS flag. (BL) - -8/7/97 (bug fix) Expressions not in {}s that have a comparison operator as -the topmost operator must be compiled out-of-line (call the expr cmd at -runtime) to properly support expr's two-level substitution semantics. An -example is "set a 2; set b {$a}; puts [expr $b == 2]". (BL) - -8/11/97 (bug fix) The catch command would sometimes crash if a variable name -was given and the bytecode evaluation stack was grown when executing the -argument script. (BL) - -8/12/97 (feature change) Reinstated the variable tcl_precision to control -the number of digits used when floating-point values are converted to -strings, with default of 12 digits. However, had to make tcl_precision -shared among all interpreters (except that safe interpreters can't -modify it). This makes the Tcl 8.0 behavior almost identical to 7.6 -except that the default precision is 12 instead of 6. (JO) -*** POTENTIAL INCOMPATIBILITY *** - ------------------ Released 8.0, 8/18/97 ----------------------- - -8/19/97 (bug fix) Minimal fix for glob -nocomplain bugs: -"glob -nocomplain unreadableDir/*" was generating an anonymous -error. More in depth fixes will come with 8.1. (DL). - -8/20/97 (bug fix) Removed check for FLT_MIN in binary command so -underflow conditions are handled by the compiler automatic -conversions. (SS) - -8/20/97 (bug fixes) Fixed several compilation-related bugs: - - Array cmd wasn't detecting arrays that, while compiled, do not yet - exist (e.g., are marked undefined since they haven't been assigned - to yet). - - The GetToken procedure in tclCompExpr.c wasn't recognizing properly - whether an integer token was invalid. For example, "0x$" is not - a valid integer. - - Performance bug in TclExecuteByteCode: the size of its stack frame - was reduced by over 20% by moving errorInfo code elsewhere. - - Uninitialized memory read error in tclCompile.c. (BL) - -8/21/97 (bug fix) safe::interpConfigure now behave like Tk widget's -configure : it changes only the options you provide and you can get -the current value of any single option. New ?-nested boolean? and -?-statics boolean? for all safe::interp* commands but we still -accept (upward compatibility) the previously defined non valued -flags ?-noStatics? and ?-nestedLoadOk?. Improved the documentation. (DL). - -8/22/97 (bug fix) Updated PrintDbl.3 to reflect the fact that the -tcl_precision variable is still used and that it is now shared by all -interpreters. (BL) - -8/25/97 (bug fix) Fixed array access bug in IllegalExprOperandType -procedure in tclExecute.c: it was not properly supporting the || and && -operators. (BL) - -8/27/97 (bug fix) In cases where a channel handler was created with an -empty event mask while data was still buffered in the channel, the -channel code would get stuck spinning on a timer that would starve -idle handlers. This mostly happened in Tk when reading from stdin. (SS) - -9/4/97 (bug fix) Slave interps now inherit the maximum recursion limit -of their parent instead of starting back at the default. {nb: this still -does not prevent stack overflow by multi-interps recursion or aliasing} (DL) - -9/11/97 (bug fix) An uninitialized variable in Tcl_WaitPid caused -pipes to fail to report eof properly under Windows. (SS) - -9/12/97 (bug fix) "exec" was misidentifying some DOS executables as not -executable. (CCS) - -9/14/97 (bug fix) Was using the wrong structure in sizeof operation in -tclUnixChan.c. (JL) - -9/15/97 (bug fix) Fixed notifier to break out of do-one-event loop if -Tcl_WaitForEvent returns 1, so that callers of Tcl_DoOneEvent will get -a chance to check whether the event just handled is significant. This -affected mainly recursive calls to Tcl_VWaitCmd; these did not get a -chance to notice that the variable they were waiting for has been set -and thus they didn't terminate the vwait. (JL, DL, SS) - -9/15/97 (bug fix) Alignment problems in "binary format" would cause a -crash on some platforms when formatting floating point numbers. (SS) - -9/15/97 (bug fix) Fixed bug in Macintosh socket code. Now passes all -tests in socket.test that are not platform specific. (Thanks to Mark -Roseman for the pointer on the fix.) (RJ) - -9/18/97 (bug fix) Fixed bug -dictionary option of lsort that could -cause the compare function to run off the end of an array if the -number only contained 0's. (Thanks to Greg Couch for the report.) (RJ) - -9/18/97 (bug fix) TclFinalizeEnvironment was not cleaning up -properly. (DL, JI) - -9/18/97 (bug fix) Fixed long-standing bug where an "array get" command -did not trigger traces on the array or its elements. (BL) - -9/18/97 (bug fixes) Fixed compilation-related bugs: - - Fixed errorInfo traceback information for toplevel coomands that - contain nested commands. - - In the expr command, && and || now accept boolean operands as well - as numeric ones. (BL) - -9/22/97 (bug fix) Fixed bug that prevented translation modes from being -set independently for input and output on sockets if input was "auto". (JL) - -9/24/97 (bug fix) Tcl_EvalFile(3) and thus source(n) now works fine on -files containing NUL chars. (DL) - -9/26/97 (bug fix) Fixed use of uninitialized memory in the environ array -that later could cause random core dumps. Applies to all platforms. (JL) - -9/26/97 (bug fix) Fixed use of uninitialized memory in socket address data -structure under some circumstances. This could cause random core dumps. -This applies only to Unix. (JL) - -9/26/97 (bug fix) Opening files on PC-NFS volumes would cause a hang -until the system timed after the file was closed. (SS) - -10/6/97 (bug fix) The join(n) command, though objectified, was loosing -NULs in the joinString and in list elements after the 2nd one. -Now you can "join $list \0" for instance. (DL) - -10/9/97 (bug fix) Under windows, if env(TMP) or env(TEMP) referred to a -non-existent directory, exec would fail when trying to create its temporary -files. (CCS) - -10/9/97 (bug fix) Under mac and windows, "info hostname" would crash if -sockets were installed but the hostname could not be determined anyhow. -Tcl_GetHostName() was returning NULL when it should have been returning -an empty string. (CCS) - -10/10/97 (bug fix) "file attribute /" returned error on windows. (CCS) - -10/10/97 (bug fix) Fixed the auto_load procedure to handle procedures -defined in namespaces better. Also fixed pgk_mkIndex so it sees procedures -defined in nested namespaces. Index entries are still only made for -exported procedures. (BW) - -10/13/97 (bug fix) On unix, for files with unknown group or owner -attributes, querying the "file attributes" would return an error rather than -returning the group's or owner's id number, although tha command accepts -numbers when setting the file's group or owner. (CCS) - -10/22/97 (bug fix) "fcopy" did not eval the callback script at the -global scope. (SS) - -10/22/97 (bug fix) Fixed the signature of the CopyDone callback used in -the http package(s) so they can handle error cases properly. (BW) - -10/28/97 (bug fixes) Fixed a problem where lappend would free the Tcl object -in a variable if a Tcl_ObjSetVar2 failed because of an error calling a trace -on the variable. (BL) - -10/28/97 (bug fix) Changed binary scan to properly handle sign -extension of integers on 64-bit or larger machines. (SS) - -11/3/97 (bug fixes) Fixed several bugs: - - expressions such as "expr ($x)" must be compiled out-of-line - (call the expr command procedure at runtime) to ensure the correct - behavior when "$x" is an expression such as "5+10". - - "array set a {}" now creates a new array var with an empty array - value if the var didn't already exist. - - "lreplace $foo end end" no longer returns an error (just an empty - list) if foo is empty. - - upvar will no longer create a variable in a namespace that refers - to a variable in a procedure. - - deleting a command trace within a command trace callback would - make the code that calls traces to reference freed memory. - - significantly sped up "string first" and "string last" (fix from - darrel@gemstone.com). - - seg fault in Tcl_NewStringObj() when a NULL is passed as the byte - pointer argument and Tcl is compiled with -DTCL_MEM_DEBUG. - - documentation and error msg fixes. (BL) - -11/3/97 (bug fix) Fixed a number of I/O bugs related to word sizes on -64-bit machines. (SS) - -11/6/97 (bug fix) The exit code of the first process created by Tcl -on Windows was not properly reported due to an initialization -problem. (SS) - ------------------ Released 8.0p1, 11/7/97 ----------------------- - -11/19/97 (bug fix) Fixed bug in linsert where it sometimes accidently -cleared out a shared argument list object. (BL). - -11/19/97 (bug fix) Autoloading in namespaces was not working properly. -auto_mkindex is still not really namespace aware but most common -cases should now be handled properly (see init.test). (BW, DL) - -11/20/97 (enhancement) Made the changes required by the new Apple -Universal Headers V.3.0, so that Tcl will compile with CW Pro 2. - -11/24/97 (bug fix) Fixed tests in clock test suite that needed the --gmt flag set. Thanks to Jan Nijtmans for reporting the problem. (RJ) - ------------------ Released 8.0p2, 11/25/97 ----------------------- - -12/3/97 (bug fix/optimization) Removed uneeded and potentially dangerous -instances of double evaluations if "if" and "expr" statements from -the library files. It is recommended that unless you need a double -evaluation you always use "expr {...}" instead of "expr ..." and -"if {...} ..." instead of "if ... ...". It will also be faster -thanks to the byte compiler. (DL) - ----- Shipped as part of the plugin2.0b5 as 8.0p2Plugin1, Dec 8th 97 ---- - -12/8/97 (bug fix) Need to protect the newly accepted channel in an -accept callback on a socket, otherwise the callback may close it and -cause an error, which would cause the C code to attempt to close the -now deleted channel. Bumping the refcount assures that the channel sticks -around to be really closed in this case. (JL) - -12/8/97 (bug fix) Need to protect the channel in a fileevent so that it -is not deleted before the fileevent handler returns. (CS, JL) - -12/18/97 (bug fix) In the opt argument parsing package: if the description -had only flags, the "too many arguments" case was not detected. The default -value was not used for the special "args" ending argument. (DL) - -1/15/98 (improvement) Moved common part of initScript in common file. -Moved windows specific initialization to init.tcl so you can initialize -Tcl in windows without having to call Tcl_Init which is now only -searching for init.tcl {back ported from 8.1}. (DL) - ----- Shipped as part of the plugin as 8.0p2Plugin2, Jan 15th 98 ---- - -5/27/98 (bug fix) Windows socket driver did not notice new data arriving -on nonblocking sockets until the event loop was entered. (SS) - -5/27/98 (bug fix) Windows socket driver used FIONREAD, which is not -supported correctly by WinSock. (SS) - -6/9/98 (bug fix) Generic channel code failed to report readable file -events on buffered data that was left behind by a gets or read that -did not consume all available data. (SS) - -6/18/98 (bug fix) Compilation of loop expressions was too aggressive -and incorrectly inlined non-literal expressions. (SS) - -6/18/98 (bug fix) "info var" and "info locals" incorrectly reported -the existence of compiler temporary variables. (SS) - -6/18/98 (bug fix) Dictionary sorting used signed character -comparisons. (SS) - -6/18/98 (bug fix) Compile procs corrupted the exception stack in some -cases. (SS) - -6/18/98 (bug fix) Array set had erratic behavior when initializing a -variable from an empty value list. (SS) - -6/18/98 (bug fix) The Windows registry package had a bad bounds check -that could lead to a crash. (SS) - -6/18/98 (bug fix) The foreach compile proc did not correctly handle -non-local variable references. (SS) - -6/25/98 (new features) Added name resolution hooks to support [incr Tcl]. -There are new internal Tcl_*Resolver* APIs to add, query and remove the hooks. -With this changes it should be possible to dynamically load [incr Tcl] -as an extension. (MM) - -7/1/97 (bug fix) The commands "info args, body, default, procs" did -not correctly handle imported procedures. (RJ) - -7/6/98 (improvement) pkg_mkIndex now implements the "package require" -command. This makes it possible to create index files for packages -that require another package and then execute code from that package in -their file. Previously, this would throw an error because the required -package had not been loaded. The -nopkgrequied flag is provided to -revert back to the old functionality. (EMS) - -7/6/98 (improvement) back-ported the -direct flag from 8.1 into -pkg_mkIndex. This results in pkgIndex.tcl files that contain direct -source or load commands instead of tclPkgSetup commands. (EMS) - -7/6/98 (improvement) made changes to the AuxData items structures to support -storage of compiled scripts on disk. Also some related minor changes in -the compilation and execution engine. (EMS) - -6/4/98 (enhancement) Added new internal routines to support inserting -and deleting from the stat, access, and open-file-channel mechanisms. -TclAccessInsertProc, TclStatInsertProc, & TclOpenFileChannelInsertProc -insert pointers to such routines; TclAccessDeleteProc, TclStatDeleteProc, -& TclOpenFileChannelDeleteProc delete pointers to such routines. See -the file generic/tclIOUtils.c for more details. (SKS) - -7/1/98 (enhancement) Added a new internal C variable -tclPreInitScript. This is a pointer to a string that may hold an -initialization script; If this pointer is non-NULL it is evaluated in -Tcl_Init() prior to the built-in initialization script defined in the -file generic/tclInitScript.h. (SKS) - -7/6/98 (bug fix) Removed dead code in PlatformInitExitHandler so that -the TCL_LIBRARY value can be safely patched in binaries. (BW) - -7/24/98 (enhancement) Incorporated a new version of auto_mkindex that -can support the [incr Tcl] class structures. This version will index -all procedures in a source file, not just those where "proc" starts -at the beginning of the line. If you want the old behavior, use the -auto_mkindex_old procedure. (MM) - -7/24/98 (feature change) Changed the Windows registry key to be -HKEY_LOCAL_MACHINE\Software\Scriptics\Tcl\8.0, and to store the path -in the default value instead of "Root". Also, this key can be -specified at compile time in case Tcl is being used in a different -context where it needs an alternate library path from the standard Tcl -installation. (SS) - -7/24/98 (feature change) Changed the search order for init.tcl. The -tcl_library variable can now be set before calling Tcl_Init to avoid -doing any searches. If it isn't set, then Tcl checks -env(TCL_LIBRARY), the static value set at compile time, an install -directory relative to the executable, a source directory relative to -the executable, and a tcl directory relative to the source heirarchy -containing the executable. See the comment at the top of -generic/tclInitScript.h for more details. (SS) - -7/27/98 (config change) Changed the use of the DBGX flag in configure.in -and the makefile to be TCL_DBGX. Users of tclConfig.sh may need to pass -this through their configure files with AC_SUBST. (BW) - -729/98 (bug fix) Changed [info body] to return a copy of the body of a -compiled procedure instead of the body itself, to avoid invalidation -of the internal rep and loss of the byte-codes. (EMS) - -8/5/98 (bug fix) The platform init code could walk off the end of a -buffer when reading the PkgPath registry value on Windows. (SS) - -8/5/98 (Windows makefile change) Introduced a set of macros to deal with -exporting symbols when compiling DLLS on Windows. See win/README for -details. (EMS) - -8/5/98 (addendum) Added a second Windows registry key under -HKEY_LOCAL_MACHINE\Software\Scriptics\Tcl\8.0, named "pkgPath". -This is a multi-string value used to initialize the tcl_pkgPath -variable. This is required if extension DLLs are in architecture specific -subdirectories. (SS) - -8/6/98 (new feature) Added tcl_findLibrary to init.tcl for use by -extensions, including Tk. This searches in a canonical way for -an extensions library directory and initialization file. (BW) - -8/10/98 (bug fix) Imported commands used to get lost if the target -of the import was redefined. Tcl_CreateCommand and Tcl_CreateObjCommand -were updated to restore import links. (Note that if you rename a command, -the import links move to the new name, and if you delete a command then -the import links get lost. These semantics have not changed.) (MC) - --------- Released 8.0.3 to the Tcl Consortium CD-ROM project, 8/10/98 ------ - -9/3/98 (bug fix) Tcl_Realloc was failing under Windows because the -GlobalReAlloc API was not correctly re-allocating blocks that were -32k+. The fix was to use newer Win32 APIs (HeapAlloc, HeapFree, and -HeapReAlloc.) (BS) - -10/5/98 (bug fix) Fixed bug in pkg_mkIndex that caused some files that do -a "package require" of packages in the Tcl libraries to give a warning like - warning: "xx.tcl" provides more than one package ({xx 2.0} {yy 0.3}) -and generate a broken pkgIndex.tcl file. (EMS) - -10/5/98 (bug fix) Pkg_mkIndex was not doing a case-insensitive comparison -of extensions to determine whether to load or source a file. Thus, under -Windows, MYDLLNAME.DLL was sourced, and mydllname.dll loaded. (EMS) - -10/5/98 (new feature) Created a new Tcl_Obj type, "procbody". This object's -internal representation holds a pointer to a Proc structure. Extended -TclCreateProc to take both strings and "procbody". (EMS) - -10/13/98 (bug fix) The "info complete" command can now handle strings -with NULLs embedded. Thanks to colin@field.medicine.adelaide.edu.au -for providing this fix. (RJ) - -10/13/98 (bug fix) The "lsort -dictionary" command did not properly -handle some numbers starting with 0. Thanks to Richard Hipp - for submitting the fix to Scriptics. (RJ) - -10/13/98 (bug fix) The function Tcl_SetListObj was creating an invalid -Tcl_Obj if the list had zero elements (despite what the comments said -it would do). Thanks to Sebastian Wangnick for reporting the -problem. (RJ) - -10/20/98 (new feature) Added tcl_platform(debug) element to the -tcl_platform array on Windows platform. The existence of the debug -element of the tcl_platform array indicates that the particular Tcl -shell has been compiled with debug information. Using -"info exists tcl_platform(debug)" a Tcl script can direct the -interpreter to load debug versions of DLLs with the load -command. (SKS) - -10/20/98 (feature change) The Makefile and configure scripts have been -changed for IRIX to build n32 binaries instead of the old 32 abi -format. If you have extensions built with the o32 abi's you will need -to update them to n32 for them to work with Tcl. (RJ) -*** POTENTIAL INCOMPATIBILITY *** - -10/23/98 (bug fix) tcl_findLibrary had a stray ] in one of the -pathnames it searched for the initialization script. tclInitScript.h -was incorrectly adding the parent of tcl_library to tcl_pkgPath. This -logic was moved into init.tcl, and the initialization of auto_path was -documented. Thanks to Donald Porter and Tom Silva for related -patches. (BW) - -10/29/98 (bug fix) Fixed Tcl_NotifyChannel to use Tcl_Preserve instead -of Tcl_RegisterChannel so that 1) unregistered channels do not get -closed after their first fileevent, and 2) errors that occur during -close in a fileevent script are actually reflected by the close -command. (BW) - -10/30/98 (bug fix) Overhaul of pkg_mkIndex to deal with transitive -package requires and packages split among scripts and binary files. -Also fixed ommision of global for errorInfo in tcl_findLibrary. (BW) - -11/08/98 (bug fix) Fixed the resource command to always detect -the case where a file is opened a second time with the same -permissions. IM claims that this will always cause the same -FileRef to be returned, but in MacOS 8.1+, this is no longer the case, -so we have to test for this explicitly. (JI) - -11/10/98 (feature change) When compiling with Metrowerk's MSL, use the -exit function from MSL rather than ExitToShell. This allows MSL to -clean up its temporary files. Thanks to Vince Darley for this -improvement. (JI) - ------------------ Released 8.0.4, 11/19/98 ------------------------- - -11/20/98 (bug fix) Handle possible NULL return in TclGetStdFiles. (RJ) - -11/20/98 (bug fix) The dltests would not build on SGI. They reported -that you could not mix n32 with 032 binaries. The configure script -has been modified to get the EXTRA_CFLAGS from the tcl configure -script. [Bug id: 840] (RJ) - -12/3/98 (bug fix) Windows NT creates sockets so they are inheritable -by default. Fixed socket code so it turns off this bit right after -creation so sockets aren't kept open by exec'ed processes. [Bug: 892] -Thanks to Kevin Kenny for this fix. (SS) - -1/11/98 (bug fix) On HP, "info sharedlibextension" was returning -empty string on static apps. It now always returns ".sl". (RJ) - -1/28/99 (configure change) Now support -pipe option on gcc. (RJ) - -2/2/99 (bug fix) Fixed initialization problem on Windows where no -searching for init.tcl would be performed if the registry keys were -missing. (stanton) - -2/2/99 (bug fix) Added support for HKEY_PERFORMANCE_DATA and -HKEY_DYN_DATA keys in the "registry" command. (stanton) - -2/2/99 (bug fix) ENOTSUP and EOPNOTSUPP clashed on some Linux -variants. (stanton) - -2/2/99 (enhancement) The "open" command has been changed to use the -object interfaces. (stanton) - -2/2/99 (bug fix) In some cases Tcl would crash due to an overflow of -the exception stack resulting from a missing byte code in some -expressions. (stanton) - -2/2/99 (bug fix) Changed configure so Linux and IRIX shared libraries -are linked with the system libraries. (stanton) - -2/2/99 (bug fix) Added support for BSDI 4.x (BSD/OS-4*) to the -configure script. (stanton) - -2/2/99 (bug fix) Fixed bug where upvar could resurrect a namespace -variable after the namespace had been deleted. (stanton) - -2/2/99 (bug fix) In some cases when creating variables, the -interpreter result was being modified even if the TCL_LEAVE_ERR_MSG -flag was set. (stanton) - -2/2/99 (bug fix & new feature) Changed the socket drivers to properly -handle failures during an async socket connection. Added a new -fconfigure option "-error" to retrieve the failure message. See the -socket.n manual entry for details. (stanton) - -2/2/99 (bug fix) Deleting a renamed interp alias could result in a -panic. (stanton) - -2/2/99 (feature change/bug fix) Changed the behavior of "file -extension" so that it splits at the last period. Now the extension of -a file like "foo..o" is ".o" instead of "..o" as in previous versions. -*** POTENTIAL INCOMPATIBILITY *** - ------------------ Released 8.0.5, 3/9/99 ------------------------- - -======== Changes for 8.0 go above this line ======== -======== Changes for 8.1 go below this line ======== - -6/18/97 (new feature) Tcl now supports international character sets: - - All C APIs now accept UTF-8 strings instead of iso8859-1 strings, - wherever you see "char *", unless explicitly noted otherwise. - - All Tcl strings represented in UTF-8, which is a convenient - multi-byte encoding of Unicode. Variable names, procedure names, - and all other values in Tcl may include arbitrary Unicode characters. - For example, the Tcl command "string length" returns how many - Unicode characters are in the argument string. - - For Java compatibility, embedded null bytes in C strings are - represented as \xC080 in UTF-8 strings, but the null byte at the end - of a UTF-8 string remains \0. Thus Tcl strings once again do not - contain null bytes, except for termination bytes. - - For Java compatibility, "\uXXXX" is used in Tcl to enter a Unicode - character. "\u0000" through "\uffff" are acceptable Unicode - characters. - - "\xXX" is used to enter a small Unicode character (between 0 and 255) - in Tcl. - - Tcl automatically translates between UTF-8 and the normal encoding for - the platform during interactions with the system. - - The fconfigure command now supports a -encoding option for specifying - the encoding of an open file or socket. Tcl will automatically - translate between the specified encoding and UTF-8 during I/O. - See the directory library/encoding to find out what encodings are - supported (eventually there will be an "encoding" command that - makes this information more accessible). - - There are several new C APIs that support UTF-8 and various encodings. - See Utf.3 for procedures that translate between Unicode and UTF-8 - and manipulate UTF-8 strings. See Encoding.3 for procedures that - create new encodings and translate between encodings. See - ToUpper.3 for procedures that perform case conversions on UTF-8 - strings. - -9/18/97 (enhancement) Literal objects are now shared by the ByteCode -structures created when compiled different scripts. This saves up to 45% -of the total memory needed for all literals. (BL) - -9/24/97 (bug fixes) Fixed Tcl_ParseCommand parsing of backslash-newline -sequences at start of command words. Suppressed Tcl_EvalDirect error logging -if non-TCL_OK result wasn't an error. (BL) - -10/17/97 (feature enhancement) "~username" now refers to the users' home -directory on Windows (previously always returned failure). (CCS) - -10/20/97 (implementation change) The Tcl parser has been completely rewritten -to make it more modular. It can now be used to parse a script without actually -executing it. The APIs for the new parser are not correctly exported, but -they will eventually be exported and augmented with Tcl commands so that -Tcl scripts can parse other Tcl scripts. (JO) - -10/21/97 (API change) Added "flags" argument to Tcl_EvalObj, removed -Tcl_GlobalEvalObj procedure. Added new procedures Tcl_Eval2 and -Tcl_EvalObjv. (JO) -*** POTENTIAL INCOMPATIBILITY *** - -10/22/97 (API change) Renamed Tcl_ObjSetVar2 and Tcl_ObjGetVar2 to -Tcl_SetObjVar2 and Tcl_GetObjVar2 (for consistency with other C APIs) -and changed the name arguments to be strings instead of objects. (JO) -*** POTENTIAL INCOMPATIBILITY *** - -10/27/97 (enhancement) Bytecode compiler rewritten to use the new Tcl -parser. (BL) - -11/3/97 (New routines) Added Tcl_AppendObjToObj, which appends the -string rep of one Tcl_Obj to another. Added Tcl_GetIndexFromObjStruct, -which is similar to Tcl_GetIndexFromObj, except that you can give an -offset between strings. This allows Tcl_GetIndexFromObjStruct to be -called with a table of records which have strings in them. (SRP) - -12/4/97 (enhancement) New Tcl expression parser added. Added new procedure -Tcl_ParseExpr and new token types TCL_TOKEN_SUB_EXPR and -TCL_TOKEN_OPERATOR. Expression compiler is reimplemented to use this -parser. (BL) - -12/9/97 (bug fix) Tcl_EvalObj() increments/decrements the refcount of the -script object to prevent the object from deleting itself while in the -middle of being evaluated. (CCS) - -12/9/97 (bug fix) Memory leak in Tcl_GetsObjCmd(). (CCS) - -12/11/97 (bug fix) Environment array leaked memory when compiled with -Visual C++. (SS) - -12/11/97 (bug fix) File events and non-blocking I/O did not work on -pipes under Windows. Changed to use threads to achieve non-blocking -behavior. (SS) - -12/18/97 (bug fixes) Fixed segfault in "namespace import"; importing a -procedure that causes a cycle now returns an error. Modified "info procs", -"info args", "info body", and "info default" to return information about -imported procedures as well as procedures defined in a namespace. (BL) - -12/19/97 (enhancement) Added new Tcl_GetString() procedure that can be used -in place of Tcl_GetStringFromObj() if the string representation's length -isn't needed. (BL) - -12/18/97 (bug fix) In the opt argument parsing package: if the description -had only flags, the "too many arguments" case was not detected. The default -value was not used for the special "args" ending argument. (DL) - -1/7/98 (clean up) Moved everything not absolutly necessary out of init.tcl -procs now in auto.tcl and package.tcl can be autoloaded if needed. (DL) - -1/7/98 (enhancement) tcltest made at install time will search for it's -init.tcl where it is, even when using virtual path compilation. (DL) - -1/8/98 (os bug workaround) when needed, using a replacement for memcmp so -string compare "char with high bit set" "char w/o high bit set" returns -the expected value on all platforms. (DL) - -1/8/98 (unix portability/configure) building from .../unix/targetName/ -subdirectories and simply using "../configure" should now work fine. (DL) - -1/14/98 (enhancement) Added new regular expression package that -supports AREs, EREs, and BREs. The new package includes new escape -characters, meta-syntax, and character classes inside brackets. -Regexps involving backslashes may behave differently. (MH) -*** POTENTIAL INCOMPATIBILITY *** - -1/16/98 (os workaround) Under windows, "file volume" was causing chatter -and/or several seconds of hanging when querying empty floppy drives. -Changed implementation to call an empirically-derived function that doesn't -cause this. (CCS) - -1/16/98 (enhancement) Converted regular expressions to a Tcl_Obj type so -their compiled form gets cached automatically. Reduced NSUBEXP from 100 -to 20. (BW) - -1/16/98 (documentation) Change unclear documentation and comments for -functions like Tcl_TranslateFileName() and Tcl_ExternalToUtfDString(). Now -it explicitly says they take an uninitialized or free DString. A DString -that is "empty" or "not holding anything" could have been interpreted as one -currently with a zero length, but with a large dynamically allocated buffer. -(CCS) - ------------------ Released 8.1a1, 1/22/98 ----------------------- - -1/28/98 (new feature) Added a "-direct" optional flag to pkg_mkIndex -to generate direct loading package indexes (such those you need -if you use namespaces and plan on using namespace import just after -package require). pkg_mkIndex still has limitations regarding -package dependencies but errors are now ignored and with -direct, correct -package indexes can be generated even if there are dependencies as long -as the "package provide" are done early enough in the files. (DL) - -1/28/98 (enhancement) Performance tuning of regexp and regsub. (CCS) - -1/28/98 (bug fix) regexp and regsub with "-indices" returned the byte-offsets -of the characters in the UTF-8 representation, not the character offsets -themselves. (CCS) - -1/28/98 (bug fix) "clock format 0 -format %Z -gmt 1" would return the local -timezone string instead of "GMT" on Solaris and Windows. - -1/28/98 (bug fix) Restore tty settings when closing serial device on Unix. -This is good behavior when closing real serial devices, essential when -closing the pseudo-device /dev/tty because the user's terminal settings -would be left useless, in raw mode, when tcl quit. (CCS) - -1/28/98 (bug fix) Tcl_OpenCommandChannel() was modifying the contents of the -argv array passed to it, causing problems for any caller that wanted to -continue to use the argv array after calling Tcl_OpenCommandChannel(). (CCS) - -2/1/98 (bug fix) More bugs with %Z in format string argument to strftime(): -1. Borland always returned empty string. -2. MSVC always returned the timezone string for the current time, not the - timezone string for the specified time. -3. With MSVC, "clock format 0 -format %Z -gmt 1" would return "GMT" the first - time it was called, but would return the current timezone string on all - subsequent calls. (CCS) - -2/1/98 (bug fix) "file stat" was broken on Windows. -1. "file stat" of a root directory (local or network) or a relative path that - resolved to a root directory (c:. when in pwd was c:/) was returning error. -2. "file stat" on a regular file (S_IFREG), the st_mode was sign extended to - a negative int if the platform-dependant type "mode_t" was declared as a - short instead of an unsigned short. -3. "file stat" of a network directory, the st_dev was incorrectly reported - as the id of the last accessed local drive rather than the id of the - network drive. (CCS) - -2/1/98 (bug fix) "file attributes" of a relative path that resolved to a -root directory was returning error. (CCS) - -2/1/98 (bug fix) Change error message when "file attribute" could not -determine the attributes for a file. Previously it would return different -error messages on Unix vs. Windows vs. Mac. (CCS) - -2/4/98 (bug fixes) Fixed several instances of bugs where the parser/compiler -would reach outside the range of allocated memory. Improved the array -lookup algorithm in set compilation. (DL) - -2/5/98 (change) The TCL_PARSE_PART1 flag for Set/Get(Obj)Var2 C APIs is now -deprecated and ignored. The part1 is always parsed when the part2 argument -is NULL. This is to avoid a pattern of errors for extension writers converting -from string based Tcl_SetVar() to new Tcl_SetObjVar2() and who could easily -forget to provide the flag and thus get code working for normal variables -but not for array elements. The performance hit is minimal. A side effect -of that change is that is is no longer possible to create scalar variables -that can't be accessed by tcl scripts because of their invalid name -(ending with parenthesis). Likewise it is also parsed and checked to -ensure that you don't create array elements of array whose name is a valid -array element because they would not be accessible from scripts anyway. -Note: There is still duplicate array elements parsing code. (DL) -*** POTENTIAL INCOMPATIBILITY *** - -2/11/98 (bug fix) Sharing objects between interps, such as by "interp -eval" or "send" could cause a crash later when dereferencing an interp -that had been deleted, given code such as: - set a {set x y} - interp create foo - interp eval foo $a - interp delete foo - unset a -Interp "foo" was gone, but "a" had a internal rep consisting of bytecodes -containing a dangling pointer to "foo". Unsetting "a" would attempt to -return resources back to "foo", causing a crash as random memory was -accessed. The lesson is that that if an object's internal rep depends on -an interp (or any other data structure) it must preserve that data in -some fashion. (CCS) - -2/11/98 (enhancement) The "interp" command was returning inconsistent error -messages when the specified slave interp could not be found. (CCS) - -2/11/98 (bug fix) Result codes like TCL_BREAK and TCL_CONTINUE were not -propagating through the master/slave interp boundaries, such as "interp -eval" and "interp alias". TCL_OK, TCL_ERROR, and non-standard codes like -teh integer 57 work. There is still a question as to whether TCL_RETURN -can/should propagate. (CCS) - -2/11/98 (bug fix) TclCompileScript() was derefering memory 1 byte before -start of the string to compile, looking for ']'. (CCS,DL) - -2/11/98 (bug fix) Tcl_Eval2() was derefering memory 1 byte before start -of the string to eval, looking for ']'. (CCS,DL) - -2/11/98 (bug fix) Compiling "set a(b" was running off end of string. (CCS,DL) - -2/11/98 (bug fix) Windows initialization code was dereferencing -uninitialized memory if TCL_LIBRARY environment didn't exist. (CCS) - -2/11/98 (bug fix) Windows "registry" command was dereferencing -uninitialized memory when constructing the $errorCode for a failed -registry call. (CCS) - -2/11/98 (enhancement) Eliminate the TCL_USE_TIMEZONE_VAR definition from -configure.in, because it was the same information as the already existing -HAVE_TM_ZONE definition. The lack of HAVE_TM_ZONE is used to work around a -Solaris and Windows bug where "clock format [clock sec] -format %Z -gmt 1" -produces the local timezone string instead of "GMT". (CCS) - -2/11/98 (bug fix) Memleaks and dereferencing of uninitialized memory in -regexp if an error occurred while compiling a regular expression. (CCS). - -2/18/98 (new feature) Added mutexes and thread local storage in order -to make Tcl thread safe. For testing purposes, there is a testthread -command that creates a new thread and an interpreter inside it. See -thread.test for examples, but this script-level interface is not fixed. -Each thread has its own notifier instance to manage its own events, -and threads can post messages to each other's message queue. -This uses pthreads on UNIX, and native thread support on other platforms. -You enable this by configuring with --enable-threads. Note that at -this time *Tk* is still not thread safe. Special thanks to -Richard Hipp: his earlier implementation inspired this work. (BW, SS, JI) - -2/18/98 (hidden feature change) The way the env() array is shared among -interpreters changed. Updates to env used to trigger write traces in -other interpreters. This undocumented feature is no longer implemented. -Instead, variable tracing is used to keep the C-level environ array in sync -with the Tcl-level env array. This required adding TCL_TRACE_ARRAY support -to Tcl_TraceVar2 so that array names works properly. (BW) -*** POTENTIAL INCOMPATIBILITY *** - -2/18/98 (enhancement) Conditional compilation for unix systems (e.g., -IRIX, SCO) that use f_bsize instead of st_blksize to determine disk block -size. (CCS) - -2/23/98 (bug fix) Fixed the emulation of polling selects in the threaded -version of the Unix notifier. The bug was showing up on a multiprocessor -as starvation of the notifier thread. (BW) - ------------------ Released 8.1a2, Feb 23 1998 ----------------------- - -9/22/98 (bug fix) Changed the value of TCL_TRACE_ARRAY so it no longer -conflicts with the deprecated TCL_PARSE_PART1 flag. This should -improve portability of C code. (stanton) - -10/6/98 (bug fix) The compile procedure for "if" incorrectly attempted -to match against the literal string "if", resulting in a stack -overflow when "::if" was compiled. It also would incorrectly accept -"if" instead of "elsif" in later clauses. (stanton) - -10/15/98 (new feature) Added a "totitle" subcommand to the "string" -command to convert strings to capitalize the first character of a string -and lowercase all of the other characters. (stanton) - -10/15/98 (bug fix) Changed regexp and string commands to properly -handle case folding according to the Unicode character -tables. (stanton) - -10/21/98 (new feature) Added an "encoding" command to facilitate -translations of strings between different character encodings. See -the encoding.n manual entry for more details. (stanton) - -11/3/98 (bug fix) The regular expression character classification -syntax now includes Unicode characters in the supported -classes. (stanton) - -11/6/98 (bug fix) Variable traces were causing crashes when upvar -variables went out of scope. [Bug: 796] (stanton) - -11/9/98 (bug fix) "format" now correctly handles multibyte characters -in %s format strings. (stanton) - -11/10/98 (new feature) "regexp" now accepts three new switches -("-line", "-lineanchor", and "-linestop") that control how regular -expressions treat line breaks. See the regexp manual entry for more -details. (stanton) - -11/17/98 (bug fix) "scan" now correctly handles Unicode -characters. (stanton) - -11/17/98 (new feature) "scan" now supports XPG3 position specifiers -and the "%n" conversion character. See the "scan" manual entry for -more details. (stanton) - -11/17/98 (bug fix) The Tcl memory allocator now returns 8-byte aligned -chunks of memory which improves performance on Windows and avoids -crashes on other platforms. [Bug: 834] (stanton) - -11/23/98 (bug fix) Applied various regular expression performance bug -fixes supplied by Henry Spencer. (stanton) - -11/30/98 (bug fix) Fixed various thread related race conditions. [Bug: -880 & 607] (stanton) - -11/30/98 (bug fix) Fixed a number of memory overflow and leak -bugs. [Bug: 584] (stanton) - -12/1/98 (new feaure) Added support for Korean encodings. (stanton) - -12/1/98 (feature change) Changed the Tcl_EvalObjv interface to remove -the string and length arguments. -*** POTENTIAL INCOMPATIBILITY with previous alpha releases *** - -12/2/98 (bug fix) Fixed various bugs related to line feed -translation. [Bug: 887] (stanton) - -12/4/98 (new feature) Added a message catalog facility to help with -localizing Tcl scripts. Thanks to Mark Harrison for contributing the -initial implementation of the "msgcat" package. (stanton) - -12/7/98 (bug fix) The memory allocator was failing to update the -block list for large memory blocks that were reallocated into a -different address. [Bug: 933] (stanton) - ------------------ Released 8.1b1, Dec 10 1998 ----------------------- - -12/22/98 (performance improvement) Improved the -command option of the -lsort command to better use the object system for improved -performance (about 5x speed up). Thanks to Syd Polk for suppling the -patch. [RFE: 726] (rjohnson) - -2/10/99 (bug fix) Restored the Tcl_ObjSetVar2/Tcl_ObjGetVar2 -interfaces from 8.0 and renamed the Tcl_GetObjVar2/Tcl_SetObjVar2 -interfaces to Tcl_GetVar2Ex and Tcl_SetVar2Ex. This should provide -better compatibility with 8.0. (stanton) -*** POTENTIAL INCOMPATIBILITY with previous alpha/beta releases *** - -2/10/99 (bug fix) Made the eval interfaces compatible with 8.0 by -renaming Tcl_EvalObj to Tcl_EvalObjEx, renaming Tcl_Eval2 to -Tcl_EvalEx and restoring Tcl_EvalObj and Tcl_GlobalEvalObj interfaces -so they match Tcl 8.0. (stanton) -*** POTENTIAL INCOMPATIBILITY with previous alpha/beta releases *** - -2/25/99 (bug fix/new feature) On Windows, the channel drivers for -consoles and serial ports now completely support file events. (redman) - -3/5/99 (bug fix) Integrated patches to fix various configure problems -that affected HP-UX-11, 64-bit IRIX, Linux, and Solaris. (stanton) - -3/9/99 (bug fix) Integrated various AIX related patches to improve -support for shared libraries. (stanton) - -3/9/99 (new feature) Added tcl_platform(user) to provide a portable -way to get the name of the current user. (welch) - -3/9/99 (new feature) Integrated the stub library mechanism contributed -by Jan Nijtmans, Paul Duffin, and Jean-Claude Wippler. This feature -should make it possible to write extensions that support multiple -versions of Tcl simultaneously. It also makes it possible to -dynamically load extensions into statically linked interpreters. This -patch includes the following changes: - - Added a Tcl_InitStubs() interface - - Added Tcl_PkgProvideEx, Tcl_PkgRequireEx, Tcl_PkgPresentEx, - and Tcl_PkgPresent. - - Added va_list versions of all VARARGS functions so they can be - invoked from wrapper functions. -See the manual for more information. (stanton) - - -3/10/99 (feature change) Replaced Tcl_AlertNotifier with -Tcl_ThreadAlert since the Tcl_AlertNotifier function relied on passing -internal data structures. (stanton) -*** POTENTIAL INCOMPATIBILITY with previous alpha/beta releases *** - -3/10/99 (new feature) Added a Tcl_GetVersion API to make it easier to -check the Tcl version and patch level from C. (redman) - -3/14/99 (feature change) Tried to unify the TclpInitLibrary path -routines to look in similar places from Windows to UNIX. The new -library search path is: TCL_LIBRARY, TCL_LIBRARY/../tcl8.1, relative -to DLL (Windows Only) relative to installed executable, relative to -develop executable, and relative to compiled-in in location (UNIX -Only.) This fix included: - - Defining a TclpFindExecutable - - Moving Tcl_FindExecutable to a common area in tclEncoding.c - - Modifying the TclpInitLibraryPath routines. -(surles) - -3/14/99 (feature change) Added hooks for TclPro Wrapper to initialize -the location of the encoding files and libraries. This fix included: - - Adding the TclSetPerInitScript routine. - - Modifying the Tcl_Init routines to evaluate the non-NULL - pre-init script. - - Adding the Tcl_SetdefaultEncodingDir and Tcl_GetDefaultEncodingDir - routines. - - Modifying the TclpInitLibrary routines to append the default - encoding dir. -(surles) - -3/14/99 (feature change) Test suite now uses "test" namespace to -define the test procedure and other auxiliary procedures as well as -global variables. - - Global array testConfige is now called ::test::testConfig. - - Global variable VERBOSE is now called ::test::verbose, and - ::test::verbose no longer works with numerical values. We've - switched to a bitwise character string. You can set - ::test::verbose by using the -verbose option on the Tcl command - line. - - Global variable TESTS is now called ::test::matchingTests, and - can be set on the Tcl command line via the -match option. - - There is now a ::test::skipTests variable (works similarly to - ::test::matchTests) that can be set on the Tcl command line via - the -match option. - - The test suite can now be run in any working directory. When - you run "make test", the working directory is nolonger switched - to ../tests. -(hirschl) -*** POTENTIAL INCOMPATIBILITY *** - ---------------- Released 8.1b2, March 16, 1999 ---------------------- - -3/18/99 (bug fix) Fixed missing/incorrect characters in shift-jis table -(stanton) - -3/18/99 (feature change) The glob command ignores the -FS_CASE_IS_PRESERVED bit on file systesm and always returns -exactly what it gets from the system. (stanton) -*** POTENTIAL INCOMPATIBILITY *** - -3/19/99 (new feature) Added support for --enable-64bit. For now, -this is only supported on Solaris 7 64bit (SunOS 5.7) using the Sun -compiler. (redman) - -3/23/99 (bug fix) Fixed fileevents and gets on Windows consoles and -serial devices so that non-blocking channels do not block on partial -input lines. (redman) - -3/23/99 (bug fix) Added a new Tcl_ServiceModeHook interface. -This is used on Windows to avoid the various problems that people -have been seeing where the system hangs when tclsh is running -outside of the event loop. As part of this, renamed -TclpAlertNotifier back to Tcl_AlertNotifier since it is public. -(stanton) - -3/23/99 (feature change) Test suite now uses "tcltest" namespace to -define the test procedure and other auxiliary procedures as well as -global variables. The previously chosen "test" namespace was thought -to be too generic and likely to create conflits. -(hirschl) -*** POTENTIAL INCOMPATIBILITY *** - -3/24/99 (bug fix) Make sockets thread safe on Windows. -(redman) - -3/24/99 (bug fix) Fix cases where expr would incorrect return -a floating point value instead of an integer. (stanton) - -3/25/99 (bug fix) Added ASCII to big5 and gb2312 encodings. -(stanton) - -3/25/99 (feature change) Changed so aliases are invoked at current -scope in the target interpreter instead of at the global scope. This -was an incompatibility introduced in 8.1 that is being removed. -(stanton) -*** POTENTIAL INCOMPATIBILITY with previous beta releases *** - -3/26/99 (feature change) --enable-shared is now the default and build -Tcl as a shared library; specify --disable-shared to build a static Tcl -library and shell. -*** POTENTIAL INCOMPATIBILITY *** - -3/29/99 (bug fix) Removed the stub functions and changed the stub -macros to just use the name without params. Pass &tclStubs into the -interp (don't use tclStubsPtr because of collisions with the stubs on -Solaris). (redman) - -3/30/99 (bug fix) Loadable modules are now unloaded at the last -possible moment during Tcl_Finalize to fix various exit-time crashes. -(welch) - -3/30/99 (bug fix) Tcl no longer calls setlocale(). It looks at -env(LANG) and env(LC_TYPE) instead. (stanton) - -4/1/99 (bug fix) Fixed the Ultrix multiple symbol definition problem. -Now, even Tcl includes a copy of the Tcl stub library. (redman) - -4/1/99 (bug fix) Internationalized the registry package. - -4/1/99 (bug fix) Changed the implemenation of Tcl_ConditionWait and -Tcl_ConditionNotify on Windows. The new algorithm eliminates a race -condition and was suggested by Jim Davidson. (welch) - -4/2/99 (new apis) Made various Unicode utility functions public. -Tcl_UtfToUniCharDString, Tcl_UniCharToUtfDString, Tcl_UniCharLen, -Tcl_UniCharNcmp, Tcl_UniCharIsAlnum, Tcl_UniCharIsAlpha, -Tcl_UniCharIsDigit, Tcl_UniCharIsLower, Tcl_UniCharIsSpace, -Tcl_UniCharIsUpper, Tcl_UniCharIsWordChar, Tcl_WinUtfToTChar, -Tcl_WinTCharToUtf (stanton) - -4/2/99 (feature change) Add new DDE package and removed the Tk -send command from the Windows version. Changed DDE-based send -code into "dde eval" command. The DDE package can be loaded -into tclsh, not just wish. Windows only. (redman) - -4/5/99 (bug fix) Changed safe-tcl so that the encoding command -is an alias that masks out the "encoding system" subcommand. -(redman) - -4/5/99 (bug fix) Configure patches to improve support for -OS/390 and BSD/OS 4.*. (stanton) - -4/5/99 (bug fix) Fixed crash in the clock command that occurred -with negative time values in timezones east of GMT. (stanton) - -4/6/99 (bug fix) Moved the "array set" C level code into a common -routine (TclArraySet). The TclSetupEnv routine now uses this API to -create an env array w/ no elements. This fixes the bug caused when -every environ varaible is removed, and the Tcl env variable is -synched. If no environ vars existed, the Tcl env var would never be -created. (surles) - -4/6/99 (bug fix) Made the Env module I18N compliant. (surles) - -4/6/99 (bug fix) Changed the FindVariable routine to TclpFindVariable, -that now does a case insensitive string comparison on Windows, and not -on UNIX. (surles) - ---------------- Released 8.1b3, April 6, 1999 ---------------------- - -4/9/99 (bug fix) Fixed notifier deadlock situation when the pipe used -to talk back notifier thread is filled with data. Found as a result of the -focus.test for Tk hanging. (redman) - -4/13/99 (bug fix) Fixed bug where socket -async combined with -fileevent for writing did not work under Windows NT. (redman) - -4/13/99 (encoding fix) Restored the double byte definition of GB2312 -and added the EUC-CN encoding. EUC-CN is a variant of GB2312 that -shifts the characters into bytes with the high bit set and includes -ASCII as a subset. (stanton) - -4/27/99 (bug fix) Added 'extern "C" {}' block around the stub table -pointer declaration so the stub library can be used from C++. (stanton) - ---------------- Released 8.1 final, April 29, 1999 ---------------------- - -4/22/99 (bug fix) Changed Windows NT socket implementation to avoid -creating a communication window. This avoids the problem where the -system hangs waiting for tclsh to respond to a system-wide synchronous -broadcast (e.g. if you change system colors). (redman) - -4/22/99 (bug fix) Added call to TclWinInit from TclpInitPlatform when -building a static library since DllMain will not be invoked. This -could break old code that explicitly called TclWinInit, but should be -simpler in the long run. (stanton) -*** POTENTIAL INCOMPATIBILITY *** - -4/23/99 (bug fix) Added support for the koi8-r Cyrillic -encoding. [Bug: 1771] (stanton) - -4/28/99 (bug fix) Changed internal Tcl_Obj usage to avoid freeing the -internal representation after the string representation has been -freed. This makes it easier to debug extensions. (stanton) - -4/30/99 (bug fix) Fixed a memory leak in CommandComplete. (stanton) - -5/3/99 (bug fix) Fixed a bug where the Tcl_ObjType was not being set -in a duplicated Tcl_Obj. [Bug: 1975, 2047] (stanton) - -5/3/99 (bug fix) Changed Tcl_ParseCommand to avoid modifying eval'ed -strings that are already null terminated. [Bug: 1793] (stanton) - -5/3/99 (new feature) Applied Jeff Hobbs's string patch which includes -the following changes: - - added new subcommands: equal, repeat, map, is, replace - - added -length option to "string compare|equal" - - added -nocase option to "string compare|equal|match" - - string and list indices can be an integer or end?-integer?. - - added optional first and last index args to string toupper, et al. -See the string.n manual entry for more details about the new string -features. [Bug: 1845] (stanton) - -5/6/99 (new feature) Added Tcl_UtfNcmp and Tcl_UtfNcasecmp to make Utf -string comparision easier. (stanton) - -5/7/99 (bug fix) Improved OS/390 support. [Bug: 1976, 1997] (stanton) - -5/12/99 (bug fix) Changed Windows initialization code to avoid using -GetUserName system call in favor of the env(USERNAME) variable. This -provides a significant startup speed improvement. (stanton) - -5/12/99 (bug fix) Replaced the per-interpreter regexp cache with a -per-thread cache. Changed the Regexp object to take advantage of this -extra cache. Added a reference count to the TclRegexp type so regexps -can be shared by multiple objects. Removed the per-interp regexp cache -from the interpreter. Now regexps can be used with no need for an -interpreter. This set of changes should provide significant speed -improvements for many Tcl scripts. [Bug: 1063] (stanton) - -5/14/99 (bug fix) Durining initialization on Unix, Tcl now extracts the -encoding subfield from the LANG/LC_ALL environment variables in cases -where the locale is not found in the built-in locale table. It also -attempts to initialize the locale subsystem so X11 is happy. [Bug: 1989] -(stanton) - -5/14/99 (bug fix) Applied the patch to fix 100-year and 400-year -boundaries in leap year code, from Isaac Hollander. [Bug: 2066] (redman) - -5/14/99 (bug fix) Fixed a crash caused by a failure to reset the result -before evaluating the test expression in an uncompiled for -statement. (stanton) - -5/18/99 (bug fix) Modified initialization code on Windows to avoid -inherenting closed or invalid channels. If the standard input is -anything other than a console, file, serial port, or pipe, then we fall -back to the standard Tk window console. (stanton) - -5/19/99 (bug fix) Added an extern "C" block around the entire tcl.h -header file to avoid C++ linkage issues. (redman) - -5/19/99 (new feature) Applied Jeff Hobb's patch to add -Tcl_StringCaseMatch to support case insensitive glob style matching and -Tcl_UniCharIs* character classification functions. (stanton) - -5/20/99 (bug fix) Added the directory containing the executuble and the -../lib directory relative to that to the auto_path variable. (redman) - ---------------- Released 8.1.1, May 25, 1999 ---------------------- - -5/21/99 (bug fix) Fixed launching command.com on Win95/98, no longer -hangs. [Bug: 2105] (redman) - -5/28/99 (bug fix) Fixed bug where dde calls were being passed an -invalid dde handle. [Bug: 2124] (stanton) - -6/1/99 (bug fix) Small configure.in patches. [Bug: 2121] (stanton) - -6/1/99 (bug fix) Applied latest regular expression patches to fix an -infinite loop bug and add support for testing whether a string could -match with additional input. [Bug: 2117] (stanton) - -6/2/99 (bug fix) Fixed incorrect computation of relative ordering in -Utf case-insensitive comparison. [Bug: 2135] (stanton) - -6/3/99 (bug fix) Fxied bug where string equal/compare -nocase -reported wrong result on null strings. [Bug: 2138] (stanton) - -6/4/99 (new feature) Windows build now uses Cygwin tools plus GNU -make and autoconf to build static/dynamic and debug/nodebug. (stanton) - -6/7/99 (new feature) Optimized string index, length, range, and -append commands. Added a new Unicode object type. (hershey) - -6/8/99 (bug fix) Rolled back Windows socket driver to 8.1.0 -version. (stanton) - -6/9/99 (new feature) Added Tcl_RegExpMatchObj and Tcl_RegExpGetInfo -to public Tcl API, these functions are needed by Expect. Changed -tools/genStubs.tcl to always write output in LF mode. (stanton) - -6/14/99 (new feature) Merged string and Unicode object types. Added -new public Tcl API functions: Tcl_NewUnicodeObj, Tcl_SetUnicodeObj, -Tcl_GetUnicode, Tcl_GetUniChar, Tcl_GetCharLength, Tcl_GetRange, -Tcl_AppendUnicodeToObj. (hershey) - -6/16/99 (new feature) Changed to conform to TEA specification, added -tcl.m4 and aclocal.m4 macro libraries for configure. (wart) - -6/17/99 (new feature) Added new regexp interfaces: -expanded, -line, --linestop, and -lineanchor switches. Renamed Tcl_RegExpMatchObj to -Tcl_RegExpExecObj and added new Tcl_RegExpMatchObj that is equivalent -to Tcl_RegExpMatch. Added public macros for regexp flags. Added -REG_BOSONLY flag to allow Expect to iterate through a string and only -find matches that start at the current position within the -string. (stanton) - -6/21/99 (bug fix) Fixed memory leak in TclpThreadCreate where thread -attributes were not being released. [Bug: 2254] (stanton) - -6/23/99 (new feature) Updated Unicode character tables to reflect -Unicode 2.1 data. (stanton) - -6/25/99 (new feature) Fixed bugs in non-greedy quantifiers for regular -expression code. (stanton) - -6/25/99 (new feature) Added initial implementation of new Tcl test -harness package. Modified test files to use new tcltest package. -(jenn) - -6/26/99 (new feature) Applied patch from Peter Hardie to add poke -command to dde and changed the dde package version number to -1.1. (redman) - -6/28/99 (bug fix) Applied patch from Peter Hardie to fix problem in -Tcl_GetIndexFromObj() when the key being passed is the empty string. -[Bug: 1738] (redman) - -6/29/99 (new feature) Added options to tcltest package: -preservecore, --limitconstraints, -help, -file, -notfile, and flags. (jenn) - -7/3/99 (new feature) Changed parsing of variable names to allow empty -array names. Now "$(foo)" is a variable reference. Previously you -had to use something line $::(foo), which is slower. This change was -requested by Jean-Luc Fontaine for his STOOOP package. (welch) - -7/3/99 (new feature) Added Tcl_SetNotifier (public API) and -associated hook points in the notifiers to be able to replace the -notifier calls at runtime. The Xt notifier and test program use this -hook. (welch) - -7/3/99 (new feature) Added a new variant of the "Trf core patch" from -Andreas Kupries that adds new C APIs Tcl_StackChannel, -Tcl_UnstackChannel, and Tcl_GetStackedChannel. This allows the Trf -extension to work without applying patches to the Tcl core. (welch) - -7/6/99 (new feature) Added -timeout option to http.tcl to handle -timeouts that occur during connection attempts to hosts that are -down. (welch) - -7/6/99 (bug fix) Applied new implementation of the Windows serial -port driver from Rolf Schroedter that fixes reading only one byte from -the port at a time. Uses polling every 10ms to implement -fileevents. [Bug: 1980 2217] (redman) - -7/8/99 (bug fix) Applied fix for bug in DFA state caching under -lookahead conditions (regular expressions). [Bug: 2318] (stanton) - -7/8/99 (bug fix) Fixed bug in string range bounds checking -code. (stanton) - ---------------- Released 8.2b1, July 14, 1999 ---------------------- - -7/16/99 (bug fix) Added Tcl_SetNotifier to stub table. [Bug: 2364] -Added check for Alpha/Linux to correct the IEEE floating point flag, -patch from Don Porter. (redman) - -7/20/99 (bug fix) Merged 8.0.5 code to handle tcl_library properly, -also fixed a bug that caused TCL_LIBRARY to be ignored. (hershey) - -7/21/99 (bug fix) Implemented modified socket driver for Windows that -uses a thread to manage the socket event window. Code works the same -on all supported versions of Windows and was based on original 8.1.0 -code. [Bug: 2178 2256 2259 2329 2323 2355] (redman) - -7/21/99 (new feature) Applied patch from Rolf Schroedter to add --pollinterval option to fconfigure for Windows serial ports. Allows -the maxblocktime to be modified to control how often serial ports are -checked for fileevents. Also added documentation for \\.\comX -notation for opening serial ports on Windows. (redman) - -7/21/99 (bug fix) Changed APIs in stub tables to use "unsigned long" -instead of the platform-specific "size_t", primarily after SunOS 4 -users could no longer compile. (redman) - -7/22/99 (bug fix) Fixed crashing during "array set a(b) {}". -[Bug: 2427] (redman) - -7/22/99 (bug fix) The install-sh script must be given execute -permissions prior to running. [Bug: 2413] (redman) - -7/22/99 (bug fix) Applied patch from Ulrich Ring to remove ANSI-style -prototypes in the code. [Bug: 2391] (redman) - -7/22/99 (bug fix) Added #if blocks around #includes of sys/*.h header -files, to allow an extension author on Windows to use the MetroWerks -compiler. [Bug: 2385] (redman) - -7/22/99 (bug fix) Fixed running the safe.test test suite, one change -to the Windows Makefile.in to fix paths and another in safe.test to -check for the tcl_platform(threaded) variable properly. (redman) - -7/22/99 (bug fix) Fixed hanging in new Win32 socket driver with -threads enabled. (redman) - -7/26/99 (bug fix) Fixed terminating of helper threads by holding any -mutexes from the primary thread while waiting for the helper thread to -terminate. Fixes dual-CPU WinNT hangs, only one rare sporadic hang -that still exists with dual-CPU WinNT. Also fixed test cases so that -they would not depend as much on timing for dual-CPU WinNT. (redman) - -7/27/99 (bug fix) Some test suite cleanup. (jenn) - -7/29/99 (bug fix) Applied patch to fix typo in .SH NAME line in -doc/Encoding.n [Bug: 2451]. Applied patch to avoid linking pack.n to -pack-old.n [Bug: 2469]. Patches from Don Porter. (redman) - -7/29/99 (bug fix) Allow tcl to open CON and NUL, even for redirection -of std channels. [Bug: 2393 2392 2209 2458] (redman) - -7/30/99 (bug fix) Applied fixed Trf patch from Andreas Kupries. -[Bug: 2386] (hobbs) - -7/30/99 (bug fix) Fixed bug in info complete. [Bug: 2383 2466] (hobbs) - -7/30/99 (bug fix) Applied patch to fix threading on Irix 6.5, patch -provided by James Dennett. [Bug: 2450] (redman) - -7/30/99 (bug fix) Fixed launching of 16bit applications on Win9x from -wish. The command line was being primed with tclpip82.dll, but it was -ignored later. - -7/30/99 (bug fix) Added functions to stub table, patch provided by Jan -Nijtmans. [Bug: 2445] (hobbs) - -8/1/99 (bug fix) Changed Windows socket driver to terminate threads -by sending a message to the window rather than calling -TerminateThread(), which seems to leak about 4k from the helper -thread's stack space. (redman) - ---------------- Released 8.2b2, August 5, 1999 ---------------------- - -8/4/99 (bug fix) Applied patches supplied by Henry Spencer to greatly -enhance performance of certain classes of regular expressions. -[Bug: 2440 2447] (stanton) - -8/5/99 (doc change) Made it clear that tcl_pkgPath was not set for -Windows. [Bug: 2455] (hobbs) - -8/5/99 (bug fix) Fixed reference to bytes that might not be null -terminated in tclLiteral.c. [Bug: 2496] (hobbs) - -8/5/99 (bug fix) Fixed typo in http.tcl. [Bug: 2502] (hobbs) - -8/9/99 (bug fix) Fixed test suite to handle larger integers -(64bit). Patch from Don Porter. (hobbs) - -8/9/99 (documentation fix) Clarified Tcl_DecrRefCount docs -[Bug: 1952]. Clarified array pattern docs [Bug: 1330]. Fixed clock docs -[Bug: 693]. Fixed formatting errors [Bug: 2188 2189]. Fixed doc error -in tclvars.n [Bug: 2042]. (hobbs) - -8/9/99 (bug fix) Fixed path handling in auto_execok [Bug: 1276] (hobbs) - -8/9/99 (internal api change) Removed the TclpMutexLock and TclpMutexUnlock -APIs and added a new exported api, Tcl_GetAllocMutex. These APIs are all for -the mutex used in the simple memory allocators. By making this change -we are able to substitute different implementations of the thread-related -APIs without having to recompile the Tcl core. (welch) - -8/9/99 (new C API) Tcl_GetChannelNames returns a list of open channel -names in the interpreter result. Still no Tcl-level version of this, -but server-like applications can use this to clean up files without -deleting interpreters. (welch) - -8/9/99 (bug fix) Traces were not firing on "info exists", which used to -happen in Tcl 7.6 and earlier. An "info exists" now fires a read trace, -if defined. This makes it possible to fully implement variables that -are defined via traces. (welch) - -8/10/99 (bug fix) Fixed Brent's changes so that they work on -Windows. (redman) - ---------------- Released 8.2b3, August 11, 1999 ---------------------- - -8/12/99 (Mac) Rearrange projects in tclMacProjects.sea.hqx so that the -build directory is separate from the sources. (Jim Ingham) - -8/12/99 (bug fix) Fixed bug in Tcl_EvalEx where the termOffset was not -being updated in cases where the evaluation returned a non TCL_OK -error code. [Bug: 2535] (stanton) - ---------------- Released 8.2.0, August 17, 1999 ---------------------- - -9/21/99 (config fixes) fixed several AIX configuration issues. gcc and -threading may still cause problems on AIX. (hobbs) - -9/21/99 (bug fix) fixed expr double-eval problem. [Bug: 732] (hobbs) - -9/21/99 (bug fix) fixed static buffer overflow problem. [Bug: 2483] (hobbs) - -9/21/99 (bug fix) fixed end-int linsert interpretation. [Bug: 2693] (hobbs) - -9/21/99 (bug fix) fixed bug when setting array in non-existent -namespace. [Bug: 2613] (hobbs) - ---- Released 8.2.1, October 04, 1999 --- See ChangeLog for details --- - -10/30/99 (feature enhancement) new regexp engine from Henry Spencer -was patched in - should greatly reduce stack space usage. (spencer) - -10/30/99 (bug fix) fixed Purify reported memory leaks in findexecutable -test command, TclpCreateProcess on Unix, in handling of C environ array, -and in testthread code. No more known (reported) mem leaks for Tcl -built using gcc on Solaris 2.5.1. Also none reported for Tcl on NT -(using Purify 6.0). (hobbs) - -10/30/99 (bug fix) fixed improper bytecode handling of -'eval {set array($unknownvar) 5}' (also for incr) (hobbs) - -10/30/99 (bug fix) fixed event/io threading problems by making -triggerPipe non-blocking (nick kisserbeth) - -10/30/99 (bug fix) fixed Tcl_AppendStringsToObjVA and Tcl_AppendResultVA -to only iterates once over the va_list (avoiding non-portable memcpy). -(joe english, hobbs) - -10/30/99 (bug fix) removed savedChar trick in tclCompile.c that appeared -to be causing a segv when the literal table was released. -[Bug: 2459, 2515] (David Whitehouse) - -10/30/99 (bug fix) fixed [string index] to return ByteArrayObj -when indexing into one (test case string-5.16) [Bug: 2871] (hobbs) - -10/30/99 (bug fix) fixes for mac UTF filename handling (ingham) - ---- Released 8.2.2, November 04, 1999 --- See ChangeLog for details --- - -11/19/99 (feature enhancement) bug fixes for http package as well as -patch required by TLS (SSL) extension that adds http::(un)register -and -type to http::geturl. Up'd http pkg version to 2.2. - -11/19/99 (bug fix) removed extra decr of numLevels in Tcl_EvalObjEx -that could cause seg fault (mjansen@wendt.de) - -11/19/99 (bug fixes) numerous minor big fixes, including correcting the -installation of the koi8-r encoding and tcltest1.0 on Windows. - -11/30/99 (bug fix) fixes scan where %[..] didn't match anything - -11/30/99 (bug fix) fixed setting of isNonBlocking flag in PipeBlockModeProc -so you can now close a non-blocking channel without waiting. - -11/30/99 (bug work-around) prevented the unloading of DLLs for Unix in -TclFinalizeLoad. This stops the seg fault on exit that some users would -see (ie with oratcl) when using DLLs that do nasty things like register -atexit handlers. - -12/07/99 (bug fix) fixes for 'expr + {[incr]}' and 'expr + {[error]}' -cases (different causes). - ---- Released 8.2.3, December 16, 1999 --- See ChangeLog for details --- - -1999-09-14 (feature enhancement) added -start switch to regexp and regsub. - -1999-09-15 (feature enhancement) add 'array unset' command. - -1999-09-15 (feature enhancement) rewrote runtime libraries to use new -string functions - -1999-08-18 (feature enhancement) added 'file channels' command, along with -Tcl_GetChannelNames(Ex) public C APIs. - -1999-10-19 (feature enhancement) enhanced tcltest package - -1999-09-16 (feature enhancement) added -milliseconds switch to 'clock clicks' - -1999-10-28 (feature enhancement) added support for inline 'scan' - -1999-10-28 (feature enhancement) added support for touch functionality by -extendeding 'file atime' and 'file mtime' to take an optional time argument - -1999-11-24 (feature enhancement) added 'fconfigure $sock -lasterror' -command to Windows to query the last error received on a serial socket. - -1999-11-30 (bug fix) fixed handling of %Z on NT for timezones that don't -have DST - -1999-12-03 (feature enhancement) improved error message in bad octal cases -and improper use of comments. (hobbs) - -1999-12-07 (bug fix) fixed Tcl_ScanCountedElement to not step -beyond the end of the counted string - -1999-12-09 (feature enhancement) removed all references to 16 bit -compatibility code for Windows (hobbs) - -1999-12-10 (bug fix) removed check for vfork - Tcl now uses only fork in -exec. (hobbs) - -1999-12-10 (optimization) changed Tcl_ConcatObj to return a list -object when it receives all pure list objects as input (used by 'concat'), -added optimizations in Tcl_EvalObjEx for pure list case, and optimized -INST_TRY_CVT_TO_NUMERIC in TclExecuteByteCode for boolean objects. -(oakley, hobbs) - -1999-12-12 (feature enhancement) enhanced glob command with -type, -path, --directory and -join switches. (darley, hobbs) - -1999-12-21 (bug fix) changed CreateThread to _beginthreadex and -ExitThread to _endthreadex to prevent 4K mem leak (gravereaux) - -1999-12-21 (bug fix) fixed applescript for I18N - -1999-12-21 (feature enhancement) added -unique option to lsort (hobbs) - -1999-12-21 (bug fix) changed thread ids to longs (for 64bit systems) - ---- Released 8.3b1, December 22, 1999 --- See ChangeLog for details --- - -2000-01-10 (feature enhancement) clock scan now supports the common -ISO 8601 date/time formats. See docs for details. (melski) - -2000-01-10 (bug fix) prevented \ooo substitution from accepting -non-octal digits [Bug: 3975] (hobbs) - -2000-01-11 (bug fix) fixed improper handling of DST by clock when -using relative times (like "1 month" or "tomorrow"). (melski) - -2000-01-12 (bug fix) improved build support for Tru64 v5, NetBSD -and Reliant Unix (hobbs) - -2000-01-12 (bug fix) made imported commands also import their -compile procedure (duffin) - -2000-01-12 (bug fix) fixed 'info procs ::namesp::*' behavior to return -procs in a namespace (dejong) - -2000-01-12 (feature enhancement) added support for setting permissions -symbolicly (like chmod) in [file attributes $file -permissions ...] (schoebel) - -2000-01-13 (bug fix) fixed lsort -dictionary problem when sorting -characters between 'Z' and 'a' (flawed upper/lower comparison logic) (melski) - ---- Released 8.3b2, January 13, 2000 --- See ChangeLog for details --- - -2000-01-14 (feature enhancement) clock format %Q added, clock scan updated - -2000-01-20 (bug fix) corrected complex array elem compiling (Spjuth) - -2000-01-20 (bug fix) made [info body] always return a string type arg, -to prevent possible misuse of bytecodes in the wrong context (hobbs) - -2000-01-20 (bug fixes) several fixes to variable handling to prevent -possible crashes, and further definition of correct behavior (melski) - -2000-01-25 (bug fixes) improved QNX, Ultrix and OSF1 (Tru64) config and -compatibility (edge, furukawa) - -2000-01-25 (bug fix) fixed mem leak when calling lsort with a bad -command -argument (hobbs) - -2000-01-27 (feature enhancement) package mechanism overhaul: changed -behavior of pkg_mkIndex to do -direct by default, added -lazy option. -Fixed pkg_mkIndex to handle odd proc names and auto_mkIndex to use platform -independent file paths. Other fixes for odd package quirks. Added -::pkg namespace and ::pkg::create helper function. (melski) - -2000-02-01 (bug fix) fixed problem where http POST would send one extra -newline (vasiljevic) - -2000-02-02 (feature enhancement) added docs for new regexp -inline and --all switches. (hobbs) - -2000-02-08 (bug fix) corrected handling of "next monthname" in clock scan -(melski) - -2000-02-09 (bug fix) restored Mac source to build readiness and prevented -mac panic from an error when closing an async socket (steffen, ingham) - -2000-02-10 (feature enhancement) improved error reporting for failed -loads on Windows (dejong, hobbs) - ---- Released 8.3.0, February 10, 2000 --- See ChangeLog for details --- - -2000-03 (bug fixes, feature enhancement) overhaul of http package for -proper handling of async callbacks (new options), version is now at 2.3 -(tamhankar, welch) - -2000-03 (performance enhancement) speedup in Windows filename handling (newman) -and ==/!= empty string in exprs. (hobbs) - -2000-03-27 (bug fix) added uniq'ing test to namespace export list to -prevent unnecessary mem growth (hobbs) - -2000-03-29 (bug fix) fixed mem leak when repeatedly sourcing the same -bytecompiled (tbc) code repeatedly across different interpreters (hobbs) - -2000-03-29 (config enhancement) improved build support for gcc/mingw on -Windows (nijtmans, hobbs) and added RPM target (melski) - -2000-03-31 (bug fix) corrected data encoding problem when using -"exec << $data" construct (melski) - -2000-04 (feature enhancement) overhaul of threading mechanism to better -support tcl level thread command (new APIs Tcl_ConditionFinalize, -Tcl_MutexFinalize, Tcl_CreateThread, etc, all docs in Thread.3). -(kupries, graveraux) -This enables the tcl level thread extension. (welch) - -2000-04-10 (bug fix) fixed infinite loop case in regexp -all (melski) - -2000-04-13 (config enhancement) added support for --enable-64bit-vis -Sparc target. (hobbs) - -2000-04-18 (bug fix) moved tclLibraryPath to thread-local storage to fix -possible race condition on MP machines (hobbs) - -2000-04-18 (config enhancement) added MacOS X build target and -tclLoadDyld.c dl type. (sanchez) - -2000-04-23 (bug fix) several Mac socket fixes (ingham) - -2000-04-24 (bug fix) fixed hang in threaded Unix case when backgrounded -exec process was running (dejong) - ---- Released 8.3.1, April 26, 2000 --- See ChangeLog for details --- - -2000-04-26 (doc fix) updated/added documentation for many API's and -commands (melski) - -2000-05-02 (feature enhancement) added support for joinable threads; -extended API's for channels to allow channels to move between threads -(kupries) - -2000-05-02 (feature enhancement) changed error return for procedures -with incorrect args to be like the Tcl_WrongNumArgs API, with a "wrong -# args: ..." message printed, with an args list (hobbs) - -2000-05-08 (feature enhancement) added [array statistics] command - -2000-05-08 (performance enhancement) rewrote Tcl_StringCaseMatch -algorithm for better performance; this affects the [string match] -command; added "eq" and "ne" operands to expr, for testing -string equality and inequality (hobbs) - -2000-05-09 (feature enhancement) extended [lsearch] to support sorted -list searches and typed list searches (melski) - -2000-05-10 (feature enhancement) added [namespace exists] command -(darley) - -2000-05-18 (build enhancement) added support for mingw compile env and -cross-compiling (dejong) - -2000-05-18 (bug fix) corrected clock grammar to properly handle the -"ago" keyword when it follows multiple relative unit specifiers -(melski) - -2000-05-22 (compile fix) type cast cleanups (dejong) - -2000-05-23 (performance enhancement) added byte-compiled -implementation of [return] command and [string] command (melski) - -2000-05-26 (performance enhancement) extended byte-compiled [string] -command with support for [string compare/index/match] (hobbs) - -2000-05-27 (feature enhancement) added ability to set [info script] -return value ([info script ?newFileName?]) (welch) - -2000-05-31 (feature enhancement) added support for regexp and exact -pattern matching for [array names] (gazetta) - -2000-05-31 (feature enhancement) added -nocomplain and -- flags to -[unset] to allow for silent unset operation (hobbs) - ---- Released 8.4a1, June 6, 2000 --- See ChangeLog for details --- - -2000-05-29 (bug fix) corrected resource cleanup in http error cases. -Improved handling of error cases in http. (tamhankar) - -2000-07 (feature rewrite) complete rewrite of the Tcl IO channel subsystem -to correct problems (hangs, core dumps) with the initial stacked channel -implementation. The new system has many more tests for robustness and -scalability. There are new C APIs (see Tcl_CreateChannel), but only -stacked channel drivers are affected (ie: TLS, Trf, iogt). The iogt -extension has been added to the core test code to test the system. -(hobbs, kupries) - **** POTENTIAL INCOMPATABILITY **** - -2000-07 (build improvements) cleanup of the makefiles and configure scripts -to correct support for building under gcc for Windows. (dejong) - -2000-08-07 (bug fix) corrected sizeof error in Tcl_GetIndexFromObjStruct. -(perkins) - -2000-08-07 (bug fix) correct off-by-one error in HistIndex, which was -causing [history redo] to start its search at the wrong event index. (melski) - -2000-08-07 (bug fix) corrected setlocale calls for XIM support and locale -issues in startup. (takahashi) - -2000-08-07 (bug fix) correct code to handle locale specific return values -from strftime, if any. (wagner) - -2000-08-07 (bug fix) tweaked grammar to properly handle the "ago" keyword -when it follows multiple relative unit specifiers, as in -"2 days 2 hours ago". (melski) - -2000-08-07 (doc fixes) numerous doc fixes to correct SEE ALSO and NAME -sections. (english) - -2000-08-07 (bug fix) new man pages memory.n, TCL_MEM_DEBUG.3, Init.3 and -DumpActiveMemory.3. (melski) - ---- Released 8.3.2, August 9, 2000 --- See ChangeLog for details --- - -2000-06 thru 2000-11 (build improvements) Added support for mingw (gcc on -Windows), AIX-5 and Win64 builds (dejong, hobbs) - -2000-06-23 (feature enhancement) ability to use Tcl_Obj *s as hash keys (duffin) - -2000-06-29 (new features) added [mcmax] and [mcmset] and extended [unknown] in -msgcat package (duperval, krone, nelson) -=> msgcat 1.1 - -2000-08 thru 2000-09 added tclPlatDecls.h to default install (melski, hobbs) - -2000-08-24 (new feature) Enhanced trace syntax to add: - trace {add|remove|list} {variable|command} name ops command -(darley, melski) - -2000-09-06 (cross-platform feature) Set ^Z (\32) as default EOF char. (hobbs) - -2000-09-07 partial fix for bug 2460 to prevent exec mem leak on Windows for the -common case (gravereaux) - -2000-09-14 Improved string allocation growth for large strings (hintermayer, -melski) - -2000-09-14 New non-panic'ing mem allocation functions Tcl_AttemptAlloc, -Tcl_AttemptRealloc, Tcl_AttemptSetObjLength (melski) - -2000-09-20 (new features) completely new, enhanced syntax in tcltest package. -Backwards compatable with tcltest v1. (hom) -=> tcltest 2.0 - -2000-09-27 (bug fix) fixed a bug introduced by a partial fix in 8.3.2 that -didn't set nonBlocking correctly when resetting the flags for the write -side (mem leak) Correct mem leak in channels when statePtr was released -(hobbs) - -2000-09-29 (bug fix) corrected reporting of space parity on Windows (Eason) - -2000-10-06 (bug fix) corrected [file channels] to only return channels in -the current interpreter (hobbs) - -2000-10-20 (performance enhancement) call stat only when necessary in 'glob' to -speed up command significantly in base cases (hobbs) - -2000-10-27 Fixed mem leak in Tcl_CreateChannel. Re-purified core via test -suites. (hobbs) - -2000-10-30 (new feature) add "ja_JP.eucJP" map to "euc-jp" encoding (takahashi) - -2000-11-01 (mem leak) Corrected excessive mem use of info exists on a -non-existent array element (hobbs) - -2000-11-02 (bug fix) Corrected sharing of tclLibraryPath in threaded -environment (gravereaux) - -2000-11-03 (new feature) Tcl_SetMainLoop enables defining an event loop for -tclsh. This enables Tk as a truly loadable package. (hobbs) - ---- Released 8.4a2, November 3, 2000 --- See ChangeLog for details --- - -2000-09-27 (bug fix) fixed a bug introduced by a partial fix in 8.3.2 that -didn't set nonBlocking correctly when resetting the flags for the write -side (mem leak) Correct mem leak in channels when statePtr was released -(hobbs) - -2000-09-29 (bug fix) corrected reporting of space parity on Windows (Eason) - -2000-10-06 (bug fix) corrected [file channels] to only return channels in -the current interpreter (hobbs) - -2000-10-20 (performance enhancement) call stat only when necessary in 'glob' to -speed up command significantly in base cases (hobbs) - -2000-11-01 (mem leak) Corrected excessive mem use of info exists on a -non-existent array element (hobbs) - -2000-11-02 (bug fix) Corrected sharing of tclLibraryPath in threaded -environment (gravereaux) - -2000-11-23 (mem leak) fixed potential memory leak in error case of lsort -(fellows) - -2000-12-09 (feature enhancement) changed %o and %x to use strtoul instead -of strtol to correctly preserve scan<>format conversion of large integers -(hobbs) -Fixed handling of {!} in expressions (hobbs, fellows) - -2000-12-14 (feature enhancement) improved (s)rand for 64-bit platforms -(porter) - -2001-01-04 (bug fix) corrected parsing of $tcl_libPath at startup on -Windows (porter) - -2001-01-30 (bug fix) Fixed possible hangs in fcopy. (porter) - -2001-02-15 (performance enhancement) improved efficiency of [string split] -(fellows) - -2001-03-13 (bug fix) Correctly possible memory corruption in string map {} -$str (fellows) - -2001-03-29 (bug fix) prevent potential race condition and security leak in -tmp filename creation on Unix. (max) -Fixed handling of timeout for threads (corrects excessive CPU usage issue -for Tk on Unix in threaded Tcl environment). (ruppert) - -2001-03-30 (bug fix) corrected Windows memory error on exit (wu) -Fixed race condition in readability of socket on Windows. - -2001-04-03 (doc fixes) numerous doc corrections and clarifications. -Update of READMEs. - -2001-04-04 (build improvements) redid Mac build structure (steffen) -Corrected IRIX-5* configure (english). Added support for AIX-5 (hobbs). -Added support for Win64 (hobbs). - ---- Released 8.3.3, April 6, 2001 --- See ChangeLog for details --- - -2000-11-23 (new feature)[TIP 7] higher resolution timer on Windows (kenny) - -2001-01-18 (new feature) Tcl_InitHashTableEx renamed to Tcl_InitCustomHashTable -(kupries) - -2001-03-30 (new feature)[TIP 10] support for thread-aware/hot channels (kupries) - -2001-04-06 (new feature)[219280] auto-loading hidden in ::errorInfo (porter) - -2001-04-07 (bug fix)[406709] corrected panic when extra items left on the -byte compiler execution stack (sofer) - -2001-04-09 (bug fix)[219136,232558] improved use of thread-safe functions in -unix time commands (kenny) - -2001-04-24 (new feature)[TIP 27] started CONST-ification of the Tcl APIs (kenny) - -2001-05-03 (new feature) [auto_import] now matches patterns like -[namespace import], not like [string match] (porter) - **** POTENTIAL INCOMPATABILITY **** - -2001-05-07 (new feature)[416643] distinct srand() seed per interp (sofer) - -2001-05-15 (new feature) new Tcl_GetUnicodeFromObj API (hobbs) - -2001-05-16 (performance enhancement) byte-compiled versions of [lappend], -[append] simple cases (hobbs) - -2001-05-23 (new feature) added ISO-8859-15 and koi8-u encodings, updated other -encoding tables based on http://www.unicode.org/Public/MAPPINGS/ (kuhn) - -2001-05-27 (new feature) updated to Unicode 3.1.0 data set (still using 16 -bits for Tcl_UniChar though) (hobbs) - -2001-05-30 (new feature)[TIP 15] Tcl_GetMathFuncInfo, Tcl_ListMathFuncs, -Tcl_InfoObjCmd, InfoFunctionsCmd APIs (fellows) - -2001-06-08 (bug fix,feature enhancement)[219170,414936] all Tcl_Panic -definitions brought into agreement (porter) - -2001-06-12 (bug fix)[219232] regexp returned non-matching sub-pairs to have -index pair {-1 -1} (fellows) - -2001-06-27 (bug fix)[217987] corrected backslash substitution of non-ASCII -characters. (hobbs, riefenstahl) - -2001-06-28 (bug fix)[231259] failure to re-compile after cmd shadowing (sofer) - -2001-07-02 (bug fix)[227512] corrected [concat] treatment of UTF-8 strings -(hobbs, barras) - -2001-07-12 (new feature)[TIP 36] Tcl_SubstObj API (fellows) - -2001-07-16 (bug fix) corrected thread-enabled pipe closing on Windows -(hobbs, jsmith) - -2001-07-18 (bug fix)[427196] corrected memory overwrite error when buffer size -of a channel is changed after channel use has already begun (kupries, porter) - -2001-07-31 (new feature)[TIP 17] TclFS* APIs provide new virtual file -system. This includes the addition of 'file normalize', 'file system', -'file separator' and 'glob -tails' (darley) - -2001-08-06 (bug fix) removed use of tmpnam in TclpCreateTempFile on Unix (lim) - - * improved build support for IRIX, GNU HURD, Mac OS 9 and OS X - - * configure scripts revamped for better support of cygwin and gcc on - Windows (mdejong) - - * corrected several minor errors noted by Purify (hobbs) - ---- Released 8.4a3, August 6, 2001 --- See ChangeLog for details --- - -2001-06-27 (bug fix)[217987] corrected backslash substitution of non-ASCII -characters. (hobbs, riefenstahl) - -2001-06-28 (bug fix)[231259] failure to re-compile after cmd shadowing (sofer) - -2001-07-02 (bug fix)[227512] corrected [concat] treatment of UTF-8 strings -(hobbs, barras) - -2001-07-16 (bug fix) corrected thread-enabled pipe closing on Windows -(hobbs, jsmith) - -2001-07-18 (bug fix)[427196] corrected memory overwrite error when buffer size -of a channel is changed after channel use has already begun (kupries, porter) - -2001-08-06 (bug fix)[442665] corrected object reference counting in [gets] -(jikamens) - -2001-08-06 (new feature) added GNU (HURD) configuration target. (brinkmann) - -2001-08-07 (bug fix)[406709] corrected panic when extra items left on the -byte compiler execution stack (see test foreach-5.5) (sofer, tallneil, jstrot) - -2001-08-08 (new features) updated packages msgcat 1.1.1, opt 0.4.3, -tcltest 1.0.1, dependencies checked (porter) - -2001-08-20 (new feature)[452217] http 2.3.2: include port number in Host: header -to comply with HTTP/1.1 spec (RFC 2068) (hobbs, tils) - -2001-08-23 (new feature) added QNX-6 build support (loverso) - -2001-08-23 (bug fix) corrected handling of spaces in path name passed to -[exec] on Windows (kenpoole) - -2001-08-24 (bug fix) corrected [package forget] stopping on non-existent -package (porter) - -2001-08-24 (bug fix) corrected construction of script library search path -relative to executable (porter) - -2001-08-24 (bug fix) [auto_import] now matches patterns like -[namespace import], not like [string match] (porter) - **** POTENTIAL INCOMPATABILITY **** - -2001-08-27 (new feature) added Tcl_SetMainLoop() to enable loading Tk as a -true package (hobbs) - -2001-08-30 (bug fix) build support for Crays (andreasen) - -2001-09-01 (bug fix) rewrite of Tcl_Async* APIs to better manage thread -cleanup (gravereaux) - -2001-09-06 (new feature) http 2.4: honor the Content-encoding and charset -parameters; add -binary switch for forcing the issue (hobbs, saoukhi, orwell) -=> http 2.4 - -2001-09-06 (performance enhancement) rewrite of file I/O flush management on -Windows. Approximately 100x speedup for some operations. (kupries, traum) - -2001-09-10 (bug fix) corrected finalization error in TclInExit (darley) - -2001-09-10 (bug fix) protect against alias loops (hobbs) - -2001-09-12 (bug fix) added missing #include in tclLoadShl.c (techentin) - -2001-09-12 (bug fix) script library path construction on Windows no longer -uses registry, nor adds the current working directory to the path (porter) - -2001-09-12 (bug fix) correct bugs in compatibility strtod() (porter) - -2001-09-13 (bug fix) Tcl_UtfPrev now returns the proper location when the -middle of a UTF-8 byte is passed in (hobbs) - -2001-09-19 (bug fix) [format] and [scan] corrected for 64-bit machines (rmax) - -2001-09-19 (new feature) --enable-64-bit support for HP-11. (hobbs) - -2001-09-19 (new feature) native memory allocator now default on Windows -(hobbs) - -2001-09-20 (new feature) WIN64 support and extra processor definitions -(hobbs, mstacy) - -2001-09-26 (bug fix) corrected potential deadlock in channels that do not -provide a BlockModeProc (kupries, kogorman) - -2001-10-03 (new feature) WIN64 build support (hobbs) - -2001-10-03 (bug fix) correction in thread finalization (rbrunner) - -2001-10-04 (new feature) updated encodings with latest mappings from -www.unicode.org (hobbs) - -2001-10-11 (bug fix) corrected cleanup of self-referential bytecodes at -interpreter deletion (sofer, rbrunner) - -2001-10-16 (new feature) config support for MacOSX / Darwin (steffen) - -2001-10-16 (new feature, Mac) change in binary extension format from MachO -bundles to standard .dylib dynamic libraries like on other unices. - *** POTENTIAL INCOMPATIBILITY *** - -2001-10-18 (bug fix) corrected off-by-one-day error in clock scan with -relative months and years during swing hours. (lavana) - ---- Released 8.3.4, October 19, 2001 --- See ChangeLog for details --- - -2001-08-21 (bug fix)[219184] overagressive compilation of [catch] (sofer) - -2001-08-22 (new feature)[227482] [dde request -binary] (hobbs) -=> dde 1.2 - -2001-08-30 (performance enhancement)[456668] fully qualified command names use -cached Command for all namespaces, avoiding repeated lookups (sofer) - -2001-08-31 (performance enhancement) bytecompiled [list] (hobbs) - -2001-09-02 (bug fix)[403553] Add -Zl to VC++ compile line for tclStubLib to -avoid any specific C-runtime library dependence. (gravereaux) - -2001-09-05 (new feature) restored support for Borland compiler (gravereaux) - -2001-09-05 (new feature)[TIP 49] Tcl_OutputBuffered API (schroedter, fellows) - -2001-09-07 (new feature) restored VC++ 5.0 compatibility (gravereaux) - -2001-09-10 (performance enhancement)[TIP 53,451441] [proc foo args {}] now -compiles to 0 bytecodes (sofer) - -2001-09-13 (new feature)[TIP 56] Tcl_EvalTokensStandard API (sofer) - -2001-09-13 (new feature) Old ChangeLog entries => ChangeLog.1999 (hobbs) - -2001-09-17 (new feature) compiling with TCL_COMPILE_DEBUG now required to -enable all compile and execution tracing (sofer) - *** POTENTIAL INCOMPATIBILITY *** - -2001-09-19 (bug fix)[411825] made TclNeedSpace UTF-8 aware (fellows) - -2001-09-19 (bug fix)[219166] overagressive compilation of "quoted" bodies of -[for], [foreach], [if], and [while] (sofer) - -2001-09-19 (performance enhancement) bytecompiled [string match] (hobbs) - -2001-10-15 (new feature)[TIP 35] serial channel configuration: Win (schroedter) - -2001-11-06 (bug fix)[478856] loss of fileevents due to short reads (kupries) - -2001-11-06 (new feature) revitalized makefile.vc (gravereaux) - -2001-11-07 (new feature) Cygwin gcc support dropped. Use mingw (dejong) - *** POTENTIAL INCOMPATIBILITY *** - -2001-11-07 (new feature) Support --include-dir= and --libdir= options to -configure. Store in tclConfig.sh as TCL_INCLUDE_SPEC and TCL_LIB_SPEC. -(dejong) - *** POTENTIAL INCOMPATIBILITY *** - -2001-11-08 (new feature) Enable --enable-threads on FreeBSD (dejong) - -2001-11-08 (new feature) New make target 'make gdb' (dejong) - -2001-11-09 (bug fix)[480176] [global] mishandled varnames matching :* (porter) - -2001-11-12 (new feature)[TIP 22,33,45] new command [lset], -[lindex] extended to accept multiple indices. (kenny, hobbs) - -2001-11-16 (new feature) new configure option --enable-langinfo=no. -By default, nl_langinfo() is used on Unix to determine system encoding. -Tcl's built-in system is used only if that fails, or configured with ---enable-langinfo=no. (hobbs, wagner) - -2001-11-19 (new feature)[TIP 62] A Tcl_VarTraceProc can now return Tcl_Obj * -or a dynamic string as well as a static string to indicate an error (fellows) - -2001-11-19 (new feature)[TIP 73] Tcl_GetTime API (kenny) - -2001-11-19 (bug fix)[478847] overflows in [time] of >2**31 microseconds (kenny) - -2001-11-29 (performance enhancement) caching scheme added to [binary scan] -(fellows) - -2001-12-05 (new feature) new algorithm for [array get] adds safety when read -traces modify the array. (sofer) - *** POTENTIAL INCOMPATIBILITY *** - -2001-12-10 (bug fix)[490514] doc fixes (porter,english) - -2001-12-18 (new feature) removed unix/dltest/configure; unix/configure does -all (dejong) - -2001-12-19 (new feature) New make target 'make shell' (dejong) - -2001-12-21 (new feature) MaxOSX / Darwin support (steffen) - -2001-12-28 (new feature) new command [memory onexit] replaces [checkmem] when -compiled with TCL_MEM_DEBUG. Added documentation. (porter) - *** POTENTIAL INCOMPATIBILITY *** - -2001-12-28 (bug fix) proper case in [auto_execok] use of $env(COMPSPEC) (hobbs) - -2002-01-05 (feature rewrite) Tcl_Main() rewritten and documentation improved. -Interactive operation and event loop operation (via Tcl_SetMainLoop) now -interleave cleanly. Also more robust against strange happenings. (porter) - -2002-01-17 (bug fix)[504642] Tcl_Obj refCounts in [gets] (griffen,kupries) - -2002-01-21 (bug fix)[506297] infinite loop writing in iso2022-jap encoding -(forssen,kupries) - -2002-01-24 (HTTP server bug workaround)[504508] leave the default port out -of the Host: header value -=> http 2.4.1 (hobbs) - -2002-01-25 (new feature)[496733] socket options -eofchar and -translation -return read-only values (dejong) - -2002-01-28 (new feature) Old ChangeLog entries => ChangeLog.20900 (hobbs) - -2002-01-28 (performance enhancement) bytecompiled [regexp] for trivial cases -that amount to string matching. Also -nocase and --. (hobbs) - -2002-02-05 (bug fix) [http::error] called when [::error] intended -=> http 2.4.2 (porter) - -2002-02-05 (bug fix)[465765] avoid zero-byte writes to STREAMs -(talcott,kupries) - -2002-02-06 (performance enhancement) [regsub] special cases that map to -[string map] detected. (hobbs) - -2002-02-06 (bug fix)[495213] [scan] accept 0x as prefix of base 16 value -(hobbs) - -2002-02-10 (new feature)[TIP 32,79] Tcl_CreateObjTrace API (kenny) - -2002-02-12 (new feature) partial support for DJGPP Tcl on DOS (gravereaux) - -2002-02-14 (mem leak) Fixed leaking an empty Tcl_Obj when [gets $chan] -errored out. (kupries, sofer) - -2002-02-15 (new feature)[TIP 72] support for 64-bit integer values on -32-bit platforms and ability to work with >2GiB files. Extends many -commands. See ChangeLog and TIP for details. - *** POTENTIAL INCOMPATIBILITY *** - -2002-02-22 (bug fix)[476537] Fix panic when loading shared library without -proper use of stubs on platform without backlinking (porter) - -2002-02-22 (new feature) 64-bit support for xlc compiler on AIX-4 (hobbs) - -2002-02-22 (new feature)[521560] Removed limits on filename length and -format [source]able through the Safe Base (hobbs) - -2002-02-22 (performance enhancement) optimized bytecodes for [if], [for], -[while] and constant conditions (sofer) - -2002-02-22 (new feature)[TIP 76] [regsub] can now return result (fellows) - -2002-02-25 (bug fix)[495207] buffer overrun when closing ] left out of -argument to [subst] (sofer, english) - -2002-02-25 (bug fix)[514392] [load] updated for Mac OS X 10.1 (steffen) - -2002-02-26 (bug fix) [info hostname] choked on names >31 characters (hobbs) - -2002-02-26 (new feature)[TIP 35] serial channel configuration: Unix -(schroedter, hobbs) - -2002-02-25 (bug fix)[483575] [fconfigure ... -error] now no-op on Mac (kupries) - -2002-02-28 (performance enhancement)[458872] fully qualified command names use -cached Command for all namespaces, avoiding repeated lookups (sofer) - - * (new feature)[TIP 27] completed CONST-ification of TCL APIs. -Added compiler macro USE_NON_CONST to keep using those old API prototypes -that present irreconcilable source incompatibilities with header files -of prior Tcl releases. Others will need to be reconciled. - *** POTENTIAL INCOMPATIBILITY *** - -2002-03-04 (bug fix)[474358, 218099, 219314, 524674] fixed several problems -related to the handling of iso2022 text and finalization of escape-based -encodings. (taguchi, takahashi, hobbs) - ---- Released 8.4a4, March 5, 2002 --- See ChangeLog for details --- - -2002-03-06 (new feature)[TIP 80] expanded [lsearch] options (wilkason, fellows) - -2002-03-07 (new feature)[TIP 87] [interp recursionlimit] (trier) - -2002-03-08 (platform feature) mingw 1.1 build favored (dejong) - -2002-03-20 (new feature)[TIP 27] CONST-ified variable access functions (porter) - -2002-03-24 (bug fix)[511666,511658,523217,530960] expanded -Tcl_FSMatchInDirectory to handle assorted [glob] bugs in VFS. (darley) - *** POTENTIAL INCOMPATIBILITY with prior 8.4a releases *** - -2002-03-25 (bug fix)[495726] stopped tcltest disabling of auto-loading (porter) - -2002-03-25 (bug fix)[495977] allow \n in test constraints (porter) - -2002-03-27 (platform support)[527941,533862] VC/winhelp/W9X (spjuth, -gravereaux) - -2002-03-28 (bug fix)[219181] exception at level 0 issues (sofer) - -2002-03-28 (bug fix)[219362] command termination; Tcl_CreateTrace (knoll,sofer) - -2002-04-05 (bug fix)[536879] exceptions during variable subst (porter) - -2002-04-15 (bug fix)[497446,513983] tcltest syntax errors now raised (porter) - ***POTENTIAL INCOMPATIBILITY with prior tcltest 2.0.* (8.4aX)*** - -2002-04-17 (bug fix)[495660] [(save|restore)state] deprecated (porter) - -2002-04-17 (bug fix)[526524] escape-based encodings corrected (yamamoto, hobbs) - -2002-04-18 (bug fix)[542588] [expr] error msgs improved (ehrens, sofer) - -2002-04-18 (bug fix)[545325] [info level $level] now returns [namespace eval] -as documented (suchenwirth,sofer) - -2002-04-19 (bug fix)[544727] export [mcload]; ns context of [mcmax] (porter) -=> msgcat 1.2.3 - -2002-04-22 (performance enhancement) threaded memory allocator (AOL, hobbs) - -2002-04-24 (new feature) TCLTK_NO_LIBRARY_TEXT_RESOURCES #define disables -inclusion of tcl library code in resource fork on Mac. (steffen) - -2002-05-21 (platform support) static libs on OSF (dejong) - -2002-05-24 (bug fix)[557878] set encoding on listening socket (staplin, -kupries) - -2002-05-24 (new feature)[TIP 91] Tcl_Seek compatibility (fellows) - -2002-05-28 (bug fix)[545579] VFS [load] left temp file (darley) - -2002-05-28 (bug fix)[559376] plug timezone env leak on Windows (hobbs) - -2002-05-29 (performance enhancement) [string compare] optimized (hobbs,fellows) - -2002-05-31 (bug fix)[550534] plug interp leak in [pkg_mkIndex] (helmut) - -2002-05-31 (dead code)[474335,555635] removed all use of matherr() (english) - *** POTENTIAL INCOMPATIBILITY *** - -2002-06-04 (new feature)[TIP 85,521362] custom result match in tcltest -(markus, porter) -=> tcltest 2.1 - -2002-06-06 (bug fix)[524352] encoding, threading, and environment issues on -MacOSX (steffen) - -2002-06-06 (bug fix)[512214,558742,512214,461000] lazy initialization of -tcltest constraints (porter) - -2002-06-07 (bug fix)[563122,564595] EOVERFLOW definitions (fellows) - -2002-06-11 (bug fix)[567386] [info locals] corrections (sofer) - -2002-06-14 (new feature)[TIP 102] [trace list] renamed [trace info] (fellows) - -2002-06-17 (new feature)[525522,525525] msgcat support for XPG4 locales; -examination of LC_ALL, LC_MESSAGES environment variables (haible, porter) -=> msgcat 1.3 - -2002-06-17 (new feature)[565088] header files assume modern C compiler by -default; older compilers may need configuration (english) - *** POTENTIAL INCOMPATIBILITY *** - -2002-06-17 (bug fix)[554068] [exec] argument quoting on Windows (darley) - -2002-06-17 (new feature)[TIP 62,462580] command execution traces (lavana) - -2002-06-19 (bug fix)[558324] regexp sets a linked variable (watson) - - * (performance enhancment) optimizations of bytecode execution (sofer) - -2002-06-21 (new feature)[TIP 99,562970] new [file link] command (darley) - -2002-06-24 (new feature)[TIP 101] new [tcltest::configure] command (porter) -=> tcltest 2.2 - -2002-06-25 (new feature) --enable-man-symlinks and --enable-man-compression -options to configure (max) - -2002-06-26 (bug fix)[565880] [clock format] now respects locale (max) - *** POTENTIAL INCOMPATIBILITY *** - -2002-07-03 (bug fix)[577015] [catch] catches even compile errors (sofer) - ---- Released 8.4b1, July 5, 2002 --- See ChangeLog for details --- - -2002-07-08 (bug fix) restored compatibility of [viewFile] in tcltest (porter) - -2002-07-11 (bug fix) [file normalize] returns long form on Win 95/98/ME (darley) - -2002-07-15 (performance enhancment) variable operations rewritten to store - and use cached Var pointers (sofer) - -2002-07-22 (bug fix)[218000] Inf and Nan are floating-point values (fellows) - -2002-07-23 (platform support)[219220] 64-bit compile on IRIX (dejong) - -2002-07-25 (bug fix)[219218] return codes in background errors (english) - -2002-07-28 (bug fix)[582522] alias fires exec traces (sofer) - -2002-07-29 (bug fix)[578363] regexp (fellows,pvgoran) - -2002-07-30 (bug fix)[584603] WriteChars infinite loop non-UTF-8 string (kupries) - -2002-08-04 (new feature)[584051,580433,585105,582429][TIP 27] Tcl interfaces - are now fully CONST-ified. Use the symbols USE_NON_CONST or - USE_COMPAT_CONST to select interfaces with fewer changes. - *** POTENTIAL INCOMPATIBILITY *** - -2002-08-05 (bug fix)[589859] tcltest setup and cleanup scripts skipped when - test body is skipped (porter) - => tcltest 2.2 - -2002-08-07 (bug fix)[587488] mem leak with USE_THREAD_ALLOC (sofer,sass) - -2002-08-07 (feature enhancement)[584794,584650,472576] boolean values - are no longer always re-parsed from string. (sofer) - -Many internal bugs fixed. -Considerable cleanup of the test suite. - ---- Released 8.4b2, August 9, 2002 --- See ChangeLog for details --- - -2002-08-20 (new feature) --enable-memdebug configure option (kupries) - -2002-08-23 (bug fix)[597936] mem leak with USE_THREAD_ALLOC (sofer,zoran) - -2002-08-26 (bug fix)[599788] segfault in compiler (sofer,wilkason) - -2002-08-28 (bug fix)[414910] avoid mem leaks accessing environment variables - on Windows (welton,gravereaux) - -2002-08-31 (platform support)[TIP 108] Mac OS X port (steffen,ingham) - -2002-09-02 (platfrom support) 64-bit compile on HP-11 (martin) - ---- Released 8.4.0, September 10, 2002 --- See ChangeLog for details --- - -2002-09-18 (platform support) Updated support for compiling with Cygwin and -either mingw or gcc. (khan, howell, dejong) - -2002-09-22 (bug fix)[612786, 611922] Corrected [puts -nonewline] within -test bodies. Also corrected reporting of body return code. Updated tcltest -to v2.2.1. - -2002-09-24 (bug fix)[613117] More robust 64-bit wide integer value -detection (fellows) - -2002-09-26 (bug fix) correct overeager optimization of noop proc to handle -the precompiled case. (sofer, hobbs) - -2002-09-26 (bug fix)[615115] removed extraneous spaces in koi8-u.enc that -confused encoding reader. - -2002-09-29 (bug fix)[219355] Added proper exiting conditions using Win32 -console signals. This handles the existing lack of a Ctrl+C exit to call -exit handlers when built for thread support. Also, properly handles exits -from other conditions such as CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, and -CTRL_SHUTDOWN_EVENT signals. In all cases, exit handlers will be called. -(gravereaux) - -2002-09-30 (bug fix) improve the checking for bad regular expressions -during regexp compilation. Resultant compiles were correct, but much -slower than necessary. (hobbs) - -2002-10-01 (bug fix) fix precompiled locals to support 8.3 precompiled -code. (hobbs) - -2002-10-09 (bug fix)[620735] Added code to set an exit handler on Windows -that terminates the thread that calibrates the performance counter, so that -the thread won't outlive unloading the Tcl DLL. (kenny) - -2002-10-09 (build support) all --enable-symbols to take the enhanced -options yes|no|mem|compile|all. (hobbs) - -2002-10-10 (build support) enable USE_THREAD_ALLOC (new threaded allocator) -by default on Windows. (hobbs, gravereaux) - -2002-10-14 (bug fix)[623269] correct possible mem leak in -Tcl_PutEnv. (brouwers) - -2002-10-15 (bug fix)[615043] fix in execution traces with idle tasks -firing. (lavana) - -2002-10-15 (platform support) Correct AIX-5 ppc and 4/5 64-bit build flags. -Correct HP 11 64-bit gcc building. (martin, hobbs) - -2002-10-17 (bug fix)[624755] Fixed code that check for proper # of args to -[array names] (porter) - -2002-10-18 (feature enhancement)[625453] Added support for broadcasting -changes to the registry Environment on Windows. Updated registry package -to v1.1. (hobbs) - -2002-10-22 (platform support)[624509] On macosx, add embedded framework -dirs to tcl_pkgPath: @executable_path/../Frameworks and -@executable_path/../PrivateFrameworks (if they exist), as well as the dirs -in DYLD_FRAMEWORK_PATH (if set). (steffen) - ---- Released 8.4.1, October 22, 2002 --- See ChangeLog for details --- - -2002-10-28 (bug fix)[627660] [package unknown] chaining for platform specifics - -2002-10-29 (bug fix)[627546] verbose [load] (dyld) error mesages on MacOSX - -2002-11-01 (bug fix) [package provide registry] consistent versions. - -2002-11-06 (bug fix)[582039] missing ar program -> configuration error - -2002-11-06 (feature enhancement) added new TclInThreadExit function to -test for thread exit vs whole process exit condition. The TclInExit -function now correctly returns 1 during Tcl_Finalize processing. - *** POTENTIAL INCOMPATIBILITY *** - -2002-11-13 (bug fix)[615043] some execution traces were not firing - -2002-11-18 (bug fix)[634856] multiple signs no longer accepted as valid integer -[string is integer ++1] => 0 - *** POTENTIAL INCOMPATIBILITY *** - -2002-11-26 (bug fix)[593810,597924] clean exit of channel worker threads on Win - -2002-11-28 (new feature) `make valgrind` target - -2002-12-03 (bug fix)[615304] repeated load/unload of Tcl now possible - -2002-12-11 (bug fix)[647307] negative return codes now propagated by procs - -2002-12-11 (bug fix)[648441] syntax error in [expr 0x] now detected. - -2003-01-07 (bug fix)[633204] [catch {return}] => 2 (not 0) - -2003-01-09 (bug fix)[634151] [file (a|m)time $nonASCIIpath $time] now works - -2003-01-16 (bug fix) dde eval with {} service name does not crash. -=> dde 1.2.1 - -2003-01-16 (bug fix)[635200,655645,615043,571385] many command trace fixes - -2003-01-31 (bug fix)[675614,678415,676978] tcltest conflicts in cleanup -and -outfile; also failure in space-containing path; also missing [close] -=> tcltest 2.2.2 - -2003-02-01 (bug fix)[670042] corrected [info loaded {}] for static -packages in multiple interps. - -2003-02-01 (bug fix)[675356] [clock clicks {}]; [clock clicks -] - syntax errs - -2003-02-01 (bug fix)[656660] MT-safety for [clock format] - -2003-02-03 (bug fix)[651271] command rename traces get fully-qualified names - *** POTENTIAL INCOMPATIBILITY *** - -2003-02-07 (performance improvement) [glob] on Windows is 2.5 times faster - -2003-02-07 (feature change) lack of Cygwin support indicated by config error - -2003-02-11 (bug fix)[684744] [info complete] stopped by \x00 - -2003-02-11 (bug fix)[685445] [glob -types l] missed broken symlinks on Unix - -2003-02-11 (bug fix) [lsearch -regexp $a $a] doesn't crash - -2003-02-13 (bug fix)[685926] accept non-ASCII7 for tcl_platform(user) on Win - -2003-02-15 (bug fix)[673714] stop crash when Tcl_DeleteEvents deletes last - -2003-02-15 (bug fix)[681841] parser missed some missing ] syntax errors - -2003-02-17 (bug fix)[684756] memory leak during command rename plugged - -2003-02-18 (bug fix)[689100] reduced per-thread memory overhead - -2003-02-18 (platform support)[651811] use xnet library on HP 11 (64 bit). - -2003-02-20 (bug fix)[Patch 689341] correct jis round-trip encoding - -2003-02-20 (bug fix)[689835] stop MacOSX hang trying to read a write-only pipe - -2003-02-07 (performance improvement) [tclPkgUnknown]: fewer vfs calls - -2003-02-18 (platform support) cut and splice procs for file channels on Mac - -2003-02-21 (bug fix)[690774] [binary scan] failed on some wide ints - -2003-02-22 (bug fix)[571002] plugged data leak during thread exit - -2003-02-25 (feature change) [pkg_mkIndex -load]: case-insensitive match - *** POTENTIAL INCOMPATIBILITY *** - -2003-02-27 (bug fix)[694232] stop [lsearch -start 0 {} x] segfault - ---- Released 8.4.2, March 3, 2003 --- See ChangeLog for details --- - -2003-03-06 (bug fix)[699042] Correct case-insensitive unicode string -comparison in Tcl_UniCharNcasecmp - -2003-03-11 (bug fix) Corrected loading of tclpip8x.dll on Win9x - -2003-03-12 (bug fix)[702383] Corrected parsing of interp create -- - -2003-03-12 (bug fix)[685106] Correct Tcl_SubstObj handling of \x00 bytes - -2003-03-14 (bug fix)[702622 699060] Correct wide int issues in 'format' - -2003-03-14 (bug fix)[698146] Remove assumption that file times and longs -are the same size. - -2003-03-18 (bug fix)[697862] Allow Tcl to differentiate between reparse -points which are symlinks and mounted drives on Windows - -2003-03-19 (bug fix)[705406] Bad command count on TCL_OUT_LINE_COMPILE - -2003-03-20 (bug fix)[707174] Store pointers to notifier funcs in a struct -to work around some platform linker issues - -2003-03-22 (bug fix)[708218] Load correct (non-)debug dll for dde or -registry - -2003-03-24 (bug fix)[631741 696893] Fixing ObjMakeUpvar's lookup algorithm -for the created local variable - -2003-04-07 (bug fix)[713562] Make sure that tclWideIntType is defined and -somewhat sensible everywhere - -2003-04-07 (bug fix)[711371] Corrected string limits of arguments -interpolated in error messages for 'if' - -2003-04-11 (bug fix)[718878] Corrected inconsistent results of -[string is integer] observed on systems where sizeof(long) != sizeof(int) - -2003-04-12 (bug fix) Substantial changes to the Windows clock synch -phase-locked loop in a quest for improved loop stability - -2003-04-16 [713562] Made changes so that the "wideInt" Tcl_ObjType is -defined on all platforms, even those where TCL_WIDE_INT_IS_LONG is defined. -Also made the Tcl_Value struct have a wideValue field on all platforms. -Potential incompatibility for TCL_WIDE_INT_IS_LONG platforms because that -struct changes size. - *** POTENTIAL INCOMPATIBILITY *** - -2003-04-25 (bug fix)[727271] Catch any errors returned by the Windows -functions handling TLS ASAP instead of waiting to get some mysterious crash -later on due to bogus pointers. - -2003-04-29 (bug fix) Correct 'glob -path {[tcl]} *', where leading -special character instead lists files in '/'. Bug only occurs on Windows -where '\' is also a directory separator. - -2003-05-09 (bug fix)[731754] Fixed memory leak in threaded allocator on -Windows caused by treating cachePtr as a TLS index - -2003-05-10 (bug fix)[710642] Ensure cd is thread-safe - -2003-05-10 (bug fix)[718002] Correct mem leak on closing a Windows serial -port - -2003-05-10 (bug fix)[714106] Prevent string repeat crash when overflow -sizes were given (throws error). - -2003-05-13 (feature enhancement)[736774] Use new versioned bundle resource -API to get tcl runtime library for TCL_VERSION on Mac OS X. - -2003-05-13 (bug fix)[711232] Worked around the issue of realpath() not -being thread-safe on Mac OS X by defining NO_REALPATH for threaded builds -on Mac OS X. - -2003-05-14 (bug fix)[557030] Correct handling of the gb2312 encoding by -making it an alias of the euc-cn encoding and creating a gb2312-raw -encoding for the original. Most uses of gb2312 really mean euc-cn. - -2003-05-14 (bug fix)[736421] Corrected another putenv() copy behavior -problem when compiling on Windows and using Microsoft's runtime. - ---- Released 8.4.3, May 20, 2003 --- See ChangeLog for details --- - -2003-05-23 (bug fix)[726018] reverted internals change to the -'cmdName' Tcl_ObjType that broke several extensions (TclBlend, e4graph...) -in the 8.4.3 release. - -2003-06-10 (bug fix)[495830] stop eval of bytecode in deleted interp. - -2003-06-17 (bug fix) corrections to regexp when matching emtpy string. - -2003-06-25 (bug fix)[748957] -*ieee compiler flags for Tru64 builds. - -2003-07-11 (bug fix) [pkg_mkIndex] indexes provided packages, not indexed ones. - -2003-07-15 (feature enhancement) MacOSX build system rewrite. - -2003-07-15 (bug fix)[771613] corrected segfault in [if] (buffer overflow) - -2003-07-16 (bug fix)[756791] corrected assumption that Tcl_Free == free - -2003-07-16 (feature enhancement) -DTCL_UTF_MAX=6 compile option forces -internal UCS-4 representation of Unicode (default is recommended UCS-2). - -2003-07-16 (bug fix)[767578] 64-bit corrections in thread notifier. - -2003-07-16 (bug fix)[759607] Safe Base tests normalized paths. - -2003-07-16 (feature enhancement)[Patch 679315] improved Cygwin path support - -2003-07-18 (bug fix)[706359] corrected broken -output option of [tcltest::test] -=> tcltest 2.4.4 - -2003-07-18 (bug fix)[753315] MT-safety of VFS records. - -2003-07-18 (bug fix)[759888] support for user:pass in URL by [http::geturl] -=> http 2.4.4 - -Improved documentation, new tests, and some code cleanup. -[655300, 720634, 735364, 748700, 756112, 756744, 756951, 758488, 760768, -763312, 769895, 771539, 771840, 771947, 771949, 772333] - ---- Released 8.4.4, July 22, 2003 --- See ChangeLog for details --- - -2003-07-23 (bug fix)[775976] fix registry compilation for VC7. - -2003-08-05 (enhancement)[781585] Use Tcl_ResetResult in bytecodes to -prevent potential costly Tcl_Obj duplication. - -2003-08-06 (bug fix)[781609] prevent non-Windows platforms from trying to -use the registry package inside msgcat. - -2003-08-27 (bug fix)[411825] Fix TclNeedSpace to handle non-breaking space -(\u00A0) and backslash escapes correctly. - -2003-09-01 (bug fix)[788780] Fix thread-safety issues in filesystem records. - -2003-09-19 (bug fix)[804681] Protect ::errorInfo and ::errorCode traces -from corrupting stack. - -2003-09-23 (bug fix)[218871] Fix handling of glob-sensitive chars in -auto_load and auto_import. - -2003-10-03 (bug fix)[811483] Fixed refcount management for command and -execution traces. - -2003-10-04 (bug fix)[789040] Fixed exec command.com error for Win9x. - -2003-10-06 (bug fix)[767834, 813273] Fixed volumerelative file -normalization and 'file join' inconsistencies. - -2003-10-08 (bug fix)[769812] Fix Tcl_NumUtfChars string length calculation -when negative parameter is given. - -2003-10-22 (bug fix)[800106] Handle VFS mountpoints inside glob'd dirs. - -2003-10-22 (bug fix)[599468] Watch for FD_CLOSE too on Windows when -asked for writable events by the generic layer. - -2003-10-23 (bug fix)[813606] Detect OS X pipes correctly. - -2003-11-05 (bug fix)[832657] Allow .. in libpath initialization. - -2003-11-11 (bug fix) Improve AIX-64 build configuration. - -2003-11-17 (bug fix)[230589, 504785, 505048, 703709, 840258] fixes to -various odd regexp "can't happen" bugs. - ---- Released 8.4.5, November 20, 2003 --- See ChangeLog for details --- - -2003-12-02 (bug fix)[851747] object sharing fix in [binary scan] - -2003-12-09 (platform support)[852369] update errno usage for recent glibc - -2003-12-12 (bug fix)[858937] fix for [file normalize ~nobody] - -2003-12-17 (bug fix)[839519] fixed two memory leaks (vasiljevic) - -2004-01-09 (bug fix)[873311] fixed infinite loop in TclFinalizeFilesystem - -2004-02-02 (bug fix)[405995] Tcl_Ungets buffer filling fix - -2004-02-04 (bug fix)[833910] tcltest command line option parsing error -=> tcltest 2.4.5 - -2004-02-04 (bug fix)[833637] code error in tcltest -preservecore operation - -2004-02-12 (feature enhancement) update HP-11 build libs setup - -2004-02-17 (bug fix)[849514,859251] corrected [file normailze] of $link/.. - -2004-02-17 (bug fix)[772288] Unix std channels forced to exist at startup. - -2004-02-17 (new default) tcltest::configure -verbose {body error} - -2004-02-19 (bug fix) init.tcl search path with unusual --libdir (samson) - -2004-02-25 (bug fix)[554068] stopped broken [exec] quoting of { (gravereaux) - -2004-02-25 (bug fix)[888777] plugged memory leak with long host names (cassoff) - -2004-03-01 (bug fix)[462580] corrected level interpretation of Tcl_CreateTrace - -2004-03-01 (platform support)[218561] Allow 64-bit configure on IRIX64-6.5* - ---- Released 8.4.6, March 1, 2004 --- See ChangeLog for details --- - -Changes to 8.5a1 include all changes to the 8.4 line through 8.4.6, -plus the following, which focuses on the high-level feature changes -in this changeset (new minor version) rather than bug fixes: - - * refactored IO code to split FS path code into generic/tclPathObj.c - and generic/tclFileSystem.h - - * refactored trace code into generic/tclTrace.c - - * configure scripts now require autoconf 2.57 for regeneration - - * updated runtime library scripts to use newer Tcl code features - (like replacing regsub with string map) - - * improve robustness of tcltest test suite across environments - - * changed the bytecode evaluation-stack addressing mode, from array-style - to pointer-style; the catch stack and evaluation stack are now - contiguous in memory - - * switch command is now byte-compiled - - * enhanced checking in 'file' command for Windows NT file permissions - - * [TIP #57] new 'lassign' command (adopted from TclX) - - * [TIP #75] switch -regexp now provides submatch info - - * [TIP #90] extended 'catch' and 'return' to enable creation of procs - that are a true replacement for 'return' - - * [TIP #100] new 'unload' command (can unload DLLs loaded via 'load', - requires the extension writer to support it) - - * [TIP #111] new 'dict' command. Several commands have been updated - to handle the list form of dicts implicitly at the C level where - only lists were previously accepted - - * [TIP #112] 'namespace ensemble' command addition allows for ensembles - that build on the namespace abstraction - - * [TIP #118] file attributes -readonly option for unices that support - chflags(), support Mac Classic attribute options on OS X, add - -rsrclength for OS X, enhance file copy on OS X to copy finder - attributes and resource forks transparently - - * [TIP #120] enable dde in safe interpreters - * [TIP #130] enable unique dde server names on Windows - * [TIP #135] change dde servername -exact option to -force -=> dde 1.3 - - * [TIP #121] new Tcl_SetExitProc C API to control application shutdown - - * [TIP #123] expr ** exponentiation operator - - * [TIP #124] 'clock clicks -milliseconds' now returns a wide integer and a - new 'clock clicks -microseconds' returns a wide integer, representing - the number of microseconds, both since the Posix epoch - - * [TIP #127] added 'lsearch -index' option - - * [TIP #136] added 'lrepeat' command - - * [TIP #137/151] Add -encoding option to 'source' command and main tclsh - executable. - *** POTENTIAL INCOMPATIBILITY *** - For Tcl embedders that build on Tcl_Main() and make use of Tcl_Main's - former ability to pass a leading "-encoding" option to interactive shell - operations, this will now be consumed by Tcl. - - * [TIP #138] New TCL_HASH_KEY_SYSTEM_HASH option for Tcl hash tables - - * [TIP #139] documented portions of Tcl's namespace C APIs - - * [TIP #148] correct [list]-quoting of the '#' character - *** POTENTIAL INCOMPATIBILITY *** - For scripts that assume a particular (buggy) string rep for lists. - - * [TIP #156] add "root locale" to msgcat -=> msgcat 1.4 - - * [TIP #157] leading {expand} syntax on words to cause argument expansion. - This is a safer/cleaner alternative to the use of 'eval'. - ---- Released 8.5a1, March 3, 2004 --- See ChangeLog for details --- - -2004-03-04 (new feature) registry package is [unload]able (thoyts) -=> registry 1.1.4 - -2004-03-08 (bug fix)[910525] [glob -path] in root directory (darley) - -2004-03-12 (new feature)[TIP 163] [dict merge] (english, fellows) - -2004-03-18 (platform support) support for Mac Classic removed (steffen) - -2004-03-28 (bug fix)[925121] corrected segfault in bc compiler (sofer) - -2004-03-30 (bug fix)[495830,729692] bytecode execution checks -each command/interp validity before executing. (sofer) - -2004-03-31 (bug fix)[811457] support translation to "" (porter) -2004-03-31 (bug fix)[811461] ignore locales with no "language" part (porter) -=> msgcat 1.4.1 - -2004-04-01 (bug fix) make [glob -type d -dir . *] work across VFS boundary - -2004-04-06 (clean up) refactored Tcl header file #include order. Might -create need for changes in extensions that #include private headers. -Changed source code files should work with older Tcl as well. See ChangeLog. - *** POTENTIAL INCOMPATIBILITY *** - -2004-04-07 (bug fix)[920667] install into any Unicode path on Win (hobbs) - -2004-04-07 (platform support) properly substitute more values in Windows -tclConfig.sh (hobbs) - -2004-04-23 (bug fix)[930851] reset channel EOF when eofchar changes (kupries) - -2004-04-28 (bug fix)[600812][TIP 184] [upvar 0 scalar array(foo)] raises error - -2004-05-03 (bug fix)[947070] stack overflow prevention on Win (kenny) - -2004-05-03 (bug fix)[868853] fix leak in [fconfigure $serial -xchar] (cassoff) - -2004-05 (bug fix)[928353,929892,928808,947440,948177] test fixes: OSX (abner) - -2004-05-05 (bug fix)[794839] socket connect error -> r/w fileevents -(gravereaux) - -2004-05-07 (bug fix)[949905] corrected utf-8 encoding of \u0000 on I/O (max) - -2004-05-13 (new feature)[TIP 129] [binary scan tnmrRqQ] (markus, fellows) - -2004-05-13 (new feature)[TIP 142] [interp limit] (fellows) - -2004-05-14 (bug fix)[940278,922848] [clock] notices $::env(TZ) changes, -gmt works on all platforms. (kenny, welton, glessner) - -2004-05-16 (feature rewrite) bytecode execution of {expand} changed - *** POTENTIAL INCOMPATIBILITY with prior 8.5a releases *** - -2004-05-18 (platform support) makefile.vc now generates tclConfig.sh (thoyts) - -2004-05-18 (bug fix)[500285,500389,852944] [clock %G %V] ISO8601 week numbers -(kenny) - -2004-05-22 (bug fix)[735335,736729] variable name resolution error (sofer) - -2004-05-24 (bug fix) support for non-WIDE_INT aware math functions (hobbs) - -2004-05-25 (new feature) [http::config -urlencoding] (hobbs) -=> http 2.5.0 - -2004-05-26 (bug fix)[960926] file count doubled when -singleproc 1 (porter) -=> tcltest 2.2.6 - -2004-05-26 (bug fix)[874058] improved build configuration on 64-bit systems. -Corrects Tcl_StatBuf definition issues. (hobbs) - -2004-05-30 (platform support) Win: allow signed short exit codes (gravereaux) - -2004-06-05 (bug fix)[976722] hi-res clock fixes: Win -(godfrey, suchenwirth, kenny) -2004-06-10 (bug fix)[932314] bad return values from Tcl_FSChdir() (vasiljevic) - -2004-06-18 (platform support) regonize more unix locales (huang) - -2004-06-18 (bug fix) prevent stack overflow from long free() chains (fellows) - -2004-06-21 (platform support) exceptions w/ gcc -O3 on Win (dejong) - -2004-06-23 (feature rewrite)[976496] thread local storage done with hash -tables to avoid system limits (mistachkin) - -2004-06-29 (bug fix)[981733] SafeBase global pollution (fellows) - -2004-06-30 (new feature)[TIP 188] [string is wideinteger] (kenny) - -2004-07-02 (new feature)[TIP 202] pipe redirection 2>@1 (hobbs) - -2004-07-03 (bug fix)[908375] round() wide integer support (lavana, sofer) - -2004-07-07 (bug fix)[458361] shimmer of single-word scripts suppressed (sofer) - -2004-07-15 (bug fix)[770053] crash in thread finalize of notifier (vasiljevic) - -2004-07-15 (bug fix)[990453] plug mutex leaks on reinit -(mistachkin, vasiljevic) - -2004-07-16 (bug fix)[990500] clean exit of notifier thread -(mistachkin, kupries) - -2004-07-19 (bug fix)[987967] improved self-init of mutexes on Win (vasiljevic) - -2004-07-20 (bug fix) pure Darwin/CFLite support (steffen) - -2004-07-20 (bug fix)[736426] plug leaky allocator reinit (mistachkin, kenny) - -2004-07-30 (bug fix)[999084] no deadlock in re-entrant Tcl_Finalize (porter) - -2004-08-02 (new feature)[TIP 207] [interp invokehidden -namespace] (porter) - -2004-08-10 (bug fix) thread IDs on 64-bit systems (ratcliff,vasiljevic) - -2004-08-13 (bug fix) avoid malicious code acceptance by [mclocale] (porter) -=> msgcat 1.3.3 - -2004-08-16 (bug fix)[1008314] Tcl_SetVar TCL_LIST_ELEMENT (sofer,porter) - -2004-08-18 (new feature)[TIP 173,209] complete [clock] rewrite (kenny) - *** POTENTIAL INCOMPATIBILITY *** - -2004-08-18 (new feature)[TIP 189] package loading for Tcl Modules (kupries) - -2004-08-19 (bug fix)[1011860] [scan %ld] fix on LP64 (fellows,porter) - -2004-08-23 (bug fix)[695441] extend [tcl_findLibrary] search path to include - $::auto_path and [pkgconfig get scriptdir,runtime] (porter) - -2004-08-27 (platform support) TCL_MODULE_PATH values for Mac OSX (steffen) - -2004-08-27 (bug fix)[1017022] recognize imported ensembles (fellows) - -2004-08-30 (bug fix) [string map $x $x] crash (fellows) - -2004-09-01 (bug fix)[1020445] WIN64 support (hobbs) - -2004-09-03 (bug fix)[1020538] crash in [file copy] (violi,fellows) - -2004-09-07 (bug fix)[1016167] [after] overwrites its imports (kenny) - -2004-09-08 (bug fix) fixed [clock format 0 -format %k] (kenny) - -2004-09-09 (bug fix)[560297] fixed broken [namespace forget] logic (porter) - -2004-09-09 (bug fix)[1017299] fixed [namespace import] cycle prevention -(porter) - -2004-09-10 (performance) $x[set x {}] is now fast [K $x [set x {}]] (sofer) - -2004-09-10 (bug fix)[868489] better control over int <-> wideInt -(fellows,kenny) - -2004-09-10 (bug fix)[1025359] POSIX errorCode from wide seeks (kupries,fellows) - -2004-09-10 (bug fix)[707104,1026493] fix [rename] of [interp alias] (porter) - -2004-09-18 (bug fix)[868467] fix [expr 5>>32] => 0, not 5 (hintermayer,fellows) - -2004-09-21 (bug fix) consistent errorinfo from [namespace eval x error foo bar] - and [namespace eval c {error foo bar}] (porter) - -2004-09-22 (feature change) syntax errors not reported at compile time; - deferred to runtime. Support [return -errorline]. (porter) - -2004-09-23 (bug fix)[1016726] fix `make clean` in static config -(leitgeb,dejong) - -2004-09-22 (feature change) report all compile errors at runtime (porter) - -2004-09-29 (bug fix)[1036649] syntax error in [subst] => buffer overflow -(sofer) - -2004-09-30 (bug fix)[1038021] save/restore error state: var traces (porter) - -2004-10-01 (performance) stackframe level values in internal reps (fellows) - -2004-10-01 (feature change)[1037235] auto-create [dict] key paths (fellows) - -2004-10-04 (bug fix)[884830] eq and ne parse in expr (fellows) - -2004-10-05 (reform) errorInfo, errorCode management (porter) - *** POTENTIAL INCOMPATIBILITY for traces on those vars *** - -2004-10-06 (feature change)[1041072] re-bless and enhance Tcl_AppendResult -(dkf) - -2004-10-06 (reform) more robust interp result appends (porter) -=> dde 1.3.1 -=> registry 1.1.5 - -2004-10-06 (reform) re-write of [glob] guts (fellows) - -2004-10-07 (reform)[925620] improved platform split of VFS code (darley) - -2004-10-08 (new feature)[TIP 201] "in" and "ni" expr operators (fellows) - -2004-10-08 (new feature)[TIP 212] [dict update]; [dict with] (fellows) - -2004-10-08 (bug fix)[954263] case insensitive [file exec] for Win -(hobbs,darley) - -2004-10-14 (performance) [info commands/globals/procs/vars $pattern] faster - when $pattern is trivial (fellows) - -2004-10-14 (new feature)[TIP 217] [lsort -indices] (salsman,fellows) - -2004-10-24 (reform) replaced bit flag values with macros for Var handling - *** POTENTIAL INCOMPATIBILITY for accesses to Var internals *** - -2004-10-26 (new feature)[1054370] install msgcat, http, tcltest as TM's -(porter) - -2004-10-26 (bug fix)[767676] negative PIDs with pipes (giese,gravereaux) - -2004-10-27 (bug fix)[731778] stop critical section leaks -(mistachkin,gravereaux) - -2004-10-27 (bug fix)[926088] -load option to find tested packages (gravereaux) - -2004-10-28 (bug fix)[1030548] restore the --enable-symbols --enable-threads -build on Win (mistachkin,kenny,kupries) - -2004-10-29 (bug fix)[1055673] fix command line syntax error message (porter) -=> tcltest 2.2.7 - -2004-10-30 (bug fix)[926106] fix [file mtime] DST anomaly (kenny) - -2004-10-31 (bug fix)[1057461] fix [info globals ::varName] (fellows) - -2004-11-02 (bug fix)[761471] fix [expr {NaN == NaN}] (sofer) - -2004-11-02 (bug fix)[1017151] misleading errorInfo after tests (seeger,porter) - -2004-11-03 (bug fix)[527164] preserve errorinfo from var traces (porter) - -2004-11-08 (bug fix){947693] Made -blocking option of channel during [close] -consistent on Windows with Unix (gravereaux) - *** POTENTIAL INCOMPATIBILITY *** - -2004-11-11 (bug fix)[1034337] recursive file delete, MacOSX (steffen) - -2004-11-12 (new feature)[TIP 221] [interp bgerror] (porter) - -2004-11-12 (new feature)[TIP 226] Tcl_(Save|Restore|Discard)InterpState -(porter) - -2004-11-12 (new feature)[TIP 227] Tcl_(Get|Set)ReturnOptions (porter) - -2004-11-12 (bug fix)[1004065] stop crash when TCL_UTF_MAX==6 (hobbs,porter) - -2004-11-15 (bug fix)[10653678] [trace variable],[trace remove] interop (porter) - -2004-11-16 (bug fix)[1067709] crash in [fconfigure -ttycontrol] (hobbs) - -2004-11-18 (new feature) configure options --enable-man-suffix (max) - -2004-11-22 (bug fix)[1030465] Improve HAVE_TYPE_OFF64_T check (dejong) - -2004-11-22 (bug fix)[1043129] Fixed the treatment of backslashes in file -join on Windows (darley) - -2004-11-22 (bug fix)[976438] Move init.tcl search path construction to -tclInit (porter) - -2004-11-24 (bug fix)[1072654] Fixed segfault in info vars trivial -matching branch (new in 8.4.8) (porter) - -2004-11-24 (bug fix)[1001325, 1071701] Fixed readdir_r detection and usage -(dejong, kenny, porter) - -2004-11-24 (bug fix)[1071807] Fixed all uses of 'select' to use standard -macros rather than older bit-whacking style (kenny) - -2004-11-26 (bug fix)[1073524] Simplify the code to check for correctness of -strstr, strtoul and strtod on unix (fellows) - -2004-11-26 (bug fix)[1072136] Remove file normalize on tcl_findLibrary -search path uniqification added in 8.4.8 (porter) - -2004-11-30 (bug fix)[976520] Rework startup/initialization of the Tcl -library, encoding search initialization, and Tcl_FindExecutable structure. -[tclInit] no longer driven by the value of $::tcl_libPath (TCLLIBPATH). -(porter) - *** POTENTIAL INCOMPATIBILITY : makes encoding names case sensitive - on Windows, where they have been case insensitive *** - -2004-12-02 (bug fix)[1074671] Ensure tilde paths are not returned specially -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) -***POTENTIAL INCOMPATIBILITY*** -May cause re-[source]-ing of files that have not anticipated that before. - -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, 2005 --- See ChangeLog for details --- - -2005-06-06 (bug fix)[1213678] Windows/gcc: crash in stack.test (kenny) - -2005-06-07 (new feature)[TIP 208] [chan] and [chan truncate] (fellows) - -2005-06-07 (revert) Restored registration of "procbody" Tcl_ObjType (porter) -Reduces the ***POTENTIAL INCOMPATIBILITY*** from 2005-05-17. - -2005-06-13 (bug fix)[1217375,1219176] [file mkdir] race (diekhans,darley) - -2005-06-14 (bug fix)[1220058] [namespace delete] crash (duquette,fellows) - -2005-06-17 (bug fix)[1221395] Tcl_LimitSetTime able to break [vwait] (fellows) - -2005-06-18 (bug fix)[1154163] [format %h] on 64-bit OS's (kraft,fellows) - -2005-06-21 (bug fix)[1201035,1224585] execution trace crashes (porter) - -2005-06-21 (bug fix)[1194458] Windows: [file split] (kenny,porter) - -2005-06-22 (bug fix)[1225727] Windows: pipe finalization crash (kenny) - -2005-06-22 (bug fix)[1225571] Windows: [file pathtype] buffer overflow (thoyts) - -2005-06-22 (bug fix)[1225044] Windows: UMR in pipe close (kenny) - -2005-06-23 (bug fix)[1225957] Windows/gcc: crashes in assembler code (kenny) - -2005-06-24 (bug fix) make Tcl_Preserve safe in Tk exit handlers (kenny) - -2005-07-01 (bug fix)[1222872] notifier spurious wake-up protection (vasiljevic) - -2005-07-05 (bug fix)[1230597] allow idempotent [namespace import] (porter) - -2005-07-15 (bug fix)[1237907] localtime() => NULL => crash (kenny) - -2005-07-21 (dropped support) IRIX 4, RISCos, Ultrix, and ancient BSD (kenny) -***POTENTIAL INCOMPATIBILITY*** - -2005-07-22 (enhancement)[1237755] 8.4 features in script library (fradin,porter) - -2005-07-24 (new feature) configure macros SC_PROG_TCLSH, SC_BUILD_TCLSH (dejong) -2005-07-26 (bug fix)[1047286] cmd delete traces during namespace delete (porter) - -2005-07-26 (new unix feature)[1231015] ${prefix}/share on ::tcl_pkgPath (dejong) -***POTENTIAL INCOMPATIBILITY*** - -2005-07-27 (bug fix)[1214462] [unknown] can return exceptions (porter) - -2005-07-27 (new feature) value of ::tcl_precision now kept per-thread (porter) -***POTENTIAL INCOMPATIBILITY*** - -2005-07-28 (unix bug fix)[1245953] O_APPEND for >> redirection (fellows) - -2005-07-29 (bug fix)[1247135] [info globals] return only existing vars (fellows) - -2005-07-30 (new Darwin feature) TCL_LOAD_FROM_MEMORY configuration (steffen) - -2005-08-05 (bug fix)[1241572] correct [expr abs($LONG_MIN)] (kenny) - -2005-08-05 (Solaris bug fix)[1252475] recognize cp1251 encoding (wagner,fellows) - -2005-08-11 (config options) eliminated USE_THREAD_STORAGE option (kenny) - -2005-08-23 (toolchain support) autoconf-2.59 now required (dejong) - -2005-08-24 (new feature)[TIP 219] reflected channels ([chan create]) (kupries) - -2005-08-25 (bug fix)[1267380] [lrepeat] buffer overflow prevention (fellows) - -2005-08-26 (bug fix) fix [namespace ensemble] crashes in Snit (fellows) - -2005-08-29 (bug fix)[1275043] restore round() away from zero (kenny) - -2005-08-29 (bug fix)[1189657] correct [tcl::tm::roots] (porter) - -2005-09-07 (bug fix)[1283976] invalid [format %c -1] result (porter) - -2005-09-08 (new feature)[1242844][TIP 254] new types for Tcl_LinkVar (fellows) - -2005-09-07 (toolchain support) deprecate TCL_VARARGS*; stdarg.h assumed (porter) -***POTENTIAL INCOMPATIBILITY*** - -2005-09-15 (RHEL bug fix)[1287638] support open >2GB files RHEL 3 (palan) - -2005-09-08 (new feature)[TIP 255] [expr min()] and [expr max()] (hobbs) - -2005-09-30 (bug fix)[1306162] $argv encoding and list formatting (porter) - -2005-10-04 (bug fix)[1067708] [fconfigure -ttycontrol] leak (hobbs) - -2005-10-04 (bug fix)[1182373] [http::mapReply] update to RFC 3986 (aho,hobbs) -=> http 2.5.2 - -2005-10-04 (HPUX bug fix)[1204237] shl_load() and DYNAMIC_PATH (collins,hobbs) - -2005-10-05 (bug fix)[979640] buffer overrun mixing putenv(), ::env (bold,hobbs) - -2005-10-08 (new feature)[TIP 237] unlimited range for integers (kenny,porter) -***POTENTIAL INCOMPATIBILITY*** for any code that relies on implicit truncation -of integer calculations to the range of a C long - -2005-10-14 (platform support)[1256937] MSVC++ static builds (thoyts) - -2005-10-19 (bug fix)[1331475] [dict append] crash (bills,sofer) - -2005-10-20 (bug fix)[1333036] [lset] shared sublist handling (sofer) - -2005-10-23 (bug fix)[1335006] memleack in [glob] (melbardis,darley) - -2005-10-23 (bug fix)[1325803] Win: [file stat] on links (bonilla,darley) - -2005-11-01 (bug fix)[1337941] Tcl_TraceCommand() -> crash (devilliers,porter) - -2005-11-02 (platform support)[1256937] MSVC 8 support (thoyts) - -2005-11-03 (new Win NT/XP feature) Unicode console support (kovalenko,thoyts) - -2005-11-04 (bug fix)[1337229,1338280] [namespace delete] / unset traces (sofer) - -2005-11-04 (enhancement) Korean timezone abbreviations (kenny) - -2005-11-04 (platform support)[1163896] LynxOS [load] (heidibr) - -2005-11-04 (bug fix)[1334947] value refcount error in var setting (sofer) - -2005-11-04 (Win enhancement)[1267871] extended exit codes (newman,thoyts) - -2005-11-07 (bug fix)[1348775] unset trace memory leak (sofer) - -2005-11-08 (bug fix)[1162286] [package require] checks that the script -registered by [package ifneeded] provides the version it claims (lavana,porter) -*** POTENTIAL INCOMPATIBILITY *** - -2005-11-09 (bug fix)[1350293,1350291] [after $negative $script] fixed (kenny) - -2005-11-12 (bug fix)[1352734,1354540,1355942,1355342] [namespace delete] -issues with [namespace path] and command delete traces (sofer,fellows) - -2005-11-18 (bug fix)[1358369] URL parsing standards compliance (wu,fellows) -=> http 2.5.2 - -2005-11-18 (revert) Restored registration of "list" Tcl_ObjType (porter) -Reduces the ***POTENTIAL INCOMPATIBILITY*** from 2005-05-17. - -2005-11-18 (bug fix)[1359094] Tclkit crash (thoyts, kupries) - -2005-11-20 (bug fix)[1091431] Tcl_InitStubs failure crashes wish (english) - -2005-11-27 (platform support) Darwin 64bit, Tiger copyfile(), and -Max OSX universal binaries support (steffen) - -2005-11-28 (bug fix) [clock] DST transition error (mackerras,kenny) - -2005-11-29 (bug fix)[1366683] [lsearch -regexp] backrefs (cleverly,fellows) - -2005-11-30 (performance) recoded portions of [clock] in C (kenny) - -2005-11-30 (enhancement) improved bytecode compiling of [switch] (fellows) -*** POTENTIAL INCOMPATIBILITY *** -For loading bytecode compiled and saved by earlier 8.5alpha releases - -2005-12-05 (Darwin bug fix)[1034337] NFS recursive file delete (steffen) - -2005-12-08 (platform support) Win x64 build (hobbs) - -2005-12-09 (bug fix)[1374778] [lsearch -start $pastEnd] => -1 (fellows) - -2005-12-12 (bug fix)[1377619] configure syntax error exposed in bash-3.1 (hobbs) - -2005-12-13 (bug fix)[1379349] [dict for] CoW error (ring,hippler,fellows) - -2005-12-18 (bug fix)[1382528] [dict for {k v} {} {}] crash (kovalenko,fellows) - -2005-12-27 clock tzdata updated to Olson's tzdata2005r (kenny) - -2005-12-27 libtommath updated to release 0.37 (kenny) - -2006-01-09 (bug fix)[1480572] [info level $l] => "namespace inscope" (porter) - -2006-01-11 (compat support)[1397843] when ::errorInfo is traced, fall back to -old pattern of stack trace construction (porter). -Reduces the ***POTENTIAL INCOMPATIBILITY*** from 2004-10-05. - -2006-01-12 (bug fix)[1366227] Win: [file stat] sharing violation (darley) - -2006-01-23 (bug fix)[1410553] Tcl_GetRange Unicode confusion (twylite,spjuth) - -2006-01-23 (bug fix)[1412695] args handling in precompiled procs (traum,sofer) - -2006-02-01 (new feature)[1275435][TIP 250] [namespace upvar] (sofer) - -2006-02-01 (new feature)[958222][TIP 181] [namespace unknown] (madden) - -2006-02-01 (new feature)[944803][TIP 194] [apply] (mistachkin) - -2006-02-08 (new feature)[1413934][TIP 258] [encoding dirs], etc. (porter) - -2006-02-09 (new feature)[1413115][TIP 215] auto-init [incr] (leitgeb) - -2006-03-02 (bug fix)[1379287] norm of paths with /../ back to root (porter) - -2006-03-03 (compat support) Restored registration of a "boolean" Tcl_ObjType -(porter) -Reduces the ***POTENTIAL INCOMPATIBILITY*** from 2005-05-17. - -2006-03-06 (bug fix)[1439836,1444291] fix TCL_EVAL_{GLOBAL,INVOKE} handling -when auto-loading or exec traces are present (porter) - -2006-03-10 (bug fix)[1437595] Win socket finalize with threads (vasiljevic) - -2006-03-13 (revert 2005-07-26 change) ${prefix}/share on ::tcl_pkgPath (porter) - -2006-03-14 (bug fix)[1448251] TCLX.y_TM_PATH handling (noble, kupries) - -2006-03-14 (bug fix)[768659] pipeline error when last command missing (kupries) - -2006-03-18 (bug fix)[1193497] Win porting of [file writable] (darley,vogel) - -2006-03-18 (bug fix)[1084705] [glob -nocomplain] silence empty result only, -no other errors (darley) -***POTENTIAL INCOMPATIBILITY*** - -2006-03-21 (platform enhancement)[823329] HFS globbing support (steffen) - -2006-03-23 (platform support) updated tcl.spec file (max) - -2006-03-28 (bug fix)[1064247] BSD: path normalization with realpath() (steffen) - -2006-04-03 (bug fix)[1462248] crash reading utf-8 chars spanning multiple -buffers at end of file (kraft,kupries) - -2006-04-05 (bug fix)[1464039] Tcl_GetIndexFromObj: empty key (fellows) - -2006-04-05 (bug fix) overdue dde, registry patchelevel increments (porter) -=> dde 1.3.2 -=> registry 1.2 - -2006-04-06 (bug fix)[1457515] TCL_IO_TRACK_OS_FOR_DRIVER_WITH_BAD_BLOCKING -removed (steffen) - -2006-04-11 (bug fix)[1458266] enter/enterstep trace interference (leunissen) - -2006-04-12 (feature change)[1376892] revised definition of [:print:] (fellows) - -(platform support) Use of _ANSI_ARGS_ purged. ANSI compiler required (fellows) - -Documentation improvements [1211078,1190891,1292427,1277503,1104682,1359183, -1415725,666770] - ---- Released 8.5a4, April 27, 2006 --- See ChangeLog for details --- - -2006-05-04 (bug fix)[1480509] srand() accept wide input (porter,afredd) - -2006-05-05 (bug fix)[1481986] interactive Tcl_Main blocks main loop (porter,lin) - -2006-05-13 (bug fix)[1482718] proc re-compile: preserve the previous -bytecode while references still on the stack (porter,ryazanov) - -2006-05-27 (bug fix)[923072] Darwin: made unthreaded CoreFoundation notifier -naked-fork safe on Tiger (steffen) - -2006-06-20 (internal change) Dropped the internal routines used to hook into -filesystem operations back in the pre-Tcl_Filesystem days. (porter) -***POTENTIAL INCOMPATIBILITY*** -For extensions and programs that have never migrated to the supported Tcl 8.4 -interface for virtual filesystems - -2006-07-05 (enhancement) Expression parser rewrite avoids stack overflow, -reduces from O(N^2) to O(N) complexity, and greatly improves syntas error -messages (porter) -***POTENTIAL INCOMPATIBILITY*** -For any code relying on exact error messages. - -2006-07-20 (platform support) Mac OS X weak linking (steffen) - -2006-07-20 (bug fix) Darwin: execve() works iff event loop not yet run (steffen) - -2006-07-24 (bug fix)[1518166] Uninitialized Tcl_DString (afredd) - -2006-07-30 (bug fix)[1426279,1505383,1494664,1531530] [clock] fixes (kenny) - -2006-08-09 (bug fix)[1531184] [dict for {file stat} x {}] crash (fellows) - -2006-08-10 (bug fix)[1538262,1530474] code cleanup; optimizations (afredd) - -2006-08-18 (bug fix) intermittent failures in TclUnixWaitForFile() (steffen) - -2006-08-18 (platform support) Darwin x86_64 (steffen) - -2006-08-21 (bug fix)[1457797] Darwin 64-bit notifier hang (steffen) - -2006-08-21 (bug fix) Darwin: recursively called event loop (steffen) - -2006-08-21 (enhancement) Darwin: nanosec resolution clicks and [time] (steffen) - -2006-08-28 (bug fix)[1547681] TclFormatObj count arguments (mistachkin,porter) - -2006-08-28 (bug fix) stack.test failure on FreeBSD (mistachkin) - -2006-08-30 (bug fix)[1548263] filesystem segfaults (hobbs,mccormack) - -2006-08-31 (bug fix)[1541274] [expr {sqrt(-1)}] => -NaN (suchenwirth,porter) - -2006-09-06 (bug fix)[999544] use of MT-safe system calls (vasiljevic) - -2006-09-10 (platform support) Darwin: msgcat use CFLocale (steffen) -=> msgcat 1.4.2 - -2006-09-10 (new feature) tcltest option: -verbose line (steffen) -=> tcltest 2.3a1 - -2006-09-19 (bug fix)[1555271,1561260] Several ** operator bugs (porter) - -2006-09-22 (bug fix)[1562528] NULL terminates variadic calls (fellows,ryazanov) - -2006-09-22 (new feature)[1520767][TIP 268] [package] alpha/beta version; -[package require] ranges, [package prefer] selection mode (kupries) - -2006-09-26 (platform support) MSVC8 AMD64 support (thoyts) - -2006-09-27 (bug fix)[1567222] bignum << errors (porter) - -2006-09-30 (enhancement)[1190441] quiet no-op [history] (sofer) - -2006-10-04 clock tzdata updated to Olson's tzdata2006m (kenny) - -2006-10-05 (bug fix)[1570718] make [lappend $nonList] complain (sofer,virden) - -2006-10-05 (bug fix)[1122671] alignment fixes in unicode encoding routines -(hobbs,staplin) - -2006-10-05 (enhancement) Allow "_" in Tcl Module filenames (kupries) - -2006-10-05 (new feature) [set ::http::strict 0] (default value is 1) to disable -URL validity checking against RFC 2986 (hobbs) -=> http 2.5.3 - -2006-10-06 (new feature)[1565751][TIP 275] [binary scan] unsigned (thoyts) - -2006-10-10 (bug fix)[1566526] crash cleaning up [namespace path] data (porter) - -2006-10-12 (bug fix)[1576006] better error messages from [interp alias] (sofer) - -2006-10-13 (platform support) get stack size on Darwin (steffen) - ---- Released 8.5a5, October 20, 2006 --- See ChangeLog for details --- - -2006-10-20 (configure change) Added autodetection for OS-supplied timezone -files (max) - -2006-10-23 (enhancement)[1577278] Ensure the Tcl call stack always has a -CallFrame, even at level 0 (sofer) - *** POTENTIAL INCOMPATIBILITY for users of tclInt.h *** - -2006-10-23 (enhancement)[1577492] Tcl_PushCallFrame and [info level] -enhanced for ensemble rewrites (sofer) - *** POTENTIAL INCOMPATIBILITY for [info level 0] on interp alias *** - -2006-11-02 (feature change)[TIP 293] Replace {expand} with {*} (hobbs) - *** POTENTIAL INCOMPATIBILITY with previous 8.5 alphas only *** - -2006-11-04 (new feature)[TIP 274] Exponentiation operator is right -associative (porter) - -2006-11-09 (new feature)[TIP 272] Added [lreverse] and [string reverse] -commands (fellows) - -2006-11-14 (new feature)[TIP 261] [namespace import] returns list of -imported commands (porter) - -2006-11-15 (new feature)[TIP 270] New C routines Tcl_ObjPrintf, -Tcl_AppendObjToErrorInfo, Tcl_Format, Tcl_AppendLimitedToObj, -Tcl_AppendFormatToObj, Tcl_AppendPrintfToObj (porter) - -2006-11-22 (feature change) Moved TCL_REG_BOSONLY from tcl.h to tclInt (porter) - -2006-11-22 (new feature)[TIP 269] Added [string is list] classification -command (mistackin, fellows) - -2006-11-25 (new feature)[TIP 174] Added commands corresponding to most -expr operators in ::tcl::mathop (fellows) - -2006-11-26 (platform support)[1230558] --enable-64bit on more systems (steffen) - -2006-11-27 (bug fix)[1602208] Fix 64-bit handling of select() on unix where -fd was greater than 32 (fontaine, kenny) - -2006-11-28 (new feature)[TIP 280] Added [info frame] command for more -Tcl-level debugging information (kupries) - -2006-12-01 (feature change)[TIP 298] Change Tcl_GetBignumAndClearObj to -Tcl_TakeBignumFromObj (porter) - -2006-12-01 (new feature)[TIP 287] Added [chan pending] subcommand (cleverly) - -2006-12-01 (new feature)[TIP 299] Added isqrt() expr operator (kenny) - -2006-12-04 (new feature)[TIP 267] Added -ignorestderr option to exec (fellows) - -2006-12-05 (new feature)[TIP 291] ::tcl_platform(pointerSize) key (kupries) - -2007-01-11 (configure change) Remove "-Wconversion" from deflt CFLAGS (english) - -2007-01-25 (configure change) Ensure CPPFLAGS env var is used when set (steffen) - -2007-02-19 (configure change) Use SHLIB_SUFFIX=".so" on HP-UX IA64 (was -".sl") (hobbs) - -2007-02-20 (bug fix)[1479814] Handle Windows NT \\?\... extended paths (thoyts) - -2007-03-01 (bug fix)[1671138] Fix infinite loop in compiled foreach with an -empty list (fellows) - -2007-03-07 (enhancement) Improved Windows time zone tables to handle new US -DST rules (kenny) - -2007-03-09 (enhancement) Improved Y2038 compliance of zoneinfo files (kenny) - -2007-04-02 (enhancement) Added bytecode compilation for global, variable, -upvar and namespace upvar (sofer) - -2007-04-20 (bug fix) Improve clock localization for Japanese locale (kenny) - -2007-04-20 (enhancement) Document Tcl_SetNotifier & Tcl_ServiceModeHook (kenny) - -2007-04-23 (bug fix) fts_open() crash on 64bit Darwin 8 or earlier (steffen) - ---- Released 8.5a6, April 25, 2007 --- See ChangeLog for details --- - -2007-04-30 (bug fix)[1705778] many valgrind-detected leaks corrected - -2007-05-01 (bug fix)[1710709] leak in [string map] (porter) - -2007-05-02 (bug fix)[1710707] leaks in filesystem paths (mistachkin,kenny) - -2007-05-18 (feature change) {expand} syntax support removed. (porter) - *** POTENTIAL INCOMPATIBILITY with previous 8.5 alphas only *** - -2007-05-29 (bug fix)[1712723] Joinable thread death on 64-bit (virden,hobbs) - -2007-05-30 (feature change)[1725186] When expanded literals are parsed, -(example: {*}{1 2 3}), TCL_TOKEN_EXPAND_WORD token is no longer returned. -Tokens reflecting the expansion are returned instead. (porter) - *** POTENTIAL INCOMPATIBILITY with previous 8.5 alphas only *** - -2007-06-06 (platform support) Darwin: add plist to tclsh (steffen) - -2007-06-12 (enhancement) [info] is now a [namespace ensemble] (fellows) - -2007-06-20 (enhancement) better `make html` results (hobbs) - -2007-06-21 (feature change)[1740962] leave traces created during execution -of traced command do not fire (sofer) - *** POTENTIAL INCOMPATIBILITY *** - -2007-06-23 (bug fix) Darwin: prevent post-fork() abort() (steffen) - -2007-06-27 (bug fix)[1743941] Infinite loop in Tcl_CreateTrace traces (porter) - -2007-06-29 (enhancement) Tcl_Alloc alignment on Darwin (steffen) - -2007-06-30 (bug fix)[1726873] crash in thread sync objects (vasiljevic,twylite) - -2007-06-30 (bug fix)[1717186] [lsort -command \{ $l] leak (afredd,fellows) - -2007-07-05 (bug fix)[1743676] no command named "" error message (porter,virden) - -2007-07-11 (bug fix)[1752146] [while 1 {}] & [interp limit] on commands (sofer) - -2007-07-31 (bug fix)[681877] tcl_platform(user) from system, not env (fellows) - -2007-07-31 (enhancement)[1750051] space efficiency of Tcl variables (sofer) - *** POTENTIAL INCOMPATIBILITY for C code that accesses internal - Tcl structs Var, Bytecode, Namespace, or CallFrame. *** - -2007-08-01 (enhancement)[1764318] word.tcl proc rewrites (petasis,fellows) - -2007-08-08 (bug fix)[1770224] [tcl::mathop::>> $big1 $big2] errors (porter) - -2007-08-14 (platform support) Darwin [load] from VFS on intel & 64bit (steffen) - -2007-08-15 (bug fix)[1773127] corrected open mode "a+" (rottman,fellows) - -2007-08-16 (bug fix)[1773040] ::errorInfo trace crash (janssen,porter) - -2007-08-16 (performance)[1564517] pre-compile constant expressions (porter) - -2007-08-21 (bug fix)[1775878] 'puts \' in interactive tclsh failed to move to -prompt for continuation line (porter) - -2007-08-25 (bug fix)[1781282] [clock scan] case senstivity (kenny) - -2007-08-25 (performance)[1767293] ** on native integer types (kenny) - -2007-09-03 clock tzdata updated to Olson's tzdata2007g (kenny) - -2007-09-06 (platform support) Darwin: drop support for Xcode 1.5 project, add -project for Xcode 3.0 (steffen) - -2007-09-08 (bug fix)[1786481] nested [dict update] crash (fellows) - -2007-09-08 (bug fix)[1710710] TclPtrSetVar leak (mistachkin,sofer) - -2005-09-09 (feature removed) Tcl_ObjType "nsName" no longer registered (porter) - *** POTENTIAL INCOMPATIBILITY for Tcl_GetObjType("nsName") *** - -2007-09-10 (bug fix)[1740631] Linked variable unlink prevention (maros,hobbs) - -2007-09-11 (bug fix)[1786481] [dict update] stack management (sofer) - *** POTENTIAL INCOMPATIBILITY with previous 8.5 alpha bytecode only *** - -2007-09-11 (bug fix)[1578344] [package require -exact] 8.4 compat (porter) - *** POTENTIAL INCOMPATIBILITY with previous 8.5 alphas only *** - -2007-09-11 (bug fix)[1772989,1071322] Support _, : in test constraints (porter) -=> tcltest 2.3b1 - -2007-09-11 (platform support) Windows AMD64 support (thoyts) - -2007-09-14 (enhancement)[1793984] DTrace provider for Tcl (steffen) - -2007-09-14 (bug fix)[1519940] surplus ns path invalidation (fellows,bauer) - -2007-09-15 (platform support) SunOS-5.1x link with cc, not ld (steffen) - -2007-09-17 (platform support)[1748251] Fix NetBSD link failures (english) - -(bug fix)[1066755] Several stack efficiency efforts increases recursion limit -on Windows to be larger than the default [interp recursionlimit] value - ---- Released 8.5b1, September 26, 2007 --- See ChangeLog for details --- - -2007-10-02 (bug fix)[1806422] proper [tcl::tm::path] autoload (porter) - -2007-10-02 (bug fix) Improve Tcl_DecrRefCount() robustness (staplin) - -2007-10-11 (bug fix)[1805887] [string is int -failindex] for 0o, 0b (porter) - -2007-10-15 (bug fix)[1813528] Tcl_ParseBraces read past buffer (mistachkin) - -2007-10-25 (bug fix)[1726873] intermittent crash in threads (vasiljevic) - ---- Released 8.5b2, October 26, 2007 --- See ChangeLog for details --- - -2007-10-27 (bug fix)[1821159] fixed broken compile on x86_64 (sofer) - -2007-10-27 (bug fix)[1810264] stop panic in RE lexer (fellows) - -2007-10-28 (enhancement)[1826906] Embed iso8859-1 encoding in libtcl (fellows) - -2007-11-01 (bug fix)[1808258] [string is ascii \000] (fellows) - -2007-11-05 (bug fix)[1823576] [fconfigure $serial -xchar \000] (cassof) - -2007-11-07 (performance)[1827996] binary glob matching (hobbs) - -2007-11-07 (performance) binary [gets] (hobbs) - -2007-11-09 (performance)[1829248] interp state reset (sofer) - -2007-11-10 (performance) stack checking (sofer) - -2007-11-10 (performance) list indexing bytecode (sofer) - -2007-11-11 (performance)[1830038] macros to fetch Tcl_Obj intreps (sofer) - -2007-11-11 (performance)[1830166] RE bytecode for simple cases (hobbs) - -2007-11-13 (performance) [switch] & [regexp] use RE bytecode (hobbs, fellows) - -2007-11-14 (performance) bytecode for [info exists] (fellows) - -2007-11-15 (new feature)[1231022] configure option: --disable-rpath (fellows) - -2007-11-15 (bug fix)[1810038] infinite loop in RE compiler (lane,porter) - -Many significant documentation improvements (fellows, sofer) - ---- Released 8.5b3, November 19, 2007 --- See ChangeLog for details --- - -2007-11-20 (enhancement) string rep of dict has stable order (fellows) - -2007-11-21 (enhancement) compiled ensemble support (fellows) - -2007-11-22 (enhancement) [dict] is now an ensemble (fellows) - -2007-11-23 (enhancement) [string] is now an ensemble (fellows) - -2007-11-26 (bug fix)[1815573] Correct stack checking failure (sofer,golovan) - -2007-11-27 (bug fix)[800753] Document single byte char limit for -[chan configure -eofchar] (cassoff) - -2007-12-03 (enhancement)[1836519] [switch $val $body] safe/fast (fellows,spjuth) - -2007-12-03 (release) tcltest package bump to 2.3.0 (porter) - -2007-12-03 (bug fix)[1618235] fix BSD compile errors (fellows) - -2007-12-05 (bug fix)[1844789] fix [lsearch -exact -integer] crash (fellows) - -2007-12-05 (performance)[1845092] Tcl_ObjType for channel names (hobbs) - -2007-12-14 (bug fix)[1602539] NUL pollution in [glob] result (hobbs) - -2007-12-17 (bug fix)[1851832,1851524] memory alignment correction (sofer) - -2007-12-18 (bug fix)[1810264] revised regexp engine to prevent debilitating -over-consumption of resources (drewry,lane,ormandy,fellows) - -Several documentation and release notes improvements - ---- Released 8.5.0, December 20, 2007 --- See ChangeLog for details --- - -2007-12-23 (bug fix)[1857126] restore backref support to regexps (hobbs) - -2007-12-26 (enhancement)[1856994] [lsort] performance (sofer) - -2008-01-10 (bug fix)[1867855] fix [format %lli 0] crash (porter) - -2008-01-11 (bug fix)[1850424,1860425] stack checking on *bsd (sofer,noble) - -2008-01-13 (bug fix)[1353846] crash in read-only serial (hobbs,newman) - -2008-01-15 (bug fix)[1869989] mem leak; expr literals (porter,melbardis) - -2008-01-20 (bug fix)[1869405] binary [gets]; stacked channels (hobbs,ficicchia) - -2008-01-22 (bug fix)[1867855] fix [lreverse {}] crash (sofer,madden) - -2008-01-30 (bug fix)[1882373] fix Tcl_GetAlias pointer code (an00na) - -Several documentation and release notes improvements - ---- Released 8.5.1, February 5, 2008 --- See ChangeLog for details --- - -2008-02-06 (enhancement) [clock format] performance (kenny) - -2008-02-12 (bug fix)[1891827] compiled [switch -nocase] error (fellows) - -2008-02-22 (bug fix)[1818565] missing state array in http::status (thoyts) -=> http 2.5.4 - -2008-02-26 (bug fix)[1868845] corrected [eof] ordering (thoyts) - -2008-02-26 (new feature) [http::meta] command (thoyts) -=> http 2.5.5 - -2008-02-26 (bug fix)[1902436] fixed regexps ending in \* (hobbs) - -2008-02-27 (bug fix)[1862555,1902423] [clock] range & l10n (kenny) - -2008-02-28 (bug fix) [return -level 0] memory leak (porter) - -2008-02-28 (bug fix) [format %llx $big] memory leak (porter) - -2008-02-28 (bug fix) expression parser error message memory leak (porter) - -2008-02-28 (bug fix) memory leak when enter trace modifies command (porter) - -2008-02-29 (enhancement) Consumer refcounting for Tcl_SetReturnOptions() -and Tcl_AddObjToErrorInfo() (spjuth,porter) - *** POTENTIAL INCOMPATIBILITY *** - -2008-03-07 (bug fix)[1899164] Avoid expr and script bytecode confusion (porter) - -2008-03-07 (bug fix)[1904907] finalize crash in Tcl_GetReturnOptions (kupries) - -2008-03-10 (bug fix)[1893815] expr {abs(-1e-350)} => -0.0 (porter) - -2008-03-10 (bug fix)[1901113] crash in [tcl::Bgerror {} {}] (madden,porter) - -2008-03-11 (bug fix)[1911919] unset trace inf loop in namespace delete (sofer) - -2008-03-12 (new feature) some HTTP 1.1 support in http (and more!) (hobbs) -=> http 2.7 - -2008-03-13 (enhancement) support space in INSTALL_ROOT or $builddir (steffen) - -2008-03-16 (bug fix)[1903325] bytecode stack space prediction crash (fellows) - -2008-03-18 (bug fix)[1914604] Tcl Modules: encoding fixed to utf-8; environment -variables without "." added to customization hooks (kupries) - *** POTENTIAL INCOMPATIBILITY *** - -2008-03-18 (bug fix)[1914503] alignment of TclStackAlloc() return (sofer)\ - -2008-03-20 (bug fix)[1868171] expose Tcl_GetMemoryInfo (for AOLserver) (fellows) - -2008-03-24 (bug fix)[1923966] crash in [binary format x0s] (thoyts) - -2008-03-27 (platform support)[1921166] Solaris 64bit build fixes (steffen) - -2008-03-27 clock tzdata updated to Olson's tzdata2008b (kenny) - ---- Released 8.5.2, March 28, 2008 --- See ChangeLog for details --- - -2008-03-30 (bug fix)[1783544] more robust TclIsNaN() (kenny,teterin) - -2008-04-01 (interface)[1819422] tclStubsPtr no longer in libtcl (porter) - *** POTENTIAL INCOMPATIBILITY *** - -2008-04-01 (bug fix)[1839067] FP round fix for Solaris/x86 (kupries,schlenker) - -2008-04-02 (bug fix)[780533,1932639] [fcopy] callbacks unreliable (ferrieux) - -2008-04-02 (interface)[1819422] libtclstub symbols MODULE_SCOPE (steffen) - -2008-04-04 (bug fix) [chan postevent] crash (kupries) - -2008-04-07 (bug fix) Fix broken [format {% d}] (max) - -2008-04-07 (bug fix)[1350564] Bi-directional [fcopy] now supported (ferrieux) - -2008-04-16 (bug fix)[1938497] Tcl_SetNotifier() fixes (steffen) - -2008-04-16 (interface)[1938497] make stubs tables 'static const' (steffen) - -2008-05-02 (new feature) [binary] is now a [namespace ensemble] (thoyts) - -2008-05-07 (bug fix) [dict append] crash (mccormack,fellows) - -2008-05-21 (bug fix)[1968882] [info complete "\\\n"] => 0 (porter) - -2008-05-22 (bug fix)[1968245] Tcl_LogCommandInfo() accept length=-1 (darroch) - -2008-05-23 (bug fix)[1965787] 32-bit overflow in [tell] result (ferrieux) - -2008-05-31 (new feature)[TIP 257] [oo::*] commands from TclOO (fellows) - -2008-06-04 (new feature)[TIP 317] [binary encode]; [binary decode] (thoyts) - -2008-06-06 (new feature)[TIP 230] [chan push]; [chan pop] (kupries) - -2008-06-08 (enhancement)[1973096] bytecompiled [uplevel] scripts (sofer) - -2008-06-12 (platform support) Solaris static build with DTrace (steffen) - -2008-06-12 (platform support) Solaris/amd64 gcc 64bit support (steffen) - -2008-06-13 (new feature)[TIP 285] [interp cancel]; Tcl_CancelEval() (mistachkin) - -2008-06-20 (bug fix)[1999035] make [interp bgerror $i] act in $i (porter) - -2008-06-23 (bug fix)[1972879] bad path intrep caching (porter) - -2008-06-24 (bug fix)[1999176] crash in [glob -dir {} a] (porter) - -2008-06-25 (bug fix)[1999119] Support TM packages in Safe Base (kupries) - ---- Released 8.6a1, June 25, 2008 --- See ChangeLog for details --- - -2008-06-29 (bug fix)[2004480] plug memory leaks (ade,porter,steffen) - -2008-07-01 (enhancement)[1905562] embed recursion limit in RE engine (fellows) - -2008-07-03 (bug fix)[1969717] fix package finding on Samba shares (jos) - -2008-07-03 (bug fix)[1987821] mem leak in [seek] on reflected chan (kupries) - -2008-07-13 (enhancement)[2017110] new Non-Recursive Evaluation implementation -enables deep Tcl evaluation stacks without deep C stacks. (sofer) - -2008-07-20 (enhancement)[2008248] dict->list preserve item intreps (pasadyn) - -2008-07-21 (bug fix)[582506] imported cmds now fire execution traces (sofer) - -2008-07-21 (bug fix)[2015723] [file] bad use of inodes on Windows (thoyts) - -2008-07-21 (new feature)[TIP 304] [chan pipe] (ferrieux) - -2008-07-21 (bug fix)[2021443] more consistent "wrong # args" msgs (nijtmans) - -2008-07-21 (enhancement) [info frame] returns file data in more cases (kupries) - -2008-07-29 (bug fix)[2030670] fix rare panic in TclStackFree (pasadyn,sofer) - -2008-08-01 Tcl_Finalize() no longer called implicitly on DLL_PROCESS_DETACH. - -2008-08-05 (enhancement)[1994512] async connect logic simplified (jenglish) - -2008-08-06 (bug fix)[2040295] stopped supplying a workaround for bugs -in Itcl's use of [namespace code]. Itcl now supplies its own workaround. - *** POTENTIAL INCOMPATIBILITY for older Itcl releases *** - -2008-08-06 (bug fix)[2039178] repaired guard against dispatching oo methods -in a deleted interp. (porter) - -2008-08-08 tzdata updated to Olson's tzdata2008e (kenny) - -2008-08-11 (bug fix)[2046846] 64bit support for http zlib crc (thoyts) -=> http 2.7.1 - -2008-08-11 (enhancement) automatic [package provide] for TMs (kupries) - -2008-08-17 (bug fix)[2055782] crash involving Tcl_ConcatObj (sofer) - -2008-08-21 (new feature) CONST-ified Tcl routines passing (Tcl_ObjType *), -(Tcl_Filesystem *), or (Tcl_Timer *) arguments (nijtmans,porter) - *** POTENTIAL INCOMPATIBILITY *** - -2008-08-21 (bug fix)[2065115] Restored ***= regexp functioning (hobbs,porter) - ---- Released 8.6a2, August 25, 2008 --- See ChangeLog for details --- - -2008-08-29 (bug fix)[2082299] Install TclOO header files (fellows) - -2008-09-01 oo methods called during interp deletion no longer skipped if -they do not need the dying interp (fellows) - -2008-09-02 (support) Dropped support for pre-ANSI compilers. (porter) - -2008-09-04 (bug fix)[2093947] var unset trace in coroutine (fellows,sofer) - -2008-09-10 (enhancement) efficient list->dict conversion (elby,fellows) - -2008-09-10 (bug fix)[2102930] faulty numLevels count (madden,sofer) - -2008-09-16 (bug fix)[2114165] eval failure following cancel (sofer) - -2008-09-17 (bug fix)[2116053] export [min] and [max] from tcl::mathfunc (sofer) - -2008-09-22 (new feature)[TIP 320] oo common variable declaration (fellows) - -2008-09-24 (new feature)[TIP 316] portable access to Tcl_StatBuf (fellows) - -2008-09-24 (new feature)[TIP 323] [file delete], [file mkdir] zero pathNames (porter) - -2008-09-25 (new feature)[TIP 315] new var: tcl_platform(pathSeparator) (vu,fellows) - -2008-09-25 (new feature)[TIP 323] [global], [variable] zero varNames (porter) - -2008-09-26 (new feature)[TIP 323] [lassign], [namespace upvar], [my variable] zero varNames (porter) - -2008-09-26 (new feature)[TIP 323] [tcl::tm::path add|remove] zero pathNames (porter) - -2008-09-26 (new feature)[TIP 323] [lrepeat] zero elements; zero repeats (porter) - -2008-09-27 (bug fix)[2130992] prevent overflow crash in [lrepeat] (fellows) - -2008-09-28 (new feature)[TIP 314] ensemble parameters before subcommand (hellström,fellows) - -2008-09-29 (new feature)[TIP 318] revised defaults for [string trim] (poser) - *** POTENTIAL INCOMPATIBILITY *** - -2008-09-29 (new feature)[TIP 313] [lsearch -bisect] (spjuth) - -2008-09-29 (new feature)[TIP 326] [lsort -stride] (elby) - -2008-09-29 (new feature)[TIP 323] [linsert] zero elements (porter) - -2008-09-29 (new feature)[TIP 323] [glob] zero patterns (porter) - -2008-10-02 (new feature)[TIP 330] interp->result access disabled (kenny) - *** POTENTIAL INCOMPATIBILITY *** - -2008-10-03 (new feature)[TIP 265] Tcl_ParseArgv() (bromley) - -2008-10-03 (new feature)[TIP 195] [tcl::prefix] (spjuth) - -2008-10-04 (new feature) CONST-ified Tcl routines Tcl_GetIndexFromObj, -Tcl_RegisterConfig, Tcl_InitCustomHashTable, and routines passing -(Tcl_ChannelType *). (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2008-10-04 (bug fix)[2059262] unload only libraries marked unloadable (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2008-10-05 (new feature)[TIP 331] [lset listVar end+1 $value] (kenny) - -2008-10-05 (bug fix)[2143288] correct bad isqrt() results (boffey,kenny) - -2008-10-05 (new feature) CONST-ified return value of the -Tcl_FSFileAttrStringsProc prototype. (nijtmans) - *** POTENTIAL INCOMPATIBILITY for Tcl_Filesystems *** - -2008-10-07 (new feature)[TIP 327] [tailcall] (sofer) - -2008-10-07 (new feature)[TIP 328] [coroutine],[yield],[info coroutine] (sofer) - -2008-10-08 (bug fix)[2151707] fix stack trace from variable trace (porter) - -2008-10-10 (bug fix)[2155658] crash in oo method export (fellows) - ---- Released 8.6a3, October 10, 2008 --- See ChangeLog for details --- - -2008-10-13 (bug fix) Fix ability to join threads on 64-bit Windows (thoyts) - -2008-10-23 (bug fix)[2186888] Direct-eval [for] handling of [continue] was -broken by NRE reform (sofer,porter) - -2008-10-24 (bug fix) fix failure to read SHOUTcast streams (thoyts) -=> http 2.7.2 - -2008-10-27 (enhancement) system encoding at startup is now "iso8859-1", and -no longer "identity". Use of identity encoding minimized (porter) - *** POTENTIAL INCOMPATIBILITY *** - -2008-10-31 (bug fix)[2200824] revised [oo::define] to include caller -context when resolving names. (nassau,fellows) - -2008-11-10 (bug fix)[2255235] [platform::shell::LOCATE] update (ring,kupries) -=> platform::shell 1.1.4 - -2008-11-13 (bug fix)[2269431] VFS [load] -> tempfile litter (ficicchia,nijtmans) - -2008-11-26 (bug fix)[2114900] updated tclIndex file (cassoff,kenny) - -2008-11-27 (bug fix)[2251175] [{*}{\{}] errors (hellström,ferrieux,porter) - -2008-11-29 (new feature)[TIP 210] [file tempfile] (techentin,fellows) - -2008-11-30 (bug fix)[2362156] [clock]: colon in format string (mizuno,kenny) - -2008-12-02 (bug fix)[2270477] hang in channel finalization (ferrieux,kupries) - -2008-12-02 (new feature)[TIP 336] Tcl_*ErrorLine() routines. Direct access -to the errorLine field of the interp struct denied by default. (porter) - *** POTENTIAL INCOMPATIBILITY *** - *** Define USE_INTERP_ERRORLINE to restore access for legacy code *** - -2008-12-04 (bug fix)[2385549] [file normalize] failed on some paths (porter) - -2008-12-05 (new feature)[TIP 307] Tcl_TransferResult() (leunissen,fellows) - -2008-12-05 (new feature)[TIP 335] Tcl_InterpActive() (mistachkin,fellows) - -2008-12-09 (new feature)[TIP 337] Tcl_BackgroundException() (porter) - -2008-12-10 (new feature)[TIP 341] >1 [dict filter] patterns (hellström,fellows) - -2008-12-10 (new feature)[TIP 343] [format %b $n] [scan $s %b] (ferrieux) - -2008-12-10 tzdata updated to Olson's tzdata2008i (kenny) - -2008-12-11 (new feature)[TIP 234] [zlib] and Tcl_Zlib*() (sheffers,fellows) - -2008-12-11 (bug fix)[2407783] spoil ChannelState when channel name passes -among multiple interps (kupries) - -2008-12-12 (new feature)[TIP 322] Tcl_NR*() routines to enabled non-recursive -evaluation in extensions (sofer,kenny) - -2008-12-09 (new feature)[TIP 338] Tcl_*StartupScript() (porter) - *** POTENTIAL INCOMPATIBILITY for callers of Tcl*Startup* routines *** - -2008-12-16 (new feature)[TIP 329] [try] [throw] (davel,fellows) - -2008-12-17 (new feature)[TIP 308] package tdbc 1.0b1 (kenny) - -2008-12-18 (new feature)[TIP 332] [close $chan read|write] (ferrieux) - -2008-12-18 (bug fix)[2444274] panic in long commands from {*} (goth,porter) - ---- Released 8.6b1, December 19, 2008 --- See ChangeLog for details --- - -2008-12-27 [TIP 234] Tcl_Zlib* interface revisions (fellows) - *** INCOMPATIBILITY with interface of 8.6b1 *** - -2009-01-02 (platform support)[878333] IRIX compat for mkstemp() (fellows) - -2009-01-03 (bug fix)[2481670] [clock add] error message (talvo) - -2009-01-05 (bug fix)[2412068] NR-enable [source] (fellows) - -2009-01-06 (bug fix)[2489836] crash unknown method dispatch (nadkarni,fellows) - -2009-01-06 (bug fix)[2481109] fix context of instance name check (fellows) - -2009-01-08 (enhancement) more -errorcode values (fellows) - -2009-01-19 (new feature) CONFIG_INSTALL_DIR - where tclConfig.sh goes (cassoff) - -2009-01-19 (platform support) better tools for BSD ports (cassoff) - -2009-01-21 (bug fix)[2458202] exit crash with [chan create]d channel (kupries) - -2009-01-26 (bug fix)[2446662] uniformly declare EOF on RST on sockets (ferrieux) - -2009-01-26 (bug fix)[1028264] delay WSACleanup() from under our feet (ferrieux) - -2009-01-29 (bug fix)[2519474] Tcl_FindCommand() bug exposed by oo (fellows) - -2009-01-29 (bug fix)[2537939] Fix Tcl_OOInitStubs() for no-stubs build (fellows) - -2009-02-04 (bug fix)[2561746] [string repeat] overflow crash (porter) - -2009-02-05 (enhancement) optimize string operations on bytearrays (fellows) - -2009-02-12 (bug fix) enable simpler [oo::define] extension (ferri,fellows) - -2009-02-15 (bug fix)[2603158] Tcl_AppendObjToObj: append to self crash (porter) - -2009-02-17 (platform support) MSVC and _WIN64 (hobbs) - -2009-02-20 (bug fix)[2571597] [file pathtype /a] wrong result (nadkarni,porter) - -2009-03-03 (bug fix)[2662434] [zlib crc32] result now unsigned (gavilan,fellows) - -2009-03-15 (platform support) translate SIGINFO where defined (BSD) (teterin) - -2009-03-15 (bug fix)[2687952] TSD struct memleak (mistachkin) - -2009-03-18 (bug fix)[2688184] memleak in [file normalize] (mistachkin) - -2009-03-20 (bug fix)[2597185] crash in Tcl_AppendStringToObj (porter) - -2009-03-20 (bug fix)[2561794,2669109,2494093,2553906] string overflow (porter) - -2009-03-22 (bug fix)[2502037] NR-enable [namespace unknown] (sofer) - -2009-03-27 (bug fix)[2710920] [file dirname|tail /foo/] errors (epler,porter) - -2009-04-08 (bug fix)[2570363] unsafe [eval]s in tcltest (bron,porter) -=> tcltest 2.3.1 - -2009-04-08 (platform support) more Darwin kernel patterns (steffen) -=> platform 1.0.4 - -2009-04-09 (bug fix)[26245326] [http::geturl] connection failures (golovan) -=> http 2.7.3 - -2009-04-10 (new feature) Darwin: embeddable CoreFoundation notifier (steffen) - -2009-04-10 (bug fix)[1961211] Darwin [load] back-compatibility (steffen) - -2009-04-09 (new feature) http chunked+gzip modes (thoyts) -=> http 2.8.0 - -2009-04-11 (enhancement) clarified cmd name resolution in oo forwards (fellows) - -20009-04-19 (bug fix)[2715421] http: excess bytes after POST (thoyts) -=> http 2.8.1 - -2009-04-30 (bug fix)[2486550] coroutine in [interp invokehidden] (sofer) - -2009-05-07 (bug fix)[2785893] find command in deleted namespace (sofer) - -2009-05-08 (bug fix)[2414858] tailcall in oo constructor (fellows) - -2009-05-14 (new subcommand)[TIP 354] [info object namespace] (fellows) - -2009-05-29 (platform support) account for ia64_32 (kupries) -=> platform 1.0.5 - -2009-06-02 (bug fix)[2798543] incorrect [expr] integer ** results (porter) - -2009-06-10 (bug fix)[2801413] overflow in [format] (porter) - -2009-06-13 (bug fix)[2802881] corrected compile env context (tasada,porter) - -2009-06-17 (redesign) reduced ambition of [exit] finalization with aim to -avoid otherwise very tricky multi-thread finalization bugs. (staplin,ferrieux) - *** POTENTIAL INCOMPATIBILITY for exit handlers *** - -2009-06-26 (platform support) updates for Xcode 3.1 & 3.2 (steffen) - -2009-06-30 (platform support) clang static analyzer macros (steffen) - -2009-07-01 (bug fix)[2806622] Win: bad tcl_platform(user) value (thoyts) - -2009-07-05 (bug fix) zlib support asynch [chan copy] on chan transform (fellows) - -2009-07-12 (bug fix)[1895546] TclOO support for Itcl 4 method caching (fellows) - -2009-07-13 (bug fix)[1605269] NR-related [info frame] fixes (kupries) - -2009-07-14 (bug fix)[2821401] NR-enable direct eval [switch] (kenny) - -2009-07-16 (bug fix)[2819200] underflow settings on MIPS systems (porter) - -2009-07-19 (interface)[TIP 354] new routine Tcl_GetObjectName() (fellows) - -2009-07-20 (performance) favor [string is] success cases over empty (fellows) - -2009-07-22 (interface) removed TclpPanic() routine (nijtmans) - -2009-07-23 (bug fix)[2820349] plug event leak in notifier (mistachkin) - -2009-07-24 (bug fix)[2826248] crash in Tcl_GetChannelHandle (sonnenburg,kupries) - -2009-07-31 (bug fix)[2830354] overflow in [format] (misch,porter) - -2009-08-06 (bug fix)[2827000] reflected channels can signal EGAIN (kupries) - -2009-08-12 (new feature)[TIP 353] Tcl_NRExprObj() (porter) - -2009-08-20 (bug fix)[2823276] NR-enable [if], [for], [while] (fellows) - -2009-08-20 (bug fix)[2806250] EIAS violation in ~foo pathnames (porter) - -2009-08-21 (bug fix)[2837800] [glob */foo] return ./~x/foo (porter) - -2009-08-24 (bug fix) nested event loop notifier w/TkAqua Cocoa (alaoui,steffen) - -2009-08-25 (bug fix) [info frame] account for continuation lines (kupries) - -2009-08-27 (bug fix)[2845535] overflows in [format] (porter) - -2009-09-01 (bug fix) improved error message in tcltest (porter) -=> tcltest 2.3.2 - -2009-09-11 (bug fix)[2849860] http handle "quoted" charset value (fellows) -=> http 2.7.4 - -2009-09-11 (enhancement)[2314561] [subst] now bytecompiled, NR-enabled (porter) - -2009-09-24 (new feature)[TIP 356] Tcl_NRSubstObj() (porter) - -2009-10-04 (bug fix)[2569449] Core Foundation memory bug in Tiger (steffen) - -2009-10-06 (bug fix) repair intrep loss in slave interp evaluations -introduced by first versions of the NRE conversion (nadkarni,porter) - -2009-10-06 (bug fix)[1941434] broken tclTomMath.h includes (porter) - -2009-10-07 (bug fix)[2871908] leaked hash table (mistachkin,kupries) - -2009-10-08 (bug fix)[2874678] bignum leak in [dict incr] (fellows) - -2009-10-17 (bug fix)[2629338] crash in var unset traces (raney,fellows) - -2009-10-19 (bug fix)[2107634] extend [read] and [gets] to Tcl string limits -(morrison,parker,porter) - -2009-10-21 (bug fix)[2882561] Haiku OS signal support (morrison,fellows) - -2009-10-22 (bug fix)[2883857] [my varname arr(index)] (boudaillier,fellows) - -2009-10-23 (bug fix) 0-length writes: spurious SIG_PIPE (teterin,kupries) - -2009-10-24 Broken DST applied EU rules to US zones (lehenbauer,kenny) - -2009-10-29 (bug fix)[2800740] halved bignum memory on 64-bit systems (porter) - *** POTENTIAL INCOMPATIBILITY *** - -2009-11-05 (bug fix)[2854929] TM search path support in Safe Base (kupries) - -2009-11-05 (enhancement) rewrite of the Safe Base commands (kupries) - -2009-11-11 (bug fix)[2888099] [close] loses ENOSPC error (khomoutov,ferrieux) - -2009-11-11 (bug fix)[2891171] RFC 3986 compliance for ? in URL (nijtmans) -=> http 2.8.2 - -2009-11-12 (bug fix)[2895565] [fcopy -size] miscounts when converting encodings -(kupries) - -2009-11-16 (bug fix)[2891556] encoding finalization crash (mistachkin,ferrieux) - -2009-11-18 (bug fix)[2849797] consistent names for std chans (nijtmans,fellows) - *** POTENTIAL INCOMPATIBILITY *** - -2009-11-19 (enhancement) [load]able Tcltest extension (nijtmans) - -2009-11-24 (bug fix)[2893771] [file stat] on Win locked files (thoyts) - -2009-11-24 (bug fix)[2903011] crash call destructor from constructor (fellows) - -2009-12-03 (bug fix)[2906841] Safe Base [glob ../*] fixes (fellows) - -2009-12-09 (bug fix)[2901998] consistent I/O buffering (ferrieux,kupries) - -2009-12-11 (bug fix)[2806407] NR-enabled coroutines (sofer) - -2009-12-16 (bug fix)[2913616] msgcat: improved safe interp support (fellows) -=> msgcat 1.4.3 - -2009-12-22 (bug fix)[2918962] [lsort -index -stride] crash (moore,fellows) - -2009-12-23 (bug fix)[2913625] [info script/nameof] in safe interps (fellows) - -2009-12-28 (bug fix)[2891362] enable time limit in child interps (fellows) - -2009-12-29 (bug fix)[2922555] [binary decode hex { }] crash (thoyts) - -2009-12-29 (bug fix)[2895741] enable min(), max() in safe interps (fellows) - -2009-12-30 (bug fix)[2824981] guard [unknown] against [set] undef (sofer) - -2010-01-05 (bug fix)[2918610] [file rootname] corruption (magerya,porter) - -2010-01-18 (bug fix)[2932421] less [format %s] shimmer (ferrieux) - -2010-01-18 (bug fix)[2918110] [chan postevent] crash (bron,kupries) - -2010-01-21 (bug fix)[2910748] NR-enable epoch fallback direct eval (sofer) - -2010-01-30 (enhancement) [unset] now bytecompiled (fellows) - -2010-02-01 (bug fix)[2942697] faster match: some pathological regexp patterns -(lane,fellows) - -2010-02-01 (bug fix)[2939073] [array unset] unset trace crash (ferrieux) - -2010-02-02 (bug fix)[2944404] crash in oo destructor (fellows) - -2010-02-02 (new feature) [array] is now a [namespace ensemble] (fellows) - -2010-02-05 (enhancement) [error] now bytecompiled (fellows) - -2010-02-08 (bug fix)[2947783] Tcl_Zlib*flate fail on shared values (fellows) - -2010-02-09 (enhancement) [try] now bytecompiled (fellows) - -2010-02-11 (bug fix)[2826551] line-sensitive matching in regexp (dejong) - -2010-02-11 (bug fix)[2949740] [open |noSuch rb] crash (kovalenko,fellows) - -2010-02-15 (bug fix)[2950259] harden (delete obj ns -> delete obj) (fellows) - -2010-02-21 (bug fix)[2954959] get sign of abs($zero) right (nijtmans) - -2010-02-22 (bug fix)[2762041] zlib chan transforms read EOF too early (kupries) - -2010-02-27 (bug fix)[801429] Tcl_SetMainLoop() thread safety (fellows) - *** POTENTIAL INCOMPATIBILITY *** - -2010-03-02 (enhancement) -fvisibility-hidden build support (nijtmans) - -2010-03-04 (bug fix)[2962664] [oo::class destroy] crash (fellows) - -2010-03-05 (interface) TclOO typedefs for function pointers (fellows) - *** POTENTIAL INCOMPATIBILITY *** - -2010-03-09 (bug fix)[2936225] stop [chan copy] to slow channel consuming all -memory with buffer backup (ferrieux) - -2010-03-17 (bug fix)[2921116] crash in chan transfrom teardown (kupries) - -2010-03-19 (enhancement) [throw] now bytecompiled (fellows) - -2010-03-20 (enhancement) permit [fcopy] of > 2**31 bytes (fellows) - -2010-03-24 (new feature) [info object methodtype] (fellows) - -2010-03-24 (bug fix)[2383005] [return -errorcode] reject non-list (porter) - -2010-03-25 (bug fix)[2976504] broken fstatfs() call (reeuwijk,fellows) - -2010-03-30 (new feature)[TIP 362] [registry -32bit|-64bit] (courtney,fellows) -=> registry 1.3 - -2010-03-30 (bug fix)[2978773] refchan mem preservation (kupries) - -2010-04-02 (new feature)[TIP 357] Tcl_LoadFile, Tcl_FindSymbol, etc. (kenny) - -2010-04-05 (configure change)[TIP 364] default build: --enable-threads (fellows) - *** POTENTIAL INCOMPATIBILITY *** - -2010-04-02 (new feature)[TIP 348] [info errorstack], [return -errorstack] -(ferrieux) - -2010-04-20 (enhancement) update bundled zlib to 1.2.5 (nijtmans) - -2010-04-29 (enhancement)[2992970] optimize bytearray appends (fellows) - -2010-05-19 (bug fix)[3004007] dict/list shimmer w/o string rep loss (fellows) - -2010-06-09 (bug fixes) platform: several fixes for 64 bit systems (kupries) -=> platform 1.0.9 - -2010-06-16 (bug fix)[3016135] [clock format] in he_IL locale (nijtmans) - -2010-06-18 (bug fix)[3017997] Add .cmd to file extensions for [exec] (fellows) - -2010-06-28 (bug fix)[3019634] support errno.h changes in MSVC++ 2010 (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2010-07-02 (enhancement) -errorcode for [expr] domain errors (fellows) - -2010-07-28 (bug fix)[3037525] crash deleting vars @ callframe pop (sofer) - -2010-08-04 (bug fix)[3034840] mem corrupt when refchan loses interp (kupries) - -2010-08-04 (enhancement) Win [load] use LOAD_WITH_ALTERED_SEARCH_PATH (hobbs) - -2010-08-04 (platform support) panic on detection of win9x system (hobbs) - *** POTENTIAL INCOMPATIBILITY *** - -2010-08-10 (fix) Handle non-null-terminated bytearrys in glob matching (hobbs) - -2010-08-11 (fix) copy-paste bug in [yield] implementation (sofer, goth) - -2010-08-11 (platform) Drop pre-aix 4.2 support, ldAix (hobbs) - -2010-08-14 (frq)[2819611] changed signatures of hash fnctions, delete-file, and get-native-path (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2010-08-15 (bug fix)[3045010] tweaked error message for wrong#args of lambda's (fellows) - -2010-08-18 (bug fix)[3004191] fixed safe [glob] (fellows) - -2010-08-21 (patch)[3034251] genStubs steal features of ttkGenStubs (nijtmans) - -2010-08-26 (bug fix)[1230554] configure, OSF-1 problems, windows manifest issues (hobbs) - -2010-08-30 (bug fix) [3046594,3047235,3048771] reimplemented tailcall (sofer) - -2010-08-31 fixed manifest handling on windows (hobbs, kupries) - -2010-08-31 windows makefile and stub changes (nijtmans) - -2010-09-01 (bug fix)[3057639] compiled lappend trace consistency (hobbs,kupries) - *** POTENTIAL INCOMPATIBILITY *** - -2010-09-01 fixed safe glob handling of -directory (kupries) - -2010-09-02 fixed safe glob handling of -join (kupries) - -2010-09-08 (bug fix)[3059922] build with mingw on amd64 (porter, mescalinum) - -2010-09-15 (bug fix)[3067036] stop hang in bytearray append (fellows) - -2010-09-22 unified set of link libraries between mingw and vc (nijtmans) - -2010-09-22 (bug fix)[3072640] protect writes to ::error* variables (sofer) - -2010-09-23 fix leak of return options [catch $err m constant] (porter, hobbs) - -2010-09-24 (bugfix)[3056775] fixed race condition in windows sockets (kupries) - -2010-09-24 (performance) string eq/cmp (hobbs) - -2010-09-26 (patch)[3072080] rewritten NRE core (sofer) - -2010-09-28 (new feature)[TIP 162] implementation of ipv6 sockets (max) - -2010-10-02 (bug fix)[3079830] properly invalidate string rep of dicts (fellows) - -2010-10-06 (bug fix)[3081065] fix writing to freed Tcl_Obj (porter) - -2010-10-08 fix in ipv6 code on windows (nijtmans) - -2010-10-09 fixed overallocation of execution stack (sofer) - -2010-10-11 windows unicode changes (nijtmans) - -2010-10-12 (bug fix)[3084338] fixed meamleak in ipv6 code (max) - -2010-10-13 (bug fix)[467523,983660] alt fix allows empty literal share (porter) - -2010-10-15 (bugfix)[3085863] updated unicode tables (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2010-10-16 refactored implementation of dict iteration (fellows) - -2010-10-17 (patch)[2995655] report inner contexts on error stack (ferrieux) - -2010-10-19 (bug fix)[3081008] fixed bytearray zlib interaction (fellows) - -2010-10-19 improved crc, appending to bytearray (fellows) - -2010-10-20 improved compilation of [dict for] (fellows) - -2010-10-26 Added private support to disable reverse dns (max) - -2010-10-26 Prevent crashes when querying socket options (fellows, max) - -2010-10-28 (bug fix)[3093120] prevent freeaddrinfo(NULL) (porter, virden) - -2010-10-29 (bug fix)[2905784] stop cycle waste in short [after] (ferrieux) - -2010-11-01 tzdata updated to Olson's tzdata2010o (kenny) - -2010-11-04 (bug fix)[3099086] Clarified docs of var substitution (fellows) - -2010-11-04 improved install targets (cassof) - -2010-11-04 improved testing of sockets (max) - -2010-11-05 (frq)[491789] setargv/unicode cmdline for MSVC (nijtmans) - -2010-11-09 (bug fix)[3105999] fixed memleak in OO var resolver (fellows) - -2010-11-15 (TIP 378)[3081184] improved TIP 280 performance (kupries) - -2010-11-16 (platform) VS 2005 SP1 MSVC compiler (nijtmans) - -2010-11-18 (bug fix)[3111059] leak in [namespace delete] w coroutines (sofer) - -2010-11-28 [3120139,3105247] Tcl_PrintDouble improvements (kenny) - -2010-11-29 (new cmd) [tcl::unsupported::inject] (ferrieux,sofer) - -2010-11-30 (enhancement) Restore TclFormatInt for performance (hobbs) - -2010-12-09 (new feature) [file] is now a [namespace ensemble] (fellows) - -2010-12-19 (bug fix) [fcopy -size 1 -command] asynchronous (ferrieux) - -2010-12-12 (platform) OpenBSD build improvements (cassoff) - -2010-12-17 (platform) Revisions to support rpm 4.4.2 (cassoff) - -2010-12-27 (bug fix) crash in [lsort] w multiple -index options (fellows) - -2010-12-30 (bug fix)[3142026] GrowEvaluationStack OBOE (harder,sofer) - -2011-01-18 (bug fix)[3001438] [info frame -1] crash (mccormack,fellows) - -2011-03-01 (performance)[3168398] optimize [interp cancel] (mistachkin) - -2011-03-05 (bug fix)[3185009] crash in OO variables (danckaert,fellows) - -2011-03-05 (new cmd) [tcl::unsupported::assemble] (ugurlu,kenny) - -2011-03-06 (bug fix)[3200987,3192636] parser buffer overruns (porter) - -2011-03-08 (bug fix)[3202905] failed intrep release of interp result (mccormack) - -2011-03-09 (bug fix)[3202171] repair [namespace inscope] optimizer (porter) - -2011-03-10 (new version) better tcltest reporting from child interps (fellows) -=> tcltest 2.3.3 - -2011-03-10 (new feature) [namespace] is now a [namespace ensemble] (fellows) - -2011-03-12 (interface) reduce casting by ckalloc(), ckfree() callers (fellows) - -2011-03-14 (bug fix) Fixes from libtommath 0.42.0 release (fellows) - -2011-03-21 (bug fix)[3216070] [load] extension from embed Tcl apps (nijtmans) - ***POTENTIAL INCOMPATIBILITY*** - -2011-03-27 (performance) NRE: LIST lset foreach benchmark (twylite) - -2011-04-11 (bug fix)[3282869] coroutine + eval + locals crash (ferrieux,sofer) - -2011-04-13 (bug fix)[2662380] crash when variable append trace unsets (sofer) - -2011-04-13 (bug fix)[3285375] Buffer overflow in [concat] (porter) - -2011-05-02 (internals change) revised TclFindElement() interface (porter) - *** POTENTIAL INCOMPATIBILITY *** - -2011-05-05 (enhancement) dict->list w/o string rep generation (porter) - -2011-05-10 (bug fix)[3173086] Crash parsing long lists (rogers,porter) - -2011-05-24 (enhancement) msgcat internal improvements (fellows) -=> msgcat 1.4.4 - -2011-05-25 (TIP 381) [info object|class call] [self call] [nextto] (fellows) - -2011-05-31 (bug fix)[3293874] let lists grow all the way to the limit (porter) - -2011-06-02 (bug fix)[3185407] cmd resolution epoch flaw (nadkarni,fellows) - -2011-06-13 (bug fix)[3315098] mem leak generating double string rep (neumann) - -2011-06-22 (new feature) DEB_HOST_MULTIARCH support (kupries) -=> platform 1.0.10 - -2011-07-15 (bug fix)[3357771] Prevent circular refs in bytecode (porter) - -2011-07-28 tzdata updated to Olson's tzdata2011h (porter) - -2011-08-01 (bug fix)[3383616] memleak exposed by XOTcl (neumann,sofer) - -Many more Tcl built-in command errors now set an -errorcode. - ---- Released 8.6b2, August 8, 2011 --- See ChangeLog for details --- - -2011-07-02 (bug fix)[3349507] correct double(1[string repeat 0 23]) (kenny) - -2011-07-19 (bug fix)[3371644] Tcl_ConvertElement() segfault (sader, ferrieux) - -2011-07-21 (bug fix)[3372130] hypot(.) segfault (nijtmans) - -2011-08-12 (bug fix)[3389764] memleaks due to reference cycles in dup'd paths - -2011-08-15 (bug fix)[3390272] leak of [info script] value (porter) - -2011-08-17 (bug fix)[3393150] bignum leaks in Tcl_Get*() routines (porter) - -2011-08-18 (bug fix)[3393714] [string toupper] overflow (nijtmans) - -2011-08-30 (bug fix)[3398794] panic in interp limit setting (gavlian,fellows) - -2011-09-08 (bug fix)[3401704] revised expr parser to permit function names -like "nano()" instead of parsing as "nan o()" with missing op (duquette,porter) - *** POTENTIAL INCOMPATIBILITY *** - -2011-09-10 (bug fix)[3400658] wrong num args msg with TclOO (rsooltan,fellows) - -2011-09-13 (bug fix)[3390638] solaris studio cc workaround (kechel,porter) - -2011-09-13 (bug fix)[3405652] DTrace workaround (michelson,porter) - -2011-09-16 (bug fix)[3391977] -headers overrides -type (ziegenhagen,fellows) -=> http 2.8.3 - -2011-09-16 (TIP 388) New \Uhhhhhhhh syntax (nijtmans) - -2011-10-06 (enhancement) bytecode compile [dict with] (fellows) - -2011-10-11 (bug fix)[2935503] [file stat] returns bad mode (nadkarni,nijtmans) - -2011-10-20 (bug fix)[3418547] cmd lits and custom resolvers (soberning,fellows) - -2011-10-31 (bug fix)[3414754] EIAS violation in fs paths (porter) - -2011-11-22 (bug fix)[3354324] Win: [file mtime] sets wrong time (nijtmans) - -2011-11-30 (bug fix)[967195] Simply args passed to child processes (nijtmans) -=> tcltest 2.3.4 - -2011-12-07 (bug fix)[3444754] fix [string tolower \u01C5] (nijtmans) - -2011-12-11 (update)[3457031] Update [[:print:]] to Unicode 6.0 (nijtmans) - -2011-12-24 (bug fix)[3464428] fix [string is graph \u0120] (nijtmans) - -2012-01-08 (bug fix)[3470928] zoneinfo trouble with Windhoek data file (kenny) - -2012-01-13 (bug fix)[3472316] fix retrieval of socket error (fellows) - -2012-01-21 (bug fix)[3475667] [regexp] buffer read overflow (sebres) - -2012-01-22 (bug fix)[3475264] [dict exists] return 0, not error (fellows) - -2012-01-25 (bug fix)[3474460] [oo::copy] var resolution list (fellows) - -2012-01-26 (bug fix)[3475569,3479689] mem corrupt in fs path (sebres,porter) - -2012-01-30 (enhancement) improve bytecode compile of [catch] (fellows) - -2012-02-02 (bug fix)[2974459,2879351,1951574,1852572,1661378,1613456] Fix -problems where [file *able] would return false results on Win/Samba (porter) - -2012-02-06 (bug fix)[3484621] bump bytecode epoch on exec traces (kuhn,sofer) - -2012-02-15 (bug fix)[3487626] crash compiling [dict for] (fellows) - -2012-02-15 (enhancement) bytecode compile [lrange],[lreplace] (fellows) - -2012-02-17 (bug fix)[2233954] compile problem on AIX & Android (nijtmans) - -2012-02-29 (bug fix)[3466099] BOM in Unicode (nijtmans) - -2012-03-07 (bug fix)[3498327] RFC 3986 compliance (kupries) - -2012-03-26 (TIP 380) New builtin class [oo::Slot] (fellows) - *** POTENTIAL INCOMPATIBILITY *** - -2012-03-27 (TIP 397) method to extend [oo::copy] (fellows) - *** POTENTIAL INCOMPATIBILITY *** - -2012-03-27 (TIP 395) New subcommand [string is entier] (fellows) - -2012-04-02 (TIP 396) New command [yieldto] (fellows) - -2012-04-04 (bug fix)[3514761] crash combining objects and ensembles (fellows) - -2012-04-09 (bug fix)[2712377] [info vars] and oo variables (fellows) - -2012-04-09 (bug fix)[3396896] no dups in oo var lists (fellows) - -2012-04-11 (bug fix)[3448512] [clock scan 1958-01-01] fail on Win (nijtmans) - -2012-04-15 (bug fix)[3517696] fix flush of zlib chan xform (fellows) - -2012-04-18 tzdata updated to Olson's tzdata2012c (kenny) - -2012-04-28 (TIP 398) exit non-blocking chan without flush (ferrieux) - *** POTENTIAL INCOMPATIBILITY *** - -2012-05-02 (enhancement) Better use of Intel cpuid instruction (nijtmans) - -2012-05-03 (bug fix)[3428753] Unbreak synchronous [socket -async] (porter) - -2012-05-10 (bug fix)[2812981] force consistent config of Tcl+pkgs (ferrieux) - -2012-05-10 (bug fix)[473946] correct send of special characters (nijtmans) - -2012-05-17 (bug fix)[3445787] fix [file] ensemble in Safe Base (fellows) - -2012-05-17 (bug fix)[2964715] fix [glob] in Safe Base (fellows) - -2012-05-17 (bug fix)[3106532] proper [switch -indexvar] values (fellows) - *** POTENTIAL INCOMPATIBILITY *** - -2012-05-21 (TIP 106) New -binary option to [dde execute|poke] (oehlmann) -=> dde 1.4.0 - -2012-05-23 (bug fix)[3525907] [zlib push decompress] & [chan event] -(fellows,ferrieux,kupries) - -2012-05-28 (bug fix)[3529949] Protect ~ paths in Safe Base (fellows) - -2012-06-21 (bug fix)[3362446] [registry keys] failure (nijtmans) -=> registry 1.3.0 - -2012-06-25 (bug fix)[3537605] [encoding dirs a b] error message (fellows) - -2012-06-25 (bug fix)[3024359] crash when multi-thread concurrent [file system] -and Tcl_FSMountsChanged(). (porter) - -2012-06-29 (bug fix)[3536888] fix locale guessing (oehlmann,nijtmans) - -2012-07-05 (bug fix)[1189293] make "<<" redirect binary safe (porter) - -2012-07-08 (bug fix)[3531209] accept IPv6 URLs (max) -=> http 2.8.4 - -2012-07-24 (bug fix) stop mem corruption in stacked channel events (max,porter) - -2012-07-25 (bug fix)[3546275] [auto_execok] search match [exec] (danckaert) - -2012-07-27 (update)[3464401] Support Unicode 6.2 (nijtmans) - -2012-08-20 (bug fix)[3559678] [file normalize] EIAS failure (phao,dgp) - -2012-08-25 (bug fix)[3561330] Ukranian translation of "March" (teterin) - -2012-09-07 (TIP 404) New msgcat commands [mcflset], [mcflmset] (oehlmann) -=> msgcat 1.5.0 - -Many revisions to better support a Cygwin environment (nijtmans) - -Dropped support for OS X versions less than 10.4 (Tiger) (fellows) - ---- Released 8.6b3, September 18, 2012 --- See ChangeLog for details --- - -2012-09-20 (enhancement) full Unicode support (nijtmans) -=> dde 1.4.0 - -2012-09-20 (enhancement) update bundled zlib to 1.2.7 (nijtmans) - -2012-10-03 (bug fix) exit panic on stacked std channel (griffin,porter) - -2012-10-14 (bug fix) [tcl::Bgerror] crash on non-dict options (nijtmans) - -2012-10-16 (TIP 400) New [zlib] options to set compression dict (fellows) - -2012-10-16 (TIP 405) New commands [lmap] and [dict map] (fellows) - -2012-10-24 (enhancement) [dict unset] now bytecompiled (fellows) - -2012-11-05 (TIP 413) Revisions to default [string trim*] trimset (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2012-11-05 (enhancement) Now bytecompiled: [array exists], [array set], -[array unset], [dict create], [dict exists], [dict merge], [format], -[info commands], [info coroutine], [info level], [info object], -[namespace current], [namespace code], [namespace qualifiers], [namespace tail], -[namespace which], [regsub], [self], [string first], [string last], -[string map], [string range], [tailcall], [yield]. (fellows) - -2012-11-06 (bug fix)[3581754] avoid multiple callback on keep-alive (fellows) -=> http 2.8.5 - -2012-11-07 tzdata updated to Olson's tzdata2012i (kenny) - -2012-11-13 (bug fix)[3567063] thread fp settings from master (mistachkin) - -2012-11-14 (bug fix)[2933003] tempfile creation in $TMPDIR (fellows) - -2012-11-15 (TIP 416) New [load] options -global and -lazy (nijtmans) - -2012-11-20 (bug fix)[3033307] base64 trail whitespace (kovalenko,goth) - -2012-12-03 (bug fix) [configure] query broke init from argv (porter) -=> tcltest 2.3.5 - -2012-12-13 (bug fix)[3595576] crash: [catch {} -> noSuchNs::var] (sofer,porter) - -2012-12-13 (bug fix) crash: [zlib gunzip $data -header noSuchNs::var] (porter) - ---- Released 8.6.0, December 20, 2012 --- See ChangeLog for details --- - -2012-12-22 (bug fix)[3598150] DString to Tcl_Obj memleak (afredd) - -2012-12-27 (bug fix)[3598580] Tcl_ListObjReplace() refcount fix (nijtmans) - -2013-01-04 (bug fix) memleak in [format] compiler (fellows) - -2013-01-08 (bug fix)[3092089,3587096] [file normalize] on junction points - -2013-01-09 (bug fix)[3599395] status line processing (nijtmans) -2013-01-23 (bug fix)[2911139] repair async connection management (fellows) -=> http 2.8.6 - -2013-01-26 (bug fix)[3601804] Darwin segfault platformCPUID (nijtmans) - -2013-01-28 (enhancement) improve ensemble bytecode (fellows) - -2013-01-30 (enhancement) selected script code improvements (fradin) -=> tcltest 2.3.6 - -2013-01-30 (bug fix)[3599098] update to handle glibc banner changes (kupries) -=> platform 1.0.11 - -2013-01-31 (bug fix)[3598282] make install DESTDIR support (cassoff) - -2013-02-05 (bug fix)[3603434] [file normalize a:/] flaw in VFS (porter,griffin) - -2013-02-09 (bug fix)[3603695] $obj varname resolution rules (venable,fellows) - -2013-02-11 (bug fix)[3603553] zlib flushing errors (vampiera,fellows) - -2013-02-14 (bug fix)[3604576] msgcat use of Windows registry (oehlmann,nijtmans) -=> msgcat 1.5.1 - -2013-02-19 (bug fix)[2438181] report errors in trace handlers (yorick) - -2013-02-21 (bug fix)[3605447] unbreak [namespace export -clear] (porter) - -2013-02-23 (bug fix)[3599194] fallback IPv6 routines (afredd,max) - -2013-02-27 (bug fix)[3606139] stop crash in [regexp] (lane) - -2013-03-03 (bug fix)[3606258] major serial port update (english) - -2013-03-06 (bug fix)[3606683] [regexp (((((a)*)*)*)*)* {}] hangs -(grathwohl,lane,porter) - -2013-03-12 (enhancement) better build support for Debian arch (shadura) - -2013-03-19 (bug fix)[2893771] [file stat] on locked files (thoyts,nijtmans) - -2013-03-21 (bug fix)[2102614] [auto_mkindex] ensemble support (griffin) - -2013-03-27 Tcl_Zlib*() routines tolerate NULL interps (porter - -2013-04-04 (bug fix) Support URLs with query but no path (max) -=> http 2.8.7 - -2013-04-08 (bug fix)[3610026] regexp crash on color overflow (linnakangas) - -2013-04-29 (enhancement) [array set] compile improvement (fellows) - -2013-04-30 (enhancement) broaden glibc version detection (kupries) -=> platform 1.0.12 - -2013-05-06 (platform support) Cygwin64 (nijtmans) - -2013-05-15 (enhancement) Improved [list {*}...] compile (fellows) - -2013-05-16 (platform support) mingw-4.0 (nijtmans) - -2013-05-19 (platform support) FreeBSD updates (gahr) - -2013-05-20 (bug fix)[3613567] access error temp file creation (keene) - -2013-05-20 (bug fix)[3613569] temp file open fail can crash [load] (keene) - -2013-05-22 (bug fix)[3613609] [lsort -nocase] failed on non-ASCII (fellows) - -2013-05-28 (bug fix)[3036566] Use language packs (Vista+) locale (oehlmann) -=> msgcat 1.5.2 - -2013-05-29 (bug fix)[3614102] [apply {{} {list [if 1]}}] stack woes (porter) - -2013-06-03 Restored lost performance appending to long strings (elby,porter) - -2013-06-05 (bug fix)[2835313] [while 1 {foo [continue]}] crash (fellows) - -2013-06-17 (bug fix)[a876646] [:cntrl:] includes \x00 to \x1f (nijtmans) - -2013-06-27 (bug fix)[983509] missing encodings for config values (nijtmans) - -2013-06-27 (bug fix)[34538b] apply DST in 2099 (lang) - -2013-07-02 (bug fix)[32afa6] corrected dirent64 check (griffin) - -2013-07-06 tzdata updated to Olson's tzdata2013d (kenny) - -2013-07-10 (bug fix)[86fb5e] [info frame] in compiled ensembles (porter) - -2013-07-18 (bug fix)[1c17fb] revisd syntax errorinfo that shows error (porter) - -2013-07-26 (bug fix)[6585b2] regexp {(\w).*?\1} abb (lane) - -2013-07-29 [string is space \u202f] => 1 (nijtmans) - -2013-08-01 [a0bc85] Limited support for fork with threads (for Rivet) (nijtmans) - -2013-08-01 (bug fix)[1905562] RE recursion limit increased to support -reported usage of large expressions (porter) - -2013-08-02 (bug fix)[9d6162] superclass slot empty crash (vdgoot,fellows) - -2013-08-03 (enhancement)[3611643] [auto_mkindex] support TclOO (fellows) - -2013-08-14 (bug fix)[a16752] Missing command delete callbacks (porter) - -2013-08-15 (bug fix)[3610404] reresolve traced forwards (porter) - -2013-08-15 Errors from execution traces become errors of the command (porter) - -2013-08-23 (bug fix)[8ff0cb9] Tcl_NR*Eval*() schedule only, as doc'd (porter) - -2013-08-29 (bug fix)[2486550] enable [interp invokehidden {} yield] (porter) - -2013-09-01 (bug fix)[b98fa55] [binary decode] fail on whitespace (reche,fellows) - -2013-09-07 (bug fix)[86ceb4] have tm path favor first provider (neumann,porter) - -2013-09-09 (bug fix)[3609693] copied object member variable confusion (fellows) -=> TclOO 1.0.1 - -2013-09-17 (bug fix)[2152292] [binary encode uuencode] corrected (fellows) - -2013-09-19 (bug fix)[3487626] segfaults in [dict] compilers (porter) - -2013-09-19 (bug fix)[31661d2] mem leak in [lreplace] (ade,porter) - -Many optmizations, improvements, and tightened stack management in bytecode. - ---- Released 8.6.1, September 20, 2013 --- http://core.tcl.tk/tcl/ for details - -2013-09-27 (enhancement) improved ::env synchronization (fellows) - -2013-10-20 (bug fix)[2835313] segfault from -[apply {{} {while 1 {a {*}[return -level 0 -code continue]}}}] (fellows) - -2013-10-22 (bug fix)[3556215] [scan %E%G%X] support (fellows) - -2013-10-25 (bug fix)[3eb2ec1] upper case scheme names in url. (nijtmans) -=> http 2.8.8 - -2013-10-29 (bug fix)[414d103] HP-UX: restore [exec] in threaded Tcl (nijtmans) - -2013-11-04 (bug fix) C++ friendly stubs struct declarations (nijtmans) - -2013-11-05 (bug fix)[426679e] OpenBSD man page rendering (nijtmans) - -2013-11-12 (bug fix)[5425f2c] [fconfigure -error] breaks [socket -async] - -2013-11-20 (bug fix) Improved environment variable management (nijtmans) -=> tcltest 2.3.7 - -2013-11-21 (platforms) Support for Windows 8.1 (nijtmans) - -2013-12-06 (RFE) improved [foreach] bytecode (fellows) - -2013-12-10 (RFE) improved [lmap] bytecode (sofer) - -2013-12-11 (RFE) improved [catch] bytecode (sofer) - -2013-12-18 (bug fix)[0b874c3] SEGV [coroutine X coroutine Y info frame] (porter) - -2013-12-20 (RFE) reduced numeric conversion in bytecode (sofer) - -2014-01-07 (RFE) compilers for [concat], [linsert], [namespace origin], -[next], [string replace], [string tolower], [string totitle], [string toupper], -[string trim], [string trimleft], [string trimright] (fellows) - -2014-01-22 (RFE) compilers for [nextto], [yieldto] (fellows) - -2014-02-02 (RFE) compiler for [string is] (fellows) - -2014-02-06 (bug fix)[a4494e2] panic in test namespace-13.2 (porter) - -2014-03-20 (bug fix)[2f7cbd0] FreeBSD 10.0 build failure (nijtmans) - -2014-03-26 (RFE)[b42b208] Cygwin: [file attr -readonly -archive -hidden -system] -(nijtmans) - -2014-03-27 (bug fix) segfault iocmd-23.11 (porter) - -2014-04-02 (bug fix)[581937a] Win: readable event on async connect failure - -2014-04-04 (bug fix)[581937a,97069ea] async socket connect fail (oehlmann) - -2014-04-10 (bug fix)[792641f] Win: no \ in normalized path (nijtmans) - -2014-04-11 (bug fix)[3118489] protect NUL in filenames (nijtmans) - -2014-04-15 (bug fix)[88aef05] segfault iocmd-21.20 (porter) - -2014-04-16 (update) Win: use Winsock 2.2 (nijtmans) - -2014-04-16 (bug fix)[d19a30d] segfault clock-67.[23] (sebres) - -2014-04-21 (bug fix) segfault iocmd-21.2[12] (porter) - -2014-04-22 (bug fix) segfault iogt-2.4 (porter) - -2014-04-23 (bug fix)[3493120] memleak in thread exit - -2014-05-08 refactoring of core I/O functions (porter) - -2014-05-09 (bug fix)[3389978] Win: extended paths support (nijtmans) - -2014-05-09 (bug fix) segfault iocmd-32.1 (porter) - -2014-05-11 (bug fix)[6d2f249] nested ensemble compile failure (fellows) - -2014-05-17 (RFE)[47d6625] wideint support in [lsearch -integer] [lsort -integer] (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2014-05-20 (bug fix) Stop eof and blocked state leaking thru stacks (porter) - *** POTENTIAL INCOMPATIBILITY *** - -2014-05-20 (bug fix)[13d3af3] Win: socket -async tried only first IP address - -2014-05-28 (platforms) work around systems that fail when a shared library -is deleted after it is [load]ed (kupries) - -2014-05-31 (bug fix) chan events on pipes must be on proper ends (porter) - -2014-06-04 (bug fix) socket-2.12 (porter) - -2014-06-05 (bug fix) io-12.6 (kupries,porter) - -2014-06-15 (RFE)[1b0266d] [dict replace|remove] return canonical dict (fellows) - *** POTENTIAL INCOMPATIBILITY *** - -2014-06-16 (bug fix) socket-2.13 workaround broken select() (porter) - -2014-06-20 (bug fix)[b47b176] iortrans.tf-11.0 (porter) - -2014-06-22 (RFE)[2f9df4c] -cleanup scripts before -out compare (nijtmans) - -2014-07-04 (update) Update Unicode data to 7.0 (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2014-07-08 (bug) [chan push] converts blocked writes to error (aspect,porter) - -2014-07-10 (bug fix)[7368d2] memleak Tcl_SetVar2(..,TCL_APPEND_VALUE) (porter) - *** POTENTIAL INCOMPATIBILITY *** - -2014-07-11 (bug) leaks in SetFsPathFromAny, [info frame] (porter) - -2014-07-15 (bug) compress dict leak in zlib xform channel close (porter) - -2014-07-17 (bug fix)[9969cf8] leak trace data in coroutine deletion (porter) - -2014-07-18 (RFE)[b43f2b4] fix [lappend] multi performance collapse (fellows) - -2014-07-19 (bug fix)[75b8433] memleak managing oo instance lists (porter) - -2014-07-21 (bug fix)[e6477e1] memleak in AtForkChild() (porter) - -2014-07-22 (bug fix)[12b0997] memleak in iocmd.tf-32.0 (porter) - -2014-07-28 (RFE) Optimized binary [chan copy] by moving buffers (porter) - -2014-07-30 (enhancement) use refcounts, not Tcl_Preserve to manage lifetime -of Tcl_Channel (porter) - *** POTENTIAL INCOMPATIBILITY *** - -2014-07-31 (bug fix)[a84a720] double free in oo chain deletion (porter) - -2014-08-01 (bug fix)[e75faba] SEGV [apply {{} {namespace upvar a b [x]}}] (porter) - -2014-08-01 (update) "macosx*-i386-x86_64" "macosx-universal" no longer compatible (kupries) -=> platform 1.0.13 - -2014-08-12 tzdata updated to Olson's tzdata2014f (kenny) - -2014-08-17 (bug fix)[7d52e11] [info class subclasses oo::object] should -include ::oo::class (fellows) - -2014-08-25 (TIP 429) New command [string cat] (leitgeb,ferrieux) - ---- Released 8.6.2, August 27, 2014 --- http://core.tcl.tk/tcl/ for details - -2014-08-28 (bug)[b9e1a3] Correct Method Search Order (nadkarni,fellows) -=> TclOO 1.0.3 - *** POTENTIAL INCOMPATIBILITY *** - -2014-09-05 (bug)[ccc2c2] Regression [lreplace {} 1 1] (bron,fellows) - -2014-09-08 (bug) Crash regression in [oo::class destroy] (porter) - -2014-09-09 (bug)[84af11] Regress [regsub -all {\(.*} a(b) {}] (fellows) - -2014-09-10 (bug)[cee90e] [try {} on ok {} - on return {} {}] panic (porter) - -2014-09-20 (feature) [tcl::unsupported::getbytecode] disassember (fellows) - -2014-09-27 (enhancement) [string cat] bytecode optimization (leitgeb,ferrieux) - -2014-09-27 (bug)[82521b] segfault in mangled bytecode (ogilvie,sofer) - -2014-10-02 (bug)[bc5b79] Hang in some [read]s of limited size (rogers,porter) - -2014-10-03 (bug)[bc1a96] segfault in [array set] of traced array (tab,porter) - -2014-10-08 (bug)[59a2e7] MSVC14 compile support (dower,nijtmans) - -2014-10-10 (bug)[ed29c4] [fcopy] treats [blocked] as error (rowen,porter) - -2014-10-10 (bug)[bf7135] regression in Tcl_Write() interface (porter) - -2014-10-18 (bug)[10dc6d] fix [gets] on non-blocking channels (fassel,porter) - -2014-10-26 Support for Windows 10 (nijtmans) - -2014-10-31 (bug)[dcc034] restore [open comX: r+] (lll,nijtmans) - -2014-11-05 (bug)[214cc0] Restore [lappend v] return value (sayers,porter) - -2014-11-06 (bug)[5adc35] Stop forcing EOF to be permanent (porter) - ---- Released 8.6.3, November 12, 2014 --- http://core.tcl.tk/tcl/ for details - -2014-11-21 (bug)[743338] Win: socket error encoding (ladayaroslav,nijtmans) - -2014-12-01 (bug) restore tbcload/tclcompiler support (kupries) - -2014-12-03 (bug)[0c043a] Fix compiled [set var($) val] (porter) - -2014-12-04 (bug)[d2ffcc] Limit $... and bareword parsing to ASCII (ladayaroslav,porter) - *** POTENTIAL INCOMPATIBILITY *** - -2014-12-06 (bug)[c6cd4a] Win: hang in async socket connection (shults,nadkarni) - -2014-12-10 tzdata updated to Olson's tzdata2014j (venkat) - -2014-12-13 fix header files installation on OS X (houben) - -2014-12-17 (TIP 427) [fconfigure $h -connecting, -peername, -sockname] (oehlmann,rmax) - -2014-12-18 (bug)[af08c8] Crash in full finalize encoding teardown (porter) - -2014-12-18 (bug)[7c187a] [chan copy] crash (io-53.17) (benno,porter) - -2015-01-26 (bug)[df0848] Trouble with INFINITY macro (dower,nijtmans) - -2015-01-29 (bug) Stop crashes when extension var resolvers misbehave (porter) - -2015-01-29 (bug)[088727] [read] past EOF (io-73.4) (fenugrec,porter) - -2015-02-11 tzdata updated to Olson's tzdata2015a (venkat) - -2015-02-20 (bug)[32b615] Fix compiled [lreplace] (lreplace-4.[345]) (aspect) - -2015-03-10 (enhancement) Revise OS X notifier for better Cocoa (walzer) - *** POTENTIAL INCOMPATIBILITY *** - ---- Released 8.6.4, March 12, 2015 --- http://core.tcl.tk/tcl/ for details - -2015-03-19 (bug)[e66e44] Win: Ctrl-C/Ctrl-Break in console not EOF (nadkarni) - -2015-03-21 (bug)[d87cb1] Proper tailcall from compiled ensembles (sofer) - -2015-04-23 (bug)[19ea02] Win: shared read from linked dirs (bogdan,oehhar) - -2015-04-24 (bug)[879a07] Incomplete chars @ buffer ends (leunissen,porter) - -2015-04-29 (bug)[894da1] Hang flushing blocking channels (yorick) - -2015-05-14 (enhance)[b9d043] Default use of gzip transfer encoding (fellows) -=> http 2.8.9 - *** POTENTIAL INCOMPATIBILITY *** - -2015-05-15 (bug)[9dd1bd] destructor [self] after failed constructor (calvo,fellows) - -2015-05-15 (bug)[0f42ff] [tailcall] combined with [next] (aspect,fellows) - -2015-05-18 (bug)[c11a51] http: race condition in -accept option (fellows) - -2015-05-19 (enhance) More pure lists from compiled [list] (porter,fellows) - -2015-05-27 (enhancement) Relax memdebug constraint on extensions (kupries) - -2015-06-03 (bug)[268b23] crash in traced [expr] (execute-11.2)(tomkinson,porter) - -2015-06-11 (bug)[478c44] Memleak in zlib compresion errors (mistachkin) - -2015-06-16 (bug)[e770d9] Higher baud on serial channels (woods,nijtmans) - -2015-06-18 (update) Update Unicode data to 8.0 (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2015-06-18 (bug)[a4cb3f] compiled [lreplace] handling of end (bron,aspect) - -2015-06-23 (enhance) Use Unicode SendMessageTimeout() (nijtmans) -=> registry 1.3.1 - -2015-06-25 (TIP 412) msgcat dynamic locale change and package private locale (oehlmann) -=> msgcat 1.6.0 - -2015-07-05 (bug)[a0ece9] crash in traced [expr] (execute-11.3) (hans,porter) - -2015-07-10 (TIP 436) [info object isa] favors 'false' over error (fellows) -=> TclOO 1.0.4 - -2015-07-15 (bug)[b1534b][9bad63] writes beyond buffer bounds (hanno,porter) - -2015-07-18 (bug)[a3309d] Memleak in compiled [unset a($i)] (jeff,porter) - -2015-07-23 (bug)[57945b] lock in forking/multi-threading (neumann,mistachkin) - -2015-07-29 (bug)[3e7eca] Allocation overflow in expr parsing (rickyb,porter) - -2015-07-30 (bug)[f00009] Win: Memleak in [file] (rp,sebres) - -2015-07-31 (bug) Correct problems found in Coverity audit (sofer) - -2015-08-19 (bug)[00189c] MSVC 14: semi-static UCRT support (dower,nijtmans) - -2015-08-26 (bug)[0df7a1] Tolerate getcwd() failures (cato,nijtmans) - -2015-09-21 (bug)[1115587][a3c350][d7ea9f][0e0e15][187d7f] Many fixes and -improvements to regexp engine from Postgres (lane,porter,fellows,seltenreich) - -2015-09-23 (enhance) hash lookup microoptimization (hipp) - -2015-09-23 (bug)[e0a7b3] Input buffer draining & file events (griffin,porter) - -2015-09-29 (bug)[219866] Cygwin support error (yorick,nijtmans) -=> platform 1.0.14 - -2015-10-06 (bug)[b42a85] Win: [file normalize ~user] wrong dir (nadkarni) - -2015-10-21 (bug)[1080042][8f2450] More regexp from Postgres (lane,porter) - -2015-10-23 (bug)[4a0c16] [clock] react to msgcat locale change (oehlmann) - -2015-11-10 (bug)[261a8a] Overflow segfault in I/O translation (brooks,porter) - -2015-11-20 (bug)[40f628] ListObjReplace callers fail to detect max (porter) - -2015-11-30 (enhance)[32c574] Improve list growth performance (brooks,porter) - -2015-12-11 (bug)[c9eb6b] tolerate unset ::env(TZ) (gahr, nijtmans) - -2016-01-29 (TIP 440) tcl_platform(engine) -- Tcl implementation (mistachkin) - -2016-02-03 (bug)[25842c] stream [zlib deflate] fails with 0 input (ade,fellows) - -2016-02-04 (bug)[3d96b7][593baa][cf74de] crashes in OO teardown (porter,fellows) - -2016-02-22 (bug)[9b4702] [info exists env(missing)] kills trace (nijtmans) - ---- Released 8.6.5, February 29, 2016 --- http://core.tcl.tk/tcl/ for details - -2016-03-01 (bug)[803042] mem leak due to reference cycle (porter) - -2016-03-08 (bug)[bbc304] reflected watch race condition (porter) - -2016-03-17 (bug)[fadc99] compile-5.3 (rodriguez,porter) - -2016-03-17 (enhancement)[1a25fd] compile [variable ${ns}::v] (porter) - -2016-03-20 (bug)[1af8de] crash in compiled [string replace] (harder,fellows) - -2016-03-21 (bug)[d30718] segv in notifier finalize (hirofumi,nijtmans) - -2016-03-23 (enhancement)[7d0db7] parallel make (yarda,nijtmans) - -2016-03-23 [f12535] enable test bindings customization (vogel,nijtmans) - -2016-04-04 (bug)[47ac84] compiled [lreplace] fixes (aspect,ferrieux,fellows) - *** POTENTIAL INCOMPATIBILITY *** - -2016-04-08 (bug)[866368] RE \w includes 'Punctuation Connector' (nijtmans) - -2016-04-08 (bug)[2538f3] Win crash Tcl_OpenTcpServer() (griffin) - -2016-04-10 [07d13d] Restore TclBlend support lost in 8.6.1 (buratti) - -2016-05-13 (bug)[3154ea] Mem corruption in assembler exceptions (tkob,kenny) - -2016-05-13 (bug) registry package support any Unicode env (nijtmans) -=> registry 1.3.2 - -2016-05-21 (bug)[f7d4e] [namespace delete] performance (fellows) - -2016-06-02 (TIP 447) execution time verbosity option (gahr) -=> tcltest 2.4.0 - -2016-06-16 (bug)[16828b] crash due to [vwait] trace undo fail (dah,porter) - -2016-06-16 (enhancement)[4b61af] good [info frame] from more cases (beric) - -2016-06-21 (bug)[c383eb] crash in [glob -path a] (oehlmann,porter) - -2016-06-21 (update) Update Unicode data to 9.0 (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2016-06-22 (bug)[16896d] Tcl_DString tolerate append to self. (dah,porter) - -2016-06-23 (bug)[d55322] crash in [dict update] (yorick,fellows) - -2016-06-27 (bug)[dd260a] crash in [chan configure -dictionary] (madden,aspect) - -2016-07-02 (bug)[f961d7] usage message with parameters with spaces (porter) - *** POTENTIAL INCOMPATIBILITY *** - -2016-07-02 (enhancement)[09fabc] Sort order of -relateddir (lanam) - -2016-07-07 (bug)[5d7ca0] Win: [file executable] for .cmd and .ps1 (nadkarni) - *** POTENTIAL INCOMPATIBILITY *** - -2016-07-08 (bug)[a47641] [file normalize] & Windows junctions (nadkarni) - -2016-07-09 [ae61a6] [file] handling of Win hardcoded names (CON) (nadkarni) - *** POTENTIAL INCOMPATIBILITY *** - -2016-07-09 [3613671] [file owned] (more) useful on Win (nadkarni) - -2016-07-09 (bug)[1493a4] [namespace upvar] use of resolvers (beric,fellows) - *** POTENTIAL INCOMPATIBILITY *** - -2016-07-10 (bug)[da340d] integer division in clock math (nadkarni) - -2016-07-20 tzdata updated to Olson's tzdata2016f (venkat) - ---- Released 8.6.6, July 27, 2016 --- http://core.tcl.tk/tcl/ for details - -2016-09-07 (bug)[c09edf] Bad caching with custom resolver (neumann,nijtmans) - -2016-09-07 (bug)[4dbdd9] Memleak in test var-8.3 (mr_calvin,porter) - -2016-10-03 (bug)[2bf561] Allow empty command as alias target (yorick,nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2016-10-04 (bug)[4d5ae7] Crash in async connects host no address (gahr,fellows) - -2016-10-08 (bug)[838e99] treat application/xml as text (gahr,fellows) -=> http 2.8.10 - -2016-10-11 (bug)[3cc1d9] Thread finalization crash in zippy (neumann) - -2016-10-12 (bug)[be003d] Fix [scan 0x1 %b], [scan 0x1 %o] (porter) - -2016-10-14 (bug)[eb6b68] Fix stringComp-14.5 (porter) - -2016-10-30 (bug)[b26e38] Fix zlib-7.8 (fellows) - -2016-10-30 (bug)[1ae129] Fix memleak in [history] destruction (fellows) - -2016-11-04 (feature) Provisional Tcl 9 support in msgcat and tcltest (nijtmans) -=> msgcat 1.6.1 -=> tcltest 2.4.1 - -2016-11-04 (bug)[824752] Crash in Tcl_ListObjReplace() (gahr,porter) - -2016-11-11 (bug)[79614f] invalidate VFS mounts on sytem encoding change (yorick) - -2016-11-14 OSX: End panic() as legacy support macro; system conflicts (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2016-11-15 (bug) TclOO fix stops crash mixing Itcl and snit (fellows) - -2016-11-17 (update) Reconcile libtommath updates; purge unused files (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2017-01-09 (bug)[b87ad7] Repair drifts in timer clock (sebres) - -2017-01-17 (update) => zlib 1.2.11 (nijtmans) - -2017-01-31 (bug)[39f630] Revise Tcl_LinkVar to tolerate some prefixes (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2017-02-01 (bug)[d0f7ba] Improper NAN optimization. expr-22.1[01] (aspect) - -2017-02-26 (bug)[25842c] zlib stream finalization (aspect) - -2017-03-07 (deprecate) Remove unmaintained makefile.bc file (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2017-03-14 (enhancement) [clock] and [encoding] are now ensembles (kenny) - -2017-03-15 (enhancement) several [clock] subcommands bytecoded (kenny) - -2017-03-23 tzdata updated to Olson's tzdata2017b (jima) - -2017-03-29 (bug)[900cb0] Fix OO unexport introspection (napier) - -2017-04-12 (bug)[42202b] Nesting imbalance in coro injection (nadkarni,sebres) - -2017-04-18 (bug)[bc4322] http package support for safe interps (nash,nijtmans) - -2017-04-28 (bug)[f34cf8] [file join a //b] => /b (neumann,porter) - -2017-05-01 (bug)[8bd13f] Windows threads and pipes (sebres,nijtmans) - -2017-05-01 (bug)[f9fe90] [file join //a b] EIAS violation (aspect,porter) - -2017-05-04 (bug) Make test filesystem-1.52 pass on Windows (nijtmans) - -2017-05-05 (bug)[601522] [binary] field spec overflow -> segfault (porter) - -2017-05-08 (bug)[6ca52a] http memleak handling keep-alive (aspect,nijtmans) -=> http 2.8.11 - -2017-05-29 (bug)[a3fb33] crash in [lsort] on long lists (sebres) - -2017-06-05 (bug)[67aa9a] Tcl_UtfToUniChar() revised handling invalid UTF-8 (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2017-06-08 (bug)[2738427] Tcl_NumUtfChars() corner case utf-4.9 (nijtmans) - -2017-06-22 (update) Update Unicode data to 10.0 (nijtmans) - *** POTENTIAL INCOMPATIBILITY *** - -2017-06-22 (TIP 473) Let [oo::copy] specify target namespace (fellows) - -2017-06-26 (bug)[46f801] Repair autoloader fragility (porter) - -2017-07-06 (bug)[adb198] Plug memleak in TclJoinPath (sebres,porter) - -2017-07-17 (bug)[fb2208] Repeatable tclIndex generation (wiedemann,nijtmans) - ---- Released 8.6.7, August 9, 2017 --- http://core.tcl.tk/tcl/ for details - -2016-03-17 (bug)[0b8c38] socket accept callbacks always in global ns (porter) - *** POTENTIAL INCOMPATIBILITY *** - -2016-07-01 Hack accommodations for legacy Itcl 3 disabled (porter) - -2016-07-12 Make TCL_HASH_TYPE build-time configurable (nijtmans) - -2016-07-19 (bug)[0363f0] Partial array search ID reform (porter) - -2016-07-19 (feature removed) Tcl_ObjType "array search" unregistered (porter) - *** POTENTIAL INCOMPATIBILITY for Tcl_GetObjType("array search") *** - -2016-10-04 Server socket on port 0 chooses port supporting IPv4 * IPv6 (max) - -2016-11-25 [array named -regexp] supports backrefs (goth) - -2017-01-04 (TIP 456) New routine Tcl_OpenTcpServerEx() (limeboy) - -2017-01-04 (TIP 459) New subcommand [package files] (nijtmans) - -2017-01-16 threaded allocator initialization repair (vasiljevic,nijtmans) - -2017-01-30 Add to Win shell builtins: assoc ftype move (ashok) - -2017-03-31 TCL_MEM_DEBUG facilities better support 64-bit memory (nijtmans) - -2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans) - -2017-05-18 (TIP 458) New epoll or kqueue notifiers are default (alborboz) - -2017-05-31 Purge build support for SunOS-4.* (stu) - -2017-06-22 (TIP 463) New option [regsub ... -command ...] (fellows) - -2017-06-22 (TIP 470) Tcl_GetDefineContextObject();[oo::define [self]] (fellows) -=> TclOO 1.2.0 - -2017-06-23 (TIP 472) Support 0d as prefix of decimal numbers (iyer,griffin) - -2017-08-31 (bug)[2a9465] http state 100 continue handling broken (oehlmann) -=> http 2.8.12 - -2017-09-02 (bug)[0e4d88] replace command, delete trace kills namespace (porter) - ---- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tcl/ for details diff --git a/compat/README b/compat/README deleted file mode 100644 index 9af4285..0000000 --- a/compat/README +++ /dev/null @@ -1,6 +0,0 @@ -This directory contains various header and code files that are -used make Tcl compatible with various releases of UNIX and UNIX-like -systems. Typically, files from this directory are used to compile -Tcl when a system doesn't contain the corresponding files or when -they are known to be incorrect. When the whole world becomes POSIX- -compliant this directory should be unnecessary. diff --git a/compat/dirent.h b/compat/dirent.h deleted file mode 100644 index fa6222a..0000000 --- a/compat/dirent.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * dirent.h -- - * - * This file is a replacement for in systems that - * support the old BSD-style with a "struct direct". - * - * Copyright (c) 1991 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. - */ - -#ifndef _DIRENT -#define _DIRENT - -#include - -#define dirent direct - -#endif /* _DIRENT */ diff --git a/compat/dirent2.h b/compat/dirent2.h deleted file mode 100644 index 5be08ba..0000000 --- a/compat/dirent2.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * dirent.h -- - * - * Declarations of a library of directory-reading procedures - * in the POSIX style ("struct dirent"). - * - * Copyright (c) 1991 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. - */ - -#ifndef _DIRENT -#define _DIRENT - -/* - * Dirent structure, which holds information about a single - * directory entry. - */ - -#define MAXNAMLEN 255 -#define DIRBLKSIZ 512 - -struct dirent { - long d_ino; /* Inode number of entry */ - short d_reclen; /* Length of this record */ - short d_namlen; /* Length of string in d_name */ - char d_name[MAXNAMLEN + 1]; /* Name must be no longer than this */ -}; - -/* - * State that keeps track of the reading of a directory (clients - * should never look inside this structure; the fields should - * only be accessed by the library procedures). - */ - -typedef struct _dirdesc { - int dd_fd; - long dd_loc; - long dd_size; - char dd_buf[DIRBLKSIZ]; -} DIR; - -/* - * Procedures defined for reading directories: - */ - -extern void closedir (DIR *dirp); -extern DIR * opendir (char *name); -extern struct dirent * readdir (DIR *dirp); - -#endif /* _DIRENT */ diff --git a/compat/dlfcn.h b/compat/dlfcn.h deleted file mode 100644 index fb27ea0..0000000 --- a/compat/dlfcn.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * dlfcn.h -- - * - * This file provides a replacement for the header file "dlfcn.h" - * on systems where dlfcn.h is missing. It's primary use is for - * AIX, where Tcl emulates the dl library. - * - * This file is subject to the following copyright notice, which is - * different from the notice used elsewhere in Tcl but rougly - * equivalent in meaning. - * - * Copyright (c) 1992,1993,1995,1996, Jens-Uwe Mager, Helios Software GmbH - * Not derived from licensed software. - * - * Permission is granted to freely use, copy, modify, and redistribute - * this software, provided that the author is not construed to be liable - * for any results of using the software, alterations are clearly marked - * as such, and this notice is not modified. - */ - -/* - * This is an unpublished work copyright (c) 1992 HELIOS Software GmbH - * 30159 Hannover, Germany - */ - -#ifndef __dlfcn_h__ -#define __dlfcn_h__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Mode flags for the dlopen routine. - */ -#define RTLD_LAZY 1 /* lazy function call binding */ -#define RTLD_NOW 2 /* immediate function call binding */ -#define RTLD_GLOBAL 0x100 /* allow symbols to be global */ - -/* - * To be able to intialize, a library may provide a dl_info structure - * that contains functions to be called to initialize and terminate. - */ -struct dl_info { - void (*init) (void); - void (*fini) (void); -}; - -void *dlopen (const char *path, int mode); -void *dlsym (void *handle, const char *symbol); -char *dlerror (void); -int dlclose (void *handle); - -#ifdef __cplusplus -} -#endif - -#endif /* __dlfcn_h__ */ diff --git a/compat/fake-rfc2553.c b/compat/fake-rfc2553.c deleted file mode 100644 index c8e69400..0000000 --- a/compat/fake-rfc2553.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (C) 2000-2003 Damien Miller. All rights reserved. - * Copyright (C) 1999 WIDE Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Pseudo-implementation of RFC2553 name / address resolution functions - * - * But these functions are not implemented correctly. The minimum subset - * is implemented for ssh use only. For example, this routine assumes - * that ai_family is AF_INET. Don't use it for another purpose. - */ -#include "tclInt.h" - -TCL_DECLARE_MUTEX(netdbMutex) - -#ifndef HAVE_GETNAMEINFO -#ifndef HAVE_STRLCPY -static size_t -strlcpy(char *dst, const char *src, size_t siz) -{ - char *d = dst; - const char *s = src; - size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - return(s - src - 1); /* count does not include NUL */ -} -#endif - -int fake_getnameinfo(const struct sockaddr *sa, size_t salen, char *host, - size_t hostlen, char *serv, size_t servlen, int flags) -{ - struct sockaddr_in *sin = (struct sockaddr_in *)sa; - struct hostent *hp; - char tmpserv[16]; - - if (sa->sa_family != AF_UNSPEC && sa->sa_family != AF_INET) - return (EAI_FAMILY); - if (serv != NULL) { - snprintf(tmpserv, sizeof(tmpserv), "%d", ntohs(sin->sin_port)); - if (strlcpy(serv, tmpserv, servlen) >= servlen) - return (EAI_MEMORY); - } - - if (host != NULL) { - if (flags & NI_NUMERICHOST) { - size_t len; - Tcl_MutexLock(&netdbMutex); - len = strlcpy(host, inet_ntoa(sin->sin_addr), hostlen); - Tcl_MutexUnlock(&netdbMutex); - if (len >= hostlen) { - return (EAI_MEMORY); - } else { - return (0); - } - } else { - int ret; - Tcl_MutexLock(&netdbMutex); - hp = gethostbyaddr((char *)&sin->sin_addr, - sizeof(struct in_addr), AF_INET); - if (hp == NULL) { - ret = EAI_NODATA; - } else if (strlcpy(host, hp->h_name, hostlen) - >= hostlen) { - ret = EAI_MEMORY; - } else { - ret = 0; - } - Tcl_MutexUnlock(&netdbMutex); - return ret; - } - } - return (0); -} -#endif /* !HAVE_GETNAMEINFO */ - -#ifndef HAVE_GAI_STRERROR -const char * -fake_gai_strerror(int err) -{ - switch (err) { - case EAI_NODATA: - return ("no address associated with name"); - case EAI_MEMORY: - return ("memory allocation failure."); - case EAI_NONAME: - return ("nodename nor servname provided, or not known"); - case EAI_FAMILY: - return ("ai_family not supported"); - default: - return ("unknown/invalid error."); - } -} -#endif /* !HAVE_GAI_STRERROR */ - -#ifndef HAVE_FREEADDRINFO -void -fake_freeaddrinfo(struct addrinfo *ai) -{ - struct addrinfo *next; - - for(; ai != NULL;) { - next = ai->ai_next; - free(ai); - ai = next; - } -} -#endif /* !HAVE_FREEADDRINFO */ - -#ifndef HAVE_GETADDRINFO -static struct -addrinfo *malloc_ai(int port, u_long addr, const struct addrinfo *hints) -{ - struct addrinfo *ai; - - ai = malloc(sizeof(*ai) + sizeof(struct sockaddr_in)); - if (ai == NULL) - return (NULL); - - memset(ai, '\0', sizeof(*ai) + sizeof(struct sockaddr_in)); - - ai->ai_addr = (struct sockaddr *)(ai + 1); - /* XXX -- ssh doesn't use sa_len */ - ai->ai_addrlen = sizeof(struct sockaddr_in); - ai->ai_addr->sa_family = ai->ai_family = AF_INET; - - ((struct sockaddr_in *)(ai)->ai_addr)->sin_port = port; - ((struct sockaddr_in *)(ai)->ai_addr)->sin_addr.s_addr = addr; - - /* XXX: the following is not generally correct, but does what we want */ - if (hints->ai_socktype) - ai->ai_socktype = hints->ai_socktype; - else - ai->ai_socktype = SOCK_STREAM; - - if (hints->ai_protocol) - ai->ai_protocol = hints->ai_protocol; - - return (ai); -} - -int -fake_getaddrinfo(const char *hostname, const char *servname, - const struct addrinfo *hints, struct addrinfo **res) -{ - struct hostent *hp; - struct servent *sp; - struct in_addr in; - int i; - long int port; - u_long addr; - - port = 0; - if (hints && hints->ai_family != AF_UNSPEC && - hints->ai_family != AF_INET) - return (EAI_FAMILY); - if (servname != NULL) { - char *cp; - - port = strtol(servname, &cp, 10); - if (port > 0 && port <= 65535 && *cp == '\0') - port = htons((unsigned short)port); - else if ((sp = getservbyname(servname, NULL)) != NULL) - port = sp->s_port; - else - port = 0; - } - - if (hints && hints->ai_flags & AI_PASSIVE) { - addr = htonl(0x00000000); - if (hostname && inet_aton(hostname, &in) != 0) - addr = in.s_addr; - *res = malloc_ai(port, addr, hints); - if (*res == NULL) - return (EAI_MEMORY); - return (0); - } - - if (!hostname) { - *res = malloc_ai(port, htonl(0x7f000001), hints); - if (*res == NULL) - return (EAI_MEMORY); - return (0); - } - - if (inet_aton(hostname, &in)) { - *res = malloc_ai(port, in.s_addr, hints); - if (*res == NULL) - return (EAI_MEMORY); - return (0); - } - - /* Don't try DNS if AI_NUMERICHOST is set */ - if (hints && hints->ai_flags & AI_NUMERICHOST) - return (EAI_NONAME); - - Tcl_MutexLock(&netdbMutex); - hp = gethostbyname(hostname); - if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { - struct addrinfo *cur, *prev; - - cur = prev = *res = NULL; - for (i = 0; hp->h_addr_list[i]; i++) { - struct in_addr *in = (struct in_addr *)hp->h_addr_list[i]; - - cur = malloc_ai(port, in->s_addr, hints); - if (cur == NULL) { - if (*res != NULL) - freeaddrinfo(*res); - Tcl_MutexUnlock(&netdbMutex); - return (EAI_MEMORY); - } - if (prev) - prev->ai_next = cur; - else - *res = cur; - - prev = cur; - } - Tcl_MutexUnlock(&netdbMutex); - return (0); - } - Tcl_MutexUnlock(&netdbMutex); - return (EAI_NODATA); -} -#endif /* !HAVE_GETADDRINFO */ diff --git a/compat/fake-rfc2553.h b/compat/fake-rfc2553.h deleted file mode 100644 index 6413170..0000000 --- a/compat/fake-rfc2553.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2000-2003 Damien Miller. All rights reserved. - * Copyright (C) 1999 WIDE Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Pseudo-implementation of RFC2553 name / address resolution functions - * - * But these functions are not implemented correctly. The minimum subset - * is implemented for ssh use only. For example, this routine assumes - * that ai_family is AF_INET. Don't use it for another purpose. - */ - -#ifndef _FAKE_RFC2553_H -#define _FAKE_RFC2553_H - -/* - * First, socket and INET6 related definitions - */ -#ifndef HAVE_STRUCT_SOCKADDR_STORAGE -# define _SS_MAXSIZE 128 /* Implementation specific max size */ -# define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) -struct sockaddr_storage { - struct sockaddr ss_sa; - char __ss_pad2[_SS_PADSIZE]; -}; -# define ss_family ss_sa.sa_family -#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ - -#ifndef IN6_IS_ADDR_LOOPBACK -# define IN6_IS_ADDR_LOOPBACK(a) \ - (((uint32_t *)(a))[0] == 0 && ((uint32_t *)(a))[1] == 0 && \ - ((uint32_t *)(a))[2] == 0 && ((uint32_t *)(a))[3] == htonl(1)) -#endif /* !IN6_IS_ADDR_LOOPBACK */ - -#ifndef HAVE_STRUCT_IN6_ADDR -struct in6_addr { - uint8_t s6_addr[16]; -}; -#endif /* !HAVE_STRUCT_IN6_ADDR */ - -#ifndef HAVE_STRUCT_SOCKADDR_IN6 -struct sockaddr_in6 { - unsigned short sin6_family; - uint16_t sin6_port; - uint32_t sin6_flowinfo; - struct in6_addr sin6_addr; - uint32_t sin6_scope_id; -}; -#endif /* !HAVE_STRUCT_SOCKADDR_IN6 */ - -#ifndef AF_INET6 -/* Define it to something that should never appear */ -#define AF_INET6 AF_MAX -#endif - -/* - * Next, RFC2553 name / address resolution API - */ - -#ifndef NI_NUMERICHOST -# define NI_NUMERICHOST (1) -#endif -#ifndef NI_NAMEREQD -# define NI_NAMEREQD (1<<1) -#endif -#ifndef NI_NUMERICSERV -# define NI_NUMERICSERV (1<<2) -#endif - -#ifndef AI_PASSIVE -# define AI_PASSIVE (1) -#endif -#ifndef AI_CANONNAME -# define AI_CANONNAME (1<<1) -#endif -#ifndef AI_NUMERICHOST -# define AI_NUMERICHOST (1<<2) -#endif - -#ifndef NI_MAXSERV -# define NI_MAXSERV 32 -#endif /* !NI_MAXSERV */ -#ifndef NI_MAXHOST -# define NI_MAXHOST 1025 -#endif /* !NI_MAXHOST */ - -#ifndef EAI_NODATA -# define EAI_NODATA (INT_MAX - 1) -#endif -#ifndef EAI_MEMORY -# define EAI_MEMORY (INT_MAX - 2) -#endif -#ifndef EAI_NONAME -# define EAI_NONAME (INT_MAX - 3) -#endif -#ifndef EAI_SYSTEM -# define EAI_SYSTEM (INT_MAX - 4) -#endif -#ifndef EAI_FAMILY -# define EAI_FAMILY (INT_MAX - 5) -#endif -#ifndef EAI_SERVICE -# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ -#endif - -#ifndef HAVE_STRUCT_ADDRINFO -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for hostname */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ -}; -#endif /* !HAVE_STRUCT_ADDRINFO */ - -#ifndef HAVE_GETADDRINFO -#ifdef getaddrinfo -# undef getaddrinfo -#endif -#define getaddrinfo(a,b,c,d) (fake_getaddrinfo(a,b,c,d)) -int getaddrinfo(const char *, const char *, - const struct addrinfo *, struct addrinfo **); -#endif /* !HAVE_GETADDRINFO */ - -#ifndef HAVE_GAI_STRERROR -#define gai_strerror(a) (fake_gai_strerror(a)) -const char *gai_strerror(int); -#endif /* !HAVE_GAI_STRERROR */ - -#ifndef HAVE_FREEADDRINFO -#define freeaddrinfo(a) (fake_freeaddrinfo(a)) -void freeaddrinfo(struct addrinfo *); -#endif /* !HAVE_FREEADDRINFO */ - -#ifndef HAVE_GETNAMEINFO -#define getnameinfo(a,b,c,d,e,f,g) (fake_getnameinfo(a,b,c,d,e,f,g)) -int getnameinfo(const struct sockaddr *, size_t, char *, size_t, - char *, size_t, int); -#endif /* !HAVE_GETNAMEINFO */ - - -#endif /* !_FAKE_RFC2553_H */ diff --git a/compat/fixstrtod.c b/compat/fixstrtod.c deleted file mode 100644 index 63fb8ef..0000000 --- a/compat/fixstrtod.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * fixstrtod.c -- - * - * Source code for the "fixstrtod" procedure. This procedure is - * used in place of strtod under Solaris 2.4, in order to fix - * a bug where the "end" pointer gets set incorrectly. - * - * 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. - */ - -#include - -#undef strtod - -/* - * Declare strtod explicitly rather than including stdlib.h, since in - * somes systems (e.g. SunOS 4.1.4) stdlib.h doesn't declare strtod. - */ - -extern double strtod(char *, char **); - -double -fixstrtod( - char *string, - char **endPtr) -{ - double d; - d = strtod(string, endPtr); - if ((endPtr != NULL) && (*endPtr != string) && ((*endPtr)[-1] == 0)) { - *endPtr -= 1; - } - return d; -} diff --git a/compat/gettod.c b/compat/gettod.c deleted file mode 100644 index ca20cf8..0000000 --- a/compat/gettod.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * gettod.c -- - * - * This file provides the gettimeofday function on systems - * that only have the System V ftime function. - * - * 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. - */ - -#include "tclPort.h" -#include - -#undef timezone - -int -gettimeofday( - struct timeval *tp, - struct timezone *tz) -{ - struct timeb t; - - ftime(&t); - tp->tv_sec = t.time; - tp->tv_usec = t. millitm * 1000; - return 0; -} - diff --git a/compat/memcmp.c b/compat/memcmp.c deleted file mode 100644 index c4e25a8..0000000 --- a/compat/memcmp.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * memcmp.c -- - * - * Source code for the "memcmp" library routine. - * - * 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. - */ - -#include "tclPort.h" - -/* - * Here is the prototype just in case it is not included in tclPort.h. - */ - -int memcmp(const void *s1, const void *s2, size_t n); - -/* - *---------------------------------------------------------------------- - * - * memcmp -- - * - * Compares two bytes sequences. - * - * Results: - * Compares its arguments, looking at the first n bytes (each interpreted - * as an unsigned char), and returns an integer less than, equal to, or - * greater than 0, according as s1 is less than, equal to, or greater - * than s2 when taken to be unsigned 8 bit numbers. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -memcmp( - const void *s1, /* First string. */ - const void *s2, /* Second string. */ - size_t n) /* Length to compare. */ -{ - const unsigned char *ptr1 = (const unsigned char *) s1; - const unsigned char *ptr2 = (const unsigned char *) s2; - - for ( ; n-- ; ptr1++, ptr2++) { - unsigned char u1 = *ptr1, u2 = *ptr2; - - if (u1 != u2) { - return (u1-u2); - } - } - return 0; -} - -/* - * Local Variables: - * mode: c - * c-basic-offset: 4 - * fill-column: 78 - * End: - */ diff --git a/compat/mkstemp.c b/compat/mkstemp.c deleted file mode 100644 index 1a44dfa..0000000 --- a/compat/mkstemp.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * mkstemp.c -- - * - * Source code for the "mkstemp" library routine. - * - * Copyright (c) 2009 Donal K. Fellows - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ - -#include -#include -#include -#include - -/* - *---------------------------------------------------------------------- - * - * mkstemp -- - * - * Create an open temporary file from a template. - * - * Results: - * A file descriptor, or -1 (with errno set) in the case of an error. - * - * Side effects: - * The template is updated to contain the real filename. - * - *---------------------------------------------------------------------- - */ - -int -mkstemp( - char *template) /* Template for filename. */ -{ - static const char alphanumerics[] = - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - register char *a, *b; - int fd, count, alphanumericsLen = strlen(alphanumerics); /* == 62 */ - - a = template + strlen(template); - while (a > template && *(a-1) == 'X') { - a--; - } - - if (a == template) { - errno = ENOENT; - return -1; - } - - /* - * We'll only try up to 10 times; after that, we're suffering from enemy - * action and should let the caller know. - */ - - count = 10; - do { - /* - * Replace the X's in the original template with random alphanumeric - * digits. - */ - - for (b=a ; *b ; b++) { - float r = rand() / ((float) RAND_MAX); - - *b = alphanumerics[(int)(r * alphanumericsLen)]; - } - - /* - * Template is now realized; try to open (with correct options). - */ - - fd = open(template, O_RDWR|O_CREAT|O_EXCL, 0600); - } while (fd == -1 && errno == EEXIST && --count > 0); - - return fd; -} diff --git a/compat/opendir.c b/compat/opendir.c deleted file mode 100644 index 7a49566..0000000 --- a/compat/opendir.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * opendir.c -- - * - * This file provides dirent-style directory-reading procedures for V7 - * Unix systems that don't have such procedures. The origin of this code - * is unclear, but it seems to have come originally from Larry Wall. - */ - -#include "tclInt.h" - -#undef DIRSIZ -#define DIRSIZ(dp) \ - ((sizeof(struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) - -/* - * open a directory. - */ - -DIR * -opendir( - char *name) -{ - register DIR *dirp; - register int fd; - char *myname; - - myname = ((*name == '\0') ? "." : name); - if ((fd = open(myname, 0, 0)) == -1) { - return NULL; - } - dirp = (DIR *) ckalloc(sizeof(DIR)); - if (dirp == NULL) { - /* unreachable? */ - close(fd); - return NULL; - } - dirp->dd_fd = fd; - dirp->dd_loc = 0; - return dirp; -} - -/* - * read an old style directory entry and present it as a new one - */ -#ifndef pyr -#define ODIRSIZ 14 - -struct olddirect { - ino_t od_ino; - char od_name[ODIRSIZ]; -}; -#else /* a Pyramid in the ATT universe */ -#define ODIRSIZ 248 - -struct olddirect { - long od_ino; - short od_fill1, od_fill2; - char od_name[ODIRSIZ]; -}; -#endif - -/* - * get next entry in a directory. - */ - -struct dirent * -readdir( - register DIR *dirp) -{ - register struct olddirect *dp; - static struct dirent dir; - - for (;;) { - if (dirp->dd_loc == 0) { - dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ); - if (dirp->dd_size <= 0) { - return NULL; - } - } - if (dirp->dd_loc >= dirp->dd_size) { - dirp->dd_loc = 0; - continue; - } - dp = (struct olddirect *)(dirp->dd_buf + dirp->dd_loc); - dirp->dd_loc += sizeof(struct olddirect); - if (dp->od_ino == 0) { - continue; - } - dir.d_ino = dp->od_ino; - strncpy(dir.d_name, dp->od_name, ODIRSIZ); - dir.d_name[ODIRSIZ] = '\0'; /* insure null termination */ - dir.d_namlen = strlen(dir.d_name); - dir.d_reclen = DIRSIZ(&dir); - return &dir; - } -} - -/* - * close a directory. - */ - -void -closedir( - register DIR *dirp) -{ - close(dirp->dd_fd); - dirp->dd_fd = -1; - dirp->dd_loc = 0; - ckfree(dirp); -} diff --git a/compat/stdlib.h b/compat/stdlib.h deleted file mode 100644 index 0ad4c1d..0000000 --- a/compat/stdlib.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * stdlib.h -- - * - * Declares facilities exported by the "stdlib" portion of the C library. - * This file isn't complete in the ANSI-C sense; it only declares things - * that are needed by Tcl. This file is needed even on many systems with - * their own stdlib.h (e.g. SunOS) because not all stdlib.h files declare - * all the procedures needed here (such as strtod). - * - * Copyright (c) 1991 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. - */ - -#ifndef _STDLIB -#define _STDLIB - -extern void abort(void); -extern double atof(const char *string); -extern int atoi(const char *string); -extern long atol(const char *string); -extern char * calloc(unsigned int numElements, unsigned int size); -extern void exit(int status); -extern int free(char *blockPtr); -extern char * getenv(const char *name); -extern char * malloc(unsigned int numBytes); -extern void qsort(void *base, int n, int size, int (*compar)( - const void *element1, const void *element2)); -extern char * realloc(char *ptr, unsigned int numBytes); -extern double strtod(const char *string, char **endPtr); -extern long strtol(const char *string, char **endPtr, int base); -extern unsigned long strtoul(const char *string, char **endPtr, int base); - -#endif /* _STDLIB */ diff --git a/compat/string.h b/compat/string.h deleted file mode 100644 index 42be10c..0000000 --- a/compat/string.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ - -#ifndef _STRING -#define _STRING - -/* - * 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 - -#ifdef __APPLE__ -extern void * memchr(const void *s, int c, size_t n); -#else -extern char * memchr(const void *s, int c, size_t n); -#endif -extern int memcmp(const void *s1, const void *s2, size_t n); -extern char * memcpy(void *t, const void *f, size_t n); -#ifdef NO_MEMMOVE -#define memmove(d,s,n) (bcopy((s), (d), (n))) -#else -extern char * memmove(void *t, const void *f, size_t n); -#endif -extern char * memset(void *s, int c, size_t n); - -extern int strcasecmp(const char *s1, const char *s2); -extern char * strcat(char *dst, const char *src); -extern char * strchr(const char *string, int c); -extern int strcmp(const char *s1, const char *s2); -extern char * strcpy(char *dst, const char *src); -extern size_t strcspn(const char *string, const char *chars); -extern char * strdup(const char *string); -extern char * strerror(int error); -extern size_t strlen(const char *string); -extern int strncasecmp(const char *s1, const char *s2, size_t n); -extern char * strncat(char *dst, const char *src, size_t numChars); -extern int strncmp(const char *s1, const char *s2, size_t nChars); -extern char * strncpy(char *dst, const char *src, size_t numChars); -extern char * strpbrk(const char *string, const char *chars); -extern char * strrchr(const char *string, int c); -extern size_t strspn(const char *string, const char *chars); -extern char * strstr(const char *string, const char *substring); -extern char * strtok(char *s, const char *delim); - -#endif /* _STRING */ diff --git a/compat/strncasecmp.c b/compat/strncasecmp.c deleted file mode 100644 index 0a69f35..0000000 --- a/compat/strncasecmp.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * strncasecmp.c -- - * - * Source code for the "strncasecmp" library routine. - * - * Copyright (c) 1988-1993 The Regents of the University of California. - * 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. - */ - -#include "tclPort.h" - -/* - * This array is designed for mapping upper and lower case letter together for - * a case independent comparison. The mappings are based upon ASCII character - * sequences. - */ - -static const unsigned char charmap[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, - 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, - 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, - 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, - 0xc0, 0xe1, 0xe2, 0xe3, 0xe4, 0xc5, 0xe6, 0xe7, - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, -}; - -/* - * Here are the prototypes just in case they are not included in tclPort.h. - */ - -int strncasecmp(const char *s1, const char *s2, size_t n); -int strcasecmp(const char *s1, const char *s2); - -/* - *---------------------------------------------------------------------- - * - * strcasecmp -- - * - * Compares two strings, ignoring case differences. - * - * Results: - * Compares two null-terminated strings s1 and s2, returning -1, 0, or 1 - * if s1 is lexicographically less than, equal to, or greater than s2. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -strcasecmp( - const char *s1, /* First string. */ - const char *s2) /* Second string. */ -{ - unsigned char u1, u2; - - for ( ; ; s1++, s2++) { - u1 = (unsigned char) *s1; - u2 = (unsigned char) *s2; - if ((u1 == '\0') || (charmap[u1] != charmap[u2])) { - break; - } - } - return charmap[u1] - charmap[u2]; -} - -/* - *---------------------------------------------------------------------- - * - * strncasecmp -- - * - * Compares two strings, ignoring case differences. - * - * Results: - * Compares up to length chars of s1 and s2, returning -1, 0, or 1 if s1 - * is lexicographically less than, equal to, or greater than s2 over - * those characters. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -strncasecmp( - const char *s1, /* First string. */ - const char *s2, /* Second string. */ - size_t length) /* Maximum number of characters to compare - * (stop earlier if the end of either string - * is reached). */ -{ - unsigned char u1, u2; - - for (; length != 0; length--, s1++, s2++) { - u1 = (unsigned char) *s1; - u2 = (unsigned char) *s2; - if (charmap[u1] != charmap[u2]) { - return charmap[u1] - charmap[u2]; - } - if (u1 == '\0') { - return 0; - } - } - return 0; -} diff --git a/compat/strstr.c b/compat/strstr.c deleted file mode 100644 index e3b9b8d..0000000 --- a/compat/strstr.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#include "tcl.h" -#ifndef NULL -#define NULL 0 -#endif - -/* - *---------------------------------------------------------------------- - * - * strstr -- - * - * Locate the first instance of a substring in a string. - * - * Results: - * If string contains substring, the return value is the location of the - * first matching instance of substring in string. If string doesn't - * contain substring, the return value is 0. Matching is done on an exact - * character-for-character basis with no wildcards or special characters. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -char * -strstr( - register char *string, /* String to search. */ - char *substring) /* Substring to try to find in string. */ -{ - register char *a, *b; - - /* - * First scan quickly through the two strings looking for a - * single-character match. When it's found, then compare the rest of the - * substring. - */ - - b = substring; - if (*b == 0) { - return string; - } - for ( ; *string != 0; string += 1) { - if (*string != *b) { - continue; - } - a = string; - while (1) { - if (*b == 0) { - return string; - } - if (*a++ != *b++) { - break; - } - } - b = substring; - } - return NULL; -} diff --git a/compat/strtod.c b/compat/strtod.c deleted file mode 100644 index 9643c09..0000000 --- a/compat/strtod.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * strtod.c -- - * - * Source code for the "strtod" library procedure. - * - * 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. - */ - -#include "tclInt.h" - -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif -#ifndef NULL -#define NULL 0 -#endif - -static const int maxExponent = 511; /* Largest possible base 10 exponent. Any - * exponent larger than this will already - * produce underflow or overflow, so there's - * no need to worry about additional digits. - */ -static const double powersOf10[] = { /* Table giving binary powers of 10. Entry */ - 10., /* is 10^2^i. Used to convert decimal */ - 100., /* exponents into floating-point numbers. */ - 1.0e4, - 1.0e8, - 1.0e16, - 1.0e32, - 1.0e64, - 1.0e128, - 1.0e256 -}; - -/* - *---------------------------------------------------------------------- - * - * strtod -- - * - * This procedure converts a floating-point number from an ASCII - * decimal representation to internal double-precision format. - * - * Results: - * The return value is the double-precision floating-point - * representation of the characters in string. If endPtr isn't - * NULL, then *endPtr is filled in with the address of the - * next character after the last one that was part of the - * floating-point number. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -double -strtod( - const char *string, /* A decimal ASCII floating-point number, - * optionally preceded by white space. Must - * have form "-I.FE-X", where I is the integer - * part of the mantissa, F is the fractional - * part of the mantissa, and X is the - * exponent. Either of the signs may be "+", - * "-", or omitted. Either I or F may be - * omitted, or both. The decimal point isn't - * necessary unless F is present. The "E" may - * actually be an "e". E and X may both be - * omitted (but not just one). */ - char **endPtr) /* If non-NULL, store terminating character's - * address here. */ -{ - int sign, expSign = FALSE; - double fraction, dblExp; - const double *d; - register const char *p; - register int c; - int exp = 0; /* Exponent read from "EX" field. */ - int fracExp = 0; /* Exponent that derives from the fractional - * part. Under normal circumstatnces, it is - * the negative of the number of digits in F. - * However, if I is very long, the last digits - * of I get dropped (otherwise a long I with a - * large negative exponent could cause an - * unnecessary overflow on I alone). In this - * case, fracExp is incremented one for each - * dropped digit. */ - int mantSize; /* Number of digits in mantissa. */ - int decPt; /* Number of mantissa digits BEFORE decimal - * point. */ - const char *pExp; /* Temporarily holds location of exponent in - * string. */ - - /* - * Strip off leading blanks and check for a sign. - */ - - p = string; - while (isspace(UCHAR(*p))) { - p += 1; - } - if (*p == '-') { - sign = TRUE; - p += 1; - } else { - if (*p == '+') { - p += 1; - } - sign = FALSE; - } - - /* - * Count the number of digits in the mantissa (including the decimal - * point), and also locate the decimal point. - */ - - decPt = -1; - for (mantSize = 0; ; mantSize += 1) - { - c = *p; - if (!isdigit(c)) { - if ((c != '.') || (decPt >= 0)) { - break; - } - decPt = mantSize; - } - p += 1; - } - - /* - * Now suck up the digits in the mantissa. Use two integers to collect 9 - * digits each (this is faster than using floating-point). If the mantissa - * has more than 18 digits, ignore the extras, since they can't affect the - * value anyway. - */ - - pExp = p; - p -= mantSize; - if (decPt < 0) { - decPt = mantSize; - } else { - mantSize -= 1; /* One of the digits was the point. */ - } - if (mantSize > 18) { - fracExp = decPt - 18; - mantSize = 18; - } else { - fracExp = decPt - mantSize; - } - if (mantSize == 0) { - fraction = 0.0; - p = string; - goto done; - } else { - int frac1, frac2; - - frac1 = 0; - for ( ; mantSize > 9; mantSize -= 1) { - c = *p; - p += 1; - if (c == '.') { - c = *p; - p += 1; - } - frac1 = 10*frac1 + (c - '0'); - } - frac2 = 0; - for (; mantSize > 0; mantSize -= 1) { - c = *p; - p += 1; - if (c == '.') { - c = *p; - p += 1; - } - frac2 = 10*frac2 + (c - '0'); - } - fraction = (1.0e9 * frac1) + frac2; - } - - /* - * Skim off the exponent. - */ - - p = pExp; - if ((*p == 'E') || (*p == 'e')) { - p += 1; - if (*p == '-') { - expSign = TRUE; - p += 1; - } else { - if (*p == '+') { - p += 1; - } - expSign = FALSE; - } - if (!isdigit(UCHAR(*p))) { - p = pExp; - goto done; - } - while (isdigit(UCHAR(*p))) { - exp = exp * 10 + (*p - '0'); - p += 1; - } - } - if (expSign) { - exp = fracExp - exp; - } else { - exp = fracExp + exp; - } - - /* - * Generate a floating-point number that represents the exponent. Do this - * by processing the exponent one bit at a time to combine many powers of - * 2 of 10. Then combine the exponent with the fraction. - */ - - if (exp < 0) { - expSign = TRUE; - exp = -exp; - } else { - expSign = FALSE; - } - if (exp > maxExponent) { - exp = maxExponent; - errno = ERANGE; - } - dblExp = 1.0; - for (d = powersOf10; exp != 0; exp >>= 1, ++d) { - if (exp & 01) { - dblExp *= *d; - } - } - if (expSign) { - fraction /= dblExp; - } else { - fraction *= dblExp; - } - - done: - if (endPtr != NULL) { - *endPtr = (char *) p; - } - - if (sign) { - return -fraction; - } - return fraction; -} diff --git a/compat/strtol.c b/compat/strtol.c deleted file mode 100644 index 811006a..0000000 --- a/compat/strtol.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * strtol.c -- - * - * Source code for the "strtol" 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. - */ - -#include "tclInt.h" - -/* - *---------------------------------------------------------------------- - * - * strtol -- - * - * Convert an ASCII string into an integer. - * - * Results: - * The return value is the integer equivalent of string. If endPtr is - * non-NULL, then *endPtr is filled in with the character after the last - * one that was part of the integer. If string doesn't contain a valid - * integer value, then zero is returned and *endPtr is set to string. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -long int -strtol( - const char *string, /* String of ASCII digits, possibly preceded - * by white space. For bases greater than 10, - * either lower- or upper-case digits may be - * used. */ - char **endPtr, /* Where to store address of terminating - * character, or NULL. */ - int base) /* Base for conversion. Must be less than 37. - * If 0, then the base is chosen from the - * leading characters of string: "0x" means - * hex, "0" means octal, anything else means - * decimal. */ -{ - register const char *p; - long result; - - /* - * Skip any leading blanks. - */ - - p = string; - while (isspace(UCHAR(*p))) { - p += 1; - } - - /* - * Check for a sign. - */ - - if (*p == '-') { - p += 1; - result = -(strtoul(p, endPtr, base)); - } else { - if (*p == '+') { - p += 1; - } - result = strtoul(p, endPtr, base); - } - if ((result == 0) && (endPtr != 0) && (*endPtr == p)) { - *endPtr = (char *) string; - } - return result; -} diff --git a/compat/strtoul.c b/compat/strtoul.c deleted file mode 100644 index 15587f1..0000000 --- a/compat/strtoul.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * strtoul.c -- - * - * Source code for the "strtoul" 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. - */ - -#include "tclInt.h" - -/* - * The table below is used to convert from ASCII digits to a numerical - * equivalent. It maps from '0' through 'z' to integers (100 for non-digit - * characters). - */ - -static const char cvtIn[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* '0' - '9' */ - 100, 100, 100, 100, 100, 100, 100, /* punctuation */ - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 'A' - 'Z' */ - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, - 100, 100, 100, 100, 100, 100, /* punctuation */ - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, /* 'a' - 'z' */ - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35}; - -/* - *---------------------------------------------------------------------- - * - * strtoul -- - * - * Convert an ASCII string into an integer. - * - * Results: - * The return value is the integer equivalent of string. If endPtr is - * non-NULL, then *endPtr is filled in with the character after the last - * one that was part of the integer. If string doesn't contain a valid - * integer value, then zero is returned and *endPtr is set to string. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -unsigned long int -strtoul( - const char *string, /* String of ASCII digits, possibly preceded - * by white space. For bases greater than 10, - * either lower- or upper-case digits may be - * used. */ - char **endPtr, /* Where to store address of terminating - * character, or NULL. */ - int base) /* Base for conversion. Must be less than 37. - * If 0, then the base is chosen from the - * leading characters of string: "0x" means - * hex, "0" means octal, anything else means - * decimal. */ -{ - register const char *p; - register unsigned long int result = 0; - register unsigned digit; - int anyDigits = 0; - int negative=0; - int overflow=0; - - /* - * Skip any leading blanks. - */ - - p = string; - while (isspace(UCHAR(*p))) { - p += 1; - } - if (*p == '-') { - negative = 1; - p += 1; - } else { - if (*p == '+') { - p += 1; - } - } - - /* - * If no base was provided, pick one from the leading characters of the - * string. - */ - - if (base == 0) { - if (*p == '0') { - p += 1; - if ((*p == 'x') || (*p == 'X')) { - p += 1; - base = 16; - } else { - /* - * Must set anyDigits here, otherwise "0" produces a "no - * digits" error. - */ - - anyDigits = 1; - base = 8; - } - } else { - base = 10; - } - } else if (base == 16) { - /* - * Skip a leading "0x" from hex numbers. - */ - - if ((p[0] == '0') && ((p[1] == 'x') || (p[1] == 'X'))) { - p += 2; - } - } - - /* - * Sorry this code is so messy, but speed seems important. Do different - * things for base 8, 10, 16, and other. - */ - - if (base == 8) { - unsigned long maxres = ULONG_MAX >> 3; - - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > 7) { - break; - } - if (result > maxres) { overflow = 1; } - result = (result << 3); - if (digit > (ULONG_MAX - result)) { overflow = 1; } - result += digit; - anyDigits = 1; - } - } else if (base == 10) { - unsigned long maxres = ULONG_MAX / 10; - - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > 9) { - break; - } - if (result > maxres) { overflow = 1; } - result *= 10; - if (digit > (ULONG_MAX - result)) { overflow = 1; } - result += digit; - anyDigits = 1; - } - } else if (base == 16) { - unsigned long maxres = ULONG_MAX >> 4; - - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > ('z' - '0')) { - break; - } - digit = cvtIn[digit]; - if (digit > 15) { - break; - } - if (result > maxres) { overflow = 1; } - result = (result << 4); - if (digit > (ULONG_MAX - result)) { overflow = 1; } - result += digit; - anyDigits = 1; - } - } else if (base >= 2 && base <= 36) { - unsigned long maxres = ULONG_MAX / base; - - for ( ; ; p += 1) { - digit = *p - '0'; - if (digit > ('z' - '0')) { - break; - } - digit = cvtIn[digit]; - if (digit >= ( (unsigned) base )) { - break; - } - if (result > maxres) { overflow = 1; } - result *= base; - if (digit > (ULONG_MAX - result)) { overflow = 1; } - result += digit; - anyDigits = 1; - } - } - - /* - * See if there were any digits at all. - */ - - if (!anyDigits) { - p = string; - } - - if (endPtr != 0) { - /* unsafe, but required by the strtoul prototype */ - *endPtr = (char *) p; - } - - if (overflow) { - errno = ERANGE; - return ULONG_MAX; - } - if (negative) { - return -result; - } - return result; -} diff --git a/compat/unistd.h b/compat/unistd.h deleted file mode 100644 index a8f14f2..0000000 --- a/compat/unistd.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * unistd.h -- - * - * Macros, constants and prototypes for Posix conformance. - * - * Copyright 1989 Regents of the University of California Permission to use, - * copy, modify, and distribute this software and its documentation for any - * purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies. The University of California makes - * no representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - */ - -#ifndef _UNISTD -#define _UNISTD - -#include - -#ifndef NULL -#define NULL 0 -#endif - -/* - * Strict POSIX stuff goes here. Extensions go down below, in the ifndef - * _POSIX_SOURCE section. - */ - -extern void _exit(int status); -extern int access(const char *path, int mode); -extern int chdir(const char *path); -extern int chown(const char *path, uid_t owner, gid_t group); -extern int close(int fd); -extern int dup(int oldfd); -extern int dup2(int oldfd, int newfd); -extern int execl(const char *path, ...); -extern int execle(const char *path, ...); -extern int execlp(const char *file, ...); -extern int execv(const char *path, char **argv); -extern int execve(const char *path, char **argv, char **envp); -extern int execvpw(const char *file, char **argv); -extern pid_t fork(void); -extern char * getcwd(char *buf, size_t size); -extern gid_t getegid(void); -extern uid_t geteuid(void); -extern gid_t getgid(void); -extern int getgroups(int bufSize, int *buffer); -extern pid_t getpid(void); -extern uid_t getuid(void); -extern int isatty(int fd); -extern long lseek(int fd, long offset, int whence); -extern int pipe(int *fildes); -extern int read(int fd, char *buf, size_t size); -extern int setgid(gid_t group); -extern int setuid(uid_t user); -extern unsigned sleep(unsigned seconds); -extern char * ttyname(int fd); -extern int unlink(const char *path); -extern int write(int fd, const char *buf, size_t size); - -#ifndef _POSIX_SOURCE -extern char * crypt(const char *, const char *); -extern int fchown(int fd, uid_t owner, gid_t group); -extern int flock(int fd, int operation); -extern int ftruncate(int fd, unsigned long length); -extern int ioctl(int fd, int request, ...); -extern int readlink(const char *path, char *buf, int bufsize); -extern int setegid(gid_t group); -extern int seteuidw(uid_t user); -extern int setreuid(int ruid, int euid); -extern int symlink(const char *, const char *); -extern int ttyslot(void); -extern int truncate(const char *path, unsigned long length); -extern int vfork(void); -#endif /* _POSIX_SOURCE */ - -#endif /* _UNISTD */ diff --git a/compat/waitpid.c b/compat/waitpid.c deleted file mode 100644 index d4473a8..0000000 --- a/compat/waitpid.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * waitpid.c -- - * - * This procedure emulates the POSIX waitpid kernel call on BSD systems - * that don't have waitpid but do have wait3. This code is based on a - * prototype version written by Mark Diekhans and Karl Lehenbauer. - * - * Copyright (c) 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. - */ - -#include "tclPort.h" - -#ifndef pid_t -#define pid_t int -#endif - -/* - * A linked list of the following structures is used to keep track of - * processes for which we received notification from the kernel, but the - * application hasn't waited for them yet (this can happen because wait may - * not return the process we really want). We save the information here until - * the application finally does wait for the process. - */ - -typedef struct WaitInfo { - pid_t pid; /* Pid of process that exited. */ - WAIT_STATUS_TYPE status; /* Status returned when child exited or - * suspended. */ - struct WaitInfo *nextPtr; /* Next in list of exited processes. */ -} WaitInfo; - -static WaitInfo *deadList = NULL; - /* First in list of all dead processes. */ - -/* - *---------------------------------------------------------------------- - * - * waitpid -- - * - * This procedure emulates the functionality of the POSIX waitpid kernel - * call, using the BSD wait3 kernel call. Note: it doesn't emulate - * absolutely all of the waitpid functionality, in that it doesn't - * support pid's of 0 or < -1. - * - * Results: - * -1 is returned if there is an error in the wait kernel call. Otherwise - * the pid of an exited or suspended process is returned and *statusPtr - * is set to the status value of the process. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -#ifdef waitpid -# undef waitpid -#endif - -pid_t -waitpid( - pid_t pid, /* The pid to wait on. Must be -1 or greater - * than zero. */ - int *statusPtr, /* Where to store wait status for the - * process. */ - int options) /* OR'ed combination of WNOHANG and - * WUNTRACED. */ -{ - register WaitInfo *waitPtr, *prevPtr; - pid_t result; - WAIT_STATUS_TYPE status; - - if ((pid < -1) || (pid == 0)) { - errno = EINVAL; - return -1; - } - - /* - * See if there's a suitable process that has already stopped or exited. - * If so, remove it from the list of exited processes and return its - * information. - */ - - for (waitPtr = deadList, prevPtr = NULL; waitPtr != NULL; - prevPtr = waitPtr, waitPtr = waitPtr->nextPtr) { - if ((pid != waitPtr->pid) && (pid != -1)) { - continue; - } - if (!(options & WUNTRACED) && (WIFSTOPPED(waitPtr->status))) { - continue; - } - result = waitPtr->pid; - *statusPtr = *((int *) &waitPtr->status); - if (prevPtr == NULL) { - deadList = waitPtr->nextPtr; - } else { - prevPtr->nextPtr = waitPtr->nextPtr; - } - ckfree(waitPtr); - return result; - } - - /* - * Wait for any process to stop or exit. If it's an acceptable one then - * return it to the caller; otherwise store information about it in the - * list of exited processes and try again. On systems that have only wait - * but not wait3, there are several situations we can't handle, but we do - * the best we can (e.g. can still handle some combinations of options by - * invoking wait instead of wait3). - */ - - while (1) { -#if NO_WAIT3 - if (options & WNOHANG) { - return 0; - } - if (options != 0) { - errno = EINVAL; - return -1; - } - result = wait(&status); -#else - result = wait3(&status, options, 0); -#endif - if ((result == -1) && (errno == EINTR)) { - continue; - } - if (result <= 0) { - return result; - } - - if ((pid != result) && (pid != -1)) { - goto saveInfo; - } - if (!(options & WUNTRACED) && (WIFSTOPPED(status))) { - goto saveInfo; - } - *statusPtr = *((int *) &status); - return result; - - /* - * Can't return this info to caller. Save it in the list of stopped or - * exited processes. Tricky point: first check for an existing entry - * for the process and overwrite it if it exists (e.g. a previously - * stopped process might now be dead). - */ - - saveInfo: - for (waitPtr = deadList; waitPtr != NULL; waitPtr = waitPtr->nextPtr) { - if (waitPtr->pid == result) { - waitPtr->status = status; - goto waitAgain; - } - } - waitPtr = (WaitInfo *) ckalloc(sizeof(WaitInfo)); - waitPtr->pid = result; - waitPtr->status = status; - waitPtr->nextPtr = deadList; - deadList = waitPtr; - - waitAgain: - continue; - } -} diff --git a/compat/zlib/CMakeLists.txt b/compat/zlib/CMakeLists.txt deleted file mode 100644 index 0fe939d..0000000 --- a/compat/zlib/CMakeLists.txt +++ /dev/null @@ -1,249 +0,0 @@ -cmake_minimum_required(VERSION 2.4.4) -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) - -project(zlib C) - -set(VERSION "1.2.11") - -option(ASM686 "Enable building i686 assembly implementation") -option(AMD64 "Enable building amd64 assembly implementation") - -set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") -set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") -set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers") -set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") -set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") - -include(CheckTypeSize) -include(CheckFunctionExists) -include(CheckIncludeFile) -include(CheckCSourceCompiles) -enable_testing() - -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(stdint.h HAVE_STDINT_H) -check_include_file(stddef.h HAVE_STDDEF_H) - -# -# Check to see if we have large file support -# -set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) -# We add these other definitions here because CheckTypeSize.cmake -# in CMake 2.4.x does not automatically do so and we want -# compatibility with CMake 2.4.x. -if(HAVE_SYS_TYPES_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) -endif() -if(HAVE_STDINT_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) -endif() -if(HAVE_STDDEF_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) -endif() -check_type_size(off64_t OFF64_T) -if(HAVE_OFF64_T) - add_definitions(-D_LARGEFILE64_SOURCE=1) -endif() -set(CMAKE_REQUIRED_DEFINITIONS) # clear variable - -# -# Check for fseeko -# -check_function_exists(fseeko HAVE_FSEEKO) -if(NOT HAVE_FSEEKO) - add_definitions(-DNO_FSEEKO) -endif() - -# -# Check for unistd.h -# -check_include_file(unistd.h Z_HAVE_UNISTD_H) - -if(MSVC) - set(CMAKE_DEBUG_POSTFIX "d") - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -endif() - -if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) - # If we're doing an out of source build and the user has a zconf.h - # in their source tree... - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h) - message(STATUS "Renaming") - message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h") - message(STATUS "to 'zconf.h.included' because this file is included with zlib") - message(STATUS "but CMake generates it automatically in the build directory.") - file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included) - endif() -endif() - -set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein - ${ZLIB_PC} @ONLY) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein - ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) -include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) - - -#============================================================================ -# zlib -#============================================================================ - -set(ZLIB_PUBLIC_HDRS - ${CMAKE_CURRENT_BINARY_DIR}/zconf.h - zlib.h -) -set(ZLIB_PRIVATE_HDRS - crc32.h - deflate.h - gzguts.h - inffast.h - inffixed.h - inflate.h - inftrees.h - trees.h - zutil.h -) -set(ZLIB_SRCS - adler32.c - compress.c - crc32.c - deflate.c - gzclose.c - gzlib.c - gzread.c - gzwrite.c - inflate.c - infback.c - inftrees.c - inffast.c - trees.c - uncompr.c - zutil.c -) - -if(NOT MINGW) - set(ZLIB_DLL_SRCS - win32/zlib1.rc # If present will override custom build rule below. - ) -endif() - -if(CMAKE_COMPILER_IS_GNUCC) - if(ASM686) - set(ZLIB_ASMS contrib/asm686/match.S) - elseif (AMD64) - set(ZLIB_ASMS contrib/amd64/amd64-match.S) - endif () - - if(ZLIB_ASMS) - add_definitions(-DASMV) - set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) - endif() -endif() - -if(MSVC) - if(ASM686) - ENABLE_LANGUAGE(ASM_MASM) - set(ZLIB_ASMS - contrib/masmx86/inffas32.asm - contrib/masmx86/match686.asm - ) - elseif (AMD64) - ENABLE_LANGUAGE(ASM_MASM) - set(ZLIB_ASMS - contrib/masmx64/gvmat64.asm - contrib/masmx64/inffasx64.asm - ) - endif() - - if(ZLIB_ASMS) - add_definitions(-DASMV -DASMINF) - endif() -endif() - -# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) -string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" - "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) - -if(MINGW) - # This gets us DLL resource information when compiling on MinGW. - if(NOT CMAKE_RC_COMPILER) - set(CMAKE_RC_COMPILER windres.exe) - endif() - - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - COMMAND ${CMAKE_RC_COMPILER} - -D GCC_WINDRES - -I ${CMAKE_CURRENT_SOURCE_DIR} - -I ${CMAKE_CURRENT_BINARY_DIR} - -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) - set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) -endif(MINGW) - -add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) -set_target_properties(zlib PROPERTIES SOVERSION 1) - -if(NOT CYGWIN) - # This property causes shared libraries on Linux to have the full version - # encoded into their final filename. We disable this on Cygwin because - # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll - # seems to be the default. - # - # This has no effect with MSVC, on that platform the version info for - # the DLL comes from the resource file win32/zlib1.rc - set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) -endif() - -if(UNIX) - # On unix-like platforms the library is almost always called libz - set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) - if(NOT APPLE) - set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") - endif() -elseif(BUILD_SHARED_LIBS AND WIN32) - # Creates zlib1.dll when building shared library version - set_target_properties(zlib PROPERTIES SUFFIX "1.dll") -endif() - -if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) - install(TARGETS zlib zlibstatic - RUNTIME DESTINATION "${INSTALL_BIN_DIR}" - ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" - LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) -endif() -if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) - install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}") -endif() -if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) - install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3") -endif() -if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) - install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}") -endif() - -#============================================================================ -# Example binaries -#============================================================================ - -add_executable(example test/example.c) -target_link_libraries(example zlib) -add_test(example example) - -add_executable(minigzip test/minigzip.c) -target_link_libraries(minigzip zlib) - -if(HAVE_OFF64_T) - add_executable(example64 test/example.c) - target_link_libraries(example64 zlib) - set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") - add_test(example64 example64) - - add_executable(minigzip64 test/minigzip.c) - target_link_libraries(minigzip64 zlib) - set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") -endif() diff --git a/compat/zlib/ChangeLog b/compat/zlib/ChangeLog deleted file mode 100644 index 30199a6..0000000 --- a/compat/zlib/ChangeLog +++ /dev/null @@ -1,1515 +0,0 @@ - - ChangeLog file for zlib - -Changes in 1.2.11 (15 Jan 2017) -- Fix deflate stored bug when pulling last block from window -- Permit immediate deflateParams changes before any deflate input - -Changes in 1.2.10 (2 Jan 2017) -- Avoid warnings on snprintf() return value -- Fix bug in deflate_stored() for zero-length input -- Fix bug in gzwrite.c that produced corrupt gzip files -- Remove files to be installed before copying them in Makefile.in -- Add warnings when compiling with assembler code - -Changes in 1.2.9 (31 Dec 2016) -- Fix contrib/minizip to permit unzipping with desktop API [Zouzou] -- Improve contrib/blast to return unused bytes -- Assure that gzoffset() is correct when appending -- Improve compress() and uncompress() to support large lengths -- Fix bug in test/example.c where error code not saved -- Remedy Coverity warning [Randers-Pehrson] -- Improve speed of gzprintf() in transparent mode -- Fix inflateInit2() bug when windowBits is 16 or 32 -- Change DEBUG macro to ZLIB_DEBUG -- Avoid uninitialized access by gzclose_w() -- Allow building zlib outside of the source directory -- Fix bug that accepted invalid zlib header when windowBits is zero -- Fix gzseek() problem on MinGW due to buggy _lseeki64 there -- Loop on write() calls in gzwrite.c in case of non-blocking I/O -- Add --warn (-w) option to ./configure for more compiler warnings -- Reject a window size of 256 bytes if not using the zlib wrapper -- Fix bug when level 0 used with Z_HUFFMAN or Z_RLE -- Add --debug (-d) option to ./configure to define ZLIB_DEBUG -- Fix bugs in creating a very large gzip header -- Add uncompress2() function, which returns the input size used -- Assure that deflateParams() will not switch functions mid-block -- Dramatically speed up deflation for level 0 (storing) -- Add gzfread(), duplicating the interface of fread() -- Add gzfwrite(), duplicating the interface of fwrite() -- Add deflateGetDictionary() function -- Use snprintf() for later versions of Microsoft C -- Fix *Init macros to use z_ prefix when requested -- Replace as400 with os400 for OS/400 support [Monnerat] -- Add crc32_z() and adler32_z() functions with size_t lengths -- Update Visual Studio project files [AraHaan] - -Changes in 1.2.8 (28 Apr 2013) -- Update contrib/minizip/iowin32.c for Windows RT [Vollant] -- Do not force Z_CONST for C++ -- Clean up contrib/vstudio [Roß] -- Correct spelling error in zlib.h -- Fix mixed line endings in contrib/vstudio - -Changes in 1.2.7.3 (13 Apr 2013) -- Fix version numbers and DLL names in contrib/vstudio/*/zlib.rc - -Changes in 1.2.7.2 (13 Apr 2013) -- Change check for a four-byte type back to hexadecimal -- Fix typo in win32/Makefile.msc -- Add casts in gzwrite.c for pointer differences - -Changes in 1.2.7.1 (24 Mar 2013) -- Replace use of unsafe string functions with snprintf if available -- Avoid including stddef.h on Windows for Z_SOLO compile [Niessink] -- Fix gzgetc undefine when Z_PREFIX set [Turk] -- Eliminate use of mktemp in Makefile (not always available) -- Fix bug in 'F' mode for gzopen() -- Add inflateGetDictionary() function -- Correct comment in deflate.h -- Use _snprintf for snprintf in Microsoft C -- On Darwin, only use /usr/bin/libtool if libtool is not Apple -- Delete "--version" file if created by "ar --version" [Richard G.] -- Fix configure check for veracity of compiler error return codes -- Fix CMake compilation of static lib for MSVC2010 x64 -- Remove unused variable in infback9.c -- Fix argument checks in gzlog_compress() and gzlog_write() -- Clean up the usage of z_const and respect const usage within zlib -- Clean up examples/gzlog.[ch] comparisons of different types -- Avoid shift equal to bits in type (caused endless loop) -- Fix uninitialized value bug in gzputc() introduced by const patches -- Fix memory allocation error in examples/zran.c [Nor] -- Fix bug where gzopen(), gzclose() would write an empty file -- Fix bug in gzclose() when gzwrite() runs out of memory -- Check for input buffer malloc failure in examples/gzappend.c -- Add note to contrib/blast to use binary mode in stdio -- Fix comparisons of differently signed integers in contrib/blast -- Check for invalid code length codes in contrib/puff -- Fix serious but very rare decompression bug in inftrees.c -- Update inflateBack() comments, since inflate() can be faster -- Use underscored I/O function names for WINAPI_FAMILY -- Add _tr_flush_bits to the external symbols prefixed by --zprefix -- Add contrib/vstudio/vc10 pre-build step for static only -- Quote --version-script argument in CMakeLists.txt -- Don't specify --version-script on Apple platforms in CMakeLists.txt -- Fix casting error in contrib/testzlib/testzlib.c -- Fix types in contrib/minizip to match result of get_crc_table() -- Simplify contrib/vstudio/vc10 with 'd' suffix -- Add TOP support to win32/Makefile.msc -- Suport i686 and amd64 assembler builds in CMakeLists.txt -- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h -- Add vc11 and vc12 build files to contrib/vstudio -- Add gzvprintf() as an undocumented function in zlib -- Fix configure for Sun shell -- Remove runtime check in configure for four-byte integer type -- Add casts and consts to ease user conversion to C++ -- Add man pages for minizip and miniunzip -- In Makefile uninstall, don't rm if preceding cd fails -- Do not return Z_BUF_ERROR if deflateParam() has nothing to write - -Changes in 1.2.7 (2 May 2012) -- Replace use of memmove() with a simple copy for portability -- Test for existence of strerror -- Restore gzgetc_ for backward compatibility with 1.2.6 -- Fix build with non-GNU make on Solaris -- Require gcc 4.0 or later on Mac OS X to use the hidden attribute -- Include unistd.h for Watcom C -- Use __WATCOMC__ instead of __WATCOM__ -- Do not use the visibility attribute if NO_VIZ defined -- Improve the detection of no hidden visibility attribute -- Avoid using __int64 for gcc or solo compilation -- Cast to char * in gzprintf to avoid warnings [Zinser] -- Fix make_vms.com for VAX [Zinser] -- Don't use library or built-in byte swaps -- Simplify test and use of gcc hidden attribute -- Fix bug in gzclose_w() when gzwrite() fails to allocate memory -- Add "x" (O_EXCL) and "e" (O_CLOEXEC) modes support to gzopen() -- Fix bug in test/minigzip.c for configure --solo -- Fix contrib/vstudio project link errors [Mohanathas] -- Add ability to choose the builder in make_vms.com [Schweda] -- Add DESTDIR support to mingw32 win32/Makefile.gcc -- Fix comments in win32/Makefile.gcc for proper usage -- Allow overriding the default install locations for cmake -- Generate and install the pkg-config file with cmake -- Build both a static and a shared version of zlib with cmake -- Include version symbols for cmake builds -- If using cmake with MSVC, add the source directory to the includes -- Remove unneeded EXTRA_CFLAGS from win32/Makefile.gcc [Truta] -- Move obsolete emx makefile to old [Truta] -- Allow the use of -Wundef when compiling or using zlib -- Avoid the use of the -u option with mktemp -- Improve inflate() documentation on the use of Z_FINISH -- Recognize clang as gcc -- Add gzopen_w() in Windows for wide character path names -- Rename zconf.h in CMakeLists.txt to move it out of the way -- Add source directory in CMakeLists.txt for building examples -- Look in build directory for zlib.pc in CMakeLists.txt -- Remove gzflags from zlibvc.def in vc9 and vc10 -- Fix contrib/minizip compilation in the MinGW environment -- Update ./configure for Solaris, support --64 [Mooney] -- Remove -R. from Solaris shared build (possible security issue) -- Avoid race condition for parallel make (-j) running example -- Fix type mismatch between get_crc_table() and crc_table -- Fix parsing of version with "-" in CMakeLists.txt [Snider, Ziegler] -- Fix the path to zlib.map in CMakeLists.txt -- Force the native libtool in Mac OS X to avoid GNU libtool [Beebe] -- Add instructions to win32/Makefile.gcc for shared install [Torri] - -Changes in 1.2.6.1 (12 Feb 2012) -- Avoid the use of the Objective-C reserved name "id" -- Include io.h in gzguts.h for Microsoft compilers -- Fix problem with ./configure --prefix and gzgetc macro -- Include gz_header definition when compiling zlib solo -- Put gzflags() functionality back in zutil.c -- Avoid library header include in crc32.c for Z_SOLO -- Use name in GCC_CLASSIC as C compiler for coverage testing, if set -- Minor cleanup in contrib/minizip/zip.c [Vollant] -- Update make_vms.com [Zinser] -- Remove unnecessary gzgetc_ function -- Use optimized byte swap operations for Microsoft and GNU [Snyder] -- Fix minor typo in zlib.h comments [Rzesniowiecki] - -Changes in 1.2.6 (29 Jan 2012) -- Update the Pascal interface in contrib/pascal -- Fix function numbers for gzgetc_ in zlibvc.def files -- Fix configure.ac for contrib/minizip [Schiffer] -- Fix large-entry detection in minizip on 64-bit systems [Schiffer] -- Have ./configure use the compiler return code for error indication -- Fix CMakeLists.txt for cross compilation [McClure] -- Fix contrib/minizip/zip.c for 64-bit architectures [Dalsnes] -- Fix compilation of contrib/minizip on FreeBSD [Marquez] -- Correct suggested usages in win32/Makefile.msc [Shachar, Horvath] -- Include io.h for Turbo C / Borland C on all platforms [Truta] -- Make version explicit in contrib/minizip/configure.ac [Bosmans] -- Avoid warning for no encryption in contrib/minizip/zip.c [Vollant] -- Minor cleanup up contrib/minizip/unzip.c [Vollant] -- Fix bug when compiling minizip with C++ [Vollant] -- Protect for long name and extra fields in contrib/minizip [Vollant] -- Avoid some warnings in contrib/minizip [Vollant] -- Add -I../.. -L../.. to CFLAGS for minizip and miniunzip -- Add missing libs to minizip linker command -- Add support for VPATH builds in contrib/minizip -- Add an --enable-demos option to contrib/minizip/configure -- Add the generation of configure.log by ./configure -- Exit when required parameters not provided to win32/Makefile.gcc -- Have gzputc return the character written instead of the argument -- Use the -m option on ldconfig for BSD systems [Tobias] -- Correct in zlib.map when deflateResetKeep was added - -Changes in 1.2.5.3 (15 Jan 2012) -- Restore gzgetc function for binary compatibility -- Do not use _lseeki64 under Borland C++ [Truta] -- Update win32/Makefile.msc to build test/*.c [Truta] -- Remove old/visualc6 given CMakefile and other alternatives -- Update AS400 build files and documentation [Monnerat] -- Update win32/Makefile.gcc to build test/*.c [Truta] -- Permit stronger flushes after Z_BLOCK flushes -- Avoid extraneous empty blocks when doing empty flushes -- Permit Z_NULL arguments to deflatePending -- Allow deflatePrime() to insert bits in the middle of a stream -- Remove second empty static block for Z_PARTIAL_FLUSH -- Write out all of the available bits when using Z_BLOCK -- Insert the first two strings in the hash table after a flush - -Changes in 1.2.5.2 (17 Dec 2011) -- fix ld error: unable to find version dependency 'ZLIB_1.2.5' -- use relative symlinks for shared libs -- Avoid searching past window for Z_RLE strategy -- Assure that high-water mark initialization is always applied in deflate -- Add assertions to fill_window() in deflate.c to match comments -- Update python link in README -- Correct spelling error in gzread.c -- Fix bug in gzgets() for a concatenated empty gzip stream -- Correct error in comment for gz_make() -- Change gzread() and related to ignore junk after gzip streams -- Allow gzread() and related to continue after gzclearerr() -- Allow gzrewind() and gzseek() after a premature end-of-file -- Simplify gzseek() now that raw after gzip is ignored -- Change gzgetc() to a macro for speed (~40% speedup in testing) -- Fix gzclose() to return the actual error last encountered -- Always add large file support for windows -- Include zconf.h for windows large file support -- Include zconf.h.cmakein for windows large file support -- Update zconf.h.cmakein on make distclean -- Merge vestigial vsnprintf determination from zutil.h to gzguts.h -- Clarify how gzopen() appends in zlib.h comments -- Correct documentation of gzdirect() since junk at end now ignored -- Add a transparent write mode to gzopen() when 'T' is in the mode -- Update python link in zlib man page -- Get inffixed.h and MAKEFIXED result to match -- Add a ./config --solo option to make zlib subset with no library use -- Add undocumented inflateResetKeep() function for CAB file decoding -- Add --cover option to ./configure for gcc coverage testing -- Add #define ZLIB_CONST option to use const in the z_stream interface -- Add comment to gzdopen() in zlib.h to use dup() when using fileno() -- Note behavior of uncompress() to provide as much data as it can -- Add files in contrib/minizip to aid in building libminizip -- Split off AR options in Makefile.in and configure -- Change ON macro to Z_ARG to avoid application conflicts -- Facilitate compilation with Borland C++ for pragmas and vsnprintf -- Include io.h for Turbo C / Borland C++ -- Move example.c and minigzip.c to test/ -- Simplify incomplete code table filling in inflate_table() -- Remove code from inflate.c and infback.c that is impossible to execute -- Test the inflate code with full coverage -- Allow deflateSetDictionary, inflateSetDictionary at any time (in raw) -- Add deflateResetKeep and fix inflateResetKeep to retain dictionary -- Fix gzwrite.c to accommodate reduced memory zlib compilation -- Have inflate() with Z_FINISH avoid the allocation of a window -- Do not set strm->adler when doing raw inflate -- Fix gzeof() to behave just like feof() when read is not past end of file -- Fix bug in gzread.c when end-of-file is reached -- Avoid use of Z_BUF_ERROR in gz* functions except for premature EOF -- Document gzread() capability to read concurrently written files -- Remove hard-coding of resource compiler in CMakeLists.txt [Blammo] - -Changes in 1.2.5.1 (10 Sep 2011) -- Update FAQ entry on shared builds (#13) -- Avoid symbolic argument to chmod in Makefile.in -- Fix bug and add consts in contrib/puff [Oberhumer] -- Update contrib/puff/zeros.raw test file to have all block types -- Add full coverage test for puff in contrib/puff/Makefile -- Fix static-only-build install in Makefile.in -- Fix bug in unzGetCurrentFileInfo() in contrib/minizip [Kuno] -- Add libz.a dependency to shared in Makefile.in for parallel builds -- Spell out "number" (instead of "nb") in zlib.h for total_in, total_out -- Replace $(...) with `...` in configure for non-bash sh [Bowler] -- Add darwin* to Darwin* and solaris* to SunOS\ 5* in configure [Groffen] -- Add solaris* to Linux* in configure to allow gcc use [Groffen] -- Add *bsd* to Linux* case in configure [Bar-Lev] -- Add inffast.obj to dependencies in win32/Makefile.msc -- Correct spelling error in deflate.h [Kohler] -- Change libzdll.a again to libz.dll.a (!) in win32/Makefile.gcc -- Add test to configure for GNU C looking for gcc in output of $cc -v -- Add zlib.pc generation to win32/Makefile.gcc [Weigelt] -- Fix bug in zlib.h for _FILE_OFFSET_BITS set and _LARGEFILE64_SOURCE not -- Add comment in zlib.h that adler32_combine with len2 < 0 makes no sense -- Make NO_DIVIDE option in adler32.c much faster (thanks to John Reiser) -- Make stronger test in zconf.h to include unistd.h for LFS -- Apply Darwin patches for 64-bit file offsets to contrib/minizip [Slack] -- Fix zlib.h LFS support when Z_PREFIX used -- Add updated as400 support (removed from old) [Monnerat] -- Avoid deflate sensitivity to volatile input data -- Avoid division in adler32_combine for NO_DIVIDE -- Clarify the use of Z_FINISH with deflateBound() amount of space -- Set binary for output file in puff.c -- Use u4 type for crc_table to avoid conversion warnings -- Apply casts in zlib.h to avoid conversion warnings -- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller] -- Improve inflateSync() documentation to note indeterminancy -- Add deflatePending() function to return the amount of pending output -- Correct the spelling of "specification" in FAQ [Randers-Pehrson] -- Add a check in configure for stdarg.h, use for gzprintf() -- Check that pointers fit in ints when gzprint() compiled old style -- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler] -- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt] -- Add debug records in assmebler code [Londer] -- Update RFC references to use http://tools.ietf.org/html/... [Li] -- Add --archs option, use of libtool to configure for Mac OS X [Borstel] - -Changes in 1.2.5 (19 Apr 2010) -- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev] -- Default to libdir as sharedlibdir in configure [Nieder] -- Update copyright dates on modified source files -- Update trees.c to be able to generate modified trees.h -- Exit configure for MinGW, suggesting win32/Makefile.gcc -- Check for NULL path in gz_open [Homurlu] - -Changes in 1.2.4.5 (18 Apr 2010) -- Set sharedlibdir in configure [Torok] -- Set LDFLAGS in Makefile.in [Bar-Lev] -- Avoid mkdir objs race condition in Makefile.in [Bowler] -- Add ZLIB_INTERNAL in front of internal inter-module functions and arrays -- Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C -- Don't use hidden attribute when it is a warning generator (e.g. Solaris) - -Changes in 1.2.4.4 (18 Apr 2010) -- Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok] -- Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty -- Try to use bash or ksh regardless of functionality of /bin/sh -- Fix configure incompatibility with NetBSD sh -- Remove attempt to run under bash or ksh since have better NetBSD fix -- Fix win32/Makefile.gcc for MinGW [Bar-Lev] -- Add diagnostic messages when using CROSS_PREFIX in configure -- Added --sharedlibdir option to configure [Weigelt] -- Use hidden visibility attribute when available [Frysinger] - -Changes in 1.2.4.3 (10 Apr 2010) -- Only use CROSS_PREFIX in configure for ar and ranlib if they exist -- Use CROSS_PREFIX for nm [Bar-Lev] -- Assume _LARGEFILE64_SOURCE defined is equivalent to true -- Avoid use of undefined symbols in #if with && and || -- Make *64 prototypes in gzguts.h consistent with functions -- Add -shared load option for MinGW in configure [Bowler] -- Move z_off64_t to public interface, use instead of off64_t -- Remove ! from shell test in configure (not portable to Solaris) -- Change +0 macro tests to -0 for possibly increased portability - -Changes in 1.2.4.2 (9 Apr 2010) -- Add consistent carriage returns to readme.txt's in masmx86 and masmx64 -- Really provide prototypes for *64 functions when building without LFS -- Only define unlink() in minigzip.c if unistd.h not included -- Update README to point to contrib/vstudio project files -- Move projects/vc6 to old/ and remove projects/ -- Include stdlib.h in minigzip.c for setmode() definition under WinCE -- Clean up assembler builds in win32/Makefile.msc [Rowe] -- Include sys/types.h for Microsoft for off_t definition -- Fix memory leak on error in gz_open() -- Symbolize nm as $NM in configure [Weigelt] -- Use TEST_LDSHARED instead of LDSHARED to link test programs [Weigelt] -- Add +0 to _FILE_OFFSET_BITS and _LFS64_LARGEFILE in case not defined -- Fix bug in gzeof() to take into account unused input data -- Avoid initialization of structures with variables in puff.c -- Updated win32/README-WIN32.txt [Rowe] - -Changes in 1.2.4.1 (28 Mar 2010) -- Remove the use of [a-z] constructs for sed in configure [gentoo 310225] -- Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech] -- Restore "for debugging" comment on sprintf() in gzlib.c -- Remove fdopen for MVS from gzguts.h -- Put new README-WIN32.txt in win32 [Rowe] -- Add check for shell to configure and invoke another shell if needed -- Fix big fat stinking bug in gzseek() on uncompressed files -- Remove vestigial F_OPEN64 define in zutil.h -- Set and check the value of _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE -- Avoid errors on non-LFS systems when applications define LFS macros -- Set EXE to ".exe" in configure for MINGW [Kahle] -- Match crc32() in crc32.c exactly to the prototype in zlib.h [Sherrill] -- Add prefix for cross-compilation in win32/makefile.gcc [Bar-Lev] -- Add DLL install in win32/makefile.gcc [Bar-Lev] -- Allow Linux* or linux* from uname in configure [Bar-Lev] -- Allow ldconfig to be redefined in configure and Makefile.in [Bar-Lev] -- Add cross-compilation prefixes to configure [Bar-Lev] -- Match type exactly in gz_load() invocation in gzread.c -- Match type exactly of zcalloc() in zutil.c to zlib.h alloc_func -- Provide prototypes for *64 functions when building zlib without LFS -- Don't use -lc when linking shared library on MinGW -- Remove errno.h check in configure and vestigial errno code in zutil.h - -Changes in 1.2.4 (14 Mar 2010) -- Fix VER3 extraction in configure for no fourth subversion -- Update zlib.3, add docs to Makefile.in to make .pdf out of it -- Add zlib.3.pdf to distribution -- Don't set error code in gzerror() if passed pointer is NULL -- Apply destination directory fixes to CMakeLists.txt [Lowman] -- Move #cmakedefine's to a new zconf.in.cmakein -- Restore zconf.h for builds that don't use configure or cmake -- Add distclean to dummy Makefile for convenience -- Update and improve INDEX, README, and FAQ -- Update CMakeLists.txt for the return of zconf.h [Lowman] -- Update contrib/vstudio/vc9 and vc10 [Vollant] -- Change libz.dll.a back to libzdll.a in win32/Makefile.gcc -- Apply license and readme changes to contrib/asm686 [Raiter] -- Check file name lengths and add -c option in minigzip.c [Li] -- Update contrib/amd64 and contrib/masmx86/ [Vollant] -- Avoid use of "eof" parameter in trees.c to not shadow library variable -- Update make_vms.com for removal of zlibdefs.h [Zinser] -- Update assembler code and vstudio projects in contrib [Vollant] -- Remove outdated assembler code contrib/masm686 and contrib/asm586 -- Remove old vc7 and vc8 from contrib/vstudio -- Update win32/Makefile.msc, add ZLIB_VER_SUBREVISION [Rowe] -- Fix memory leaks in gzclose_r() and gzclose_w(), file leak in gz_open() -- Add contrib/gcc_gvmat64 for longest_match and inflate_fast [Vollant] -- Remove *64 functions from win32/zlib.def (they're not 64-bit yet) -- Fix bug in void-returning vsprintf() case in gzwrite.c -- Fix name change from inflate.h in contrib/inflate86/inffas86.c -- Check if temporary file exists before removing in make_vms.com [Zinser] -- Fix make install and uninstall for --static option -- Fix usage of _MSC_VER in gzguts.h and zutil.h [Truta] -- Update readme.txt in contrib/masmx64 and masmx86 to assemble - -Changes in 1.2.3.9 (21 Feb 2010) -- Expunge gzio.c -- Move as400 build information to old -- Fix updates in contrib/minizip and contrib/vstudio -- Add const to vsnprintf test in configure to avoid warnings [Weigelt] -- Delete zconf.h (made by configure) [Weigelt] -- Change zconf.in.h to zconf.h.in per convention [Weigelt] -- Check for NULL buf in gzgets() -- Return empty string for gzgets() with len == 1 (like fgets()) -- Fix description of gzgets() in zlib.h for end-of-file, NULL return -- Update minizip to 1.1 [Vollant] -- Avoid MSVC loss of data warnings in gzread.c, gzwrite.c -- Note in zlib.h that gzerror() should be used to distinguish from EOF -- Remove use of snprintf() from gzlib.c -- Fix bug in gzseek() -- Update contrib/vstudio, adding vc9 and vc10 [Kuno, Vollant] -- Fix zconf.h generation in CMakeLists.txt [Lowman] -- Improve comments in zconf.h where modified by configure - -Changes in 1.2.3.8 (13 Feb 2010) -- Clean up text files (tabs, trailing whitespace, etc.) [Oberhumer] -- Use z_off64_t in gz_zero() and gz_skip() to match state->skip -- Avoid comparison problem when sizeof(int) == sizeof(z_off64_t) -- Revert to Makefile.in from 1.2.3.6 (live with the clutter) -- Fix missing error return in gzflush(), add zlib.h note -- Add *64 functions to zlib.map [Levin] -- Fix signed/unsigned comparison in gz_comp() -- Use SFLAGS when testing shared linking in configure -- Add --64 option to ./configure to use -m64 with gcc -- Fix ./configure --help to correctly name options -- Have make fail if a test fails [Levin] -- Avoid buffer overrun in contrib/masmx64/gvmat64.asm [Simpson] -- Remove assembler object files from contrib - -Changes in 1.2.3.7 (24 Jan 2010) -- Always gzopen() with O_LARGEFILE if available -- Fix gzdirect() to work immediately after gzopen() or gzdopen() -- Make gzdirect() more precise when the state changes while reading -- Improve zlib.h documentation in many places -- Catch memory allocation failure in gz_open() -- Complete close operation if seek forward in gzclose_w() fails -- Return Z_ERRNO from gzclose_r() if close() fails -- Return Z_STREAM_ERROR instead of EOF for gzclose() being passed NULL -- Return zero for gzwrite() errors to match zlib.h description -- Return -1 on gzputs() error to match zlib.h description -- Add zconf.in.h to allow recovery from configure modification [Weigelt] -- Fix static library permissions in Makefile.in [Weigelt] -- Avoid warnings in configure tests that hide functionality [Weigelt] -- Add *BSD and DragonFly to Linux case in configure [gentoo 123571] -- Change libzdll.a to libz.dll.a in win32/Makefile.gcc [gentoo 288212] -- Avoid access of uninitialized data for first inflateReset2 call [Gomes] -- Keep object files in subdirectories to reduce the clutter somewhat -- Remove default Makefile and zlibdefs.h, add dummy Makefile -- Add new external functions to Z_PREFIX, remove duplicates, z_z_ -> z_ -- Remove zlibdefs.h completely -- modify zconf.h instead - -Changes in 1.2.3.6 (17 Jan 2010) -- Avoid void * arithmetic in gzread.c and gzwrite.c -- Make compilers happier with const char * for gz_error message -- Avoid unused parameter warning in inflate.c -- Avoid signed-unsigned comparison warning in inflate.c -- Indent #pragma's for traditional C -- Fix usage of strwinerror() in glib.c, change to gz_strwinerror() -- Correct email address in configure for system options -- Update make_vms.com and add make_vms.com to contrib/minizip [Zinser] -- Update zlib.map [Brown] -- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok] -- Apply various fixes to CMakeLists.txt [Lowman] -- Add checks on len in gzread() and gzwrite() -- Add error message for no more room for gzungetc() -- Remove zlib version check in gzwrite() -- Defer compression of gzprintf() result until need to -- Use snprintf() in gzdopen() if available -- Remove USE_MMAP configuration determination (only used by minigzip) -- Remove examples/pigz.c (available separately) -- Update examples/gun.c to 1.6 - -Changes in 1.2.3.5 (8 Jan 2010) -- Add space after #if in zutil.h for some compilers -- Fix relatively harmless bug in deflate_fast() [Exarevsky] -- Fix same problem in deflate_slow() -- Add $(SHAREDLIBV) to LIBS in Makefile.in [Brown] -- Add deflate_rle() for faster Z_RLE strategy run-length encoding -- Add deflate_huff() for faster Z_HUFFMAN_ONLY encoding -- Change name of "write" variable in inffast.c to avoid library collisions -- Fix premature EOF from gzread() in gzio.c [Brown] -- Use zlib header window size if windowBits is 0 in inflateInit2() -- Remove compressBound() call in deflate.c to avoid linking compress.o -- Replace use of errno in gz* with functions, support WinCE [Alves] -- Provide alternative to perror() in minigzip.c for WinCE [Alves] -- Don't use _vsnprintf on later versions of MSVC [Lowman] -- Add CMake build script and input file [Lowman] -- Update contrib/minizip to 1.1 [Svensson, Vollant] -- Moved nintendods directory from contrib to . -- Replace gzio.c with a new set of routines with the same functionality -- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above -- Update contrib/minizip to 1.1b -- Change gzeof() to return 0 on error instead of -1 to agree with zlib.h - -Changes in 1.2.3.4 (21 Dec 2009) -- Use old school .SUFFIXES in Makefile.in for FreeBSD compatibility -- Update comments in configure and Makefile.in for default --shared -- Fix test -z's in configure [Marquess] -- Build examplesh and minigzipsh when not testing -- Change NULL's to Z_NULL's in deflate.c and in comments in zlib.h -- Import LDFLAGS from the environment in configure -- Fix configure to populate SFLAGS with discovered CFLAGS options -- Adapt make_vms.com to the new Makefile.in [Zinser] -- Add zlib2ansi script for C++ compilation [Marquess] -- Add _FILE_OFFSET_BITS=64 test to make test (when applicable) -- Add AMD64 assembler code for longest match to contrib [Teterin] -- Include options from $SFLAGS when doing $LDSHARED -- Simplify 64-bit file support by introducing z_off64_t type -- Make shared object files in objs directory to work around old Sun cc -- Use only three-part version number for Darwin shared compiles -- Add rc option to ar in Makefile.in for when ./configure not run -- Add -WI,-rpath,. to LDFLAGS for OSF 1 V4* -- Set LD_LIBRARYN32_PATH for SGI IRIX shared compile -- Protect against _FILE_OFFSET_BITS being defined when compiling zlib -- Rename Makefile.in targets allstatic to static and allshared to shared -- Fix static and shared Makefile.in targets to be independent -- Correct error return bug in gz_open() by setting state [Brown] -- Put spaces before ;;'s in configure for better sh compatibility -- Add pigz.c (parallel implementation of gzip) to examples/ -- Correct constant in crc32.c to UL [Leventhal] -- Reject negative lengths in crc32_combine() -- Add inflateReset2() function to work like inflateEnd()/inflateInit2() -- Include sys/types.h for _LARGEFILE64_SOURCE [Brown] -- Correct typo in doc/algorithm.txt [Janik] -- Fix bug in adler32_combine() [Zhu] -- Catch missing-end-of-block-code error in all inflates and in puff - Assures that random input to inflate eventually results in an error -- Added enough.c (calculation of ENOUGH for inftrees.h) to examples/ -- Update ENOUGH and its usage to reflect discovered bounds -- Fix gzerror() error report on empty input file [Brown] -- Add ush casts in trees.c to avoid pedantic runtime errors -- Fix typo in zlib.h uncompress() description [Reiss] -- Correct inflate() comments with regard to automatic header detection -- Remove deprecation comment on Z_PARTIAL_FLUSH (it stays) -- Put new version of gzlog (2.0) in examples with interruption recovery -- Add puff compile option to permit invalid distance-too-far streams -- Add puff TEST command options, ability to read piped input -- Prototype the *64 functions in zlib.h when _FILE_OFFSET_BITS == 64, but - _LARGEFILE64_SOURCE not defined -- Fix Z_FULL_FLUSH to truly erase the past by resetting s->strstart -- Fix deflateSetDictionary() to use all 32K for output consistency -- Remove extraneous #define MIN_LOOKAHEAD in deflate.c (in deflate.h) -- Clear bytes after deflate lookahead to avoid use of uninitialized data -- Change a limit in inftrees.c to be more transparent to Coverity Prevent -- Update win32/zlib.def with exported symbols from zlib.h -- Correct spelling errors in zlib.h [Willem, Sobrado] -- Allow Z_BLOCK for deflate() to force a new block -- Allow negative bits in inflatePrime() to delete existing bit buffer -- Add Z_TREES flush option to inflate() to return at end of trees -- Add inflateMark() to return current state information for random access -- Add Makefile for NintendoDS to contrib [Costa] -- Add -w in configure compile tests to avoid spurious warnings [Beucler] -- Fix typos in zlib.h comments for deflateSetDictionary() -- Fix EOF detection in transparent gzread() [Maier] - -Changes in 1.2.3.3 (2 October 2006) -- Make --shared the default for configure, add a --static option -- Add compile option to permit invalid distance-too-far streams -- Add inflateUndermine() function which is required to enable above -- Remove use of "this" variable name for C++ compatibility [Marquess] -- Add testing of shared library in make test, if shared library built -- Use ftello() and fseeko() if available instead of ftell() and fseek() -- Provide two versions of all functions that use the z_off_t type for - binary compatibility -- a normal version and a 64-bit offset version, - per the Large File Support Extension when _LARGEFILE64_SOURCE is - defined; use the 64-bit versions by default when _FILE_OFFSET_BITS - is defined to be 64 -- Add a --uname= option to configure to perhaps help with cross-compiling - -Changes in 1.2.3.2 (3 September 2006) -- Turn off silly Borland warnings [Hay] -- Use off64_t and define _LARGEFILE64_SOURCE when present -- Fix missing dependency on inffixed.h in Makefile.in -- Rig configure --shared to build both shared and static [Teredesai, Truta] -- Remove zconf.in.h and instead create a new zlibdefs.h file -- Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant] -- Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt] - -Changes in 1.2.3.1 (16 August 2006) -- Add watcom directory with OpenWatcom make files [Daniel] -- Remove #undef of FAR in zconf.in.h for MVS [Fedtke] -- Update make_vms.com [Zinser] -- Use -fPIC for shared build in configure [Teredesai, Nicholson] -- Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen] -- Use fdopen() (not _fdopen()) for Interix in zutil.h [Bäck] -- Add some FAQ entries about the contrib directory -- Update the MVS question in the FAQ -- Avoid extraneous reads after EOF in gzio.c [Brown] -- Correct spelling of "successfully" in gzio.c [Randers-Pehrson] -- Add comments to zlib.h about gzerror() usage [Brown] -- Set extra flags in gzip header in gzopen() like deflate() does -- Make configure options more compatible with double-dash conventions - [Weigelt] -- Clean up compilation under Solaris SunStudio cc [Rowe, Reinholdtsen] -- Fix uninstall target in Makefile.in [Truta] -- Add pkgconfig support [Weigelt] -- Use $(DESTDIR) macro in Makefile.in [Reinholdtsen, Weigelt] -- Replace set_data_type() with a more accurate detect_data_type() in - trees.c, according to the txtvsbin.txt document [Truta] -- Swap the order of #include and #include "zlib.h" in - gzio.c, example.c and minigzip.c [Truta] -- Shut up annoying VS2005 warnings about standard C deprecation [Rowe, - Truta] (where?) -- Fix target "clean" from win32/Makefile.bor [Truta] -- Create .pdb and .manifest files in win32/makefile.msc [Ziegler, Rowe] -- Update zlib www home address in win32/DLL_FAQ.txt [Truta] -- Update contrib/masmx86/inffas32.asm for VS2005 [Vollant, Van Wassenhove] -- Enable browse info in the "Debug" and "ASM Debug" configurations in - the Visual C++ 6 project, and set (non-ASM) "Debug" as default [Truta] -- Add pkgconfig support [Weigelt] -- Add ZLIB_VER_MAJOR, ZLIB_VER_MINOR and ZLIB_VER_REVISION in zlib.h, - for use in win32/zlib1.rc [Polushin, Rowe, Truta] -- Add a document that explains the new text detection scheme to - doc/txtvsbin.txt [Truta] -- Add rfc1950.txt, rfc1951.txt and rfc1952.txt to doc/ [Truta] -- Move algorithm.txt into doc/ [Truta] -- Synchronize FAQ with website -- Fix compressBound(), was low for some pathological cases [Fearnley] -- Take into account wrapper variations in deflateBound() -- Set examples/zpipe.c input and output to binary mode for Windows -- Update examples/zlib_how.html with new zpipe.c (also web site) -- Fix some warnings in examples/gzlog.c and examples/zran.c (it seems - that gcc became pickier in 4.0) -- Add zlib.map for Linux: "All symbols from zlib-1.1.4 remain - un-versioned, the patch adds versioning only for symbols introduced in - zlib-1.2.0 or later. It also declares as local those symbols which are - not designed to be exported." [Levin] -- Update Z_PREFIX list in zconf.in.h, add --zprefix option to configure -- Do not initialize global static by default in trees.c, add a response - NO_INIT_GLOBAL_POINTERS to initialize them if needed [Marquess] -- Don't use strerror() in gzio.c under WinCE [Yakimov] -- Don't use errno.h in zutil.h under WinCE [Yakimov] -- Move arguments for AR to its usage to allow replacing ar [Marot] -- Add HAVE_VISIBILITY_PRAGMA in zconf.in.h for Mozilla [Randers-Pehrson] -- Improve inflateInit() and inflateInit2() documentation -- Fix structure size comment in inflate.h -- Change configure help option from --h* to --help [Santos] - -Changes in 1.2.3 (18 July 2005) -- Apply security vulnerability fixes to contrib/infback9 as well -- Clean up some text files (carriage returns, trailing space) -- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant] - -Changes in 1.2.2.4 (11 July 2005) -- Add inflatePrime() function for starting inflation at bit boundary -- Avoid some Visual C warnings in deflate.c -- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit - compile -- Fix some spelling errors in comments [Betts] -- Correct inflateInit2() error return documentation in zlib.h -- Add zran.c example of compressed data random access to examples - directory, shows use of inflatePrime() -- Fix cast for assignments to strm->state in inflate.c and infback.c -- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer] -- Move declarations of gf2 functions to right place in crc32.c [Oberhumer] -- Add cast in trees.c t avoid a warning [Oberhumer] -- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer] -- Update make_vms.com [Zinser] -- Initialize state->write in inflateReset() since copied in inflate_fast() -- Be more strict on incomplete code sets in inflate_table() and increase - ENOUGH and MAXD -- this repairs a possible security vulnerability for - invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for - discovering the vulnerability and providing test cases. -- Add ia64 support to configure for HP-UX [Smith] -- Add error return to gzread() for format or i/o error [Levin] -- Use malloc.h for OS/2 [Necasek] - -Changes in 1.2.2.3 (27 May 2005) -- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile -- Typecast fread() return values in gzio.c [Vollant] -- Remove trailing space in minigzip.c outmode (VC++ can't deal with it) -- Fix crc check bug in gzread() after gzungetc() [Heiner] -- Add the deflateTune() function to adjust internal compression parameters -- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack) -- Remove an incorrect assertion in examples/zpipe.c -- Add C++ wrapper in infback9.h [Donais] -- Fix bug in inflateCopy() when decoding fixed codes -- Note in zlib.h how much deflateSetDictionary() actually uses -- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used) -- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer] -- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer] -- Add gzdirect() function to indicate transparent reads -- Update contrib/minizip [Vollant] -- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer] -- Add casts in crc32.c to avoid warnings [Oberhumer] -- Add contrib/masmx64 [Vollant] -- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant] - -Changes in 1.2.2.2 (30 December 2004) -- Replace structure assignments in deflate.c and inflate.c with zmemcpy to - avoid implicit memcpy calls (portability for no-library compilation) -- Increase sprintf() buffer size in gzdopen() to allow for large numbers -- Add INFLATE_STRICT to check distances against zlib header -- Improve WinCE errno handling and comments [Chang] -- Remove comment about no gzip header processing in FAQ -- Add Z_FIXED strategy option to deflateInit2() to force fixed trees -- Add updated make_vms.com [Coghlan], update README -- Create a new "examples" directory, move gzappend.c there, add zpipe.c, - fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. -- Add FAQ entry and comments in deflate.c on uninitialized memory access -- Add Solaris 9 make options in configure [Gilbert] -- Allow strerror() usage in gzio.c for STDC -- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer] -- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant] -- Use z_off_t for adler32_combine() and crc32_combine() lengths -- Make adler32() much faster for small len -- Use OS_CODE in deflate() default gzip header - -Changes in 1.2.2.1 (31 October 2004) -- Allow inflateSetDictionary() call for raw inflate -- Fix inflate header crc check bug for file names and comments -- Add deflateSetHeader() and gz_header structure for custom gzip headers -- Add inflateGetheader() to retrieve gzip headers -- Add crc32_combine() and adler32_combine() functions -- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list -- Use zstreamp consistently in zlib.h (inflate_back functions) -- Remove GUNZIP condition from definition of inflate_mode in inflate.h - and in contrib/inflate86/inffast.S [Truta, Anderson] -- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson] -- Update projects/README.projects and projects/visualc6 [Truta] -- Update win32/DLL_FAQ.txt [Truta] -- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta] -- Deprecate Z_ASCII; use Z_TEXT instead [Truta] -- Use a new algorithm for setting strm->data_type in trees.c [Truta] -- Do not define an exit() prototype in zutil.c unless DEBUG defined -- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta] -- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate() -- Fix Darwin build version identification [Peterson] - -Changes in 1.2.2 (3 October 2004) -- Update zlib.h comments on gzip in-memory processing -- Set adler to 1 in inflateReset() to support Java test suite [Walles] -- Add contrib/dotzlib [Ravn] -- Update win32/DLL_FAQ.txt [Truta] -- Update contrib/minizip [Vollant] -- Move contrib/visual-basic.txt to old/ [Truta] -- Fix assembler builds in projects/visualc6/ [Truta] - -Changes in 1.2.1.2 (9 September 2004) -- Update INDEX file -- Fix trees.c to update strm->data_type (no one ever noticed!) -- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown] -- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE) -- Add limited multitasking protection to DYNAMIC_CRC_TABLE -- Add NO_vsnprintf for VMS in zutil.h [Mozilla] -- Don't declare strerror() under VMS [Mozilla] -- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize -- Update contrib/ada [Anisimkov] -- Update contrib/minizip [Vollant] -- Fix configure to not hardcode directories for Darwin [Peterson] -- Fix gzio.c to not return error on empty files [Brown] -- Fix indentation; update version in contrib/delphi/ZLib.pas and - contrib/pascal/zlibpas.pas [Truta] -- Update mkasm.bat in contrib/masmx86 [Truta] -- Update contrib/untgz [Truta] -- Add projects/README.projects [Truta] -- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta] -- Update win32/DLL_FAQ.txt [Truta] -- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta] -- Remove an unnecessary assignment to curr in inftrees.c [Truta] -- Add OS/2 to exe builds in configure [Poltorak] -- Remove err dummy parameter in zlib.h [Kientzle] - -Changes in 1.2.1.1 (9 January 2004) -- Update email address in README -- Several FAQ updates -- Fix a big fat bug in inftrees.c that prevented decoding valid - dynamic blocks with only literals and no distance codes -- - Thanks to "Hot Emu" for the bug report and sample file -- Add a note to puff.c on no distance codes case. - -Changes in 1.2.1 (17 November 2003) -- Remove a tab in contrib/gzappend/gzappend.c -- Update some interfaces in contrib for new zlib functions -- Update zlib version number in some contrib entries -- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta] -- Support shared libraries on Hurd and KFreeBSD [Brown] -- Fix error in NO_DIVIDE option of adler32.c - -Changes in 1.2.0.8 (4 November 2003) -- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas -- Add experimental NO_DIVIDE #define in adler32.c - - Possibly faster on some processors (let me know if it is) -- Correct Z_BLOCK to not return on first inflate call if no wrap -- Fix strm->data_type on inflate() return to correctly indicate EOB -- Add deflatePrime() function for appending in the middle of a byte -- Add contrib/gzappend for an example of appending to a stream -- Update win32/DLL_FAQ.txt [Truta] -- Delete Turbo C comment in README [Truta] -- Improve some indentation in zconf.h [Truta] -- Fix infinite loop on bad input in configure script [Church] -- Fix gzeof() for concatenated gzip files [Johnson] -- Add example to contrib/visual-basic.txt [Michael B.] -- Add -p to mkdir's in Makefile.in [vda] -- Fix configure to properly detect presence or lack of printf functions -- Add AS400 support [Monnerat] -- Add a little Cygwin support [Wilson] - -Changes in 1.2.0.7 (21 September 2003) -- Correct some debug formats in contrib/infback9 -- Cast a type in a debug statement in trees.c -- Change search and replace delimiter in configure from % to # [Beebe] -- Update contrib/untgz to 0.2 with various fixes [Truta] -- Add build support for Amiga [Nikl] -- Remove some directories in old that have been updated to 1.2 -- Add dylib building for Mac OS X in configure and Makefile.in -- Remove old distribution stuff from Makefile -- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X -- Update links in README - -Changes in 1.2.0.6 (13 September 2003) -- Minor FAQ updates -- Update contrib/minizip to 1.00 [Vollant] -- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta] -- Update POSTINC comment for 68060 [Nikl] -- Add contrib/infback9 with deflate64 decoding (unsupported) -- For MVS define NO_vsnprintf and undefine FAR [van Burik] -- Add pragma for fdopen on MVS [van Burik] - -Changes in 1.2.0.5 (8 September 2003) -- Add OF to inflateBackEnd() declaration in zlib.h -- Remember start when using gzdopen in the middle of a file -- Use internal off_t counters in gz* functions to properly handle seeks -- Perform more rigorous check for distance-too-far in inffast.c -- Add Z_BLOCK flush option to return from inflate at block boundary -- Set strm->data_type on return from inflate - - Indicate bits unused, if at block boundary, and if in last block -- Replace size_t with ptrdiff_t in crc32.c, and check for correct size -- Add condition so old NO_DEFLATE define still works for compatibility -- FAQ update regarding the Windows DLL [Truta] -- INDEX update: add qnx entry, remove aix entry [Truta] -- Install zlib.3 into mandir [Wilson] -- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta] -- Adapt the zlib interface to the new DLL convention guidelines [Truta] -- Introduce ZLIB_WINAPI macro to allow the export of functions using - the WINAPI calling convention, for Visual Basic [Vollant, Truta] -- Update msdos and win32 scripts and makefiles [Truta] -- Export symbols by name, not by ordinal, in win32/zlib.def [Truta] -- Add contrib/ada [Anisimkov] -- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta] -- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant] -- Add contrib/masm686 [Truta] -- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm - [Truta, Vollant] -- Update contrib/delphi; rename to contrib/pascal; add example [Truta] -- Remove contrib/delphi2; add a new contrib/delphi [Truta] -- Avoid inclusion of the nonstandard in contrib/iostream, - and fix some method prototypes [Truta] -- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip - [Truta] -- Avoid the use of backslash (\) in contrib/minizip [Vollant] -- Fix file time handling in contrib/untgz; update makefiles [Truta] -- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines - [Vollant] -- Remove contrib/vstudio/vc15_16 [Vollant] -- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta] -- Update README.contrib [Truta] -- Invert the assignment order of match_head and s->prev[...] in - INSERT_STRING [Truta] -- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings - [Truta] -- Compare function pointers with 0, not with NULL or Z_NULL [Truta] -- Fix prototype of syncsearch in inflate.c [Truta] -- Introduce ASMINF macro to be enabled when using an ASM implementation - of inflate_fast [Truta] -- Change NO_DEFLATE to NO_GZCOMPRESS [Truta] -- Modify test_gzio in example.c to take a single file name as a - parameter [Truta] -- Exit the example.c program if gzopen fails [Truta] -- Add type casts around strlen in example.c [Truta] -- Remove casting to sizeof in minigzip.c; give a proper type - to the variable compared with SUFFIX_LEN [Truta] -- Update definitions of STDC and STDC99 in zconf.h [Truta] -- Synchronize zconf.h with the new Windows DLL interface [Truta] -- Use SYS16BIT instead of __32BIT__ to distinguish between - 16- and 32-bit platforms [Truta] -- Use far memory allocators in small 16-bit memory models for - Turbo C [Truta] -- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in - zlibCompileFlags [Truta] -- Cygwin has vsnprintf [Wilson] -- In Windows16, OS_CODE is 0, as in MSDOS [Truta] -- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson] - -Changes in 1.2.0.4 (10 August 2003) -- Minor FAQ updates -- Be more strict when checking inflateInit2's windowBits parameter -- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well -- Add gzip wrapper option to deflateInit2 using windowBits -- Add updated QNX rule in configure and qnx directory [Bonnefoy] -- Make inflate distance-too-far checks more rigorous -- Clean up FAR usage in inflate -- Add casting to sizeof() in gzio.c and minigzip.c - -Changes in 1.2.0.3 (19 July 2003) -- Fix silly error in gzungetc() implementation [Vollant] -- Update contrib/minizip and contrib/vstudio [Vollant] -- Fix printf format in example.c -- Correct cdecl support in zconf.in.h [Anisimkov] -- Minor FAQ updates - -Changes in 1.2.0.2 (13 July 2003) -- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons -- Attempt to avoid warnings in crc32.c for pointer-int conversion -- Add AIX to configure, remove aix directory [Bakker] -- Add some casts to minigzip.c -- Improve checking after insecure sprintf() or vsprintf() calls -- Remove #elif's from crc32.c -- Change leave label to inf_leave in inflate.c and infback.c to avoid - library conflicts -- Remove inflate gzip decoding by default--only enable gzip decoding by - special request for stricter backward compatibility -- Add zlibCompileFlags() function to return compilation information -- More typecasting in deflate.c to avoid warnings -- Remove leading underscore from _Capital #defines [Truta] -- Fix configure to link shared library when testing -- Add some Windows CE target adjustments [Mai] -- Remove #define ZLIB_DLL in zconf.h [Vollant] -- Add zlib.3 [Rodgers] -- Update RFC URL in deflate.c and algorithm.txt [Mai] -- Add zlib_dll_FAQ.txt to contrib [Truta] -- Add UL to some constants [Truta] -- Update minizip and vstudio [Vollant] -- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h -- Expand use of NO_DUMMY_DECL to avoid all dummy structures -- Added iostream3 to contrib [Schwardt] -- Replace rewind() with fseek() for WinCE [Truta] -- Improve setting of zlib format compression level flags - - Report 0 for huffman and rle strategies and for level == 0 or 1 - - Report 2 only for level == 6 -- Only deal with 64K limit when necessary at compile time [Truta] -- Allow TOO_FAR check to be turned off at compile time [Truta] -- Add gzclearerr() function [Souza] -- Add gzungetc() function - -Changes in 1.2.0.1 (17 March 2003) -- Add Z_RLE strategy for run-length encoding [Truta] - - When Z_RLE requested, restrict matches to distance one - - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE -- Correct FASTEST compilation to allow level == 0 -- Clean up what gets compiled for FASTEST -- Incorporate changes to zconf.in.h [Vollant] - - Refine detection of Turbo C need for dummy returns - - Refine ZLIB_DLL compilation - - Include additional header file on VMS for off_t typedef -- Try to use _vsnprintf where it supplants vsprintf [Vollant] -- Add some casts in inffast.c -- Enchance comments in zlib.h on what happens if gzprintf() tries to - write more than 4095 bytes before compression -- Remove unused state from inflateBackEnd() -- Remove exit(0) from minigzip.c, example.c -- Get rid of all those darn tabs -- Add "check" target to Makefile.in that does the same thing as "test" -- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in -- Update contrib/inflate86 [Anderson] -- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant] -- Add msdos and win32 directories with makefiles [Truta] -- More additions and improvements to the FAQ - -Changes in 1.2.0 (9 March 2003) -- New and improved inflate code - - About 20% faster - - Does not allocate 32K window unless and until needed - - Automatically detects and decompresses gzip streams - - Raw inflate no longer needs an extra dummy byte at end - - Added inflateBack functions using a callback interface--even faster - than inflate, useful for file utilities (gzip, zip) - - Added inflateCopy() function to record state for random access on - externally generated deflate streams (e.g. in gzip files) - - More readable code (I hope) -- New and improved crc32() - - About 50% faster, thanks to suggestions from Rodney Brown -- Add deflateBound() and compressBound() functions -- Fix memory leak in deflateInit2() -- Permit setting dictionary for raw deflate (for parallel deflate) -- Fix const declaration for gzwrite() -- Check for some malloc() failures in gzio.c -- Fix bug in gzopen() on single-byte file 0x1f -- Fix bug in gzread() on concatenated file with 0x1f at end of buffer - and next buffer doesn't start with 0x8b -- Fix uncompress() to return Z_DATA_ERROR on truncated input -- Free memory at end of example.c -- Remove MAX #define in trees.c (conflicted with some libraries) -- Fix static const's in deflate.c, gzio.c, and zutil.[ch] -- Declare malloc() and free() in gzio.c if STDC not defined -- Use malloc() instead of calloc() in zutil.c if int big enough -- Define STDC for AIX -- Add aix/ with approach for compiling shared library on AIX -- Add HP-UX support for shared libraries in configure -- Add OpenUNIX support for shared libraries in configure -- Use $cc instead of gcc to build shared library -- Make prefix directory if needed when installing -- Correct Macintosh avoidance of typedef Byte in zconf.h -- Correct Turbo C memory allocation when under Linux -- Use libz.a instead of -lz in Makefile (assure use of compiled library) -- Update configure to check for snprintf or vsnprintf functions and their - return value, warn during make if using an insecure function -- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that - is lost when library is used--resolution is to build new zconf.h -- Documentation improvements (in zlib.h): - - Document raw deflate and inflate - - Update RFCs URL - - Point out that zlib and gzip formats are different - - Note that Z_BUF_ERROR is not fatal - - Document string limit for gzprintf() and possible buffer overflow - - Note requirement on avail_out when flushing - - Note permitted values of flush parameter of inflate() -- Add some FAQs (and even answers) to the FAQ -- Add contrib/inflate86/ for x86 faster inflate -- Add contrib/blast/ for PKWare Data Compression Library decompression -- Add contrib/puff/ simple inflate for deflate format description - -Changes in 1.1.4 (11 March 2002) -- ZFREE was repeated on same allocation on some error conditions. - This creates a security problem described in - http://www.zlib.org/advisory-2002-03-11.txt -- Returned incorrect error (Z_MEM_ERROR) on some invalid data -- Avoid accesses before window for invalid distances with inflate window - less than 32K. -- force windowBits > 8 to avoid a bug in the encoder for a window size - of 256 bytes. (A complete fix will be available in 1.1.5). - -Changes in 1.1.3 (9 July 1998) -- fix "an inflate input buffer bug that shows up on rare but persistent - occasions" (Mark) -- fix gzread and gztell for concatenated .gz files (Didier Le Botlan) -- fix gzseek(..., SEEK_SET) in write mode -- fix crc check after a gzeek (Frank Faubert) -- fix miniunzip when the last entry in a zip file is itself a zip file - (J Lillge) -- add contrib/asm586 and contrib/asm686 (Brian Raiter) - See http://www.muppetlabs.com/~breadbox/software/assembly.html -- add support for Delphi 3 in contrib/delphi (Bob Dellaca) -- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) -- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) -- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) -- added a FAQ file - -- Support gzdopen on Mac with Metrowerks (Jason Linhart) -- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart) -- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young) -- avoid some warnings with Borland C (Tom Tanner) -- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant) -- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant) -- allow several arguments to configure (Tim Mooney, Frodo Looijaard) -- use libdir and includedir in Makefile.in (Tim Mooney) -- support shared libraries on OSF1 V4 (Tim Mooney) -- remove so_locations in "make clean" (Tim Mooney) -- fix maketree.c compilation error (Glenn, Mark) -- Python interface to zlib now in Python 1.5 (Jeremy Hylton) -- new Makefile.riscos (Rich Walker) -- initialize static descriptors in trees.c for embedded targets (Nick Smith) -- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith) -- add the OS/2 files in Makefile.in too (Andrew Zabolotny) -- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane) -- fix maketree.c to allow clean compilation of inffixed.h (Mark) -- fix parameter check in deflateCopy (Gunther Nikl) -- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler) -- Many portability patches by Christian Spieler: - . zutil.c, zutil.h: added "const" for zmem* - . Make_vms.com: fixed some typos - . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists - . msdos/Makefile.msc: remove "default rtl link library" info from obj files - . msdos/Makefile.*: use model-dependent name for the built zlib library - . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc: - new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT) -- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane) -- replace __far with _far for better portability (Christian Spieler, Tom Lane) -- fix test for errno.h in configure (Tim Newsham) - -Changes in 1.1.2 (19 March 98) -- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) - See http://www.winimage.com/zLibDll/unzip.html -- preinitialize the inflate tables for fixed codes, to make the code - completely thread safe (Mark) -- some simplifications and slight speed-up to the inflate code (Mark) -- fix gzeof on non-compressed files (Allan Schrum) -- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs) -- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn) -- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny) -- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori) -- do not wrap extern "C" around system includes (Tom Lane) -- mention zlib binding for TCL in README (Andreas Kupries) -- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert) -- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson) -- allow "configure --prefix $HOME" (Tim Mooney) -- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson) -- move Makefile.sas to amiga/Makefile.sas - -Changes in 1.1.1 (27 Feb 98) -- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson) -- remove block truncation heuristic which had very marginal effect for zlib - (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the - compression ratio on some files. This also allows inlining _tr_tally for - matches in deflate_slow. -- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) - -Changes in 1.1.0 (24 Feb 98) -- do not return STREAM_END prematurely in inflate (John Bowler) -- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler) -- compile with -DFASTEST to get compression code optimized for speed only -- in minigzip, try mmap'ing the input file first (Miguel Albrecht) -- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain - on Sun but significant on HP) - -- add a pointer to experimental unzip library in README (Gilles Vollant) -- initialize variable gcc in configure (Chris Herborth) - -Changes in 1.0.9 (17 Feb 1998) -- added gzputs and gzgets functions -- do not clear eof flag in gzseek (Mark Diekhans) -- fix gzseek for files in transparent mode (Mark Diekhans) -- do not assume that vsprintf returns the number of bytes written (Jens Krinke) -- replace EXPORT with ZEXPORT to avoid conflict with other programs -- added compress2 in zconf.h, zlib.def, zlib.dnt -- new asm code from Gilles Vollant in contrib/asm386 -- simplify the inflate code (Mark): - . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new() - . ZALLOC the length list in inflate_trees_fixed() instead of using stack - . ZALLOC the value area for huft_build() instead of using stack - . Simplify Z_FINISH check in inflate() - -- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 -- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) -- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - the declaration of FAR (Gilles VOllant) -- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) -- read_buf buf parameter of type Bytef* instead of charf* -- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) -- do not redeclare unlink in minigzip.c for WIN32 (John Bowler) -- fix check for presence of directories in "make install" (Ian Willis) - -Changes in 1.0.8 (27 Jan 1998) -- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant) -- fix gzgetc and gzputc for big endian systems (Markus Oberhumer) -- added compress2() to allow setting the compression level -- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) -- use constant arrays for the static trees in trees.c instead of computing - them at run time (thanks to Ken Raeburn for this suggestion). To create - trees.h, compile with GEN_TREES_H and run "make test". -- check return code of example in "make test" and display result -- pass minigzip command line options to file_compress -- simplifying code of inflateSync to avoid gcc 2.8 bug - -- support CC="gcc -Wall" in configure -s (QingLong) -- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn) -- fix test for shared library support to avoid compiler warnings -- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant) -- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit) -- do not use fdopen for Metrowerks on Mac (Brad Pettit)) -- add checks for gzputc and gzputc in example.c -- avoid warnings in gzio.c and deflate.c (Andreas Kleinert) -- use const for the CRC table (Ken Raeburn) -- fixed "make uninstall" for shared libraries -- use Tracev instead of Trace in infblock.c -- in example.c use correct compressed length for test_sync -- suppress +vnocompatwarnings in configure for HPUX (not always supported) - -Changes in 1.0.7 (20 Jan 1998) -- fix gzseek which was broken in write mode -- return error for gzseek to negative absolute position -- fix configure for Linux (Chun-Chung Chen) -- increase stack space for MSC (Tim Wegner) -- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant) -- define EXPORTVA for gzprintf (Gilles Vollant) -- added man page zlib.3 (Rick Rodgers) -- for contrib/untgz, fix makedir() and improve Makefile - -- check gzseek in write mode in example.c -- allocate extra buffer for seeks only if gzseek is actually called -- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant) -- add inflateSyncPoint in zconf.h -- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def - -Changes in 1.0.6 (19 Jan 1998) -- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and - gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) -- Fix a deflate bug occurring only with compression level 0 (thanks to - Andy Buckler for finding this one). -- In minigzip, pass transparently also the first byte for .Z files. -- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() -- check Z_FINISH in inflate (thanks to Marc Schluper) -- Implement deflateCopy (thanks to Adam Costello) -- make static libraries by default in configure, add --shared option. -- move MSDOS or Windows specific files to directory msdos -- suppress the notion of partial flush to simplify the interface - (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) -- suppress history buffer provided by application to simplify the interface - (this feature was not implemented anyway in 1.0.4) -- next_in and avail_in must be initialized before calling inflateInit or - inflateInit2 -- add EXPORT in all exported functions (for Windows DLL) -- added Makefile.nt (thanks to Stephen Williams) -- added the unsupported "contrib" directory: - contrib/asm386/ by Gilles Vollant - 386 asm code replacing longest_match(). - contrib/iostream/ by Kevin Ruland - A C++ I/O streams interface to the zlib gz* functions - contrib/iostream2/ by Tyge Løvset - Another C++ I/O streams interface - contrib/untgz/ by "Pedro A. Aranda Guti\irrez" - A very simple tar.gz file extractor using zlib - contrib/visual-basic.txt by Carlos Rios - How to use compress(), uncompress() and the gz* functions from VB. -- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression - level) in minigzip (thanks to Tom Lane) - -- use const for rommable constants in deflate -- added test for gzseek and gztell in example.c -- add undocumented function inflateSyncPoint() (hack for Paul Mackerras) -- add undocumented function zError to convert error code to string - (for Tim Smithers) -- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. -- Use default memcpy for Symantec MSDOS compiler. -- Add EXPORT keyword for check_func (needed for Windows DLL) -- add current directory to LD_LIBRARY_PATH for "make test" -- create also a link for libz.so.1 -- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura) -- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX) -- added -soname for Linux in configure (Chun-Chung Chen, -- assign numbers to the exported functions in zlib.def (for Windows DLL) -- add advice in zlib.h for best usage of deflateSetDictionary -- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn) -- allow compilation with ANSI keywords only enabled for TurboC in large model -- avoid "versionString"[0] (Borland bug) -- add NEED_DUMMY_RETURN for Borland -- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). -- allow compilation with CC -- defined STDC for OS/2 (David Charlap) -- limit external names to 8 chars for MVS (Thomas Lund) -- in minigzip.c, use static buffers only for 16-bit systems -- fix suffix check for "minigzip -d foo.gz" -- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee) -- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) -- added makelcc.bat for lcc-win32 (Tom St Denis) -- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) -- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. -- check for unistd.h in configure (for off_t) -- remove useless check parameter in inflate_blocks_free -- avoid useless assignment of s->check to itself in inflate_blocks_new -- do not flush twice in gzclose (thanks to Ken Raeburn) -- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h -- use NO_ERRNO_H instead of enumeration of operating systems with errno.h -- work around buggy fclose on pipes for HP/UX -- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson) -- fix configure if CC is already equal to gcc - -Changes in 1.0.5 (3 Jan 98) -- Fix inflate to terminate gracefully when fed corrupted or invalid data -- Use const for rommable constants in inflate -- Eliminate memory leaks on error conditions in inflate -- Removed some vestigial code in inflate -- Update web address in README - -Changes in 1.0.4 (24 Jul 96) -- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF - bit, so the decompressor could decompress all the correct data but went - on to attempt decompressing extra garbage data. This affected minigzip too. -- zlibVersion and gzerror return const char* (needed for DLL) -- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) -- use z_error only for DEBUG (avoid problem with DLLs) - -Changes in 1.0.3 (2 Jul 96) -- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS - small and medium models; this makes the library incompatible with previous - versions for these models. (No effect in large model or on other systems.) -- return OK instead of BUF_ERROR if previous deflate call returned with - avail_out as zero but there is nothing to do -- added memcmp for non STDC compilers -- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly) -- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO) -- better check for 16-bit mode MSC (avoids problem with Symantec) - -Changes in 1.0.2 (23 May 96) -- added Windows DLL support -- added a function zlibVersion (for the DLL support) -- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model) -- Bytef is define's instead of typedef'd only for Borland C -- avoid reading uninitialized memory in example.c -- mention in README that the zlib format is now RFC1950 -- updated Makefile.dj2 -- added algorithm.doc - -Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] -- fix array overlay in deflate.c which sometimes caused bad compressed data -- fix inflate bug with empty stored block -- fix MSDOS medium model which was broken in 0.99 -- fix deflateParams() which could generate bad compressed data. -- Bytef is define'd instead of typedef'ed (work around Borland bug) -- added an INDEX file -- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), - Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas) -- speed up adler32 for modern machines without auto-increment -- added -ansi for IRIX in configure -- static_init_done in trees.c is an int -- define unlink as delete for VMS -- fix configure for QNX -- add configure branch for SCO and HPUX -- avoid many warnings (unused variables, dead assignments, etc...) -- no fdopen for BeOS -- fix the Watcom fix for 32 bit mode (define FAR as empty) -- removed redefinition of Byte for MKWERKS -- work around an MWKERKS bug (incorrect merge of all .h files) - -Changes in 0.99 (27 Jan 96) -- allow preset dictionary shared between compressor and decompressor -- allow compression level 0 (no compression) -- add deflateParams in zlib.h: allow dynamic change of compression level - and compression strategy. -- test large buffers and deflateParams in example.c -- add optional "configure" to build zlib as a shared library -- suppress Makefile.qnx, use configure instead -- fixed deflate for 64-bit systems (detected on Cray) -- fixed inflate_blocks for 64-bit systems (detected on Alpha) -- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2) -- always return Z_BUF_ERROR when deflate() has nothing to do -- deflateInit and inflateInit are now macros to allow version checking -- prefix all global functions and types with z_ with -DZ_PREFIX -- make falloc completely reentrant (inftrees.c) -- fixed very unlikely race condition in ct_static_init -- free in reverse order of allocation to help memory manager -- use zlib-1.0/* instead of zlib/* inside the tar.gz -- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith - -Wconversion -Wstrict-prototypes -Wmissing-prototypes" -- allow gzread on concatenated .gz files -- deflateEnd now returns Z_DATA_ERROR if it was premature -- deflate is finally (?) fully deterministic (no matches beyond end of input) -- Document Z_SYNC_FLUSH -- add uninstall in Makefile -- Check for __cpluplus in zlib.h -- Better test in ct_align for partial flush -- avoid harmless warnings for Borland C++ -- initialize hash_head in deflate.c -- avoid warning on fdopen (gzio.c) for HP cc -Aa -- include stdlib.h for STDC compilers -- include errno.h for Cray -- ignore error if ranlib doesn't exist -- call ranlib twice for NeXTSTEP -- use exec_prefix instead of prefix for libz.a -- renamed ct_* as _tr_* to avoid conflict with applications -- clear z->msg in inflateInit2 before any error return -- initialize opaque in example.c, gzio.c, deflate.c and inflate.c -- fixed typo in zconf.h (_GNUC__ => __GNUC__) -- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode) -- fix typo in Make_vms.com (f$trnlnm -> f$getsyi) -- in fcalloc, normalize pointer if size > 65520 bytes -- don't use special fcalloc for 32 bit Borland C++ -- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... -- use Z_BINARY instead of BINARY -- document that gzclose after gzdopen will close the file -- allow "a" as mode in gzopen. -- fix error checking in gzread -- allow skipping .gz extra-field on pipes -- added reference to Perl interface in README -- put the crc table in FAR data (I dislike more and more the medium model :) -- added get_crc_table -- added a dimension to all arrays (Borland C can't count). -- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast -- guard against multiple inclusion of *.h (for precompiled header on Mac) -- Watcom C pretends to be Microsoft C small model even in 32 bit mode. -- don't use unsized arrays to avoid silly warnings by Visual C++: - warning C4746: 'inflate_mask' : unsized array treated as '__far' - (what's wrong with far data in far model?). -- define enum out of inflate_blocks_state to allow compilation with C++ - -Changes in 0.95 (16 Aug 95) -- fix MSDOS small and medium model (now easier to adapt to any compiler) -- inlined send_bits -- fix the final (:-) bug for deflate with flush (output was correct but - not completely flushed in rare occasions). -- default window size is same for compression and decompression - (it's now sufficient to set MAX_WBITS in zconf.h). -- voidp -> voidpf and voidnp -> voidp (for consistency with other - typedefs and because voidnp was not near in large model). - -Changes in 0.94 (13 Aug 95) -- support MSDOS medium model -- fix deflate with flush (could sometimes generate bad output) -- fix deflateReset (zlib header was incorrectly suppressed) -- added support for VMS -- allow a compression level in gzopen() -- gzflush now calls fflush -- For deflate with flush, flush even if no more input is provided. -- rename libgz.a as libz.a -- avoid complex expression in infcodes.c triggering Turbo C bug -- work around a problem with gcc on Alpha (in INSERT_STRING) -- don't use inline functions (problem with some gcc versions) -- allow renaming of Byte, uInt, etc... with #define. -- avoid warning about (unused) pointer before start of array in deflate.c -- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c -- avoid reserved word 'new' in trees.c - -Changes in 0.93 (25 June 95) -- temporarily disable inline functions -- make deflate deterministic -- give enough lookahead for PARTIAL_FLUSH -- Set binary mode for stdin/stdout in minigzip.c for OS/2 -- don't even use signed char in inflate (not portable enough) -- fix inflate memory leak for segmented architectures - -Changes in 0.92 (3 May 95) -- don't assume that char is signed (problem on SGI) -- Clear bit buffer when starting a stored block -- no memcpy on Pyramid -- suppressed inftest.c -- optimized fill_window, put longest_match inline for gcc -- optimized inflate on stored blocks. -- untabify all sources to simplify patches - -Changes in 0.91 (2 May 95) -- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h -- Document the memory requirements in zconf.h -- added "make install" -- fix sync search logic in inflateSync -- deflate(Z_FULL_FLUSH) now works even if output buffer too short -- after inflateSync, don't scare people with just "lo world" -- added support for DJGPP - -Changes in 0.9 (1 May 95) -- don't assume that zalloc clears the allocated memory (the TurboC bug - was Mark's bug after all :) -- let again gzread copy uncompressed data unchanged (was working in 0.71) -- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented -- added a test of inflateSync in example.c -- moved MAX_WBITS to zconf.h because users might want to change that. -- document explicitly that zalloc(64K) on MSDOS must return a normalized - pointer (zero offset) -- added Makefiles for Microsoft C, Turbo C, Borland C++ -- faster crc32() - -Changes in 0.8 (29 April 95) -- added fast inflate (inffast.c) -- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this - is incompatible with previous versions of zlib which returned Z_OK. -- work around a TurboC compiler bug (bad code for b << 0, see infutil.h) - (actually that was not a compiler bug, see 0.81 above) -- gzread no longer reads one extra byte in certain cases -- In gzio destroy(), don't reference a freed structure -- avoid many warnings for MSDOS -- avoid the ERROR symbol which is used by MS Windows - -Changes in 0.71 (14 April 95) -- Fixed more MSDOS compilation problems :( There is still a bug with - TurboC large model. - -Changes in 0.7 (14 April 95) -- Added full inflate support. -- Simplified the crc32() interface. The pre- and post-conditioning - (one's complement) is now done inside crc32(). WARNING: this is - incompatible with previous versions; see zlib.h for the new usage. - -Changes in 0.61 (12 April 95) -- workaround for a bug in TurboC. example and minigzip now work on MSDOS. - -Changes in 0.6 (11 April 95) -- added minigzip.c -- added gzdopen to reopen a file descriptor as gzFile -- added transparent reading of non-gziped files in gzread. -- fixed bug in gzread (don't read crc as data) -- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). -- don't allocate big arrays in the stack (for MSDOS) -- fix some MSDOS compilation problems - -Changes in 0.5: -- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but - not yet Z_FULL_FLUSH. -- support decompression but only in a single step (forced Z_FINISH) -- added opaque object for zalloc and zfree. -- added deflateReset and inflateReset -- added a variable zlib_version for consistency checking. -- renamed the 'filter' parameter of deflateInit2 as 'strategy'. - Added Z_FILTERED and Z_HUFFMAN_ONLY constants. - -Changes in 0.4: -- avoid "zip" everywhere, use zlib instead of ziplib. -- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush - if compression method == 8. -- added adler32 and crc32 -- renamed deflateOptions as deflateInit2, call one or the other but not both -- added the method parameter for deflateInit2. -- added inflateInit2 -- simplied considerably deflateInit and inflateInit by not supporting - user-provided history buffer. This is supported only in deflateInit2 - and inflateInit2. - -Changes in 0.3: -- prefix all macro names with Z_ -- use Z_FINISH instead of deflateEnd to finish compression. -- added Z_HUFFMAN_ONLY -- added gzerror() diff --git a/compat/zlib/FAQ b/compat/zlib/FAQ deleted file mode 100644 index 99b7cf9..0000000 --- a/compat/zlib/FAQ +++ /dev/null @@ -1,368 +0,0 @@ - - Frequently Asked Questions about zlib - - -If your question is not there, please check the zlib home page -http://zlib.net/ which may have more recent information. -The lastest zlib FAQ is at http://zlib.net/zlib_faq.html - - - 1. Is zlib Y2K-compliant? - - Yes. zlib doesn't handle dates. - - 2. Where can I get a Windows DLL version? - - The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . - - 3. Where can I get a Visual Basic interface to zlib? - - See - * http://marknelson.us/1997/01/01/zlib-engine/ - * win32/DLL_FAQ.txt in the zlib distribution - - 4. compress() returns Z_BUF_ERROR. - - Make sure that before the call of compress(), the length of the compressed - buffer is equal to the available size of the compressed buffer and not - zero. For Visual Basic, check that this parameter is passed by reference - ("as any"), not by value ("as long"). - - 5. deflate() or inflate() returns Z_BUF_ERROR. - - Before making the call, make sure that avail_in and avail_out are not zero. - When setting the parameter flush equal to Z_FINISH, also make sure that - avail_out is big enough to allow processing all pending input. Note that a - Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be - made with more input or output space. A Z_BUF_ERROR may in fact be - unavoidable depending on how the functions are used, since it is not - possible to tell whether or not there is more output pending when - strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a - heavily annotated example. - - 6. Where's the zlib documentation (man pages, etc.)? - - It's in zlib.h . Examples of zlib usage are in the files test/example.c - and test/minigzip.c, with more in examples/ . - - 7. Why don't you use GNU autoconf or libtool or ...? - - Because we would like to keep zlib as a very small and simple package. - zlib is rather portable and doesn't need much configuration. - - 8. I found a bug in zlib. - - Most of the time, such problems are due to an incorrect usage of zlib. - Please try to reproduce the problem with a small program and send the - corresponding source to us at zlib@gzip.org . Do not send multi-megabyte - data files without prior agreement. - - 9. Why do I get "undefined reference to gzputc"? - - If "make test" produces something like - - example.o(.text+0x154): undefined reference to `gzputc' - - check that you don't have old files libz.* in /usr/lib, /usr/local/lib or - /usr/X11R6/lib. Remove any old versions, then do "make install". - -10. I need a Delphi interface to zlib. - - See the contrib/delphi directory in the zlib distribution. - -11. Can zlib handle .zip archives? - - Not by itself, no. See the directory contrib/minizip in the zlib - distribution. - -12. Can zlib handle .Z files? - - No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt - the code of uncompress on your own. - -13. How can I make a Unix shared library? - - By default a shared (and a static) library is built for Unix. So: - - make distclean - ./configure - make - -14. How do I install a shared zlib library on Unix? - - After the above, then: - - make install - - However, many flavors of Unix come with a shared zlib already installed. - Before going to the trouble of compiling a shared version of zlib and - trying to install it, you may want to check if it's already there! If you - can #include , it's there. The -lz option will probably link to - it. You can check the version at the top of zlib.h or with the - ZLIB_VERSION symbol defined in zlib.h . - -15. I have a question about OttoPDF. - - We are not the authors of OttoPDF. The real author is on the OttoPDF web - site: Joel Hainley, jhainley@myndkryme.com. - -16. Can zlib decode Flate data in an Adobe PDF file? - - Yes. See http://www.pdflib.com/ . To modify PDF forms, see - http://sourceforge.net/projects/acroformtool/ . - -17. Why am I getting this "register_frame_info not found" error on Solaris? - - After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib - generates an error such as: - - ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so: - symbol __register_frame_info: referenced symbol not found - - The symbol __register_frame_info is not part of zlib, it is generated by - the C compiler (cc or gcc). You must recompile applications using zlib - which have this problem. This problem is specific to Solaris. See - http://www.sunfreeware.com for Solaris versions of zlib and applications - using zlib. - -18. Why does gzip give an error on a file I make with compress/deflate? - - The compress and deflate functions produce data in the zlib format, which - is different and incompatible with the gzip format. The gz* functions in - zlib on the other hand use the gzip format. Both the zlib and gzip formats - use the same compressed data format internally, but have different headers - and trailers around the compressed data. - -19. Ok, so why are there two different formats? - - The gzip format was designed to retain the directory information about a - single file, such as the name and last modification date. The zlib format - on the other hand was designed for in-memory and communication channel - applications, and has a much more compact header and trailer and uses a - faster integrity check than gzip. - -20. Well that's nice, but how do I make a gzip file in memory? - - You can request that deflate write the gzip format instead of the zlib - format using deflateInit2(). You can also request that inflate decode the - gzip format using inflateInit2(). Read zlib.h for more details. - -21. Is zlib thread-safe? - - Yes. However any library routines that zlib uses and any application- - provided memory allocation routines must also be thread-safe. zlib's gz* - functions use stdio library routines, and most of zlib's functions use the - library memory allocation routines by default. zlib's *Init* functions - allow for the application to provide custom memory allocation routines. - - Of course, you should only operate on any given zlib or gzip stream from a - single thread at a time. - -22. Can I use zlib in my commercial application? - - Yes. Please read the license in zlib.h. - -23. Is zlib under the GNU license? - - No. Please read the license in zlib.h. - -24. The license says that altered source versions must be "plainly marked". So - what exactly do I need to do to meet that requirement? - - You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In - particular, the final version number needs to be changed to "f", and an - identification string should be appended to ZLIB_VERSION. Version numbers - x.x.x.f are reserved for modifications to zlib by others than the zlib - maintainers. For example, if the version of the base zlib you are altering - is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and - ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also - update the version strings in deflate.c and inftrees.c. - - For altered source distributions, you should also note the origin and - nature of the changes in zlib.h, as well as in ChangeLog and README, along - with the dates of the alterations. The origin should include at least your - name (or your company's name), and an email address to contact for help or - issues with the library. - - Note that distributing a compiled zlib library along with zlib.h and - zconf.h is also a source distribution, and so you should change - ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes - in zlib.h as you would for a full source distribution. - -25. Will zlib work on a big-endian or little-endian architecture, and can I - exchange compressed data between them? - - Yes and yes. - -26. Will zlib work on a 64-bit machine? - - Yes. It has been tested on 64-bit machines, and has no dependence on any - data types being limited to 32-bits in length. If you have any - difficulties, please provide a complete problem report to zlib@gzip.org - -27. Will zlib decompress data from the PKWare Data Compression Library? - - No. The PKWare DCL uses a completely different compressed data format than - does PKZIP and zlib. However, you can look in zlib's contrib/blast - directory for a possible solution to your problem. - -28. Can I access data randomly in a compressed stream? - - No, not without some preparation. If when compressing you periodically use - Z_FULL_FLUSH, carefully write all the pending data at those points, and - keep an index of those locations, then you can start decompression at those - points. You have to be careful to not use Z_FULL_FLUSH too often, since it - can significantly degrade compression. Alternatively, you can scan a - deflate stream once to generate an index, and then use that index for - random access. See examples/zran.c . - -29. Does zlib work on MVS, OS/390, CICS, etc.? - - It has in the past, but we have not heard of any recent evidence. There - were working ports of zlib 1.1.4 to MVS, but those links no longer work. - If you know of recent, successful applications of zlib on these operating - systems, please let us know. Thanks. - -30. Is there some simpler, easier to read version of inflate I can look at to - understand the deflate format? - - First off, you should read RFC 1951. Second, yes. Look in zlib's - contrib/puff directory. - -31. Does zlib infringe on any patents? - - As far as we know, no. In fact, that was originally the whole point behind - zlib. Look here for some more information: - - http://www.gzip.org/#faq11 - -32. Can zlib work with greater than 4 GB of data? - - Yes. inflate() and deflate() will process any amount of data correctly. - Each call of inflate() or deflate() is limited to input and output chunks - of the maximum value that can be stored in the compiler's "unsigned int" - type, but there is no limit to the number of chunks. Note however that the - strm.total_in and strm_total_out counters may be limited to 4 GB. These - counters are provided as a convenience and are not used internally by - inflate() or deflate(). The application can easily set up its own counters - updated after each call of inflate() or deflate() to count beyond 4 GB. - compress() and uncompress() may be limited to 4 GB, since they operate in a - single call. gzseek() and gztell() may be limited to 4 GB depending on how - zlib is compiled. See the zlibCompileFlags() function in zlib.h. - - The word "may" appears several times above since there is a 4 GB limit only - if the compiler's "long" type is 32 bits. If the compiler's "long" type is - 64 bits, then the limit is 16 exabytes. - -33. Does zlib have any security vulnerabilities? - - The only one that we are aware of is potentially in gzprintf(). If zlib is - compiled to use sprintf() or vsprintf(), then there is no protection - against a buffer overflow of an 8K string space (or other value as set by - gzbuffer()), other than the caller of gzprintf() assuring that the output - will not exceed 8K. On the other hand, if zlib is compiled to use - snprintf() or vsnprintf(), which should normally be the case, then there is - no vulnerability. The ./configure script will display warnings if an - insecure variation of sprintf() will be used by gzprintf(). Also the - zlibCompileFlags() function will return information on what variant of - sprintf() is used by gzprintf(). - - If you don't have snprintf() or vsnprintf() and would like one, you can - find a portable implementation here: - - http://www.ijs.si/software/snprintf/ - - Note that you should be using the most recent version of zlib. Versions - 1.1.3 and before were subject to a double-free vulnerability, and versions - 1.2.1 and 1.2.2 were subject to an access exception when decompressing - invalid compressed data. - -34. Is there a Java version of zlib? - - Probably what you want is to use zlib in Java. zlib is already included - as part of the Java SDK in the java.util.zip package. If you really want - a version of zlib written in the Java language, look on the zlib home - page for links: http://zlib.net/ . - -35. I get this or that compiler or source-code scanner warning when I crank it - up to maximally-pedantic. Can't you guys write proper code? - - Many years ago, we gave up attempting to avoid warnings on every compiler - in the universe. It just got to be a waste of time, and some compilers - were downright silly as well as contradicted each other. So now, we simply - make sure that the code always works. - -36. Valgrind (or some similar memory access checker) says that deflate is - performing a conditional jump that depends on an uninitialized value. - Isn't that a bug? - - No. That is intentional for performance reasons, and the output of deflate - is not affected. This only started showing up recently since zlib 1.2.x - uses malloc() by default for allocations, whereas earlier versions used - calloc(), which zeros out the allocated memory. Even though the code was - correct, versions 1.2.4 and later was changed to not stimulate these - checkers. - -37. Will zlib read the (insert any ancient or arcane format here) compressed - data format? - - Probably not. Look in the comp.compression FAQ for pointers to various - formats and associated software. - -38. How can I encrypt/decrypt zip files with zlib? - - zlib doesn't support encryption. The original PKZIP encryption is very - weak and can be broken with freely available programs. To get strong - encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib - compression. For PKZIP compatible "encryption", look at - http://www.info-zip.org/ - -39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? - - "gzip" is the gzip format, and "deflate" is the zlib format. They should - probably have called the second one "zlib" instead to avoid confusion with - the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 - correctly points to the zlib specification in RFC 1950 for the "deflate" - transfer encoding, there have been reports of servers and browsers that - incorrectly produce or expect raw deflate data per the deflate - specification in RFC 1951, most notably Microsoft. So even though the - "deflate" transfer encoding using the zlib format would be the more - efficient approach (and in fact exactly what the zlib format was designed - for), using the "gzip" transfer encoding is probably more reliable due to - an unfortunate choice of name on the part of the HTTP 1.1 authors. - - Bottom line: use the gzip format for HTTP 1.1 encoding. - -40. Does zlib support the new "Deflate64" format introduced by PKWare? - - No. PKWare has apparently decided to keep that format proprietary, since - they have not documented it as they have previous compression formats. In - any case, the compression improvements are so modest compared to other more - modern approaches, that it's not worth the effort to implement. - -41. I'm having a problem with the zip functions in zlib, can you help? - - There are no zip functions in zlib. You are probably using minizip by - Giles Vollant, which is found in the contrib directory of zlib. It is not - part of zlib. In fact none of the stuff in contrib is part of zlib. The - files in there are not supported by the zlib authors. You need to contact - the authors of the respective contribution for help. - -42. The match.asm code in contrib is under the GNU General Public License. - Since it's part of zlib, doesn't that mean that all of zlib falls under the - GNU GPL? - - No. The files in contrib are not part of zlib. They were contributed by - other authors and are provided as a convenience to the user within the zlib - distribution. Each item in contrib has its own license. - -43. Is zlib subject to export controls? What is its ECCN? - - zlib is not subject to export controls, and so is classified as EAR99. - -44. Can you please sign these lengthy legal documents and fax them back to us - so that we can use your software in our product? - - No. Go away. Shoo. diff --git a/compat/zlib/INDEX b/compat/zlib/INDEX deleted file mode 100644 index 2ba0641..0000000 --- a/compat/zlib/INDEX +++ /dev/null @@ -1,68 +0,0 @@ -CMakeLists.txt cmake build file -ChangeLog history of changes -FAQ Frequently Asked Questions about zlib -INDEX this file -Makefile dummy Makefile that tells you to ./configure -Makefile.in template for Unix Makefile -README guess what -configure configure script for Unix -make_vms.com makefile for VMS -test/example.c zlib usages examples for build testing -test/minigzip.c minimal gzip-like functionality for build testing -test/infcover.c inf*.c code coverage for build coverage testing -treebuild.xml XML description of source file dependencies -zconf.h.cmakein zconf.h template for cmake -zconf.h.in zconf.h template for configure -zlib.3 Man page for zlib -zlib.3.pdf Man page in PDF format -zlib.map Linux symbol information -zlib.pc.in Template for pkg-config descriptor -zlib.pc.cmakein zlib.pc template for cmake -zlib2ansi perl script to convert source files for C++ compilation - -amiga/ makefiles for Amiga SAS C -as400/ makefiles for AS/400 -doc/ documentation for formats and algorithms -msdos/ makefiles for MSDOS -nintendods/ makefile for Nintendo DS -old/ makefiles for various architectures and zlib documentation - files that have not yet been updated for zlib 1.2.x -qnx/ makefiles for QNX -watcom/ makefiles for OpenWatcom -win32/ makefiles for Windows - - zlib public header files (required for library use): -zconf.h -zlib.h - - private source files used to build the zlib library: -adler32.c -compress.c -crc32.c -crc32.h -deflate.c -deflate.h -gzclose.c -gzguts.h -gzlib.c -gzread.c -gzwrite.c -infback.c -inffast.c -inffast.h -inffixed.h -inflate.c -inflate.h -inftrees.c -inftrees.h -trees.c -trees.h -uncompr.c -zutil.c -zutil.h - - source files for sample programs -See examples/README.examples - - unsupported contributions by third parties -See contrib/README.contrib diff --git a/compat/zlib/Makefile b/compat/zlib/Makefile deleted file mode 100644 index 6bba86c..0000000 --- a/compat/zlib/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -all: - -@echo "Please use ./configure first. Thank you." - -distclean: - make -f Makefile.in distclean diff --git a/compat/zlib/Makefile.in b/compat/zlib/Makefile.in deleted file mode 100644 index 5a77949..0000000 --- a/compat/zlib/Makefile.in +++ /dev/null @@ -1,410 +0,0 @@ -# Makefile for zlib -# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile and test, type: -# ./configure; make test -# Normally configure builds both a static and a shared library. -# If you want to build just a static library, use: ./configure --static - -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o - -# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: -# make install -# To install in $HOME instead of /usr/local, use: -# make install prefix=$HOME - -CC=cc - -CFLAGS=-O -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-g -DZLIB_DEBUG -#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ -# -Wstrict-prototypes -Wmissing-prototypes - -SFLAGS=-O -LDFLAGS= -TEST_LDFLAGS=-L. libz.a -LDSHARED=$(CC) -CPP=$(CC) -E - -STATICLIB=libz.a -SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.2.11 -SHAREDLIBM=libz.so.1 -LIBS=$(STATICLIB) $(SHAREDLIBV) - -AR=ar -ARFLAGS=rc -RANLIB=ranlib -LDCONFIG=ldconfig -LDSHAREDLIBC=-lc -TAR=tar -SHELL=/bin/sh -EXE= - -prefix = /usr/local -exec_prefix = ${prefix} -libdir = ${exec_prefix}/lib -sharedlibdir = ${libdir} -includedir = ${prefix}/include -mandir = ${prefix}/share/man -man3dir = ${mandir}/man3 -pkgconfigdir = ${libdir}/pkgconfig -SRCDIR= -ZINC= -ZINCOUT=-I. - -OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o -OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o -OBJC = $(OBJZ) $(OBJG) - -PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo -PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo -PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG) - -# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo -OBJA = -PIC_OBJA = - -OBJS = $(OBJC) $(OBJA) - -PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA) - -all: static shared - -static: example$(EXE) minigzip$(EXE) - -shared: examplesh$(EXE) minigzipsh$(EXE) - -all64: example64$(EXE) minigzip64$(EXE) - -check: test - -test: all teststatic testshared - -teststatic: static - @TMPST=tmpst_$$; \ - if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \ - echo ' *** zlib test OK ***'; \ - else \ - echo ' *** zlib test FAILED ***'; false; \ - fi; \ - rm -f $$TMPST - -testshared: shared - @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ - LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \ - DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ - SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ - TMPSH=tmpsh_$$; \ - if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \ - echo ' *** zlib shared test OK ***'; \ - else \ - echo ' *** zlib shared test FAILED ***'; false; \ - fi; \ - rm -f $$TMPSH - -test64: all64 - @TMP64=tmp64_$$; \ - if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \ - echo ' *** zlib 64-bit test OK ***'; \ - else \ - echo ' *** zlib 64-bit test FAILED ***'; false; \ - fi; \ - rm -f $$TMP64 - -infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h - $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c - -infcover: infcover.o libz.a - $(CC) $(CFLAGS) -o $@ infcover.o libz.a - -cover: infcover - rm -f *.gcda - ./infcover - gcov inf*.c - -libz.a: $(OBJS) - $(AR) $(ARFLAGS) $@ $(OBJS) - -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 - -match.o: match.S - $(CPP) match.S > _match.s - $(CC) -c _match.s - mv _match.o match.o - rm -f _match.s - -match.lo: match.S - $(CPP) match.S > _match.s - $(CC) -c -fPIC _match.s - mv _match.o match.lo - rm -f _match.s - -example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h - $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c - -minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h - $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c - -example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h - $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c - -minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h - $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c - - -adler32.o: $(SRCDIR)adler32.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c - -crc32.o: $(SRCDIR)crc32.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c - -deflate.o: $(SRCDIR)deflate.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c - -infback.o: $(SRCDIR)infback.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c - -inffast.o: $(SRCDIR)inffast.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c - -inflate.o: $(SRCDIR)inflate.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c - -inftrees.o: $(SRCDIR)inftrees.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c - -trees.o: $(SRCDIR)trees.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c - -zutil.o: $(SRCDIR)zutil.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c - -compress.o: $(SRCDIR)compress.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c - -uncompr.o: $(SRCDIR)uncompr.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c - -gzclose.o: $(SRCDIR)gzclose.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c - -gzlib.o: $(SRCDIR)gzlib.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c - -gzread.o: $(SRCDIR)gzread.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c - -gzwrite.o: $(SRCDIR)gzwrite.c - $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c - - -adler32.lo: $(SRCDIR)adler32.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c - -@mv objs/adler32.o $@ - -crc32.lo: $(SRCDIR)crc32.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c - -@mv objs/crc32.o $@ - -deflate.lo: $(SRCDIR)deflate.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c - -@mv objs/deflate.o $@ - -infback.lo: $(SRCDIR)infback.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c - -@mv objs/infback.o $@ - -inffast.lo: $(SRCDIR)inffast.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c - -@mv objs/inffast.o $@ - -inflate.lo: $(SRCDIR)inflate.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c - -@mv objs/inflate.o $@ - -inftrees.lo: $(SRCDIR)inftrees.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c - -@mv objs/inftrees.o $@ - -trees.lo: $(SRCDIR)trees.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c - -@mv objs/trees.o $@ - -zutil.lo: $(SRCDIR)zutil.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c - -@mv objs/zutil.o $@ - -compress.lo: $(SRCDIR)compress.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c - -@mv objs/compress.o $@ - -uncompr.lo: $(SRCDIR)uncompr.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c - -@mv objs/uncompr.o $@ - -gzclose.lo: $(SRCDIR)gzclose.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c - -@mv objs/gzclose.o $@ - -gzlib.lo: $(SRCDIR)gzlib.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c - -@mv objs/gzlib.o $@ - -gzread.lo: $(SRCDIR)gzread.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c - -@mv objs/gzread.o $@ - -gzwrite.lo: $(SRCDIR)gzwrite.c - -@mkdir objs 2>/dev/null || test -d objs - $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c - -@mv objs/gzwrite.o $@ - - -placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a - $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS) - rm -f $(SHAREDLIB) $(SHAREDLIBM) - ln -s $@ $(SHAREDLIB) - ln -s $@ $(SHAREDLIBM) - -@rmdir objs - -example$(EXE): example.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) - -minigzip$(EXE): minigzip.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) - -examplesh$(EXE): example.o $(SHAREDLIBV) - $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV) - -minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) - $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV) - -example64$(EXE): example64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) - -minigzip64$(EXE): minigzip64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) - -install-libs: $(LIBS) - -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi - -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi - -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi - -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi - -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi - rm -f $(DESTDIR)$(libdir)/$(STATICLIB) - cp $(STATICLIB) $(DESTDIR)$(libdir) - chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB) - -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1 - -@if test -n "$(SHAREDLIBV)"; then \ - rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \ - cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \ - echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \ - chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \ - echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \ - rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \ - ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \ - ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \ - ($(LDCONFIG) || true) >/dev/null 2>&1; \ - fi - rm -f $(DESTDIR)$(man3dir)/zlib.3 - cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir) - chmod 644 $(DESTDIR)$(man3dir)/zlib.3 - rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc - cp zlib.pc $(DESTDIR)$(pkgconfigdir) - chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc -# The ranlib in install is needed on NeXTSTEP which checks file times -# ldconfig is for Linux - -install: install-libs - -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi - rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h - cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir) - chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h - -uninstall: - cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h - cd $(DESTDIR)$(libdir) && rm -f libz.a; \ - if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \ - rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ - fi - cd $(DESTDIR)$(man3dir) && rm -f zlib.3 - cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc - -docs: zlib.3.pdf - -zlib.3.pdf: $(SRCDIR)zlib.3 - groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@ - -zconf.h.cmakein: $(SRCDIR)zconf.h.in - -@ TEMPFILE=zconfh_$$; \ - echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\ - sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\ - touch -r $(SRCDIR)zconf.h.in $@ &&\ - rm $$TEMPFILE - -zconf: $(SRCDIR)zconf.h.in - cp -p $(SRCDIR)zconf.h.in zconf.h - -mostlyclean: clean -clean: - rm -f *.o *.lo *~ \ - example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ - example64$(EXE) minigzip64$(EXE) \ - infcover \ - libz.* foo.gz so_locations \ - _match.s maketree contrib/infback9/*.o - rm -rf objs - rm -f *.gcda *.gcno *.gcov - rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov - -maintainer-clean: distclean -distclean: clean zconf zconf.h.cmakein docs - rm -f Makefile zlib.pc configure.log - -@rm -f .DS_Store - @if [ -f Makefile.in ]; then \ - printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \ - printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \ - touch -r $(SRCDIR)Makefile.in Makefile ; fi - @if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi - @if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi - -tags: - etags $(SRCDIR)*.[ch] - -adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h -gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h -compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h -crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h -deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h -infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h -inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h -inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h -trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h - -adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h -gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h -compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h -crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h -deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h -infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h -inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h -inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h -trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h diff --git a/compat/zlib/README b/compat/zlib/README deleted file mode 100644 index 51106de..0000000 --- a/compat/zlib/README +++ /dev/null @@ -1,115 +0,0 @@ -ZLIB DATA COMPRESSION LIBRARY - -zlib 1.2.11 is a general purpose data compression library. All the code is -thread safe. The data format used by the zlib library is described by RFCs -(Request for Comments) 1950 to 1952 in the files -http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and -rfc1952 (gzip format). - -All functions of the compression library are documented in the file zlib.h -(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example -of the library is given in the file test/example.c which also tests that -the library is working correctly. Another example is given in the file -test/minigzip.c. The compression library itself is composed of all source -files in the root directory. - -To compile all files and run the test program, follow the instructions given at -the top of Makefile.in. In short "./configure; make test", and if that goes -well, "make install" should work for most flavors of Unix. For Windows, use -one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use -make_vms.com. - -Questions about zlib should be sent to , or to Gilles Vollant - for the Windows DLL version. The zlib home page is -http://zlib.net/ . Before reporting a problem, please check this site to -verify that you have the latest version of zlib; otherwise get the latest -version and check whether the problem still exists or not. - -PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help. - -Mark Nelson wrote an article about zlib for the Jan. 1997 -issue of Dr. Dobb's Journal; a copy of the article is available at -http://marknelson.us/1997/01/01/zlib-engine/ . - -The changes made in version 1.2.11 are documented in the file ChangeLog. - -Unsupported third party contributions are provided in directory contrib/ . - -zlib is available in Java using the java.util.zip package, documented at -http://java.sun.com/developer/technicalArticles/Programming/compression/ . - -A Perl interface to zlib written by Paul Marquess is available -at CPAN (Comprehensive Perl Archive Network) sites, including -http://search.cpan.org/~pmqs/IO-Compress-Zlib/ . - -A Python interface to zlib written by A.M. Kuchling is -available in Python 1.5 and later versions, see -http://docs.python.org/library/zlib.html . - -zlib is built into tcl: http://wiki.tcl.tk/4610 . - -An experimental package to read and write files in .zip format, written on top -of zlib by Gilles Vollant , is available in the -contrib/minizip directory of zlib. - - -Notes for some targets: - -- For Windows DLL versions, please see win32/DLL_FAQ.txt - -- For 64-bit Irix, deflate.c must be compiled without any optimization. With - -O, one libpng test fails. The test works in 32 bit mode (with the -n32 - compiler flag). The compiler bug has been reported to SGI. - -- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works - when compiled with cc. - -- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is - necessary to get gzprintf working correctly. This is done by configure. - -- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with - other compilers. Use "make test" to check your compiler. - -- gzdopen is not supported on RISCOS or BEOS. - -- For PalmOs, see http://palmzlib.sourceforge.net/ - - -Acknowledgments: - - The deflate format used by zlib was defined by Phil Katz. The deflate and - zlib specifications were written by L. Peter Deutsch. Thanks to all the - people who reported problems and suggested various improvements in zlib; they - are too numerous to cite here. - -Copyright notice: - - (C) 1995-2017 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* receiving -lengthy legal documents to sign. The sources are provided for free but without -warranty of any kind. The library has been entirely written by Jean-loup -Gailly and Mark Adler; it does not include third-party code. - -If you redistribute modified sources, we would appreciate that you include in -the file ChangeLog history information documenting your changes. Please read -the FAQ for more information on the distribution of modified source versions. diff --git a/compat/zlib/adler32.c b/compat/zlib/adler32.c deleted file mode 100644 index d0be438..0000000 --- a/compat/zlib/adler32.c +++ /dev/null @@ -1,186 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2011, 2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zutil.h" - -local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); - -#define BASE 65521U /* largest prime smaller than 65536 */ -#define NMAX 5552 -/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ - -#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} -#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); -#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); -#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); -#define DO16(buf) DO8(buf,0); DO8(buf,8); - -/* use NO_DIVIDE if your processor does not do division in hardware -- - try it both ways to see which is faster */ -#ifdef NO_DIVIDE -/* note that this assumes BASE is 65521, where 65536 % 65521 == 15 - (thank you to John Reiser for pointing this out) */ -# define CHOP(a) \ - do { \ - unsigned long tmp = a >> 16; \ - a &= 0xffffUL; \ - a += (tmp << 4) - tmp; \ - } while (0) -# define MOD28(a) \ - do { \ - CHOP(a); \ - if (a >= BASE) a -= BASE; \ - } while (0) -# define MOD(a) \ - do { \ - CHOP(a); \ - MOD28(a); \ - } while (0) -# define MOD63(a) \ - do { /* this assumes a is not negative */ \ - z_off64_t tmp = a >> 32; \ - a &= 0xffffffffL; \ - a += (tmp << 8) - (tmp << 5) + tmp; \ - tmp = a >> 16; \ - a &= 0xffffL; \ - a += (tmp << 4) - tmp; \ - tmp = a >> 16; \ - a &= 0xffffL; \ - a += (tmp << 4) - tmp; \ - if (a >= BASE) a -= BASE; \ - } while (0) -#else -# define MOD(a) a %= BASE -# define MOD28(a) a %= BASE -# define MOD63(a) a %= BASE -#endif - -/* ========================================================================= */ -uLong ZEXPORT adler32_z(adler, buf, len) - uLong adler; - const Bytef *buf; - z_size_t len; -{ - unsigned long sum2; - unsigned n; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (len == 1) { - adler += buf[0]; - if (adler >= BASE) - adler -= BASE; - sum2 += adler; - if (sum2 >= BASE) - sum2 -= BASE; - return adler | (sum2 << 16); - } - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (buf == Z_NULL) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (len < 16) { - while (len--) { - adler += *buf++; - sum2 += adler; - } - if (adler >= BASE) - adler -= BASE; - MOD28(sum2); /* only added so many BASE's */ - return adler | (sum2 << 16); - } - - /* do length NMAX blocks -- requires just one modulo operation */ - while (len >= NMAX) { - len -= NMAX; - n = NMAX / 16; /* NMAX is divisible by 16 */ - do { - DO16(buf); /* 16 sums unrolled */ - buf += 16; - } while (--n); - MOD(adler); - MOD(sum2); - } - - /* do remaining bytes (less than NMAX, still just one modulo) */ - if (len) { /* avoid modulos if none remaining */ - while (len >= 16) { - len -= 16; - DO16(buf); - buf += 16; - } - while (len--) { - adler += *buf++; - sum2 += adler; - } - MOD(adler); - MOD(sum2); - } - - /* return recombined sums */ - return adler | (sum2 << 16); -} - -/* ========================================================================= */ -uLong ZEXPORT adler32(adler, buf, len) - uLong adler; - const Bytef *buf; - uInt len; -{ - return adler32_z(adler, buf, len); -} - -/* ========================================================================= */ -local uLong adler32_combine_(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off64_t len2; -{ - unsigned long sum1; - unsigned long sum2; - unsigned rem; - - /* for negative len, return invalid adler32 as a clue for debugging */ - if (len2 < 0) - return 0xffffffffUL; - - /* the derivation of this formula is left as an exercise for the reader */ - MOD63(len2); /* assumes len2 >= 0 */ - rem = (unsigned)len2; - sum1 = adler1 & 0xffff; - sum2 = rem * sum1; - MOD(sum2); - sum1 += (adler2 & 0xffff) + BASE - 1; - sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; - if (sum1 >= BASE) sum1 -= BASE; - if (sum1 >= BASE) sum1 -= BASE; - if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1); - if (sum2 >= BASE) sum2 -= BASE; - return sum1 | (sum2 << 16); -} - -/* ========================================================================= */ -uLong ZEXPORT adler32_combine(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off_t len2; -{ - return adler32_combine_(adler1, adler2, len2); -} - -uLong ZEXPORT adler32_combine64(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off64_t len2; -{ - return adler32_combine_(adler1, adler2, len2); -} diff --git a/compat/zlib/amiga/Makefile.pup b/compat/zlib/amiga/Makefile.pup deleted file mode 100644 index 8940c12..0000000 --- a/compat/zlib/amiga/Makefile.pup +++ /dev/null @@ -1,69 +0,0 @@ -# Amiga powerUP (TM) Makefile -# makefile for libpng and SAS C V6.58/7.00 PPC compiler -# Copyright (C) 1998 by Andreas R. Kleinert - -LIBNAME = libzip.a - -CC = scppc -CFLAGS = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL \ - OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8 NOVER -AR = ppc-amigaos-ar cr -RANLIB = ppc-amigaos-ranlib -LD = ppc-amigaos-ld -r -LDFLAGS = -o -LDLIBS = LIB:scppc.a LIB:end.o -RM = delete quiet - -OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \ - uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o - -TEST_OBJS = example.o minigzip.o - -all: example minigzip - -check: test -test: all - example - echo hello world | minigzip | minigzip -d - -$(LIBNAME): $(OBJS) - $(AR) $@ $(OBJS) - -$(RANLIB) $@ - -example: example.o $(LIBNAME) - $(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS) - -minigzip: minigzip.o $(LIBNAME) - $(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS) - -mostlyclean: clean -clean: - $(RM) *.o example minigzip $(LIBNAME) foo.gz - -zip: - zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \ - descrip.mms *.[ch] - -tgz: - cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \ - zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch] - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -adler32.o: zlib.h zconf.h -compress.o: zlib.h zconf.h -crc32.o: crc32.h zlib.h zconf.h -deflate.o: deflate.h zutil.h zlib.h zconf.h -example.o: zlib.h zconf.h -gzclose.o: zlib.h zconf.h gzguts.h -gzlib.o: zlib.h zconf.h gzguts.h -gzread.o: zlib.h zconf.h gzguts.h -gzwrite.o: zlib.h zconf.h gzguts.h -inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inftrees.o: zutil.h zlib.h zconf.h inftrees.h -minigzip.o: zlib.h zconf.h -trees.o: deflate.h zutil.h zlib.h zconf.h trees.h -uncompr.o: zlib.h zconf.h -zutil.o: zutil.h zlib.h zconf.h diff --git a/compat/zlib/amiga/Makefile.sas b/compat/zlib/amiga/Makefile.sas deleted file mode 100644 index 749e291..0000000 --- a/compat/zlib/amiga/Makefile.sas +++ /dev/null @@ -1,68 +0,0 @@ -# SMakefile for zlib -# Modified from the standard UNIX Makefile Copyright Jean-loup Gailly -# Osma Ahvenlampi -# Amiga, SAS/C 6.56 & Smake - -CC=sc -CFLAGS=OPT -#CFLAGS=OPT CPU=68030 -#CFLAGS=DEBUG=LINE -LDFLAGS=LIB z.lib - -SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \ - NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX \ - DEF=POSTINC - -OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \ - uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o - -TEST_OBJS = example.o minigzip.o - -all: SCOPTIONS example minigzip - -check: test -test: all - example - echo hello world | minigzip | minigzip -d - -install: z.lib - copy clone zlib.h zconf.h INCLUDE: - copy clone z.lib LIB: - -z.lib: $(OBJS) - oml z.lib r $(OBJS) - -example: example.o z.lib - $(CC) $(CFLAGS) LINK TO $@ example.o $(LDFLAGS) - -minigzip: minigzip.o z.lib - $(CC) $(CFLAGS) LINK TO $@ minigzip.o $(LDFLAGS) - -mostlyclean: clean -clean: - -delete force quiet example minigzip *.o z.lib foo.gz *.lnk SCOPTIONS - -SCOPTIONS: Makefile.sas - copy to $@ (uLong)max ? max : (uInt)left; - left -= stream.avail_out; - } - if (stream.avail_in == 0) { - stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen; - sourceLen -= stream.avail_in; - } - err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH); - } while (err == Z_OK); - - *destLen = stream.total_out; - deflateEnd(&stream); - return err == Z_STREAM_END ? Z_OK : err; -} - -/* =========================================================================== - */ -int ZEXPORT compress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); -} - -/* =========================================================================== - If the default memLevel or windowBits for deflateInit() is changed, then - this function needs to be updated. - */ -uLong ZEXPORT compressBound (sourceLen) - uLong sourceLen; -{ - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + - (sourceLen >> 25) + 13; -} diff --git a/compat/zlib/configure b/compat/zlib/configure deleted file mode 100755 index e974d1f..0000000 --- a/compat/zlib/configure +++ /dev/null @@ -1,921 +0,0 @@ -#!/bin/sh -# configure script for zlib. -# -# Normally configure builds both a static and a shared library. -# If you want to build just a static library, use: ./configure --static -# -# To impose specific compiler or flags or install directory, use for example: -# prefix=$HOME CC=cc CFLAGS="-O4" ./configure -# or for csh/tcsh users: -# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure) - -# Incorrect settings of CC or CFLAGS may prevent creating a shared library. -# If you have problems, try without defining CC and CFLAGS before reporting -# an error. - -# start off configure.log -echo -------------------- >> configure.log -echo $0 $* >> configure.log -date >> configure.log - -# get source directory -SRCDIR=`dirname $0` -if test $SRCDIR = "."; then - ZINC="" - ZINCOUT="-I." - SRCDIR="" -else - ZINC='-include zconf.h' - ZINCOUT='-I. -I$(SRCDIR)' - SRCDIR="$SRCDIR/" -fi - -# set command prefix for cross-compilation -if [ -n "${CHOST}" ]; then - uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`" - CROSS_PREFIX="${CHOST}-" -fi - -# destination name for static library -STATICLIB=libz.a - -# extract zlib version numbers from zlib.h -VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h` -VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}zlib.h` -VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h` -VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h` - -# establish commands for library building -if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then - AR=${AR-"${CROSS_PREFIX}ar"} - test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log -else - AR=${AR-"ar"} - test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log -fi -ARFLAGS=${ARFLAGS-"rc"} -if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then - RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"} - test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log -else - RANLIB=${RANLIB-"ranlib"} -fi -if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then - NM=${NM-"${CROSS_PREFIX}nm"} - test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log -else - NM=${NM-"nm"} -fi - -# set defaults before processing command line options -LDCONFIG=${LDCONFIG-"ldconfig"} -LDSHAREDLIBC="${LDSHAREDLIBC--lc}" -ARCHS= -prefix=${prefix-/usr/local} -exec_prefix=${exec_prefix-'${prefix}'} -libdir=${libdir-'${exec_prefix}/lib'} -sharedlibdir=${sharedlibdir-'${libdir}'} -includedir=${includedir-'${prefix}/include'} -mandir=${mandir-'${prefix}/share/man'} -shared_ext='.so' -shared=1 -solo=0 -cover=0 -zprefix=0 -zconst=0 -build64=0 -gcc=0 -warn=0 -debug=0 -old_cc="$CC" -old_cflags="$CFLAGS" -OBJC='$(OBJZ) $(OBJG)' -PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)' - -# leave this script, optionally in a bad way -leave() -{ - if test "$*" != "0"; then - echo "** $0 aborting." | tee -a configure.log - fi - rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version - echo -------------------- >> configure.log - echo >> configure.log - echo >> configure.log - exit $1 -} - -# process command line options -while test $# -ge 1 -do -case "$1" in - -h* | --help) - echo 'usage:' | tee -a configure.log - echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log - echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log - echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log - exit 0 ;; - -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;; - -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;; - -l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;; - --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;; - -i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;; - -u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;; - -p* | --prefix) prefix="$2"; shift; shift ;; - -e* | --eprefix) exec_prefix="$2"; shift; shift ;; - -l* | --libdir) libdir="$2"; shift; shift ;; - -i* | --includedir) includedir="$2"; shift; shift ;; - -s* | --shared | --enable-shared) shared=1; shift ;; - -t | --static) shared=0; shift ;; - --solo) solo=1; shift ;; - --cover) cover=1; shift ;; - -z* | --zprefix) zprefix=1; shift ;; - -6* | --64) build64=1; shift ;; - -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;; - --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;; - --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;; - -c* | --const) zconst=1; shift ;; - -w* | --warn) warn=1; shift ;; - -d* | --debug) debug=1; shift ;; - *) - echo "unknown option: $1" | tee -a configure.log - echo "$0 --help for help" | tee -a configure.log - leave 1;; - esac -done - -# temporary file name -test=ztest$$ - -# put arguments in log, also put test file in log if used in arguments -show() -{ - case "$*" in - *$test.c*) - echo === $test.c === >> configure.log - cat $test.c >> configure.log - echo === >> configure.log;; - esac - echo $* >> configure.log -} - -# check for gcc vs. cc and set compile and link flags based on the system identified by uname -cat > $test.c <&1` in - *gcc*) gcc=1 ;; - *clang*) gcc=1 ;; -esac - -show $cc -c $test.c -if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then - echo ... using gcc >> configure.log - CC="$cc" - CFLAGS="${CFLAGS--O3}" - SFLAGS="${CFLAGS--O3} -fPIC" - if test "$ARCHS"; then - CFLAGS="${CFLAGS} ${ARCHS}" - LDFLAGS="${LDFLAGS} ${ARCHS}" - fi - if test $build64 -eq 1; then - CFLAGS="${CFLAGS} -m64" - SFLAGS="${SFLAGS} -m64" - fi - if test "$warn" -eq 1; then - if test "$zconst" -eq 1; then - CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST" - else - CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" - fi - fi - if test $debug -eq 1; then - CFLAGS="${CFLAGS} -DZLIB_DEBUG" - SFLAGS="${SFLAGS} -DZLIB_DEBUG" - fi - if test -z "$uname"; then - uname=`(uname -s || echo unknown) 2>/dev/null` - fi - case "$uname" in - Linux* | linux* | GNU | GNU/* | solaris*) - LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;; - *BSD | *bsd* | DragonFly) - LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} - LDCONFIG="ldconfig -m" ;; - CYGWIN* | Cygwin* | cygwin* | OS/2*) - EXE='.exe' ;; - MINGW* | mingw*) -# temporary bypass - rm -f $test.[co] $test $test$shared_ext - echo "Please use win32/Makefile.gcc instead." | tee -a configure.log - leave 1 - LDSHARED=${LDSHARED-"$cc -shared"} - LDSHAREDLIBC="" - EXE='.exe' ;; - QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 - # (alain.bonnefoy@icbt.com) - LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;; - HP-UX*) - LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} - case `(uname -m || echo unknown) 2>/dev/null` in - ia64) - shared_ext='.so' - SHAREDLIB='libz.so' ;; - *) - shared_ext='.sl' - SHAREDLIB='libz.sl' ;; - esac ;; - Darwin* | darwin*) - shared_ext='.dylib' - SHAREDLIB=libz$shared_ext - SHAREDLIBV=libz.$VER$shared_ext - SHAREDLIBM=libz.$VER1$shared_ext - LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} - if libtool -V 2>&1 | grep Apple > /dev/null; then - AR="libtool" - else - AR="/usr/bin/libtool" - fi - ARFLAGS="-o" ;; - *) LDSHARED=${LDSHARED-"$cc -shared"} ;; - esac -else - # find system name and corresponding cc options - CC=${CC-cc} - gcc=0 - echo ... using $CC >> configure.log - if test -z "$uname"; then - uname=`(uname -sr || echo unknown) 2>/dev/null` - fi - case "$uname" in - HP-UX*) SFLAGS=${CFLAGS-"-O +z"} - CFLAGS=${CFLAGS-"-O"} -# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} - LDSHARED=${LDSHARED-"ld -b"} - case `(uname -m || echo unknown) 2>/dev/null` in - ia64) - shared_ext='.so' - SHAREDLIB='libz.so' ;; - *) - shared_ext='.sl' - SHAREDLIB='libz.sl' ;; - esac ;; - IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."} - CFLAGS=${CFLAGS-"-ansi -O2"} - LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;; - OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"} - CFLAGS=${CFLAGS-"-O -std1"} - LDFLAGS="${LDFLAGS} -Wl,-rpath,." - LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;; - OSF1*) SFLAGS=${CFLAGS-"-O -std1"} - CFLAGS=${CFLAGS-"-O -std1"} - LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;; - QNX*) SFLAGS=${CFLAGS-"-4 -O"} - CFLAGS=${CFLAGS-"-4 -O"} - LDSHARED=${LDSHARED-"cc"} - RANLIB=${RANLIB-"true"} - AR="cc" - ARFLAGS="-A" ;; - SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "} - CFLAGS=${CFLAGS-"-O3"} - LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;; - SunOS\ 5* | solaris*) - LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"} - SFLAGS=${CFLAGS-"-fast -KPIC"} - CFLAGS=${CFLAGS-"-fast"} - if test $build64 -eq 1; then - # old versions of SunPRO/Workshop/Studio don't support -m64, - # but newer ones do. Check for it. - flag64=`$CC -flags | egrep -- '^-m64'` - if test x"$flag64" != x"" ; then - CFLAGS="${CFLAGS} -m64" - SFLAGS="${SFLAGS} -m64" - else - case `(uname -m || echo unknown) 2>/dev/null` in - i86*) - SFLAGS="$SFLAGS -xarch=amd64" - CFLAGS="$CFLAGS -xarch=amd64" ;; - *) - SFLAGS="$SFLAGS -xarch=v9" - CFLAGS="$CFLAGS -xarch=v9" ;; - esac - fi - fi - if test -n "$ZINC"; then - ZINC='-I- -I. -I$(SRCDIR)' - fi - ;; - SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"} - CFLAGS=${CFLAGS-"-O2"} - LDSHARED=${LDSHARED-"ld"} ;; - SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"} - CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"} - LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;; - UNIX_System_V\ 4.2.0) - SFLAGS=${CFLAGS-"-KPIC -O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -G"} ;; - UNIX_SV\ 4.2MP) - SFLAGS=${CFLAGS-"-Kconform_pic -O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -G"} ;; - OpenUNIX\ 5) - SFLAGS=${CFLAGS-"-KPIC -O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -G"} ;; - AIX*) # Courtesy of dbakker@arrayasolutions.com - SFLAGS=${CFLAGS-"-O -qmaxmem=8192"} - CFLAGS=${CFLAGS-"-O -qmaxmem=8192"} - LDSHARED=${LDSHARED-"xlc -G"} ;; - # send working options for other systems to zlib@gzip.org - *) SFLAGS=${CFLAGS-"-O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -shared"} ;; - esac -fi - -# destination names for shared library if not defined above -SHAREDLIB=${SHAREDLIB-"libz$shared_ext"} -SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} -SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} - -echo >> configure.log - -# define functions for testing compiler and library characteristics and logging the results - -cat > $test.c </dev/null; then - try() - { - show $* - test "`( $* ) 2>&1 | tee -a configure.log`" = "" - } - echo - using any output from compiler to indicate an error >> configure.log -else - try() - { - show $* - ( $* ) >> configure.log 2>&1 - ret=$? - if test $ret -ne 0; then - echo "(exit code "$ret")" >> configure.log - fi - return $ret - } -fi - -tryboth() -{ - show $* - got=`( $* ) 2>&1` - ret=$? - printf %s "$got" >> configure.log - if test $ret -ne 0; then - return $ret - fi - test "$got" = "" -} - -cat > $test.c << EOF -int foo() { return 0; } -EOF -echo "Checking for obsessive-compulsive compiler options..." >> configure.log -if try $CC -c $CFLAGS $test.c; then - : -else - echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log - leave 1 -fi - -echo >> configure.log - -# see if shared library build supported -cat > $test.c <> configure.log - show "$NM $test.o | grep _hello" - if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then - CPP="$CPP -DNO_UNDERLINE" - echo Checking for underline in external names... No. | tee -a configure.log - else - echo Checking for underline in external names... Yes. | tee -a configure.log - fi ;; -esac - -echo >> configure.log - -# check for size_t -cat > $test.c < -#include -size_t dummy = 0; -EOF -if try $CC -c $CFLAGS $test.c; then - echo "Checking for size_t... Yes." | tee -a configure.log - need_sizet=0 -else - echo "Checking for size_t... No." | tee -a configure.log - need_sizet=1 -fi - -echo >> configure.log - -# find the size_t integer type, if needed -if test $need_sizet -eq 1; then - cat > $test.c < $test.c < -int main(void) { - if (sizeof(void *) <= sizeof(int)) puts("int"); - else if (sizeof(void *) <= sizeof(long)) puts("long"); - else puts("z_longlong"); - return 0; -} -EOF - else - echo "Checking for long long... No." | tee -a configure.log - cat > $test.c < -int main(void) { - if (sizeof(void *) <= sizeof(int)) puts("int"); - else puts("long"); - return 0; -} -EOF - fi - if try $CC $CFLAGS -o $test $test.c; then - sizet=`./$test` - echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log - else - echo "Failed to find a pointer-size integer type." | tee -a configure.log - leave 1 - fi -fi - -if test $need_sizet -eq 1; then - CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}" - SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}" -fi - -echo >> configure.log - -# check for large file support, and if none, check for fseeko() -cat > $test.c < -off64_t dummy = 0; -EOF -if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then - CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1" - SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" - ALL="${ALL} all64" - TEST="${TEST} test64" - echo "Checking for off64_t... Yes." | tee -a configure.log - echo "Checking for fseeko... Yes." | tee -a configure.log -else - echo "Checking for off64_t... No." | tee -a configure.log - echo >> configure.log - cat > $test.c < -int main(void) { - fseeko(NULL, 0, 0); - return 0; -} -EOF - if try $CC $CFLAGS -o $test $test.c; then - echo "Checking for fseeko... Yes." | tee -a configure.log - else - CFLAGS="${CFLAGS} -DNO_FSEEKO" - SFLAGS="${SFLAGS} -DNO_FSEEKO" - echo "Checking for fseeko... No." | tee -a configure.log - fi -fi - -echo >> configure.log - -# check for strerror() for use by gz* functions -cat > $test.c < -#include -int main() { return strlen(strerror(errno)); } -EOF -if try $CC $CFLAGS -o $test $test.c; then - echo "Checking for strerror... Yes." | tee -a configure.log -else - CFLAGS="${CFLAGS} -DNO_STRERROR" - SFLAGS="${SFLAGS} -DNO_STRERROR" - echo "Checking for strerror... No." | tee -a configure.log -fi - -# copy clean zconf.h for subsequent edits -cp -p ${SRCDIR}zconf.h.in zconf.h - -echo >> configure.log - -# check for unistd.h and save result in zconf.h -cat > $test.c < -int main() { return 0; } -EOF -if try $CC -c $CFLAGS $test.c; then - sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h - mv zconf.temp.h zconf.h - echo "Checking for unistd.h... Yes." | tee -a configure.log -else - echo "Checking for unistd.h... No." | tee -a configure.log -fi - -echo >> configure.log - -# check for stdarg.h and save result in zconf.h -cat > $test.c < -int main() { return 0; } -EOF -if try $CC -c $CFLAGS $test.c; then - sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h - mv zconf.temp.h zconf.h - echo "Checking for stdarg.h... Yes." | tee -a configure.log -else - echo "Checking for stdarg.h... No." | tee -a configure.log -fi - -# if the z_ prefix was requested, save that in zconf.h -if test $zprefix -eq 1; then - sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h - mv zconf.temp.h zconf.h - echo >> configure.log - echo "Using z_ prefix on all symbols." | tee -a configure.log -fi - -# if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists -if test $solo -eq 1; then - sed '/#define ZCONF_H/a\ -#define Z_SOLO - -' < zconf.h > zconf.temp.h - mv zconf.temp.h zconf.h -OBJC='$(OBJZ)' -PIC_OBJC='$(PIC_OBJZ)' -fi - -# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X -if test $cover -eq 1; then - CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" - if test -n "$GCC_CLASSIC"; then - CC=$GCC_CLASSIC - fi -fi - -echo >> configure.log - -# conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions -# (using stdarg or not), with or without "n" (proving size of buffer), and with or without a -# return value. The most secure result is vsnprintf() with a return value. snprintf() with a -# return value is secure as well, but then gzprintf() will be limited to 20 arguments. -cat > $test.c < -#include -#include "zconf.h" -int main() -{ -#ifndef STDC - choke me -#endif - return 0; -} -EOF -if try $CC -c $CFLAGS $test.c; then - echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log - - echo >> configure.log - cat > $test.c < -#include -int mytest(const char *fmt, ...) -{ - char buf[20]; - va_list ap; - va_start(ap, fmt); - vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - return 0; -} -int main() -{ - return (mytest("Hello%d\n", 1)); -} -EOF - if try $CC $CFLAGS -o $test $test.c; then - echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log - - echo >> configure.log - cat >$test.c < -#include -int mytest(const char *fmt, ...) -{ - int n; - char buf[20]; - va_list ap; - va_start(ap, fmt); - n = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - return n; -} -int main() -{ - return (mytest("Hello%d\n", 1)); -} -EOF - - if try $CC -c $CFLAGS $test.c; then - echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log - else - CFLAGS="$CFLAGS -DHAS_vsnprintf_void" - SFLAGS="$SFLAGS -DHAS_vsnprintf_void" - echo "Checking for return value of vsnprintf()... No." | tee -a configure.log - echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log - echo " can build but will be open to possible string-format security" | tee -a configure.log - echo " vulnerabilities." | tee -a configure.log - fi - else - CFLAGS="$CFLAGS -DNO_vsnprintf" - SFLAGS="$SFLAGS -DNO_vsnprintf" - echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log - echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log - echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log - echo " vulnerabilities." | tee -a configure.log - - echo >> configure.log - cat >$test.c < -#include -int mytest(const char *fmt, ...) -{ - int n; - char buf[20]; - va_list ap; - va_start(ap, fmt); - n = vsprintf(buf, fmt, ap); - va_end(ap); - return n; -} -int main() -{ - return (mytest("Hello%d\n", 1)); -} -EOF - - if try $CC -c $CFLAGS $test.c; then - echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log - else - CFLAGS="$CFLAGS -DHAS_vsprintf_void" - SFLAGS="$SFLAGS -DHAS_vsprintf_void" - echo "Checking for return value of vsprintf()... No." | tee -a configure.log - echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log - echo " can build but will be open to possible string-format security" | tee -a configure.log - echo " vulnerabilities." | tee -a configure.log - fi - fi -else - echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log - - echo >> configure.log - cat >$test.c < -int mytest() -{ - char buf[20]; - snprintf(buf, sizeof(buf), "%s", "foo"); - return 0; -} -int main() -{ - return (mytest()); -} -EOF - - if try $CC $CFLAGS -o $test $test.c; then - echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log - - echo >> configure.log - cat >$test.c < -int mytest() -{ - char buf[20]; - return snprintf(buf, sizeof(buf), "%s", "foo"); -} -int main() -{ - return (mytest()); -} -EOF - - if try $CC -c $CFLAGS $test.c; then - echo "Checking for return value of snprintf()... Yes." | tee -a configure.log - else - CFLAGS="$CFLAGS -DHAS_snprintf_void" - SFLAGS="$SFLAGS -DHAS_snprintf_void" - echo "Checking for return value of snprintf()... No." | tee -a configure.log - echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log - echo " can build but will be open to possible string-format security" | tee -a configure.log - echo " vulnerabilities." | tee -a configure.log - fi - else - CFLAGS="$CFLAGS -DNO_snprintf" - SFLAGS="$SFLAGS -DNO_snprintf" - echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log - echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log - echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log - echo " vulnerabilities." | tee -a configure.log - - echo >> configure.log - cat >$test.c < -int mytest() -{ - char buf[20]; - return sprintf(buf, "%s", "foo"); -} -int main() -{ - return (mytest()); -} -EOF - - if try $CC -c $CFLAGS $test.c; then - echo "Checking for return value of sprintf()... Yes." | tee -a configure.log - else - CFLAGS="$CFLAGS -DHAS_sprintf_void" - SFLAGS="$SFLAGS -DHAS_sprintf_void" - echo "Checking for return value of sprintf()... No." | tee -a configure.log - echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log - echo " can build but will be open to possible string-format security" | tee -a configure.log - echo " vulnerabilities." | tee -a configure.log - fi - fi -fi - -# see if we can hide zlib internal symbols that are linked between separate source files -if test "$gcc" -eq 1; then - echo >> configure.log - cat > $test.c <> configure.log -echo ALL = $ALL >> configure.log -echo AR = $AR >> configure.log -echo ARFLAGS = $ARFLAGS >> configure.log -echo CC = $CC >> configure.log -echo CFLAGS = $CFLAGS >> configure.log -echo CPP = $CPP >> configure.log -echo EXE = $EXE >> configure.log -echo LDCONFIG = $LDCONFIG >> configure.log -echo LDFLAGS = $LDFLAGS >> configure.log -echo LDSHARED = $LDSHARED >> configure.log -echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log -echo OBJC = $OBJC >> configure.log -echo PIC_OBJC = $PIC_OBJC >> configure.log -echo RANLIB = $RANLIB >> configure.log -echo SFLAGS = $SFLAGS >> configure.log -echo SHAREDLIB = $SHAREDLIB >> configure.log -echo SHAREDLIBM = $SHAREDLIBM >> configure.log -echo SHAREDLIBV = $SHAREDLIBV >> configure.log -echo STATICLIB = $STATICLIB >> configure.log -echo TEST = $TEST >> configure.log -echo VER = $VER >> configure.log -echo Z_U4 = $Z_U4 >> configure.log -echo SRCDIR = $SRCDIR >> configure.log -echo exec_prefix = $exec_prefix >> configure.log -echo includedir = $includedir >> configure.log -echo libdir = $libdir >> configure.log -echo mandir = $mandir >> configure.log -echo prefix = $prefix >> configure.log -echo sharedlibdir = $sharedlibdir >> configure.log -echo uname = $uname >> configure.log - -# udpate Makefile with the configure results -sed < ${SRCDIR}Makefile.in " -/^CC *=/s#=.*#=$CC# -/^CFLAGS *=/s#=.*#=$CFLAGS# -/^SFLAGS *=/s#=.*#=$SFLAGS# -/^LDFLAGS *=/s#=.*#=$LDFLAGS# -/^LDSHARED *=/s#=.*#=$LDSHARED# -/^CPP *=/s#=.*#=$CPP# -/^STATICLIB *=/s#=.*#=$STATICLIB# -/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# -/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# -/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# -/^AR *=/s#=.*#=$AR# -/^ARFLAGS *=/s#=.*#=$ARFLAGS# -/^RANLIB *=/s#=.*#=$RANLIB# -/^LDCONFIG *=/s#=.*#=$LDCONFIG# -/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC# -/^EXE *=/s#=.*#=$EXE# -/^SRCDIR *=/s#=.*#=$SRCDIR# -/^ZINC *=/s#=.*#=$ZINC# -/^ZINCOUT *=/s#=.*#=$ZINCOUT# -/^prefix *=/s#=.*#=$prefix# -/^exec_prefix *=/s#=.*#=$exec_prefix# -/^libdir *=/s#=.*#=$libdir# -/^sharedlibdir *=/s#=.*#=$sharedlibdir# -/^includedir *=/s#=.*#=$includedir# -/^mandir *=/s#=.*#=$mandir# -/^OBJC *=/s#=.*#= $OBJC# -/^PIC_OBJC *=/s#=.*#= $PIC_OBJC# -/^all: */s#:.*#: $ALL# -/^test: */s#:.*#: $TEST# -" > Makefile - -# create zlib.pc with the configure results -sed < ${SRCDIR}zlib.pc.in " -/^CC *=/s#=.*#=$CC# -/^CFLAGS *=/s#=.*#=$CFLAGS# -/^CPP *=/s#=.*#=$CPP# -/^LDSHARED *=/s#=.*#=$LDSHARED# -/^STATICLIB *=/s#=.*#=$STATICLIB# -/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# -/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# -/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# -/^AR *=/s#=.*#=$AR# -/^ARFLAGS *=/s#=.*#=$ARFLAGS# -/^RANLIB *=/s#=.*#=$RANLIB# -/^EXE *=/s#=.*#=$EXE# -/^prefix *=/s#=.*#=$prefix# -/^exec_prefix *=/s#=.*#=$exec_prefix# -/^libdir *=/s#=.*#=$libdir# -/^sharedlibdir *=/s#=.*#=$sharedlibdir# -/^includedir *=/s#=.*#=$includedir# -/^mandir *=/s#=.*#=$mandir# -/^LDFLAGS *=/s#=.*#=$LDFLAGS# -" | sed -e " -s/\@VERSION\@/$VER/g; -" > zlib.pc - -# done -leave 0 diff --git a/compat/zlib/contrib/README.contrib b/compat/zlib/contrib/README.contrib deleted file mode 100644 index a411d5c..0000000 --- a/compat/zlib/contrib/README.contrib +++ /dev/null @@ -1,78 +0,0 @@ -All files under this contrib directory are UNSUPPORTED. There were -provided by users of zlib and were not tested by the authors of zlib. -Use at your own risk. Please contact the authors of the contributions -for help about these, not the zlib authors. Thanks. - - -ada/ by Dmitriy Anisimkov - Support for Ada - See http://zlib-ada.sourceforge.net/ - -amd64/ by Mikhail Teterin - asm code for AMD64 - See patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/96393 - -asm686/ by Brian Raiter - asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax - See http://www.muppetlabs.com/~breadbox/software/assembly.html - -blast/ by Mark Adler - Decompressor for output of PKWare Data Compression Library (DCL) - -delphi/ by Cosmin Truta - Support for Delphi and C++ Builder - -dotzlib/ by Henrik Ravn - Support for Microsoft .Net and Visual C++ .Net - -gcc_gvmat64/by Gilles Vollant - GCC Version of x86 64-bit (AMD64 and Intel EM64t) code for x64 - assembler to replace longest_match() and inflate_fast() - -infback9/ by Mark Adler - Unsupported diffs to infback to decode the deflate64 format - -inflate86/ by Chris Anderson - Tuned x86 gcc asm code to replace inflate_fast() - -iostream/ by Kevin Ruland - A C++ I/O streams interface to the zlib gz* functions - -iostream2/ by Tyge Løvset - Another C++ I/O streams interface - -iostream3/ by Ludwig Schwardt - and Kevin Ruland - Yet another C++ I/O streams interface - -masmx64/ by Gilles Vollant - x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to - replace longest_match() and inflate_fast(), also masm x86 - 64-bits translation of Chris Anderson inflate_fast() - -masmx86/ by Gilles Vollant - x86 asm code to replace longest_match() and inflate_fast(), - for Visual C++ and MASM (32 bits). - Based on Brian Raiter (asm686) and Chris Anderson (inflate86) - -minizip/ by Gilles Vollant - Mini zip and unzip based on zlib - Includes Zip64 support by Mathias Svensson - See http://www.winimage.com/zLibDll/minizip.html - -pascal/ by Bob Dellaca et al. - Support for Pascal - -puff/ by Mark Adler - Small, low memory usage inflate. Also serves to provide an - unambiguous description of the deflate format. - -testzlib/ by Gilles Vollant - Example of the use of zlib - -untgz/ by Pedro A. Aranda Gutierrez - A very simple tar.gz file extractor using zlib - -vstudio/ by Gilles Vollant - Building a minizip-enhanced zlib with Microsoft Visual Studio - Includes vc11 from kreuzerkrieg and vc12 from davispuh diff --git a/compat/zlib/contrib/ada/buffer_demo.adb b/compat/zlib/contrib/ada/buffer_demo.adb deleted file mode 100644 index 46b8638..0000000 --- a/compat/zlib/contrib/ada/buffer_demo.adb +++ /dev/null @@ -1,106 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2004 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- --- --- $Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp $ - --- This demo program provided by Dr Steve Sangwine --- --- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer --- of exactly the correct size is used for decompressed data, and the last --- few bytes passed in to Zlib are checksum bytes. - --- This program compresses a string of text, and then decompresses the --- compressed text into a buffer of the same size as the original text. - -with Ada.Streams; use Ada.Streams; -with Ada.Text_IO; - -with ZLib; use ZLib; - -procedure Buffer_Demo is - EOL : Character renames ASCII.LF; - Text : constant String - := "Four score and seven years ago our fathers brought forth," & EOL & - "upon this continent, a new nation, conceived in liberty," & EOL & - "and dedicated to the proposition that `all men are created equal'."; - - Source : Stream_Element_Array (1 .. Text'Length); - for Source'Address use Text'Address; - -begin - Ada.Text_IO.Put (Text); - Ada.Text_IO.New_Line; - Ada.Text_IO.Put_Line - ("Uncompressed size : " & Positive'Image (Text'Length) & " bytes"); - - declare - Compressed_Data : Stream_Element_Array (1 .. Text'Length); - L : Stream_Element_Offset; - begin - Compress : declare - Compressor : Filter_Type; - I : Stream_Element_Offset; - begin - Deflate_Init (Compressor); - - -- Compress the whole of T at once. - - Translate (Compressor, Source, I, Compressed_Data, L, Finish); - pragma Assert (I = Source'Last); - - Close (Compressor); - - Ada.Text_IO.Put_Line - ("Compressed size : " - & Stream_Element_Offset'Image (L) & " bytes"); - end Compress; - - -- Now we decompress the data, passing short blocks of data to Zlib - -- (because this demonstrates the problem - the last block passed will - -- contain checksum information and there will be no output, only a - -- check inside Zlib that the checksum is correct). - - Decompress : declare - Decompressor : Filter_Type; - - Uncompressed_Data : Stream_Element_Array (1 .. Text'Length); - - Block_Size : constant := 4; - -- This makes sure that the last block contains - -- only Adler checksum data. - - P : Stream_Element_Offset := Compressed_Data'First - 1; - O : Stream_Element_Offset; - begin - Inflate_Init (Decompressor); - - loop - Translate - (Decompressor, - Compressed_Data - (P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)), - P, - Uncompressed_Data - (Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last), - O, - No_Flush); - - Ada.Text_IO.Put_Line - ("Total in : " & Count'Image (Total_In (Decompressor)) & - ", out : " & Count'Image (Total_Out (Decompressor))); - - exit when P = L; - end loop; - - Ada.Text_IO.New_Line; - Ada.Text_IO.Put_Line - ("Decompressed text matches original text : " - & Boolean'Image (Uncompressed_Data = Source)); - end Decompress; - end; -end Buffer_Demo; diff --git a/compat/zlib/contrib/ada/mtest.adb b/compat/zlib/contrib/ada/mtest.adb deleted file mode 100644 index c4dfd08..0000000 --- a/compat/zlib/contrib/ada/mtest.adb +++ /dev/null @@ -1,156 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- --- Continuous test for ZLib multithreading. If the test would fail --- we should provide thread safe allocation routines for the Z_Stream. --- --- $Id: mtest.adb,v 1.4 2004/07/23 07:49:54 vagul Exp $ - -with ZLib; -with Ada.Streams; -with Ada.Numerics.Discrete_Random; -with Ada.Text_IO; -with Ada.Exceptions; -with Ada.Task_Identification; - -procedure MTest is - use Ada.Streams; - use ZLib; - - Stop : Boolean := False; - - pragma Atomic (Stop); - - subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#; - - package Random_Elements is - new Ada.Numerics.Discrete_Random (Visible_Symbols); - - task type Test_Task; - - task body Test_Task is - Buffer : Stream_Element_Array (1 .. 100_000); - Gen : Random_Elements.Generator; - - Buffer_First : Stream_Element_Offset; - Compare_First : Stream_Element_Offset; - - Deflate : Filter_Type; - Inflate : Filter_Type; - - procedure Further (Item : in Stream_Element_Array); - - procedure Read_Buffer - (Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset); - - ------------- - -- Further -- - ------------- - - procedure Further (Item : in Stream_Element_Array) is - - procedure Compare (Item : in Stream_Element_Array); - - ------------- - -- Compare -- - ------------- - - procedure Compare (Item : in Stream_Element_Array) is - Next_First : Stream_Element_Offset := Compare_First + Item'Length; - begin - if Buffer (Compare_First .. Next_First - 1) /= Item then - raise Program_Error; - end if; - - Compare_First := Next_First; - end Compare; - - procedure Compare_Write is new ZLib.Write (Write => Compare); - begin - Compare_Write (Inflate, Item, No_Flush); - end Further; - - ----------------- - -- Read_Buffer -- - ----------------- - - procedure Read_Buffer - (Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset) - is - Buff_Diff : Stream_Element_Offset := Buffer'Last - Buffer_First; - Next_First : Stream_Element_Offset; - begin - if Item'Length <= Buff_Diff then - Last := Item'Last; - - Next_First := Buffer_First + Item'Length; - - Item := Buffer (Buffer_First .. Next_First - 1); - - Buffer_First := Next_First; - else - Last := Item'First + Buff_Diff; - Item (Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last); - Buffer_First := Buffer'Last + 1; - end if; - end Read_Buffer; - - procedure Translate is new Generic_Translate - (Data_In => Read_Buffer, - Data_Out => Further); - - begin - Random_Elements.Reset (Gen); - - Buffer := (others => 20); - - Main : loop - for J in Buffer'Range loop - Buffer (J) := Random_Elements.Random (Gen); - - Deflate_Init (Deflate); - Inflate_Init (Inflate); - - Buffer_First := Buffer'First; - Compare_First := Buffer'First; - - Translate (Deflate); - - if Compare_First /= Buffer'Last + 1 then - raise Program_Error; - end if; - - Ada.Text_IO.Put_Line - (Ada.Task_Identification.Image - (Ada.Task_Identification.Current_Task) - & Stream_Element_Offset'Image (J) - & ZLib.Count'Image (Total_Out (Deflate))); - - Close (Deflate); - Close (Inflate); - - exit Main when Stop; - end loop; - end loop Main; - exception - when E : others => - Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E)); - Stop := True; - end Test_Task; - - Test : array (1 .. 4) of Test_Task; - - pragma Unreferenced (Test); - - Dummy : Character; - -begin - Ada.Text_IO.Get_Immediate (Dummy); - Stop := True; -end MTest; diff --git a/compat/zlib/contrib/ada/read.adb b/compat/zlib/contrib/ada/read.adb deleted file mode 100644 index 1f2efbf..0000000 --- a/compat/zlib/contrib/ada/read.adb +++ /dev/null @@ -1,156 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- $Id: read.adb,v 1.8 2004/05/31 10:53:40 vagul Exp $ - --- Test/demo program for the generic read interface. - -with Ada.Numerics.Discrete_Random; -with Ada.Streams; -with Ada.Text_IO; - -with ZLib; - -procedure Read is - - use Ada.Streams; - - ------------------------------------ - -- Test configuration parameters -- - ------------------------------------ - - File_Size : Stream_Element_Offset := 100_000; - - Continuous : constant Boolean := False; - -- If this constant is True, the test would be repeated again and again, - -- with increment File_Size for every iteration. - - Header : constant ZLib.Header_Type := ZLib.Default; - -- Do not use Header other than Default in ZLib versions 1.1.4 and older. - - Init_Random : constant := 8; - -- We are using the same random sequence, in case of we catch bug, - -- so we would be able to reproduce it. - - -- End -- - - Pack_Size : Stream_Element_Offset; - Offset : Stream_Element_Offset; - - Filter : ZLib.Filter_Type; - - subtype Visible_Symbols - is Stream_Element range 16#20# .. 16#7E#; - - package Random_Elements is new - Ada.Numerics.Discrete_Random (Visible_Symbols); - - Gen : Random_Elements.Generator; - Period : constant Stream_Element_Offset := 200; - -- Period constant variable for random generator not to be very random. - -- Bigger period, harder random. - - Read_Buffer : Stream_Element_Array (1 .. 2048); - Read_First : Stream_Element_Offset; - Read_Last : Stream_Element_Offset; - - procedure Reset; - - procedure Read - (Item : out Stream_Element_Array; - Last : out Stream_Element_Offset); - -- this procedure is for generic instantiation of - -- ZLib.Read - -- reading data from the File_In. - - procedure Read is new ZLib.Read - (Read, - Read_Buffer, - Rest_First => Read_First, - Rest_Last => Read_Last); - - ---------- - -- Read -- - ---------- - - procedure Read - (Item : out Stream_Element_Array; - Last : out Stream_Element_Offset) is - begin - Last := Stream_Element_Offset'Min - (Item'Last, - Item'First + File_Size - Offset); - - for J in Item'First .. Last loop - if J < Item'First + Period then - Item (J) := Random_Elements.Random (Gen); - else - Item (J) := Item (J - Period); - end if; - - Offset := Offset + 1; - end loop; - end Read; - - ----------- - -- Reset -- - ----------- - - procedure Reset is - begin - Random_Elements.Reset (Gen, Init_Random); - Pack_Size := 0; - Offset := 1; - Read_First := Read_Buffer'Last + 1; - Read_Last := Read_Buffer'Last; - end Reset; - -begin - Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version); - - loop - for Level in ZLib.Compression_Level'Range loop - - Ada.Text_IO.Put ("Level =" - & ZLib.Compression_Level'Image (Level)); - - -- Deflate using generic instantiation. - - ZLib.Deflate_Init - (Filter, - Level, - Header => Header); - - Reset; - - Ada.Text_IO.Put - (Stream_Element_Offset'Image (File_Size) & " ->"); - - loop - declare - Buffer : Stream_Element_Array (1 .. 1024); - Last : Stream_Element_Offset; - begin - Read (Filter, Buffer, Last); - - Pack_Size := Pack_Size + Last - Buffer'First + 1; - - exit when Last < Buffer'Last; - end; - end loop; - - Ada.Text_IO.Put_Line (Stream_Element_Offset'Image (Pack_Size)); - - ZLib.Close (Filter); - end loop; - - exit when not Continuous; - - File_Size := File_Size + 1; - end loop; -end Read; diff --git a/compat/zlib/contrib/ada/readme.txt b/compat/zlib/contrib/ada/readme.txt deleted file mode 100644 index ce4d2ca..0000000 --- a/compat/zlib/contrib/ada/readme.txt +++ /dev/null @@ -1,65 +0,0 @@ - ZLib for Ada thick binding (ZLib.Ada) - Release 1.3 - -ZLib.Ada is a thick binding interface to the popular ZLib data -compression library, available at http://www.gzip.org/zlib/. -It provides Ada-style access to the ZLib C library. - - - Here are the main changes since ZLib.Ada 1.2: - -- Attension: ZLib.Read generic routine have a initialization requirement - for Read_Last parameter now. It is a bit incompartible with previous version, - but extends functionality, we could use new parameters Allow_Read_Some and - Flush now. - -- Added Is_Open routines to ZLib and ZLib.Streams packages. - -- Add pragma Assert to check Stream_Element is 8 bit. - -- Fix extraction to buffer with exact known decompressed size. Error reported by - Steve Sangwine. - -- Fix definition of ULong (changed to unsigned_long), fix regression on 64 bits - computers. Patch provided by Pascal Obry. - -- Add Status_Error exception definition. - -- Add pragma Assertion that Ada.Streams.Stream_Element size is 8 bit. - - - How to build ZLib.Ada under GNAT - -You should have the ZLib library already build on your computer, before -building ZLib.Ada. Make the directory of ZLib.Ada sources current and -issue the command: - - gnatmake test -largs -L -lz - -Or use the GNAT project file build for GNAT 3.15 or later: - - gnatmake -Pzlib.gpr -L - - - How to build ZLib.Ada under Aonix ObjectAda for Win32 7.2.2 - -1. Make a project with all *.ads and *.adb files from the distribution. -2. Build the libz.a library from the ZLib C sources. -3. Rename libz.a to z.lib. -4. Add the library z.lib to the project. -5. Add the libc.lib library from the ObjectAda distribution to the project. -6. Build the executable using test.adb as a main procedure. - - - How to use ZLib.Ada - -The source files test.adb and read.adb are small demo programs that show -the main functionality of ZLib.Ada. - -The routines from the package specifications are commented. - - -Homepage: http://zlib-ada.sourceforge.net/ -Author: Dmitriy Anisimkov - -Contributors: Pascal Obry , Steve Sangwine diff --git a/compat/zlib/contrib/ada/test.adb b/compat/zlib/contrib/ada/test.adb deleted file mode 100644 index 90773ac..0000000 --- a/compat/zlib/contrib/ada/test.adb +++ /dev/null @@ -1,463 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- $Id: test.adb,v 1.17 2003/08/12 12:13:30 vagul Exp $ - --- The program has a few aims. --- 1. Test ZLib.Ada95 thick binding functionality. --- 2. Show the example of use main functionality of the ZLib.Ada95 binding. --- 3. Build this program automatically compile all ZLib.Ada95 packages under --- GNAT Ada95 compiler. - -with ZLib.Streams; -with Ada.Streams.Stream_IO; -with Ada.Numerics.Discrete_Random; - -with Ada.Text_IO; - -with Ada.Calendar; - -procedure Test is - - use Ada.Streams; - use Stream_IO; - - ------------------------------------ - -- Test configuration parameters -- - ------------------------------------ - - File_Size : Count := 100_000; - Continuous : constant Boolean := False; - - Header : constant ZLib.Header_Type := ZLib.Default; - -- ZLib.None; - -- ZLib.Auto; - -- ZLib.GZip; - -- Do not use Header other then Default in ZLib versions 1.1.4 - -- and older. - - Strategy : constant ZLib.Strategy_Type := ZLib.Default_Strategy; - Init_Random : constant := 10; - - -- End -- - - In_File_Name : constant String := "testzlib.in"; - -- Name of the input file - - Z_File_Name : constant String := "testzlib.zlb"; - -- Name of the compressed file. - - Out_File_Name : constant String := "testzlib.out"; - -- Name of the decompressed file. - - File_In : File_Type; - File_Out : File_Type; - File_Back : File_Type; - File_Z : ZLib.Streams.Stream_Type; - - Filter : ZLib.Filter_Type; - - Time_Stamp : Ada.Calendar.Time; - - procedure Generate_File; - -- Generate file of spetsified size with some random data. - -- The random data is repeatable, for the good compression. - - procedure Compare_Streams - (Left, Right : in out Root_Stream_Type'Class); - -- The procedure compearing data in 2 streams. - -- It is for compare data before and after compression/decompression. - - procedure Compare_Files (Left, Right : String); - -- Compare files. Based on the Compare_Streams. - - procedure Copy_Streams - (Source, Target : in out Root_Stream_Type'Class; - Buffer_Size : in Stream_Element_Offset := 1024); - -- Copying data from one stream to another. It is for test stream - -- interface of the library. - - procedure Data_In - (Item : out Stream_Element_Array; - Last : out Stream_Element_Offset); - -- this procedure is for generic instantiation of - -- ZLib.Generic_Translate. - -- reading data from the File_In. - - procedure Data_Out (Item : in Stream_Element_Array); - -- this procedure is for generic instantiation of - -- ZLib.Generic_Translate. - -- writing data to the File_Out. - - procedure Stamp; - -- Store the timestamp to the local variable. - - procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count); - -- Print the time statistic with the message. - - procedure Translate is new ZLib.Generic_Translate - (Data_In => Data_In, - Data_Out => Data_Out); - -- This procedure is moving data from File_In to File_Out - -- with compression or decompression, depend on initialization of - -- Filter parameter. - - ------------------- - -- Compare_Files -- - ------------------- - - procedure Compare_Files (Left, Right : String) is - Left_File, Right_File : File_Type; - begin - Open (Left_File, In_File, Left); - Open (Right_File, In_File, Right); - Compare_Streams (Stream (Left_File).all, Stream (Right_File).all); - Close (Left_File); - Close (Right_File); - end Compare_Files; - - --------------------- - -- Compare_Streams -- - --------------------- - - procedure Compare_Streams - (Left, Right : in out Ada.Streams.Root_Stream_Type'Class) - is - Left_Buffer, Right_Buffer : Stream_Element_Array (0 .. 16#FFF#); - Left_Last, Right_Last : Stream_Element_Offset; - begin - loop - Read (Left, Left_Buffer, Left_Last); - Read (Right, Right_Buffer, Right_Last); - - if Left_Last /= Right_Last then - Ada.Text_IO.Put_Line ("Compare error :" - & Stream_Element_Offset'Image (Left_Last) - & " /= " - & Stream_Element_Offset'Image (Right_Last)); - - raise Constraint_Error; - - elsif Left_Buffer (0 .. Left_Last) - /= Right_Buffer (0 .. Right_Last) - then - Ada.Text_IO.Put_Line ("ERROR: IN and OUT files is not equal."); - raise Constraint_Error; - - end if; - - exit when Left_Last < Left_Buffer'Last; - end loop; - end Compare_Streams; - - ------------------ - -- Copy_Streams -- - ------------------ - - procedure Copy_Streams - (Source, Target : in out Ada.Streams.Root_Stream_Type'Class; - Buffer_Size : in Stream_Element_Offset := 1024) - is - Buffer : Stream_Element_Array (1 .. Buffer_Size); - Last : Stream_Element_Offset; - begin - loop - Read (Source, Buffer, Last); - Write (Target, Buffer (1 .. Last)); - - exit when Last < Buffer'Last; - end loop; - end Copy_Streams; - - ------------- - -- Data_In -- - ------------- - - procedure Data_In - (Item : out Stream_Element_Array; - Last : out Stream_Element_Offset) is - begin - Read (File_In, Item, Last); - end Data_In; - - -------------- - -- Data_Out -- - -------------- - - procedure Data_Out (Item : in Stream_Element_Array) is - begin - Write (File_Out, Item); - end Data_Out; - - ------------------- - -- Generate_File -- - ------------------- - - procedure Generate_File is - subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#; - - package Random_Elements is - new Ada.Numerics.Discrete_Random (Visible_Symbols); - - Gen : Random_Elements.Generator; - Buffer : Stream_Element_Array := (1 .. 77 => 16#20#) & 10; - - Buffer_Count : constant Count := File_Size / Buffer'Length; - -- Number of same buffers in the packet. - - Density : constant Count := 30; -- from 0 to Buffer'Length - 2; - - procedure Fill_Buffer (J, D : in Count); - -- Change the part of the buffer. - - ----------------- - -- Fill_Buffer -- - ----------------- - - procedure Fill_Buffer (J, D : in Count) is - begin - for K in 0 .. D loop - Buffer - (Stream_Element_Offset ((J + K) mod (Buffer'Length - 1) + 1)) - := Random_Elements.Random (Gen); - - end loop; - end Fill_Buffer; - - begin - Random_Elements.Reset (Gen, Init_Random); - - Create (File_In, Out_File, In_File_Name); - - Fill_Buffer (1, Buffer'Length - 2); - - for J in 1 .. Buffer_Count loop - Write (File_In, Buffer); - - Fill_Buffer (J, Density); - end loop; - - -- fill remain size. - - Write - (File_In, - Buffer - (1 .. Stream_Element_Offset - (File_Size - Buffer'Length * Buffer_Count))); - - Flush (File_In); - Close (File_In); - end Generate_File; - - --------------------- - -- Print_Statistic -- - --------------------- - - procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count) is - use Ada.Calendar; - use Ada.Text_IO; - - package Count_IO is new Integer_IO (ZLib.Count); - - Curr_Dur : Duration := Clock - Time_Stamp; - begin - Put (Msg); - - Set_Col (20); - Ada.Text_IO.Put ("size ="); - - Count_IO.Put - (Data_Size, - Width => Stream_IO.Count'Image (File_Size)'Length); - - Put_Line (" duration =" & Duration'Image (Curr_Dur)); - end Print_Statistic; - - ----------- - -- Stamp -- - ----------- - - procedure Stamp is - begin - Time_Stamp := Ada.Calendar.Clock; - end Stamp; - -begin - Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version); - - loop - Generate_File; - - for Level in ZLib.Compression_Level'Range loop - - Ada.Text_IO.Put_Line ("Level =" - & ZLib.Compression_Level'Image (Level)); - - -- Test generic interface. - Open (File_In, In_File, In_File_Name); - Create (File_Out, Out_File, Z_File_Name); - - Stamp; - - -- Deflate using generic instantiation. - - ZLib.Deflate_Init - (Filter => Filter, - Level => Level, - Strategy => Strategy, - Header => Header); - - Translate (Filter); - Print_Statistic ("Generic compress", ZLib.Total_Out (Filter)); - ZLib.Close (Filter); - - Close (File_In); - Close (File_Out); - - Open (File_In, In_File, Z_File_Name); - Create (File_Out, Out_File, Out_File_Name); - - Stamp; - - -- Inflate using generic instantiation. - - ZLib.Inflate_Init (Filter, Header => Header); - - Translate (Filter); - Print_Statistic ("Generic decompress", ZLib.Total_Out (Filter)); - - ZLib.Close (Filter); - - Close (File_In); - Close (File_Out); - - Compare_Files (In_File_Name, Out_File_Name); - - -- Test stream interface. - - -- Compress to the back stream. - - Open (File_In, In_File, In_File_Name); - Create (File_Back, Out_File, Z_File_Name); - - Stamp; - - ZLib.Streams.Create - (Stream => File_Z, - Mode => ZLib.Streams.Out_Stream, - Back => ZLib.Streams.Stream_Access - (Stream (File_Back)), - Back_Compressed => True, - Level => Level, - Strategy => Strategy, - Header => Header); - - Copy_Streams - (Source => Stream (File_In).all, - Target => File_Z); - - -- Flushing internal buffers to the back stream. - - ZLib.Streams.Flush (File_Z, ZLib.Finish); - - Print_Statistic ("Write compress", - ZLib.Streams.Write_Total_Out (File_Z)); - - ZLib.Streams.Close (File_Z); - - Close (File_In); - Close (File_Back); - - -- Compare reading from original file and from - -- decompression stream. - - Open (File_In, In_File, In_File_Name); - Open (File_Back, In_File, Z_File_Name); - - ZLib.Streams.Create - (Stream => File_Z, - Mode => ZLib.Streams.In_Stream, - Back => ZLib.Streams.Stream_Access - (Stream (File_Back)), - Back_Compressed => True, - Header => Header); - - Stamp; - Compare_Streams (Stream (File_In).all, File_Z); - - Print_Statistic ("Read decompress", - ZLib.Streams.Read_Total_Out (File_Z)); - - ZLib.Streams.Close (File_Z); - Close (File_In); - Close (File_Back); - - -- Compress by reading from compression stream. - - Open (File_Back, In_File, In_File_Name); - Create (File_Out, Out_File, Z_File_Name); - - ZLib.Streams.Create - (Stream => File_Z, - Mode => ZLib.Streams.In_Stream, - Back => ZLib.Streams.Stream_Access - (Stream (File_Back)), - Back_Compressed => False, - Level => Level, - Strategy => Strategy, - Header => Header); - - Stamp; - Copy_Streams - (Source => File_Z, - Target => Stream (File_Out).all); - - Print_Statistic ("Read compress", - ZLib.Streams.Read_Total_Out (File_Z)); - - ZLib.Streams.Close (File_Z); - - Close (File_Out); - Close (File_Back); - - -- Decompress to decompression stream. - - Open (File_In, In_File, Z_File_Name); - Create (File_Back, Out_File, Out_File_Name); - - ZLib.Streams.Create - (Stream => File_Z, - Mode => ZLib.Streams.Out_Stream, - Back => ZLib.Streams.Stream_Access - (Stream (File_Back)), - Back_Compressed => False, - Header => Header); - - Stamp; - - Copy_Streams - (Source => Stream (File_In).all, - Target => File_Z); - - Print_Statistic ("Write decompress", - ZLib.Streams.Write_Total_Out (File_Z)); - - ZLib.Streams.Close (File_Z); - Close (File_In); - Close (File_Back); - - Compare_Files (In_File_Name, Out_File_Name); - end loop; - - Ada.Text_IO.Put_Line (Count'Image (File_Size) & " Ok."); - - exit when not Continuous; - - File_Size := File_Size + 1; - end loop; -end Test; diff --git a/compat/zlib/contrib/ada/zlib-streams.adb b/compat/zlib/contrib/ada/zlib-streams.adb deleted file mode 100644 index b6497ba..0000000 --- a/compat/zlib/contrib/ada/zlib-streams.adb +++ /dev/null @@ -1,225 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- $Id: zlib-streams.adb,v 1.10 2004/05/31 10:53:40 vagul Exp $ - -with Ada.Unchecked_Deallocation; - -package body ZLib.Streams is - - ----------- - -- Close -- - ----------- - - procedure Close (Stream : in out Stream_Type) is - procedure Free is new Ada.Unchecked_Deallocation - (Stream_Element_Array, Buffer_Access); - begin - if Stream.Mode = Out_Stream or Stream.Mode = Duplex then - -- We should flush the data written by the writer. - - Flush (Stream, Finish); - - Close (Stream.Writer); - end if; - - if Stream.Mode = In_Stream or Stream.Mode = Duplex then - Close (Stream.Reader); - Free (Stream.Buffer); - end if; - end Close; - - ------------ - -- Create -- - ------------ - - procedure Create - (Stream : out Stream_Type; - Mode : in Stream_Mode; - Back : in Stream_Access; - Back_Compressed : in Boolean; - Level : in Compression_Level := Default_Compression; - Strategy : in Strategy_Type := Default_Strategy; - Header : in Header_Type := Default; - Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset - := Default_Buffer_Size; - Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset - := Default_Buffer_Size) - is - - subtype Buffer_Subtype is Stream_Element_Array (1 .. Read_Buffer_Size); - - procedure Init_Filter - (Filter : in out Filter_Type; - Compress : in Boolean); - - ----------------- - -- Init_Filter -- - ----------------- - - procedure Init_Filter - (Filter : in out Filter_Type; - Compress : in Boolean) is - begin - if Compress then - Deflate_Init - (Filter, Level, Strategy, Header => Header); - else - Inflate_Init (Filter, Header => Header); - end if; - end Init_Filter; - - begin - Stream.Back := Back; - Stream.Mode := Mode; - - if Mode = Out_Stream or Mode = Duplex then - Init_Filter (Stream.Writer, Back_Compressed); - Stream.Buffer_Size := Write_Buffer_Size; - else - Stream.Buffer_Size := 0; - end if; - - if Mode = In_Stream or Mode = Duplex then - Init_Filter (Stream.Reader, not Back_Compressed); - - Stream.Buffer := new Buffer_Subtype; - Stream.Rest_First := Stream.Buffer'Last + 1; - Stream.Rest_Last := Stream.Buffer'Last; - end if; - end Create; - - ----------- - -- Flush -- - ----------- - - procedure Flush - (Stream : in out Stream_Type; - Mode : in Flush_Mode := Sync_Flush) - is - Buffer : Stream_Element_Array (1 .. Stream.Buffer_Size); - Last : Stream_Element_Offset; - begin - loop - Flush (Stream.Writer, Buffer, Last, Mode); - - Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last)); - - exit when Last < Buffer'Last; - end loop; - end Flush; - - ------------- - -- Is_Open -- - ------------- - - function Is_Open (Stream : Stream_Type) return Boolean is - begin - return Is_Open (Stream.Reader) or else Is_Open (Stream.Writer); - end Is_Open; - - ---------- - -- Read -- - ---------- - - procedure Read - (Stream : in out Stream_Type; - Item : out Stream_Element_Array; - Last : out Stream_Element_Offset) - is - - procedure Read - (Item : out Stream_Element_Array; - Last : out Stream_Element_Offset); - - ---------- - -- Read -- - ---------- - - procedure Read - (Item : out Stream_Element_Array; - Last : out Stream_Element_Offset) is - begin - Ada.Streams.Read (Stream.Back.all, Item, Last); - end Read; - - procedure Read is new ZLib.Read - (Read => Read, - Buffer => Stream.Buffer.all, - Rest_First => Stream.Rest_First, - Rest_Last => Stream.Rest_Last); - - begin - Read (Stream.Reader, Item, Last); - end Read; - - ------------------- - -- Read_Total_In -- - ------------------- - - function Read_Total_In (Stream : in Stream_Type) return Count is - begin - return Total_In (Stream.Reader); - end Read_Total_In; - - -------------------- - -- Read_Total_Out -- - -------------------- - - function Read_Total_Out (Stream : in Stream_Type) return Count is - begin - return Total_Out (Stream.Reader); - end Read_Total_Out; - - ----------- - -- Write -- - ----------- - - procedure Write - (Stream : in out Stream_Type; - Item : in Stream_Element_Array) - is - - procedure Write (Item : in Stream_Element_Array); - - ----------- - -- Write -- - ----------- - - procedure Write (Item : in Stream_Element_Array) is - begin - Ada.Streams.Write (Stream.Back.all, Item); - end Write; - - procedure Write is new ZLib.Write - (Write => Write, - Buffer_Size => Stream.Buffer_Size); - - begin - Write (Stream.Writer, Item, No_Flush); - end Write; - - -------------------- - -- Write_Total_In -- - -------------------- - - function Write_Total_In (Stream : in Stream_Type) return Count is - begin - return Total_In (Stream.Writer); - end Write_Total_In; - - --------------------- - -- Write_Total_Out -- - --------------------- - - function Write_Total_Out (Stream : in Stream_Type) return Count is - begin - return Total_Out (Stream.Writer); - end Write_Total_Out; - -end ZLib.Streams; diff --git a/compat/zlib/contrib/ada/zlib-streams.ads b/compat/zlib/contrib/ada/zlib-streams.ads deleted file mode 100644 index 8e26cd4..0000000 --- a/compat/zlib/contrib/ada/zlib-streams.ads +++ /dev/null @@ -1,114 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- $Id: zlib-streams.ads,v 1.12 2004/05/31 10:53:40 vagul Exp $ - -package ZLib.Streams is - - type Stream_Mode is (In_Stream, Out_Stream, Duplex); - - type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class; - - type Stream_Type is - new Ada.Streams.Root_Stream_Type with private; - - procedure Read - (Stream : in out Stream_Type; - Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset); - - procedure Write - (Stream : in out Stream_Type; - Item : in Ada.Streams.Stream_Element_Array); - - procedure Flush - (Stream : in out Stream_Type; - Mode : in Flush_Mode := Sync_Flush); - -- Flush the written data to the back stream, - -- all data placed to the compressor is flushing to the Back stream. - -- Should not be used until necessary, because it is decreasing - -- compression. - - function Read_Total_In (Stream : in Stream_Type) return Count; - pragma Inline (Read_Total_In); - -- Return total number of bytes read from back stream so far. - - function Read_Total_Out (Stream : in Stream_Type) return Count; - pragma Inline (Read_Total_Out); - -- Return total number of bytes read so far. - - function Write_Total_In (Stream : in Stream_Type) return Count; - pragma Inline (Write_Total_In); - -- Return total number of bytes written so far. - - function Write_Total_Out (Stream : in Stream_Type) return Count; - pragma Inline (Write_Total_Out); - -- Return total number of bytes written to the back stream. - - procedure Create - (Stream : out Stream_Type; - Mode : in Stream_Mode; - Back : in Stream_Access; - Back_Compressed : in Boolean; - Level : in Compression_Level := Default_Compression; - Strategy : in Strategy_Type := Default_Strategy; - Header : in Header_Type := Default; - Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset - := Default_Buffer_Size; - Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset - := Default_Buffer_Size); - -- Create the Comression/Decompression stream. - -- If mode is In_Stream then Write operation is disabled. - -- If mode is Out_Stream then Read operation is disabled. - - -- If Back_Compressed is true then - -- Data written to the Stream is compressing to the Back stream - -- and data read from the Stream is decompressed data from the Back stream. - - -- If Back_Compressed is false then - -- Data written to the Stream is decompressing to the Back stream - -- and data read from the Stream is compressed data from the Back stream. - - -- !!! When the Need_Header is False ZLib-Ada is using undocumented - -- ZLib 1.1.4 functionality to do not create/wait for ZLib headers. - - function Is_Open (Stream : Stream_Type) return Boolean; - - procedure Close (Stream : in out Stream_Type); - -private - - use Ada.Streams; - - type Buffer_Access is access all Stream_Element_Array; - - type Stream_Type - is new Root_Stream_Type with - record - Mode : Stream_Mode; - - Buffer : Buffer_Access; - Rest_First : Stream_Element_Offset; - Rest_Last : Stream_Element_Offset; - -- Buffer for Read operation. - -- We need to have this buffer in the record - -- because not all read data from back stream - -- could be processed during the read operation. - - Buffer_Size : Stream_Element_Offset; - -- Buffer size for write operation. - -- We do not need to have this buffer - -- in the record because all data could be - -- processed in the write operation. - - Back : Stream_Access; - Reader : Filter_Type; - Writer : Filter_Type; - end record; - -end ZLib.Streams; diff --git a/compat/zlib/contrib/ada/zlib-thin.adb b/compat/zlib/contrib/ada/zlib-thin.adb deleted file mode 100644 index 0ca4a71..0000000 --- a/compat/zlib/contrib/ada/zlib-thin.adb +++ /dev/null @@ -1,141 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $ - -package body ZLib.Thin is - - ZLIB_VERSION : constant Chars_Ptr := zlibVersion; - - Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit; - - -------------- - -- Avail_In -- - -------------- - - function Avail_In (Strm : in Z_Stream) return UInt is - begin - return Strm.Avail_In; - end Avail_In; - - --------------- - -- Avail_Out -- - --------------- - - function Avail_Out (Strm : in Z_Stream) return UInt is - begin - return Strm.Avail_Out; - end Avail_Out; - - ------------------ - -- Deflate_Init -- - ------------------ - - function Deflate_Init - (strm : Z_Streamp; - level : Int; - method : Int; - windowBits : Int; - memLevel : Int; - strategy : Int) - return Int is - begin - return deflateInit2 - (strm, - level, - method, - windowBits, - memLevel, - strategy, - ZLIB_VERSION, - Z_Stream_Size); - end Deflate_Init; - - ------------------ - -- Inflate_Init -- - ------------------ - - function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is - begin - return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size); - end Inflate_Init; - - ------------------------ - -- Last_Error_Message -- - ------------------------ - - function Last_Error_Message (Strm : in Z_Stream) return String is - use Interfaces.C.Strings; - begin - if Strm.msg = Null_Ptr then - return ""; - else - return Value (Strm.msg); - end if; - end Last_Error_Message; - - ------------ - -- Set_In -- - ------------ - - procedure Set_In - (Strm : in out Z_Stream; - Buffer : in Voidp; - Size : in UInt) is - begin - Strm.Next_In := Buffer; - Strm.Avail_In := Size; - end Set_In; - - ------------------ - -- Set_Mem_Func -- - ------------------ - - procedure Set_Mem_Func - (Strm : in out Z_Stream; - Opaque : in Voidp; - Alloc : in alloc_func; - Free : in free_func) is - begin - Strm.opaque := Opaque; - Strm.zalloc := Alloc; - Strm.zfree := Free; - end Set_Mem_Func; - - ------------- - -- Set_Out -- - ------------- - - procedure Set_Out - (Strm : in out Z_Stream; - Buffer : in Voidp; - Size : in UInt) is - begin - Strm.Next_Out := Buffer; - Strm.Avail_Out := Size; - end Set_Out; - - -------------- - -- Total_In -- - -------------- - - function Total_In (Strm : in Z_Stream) return ULong is - begin - return Strm.Total_In; - end Total_In; - - --------------- - -- Total_Out -- - --------------- - - function Total_Out (Strm : in Z_Stream) return ULong is - begin - return Strm.Total_Out; - end Total_Out; - -end ZLib.Thin; diff --git a/compat/zlib/contrib/ada/zlib-thin.ads b/compat/zlib/contrib/ada/zlib-thin.ads deleted file mode 100644 index 810173c..0000000 --- a/compat/zlib/contrib/ada/zlib-thin.ads +++ /dev/null @@ -1,450 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- $Id: zlib-thin.ads,v 1.11 2004/07/23 06:33:11 vagul Exp $ - -with Interfaces.C.Strings; - -with System; - -private package ZLib.Thin is - - -- From zconf.h - - MAX_MEM_LEVEL : constant := 9; -- zconf.h:105 - -- zconf.h:105 - MAX_WBITS : constant := 15; -- zconf.h:115 - -- 32K LZ77 window - -- zconf.h:115 - SEEK_SET : constant := 8#0000#; -- zconf.h:244 - -- Seek from beginning of file. - -- zconf.h:244 - SEEK_CUR : constant := 1; -- zconf.h:245 - -- Seek from current position. - -- zconf.h:245 - SEEK_END : constant := 2; -- zconf.h:246 - -- Set file pointer to EOF plus "offset" - -- zconf.h:246 - - type Byte is new Interfaces.C.unsigned_char; -- 8 bits - -- zconf.h:214 - type UInt is new Interfaces.C.unsigned; -- 16 bits or more - -- zconf.h:216 - type Int is new Interfaces.C.int; - - type ULong is new Interfaces.C.unsigned_long; -- 32 bits or more - -- zconf.h:217 - subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr; - - type ULong_Access is access ULong; - type Int_Access is access Int; - - subtype Voidp is System.Address; -- zconf.h:232 - - subtype Byte_Access is Voidp; - - Nul : constant Voidp := System.Null_Address; - -- end from zconf - - Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125 - -- zlib.h:125 - Z_PARTIAL_FLUSH : constant := 1; -- zlib.h:126 - -- will be removed, use - -- Z_SYNC_FLUSH instead - -- zlib.h:126 - Z_SYNC_FLUSH : constant := 2; -- zlib.h:127 - -- zlib.h:127 - Z_FULL_FLUSH : constant := 3; -- zlib.h:128 - -- zlib.h:128 - Z_FINISH : constant := 4; -- zlib.h:129 - -- zlib.h:129 - Z_OK : constant := 8#0000#; -- zlib.h:132 - -- zlib.h:132 - Z_STREAM_END : constant := 1; -- zlib.h:133 - -- zlib.h:133 - Z_NEED_DICT : constant := 2; -- zlib.h:134 - -- zlib.h:134 - Z_ERRNO : constant := -1; -- zlib.h:135 - -- zlib.h:135 - Z_STREAM_ERROR : constant := -2; -- zlib.h:136 - -- zlib.h:136 - Z_DATA_ERROR : constant := -3; -- zlib.h:137 - -- zlib.h:137 - Z_MEM_ERROR : constant := -4; -- zlib.h:138 - -- zlib.h:138 - Z_BUF_ERROR : constant := -5; -- zlib.h:139 - -- zlib.h:139 - Z_VERSION_ERROR : constant := -6; -- zlib.h:140 - -- zlib.h:140 - Z_NO_COMPRESSION : constant := 8#0000#; -- zlib.h:145 - -- zlib.h:145 - Z_BEST_SPEED : constant := 1; -- zlib.h:146 - -- zlib.h:146 - Z_BEST_COMPRESSION : constant := 9; -- zlib.h:147 - -- zlib.h:147 - Z_DEFAULT_COMPRESSION : constant := -1; -- zlib.h:148 - -- zlib.h:148 - Z_FILTERED : constant := 1; -- zlib.h:151 - -- zlib.h:151 - Z_HUFFMAN_ONLY : constant := 2; -- zlib.h:152 - -- zlib.h:152 - Z_DEFAULT_STRATEGY : constant := 8#0000#; -- zlib.h:153 - -- zlib.h:153 - Z_BINARY : constant := 8#0000#; -- zlib.h:156 - -- zlib.h:156 - Z_ASCII : constant := 1; -- zlib.h:157 - -- zlib.h:157 - Z_UNKNOWN : constant := 2; -- zlib.h:158 - -- zlib.h:158 - Z_DEFLATED : constant := 8; -- zlib.h:161 - -- zlib.h:161 - Z_NULL : constant := 8#0000#; -- zlib.h:164 - -- for initializing zalloc, zfree, opaque - -- zlib.h:164 - type gzFile is new Voidp; -- zlib.h:646 - - type Z_Stream is private; - - type Z_Streamp is access all Z_Stream; -- zlib.h:89 - - type alloc_func is access function - (Opaque : Voidp; - Items : UInt; - Size : UInt) - return Voidp; -- zlib.h:63 - - type free_func is access procedure (opaque : Voidp; address : Voidp); - - function zlibVersion return Chars_Ptr; - - function Deflate (strm : Z_Streamp; flush : Int) return Int; - - function DeflateEnd (strm : Z_Streamp) return Int; - - function Inflate (strm : Z_Streamp; flush : Int) return Int; - - function InflateEnd (strm : Z_Streamp) return Int; - - function deflateSetDictionary - (strm : Z_Streamp; - dictionary : Byte_Access; - dictLength : UInt) - return Int; - - function deflateCopy (dest : Z_Streamp; source : Z_Streamp) return Int; - -- zlib.h:478 - - function deflateReset (strm : Z_Streamp) return Int; -- zlib.h:495 - - function deflateParams - (strm : Z_Streamp; - level : Int; - strategy : Int) - return Int; -- zlib.h:506 - - function inflateSetDictionary - (strm : Z_Streamp; - dictionary : Byte_Access; - dictLength : UInt) - return Int; -- zlib.h:548 - - function inflateSync (strm : Z_Streamp) return Int; -- zlib.h:565 - - function inflateReset (strm : Z_Streamp) return Int; -- zlib.h:580 - - function compress - (dest : Byte_Access; - destLen : ULong_Access; - source : Byte_Access; - sourceLen : ULong) - return Int; -- zlib.h:601 - - function compress2 - (dest : Byte_Access; - destLen : ULong_Access; - source : Byte_Access; - sourceLen : ULong; - level : Int) - return Int; -- zlib.h:615 - - function uncompress - (dest : Byte_Access; - destLen : ULong_Access; - source : Byte_Access; - sourceLen : ULong) - return Int; - - function gzopen (path : Chars_Ptr; mode : Chars_Ptr) return gzFile; - - function gzdopen (fd : Int; mode : Chars_Ptr) return gzFile; - - function gzsetparams - (file : gzFile; - level : Int; - strategy : Int) - return Int; - - function gzread - (file : gzFile; - buf : Voidp; - len : UInt) - return Int; - - function gzwrite - (file : in gzFile; - buf : in Voidp; - len : in UInt) - return Int; - - function gzprintf (file : in gzFile; format : in Chars_Ptr) return Int; - - function gzputs (file : in gzFile; s : in Chars_Ptr) return Int; - - function gzgets - (file : gzFile; - buf : Chars_Ptr; - len : Int) - return Chars_Ptr; - - function gzputc (file : gzFile; char : Int) return Int; - - function gzgetc (file : gzFile) return Int; - - function gzflush (file : gzFile; flush : Int) return Int; - - function gzseek - (file : gzFile; - offset : Int; - whence : Int) - return Int; - - function gzrewind (file : gzFile) return Int; - - function gztell (file : gzFile) return Int; - - function gzeof (file : gzFile) return Int; - - function gzclose (file : gzFile) return Int; - - function gzerror (file : gzFile; errnum : Int_Access) return Chars_Ptr; - - function adler32 - (adler : ULong; - buf : Byte_Access; - len : UInt) - return ULong; - - function crc32 - (crc : ULong; - buf : Byte_Access; - len : UInt) - return ULong; - - function deflateInit - (strm : Z_Streamp; - level : Int; - version : Chars_Ptr; - stream_size : Int) - return Int; - - function deflateInit2 - (strm : Z_Streamp; - level : Int; - method : Int; - windowBits : Int; - memLevel : Int; - strategy : Int; - version : Chars_Ptr; - stream_size : Int) - return Int; - - function Deflate_Init - (strm : Z_Streamp; - level : Int; - method : Int; - windowBits : Int; - memLevel : Int; - strategy : Int) - return Int; - pragma Inline (Deflate_Init); - - function inflateInit - (strm : Z_Streamp; - version : Chars_Ptr; - stream_size : Int) - return Int; - - function inflateInit2 - (strm : in Z_Streamp; - windowBits : in Int; - version : in Chars_Ptr; - stream_size : in Int) - return Int; - - function inflateBackInit - (strm : in Z_Streamp; - windowBits : in Int; - window : in Byte_Access; - version : in Chars_Ptr; - stream_size : in Int) - return Int; - -- Size of window have to be 2**windowBits. - - function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int; - pragma Inline (Inflate_Init); - - function zError (err : Int) return Chars_Ptr; - - function inflateSyncPoint (z : Z_Streamp) return Int; - - function get_crc_table return ULong_Access; - - -- Interface to the available fields of the z_stream structure. - -- The application must update next_in and avail_in when avail_in has - -- dropped to zero. It must update next_out and avail_out when avail_out - -- has dropped to zero. The application must initialize zalloc, zfree and - -- opaque before calling the init function. - - procedure Set_In - (Strm : in out Z_Stream; - Buffer : in Voidp; - Size : in UInt); - pragma Inline (Set_In); - - procedure Set_Out - (Strm : in out Z_Stream; - Buffer : in Voidp; - Size : in UInt); - pragma Inline (Set_Out); - - procedure Set_Mem_Func - (Strm : in out Z_Stream; - Opaque : in Voidp; - Alloc : in alloc_func; - Free : in free_func); - pragma Inline (Set_Mem_Func); - - function Last_Error_Message (Strm : in Z_Stream) return String; - pragma Inline (Last_Error_Message); - - function Avail_Out (Strm : in Z_Stream) return UInt; - pragma Inline (Avail_Out); - - function Avail_In (Strm : in Z_Stream) return UInt; - pragma Inline (Avail_In); - - function Total_In (Strm : in Z_Stream) return ULong; - pragma Inline (Total_In); - - function Total_Out (Strm : in Z_Stream) return ULong; - pragma Inline (Total_Out); - - function inflateCopy - (dest : in Z_Streamp; - Source : in Z_Streamp) - return Int; - - function compressBound (Source_Len : in ULong) return ULong; - - function deflateBound - (Strm : in Z_Streamp; - Source_Len : in ULong) - return ULong; - - function gzungetc (C : in Int; File : in gzFile) return Int; - - function zlibCompileFlags return ULong; - -private - - type Z_Stream is record -- zlib.h:68 - Next_In : Voidp := Nul; -- next input byte - Avail_In : UInt := 0; -- number of bytes available at next_in - Total_In : ULong := 0; -- total nb of input bytes read so far - Next_Out : Voidp := Nul; -- next output byte should be put there - Avail_Out : UInt := 0; -- remaining free space at next_out - Total_Out : ULong := 0; -- total nb of bytes output so far - msg : Chars_Ptr; -- last error message, NULL if no error - state : Voidp; -- not visible by applications - zalloc : alloc_func := null; -- used to allocate the internal state - zfree : free_func := null; -- used to free the internal state - opaque : Voidp; -- private data object passed to - -- zalloc and zfree - data_type : Int; -- best guess about the data type: - -- ascii or binary - adler : ULong; -- adler32 value of the uncompressed - -- data - reserved : ULong; -- reserved for future use - end record; - - pragma Convention (C, Z_Stream); - - pragma Import (C, zlibVersion, "zlibVersion"); - pragma Import (C, Deflate, "deflate"); - pragma Import (C, DeflateEnd, "deflateEnd"); - pragma Import (C, Inflate, "inflate"); - pragma Import (C, InflateEnd, "inflateEnd"); - pragma Import (C, deflateSetDictionary, "deflateSetDictionary"); - pragma Import (C, deflateCopy, "deflateCopy"); - pragma Import (C, deflateReset, "deflateReset"); - pragma Import (C, deflateParams, "deflateParams"); - pragma Import (C, inflateSetDictionary, "inflateSetDictionary"); - pragma Import (C, inflateSync, "inflateSync"); - pragma Import (C, inflateReset, "inflateReset"); - pragma Import (C, compress, "compress"); - pragma Import (C, compress2, "compress2"); - pragma Import (C, uncompress, "uncompress"); - pragma Import (C, gzopen, "gzopen"); - pragma Import (C, gzdopen, "gzdopen"); - pragma Import (C, gzsetparams, "gzsetparams"); - pragma Import (C, gzread, "gzread"); - pragma Import (C, gzwrite, "gzwrite"); - pragma Import (C, gzprintf, "gzprintf"); - pragma Import (C, gzputs, "gzputs"); - pragma Import (C, gzgets, "gzgets"); - pragma Import (C, gzputc, "gzputc"); - pragma Import (C, gzgetc, "gzgetc"); - pragma Import (C, gzflush, "gzflush"); - pragma Import (C, gzseek, "gzseek"); - pragma Import (C, gzrewind, "gzrewind"); - pragma Import (C, gztell, "gztell"); - pragma Import (C, gzeof, "gzeof"); - pragma Import (C, gzclose, "gzclose"); - pragma Import (C, gzerror, "gzerror"); - pragma Import (C, adler32, "adler32"); - pragma Import (C, crc32, "crc32"); - pragma Import (C, deflateInit, "deflateInit_"); - pragma Import (C, inflateInit, "inflateInit_"); - pragma Import (C, deflateInit2, "deflateInit2_"); - pragma Import (C, inflateInit2, "inflateInit2_"); - pragma Import (C, zError, "zError"); - pragma Import (C, inflateSyncPoint, "inflateSyncPoint"); - pragma Import (C, get_crc_table, "get_crc_table"); - - -- since zlib 1.2.0: - - pragma Import (C, inflateCopy, "inflateCopy"); - pragma Import (C, compressBound, "compressBound"); - pragma Import (C, deflateBound, "deflateBound"); - pragma Import (C, gzungetc, "gzungetc"); - pragma Import (C, zlibCompileFlags, "zlibCompileFlags"); - - pragma Import (C, inflateBackInit, "inflateBackInit_"); - - -- I stopped binding the inflateBack routines, because realize that - -- it does not support zlib and gzip headers for now, and have no - -- symmetric deflateBack routines. - -- ZLib-Ada is symmetric regarding deflate/inflate data transformation - -- and has a similar generic callback interface for the - -- deflate/inflate transformation based on the regular Deflate/Inflate - -- routines. - - -- pragma Import (C, inflateBack, "inflateBack"); - -- pragma Import (C, inflateBackEnd, "inflateBackEnd"); - -end ZLib.Thin; diff --git a/compat/zlib/contrib/ada/zlib.adb b/compat/zlib/contrib/ada/zlib.adb deleted file mode 100644 index 8b6fd68..0000000 --- a/compat/zlib/contrib/ada/zlib.adb +++ /dev/null @@ -1,701 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2004 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- $Id: zlib.adb,v 1.31 2004/09/06 06:53:19 vagul Exp $ - -with Ada.Exceptions; -with Ada.Unchecked_Conversion; -with Ada.Unchecked_Deallocation; - -with Interfaces.C.Strings; - -with ZLib.Thin; - -package body ZLib is - - use type Thin.Int; - - type Z_Stream is new Thin.Z_Stream; - - type Return_Code_Enum is - (OK, - STREAM_END, - NEED_DICT, - ERRNO, - STREAM_ERROR, - DATA_ERROR, - MEM_ERROR, - BUF_ERROR, - VERSION_ERROR); - - type Flate_Step_Function is access - function (Strm : in Thin.Z_Streamp; Flush : in Thin.Int) return Thin.Int; - pragma Convention (C, Flate_Step_Function); - - type Flate_End_Function is access - function (Ctrm : in Thin.Z_Streamp) return Thin.Int; - pragma Convention (C, Flate_End_Function); - - type Flate_Type is record - Step : Flate_Step_Function; - Done : Flate_End_Function; - end record; - - subtype Footer_Array is Stream_Element_Array (1 .. 8); - - Simple_GZip_Header : constant Stream_Element_Array (1 .. 10) - := (16#1f#, 16#8b#, -- Magic header - 16#08#, -- Z_DEFLATED - 16#00#, -- Flags - 16#00#, 16#00#, 16#00#, 16#00#, -- Time - 16#00#, -- XFlags - 16#03# -- OS code - ); - -- The simplest gzip header is not for informational, but just for - -- gzip format compatibility. - -- Note that some code below is using assumption - -- Simple_GZip_Header'Last > Footer_Array'Last, so do not make - -- Simple_GZip_Header'Last <= Footer_Array'Last. - - Return_Code : constant array (Thin.Int range <>) of Return_Code_Enum - := (0 => OK, - 1 => STREAM_END, - 2 => NEED_DICT, - -1 => ERRNO, - -2 => STREAM_ERROR, - -3 => DATA_ERROR, - -4 => MEM_ERROR, - -5 => BUF_ERROR, - -6 => VERSION_ERROR); - - Flate : constant array (Boolean) of Flate_Type - := (True => (Step => Thin.Deflate'Access, - Done => Thin.DeflateEnd'Access), - False => (Step => Thin.Inflate'Access, - Done => Thin.InflateEnd'Access)); - - Flush_Finish : constant array (Boolean) of Flush_Mode - := (True => Finish, False => No_Flush); - - procedure Raise_Error (Stream : in Z_Stream); - pragma Inline (Raise_Error); - - procedure Raise_Error (Message : in String); - pragma Inline (Raise_Error); - - procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int); - - procedure Free is new Ada.Unchecked_Deallocation - (Z_Stream, Z_Stream_Access); - - function To_Thin_Access is new Ada.Unchecked_Conversion - (Z_Stream_Access, Thin.Z_Streamp); - - procedure Translate_GZip - (Filter : in out Filter_Type; - In_Data : in Ada.Streams.Stream_Element_Array; - In_Last : out Ada.Streams.Stream_Element_Offset; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode); - -- Separate translate routine for make gzip header. - - procedure Translate_Auto - (Filter : in out Filter_Type; - In_Data : in Ada.Streams.Stream_Element_Array; - In_Last : out Ada.Streams.Stream_Element_Offset; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode); - -- translate routine without additional headers. - - ----------------- - -- Check_Error -- - ----------------- - - procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int) is - use type Thin.Int; - begin - if Code /= Thin.Z_OK then - Raise_Error - (Return_Code_Enum'Image (Return_Code (Code)) - & ": " & Last_Error_Message (Stream)); - end if; - end Check_Error; - - ----------- - -- Close -- - ----------- - - procedure Close - (Filter : in out Filter_Type; - Ignore_Error : in Boolean := False) - is - Code : Thin.Int; - begin - if not Ignore_Error and then not Is_Open (Filter) then - raise Status_Error; - end if; - - Code := Flate (Filter.Compression).Done (To_Thin_Access (Filter.Strm)); - - if Ignore_Error or else Code = Thin.Z_OK then - Free (Filter.Strm); - else - declare - Error_Message : constant String - := Last_Error_Message (Filter.Strm.all); - begin - Free (Filter.Strm); - Ada.Exceptions.Raise_Exception - (ZLib_Error'Identity, - Return_Code_Enum'Image (Return_Code (Code)) - & ": " & Error_Message); - end; - end if; - end Close; - - ----------- - -- CRC32 -- - ----------- - - function CRC32 - (CRC : in Unsigned_32; - Data : in Ada.Streams.Stream_Element_Array) - return Unsigned_32 - is - use Thin; - begin - return Unsigned_32 (crc32 (ULong (CRC), - Data'Address, - Data'Length)); - end CRC32; - - procedure CRC32 - (CRC : in out Unsigned_32; - Data : in Ada.Streams.Stream_Element_Array) is - begin - CRC := CRC32 (CRC, Data); - end CRC32; - - ------------------ - -- Deflate_Init -- - ------------------ - - procedure Deflate_Init - (Filter : in out Filter_Type; - Level : in Compression_Level := Default_Compression; - Strategy : in Strategy_Type := Default_Strategy; - Method : in Compression_Method := Deflated; - Window_Bits : in Window_Bits_Type := Default_Window_Bits; - Memory_Level : in Memory_Level_Type := Default_Memory_Level; - Header : in Header_Type := Default) - is - use type Thin.Int; - Win_Bits : Thin.Int := Thin.Int (Window_Bits); - begin - if Is_Open (Filter) then - raise Status_Error; - end if; - - -- We allow ZLib to make header only in case of default header type. - -- Otherwise we would either do header by ourselfs, or do not do - -- header at all. - - if Header = None or else Header = GZip then - Win_Bits := -Win_Bits; - end if; - - -- For the GZip CRC calculation and make headers. - - if Header = GZip then - Filter.CRC := 0; - Filter.Offset := Simple_GZip_Header'First; - else - Filter.Offset := Simple_GZip_Header'Last + 1; - end if; - - Filter.Strm := new Z_Stream; - Filter.Compression := True; - Filter.Stream_End := False; - Filter.Header := Header; - - if Thin.Deflate_Init - (To_Thin_Access (Filter.Strm), - Level => Thin.Int (Level), - method => Thin.Int (Method), - windowBits => Win_Bits, - memLevel => Thin.Int (Memory_Level), - strategy => Thin.Int (Strategy)) /= Thin.Z_OK - then - Raise_Error (Filter.Strm.all); - end if; - end Deflate_Init; - - ----------- - -- Flush -- - ----------- - - procedure Flush - (Filter : in out Filter_Type; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode) - is - No_Data : Stream_Element_Array := (1 .. 0 => 0); - Last : Stream_Element_Offset; - begin - Translate (Filter, No_Data, Last, Out_Data, Out_Last, Flush); - end Flush; - - ----------------------- - -- Generic_Translate -- - ----------------------- - - procedure Generic_Translate - (Filter : in out ZLib.Filter_Type; - In_Buffer_Size : in Integer := Default_Buffer_Size; - Out_Buffer_Size : in Integer := Default_Buffer_Size) - is - In_Buffer : Stream_Element_Array - (1 .. Stream_Element_Offset (In_Buffer_Size)); - Out_Buffer : Stream_Element_Array - (1 .. Stream_Element_Offset (Out_Buffer_Size)); - Last : Stream_Element_Offset; - In_Last : Stream_Element_Offset; - In_First : Stream_Element_Offset; - Out_Last : Stream_Element_Offset; - begin - Main : loop - Data_In (In_Buffer, Last); - - In_First := In_Buffer'First; - - loop - Translate - (Filter => Filter, - In_Data => In_Buffer (In_First .. Last), - In_Last => In_Last, - Out_Data => Out_Buffer, - Out_Last => Out_Last, - Flush => Flush_Finish (Last < In_Buffer'First)); - - if Out_Buffer'First <= Out_Last then - Data_Out (Out_Buffer (Out_Buffer'First .. Out_Last)); - end if; - - exit Main when Stream_End (Filter); - - -- The end of in buffer. - - exit when In_Last = Last; - - In_First := In_Last + 1; - end loop; - end loop Main; - - end Generic_Translate; - - ------------------ - -- Inflate_Init -- - ------------------ - - procedure Inflate_Init - (Filter : in out Filter_Type; - Window_Bits : in Window_Bits_Type := Default_Window_Bits; - Header : in Header_Type := Default) - is - use type Thin.Int; - Win_Bits : Thin.Int := Thin.Int (Window_Bits); - - procedure Check_Version; - -- Check the latest header types compatibility. - - procedure Check_Version is - begin - if Version <= "1.1.4" then - Raise_Error - ("Inflate header type " & Header_Type'Image (Header) - & " incompatible with ZLib version " & Version); - end if; - end Check_Version; - - begin - if Is_Open (Filter) then - raise Status_Error; - end if; - - case Header is - when None => - Check_Version; - - -- Inflate data without headers determined - -- by negative Win_Bits. - - Win_Bits := -Win_Bits; - when GZip => - Check_Version; - - -- Inflate gzip data defined by flag 16. - - Win_Bits := Win_Bits + 16; - when Auto => - Check_Version; - - -- Inflate with automatic detection - -- of gzip or native header defined by flag 32. - - Win_Bits := Win_Bits + 32; - when Default => null; - end case; - - Filter.Strm := new Z_Stream; - Filter.Compression := False; - Filter.Stream_End := False; - Filter.Header := Header; - - if Thin.Inflate_Init - (To_Thin_Access (Filter.Strm), Win_Bits) /= Thin.Z_OK - then - Raise_Error (Filter.Strm.all); - end if; - end Inflate_Init; - - ------------- - -- Is_Open -- - ------------- - - function Is_Open (Filter : in Filter_Type) return Boolean is - begin - return Filter.Strm /= null; - end Is_Open; - - ----------------- - -- Raise_Error -- - ----------------- - - procedure Raise_Error (Message : in String) is - begin - Ada.Exceptions.Raise_Exception (ZLib_Error'Identity, Message); - end Raise_Error; - - procedure Raise_Error (Stream : in Z_Stream) is - begin - Raise_Error (Last_Error_Message (Stream)); - end Raise_Error; - - ---------- - -- Read -- - ---------- - - procedure Read - (Filter : in out Filter_Type; - Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode := No_Flush) - is - In_Last : Stream_Element_Offset; - Item_First : Ada.Streams.Stream_Element_Offset := Item'First; - V_Flush : Flush_Mode := Flush; - - begin - pragma Assert (Rest_First in Buffer'First .. Buffer'Last + 1); - pragma Assert (Rest_Last in Buffer'First - 1 .. Buffer'Last); - - loop - if Rest_Last = Buffer'First - 1 then - V_Flush := Finish; - - elsif Rest_First > Rest_Last then - Read (Buffer, Rest_Last); - Rest_First := Buffer'First; - - if Rest_Last < Buffer'First then - V_Flush := Finish; - end if; - end if; - - Translate - (Filter => Filter, - In_Data => Buffer (Rest_First .. Rest_Last), - In_Last => In_Last, - Out_Data => Item (Item_First .. Item'Last), - Out_Last => Last, - Flush => V_Flush); - - Rest_First := In_Last + 1; - - exit when Stream_End (Filter) - or else Last = Item'Last - or else (Last >= Item'First and then Allow_Read_Some); - - Item_First := Last + 1; - end loop; - end Read; - - ---------------- - -- Stream_End -- - ---------------- - - function Stream_End (Filter : in Filter_Type) return Boolean is - begin - if Filter.Header = GZip and Filter.Compression then - return Filter.Stream_End - and then Filter.Offset = Footer_Array'Last + 1; - else - return Filter.Stream_End; - end if; - end Stream_End; - - -------------- - -- Total_In -- - -------------- - - function Total_In (Filter : in Filter_Type) return Count is - begin - return Count (Thin.Total_In (To_Thin_Access (Filter.Strm).all)); - end Total_In; - - --------------- - -- Total_Out -- - --------------- - - function Total_Out (Filter : in Filter_Type) return Count is - begin - return Count (Thin.Total_Out (To_Thin_Access (Filter.Strm).all)); - end Total_Out; - - --------------- - -- Translate -- - --------------- - - procedure Translate - (Filter : in out Filter_Type; - In_Data : in Ada.Streams.Stream_Element_Array; - In_Last : out Ada.Streams.Stream_Element_Offset; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode) is - begin - if Filter.Header = GZip and then Filter.Compression then - Translate_GZip - (Filter => Filter, - In_Data => In_Data, - In_Last => In_Last, - Out_Data => Out_Data, - Out_Last => Out_Last, - Flush => Flush); - else - Translate_Auto - (Filter => Filter, - In_Data => In_Data, - In_Last => In_Last, - Out_Data => Out_Data, - Out_Last => Out_Last, - Flush => Flush); - end if; - end Translate; - - -------------------- - -- Translate_Auto -- - -------------------- - - procedure Translate_Auto - (Filter : in out Filter_Type; - In_Data : in Ada.Streams.Stream_Element_Array; - In_Last : out Ada.Streams.Stream_Element_Offset; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode) - is - use type Thin.Int; - Code : Thin.Int; - - begin - if not Is_Open (Filter) then - raise Status_Error; - end if; - - if Out_Data'Length = 0 and then In_Data'Length = 0 then - raise Constraint_Error; - end if; - - Set_Out (Filter.Strm.all, Out_Data'Address, Out_Data'Length); - Set_In (Filter.Strm.all, In_Data'Address, In_Data'Length); - - Code := Flate (Filter.Compression).Step - (To_Thin_Access (Filter.Strm), - Thin.Int (Flush)); - - if Code = Thin.Z_STREAM_END then - Filter.Stream_End := True; - else - Check_Error (Filter.Strm.all, Code); - end if; - - In_Last := In_Data'Last - - Stream_Element_Offset (Avail_In (Filter.Strm.all)); - Out_Last := Out_Data'Last - - Stream_Element_Offset (Avail_Out (Filter.Strm.all)); - end Translate_Auto; - - -------------------- - -- Translate_GZip -- - -------------------- - - procedure Translate_GZip - (Filter : in out Filter_Type; - In_Data : in Ada.Streams.Stream_Element_Array; - In_Last : out Ada.Streams.Stream_Element_Offset; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode) - is - Out_First : Stream_Element_Offset; - - procedure Add_Data (Data : in Stream_Element_Array); - -- Add data to stream from the Filter.Offset till necessary, - -- used for add gzip headr/footer. - - procedure Put_32 - (Item : in out Stream_Element_Array; - Data : in Unsigned_32); - pragma Inline (Put_32); - - -------------- - -- Add_Data -- - -------------- - - procedure Add_Data (Data : in Stream_Element_Array) is - Data_First : Stream_Element_Offset renames Filter.Offset; - Data_Last : Stream_Element_Offset; - Data_Len : Stream_Element_Offset; -- -1 - Out_Len : Stream_Element_Offset; -- -1 - begin - Out_First := Out_Last + 1; - - if Data_First > Data'Last then - return; - end if; - - Data_Len := Data'Last - Data_First; - Out_Len := Out_Data'Last - Out_First; - - if Data_Len <= Out_Len then - Out_Last := Out_First + Data_Len; - Data_Last := Data'Last; - else - Out_Last := Out_Data'Last; - Data_Last := Data_First + Out_Len; - end if; - - Out_Data (Out_First .. Out_Last) := Data (Data_First .. Data_Last); - - Data_First := Data_Last + 1; - Out_First := Out_Last + 1; - end Add_Data; - - ------------ - -- Put_32 -- - ------------ - - procedure Put_32 - (Item : in out Stream_Element_Array; - Data : in Unsigned_32) - is - D : Unsigned_32 := Data; - begin - for J in Item'First .. Item'First + 3 loop - Item (J) := Stream_Element (D and 16#FF#); - D := Shift_Right (D, 8); - end loop; - end Put_32; - - begin - Out_Last := Out_Data'First - 1; - - if not Filter.Stream_End then - Add_Data (Simple_GZip_Header); - - Translate_Auto - (Filter => Filter, - In_Data => In_Data, - In_Last => In_Last, - Out_Data => Out_Data (Out_First .. Out_Data'Last), - Out_Last => Out_Last, - Flush => Flush); - - CRC32 (Filter.CRC, In_Data (In_Data'First .. In_Last)); - end if; - - if Filter.Stream_End and then Out_Last <= Out_Data'Last then - -- This detection method would work only when - -- Simple_GZip_Header'Last > Footer_Array'Last - - if Filter.Offset = Simple_GZip_Header'Last + 1 then - Filter.Offset := Footer_Array'First; - end if; - - declare - Footer : Footer_Array; - begin - Put_32 (Footer, Filter.CRC); - Put_32 (Footer (Footer'First + 4 .. Footer'Last), - Unsigned_32 (Total_In (Filter))); - Add_Data (Footer); - end; - end if; - end Translate_GZip; - - ------------- - -- Version -- - ------------- - - function Version return String is - begin - return Interfaces.C.Strings.Value (Thin.zlibVersion); - end Version; - - ----------- - -- Write -- - ----------- - - procedure Write - (Filter : in out Filter_Type; - Item : in Ada.Streams.Stream_Element_Array; - Flush : in Flush_Mode := No_Flush) - is - Buffer : Stream_Element_Array (1 .. Buffer_Size); - In_Last : Stream_Element_Offset; - Out_Last : Stream_Element_Offset; - In_First : Stream_Element_Offset := Item'First; - begin - if Item'Length = 0 and Flush = No_Flush then - return; - end if; - - loop - Translate - (Filter => Filter, - In_Data => Item (In_First .. Item'Last), - In_Last => In_Last, - Out_Data => Buffer, - Out_Last => Out_Last, - Flush => Flush); - - if Out_Last >= Buffer'First then - Write (Buffer (1 .. Out_Last)); - end if; - - exit when In_Last = Item'Last or Stream_End (Filter); - - In_First := In_Last + 1; - end loop; - end Write; - -end ZLib; diff --git a/compat/zlib/contrib/ada/zlib.ads b/compat/zlib/contrib/ada/zlib.ads deleted file mode 100644 index 79ffc40..0000000 --- a/compat/zlib/contrib/ada/zlib.ads +++ /dev/null @@ -1,328 +0,0 @@ ------------------------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2004 Dmitriy Anisimkov -- --- -- --- This library is free software; you can redistribute it and/or modify -- --- it under the terms of the GNU General Public License as published by -- --- the Free Software Foundation; either version 2 of the License, or (at -- --- your option) any later version. -- --- -- --- This library is distributed in the hope that it will be useful, but -- --- WITHOUT ANY WARRANTY; without even the implied warranty of -- --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- --- General Public License for more details. -- --- -- --- You should have received a copy of the GNU General Public License -- --- along with this library; if not, write to the Free Software Foundation, -- --- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- --- -- --- As a special exception, if other files instantiate generics from this -- --- unit, or you link this unit with other files to produce an executable, -- --- this unit does not by itself cause the resulting executable to be -- --- covered by the GNU General Public License. This exception does not -- --- however invalidate any other reasons why the executable file might be -- --- covered by the GNU Public License. -- ------------------------------------------------------------------------------- - --- $Id: zlib.ads,v 1.26 2004/09/06 06:53:19 vagul Exp $ - -with Ada.Streams; - -with Interfaces; - -package ZLib is - - ZLib_Error : exception; - Status_Error : exception; - - type Compression_Level is new Integer range -1 .. 9; - - type Flush_Mode is private; - - type Compression_Method is private; - - type Window_Bits_Type is new Integer range 8 .. 15; - - type Memory_Level_Type is new Integer range 1 .. 9; - - type Unsigned_32 is new Interfaces.Unsigned_32; - - type Strategy_Type is private; - - type Header_Type is (None, Auto, Default, GZip); - -- Header type usage have a some limitation for inflate. - -- See comment for Inflate_Init. - - subtype Count is Ada.Streams.Stream_Element_Count; - - Default_Memory_Level : constant Memory_Level_Type := 8; - Default_Window_Bits : constant Window_Bits_Type := 15; - - ---------------------------------- - -- Compression method constants -- - ---------------------------------- - - Deflated : constant Compression_Method; - -- Only one method allowed in this ZLib version - - --------------------------------- - -- Compression level constants -- - --------------------------------- - - No_Compression : constant Compression_Level := 0; - Best_Speed : constant Compression_Level := 1; - Best_Compression : constant Compression_Level := 9; - Default_Compression : constant Compression_Level := -1; - - -------------------------- - -- Flush mode constants -- - -------------------------- - - No_Flush : constant Flush_Mode; - -- Regular way for compression, no flush - - Partial_Flush : constant Flush_Mode; - -- Will be removed, use Z_SYNC_FLUSH instead - - Sync_Flush : constant Flush_Mode; - -- All pending output is flushed to the output buffer and the output - -- is aligned on a byte boundary, so that the decompressor can get all - -- input data available so far. (In particular avail_in is zero after the - -- call if enough output space has been provided before the call.) - -- Flushing may degrade compression for some compression algorithms and so - -- it should be used only when necessary. - - Block_Flush : constant Flush_Mode; - -- Z_BLOCK requests that inflate() stop - -- if and when it get to the next deflate block boundary. When decoding the - -- zlib or gzip format, this will cause inflate() to return immediately - -- after the header and before the first block. When doing a raw inflate, - -- inflate() will go ahead and process the first block, and will return - -- when it gets to the end of that block, or when it runs out of data. - - Full_Flush : constant Flush_Mode; - -- All output is flushed as with SYNC_FLUSH, and the compression state - -- is reset so that decompression can restart from this point if previous - -- compressed data has been damaged or if random access is desired. Using - -- Full_Flush too often can seriously degrade the compression. - - Finish : constant Flush_Mode; - -- Just for tell the compressor that input data is complete. - - ------------------------------------ - -- Compression strategy constants -- - ------------------------------------ - - -- RLE stategy could be used only in version 1.2.0 and later. - - Filtered : constant Strategy_Type; - Huffman_Only : constant Strategy_Type; - RLE : constant Strategy_Type; - Default_Strategy : constant Strategy_Type; - - Default_Buffer_Size : constant := 4096; - - type Filter_Type is tagged limited private; - -- The filter is for compression and for decompression. - -- The usage of the type is depend of its initialization. - - function Version return String; - pragma Inline (Version); - -- Return string representation of the ZLib version. - - procedure Deflate_Init - (Filter : in out Filter_Type; - Level : in Compression_Level := Default_Compression; - Strategy : in Strategy_Type := Default_Strategy; - Method : in Compression_Method := Deflated; - Window_Bits : in Window_Bits_Type := Default_Window_Bits; - Memory_Level : in Memory_Level_Type := Default_Memory_Level; - Header : in Header_Type := Default); - -- Compressor initialization. - -- When Header parameter is Auto or Default, then default zlib header - -- would be provided for compressed data. - -- When Header is GZip, then gzip header would be set instead of - -- default header. - -- When Header is None, no header would be set for compressed data. - - procedure Inflate_Init - (Filter : in out Filter_Type; - Window_Bits : in Window_Bits_Type := Default_Window_Bits; - Header : in Header_Type := Default); - -- Decompressor initialization. - -- Default header type mean that ZLib default header is expecting in the - -- input compressed stream. - -- Header type None mean that no header is expecting in the input stream. - -- GZip header type mean that GZip header is expecting in the - -- input compressed stream. - -- Auto header type mean that header type (GZip or Native) would be - -- detected automatically in the input stream. - -- Note that header types parameter values None, GZip and Auto are - -- supported for inflate routine only in ZLib versions 1.2.0.2 and later. - -- Deflate_Init is supporting all header types. - - function Is_Open (Filter : in Filter_Type) return Boolean; - pragma Inline (Is_Open); - -- Is the filter opened for compression or decompression. - - procedure Close - (Filter : in out Filter_Type; - Ignore_Error : in Boolean := False); - -- Closing the compression or decompressor. - -- If stream is closing before the complete and Ignore_Error is False, - -- The exception would be raised. - - generic - with procedure Data_In - (Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset); - with procedure Data_Out - (Item : in Ada.Streams.Stream_Element_Array); - procedure Generic_Translate - (Filter : in out Filter_Type; - In_Buffer_Size : in Integer := Default_Buffer_Size; - Out_Buffer_Size : in Integer := Default_Buffer_Size); - -- Compress/decompress data fetch from Data_In routine and pass the result - -- to the Data_Out routine. User should provide Data_In and Data_Out - -- for compression/decompression data flow. - -- Compression or decompression depend on Filter initialization. - - function Total_In (Filter : in Filter_Type) return Count; - pragma Inline (Total_In); - -- Returns total number of input bytes read so far - - function Total_Out (Filter : in Filter_Type) return Count; - pragma Inline (Total_Out); - -- Returns total number of bytes output so far - - function CRC32 - (CRC : in Unsigned_32; - Data : in Ada.Streams.Stream_Element_Array) - return Unsigned_32; - pragma Inline (CRC32); - -- Compute CRC32, it could be necessary for make gzip format - - procedure CRC32 - (CRC : in out Unsigned_32; - Data : in Ada.Streams.Stream_Element_Array); - pragma Inline (CRC32); - -- Compute CRC32, it could be necessary for make gzip format - - ------------------------------------------------- - -- Below is more complex low level routines. -- - ------------------------------------------------- - - procedure Translate - (Filter : in out Filter_Type; - In_Data : in Ada.Streams.Stream_Element_Array; - In_Last : out Ada.Streams.Stream_Element_Offset; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode); - -- Compress/decompress the In_Data buffer and place the result into - -- Out_Data. In_Last is the index of last element from In_Data accepted by - -- the Filter. Out_Last is the last element of the received data from - -- Filter. To tell the filter that incoming data are complete put the - -- Flush parameter to Finish. - - function Stream_End (Filter : in Filter_Type) return Boolean; - pragma Inline (Stream_End); - -- Return the true when the stream is complete. - - procedure Flush - (Filter : in out Filter_Type; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode); - pragma Inline (Flush); - -- Flushing the data from the compressor. - - generic - with procedure Write - (Item : in Ada.Streams.Stream_Element_Array); - -- User should provide this routine for accept - -- compressed/decompressed data. - - Buffer_Size : in Ada.Streams.Stream_Element_Offset - := Default_Buffer_Size; - -- Buffer size for Write user routine. - - procedure Write - (Filter : in out Filter_Type; - Item : in Ada.Streams.Stream_Element_Array; - Flush : in Flush_Mode := No_Flush); - -- Compress/Decompress data from Item to the generic parameter procedure - -- Write. Output buffer size could be set in Buffer_Size generic parameter. - - generic - with procedure Read - (Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset); - -- User should provide data for compression/decompression - -- thru this routine. - - Buffer : in out Ada.Streams.Stream_Element_Array; - -- Buffer for keep remaining data from the previous - -- back read. - - Rest_First, Rest_Last : in out Ada.Streams.Stream_Element_Offset; - -- Rest_First have to be initialized to Buffer'Last + 1 - -- Rest_Last have to be initialized to Buffer'Last - -- before usage. - - Allow_Read_Some : in Boolean := False; - -- Is it allowed to return Last < Item'Last before end of data. - - procedure Read - (Filter : in out Filter_Type; - Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode := No_Flush); - -- Compress/Decompress data from generic parameter procedure Read to the - -- Item. User should provide Buffer and initialized Rest_First, Rest_Last - -- indicators. If Allow_Read_Some is True, Read routines could return - -- Last < Item'Last only at end of stream. - -private - - use Ada.Streams; - - pragma Assert (Ada.Streams.Stream_Element'Size = 8); - pragma Assert (Ada.Streams.Stream_Element'Modulus = 2**8); - - type Flush_Mode is new Integer range 0 .. 5; - - type Compression_Method is new Integer range 8 .. 8; - - type Strategy_Type is new Integer range 0 .. 3; - - No_Flush : constant Flush_Mode := 0; - Partial_Flush : constant Flush_Mode := 1; - Sync_Flush : constant Flush_Mode := 2; - Full_Flush : constant Flush_Mode := 3; - Finish : constant Flush_Mode := 4; - Block_Flush : constant Flush_Mode := 5; - - Filtered : constant Strategy_Type := 1; - Huffman_Only : constant Strategy_Type := 2; - RLE : constant Strategy_Type := 3; - Default_Strategy : constant Strategy_Type := 0; - - Deflated : constant Compression_Method := 8; - - type Z_Stream; - - type Z_Stream_Access is access all Z_Stream; - - type Filter_Type is tagged limited record - Strm : Z_Stream_Access; - Compression : Boolean; - Stream_End : Boolean; - Header : Header_Type; - CRC : Unsigned_32; - Offset : Stream_Element_Offset; - -- Offset for gzip header/footer output. - end record; - -end ZLib; diff --git a/compat/zlib/contrib/ada/zlib.gpr b/compat/zlib/contrib/ada/zlib.gpr deleted file mode 100644 index 296b22a..0000000 --- a/compat/zlib/contrib/ada/zlib.gpr +++ /dev/null @@ -1,20 +0,0 @@ -project Zlib is - - for Languages use ("Ada"); - for Source_Dirs use ("."); - for Object_Dir use "."; - for Main use ("test.adb", "mtest.adb", "read.adb", "buffer_demo"); - - package Compiler is - for Default_Switches ("ada") use ("-gnatwcfilopru", "-gnatVcdfimorst", "-gnatyabcefhiklmnoprst"); - end Compiler; - - package Linker is - for Default_Switches ("ada") use ("-lz"); - end Linker; - - package Builder is - for Default_Switches ("ada") use ("-s", "-gnatQ"); - end Builder; - -end Zlib; diff --git a/compat/zlib/contrib/amd64/amd64-match.S b/compat/zlib/contrib/amd64/amd64-match.S deleted file mode 100644 index 81d4a1c..0000000 --- a/compat/zlib/contrib/amd64/amd64-match.S +++ /dev/null @@ -1,452 +0,0 @@ -/* - * match.S -- optimized version of longest_match() - * based on the similar work by Gilles Vollant, and Brian Raiter, written 1998 - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the BSD License. Use by owners of Che Guevarra - * parafernalia is prohibited, where possible, and highly discouraged - * elsewhere. - */ - -#ifndef NO_UNDERLINE -# define match_init _match_init -# define longest_match _longest_match -#endif - -#define scanend ebx -#define scanendw bx -#define chainlenwmask edx /* high word: current chain len low word: s->wmask */ -#define curmatch rsi -#define curmatchd esi -#define windowbestlen r8 -#define scanalign r9 -#define scanalignd r9d -#define window r10 -#define bestlen r11 -#define bestlend r11d -#define scanstart r12d -#define scanstartw r12w -#define scan r13 -#define nicematch r14d -#define limit r15 -#define limitd r15d -#define prev rcx - -/* - * The 258 is a "magic number, not a parameter -- changing it - * breaks the hell loose - */ -#define MAX_MATCH (258) -#define MIN_MATCH (3) -#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) -#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) - -/* stack frame offsets */ -#define LocalVarsSize (112) -#define _chainlenwmask ( 8-LocalVarsSize)(%rsp) -#define _windowbestlen (16-LocalVarsSize)(%rsp) -#define save_r14 (24-LocalVarsSize)(%rsp) -#define save_rsi (32-LocalVarsSize)(%rsp) -#define save_rbx (40-LocalVarsSize)(%rsp) -#define save_r12 (56-LocalVarsSize)(%rsp) -#define save_r13 (64-LocalVarsSize)(%rsp) -#define save_r15 (80-LocalVarsSize)(%rsp) - - -.globl match_init, longest_match - -/* - * On AMD64 the first argument of a function (in our case -- the pointer to - * deflate_state structure) is passed in %rdi, hence our offsets below are - * all off of that. - */ - -/* you can check the structure offset by running - -#include -#include -#include "deflate.h" - -void print_depl() -{ -deflate_state ds; -deflate_state *s=&ds; -printf("size pointer=%u\n",(int)sizeof(void*)); - -printf("#define dsWSize (%3u)(%%rdi)\n",(int)(((char*)&(s->w_size))-((char*)s))); -printf("#define dsWMask (%3u)(%%rdi)\n",(int)(((char*)&(s->w_mask))-((char*)s))); -printf("#define dsWindow (%3u)(%%rdi)\n",(int)(((char*)&(s->window))-((char*)s))); -printf("#define dsPrev (%3u)(%%rdi)\n",(int)(((char*)&(s->prev))-((char*)s))); -printf("#define dsMatchLen (%3u)(%%rdi)\n",(int)(((char*)&(s->match_length))-((char*)s))); -printf("#define dsPrevMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_match))-((char*)s))); -printf("#define dsStrStart (%3u)(%%rdi)\n",(int)(((char*)&(s->strstart))-((char*)s))); -printf("#define dsMatchStart (%3u)(%%rdi)\n",(int)(((char*)&(s->match_start))-((char*)s))); -printf("#define dsLookahead (%3u)(%%rdi)\n",(int)(((char*)&(s->lookahead))-((char*)s))); -printf("#define dsPrevLen (%3u)(%%rdi)\n",(int)(((char*)&(s->prev_length))-((char*)s))); -printf("#define dsMaxChainLen (%3u)(%%rdi)\n",(int)(((char*)&(s->max_chain_length))-((char*)s))); -printf("#define dsGoodMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->good_match))-((char*)s))); -printf("#define dsNiceMatch (%3u)(%%rdi)\n",(int)(((char*)&(s->nice_match))-((char*)s))); -} - -*/ - - -/* - to compile for XCode 3.2 on MacOSX x86_64 - - run "gcc -g -c -DXCODE_MAC_X64_STRUCTURE amd64-match.S" - */ - - -#ifndef CURRENT_LINX_XCODE_MAC_X64_STRUCTURE -#define dsWSize ( 68)(%rdi) -#define dsWMask ( 76)(%rdi) -#define dsWindow ( 80)(%rdi) -#define dsPrev ( 96)(%rdi) -#define dsMatchLen (144)(%rdi) -#define dsPrevMatch (148)(%rdi) -#define dsStrStart (156)(%rdi) -#define dsMatchStart (160)(%rdi) -#define dsLookahead (164)(%rdi) -#define dsPrevLen (168)(%rdi) -#define dsMaxChainLen (172)(%rdi) -#define dsGoodMatch (188)(%rdi) -#define dsNiceMatch (192)(%rdi) - -#else - -#ifndef STRUCT_OFFSET -# define STRUCT_OFFSET (0) -#endif - - -#define dsWSize ( 56 + STRUCT_OFFSET)(%rdi) -#define dsWMask ( 64 + STRUCT_OFFSET)(%rdi) -#define dsWindow ( 72 + STRUCT_OFFSET)(%rdi) -#define dsPrev ( 88 + STRUCT_OFFSET)(%rdi) -#define dsMatchLen (136 + STRUCT_OFFSET)(%rdi) -#define dsPrevMatch (140 + STRUCT_OFFSET)(%rdi) -#define dsStrStart (148 + STRUCT_OFFSET)(%rdi) -#define dsMatchStart (152 + STRUCT_OFFSET)(%rdi) -#define dsLookahead (156 + STRUCT_OFFSET)(%rdi) -#define dsPrevLen (160 + STRUCT_OFFSET)(%rdi) -#define dsMaxChainLen (164 + STRUCT_OFFSET)(%rdi) -#define dsGoodMatch (180 + STRUCT_OFFSET)(%rdi) -#define dsNiceMatch (184 + STRUCT_OFFSET)(%rdi) - -#endif - - - - -.text - -/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ - -longest_match: -/* - * Retrieve the function arguments. %curmatch will hold cur_match - * throughout the entire function (passed via rsi on amd64). - * rdi will hold the pointer to the deflate_state (first arg on amd64) - */ - mov %rsi, save_rsi - mov %rbx, save_rbx - mov %r12, save_r12 - mov %r13, save_r13 - mov %r14, save_r14 - mov %r15, save_r15 - -/* uInt wmask = s->w_mask; */ -/* unsigned chain_length = s->max_chain_length; */ -/* if (s->prev_length >= s->good_match) { */ -/* chain_length >>= 2; */ -/* } */ - - movl dsPrevLen, %eax - movl dsGoodMatch, %ebx - cmpl %ebx, %eax - movl dsWMask, %eax - movl dsMaxChainLen, %chainlenwmask - jl LastMatchGood - shrl $2, %chainlenwmask -LastMatchGood: - -/* chainlen is decremented once beforehand so that the function can */ -/* use the sign flag instead of the zero flag for the exit test. */ -/* It is then shifted into the high word, to make room for the wmask */ -/* value, which it will always accompany. */ - - decl %chainlenwmask - shll $16, %chainlenwmask - orl %eax, %chainlenwmask - -/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ - - movl dsNiceMatch, %eax - movl dsLookahead, %ebx - cmpl %eax, %ebx - jl LookaheadLess - movl %eax, %ebx -LookaheadLess: movl %ebx, %nicematch - -/* register Bytef *scan = s->window + s->strstart; */ - - mov dsWindow, %window - movl dsStrStart, %limitd - lea (%limit, %window), %scan - -/* Determine how many bytes the scan ptr is off from being */ -/* dword-aligned. */ - - mov %scan, %scanalign - negl %scanalignd - andl $3, %scanalignd - -/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ -/* s->strstart - (IPos)MAX_DIST(s) : NIL; */ - - movl dsWSize, %eax - subl $MIN_LOOKAHEAD, %eax - xorl %ecx, %ecx - subl %eax, %limitd - cmovng %ecx, %limitd - -/* int best_len = s->prev_length; */ - - movl dsPrevLen, %bestlend - -/* Store the sum of s->window + best_len in %windowbestlen locally, and in memory. */ - - lea (%window, %bestlen), %windowbestlen - mov %windowbestlen, _windowbestlen - -/* register ush scan_start = *(ushf*)scan; */ -/* register ush scan_end = *(ushf*)(scan+best_len-1); */ -/* Posf *prev = s->prev; */ - - movzwl (%scan), %scanstart - movzwl -1(%scan, %bestlen), %scanend - mov dsPrev, %prev - -/* Jump into the main loop. */ - - movl %chainlenwmask, _chainlenwmask - jmp LoopEntry - -.balign 16 - -/* do { - * match = s->window + cur_match; - * if (*(ushf*)(match+best_len-1) != scan_end || - * *(ushf*)match != scan_start) continue; - * [...] - * } while ((cur_match = prev[cur_match & wmask]) > limit - * && --chain_length != 0); - * - * Here is the inner loop of the function. The function will spend the - * majority of its time in this loop, and majority of that time will - * be spent in the first ten instructions. - */ -LookupLoop: - andl %chainlenwmask, %curmatchd - movzwl (%prev, %curmatch, 2), %curmatchd - cmpl %limitd, %curmatchd - jbe LeaveNow - subl $0x00010000, %chainlenwmask - js LeaveNow -LoopEntry: cmpw -1(%windowbestlen, %curmatch), %scanendw - jne LookupLoop - cmpw %scanstartw, (%window, %curmatch) - jne LookupLoop - -/* Store the current value of chainlen. */ - movl %chainlenwmask, _chainlenwmask - -/* %scan is the string under scrutiny, and %prev to the string we */ -/* are hoping to match it up with. In actuality, %esi and %edi are */ -/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ -/* initialized to -(MAX_MATCH_8 - scanalign). */ - - mov $(-MAX_MATCH_8), %rdx - lea (%curmatch, %window), %windowbestlen - lea MAX_MATCH_8(%windowbestlen, %scanalign), %windowbestlen - lea MAX_MATCH_8(%scan, %scanalign), %prev - -/* the prefetching below makes very little difference... */ - prefetcht1 (%windowbestlen, %rdx) - prefetcht1 (%prev, %rdx) - -/* - * Test the strings for equality, 8 bytes at a time. At the end, - * adjust %rdx so that it is offset to the exact byte that mismatched. - * - * It should be confessed that this loop usually does not represent - * much of the total running time. Replacing it with a more - * straightforward "rep cmpsb" would not drastically degrade - * performance -- unrolling it, for example, makes no difference. - */ - -#undef USE_SSE /* works, but is 6-7% slower, than non-SSE... */ - -LoopCmps: -#ifdef USE_SSE - /* Preload the SSE registers */ - movdqu (%windowbestlen, %rdx), %xmm1 - movdqu (%prev, %rdx), %xmm2 - pcmpeqb %xmm2, %xmm1 - movdqu 16(%windowbestlen, %rdx), %xmm3 - movdqu 16(%prev, %rdx), %xmm4 - pcmpeqb %xmm4, %xmm3 - movdqu 32(%windowbestlen, %rdx), %xmm5 - movdqu 32(%prev, %rdx), %xmm6 - pcmpeqb %xmm6, %xmm5 - movdqu 48(%windowbestlen, %rdx), %xmm7 - movdqu 48(%prev, %rdx), %xmm8 - pcmpeqb %xmm8, %xmm7 - - /* Check the comparisions' results */ - pmovmskb %xmm1, %rax - notw %ax - bsfw %ax, %ax - jnz LeaveLoopCmps - - /* this is the only iteration of the loop with a possibility of having - incremented rdx by 0x108 (each loop iteration add 16*4 = 0x40 - and (0x40*4)+8=0x108 */ - add $8, %rdx - jz LenMaximum - add $8, %rdx - - - pmovmskb %xmm3, %rax - notw %ax - bsfw %ax, %ax - jnz LeaveLoopCmps - - - add $16, %rdx - - - pmovmskb %xmm5, %rax - notw %ax - bsfw %ax, %ax - jnz LeaveLoopCmps - - add $16, %rdx - - - pmovmskb %xmm7, %rax - notw %ax - bsfw %ax, %ax - jnz LeaveLoopCmps - - add $16, %rdx - - jmp LoopCmps -LeaveLoopCmps: add %rax, %rdx -#else - mov (%windowbestlen, %rdx), %rax - xor (%prev, %rdx), %rax - jnz LeaveLoopCmps - - mov 8(%windowbestlen, %rdx), %rax - xor 8(%prev, %rdx), %rax - jnz LeaveLoopCmps8 - - mov 16(%windowbestlen, %rdx), %rax - xor 16(%prev, %rdx), %rax - jnz LeaveLoopCmps16 - - add $24, %rdx - jnz LoopCmps - jmp LenMaximum -# if 0 -/* - * This three-liner is tantalizingly simple, but bsf is a slow instruction, - * and the complicated alternative down below is quite a bit faster. Sad... - */ - -LeaveLoopCmps: bsf %rax, %rax /* find the first non-zero bit */ - shrl $3, %eax /* divide by 8 to get the byte */ - add %rax, %rdx -# else -LeaveLoopCmps16: - add $8, %rdx -LeaveLoopCmps8: - add $8, %rdx -LeaveLoopCmps: testl $0xFFFFFFFF, %eax /* Check the first 4 bytes */ - jnz Check16 - add $4, %rdx - shr $32, %rax -Check16: testw $0xFFFF, %ax - jnz LenLower - add $2, %rdx - shrl $16, %eax -LenLower: subb $1, %al - adc $0, %rdx -# endif -#endif - -/* Calculate the length of the match. If it is longer than MAX_MATCH, */ -/* then automatically accept it as the best possible match and leave. */ - - lea (%prev, %rdx), %rax - sub %scan, %rax - cmpl $MAX_MATCH, %eax - jge LenMaximum - -/* If the length of the match is not longer than the best match we */ -/* have so far, then forget it and return to the lookup loop. */ - - cmpl %bestlend, %eax - jg LongerMatch - mov _windowbestlen, %windowbestlen - mov dsPrev, %prev - movl _chainlenwmask, %edx - jmp LookupLoop - -/* s->match_start = cur_match; */ -/* best_len = len; */ -/* if (len >= nice_match) break; */ -/* scan_end = *(ushf*)(scan+best_len-1); */ - -LongerMatch: - movl %eax, %bestlend - movl %curmatchd, dsMatchStart - cmpl %nicematch, %eax - jge LeaveNow - - lea (%window, %bestlen), %windowbestlen - mov %windowbestlen, _windowbestlen - - movzwl -1(%scan, %rax), %scanend - mov dsPrev, %prev - movl _chainlenwmask, %chainlenwmask - jmp LookupLoop - -/* Accept the current string, with the maximum possible length. */ - -LenMaximum: - movl $MAX_MATCH, %bestlend - movl %curmatchd, dsMatchStart - -/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ -/* return s->lookahead; */ - -LeaveNow: - movl dsLookahead, %eax - cmpl %eax, %bestlend - cmovngl %bestlend, %eax -LookaheadRet: - -/* Restore the registers and return from whence we came. */ - - mov save_rsi, %rsi - mov save_rbx, %rbx - mov save_r12, %r12 - mov save_r13, %r13 - mov save_r14, %r14 - mov save_r15, %r15 - - ret - -match_init: ret diff --git a/compat/zlib/contrib/asm686/README.686 b/compat/zlib/contrib/asm686/README.686 deleted file mode 100644 index a0bf3be..0000000 --- a/compat/zlib/contrib/asm686/README.686 +++ /dev/null @@ -1,51 +0,0 @@ -This is a patched version of zlib, modified to use -Pentium-Pro-optimized assembly code in the deflation algorithm. The -files changed/added by this patch are: - -README.686 -match.S - -The speedup that this patch provides varies, depending on whether the -compiler used to build the original version of zlib falls afoul of the -PPro's speed traps. My own tests show a speedup of around 10-20% at -the default compression level, and 20-30% using -9, against a version -compiled using gcc 2.7.2.3. Your mileage may vary. - -Note that this code has been tailored for the PPro/PII in particular, -and will not perform particuarly well on a Pentium. - -If you are using an assembler other than GNU as, you will have to -translate match.S to use your assembler's syntax. (Have fun.) - -Brian Raiter -breadbox@muppetlabs.com -April, 1998 - - -Added for zlib 1.1.3: - -The patches come from -http://www.muppetlabs.com/~breadbox/software/assembly.html - -To compile zlib with this asm file, copy match.S to the zlib directory -then do: - -CFLAGS="-O3 -DASMV" ./configure -make OBJA=match.o - - -Update: - -I've been ignoring these assembly routines for years, believing that -gcc's generated code had caught up with it sometime around gcc 2.95 -and the major rearchitecting of the Pentium 4. However, I recently -learned that, despite what I believed, this code still has some life -in it. On the Pentium 4 and AMD64 chips, it continues to run about 8% -faster than the code produced by gcc 4.1. - -In acknowledgement of its continuing usefulness, I've altered the -license to match that of the rest of zlib. Share and Enjoy! - -Brian Raiter -breadbox@muppetlabs.com -April, 2007 diff --git a/compat/zlib/contrib/asm686/match.S b/compat/zlib/contrib/asm686/match.S deleted file mode 100644 index fa42109..0000000 --- a/compat/zlib/contrib/asm686/match.S +++ /dev/null @@ -1,357 +0,0 @@ -/* match.S -- x86 assembly version of the zlib longest_match() function. - * Optimized for the Intel 686 chips (PPro and later). - * - * Copyright (C) 1998, 2007 Brian Raiter - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the author be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - */ - -#ifndef NO_UNDERLINE -#define match_init _match_init -#define longest_match _longest_match -#endif - -#define MAX_MATCH (258) -#define MIN_MATCH (3) -#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) -#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) - -/* stack frame offsets */ - -#define chainlenwmask 0 /* high word: current chain len */ - /* low word: s->wmask */ -#define window 4 /* local copy of s->window */ -#define windowbestlen 8 /* s->window + bestlen */ -#define scanstart 16 /* first two bytes of string */ -#define scanend 12 /* last two bytes of string */ -#define scanalign 20 /* dword-misalignment of string */ -#define nicematch 24 /* a good enough match size */ -#define bestlen 28 /* size of best match so far */ -#define scan 32 /* ptr to string wanting match */ - -#define LocalVarsSize (36) -/* saved ebx 36 */ -/* saved edi 40 */ -/* saved esi 44 */ -/* saved ebp 48 */ -/* return address 52 */ -#define deflatestate 56 /* the function arguments */ -#define curmatch 60 - -/* All the +zlib1222add offsets are due to the addition of fields - * in zlib in the deflate_state structure since the asm code was first written - * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). - * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). - * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). - */ - -#define zlib1222add (8) - -#define dsWSize (36+zlib1222add) -#define dsWMask (44+zlib1222add) -#define dsWindow (48+zlib1222add) -#define dsPrev (56+zlib1222add) -#define dsMatchLen (88+zlib1222add) -#define dsPrevMatch (92+zlib1222add) -#define dsStrStart (100+zlib1222add) -#define dsMatchStart (104+zlib1222add) -#define dsLookahead (108+zlib1222add) -#define dsPrevLen (112+zlib1222add) -#define dsMaxChainLen (116+zlib1222add) -#define dsGoodMatch (132+zlib1222add) -#define dsNiceMatch (136+zlib1222add) - - -.file "match.S" - -.globl match_init, longest_match - -.text - -/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ -.cfi_sections .debug_frame - -longest_match: - -.cfi_startproc -/* Save registers that the compiler may be using, and adjust %esp to */ -/* make room for our stack frame. */ - - pushl %ebp - .cfi_def_cfa_offset 8 - .cfi_offset ebp, -8 - pushl %edi - .cfi_def_cfa_offset 12 - pushl %esi - .cfi_def_cfa_offset 16 - pushl %ebx - .cfi_def_cfa_offset 20 - subl $LocalVarsSize, %esp - .cfi_def_cfa_offset LocalVarsSize+20 - -/* Retrieve the function arguments. %ecx will hold cur_match */ -/* throughout the entire function. %edx will hold the pointer to the */ -/* deflate_state structure during the function's setup (before */ -/* entering the main loop). */ - - movl deflatestate(%esp), %edx - movl curmatch(%esp), %ecx - -/* uInt wmask = s->w_mask; */ -/* unsigned chain_length = s->max_chain_length; */ -/* if (s->prev_length >= s->good_match) { */ -/* chain_length >>= 2; */ -/* } */ - - movl dsPrevLen(%edx), %eax - movl dsGoodMatch(%edx), %ebx - cmpl %ebx, %eax - movl dsWMask(%edx), %eax - movl dsMaxChainLen(%edx), %ebx - jl LastMatchGood - shrl $2, %ebx -LastMatchGood: - -/* chainlen is decremented once beforehand so that the function can */ -/* use the sign flag instead of the zero flag for the exit test. */ -/* It is then shifted into the high word, to make room for the wmask */ -/* value, which it will always accompany. */ - - decl %ebx - shll $16, %ebx - orl %eax, %ebx - movl %ebx, chainlenwmask(%esp) - -/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ - - movl dsNiceMatch(%edx), %eax - movl dsLookahead(%edx), %ebx - cmpl %eax, %ebx - jl LookaheadLess - movl %eax, %ebx -LookaheadLess: movl %ebx, nicematch(%esp) - -/* register Bytef *scan = s->window + s->strstart; */ - - movl dsWindow(%edx), %esi - movl %esi, window(%esp) - movl dsStrStart(%edx), %ebp - lea (%esi,%ebp), %edi - movl %edi, scan(%esp) - -/* Determine how many bytes the scan ptr is off from being */ -/* dword-aligned. */ - - movl %edi, %eax - negl %eax - andl $3, %eax - movl %eax, scanalign(%esp) - -/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ -/* s->strstart - (IPos)MAX_DIST(s) : NIL; */ - - movl dsWSize(%edx), %eax - subl $MIN_LOOKAHEAD, %eax - subl %eax, %ebp - jg LimitPositive - xorl %ebp, %ebp -LimitPositive: - -/* int best_len = s->prev_length; */ - - movl dsPrevLen(%edx), %eax - movl %eax, bestlen(%esp) - -/* Store the sum of s->window + best_len in %esi locally, and in %esi. */ - - addl %eax, %esi - movl %esi, windowbestlen(%esp) - -/* register ush scan_start = *(ushf*)scan; */ -/* register ush scan_end = *(ushf*)(scan+best_len-1); */ -/* Posf *prev = s->prev; */ - - movzwl (%edi), %ebx - movl %ebx, scanstart(%esp) - movzwl -1(%edi,%eax), %ebx - movl %ebx, scanend(%esp) - movl dsPrev(%edx), %edi - -/* Jump into the main loop. */ - - movl chainlenwmask(%esp), %edx - jmp LoopEntry - -.balign 16 - -/* do { - * match = s->window + cur_match; - * if (*(ushf*)(match+best_len-1) != scan_end || - * *(ushf*)match != scan_start) continue; - * [...] - * } while ((cur_match = prev[cur_match & wmask]) > limit - * && --chain_length != 0); - * - * Here is the inner loop of the function. The function will spend the - * majority of its time in this loop, and majority of that time will - * be spent in the first ten instructions. - * - * Within this loop: - * %ebx = scanend - * %ecx = curmatch - * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) - * %esi = windowbestlen - i.e., (window + bestlen) - * %edi = prev - * %ebp = limit - */ -LookupLoop: - andl %edx, %ecx - movzwl (%edi,%ecx,2), %ecx - cmpl %ebp, %ecx - jbe LeaveNow - subl $0x00010000, %edx - js LeaveNow -LoopEntry: movzwl -1(%esi,%ecx), %eax - cmpl %ebx, %eax - jnz LookupLoop - movl window(%esp), %eax - movzwl (%eax,%ecx), %eax - cmpl scanstart(%esp), %eax - jnz LookupLoop - -/* Store the current value of chainlen. */ - - movl %edx, chainlenwmask(%esp) - -/* Point %edi to the string under scrutiny, and %esi to the string we */ -/* are hoping to match it up with. In actuality, %esi and %edi are */ -/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ -/* initialized to -(MAX_MATCH_8 - scanalign). */ - - movl window(%esp), %esi - movl scan(%esp), %edi - addl %ecx, %esi - movl scanalign(%esp), %eax - movl $(-MAX_MATCH_8), %edx - lea MAX_MATCH_8(%edi,%eax), %edi - lea MAX_MATCH_8(%esi,%eax), %esi - -/* Test the strings for equality, 8 bytes at a time. At the end, - * adjust %edx so that it is offset to the exact byte that mismatched. - * - * We already know at this point that the first three bytes of the - * strings match each other, and they can be safely passed over before - * starting the compare loop. So what this code does is skip over 0-3 - * bytes, as much as necessary in order to dword-align the %edi - * pointer. (%esi will still be misaligned three times out of four.) - * - * It should be confessed that this loop usually does not represent - * much of the total running time. Replacing it with a more - * straightforward "rep cmpsb" would not drastically degrade - * performance. - */ -LoopCmps: - movl (%esi,%edx), %eax - xorl (%edi,%edx), %eax - jnz LeaveLoopCmps - movl 4(%esi,%edx), %eax - xorl 4(%edi,%edx), %eax - jnz LeaveLoopCmps4 - addl $8, %edx - jnz LoopCmps - jmp LenMaximum -LeaveLoopCmps4: addl $4, %edx -LeaveLoopCmps: testl $0x0000FFFF, %eax - jnz LenLower - addl $2, %edx - shrl $16, %eax -LenLower: subb $1, %al - adcl $0, %edx - -/* Calculate the length of the match. If it is longer than MAX_MATCH, */ -/* then automatically accept it as the best possible match and leave. */ - - lea (%edi,%edx), %eax - movl scan(%esp), %edi - subl %edi, %eax - cmpl $MAX_MATCH, %eax - jge LenMaximum - -/* If the length of the match is not longer than the best match we */ -/* have so far, then forget it and return to the lookup loop. */ - - movl deflatestate(%esp), %edx - movl bestlen(%esp), %ebx - cmpl %ebx, %eax - jg LongerMatch - movl windowbestlen(%esp), %esi - movl dsPrev(%edx), %edi - movl scanend(%esp), %ebx - movl chainlenwmask(%esp), %edx - jmp LookupLoop - -/* s->match_start = cur_match; */ -/* best_len = len; */ -/* if (len >= nice_match) break; */ -/* scan_end = *(ushf*)(scan+best_len-1); */ - -LongerMatch: movl nicematch(%esp), %ebx - movl %eax, bestlen(%esp) - movl %ecx, dsMatchStart(%edx) - cmpl %ebx, %eax - jge LeaveNow - movl window(%esp), %esi - addl %eax, %esi - movl %esi, windowbestlen(%esp) - movzwl -1(%edi,%eax), %ebx - movl dsPrev(%edx), %edi - movl %ebx, scanend(%esp) - movl chainlenwmask(%esp), %edx - jmp LookupLoop - -/* Accept the current string, with the maximum possible length. */ - -LenMaximum: movl deflatestate(%esp), %edx - movl $MAX_MATCH, bestlen(%esp) - movl %ecx, dsMatchStart(%edx) - -/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ -/* return s->lookahead; */ - -LeaveNow: - movl deflatestate(%esp), %edx - movl bestlen(%esp), %ebx - movl dsLookahead(%edx), %eax - cmpl %eax, %ebx - jg LookaheadRet - movl %ebx, %eax -LookaheadRet: - -/* Restore the stack and return from whence we came. */ - - addl $LocalVarsSize, %esp - .cfi_def_cfa_offset 20 - popl %ebx - .cfi_def_cfa_offset 16 - popl %esi - .cfi_def_cfa_offset 12 - popl %edi - .cfi_def_cfa_offset 8 - popl %ebp - .cfi_def_cfa_offset 4 -.cfi_endproc -match_init: ret diff --git a/compat/zlib/contrib/blast/Makefile b/compat/zlib/contrib/blast/Makefile deleted file mode 100644 index 9be80ba..0000000 --- a/compat/zlib/contrib/blast/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -blast: blast.c blast.h - cc -DTEST -o blast blast.c - -test: blast - blast < test.pk | cmp - test.txt - -clean: - rm -f blast blast.o diff --git a/compat/zlib/contrib/blast/README b/compat/zlib/contrib/blast/README deleted file mode 100644 index e3a60b3..0000000 --- a/compat/zlib/contrib/blast/README +++ /dev/null @@ -1,4 +0,0 @@ -Read blast.h for purpose and usage. - -Mark Adler -madler@alumni.caltech.edu diff --git a/compat/zlib/contrib/blast/blast.c b/compat/zlib/contrib/blast/blast.c deleted file mode 100644 index e6e6590..0000000 --- a/compat/zlib/contrib/blast/blast.c +++ /dev/null @@ -1,466 +0,0 @@ -/* blast.c - * Copyright (C) 2003, 2012, 2013 Mark Adler - * For conditions of distribution and use, see copyright notice in blast.h - * version 1.3, 24 Aug 2013 - * - * blast.c decompresses data compressed by the PKWare Compression Library. - * This function provides functionality similar to the explode() function of - * the PKWare library, hence the name "blast". - * - * This decompressor is based on the excellent format description provided by - * Ben Rudiak-Gould in comp.compression on August 13, 2001. Interestingly, the - * example Ben provided in the post is incorrect. The distance 110001 should - * instead be 111000. When corrected, the example byte stream becomes: - * - * 00 04 82 24 25 8f 80 7f - * - * which decompresses to "AIAIAIAIAIAIA" (without the quotes). - */ - -/* - * Change history: - * - * 1.0 12 Feb 2003 - First version - * 1.1 16 Feb 2003 - Fixed distance check for > 4 GB uncompressed data - * 1.2 24 Oct 2012 - Add note about using binary mode in stdio - * - Fix comparisons of differently signed integers - * 1.3 24 Aug 2013 - Return unused input from blast() - * - Fix test code to correctly report unused input - * - Enable the provision of initial input to blast() - */ - -#include /* for NULL */ -#include /* for setjmp(), longjmp(), and jmp_buf */ -#include "blast.h" /* prototype for blast() */ - -#define local static /* for local function definitions */ -#define MAXBITS 13 /* maximum code length */ -#define MAXWIN 4096 /* maximum window size */ - -/* input and output state */ -struct state { - /* input state */ - blast_in infun; /* input function provided by user */ - void *inhow; /* opaque information passed to infun() */ - unsigned char *in; /* next input location */ - unsigned left; /* available input at in */ - int bitbuf; /* bit buffer */ - int bitcnt; /* number of bits in bit buffer */ - - /* input limit error return state for bits() and decode() */ - jmp_buf env; - - /* output state */ - blast_out outfun; /* output function provided by user */ - void *outhow; /* opaque information passed to outfun() */ - unsigned next; /* index of next write location in out[] */ - int first; /* true to check distances (for first 4K) */ - unsigned char out[MAXWIN]; /* output buffer and sliding window */ -}; - -/* - * Return need bits from the input stream. This always leaves less than - * eight bits in the buffer. bits() works properly for need == 0. - * - * Format notes: - * - * - Bits are stored in bytes from the least significant bit to the most - * significant bit. Therefore bits are dropped from the bottom of the bit - * buffer, using shift right, and new bytes are appended to the top of the - * bit buffer, using shift left. - */ -local int bits(struct state *s, int need) -{ - int val; /* bit accumulator */ - - /* load at least need bits into val */ - val = s->bitbuf; - while (s->bitcnt < need) { - if (s->left == 0) { - s->left = s->infun(s->inhow, &(s->in)); - if (s->left == 0) longjmp(s->env, 1); /* out of input */ - } - val |= (int)(*(s->in)++) << s->bitcnt; /* load eight bits */ - s->left--; - s->bitcnt += 8; - } - - /* drop need bits and update buffer, always zero to seven bits left */ - s->bitbuf = val >> need; - s->bitcnt -= need; - - /* return need bits, zeroing the bits above that */ - return val & ((1 << need) - 1); -} - -/* - * Huffman code decoding tables. count[1..MAXBITS] is the number of symbols of - * each length, which for a canonical code are stepped through in order. - * symbol[] are the symbol values in canonical order, where the number of - * entries is the sum of the counts in count[]. The decoding process can be - * seen in the function decode() below. - */ -struct huffman { - short *count; /* number of symbols of each length */ - short *symbol; /* canonically ordered symbols */ -}; - -/* - * Decode a code from the stream s using huffman table h. Return the symbol or - * a negative value if there is an error. If all of the lengths are zero, i.e. - * an empty code, or if the code is incomplete and an invalid code is received, - * then -9 is returned after reading MAXBITS bits. - * - * Format notes: - * - * - The codes as stored in the compressed data are bit-reversed relative to - * a simple integer ordering of codes of the same lengths. Hence below the - * bits are pulled from the compressed data one at a time and used to - * build the code value reversed from what is in the stream in order to - * permit simple integer comparisons for decoding. - * - * - The first code for the shortest length is all ones. Subsequent codes of - * the same length are simply integer decrements of the previous code. When - * moving up a length, a one bit is appended to the code. For a complete - * code, the last code of the longest length will be all zeros. To support - * this ordering, the bits pulled during decoding are inverted to apply the - * more "natural" ordering starting with all zeros and incrementing. - */ -local int decode(struct state *s, struct huffman *h) -{ - int len; /* current number of bits in code */ - int code; /* len bits being decoded */ - int first; /* first code of length len */ - int count; /* number of codes of length len */ - int index; /* index of first code of length len in symbol table */ - int bitbuf; /* bits from stream */ - int left; /* bits left in next or left to process */ - short *next; /* next number of codes */ - - bitbuf = s->bitbuf; - left = s->bitcnt; - code = first = index = 0; - len = 1; - next = h->count + 1; - while (1) { - while (left--) { - code |= (bitbuf & 1) ^ 1; /* invert code */ - bitbuf >>= 1; - count = *next++; - if (code < first + count) { /* if length len, return symbol */ - s->bitbuf = bitbuf; - s->bitcnt = (s->bitcnt - len) & 7; - return h->symbol[index + (code - first)]; - } - index += count; /* else update for next length */ - first += count; - first <<= 1; - code <<= 1; - len++; - } - left = (MAXBITS+1) - len; - if (left == 0) break; - if (s->left == 0) { - s->left = s->infun(s->inhow, &(s->in)); - if (s->left == 0) longjmp(s->env, 1); /* out of input */ - } - bitbuf = *(s->in)++; - s->left--; - if (left > 8) left = 8; - } - return -9; /* ran out of codes */ -} - -/* - * Given a list of repeated code lengths rep[0..n-1], where each byte is a - * count (high four bits + 1) and a code length (low four bits), generate the - * list of code lengths. This compaction reduces the size of the object code. - * Then given the list of code lengths length[0..n-1] representing a canonical - * Huffman code for n symbols, construct the tables required to decode those - * codes. Those tables are the number of codes of each length, and the symbols - * sorted by length, retaining their original order within each length. The - * return value is zero for a complete code set, negative for an over- - * subscribed code set, and positive for an incomplete code set. The tables - * can be used if the return value is zero or positive, but they cannot be used - * if the return value is negative. If the return value is zero, it is not - * possible for decode() using that table to return an error--any stream of - * enough bits will resolve to a symbol. If the return value is positive, then - * it is possible for decode() using that table to return an error for received - * codes past the end of the incomplete lengths. - */ -local int construct(struct huffman *h, const unsigned char *rep, int n) -{ - int symbol; /* current symbol when stepping through length[] */ - int len; /* current length when stepping through h->count[] */ - int left; /* number of possible codes left of current length */ - short offs[MAXBITS+1]; /* offsets in symbol table for each length */ - short length[256]; /* code lengths */ - - /* convert compact repeat counts into symbol bit length list */ - symbol = 0; - do { - len = *rep++; - left = (len >> 4) + 1; - len &= 15; - do { - length[symbol++] = len; - } while (--left); - } while (--n); - n = symbol; - - /* count number of codes of each length */ - for (len = 0; len <= MAXBITS; len++) - h->count[len] = 0; - for (symbol = 0; symbol < n; symbol++) - (h->count[length[symbol]])++; /* assumes lengths are within bounds */ - if (h->count[0] == n) /* no codes! */ - return 0; /* complete, but decode() will fail */ - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; /* one possible code of zero length */ - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; /* one more bit, double codes left */ - left -= h->count[len]; /* deduct count from possible codes */ - if (left < 0) return left; /* over-subscribed--return negative */ - } /* left > 0 means incomplete */ - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) - offs[len + 1] = offs[len] + h->count[len]; - - /* - * put symbols in table sorted by length, by symbol order within each - * length - */ - for (symbol = 0; symbol < n; symbol++) - if (length[symbol] != 0) - h->symbol[offs[length[symbol]]++] = symbol; - - /* return zero for complete set, positive for incomplete set */ - return left; -} - -/* - * Decode PKWare Compression Library stream. - * - * Format notes: - * - * - First byte is 0 if literals are uncoded or 1 if they are coded. Second - * byte is 4, 5, or 6 for the number of extra bits in the distance code. - * This is the base-2 logarithm of the dictionary size minus six. - * - * - Compressed data is a combination of literals and length/distance pairs - * terminated by an end code. Literals are either Huffman coded or - * uncoded bytes. A length/distance pair is a coded length followed by a - * coded distance to represent a string that occurs earlier in the - * uncompressed data that occurs again at the current location. - * - * - A bit preceding a literal or length/distance pair indicates which comes - * next, 0 for literals, 1 for length/distance. - * - * - If literals are uncoded, then the next eight bits are the literal, in the - * normal bit order in the stream, i.e. no bit-reversal is needed. Similarly, - * no bit reversal is needed for either the length extra bits or the distance - * extra bits. - * - * - Literal bytes are simply written to the output. A length/distance pair is - * an instruction to copy previously uncompressed bytes to the output. The - * copy is from distance bytes back in the output stream, copying for length - * bytes. - * - * - Distances pointing before the beginning of the output data are not - * permitted. - * - * - Overlapped copies, where the length is greater than the distance, are - * allowed and common. For example, a distance of one and a length of 518 - * simply copies the last byte 518 times. A distance of four and a length of - * twelve copies the last four bytes three times. A simple forward copy - * ignoring whether the length is greater than the distance or not implements - * this correctly. - */ -local int decomp(struct state *s) -{ - int lit; /* true if literals are coded */ - int dict; /* log2(dictionary size) - 6 */ - int symbol; /* decoded symbol, extra bits for distance */ - int len; /* length for copy */ - unsigned dist; /* distance for copy */ - int copy; /* copy counter */ - unsigned char *from, *to; /* copy pointers */ - static int virgin = 1; /* build tables once */ - static short litcnt[MAXBITS+1], litsym[256]; /* litcode memory */ - static short lencnt[MAXBITS+1], lensym[16]; /* lencode memory */ - static short distcnt[MAXBITS+1], distsym[64]; /* distcode memory */ - static struct huffman litcode = {litcnt, litsym}; /* length code */ - static struct huffman lencode = {lencnt, lensym}; /* length code */ - static struct huffman distcode = {distcnt, distsym};/* distance code */ - /* bit lengths of literal codes */ - static const unsigned char litlen[] = { - 11, 124, 8, 7, 28, 7, 188, 13, 76, 4, 10, 8, 12, 10, 12, 10, 8, 23, 8, - 9, 7, 6, 7, 8, 7, 6, 55, 8, 23, 24, 12, 11, 7, 9, 11, 12, 6, 7, 22, 5, - 7, 24, 6, 11, 9, 6, 7, 22, 7, 11, 38, 7, 9, 8, 25, 11, 8, 11, 9, 12, - 8, 12, 5, 38, 5, 38, 5, 11, 7, 5, 6, 21, 6, 10, 53, 8, 7, 24, 10, 27, - 44, 253, 253, 253, 252, 252, 252, 13, 12, 45, 12, 45, 12, 61, 12, 45, - 44, 173}; - /* bit lengths of length codes 0..15 */ - static const unsigned char lenlen[] = {2, 35, 36, 53, 38, 23}; - /* bit lengths of distance codes 0..63 */ - static const unsigned char distlen[] = {2, 20, 53, 230, 247, 151, 248}; - static const short base[16] = { /* base for length codes */ - 3, 2, 4, 5, 6, 7, 8, 9, 10, 12, 16, 24, 40, 72, 136, 264}; - static const char extra[16] = { /* extra bits for length codes */ - 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8}; - - /* set up decoding tables (once--might not be thread-safe) */ - if (virgin) { - construct(&litcode, litlen, sizeof(litlen)); - construct(&lencode, lenlen, sizeof(lenlen)); - construct(&distcode, distlen, sizeof(distlen)); - virgin = 0; - } - - /* read header */ - lit = bits(s, 8); - if (lit > 1) return -1; - dict = bits(s, 8); - if (dict < 4 || dict > 6) return -2; - - /* decode literals and length/distance pairs */ - do { - if (bits(s, 1)) { - /* get length */ - symbol = decode(s, &lencode); - len = base[symbol] + bits(s, extra[symbol]); - if (len == 519) break; /* end code */ - - /* get distance */ - symbol = len == 2 ? 2 : dict; - dist = decode(s, &distcode) << symbol; - dist += bits(s, symbol); - dist++; - if (s->first && dist > s->next) - return -3; /* distance too far back */ - - /* copy length bytes from distance bytes back */ - do { - to = s->out + s->next; - from = to - dist; - copy = MAXWIN; - if (s->next < dist) { - from += copy; - copy = dist; - } - copy -= s->next; - if (copy > len) copy = len; - len -= copy; - s->next += copy; - do { - *to++ = *from++; - } while (--copy); - if (s->next == MAXWIN) { - if (s->outfun(s->outhow, s->out, s->next)) return 1; - s->next = 0; - s->first = 0; - } - } while (len != 0); - } - else { - /* get literal and write it */ - symbol = lit ? decode(s, &litcode) : bits(s, 8); - s->out[s->next++] = symbol; - if (s->next == MAXWIN) { - if (s->outfun(s->outhow, s->out, s->next)) return 1; - s->next = 0; - s->first = 0; - } - } - } while (1); - return 0; -} - -/* See comments in blast.h */ -int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow, - unsigned *left, unsigned char **in) -{ - struct state s; /* input/output state */ - int err; /* return value */ - - /* initialize input state */ - s.infun = infun; - s.inhow = inhow; - if (left != NULL && *left) { - s.left = *left; - s.in = *in; - } - else - s.left = 0; - s.bitbuf = 0; - s.bitcnt = 0; - - /* initialize output state */ - s.outfun = outfun; - s.outhow = outhow; - s.next = 0; - s.first = 1; - - /* return if bits() or decode() tries to read past available input */ - if (setjmp(s.env) != 0) /* if came back here via longjmp(), */ - err = 2; /* then skip decomp(), return error */ - else - err = decomp(&s); /* decompress */ - - /* return unused input */ - if (left != NULL) - *left = s.left; - if (in != NULL) - *in = s.left ? s.in : NULL; - - /* write any leftover output and update the error code if needed */ - if (err != 1 && s.next && s.outfun(s.outhow, s.out, s.next) && err == 0) - err = 1; - return err; -} - -#ifdef TEST -/* Example of how to use blast() */ -#include -#include - -#define CHUNK 16384 - -local unsigned inf(void *how, unsigned char **buf) -{ - static unsigned char hold[CHUNK]; - - *buf = hold; - return fread(hold, 1, CHUNK, (FILE *)how); -} - -local int outf(void *how, unsigned char *buf, unsigned len) -{ - return fwrite(buf, 1, len, (FILE *)how) != len; -} - -/* Decompress a PKWare Compression Library stream from stdin to stdout */ -int main(void) -{ - int ret; - unsigned left; - - /* decompress to stdout */ - left = 0; - ret = blast(inf, stdin, outf, stdout, &left, NULL); - if (ret != 0) - fprintf(stderr, "blast error: %d\n", ret); - - /* count any leftover bytes */ - while (getchar() != EOF) - left++; - if (left) - fprintf(stderr, "blast warning: %u unused bytes of input\n", left); - - /* return blast() error code */ - return ret; -} -#endif diff --git a/compat/zlib/contrib/blast/blast.h b/compat/zlib/contrib/blast/blast.h deleted file mode 100644 index 6cf65ed..0000000 --- a/compat/zlib/contrib/blast/blast.h +++ /dev/null @@ -1,83 +0,0 @@ -/* blast.h -- interface for blast.c - Copyright (C) 2003, 2012, 2013 Mark Adler - version 1.3, 24 Aug 2013 - - This software is provided 'as-is', without any express or implied - warranty. In no event will the author be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Mark Adler madler@alumni.caltech.edu - */ - - -/* - * blast() decompresses the PKWare Data Compression Library (DCL) compressed - * format. It provides the same functionality as the explode() function in - * that library. (Note: PKWare overused the "implode" verb, and the format - * used by their library implode() function is completely different and - * incompatible with the implode compression method supported by PKZIP.) - * - * The binary mode for stdio functions should be used to assure that the - * compressed data is not corrupted when read or written. For example: - * fopen(..., "rb") and fopen(..., "wb"). - */ - - -typedef unsigned (*blast_in)(void *how, unsigned char **buf); -typedef int (*blast_out)(void *how, unsigned char *buf, unsigned len); -/* Definitions for input/output functions passed to blast(). See below for - * what the provided functions need to do. - */ - - -int blast(blast_in infun, void *inhow, blast_out outfun, void *outhow, - unsigned *left, unsigned char **in); -/* Decompress input to output using the provided infun() and outfun() calls. - * On success, the return value of blast() is zero. If there is an error in - * the source data, i.e. it is not in the proper format, then a negative value - * is returned. If there is not enough input available or there is not enough - * output space, then a positive error is returned. - * - * The input function is invoked: len = infun(how, &buf), where buf is set by - * infun() to point to the input buffer, and infun() returns the number of - * available bytes there. If infun() returns zero, then blast() returns with - * an input error. (blast() only asks for input if it needs it.) inhow is for - * use by the application to pass an input descriptor to infun(), if desired. - * - * If left and in are not NULL and *left is not zero when blast() is called, - * then the *left bytes are *in are consumed for input before infun() is used. - * - * The output function is invoked: err = outfun(how, buf, len), where the bytes - * to be written are buf[0..len-1]. If err is not zero, then blast() returns - * with an output error. outfun() is always called with len <= 4096. outhow - * is for use by the application to pass an output descriptor to outfun(), if - * desired. - * - * If there is any unused input, *left is set to the number of bytes that were - * read and *in points to them. Otherwise *left is set to zero and *in is set - * to NULL. If left or in are NULL, then they are not set. - * - * The return codes are: - * - * 2: ran out of input before completing decompression - * 1: output error before completing decompression - * 0: successful decompression - * -1: literal flag not zero or one - * -2: dictionary size not in 4..6 - * -3: distance is too far back - * - * At the bottom of blast.c is an example program that uses blast() that can be - * compiled to produce a command-line decompression filter by defining TEST. - */ diff --git a/compat/zlib/contrib/blast/test.pk b/compat/zlib/contrib/blast/test.pk deleted file mode 100644 index be10b2b..0000000 Binary files a/compat/zlib/contrib/blast/test.pk and /dev/null differ diff --git a/compat/zlib/contrib/blast/test.txt b/compat/zlib/contrib/blast/test.txt deleted file mode 100644 index bfdf1c5..0000000 --- a/compat/zlib/contrib/blast/test.txt +++ /dev/null @@ -1 +0,0 @@ -AIAIAIAIAIAIA \ No newline at end of file diff --git a/compat/zlib/contrib/delphi/ZLib.pas b/compat/zlib/contrib/delphi/ZLib.pas deleted file mode 100644 index 060e199..0000000 --- a/compat/zlib/contrib/delphi/ZLib.pas +++ /dev/null @@ -1,557 +0,0 @@ -{*******************************************************} -{ } -{ Borland Delphi Supplemental Components } -{ ZLIB Data Compression Interface Unit } -{ } -{ Copyright (c) 1997,99 Borland Corporation } -{ } -{*******************************************************} - -{ Updated for zlib 1.2.x by Cosmin Truta } - -unit ZLib; - -interface - -uses SysUtils, Classes; - -type - TAlloc = function (AppData: Pointer; Items, Size: Integer): Pointer; cdecl; - TFree = procedure (AppData, Block: Pointer); cdecl; - - // Internal structure. Ignore. - TZStreamRec = packed record - next_in: PChar; // next input byte - avail_in: Integer; // number of bytes available at next_in - total_in: Longint; // total nb of input bytes read so far - - next_out: PChar; // next output byte should be put here - avail_out: Integer; // remaining free space at next_out - total_out: Longint; // total nb of bytes output so far - - msg: PChar; // last error message, NULL if no error - internal: Pointer; // not visible by applications - - zalloc: TAlloc; // used to allocate the internal state - zfree: TFree; // used to free the internal state - AppData: Pointer; // private data object passed to zalloc and zfree - - data_type: Integer; // best guess about the data type: ascii or binary - adler: Longint; // adler32 value of the uncompressed data - reserved: Longint; // reserved for future use - end; - - // Abstract ancestor class - TCustomZlibStream = class(TStream) - private - FStrm: TStream; - FStrmPos: Integer; - FOnProgress: TNotifyEvent; - FZRec: TZStreamRec; - FBuffer: array [Word] of Char; - protected - procedure Progress(Sender: TObject); dynamic; - property OnProgress: TNotifyEvent read FOnProgress write FOnProgress; - constructor Create(Strm: TStream); - end; - -{ TCompressionStream compresses data on the fly as data is written to it, and - stores the compressed data to another stream. - - TCompressionStream is write-only and strictly sequential. Reading from the - stream will raise an exception. Using Seek to move the stream pointer - will raise an exception. - - Output data is cached internally, written to the output stream only when - the internal output buffer is full. All pending output data is flushed - when the stream is destroyed. - - The Position property returns the number of uncompressed bytes of - data that have been written to the stream so far. - - CompressionRate returns the on-the-fly percentage by which the original - data has been compressed: (1 - (CompressedBytes / UncompressedBytes)) * 100 - If raw data size = 100 and compressed data size = 25, the CompressionRate - is 75% - - The OnProgress event is called each time the output buffer is filled and - written to the output stream. This is useful for updating a progress - indicator when you are writing a large chunk of data to the compression - stream in a single call.} - - - TCompressionLevel = (clNone, clFastest, clDefault, clMax); - - TCompressionStream = class(TCustomZlibStream) - private - function GetCompressionRate: Single; - public - constructor Create(CompressionLevel: TCompressionLevel; Dest: TStream); - destructor Destroy; override; - function Read(var Buffer; Count: Longint): Longint; override; - function Write(const Buffer; Count: Longint): Longint; override; - function Seek(Offset: Longint; Origin: Word): Longint; override; - property CompressionRate: Single read GetCompressionRate; - property OnProgress; - end; - -{ TDecompressionStream decompresses data on the fly as data is read from it. - - Compressed data comes from a separate source stream. TDecompressionStream - is read-only and unidirectional; you can seek forward in the stream, but not - backwards. The special case of setting the stream position to zero is - allowed. Seeking forward decompresses data until the requested position in - the uncompressed data has been reached. Seeking backwards, seeking relative - to the end of the stream, requesting the size of the stream, and writing to - the stream will raise an exception. - - The Position property returns the number of bytes of uncompressed data that - have been read from the stream so far. - - The OnProgress event is called each time the internal input buffer of - compressed data is exhausted and the next block is read from the input stream. - This is useful for updating a progress indicator when you are reading a - large chunk of data from the decompression stream in a single call.} - - TDecompressionStream = class(TCustomZlibStream) - public - constructor Create(Source: TStream); - destructor Destroy; override; - function Read(var Buffer; Count: Longint): Longint; override; - function Write(const Buffer; Count: Longint): Longint; override; - function Seek(Offset: Longint; Origin: Word): Longint; override; - property OnProgress; - end; - - - -{ CompressBuf compresses data, buffer to buffer, in one call. - In: InBuf = ptr to compressed data - InBytes = number of bytes in InBuf - Out: OutBuf = ptr to newly allocated buffer containing decompressed data - OutBytes = number of bytes in OutBuf } -procedure CompressBuf(const InBuf: Pointer; InBytes: Integer; - out OutBuf: Pointer; out OutBytes: Integer); - - -{ DecompressBuf decompresses data, buffer to buffer, in one call. - In: InBuf = ptr to compressed data - InBytes = number of bytes in InBuf - OutEstimate = zero, or est. size of the decompressed data - Out: OutBuf = ptr to newly allocated buffer containing decompressed data - OutBytes = number of bytes in OutBuf } -procedure DecompressBuf(const InBuf: Pointer; InBytes: Integer; - OutEstimate: Integer; out OutBuf: Pointer; out OutBytes: Integer); - -{ DecompressToUserBuf decompresses data, buffer to buffer, in one call. - In: InBuf = ptr to compressed data - InBytes = number of bytes in InBuf - Out: OutBuf = ptr to user-allocated buffer to contain decompressed data - BufSize = number of bytes in OutBuf } -procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer; - const OutBuf: Pointer; BufSize: Integer); - -const - zlib_version = '1.2.11'; - -type - EZlibError = class(Exception); - ECompressionError = class(EZlibError); - EDecompressionError = class(EZlibError); - -implementation - -uses ZLibConst; - -const - Z_NO_FLUSH = 0; - Z_PARTIAL_FLUSH = 1; - Z_SYNC_FLUSH = 2; - Z_FULL_FLUSH = 3; - Z_FINISH = 4; - - Z_OK = 0; - Z_STREAM_END = 1; - Z_NEED_DICT = 2; - Z_ERRNO = (-1); - Z_STREAM_ERROR = (-2); - Z_DATA_ERROR = (-3); - Z_MEM_ERROR = (-4); - Z_BUF_ERROR = (-5); - Z_VERSION_ERROR = (-6); - - Z_NO_COMPRESSION = 0; - Z_BEST_SPEED = 1; - Z_BEST_COMPRESSION = 9; - Z_DEFAULT_COMPRESSION = (-1); - - Z_FILTERED = 1; - Z_HUFFMAN_ONLY = 2; - Z_RLE = 3; - Z_DEFAULT_STRATEGY = 0; - - Z_BINARY = 0; - Z_ASCII = 1; - Z_UNKNOWN = 2; - - Z_DEFLATED = 8; - - -{$L adler32.obj} -{$L compress.obj} -{$L crc32.obj} -{$L deflate.obj} -{$L infback.obj} -{$L inffast.obj} -{$L inflate.obj} -{$L inftrees.obj} -{$L trees.obj} -{$L uncompr.obj} -{$L zutil.obj} - -procedure adler32; external; -procedure compressBound; external; -procedure crc32; external; -procedure deflateInit2_; external; -procedure deflateParams; external; - -function _malloc(Size: Integer): Pointer; cdecl; -begin - Result := AllocMem(Size); -end; - -procedure _free(Block: Pointer); cdecl; -begin - FreeMem(Block); -end; - -procedure _memset(P: Pointer; B: Byte; count: Integer); cdecl; -begin - FillChar(P^, count, B); -end; - -procedure _memcpy(dest, source: Pointer; count: Integer); cdecl; -begin - Move(source^, dest^, count); -end; - - - -// deflate compresses data -function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; - recsize: Integer): Integer; external; -function deflate(var strm: TZStreamRec; flush: Integer): Integer; external; -function deflateEnd(var strm: TZStreamRec): Integer; external; - -// inflate decompresses data -function inflateInit_(var strm: TZStreamRec; version: PChar; - recsize: Integer): Integer; external; -function inflate(var strm: TZStreamRec; flush: Integer): Integer; external; -function inflateEnd(var strm: TZStreamRec): Integer; external; -function inflateReset(var strm: TZStreamRec): Integer; external; - - -function zlibAllocMem(AppData: Pointer; Items, Size: Integer): Pointer; cdecl; -begin -// GetMem(Result, Items*Size); - Result := AllocMem(Items * Size); -end; - -procedure zlibFreeMem(AppData, Block: Pointer); cdecl; -begin - FreeMem(Block); -end; - -{function zlibCheck(code: Integer): Integer; -begin - Result := code; - if code < 0 then - raise EZlibError.Create('error'); //!! -end;} - -function CCheck(code: Integer): Integer; -begin - Result := code; - if code < 0 then - raise ECompressionError.Create('error'); //!! -end; - -function DCheck(code: Integer): Integer; -begin - Result := code; - if code < 0 then - raise EDecompressionError.Create('error'); //!! -end; - -procedure CompressBuf(const InBuf: Pointer; InBytes: Integer; - out OutBuf: Pointer; out OutBytes: Integer); -var - strm: TZStreamRec; - P: Pointer; -begin - FillChar(strm, sizeof(strm), 0); - strm.zalloc := zlibAllocMem; - strm.zfree := zlibFreeMem; - OutBytes := ((InBytes + (InBytes div 10) + 12) + 255) and not 255; - GetMem(OutBuf, OutBytes); - try - strm.next_in := InBuf; - strm.avail_in := InBytes; - strm.next_out := OutBuf; - strm.avail_out := OutBytes; - CCheck(deflateInit_(strm, Z_BEST_COMPRESSION, zlib_version, sizeof(strm))); - try - while CCheck(deflate(strm, Z_FINISH)) <> Z_STREAM_END do - begin - P := OutBuf; - Inc(OutBytes, 256); - ReallocMem(OutBuf, OutBytes); - strm.next_out := PChar(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P))); - strm.avail_out := 256; - end; - finally - CCheck(deflateEnd(strm)); - end; - ReallocMem(OutBuf, strm.total_out); - OutBytes := strm.total_out; - except - FreeMem(OutBuf); - raise - end; -end; - - -procedure DecompressBuf(const InBuf: Pointer; InBytes: Integer; - OutEstimate: Integer; out OutBuf: Pointer; out OutBytes: Integer); -var - strm: TZStreamRec; - P: Pointer; - BufInc: Integer; -begin - FillChar(strm, sizeof(strm), 0); - strm.zalloc := zlibAllocMem; - strm.zfree := zlibFreeMem; - BufInc := (InBytes + 255) and not 255; - if OutEstimate = 0 then - OutBytes := BufInc - else - OutBytes := OutEstimate; - GetMem(OutBuf, OutBytes); - try - strm.next_in := InBuf; - strm.avail_in := InBytes; - strm.next_out := OutBuf; - strm.avail_out := OutBytes; - DCheck(inflateInit_(strm, zlib_version, sizeof(strm))); - try - while DCheck(inflate(strm, Z_NO_FLUSH)) <> Z_STREAM_END do - begin - P := OutBuf; - Inc(OutBytes, BufInc); - ReallocMem(OutBuf, OutBytes); - strm.next_out := PChar(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P))); - strm.avail_out := BufInc; - end; - finally - DCheck(inflateEnd(strm)); - end; - ReallocMem(OutBuf, strm.total_out); - OutBytes := strm.total_out; - except - FreeMem(OutBuf); - raise - end; -end; - -procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer; - const OutBuf: Pointer; BufSize: Integer); -var - strm: TZStreamRec; -begin - FillChar(strm, sizeof(strm), 0); - strm.zalloc := zlibAllocMem; - strm.zfree := zlibFreeMem; - strm.next_in := InBuf; - strm.avail_in := InBytes; - strm.next_out := OutBuf; - strm.avail_out := BufSize; - DCheck(inflateInit_(strm, zlib_version, sizeof(strm))); - try - if DCheck(inflate(strm, Z_FINISH)) <> Z_STREAM_END then - raise EZlibError.CreateRes(@sTargetBufferTooSmall); - finally - DCheck(inflateEnd(strm)); - end; -end; - -// TCustomZlibStream - -constructor TCustomZLibStream.Create(Strm: TStream); -begin - inherited Create; - FStrm := Strm; - FStrmPos := Strm.Position; - FZRec.zalloc := zlibAllocMem; - FZRec.zfree := zlibFreeMem; -end; - -procedure TCustomZLibStream.Progress(Sender: TObject); -begin - if Assigned(FOnProgress) then FOnProgress(Sender); -end; - - -// TCompressionStream - -constructor TCompressionStream.Create(CompressionLevel: TCompressionLevel; - Dest: TStream); -const - Levels: array [TCompressionLevel] of ShortInt = - (Z_NO_COMPRESSION, Z_BEST_SPEED, Z_DEFAULT_COMPRESSION, Z_BEST_COMPRESSION); -begin - inherited Create(Dest); - FZRec.next_out := FBuffer; - FZRec.avail_out := sizeof(FBuffer); - CCheck(deflateInit_(FZRec, Levels[CompressionLevel], zlib_version, sizeof(FZRec))); -end; - -destructor TCompressionStream.Destroy; -begin - FZRec.next_in := nil; - FZRec.avail_in := 0; - try - if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos; - while (CCheck(deflate(FZRec, Z_FINISH)) <> Z_STREAM_END) - and (FZRec.avail_out = 0) do - begin - FStrm.WriteBuffer(FBuffer, sizeof(FBuffer)); - FZRec.next_out := FBuffer; - FZRec.avail_out := sizeof(FBuffer); - end; - if FZRec.avail_out < sizeof(FBuffer) then - FStrm.WriteBuffer(FBuffer, sizeof(FBuffer) - FZRec.avail_out); - finally - deflateEnd(FZRec); - end; - inherited Destroy; -end; - -function TCompressionStream.Read(var Buffer; Count: Longint): Longint; -begin - raise ECompressionError.CreateRes(@sInvalidStreamOp); -end; - -function TCompressionStream.Write(const Buffer; Count: Longint): Longint; -begin - FZRec.next_in := @Buffer; - FZRec.avail_in := Count; - if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos; - while (FZRec.avail_in > 0) do - begin - CCheck(deflate(FZRec, 0)); - if FZRec.avail_out = 0 then - begin - FStrm.WriteBuffer(FBuffer, sizeof(FBuffer)); - FZRec.next_out := FBuffer; - FZRec.avail_out := sizeof(FBuffer); - FStrmPos := FStrm.Position; - Progress(Self); - end; - end; - Result := Count; -end; - -function TCompressionStream.Seek(Offset: Longint; Origin: Word): Longint; -begin - if (Offset = 0) and (Origin = soFromCurrent) then - Result := FZRec.total_in - else - raise ECompressionError.CreateRes(@sInvalidStreamOp); -end; - -function TCompressionStream.GetCompressionRate: Single; -begin - if FZRec.total_in = 0 then - Result := 0 - else - Result := (1.0 - (FZRec.total_out / FZRec.total_in)) * 100.0; -end; - - -// TDecompressionStream - -constructor TDecompressionStream.Create(Source: TStream); -begin - inherited Create(Source); - FZRec.next_in := FBuffer; - FZRec.avail_in := 0; - DCheck(inflateInit_(FZRec, zlib_version, sizeof(FZRec))); -end; - -destructor TDecompressionStream.Destroy; -begin - FStrm.Seek(-FZRec.avail_in, 1); - inflateEnd(FZRec); - inherited Destroy; -end; - -function TDecompressionStream.Read(var Buffer; Count: Longint): Longint; -begin - FZRec.next_out := @Buffer; - FZRec.avail_out := Count; - if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos; - while (FZRec.avail_out > 0) do - begin - if FZRec.avail_in = 0 then - begin - FZRec.avail_in := FStrm.Read(FBuffer, sizeof(FBuffer)); - if FZRec.avail_in = 0 then - begin - Result := Count - FZRec.avail_out; - Exit; - end; - FZRec.next_in := FBuffer; - FStrmPos := FStrm.Position; - Progress(Self); - end; - CCheck(inflate(FZRec, 0)); - end; - Result := Count; -end; - -function TDecompressionStream.Write(const Buffer; Count: Longint): Longint; -begin - raise EDecompressionError.CreateRes(@sInvalidStreamOp); -end; - -function TDecompressionStream.Seek(Offset: Longint; Origin: Word): Longint; -var - I: Integer; - Buf: array [0..4095] of Char; -begin - if (Offset = 0) and (Origin = soFromBeginning) then - begin - DCheck(inflateReset(FZRec)); - FZRec.next_in := FBuffer; - FZRec.avail_in := 0; - FStrm.Position := 0; - FStrmPos := 0; - end - else if ( (Offset >= 0) and (Origin = soFromCurrent)) or - ( ((Offset - FZRec.total_out) > 0) and (Origin = soFromBeginning)) then - begin - if Origin = soFromBeginning then Dec(Offset, FZRec.total_out); - if Offset > 0 then - begin - for I := 1 to Offset div sizeof(Buf) do - ReadBuffer(Buf, sizeof(Buf)); - ReadBuffer(Buf, Offset mod sizeof(Buf)); - end; - end - else - raise EDecompressionError.CreateRes(@sInvalidStreamOp); - Result := FZRec.total_out; -end; - - -end. diff --git a/compat/zlib/contrib/delphi/ZLibConst.pas b/compat/zlib/contrib/delphi/ZLibConst.pas deleted file mode 100644 index cdfe136..0000000 --- a/compat/zlib/contrib/delphi/ZLibConst.pas +++ /dev/null @@ -1,11 +0,0 @@ -unit ZLibConst; - -interface - -resourcestring - sTargetBufferTooSmall = 'ZLib error: target buffer may be too small'; - sInvalidStreamOp = 'Invalid stream operation'; - -implementation - -end. diff --git a/compat/zlib/contrib/delphi/readme.txt b/compat/zlib/contrib/delphi/readme.txt deleted file mode 100644 index 2dc9a8b..0000000 --- a/compat/zlib/contrib/delphi/readme.txt +++ /dev/null @@ -1,76 +0,0 @@ - -Overview -======== - -This directory contains an update to the ZLib interface unit, -distributed by Borland as a Delphi supplemental component. - -The original ZLib unit is Copyright (c) 1997,99 Borland Corp., -and is based on zlib version 1.0.4. There are a series of bugs -and security problems associated with that old zlib version, and -we recommend the users to update their ZLib unit. - - -Summary of modifications -======================== - -- Improved makefile, adapted to zlib version 1.2.1. - -- Some field types from TZStreamRec are changed from Integer to - Longint, for consistency with the zlib.h header, and for 64-bit - readiness. - -- The zlib_version constant is updated. - -- The new Z_RLE strategy has its corresponding symbolic constant. - -- The allocation and deallocation functions and function types - (TAlloc, TFree, zlibAllocMem and zlibFreeMem) are now cdecl, - and _malloc and _free are added as C RTL stubs. As a result, - the original C sources of zlib can be compiled out of the box, - and linked to the ZLib unit. - - -Suggestions for improvements -============================ - -Currently, the ZLib unit provides only a limited wrapper around -the zlib library, and much of the original zlib functionality is -missing. Handling compressed file formats like ZIP/GZIP or PNG -cannot be implemented without having this functionality. -Applications that handle these formats are either using their own, -duplicated code, or not using the ZLib unit at all. - -Here are a few suggestions: - -- Checksum class wrappers around adler32() and crc32(), similar - to the Java classes that implement the java.util.zip.Checksum - interface. - -- The ability to read and write raw deflate streams, without the - zlib stream header and trailer. Raw deflate streams are used - in the ZIP file format. - -- The ability to read and write gzip streams, used in the GZIP - file format, and normally produced by the gzip program. - -- The ability to select a different compression strategy, useful - to PNG and MNG image compression, and to multimedia compression - in general. Besides the compression level - - TCompressionLevel = (clNone, clFastest, clDefault, clMax); - - which, in fact, could have used the 'z' prefix and avoided - TColor-like symbols - - TCompressionLevel = (zcNone, zcFastest, zcDefault, zcMax); - - there could be a compression strategy - - TCompressionStrategy = (zsDefault, zsFiltered, zsHuffmanOnly, zsRle); - -- ZIP and GZIP stream handling via TStreams. - - --- -Cosmin Truta diff --git a/compat/zlib/contrib/delphi/zlibd32.mak b/compat/zlib/contrib/delphi/zlibd32.mak deleted file mode 100644 index 9bb00b7..0000000 --- a/compat/zlib/contrib/delphi/zlibd32.mak +++ /dev/null @@ -1,99 +0,0 @@ -# Makefile for zlib -# For use with Delphi and C++ Builder under Win32 -# Updated for zlib 1.2.x by Cosmin Truta - -# ------------ Borland C++ ------------ - -# This project uses the Delphi (fastcall/register) calling convention: -LOC = -DZEXPORT=__fastcall -DZEXPORTVA=__cdecl - -CC = bcc32 -LD = bcc32 -AR = tlib -# do not use "-pr" in CFLAGS -CFLAGS = -a -d -k- -O2 $(LOC) -LDFLAGS = - - -# variables -ZLIB_LIB = zlib.lib - -OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj -OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj -OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj -OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj - - -# targets -all: $(ZLIB_LIB) example.exe minigzip.exe - -.c.obj: - $(CC) -c $(CFLAGS) $*.c - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h - -gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h - -gzread.obj: gzread.c zlib.h zconf.h gzguts.h - -gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: test/example.c zlib.h zconf.h - -minigzip.obj: test/minigzip.c zlib.h zconf.h - - -# For the sake of the old Borland make, -# the command line is cut to fit in the MS-DOS 128 byte limit: -$(ZLIB_LIB): $(OBJ1) $(OBJ2) - -del $(ZLIB_LIB) - $(AR) $(ZLIB_LIB) $(OBJP1) - $(AR) $(ZLIB_LIB) $(OBJP2) - - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -example.exe: example.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) - -minigzip.exe: minigzip.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) - - -# cleanup -clean: - -del *.obj - -del *.exe - -del *.lib - -del *.tds - -del zlib.bak - -del foo.gz - diff --git a/compat/zlib/contrib/dotzlib/DotZLib.build b/compat/zlib/contrib/dotzlib/DotZLib.build deleted file mode 100644 index 7f90d6b..0000000 --- a/compat/zlib/contrib/dotzlib/DotZLib.build +++ /dev/null @@ -1,33 +0,0 @@ - - - A .Net wrapper library around ZLib1.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/dotzlib/DotZLib.chm b/compat/zlib/contrib/dotzlib/DotZLib.chm deleted file mode 100644 index f214a44..0000000 Binary files a/compat/zlib/contrib/dotzlib/DotZLib.chm and /dev/null differ diff --git a/compat/zlib/contrib/dotzlib/DotZLib.sln b/compat/zlib/contrib/dotzlib/DotZLib.sln deleted file mode 100644 index ac45ca0..0000000 --- a/compat/zlib/contrib/dotzlib/DotZLib.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotZLib", "DotZLib\DotZLib.csproj", "{BB1EE0B1-1808-46CB-B786-949D91117FC5}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.ActiveCfg = Debug|.NET - {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.Build.0 = Debug|.NET - {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.ActiveCfg = Release|.NET - {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.Build.0 = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/compat/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs b/compat/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs deleted file mode 100644 index 0491bfc..0000000 --- a/compat/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// -[assembly: AssemblyTitle("DotZLib")] -[assembly: AssemblyDescription(".Net bindings for ZLib compression dll 1.2.x")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Henrik Ravn")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("(c) 2004 by Henrik Ravn")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly: AssemblyVersion("1.0.*")] - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyKeyName("")] diff --git a/compat/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs b/compat/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs deleted file mode 100644 index 788b2fc..0000000 --- a/compat/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs +++ /dev/null @@ -1,202 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.Runtime.InteropServices; -using System.Text; - - -namespace DotZLib -{ - #region ChecksumGeneratorBase - /// - /// Implements the common functionality needed for all s - /// - /// - public abstract class ChecksumGeneratorBase : ChecksumGenerator - { - /// - /// The value of the current checksum - /// - protected uint _current; - - /// - /// Initializes a new instance of the checksum generator base - the current checksum is - /// set to zero - /// - public ChecksumGeneratorBase() - { - _current = 0; - } - - /// - /// Initializes a new instance of the checksum generator basewith a specified value - /// - /// The value to set the current checksum to - public ChecksumGeneratorBase(uint initialValue) - { - _current = initialValue; - } - - /// - /// Resets the current checksum to zero - /// - public void Reset() { _current = 0; } - - /// - /// Gets the current checksum value - /// - public uint Value { get { return _current; } } - - /// - /// Updates the current checksum with part of an array of bytes - /// - /// The data to update the checksum with - /// Where in data to start updating - /// The number of bytes from data to use - /// The sum of offset and count is larger than the length of data - /// data is a null reference - /// Offset or count is negative. - /// All the other Update methods are implmeneted in terms of this one. - /// This is therefore the only method a derived class has to implement - public abstract void Update(byte[] data, int offset, int count); - - /// - /// Updates the current checksum with an array of bytes. - /// - /// The data to update the checksum with - public void Update(byte[] data) - { - Update(data, 0, data.Length); - } - - /// - /// Updates the current checksum with the data from a string - /// - /// The string to update the checksum with - /// The characters in the string are converted by the UTF-8 encoding - public void Update(string data) - { - Update(Encoding.UTF8.GetBytes(data)); - } - - /// - /// Updates the current checksum with the data from a string, using a specific encoding - /// - /// The string to update the checksum with - /// The encoding to use - public void Update(string data, Encoding encoding) - { - Update(encoding.GetBytes(data)); - } - - } - #endregion - - #region CRC32 - /// - /// Implements a CRC32 checksum generator - /// - public sealed class CRC32Checksum : ChecksumGeneratorBase - { - #region DLL imports - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern uint crc32(uint crc, int data, uint length); - - #endregion - - /// - /// Initializes a new instance of the CRC32 checksum generator - /// - public CRC32Checksum() : base() {} - - /// - /// Initializes a new instance of the CRC32 checksum generator with a specified value - /// - /// The value to set the current checksum to - public CRC32Checksum(uint initialValue) : base(initialValue) {} - - /// - /// Updates the current checksum with part of an array of bytes - /// - /// The data to update the checksum with - /// Where in data to start updating - /// The number of bytes from data to use - /// The sum of offset and count is larger than the length of data - /// data is a null reference - /// Offset or count is negative. - public override void Update(byte[] data, int offset, int count) - { - if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); - if ((offset+count) > data.Length) throw new ArgumentException(); - GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned); - try - { - _current = crc32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count); - } - finally - { - hData.Free(); - } - } - - } - #endregion - - #region Adler - /// - /// Implements a checksum generator that computes the Adler checksum on data - /// - public sealed class AdlerChecksum : ChecksumGeneratorBase - { - #region DLL imports - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern uint adler32(uint adler, int data, uint length); - - #endregion - - /// - /// Initializes a new instance of the Adler checksum generator - /// - public AdlerChecksum() : base() {} - - /// - /// Initializes a new instance of the Adler checksum generator with a specified value - /// - /// The value to set the current checksum to - public AdlerChecksum(uint initialValue) : base(initialValue) {} - - /// - /// Updates the current checksum with part of an array of bytes - /// - /// The data to update the checksum with - /// Where in data to start updating - /// The number of bytes from data to use - /// The sum of offset and count is larger than the length of data - /// data is a null reference - /// Offset or count is negative. - public override void Update(byte[] data, int offset, int count) - { - if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); - if ((offset+count) > data.Length) throw new ArgumentException(); - GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned); - try - { - _current = adler32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count); - } - finally - { - hData.Free(); - } - } - - } - #endregion - -} \ No newline at end of file diff --git a/compat/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs b/compat/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs deleted file mode 100644 index c1cab3a..0000000 --- a/compat/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs +++ /dev/null @@ -1,83 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.Diagnostics; - -namespace DotZLib -{ - - /// - /// This class implements a circular buffer - /// - internal class CircularBuffer - { - #region Private data - private int _capacity; - private int _head; - private int _tail; - private int _size; - private byte[] _buffer; - #endregion - - public CircularBuffer(int capacity) - { - Debug.Assert( capacity > 0 ); - _buffer = new byte[capacity]; - _capacity = capacity; - _head = 0; - _tail = 0; - _size = 0; - } - - public int Size { get { return _size; } } - - public int Put(byte[] source, int offset, int count) - { - Debug.Assert( count > 0 ); - int trueCount = Math.Min(count, _capacity - Size); - for (int i = 0; i < trueCount; ++i) - _buffer[(_tail+i) % _capacity] = source[offset+i]; - _tail += trueCount; - _tail %= _capacity; - _size += trueCount; - return trueCount; - } - - public bool Put(byte b) - { - if (Size == _capacity) // no room - return false; - _buffer[_tail++] = b; - _tail %= _capacity; - ++_size; - return true; - } - - public int Get(byte[] destination, int offset, int count) - { - int trueCount = Math.Min(count,Size); - for (int i = 0; i < trueCount; ++i) - destination[offset + i] = _buffer[(_head+i) % _capacity]; - _head += trueCount; - _head %= _capacity; - _size -= trueCount; - return trueCount; - } - - public int Get() - { - if (Size == 0) - return -1; - - int result = (int)_buffer[_head++ % _capacity]; - --_size; - return result; - } - - } -} diff --git a/compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs b/compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs deleted file mode 100644 index 42e6da3..0000000 --- a/compat/zlib/contrib/dotzlib/DotZLib/CodecBase.cs +++ /dev/null @@ -1,198 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.Runtime.InteropServices; - -namespace DotZLib -{ - /// - /// Implements the common functionality needed for all s - /// - public abstract class CodecBase : Codec, IDisposable - { - - #region Data members - - /// - /// Instance of the internal zlib buffer structure that is - /// passed to all functions in the zlib dll - /// - internal ZStream _ztream = new ZStream(); - - /// - /// True if the object instance has been disposed, false otherwise - /// - protected bool _isDisposed = false; - - /// - /// The size of the internal buffers - /// - protected const int kBufferSize = 16384; - - private byte[] _outBuffer = new byte[kBufferSize]; - private byte[] _inBuffer = new byte[kBufferSize]; - - private GCHandle _hInput; - private GCHandle _hOutput; - - private uint _checksum = 0; - - #endregion - - /// - /// Initializes a new instance of the CodeBase class. - /// - public CodecBase() - { - try - { - _hInput = GCHandle.Alloc(_inBuffer, GCHandleType.Pinned); - _hOutput = GCHandle.Alloc(_outBuffer, GCHandleType.Pinned); - } - catch (Exception) - { - CleanUp(false); - throw; - } - } - - - #region Codec Members - - /// - /// Occurs when more processed data are available. - /// - public event DataAvailableHandler DataAvailable; - - /// - /// Fires the event - /// - protected void OnDataAvailable() - { - if (_ztream.total_out > 0) - { - if (DataAvailable != null) - DataAvailable( _outBuffer, 0, (int)_ztream.total_out); - resetOutput(); - } - } - - /// - /// Adds more data to the codec to be processed. - /// - /// Byte array containing the data to be added to the codec - /// Adding data may, or may not, raise the DataAvailable event - public void Add(byte[] data) - { - Add(data,0,data.Length); - } - - /// - /// Adds more data to the codec to be processed. - /// - /// Byte array containing the data to be added to the codec - /// The index of the first byte to add from data - /// The number of bytes to add - /// Adding data may, or may not, raise the DataAvailable event - /// This must be implemented by a derived class - public abstract void Add(byte[] data, int offset, int count); - - /// - /// Finishes up any pending data that needs to be processed and handled. - /// - /// This must be implemented by a derived class - public abstract void Finish(); - - /// - /// Gets the checksum of the data that has been added so far - /// - public uint Checksum { get { return _checksum; } } - - #endregion - - #region Destructor & IDisposable stuff - - /// - /// Destroys this instance - /// - ~CodecBase() - { - CleanUp(false); - } - - /// - /// Releases any unmanaged resources and calls the method of the derived class - /// - public void Dispose() - { - CleanUp(true); - } - - /// - /// Performs any codec specific cleanup - /// - /// This must be implemented by a derived class - protected abstract void CleanUp(); - - // performs the release of the handles and calls the dereived CleanUp() - private void CleanUp(bool isDisposing) - { - if (!_isDisposed) - { - CleanUp(); - if (_hInput.IsAllocated) - _hInput.Free(); - if (_hOutput.IsAllocated) - _hOutput.Free(); - - _isDisposed = true; - } - } - - - #endregion - - #region Helper methods - - /// - /// Copies a number of bytes to the internal codec buffer - ready for proccesing - /// - /// The byte array that contains the data to copy - /// The index of the first byte to copy - /// The number of bytes to copy from data - protected void copyInput(byte[] data, int startIndex, int count) - { - Array.Copy(data, startIndex, _inBuffer,0, count); - _ztream.next_in = _hInput.AddrOfPinnedObject(); - _ztream.total_in = 0; - _ztream.avail_in = (uint)count; - - } - - /// - /// Resets the internal output buffers to a known state - ready for processing - /// - protected void resetOutput() - { - _ztream.total_out = 0; - _ztream.avail_out = kBufferSize; - _ztream.next_out = _hOutput.AddrOfPinnedObject(); - } - - /// - /// Updates the running checksum property - /// - /// The new checksum value - protected void setChecksum(uint newSum) - { - _checksum = newSum; - } - #endregion - - } -} diff --git a/compat/zlib/contrib/dotzlib/DotZLib/Deflater.cs b/compat/zlib/contrib/dotzlib/DotZLib/Deflater.cs deleted file mode 100644 index c247792..0000000 --- a/compat/zlib/contrib/dotzlib/DotZLib/Deflater.cs +++ /dev/null @@ -1,106 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; - -namespace DotZLib -{ - - /// - /// Implements a data compressor, using the deflate algorithm in the ZLib dll - /// - public sealed class Deflater : CodecBase - { - #region Dll imports - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)] - private static extern int deflateInit_(ref ZStream sz, int level, string vs, int size); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int deflate(ref ZStream sz, int flush); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int deflateReset(ref ZStream sz); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int deflateEnd(ref ZStream sz); - #endregion - - /// - /// Constructs an new instance of the Deflater - /// - /// The compression level to use for this Deflater - public Deflater(CompressLevel level) : base() - { - int retval = deflateInit_(ref _ztream, (int)level, Info.Version, Marshal.SizeOf(_ztream)); - if (retval != 0) - throw new ZLibException(retval, "Could not initialize deflater"); - - resetOutput(); - } - - /// - /// Adds more data to the codec to be processed. - /// - /// Byte array containing the data to be added to the codec - /// The index of the first byte to add from data - /// The number of bytes to add - /// Adding data may, or may not, raise the DataAvailable event - public override void Add(byte[] data, int offset, int count) - { - if (data == null) throw new ArgumentNullException(); - if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); - if ((offset+count) > data.Length) throw new ArgumentException(); - - int total = count; - int inputIndex = offset; - int err = 0; - - while (err >= 0 && inputIndex < total) - { - copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize)); - while (err >= 0 && _ztream.avail_in > 0) - { - err = deflate(ref _ztream, (int)FlushTypes.None); - if (err == 0) - while (_ztream.avail_out == 0) - { - OnDataAvailable(); - err = deflate(ref _ztream, (int)FlushTypes.None); - } - inputIndex += (int)_ztream.total_in; - } - } - setChecksum( _ztream.adler ); - } - - - /// - /// Finishes up any pending data that needs to be processed and handled. - /// - public override void Finish() - { - int err; - do - { - err = deflate(ref _ztream, (int)FlushTypes.Finish); - OnDataAvailable(); - } - while (err == 0); - setChecksum( _ztream.adler ); - deflateReset(ref _ztream); - resetOutput(); - } - - /// - /// Closes the internal zlib deflate stream - /// - protected override void CleanUp() { deflateEnd(ref _ztream); } - - } -} diff --git a/compat/zlib/contrib/dotzlib/DotZLib/DotZLib.cs b/compat/zlib/contrib/dotzlib/DotZLib/DotZLib.cs deleted file mode 100644 index be184b4..0000000 --- a/compat/zlib/contrib/dotzlib/DotZLib/DotZLib.cs +++ /dev/null @@ -1,288 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.IO; -using System.Runtime.InteropServices; -using System.Text; - - -namespace DotZLib -{ - - #region Internal types - - /// - /// Defines constants for the various flush types used with zlib - /// - internal enum FlushTypes - { - None, Partial, Sync, Full, Finish, Block - } - - #region ZStream structure - // internal mapping of the zlib zstream structure for marshalling - [StructLayoutAttribute(LayoutKind.Sequential, Pack=4, Size=0, CharSet=CharSet.Ansi)] - internal struct ZStream - { - public IntPtr next_in; - public uint avail_in; - public uint total_in; - - public IntPtr next_out; - public uint avail_out; - public uint total_out; - - [MarshalAs(UnmanagedType.LPStr)] - string msg; - uint state; - - uint zalloc; - uint zfree; - uint opaque; - - int data_type; - public uint adler; - uint reserved; - } - - #endregion - - #endregion - - #region Public enums - /// - /// Defines constants for the available compression levels in zlib - /// - public enum CompressLevel : int - { - /// - /// The default compression level with a reasonable compromise between compression and speed - /// - Default = -1, - /// - /// No compression at all. The data are passed straight through. - /// - None = 0, - /// - /// The maximum compression rate available. - /// - Best = 9, - /// - /// The fastest available compression level. - /// - Fastest = 1 - } - #endregion - - #region Exception classes - /// - /// The exception that is thrown when an error occurs on the zlib dll - /// - public class ZLibException : ApplicationException - { - /// - /// Initializes a new instance of the class with a specified - /// error message and error code - /// - /// The zlib error code that caused the exception - /// A message that (hopefully) describes the error - public ZLibException(int errorCode, string msg) : base(String.Format("ZLib error {0} {1}", errorCode, msg)) - { - } - - /// - /// Initializes a new instance of the class with a specified - /// error code - /// - /// The zlib error code that caused the exception - public ZLibException(int errorCode) : base(String.Format("ZLib error {0}", errorCode)) - { - } - } - #endregion - - #region Interfaces - - /// - /// Declares methods and properties that enables a running checksum to be calculated - /// - public interface ChecksumGenerator - { - /// - /// Gets the current value of the checksum - /// - uint Value { get; } - - /// - /// Clears the current checksum to 0 - /// - void Reset(); - - /// - /// Updates the current checksum with an array of bytes - /// - /// The data to update the checksum with - void Update(byte[] data); - - /// - /// Updates the current checksum with part of an array of bytes - /// - /// The data to update the checksum with - /// Where in data to start updating - /// The number of bytes from data to use - /// The sum of offset and count is larger than the length of data - /// data is a null reference - /// Offset or count is negative. - void Update(byte[] data, int offset, int count); - - /// - /// Updates the current checksum with the data from a string - /// - /// The string to update the checksum with - /// The characters in the string are converted by the UTF-8 encoding - void Update(string data); - - /// - /// Updates the current checksum with the data from a string, using a specific encoding - /// - /// The string to update the checksum with - /// The encoding to use - void Update(string data, Encoding encoding); - } - - - /// - /// Represents the method that will be called from a codec when new data - /// are available. - /// - /// The byte array containing the processed data - /// The index of the first processed byte in data - /// The number of processed bytes available - /// On return from this method, the data may be overwritten, so grab it while you can. - /// You cannot assume that startIndex will be zero. - /// - public delegate void DataAvailableHandler(byte[] data, int startIndex, int count); - - /// - /// Declares methods and events for implementing compressors/decompressors - /// - public interface Codec - { - /// - /// Occurs when more processed data are available. - /// - event DataAvailableHandler DataAvailable; - - /// - /// Adds more data to the codec to be processed. - /// - /// Byte array containing the data to be added to the codec - /// Adding data may, or may not, raise the DataAvailable event - void Add(byte[] data); - - /// - /// Adds more data to the codec to be processed. - /// - /// Byte array containing the data to be added to the codec - /// The index of the first byte to add from data - /// The number of bytes to add - /// Adding data may, or may not, raise the DataAvailable event - void Add(byte[] data, int offset, int count); - - /// - /// Finishes up any pending data that needs to be processed and handled. - /// - void Finish(); - - /// - /// Gets the checksum of the data that has been added so far - /// - uint Checksum { get; } - - - } - - #endregion - - #region Classes - /// - /// Encapsulates general information about the ZLib library - /// - public class Info - { - #region DLL imports - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern uint zlibCompileFlags(); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern string zlibVersion(); - #endregion - - #region Private stuff - private uint _flags; - - // helper function that unpacks a bitsize mask - private static int bitSize(uint bits) - { - switch (bits) - { - case 0: return 16; - case 1: return 32; - case 2: return 64; - } - return -1; - } - #endregion - - /// - /// Constructs an instance of the Info class. - /// - public Info() - { - _flags = zlibCompileFlags(); - } - - /// - /// True if the library is compiled with debug info - /// - public bool HasDebugInfo { get { return 0 != (_flags & 0x100); } } - - /// - /// True if the library is compiled with assembly optimizations - /// - public bool UsesAssemblyCode { get { return 0 != (_flags & 0x200); } } - - /// - /// Gets the size of the unsigned int that was compiled into Zlib - /// - public int SizeOfUInt { get { return bitSize(_flags & 3); } } - - /// - /// Gets the size of the unsigned long that was compiled into Zlib - /// - public int SizeOfULong { get { return bitSize((_flags >> 2) & 3); } } - - /// - /// Gets the size of the pointers that were compiled into Zlib - /// - public int SizeOfPointer { get { return bitSize((_flags >> 4) & 3); } } - - /// - /// Gets the size of the z_off_t type that was compiled into Zlib - /// - public int SizeOfOffset { get { return bitSize((_flags >> 6) & 3); } } - - /// - /// Gets the version of ZLib as a string, e.g. "1.2.1" - /// - public static string Version { get { return zlibVersion(); } } - } - - #endregion - -} diff --git a/compat/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj b/compat/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj deleted file mode 100644 index 71eeb85..0000000 --- a/compat/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs b/compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs deleted file mode 100644 index b161300..0000000 --- a/compat/zlib/contrib/dotzlib/DotZLib/GZipStream.cs +++ /dev/null @@ -1,301 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.IO; -using System.Runtime.InteropServices; - -namespace DotZLib -{ - /// - /// Implements a compressed , in GZip (.gz) format. - /// - public class GZipStream : Stream, IDisposable - { - #region Dll Imports - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)] - private static extern IntPtr gzopen(string name, string mode); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int gzclose(IntPtr gzFile); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int gzwrite(IntPtr gzFile, int data, int length); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int gzread(IntPtr gzFile, int data, int length); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int gzgetc(IntPtr gzFile); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int gzputc(IntPtr gzFile, int c); - - #endregion - - #region Private data - private IntPtr _gzFile; - private bool _isDisposed = false; - private bool _isWriting; - #endregion - - #region Constructors - /// - /// Creates a new file as a writeable GZipStream - /// - /// The name of the compressed file to create - /// The compression level to use when adding data - /// If an error occurred in the internal zlib function - public GZipStream(string fileName, CompressLevel level) - { - _isWriting = true; - _gzFile = gzopen(fileName, String.Format("wb{0}", (int)level)); - if (_gzFile == IntPtr.Zero) - throw new ZLibException(-1, "Could not open " + fileName); - } - - /// - /// Opens an existing file as a readable GZipStream - /// - /// The name of the file to open - /// If an error occurred in the internal zlib function - public GZipStream(string fileName) - { - _isWriting = false; - _gzFile = gzopen(fileName, "rb"); - if (_gzFile == IntPtr.Zero) - throw new ZLibException(-1, "Could not open " + fileName); - - } - #endregion - - #region Access properties - /// - /// Returns true of this stream can be read from, false otherwise - /// - public override bool CanRead - { - get - { - return !_isWriting; - } - } - - - /// - /// Returns false. - /// - public override bool CanSeek - { - get - { - return false; - } - } - - /// - /// Returns true if this tsream is writeable, false otherwise - /// - public override bool CanWrite - { - get - { - return _isWriting; - } - } - #endregion - - #region Destructor & IDispose stuff - - /// - /// Destroys this instance - /// - ~GZipStream() - { - cleanUp(false); - } - - /// - /// Closes the external file handle - /// - public void Dispose() - { - cleanUp(true); - } - - // Does the actual closing of the file handle. - private void cleanUp(bool isDisposing) - { - if (!_isDisposed) - { - gzclose(_gzFile); - _isDisposed = true; - } - } - #endregion - - #region Basic reading and writing - /// - /// Attempts to read a number of bytes from the stream. - /// - /// The destination data buffer - /// The index of the first destination byte in buffer - /// The number of bytes requested - /// The number of bytes read - /// If buffer is null - /// If count or offset are negative - /// If offset + count is > buffer.Length - /// If this stream is not readable. - /// If this stream has been disposed. - public override int Read(byte[] buffer, int offset, int count) - { - if (!CanRead) throw new NotSupportedException(); - if (buffer == null) throw new ArgumentNullException(); - if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); - if ((offset+count) > buffer.Length) throw new ArgumentException(); - if (_isDisposed) throw new ObjectDisposedException("GZipStream"); - - GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned); - int result; - try - { - result = gzread(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count); - if (result < 0) - throw new IOException(); - } - finally - { - h.Free(); - } - return result; - } - - /// - /// Attempts to read a single byte from the stream. - /// - /// The byte that was read, or -1 in case of error or End-Of-File - public override int ReadByte() - { - if (!CanRead) throw new NotSupportedException(); - if (_isDisposed) throw new ObjectDisposedException("GZipStream"); - return gzgetc(_gzFile); - } - - /// - /// Writes a number of bytes to the stream - /// - /// - /// - /// - /// If buffer is null - /// If count or offset are negative - /// If offset + count is > buffer.Length - /// If this stream is not writeable. - /// If this stream has been disposed. - public override void Write(byte[] buffer, int offset, int count) - { - if (!CanWrite) throw new NotSupportedException(); - if (buffer == null) throw new ArgumentNullException(); - if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); - if ((offset+count) > buffer.Length) throw new ArgumentException(); - if (_isDisposed) throw new ObjectDisposedException("GZipStream"); - - GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned); - try - { - int result = gzwrite(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count); - if (result < 0) - throw new IOException(); - } - finally - { - h.Free(); - } - } - - /// - /// Writes a single byte to the stream - /// - /// The byte to add to the stream. - /// If this stream is not writeable. - /// If this stream has been disposed. - public override void WriteByte(byte value) - { - if (!CanWrite) throw new NotSupportedException(); - if (_isDisposed) throw new ObjectDisposedException("GZipStream"); - - int result = gzputc(_gzFile, (int)value); - if (result < 0) - throw new IOException(); - } - #endregion - - #region Position & length stuff - /// - /// Not supported. - /// - /// - /// Always thrown - public override void SetLength(long value) - { - throw new NotSupportedException(); - } - - /// - /// Not suppported. - /// - /// - /// - /// - /// Always thrown - public override long Seek(long offset, SeekOrigin origin) - { - throw new NotSupportedException(); - } - - /// - /// Flushes the GZipStream. - /// - /// In this implementation, this method does nothing. This is because excessive - /// flushing may degrade the achievable compression rates. - public override void Flush() - { - // left empty on purpose - } - - /// - /// Gets/sets the current position in the GZipStream. Not suppported. - /// - /// In this implementation this property is not supported - /// Always thrown - public override long Position - { - get - { - throw new NotSupportedException(); - } - set - { - throw new NotSupportedException(); - } - } - - /// - /// Gets the size of the stream. Not suppported. - /// - /// In this implementation this property is not supported - /// Always thrown - public override long Length - { - get - { - throw new NotSupportedException(); - } - } - #endregion - } -} diff --git a/compat/zlib/contrib/dotzlib/DotZLib/Inflater.cs b/compat/zlib/contrib/dotzlib/DotZLib/Inflater.cs deleted file mode 100644 index 8ed5451..0000000 --- a/compat/zlib/contrib/dotzlib/DotZLib/Inflater.cs +++ /dev/null @@ -1,105 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; - -namespace DotZLib -{ - - /// - /// Implements a data decompressor, using the inflate algorithm in the ZLib dll - /// - public class Inflater : CodecBase - { - #region Dll imports - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)] - private static extern int inflateInit_(ref ZStream sz, string vs, int size); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int inflate(ref ZStream sz, int flush); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int inflateReset(ref ZStream sz); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int inflateEnd(ref ZStream sz); - #endregion - - /// - /// Constructs an new instance of the Inflater - /// - public Inflater() : base() - { - int retval = inflateInit_(ref _ztream, Info.Version, Marshal.SizeOf(_ztream)); - if (retval != 0) - throw new ZLibException(retval, "Could not initialize inflater"); - - resetOutput(); - } - - - /// - /// Adds more data to the codec to be processed. - /// - /// Byte array containing the data to be added to the codec - /// The index of the first byte to add from data - /// The number of bytes to add - /// Adding data may, or may not, raise the DataAvailable event - public override void Add(byte[] data, int offset, int count) - { - if (data == null) throw new ArgumentNullException(); - if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); - if ((offset+count) > data.Length) throw new ArgumentException(); - - int total = count; - int inputIndex = offset; - int err = 0; - - while (err >= 0 && inputIndex < total) - { - copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize)); - err = inflate(ref _ztream, (int)FlushTypes.None); - if (err == 0) - while (_ztream.avail_out == 0) - { - OnDataAvailable(); - err = inflate(ref _ztream, (int)FlushTypes.None); - } - - inputIndex += (int)_ztream.total_in; - } - setChecksum( _ztream.adler ); - } - - - /// - /// Finishes up any pending data that needs to be processed and handled. - /// - public override void Finish() - { - int err; - do - { - err = inflate(ref _ztream, (int)FlushTypes.Finish); - OnDataAvailable(); - } - while (err == 0); - setChecksum( _ztream.adler ); - inflateReset(ref _ztream); - resetOutput(); - } - - /// - /// Closes the internal zlib inflate stream - /// - protected override void CleanUp() { inflateEnd(ref _ztream); } - - - } -} diff --git a/compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs b/compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs deleted file mode 100644 index 44f7633..0000000 --- a/compat/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +++ /dev/null @@ -1,274 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.Collections; -using System.IO; - -// uncomment the define below to include unit tests -//#define nunit -#if nunit -using NUnit.Framework; - -// Unit tests for the DotZLib class library -// ---------------------------------------- -// -// Use this with NUnit 2 from http://www.nunit.org -// - -namespace DotZLibTests -{ - using DotZLib; - - // helper methods - internal class Utils - { - public static bool byteArrEqual( byte[] lhs, byte[] rhs ) - { - if (lhs.Length != rhs.Length) - return false; - for (int i = lhs.Length-1; i >= 0; --i) - if (lhs[i] != rhs[i]) - return false; - return true; - } - - } - - - [TestFixture] - public class CircBufferTests - { - #region Circular buffer tests - [Test] - public void SinglePutGet() - { - CircularBuffer buf = new CircularBuffer(10); - Assert.AreEqual( 0, buf.Size ); - Assert.AreEqual( -1, buf.Get() ); - - Assert.IsTrue(buf.Put( 1 )); - Assert.AreEqual( 1, buf.Size ); - Assert.AreEqual( 1, buf.Get() ); - Assert.AreEqual( 0, buf.Size ); - Assert.AreEqual( -1, buf.Get() ); - } - - [Test] - public void BlockPutGet() - { - CircularBuffer buf = new CircularBuffer(10); - byte[] arr = {1,2,3,4,5,6,7,8,9,10}; - Assert.AreEqual( 10, buf.Put(arr,0,10) ); - Assert.AreEqual( 10, buf.Size ); - Assert.IsFalse( buf.Put(11) ); - Assert.AreEqual( 1, buf.Get() ); - Assert.IsTrue( buf.Put(11) ); - - byte[] arr2 = (byte[])arr.Clone(); - Assert.AreEqual( 9, buf.Get(arr2,1,9) ); - Assert.IsTrue( Utils.byteArrEqual(arr,arr2) ); - } - - #endregion - } - - [TestFixture] - public class ChecksumTests - { - #region CRC32 Tests - [Test] - public void CRC32_Null() - { - CRC32Checksum crc32 = new CRC32Checksum(); - Assert.AreEqual( 0, crc32.Value ); - - crc32 = new CRC32Checksum(1); - Assert.AreEqual( 1, crc32.Value ); - - crc32 = new CRC32Checksum(556); - Assert.AreEqual( 556, crc32.Value ); - } - - [Test] - public void CRC32_Data() - { - CRC32Checksum crc32 = new CRC32Checksum(); - byte[] data = { 1,2,3,4,5,6,7 }; - crc32.Update(data); - Assert.AreEqual( 0x70e46888, crc32.Value ); - - crc32 = new CRC32Checksum(); - crc32.Update("penguin"); - Assert.AreEqual( 0x0e5c1a120, crc32.Value ); - - crc32 = new CRC32Checksum(1); - crc32.Update("penguin"); - Assert.AreEqual(0x43b6aa94, crc32.Value); - - } - #endregion - - #region Adler tests - - [Test] - public void Adler_Null() - { - AdlerChecksum adler = new AdlerChecksum(); - Assert.AreEqual(0, adler.Value); - - adler = new AdlerChecksum(1); - Assert.AreEqual( 1, adler.Value ); - - adler = new AdlerChecksum(556); - Assert.AreEqual( 556, adler.Value ); - } - - [Test] - public void Adler_Data() - { - AdlerChecksum adler = new AdlerChecksum(1); - byte[] data = { 1,2,3,4,5,6,7 }; - adler.Update(data); - Assert.AreEqual( 0x5b001d, adler.Value ); - - adler = new AdlerChecksum(); - adler.Update("penguin"); - Assert.AreEqual(0x0bcf02f6, adler.Value ); - - adler = new AdlerChecksum(1); - adler.Update("penguin"); - Assert.AreEqual(0x0bd602f7, adler.Value); - - } - #endregion - } - - [TestFixture] - public class InfoTests - { - #region Info tests - [Test] - public void Info_Version() - { - Info info = new Info(); - Assert.AreEqual("1.2.11", Info.Version); - Assert.AreEqual(32, info.SizeOfUInt); - Assert.AreEqual(32, info.SizeOfULong); - Assert.AreEqual(32, info.SizeOfPointer); - Assert.AreEqual(32, info.SizeOfOffset); - } - #endregion - } - - [TestFixture] - public class DeflateInflateTests - { - #region Deflate tests - [Test] - public void Deflate_Init() - { - using (Deflater def = new Deflater(CompressLevel.Default)) - { - } - } - - private ArrayList compressedData = new ArrayList(); - private uint adler1; - - private ArrayList uncompressedData = new ArrayList(); - private uint adler2; - - public void CDataAvail(byte[] data, int startIndex, int count) - { - for (int i = 0; i < count; ++i) - compressedData.Add(data[i+startIndex]); - } - - [Test] - public void Deflate_Compress() - { - compressedData.Clear(); - - byte[] testData = new byte[35000]; - for (int i = 0; i < testData.Length; ++i) - testData[i] = 5; - - using (Deflater def = new Deflater((CompressLevel)5)) - { - def.DataAvailable += new DataAvailableHandler(CDataAvail); - def.Add(testData); - def.Finish(); - adler1 = def.Checksum; - } - } - #endregion - - #region Inflate tests - [Test] - public void Inflate_Init() - { - using (Inflater inf = new Inflater()) - { - } - } - - private void DDataAvail(byte[] data, int startIndex, int count) - { - for (int i = 0; i < count; ++i) - uncompressedData.Add(data[i+startIndex]); - } - - [Test] - public void Inflate_Expand() - { - uncompressedData.Clear(); - - using (Inflater inf = new Inflater()) - { - inf.DataAvailable += new DataAvailableHandler(DDataAvail); - inf.Add((byte[])compressedData.ToArray(typeof(byte))); - inf.Finish(); - adler2 = inf.Checksum; - } - Assert.AreEqual( adler1, adler2 ); - } - #endregion - } - - [TestFixture] - public class GZipStreamTests - { - #region GZipStream test - [Test] - public void GZipStream_WriteRead() - { - using (GZipStream gzOut = new GZipStream("gzstream.gz", CompressLevel.Best)) - { - BinaryWriter writer = new BinaryWriter(gzOut); - writer.Write("hi there"); - writer.Write(Math.PI); - writer.Write(42); - } - - using (GZipStream gzIn = new GZipStream("gzstream.gz")) - { - BinaryReader reader = new BinaryReader(gzIn); - string s = reader.ReadString(); - Assert.AreEqual("hi there",s); - double d = reader.ReadDouble(); - Assert.AreEqual(Math.PI, d); - int i = reader.ReadInt32(); - Assert.AreEqual(42,i); - } - - } - #endregion - } -} - -#endif diff --git a/compat/zlib/contrib/dotzlib/LICENSE_1_0.txt b/compat/zlib/contrib/dotzlib/LICENSE_1_0.txt deleted file mode 100644 index 30aac2c..0000000 --- a/compat/zlib/contrib/dotzlib/LICENSE_1_0.txt +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/compat/zlib/contrib/dotzlib/readme.txt b/compat/zlib/contrib/dotzlib/readme.txt deleted file mode 100644 index b239572..0000000 --- a/compat/zlib/contrib/dotzlib/readme.txt +++ /dev/null @@ -1,58 +0,0 @@ -This directory contains a .Net wrapper class library for the ZLib1.dll - -The wrapper includes support for inflating/deflating memory buffers, -.Net streaming wrappers for the gz streams part of zlib, and wrappers -for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples. - -Directory structure: --------------------- - -LICENSE_1_0.txt - License file. -readme.txt - This file. -DotZLib.chm - Class library documentation -DotZLib.build - NAnt build file -DotZLib.sln - Microsoft Visual Studio 2003 solution file - -DotZLib\*.cs - Source files for the class library - -Unit tests: ------------ -The file DotZLib/UnitTests.cs contains unit tests for use with NUnit 2.1 or higher. -To include unit tests in the build, define nunit before building. - - -Build instructions: -------------------- - -1. Using Visual Studio.Net 2003: - Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll) - will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on - you are building the release or debug version of the library. Check - DotZLib/UnitTests.cs for instructions on how to include unit tests in the - build. - -2. Using NAnt: - Open a command prompt with access to the build environment and run nant - in the same directory as the DotZLib.build file. - You can define 2 properties on the nant command-line to control the build: - debug={true|false} to toggle between release/debug builds (default=true). - nunit={true|false} to include or esclude unit tests (default=true). - Also the target clean will remove binaries. - Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release - or ./DotZLib/bin/debug, depending on whether you are building the release - or debug version of the library. - - Examples: - nant -D:debug=false -D:nunit=false - will build a release mode version of the library without unit tests. - nant - will build a debug version of the library with unit tests - nant clean - will remove all previously built files. - - ---------------------------------- -Copyright (c) Henrik Ravn 2004 - -Use, modification and distribution are subject to the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/compat/zlib/contrib/gcc_gvmat64/gvmat64.S b/compat/zlib/contrib/gcc_gvmat64/gvmat64.S deleted file mode 100644 index dd858dd..0000000 --- a/compat/zlib/contrib/gcc_gvmat64/gvmat64.S +++ /dev/null @@ -1,574 +0,0 @@ -/* -;uInt longest_match_x64( -; deflate_state *s, -; IPos cur_match); // current match - -; gvmat64.S -- Asm portion of the optimized longest_match for 32 bits x86_64 -; (AMD64 on Athlon 64, Opteron, Phenom -; and Intel EM64T on Pentium 4 with EM64T, Pentium D, Core 2 Duo, Core I5/I7) -; this file is translation from gvmat64.asm to GCC 4.x (for Linux, Mac XCode) -; Copyright (C) 1995-2010 Jean-loup Gailly, Brian Raiter and Gilles Vollant. -; -; File written by Gilles Vollant, by converting to assembly the longest_match -; from Jean-loup Gailly in deflate.c of zLib and infoZip zip. -; and by taking inspiration on asm686 with masm, optimised assembly code -; from Brian Raiter, written 1998 -; -; This software is provided 'as-is', without any express or implied -; warranty. In no event will the authors be held liable for any damages -; arising from the use of this software. -; -; Permission is granted to anyone to use this software for any purpose, -; including commercial applications, and to alter it and redistribute it -; freely, subject to the following restrictions: -; -; 1. The origin of this software must not be misrepresented; you must not -; claim that you wrote the original software. If you use this software -; in a product, an acknowledgment in the product documentation would be -; appreciated but is not required. -; 2. Altered source versions must be plainly marked as such, and must not be -; misrepresented as being the original software -; 3. This notice may not be removed or altered from any source distribution. -; -; http://www.zlib.net -; http://www.winimage.com/zLibDll -; http://www.muppetlabs.com/~breadbox/software/assembly.html -; -; to compile this file for zLib, I use option: -; gcc -c -arch x86_64 gvmat64.S - - -;uInt longest_match(s, cur_match) -; deflate_state *s; -; IPos cur_match; // current match / -; -; with XCode for Mac, I had strange error with some jump on intel syntax -; this is why BEFORE_JMP and AFTER_JMP are used - */ - - -#define BEFORE_JMP .att_syntax -#define AFTER_JMP .intel_syntax noprefix - -#ifndef NO_UNDERLINE -# define match_init _match_init -# define longest_match _longest_match -#endif - -.intel_syntax noprefix - -.globl match_init, longest_match -.text -longest_match: - - - -#define LocalVarsSize 96 -/* -; register used : rax,rbx,rcx,rdx,rsi,rdi,r8,r9,r10,r11,r12 -; free register : r14,r15 -; register can be saved : rsp -*/ - -#define chainlenwmask (rsp + 8 - LocalVarsSize) -#define nicematch (rsp + 16 - LocalVarsSize) - -#define save_rdi (rsp + 24 - LocalVarsSize) -#define save_rsi (rsp + 32 - LocalVarsSize) -#define save_rbx (rsp + 40 - LocalVarsSize) -#define save_rbp (rsp + 48 - LocalVarsSize) -#define save_r12 (rsp + 56 - LocalVarsSize) -#define save_r13 (rsp + 64 - LocalVarsSize) -#define save_r14 (rsp + 72 - LocalVarsSize) -#define save_r15 (rsp + 80 - LocalVarsSize) - - -/* -; all the +4 offsets are due to the addition of pending_buf_size (in zlib -; in the deflate_state structure since the asm code was first written -; (if you compile with zlib 1.0.4 or older, remove the +4). -; Note : these value are good with a 8 bytes boundary pack structure -*/ - -#define MAX_MATCH 258 -#define MIN_MATCH 3 -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) - -/* -;;; Offsets for fields in the deflate_state structure. These numbers -;;; are calculated from the definition of deflate_state, with the -;;; assumption that the compiler will dword-align the fields. (Thus, -;;; changing the definition of deflate_state could easily cause this -;;; program to crash horribly, without so much as a warning at -;;; compile time. Sigh.) - -; all the +zlib1222add offsets are due to the addition of fields -; in zlib in the deflate_state structure since the asm code was first written -; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). -; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). -; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). -*/ - - - -/* you can check the structure offset by running - -#include -#include -#include "deflate.h" - -void print_depl() -{ -deflate_state ds; -deflate_state *s=&ds; -printf("size pointer=%u\n",(int)sizeof(void*)); - -printf("#define dsWSize %u\n",(int)(((char*)&(s->w_size))-((char*)s))); -printf("#define dsWMask %u\n",(int)(((char*)&(s->w_mask))-((char*)s))); -printf("#define dsWindow %u\n",(int)(((char*)&(s->window))-((char*)s))); -printf("#define dsPrev %u\n",(int)(((char*)&(s->prev))-((char*)s))); -printf("#define dsMatchLen %u\n",(int)(((char*)&(s->match_length))-((char*)s))); -printf("#define dsPrevMatch %u\n",(int)(((char*)&(s->prev_match))-((char*)s))); -printf("#define dsStrStart %u\n",(int)(((char*)&(s->strstart))-((char*)s))); -printf("#define dsMatchStart %u\n",(int)(((char*)&(s->match_start))-((char*)s))); -printf("#define dsLookahead %u\n",(int)(((char*)&(s->lookahead))-((char*)s))); -printf("#define dsPrevLen %u\n",(int)(((char*)&(s->prev_length))-((char*)s))); -printf("#define dsMaxChainLen %u\n",(int)(((char*)&(s->max_chain_length))-((char*)s))); -printf("#define dsGoodMatch %u\n",(int)(((char*)&(s->good_match))-((char*)s))); -printf("#define dsNiceMatch %u\n",(int)(((char*)&(s->nice_match))-((char*)s))); -} -*/ - -#define dsWSize 68 -#define dsWMask 76 -#define dsWindow 80 -#define dsPrev 96 -#define dsMatchLen 144 -#define dsPrevMatch 148 -#define dsStrStart 156 -#define dsMatchStart 160 -#define dsLookahead 164 -#define dsPrevLen 168 -#define dsMaxChainLen 172 -#define dsGoodMatch 188 -#define dsNiceMatch 192 - -#define window_size [ rcx + dsWSize] -#define WMask [ rcx + dsWMask] -#define window_ad [ rcx + dsWindow] -#define prev_ad [ rcx + dsPrev] -#define strstart [ rcx + dsStrStart] -#define match_start [ rcx + dsMatchStart] -#define Lookahead [ rcx + dsLookahead] //; 0ffffffffh on infozip -#define prev_length [ rcx + dsPrevLen] -#define max_chain_length [ rcx + dsMaxChainLen] -#define good_match [ rcx + dsGoodMatch] -#define nice_match [ rcx + dsNiceMatch] - -/* -; windows: -; parameter 1 in rcx(deflate state s), param 2 in rdx (cur match) - -; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and -; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp -; -; All registers must be preserved across the call, except for -; rax, rcx, rdx, r8, r9, r10, and r11, which are scratch. - -; -; gcc on macosx-linux: -; see http://www.x86-64.org/documentation/abi-0.99.pdf -; param 1 in rdi, param 2 in rsi -; rbx, rsp, rbp, r12 to r15 must be preserved - -;;; Save registers that the compiler may be using, and adjust esp to -;;; make room for our stack frame. - - -;;; Retrieve the function arguments. r8d will hold cur_match -;;; throughout the entire function. edx will hold the pointer to the -;;; deflate_state structure during the function's setup (before -;;; entering the main loop. - -; ms: parameter 1 in rcx (deflate_state* s), param 2 in edx -> r8 (cur match) -; mac: param 1 in rdi, param 2 rsi -; this clear high 32 bits of r8, which can be garbage in both r8 and rdx -*/ - mov [save_rbx],rbx - mov [save_rbp],rbp - - - mov rcx,rdi - - mov r8d,esi - - - mov [save_r12],r12 - mov [save_r13],r13 - mov [save_r14],r14 - mov [save_r15],r15 - - -//;;; uInt wmask = s->w_mask; -//;;; unsigned chain_length = s->max_chain_length; -//;;; if (s->prev_length >= s->good_match) { -//;;; chain_length >>= 2; -//;;; } - - - mov edi, prev_length - mov esi, good_match - mov eax, WMask - mov ebx, max_chain_length - cmp edi, esi - jl LastMatchGood - shr ebx, 2 -LastMatchGood: - -//;;; chainlen is decremented once beforehand so that the function can -//;;; use the sign flag instead of the zero flag for the exit test. -//;;; It is then shifted into the high word, to make room for the wmask -//;;; value, which it will always accompany. - - dec ebx - shl ebx, 16 - or ebx, eax - -//;;; on zlib only -//;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - - - - mov eax, nice_match - mov [chainlenwmask], ebx - mov r10d, Lookahead - cmp r10d, eax - cmovnl r10d, eax - mov [nicematch],r10d - - - -//;;; register Bytef *scan = s->window + s->strstart; - mov r10, window_ad - mov ebp, strstart - lea r13, [r10 + rbp] - -//;;; Determine how many bytes the scan ptr is off from being -//;;; dword-aligned. - - mov r9,r13 - neg r13 - and r13,3 - -//;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? -//;;; s->strstart - (IPos)MAX_DIST(s) : NIL; - - - mov eax, window_size - sub eax, MIN_LOOKAHEAD - - - xor edi,edi - sub ebp, eax - - mov r11d, prev_length - - cmovng ebp,edi - -//;;; int best_len = s->prev_length; - - -//;;; Store the sum of s->window + best_len in esi locally, and in esi. - - lea rsi,[r10+r11] - -//;;; register ush scan_start = *(ushf*)scan; -//;;; register ush scan_end = *(ushf*)(scan+best_len-1); -//;;; Posf *prev = s->prev; - - movzx r12d,word ptr [r9] - movzx ebx, word ptr [r9 + r11 - 1] - - mov rdi, prev_ad - -//;;; Jump into the main loop. - - mov edx, [chainlenwmask] - - cmp bx,word ptr [rsi + r8 - 1] - jz LookupLoopIsZero - - - -LookupLoop1: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - - - - sub edx, 0x00010000 - BEFORE_JMP - js LeaveNow - AFTER_JMP - -LoopEntry1: - cmp bx,word ptr [rsi + r8 - 1] - BEFORE_JMP - jz LookupLoopIsZero - AFTER_JMP - -LookupLoop2: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - BEFORE_JMP - jbe LeaveNow - AFTER_JMP - sub edx, 0x00010000 - BEFORE_JMP - js LeaveNow - AFTER_JMP - -LoopEntry2: - cmp bx,word ptr [rsi + r8 - 1] - BEFORE_JMP - jz LookupLoopIsZero - AFTER_JMP - -LookupLoop4: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - BEFORE_JMP - jbe LeaveNow - AFTER_JMP - sub edx, 0x00010000 - BEFORE_JMP - js LeaveNow - AFTER_JMP - -LoopEntry4: - - cmp bx,word ptr [rsi + r8 - 1] - BEFORE_JMP - jnz LookupLoop1 - jmp LookupLoopIsZero - AFTER_JMP -/* -;;; do { -;;; match = s->window + cur_match; -;;; if (*(ushf*)(match+best_len-1) != scan_end || -;;; *(ushf*)match != scan_start) continue; -;;; [...] -;;; } while ((cur_match = prev[cur_match & wmask]) > limit -;;; && --chain_length != 0); -;;; -;;; Here is the inner loop of the function. The function will spend the -;;; majority of its time in this loop, and majority of that time will -;;; be spent in the first ten instructions. -;;; -;;; Within this loop: -;;; ebx = scanend -;;; r8d = curmatch -;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) -;;; esi = windowbestlen - i.e., (window + bestlen) -;;; edi = prev -;;; ebp = limit -*/ -.balign 16 -LookupLoop: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - BEFORE_JMP - jbe LeaveNow - AFTER_JMP - sub edx, 0x00010000 - BEFORE_JMP - js LeaveNow - AFTER_JMP - -LoopEntry: - - cmp bx,word ptr [rsi + r8 - 1] - BEFORE_JMP - jnz LookupLoop1 - AFTER_JMP -LookupLoopIsZero: - cmp r12w, word ptr [r10 + r8] - BEFORE_JMP - jnz LookupLoop1 - AFTER_JMP - - -//;;; Store the current value of chainlen. - mov [chainlenwmask], edx -/* -;;; Point edi to the string under scrutiny, and esi to the string we -;;; are hoping to match it up with. In actuality, esi and edi are -;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is -;;; initialized to -(MAX_MATCH_8 - scanalign). -*/ - lea rsi,[r8+r10] - mov rdx, 0xfffffffffffffef8 //; -(MAX_MATCH_8) - lea rsi, [rsi + r13 + 0x0108] //;MAX_MATCH_8] - lea rdi, [r9 + r13 + 0x0108] //;MAX_MATCH_8] - - prefetcht1 [rsi+rdx] - prefetcht1 [rdi+rdx] - -/* -;;; Test the strings for equality, 8 bytes at a time. At the end, -;;; adjust rdx so that it is offset to the exact byte that mismatched. -;;; -;;; We already know at this point that the first three bytes of the -;;; strings match each other, and they can be safely passed over before -;;; starting the compare loop. So what this code does is skip over 0-3 -;;; bytes, as much as necessary in order to dword-align the edi -;;; pointer. (rsi will still be misaligned three times out of four.) -;;; -;;; It should be confessed that this loop usually does not represent -;;; much of the total running time. Replacing it with a more -;;; straightforward "rep cmpsb" would not drastically degrade -;;; performance. -*/ - -LoopCmps: - mov rax, [rsi + rdx] - xor rax, [rdi + rdx] - jnz LeaveLoopCmps - - mov rax, [rsi + rdx + 8] - xor rax, [rdi + rdx + 8] - jnz LeaveLoopCmps8 - - - mov rax, [rsi + rdx + 8+8] - xor rax, [rdi + rdx + 8+8] - jnz LeaveLoopCmps16 - - add rdx,8+8+8 - - BEFORE_JMP - jnz LoopCmps - jmp LenMaximum - AFTER_JMP - -LeaveLoopCmps16: add rdx,8 -LeaveLoopCmps8: add rdx,8 -LeaveLoopCmps: - - test eax, 0x0000FFFF - jnz LenLower - - test eax,0xffffffff - - jnz LenLower32 - - add rdx,4 - shr rax,32 - or ax,ax - BEFORE_JMP - jnz LenLower - AFTER_JMP - -LenLower32: - shr eax,16 - add rdx,2 - -LenLower: - sub al, 1 - adc rdx, 0 -//;;; Calculate the length of the match. If it is longer than MAX_MATCH, -//;;; then automatically accept it as the best possible match and leave. - - lea rax, [rdi + rdx] - sub rax, r9 - cmp eax, MAX_MATCH - BEFORE_JMP - jge LenMaximum - AFTER_JMP -/* -;;; If the length of the match is not longer than the best match we -;;; have so far, then forget it and return to the lookup loop. -;/////////////////////////////////// -*/ - cmp eax, r11d - jg LongerMatch - - lea rsi,[r10+r11] - - mov rdi, prev_ad - mov edx, [chainlenwmask] - BEFORE_JMP - jmp LookupLoop - AFTER_JMP -/* -;;; s->match_start = cur_match; -;;; best_len = len; -;;; if (len >= nice_match) break; -;;; scan_end = *(ushf*)(scan+best_len-1); -*/ -LongerMatch: - mov r11d, eax - mov match_start, r8d - cmp eax, [nicematch] - BEFORE_JMP - jge LeaveNow - AFTER_JMP - - lea rsi,[r10+rax] - - movzx ebx, word ptr [r9 + rax - 1] - mov rdi, prev_ad - mov edx, [chainlenwmask] - BEFORE_JMP - jmp LookupLoop - AFTER_JMP - -//;;; Accept the current string, with the maximum possible length. - -LenMaximum: - mov r11d,MAX_MATCH - mov match_start, r8d - -//;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len; -//;;; return s->lookahead; - -LeaveNow: - mov eax, Lookahead - cmp r11d, eax - cmovng eax, r11d - - - -//;;; Restore the stack and return from whence we came. - - -// mov rsi,[save_rsi] -// mov rdi,[save_rdi] - mov rbx,[save_rbx] - mov rbp,[save_rbp] - mov r12,[save_r12] - mov r13,[save_r13] - mov r14,[save_r14] - mov r15,[save_r15] - - - ret 0 -//; please don't remove this string ! -//; Your can freely use gvmat64 in any free or commercial app -//; but it is far better don't remove the string in the binary! - // db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998, converted to amd 64 by Gilles Vollant 2005",0dh,0ah,0 - - -match_init: - ret 0 - - diff --git a/compat/zlib/contrib/infback9/README b/compat/zlib/contrib/infback9/README deleted file mode 100644 index e75ed13..0000000 --- a/compat/zlib/contrib/infback9/README +++ /dev/null @@ -1 +0,0 @@ -See infback9.h for what this is and how to use it. diff --git a/compat/zlib/contrib/infback9/infback9.c b/compat/zlib/contrib/infback9/infback9.c deleted file mode 100644 index 05fb3e3..0000000 --- a/compat/zlib/contrib/infback9/infback9.c +++ /dev/null @@ -1,615 +0,0 @@ -/* infback9.c -- inflate deflate64 data using a call-back interface - * Copyright (C) 1995-2008 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "infback9.h" -#include "inftree9.h" -#include "inflate9.h" - -#define WSIZE 65536UL - -/* - strm provides memory allocation functions in zalloc and zfree, or - Z_NULL to use the library memory allocation functions. - - window is a user-supplied window and output buffer that is 64K bytes. - */ -int ZEXPORT inflateBack9Init_(strm, window, version, stream_size) -z_stream FAR *strm; -unsigned char FAR *window; -const char *version; -int stream_size; -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL || window == Z_NULL) - return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - state = (struct inflate_state FAR *)ZALLOC(strm, 1, - sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (voidpf)state; - state->window = window; - return Z_OK; -} - -/* - Build and output length and distance decoding tables for fixed code - decoding. - */ -#ifdef MAKEFIXED -#include - -void makefixed9(void) -{ - unsigned sym, bits, low, size; - code *next, *lenfix, *distfix; - struct inflate_state state; - code fixed[544]; - - /* literal/length table */ - sym = 0; - while (sym < 144) state.lens[sym++] = 8; - while (sym < 256) state.lens[sym++] = 9; - while (sym < 280) state.lens[sym++] = 7; - while (sym < 288) state.lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table9(LENS, state.lens, 288, &(next), &(bits), state.work); - - /* distance table */ - sym = 0; - while (sym < 32) state.lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table9(DISTS, state.lens, 32, &(next), &(bits), state.work); - - /* write tables */ - puts(" /* inffix9.h -- table for decoding deflate64 fixed codes"); - puts(" * Generated automatically by makefixed9()."); - puts(" */"); - puts(""); - puts(" /* WARNING: this file should *not* be used by applications."); - puts(" It is part of the implementation of this library and is"); - puts(" subject to change. Applications should only use zlib.h."); - puts(" */"); - puts(""); - size = 1U << 9; - printf(" static const code lenfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 6) == 0) printf("\n "); - printf("{%u,%u,%d}", lenfix[low].op, lenfix[low].bits, - lenfix[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); - size = 1U << 5; - printf("\n static const code distfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 5) == 0) printf("\n "); - printf("{%u,%u,%d}", distfix[low].op, distfix[low].bits, - distfix[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); -} -#endif /* MAKEFIXED */ - -/* Macros for inflateBack(): */ - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Assure that some input is available. If input is requested, but denied, - then return a Z_BUF_ERROR from inflateBack(). */ -#define PULL() \ - do { \ - if (have == 0) { \ - have = in(in_desc, &next); \ - if (have == 0) { \ - next = Z_NULL; \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflateBack() - with an error if there is no input available. */ -#define PULLBYTE() \ - do { \ - PULL(); \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflateBack() with - an error. */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n <= 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Assure that some output space is available, by writing out the window - if it's full. If the write fails, return from inflateBack() with a - Z_BUF_ERROR. */ -#define ROOM() \ - do { \ - if (left == 0) { \ - put = window; \ - left = WSIZE; \ - wrap = 1; \ - if (out(out_desc, put, (unsigned)left)) { \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* - strm provides the memory allocation functions and window buffer on input, - and provides information on the unused input on return. For Z_DATA_ERROR - returns, strm will also provide an error message. - - in() and out() are the call-back input and output functions. When - inflateBack() needs more input, it calls in(). When inflateBack() has - filled the window with output, or when it completes with data in the - window, it calls out() to write out the data. The application must not - change the provided input until in() is called again or inflateBack() - returns. The application must not change the window/output buffer until - inflateBack() returns. - - in() and out() are called with a descriptor parameter provided in the - inflateBack() call. This parameter can be a structure that provides the - information required to do the read or write, as well as accumulated - information on the input and output such as totals and check values. - - in() should return zero on failure. out() should return non-zero on - failure. If either in() or out() fails, than inflateBack() returns a - Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it - was in() or out() that caused in the error. Otherwise, inflateBack() - returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format - error, or Z_MEM_ERROR if it could not allocate memory for the state. - inflateBack() can also return Z_STREAM_ERROR if the input parameters - are not correct, i.e. strm is Z_NULL or the state was not initialized. - */ -int ZEXPORT inflateBack9(strm, in, in_desc, out, out_desc) -z_stream FAR *strm; -in_func in; -void FAR *in_desc; -out_func out; -void FAR *out_desc; -{ - struct inflate_state FAR *state; - z_const unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have; /* available input */ - unsigned long left; /* available output */ - inflate_mode mode; /* current inflate mode */ - int lastblock; /* true if processing last block */ - int wrap; /* true if the window has wrapped */ - unsigned char FAR *window; /* allocated sliding window, if needed */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned extra; /* extra bits needed */ - unsigned long length; /* literal or length of data to copy */ - unsigned long offset; /* distance back to copy string from */ - unsigned long copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code const FAR *lencode; /* starting table for length/literal codes */ - code const FAR *distcode; /* starting table for distance codes */ - unsigned lenbits; /* index bits for lencode */ - unsigned distbits; /* index bits for distcode */ - code here; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; -#include "inffix9.h" - - /* Check that the strm exists and that the state was initialized */ - if (strm == Z_NULL || strm->state == Z_NULL) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* Reset the state */ - strm->msg = Z_NULL; - mode = TYPE; - lastblock = 0; - wrap = 0; - window = state->window; - next = strm->next_in; - have = next != Z_NULL ? strm->avail_in : 0; - hold = 0; - bits = 0; - put = window; - left = WSIZE; - lencode = Z_NULL; - distcode = Z_NULL; - - /* Inflate until end of block marked as last */ - for (;;) - switch (mode) { - case TYPE: - /* determine and dispatch block type */ - if (lastblock) { - BYTEBITS(); - mode = DONE; - break; - } - NEEDBITS(3); - lastblock = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - lastblock ? " (last)" : "")); - mode = STORED; - break; - case 1: /* fixed block */ - lencode = lenfix; - lenbits = 9; - distcode = distfix; - distbits = 5; - Tracev((stderr, "inflate: fixed codes block%s\n", - lastblock ? " (last)" : "")); - mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - lastblock ? " (last)" : "")); - mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - mode = BAD; - } - DROPBITS(2); - break; - - case STORED: - /* get and verify stored block length */ - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - mode = BAD; - break; - } - length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %lu\n", - length)); - INITBITS(); - - /* copy stored block from input to output */ - while (length != 0) { - copy = length; - PULL(); - ROOM(); - if (copy > have) copy = have; - if (copy > left) copy = left; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - length -= copy; - } - Tracev((stderr, "inflate: stored end\n")); - mode = TYPE; - break; - - case TABLE: - /* get dynamic table entries descriptor */ - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); - if (state->nlen > 286) { - strm->msg = (char *)"too many length symbols"; - mode = BAD; - break; - } - Tracev((stderr, "inflate: table sizes ok\n")); - - /* get code length code lengths (not a typo) */ - state->have = 0; - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - lencode = (code const FAR *)(state->next); - lenbits = 7; - ret = inflate_table9(CODES, state->lens, 19, &(state->next), - &(lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - - /* get length and distance code code lengths */ - state->have = 0; - while (state->have < state->nlen + state->ndist) { - for (;;) { - here = lencode[BITS(lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.val < 16) { - NEEDBITS(here.bits); - DROPBITS(here.bits); - state->lens[state->have++] = here.val; - } - else { - if (here.val == 16) { - NEEDBITS(here.bits + 2); - DROPBITS(here.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - mode = BAD; - break; - } - len = (unsigned)(state->lens[state->have - 1]); - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (here.val == 17) { - NEEDBITS(here.bits + 3); - DROPBITS(here.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(here.bits + 7); - DROPBITS(here.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (mode == BAD) break; - - /* check for end-of-block code (better have one) */ - if (state->lens[256] == 0) { - strm->msg = (char *)"invalid code -- missing end-of-block"; - mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftree9.h - concerning the ENOUGH constants, which depend on those values */ - state->next = state->codes; - lencode = (code const FAR *)(state->next); - lenbits = 9; - ret = inflate_table9(LENS, state->lens, state->nlen, - &(state->next), &(lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - mode = BAD; - break; - } - distcode = (code const FAR *)(state->next); - distbits = 6; - ret = inflate_table9(DISTS, state->lens + state->nlen, - state->ndist, &(state->next), &(distbits), - state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - mode = LEN; - - case LEN: - /* get a literal, length, or end-of-block code */ - for (;;) { - here = lencode[BITS(lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.op && (here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(here.bits); - length = (unsigned)here.val; - - /* process literal */ - if (here.op == 0) { - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - ROOM(); - *put++ = (unsigned char)(length); - left--; - mode = LEN; - break; - } - - /* process end of block */ - if (here.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - mode = TYPE; - break; - } - - /* invalid code */ - if (here.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - mode = BAD; - break; - } - - /* length code -- get extra bits, if any */ - extra = (unsigned)(here.op) & 31; - if (extra != 0) { - NEEDBITS(extra); - length += BITS(extra); - DROPBITS(extra); - } - Tracevv((stderr, "inflate: length %lu\n", length)); - - /* get distance code */ - for (;;) { - here = distcode[BITS(distbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if ((here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(here.bits); - if (here.op & 64) { - strm->msg = (char *)"invalid distance code"; - mode = BAD; - break; - } - offset = (unsigned)here.val; - - /* get distance extra bits, if any */ - extra = (unsigned)(here.op) & 15; - if (extra != 0) { - NEEDBITS(extra); - offset += BITS(extra); - DROPBITS(extra); - } - if (offset > WSIZE - (wrap ? 0: left)) { - strm->msg = (char *)"invalid distance too far back"; - mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %lu\n", offset)); - - /* copy match from window to output */ - do { - ROOM(); - copy = WSIZE - offset; - if (copy < left) { - from = put + copy; - copy = left - copy; - } - else { - from = put - offset; - copy = left; - } - if (copy > length) copy = length; - length -= copy; - left -= copy; - do { - *put++ = *from++; - } while (--copy); - } while (length != 0); - break; - - case DONE: - /* inflate stream terminated properly -- write leftover output */ - ret = Z_STREAM_END; - if (left < WSIZE) { - if (out(out_desc, window, (unsigned)(WSIZE - left))) - ret = Z_BUF_ERROR; - } - goto inf_leave; - - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - - default: /* can't happen, but makes compilers happy */ - ret = Z_STREAM_ERROR; - goto inf_leave; - } - - /* Return unused input */ - inf_leave: - strm->next_in = next; - strm->avail_in = have; - return ret; -} - -int ZEXPORT inflateBack9End(strm) -z_stream FAR *strm; -{ - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} diff --git a/compat/zlib/contrib/infback9/infback9.h b/compat/zlib/contrib/infback9/infback9.h deleted file mode 100644 index 1073c0a..0000000 --- a/compat/zlib/contrib/infback9/infback9.h +++ /dev/null @@ -1,37 +0,0 @@ -/* infback9.h -- header for using inflateBack9 functions - * Copyright (C) 2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * This header file and associated patches provide a decoder for PKWare's - * undocumented deflate64 compression method (method 9). Use with infback9.c, - * inftree9.h, inftree9.c, and inffix9.h. These patches are not supported. - * This should be compiled with zlib, since it uses zutil.h and zutil.o. - * This code has not yet been tested on 16-bit architectures. See the - * comments in zlib.h for inflateBack() usage. These functions are used - * identically, except that there is no windowBits parameter, and a 64K - * window must be provided. Also if int's are 16 bits, then a zero for - * the third parameter of the "out" function actually means 65536UL. - * zlib.h must be included before this header file. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); -ZEXTERN int ZEXPORT inflateBack9End OF((z_stream FAR *strm)); -ZEXTERN int ZEXPORT inflateBack9Init_ OF((z_stream FAR *strm, - unsigned char FAR *window, - const char *version, - int stream_size)); -#define inflateBack9Init(strm, window) \ - inflateBack9Init_((strm), (window), \ - ZLIB_VERSION, sizeof(z_stream)) - -#ifdef __cplusplus -} -#endif diff --git a/compat/zlib/contrib/infback9/inffix9.h b/compat/zlib/contrib/infback9/inffix9.h deleted file mode 100644 index ee5671d..0000000 --- a/compat/zlib/contrib/infback9/inffix9.h +++ /dev/null @@ -1,107 +0,0 @@ - /* inffix9.h -- table for decoding deflate64 fixed codes - * Generated automatically by makefixed9(). - */ - - /* WARNING: this file should *not* be used by applications. - It is part of the implementation of this library and is - subject to change. Applications should only use zlib.h. - */ - - static const code lenfix[512] = { - {96,7,0},{0,8,80},{0,8,16},{132,8,115},{130,7,31},{0,8,112}, - {0,8,48},{0,9,192},{128,7,10},{0,8,96},{0,8,32},{0,9,160}, - {0,8,0},{0,8,128},{0,8,64},{0,9,224},{128,7,6},{0,8,88}, - {0,8,24},{0,9,144},{131,7,59},{0,8,120},{0,8,56},{0,9,208}, - {129,7,17},{0,8,104},{0,8,40},{0,9,176},{0,8,8},{0,8,136}, - {0,8,72},{0,9,240},{128,7,4},{0,8,84},{0,8,20},{133,8,227}, - {131,7,43},{0,8,116},{0,8,52},{0,9,200},{129,7,13},{0,8,100}, - {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232}, - {128,7,8},{0,8,92},{0,8,28},{0,9,152},{132,7,83},{0,8,124}, - {0,8,60},{0,9,216},{130,7,23},{0,8,108},{0,8,44},{0,9,184}, - {0,8,12},{0,8,140},{0,8,76},{0,9,248},{128,7,3},{0,8,82}, - {0,8,18},{133,8,163},{131,7,35},{0,8,114},{0,8,50},{0,9,196}, - {129,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},{0,8,130}, - {0,8,66},{0,9,228},{128,7,7},{0,8,90},{0,8,26},{0,9,148}, - {132,7,67},{0,8,122},{0,8,58},{0,9,212},{130,7,19},{0,8,106}, - {0,8,42},{0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244}, - {128,7,5},{0,8,86},{0,8,22},{65,8,0},{131,7,51},{0,8,118}, - {0,8,54},{0,9,204},{129,7,15},{0,8,102},{0,8,38},{0,9,172}, - {0,8,6},{0,8,134},{0,8,70},{0,9,236},{128,7,9},{0,8,94}, - {0,8,30},{0,9,156},{132,7,99},{0,8,126},{0,8,62},{0,9,220}, - {130,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, - {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{133,8,131}, - {130,7,31},{0,8,113},{0,8,49},{0,9,194},{128,7,10},{0,8,97}, - {0,8,33},{0,9,162},{0,8,1},{0,8,129},{0,8,65},{0,9,226}, - {128,7,6},{0,8,89},{0,8,25},{0,9,146},{131,7,59},{0,8,121}, - {0,8,57},{0,9,210},{129,7,17},{0,8,105},{0,8,41},{0,9,178}, - {0,8,9},{0,8,137},{0,8,73},{0,9,242},{128,7,4},{0,8,85}, - {0,8,21},{144,8,3},{131,7,43},{0,8,117},{0,8,53},{0,9,202}, - {129,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133}, - {0,8,69},{0,9,234},{128,7,8},{0,8,93},{0,8,29},{0,9,154}, - {132,7,83},{0,8,125},{0,8,61},{0,9,218},{130,7,23},{0,8,109}, - {0,8,45},{0,9,186},{0,8,13},{0,8,141},{0,8,77},{0,9,250}, - {128,7,3},{0,8,83},{0,8,19},{133,8,195},{131,7,35},{0,8,115}, - {0,8,51},{0,9,198},{129,7,11},{0,8,99},{0,8,35},{0,9,166}, - {0,8,3},{0,8,131},{0,8,67},{0,9,230},{128,7,7},{0,8,91}, - {0,8,27},{0,9,150},{132,7,67},{0,8,123},{0,8,59},{0,9,214}, - {130,7,19},{0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139}, - {0,8,75},{0,9,246},{128,7,5},{0,8,87},{0,8,23},{77,8,0}, - {131,7,51},{0,8,119},{0,8,55},{0,9,206},{129,7,15},{0,8,103}, - {0,8,39},{0,9,174},{0,8,7},{0,8,135},{0,8,71},{0,9,238}, - {128,7,9},{0,8,95},{0,8,31},{0,9,158},{132,7,99},{0,8,127}, - {0,8,63},{0,9,222},{130,7,27},{0,8,111},{0,8,47},{0,9,190}, - {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80}, - {0,8,16},{132,8,115},{130,7,31},{0,8,112},{0,8,48},{0,9,193}, - {128,7,10},{0,8,96},{0,8,32},{0,9,161},{0,8,0},{0,8,128}, - {0,8,64},{0,9,225},{128,7,6},{0,8,88},{0,8,24},{0,9,145}, - {131,7,59},{0,8,120},{0,8,56},{0,9,209},{129,7,17},{0,8,104}, - {0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},{0,9,241}, - {128,7,4},{0,8,84},{0,8,20},{133,8,227},{131,7,43},{0,8,116}, - {0,8,52},{0,9,201},{129,7,13},{0,8,100},{0,8,36},{0,9,169}, - {0,8,4},{0,8,132},{0,8,68},{0,9,233},{128,7,8},{0,8,92}, - {0,8,28},{0,9,153},{132,7,83},{0,8,124},{0,8,60},{0,9,217}, - {130,7,23},{0,8,108},{0,8,44},{0,9,185},{0,8,12},{0,8,140}, - {0,8,76},{0,9,249},{128,7,3},{0,8,82},{0,8,18},{133,8,163}, - {131,7,35},{0,8,114},{0,8,50},{0,9,197},{129,7,11},{0,8,98}, - {0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, - {128,7,7},{0,8,90},{0,8,26},{0,9,149},{132,7,67},{0,8,122}, - {0,8,58},{0,9,213},{130,7,19},{0,8,106},{0,8,42},{0,9,181}, - {0,8,10},{0,8,138},{0,8,74},{0,9,245},{128,7,5},{0,8,86}, - {0,8,22},{65,8,0},{131,7,51},{0,8,118},{0,8,54},{0,9,205}, - {129,7,15},{0,8,102},{0,8,38},{0,9,173},{0,8,6},{0,8,134}, - {0,8,70},{0,9,237},{128,7,9},{0,8,94},{0,8,30},{0,9,157}, - {132,7,99},{0,8,126},{0,8,62},{0,9,221},{130,7,27},{0,8,110}, - {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253}, - {96,7,0},{0,8,81},{0,8,17},{133,8,131},{130,7,31},{0,8,113}, - {0,8,49},{0,9,195},{128,7,10},{0,8,97},{0,8,33},{0,9,163}, - {0,8,1},{0,8,129},{0,8,65},{0,9,227},{128,7,6},{0,8,89}, - {0,8,25},{0,9,147},{131,7,59},{0,8,121},{0,8,57},{0,9,211}, - {129,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},{0,8,137}, - {0,8,73},{0,9,243},{128,7,4},{0,8,85},{0,8,21},{144,8,3}, - {131,7,43},{0,8,117},{0,8,53},{0,9,203},{129,7,13},{0,8,101}, - {0,8,37},{0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235}, - {128,7,8},{0,8,93},{0,8,29},{0,9,155},{132,7,83},{0,8,125}, - {0,8,61},{0,9,219},{130,7,23},{0,8,109},{0,8,45},{0,9,187}, - {0,8,13},{0,8,141},{0,8,77},{0,9,251},{128,7,3},{0,8,83}, - {0,8,19},{133,8,195},{131,7,35},{0,8,115},{0,8,51},{0,9,199}, - {129,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, - {0,8,67},{0,9,231},{128,7,7},{0,8,91},{0,8,27},{0,9,151}, - {132,7,67},{0,8,123},{0,8,59},{0,9,215},{130,7,19},{0,8,107}, - {0,8,43},{0,9,183},{0,8,11},{0,8,139},{0,8,75},{0,9,247}, - {128,7,5},{0,8,87},{0,8,23},{77,8,0},{131,7,51},{0,8,119}, - {0,8,55},{0,9,207},{129,7,15},{0,8,103},{0,8,39},{0,9,175}, - {0,8,7},{0,8,135},{0,8,71},{0,9,239},{128,7,9},{0,8,95}, - {0,8,31},{0,9,159},{132,7,99},{0,8,127},{0,8,63},{0,9,223}, - {130,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143}, - {0,8,79},{0,9,255} - }; - - static const code distfix[32] = { - {128,5,1},{135,5,257},{131,5,17},{139,5,4097},{129,5,5}, - {137,5,1025},{133,5,65},{141,5,16385},{128,5,3},{136,5,513}, - {132,5,33},{140,5,8193},{130,5,9},{138,5,2049},{134,5,129}, - {142,5,32769},{128,5,2},{135,5,385},{131,5,25},{139,5,6145}, - {129,5,7},{137,5,1537},{133,5,97},{141,5,24577},{128,5,4}, - {136,5,769},{132,5,49},{140,5,12289},{130,5,13},{138,5,3073}, - {134,5,193},{142,5,49153} - }; diff --git a/compat/zlib/contrib/infback9/inflate9.h b/compat/zlib/contrib/infback9/inflate9.h deleted file mode 100644 index ee9a793..0000000 --- a/compat/zlib/contrib/infback9/inflate9.h +++ /dev/null @@ -1,47 +0,0 @@ -/* inflate9.h -- internal inflate state definition - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* Possible inflate modes between inflate() calls */ -typedef enum { - TYPE, /* i: waiting for type bits, including last-flag bit */ - STORED, /* i: waiting for stored size (length and complement) */ - TABLE, /* i: waiting for dynamic block table lengths */ - LEN, /* i: waiting for length/lit code */ - DONE, /* finished check, done -- remain here until reset */ - BAD /* got a data error -- remain here until reset */ -} inflate_mode; - -/* - State transitions between above modes - - - (most modes can go to the BAD mode -- not shown for clarity) - - Read deflate blocks: - TYPE -> STORED or TABLE or LEN or DONE - STORED -> TYPE - TABLE -> LENLENS -> CODELENS -> LEN - Read deflate codes: - LEN -> LEN or TYPE - */ - -/* state maintained between inflate() calls. Approximately 7K bytes. */ -struct inflate_state { - /* sliding window */ - unsigned char FAR *window; /* allocated sliding window, if needed */ - /* dynamic table building */ - unsigned ncode; /* number of code length code lengths */ - unsigned nlen; /* number of length code lengths */ - unsigned ndist; /* number of distance code lengths */ - unsigned have; /* number of code lengths in lens[] */ - code FAR *next; /* next available space in codes[] */ - unsigned short lens[320]; /* temporary storage for code lengths */ - unsigned short work[288]; /* work area for code table building */ - code codes[ENOUGH]; /* space for code tables */ -}; diff --git a/compat/zlib/contrib/infback9/inftree9.c b/compat/zlib/contrib/infback9/inftree9.c deleted file mode 100644 index 5f4a767..0000000 --- a/compat/zlib/contrib/infback9/inftree9.c +++ /dev/null @@ -1,324 +0,0 @@ -/* inftree9.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2017 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftree9.h" - -#define MAXBITS 15 - -const char inflate9_copyright[] = - " inflate9 1.2.11 Copyright 1995-2017 Mark Adler "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* - Build a set of tables to decode the provided canonical Huffman code. - The code lengths are lens[0..codes-1]. The result starts at *table, - whose indices are 0..2^bits-1. work is a writable array of at least - lens shorts, which is used as a work area. type is the type of code - to be generated, CODES, LENS, or DISTS. On return, zero is success, - -1 is an invalid code, and +1 means that ENOUGH isn't enough. table - on return points to the next available entry's address. bits is the - requested root table index bits, and on return it is the actual root - table index bits. It will differ if the request is greater than the - longest code or if it is less than the shortest code. - */ -int inflate_table9(type, lens, codes, table, bits, work) -codetype type; -unsigned short FAR *lens; -unsigned codes; -code FAR * FAR *table; -unsigned FAR *bits; -unsigned short FAR *work; -{ - unsigned len; /* a code's length in bits */ - unsigned sym; /* index of code symbols */ - unsigned min, max; /* minimum and maximum code lengths */ - unsigned root; /* number of index bits for root table */ - unsigned curr; /* number of index bits for current table */ - unsigned drop; /* code bits to drop for sub-table */ - int left; /* number of prefix codes available */ - unsigned used; /* code entries in table used */ - unsigned huff; /* Huffman code */ - unsigned incr; /* for incrementing code, index */ - unsigned fill; /* index for replicating entries */ - unsigned low; /* low bits for current root entry */ - unsigned mask; /* mask for low root bits */ - code this; /* table entry for duplication */ - code FAR *next; /* next available space in table */ - const unsigned short FAR *base; /* base value table to use */ - const unsigned short FAR *extra; /* extra bits table to use */ - int end; /* use base and extra for symbol > end */ - unsigned short count[MAXBITS+1]; /* number of codes of each length */ - unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ - static const unsigned short lbase[31] = { /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, - 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, - 131, 163, 195, 227, 3, 0, 0}; - static const unsigned short lext[31] = { /* Length codes 257..285 extra */ - 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, - 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, - 133, 133, 133, 133, 144, 77, 202}; - static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, - 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, - 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153}; - static const unsigned short dext[32] = { /* Distance codes 0..31 extra */ - 128, 128, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, - 133, 133, 134, 134, 135, 135, 136, 136, 137, 137, 138, 138, - 139, 139, 140, 140, 141, 141, 142, 142}; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) - count[len] = 0; - for (sym = 0; sym < codes; sym++) - count[lens[sym]]++; - - /* bound code lengths, force root to be within code lengths */ - root = *bits; - for (max = MAXBITS; max >= 1; max--) - if (count[max] != 0) break; - if (root > max) root = max; - if (max == 0) return -1; /* no codes! */ - for (min = 1; min <= MAXBITS; min++) - if (count[min] != 0) break; - if (root < min) root = min; - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) return -1; /* over-subscribed */ - } - if (left > 0 && (type == CODES || max != 1)) - return -1; /* incomplete set */ - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) - offs[len + 1] = offs[len] + count[len]; - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) - if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked for LENS and DIST tables against - the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in - the initial root table size constants. See the comments in inftree9.h - for more information. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - switch (type) { - case CODES: - base = extra = work; /* dummy value--not used */ - end = 19; - break; - case LENS: - base = lbase; - base -= 257; - extra = lext; - extra -= 257; - end = 256; - break; - default: /* DISTS */ - base = dbase; - extra = dext; - end = -1; - } - - /* initialize state for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = *table; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = (unsigned)(-1); /* trigger new sub-table when len > root */ - used = 1U << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if ((type == LENS && used >= ENOUGH_LENS) || - (type == DISTS && used >= ENOUGH_DISTS)) - return 1; - - /* process all codes and make table entries */ - for (;;) { - /* create table entry */ - this.bits = (unsigned char)(len - drop); - if ((int)(work[sym]) < end) { - this.op = (unsigned char)0; - this.val = work[sym]; - } - else if ((int)(work[sym]) > end) { - this.op = (unsigned char)(extra[work[sym]]); - this.val = base[work[sym]]; - } - else { - this.op = (unsigned char)(32 + 64); /* end of block */ - this.val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1U << (len - drop); - fill = 1U << curr; - do { - fill -= incr; - next[(huff >> drop) + fill] = this; - } while (fill != 0); - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - - /* go to next symbol, update count, len */ - sym++; - if (--(count[len]) == 0) { - if (len == max) break; - len = lens[work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) != low) { - /* if first time, transition to sub-tables */ - if (drop == 0) - drop = root; - - /* increment past last table */ - next += 1U << curr; - - /* determine length of next table */ - curr = len - drop; - left = (int)(1 << curr); - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) break; - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1U << curr; - if ((type == LENS && used >= ENOUGH_LENS) || - (type == DISTS && used >= ENOUGH_DISTS)) - return 1; - - /* point entry in root table to sub-table */ - low = huff & mask; - (*table)[low].op = (unsigned char)curr; - (*table)[low].bits = (unsigned char)root; - (*table)[low].val = (unsigned short)(next - *table); - } - } - - /* - Fill in rest of table for incomplete codes. This loop is similar to the - loop above in incrementing huff for table indices. It is assumed that - len is equal to curr + drop, so there is no loop needed to increment - through high index bits. When the current sub-table is filled, the loop - drops back to the root table to fill in any remaining entries there. - */ - this.op = (unsigned char)64; /* invalid code marker */ - this.bits = (unsigned char)(len - drop); - this.val = (unsigned short)0; - while (huff != 0) { - /* when done with sub-table, drop back to root table */ - if (drop != 0 && (huff & mask) != low) { - drop = 0; - len = root; - next = *table; - curr = root; - this.bits = (unsigned char)len; - } - - /* put invalid code marker in table */ - next[huff >> drop] = this; - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - } - - /* set return parameters */ - *table += used; - *bits = root; - return 0; -} diff --git a/compat/zlib/contrib/infback9/inftree9.h b/compat/zlib/contrib/infback9/inftree9.h deleted file mode 100644 index 5ab21f0..0000000 --- a/compat/zlib/contrib/infback9/inftree9.h +++ /dev/null @@ -1,61 +0,0 @@ -/* inftree9.h -- header to use inftree9.c - * Copyright (C) 1995-2008 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* Structure for decoding tables. Each entry provides either the - information needed to do the operation requested by the code that - indexed that table entry, or it provides a pointer to another - table that indexes more bits of the code. op indicates whether - the entry is a pointer to another table, a literal, a length or - distance, an end-of-block, or an invalid code. For a table - pointer, the low four bits of op is the number of index bits of - that table. For a length or distance, the low four bits of op - is the number of extra bits to get after the code. bits is - the number of bits in this code or part of the code to drop off - of the bit buffer. val is the actual byte to output in the case - of a literal, the base length or distance, or the offset from - the current table to the next table. Each entry is four bytes. */ -typedef struct { - unsigned char op; /* operation, extra bits, table bits */ - unsigned char bits; /* bits in this part of the code */ - unsigned short val; /* offset in table or code value */ -} code; - -/* op values as set by inflate_table(): - 00000000 - literal - 0000tttt - table link, tttt != 0 is the number of table index bits - 100eeeee - length or distance, eeee is the number of extra bits - 01100000 - end of block - 01000000 - invalid code - */ - -/* Maximum size of the dynamic table. The maximum number of code structures is - 1446, which is the sum of 852 for literal/length codes and 594 for distance - codes. These values were found by exhaustive searches using the program - examples/enough.c found in the zlib distribtution. The arguments to that - program are the number of symbols, the initial root table size, and the - maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 32 6 15" for distance codes returns 594. - The initial root table size (9 or 6) is found in the fifth argument of the - inflate_table() calls in infback9.c. If the root table size is changed, - then these maximum sizes would be need to be recalculated and updated. */ -#define ENOUGH_LENS 852 -#define ENOUGH_DISTS 594 -#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) - -/* Type of code to build for inflate_table9() */ -typedef enum { - CODES, - LENS, - DISTS -} codetype; - -extern int inflate_table9 OF((codetype type, unsigned short FAR *lens, - unsigned codes, code FAR * FAR *table, - unsigned FAR *bits, unsigned short FAR *work)); diff --git a/compat/zlib/contrib/inflate86/inffas86.c b/compat/zlib/contrib/inflate86/inffas86.c deleted file mode 100644 index 7292f67..0000000 --- a/compat/zlib/contrib/inflate86/inffas86.c +++ /dev/null @@ -1,1157 +0,0 @@ -/* inffas86.c is a hand tuned assembler version of - * - * inffast.c -- fast decoding - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Copyright (C) 2003 Chris Anderson - * Please use the copyright conditions above. - * - * Dec-29-2003 -- I added AMD64 inflate asm support. This version is also - * slightly quicker on x86 systems because, instead of using rep movsb to copy - * data, it uses rep movsw, which moves data in 2-byte chunks instead of single - * bytes. I've tested the AMD64 code on a Fedora Core 1 + the x86_64 updates - * from http://fedora.linux.duke.edu/fc1_x86_64 - * which is running on an Athlon 64 3000+ / Gigabyte GA-K8VT800M system with - * 1GB ram. The 64-bit version is about 4% faster than the 32-bit version, - * when decompressing mozilla-source-1.3.tar.gz. - * - * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from - * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at - * the moment. I have successfully compiled and tested this code with gcc2.96, - * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S - * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX - * enabled. I will attempt to merge the MMX code into this version. Newer - * versions of this and inffast.S can be found at - * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/ - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -/* Mark Adler's comments from inffast.c: */ - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state->mode == LEN - strm->avail_in >= 6 - strm->avail_out >= 258 - start >= strm->avail_out - state->bits < 8 - - On return, state->mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm->avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm->avail_out >= 258 for each loop to avoid checking for - output space. - */ -void inflate_fast(strm, start) -z_streamp strm; -unsigned start; /* inflate()'s starting value for strm->avail_out */ -{ - struct inflate_state FAR *state; - struct inffast_ar { -/* 64 32 x86 x86_64 */ -/* ar offset register */ -/* 0 0 */ void *esp; /* esp save */ -/* 8 4 */ void *ebp; /* ebp save */ -/* 16 8 */ unsigned char FAR *in; /* esi rsi local strm->next_in */ -/* 24 12 */ unsigned char FAR *last; /* r9 while in < last */ -/* 32 16 */ unsigned char FAR *out; /* edi rdi local strm->next_out */ -/* 40 20 */ unsigned char FAR *beg; /* inflate()'s init next_out */ -/* 48 24 */ unsigned char FAR *end; /* r10 while out < end */ -/* 56 28 */ unsigned char FAR *window;/* size of window, wsize!=0 */ -/* 64 32 */ code const FAR *lcode; /* ebp rbp local strm->lencode */ -/* 72 36 */ code const FAR *dcode; /* r11 local strm->distcode */ -/* 80 40 */ unsigned long hold; /* edx rdx local strm->hold */ -/* 88 44 */ unsigned bits; /* ebx rbx local strm->bits */ -/* 92 48 */ unsigned wsize; /* window size */ -/* 96 52 */ unsigned write; /* window write index */ -/*100 56 */ unsigned lmask; /* r12 mask for lcode */ -/*104 60 */ unsigned dmask; /* r13 mask for dcode */ -/*108 64 */ unsigned len; /* r14 match length */ -/*112 68 */ unsigned dist; /* r15 match distance */ -/*116 72 */ unsigned status; /* set when state chng*/ - } ar; - -#if defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 ) -#define PAD_AVAIL_IN 6 -#define PAD_AVAIL_OUT 258 -#else -#define PAD_AVAIL_IN 5 -#define PAD_AVAIL_OUT 257 -#endif - - /* copy state to local variables */ - state = (struct inflate_state FAR *)strm->state; - ar.in = strm->next_in; - ar.last = ar.in + (strm->avail_in - PAD_AVAIL_IN); - ar.out = strm->next_out; - ar.beg = ar.out - (start - strm->avail_out); - ar.end = ar.out + (strm->avail_out - PAD_AVAIL_OUT); - ar.wsize = state->wsize; - ar.write = state->wnext; - ar.window = state->window; - ar.hold = state->hold; - ar.bits = state->bits; - ar.lcode = state->lencode; - ar.dcode = state->distcode; - ar.lmask = (1U << state->lenbits) - 1; - ar.dmask = (1U << state->distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - - /* align in on 1/2 hold size boundary */ - while (((unsigned long)(void *)ar.in & (sizeof(ar.hold) / 2 - 1)) != 0) { - ar.hold += (unsigned long)*ar.in++ << ar.bits; - ar.bits += 8; - } - -#if defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 ) - __asm__ __volatile__ ( -" leaq %0, %%rax\n" -" movq %%rbp, 8(%%rax)\n" /* save regs rbp and rsp */ -" movq %%rsp, (%%rax)\n" -" movq %%rax, %%rsp\n" /* make rsp point to &ar */ -" movq 16(%%rsp), %%rsi\n" /* rsi = in */ -" movq 32(%%rsp), %%rdi\n" /* rdi = out */ -" movq 24(%%rsp), %%r9\n" /* r9 = last */ -" movq 48(%%rsp), %%r10\n" /* r10 = end */ -" movq 64(%%rsp), %%rbp\n" /* rbp = lcode */ -" movq 72(%%rsp), %%r11\n" /* r11 = dcode */ -" movq 80(%%rsp), %%rdx\n" /* rdx = hold */ -" movl 88(%%rsp), %%ebx\n" /* ebx = bits */ -" movl 100(%%rsp), %%r12d\n" /* r12d = lmask */ -" movl 104(%%rsp), %%r13d\n" /* r13d = dmask */ - /* r14d = len */ - /* r15d = dist */ -" cld\n" -" cmpq %%rdi, %%r10\n" -" je .L_one_time\n" /* if only one decode left */ -" cmpq %%rsi, %%r9\n" -" je .L_one_time\n" -" jmp .L_do_loop\n" - -".L_one_time:\n" -" movq %%r12, %%r8\n" /* r8 = lmask */ -" cmpb $32, %%bl\n" -" ja .L_get_length_code_one_time\n" - -" lodsl\n" /* eax = *(uint *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $32, %%bl\n" /* bits += 32 */ -" shlq %%cl, %%rax\n" -" orq %%rax, %%rdx\n" /* hold |= *((uint *)in)++ << bits */ -" jmp .L_get_length_code_one_time\n" - -".align 32,0x90\n" -".L_while_test:\n" -" cmpq %%rdi, %%r10\n" -" jbe .L_break_loop\n" -" cmpq %%rsi, %%r9\n" -" jbe .L_break_loop\n" - -".L_do_loop:\n" -" movq %%r12, %%r8\n" /* r8 = lmask */ -" cmpb $32, %%bl\n" -" ja .L_get_length_code\n" /* if (32 < bits) */ - -" lodsl\n" /* eax = *(uint *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $32, %%bl\n" /* bits += 32 */ -" shlq %%cl, %%rax\n" -" orq %%rax, %%rdx\n" /* hold |= *((uint *)in)++ << bits */ - -".L_get_length_code:\n" -" andq %%rdx, %%r8\n" /* r8 &= hold */ -" movl (%%rbp,%%r8,4), %%eax\n" /* eax = lcode[hold & lmask] */ - -" movb %%ah, %%cl\n" /* cl = this.bits */ -" subb %%ah, %%bl\n" /* bits -= this.bits */ -" shrq %%cl, %%rdx\n" /* hold >>= this.bits */ - -" testb %%al, %%al\n" -" jnz .L_test_for_length_base\n" /* if (op != 0) 45.7% */ - -" movq %%r12, %%r8\n" /* r8 = lmask */ -" shrl $16, %%eax\n" /* output this.val char */ -" stosb\n" - -".L_get_length_code_one_time:\n" -" andq %%rdx, %%r8\n" /* r8 &= hold */ -" movl (%%rbp,%%r8,4), %%eax\n" /* eax = lcode[hold & lmask] */ - -".L_dolen:\n" -" movb %%ah, %%cl\n" /* cl = this.bits */ -" subb %%ah, %%bl\n" /* bits -= this.bits */ -" shrq %%cl, %%rdx\n" /* hold >>= this.bits */ - -" testb %%al, %%al\n" -" jnz .L_test_for_length_base\n" /* if (op != 0) 45.7% */ - -" shrl $16, %%eax\n" /* output this.val char */ -" stosb\n" -" jmp .L_while_test\n" - -".align 32,0x90\n" -".L_test_for_length_base:\n" -" movl %%eax, %%r14d\n" /* len = this */ -" shrl $16, %%r14d\n" /* len = this.val */ -" movb %%al, %%cl\n" - -" testb $16, %%al\n" -" jz .L_test_for_second_level_length\n" /* if ((op & 16) == 0) 8% */ -" andb $15, %%cl\n" /* op &= 15 */ -" jz .L_decode_distance\n" /* if (!op) */ - -".L_add_bits_to_len:\n" -" subb %%cl, %%bl\n" -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" -" andl %%edx, %%eax\n" /* eax &= hold */ -" shrq %%cl, %%rdx\n" -" addl %%eax, %%r14d\n" /* len += hold & mask[op] */ - -".L_decode_distance:\n" -" movq %%r13, %%r8\n" /* r8 = dmask */ -" cmpb $32, %%bl\n" -" ja .L_get_distance_code\n" /* if (32 < bits) */ - -" lodsl\n" /* eax = *(uint *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $32, %%bl\n" /* bits += 32 */ -" shlq %%cl, %%rax\n" -" orq %%rax, %%rdx\n" /* hold |= *((uint *)in)++ << bits */ - -".L_get_distance_code:\n" -" andq %%rdx, %%r8\n" /* r8 &= hold */ -" movl (%%r11,%%r8,4), %%eax\n" /* eax = dcode[hold & dmask] */ - -".L_dodist:\n" -" movl %%eax, %%r15d\n" /* dist = this */ -" shrl $16, %%r15d\n" /* dist = this.val */ -" movb %%ah, %%cl\n" -" subb %%ah, %%bl\n" /* bits -= this.bits */ -" shrq %%cl, %%rdx\n" /* hold >>= this.bits */ -" movb %%al, %%cl\n" /* cl = this.op */ - -" testb $16, %%al\n" /* if ((op & 16) == 0) */ -" jz .L_test_for_second_level_dist\n" -" andb $15, %%cl\n" /* op &= 15 */ -" jz .L_check_dist_one\n" - -".L_add_bits_to_dist:\n" -" subb %%cl, %%bl\n" -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" /* (1 << op) - 1 */ -" andl %%edx, %%eax\n" /* eax &= hold */ -" shrq %%cl, %%rdx\n" -" addl %%eax, %%r15d\n" /* dist += hold & ((1 << op) - 1) */ - -".L_check_window:\n" -" movq %%rsi, %%r8\n" /* save in so from can use it's reg */ -" movq %%rdi, %%rax\n" -" subq 40(%%rsp), %%rax\n" /* nbytes = out - beg */ - -" cmpl %%r15d, %%eax\n" -" jb .L_clip_window\n" /* if (dist > nbytes) 4.2% */ - -" movl %%r14d, %%ecx\n" /* ecx = len */ -" movq %%rdi, %%rsi\n" -" subq %%r15, %%rsi\n" /* from = out - dist */ - -" sarl %%ecx\n" -" jnc .L_copy_two\n" /* if len % 2 == 0 */ - -" rep movsw\n" -" movb (%%rsi), %%al\n" -" movb %%al, (%%rdi)\n" -" incq %%rdi\n" - -" movq %%r8, %%rsi\n" /* move in back to %rsi, toss from */ -" jmp .L_while_test\n" - -".L_copy_two:\n" -" rep movsw\n" -" movq %%r8, %%rsi\n" /* move in back to %rsi, toss from */ -" jmp .L_while_test\n" - -".align 32,0x90\n" -".L_check_dist_one:\n" -" cmpl $1, %%r15d\n" /* if dist 1, is a memset */ -" jne .L_check_window\n" -" cmpq %%rdi, 40(%%rsp)\n" /* if out == beg, outside window */ -" je .L_check_window\n" - -" movl %%r14d, %%ecx\n" /* ecx = len */ -" movb -1(%%rdi), %%al\n" -" movb %%al, %%ah\n" - -" sarl %%ecx\n" -" jnc .L_set_two\n" -" movb %%al, (%%rdi)\n" -" incq %%rdi\n" - -".L_set_two:\n" -" rep stosw\n" -" jmp .L_while_test\n" - -".align 32,0x90\n" -".L_test_for_second_level_length:\n" -" testb $64, %%al\n" -" jnz .L_test_for_end_of_block\n" /* if ((op & 64) != 0) */ - -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" -" andl %%edx, %%eax\n" /* eax &= hold */ -" addl %%r14d, %%eax\n" /* eax += len */ -" movl (%%rbp,%%rax,4), %%eax\n" /* eax = lcode[val+(hold&mask[op])]*/ -" jmp .L_dolen\n" - -".align 32,0x90\n" -".L_test_for_second_level_dist:\n" -" testb $64, %%al\n" -" jnz .L_invalid_distance_code\n" /* if ((op & 64) != 0) */ - -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" -" andl %%edx, %%eax\n" /* eax &= hold */ -" addl %%r15d, %%eax\n" /* eax += dist */ -" movl (%%r11,%%rax,4), %%eax\n" /* eax = dcode[val+(hold&mask[op])]*/ -" jmp .L_dodist\n" - -".align 32,0x90\n" -".L_clip_window:\n" -" movl %%eax, %%ecx\n" /* ecx = nbytes */ -" movl 92(%%rsp), %%eax\n" /* eax = wsize, prepare for dist cmp */ -" negl %%ecx\n" /* nbytes = -nbytes */ - -" cmpl %%r15d, %%eax\n" -" jb .L_invalid_distance_too_far\n" /* if (dist > wsize) */ - -" addl %%r15d, %%ecx\n" /* nbytes = dist - nbytes */ -" cmpl $0, 96(%%rsp)\n" -" jne .L_wrap_around_window\n" /* if (write != 0) */ - -" movq 56(%%rsp), %%rsi\n" /* from = window */ -" subl %%ecx, %%eax\n" /* eax -= nbytes */ -" addq %%rax, %%rsi\n" /* from += wsize - nbytes */ - -" movl %%r14d, %%eax\n" /* eax = len */ -" cmpl %%ecx, %%r14d\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* eax -= nbytes */ -" rep movsb\n" -" movq %%rdi, %%rsi\n" -" subq %%r15, %%rsi\n" /* from = &out[ -dist ] */ -" jmp .L_do_copy\n" - -".align 32,0x90\n" -".L_wrap_around_window:\n" -" movl 96(%%rsp), %%eax\n" /* eax = write */ -" cmpl %%eax, %%ecx\n" -" jbe .L_contiguous_in_window\n" /* if (write >= nbytes) */ - -" movl 92(%%rsp), %%esi\n" /* from = wsize */ -" addq 56(%%rsp), %%rsi\n" /* from += window */ -" addq %%rax, %%rsi\n" /* from += write */ -" subq %%rcx, %%rsi\n" /* from -= nbytes */ -" subl %%eax, %%ecx\n" /* nbytes -= write */ - -" movl %%r14d, %%eax\n" /* eax = len */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movq 56(%%rsp), %%rsi\n" /* from = window */ -" movl 96(%%rsp), %%ecx\n" /* nbytes = write */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movq %%rdi, %%rsi\n" -" subq %%r15, %%rsi\n" /* from = out - dist */ -" jmp .L_do_copy\n" - -".align 32,0x90\n" -".L_contiguous_in_window:\n" -" movq 56(%%rsp), %%rsi\n" /* rsi = window */ -" addq %%rax, %%rsi\n" -" subq %%rcx, %%rsi\n" /* from += write - nbytes */ - -" movl %%r14d, %%eax\n" /* eax = len */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movq %%rdi, %%rsi\n" -" subq %%r15, %%rsi\n" /* from = out - dist */ -" jmp .L_do_copy\n" /* if (nbytes >= len) */ - -".align 32,0x90\n" -".L_do_copy:\n" -" movl %%eax, %%ecx\n" /* ecx = len */ -" rep movsb\n" - -" movq %%r8, %%rsi\n" /* move in back to %esi, toss from */ -" jmp .L_while_test\n" - -".L_test_for_end_of_block:\n" -" testb $32, %%al\n" -" jz .L_invalid_literal_length_code\n" -" movl $1, 116(%%rsp)\n" -" jmp .L_break_loop_with_status\n" - -".L_invalid_literal_length_code:\n" -" movl $2, 116(%%rsp)\n" -" jmp .L_break_loop_with_status\n" - -".L_invalid_distance_code:\n" -" movl $3, 116(%%rsp)\n" -" jmp .L_break_loop_with_status\n" - -".L_invalid_distance_too_far:\n" -" movl $4, 116(%%rsp)\n" -" jmp .L_break_loop_with_status\n" - -".L_break_loop:\n" -" movl $0, 116(%%rsp)\n" - -".L_break_loop_with_status:\n" -/* put in, out, bits, and hold back into ar and pop esp */ -" movq %%rsi, 16(%%rsp)\n" /* in */ -" movq %%rdi, 32(%%rsp)\n" /* out */ -" movl %%ebx, 88(%%rsp)\n" /* bits */ -" movq %%rdx, 80(%%rsp)\n" /* hold */ -" movq (%%rsp), %%rax\n" /* restore rbp and rsp */ -" movq 8(%%rsp), %%rbp\n" -" movq %%rax, %%rsp\n" - : - : "m" (ar) - : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", - "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" - ); -#elif ( defined( __GNUC__ ) || defined( __ICC ) ) && defined( __i386 ) - __asm__ __volatile__ ( -" leal %0, %%eax\n" -" movl %%esp, (%%eax)\n" /* save esp, ebp */ -" movl %%ebp, 4(%%eax)\n" -" movl %%eax, %%esp\n" -" movl 8(%%esp), %%esi\n" /* esi = in */ -" movl 16(%%esp), %%edi\n" /* edi = out */ -" movl 40(%%esp), %%edx\n" /* edx = hold */ -" movl 44(%%esp), %%ebx\n" /* ebx = bits */ -" movl 32(%%esp), %%ebp\n" /* ebp = lcode */ - -" cld\n" -" jmp .L_do_loop\n" - -".align 32,0x90\n" -".L_while_test:\n" -" cmpl %%edi, 24(%%esp)\n" /* out < end */ -" jbe .L_break_loop\n" -" cmpl %%esi, 12(%%esp)\n" /* in < last */ -" jbe .L_break_loop\n" - -".L_do_loop:\n" -" cmpb $15, %%bl\n" -" ja .L_get_length_code\n" /* if (15 < bits) */ - -" xorl %%eax, %%eax\n" -" lodsw\n" /* al = *(ushort *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $16, %%bl\n" /* bits += 16 */ -" shll %%cl, %%eax\n" -" orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */ - -".L_get_length_code:\n" -" movl 56(%%esp), %%eax\n" /* eax = lmask */ -" andl %%edx, %%eax\n" /* eax &= hold */ -" movl (%%ebp,%%eax,4), %%eax\n" /* eax = lcode[hold & lmask] */ - -".L_dolen:\n" -" movb %%ah, %%cl\n" /* cl = this.bits */ -" subb %%ah, %%bl\n" /* bits -= this.bits */ -" shrl %%cl, %%edx\n" /* hold >>= this.bits */ - -" testb %%al, %%al\n" -" jnz .L_test_for_length_base\n" /* if (op != 0) 45.7% */ - -" shrl $16, %%eax\n" /* output this.val char */ -" stosb\n" -" jmp .L_while_test\n" - -".align 32,0x90\n" -".L_test_for_length_base:\n" -" movl %%eax, %%ecx\n" /* len = this */ -" shrl $16, %%ecx\n" /* len = this.val */ -" movl %%ecx, 64(%%esp)\n" /* save len */ -" movb %%al, %%cl\n" - -" testb $16, %%al\n" -" jz .L_test_for_second_level_length\n" /* if ((op & 16) == 0) 8% */ -" andb $15, %%cl\n" /* op &= 15 */ -" jz .L_decode_distance\n" /* if (!op) */ -" cmpb %%cl, %%bl\n" -" jae .L_add_bits_to_len\n" /* if (op <= bits) */ - -" movb %%cl, %%ch\n" /* stash op in ch, freeing cl */ -" xorl %%eax, %%eax\n" -" lodsw\n" /* al = *(ushort *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $16, %%bl\n" /* bits += 16 */ -" shll %%cl, %%eax\n" -" orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */ -" movb %%ch, %%cl\n" /* move op back to ecx */ - -".L_add_bits_to_len:\n" -" subb %%cl, %%bl\n" -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" -" andl %%edx, %%eax\n" /* eax &= hold */ -" shrl %%cl, %%edx\n" -" addl %%eax, 64(%%esp)\n" /* len += hold & mask[op] */ - -".L_decode_distance:\n" -" cmpb $15, %%bl\n" -" ja .L_get_distance_code\n" /* if (15 < bits) */ - -" xorl %%eax, %%eax\n" -" lodsw\n" /* al = *(ushort *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $16, %%bl\n" /* bits += 16 */ -" shll %%cl, %%eax\n" -" orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */ - -".L_get_distance_code:\n" -" movl 60(%%esp), %%eax\n" /* eax = dmask */ -" movl 36(%%esp), %%ecx\n" /* ecx = dcode */ -" andl %%edx, %%eax\n" /* eax &= hold */ -" movl (%%ecx,%%eax,4), %%eax\n"/* eax = dcode[hold & dmask] */ - -".L_dodist:\n" -" movl %%eax, %%ebp\n" /* dist = this */ -" shrl $16, %%ebp\n" /* dist = this.val */ -" movb %%ah, %%cl\n" -" subb %%ah, %%bl\n" /* bits -= this.bits */ -" shrl %%cl, %%edx\n" /* hold >>= this.bits */ -" movb %%al, %%cl\n" /* cl = this.op */ - -" testb $16, %%al\n" /* if ((op & 16) == 0) */ -" jz .L_test_for_second_level_dist\n" -" andb $15, %%cl\n" /* op &= 15 */ -" jz .L_check_dist_one\n" -" cmpb %%cl, %%bl\n" -" jae .L_add_bits_to_dist\n" /* if (op <= bits) 97.6% */ - -" movb %%cl, %%ch\n" /* stash op in ch, freeing cl */ -" xorl %%eax, %%eax\n" -" lodsw\n" /* al = *(ushort *)in++ */ -" movb %%bl, %%cl\n" /* cl = bits, needs it for shifting */ -" addb $16, %%bl\n" /* bits += 16 */ -" shll %%cl, %%eax\n" -" orl %%eax, %%edx\n" /* hold |= *((ushort *)in)++ << bits */ -" movb %%ch, %%cl\n" /* move op back to ecx */ - -".L_add_bits_to_dist:\n" -" subb %%cl, %%bl\n" -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" /* (1 << op) - 1 */ -" andl %%edx, %%eax\n" /* eax &= hold */ -" shrl %%cl, %%edx\n" -" addl %%eax, %%ebp\n" /* dist += hold & ((1 << op) - 1) */ - -".L_check_window:\n" -" movl %%esi, 8(%%esp)\n" /* save in so from can use it's reg */ -" movl %%edi, %%eax\n" -" subl 20(%%esp), %%eax\n" /* nbytes = out - beg */ - -" cmpl %%ebp, %%eax\n" -" jb .L_clip_window\n" /* if (dist > nbytes) 4.2% */ - -" movl 64(%%esp), %%ecx\n" /* ecx = len */ -" movl %%edi, %%esi\n" -" subl %%ebp, %%esi\n" /* from = out - dist */ - -" sarl %%ecx\n" -" jnc .L_copy_two\n" /* if len % 2 == 0 */ - -" rep movsw\n" -" movb (%%esi), %%al\n" -" movb %%al, (%%edi)\n" -" incl %%edi\n" - -" movl 8(%%esp), %%esi\n" /* move in back to %esi, toss from */ -" movl 32(%%esp), %%ebp\n" /* ebp = lcode */ -" jmp .L_while_test\n" - -".L_copy_two:\n" -" rep movsw\n" -" movl 8(%%esp), %%esi\n" /* move in back to %esi, toss from */ -" movl 32(%%esp), %%ebp\n" /* ebp = lcode */ -" jmp .L_while_test\n" - -".align 32,0x90\n" -".L_check_dist_one:\n" -" cmpl $1, %%ebp\n" /* if dist 1, is a memset */ -" jne .L_check_window\n" -" cmpl %%edi, 20(%%esp)\n" -" je .L_check_window\n" /* out == beg, if outside window */ - -" movl 64(%%esp), %%ecx\n" /* ecx = len */ -" movb -1(%%edi), %%al\n" -" movb %%al, %%ah\n" - -" sarl %%ecx\n" -" jnc .L_set_two\n" -" movb %%al, (%%edi)\n" -" incl %%edi\n" - -".L_set_two:\n" -" rep stosw\n" -" movl 32(%%esp), %%ebp\n" /* ebp = lcode */ -" jmp .L_while_test\n" - -".align 32,0x90\n" -".L_test_for_second_level_length:\n" -" testb $64, %%al\n" -" jnz .L_test_for_end_of_block\n" /* if ((op & 64) != 0) */ - -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" -" andl %%edx, %%eax\n" /* eax &= hold */ -" addl 64(%%esp), %%eax\n" /* eax += len */ -" movl (%%ebp,%%eax,4), %%eax\n" /* eax = lcode[val+(hold&mask[op])]*/ -" jmp .L_dolen\n" - -".align 32,0x90\n" -".L_test_for_second_level_dist:\n" -" testb $64, %%al\n" -" jnz .L_invalid_distance_code\n" /* if ((op & 64) != 0) */ - -" xorl %%eax, %%eax\n" -" incl %%eax\n" -" shll %%cl, %%eax\n" -" decl %%eax\n" -" andl %%edx, %%eax\n" /* eax &= hold */ -" addl %%ebp, %%eax\n" /* eax += dist */ -" movl 36(%%esp), %%ecx\n" /* ecx = dcode */ -" movl (%%ecx,%%eax,4), %%eax\n" /* eax = dcode[val+(hold&mask[op])]*/ -" jmp .L_dodist\n" - -".align 32,0x90\n" -".L_clip_window:\n" -" movl %%eax, %%ecx\n" -" movl 48(%%esp), %%eax\n" /* eax = wsize */ -" negl %%ecx\n" /* nbytes = -nbytes */ -" movl 28(%%esp), %%esi\n" /* from = window */ - -" cmpl %%ebp, %%eax\n" -" jb .L_invalid_distance_too_far\n" /* if (dist > wsize) */ - -" addl %%ebp, %%ecx\n" /* nbytes = dist - nbytes */ -" cmpl $0, 52(%%esp)\n" -" jne .L_wrap_around_window\n" /* if (write != 0) */ - -" subl %%ecx, %%eax\n" -" addl %%eax, %%esi\n" /* from += wsize - nbytes */ - -" movl 64(%%esp), %%eax\n" /* eax = len */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movl %%edi, %%esi\n" -" subl %%ebp, %%esi\n" /* from = out - dist */ -" jmp .L_do_copy\n" - -".align 32,0x90\n" -".L_wrap_around_window:\n" -" movl 52(%%esp), %%eax\n" /* eax = write */ -" cmpl %%eax, %%ecx\n" -" jbe .L_contiguous_in_window\n" /* if (write >= nbytes) */ - -" addl 48(%%esp), %%esi\n" /* from += wsize */ -" addl %%eax, %%esi\n" /* from += write */ -" subl %%ecx, %%esi\n" /* from -= nbytes */ -" subl %%eax, %%ecx\n" /* nbytes -= write */ - -" movl 64(%%esp), %%eax\n" /* eax = len */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movl 28(%%esp), %%esi\n" /* from = window */ -" movl 52(%%esp), %%ecx\n" /* nbytes = write */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movl %%edi, %%esi\n" -" subl %%ebp, %%esi\n" /* from = out - dist */ -" jmp .L_do_copy\n" - -".align 32,0x90\n" -".L_contiguous_in_window:\n" -" addl %%eax, %%esi\n" -" subl %%ecx, %%esi\n" /* from += write - nbytes */ - -" movl 64(%%esp), %%eax\n" /* eax = len */ -" cmpl %%ecx, %%eax\n" -" jbe .L_do_copy\n" /* if (nbytes >= len) */ - -" subl %%ecx, %%eax\n" /* len -= nbytes */ -" rep movsb\n" -" movl %%edi, %%esi\n" -" subl %%ebp, %%esi\n" /* from = out - dist */ -" jmp .L_do_copy\n" /* if (nbytes >= len) */ - -".align 32,0x90\n" -".L_do_copy:\n" -" movl %%eax, %%ecx\n" -" rep movsb\n" - -" movl 8(%%esp), %%esi\n" /* move in back to %esi, toss from */ -" movl 32(%%esp), %%ebp\n" /* ebp = lcode */ -" jmp .L_while_test\n" - -".L_test_for_end_of_block:\n" -" testb $32, %%al\n" -" jz .L_invalid_literal_length_code\n" -" movl $1, 72(%%esp)\n" -" jmp .L_break_loop_with_status\n" - -".L_invalid_literal_length_code:\n" -" movl $2, 72(%%esp)\n" -" jmp .L_break_loop_with_status\n" - -".L_invalid_distance_code:\n" -" movl $3, 72(%%esp)\n" -" jmp .L_break_loop_with_status\n" - -".L_invalid_distance_too_far:\n" -" movl 8(%%esp), %%esi\n" -" movl $4, 72(%%esp)\n" -" jmp .L_break_loop_with_status\n" - -".L_break_loop:\n" -" movl $0, 72(%%esp)\n" - -".L_break_loop_with_status:\n" -/* put in, out, bits, and hold back into ar and pop esp */ -" movl %%esi, 8(%%esp)\n" /* save in */ -" movl %%edi, 16(%%esp)\n" /* save out */ -" movl %%ebx, 44(%%esp)\n" /* save bits */ -" movl %%edx, 40(%%esp)\n" /* save hold */ -" movl 4(%%esp), %%ebp\n" /* restore esp, ebp */ -" movl (%%esp), %%esp\n" - : - : "m" (ar) - : "memory", "%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi" - ); -#elif defined( _MSC_VER ) && ! defined( _M_AMD64 ) - __asm { - lea eax, ar - mov [eax], esp /* save esp, ebp */ - mov [eax+4], ebp - mov esp, eax - mov esi, [esp+8] /* esi = in */ - mov edi, [esp+16] /* edi = out */ - mov edx, [esp+40] /* edx = hold */ - mov ebx, [esp+44] /* ebx = bits */ - mov ebp, [esp+32] /* ebp = lcode */ - - cld - jmp L_do_loop - -ALIGN 4 -L_while_test: - cmp [esp+24], edi - jbe L_break_loop - cmp [esp+12], esi - jbe L_break_loop - -L_do_loop: - cmp bl, 15 - ja L_get_length_code /* if (15 < bits) */ - - xor eax, eax - lodsw /* al = *(ushort *)in++ */ - mov cl, bl /* cl = bits, needs it for shifting */ - add bl, 16 /* bits += 16 */ - shl eax, cl - or edx, eax /* hold |= *((ushort *)in)++ << bits */ - -L_get_length_code: - mov eax, [esp+56] /* eax = lmask */ - and eax, edx /* eax &= hold */ - mov eax, [ebp+eax*4] /* eax = lcode[hold & lmask] */ - -L_dolen: - mov cl, ah /* cl = this.bits */ - sub bl, ah /* bits -= this.bits */ - shr edx, cl /* hold >>= this.bits */ - - test al, al - jnz L_test_for_length_base /* if (op != 0) 45.7% */ - - shr eax, 16 /* output this.val char */ - stosb - jmp L_while_test - -ALIGN 4 -L_test_for_length_base: - mov ecx, eax /* len = this */ - shr ecx, 16 /* len = this.val */ - mov [esp+64], ecx /* save len */ - mov cl, al - - test al, 16 - jz L_test_for_second_level_length /* if ((op & 16) == 0) 8% */ - and cl, 15 /* op &= 15 */ - jz L_decode_distance /* if (!op) */ - cmp bl, cl - jae L_add_bits_to_len /* if (op <= bits) */ - - mov ch, cl /* stash op in ch, freeing cl */ - xor eax, eax - lodsw /* al = *(ushort *)in++ */ - mov cl, bl /* cl = bits, needs it for shifting */ - add bl, 16 /* bits += 16 */ - shl eax, cl - or edx, eax /* hold |= *((ushort *)in)++ << bits */ - mov cl, ch /* move op back to ecx */ - -L_add_bits_to_len: - sub bl, cl - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx /* eax &= hold */ - shr edx, cl - add [esp+64], eax /* len += hold & mask[op] */ - -L_decode_distance: - cmp bl, 15 - ja L_get_distance_code /* if (15 < bits) */ - - xor eax, eax - lodsw /* al = *(ushort *)in++ */ - mov cl, bl /* cl = bits, needs it for shifting */ - add bl, 16 /* bits += 16 */ - shl eax, cl - or edx, eax /* hold |= *((ushort *)in)++ << bits */ - -L_get_distance_code: - mov eax, [esp+60] /* eax = dmask */ - mov ecx, [esp+36] /* ecx = dcode */ - and eax, edx /* eax &= hold */ - mov eax, [ecx+eax*4]/* eax = dcode[hold & dmask] */ - -L_dodist: - mov ebp, eax /* dist = this */ - shr ebp, 16 /* dist = this.val */ - mov cl, ah - sub bl, ah /* bits -= this.bits */ - shr edx, cl /* hold >>= this.bits */ - mov cl, al /* cl = this.op */ - - test al, 16 /* if ((op & 16) == 0) */ - jz L_test_for_second_level_dist - and cl, 15 /* op &= 15 */ - jz L_check_dist_one - cmp bl, cl - jae L_add_bits_to_dist /* if (op <= bits) 97.6% */ - - mov ch, cl /* stash op in ch, freeing cl */ - xor eax, eax - lodsw /* al = *(ushort *)in++ */ - mov cl, bl /* cl = bits, needs it for shifting */ - add bl, 16 /* bits += 16 */ - shl eax, cl - or edx, eax /* hold |= *((ushort *)in)++ << bits */ - mov cl, ch /* move op back to ecx */ - -L_add_bits_to_dist: - sub bl, cl - xor eax, eax - inc eax - shl eax, cl - dec eax /* (1 << op) - 1 */ - and eax, edx /* eax &= hold */ - shr edx, cl - add ebp, eax /* dist += hold & ((1 << op) - 1) */ - -L_check_window: - mov [esp+8], esi /* save in so from can use it's reg */ - mov eax, edi - sub eax, [esp+20] /* nbytes = out - beg */ - - cmp eax, ebp - jb L_clip_window /* if (dist > nbytes) 4.2% */ - - mov ecx, [esp+64] /* ecx = len */ - mov esi, edi - sub esi, ebp /* from = out - dist */ - - sar ecx, 1 - jnc L_copy_two - - rep movsw - mov al, [esi] - mov [edi], al - inc edi - - mov esi, [esp+8] /* move in back to %esi, toss from */ - mov ebp, [esp+32] /* ebp = lcode */ - jmp L_while_test - -L_copy_two: - rep movsw - mov esi, [esp+8] /* move in back to %esi, toss from */ - mov ebp, [esp+32] /* ebp = lcode */ - jmp L_while_test - -ALIGN 4 -L_check_dist_one: - cmp ebp, 1 /* if dist 1, is a memset */ - jne L_check_window - cmp [esp+20], edi - je L_check_window /* out == beg, if outside window */ - - mov ecx, [esp+64] /* ecx = len */ - mov al, [edi-1] - mov ah, al - - sar ecx, 1 - jnc L_set_two - mov [edi], al /* memset out with from[-1] */ - inc edi - -L_set_two: - rep stosw - mov ebp, [esp+32] /* ebp = lcode */ - jmp L_while_test - -ALIGN 4 -L_test_for_second_level_length: - test al, 64 - jnz L_test_for_end_of_block /* if ((op & 64) != 0) */ - - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx /* eax &= hold */ - add eax, [esp+64] /* eax += len */ - mov eax, [ebp+eax*4] /* eax = lcode[val+(hold&mask[op])]*/ - jmp L_dolen - -ALIGN 4 -L_test_for_second_level_dist: - test al, 64 - jnz L_invalid_distance_code /* if ((op & 64) != 0) */ - - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx /* eax &= hold */ - add eax, ebp /* eax += dist */ - mov ecx, [esp+36] /* ecx = dcode */ - mov eax, [ecx+eax*4] /* eax = dcode[val+(hold&mask[op])]*/ - jmp L_dodist - -ALIGN 4 -L_clip_window: - mov ecx, eax - mov eax, [esp+48] /* eax = wsize */ - neg ecx /* nbytes = -nbytes */ - mov esi, [esp+28] /* from = window */ - - cmp eax, ebp - jb L_invalid_distance_too_far /* if (dist > wsize) */ - - add ecx, ebp /* nbytes = dist - nbytes */ - cmp dword ptr [esp+52], 0 - jne L_wrap_around_window /* if (write != 0) */ - - sub eax, ecx - add esi, eax /* from += wsize - nbytes */ - - mov eax, [esp+64] /* eax = len */ - cmp eax, ecx - jbe L_do_copy /* if (nbytes >= len) */ - - sub eax, ecx /* len -= nbytes */ - rep movsb - mov esi, edi - sub esi, ebp /* from = out - dist */ - jmp L_do_copy - -ALIGN 4 -L_wrap_around_window: - mov eax, [esp+52] /* eax = write */ - cmp ecx, eax - jbe L_contiguous_in_window /* if (write >= nbytes) */ - - add esi, [esp+48] /* from += wsize */ - add esi, eax /* from += write */ - sub esi, ecx /* from -= nbytes */ - sub ecx, eax /* nbytes -= write */ - - mov eax, [esp+64] /* eax = len */ - cmp eax, ecx - jbe L_do_copy /* if (nbytes >= len) */ - - sub eax, ecx /* len -= nbytes */ - rep movsb - mov esi, [esp+28] /* from = window */ - mov ecx, [esp+52] /* nbytes = write */ - cmp eax, ecx - jbe L_do_copy /* if (nbytes >= len) */ - - sub eax, ecx /* len -= nbytes */ - rep movsb - mov esi, edi - sub esi, ebp /* from = out - dist */ - jmp L_do_copy - -ALIGN 4 -L_contiguous_in_window: - add esi, eax - sub esi, ecx /* from += write - nbytes */ - - mov eax, [esp+64] /* eax = len */ - cmp eax, ecx - jbe L_do_copy /* if (nbytes >= len) */ - - sub eax, ecx /* len -= nbytes */ - rep movsb - mov esi, edi - sub esi, ebp /* from = out - dist */ - jmp L_do_copy - -ALIGN 4 -L_do_copy: - mov ecx, eax - rep movsb - - mov esi, [esp+8] /* move in back to %esi, toss from */ - mov ebp, [esp+32] /* ebp = lcode */ - jmp L_while_test - -L_test_for_end_of_block: - test al, 32 - jz L_invalid_literal_length_code - mov dword ptr [esp+72], 1 - jmp L_break_loop_with_status - -L_invalid_literal_length_code: - mov dword ptr [esp+72], 2 - jmp L_break_loop_with_status - -L_invalid_distance_code: - mov dword ptr [esp+72], 3 - jmp L_break_loop_with_status - -L_invalid_distance_too_far: - mov esi, [esp+4] - mov dword ptr [esp+72], 4 - jmp L_break_loop_with_status - -L_break_loop: - mov dword ptr [esp+72], 0 - -L_break_loop_with_status: -/* put in, out, bits, and hold back into ar and pop esp */ - mov [esp+8], esi /* save in */ - mov [esp+16], edi /* save out */ - mov [esp+44], ebx /* save bits */ - mov [esp+40], edx /* save hold */ - mov ebp, [esp+4] /* restore esp, ebp */ - mov esp, [esp] - } -#else -#error "x86 architecture not defined" -#endif - - if (ar.status > 1) { - if (ar.status == 2) - strm->msg = "invalid literal/length code"; - else if (ar.status == 3) - strm->msg = "invalid distance code"; - else - strm->msg = "invalid distance too far back"; - state->mode = BAD; - } - else if ( ar.status == 1 ) { - state->mode = TYPE; - } - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - ar.len = ar.bits >> 3; - ar.in -= ar.len; - ar.bits -= ar.len << 3; - ar.hold &= (1U << ar.bits) - 1; - - /* update state and return */ - strm->next_in = ar.in; - strm->next_out = ar.out; - strm->avail_in = (unsigned)(ar.in < ar.last ? - PAD_AVAIL_IN + (ar.last - ar.in) : - PAD_AVAIL_IN - (ar.in - ar.last)); - strm->avail_out = (unsigned)(ar.out < ar.end ? - PAD_AVAIL_OUT + (ar.end - ar.out) : - PAD_AVAIL_OUT - (ar.out - ar.end)); - state->hold = ar.hold; - state->bits = ar.bits; - return; -} - diff --git a/compat/zlib/contrib/inflate86/inffast.S b/compat/zlib/contrib/inflate86/inffast.S deleted file mode 100644 index 2245a29..0000000 --- a/compat/zlib/contrib/inflate86/inffast.S +++ /dev/null @@ -1,1368 +0,0 @@ -/* - * inffast.S is a hand tuned assembler version of: - * - * inffast.c -- fast decoding - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Copyright (C) 2003 Chris Anderson - * Please use the copyright conditions above. - * - * This version (Jan-23-2003) of inflate_fast was coded and tested under - * GNU/Linux on a pentium 3, using the gcc-3.2 compiler distribution. On that - * machine, I found that gzip style archives decompressed about 20% faster than - * the gcc-3.2 -O3 -fomit-frame-pointer compiled version. Your results will - * depend on how large of a buffer is used for z_stream.next_in & next_out - * (8K-32K worked best for my 256K cpu cache) and how much overhead there is in - * stream processing I/O and crc32/addler32. In my case, this routine used - * 70% of the cpu time and crc32 used 20%. - * - * I am confident that this version will work in the general case, but I have - * not tested a wide variety of datasets or a wide variety of platforms. - * - * Jan-24-2003 -- Added -DUSE_MMX define for slightly faster inflating. - * It should be a runtime flag instead of compile time flag... - * - * Jan-26-2003 -- Added runtime check for MMX support with cpuid instruction. - * With -DUSE_MMX, only MMX code is compiled. With -DNO_MMX, only non-MMX code - * is compiled. Without either option, runtime detection is enabled. Runtime - * detection should work on all modern cpus and the recomended algorithm (flip - * ID bit on eflags and then use the cpuid instruction) is used in many - * multimedia applications. Tested under win2k with gcc-2.95 and gas-2.12 - * distributed with cygwin3. Compiling with gcc-2.95 -c inffast.S -o - * inffast.obj generates a COFF object which can then be linked with MSVC++ - * compiled code. Tested under FreeBSD 4.7 with gcc-2.95. - * - * Jan-28-2003 -- Tested Athlon XP... MMX mode is slower than no MMX (and - * slower than compiler generated code). Adjusted cpuid check to use the MMX - * code only for Pentiums < P4 until I have more data on the P4. Speed - * improvment is only about 15% on the Athlon when compared with code generated - * with MSVC++. Not sure yet, but I think the P4 will also be slower using the - * MMX mode because many of it's x86 ALU instructions execute in .5 cycles and - * have less latency than MMX ops. Added code to buffer the last 11 bytes of - * the input stream since the MMX code grabs bits in chunks of 32, which - * differs from the inffast.c algorithm. I don't think there would have been - * read overruns where a page boundary was crossed (a segfault), but there - * could have been overruns when next_in ends on unaligned memory (unintialized - * memory read). - * - * Mar-13-2003 -- P4 MMX is slightly slower than P4 NO_MMX. I created a C - * version of the non-MMX code so that it doesn't depend on zstrm and zstate - * structure offsets which are hard coded in this file. This was last tested - * with zlib-1.2.0 which is currently in beta testing, newer versions of this - * and inffas86.c can be found at http://www.eetbeetee.com/zlib/ and - * http://www.charm.net/~christop/zlib/ - */ - - -/* - * if you have underscore linking problems (_inflate_fast undefined), try - * using -DGAS_COFF - */ -#if ! defined( GAS_COFF ) && ! defined( GAS_ELF ) - -#if defined( WIN32 ) || defined( __CYGWIN__ ) -#define GAS_COFF /* windows object format */ -#else -#define GAS_ELF -#endif - -#endif /* ! GAS_COFF && ! GAS_ELF */ - - -#if defined( GAS_COFF ) - -/* coff externals have underscores */ -#define inflate_fast _inflate_fast -#define inflate_fast_use_mmx _inflate_fast_use_mmx - -#endif /* GAS_COFF */ - - -.file "inffast.S" - -.globl inflate_fast - -.text -.align 4,0 -.L_invalid_literal_length_code_msg: -.string "invalid literal/length code" - -.align 4,0 -.L_invalid_distance_code_msg: -.string "invalid distance code" - -.align 4,0 -.L_invalid_distance_too_far_msg: -.string "invalid distance too far back" - -#if ! defined( NO_MMX ) -.align 4,0 -.L_mask: /* mask[N] = ( 1 << N ) - 1 */ -.long 0 -.long 1 -.long 3 -.long 7 -.long 15 -.long 31 -.long 63 -.long 127 -.long 255 -.long 511 -.long 1023 -.long 2047 -.long 4095 -.long 8191 -.long 16383 -.long 32767 -.long 65535 -.long 131071 -.long 262143 -.long 524287 -.long 1048575 -.long 2097151 -.long 4194303 -.long 8388607 -.long 16777215 -.long 33554431 -.long 67108863 -.long 134217727 -.long 268435455 -.long 536870911 -.long 1073741823 -.long 2147483647 -.long 4294967295 -#endif /* NO_MMX */ - -.text - -/* - * struct z_stream offsets, in zlib.h - */ -#define next_in_strm 0 /* strm->next_in */ -#define avail_in_strm 4 /* strm->avail_in */ -#define next_out_strm 12 /* strm->next_out */ -#define avail_out_strm 16 /* strm->avail_out */ -#define msg_strm 24 /* strm->msg */ -#define state_strm 28 /* strm->state */ - -/* - * struct inflate_state offsets, in inflate.h - */ -#define mode_state 0 /* state->mode */ -#define wsize_state 32 /* state->wsize */ -#define write_state 40 /* state->write */ -#define window_state 44 /* state->window */ -#define hold_state 48 /* state->hold */ -#define bits_state 52 /* state->bits */ -#define lencode_state 68 /* state->lencode */ -#define distcode_state 72 /* state->distcode */ -#define lenbits_state 76 /* state->lenbits */ -#define distbits_state 80 /* state->distbits */ - -/* - * inflate_fast's activation record - */ -#define local_var_size 64 /* how much local space for vars */ -#define strm_sp 88 /* first arg: z_stream * (local_var_size + 24) */ -#define start_sp 92 /* second arg: unsigned int (local_var_size + 28) */ - -/* - * offsets for local vars on stack - */ -#define out 60 /* unsigned char* */ -#define window 56 /* unsigned char* */ -#define wsize 52 /* unsigned int */ -#define write 48 /* unsigned int */ -#define in 44 /* unsigned char* */ -#define beg 40 /* unsigned char* */ -#define buf 28 /* char[ 12 ] */ -#define len 24 /* unsigned int */ -#define last 20 /* unsigned char* */ -#define end 16 /* unsigned char* */ -#define dcode 12 /* code* */ -#define lcode 8 /* code* */ -#define dmask 4 /* unsigned int */ -#define lmask 0 /* unsigned int */ - -/* - * typedef enum inflate_mode consts, in inflate.h - */ -#define INFLATE_MODE_TYPE 11 /* state->mode flags enum-ed in inflate.h */ -#define INFLATE_MODE_BAD 26 - - -#if ! defined( USE_MMX ) && ! defined( NO_MMX ) - -#define RUN_TIME_MMX - -#define CHECK_MMX 1 -#define DO_USE_MMX 2 -#define DONT_USE_MMX 3 - -.globl inflate_fast_use_mmx - -.data - -.align 4,0 -inflate_fast_use_mmx: /* integer flag for run time control 1=check,2=mmx,3=no */ -.long CHECK_MMX - -#if defined( GAS_ELF ) -/* elf info */ -.type inflate_fast_use_mmx,@object -.size inflate_fast_use_mmx,4 -#endif - -#endif /* RUN_TIME_MMX */ - -#if defined( GAS_COFF ) -/* coff info: scl 2 = extern, type 32 = function */ -.def inflate_fast; .scl 2; .type 32; .endef -#endif - -.text - -.align 32,0x90 -inflate_fast: - pushl %edi - pushl %esi - pushl %ebp - pushl %ebx - pushf /* save eflags (strm_sp, state_sp assumes this is 32 bits) */ - subl $local_var_size, %esp - cld - -#define strm_r %esi -#define state_r %edi - - movl strm_sp(%esp), strm_r - movl state_strm(strm_r), state_r - - /* in = strm->next_in; - * out = strm->next_out; - * last = in + strm->avail_in - 11; - * beg = out - (start - strm->avail_out); - * end = out + (strm->avail_out - 257); - */ - movl avail_in_strm(strm_r), %edx - movl next_in_strm(strm_r), %eax - - addl %eax, %edx /* avail_in += next_in */ - subl $11, %edx /* avail_in -= 11 */ - - movl %eax, in(%esp) - movl %edx, last(%esp) - - movl start_sp(%esp), %ebp - movl avail_out_strm(strm_r), %ecx - movl next_out_strm(strm_r), %ebx - - subl %ecx, %ebp /* start -= avail_out */ - negl %ebp /* start = -start */ - addl %ebx, %ebp /* start += next_out */ - - subl $257, %ecx /* avail_out -= 257 */ - addl %ebx, %ecx /* avail_out += out */ - - movl %ebx, out(%esp) - movl %ebp, beg(%esp) - movl %ecx, end(%esp) - - /* wsize = state->wsize; - * write = state->write; - * window = state->window; - * hold = state->hold; - * bits = state->bits; - * lcode = state->lencode; - * dcode = state->distcode; - * lmask = ( 1 << state->lenbits ) - 1; - * dmask = ( 1 << state->distbits ) - 1; - */ - - movl lencode_state(state_r), %eax - movl distcode_state(state_r), %ecx - - movl %eax, lcode(%esp) - movl %ecx, dcode(%esp) - - movl $1, %eax - movl lenbits_state(state_r), %ecx - shll %cl, %eax - decl %eax - movl %eax, lmask(%esp) - - movl $1, %eax - movl distbits_state(state_r), %ecx - shll %cl, %eax - decl %eax - movl %eax, dmask(%esp) - - movl wsize_state(state_r), %eax - movl write_state(state_r), %ecx - movl window_state(state_r), %edx - - movl %eax, wsize(%esp) - movl %ecx, write(%esp) - movl %edx, window(%esp) - - movl hold_state(state_r), %ebp - movl bits_state(state_r), %ebx - -#undef strm_r -#undef state_r - -#define in_r %esi -#define from_r %esi -#define out_r %edi - - movl in(%esp), in_r - movl last(%esp), %ecx - cmpl in_r, %ecx - ja .L_align_long /* if in < last */ - - addl $11, %ecx /* ecx = &in[ avail_in ] */ - subl in_r, %ecx /* ecx = avail_in */ - movl $12, %eax - subl %ecx, %eax /* eax = 12 - avail_in */ - leal buf(%esp), %edi - rep movsb /* memcpy( buf, in, avail_in ) */ - movl %eax, %ecx - xorl %eax, %eax - rep stosb /* memset( &buf[ avail_in ], 0, 12 - avail_in ) */ - leal buf(%esp), in_r /* in = buf */ - movl in_r, last(%esp) /* last = in, do just one iteration */ - jmp .L_is_aligned - - /* align in_r on long boundary */ -.L_align_long: - testl $3, in_r - jz .L_is_aligned - xorl %eax, %eax - movb (in_r), %al - incl in_r - movl %ebx, %ecx - addl $8, %ebx - shll %cl, %eax - orl %eax, %ebp - jmp .L_align_long - -.L_is_aligned: - movl out(%esp), out_r - -#if defined( NO_MMX ) - jmp .L_do_loop -#endif - -#if defined( USE_MMX ) - jmp .L_init_mmx -#endif - -/*** Runtime MMX check ***/ - -#if defined( RUN_TIME_MMX ) -.L_check_mmx: - cmpl $DO_USE_MMX, inflate_fast_use_mmx - je .L_init_mmx - ja .L_do_loop /* > 2 */ - - pushl %eax - pushl %ebx - pushl %ecx - pushl %edx - pushf - movl (%esp), %eax /* copy eflags to eax */ - xorl $0x200000, (%esp) /* try toggling ID bit of eflags (bit 21) - * to see if cpu supports cpuid... - * ID bit method not supported by NexGen but - * bios may load a cpuid instruction and - * cpuid may be disabled on Cyrix 5-6x86 */ - popf - pushf - popl %edx /* copy new eflags to edx */ - xorl %eax, %edx /* test if ID bit is flipped */ - jz .L_dont_use_mmx /* not flipped if zero */ - xorl %eax, %eax - cpuid - cmpl $0x756e6547, %ebx /* check for GenuineIntel in ebx,ecx,edx */ - jne .L_dont_use_mmx - cmpl $0x6c65746e, %ecx - jne .L_dont_use_mmx - cmpl $0x49656e69, %edx - jne .L_dont_use_mmx - movl $1, %eax - cpuid /* get cpu features */ - shrl $8, %eax - andl $15, %eax - cmpl $6, %eax /* check for Pentium family, is 0xf for P4 */ - jne .L_dont_use_mmx - testl $0x800000, %edx /* test if MMX feature is set (bit 23) */ - jnz .L_use_mmx - jmp .L_dont_use_mmx -.L_use_mmx: - movl $DO_USE_MMX, inflate_fast_use_mmx - jmp .L_check_mmx_pop -.L_dont_use_mmx: - movl $DONT_USE_MMX, inflate_fast_use_mmx -.L_check_mmx_pop: - popl %edx - popl %ecx - popl %ebx - popl %eax - jmp .L_check_mmx -#endif - - -/*** Non-MMX code ***/ - -#if defined ( NO_MMX ) || defined( RUN_TIME_MMX ) - -#define hold_r %ebp -#define bits_r %bl -#define bitslong_r %ebx - -.align 32,0x90 -.L_while_test: - /* while (in < last && out < end) - */ - cmpl out_r, end(%esp) - jbe .L_break_loop /* if (out >= end) */ - - cmpl in_r, last(%esp) - jbe .L_break_loop - -.L_do_loop: - /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out - * - * do { - * if (bits < 15) { - * hold |= *((unsigned short *)in)++ << bits; - * bits += 16 - * } - * this = lcode[hold & lmask] - */ - cmpb $15, bits_r - ja .L_get_length_code /* if (15 < bits) */ - - xorl %eax, %eax - lodsw /* al = *(ushort *)in++ */ - movb bits_r, %cl /* cl = bits, needs it for shifting */ - addb $16, bits_r /* bits += 16 */ - shll %cl, %eax - orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ - -.L_get_length_code: - movl lmask(%esp), %edx /* edx = lmask */ - movl lcode(%esp), %ecx /* ecx = lcode */ - andl hold_r, %edx /* edx &= hold */ - movl (%ecx,%edx,4), %eax /* eax = lcode[hold & lmask] */ - -.L_dolen: - /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out - * - * dolen: - * bits -= this.bits; - * hold >>= this.bits - */ - movb %ah, %cl /* cl = this.bits */ - subb %ah, bits_r /* bits -= this.bits */ - shrl %cl, hold_r /* hold >>= this.bits */ - - /* check if op is a literal - * if (op == 0) { - * PUP(out) = this.val; - * } - */ - testb %al, %al - jnz .L_test_for_length_base /* if (op != 0) 45.7% */ - - shrl $16, %eax /* output this.val char */ - stosb - jmp .L_while_test - -.L_test_for_length_base: - /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out, %edx = len - * - * else if (op & 16) { - * len = this.val - * op &= 15 - * if (op) { - * if (op > bits) { - * hold |= *((unsigned short *)in)++ << bits; - * bits += 16 - * } - * len += hold & mask[op]; - * bits -= op; - * hold >>= op; - * } - */ -#define len_r %edx - movl %eax, len_r /* len = this */ - shrl $16, len_r /* len = this.val */ - movb %al, %cl - - testb $16, %al - jz .L_test_for_second_level_length /* if ((op & 16) == 0) 8% */ - andb $15, %cl /* op &= 15 */ - jz .L_save_len /* if (!op) */ - cmpb %cl, bits_r - jae .L_add_bits_to_len /* if (op <= bits) */ - - movb %cl, %ch /* stash op in ch, freeing cl */ - xorl %eax, %eax - lodsw /* al = *(ushort *)in++ */ - movb bits_r, %cl /* cl = bits, needs it for shifting */ - addb $16, bits_r /* bits += 16 */ - shll %cl, %eax - orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ - movb %ch, %cl /* move op back to ecx */ - -.L_add_bits_to_len: - movl $1, %eax - shll %cl, %eax - decl %eax - subb %cl, bits_r - andl hold_r, %eax /* eax &= hold */ - shrl %cl, hold_r - addl %eax, len_r /* len += hold & mask[op] */ - -.L_save_len: - movl len_r, len(%esp) /* save len */ -#undef len_r - -.L_decode_distance: - /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * - * if (bits < 15) { - * hold |= *((unsigned short *)in)++ << bits; - * bits += 16 - * } - * this = dcode[hold & dmask]; - * dodist: - * bits -= this.bits; - * hold >>= this.bits; - * op = this.op; - */ - - cmpb $15, bits_r - ja .L_get_distance_code /* if (15 < bits) */ - - xorl %eax, %eax - lodsw /* al = *(ushort *)in++ */ - movb bits_r, %cl /* cl = bits, needs it for shifting */ - addb $16, bits_r /* bits += 16 */ - shll %cl, %eax - orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ - -.L_get_distance_code: - movl dmask(%esp), %edx /* edx = dmask */ - movl dcode(%esp), %ecx /* ecx = dcode */ - andl hold_r, %edx /* edx &= hold */ - movl (%ecx,%edx,4), %eax /* eax = dcode[hold & dmask] */ - -#define dist_r %edx -.L_dodist: - movl %eax, dist_r /* dist = this */ - shrl $16, dist_r /* dist = this.val */ - movb %ah, %cl - subb %ah, bits_r /* bits -= this.bits */ - shrl %cl, hold_r /* hold >>= this.bits */ - - /* if (op & 16) { - * dist = this.val - * op &= 15 - * if (op > bits) { - * hold |= *((unsigned short *)in)++ << bits; - * bits += 16 - * } - * dist += hold & mask[op]; - * bits -= op; - * hold >>= op; - */ - movb %al, %cl /* cl = this.op */ - - testb $16, %al /* if ((op & 16) == 0) */ - jz .L_test_for_second_level_dist - andb $15, %cl /* op &= 15 */ - jz .L_check_dist_one - cmpb %cl, bits_r - jae .L_add_bits_to_dist /* if (op <= bits) 97.6% */ - - movb %cl, %ch /* stash op in ch, freeing cl */ - xorl %eax, %eax - lodsw /* al = *(ushort *)in++ */ - movb bits_r, %cl /* cl = bits, needs it for shifting */ - addb $16, bits_r /* bits += 16 */ - shll %cl, %eax - orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ - movb %ch, %cl /* move op back to ecx */ - -.L_add_bits_to_dist: - movl $1, %eax - shll %cl, %eax - decl %eax /* (1 << op) - 1 */ - subb %cl, bits_r - andl hold_r, %eax /* eax &= hold */ - shrl %cl, hold_r - addl %eax, dist_r /* dist += hold & ((1 << op) - 1) */ - jmp .L_check_window - -.L_check_window: - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes - * - * nbytes = out - beg; - * if (dist <= nbytes) { - * from = out - dist; - * do { - * PUP(out) = PUP(from); - * } while (--len > 0) { - * } - */ - - movl in_r, in(%esp) /* save in so from can use it's reg */ - movl out_r, %eax - subl beg(%esp), %eax /* nbytes = out - beg */ - - cmpl dist_r, %eax - jb .L_clip_window /* if (dist > nbytes) 4.2% */ - - movl len(%esp), %ecx - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - - subl $3, %ecx - movb (from_r), %al - movb %al, (out_r) - movb 1(from_r), %al - movb 2(from_r), %dl - addl $3, from_r - movb %al, 1(out_r) - movb %dl, 2(out_r) - addl $3, out_r - rep movsb - - movl in(%esp), in_r /* move in back to %esi, toss from */ - jmp .L_while_test - -.align 16,0x90 -.L_check_dist_one: - cmpl $1, dist_r - jne .L_check_window - cmpl out_r, beg(%esp) - je .L_check_window - - decl out_r - movl len(%esp), %ecx - movb (out_r), %al - subl $3, %ecx - - movb %al, 1(out_r) - movb %al, 2(out_r) - movb %al, 3(out_r) - addl $4, out_r - rep stosb - - jmp .L_while_test - -.align 16,0x90 -.L_test_for_second_level_length: - /* else if ((op & 64) == 0) { - * this = lcode[this.val + (hold & mask[op])]; - * } - */ - testb $64, %al - jnz .L_test_for_end_of_block /* if ((op & 64) != 0) */ - - movl $1, %eax - shll %cl, %eax - decl %eax - andl hold_r, %eax /* eax &= hold */ - addl %edx, %eax /* eax += this.val */ - movl lcode(%esp), %edx /* edx = lcode */ - movl (%edx,%eax,4), %eax /* eax = lcode[val + (hold&mask[op])] */ - jmp .L_dolen - -.align 16,0x90 -.L_test_for_second_level_dist: - /* else if ((op & 64) == 0) { - * this = dcode[this.val + (hold & mask[op])]; - * } - */ - testb $64, %al - jnz .L_invalid_distance_code /* if ((op & 64) != 0) */ - - movl $1, %eax - shll %cl, %eax - decl %eax - andl hold_r, %eax /* eax &= hold */ - addl %edx, %eax /* eax += this.val */ - movl dcode(%esp), %edx /* edx = dcode */ - movl (%edx,%eax,4), %eax /* eax = dcode[val + (hold&mask[op])] */ - jmp .L_dodist - -.align 16,0x90 -.L_clip_window: - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes - * - * else { - * if (dist > wsize) { - * invalid distance - * } - * from = window; - * nbytes = dist - nbytes; - * if (write == 0) { - * from += wsize - nbytes; - */ -#define nbytes_r %ecx - movl %eax, nbytes_r - movl wsize(%esp), %eax /* prepare for dist compare */ - negl nbytes_r /* nbytes = -nbytes */ - movl window(%esp), from_r /* from = window */ - - cmpl dist_r, %eax - jb .L_invalid_distance_too_far /* if (dist > wsize) */ - - addl dist_r, nbytes_r /* nbytes = dist - nbytes */ - cmpl $0, write(%esp) - jne .L_wrap_around_window /* if (write != 0) */ - - subl nbytes_r, %eax - addl %eax, from_r /* from += wsize - nbytes */ - - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes, %eax = len - * - * if (nbytes < len) { - * len -= nbytes; - * do { - * PUP(out) = PUP(from); - * } while (--nbytes); - * from = out - dist; - * } - * } - */ -#define len_r %eax - movl len(%esp), len_r - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1 - - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1 - -.L_wrap_around_window: - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes, %eax = write, %eax = len - * - * else if (write < nbytes) { - * from += wsize + write - nbytes; - * nbytes -= write; - * if (nbytes < len) { - * len -= nbytes; - * do { - * PUP(out) = PUP(from); - * } while (--nbytes); - * from = window; - * nbytes = write; - * if (nbytes < len) { - * len -= nbytes; - * do { - * PUP(out) = PUP(from); - * } while(--nbytes); - * from = out - dist; - * } - * } - * } - */ -#define write_r %eax - movl write(%esp), write_r - cmpl write_r, nbytes_r - jbe .L_contiguous_in_window /* if (write >= nbytes) */ - - addl wsize(%esp), from_r - addl write_r, from_r - subl nbytes_r, from_r /* from += wsize + write - nbytes */ - subl write_r, nbytes_r /* nbytes -= write */ -#undef write_r - - movl len(%esp), len_r - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl window(%esp), from_r /* from = window */ - movl write(%esp), nbytes_r /* nbytes = write */ - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1 - -.L_contiguous_in_window: - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes, %eax = write, %eax = len - * - * else { - * from += write - nbytes; - * if (nbytes < len) { - * len -= nbytes; - * do { - * PUP(out) = PUP(from); - * } while (--nbytes); - * from = out - dist; - * } - * } - */ -#define write_r %eax - addl write_r, from_r - subl nbytes_r, from_r /* from += write - nbytes */ -#undef write_r - - movl len(%esp), len_r - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - -.L_do_copy1: - /* regs: %esi = from, %esi = in, %ebp = hold, %bl = bits, %edi = out - * %eax = len - * - * while (len > 0) { - * PUP(out) = PUP(from); - * len--; - * } - * } - * } while (in < last && out < end); - */ -#undef nbytes_r -#define in_r %esi - movl len_r, %ecx - rep movsb - - movl in(%esp), in_r /* move in back to %esi, toss from */ - jmp .L_while_test - -#undef len_r -#undef dist_r - -#endif /* NO_MMX || RUN_TIME_MMX */ - - -/*** MMX code ***/ - -#if defined( USE_MMX ) || defined( RUN_TIME_MMX ) - -.align 32,0x90 -.L_init_mmx: - emms - -#undef bits_r -#undef bitslong_r -#define bitslong_r %ebp -#define hold_mm %mm0 - movd %ebp, hold_mm - movl %ebx, bitslong_r - -#define used_mm %mm1 -#define dmask2_mm %mm2 -#define lmask2_mm %mm3 -#define lmask_mm %mm4 -#define dmask_mm %mm5 -#define tmp_mm %mm6 - - movd lmask(%esp), lmask_mm - movq lmask_mm, lmask2_mm - movd dmask(%esp), dmask_mm - movq dmask_mm, dmask2_mm - pxor used_mm, used_mm - movl lcode(%esp), %ebx /* ebx = lcode */ - jmp .L_do_loop_mmx - -.align 32,0x90 -.L_while_test_mmx: - /* while (in < last && out < end) - */ - cmpl out_r, end(%esp) - jbe .L_break_loop /* if (out >= end) */ - - cmpl in_r, last(%esp) - jbe .L_break_loop - -.L_do_loop_mmx: - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - - cmpl $32, bitslong_r - ja .L_get_length_code_mmx /* if (32 < bits) */ - - movd bitslong_r, tmp_mm - movd (in_r), %mm7 - addl $4, in_r - psllq tmp_mm, %mm7 - addl $32, bitslong_r - por %mm7, hold_mm /* hold_mm |= *((uint *)in)++ << bits */ - -.L_get_length_code_mmx: - pand hold_mm, lmask_mm - movd lmask_mm, %eax - movq lmask2_mm, lmask_mm - movl (%ebx,%eax,4), %eax /* eax = lcode[hold & lmask] */ - -.L_dolen_mmx: - movzbl %ah, %ecx /* ecx = this.bits */ - movd %ecx, used_mm - subl %ecx, bitslong_r /* bits -= this.bits */ - - testb %al, %al - jnz .L_test_for_length_base_mmx /* if (op != 0) 45.7% */ - - shrl $16, %eax /* output this.val char */ - stosb - jmp .L_while_test_mmx - -.L_test_for_length_base_mmx: -#define len_r %edx - movl %eax, len_r /* len = this */ - shrl $16, len_r /* len = this.val */ - - testb $16, %al - jz .L_test_for_second_level_length_mmx /* if ((op & 16) == 0) 8% */ - andl $15, %eax /* op &= 15 */ - jz .L_decode_distance_mmx /* if (!op) */ - - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd %eax, used_mm - movd hold_mm, %ecx - subl %eax, bitslong_r - andl .L_mask(,%eax,4), %ecx - addl %ecx, len_r /* len += hold & mask[op] */ - -.L_decode_distance_mmx: - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - - cmpl $32, bitslong_r - ja .L_get_dist_code_mmx /* if (32 < bits) */ - - movd bitslong_r, tmp_mm - movd (in_r), %mm7 - addl $4, in_r - psllq tmp_mm, %mm7 - addl $32, bitslong_r - por %mm7, hold_mm /* hold_mm |= *((uint *)in)++ << bits */ - -.L_get_dist_code_mmx: - movl dcode(%esp), %ebx /* ebx = dcode */ - pand hold_mm, dmask_mm - movd dmask_mm, %eax - movq dmask2_mm, dmask_mm - movl (%ebx,%eax,4), %eax /* eax = dcode[hold & lmask] */ - -.L_dodist_mmx: -#define dist_r %ebx - movzbl %ah, %ecx /* ecx = this.bits */ - movl %eax, dist_r - shrl $16, dist_r /* dist = this.val */ - subl %ecx, bitslong_r /* bits -= this.bits */ - movd %ecx, used_mm - - testb $16, %al /* if ((op & 16) == 0) */ - jz .L_test_for_second_level_dist_mmx - andl $15, %eax /* op &= 15 */ - jz .L_check_dist_one_mmx - -.L_add_bits_to_dist_mmx: - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd %eax, used_mm /* save bit length of current op */ - movd hold_mm, %ecx /* get the next bits on input stream */ - subl %eax, bitslong_r /* bits -= op bits */ - andl .L_mask(,%eax,4), %ecx /* ecx = hold & mask[op] */ - addl %ecx, dist_r /* dist += hold & mask[op] */ - -.L_check_window_mmx: - movl in_r, in(%esp) /* save in so from can use it's reg */ - movl out_r, %eax - subl beg(%esp), %eax /* nbytes = out - beg */ - - cmpl dist_r, %eax - jb .L_clip_window_mmx /* if (dist > nbytes) 4.2% */ - - movl len_r, %ecx - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - - subl $3, %ecx - movb (from_r), %al - movb %al, (out_r) - movb 1(from_r), %al - movb 2(from_r), %dl - addl $3, from_r - movb %al, 1(out_r) - movb %dl, 2(out_r) - addl $3, out_r - rep movsb - - movl in(%esp), in_r /* move in back to %esi, toss from */ - movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */ - jmp .L_while_test_mmx - -.align 16,0x90 -.L_check_dist_one_mmx: - cmpl $1, dist_r - jne .L_check_window_mmx - cmpl out_r, beg(%esp) - je .L_check_window_mmx - - decl out_r - movl len_r, %ecx - movb (out_r), %al - subl $3, %ecx - - movb %al, 1(out_r) - movb %al, 2(out_r) - movb %al, 3(out_r) - addl $4, out_r - rep stosb - - movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */ - jmp .L_while_test_mmx - -.align 16,0x90 -.L_test_for_second_level_length_mmx: - testb $64, %al - jnz .L_test_for_end_of_block /* if ((op & 64) != 0) */ - - andl $15, %eax - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd hold_mm, %ecx - andl .L_mask(,%eax,4), %ecx - addl len_r, %ecx - movl (%ebx,%ecx,4), %eax /* eax = lcode[hold & lmask] */ - jmp .L_dolen_mmx - -.align 16,0x90 -.L_test_for_second_level_dist_mmx: - testb $64, %al - jnz .L_invalid_distance_code /* if ((op & 64) != 0) */ - - andl $15, %eax - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd hold_mm, %ecx - andl .L_mask(,%eax,4), %ecx - movl dcode(%esp), %eax /* ecx = dcode */ - addl dist_r, %ecx - movl (%eax,%ecx,4), %eax /* eax = lcode[hold & lmask] */ - jmp .L_dodist_mmx - -.align 16,0x90 -.L_clip_window_mmx: -#define nbytes_r %ecx - movl %eax, nbytes_r - movl wsize(%esp), %eax /* prepare for dist compare */ - negl nbytes_r /* nbytes = -nbytes */ - movl window(%esp), from_r /* from = window */ - - cmpl dist_r, %eax - jb .L_invalid_distance_too_far /* if (dist > wsize) */ - - addl dist_r, nbytes_r /* nbytes = dist - nbytes */ - cmpl $0, write(%esp) - jne .L_wrap_around_window_mmx /* if (write != 0) */ - - subl nbytes_r, %eax - addl %eax, from_r /* from += wsize - nbytes */ - - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1_mmx - - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1_mmx - -.L_wrap_around_window_mmx: -#define write_r %eax - movl write(%esp), write_r - cmpl write_r, nbytes_r - jbe .L_contiguous_in_window_mmx /* if (write >= nbytes) */ - - addl wsize(%esp), from_r - addl write_r, from_r - subl nbytes_r, from_r /* from += wsize + write - nbytes */ - subl write_r, nbytes_r /* nbytes -= write */ -#undef write_r - - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl window(%esp), from_r /* from = window */ - movl write(%esp), nbytes_r /* nbytes = write */ - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1_mmx - -.L_contiguous_in_window_mmx: -#define write_r %eax - addl write_r, from_r - subl nbytes_r, from_r /* from += write - nbytes */ -#undef write_r - - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - -.L_do_copy1_mmx: -#undef nbytes_r -#define in_r %esi - movl len_r, %ecx - rep movsb - - movl in(%esp), in_r /* move in back to %esi, toss from */ - movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */ - jmp .L_while_test_mmx - -#undef hold_r -#undef bitslong_r - -#endif /* USE_MMX || RUN_TIME_MMX */ - - -/*** USE_MMX, NO_MMX, and RUNTIME_MMX from here on ***/ - -.L_invalid_distance_code: - /* else { - * strm->msg = "invalid distance code"; - * state->mode = BAD; - * } - */ - movl $.L_invalid_distance_code_msg, %ecx - movl $INFLATE_MODE_BAD, %edx - jmp .L_update_stream_state - -.L_test_for_end_of_block: - /* else if (op & 32) { - * state->mode = TYPE; - * break; - * } - */ - testb $32, %al - jz .L_invalid_literal_length_code /* if ((op & 32) == 0) */ - - movl $0, %ecx - movl $INFLATE_MODE_TYPE, %edx - jmp .L_update_stream_state - -.L_invalid_literal_length_code: - /* else { - * strm->msg = "invalid literal/length code"; - * state->mode = BAD; - * } - */ - movl $.L_invalid_literal_length_code_msg, %ecx - movl $INFLATE_MODE_BAD, %edx - jmp .L_update_stream_state - -.L_invalid_distance_too_far: - /* strm->msg = "invalid distance too far back"; - * state->mode = BAD; - */ - movl in(%esp), in_r /* from_r has in's reg, put in back */ - movl $.L_invalid_distance_too_far_msg, %ecx - movl $INFLATE_MODE_BAD, %edx - jmp .L_update_stream_state - -.L_update_stream_state: - /* set strm->msg = %ecx, strm->state->mode = %edx */ - movl strm_sp(%esp), %eax - testl %ecx, %ecx /* if (msg != NULL) */ - jz .L_skip_msg - movl %ecx, msg_strm(%eax) /* strm->msg = msg */ -.L_skip_msg: - movl state_strm(%eax), %eax /* state = strm->state */ - movl %edx, mode_state(%eax) /* state->mode = edx (BAD | TYPE) */ - jmp .L_break_loop - -.align 32,0x90 -.L_break_loop: - -/* - * Regs: - * - * bits = %ebp when mmx, and in %ebx when non-mmx - * hold = %hold_mm when mmx, and in %ebp when non-mmx - * in = %esi - * out = %edi - */ - -#if defined( USE_MMX ) || defined( RUN_TIME_MMX ) - -#if defined( RUN_TIME_MMX ) - - cmpl $DO_USE_MMX, inflate_fast_use_mmx - jne .L_update_next_in - -#endif /* RUN_TIME_MMX */ - - movl %ebp, %ebx - -.L_update_next_in: - -#endif - -#define strm_r %eax -#define state_r %edx - - /* len = bits >> 3; - * in -= len; - * bits -= len << 3; - * hold &= (1U << bits) - 1; - * state->hold = hold; - * state->bits = bits; - * strm->next_in = in; - * strm->next_out = out; - */ - movl strm_sp(%esp), strm_r - movl %ebx, %ecx - movl state_strm(strm_r), state_r - shrl $3, %ecx - subl %ecx, in_r - shll $3, %ecx - subl %ecx, %ebx - movl out_r, next_out_strm(strm_r) - movl %ebx, bits_state(state_r) - movl %ebx, %ecx - - leal buf(%esp), %ebx - cmpl %ebx, last(%esp) - jne .L_buf_not_used /* if buf != last */ - - subl %ebx, in_r /* in -= buf */ - movl next_in_strm(strm_r), %ebx - movl %ebx, last(%esp) /* last = strm->next_in */ - addl %ebx, in_r /* in += strm->next_in */ - movl avail_in_strm(strm_r), %ebx - subl $11, %ebx - addl %ebx, last(%esp) /* last = &strm->next_in[ avail_in - 11 ] */ - -.L_buf_not_used: - movl in_r, next_in_strm(strm_r) - - movl $1, %ebx - shll %cl, %ebx - decl %ebx - -#if defined( USE_MMX ) || defined( RUN_TIME_MMX ) - -#if defined( RUN_TIME_MMX ) - - cmpl $DO_USE_MMX, inflate_fast_use_mmx - jne .L_update_hold - -#endif /* RUN_TIME_MMX */ - - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd hold_mm, %ebp - - emms - -.L_update_hold: - -#endif /* USE_MMX || RUN_TIME_MMX */ - - andl %ebx, %ebp - movl %ebp, hold_state(state_r) - -#define last_r %ebx - - /* strm->avail_in = in < last ? 11 + (last - in) : 11 - (in - last) */ - movl last(%esp), last_r - cmpl in_r, last_r - jbe .L_last_is_smaller /* if (in >= last) */ - - subl in_r, last_r /* last -= in */ - addl $11, last_r /* last += 11 */ - movl last_r, avail_in_strm(strm_r) - jmp .L_fixup_out -.L_last_is_smaller: - subl last_r, in_r /* in -= last */ - negl in_r /* in = -in */ - addl $11, in_r /* in += 11 */ - movl in_r, avail_in_strm(strm_r) - -#undef last_r -#define end_r %ebx - -.L_fixup_out: - /* strm->avail_out = out < end ? 257 + (end - out) : 257 - (out - end)*/ - movl end(%esp), end_r - cmpl out_r, end_r - jbe .L_end_is_smaller /* if (out >= end) */ - - subl out_r, end_r /* end -= out */ - addl $257, end_r /* end += 257 */ - movl end_r, avail_out_strm(strm_r) - jmp .L_done -.L_end_is_smaller: - subl end_r, out_r /* out -= end */ - negl out_r /* out = -out */ - addl $257, out_r /* out += 257 */ - movl out_r, avail_out_strm(strm_r) - -#undef end_r -#undef strm_r -#undef state_r - -.L_done: - addl $local_var_size, %esp - popf - popl %ebx - popl %ebp - popl %esi - popl %edi - ret - -#if defined( GAS_ELF ) -/* elf info */ -.type inflate_fast,@function -.size inflate_fast,.-inflate_fast -#endif diff --git a/compat/zlib/contrib/iostream/test.cpp b/compat/zlib/contrib/iostream/test.cpp deleted file mode 100644 index 7d265b3..0000000 --- a/compat/zlib/contrib/iostream/test.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -#include "zfstream.h" - -int main() { - - // Construct a stream object with this filebuffer. Anything sent - // to this stream will go to standard out. - gzofstream os( 1, ios::out ); - - // This text is getting compressed and sent to stdout. - // To prove this, run 'test | zcat'. - os << "Hello, Mommy" << endl; - - os << setcompressionlevel( Z_NO_COMPRESSION ); - os << "hello, hello, hi, ho!" << endl; - - setcompressionlevel( os, Z_DEFAULT_COMPRESSION ) - << "I'm compressing again" << endl; - - os.close(); - - return 0; - -} diff --git a/compat/zlib/contrib/iostream/zfstream.cpp b/compat/zlib/contrib/iostream/zfstream.cpp deleted file mode 100644 index d0cd85f..0000000 --- a/compat/zlib/contrib/iostream/zfstream.cpp +++ /dev/null @@ -1,329 +0,0 @@ - -#include "zfstream.h" - -gzfilebuf::gzfilebuf() : - file(NULL), - mode(0), - own_file_descriptor(0) -{ } - -gzfilebuf::~gzfilebuf() { - - sync(); - if ( own_file_descriptor ) - close(); - -} - -gzfilebuf *gzfilebuf::open( const char *name, - int io_mode ) { - - if ( is_open() ) - return NULL; - - char char_mode[10]; - char *p = char_mode; - - if ( io_mode & ios::in ) { - mode = ios::in; - *p++ = 'r'; - } else if ( io_mode & ios::app ) { - mode = ios::app; - *p++ = 'a'; - } else { - mode = ios::out; - *p++ = 'w'; - } - - if ( io_mode & ios::binary ) { - mode |= ios::binary; - *p++ = 'b'; - } - - // Hard code the compression level - if ( io_mode & (ios::out|ios::app )) { - *p++ = '9'; - } - - // Put the end-of-string indicator - *p = '\0'; - - if ( (file = gzopen(name, char_mode)) == NULL ) - return NULL; - - own_file_descriptor = 1; - - return this; - -} - -gzfilebuf *gzfilebuf::attach( int file_descriptor, - int io_mode ) { - - if ( is_open() ) - return NULL; - - char char_mode[10]; - char *p = char_mode; - - if ( io_mode & ios::in ) { - mode = ios::in; - *p++ = 'r'; - } else if ( io_mode & ios::app ) { - mode = ios::app; - *p++ = 'a'; - } else { - mode = ios::out; - *p++ = 'w'; - } - - if ( io_mode & ios::binary ) { - mode |= ios::binary; - *p++ = 'b'; - } - - // Hard code the compression level - if ( io_mode & (ios::out|ios::app )) { - *p++ = '9'; - } - - // Put the end-of-string indicator - *p = '\0'; - - if ( (file = gzdopen(file_descriptor, char_mode)) == NULL ) - return NULL; - - own_file_descriptor = 0; - - return this; - -} - -gzfilebuf *gzfilebuf::close() { - - if ( is_open() ) { - - sync(); - gzclose( file ); - file = NULL; - - } - - return this; - -} - -int gzfilebuf::setcompressionlevel( int comp_level ) { - - return gzsetparams(file, comp_level, -2); - -} - -int gzfilebuf::setcompressionstrategy( int comp_strategy ) { - - return gzsetparams(file, -2, comp_strategy); - -} - - -streampos gzfilebuf::seekoff( streamoff off, ios::seek_dir dir, int which ) { - - return streampos(EOF); - -} - -int gzfilebuf::underflow() { - - // If the file hasn't been opened for reading, error. - if ( !is_open() || !(mode & ios::in) ) - return EOF; - - // if a buffer doesn't exists, allocate one. - if ( !base() ) { - - if ( (allocate()) == EOF ) - return EOF; - setp(0,0); - - } else { - - if ( in_avail() ) - return (unsigned char) *gptr(); - - if ( out_waiting() ) { - if ( flushbuf() == EOF ) - return EOF; - } - - } - - // Attempt to fill the buffer. - - int result = fillbuf(); - if ( result == EOF ) { - // disable get area - setg(0,0,0); - return EOF; - } - - return (unsigned char) *gptr(); - -} - -int gzfilebuf::overflow( int c ) { - - if ( !is_open() || !(mode & ios::out) ) - return EOF; - - if ( !base() ) { - if ( allocate() == EOF ) - return EOF; - setg(0,0,0); - } else { - if (in_avail()) { - return EOF; - } - if (out_waiting()) { - if (flushbuf() == EOF) - return EOF; - } - } - - int bl = blen(); - setp( base(), base() + bl); - - if ( c != EOF ) { - - *pptr() = c; - pbump(1); - - } - - return 0; - -} - -int gzfilebuf::sync() { - - if ( !is_open() ) - return EOF; - - if ( out_waiting() ) - return flushbuf(); - - return 0; - -} - -int gzfilebuf::flushbuf() { - - int n; - char *q; - - q = pbase(); - n = pptr() - q; - - if ( gzwrite( file, q, n) < n ) - return EOF; - - setp(0,0); - - return 0; - -} - -int gzfilebuf::fillbuf() { - - int required; - char *p; - - p = base(); - - required = blen(); - - int t = gzread( file, p, required ); - - if ( t <= 0) return EOF; - - setg( base(), base(), base()+t); - - return t; - -} - -gzfilestream_common::gzfilestream_common() : - ios( gzfilestream_common::rdbuf() ) -{ } - -gzfilestream_common::~gzfilestream_common() -{ } - -void gzfilestream_common::attach( int fd, int io_mode ) { - - if ( !buffer.attach( fd, io_mode) ) - clear( ios::failbit | ios::badbit ); - else - clear(); - -} - -void gzfilestream_common::open( const char *name, int io_mode ) { - - if ( !buffer.open( name, io_mode ) ) - clear( ios::failbit | ios::badbit ); - else - clear(); - -} - -void gzfilestream_common::close() { - - if ( !buffer.close() ) - clear( ios::failbit | ios::badbit ); - -} - -gzfilebuf *gzfilestream_common::rdbuf() -{ - return &buffer; -} - -gzifstream::gzifstream() : - ios( gzfilestream_common::rdbuf() ) -{ - clear( ios::badbit ); -} - -gzifstream::gzifstream( const char *name, int io_mode ) : - ios( gzfilestream_common::rdbuf() ) -{ - gzfilestream_common::open( name, io_mode ); -} - -gzifstream::gzifstream( int fd, int io_mode ) : - ios( gzfilestream_common::rdbuf() ) -{ - gzfilestream_common::attach( fd, io_mode ); -} - -gzifstream::~gzifstream() { } - -gzofstream::gzofstream() : - ios( gzfilestream_common::rdbuf() ) -{ - clear( ios::badbit ); -} - -gzofstream::gzofstream( const char *name, int io_mode ) : - ios( gzfilestream_common::rdbuf() ) -{ - gzfilestream_common::open( name, io_mode ); -} - -gzofstream::gzofstream( int fd, int io_mode ) : - ios( gzfilestream_common::rdbuf() ) -{ - gzfilestream_common::attach( fd, io_mode ); -} - -gzofstream::~gzofstream() { } diff --git a/compat/zlib/contrib/iostream/zfstream.h b/compat/zlib/contrib/iostream/zfstream.h deleted file mode 100644 index ed79098..0000000 --- a/compat/zlib/contrib/iostream/zfstream.h +++ /dev/null @@ -1,128 +0,0 @@ - -#ifndef zfstream_h -#define zfstream_h - -#include -#include "zlib.h" - -class gzfilebuf : public streambuf { - -public: - - gzfilebuf( ); - virtual ~gzfilebuf(); - - gzfilebuf *open( const char *name, int io_mode ); - gzfilebuf *attach( int file_descriptor, int io_mode ); - gzfilebuf *close(); - - int setcompressionlevel( int comp_level ); - int setcompressionstrategy( int comp_strategy ); - - inline int is_open() const { return (file !=NULL); } - - virtual streampos seekoff( streamoff, ios::seek_dir, int ); - - virtual int sync(); - -protected: - - virtual int underflow(); - virtual int overflow( int = EOF ); - -private: - - gzFile file; - short mode; - short own_file_descriptor; - - int flushbuf(); - int fillbuf(); - -}; - -class gzfilestream_common : virtual public ios { - - friend class gzifstream; - friend class gzofstream; - friend gzofstream &setcompressionlevel( gzofstream &, int ); - friend gzofstream &setcompressionstrategy( gzofstream &, int ); - -public: - virtual ~gzfilestream_common(); - - void attach( int fd, int io_mode ); - void open( const char *name, int io_mode ); - void close(); - -protected: - gzfilestream_common(); - -private: - gzfilebuf *rdbuf(); - - gzfilebuf buffer; - -}; - -class gzifstream : public gzfilestream_common, public istream { - -public: - - gzifstream(); - gzifstream( const char *name, int io_mode = ios::in ); - gzifstream( int fd, int io_mode = ios::in ); - - virtual ~gzifstream(); - -}; - -class gzofstream : public gzfilestream_common, public ostream { - -public: - - gzofstream(); - gzofstream( const char *name, int io_mode = ios::out ); - gzofstream( int fd, int io_mode = ios::out ); - - virtual ~gzofstream(); - -}; - -template class gzomanip { - friend gzofstream &operator<<(gzofstream &, const gzomanip &); -public: - gzomanip(gzofstream &(*f)(gzofstream &, T), T v) : func(f), val(v) { } -private: - gzofstream &(*func)(gzofstream &, T); - T val; -}; - -template gzofstream &operator<<(gzofstream &s, const gzomanip &m) -{ - return (*m.func)(s, m.val); -} - -inline gzofstream &setcompressionlevel( gzofstream &s, int l ) -{ - (s.rdbuf())->setcompressionlevel(l); - return s; -} - -inline gzofstream &setcompressionstrategy( gzofstream &s, int l ) -{ - (s.rdbuf())->setcompressionstrategy(l); - return s; -} - -inline gzomanip setcompressionlevel(int l) -{ - return gzomanip(&setcompressionlevel,l); -} - -inline gzomanip setcompressionstrategy(int l) -{ - return gzomanip(&setcompressionstrategy,l); -} - -#endif diff --git a/compat/zlib/contrib/iostream2/zstream.h b/compat/zlib/contrib/iostream2/zstream.h deleted file mode 100644 index 43d2332..0000000 --- a/compat/zlib/contrib/iostream2/zstream.h +++ /dev/null @@ -1,307 +0,0 @@ -/* - * - * Copyright (c) 1997 - * Christian Michelsen Research AS - * Advanced Computing - * Fantoftvegen 38, 5036 BERGEN, Norway - * http://www.cmr.no - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Christian Michelsen Research AS makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - */ - -#ifndef ZSTREAM__H -#define ZSTREAM__H - -/* - * zstream.h - C++ interface to the 'zlib' general purpose compression library - * $Id: zstream.h 1.1 1997-06-25 12:00:56+02 tyge Exp tyge $ - */ - -#include -#include -#include -#include "zlib.h" - -#if defined(_WIN32) -# include -# include -# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif - -class zstringlen { -public: - zstringlen(class izstream&); - zstringlen(class ozstream&, const char*); - size_t value() const { return val.word; } -private: - struct Val { unsigned char byte; size_t word; } val; -}; - -// ----------------------------- izstream ----------------------------- - -class izstream -{ - public: - izstream() : m_fp(0) {} - izstream(FILE* fp) : m_fp(0) { open(fp); } - izstream(const char* name) : m_fp(0) { open(name); } - ~izstream() { close(); } - - /* Opens a gzip (.gz) file for reading. - * open() can be used to read a file which is not in gzip format; - * in this case read() will directly read from the file without - * decompression. errno can be checked to distinguish two error - * cases (if errno is zero, the zlib error is Z_MEM_ERROR). - */ - void open(const char* name) { - if (m_fp) close(); - m_fp = ::gzopen(name, "rb"); - } - - void open(FILE* fp) { - SET_BINARY_MODE(fp); - if (m_fp) close(); - m_fp = ::gzdopen(fileno(fp), "rb"); - } - - /* Flushes all pending input if necessary, closes the compressed file - * and deallocates all the (de)compression state. The return value is - * the zlib error number (see function error() below). - */ - int close() { - int r = ::gzclose(m_fp); - m_fp = 0; return r; - } - - /* Binary read the given number of bytes from the compressed file. - */ - int read(void* buf, size_t len) { - return ::gzread(m_fp, buf, len); - } - - /* Returns the error message for the last error which occurred on the - * given compressed file. errnum is set to zlib error number. If an - * error occurred in the file system and not in the compression library, - * errnum is set to Z_ERRNO and the application may consult errno - * to get the exact error code. - */ - const char* error(int* errnum) { - return ::gzerror(m_fp, errnum); - } - - gzFile fp() { return m_fp; } - - private: - gzFile m_fp; -}; - -/* - * Binary read the given (array of) object(s) from the compressed file. - * If the input file was not in gzip format, read() copies the objects number - * of bytes into the buffer. - * returns the number of uncompressed bytes actually read - * (0 for end of file, -1 for error). - */ -template -inline int read(izstream& zs, T* x, Items items) { - return ::gzread(zs.fp(), x, items*sizeof(T)); -} - -/* - * Binary input with the '>' operator. - */ -template -inline izstream& operator>(izstream& zs, T& x) { - ::gzread(zs.fp(), &x, sizeof(T)); - return zs; -} - - -inline zstringlen::zstringlen(izstream& zs) { - zs > val.byte; - if (val.byte == 255) zs > val.word; - else val.word = val.byte; -} - -/* - * Read length of string + the string with the '>' operator. - */ -inline izstream& operator>(izstream& zs, char* x) { - zstringlen len(zs); - ::gzread(zs.fp(), x, len.value()); - x[len.value()] = '\0'; - return zs; -} - -inline char* read_string(izstream& zs) { - zstringlen len(zs); - char* x = new char[len.value()+1]; - ::gzread(zs.fp(), x, len.value()); - x[len.value()] = '\0'; - return x; -} - -// ----------------------------- ozstream ----------------------------- - -class ozstream -{ - public: - ozstream() : m_fp(0), m_os(0) { - } - ozstream(FILE* fp, int level = Z_DEFAULT_COMPRESSION) - : m_fp(0), m_os(0) { - open(fp, level); - } - ozstream(const char* name, int level = Z_DEFAULT_COMPRESSION) - : m_fp(0), m_os(0) { - open(name, level); - } - ~ozstream() { - close(); - } - - /* Opens a gzip (.gz) file for writing. - * The compression level parameter should be in 0..9 - * errno can be checked to distinguish two error cases - * (if errno is zero, the zlib error is Z_MEM_ERROR). - */ - void open(const char* name, int level = Z_DEFAULT_COMPRESSION) { - char mode[4] = "wb\0"; - if (level != Z_DEFAULT_COMPRESSION) mode[2] = '0'+level; - if (m_fp) close(); - m_fp = ::gzopen(name, mode); - } - - /* open from a FILE pointer. - */ - void open(FILE* fp, int level = Z_DEFAULT_COMPRESSION) { - SET_BINARY_MODE(fp); - char mode[4] = "wb\0"; - if (level != Z_DEFAULT_COMPRESSION) mode[2] = '0'+level; - if (m_fp) close(); - m_fp = ::gzdopen(fileno(fp), mode); - } - - /* Flushes all pending output if necessary, closes the compressed file - * and deallocates all the (de)compression state. The return value is - * the zlib error number (see function error() below). - */ - int close() { - if (m_os) { - ::gzwrite(m_fp, m_os->str(), m_os->pcount()); - delete[] m_os->str(); delete m_os; m_os = 0; - } - int r = ::gzclose(m_fp); m_fp = 0; return r; - } - - /* Binary write the given number of bytes into the compressed file. - */ - int write(const void* buf, size_t len) { - return ::gzwrite(m_fp, (voidp) buf, len); - } - - /* Flushes all pending output into the compressed file. The parameter - * _flush is as in the deflate() function. The return value is the zlib - * error number (see function gzerror below). flush() returns Z_OK if - * the flush_ parameter is Z_FINISH and all output could be flushed. - * flush() should be called only when strictly necessary because it can - * degrade compression. - */ - int flush(int _flush) { - os_flush(); - return ::gzflush(m_fp, _flush); - } - - /* Returns the error message for the last error which occurred on the - * given compressed file. errnum is set to zlib error number. If an - * error occurred in the file system and not in the compression library, - * errnum is set to Z_ERRNO and the application may consult errno - * to get the exact error code. - */ - const char* error(int* errnum) { - return ::gzerror(m_fp, errnum); - } - - gzFile fp() { return m_fp; } - - ostream& os() { - if (m_os == 0) m_os = new ostrstream; - return *m_os; - } - - void os_flush() { - if (m_os && m_os->pcount()>0) { - ostrstream* oss = new ostrstream; - oss->fill(m_os->fill()); - oss->flags(m_os->flags()); - oss->precision(m_os->precision()); - oss->width(m_os->width()); - ::gzwrite(m_fp, m_os->str(), m_os->pcount()); - delete[] m_os->str(); delete m_os; m_os = oss; - } - } - - private: - gzFile m_fp; - ostrstream* m_os; -}; - -/* - * Binary write the given (array of) object(s) into the compressed file. - * returns the number of uncompressed bytes actually written - * (0 in case of error). - */ -template -inline int write(ozstream& zs, const T* x, Items items) { - return ::gzwrite(zs.fp(), (voidp) x, items*sizeof(T)); -} - -/* - * Binary output with the '<' operator. - */ -template -inline ozstream& operator<(ozstream& zs, const T& x) { - ::gzwrite(zs.fp(), (voidp) &x, sizeof(T)); - return zs; -} - -inline zstringlen::zstringlen(ozstream& zs, const char* x) { - val.byte = 255; val.word = ::strlen(x); - if (val.word < 255) zs < (val.byte = val.word); - else zs < val; -} - -/* - * Write length of string + the string with the '<' operator. - */ -inline ozstream& operator<(ozstream& zs, const char* x) { - zstringlen len(zs, x); - ::gzwrite(zs.fp(), (voidp) x, len.value()); - return zs; -} - -#ifdef _MSC_VER -inline ozstream& operator<(ozstream& zs, char* const& x) { - return zs < (const char*) x; -} -#endif - -/* - * Ascii write with the << operator; - */ -template -inline ostream& operator<<(ozstream& zs, const T& x) { - zs.os_flush(); - return zs.os() << x; -} - -#endif diff --git a/compat/zlib/contrib/iostream2/zstream_test.cpp b/compat/zlib/contrib/iostream2/zstream_test.cpp deleted file mode 100644 index 6273f62..0000000 --- a/compat/zlib/contrib/iostream2/zstream_test.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "zstream.h" -#include -#include -#include - -void main() { - char h[256] = "Hello"; - char* g = "Goodbye"; - ozstream out("temp.gz"); - out < "This works well" < h < g; - out.close(); - - izstream in("temp.gz"); // read it back - char *x = read_string(in), *y = new char[256], z[256]; - in > y > z; - in.close(); - cout << x << endl << y << endl << z << endl; - - out.open("temp.gz"); // try ascii output; zcat temp.gz to see the results - out << setw(50) << setfill('#') << setprecision(20) << x << endl << y << endl << z << endl; - out << z << endl << y << endl << x << endl; - out << 1.1234567890123456789 << endl; - - delete[] x; delete[] y; -} diff --git a/compat/zlib/contrib/iostream3/README b/compat/zlib/contrib/iostream3/README deleted file mode 100644 index f7b319a..0000000 --- a/compat/zlib/contrib/iostream3/README +++ /dev/null @@ -1,35 +0,0 @@ -These classes provide a C++ stream interface to the zlib library. It allows you -to do things like: - - gzofstream outf("blah.gz"); - outf << "These go into the gzip file " << 123 << endl; - -It does this by deriving a specialized stream buffer for gzipped files, which is -the way Stroustrup would have done it. :-> - -The gzifstream and gzofstream classes were originally written by Kevin Ruland -and made available in the zlib contrib/iostream directory. The older version still -compiles under gcc 2.xx, but not under gcc 3.xx, which sparked the development of -this version. - -The new classes are as standard-compliant as possible, closely following the -approach of the standard library's fstream classes. It compiles under gcc versions -3.2 and 3.3, but not under gcc 2.xx. This is mainly due to changes in the standard -library naming scheme. The new version of gzifstream/gzofstream/gzfilebuf differs -from the previous one in the following respects: -- added showmanyc -- added setbuf, with support for unbuffered output via setbuf(0,0) -- a few bug fixes of stream behavior -- gzipped output file opened with default compression level instead of maximum level -- setcompressionlevel()/strategy() members replaced by single setcompression() - -The code is provided "as is", with the permission to use, copy, modify, distribute -and sell it for any purpose without fee. - -Ludwig Schwardt - - -DSP Lab -Electrical & Electronic Engineering Department -University of Stellenbosch -South Africa diff --git a/compat/zlib/contrib/iostream3/TODO b/compat/zlib/contrib/iostream3/TODO deleted file mode 100644 index 7032f97..0000000 --- a/compat/zlib/contrib/iostream3/TODO +++ /dev/null @@ -1,17 +0,0 @@ -Possible upgrades to gzfilebuf: - -- The ability to do putback (e.g. putbackfail) - -- The ability to seek (zlib supports this, but could be slow/tricky) - -- Simultaneous read/write access (does it make sense?) - -- Support for ios_base::ate open mode - -- Locale support? - -- Check public interface to see which calls give problems - (due to dependence on library internals) - -- Override operator<<(ostream&, gzfilebuf*) to allow direct copying - of stream buffer to stream ( i.e. os << is.rdbuf(); ) diff --git a/compat/zlib/contrib/iostream3/test.cc b/compat/zlib/contrib/iostream3/test.cc deleted file mode 100644 index 9423533..0000000 --- a/compat/zlib/contrib/iostream3/test.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Test program for gzifstream and gzofstream - * - * by Ludwig Schwardt - * original version by Kevin Ruland - */ - -#include "zfstream.h" -#include // for cout - -int main() { - - gzofstream outf; - gzifstream inf; - char buf[80]; - - outf.open("test1.txt.gz"); - outf << "The quick brown fox sidestepped the lazy canine\n" - << 1.3 << "\nPlan " << 9 << std::endl; - outf.close(); - std::cout << "Wrote the following message to 'test1.txt.gz' (check with zcat or zless):\n" - << "The quick brown fox sidestepped the lazy canine\n" - << 1.3 << "\nPlan " << 9 << std::endl; - - std::cout << "\nReading 'test1.txt.gz' (buffered) produces:\n"; - inf.open("test1.txt.gz"); - while (inf.getline(buf,80,'\n')) { - std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n"; - } - inf.close(); - - outf.rdbuf()->pubsetbuf(0,0); - outf.open("test2.txt.gz"); - outf << setcompression(Z_NO_COMPRESSION) - << "The quick brown fox sidestepped the lazy canine\n" - << 1.3 << "\nPlan " << 9 << std::endl; - outf.close(); - std::cout << "\nWrote the same message to 'test2.txt.gz' in uncompressed form"; - - std::cout << "\nReading 'test2.txt.gz' (unbuffered) produces:\n"; - inf.rdbuf()->pubsetbuf(0,0); - inf.open("test2.txt.gz"); - while (inf.getline(buf,80,'\n')) { - std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n"; - } - inf.close(); - - return 0; - -} diff --git a/compat/zlib/contrib/iostream3/zfstream.cc b/compat/zlib/contrib/iostream3/zfstream.cc deleted file mode 100644 index 94eb933..0000000 --- a/compat/zlib/contrib/iostream3/zfstream.cc +++ /dev/null @@ -1,479 +0,0 @@ -/* - * A C++ I/O streams interface to the zlib gz* functions - * - * by Ludwig Schwardt - * original version by Kevin Ruland - * - * This version is standard-compliant and compatible with gcc 3.x. - */ - -#include "zfstream.h" -#include // for strcpy, strcat, strlen (mode strings) -#include // for BUFSIZ - -// Internal buffer sizes (default and "unbuffered" versions) -#define BIGBUFSIZE BUFSIZ -#define SMALLBUFSIZE 1 - -/*****************************************************************************/ - -// Default constructor -gzfilebuf::gzfilebuf() -: file(NULL), io_mode(std::ios_base::openmode(0)), own_fd(false), - buffer(NULL), buffer_size(BIGBUFSIZE), own_buffer(true) -{ - // No buffers to start with - this->disable_buffer(); -} - -// Destructor -gzfilebuf::~gzfilebuf() -{ - // Sync output buffer and close only if responsible for file - // (i.e. attached streams should be left open at this stage) - this->sync(); - if (own_fd) - this->close(); - // Make sure internal buffer is deallocated - this->disable_buffer(); -} - -// Set compression level and strategy -int -gzfilebuf::setcompression(int comp_level, - int comp_strategy) -{ - return gzsetparams(file, comp_level, comp_strategy); -} - -// Open gzipped file -gzfilebuf* -gzfilebuf::open(const char *name, - std::ios_base::openmode mode) -{ - // Fail if file already open - if (this->is_open()) - return NULL; - // Don't support simultaneous read/write access (yet) - if ((mode & std::ios_base::in) && (mode & std::ios_base::out)) - return NULL; - - // Build mode string for gzopen and check it [27.8.1.3.2] - char char_mode[6] = "\0\0\0\0\0"; - if (!this->open_mode(mode, char_mode)) - return NULL; - - // Attempt to open file - if ((file = gzopen(name, char_mode)) == NULL) - return NULL; - - // On success, allocate internal buffer and set flags - this->enable_buffer(); - io_mode = mode; - own_fd = true; - return this; -} - -// Attach to gzipped file -gzfilebuf* -gzfilebuf::attach(int fd, - std::ios_base::openmode mode) -{ - // Fail if file already open - if (this->is_open()) - return NULL; - // Don't support simultaneous read/write access (yet) - if ((mode & std::ios_base::in) && (mode & std::ios_base::out)) - return NULL; - - // Build mode string for gzdopen and check it [27.8.1.3.2] - char char_mode[6] = "\0\0\0\0\0"; - if (!this->open_mode(mode, char_mode)) - return NULL; - - // Attempt to attach to file - if ((file = gzdopen(fd, char_mode)) == NULL) - return NULL; - - // On success, allocate internal buffer and set flags - this->enable_buffer(); - io_mode = mode; - own_fd = false; - return this; -} - -// Close gzipped file -gzfilebuf* -gzfilebuf::close() -{ - // Fail immediately if no file is open - if (!this->is_open()) - return NULL; - // Assume success - gzfilebuf* retval = this; - // Attempt to sync and close gzipped file - if (this->sync() == -1) - retval = NULL; - if (gzclose(file) < 0) - retval = NULL; - // File is now gone anyway (postcondition [27.8.1.3.8]) - file = NULL; - own_fd = false; - // Destroy internal buffer if it exists - this->disable_buffer(); - return retval; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -// Convert int open mode to mode string -bool -gzfilebuf::open_mode(std::ios_base::openmode mode, - char* c_mode) const -{ - bool testb = mode & std::ios_base::binary; - bool testi = mode & std::ios_base::in; - bool testo = mode & std::ios_base::out; - bool testt = mode & std::ios_base::trunc; - bool testa = mode & std::ios_base::app; - - // Check for valid flag combinations - see [27.8.1.3.2] (Table 92) - // Original zfstream hardcoded the compression level to maximum here... - // Double the time for less than 1% size improvement seems - // excessive though - keeping it at the default level - // To change back, just append "9" to the next three mode strings - if (!testi && testo && !testt && !testa) - strcpy(c_mode, "w"); - if (!testi && testo && !testt && testa) - strcpy(c_mode, "a"); - if (!testi && testo && testt && !testa) - strcpy(c_mode, "w"); - if (testi && !testo && !testt && !testa) - strcpy(c_mode, "r"); - // No read/write mode yet -// if (testi && testo && !testt && !testa) -// strcpy(c_mode, "r+"); -// if (testi && testo && testt && !testa) -// strcpy(c_mode, "w+"); - - // Mode string should be empty for invalid combination of flags - if (strlen(c_mode) == 0) - return false; - if (testb) - strcat(c_mode, "b"); - return true; -} - -// Determine number of characters in internal get buffer -std::streamsize -gzfilebuf::showmanyc() -{ - // Calls to underflow will fail if file not opened for reading - if (!this->is_open() || !(io_mode & std::ios_base::in)) - return -1; - // Make sure get area is in use - if (this->gptr() && (this->gptr() < this->egptr())) - return std::streamsize(this->egptr() - this->gptr()); - else - return 0; -} - -// Fill get area from gzipped file -gzfilebuf::int_type -gzfilebuf::underflow() -{ - // If something is left in the get area by chance, return it - // (this shouldn't normally happen, as underflow is only supposed - // to be called when gptr >= egptr, but it serves as error check) - if (this->gptr() && (this->gptr() < this->egptr())) - return traits_type::to_int_type(*(this->gptr())); - - // If the file hasn't been opened for reading, produce error - if (!this->is_open() || !(io_mode & std::ios_base::in)) - return traits_type::eof(); - - // Attempt to fill internal buffer from gzipped file - // (buffer must be guaranteed to exist...) - int bytes_read = gzread(file, buffer, buffer_size); - // Indicates error or EOF - if (bytes_read <= 0) - { - // Reset get area - this->setg(buffer, buffer, buffer); - return traits_type::eof(); - } - // Make all bytes read from file available as get area - this->setg(buffer, buffer, buffer + bytes_read); - - // Return next character in get area - return traits_type::to_int_type(*(this->gptr())); -} - -// Write put area to gzipped file -gzfilebuf::int_type -gzfilebuf::overflow(int_type c) -{ - // Determine whether put area is in use - if (this->pbase()) - { - // Double-check pointer range - if (this->pptr() > this->epptr() || this->pptr() < this->pbase()) - return traits_type::eof(); - // Add extra character to buffer if not EOF - if (!traits_type::eq_int_type(c, traits_type::eof())) - { - *(this->pptr()) = traits_type::to_char_type(c); - this->pbump(1); - } - // Number of characters to write to file - int bytes_to_write = this->pptr() - this->pbase(); - // Overflow doesn't fail if nothing is to be written - if (bytes_to_write > 0) - { - // If the file hasn't been opened for writing, produce error - if (!this->is_open() || !(io_mode & std::ios_base::out)) - return traits_type::eof(); - // If gzipped file won't accept all bytes written to it, fail - if (gzwrite(file, this->pbase(), bytes_to_write) != bytes_to_write) - return traits_type::eof(); - // Reset next pointer to point to pbase on success - this->pbump(-bytes_to_write); - } - } - // Write extra character to file if not EOF - else if (!traits_type::eq_int_type(c, traits_type::eof())) - { - // If the file hasn't been opened for writing, produce error - if (!this->is_open() || !(io_mode & std::ios_base::out)) - return traits_type::eof(); - // Impromptu char buffer (allows "unbuffered" output) - char_type last_char = traits_type::to_char_type(c); - // If gzipped file won't accept this character, fail - if (gzwrite(file, &last_char, 1) != 1) - return traits_type::eof(); - } - - // If you got here, you have succeeded (even if c was EOF) - // The return value should therefore be non-EOF - if (traits_type::eq_int_type(c, traits_type::eof())) - return traits_type::not_eof(c); - else - return c; -} - -// Assign new buffer -std::streambuf* -gzfilebuf::setbuf(char_type* p, - std::streamsize n) -{ - // First make sure stuff is sync'ed, for safety - if (this->sync() == -1) - return NULL; - // If buffering is turned off on purpose via setbuf(0,0), still allocate one... - // "Unbuffered" only really refers to put [27.8.1.4.10], while get needs at - // least a buffer of size 1 (very inefficient though, therefore make it bigger?) - // This follows from [27.5.2.4.3]/12 (gptr needs to point at something, it seems) - if (!p || !n) - { - // Replace existing buffer (if any) with small internal buffer - this->disable_buffer(); - buffer = NULL; - buffer_size = 0; - own_buffer = true; - this->enable_buffer(); - } - else - { - // Replace existing buffer (if any) with external buffer - this->disable_buffer(); - buffer = p; - buffer_size = n; - own_buffer = false; - this->enable_buffer(); - } - return this; -} - -// Write put area to gzipped file (i.e. ensures that put area is empty) -int -gzfilebuf::sync() -{ - return traits_type::eq_int_type(this->overflow(), traits_type::eof()) ? -1 : 0; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -// Allocate internal buffer -void -gzfilebuf::enable_buffer() -{ - // If internal buffer required, allocate one - if (own_buffer && !buffer) - { - // Check for buffered vs. "unbuffered" - if (buffer_size > 0) - { - // Allocate internal buffer - buffer = new char_type[buffer_size]; - // Get area starts empty and will be expanded by underflow as need arises - this->setg(buffer, buffer, buffer); - // Setup entire internal buffer as put area. - // The one-past-end pointer actually points to the last element of the buffer, - // so that overflow(c) can safely add the extra character c to the sequence. - // These pointers remain in place for the duration of the buffer - this->setp(buffer, buffer + buffer_size - 1); - } - else - { - // Even in "unbuffered" case, (small?) get buffer is still required - buffer_size = SMALLBUFSIZE; - buffer = new char_type[buffer_size]; - this->setg(buffer, buffer, buffer); - // "Unbuffered" means no put buffer - this->setp(0, 0); - } - } - else - { - // If buffer already allocated, reset buffer pointers just to make sure no - // stale chars are lying around - this->setg(buffer, buffer, buffer); - this->setp(buffer, buffer + buffer_size - 1); - } -} - -// Destroy internal buffer -void -gzfilebuf::disable_buffer() -{ - // If internal buffer exists, deallocate it - if (own_buffer && buffer) - { - // Preserve unbuffered status by zeroing size - if (!this->pbase()) - buffer_size = 0; - delete[] buffer; - buffer = NULL; - this->setg(0, 0, 0); - this->setp(0, 0); - } - else - { - // Reset buffer pointers to initial state if external buffer exists - this->setg(buffer, buffer, buffer); - if (buffer) - this->setp(buffer, buffer + buffer_size - 1); - else - this->setp(0, 0); - } -} - -/*****************************************************************************/ - -// Default constructor initializes stream buffer -gzifstream::gzifstream() -: std::istream(NULL), sb() -{ this->init(&sb); } - -// Initialize stream buffer and open file -gzifstream::gzifstream(const char* name, - std::ios_base::openmode mode) -: std::istream(NULL), sb() -{ - this->init(&sb); - this->open(name, mode); -} - -// Initialize stream buffer and attach to file -gzifstream::gzifstream(int fd, - std::ios_base::openmode mode) -: std::istream(NULL), sb() -{ - this->init(&sb); - this->attach(fd, mode); -} - -// Open file and go into fail() state if unsuccessful -void -gzifstream::open(const char* name, - std::ios_base::openmode mode) -{ - if (!sb.open(name, mode | std::ios_base::in)) - this->setstate(std::ios_base::failbit); - else - this->clear(); -} - -// Attach to file and go into fail() state if unsuccessful -void -gzifstream::attach(int fd, - std::ios_base::openmode mode) -{ - if (!sb.attach(fd, mode | std::ios_base::in)) - this->setstate(std::ios_base::failbit); - else - this->clear(); -} - -// Close file -void -gzifstream::close() -{ - if (!sb.close()) - this->setstate(std::ios_base::failbit); -} - -/*****************************************************************************/ - -// Default constructor initializes stream buffer -gzofstream::gzofstream() -: std::ostream(NULL), sb() -{ this->init(&sb); } - -// Initialize stream buffer and open file -gzofstream::gzofstream(const char* name, - std::ios_base::openmode mode) -: std::ostream(NULL), sb() -{ - this->init(&sb); - this->open(name, mode); -} - -// Initialize stream buffer and attach to file -gzofstream::gzofstream(int fd, - std::ios_base::openmode mode) -: std::ostream(NULL), sb() -{ - this->init(&sb); - this->attach(fd, mode); -} - -// Open file and go into fail() state if unsuccessful -void -gzofstream::open(const char* name, - std::ios_base::openmode mode) -{ - if (!sb.open(name, mode | std::ios_base::out)) - this->setstate(std::ios_base::failbit); - else - this->clear(); -} - -// Attach to file and go into fail() state if unsuccessful -void -gzofstream::attach(int fd, - std::ios_base::openmode mode) -{ - if (!sb.attach(fd, mode | std::ios_base::out)) - this->setstate(std::ios_base::failbit); - else - this->clear(); -} - -// Close file -void -gzofstream::close() -{ - if (!sb.close()) - this->setstate(std::ios_base::failbit); -} diff --git a/compat/zlib/contrib/iostream3/zfstream.h b/compat/zlib/contrib/iostream3/zfstream.h deleted file mode 100644 index 8574479..0000000 --- a/compat/zlib/contrib/iostream3/zfstream.h +++ /dev/null @@ -1,466 +0,0 @@ -/* - * A C++ I/O streams interface to the zlib gz* functions - * - * by Ludwig Schwardt - * original version by Kevin Ruland - * - * This version is standard-compliant and compatible with gcc 3.x. - */ - -#ifndef ZFSTREAM_H -#define ZFSTREAM_H - -#include // not iostream, since we don't need cin/cout -#include -#include "zlib.h" - -/*****************************************************************************/ - -/** - * @brief Gzipped file stream buffer class. - * - * This class implements basic_filebuf for gzipped files. It doesn't yet support - * seeking (allowed by zlib but slow/limited), putback and read/write access - * (tricky). Otherwise, it attempts to be a drop-in replacement for the standard - * file streambuf. -*/ -class gzfilebuf : public std::streambuf -{ -public: - // Default constructor. - gzfilebuf(); - - // Destructor. - virtual - ~gzfilebuf(); - - /** - * @brief Set compression level and strategy on the fly. - * @param comp_level Compression level (see zlib.h for allowed values) - * @param comp_strategy Compression strategy (see zlib.h for allowed values) - * @return Z_OK on success, Z_STREAM_ERROR otherwise. - * - * Unfortunately, these parameters cannot be modified separately, as the - * previous zfstream version assumed. Since the strategy is seldom changed, - * it can default and setcompression(level) then becomes like the old - * setcompressionlevel(level). - */ - int - setcompression(int comp_level, - int comp_strategy = Z_DEFAULT_STRATEGY); - - /** - * @brief Check if file is open. - * @return True if file is open. - */ - bool - is_open() const { return (file != NULL); } - - /** - * @brief Open gzipped file. - * @param name File name. - * @param mode Open mode flags. - * @return @c this on success, NULL on failure. - */ - gzfilebuf* - open(const char* name, - std::ios_base::openmode mode); - - /** - * @brief Attach to already open gzipped file. - * @param fd File descriptor. - * @param mode Open mode flags. - * @return @c this on success, NULL on failure. - */ - gzfilebuf* - attach(int fd, - std::ios_base::openmode mode); - - /** - * @brief Close gzipped file. - * @return @c this on success, NULL on failure. - */ - gzfilebuf* - close(); - -protected: - /** - * @brief Convert ios open mode int to mode string used by zlib. - * @return True if valid mode flag combination. - */ - bool - open_mode(std::ios_base::openmode mode, - char* c_mode) const; - - /** - * @brief Number of characters available in stream buffer. - * @return Number of characters. - * - * This indicates number of characters in get area of stream buffer. - * These characters can be read without accessing the gzipped file. - */ - virtual std::streamsize - showmanyc(); - - /** - * @brief Fill get area from gzipped file. - * @return First character in get area on success, EOF on error. - * - * This actually reads characters from gzipped file to stream - * buffer. Always buffered. - */ - virtual int_type - underflow(); - - /** - * @brief Write put area to gzipped file. - * @param c Extra character to add to buffer contents. - * @return Non-EOF on success, EOF on error. - * - * This actually writes characters in stream buffer to - * gzipped file. With unbuffered output this is done one - * character at a time. - */ - virtual int_type - overflow(int_type c = traits_type::eof()); - - /** - * @brief Installs external stream buffer. - * @param p Pointer to char buffer. - * @param n Size of external buffer. - * @return @c this on success, NULL on failure. - * - * Call setbuf(0,0) to enable unbuffered output. - */ - virtual std::streambuf* - setbuf(char_type* p, - std::streamsize n); - - /** - * @brief Flush stream buffer to file. - * @return 0 on success, -1 on error. - * - * This calls underflow(EOF) to do the job. - */ - virtual int - sync(); - -// -// Some future enhancements -// -// virtual int_type uflow(); -// virtual int_type pbackfail(int_type c = traits_type::eof()); -// virtual pos_type -// seekoff(off_type off, -// std::ios_base::seekdir way, -// std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out); -// virtual pos_type -// seekpos(pos_type sp, -// std::ios_base::openmode mode = std::ios_base::in|std::ios_base::out); - -private: - /** - * @brief Allocate internal buffer. - * - * This function is safe to call multiple times. It will ensure - * that a proper internal buffer exists if it is required. If the - * buffer already exists or is external, the buffer pointers will be - * reset to their original state. - */ - void - enable_buffer(); - - /** - * @brief Destroy internal buffer. - * - * This function is safe to call multiple times. It will ensure - * that the internal buffer is deallocated if it exists. In any - * case, it will also reset the buffer pointers. - */ - void - disable_buffer(); - - /** - * Underlying file pointer. - */ - gzFile file; - - /** - * Mode in which file was opened. - */ - std::ios_base::openmode io_mode; - - /** - * @brief True if this object owns file descriptor. - * - * This makes the class responsible for closing the file - * upon destruction. - */ - bool own_fd; - - /** - * @brief Stream buffer. - * - * For simplicity this remains allocated on the free store for the - * entire life span of the gzfilebuf object, unless replaced by setbuf. - */ - char_type* buffer; - - /** - * @brief Stream buffer size. - * - * Defaults to system default buffer size (typically 8192 bytes). - * Modified by setbuf. - */ - std::streamsize buffer_size; - - /** - * @brief True if this object owns stream buffer. - * - * This makes the class responsible for deleting the buffer - * upon destruction. - */ - bool own_buffer; -}; - -/*****************************************************************************/ - -/** - * @brief Gzipped file input stream class. - * - * This class implements ifstream for gzipped files. Seeking and putback - * is not supported yet. -*/ -class gzifstream : public std::istream -{ -public: - // Default constructor - gzifstream(); - - /** - * @brief Construct stream on gzipped file to be opened. - * @param name File name. - * @param mode Open mode flags (forced to contain ios::in). - */ - explicit - gzifstream(const char* name, - std::ios_base::openmode mode = std::ios_base::in); - - /** - * @brief Construct stream on already open gzipped file. - * @param fd File descriptor. - * @param mode Open mode flags (forced to contain ios::in). - */ - explicit - gzifstream(int fd, - std::ios_base::openmode mode = std::ios_base::in); - - /** - * Obtain underlying stream buffer. - */ - gzfilebuf* - rdbuf() const - { return const_cast(&sb); } - - /** - * @brief Check if file is open. - * @return True if file is open. - */ - bool - is_open() { return sb.is_open(); } - - /** - * @brief Open gzipped file. - * @param name File name. - * @param mode Open mode flags (forced to contain ios::in). - * - * Stream will be in state good() if file opens successfully; - * otherwise in state fail(). This differs from the behavior of - * ifstream, which never sets the state to good() and therefore - * won't allow you to reuse the stream for a second file unless - * you manually clear() the state. The choice is a matter of - * convenience. - */ - void - open(const char* name, - std::ios_base::openmode mode = std::ios_base::in); - - /** - * @brief Attach to already open gzipped file. - * @param fd File descriptor. - * @param mode Open mode flags (forced to contain ios::in). - * - * Stream will be in state good() if attach succeeded; otherwise - * in state fail(). - */ - void - attach(int fd, - std::ios_base::openmode mode = std::ios_base::in); - - /** - * @brief Close gzipped file. - * - * Stream will be in state fail() if close failed. - */ - void - close(); - -private: - /** - * Underlying stream buffer. - */ - gzfilebuf sb; -}; - -/*****************************************************************************/ - -/** - * @brief Gzipped file output stream class. - * - * This class implements ofstream for gzipped files. Seeking and putback - * is not supported yet. -*/ -class gzofstream : public std::ostream -{ -public: - // Default constructor - gzofstream(); - - /** - * @brief Construct stream on gzipped file to be opened. - * @param name File name. - * @param mode Open mode flags (forced to contain ios::out). - */ - explicit - gzofstream(const char* name, - std::ios_base::openmode mode = std::ios_base::out); - - /** - * @brief Construct stream on already open gzipped file. - * @param fd File descriptor. - * @param mode Open mode flags (forced to contain ios::out). - */ - explicit - gzofstream(int fd, - std::ios_base::openmode mode = std::ios_base::out); - - /** - * Obtain underlying stream buffer. - */ - gzfilebuf* - rdbuf() const - { return const_cast(&sb); } - - /** - * @brief Check if file is open. - * @return True if file is open. - */ - bool - is_open() { return sb.is_open(); } - - /** - * @brief Open gzipped file. - * @param name File name. - * @param mode Open mode flags (forced to contain ios::out). - * - * Stream will be in state good() if file opens successfully; - * otherwise in state fail(). This differs from the behavior of - * ofstream, which never sets the state to good() and therefore - * won't allow you to reuse the stream for a second file unless - * you manually clear() the state. The choice is a matter of - * convenience. - */ - void - open(const char* name, - std::ios_base::openmode mode = std::ios_base::out); - - /** - * @brief Attach to already open gzipped file. - * @param fd File descriptor. - * @param mode Open mode flags (forced to contain ios::out). - * - * Stream will be in state good() if attach succeeded; otherwise - * in state fail(). - */ - void - attach(int fd, - std::ios_base::openmode mode = std::ios_base::out); - - /** - * @brief Close gzipped file. - * - * Stream will be in state fail() if close failed. - */ - void - close(); - -private: - /** - * Underlying stream buffer. - */ - gzfilebuf sb; -}; - -/*****************************************************************************/ - -/** - * @brief Gzipped file output stream manipulator class. - * - * This class defines a two-argument manipulator for gzofstream. It is used - * as base for the setcompression(int,int) manipulator. -*/ -template - class gzomanip2 - { - public: - // Allows insertor to peek at internals - template - friend gzofstream& - operator<<(gzofstream&, - const gzomanip2&); - - // Constructor - gzomanip2(gzofstream& (*f)(gzofstream&, T1, T2), - T1 v1, - T2 v2); - private: - // Underlying manipulator function - gzofstream& - (*func)(gzofstream&, T1, T2); - - // Arguments for manipulator function - T1 val1; - T2 val2; - }; - -/*****************************************************************************/ - -// Manipulator function thunks through to stream buffer -inline gzofstream& -setcompression(gzofstream &gzs, int l, int s = Z_DEFAULT_STRATEGY) -{ - (gzs.rdbuf())->setcompression(l, s); - return gzs; -} - -// Manipulator constructor stores arguments -template - inline - gzomanip2::gzomanip2(gzofstream &(*f)(gzofstream &, T1, T2), - T1 v1, - T2 v2) - : func(f), val1(v1), val2(v2) - { } - -// Insertor applies underlying manipulator function to stream -template - inline gzofstream& - operator<<(gzofstream& s, const gzomanip2& m) - { return (*m.func)(s, m.val1, m.val2); } - -// Insert this onto stream to simplify setting of compression level -inline gzomanip2 -setcompression(int l, int s = Z_DEFAULT_STRATEGY) -{ return gzomanip2(&setcompression, l, s); } - -#endif // ZFSTREAM_H diff --git a/compat/zlib/contrib/masmx64/bld_ml64.bat b/compat/zlib/contrib/masmx64/bld_ml64.bat deleted file mode 100644 index 8f9343d..0000000 --- a/compat/zlib/contrib/masmx64/bld_ml64.bat +++ /dev/null @@ -1,2 +0,0 @@ -ml64.exe /Flinffasx64 /c /Zi inffasx64.asm -ml64.exe /Flgvmat64 /c /Zi gvmat64.asm diff --git a/compat/zlib/contrib/masmx64/gvmat64.asm b/compat/zlib/contrib/masmx64/gvmat64.asm deleted file mode 100644 index 9879c28..0000000 --- a/compat/zlib/contrib/masmx64/gvmat64.asm +++ /dev/null @@ -1,553 +0,0 @@ -;uInt longest_match_x64( -; deflate_state *s, -; IPos cur_match); /* current match */ - -; gvmat64.asm -- Asm portion of the optimized longest_match for 32 bits x86_64 -; (AMD64 on Athlon 64, Opteron, Phenom -; and Intel EM64T on Pentium 4 with EM64T, Pentium D, Core 2 Duo, Core I5/I7) -; Copyright (C) 1995-2010 Jean-loup Gailly, Brian Raiter and Gilles Vollant. -; -; File written by Gilles Vollant, by converting to assembly the longest_match -; from Jean-loup Gailly in deflate.c of zLib and infoZip zip. -; -; and by taking inspiration on asm686 with masm, optimised assembly code -; from Brian Raiter, written 1998 -; -; This software is provided 'as-is', without any express or implied -; warranty. In no event will the authors be held liable for any damages -; arising from the use of this software. -; -; Permission is granted to anyone to use this software for any purpose, -; including commercial applications, and to alter it and redistribute it -; freely, subject to the following restrictions: -; -; 1. The origin of this software must not be misrepresented; you must not -; claim that you wrote the original software. If you use this software -; in a product, an acknowledgment in the product documentation would be -; appreciated but is not required. -; 2. Altered source versions must be plainly marked as such, and must not be -; misrepresented as being the original software -; 3. This notice may not be removed or altered from any source distribution. -; -; -; -; http://www.zlib.net -; http://www.winimage.com/zLibDll -; http://www.muppetlabs.com/~breadbox/software/assembly.html -; -; to compile this file for infozip Zip, I use option: -; ml64.exe /Flgvmat64 /c /Zi /DINFOZIP gvmat64.asm -; -; to compile this file for zLib, I use option: -; ml64.exe /Flgvmat64 /c /Zi gvmat64.asm -; Be carrefull to adapt zlib1222add below to your version of zLib -; (if you use a version of zLib before 1.0.4 or after 1.2.2.2, change -; value of zlib1222add later) -; -; This file compile with Microsoft Macro Assembler (x64) for AMD64 -; -; ml64.exe is given with Visual Studio 2005/2008/2010 and Windows WDK -; -; (you can get Windows WDK with ml64 for AMD64 from -; http://www.microsoft.com/whdc/Devtools/wdk/default.mspx for low price) -; - - -;uInt longest_match(s, cur_match) -; deflate_state *s; -; IPos cur_match; /* current match */ -.code -longest_match PROC - - -;LocalVarsSize equ 88 - LocalVarsSize equ 72 - -; register used : rax,rbx,rcx,rdx,rsi,rdi,r8,r9,r10,r11,r12 -; free register : r14,r15 -; register can be saved : rsp - - chainlenwmask equ rsp + 8 - LocalVarsSize ; high word: current chain len - ; low word: s->wmask -;window equ rsp + xx - LocalVarsSize ; local copy of s->window ; stored in r10 -;windowbestlen equ rsp + xx - LocalVarsSize ; s->window + bestlen , use r10+r11 -;scanstart equ rsp + xx - LocalVarsSize ; first two bytes of string ; stored in r12w -;scanend equ rsp + xx - LocalVarsSize ; last two bytes of string use ebx -;scanalign equ rsp + xx - LocalVarsSize ; dword-misalignment of string r13 -;bestlen equ rsp + xx - LocalVarsSize ; size of best match so far -> r11d -;scan equ rsp + xx - LocalVarsSize ; ptr to string wanting match -> r9 -IFDEF INFOZIP -ELSE - nicematch equ (rsp + 16 - LocalVarsSize) ; a good enough match size -ENDIF - -save_rdi equ rsp + 24 - LocalVarsSize -save_rsi equ rsp + 32 - LocalVarsSize -save_rbx equ rsp + 40 - LocalVarsSize -save_rbp equ rsp + 48 - LocalVarsSize -save_r12 equ rsp + 56 - LocalVarsSize -save_r13 equ rsp + 64 - LocalVarsSize -;save_r14 equ rsp + 72 - LocalVarsSize -;save_r15 equ rsp + 80 - LocalVarsSize - - -; summary of register usage -; scanend ebx -; scanendw bx -; chainlenwmask edx -; curmatch rsi -; curmatchd esi -; windowbestlen r8 -; scanalign r9 -; scanalignd r9d -; window r10 -; bestlen r11 -; bestlend r11d -; scanstart r12d -; scanstartw r12w -; scan r13 -; nicematch r14d -; limit r15 -; limitd r15d -; prev rcx - -; all the +4 offsets are due to the addition of pending_buf_size (in zlib -; in the deflate_state structure since the asm code was first written -; (if you compile with zlib 1.0.4 or older, remove the +4). -; Note : these value are good with a 8 bytes boundary pack structure - - - MAX_MATCH equ 258 - MIN_MATCH equ 3 - MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1) - - -;;; Offsets for fields in the deflate_state structure. These numbers -;;; are calculated from the definition of deflate_state, with the -;;; assumption that the compiler will dword-align the fields. (Thus, -;;; changing the definition of deflate_state could easily cause this -;;; program to crash horribly, without so much as a warning at -;;; compile time. Sigh.) - -; all the +zlib1222add offsets are due to the addition of fields -; in zlib in the deflate_state structure since the asm code was first written -; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). -; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). -; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). - - -IFDEF INFOZIP - -_DATA SEGMENT -COMM window_size:DWORD -; WMask ; 7fff -COMM window:BYTE:010040H -COMM prev:WORD:08000H -; MatchLen : unused -; PrevMatch : unused -COMM strstart:DWORD -COMM match_start:DWORD -; Lookahead : ignore -COMM prev_length:DWORD ; PrevLen -COMM max_chain_length:DWORD -COMM good_match:DWORD -COMM nice_match:DWORD -prev_ad equ OFFSET prev -window_ad equ OFFSET window -nicematch equ nice_match -_DATA ENDS -WMask equ 07fffh - -ELSE - - IFNDEF zlib1222add - zlib1222add equ 8 - ENDIF -dsWSize equ 56+zlib1222add+(zlib1222add/2) -dsWMask equ 64+zlib1222add+(zlib1222add/2) -dsWindow equ 72+zlib1222add -dsPrev equ 88+zlib1222add -dsMatchLen equ 128+zlib1222add -dsPrevMatch equ 132+zlib1222add -dsStrStart equ 140+zlib1222add -dsMatchStart equ 144+zlib1222add -dsLookahead equ 148+zlib1222add -dsPrevLen equ 152+zlib1222add -dsMaxChainLen equ 156+zlib1222add -dsGoodMatch equ 172+zlib1222add -dsNiceMatch equ 176+zlib1222add - -window_size equ [ rcx + dsWSize] -WMask equ [ rcx + dsWMask] -window_ad equ [ rcx + dsWindow] -prev_ad equ [ rcx + dsPrev] -strstart equ [ rcx + dsStrStart] -match_start equ [ rcx + dsMatchStart] -Lookahead equ [ rcx + dsLookahead] ; 0ffffffffh on infozip -prev_length equ [ rcx + dsPrevLen] -max_chain_length equ [ rcx + dsMaxChainLen] -good_match equ [ rcx + dsGoodMatch] -nice_match equ [ rcx + dsNiceMatch] -ENDIF - -; parameter 1 in r8(deflate state s), param 2 in rdx (cur match) - -; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and -; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp -; -; All registers must be preserved across the call, except for -; rax, rcx, rdx, r8, r9, r10, and r11, which are scratch. - - - -;;; Save registers that the compiler may be using, and adjust esp to -;;; make room for our stack frame. - - -;;; Retrieve the function arguments. r8d will hold cur_match -;;; throughout the entire function. edx will hold the pointer to the -;;; deflate_state structure during the function's setup (before -;;; entering the main loop. - -; parameter 1 in rcx (deflate_state* s), param 2 in edx -> r8 (cur match) - -; this clear high 32 bits of r8, which can be garbage in both r8 and rdx - - mov [save_rdi],rdi - mov [save_rsi],rsi - mov [save_rbx],rbx - mov [save_rbp],rbp -IFDEF INFOZIP - mov r8d,ecx -ELSE - mov r8d,edx -ENDIF - mov [save_r12],r12 - mov [save_r13],r13 -; mov [save_r14],r14 -; mov [save_r15],r15 - - -;;; uInt wmask = s->w_mask; -;;; unsigned chain_length = s->max_chain_length; -;;; if (s->prev_length >= s->good_match) { -;;; chain_length >>= 2; -;;; } - - mov edi, prev_length - mov esi, good_match - mov eax, WMask - mov ebx, max_chain_length - cmp edi, esi - jl LastMatchGood - shr ebx, 2 -LastMatchGood: - -;;; chainlen is decremented once beforehand so that the function can -;;; use the sign flag instead of the zero flag for the exit test. -;;; It is then shifted into the high word, to make room for the wmask -;;; value, which it will always accompany. - - dec ebx - shl ebx, 16 - or ebx, eax - -;;; on zlib only -;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - -IFDEF INFOZIP - mov [chainlenwmask], ebx -; on infozip nice_match = [nice_match] -ELSE - mov eax, nice_match - mov [chainlenwmask], ebx - mov r10d, Lookahead - cmp r10d, eax - cmovnl r10d, eax - mov [nicematch],r10d -ENDIF - -;;; register Bytef *scan = s->window + s->strstart; - mov r10, window_ad - mov ebp, strstart - lea r13, [r10 + rbp] - -;;; Determine how many bytes the scan ptr is off from being -;;; dword-aligned. - - mov r9,r13 - neg r13 - and r13,3 - -;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? -;;; s->strstart - (IPos)MAX_DIST(s) : NIL; -IFDEF INFOZIP - mov eax,07efah ; MAX_DIST = (WSIZE-MIN_LOOKAHEAD) (0x8000-(3+8+1)) -ELSE - mov eax, window_size - sub eax, MIN_LOOKAHEAD -ENDIF - xor edi,edi - sub ebp, eax - - mov r11d, prev_length - - cmovng ebp,edi - -;;; int best_len = s->prev_length; - - -;;; Store the sum of s->window + best_len in esi locally, and in esi. - - lea rsi,[r10+r11] - -;;; register ush scan_start = *(ushf*)scan; -;;; register ush scan_end = *(ushf*)(scan+best_len-1); -;;; Posf *prev = s->prev; - - movzx r12d,word ptr [r9] - movzx ebx, word ptr [r9 + r11 - 1] - - mov rdi, prev_ad - -;;; Jump into the main loop. - - mov edx, [chainlenwmask] - - cmp bx,word ptr [rsi + r8 - 1] - jz LookupLoopIsZero - -LookupLoop1: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow - -LoopEntry1: - cmp bx,word ptr [rsi + r8 - 1] - jz LookupLoopIsZero - -LookupLoop2: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow - -LoopEntry2: - cmp bx,word ptr [rsi + r8 - 1] - jz LookupLoopIsZero - -LookupLoop4: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow - -LoopEntry4: - - cmp bx,word ptr [rsi + r8 - 1] - jnz LookupLoop1 - jmp LookupLoopIsZero - - -;;; do { -;;; match = s->window + cur_match; -;;; if (*(ushf*)(match+best_len-1) != scan_end || -;;; *(ushf*)match != scan_start) continue; -;;; [...] -;;; } while ((cur_match = prev[cur_match & wmask]) > limit -;;; && --chain_length != 0); -;;; -;;; Here is the inner loop of the function. The function will spend the -;;; majority of its time in this loop, and majority of that time will -;;; be spent in the first ten instructions. -;;; -;;; Within this loop: -;;; ebx = scanend -;;; r8d = curmatch -;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) -;;; esi = windowbestlen - i.e., (window + bestlen) -;;; edi = prev -;;; ebp = limit - -LookupLoop: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow - -LoopEntry: - - cmp bx,word ptr [rsi + r8 - 1] - jnz LookupLoop1 -LookupLoopIsZero: - cmp r12w, word ptr [r10 + r8] - jnz LookupLoop1 - - -;;; Store the current value of chainlen. - mov [chainlenwmask], edx - -;;; Point edi to the string under scrutiny, and esi to the string we -;;; are hoping to match it up with. In actuality, esi and edi are -;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is -;;; initialized to -(MAX_MATCH_8 - scanalign). - - lea rsi,[r8+r10] - mov rdx, 0fffffffffffffef8h; -(MAX_MATCH_8) - lea rsi, [rsi + r13 + 0108h] ;MAX_MATCH_8] - lea rdi, [r9 + r13 + 0108h] ;MAX_MATCH_8] - - prefetcht1 [rsi+rdx] - prefetcht1 [rdi+rdx] - - -;;; Test the strings for equality, 8 bytes at a time. At the end, -;;; adjust rdx so that it is offset to the exact byte that mismatched. -;;; -;;; We already know at this point that the first three bytes of the -;;; strings match each other, and they can be safely passed over before -;;; starting the compare loop. So what this code does is skip over 0-3 -;;; bytes, as much as necessary in order to dword-align the edi -;;; pointer. (rsi will still be misaligned three times out of four.) -;;; -;;; It should be confessed that this loop usually does not represent -;;; much of the total running time. Replacing it with a more -;;; straightforward "rep cmpsb" would not drastically degrade -;;; performance. - - -LoopCmps: - mov rax, [rsi + rdx] - xor rax, [rdi + rdx] - jnz LeaveLoopCmps - - mov rax, [rsi + rdx + 8] - xor rax, [rdi + rdx + 8] - jnz LeaveLoopCmps8 - - - mov rax, [rsi + rdx + 8+8] - xor rax, [rdi + rdx + 8+8] - jnz LeaveLoopCmps16 - - add rdx,8+8+8 - - jnz short LoopCmps - jmp short LenMaximum -LeaveLoopCmps16: add rdx,8 -LeaveLoopCmps8: add rdx,8 -LeaveLoopCmps: - - test eax, 0000FFFFh - jnz LenLower - - test eax,0ffffffffh - - jnz LenLower32 - - add rdx,4 - shr rax,32 - or ax,ax - jnz LenLower - -LenLower32: - shr eax,16 - add rdx,2 -LenLower: sub al, 1 - adc rdx, 0 -;;; Calculate the length of the match. If it is longer than MAX_MATCH, -;;; then automatically accept it as the best possible match and leave. - - lea rax, [rdi + rdx] - sub rax, r9 - cmp eax, MAX_MATCH - jge LenMaximum - -;;; If the length of the match is not longer than the best match we -;;; have so far, then forget it and return to the lookup loop. -;/////////////////////////////////// - - cmp eax, r11d - jg LongerMatch - - lea rsi,[r10+r11] - - mov rdi, prev_ad - mov edx, [chainlenwmask] - jmp LookupLoop - -;;; s->match_start = cur_match; -;;; best_len = len; -;;; if (len >= nice_match) break; -;;; scan_end = *(ushf*)(scan+best_len-1); - -LongerMatch: - mov r11d, eax - mov match_start, r8d - cmp eax, [nicematch] - jge LeaveNow - - lea rsi,[r10+rax] - - movzx ebx, word ptr [r9 + rax - 1] - mov rdi, prev_ad - mov edx, [chainlenwmask] - jmp LookupLoop - -;;; Accept the current string, with the maximum possible length. - -LenMaximum: - mov r11d,MAX_MATCH - mov match_start, r8d - -;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len; -;;; return s->lookahead; - -LeaveNow: -IFDEF INFOZIP - mov eax,r11d -ELSE - mov eax, Lookahead - cmp r11d, eax - cmovng eax, r11d -ENDIF - -;;; Restore the stack and return from whence we came. - - - mov rsi,[save_rsi] - mov rdi,[save_rdi] - mov rbx,[save_rbx] - mov rbp,[save_rbp] - mov r12,[save_r12] - mov r13,[save_r13] -; mov r14,[save_r14] -; mov r15,[save_r15] - - - ret 0 -; please don't remove this string ! -; Your can freely use gvmat64 in any free or commercial app -; but it is far better don't remove the string in the binary! - db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998, converted to amd 64 by Gilles Vollant 2005",0dh,0ah,0 -longest_match ENDP - -match_init PROC - ret 0 -match_init ENDP - - -END diff --git a/compat/zlib/contrib/masmx64/inffas8664.c b/compat/zlib/contrib/masmx64/inffas8664.c deleted file mode 100644 index e8af06f..0000000 --- a/compat/zlib/contrib/masmx64/inffas8664.c +++ /dev/null @@ -1,186 +0,0 @@ -/* inffas8664.c is a hand tuned assembler version of inffast.c - fast decoding - * version for AMD64 on Windows using Microsoft C compiler - * - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Copyright (C) 2003 Chris Anderson - * Please use the copyright conditions above. - * - * 2005 - Adaptation to Microsoft C Compiler for AMD64 by Gilles Vollant - * - * inffas8664.c call function inffas8664fnc in inffasx64.asm - * inffasx64.asm is automatically convert from AMD64 portion of inffas86.c - * - * Dec-29-2003 -- I added AMD64 inflate asm support. This version is also - * slightly quicker on x86 systems because, instead of using rep movsb to copy - * data, it uses rep movsw, which moves data in 2-byte chunks instead of single - * bytes. I've tested the AMD64 code on a Fedora Core 1 + the x86_64 updates - * from http://fedora.linux.duke.edu/fc1_x86_64 - * which is running on an Athlon 64 3000+ / Gigabyte GA-K8VT800M system with - * 1GB ram. The 64-bit version is about 4% faster than the 32-bit version, - * when decompressing mozilla-source-1.3.tar.gz. - * - * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from - * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at - * the moment. I have successfully compiled and tested this code with gcc2.96, - * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S - * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX - * enabled. I will attempt to merge the MMX code into this version. Newer - * versions of this and inffast.S can be found at - * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/ - * - */ - -#include -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -/* Mark Adler's comments from inffast.c: */ - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state->mode == LEN - strm->avail_in >= 6 - strm->avail_out >= 258 - start >= strm->avail_out - state->bits < 8 - - On return, state->mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm->avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm->avail_out >= 258 for each loop to avoid checking for - output space. - */ - - - - typedef struct inffast_ar { -/* 64 32 x86 x86_64 */ -/* ar offset register */ -/* 0 0 */ void *esp; /* esp save */ -/* 8 4 */ void *ebp; /* ebp save */ -/* 16 8 */ unsigned char FAR *in; /* esi rsi local strm->next_in */ -/* 24 12 */ unsigned char FAR *last; /* r9 while in < last */ -/* 32 16 */ unsigned char FAR *out; /* edi rdi local strm->next_out */ -/* 40 20 */ unsigned char FAR *beg; /* inflate()'s init next_out */ -/* 48 24 */ unsigned char FAR *end; /* r10 while out < end */ -/* 56 28 */ unsigned char FAR *window;/* size of window, wsize!=0 */ -/* 64 32 */ code const FAR *lcode; /* ebp rbp local strm->lencode */ -/* 72 36 */ code const FAR *dcode; /* r11 local strm->distcode */ -/* 80 40 */ size_t /*unsigned long */hold; /* edx rdx local strm->hold */ -/* 88 44 */ unsigned bits; /* ebx rbx local strm->bits */ -/* 92 48 */ unsigned wsize; /* window size */ -/* 96 52 */ unsigned write; /* window write index */ -/*100 56 */ unsigned lmask; /* r12 mask for lcode */ -/*104 60 */ unsigned dmask; /* r13 mask for dcode */ -/*108 64 */ unsigned len; /* r14 match length */ -/*112 68 */ unsigned dist; /* r15 match distance */ -/*116 72 */ unsigned status; /* set when state chng*/ - } type_ar; -#ifdef ASMINF - -void inflate_fast(strm, start) -z_streamp strm; -unsigned start; /* inflate()'s starting value for strm->avail_out */ -{ - struct inflate_state FAR *state; - type_ar ar; - void inffas8664fnc(struct inffast_ar * par); - - - -#if (defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 )) || (defined(_MSC_VER) && defined(_M_AMD64)) -#define PAD_AVAIL_IN 6 -#define PAD_AVAIL_OUT 258 -#else -#define PAD_AVAIL_IN 5 -#define PAD_AVAIL_OUT 257 -#endif - - /* copy state to local variables */ - state = (struct inflate_state FAR *)strm->state; - - ar.in = strm->next_in; - ar.last = ar.in + (strm->avail_in - PAD_AVAIL_IN); - ar.out = strm->next_out; - ar.beg = ar.out - (start - strm->avail_out); - ar.end = ar.out + (strm->avail_out - PAD_AVAIL_OUT); - ar.wsize = state->wsize; - ar.write = state->wnext; - ar.window = state->window; - ar.hold = state->hold; - ar.bits = state->bits; - ar.lcode = state->lencode; - ar.dcode = state->distcode; - ar.lmask = (1U << state->lenbits) - 1; - ar.dmask = (1U << state->distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - - /* align in on 1/2 hold size boundary */ - while (((size_t)(void *)ar.in & (sizeof(ar.hold) / 2 - 1)) != 0) { - ar.hold += (unsigned long)*ar.in++ << ar.bits; - ar.bits += 8; - } - - inffas8664fnc(&ar); - - if (ar.status > 1) { - if (ar.status == 2) - strm->msg = "invalid literal/length code"; - else if (ar.status == 3) - strm->msg = "invalid distance code"; - else - strm->msg = "invalid distance too far back"; - state->mode = BAD; - } - else if ( ar.status == 1 ) { - state->mode = TYPE; - } - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - ar.len = ar.bits >> 3; - ar.in -= ar.len; - ar.bits -= ar.len << 3; - ar.hold &= (1U << ar.bits) - 1; - - /* update state and return */ - strm->next_in = ar.in; - strm->next_out = ar.out; - strm->avail_in = (unsigned)(ar.in < ar.last ? - PAD_AVAIL_IN + (ar.last - ar.in) : - PAD_AVAIL_IN - (ar.in - ar.last)); - strm->avail_out = (unsigned)(ar.out < ar.end ? - PAD_AVAIL_OUT + (ar.end - ar.out) : - PAD_AVAIL_OUT - (ar.out - ar.end)); - state->hold = (unsigned long)ar.hold; - state->bits = ar.bits; - return; -} - -#endif diff --git a/compat/zlib/contrib/masmx64/inffasx64.asm b/compat/zlib/contrib/masmx64/inffasx64.asm deleted file mode 100644 index 60a8d89..0000000 --- a/compat/zlib/contrib/masmx64/inffasx64.asm +++ /dev/null @@ -1,396 +0,0 @@ -; inffasx64.asm is a hand tuned assembler version of inffast.c - fast decoding -; version for AMD64 on Windows using Microsoft C compiler -; -; inffasx64.asm is automatically convert from AMD64 portion of inffas86.c -; inffasx64.asm is called by inffas8664.c, which contain more info. - - -; to compile this file, I use option -; ml64.exe /Flinffasx64 /c /Zi inffasx64.asm -; with Microsoft Macro Assembler (x64) for AMD64 -; - -; This file compile with Microsoft Macro Assembler (x64) for AMD64 -; -; ml64.exe is given with Visual Studio 2005/2008/2010 and Windows WDK -; -; (you can get Windows WDK with ml64 for AMD64 from -; http://www.microsoft.com/whdc/Devtools/wdk/default.mspx for low price) -; - - -.code -inffas8664fnc PROC - -; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and -; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp -; -; All registers must be preserved across the call, except for -; rax, rcx, rdx, r8, r-9, r10, and r11, which are scratch. - - - mov [rsp-8],rsi - mov [rsp-16],rdi - mov [rsp-24],r12 - mov [rsp-32],r13 - mov [rsp-40],r14 - mov [rsp-48],r15 - mov [rsp-56],rbx - - mov rax,rcx - - mov [rax+8], rbp ; /* save regs rbp and rsp */ - mov [rax], rsp - - mov rsp, rax ; /* make rsp point to &ar */ - - mov rsi, [rsp+16] ; /* rsi = in */ - mov rdi, [rsp+32] ; /* rdi = out */ - mov r9, [rsp+24] ; /* r9 = last */ - mov r10, [rsp+48] ; /* r10 = end */ - mov rbp, [rsp+64] ; /* rbp = lcode */ - mov r11, [rsp+72] ; /* r11 = dcode */ - mov rdx, [rsp+80] ; /* rdx = hold */ - mov ebx, [rsp+88] ; /* ebx = bits */ - mov r12d, [rsp+100] ; /* r12d = lmask */ - mov r13d, [rsp+104] ; /* r13d = dmask */ - ; /* r14d = len */ - ; /* r15d = dist */ - - - cld - cmp r10, rdi - je L_one_time ; /* if only one decode left */ - cmp r9, rsi - - jne L_do_loop - - -L_one_time: - mov r8, r12 ; /* r8 = lmask */ - cmp bl, 32 - ja L_get_length_code_one_time - - lodsd ; /* eax = *(uint *)in++ */ - mov cl, bl ; /* cl = bits, needs it for shifting */ - add bl, 32 ; /* bits += 32 */ - shl rax, cl - or rdx, rax ; /* hold |= *((uint *)in)++ << bits */ - jmp L_get_length_code_one_time - -ALIGN 4 -L_while_test: - cmp r10, rdi - jbe L_break_loop - cmp r9, rsi - jbe L_break_loop - -L_do_loop: - mov r8, r12 ; /* r8 = lmask */ - cmp bl, 32 - ja L_get_length_code ; /* if (32 < bits) */ - - lodsd ; /* eax = *(uint *)in++ */ - mov cl, bl ; /* cl = bits, needs it for shifting */ - add bl, 32 ; /* bits += 32 */ - shl rax, cl - or rdx, rax ; /* hold |= *((uint *)in)++ << bits */ - -L_get_length_code: - and r8, rdx ; /* r8 &= hold */ - mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */ - - mov cl, ah ; /* cl = this.bits */ - sub bl, ah ; /* bits -= this.bits */ - shr rdx, cl ; /* hold >>= this.bits */ - - test al, al - jnz L_test_for_length_base ; /* if (op != 0) 45.7% */ - - mov r8, r12 ; /* r8 = lmask */ - shr eax, 16 ; /* output this.val char */ - stosb - -L_get_length_code_one_time: - and r8, rdx ; /* r8 &= hold */ - mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */ - -L_dolen: - mov cl, ah ; /* cl = this.bits */ - sub bl, ah ; /* bits -= this.bits */ - shr rdx, cl ; /* hold >>= this.bits */ - - test al, al - jnz L_test_for_length_base ; /* if (op != 0) 45.7% */ - - shr eax, 16 ; /* output this.val char */ - stosb - jmp L_while_test - -ALIGN 4 -L_test_for_length_base: - mov r14d, eax ; /* len = this */ - shr r14d, 16 ; /* len = this.val */ - mov cl, al - - test al, 16 - jz L_test_for_second_level_length ; /* if ((op & 16) == 0) 8% */ - and cl, 15 ; /* op &= 15 */ - jz L_decode_distance ; /* if (!op) */ - -L_add_bits_to_len: - sub bl, cl - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx ; /* eax &= hold */ - shr rdx, cl - add r14d, eax ; /* len += hold & mask[op] */ - -L_decode_distance: - mov r8, r13 ; /* r8 = dmask */ - cmp bl, 32 - ja L_get_distance_code ; /* if (32 < bits) */ - - lodsd ; /* eax = *(uint *)in++ */ - mov cl, bl ; /* cl = bits, needs it for shifting */ - add bl, 32 ; /* bits += 32 */ - shl rax, cl - or rdx, rax ; /* hold |= *((uint *)in)++ << bits */ - -L_get_distance_code: - and r8, rdx ; /* r8 &= hold */ - mov eax, [r11+r8*4] ; /* eax = dcode[hold & dmask] */ - -L_dodist: - mov r15d, eax ; /* dist = this */ - shr r15d, 16 ; /* dist = this.val */ - mov cl, ah - sub bl, ah ; /* bits -= this.bits */ - shr rdx, cl ; /* hold >>= this.bits */ - mov cl, al ; /* cl = this.op */ - - test al, 16 ; /* if ((op & 16) == 0) */ - jz L_test_for_second_level_dist - and cl, 15 ; /* op &= 15 */ - jz L_check_dist_one - -L_add_bits_to_dist: - sub bl, cl - xor eax, eax - inc eax - shl eax, cl - dec eax ; /* (1 << op) - 1 */ - and eax, edx ; /* eax &= hold */ - shr rdx, cl - add r15d, eax ; /* dist += hold & ((1 << op) - 1) */ - -L_check_window: - mov r8, rsi ; /* save in so from can use it's reg */ - mov rax, rdi - sub rax, [rsp+40] ; /* nbytes = out - beg */ - - cmp eax, r15d - jb L_clip_window ; /* if (dist > nbytes) 4.2% */ - - mov ecx, r14d ; /* ecx = len */ - mov rsi, rdi - sub rsi, r15 ; /* from = out - dist */ - - sar ecx, 1 - jnc L_copy_two ; /* if len % 2 == 0 */ - - rep movsw - mov al, [rsi] - mov [rdi], al - inc rdi - - mov rsi, r8 ; /* move in back to %rsi, toss from */ - jmp L_while_test - -L_copy_two: - rep movsw - mov rsi, r8 ; /* move in back to %rsi, toss from */ - jmp L_while_test - -ALIGN 4 -L_check_dist_one: - cmp r15d, 1 ; /* if dist 1, is a memset */ - jne L_check_window - cmp [rsp+40], rdi ; /* if out == beg, outside window */ - je L_check_window - - mov ecx, r14d ; /* ecx = len */ - mov al, [rdi-1] - mov ah, al - - sar ecx, 1 - jnc L_set_two - mov [rdi], al - inc rdi - -L_set_two: - rep stosw - jmp L_while_test - -ALIGN 4 -L_test_for_second_level_length: - test al, 64 - jnz L_test_for_end_of_block ; /* if ((op & 64) != 0) */ - - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx ; /* eax &= hold */ - add eax, r14d ; /* eax += len */ - mov eax, [rbp+rax*4] ; /* eax = lcode[val+(hold&mask[op])]*/ - jmp L_dolen - -ALIGN 4 -L_test_for_second_level_dist: - test al, 64 - jnz L_invalid_distance_code ; /* if ((op & 64) != 0) */ - - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx ; /* eax &= hold */ - add eax, r15d ; /* eax += dist */ - mov eax, [r11+rax*4] ; /* eax = dcode[val+(hold&mask[op])]*/ - jmp L_dodist - -ALIGN 4 -L_clip_window: - mov ecx, eax ; /* ecx = nbytes */ - mov eax, [rsp+92] ; /* eax = wsize, prepare for dist cmp */ - neg ecx ; /* nbytes = -nbytes */ - - cmp eax, r15d - jb L_invalid_distance_too_far ; /* if (dist > wsize) */ - - add ecx, r15d ; /* nbytes = dist - nbytes */ - cmp dword ptr [rsp+96], 0 - jne L_wrap_around_window ; /* if (write != 0) */ - - mov rsi, [rsp+56] ; /* from = window */ - sub eax, ecx ; /* eax -= nbytes */ - add rsi, rax ; /* from += wsize - nbytes */ - - mov eax, r14d ; /* eax = len */ - cmp r14d, ecx - jbe L_do_copy ; /* if (nbytes >= len) */ - - sub eax, ecx ; /* eax -= nbytes */ - rep movsb - mov rsi, rdi - sub rsi, r15 ; /* from = &out[ -dist ] */ - jmp L_do_copy - -ALIGN 4 -L_wrap_around_window: - mov eax, [rsp+96] ; /* eax = write */ - cmp ecx, eax - jbe L_contiguous_in_window ; /* if (write >= nbytes) */ - - mov esi, [rsp+92] ; /* from = wsize */ - add rsi, [rsp+56] ; /* from += window */ - add rsi, rax ; /* from += write */ - sub rsi, rcx ; /* from -= nbytes */ - sub ecx, eax ; /* nbytes -= write */ - - mov eax, r14d ; /* eax = len */ - cmp eax, ecx - jbe L_do_copy ; /* if (nbytes >= len) */ - - sub eax, ecx ; /* len -= nbytes */ - rep movsb - mov rsi, [rsp+56] ; /* from = window */ - mov ecx, [rsp+96] ; /* nbytes = write */ - cmp eax, ecx - jbe L_do_copy ; /* if (nbytes >= len) */ - - sub eax, ecx ; /* len -= nbytes */ - rep movsb - mov rsi, rdi - sub rsi, r15 ; /* from = out - dist */ - jmp L_do_copy - -ALIGN 4 -L_contiguous_in_window: - mov rsi, [rsp+56] ; /* rsi = window */ - add rsi, rax - sub rsi, rcx ; /* from += write - nbytes */ - - mov eax, r14d ; /* eax = len */ - cmp eax, ecx - jbe L_do_copy ; /* if (nbytes >= len) */ - - sub eax, ecx ; /* len -= nbytes */ - rep movsb - mov rsi, rdi - sub rsi, r15 ; /* from = out - dist */ - jmp L_do_copy ; /* if (nbytes >= len) */ - -ALIGN 4 -L_do_copy: - mov ecx, eax ; /* ecx = len */ - rep movsb - - mov rsi, r8 ; /* move in back to %esi, toss from */ - jmp L_while_test - -L_test_for_end_of_block: - test al, 32 - jz L_invalid_literal_length_code - mov dword ptr [rsp+116], 1 - jmp L_break_loop_with_status - -L_invalid_literal_length_code: - mov dword ptr [rsp+116], 2 - jmp L_break_loop_with_status - -L_invalid_distance_code: - mov dword ptr [rsp+116], 3 - jmp L_break_loop_with_status - -L_invalid_distance_too_far: - mov dword ptr [rsp+116], 4 - jmp L_break_loop_with_status - -L_break_loop: - mov dword ptr [rsp+116], 0 - -L_break_loop_with_status: -; /* put in, out, bits, and hold back into ar and pop esp */ - mov [rsp+16], rsi ; /* in */ - mov [rsp+32], rdi ; /* out */ - mov [rsp+88], ebx ; /* bits */ - mov [rsp+80], rdx ; /* hold */ - - mov rax, [rsp] ; /* restore rbp and rsp */ - mov rbp, [rsp+8] - mov rsp, rax - - - - mov rsi,[rsp-8] - mov rdi,[rsp-16] - mov r12,[rsp-24] - mov r13,[rsp-32] - mov r14,[rsp-40] - mov r15,[rsp-48] - mov rbx,[rsp-56] - - ret 0 -; : -; : "m" (ar) -; : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", -; "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" -; ); - -inffas8664fnc ENDP -;_TEXT ENDS -END diff --git a/compat/zlib/contrib/masmx64/readme.txt b/compat/zlib/contrib/masmx64/readme.txt deleted file mode 100644 index 2da6733..0000000 --- a/compat/zlib/contrib/masmx64/readme.txt +++ /dev/null @@ -1,31 +0,0 @@ -Summary -------- -This directory contains ASM implementations of the functions -longest_match() and inflate_fast(), for 64 bits x86 (both AMD64 and Intel EM64t), -for use with Microsoft Macro Assembler (x64) for AMD64 and Microsoft C++ 64 bits. - -gvmat64.asm is written by Gilles Vollant (2005), by using Brian Raiter 686/32 bits - assembly optimized version from Jean-loup Gailly original longest_match function - -inffasx64.asm and inffas8664.c were written by Chris Anderson, by optimizing - original function from Mark Adler - -Use instructions ----------------- -Assemble the .asm files using MASM and put the object files into the zlib source -directory. You can also get object files here: - - http://www.winimage.com/zLibDll/zlib124_masm_obj.zip - -define ASMV and ASMINF in your project. Include inffas8664.c in your source tree, -and inffasx64.obj and gvmat64.obj as object to link. - - -Build instructions ------------------- -run bld_64.bat with Microsoft Macro Assembler (x64) for AMD64 (ml64.exe) - -ml64.exe is given with Visual Studio 2005, Windows 2003 server DDK - -You can get Windows 2003 server DDK with ml64 and cl for AMD64 from - http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price) diff --git a/compat/zlib/contrib/masmx86/bld_ml32.bat b/compat/zlib/contrib/masmx86/bld_ml32.bat deleted file mode 100644 index e1b86bf..0000000 --- a/compat/zlib/contrib/masmx86/bld_ml32.bat +++ /dev/null @@ -1,2 +0,0 @@ -ml /coff /Zi /c /Flmatch686.lst match686.asm -ml /coff /Zi /c /Flinffas32.lst inffas32.asm diff --git a/compat/zlib/contrib/masmx86/inffas32.asm b/compat/zlib/contrib/masmx86/inffas32.asm deleted file mode 100644 index 03d20f8..0000000 --- a/compat/zlib/contrib/masmx86/inffas32.asm +++ /dev/null @@ -1,1080 +0,0 @@ -;/* inffas32.asm is a hand tuned assembler version of inffast.c -- fast decoding -; * -; * inffas32.asm is derivated from inffas86.c, with translation of assembly code -; * -; * Copyright (C) 1995-2003 Mark Adler -; * For conditions of distribution and use, see copyright notice in zlib.h -; * -; * Copyright (C) 2003 Chris Anderson -; * Please use the copyright conditions above. -; * -; * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from -; * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at -; * the moment. I have successfully compiled and tested this code with gcc2.96, -; * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S -; * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX -; * enabled. I will attempt to merge the MMX code into this version. Newer -; * versions of this and inffast.S can be found at -; * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/ -; * -; * 2005 : modification by Gilles Vollant -; */ -; For Visual C++ 4.x and higher and ML 6.x and higher -; ml.exe is in directory \MASM611C of Win95 DDK -; ml.exe is also distributed in http://www.masm32.com/masmdl.htm -; and in VC++2003 toolkit at http://msdn.microsoft.com/visualc/vctoolkit2003/ -; -; -; compile with command line option -; ml /coff /Zi /c /Flinffas32.lst inffas32.asm - -; if you define NO_GZIP (see inflate.h), compile with -; ml /coff /Zi /c /Flinffas32.lst /DNO_GUNZIP inffas32.asm - - -; zlib122sup is 0 fort zlib 1.2.2.1 and lower -; zlib122sup is 8 fort zlib 1.2.2.2 and more (with addition of dmax and head -; in inflate_state in inflate.h) -zlib1222sup equ 8 - - -IFDEF GUNZIP - INFLATE_MODE_TYPE equ 11 - INFLATE_MODE_BAD equ 26 -ELSE - IFNDEF NO_GUNZIP - INFLATE_MODE_TYPE equ 11 - INFLATE_MODE_BAD equ 26 - ELSE - INFLATE_MODE_TYPE equ 3 - INFLATE_MODE_BAD equ 17 - ENDIF -ENDIF - - -; 75 "inffast.S" -;FILE "inffast.S" - -;;;GLOBAL _inflate_fast - -;;;SECTION .text - - - - .586p - .mmx - - name inflate_fast_x86 - .MODEL FLAT - -_DATA segment -inflate_fast_use_mmx: - dd 1 - - -_TEXT segment - - - -ALIGN 4 - db 'Fast decoding Code from Chris Anderson' - db 0 - -ALIGN 4 -invalid_literal_length_code_msg: - db 'invalid literal/length code' - db 0 - -ALIGN 4 -invalid_distance_code_msg: - db 'invalid distance code' - db 0 - -ALIGN 4 -invalid_distance_too_far_msg: - db 'invalid distance too far back' - db 0 - - -ALIGN 4 -inflate_fast_mask: -dd 0 -dd 1 -dd 3 -dd 7 -dd 15 -dd 31 -dd 63 -dd 127 -dd 255 -dd 511 -dd 1023 -dd 2047 -dd 4095 -dd 8191 -dd 16383 -dd 32767 -dd 65535 -dd 131071 -dd 262143 -dd 524287 -dd 1048575 -dd 2097151 -dd 4194303 -dd 8388607 -dd 16777215 -dd 33554431 -dd 67108863 -dd 134217727 -dd 268435455 -dd 536870911 -dd 1073741823 -dd 2147483647 -dd 4294967295 - - -mode_state equ 0 ;/* state->mode */ -wsize_state equ (32+zlib1222sup) ;/* state->wsize */ -write_state equ (36+4+zlib1222sup) ;/* state->write */ -window_state equ (40+4+zlib1222sup) ;/* state->window */ -hold_state equ (44+4+zlib1222sup) ;/* state->hold */ -bits_state equ (48+4+zlib1222sup) ;/* state->bits */ -lencode_state equ (64+4+zlib1222sup) ;/* state->lencode */ -distcode_state equ (68+4+zlib1222sup) ;/* state->distcode */ -lenbits_state equ (72+4+zlib1222sup) ;/* state->lenbits */ -distbits_state equ (76+4+zlib1222sup) ;/* state->distbits */ - - -;;SECTION .text -; 205 "inffast.S" -;GLOBAL inflate_fast_use_mmx - -;SECTION .data - - -; GLOBAL inflate_fast_use_mmx:object -;.size inflate_fast_use_mmx, 4 -; 226 "inffast.S" -;SECTION .text - -ALIGN 4 -_inflate_fast proc near -.FPO (16, 4, 0, 0, 1, 0) - push edi - push esi - push ebp - push ebx - pushfd - sub esp,64 - cld - - - - - mov esi, [esp+88] - mov edi, [esi+28] - - - - - - - - mov edx, [esi+4] - mov eax, [esi+0] - - add edx,eax - sub edx,11 - - mov [esp+44],eax - mov [esp+20],edx - - mov ebp, [esp+92] - mov ecx, [esi+16] - mov ebx, [esi+12] - - sub ebp,ecx - neg ebp - add ebp,ebx - - sub ecx,257 - add ecx,ebx - - mov [esp+60],ebx - mov [esp+40],ebp - mov [esp+16],ecx -; 285 "inffast.S" - mov eax, [edi+lencode_state] - mov ecx, [edi+distcode_state] - - mov [esp+8],eax - mov [esp+12],ecx - - mov eax,1 - mov ecx, [edi+lenbits_state] - shl eax,cl - dec eax - mov [esp+0],eax - - mov eax,1 - mov ecx, [edi+distbits_state] - shl eax,cl - dec eax - mov [esp+4],eax - - mov eax, [edi+wsize_state] - mov ecx, [edi+write_state] - mov edx, [edi+window_state] - - mov [esp+52],eax - mov [esp+48],ecx - mov [esp+56],edx - - mov ebp, [edi+hold_state] - mov ebx, [edi+bits_state] -; 321 "inffast.S" - mov esi, [esp+44] - mov ecx, [esp+20] - cmp ecx,esi - ja L_align_long - - add ecx,11 - sub ecx,esi - mov eax,12 - sub eax,ecx - lea edi, [esp+28] - rep movsb - mov ecx,eax - xor eax,eax - rep stosb - lea esi, [esp+28] - mov [esp+20],esi - jmp L_is_aligned - - -L_align_long: - test esi,3 - jz L_is_aligned - xor eax,eax - mov al, [esi] - inc esi - mov ecx,ebx - add ebx,8 - shl eax,cl - or ebp,eax - jmp L_align_long - -L_is_aligned: - mov edi, [esp+60] -; 366 "inffast.S" -L_check_mmx: - cmp dword ptr [inflate_fast_use_mmx],2 - je L_init_mmx - ja L_do_loop - - push eax - push ebx - push ecx - push edx - pushfd - mov eax, [esp] - xor dword ptr [esp],0200000h - - - - - popfd - pushfd - pop edx - xor edx,eax - jz L_dont_use_mmx - xor eax,eax - cpuid - cmp ebx,0756e6547h - jne L_dont_use_mmx - cmp ecx,06c65746eh - jne L_dont_use_mmx - cmp edx,049656e69h - jne L_dont_use_mmx - mov eax,1 - cpuid - shr eax,8 - and eax,15 - cmp eax,6 - jne L_dont_use_mmx - test edx,0800000h - jnz L_use_mmx - jmp L_dont_use_mmx -L_use_mmx: - mov dword ptr [inflate_fast_use_mmx],2 - jmp L_check_mmx_pop -L_dont_use_mmx: - mov dword ptr [inflate_fast_use_mmx],3 -L_check_mmx_pop: - pop edx - pop ecx - pop ebx - pop eax - jmp L_check_mmx -; 426 "inffast.S" -ALIGN 4 -L_do_loop: -; 437 "inffast.S" - cmp bl,15 - ja L_get_length_code - - xor eax,eax - lodsw - mov cl,bl - add bl,16 - shl eax,cl - or ebp,eax - -L_get_length_code: - mov edx, [esp+0] - mov ecx, [esp+8] - and edx,ebp - mov eax, [ecx+edx*4] - -L_dolen: - - - - - - - mov cl,ah - sub bl,ah - shr ebp,cl - - - - - - - test al,al - jnz L_test_for_length_base - - shr eax,16 - stosb - -L_while_test: - - - cmp [esp+16],edi - jbe L_break_loop - - cmp [esp+20],esi - ja L_do_loop - jmp L_break_loop - -L_test_for_length_base: -; 502 "inffast.S" - mov edx,eax - shr edx,16 - mov cl,al - - test al,16 - jz L_test_for_second_level_length - and cl,15 - jz L_save_len - cmp bl,cl - jae L_add_bits_to_len - - mov ch,cl - xor eax,eax - lodsw - mov cl,bl - add bl,16 - shl eax,cl - or ebp,eax - mov cl,ch - -L_add_bits_to_len: - mov eax,1 - shl eax,cl - dec eax - sub bl,cl - and eax,ebp - shr ebp,cl - add edx,eax - -L_save_len: - mov [esp+24],edx - - -L_decode_distance: -; 549 "inffast.S" - cmp bl,15 - ja L_get_distance_code - - xor eax,eax - lodsw - mov cl,bl - add bl,16 - shl eax,cl - or ebp,eax - -L_get_distance_code: - mov edx, [esp+4] - mov ecx, [esp+12] - and edx,ebp - mov eax, [ecx+edx*4] - - -L_dodist: - mov edx,eax - shr edx,16 - mov cl,ah - sub bl,ah - shr ebp,cl -; 584 "inffast.S" - mov cl,al - - test al,16 - jz L_test_for_second_level_dist - and cl,15 - jz L_check_dist_one - cmp bl,cl - jae L_add_bits_to_dist - - mov ch,cl - xor eax,eax - lodsw - mov cl,bl - add bl,16 - shl eax,cl - or ebp,eax - mov cl,ch - -L_add_bits_to_dist: - mov eax,1 - shl eax,cl - dec eax - sub bl,cl - and eax,ebp - shr ebp,cl - add edx,eax - jmp L_check_window - -L_check_window: -; 625 "inffast.S" - mov [esp+44],esi - mov eax,edi - sub eax, [esp+40] - - cmp eax,edx - jb L_clip_window - - mov ecx, [esp+24] - mov esi,edi - sub esi,edx - - sub ecx,3 - mov al, [esi] - mov [edi],al - mov al, [esi+1] - mov dl, [esi+2] - add esi,3 - mov [edi+1],al - mov [edi+2],dl - add edi,3 - rep movsb - - mov esi, [esp+44] - jmp L_while_test - -ALIGN 4 -L_check_dist_one: - cmp edx,1 - jne L_check_window - cmp [esp+40],edi - je L_check_window - - dec edi - mov ecx, [esp+24] - mov al, [edi] - sub ecx,3 - - mov [edi+1],al - mov [edi+2],al - mov [edi+3],al - add edi,4 - rep stosb - - jmp L_while_test - -ALIGN 4 -L_test_for_second_level_length: - - - - - test al,64 - jnz L_test_for_end_of_block - - mov eax,1 - shl eax,cl - dec eax - and eax,ebp - add eax,edx - mov edx, [esp+8] - mov eax, [edx+eax*4] - jmp L_dolen - -ALIGN 4 -L_test_for_second_level_dist: - - - - - test al,64 - jnz L_invalid_distance_code - - mov eax,1 - shl eax,cl - dec eax - and eax,ebp - add eax,edx - mov edx, [esp+12] - mov eax, [edx+eax*4] - jmp L_dodist - -ALIGN 4 -L_clip_window: -; 721 "inffast.S" - mov ecx,eax - mov eax, [esp+52] - neg ecx - mov esi, [esp+56] - - cmp eax,edx - jb L_invalid_distance_too_far - - add ecx,edx - cmp dword ptr [esp+48],0 - jne L_wrap_around_window - - sub eax,ecx - add esi,eax -; 749 "inffast.S" - mov eax, [esp+24] - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi,edi - sub esi,edx - jmp L_do_copy1 - - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi,edi - sub esi,edx - jmp L_do_copy1 - -L_wrap_around_window: -; 793 "inffast.S" - mov eax, [esp+48] - cmp ecx,eax - jbe L_contiguous_in_window - - add esi, [esp+52] - add esi,eax - sub esi,ecx - sub ecx,eax - - - mov eax, [esp+24] - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi, [esp+56] - mov ecx, [esp+48] - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi,edi - sub esi,edx - jmp L_do_copy1 - -L_contiguous_in_window: -; 836 "inffast.S" - add esi,eax - sub esi,ecx - - - mov eax, [esp+24] - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi,edi - sub esi,edx - -L_do_copy1: -; 862 "inffast.S" - mov ecx,eax - rep movsb - - mov esi, [esp+44] - jmp L_while_test -; 878 "inffast.S" -ALIGN 4 -L_init_mmx: - emms - - - - - - movd mm0,ebp - mov ebp,ebx -; 896 "inffast.S" - movd mm4,dword ptr [esp+0] - movq mm3,mm4 - movd mm5,dword ptr [esp+4] - movq mm2,mm5 - pxor mm1,mm1 - mov ebx, [esp+8] - jmp L_do_loop_mmx - -ALIGN 4 -L_do_loop_mmx: - psrlq mm0,mm1 - - cmp ebp,32 - ja L_get_length_code_mmx - - movd mm6,ebp - movd mm7,dword ptr [esi] - add esi,4 - psllq mm7,mm6 - add ebp,32 - por mm0,mm7 - -L_get_length_code_mmx: - pand mm4,mm0 - movd eax,mm4 - movq mm4,mm3 - mov eax, [ebx+eax*4] - -L_dolen_mmx: - movzx ecx,ah - movd mm1,ecx - sub ebp,ecx - - test al,al - jnz L_test_for_length_base_mmx - - shr eax,16 - stosb - -L_while_test_mmx: - - - cmp [esp+16],edi - jbe L_break_loop - - cmp [esp+20],esi - ja L_do_loop_mmx - jmp L_break_loop - -L_test_for_length_base_mmx: - - mov edx,eax - shr edx,16 - - test al,16 - jz L_test_for_second_level_length_mmx - and eax,15 - jz L_decode_distance_mmx - - psrlq mm0,mm1 - movd mm1,eax - movd ecx,mm0 - sub ebp,eax - and ecx, [inflate_fast_mask+eax*4] - add edx,ecx - -L_decode_distance_mmx: - psrlq mm0,mm1 - - cmp ebp,32 - ja L_get_dist_code_mmx - - movd mm6,ebp - movd mm7,dword ptr [esi] - add esi,4 - psllq mm7,mm6 - add ebp,32 - por mm0,mm7 - -L_get_dist_code_mmx: - mov ebx, [esp+12] - pand mm5,mm0 - movd eax,mm5 - movq mm5,mm2 - mov eax, [ebx+eax*4] - -L_dodist_mmx: - - movzx ecx,ah - mov ebx,eax - shr ebx,16 - sub ebp,ecx - movd mm1,ecx - - test al,16 - jz L_test_for_second_level_dist_mmx - and eax,15 - jz L_check_dist_one_mmx - -L_add_bits_to_dist_mmx: - psrlq mm0,mm1 - movd mm1,eax - movd ecx,mm0 - sub ebp,eax - and ecx, [inflate_fast_mask+eax*4] - add ebx,ecx - -L_check_window_mmx: - mov [esp+44],esi - mov eax,edi - sub eax, [esp+40] - - cmp eax,ebx - jb L_clip_window_mmx - - mov ecx,edx - mov esi,edi - sub esi,ebx - - sub ecx,3 - mov al, [esi] - mov [edi],al - mov al, [esi+1] - mov dl, [esi+2] - add esi,3 - mov [edi+1],al - mov [edi+2],dl - add edi,3 - rep movsb - - mov esi, [esp+44] - mov ebx, [esp+8] - jmp L_while_test_mmx - -ALIGN 4 -L_check_dist_one_mmx: - cmp ebx,1 - jne L_check_window_mmx - cmp [esp+40],edi - je L_check_window_mmx - - dec edi - mov ecx,edx - mov al, [edi] - sub ecx,3 - - mov [edi+1],al - mov [edi+2],al - mov [edi+3],al - add edi,4 - rep stosb - - mov ebx, [esp+8] - jmp L_while_test_mmx - -ALIGN 4 -L_test_for_second_level_length_mmx: - test al,64 - jnz L_test_for_end_of_block - - and eax,15 - psrlq mm0,mm1 - movd ecx,mm0 - and ecx, [inflate_fast_mask+eax*4] - add ecx,edx - mov eax, [ebx+ecx*4] - jmp L_dolen_mmx - -ALIGN 4 -L_test_for_second_level_dist_mmx: - test al,64 - jnz L_invalid_distance_code - - and eax,15 - psrlq mm0,mm1 - movd ecx,mm0 - and ecx, [inflate_fast_mask+eax*4] - mov eax, [esp+12] - add ecx,ebx - mov eax, [eax+ecx*4] - jmp L_dodist_mmx - -ALIGN 4 -L_clip_window_mmx: - - mov ecx,eax - mov eax, [esp+52] - neg ecx - mov esi, [esp+56] - - cmp eax,ebx - jb L_invalid_distance_too_far - - add ecx,ebx - cmp dword ptr [esp+48],0 - jne L_wrap_around_window_mmx - - sub eax,ecx - add esi,eax - - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi,edi - sub esi,ebx - jmp L_do_copy1_mmx - - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi,edi - sub esi,ebx - jmp L_do_copy1_mmx - -L_wrap_around_window_mmx: - - mov eax, [esp+48] - cmp ecx,eax - jbe L_contiguous_in_window_mmx - - add esi, [esp+52] - add esi,eax - sub esi,ecx - sub ecx,eax - - - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi, [esp+56] - mov ecx, [esp+48] - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi,edi - sub esi,ebx - jmp L_do_copy1_mmx - -L_contiguous_in_window_mmx: - - add esi,eax - sub esi,ecx - - - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi,edi - sub esi,ebx - -L_do_copy1_mmx: - - - mov ecx,edx - rep movsb - - mov esi, [esp+44] - mov ebx, [esp+8] - jmp L_while_test_mmx -; 1174 "inffast.S" -L_invalid_distance_code: - - - - - - mov ecx, invalid_distance_code_msg - mov edx,INFLATE_MODE_BAD - jmp L_update_stream_state - -L_test_for_end_of_block: - - - - - - test al,32 - jz L_invalid_literal_length_code - - mov ecx,0 - mov edx,INFLATE_MODE_TYPE - jmp L_update_stream_state - -L_invalid_literal_length_code: - - - - - - mov ecx, invalid_literal_length_code_msg - mov edx,INFLATE_MODE_BAD - jmp L_update_stream_state - -L_invalid_distance_too_far: - - - - mov esi, [esp+44] - mov ecx, invalid_distance_too_far_msg - mov edx,INFLATE_MODE_BAD - jmp L_update_stream_state - -L_update_stream_state: - - mov eax, [esp+88] - test ecx,ecx - jz L_skip_msg - mov [eax+24],ecx -L_skip_msg: - mov eax, [eax+28] - mov [eax+mode_state],edx - jmp L_break_loop - -ALIGN 4 -L_break_loop: -; 1243 "inffast.S" - cmp dword ptr [inflate_fast_use_mmx],2 - jne L_update_next_in - - - - mov ebx,ebp - -L_update_next_in: -; 1266 "inffast.S" - mov eax, [esp+88] - mov ecx,ebx - mov edx, [eax+28] - shr ecx,3 - sub esi,ecx - shl ecx,3 - sub ebx,ecx - mov [eax+12],edi - mov [edx+bits_state],ebx - mov ecx,ebx - - lea ebx, [esp+28] - cmp [esp+20],ebx - jne L_buf_not_used - - sub esi,ebx - mov ebx, [eax+0] - mov [esp+20],ebx - add esi,ebx - mov ebx, [eax+4] - sub ebx,11 - add [esp+20],ebx - -L_buf_not_used: - mov [eax+0],esi - - mov ebx,1 - shl ebx,cl - dec ebx - - - - - - cmp dword ptr [inflate_fast_use_mmx],2 - jne L_update_hold - - - - psrlq mm0,mm1 - movd ebp,mm0 - - emms - -L_update_hold: - - - - and ebp,ebx - mov [edx+hold_state],ebp - - - - - mov ebx, [esp+20] - cmp ebx,esi - jbe L_last_is_smaller - - sub ebx,esi - add ebx,11 - mov [eax+4],ebx - jmp L_fixup_out -L_last_is_smaller: - sub esi,ebx - neg esi - add esi,11 - mov [eax+4],esi - - - - -L_fixup_out: - - mov ebx, [esp+16] - cmp ebx,edi - jbe L_end_is_smaller - - sub ebx,edi - add ebx,257 - mov [eax+16],ebx - jmp L_done -L_end_is_smaller: - sub edi,ebx - neg edi - add edi,257 - mov [eax+16],edi - - - - - -L_done: - add esp,64 - popfd - pop ebx - pop ebp - pop esi - pop edi - ret -_inflate_fast endp - -_TEXT ends -end diff --git a/compat/zlib/contrib/masmx86/match686.asm b/compat/zlib/contrib/masmx86/match686.asm deleted file mode 100644 index 3b09212..0000000 --- a/compat/zlib/contrib/masmx86/match686.asm +++ /dev/null @@ -1,479 +0,0 @@ -; match686.asm -- Asm portion of the optimized longest_match for 32 bits x86 -; Copyright (C) 1995-1996 Jean-loup Gailly, Brian Raiter and Gilles Vollant. -; File written by Gilles Vollant, by converting match686.S from Brian Raiter -; for MASM. This is as assembly version of longest_match -; from Jean-loup Gailly in deflate.c -; -; http://www.zlib.net -; http://www.winimage.com/zLibDll -; http://www.muppetlabs.com/~breadbox/software/assembly.html -; -; For Visual C++ 4.x and higher and ML 6.x and higher -; ml.exe is distributed in -; http://www.microsoft.com/downloads/details.aspx?FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64 -; -; this file contain two implementation of longest_match -; -; this longest_match was written by Brian raiter (1998), optimized for Pentium Pro -; (and the faster known version of match_init on modern Core 2 Duo and AMD Phenom) -; -; for using an assembly version of longest_match, you need define ASMV in project -; -; compile the asm file running -; ml /coff /Zi /c /Flmatch686.lst match686.asm -; and do not include match686.obj in your project -; -; note: contrib of zLib 1.2.3 and earlier contained both a deprecated version for -; Pentium (prior Pentium Pro) and this version for Pentium Pro and modern processor -; with autoselect (with cpu detection code) -; if you want support the old pentium optimization, you can still use these version -; -; this file is not optimized for old pentium, but it compatible with all x86 32 bits -; processor (starting 80386) -; -; -; see below : zlib1222add must be adjuster if you use a zlib version < 1.2.2.2 - -;uInt longest_match(s, cur_match) -; deflate_state *s; -; IPos cur_match; /* current match */ - - NbStack equ 76 - cur_match equ dword ptr[esp+NbStack-0] - str_s equ dword ptr[esp+NbStack-4] -; 5 dword on top (ret,ebp,esi,edi,ebx) - adrret equ dword ptr[esp+NbStack-8] - pushebp equ dword ptr[esp+NbStack-12] - pushedi equ dword ptr[esp+NbStack-16] - pushesi equ dword ptr[esp+NbStack-20] - pushebx equ dword ptr[esp+NbStack-24] - - chain_length equ dword ptr [esp+NbStack-28] - limit equ dword ptr [esp+NbStack-32] - best_len equ dword ptr [esp+NbStack-36] - window equ dword ptr [esp+NbStack-40] - prev equ dword ptr [esp+NbStack-44] - scan_start equ word ptr [esp+NbStack-48] - wmask equ dword ptr [esp+NbStack-52] - match_start_ptr equ dword ptr [esp+NbStack-56] - nice_match equ dword ptr [esp+NbStack-60] - scan equ dword ptr [esp+NbStack-64] - - windowlen equ dword ptr [esp+NbStack-68] - match_start equ dword ptr [esp+NbStack-72] - strend equ dword ptr [esp+NbStack-76] - NbStackAdd equ (NbStack-24) - - .386p - - name gvmatch - .MODEL FLAT - - - -; all the +zlib1222add offsets are due to the addition of fields -; in zlib in the deflate_state structure since the asm code was first written -; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). -; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). -; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). - - zlib1222add equ 8 - -; Note : these value are good with a 8 bytes boundary pack structure - dep_chain_length equ 74h+zlib1222add - dep_window equ 30h+zlib1222add - dep_strstart equ 64h+zlib1222add - dep_prev_length equ 70h+zlib1222add - dep_nice_match equ 88h+zlib1222add - dep_w_size equ 24h+zlib1222add - dep_prev equ 38h+zlib1222add - dep_w_mask equ 2ch+zlib1222add - dep_good_match equ 84h+zlib1222add - dep_match_start equ 68h+zlib1222add - dep_lookahead equ 6ch+zlib1222add - - -_TEXT segment - -IFDEF NOUNDERLINE - public longest_match - public match_init -ELSE - public _longest_match - public _match_init -ENDIF - - MAX_MATCH equ 258 - MIN_MATCH equ 3 - MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1) - - - -MAX_MATCH equ 258 -MIN_MATCH equ 3 -MIN_LOOKAHEAD equ (MAX_MATCH + MIN_MATCH + 1) -MAX_MATCH_8_ equ ((MAX_MATCH + 7) AND 0FFF0h) - - -;;; stack frame offsets - -chainlenwmask equ esp + 0 ; high word: current chain len - ; low word: s->wmask -window equ esp + 4 ; local copy of s->window -windowbestlen equ esp + 8 ; s->window + bestlen -scanstart equ esp + 16 ; first two bytes of string -scanend equ esp + 12 ; last two bytes of string -scanalign equ esp + 20 ; dword-misalignment of string -nicematch equ esp + 24 ; a good enough match size -bestlen equ esp + 28 ; size of best match so far -scan equ esp + 32 ; ptr to string wanting match - -LocalVarsSize equ 36 -; saved ebx byte esp + 36 -; saved edi byte esp + 40 -; saved esi byte esp + 44 -; saved ebp byte esp + 48 -; return address byte esp + 52 -deflatestate equ esp + 56 ; the function arguments -curmatch equ esp + 60 - -;;; Offsets for fields in the deflate_state structure. These numbers -;;; are calculated from the definition of deflate_state, with the -;;; assumption that the compiler will dword-align the fields. (Thus, -;;; changing the definition of deflate_state could easily cause this -;;; program to crash horribly, without so much as a warning at -;;; compile time. Sigh.) - -dsWSize equ 36+zlib1222add -dsWMask equ 44+zlib1222add -dsWindow equ 48+zlib1222add -dsPrev equ 56+zlib1222add -dsMatchLen equ 88+zlib1222add -dsPrevMatch equ 92+zlib1222add -dsStrStart equ 100+zlib1222add -dsMatchStart equ 104+zlib1222add -dsLookahead equ 108+zlib1222add -dsPrevLen equ 112+zlib1222add -dsMaxChainLen equ 116+zlib1222add -dsGoodMatch equ 132+zlib1222add -dsNiceMatch equ 136+zlib1222add - - -;;; match686.asm -- Pentium-Pro-optimized version of longest_match() -;;; Written for zlib 1.1.2 -;;; Copyright (C) 1998 Brian Raiter -;;; You can look at http://www.muppetlabs.com/~breadbox/software/assembly.html -;;; -;; -;; This software is provided 'as-is', without any express or implied -;; warranty. In no event will the authors be held liable for any damages -;; arising from the use of this software. -;; -;; Permission is granted to anyone to use this software for any purpose, -;; including commercial applications, and to alter it and redistribute it -;; freely, subject to the following restrictions: -;; -;; 1. The origin of this software must not be misrepresented; you must not -;; claim that you wrote the original software. If you use this software -;; in a product, an acknowledgment in the product documentation would be -;; appreciated but is not required. -;; 2. Altered source versions must be plainly marked as such, and must not be -;; misrepresented as being the original software -;; 3. This notice may not be removed or altered from any source distribution. -;; - -;GLOBAL _longest_match, _match_init - - -;SECTION .text - -;;; uInt longest_match(deflate_state *deflatestate, IPos curmatch) - -;_longest_match: - IFDEF NOUNDERLINE - longest_match proc near - ELSE - _longest_match proc near - ENDIF -.FPO (9, 4, 0, 0, 1, 0) - -;;; Save registers that the compiler may be using, and adjust esp to -;;; make room for our stack frame. - - push ebp - push edi - push esi - push ebx - sub esp, LocalVarsSize - -;;; Retrieve the function arguments. ecx will hold cur_match -;;; throughout the entire function. edx will hold the pointer to the -;;; deflate_state structure during the function's setup (before -;;; entering the main loop. - - mov edx, [deflatestate] - mov ecx, [curmatch] - -;;; uInt wmask = s->w_mask; -;;; unsigned chain_length = s->max_chain_length; -;;; if (s->prev_length >= s->good_match) { -;;; chain_length >>= 2; -;;; } - - mov eax, [edx + dsPrevLen] - mov ebx, [edx + dsGoodMatch] - cmp eax, ebx - mov eax, [edx + dsWMask] - mov ebx, [edx + dsMaxChainLen] - jl LastMatchGood - shr ebx, 2 -LastMatchGood: - -;;; chainlen is decremented once beforehand so that the function can -;;; use the sign flag instead of the zero flag for the exit test. -;;; It is then shifted into the high word, to make room for the wmask -;;; value, which it will always accompany. - - dec ebx - shl ebx, 16 - or ebx, eax - mov [chainlenwmask], ebx - -;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - - mov eax, [edx + dsNiceMatch] - mov ebx, [edx + dsLookahead] - cmp ebx, eax - jl LookaheadLess - mov ebx, eax -LookaheadLess: mov [nicematch], ebx - -;;; register Bytef *scan = s->window + s->strstart; - - mov esi, [edx + dsWindow] - mov [window], esi - mov ebp, [edx + dsStrStart] - lea edi, [esi + ebp] - mov [scan], edi - -;;; Determine how many bytes the scan ptr is off from being -;;; dword-aligned. - - mov eax, edi - neg eax - and eax, 3 - mov [scanalign], eax - -;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? -;;; s->strstart - (IPos)MAX_DIST(s) : NIL; - - mov eax, [edx + dsWSize] - sub eax, MIN_LOOKAHEAD - sub ebp, eax - jg LimitPositive - xor ebp, ebp -LimitPositive: - -;;; int best_len = s->prev_length; - - mov eax, [edx + dsPrevLen] - mov [bestlen], eax - -;;; Store the sum of s->window + best_len in esi locally, and in esi. - - add esi, eax - mov [windowbestlen], esi - -;;; register ush scan_start = *(ushf*)scan; -;;; register ush scan_end = *(ushf*)(scan+best_len-1); -;;; Posf *prev = s->prev; - - movzx ebx, word ptr [edi] - mov [scanstart], ebx - movzx ebx, word ptr [edi + eax - 1] - mov [scanend], ebx - mov edi, [edx + dsPrev] - -;;; Jump into the main loop. - - mov edx, [chainlenwmask] - jmp short LoopEntry - -align 4 - -;;; do { -;;; match = s->window + cur_match; -;;; if (*(ushf*)(match+best_len-1) != scan_end || -;;; *(ushf*)match != scan_start) continue; -;;; [...] -;;; } while ((cur_match = prev[cur_match & wmask]) > limit -;;; && --chain_length != 0); -;;; -;;; Here is the inner loop of the function. The function will spend the -;;; majority of its time in this loop, and majority of that time will -;;; be spent in the first ten instructions. -;;; -;;; Within this loop: -;;; ebx = scanend -;;; ecx = curmatch -;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) -;;; esi = windowbestlen - i.e., (window + bestlen) -;;; edi = prev -;;; ebp = limit - -LookupLoop: - and ecx, edx - movzx ecx, word ptr [edi + ecx*2] - cmp ecx, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow -LoopEntry: movzx eax, word ptr [esi + ecx - 1] - cmp eax, ebx - jnz LookupLoop - mov eax, [window] - movzx eax, word ptr [eax + ecx] - cmp eax, [scanstart] - jnz LookupLoop - -;;; Store the current value of chainlen. - - mov [chainlenwmask], edx - -;;; Point edi to the string under scrutiny, and esi to the string we -;;; are hoping to match it up with. In actuality, esi and edi are -;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is -;;; initialized to -(MAX_MATCH_8 - scanalign). - - mov esi, [window] - mov edi, [scan] - add esi, ecx - mov eax, [scanalign] - mov edx, 0fffffef8h; -(MAX_MATCH_8) - lea edi, [edi + eax + 0108h] ;MAX_MATCH_8] - lea esi, [esi + eax + 0108h] ;MAX_MATCH_8] - -;;; Test the strings for equality, 8 bytes at a time. At the end, -;;; adjust edx so that it is offset to the exact byte that mismatched. -;;; -;;; We already know at this point that the first three bytes of the -;;; strings match each other, and they can be safely passed over before -;;; starting the compare loop. So what this code does is skip over 0-3 -;;; bytes, as much as necessary in order to dword-align the edi -;;; pointer. (esi will still be misaligned three times out of four.) -;;; -;;; It should be confessed that this loop usually does not represent -;;; much of the total running time. Replacing it with a more -;;; straightforward "rep cmpsb" would not drastically degrade -;;; performance. - -LoopCmps: - mov eax, [esi + edx] - xor eax, [edi + edx] - jnz LeaveLoopCmps - mov eax, [esi + edx + 4] - xor eax, [edi + edx + 4] - jnz LeaveLoopCmps4 - add edx, 8 - jnz LoopCmps - jmp short LenMaximum -LeaveLoopCmps4: add edx, 4 -LeaveLoopCmps: test eax, 0000FFFFh - jnz LenLower - add edx, 2 - shr eax, 16 -LenLower: sub al, 1 - adc edx, 0 - -;;; Calculate the length of the match. If it is longer than MAX_MATCH, -;;; then automatically accept it as the best possible match and leave. - - lea eax, [edi + edx] - mov edi, [scan] - sub eax, edi - cmp eax, MAX_MATCH - jge LenMaximum - -;;; If the length of the match is not longer than the best match we -;;; have so far, then forget it and return to the lookup loop. - - mov edx, [deflatestate] - mov ebx, [bestlen] - cmp eax, ebx - jg LongerMatch - mov esi, [windowbestlen] - mov edi, [edx + dsPrev] - mov ebx, [scanend] - mov edx, [chainlenwmask] - jmp LookupLoop - -;;; s->match_start = cur_match; -;;; best_len = len; -;;; if (len >= nice_match) break; -;;; scan_end = *(ushf*)(scan+best_len-1); - -LongerMatch: mov ebx, [nicematch] - mov [bestlen], eax - mov [edx + dsMatchStart], ecx - cmp eax, ebx - jge LeaveNow - mov esi, [window] - add esi, eax - mov [windowbestlen], esi - movzx ebx, word ptr [edi + eax - 1] - mov edi, [edx + dsPrev] - mov [scanend], ebx - mov edx, [chainlenwmask] - jmp LookupLoop - -;;; Accept the current string, with the maximum possible length. - -LenMaximum: mov edx, [deflatestate] - mov dword ptr [bestlen], MAX_MATCH - mov [edx + dsMatchStart], ecx - -;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len; -;;; return s->lookahead; - -LeaveNow: - mov edx, [deflatestate] - mov ebx, [bestlen] - mov eax, [edx + dsLookahead] - cmp ebx, eax - jg LookaheadRet - mov eax, ebx -LookaheadRet: - -;;; Restore the stack and return from whence we came. - - add esp, LocalVarsSize - pop ebx - pop esi - pop edi - pop ebp - - ret -; please don't remove this string ! -; Your can freely use match686 in any free or commercial app if you don't remove the string in the binary! - db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998",0dh,0ah - - - IFDEF NOUNDERLINE - longest_match endp - ELSE - _longest_match endp - ENDIF - - IFDEF NOUNDERLINE - match_init proc near - ret - match_init endp - ELSE - _match_init proc near - ret - _match_init endp - ENDIF - - -_TEXT ends -end diff --git a/compat/zlib/contrib/masmx86/readme.txt b/compat/zlib/contrib/masmx86/readme.txt deleted file mode 100644 index 3271f72..0000000 --- a/compat/zlib/contrib/masmx86/readme.txt +++ /dev/null @@ -1,27 +0,0 @@ - -Summary -------- -This directory contains ASM implementations of the functions -longest_match() and inflate_fast(). - - -Use instructions ----------------- -Assemble using MASM, and copy the object files into the zlib source -directory, then run the appropriate makefile, as suggested below. You can -donwload MASM from here: - - http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=7a1c9da0-0510-44a2-b042-7ef370530c64 - -You can also get objects files here: - - http://www.winimage.com/zLibDll/zlib124_masm_obj.zip - -Build instructions ------------------- -* With Microsoft C and MASM: -nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" - -* With Borland C and TASM: -make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="match686.obj inffas32.obj" OBJPA="+match686c.obj+match686.obj+inffas32.obj" - diff --git a/compat/zlib/contrib/minizip/Makefile b/compat/zlib/contrib/minizip/Makefile deleted file mode 100644 index 84eaad2..0000000 --- a/compat/zlib/contrib/minizip/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -CC=cc -CFLAGS=-O -I../.. - -UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a -ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a - -.c.o: - $(CC) -c $(CFLAGS) $*.c - -all: miniunz minizip - -miniunz: $(UNZ_OBJS) - $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) - -minizip: $(ZIP_OBJS) - $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) - -test: miniunz minizip - ./minizip test readme.txt - ./miniunz -l test.zip - mv readme.txt readme.old - ./miniunz test.zip - -clean: - /bin/rm -f *.o *~ minizip miniunz diff --git a/compat/zlib/contrib/minizip/Makefile.am b/compat/zlib/contrib/minizip/Makefile.am deleted file mode 100644 index d343011..0000000 --- a/compat/zlib/contrib/minizip/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ -lib_LTLIBRARIES = libminizip.la - -if COND_DEMOS -bin_PROGRAMS = miniunzip minizip -endif - -zlib_top_srcdir = $(top_srcdir)/../.. -zlib_top_builddir = $(top_builddir)/../.. - -AM_CPPFLAGS = -I$(zlib_top_srcdir) -AM_LDFLAGS = -L$(zlib_top_builddir) - -if WIN32 -iowin32_src = iowin32.c -iowin32_h = iowin32.h -endif - -libminizip_la_SOURCES = \ - ioapi.c \ - mztools.c \ - unzip.c \ - zip.c \ - ${iowin32_src} - -libminizip_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 -lz - -minizip_includedir = $(includedir)/minizip -minizip_include_HEADERS = \ - crypt.h \ - ioapi.h \ - mztools.h \ - unzip.h \ - zip.h \ - ${iowin32_h} - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = minizip.pc - -EXTRA_PROGRAMS = miniunzip minizip - -miniunzip_SOURCES = miniunz.c -miniunzip_LDADD = libminizip.la - -minizip_SOURCES = minizip.c -minizip_LDADD = libminizip.la -lz diff --git a/compat/zlib/contrib/minizip/MiniZip64_Changes.txt b/compat/zlib/contrib/minizip/MiniZip64_Changes.txt deleted file mode 100644 index 13a1bd9..0000000 --- a/compat/zlib/contrib/minizip/MiniZip64_Changes.txt +++ /dev/null @@ -1,6 +0,0 @@ - -MiniZip 1.1 was derrived from MiniZip at version 1.01f - -Change in 1.0 (Okt 2009) - - **TODO - Add history** - diff --git a/compat/zlib/contrib/minizip/MiniZip64_info.txt b/compat/zlib/contrib/minizip/MiniZip64_info.txt deleted file mode 100644 index 57d7152..0000000 --- a/compat/zlib/contrib/minizip/MiniZip64_info.txt +++ /dev/null @@ -1,74 +0,0 @@ -MiniZip - Copyright (c) 1998-2010 - by Gilles Vollant - version 1.1 64 bits from Mathias Svensson - -Introduction ---------------------- -MiniZip 1.1 is built from MiniZip 1.0 by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html ) - -When adding ZIP64 support into minizip it would result into risk of breaking compatibility with minizip 1.0. -All possible work was done for compatibility. - - -Background ---------------------- -When adding ZIP64 support Mathias Svensson found that Even Rouault have added ZIP64 -support for unzip.c into minizip for a open source project called gdal ( http://www.gdal.org/ ) - -That was used as a starting point. And after that ZIP64 support was added to zip.c -some refactoring and code cleanup was also done. - - -Changed from MiniZip 1.0 to MiniZip 1.1 ---------------------------------------- -* Added ZIP64 support for unzip ( by Even Rouault ) -* Added ZIP64 support for zip ( by Mathias Svensson ) -* Reverted some changed that Even Rouault did. -* Bunch of patches received from Gulles Vollant that he received for MiniZip from various users. -* Added unzip patch for BZIP Compression method (patch create by Daniel Borca) -* Added BZIP Compress method for zip -* Did some refactoring and code cleanup - - -Credits - - Gilles Vollant - Original MiniZip author - Even Rouault - ZIP64 unzip Support - Daniel Borca - BZip Compression method support in unzip - Mathias Svensson - ZIP64 zip support - Mathias Svensson - BZip Compression method support in zip - - Resources - - ZipLayout http://result42.com/projects/ZipFileLayout - Command line tool for Windows that shows the layout and information of the headers in a zip archive. - Used when debugging and validating the creation of zip files using MiniZip64 - - - ZIP App Note http://www.pkware.com/documents/casestudies/APPNOTE.TXT - Zip File specification - - -Notes. - * To be able to use BZip compression method in zip64.c or unzip64.c the BZIP2 lib is needed and HAVE_BZIP2 need to be defined. - -License ----------------------------------------------------------- - Condition of use and distribution are the same than zlib : - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - ----------------------------------------------------------- - diff --git a/compat/zlib/contrib/minizip/configure.ac b/compat/zlib/contrib/minizip/configure.ac deleted file mode 100644 index 5b11970..0000000 --- a/compat/zlib/contrib/minizip/configure.ac +++ /dev/null @@ -1,32 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_INIT([minizip], [1.2.11], [bugzilla.redhat.com]) -AC_CONFIG_SRCDIR([minizip.c]) -AM_INIT_AUTOMAKE([foreign]) -LT_INIT - -AC_MSG_CHECKING([whether to build example programs]) -AC_ARG_ENABLE([demos], AC_HELP_STRING([--enable-demos], [build example programs])) -AM_CONDITIONAL([COND_DEMOS], [test "$enable_demos" = yes]) -if test "$enable_demos" = yes -then - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) -fi - -case "${host}" in - *-mingw* | mingw*) - WIN32="yes" - ;; - *) - ;; -esac -AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"]) - - -AC_SUBST([HAVE_UNISTD_H], [0]) -AC_CHECK_HEADER([unistd.h], [HAVE_UNISTD_H=1], []) -AC_CONFIG_FILES([Makefile minizip.pc]) -AC_OUTPUT diff --git a/compat/zlib/contrib/minizip/crypt.h b/compat/zlib/contrib/minizip/crypt.h deleted file mode 100644 index 1e9e820..0000000 --- a/compat/zlib/contrib/minizip/crypt.h +++ /dev/null @@ -1,131 +0,0 @@ -/* crypt.h -- base code for crypt/uncrypt ZIPfile - - - Version 1.01e, February 12th, 2005 - - Copyright (C) 1998-2005 Gilles Vollant - - This code is a modified version of crypting code in Infozip distribution - - The encryption/decryption parts of this source code (as opposed to the - non-echoing password parts) were originally written in Europe. The - whole source package can be freely distributed, including from the USA. - (Prior to January 2000, re-export from the US was a violation of US law.) - - This encryption code is a direct transcription of the algorithm from - Roger Schlafly, described by Phil Katz in the file appnote.txt. This - file (appnote.txt) is distributed with the PKZIP program (even in the - version without encryption capabilities). - - If you don't need crypting in your application, just define symbols - NOCRYPT and NOUNCRYPT. - - This code support the "Traditional PKWARE Encryption". - - The new AES encryption added on Zip format by Winzip (see the page - http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong - Encryption is not supported. -*/ - -#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) - -/*********************************************************************** - * Return the next byte in the pseudo-random sequence - */ -static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) -{ - unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an - * unpredictable manner on 16-bit systems; not a problem - * with any known compiler so far, though */ - - temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; - return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); -} - -/*********************************************************************** - * Update the encryption keys with the next byte of plain text - */ -static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c) -{ - (*(pkeys+0)) = CRC32((*(pkeys+0)), c); - (*(pkeys+1)) += (*(pkeys+0)) & 0xff; - (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; - { - register int keyshift = (int)((*(pkeys+1)) >> 24); - (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); - } - return c; -} - - -/*********************************************************************** - * Initialize the encryption keys and the random header according to - * the given password. - */ -static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab) -{ - *(pkeys+0) = 305419896L; - *(pkeys+1) = 591751049L; - *(pkeys+2) = 878082192L; - while (*passwd != '\0') { - update_keys(pkeys,pcrc_32_tab,(int)*passwd); - passwd++; - } -} - -#define zdecode(pkeys,pcrc_32_tab,c) \ - (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) - -#define zencode(pkeys,pcrc_32_tab,c,t) \ - (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) - -#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED - -#define RAND_HEAD_LEN 12 - /* "last resort" source for second part of crypt seed pattern */ -# ifndef ZCR_SEED2 -# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ -# endif - -static int crypthead(const char* passwd, /* password string */ - unsigned char* buf, /* where to write header */ - int bufSize, - unsigned long* pkeys, - const z_crc_t* pcrc_32_tab, - unsigned long crcForCrypting) -{ - int n; /* index in random header */ - int t; /* temporary */ - int c; /* random byte */ - unsigned char header[RAND_HEAD_LEN-2]; /* random header */ - static unsigned calls = 0; /* ensure different random header each time */ - - if (bufSize> 7) & 0xff; - header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); - } - /* Encrypt random header (last two bytes is high word of crc) */ - init_keys(passwd, pkeys, pcrc_32_tab); - for (n = 0; n < RAND_HEAD_LEN-2; n++) - { - buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); - } - buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); - buf[n++] = (unsigned char)zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); - return n; -} - -#endif diff --git a/compat/zlib/contrib/minizip/ioapi.c b/compat/zlib/contrib/minizip/ioapi.c deleted file mode 100644 index 7f5c191..0000000 --- a/compat/zlib/contrib/minizip/ioapi.c +++ /dev/null @@ -1,247 +0,0 @@ -/* ioapi.h -- IO base function header for compress/uncompress .zip - part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) - - Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) - - Modifications for Zip64 support - Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - - For more info read MiniZip_info.txt - -*/ - -#if defined(_WIN32) && (!(defined(_CRT_SECURE_NO_WARNINGS))) - #define _CRT_SECURE_NO_WARNINGS -#endif - -#if defined(__APPLE__) || defined(IOAPI_NO_64) -// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions -#define FOPEN_FUNC(filename, mode) fopen(filename, mode) -#define FTELLO_FUNC(stream) ftello(stream) -#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) -#else -#define FOPEN_FUNC(filename, mode) fopen64(filename, mode) -#define FTELLO_FUNC(stream) ftello64(stream) -#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin) -#endif - - -#include "ioapi.h" - -voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode) -{ - if (pfilefunc->zfile_func64.zopen64_file != NULL) - return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode); - else - { - return (*(pfilefunc->zopen32_file))(pfilefunc->zfile_func64.opaque,(const char*)filename,mode); - } -} - -long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) -{ - if (pfilefunc->zfile_func64.zseek64_file != NULL) - return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin); - else - { - uLong offsetTruncated = (uLong)offset; - if (offsetTruncated != offset) - return -1; - else - return (*(pfilefunc->zseek32_file))(pfilefunc->zfile_func64.opaque,filestream,offsetTruncated,origin); - } -} - -ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream) -{ - if (pfilefunc->zfile_func64.zseek64_file != NULL) - return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream); - else - { - uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream); - if ((tell_uLong) == MAXU32) - return (ZPOS64_T)-1; - else - return tell_uLong; - } -} - -void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32) -{ - p_filefunc64_32->zfile_func64.zopen64_file = NULL; - p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file; - p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; - p_filefunc64_32->zfile_func64.zread_file = p_filefunc32->zread_file; - p_filefunc64_32->zfile_func64.zwrite_file = p_filefunc32->zwrite_file; - p_filefunc64_32->zfile_func64.ztell64_file = NULL; - p_filefunc64_32->zfile_func64.zseek64_file = NULL; - p_filefunc64_32->zfile_func64.zclose_file = p_filefunc32->zclose_file; - p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; - p_filefunc64_32->zfile_func64.opaque = p_filefunc32->opaque; - p_filefunc64_32->zseek32_file = p_filefunc32->zseek_file; - p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file; -} - - - -static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode)); -static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); -static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size)); -static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream)); -static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); -static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream)); -static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream)); - -static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode) -{ - FILE* file = NULL; - const char* mode_fopen = NULL; - if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) - mode_fopen = "rb"; - else - if (mode & ZLIB_FILEFUNC_MODE_EXISTING) - mode_fopen = "r+b"; - else - if (mode & ZLIB_FILEFUNC_MODE_CREATE) - mode_fopen = "wb"; - - if ((filename!=NULL) && (mode_fopen != NULL)) - file = fopen(filename, mode_fopen); - return file; -} - -static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode) -{ - FILE* file = NULL; - const char* mode_fopen = NULL; - if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) - mode_fopen = "rb"; - else - if (mode & ZLIB_FILEFUNC_MODE_EXISTING) - mode_fopen = "r+b"; - else - if (mode & ZLIB_FILEFUNC_MODE_CREATE) - mode_fopen = "wb"; - - if ((filename!=NULL) && (mode_fopen != NULL)) - file = FOPEN_FUNC((const char*)filename, mode_fopen); - return file; -} - - -static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size) -{ - uLong ret; - ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); - return ret; -} - -static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size) -{ - uLong ret; - ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); - return ret; -} - -static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) -{ - long ret; - ret = ftell((FILE *)stream); - return ret; -} - - -static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) -{ - ZPOS64_T ret; - ret = FTELLO_FUNC((FILE *)stream); - return ret; -} - -static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin) -{ - int fseek_origin=0; - long ret; - switch (origin) - { - case ZLIB_FILEFUNC_SEEK_CUR : - fseek_origin = SEEK_CUR; - break; - case ZLIB_FILEFUNC_SEEK_END : - fseek_origin = SEEK_END; - break; - case ZLIB_FILEFUNC_SEEK_SET : - fseek_origin = SEEK_SET; - break; - default: return -1; - } - ret = 0; - if (fseek((FILE *)stream, offset, fseek_origin) != 0) - ret = -1; - return ret; -} - -static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) -{ - int fseek_origin=0; - long ret; - switch (origin) - { - case ZLIB_FILEFUNC_SEEK_CUR : - fseek_origin = SEEK_CUR; - break; - case ZLIB_FILEFUNC_SEEK_END : - fseek_origin = SEEK_END; - break; - case ZLIB_FILEFUNC_SEEK_SET : - fseek_origin = SEEK_SET; - break; - default: return -1; - } - ret = 0; - - if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0) - ret = -1; - - return ret; -} - - -static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) -{ - int ret; - ret = fclose((FILE *)stream); - return ret; -} - -static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream) -{ - int ret; - ret = ferror((FILE *)stream); - return ret; -} - -void fill_fopen_filefunc (pzlib_filefunc_def) - zlib_filefunc_def* pzlib_filefunc_def; -{ - pzlib_filefunc_def->zopen_file = fopen_file_func; - pzlib_filefunc_def->zread_file = fread_file_func; - pzlib_filefunc_def->zwrite_file = fwrite_file_func; - pzlib_filefunc_def->ztell_file = ftell_file_func; - pzlib_filefunc_def->zseek_file = fseek_file_func; - pzlib_filefunc_def->zclose_file = fclose_file_func; - pzlib_filefunc_def->zerror_file = ferror_file_func; - pzlib_filefunc_def->opaque = NULL; -} - -void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def) -{ - pzlib_filefunc_def->zopen64_file = fopen64_file_func; - pzlib_filefunc_def->zread_file = fread_file_func; - pzlib_filefunc_def->zwrite_file = fwrite_file_func; - pzlib_filefunc_def->ztell64_file = ftell64_file_func; - pzlib_filefunc_def->zseek64_file = fseek64_file_func; - pzlib_filefunc_def->zclose_file = fclose_file_func; - pzlib_filefunc_def->zerror_file = ferror_file_func; - pzlib_filefunc_def->opaque = NULL; -} diff --git a/compat/zlib/contrib/minizip/ioapi.h b/compat/zlib/contrib/minizip/ioapi.h deleted file mode 100644 index 8dcbdb0..0000000 --- a/compat/zlib/contrib/minizip/ioapi.h +++ /dev/null @@ -1,208 +0,0 @@ -/* ioapi.h -- IO base function header for compress/uncompress .zip - part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) - - Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) - - Modifications for Zip64 support - Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - - For more info read MiniZip_info.txt - - Changes - - Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this) - Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux. - More if/def section may be needed to support other platforms - Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows. - (but you should use iowin32.c for windows instead) - -*/ - -#ifndef _ZLIBIOAPI64_H -#define _ZLIBIOAPI64_H - -#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) - - // Linux needs this to support file operation on files larger then 4+GB - // But might need better if/def to select just the platforms that needs them. - - #ifndef __USE_FILE_OFFSET64 - #define __USE_FILE_OFFSET64 - #endif - #ifndef __USE_LARGEFILE64 - #define __USE_LARGEFILE64 - #endif - #ifndef _LARGEFILE64_SOURCE - #define _LARGEFILE64_SOURCE - #endif - #ifndef _FILE_OFFSET_BIT - #define _FILE_OFFSET_BIT 64 - #endif - -#endif - -#include -#include -#include "zlib.h" - -#if defined(USE_FILE32API) -#define fopen64 fopen -#define ftello64 ftell -#define fseeko64 fseek -#else -#ifdef __FreeBSD__ -#define fopen64 fopen -#define ftello64 ftello -#define fseeko64 fseeko -#endif -#ifdef _MSC_VER - #define fopen64 fopen - #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC))) - #define ftello64 _ftelli64 - #define fseeko64 _fseeki64 - #else // old MSC - #define ftello64 ftell - #define fseeko64 fseek - #endif -#endif -#endif - -/* -#ifndef ZPOS64_T - #ifdef _WIN32 - #define ZPOS64_T fpos_t - #else - #include - #define ZPOS64_T uint64_t - #endif -#endif -*/ - -#ifdef HAVE_MINIZIP64_CONF_H -#include "mz64conf.h" -#endif - -/* a type choosen by DEFINE */ -#ifdef HAVE_64BIT_INT_CUSTOM -typedef 64BIT_INT_CUSTOM_TYPE ZPOS64_T; -#else -#ifdef HAS_STDINT_H -#include "stdint.h" -typedef uint64_t ZPOS64_T; -#else - -/* Maximum unsigned 32-bit value used as placeholder for zip64 */ -#define MAXU32 0xffffffff - -#if defined(_MSC_VER) || defined(__BORLANDC__) -typedef unsigned __int64 ZPOS64_T; -#else -typedef unsigned long long int ZPOS64_T; -#endif -#endif -#endif - - - -#ifdef __cplusplus -extern "C" { -#endif - - -#define ZLIB_FILEFUNC_SEEK_CUR (1) -#define ZLIB_FILEFUNC_SEEK_END (2) -#define ZLIB_FILEFUNC_SEEK_SET (0) - -#define ZLIB_FILEFUNC_MODE_READ (1) -#define ZLIB_FILEFUNC_MODE_WRITE (2) -#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) - -#define ZLIB_FILEFUNC_MODE_EXISTING (4) -#define ZLIB_FILEFUNC_MODE_CREATE (8) - - -#ifndef ZCALLBACK - #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) - #define ZCALLBACK CALLBACK - #else - #define ZCALLBACK - #endif -#endif - - - - -typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); -typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); -typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); -typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); -typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); - -typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); -typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); - - -/* here is the "old" 32 bits structure structure */ -typedef struct zlib_filefunc_def_s -{ - open_file_func zopen_file; - read_file_func zread_file; - write_file_func zwrite_file; - tell_file_func ztell_file; - seek_file_func zseek_file; - close_file_func zclose_file; - testerror_file_func zerror_file; - voidpf opaque; -} zlib_filefunc_def; - -typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream)); -typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); -typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode)); - -typedef struct zlib_filefunc64_def_s -{ - open64_file_func zopen64_file; - read_file_func zread_file; - write_file_func zwrite_file; - tell64_file_func ztell64_file; - seek64_file_func zseek64_file; - close_file_func zclose_file; - testerror_file_func zerror_file; - voidpf opaque; -} zlib_filefunc64_def; - -void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def)); -void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); - -/* now internal definition, only for zip.c and unzip.h */ -typedef struct zlib_filefunc64_32_def_s -{ - zlib_filefunc64_def zfile_func64; - open_file_func zopen32_file; - tell_file_func ztell32_file; - seek_file_func zseek32_file; -} zlib_filefunc64_32_def; - - -#define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) -#define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) -//#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) -//#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode)) -#define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream)) -#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream)) - -voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)); -long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)); -ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)); - -void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32); - -#define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode))) -#define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream))) -#define ZSEEK64(filefunc,filestream,pos,mode) (call_zseek64((&(filefunc)),(filestream),(pos),(mode))) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/compat/zlib/contrib/minizip/iowin32.c b/compat/zlib/contrib/minizip/iowin32.c deleted file mode 100644 index 274f39e..0000000 --- a/compat/zlib/contrib/minizip/iowin32.c +++ /dev/null @@ -1,462 +0,0 @@ -/* iowin32.c -- IO base function header for compress/uncompress .zip - Version 1.1, February 14h, 2010 - part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) - - Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) - - Modifications for Zip64 support - Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - - For more info read MiniZip_info.txt - -*/ - -#include - -#include "zlib.h" -#include "ioapi.h" -#include "iowin32.h" - -#ifndef INVALID_HANDLE_VALUE -#define INVALID_HANDLE_VALUE (0xFFFFFFFF) -#endif - -#ifndef INVALID_SET_FILE_POINTER -#define INVALID_SET_FILE_POINTER ((DWORD)-1) -#endif - - -// see Include/shared/winapifamily.h in the Windows Kit -#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) -#if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP) -#define IOWIN32_USING_WINRT_API 1 -#endif -#endif - -voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode)); -uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); -uLong ZCALLBACK win32_write_file_func OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); -ZPOS64_T ZCALLBACK win32_tell64_file_func OF((voidpf opaque, voidpf stream)); -long ZCALLBACK win32_seek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); -int ZCALLBACK win32_close_file_func OF((voidpf opaque, voidpf stream)); -int ZCALLBACK win32_error_file_func OF((voidpf opaque, voidpf stream)); - -typedef struct -{ - HANDLE hf; - int error; -} WIN32FILE_IOWIN; - - -static void win32_translate_open_mode(int mode, - DWORD* lpdwDesiredAccess, - DWORD* lpdwCreationDisposition, - DWORD* lpdwShareMode, - DWORD* lpdwFlagsAndAttributes) -{ - *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0; - - if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) - { - *lpdwDesiredAccess = GENERIC_READ; - *lpdwCreationDisposition = OPEN_EXISTING; - *lpdwShareMode = FILE_SHARE_READ; - } - else if (mode & ZLIB_FILEFUNC_MODE_EXISTING) - { - *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ; - *lpdwCreationDisposition = OPEN_EXISTING; - } - else if (mode & ZLIB_FILEFUNC_MODE_CREATE) - { - *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ; - *lpdwCreationDisposition = CREATE_ALWAYS; - } -} - -static voidpf win32_build_iowin(HANDLE hFile) -{ - voidpf ret=NULL; - - if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE)) - { - WIN32FILE_IOWIN w32fiow; - w32fiow.hf = hFile; - w32fiow.error = 0; - ret = malloc(sizeof(WIN32FILE_IOWIN)); - - if (ret==NULL) - CloseHandle(hFile); - else - *((WIN32FILE_IOWIN*)ret) = w32fiow; - } - return ret; -} - -voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int mode) -{ - const char* mode_fopen = NULL; - DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; - HANDLE hFile = NULL; - - win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); - -#ifdef IOWIN32_USING_WINRT_API -#ifdef UNICODE - if ((filename!=NULL) && (dwDesiredAccess != 0)) - hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); -#else - if ((filename!=NULL) && (dwDesiredAccess != 0)) - { - WCHAR filenameW[FILENAME_MAX + 0x200 + 1]; - MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200); - hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); - } -#endif -#else - if ((filename!=NULL) && (dwDesiredAccess != 0)) - hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); -#endif - - return win32_build_iowin(hFile); -} - - -voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int mode) -{ - const char* mode_fopen = NULL; - DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; - HANDLE hFile = NULL; - - win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); - -#ifdef IOWIN32_USING_WINRT_API - if ((filename!=NULL) && (dwDesiredAccess != 0)) - { - WCHAR filenameW[FILENAME_MAX + 0x200 + 1]; - MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200); - hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); - } -#else - if ((filename!=NULL) && (dwDesiredAccess != 0)) - hFile = CreateFileA((LPCSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); -#endif - - return win32_build_iowin(hFile); -} - - -voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int mode) -{ - const char* mode_fopen = NULL; - DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; - HANDLE hFile = NULL; - - win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); - -#ifdef IOWIN32_USING_WINRT_API - if ((filename!=NULL) && (dwDesiredAccess != 0)) - hFile = CreateFile2((LPCWSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition,NULL); -#else - if ((filename!=NULL) && (dwDesiredAccess != 0)) - hFile = CreateFileW((LPCWSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); -#endif - - return win32_build_iowin(hFile); -} - - -voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mode) -{ - const char* mode_fopen = NULL; - DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; - HANDLE hFile = NULL; - - win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes); - -#ifdef IOWIN32_USING_WINRT_API -#ifdef UNICODE - if ((filename!=NULL) && (dwDesiredAccess != 0)) - hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); -#else - if ((filename!=NULL) && (dwDesiredAccess != 0)) - { - WCHAR filenameW[FILENAME_MAX + 0x200 + 1]; - MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200); - hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL); - } -#endif -#else - if ((filename!=NULL) && (dwDesiredAccess != 0)) - hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL); -#endif - - return win32_build_iowin(hFile); -} - - -uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uLong size) -{ - uLong ret=0; - HANDLE hFile = NULL; - if (stream!=NULL) - hFile = ((WIN32FILE_IOWIN*)stream) -> hf; - - if (hFile != NULL) - { - if (!ReadFile(hFile, buf, size, &ret, NULL)) - { - DWORD dwErr = GetLastError(); - if (dwErr == ERROR_HANDLE_EOF) - dwErr = 0; - ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; - } - } - - return ret; -} - - -uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* buf,uLong size) -{ - uLong ret=0; - HANDLE hFile = NULL; - if (stream!=NULL) - hFile = ((WIN32FILE_IOWIN*)stream) -> hf; - - if (hFile != NULL) - { - if (!WriteFile(hFile, buf, size, &ret, NULL)) - { - DWORD dwErr = GetLastError(); - if (dwErr == ERROR_HANDLE_EOF) - dwErr = 0; - ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; - } - } - - return ret; -} - -static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod) -{ -#ifdef IOWIN32_USING_WINRT_API - return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod); -#else - LONG lHigh = pos.HighPart; - DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, dwMoveMethod); - BOOL fOk = TRUE; - if (dwNewPos == 0xFFFFFFFF) - if (GetLastError() != NO_ERROR) - fOk = FALSE; - if ((newPos != NULL) && (fOk)) - { - newPos->LowPart = dwNewPos; - newPos->HighPart = lHigh; - } - return fOk; -#endif -} - -long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream) -{ - long ret=-1; - HANDLE hFile = NULL; - if (stream!=NULL) - hFile = ((WIN32FILE_IOWIN*)stream) -> hf; - if (hFile != NULL) - { - LARGE_INTEGER pos; - pos.QuadPart = 0; - - if (!MySetFilePointerEx(hFile, pos, &pos, FILE_CURRENT)) - { - DWORD dwErr = GetLastError(); - ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; - ret = -1; - } - else - ret=(long)pos.LowPart; - } - return ret; -} - -ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream) -{ - ZPOS64_T ret= (ZPOS64_T)-1; - HANDLE hFile = NULL; - if (stream!=NULL) - hFile = ((WIN32FILE_IOWIN*)stream)->hf; - - if (hFile) - { - LARGE_INTEGER pos; - pos.QuadPart = 0; - - if (!MySetFilePointerEx(hFile, pos, &pos, FILE_CURRENT)) - { - DWORD dwErr = GetLastError(); - ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; - ret = (ZPOS64_T)-1; - } - else - ret=pos.QuadPart; - } - return ret; -} - - -long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,int origin) -{ - DWORD dwMoveMethod=0xFFFFFFFF; - HANDLE hFile = NULL; - - long ret=-1; - if (stream!=NULL) - hFile = ((WIN32FILE_IOWIN*)stream) -> hf; - switch (origin) - { - case ZLIB_FILEFUNC_SEEK_CUR : - dwMoveMethod = FILE_CURRENT; - break; - case ZLIB_FILEFUNC_SEEK_END : - dwMoveMethod = FILE_END; - break; - case ZLIB_FILEFUNC_SEEK_SET : - dwMoveMethod = FILE_BEGIN; - break; - default: return -1; - } - - if (hFile != NULL) - { - LARGE_INTEGER pos; - pos.QuadPart = offset; - if (!MySetFilePointerEx(hFile, pos, NULL, dwMoveMethod)) - { - DWORD dwErr = GetLastError(); - ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; - ret = -1; - } - else - ret=0; - } - return ret; -} - -long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T offset,int origin) -{ - DWORD dwMoveMethod=0xFFFFFFFF; - HANDLE hFile = NULL; - long ret=-1; - - if (stream!=NULL) - hFile = ((WIN32FILE_IOWIN*)stream)->hf; - - switch (origin) - { - case ZLIB_FILEFUNC_SEEK_CUR : - dwMoveMethod = FILE_CURRENT; - break; - case ZLIB_FILEFUNC_SEEK_END : - dwMoveMethod = FILE_END; - break; - case ZLIB_FILEFUNC_SEEK_SET : - dwMoveMethod = FILE_BEGIN; - break; - default: return -1; - } - - if (hFile) - { - LARGE_INTEGER pos; - pos.QuadPart = offset; - if (!MySetFilePointerEx(hFile, pos, NULL, dwMoveMethod)) - { - DWORD dwErr = GetLastError(); - ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; - ret = -1; - } - else - ret=0; - } - return ret; -} - -int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream) -{ - int ret=-1; - - if (stream!=NULL) - { - HANDLE hFile; - hFile = ((WIN32FILE_IOWIN*)stream) -> hf; - if (hFile != NULL) - { - CloseHandle(hFile); - ret=0; - } - free(stream); - } - return ret; -} - -int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream) -{ - int ret=-1; - if (stream!=NULL) - { - ret = ((WIN32FILE_IOWIN*)stream) -> error; - } - return ret; -} - -void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def) -{ - pzlib_filefunc_def->zopen_file = win32_open_file_func; - pzlib_filefunc_def->zread_file = win32_read_file_func; - pzlib_filefunc_def->zwrite_file = win32_write_file_func; - pzlib_filefunc_def->ztell_file = win32_tell_file_func; - pzlib_filefunc_def->zseek_file = win32_seek_file_func; - pzlib_filefunc_def->zclose_file = win32_close_file_func; - pzlib_filefunc_def->zerror_file = win32_error_file_func; - pzlib_filefunc_def->opaque = NULL; -} - -void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) -{ - pzlib_filefunc_def->zopen64_file = win32_open64_file_func; - pzlib_filefunc_def->zread_file = win32_read_file_func; - pzlib_filefunc_def->zwrite_file = win32_write_file_func; - pzlib_filefunc_def->ztell64_file = win32_tell64_file_func; - pzlib_filefunc_def->zseek64_file = win32_seek64_file_func; - pzlib_filefunc_def->zclose_file = win32_close_file_func; - pzlib_filefunc_def->zerror_file = win32_error_file_func; - pzlib_filefunc_def->opaque = NULL; -} - - -void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) -{ - pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA; - pzlib_filefunc_def->zread_file = win32_read_file_func; - pzlib_filefunc_def->zwrite_file = win32_write_file_func; - pzlib_filefunc_def->ztell64_file = win32_tell64_file_func; - pzlib_filefunc_def->zseek64_file = win32_seek64_file_func; - pzlib_filefunc_def->zclose_file = win32_close_file_func; - pzlib_filefunc_def->zerror_file = win32_error_file_func; - pzlib_filefunc_def->opaque = NULL; -} - - -void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def) -{ - pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW; - pzlib_filefunc_def->zread_file = win32_read_file_func; - pzlib_filefunc_def->zwrite_file = win32_write_file_func; - pzlib_filefunc_def->ztell64_file = win32_tell64_file_func; - pzlib_filefunc_def->zseek64_file = win32_seek64_file_func; - pzlib_filefunc_def->zclose_file = win32_close_file_func; - pzlib_filefunc_def->zerror_file = win32_error_file_func; - pzlib_filefunc_def->opaque = NULL; -} diff --git a/compat/zlib/contrib/minizip/iowin32.h b/compat/zlib/contrib/minizip/iowin32.h deleted file mode 100644 index 0ca0969..0000000 --- a/compat/zlib/contrib/minizip/iowin32.h +++ /dev/null @@ -1,28 +0,0 @@ -/* iowin32.h -- IO base function header for compress/uncompress .zip - Version 1.1, February 14h, 2010 - part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) - - Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) - - Modifications for Zip64 support - Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - - For more info read MiniZip_info.txt - -*/ - -#include - - -#ifdef __cplusplus -extern "C" { -#endif - -void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); -void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def)); -void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def)); -void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def)); - -#ifdef __cplusplus -} -#endif diff --git a/compat/zlib/contrib/minizip/make_vms.com b/compat/zlib/contrib/minizip/make_vms.com deleted file mode 100644 index 9ac13a9..0000000 --- a/compat/zlib/contrib/minizip/make_vms.com +++ /dev/null @@ -1,25 +0,0 @@ -$ if f$search("ioapi.h_orig") .eqs. "" then copy ioapi.h ioapi.h_orig -$ open/write zdef vmsdefs.h -$ copy sys$input: zdef -$ deck -#define unix -#define fill_zlib_filefunc64_32_def_from_filefunc32 fillzffunc64from -#define Write_Zip64EndOfCentralDirectoryLocator Write_Zip64EoDLocator -#define Write_Zip64EndOfCentralDirectoryRecord Write_Zip64EoDRecord -#define Write_EndOfCentralDirectoryRecord Write_EoDRecord -$ eod -$ close zdef -$ copy vmsdefs.h,ioapi.h_orig ioapi.h -$ cc/include=[--]/prefix=all ioapi.c -$ cc/include=[--]/prefix=all miniunz.c -$ cc/include=[--]/prefix=all unzip.c -$ cc/include=[--]/prefix=all minizip.c -$ cc/include=[--]/prefix=all zip.c -$ link miniunz,unzip,ioapi,[--]libz.olb/lib -$ link minizip,zip,ioapi,[--]libz.olb/lib -$ mcr []minizip test minizip_info.txt -$ mcr []miniunz -l test.zip -$ rename minizip_info.txt; minizip_info.txt_old -$ mcr []miniunz test.zip -$ delete test.zip;* -$exit diff --git a/compat/zlib/contrib/minizip/miniunz.c b/compat/zlib/contrib/minizip/miniunz.c deleted file mode 100644 index 3d65401..0000000 --- a/compat/zlib/contrib/minizip/miniunz.c +++ /dev/null @@ -1,660 +0,0 @@ -/* - miniunz.c - Version 1.1, February 14h, 2010 - sample part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) - - Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) - - Modifications of Unzip for Zip64 - Copyright (C) 2007-2008 Even Rouault - - Modifications for Zip64 support on both zip and unzip - Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) -*/ - -#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) - #ifndef __USE_FILE_OFFSET64 - #define __USE_FILE_OFFSET64 - #endif - #ifndef __USE_LARGEFILE64 - #define __USE_LARGEFILE64 - #endif - #ifndef _LARGEFILE64_SOURCE - #define _LARGEFILE64_SOURCE - #endif - #ifndef _FILE_OFFSET_BIT - #define _FILE_OFFSET_BIT 64 - #endif -#endif - -#ifdef __APPLE__ -// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions -#define FOPEN_FUNC(filename, mode) fopen(filename, mode) -#define FTELLO_FUNC(stream) ftello(stream) -#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) -#else -#define FOPEN_FUNC(filename, mode) fopen64(filename, mode) -#define FTELLO_FUNC(stream) ftello64(stream) -#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin) -#endif - - -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 -# include -# include -#else -# include -# include -#endif - - -#include "unzip.h" - -#define CASESENSITIVITY (0) -#define WRITEBUFFERSIZE (8192) -#define MAXFILENAME (256) - -#ifdef _WIN32 -#define USEWIN32IOAPI -#include "iowin32.h" -#endif -/* - mini unzip, demo of unzip package - - usage : - Usage : miniunz [-exvlo] file.zip [file_to_extract] [-d extractdir] - - list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT - if it exists -*/ - - -/* change_file_date : change the date/time of a file - filename : the filename of the file where date/time must be modified - dosdate : the new date at the MSDos format (4 bytes) - tmu_date : the SAME new date at the tm_unz format */ -void change_file_date(filename,dosdate,tmu_date) - const char *filename; - uLong dosdate; - tm_unz tmu_date; -{ -#ifdef _WIN32 - HANDLE hFile; - FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; - - hFile = CreateFileA(filename,GENERIC_READ | GENERIC_WRITE, - 0,NULL,OPEN_EXISTING,0,NULL); - GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite); - DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal); - LocalFileTimeToFileTime(&ftLocal,&ftm); - SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); - CloseHandle(hFile); -#else -#ifdef unix || __APPLE__ - struct utimbuf ut; - struct tm newdate; - newdate.tm_sec = tmu_date.tm_sec; - newdate.tm_min=tmu_date.tm_min; - newdate.tm_hour=tmu_date.tm_hour; - newdate.tm_mday=tmu_date.tm_mday; - newdate.tm_mon=tmu_date.tm_mon; - if (tmu_date.tm_year > 1900) - newdate.tm_year=tmu_date.tm_year - 1900; - else - newdate.tm_year=tmu_date.tm_year ; - newdate.tm_isdst=-1; - - ut.actime=ut.modtime=mktime(&newdate); - utime(filename,&ut); -#endif -#endif -} - - -/* mymkdir and change_file_date are not 100 % portable - As I don't know well Unix, I wait feedback for the unix portion */ - -int mymkdir(dirname) - const char* dirname; -{ - int ret=0; -#ifdef _WIN32 - ret = _mkdir(dirname); -#elif unix - ret = mkdir (dirname,0775); -#elif __APPLE__ - ret = mkdir (dirname,0775); -#endif - return ret; -} - -int makedir (newdir) - char *newdir; -{ - char *buffer ; - char *p; - int len = (int)strlen(newdir); - - if (len <= 0) - return 0; - - buffer = (char*)malloc(len+1); - if (buffer==NULL) - { - printf("Error allocating memory\n"); - return UNZ_INTERNALERROR; - } - strcpy(buffer,newdir); - - if (buffer[len-1] == '/') { - buffer[len-1] = '\0'; - } - if (mymkdir(buffer) == 0) - { - free(buffer); - return 1; - } - - p = buffer+1; - while (1) - { - char hold; - - while(*p && *p != '\\' && *p != '/') - p++; - hold = *p; - *p = 0; - if ((mymkdir(buffer) == -1) && (errno == ENOENT)) - { - printf("couldn't create directory %s\n",buffer); - free(buffer); - return 0; - } - if (hold == 0) - break; - *p++ = hold; - } - free(buffer); - return 1; -} - -void do_banner() -{ - printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); - printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); -} - -void do_help() -{ - printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \ - " -e Extract without pathname (junk paths)\n" \ - " -x Extract with pathname\n" \ - " -v list files\n" \ - " -l list files\n" \ - " -d directory to extract into\n" \ - " -o overwrite files without prompting\n" \ - " -p extract crypted file using password\n\n"); -} - -void Display64BitsSize(ZPOS64_T n, int size_char) -{ - /* to avoid compatibility problem , we do here the conversion */ - char number[21]; - int offset=19; - int pos_string = 19; - number[20]=0; - for (;;) { - number[offset]=(char)((n%10)+'0'); - if (number[offset] != '0') - pos_string=offset; - n/=10; - if (offset==0) - break; - offset--; - } - { - int size_display_string = 19-pos_string; - while (size_char > size_display_string) - { - size_char--; - printf(" "); - } - } - - printf("%s",&number[pos_string]); -} - -int do_list(uf) - unzFile uf; -{ - uLong i; - unz_global_info64 gi; - int err; - - err = unzGetGlobalInfo64(uf,&gi); - if (err!=UNZ_OK) - printf("error %d with zipfile in unzGetGlobalInfo \n",err); - printf(" Length Method Size Ratio Date Time CRC-32 Name\n"); - printf(" ------ ------ ---- ----- ---- ---- ------ ----\n"); - for (i=0;i0) - ratio = (uLong)((file_info.compressed_size*100)/file_info.uncompressed_size); - - /* display a '*' if the file is crypted */ - if ((file_info.flag & 1) != 0) - charCrypt='*'; - - if (file_info.compression_method==0) - string_method="Stored"; - else - if (file_info.compression_method==Z_DEFLATED) - { - uInt iLevel=(uInt)((file_info.flag & 0x6)/2); - if (iLevel==0) - string_method="Defl:N"; - else if (iLevel==1) - string_method="Defl:X"; - else if ((iLevel==2) || (iLevel==3)) - string_method="Defl:F"; /* 2:fast , 3 : extra fast*/ - } - else - if (file_info.compression_method==Z_BZIP2ED) - { - string_method="BZip2 "; - } - else - string_method="Unkn. "; - - Display64BitsSize(file_info.uncompressed_size,7); - printf(" %6s%c",string_method,charCrypt); - Display64BitsSize(file_info.compressed_size,7); - printf(" %3lu%% %2.2lu-%2.2lu-%2.2lu %2.2lu:%2.2lu %8.8lx %s\n", - ratio, - (uLong)file_info.tmu_date.tm_mon + 1, - (uLong)file_info.tmu_date.tm_mday, - (uLong)file_info.tmu_date.tm_year % 100, - (uLong)file_info.tmu_date.tm_hour,(uLong)file_info.tmu_date.tm_min, - (uLong)file_info.crc,filename_inzip); - if ((i+1)='a') && (rep<='z')) - rep -= 0x20; - } - while ((rep!='Y') && (rep!='N') && (rep!='A')); - } - - if (rep == 'N') - skip = 1; - - if (rep == 'A') - *popt_overwrite=1; - } - - if ((skip==0) && (err==UNZ_OK)) - { - fout=FOPEN_FUNC(write_filename,"wb"); - /* some zipfile don't contain directory alone before file */ - if ((fout==NULL) && ((*popt_extract_without_path)==0) && - (filename_withoutpath!=(char*)filename_inzip)) - { - char c=*(filename_withoutpath-1); - *(filename_withoutpath-1)='\0'; - makedir(write_filename); - *(filename_withoutpath-1)=c; - fout=FOPEN_FUNC(write_filename,"wb"); - } - - if (fout==NULL) - { - printf("error opening %s\n",write_filename); - } - } - - if (fout!=NULL) - { - printf(" extracting: %s\n",write_filename); - - do - { - err = unzReadCurrentFile(uf,buf,size_buf); - if (err<0) - { - printf("error %d with zipfile in unzReadCurrentFile\n",err); - break; - } - if (err>0) - if (fwrite(buf,err,1,fout)!=1) - { - printf("error in writing extracted file\n"); - err=UNZ_ERRNO; - break; - } - } - while (err>0); - if (fout) - fclose(fout); - - if (err==0) - change_file_date(write_filename,file_info.dosDate, - file_info.tmu_date); - } - - if (err==UNZ_OK) - { - err = unzCloseCurrentFile (uf); - if (err!=UNZ_OK) - { - printf("error %d with zipfile in unzCloseCurrentFile\n",err); - } - } - else - unzCloseCurrentFile(uf); /* don't lose the error */ - } - - free(buf); - return err; -} - - -int do_extract(uf,opt_extract_without_path,opt_overwrite,password) - unzFile uf; - int opt_extract_without_path; - int opt_overwrite; - const char* password; -{ - uLong i; - unz_global_info64 gi; - int err; - FILE* fout=NULL; - - err = unzGetGlobalInfo64(uf,&gi); - if (err!=UNZ_OK) - printf("error %d with zipfile in unzGetGlobalInfo \n",err); - - for (i=0;i insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -miniunzip - uncompress and examine ZIP archives -.SH SYNOPSIS -.B miniunzip -.RI [ -exvlo ] -zipfile [ files_to_extract ] [-d tempdir] -.SH DESCRIPTION -.B minizip -is a simple tool which allows the extraction of compressed file -archives in the ZIP format used by the MS-DOS utility PKZIP. It was -written as a demonstration of the -.IR zlib (3) -library and therefore lack many of the features of the -.IR unzip (1) -program. -.SH OPTIONS -A number of options are supported. With the exception of -.BI \-d\ tempdir -these must be supplied before any -other arguments and are: -.TP -.BI \-l\ ,\ \-\-v -List the files in the archive without extracting them. -.TP -.B \-o -Overwrite files without prompting for confirmation. -.TP -.B \-x -Extract files (default). -.PP -The -.I zipfile -argument is the name of the archive to process. The next argument can be used -to specify a single file to extract from the archive. - -Lastly, the following option can be specified at the end of the command-line: -.TP -.BI \-d\ tempdir -Extract the archive in the directory -.I tempdir -rather than the current directory. -.SH SEE ALSO -.BR minizip (1), -.BR zlib (3), -.BR unzip (1). -.SH AUTHOR -This program was written by Gilles Vollant. This manual page was -written by Mark Brown . The -d tempdir option -was added by Dirk Eddelbuettel . diff --git a/compat/zlib/contrib/minizip/minizip.1 b/compat/zlib/contrib/minizip/minizip.1 deleted file mode 100644 index 1154484..0000000 --- a/compat/zlib/contrib/minizip/minizip.1 +++ /dev/null @@ -1,46 +0,0 @@ -.\" Hey, EMACS: -*- nroff -*- -.TH minizip 1 "May 2, 2001" -.\" Please adjust this date whenever revising the manpage. -.\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -minizip - create ZIP archives -.SH SYNOPSIS -.B minizip -.RI [ -o ] -zipfile [ " files" ... ] -.SH DESCRIPTION -.B minizip -is a simple tool which allows the creation of compressed file archives -in the ZIP format used by the MS-DOS utility PKZIP. It was written as -a demonstration of the -.IR zlib (3) -library and therefore lack many of the features of the -.IR zip (1) -program. -.SH OPTIONS -The first argument supplied is the name of the ZIP archive to create or -.RI -o -in which case it is ignored and the second argument treated as the -name of the ZIP file. If the ZIP file already exists it will be -overwritten. -.PP -Subsequent arguments specify a list of files to place in the ZIP -archive. If none are specified then an empty archive will be created. -.SH SEE ALSO -.BR miniunzip (1), -.BR zlib (3), -.BR zip (1). -.SH AUTHOR -This program was written by Gilles Vollant. This manual page was -written by Mark Brown . - diff --git a/compat/zlib/contrib/minizip/minizip.c b/compat/zlib/contrib/minizip/minizip.c deleted file mode 100644 index 4288962..0000000 --- a/compat/zlib/contrib/minizip/minizip.c +++ /dev/null @@ -1,520 +0,0 @@ -/* - minizip.c - Version 1.1, February 14h, 2010 - sample part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) - - Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) - - Modifications of Unzip for Zip64 - Copyright (C) 2007-2008 Even Rouault - - Modifications for Zip64 support on both zip and unzip - Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) -*/ - - -#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__)) - #ifndef __USE_FILE_OFFSET64 - #define __USE_FILE_OFFSET64 - #endif - #ifndef __USE_LARGEFILE64 - #define __USE_LARGEFILE64 - #endif - #ifndef _LARGEFILE64_SOURCE - #define _LARGEFILE64_SOURCE - #endif - #ifndef _FILE_OFFSET_BIT - #define _FILE_OFFSET_BIT 64 - #endif -#endif - -#ifdef __APPLE__ -// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions -#define FOPEN_FUNC(filename, mode) fopen(filename, mode) -#define FTELLO_FUNC(stream) ftello(stream) -#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) -#else -#define FOPEN_FUNC(filename, mode) fopen64(filename, mode) -#define FTELLO_FUNC(stream) ftello64(stream) -#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin) -#endif - - - -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 -# include -# include -#else -# include -# include -# include -# include -#endif - -#include "zip.h" - -#ifdef _WIN32 - #define USEWIN32IOAPI - #include "iowin32.h" -#endif - - - -#define WRITEBUFFERSIZE (16384) -#define MAXFILENAME (256) - -#ifdef _WIN32 -uLong filetime(f, tmzip, dt) - char *f; /* name of file to get info on */ - tm_zip *tmzip; /* return value: access, modific. and creation times */ - uLong *dt; /* dostime */ -{ - int ret = 0; - { - FILETIME ftLocal; - HANDLE hFind; - WIN32_FIND_DATAA ff32; - - hFind = FindFirstFileA(f,&ff32); - if (hFind != INVALID_HANDLE_VALUE) - { - FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal); - FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0); - FindClose(hFind); - ret = 1; - } - } - return ret; -} -#else -#ifdef unix || __APPLE__ -uLong filetime(f, tmzip, dt) - char *f; /* name of file to get info on */ - tm_zip *tmzip; /* return value: access, modific. and creation times */ - uLong *dt; /* dostime */ -{ - int ret=0; - struct stat s; /* results of stat() */ - struct tm* filedate; - time_t tm_t=0; - - if (strcmp(f,"-")!=0) - { - char name[MAXFILENAME+1]; - int len = strlen(f); - if (len > MAXFILENAME) - len = MAXFILENAME; - - strncpy(name, f,MAXFILENAME-1); - /* strncpy doesnt append the trailing NULL, of the string is too long. */ - name[ MAXFILENAME ] = '\0'; - - if (name[len - 1] == '/') - name[len - 1] = '\0'; - /* not all systems allow stat'ing a file with / appended */ - if (stat(name,&s)==0) - { - tm_t = s.st_mtime; - ret = 1; - } - } - filedate = localtime(&tm_t); - - tmzip->tm_sec = filedate->tm_sec; - tmzip->tm_min = filedate->tm_min; - tmzip->tm_hour = filedate->tm_hour; - tmzip->tm_mday = filedate->tm_mday; - tmzip->tm_mon = filedate->tm_mon ; - tmzip->tm_year = filedate->tm_year; - - return ret; -} -#else -uLong filetime(f, tmzip, dt) - char *f; /* name of file to get info on */ - tm_zip *tmzip; /* return value: access, modific. and creation times */ - uLong *dt; /* dostime */ -{ - return 0; -} -#endif -#endif - - - - -int check_exist_file(filename) - const char* filename; -{ - FILE* ftestexist; - int ret = 1; - ftestexist = FOPEN_FUNC(filename,"rb"); - if (ftestexist==NULL) - ret = 0; - else - fclose(ftestexist); - return ret; -} - -void do_banner() -{ - printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n"); - printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n"); -} - -void do_help() -{ - printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \ - " -o Overwrite existing file.zip\n" \ - " -a Append to existing file.zip\n" \ - " -0 Store only\n" \ - " -1 Compress faster\n" \ - " -9 Compress better\n\n" \ - " -j exclude path. store only the file name.\n\n"); -} - -/* calculate the CRC32 of a file, - because to encrypt a file, we need known the CRC32 of the file before */ -int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc) -{ - unsigned long calculate_crc=0; - int err=ZIP_OK; - FILE * fin = FOPEN_FUNC(filenameinzip,"rb"); - - unsigned long size_read = 0; - unsigned long total_read = 0; - if (fin==NULL) - { - err = ZIP_ERRNO; - } - - if (err == ZIP_OK) - do - { - err = ZIP_OK; - size_read = (int)fread(buf,1,size_buf,fin); - if (size_read < size_buf) - if (feof(fin)==0) - { - printf("error in reading %s\n",filenameinzip); - err = ZIP_ERRNO; - } - - if (size_read>0) - calculate_crc = crc32(calculate_crc,buf,size_read); - total_read += size_read; - - } while ((err == ZIP_OK) && (size_read>0)); - - if (fin) - fclose(fin); - - *result_crc=calculate_crc; - printf("file %s crc %lx\n", filenameinzip, calculate_crc); - return err; -} - -int isLargeFile(const char* filename) -{ - int largeFile = 0; - ZPOS64_T pos = 0; - FILE* pFile = FOPEN_FUNC(filename, "rb"); - - if(pFile != NULL) - { - int n = FSEEKO_FUNC(pFile, 0, SEEK_END); - pos = FTELLO_FUNC(pFile); - - printf("File : %s is %lld bytes\n", filename, pos); - - if(pos >= 0xffffffff) - largeFile = 1; - - fclose(pFile); - } - - return largeFile; -} - -int main(argc,argv) - int argc; - char *argv[]; -{ - int i; - int opt_overwrite=0; - int opt_compress_level=Z_DEFAULT_COMPRESSION; - int opt_exclude_path=0; - int zipfilenamearg = 0; - char filename_try[MAXFILENAME+16]; - int zipok; - int err=0; - int size_buf=0; - void* buf=NULL; - const char* password=NULL; - - - do_banner(); - if (argc==1) - { - do_help(); - return 0; - } - else - { - for (i=1;i='0') && (c<='9')) - opt_compress_level = c-'0'; - if ((c=='j') || (c=='J')) - opt_exclude_path = 1; - - if (((c=='p') || (c=='P')) && (i+1='a') && (rep<='z')) - rep -= 0x20; - } - while ((rep!='Y') && (rep!='N') && (rep!='A')); - if (rep=='N') - zipok = 0; - if (rep=='A') - opt_overwrite = 2; - } - } - - if (zipok==1) - { - zipFile zf; - int errclose; -# ifdef USEWIN32IOAPI - zlib_filefunc64_def ffunc; - fill_win32_filefunc64A(&ffunc); - zf = zipOpen2_64(filename_try,(opt_overwrite==2) ? 2 : 0,NULL,&ffunc); -# else - zf = zipOpen64(filename_try,(opt_overwrite==2) ? 2 : 0); -# endif - - if (zf == NULL) - { - printf("error opening %s\n",filename_try); - err= ZIP_ERRNO; - } - else - printf("creating %s\n",filename_try); - - for (i=zipfilenamearg+1;(i='0') || (argv[i][1]<='9'))) && - (strlen(argv[i]) == 2))) - { - FILE * fin; - int size_read; - const char* filenameinzip = argv[i]; - const char *savefilenameinzip; - zip_fileinfo zi; - unsigned long crcFile=0; - int zip64 = 0; - - zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour = - zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0; - zi.dosDate = 0; - zi.internal_fa = 0; - zi.external_fa = 0; - filetime(filenameinzip,&zi.tmz_date,&zi.dosDate); - -/* - err = zipOpenNewFileInZip(zf,filenameinzip,&zi, - NULL,0,NULL,0,NULL / * comment * /, - (opt_compress_level != 0) ? Z_DEFLATED : 0, - opt_compress_level); -*/ - if ((password != NULL) && (err==ZIP_OK)) - err = getFileCrc(filenameinzip,buf,size_buf,&crcFile); - - zip64 = isLargeFile(filenameinzip); - - /* The path name saved, should not include a leading slash. */ - /*if it did, windows/xp and dynazip couldn't read the zip file. */ - savefilenameinzip = filenameinzip; - while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' ) - { - savefilenameinzip++; - } - - /*should the zip file contain any path at all?*/ - if( opt_exclude_path ) - { - const char *tmpptr; - const char *lastslash = 0; - for( tmpptr = savefilenameinzip; *tmpptr; tmpptr++) - { - if( *tmpptr == '\\' || *tmpptr == '/') - { - lastslash = tmpptr; - } - } - if( lastslash != NULL ) - { - savefilenameinzip = lastslash+1; // base filename follows last slash. - } - } - - /**/ - err = zipOpenNewFileInZip3_64(zf,savefilenameinzip,&zi, - NULL,0,NULL,0,NULL /* comment*/, - (opt_compress_level != 0) ? Z_DEFLATED : 0, - opt_compress_level,0, - /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */ - -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, - password,crcFile, zip64); - - if (err != ZIP_OK) - printf("error in opening %s in zipfile\n",filenameinzip); - else - { - fin = FOPEN_FUNC(filenameinzip,"rb"); - if (fin==NULL) - { - err=ZIP_ERRNO; - printf("error in opening %s for reading\n",filenameinzip); - } - } - - if (err == ZIP_OK) - do - { - err = ZIP_OK; - size_read = (int)fread(buf,1,size_buf,fin); - if (size_read < size_buf) - if (feof(fin)==0) - { - printf("error in reading %s\n",filenameinzip); - err = ZIP_ERRNO; - } - - if (size_read>0) - { - err = zipWriteInFileInZip (zf,buf,size_read); - if (err<0) - { - printf("error in writing %s in the zipfile\n", - filenameinzip); - } - - } - } while ((err == ZIP_OK) && (size_read>0)); - - if (fin) - fclose(fin); - - if (err<0) - err=ZIP_ERRNO; - else - { - err = zipCloseFileInZip(zf); - if (err!=ZIP_OK) - printf("error in closing %s in the zipfile\n", - filenameinzip); - } - } - } - errclose = zipClose(zf,NULL); - if (errclose != ZIP_OK) - printf("error in closing %s\n",filename_try); - } - else - { - do_help(); - } - - free(buf); - return 0; -} diff --git a/compat/zlib/contrib/minizip/minizip.pc.in b/compat/zlib/contrib/minizip/minizip.pc.in deleted file mode 100644 index 69b5b7f..0000000 --- a/compat/zlib/contrib/minizip/minizip.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@/minizip - -Name: minizip -Description: Minizip zip file manipulation library -Requires: -Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lminizip -Libs.private: -lz -Cflags: -I${includedir} diff --git a/compat/zlib/contrib/minizip/mztools.c b/compat/zlib/contrib/minizip/mztools.c deleted file mode 100644 index 96891c2..0000000 --- a/compat/zlib/contrib/minizip/mztools.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - Additional tools for Minizip - Code: Xavier Roche '2004 - License: Same as ZLIB (www.gzip.org) -*/ - -/* Code */ -#include -#include -#include -#include "zlib.h" -#include "unzip.h" - -#define READ_8(adr) ((unsigned char)*(adr)) -#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) ) -#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) ) - -#define WRITE_8(buff, n) do { \ - *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \ -} while(0) -#define WRITE_16(buff, n) do { \ - WRITE_8((unsigned char*)(buff), n); \ - WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \ -} while(0) -#define WRITE_32(buff, n) do { \ - WRITE_16((unsigned char*)(buff), (n) & 0xffff); \ - WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \ -} while(0) - -extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered) -const char* file; -const char* fileOut; -const char* fileOutTmp; -uLong* nRecovered; -uLong* bytesRecovered; -{ - int err = Z_OK; - FILE* fpZip = fopen(file, "rb"); - FILE* fpOut = fopen(fileOut, "wb"); - FILE* fpOutCD = fopen(fileOutTmp, "wb"); - if (fpZip != NULL && fpOut != NULL) { - int entries = 0; - uLong totalBytes = 0; - char header[30]; - char filename[1024]; - char extra[1024]; - int offset = 0; - int offsetCD = 0; - while ( fread(header, 1, 30, fpZip) == 30 ) { - int currentOffset = offset; - - /* File entry */ - if (READ_32(header) == 0x04034b50) { - unsigned int version = READ_16(header + 4); - unsigned int gpflag = READ_16(header + 6); - unsigned int method = READ_16(header + 8); - unsigned int filetime = READ_16(header + 10); - unsigned int filedate = READ_16(header + 12); - unsigned int crc = READ_32(header + 14); /* crc */ - unsigned int cpsize = READ_32(header + 18); /* compressed size */ - unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */ - unsigned int fnsize = READ_16(header + 26); /* file name length */ - unsigned int extsize = READ_16(header + 28); /* extra field length */ - filename[0] = extra[0] = '\0'; - - /* Header */ - if (fwrite(header, 1, 30, fpOut) == 30) { - offset += 30; - } else { - err = Z_ERRNO; - break; - } - - /* Filename */ - if (fnsize > 0) { - if (fnsize < sizeof(filename)) { - if (fread(filename, 1, fnsize, fpZip) == fnsize) { - if (fwrite(filename, 1, fnsize, fpOut) == fnsize) { - offset += fnsize; - } else { - err = Z_ERRNO; - break; - } - } else { - err = Z_ERRNO; - break; - } - } else { - err = Z_ERRNO; - break; - } - } else { - err = Z_STREAM_ERROR; - break; - } - - /* Extra field */ - if (extsize > 0) { - if (extsize < sizeof(extra)) { - if (fread(extra, 1, extsize, fpZip) == extsize) { - if (fwrite(extra, 1, extsize, fpOut) == extsize) { - offset += extsize; - } else { - err = Z_ERRNO; - break; - } - } else { - err = Z_ERRNO; - break; - } - } else { - err = Z_ERRNO; - break; - } - } - - /* Data */ - { - int dataSize = cpsize; - if (dataSize == 0) { - dataSize = uncpsize; - } - if (dataSize > 0) { - char* data = malloc(dataSize); - if (data != NULL) { - if ((int)fread(data, 1, dataSize, fpZip) == dataSize) { - if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) { - offset += dataSize; - totalBytes += dataSize; - } else { - err = Z_ERRNO; - } - } else { - err = Z_ERRNO; - } - free(data); - if (err != Z_OK) { - break; - } - } else { - err = Z_MEM_ERROR; - break; - } - } - } - - /* Central directory entry */ - { - char header[46]; - char* comment = ""; - int comsize = (int) strlen(comment); - WRITE_32(header, 0x02014b50); - WRITE_16(header + 4, version); - WRITE_16(header + 6, version); - WRITE_16(header + 8, gpflag); - WRITE_16(header + 10, method); - WRITE_16(header + 12, filetime); - WRITE_16(header + 14, filedate); - WRITE_32(header + 16, crc); - WRITE_32(header + 20, cpsize); - WRITE_32(header + 24, uncpsize); - WRITE_16(header + 28, fnsize); - WRITE_16(header + 30, extsize); - WRITE_16(header + 32, comsize); - WRITE_16(header + 34, 0); /* disk # */ - WRITE_16(header + 36, 0); /* int attrb */ - WRITE_32(header + 38, 0); /* ext attrb */ - WRITE_32(header + 42, currentOffset); - /* Header */ - if (fwrite(header, 1, 46, fpOutCD) == 46) { - offsetCD += 46; - - /* Filename */ - if (fnsize > 0) { - if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) { - offsetCD += fnsize; - } else { - err = Z_ERRNO; - break; - } - } else { - err = Z_STREAM_ERROR; - break; - } - - /* Extra field */ - if (extsize > 0) { - if (fwrite(extra, 1, extsize, fpOutCD) == extsize) { - offsetCD += extsize; - } else { - err = Z_ERRNO; - break; - } - } - - /* Comment field */ - if (comsize > 0) { - if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) { - offsetCD += comsize; - } else { - err = Z_ERRNO; - break; - } - } - - - } else { - err = Z_ERRNO; - break; - } - } - - /* Success */ - entries++; - - } else { - break; - } - } - - /* Final central directory */ - { - int entriesZip = entries; - char header[22]; - char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools"; - int comsize = (int) strlen(comment); - if (entriesZip > 0xffff) { - entriesZip = 0xffff; - } - WRITE_32(header, 0x06054b50); - WRITE_16(header + 4, 0); /* disk # */ - WRITE_16(header + 6, 0); /* disk # */ - WRITE_16(header + 8, entriesZip); /* hack */ - WRITE_16(header + 10, entriesZip); /* hack */ - WRITE_32(header + 12, offsetCD); /* size of CD */ - WRITE_32(header + 16, offset); /* offset to CD */ - WRITE_16(header + 20, comsize); /* comment */ - - /* Header */ - if (fwrite(header, 1, 22, fpOutCD) == 22) { - - /* Comment field */ - if (comsize > 0) { - if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) { - err = Z_ERRNO; - } - } - - } else { - err = Z_ERRNO; - } - } - - /* Final merge (file + central directory) */ - fclose(fpOutCD); - if (err == Z_OK) { - fpOutCD = fopen(fileOutTmp, "rb"); - if (fpOutCD != NULL) { - int nRead; - char buffer[8192]; - while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) { - if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) { - err = Z_ERRNO; - break; - } - } - fclose(fpOutCD); - } - } - - /* Close */ - fclose(fpZip); - fclose(fpOut); - - /* Wipe temporary file */ - (void)remove(fileOutTmp); - - /* Number of recovered entries */ - if (err == Z_OK) { - if (nRecovered != NULL) { - *nRecovered = entries; - } - if (bytesRecovered != NULL) { - *bytesRecovered = totalBytes; - } - } - } else { - err = Z_STREAM_ERROR; - } - return err; -} diff --git a/compat/zlib/contrib/minizip/mztools.h b/compat/zlib/contrib/minizip/mztools.h deleted file mode 100644 index a49a426..0000000 --- a/compat/zlib/contrib/minizip/mztools.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Additional tools for Minizip - Code: Xavier Roche '2004 - License: Same as ZLIB (www.gzip.org) -*/ - -#ifndef _zip_tools_H -#define _zip_tools_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _ZLIB_H -#include "zlib.h" -#endif - -#include "unzip.h" - -/* Repair a ZIP file (missing central directory) - file: file to recover - fileOut: output file after recovery - fileOutTmp: temporary file name used for recovery -*/ -extern int ZEXPORT unzRepair(const char* file, - const char* fileOut, - const char* fileOutTmp, - uLong* nRecovered, - uLong* bytesRecovered); - - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/compat/zlib/contrib/minizip/unzip.c b/compat/zlib/contrib/minizip/unzip.c deleted file mode 100644 index bcfb941..0000000 --- a/compat/zlib/contrib/minizip/unzip.c +++ /dev/null @@ -1,2125 +0,0 @@ -/* unzip.c -- IO for uncompress .zip files using zlib - Version 1.1, February 14h, 2010 - part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) - - Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) - - Modifications of Unzip for Zip64 - Copyright (C) 2007-2008 Even Rouault - - Modifications for Zip64 support on both zip and unzip - Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - - For more info read MiniZip_info.txt - - - ------------------------------------------------------------------------------------ - Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of - compatibility with older software. The following is from the original crypt.c. - Code woven in by Terry Thorsen 1/2003. - - Copyright (c) 1990-2000 Info-ZIP. All rights reserved. - - See the accompanying file LICENSE, version 2000-Apr-09 or later - (the contents of which are also included in zip.h) for terms of use. - If, for some reason, all these files are missing, the Info-ZIP license - also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html - - crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h] - - The encryption/decryption parts of this source code (as opposed to the - non-echoing password parts) were originally written in Europe. The - whole source package can be freely distributed, including from the USA. - (Prior to January 2000, re-export from the US was a violation of US law.) - - This encryption code is a direct transcription of the algorithm from - Roger Schlafly, described by Phil Katz in the file appnote.txt. This - file (appnote.txt) is distributed with the PKZIP program (even in the - version without encryption capabilities). - - ------------------------------------------------------------------------------------ - - Changes in unzip.c - - 2007-2008 - Even Rouault - Addition of cpl_unzGetCurrentFileZStreamPos - 2007-2008 - Even Rouault - Decoration of symbol names unz* -> cpl_unz* - 2007-2008 - Even Rouault - Remove old C style function prototypes - 2007-2008 - Even Rouault - Add unzip support for ZIP64 - - Copyright (C) 2007-2008 Even Rouault - - - Oct-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again). - Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G - should only read the compressed/uncompressed size from the Zip64 format if - the size from normal header was 0xFFFFFFFF - Oct-2009 - Mathias Svensson - Applied some bug fixes from paches recived from Gilles Vollant - Oct-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required) - Patch created by Daniel Borca - - Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer - - Copyright (C) 1998 - 2010 Gilles Vollant, Even Rouault, Mathias Svensson - -*/ - - -#include -#include -#include - -#ifndef NOUNCRYPT - #define NOUNCRYPT -#endif - -#include "zlib.h" -#include "unzip.h" - -#ifdef STDC -# include -# include -# include -#endif -#ifdef NO_ERRNO_H - extern int errno; -#else -# include -#endif - - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - - -#ifndef CASESENSITIVITYDEFAULT_NO -# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) -# define CASESENSITIVITYDEFAULT_NO -# endif -#endif - - -#ifndef UNZ_BUFSIZE -#define UNZ_BUFSIZE (16384) -#endif - -#ifndef UNZ_MAXFILENAMEINZIP -#define UNZ_MAXFILENAMEINZIP (256) -#endif - -#ifndef ALLOC -# define ALLOC(size) (malloc(size)) -#endif -#ifndef TRYFREE -# define TRYFREE(p) {if (p) free(p);} -#endif - -#define SIZECENTRALDIRITEM (0x2e) -#define SIZEZIPLOCALHEADER (0x1e) - - -const char unz_copyright[] = - " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; - -/* unz_file_info_interntal contain internal info about a file in zipfile*/ -typedef struct unz_file_info64_internal_s -{ - ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ -} unz_file_info64_internal; - - -/* file_in_zip_read_info_s contain internal information about a file in zipfile, - when reading and decompress it */ -typedef struct -{ - char *read_buffer; /* internal buffer for compressed data */ - z_stream stream; /* zLib stream structure for inflate */ - -#ifdef HAVE_BZIP2 - bz_stream bstream; /* bzLib stream structure for bziped */ -#endif - - ZPOS64_T pos_in_zipfile; /* position in byte on the zipfile, for fseek*/ - uLong stream_initialised; /* flag set if stream structure is initialised*/ - - ZPOS64_T offset_local_extrafield;/* offset of the local extra field */ - uInt size_local_extrafield;/* size of the local extra field */ - ZPOS64_T pos_local_extrafield; /* position in the local extra field in read*/ - ZPOS64_T total_out_64; - - uLong crc32; /* crc32 of all data uncompressed */ - uLong crc32_wait; /* crc32 we must obtain after decompress all */ - ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */ - ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/ - zlib_filefunc64_32_def z_filefunc; - voidpf filestream; /* io structore of the zipfile */ - uLong compression_method; /* compression method (0==store) */ - ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ - int raw; -} file_in_zip64_read_info_s; - - -/* unz64_s contain internal information about the zipfile -*/ -typedef struct -{ - zlib_filefunc64_32_def z_filefunc; - int is64bitOpenFunction; - voidpf filestream; /* io structore of the zipfile */ - unz_global_info64 gi; /* public global information */ - ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ - ZPOS64_T num_file; /* number of the current file in the zipfile*/ - ZPOS64_T pos_in_central_dir; /* pos of the current file in the central dir*/ - ZPOS64_T current_file_ok; /* flag about the usability of the current file*/ - ZPOS64_T central_pos; /* position of the beginning of the central dir*/ - - ZPOS64_T size_central_dir; /* size of the central directory */ - ZPOS64_T offset_central_dir; /* offset of start of central directory with - respect to the starting disk number */ - - unz_file_info64 cur_file_info; /* public info about the current file in zip*/ - unz_file_info64_internal cur_file_info_internal; /* private info about it*/ - file_in_zip64_read_info_s* pfile_in_zip_read; /* structure about the current - file if we are decompressing it */ - int encrypted; - - int isZip64; - -# ifndef NOUNCRYPT - unsigned long keys[3]; /* keys defining the pseudo-random sequence */ - const z_crc_t* pcrc_32_tab; -# endif -} unz64_s; - - -#ifndef NOUNCRYPT -#include "crypt.h" -#endif - -/* =========================================================================== - Read a byte from a gz_stream; update next_in and avail_in. Return EOF - for end of file. - IN assertion: the stream s has been successfully opened for reading. -*/ - - -local int unz64local_getByte OF(( - const zlib_filefunc64_32_def* pzlib_filefunc_def, - voidpf filestream, - int *pi)); - -local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi) -{ - unsigned char c; - int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1); - if (err==1) - { - *pi = (int)c; - return UNZ_OK; - } - else - { - if (ZERROR64(*pzlib_filefunc_def,filestream)) - return UNZ_ERRNO; - else - return UNZ_EOF; - } -} - - -/* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets -*/ -local int unz64local_getShort OF(( - const zlib_filefunc64_32_def* pzlib_filefunc_def, - voidpf filestream, - uLong *pX)); - -local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, - voidpf filestream, - uLong *pX) -{ - uLong x ; - int i = 0; - int err; - - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x = (uLong)i; - - if (err==UNZ_OK) - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x |= ((uLong)i)<<8; - - if (err==UNZ_OK) - *pX = x; - else - *pX = 0; - return err; -} - -local int unz64local_getLong OF(( - const zlib_filefunc64_32_def* pzlib_filefunc_def, - voidpf filestream, - uLong *pX)); - -local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, - voidpf filestream, - uLong *pX) -{ - uLong x ; - int i = 0; - int err; - - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x = (uLong)i; - - if (err==UNZ_OK) - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x |= ((uLong)i)<<8; - - if (err==UNZ_OK) - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x |= ((uLong)i)<<16; - - if (err==UNZ_OK) - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x += ((uLong)i)<<24; - - if (err==UNZ_OK) - *pX = x; - else - *pX = 0; - return err; -} - -local int unz64local_getLong64 OF(( - const zlib_filefunc64_32_def* pzlib_filefunc_def, - voidpf filestream, - ZPOS64_T *pX)); - - -local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, - voidpf filestream, - ZPOS64_T *pX) -{ - ZPOS64_T x ; - int i = 0; - int err; - - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x = (ZPOS64_T)i; - - if (err==UNZ_OK) - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x |= ((ZPOS64_T)i)<<8; - - if (err==UNZ_OK) - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x |= ((ZPOS64_T)i)<<16; - - if (err==UNZ_OK) - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x |= ((ZPOS64_T)i)<<24; - - if (err==UNZ_OK) - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x |= ((ZPOS64_T)i)<<32; - - if (err==UNZ_OK) - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x |= ((ZPOS64_T)i)<<40; - - if (err==UNZ_OK) - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x |= ((ZPOS64_T)i)<<48; - - if (err==UNZ_OK) - err = unz64local_getByte(pzlib_filefunc_def,filestream,&i); - x |= ((ZPOS64_T)i)<<56; - - if (err==UNZ_OK) - *pX = x; - else - *pX = 0; - return err; -} - -/* My own strcmpi / strcasecmp */ -local int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2) -{ - for (;;) - { - char c1=*(fileName1++); - char c2=*(fileName2++); - if ((c1>='a') && (c1<='z')) - c1 -= 0x20; - if ((c2>='a') && (c2<='z')) - c2 -= 0x20; - if (c1=='\0') - return ((c2=='\0') ? 0 : -1); - if (c2=='\0') - return 1; - if (c1c2) - return 1; - } -} - - -#ifdef CASESENSITIVITYDEFAULT_NO -#define CASESENSITIVITYDEFAULTVALUE 2 -#else -#define CASESENSITIVITYDEFAULTVALUE 1 -#endif - -#ifndef STRCMPCASENOSENTIVEFUNCTION -#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal -#endif - -/* - Compare two filename (fileName1,fileName2). - If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) - If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi - or strcasecmp) - If iCaseSenisivity = 0, case sensitivity is defaut of your operating system - (like 1 on Unix, 2 on Windows) - -*/ -extern int ZEXPORT unzStringFileNameCompare (const char* fileName1, - const char* fileName2, - int iCaseSensitivity) - -{ - if (iCaseSensitivity==0) - iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; - - if (iCaseSensitivity==1) - return strcmp(fileName1,fileName2); - - return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); -} - -#ifndef BUFREADCOMMENT -#define BUFREADCOMMENT (0x400) -#endif - -/* - Locate the Central directory of a zipfile (at the end, just before - the global comment) -*/ -local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); -local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) -{ - unsigned char* buf; - ZPOS64_T uSizeFile; - ZPOS64_T uBackRead; - ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ - ZPOS64_T uPosFound=0; - - if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) - return 0; - - - uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); - - if (uMaxBack>uSizeFile) - uMaxBack = uSizeFile; - - buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); - if (buf==NULL) - return 0; - - uBackRead = 4; - while (uBackReaduMaxBack) - uBackRead = uMaxBack; - else - uBackRead+=BUFREADCOMMENT; - uReadPos = uSizeFile-uBackRead ; - - uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? - (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos); - if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) - break; - - if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) - break; - - for (i=(int)uReadSize-3; (i--)>0;) - if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && - ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) - { - uPosFound = uReadPos+i; - break; - } - - if (uPosFound!=0) - break; - } - TRYFREE(buf); - return uPosFound; -} - - -/* - Locate the Central directory 64 of a zipfile (at the end, just before - the global comment) -*/ -local ZPOS64_T unz64local_SearchCentralDir64 OF(( - const zlib_filefunc64_32_def* pzlib_filefunc_def, - voidpf filestream)); - -local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, - voidpf filestream) -{ - unsigned char* buf; - ZPOS64_T uSizeFile; - ZPOS64_T uBackRead; - ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ - ZPOS64_T uPosFound=0; - uLong uL; - ZPOS64_T relativeOffset; - - if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) - return 0; - - - uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); - - if (uMaxBack>uSizeFile) - uMaxBack = uSizeFile; - - buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); - if (buf==NULL) - return 0; - - uBackRead = 4; - while (uBackReaduMaxBack) - uBackRead = uMaxBack; - else - uBackRead+=BUFREADCOMMENT; - uReadPos = uSizeFile-uBackRead ; - - uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? - (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos); - if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) - break; - - if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) - break; - - for (i=(int)uReadSize-3; (i--)>0;) - if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && - ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07)) - { - uPosFound = uReadPos+i; - break; - } - - if (uPosFound!=0) - break; - } - TRYFREE(buf); - if (uPosFound == 0) - return 0; - - /* Zip64 end of central directory locator */ - if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0) - return 0; - - /* the signature, already checked */ - if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) - return 0; - - /* number of the disk with the start of the zip64 end of central directory */ - if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) - return 0; - if (uL != 0) - return 0; - - /* relative offset of the zip64 end of central directory record */ - if (unz64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=UNZ_OK) - return 0; - - /* total number of disks */ - if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) - return 0; - if (uL != 1) - return 0; - - /* Goto end of central directory record */ - if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0) - return 0; - - /* the signature */ - if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) - return 0; - - if (uL != 0x06064b50) - return 0; - - return relativeOffset; -} - -/* - Open a Zip file. path contain the full pathname (by example, - on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer - "zlib/zlib114.zip". - If the zipfile cannot be opened (file doesn't exist or in not valid), the - return value is NULL. - Else, the return value is a unzFile Handle, usable with other function - of this unzip package. -*/ -local unzFile unzOpenInternal (const void *path, - zlib_filefunc64_32_def* pzlib_filefunc64_32_def, - int is64bitOpenFunction) -{ - unz64_s us; - unz64_s *s; - ZPOS64_T central_pos; - uLong uL; - - uLong number_disk; /* number of the current dist, used for - spaning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used - for spaning ZIP, unsupported, always 0*/ - ZPOS64_T number_entry_CD; /* total number of entries in - the central dir - (same than number_entry on nospan) */ - - int err=UNZ_OK; - - if (unz_copyright[0]!=' ') - return NULL; - - us.z_filefunc.zseek32_file = NULL; - us.z_filefunc.ztell32_file = NULL; - if (pzlib_filefunc64_32_def==NULL) - fill_fopen64_filefunc(&us.z_filefunc.zfile_func64); - else - us.z_filefunc = *pzlib_filefunc64_32_def; - us.is64bitOpenFunction = is64bitOpenFunction; - - - - us.filestream = ZOPEN64(us.z_filefunc, - path, - ZLIB_FILEFUNC_MODE_READ | - ZLIB_FILEFUNC_MODE_EXISTING); - if (us.filestream==NULL) - return NULL; - - central_pos = unz64local_SearchCentralDir64(&us.z_filefunc,us.filestream); - if (central_pos) - { - uLong uS; - ZPOS64_T uL64; - - us.isZip64 = 1; - - if (ZSEEK64(us.z_filefunc, us.filestream, - central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0) - err=UNZ_ERRNO; - - /* the signature, already checked */ - if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) - err=UNZ_ERRNO; - - /* size of zip64 end of central directory record */ - if (unz64local_getLong64(&us.z_filefunc, us.filestream,&uL64)!=UNZ_OK) - err=UNZ_ERRNO; - - /* version made by */ - if (unz64local_getShort(&us.z_filefunc, us.filestream,&uS)!=UNZ_OK) - err=UNZ_ERRNO; - - /* version needed to extract */ - if (unz64local_getShort(&us.z_filefunc, us.filestream,&uS)!=UNZ_OK) - err=UNZ_ERRNO; - - /* number of this disk */ - if (unz64local_getLong(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK) - err=UNZ_ERRNO; - - /* number of the disk with the start of the central directory */ - if (unz64local_getLong(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK) - err=UNZ_ERRNO; - - /* total number of entries in the central directory on this disk */ - if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK) - err=UNZ_ERRNO; - - /* total number of entries in the central directory */ - if (unz64local_getLong64(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK) - err=UNZ_ERRNO; - - if ((number_entry_CD!=us.gi.number_entry) || - (number_disk_with_CD!=0) || - (number_disk!=0)) - err=UNZ_BADZIPFILE; - - /* size of the central directory */ - if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK) - err=UNZ_ERRNO; - - /* offset of start of central directory with respect to the - starting disk number */ - if (unz64local_getLong64(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK) - err=UNZ_ERRNO; - - us.gi.size_comment = 0; - } - else - { - central_pos = unz64local_SearchCentralDir(&us.z_filefunc,us.filestream); - if (central_pos==0) - err=UNZ_ERRNO; - - us.isZip64 = 0; - - if (ZSEEK64(us.z_filefunc, us.filestream, - central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0) - err=UNZ_ERRNO; - - /* the signature, already checked */ - if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) - err=UNZ_ERRNO; - - /* number of this disk */ - if (unz64local_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK) - err=UNZ_ERRNO; - - /* number of the disk with the start of the central directory */ - if (unz64local_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK) - err=UNZ_ERRNO; - - /* total number of entries in the central dir on this disk */ - if (unz64local_getShort(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) - err=UNZ_ERRNO; - us.gi.number_entry = uL; - - /* total number of entries in the central dir */ - if (unz64local_getShort(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) - err=UNZ_ERRNO; - number_entry_CD = uL; - - if ((number_entry_CD!=us.gi.number_entry) || - (number_disk_with_CD!=0) || - (number_disk!=0)) - err=UNZ_BADZIPFILE; - - /* size of the central directory */ - if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) - err=UNZ_ERRNO; - us.size_central_dir = uL; - - /* offset of start of central directory with respect to the - starting disk number */ - if (unz64local_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) - err=UNZ_ERRNO; - us.offset_central_dir = uL; - - /* zipfile comment length */ - if (unz64local_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK) - err=UNZ_ERRNO; - } - - if ((central_pospfile_in_zip_read!=NULL) - unzCloseCurrentFile(file); - - ZCLOSE64(s->z_filefunc, s->filestream); - TRYFREE(s); - return UNZ_OK; -} - - -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. */ -extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_info) -{ - unz64_s* s; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - *pglobal_info=s->gi; - return UNZ_OK; -} - -extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info32) -{ - unz64_s* s; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - /* to do : check if number_entry is not truncated */ - pglobal_info32->number_entry = (uLong)s->gi.number_entry; - pglobal_info32->size_comment = s->gi.size_comment; - return UNZ_OK; -} -/* - Translate date/time from Dos format to tm_unz (readable more easilty) -*/ -local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm) -{ - ZPOS64_T uDate; - uDate = (ZPOS64_T)(ulDosDate>>16); - ptm->tm_mday = (uInt)(uDate&0x1f) ; - ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; - ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; - - ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); - ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; - ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; -} - -/* - Get Info about the current file in the zipfile, with internal only info -*/ -local int unz64local_GetCurrentFileInfoInternal OF((unzFile file, - unz_file_info64 *pfile_info, - unz_file_info64_internal - *pfile_info_internal, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize)); - -local int unz64local_GetCurrentFileInfoInternal (unzFile file, - unz_file_info64 *pfile_info, - unz_file_info64_internal - *pfile_info_internal, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize) -{ - unz64_s* s; - unz_file_info64 file_info; - unz_file_info64_internal file_info_internal; - int err=UNZ_OK; - uLong uMagic; - long lSeek=0; - uLong uL; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - if (ZSEEK64(s->z_filefunc, s->filestream, - s->pos_in_central_dir+s->byte_before_the_zipfile, - ZLIB_FILEFUNC_SEEK_SET)!=0) - err=UNZ_ERRNO; - - - /* we check the magic */ - if (err==UNZ_OK) - { - if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) - err=UNZ_ERRNO; - else if (uMagic!=0x02014b50) - err=UNZ_BADZIPFILE; - } - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK) - err=UNZ_ERRNO; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK) - err=UNZ_ERRNO; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK) - err=UNZ_ERRNO; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK) - err=UNZ_ERRNO; - - if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK) - err=UNZ_ERRNO; - - unz64local_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date); - - if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK) - err=UNZ_ERRNO; - - if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) - err=UNZ_ERRNO; - file_info.compressed_size = uL; - - if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) - err=UNZ_ERRNO; - file_info.uncompressed_size = uL; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK) - err=UNZ_ERRNO; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK) - err=UNZ_ERRNO; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK) - err=UNZ_ERRNO; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK) - err=UNZ_ERRNO; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK) - err=UNZ_ERRNO; - - if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK) - err=UNZ_ERRNO; - - // relative offset of local header - if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) - err=UNZ_ERRNO; - file_info_internal.offset_curfile = uL; - - lSeek+=file_info.size_filename; - if ((err==UNZ_OK) && (szFileName!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_filename0) && (fileNameBufferSize>0)) - if (ZREAD64(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead) - err=UNZ_ERRNO; - lSeek -= uSizeRead; - } - - // Read extrafield - if ((err==UNZ_OK) && (extraField!=NULL)) - { - ZPOS64_T uSizeRead ; - if (file_info.size_file_extraz_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) - lSeek=0; - else - err=UNZ_ERRNO; - } - - if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) - if (ZREAD64(s->z_filefunc, s->filestream,extraField,(uLong)uSizeRead)!=uSizeRead) - err=UNZ_ERRNO; - - lSeek += file_info.size_file_extra - (uLong)uSizeRead; - } - else - lSeek += file_info.size_file_extra; - - - if ((err==UNZ_OK) && (file_info.size_file_extra != 0)) - { - uLong acc = 0; - - // since lSeek now points to after the extra field we need to move back - lSeek -= file_info.size_file_extra; - - if (lSeek!=0) - { - if (ZSEEK64(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) - lSeek=0; - else - err=UNZ_ERRNO; - } - - while(acc < file_info.size_file_extra) - { - uLong headerId; - uLong dataSize; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&headerId) != UNZ_OK) - err=UNZ_ERRNO; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&dataSize) != UNZ_OK) - err=UNZ_ERRNO; - - /* ZIP64 extra fields */ - if (headerId == 0x0001) - { - uLong uL; - - if(file_info.uncompressed_size == MAXU32) - { - if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK) - err=UNZ_ERRNO; - } - - if(file_info.compressed_size == MAXU32) - { - if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK) - err=UNZ_ERRNO; - } - - if(file_info_internal.offset_curfile == MAXU32) - { - /* Relative Header offset */ - if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK) - err=UNZ_ERRNO; - } - - if(file_info.disk_num_start == MAXU32) - { - /* Disk Start Number */ - if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) - err=UNZ_ERRNO; - } - - } - else - { - if (ZSEEK64(s->z_filefunc, s->filestream,dataSize,ZLIB_FILEFUNC_SEEK_CUR)!=0) - err=UNZ_ERRNO; - } - - acc += 2 + 2 + dataSize; - } - } - - if ((err==UNZ_OK) && (szComment!=NULL)) - { - uLong uSizeRead ; - if (file_info.size_file_commentz_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) - lSeek=0; - else - err=UNZ_ERRNO; - } - - if ((file_info.size_file_comment>0) && (commentBufferSize>0)) - if (ZREAD64(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead) - err=UNZ_ERRNO; - lSeek+=file_info.size_file_comment - uSizeRead; - } - else - lSeek+=file_info.size_file_comment; - - - if ((err==UNZ_OK) && (pfile_info!=NULL)) - *pfile_info=file_info; - - if ((err==UNZ_OK) && (pfile_info_internal!=NULL)) - *pfile_info_internal=file_info_internal; - - return err; -} - - - -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. -*/ -extern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file, - unz_file_info64 * pfile_info, - char * szFileName, uLong fileNameBufferSize, - void *extraField, uLong extraFieldBufferSize, - char* szComment, uLong commentBufferSize) -{ - return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL, - szFileName,fileNameBufferSize, - extraField,extraFieldBufferSize, - szComment,commentBufferSize); -} - -extern int ZEXPORT unzGetCurrentFileInfo (unzFile file, - unz_file_info * pfile_info, - char * szFileName, uLong fileNameBufferSize, - void *extraField, uLong extraFieldBufferSize, - char* szComment, uLong commentBufferSize) -{ - int err; - unz_file_info64 file_info64; - err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL, - szFileName,fileNameBufferSize, - extraField,extraFieldBufferSize, - szComment,commentBufferSize); - if ((err==UNZ_OK) && (pfile_info != NULL)) - { - pfile_info->version = file_info64.version; - pfile_info->version_needed = file_info64.version_needed; - pfile_info->flag = file_info64.flag; - pfile_info->compression_method = file_info64.compression_method; - pfile_info->dosDate = file_info64.dosDate; - pfile_info->crc = file_info64.crc; - - pfile_info->size_filename = file_info64.size_filename; - pfile_info->size_file_extra = file_info64.size_file_extra; - pfile_info->size_file_comment = file_info64.size_file_comment; - - pfile_info->disk_num_start = file_info64.disk_num_start; - pfile_info->internal_fa = file_info64.internal_fa; - pfile_info->external_fa = file_info64.external_fa; - - pfile_info->tmu_date = file_info64.tmu_date, - - - pfile_info->compressed_size = (uLong)file_info64.compressed_size; - pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size; - - } - return err; -} -/* - Set the current file of the zipfile to the first file. - return UNZ_OK if there is no problem -*/ -extern int ZEXPORT unzGoToFirstFile (unzFile file) -{ - int err=UNZ_OK; - unz64_s* s; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - s->pos_in_central_dir=s->offset_central_dir; - s->num_file=0; - err=unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - s->current_file_ok = (err == UNZ_OK); - return err; -} - -/* - Set the current file of the zipfile to the next file. - return UNZ_OK if there is no problem - return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. -*/ -extern int ZEXPORT unzGoToNextFile (unzFile file) -{ - unz64_s* s; - int err; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */ - if (s->num_file+1==s->gi.number_entry) - return UNZ_END_OF_LIST_OF_FILE; - - s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + - s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ; - s->num_file++; - err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - s->current_file_ok = (err == UNZ_OK); - return err; -} - - -/* - Try locate the file szFileName in the zipfile. - For the iCaseSensitivity signification, see unzStringFileNameCompare - - return value : - UNZ_OK if the file is found. It becomes the current file. - UNZ_END_OF_LIST_OF_FILE if the file is not found -*/ -extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity) -{ - unz64_s* s; - int err; - - /* We remember the 'current' position in the file so that we can jump - * back there if we fail. - */ - unz_file_info64 cur_file_infoSaved; - unz_file_info64_internal cur_file_info_internalSaved; - ZPOS64_T num_fileSaved; - ZPOS64_T pos_in_central_dirSaved; - - - if (file==NULL) - return UNZ_PARAMERROR; - - if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) - return UNZ_PARAMERROR; - - s=(unz64_s*)file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - - /* Save the current state */ - num_fileSaved = s->num_file; - pos_in_central_dirSaved = s->pos_in_central_dir; - cur_file_infoSaved = s->cur_file_info; - cur_file_info_internalSaved = s->cur_file_info_internal; - - err = unzGoToFirstFile(file); - - while (err == UNZ_OK) - { - char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; - err = unzGetCurrentFileInfo64(file,NULL, - szCurrentFileName,sizeof(szCurrentFileName)-1, - NULL,0,NULL,0); - if (err == UNZ_OK) - { - if (unzStringFileNameCompare(szCurrentFileName, - szFileName,iCaseSensitivity)==0) - return UNZ_OK; - err = unzGoToNextFile(file); - } - } - - /* We failed, so restore the state of the 'current file' to where we - * were. - */ - s->num_file = num_fileSaved ; - s->pos_in_central_dir = pos_in_central_dirSaved ; - s->cur_file_info = cur_file_infoSaved; - s->cur_file_info_internal = cur_file_info_internalSaved; - return err; -} - - -/* -/////////////////////////////////////////// -// Contributed by Ryan Haksi (mailto://cryogen@infoserve.net) -// I need random access -// -// Further optimization could be realized by adding an ability -// to cache the directory in memory. The goal being a single -// comprehensive file read to put the file I need in a memory. -*/ - -/* -typedef struct unz_file_pos_s -{ - ZPOS64_T pos_in_zip_directory; // offset in file - ZPOS64_T num_of_file; // # of file -} unz_file_pos; -*/ - -extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) -{ - unz64_s* s; - - if (file==NULL || file_pos==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - if (!s->current_file_ok) - return UNZ_END_OF_LIST_OF_FILE; - - file_pos->pos_in_zip_directory = s->pos_in_central_dir; - file_pos->num_of_file = s->num_file; - - return UNZ_OK; -} - -extern int ZEXPORT unzGetFilePos( - unzFile file, - unz_file_pos* file_pos) -{ - unz64_file_pos file_pos64; - int err = unzGetFilePos64(file,&file_pos64); - if (err==UNZ_OK) - { - file_pos->pos_in_zip_directory = (uLong)file_pos64.pos_in_zip_directory; - file_pos->num_of_file = (uLong)file_pos64.num_of_file; - } - return err; -} - -extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos) -{ - unz64_s* s; - int err; - - if (file==NULL || file_pos==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - - /* jump to the right spot */ - s->pos_in_central_dir = file_pos->pos_in_zip_directory; - s->num_file = file_pos->num_of_file; - - /* set the current file */ - err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - /* return results */ - s->current_file_ok = (err == UNZ_OK); - return err; -} - -extern int ZEXPORT unzGoToFilePos( - unzFile file, - unz_file_pos* file_pos) -{ - unz64_file_pos file_pos64; - if (file_pos == NULL) - return UNZ_PARAMERROR; - - file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory; - file_pos64.num_of_file = file_pos->num_of_file; - return unzGoToFilePos64(file,&file_pos64); -} - -/* -// Unzip Helper Functions - should be here? -/////////////////////////////////////////// -*/ - -/* - Read the local header of the current zipfile - Check the coherency of the local header and info in the end of central - directory about this file - store in *piSizeVar the size of extra info in local header - (filename and size of extra field data) -*/ -local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar, - ZPOS64_T * poffset_local_extrafield, - uInt * psize_local_extrafield) -{ - uLong uMagic,uData,uFlags; - uLong size_filename; - uLong size_extra_field; - int err=UNZ_OK; - - *piSizeVar = 0; - *poffset_local_extrafield = 0; - *psize_local_extrafield = 0; - - if (ZSEEK64(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile + - s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0) - return UNZ_ERRNO; - - - if (err==UNZ_OK) - { - if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) - err=UNZ_ERRNO; - else if (uMagic!=0x04034b50) - err=UNZ_BADZIPFILE; - } - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) - err=UNZ_ERRNO; -/* - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion)) - err=UNZ_BADZIPFILE; -*/ - if (unz64local_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK) - err=UNZ_ERRNO; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) - err=UNZ_BADZIPFILE; - - if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && -/* #ifdef HAVE_BZIP2 */ - (s->cur_file_info.compression_method!=Z_BZIP2ED) && -/* #endif */ - (s->cur_file_info.compression_method!=Z_DEFLATED)) - err=UNZ_BADZIPFILE; - - if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */ - err=UNZ_ERRNO; - - if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */ - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; - - if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */ - err=UNZ_ERRNO; - else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; - - if (unz64local_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */ - err=UNZ_ERRNO; - else if (uData != 0xFFFFFFFF && (err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && ((uFlags & 8)==0)) - err=UNZ_BADZIPFILE; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK) - err=UNZ_ERRNO; - else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename)) - err=UNZ_BADZIPFILE; - - *piSizeVar += (uInt)size_filename; - - if (unz64local_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK) - err=UNZ_ERRNO; - *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile + - SIZEZIPLOCALHEADER + size_filename; - *psize_local_extrafield = (uInt)size_extra_field; - - *piSizeVar += (uInt)size_extra_field; - - return err; -} - -/* - Open for reading data the current file in the zipfile. - If there is no error and the file is opened, the return value is UNZ_OK. -*/ -extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, - int* level, int raw, const char* password) -{ - int err=UNZ_OK; - uInt iSizeVar; - unz64_s* s; - file_in_zip64_read_info_s* pfile_in_zip_read_info; - ZPOS64_T offset_local_extrafield; /* offset of the local extra field */ - uInt size_local_extrafield; /* size of the local extra field */ -# ifndef NOUNCRYPT - char source[12]; -# else - if (password != NULL) - return UNZ_PARAMERROR; -# endif - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - if (!s->current_file_ok) - return UNZ_PARAMERROR; - - if (s->pfile_in_zip_read != NULL) - unzCloseCurrentFile(file); - - if (unz64local_CheckCurrentFileCoherencyHeader(s,&iSizeVar, &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) - return UNZ_BADZIPFILE; - - pfile_in_zip_read_info = (file_in_zip64_read_info_s*)ALLOC(sizeof(file_in_zip64_read_info_s)); - if (pfile_in_zip_read_info==NULL) - return UNZ_INTERNALERROR; - - pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE); - pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield; - pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield; - pfile_in_zip_read_info->pos_local_extrafield=0; - pfile_in_zip_read_info->raw=raw; - - if (pfile_in_zip_read_info->read_buffer==NULL) - { - TRYFREE(pfile_in_zip_read_info); - return UNZ_INTERNALERROR; - } - - pfile_in_zip_read_info->stream_initialised=0; - - if (method!=NULL) - *method = (int)s->cur_file_info.compression_method; - - if (level!=NULL) - { - *level = 6; - switch (s->cur_file_info.flag & 0x06) - { - case 6 : *level = 1; break; - case 4 : *level = 2; break; - case 2 : *level = 9; break; - } - } - - if ((s->cur_file_info.compression_method!=0) && -/* #ifdef HAVE_BZIP2 */ - (s->cur_file_info.compression_method!=Z_BZIP2ED) && -/* #endif */ - (s->cur_file_info.compression_method!=Z_DEFLATED)) - - err=UNZ_BADZIPFILE; - - pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc; - pfile_in_zip_read_info->crc32=0; - pfile_in_zip_read_info->total_out_64=0; - pfile_in_zip_read_info->compression_method = s->cur_file_info.compression_method; - pfile_in_zip_read_info->filestream=s->filestream; - pfile_in_zip_read_info->z_filefunc=s->z_filefunc; - pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile; - - pfile_in_zip_read_info->stream.total_out = 0; - - if ((s->cur_file_info.compression_method==Z_BZIP2ED) && (!raw)) - { -#ifdef HAVE_BZIP2 - pfile_in_zip_read_info->bstream.bzalloc = (void *(*) (void *, int, int))0; - pfile_in_zip_read_info->bstream.bzfree = (free_func)0; - pfile_in_zip_read_info->bstream.opaque = (voidpf)0; - pfile_in_zip_read_info->bstream.state = (voidpf)0; - - pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; - pfile_in_zip_read_info->stream.zfree = (free_func)0; - pfile_in_zip_read_info->stream.opaque = (voidpf)0; - pfile_in_zip_read_info->stream.next_in = (voidpf)0; - pfile_in_zip_read_info->stream.avail_in = 0; - - err=BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0); - if (err == Z_OK) - pfile_in_zip_read_info->stream_initialised=Z_BZIP2ED; - else - { - TRYFREE(pfile_in_zip_read_info); - return err; - } -#else - pfile_in_zip_read_info->raw=1; -#endif - } - else if ((s->cur_file_info.compression_method==Z_DEFLATED) && (!raw)) - { - pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; - pfile_in_zip_read_info->stream.zfree = (free_func)0; - pfile_in_zip_read_info->stream.opaque = (voidpf)0; - pfile_in_zip_read_info->stream.next_in = 0; - pfile_in_zip_read_info->stream.avail_in = 0; - - err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); - if (err == Z_OK) - pfile_in_zip_read_info->stream_initialised=Z_DEFLATED; - else - { - TRYFREE(pfile_in_zip_read_info); - return err; - } - /* windowBits is passed < 0 to tell that there is no zlib header. - * Note that in this case inflate *requires* an extra "dummy" byte - * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. - * In unzip, i don't wait absolutely Z_STREAM_END because I known the - * size of both compressed and uncompressed data - */ - } - pfile_in_zip_read_info->rest_read_compressed = - s->cur_file_info.compressed_size ; - pfile_in_zip_read_info->rest_read_uncompressed = - s->cur_file_info.uncompressed_size ; - - - pfile_in_zip_read_info->pos_in_zipfile = - s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + - iSizeVar; - - pfile_in_zip_read_info->stream.avail_in = (uInt)0; - - s->pfile_in_zip_read = pfile_in_zip_read_info; - s->encrypted = 0; - -# ifndef NOUNCRYPT - if (password != NULL) - { - int i; - s->pcrc_32_tab = get_crc_table(); - init_keys(password,s->keys,s->pcrc_32_tab); - if (ZSEEK64(s->z_filefunc, s->filestream, - s->pfile_in_zip_read->pos_in_zipfile + - s->pfile_in_zip_read->byte_before_the_zipfile, - SEEK_SET)!=0) - return UNZ_INTERNALERROR; - if(ZREAD64(s->z_filefunc, s->filestream,source, 12)<12) - return UNZ_INTERNALERROR; - - for (i = 0; i<12; i++) - zdecode(s->keys,s->pcrc_32_tab,source[i]); - - s->pfile_in_zip_read->pos_in_zipfile+=12; - s->encrypted=1; - } -# endif - - - return UNZ_OK; -} - -extern int ZEXPORT unzOpenCurrentFile (unzFile file) -{ - return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL); -} - -extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char* password) -{ - return unzOpenCurrentFile3(file, NULL, NULL, 0, password); -} - -extern int ZEXPORT unzOpenCurrentFile2 (unzFile file, int* method, int* level, int raw) -{ - return unzOpenCurrentFile3(file, method, level, raw, NULL); -} - -/** Addition for GDAL : START */ - -extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file) -{ - unz64_s* s; - file_in_zip64_read_info_s* pfile_in_zip_read_info; - s=(unz64_s*)file; - if (file==NULL) - return 0; //UNZ_PARAMERROR; - pfile_in_zip_read_info=s->pfile_in_zip_read; - if (pfile_in_zip_read_info==NULL) - return 0; //UNZ_PARAMERROR; - return pfile_in_zip_read_info->pos_in_zipfile + - pfile_in_zip_read_info->byte_before_the_zipfile; -} - -/** Addition for GDAL : END */ - -/* - Read bytes from the current file. - buf contain buffer where data must be copied - len the size of buf. - - return the number of byte copied if somes bytes are copied - return 0 if the end of file was reached - return <0 with error code if there is an error - (UNZ_ERRNO for IO error, or zLib error for uncompress error) -*/ -extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) -{ - int err=UNZ_OK; - uInt iRead = 0; - unz64_s* s; - file_in_zip64_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - - if (pfile_in_zip_read_info->read_buffer == NULL) - return UNZ_END_OF_LIST_OF_FILE; - if (len==0) - return 0; - - pfile_in_zip_read_info->stream.next_out = (Bytef*)buf; - - pfile_in_zip_read_info->stream.avail_out = (uInt)len; - - if ((len>pfile_in_zip_read_info->rest_read_uncompressed) && - (!(pfile_in_zip_read_info->raw))) - pfile_in_zip_read_info->stream.avail_out = - (uInt)pfile_in_zip_read_info->rest_read_uncompressed; - - if ((len>pfile_in_zip_read_info->rest_read_compressed+ - pfile_in_zip_read_info->stream.avail_in) && - (pfile_in_zip_read_info->raw)) - pfile_in_zip_read_info->stream.avail_out = - (uInt)pfile_in_zip_read_info->rest_read_compressed+ - pfile_in_zip_read_info->stream.avail_in; - - while (pfile_in_zip_read_info->stream.avail_out>0) - { - if ((pfile_in_zip_read_info->stream.avail_in==0) && - (pfile_in_zip_read_info->rest_read_compressed>0)) - { - uInt uReadThis = UNZ_BUFSIZE; - if (pfile_in_zip_read_info->rest_read_compressedrest_read_compressed; - if (uReadThis == 0) - return UNZ_EOF; - if (ZSEEK64(pfile_in_zip_read_info->z_filefunc, - pfile_in_zip_read_info->filestream, - pfile_in_zip_read_info->pos_in_zipfile + - pfile_in_zip_read_info->byte_before_the_zipfile, - ZLIB_FILEFUNC_SEEK_SET)!=0) - return UNZ_ERRNO; - if (ZREAD64(pfile_in_zip_read_info->z_filefunc, - pfile_in_zip_read_info->filestream, - pfile_in_zip_read_info->read_buffer, - uReadThis)!=uReadThis) - return UNZ_ERRNO; - - -# ifndef NOUNCRYPT - if(s->encrypted) - { - uInt i; - for(i=0;iread_buffer[i] = - zdecode(s->keys,s->pcrc_32_tab, - pfile_in_zip_read_info->read_buffer[i]); - } -# endif - - - pfile_in_zip_read_info->pos_in_zipfile += uReadThis; - - pfile_in_zip_read_info->rest_read_compressed-=uReadThis; - - pfile_in_zip_read_info->stream.next_in = - (Bytef*)pfile_in_zip_read_info->read_buffer; - pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; - } - - if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) - { - uInt uDoCopy,i ; - - if ((pfile_in_zip_read_info->stream.avail_in == 0) && - (pfile_in_zip_read_info->rest_read_compressed == 0)) - return (iRead==0) ? UNZ_EOF : iRead; - - if (pfile_in_zip_read_info->stream.avail_out < - pfile_in_zip_read_info->stream.avail_in) - uDoCopy = pfile_in_zip_read_info->stream.avail_out ; - else - uDoCopy = pfile_in_zip_read_info->stream.avail_in ; - - for (i=0;istream.next_out+i) = - *(pfile_in_zip_read_info->stream.next_in+i); - - pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uDoCopy; - - pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, - pfile_in_zip_read_info->stream.next_out, - uDoCopy); - pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy; - pfile_in_zip_read_info->stream.avail_in -= uDoCopy; - pfile_in_zip_read_info->stream.avail_out -= uDoCopy; - pfile_in_zip_read_info->stream.next_out += uDoCopy; - pfile_in_zip_read_info->stream.next_in += uDoCopy; - pfile_in_zip_read_info->stream.total_out += uDoCopy; - iRead += uDoCopy; - } - else if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED) - { -#ifdef HAVE_BZIP2 - uLong uTotalOutBefore,uTotalOutAfter; - const Bytef *bufBefore; - uLong uOutThis; - - pfile_in_zip_read_info->bstream.next_in = (char*)pfile_in_zip_read_info->stream.next_in; - pfile_in_zip_read_info->bstream.avail_in = pfile_in_zip_read_info->stream.avail_in; - pfile_in_zip_read_info->bstream.total_in_lo32 = pfile_in_zip_read_info->stream.total_in; - pfile_in_zip_read_info->bstream.total_in_hi32 = 0; - pfile_in_zip_read_info->bstream.next_out = (char*)pfile_in_zip_read_info->stream.next_out; - pfile_in_zip_read_info->bstream.avail_out = pfile_in_zip_read_info->stream.avail_out; - pfile_in_zip_read_info->bstream.total_out_lo32 = pfile_in_zip_read_info->stream.total_out; - pfile_in_zip_read_info->bstream.total_out_hi32 = 0; - - uTotalOutBefore = pfile_in_zip_read_info->bstream.total_out_lo32; - bufBefore = (const Bytef *)pfile_in_zip_read_info->bstream.next_out; - - err=BZ2_bzDecompress(&pfile_in_zip_read_info->bstream); - - uTotalOutAfter = pfile_in_zip_read_info->bstream.total_out_lo32; - uOutThis = uTotalOutAfter-uTotalOutBefore; - - pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis; - - pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,bufBefore, (uInt)(uOutThis)); - pfile_in_zip_read_info->rest_read_uncompressed -= uOutThis; - iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); - - pfile_in_zip_read_info->stream.next_in = (Bytef*)pfile_in_zip_read_info->bstream.next_in; - pfile_in_zip_read_info->stream.avail_in = pfile_in_zip_read_info->bstream.avail_in; - pfile_in_zip_read_info->stream.total_in = pfile_in_zip_read_info->bstream.total_in_lo32; - pfile_in_zip_read_info->stream.next_out = (Bytef*)pfile_in_zip_read_info->bstream.next_out; - pfile_in_zip_read_info->stream.avail_out = pfile_in_zip_read_info->bstream.avail_out; - pfile_in_zip_read_info->stream.total_out = pfile_in_zip_read_info->bstream.total_out_lo32; - - if (err==BZ_STREAM_END) - return (iRead==0) ? UNZ_EOF : iRead; - if (err!=BZ_OK) - break; -#endif - } // end Z_BZIP2ED - else - { - ZPOS64_T uTotalOutBefore,uTotalOutAfter; - const Bytef *bufBefore; - ZPOS64_T uOutThis; - int flush=Z_SYNC_FLUSH; - - uTotalOutBefore = pfile_in_zip_read_info->stream.total_out; - bufBefore = pfile_in_zip_read_info->stream.next_out; - - /* - if ((pfile_in_zip_read_info->rest_read_uncompressed == - pfile_in_zip_read_info->stream.avail_out) && - (pfile_in_zip_read_info->rest_read_compressed == 0)) - flush = Z_FINISH; - */ - err=inflate(&pfile_in_zip_read_info->stream,flush); - - if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL)) - err = Z_DATA_ERROR; - - uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; - uOutThis = uTotalOutAfter-uTotalOutBefore; - - pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis; - - pfile_in_zip_read_info->crc32 = - crc32(pfile_in_zip_read_info->crc32,bufBefore, - (uInt)(uOutThis)); - - pfile_in_zip_read_info->rest_read_uncompressed -= - uOutThis; - - iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); - - if (err==Z_STREAM_END) - return (iRead==0) ? UNZ_EOF : iRead; - if (err!=Z_OK) - break; - } - } - - if (err==Z_OK) - return iRead; - return err; -} - - -/* - Give the current position in uncompressed data -*/ -extern z_off_t ZEXPORT unztell (unzFile file) -{ - unz64_s* s; - file_in_zip64_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - return (z_off_t)pfile_in_zip_read_info->stream.total_out; -} - -extern ZPOS64_T ZEXPORT unztell64 (unzFile file) -{ - - unz64_s* s; - file_in_zip64_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return (ZPOS64_T)-1; - s=(unz64_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return (ZPOS64_T)-1; - - return pfile_in_zip_read_info->total_out_64; -} - - -/* - return 1 if the end of file was reached, 0 elsewhere -*/ -extern int ZEXPORT unzeof (unzFile file) -{ - unz64_s* s; - file_in_zip64_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - if (pfile_in_zip_read_info->rest_read_uncompressed == 0) - return 1; - else - return 0; -} - - - -/* -Read extra field from the current file (opened by unzOpenCurrentFile) -This is the local-header version of the extra field (sometimes, there is -more info in the local-header version than in the central-header) - - if buf==NULL, it return the size of the local extra field that can be read - - if buf!=NULL, len is the size of the buffer, the extra header is copied in - buf. - the return value is the number of bytes copied in buf, or (if <0) - the error code -*/ -extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len) -{ - unz64_s* s; - file_in_zip64_read_info_s* pfile_in_zip_read_info; - uInt read_now; - ZPOS64_T size_to_read; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - size_to_read = (pfile_in_zip_read_info->size_local_extrafield - - pfile_in_zip_read_info->pos_local_extrafield); - - if (buf==NULL) - return (int)size_to_read; - - if (len>size_to_read) - read_now = (uInt)size_to_read; - else - read_now = (uInt)len ; - - if (read_now==0) - return 0; - - if (ZSEEK64(pfile_in_zip_read_info->z_filefunc, - pfile_in_zip_read_info->filestream, - pfile_in_zip_read_info->offset_local_extrafield + - pfile_in_zip_read_info->pos_local_extrafield, - ZLIB_FILEFUNC_SEEK_SET)!=0) - return UNZ_ERRNO; - - if (ZREAD64(pfile_in_zip_read_info->z_filefunc, - pfile_in_zip_read_info->filestream, - buf,read_now)!=read_now) - return UNZ_ERRNO; - - return (int)read_now; -} - -/* - Close the file in zip opened with unzOpenCurrentFile - Return UNZ_CRCERROR if all the file was read but the CRC is not good -*/ -extern int ZEXPORT unzCloseCurrentFile (unzFile file) -{ - int err=UNZ_OK; - - unz64_s* s; - file_in_zip64_read_info_s* pfile_in_zip_read_info; - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - pfile_in_zip_read_info=s->pfile_in_zip_read; - - if (pfile_in_zip_read_info==NULL) - return UNZ_PARAMERROR; - - - if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) && - (!pfile_in_zip_read_info->raw)) - { - if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) - err=UNZ_CRCERROR; - } - - - TRYFREE(pfile_in_zip_read_info->read_buffer); - pfile_in_zip_read_info->read_buffer = NULL; - if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED) - inflateEnd(&pfile_in_zip_read_info->stream); -#ifdef HAVE_BZIP2 - else if (pfile_in_zip_read_info->stream_initialised == Z_BZIP2ED) - BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream); -#endif - - - pfile_in_zip_read_info->stream_initialised = 0; - TRYFREE(pfile_in_zip_read_info); - - s->pfile_in_zip_read=NULL; - - return err; -} - - -/* - Get the global comment string of the ZipFile, in the szComment buffer. - uSizeBuf is the size of the szComment buffer. - return the number of byte copied or an error code <0 -*/ -extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf) -{ - unz64_s* s; - uLong uReadThis ; - if (file==NULL) - return (int)UNZ_PARAMERROR; - s=(unz64_s*)file; - - uReadThis = uSizeBuf; - if (uReadThis>s->gi.size_comment) - uReadThis = s->gi.size_comment; - - if (ZSEEK64(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0) - return UNZ_ERRNO; - - if (uReadThis>0) - { - *szComment='\0'; - if (ZREAD64(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis) - return UNZ_ERRNO; - } - - if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) - *(szComment+s->gi.size_comment)='\0'; - return (int)uReadThis; -} - -/* Additions by RX '2004 */ -extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) -{ - unz64_s* s; - - if (file==NULL) - return 0; //UNZ_PARAMERROR; - s=(unz64_s*)file; - if (!s->current_file_ok) - return 0; - if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff) - if (s->num_file==s->gi.number_entry) - return 0; - return s->pos_in_central_dir; -} - -extern uLong ZEXPORT unzGetOffset (unzFile file) -{ - ZPOS64_T offset64; - - if (file==NULL) - return 0; //UNZ_PARAMERROR; - offset64 = unzGetOffset64(file); - return (uLong)offset64; -} - -extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) -{ - unz64_s* s; - int err; - - if (file==NULL) - return UNZ_PARAMERROR; - s=(unz64_s*)file; - - s->pos_in_central_dir = pos; - s->num_file = s->gi.number_entry; /* hack */ - err = unz64local_GetCurrentFileInfoInternal(file,&s->cur_file_info, - &s->cur_file_info_internal, - NULL,0,NULL,0,NULL,0); - s->current_file_ok = (err == UNZ_OK); - return err; -} - -extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) -{ - return unzSetOffset64(file,pos); -} diff --git a/compat/zlib/contrib/minizip/unzip.h b/compat/zlib/contrib/minizip/unzip.h deleted file mode 100644 index 2104e39..0000000 --- a/compat/zlib/contrib/minizip/unzip.h +++ /dev/null @@ -1,437 +0,0 @@ -/* unzip.h -- IO for uncompress .zip files using zlib - Version 1.1, February 14h, 2010 - part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) - - Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) - - Modifications of Unzip for Zip64 - Copyright (C) 2007-2008 Even Rouault - - Modifications for Zip64 support on both zip and unzip - Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - - For more info read MiniZip_info.txt - - --------------------------------------------------------------------------------- - - Condition of use and distribution are the same than zlib : - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - --------------------------------------------------------------------------------- - - Changes - - See header of unzip64.c - -*/ - -#ifndef _unz64_H -#define _unz64_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef _ZLIB_H -#include "zlib.h" -#endif - -#ifndef _ZLIBIOAPI_H -#include "ioapi.h" -#endif - -#ifdef HAVE_BZIP2 -#include "bzlib.h" -#endif - -#define Z_BZIP2ED 12 - -#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) -/* like the STRICT of WIN32, we define a pointer that cannot be converted - from (void*) without cast */ -typedef struct TagunzFile__ { int unused; } unzFile__; -typedef unzFile__ *unzFile; -#else -typedef voidp unzFile; -#endif - - -#define UNZ_OK (0) -#define UNZ_END_OF_LIST_OF_FILE (-100) -#define UNZ_ERRNO (Z_ERRNO) -#define UNZ_EOF (0) -#define UNZ_PARAMERROR (-102) -#define UNZ_BADZIPFILE (-103) -#define UNZ_INTERNALERROR (-104) -#define UNZ_CRCERROR (-105) - -/* tm_unz contain date/time info */ -typedef struct tm_unz_s -{ - uInt tm_sec; /* seconds after the minute - [0,59] */ - uInt tm_min; /* minutes after the hour - [0,59] */ - uInt tm_hour; /* hours since midnight - [0,23] */ - uInt tm_mday; /* day of the month - [1,31] */ - uInt tm_mon; /* months since January - [0,11] */ - uInt tm_year; /* years - [1980..2044] */ -} tm_unz; - -/* unz_global_info structure contain global data about the ZIPfile - These data comes from the end of central dir */ -typedef struct unz_global_info64_s -{ - ZPOS64_T number_entry; /* total number of entries in - the central dir on this disk */ - uLong size_comment; /* size of the global comment of the zipfile */ -} unz_global_info64; - -typedef struct unz_global_info_s -{ - uLong number_entry; /* total number of entries in - the central dir on this disk */ - uLong size_comment; /* size of the global comment of the zipfile */ -} unz_global_info; - -/* unz_file_info contain information about a file in the zipfile */ -typedef struct unz_file_info64_s -{ - uLong version; /* version made by 2 bytes */ - uLong version_needed; /* version needed to extract 2 bytes */ - uLong flag; /* general purpose bit flag 2 bytes */ - uLong compression_method; /* compression method 2 bytes */ - uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ - uLong crc; /* crc-32 4 bytes */ - ZPOS64_T compressed_size; /* compressed size 8 bytes */ - ZPOS64_T uncompressed_size; /* uncompressed size 8 bytes */ - uLong size_filename; /* filename length 2 bytes */ - uLong size_file_extra; /* extra field length 2 bytes */ - uLong size_file_comment; /* file comment length 2 bytes */ - - uLong disk_num_start; /* disk number start 2 bytes */ - uLong internal_fa; /* internal file attributes 2 bytes */ - uLong external_fa; /* external file attributes 4 bytes */ - - tm_unz tmu_date; -} unz_file_info64; - -typedef struct unz_file_info_s -{ - uLong version; /* version made by 2 bytes */ - uLong version_needed; /* version needed to extract 2 bytes */ - uLong flag; /* general purpose bit flag 2 bytes */ - uLong compression_method; /* compression method 2 bytes */ - uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ - uLong crc; /* crc-32 4 bytes */ - uLong compressed_size; /* compressed size 4 bytes */ - uLong uncompressed_size; /* uncompressed size 4 bytes */ - uLong size_filename; /* filename length 2 bytes */ - uLong size_file_extra; /* extra field length 2 bytes */ - uLong size_file_comment; /* file comment length 2 bytes */ - - uLong disk_num_start; /* disk number start 2 bytes */ - uLong internal_fa; /* internal file attributes 2 bytes */ - uLong external_fa; /* external file attributes 4 bytes */ - - tm_unz tmu_date; -} unz_file_info; - -extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, - const char* fileName2, - int iCaseSensitivity)); -/* - Compare two filename (fileName1,fileName2). - If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) - If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi - or strcasecmp) - If iCaseSenisivity = 0, case sensitivity is defaut of your operating system - (like 1 on Unix, 2 on Windows) -*/ - - -extern unzFile ZEXPORT unzOpen OF((const char *path)); -extern unzFile ZEXPORT unzOpen64 OF((const void *path)); -/* - Open a Zip file. path contain the full pathname (by example, - on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer - "zlib/zlib113.zip". - If the zipfile cannot be opened (file don't exist or in not valid), the - return value is NULL. - Else, the return value is a unzFile Handle, usable with other function - of this unzip package. - the "64" function take a const void* pointer, because the path is just the - value passed to the open64_file_func callback. - Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path - is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char* - does not describe the reality -*/ - - -extern unzFile ZEXPORT unzOpen2 OF((const char *path, - zlib_filefunc_def* pzlib_filefunc_def)); -/* - Open a Zip file, like unzOpen, but provide a set of file low level API - for read/write the zip file (see ioapi.h) -*/ - -extern unzFile ZEXPORT unzOpen2_64 OF((const void *path, - zlib_filefunc64_def* pzlib_filefunc_def)); -/* - Open a Zip file, like unz64Open, but provide a set of file low level API - for read/write the zip file (see ioapi.h) -*/ - -extern int ZEXPORT unzClose OF((unzFile file)); -/* - Close a ZipFile opened with unzOpen. - If there is files inside the .Zip opened with unzOpenCurrentFile (see later), - these files MUST be closed with unzCloseCurrentFile before call unzClose. - return UNZ_OK if there is no problem. */ - -extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, - unz_global_info *pglobal_info)); - -extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file, - unz_global_info64 *pglobal_info)); -/* - Write info about the ZipFile in the *pglobal_info structure. - No preparation of the structure is needed - return UNZ_OK if there is no problem. */ - - -extern int ZEXPORT unzGetGlobalComment OF((unzFile file, - char *szComment, - uLong uSizeBuf)); -/* - Get the global comment string of the ZipFile, in the szComment buffer. - uSizeBuf is the size of the szComment buffer. - return the number of byte copied or an error code <0 -*/ - - -/***************************************************************************/ -/* Unzip package allow you browse the directory of the zipfile */ - -extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); -/* - Set the current file of the zipfile to the first file. - return UNZ_OK if there is no problem -*/ - -extern int ZEXPORT unzGoToNextFile OF((unzFile file)); -/* - Set the current file of the zipfile to the next file. - return UNZ_OK if there is no problem - return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. -*/ - -extern int ZEXPORT unzLocateFile OF((unzFile file, - const char *szFileName, - int iCaseSensitivity)); -/* - Try locate the file szFileName in the zipfile. - For the iCaseSensitivity signification, see unzStringFileNameCompare - - return value : - UNZ_OK if the file is found. It becomes the current file. - UNZ_END_OF_LIST_OF_FILE if the file is not found -*/ - - -/* ****************************************** */ -/* Ryan supplied functions */ -/* unz_file_info contain information about a file in the zipfile */ -typedef struct unz_file_pos_s -{ - uLong pos_in_zip_directory; /* offset in zip file directory */ - uLong num_of_file; /* # of file */ -} unz_file_pos; - -extern int ZEXPORT unzGetFilePos( - unzFile file, - unz_file_pos* file_pos); - -extern int ZEXPORT unzGoToFilePos( - unzFile file, - unz_file_pos* file_pos); - -typedef struct unz64_file_pos_s -{ - ZPOS64_T pos_in_zip_directory; /* offset in zip file directory */ - ZPOS64_T num_of_file; /* # of file */ -} unz64_file_pos; - -extern int ZEXPORT unzGetFilePos64( - unzFile file, - unz64_file_pos* file_pos); - -extern int ZEXPORT unzGoToFilePos64( - unzFile file, - const unz64_file_pos* file_pos); - -/* ****************************************** */ - -extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file, - unz_file_info64 *pfile_info, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize)); - -extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, - unz_file_info *pfile_info, - char *szFileName, - uLong fileNameBufferSize, - void *extraField, - uLong extraFieldBufferSize, - char *szComment, - uLong commentBufferSize)); -/* - Get Info about the current file - if pfile_info!=NULL, the *pfile_info structure will contain somes info about - the current file - if szFileName!=NULL, the filemane string will be copied in szFileName - (fileNameBufferSize is the size of the buffer) - if extraField!=NULL, the extra field information will be copied in extraField - (extraFieldBufferSize is the size of the buffer). - This is the Central-header version of the extra field - if szComment!=NULL, the comment string of the file will be copied in szComment - (commentBufferSize is the size of the buffer) -*/ - - -/** Addition for GDAL : START */ - -extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); - -/** Addition for GDAL : END */ - - -/***************************************************************************/ -/* for reading the content of the current zipfile, you can open it, read data - from it, and close it (you can close it before reading all the file) - */ - -extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); -/* - Open for reading data the current file in the zipfile. - If there is no error, the return value is UNZ_OK. -*/ - -extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, - const char* password)); -/* - Open for reading data the current file in the zipfile. - password is a crypting password - If there is no error, the return value is UNZ_OK. -*/ - -extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, - int* method, - int* level, - int raw)); -/* - Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) - if raw==1 - *method will receive method of compression, *level will receive level of - compression - note : you can set level parameter as NULL (if you did not want known level, - but you CANNOT set method parameter as NULL -*/ - -extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, - int* method, - int* level, - int raw, - const char* password)); -/* - Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) - if raw==1 - *method will receive method of compression, *level will receive level of - compression - note : you can set level parameter as NULL (if you did not want known level, - but you CANNOT set method parameter as NULL -*/ - - -extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); -/* - Close the file in zip opened with unzOpenCurrentFile - Return UNZ_CRCERROR if all the file was read but the CRC is not good -*/ - -extern int ZEXPORT unzReadCurrentFile OF((unzFile file, - voidp buf, - unsigned len)); -/* - Read bytes from the current file (opened by unzOpenCurrentFile) - buf contain buffer where data must be copied - len the size of buf. - - return the number of byte copied if somes bytes are copied - return 0 if the end of file was reached - return <0 with error code if there is an error - (UNZ_ERRNO for IO error, or zLib error for uncompress error) -*/ - -extern z_off_t ZEXPORT unztell OF((unzFile file)); - -extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file)); -/* - Give the current position in uncompressed data -*/ - -extern int ZEXPORT unzeof OF((unzFile file)); -/* - return 1 if the end of file was reached, 0 elsewhere -*/ - -extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, - voidp buf, - unsigned len)); -/* - Read extra field from the current file (opened by unzOpenCurrentFile) - This is the local-header version of the extra field (sometimes, there is - more info in the local-header version than in the central-header) - - if buf==NULL, it return the size of the local extra field - - if buf!=NULL, len is the size of the buffer, the extra header is copied in - buf. - the return value is the number of bytes copied in buf, or (if <0) - the error code -*/ - -/***************************************************************************/ - -/* Get the current file offset */ -extern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file); -extern uLong ZEXPORT unzGetOffset (unzFile file); - -/* Set the current file offset */ -extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos); -extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); - - - -#ifdef __cplusplus -} -#endif - -#endif /* _unz64_H */ diff --git a/compat/zlib/contrib/minizip/zip.c b/compat/zlib/contrib/minizip/zip.c deleted file mode 100644 index 44e88a9..0000000 --- a/compat/zlib/contrib/minizip/zip.c +++ /dev/null @@ -1,2007 +0,0 @@ -/* zip.c -- IO on .zip files using zlib - Version 1.1, February 14h, 2010 - part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) - - Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) - - Modifications for Zip64 support - Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - - For more info read MiniZip_info.txt - - Changes - Oct-2009 - Mathias Svensson - Remove old C style function prototypes - Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives - Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions. - Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data - It is used when recreting zip archive with RAW when deleting items from a zip. - ZIP64 data is automatically added to items that needs it, and existing ZIP64 data need to be removed. - Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required) - Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer - -*/ - - -#include -#include -#include -#include -#include "zlib.h" -#include "zip.h" - -#ifdef STDC -# include -# include -# include -#endif -#ifdef NO_ERRNO_H - extern int errno; -#else -# include -#endif - - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -#ifndef VERSIONMADEBY -# define VERSIONMADEBY (0x0) /* platform depedent */ -#endif - -#ifndef Z_BUFSIZE -#define Z_BUFSIZE (64*1024) //(16384) -#endif - -#ifndef Z_MAXFILENAMEINZIP -#define Z_MAXFILENAMEINZIP (256) -#endif - -#ifndef ALLOC -# define ALLOC(size) (malloc(size)) -#endif -#ifndef TRYFREE -# define TRYFREE(p) {if (p) free(p);} -#endif - -/* -#define SIZECENTRALDIRITEM (0x2e) -#define SIZEZIPLOCALHEADER (0x1e) -*/ - -/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ - - -// NOT sure that this work on ALL platform -#define MAKEULONG64(a, b) ((ZPOS64_T)(((unsigned long)(a)) | ((ZPOS64_T)((unsigned long)(b))) << 32)) - -#ifndef SEEK_CUR -#define SEEK_CUR 1 -#endif - -#ifndef SEEK_END -#define SEEK_END 2 -#endif - -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - -#ifndef DEF_MEM_LEVEL -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -#endif -const char zip_copyright[] =" zip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; - - -#define SIZEDATA_INDATABLOCK (4096-(4*4)) - -#define LOCALHEADERMAGIC (0x04034b50) -#define CENTRALHEADERMAGIC (0x02014b50) -#define ENDHEADERMAGIC (0x06054b50) -#define ZIP64ENDHEADERMAGIC (0x6064b50) -#define ZIP64ENDLOCHEADERMAGIC (0x7064b50) - -#define FLAG_LOCALHEADER_OFFSET (0x06) -#define CRC_LOCALHEADER_OFFSET (0x0e) - -#define SIZECENTRALHEADER (0x2e) /* 46 */ - -typedef struct linkedlist_datablock_internal_s -{ - struct linkedlist_datablock_internal_s* next_datablock; - uLong avail_in_this_block; - uLong filled_in_this_block; - uLong unused; /* for future use and alignment */ - unsigned char data[SIZEDATA_INDATABLOCK]; -} linkedlist_datablock_internal; - -typedef struct linkedlist_data_s -{ - linkedlist_datablock_internal* first_block; - linkedlist_datablock_internal* last_block; -} linkedlist_data; - - -typedef struct -{ - z_stream stream; /* zLib stream structure for inflate */ -#ifdef HAVE_BZIP2 - bz_stream bstream; /* bzLib stream structure for bziped */ -#endif - - int stream_initialised; /* 1 is stream is initialised */ - uInt pos_in_buffered_data; /* last written byte in buffered_data */ - - ZPOS64_T pos_local_header; /* offset of the local header of the file - currenty writing */ - char* central_header; /* central header data for the current file */ - uLong size_centralExtra; - uLong size_centralheader; /* size of the central header for cur file */ - uLong size_centralExtraFree; /* Extra bytes allocated to the centralheader but that are not used */ - uLong flag; /* flag of the file currently writing */ - - int method; /* compression method of file currenty wr.*/ - int raw; /* 1 for directly writing raw data */ - Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/ - uLong dosDate; - uLong crc32; - int encrypt; - int zip64; /* Add ZIP64 extened information in the extra field */ - ZPOS64_T pos_zip64extrainfo; - ZPOS64_T totalCompressedData; - ZPOS64_T totalUncompressedData; -#ifndef NOCRYPT - unsigned long keys[3]; /* keys defining the pseudo-random sequence */ - const z_crc_t* pcrc_32_tab; - int crypt_header_size; -#endif -} curfile64_info; - -typedef struct -{ - zlib_filefunc64_32_def z_filefunc; - voidpf filestream; /* io structore of the zipfile */ - linkedlist_data central_dir;/* datablock with central dir in construction*/ - int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/ - curfile64_info ci; /* info on the file curretly writing */ - - ZPOS64_T begin_pos; /* position of the beginning of the zipfile */ - ZPOS64_T add_position_when_writing_offset; - ZPOS64_T number_entry; - -#ifndef NO_ADDFILEINEXISTINGZIP - char *globalcomment; -#endif - -} zip64_internal; - - -#ifndef NOCRYPT -#define INCLUDECRYPTINGCODE_IFCRYPTALLOWED -#include "crypt.h" -#endif - -local linkedlist_datablock_internal* allocate_new_datablock() -{ - linkedlist_datablock_internal* ldi; - ldi = (linkedlist_datablock_internal*) - ALLOC(sizeof(linkedlist_datablock_internal)); - if (ldi!=NULL) - { - ldi->next_datablock = NULL ; - ldi->filled_in_this_block = 0 ; - ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ; - } - return ldi; -} - -local void free_datablock(linkedlist_datablock_internal* ldi) -{ - while (ldi!=NULL) - { - linkedlist_datablock_internal* ldinext = ldi->next_datablock; - TRYFREE(ldi); - ldi = ldinext; - } -} - -local void init_linkedlist(linkedlist_data* ll) -{ - ll->first_block = ll->last_block = NULL; -} - -local void free_linkedlist(linkedlist_data* ll) -{ - free_datablock(ll->first_block); - ll->first_block = ll->last_block = NULL; -} - - -local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) -{ - linkedlist_datablock_internal* ldi; - const unsigned char* from_copy; - - if (ll==NULL) - return ZIP_INTERNALERROR; - - if (ll->last_block == NULL) - { - ll->first_block = ll->last_block = allocate_new_datablock(); - if (ll->first_block == NULL) - return ZIP_INTERNALERROR; - } - - ldi = ll->last_block; - from_copy = (unsigned char*)buf; - - while (len>0) - { - uInt copy_this; - uInt i; - unsigned char* to_copy; - - if (ldi->avail_in_this_block==0) - { - ldi->next_datablock = allocate_new_datablock(); - if (ldi->next_datablock == NULL) - return ZIP_INTERNALERROR; - ldi = ldi->next_datablock ; - ll->last_block = ldi; - } - - if (ldi->avail_in_this_block < len) - copy_this = (uInt)ldi->avail_in_this_block; - else - copy_this = (uInt)len; - - to_copy = &(ldi->data[ldi->filled_in_this_block]); - - for (i=0;ifilled_in_this_block += copy_this; - ldi->avail_in_this_block -= copy_this; - from_copy += copy_this ; - len -= copy_this; - } - return ZIP_OK; -} - - - -/****************************************************************************/ - -#ifndef NO_ADDFILEINEXISTINGZIP -/* =========================================================================== - Inputs a long in LSB order to the given file - nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T) -*/ - -local int zip64local_putValue OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)); -local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte) -{ - unsigned char buf[8]; - int n; - for (n = 0; n < nbByte; n++) - { - buf[n] = (unsigned char)(x & 0xff); - x >>= 8; - } - if (x != 0) - { /* data overflow - hack for ZIP64 (X Roche) */ - for (n = 0; n < nbByte; n++) - { - buf[n] = 0xff; - } - } - - if (ZWRITE64(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte) - return ZIP_ERRNO; - else - return ZIP_OK; -} - -local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte)); -local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) -{ - unsigned char* buf=(unsigned char*)dest; - int n; - for (n = 0; n < nbByte; n++) { - buf[n] = (unsigned char)(x & 0xff); - x >>= 8; - } - - if (x != 0) - { /* data overflow - hack for ZIP64 */ - for (n = 0; n < nbByte; n++) - { - buf[n] = 0xff; - } - } -} - -/****************************************************************************/ - - -local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) -{ - uLong year = (uLong)ptm->tm_year; - if (year>=1980) - year-=1980; - else if (year>=80) - year-=80; - return - (uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) | - ((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour)); -} - - -/****************************************************************************/ - -local int zip64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)); - -local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi) -{ - unsigned char c; - int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1); - if (err==1) - { - *pi = (int)c; - return ZIP_OK; - } - else - { - if (ZERROR64(*pzlib_filefunc_def,filestream)) - return ZIP_ERRNO; - else - return ZIP_EOF; - } -} - - -/* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets -*/ -local int zip64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX)); - -local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) -{ - uLong x ; - int i = 0; - int err; - - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x = (uLong)i; - - if (err==ZIP_OK) - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x += ((uLong)i)<<8; - - if (err==ZIP_OK) - *pX = x; - else - *pX = 0; - return err; -} - -local int zip64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX)); - -local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) -{ - uLong x ; - int i = 0; - int err; - - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x = (uLong)i; - - if (err==ZIP_OK) - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x += ((uLong)i)<<8; - - if (err==ZIP_OK) - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x += ((uLong)i)<<16; - - if (err==ZIP_OK) - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x += ((uLong)i)<<24; - - if (err==ZIP_OK) - *pX = x; - else - *pX = 0; - return err; -} - -local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)); - - -local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) -{ - ZPOS64_T x; - int i = 0; - int err; - - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x = (ZPOS64_T)i; - - if (err==ZIP_OK) - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x += ((ZPOS64_T)i)<<8; - - if (err==ZIP_OK) - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x += ((ZPOS64_T)i)<<16; - - if (err==ZIP_OK) - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x += ((ZPOS64_T)i)<<24; - - if (err==ZIP_OK) - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x += ((ZPOS64_T)i)<<32; - - if (err==ZIP_OK) - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x += ((ZPOS64_T)i)<<40; - - if (err==ZIP_OK) - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x += ((ZPOS64_T)i)<<48; - - if (err==ZIP_OK) - err = zip64local_getByte(pzlib_filefunc_def,filestream,&i); - x += ((ZPOS64_T)i)<<56; - - if (err==ZIP_OK) - *pX = x; - else - *pX = 0; - - return err; -} - -#ifndef BUFREADCOMMENT -#define BUFREADCOMMENT (0x400) -#endif -/* - Locate the Central directory of a zipfile (at the end, just before - the global comment) -*/ -local ZPOS64_T zip64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); - -local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) -{ - unsigned char* buf; - ZPOS64_T uSizeFile; - ZPOS64_T uBackRead; - ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ - ZPOS64_T uPosFound=0; - - if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) - return 0; - - - uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); - - if (uMaxBack>uSizeFile) - uMaxBack = uSizeFile; - - buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); - if (buf==NULL) - return 0; - - uBackRead = 4; - while (uBackReaduMaxBack) - uBackRead = uMaxBack; - else - uBackRead+=BUFREADCOMMENT; - uReadPos = uSizeFile-uBackRead ; - - uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? - (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos); - if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) - break; - - if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) - break; - - for (i=(int)uReadSize-3; (i--)>0;) - if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && - ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) - { - uPosFound = uReadPos+i; - break; - } - - if (uPosFound!=0) - break; - } - TRYFREE(buf); - return uPosFound; -} - -/* -Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before -the global comment) -*/ -local ZPOS64_T zip64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); - -local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) -{ - unsigned char* buf; - ZPOS64_T uSizeFile; - ZPOS64_T uBackRead; - ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ - ZPOS64_T uPosFound=0; - uLong uL; - ZPOS64_T relativeOffset; - - if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) - return 0; - - uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); - - if (uMaxBack>uSizeFile) - uMaxBack = uSizeFile; - - buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); - if (buf==NULL) - return 0; - - uBackRead = 4; - while (uBackReaduMaxBack) - uBackRead = uMaxBack; - else - uBackRead+=BUFREADCOMMENT; - uReadPos = uSizeFile-uBackRead ; - - uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? - (BUFREADCOMMENT+4) : (uLong)(uSizeFile-uReadPos); - if (ZSEEK64(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) - break; - - if (ZREAD64(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) - break; - - for (i=(int)uReadSize-3; (i--)>0;) - { - // Signature "0x07064b50" Zip64 end of central directory locater - if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && ((*(buf+i+2))==0x06) && ((*(buf+i+3))==0x07)) - { - uPosFound = uReadPos+i; - break; - } - } - - if (uPosFound!=0) - break; - } - - TRYFREE(buf); - if (uPosFound == 0) - return 0; - - /* Zip64 end of central directory locator */ - if (ZSEEK64(*pzlib_filefunc_def,filestream, uPosFound,ZLIB_FILEFUNC_SEEK_SET)!=0) - return 0; - - /* the signature, already checked */ - if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) - return 0; - - /* number of the disk with the start of the zip64 end of central directory */ - if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) - return 0; - if (uL != 0) - return 0; - - /* relative offset of the zip64 end of central directory record */ - if (zip64local_getLong64(pzlib_filefunc_def,filestream,&relativeOffset)!=ZIP_OK) - return 0; - - /* total number of disks */ - if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) - return 0; - if (uL != 1) - return 0; - - /* Goto Zip64 end of central directory record */ - if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0) - return 0; - - /* the signature */ - if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) - return 0; - - if (uL != 0x06064b50) // signature of 'Zip64 end of central directory' - return 0; - - return relativeOffset; -} - -int LoadCentralDirectoryRecord(zip64_internal* pziinit) -{ - int err=ZIP_OK; - ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ - - ZPOS64_T size_central_dir; /* size of the central directory */ - ZPOS64_T offset_central_dir; /* offset of start of central directory */ - ZPOS64_T central_pos; - uLong uL; - - uLong number_disk; /* number of the current dist, used for - spaning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used - for spaning ZIP, unsupported, always 0*/ - ZPOS64_T number_entry; - ZPOS64_T number_entry_CD; /* total number of entries in - the central dir - (same than number_entry on nospan) */ - uLong VersionMadeBy; - uLong VersionNeeded; - uLong size_comment; - - int hasZIP64Record = 0; - - // check first if we find a ZIP64 record - central_pos = zip64local_SearchCentralDir64(&pziinit->z_filefunc,pziinit->filestream); - if(central_pos > 0) - { - hasZIP64Record = 1; - } - else if(central_pos == 0) - { - central_pos = zip64local_SearchCentralDir(&pziinit->z_filefunc,pziinit->filestream); - } - -/* disable to allow appending to empty ZIP archive - if (central_pos==0) - err=ZIP_ERRNO; -*/ - - if(hasZIP64Record) - { - ZPOS64_T sizeEndOfCentralDirectory; - if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, central_pos, ZLIB_FILEFUNC_SEEK_SET) != 0) - err=ZIP_ERRNO; - - /* the signature, already checked */ - if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream,&uL)!=ZIP_OK) - err=ZIP_ERRNO; - - /* size of zip64 end of central directory record */ - if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream, &sizeEndOfCentralDirectory)!=ZIP_OK) - err=ZIP_ERRNO; - - /* version made by */ - if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &VersionMadeBy)!=ZIP_OK) - err=ZIP_ERRNO; - - /* version needed to extract */ - if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &VersionNeeded)!=ZIP_OK) - err=ZIP_ERRNO; - - /* number of this disk */ - if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream,&number_disk)!=ZIP_OK) - err=ZIP_ERRNO; - - /* number of the disk with the start of the central directory */ - if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream,&number_disk_with_CD)!=ZIP_OK) - err=ZIP_ERRNO; - - /* total number of entries in the central directory on this disk */ - if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream, &number_entry)!=ZIP_OK) - err=ZIP_ERRNO; - - /* total number of entries in the central directory */ - if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream,&number_entry_CD)!=ZIP_OK) - err=ZIP_ERRNO; - - if ((number_entry_CD!=number_entry) || (number_disk_with_CD!=0) || (number_disk!=0)) - err=ZIP_BADZIPFILE; - - /* size of the central directory */ - if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream,&size_central_dir)!=ZIP_OK) - err=ZIP_ERRNO; - - /* offset of start of central directory with respect to the - starting disk number */ - if (zip64local_getLong64(&pziinit->z_filefunc, pziinit->filestream,&offset_central_dir)!=ZIP_OK) - err=ZIP_ERRNO; - - // TODO.. - // read the comment from the standard central header. - size_comment = 0; - } - else - { - // Read End of central Directory info - if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0) - err=ZIP_ERRNO; - - /* the signature, already checked */ - if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream,&uL)!=ZIP_OK) - err=ZIP_ERRNO; - - /* number of this disk */ - if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream,&number_disk)!=ZIP_OK) - err=ZIP_ERRNO; - - /* number of the disk with the start of the central directory */ - if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream,&number_disk_with_CD)!=ZIP_OK) - err=ZIP_ERRNO; - - /* total number of entries in the central dir on this disk */ - number_entry = 0; - if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK) - err=ZIP_ERRNO; - else - number_entry = uL; - - /* total number of entries in the central dir */ - number_entry_CD = 0; - if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK) - err=ZIP_ERRNO; - else - number_entry_CD = uL; - - if ((number_entry_CD!=number_entry) || (number_disk_with_CD!=0) || (number_disk!=0)) - err=ZIP_BADZIPFILE; - - /* size of the central directory */ - size_central_dir = 0; - if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK) - err=ZIP_ERRNO; - else - size_central_dir = uL; - - /* offset of start of central directory with respect to the starting disk number */ - offset_central_dir = 0; - if (zip64local_getLong(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK) - err=ZIP_ERRNO; - else - offset_central_dir = uL; - - - /* zipfile global comment length */ - if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &size_comment)!=ZIP_OK) - err=ZIP_ERRNO; - } - - if ((central_posz_filefunc, pziinit->filestream); - return ZIP_ERRNO; - } - - if (size_comment>0) - { - pziinit->globalcomment = (char*)ALLOC(size_comment+1); - if (pziinit->globalcomment) - { - size_comment = ZREAD64(pziinit->z_filefunc, pziinit->filestream, pziinit->globalcomment,size_comment); - pziinit->globalcomment[size_comment]=0; - } - } - - byte_before_the_zipfile = central_pos - (offset_central_dir+size_central_dir); - pziinit->add_position_when_writing_offset = byte_before_the_zipfile; - - { - ZPOS64_T size_central_dir_to_read = size_central_dir; - size_t buf_size = SIZEDATA_INDATABLOCK; - void* buf_read = (void*)ALLOC(buf_size); - if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir + byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0) - err=ZIP_ERRNO; - - while ((size_central_dir_to_read>0) && (err==ZIP_OK)) - { - ZPOS64_T read_this = SIZEDATA_INDATABLOCK; - if (read_this > size_central_dir_to_read) - read_this = size_central_dir_to_read; - - if (ZREAD64(pziinit->z_filefunc, pziinit->filestream,buf_read,(uLong)read_this) != read_this) - err=ZIP_ERRNO; - - if (err==ZIP_OK) - err = add_data_in_datablock(&pziinit->central_dir,buf_read, (uLong)read_this); - - size_central_dir_to_read-=read_this; - } - TRYFREE(buf_read); - } - pziinit->begin_pos = byte_before_the_zipfile; - pziinit->number_entry = number_entry_CD; - - if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET) != 0) - err=ZIP_ERRNO; - - return err; -} - - -#endif /* !NO_ADDFILEINEXISTINGZIP*/ - - -/************************************************************/ -extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) -{ - zip64_internal ziinit; - zip64_internal* zi; - int err=ZIP_OK; - - ziinit.z_filefunc.zseek32_file = NULL; - ziinit.z_filefunc.ztell32_file = NULL; - if (pzlib_filefunc64_32_def==NULL) - fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64); - else - ziinit.z_filefunc = *pzlib_filefunc64_32_def; - - ziinit.filestream = ZOPEN64(ziinit.z_filefunc, - pathname, - (append == APPEND_STATUS_CREATE) ? - (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE) : - (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING)); - - if (ziinit.filestream == NULL) - return NULL; - - if (append == APPEND_STATUS_CREATEAFTER) - ZSEEK64(ziinit.z_filefunc,ziinit.filestream,0,SEEK_END); - - ziinit.begin_pos = ZTELL64(ziinit.z_filefunc,ziinit.filestream); - ziinit.in_opened_file_inzip = 0; - ziinit.ci.stream_initialised = 0; - ziinit.number_entry = 0; - ziinit.add_position_when_writing_offset = 0; - init_linkedlist(&(ziinit.central_dir)); - - - - zi = (zip64_internal*)ALLOC(sizeof(zip64_internal)); - if (zi==NULL) - { - ZCLOSE64(ziinit.z_filefunc,ziinit.filestream); - return NULL; - } - - /* now we add file in a zipfile */ -# ifndef NO_ADDFILEINEXISTINGZIP - ziinit.globalcomment = NULL; - if (append == APPEND_STATUS_ADDINZIP) - { - // Read and Cache Central Directory Records - err = LoadCentralDirectoryRecord(&ziinit); - } - - if (globalcomment) - { - *globalcomment = ziinit.globalcomment; - } -# endif /* !NO_ADDFILEINEXISTINGZIP*/ - - if (err != ZIP_OK) - { -# ifndef NO_ADDFILEINEXISTINGZIP - TRYFREE(ziinit.globalcomment); -# endif /* !NO_ADDFILEINEXISTINGZIP*/ - TRYFREE(zi); - return NULL; - } - else - { - *zi = ziinit; - return (zipFile)zi; - } -} - -extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def) -{ - if (pzlib_filefunc32_def != NULL) - { - zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; - fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def); - return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill); - } - else - return zipOpen3(pathname, append, globalcomment, NULL); -} - -extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def) -{ - if (pzlib_filefunc_def != NULL) - { - zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; - zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def; - zlib_filefunc64_32_def_fill.ztell32_file = NULL; - zlib_filefunc64_32_def_fill.zseek32_file = NULL; - return zipOpen3(pathname, append, globalcomment, &zlib_filefunc64_32_def_fill); - } - else - return zipOpen3(pathname, append, globalcomment, NULL); -} - - - -extern zipFile ZEXPORT zipOpen (const char* pathname, int append) -{ - return zipOpen3((const void*)pathname,append,NULL,NULL); -} - -extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append) -{ - return zipOpen3(pathname,append,NULL,NULL); -} - -int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) -{ - /* write the local header */ - int err; - uInt size_filename = (uInt)strlen(filename); - uInt size_extrafield = size_extrafield_local; - - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)LOCALHEADERMAGIC, 4); - - if (err==ZIP_OK) - { - if(zi->ci.zip64) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)45,2);/* version needed to extract */ - else - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)20,2);/* version needed to extract */ - } - - if (err==ZIP_OK) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.flag,2); - - if (err==ZIP_OK) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.method,2); - - if (err==ZIP_OK) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.dosDate,4); - - // CRC / Compressed size / Uncompressed size will be filled in later and rewritten later - if (err==ZIP_OK) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* crc 32, unknown */ - if (err==ZIP_OK) - { - if(zi->ci.zip64) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xFFFFFFFF,4); /* compressed size, unknown */ - else - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* compressed size, unknown */ - } - if (err==ZIP_OK) - { - if(zi->ci.zip64) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xFFFFFFFF,4); /* uncompressed size, unknown */ - else - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* uncompressed size, unknown */ - } - - if (err==ZIP_OK) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_filename,2); - - if(zi->ci.zip64) - { - size_extrafield += 20; - } - - if (err==ZIP_OK) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_extrafield,2); - - if ((err==ZIP_OK) && (size_filename > 0)) - { - if (ZWRITE64(zi->z_filefunc,zi->filestream,filename,size_filename)!=size_filename) - err = ZIP_ERRNO; - } - - if ((err==ZIP_OK) && (size_extrafield_local > 0)) - { - if (ZWRITE64(zi->z_filefunc, zi->filestream, extrafield_local, size_extrafield_local) != size_extrafield_local) - err = ZIP_ERRNO; - } - - - if ((err==ZIP_OK) && (zi->ci.zip64)) - { - // write the Zip64 extended info - short HeaderID = 1; - short DataSize = 16; - ZPOS64_T CompressedSize = 0; - ZPOS64_T UncompressedSize = 0; - - // Remember position of Zip64 extended info for the local file header. (needed when we update size after done with file) - zi->ci.pos_zip64extrainfo = ZTELL64(zi->z_filefunc,zi->filestream); - - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2); - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2); - - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8); - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8); - } - - return err; -} - -/* - NOTE. - When writing RAW the ZIP64 extended information in extrafield_local and extrafield_global needs to be stripped - before calling this function it can be done with zipRemoveExtraInfoBlock - - It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize - unnecessary allocations. - */ -extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const zip_fileinfo* zipfi, - const void* extrafield_local, uInt size_extrafield_local, - const void* extrafield_global, uInt size_extrafield_global, - const char* comment, int method, int level, int raw, - int windowBits,int memLevel, int strategy, - const char* password, uLong crcForCrypting, - uLong versionMadeBy, uLong flagBase, int zip64) -{ - zip64_internal* zi; - uInt size_filename; - uInt size_comment; - uInt i; - int err = ZIP_OK; - -# ifdef NOCRYPT - (crcForCrypting); - if (password != NULL) - return ZIP_PARAMERROR; -# endif - - if (file == NULL) - return ZIP_PARAMERROR; - -#ifdef HAVE_BZIP2 - if ((method!=0) && (method!=Z_DEFLATED) && (method!=Z_BZIP2ED)) - return ZIP_PARAMERROR; -#else - if ((method!=0) && (method!=Z_DEFLATED)) - return ZIP_PARAMERROR; -#endif - - zi = (zip64_internal*)file; - - if (zi->in_opened_file_inzip == 1) - { - err = zipCloseFileInZip (file); - if (err != ZIP_OK) - return err; - } - - if (filename==NULL) - filename="-"; - - if (comment==NULL) - size_comment = 0; - else - size_comment = (uInt)strlen(comment); - - size_filename = (uInt)strlen(filename); - - if (zipfi == NULL) - zi->ci.dosDate = 0; - else - { - if (zipfi->dosDate != 0) - zi->ci.dosDate = zipfi->dosDate; - else - zi->ci.dosDate = zip64local_TmzDateToDosDate(&zipfi->tmz_date); - } - - zi->ci.flag = flagBase; - if ((level==8) || (level==9)) - zi->ci.flag |= 2; - if (level==2) - zi->ci.flag |= 4; - if (level==1) - zi->ci.flag |= 6; - if (password != NULL) - zi->ci.flag |= 1; - - zi->ci.crc32 = 0; - zi->ci.method = method; - zi->ci.encrypt = 0; - zi->ci.stream_initialised = 0; - zi->ci.pos_in_buffered_data = 0; - zi->ci.raw = raw; - zi->ci.pos_local_header = ZTELL64(zi->z_filefunc,zi->filestream); - - zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + size_extrafield_global + size_comment; - zi->ci.size_centralExtraFree = 32; // Extra space we have reserved in case we need to add ZIP64 extra info data - - zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader + zi->ci.size_centralExtraFree); - - zi->ci.size_centralExtra = size_extrafield_global; - zip64local_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4); - /* version info */ - zip64local_putValue_inmemory(zi->ci.central_header+4,(uLong)versionMadeBy,2); - zip64local_putValue_inmemory(zi->ci.central_header+6,(uLong)20,2); - zip64local_putValue_inmemory(zi->ci.central_header+8,(uLong)zi->ci.flag,2); - zip64local_putValue_inmemory(zi->ci.central_header+10,(uLong)zi->ci.method,2); - zip64local_putValue_inmemory(zi->ci.central_header+12,(uLong)zi->ci.dosDate,4); - zip64local_putValue_inmemory(zi->ci.central_header+16,(uLong)0,4); /*crc*/ - zip64local_putValue_inmemory(zi->ci.central_header+20,(uLong)0,4); /*compr size*/ - zip64local_putValue_inmemory(zi->ci.central_header+24,(uLong)0,4); /*uncompr size*/ - zip64local_putValue_inmemory(zi->ci.central_header+28,(uLong)size_filename,2); - zip64local_putValue_inmemory(zi->ci.central_header+30,(uLong)size_extrafield_global,2); - zip64local_putValue_inmemory(zi->ci.central_header+32,(uLong)size_comment,2); - zip64local_putValue_inmemory(zi->ci.central_header+34,(uLong)0,2); /*disk nm start*/ - - if (zipfi==NULL) - zip64local_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2); - else - zip64local_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2); - - if (zipfi==NULL) - zip64local_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4); - else - zip64local_putValue_inmemory(zi->ci.central_header+38,(uLong)zipfi->external_fa,4); - - if(zi->ci.pos_local_header >= 0xffffffff) - zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)0xffffffff,4); - else - zip64local_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header - zi->add_position_when_writing_offset,4); - - for (i=0;ici.central_header+SIZECENTRALHEADER+i) = *(filename+i); - - for (i=0;ici.central_header+SIZECENTRALHEADER+size_filename+i) = - *(((const char*)extrafield_global)+i); - - for (i=0;ici.central_header+SIZECENTRALHEADER+size_filename+ - size_extrafield_global+i) = *(comment+i); - if (zi->ci.central_header == NULL) - return ZIP_INTERNALERROR; - - zi->ci.zip64 = zip64; - zi->ci.totalCompressedData = 0; - zi->ci.totalUncompressedData = 0; - zi->ci.pos_zip64extrainfo = 0; - - err = Write_LocalFileHeader(zi, filename, size_extrafield_local, extrafield_local); - -#ifdef HAVE_BZIP2 - zi->ci.bstream.avail_in = (uInt)0; - zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE; - zi->ci.bstream.next_out = (char*)zi->ci.buffered_data; - zi->ci.bstream.total_in_hi32 = 0; - zi->ci.bstream.total_in_lo32 = 0; - zi->ci.bstream.total_out_hi32 = 0; - zi->ci.bstream.total_out_lo32 = 0; -#endif - - zi->ci.stream.avail_in = (uInt)0; - zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; - zi->ci.stream.next_out = zi->ci.buffered_data; - zi->ci.stream.total_in = 0; - zi->ci.stream.total_out = 0; - zi->ci.stream.data_type = Z_BINARY; - -#ifdef HAVE_BZIP2 - if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED || zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw)) -#else - if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) -#endif - { - if(zi->ci.method == Z_DEFLATED) - { - zi->ci.stream.zalloc = (alloc_func)0; - zi->ci.stream.zfree = (free_func)0; - zi->ci.stream.opaque = (voidpf)0; - - if (windowBits>0) - windowBits = -windowBits; - - err = deflateInit2(&zi->ci.stream, level, Z_DEFLATED, windowBits, memLevel, strategy); - - if (err==Z_OK) - zi->ci.stream_initialised = Z_DEFLATED; - } - else if(zi->ci.method == Z_BZIP2ED) - { -#ifdef HAVE_BZIP2 - // Init BZip stuff here - zi->ci.bstream.bzalloc = 0; - zi->ci.bstream.bzfree = 0; - zi->ci.bstream.opaque = (voidpf)0; - - err = BZ2_bzCompressInit(&zi->ci.bstream, level, 0,35); - if(err == BZ_OK) - zi->ci.stream_initialised = Z_BZIP2ED; -#endif - } - - } - -# ifndef NOCRYPT - zi->ci.crypt_header_size = 0; - if ((err==Z_OK) && (password != NULL)) - { - unsigned char bufHead[RAND_HEAD_LEN]; - unsigned int sizeHead; - zi->ci.encrypt = 1; - zi->ci.pcrc_32_tab = get_crc_table(); - /*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/ - - sizeHead=crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting); - zi->ci.crypt_header_size = sizeHead; - - if (ZWRITE64(zi->z_filefunc,zi->filestream,bufHead,sizeHead) != sizeHead) - err = ZIP_ERRNO; - } -# endif - - if (err==Z_OK) - zi->in_opened_file_inzip = 1; - return err; -} - -extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file, const char* filename, const zip_fileinfo* zipfi, - const void* extrafield_local, uInt size_extrafield_local, - const void* extrafield_global, uInt size_extrafield_global, - const char* comment, int method, int level, int raw, - int windowBits,int memLevel, int strategy, - const char* password, uLong crcForCrypting, - uLong versionMadeBy, uLong flagBase) -{ - return zipOpenNewFileInZip4_64 (file, filename, zipfi, - extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, - comment, method, level, raw, - windowBits, memLevel, strategy, - password, crcForCrypting, versionMadeBy, flagBase, 0); -} - -extern int ZEXPORT zipOpenNewFileInZip3 (zipFile file, const char* filename, const zip_fileinfo* zipfi, - const void* extrafield_local, uInt size_extrafield_local, - const void* extrafield_global, uInt size_extrafield_global, - const char* comment, int method, int level, int raw, - int windowBits,int memLevel, int strategy, - const char* password, uLong crcForCrypting) -{ - return zipOpenNewFileInZip4_64 (file, filename, zipfi, - extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, - comment, method, level, raw, - windowBits, memLevel, strategy, - password, crcForCrypting, VERSIONMADEBY, 0, 0); -} - -extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, - const void* extrafield_local, uInt size_extrafield_local, - const void* extrafield_global, uInt size_extrafield_global, - const char* comment, int method, int level, int raw, - int windowBits,int memLevel, int strategy, - const char* password, uLong crcForCrypting, int zip64) -{ - return zipOpenNewFileInZip4_64 (file, filename, zipfi, - extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, - comment, method, level, raw, - windowBits, memLevel, strategy, - password, crcForCrypting, VERSIONMADEBY, 0, zip64); -} - -extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi, - const void* extrafield_local, uInt size_extrafield_local, - const void* extrafield_global, uInt size_extrafield_global, - const char* comment, int method, int level, int raw) -{ - return zipOpenNewFileInZip4_64 (file, filename, zipfi, - extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, - comment, method, level, raw, - -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, - NULL, 0, VERSIONMADEBY, 0, 0); -} - -extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, - const void* extrafield_local, uInt size_extrafield_local, - const void* extrafield_global, uInt size_extrafield_global, - const char* comment, int method, int level, int raw, int zip64) -{ - return zipOpenNewFileInZip4_64 (file, filename, zipfi, - extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, - comment, method, level, raw, - -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, - NULL, 0, VERSIONMADEBY, 0, zip64); -} - -extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file, const char* filename, const zip_fileinfo* zipfi, - const void* extrafield_local, uInt size_extrafield_local, - const void*extrafield_global, uInt size_extrafield_global, - const char* comment, int method, int level, int zip64) -{ - return zipOpenNewFileInZip4_64 (file, filename, zipfi, - extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, - comment, method, level, 0, - -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, - NULL, 0, VERSIONMADEBY, 0, zip64); -} - -extern int ZEXPORT zipOpenNewFileInZip (zipFile file, const char* filename, const zip_fileinfo* zipfi, - const void* extrafield_local, uInt size_extrafield_local, - const void*extrafield_global, uInt size_extrafield_global, - const char* comment, int method, int level) -{ - return zipOpenNewFileInZip4_64 (file, filename, zipfi, - extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, - comment, method, level, 0, - -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, - NULL, 0, VERSIONMADEBY, 0, 0); -} - -local int zip64FlushWriteBuffer(zip64_internal* zi) -{ - int err=ZIP_OK; - - if (zi->ci.encrypt != 0) - { -#ifndef NOCRYPT - uInt i; - int t; - for (i=0;ici.pos_in_buffered_data;i++) - zi->ci.buffered_data[i] = zencode(zi->ci.keys, zi->ci.pcrc_32_tab, zi->ci.buffered_data[i],t); -#endif - } - - if (ZWRITE64(zi->z_filefunc,zi->filestream,zi->ci.buffered_data,zi->ci.pos_in_buffered_data) != zi->ci.pos_in_buffered_data) - err = ZIP_ERRNO; - - zi->ci.totalCompressedData += zi->ci.pos_in_buffered_data; - -#ifdef HAVE_BZIP2 - if(zi->ci.method == Z_BZIP2ED) - { - zi->ci.totalUncompressedData += zi->ci.bstream.total_in_lo32; - zi->ci.bstream.total_in_lo32 = 0; - zi->ci.bstream.total_in_hi32 = 0; - } - else -#endif - { - zi->ci.totalUncompressedData += zi->ci.stream.total_in; - zi->ci.stream.total_in = 0; - } - - - zi->ci.pos_in_buffered_data = 0; - - return err; -} - -extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned int len) -{ - zip64_internal* zi; - int err=ZIP_OK; - - if (file == NULL) - return ZIP_PARAMERROR; - zi = (zip64_internal*)file; - - if (zi->in_opened_file_inzip == 0) - return ZIP_PARAMERROR; - - zi->ci.crc32 = crc32(zi->ci.crc32,buf,(uInt)len); - -#ifdef HAVE_BZIP2 - if(zi->ci.method == Z_BZIP2ED && (!zi->ci.raw)) - { - zi->ci.bstream.next_in = (void*)buf; - zi->ci.bstream.avail_in = len; - err = BZ_RUN_OK; - - while ((err==BZ_RUN_OK) && (zi->ci.bstream.avail_in>0)) - { - if (zi->ci.bstream.avail_out == 0) - { - if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) - err = ZIP_ERRNO; - zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE; - zi->ci.bstream.next_out = (char*)zi->ci.buffered_data; - } - - - if(err != BZ_RUN_OK) - break; - - if ((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw)) - { - uLong uTotalOutBefore_lo = zi->ci.bstream.total_out_lo32; -// uLong uTotalOutBefore_hi = zi->ci.bstream.total_out_hi32; - err=BZ2_bzCompress(&zi->ci.bstream, BZ_RUN); - - zi->ci.pos_in_buffered_data += (uInt)(zi->ci.bstream.total_out_lo32 - uTotalOutBefore_lo) ; - } - } - - if(err == BZ_RUN_OK) - err = ZIP_OK; - } - else -#endif - { - zi->ci.stream.next_in = (Bytef*)buf; - zi->ci.stream.avail_in = len; - - while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0)) - { - if (zi->ci.stream.avail_out == 0) - { - if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) - err = ZIP_ERRNO; - zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; - zi->ci.stream.next_out = zi->ci.buffered_data; - } - - - if(err != ZIP_OK) - break; - - if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) - { - uLong uTotalOutBefore = zi->ci.stream.total_out; - err=deflate(&zi->ci.stream, Z_NO_FLUSH); - if(uTotalOutBefore > zi->ci.stream.total_out) - { - int bBreak = 0; - bBreak++; - } - - zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; - } - else - { - uInt copy_this,i; - if (zi->ci.stream.avail_in < zi->ci.stream.avail_out) - copy_this = zi->ci.stream.avail_in; - else - copy_this = zi->ci.stream.avail_out; - - for (i = 0; i < copy_this; i++) - *(((char*)zi->ci.stream.next_out)+i) = - *(((const char*)zi->ci.stream.next_in)+i); - { - zi->ci.stream.avail_in -= copy_this; - zi->ci.stream.avail_out-= copy_this; - zi->ci.stream.next_in+= copy_this; - zi->ci.stream.next_out+= copy_this; - zi->ci.stream.total_in+= copy_this; - zi->ci.stream.total_out+= copy_this; - zi->ci.pos_in_buffered_data += copy_this; - } - } - }// while(...) - } - - return err; -} - -extern int ZEXPORT zipCloseFileInZipRaw (zipFile file, uLong uncompressed_size, uLong crc32) -{ - return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32); -} - -extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_size, uLong crc32) -{ - zip64_internal* zi; - ZPOS64_T compressed_size; - uLong invalidValue = 0xffffffff; - short datasize = 0; - int err=ZIP_OK; - - if (file == NULL) - return ZIP_PARAMERROR; - zi = (zip64_internal*)file; - - if (zi->in_opened_file_inzip == 0) - return ZIP_PARAMERROR; - zi->ci.stream.avail_in = 0; - - if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) - { - while (err==ZIP_OK) - { - uLong uTotalOutBefore; - if (zi->ci.stream.avail_out == 0) - { - if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) - err = ZIP_ERRNO; - zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; - zi->ci.stream.next_out = zi->ci.buffered_data; - } - uTotalOutBefore = zi->ci.stream.total_out; - err=deflate(&zi->ci.stream, Z_FINISH); - zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; - } - } - else if ((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw)) - { -#ifdef HAVE_BZIP2 - err = BZ_FINISH_OK; - while (err==BZ_FINISH_OK) - { - uLong uTotalOutBefore; - if (zi->ci.bstream.avail_out == 0) - { - if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) - err = ZIP_ERRNO; - zi->ci.bstream.avail_out = (uInt)Z_BUFSIZE; - zi->ci.bstream.next_out = (char*)zi->ci.buffered_data; - } - uTotalOutBefore = zi->ci.bstream.total_out_lo32; - err=BZ2_bzCompress(&zi->ci.bstream, BZ_FINISH); - if(err == BZ_STREAM_END) - err = Z_STREAM_END; - - zi->ci.pos_in_buffered_data += (uInt)(zi->ci.bstream.total_out_lo32 - uTotalOutBefore); - } - - if(err == BZ_FINISH_OK) - err = ZIP_OK; -#endif - } - - if (err==Z_STREAM_END) - err=ZIP_OK; /* this is normal */ - - if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK)) - { - if (zip64FlushWriteBuffer(zi)==ZIP_ERRNO) - err = ZIP_ERRNO; - } - - if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) - { - int tmp_err = deflateEnd(&zi->ci.stream); - if (err == ZIP_OK) - err = tmp_err; - zi->ci.stream_initialised = 0; - } -#ifdef HAVE_BZIP2 - else if((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw)) - { - int tmperr = BZ2_bzCompressEnd(&zi->ci.bstream); - if (err==ZIP_OK) - err = tmperr; - zi->ci.stream_initialised = 0; - } -#endif - - if (!zi->ci.raw) - { - crc32 = (uLong)zi->ci.crc32; - uncompressed_size = zi->ci.totalUncompressedData; - } - compressed_size = zi->ci.totalCompressedData; - -# ifndef NOCRYPT - compressed_size += zi->ci.crypt_header_size; -# endif - - // update Current Item crc and sizes, - if(compressed_size >= 0xffffffff || uncompressed_size >= 0xffffffff || zi->ci.pos_local_header >= 0xffffffff) - { - /*version Made by*/ - zip64local_putValue_inmemory(zi->ci.central_header+4,(uLong)45,2); - /*version needed*/ - zip64local_putValue_inmemory(zi->ci.central_header+6,(uLong)45,2); - - } - - zip64local_putValue_inmemory(zi->ci.central_header+16,crc32,4); /*crc*/ - - - if(compressed_size >= 0xffffffff) - zip64local_putValue_inmemory(zi->ci.central_header+20, invalidValue,4); /*compr size*/ - else - zip64local_putValue_inmemory(zi->ci.central_header+20, compressed_size,4); /*compr size*/ - - /// set internal file attributes field - if (zi->ci.stream.data_type == Z_ASCII) - zip64local_putValue_inmemory(zi->ci.central_header+36,(uLong)Z_ASCII,2); - - if(uncompressed_size >= 0xffffffff) - zip64local_putValue_inmemory(zi->ci.central_header+24, invalidValue,4); /*uncompr size*/ - else - zip64local_putValue_inmemory(zi->ci.central_header+24, uncompressed_size,4); /*uncompr size*/ - - // Add ZIP64 extra info field for uncompressed size - if(uncompressed_size >= 0xffffffff) - datasize += 8; - - // Add ZIP64 extra info field for compressed size - if(compressed_size >= 0xffffffff) - datasize += 8; - - // Add ZIP64 extra info field for relative offset to local file header of current file - if(zi->ci.pos_local_header >= 0xffffffff) - datasize += 8; - - if(datasize > 0) - { - char* p = NULL; - - if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) - { - // we can not write more data to the buffer that we have room for. - return ZIP_BADZIPFILE; - } - - p = zi->ci.central_header + zi->ci.size_centralheader; - - // Add Extra Information Header for 'ZIP64 information' - zip64local_putValue_inmemory(p, 0x0001, 2); // HeaderID - p += 2; - zip64local_putValue_inmemory(p, datasize, 2); // DataSize - p += 2; - - if(uncompressed_size >= 0xffffffff) - { - zip64local_putValue_inmemory(p, uncompressed_size, 8); - p += 8; - } - - if(compressed_size >= 0xffffffff) - { - zip64local_putValue_inmemory(p, compressed_size, 8); - p += 8; - } - - if(zi->ci.pos_local_header >= 0xffffffff) - { - zip64local_putValue_inmemory(p, zi->ci.pos_local_header, 8); - p += 8; - } - - // Update how much extra free space we got in the memory buffer - // and increase the centralheader size so the new ZIP64 fields are included - // ( 4 below is the size of HeaderID and DataSize field ) - zi->ci.size_centralExtraFree -= datasize + 4; - zi->ci.size_centralheader += datasize + 4; - - // Update the extra info size field - zi->ci.size_centralExtra += datasize + 4; - zip64local_putValue_inmemory(zi->ci.central_header+30,(uLong)zi->ci.size_centralExtra,2); - } - - if (err==ZIP_OK) - err = add_data_in_datablock(&zi->central_dir, zi->ci.central_header, (uLong)zi->ci.size_centralheader); - - free(zi->ci.central_header); - - if (err==ZIP_OK) - { - // Update the LocalFileHeader with the new values. - - ZPOS64_T cur_pos_inzip = ZTELL64(zi->z_filefunc,zi->filestream); - - if (ZSEEK64(zi->z_filefunc,zi->filestream, zi->ci.pos_local_header + 14,ZLIB_FILEFUNC_SEEK_SET)!=0) - err = ZIP_ERRNO; - - if (err==ZIP_OK) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,crc32,4); /* crc 32, unknown */ - - if(uncompressed_size >= 0xffffffff || compressed_size >= 0xffffffff ) - { - if(zi->ci.pos_zip64extrainfo > 0) - { - // Update the size in the ZIP64 extended field. - if (ZSEEK64(zi->z_filefunc,zi->filestream, zi->ci.pos_zip64extrainfo + 4,ZLIB_FILEFUNC_SEEK_SET)!=0) - err = ZIP_ERRNO; - - if (err==ZIP_OK) /* compressed size, unknown */ - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, uncompressed_size, 8); - - if (err==ZIP_OK) /* uncompressed size, unknown */ - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, compressed_size, 8); - } - else - err = ZIP_BADZIPFILE; // Caller passed zip64 = 0, so no room for zip64 info -> fatal - } - else - { - if (err==ZIP_OK) /* compressed size, unknown */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,compressed_size,4); - - if (err==ZIP_OK) /* uncompressed size, unknown */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,uncompressed_size,4); - } - - if (ZSEEK64(zi->z_filefunc,zi->filestream, cur_pos_inzip,ZLIB_FILEFUNC_SEEK_SET)!=0) - err = ZIP_ERRNO; - } - - zi->number_entry ++; - zi->in_opened_file_inzip = 0; - - return err; -} - -extern int ZEXPORT zipCloseFileInZip (zipFile file) -{ - return zipCloseFileInZipRaw (file,0,0); -} - -int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) -{ - int err = ZIP_OK; - ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset; - - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4); - - /*num disks*/ - if (err==ZIP_OK) /* number of the disk with the start of the central directory */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); - - /*relative offset*/ - if (err==ZIP_OK) /* Relative offset to the Zip64EndOfCentralDirectory */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream, pos,8); - - /*total disks*/ /* Do not support spawning of disk so always say 1 here*/ - if (err==ZIP_OK) /* number of the disk with the start of the central directory */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)1,4); - - return err; -} - -int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) -{ - int err = ZIP_OK; - - uLong Zip64DataSize = 44; - - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDHEADERMAGIC,4); - - if (err==ZIP_OK) /* size of this 'zip64 end of central directory' */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(ZPOS64_T)Zip64DataSize,8); // why ZPOS64_T of this ? - - if (err==ZIP_OK) /* version made by */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)45,2); - - if (err==ZIP_OK) /* version needed */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)45,2); - - if (err==ZIP_OK) /* number of this disk */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); - - if (err==ZIP_OK) /* number of the disk with the start of the central directory */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); - - if (err==ZIP_OK) /* total number of entries in the central dir on this disk */ - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, zi->number_entry, 8); - - if (err==ZIP_OK) /* total number of entries in the central dir */ - err = zip64local_putValue(&zi->z_filefunc, zi->filestream, zi->number_entry, 8); - - if (err==ZIP_OK) /* size of the central directory */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(ZPOS64_T)size_centraldir,8); - - if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */ - { - ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; - err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8); - } - return err; -} -int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) -{ - int err = ZIP_OK; - - /*signature*/ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4); - - if (err==ZIP_OK) /* number of this disk */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2); - - if (err==ZIP_OK) /* number of the disk with the start of the central directory */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2); - - if (err==ZIP_OK) /* total number of entries in the central dir on this disk */ - { - { - if(zi->number_entry >= 0xFFFF) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xffff,2); // use value in ZIP64 record - else - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2); - } - } - - if (err==ZIP_OK) /* total number of entries in the central dir */ - { - if(zi->number_entry >= 0xFFFF) - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0xffff,2); // use value in ZIP64 record - else - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2); - } - - if (err==ZIP_OK) /* size of the central directory */ - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_centraldir,4); - - if (err==ZIP_OK) /* offset of start of central directory with respect to the starting disk number */ - { - ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; - if(pos >= 0xffffffff) - { - err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)0xffffffff,4); - } - else - err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writing_offset),4); - } - - return err; -} - -int Write_GlobalComment(zip64_internal* zi, const char* global_comment) -{ - int err = ZIP_OK; - uInt size_global_comment = 0; - - if(global_comment != NULL) - size_global_comment = (uInt)strlen(global_comment); - - err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_global_comment,2); - - if (err == ZIP_OK && size_global_comment > 0) - { - if (ZWRITE64(zi->z_filefunc,zi->filestream, global_comment, size_global_comment) != size_global_comment) - err = ZIP_ERRNO; - } - return err; -} - -extern int ZEXPORT zipClose (zipFile file, const char* global_comment) -{ - zip64_internal* zi; - int err = 0; - uLong size_centraldir = 0; - ZPOS64_T centraldir_pos_inzip; - ZPOS64_T pos; - - if (file == NULL) - return ZIP_PARAMERROR; - - zi = (zip64_internal*)file; - - if (zi->in_opened_file_inzip == 1) - { - err = zipCloseFileInZip (file); - } - -#ifndef NO_ADDFILEINEXISTINGZIP - if (global_comment==NULL) - global_comment = zi->globalcomment; -#endif - - centraldir_pos_inzip = ZTELL64(zi->z_filefunc,zi->filestream); - - if (err==ZIP_OK) - { - linkedlist_datablock_internal* ldi = zi->central_dir.first_block; - while (ldi!=NULL) - { - if ((err==ZIP_OK) && (ldi->filled_in_this_block>0)) - { - if (ZWRITE64(zi->z_filefunc,zi->filestream, ldi->data, ldi->filled_in_this_block) != ldi->filled_in_this_block) - err = ZIP_ERRNO; - } - - size_centraldir += ldi->filled_in_this_block; - ldi = ldi->next_datablock; - } - } - free_linkedlist(&(zi->central_dir)); - - pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; - if(pos >= 0xffffffff || zi->number_entry > 0xFFFF) - { - ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); - Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); - - Write_Zip64EndOfCentralDirectoryLocator(zi, Zip64EOCDpos); - } - - if (err==ZIP_OK) - err = Write_EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); - - if(err == ZIP_OK) - err = Write_GlobalComment(zi, global_comment); - - if (ZCLOSE64(zi->z_filefunc,zi->filestream) != 0) - if (err == ZIP_OK) - err = ZIP_ERRNO; - -#ifndef NO_ADDFILEINEXISTINGZIP - TRYFREE(zi->globalcomment); -#endif - TRYFREE(zi); - - return err; -} - -extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHeader) -{ - char* p = pData; - int size = 0; - char* pNewHeader; - char* pTmp; - short header; - short dataSize; - - int retVal = ZIP_OK; - - if(pData == NULL || *dataLen < 4) - return ZIP_PARAMERROR; - - pNewHeader = (char*)ALLOC(*dataLen); - pTmp = pNewHeader; - - while(p < (pData + *dataLen)) - { - header = *(short*)p; - dataSize = *(((short*)p)+1); - - if( header == sHeader ) // Header found. - { - p += dataSize + 4; // skip it. do not copy to temp buffer - } - else - { - // Extra Info block should not be removed, So copy it to the temp buffer. - memcpy(pTmp, p, dataSize + 4); - p += dataSize + 4; - size += dataSize + 4; - } - - } - - if(size < *dataLen) - { - // clean old extra info block. - memset(pData,0, *dataLen); - - // copy the new extra info block over the old - if(size > 0) - memcpy(pData, pNewHeader, size); - - // set the new extra info size - *dataLen = size; - - retVal = ZIP_OK; - } - else - retVal = ZIP_ERRNO; - - TRYFREE(pNewHeader); - - return retVal; -} diff --git a/compat/zlib/contrib/minizip/zip.h b/compat/zlib/contrib/minizip/zip.h deleted file mode 100644 index 8aaebb6..0000000 --- a/compat/zlib/contrib/minizip/zip.h +++ /dev/null @@ -1,362 +0,0 @@ -/* zip.h -- IO on .zip files using zlib - Version 1.1, February 14h, 2010 - part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) - - Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) - - Modifications for Zip64 support - Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) - - For more info read MiniZip_info.txt - - --------------------------------------------------------------------------- - - Condition of use and distribution are the same than zlib : - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - --------------------------------------------------------------------------- - - Changes - - See header of zip.h - -*/ - -#ifndef _zip12_H -#define _zip12_H - -#ifdef __cplusplus -extern "C" { -#endif - -//#define HAVE_BZIP2 - -#ifndef _ZLIB_H -#include "zlib.h" -#endif - -#ifndef _ZLIBIOAPI_H -#include "ioapi.h" -#endif - -#ifdef HAVE_BZIP2 -#include "bzlib.h" -#endif - -#define Z_BZIP2ED 12 - -#if defined(STRICTZIP) || defined(STRICTZIPUNZIP) -/* like the STRICT of WIN32, we define a pointer that cannot be converted - from (void*) without cast */ -typedef struct TagzipFile__ { int unused; } zipFile__; -typedef zipFile__ *zipFile; -#else -typedef voidp zipFile; -#endif - -#define ZIP_OK (0) -#define ZIP_EOF (0) -#define ZIP_ERRNO (Z_ERRNO) -#define ZIP_PARAMERROR (-102) -#define ZIP_BADZIPFILE (-103) -#define ZIP_INTERNALERROR (-104) - -#ifndef DEF_MEM_LEVEL -# if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -# else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -# endif -#endif -/* default memLevel */ - -/* tm_zip contain date/time info */ -typedef struct tm_zip_s -{ - uInt tm_sec; /* seconds after the minute - [0,59] */ - uInt tm_min; /* minutes after the hour - [0,59] */ - uInt tm_hour; /* hours since midnight - [0,23] */ - uInt tm_mday; /* day of the month - [1,31] */ - uInt tm_mon; /* months since January - [0,11] */ - uInt tm_year; /* years - [1980..2044] */ -} tm_zip; - -typedef struct -{ - tm_zip tmz_date; /* date in understandable format */ - uLong dosDate; /* if dos_date == 0, tmu_date is used */ -/* uLong flag; */ /* general purpose bit flag 2 bytes */ - - uLong internal_fa; /* internal file attributes 2 bytes */ - uLong external_fa; /* external file attributes 4 bytes */ -} zip_fileinfo; - -typedef const char* zipcharpc; - - -#define APPEND_STATUS_CREATE (0) -#define APPEND_STATUS_CREATEAFTER (1) -#define APPEND_STATUS_ADDINZIP (2) - -extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); -extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append)); -/* - Create a zipfile. - pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on - an Unix computer "zlib/zlib113.zip". - if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip - will be created at the end of the file. - (useful if the file contain a self extractor code) - if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will - add files in existing zip (be sure you don't add file that doesn't exist) - If the zipfile cannot be opened, the return value is NULL. - Else, the return value is a zipFile Handle, usable with other function - of this zip package. -*/ - -/* Note : there is no delete function into a zipfile. - If you want delete file into a zipfile, you must open a zipfile, and create another - Of couse, you can use RAW reading and writing to copy the file you did not want delte -*/ - -extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, - int append, - zipcharpc* globalcomment, - zlib_filefunc_def* pzlib_filefunc_def)); - -extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname, - int append, - zipcharpc* globalcomment, - zlib_filefunc64_def* pzlib_filefunc_def)); - -extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, - const char* filename, - const zip_fileinfo* zipfi, - const void* extrafield_local, - uInt size_extrafield_local, - const void* extrafield_global, - uInt size_extrafield_global, - const char* comment, - int method, - int level)); - -extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file, - const char* filename, - const zip_fileinfo* zipfi, - const void* extrafield_local, - uInt size_extrafield_local, - const void* extrafield_global, - uInt size_extrafield_global, - const char* comment, - int method, - int level, - int zip64)); - -/* - Open a file in the ZIP for writing. - filename : the filename in zip (if NULL, '-' without quote will be used - *zipfi contain supplemental information - if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local - contains the extrafield data the the local header - if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global - contains the extrafield data the the local header - if comment != NULL, comment contain the comment string - method contain the compression method (0 for store, Z_DEFLATED for deflate) - level contain the level of compression (can be Z_DEFAULT_COMPRESSION) - zip64 is set to 1 if a zip64 extended information block should be added to the local file header. - this MUST be '1' if the uncompressed size is >= 0xffffffff. - -*/ - - -extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, - const char* filename, - const zip_fileinfo* zipfi, - const void* extrafield_local, - uInt size_extrafield_local, - const void* extrafield_global, - uInt size_extrafield_global, - const char* comment, - int method, - int level, - int raw)); - - -extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file, - const char* filename, - const zip_fileinfo* zipfi, - const void* extrafield_local, - uInt size_extrafield_local, - const void* extrafield_global, - uInt size_extrafield_global, - const char* comment, - int method, - int level, - int raw, - int zip64)); -/* - Same than zipOpenNewFileInZip, except if raw=1, we write raw file - */ - -extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, - const char* filename, - const zip_fileinfo* zipfi, - const void* extrafield_local, - uInt size_extrafield_local, - const void* extrafield_global, - uInt size_extrafield_global, - const char* comment, - int method, - int level, - int raw, - int windowBits, - int memLevel, - int strategy, - const char* password, - uLong crcForCrypting)); - -extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file, - const char* filename, - const zip_fileinfo* zipfi, - const void* extrafield_local, - uInt size_extrafield_local, - const void* extrafield_global, - uInt size_extrafield_global, - const char* comment, - int method, - int level, - int raw, - int windowBits, - int memLevel, - int strategy, - const char* password, - uLong crcForCrypting, - int zip64 - )); - -/* - Same than zipOpenNewFileInZip2, except - windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 - password : crypting password (NULL for no crypting) - crcForCrypting : crc of file to compress (needed for crypting) - */ - -extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file, - const char* filename, - const zip_fileinfo* zipfi, - const void* extrafield_local, - uInt size_extrafield_local, - const void* extrafield_global, - uInt size_extrafield_global, - const char* comment, - int method, - int level, - int raw, - int windowBits, - int memLevel, - int strategy, - const char* password, - uLong crcForCrypting, - uLong versionMadeBy, - uLong flagBase - )); - - -extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file, - const char* filename, - const zip_fileinfo* zipfi, - const void* extrafield_local, - uInt size_extrafield_local, - const void* extrafield_global, - uInt size_extrafield_global, - const char* comment, - int method, - int level, - int raw, - int windowBits, - int memLevel, - int strategy, - const char* password, - uLong crcForCrypting, - uLong versionMadeBy, - uLong flagBase, - int zip64 - )); -/* - Same than zipOpenNewFileInZip4, except - versionMadeBy : value for Version made by field - flag : value for flag field (compression level info will be added) - */ - - -extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, - const void* buf, - unsigned len)); -/* - Write data in the zipfile -*/ - -extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); -/* - Close the current file in the zipfile -*/ - -extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, - uLong uncompressed_size, - uLong crc32)); - -extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file, - ZPOS64_T uncompressed_size, - uLong crc32)); - -/* - Close the current file in the zipfile, for file opened with - parameter raw=1 in zipOpenNewFileInZip2 - uncompressed_size and crc32 are value for the uncompressed size -*/ - -extern int ZEXPORT zipClose OF((zipFile file, - const char* global_comment)); -/* - Close the zipfile -*/ - - -extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader)); -/* - zipRemoveExtraInfoBlock - Added by Mathias Svensson - - Remove extra information block from a extra information data for the local file header or central directory header - - It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode. - - 0x0001 is the signature header for the ZIP64 extra information blocks - - usage. - Remove ZIP64 Extra information from a central director extra field data - zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001); - - Remove ZIP64 Extra information from a Local File Header extra field data - zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001); -*/ - -#ifdef __cplusplus -} -#endif - -#endif /* _zip64_H */ diff --git a/compat/zlib/contrib/pascal/example.pas b/compat/zlib/contrib/pascal/example.pas deleted file mode 100644 index 5518b36..0000000 --- a/compat/zlib/contrib/pascal/example.pas +++ /dev/null @@ -1,599 +0,0 @@ -(* example.c -- usage example of the zlib compression library - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Pascal translation - * Copyright (C) 1998 by Jacques Nomssi Nzali. - * For conditions of distribution and use, see copyright notice in readme.txt - * - * Adaptation to the zlibpas interface - * Copyright (C) 2003 by Cosmin Truta. - * For conditions of distribution and use, see copyright notice in readme.txt - *) - -program example; - -{$DEFINE TEST_COMPRESS} -{DO NOT $DEFINE TEST_GZIO} -{$DEFINE TEST_DEFLATE} -{$DEFINE TEST_INFLATE} -{$DEFINE TEST_FLUSH} -{$DEFINE TEST_SYNC} -{$DEFINE TEST_DICT} - -uses SysUtils, zlibpas; - -const TESTFILE = 'foo.gz'; - -(* "hello world" would be more standard, but the repeated "hello" - * stresses the compression code better, sorry... - *) -const hello: PChar = 'hello, hello!'; - -const dictionary: PChar = 'hello'; - -var dictId: LongInt; (* Adler32 value of the dictionary *) - -procedure CHECK_ERR(err: Integer; msg: String); -begin - if err <> Z_OK then - begin - WriteLn(msg, ' error: ', err); - Halt(1); - end; -end; - -procedure EXIT_ERR(const msg: String); -begin - WriteLn('Error: ', msg); - Halt(1); -end; - -(* =========================================================================== - * Test compress and uncompress - *) -{$IFDEF TEST_COMPRESS} -procedure test_compress(compr: Pointer; comprLen: LongInt; - uncompr: Pointer; uncomprLen: LongInt); -var err: Integer; - len: LongInt; -begin - len := StrLen(hello)+1; - - err := compress(compr, comprLen, hello, len); - CHECK_ERR(err, 'compress'); - - StrCopy(PChar(uncompr), 'garbage'); - - err := uncompress(uncompr, uncomprLen, compr, comprLen); - CHECK_ERR(err, 'uncompress'); - - if StrComp(PChar(uncompr), hello) <> 0 then - EXIT_ERR('bad uncompress') - else - WriteLn('uncompress(): ', PChar(uncompr)); -end; -{$ENDIF} - -(* =========================================================================== - * Test read/write of .gz files - *) -{$IFDEF TEST_GZIO} -procedure test_gzio(const fname: PChar; (* compressed file name *) - uncompr: Pointer; - uncomprLen: LongInt); -var err: Integer; - len: Integer; - zfile: gzFile; - pos: LongInt; -begin - len := StrLen(hello)+1; - - zfile := gzopen(fname, 'wb'); - if zfile = NIL then - begin - WriteLn('gzopen error'); - Halt(1); - end; - gzputc(zfile, 'h'); - if gzputs(zfile, 'ello') <> 4 then - begin - WriteLn('gzputs err: ', gzerror(zfile, err)); - Halt(1); - end; - {$IFDEF GZ_FORMAT_STRING} - if gzprintf(zfile, ', %s!', 'hello') <> 8 then - begin - WriteLn('gzprintf err: ', gzerror(zfile, err)); - Halt(1); - end; - {$ELSE} - if gzputs(zfile, ', hello!') <> 8 then - begin - WriteLn('gzputs err: ', gzerror(zfile, err)); - Halt(1); - end; - {$ENDIF} - gzseek(zfile, 1, SEEK_CUR); (* add one zero byte *) - gzclose(zfile); - - zfile := gzopen(fname, 'rb'); - if zfile = NIL then - begin - WriteLn('gzopen error'); - Halt(1); - end; - - StrCopy(PChar(uncompr), 'garbage'); - - if gzread(zfile, uncompr, uncomprLen) <> len then - begin - WriteLn('gzread err: ', gzerror(zfile, err)); - Halt(1); - end; - if StrComp(PChar(uncompr), hello) <> 0 then - begin - WriteLn('bad gzread: ', PChar(uncompr)); - Halt(1); - end - else - WriteLn('gzread(): ', PChar(uncompr)); - - pos := gzseek(zfile, -8, SEEK_CUR); - if (pos <> 6) or (gztell(zfile) <> pos) then - begin - WriteLn('gzseek error, pos=', pos, ', gztell=', gztell(zfile)); - Halt(1); - end; - - if gzgetc(zfile) <> ' ' then - begin - WriteLn('gzgetc error'); - Halt(1); - end; - - if gzungetc(' ', zfile) <> ' ' then - begin - WriteLn('gzungetc error'); - Halt(1); - end; - - gzgets(zfile, PChar(uncompr), uncomprLen); - uncomprLen := StrLen(PChar(uncompr)); - if uncomprLen <> 7 then (* " hello!" *) - begin - WriteLn('gzgets err after gzseek: ', gzerror(zfile, err)); - Halt(1); - end; - if StrComp(PChar(uncompr), hello + 6) <> 0 then - begin - WriteLn('bad gzgets after gzseek'); - Halt(1); - end - else - WriteLn('gzgets() after gzseek: ', PChar(uncompr)); - - gzclose(zfile); -end; -{$ENDIF} - -(* =========================================================================== - * Test deflate with small buffers - *) -{$IFDEF TEST_DEFLATE} -procedure test_deflate(compr: Pointer; comprLen: LongInt); -var c_stream: z_stream; (* compression stream *) - err: Integer; - len: LongInt; -begin - len := StrLen(hello)+1; - - c_stream.zalloc := NIL; - c_stream.zfree := NIL; - c_stream.opaque := NIL; - - err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, 'deflateInit'); - - c_stream.next_in := hello; - c_stream.next_out := compr; - - while (c_stream.total_in <> len) and - (c_stream.total_out < comprLen) do - begin - c_stream.avail_out := 1; { force small buffers } - c_stream.avail_in := 1; - err := deflate(c_stream, Z_NO_FLUSH); - CHECK_ERR(err, 'deflate'); - end; - - (* Finish the stream, still forcing small buffers: *) - while TRUE do - begin - c_stream.avail_out := 1; - err := deflate(c_stream, Z_FINISH); - if err = Z_STREAM_END then - break; - CHECK_ERR(err, 'deflate'); - end; - - err := deflateEnd(c_stream); - CHECK_ERR(err, 'deflateEnd'); -end; -{$ENDIF} - -(* =========================================================================== - * Test inflate with small buffers - *) -{$IFDEF TEST_INFLATE} -procedure test_inflate(compr: Pointer; comprLen : LongInt; - uncompr: Pointer; uncomprLen : LongInt); -var err: Integer; - d_stream: z_stream; (* decompression stream *) -begin - StrCopy(PChar(uncompr), 'garbage'); - - d_stream.zalloc := NIL; - d_stream.zfree := NIL; - d_stream.opaque := NIL; - - d_stream.next_in := compr; - d_stream.avail_in := 0; - d_stream.next_out := uncompr; - - err := inflateInit(d_stream); - CHECK_ERR(err, 'inflateInit'); - - while (d_stream.total_out < uncomprLen) and - (d_stream.total_in < comprLen) do - begin - d_stream.avail_out := 1; (* force small buffers *) - d_stream.avail_in := 1; - err := inflate(d_stream, Z_NO_FLUSH); - if err = Z_STREAM_END then - break; - CHECK_ERR(err, 'inflate'); - end; - - err := inflateEnd(d_stream); - CHECK_ERR(err, 'inflateEnd'); - - if StrComp(PChar(uncompr), hello) <> 0 then - EXIT_ERR('bad inflate') - else - WriteLn('inflate(): ', PChar(uncompr)); -end; -{$ENDIF} - -(* =========================================================================== - * Test deflate with large buffers and dynamic change of compression level - *) -{$IFDEF TEST_DEFLATE} -procedure test_large_deflate(compr: Pointer; comprLen: LongInt; - uncompr: Pointer; uncomprLen: LongInt); -var c_stream: z_stream; (* compression stream *) - err: Integer; -begin - c_stream.zalloc := NIL; - c_stream.zfree := NIL; - c_stream.opaque := NIL; - - err := deflateInit(c_stream, Z_BEST_SPEED); - CHECK_ERR(err, 'deflateInit'); - - c_stream.next_out := compr; - c_stream.avail_out := Integer(comprLen); - - (* At this point, uncompr is still mostly zeroes, so it should compress - * very well: - *) - c_stream.next_in := uncompr; - c_stream.avail_in := Integer(uncomprLen); - err := deflate(c_stream, Z_NO_FLUSH); - CHECK_ERR(err, 'deflate'); - if c_stream.avail_in <> 0 then - EXIT_ERR('deflate not greedy'); - - (* Feed in already compressed data and switch to no compression: *) - deflateParams(c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); - c_stream.next_in := compr; - c_stream.avail_in := Integer(comprLen div 2); - err := deflate(c_stream, Z_NO_FLUSH); - CHECK_ERR(err, 'deflate'); - - (* Switch back to compressing mode: *) - deflateParams(c_stream, Z_BEST_COMPRESSION, Z_FILTERED); - c_stream.next_in := uncompr; - c_stream.avail_in := Integer(uncomprLen); - err := deflate(c_stream, Z_NO_FLUSH); - CHECK_ERR(err, 'deflate'); - - err := deflate(c_stream, Z_FINISH); - if err <> Z_STREAM_END then - EXIT_ERR('deflate should report Z_STREAM_END'); - - err := deflateEnd(c_stream); - CHECK_ERR(err, 'deflateEnd'); -end; -{$ENDIF} - -(* =========================================================================== - * Test inflate with large buffers - *) -{$IFDEF TEST_INFLATE} -procedure test_large_inflate(compr: Pointer; comprLen: LongInt; - uncompr: Pointer; uncomprLen: LongInt); -var err: Integer; - d_stream: z_stream; (* decompression stream *) -begin - StrCopy(PChar(uncompr), 'garbage'); - - d_stream.zalloc := NIL; - d_stream.zfree := NIL; - d_stream.opaque := NIL; - - d_stream.next_in := compr; - d_stream.avail_in := Integer(comprLen); - - err := inflateInit(d_stream); - CHECK_ERR(err, 'inflateInit'); - - while TRUE do - begin - d_stream.next_out := uncompr; (* discard the output *) - d_stream.avail_out := Integer(uncomprLen); - err := inflate(d_stream, Z_NO_FLUSH); - if err = Z_STREAM_END then - break; - CHECK_ERR(err, 'large inflate'); - end; - - err := inflateEnd(d_stream); - CHECK_ERR(err, 'inflateEnd'); - - if d_stream.total_out <> 2 * uncomprLen + comprLen div 2 then - begin - WriteLn('bad large inflate: ', d_stream.total_out); - Halt(1); - end - else - WriteLn('large_inflate(): OK'); -end; -{$ENDIF} - -(* =========================================================================== - * Test deflate with full flush - *) -{$IFDEF TEST_FLUSH} -procedure test_flush(compr: Pointer; var comprLen : LongInt); -var c_stream: z_stream; (* compression stream *) - err: Integer; - len: Integer; -begin - len := StrLen(hello)+1; - - c_stream.zalloc := NIL; - c_stream.zfree := NIL; - c_stream.opaque := NIL; - - err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, 'deflateInit'); - - c_stream.next_in := hello; - c_stream.next_out := compr; - c_stream.avail_in := 3; - c_stream.avail_out := Integer(comprLen); - err := deflate(c_stream, Z_FULL_FLUSH); - CHECK_ERR(err, 'deflate'); - - Inc(PByteArray(compr)^[3]); (* force an error in first compressed block *) - c_stream.avail_in := len - 3; - - err := deflate(c_stream, Z_FINISH); - if err <> Z_STREAM_END then - CHECK_ERR(err, 'deflate'); - - err := deflateEnd(c_stream); - CHECK_ERR(err, 'deflateEnd'); - - comprLen := c_stream.total_out; -end; -{$ENDIF} - -(* =========================================================================== - * Test inflateSync() - *) -{$IFDEF TEST_SYNC} -procedure test_sync(compr: Pointer; comprLen: LongInt; - uncompr: Pointer; uncomprLen : LongInt); -var err: Integer; - d_stream: z_stream; (* decompression stream *) -begin - StrCopy(PChar(uncompr), 'garbage'); - - d_stream.zalloc := NIL; - d_stream.zfree := NIL; - d_stream.opaque := NIL; - - d_stream.next_in := compr; - d_stream.avail_in := 2; (* just read the zlib header *) - - err := inflateInit(d_stream); - CHECK_ERR(err, 'inflateInit'); - - d_stream.next_out := uncompr; - d_stream.avail_out := Integer(uncomprLen); - - inflate(d_stream, Z_NO_FLUSH); - CHECK_ERR(err, 'inflate'); - - d_stream.avail_in := Integer(comprLen-2); (* read all compressed data *) - err := inflateSync(d_stream); (* but skip the damaged part *) - CHECK_ERR(err, 'inflateSync'); - - err := inflate(d_stream, Z_FINISH); - if err <> Z_DATA_ERROR then - EXIT_ERR('inflate should report DATA_ERROR'); - (* Because of incorrect adler32 *) - - err := inflateEnd(d_stream); - CHECK_ERR(err, 'inflateEnd'); - - WriteLn('after inflateSync(): hel', PChar(uncompr)); -end; -{$ENDIF} - -(* =========================================================================== - * Test deflate with preset dictionary - *) -{$IFDEF TEST_DICT} -procedure test_dict_deflate(compr: Pointer; comprLen: LongInt); -var c_stream: z_stream; (* compression stream *) - err: Integer; -begin - c_stream.zalloc := NIL; - c_stream.zfree := NIL; - c_stream.opaque := NIL; - - err := deflateInit(c_stream, Z_BEST_COMPRESSION); - CHECK_ERR(err, 'deflateInit'); - - err := deflateSetDictionary(c_stream, dictionary, StrLen(dictionary)); - CHECK_ERR(err, 'deflateSetDictionary'); - - dictId := c_stream.adler; - c_stream.next_out := compr; - c_stream.avail_out := Integer(comprLen); - - c_stream.next_in := hello; - c_stream.avail_in := StrLen(hello)+1; - - err := deflate(c_stream, Z_FINISH); - if err <> Z_STREAM_END then - EXIT_ERR('deflate should report Z_STREAM_END'); - - err := deflateEnd(c_stream); - CHECK_ERR(err, 'deflateEnd'); -end; -{$ENDIF} - -(* =========================================================================== - * Test inflate with a preset dictionary - *) -{$IFDEF TEST_DICT} -procedure test_dict_inflate(compr: Pointer; comprLen: LongInt; - uncompr: Pointer; uncomprLen: LongInt); -var err: Integer; - d_stream: z_stream; (* decompression stream *) -begin - StrCopy(PChar(uncompr), 'garbage'); - - d_stream.zalloc := NIL; - d_stream.zfree := NIL; - d_stream.opaque := NIL; - - d_stream.next_in := compr; - d_stream.avail_in := Integer(comprLen); - - err := inflateInit(d_stream); - CHECK_ERR(err, 'inflateInit'); - - d_stream.next_out := uncompr; - d_stream.avail_out := Integer(uncomprLen); - - while TRUE do - begin - err := inflate(d_stream, Z_NO_FLUSH); - if err = Z_STREAM_END then - break; - if err = Z_NEED_DICT then - begin - if d_stream.adler <> dictId then - EXIT_ERR('unexpected dictionary'); - err := inflateSetDictionary(d_stream, dictionary, StrLen(dictionary)); - end; - CHECK_ERR(err, 'inflate with dict'); - end; - - err := inflateEnd(d_stream); - CHECK_ERR(err, 'inflateEnd'); - - if StrComp(PChar(uncompr), hello) <> 0 then - EXIT_ERR('bad inflate with dict') - else - WriteLn('inflate with dictionary: ', PChar(uncompr)); -end; -{$ENDIF} - -var compr, uncompr: Pointer; - comprLen, uncomprLen: LongInt; - -begin - if zlibVersion^ <> ZLIB_VERSION[1] then - EXIT_ERR('Incompatible zlib version'); - - WriteLn('zlib version: ', zlibVersion); - WriteLn('zlib compile flags: ', Format('0x%x', [zlibCompileFlags])); - - comprLen := 10000 * SizeOf(Integer); (* don't overflow on MSDOS *) - uncomprLen := comprLen; - GetMem(compr, comprLen); - GetMem(uncompr, uncomprLen); - if (compr = NIL) or (uncompr = NIL) then - EXIT_ERR('Out of memory'); - (* compr and uncompr are cleared to avoid reading uninitialized - * data and to ensure that uncompr compresses well. - *) - FillChar(compr^, comprLen, 0); - FillChar(uncompr^, uncomprLen, 0); - - {$IFDEF TEST_COMPRESS} - WriteLn('** Testing compress'); - test_compress(compr, comprLen, uncompr, uncomprLen); - {$ENDIF} - - {$IFDEF TEST_GZIO} - WriteLn('** Testing gzio'); - if ParamCount >= 1 then - test_gzio(ParamStr(1), uncompr, uncomprLen) - else - test_gzio(TESTFILE, uncompr, uncomprLen); - {$ENDIF} - - {$IFDEF TEST_DEFLATE} - WriteLn('** Testing deflate with small buffers'); - test_deflate(compr, comprLen); - {$ENDIF} - {$IFDEF TEST_INFLATE} - WriteLn('** Testing inflate with small buffers'); - test_inflate(compr, comprLen, uncompr, uncomprLen); - {$ENDIF} - - {$IFDEF TEST_DEFLATE} - WriteLn('** Testing deflate with large buffers'); - test_large_deflate(compr, comprLen, uncompr, uncomprLen); - {$ENDIF} - {$IFDEF TEST_INFLATE} - WriteLn('** Testing inflate with large buffers'); - test_large_inflate(compr, comprLen, uncompr, uncomprLen); - {$ENDIF} - - {$IFDEF TEST_FLUSH} - WriteLn('** Testing deflate with full flush'); - test_flush(compr, comprLen); - {$ENDIF} - {$IFDEF TEST_SYNC} - WriteLn('** Testing inflateSync'); - test_sync(compr, comprLen, uncompr, uncomprLen); - {$ENDIF} - comprLen := uncomprLen; - - {$IFDEF TEST_DICT} - WriteLn('** Testing deflate and inflate with preset dictionary'); - test_dict_deflate(compr, comprLen); - test_dict_inflate(compr, comprLen, uncompr, uncomprLen); - {$ENDIF} - - FreeMem(compr, comprLen); - FreeMem(uncompr, uncomprLen); -end. diff --git a/compat/zlib/contrib/pascal/readme.txt b/compat/zlib/contrib/pascal/readme.txt deleted file mode 100644 index 60e87c8..0000000 --- a/compat/zlib/contrib/pascal/readme.txt +++ /dev/null @@ -1,76 +0,0 @@ - -This directory contains a Pascal (Delphi, Kylix) interface to the -zlib data compression library. - - -Directory listing -================= - -zlibd32.mak makefile for Borland C++ -example.pas usage example of zlib -zlibpas.pas the Pascal interface to zlib -readme.txt this file - - -Compatibility notes -=================== - -- Although the name "zlib" would have been more normal for the - zlibpas unit, this name is already taken by Borland's ZLib unit. - This is somehow unfortunate, because that unit is not a genuine - interface to the full-fledged zlib functionality, but a suite of - class wrappers around zlib streams. Other essential features, - such as checksums, are missing. - It would have been more appropriate for that unit to have a name - like "ZStreams", or something similar. - -- The C and zlib-supplied types int, uInt, long, uLong, etc. are - translated directly into Pascal types of similar sizes (Integer, - LongInt, etc.), to avoid namespace pollution. In particular, - there is no conversion of unsigned int into a Pascal unsigned - integer. The Word type is non-portable and has the same size - (16 bits) both in a 16-bit and in a 32-bit environment, unlike - Integer. Even if there is a 32-bit Cardinal type, there is no - real need for unsigned int in zlib under a 32-bit environment. - -- Except for the callbacks, the zlib function interfaces are - assuming the calling convention normally used in Pascal - (__pascal for DOS and Windows16, __fastcall for Windows32). - Since the cdecl keyword is used, the old Turbo Pascal does - not work with this interface. - -- The gz* function interfaces are not translated, to avoid - interfacing problems with the C runtime library. Besides, - gzprintf(gzFile file, const char *format, ...) - cannot be translated into Pascal. - - -Legal issues -============ - -The zlibpas interface is: - Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler. - Copyright (C) 1998 by Bob Dellaca. - Copyright (C) 2003 by Cosmin Truta. - -The example program is: - Copyright (C) 1995-2003 by Jean-loup Gailly. - Copyright (C) 1998,1999,2000 by Jacques Nomssi Nzali. - Copyright (C) 2003 by Cosmin Truta. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the author be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - diff --git a/compat/zlib/contrib/pascal/zlibd32.mak b/compat/zlib/contrib/pascal/zlibd32.mak deleted file mode 100644 index 9bb00b7..0000000 --- a/compat/zlib/contrib/pascal/zlibd32.mak +++ /dev/null @@ -1,99 +0,0 @@ -# Makefile for zlib -# For use with Delphi and C++ Builder under Win32 -# Updated for zlib 1.2.x by Cosmin Truta - -# ------------ Borland C++ ------------ - -# This project uses the Delphi (fastcall/register) calling convention: -LOC = -DZEXPORT=__fastcall -DZEXPORTVA=__cdecl - -CC = bcc32 -LD = bcc32 -AR = tlib -# do not use "-pr" in CFLAGS -CFLAGS = -a -d -k- -O2 $(LOC) -LDFLAGS = - - -# variables -ZLIB_LIB = zlib.lib - -OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj -OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj -OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj -OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj - - -# targets -all: $(ZLIB_LIB) example.exe minigzip.exe - -.c.obj: - $(CC) -c $(CFLAGS) $*.c - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h - -gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h - -gzread.obj: gzread.c zlib.h zconf.h gzguts.h - -gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: test/example.c zlib.h zconf.h - -minigzip.obj: test/minigzip.c zlib.h zconf.h - - -# For the sake of the old Borland make, -# the command line is cut to fit in the MS-DOS 128 byte limit: -$(ZLIB_LIB): $(OBJ1) $(OBJ2) - -del $(ZLIB_LIB) - $(AR) $(ZLIB_LIB) $(OBJP1) - $(AR) $(ZLIB_LIB) $(OBJP2) - - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -example.exe: example.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) - -minigzip.exe: minigzip.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) - - -# cleanup -clean: - -del *.obj - -del *.exe - -del *.lib - -del *.tds - -del zlib.bak - -del foo.gz - diff --git a/compat/zlib/contrib/pascal/zlibpas.pas b/compat/zlib/contrib/pascal/zlibpas.pas deleted file mode 100644 index a0dff11..0000000 --- a/compat/zlib/contrib/pascal/zlibpas.pas +++ /dev/null @@ -1,276 +0,0 @@ -(* zlibpas -- Pascal interface to the zlib data compression library - * - * Copyright (C) 2003 Cosmin Truta. - * Derived from original sources by Bob Dellaca. - * For conditions of distribution and use, see copyright notice in readme.txt - *) - -unit zlibpas; - -interface - -const - ZLIB_VERSION = '1.2.11'; - ZLIB_VERNUM = $12a0; - -type - alloc_func = function(opaque: Pointer; items, size: Integer): Pointer; - cdecl; - free_func = procedure(opaque, address: Pointer); - cdecl; - - in_func = function(opaque: Pointer; var buf: PByte): Integer; - cdecl; - out_func = function(opaque: Pointer; buf: PByte; size: Integer): Integer; - cdecl; - - z_streamp = ^z_stream; - z_stream = packed record - next_in: PChar; (* next input byte *) - avail_in: Integer; (* number of bytes available at next_in *) - total_in: LongInt; (* total nb of input bytes read so far *) - - next_out: PChar; (* next output byte should be put there *) - avail_out: Integer; (* remaining free space at next_out *) - total_out: LongInt; (* total nb of bytes output so far *) - - msg: PChar; (* last error message, NULL if no error *) - state: Pointer; (* not visible by applications *) - - zalloc: alloc_func; (* used to allocate the internal state *) - zfree: free_func; (* used to free the internal state *) - opaque: Pointer; (* private data object passed to zalloc and zfree *) - - data_type: Integer; (* best guess about the data type: ascii or binary *) - adler: LongInt; (* adler32 value of the uncompressed data *) - reserved: LongInt; (* reserved for future use *) - end; - - gz_headerp = ^gz_header; - gz_header = packed record - text: Integer; (* true if compressed data believed to be text *) - time: LongInt; (* modification time *) - xflags: Integer; (* extra flags (not used when writing a gzip file) *) - os: Integer; (* operating system *) - extra: PChar; (* pointer to extra field or Z_NULL if none *) - extra_len: Integer; (* extra field length (valid if extra != Z_NULL) *) - extra_max: Integer; (* space at extra (only when reading header) *) - name: PChar; (* pointer to zero-terminated file name or Z_NULL *) - name_max: Integer; (* space at name (only when reading header) *) - comment: PChar; (* pointer to zero-terminated comment or Z_NULL *) - comm_max: Integer; (* space at comment (only when reading header) *) - hcrc: Integer; (* true if there was or will be a header crc *) - done: Integer; (* true when done reading gzip header *) - end; - -(* constants *) -const - Z_NO_FLUSH = 0; - Z_PARTIAL_FLUSH = 1; - Z_SYNC_FLUSH = 2; - Z_FULL_FLUSH = 3; - Z_FINISH = 4; - Z_BLOCK = 5; - Z_TREES = 6; - - Z_OK = 0; - Z_STREAM_END = 1; - Z_NEED_DICT = 2; - Z_ERRNO = -1; - Z_STREAM_ERROR = -2; - Z_DATA_ERROR = -3; - Z_MEM_ERROR = -4; - Z_BUF_ERROR = -5; - Z_VERSION_ERROR = -6; - - Z_NO_COMPRESSION = 0; - Z_BEST_SPEED = 1; - Z_BEST_COMPRESSION = 9; - Z_DEFAULT_COMPRESSION = -1; - - Z_FILTERED = 1; - Z_HUFFMAN_ONLY = 2; - Z_RLE = 3; - Z_FIXED = 4; - Z_DEFAULT_STRATEGY = 0; - - Z_BINARY = 0; - Z_TEXT = 1; - Z_ASCII = 1; - Z_UNKNOWN = 2; - - Z_DEFLATED = 8; - -(* basic functions *) -function zlibVersion: PChar; -function deflateInit(var strm: z_stream; level: Integer): Integer; -function deflate(var strm: z_stream; flush: Integer): Integer; -function deflateEnd(var strm: z_stream): Integer; -function inflateInit(var strm: z_stream): Integer; -function inflate(var strm: z_stream; flush: Integer): Integer; -function inflateEnd(var strm: z_stream): Integer; - -(* advanced functions *) -function deflateInit2(var strm: z_stream; level, method, windowBits, - memLevel, strategy: Integer): Integer; -function deflateSetDictionary(var strm: z_stream; const dictionary: PChar; - dictLength: Integer): Integer; -function deflateCopy(var dest, source: z_stream): Integer; -function deflateReset(var strm: z_stream): Integer; -function deflateParams(var strm: z_stream; level, strategy: Integer): Integer; -function deflateTune(var strm: z_stream; good_length, max_lazy, nice_length, max_chain: Integer): Integer; -function deflateBound(var strm: z_stream; sourceLen: LongInt): LongInt; -function deflatePending(var strm: z_stream; var pending: Integer; var bits: Integer): Integer; -function deflatePrime(var strm: z_stream; bits, value: Integer): Integer; -function deflateSetHeader(var strm: z_stream; head: gz_header): Integer; -function inflateInit2(var strm: z_stream; windowBits: Integer): Integer; -function inflateSetDictionary(var strm: z_stream; const dictionary: PChar; - dictLength: Integer): Integer; -function inflateSync(var strm: z_stream): Integer; -function inflateCopy(var dest, source: z_stream): Integer; -function inflateReset(var strm: z_stream): Integer; -function inflateReset2(var strm: z_stream; windowBits: Integer): Integer; -function inflatePrime(var strm: z_stream; bits, value: Integer): Integer; -function inflateMark(var strm: z_stream): LongInt; -function inflateGetHeader(var strm: z_stream; var head: gz_header): Integer; -function inflateBackInit(var strm: z_stream; - windowBits: Integer; window: PChar): Integer; -function inflateBack(var strm: z_stream; in_fn: in_func; in_desc: Pointer; - out_fn: out_func; out_desc: Pointer): Integer; -function inflateBackEnd(var strm: z_stream): Integer; -function zlibCompileFlags: LongInt; - -(* utility functions *) -function compress(dest: PChar; var destLen: LongInt; - const source: PChar; sourceLen: LongInt): Integer; -function compress2(dest: PChar; var destLen: LongInt; - const source: PChar; sourceLen: LongInt; - level: Integer): Integer; -function compressBound(sourceLen: LongInt): LongInt; -function uncompress(dest: PChar; var destLen: LongInt; - const source: PChar; sourceLen: LongInt): Integer; - -(* checksum functions *) -function adler32(adler: LongInt; const buf: PChar; len: Integer): LongInt; -function adler32_combine(adler1, adler2, len2: LongInt): LongInt; -function crc32(crc: LongInt; const buf: PChar; len: Integer): LongInt; -function crc32_combine(crc1, crc2, len2: LongInt): LongInt; - -(* various hacks, don't look :) *) -function deflateInit_(var strm: z_stream; level: Integer; - const version: PChar; stream_size: Integer): Integer; -function inflateInit_(var strm: z_stream; const version: PChar; - stream_size: Integer): Integer; -function deflateInit2_(var strm: z_stream; - level, method, windowBits, memLevel, strategy: Integer; - const version: PChar; stream_size: Integer): Integer; -function inflateInit2_(var strm: z_stream; windowBits: Integer; - const version: PChar; stream_size: Integer): Integer; -function inflateBackInit_(var strm: z_stream; - windowBits: Integer; window: PChar; - const version: PChar; stream_size: Integer): Integer; - - -implementation - -{$L adler32.obj} -{$L compress.obj} -{$L crc32.obj} -{$L deflate.obj} -{$L infback.obj} -{$L inffast.obj} -{$L inflate.obj} -{$L inftrees.obj} -{$L trees.obj} -{$L uncompr.obj} -{$L zutil.obj} - -function adler32; external; -function adler32_combine; external; -function compress; external; -function compress2; external; -function compressBound; external; -function crc32; external; -function crc32_combine; external; -function deflate; external; -function deflateBound; external; -function deflateCopy; external; -function deflateEnd; external; -function deflateInit_; external; -function deflateInit2_; external; -function deflateParams; external; -function deflatePending; external; -function deflatePrime; external; -function deflateReset; external; -function deflateSetDictionary; external; -function deflateSetHeader; external; -function deflateTune; external; -function inflate; external; -function inflateBack; external; -function inflateBackEnd; external; -function inflateBackInit_; external; -function inflateCopy; external; -function inflateEnd; external; -function inflateGetHeader; external; -function inflateInit_; external; -function inflateInit2_; external; -function inflateMark; external; -function inflatePrime; external; -function inflateReset; external; -function inflateReset2; external; -function inflateSetDictionary; external; -function inflateSync; external; -function uncompress; external; -function zlibCompileFlags; external; -function zlibVersion; external; - -function deflateInit(var strm: z_stream; level: Integer): Integer; -begin - Result := deflateInit_(strm, level, ZLIB_VERSION, sizeof(z_stream)); -end; - -function deflateInit2(var strm: z_stream; level, method, windowBits, memLevel, - strategy: Integer): Integer; -begin - Result := deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - ZLIB_VERSION, sizeof(z_stream)); -end; - -function inflateInit(var strm: z_stream): Integer; -begin - Result := inflateInit_(strm, ZLIB_VERSION, sizeof(z_stream)); -end; - -function inflateInit2(var strm: z_stream; windowBits: Integer): Integer; -begin - Result := inflateInit2_(strm, windowBits, ZLIB_VERSION, sizeof(z_stream)); -end; - -function inflateBackInit(var strm: z_stream; - windowBits: Integer; window: PChar): Integer; -begin - Result := inflateBackInit_(strm, windowBits, window, - ZLIB_VERSION, sizeof(z_stream)); -end; - -function _malloc(Size: Integer): Pointer; cdecl; -begin - GetMem(Result, Size); -end; - -procedure _free(Block: Pointer); cdecl; -begin - FreeMem(Block); -end; - -procedure _memset(P: Pointer; B: Byte; count: Integer); cdecl; -begin - FillChar(P^, count, B); -end; - -procedure _memcpy(dest, source: Pointer; count: Integer); cdecl; -begin - Move(source^, dest^, count); -end; - -end. diff --git a/compat/zlib/contrib/puff/Makefile b/compat/zlib/contrib/puff/Makefile deleted file mode 100644 index 0e2594c..0000000 --- a/compat/zlib/contrib/puff/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -CFLAGS=-O - -puff: puff.o pufftest.o - -puff.o: puff.h - -pufftest.o: puff.h - -test: puff - puff zeros.raw - -puft: puff.c puff.h pufftest.o - cc -fprofile-arcs -ftest-coverage -o puft puff.c pufftest.o - -# puff full coverage test (should say 100%) -cov: puft - @rm -f *.gcov *.gcda - @puft -w zeros.raw 2>&1 | cat > /dev/null - @echo '04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2 - @echo '00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2 - @echo '00 00 00 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 254 - @echo '00 01 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2 - @echo '01 01 00 fe ff 0a' | xxd -r -p | puft -f 2>&1 | cat > /dev/null - @echo '02 7e ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246 - @echo '02' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2 - @echo '04 80 49 92 24 49 92 24 0f b4 ff ff c3 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2 - @echo '04 80 49 92 24 49 92 24 71 ff ff 93 11 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 249 - @echo '04 c0 81 08 00 00 00 00 20 7f eb 0b 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246 - @echo '0b 00 00' | xxd -r -p | puft -f 2>&1 | cat > /dev/null - @echo '1a 07' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246 - @echo '0c c0 81 00 00 00 00 00 90 ff 6b 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 245 - @puft -f zeros.raw 2>&1 | cat > /dev/null - @echo 'fc 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 253 - @echo '04 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 252 - @echo '04 00 24 49' | xxd -r -p | puft 2> /dev/null || test $$? -eq 251 - @echo '04 80 49 92 24 49 92 24 0f b4 ff ff c3 84' | xxd -r -p | puft 2> /dev/null || test $$? -eq 248 - @echo '04 00 24 e9 ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 250 - @echo '04 00 24 e9 ff 6d' | xxd -r -p | puft 2> /dev/null || test $$? -eq 247 - @gcov -n puff.c - -clean: - rm -f puff puft *.o *.gc* diff --git a/compat/zlib/contrib/puff/README b/compat/zlib/contrib/puff/README deleted file mode 100644 index bbc4cb5..0000000 --- a/compat/zlib/contrib/puff/README +++ /dev/null @@ -1,63 +0,0 @@ -Puff -- A Simple Inflate -3 Mar 2003 -Mark Adler -madler@alumni.caltech.edu - -What this is -- - -puff.c provides the routine puff() to decompress the deflate data format. It -does so more slowly than zlib, but the code is about one-fifth the size of the -inflate code in zlib, and written to be very easy to read. - -Why I wrote this -- - -puff.c was written to document the deflate format unambiguously, by virtue of -being working C code. It is meant to supplement RFC 1951, which formally -describes the deflate format. I have received many questions on details of the -deflate format, and I hope that reading this code will answer those questions. -puff.c is heavily commented with details of the deflate format, especially -those little nooks and cranies of the format that might not be obvious from a -specification. - -puff.c may also be useful in applications where code size or memory usage is a -very limited resource, and speed is not as important. - -How to use it -- - -Well, most likely you should just be reading puff.c and using zlib for actual -applications, but if you must ... - -Include puff.h in your code, which provides this prototype: - -int puff(unsigned char *dest, /* pointer to destination pointer */ - unsigned long *destlen, /* amount of output space */ - unsigned char *source, /* pointer to source data pointer */ - unsigned long *sourcelen); /* amount of input available */ - -Then you can call puff() to decompress a deflate stream that is in memory in -its entirety at source, to a sufficiently sized block of memory for the -decompressed data at dest. puff() is the only external symbol in puff.c The -only C library functions that puff.c needs are setjmp() and longjmp(), which -are used to simplify error checking in the code to improve readabilty. puff.c -does no memory allocation, and uses less than 2K bytes off of the stack. - -If destlen is not enough space for the uncompressed data, then inflate will -return an error without writing more than destlen bytes. Note that this means -that in order to decompress the deflate data successfully, you need to know -the size of the uncompressed data ahead of time. - -If needed, puff() can determine the size of the uncompressed data with no -output space. This is done by passing dest equal to (unsigned char *)0. Then -the initial value of *destlen is ignored and *destlen is set to the length of -the uncompressed data. So if the size of the uncompressed data is not known, -then two passes of puff() can be used--first to determine the size, and second -to do the actual inflation after allocating the appropriate memory. Not -pretty, but it works. (This is one of the reasons you should be using zlib.) - -The deflate format is self-terminating. If the deflate stream does not end -in *sourcelen bytes, puff() will return an error without reading at or past -endsource. - -On return, *sourcelen is updated to the amount of input data consumed, and -*destlen is updated to the size of the uncompressed data. See the comments -in puff.c for the possible return codes for puff(). diff --git a/compat/zlib/contrib/puff/puff.c b/compat/zlib/contrib/puff/puff.c deleted file mode 100644 index c6c90d7..0000000 --- a/compat/zlib/contrib/puff/puff.c +++ /dev/null @@ -1,840 +0,0 @@ -/* - * puff.c - * Copyright (C) 2002-2013 Mark Adler - * For conditions of distribution and use, see copyright notice in puff.h - * version 2.3, 21 Jan 2013 - * - * puff.c is a simple inflate written to be an unambiguous way to specify the - * deflate format. It is not written for speed but rather simplicity. As a - * side benefit, this code might actually be useful when small code is more - * important than speed, such as bootstrap applications. For typical deflate - * data, zlib's inflate() is about four times as fast as puff(). zlib's - * inflate compiles to around 20K on my machine, whereas puff.c compiles to - * around 4K on my machine (a PowerPC using GNU cc). If the faster decode() - * function here is used, then puff() is only twice as slow as zlib's - * inflate(). - * - * All dynamically allocated memory comes from the stack. The stack required - * is less than 2K bytes. This code is compatible with 16-bit int's and - * assumes that long's are at least 32 bits. puff.c uses the short data type, - * assumed to be 16 bits, for arrays in order to conserve memory. The code - * works whether integers are stored big endian or little endian. - * - * In the comments below are "Format notes" that describe the inflate process - * and document some of the less obvious aspects of the format. This source - * code is meant to supplement RFC 1951, which formally describes the deflate - * format: - * - * http://www.zlib.org/rfc-deflate.html - */ - -/* - * Change history: - * - * 1.0 10 Feb 2002 - First version - * 1.1 17 Feb 2002 - Clarifications of some comments and notes - * - Update puff() dest and source pointers on negative - * errors to facilitate debugging deflators - * - Remove longest from struct huffman -- not needed - * - Simplify offs[] index in construct() - * - Add input size and checking, using longjmp() to - * maintain easy readability - * - Use short data type for large arrays - * - Use pointers instead of long to specify source and - * destination sizes to avoid arbitrary 4 GB limits - * 1.2 17 Mar 2002 - Add faster version of decode(), doubles speed (!), - * but leave simple version for readabilty - * - Make sure invalid distances detected if pointers - * are 16 bits - * - Fix fixed codes table error - * - Provide a scanning mode for determining size of - * uncompressed data - * 1.3 20 Mar 2002 - Go back to lengths for puff() parameters [Gailly] - * - Add a puff.h file for the interface - * - Add braces in puff() for else do [Gailly] - * - Use indexes instead of pointers for readability - * 1.4 31 Mar 2002 - Simplify construct() code set check - * - Fix some comments - * - Add FIXLCODES #define - * 1.5 6 Apr 2002 - Minor comment fixes - * 1.6 7 Aug 2002 - Minor format changes - * 1.7 3 Mar 2003 - Added test code for distribution - * - Added zlib-like license - * 1.8 9 Jan 2004 - Added some comments on no distance codes case - * 1.9 21 Feb 2008 - Fix bug on 16-bit integer architectures [Pohland] - * - Catch missing end-of-block symbol error - * 2.0 25 Jul 2008 - Add #define to permit distance too far back - * - Add option in TEST code for puff to write the data - * - Add option in TEST code to skip input bytes - * - Allow TEST code to read from piped stdin - * 2.1 4 Apr 2010 - Avoid variable initialization for happier compilers - * - Avoid unsigned comparisons for even happier compilers - * 2.2 25 Apr 2010 - Fix bug in variable initializations [Oberhumer] - * - Add const where appropriate [Oberhumer] - * - Split if's and ?'s for coverage testing - * - Break out test code to separate file - * - Move NIL to puff.h - * - Allow incomplete code only if single code length is 1 - * - Add full code coverage test to Makefile - * 2.3 21 Jan 2013 - Check for invalid code length codes in dynamic blocks - */ - -#include /* for setjmp(), longjmp(), and jmp_buf */ -#include "puff.h" /* prototype for puff() */ - -#define local static /* for local function definitions */ - -/* - * Maximums for allocations and loops. It is not useful to change these -- - * they are fixed by the deflate format. - */ -#define MAXBITS 15 /* maximum bits in a code */ -#define MAXLCODES 286 /* maximum number of literal/length codes */ -#define MAXDCODES 30 /* maximum number of distance codes */ -#define MAXCODES (MAXLCODES+MAXDCODES) /* maximum codes lengths to read */ -#define FIXLCODES 288 /* number of fixed literal/length codes */ - -/* input and output state */ -struct state { - /* output state */ - unsigned char *out; /* output buffer */ - unsigned long outlen; /* available space at out */ - unsigned long outcnt; /* bytes written to out so far */ - - /* input state */ - const unsigned char *in; /* input buffer */ - unsigned long inlen; /* available input at in */ - unsigned long incnt; /* bytes read so far */ - int bitbuf; /* bit buffer */ - int bitcnt; /* number of bits in bit buffer */ - - /* input limit error return state for bits() and decode() */ - jmp_buf env; -}; - -/* - * Return need bits from the input stream. This always leaves less than - * eight bits in the buffer. bits() works properly for need == 0. - * - * Format notes: - * - * - Bits are stored in bytes from the least significant bit to the most - * significant bit. Therefore bits are dropped from the bottom of the bit - * buffer, using shift right, and new bytes are appended to the top of the - * bit buffer, using shift left. - */ -local int bits(struct state *s, int need) -{ - long val; /* bit accumulator (can use up to 20 bits) */ - - /* load at least need bits into val */ - val = s->bitbuf; - while (s->bitcnt < need) { - if (s->incnt == s->inlen) - longjmp(s->env, 1); /* out of input */ - val |= (long)(s->in[s->incnt++]) << s->bitcnt; /* load eight bits */ - s->bitcnt += 8; - } - - /* drop need bits and update buffer, always zero to seven bits left */ - s->bitbuf = (int)(val >> need); - s->bitcnt -= need; - - /* return need bits, zeroing the bits above that */ - return (int)(val & ((1L << need) - 1)); -} - -/* - * Process a stored block. - * - * Format notes: - * - * - After the two-bit stored block type (00), the stored block length and - * stored bytes are byte-aligned for fast copying. Therefore any leftover - * bits in the byte that has the last bit of the type, as many as seven, are - * discarded. The value of the discarded bits are not defined and should not - * be checked against any expectation. - * - * - The second inverted copy of the stored block length does not have to be - * checked, but it's probably a good idea to do so anyway. - * - * - A stored block can have zero length. This is sometimes used to byte-align - * subsets of the compressed data for random access or partial recovery. - */ -local int stored(struct state *s) -{ - unsigned len; /* length of stored block */ - - /* discard leftover bits from current byte (assumes s->bitcnt < 8) */ - s->bitbuf = 0; - s->bitcnt = 0; - - /* get length and check against its one's complement */ - if (s->incnt + 4 > s->inlen) - return 2; /* not enough input */ - len = s->in[s->incnt++]; - len |= s->in[s->incnt++] << 8; - if (s->in[s->incnt++] != (~len & 0xff) || - s->in[s->incnt++] != ((~len >> 8) & 0xff)) - return -2; /* didn't match complement! */ - - /* copy len bytes from in to out */ - if (s->incnt + len > s->inlen) - return 2; /* not enough input */ - if (s->out != NIL) { - if (s->outcnt + len > s->outlen) - return 1; /* not enough output space */ - while (len--) - s->out[s->outcnt++] = s->in[s->incnt++]; - } - else { /* just scanning */ - s->outcnt += len; - s->incnt += len; - } - - /* done with a valid stored block */ - return 0; -} - -/* - * Huffman code decoding tables. count[1..MAXBITS] is the number of symbols of - * each length, which for a canonical code are stepped through in order. - * symbol[] are the symbol values in canonical order, where the number of - * entries is the sum of the counts in count[]. The decoding process can be - * seen in the function decode() below. - */ -struct huffman { - short *count; /* number of symbols of each length */ - short *symbol; /* canonically ordered symbols */ -}; - -/* - * Decode a code from the stream s using huffman table h. Return the symbol or - * a negative value if there is an error. If all of the lengths are zero, i.e. - * an empty code, or if the code is incomplete and an invalid code is received, - * then -10 is returned after reading MAXBITS bits. - * - * Format notes: - * - * - The codes as stored in the compressed data are bit-reversed relative to - * a simple integer ordering of codes of the same lengths. Hence below the - * bits are pulled from the compressed data one at a time and used to - * build the code value reversed from what is in the stream in order to - * permit simple integer comparisons for decoding. A table-based decoding - * scheme (as used in zlib) does not need to do this reversal. - * - * - The first code for the shortest length is all zeros. Subsequent codes of - * the same length are simply integer increments of the previous code. When - * moving up a length, a zero bit is appended to the code. For a complete - * code, the last code of the longest length will be all ones. - * - * - Incomplete codes are handled by this decoder, since they are permitted - * in the deflate format. See the format notes for fixed() and dynamic(). - */ -#ifdef SLOW -local int decode(struct state *s, const struct huffman *h) -{ - int len; /* current number of bits in code */ - int code; /* len bits being decoded */ - int first; /* first code of length len */ - int count; /* number of codes of length len */ - int index; /* index of first code of length len in symbol table */ - - code = first = index = 0; - for (len = 1; len <= MAXBITS; len++) { - code |= bits(s, 1); /* get next bit */ - count = h->count[len]; - if (code - count < first) /* if length len, return symbol */ - return h->symbol[index + (code - first)]; - index += count; /* else update for next length */ - first += count; - first <<= 1; - code <<= 1; - } - return -10; /* ran out of codes */ -} - -/* - * A faster version of decode() for real applications of this code. It's not - * as readable, but it makes puff() twice as fast. And it only makes the code - * a few percent larger. - */ -#else /* !SLOW */ -local int decode(struct state *s, const struct huffman *h) -{ - int len; /* current number of bits in code */ - int code; /* len bits being decoded */ - int first; /* first code of length len */ - int count; /* number of codes of length len */ - int index; /* index of first code of length len in symbol table */ - int bitbuf; /* bits from stream */ - int left; /* bits left in next or left to process */ - short *next; /* next number of codes */ - - bitbuf = s->bitbuf; - left = s->bitcnt; - code = first = index = 0; - len = 1; - next = h->count + 1; - while (1) { - while (left--) { - code |= bitbuf & 1; - bitbuf >>= 1; - count = *next++; - if (code - count < first) { /* if length len, return symbol */ - s->bitbuf = bitbuf; - s->bitcnt = (s->bitcnt - len) & 7; - return h->symbol[index + (code - first)]; - } - index += count; /* else update for next length */ - first += count; - first <<= 1; - code <<= 1; - len++; - } - left = (MAXBITS+1) - len; - if (left == 0) - break; - if (s->incnt == s->inlen) - longjmp(s->env, 1); /* out of input */ - bitbuf = s->in[s->incnt++]; - if (left > 8) - left = 8; - } - return -10; /* ran out of codes */ -} -#endif /* SLOW */ - -/* - * Given the list of code lengths length[0..n-1] representing a canonical - * Huffman code for n symbols, construct the tables required to decode those - * codes. Those tables are the number of codes of each length, and the symbols - * sorted by length, retaining their original order within each length. The - * return value is zero for a complete code set, negative for an over- - * subscribed code set, and positive for an incomplete code set. The tables - * can be used if the return value is zero or positive, but they cannot be used - * if the return value is negative. If the return value is zero, it is not - * possible for decode() using that table to return an error--any stream of - * enough bits will resolve to a symbol. If the return value is positive, then - * it is possible for decode() using that table to return an error for received - * codes past the end of the incomplete lengths. - * - * Not used by decode(), but used for error checking, h->count[0] is the number - * of the n symbols not in the code. So n - h->count[0] is the number of - * codes. This is useful for checking for incomplete codes that have more than - * one symbol, which is an error in a dynamic block. - * - * Assumption: for all i in 0..n-1, 0 <= length[i] <= MAXBITS - * This is assured by the construction of the length arrays in dynamic() and - * fixed() and is not verified by construct(). - * - * Format notes: - * - * - Permitted and expected examples of incomplete codes are one of the fixed - * codes and any code with a single symbol which in deflate is coded as one - * bit instead of zero bits. See the format notes for fixed() and dynamic(). - * - * - Within a given code length, the symbols are kept in ascending order for - * the code bits definition. - */ -local int construct(struct huffman *h, const short *length, int n) -{ - int symbol; /* current symbol when stepping through length[] */ - int len; /* current length when stepping through h->count[] */ - int left; /* number of possible codes left of current length */ - short offs[MAXBITS+1]; /* offsets in symbol table for each length */ - - /* count number of codes of each length */ - for (len = 0; len <= MAXBITS; len++) - h->count[len] = 0; - for (symbol = 0; symbol < n; symbol++) - (h->count[length[symbol]])++; /* assumes lengths are within bounds */ - if (h->count[0] == n) /* no codes! */ - return 0; /* complete, but decode() will fail */ - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; /* one possible code of zero length */ - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; /* one more bit, double codes left */ - left -= h->count[len]; /* deduct count from possible codes */ - if (left < 0) - return left; /* over-subscribed--return negative */ - } /* left > 0 means incomplete */ - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) - offs[len + 1] = offs[len] + h->count[len]; - - /* - * put symbols in table sorted by length, by symbol order within each - * length - */ - for (symbol = 0; symbol < n; symbol++) - if (length[symbol] != 0) - h->symbol[offs[length[symbol]]++] = symbol; - - /* return zero for complete set, positive for incomplete set */ - return left; -} - -/* - * Decode literal/length and distance codes until an end-of-block code. - * - * Format notes: - * - * - Compressed data that is after the block type if fixed or after the code - * description if dynamic is a combination of literals and length/distance - * pairs terminated by and end-of-block code. Literals are simply Huffman - * coded bytes. A length/distance pair is a coded length followed by a - * coded distance to represent a string that occurs earlier in the - * uncompressed data that occurs again at the current location. - * - * - Literals, lengths, and the end-of-block code are combined into a single - * code of up to 286 symbols. They are 256 literals (0..255), 29 length - * symbols (257..285), and the end-of-block symbol (256). - * - * - There are 256 possible lengths (3..258), and so 29 symbols are not enough - * to represent all of those. Lengths 3..10 and 258 are in fact represented - * by just a length symbol. Lengths 11..257 are represented as a symbol and - * some number of extra bits that are added as an integer to the base length - * of the length symbol. The number of extra bits is determined by the base - * length symbol. These are in the static arrays below, lens[] for the base - * lengths and lext[] for the corresponding number of extra bits. - * - * - The reason that 258 gets its own symbol is that the longest length is used - * often in highly redundant files. Note that 258 can also be coded as the - * base value 227 plus the maximum extra value of 31. While a good deflate - * should never do this, it is not an error, and should be decoded properly. - * - * - If a length is decoded, including its extra bits if any, then it is - * followed a distance code. There are up to 30 distance symbols. Again - * there are many more possible distances (1..32768), so extra bits are added - * to a base value represented by the symbol. The distances 1..4 get their - * own symbol, but the rest require extra bits. The base distances and - * corresponding number of extra bits are below in the static arrays dist[] - * and dext[]. - * - * - Literal bytes are simply written to the output. A length/distance pair is - * an instruction to copy previously uncompressed bytes to the output. The - * copy is from distance bytes back in the output stream, copying for length - * bytes. - * - * - Distances pointing before the beginning of the output data are not - * permitted. - * - * - Overlapped copies, where the length is greater than the distance, are - * allowed and common. For example, a distance of one and a length of 258 - * simply copies the last byte 258 times. A distance of four and a length of - * twelve copies the last four bytes three times. A simple forward copy - * ignoring whether the length is greater than the distance or not implements - * this correctly. You should not use memcpy() since its behavior is not - * defined for overlapped arrays. You should not use memmove() or bcopy() - * since though their behavior -is- defined for overlapping arrays, it is - * defined to do the wrong thing in this case. - */ -local int codes(struct state *s, - const struct huffman *lencode, - const struct huffman *distcode) -{ - int symbol; /* decoded symbol */ - int len; /* length for copy */ - unsigned dist; /* distance for copy */ - static const short lens[29] = { /* Size base for length codes 257..285 */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258}; - static const short lext[29] = { /* Extra bits for length codes 257..285 */ - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, - 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0}; - static const short dists[30] = { /* Offset base for distance codes 0..29 */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577}; - static const short dext[30] = { /* Extra bits for distance codes 0..29 */ - 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, - 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, - 12, 12, 13, 13}; - - /* decode literals and length/distance pairs */ - do { - symbol = decode(s, lencode); - if (symbol < 0) - return symbol; /* invalid symbol */ - if (symbol < 256) { /* literal: symbol is the byte */ - /* write out the literal */ - if (s->out != NIL) { - if (s->outcnt == s->outlen) - return 1; - s->out[s->outcnt] = symbol; - } - s->outcnt++; - } - else if (symbol > 256) { /* length */ - /* get and compute length */ - symbol -= 257; - if (symbol >= 29) - return -10; /* invalid fixed code */ - len = lens[symbol] + bits(s, lext[symbol]); - - /* get and check distance */ - symbol = decode(s, distcode); - if (symbol < 0) - return symbol; /* invalid symbol */ - dist = dists[symbol] + bits(s, dext[symbol]); -#ifndef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - if (dist > s->outcnt) - return -11; /* distance too far back */ -#endif - - /* copy length bytes from distance bytes back */ - if (s->out != NIL) { - if (s->outcnt + len > s->outlen) - return 1; - while (len--) { - s->out[s->outcnt] = -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - dist > s->outcnt ? - 0 : -#endif - s->out[s->outcnt - dist]; - s->outcnt++; - } - } - else - s->outcnt += len; - } - } while (symbol != 256); /* end of block symbol */ - - /* done with a valid fixed or dynamic block */ - return 0; -} - -/* - * Process a fixed codes block. - * - * Format notes: - * - * - This block type can be useful for compressing small amounts of data for - * which the size of the code descriptions in a dynamic block exceeds the - * benefit of custom codes for that block. For fixed codes, no bits are - * spent on code descriptions. Instead the code lengths for literal/length - * codes and distance codes are fixed. The specific lengths for each symbol - * can be seen in the "for" loops below. - * - * - The literal/length code is complete, but has two symbols that are invalid - * and should result in an error if received. This cannot be implemented - * simply as an incomplete code since those two symbols are in the "middle" - * of the code. They are eight bits long and the longest literal/length\ - * code is nine bits. Therefore the code must be constructed with those - * symbols, and the invalid symbols must be detected after decoding. - * - * - The fixed distance codes also have two invalid symbols that should result - * in an error if received. Since all of the distance codes are the same - * length, this can be implemented as an incomplete code. Then the invalid - * codes are detected while decoding. - */ -local int fixed(struct state *s) -{ - static int virgin = 1; - static short lencnt[MAXBITS+1], lensym[FIXLCODES]; - static short distcnt[MAXBITS+1], distsym[MAXDCODES]; - static struct huffman lencode, distcode; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - int symbol; - short lengths[FIXLCODES]; - - /* construct lencode and distcode */ - lencode.count = lencnt; - lencode.symbol = lensym; - distcode.count = distcnt; - distcode.symbol = distsym; - - /* literal/length table */ - for (symbol = 0; symbol < 144; symbol++) - lengths[symbol] = 8; - for (; symbol < 256; symbol++) - lengths[symbol] = 9; - for (; symbol < 280; symbol++) - lengths[symbol] = 7; - for (; symbol < FIXLCODES; symbol++) - lengths[symbol] = 8; - construct(&lencode, lengths, FIXLCODES); - - /* distance table */ - for (symbol = 0; symbol < MAXDCODES; symbol++) - lengths[symbol] = 5; - construct(&distcode, lengths, MAXDCODES); - - /* do this just once */ - virgin = 0; - } - - /* decode data until end-of-block code */ - return codes(s, &lencode, &distcode); -} - -/* - * Process a dynamic codes block. - * - * Format notes: - * - * - A dynamic block starts with a description of the literal/length and - * distance codes for that block. New dynamic blocks allow the compressor to - * rapidly adapt to changing data with new codes optimized for that data. - * - * - The codes used by the deflate format are "canonical", which means that - * the actual bits of the codes are generated in an unambiguous way simply - * from the number of bits in each code. Therefore the code descriptions - * are simply a list of code lengths for each symbol. - * - * - The code lengths are stored in order for the symbols, so lengths are - * provided for each of the literal/length symbols, and for each of the - * distance symbols. - * - * - If a symbol is not used in the block, this is represented by a zero as - * as the code length. This does not mean a zero-length code, but rather - * that no code should be created for this symbol. There is no way in the - * deflate format to represent a zero-length code. - * - * - The maximum number of bits in a code is 15, so the possible lengths for - * any code are 1..15. - * - * - The fact that a length of zero is not permitted for a code has an - * interesting consequence. Normally if only one symbol is used for a given - * code, then in fact that code could be represented with zero bits. However - * in deflate, that code has to be at least one bit. So for example, if - * only a single distance base symbol appears in a block, then it will be - * represented by a single code of length one, in particular one 0 bit. This - * is an incomplete code, since if a 1 bit is received, it has no meaning, - * and should result in an error. So incomplete distance codes of one symbol - * should be permitted, and the receipt of invalid codes should be handled. - * - * - It is also possible to have a single literal/length code, but that code - * must be the end-of-block code, since every dynamic block has one. This - * is not the most efficient way to create an empty block (an empty fixed - * block is fewer bits), but it is allowed by the format. So incomplete - * literal/length codes of one symbol should also be permitted. - * - * - If there are only literal codes and no lengths, then there are no distance - * codes. This is represented by one distance code with zero bits. - * - * - The list of up to 286 length/literal lengths and up to 30 distance lengths - * are themselves compressed using Huffman codes and run-length encoding. In - * the list of code lengths, a 0 symbol means no code, a 1..15 symbol means - * that length, and the symbols 16, 17, and 18 are run-length instructions. - * Each of 16, 17, and 18 are follwed by extra bits to define the length of - * the run. 16 copies the last length 3 to 6 times. 17 represents 3 to 10 - * zero lengths, and 18 represents 11 to 138 zero lengths. Unused symbols - * are common, hence the special coding for zero lengths. - * - * - The symbols for 0..18 are Huffman coded, and so that code must be - * described first. This is simply a sequence of up to 19 three-bit values - * representing no code (0) or the code length for that symbol (1..7). - * - * - A dynamic block starts with three fixed-size counts from which is computed - * the number of literal/length code lengths, the number of distance code - * lengths, and the number of code length code lengths (ok, you come up with - * a better name!) in the code descriptions. For the literal/length and - * distance codes, lengths after those provided are considered zero, i.e. no - * code. The code length code lengths are received in a permuted order (see - * the order[] array below) to make a short code length code length list more - * likely. As it turns out, very short and very long codes are less likely - * to be seen in a dynamic code description, hence what may appear initially - * to be a peculiar ordering. - * - * - Given the number of literal/length code lengths (nlen) and distance code - * lengths (ndist), then they are treated as one long list of nlen + ndist - * code lengths. Therefore run-length coding can and often does cross the - * boundary between the two sets of lengths. - * - * - So to summarize, the code description at the start of a dynamic block is - * three counts for the number of code lengths for the literal/length codes, - * the distance codes, and the code length codes. This is followed by the - * code length code lengths, three bits each. This is used to construct the - * code length code which is used to read the remainder of the lengths. Then - * the literal/length code lengths and distance lengths are read as a single - * set of lengths using the code length codes. Codes are constructed from - * the resulting two sets of lengths, and then finally you can start - * decoding actual compressed data in the block. - * - * - For reference, a "typical" size for the code description in a dynamic - * block is around 80 bytes. - */ -local int dynamic(struct state *s) -{ - int nlen, ndist, ncode; /* number of lengths in descriptor */ - int index; /* index of lengths[] */ - int err; /* construct() return value */ - short lengths[MAXCODES]; /* descriptor code lengths */ - short lencnt[MAXBITS+1], lensym[MAXLCODES]; /* lencode memory */ - short distcnt[MAXBITS+1], distsym[MAXDCODES]; /* distcode memory */ - struct huffman lencode, distcode; /* length and distance codes */ - static const short order[19] = /* permutation of code length codes */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - /* construct lencode and distcode */ - lencode.count = lencnt; - lencode.symbol = lensym; - distcode.count = distcnt; - distcode.symbol = distsym; - - /* get number of lengths in each table, check lengths */ - nlen = bits(s, 5) + 257; - ndist = bits(s, 5) + 1; - ncode = bits(s, 4) + 4; - if (nlen > MAXLCODES || ndist > MAXDCODES) - return -3; /* bad counts */ - - /* read code length code lengths (really), missing lengths are zero */ - for (index = 0; index < ncode; index++) - lengths[order[index]] = bits(s, 3); - for (; index < 19; index++) - lengths[order[index]] = 0; - - /* build huffman table for code lengths codes (use lencode temporarily) */ - err = construct(&lencode, lengths, 19); - if (err != 0) /* require complete code set here */ - return -4; - - /* read length/literal and distance code length tables */ - index = 0; - while (index < nlen + ndist) { - int symbol; /* decoded value */ - int len; /* last length to repeat */ - - symbol = decode(s, &lencode); - if (symbol < 0) - return symbol; /* invalid symbol */ - if (symbol < 16) /* length in 0..15 */ - lengths[index++] = symbol; - else { /* repeat instruction */ - len = 0; /* assume repeating zeros */ - if (symbol == 16) { /* repeat last length 3..6 times */ - if (index == 0) - return -5; /* no last length! */ - len = lengths[index - 1]; /* last length */ - symbol = 3 + bits(s, 2); - } - else if (symbol == 17) /* repeat zero 3..10 times */ - symbol = 3 + bits(s, 3); - else /* == 18, repeat zero 11..138 times */ - symbol = 11 + bits(s, 7); - if (index + symbol > nlen + ndist) - return -6; /* too many lengths! */ - while (symbol--) /* repeat last or zero symbol times */ - lengths[index++] = len; - } - } - - /* check for end-of-block code -- there better be one! */ - if (lengths[256] == 0) - return -9; - - /* build huffman table for literal/length codes */ - err = construct(&lencode, lengths, nlen); - if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1])) - return -7; /* incomplete code ok only for single length 1 code */ - - /* build huffman table for distance codes */ - err = construct(&distcode, lengths + nlen, ndist); - if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1])) - return -8; /* incomplete code ok only for single length 1 code */ - - /* decode data until end-of-block code */ - return codes(s, &lencode, &distcode); -} - -/* - * Inflate source to dest. On return, destlen and sourcelen are updated to the - * size of the uncompressed data and the size of the deflate data respectively. - * On success, the return value of puff() is zero. If there is an error in the - * source data, i.e. it is not in the deflate format, then a negative value is - * returned. If there is not enough input available or there is not enough - * output space, then a positive error is returned. In that case, destlen and - * sourcelen are not updated to facilitate retrying from the beginning with the - * provision of more input data or more output space. In the case of invalid - * inflate data (a negative error), the dest and source pointers are updated to - * facilitate the debugging of deflators. - * - * puff() also has a mode to determine the size of the uncompressed output with - * no output written. For this dest must be (unsigned char *)0. In this case, - * the input value of *destlen is ignored, and on return *destlen is set to the - * size of the uncompressed output. - * - * The return codes are: - * - * 2: available inflate data did not terminate - * 1: output space exhausted before completing inflate - * 0: successful inflate - * -1: invalid block type (type == 3) - * -2: stored block length did not match one's complement - * -3: dynamic block code description: too many length or distance codes - * -4: dynamic block code description: code lengths codes incomplete - * -5: dynamic block code description: repeat lengths with no first length - * -6: dynamic block code description: repeat more than specified lengths - * -7: dynamic block code description: invalid literal/length code lengths - * -8: dynamic block code description: invalid distance code lengths - * -9: dynamic block code description: missing end-of-block code - * -10: invalid literal/length or distance code in fixed or dynamic block - * -11: distance is too far back in fixed or dynamic block - * - * Format notes: - * - * - Three bits are read for each block to determine the kind of block and - * whether or not it is the last block. Then the block is decoded and the - * process repeated if it was not the last block. - * - * - The leftover bits in the last byte of the deflate data after the last - * block (if it was a fixed or dynamic block) are undefined and have no - * expected values to check. - */ -int puff(unsigned char *dest, /* pointer to destination pointer */ - unsigned long *destlen, /* amount of output space */ - const unsigned char *source, /* pointer to source data pointer */ - unsigned long *sourcelen) /* amount of input available */ -{ - struct state s; /* input/output state */ - int last, type; /* block information */ - int err; /* return value */ - - /* initialize output state */ - s.out = dest; - s.outlen = *destlen; /* ignored if dest is NIL */ - s.outcnt = 0; - - /* initialize input state */ - s.in = source; - s.inlen = *sourcelen; - s.incnt = 0; - s.bitbuf = 0; - s.bitcnt = 0; - - /* return if bits() or decode() tries to read past available input */ - if (setjmp(s.env) != 0) /* if came back here via longjmp() */ - err = 2; /* then skip do-loop, return error */ - else { - /* process blocks until last block or error */ - do { - last = bits(&s, 1); /* one if last block */ - type = bits(&s, 2); /* block type 0..3 */ - err = type == 0 ? - stored(&s) : - (type == 1 ? - fixed(&s) : - (type == 2 ? - dynamic(&s) : - -1)); /* type == 3, invalid */ - if (err != 0) - break; /* return with error */ - } while (!last); - } - - /* update the lengths and return */ - if (err <= 0) { - *destlen = s.outcnt; - *sourcelen = s.incnt; - } - return err; -} diff --git a/compat/zlib/contrib/puff/puff.h b/compat/zlib/contrib/puff/puff.h deleted file mode 100644 index e23a245..0000000 --- a/compat/zlib/contrib/puff/puff.h +++ /dev/null @@ -1,35 +0,0 @@ -/* puff.h - Copyright (C) 2002-2013 Mark Adler, all rights reserved - version 2.3, 21 Jan 2013 - - This software is provided 'as-is', without any express or implied - warranty. In no event will the author be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Mark Adler madler@alumni.caltech.edu - */ - - -/* - * See puff.c for purpose and usage. - */ -#ifndef NIL -# define NIL ((unsigned char *)0) /* for no output option */ -#endif - -int puff(unsigned char *dest, /* pointer to destination pointer */ - unsigned long *destlen, /* amount of output space */ - const unsigned char *source, /* pointer to source data pointer */ - unsigned long *sourcelen); /* amount of input available */ diff --git a/compat/zlib/contrib/puff/pufftest.c b/compat/zlib/contrib/puff/pufftest.c deleted file mode 100644 index 7764814..0000000 --- a/compat/zlib/contrib/puff/pufftest.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * pufftest.c - * Copyright (C) 2002-2013 Mark Adler - * For conditions of distribution and use, see copyright notice in puff.h - * version 2.3, 21 Jan 2013 - */ - -/* Example of how to use puff(). - - Usage: puff [-w] [-f] [-nnn] file - ... | puff [-w] [-f] [-nnn] - - where file is the input file with deflate data, nnn is the number of bytes - of input to skip before inflating (e.g. to skip a zlib or gzip header), and - -w is used to write the decompressed data to stdout. -f is for coverage - testing, and causes pufftest to fail with not enough output space (-f does - a write like -w, so -w is not required). */ - -#include -#include -#include "puff.h" - -#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) -# include -# include -# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif - -#define local static - -/* Return size times approximately the cube root of 2, keeping the result as 1, - 3, or 5 times a power of 2 -- the result is always > size, until the result - is the maximum value of an unsigned long, where it remains. This is useful - to keep reallocations less than ~33% over the actual data. */ -local size_t bythirds(size_t size) -{ - int n; - size_t m; - - m = size; - for (n = 0; m; n++) - m >>= 1; - if (n < 3) - return size + 1; - n -= 3; - m = size >> n; - m += m == 6 ? 2 : 1; - m <<= n; - return m > size ? m : (size_t)(-1); -} - -/* Read the input file *name, or stdin if name is NULL, into allocated memory. - Reallocate to larger buffers until the entire file is read in. Return a - pointer to the allocated data, or NULL if there was a memory allocation - failure. *len is the number of bytes of data read from the input file (even - if load() returns NULL). If the input file was empty or could not be opened - or read, *len is zero. */ -local void *load(const char *name, size_t *len) -{ - size_t size; - void *buf, *swap; - FILE *in; - - *len = 0; - buf = malloc(size = 4096); - if (buf == NULL) - return NULL; - in = name == NULL ? stdin : fopen(name, "rb"); - if (in != NULL) { - for (;;) { - *len += fread((char *)buf + *len, 1, size - *len, in); - if (*len < size) break; - size = bythirds(size); - if (size == *len || (swap = realloc(buf, size)) == NULL) { - free(buf); - buf = NULL; - break; - } - buf = swap; - } - fclose(in); - } - return buf; -} - -int main(int argc, char **argv) -{ - int ret, put = 0, fail = 0; - unsigned skip = 0; - char *arg, *name = NULL; - unsigned char *source = NULL, *dest; - size_t len = 0; - unsigned long sourcelen, destlen; - - /* process arguments */ - while (arg = *++argv, --argc) - if (arg[0] == '-') { - if (arg[1] == 'w' && arg[2] == 0) - put = 1; - else if (arg[1] == 'f' && arg[2] == 0) - fail = 1, put = 1; - else if (arg[1] >= '0' && arg[1] <= '9') - skip = (unsigned)atoi(arg + 1); - else { - fprintf(stderr, "invalid option %s\n", arg); - return 3; - } - } - else if (name != NULL) { - fprintf(stderr, "only one file name allowed\n"); - return 3; - } - else - name = arg; - source = load(name, &len); - if (source == NULL) { - fprintf(stderr, "memory allocation failure\n"); - return 4; - } - if (len == 0) { - fprintf(stderr, "could not read %s, or it was empty\n", - name == NULL ? "" : name); - free(source); - return 3; - } - if (skip >= len) { - fprintf(stderr, "skip request of %d leaves no input\n", skip); - free(source); - return 3; - } - - /* test inflate data with offset skip */ - len -= skip; - sourcelen = (unsigned long)len; - ret = puff(NIL, &destlen, source + skip, &sourcelen); - if (ret) - fprintf(stderr, "puff() failed with return code %d\n", ret); - else { - fprintf(stderr, "puff() succeeded uncompressing %lu bytes\n", destlen); - if (sourcelen < len) fprintf(stderr, "%lu compressed bytes unused\n", - len - sourcelen); - } - - /* if requested, inflate again and write decompressd data to stdout */ - if (put && ret == 0) { - if (fail) - destlen >>= 1; - dest = malloc(destlen); - if (dest == NULL) { - fprintf(stderr, "memory allocation failure\n"); - free(source); - return 4; - } - puff(dest, &destlen, source + skip, &sourcelen); - SET_BINARY_MODE(stdout); - fwrite(dest, 1, destlen, stdout); - free(dest); - } - - /* clean up */ - free(source); - return ret; -} diff --git a/compat/zlib/contrib/puff/zeros.raw b/compat/zlib/contrib/puff/zeros.raw deleted file mode 100644 index 0a90e76..0000000 Binary files a/compat/zlib/contrib/puff/zeros.raw and /dev/null differ diff --git a/compat/zlib/contrib/testzlib/testzlib.c b/compat/zlib/contrib/testzlib/testzlib.c deleted file mode 100644 index 5f659de..0000000 --- a/compat/zlib/contrib/testzlib/testzlib.c +++ /dev/null @@ -1,275 +0,0 @@ -#include -#include -#include - -#include "zlib.h" - - -void MyDoMinus64(LARGE_INTEGER *R,LARGE_INTEGER A,LARGE_INTEGER B) -{ - R->HighPart = A.HighPart - B.HighPart; - if (A.LowPart >= B.LowPart) - R->LowPart = A.LowPart - B.LowPart; - else - { - R->LowPart = A.LowPart - B.LowPart; - R->HighPart --; - } -} - -#ifdef _M_X64 -// see http://msdn2.microsoft.com/library/twchhe95(en-us,vs.80).aspx for __rdtsc -unsigned __int64 __rdtsc(void); -void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64) -{ - // printf("rdtsc = %I64x\n",__rdtsc()); - pbeginTime64->QuadPart=__rdtsc(); -} - -LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf) -{ - LARGE_INTEGER LIres; - unsigned _int64 res=__rdtsc()-((unsigned _int64)(beginTime64.QuadPart)); - LIres.QuadPart=res; - // printf("rdtsc = %I64x\n",__rdtsc()); - return LIres; -} -#else -#ifdef _M_IX86 -void myGetRDTSC32(LARGE_INTEGER * pbeginTime64) -{ - DWORD dwEdx,dwEax; - _asm - { - rdtsc - mov dwEax,eax - mov dwEdx,edx - } - pbeginTime64->LowPart=dwEax; - pbeginTime64->HighPart=dwEdx; -} - -void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64) -{ - myGetRDTSC32(pbeginTime64); -} - -LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf) -{ - LARGE_INTEGER LIres,endTime64; - myGetRDTSC32(&endTime64); - - LIres.LowPart=LIres.HighPart=0; - MyDoMinus64(&LIres,endTime64,beginTime64); - return LIres; -} -#else -void myGetRDTSC32(LARGE_INTEGER * pbeginTime64) -{ -} - -void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64) -{ -} - -LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf) -{ - LARGE_INTEGER lr; - lr.QuadPart=0; - return lr; -} -#endif -#endif - -void BeginCountPerfCounter(LARGE_INTEGER * pbeginTime64,BOOL fComputeTimeQueryPerf) -{ - if ((!fComputeTimeQueryPerf) || (!QueryPerformanceCounter(pbeginTime64))) - { - pbeginTime64->LowPart = GetTickCount(); - pbeginTime64->HighPart = 0; - } -} - -DWORD GetMsecSincePerfCounter(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf) -{ - LARGE_INTEGER endTime64,ticksPerSecond,ticks; - DWORDLONG ticksShifted,tickSecShifted; - DWORD dwLog=16+0; - DWORD dwRet; - if ((!fComputeTimeQueryPerf) || (!QueryPerformanceCounter(&endTime64))) - dwRet = (GetTickCount() - beginTime64.LowPart)*1; - else - { - MyDoMinus64(&ticks,endTime64,beginTime64); - QueryPerformanceFrequency(&ticksPerSecond); - - - { - ticksShifted = Int64ShrlMod32(*(DWORDLONG*)&ticks,dwLog); - tickSecShifted = Int64ShrlMod32(*(DWORDLONG*)&ticksPerSecond,dwLog); - - } - - dwRet = (DWORD)((((DWORD)ticksShifted)*1000)/(DWORD)(tickSecShifted)); - dwRet *=1; - } - return dwRet; -} - -int ReadFileMemory(const char* filename,long* plFileSize,unsigned char** pFilePtr) -{ - FILE* stream; - unsigned char* ptr; - int retVal=1; - stream=fopen(filename, "rb"); - if (stream==NULL) - return 0; - - fseek(stream,0,SEEK_END); - - *plFileSize=ftell(stream); - fseek(stream,0,SEEK_SET); - ptr=malloc((*plFileSize)+1); - if (ptr==NULL) - retVal=0; - else - { - if (fread(ptr, 1, *plFileSize,stream) != (*plFileSize)) - retVal=0; - } - fclose(stream); - *pFilePtr=ptr; - return retVal; -} - -int main(int argc, char *argv[]) -{ - int BlockSizeCompress=0x8000; - int BlockSizeUncompress=0x8000; - int cprLevel=Z_DEFAULT_COMPRESSION ; - long lFileSize; - unsigned char* FilePtr; - long lBufferSizeCpr; - long lBufferSizeUncpr; - long lCompressedSize=0; - unsigned char* CprPtr; - unsigned char* UncprPtr; - long lSizeCpr,lSizeUncpr; - DWORD dwGetTick,dwMsecQP; - LARGE_INTEGER li_qp,li_rdtsc,dwResRdtsc; - - if (argc<=1) - { - printf("run TestZlib [BlockSizeCompress] [BlockSizeUncompress] [compres. level]\n"); - return 0; - } - - if (ReadFileMemory(argv[1],&lFileSize,&FilePtr)==0) - { - printf("error reading %s\n",argv[1]); - return 1; - } - else printf("file %s read, %u bytes\n",argv[1],lFileSize); - - if (argc>=3) - BlockSizeCompress=atol(argv[2]); - - if (argc>=4) - BlockSizeUncompress=atol(argv[3]); - - if (argc>=5) - cprLevel=(int)atol(argv[4]); - - lBufferSizeCpr = lFileSize + (lFileSize/0x10) + 0x200; - lBufferSizeUncpr = lBufferSizeCpr; - - CprPtr=(unsigned char*)malloc(lBufferSizeCpr + BlockSizeCompress); - - BeginCountPerfCounter(&li_qp,TRUE); - dwGetTick=GetTickCount(); - BeginCountRdtsc(&li_rdtsc); - { - z_stream zcpr; - int ret=Z_OK; - long lOrigToDo = lFileSize; - long lOrigDone = 0; - int step=0; - memset(&zcpr,0,sizeof(z_stream)); - deflateInit(&zcpr,cprLevel); - - zcpr.next_in = FilePtr; - zcpr.next_out = CprPtr; - - - do - { - long all_read_before = zcpr.total_in; - zcpr.avail_in = min(lOrigToDo,BlockSizeCompress); - zcpr.avail_out = BlockSizeCompress; - ret=deflate(&zcpr,(zcpr.avail_in==lOrigToDo) ? Z_FINISH : Z_SYNC_FLUSH); - lOrigDone += (zcpr.total_in-all_read_before); - lOrigToDo -= (zcpr.total_in-all_read_before); - step++; - } while (ret==Z_OK); - - lSizeCpr=zcpr.total_out; - deflateEnd(&zcpr); - dwGetTick=GetTickCount()-dwGetTick; - dwMsecQP=GetMsecSincePerfCounter(li_qp,TRUE); - dwResRdtsc=GetResRdtsc(li_rdtsc,TRUE); - printf("total compress size = %u, in %u step\n",lSizeCpr,step); - printf("time = %u msec = %f sec\n",dwGetTick,dwGetTick/(double)1000.); - printf("defcpr time QP = %u msec = %f sec\n",dwMsecQP,dwMsecQP/(double)1000.); - printf("defcpr result rdtsc = %I64x\n\n",dwResRdtsc.QuadPart); - } - - CprPtr=(unsigned char*)realloc(CprPtr,lSizeCpr); - UncprPtr=(unsigned char*)malloc(lBufferSizeUncpr + BlockSizeUncompress); - - BeginCountPerfCounter(&li_qp,TRUE); - dwGetTick=GetTickCount(); - BeginCountRdtsc(&li_rdtsc); - { - z_stream zcpr; - int ret=Z_OK; - long lOrigToDo = lSizeCpr; - long lOrigDone = 0; - int step=0; - memset(&zcpr,0,sizeof(z_stream)); - inflateInit(&zcpr); - - zcpr.next_in = CprPtr; - zcpr.next_out = UncprPtr; - - - do - { - long all_read_before = zcpr.total_in; - zcpr.avail_in = min(lOrigToDo,BlockSizeUncompress); - zcpr.avail_out = BlockSizeUncompress; - ret=inflate(&zcpr,Z_SYNC_FLUSH); - lOrigDone += (zcpr.total_in-all_read_before); - lOrigToDo -= (zcpr.total_in-all_read_before); - step++; - } while (ret==Z_OK); - - lSizeUncpr=zcpr.total_out; - inflateEnd(&zcpr); - dwGetTick=GetTickCount()-dwGetTick; - dwMsecQP=GetMsecSincePerfCounter(li_qp,TRUE); - dwResRdtsc=GetResRdtsc(li_rdtsc,TRUE); - printf("total uncompress size = %u, in %u step\n",lSizeUncpr,step); - printf("time = %u msec = %f sec\n",dwGetTick,dwGetTick/(double)1000.); - printf("uncpr time QP = %u msec = %f sec\n",dwMsecQP,dwMsecQP/(double)1000.); - printf("uncpr result rdtsc = %I64x\n\n",dwResRdtsc.QuadPart); - } - - if (lSizeUncpr==lFileSize) - { - if (memcmp(FilePtr,UncprPtr,lFileSize)==0) - printf("compare ok\n"); - - } - - return 0; -} diff --git a/compat/zlib/contrib/testzlib/testzlib.txt b/compat/zlib/contrib/testzlib/testzlib.txt deleted file mode 100644 index 62258f1..0000000 --- a/compat/zlib/contrib/testzlib/testzlib.txt +++ /dev/null @@ -1,10 +0,0 @@ -To build testzLib with Visual Studio 2005: - -copy to a directory file from : -- root of zLib tree -- contrib/testzlib -- contrib/masmx86 -- contrib/masmx64 -- contrib/vstudio/vc7 - -and open testzlib8.sln \ No newline at end of file diff --git a/compat/zlib/contrib/untgz/Makefile b/compat/zlib/contrib/untgz/Makefile deleted file mode 100644 index b54266f..0000000 --- a/compat/zlib/contrib/untgz/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -CC=cc -CFLAGS=-g - -untgz: untgz.o ../../libz.a - $(CC) $(CFLAGS) -o untgz untgz.o -L../.. -lz - -untgz.o: untgz.c ../../zlib.h - $(CC) $(CFLAGS) -c -I../.. untgz.c - -../../libz.a: - cd ../..; ./configure; make - -clean: - rm -f untgz untgz.o *~ diff --git a/compat/zlib/contrib/untgz/Makefile.msc b/compat/zlib/contrib/untgz/Makefile.msc deleted file mode 100644 index 77b8602..0000000 --- a/compat/zlib/contrib/untgz/Makefile.msc +++ /dev/null @@ -1,17 +0,0 @@ -CC=cl -CFLAGS=-MD - -untgz.exe: untgz.obj ..\..\zlib.lib - $(CC) $(CFLAGS) untgz.obj ..\..\zlib.lib - -untgz.obj: untgz.c ..\..\zlib.h - $(CC) $(CFLAGS) -c -I..\.. untgz.c - -..\..\zlib.lib: - cd ..\.. - $(MAKE) -f win32\makefile.msc - cd contrib\untgz - -clean: - -del untgz.obj - -del untgz.exe diff --git a/compat/zlib/contrib/untgz/untgz.c b/compat/zlib/contrib/untgz/untgz.c deleted file mode 100644 index 2c391e5..0000000 --- a/compat/zlib/contrib/untgz/untgz.c +++ /dev/null @@ -1,674 +0,0 @@ -/* - * untgz.c -- Display contents and extract files from a gzip'd TAR file - * - * written by Pedro A. Aranda Gutierrez - * adaptation to Unix by Jean-loup Gailly - * various fixes by Cosmin Truta - */ - -#include -#include -#include -#include -#include - -#include "zlib.h" - -#ifdef unix -# include -#else -# include -# include -#endif - -#ifdef WIN32 -#include -# ifndef F_OK -# define F_OK 0 -# endif -# define mkdir(dirname,mode) _mkdir(dirname) -# ifdef _MSC_VER -# define access(path,mode) _access(path,mode) -# define chmod(path,mode) _chmod(path,mode) -# define strdup(str) _strdup(str) -# endif -#else -# include -#endif - - -/* values used in typeflag field */ - -#define REGTYPE '0' /* regular file */ -#define AREGTYPE '\0' /* regular file */ -#define LNKTYPE '1' /* link */ -#define SYMTYPE '2' /* reserved */ -#define CHRTYPE '3' /* character special */ -#define BLKTYPE '4' /* block special */ -#define DIRTYPE '5' /* directory */ -#define FIFOTYPE '6' /* FIFO special */ -#define CONTTYPE '7' /* reserved */ - -/* GNU tar extensions */ - -#define GNUTYPE_DUMPDIR 'D' /* file names from dumped directory */ -#define GNUTYPE_LONGLINK 'K' /* long link name */ -#define GNUTYPE_LONGNAME 'L' /* long file name */ -#define GNUTYPE_MULTIVOL 'M' /* continuation of file from another volume */ -#define GNUTYPE_NAMES 'N' /* file name that does not fit into main hdr */ -#define GNUTYPE_SPARSE 'S' /* sparse file */ -#define GNUTYPE_VOLHDR 'V' /* tape/volume header */ - - -/* tar header */ - -#define BLOCKSIZE 512 -#define SHORTNAMESIZE 100 - -struct tar_header -{ /* byte offset */ - char name[100]; /* 0 */ - char mode[8]; /* 100 */ - char uid[8]; /* 108 */ - char gid[8]; /* 116 */ - char size[12]; /* 124 */ - char mtime[12]; /* 136 */ - char chksum[8]; /* 148 */ - char typeflag; /* 156 */ - char linkname[100]; /* 157 */ - char magic[6]; /* 257 */ - char version[2]; /* 263 */ - char uname[32]; /* 265 */ - char gname[32]; /* 297 */ - char devmajor[8]; /* 329 */ - char devminor[8]; /* 337 */ - char prefix[155]; /* 345 */ - /* 500 */ -}; - -union tar_buffer -{ - char buffer[BLOCKSIZE]; - struct tar_header header; -}; - -struct attr_item -{ - struct attr_item *next; - char *fname; - int mode; - time_t time; -}; - -enum { TGZ_EXTRACT, TGZ_LIST, TGZ_INVALID }; - -char *TGZfname OF((const char *)); -void TGZnotfound OF((const char *)); - -int getoct OF((char *, int)); -char *strtime OF((time_t *)); -int setfiletime OF((char *, time_t)); -void push_attr OF((struct attr_item **, char *, int, time_t)); -void restore_attr OF((struct attr_item **)); - -int ExprMatch OF((char *, char *)); - -int makedir OF((char *)); -int matchname OF((int, int, char **, char *)); - -void error OF((const char *)); -int tar OF((gzFile, int, int, int, char **)); - -void help OF((int)); -int main OF((int, char **)); - -char *prog; - -const char *TGZsuffix[] = { "\0", ".tar", ".tar.gz", ".taz", ".tgz", NULL }; - -/* return the file name of the TGZ archive */ -/* or NULL if it does not exist */ - -char *TGZfname (const char *arcname) -{ - static char buffer[1024]; - int origlen,i; - - strcpy(buffer,arcname); - origlen = strlen(buffer); - - for (i=0; TGZsuffix[i]; i++) - { - strcpy(buffer+origlen,TGZsuffix[i]); - if (access(buffer,F_OK) == 0) - return buffer; - } - return NULL; -} - - -/* error message for the filename */ - -void TGZnotfound (const char *arcname) -{ - int i; - - fprintf(stderr,"%s: Couldn't find ",prog); - for (i=0;TGZsuffix[i];i++) - fprintf(stderr,(TGZsuffix[i+1]) ? "%s%s, " : "or %s%s\n", - arcname, - TGZsuffix[i]); - exit(1); -} - - -/* convert octal digits to int */ -/* on error return -1 */ - -int getoct (char *p,int width) -{ - int result = 0; - char c; - - while (width--) - { - c = *p++; - if (c == 0) - break; - if (c == ' ') - continue; - if (c < '0' || c > '7') - return -1; - result = result * 8 + (c - '0'); - } - return result; -} - - -/* convert time_t to string */ -/* use the "YYYY/MM/DD hh:mm:ss" format */ - -char *strtime (time_t *t) -{ - struct tm *local; - static char result[32]; - - local = localtime(t); - sprintf(result,"%4d/%02d/%02d %02d:%02d:%02d", - local->tm_year+1900, local->tm_mon+1, local->tm_mday, - local->tm_hour, local->tm_min, local->tm_sec); - return result; -} - - -/* set file time */ - -int setfiletime (char *fname,time_t ftime) -{ -#ifdef WIN32 - static int isWinNT = -1; - SYSTEMTIME st; - FILETIME locft, modft; - struct tm *loctm; - HANDLE hFile; - int result; - - loctm = localtime(&ftime); - if (loctm == NULL) - return -1; - - st.wYear = (WORD)loctm->tm_year + 1900; - st.wMonth = (WORD)loctm->tm_mon + 1; - st.wDayOfWeek = (WORD)loctm->tm_wday; - st.wDay = (WORD)loctm->tm_mday; - st.wHour = (WORD)loctm->tm_hour; - st.wMinute = (WORD)loctm->tm_min; - st.wSecond = (WORD)loctm->tm_sec; - st.wMilliseconds = 0; - if (!SystemTimeToFileTime(&st, &locft) || - !LocalFileTimeToFileTime(&locft, &modft)) - return -1; - - if (isWinNT < 0) - isWinNT = (GetVersion() < 0x80000000) ? 1 : 0; - hFile = CreateFile(fname, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, - (isWinNT ? FILE_FLAG_BACKUP_SEMANTICS : 0), - NULL); - if (hFile == INVALID_HANDLE_VALUE) - return -1; - result = SetFileTime(hFile, NULL, NULL, &modft) ? 0 : -1; - CloseHandle(hFile); - return result; -#else - struct utimbuf settime; - - settime.actime = settime.modtime = ftime; - return utime(fname,&settime); -#endif -} - - -/* push file attributes */ - -void push_attr(struct attr_item **list,char *fname,int mode,time_t time) -{ - struct attr_item *item; - - item = (struct attr_item *)malloc(sizeof(struct attr_item)); - if (item == NULL) - error("Out of memory"); - item->fname = strdup(fname); - item->mode = mode; - item->time = time; - item->next = *list; - *list = item; -} - - -/* restore file attributes */ - -void restore_attr(struct attr_item **list) -{ - struct attr_item *item, *prev; - - for (item = *list; item != NULL; ) - { - setfiletime(item->fname,item->time); - chmod(item->fname,item->mode); - prev = item; - item = item->next; - free(prev); - } - *list = NULL; -} - - -/* match regular expression */ - -#define ISSPECIAL(c) (((c) == '*') || ((c) == '/')) - -int ExprMatch (char *string,char *expr) -{ - while (1) - { - if (ISSPECIAL(*expr)) - { - if (*expr == '/') - { - if (*string != '\\' && *string != '/') - return 0; - string ++; expr++; - } - else if (*expr == '*') - { - if (*expr ++ == 0) - return 1; - while (*++string != *expr) - if (*string == 0) - return 0; - } - } - else - { - if (*string != *expr) - return 0; - if (*expr++ == 0) - return 1; - string++; - } - } -} - - -/* recursive mkdir */ -/* abort on ENOENT; ignore other errors like "directory already exists" */ -/* return 1 if OK */ -/* 0 on error */ - -int makedir (char *newdir) -{ - char *buffer = strdup(newdir); - char *p; - int len = strlen(buffer); - - if (len <= 0) { - free(buffer); - return 0; - } - if (buffer[len-1] == '/') { - buffer[len-1] = '\0'; - } - if (mkdir(buffer, 0755) == 0) - { - free(buffer); - return 1; - } - - p = buffer+1; - while (1) - { - char hold; - - while(*p && *p != '\\' && *p != '/') - p++; - hold = *p; - *p = 0; - if ((mkdir(buffer, 0755) == -1) && (errno == ENOENT)) - { - fprintf(stderr,"%s: Couldn't create directory %s\n",prog,buffer); - free(buffer); - return 0; - } - if (hold == 0) - break; - *p++ = hold; - } - free(buffer); - return 1; -} - - -int matchname (int arg,int argc,char **argv,char *fname) -{ - if (arg == argc) /* no arguments given (untgz tgzarchive) */ - return 1; - - while (arg < argc) - if (ExprMatch(fname,argv[arg++])) - return 1; - - return 0; /* ignore this for the moment being */ -} - - -/* tar file list or extract */ - -int tar (gzFile in,int action,int arg,int argc,char **argv) -{ - union tar_buffer buffer; - int len; - int err; - int getheader = 1; - int remaining = 0; - FILE *outfile = NULL; - char fname[BLOCKSIZE]; - int tarmode; - time_t tartime; - struct attr_item *attributes = NULL; - - if (action == TGZ_LIST) - printf(" date time size file\n" - " ---------- -------- --------- -------------------------------------\n"); - while (1) - { - len = gzread(in, &buffer, BLOCKSIZE); - if (len < 0) - error(gzerror(in, &err)); - /* - * Always expect complete blocks to process - * the tar information. - */ - if (len != BLOCKSIZE) - { - action = TGZ_INVALID; /* force error exit */ - remaining = 0; /* force I/O cleanup */ - } - - /* - * If we have to get a tar header - */ - if (getheader >= 1) - { - /* - * if we met the end of the tar - * or the end-of-tar block, - * we are done - */ - if (len == 0 || buffer.header.name[0] == 0) - break; - - tarmode = getoct(buffer.header.mode,8); - tartime = (time_t)getoct(buffer.header.mtime,12); - if (tarmode == -1 || tartime == (time_t)-1) - { - buffer.header.name[0] = 0; - action = TGZ_INVALID; - } - - if (getheader == 1) - { - strncpy(fname,buffer.header.name,SHORTNAMESIZE); - if (fname[SHORTNAMESIZE-1] != 0) - fname[SHORTNAMESIZE] = 0; - } - else - { - /* - * The file name is longer than SHORTNAMESIZE - */ - if (strncmp(fname,buffer.header.name,SHORTNAMESIZE-1) != 0) - error("bad long name"); - getheader = 1; - } - - /* - * Act according to the type flag - */ - switch (buffer.header.typeflag) - { - case DIRTYPE: - if (action == TGZ_LIST) - printf(" %s %s\n",strtime(&tartime),fname); - if (action == TGZ_EXTRACT) - { - makedir(fname); - push_attr(&attributes,fname,tarmode,tartime); - } - break; - case REGTYPE: - case AREGTYPE: - remaining = getoct(buffer.header.size,12); - if (remaining == -1) - { - action = TGZ_INVALID; - break; - } - if (action == TGZ_LIST) - printf(" %s %9d %s\n",strtime(&tartime),remaining,fname); - else if (action == TGZ_EXTRACT) - { - if (matchname(arg,argc,argv,fname)) - { - outfile = fopen(fname,"wb"); - if (outfile == NULL) { - /* try creating directory */ - char *p = strrchr(fname, '/'); - if (p != NULL) { - *p = '\0'; - makedir(fname); - *p = '/'; - outfile = fopen(fname,"wb"); - } - } - if (outfile != NULL) - printf("Extracting %s\n",fname); - else - fprintf(stderr, "%s: Couldn't create %s",prog,fname); - } - else - outfile = NULL; - } - getheader = 0; - break; - case GNUTYPE_LONGLINK: - case GNUTYPE_LONGNAME: - remaining = getoct(buffer.header.size,12); - if (remaining < 0 || remaining >= BLOCKSIZE) - { - action = TGZ_INVALID; - break; - } - len = gzread(in, fname, BLOCKSIZE); - if (len < 0) - error(gzerror(in, &err)); - if (fname[BLOCKSIZE-1] != 0 || (int)strlen(fname) > remaining) - { - action = TGZ_INVALID; - break; - } - getheader = 2; - break; - default: - if (action == TGZ_LIST) - printf(" %s <---> %s\n",strtime(&tartime),fname); - break; - } - } - else - { - unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining; - - if (outfile != NULL) - { - if (fwrite(&buffer,sizeof(char),bytes,outfile) != bytes) - { - fprintf(stderr, - "%s: Error writing %s -- skipping\n",prog,fname); - fclose(outfile); - outfile = NULL; - remove(fname); - } - } - remaining -= bytes; - } - - if (remaining == 0) - { - getheader = 1; - if (outfile != NULL) - { - fclose(outfile); - outfile = NULL; - if (action != TGZ_INVALID) - push_attr(&attributes,fname,tarmode,tartime); - } - } - - /* - * Abandon if errors are found - */ - if (action == TGZ_INVALID) - { - error("broken archive"); - break; - } - } - - /* - * Restore file modes and time stamps - */ - restore_attr(&attributes); - - if (gzclose(in) != Z_OK) - error("failed gzclose"); - - return 0; -} - - -/* ============================================================ */ - -void help(int exitval) -{ - printf("untgz version 0.2.1\n" - " using zlib version %s\n\n", - zlibVersion()); - printf("Usage: untgz file.tgz extract all files\n" - " untgz file.tgz fname ... extract selected files\n" - " untgz -l file.tgz list archive contents\n" - " untgz -h display this help\n"); - exit(exitval); -} - -void error(const char *msg) -{ - fprintf(stderr, "%s: %s\n", prog, msg); - exit(1); -} - - -/* ============================================================ */ - -#if defined(WIN32) && defined(__GNUC__) -int _CRT_glob = 0; /* disable argument globbing in MinGW */ -#endif - -int main(int argc,char **argv) -{ - int action = TGZ_EXTRACT; - int arg = 1; - char *TGZfile; - gzFile *f; - - prog = strrchr(argv[0],'\\'); - if (prog == NULL) - { - prog = strrchr(argv[0],'/'); - if (prog == NULL) - { - prog = strrchr(argv[0],':'); - if (prog == NULL) - prog = argv[0]; - else - prog++; - } - else - prog++; - } - else - prog++; - - if (argc == 1) - help(0); - - if (strcmp(argv[arg],"-l") == 0) - { - action = TGZ_LIST; - if (argc == ++arg) - help(0); - } - else if (strcmp(argv[arg],"-h") == 0) - { - help(0); - } - - if ((TGZfile = TGZfname(argv[arg])) == NULL) - TGZnotfound(argv[arg]); - - ++arg; - if ((action == TGZ_LIST) && (arg != argc)) - help(1); - -/* - * Process the TGZ file - */ - switch(action) - { - case TGZ_LIST: - case TGZ_EXTRACT: - f = gzopen(TGZfile,"rb"); - if (f == NULL) - { - fprintf(stderr,"%s: Couldn't gzopen %s\n",prog,TGZfile); - return 1; - } - exit(tar(f, action, arg, argc, argv)); - break; - - default: - error("Unknown option"); - exit(1); - } - - return 0; -} diff --git a/compat/zlib/contrib/vstudio/readme.txt b/compat/zlib/contrib/vstudio/readme.txt deleted file mode 100644 index f67eae8..0000000 --- a/compat/zlib/contrib/vstudio/readme.txt +++ /dev/null @@ -1,78 +0,0 @@ -Building instructions for the DLL versions of Zlib 1.2.11 -======================================================== - -This directory contains projects that build zlib and minizip using -Microsoft Visual C++ 9.0/10.0. - -You don't need to build these projects yourself. You can download the -binaries from: - http://www.winimage.com/zLibDll - -More information can be found at this site. - - - - - -Build instructions for Visual Studio 2008 (32 bits or 64 bits) --------------------------------------------------------------- -- Decompress current zlib, including all contrib/* files -- Compile assembly code (with Visual Studio Command Prompt) by running: - bld_ml64.bat (in contrib\masmx64) - bld_ml32.bat (in contrib\masmx86) -- Open contrib\vstudio\vc9\zlibvc.sln with Microsoft Visual C++ 2008 -- Or run: vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32" - -Build instructions for Visual Studio 2010 (32 bits or 64 bits) --------------------------------------------------------------- -- Decompress current zlib, including all contrib/* files -- Open contrib\vstudio\vc10\zlibvc.sln with Microsoft Visual C++ 2010 - -Build instructions for Visual Studio 2012 (32 bits or 64 bits) --------------------------------------------------------------- -- Decompress current zlib, including all contrib/* files -- Open contrib\vstudio\vc11\zlibvc.sln with Microsoft Visual C++ 2012 - -Build instructions for Visual Studio 2013 (32 bits or 64 bits) --------------------------------------------------------------- -- Decompress current zlib, including all contrib/* files -- Open contrib\vstudio\vc12\zlibvc.sln with Microsoft Visual C++ 2013 - -Build instructions for Visual Studio 2015 (32 bits or 64 bits) --------------------------------------------------------------- -- Decompress current zlib, including all contrib/* files -- Open contrib\vstudio\vc14\zlibvc.sln with Microsoft Visual C++ 2015 - - -Important ---------- -- To use zlibwapi.dll in your application, you must define the - macro ZLIB_WINAPI when compiling your application's source files. - - -Additional notes ----------------- -- This DLL, named zlibwapi.dll, is compatible to the old zlib.dll built - by Gilles Vollant from the zlib 1.1.x sources, and distributed at - http://www.winimage.com/zLibDll - It uses the WINAPI calling convention for the exported functions, and - includes the minizip functionality. If your application needs that - particular build of zlib.dll, you can rename zlibwapi.dll to zlib.dll. - -- The new DLL was renamed because there exist several incompatible - versions of zlib.dll on the Internet. - -- There is also an official DLL build of zlib, named zlib1.dll. This one - is exporting the functions using the CDECL convention. See the file - win32\DLL_FAQ.txt found in this zlib distribution. - -- There used to be a ZLIB_DLL macro in zlib 1.1.x, but now this symbol - has a slightly different effect. To avoid compatibility problems, do - not define it here. - - -Gilles Vollant -info@winimage.com - -Visual Studio 2013 and 2015 Projects from Sean Hunt -seandhunt_7@yahoo.com diff --git a/compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj b/compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj deleted file mode 100644 index 74e15c9..0000000 --- a/compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj +++ /dev/null @@ -1,310 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {C52F9E7B-498A-42BE-8DB4-85A15694382A} - Win32Proj - - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\MiniUnzip$(Configuration)\ - x86\MiniUnzip$(Configuration)\Tmp\ - true - false - x86\MiniUnzip$(Configuration)\ - x86\MiniUnzip$(Configuration)\Tmp\ - false - false - x64\MiniUnzip$(Configuration)\ - x64\MiniUnzip$(Configuration)\Tmp\ - true - false - ia64\MiniUnzip$(Configuration)\ - ia64\MiniUnzip$(Configuration)\Tmp\ - true - false - x64\MiniUnzip$(Configuration)\ - x64\MiniUnzip$(Configuration)\Tmp\ - false - false - ia64\MiniUnzip$(Configuration)\ - ia64\MiniUnzip$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebug - false - - - $(IntDir) - Level3 - EditAndContinue - - - x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - $(OutDir)miniunz.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - Console - true - true - false - - - MachineX86 - - - - - X64 - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - $(OutDir)miniunz.pdb - Console - MachineX64 - - - - - Itanium - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - $(OutDir)miniunz.pdb - Console - MachineIA64 - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - Console - true - true - MachineX64 - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - Console - true - true - MachineIA64 - - - - - - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters b/compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters deleted file mode 100644 index 0b2a3de..0000000 --- a/compat/zlib/contrib/vstudio/vc10/miniunz.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {048af943-022b-4db6-beeb-a54c34774ee2} - cpp;c;cxx;def;odl;idl;hpj;bat;asm - - - {c1d600d2-888f-4aea-b73e-8b0dd9befa0c} - h;hpp;hxx;hm;inl;inc - - - {0844199a-966b-4f19-81db-1e0125e141b9} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - - - Source Files - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/minizip.vcxproj b/compat/zlib/contrib/vstudio/vc10/minizip.vcxproj deleted file mode 100644 index 917e156..0000000 --- a/compat/zlib/contrib/vstudio/vc10/minizip.vcxproj +++ /dev/null @@ -1,307 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B} - Win32Proj - - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\MiniZip$(Configuration)\ - x86\MiniZip$(Configuration)\Tmp\ - true - false - x86\MiniZip$(Configuration)\ - x86\MiniZip$(Configuration)\Tmp\ - false - x64\$(Configuration)\ - x64\$(Configuration)\ - true - false - ia64\$(Configuration)\ - ia64\$(Configuration)\ - true - false - x64\$(Configuration)\ - x64\$(Configuration)\ - false - ia64\$(Configuration)\ - ia64\$(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebug - false - - - $(IntDir) - Level3 - EditAndContinue - - - x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - $(OutDir)minizip.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - Console - true - true - false - - - MachineX86 - - - - - X64 - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - $(OutDir)minizip.pdb - Console - MachineX64 - - - - - Itanium - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - $(OutDir)minizip.pdb - Console - MachineIA64 - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - Console - true - true - MachineX64 - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - Console - true - true - MachineIA64 - - - - - - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/minizip.vcxproj.filters b/compat/zlib/contrib/vstudio/vc10/minizip.vcxproj.filters deleted file mode 100644 index dd73cd3..0000000 --- a/compat/zlib/contrib/vstudio/vc10/minizip.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {c0419b40-bf50-40da-b153-ff74215b79de} - cpp;c;cxx;def;odl;idl;hpj;bat;asm - - - {bb87b070-735b-478e-92ce-7383abb2f36c} - h;hpp;hxx;hm;inl;inc - - - {f46ab6a6-548f-43cb-ae96-681abb5bd5db} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - - - Source Files - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj b/compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj deleted file mode 100644 index 9088d17..0000000 --- a/compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj +++ /dev/null @@ -1,420 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - ReleaseWithoutAsm - Itanium - - - ReleaseWithoutAsm - Win32 - - - ReleaseWithoutAsm - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B} - testzlib - Win32Proj - - - - Application - MultiByte - true - - - Application - MultiByte - true - - - Application - MultiByte - - - Application - MultiByte - true - - - Application - MultiByte - true - - - Application - MultiByte - - - Application - true - - - Application - true - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\TestZlib$(Configuration)\ - x86\TestZlib$(Configuration)\Tmp\ - true - false - x86\TestZlib$(Configuration)\ - x86\TestZlib$(Configuration)\Tmp\ - false - false - x86\TestZlib$(Configuration)\ - x86\TestZlib$(Configuration)\Tmp\ - false - false - x64\TestZlib$(Configuration)\ - x64\TestZlib$(Configuration)\Tmp\ - false - ia64\TestZlib$(Configuration)\ - ia64\TestZlib$(Configuration)\Tmp\ - true - false - x64\TestZlib$(Configuration)\ - x64\TestZlib$(Configuration)\Tmp\ - false - ia64\TestZlib$(Configuration)\ - ia64\TestZlib$(Configuration)\Tmp\ - false - false - x64\TestZlib$(Configuration)\ - x64\TestZlib$(Configuration)\Tmp\ - false - ia64\TestZlib$(Configuration)\ - ia64\TestZlib$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebug - false - - - AssemblyAndSourceCode - $(IntDir) - Level3 - EditAndContinue - - - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)testzlib.exe - true - $(OutDir)testzlib.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - Console - true - true - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)testzlib.exe - true - Console - true - true - false - - - MachineX86 - - - - - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - Default - MultiThreadedDebugDLL - false - $(IntDir) - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - - - - - Itanium - - - Disabled - ..\..\..;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - AssemblyAndSourceCode - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - $(OutDir)testzlib.pdb - Console - MachineIA64 - - - - - ..\..\..;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - Default - MultiThreadedDLL - false - $(IntDir) - - - %(AdditionalDependencies) - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - Console - true - true - MachineIA64 - - - - - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - Default - MultiThreadedDLL - false - $(IntDir) - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - Console - true - true - MachineIA64 - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters b/compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters deleted file mode 100644 index 249daa8..0000000 --- a/compat/zlib/contrib/vstudio/vc10/testzlib.vcxproj.filters +++ /dev/null @@ -1,58 +0,0 @@ - - - - - {c1f6a2e3-5da5-4955-8653-310d3efe05a9} - cpp;c;cxx;def;odl;idl;hpj;bat;asm - - - {c2aaffdc-2c95-4d6f-8466-4bec5890af2c} - h;hpp;hxx;hm;inl;inc - - - {c274fe07-05f2-461c-964b-f6341e4e7eb5} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj b/compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj deleted file mode 100644 index bcb08ff..0000000 --- a/compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj +++ /dev/null @@ -1,310 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {C52F9E7B-498A-42BE-8DB4-85A15694366A} - Win32Proj - - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\TestZlibDll$(Configuration)\ - x86\TestZlibDll$(Configuration)\Tmp\ - true - false - x86\TestZlibDll$(Configuration)\ - x86\TestZlibDll$(Configuration)\Tmp\ - false - false - x64\TestZlibDll$(Configuration)\ - x64\TestZlibDll$(Configuration)\Tmp\ - true - false - ia64\TestZlibDll$(Configuration)\ - ia64\TestZlibDll$(Configuration)\Tmp\ - true - false - x64\TestZlibDll$(Configuration)\ - x64\TestZlibDll$(Configuration)\Tmp\ - false - false - ia64\TestZlibDll$(Configuration)\ - ia64\TestZlibDll$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebug - false - - - $(IntDir) - Level3 - EditAndContinue - - - x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - $(OutDir)testzlib.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - Console - true - true - false - - - MachineX86 - - - - - X64 - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - $(OutDir)testzlib.pdb - Console - MachineX64 - - - - - Itanium - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - $(OutDir)testzlib.pdb - Console - MachineIA64 - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - Console - true - true - MachineX64 - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - Console - true - true - MachineIA64 - - - - - - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters b/compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters deleted file mode 100644 index 53a8693..0000000 --- a/compat/zlib/contrib/vstudio/vc10/testzlibdll.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {fa61a89f-93fc-4c89-b29e-36224b7592f4} - cpp;c;cxx;def;odl;idl;hpj;bat;asm - - - {d4b85da0-2ba2-4934-b57f-e2584e3848ee} - h;hpp;hxx;hm;inl;inc - - - {e573e075-00bd-4a7d-bd67-a8cc9bfc5aca} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - - - Source Files - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/zlib.rc b/compat/zlib/contrib/vstudio/vc10/zlib.rc deleted file mode 100644 index fee177a..0000000 --- a/compat/zlib/contrib/vstudio/vc10/zlib.rc +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#define IDR_VERSION1 1 -IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 2, 11, 0 - PRODUCTVERSION 1, 2, 11, 0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS 0 - FILEOS VOS_DOS_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0 // not used -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - //language ID = U.S. English, char set = Windows, Multilingual - - BEGIN - VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.11\0" - VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlibwapi.dll\0" - VALUE "ProductName", "ZLib.DLL\0" - VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj b/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj deleted file mode 100644 index b9f2bbe..0000000 --- a/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj +++ /dev/null @@ -1,473 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - ReleaseWithoutAsm - Itanium - - - ReleaseWithoutAsm - Win32 - - - ReleaseWithoutAsm - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} - - - - StaticLibrary - false - - - StaticLibrary - false - - - StaticLibrary - false - - - StaticLibrary - false - - - StaticLibrary - false - - - StaticLibrary - false - - - StaticLibrary - false - - - StaticLibrary - false - - - StaticLibrary - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\ZlibStat$(Configuration)\ - x86\ZlibStat$(Configuration)\Tmp\ - x86\ZlibStat$(Configuration)\ - x86\ZlibStat$(Configuration)\Tmp\ - x86\ZlibStat$(Configuration)\ - x86\ZlibStat$(Configuration)\Tmp\ - x64\ZlibStat$(Configuration)\ - x64\ZlibStat$(Configuration)\Tmp\ - ia64\ZlibStat$(Configuration)\ - ia64\ZlibStat$(Configuration)\Tmp\ - x64\ZlibStat$(Configuration)\ - x64\ZlibStat$(Configuration)\Tmp\ - ia64\ZlibStat$(Configuration)\ - ia64\ZlibStat$(Configuration)\Tmp\ - x64\ZlibStat$(Configuration)\ - x64\ZlibStat$(Configuration)\Tmp\ - ia64\ZlibStat$(Configuration)\ - ia64\ZlibStat$(Configuration)\Tmp\ - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - - - MultiThreadedDebug - false - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - OldStyle - - - 0x040c - - - /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - cd ..\..\masmx86 -bld_ml32.bat - - - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions) - true - - - MultiThreaded - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibstat.lib - true - - - cd ..\..\masmx86 -bld_ml32.bat - - - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - MultiThreaded - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - X64 - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - OldStyle - - - 0x040c - - - /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - cd ..\..\masmx64 -bld_ml64.bat - - - - - Itanium - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - OldStyle - - - 0x040c - - - /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - X64 - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibstat.lib - true - - - cd ..\..\masmx64 -bld_ml64.bat - - - - - Itanium - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - X64 - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - Itanium - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters b/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters deleted file mode 100644 index c8c7f7e..0000000 --- a/compat/zlib/contrib/vstudio/vc10/zlibstat.vcxproj.filters +++ /dev/null @@ -1,77 +0,0 @@ - - - - - {174213f6-7f66-4ae8-a3a8-a1e0a1e6ffdd} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - - - - Source Files - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/zlibvc.def b/compat/zlib/contrib/vstudio/vc10/zlibvc.def deleted file mode 100644 index 54e683d..0000000 --- a/compat/zlib/contrib/vstudio/vc10/zlibvc.def +++ /dev/null @@ -1,153 +0,0 @@ -LIBRARY -; zlib data compression and ZIP file I/O library - -VERSION 1.2 - -EXPORTS - adler32 @1 - compress @2 - crc32 @3 - deflate @4 - deflateCopy @5 - deflateEnd @6 - deflateInit2_ @7 - deflateInit_ @8 - deflateParams @9 - deflateReset @10 - deflateSetDictionary @11 - gzclose @12 - gzdopen @13 - gzerror @14 - gzflush @15 - gzopen @16 - gzread @17 - gzwrite @18 - inflate @19 - inflateEnd @20 - inflateInit2_ @21 - inflateInit_ @22 - inflateReset @23 - inflateSetDictionary @24 - inflateSync @25 - uncompress @26 - zlibVersion @27 - gzprintf @28 - gzputc @29 - gzgetc @30 - gzseek @31 - gzrewind @32 - gztell @33 - gzeof @34 - gzsetparams @35 - zError @36 - inflateSyncPoint @37 - get_crc_table @38 - compress2 @39 - gzputs @40 - gzgets @41 - inflateCopy @42 - inflateBackInit_ @43 - inflateBack @44 - inflateBackEnd @45 - compressBound @46 - deflateBound @47 - gzclearerr @48 - gzungetc @49 - zlibCompileFlags @50 - deflatePrime @51 - deflatePending @52 - - unzOpen @61 - unzClose @62 - unzGetGlobalInfo @63 - unzGetCurrentFileInfo @64 - unzGoToFirstFile @65 - unzGoToNextFile @66 - unzOpenCurrentFile @67 - unzReadCurrentFile @68 - unzOpenCurrentFile3 @69 - unztell @70 - unzeof @71 - unzCloseCurrentFile @72 - unzGetGlobalComment @73 - unzStringFileNameCompare @74 - unzLocateFile @75 - unzGetLocalExtrafield @76 - unzOpen2 @77 - unzOpenCurrentFile2 @78 - unzOpenCurrentFilePassword @79 - - zipOpen @80 - zipOpenNewFileInZip @81 - zipWriteInFileInZip @82 - zipCloseFileInZip @83 - zipClose @84 - zipOpenNewFileInZip2 @86 - zipCloseFileInZipRaw @87 - zipOpen2 @88 - zipOpenNewFileInZip3 @89 - - unzGetFilePos @100 - unzGoToFilePos @101 - - fill_win32_filefunc @110 - -; zlibwapi v1.2.4 added: - fill_win32_filefunc64 @111 - fill_win32_filefunc64A @112 - fill_win32_filefunc64W @113 - - unzOpen64 @120 - unzOpen2_64 @121 - unzGetGlobalInfo64 @122 - unzGetCurrentFileInfo64 @124 - unzGetCurrentFileZStreamPos64 @125 - unztell64 @126 - unzGetFilePos64 @127 - unzGoToFilePos64 @128 - - zipOpen64 @130 - zipOpen2_64 @131 - zipOpenNewFileInZip64 @132 - zipOpenNewFileInZip2_64 @133 - zipOpenNewFileInZip3_64 @134 - zipOpenNewFileInZip4_64 @135 - zipCloseFileInZipRaw64 @136 - -; zlib1 v1.2.4 added: - adler32_combine @140 - crc32_combine @142 - deflateSetHeader @144 - deflateTune @145 - gzbuffer @146 - gzclose_r @147 - gzclose_w @148 - gzdirect @149 - gzoffset @150 - inflateGetHeader @156 - inflateMark @157 - inflatePrime @158 - inflateReset2 @159 - inflateUndermine @160 - -; zlib1 v1.2.6 added: - gzgetc_ @161 - inflateResetKeep @163 - deflateResetKeep @164 - -; zlib1 v1.2.7 added: - gzopen_w @165 - -; zlib1 v1.2.8 added: - inflateGetDictionary @166 - gzvprintf @167 - -; zlib1 v1.2.9 added: - inflateCodesUsed @168 - inflateValidate @169 - uncompress2 @170 - gzfread @171 - gzfwrite @172 - deflateGetDictionary @173 - adler32_z @174 - crc32_z @175 diff --git a/compat/zlib/contrib/vstudio/vc10/zlibvc.sln b/compat/zlib/contrib/vstudio/vc10/zlibvc.sln deleted file mode 100644 index 6f6ffd5..0000000 --- a/compat/zlib/contrib/vstudio/vc10/zlibvc.sln +++ /dev/null @@ -1,135 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcxproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcxproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlibdll", "testzlibdll.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcxproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Itanium = Debug|Itanium - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Itanium = Release|Itanium - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - ReleaseWithoutAsm|Itanium = ReleaseWithoutAsm|Itanium - ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32 - ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.ActiveCfg = Debug|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.Build.0 = Debug|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.ActiveCfg = Release|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.Build.0 = Release|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = Release|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = Release|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.ActiveCfg = Debug|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.Build.0 = Debug|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.ActiveCfg = Release|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.Build.0 = Release|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.Build.0 = Debug|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.Build.0 = Release|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.ActiveCfg = Debug|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.Build.0 = Debug|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.Build.0 = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.Build.0 = Debug|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.Build.0 = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.ActiveCfg = Debug|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.Build.0 = Debug|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.Build.0 = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj b/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj deleted file mode 100644 index 6ff9ddb..0000000 --- a/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj +++ /dev/null @@ -1,657 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - ReleaseWithoutAsm - Itanium - - - ReleaseWithoutAsm - Win32 - - - ReleaseWithoutAsm - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {8FD826F8-3739-44E6-8CC8-997122E53B8D} - - - - DynamicLibrary - false - true - - - DynamicLibrary - false - true - - - DynamicLibrary - false - - - DynamicLibrary - false - true - - - DynamicLibrary - false - true - - - DynamicLibrary - false - - - DynamicLibrary - false - true - - - DynamicLibrary - false - true - - - DynamicLibrary - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\ZlibDll$(Configuration)\ - x86\ZlibDll$(Configuration)\Tmp\ - true - false - x86\ZlibDll$(Configuration)\ - x86\ZlibDll$(Configuration)\Tmp\ - false - false - x86\ZlibDll$(Configuration)\ - x86\ZlibDll$(Configuration)\Tmp\ - false - false - x64\ZlibDll$(Configuration)\ - x64\ZlibDll$(Configuration)\Tmp\ - true - false - ia64\ZlibDll$(Configuration)\ - ia64\ZlibDll$(Configuration)\Tmp\ - true - false - x64\ZlibDll$(Configuration)\ - x64\ZlibDll$(Configuration)\Tmp\ - false - false - ia64\ZlibDll$(Configuration)\ - ia64\ZlibDll$(Configuration)\Tmp\ - false - false - x64\ZlibDll$(Configuration)\ - x64\ZlibDll$(Configuration)\Tmp\ - false - false - ia64\ZlibDll$(Configuration)\ - ia64\ZlibDll$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - zlibwapid - zlibwapi - zlibwapi - zlibwapid - zlibwapi - zlibwapi - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - $(OutDir)zlibvc.tlb - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) - - - MultiThreadedDebug - false - $(IntDir)zlibvc.pch - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - true - .\zlibvc.def - true - true - Windows - false - - - - - cd ..\..\masmx86 -bld_ml32.bat - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - /MACHINE:I386 %(AdditionalOptions) - true - false - .\zlibvc.def - true - Windows - false - - - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) - true - - - MultiThreaded - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - true - false - .\zlibvc.def - true - Windows - false - - - - - cd ..\..\masmx86 -bld_ml32.bat - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - X64 - $(OutDir)zlibvc.tlb - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibvc.pch - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - true - .\zlibvc.def - true - true - Windows - MachineX64 - - - cd ..\..\masmx64 -bld_ml64.bat - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Itanium - $(OutDir)zlibvc.tlb - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibvc.pch - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - .\zlibvc.def - true - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineIA64 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - X64 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - true - false - .\zlibvc.def - true - Windows - MachineX64 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Itanium - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineIA64 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - X64 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - true - false - .\zlibvc.def - true - Windows - MachineX64 - - - cd ..\..\masmx64 -bld_ml64.bat - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Itanium - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineIA64 - - - - - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - - - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.filters b/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.filters deleted file mode 100644 index 180b71c..0000000 --- a/compat/zlib/contrib/vstudio/vc10/zlibvc.vcxproj.filters +++ /dev/null @@ -1,118 +0,0 @@ - - - - - {07934a85-8b61-443d-a0ee-b2eedb74f3cd} - cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90 - - - {1d99675b-433d-4a21-9e50-ed4ab8b19762} - h;hpp;hxx;hm;inl;fi;fd - - - {431c0958-fa71-44d0-9084-2d19d100c0cc} - ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj b/compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj deleted file mode 100644 index 8f9f20b..0000000 --- a/compat/zlib/contrib/vstudio/vc11/miniunz.vcxproj +++ /dev/null @@ -1,314 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {C52F9E7B-498A-42BE-8DB4-85A15694382A} - Win32Proj - - - - Application - MultiByte - v110 - - - Application - Unicode - v110 - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - v110 - - - Application - MultiByte - v110 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\MiniUnzip$(Configuration)\ - x86\MiniUnzip$(Configuration)\Tmp\ - true - false - x86\MiniUnzip$(Configuration)\ - x86\MiniUnzip$(Configuration)\Tmp\ - false - false - x64\MiniUnzip$(Configuration)\ - x64\MiniUnzip$(Configuration)\Tmp\ - true - false - ia64\MiniUnzip$(Configuration)\ - ia64\MiniUnzip$(Configuration)\Tmp\ - true - false - x64\MiniUnzip$(Configuration)\ - x64\MiniUnzip$(Configuration)\Tmp\ - false - false - ia64\MiniUnzip$(Configuration)\ - ia64\MiniUnzip$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - $(OutDir)miniunz.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - Console - true - true - false - - - MachineX86 - - - - - X64 - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - $(OutDir)miniunz.pdb - Console - MachineX64 - - - - - Itanium - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - $(OutDir)miniunz.pdb - Console - MachineIA64 - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - Console - true - true - MachineX64 - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - Console - true - true - MachineIA64 - - - - - - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc11/minizip.vcxproj b/compat/zlib/contrib/vstudio/vc11/minizip.vcxproj deleted file mode 100644 index c93d9e6..0000000 --- a/compat/zlib/contrib/vstudio/vc11/minizip.vcxproj +++ /dev/null @@ -1,311 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B} - Win32Proj - - - - Application - MultiByte - v110 - - - Application - Unicode - v110 - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - v110 - - - Application - MultiByte - v110 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\MiniZip$(Configuration)\ - x86\MiniZip$(Configuration)\Tmp\ - true - false - x86\MiniZip$(Configuration)\ - x86\MiniZip$(Configuration)\Tmp\ - false - x64\$(Configuration)\ - x64\$(Configuration)\ - true - false - ia64\$(Configuration)\ - ia64\$(Configuration)\ - true - false - x64\$(Configuration)\ - x64\$(Configuration)\ - false - ia64\$(Configuration)\ - ia64\$(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - $(OutDir)minizip.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - Console - true - true - false - - - MachineX86 - - - - - X64 - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - $(OutDir)minizip.pdb - Console - MachineX64 - - - - - Itanium - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - $(OutDir)minizip.pdb - Console - MachineIA64 - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - Console - true - true - MachineX64 - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - Console - true - true - MachineIA64 - - - - - - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj b/compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj deleted file mode 100644 index 6d55954..0000000 --- a/compat/zlib/contrib/vstudio/vc11/testzlib.vcxproj +++ /dev/null @@ -1,426 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - ReleaseWithoutAsm - Itanium - - - ReleaseWithoutAsm - Win32 - - - ReleaseWithoutAsm - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B} - testzlib - Win32Proj - - - - Application - MultiByte - true - v110 - - - Application - MultiByte - true - v110 - - - Application - Unicode - v110 - - - Application - MultiByte - true - - - Application - MultiByte - true - - - Application - MultiByte - - - Application - true - v110 - - - Application - true - v110 - - - Application - v110 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\TestZlib$(Configuration)\ - x86\TestZlib$(Configuration)\Tmp\ - true - false - x86\TestZlib$(Configuration)\ - x86\TestZlib$(Configuration)\Tmp\ - false - false - x86\TestZlib$(Configuration)\ - x86\TestZlib$(Configuration)\Tmp\ - false - false - x64\TestZlib$(Configuration)\ - x64\TestZlib$(Configuration)\Tmp\ - false - ia64\TestZlib$(Configuration)\ - ia64\TestZlib$(Configuration)\Tmp\ - true - false - x64\TestZlib$(Configuration)\ - x64\TestZlib$(Configuration)\Tmp\ - false - ia64\TestZlib$(Configuration)\ - ia64\TestZlib$(Configuration)\Tmp\ - false - false - x64\TestZlib$(Configuration)\ - x64\TestZlib$(Configuration)\Tmp\ - false - ia64\TestZlib$(Configuration)\ - ia64\TestZlib$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - AssemblyAndSourceCode - $(IntDir) - Level3 - ProgramDatabase - - - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)testzlib.exe - true - $(OutDir)testzlib.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - Console - true - true - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)testzlib.exe - true - Console - true - true - false - - - MachineX86 - - - - - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - Default - MultiThreadedDebugDLL - false - $(IntDir) - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - - - - - Itanium - - - Disabled - ..\..\..;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - AssemblyAndSourceCode - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - $(OutDir)testzlib.pdb - Console - MachineIA64 - - - - - ..\..\..;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - Default - MultiThreadedDLL - false - $(IntDir) - - - %(AdditionalDependencies) - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - Console - true - true - MachineIA64 - - - - - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - Default - MultiThreadedDLL - false - $(IntDir) - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - Console - true - true - MachineIA64 - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj b/compat/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj deleted file mode 100644 index 9f20c78..0000000 --- a/compat/zlib/contrib/vstudio/vc11/testzlibdll.vcxproj +++ /dev/null @@ -1,314 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {C52F9E7B-498A-42BE-8DB4-85A15694366A} - Win32Proj - - - - Application - MultiByte - v110 - - - Application - Unicode - v110 - - - Application - MultiByte - - - Application - MultiByte - - - Application - MultiByte - v110 - - - Application - MultiByte - v110 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\TestZlibDll$(Configuration)\ - x86\TestZlibDll$(Configuration)\Tmp\ - true - false - x86\TestZlibDll$(Configuration)\ - x86\TestZlibDll$(Configuration)\Tmp\ - false - false - x64\TestZlibDll$(Configuration)\ - x64\TestZlibDll$(Configuration)\Tmp\ - true - false - ia64\TestZlibDll$(Configuration)\ - ia64\TestZlibDll$(Configuration)\Tmp\ - true - false - x64\TestZlibDll$(Configuration)\ - x64\TestZlibDll$(Configuration)\Tmp\ - false - false - ia64\TestZlibDll$(Configuration)\ - ia64\TestZlibDll$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - $(OutDir)testzlib.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - Console - true - true - false - - - MachineX86 - - - - - X64 - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - $(OutDir)testzlib.pdb - Console - MachineX64 - - - - - Itanium - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - $(OutDir)testzlib.pdb - Console - MachineIA64 - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - Console - true - true - MachineX64 - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - Console - true - true - MachineIA64 - - - - - - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc11/zlib.rc b/compat/zlib/contrib/vstudio/vc11/zlib.rc deleted file mode 100644 index fee177a..0000000 --- a/compat/zlib/contrib/vstudio/vc11/zlib.rc +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#define IDR_VERSION1 1 -IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 2, 11, 0 - PRODUCTVERSION 1, 2, 11, 0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS 0 - FILEOS VOS_DOS_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0 // not used -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - //language ID = U.S. English, char set = Windows, Multilingual - - BEGIN - VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.11\0" - VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlibwapi.dll\0" - VALUE "ProductName", "ZLib.DLL\0" - VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj b/compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj deleted file mode 100644 index 806b76a..0000000 --- a/compat/zlib/contrib/vstudio/vc11/zlibstat.vcxproj +++ /dev/null @@ -1,464 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - ReleaseWithoutAsm - Itanium - - - ReleaseWithoutAsm - Win32 - - - ReleaseWithoutAsm - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} - - - - StaticLibrary - false - v110 - - - StaticLibrary - false - v110 - - - StaticLibrary - false - v110 - Unicode - - - StaticLibrary - false - - - StaticLibrary - false - - - StaticLibrary - false - - - StaticLibrary - false - v110 - - - StaticLibrary - false - v110 - - - StaticLibrary - false - v110 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\ZlibStat$(Configuration)\ - x86\ZlibStat$(Configuration)\Tmp\ - x86\ZlibStat$(Configuration)\ - x86\ZlibStat$(Configuration)\Tmp\ - x86\ZlibStat$(Configuration)\ - x86\ZlibStat$(Configuration)\Tmp\ - x64\ZlibStat$(Configuration)\ - x64\ZlibStat$(Configuration)\Tmp\ - ia64\ZlibStat$(Configuration)\ - ia64\ZlibStat$(Configuration)\Tmp\ - x64\ZlibStat$(Configuration)\ - x64\ZlibStat$(Configuration)\Tmp\ - ia64\ZlibStat$(Configuration)\ - ia64\ZlibStat$(Configuration)\Tmp\ - x64\ZlibStat$(Configuration)\ - x64\ZlibStat$(Configuration)\Tmp\ - ia64\ZlibStat$(Configuration)\ - ia64\ZlibStat$(Configuration)\Tmp\ - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - OldStyle - - - 0x040c - - - /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions) - true - - - MultiThreaded - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibstat.lib - true - - - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - MultiThreaded - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - X64 - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - OldStyle - - - 0x040c - - - /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - Itanium - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - OldStyle - - - 0x040c - - - /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - X64 - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibstat.lib - true - - - - - Itanium - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - X64 - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - Itanium - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc11/zlibvc.def b/compat/zlib/contrib/vstudio/vc11/zlibvc.def deleted file mode 100644 index 54e683d..0000000 --- a/compat/zlib/contrib/vstudio/vc11/zlibvc.def +++ /dev/null @@ -1,153 +0,0 @@ -LIBRARY -; zlib data compression and ZIP file I/O library - -VERSION 1.2 - -EXPORTS - adler32 @1 - compress @2 - crc32 @3 - deflate @4 - deflateCopy @5 - deflateEnd @6 - deflateInit2_ @7 - deflateInit_ @8 - deflateParams @9 - deflateReset @10 - deflateSetDictionary @11 - gzclose @12 - gzdopen @13 - gzerror @14 - gzflush @15 - gzopen @16 - gzread @17 - gzwrite @18 - inflate @19 - inflateEnd @20 - inflateInit2_ @21 - inflateInit_ @22 - inflateReset @23 - inflateSetDictionary @24 - inflateSync @25 - uncompress @26 - zlibVersion @27 - gzprintf @28 - gzputc @29 - gzgetc @30 - gzseek @31 - gzrewind @32 - gztell @33 - gzeof @34 - gzsetparams @35 - zError @36 - inflateSyncPoint @37 - get_crc_table @38 - compress2 @39 - gzputs @40 - gzgets @41 - inflateCopy @42 - inflateBackInit_ @43 - inflateBack @44 - inflateBackEnd @45 - compressBound @46 - deflateBound @47 - gzclearerr @48 - gzungetc @49 - zlibCompileFlags @50 - deflatePrime @51 - deflatePending @52 - - unzOpen @61 - unzClose @62 - unzGetGlobalInfo @63 - unzGetCurrentFileInfo @64 - unzGoToFirstFile @65 - unzGoToNextFile @66 - unzOpenCurrentFile @67 - unzReadCurrentFile @68 - unzOpenCurrentFile3 @69 - unztell @70 - unzeof @71 - unzCloseCurrentFile @72 - unzGetGlobalComment @73 - unzStringFileNameCompare @74 - unzLocateFile @75 - unzGetLocalExtrafield @76 - unzOpen2 @77 - unzOpenCurrentFile2 @78 - unzOpenCurrentFilePassword @79 - - zipOpen @80 - zipOpenNewFileInZip @81 - zipWriteInFileInZip @82 - zipCloseFileInZip @83 - zipClose @84 - zipOpenNewFileInZip2 @86 - zipCloseFileInZipRaw @87 - zipOpen2 @88 - zipOpenNewFileInZip3 @89 - - unzGetFilePos @100 - unzGoToFilePos @101 - - fill_win32_filefunc @110 - -; zlibwapi v1.2.4 added: - fill_win32_filefunc64 @111 - fill_win32_filefunc64A @112 - fill_win32_filefunc64W @113 - - unzOpen64 @120 - unzOpen2_64 @121 - unzGetGlobalInfo64 @122 - unzGetCurrentFileInfo64 @124 - unzGetCurrentFileZStreamPos64 @125 - unztell64 @126 - unzGetFilePos64 @127 - unzGoToFilePos64 @128 - - zipOpen64 @130 - zipOpen2_64 @131 - zipOpenNewFileInZip64 @132 - zipOpenNewFileInZip2_64 @133 - zipOpenNewFileInZip3_64 @134 - zipOpenNewFileInZip4_64 @135 - zipCloseFileInZipRaw64 @136 - -; zlib1 v1.2.4 added: - adler32_combine @140 - crc32_combine @142 - deflateSetHeader @144 - deflateTune @145 - gzbuffer @146 - gzclose_r @147 - gzclose_w @148 - gzdirect @149 - gzoffset @150 - inflateGetHeader @156 - inflateMark @157 - inflatePrime @158 - inflateReset2 @159 - inflateUndermine @160 - -; zlib1 v1.2.6 added: - gzgetc_ @161 - inflateResetKeep @163 - deflateResetKeep @164 - -; zlib1 v1.2.7 added: - gzopen_w @165 - -; zlib1 v1.2.8 added: - inflateGetDictionary @166 - gzvprintf @167 - -; zlib1 v1.2.9 added: - inflateCodesUsed @168 - inflateValidate @169 - uncompress2 @170 - gzfread @171 - gzfwrite @172 - deflateGetDictionary @173 - adler32_z @174 - crc32_z @175 diff --git a/compat/zlib/contrib/vstudio/vc11/zlibvc.sln b/compat/zlib/contrib/vstudio/vc11/zlibvc.sln deleted file mode 100644 index 9fcbafd..0000000 --- a/compat/zlib/contrib/vstudio/vc11/zlibvc.sln +++ /dev/null @@ -1,117 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcxproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcxproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlibdll", "testzlibdll.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcxproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Itanium = Debug|Itanium - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Itanium = Release|Itanium - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - ReleaseWithoutAsm|Itanium = ReleaseWithoutAsm|Itanium - ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32 - ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.ActiveCfg = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.ActiveCfg = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = Release|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = Release|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.ActiveCfg = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.ActiveCfg = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj b/compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj deleted file mode 100644 index c65b95f..0000000 --- a/compat/zlib/contrib/vstudio/vc11/zlibvc.vcxproj +++ /dev/null @@ -1,688 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - ReleaseWithoutAsm - Itanium - - - ReleaseWithoutAsm - Win32 - - - ReleaseWithoutAsm - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {8FD826F8-3739-44E6-8CC8-997122E53B8D} - - - - DynamicLibrary - false - true - v110 - - - DynamicLibrary - false - true - v110 - - - DynamicLibrary - false - v110 - Unicode - - - DynamicLibrary - false - true - - - DynamicLibrary - false - true - - - DynamicLibrary - false - - - DynamicLibrary - false - true - v110 - - - DynamicLibrary - false - true - v110 - - - DynamicLibrary - false - v110 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\ZlibDll$(Configuration)\ - x86\ZlibDll$(Configuration)\Tmp\ - true - false - x86\ZlibDll$(Configuration)\ - x86\ZlibDll$(Configuration)\Tmp\ - false - false - x86\ZlibDll$(Configuration)\ - x86\ZlibDll$(Configuration)\Tmp\ - false - false - x64\ZlibDll$(Configuration)\ - x64\ZlibDll$(Configuration)\Tmp\ - true - false - ia64\ZlibDll$(Configuration)\ - ia64\ZlibDll$(Configuration)\Tmp\ - true - false - x64\ZlibDll$(Configuration)\ - x64\ZlibDll$(Configuration)\Tmp\ - false - false - ia64\ZlibDll$(Configuration)\ - ia64\ZlibDll$(Configuration)\Tmp\ - false - false - x64\ZlibDll$(Configuration)\ - x64\ZlibDll$(Configuration)\Tmp\ - false - false - ia64\ZlibDll$(Configuration)\ - ia64\ZlibDll$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - zlibwapi - zlibwapi - zlibwapi - zlibwapi - zlibwapi - zlibwapi - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - $(OutDir)zlibvc.tlb - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibvc.pch - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll - true - .\zlibvc.def - true - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - false - - - $(OutDir)zlibwapi.lib - - - cd ..\..\masmx86 -bld_ml32.bat - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - /MACHINE:I386 %(AdditionalOptions) - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - false - - - $(OutDir)zlibwapi.lib - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) - true - - - MultiThreaded - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - false - - - $(OutDir)zlibwapi.lib - - - cd ..\..\masmx86 -bld_ml32.bat - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - X64 - $(OutDir)zlibvc.tlb - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibvc.pch - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll - true - .\zlibvc.def - true - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineX64 - - - cd ..\..\contrib\masmx64 -bld_ml64.bat - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Itanium - $(OutDir)zlibvc.tlb - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibvc.pch - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - .\zlibvc.def - true - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineIA64 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - X64 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineX64 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Itanium - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineIA64 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - X64 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineX64 - - - cd ..\..\masmx64 -bld_ml64.bat - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Itanium - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineIA64 - - - - - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - - - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc12/miniunz.vcxproj b/compat/zlib/contrib/vstudio/vc12/miniunz.vcxproj deleted file mode 100644 index d88ac7f..0000000 --- a/compat/zlib/contrib/vstudio/vc12/miniunz.vcxproj +++ /dev/null @@ -1,316 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {C52F9E7B-498A-42BE-8DB4-85A15694382A} - Win32Proj - - - - Application - MultiByte - v120 - - - Application - Unicode - v120 - - - Application - MultiByte - v120 - - - Application - MultiByte - v120 - - - Application - MultiByte - v120 - - - Application - MultiByte - v120 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\MiniUnzip$(Configuration)\ - x86\MiniUnzip$(Configuration)\Tmp\ - true - false - x86\MiniUnzip$(Configuration)\ - x86\MiniUnzip$(Configuration)\Tmp\ - false - false - x64\MiniUnzip$(Configuration)\ - x64\MiniUnzip$(Configuration)\Tmp\ - true - false - ia64\MiniUnzip$(Configuration)\ - ia64\MiniUnzip$(Configuration)\Tmp\ - true - false - x64\MiniUnzip$(Configuration)\ - x64\MiniUnzip$(Configuration)\Tmp\ - false - false - ia64\MiniUnzip$(Configuration)\ - ia64\MiniUnzip$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - $(OutDir)miniunz.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - Console - true - true - false - - - MachineX86 - - - - - X64 - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - $(OutDir)miniunz.pdb - Console - MachineX64 - - - - - Itanium - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - $(OutDir)miniunz.pdb - Console - MachineIA64 - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - Console - true - true - MachineX64 - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - Console - true - true - MachineIA64 - - - - - - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc12/minizip.vcxproj b/compat/zlib/contrib/vstudio/vc12/minizip.vcxproj deleted file mode 100644 index f1f239c..0000000 --- a/compat/zlib/contrib/vstudio/vc12/minizip.vcxproj +++ /dev/null @@ -1,313 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B} - Win32Proj - - - - Application - MultiByte - v120 - - - Application - Unicode - v120 - - - Application - MultiByte - v120 - - - Application - MultiByte - v120 - - - Application - MultiByte - v120 - - - Application - MultiByte - v120 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\MiniZip$(Configuration)\ - x86\MiniZip$(Configuration)\Tmp\ - true - false - x86\MiniZip$(Configuration)\ - x86\MiniZip$(Configuration)\Tmp\ - false - x64\$(Configuration)\ - x64\$(Configuration)\ - true - false - ia64\$(Configuration)\ - ia64\$(Configuration)\ - true - false - x64\$(Configuration)\ - x64\$(Configuration)\ - false - ia64\$(Configuration)\ - ia64\$(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - $(OutDir)minizip.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - Console - true - true - false - - - MachineX86 - - - - - X64 - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - $(OutDir)minizip.pdb - Console - MachineX64 - - - - - Itanium - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - $(OutDir)minizip.pdb - Console - MachineIA64 - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - Console - true - true - MachineX64 - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - Console - true - true - MachineIA64 - - - - - - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc12/testzlib.vcxproj b/compat/zlib/contrib/vstudio/vc12/testzlib.vcxproj deleted file mode 100644 index 64b2cbe..0000000 --- a/compat/zlib/contrib/vstudio/vc12/testzlib.vcxproj +++ /dev/null @@ -1,430 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - ReleaseWithoutAsm - Itanium - - - ReleaseWithoutAsm - Win32 - - - ReleaseWithoutAsm - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B} - testzlib - Win32Proj - - - - Application - MultiByte - true - v120 - - - Application - MultiByte - true - v120 - - - Application - Unicode - v120 - - - Application - MultiByte - true - v120 - - - Application - MultiByte - true - v120 - - - Application - MultiByte - v120 - - - Application - true - v120 - - - Application - true - v120 - - - Application - v120 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\TestZlib$(Configuration)\ - x86\TestZlib$(Configuration)\Tmp\ - true - false - x86\TestZlib$(Configuration)\ - x86\TestZlib$(Configuration)\Tmp\ - false - false - x86\TestZlib$(Configuration)\ - x86\TestZlib$(Configuration)\Tmp\ - false - false - x64\TestZlib$(Configuration)\ - x64\TestZlib$(Configuration)\Tmp\ - false - ia64\TestZlib$(Configuration)\ - ia64\TestZlib$(Configuration)\Tmp\ - true - false - x64\TestZlib$(Configuration)\ - x64\TestZlib$(Configuration)\Tmp\ - false - ia64\TestZlib$(Configuration)\ - ia64\TestZlib$(Configuration)\Tmp\ - false - false - x64\TestZlib$(Configuration)\ - x64\TestZlib$(Configuration)\Tmp\ - false - ia64\TestZlib$(Configuration)\ - ia64\TestZlib$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - AssemblyAndSourceCode - $(IntDir) - Level3 - ProgramDatabase - - - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)testzlib.exe - true - $(OutDir)testzlib.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - Console - true - true - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)testzlib.exe - true - Console - true - true - false - - - MachineX86 - false - - - - - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - Default - MultiThreadedDebugDLL - false - $(IntDir) - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - - - - - Itanium - - - Disabled - ..\..\..;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - AssemblyAndSourceCode - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - $(OutDir)testzlib.pdb - Console - MachineIA64 - - - - - ..\..\..;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - Default - MultiThreadedDLL - false - $(IntDir) - - - %(AdditionalDependencies) - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - Console - true - true - MachineIA64 - - - - - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - Default - MultiThreadedDLL - false - $(IntDir) - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - Console - true - true - MachineIA64 - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc12/testzlibdll.vcxproj b/compat/zlib/contrib/vstudio/vc12/testzlibdll.vcxproj deleted file mode 100644 index c66573a..0000000 --- a/compat/zlib/contrib/vstudio/vc12/testzlibdll.vcxproj +++ /dev/null @@ -1,316 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {C52F9E7B-498A-42BE-8DB4-85A15694366A} - Win32Proj - - - - Application - MultiByte - v120 - - - Application - Unicode - v120 - - - Application - MultiByte - v120 - - - Application - MultiByte - v120 - - - Application - MultiByte - v120 - - - Application - MultiByte - v120 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\TestZlibDll$(Configuration)\ - x86\TestZlibDll$(Configuration)\Tmp\ - true - false - x86\TestZlibDll$(Configuration)\ - x86\TestZlibDll$(Configuration)\Tmp\ - false - false - x64\TestZlibDll$(Configuration)\ - x64\TestZlibDll$(Configuration)\Tmp\ - true - false - ia64\TestZlibDll$(Configuration)\ - ia64\TestZlibDll$(Configuration)\Tmp\ - true - false - x64\TestZlibDll$(Configuration)\ - x64\TestZlibDll$(Configuration)\Tmp\ - false - false - ia64\TestZlibDll$(Configuration)\ - ia64\TestZlibDll$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - $(OutDir)testzlib.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - Console - true - true - false - - - MachineX86 - - - - - X64 - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - $(OutDir)testzlib.pdb - Console - MachineX64 - - - - - Itanium - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - $(OutDir)testzlib.pdb - Console - MachineIA64 - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - Console - true - true - MachineX64 - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - Console - true - true - MachineIA64 - - - - - - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc12/zlib.rc b/compat/zlib/contrib/vstudio/vc12/zlib.rc deleted file mode 100644 index c4e4b01..0000000 --- a/compat/zlib/contrib/vstudio/vc12/zlib.rc +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#define IDR_VERSION1 1 -IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 2, 11, 0 - PRODUCTVERSION 1, 2, 11, 0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS 0 - FILEOS VOS_DOS_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0 // not used -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - //language ID = U.S. English, char set = Windows, Multilingual - - BEGIN - VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.11\0" - VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlibwapi.dll\0" - VALUE "ProductName", "ZLib.DLL\0" - VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/compat/zlib/contrib/vstudio/vc12/zlibstat.vcxproj b/compat/zlib/contrib/vstudio/vc12/zlibstat.vcxproj deleted file mode 100644 index 3fdee7c..0000000 --- a/compat/zlib/contrib/vstudio/vc12/zlibstat.vcxproj +++ /dev/null @@ -1,467 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - ReleaseWithoutAsm - Itanium - - - ReleaseWithoutAsm - Win32 - - - ReleaseWithoutAsm - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} - - - - StaticLibrary - false - v120 - - - StaticLibrary - false - v120 - - - StaticLibrary - false - v120 - Unicode - - - StaticLibrary - false - v120 - - - StaticLibrary - false - v120 - - - StaticLibrary - false - v120 - - - StaticLibrary - false - v120 - - - StaticLibrary - false - v120 - - - StaticLibrary - false - v120 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\ZlibStat$(Configuration)\ - x86\ZlibStat$(Configuration)\Tmp\ - x86\ZlibStat$(Configuration)\ - x86\ZlibStat$(Configuration)\Tmp\ - x86\ZlibStat$(Configuration)\ - x86\ZlibStat$(Configuration)\Tmp\ - x64\ZlibStat$(Configuration)\ - x64\ZlibStat$(Configuration)\Tmp\ - ia64\ZlibStat$(Configuration)\ - ia64\ZlibStat$(Configuration)\Tmp\ - x64\ZlibStat$(Configuration)\ - x64\ZlibStat$(Configuration)\Tmp\ - ia64\ZlibStat$(Configuration)\ - ia64\ZlibStat$(Configuration)\Tmp\ - x64\ZlibStat$(Configuration)\ - x64\ZlibStat$(Configuration)\Tmp\ - ia64\ZlibStat$(Configuration)\ - ia64\ZlibStat$(Configuration)\Tmp\ - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - OldStyle - - - 0x040c - - - /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions) - true - - - MultiThreaded - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibstat.lib - true - - - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - MultiThreaded - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - X64 - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - OldStyle - - - 0x040c - - - /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - Itanium - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - OldStyle - - - 0x040c - - - /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - X64 - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibstat.lib - true - - - - - Itanium - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - X64 - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - Itanium - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc12/zlibvc.def b/compat/zlib/contrib/vstudio/vc12/zlibvc.def deleted file mode 100644 index 54e683d..0000000 --- a/compat/zlib/contrib/vstudio/vc12/zlibvc.def +++ /dev/null @@ -1,153 +0,0 @@ -LIBRARY -; zlib data compression and ZIP file I/O library - -VERSION 1.2 - -EXPORTS - adler32 @1 - compress @2 - crc32 @3 - deflate @4 - deflateCopy @5 - deflateEnd @6 - deflateInit2_ @7 - deflateInit_ @8 - deflateParams @9 - deflateReset @10 - deflateSetDictionary @11 - gzclose @12 - gzdopen @13 - gzerror @14 - gzflush @15 - gzopen @16 - gzread @17 - gzwrite @18 - inflate @19 - inflateEnd @20 - inflateInit2_ @21 - inflateInit_ @22 - inflateReset @23 - inflateSetDictionary @24 - inflateSync @25 - uncompress @26 - zlibVersion @27 - gzprintf @28 - gzputc @29 - gzgetc @30 - gzseek @31 - gzrewind @32 - gztell @33 - gzeof @34 - gzsetparams @35 - zError @36 - inflateSyncPoint @37 - get_crc_table @38 - compress2 @39 - gzputs @40 - gzgets @41 - inflateCopy @42 - inflateBackInit_ @43 - inflateBack @44 - inflateBackEnd @45 - compressBound @46 - deflateBound @47 - gzclearerr @48 - gzungetc @49 - zlibCompileFlags @50 - deflatePrime @51 - deflatePending @52 - - unzOpen @61 - unzClose @62 - unzGetGlobalInfo @63 - unzGetCurrentFileInfo @64 - unzGoToFirstFile @65 - unzGoToNextFile @66 - unzOpenCurrentFile @67 - unzReadCurrentFile @68 - unzOpenCurrentFile3 @69 - unztell @70 - unzeof @71 - unzCloseCurrentFile @72 - unzGetGlobalComment @73 - unzStringFileNameCompare @74 - unzLocateFile @75 - unzGetLocalExtrafield @76 - unzOpen2 @77 - unzOpenCurrentFile2 @78 - unzOpenCurrentFilePassword @79 - - zipOpen @80 - zipOpenNewFileInZip @81 - zipWriteInFileInZip @82 - zipCloseFileInZip @83 - zipClose @84 - zipOpenNewFileInZip2 @86 - zipCloseFileInZipRaw @87 - zipOpen2 @88 - zipOpenNewFileInZip3 @89 - - unzGetFilePos @100 - unzGoToFilePos @101 - - fill_win32_filefunc @110 - -; zlibwapi v1.2.4 added: - fill_win32_filefunc64 @111 - fill_win32_filefunc64A @112 - fill_win32_filefunc64W @113 - - unzOpen64 @120 - unzOpen2_64 @121 - unzGetGlobalInfo64 @122 - unzGetCurrentFileInfo64 @124 - unzGetCurrentFileZStreamPos64 @125 - unztell64 @126 - unzGetFilePos64 @127 - unzGoToFilePos64 @128 - - zipOpen64 @130 - zipOpen2_64 @131 - zipOpenNewFileInZip64 @132 - zipOpenNewFileInZip2_64 @133 - zipOpenNewFileInZip3_64 @134 - zipOpenNewFileInZip4_64 @135 - zipCloseFileInZipRaw64 @136 - -; zlib1 v1.2.4 added: - adler32_combine @140 - crc32_combine @142 - deflateSetHeader @144 - deflateTune @145 - gzbuffer @146 - gzclose_r @147 - gzclose_w @148 - gzdirect @149 - gzoffset @150 - inflateGetHeader @156 - inflateMark @157 - inflatePrime @158 - inflateReset2 @159 - inflateUndermine @160 - -; zlib1 v1.2.6 added: - gzgetc_ @161 - inflateResetKeep @163 - deflateResetKeep @164 - -; zlib1 v1.2.7 added: - gzopen_w @165 - -; zlib1 v1.2.8 added: - inflateGetDictionary @166 - gzvprintf @167 - -; zlib1 v1.2.9 added: - inflateCodesUsed @168 - inflateValidate @169 - uncompress2 @170 - gzfread @171 - gzfwrite @172 - deflateGetDictionary @173 - adler32_z @174 - crc32_z @175 diff --git a/compat/zlib/contrib/vstudio/vc12/zlibvc.sln b/compat/zlib/contrib/vstudio/vc12/zlibvc.sln deleted file mode 100644 index dcda229..0000000 --- a/compat/zlib/contrib/vstudio/vc12/zlibvc.sln +++ /dev/null @@ -1,119 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.40629.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcxproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcxproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlibdll", "testzlibdll.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcxproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Itanium = Debug|Itanium - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Itanium = Release|Itanium - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - ReleaseWithoutAsm|Itanium = ReleaseWithoutAsm|Itanium - ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32 - ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.ActiveCfg = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.ActiveCfg = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = Release|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = Release|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.ActiveCfg = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.ActiveCfg = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/compat/zlib/contrib/vstudio/vc12/zlibvc.vcxproj b/compat/zlib/contrib/vstudio/vc12/zlibvc.vcxproj deleted file mode 100644 index ab2b6c3..0000000 --- a/compat/zlib/contrib/vstudio/vc12/zlibvc.vcxproj +++ /dev/null @@ -1,692 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - ReleaseWithoutAsm - Itanium - - - ReleaseWithoutAsm - Win32 - - - ReleaseWithoutAsm - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {8FD826F8-3739-44E6-8CC8-997122E53B8D} - - - - DynamicLibrary - false - true - v120 - - - DynamicLibrary - false - true - v120 - - - DynamicLibrary - false - v120 - Unicode - - - DynamicLibrary - false - true - v120 - - - DynamicLibrary - false - true - v120 - - - DynamicLibrary - false - v120 - - - DynamicLibrary - false - true - v120 - - - DynamicLibrary - false - true - v120 - - - DynamicLibrary - false - v120 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\ZlibDll$(Configuration)\ - x86\ZlibDll$(Configuration)\Tmp\ - true - false - x86\ZlibDll$(Configuration)\ - x86\ZlibDll$(Configuration)\Tmp\ - false - false - x86\ZlibDll$(Configuration)\ - x86\ZlibDll$(Configuration)\Tmp\ - false - false - x64\ZlibDll$(Configuration)\ - x64\ZlibDll$(Configuration)\Tmp\ - true - false - ia64\ZlibDll$(Configuration)\ - ia64\ZlibDll$(Configuration)\Tmp\ - true - false - x64\ZlibDll$(Configuration)\ - x64\ZlibDll$(Configuration)\Tmp\ - false - false - ia64\ZlibDll$(Configuration)\ - ia64\ZlibDll$(Configuration)\Tmp\ - false - false - x64\ZlibDll$(Configuration)\ - x64\ZlibDll$(Configuration)\Tmp\ - false - false - ia64\ZlibDll$(Configuration)\ - ia64\ZlibDll$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - zlibwapi - zlibwapi - zlibwapi - zlibwapi - zlibwapi - zlibwapi - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - $(OutDir)zlibvc.tlb - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibvc.pch - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll - true - .\zlibvc.def - true - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - false - - - $(OutDir)zlibwapi.lib - - - cd ..\..\masmx86 -bld_ml32.bat - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - /MACHINE:I386 %(AdditionalOptions) - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - false - - - $(OutDir)zlibwapi.lib - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) - true - - - MultiThreaded - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - false - - - $(OutDir)zlibwapi.lib - false - - - cd ..\..\masmx86 -bld_ml32.bat - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - X64 - $(OutDir)zlibvc.tlb - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibvc.pch - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll - true - .\zlibvc.def - true - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineX64 - - - cd ..\..\contrib\masmx64 -bld_ml64.bat - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Itanium - $(OutDir)zlibvc.tlb - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibvc.pch - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - .\zlibvc.def - true - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineIA64 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - X64 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineX64 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Itanium - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineIA64 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - X64 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineX64 - - - cd ..\..\masmx64 -bld_ml64.bat - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Itanium - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineIA64 - - - - - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - - - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc14/miniunz.vcxproj b/compat/zlib/contrib/vstudio/vc14/miniunz.vcxproj deleted file mode 100644 index 9b5c075..0000000 --- a/compat/zlib/contrib/vstudio/vc14/miniunz.vcxproj +++ /dev/null @@ -1,316 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {C52F9E7B-498A-42BE-8DB4-85A15694382A} - Win32Proj - - - - Application - MultiByte - v140 - - - Application - Unicode - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - v140 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\MiniUnzip$(Configuration)\ - x86\MiniUnzip$(Configuration)\Tmp\ - true - false - x86\MiniUnzip$(Configuration)\ - x86\MiniUnzip$(Configuration)\Tmp\ - false - false - x64\MiniUnzip$(Configuration)\ - x64\MiniUnzip$(Configuration)\Tmp\ - true - false - ia64\MiniUnzip$(Configuration)\ - ia64\MiniUnzip$(Configuration)\Tmp\ - true - false - x64\MiniUnzip$(Configuration)\ - x64\MiniUnzip$(Configuration)\Tmp\ - false - false - ia64\MiniUnzip$(Configuration)\ - ia64\MiniUnzip$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - $(OutDir)miniunz.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - Console - true - true - false - - - MachineX86 - - - - - X64 - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - $(OutDir)miniunz.pdb - Console - MachineX64 - - - - - Itanium - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - $(OutDir)miniunz.pdb - Console - MachineIA64 - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - Console - true - true - MachineX64 - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)miniunz.exe - true - Console - true - true - MachineIA64 - - - - - - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc14/minizip.vcxproj b/compat/zlib/contrib/vstudio/vc14/minizip.vcxproj deleted file mode 100644 index 968a410..0000000 --- a/compat/zlib/contrib/vstudio/vc14/minizip.vcxproj +++ /dev/null @@ -1,313 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B} - Win32Proj - - - - Application - MultiByte - v140 - - - Application - Unicode - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - v140 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\MiniZip$(Configuration)\ - x86\MiniZip$(Configuration)\Tmp\ - true - false - x86\MiniZip$(Configuration)\ - x86\MiniZip$(Configuration)\Tmp\ - false - x64\$(Configuration)\ - x64\$(Configuration)\ - true - false - ia64\$(Configuration)\ - ia64\$(Configuration)\ - true - false - x64\$(Configuration)\ - x64\$(Configuration)\ - false - ia64\$(Configuration)\ - ia64\$(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - $(OutDir)minizip.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - Console - true - true - false - - - MachineX86 - - - - - X64 - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - $(OutDir)minizip.pdb - Console - MachineX64 - - - - - Itanium - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - $(OutDir)minizip.pdb - Console - MachineIA64 - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - Console - true - true - MachineX64 - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)minizip.exe - true - Console - true - true - MachineIA64 - - - - - - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc14/testzlib.vcxproj b/compat/zlib/contrib/vstudio/vc14/testzlib.vcxproj deleted file mode 100644 index 2c37125..0000000 --- a/compat/zlib/contrib/vstudio/vc14/testzlib.vcxproj +++ /dev/null @@ -1,430 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - ReleaseWithoutAsm - Itanium - - - ReleaseWithoutAsm - Win32 - - - ReleaseWithoutAsm - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B} - testzlib - Win32Proj - - - - Application - MultiByte - true - v140 - - - Application - MultiByte - true - v140 - - - Application - Unicode - v140 - - - Application - MultiByte - true - v140 - - - Application - MultiByte - true - v140 - - - Application - MultiByte - v140 - - - Application - true - v140 - - - Application - true - v140 - - - Application - v140 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\TestZlib$(Configuration)\ - x86\TestZlib$(Configuration)\Tmp\ - true - false - x86\TestZlib$(Configuration)\ - x86\TestZlib$(Configuration)\Tmp\ - false - false - x86\TestZlib$(Configuration)\ - x86\TestZlib$(Configuration)\Tmp\ - false - false - x64\TestZlib$(Configuration)\ - x64\TestZlib$(Configuration)\Tmp\ - false - ia64\TestZlib$(Configuration)\ - ia64\TestZlib$(Configuration)\Tmp\ - true - false - x64\TestZlib$(Configuration)\ - x64\TestZlib$(Configuration)\Tmp\ - false - ia64\TestZlib$(Configuration)\ - ia64\TestZlib$(Configuration)\Tmp\ - false - false - x64\TestZlib$(Configuration)\ - x64\TestZlib$(Configuration)\Tmp\ - false - ia64\TestZlib$(Configuration)\ - ia64\TestZlib$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - AssemblyAndSourceCode - $(IntDir) - Level3 - ProgramDatabase - - - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)testzlib.exe - true - $(OutDir)testzlib.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - Console - true - true - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)testzlib.exe - true - Console - true - true - false - - - MachineX86 - false - - - - - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - Default - MultiThreadedDebugDLL - false - $(IntDir) - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - - - - - Itanium - - - Disabled - ..\..\..;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - AssemblyAndSourceCode - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - $(OutDir)testzlib.pdb - Console - MachineIA64 - - - - - ..\..\..;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - Default - MultiThreadedDLL - false - $(IntDir) - - - %(AdditionalDependencies) - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - Console - true - true - MachineIA64 - - - - - ..\..\..;%(AdditionalIncludeDirectories) - ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - Default - MultiThreadedDLL - false - $(IntDir) - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - $(OutDir)testzlib.exe - true - Console - true - true - MachineIA64 - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc14/testzlibdll.vcxproj b/compat/zlib/contrib/vstudio/vc14/testzlibdll.vcxproj deleted file mode 100644 index d87474d..0000000 --- a/compat/zlib/contrib/vstudio/vc14/testzlibdll.vcxproj +++ /dev/null @@ -1,316 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {C52F9E7B-498A-42BE-8DB4-85A15694366A} - Win32Proj - - - - Application - MultiByte - v140 - - - Application - Unicode - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - v140 - - - Application - MultiByte - v140 - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\TestZlibDll$(Configuration)\ - x86\TestZlibDll$(Configuration)\Tmp\ - true - false - x86\TestZlibDll$(Configuration)\ - x86\TestZlibDll$(Configuration)\Tmp\ - false - false - x64\TestZlibDll$(Configuration)\ - x64\TestZlibDll$(Configuration)\Tmp\ - true - false - ia64\TestZlibDll$(Configuration)\ - ia64\TestZlibDll$(Configuration)\Tmp\ - true - false - x64\TestZlibDll$(Configuration)\ - x64\TestZlibDll$(Configuration)\Tmp\ - false - false - ia64\TestZlibDll$(Configuration)\ - ia64\TestZlibDll$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - $(OutDir)testzlib.pdb - Console - false - - - MachineX86 - - - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - Default - MultiThreaded - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - Console - true - true - false - - - MachineX86 - - - - - X64 - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - $(OutDir)testzlib.pdb - Console - MachineX64 - - - - - Itanium - - - Disabled - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebugDLL - false - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - $(OutDir)testzlib.pdb - Console - MachineIA64 - - - - - X64 - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - Console - true - true - MachineX64 - - - - - Itanium - - - MaxSpeed - OnlyExplicitInline - true - ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) - true - Default - MultiThreadedDLL - false - true - - - $(IntDir) - Level3 - ProgramDatabase - - - ia64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) - $(OutDir)testzlibdll.exe - true - Console - true - true - MachineIA64 - - - - - - - - {8fd826f8-3739-44e6-8cc8-997122e53b8d} - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc14/zlib.rc b/compat/zlib/contrib/vstudio/vc14/zlib.rc deleted file mode 100644 index c4e4b01..0000000 --- a/compat/zlib/contrib/vstudio/vc14/zlib.rc +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#define IDR_VERSION1 1 -IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 2, 11, 0 - PRODUCTVERSION 1, 2, 11, 0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS 0 - FILEOS VOS_DOS_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0 // not used -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - //language ID = U.S. English, char set = Windows, Multilingual - - BEGIN - VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.11\0" - VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlibwapi.dll\0" - VALUE "ProductName", "ZLib.DLL\0" - VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/compat/zlib/contrib/vstudio/vc14/zlibstat.vcxproj b/compat/zlib/contrib/vstudio/vc14/zlibstat.vcxproj deleted file mode 100644 index 3e4b986..0000000 --- a/compat/zlib/contrib/vstudio/vc14/zlibstat.vcxproj +++ /dev/null @@ -1,467 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - ReleaseWithoutAsm - Itanium - - - ReleaseWithoutAsm - Win32 - - - ReleaseWithoutAsm - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} - - - - StaticLibrary - false - v140 - - - StaticLibrary - false - v140 - - - StaticLibrary - false - v140 - Unicode - - - StaticLibrary - false - v140 - - - StaticLibrary - false - v140 - - - StaticLibrary - false - v140 - - - StaticLibrary - false - v140 - - - StaticLibrary - false - v140 - - - StaticLibrary - false - v140 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\ZlibStat$(Configuration)\ - x86\ZlibStat$(Configuration)\Tmp\ - x86\ZlibStat$(Configuration)\ - x86\ZlibStat$(Configuration)\Tmp\ - x86\ZlibStat$(Configuration)\ - x86\ZlibStat$(Configuration)\Tmp\ - x64\ZlibStat$(Configuration)\ - x64\ZlibStat$(Configuration)\Tmp\ - ia64\ZlibStat$(Configuration)\ - ia64\ZlibStat$(Configuration)\Tmp\ - x64\ZlibStat$(Configuration)\ - x64\ZlibStat$(Configuration)\Tmp\ - ia64\ZlibStat$(Configuration)\ - ia64\ZlibStat$(Configuration)\Tmp\ - x64\ZlibStat$(Configuration)\ - x64\ZlibStat$(Configuration)\Tmp\ - ia64\ZlibStat$(Configuration)\ - ia64\ZlibStat$(Configuration)\Tmp\ - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - OldStyle - - - 0x040c - - - /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;%(PreprocessorDefinitions) - true - - - MultiThreaded - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibstat.lib - true - - - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) - true - - - MultiThreaded - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - X64 - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - OldStyle - - - 0x040c - - - /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - Itanium - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - OldStyle - - - 0x040c - - - /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - X64 - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibstat.lib - true - - - - - Itanium - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - X64 - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - Itanium - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibstat.pch - $(IntDir) - $(IntDir) - $(OutDir) - Level3 - true - - - 0x040c - - - /MACHINE:IA64 /NODEFAULTLIB %(AdditionalOptions) - $(OutDir)zlibstat.lib - true - - - - - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc14/zlibvc.def b/compat/zlib/contrib/vstudio/vc14/zlibvc.def deleted file mode 100644 index 54e683d..0000000 --- a/compat/zlib/contrib/vstudio/vc14/zlibvc.def +++ /dev/null @@ -1,153 +0,0 @@ -LIBRARY -; zlib data compression and ZIP file I/O library - -VERSION 1.2 - -EXPORTS - adler32 @1 - compress @2 - crc32 @3 - deflate @4 - deflateCopy @5 - deflateEnd @6 - deflateInit2_ @7 - deflateInit_ @8 - deflateParams @9 - deflateReset @10 - deflateSetDictionary @11 - gzclose @12 - gzdopen @13 - gzerror @14 - gzflush @15 - gzopen @16 - gzread @17 - gzwrite @18 - inflate @19 - inflateEnd @20 - inflateInit2_ @21 - inflateInit_ @22 - inflateReset @23 - inflateSetDictionary @24 - inflateSync @25 - uncompress @26 - zlibVersion @27 - gzprintf @28 - gzputc @29 - gzgetc @30 - gzseek @31 - gzrewind @32 - gztell @33 - gzeof @34 - gzsetparams @35 - zError @36 - inflateSyncPoint @37 - get_crc_table @38 - compress2 @39 - gzputs @40 - gzgets @41 - inflateCopy @42 - inflateBackInit_ @43 - inflateBack @44 - inflateBackEnd @45 - compressBound @46 - deflateBound @47 - gzclearerr @48 - gzungetc @49 - zlibCompileFlags @50 - deflatePrime @51 - deflatePending @52 - - unzOpen @61 - unzClose @62 - unzGetGlobalInfo @63 - unzGetCurrentFileInfo @64 - unzGoToFirstFile @65 - unzGoToNextFile @66 - unzOpenCurrentFile @67 - unzReadCurrentFile @68 - unzOpenCurrentFile3 @69 - unztell @70 - unzeof @71 - unzCloseCurrentFile @72 - unzGetGlobalComment @73 - unzStringFileNameCompare @74 - unzLocateFile @75 - unzGetLocalExtrafield @76 - unzOpen2 @77 - unzOpenCurrentFile2 @78 - unzOpenCurrentFilePassword @79 - - zipOpen @80 - zipOpenNewFileInZip @81 - zipWriteInFileInZip @82 - zipCloseFileInZip @83 - zipClose @84 - zipOpenNewFileInZip2 @86 - zipCloseFileInZipRaw @87 - zipOpen2 @88 - zipOpenNewFileInZip3 @89 - - unzGetFilePos @100 - unzGoToFilePos @101 - - fill_win32_filefunc @110 - -; zlibwapi v1.2.4 added: - fill_win32_filefunc64 @111 - fill_win32_filefunc64A @112 - fill_win32_filefunc64W @113 - - unzOpen64 @120 - unzOpen2_64 @121 - unzGetGlobalInfo64 @122 - unzGetCurrentFileInfo64 @124 - unzGetCurrentFileZStreamPos64 @125 - unztell64 @126 - unzGetFilePos64 @127 - unzGoToFilePos64 @128 - - zipOpen64 @130 - zipOpen2_64 @131 - zipOpenNewFileInZip64 @132 - zipOpenNewFileInZip2_64 @133 - zipOpenNewFileInZip3_64 @134 - zipOpenNewFileInZip4_64 @135 - zipCloseFileInZipRaw64 @136 - -; zlib1 v1.2.4 added: - adler32_combine @140 - crc32_combine @142 - deflateSetHeader @144 - deflateTune @145 - gzbuffer @146 - gzclose_r @147 - gzclose_w @148 - gzdirect @149 - gzoffset @150 - inflateGetHeader @156 - inflateMark @157 - inflatePrime @158 - inflateReset2 @159 - inflateUndermine @160 - -; zlib1 v1.2.6 added: - gzgetc_ @161 - inflateResetKeep @163 - deflateResetKeep @164 - -; zlib1 v1.2.7 added: - gzopen_w @165 - -; zlib1 v1.2.8 added: - inflateGetDictionary @166 - gzvprintf @167 - -; zlib1 v1.2.9 added: - inflateCodesUsed @168 - inflateValidate @169 - uncompress2 @170 - gzfread @171 - gzfwrite @172 - deflateGetDictionary @173 - adler32_z @174 - crc32_z @175 diff --git a/compat/zlib/contrib/vstudio/vc14/zlibvc.sln b/compat/zlib/contrib/vstudio/vc14/zlibvc.sln deleted file mode 100644 index 6f4a107..0000000 --- a/compat/zlib/contrib/vstudio/vc14/zlibvc.sln +++ /dev/null @@ -1,119 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcxproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcxproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlibdll", "testzlibdll.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcxproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Itanium = Debug|Itanium - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Itanium = Release|Itanium - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - ReleaseWithoutAsm|Itanium = ReleaseWithoutAsm|Itanium - ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32 - ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.ActiveCfg = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.ActiveCfg = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = Release|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = Release|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.ActiveCfg = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.ActiveCfg = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/compat/zlib/contrib/vstudio/vc14/zlibvc.vcxproj b/compat/zlib/contrib/vstudio/vc14/zlibvc.vcxproj deleted file mode 100644 index f8f673c..0000000 --- a/compat/zlib/contrib/vstudio/vc14/zlibvc.vcxproj +++ /dev/null @@ -1,692 +0,0 @@ - - - - - Debug - Itanium - - - Debug - Win32 - - - Debug - x64 - - - ReleaseWithoutAsm - Itanium - - - ReleaseWithoutAsm - Win32 - - - ReleaseWithoutAsm - x64 - - - Release - Itanium - - - Release - Win32 - - - Release - x64 - - - - {8FD826F8-3739-44E6-8CC8-997122E53B8D} - - - - DynamicLibrary - false - true - v140 - - - DynamicLibrary - false - true - v140 - - - DynamicLibrary - false - v140 - Unicode - - - DynamicLibrary - false - true - v140 - - - DynamicLibrary - false - true - v140 - - - DynamicLibrary - false - v140 - - - DynamicLibrary - false - true - v140 - - - DynamicLibrary - false - true - v140 - - - DynamicLibrary - false - v140 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30128.1 - x86\ZlibDll$(Configuration)\ - x86\ZlibDll$(Configuration)\Tmp\ - true - false - x86\ZlibDll$(Configuration)\ - x86\ZlibDll$(Configuration)\Tmp\ - false - false - x86\ZlibDll$(Configuration)\ - x86\ZlibDll$(Configuration)\Tmp\ - false - false - x64\ZlibDll$(Configuration)\ - x64\ZlibDll$(Configuration)\Tmp\ - true - false - ia64\ZlibDll$(Configuration)\ - ia64\ZlibDll$(Configuration)\Tmp\ - true - false - x64\ZlibDll$(Configuration)\ - x64\ZlibDll$(Configuration)\Tmp\ - false - false - ia64\ZlibDll$(Configuration)\ - ia64\ZlibDll$(Configuration)\Tmp\ - false - false - x64\ZlibDll$(Configuration)\ - x64\ZlibDll$(Configuration)\Tmp\ - false - false - ia64\ZlibDll$(Configuration)\ - ia64\ZlibDll$(Configuration)\Tmp\ - false - false - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - zlibwapi - zlibwapi - zlibwapi - zlibwapi - zlibwapi - zlibwapi - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - $(OutDir)zlibvc.tlb - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibvc.pch - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll - true - .\zlibvc.def - true - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - false - - - $(OutDir)zlibwapi.lib - - - cd ..\..\masmx86 -bld_ml32.bat - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - /MACHINE:I386 %(AdditionalOptions) - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - false - - - $(OutDir)zlibwapi.lib - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;%(PreprocessorDefinitions) - true - - - MultiThreaded - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - /MACHINE:I386 %(AdditionalOptions) - ..\..\masmx86\match686.obj;..\..\masmx86\inffas32.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - false - - - $(OutDir)zlibwapi.lib - false - - - cd ..\..\masmx86 -bld_ml32.bat - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - X64 - $(OutDir)zlibvc.tlb - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibvc.pch - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll - true - .\zlibvc.def - true - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineX64 - - - cd ..\..\contrib\masmx64 -bld_ml64.bat - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Itanium - $(OutDir)zlibvc.tlb - - - Disabled - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - - - MultiThreadedDebugDLL - false - $(IntDir)zlibvc.pch - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - ProgramDatabase - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - .\zlibvc.def - true - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineIA64 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - X64 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineX64 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Itanium - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineIA64 - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - X64 - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;ASMV;ASMINF;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - ..\..\masmx64\gvmat64.obj;..\..\masmx64\inffasx64.obj;%(AdditionalDependencies) - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineX64 - - - cd ..\..\masmx64 -bld_ml64.bat - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Itanium - $(OutDir)zlibvc.tlb - - - OnlyExplicitInline - ..\..\..;..\..\masmx86;%(AdditionalIncludeDirectories) - _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) - true - - - MultiThreadedDLL - false - true - $(IntDir)zlibvc.pch - All - $(IntDir) - $(IntDir) - $(OutDir) - - - Level3 - true - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - $(OutDir)zlibwapi.dll - true - false - .\zlibvc.def - $(OutDir)zlibwapi.pdb - true - $(OutDir)zlibwapi.map - Windows - $(OutDir)zlibwapi.lib - MachineIA64 - - - - - - - - - - - - - - true - true - true - true - true - true - - - - - - - - - - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - - - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - %(AdditionalIncludeDirectories) - ZLIB_INTERNAL;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/compat/zlib/contrib/vstudio/vc9/miniunz.vcproj b/compat/zlib/contrib/vstudio/vc9/miniunz.vcproj deleted file mode 100644 index 7da32b9..0000000 --- a/compat/zlib/contrib/vstudio/vc9/miniunz.vcproj +++ /dev/null @@ -1,565 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/compat/zlib/contrib/vstudio/vc9/minizip.vcproj b/compat/zlib/contrib/vstudio/vc9/minizip.vcproj deleted file mode 100644 index e57e07d..0000000 --- a/compat/zlib/contrib/vstudio/vc9/minizip.vcproj +++ /dev/null @@ -1,562 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/compat/zlib/contrib/vstudio/vc9/testzlib.vcproj b/compat/zlib/contrib/vstudio/vc9/testzlib.vcproj deleted file mode 100644 index 9cb0bf8..0000000 --- a/compat/zlib/contrib/vstudio/vc9/testzlib.vcproj +++ /dev/null @@ -1,852 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/compat/zlib/contrib/vstudio/vc9/testzlibdll.vcproj b/compat/zlib/contrib/vstudio/vc9/testzlibdll.vcproj deleted file mode 100644 index b1ddde0..0000000 --- a/compat/zlib/contrib/vstudio/vc9/testzlibdll.vcproj +++ /dev/null @@ -1,565 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/compat/zlib/contrib/vstudio/vc9/zlib.rc b/compat/zlib/contrib/vstudio/vc9/zlib.rc deleted file mode 100644 index fee177a..0000000 --- a/compat/zlib/contrib/vstudio/vc9/zlib.rc +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#define IDR_VERSION1 1 -IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 2, 11, 0 - PRODUCTVERSION 1, 2, 11, 0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS 0 - FILEOS VOS_DOS_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0 // not used -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - //language ID = U.S. English, char set = Windows, Multilingual - - BEGIN - VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.2.11\0" - VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlibwapi.dll\0" - VALUE "ProductName", "ZLib.DLL\0" - VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/compat/zlib/contrib/vstudio/vc9/zlibstat.vcproj b/compat/zlib/contrib/vstudio/vc9/zlibstat.vcproj deleted file mode 100644 index 61c76c7..0000000 --- a/compat/zlib/contrib/vstudio/vc9/zlibstat.vcproj +++ /dev/null @@ -1,835 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/compat/zlib/contrib/vstudio/vc9/zlibvc.def b/compat/zlib/contrib/vstudio/vc9/zlibvc.def deleted file mode 100644 index 54e683d..0000000 --- a/compat/zlib/contrib/vstudio/vc9/zlibvc.def +++ /dev/null @@ -1,153 +0,0 @@ -LIBRARY -; zlib data compression and ZIP file I/O library - -VERSION 1.2 - -EXPORTS - adler32 @1 - compress @2 - crc32 @3 - deflate @4 - deflateCopy @5 - deflateEnd @6 - deflateInit2_ @7 - deflateInit_ @8 - deflateParams @9 - deflateReset @10 - deflateSetDictionary @11 - gzclose @12 - gzdopen @13 - gzerror @14 - gzflush @15 - gzopen @16 - gzread @17 - gzwrite @18 - inflate @19 - inflateEnd @20 - inflateInit2_ @21 - inflateInit_ @22 - inflateReset @23 - inflateSetDictionary @24 - inflateSync @25 - uncompress @26 - zlibVersion @27 - gzprintf @28 - gzputc @29 - gzgetc @30 - gzseek @31 - gzrewind @32 - gztell @33 - gzeof @34 - gzsetparams @35 - zError @36 - inflateSyncPoint @37 - get_crc_table @38 - compress2 @39 - gzputs @40 - gzgets @41 - inflateCopy @42 - inflateBackInit_ @43 - inflateBack @44 - inflateBackEnd @45 - compressBound @46 - deflateBound @47 - gzclearerr @48 - gzungetc @49 - zlibCompileFlags @50 - deflatePrime @51 - deflatePending @52 - - unzOpen @61 - unzClose @62 - unzGetGlobalInfo @63 - unzGetCurrentFileInfo @64 - unzGoToFirstFile @65 - unzGoToNextFile @66 - unzOpenCurrentFile @67 - unzReadCurrentFile @68 - unzOpenCurrentFile3 @69 - unztell @70 - unzeof @71 - unzCloseCurrentFile @72 - unzGetGlobalComment @73 - unzStringFileNameCompare @74 - unzLocateFile @75 - unzGetLocalExtrafield @76 - unzOpen2 @77 - unzOpenCurrentFile2 @78 - unzOpenCurrentFilePassword @79 - - zipOpen @80 - zipOpenNewFileInZip @81 - zipWriteInFileInZip @82 - zipCloseFileInZip @83 - zipClose @84 - zipOpenNewFileInZip2 @86 - zipCloseFileInZipRaw @87 - zipOpen2 @88 - zipOpenNewFileInZip3 @89 - - unzGetFilePos @100 - unzGoToFilePos @101 - - fill_win32_filefunc @110 - -; zlibwapi v1.2.4 added: - fill_win32_filefunc64 @111 - fill_win32_filefunc64A @112 - fill_win32_filefunc64W @113 - - unzOpen64 @120 - unzOpen2_64 @121 - unzGetGlobalInfo64 @122 - unzGetCurrentFileInfo64 @124 - unzGetCurrentFileZStreamPos64 @125 - unztell64 @126 - unzGetFilePos64 @127 - unzGoToFilePos64 @128 - - zipOpen64 @130 - zipOpen2_64 @131 - zipOpenNewFileInZip64 @132 - zipOpenNewFileInZip2_64 @133 - zipOpenNewFileInZip3_64 @134 - zipOpenNewFileInZip4_64 @135 - zipCloseFileInZipRaw64 @136 - -; zlib1 v1.2.4 added: - adler32_combine @140 - crc32_combine @142 - deflateSetHeader @144 - deflateTune @145 - gzbuffer @146 - gzclose_r @147 - gzclose_w @148 - gzdirect @149 - gzoffset @150 - inflateGetHeader @156 - inflateMark @157 - inflatePrime @158 - inflateReset2 @159 - inflateUndermine @160 - -; zlib1 v1.2.6 added: - gzgetc_ @161 - inflateResetKeep @163 - deflateResetKeep @164 - -; zlib1 v1.2.7 added: - gzopen_w @165 - -; zlib1 v1.2.8 added: - inflateGetDictionary @166 - gzvprintf @167 - -; zlib1 v1.2.9 added: - inflateCodesUsed @168 - inflateValidate @169 - uncompress2 @170 - gzfread @171 - gzfwrite @172 - deflateGetDictionary @173 - adler32_z @174 - crc32_z @175 diff --git a/compat/zlib/contrib/vstudio/vc9/zlibvc.sln b/compat/zlib/contrib/vstudio/vc9/zlibvc.sln deleted file mode 100644 index b482967..0000000 --- a/compat/zlib/contrib/vstudio/vc9/zlibvc.sln +++ /dev/null @@ -1,144 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestZlibDll", "testzlibdll.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}" - ProjectSection(ProjectDependencies) = postProject - {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" - ProjectSection(ProjectDependencies) = postProject - {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" - ProjectSection(ProjectDependencies) = postProject - {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Itanium = Debug|Itanium - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Itanium = Release|Itanium - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - ReleaseWithoutAsm|Itanium = ReleaseWithoutAsm|Itanium - ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32 - ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.ActiveCfg = Debug|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.Build.0 = Debug|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.ActiveCfg = Release|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.Build.0 = Release|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = Release|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = Release|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.ActiveCfg = Debug|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.Build.0 = Debug|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.ActiveCfg = Release|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.Build.0 = Release|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.Build.0 = Debug|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.Build.0 = Release|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.ActiveCfg = Debug|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.Build.0 = Debug|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.Build.0 = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.Build.0 = Debug|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.Build.0 = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.ActiveCfg = Debug|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.Build.0 = Debug|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.Build.0 = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/compat/zlib/contrib/vstudio/vc9/zlibvc.vcproj b/compat/zlib/contrib/vstudio/vc9/zlibvc.vcproj deleted file mode 100644 index c9a8947..0000000 --- a/compat/zlib/contrib/vstudio/vc9/zlibvc.vcproj +++ /dev/null @@ -1,1156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/compat/zlib/crc32.c b/compat/zlib/crc32.c deleted file mode 100644 index 9580440..0000000 --- a/compat/zlib/crc32.c +++ /dev/null @@ -1,442 +0,0 @@ -/* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Thanks to Rodney Brown for his contribution of faster - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing - * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results in about a - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. - */ - -/* @(#) $Id$ */ - -/* - Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore - protection on the static variables used to control the first-use generation - of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should - first call get_crc_table() to initialize the tables before allowing more than - one thread to use crc32(). - - DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h. - */ - -#ifdef MAKECRCH -# include -# ifndef DYNAMIC_CRC_TABLE -# define DYNAMIC_CRC_TABLE -# endif /* !DYNAMIC_CRC_TABLE */ -#endif /* MAKECRCH */ - -#include "zutil.h" /* for STDC and FAR definitions */ - -/* Definitions for doing the crc four data bytes at a time. */ -#if !defined(NOBYFOUR) && defined(Z_U4) -# define BYFOUR -#endif -#ifdef BYFOUR - local unsigned long crc32_little OF((unsigned long, - const unsigned char FAR *, z_size_t)); - local unsigned long crc32_big OF((unsigned long, - const unsigned char FAR *, z_size_t)); -# define TBLS 8 -#else -# define TBLS 1 -#endif /* BYFOUR */ - -/* Local functions for crc concatenation */ -local unsigned long gf2_matrix_times OF((unsigned long *mat, - unsigned long vec)); -local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); -local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2)); - - -#ifdef DYNAMIC_CRC_TABLE - -local volatile int crc_table_empty = 1; -local z_crc_t FAR crc_table[TBLS][256]; -local void make_crc_table OF((void)); -#ifdef MAKECRCH - local void write_table OF((FILE *, const z_crc_t FAR *)); -#endif /* MAKECRCH */ -/* - Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: - x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. - - Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials - is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the - polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, - where a mod b means the remainder after dividing a by b. - - This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each - incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The first table is simply the CRC of all possible eight bit values. This is - all the information needed to generate CRCs on data a byte at a time for all - combinations of CRC register values and incoming bytes. The remaining tables - allow for word-at-a-time CRC calculation for both big-endian and little- - endian machines, where a word is four bytes. -*/ -local void make_crc_table() -{ - z_crc_t c; - int n, k; - z_crc_t poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static volatile int first = 1; /* flag to limit concurrent making */ - static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* See if another task is already doing this (not thread-safe, but better - than nothing -- significantly reduces duration of vulnerability in - case the advice about DYNAMIC_CRC_TABLE is ignored) */ - if (first) { - first = 0; - - /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0; - for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) - poly |= (z_crc_t)1 << (31 - p[n]); - - /* generate a crc for every 8-bit value */ - for (n = 0; n < 256; n++) { - c = (z_crc_t)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[0][n] = c; - } - -#ifdef BYFOUR - /* generate crc for each value followed by one, two, and three zeros, - and then the byte reversal of those as well as the first table */ - for (n = 0; n < 256; n++) { - c = crc_table[0][n]; - crc_table[4][n] = ZSWAP32(c); - for (k = 1; k < 4; k++) { - c = crc_table[0][c & 0xff] ^ (c >> 8); - crc_table[k][n] = c; - crc_table[k + 4][n] = ZSWAP32(c); - } - } -#endif /* BYFOUR */ - - crc_table_empty = 0; - } - else { /* not first */ - /* wait for the other guy to finish (not efficient, but rare) */ - while (crc_table_empty) - ; - } - -#ifdef MAKECRCH - /* write out CRC tables to crc32.h */ - { - FILE *out; - - out = fopen("crc32.h", "w"); - if (out == NULL) return; - fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); - fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const z_crc_t FAR "); - fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); - write_table(out, crc_table[0]); -# ifdef BYFOUR - fprintf(out, "#ifdef BYFOUR\n"); - for (k = 1; k < 8; k++) { - fprintf(out, " },\n {\n"); - write_table(out, crc_table[k]); - } - fprintf(out, "#endif\n"); -# endif /* BYFOUR */ - fprintf(out, " }\n};\n"); - fclose(out); - } -#endif /* MAKECRCH */ -} - -#ifdef MAKECRCH -local void write_table(out, table) - FILE *out; - const z_crc_t FAR *table; -{ - int n; - - for (n = 0; n < 256; n++) - fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", - (unsigned long)(table[n]), - n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); -} -#endif /* MAKECRCH */ - -#else /* !DYNAMIC_CRC_TABLE */ -/* ======================================================================== - * Tables of CRC-32s of all single-byte values, made by make_crc_table(). - */ -#include "crc32.h" -#endif /* DYNAMIC_CRC_TABLE */ - -/* ========================================================================= - * This function can be used by asm versions of crc32() - */ -const z_crc_t FAR * ZEXPORT get_crc_table() -{ -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - return (const z_crc_t FAR *)crc_table; -} - -/* ========================================================================= */ -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 - -/* ========================================================================= */ -unsigned long ZEXPORT crc32_z(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - z_size_t len; -{ - if (buf == Z_NULL) return 0UL; - -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - -#ifdef BYFOUR - if (sizeof(void *) == sizeof(ptrdiff_t)) { - z_crc_t endian; - - endian = 1; - if (*((unsigned char *)(&endian))) - return crc32_little(crc, buf, len); - else - return crc32_big(crc, buf, len); - } -#endif /* BYFOUR */ - crc = crc ^ 0xffffffffUL; - while (len >= 8) { - DO8; - len -= 8; - } - if (len) do { - DO1; - } while (--len); - return crc ^ 0xffffffffUL; -} - -/* ========================================================================= */ -unsigned long ZEXPORT crc32(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - uInt len; -{ - return crc32_z(crc, buf, len); -} - -#ifdef BYFOUR - -/* - This BYFOUR code accesses the passed unsigned char * buffer with a 32-bit - integer pointer type. This violates the strict aliasing rule, where a - compiler can assume, for optimization purposes, that two pointers to - fundamentally different types won't ever point to the same memory. This can - manifest as a problem only if one of the pointers is written to. This code - only reads from those pointers. So long as this code remains isolated in - this compilation unit, there won't be a problem. For this reason, this code - should not be copied and pasted into a compilation unit in which other code - writes to the buffer that is passed to these routines. - */ - -/* ========================================================================= */ -#define DOLIT4 c ^= *buf4++; \ - c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ - crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] -#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 - -/* ========================================================================= */ -local unsigned long crc32_little(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - z_size_t len; -{ - register z_crc_t c; - register const z_crc_t FAR *buf4; - - c = (z_crc_t)crc; - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - len--; - } - - buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - while (len >= 32) { - DOLIT32; - len -= 32; - } - while (len >= 4) { - DOLIT4; - len -= 4; - } - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - } while (--len); - c = ~c; - return (unsigned long)c; -} - -/* ========================================================================= */ -#define DOBIG4 c ^= *buf4++; \ - c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ - crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] -#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 - -/* ========================================================================= */ -local unsigned long crc32_big(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - z_size_t len; -{ - register z_crc_t c; - register const z_crc_t FAR *buf4; - - c = ZSWAP32((z_crc_t)crc); - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - len--; - } - - buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - while (len >= 32) { - DOBIG32; - len -= 32; - } - while (len >= 4) { - DOBIG4; - len -= 4; - } - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - } while (--len); - c = ~c; - return (unsigned long)(ZSWAP32(c)); -} - -#endif /* BYFOUR */ - -#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ - -/* ========================================================================= */ -local unsigned long gf2_matrix_times(mat, vec) - unsigned long *mat; - unsigned long vec; -{ - unsigned long sum; - - sum = 0; - while (vec) { - if (vec & 1) - sum ^= *mat; - vec >>= 1; - mat++; - } - return sum; -} - -/* ========================================================================= */ -local void gf2_matrix_square(square, mat) - unsigned long *square; - unsigned long *mat; -{ - int n; - - for (n = 0; n < GF2_DIM; n++) - square[n] = gf2_matrix_times(mat, mat[n]); -} - -/* ========================================================================= */ -local uLong crc32_combine_(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off64_t len2; -{ - int n; - unsigned long row; - unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ - unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ - - /* degenerate case (also disallow negative lengths) */ - if (len2 <= 0) - return crc1; - - /* put operator for one zero bit in odd */ - odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ - row = 1; - for (n = 1; n < GF2_DIM; n++) { - odd[n] = row; - row <<= 1; - } - - /* put operator for two zero bits in even */ - gf2_matrix_square(even, odd); - - /* put operator for four zero bits in odd */ - gf2_matrix_square(odd, even); - - /* apply len2 zeros to crc1 (first square will put the operator for one - zero byte, eight zero bits, in even) */ - do { - /* apply zeros operator for this bit of len2 */ - gf2_matrix_square(even, odd); - if (len2 & 1) - crc1 = gf2_matrix_times(even, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - if (len2 == 0) - break; - - /* another iteration of the loop with odd and even swapped */ - gf2_matrix_square(odd, even); - if (len2 & 1) - crc1 = gf2_matrix_times(odd, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - } while (len2 != 0); - - /* return combined crc */ - crc1 ^= crc2; - return crc1; -} - -/* ========================================================================= */ -uLong ZEXPORT crc32_combine(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off_t len2; -{ - return crc32_combine_(crc1, crc2, len2); -} - -uLong ZEXPORT crc32_combine64(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off64_t len2; -{ - return crc32_combine_(crc1, crc2, len2); -} diff --git a/compat/zlib/crc32.h b/compat/zlib/crc32.h deleted file mode 100644 index 9e0c778..0000000 --- a/compat/zlib/crc32.h +++ /dev/null @@ -1,441 +0,0 @@ -/* crc32.h -- tables for rapid CRC calculation - * Generated automatically by crc32.c - */ - -local const z_crc_t FAR crc_table[TBLS][256] = -{ - { - 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, - 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, - 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, - 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, - 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, - 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, - 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, - 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, - 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, - 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, - 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, - 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, - 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, - 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, - 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, - 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, - 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, - 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, - 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, - 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, - 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, - 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, - 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, - 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, - 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, - 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, - 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, - 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, - 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, - 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, - 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, - 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, - 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, - 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, - 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, - 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, - 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, - 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, - 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, - 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, - 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, - 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, - 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, - 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, - 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, - 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, - 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, - 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, - 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, - 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, - 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, - 0x2d02ef8dUL -#ifdef BYFOUR - }, - { - 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, - 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, - 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, - 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, - 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, - 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, - 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, - 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, - 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, - 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, - 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, - 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, - 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, - 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, - 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, - 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, - 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, - 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, - 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, - 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, - 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, - 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, - 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, - 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, - 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, - 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, - 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, - 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, - 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, - 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, - 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, - 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, - 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, - 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, - 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, - 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, - 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, - 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, - 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, - 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, - 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, - 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, - 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, - 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, - 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, - 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, - 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, - 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, - 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, - 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, - 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, - 0x9324fd72UL - }, - { - 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, - 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, - 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, - 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, - 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, - 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, - 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, - 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, - 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, - 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, - 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, - 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, - 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, - 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, - 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, - 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, - 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, - 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, - 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, - 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, - 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, - 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, - 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, - 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, - 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, - 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, - 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, - 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, - 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, - 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, - 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, - 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, - 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, - 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, - 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, - 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, - 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, - 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, - 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, - 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, - 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, - 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, - 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, - 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, - 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, - 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, - 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, - 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, - 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, - 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, - 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, - 0xbe9834edUL - }, - { - 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, - 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, - 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, - 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, - 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, - 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, - 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, - 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, - 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, - 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, - 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, - 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, - 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, - 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, - 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, - 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, - 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, - 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, - 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, - 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, - 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, - 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, - 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, - 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, - 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, - 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, - 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, - 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, - 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, - 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, - 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, - 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, - 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, - 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, - 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, - 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, - 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, - 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, - 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, - 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, - 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, - 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, - 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, - 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, - 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, - 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, - 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, - 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, - 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, - 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, - 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, - 0xde0506f1UL - }, - { - 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, - 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, - 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, - 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, - 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, - 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, - 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, - 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, - 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, - 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, - 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, - 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, - 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, - 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, - 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, - 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, - 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, - 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, - 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, - 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, - 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, - 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, - 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, - 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, - 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, - 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, - 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, - 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, - 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, - 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, - 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, - 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, - 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, - 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, - 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, - 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, - 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, - 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, - 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, - 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, - 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, - 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, - 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, - 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, - 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, - 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, - 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, - 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, - 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, - 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, - 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, - 0x8def022dUL - }, - { - 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, - 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, - 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, - 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, - 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, - 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, - 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, - 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, - 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, - 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, - 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, - 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, - 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, - 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, - 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, - 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, - 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, - 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, - 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, - 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, - 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, - 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, - 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, - 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, - 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, - 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, - 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, - 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, - 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, - 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, - 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, - 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, - 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, - 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, - 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, - 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, - 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, - 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, - 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, - 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, - 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, - 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, - 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, - 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, - 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, - 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, - 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, - 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, - 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, - 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, - 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, - 0x72fd2493UL - }, - { - 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, - 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, - 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, - 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, - 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, - 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, - 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, - 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, - 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, - 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, - 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, - 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, - 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, - 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, - 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, - 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, - 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, - 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, - 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, - 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, - 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, - 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, - 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, - 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, - 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, - 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, - 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, - 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, - 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, - 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, - 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, - 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, - 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, - 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, - 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, - 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, - 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, - 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, - 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, - 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, - 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, - 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, - 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, - 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, - 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, - 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, - 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, - 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, - 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, - 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, - 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, - 0xed3498beUL - }, - { - 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, - 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, - 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, - 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, - 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, - 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, - 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, - 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, - 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, - 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, - 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, - 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, - 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, - 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, - 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, - 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, - 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, - 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, - 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, - 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, - 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, - 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, - 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, - 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, - 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, - 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, - 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, - 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, - 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, - 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, - 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, - 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, - 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, - 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, - 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, - 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, - 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, - 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, - 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, - 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, - 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, - 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, - 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, - 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, - 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, - 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, - 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, - 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, - 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, - 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, - 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, - 0xf10605deUL -#endif - } -}; diff --git a/compat/zlib/deflate.c b/compat/zlib/deflate.c deleted file mode 100644 index 1ec7614..0000000 --- a/compat/zlib/deflate.c +++ /dev/null @@ -1,2163 +0,0 @@ -/* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process depends on being able to identify portions - * of the input text which are identical to earlier input (within a - * sliding window trailing behind the input currently being processed). - * - * The most straightforward technique turns out to be the fastest for - * most input files: try all possible matches and select the longest. - * The key feature of this algorithm is that insertions into the string - * dictionary are very simple and thus fast, and deletions are avoided - * completely. Insertions are performed at each input character, whereas - * string matches are performed only when the previous match ends. So it - * is preferable to spend more time in matches to allow very fast string - * insertions and avoid deletions. The matching algorithm for small - * strings is inspired from that of Rabin & Karp. A brute force approach - * is used to find longer strings when a small match has been found. - * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze - * (by Leonid Broukhis). - * A previous version of this file used a more sophisticated algorithm - * (by Fiala and Greene) which is guaranteed to run in linear amortized - * time, but has a larger average cost, uses more memory and is patented. - * However the F&G algorithm may be faster for some highly redundant - * files if the parameter max_chain_length (described below) is too large. - * - * ACKNOWLEDGEMENTS - * - * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and - * I found it in 'freeze' written by Leonid Broukhis. - * Thanks to many people for bug reports and testing. - * - * REFERENCES - * - * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". - * Available in http://tools.ietf.org/html/rfc1951 - * - * A description of the Rabin and Karp algorithm is given in the book - * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. - * - * Fiala,E.R., and Greene,D.H. - * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 - * - */ - -/* @(#) $Id$ */ - -#include "deflate.h" - -const char deflate_copyright[] = - " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* =========================================================================== - * Function prototypes. - */ -typedef enum { - need_more, /* block not completed, need more input or more output */ - block_done, /* block flush performed */ - finish_started, /* finish started, need only more output at next deflate */ - finish_done /* finish done, accept no more input or output */ -} block_state; - -typedef block_state (*compress_func) OF((deflate_state *s, int flush)); -/* Compression function. Returns the block state after the call. */ - -local int deflateStateCheck OF((z_streamp strm)); -local void slide_hash OF((deflate_state *s)); -local void fill_window OF((deflate_state *s)); -local block_state deflate_stored OF((deflate_state *s, int flush)); -local block_state deflate_fast OF((deflate_state *s, int flush)); -#ifndef FASTEST -local block_state deflate_slow OF((deflate_state *s, int flush)); -#endif -local block_state deflate_rle OF((deflate_state *s, int flush)); -local block_state deflate_huff OF((deflate_state *s, int flush)); -local void lm_init OF((deflate_state *s)); -local void putShortMSB OF((deflate_state *s, uInt b)); -local void flush_pending OF((z_streamp strm)); -local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifdef ASMV -# pragma message("Assembler code may have bugs -- use at your own risk") - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else -local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif - -#ifdef ZLIB_DEBUG -local void check_match OF((deflate_state *s, IPos start, IPos match, - int length)); -#endif - -/* =========================================================================== - * Local data - */ - -#define NIL 0 -/* Tail of hash chains */ - -#ifndef TOO_FAR -# define TOO_FAR 4096 -#endif -/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -typedef struct config_s { - ush good_length; /* reduce lazy search above this match length */ - ush max_lazy; /* do not perform lazy search above this match length */ - ush nice_length; /* quit search above this match length */ - ush max_chain; - compress_func func; -} config; - -#ifdef FASTEST -local const config configuration_table[2] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ -#else -local const config configuration_table[10] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ -/* 2 */ {4, 5, 16, 8, deflate_fast}, -/* 3 */ {4, 6, 32, 32, deflate_fast}, - -/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ -/* 5 */ {8, 16, 32, 32, deflate_slow}, -/* 6 */ {8, 16, 128, 128, deflate_slow}, -/* 7 */ {8, 32, 128, 256, deflate_slow}, -/* 8 */ {32, 128, 258, 1024, deflate_slow}, -/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ -#endif - -/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 - * For deflate_fast() (levels <= 3) good is ignored and lazy has a different - * meaning. - */ - -/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ -#define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0)) - -/* =========================================================================== - * Update a hash value with the given input byte - * IN assertion: all calls to UPDATE_HASH are made with consecutive input - * characters, so that a running hash key can be computed from the previous - * key instead of complete recalculation each time. - */ -#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) - - -/* =========================================================================== - * Insert string str in the dictionary and set match_head to the previous head - * of the hash chain (the most recent string with same hash key). Return - * the previous length of the hash chain. - * If this file is compiled with -DFASTEST, the compression level is forced - * to 1, and no hash chains are maintained. - * IN assertion: all calls to INSERT_STRING are made with consecutive input - * characters and the first MIN_MATCH bytes of str are valid (except for - * the last MIN_MATCH-1 bytes of the input file). - */ -#ifdef FASTEST -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#else -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#endif - -/* =========================================================================== - * Initialize the hash table (avoiding 64K overflow for 16 bit systems). - * prev[] will be initialized on the fly. - */ -#define CLEAR_HASH(s) \ - s->head[s->hash_size-1] = NIL; \ - zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); - -/* =========================================================================== - * Slide the hash table when sliding the window down (could be avoided with 32 - * bit values at the expense of memory usage). We slide even when level == 0 to - * keep the hash table consistent if we switch back to level > 0 later. - */ -local void slide_hash(s) - deflate_state *s; -{ - unsigned n, m; - Posf *p; - uInt wsize = s->w_size; - - n = s->hash_size; - p = &s->head[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m - wsize : NIL); - } while (--n); - n = wsize; -#ifndef FASTEST - p = &s->prev[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m - wsize : NIL); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); -#endif -} - -/* ========================================================================= */ -int ZEXPORT deflateInit_(strm, level, version, stream_size) - z_streamp strm; - int level; - const char *version; - int stream_size; -{ - return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, - Z_DEFAULT_STRATEGY, version, stream_size); - /* To do: ignore strm->next_in if we use it as window */ -} - -/* ========================================================================= */ -int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - version, stream_size) - z_streamp strm; - int level; - int method; - int windowBits; - int memLevel; - int strategy; - const char *version; - int stream_size; -{ - deflate_state *s; - int wrap = 1; - static const char my_version[] = ZLIB_VERSION; - - ushf *overlay; - /* We overlay pending_buf and d_buf+l_buf. This works since the average - * output size for (length,distance) codes is <= 24 bits. - */ - - if (version == Z_NULL || version[0] != my_version[0] || - stream_size != sizeof(z_stream)) { - return Z_VERSION_ERROR; - } - if (strm == Z_NULL) return Z_STREAM_ERROR; - - strm->msg = Z_NULL; - if (strm->zalloc == (alloc_func)0) { -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; -#endif - } - if (strm->zfree == (free_func)0) -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zfree = zcfree; -#endif - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } -#ifdef GZIP - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } -#endif - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED || (windowBits == 8 && wrap != 1)) { - return Z_STREAM_ERROR; - } - if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ - s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); - if (s == Z_NULL) return Z_MEM_ERROR; - strm->state = (struct internal_state FAR *)s; - s->strm = strm; - s->status = INIT_STATE; /* to pass state test in deflateReset() */ - - s->wrap = wrap; - s->gzhead = Z_NULL; - s->w_bits = (uInt)windowBits; - s->w_size = 1 << s->w_bits; - s->w_mask = s->w_size - 1; - - s->hash_bits = (uInt)memLevel + 7; - s->hash_size = 1 << s->hash_bits; - s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); - - s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); - s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); - s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); - - s->high_water = 0; /* nothing written to s->window yet */ - - s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - s->pending_buf = (uchf *) overlay; - s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); - - if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || - s->pending_buf == Z_NULL) { - s->status = FINISH_STATE; - strm->msg = ERR_MSG(Z_MEM_ERROR); - deflateEnd (strm); - return Z_MEM_ERROR; - } - s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - - s->level = level; - s->strategy = strategy; - s->method = (Byte)method; - - return deflateReset(strm); -} - -/* ========================================================================= - * Check for a valid deflate stream state. Return 0 if ok, 1 if not. - */ -local int deflateStateCheck (strm) - z_streamp strm; -{ - deflate_state *s; - if (strm == Z_NULL || - strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) - return 1; - s = strm->state; - if (s == Z_NULL || s->strm != strm || (s->status != INIT_STATE && -#ifdef GZIP - s->status != GZIP_STATE && -#endif - s->status != EXTRA_STATE && - s->status != NAME_STATE && - s->status != COMMENT_STATE && - s->status != HCRC_STATE && - s->status != BUSY_STATE && - s->status != FINISH_STATE)) - return 1; - return 0; -} - -/* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) - z_streamp strm; - const Bytef *dictionary; - uInt dictLength; -{ - deflate_state *s; - uInt str, n; - int wrap; - unsigned avail; - z_const unsigned char *next; - - if (deflateStateCheck(strm) || dictionary == Z_NULL) - return Z_STREAM_ERROR; - s = strm->state; - wrap = s->wrap; - if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead) - return Z_STREAM_ERROR; - - /* when using zlib wrappers, compute Adler-32 for provided dictionary */ - if (wrap == 1) - strm->adler = adler32(strm->adler, dictionary, dictLength); - s->wrap = 0; /* avoid computing Adler-32 in read_buf */ - - /* if dictionary would fill window, just replace the history */ - if (dictLength >= s->w_size) { - if (wrap == 0) { /* already empty otherwise */ - CLEAR_HASH(s); - s->strstart = 0; - s->block_start = 0L; - s->insert = 0; - } - dictionary += dictLength - s->w_size; /* use the tail */ - dictLength = s->w_size; - } - - /* insert dictionary into window and hash */ - avail = strm->avail_in; - next = strm->next_in; - strm->avail_in = dictLength; - strm->next_in = (z_const Bytef *)dictionary; - fill_window(s); - while (s->lookahead >= MIN_MATCH) { - str = s->strstart; - n = s->lookahead - (MIN_MATCH-1); - do { - UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); -#ifndef FASTEST - s->prev[str & s->w_mask] = s->head[s->ins_h]; -#endif - s->head[s->ins_h] = (Pos)str; - str++; - } while (--n); - s->strstart = str; - s->lookahead = MIN_MATCH-1; - fill_window(s); - } - s->strstart += s->lookahead; - s->block_start = (long)s->strstart; - s->insert = s->lookahead; - s->lookahead = 0; - s->match_length = s->prev_length = MIN_MATCH-1; - s->match_available = 0; - strm->next_in = next; - strm->avail_in = avail; - s->wrap = wrap; - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) - z_streamp strm; - Bytef *dictionary; - uInt *dictLength; -{ - deflate_state *s; - uInt len; - - if (deflateStateCheck(strm)) - return Z_STREAM_ERROR; - s = strm->state; - len = s->strstart + s->lookahead; - if (len > s->w_size) - len = s->w_size; - if (dictionary != Z_NULL && len) - zmemcpy(dictionary, s->window + s->strstart + s->lookahead - len, len); - if (dictLength != Z_NULL) - *dictLength = len; - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateResetKeep (strm) - z_streamp strm; -{ - deflate_state *s; - - if (deflateStateCheck(strm)) { - return Z_STREAM_ERROR; - } - - strm->total_in = strm->total_out = 0; - strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ - strm->data_type = Z_UNKNOWN; - - s = (deflate_state *)strm->state; - s->pending = 0; - s->pending_out = s->pending_buf; - - if (s->wrap < 0) { - s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ - } - s->status = -#ifdef GZIP - s->wrap == 2 ? GZIP_STATE : -#endif - s->wrap ? INIT_STATE : BUSY_STATE; - strm->adler = -#ifdef GZIP - s->wrap == 2 ? crc32(0L, Z_NULL, 0) : -#endif - adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; - - _tr_init(s); - - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateReset (strm) - z_streamp strm; -{ - int ret; - - ret = deflateResetKeep(strm); - if (ret == Z_OK) - lm_init(strm->state); - return ret; -} - -/* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) - z_streamp strm; - gz_headerp head; -{ - if (deflateStateCheck(strm) || strm->state->wrap != 2) - return Z_STREAM_ERROR; - strm->state->gzhead = head; - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflatePending (strm, pending, bits) - unsigned *pending; - int *bits; - z_streamp strm; -{ - if (deflateStateCheck(strm)) return Z_STREAM_ERROR; - if (pending != Z_NULL) - *pending = strm->state->pending; - if (bits != Z_NULL) - *bits = strm->state->bi_valid; - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) - z_streamp strm; - int bits; - int value; -{ - deflate_state *s; - int put; - - if (deflateStateCheck(strm)) return Z_STREAM_ERROR; - s = strm->state; - if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) - return Z_BUF_ERROR; - do { - put = Buf_size - s->bi_valid; - if (put > bits) - put = bits; - s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid); - s->bi_valid += put; - _tr_flush_bits(s); - value >>= put; - bits -= put; - } while (bits); - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateParams(strm, level, strategy) - z_streamp strm; - int level; - int strategy; -{ - deflate_state *s; - compress_func func; - - if (deflateStateCheck(strm)) return Z_STREAM_ERROR; - s = strm->state; - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { - return Z_STREAM_ERROR; - } - func = configuration_table[s->level].func; - - if ((strategy != s->strategy || func != configuration_table[level].func) && - s->high_water) { - /* Flush the last buffer: */ - int err = deflate(strm, Z_BLOCK); - if (err == Z_STREAM_ERROR) - return err; - if (strm->avail_out == 0) - return Z_BUF_ERROR; - } - if (s->level != level) { - if (s->level == 0 && s->matches != 0) { - if (s->matches == 1) - slide_hash(s); - else - CLEAR_HASH(s); - s->matches = 0; - } - s->level = level; - s->max_lazy_match = configuration_table[level].max_lazy; - s->good_match = configuration_table[level].good_length; - s->nice_match = configuration_table[level].nice_length; - s->max_chain_length = configuration_table[level].max_chain; - } - s->strategy = strategy; - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) - z_streamp strm; - int good_length; - int max_lazy; - int nice_length; - int max_chain; -{ - deflate_state *s; - - if (deflateStateCheck(strm)) return Z_STREAM_ERROR; - s = strm->state; - s->good_match = (uInt)good_length; - s->max_lazy_match = (uInt)max_lazy; - s->nice_match = nice_length; - s->max_chain_length = (uInt)max_chain; - return Z_OK; -} - -/* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. - * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. - * - * This function could be more sophisticated to provide closer upper bounds for - * every combination of windowBits and memLevel. But even the conservative - * upper bound of about 14% expansion does not seem onerous for output buffer - * allocation. - */ -uLong ZEXPORT deflateBound(strm, sourceLen) - z_streamp strm; - uLong sourceLen; -{ - deflate_state *s; - uLong complen, wraplen; - - /* conservative upper bound for compressed data */ - complen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; - - /* if can't get parameters, return conservative bound plus zlib wrapper */ - if (deflateStateCheck(strm)) - return complen + 6; - - /* compute wrapper length */ - s = strm->state; - switch (s->wrap) { - case 0: /* raw deflate */ - wraplen = 0; - break; - case 1: /* zlib wrapper */ - wraplen = 6 + (s->strstart ? 4 : 0); - break; -#ifdef GZIP - case 2: /* gzip wrapper */ - wraplen = 18; - if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ - Bytef *str; - if (s->gzhead->extra != Z_NULL) - wraplen += 2 + s->gzhead->extra_len; - str = s->gzhead->name; - if (str != Z_NULL) - do { - wraplen++; - } while (*str++); - str = s->gzhead->comment; - if (str != Z_NULL) - do { - wraplen++; - } while (*str++); - if (s->gzhead->hcrc) - wraplen += 2; - } - break; -#endif - default: /* for compiler happiness */ - wraplen = 6; - } - - /* if not default parameters, return conservative bound */ - if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return complen + wraplen; - - /* default settings: return tight bound for that case */ - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + - (sourceLen >> 25) + 13 - 6 + wraplen; -} - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -local void putShortMSB (s, b) - deflate_state *s; - uInt b; -{ - put_byte(s, (Byte)(b >> 8)); - put_byte(s, (Byte)(b & 0xff)); -} - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output, except for - * some deflate_stored() output, goes through this function so some - * applications may wish to modify it to avoid allocating a large - * strm->next_out buffer and copying into it. (See also read_buf()). - */ -local void flush_pending(strm) - z_streamp strm; -{ - unsigned len; - deflate_state *s = strm->state; - - _tr_flush_bits(s); - len = s->pending; - if (len > strm->avail_out) len = strm->avail_out; - if (len == 0) return; - - zmemcpy(strm->next_out, s->pending_out, len); - strm->next_out += len; - s->pending_out += len; - strm->total_out += len; - strm->avail_out -= len; - s->pending -= len; - if (s->pending == 0) { - s->pending_out = s->pending_buf; - } -} - -/* =========================================================================== - * Update the header CRC with the bytes s->pending_buf[beg..s->pending - 1]. - */ -#define HCRC_UPDATE(beg) \ - do { \ - if (s->gzhead->hcrc && s->pending > (beg)) \ - strm->adler = crc32(strm->adler, s->pending_buf + (beg), \ - s->pending - (beg)); \ - } while (0) - -/* ========================================================================= */ -int ZEXPORT deflate (strm, flush) - z_streamp strm; - int flush; -{ - int old_flush; /* value of flush param for previous deflate call */ - deflate_state *s; - - if (deflateStateCheck(strm) || flush > Z_BLOCK || flush < 0) { - return Z_STREAM_ERROR; - } - s = strm->state; - - if (strm->next_out == Z_NULL || - (strm->avail_in != 0 && strm->next_in == Z_NULL) || - (s->status == FINISH_STATE && flush != Z_FINISH)) { - ERR_RETURN(strm, Z_STREAM_ERROR); - } - if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); - - old_flush = s->last_flush; - s->last_flush = flush; - - /* Flush as much pending output as possible */ - if (s->pending != 0) { - flush_pending(strm); - if (strm->avail_out == 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s->last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && - flush != Z_FINISH) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s->status == FINISH_STATE && strm->avail_in != 0) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* Write the header */ - if (s->status == INIT_STATE) { - /* zlib header */ - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; - uInt level_flags; - - if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) - level_flags = 0; - else if (s->level < 6) - level_flags = 1; - else if (s->level == 6) - level_flags = 2; - else - level_flags = 3; - header |= (level_flags << 6); - if (s->strstart != 0) header |= PRESET_DICT; - header += 31 - (header % 31); - - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s->strstart != 0) { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - strm->adler = adler32(0L, Z_NULL, 0); - s->status = BUSY_STATE; - - /* Compression must start with an empty pending buffer */ - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - } -#ifdef GZIP - if (s->status == GZIP_STATE) { - /* gzip header */ - strm->adler = crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (s->gzhead == Z_NULL) { - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s->status = BUSY_STATE; - - /* Compression must start with an empty pending buffer */ - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - } - else { - put_byte(s, (s->gzhead->text ? 1 : 0) + - (s->gzhead->hcrc ? 2 : 0) + - (s->gzhead->extra == Z_NULL ? 0 : 4) + - (s->gzhead->name == Z_NULL ? 0 : 8) + - (s->gzhead->comment == Z_NULL ? 0 : 16) - ); - put_byte(s, (Byte)(s->gzhead->time & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, s->gzhead->os & 0xff); - if (s->gzhead->extra != Z_NULL) { - put_byte(s, s->gzhead->extra_len & 0xff); - put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); - } - if (s->gzhead->hcrc) - strm->adler = crc32(strm->adler, s->pending_buf, - s->pending); - s->gzindex = 0; - s->status = EXTRA_STATE; - } - } - if (s->status == EXTRA_STATE) { - if (s->gzhead->extra != Z_NULL) { - ulg beg = s->pending; /* start of bytes to update crc */ - uInt left = (s->gzhead->extra_len & 0xffff) - s->gzindex; - while (s->pending + left > s->pending_buf_size) { - uInt copy = s->pending_buf_size - s->pending; - zmemcpy(s->pending_buf + s->pending, - s->gzhead->extra + s->gzindex, copy); - s->pending = s->pending_buf_size; - HCRC_UPDATE(beg); - s->gzindex += copy; - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - beg = 0; - left -= copy; - } - zmemcpy(s->pending_buf + s->pending, - s->gzhead->extra + s->gzindex, left); - s->pending += left; - HCRC_UPDATE(beg); - s->gzindex = 0; - } - s->status = NAME_STATE; - } - if (s->status == NAME_STATE) { - if (s->gzhead->name != Z_NULL) { - ulg beg = s->pending; /* start of bytes to update crc */ - int val; - do { - if (s->pending == s->pending_buf_size) { - HCRC_UPDATE(beg); - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - beg = 0; - } - val = s->gzhead->name[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - HCRC_UPDATE(beg); - s->gzindex = 0; - } - s->status = COMMENT_STATE; - } - if (s->status == COMMENT_STATE) { - if (s->gzhead->comment != Z_NULL) { - ulg beg = s->pending; /* start of bytes to update crc */ - int val; - do { - if (s->pending == s->pending_buf_size) { - HCRC_UPDATE(beg); - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - beg = 0; - } - val = s->gzhead->comment[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - HCRC_UPDATE(beg); - } - s->status = HCRC_STATE; - } - if (s->status == HCRC_STATE) { - if (s->gzhead->hcrc) { - if (s->pending + 2 > s->pending_buf_size) { - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - } - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - strm->adler = crc32(0L, Z_NULL, 0); - } - s->status = BUSY_STATE; - - /* Compression must start with an empty pending buffer */ - flush_pending(strm); - if (s->pending != 0) { - s->last_flush = -1; - return Z_OK; - } - } -#endif - - /* Start a new block or continue the current one. - */ - if (strm->avail_in != 0 || s->lookahead != 0 || - (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { - block_state bstate; - - bstate = s->level == 0 ? deflate_stored(s, flush) : - s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : - s->strategy == Z_RLE ? deflate_rle(s, flush) : - (*(configuration_table[s->level].func))(s, flush); - - if (bstate == finish_started || bstate == finish_done) { - s->status = FINISH_STATE; - } - if (bstate == need_more || bstate == finish_started) { - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate == block_done) { - if (flush == Z_PARTIAL_FLUSH) { - _tr_align(s); - } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ - _tr_stored_block(s, (char*)0, 0L, 0); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush == Z_FULL_FLUSH) { - CLEAR_HASH(s); /* forget history */ - if (s->lookahead == 0) { - s->strstart = 0; - s->block_start = 0L; - s->insert = 0; - } - } - } - flush_pending(strm); - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - - if (flush != Z_FINISH) return Z_OK; - if (s->wrap <= 0) return Z_STREAM_END; - - /* Write the trailer */ -#ifdef GZIP - if (s->wrap == 2) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); - put_byte(s, (Byte)(strm->total_in & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); - } - else -#endif - { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ - return s->pending != 0 ? Z_OK : Z_STREAM_END; -} - -/* ========================================================================= */ -int ZEXPORT deflateEnd (strm) - z_streamp strm; -{ - int status; - - if (deflateStateCheck(strm)) return Z_STREAM_ERROR; - - status = strm->state->status; - - /* Deallocate in reverse order of allocations: */ - TRY_FREE(strm, strm->state->pending_buf); - TRY_FREE(strm, strm->state->head); - TRY_FREE(strm, strm->state->prev); - TRY_FREE(strm, strm->state->window); - - ZFREE(strm, strm->state); - strm->state = Z_NULL; - - return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; -} - -/* ========================================================================= - * Copy the source state to the destination state. - * To simplify the source, this is not supported for 16-bit MSDOS (which - * doesn't have enough memory anyway to duplicate compression states). - */ -int ZEXPORT deflateCopy (dest, source) - z_streamp dest; - z_streamp source; -{ -#ifdef MAXSEG_64K - return Z_STREAM_ERROR; -#else - deflate_state *ds; - deflate_state *ss; - ushf *overlay; - - - if (deflateStateCheck(source) || dest == Z_NULL) { - return Z_STREAM_ERROR; - } - - ss = source->state; - - zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); - - ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); - if (ds == Z_NULL) return Z_MEM_ERROR; - dest->state = (struct internal_state FAR *) ds; - zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state)); - ds->strm = dest; - - ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); - ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); - ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); - ds->pending_buf = (uchf *) overlay; - - if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || - ds->pending_buf == Z_NULL) { - deflateEnd (dest); - return Z_MEM_ERROR; - } - /* following zmemcpy do not work for 16-bit MSDOS */ - zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); - zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); - zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); - - ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); - ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); - ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; - - ds->l_desc.dyn_tree = ds->dyn_ltree; - ds->d_desc.dyn_tree = ds->dyn_dtree; - ds->bl_desc.dyn_tree = ds->bl_tree; - - return Z_OK; -#endif /* MAXSEG_64K */ -} - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->next_in buffer and copying from it. - * (See also flush_pending()). - */ -local unsigned read_buf(strm, buf, size) - z_streamp strm; - Bytef *buf; - unsigned size; -{ - unsigned len = strm->avail_in; - - if (len > size) len = size; - if (len == 0) return 0; - - strm->avail_in -= len; - - zmemcpy(buf, strm->next_in, len); - if (strm->state->wrap == 1) { - strm->adler = adler32(strm->adler, buf, len); - } -#ifdef GZIP - else if (strm->state->wrap == 2) { - strm->adler = crc32(strm->adler, buf, len); - } -#endif - strm->next_in += len; - strm->total_in += len; - - return len; -} - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -local void lm_init (s) - deflate_state *s; -{ - s->window_size = (ulg)2L*s->w_size; - - CLEAR_HASH(s); - - /* Set the default configuration parameters: - */ - s->max_lazy_match = configuration_table[s->level].max_lazy; - s->good_match = configuration_table[s->level].good_length; - s->nice_match = configuration_table[s->level].nice_length; - s->max_chain_length = configuration_table[s->level].max_chain; - - s->strstart = 0; - s->block_start = 0L; - s->lookahead = 0; - s->insert = 0; - s->match_length = s->prev_length = MIN_MATCH-1; - s->match_available = 0; - s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif -} - -#ifndef FASTEST -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ -local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - unsigned chain_length = s->max_chain_length;/* max hash chain length */ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - int best_len = (int)s->prev_length; /* best match length so far */ - int nice_match = s->nice_match; /* stop if match long enough */ - IPos limit = s->strstart > (IPos)MAX_DIST(s) ? - s->strstart - (IPos)MAX_DIST(s) : NIL; - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - Posf *prev = s->prev; - uInt wmask = s->w_mask; - -#ifdef UNALIGNED_OK - /* Compare two bytes at a time. Note: this is not always beneficial. - * Try with and without -DUNALIGNED_OK to check. - */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; - register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); -#else - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; - register Byte scan_end = scan[best_len]; -#endif - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s->prev_length >= s->good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead; - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - Assert(cur_match < s->strstart, "no future"); - match = s->window + cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ -#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) - /* This code assumes sizeof(unsigned short) == 2. Do not use - * UNALIGNED_OK if your compiler uses a different size. - */ - if (*(ushf*)(match+best_len-1) != scan_end || - *(ushf*)match != scan_start) continue; - - /* It is not necessary to compare scan[2] and match[2] since they are - * always equal when the other bytes match, given that the hash keys - * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient - * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is - * necessary to put more guard bytes at the end of the window, or - * to check more often for insufficient lookahead. - */ - Assert(scan[2] == match[2], "scan[2]?"); - scan++, match++; - do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - scan < strend); - /* The funny "do {}" generates better code on most compilers */ - - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - if (*scan == *match) scan++; - - len = (MAX_MATCH - 1) - (int)(strend-scan); - scan = strend - (MAX_MATCH-1); - -#else /* UNALIGNED_OK */ - - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match++; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - scan = strend - MAX_MATCH; - -#endif /* UNALIGNED_OK */ - - if (len > best_len) { - s->match_start = cur_match; - best_len = len; - if (len >= nice_match) break; -#ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); -#else - scan_end1 = scan[best_len-1]; - scan_end = scan[best_len]; -#endif - } - } while ((cur_match = prev[cur_match & wmask]) > limit - && --chain_length != 0); - - if ((uInt)best_len <= s->lookahead) return (uInt)best_len; - return s->lookahead; -} -#endif /* ASMV */ - -#else /* FASTEST */ - -/* --------------------------------------------------------------------------- - * Optimized version for FASTEST only - */ -local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - Assert(cur_match < s->strstart, "no future"); - - match = s->window + cur_match; - - /* Return failure if the match length is less than 2: - */ - if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match += 2; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - - if (len < MIN_MATCH) return MIN_MATCH - 1; - - s->match_start = cur_match; - return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; -} - -#endif /* FASTEST */ - -#ifdef ZLIB_DEBUG - -#define EQUAL 0 -/* result of memcmp for equal strings */ - -/* =========================================================================== - * Check that the match at match_start is indeed a match. - */ -local void check_match(s, start, match, length) - deflate_state *s; - IPos start, match; - int length; -{ - /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); - do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); - z_error("invalid match"); - } - if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); - do { putc(s->window[start++], stderr); } while (--length != 0); - } -} -#else -# define check_match(s, start, match, length) -#endif /* ZLIB_DEBUG */ - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -local void fill_window(s) - deflate_state *s; -{ - unsigned n; - unsigned more; /* Amount of free space at the end of the window. */ - uInt wsize = s->w_size; - - Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); - - do { - more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); - - /* Deal with !@#$% 64K limit: */ - if (sizeof(int) <= 2) { - if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - more = wsize; - - } else if (more == (unsigned)(-1)) { - /* Very unlikely, but possible on 16 bit machine if - * strstart == 0 && lookahead == 1 (input done a byte at time) - */ - more--; - } - } - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s->strstart >= wsize+MAX_DIST(s)) { - - zmemcpy(s->window, s->window+wsize, (unsigned)wsize - more); - s->match_start -= wsize; - s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ - s->block_start -= (long) wsize; - slide_hash(s); - more += wsize; - } - if (s->strm->avail_in == 0) break; - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - Assert(more >= 2, "more < 2"); - - n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); - s->lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s->lookahead + s->insert >= MIN_MATCH) { - uInt str = s->strstart - s->insert; - s->ins_h = s->window[str]; - UPDATE_HASH(s, s->ins_h, s->window[str + 1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - while (s->insert) { - UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); -#ifndef FASTEST - s->prev[str & s->w_mask] = s->head[s->ins_h]; -#endif - s->head[s->ins_h] = (Pos)str; - str++; - s->insert--; - if (s->lookahead + s->insert < MIN_MATCH) - break; - } - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ - if (s->high_water < s->window_size) { - ulg curr = s->strstart + (ulg)(s->lookahead); - ulg init; - - if (s->high_water < curr) { - /* Previous high water mark below current data -- zero WIN_INIT - * bytes or up to end of window, whichever is less. - */ - init = s->window_size - curr; - if (init > WIN_INIT) - init = WIN_INIT; - zmemzero(s->window + curr, (unsigned)init); - s->high_water = curr + init; - } - else if (s->high_water < (ulg)curr + WIN_INIT) { - /* High water mark at or above current data, but below current data - * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up - * to end of window, whichever is less. - */ - init = (ulg)curr + WIN_INIT - s->high_water; - if (init > s->window_size - s->high_water) - init = s->window_size - s->high_water; - zmemzero(s->window + s->high_water, (unsigned)init); - s->high_water += init; - } - } - - Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, - "not enough room for search"); -} - -/* =========================================================================== - * Flush the current block, with given end-of-file flag. - * IN assertion: strstart is set to the end of the current match. - */ -#define FLUSH_BLOCK_ONLY(s, last) { \ - _tr_flush_block(s, (s->block_start >= 0L ? \ - (charf *)&s->window[(unsigned)s->block_start] : \ - (charf *)Z_NULL), \ - (ulg)((long)s->strstart - s->block_start), \ - (last)); \ - s->block_start = s->strstart; \ - flush_pending(s->strm); \ - Tracev((stderr,"[FLUSH]")); \ -} - -/* Same but force premature exit if necessary. */ -#define FLUSH_BLOCK(s, last) { \ - FLUSH_BLOCK_ONLY(s, last); \ - if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ -} - -/* Maximum stored block length in deflate format (not including header). */ -#define MAX_STORED 65535 - -/* Minimum of a and b. */ -#define MIN(a, b) ((a) > (b) ? (b) : (a)) - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * - * In case deflateParams() is used to later switch to a non-zero compression - * level, s->matches (otherwise unused when storing) keeps track of the number - * of hash table slides to perform. If s->matches is 1, then one hash table - * slide will be done when switching. If s->matches is 2, the maximum value - * allowed here, then the hash table will be cleared, since two or more slides - * is the same as a clear. - * - * deflate_stored() is written to minimize the number of times an input byte is - * copied. It is most efficient with large input and output buffers, which - * maximizes the opportunites to have a single copy from next_in to next_out. - */ -local block_state deflate_stored(s, flush) - deflate_state *s; - int flush; -{ - /* Smallest worthy block size when not flushing or finishing. By default - * this is 32K. This can be as small as 507 bytes for memLevel == 1. For - * large input and output buffers, the stored block size will be larger. - */ - unsigned min_block = MIN(s->pending_buf_size - 5, s->w_size); - - /* Copy as many min_block or larger stored blocks directly to next_out as - * possible. If flushing, copy the remaining available input to next_out as - * stored blocks, if there is enough space. - */ - unsigned len, left, have, last = 0; - unsigned used = s->strm->avail_in; - do { - /* Set len to the maximum size block that we can copy directly with the - * available input data and output space. Set left to how much of that - * would be copied from what's left in the window. - */ - len = MAX_STORED; /* maximum deflate stored block length */ - have = (s->bi_valid + 42) >> 3; /* number of header bytes */ - if (s->strm->avail_out < have) /* need room for header */ - break; - /* maximum stored block length that will fit in avail_out: */ - have = s->strm->avail_out - have; - left = s->strstart - s->block_start; /* bytes left in window */ - if (len > (ulg)left + s->strm->avail_in) - len = left + s->strm->avail_in; /* limit len to the input */ - if (len > have) - len = have; /* limit len to the output */ - - /* If the stored block would be less than min_block in length, or if - * unable to copy all of the available input when flushing, then try - * copying to the window and the pending buffer instead. Also don't - * write an empty block when flushing -- deflate() does that. - */ - if (len < min_block && ((len == 0 && flush != Z_FINISH) || - flush == Z_NO_FLUSH || - len != left + s->strm->avail_in)) - break; - - /* Make a dummy stored block in pending to get the header bytes, - * including any pending bits. This also updates the debugging counts. - */ - last = flush == Z_FINISH && len == left + s->strm->avail_in ? 1 : 0; - _tr_stored_block(s, (char *)0, 0L, last); - - /* Replace the lengths in the dummy stored block with len. */ - s->pending_buf[s->pending - 4] = len; - s->pending_buf[s->pending - 3] = len >> 8; - s->pending_buf[s->pending - 2] = ~len; - s->pending_buf[s->pending - 1] = ~len >> 8; - - /* Write the stored block header bytes. */ - flush_pending(s->strm); - -#ifdef ZLIB_DEBUG - /* Update debugging counts for the data about to be copied. */ - s->compressed_len += len << 3; - s->bits_sent += len << 3; -#endif - - /* Copy uncompressed bytes from the window to next_out. */ - if (left) { - if (left > len) - left = len; - zmemcpy(s->strm->next_out, s->window + s->block_start, left); - s->strm->next_out += left; - s->strm->avail_out -= left; - s->strm->total_out += left; - s->block_start += left; - len -= left; - } - - /* Copy uncompressed bytes directly from next_in to next_out, updating - * the check value. - */ - if (len) { - read_buf(s->strm, s->strm->next_out, len); - s->strm->next_out += len; - s->strm->avail_out -= len; - s->strm->total_out += len; - } - } while (last == 0); - - /* Update the sliding window with the last s->w_size bytes of the copied - * data, or append all of the copied data to the existing window if less - * than s->w_size bytes were copied. Also update the number of bytes to - * insert in the hash tables, in the event that deflateParams() switches to - * a non-zero compression level. - */ - used -= s->strm->avail_in; /* number of input bytes directly copied */ - if (used) { - /* If any input was used, then no unused input remains in the window, - * therefore s->block_start == s->strstart. - */ - if (used >= s->w_size) { /* supplant the previous history */ - s->matches = 2; /* clear hash */ - zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size); - s->strstart = s->w_size; - } - else { - if (s->window_size - s->strstart <= used) { - /* Slide the window down. */ - s->strstart -= s->w_size; - zmemcpy(s->window, s->window + s->w_size, s->strstart); - if (s->matches < 2) - s->matches++; /* add a pending slide_hash() */ - } - zmemcpy(s->window + s->strstart, s->strm->next_in - used, used); - s->strstart += used; - } - s->block_start = s->strstart; - s->insert += MIN(used, s->w_size - s->insert); - } - if (s->high_water < s->strstart) - s->high_water = s->strstart; - - /* If the last block was written to next_out, then done. */ - if (last) - return finish_done; - - /* If flushing and all input has been consumed, then done. */ - if (flush != Z_NO_FLUSH && flush != Z_FINISH && - s->strm->avail_in == 0 && (long)s->strstart == s->block_start) - return block_done; - - /* Fill the window with any remaining input. */ - have = s->window_size - s->strstart - 1; - if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) { - /* Slide the window down. */ - s->block_start -= s->w_size; - s->strstart -= s->w_size; - zmemcpy(s->window, s->window + s->w_size, s->strstart); - if (s->matches < 2) - s->matches++; /* add a pending slide_hash() */ - have += s->w_size; /* more space now */ - } - if (have > s->strm->avail_in) - have = s->strm->avail_in; - if (have) { - read_buf(s->strm, s->window + s->strstart, have); - s->strstart += have; - } - if (s->high_water < s->strstart) - s->high_water = s->strstart; - - /* There was not enough avail_out to write a complete worthy or flushed - * stored block to next_out. Write a stored block to pending instead, if we - * have enough input for a worthy block, or if flushing and there is enough - * room for the remaining input as a stored block in the pending buffer. - */ - have = (s->bi_valid + 42) >> 3; /* number of header bytes */ - /* maximum stored block length that will fit in pending: */ - have = MIN(s->pending_buf_size - have, MAX_STORED); - min_block = MIN(have, s->w_size); - left = s->strstart - s->block_start; - if (left >= min_block || - ((left || flush == Z_FINISH) && flush != Z_NO_FLUSH && - s->strm->avail_in == 0 && left <= have)) { - len = MIN(left, have); - last = flush == Z_FINISH && s->strm->avail_in == 0 && - len == left ? 1 : 0; - _tr_stored_block(s, (charf *)s->window + s->block_start, len, last); - s->block_start += len; - flush_pending(s->strm); - } - - /* We've done all we can with the available input and output. */ - return last ? finish_started : need_more; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -local block_state deflate_fast(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head; /* head of the hash chain */ - int bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = NIL; - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s->match_length = longest_match (s, hash_head); - /* longest_match() sets match_start */ - } - if (s->match_length >= MIN_MATCH) { - check_match(s, s->strstart, s->match_start, s->match_length); - - _tr_tally_dist(s, s->strstart - s->match_start, - s->match_length - MIN_MATCH, bflush); - - s->lookahead -= s->match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ -#ifndef FASTEST - if (s->match_length <= s->max_insert_length && - s->lookahead >= MIN_MATCH) { - s->match_length--; /* string at strstart already in table */ - do { - s->strstart++; - INSERT_STRING(s, s->strstart, hash_head); - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s->match_length != 0); - s->strstart++; - } else -#endif - { - s->strstart += s->match_length; - s->match_length = 0; - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (s->last_lit) - FLUSH_BLOCK(s, 0); - return block_done; -} - -#ifndef FASTEST -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -local block_state deflate_slow(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head; /* head of hash chain */ - int bflush; /* set if current block must be flushed */ - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = NIL; - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - */ - s->prev_length = s->match_length, s->prev_match = s->match_start; - s->match_length = MIN_MATCH-1; - - if (hash_head != NIL && s->prev_length < s->max_lazy_match && - s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s->match_length = longest_match (s, hash_head); - /* longest_match() sets match_start */ - - if (s->match_length <= 5 && (s->strategy == Z_FILTERED -#if TOO_FAR <= 32767 - || (s->match_length == MIN_MATCH && - s->strstart - s->match_start > TOO_FAR) -#endif - )) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s->match_length = MIN_MATCH-1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { - uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - check_match(s, s->strstart-1, s->prev_match, s->prev_length); - - _tr_tally_dist(s, s->strstart -1 - s->prev_match, - s->prev_length - MIN_MATCH, bflush); - - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s->lookahead -= s->prev_length-1; - s->prev_length -= 2; - do { - if (++s->strstart <= max_insert) { - INSERT_STRING(s, s->strstart, hash_head); - } - } while (--s->prev_length != 0); - s->match_available = 0; - s->match_length = MIN_MATCH-1; - s->strstart++; - - if (bflush) FLUSH_BLOCK(s, 0); - - } else if (s->match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - if (bflush) { - FLUSH_BLOCK_ONLY(s, 0); - } - s->strstart++; - s->lookahead--; - if (s->strm->avail_out == 0) return need_more; - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s->match_available = 1; - s->strstart++; - s->lookahead--; - } - } - Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - s->match_available = 0; - } - s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (s->last_lit) - FLUSH_BLOCK(s, 0); - return block_done; -} -#endif /* FASTEST */ - -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -local block_state deflate_rle(s, flush) - deflate_state *s; - int flush; -{ - int bflush; /* set if current block must be flushed */ - uInt prev; /* byte at distance one to match */ - Bytef *scan, *strend; /* scan goes up to strend for length of run */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest run, plus one for the unrolled loop. - */ - if (s->lookahead <= MAX_MATCH) { - fill_window(s); - if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - s->match_length = 0; - if (s->lookahead >= MIN_MATCH && s->strstart > 0) { - scan = s->window + s->strstart - 1; - prev = *scan; - if (prev == *++scan && prev == *++scan && prev == *++scan) { - strend = s->window + s->strstart + MAX_MATCH; - do { - } while (prev == *++scan && prev == *++scan && - prev == *++scan && prev == *++scan && - prev == *++scan && prev == *++scan && - prev == *++scan && prev == *++scan && - scan < strend); - s->match_length = MAX_MATCH - (uInt)(strend - scan); - if (s->match_length > s->lookahead) - s->match_length = s->lookahead; - } - Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (s->match_length >= MIN_MATCH) { - check_match(s, s->strstart, s->strstart - 1, s->match_length); - - _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush); - - s->lookahead -= s->match_length; - s->strstart += s->match_length; - s->match_length = 0; - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - s->insert = 0; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (s->last_lit) - FLUSH_BLOCK(s, 0); - return block_done; -} - -/* =========================================================================== - * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. - * (It will be regenerated if this run of deflate switches away from Huffman.) - */ -local block_state deflate_huff(s, flush) - deflate_state *s; - int flush; -{ - int bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we have a literal to write. */ - if (s->lookahead == 0) { - fill_window(s); - if (s->lookahead == 0) { - if (flush == Z_NO_FLUSH) - return need_more; - break; /* flush the current block */ - } - } - - /* Output a literal byte */ - s->match_length = 0; - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - if (bflush) FLUSH_BLOCK(s, 0); - } - s->insert = 0; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (s->last_lit) - FLUSH_BLOCK(s, 0); - return block_done; -} diff --git a/compat/zlib/deflate.h b/compat/zlib/deflate.h deleted file mode 100644 index 23ecdd3..0000000 --- a/compat/zlib/deflate.h +++ /dev/null @@ -1,349 +0,0 @@ -/* deflate.h -- internal compression state - * Copyright (C) 1995-2016 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef DEFLATE_H -#define DEFLATE_H - -#include "zutil.h" - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer creation by deflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip encoding - should be left enabled. */ -#ifndef NO_GZIP -# define GZIP -#endif - -/* =========================================================================== - * Internal compression state. - */ - -#define LENGTH_CODES 29 -/* number of length codes, not counting the special END_BLOCK code */ - -#define LITERALS 256 -/* number of literal bytes 0..255 */ - -#define L_CODES (LITERALS+1+LENGTH_CODES) -/* number of Literal or Length codes, including the END_BLOCK code */ - -#define D_CODES 30 -/* number of distance codes */ - -#define BL_CODES 19 -/* number of codes used to transfer the bit lengths */ - -#define HEAP_SIZE (2*L_CODES+1) -/* maximum heap size */ - -#define MAX_BITS 15 -/* All codes must not exceed MAX_BITS bits */ - -#define Buf_size 16 -/* size of bit buffer in bi_buf */ - -#define INIT_STATE 42 /* zlib header -> BUSY_STATE */ -#ifdef GZIP -# define GZIP_STATE 57 /* gzip header -> BUSY_STATE | EXTRA_STATE */ -#endif -#define EXTRA_STATE 69 /* gzip extra block -> NAME_STATE */ -#define NAME_STATE 73 /* gzip file name -> COMMENT_STATE */ -#define COMMENT_STATE 91 /* gzip comment -> HCRC_STATE */ -#define HCRC_STATE 103 /* gzip header CRC -> BUSY_STATE */ -#define BUSY_STATE 113 /* deflate -> FINISH_STATE */ -#define FINISH_STATE 666 /* stream complete */ -/* Stream status */ - - -/* Data structure describing a single value and its code string. */ -typedef struct ct_data_s { - union { - ush freq; /* frequency count */ - ush code; /* bit string */ - } fc; - union { - ush dad; /* father node in Huffman tree */ - ush len; /* length of bit string */ - } dl; -} FAR ct_data; - -#define Freq fc.freq -#define Code fc.code -#define Dad dl.dad -#define Len dl.len - -typedef struct static_tree_desc_s static_tree_desc; - -typedef struct tree_desc_s { - ct_data *dyn_tree; /* the dynamic tree */ - int max_code; /* largest code with non zero frequency */ - const static_tree_desc *stat_desc; /* the corresponding static tree */ -} FAR tree_desc; - -typedef ush Pos; -typedef Pos FAR Posf; -typedef unsigned IPos; - -/* A Pos is an index in the character window. We use short instead of int to - * save space in the various tables. IPos is used only for parameter passing. - */ - -typedef struct internal_state { - z_streamp strm; /* pointer back to this zlib stream */ - int status; /* as the name implies */ - Bytef *pending_buf; /* output still pending */ - ulg pending_buf_size; /* size of pending_buf */ - Bytef *pending_out; /* next pending byte to output to the stream */ - ulg pending; /* nb of bytes in the pending buffer */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - gz_headerp gzhead; /* gzip header information to write */ - ulg gzindex; /* where in extra, name, or comment */ - Byte method; /* can only be DEFLATED */ - int last_flush; /* value of flush param for previous deflate call */ - - /* used by deflate.c: */ - - uInt w_size; /* LZ77 window size (32K by default) */ - uInt w_bits; /* log2(w_size) (8..16) */ - uInt w_mask; /* w_size - 1 */ - - Bytef *window; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. Also, it limits - * the window size to 64K, which is quite useful on MSDOS. - * To do: use the user input buffer as sliding window. - */ - - ulg window_size; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - Posf *prev; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - Posf *head; /* Heads of the hash chains or NIL. */ - - uInt ins_h; /* hash index of string to be inserted */ - uInt hash_size; /* number of elements in hash table */ - uInt hash_bits; /* log2(hash_size) */ - uInt hash_mask; /* hash_size-1 */ - - uInt hash_shift; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - long block_start; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - uInt match_length; /* length of best match */ - IPos prev_match; /* previous match */ - int match_available; /* set if previous match exists */ - uInt strstart; /* start of string to insert */ - uInt match_start; /* start of matching string */ - uInt lookahead; /* number of valid bytes ahead in window */ - - uInt prev_length; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - uInt max_chain_length; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - uInt max_lazy_match; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ -# define max_insert_length max_lazy_match - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - int level; /* compression level (1..9) */ - int strategy; /* favor or force Huffman coding*/ - - uInt good_match; - /* Use a faster search when the previous match is longer than this */ - - int nice_match; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - /* Didn't use ct_data typedef below to suppress compiler warning */ - struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - struct tree_desc_s l_desc; /* desc. for literal tree */ - struct tree_desc_s d_desc; /* desc. for distance tree */ - struct tree_desc_s bl_desc; /* desc. for bit length tree */ - - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - int heap_len; /* number of elements in the heap */ - int heap_max; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - uch depth[2*L_CODES+1]; - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - uchf *l_buf; /* buffer for literals or lengths */ - - uInt lit_bufsize; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - uInt last_lit; /* running index in l_buf */ - - ushf *d_buf; - /* Buffer for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - ulg opt_len; /* bit length of current block with optimal trees */ - ulg static_len; /* bit length of current block with static trees */ - uInt matches; /* number of string matches in current block */ - uInt insert; /* bytes at end of window left to insert */ - -#ifdef ZLIB_DEBUG - ulg compressed_len; /* total bit length of compressed file mod 2^32 */ - ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ -#endif - - ush bi_buf; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - int bi_valid; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - - ulg high_water; - /* High water mark offset in window for initialized bytes -- bytes above - * this are set to zero in order to avoid memory check warnings when - * longest match routines access bytes past the input. This is then - * updated to the new high water mark. - */ - -} FAR deflate_state; - -/* Output a byte on the stream. - * IN assertion: there is enough room in pending_buf. - */ -#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);} - - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) -/* In order to simplify the code, particularly on 16 bit machines, match - * distances are limited to MAX_DIST instead of WSIZE. - */ - -#define WIN_INIT MAX_MATCH -/* Number of bytes after end of data in window to initialize in order to avoid - memory checker errors from longest match routines */ - - /* in trees.c */ -void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); -int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); -void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, - ulg stored_len, int last)); -void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s)); -void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); -void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, - ulg stored_len, int last)); - -#define d_code(dist) \ - ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) -/* Mapping from a distance to a distance code. dist is the distance - 1 and - * must not have side effects. _dist_code[256] and _dist_code[257] are never - * used. - */ - -#ifndef ZLIB_DEBUG -/* Inline versions of _tr_tally for speed: */ - -#if defined(GEN_TREES_H) || !defined(STDC) - extern uch ZLIB_INTERNAL _length_code[]; - extern uch ZLIB_INTERNAL _dist_code[]; -#else - extern const uch ZLIB_INTERNAL _length_code[]; - extern const uch ZLIB_INTERNAL _dist_code[]; -#endif - -# define _tr_tally_lit(s, c, flush) \ - { uch cc = (c); \ - s->d_buf[s->last_lit] = 0; \ - s->l_buf[s->last_lit++] = cc; \ - s->dyn_ltree[cc].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -# define _tr_tally_dist(s, distance, length, flush) \ - { uch len = (uch)(length); \ - ush dist = (ush)(distance); \ - s->d_buf[s->last_lit] = dist; \ - s->l_buf[s->last_lit++] = len; \ - dist--; \ - s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ - s->dyn_dtree[d_code(dist)].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -#else -# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) -# define _tr_tally_dist(s, distance, length, flush) \ - flush = _tr_tally(s, distance, length) -#endif - -#endif /* DEFLATE_H */ diff --git a/compat/zlib/examples/README.examples b/compat/zlib/examples/README.examples deleted file mode 100644 index 56a3171..0000000 --- a/compat/zlib/examples/README.examples +++ /dev/null @@ -1,49 +0,0 @@ -This directory contains examples of the use of zlib and other relevant -programs and documentation. - -enough.c - calculation and justification of ENOUGH parameter in inftrees.h - - calculates the maximum table space used in inflate tree - construction over all possible Huffman codes - -fitblk.c - compress just enough input to nearly fill a requested output size - - zlib isn't designed to do this, but fitblk does it anyway - -gun.c - uncompress a gzip file - - illustrates the use of inflateBack() for high speed file-to-file - decompression using call-back functions - - is approximately twice as fast as gzip -d - - also provides Unix uncompress functionality, again twice as fast - -gzappend.c - append to a gzip file - - illustrates the use of the Z_BLOCK flush parameter for inflate() - - illustrates the use of deflatePrime() to start at any bit - -gzjoin.c - join gzip files without recalculating the crc or recompressing - - illustrates the use of the Z_BLOCK flush parameter for inflate() - - illustrates the use of crc32_combine() - -gzlog.c -gzlog.h - efficiently and robustly maintain a message log file in gzip format - - illustrates use of raw deflate, Z_PARTIAL_FLUSH, deflatePrime(), - and deflateSetDictionary() - - illustrates use of a gzip header extra field - -zlib_how.html - painfully comprehensive description of zpipe.c (see below) - - describes in excruciating detail the use of deflate() and inflate() - -zpipe.c - reads and writes zlib streams from stdin to stdout - - illustrates the proper use of deflate() and inflate() - - deeply commented in zlib_how.html (see above) - -zran.c - index a zlib or gzip stream and randomly access it - - illustrates the use of Z_BLOCK, inflatePrime(), and - inflateSetDictionary() to provide random access diff --git a/compat/zlib/examples/enough.c b/compat/zlib/examples/enough.c deleted file mode 100644 index b991144..0000000 --- a/compat/zlib/examples/enough.c +++ /dev/null @@ -1,572 +0,0 @@ -/* enough.c -- determine the maximum size of inflate's Huffman code tables over - * all possible valid and complete Huffman codes, subject to a length limit. - * Copyright (C) 2007, 2008, 2012 Mark Adler - * Version 1.4 18 August 2012 Mark Adler - */ - -/* Version history: - 1.0 3 Jan 2007 First version (derived from codecount.c version 1.4) - 1.1 4 Jan 2007 Use faster incremental table usage computation - Prune examine() search on previously visited states - 1.2 5 Jan 2007 Comments clean up - As inflate does, decrease root for short codes - Refuse cases where inflate would increase root - 1.3 17 Feb 2008 Add argument for initial root table size - Fix bug for initial root table size == max - 1 - Use a macro to compute the history index - 1.4 18 Aug 2012 Avoid shifts more than bits in type (caused endless loop!) - Clean up comparisons of different types - Clean up code indentation - */ - -/* - Examine all possible Huffman codes for a given number of symbols and a - maximum code length in bits to determine the maximum table size for zilb's - inflate. Only complete Huffman codes are counted. - - Two codes are considered distinct if the vectors of the number of codes per - length are not identical. So permutations of the symbol assignments result - in the same code for the counting, as do permutations of the assignments of - the bit values to the codes (i.e. only canonical codes are counted). - - We build a code from shorter to longer lengths, determining how many symbols - are coded at each length. At each step, we have how many symbols remain to - be coded, what the last code length used was, and how many bit patterns of - that length remain unused. Then we add one to the code length and double the - number of unused patterns to graduate to the next code length. We then - assign all portions of the remaining symbols to that code length that - preserve the properties of a correct and eventually complete code. Those - properties are: we cannot use more bit patterns than are available; and when - all the symbols are used, there are exactly zero possible bit patterns - remaining. - - The inflate Huffman decoding algorithm uses two-level lookup tables for - speed. There is a single first-level table to decode codes up to root bits - in length (root == 9 in the current inflate implementation). The table - has 1 << root entries and is indexed by the next root bits of input. Codes - shorter than root bits have replicated table entries, so that the correct - entry is pointed to regardless of the bits that follow the short code. If - the code is longer than root bits, then the table entry points to a second- - level table. The size of that table is determined by the longest code with - that root-bit prefix. If that longest code has length len, then the table - has size 1 << (len - root), to index the remaining bits in that set of - codes. Each subsequent root-bit prefix then has its own sub-table. The - total number of table entries required by the code is calculated - incrementally as the number of codes at each bit length is populated. When - all of the codes are shorter than root bits, then root is reduced to the - longest code length, resulting in a single, smaller, one-level table. - - The inflate algorithm also provides for small values of root (relative to - the log2 of the number of symbols), where the shortest code has more bits - than root. In that case, root is increased to the length of the shortest - code. This program, by design, does not handle that case, so it is verified - that the number of symbols is less than 2^(root + 1). - - In order to speed up the examination (by about ten orders of magnitude for - the default arguments), the intermediate states in the build-up of a code - are remembered and previously visited branches are pruned. The memory - required for this will increase rapidly with the total number of symbols and - the maximum code length in bits. However this is a very small price to pay - for the vast speedup. - - First, all of the possible Huffman codes are counted, and reachable - intermediate states are noted by a non-zero count in a saved-results array. - Second, the intermediate states that lead to (root + 1) bit or longer codes - are used to look at all sub-codes from those junctures for their inflate - memory usage. (The amount of memory used is not affected by the number of - codes of root bits or less in length.) Third, the visited states in the - construction of those sub-codes and the associated calculation of the table - size is recalled in order to avoid recalculating from the same juncture. - Beginning the code examination at (root + 1) bit codes, which is enabled by - identifying the reachable nodes, accounts for about six of the orders of - magnitude of improvement for the default arguments. About another four - orders of magnitude come from not revisiting previous states. Out of - approximately 2x10^16 possible Huffman codes, only about 2x10^6 sub-codes - need to be examined to cover all of the possible table memory usage cases - for the default arguments of 286 symbols limited to 15-bit codes. - - Note that an unsigned long long type is used for counting. It is quite easy - to exceed the capacity of an eight-byte integer with a large number of - symbols and a large maximum code length, so multiple-precision arithmetic - would need to replace the unsigned long long arithmetic in that case. This - program will abort if an overflow occurs. The big_t type identifies where - the counting takes place. - - An unsigned long long type is also used for calculating the number of - possible codes remaining at the maximum length. This limits the maximum - code length to the number of bits in a long long minus the number of bits - needed to represent the symbols in a flat code. The code_t type identifies - where the bit pattern counting takes place. - */ - -#include -#include -#include -#include - -#define local static - -/* special data types */ -typedef unsigned long long big_t; /* type for code counting */ -typedef unsigned long long code_t; /* type for bit pattern counting */ -struct tab { /* type for been here check */ - size_t len; /* length of bit vector in char's */ - char *vec; /* allocated bit vector */ -}; - -/* The array for saving results, num[], is indexed with this triplet: - - syms: number of symbols remaining to code - left: number of available bit patterns at length len - len: number of bits in the codes currently being assigned - - Those indices are constrained thusly when saving results: - - syms: 3..totsym (totsym == total symbols to code) - left: 2..syms - 1, but only the evens (so syms == 8 -> 2, 4, 6) - len: 1..max - 1 (max == maximum code length in bits) - - syms == 2 is not saved since that immediately leads to a single code. left - must be even, since it represents the number of available bit patterns at - the current length, which is double the number at the previous length. - left ends at syms-1 since left == syms immediately results in a single code. - (left > sym is not allowed since that would result in an incomplete code.) - len is less than max, since the code completes immediately when len == max. - - The offset into the array is calculated for the three indices with the - first one (syms) being outermost, and the last one (len) being innermost. - We build the array with length max-1 lists for the len index, with syms-3 - of those for each symbol. There are totsym-2 of those, with each one - varying in length as a function of sym. See the calculation of index in - count() for the index, and the calculation of size in main() for the size - of the array. - - For the deflate example of 286 symbols limited to 15-bit codes, the array - has 284,284 entries, taking up 2.17 MB for an 8-byte big_t. More than - half of the space allocated for saved results is actually used -- not all - possible triplets are reached in the generation of valid Huffman codes. - */ - -/* The array for tracking visited states, done[], is itself indexed identically - to the num[] array as described above for the (syms, left, len) triplet. - Each element in the array is further indexed by the (mem, rem) doublet, - where mem is the amount of inflate table space used so far, and rem is the - remaining unused entries in the current inflate sub-table. Each indexed - element is simply one bit indicating whether the state has been visited or - not. Since the ranges for mem and rem are not known a priori, each bit - vector is of a variable size, and grows as needed to accommodate the visited - states. mem and rem are used to calculate a single index in a triangular - array. Since the range of mem is expected in the default case to be about - ten times larger than the range of rem, the array is skewed to reduce the - memory usage, with eight times the range for mem than for rem. See the - calculations for offset and bit in beenhere() for the details. - - For the deflate example of 286 symbols limited to 15-bit codes, the bit - vectors grow to total approximately 21 MB, in addition to the 4.3 MB done[] - array itself. - */ - -/* Globals to avoid propagating constants or constant pointers recursively */ -local int max; /* maximum allowed bit length for the codes */ -local int root; /* size of base code table in bits */ -local int large; /* largest code table so far */ -local size_t size; /* number of elements in num and done */ -local int *code; /* number of symbols assigned to each bit length */ -local big_t *num; /* saved results array for code counting */ -local struct tab *done; /* states already evaluated array */ - -/* Index function for num[] and done[] */ -#define INDEX(i,j,k) (((size_t)((i-1)>>1)*((i-2)>>1)+(j>>1)-1)*(max-1)+k-1) - -/* Free allocated space. Uses globals code, num, and done. */ -local void cleanup(void) -{ - size_t n; - - if (done != NULL) { - for (n = 0; n < size; n++) - if (done[n].len) - free(done[n].vec); - free(done); - } - if (num != NULL) - free(num); - if (code != NULL) - free(code); -} - -/* Return the number of possible Huffman codes using bit patterns of lengths - len through max inclusive, coding syms symbols, with left bit patterns of - length len unused -- return -1 if there is an overflow in the counting. - Keep a record of previous results in num to prevent repeating the same - calculation. Uses the globals max and num. */ -local big_t count(int syms, int len, int left) -{ - big_t sum; /* number of possible codes from this juncture */ - big_t got; /* value returned from count() */ - int least; /* least number of syms to use at this juncture */ - int most; /* most number of syms to use at this juncture */ - int use; /* number of bit patterns to use in next call */ - size_t index; /* index of this case in *num */ - - /* see if only one possible code */ - if (syms == left) - return 1; - - /* note and verify the expected state */ - assert(syms > left && left > 0 && len < max); - - /* see if we've done this one already */ - index = INDEX(syms, left, len); - got = num[index]; - if (got) - return got; /* we have -- return the saved result */ - - /* we need to use at least this many bit patterns so that the code won't be - incomplete at the next length (more bit patterns than symbols) */ - least = (left << 1) - syms; - if (least < 0) - least = 0; - - /* we can use at most this many bit patterns, lest there not be enough - available for the remaining symbols at the maximum length (if there were - no limit to the code length, this would become: most = left - 1) */ - most = (((code_t)left << (max - len)) - syms) / - (((code_t)1 << (max - len)) - 1); - - /* count all possible codes from this juncture and add them up */ - sum = 0; - for (use = least; use <= most; use++) { - got = count(syms - use, len + 1, (left - use) << 1); - sum += got; - if (got == (big_t)0 - 1 || sum < got) /* overflow */ - return (big_t)0 - 1; - } - - /* verify that all recursive calls are productive */ - assert(sum != 0); - - /* save the result and return it */ - num[index] = sum; - return sum; -} - -/* Return true if we've been here before, set to true if not. Set a bit in a - bit vector to indicate visiting this state. Each (syms,len,left) state - has a variable size bit vector indexed by (mem,rem). The bit vector is - lengthened if needed to allow setting the (mem,rem) bit. */ -local int beenhere(int syms, int len, int left, int mem, int rem) -{ - size_t index; /* index for this state's bit vector */ - size_t offset; /* offset in this state's bit vector */ - int bit; /* mask for this state's bit */ - size_t length; /* length of the bit vector in bytes */ - char *vector; /* new or enlarged bit vector */ - - /* point to vector for (syms,left,len), bit in vector for (mem,rem) */ - index = INDEX(syms, left, len); - mem -= 1 << root; - offset = (mem >> 3) + rem; - offset = ((offset * (offset + 1)) >> 1) + rem; - bit = 1 << (mem & 7); - - /* see if we've been here */ - length = done[index].len; - if (offset < length && (done[index].vec[offset] & bit) != 0) - return 1; /* done this! */ - - /* we haven't been here before -- set the bit to show we have now */ - - /* see if we need to lengthen the vector in order to set the bit */ - if (length <= offset) { - /* if we have one already, enlarge it, zero out the appended space */ - if (length) { - do { - length <<= 1; - } while (length <= offset); - vector = realloc(done[index].vec, length); - if (vector != NULL) - memset(vector + done[index].len, 0, length - done[index].len); - } - - /* otherwise we need to make a new vector and zero it out */ - else { - length = 1 << (len - root); - while (length <= offset) - length <<= 1; - vector = calloc(length, sizeof(char)); - } - - /* in either case, bail if we can't get the memory */ - if (vector == NULL) { - fputs("abort: unable to allocate enough memory\n", stderr); - cleanup(); - exit(1); - } - - /* install the new vector */ - done[index].len = length; - done[index].vec = vector; - } - - /* set the bit */ - done[index].vec[offset] |= bit; - return 0; -} - -/* Examine all possible codes from the given node (syms, len, left). Compute - the amount of memory required to build inflate's decoding tables, where the - number of code structures used so far is mem, and the number remaining in - the current sub-table is rem. Uses the globals max, code, root, large, and - done. */ -local void examine(int syms, int len, int left, int mem, int rem) -{ - int least; /* least number of syms to use at this juncture */ - int most; /* most number of syms to use at this juncture */ - int use; /* number of bit patterns to use in next call */ - - /* see if we have a complete code */ - if (syms == left) { - /* set the last code entry */ - code[len] = left; - - /* complete computation of memory used by this code */ - while (rem < left) { - left -= rem; - rem = 1 << (len - root); - mem += rem; - } - assert(rem == left); - - /* if this is a new maximum, show the entries used and the sub-code */ - if (mem > large) { - large = mem; - printf("max %d: ", mem); - for (use = root + 1; use <= max; use++) - if (code[use]) - printf("%d[%d] ", code[use], use); - putchar('\n'); - fflush(stdout); - } - - /* remove entries as we drop back down in the recursion */ - code[len] = 0; - return; - } - - /* prune the tree if we can */ - if (beenhere(syms, len, left, mem, rem)) - return; - - /* we need to use at least this many bit patterns so that the code won't be - incomplete at the next length (more bit patterns than symbols) */ - least = (left << 1) - syms; - if (least < 0) - least = 0; - - /* we can use at most this many bit patterns, lest there not be enough - available for the remaining symbols at the maximum length (if there were - no limit to the code length, this would become: most = left - 1) */ - most = (((code_t)left << (max - len)) - syms) / - (((code_t)1 << (max - len)) - 1); - - /* occupy least table spaces, creating new sub-tables as needed */ - use = least; - while (rem < use) { - use -= rem; - rem = 1 << (len - root); - mem += rem; - } - rem -= use; - - /* examine codes from here, updating table space as we go */ - for (use = least; use <= most; use++) { - code[len] = use; - examine(syms - use, len + 1, (left - use) << 1, - mem + (rem ? 1 << (len - root) : 0), rem << 1); - if (rem == 0) { - rem = 1 << (len - root); - mem += rem; - } - rem--; - } - - /* remove entries as we drop back down in the recursion */ - code[len] = 0; -} - -/* Look at all sub-codes starting with root + 1 bits. Look at only the valid - intermediate code states (syms, left, len). For each completed code, - calculate the amount of memory required by inflate to build the decoding - tables. Find the maximum amount of memory required and show the code that - requires that maximum. Uses the globals max, root, and num. */ -local void enough(int syms) -{ - int n; /* number of remaing symbols for this node */ - int left; /* number of unused bit patterns at this length */ - size_t index; /* index of this case in *num */ - - /* clear code */ - for (n = 0; n <= max; n++) - code[n] = 0; - - /* look at all (root + 1) bit and longer codes */ - large = 1 << root; /* base table */ - if (root < max) /* otherwise, there's only a base table */ - for (n = 3; n <= syms; n++) - for (left = 2; left < n; left += 2) - { - /* look at all reachable (root + 1) bit nodes, and the - resulting codes (complete at root + 2 or more) */ - index = INDEX(n, left, root + 1); - if (root + 1 < max && num[index]) /* reachable node */ - examine(n, root + 1, left, 1 << root, 0); - - /* also look at root bit codes with completions at root + 1 - bits (not saved in num, since complete), just in case */ - if (num[index - 1] && n <= left << 1) - examine((n - left) << 1, root + 1, (n - left) << 1, - 1 << root, 0); - } - - /* done */ - printf("done: maximum of %d table entries\n", large); -} - -/* - Examine and show the total number of possible Huffman codes for a given - maximum number of symbols, initial root table size, and maximum code length - in bits -- those are the command arguments in that order. The default - values are 286, 9, and 15 respectively, for the deflate literal/length code. - The possible codes are counted for each number of coded symbols from two to - the maximum. The counts for each of those and the total number of codes are - shown. The maximum number of inflate table entires is then calculated - across all possible codes. Each new maximum number of table entries and the - associated sub-code (starting at root + 1 == 10 bits) is shown. - - To count and examine Huffman codes that are not length-limited, provide a - maximum length equal to the number of symbols minus one. - - For the deflate literal/length code, use "enough". For the deflate distance - code, use "enough 30 6". - - This uses the %llu printf format to print big_t numbers, which assumes that - big_t is an unsigned long long. If the big_t type is changed (for example - to a multiple precision type), the method of printing will also need to be - updated. - */ -int main(int argc, char **argv) -{ - int syms; /* total number of symbols to code */ - int n; /* number of symbols to code for this run */ - big_t got; /* return value of count() */ - big_t sum; /* accumulated number of codes over n */ - code_t word; /* for counting bits in code_t */ - - /* set up globals for cleanup() */ - code = NULL; - num = NULL; - done = NULL; - - /* get arguments -- default to the deflate literal/length code */ - syms = 286; - root = 9; - max = 15; - if (argc > 1) { - syms = atoi(argv[1]); - if (argc > 2) { - root = atoi(argv[2]); - if (argc > 3) - max = atoi(argv[3]); - } - } - if (argc > 4 || syms < 2 || root < 1 || max < 1) { - fputs("invalid arguments, need: [sym >= 2 [root >= 1 [max >= 1]]]\n", - stderr); - return 1; - } - - /* if not restricting the code length, the longest is syms - 1 */ - if (max > syms - 1) - max = syms - 1; - - /* determine the number of bits in a code_t */ - for (n = 0, word = 1; word; n++, word <<= 1) - ; - - /* make sure that the calculation of most will not overflow */ - if (max > n || (code_t)(syms - 2) >= (((code_t)0 - 1) >> (max - 1))) { - fputs("abort: code length too long for internal types\n", stderr); - return 1; - } - - /* reject impossible code requests */ - if ((code_t)(syms - 1) > ((code_t)1 << max) - 1) { - fprintf(stderr, "%d symbols cannot be coded in %d bits\n", - syms, max); - return 1; - } - - /* allocate code vector */ - code = calloc(max + 1, sizeof(int)); - if (code == NULL) { - fputs("abort: unable to allocate enough memory\n", stderr); - return 1; - } - - /* determine size of saved results array, checking for overflows, - allocate and clear the array (set all to zero with calloc()) */ - if (syms == 2) /* iff max == 1 */ - num = NULL; /* won't be saving any results */ - else { - size = syms >> 1; - if (size > ((size_t)0 - 1) / (n = (syms - 1) >> 1) || - (size *= n, size > ((size_t)0 - 1) / (n = max - 1)) || - (size *= n, size > ((size_t)0 - 1) / sizeof(big_t)) || - (num = calloc(size, sizeof(big_t))) == NULL) { - fputs("abort: unable to allocate enough memory\n", stderr); - cleanup(); - return 1; - } - } - - /* count possible codes for all numbers of symbols, add up counts */ - sum = 0; - for (n = 2; n <= syms; n++) { - got = count(n, 1, 2); - sum += got; - if (got == (big_t)0 - 1 || sum < got) { /* overflow */ - fputs("abort: can't count that high!\n", stderr); - cleanup(); - return 1; - } - printf("%llu %d-codes\n", got, n); - } - printf("%llu total codes for 2 to %d symbols", sum, syms); - if (max < syms - 1) - printf(" (%d-bit length limit)\n", max); - else - puts(" (no length limit)"); - - /* allocate and clear done array for beenhere() */ - if (syms == 2) - done = NULL; - else if (size > ((size_t)0 - 1) / sizeof(struct tab) || - (done = calloc(size, sizeof(struct tab))) == NULL) { - fputs("abort: unable to allocate enough memory\n", stderr); - cleanup(); - return 1; - } - - /* find and show maximum inflate table usage */ - if (root > max) /* reduce root to max length */ - root = max; - if ((code_t)syms < ((code_t)1 << (root + 1))) - enough(syms); - else - puts("cannot handle minimum code lengths > root"); - - /* done */ - cleanup(); - return 0; -} diff --git a/compat/zlib/examples/fitblk.c b/compat/zlib/examples/fitblk.c deleted file mode 100644 index c61de5c..0000000 --- a/compat/zlib/examples/fitblk.c +++ /dev/null @@ -1,233 +0,0 @@ -/* fitblk.c: example of fitting compressed output to a specified size - Not copyrighted -- provided to the public domain - Version 1.1 25 November 2004 Mark Adler */ - -/* Version history: - 1.0 24 Nov 2004 First version - 1.1 25 Nov 2004 Change deflateInit2() to deflateInit() - Use fixed-size, stack-allocated raw buffers - Simplify code moving compression to subroutines - Use assert() for internal errors - Add detailed description of approach - */ - -/* Approach to just fitting a requested compressed size: - - fitblk performs three compression passes on a portion of the input - data in order to determine how much of that input will compress to - nearly the requested output block size. The first pass generates - enough deflate blocks to produce output to fill the requested - output size plus a specfied excess amount (see the EXCESS define - below). The last deflate block may go quite a bit past that, but - is discarded. The second pass decompresses and recompresses just - the compressed data that fit in the requested plus excess sized - buffer. The deflate process is terminated after that amount of - input, which is less than the amount consumed on the first pass. - The last deflate block of the result will be of a comparable size - to the final product, so that the header for that deflate block and - the compression ratio for that block will be about the same as in - the final product. The third compression pass decompresses the - result of the second step, but only the compressed data up to the - requested size minus an amount to allow the compressed stream to - complete (see the MARGIN define below). That will result in a - final compressed stream whose length is less than or equal to the - requested size. Assuming sufficient input and a requested size - greater than a few hundred bytes, the shortfall will typically be - less than ten bytes. - - If the input is short enough that the first compression completes - before filling the requested output size, then that compressed - stream is return with no recompression. - - EXCESS is chosen to be just greater than the shortfall seen in a - two pass approach similar to the above. That shortfall is due to - the last deflate block compressing more efficiently with a smaller - header on the second pass. EXCESS is set to be large enough so - that there is enough uncompressed data for the second pass to fill - out the requested size, and small enough so that the final deflate - block of the second pass will be close in size to the final deflate - block of the third and final pass. MARGIN is chosen to be just - large enough to assure that the final compression has enough room - to complete in all cases. - */ - -#include -#include -#include -#include "zlib.h" - -#define local static - -/* print nastygram and leave */ -local void quit(char *why) -{ - fprintf(stderr, "fitblk abort: %s\n", why); - exit(1); -} - -#define RAWLEN 4096 /* intermediate uncompressed buffer size */ - -/* compress from file to def until provided buffer is full or end of - input reached; return last deflate() return value, or Z_ERRNO if - there was read error on the file */ -local int partcompress(FILE *in, z_streamp def) -{ - int ret, flush; - unsigned char raw[RAWLEN]; - - flush = Z_NO_FLUSH; - do { - def->avail_in = fread(raw, 1, RAWLEN, in); - if (ferror(in)) - return Z_ERRNO; - def->next_in = raw; - if (feof(in)) - flush = Z_FINISH; - ret = deflate(def, flush); - assert(ret != Z_STREAM_ERROR); - } while (def->avail_out != 0 && flush == Z_NO_FLUSH); - return ret; -} - -/* recompress from inf's input to def's output; the input for inf and - the output for def are set in those structures before calling; - return last deflate() return value, or Z_MEM_ERROR if inflate() - was not able to allocate enough memory when it needed to */ -local int recompress(z_streamp inf, z_streamp def) -{ - int ret, flush; - unsigned char raw[RAWLEN]; - - flush = Z_NO_FLUSH; - do { - /* decompress */ - inf->avail_out = RAWLEN; - inf->next_out = raw; - ret = inflate(inf, Z_NO_FLUSH); - assert(ret != Z_STREAM_ERROR && ret != Z_DATA_ERROR && - ret != Z_NEED_DICT); - if (ret == Z_MEM_ERROR) - return ret; - - /* compress what was decompresed until done or no room */ - def->avail_in = RAWLEN - inf->avail_out; - def->next_in = raw; - if (inf->avail_out != 0) - flush = Z_FINISH; - ret = deflate(def, flush); - assert(ret != Z_STREAM_ERROR); - } while (ret != Z_STREAM_END && def->avail_out != 0); - return ret; -} - -#define EXCESS 256 /* empirically determined stream overage */ -#define MARGIN 8 /* amount to back off for completion */ - -/* compress from stdin to fixed-size block on stdout */ -int main(int argc, char **argv) -{ - int ret; /* return code */ - unsigned size; /* requested fixed output block size */ - unsigned have; /* bytes written by deflate() call */ - unsigned char *blk; /* intermediate and final stream */ - unsigned char *tmp; /* close to desired size stream */ - z_stream def, inf; /* zlib deflate and inflate states */ - - /* get requested output size */ - if (argc != 2) - quit("need one argument: size of output block"); - ret = strtol(argv[1], argv + 1, 10); - if (argv[1][0] != 0) - quit("argument must be a number"); - if (ret < 8) /* 8 is minimum zlib stream size */ - quit("need positive size of 8 or greater"); - size = (unsigned)ret; - - /* allocate memory for buffers and compression engine */ - blk = malloc(size + EXCESS); - def.zalloc = Z_NULL; - def.zfree = Z_NULL; - def.opaque = Z_NULL; - ret = deflateInit(&def, Z_DEFAULT_COMPRESSION); - if (ret != Z_OK || blk == NULL) - quit("out of memory"); - - /* compress from stdin until output full, or no more input */ - def.avail_out = size + EXCESS; - def.next_out = blk; - ret = partcompress(stdin, &def); - if (ret == Z_ERRNO) - quit("error reading input"); - - /* if it all fit, then size was undersubscribed -- done! */ - if (ret == Z_STREAM_END && def.avail_out >= EXCESS) { - /* write block to stdout */ - have = size + EXCESS - def.avail_out; - if (fwrite(blk, 1, have, stdout) != have || ferror(stdout)) - quit("error writing output"); - - /* clean up and print results to stderr */ - ret = deflateEnd(&def); - assert(ret != Z_STREAM_ERROR); - free(blk); - fprintf(stderr, - "%u bytes unused out of %u requested (all input)\n", - size - have, size); - return 0; - } - - /* it didn't all fit -- set up for recompression */ - inf.zalloc = Z_NULL; - inf.zfree = Z_NULL; - inf.opaque = Z_NULL; - inf.avail_in = 0; - inf.next_in = Z_NULL; - ret = inflateInit(&inf); - tmp = malloc(size + EXCESS); - if (ret != Z_OK || tmp == NULL) - quit("out of memory"); - ret = deflateReset(&def); - assert(ret != Z_STREAM_ERROR); - - /* do first recompression close to the right amount */ - inf.avail_in = size + EXCESS; - inf.next_in = blk; - def.avail_out = size + EXCESS; - def.next_out = tmp; - ret = recompress(&inf, &def); - if (ret == Z_MEM_ERROR) - quit("out of memory"); - - /* set up for next reocmpression */ - ret = inflateReset(&inf); - assert(ret != Z_STREAM_ERROR); - ret = deflateReset(&def); - assert(ret != Z_STREAM_ERROR); - - /* do second and final recompression (third compression) */ - inf.avail_in = size - MARGIN; /* assure stream will complete */ - inf.next_in = tmp; - def.avail_out = size; - def.next_out = blk; - ret = recompress(&inf, &def); - if (ret == Z_MEM_ERROR) - quit("out of memory"); - assert(ret == Z_STREAM_END); /* otherwise MARGIN too small */ - - /* done -- write block to stdout */ - have = size - def.avail_out; - if (fwrite(blk, 1, have, stdout) != have || ferror(stdout)) - quit("error writing output"); - - /* clean up and print results to stderr */ - free(tmp); - ret = inflateEnd(&inf); - assert(ret != Z_STREAM_ERROR); - ret = deflateEnd(&def); - assert(ret != Z_STREAM_ERROR); - free(blk); - fprintf(stderr, - "%u bytes unused out of %u requested (%lu input)\n", - size - have, size, def.total_in); - return 0; -} diff --git a/compat/zlib/examples/gun.c b/compat/zlib/examples/gun.c deleted file mode 100644 index be44fa5..0000000 --- a/compat/zlib/examples/gun.c +++ /dev/null @@ -1,702 +0,0 @@ -/* gun.c -- simple gunzip to give an example of the use of inflateBack() - * Copyright (C) 2003, 2005, 2008, 2010, 2012 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - Version 1.7 12 August 2012 Mark Adler */ - -/* Version history: - 1.0 16 Feb 2003 First version for testing of inflateBack() - 1.1 21 Feb 2005 Decompress concatenated gzip streams - Remove use of "this" variable (C++ keyword) - Fix return value for in() - Improve allocation failure checking - Add typecasting for void * structures - Add -h option for command version and usage - Add a bunch of comments - 1.2 20 Mar 2005 Add Unix compress (LZW) decompression - Copy file attributes from input file to output file - 1.3 12 Jun 2005 Add casts for error messages [Oberhumer] - 1.4 8 Dec 2006 LZW decompression speed improvements - 1.5 9 Feb 2008 Avoid warning in latest version of gcc - 1.6 17 Jan 2010 Avoid signed/unsigned comparison warnings - 1.7 12 Aug 2012 Update for z_const usage in zlib 1.2.8 - */ - -/* - gun [ -t ] [ name ... ] - - decompresses the data in the named gzip files. If no arguments are given, - gun will decompress from stdin to stdout. The names must end in .gz, -gz, - .z, -z, _z, or .Z. The uncompressed data will be written to a file name - with the suffix stripped. On success, the original file is deleted. On - failure, the output file is deleted. For most failures, the command will - continue to process the remaining names on the command line. A memory - allocation failure will abort the command. If -t is specified, then the - listed files or stdin will be tested as gzip files for integrity (without - checking for a proper suffix), no output will be written, and no files - will be deleted. - - Like gzip, gun allows concatenated gzip streams and will decompress them, - writing all of the uncompressed data to the output. Unlike gzip, gun allows - an empty file on input, and will produce no error writing an empty output - file. - - gun will also decompress files made by Unix compress, which uses LZW - compression. These files are automatically detected by virtue of their - magic header bytes. Since the end of Unix compress stream is marked by the - end-of-file, they cannot be concantenated. If a Unix compress stream is - encountered in an input file, it is the last stream in that file. - - Like gunzip and uncompress, the file attributes of the original compressed - file are maintained in the final uncompressed file, to the extent that the - user permissions allow it. - - On my Mac OS X PowerPC G4, gun is almost twice as fast as gunzip (version - 1.2.4) is on the same file, when gun is linked with zlib 1.2.2. Also the - LZW decompression provided by gun is about twice as fast as the standard - Unix uncompress command. - */ - -/* external functions and related types and constants */ -#include /* fprintf() */ -#include /* malloc(), free() */ -#include /* strerror(), strcmp(), strlen(), memcpy() */ -#include /* errno */ -#include /* open() */ -#include /* read(), write(), close(), chown(), unlink() */ -#include -#include /* stat(), chmod() */ -#include /* utime() */ -#include "zlib.h" /* inflateBackInit(), inflateBack(), */ - /* inflateBackEnd(), crc32() */ - -/* function declaration */ -#define local static - -/* buffer constants */ -#define SIZE 32768U /* input and output buffer sizes */ -#define PIECE 16384 /* limits i/o chunks for 16-bit int case */ - -/* structure for infback() to pass to input function in() -- it maintains the - input file and a buffer of size SIZE */ -struct ind { - int infile; - unsigned char *inbuf; -}; - -/* Load input buffer, assumed to be empty, and return bytes loaded and a - pointer to them. read() is called until the buffer is full, or until it - returns end-of-file or error. Return 0 on error. */ -local unsigned in(void *in_desc, z_const unsigned char **buf) -{ - int ret; - unsigned len; - unsigned char *next; - struct ind *me = (struct ind *)in_desc; - - next = me->inbuf; - *buf = next; - len = 0; - do { - ret = PIECE; - if ((unsigned)ret > SIZE - len) - ret = (int)(SIZE - len); - ret = (int)read(me->infile, next, ret); - if (ret == -1) { - len = 0; - break; - } - next += ret; - len += ret; - } while (ret != 0 && len < SIZE); - return len; -} - -/* structure for infback() to pass to output function out() -- it maintains the - output file, a running CRC-32 check on the output and the total number of - bytes output, both for checking against the gzip trailer. (The length in - the gzip trailer is stored modulo 2^32, so it's ok if a long is 32 bits and - the output is greater than 4 GB.) */ -struct outd { - int outfile; - int check; /* true if checking crc and total */ - unsigned long crc; - unsigned long total; -}; - -/* Write output buffer and update the CRC-32 and total bytes written. write() - is called until all of the output is written or an error is encountered. - On success out() returns 0. For a write failure, out() returns 1. If the - output file descriptor is -1, then nothing is written. - */ -local int out(void *out_desc, unsigned char *buf, unsigned len) -{ - int ret; - struct outd *me = (struct outd *)out_desc; - - if (me->check) { - me->crc = crc32(me->crc, buf, len); - me->total += len; - } - if (me->outfile != -1) - do { - ret = PIECE; - if ((unsigned)ret > len) - ret = (int)len; - ret = (int)write(me->outfile, buf, ret); - if (ret == -1) - return 1; - buf += ret; - len -= ret; - } while (len != 0); - return 0; -} - -/* next input byte macro for use inside lunpipe() and gunpipe() */ -#define NEXT() (have ? 0 : (have = in(indp, &next)), \ - last = have ? (have--, (int)(*next++)) : -1) - -/* memory for gunpipe() and lunpipe() -- - the first 256 entries of prefix[] and suffix[] are never used, could - have offset the index, but it's faster to waste the memory */ -unsigned char inbuf[SIZE]; /* input buffer */ -unsigned char outbuf[SIZE]; /* output buffer */ -unsigned short prefix[65536]; /* index to LZW prefix string */ -unsigned char suffix[65536]; /* one-character LZW suffix */ -unsigned char match[65280 + 2]; /* buffer for reversed match or gzip - 32K sliding window */ - -/* throw out what's left in the current bits byte buffer (this is a vestigial - aspect of the compressed data format derived from an implementation that - made use of a special VAX machine instruction!) */ -#define FLUSHCODE() \ - do { \ - left = 0; \ - rem = 0; \ - if (chunk > have) { \ - chunk -= have; \ - have = 0; \ - if (NEXT() == -1) \ - break; \ - chunk--; \ - if (chunk > have) { \ - chunk = have = 0; \ - break; \ - } \ - } \ - have -= chunk; \ - next += chunk; \ - chunk = 0; \ - } while (0) - -/* Decompress a compress (LZW) file from indp to outfile. The compress magic - header (two bytes) has already been read and verified. There are have bytes - of buffered input at next. strm is used for passing error information back - to gunpipe(). - - lunpipe() will return Z_OK on success, Z_BUF_ERROR for an unexpected end of - file, read error, or write error (a write error indicated by strm->next_in - not equal to Z_NULL), or Z_DATA_ERROR for invalid input. - */ -local int lunpipe(unsigned have, z_const unsigned char *next, struct ind *indp, - int outfile, z_stream *strm) -{ - int last; /* last byte read by NEXT(), or -1 if EOF */ - unsigned chunk; /* bytes left in current chunk */ - int left; /* bits left in rem */ - unsigned rem; /* unused bits from input */ - int bits; /* current bits per code */ - unsigned code; /* code, table traversal index */ - unsigned mask; /* mask for current bits codes */ - int max; /* maximum bits per code for this stream */ - unsigned flags; /* compress flags, then block compress flag */ - unsigned end; /* last valid entry in prefix/suffix tables */ - unsigned temp; /* current code */ - unsigned prev; /* previous code */ - unsigned final; /* last character written for previous code */ - unsigned stack; /* next position for reversed string */ - unsigned outcnt; /* bytes in output buffer */ - struct outd outd; /* output structure */ - unsigned char *p; - - /* set up output */ - outd.outfile = outfile; - outd.check = 0; - - /* process remainder of compress header -- a flags byte */ - flags = NEXT(); - if (last == -1) - return Z_BUF_ERROR; - if (flags & 0x60) { - strm->msg = (char *)"unknown lzw flags set"; - return Z_DATA_ERROR; - } - max = flags & 0x1f; - if (max < 9 || max > 16) { - strm->msg = (char *)"lzw bits out of range"; - return Z_DATA_ERROR; - } - if (max == 9) /* 9 doesn't really mean 9 */ - max = 10; - flags &= 0x80; /* true if block compress */ - - /* clear table */ - bits = 9; - mask = 0x1ff; - end = flags ? 256 : 255; - - /* set up: get first 9-bit code, which is the first decompressed byte, but - don't create a table entry until the next code */ - if (NEXT() == -1) /* no compressed data is ok */ - return Z_OK; - final = prev = (unsigned)last; /* low 8 bits of code */ - if (NEXT() == -1) /* missing a bit */ - return Z_BUF_ERROR; - if (last & 1) { /* code must be < 256 */ - strm->msg = (char *)"invalid lzw code"; - return Z_DATA_ERROR; - } - rem = (unsigned)last >> 1; /* remaining 7 bits */ - left = 7; - chunk = bits - 2; /* 7 bytes left in this chunk */ - outbuf[0] = (unsigned char)final; /* write first decompressed byte */ - outcnt = 1; - - /* decode codes */ - stack = 0; - for (;;) { - /* if the table will be full after this, increment the code size */ - if (end >= mask && bits < max) { - FLUSHCODE(); - bits++; - mask <<= 1; - mask++; - } - - /* get a code of length bits */ - if (chunk == 0) /* decrement chunk modulo bits */ - chunk = bits; - code = rem; /* low bits of code */ - if (NEXT() == -1) { /* EOF is end of compressed data */ - /* write remaining buffered output */ - if (outcnt && out(&outd, outbuf, outcnt)) { - strm->next_in = outbuf; /* signal write error */ - return Z_BUF_ERROR; - } - return Z_OK; - } - code += (unsigned)last << left; /* middle (or high) bits of code */ - left += 8; - chunk--; - if (bits > left) { /* need more bits */ - if (NEXT() == -1) /* can't end in middle of code */ - return Z_BUF_ERROR; - code += (unsigned)last << left; /* high bits of code */ - left += 8; - chunk--; - } - code &= mask; /* mask to current code length */ - left -= bits; /* number of unused bits */ - rem = (unsigned)last >> (8 - left); /* unused bits from last byte */ - - /* process clear code (256) */ - if (code == 256 && flags) { - FLUSHCODE(); - bits = 9; /* initialize bits and mask */ - mask = 0x1ff; - end = 255; /* empty table */ - continue; /* get next code */ - } - - /* special code to reuse last match */ - temp = code; /* save the current code */ - if (code > end) { - /* Be picky on the allowed code here, and make sure that the code - we drop through (prev) will be a valid index so that random - input does not cause an exception. The code != end + 1 check is - empirically derived, and not checked in the original uncompress - code. If this ever causes a problem, that check could be safely - removed. Leaving this check in greatly improves gun's ability - to detect random or corrupted input after a compress header. - In any case, the prev > end check must be retained. */ - if (code != end + 1 || prev > end) { - strm->msg = (char *)"invalid lzw code"; - return Z_DATA_ERROR; - } - match[stack++] = (unsigned char)final; - code = prev; - } - - /* walk through linked list to generate output in reverse order */ - p = match + stack; - while (code >= 256) { - *p++ = suffix[code]; - code = prefix[code]; - } - stack = p - match; - match[stack++] = (unsigned char)code; - final = code; - - /* link new table entry */ - if (end < mask) { - end++; - prefix[end] = (unsigned short)prev; - suffix[end] = (unsigned char)final; - } - - /* set previous code for next iteration */ - prev = temp; - - /* write output in forward order */ - while (stack > SIZE - outcnt) { - while (outcnt < SIZE) - outbuf[outcnt++] = match[--stack]; - if (out(&outd, outbuf, outcnt)) { - strm->next_in = outbuf; /* signal write error */ - return Z_BUF_ERROR; - } - outcnt = 0; - } - p = match + stack; - do { - outbuf[outcnt++] = *--p; - } while (p > match); - stack = 0; - - /* loop for next code with final and prev as the last match, rem and - left provide the first 0..7 bits of the next code, end is the last - valid table entry */ - } -} - -/* Decompress a gzip file from infile to outfile. strm is assumed to have been - successfully initialized with inflateBackInit(). The input file may consist - of a series of gzip streams, in which case all of them will be decompressed - to the output file. If outfile is -1, then the gzip stream(s) integrity is - checked and nothing is written. - - The return value is a zlib error code: Z_MEM_ERROR if out of memory, - Z_DATA_ERROR if the header or the compressed data is invalid, or if the - trailer CRC-32 check or length doesn't match, Z_BUF_ERROR if the input ends - prematurely or a write error occurs, or Z_ERRNO if junk (not a another gzip - stream) follows a valid gzip stream. - */ -local int gunpipe(z_stream *strm, int infile, int outfile) -{ - int ret, first, last; - unsigned have, flags, len; - z_const unsigned char *next = NULL; - struct ind ind, *indp; - struct outd outd; - - /* setup input buffer */ - ind.infile = infile; - ind.inbuf = inbuf; - indp = &ind; - - /* decompress concatenated gzip streams */ - have = 0; /* no input data read in yet */ - first = 1; /* looking for first gzip header */ - strm->next_in = Z_NULL; /* so Z_BUF_ERROR means EOF */ - for (;;) { - /* look for the two magic header bytes for a gzip stream */ - if (NEXT() == -1) { - ret = Z_OK; - break; /* empty gzip stream is ok */ - } - if (last != 31 || (NEXT() != 139 && last != 157)) { - strm->msg = (char *)"incorrect header check"; - ret = first ? Z_DATA_ERROR : Z_ERRNO; - break; /* not a gzip or compress header */ - } - first = 0; /* next non-header is junk */ - - /* process a compress (LZW) file -- can't be concatenated after this */ - if (last == 157) { - ret = lunpipe(have, next, indp, outfile, strm); - break; - } - - /* process remainder of gzip header */ - ret = Z_BUF_ERROR; - if (NEXT() != 8) { /* only deflate method allowed */ - if (last == -1) break; - strm->msg = (char *)"unknown compression method"; - ret = Z_DATA_ERROR; - break; - } - flags = NEXT(); /* header flags */ - NEXT(); /* discard mod time, xflgs, os */ - NEXT(); - NEXT(); - NEXT(); - NEXT(); - NEXT(); - if (last == -1) break; - if (flags & 0xe0) { - strm->msg = (char *)"unknown header flags set"; - ret = Z_DATA_ERROR; - break; - } - if (flags & 4) { /* extra field */ - len = NEXT(); - len += (unsigned)(NEXT()) << 8; - if (last == -1) break; - while (len > have) { - len -= have; - have = 0; - if (NEXT() == -1) break; - len--; - } - if (last == -1) break; - have -= len; - next += len; - } - if (flags & 8) /* file name */ - while (NEXT() != 0 && last != -1) - ; - if (flags & 16) /* comment */ - while (NEXT() != 0 && last != -1) - ; - if (flags & 2) { /* header crc */ - NEXT(); - NEXT(); - } - if (last == -1) break; - - /* set up output */ - outd.outfile = outfile; - outd.check = 1; - outd.crc = crc32(0L, Z_NULL, 0); - outd.total = 0; - - /* decompress data to output */ - strm->next_in = next; - strm->avail_in = have; - ret = inflateBack(strm, in, indp, out, &outd); - if (ret != Z_STREAM_END) break; - next = strm->next_in; - have = strm->avail_in; - strm->next_in = Z_NULL; /* so Z_BUF_ERROR means EOF */ - - /* check trailer */ - ret = Z_BUF_ERROR; - if (NEXT() != (int)(outd.crc & 0xff) || - NEXT() != (int)((outd.crc >> 8) & 0xff) || - NEXT() != (int)((outd.crc >> 16) & 0xff) || - NEXT() != (int)((outd.crc >> 24) & 0xff)) { - /* crc error */ - if (last != -1) { - strm->msg = (char *)"incorrect data check"; - ret = Z_DATA_ERROR; - } - break; - } - if (NEXT() != (int)(outd.total & 0xff) || - NEXT() != (int)((outd.total >> 8) & 0xff) || - NEXT() != (int)((outd.total >> 16) & 0xff) || - NEXT() != (int)((outd.total >> 24) & 0xff)) { - /* length error */ - if (last != -1) { - strm->msg = (char *)"incorrect length check"; - ret = Z_DATA_ERROR; - } - break; - } - - /* go back and look for another gzip stream */ - } - - /* clean up and return */ - return ret; -} - -/* Copy file attributes, from -> to, as best we can. This is best effort, so - no errors are reported. The mode bits, including suid, sgid, and the sticky - bit are copied (if allowed), the owner's user id and group id are copied - (again if allowed), and the access and modify times are copied. */ -local void copymeta(char *from, char *to) -{ - struct stat was; - struct utimbuf when; - - /* get all of from's Unix meta data, return if not a regular file */ - if (stat(from, &was) != 0 || (was.st_mode & S_IFMT) != S_IFREG) - return; - - /* set to's mode bits, ignore errors */ - (void)chmod(to, was.st_mode & 07777); - - /* copy owner's user and group, ignore errors */ - (void)chown(to, was.st_uid, was.st_gid); - - /* copy access and modify times, ignore errors */ - when.actime = was.st_atime; - when.modtime = was.st_mtime; - (void)utime(to, &when); -} - -/* Decompress the file inname to the file outnname, of if test is true, just - decompress without writing and check the gzip trailer for integrity. If - inname is NULL or an empty string, read from stdin. If outname is NULL or - an empty string, write to stdout. strm is a pre-initialized inflateBack - structure. When appropriate, copy the file attributes from inname to - outname. - - gunzip() returns 1 if there is an out-of-memory error or an unexpected - return code from gunpipe(). Otherwise it returns 0. - */ -local int gunzip(z_stream *strm, char *inname, char *outname, int test) -{ - int ret; - int infile, outfile; - - /* open files */ - if (inname == NULL || *inname == 0) { - inname = "-"; - infile = 0; /* stdin */ - } - else { - infile = open(inname, O_RDONLY, 0); - if (infile == -1) { - fprintf(stderr, "gun cannot open %s\n", inname); - return 0; - } - } - if (test) - outfile = -1; - else if (outname == NULL || *outname == 0) { - outname = "-"; - outfile = 1; /* stdout */ - } - else { - outfile = open(outname, O_CREAT | O_TRUNC | O_WRONLY, 0666); - if (outfile == -1) { - close(infile); - fprintf(stderr, "gun cannot create %s\n", outname); - return 0; - } - } - errno = 0; - - /* decompress */ - ret = gunpipe(strm, infile, outfile); - if (outfile > 2) close(outfile); - if (infile > 2) close(infile); - - /* interpret result */ - switch (ret) { - case Z_OK: - case Z_ERRNO: - if (infile > 2 && outfile > 2) { - copymeta(inname, outname); /* copy attributes */ - unlink(inname); - } - if (ret == Z_ERRNO) - fprintf(stderr, "gun warning: trailing garbage ignored in %s\n", - inname); - break; - case Z_DATA_ERROR: - if (outfile > 2) unlink(outname); - fprintf(stderr, "gun data error on %s: %s\n", inname, strm->msg); - break; - case Z_MEM_ERROR: - if (outfile > 2) unlink(outname); - fprintf(stderr, "gun out of memory error--aborting\n"); - return 1; - case Z_BUF_ERROR: - if (outfile > 2) unlink(outname); - if (strm->next_in != Z_NULL) { - fprintf(stderr, "gun write error on %s: %s\n", - outname, strerror(errno)); - } - else if (errno) { - fprintf(stderr, "gun read error on %s: %s\n", - inname, strerror(errno)); - } - else { - fprintf(stderr, "gun unexpected end of file on %s\n", - inname); - } - break; - default: - if (outfile > 2) unlink(outname); - fprintf(stderr, "gun internal error--aborting\n"); - return 1; - } - return 0; -} - -/* Process the gun command line arguments. See the command syntax near the - beginning of this source file. */ -int main(int argc, char **argv) -{ - int ret, len, test; - char *outname; - unsigned char *window; - z_stream strm; - - /* initialize inflateBack state for repeated use */ - window = match; /* reuse LZW match buffer */ - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - ret = inflateBackInit(&strm, 15, window); - if (ret != Z_OK) { - fprintf(stderr, "gun out of memory error--aborting\n"); - return 1; - } - - /* decompress each file to the same name with the suffix removed */ - argc--; - argv++; - test = 0; - if (argc && strcmp(*argv, "-h") == 0) { - fprintf(stderr, "gun 1.6 (17 Jan 2010)\n"); - fprintf(stderr, "Copyright (C) 2003-2010 Mark Adler\n"); - fprintf(stderr, "usage: gun [-t] [file1.gz [file2.Z ...]]\n"); - return 0; - } - if (argc && strcmp(*argv, "-t") == 0) { - test = 1; - argc--; - argv++; - } - if (argc) - do { - if (test) - outname = NULL; - else { - len = (int)strlen(*argv); - if (strcmp(*argv + len - 3, ".gz") == 0 || - strcmp(*argv + len - 3, "-gz") == 0) - len -= 3; - else if (strcmp(*argv + len - 2, ".z") == 0 || - strcmp(*argv + len - 2, "-z") == 0 || - strcmp(*argv + len - 2, "_z") == 0 || - strcmp(*argv + len - 2, ".Z") == 0) - len -= 2; - else { - fprintf(stderr, "gun error: no gz type on %s--skipping\n", - *argv); - continue; - } - outname = malloc(len + 1); - if (outname == NULL) { - fprintf(stderr, "gun out of memory error--aborting\n"); - ret = 1; - break; - } - memcpy(outname, *argv, len); - outname[len] = 0; - } - ret = gunzip(&strm, *argv, outname, test); - if (outname != NULL) free(outname); - if (ret) break; - } while (argv++, --argc); - else - ret = gunzip(&strm, NULL, NULL, test); - - /* clean up */ - inflateBackEnd(&strm); - return ret; -} diff --git a/compat/zlib/examples/gzappend.c b/compat/zlib/examples/gzappend.c deleted file mode 100644 index 662dec3..0000000 --- a/compat/zlib/examples/gzappend.c +++ /dev/null @@ -1,504 +0,0 @@ -/* gzappend -- command to append to a gzip file - - Copyright (C) 2003, 2012 Mark Adler, all rights reserved - version 1.2, 11 Oct 2012 - - This software is provided 'as-is', without any express or implied - warranty. In no event will the author be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Mark Adler madler@alumni.caltech.edu - */ - -/* - * Change history: - * - * 1.0 19 Oct 2003 - First version - * 1.1 4 Nov 2003 - Expand and clarify some comments and notes - * - Add version and copyright to help - * - Send help to stdout instead of stderr - * - Add some preemptive typecasts - * - Add L to constants in lseek() calls - * - Remove some debugging information in error messages - * - Use new data_type definition for zlib 1.2.1 - * - Simplfy and unify file operations - * - Finish off gzip file in gztack() - * - Use deflatePrime() instead of adding empty blocks - * - Keep gzip file clean on appended file read errors - * - Use in-place rotate instead of auxiliary buffer - * (Why you ask? Because it was fun to write!) - * 1.2 11 Oct 2012 - Fix for proper z_const usage - * - Check for input buffer malloc failure - */ - -/* - gzappend takes a gzip file and appends to it, compressing files from the - command line or data from stdin. The gzip file is written to directly, to - avoid copying that file, in case it's large. Note that this results in the - unfriendly behavior that if gzappend fails, the gzip file is corrupted. - - This program was written to illustrate the use of the new Z_BLOCK option of - zlib 1.2.x's inflate() function. This option returns from inflate() at each - block boundary to facilitate locating and modifying the last block bit at - the start of the final deflate block. Also whether using Z_BLOCK or not, - another required feature of zlib 1.2.x is that inflate() now provides the - number of unusued bits in the last input byte used. gzappend will not work - with versions of zlib earlier than 1.2.1. - - gzappend first decompresses the gzip file internally, discarding all but - the last 32K of uncompressed data, and noting the location of the last block - bit and the number of unused bits in the last byte of the compressed data. - The gzip trailer containing the CRC-32 and length of the uncompressed data - is verified. This trailer will be later overwritten. - - Then the last block bit is cleared by seeking back in the file and rewriting - the byte that contains it. Seeking forward, the last byte of the compressed - data is saved along with the number of unused bits to initialize deflate. - - A deflate process is initialized, using the last 32K of the uncompressed - data from the gzip file to initialize the dictionary. If the total - uncompressed data was less than 32K, then all of it is used to initialize - the dictionary. The deflate output bit buffer is also initialized with the - last bits from the original deflate stream. From here on, the data to - append is simply compressed using deflate, and written to the gzip file. - When that is complete, the new CRC-32 and uncompressed length are written - as the trailer of the gzip file. - */ - -#include -#include -#include -#include -#include -#include "zlib.h" - -#define local static -#define LGCHUNK 14 -#define CHUNK (1U << LGCHUNK) -#define DSIZE 32768U - -/* print an error message and terminate with extreme prejudice */ -local void bye(char *msg1, char *msg2) -{ - fprintf(stderr, "gzappend error: %s%s\n", msg1, msg2); - exit(1); -} - -/* return the greatest common divisor of a and b using Euclid's algorithm, - modified to be fast when one argument much greater than the other, and - coded to avoid unnecessary swapping */ -local unsigned gcd(unsigned a, unsigned b) -{ - unsigned c; - - while (a && b) - if (a > b) { - c = b; - while (a - c >= c) - c <<= 1; - a -= c; - } - else { - c = a; - while (b - c >= c) - c <<= 1; - b -= c; - } - return a + b; -} - -/* rotate list[0..len-1] left by rot positions, in place */ -local void rotate(unsigned char *list, unsigned len, unsigned rot) -{ - unsigned char tmp; - unsigned cycles; - unsigned char *start, *last, *to, *from; - - /* normalize rot and handle degenerate cases */ - if (len < 2) return; - if (rot >= len) rot %= len; - if (rot == 0) return; - - /* pointer to last entry in list */ - last = list + (len - 1); - - /* do simple left shift by one */ - if (rot == 1) { - tmp = *list; - memcpy(list, list + 1, len - 1); - *last = tmp; - return; - } - - /* do simple right shift by one */ - if (rot == len - 1) { - tmp = *last; - memmove(list + 1, list, len - 1); - *list = tmp; - return; - } - - /* otherwise do rotate as a set of cycles in place */ - cycles = gcd(len, rot); /* number of cycles */ - do { - start = from = list + cycles; /* start index is arbitrary */ - tmp = *from; /* save entry to be overwritten */ - for (;;) { - to = from; /* next step in cycle */ - from += rot; /* go right rot positions */ - if (from > last) from -= len; /* (pointer better not wrap) */ - if (from == start) break; /* all but one shifted */ - *to = *from; /* shift left */ - } - *to = tmp; /* complete the circle */ - } while (--cycles); -} - -/* structure for gzip file read operations */ -typedef struct { - int fd; /* file descriptor */ - int size; /* 1 << size is bytes in buf */ - unsigned left; /* bytes available at next */ - unsigned char *buf; /* buffer */ - z_const unsigned char *next; /* next byte in buffer */ - char *name; /* file name for error messages */ -} file; - -/* reload buffer */ -local int readin(file *in) -{ - int len; - - len = read(in->fd, in->buf, 1 << in->size); - if (len == -1) bye("error reading ", in->name); - in->left = (unsigned)len; - in->next = in->buf; - return len; -} - -/* read from file in, exit if end-of-file */ -local int readmore(file *in) -{ - if (readin(in) == 0) bye("unexpected end of ", in->name); - return 0; -} - -#define read1(in) (in->left == 0 ? readmore(in) : 0, \ - in->left--, *(in->next)++) - -/* skip over n bytes of in */ -local void skip(file *in, unsigned n) -{ - unsigned bypass; - - if (n > in->left) { - n -= in->left; - bypass = n & ~((1U << in->size) - 1); - if (bypass) { - if (lseek(in->fd, (off_t)bypass, SEEK_CUR) == -1) - bye("seeking ", in->name); - n -= bypass; - } - readmore(in); - if (n > in->left) - bye("unexpected end of ", in->name); - } - in->left -= n; - in->next += n; -} - -/* read a four-byte unsigned integer, little-endian, from in */ -unsigned long read4(file *in) -{ - unsigned long val; - - val = read1(in); - val += (unsigned)read1(in) << 8; - val += (unsigned long)read1(in) << 16; - val += (unsigned long)read1(in) << 24; - return val; -} - -/* skip over gzip header */ -local void gzheader(file *in) -{ - int flags; - unsigned n; - - if (read1(in) != 31 || read1(in) != 139) bye(in->name, " not a gzip file"); - if (read1(in) != 8) bye("unknown compression method in", in->name); - flags = read1(in); - if (flags & 0xe0) bye("unknown header flags set in", in->name); - skip(in, 6); - if (flags & 4) { - n = read1(in); - n += (unsigned)(read1(in)) << 8; - skip(in, n); - } - if (flags & 8) while (read1(in) != 0) ; - if (flags & 16) while (read1(in) != 0) ; - if (flags & 2) skip(in, 2); -} - -/* decompress gzip file "name", return strm with a deflate stream ready to - continue compression of the data in the gzip file, and return a file - descriptor pointing to where to write the compressed data -- the deflate - stream is initialized to compress using level "level" */ -local int gzscan(char *name, z_stream *strm, int level) -{ - int ret, lastbit, left, full; - unsigned have; - unsigned long crc, tot; - unsigned char *window; - off_t lastoff, end; - file gz; - - /* open gzip file */ - gz.name = name; - gz.fd = open(name, O_RDWR, 0); - if (gz.fd == -1) bye("cannot open ", name); - gz.buf = malloc(CHUNK); - if (gz.buf == NULL) bye("out of memory", ""); - gz.size = LGCHUNK; - gz.left = 0; - - /* skip gzip header */ - gzheader(&gz); - - /* prepare to decompress */ - window = malloc(DSIZE); - if (window == NULL) bye("out of memory", ""); - strm->zalloc = Z_NULL; - strm->zfree = Z_NULL; - strm->opaque = Z_NULL; - ret = inflateInit2(strm, -15); - if (ret != Z_OK) bye("out of memory", " or library mismatch"); - - /* decompress the deflate stream, saving append information */ - lastbit = 0; - lastoff = lseek(gz.fd, 0L, SEEK_CUR) - gz.left; - left = 0; - strm->avail_in = gz.left; - strm->next_in = gz.next; - crc = crc32(0L, Z_NULL, 0); - have = full = 0; - do { - /* if needed, get more input */ - if (strm->avail_in == 0) { - readmore(&gz); - strm->avail_in = gz.left; - strm->next_in = gz.next; - } - - /* set up output to next available section of sliding window */ - strm->avail_out = DSIZE - have; - strm->next_out = window + have; - - /* inflate and check for errors */ - ret = inflate(strm, Z_BLOCK); - if (ret == Z_STREAM_ERROR) bye("internal stream error!", ""); - if (ret == Z_MEM_ERROR) bye("out of memory", ""); - if (ret == Z_DATA_ERROR) - bye("invalid compressed data--format violated in", name); - - /* update crc and sliding window pointer */ - crc = crc32(crc, window + have, DSIZE - have - strm->avail_out); - if (strm->avail_out) - have = DSIZE - strm->avail_out; - else { - have = 0; - full = 1; - } - - /* process end of block */ - if (strm->data_type & 128) { - if (strm->data_type & 64) - left = strm->data_type & 0x1f; - else { - lastbit = strm->data_type & 0x1f; - lastoff = lseek(gz.fd, 0L, SEEK_CUR) - strm->avail_in; - } - } - } while (ret != Z_STREAM_END); - inflateEnd(strm); - gz.left = strm->avail_in; - gz.next = strm->next_in; - - /* save the location of the end of the compressed data */ - end = lseek(gz.fd, 0L, SEEK_CUR) - gz.left; - - /* check gzip trailer and save total for deflate */ - if (crc != read4(&gz)) - bye("invalid compressed data--crc mismatch in ", name); - tot = strm->total_out; - if ((tot & 0xffffffffUL) != read4(&gz)) - bye("invalid compressed data--length mismatch in", name); - - /* if not at end of file, warn */ - if (gz.left || readin(&gz)) - fprintf(stderr, - "gzappend warning: junk at end of gzip file overwritten\n"); - - /* clear last block bit */ - lseek(gz.fd, lastoff - (lastbit != 0), SEEK_SET); - if (read(gz.fd, gz.buf, 1) != 1) bye("reading after seek on ", name); - *gz.buf = (unsigned char)(*gz.buf ^ (1 << ((8 - lastbit) & 7))); - lseek(gz.fd, -1L, SEEK_CUR); - if (write(gz.fd, gz.buf, 1) != 1) bye("writing after seek to ", name); - - /* if window wrapped, build dictionary from window by rotating */ - if (full) { - rotate(window, DSIZE, have); - have = DSIZE; - } - - /* set up deflate stream with window, crc, total_in, and leftover bits */ - ret = deflateInit2(strm, level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY); - if (ret != Z_OK) bye("out of memory", ""); - deflateSetDictionary(strm, window, have); - strm->adler = crc; - strm->total_in = tot; - if (left) { - lseek(gz.fd, --end, SEEK_SET); - if (read(gz.fd, gz.buf, 1) != 1) bye("reading after seek on ", name); - deflatePrime(strm, 8 - left, *gz.buf); - } - lseek(gz.fd, end, SEEK_SET); - - /* clean up and return */ - free(window); - free(gz.buf); - return gz.fd; -} - -/* append file "name" to gzip file gd using deflate stream strm -- if last - is true, then finish off the deflate stream at the end */ -local void gztack(char *name, int gd, z_stream *strm, int last) -{ - int fd, len, ret; - unsigned left; - unsigned char *in, *out; - - /* open file to compress and append */ - fd = 0; - if (name != NULL) { - fd = open(name, O_RDONLY, 0); - if (fd == -1) - fprintf(stderr, "gzappend warning: %s not found, skipping ...\n", - name); - } - - /* allocate buffers */ - in = malloc(CHUNK); - out = malloc(CHUNK); - if (in == NULL || out == NULL) bye("out of memory", ""); - - /* compress input file and append to gzip file */ - do { - /* get more input */ - len = read(fd, in, CHUNK); - if (len == -1) { - fprintf(stderr, - "gzappend warning: error reading %s, skipping rest ...\n", - name); - len = 0; - } - strm->avail_in = (unsigned)len; - strm->next_in = in; - if (len) strm->adler = crc32(strm->adler, in, (unsigned)len); - - /* compress and write all available output */ - do { - strm->avail_out = CHUNK; - strm->next_out = out; - ret = deflate(strm, last && len == 0 ? Z_FINISH : Z_NO_FLUSH); - left = CHUNK - strm->avail_out; - while (left) { - len = write(gd, out + CHUNK - strm->avail_out - left, left); - if (len == -1) bye("writing gzip file", ""); - left -= (unsigned)len; - } - } while (strm->avail_out == 0 && ret != Z_STREAM_END); - } while (len != 0); - - /* write trailer after last entry */ - if (last) { - deflateEnd(strm); - out[0] = (unsigned char)(strm->adler); - out[1] = (unsigned char)(strm->adler >> 8); - out[2] = (unsigned char)(strm->adler >> 16); - out[3] = (unsigned char)(strm->adler >> 24); - out[4] = (unsigned char)(strm->total_in); - out[5] = (unsigned char)(strm->total_in >> 8); - out[6] = (unsigned char)(strm->total_in >> 16); - out[7] = (unsigned char)(strm->total_in >> 24); - len = 8; - do { - ret = write(gd, out + 8 - len, len); - if (ret == -1) bye("writing gzip file", ""); - len -= ret; - } while (len); - close(gd); - } - - /* clean up and return */ - free(out); - free(in); - if (fd > 0) close(fd); -} - -/* process the compression level option if present, scan the gzip file, and - append the specified files, or append the data from stdin if no other file - names are provided on the command line -- the gzip file must be writable - and seekable */ -int main(int argc, char **argv) -{ - int gd, level; - z_stream strm; - - /* ignore command name */ - argc--; argv++; - - /* provide usage if no arguments */ - if (*argv == NULL) { - printf( - "gzappend 1.2 (11 Oct 2012) Copyright (C) 2003, 2012 Mark Adler\n" - ); - printf( - "usage: gzappend [-level] file.gz [ addthis [ andthis ... ]]\n"); - return 0; - } - - /* set compression level */ - level = Z_DEFAULT_COMPRESSION; - if (argv[0][0] == '-') { - if (argv[0][1] < '0' || argv[0][1] > '9' || argv[0][2] != 0) - bye("invalid compression level", ""); - level = argv[0][1] - '0'; - if (*++argv == NULL) bye("no gzip file name after options", ""); - } - - /* prepare to append to gzip file */ - gd = gzscan(*argv++, &strm, level); - - /* append files on command line, or from stdin if none */ - if (*argv == NULL) - gztack(NULL, gd, &strm, 1); - else - do { - gztack(*argv, gd, &strm, argv[1] == NULL); - } while (*++argv != NULL); - return 0; -} diff --git a/compat/zlib/examples/gzjoin.c b/compat/zlib/examples/gzjoin.c deleted file mode 100644 index 89e8098..0000000 --- a/compat/zlib/examples/gzjoin.c +++ /dev/null @@ -1,449 +0,0 @@ -/* gzjoin -- command to join gzip files into one gzip file - - Copyright (C) 2004, 2005, 2012 Mark Adler, all rights reserved - version 1.2, 14 Aug 2012 - - This software is provided 'as-is', without any express or implied - warranty. In no event will the author be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Mark Adler madler@alumni.caltech.edu - */ - -/* - * Change history: - * - * 1.0 11 Dec 2004 - First version - * 1.1 12 Jun 2005 - Changed ssize_t to long for portability - * 1.2 14 Aug 2012 - Clean up for z_const usage - */ - -/* - gzjoin takes one or more gzip files on the command line and writes out a - single gzip file that will uncompress to the concatenation of the - uncompressed data from the individual gzip files. gzjoin does this without - having to recompress any of the data and without having to calculate a new - crc32 for the concatenated uncompressed data. gzjoin does however have to - decompress all of the input data in order to find the bits in the compressed - data that need to be modified to concatenate the streams. - - gzjoin does not do an integrity check on the input gzip files other than - checking the gzip header and decompressing the compressed data. They are - otherwise assumed to be complete and correct. - - Each joint between gzip files removes at least 18 bytes of previous trailer - and subsequent header, and inserts an average of about three bytes to the - compressed data in order to connect the streams. The output gzip file - has a minimal ten-byte gzip header with no file name or modification time. - - This program was written to illustrate the use of the Z_BLOCK option of - inflate() and the crc32_combine() function. gzjoin will not compile with - versions of zlib earlier than 1.2.3. - */ - -#include /* fputs(), fprintf(), fwrite(), putc() */ -#include /* exit(), malloc(), free() */ -#include /* open() */ -#include /* close(), read(), lseek() */ -#include "zlib.h" - /* crc32(), crc32_combine(), inflateInit2(), inflate(), inflateEnd() */ - -#define local static - -/* exit with an error (return a value to allow use in an expression) */ -local int bail(char *why1, char *why2) -{ - fprintf(stderr, "gzjoin error: %s%s, output incomplete\n", why1, why2); - exit(1); - return 0; -} - -/* -- simple buffered file input with access to the buffer -- */ - -#define CHUNK 32768 /* must be a power of two and fit in unsigned */ - -/* bin buffered input file type */ -typedef struct { - char *name; /* name of file for error messages */ - int fd; /* file descriptor */ - unsigned left; /* bytes remaining at next */ - unsigned char *next; /* next byte to read */ - unsigned char *buf; /* allocated buffer of length CHUNK */ -} bin; - -/* close a buffered file and free allocated memory */ -local void bclose(bin *in) -{ - if (in != NULL) { - if (in->fd != -1) - close(in->fd); - if (in->buf != NULL) - free(in->buf); - free(in); - } -} - -/* open a buffered file for input, return a pointer to type bin, or NULL on - failure */ -local bin *bopen(char *name) -{ - bin *in; - - in = malloc(sizeof(bin)); - if (in == NULL) - return NULL; - in->buf = malloc(CHUNK); - in->fd = open(name, O_RDONLY, 0); - if (in->buf == NULL || in->fd == -1) { - bclose(in); - return NULL; - } - in->left = 0; - in->next = in->buf; - in->name = name; - return in; -} - -/* load buffer from file, return -1 on read error, 0 or 1 on success, with - 1 indicating that end-of-file was reached */ -local int bload(bin *in) -{ - long len; - - if (in == NULL) - return -1; - if (in->left != 0) - return 0; - in->next = in->buf; - do { - len = (long)read(in->fd, in->buf + in->left, CHUNK - in->left); - if (len < 0) - return -1; - in->left += (unsigned)len; - } while (len != 0 && in->left < CHUNK); - return len == 0 ? 1 : 0; -} - -/* get a byte from the file, bail if end of file */ -#define bget(in) (in->left ? 0 : bload(in), \ - in->left ? (in->left--, *(in->next)++) : \ - bail("unexpected end of file on ", in->name)) - -/* get a four-byte little-endian unsigned integer from file */ -local unsigned long bget4(bin *in) -{ - unsigned long val; - - val = bget(in); - val += (unsigned long)(bget(in)) << 8; - val += (unsigned long)(bget(in)) << 16; - val += (unsigned long)(bget(in)) << 24; - return val; -} - -/* skip bytes in file */ -local void bskip(bin *in, unsigned skip) -{ - /* check pointer */ - if (in == NULL) - return; - - /* easy case -- skip bytes in buffer */ - if (skip <= in->left) { - in->left -= skip; - in->next += skip; - return; - } - - /* skip what's in buffer, discard buffer contents */ - skip -= in->left; - in->left = 0; - - /* seek past multiples of CHUNK bytes */ - if (skip > CHUNK) { - unsigned left; - - left = skip & (CHUNK - 1); - if (left == 0) { - /* exact number of chunks: seek all the way minus one byte to check - for end-of-file with a read */ - lseek(in->fd, skip - 1, SEEK_CUR); - if (read(in->fd, in->buf, 1) != 1) - bail("unexpected end of file on ", in->name); - return; - } - - /* skip the integral chunks, update skip with remainder */ - lseek(in->fd, skip - left, SEEK_CUR); - skip = left; - } - - /* read more input and skip remainder */ - bload(in); - if (skip > in->left) - bail("unexpected end of file on ", in->name); - in->left -= skip; - in->next += skip; -} - -/* -- end of buffered input functions -- */ - -/* skip the gzip header from file in */ -local void gzhead(bin *in) -{ - int flags; - - /* verify gzip magic header and compression method */ - if (bget(in) != 0x1f || bget(in) != 0x8b || bget(in) != 8) - bail(in->name, " is not a valid gzip file"); - - /* get and verify flags */ - flags = bget(in); - if ((flags & 0xe0) != 0) - bail("unknown reserved bits set in ", in->name); - - /* skip modification time, extra flags, and os */ - bskip(in, 6); - - /* skip extra field if present */ - if (flags & 4) { - unsigned len; - - len = bget(in); - len += (unsigned)(bget(in)) << 8; - bskip(in, len); - } - - /* skip file name if present */ - if (flags & 8) - while (bget(in) != 0) - ; - - /* skip comment if present */ - if (flags & 16) - while (bget(in) != 0) - ; - - /* skip header crc if present */ - if (flags & 2) - bskip(in, 2); -} - -/* write a four-byte little-endian unsigned integer to out */ -local void put4(unsigned long val, FILE *out) -{ - putc(val & 0xff, out); - putc((val >> 8) & 0xff, out); - putc((val >> 16) & 0xff, out); - putc((val >> 24) & 0xff, out); -} - -/* Load up zlib stream from buffered input, bail if end of file */ -local void zpull(z_streamp strm, bin *in) -{ - if (in->left == 0) - bload(in); - if (in->left == 0) - bail("unexpected end of file on ", in->name); - strm->avail_in = in->left; - strm->next_in = in->next; -} - -/* Write header for gzip file to out and initialize trailer. */ -local void gzinit(unsigned long *crc, unsigned long *tot, FILE *out) -{ - fwrite("\x1f\x8b\x08\0\0\0\0\0\0\xff", 1, 10, out); - *crc = crc32(0L, Z_NULL, 0); - *tot = 0; -} - -/* Copy the compressed data from name, zeroing the last block bit of the last - block if clr is true, and adding empty blocks as needed to get to a byte - boundary. If clr is false, then the last block becomes the last block of - the output, and the gzip trailer is written. crc and tot maintains the - crc and length (modulo 2^32) of the output for the trailer. The resulting - gzip file is written to out. gzinit() must be called before the first call - of gzcopy() to write the gzip header and to initialize crc and tot. */ -local void gzcopy(char *name, int clr, unsigned long *crc, unsigned long *tot, - FILE *out) -{ - int ret; /* return value from zlib functions */ - int pos; /* where the "last block" bit is in byte */ - int last; /* true if processing the last block */ - bin *in; /* buffered input file */ - unsigned char *start; /* start of compressed data in buffer */ - unsigned char *junk; /* buffer for uncompressed data -- discarded */ - z_off_t len; /* length of uncompressed data (support > 4 GB) */ - z_stream strm; /* zlib inflate stream */ - - /* open gzip file and skip header */ - in = bopen(name); - if (in == NULL) - bail("could not open ", name); - gzhead(in); - - /* allocate buffer for uncompressed data and initialize raw inflate - stream */ - junk = malloc(CHUNK); - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit2(&strm, -15); - if (junk == NULL || ret != Z_OK) - bail("out of memory", ""); - - /* inflate and copy compressed data, clear last-block bit if requested */ - len = 0; - zpull(&strm, in); - start = in->next; - last = start[0] & 1; - if (last && clr) - start[0] &= ~1; - strm.avail_out = 0; - for (;;) { - /* if input used and output done, write used input and get more */ - if (strm.avail_in == 0 && strm.avail_out != 0) { - fwrite(start, 1, strm.next_in - start, out); - start = in->buf; - in->left = 0; - zpull(&strm, in); - } - - /* decompress -- return early when end-of-block reached */ - strm.avail_out = CHUNK; - strm.next_out = junk; - ret = inflate(&strm, Z_BLOCK); - switch (ret) { - case Z_MEM_ERROR: - bail("out of memory", ""); - case Z_DATA_ERROR: - bail("invalid compressed data in ", in->name); - } - - /* update length of uncompressed data */ - len += CHUNK - strm.avail_out; - - /* check for block boundary (only get this when block copied out) */ - if (strm.data_type & 128) { - /* if that was the last block, then done */ - if (last) - break; - - /* number of unused bits in last byte */ - pos = strm.data_type & 7; - - /* find the next last-block bit */ - if (pos != 0) { - /* next last-block bit is in last used byte */ - pos = 0x100 >> pos; - last = strm.next_in[-1] & pos; - if (last && clr) - in->buf[strm.next_in - in->buf - 1] &= ~pos; - } - else { - /* next last-block bit is in next unused byte */ - if (strm.avail_in == 0) { - /* don't have that byte yet -- get it */ - fwrite(start, 1, strm.next_in - start, out); - start = in->buf; - in->left = 0; - zpull(&strm, in); - } - last = strm.next_in[0] & 1; - if (last && clr) - in->buf[strm.next_in - in->buf] &= ~1; - } - } - } - - /* update buffer with unused input */ - in->left = strm.avail_in; - in->next = in->buf + (strm.next_in - in->buf); - - /* copy used input, write empty blocks to get to byte boundary */ - pos = strm.data_type & 7; - fwrite(start, 1, in->next - start - 1, out); - last = in->next[-1]; - if (pos == 0 || !clr) - /* already at byte boundary, or last file: write last byte */ - putc(last, out); - else { - /* append empty blocks to last byte */ - last &= ((0x100 >> pos) - 1); /* assure unused bits are zero */ - if (pos & 1) { - /* odd -- append an empty stored block */ - putc(last, out); - if (pos == 1) - putc(0, out); /* two more bits in block header */ - fwrite("\0\0\xff\xff", 1, 4, out); - } - else { - /* even -- append 1, 2, or 3 empty fixed blocks */ - switch (pos) { - case 6: - putc(last | 8, out); - last = 0; - case 4: - putc(last | 0x20, out); - last = 0; - case 2: - putc(last | 0x80, out); - putc(0, out); - } - } - } - - /* update crc and tot */ - *crc = crc32_combine(*crc, bget4(in), len); - *tot += (unsigned long)len; - - /* clean up */ - inflateEnd(&strm); - free(junk); - bclose(in); - - /* write trailer if this is the last gzip file */ - if (!clr) { - put4(*crc, out); - put4(*tot, out); - } -} - -/* join the gzip files on the command line, write result to stdout */ -int main(int argc, char **argv) -{ - unsigned long crc, tot; /* running crc and total uncompressed length */ - - /* skip command name */ - argc--; - argv++; - - /* show usage if no arguments */ - if (argc == 0) { - fputs("gzjoin usage: gzjoin f1.gz [f2.gz [f3.gz ...]] > fjoin.gz\n", - stderr); - return 0; - } - - /* join gzip files on command line and write to stdout */ - gzinit(&crc, &tot, stdout); - while (argc--) - gzcopy(*argv++, argc, &crc, &tot, stdout); - - /* done */ - return 0; -} diff --git a/compat/zlib/examples/gzlog.c b/compat/zlib/examples/gzlog.c deleted file mode 100644 index b8c2927..0000000 --- a/compat/zlib/examples/gzlog.c +++ /dev/null @@ -1,1059 +0,0 @@ -/* - * gzlog.c - * Copyright (C) 2004, 2008, 2012, 2016 Mark Adler, all rights reserved - * For conditions of distribution and use, see copyright notice in gzlog.h - * version 2.2, 14 Aug 2012 - */ - -/* - gzlog provides a mechanism for frequently appending short strings to a gzip - file that is efficient both in execution time and compression ratio. The - strategy is to write the short strings in an uncompressed form to the end of - the gzip file, only compressing when the amount of uncompressed data has - reached a given threshold. - - gzlog also provides protection against interruptions in the process due to - system crashes. The status of the operation is recorded in an extra field - in the gzip file, and is only updated once the gzip file is brought to a - valid state. The last data to be appended or compressed is saved in an - auxiliary file, so that if the operation is interrupted, it can be completed - the next time an append operation is attempted. - - gzlog maintains another auxiliary file with the last 32K of data from the - compressed portion, which is preloaded for the compression of the subsequent - data. This minimizes the impact to the compression ratio of appending. - */ - -/* - Operations Concept: - - Files (log name "foo"): - foo.gz -- gzip file with the complete log - foo.add -- last message to append or last data to compress - foo.dict -- dictionary of the last 32K of data for next compression - foo.temp -- temporary dictionary file for compression after this one - foo.lock -- lock file for reading and writing the other files - foo.repairs -- log file for log file recovery operations (not compressed) - - gzip file structure: - - fixed-length (no file name) header with extra field (see below) - - compressed data ending initially with empty stored block - - uncompressed data filling out originally empty stored block and - subsequent stored blocks as needed (16K max each) - - gzip trailer - - no junk at end (no other gzip streams) - - When appending data, the information in the first three items above plus the - foo.add file are sufficient to recover an interrupted append operation. The - extra field has the necessary information to restore the start of the last - stored block and determine where to append the data in the foo.add file, as - well as the crc and length of the gzip data before the append operation. - - The foo.add file is created before the gzip file is marked for append, and - deleted after the gzip file is marked as complete. So if the append - operation is interrupted, the data to add will still be there. If due to - some external force, the foo.add file gets deleted between when the append - operation was interrupted and when recovery is attempted, the gzip file will - still be restored, but without the appended data. - - When compressing data, the information in the first two items above plus the - foo.add file are sufficient to recover an interrupted compress operation. - The extra field has the necessary information to find the end of the - compressed data, and contains both the crc and length of just the compressed - data and of the complete set of data including the contents of the foo.add - file. - - Again, the foo.add file is maintained during the compress operation in case - of an interruption. If in the unlikely event the foo.add file with the data - to be compressed is missing due to some external force, a gzip file with - just the previous compressed data will be reconstructed. In this case, all - of the data that was to be compressed is lost (approximately one megabyte). - This will not occur if all that happened was an interruption of the compress - operation. - - The third state that is marked is the replacement of the old dictionary with - the new dictionary after a compress operation. Once compression is - complete, the gzip file is marked as being in the replace state. This - completes the gzip file, so an interrupt after being so marked does not - result in recompression. Then the dictionary file is replaced, and the gzip - file is marked as completed. This state prevents the possibility of - restarting compression with the wrong dictionary file. - - All three operations are wrapped by a lock/unlock procedure. In order to - gain exclusive access to the log files, first a foo.lock file must be - exclusively created. When all operations are complete, the lock is - released by deleting the foo.lock file. If when attempting to create the - lock file, it already exists and the modify time of the lock file is more - than five minutes old (set by the PATIENCE define below), then the old - lock file is considered stale and deleted, and the exclusive creation of - the lock file is retried. To assure that there are no false assessments - of the staleness of the lock file, the operations periodically touch the - lock file to update the modified date. - - Following is the definition of the extra field with all of the information - required to enable the above append and compress operations and their - recovery if interrupted. Multi-byte values are stored little endian - (consistent with the gzip format). File pointers are eight bytes long. - The crc's and lengths for the gzip trailer are four bytes long. (Note that - the length at the end of a gzip file is used for error checking only, and - for large files is actually the length modulo 2^32.) The stored block - length is two bytes long. The gzip extra field two-byte identification is - "ap" for append. It is assumed that writing the extra field to the file is - an "atomic" operation. That is, either all of the extra field is written - to the file, or none of it is, if the operation is interrupted right at the - point of updating the extra field. This is a reasonable assumption, since - the extra field is within the first 52 bytes of the file, which is smaller - than any expected block size for a mass storage device (usually 512 bytes or - larger). - - Extra field (35 bytes): - - Pointer to first stored block length -- this points to the two-byte length - of the first stored block, which is followed by the two-byte, one's - complement of that length. The stored block length is preceded by the - three-bit header of the stored block, which is the actual start of the - stored block in the deflate format. See the bit offset field below. - - Pointer to the last stored block length. This is the same as above, but - for the last stored block of the uncompressed data in the gzip file. - Initially this is the same as the first stored block length pointer. - When the stored block gets to 16K (see the MAX_STORE define), then a new - stored block as added, at which point the last stored block length pointer - is different from the first stored block length pointer. When they are - different, the first bit of the last stored block header is eight bits, or - one byte back from the block length. - - Compressed data crc and length. This is the crc and length of the data - that is in the compressed portion of the deflate stream. These are used - only in the event that the foo.add file containing the data to compress is - lost after a compress operation is interrupted. - - Total data crc and length. This is the crc and length of all of the data - stored in the gzip file, compressed and uncompressed. It is used to - reconstruct the gzip trailer when compressing, as well as when recovering - interrupted operations. - - Final stored block length. This is used to quickly find where to append, - and allows the restoration of the original final stored block state when - an append operation is interrupted. - - First stored block start as the number of bits back from the final stored - block first length byte. This value is in the range of 3..10, and is - stored as the low three bits of the final byte of the extra field after - subtracting three (0..7). This allows the last-block bit of the stored - block header to be updated when a new stored block is added, for the case - when the first stored block and the last stored block are the same. (When - they are different, the numbers of bits back is known to be eight.) This - also allows for new compressed data to be appended to the old compressed - data in the compress operation, overwriting the previous first stored - block, or for the compressed data to be terminated and a valid gzip file - reconstructed on the off chance that a compression operation was - interrupted and the data to compress in the foo.add file was deleted. - - The operation in process. This is the next two bits in the last byte (the - bits under the mask 0x18). The are interpreted as 0: nothing in process, - 1: append in process, 2: compress in process, 3: replace in process. - - The top three bits of the last byte in the extra field are reserved and - are currently set to zero. - - Main procedure: - - Exclusively create the foo.lock file using the O_CREAT and O_EXCL modes of - the system open() call. If the modify time of an existing lock file is - more than PATIENCE seconds old, then the lock file is deleted and the - exclusive create is retried. - - Load the extra field from the foo.gz file, and see if an operation was in - progress but not completed. If so, apply the recovery procedure below. - - Perform the append procedure with the provided data. - - If the uncompressed data in the foo.gz file is 1MB or more, apply the - compress procedure. - - Delete the foo.lock file. - - Append procedure: - - Put what to append in the foo.add file so that the operation can be - restarted if this procedure is interrupted. - - Mark the foo.gz extra field with the append operation in progress. - + Restore the original last-block bit and stored block length of the last - stored block from the information in the extra field, in case a previous - append operation was interrupted. - - Append the provided data to the last stored block, creating new stored - blocks as needed and updating the stored blocks last-block bits and - lengths. - - Update the crc and length with the new data, and write the gzip trailer. - - Write over the extra field (with a single write operation) with the new - pointers, lengths, and crc's, and mark the gzip file as not in process. - Though there is still a foo.add file, it will be ignored since nothing - is in process. If a foo.add file is leftover from a previously - completed operation, it is truncated when writing new data to it. - - Delete the foo.add file. - - Compress and replace procedures: - - Read all of the uncompressed data in the stored blocks in foo.gz and write - it to foo.add. Also write foo.temp with the last 32K of that data to - provide a dictionary for the next invocation of this procedure. - - Rewrite the extra field marking foo.gz with a compression in process. - * If there is no data provided to compress (due to a missing foo.add file - when recovering), reconstruct and truncate the foo.gz file to contain - only the previous compressed data and proceed to the step after the next - one. Otherwise ... - - Compress the data with the dictionary in foo.dict, and write to the - foo.gz file starting at the bit immediately following the last previously - compressed block. If there is no foo.dict, proceed anyway with the - compression at slightly reduced efficiency. (For the foo.dict file to be - missing requires some external failure beyond simply the interruption of - a compress operation.) During this process, the foo.lock file is - periodically touched to assure that that file is not considered stale by - another process before we're done. The deflation is terminated with a - non-last empty static block (10 bits long), that is then located and - written over by a last-bit-set empty stored block. - - Append the crc and length of the data in the gzip file (previously - calculated during the append operations). - - Write over the extra field with the updated stored block offsets, bits - back, crc's, and lengths, and mark foo.gz as in process for a replacement - of the dictionary. - @ Delete the foo.add file. - - Replace foo.dict with foo.temp. - - Write over the extra field, marking foo.gz as complete. - - Recovery procedure: - - If not a replace recovery, read in the foo.add file, and provide that data - to the appropriate recovery below. If there is no foo.add file, provide - a zero data length to the recovery. In that case, the append recovery - restores the foo.gz to the previous compressed + uncompressed data state. - For the the compress recovery, a missing foo.add file results in foo.gz - being restored to the previous compressed-only data state. - - Append recovery: - - Pick up append at + step above - - Compress recovery: - - Pick up compress at * step above - - Replace recovery: - - Pick up compress at @ step above - - Log the repair with a date stamp in foo.repairs - */ - -#include -#include /* rename, fopen, fprintf, fclose */ -#include /* malloc, free */ -#include /* strlen, strrchr, strcpy, strncpy, strcmp */ -#include /* open */ -#include /* lseek, read, write, close, unlink, sleep, */ - /* ftruncate, fsync */ -#include /* errno */ -#include /* time, ctime */ -#include /* stat */ -#include /* utimes */ -#include "zlib.h" /* crc32 */ - -#include "gzlog.h" /* header for external access */ - -#define local static -typedef unsigned int uint; -typedef unsigned long ulong; - -/* Macro for debugging to deterministically force recovery operations */ -#ifdef GZLOG_DEBUG - #include /* longjmp */ - jmp_buf gzlog_jump; /* where to go back to */ - int gzlog_bail = 0; /* which point to bail at (1..8) */ - int gzlog_count = -1; /* number of times through to wait */ -# define BAIL(n) do { if (n == gzlog_bail && gzlog_count-- == 0) \ - longjmp(gzlog_jump, gzlog_bail); } while (0) -#else -# define BAIL(n) -#endif - -/* how old the lock file can be in seconds before considering it stale */ -#define PATIENCE 300 - -/* maximum stored block size in Kbytes -- must be in 1..63 */ -#define MAX_STORE 16 - -/* number of stored Kbytes to trigger compression (must be >= 32 to allow - dictionary construction, and <= 204 * MAX_STORE, in order for >> 10 to - discard the stored block headers contribution of five bytes each) */ -#define TRIGGER 1024 - -/* size of a deflate dictionary (this cannot be changed) */ -#define DICT 32768U - -/* values for the operation (2 bits) */ -#define NO_OP 0 -#define APPEND_OP 1 -#define COMPRESS_OP 2 -#define REPLACE_OP 3 - -/* macros to extract little-endian integers from an unsigned byte buffer */ -#define PULL2(p) ((p)[0]+((uint)((p)[1])<<8)) -#define PULL4(p) (PULL2(p)+((ulong)PULL2(p+2)<<16)) -#define PULL8(p) (PULL4(p)+((off_t)PULL4(p+4)<<32)) - -/* macros to store integers into a byte buffer in little-endian order */ -#define PUT2(p,a) do {(p)[0]=a;(p)[1]=(a)>>8;} while(0) -#define PUT4(p,a) do {PUT2(p,a);PUT2(p+2,a>>16);} while(0) -#define PUT8(p,a) do {PUT4(p,a);PUT4(p+4,a>>32);} while(0) - -/* internal structure for log information */ -#define LOGID "\106\035\172" /* should be three non-zero characters */ -struct log { - char id[4]; /* contains LOGID to detect inadvertent overwrites */ - int fd; /* file descriptor for .gz file, opened read/write */ - char *path; /* allocated path, e.g. "/var/log/foo" or "foo" */ - char *end; /* end of path, for appending suffices such as ".gz" */ - off_t first; /* offset of first stored block first length byte */ - int back; /* location of first block id in bits back from first */ - uint stored; /* bytes currently in last stored block */ - off_t last; /* offset of last stored block first length byte */ - ulong ccrc; /* crc of compressed data */ - ulong clen; /* length (modulo 2^32) of compressed data */ - ulong tcrc; /* crc of total data */ - ulong tlen; /* length (modulo 2^32) of total data */ - time_t lock; /* last modify time of our lock file */ -}; - -/* gzip header for gzlog */ -local unsigned char log_gzhead[] = { - 0x1f, 0x8b, /* magic gzip id */ - 8, /* compression method is deflate */ - 4, /* there is an extra field (no file name) */ - 0, 0, 0, 0, /* no modification time provided */ - 0, 0xff, /* no extra flags, no OS specified */ - 39, 0, 'a', 'p', 35, 0 /* extra field with "ap" subfield */ - /* 35 is EXTRA, 39 is EXTRA + 4 */ -}; - -#define HEAD sizeof(log_gzhead) /* should be 16 */ - -/* initial gzip extra field content (52 == HEAD + EXTRA + 1) */ -local unsigned char log_gzext[] = { - 52, 0, 0, 0, 0, 0, 0, 0, /* offset of first stored block length */ - 52, 0, 0, 0, 0, 0, 0, 0, /* offset of last stored block length */ - 0, 0, 0, 0, 0, 0, 0, 0, /* compressed data crc and length */ - 0, 0, 0, 0, 0, 0, 0, 0, /* total data crc and length */ - 0, 0, /* final stored block data length */ - 5 /* op is NO_OP, last bit 8 bits back */ -}; - -#define EXTRA sizeof(log_gzext) /* should be 35 */ - -/* initial gzip data and trailer */ -local unsigned char log_gzbody[] = { - 1, 0, 0, 0xff, 0xff, /* empty stored block (last) */ - 0, 0, 0, 0, /* crc */ - 0, 0, 0, 0 /* uncompressed length */ -}; - -#define BODY sizeof(log_gzbody) - -/* Exclusively create foo.lock in order to negotiate exclusive access to the - foo.* files. If the modify time of an existing lock file is greater than - PATIENCE seconds in the past, then consider the lock file to have been - abandoned, delete it, and try the exclusive create again. Save the lock - file modify time for verification of ownership. Return 0 on success, or -1 - on failure, usually due to an access restriction or invalid path. Note that - if stat() or unlink() fails, it may be due to another process noticing the - abandoned lock file a smidge sooner and deleting it, so those are not - flagged as an error. */ -local int log_lock(struct log *log) -{ - int fd; - struct stat st; - - strcpy(log->end, ".lock"); - while ((fd = open(log->path, O_CREAT | O_EXCL, 0644)) < 0) { - if (errno != EEXIST) - return -1; - if (stat(log->path, &st) == 0 && time(NULL) - st.st_mtime > PATIENCE) { - unlink(log->path); - continue; - } - sleep(2); /* relinquish the CPU for two seconds while waiting */ - } - close(fd); - if (stat(log->path, &st) == 0) - log->lock = st.st_mtime; - return 0; -} - -/* Update the modify time of the lock file to now, in order to prevent another - task from thinking that the lock is stale. Save the lock file modify time - for verification of ownership. */ -local void log_touch(struct log *log) -{ - struct stat st; - - strcpy(log->end, ".lock"); - utimes(log->path, NULL); - if (stat(log->path, &st) == 0) - log->lock = st.st_mtime; -} - -/* Check the log file modify time against what is expected. Return true if - this is not our lock. If it is our lock, touch it to keep it. */ -local int log_check(struct log *log) -{ - struct stat st; - - strcpy(log->end, ".lock"); - if (stat(log->path, &st) || st.st_mtime != log->lock) - return 1; - log_touch(log); - return 0; -} - -/* Unlock a previously acquired lock, but only if it's ours. */ -local void log_unlock(struct log *log) -{ - if (log_check(log)) - return; - strcpy(log->end, ".lock"); - unlink(log->path); - log->lock = 0; -} - -/* Check the gzip header and read in the extra field, filling in the values in - the log structure. Return op on success or -1 if the gzip header was not as - expected. op is the current operation in progress last written to the extra - field. This assumes that the gzip file has already been opened, with the - file descriptor log->fd. */ -local int log_head(struct log *log) -{ - int op; - unsigned char buf[HEAD + EXTRA]; - - if (lseek(log->fd, 0, SEEK_SET) < 0 || - read(log->fd, buf, HEAD + EXTRA) != HEAD + EXTRA || - memcmp(buf, log_gzhead, HEAD)) { - return -1; - } - log->first = PULL8(buf + HEAD); - log->last = PULL8(buf + HEAD + 8); - log->ccrc = PULL4(buf + HEAD + 16); - log->clen = PULL4(buf + HEAD + 20); - log->tcrc = PULL4(buf + HEAD + 24); - log->tlen = PULL4(buf + HEAD + 28); - log->stored = PULL2(buf + HEAD + 32); - log->back = 3 + (buf[HEAD + 34] & 7); - op = (buf[HEAD + 34] >> 3) & 3; - return op; -} - -/* Write over the extra field contents, marking the operation as op. Use fsync - to assure that the device is written to, and in the requested order. This - operation, and only this operation, is assumed to be atomic in order to - assure that the log is recoverable in the event of an interruption at any - point in the process. Return -1 if the write to foo.gz failed. */ -local int log_mark(struct log *log, int op) -{ - int ret; - unsigned char ext[EXTRA]; - - PUT8(ext, log->first); - PUT8(ext + 8, log->last); - PUT4(ext + 16, log->ccrc); - PUT4(ext + 20, log->clen); - PUT4(ext + 24, log->tcrc); - PUT4(ext + 28, log->tlen); - PUT2(ext + 32, log->stored); - ext[34] = log->back - 3 + (op << 3); - fsync(log->fd); - ret = lseek(log->fd, HEAD, SEEK_SET) < 0 || - write(log->fd, ext, EXTRA) != EXTRA ? -1 : 0; - fsync(log->fd); - return ret; -} - -/* Rewrite the last block header bits and subsequent zero bits to get to a byte - boundary, setting the last block bit if last is true, and then write the - remainder of the stored block header (length and one's complement). Leave - the file pointer after the end of the last stored block data. Return -1 if - there is a read or write failure on the foo.gz file */ -local int log_last(struct log *log, int last) -{ - int back, len, mask; - unsigned char buf[6]; - - /* determine the locations of the bytes and bits to modify */ - back = log->last == log->first ? log->back : 8; - len = back > 8 ? 2 : 1; /* bytes back from log->last */ - mask = 0x80 >> ((back - 1) & 7); /* mask for block last-bit */ - - /* get the byte to modify (one or two back) into buf[0] -- don't need to - read the byte if the last-bit is eight bits back, since in that case - the entire byte will be modified */ - buf[0] = 0; - if (back != 8 && (lseek(log->fd, log->last - len, SEEK_SET) < 0 || - read(log->fd, buf, 1) != 1)) - return -1; - - /* change the last-bit of the last stored block as requested -- note - that all bits above the last-bit are set to zero, per the type bits - of a stored block being 00 and per the convention that the bits to - bring the stream to a byte boundary are also zeros */ - buf[1] = 0; - buf[2 - len] = (*buf & (mask - 1)) + (last ? mask : 0); - - /* write the modified stored block header and lengths, move the file - pointer to after the last stored block data */ - PUT2(buf + 2, log->stored); - PUT2(buf + 4, log->stored ^ 0xffff); - return lseek(log->fd, log->last - len, SEEK_SET) < 0 || - write(log->fd, buf + 2 - len, len + 4) != len + 4 || - lseek(log->fd, log->stored, SEEK_CUR) < 0 ? -1 : 0; -} - -/* Append len bytes from data to the locked and open log file. len may be zero - if recovering and no .add file was found. In that case, the previous state - of the foo.gz file is restored. The data is appended uncompressed in - deflate stored blocks. Return -1 if there was an error reading or writing - the foo.gz file. */ -local int log_append(struct log *log, unsigned char *data, size_t len) -{ - uint put; - off_t end; - unsigned char buf[8]; - - /* set the last block last-bit and length, in case recovering an - interrupted append, then position the file pointer to append to the - block */ - if (log_last(log, 1)) - return -1; - - /* append, adding stored blocks and updating the offset of the last stored - block as needed, and update the total crc and length */ - while (len) { - /* append as much as we can to the last block */ - put = (MAX_STORE << 10) - log->stored; - if (put > len) - put = (uint)len; - if (put) { - if (write(log->fd, data, put) != put) - return -1; - BAIL(1); - log->tcrc = crc32(log->tcrc, data, put); - log->tlen += put; - log->stored += put; - data += put; - len -= put; - } - - /* if we need to, add a new empty stored block */ - if (len) { - /* mark current block as not last */ - if (log_last(log, 0)) - return -1; - - /* point to new, empty stored block */ - log->last += 4 + log->stored + 1; - log->stored = 0; - } - - /* mark last block as last, update its length */ - if (log_last(log, 1)) - return -1; - BAIL(2); - } - - /* write the new crc and length trailer, and truncate just in case (could - be recovering from partial append with a missing foo.add file) */ - PUT4(buf, log->tcrc); - PUT4(buf + 4, log->tlen); - if (write(log->fd, buf, 8) != 8 || - (end = lseek(log->fd, 0, SEEK_CUR)) < 0 || ftruncate(log->fd, end)) - return -1; - - /* write the extra field, marking the log file as done, delete .add file */ - if (log_mark(log, NO_OP)) - return -1; - strcpy(log->end, ".add"); - unlink(log->path); /* ignore error, since may not exist */ - return 0; -} - -/* Replace the foo.dict file with the foo.temp file. Also delete the foo.add - file, since the compress operation may have been interrupted before that was - done. Returns 1 if memory could not be allocated, or -1 if reading or - writing foo.gz fails, or if the rename fails for some reason other than - foo.temp not existing. foo.temp not existing is a permitted error, since - the replace operation may have been interrupted after the rename is done, - but before foo.gz is marked as complete. */ -local int log_replace(struct log *log) -{ - int ret; - char *dest; - - /* delete foo.add file */ - strcpy(log->end, ".add"); - unlink(log->path); /* ignore error, since may not exist */ - BAIL(3); - - /* rename foo.name to foo.dict, replacing foo.dict if it exists */ - strcpy(log->end, ".dict"); - dest = malloc(strlen(log->path) + 1); - if (dest == NULL) - return -2; - strcpy(dest, log->path); - strcpy(log->end, ".temp"); - ret = rename(log->path, dest); - free(dest); - if (ret && errno != ENOENT) - return -1; - BAIL(4); - - /* mark the foo.gz file as done */ - return log_mark(log, NO_OP); -} - -/* Compress the len bytes at data and append the compressed data to the - foo.gz deflate data immediately after the previous compressed data. This - overwrites the previous uncompressed data, which was stored in foo.add - and is the data provided in data[0..len-1]. If this operation is - interrupted, it picks up at the start of this routine, with the foo.add - file read in again. If there is no data to compress (len == 0), then we - simply terminate the foo.gz file after the previously compressed data, - appending a final empty stored block and the gzip trailer. Return -1 if - reading or writing the log.gz file failed, or -2 if there was a memory - allocation failure. */ -local int log_compress(struct log *log, unsigned char *data, size_t len) -{ - int fd; - uint got, max; - ssize_t dict; - off_t end; - z_stream strm; - unsigned char buf[DICT]; - - /* compress and append compressed data */ - if (len) { - /* set up for deflate, allocating memory */ - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - if (deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, -15, 8, - Z_DEFAULT_STRATEGY) != Z_OK) - return -2; - - /* read in dictionary (last 32K of data that was compressed) */ - strcpy(log->end, ".dict"); - fd = open(log->path, O_RDONLY, 0); - if (fd >= 0) { - dict = read(fd, buf, DICT); - close(fd); - if (dict < 0) { - deflateEnd(&strm); - return -1; - } - if (dict) - deflateSetDictionary(&strm, buf, (uint)dict); - } - log_touch(log); - - /* prime deflate with last bits of previous block, position write - pointer to write those bits and overwrite what follows */ - if (lseek(log->fd, log->first - (log->back > 8 ? 2 : 1), - SEEK_SET) < 0 || - read(log->fd, buf, 1) != 1 || lseek(log->fd, -1, SEEK_CUR) < 0) { - deflateEnd(&strm); - return -1; - } - deflatePrime(&strm, (8 - log->back) & 7, *buf); - - /* compress, finishing with a partial non-last empty static block */ - strm.next_in = data; - max = (((uint)0 - 1) >> 1) + 1; /* in case int smaller than size_t */ - do { - strm.avail_in = len > max ? max : (uint)len; - len -= strm.avail_in; - do { - strm.avail_out = DICT; - strm.next_out = buf; - deflate(&strm, len ? Z_NO_FLUSH : Z_PARTIAL_FLUSH); - got = DICT - strm.avail_out; - if (got && write(log->fd, buf, got) != got) { - deflateEnd(&strm); - return -1; - } - log_touch(log); - } while (strm.avail_out == 0); - } while (len); - deflateEnd(&strm); - BAIL(5); - - /* find start of empty static block -- scanning backwards the first one - bit is the second bit of the block, if the last byte is zero, then - we know the byte before that has a one in the top bit, since an - empty static block is ten bits long */ - if ((log->first = lseek(log->fd, -1, SEEK_CUR)) < 0 || - read(log->fd, buf, 1) != 1) - return -1; - log->first++; - if (*buf) { - log->back = 1; - while ((*buf & ((uint)1 << (8 - log->back++))) == 0) - ; /* guaranteed to terminate, since *buf != 0 */ - } - else - log->back = 10; - - /* update compressed crc and length */ - log->ccrc = log->tcrc; - log->clen = log->tlen; - } - else { - /* no data to compress -- fix up existing gzip stream */ - log->tcrc = log->ccrc; - log->tlen = log->clen; - } - - /* complete and truncate gzip stream */ - log->last = log->first; - log->stored = 0; - PUT4(buf, log->tcrc); - PUT4(buf + 4, log->tlen); - if (log_last(log, 1) || write(log->fd, buf, 8) != 8 || - (end = lseek(log->fd, 0, SEEK_CUR)) < 0 || ftruncate(log->fd, end)) - return -1; - BAIL(6); - - /* mark as being in the replace operation */ - if (log_mark(log, REPLACE_OP)) - return -1; - - /* execute the replace operation and mark the file as done */ - return log_replace(log); -} - -/* log a repair record to the .repairs file */ -local void log_log(struct log *log, int op, char *record) -{ - time_t now; - FILE *rec; - - now = time(NULL); - strcpy(log->end, ".repairs"); - rec = fopen(log->path, "a"); - if (rec == NULL) - return; - fprintf(rec, "%.24s %s recovery: %s\n", ctime(&now), op == APPEND_OP ? - "append" : (op == COMPRESS_OP ? "compress" : "replace"), record); - fclose(rec); - return; -} - -/* Recover the interrupted operation op. First read foo.add for recovering an - append or compress operation. Return -1 if there was an error reading or - writing foo.gz or reading an existing foo.add, or -2 if there was a memory - allocation failure. */ -local int log_recover(struct log *log, int op) -{ - int fd, ret = 0; - unsigned char *data = NULL; - size_t len = 0; - struct stat st; - - /* log recovery */ - log_log(log, op, "start"); - - /* load foo.add file if expected and present */ - if (op == APPEND_OP || op == COMPRESS_OP) { - strcpy(log->end, ".add"); - if (stat(log->path, &st) == 0 && st.st_size) { - len = (size_t)(st.st_size); - if ((off_t)len != st.st_size || - (data = malloc(st.st_size)) == NULL) { - log_log(log, op, "allocation failure"); - return -2; - } - if ((fd = open(log->path, O_RDONLY, 0)) < 0) { - log_log(log, op, ".add file read failure"); - return -1; - } - ret = (size_t)read(fd, data, len) != len; - close(fd); - if (ret) { - log_log(log, op, ".add file read failure"); - return -1; - } - log_log(log, op, "loaded .add file"); - } - else - log_log(log, op, "missing .add file!"); - } - - /* recover the interrupted operation */ - switch (op) { - case APPEND_OP: - ret = log_append(log, data, len); - break; - case COMPRESS_OP: - ret = log_compress(log, data, len); - break; - case REPLACE_OP: - ret = log_replace(log); - } - - /* log status */ - log_log(log, op, ret ? "failure" : "complete"); - - /* clean up */ - if (data != NULL) - free(data); - return ret; -} - -/* Close the foo.gz file (if open) and release the lock. */ -local void log_close(struct log *log) -{ - if (log->fd >= 0) - close(log->fd); - log->fd = -1; - log_unlock(log); -} - -/* Open foo.gz, verify the header, and load the extra field contents, after - first creating the foo.lock file to gain exclusive access to the foo.* - files. If foo.gz does not exist or is empty, then write the initial header, - extra, and body content of an empty foo.gz log file. If there is an error - creating the lock file due to access restrictions, or an error reading or - writing the foo.gz file, or if the foo.gz file is not a proper log file for - this object (e.g. not a gzip file or does not contain the expected extra - field), then return true. If there is an error, the lock is released. - Otherwise, the lock is left in place. */ -local int log_open(struct log *log) -{ - int op; - - /* release open file resource if left over -- can occur if lock lost - between gzlog_open() and gzlog_write() */ - if (log->fd >= 0) - close(log->fd); - log->fd = -1; - - /* negotiate exclusive access */ - if (log_lock(log) < 0) - return -1; - - /* open the log file, foo.gz */ - strcpy(log->end, ".gz"); - log->fd = open(log->path, O_RDWR | O_CREAT, 0644); - if (log->fd < 0) { - log_close(log); - return -1; - } - - /* if new, initialize foo.gz with an empty log, delete old dictionary */ - if (lseek(log->fd, 0, SEEK_END) == 0) { - if (write(log->fd, log_gzhead, HEAD) != HEAD || - write(log->fd, log_gzext, EXTRA) != EXTRA || - write(log->fd, log_gzbody, BODY) != BODY) { - log_close(log); - return -1; - } - strcpy(log->end, ".dict"); - unlink(log->path); - } - - /* verify log file and load extra field information */ - if ((op = log_head(log)) < 0) { - log_close(log); - return -1; - } - - /* check for interrupted process and if so, recover */ - if (op != NO_OP && log_recover(log, op)) { - log_close(log); - return -1; - } - - /* touch the lock file to prevent another process from grabbing it */ - log_touch(log); - return 0; -} - -/* See gzlog.h for the description of the external methods below */ -gzlog *gzlog_open(char *path) -{ - size_t n; - struct log *log; - - /* check arguments */ - if (path == NULL || *path == 0) - return NULL; - - /* allocate and initialize log structure */ - log = malloc(sizeof(struct log)); - if (log == NULL) - return NULL; - strcpy(log->id, LOGID); - log->fd = -1; - - /* save path and end of path for name construction */ - n = strlen(path); - log->path = malloc(n + 9); /* allow for ".repairs" */ - if (log->path == NULL) { - free(log); - return NULL; - } - strcpy(log->path, path); - log->end = log->path + n; - - /* gain exclusive access and verify log file -- may perform a - recovery operation if needed */ - if (log_open(log)) { - free(log->path); - free(log); - return NULL; - } - - /* return pointer to log structure */ - return log; -} - -/* gzlog_compress() return values: - 0: all good - -1: file i/o error (usually access issue) - -2: memory allocation failure - -3: invalid log pointer argument */ -int gzlog_compress(gzlog *logd) -{ - int fd, ret; - uint block; - size_t len, next; - unsigned char *data, buf[5]; - struct log *log = logd; - - /* check arguments */ - if (log == NULL || strcmp(log->id, LOGID)) - return -3; - - /* see if we lost the lock -- if so get it again and reload the extra - field information (it probably changed), recover last operation if - necessary */ - if (log_check(log) && log_open(log)) - return -1; - - /* create space for uncompressed data */ - len = ((size_t)(log->last - log->first) & ~(((size_t)1 << 10) - 1)) + - log->stored; - if ((data = malloc(len)) == NULL) - return -2; - - /* do statement here is just a cheap trick for error handling */ - do { - /* read in the uncompressed data */ - if (lseek(log->fd, log->first - 1, SEEK_SET) < 0) - break; - next = 0; - while (next < len) { - if (read(log->fd, buf, 5) != 5) - break; - block = PULL2(buf + 1); - if (next + block > len || - read(log->fd, (char *)data + next, block) != block) - break; - next += block; - } - if (lseek(log->fd, 0, SEEK_CUR) != log->last + 4 + log->stored) - break; - log_touch(log); - - /* write the uncompressed data to the .add file */ - strcpy(log->end, ".add"); - fd = open(log->path, O_WRONLY | O_CREAT | O_TRUNC, 0644); - if (fd < 0) - break; - ret = (size_t)write(fd, data, len) != len; - if (ret | close(fd)) - break; - log_touch(log); - - /* write the dictionary for the next compress to the .temp file */ - strcpy(log->end, ".temp"); - fd = open(log->path, O_WRONLY | O_CREAT | O_TRUNC, 0644); - if (fd < 0) - break; - next = DICT > len ? len : DICT; - ret = (size_t)write(fd, (char *)data + len - next, next) != next; - if (ret | close(fd)) - break; - log_touch(log); - - /* roll back to compressed data, mark the compress in progress */ - log->last = log->first; - log->stored = 0; - if (log_mark(log, COMPRESS_OP)) - break; - BAIL(7); - - /* compress and append the data (clears mark) */ - ret = log_compress(log, data, len); - free(data); - return ret; - } while (0); - - /* broke out of do above on i/o error */ - free(data); - return -1; -} - -/* gzlog_write() return values: - 0: all good - -1: file i/o error (usually access issue) - -2: memory allocation failure - -3: invalid log pointer argument */ -int gzlog_write(gzlog *logd, void *data, size_t len) -{ - int fd, ret; - struct log *log = logd; - - /* check arguments */ - if (log == NULL || strcmp(log->id, LOGID)) - return -3; - if (data == NULL || len <= 0) - return 0; - - /* see if we lost the lock -- if so get it again and reload the extra - field information (it probably changed), recover last operation if - necessary */ - if (log_check(log) && log_open(log)) - return -1; - - /* create and write .add file */ - strcpy(log->end, ".add"); - fd = open(log->path, O_WRONLY | O_CREAT | O_TRUNC, 0644); - if (fd < 0) - return -1; - ret = (size_t)write(fd, data, len) != len; - if (ret | close(fd)) - return -1; - log_touch(log); - - /* mark log file with append in progress */ - if (log_mark(log, APPEND_OP)) - return -1; - BAIL(8); - - /* append data (clears mark) */ - if (log_append(log, data, len)) - return -1; - - /* check to see if it's time to compress -- if not, then done */ - if (((log->last - log->first) >> 10) + (log->stored >> 10) < TRIGGER) - return 0; - - /* time to compress */ - return gzlog_compress(log); -} - -/* gzlog_close() return values: - 0: ok - -3: invalid log pointer argument */ -int gzlog_close(gzlog *logd) -{ - struct log *log = logd; - - /* check arguments */ - if (log == NULL || strcmp(log->id, LOGID)) - return -3; - - /* close the log file and release the lock */ - log_close(log); - - /* free structure and return */ - if (log->path != NULL) - free(log->path); - strcpy(log->id, "bad"); - free(log); - return 0; -} diff --git a/compat/zlib/examples/gzlog.h b/compat/zlib/examples/gzlog.h deleted file mode 100644 index 86f0cec..0000000 --- a/compat/zlib/examples/gzlog.h +++ /dev/null @@ -1,91 +0,0 @@ -/* gzlog.h - Copyright (C) 2004, 2008, 2012 Mark Adler, all rights reserved - version 2.2, 14 Aug 2012 - - This software is provided 'as-is', without any express or implied - warranty. In no event will the author be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Mark Adler madler@alumni.caltech.edu - */ - -/* Version History: - 1.0 26 Nov 2004 First version - 2.0 25 Apr 2008 Complete redesign for recovery of interrupted operations - Interface changed slightly in that now path is a prefix - Compression now occurs as needed during gzlog_write() - gzlog_write() now always leaves the log file as valid gzip - 2.1 8 Jul 2012 Fix argument checks in gzlog_compress() and gzlog_write() - 2.2 14 Aug 2012 Clean up signed comparisons - */ - -/* - The gzlog object allows writing short messages to a gzipped log file, - opening the log file locked for small bursts, and then closing it. The log - object works by appending stored (uncompressed) data to the gzip file until - 1 MB has been accumulated. At that time, the stored data is compressed, and - replaces the uncompressed data in the file. The log file is truncated to - its new size at that time. After each write operation, the log file is a - valid gzip file that can decompressed to recover what was written. - - The gzlog operations can be interupted at any point due to an application or - system crash, and the log file will be recovered the next time the log is - opened with gzlog_open(). - */ - -#ifndef GZLOG_H -#define GZLOG_H - -/* gzlog object type */ -typedef void gzlog; - -/* Open a gzlog object, creating the log file if it does not exist. Return - NULL on error. Note that gzlog_open() could take a while to complete if it - has to wait to verify that a lock is stale (possibly for five minutes), or - if there is significant contention with other instantiations of this object - when locking the resource. path is the prefix of the file names created by - this object. If path is "foo", then the log file will be "foo.gz", and - other auxiliary files will be created and destroyed during the process: - "foo.dict" for a compression dictionary, "foo.temp" for a temporary (next) - dictionary, "foo.add" for data being added or compressed, "foo.lock" for the - lock file, and "foo.repairs" to log recovery operations performed due to - interrupted gzlog operations. A gzlog_open() followed by a gzlog_close() - will recover a previously interrupted operation, if any. */ -gzlog *gzlog_open(char *path); - -/* Write to a gzlog object. Return zero on success, -1 if there is a file i/o - error on any of the gzlog files (this should not happen if gzlog_open() - succeeded, unless the device has run out of space or leftover auxiliary - files have permissions or ownership that prevent their use), -2 if there is - a memory allocation failure, or -3 if the log argument is invalid (e.g. if - it was not created by gzlog_open()). This function will write data to the - file uncompressed, until 1 MB has been accumulated, at which time that data - will be compressed. The log file will be a valid gzip file upon successful - return. */ -int gzlog_write(gzlog *log, void *data, size_t len); - -/* Force compression of any uncompressed data in the log. This should be used - sparingly, if at all. The main application would be when a log file will - not be appended to again. If this is used to compress frequently while - appending, it will both significantly increase the execution time and - reduce the compression ratio. The return codes are the same as for - gzlog_write(). */ -int gzlog_compress(gzlog *log); - -/* Close a gzlog object. Return zero on success, -3 if the log argument is - invalid. The log object is freed, and so cannot be referenced again. */ -int gzlog_close(gzlog *log); - -#endif diff --git a/compat/zlib/examples/zlib_how.html b/compat/zlib/examples/zlib_how.html deleted file mode 100644 index 444ff1c..0000000 --- a/compat/zlib/examples/zlib_how.html +++ /dev/null @@ -1,545 +0,0 @@ - - - - -zlib Usage Example - - - -

zlib Usage Example

-We often get questions about how the deflate() and inflate() functions should be used. -Users wonder when they should provide more input, when they should use more output, -what to do with a Z_BUF_ERROR, how to make sure the process terminates properly, and -so on. So for those who have read zlib.h (a few times), and -would like further edification, below is an annotated example in C of simple routines to compress and decompress -from an input file to an output file using deflate() and inflate() respectively. The -annotations are interspersed between lines of the code. So please read between the lines. -We hope this helps explain some of the intricacies of zlib. -

-Without further adieu, here is the program zpipe.c: -


-/* zpipe.c: example of proper use of zlib's inflate() and deflate()
-   Not copyrighted -- provided to the public domain
-   Version 1.4  11 December 2005  Mark Adler */
-
-/* Version history:
-   1.0  30 Oct 2004  First version
-   1.1   8 Nov 2004  Add void casting for unused return values
-                     Use switch statement for inflate() return values
-   1.2   9 Nov 2004  Add assertions to document zlib guarantees
-   1.3   6 Apr 2005  Remove incorrect assertion in inf()
-   1.4  11 Dec 2005  Add hack to avoid MSDOS end-of-line conversions
-                     Avoid some compiler warnings for input and output buffers
- */
-
-We now include the header files for the required definitions. From -stdio.h we use fopen(), fread(), fwrite(), -feof(), ferror(), and fclose() for file i/o, and -fputs() for error messages. From string.h we use -strcmp() for command line argument processing. -From assert.h we use the assert() macro. -From zlib.h -we use the basic compression functions deflateInit(), -deflate(), and deflateEnd(), and the basic decompression -functions inflateInit(), inflate(), and -inflateEnd(). -

-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include "zlib.h"
-
-This is an ugly hack required to avoid corruption of the input and output data on -Windows/MS-DOS systems. Without this, those systems would assume that the input and output -files are text, and try to convert the end-of-line characters from one standard to -another. That would corrupt binary data, and in particular would render the compressed data unusable. -This sets the input and output to binary which suppresses the end-of-line conversions. -SET_BINARY_MODE() will be used later on stdin and stdout, at the beginning of main(). -

-#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
-#  include <fcntl.h>
-#  include <io.h>
-#  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
-#else
-#  define SET_BINARY_MODE(file)
-#endif
-
-CHUNK is simply the buffer size for feeding data to and pulling data -from the zlib routines. Larger buffer sizes would be more efficient, -especially for inflate(). If the memory is available, buffers sizes -on the order of 128K or 256K bytes should be used. -

-#define CHUNK 16384
-
-The def() routine compresses data from an input file to an output file. The output data -will be in the zlib format, which is different from the gzip or zip -formats. The zlib format has a very small header of only two bytes to identify it as -a zlib stream and to provide decoding information, and a four-byte trailer with a fast -check value to verify the integrity of the uncompressed data after decoding. -

-/* Compress from file source to file dest until EOF on source.
-   def() returns Z_OK on success, Z_MEM_ERROR if memory could not be
-   allocated for processing, Z_STREAM_ERROR if an invalid compression
-   level is supplied, Z_VERSION_ERROR if the version of zlib.h and the
-   version of the library linked do not match, or Z_ERRNO if there is
-   an error reading or writing the files. */
-int def(FILE *source, FILE *dest, int level)
-{
-
-Here are the local variables for def(). ret will be used for zlib -return codes. flush will keep track of the current flushing state for deflate(), -which is either no flushing, or flush to completion after the end of the input file is reached. -have is the amount of data returned from deflate(). The strm structure -is used to pass information to and from the zlib routines, and to maintain the -deflate() state. in and out are the input and output buffers for -deflate(). -

-    int ret, flush;
-    unsigned have;
-    z_stream strm;
-    unsigned char in[CHUNK];
-    unsigned char out[CHUNK];
-
-The first thing we do is to initialize the zlib state for compression using -deflateInit(). This must be done before the first use of deflate(). -The zalloc, zfree, and opaque fields in the strm -structure must be initialized before calling deflateInit(). Here they are -set to the zlib constant Z_NULL to request that zlib use -the default memory allocation routines. An application may also choose to provide -custom memory allocation routines here. deflateInit() will allocate on the -order of 256K bytes for the internal state. -(See zlib Technical Details.) -

-deflateInit() is called with a pointer to the structure to be initialized and -the compression level, which is an integer in the range of -1 to 9. Lower compression -levels result in faster execution, but less compression. Higher levels result in -greater compression, but slower execution. The zlib constant Z_DEFAULT_COMPRESSION, -equal to -1, -provides a good compromise between compression and speed and is equivalent to level 6. -Level 0 actually does no compression at all, and in fact expands the data slightly to produce -the zlib format (it is not a byte-for-byte copy of the input). -More advanced applications of zlib -may use deflateInit2() here instead. Such an application may want to reduce how -much memory will be used, at some price in compression. Or it may need to request a -gzip header and trailer instead of a zlib header and trailer, or raw -encoding with no header or trailer at all. -

-We must check the return value of deflateInit() against the zlib constant -Z_OK to make sure that it was able to -allocate memory for the internal state, and that the provided arguments were valid. -deflateInit() will also check that the version of zlib that the zlib.h -file came from matches the version of zlib actually linked with the program. This -is especially important for environments in which zlib is a shared library. -

-Note that an application can initialize multiple, independent zlib streams, which can -operate in parallel. The state information maintained in the structure allows the zlib -routines to be reentrant. -


-    /* allocate deflate state */
-    strm.zalloc = Z_NULL;
-    strm.zfree = Z_NULL;
-    strm.opaque = Z_NULL;
-    ret = deflateInit(&strm, level);
-    if (ret != Z_OK)
-        return ret;
-
-With the pleasantries out of the way, now we can get down to business. The outer do-loop -reads all of the input file and exits at the bottom of the loop once end-of-file is reached. -This loop contains the only call of deflate(). So we must make sure that all of the -input data has been processed and that all of the output data has been generated and consumed -before we fall out of the loop at the bottom. -

-    /* compress until end of file */
-    do {
-
-We start off by reading data from the input file. The number of bytes read is put directly -into avail_in, and a pointer to those bytes is put into next_in. We also -check to see if end-of-file on the input has been reached. If we are at the end of file, then flush is set to the -zlib constant Z_FINISH, which is later passed to deflate() to -indicate that this is the last chunk of input data to compress. We need to use feof() -to check for end-of-file as opposed to seeing if fewer than CHUNK bytes have been read. The -reason is that if the input file length is an exact multiple of CHUNK, we will miss -the fact that we got to the end-of-file, and not know to tell deflate() to finish -up the compressed stream. If we are not yet at the end of the input, then the zlib -constant Z_NO_FLUSH will be passed to deflate to indicate that we are still -in the middle of the uncompressed data. -

-If there is an error in reading from the input file, the process is aborted with -deflateEnd() being called to free the allocated zlib state before returning -the error. We wouldn't want a memory leak, now would we? deflateEnd() can be called -at any time after the state has been initialized. Once that's done, deflateInit() (or -deflateInit2()) would have to be called to start a new compression process. There is -no point here in checking the deflateEnd() return code. The deallocation can't fail. -


-        strm.avail_in = fread(in, 1, CHUNK, source);
-        if (ferror(source)) {
-            (void)deflateEnd(&strm);
-            return Z_ERRNO;
-        }
-        flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
-        strm.next_in = in;
-
-The inner do-loop passes our chunk of input data to deflate(), and then -keeps calling deflate() until it is done producing output. Once there is no more -new output, deflate() is guaranteed to have consumed all of the input, i.e., -avail_in will be zero. -

-        /* run deflate() on input until output buffer not full, finish
-           compression if all of source has been read in */
-        do {
-
-Output space is provided to deflate() by setting avail_out to the number -of available output bytes and next_out to a pointer to that space. -

-            strm.avail_out = CHUNK;
-            strm.next_out = out;
-
-Now we call the compression engine itself, deflate(). It takes as many of the -avail_in bytes at next_in as it can process, and writes as many as -avail_out bytes to next_out. Those counters and pointers are then -updated past the input data consumed and the output data written. It is the amount of -output space available that may limit how much input is consumed. -Hence the inner loop to make sure that -all of the input is consumed by providing more output space each time. Since avail_in -and next_in are updated by deflate(), we don't have to mess with those -between deflate() calls until it's all used up. -

-The parameters to deflate() are a pointer to the strm structure containing -the input and output information and the internal compression engine state, and a parameter -indicating whether and how to flush data to the output. Normally deflate will consume -several K bytes of input data before producing any output (except for the header), in order -to accumulate statistics on the data for optimum compression. It will then put out a burst of -compressed data, and proceed to consume more input before the next burst. Eventually, -deflate() -must be told to terminate the stream, complete the compression with provided input data, and -write out the trailer check value. deflate() will continue to compress normally as long -as the flush parameter is Z_NO_FLUSH. Once the Z_FINISH parameter is provided, -deflate() will begin to complete the compressed output stream. However depending on how -much output space is provided, deflate() may have to be called several times until it -has provided the complete compressed stream, even after it has consumed all of the input. The flush -parameter must continue to be Z_FINISH for those subsequent calls. -

-There are other values of the flush parameter that are used in more advanced applications. You can -force deflate() to produce a burst of output that encodes all of the input data provided -so far, even if it wouldn't have otherwise, for example to control data latency on a link with -compressed data. You can also ask that deflate() do that as well as erase any history up to -that point so that what follows can be decompressed independently, for example for random access -applications. Both requests will degrade compression by an amount depending on how often such -requests are made. -

-deflate() has a return value that can indicate errors, yet we do not check it here. Why -not? Well, it turns out that deflate() can do no wrong here. Let's go through -deflate()'s return values and dispense with them one by one. The possible values are -Z_OK, Z_STREAM_END, Z_STREAM_ERROR, or Z_BUF_ERROR. Z_OK -is, well, ok. Z_STREAM_END is also ok and will be returned for the last call of -deflate(). This is already guaranteed by calling deflate() with Z_FINISH -until it has no more output. Z_STREAM_ERROR is only possible if the stream is not -initialized properly, but we did initialize it properly. There is no harm in checking for -Z_STREAM_ERROR here, for example to check for the possibility that some -other part of the application inadvertently clobbered the memory containing the zlib state. -Z_BUF_ERROR will be explained further below, but -suffice it to say that this is simply an indication that deflate() could not consume -more input or produce more output. deflate() can be called again with more output space -or more available input, which it will be in this code. -


-            ret = deflate(&strm, flush);    /* no bad return value */
-            assert(ret != Z_STREAM_ERROR);  /* state not clobbered */
-
-Now we compute how much output deflate() provided on the last call, which is the -difference between how much space was provided before the call, and how much output space -is still available after the call. Then that data, if any, is written to the output file. -We can then reuse the output buffer for the next call of deflate(). Again if there -is a file i/o error, we call deflateEnd() before returning to avoid a memory leak. -

-            have = CHUNK - strm.avail_out;
-            if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
-                (void)deflateEnd(&strm);
-                return Z_ERRNO;
-            }
-
-The inner do-loop is repeated until the last deflate() call fails to fill the -provided output buffer. Then we know that deflate() has done as much as it can with -the provided input, and that all of that input has been consumed. We can then fall out of this -loop and reuse the input buffer. -

-The way we tell that deflate() has no more output is by seeing that it did not fill -the output buffer, leaving avail_out greater than zero. However suppose that -deflate() has no more output, but just so happened to exactly fill the output buffer! -avail_out is zero, and we can't tell that deflate() has done all it can. -As far as we know, deflate() -has more output for us. So we call it again. But now deflate() produces no output -at all, and avail_out remains unchanged as CHUNK. That deflate() call -wasn't able to do anything, either consume input or produce output, and so it returns -Z_BUF_ERROR. (See, I told you I'd cover this later.) However this is not a problem at -all. Now we finally have the desired indication that deflate() is really done, -and so we drop out of the inner loop to provide more input to deflate(). -

-With flush set to Z_FINISH, this final set of deflate() calls will -complete the output stream. Once that is done, subsequent calls of deflate() would return -Z_STREAM_ERROR if the flush parameter is not Z_FINISH, and do no more processing -until the state is reinitialized. -

-Some applications of zlib have two loops that call deflate() -instead of the single inner loop we have here. The first loop would call -without flushing and feed all of the data to deflate(). The second loop would call -deflate() with no more -data and the Z_FINISH parameter to complete the process. As you can see from this -example, that can be avoided by simply keeping track of the current flush state. -


-        } while (strm.avail_out == 0);
-        assert(strm.avail_in == 0);     /* all input will be used */
-
-Now we check to see if we have already processed all of the input file. That information was -saved in the flush variable, so we see if that was set to Z_FINISH. If so, -then we're done and we fall out of the outer loop. We're guaranteed to get Z_STREAM_END -from the last deflate() call, since we ran it until the last chunk of input was -consumed and all of the output was generated. -

-        /* done when last data in file processed */
-    } while (flush != Z_FINISH);
-    assert(ret == Z_STREAM_END);        /* stream will be complete */
-
-The process is complete, but we still need to deallocate the state to avoid a memory leak -(or rather more like a memory hemorrhage if you didn't do this). Then -finally we can return with a happy return value. -

-    /* clean up and return */
-    (void)deflateEnd(&strm);
-    return Z_OK;
-}
-
-Now we do the same thing for decompression in the inf() routine. inf() -decompresses what is hopefully a valid zlib stream from the input file and writes the -uncompressed data to the output file. Much of the discussion above for def() -applies to inf() as well, so the discussion here will focus on the differences between -the two. -

-/* Decompress from file source to file dest until stream ends or EOF.
-   inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be
-   allocated for processing, Z_DATA_ERROR if the deflate data is
-   invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and
-   the version of the library linked do not match, or Z_ERRNO if there
-   is an error reading or writing the files. */
-int inf(FILE *source, FILE *dest)
-{
-
-The local variables have the same functionality as they do for def(). The -only difference is that there is no flush variable, since inflate() -can tell from the zlib stream itself when the stream is complete. -

-    int ret;
-    unsigned have;
-    z_stream strm;
-    unsigned char in[CHUNK];
-    unsigned char out[CHUNK];
-
-The initialization of the state is the same, except that there is no compression level, -of course, and two more elements of the structure are initialized. avail_in -and next_in must be initialized before calling inflateInit(). This -is because the application has the option to provide the start of the zlib stream in -order for inflateInit() to have access to information about the compression -method to aid in memory allocation. In the current implementation of zlib -(up through versions 1.2.x), the method-dependent memory allocations are deferred to the first call of -inflate() anyway. However those fields must be initialized since later versions -of zlib that provide more compression methods may take advantage of this interface. -In any case, no decompression is performed by inflateInit(), so the -avail_out and next_out fields do not need to be initialized before calling. -

-Here avail_in is set to zero and next_in is set to Z_NULL to -indicate that no input data is being provided. -


-    /* allocate inflate state */
-    strm.zalloc = Z_NULL;
-    strm.zfree = Z_NULL;
-    strm.opaque = Z_NULL;
-    strm.avail_in = 0;
-    strm.next_in = Z_NULL;
-    ret = inflateInit(&strm);
-    if (ret != Z_OK)
-        return ret;
-
-The outer do-loop decompresses input until inflate() indicates -that it has reached the end of the compressed data and has produced all of the uncompressed -output. This is in contrast to def() which processes all of the input file. -If end-of-file is reached before the compressed data self-terminates, then the compressed -data is incomplete and an error is returned. -

-    /* decompress until deflate stream ends or end of file */
-    do {
-
-We read input data and set the strm structure accordingly. If we've reached the -end of the input file, then we leave the outer loop and report an error, since the -compressed data is incomplete. Note that we may read more data than is eventually consumed -by inflate(), if the input file continues past the zlib stream. -For applications where zlib streams are embedded in other data, this routine would -need to be modified to return the unused data, or at least indicate how much of the input -data was not used, so the application would know where to pick up after the zlib stream. -

-        strm.avail_in = fread(in, 1, CHUNK, source);
-        if (ferror(source)) {
-            (void)inflateEnd(&strm);
-            return Z_ERRNO;
-        }
-        if (strm.avail_in == 0)
-            break;
-        strm.next_in = in;
-
-The inner do-loop has the same function it did in def(), which is to -keep calling inflate() until has generated all of the output it can with the -provided input. -

-        /* run inflate() on input until output buffer not full */
-        do {
-
-Just like in def(), the same output space is provided for each call of inflate(). -

-            strm.avail_out = CHUNK;
-            strm.next_out = out;
-
-Now we run the decompression engine itself. There is no need to adjust the flush parameter, since -the zlib format is self-terminating. The main difference here is that there are -return values that we need to pay attention to. Z_DATA_ERROR -indicates that inflate() detected an error in the zlib compressed data format, -which means that either the data is not a zlib stream to begin with, or that the data was -corrupted somewhere along the way since it was compressed. The other error to be processed is -Z_MEM_ERROR, which can occur since memory allocation is deferred until inflate() -needs it, unlike deflate(), whose memory is allocated at the start by deflateInit(). -

-Advanced applications may use -deflateSetDictionary() to prime deflate() with a set of likely data to improve the -first 32K or so of compression. This is noted in the zlib header, so inflate() -requests that that dictionary be provided before it can start to decompress. Without the dictionary, -correct decompression is not possible. For this routine, we have no idea what the dictionary is, -so the Z_NEED_DICT indication is converted to a Z_DATA_ERROR. -

-inflate() can also return Z_STREAM_ERROR, which should not be possible here, -but could be checked for as noted above for def(). Z_BUF_ERROR does not need to be -checked for here, for the same reasons noted for def(). Z_STREAM_END will be -checked for later. -


-            ret = inflate(&strm, Z_NO_FLUSH);
-            assert(ret != Z_STREAM_ERROR);  /* state not clobbered */
-            switch (ret) {
-            case Z_NEED_DICT:
-                ret = Z_DATA_ERROR;     /* and fall through */
-            case Z_DATA_ERROR:
-            case Z_MEM_ERROR:
-                (void)inflateEnd(&strm);
-                return ret;
-            }
-
-The output of inflate() is handled identically to that of deflate(). -

-            have = CHUNK - strm.avail_out;
-            if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
-                (void)inflateEnd(&strm);
-                return Z_ERRNO;
-            }
-
-The inner do-loop ends when inflate() has no more output as indicated -by not filling the output buffer, just as for deflate(). In this case, we cannot -assert that strm.avail_in will be zero, since the deflate stream may end before the file -does. -

-        } while (strm.avail_out == 0);
-
-The outer do-loop ends when inflate() reports that it has reached the -end of the input zlib stream, has completed the decompression and integrity -check, and has provided all of the output. This is indicated by the inflate() -return value Z_STREAM_END. The inner loop is guaranteed to leave ret -equal to Z_STREAM_END if the last chunk of the input file read contained the end -of the zlib stream. So if the return value is not Z_STREAM_END, the -loop continues to read more input. -

-        /* done when inflate() says it's done */
-    } while (ret != Z_STREAM_END);
-
-At this point, decompression successfully completed, or we broke out of the loop due to no -more data being available from the input file. If the last inflate() return value -is not Z_STREAM_END, then the zlib stream was incomplete and a data error -is returned. Otherwise, we return with a happy return value. Of course, inflateEnd() -is called first to avoid a memory leak. -

-    /* clean up and return */
-    (void)inflateEnd(&strm);
-    return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
-}
-
-That ends the routines that directly use zlib. The following routines make this -a command-line program by running data through the above routines from stdin to -stdout, and handling any errors reported by def() or inf(). -

-zerr() is used to interpret the possible error codes from def() -and inf(), as detailed in their comments above, and print out an error message. -Note that these are only a subset of the possible return values from deflate() -and inflate(). -


-/* report a zlib or i/o error */
-void zerr(int ret)
-{
-    fputs("zpipe: ", stderr);
-    switch (ret) {
-    case Z_ERRNO:
-        if (ferror(stdin))
-            fputs("error reading stdin\n", stderr);
-        if (ferror(stdout))
-            fputs("error writing stdout\n", stderr);
-        break;
-    case Z_STREAM_ERROR:
-        fputs("invalid compression level\n", stderr);
-        break;
-    case Z_DATA_ERROR:
-        fputs("invalid or incomplete deflate data\n", stderr);
-        break;
-    case Z_MEM_ERROR:
-        fputs("out of memory\n", stderr);
-        break;
-    case Z_VERSION_ERROR:
-        fputs("zlib version mismatch!\n", stderr);
-    }
-}
-
-Here is the main() routine used to test def() and inf(). The -zpipe command is simply a compression pipe from stdin to stdout, if -no arguments are given, or it is a decompression pipe if zpipe -d is used. If any other -arguments are provided, no compression or decompression is performed. Instead a usage -message is displayed. Examples are zpipe < foo.txt > foo.txt.z to compress, and -zpipe -d < foo.txt.z > foo.txt to decompress. -

-/* compress or decompress from stdin to stdout */
-int main(int argc, char **argv)
-{
-    int ret;
-
-    /* avoid end-of-line conversions */
-    SET_BINARY_MODE(stdin);
-    SET_BINARY_MODE(stdout);
-
-    /* do compression if no arguments */
-    if (argc == 1) {
-        ret = def(stdin, stdout, Z_DEFAULT_COMPRESSION);
-        if (ret != Z_OK)
-            zerr(ret);
-        return ret;
-    }
-
-    /* do decompression if -d specified */
-    else if (argc == 2 && strcmp(argv[1], "-d") == 0) {
-        ret = inf(stdin, stdout);
-        if (ret != Z_OK)
-            zerr(ret);
-        return ret;
-    }
-
-    /* otherwise, report usage */
-    else {
-        fputs("zpipe usage: zpipe [-d] < source > dest\n", stderr);
-        return 1;
-    }
-}
-
-
-Copyright (c) 2004, 2005 by Mark Adler
Last modified 11 December 2005
- - diff --git a/compat/zlib/examples/zpipe.c b/compat/zlib/examples/zpipe.c deleted file mode 100644 index 83535d1..0000000 --- a/compat/zlib/examples/zpipe.c +++ /dev/null @@ -1,205 +0,0 @@ -/* zpipe.c: example of proper use of zlib's inflate() and deflate() - Not copyrighted -- provided to the public domain - Version 1.4 11 December 2005 Mark Adler */ - -/* Version history: - 1.0 30 Oct 2004 First version - 1.1 8 Nov 2004 Add void casting for unused return values - Use switch statement for inflate() return values - 1.2 9 Nov 2004 Add assertions to document zlib guarantees - 1.3 6 Apr 2005 Remove incorrect assertion in inf() - 1.4 11 Dec 2005 Add hack to avoid MSDOS end-of-line conversions - Avoid some compiler warnings for input and output buffers - */ - -#include -#include -#include -#include "zlib.h" - -#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) -# include -# include -# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif - -#define CHUNK 16384 - -/* Compress from file source to file dest until EOF on source. - def() returns Z_OK on success, Z_MEM_ERROR if memory could not be - allocated for processing, Z_STREAM_ERROR if an invalid compression - level is supplied, Z_VERSION_ERROR if the version of zlib.h and the - version of the library linked do not match, or Z_ERRNO if there is - an error reading or writing the files. */ -int def(FILE *source, FILE *dest, int level) -{ - int ret, flush; - unsigned have; - z_stream strm; - unsigned char in[CHUNK]; - unsigned char out[CHUNK]; - - /* allocate deflate state */ - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - ret = deflateInit(&strm, level); - if (ret != Z_OK) - return ret; - - /* compress until end of file */ - do { - strm.avail_in = fread(in, 1, CHUNK, source); - if (ferror(source)) { - (void)deflateEnd(&strm); - return Z_ERRNO; - } - flush = feof(source) ? Z_FINISH : Z_NO_FLUSH; - strm.next_in = in; - - /* run deflate() on input until output buffer not full, finish - compression if all of source has been read in */ - do { - strm.avail_out = CHUNK; - strm.next_out = out; - ret = deflate(&strm, flush); /* no bad return value */ - assert(ret != Z_STREAM_ERROR); /* state not clobbered */ - have = CHUNK - strm.avail_out; - if (fwrite(out, 1, have, dest) != have || ferror(dest)) { - (void)deflateEnd(&strm); - return Z_ERRNO; - } - } while (strm.avail_out == 0); - assert(strm.avail_in == 0); /* all input will be used */ - - /* done when last data in file processed */ - } while (flush != Z_FINISH); - assert(ret == Z_STREAM_END); /* stream will be complete */ - - /* clean up and return */ - (void)deflateEnd(&strm); - return Z_OK; -} - -/* Decompress from file source to file dest until stream ends or EOF. - inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be - allocated for processing, Z_DATA_ERROR if the deflate data is - invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and - the version of the library linked do not match, or Z_ERRNO if there - is an error reading or writing the files. */ -int inf(FILE *source, FILE *dest) -{ - int ret; - unsigned have; - z_stream strm; - unsigned char in[CHUNK]; - unsigned char out[CHUNK]; - - /* allocate inflate state */ - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit(&strm); - if (ret != Z_OK) - return ret; - - /* decompress until deflate stream ends or end of file */ - do { - strm.avail_in = fread(in, 1, CHUNK, source); - if (ferror(source)) { - (void)inflateEnd(&strm); - return Z_ERRNO; - } - if (strm.avail_in == 0) - break; - strm.next_in = in; - - /* run inflate() on input until output buffer not full */ - do { - strm.avail_out = CHUNK; - strm.next_out = out; - ret = inflate(&strm, Z_NO_FLUSH); - assert(ret != Z_STREAM_ERROR); /* state not clobbered */ - switch (ret) { - case Z_NEED_DICT: - ret = Z_DATA_ERROR; /* and fall through */ - case Z_DATA_ERROR: - case Z_MEM_ERROR: - (void)inflateEnd(&strm); - return ret; - } - have = CHUNK - strm.avail_out; - if (fwrite(out, 1, have, dest) != have || ferror(dest)) { - (void)inflateEnd(&strm); - return Z_ERRNO; - } - } while (strm.avail_out == 0); - - /* done when inflate() says it's done */ - } while (ret != Z_STREAM_END); - - /* clean up and return */ - (void)inflateEnd(&strm); - return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR; -} - -/* report a zlib or i/o error */ -void zerr(int ret) -{ - fputs("zpipe: ", stderr); - switch (ret) { - case Z_ERRNO: - if (ferror(stdin)) - fputs("error reading stdin\n", stderr); - if (ferror(stdout)) - fputs("error writing stdout\n", stderr); - break; - case Z_STREAM_ERROR: - fputs("invalid compression level\n", stderr); - break; - case Z_DATA_ERROR: - fputs("invalid or incomplete deflate data\n", stderr); - break; - case Z_MEM_ERROR: - fputs("out of memory\n", stderr); - break; - case Z_VERSION_ERROR: - fputs("zlib version mismatch!\n", stderr); - } -} - -/* compress or decompress from stdin to stdout */ -int main(int argc, char **argv) -{ - int ret; - - /* avoid end-of-line conversions */ - SET_BINARY_MODE(stdin); - SET_BINARY_MODE(stdout); - - /* do compression if no arguments */ - if (argc == 1) { - ret = def(stdin, stdout, Z_DEFAULT_COMPRESSION); - if (ret != Z_OK) - zerr(ret); - return ret; - } - - /* do decompression if -d specified */ - else if (argc == 2 && strcmp(argv[1], "-d") == 0) { - ret = inf(stdin, stdout); - if (ret != Z_OK) - zerr(ret); - return ret; - } - - /* otherwise, report usage */ - else { - fputs("zpipe usage: zpipe [-d] < source > dest\n", stderr); - return 1; - } -} diff --git a/compat/zlib/examples/zran.c b/compat/zlib/examples/zran.c deleted file mode 100644 index 4fec659..0000000 --- a/compat/zlib/examples/zran.c +++ /dev/null @@ -1,409 +0,0 @@ -/* zran.c -- example of zlib/gzip stream indexing and random access - * Copyright (C) 2005, 2012 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - Version 1.1 29 Sep 2012 Mark Adler */ - -/* Version History: - 1.0 29 May 2005 First version - 1.1 29 Sep 2012 Fix memory reallocation error - */ - -/* Illustrate the use of Z_BLOCK, inflatePrime(), and inflateSetDictionary() - for random access of a compressed file. A file containing a zlib or gzip - stream is provided on the command line. The compressed stream is decoded in - its entirety, and an index built with access points about every SPAN bytes - in the uncompressed output. The compressed file is left open, and can then - be read randomly, having to decompress on the average SPAN/2 uncompressed - bytes before getting to the desired block of data. - - An access point can be created at the start of any deflate block, by saving - the starting file offset and bit of that block, and the 32K bytes of - uncompressed data that precede that block. Also the uncompressed offset of - that block is saved to provide a referece for locating a desired starting - point in the uncompressed stream. build_index() works by decompressing the - input zlib or gzip stream a block at a time, and at the end of each block - deciding if enough uncompressed data has gone by to justify the creation of - a new access point. If so, that point is saved in a data structure that - grows as needed to accommodate the points. - - To use the index, an offset in the uncompressed data is provided, for which - the latest access point at or preceding that offset is located in the index. - The input file is positioned to the specified location in the index, and if - necessary the first few bits of the compressed data is read from the file. - inflate is initialized with those bits and the 32K of uncompressed data, and - the decompression then proceeds until the desired offset in the file is - reached. Then the decompression continues to read the desired uncompressed - data from the file. - - Another approach would be to generate the index on demand. In that case, - requests for random access reads from the compressed data would try to use - the index, but if a read far enough past the end of the index is required, - then further index entries would be generated and added. - - There is some fair bit of overhead to starting inflation for the random - access, mainly copying the 32K byte dictionary. So if small pieces of the - file are being accessed, it would make sense to implement a cache to hold - some lookahead and avoid many calls to extract() for small lengths. - - Another way to build an index would be to use inflateCopy(). That would - not be constrained to have access points at block boundaries, but requires - more memory per access point, and also cannot be saved to file due to the - use of pointers in the state. The approach here allows for storage of the - index in a file. - */ - -#include -#include -#include -#include "zlib.h" - -#define local static - -#define SPAN 1048576L /* desired distance between access points */ -#define WINSIZE 32768U /* sliding window size */ -#define CHUNK 16384 /* file input buffer size */ - -/* access point entry */ -struct point { - off_t out; /* corresponding offset in uncompressed data */ - off_t in; /* offset in input file of first full byte */ - int bits; /* number of bits (1-7) from byte at in - 1, or 0 */ - unsigned char window[WINSIZE]; /* preceding 32K of uncompressed data */ -}; - -/* access point list */ -struct access { - int have; /* number of list entries filled in */ - int size; /* number of list entries allocated */ - struct point *list; /* allocated list */ -}; - -/* Deallocate an index built by build_index() */ -local void free_index(struct access *index) -{ - if (index != NULL) { - free(index->list); - free(index); - } -} - -/* Add an entry to the access point list. If out of memory, deallocate the - existing list and return NULL. */ -local struct access *addpoint(struct access *index, int bits, - off_t in, off_t out, unsigned left, unsigned char *window) -{ - struct point *next; - - /* if list is empty, create it (start with eight points) */ - if (index == NULL) { - index = malloc(sizeof(struct access)); - if (index == NULL) return NULL; - index->list = malloc(sizeof(struct point) << 3); - if (index->list == NULL) { - free(index); - return NULL; - } - index->size = 8; - index->have = 0; - } - - /* if list is full, make it bigger */ - else if (index->have == index->size) { - index->size <<= 1; - next = realloc(index->list, sizeof(struct point) * index->size); - if (next == NULL) { - free_index(index); - return NULL; - } - index->list = next; - } - - /* fill in entry and increment how many we have */ - next = index->list + index->have; - next->bits = bits; - next->in = in; - next->out = out; - if (left) - memcpy(next->window, window + WINSIZE - left, left); - if (left < WINSIZE) - memcpy(next->window + left, window, WINSIZE - left); - index->have++; - - /* return list, possibly reallocated */ - return index; -} - -/* Make one entire pass through the compressed stream and build an index, with - access points about every span bytes of uncompressed output -- span is - chosen to balance the speed of random access against the memory requirements - of the list, about 32K bytes per access point. Note that data after the end - of the first zlib or gzip stream in the file is ignored. build_index() - returns the number of access points on success (>= 1), Z_MEM_ERROR for out - of memory, Z_DATA_ERROR for an error in the input file, or Z_ERRNO for a - file read error. On success, *built points to the resulting index. */ -local int build_index(FILE *in, off_t span, struct access **built) -{ - int ret; - off_t totin, totout; /* our own total counters to avoid 4GB limit */ - off_t last; /* totout value of last access point */ - struct access *index; /* access points being generated */ - z_stream strm; - unsigned char input[CHUNK]; - unsigned char window[WINSIZE]; - - /* initialize inflate */ - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit2(&strm, 47); /* automatic zlib or gzip decoding */ - if (ret != Z_OK) - return ret; - - /* inflate the input, maintain a sliding window, and build an index -- this - also validates the integrity of the compressed data using the check - information at the end of the gzip or zlib stream */ - totin = totout = last = 0; - index = NULL; /* will be allocated by first addpoint() */ - strm.avail_out = 0; - do { - /* get some compressed data from input file */ - strm.avail_in = fread(input, 1, CHUNK, in); - if (ferror(in)) { - ret = Z_ERRNO; - goto build_index_error; - } - if (strm.avail_in == 0) { - ret = Z_DATA_ERROR; - goto build_index_error; - } - strm.next_in = input; - - /* process all of that, or until end of stream */ - do { - /* reset sliding window if necessary */ - if (strm.avail_out == 0) { - strm.avail_out = WINSIZE; - strm.next_out = window; - } - - /* inflate until out of input, output, or at end of block -- - update the total input and output counters */ - totin += strm.avail_in; - totout += strm.avail_out; - ret = inflate(&strm, Z_BLOCK); /* return at end of block */ - totin -= strm.avail_in; - totout -= strm.avail_out; - if (ret == Z_NEED_DICT) - ret = Z_DATA_ERROR; - if (ret == Z_MEM_ERROR || ret == Z_DATA_ERROR) - goto build_index_error; - if (ret == Z_STREAM_END) - break; - - /* if at end of block, consider adding an index entry (note that if - data_type indicates an end-of-block, then all of the - uncompressed data from that block has been delivered, and none - of the compressed data after that block has been consumed, - except for up to seven bits) -- the totout == 0 provides an - entry point after the zlib or gzip header, and assures that the - index always has at least one access point; we avoid creating an - access point after the last block by checking bit 6 of data_type - */ - if ((strm.data_type & 128) && !(strm.data_type & 64) && - (totout == 0 || totout - last > span)) { - index = addpoint(index, strm.data_type & 7, totin, - totout, strm.avail_out, window); - if (index == NULL) { - ret = Z_MEM_ERROR; - goto build_index_error; - } - last = totout; - } - } while (strm.avail_in != 0); - } while (ret != Z_STREAM_END); - - /* clean up and return index (release unused entries in list) */ - (void)inflateEnd(&strm); - index->list = realloc(index->list, sizeof(struct point) * index->have); - index->size = index->have; - *built = index; - return index->size; - - /* return error */ - build_index_error: - (void)inflateEnd(&strm); - if (index != NULL) - free_index(index); - return ret; -} - -/* Use the index to read len bytes from offset into buf, return bytes read or - negative for error (Z_DATA_ERROR or Z_MEM_ERROR). If data is requested past - the end of the uncompressed data, then extract() will return a value less - than len, indicating how much as actually read into buf. This function - should not return a data error unless the file was modified since the index - was generated. extract() may also return Z_ERRNO if there is an error on - reading or seeking the input file. */ -local int extract(FILE *in, struct access *index, off_t offset, - unsigned char *buf, int len) -{ - int ret, skip; - z_stream strm; - struct point *here; - unsigned char input[CHUNK]; - unsigned char discard[WINSIZE]; - - /* proceed only if something reasonable to do */ - if (len < 0) - return 0; - - /* find where in stream to start */ - here = index->list; - ret = index->have; - while (--ret && here[1].out <= offset) - here++; - - /* initialize file and inflate state to start there */ - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - strm.opaque = Z_NULL; - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit2(&strm, -15); /* raw inflate */ - if (ret != Z_OK) - return ret; - ret = fseeko(in, here->in - (here->bits ? 1 : 0), SEEK_SET); - if (ret == -1) - goto extract_ret; - if (here->bits) { - ret = getc(in); - if (ret == -1) { - ret = ferror(in) ? Z_ERRNO : Z_DATA_ERROR; - goto extract_ret; - } - (void)inflatePrime(&strm, here->bits, ret >> (8 - here->bits)); - } - (void)inflateSetDictionary(&strm, here->window, WINSIZE); - - /* skip uncompressed bytes until offset reached, then satisfy request */ - offset -= here->out; - strm.avail_in = 0; - skip = 1; /* while skipping to offset */ - do { - /* define where to put uncompressed data, and how much */ - if (offset == 0 && skip) { /* at offset now */ - strm.avail_out = len; - strm.next_out = buf; - skip = 0; /* only do this once */ - } - if (offset > WINSIZE) { /* skip WINSIZE bytes */ - strm.avail_out = WINSIZE; - strm.next_out = discard; - offset -= WINSIZE; - } - else if (offset != 0) { /* last skip */ - strm.avail_out = (unsigned)offset; - strm.next_out = discard; - offset = 0; - } - - /* uncompress until avail_out filled, or end of stream */ - do { - if (strm.avail_in == 0) { - strm.avail_in = fread(input, 1, CHUNK, in); - if (ferror(in)) { - ret = Z_ERRNO; - goto extract_ret; - } - if (strm.avail_in == 0) { - ret = Z_DATA_ERROR; - goto extract_ret; - } - strm.next_in = input; - } - ret = inflate(&strm, Z_NO_FLUSH); /* normal inflate */ - if (ret == Z_NEED_DICT) - ret = Z_DATA_ERROR; - if (ret == Z_MEM_ERROR || ret == Z_DATA_ERROR) - goto extract_ret; - if (ret == Z_STREAM_END) - break; - } while (strm.avail_out != 0); - - /* if reach end of stream, then don't keep trying to get more */ - if (ret == Z_STREAM_END) - break; - - /* do until offset reached and requested data read, or stream ends */ - } while (skip); - - /* compute number of uncompressed bytes read after offset */ - ret = skip ? 0 : len - strm.avail_out; - - /* clean up and return bytes read or error */ - extract_ret: - (void)inflateEnd(&strm); - return ret; -} - -/* Demonstrate the use of build_index() and extract() by processing the file - provided on the command line, and the extracting 16K from about 2/3rds of - the way through the uncompressed output, and writing that to stdout. */ -int main(int argc, char **argv) -{ - int len; - off_t offset; - FILE *in; - struct access *index = NULL; - unsigned char buf[CHUNK]; - - /* open input file */ - if (argc != 2) { - fprintf(stderr, "usage: zran file.gz\n"); - return 1; - } - in = fopen(argv[1], "rb"); - if (in == NULL) { - fprintf(stderr, "zran: could not open %s for reading\n", argv[1]); - return 1; - } - - /* build index */ - len = build_index(in, SPAN, &index); - if (len < 0) { - fclose(in); - switch (len) { - case Z_MEM_ERROR: - fprintf(stderr, "zran: out of memory\n"); - break; - case Z_DATA_ERROR: - fprintf(stderr, "zran: compressed data error in %s\n", argv[1]); - break; - case Z_ERRNO: - fprintf(stderr, "zran: read error on %s\n", argv[1]); - break; - default: - fprintf(stderr, "zran: error %d while building index\n", len); - } - return 1; - } - fprintf(stderr, "zran: built index with %d access points\n", len); - - /* use index by reading some bytes from an arbitrary offset */ - offset = (index->list[index->have - 1].out << 1) / 3; - len = extract(in, index, offset, buf, CHUNK); - if (len < 0) - fprintf(stderr, "zran: extraction failed: %s error\n", - len == Z_MEM_ERROR ? "out of memory" : "input corrupted"); - else { - fwrite(buf, 1, len, stdout); - fprintf(stderr, "zran: extracted %d bytes at %llu\n", len, offset); - } - - /* clean up and exit */ - free_index(index); - fclose(in); - return 0; -} diff --git a/compat/zlib/gzclose.c b/compat/zlib/gzclose.c deleted file mode 100644 index caeb99a..0000000 --- a/compat/zlib/gzclose.c +++ /dev/null @@ -1,25 +0,0 @@ -/* gzclose.c -- zlib gzclose() function - * Copyright (C) 2004, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "gzguts.h" - -/* gzclose() is in a separate file so that it is linked in only if it is used. - That way the other gzclose functions can be used instead to avoid linking in - unneeded compression or decompression routines. */ -int ZEXPORT gzclose(file) - gzFile file; -{ -#ifndef NO_GZCOMPRESS - gz_statep state; - - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - - return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); -#else - return gzclose_r(file); -#endif -} diff --git a/compat/zlib/gzguts.h b/compat/zlib/gzguts.h deleted file mode 100644 index 990a4d2..0000000 --- a/compat/zlib/gzguts.h +++ /dev/null @@ -1,218 +0,0 @@ -/* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifdef _LARGEFILE64_SOURCE -# ifndef _LARGEFILE_SOURCE -# define _LARGEFILE_SOURCE 1 -# endif -# ifdef _FILE_OFFSET_BITS -# undef _FILE_OFFSET_BITS -# endif -#endif - -#ifdef HAVE_HIDDEN -# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) -#else -# define ZLIB_INTERNAL -#endif - -#include -#include "zlib.h" -#ifdef STDC -# include -# include -# include -#endif - -#ifndef _POSIX_SOURCE -# define _POSIX_SOURCE -#endif -#include - -#ifdef _WIN32 -# include -#endif - -#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32) -# include -#endif - -#if defined(_WIN32) || defined(__CYGWIN__) -# define WIDECHAR -#endif - -#ifdef WINAPI_FAMILY -# define open _open -# define read _read -# define write _write -# define close _close -#endif - -#ifdef NO_DEFLATE /* for compatibility with old definition */ -# define NO_GZCOMPRESS -#endif - -#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif - -#if defined(__CYGWIN__) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif - -#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif - -#ifndef HAVE_VSNPRINTF -# ifdef MSDOS -/* vsnprintf may exist on some MS-DOS compilers (DJGPP?), - but for now we just assume it doesn't. */ -# define NO_vsnprintf -# endif -# ifdef __TURBOC__ -# define NO_vsnprintf -# endif -# ifdef WIN32 -/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -# if !defined(vsnprintf) && !defined(NO_vsnprintf) -# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) -# define vsnprintf _vsnprintf -# endif -# endif -# endif -# ifdef __SASC -# define NO_vsnprintf -# endif -# ifdef VMS -# define NO_vsnprintf -# endif -# ifdef __OS400__ -# define NO_vsnprintf -# endif -# ifdef __MVS__ -# define NO_vsnprintf -# endif -#endif - -/* unlike snprintf (which is required in C99), _snprintf does not guarantee - null termination of the result -- however this is only used in gzlib.c where - the result is assured to fit in the space provided */ -#if defined(_MSC_VER) && _MSC_VER < 1900 -# define snprintf _snprintf -#endif - -#ifndef local -# define local static -#endif -/* since "static" is used to mean two completely different things in C, we - define "local" for the non-static meaning of "static", for readability - (compile with -Dlocal if your debugger can't find static symbols) */ - -/* gz* functions always use library allocation functions */ -#ifndef STDC - extern voidp malloc OF((uInt size)); - extern void free OF((voidpf ptr)); -#endif - -/* get errno and strerror definition */ -#if defined UNDER_CE -# include -# define zstrerror() gz_strwinerror((DWORD)GetLastError()) -#else -# ifndef NO_STRERROR -# include -# define zstrerror() strerror(errno) -# else -# define zstrerror() "stdio error (consult errno)" -# endif -#endif - -/* provide prototypes for these when building zlib without LFS */ -#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); - ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); -#endif - -/* default memLevel */ -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif - -/* default i/o buffer size -- double this for output when reading (this and - twice this must be able to fit in an unsigned type) */ -#define GZBUFSIZE 8192 - -/* gzip modes, also provide a little integrity check on the passed structure */ -#define GZ_NONE 0 -#define GZ_READ 7247 -#define GZ_WRITE 31153 -#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ - -/* values for gz_state how */ -#define LOOK 0 /* look for a gzip header */ -#define COPY 1 /* copy input directly */ -#define GZIP 2 /* decompress a gzip stream */ - -/* internal gzip file state data structure */ -typedef struct { - /* exposed contents for gzgetc() macro */ - struct gzFile_s x; /* "x" for exposed */ - /* x.have: number of bytes available at x.next */ - /* x.next: next output data to deliver or write */ - /* x.pos: current position in uncompressed data */ - /* used for both reading and writing */ - int mode; /* see gzip modes above */ - int fd; /* file descriptor */ - char *path; /* path or fd for error messages */ - unsigned size; /* buffer size, zero if not allocated yet */ - unsigned want; /* requested buffer size, default is GZBUFSIZE */ - unsigned char *in; /* input buffer (double-sized when writing) */ - unsigned char *out; /* output buffer (double-sized when reading) */ - int direct; /* 0 if processing gzip, 1 if transparent */ - /* just for reading */ - int how; /* 0: get header, 1: copy, 2: decompress */ - z_off64_t start; /* where the gzip data started, for rewinding */ - int eof; /* true if end of input file reached */ - int past; /* true if read requested past end */ - /* just for writing */ - int level; /* compression level */ - int strategy; /* compression strategy */ - /* seek request */ - z_off64_t skip; /* amount to skip (already rewound if backwards) */ - int seek; /* true if seek request pending */ - /* error information */ - int err; /* error code */ - char *msg; /* error message */ - /* zlib inflate or deflate stream */ - z_stream strm; /* stream structure in-place (not a pointer) */ -} gz_state; -typedef gz_state FAR *gz_statep; - -/* shared functions */ -void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); -#if defined UNDER_CE -char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); -#endif - -/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t - value -- needed when comparing unsigned to z_off64_t, which is signed - (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else -unsigned ZLIB_INTERNAL gz_intmax OF((void)); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif diff --git a/compat/zlib/gzlib.c b/compat/zlib/gzlib.c deleted file mode 100644 index 4105e6a..0000000 --- a/compat/zlib/gzlib.c +++ /dev/null @@ -1,637 +0,0 @@ -/* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2017 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "gzguts.h" - -#if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__) -# define LSEEK _lseeki64 -#else -#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 -# define LSEEK lseek64 -#else -# define LSEEK lseek -#endif -#endif - -/* Local functions */ -local void gz_reset OF((gz_statep)); -local gzFile gz_open OF((const void *, int, const char *)); - -#if defined UNDER_CE - -/* Map the Windows error number in ERROR to a locale-dependent error message - string and return a pointer to it. Typically, the values for ERROR come - from GetLastError. - - The string pointed to shall not be modified by the application, but may be - overwritten by a subsequent call to gz_strwinerror - - The gz_strwinerror function does not change the current setting of - GetLastError. */ -char ZLIB_INTERNAL *gz_strwinerror (error) - DWORD error; -{ - static char buf[1024]; - - wchar_t *msgbuf; - DWORD lasterr = GetLastError(); - DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, - error, - 0, /* Default language */ - (LPVOID)&msgbuf, - 0, - NULL); - if (chars != 0) { - /* If there is an \r\n appended, zap it. */ - if (chars >= 2 - && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { - chars -= 2; - msgbuf[chars] = 0; - } - - if (chars > sizeof (buf) - 1) { - chars = sizeof (buf) - 1; - msgbuf[chars] = 0; - } - - wcstombs(buf, msgbuf, chars + 1); - LocalFree(msgbuf); - } - else { - sprintf(buf, "unknown win32 error (%ld)", error); - } - - SetLastError(lasterr); - return buf; -} - -#endif /* UNDER_CE */ - -/* Reset gzip file state */ -local void gz_reset(state) - gz_statep state; -{ - state->x.have = 0; /* no output data available */ - if (state->mode == GZ_READ) { /* for reading ... */ - state->eof = 0; /* not at end of file */ - state->past = 0; /* have not read past end yet */ - state->how = LOOK; /* look for gzip header */ - } - state->seek = 0; /* no seek request pending */ - gz_error(state, Z_OK, NULL); /* clear error */ - state->x.pos = 0; /* no uncompressed data yet */ - state->strm.avail_in = 0; /* no input data yet */ -} - -/* Open a gzip file either by name or file descriptor. */ -local gzFile gz_open(path, fd, mode) - const void *path; - int fd; - const char *mode; -{ - gz_statep state; - z_size_t len; - int oflag; -#ifdef O_CLOEXEC - int cloexec = 0; -#endif -#ifdef O_EXCL - int exclusive = 0; -#endif - - /* check input */ - if (path == NULL) - return NULL; - - /* allocate gzFile structure to return */ - state = (gz_statep)malloc(sizeof(gz_state)); - if (state == NULL) - return NULL; - state->size = 0; /* no buffers allocated yet */ - state->want = GZBUFSIZE; /* requested buffer size */ - state->msg = NULL; /* no error message yet */ - - /* interpret mode */ - state->mode = GZ_NONE; - state->level = Z_DEFAULT_COMPRESSION; - state->strategy = Z_DEFAULT_STRATEGY; - state->direct = 0; - while (*mode) { - if (*mode >= '0' && *mode <= '9') - state->level = *mode - '0'; - else - switch (*mode) { - case 'r': - state->mode = GZ_READ; - break; -#ifndef NO_GZCOMPRESS - case 'w': - state->mode = GZ_WRITE; - break; - case 'a': - state->mode = GZ_APPEND; - break; -#endif - case '+': /* can't read and write at the same time */ - free(state); - return NULL; - case 'b': /* ignore -- will request binary anyway */ - break; -#ifdef O_CLOEXEC - case 'e': - cloexec = 1; - break; -#endif -#ifdef O_EXCL - case 'x': - exclusive = 1; - break; -#endif - case 'f': - state->strategy = Z_FILTERED; - break; - case 'h': - state->strategy = Z_HUFFMAN_ONLY; - break; - case 'R': - state->strategy = Z_RLE; - break; - case 'F': - state->strategy = Z_FIXED; - break; - case 'T': - state->direct = 1; - break; - default: /* could consider as an error, but just ignore */ - ; - } - mode++; - } - - /* must provide an "r", "w", or "a" */ - if (state->mode == GZ_NONE) { - free(state); - return NULL; - } - - /* can't force transparent read */ - if (state->mode == GZ_READ) { - if (state->direct) { - free(state); - return NULL; - } - state->direct = 1; /* for empty file */ - } - - /* save the path name for error messages */ -#ifdef WIDECHAR - if (fd == -2) { - len = wcstombs(NULL, path, 0); - if (len == (z_size_t)-1) - len = 0; - } - else -#endif - len = strlen((const char *)path); - state->path = (char *)malloc(len + 1); - if (state->path == NULL) { - free(state); - return NULL; - } -#ifdef WIDECHAR - if (fd == -2) - if (len) - wcstombs(state->path, path, len + 1); - else - *(state->path) = 0; - else -#endif -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - (void)snprintf(state->path, len + 1, "%s", (const char *)path); -#else - strcpy(state->path, path); -#endif - - /* compute the flags for open() */ - oflag = -#ifdef O_LARGEFILE - O_LARGEFILE | -#endif -#ifdef O_BINARY - O_BINARY | -#endif -#ifdef O_CLOEXEC - (cloexec ? O_CLOEXEC : 0) | -#endif - (state->mode == GZ_READ ? - O_RDONLY : - (O_WRONLY | O_CREAT | -#ifdef O_EXCL - (exclusive ? O_EXCL : 0) | -#endif - (state->mode == GZ_WRITE ? - O_TRUNC : - O_APPEND))); - - /* open the file with the appropriate flags (or just use fd) */ - state->fd = fd > -1 ? fd : ( -#ifdef WIDECHAR - fd == -2 ? _wopen(path, oflag, 0666) : -#endif - open((const char *)path, oflag, 0666)); - if (state->fd == -1) { - free(state->path); - free(state); - return NULL; - } - if (state->mode == GZ_APPEND) { - LSEEK(state->fd, 0, SEEK_END); /* so gzoffset() is correct */ - state->mode = GZ_WRITE; /* simplify later checks */ - } - - /* save the current position for rewinding (only if reading) */ - if (state->mode == GZ_READ) { - state->start = LSEEK(state->fd, 0, SEEK_CUR); - if (state->start == -1) state->start = 0; - } - - /* initialize stream */ - gz_reset(state); - - /* return stream */ - return (gzFile)state; -} - -/* -- see zlib.h -- */ -gzFile ZEXPORT gzopen(path, mode) - const char *path; - const char *mode; -{ - return gz_open(path, -1, mode); -} - -/* -- see zlib.h -- */ -gzFile ZEXPORT gzopen64(path, mode) - const char *path; - const char *mode; -{ - return gz_open(path, -1, mode); -} - -/* -- see zlib.h -- */ -gzFile ZEXPORT gzdopen(fd, mode) - int fd; - const char *mode; -{ - char *path; /* identifier for error messages */ - gzFile gz; - - if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL) - return NULL; -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - (void)snprintf(path, 7 + 3 * sizeof(int), "", fd); -#else - sprintf(path, "", fd); /* for debugging */ -#endif - gz = gz_open(path, fd, mode); - free(path); - return gz; -} - -/* -- see zlib.h -- */ -#ifdef WIDECHAR -gzFile ZEXPORT gzopen_w(path, mode) - const wchar_t *path; - const char *mode; -{ - return gz_open(path, -2, mode); -} -#endif - -/* -- see zlib.h -- */ -int ZEXPORT gzbuffer(file, size) - gzFile file; - unsigned size; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* make sure we haven't already allocated memory */ - if (state->size != 0) - return -1; - - /* check and set requested size */ - if ((size << 1) < size) - return -1; /* need to be able to double it */ - if (size < 2) - size = 2; /* need two bytes to check magic header */ - state->want = size; - return 0; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzrewind(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* back up and start over */ - if (LSEEK(state->fd, state->start, SEEK_SET) == -1) - return -1; - gz_reset(state); - return 0; -} - -/* -- see zlib.h -- */ -z_off64_t ZEXPORT gzseek64(file, offset, whence) - gzFile file; - z_off64_t offset; - int whence; -{ - unsigned n; - z_off64_t ret; - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* check that there's no error */ - if (state->err != Z_OK && state->err != Z_BUF_ERROR) - return -1; - - /* can only seek from start or relative to current position */ - if (whence != SEEK_SET && whence != SEEK_CUR) - return -1; - - /* normalize offset to a SEEK_CUR specification */ - if (whence == SEEK_SET) - offset -= state->x.pos; - else if (state->seek) - offset += state->skip; - state->seek = 0; - - /* if within raw area while reading, just go there */ - if (state->mode == GZ_READ && state->how == COPY && - state->x.pos + offset >= 0) { - ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); - if (ret == -1) - return -1; - state->x.have = 0; - state->eof = 0; - state->past = 0; - state->seek = 0; - gz_error(state, Z_OK, NULL); - state->strm.avail_in = 0; - state->x.pos += offset; - return state->x.pos; - } - - /* calculate skip amount, rewinding if needed for back seek when reading */ - if (offset < 0) { - if (state->mode != GZ_READ) /* writing -- can't go backwards */ - return -1; - offset += state->x.pos; - if (offset < 0) /* before start of file! */ - return -1; - if (gzrewind(file) == -1) /* rewind, then skip to offset */ - return -1; - } - - /* if reading, skip what's in output buffer (one less gzgetc() check) */ - if (state->mode == GZ_READ) { - n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ? - (unsigned)offset : state->x.have; - state->x.have -= n; - state->x.next += n; - state->x.pos += n; - offset -= n; - } - - /* request skip (if not zero) */ - if (offset) { - state->seek = 1; - state->skip = offset; - } - return state->x.pos + offset; -} - -/* -- see zlib.h -- */ -z_off_t ZEXPORT gzseek(file, offset, whence) - gzFile file; - z_off_t offset; - int whence; -{ - z_off64_t ret; - - ret = gzseek64(file, (z_off64_t)offset, whence); - return ret == (z_off_t)ret ? (z_off_t)ret : -1; -} - -/* -- see zlib.h -- */ -z_off64_t ZEXPORT gztell64(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* return position */ - return state->x.pos + (state->seek ? state->skip : 0); -} - -/* -- see zlib.h -- */ -z_off_t ZEXPORT gztell(file) - gzFile file; -{ - z_off64_t ret; - - ret = gztell64(file); - return ret == (z_off_t)ret ? (z_off_t)ret : -1; -} - -/* -- see zlib.h -- */ -z_off64_t ZEXPORT gzoffset64(file) - gzFile file; -{ - z_off64_t offset; - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* compute and return effective offset in file */ - offset = LSEEK(state->fd, 0, SEEK_CUR); - if (offset == -1) - return -1; - if (state->mode == GZ_READ) /* reading */ - offset -= state->strm.avail_in; /* don't count buffered input */ - return offset; -} - -/* -- see zlib.h -- */ -z_off_t ZEXPORT gzoffset(file) - gzFile file; -{ - z_off64_t ret; - - ret = gzoffset64(file); - return ret == (z_off_t)ret ? (z_off_t)ret : -1; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzeof(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return 0; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return 0; - - /* return end-of-file state */ - return state->mode == GZ_READ ? state->past : 0; -} - -/* -- see zlib.h -- */ -const char * ZEXPORT gzerror(file, errnum) - gzFile file; - int *errnum; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return NULL; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return NULL; - - /* return error information */ - if (errnum != NULL) - *errnum = state->err; - return state->err == Z_MEM_ERROR ? "out of memory" : - (state->msg == NULL ? "" : state->msg); -} - -/* -- see zlib.h -- */ -void ZEXPORT gzclearerr(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return; - - /* clear error and end-of-file */ - if (state->mode == GZ_READ) { - state->eof = 0; - state->past = 0; - } - gz_error(state, Z_OK, NULL); -} - -/* Create an error message in allocated memory and set state->err and - state->msg accordingly. Free any previous error message already there. Do - not try to free or allocate space if the error is Z_MEM_ERROR (out of - memory). Simply save the error message as a static string. If there is an - allocation failure constructing the error message, then convert the error to - out of memory. */ -void ZLIB_INTERNAL gz_error(state, err, msg) - gz_statep state; - int err; - const char *msg; -{ - /* free previously allocated message and clear */ - if (state->msg != NULL) { - if (state->err != Z_MEM_ERROR) - free(state->msg); - state->msg = NULL; - } - - /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */ - if (err != Z_OK && err != Z_BUF_ERROR) - state->x.have = 0; - - /* set error code, and if no message, then done */ - state->err = err; - if (msg == NULL) - return; - - /* for an out of memory error, return literal string when requested */ - if (err == Z_MEM_ERROR) - return; - - /* construct error message with path */ - if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) == - NULL) { - state->err = Z_MEM_ERROR; - return; - } -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - (void)snprintf(state->msg, strlen(state->path) + strlen(msg) + 3, - "%s%s%s", state->path, ": ", msg); -#else - strcpy(state->msg, state->path); - strcat(state->msg, ": "); - strcat(state->msg, msg); -#endif -} - -#ifndef INT_MAX -/* portably return maximum value for an int (when limits.h presumed not - available) -- we need to do this to cover cases where 2's complement not - used, since C standard permits 1's complement and sign-bit representations, - otherwise we could just use ((unsigned)-1) >> 1 */ -unsigned ZLIB_INTERNAL gz_intmax() -{ - unsigned p, q; - - p = 1; - do { - q = p; - p <<= 1; - p++; - } while (p > q); - return q >> 1; -} -#endif diff --git a/compat/zlib/gzread.c b/compat/zlib/gzread.c deleted file mode 100644 index 956b91e..0000000 --- a/compat/zlib/gzread.c +++ /dev/null @@ -1,654 +0,0 @@ -/* gzread.c -- zlib functions for reading gzip files - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "gzguts.h" - -/* Local functions */ -local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *)); -local int gz_avail OF((gz_statep)); -local int gz_look OF((gz_statep)); -local int gz_decomp OF((gz_statep)); -local int gz_fetch OF((gz_statep)); -local int gz_skip OF((gz_statep, z_off64_t)); -local z_size_t gz_read OF((gz_statep, voidp, z_size_t)); - -/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from - state->fd, and update state->eof, state->err, and state->msg as appropriate. - This function needs to loop on read(), since read() is not guaranteed to - read the number of bytes requested, depending on the type of descriptor. */ -local int gz_load(state, buf, len, have) - gz_statep state; - unsigned char *buf; - unsigned len; - unsigned *have; -{ - int ret; - unsigned get, max = ((unsigned)-1 >> 2) + 1; - - *have = 0; - do { - get = len - *have; - if (get > max) - get = max; - ret = read(state->fd, buf + *have, get); - if (ret <= 0) - break; - *have += (unsigned)ret; - } while (*have < len); - if (ret < 0) { - gz_error(state, Z_ERRNO, zstrerror()); - return -1; - } - if (ret == 0) - state->eof = 1; - return 0; -} - -/* Load up input buffer and set eof flag if last data loaded -- return -1 on - error, 0 otherwise. Note that the eof flag is set when the end of the input - file is reached, even though there may be unused data in the buffer. Once - that data has been used, no more attempts will be made to read the file. - If strm->avail_in != 0, then the current data is moved to the beginning of - the input buffer, and then the remainder of the buffer is loaded with the - available data from the input file. */ -local int gz_avail(state) - gz_statep state; -{ - unsigned got; - z_streamp strm = &(state->strm); - - if (state->err != Z_OK && state->err != Z_BUF_ERROR) - return -1; - if (state->eof == 0) { - if (strm->avail_in) { /* copy what's there to the start */ - unsigned char *p = state->in; - unsigned const char *q = strm->next_in; - unsigned n = strm->avail_in; - do { - *p++ = *q++; - } while (--n); - } - if (gz_load(state, state->in + strm->avail_in, - state->size - strm->avail_in, &got) == -1) - return -1; - strm->avail_in += got; - strm->next_in = state->in; - } - return 0; -} - -/* Look for gzip header, set up for inflate or copy. state->x.have must be 0. - If this is the first time in, allocate required memory. state->how will be - left unchanged if there is no more input data available, will be set to COPY - if there is no gzip header and direct copying will be performed, or it will - be set to GZIP for decompression. If direct copying, then leftover input - data from the input buffer will be copied to the output buffer. In that - case, all further file reads will be directly to either the output buffer or - a user buffer. If decompressing, the inflate state will be initialized. - gz_look() will return 0 on success or -1 on failure. */ -local int gz_look(state) - gz_statep state; -{ - z_streamp strm = &(state->strm); - - /* allocate read buffers and inflate memory */ - if (state->size == 0) { - /* allocate buffers */ - state->in = (unsigned char *)malloc(state->want); - state->out = (unsigned char *)malloc(state->want << 1); - if (state->in == NULL || state->out == NULL) { - free(state->out); - free(state->in); - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - state->size = state->want; - - /* allocate inflate memory */ - state->strm.zalloc = Z_NULL; - state->strm.zfree = Z_NULL; - state->strm.opaque = Z_NULL; - state->strm.avail_in = 0; - state->strm.next_in = Z_NULL; - if (inflateInit2(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */ - free(state->out); - free(state->in); - state->size = 0; - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - } - - /* get at least the magic bytes in the input buffer */ - if (strm->avail_in < 2) { - if (gz_avail(state) == -1) - return -1; - if (strm->avail_in == 0) - return 0; - } - - /* look for gzip magic bytes -- if there, do gzip decoding (note: there is - a logical dilemma here when considering the case of a partially written - gzip file, to wit, if a single 31 byte is written, then we cannot tell - whether this is a single-byte file, or just a partially written gzip - file -- for here we assume that if a gzip file is being written, then - the header will be written in a single operation, so that reading a - single byte is sufficient indication that it is not a gzip file) */ - if (strm->avail_in > 1 && - strm->next_in[0] == 31 && strm->next_in[1] == 139) { - inflateReset(strm); - state->how = GZIP; - state->direct = 0; - return 0; - } - - /* no gzip header -- if we were decoding gzip before, then this is trailing - garbage. Ignore the trailing garbage and finish. */ - if (state->direct == 0) { - strm->avail_in = 0; - state->eof = 1; - state->x.have = 0; - return 0; - } - - /* doing raw i/o, copy any leftover input to output -- this assumes that - the output buffer is larger than the input buffer, which also assures - space for gzungetc() */ - state->x.next = state->out; - if (strm->avail_in) { - memcpy(state->x.next, strm->next_in, strm->avail_in); - state->x.have = strm->avail_in; - strm->avail_in = 0; - } - state->how = COPY; - state->direct = 1; - return 0; -} - -/* Decompress from input to the provided next_out and avail_out in the state. - On return, state->x.have and state->x.next point to the just decompressed - data. If the gzip stream completes, state->how is reset to LOOK to look for - the next gzip stream or raw data, once state->x.have is depleted. Returns 0 - on success, -1 on failure. */ -local int gz_decomp(state) - gz_statep state; -{ - int ret = Z_OK; - unsigned had; - z_streamp strm = &(state->strm); - - /* fill output buffer up to end of deflate stream */ - had = strm->avail_out; - do { - /* get more input for inflate() */ - if (strm->avail_in == 0 && gz_avail(state) == -1) - return -1; - if (strm->avail_in == 0) { - gz_error(state, Z_BUF_ERROR, "unexpected end of file"); - break; - } - - /* decompress and handle errors */ - ret = inflate(strm, Z_NO_FLUSH); - if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) { - gz_error(state, Z_STREAM_ERROR, - "internal error: inflate stream corrupt"); - return -1; - } - if (ret == Z_MEM_ERROR) { - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - if (ret == Z_DATA_ERROR) { /* deflate stream invalid */ - gz_error(state, Z_DATA_ERROR, - strm->msg == NULL ? "compressed data error" : strm->msg); - return -1; - } - } while (strm->avail_out && ret != Z_STREAM_END); - - /* update available output */ - state->x.have = had - strm->avail_out; - state->x.next = strm->next_out - state->x.have; - - /* if the gzip stream completed successfully, look for another */ - if (ret == Z_STREAM_END) - state->how = LOOK; - - /* good decompression */ - return 0; -} - -/* Fetch data and put it in the output buffer. Assumes state->x.have is 0. - Data is either copied from the input file or decompressed from the input - file depending on state->how. If state->how is LOOK, then a gzip header is - looked for to determine whether to copy or decompress. Returns -1 on error, - otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the - end of the input file has been reached and all data has been processed. */ -local int gz_fetch(state) - gz_statep state; -{ - z_streamp strm = &(state->strm); - - do { - switch(state->how) { - case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */ - if (gz_look(state) == -1) - return -1; - if (state->how == LOOK) - return 0; - break; - case COPY: /* -> COPY */ - if (gz_load(state, state->out, state->size << 1, &(state->x.have)) - == -1) - return -1; - state->x.next = state->out; - return 0; - case GZIP: /* -> GZIP or LOOK (if end of gzip stream) */ - strm->avail_out = state->size << 1; - strm->next_out = state->out; - if (gz_decomp(state) == -1) - return -1; - } - } while (state->x.have == 0 && (!state->eof || strm->avail_in)); - return 0; -} - -/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */ -local int gz_skip(state, len) - gz_statep state; - z_off64_t len; -{ - unsigned n; - - /* skip over len bytes or reach end-of-file, whichever comes first */ - while (len) - /* skip over whatever is in output buffer */ - if (state->x.have) { - n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ? - (unsigned)len : state->x.have; - state->x.have -= n; - state->x.next += n; - state->x.pos += n; - len -= n; - } - - /* output buffer empty -- return if we're at the end of the input */ - else if (state->eof && state->strm.avail_in == 0) - break; - - /* need more data to skip -- load up output buffer */ - else { - /* get more output, looking for header if required */ - if (gz_fetch(state) == -1) - return -1; - } - return 0; -} - -/* Read len bytes into buf from file, or less than len up to the end of the - input. Return the number of bytes read. If zero is returned, either the - end of file was reached, or there was an error. state->err must be - consulted in that case to determine which. */ -local z_size_t gz_read(state, buf, len) - gz_statep state; - voidp buf; - z_size_t len; -{ - z_size_t got; - unsigned n; - - /* if len is zero, avoid unnecessary operations */ - if (len == 0) - return 0; - - /* process a skip request */ - if (state->seek) { - state->seek = 0; - if (gz_skip(state, state->skip) == -1) - return 0; - } - - /* get len bytes to buf, or less than len if at the end */ - got = 0; - do { - /* set n to the maximum amount of len that fits in an unsigned int */ - n = -1; - if (n > len) - n = len; - - /* first just try copying data from the output buffer */ - if (state->x.have) { - if (state->x.have < n) - n = state->x.have; - memcpy(buf, state->x.next, n); - state->x.next += n; - state->x.have -= n; - } - - /* output buffer empty -- return if we're at the end of the input */ - else if (state->eof && state->strm.avail_in == 0) { - state->past = 1; /* tried to read past end */ - break; - } - - /* need output data -- for small len or new stream load up our output - buffer */ - else if (state->how == LOOK || n < (state->size << 1)) { - /* get more output, looking for header if required */ - if (gz_fetch(state) == -1) - return 0; - continue; /* no progress yet -- go back to copy above */ - /* the copy above assures that we will leave with space in the - output buffer, allowing at least one gzungetc() to succeed */ - } - - /* large len -- read directly into user buffer */ - else if (state->how == COPY) { /* read directly */ - if (gz_load(state, (unsigned char *)buf, n, &n) == -1) - return 0; - } - - /* large len -- decompress directly into user buffer */ - else { /* state->how == GZIP */ - state->strm.avail_out = n; - state->strm.next_out = (unsigned char *)buf; - if (gz_decomp(state) == -1) - return 0; - n = state->x.have; - state->x.have = 0; - } - - /* update progress */ - len -= n; - buf = (char *)buf + n; - got += n; - state->x.pos += n; - } while (len); - - /* return number of bytes read into user buffer */ - return got; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzread(file, buf, len) - gzFile file; - voidp buf; - unsigned len; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* since an int is returned, make sure len fits in one, otherwise return - with an error (this avoids a flaw in the interface) */ - if ((int)len < 0) { - gz_error(state, Z_STREAM_ERROR, "request does not fit in an int"); - return -1; - } - - /* read len or fewer bytes to buf */ - len = gz_read(state, buf, len); - - /* check for an error */ - if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR) - return -1; - - /* return the number of bytes read (this is assured to fit in an int) */ - return (int)len; -} - -/* -- see zlib.h -- */ -z_size_t ZEXPORT gzfread(buf, size, nitems, file) - voidp buf; - z_size_t size; - z_size_t nitems; - gzFile file; -{ - z_size_t len; - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return 0; - state = (gz_statep)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return 0; - - /* compute bytes to read -- error on overflow */ - len = nitems * size; - if (size && len / size != nitems) { - gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t"); - return 0; - } - - /* read len or fewer bytes to buf, return the number of full items read */ - return len ? gz_read(state, buf, len) / size : 0; -} - -/* -- see zlib.h -- */ -#ifdef Z_PREFIX_SET -# undef z_gzgetc -#else -# undef gzgetc -#endif -int ZEXPORT gzgetc(file) - gzFile file; -{ - int ret; - unsigned char buf[1]; - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* try output buffer (no need to check for skip request) */ - if (state->x.have) { - state->x.have--; - state->x.pos++; - return *(state->x.next)++; - } - - /* nothing there -- try gz_read() */ - ret = gz_read(state, buf, 1); - return ret < 1 ? -1 : buf[0]; -} - -int ZEXPORT gzgetc_(file) -gzFile file; -{ - return gzgetc(file); -} - -/* -- see zlib.h -- */ -int ZEXPORT gzungetc(c, file) - int c; - gzFile file; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* process a skip request */ - if (state->seek) { - state->seek = 0; - if (gz_skip(state, state->skip) == -1) - return -1; - } - - /* can't push EOF */ - if (c < 0) - return -1; - - /* if output buffer empty, put byte at end (allows more pushing) */ - if (state->x.have == 0) { - state->x.have = 1; - state->x.next = state->out + (state->size << 1) - 1; - state->x.next[0] = (unsigned char)c; - state->x.pos--; - state->past = 0; - return c; - } - - /* if no room, give up (must have already done a gzungetc()) */ - if (state->x.have == (state->size << 1)) { - gz_error(state, Z_DATA_ERROR, "out of room to push characters"); - return -1; - } - - /* slide output data if needed and insert byte before existing data */ - if (state->x.next == state->out) { - unsigned char *src = state->out + state->x.have; - unsigned char *dest = state->out + (state->size << 1); - while (src > state->out) - *--dest = *--src; - state->x.next = dest; - } - state->x.have++; - state->x.next--; - state->x.next[0] = (unsigned char)c; - state->x.pos--; - state->past = 0; - return c; -} - -/* -- see zlib.h -- */ -char * ZEXPORT gzgets(file, buf, len) - gzFile file; - char *buf; - int len; -{ - unsigned left, n; - char *str; - unsigned char *eol; - gz_statep state; - - /* check parameters and get internal structure */ - if (file == NULL || buf == NULL || len < 1) - return NULL; - state = (gz_statep)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return NULL; - - /* process a skip request */ - if (state->seek) { - state->seek = 0; - if (gz_skip(state, state->skip) == -1) - return NULL; - } - - /* copy output bytes up to new line or len - 1, whichever comes first -- - append a terminating zero to the string (we don't check for a zero in - the contents, let the user worry about that) */ - str = buf; - left = (unsigned)len - 1; - if (left) do { - /* assure that something is in the output buffer */ - if (state->x.have == 0 && gz_fetch(state) == -1) - return NULL; /* error */ - if (state->x.have == 0) { /* end of file */ - state->past = 1; /* read past end */ - break; /* return what we have */ - } - - /* look for end-of-line in current output buffer */ - n = state->x.have > left ? left : state->x.have; - eol = (unsigned char *)memchr(state->x.next, '\n', n); - if (eol != NULL) - n = (unsigned)(eol - state->x.next) + 1; - - /* copy through end-of-line, or remainder if not found */ - memcpy(buf, state->x.next, n); - state->x.have -= n; - state->x.next += n; - state->x.pos += n; - left -= n; - buf += n; - } while (left && eol == NULL); - - /* return terminated string, or if nothing, end of file */ - if (buf == str) - return NULL; - buf[0] = 0; - return str; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzdirect(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return 0; - state = (gz_statep)file; - - /* if the state is not known, but we can find out, then do so (this is - mainly for right after a gzopen() or gzdopen()) */ - if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0) - (void)gz_look(state); - - /* return 1 if transparent, 0 if processing a gzip stream */ - return state->direct; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzclose_r(file) - gzFile file; -{ - int ret, err; - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - - /* check that we're reading */ - if (state->mode != GZ_READ) - return Z_STREAM_ERROR; - - /* free memory and close file */ - if (state->size) { - inflateEnd(&(state->strm)); - free(state->out); - free(state->in); - } - err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK; - gz_error(state, Z_OK, NULL); - free(state->path); - ret = close(state->fd); - free(state); - return ret ? Z_ERRNO : err; -} diff --git a/compat/zlib/gzwrite.c b/compat/zlib/gzwrite.c deleted file mode 100644 index c7b5651..0000000 --- a/compat/zlib/gzwrite.c +++ /dev/null @@ -1,665 +0,0 @@ -/* gzwrite.c -- zlib functions for writing gzip files - * Copyright (C) 2004-2017 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "gzguts.h" - -/* Local functions */ -local int gz_init OF((gz_statep)); -local int gz_comp OF((gz_statep, int)); -local int gz_zero OF((gz_statep, z_off64_t)); -local z_size_t gz_write OF((gz_statep, voidpc, z_size_t)); - -/* Initialize state for writing a gzip file. Mark initialization by setting - state->size to non-zero. Return -1 on a memory allocation failure, or 0 on - success. */ -local int gz_init(state) - gz_statep state; -{ - int ret; - z_streamp strm = &(state->strm); - - /* allocate input buffer (double size for gzprintf) */ - state->in = (unsigned char *)malloc(state->want << 1); - if (state->in == NULL) { - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - - /* only need output buffer and deflate state if compressing */ - if (!state->direct) { - /* allocate output buffer */ - state->out = (unsigned char *)malloc(state->want); - if (state->out == NULL) { - free(state->in); - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - - /* allocate deflate memory, set up for gzip compression */ - strm->zalloc = Z_NULL; - strm->zfree = Z_NULL; - strm->opaque = Z_NULL; - ret = deflateInit2(strm, state->level, Z_DEFLATED, - MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy); - if (ret != Z_OK) { - free(state->out); - free(state->in); - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - strm->next_in = NULL; - } - - /* mark state as initialized */ - state->size = state->want; - - /* initialize write buffer if compressing */ - if (!state->direct) { - strm->avail_out = state->size; - strm->next_out = state->out; - state->x.next = strm->next_out; - } - return 0; -} - -/* Compress whatever is at avail_in and next_in and write to the output file. - Return -1 if there is an error writing to the output file or if gz_init() - fails to allocate memory, otherwise 0. flush is assumed to be a valid - deflate() flush value. If flush is Z_FINISH, then the deflate() state is - reset to start a new gzip stream. If gz->direct is true, then simply write - to the output file without compressing, and ignore flush. */ -local int gz_comp(state, flush) - gz_statep state; - int flush; -{ - int ret, writ; - unsigned have, put, max = ((unsigned)-1 >> 2) + 1; - z_streamp strm = &(state->strm); - - /* allocate memory if this is the first time through */ - if (state->size == 0 && gz_init(state) == -1) - return -1; - - /* write directly if requested */ - if (state->direct) { - while (strm->avail_in) { - put = strm->avail_in > max ? max : strm->avail_in; - writ = write(state->fd, strm->next_in, put); - if (writ < 0) { - gz_error(state, Z_ERRNO, zstrerror()); - return -1; - } - strm->avail_in -= (unsigned)writ; - strm->next_in += writ; - } - return 0; - } - - /* run deflate() on provided input until it produces no more output */ - ret = Z_OK; - do { - /* write out current buffer contents if full, or if flushing, but if - doing Z_FINISH then don't write until we get to Z_STREAM_END */ - if (strm->avail_out == 0 || (flush != Z_NO_FLUSH && - (flush != Z_FINISH || ret == Z_STREAM_END))) { - while (strm->next_out > state->x.next) { - put = strm->next_out - state->x.next > (int)max ? max : - (unsigned)(strm->next_out - state->x.next); - writ = write(state->fd, state->x.next, put); - if (writ < 0) { - gz_error(state, Z_ERRNO, zstrerror()); - return -1; - } - state->x.next += writ; - } - if (strm->avail_out == 0) { - strm->avail_out = state->size; - strm->next_out = state->out; - state->x.next = state->out; - } - } - - /* compress */ - have = strm->avail_out; - ret = deflate(strm, flush); - if (ret == Z_STREAM_ERROR) { - gz_error(state, Z_STREAM_ERROR, - "internal error: deflate stream corrupt"); - return -1; - } - have -= strm->avail_out; - } while (have); - - /* if that completed a deflate stream, allow another to start */ - if (flush == Z_FINISH) - deflateReset(strm); - - /* all done, no errors */ - return 0; -} - -/* Compress len zeros to output. Return -1 on a write error or memory - allocation failure by gz_comp(), or 0 on success. */ -local int gz_zero(state, len) - gz_statep state; - z_off64_t len; -{ - int first; - unsigned n; - z_streamp strm = &(state->strm); - - /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return -1; - - /* compress len zeros (len guaranteed > 0) */ - first = 1; - while (len) { - n = GT_OFF(state->size) || (z_off64_t)state->size > len ? - (unsigned)len : state->size; - if (first) { - memset(state->in, 0, n); - first = 0; - } - strm->avail_in = n; - strm->next_in = state->in; - state->x.pos += n; - if (gz_comp(state, Z_NO_FLUSH) == -1) - return -1; - len -= n; - } - return 0; -} - -/* Write len bytes from buf to file. Return the number of bytes written. If - the returned value is less than len, then there was an error. */ -local z_size_t gz_write(state, buf, len) - gz_statep state; - voidpc buf; - z_size_t len; -{ - z_size_t put = len; - - /* if len is zero, avoid unnecessary operations */ - if (len == 0) - return 0; - - /* allocate memory if this is the first time through */ - if (state->size == 0 && gz_init(state) == -1) - return 0; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return 0; - } - - /* for small len, copy to input buffer, otherwise compress directly */ - if (len < state->size) { - /* copy to input buffer, compress when full */ - do { - unsigned have, copy; - - if (state->strm.avail_in == 0) - state->strm.next_in = state->in; - have = (unsigned)((state->strm.next_in + state->strm.avail_in) - - state->in); - copy = state->size - have; - if (copy > len) - copy = len; - memcpy(state->in + have, buf, copy); - state->strm.avail_in += copy; - state->x.pos += copy; - buf = (const char *)buf + copy; - len -= copy; - if (len && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - } while (len); - } - else { - /* consume whatever's left in the input buffer */ - if (state->strm.avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - - /* directly compress user buffer to file */ - state->strm.next_in = (z_const Bytef *)buf; - do { - unsigned n = (unsigned)-1; - if (n > len) - n = len; - state->strm.avail_in = n; - state->x.pos += n; - if (gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - len -= n; - } while (len); - } - - /* input was all buffered or compressed */ - return put; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzwrite(file, buf, len) - gzFile file; - voidpc buf; - unsigned len; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return 0; - state = (gz_statep)file; - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; - - /* since an int is returned, make sure len fits in one, otherwise return - with an error (this avoids a flaw in the interface) */ - if ((int)len < 0) { - gz_error(state, Z_DATA_ERROR, "requested length does not fit in int"); - return 0; - } - - /* write len bytes from buf (the return value will fit in an int) */ - return (int)gz_write(state, buf, len); -} - -/* -- see zlib.h -- */ -z_size_t ZEXPORT gzfwrite(buf, size, nitems, file) - voidpc buf; - z_size_t size; - z_size_t nitems; - gzFile file; -{ - z_size_t len; - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return 0; - state = (gz_statep)file; - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; - - /* compute bytes to read -- error on overflow */ - len = nitems * size; - if (size && len / size != nitems) { - gz_error(state, Z_STREAM_ERROR, "request does not fit in a size_t"); - return 0; - } - - /* write len bytes to buf, return the number of full items written */ - return len ? gz_write(state, buf, len) / size : 0; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzputc(file, c) - gzFile file; - int c; -{ - unsigned have; - unsigned char buf[1]; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return -1; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return -1; - } - - /* try writing to input buffer for speed (state->size == 0 if buffer not - initialized) */ - if (state->size) { - if (strm->avail_in == 0) - strm->next_in = state->in; - have = (unsigned)((strm->next_in + strm->avail_in) - state->in); - if (have < state->size) { - state->in[have] = (unsigned char)c; - strm->avail_in++; - state->x.pos++; - return c & 0xff; - } - } - - /* no room in buffer or not initialized, use gz_write() */ - buf[0] = (unsigned char)c; - if (gz_write(state, buf, 1) != 1) - return -1; - return c & 0xff; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzputs(file, str) - gzFile file; - const char *str; -{ - int ret; - z_size_t len; - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return -1; - - /* write string */ - len = strlen(str); - ret = gz_write(state, str, len); - return ret == 0 && len != 0 ? -1 : ret; -} - -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -#include - -/* -- see zlib.h -- */ -int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) -{ - int len; - unsigned left; - char *next; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return Z_STREAM_ERROR; - - /* make sure we have some buffer space */ - if (state->size == 0 && gz_init(state) == -1) - return state->err; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return state->err; - } - - /* do the printf() into the input buffer, put length in len -- the input - buffer is double-sized just for this function, so there is guaranteed to - be state->size bytes available after the current contents */ - if (strm->avail_in == 0) - strm->next_in = state->in; - next = (char *)(state->in + (strm->next_in - state->in) + strm->avail_in); - next[state->size - 1] = 0; -#ifdef NO_vsnprintf -# ifdef HAS_vsprintf_void - (void)vsprintf(next, format, va); - for (len = 0; len < state->size; len++) - if (next[len] == 0) break; -# else - len = vsprintf(next, format, va); -# endif -#else -# ifdef HAS_vsnprintf_void - (void)vsnprintf(next, state->size, format, va); - len = strlen(next); -# else - len = vsnprintf(next, state->size, format, va); -# endif -#endif - - /* check that printf() results fit in buffer */ - if (len == 0 || (unsigned)len >= state->size || next[state->size - 1] != 0) - return 0; - - /* update buffer and position, compress first half if past that */ - strm->avail_in += (unsigned)len; - state->x.pos += len; - if (strm->avail_in >= state->size) { - left = strm->avail_in - state->size; - strm->avail_in = state->size; - if (gz_comp(state, Z_NO_FLUSH) == -1) - return state->err; - memcpy(state->in, state->in + state->size, left); - strm->next_in = state->in; - strm->avail_in = left; - } - return len; -} - -int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) -{ - va_list va; - int ret; - - va_start(va, format); - ret = gzvprintf(file, format, va); - va_end(va); - return ret; -} - -#else /* !STDC && !Z_HAVE_STDARG_H */ - -/* -- see zlib.h -- */ -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) - gzFile file; - const char *format; - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; -{ - unsigned len, left; - char *next; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that can really pass pointer in ints */ - if (sizeof(int) != sizeof(void *)) - return Z_STREAM_ERROR; - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return Z_STREAM_ERROR; - - /* make sure we have some buffer space */ - if (state->size == 0 && gz_init(state) == -1) - return state->error; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return state->error; - } - - /* do the printf() into the input buffer, put length in len -- the input - buffer is double-sized just for this function, so there is guaranteed to - be state->size bytes available after the current contents */ - if (strm->avail_in == 0) - strm->next_in = state->in; - next = (char *)(strm->next_in + strm->avail_in); - next[state->size - 1] = 0; -#ifdef NO_snprintf -# ifdef HAS_sprintf_void - sprintf(next, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, - a13, a14, a15, a16, a17, a18, a19, a20); - for (len = 0; len < size; len++) - if (next[len] == 0) - break; -# else - len = sprintf(next, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, - a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#else -# ifdef HAS_snprintf_void - snprintf(next, state->size, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, - a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - len = strlen(next); -# else - len = snprintf(next, state->size, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#endif - - /* check that printf() results fit in buffer */ - if (len == 0 || len >= state->size || next[state->size - 1] != 0) - return 0; - - /* update buffer and position, compress first half if past that */ - strm->avail_in += len; - state->x.pos += len; - if (strm->avail_in >= state->size) { - left = strm->avail_in - state->size; - strm->avail_in = state->size; - if (gz_comp(state, Z_NO_FLUSH) == -1) - return state->err; - memcpy(state->in, state->in + state->size, left); - strm->next_in = state->in; - strm->avail_in = left; - } - return (int)len; -} - -#endif - -/* -- see zlib.h -- */ -int ZEXPORT gzflush(file, flush) - gzFile file; - int flush; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return Z_STREAM_ERROR; - - /* check flush parameter */ - if (flush < 0 || flush > Z_FINISH) - return Z_STREAM_ERROR; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return state->err; - } - - /* compress remaining data with requested flush */ - (void)gz_comp(state, flush); - return state->err; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzsetparams(file, level, strategy) - gzFile file; - int level; - int strategy; -{ - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return Z_STREAM_ERROR; - - /* if no change is requested, then do nothing */ - if (level == state->level && strategy == state->strategy) - return Z_OK; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return state->err; - } - - /* change compression parameters for subsequent input */ - if (state->size) { - /* flush previous input with previous parameters before changing */ - if (strm->avail_in && gz_comp(state, Z_BLOCK) == -1) - return state->err; - deflateParams(strm, level, strategy); - } - state->level = level; - state->strategy = strategy; - return Z_OK; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzclose_w(file) - gzFile file; -{ - int ret = Z_OK; - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - - /* check that we're writing */ - if (state->mode != GZ_WRITE) - return Z_STREAM_ERROR; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - ret = state->err; - } - - /* flush, free memory, and close file */ - if (gz_comp(state, Z_FINISH) == -1) - ret = state->err; - if (state->size) { - if (!state->direct) { - (void)deflateEnd(&(state->strm)); - free(state->out); - } - free(state->in); - } - gz_error(state, Z_OK, NULL); - free(state->path); - if (close(state->fd) == -1) - ret = Z_ERRNO; - free(state); - return ret; -} diff --git a/compat/zlib/infback.c b/compat/zlib/infback.c deleted file mode 100644 index 59679ec..0000000 --- a/compat/zlib/infback.c +++ /dev/null @@ -1,640 +0,0 @@ -/* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - This code is largely copied from inflate.c. Normally either infback.o or - inflate.o would be linked into an application--not both. The interface - with inffast.c is retained so that optimized assembler-coded versions of - inflate_fast() can be used with either inflate.c or infback.c. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); - -/* - strm provides memory allocation functions in zalloc and zfree, or - Z_NULL to use the library memory allocation functions. - - windowBits is in the range 8..15, and window is a user-supplied - window and output buffer that is 2**windowBits bytes. - */ -int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) -z_streamp strm; -int windowBits; -unsigned char FAR *window; -const char *version; -int stream_size; -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL || window == Z_NULL || - windowBits < 8 || windowBits > 15) - return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; -#endif - } - if (strm->zfree == (free_func)0) -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zfree = zcfree; -#endif - state = (struct inflate_state FAR *)ZALLOC(strm, 1, - sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - state->dmax = 32768U; - state->wbits = (uInt)windowBits; - state->wsize = 1U << windowBits; - state->window = window; - state->wnext = 0; - state->whave = 0; - return Z_OK; -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -/* Macros for inflateBack(): */ - -/* Load returned state from inflate_fast() */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Set state from registers for inflate_fast() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Assure that some input is available. If input is requested, but denied, - then return a Z_BUF_ERROR from inflateBack(). */ -#define PULL() \ - do { \ - if (have == 0) { \ - have = in(in_desc, &next); \ - if (have == 0) { \ - next = Z_NULL; \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflateBack() - with an error if there is no input available. */ -#define PULLBYTE() \ - do { \ - PULL(); \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflateBack() with - an error. */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Assure that some output space is available, by writing out the window - if it's full. If the write fails, return from inflateBack() with a - Z_BUF_ERROR. */ -#define ROOM() \ - do { \ - if (left == 0) { \ - put = state->window; \ - left = state->wsize; \ - state->whave = left; \ - if (out(out_desc, put, left)) { \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* - strm provides the memory allocation functions and window buffer on input, - and provides information on the unused input on return. For Z_DATA_ERROR - returns, strm will also provide an error message. - - in() and out() are the call-back input and output functions. When - inflateBack() needs more input, it calls in(). When inflateBack() has - filled the window with output, or when it completes with data in the - window, it calls out() to write out the data. The application must not - change the provided input until in() is called again or inflateBack() - returns. The application must not change the window/output buffer until - inflateBack() returns. - - in() and out() are called with a descriptor parameter provided in the - inflateBack() call. This parameter can be a structure that provides the - information required to do the read or write, as well as accumulated - information on the input and output such as totals and check values. - - in() should return zero on failure. out() should return non-zero on - failure. If either in() or out() fails, than inflateBack() returns a - Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it - was in() or out() that caused in the error. Otherwise, inflateBack() - returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format - error, or Z_MEM_ERROR if it could not allocate memory for the state. - inflateBack() can also return Z_STREAM_ERROR if the input parameters - are not correct, i.e. strm is Z_NULL or the state was not initialized. - */ -int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) -z_streamp strm; -in_func in; -void FAR *in_desc; -out_func out; -void FAR *out_desc; -{ - struct inflate_state FAR *state; - z_const unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code here; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - /* Check that the strm exists and that the state was initialized */ - if (strm == Z_NULL || strm->state == Z_NULL) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* Reset the state */ - strm->msg = Z_NULL; - state->mode = TYPE; - state->last = 0; - state->whave = 0; - next = strm->next_in; - have = next != Z_NULL ? strm->avail_in : 0; - hold = 0; - bits = 0; - put = state->window; - left = state->wsize; - - /* Inflate until end of block marked as last */ - for (;;) - switch (state->mode) { - case TYPE: - /* determine and dispatch block type */ - if (state->last) { - BYTEBITS(); - state->mode = DONE; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - - case STORED: - /* get and verify stored block length */ - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - - /* copy stored block from input to output */ - while (state->length != 0) { - copy = state->length; - PULL(); - ROOM(); - if (copy > have) copy = have; - if (copy > left) copy = left; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - - case TABLE: - /* get dynamic table entries descriptor */ - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - - /* get code length code lengths (not a typo) */ - state->have = 0; - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - - /* get length and distance code code lengths */ - state->have = 0; - while (state->have < state->nlen + state->ndist) { - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.val < 16) { - DROPBITS(here.bits); - state->lens[state->have++] = here.val; - } - else { - if (here.val == 16) { - NEEDBITS(here.bits + 2); - DROPBITS(here.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = (unsigned)(state->lens[state->have - 1]); - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (here.val == 17) { - NEEDBITS(here.bits + 3); - DROPBITS(here.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(here.bits + 7); - DROPBITS(here.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* check for end-of-block code (better have one) */ - if (state->lens[256] == 0) { - strm->msg = (char *)"invalid code -- missing end-of-block"; - state->mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - - case LEN: - /* use inflate_fast() if we have enough input and output */ - if (have >= 6 && left >= 258) { - RESTORE(); - if (state->whave < state->wsize) - state->whave = state->wsize - left; - inflate_fast(strm, state->wsize); - LOAD(); - break; - } - - /* get a literal, length, or end-of-block code */ - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.op && (here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(here.bits); - state->length = (unsigned)here.val; - - /* process literal */ - if (here.op == 0) { - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - ROOM(); - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - } - - /* process end of block */ - if (here.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - - /* invalid code */ - if (here.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - - /* length code -- get extra bits, if any */ - state->extra = (unsigned)(here.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - - /* get distance code */ - for (;;) { - here = state->distcode[BITS(state->distbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if ((here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(here.bits); - if (here.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)here.val; - - /* get distance extra bits, if any */ - state->extra = (unsigned)(here.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } - if (state->offset > state->wsize - (state->whave < state->wsize ? - left : 0)) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - - /* copy match from window to output */ - do { - ROOM(); - copy = state->wsize - state->offset; - if (copy < left) { - from = put + copy; - copy = left - copy; - } - else { - from = put - state->offset; - copy = left; - } - if (copy > state->length) copy = state->length; - state->length -= copy; - left -= copy; - do { - *put++ = *from++; - } while (--copy); - } while (state->length != 0); - break; - - case DONE: - /* inflate stream terminated properly -- write leftover output */ - ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } - goto inf_leave; - - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - - default: /* can't happen, but makes compilers happy */ - ret = Z_STREAM_ERROR; - goto inf_leave; - } - - /* Return unused input */ - inf_leave: - strm->next_in = next; - strm->avail_in = have; - return ret; -} - -int ZEXPORT inflateBackEnd(strm) -z_streamp strm; -{ - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} diff --git a/compat/zlib/inffast.c b/compat/zlib/inffast.c deleted file mode 100644 index 0dbd1db..0000000 --- a/compat/zlib/inffast.c +++ /dev/null @@ -1,323 +0,0 @@ -/* inffast.c -- fast decoding - * Copyright (C) 1995-2017 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifdef ASMINF -# pragma message("Assembler code may have bugs -- use at your own risk") -#else - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state->mode == LEN - strm->avail_in >= 6 - strm->avail_out >= 258 - start >= strm->avail_out - state->bits < 8 - - On return, state->mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm->avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm->avail_out >= 258 for each loop to avoid checking for - output space. - */ -void ZLIB_INTERNAL inflate_fast(strm, start) -z_streamp strm; -unsigned start; /* inflate()'s starting value for strm->avail_out */ -{ - struct inflate_state FAR *state; - z_const unsigned char FAR *in; /* local strm->next_in */ - z_const unsigned char FAR *last; /* have enough input while in < last */ - unsigned char FAR *out; /* local strm->next_out */ - unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ - unsigned char FAR *end; /* while out < end, enough space available */ -#ifdef INFLATE_STRICT - unsigned dmax; /* maximum distance from zlib header */ -#endif - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned wnext; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ - unsigned long hold; /* local strm->hold */ - unsigned bits; /* local strm->bits */ - code const FAR *lcode; /* local strm->lencode */ - code const FAR *dcode; /* local strm->distcode */ - unsigned lmask; /* mask for first level of length codes */ - unsigned dmask; /* mask for first level of distance codes */ - code here; /* retrieved table entry */ - unsigned op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - unsigned len; /* match length, unused bytes */ - unsigned dist; /* match distance */ - unsigned char FAR *from; /* where to copy match from */ - - /* copy state to local variables */ - state = (struct inflate_state FAR *)strm->state; - in = strm->next_in; - last = in + (strm->avail_in - 5); - out = strm->next_out; - beg = out - (start - strm->avail_out); - end = out + (strm->avail_out - 257); -#ifdef INFLATE_STRICT - dmax = state->dmax; -#endif - wsize = state->wsize; - whave = state->whave; - wnext = state->wnext; - window = state->window; - hold = state->hold; - bits = state->bits; - lcode = state->lencode; - dcode = state->distcode; - lmask = (1U << state->lenbits) - 1; - dmask = (1U << state->distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - do { - if (bits < 15) { - hold += (unsigned long)(*in++) << bits; - bits += 8; - hold += (unsigned long)(*in++) << bits; - bits += 8; - } - here = lcode[hold & lmask]; - dolen: - op = (unsigned)(here.bits); - hold >>= op; - bits -= op; - op = (unsigned)(here.op); - if (op == 0) { /* literal */ - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - *out++ = (unsigned char)(here.val); - } - else if (op & 16) { /* length base */ - len = (unsigned)(here.val); - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += (unsigned long)(*in++) << bits; - bits += 8; - } - len += (unsigned)hold & ((1U << op) - 1); - hold >>= op; - bits -= op; - } - Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += (unsigned long)(*in++) << bits; - bits += 8; - hold += (unsigned long)(*in++) << bits; - bits += 8; - } - here = dcode[hold & dmask]; - dodist: - op = (unsigned)(here.bits); - hold >>= op; - bits -= op; - op = (unsigned)(here.op); - if (op & 16) { /* distance base */ - dist = (unsigned)(here.val); - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += (unsigned long)(*in++) << bits; - bits += 8; - if (bits < op) { - hold += (unsigned long)(*in++) << bits; - bits += 8; - } - } - dist += (unsigned)hold & ((1U << op) - 1); -#ifdef INFLATE_STRICT - if (dist > dmax) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - hold >>= op; - bits -= op; - Tracevv((stderr, "inflate: distance %u\n", dist)); - op = (unsigned)(out - beg); /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - if (state->sane) { - strm->msg = - (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - if (len <= op - whave) { - do { - *out++ = 0; - } while (--len); - continue; - } - len -= op - whave; - do { - *out++ = 0; - } while (--op > whave); - if (op == 0) { - from = out - dist; - do { - *out++ = *from++; - } while (--len); - continue; - } -#endif - } - from = window; - if (wnext == 0) { /* very common case */ - from += wsize - op; - if (op < len) { /* some from window */ - len -= op; - do { - *out++ = *from++; - } while (--op); - from = out - dist; /* rest from output */ - } - } - else if (wnext < op) { /* wrap around window */ - from += wsize + wnext - op; - op -= wnext; - if (op < len) { /* some from end of window */ - len -= op; - do { - *out++ = *from++; - } while (--op); - from = window; - if (wnext < len) { /* some from start of window */ - op = wnext; - len -= op; - do { - *out++ = *from++; - } while (--op); - from = out - dist; /* rest from output */ - } - } - } - else { /* contiguous in window */ - from += wnext - op; - if (op < len) { /* some from window */ - len -= op; - do { - *out++ = *from++; - } while (--op); - from = out - dist; /* rest from output */ - } - } - while (len > 2) { - *out++ = *from++; - *out++ = *from++; - *out++ = *from++; - len -= 3; - } - if (len) { - *out++ = *from++; - if (len > 1) - *out++ = *from++; - } - } - else { - from = out - dist; /* copy direct from output */ - do { /* minimum length is three */ - *out++ = *from++; - *out++ = *from++; - *out++ = *from++; - len -= 3; - } while (len > 2); - if (len) { - *out++ = *from++; - if (len > 1) - *out++ = *from++; - } - } - } - else if ((op & 64) == 0) { /* 2nd level distance code */ - here = dcode[here.val + (hold & ((1U << op) - 1))]; - goto dodist; - } - else { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - } - else if ((op & 64) == 0) { /* 2nd level length code */ - here = lcode[here.val + (hold & ((1U << op) - 1))]; - goto dolen; - } - else if (op & 32) { /* end-of-block */ - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - else { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - } while (in < last && out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - in -= len; - bits -= len << 3; - hold &= (1U << bits) - 1; - - /* update state and return */ - strm->next_in = in; - strm->next_out = out; - strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); - strm->avail_out = (unsigned)(out < end ? - 257 + (end - out) : 257 - (out - end)); - state->hold = hold; - state->bits = bits; - return; -} - -/* - inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): - - Using bit fields for code structure - - Different op definition to avoid & for extra bits (do & for table bits) - - Three separate decoding do-loops for direct, window, and wnext == 0 - - Special case for distance > 1 copies to do overlapped load and store copy - - Explicit branch predictions (based on measured branch probabilities) - - Deferring match copy and interspersed it with decoding subsequent codes - - Swapping literal/length else - - Swapping window/direct else - - Larger unrolled copy loops (three is about right) - - Moving len -= 3 statement into middle of loop - */ - -#endif /* !ASMINF */ diff --git a/compat/zlib/inffast.h b/compat/zlib/inffast.h deleted file mode 100644 index e5c1aa4..0000000 --- a/compat/zlib/inffast.h +++ /dev/null @@ -1,11 +0,0 @@ -/* inffast.h -- header to use inffast.c - * Copyright (C) 1995-2003, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/compat/zlib/inffixed.h b/compat/zlib/inffixed.h deleted file mode 100644 index d628327..0000000 --- a/compat/zlib/inffixed.h +++ /dev/null @@ -1,94 +0,0 @@ - /* inffixed.h -- table for decoding fixed codes - * Generated automatically by makefixed(). - */ - - /* WARNING: this file should *not* be used by applications. - It is part of the implementation of this library and is - subject to change. Applications should only use zlib.h. - */ - - static const code lenfix[512] = { - {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, - {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, - {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, - {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, - {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, - {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, - {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, - {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, - {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, - {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, - {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, - {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, - {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, - {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, - {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, - {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, - {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, - {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, - {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, - {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, - {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, - {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, - {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, - {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, - {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, - {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, - {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, - {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, - {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, - {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, - {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, - {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, - {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, - {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, - {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, - {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, - {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, - {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, - {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, - {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, - {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, - {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, - {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, - {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, - {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, - {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, - {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, - {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, - {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, - {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, - {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, - {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, - {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, - {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, - {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, - {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, - {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, - {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, - {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, - {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, - {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, - {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, - {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, - {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, - {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, - {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, - {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, - {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, - {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, - {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, - {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, - {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, - {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, - {0,9,255} - }; - - static const code distfix[32] = { - {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, - {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, - {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, - {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, - {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, - {22,5,193},{64,5,0} - }; diff --git a/compat/zlib/inflate.c b/compat/zlib/inflate.c deleted file mode 100644 index ac333e8..0000000 --- a/compat/zlib/inflate.c +++ /dev/null @@ -1,1561 +0,0 @@ -/* inflate.c -- zlib decompression - * Copyright (C) 1995-2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * Change history: - * - * 1.2.beta0 24 Nov 2002 - * - First version -- complete rewrite of inflate to simplify code, avoid - * creation of window when not needed, minimize use of window when it is - * needed, make inffast.c even faster, implement gzip decoding, and to - * improve code readability and style over the previous zlib inflate code - * - * 1.2.beta1 25 Nov 2002 - * - Use pointers for available input and output checking in inffast.c - * - Remove input and output counters in inffast.c - * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 - * - Remove unnecessary second byte pull from length extra in inffast.c - * - Unroll direct copy to three copies per loop in inffast.c - * - * 1.2.beta2 4 Dec 2002 - * - Change external routine names to reduce potential conflicts - * - Correct filename to inffixed.h for fixed tables in inflate.c - * - Make hbuf[] unsigned char to match parameter type in inflate.c - * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) - * to avoid negation problem on Alphas (64 bit) in inflate.c - * - * 1.2.beta3 22 Dec 2002 - * - Add comments on state->bits assertion in inffast.c - * - Add comments on op field in inftrees.h - * - Fix bug in reuse of allocated window after inflateReset() - * - Remove bit fields--back to byte structure for speed - * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths - * - Change post-increments to pre-increments in inflate_fast(), PPC biased? - * - Add compile time option, POSTINC, to use post-increments instead (Intel?) - * - Make MATCH copy in inflate() much faster for when inflate_fast() not used - * - Use local copies of stream next and avail values, as well as local bit - * buffer and bit count in inflate()--for speed when inflate_fast() not used - * - * 1.2.beta4 1 Jan 2003 - * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings - * - Move a comment on output buffer sizes from inffast.c to inflate.c - * - Add comments in inffast.c to introduce the inflate_fast() routine - * - Rearrange window copies in inflate_fast() for speed and simplification - * - Unroll last copy for window match in inflate_fast() - * - Use local copies of window variables in inflate_fast() for speed - * - Pull out common wnext == 0 case for speed in inflate_fast() - * - Make op and len in inflate_fast() unsigned for consistency - * - Add FAR to lcode and dcode declarations in inflate_fast() - * - Simplified bad distance check in inflate_fast() - * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new - * source file infback.c to provide a call-back interface to inflate for - * programs like gzip and unzip -- uses window as output buffer to avoid - * window copying - * - * 1.2.beta5 1 Jan 2003 - * - Improved inflateBack() interface to allow the caller to provide initial - * input in strm. - * - Fixed stored blocks bug in inflateBack() - * - * 1.2.beta6 4 Jan 2003 - * - Added comments in inffast.c on effectiveness of POSTINC - * - Typecasting all around to reduce compiler warnings - * - Changed loops from while (1) or do {} while (1) to for (;;), again to - * make compilers happy - * - Changed type of window in inflateBackInit() to unsigned char * - * - * 1.2.beta7 27 Jan 2003 - * - Changed many types to unsigned or unsigned short to avoid warnings - * - Added inflateCopy() function - * - * 1.2.0 9 Mar 2003 - * - Changed inflateBack() interface to provide separate opaque descriptors - * for the in() and out() functions - * - Changed inflateBack() argument and in_func typedef to swap the length - * and buffer address return values for the input function - * - Check next_in and next_out for Z_NULL on entry to inflate() - * - * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifdef MAKEFIXED -# ifndef BUILDFIXED -# define BUILDFIXED -# endif -#endif - -/* function prototypes */ -local int inflateStateCheck OF((z_streamp strm)); -local void fixedtables OF((struct inflate_state FAR *state)); -local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, - unsigned copy)); -#ifdef BUILDFIXED - void makefixed OF((void)); -#endif -local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf, - unsigned len)); - -local int inflateStateCheck(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - if (strm == Z_NULL || - strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) - return 1; - state = (struct inflate_state FAR *)strm->state; - if (state == Z_NULL || state->strm != strm || - state->mode < HEAD || state->mode > SYNC) - return 1; - return 0; -} - -int ZEXPORT inflateResetKeep(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (inflateStateCheck(strm)) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - strm->total_in = strm->total_out = state->total = 0; - strm->msg = Z_NULL; - if (state->wrap) /* to support ill-conceived Java test suite */ - strm->adler = state->wrap & 1; - state->mode = HEAD; - state->last = 0; - state->havedict = 0; - state->dmax = 32768U; - state->head = Z_NULL; - state->hold = 0; - state->bits = 0; - state->lencode = state->distcode = state->next = state->codes; - state->sane = 1; - state->back = -1; - Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -int ZEXPORT inflateReset(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (inflateStateCheck(strm)) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - state->wsize = 0; - state->whave = 0; - state->wnext = 0; - return inflateResetKeep(strm); -} - -int ZEXPORT inflateReset2(strm, windowBits) -z_streamp strm; -int windowBits; -{ - int wrap; - struct inflate_state FAR *state; - - /* get the state */ - if (inflateStateCheck(strm)) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* extract wrap request from windowBits parameter */ - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } - else { - wrap = (windowBits >> 4) + 5; -#ifdef GUNZIP - if (windowBits < 48) - windowBits &= 15; -#endif - } - - /* set number of window bits, free window if different */ - if (windowBits && (windowBits < 8 || windowBits > 15)) - return Z_STREAM_ERROR; - if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { - ZFREE(strm, state->window); - state->window = Z_NULL; - } - - /* update state and reset the rest of it */ - state->wrap = wrap; - state->wbits = (unsigned)windowBits; - return inflateReset(strm); -} - -int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) -z_streamp strm; -int windowBits; -const char *version; -int stream_size; -{ - int ret; - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL) return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; -#endif - } - if (strm->zfree == (free_func)0) -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zfree = zcfree; -#endif - state = (struct inflate_state FAR *) - ZALLOC(strm, 1, sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - state->strm = strm; - state->window = Z_NULL; - state->mode = HEAD; /* to pass state test in inflateReset2() */ - ret = inflateReset2(strm, windowBits); - if (ret != Z_OK) { - ZFREE(strm, state); - strm->state = Z_NULL; - } - return ret; -} - -int ZEXPORT inflateInit_(strm, version, stream_size) -z_streamp strm; -const char *version; -int stream_size; -{ - return inflateInit2_(strm, DEF_WBITS, version, stream_size); -} - -int ZEXPORT inflatePrime(strm, bits, value) -z_streamp strm; -int bits; -int value; -{ - struct inflate_state FAR *state; - - if (inflateStateCheck(strm)) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (bits < 0) { - state->hold = 0; - state->bits = 0; - return Z_OK; - } - if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR; - value &= (1L << bits) - 1; - state->hold += (unsigned)value << state->bits; - state->bits += (uInt)bits; - return Z_OK; -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -#ifdef MAKEFIXED -#include - -/* - Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also - defines BUILDFIXED, so the tables are built on the fly. makefixed() writes - those tables to stdout, which would be piped to inffixed.h. A small program - can simply call makefixed to do this: - - void makefixed(void); - - int main(void) - { - makefixed(); - return 0; - } - - Then that can be linked with zlib built with MAKEFIXED defined and run: - - a.out > inffixed.h - */ -void makefixed() -{ - unsigned low, size; - struct inflate_state state; - - fixedtables(&state); - puts(" /* inffixed.h -- table for decoding fixed codes"); - puts(" * Generated automatically by makefixed()."); - puts(" */"); - puts(""); - puts(" /* WARNING: this file should *not* be used by applications."); - puts(" It is part of the implementation of this library and is"); - puts(" subject to change. Applications should only use zlib.h."); - puts(" */"); - puts(""); - size = 1U << 9; - printf(" static const code lenfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 7) == 0) printf("\n "); - printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op, - state.lencode[low].bits, state.lencode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); - size = 1U << 5; - printf("\n static const code distfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 6) == 0) printf("\n "); - printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, - state.distcode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); -} -#endif /* MAKEFIXED */ - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -local int updatewindow(strm, end, copy) -z_streamp strm; -const Bytef *end; -unsigned copy; -{ - struct inflate_state FAR *state; - unsigned dist; - - state = (struct inflate_state FAR *)strm->state; - - /* if it hasn't been done already, allocate space for the window */ - if (state->window == Z_NULL) { - state->window = (unsigned char FAR *) - ZALLOC(strm, 1U << state->wbits, - sizeof(unsigned char)); - if (state->window == Z_NULL) return 1; - } - - /* if window not in use yet, initialize */ - if (state->wsize == 0) { - state->wsize = 1U << state->wbits; - state->wnext = 0; - state->whave = 0; - } - - /* copy state->wsize or less output bytes into the circular window */ - if (copy >= state->wsize) { - zmemcpy(state->window, end - state->wsize, state->wsize); - state->wnext = 0; - state->whave = state->wsize; - } - else { - dist = state->wsize - state->wnext; - if (dist > copy) dist = copy; - zmemcpy(state->window + state->wnext, end - copy, dist); - copy -= dist; - if (copy) { - zmemcpy(state->window, end - copy, copy); - state->wnext = copy; - state->whave = state->wsize; - } - else { - state->wnext += dist; - if (state->wnext == state->wsize) state->wnext = 0; - if (state->whave < state->wsize) state->whave += dist; - } - } - return 0; -} - -/* Macros for inflate(): */ - -/* check function to use adler32() for zlib or crc32() for gzip */ -#ifdef GUNZIP -# define UPDATE(check, buf, len) \ - (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) -#else -# define UPDATE(check, buf, len) adler32(check, buf, len) -#endif - -/* check macros for header crc */ -#ifdef GUNZIP -# define CRC2(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - check = crc32(check, hbuf, 2); \ - } while (0) - -# define CRC4(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - hbuf[2] = (unsigned char)((word) >> 16); \ - hbuf[3] = (unsigned char)((word) >> 24); \ - check = crc32(check, hbuf, 4); \ - } while (0) -#endif - -/* Load registers with state in inflate() for speed */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Restore state from registers in inflate() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflate() - if there is no input available. */ -#define PULLBYTE() \ - do { \ - if (have == 0) goto inf_leave; \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflate(). */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* - inflate() uses a state machine to process as much input data and generate as - much output data as possible before returning. The state machine is - structured roughly as follows: - - for (;;) switch (state) { - ... - case STATEn: - if (not enough input data or output space to make progress) - return; - ... make progress ... - state = STATEm; - break; - ... - } - - so when inflate() is called again, the same case is attempted again, and - if the appropriate resources are provided, the machine proceeds to the - next state. The NEEDBITS() macro is usually the way the state evaluates - whether it can proceed or should return. NEEDBITS() does the return if - the requested bits are not available. The typical use of the BITS macros - is: - - NEEDBITS(n); - ... do something with BITS(n) ... - DROPBITS(n); - - where NEEDBITS(n) either returns from inflate() if there isn't enough - input left to load n bits into the accumulator, or it continues. BITS(n) - gives the low n bits in the accumulator. When done, DROPBITS(n) drops - the low n bits off the accumulator. INITBITS() clears the accumulator - and sets the number of available bits to zero. BYTEBITS() discards just - enough bits to put the accumulator on a byte boundary. After BYTEBITS() - and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. - - NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return - if there is no input available. The decoding of variable length codes uses - PULLBYTE() directly in order to pull just enough bytes to decode the next - code, and no more. - - Some states loop until they get enough input, making sure that enough - state information is maintained to continue the loop where it left off - if NEEDBITS() returns in the loop. For example, want, need, and keep - would all have to actually be part of the saved state in case NEEDBITS() - returns: - - case STATEw: - while (want < need) { - NEEDBITS(n); - keep[want++] = BITS(n); - DROPBITS(n); - } - state = STATEx; - case STATEx: - - As shown above, if the next state is also the next case, then the break - is omitted. - - A state may also return if there is not enough output space available to - complete that state. Those states are copying stored data, writing a - literal byte, and copying a matching string. - - When returning, a "goto inf_leave" is used to update the total counters, - update the check value, and determine whether any progress has been made - during that inflate() call in order to return the proper return code. - Progress is defined as a change in either strm->avail_in or strm->avail_out. - When there is a window, goto inf_leave will update the window with the last - output written. If a goto inf_leave occurs in the middle of decompression - and there is no window currently, goto inf_leave will create one and copy - output to the window for the next call of inflate(). - - In this implementation, the flush parameter of inflate() only affects the - return code (per zlib.h). inflate() always writes as much as possible to - strm->next_out, given the space available and the provided input--the effect - documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers - the allocation of and copying into a sliding window until necessary, which - provides the effect documented in zlib.h for Z_FINISH when the entire input - stream available. So the only thing the flush parameter actually does is: - when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it - will return Z_BUF_ERROR if it has not reached the end of the stream. - */ - -int ZEXPORT inflate(strm, flush) -z_streamp strm; -int flush; -{ - struct inflate_state FAR *state; - z_const unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned in, out; /* save starting available input and output */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code here; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ -#ifdef GUNZIP - unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ -#endif - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - if (inflateStateCheck(strm) || strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0)) - return Z_STREAM_ERROR; - - state = (struct inflate_state FAR *)strm->state; - if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ - LOAD(); - in = have; - out = left; - ret = Z_OK; - for (;;) - switch (state->mode) { - case HEAD: - if (state->wrap == 0) { - state->mode = TYPEDO; - break; - } - NEEDBITS(16); -#ifdef GUNZIP - if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ - if (state->wbits == 0) - state->wbits = 15; - state->check = crc32(0L, Z_NULL, 0); - CRC2(state->check, hold); - INITBITS(); - state->mode = FLAGS; - break; - } - state->flags = 0; /* expect zlib header */ - if (state->head != Z_NULL) - state->head->done = -1; - if (!(state->wrap & 1) || /* check if zlib header allowed */ -#else - if ( -#endif - ((BITS(8) << 8) + (hold >> 8)) % 31) { - strm->msg = (char *)"incorrect header check"; - state->mode = BAD; - break; - } - if (BITS(4) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - DROPBITS(4); - len = BITS(4) + 8; - if (state->wbits == 0) - state->wbits = len; - if (len > 15 || len > state->wbits) { - strm->msg = (char *)"invalid window size"; - state->mode = BAD; - break; - } - state->dmax = 1U << len; - Tracev((stderr, "inflate: zlib header ok\n")); - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = hold & 0x200 ? DICTID : TYPE; - INITBITS(); - break; -#ifdef GUNZIP - case FLAGS: - NEEDBITS(16); - state->flags = (int)(hold); - if ((state->flags & 0xff) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - if (state->flags & 0xe000) { - strm->msg = (char *)"unknown header flags set"; - state->mode = BAD; - break; - } - if (state->head != Z_NULL) - state->head->text = (int)((hold >> 8) & 1); - if ((state->flags & 0x0200) && (state->wrap & 4)) - CRC2(state->check, hold); - INITBITS(); - state->mode = TIME; - case TIME: - NEEDBITS(32); - if (state->head != Z_NULL) - state->head->time = hold; - if ((state->flags & 0x0200) && (state->wrap & 4)) - CRC4(state->check, hold); - INITBITS(); - state->mode = OS; - case OS: - NEEDBITS(16); - if (state->head != Z_NULL) { - state->head->xflags = (int)(hold & 0xff); - state->head->os = (int)(hold >> 8); - } - if ((state->flags & 0x0200) && (state->wrap & 4)) - CRC2(state->check, hold); - INITBITS(); - state->mode = EXLEN; - case EXLEN: - if (state->flags & 0x0400) { - NEEDBITS(16); - state->length = (unsigned)(hold); - if (state->head != Z_NULL) - state->head->extra_len = (unsigned)hold; - if ((state->flags & 0x0200) && (state->wrap & 4)) - CRC2(state->check, hold); - INITBITS(); - } - else if (state->head != Z_NULL) - state->head->extra = Z_NULL; - state->mode = EXTRA; - case EXTRA: - if (state->flags & 0x0400) { - copy = state->length; - if (copy > have) copy = have; - if (copy) { - if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; - zmemcpy(state->head->extra + len, next, - len + copy > state->head->extra_max ? - state->head->extra_max - len : copy); - } - if ((state->flags & 0x0200) && (state->wrap & 4)) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - state->length -= copy; - } - if (state->length) goto inf_leave; - } - state->length = 0; - state->mode = NAME; - case NAME: - if (state->flags & 0x0800) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != Z_NULL && - state->head->name != Z_NULL && - state->length < state->head->name_max) - state->head->name[state->length++] = (Bytef)len; - } while (len && copy < have); - if ((state->flags & 0x0200) && (state->wrap & 4)) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - else if (state->head != Z_NULL) - state->head->name = Z_NULL; - state->length = 0; - state->mode = COMMENT; - case COMMENT: - if (state->flags & 0x1000) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != Z_NULL && - state->head->comment != Z_NULL && - state->length < state->head->comm_max) - state->head->comment[state->length++] = (Bytef)len; - } while (len && copy < have); - if ((state->flags & 0x0200) && (state->wrap & 4)) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - else if (state->head != Z_NULL) - state->head->comment = Z_NULL; - state->mode = HCRC; - case HCRC: - if (state->flags & 0x0200) { - NEEDBITS(16); - if ((state->wrap & 4) && hold != (state->check & 0xffff)) { - strm->msg = (char *)"header crc mismatch"; - state->mode = BAD; - break; - } - INITBITS(); - } - if (state->head != Z_NULL) { - state->head->hcrc = (int)((state->flags >> 9) & 1); - state->head->done = 1; - } - strm->adler = state->check = crc32(0L, Z_NULL, 0); - state->mode = TYPE; - break; -#endif - case DICTID: - NEEDBITS(32); - strm->adler = state->check = ZSWAP32(hold); - INITBITS(); - state->mode = DICT; - case DICT: - if (state->havedict == 0) { - RESTORE(); - return Z_NEED_DICT; - } - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = TYPE; - case TYPE: - if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; - case TYPEDO: - if (state->last) { - BYTEBITS(); - state->mode = CHECK; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN_; /* decode codes */ - if (flush == Z_TREES) { - DROPBITS(2); - goto inf_leave; - } - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - case STORED: - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - state->mode = COPY_; - if (flush == Z_TREES) goto inf_leave; - case COPY_: - state->mode = COPY; - case COPY: - copy = state->length; - if (copy) { - if (copy > have) copy = have; - if (copy > left) copy = left; - if (copy == 0) goto inf_leave; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - break; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - case TABLE: - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - state->have = 0; - state->mode = LENLENS; - case LENLENS: - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (const code FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - state->have = 0; - state->mode = CODELENS; - case CODELENS: - while (state->have < state->nlen + state->ndist) { - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.val < 16) { - DROPBITS(here.bits); - state->lens[state->have++] = here.val; - } - else { - if (here.val == 16) { - NEEDBITS(here.bits + 2); - DROPBITS(here.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = state->lens[state->have - 1]; - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (here.val == 17) { - NEEDBITS(here.bits + 3); - DROPBITS(here.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(here.bits + 7); - DROPBITS(here.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* check for end-of-block code (better have one) */ - if (state->lens[256] == 0) { - strm->msg = (char *)"invalid code -- missing end-of-block"; - state->mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state->next = state->codes; - state->lencode = (const code FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (const code FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN_; - if (flush == Z_TREES) goto inf_leave; - case LEN_: - state->mode = LEN; - case LEN: - if (have >= 6 && left >= 258) { - RESTORE(); - inflate_fast(strm, out); - LOAD(); - if (state->mode == TYPE) - state->back = -1; - break; - } - state->back = 0; - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.op && (here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - state->back += last.bits; - } - DROPBITS(here.bits); - state->back += here.bits; - state->length = (unsigned)here.val; - if ((int)(here.op) == 0) { - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - state->mode = LIT; - break; - } - if (here.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->back = -1; - state->mode = TYPE; - break; - } - if (here.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - state->extra = (unsigned)(here.op) & 15; - state->mode = LENEXT; - case LENEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - state->back += state->extra; - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - state->was = state->length; - state->mode = DIST; - case DIST: - for (;;) { - here = state->distcode[BITS(state->distbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if ((here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - state->back += last.bits; - } - DROPBITS(here.bits); - state->back += here.bits; - if (here.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)here.val; - state->extra = (unsigned)(here.op) & 15; - state->mode = DISTEXT; - case DISTEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - state->back += state->extra; - } -#ifdef INFLATE_STRICT - if (state->offset > state->dmax) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - state->mode = MATCH; - case MATCH: - if (left == 0) goto inf_leave; - copy = out - left; - if (state->offset > copy) { /* copy from window */ - copy = state->offset - copy; - if (copy > state->whave) { - if (state->sane) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - Trace((stderr, "inflate.c too far\n")); - copy -= state->whave; - if (copy > state->length) copy = state->length; - if (copy > left) copy = left; - left -= copy; - state->length -= copy; - do { - *put++ = 0; - } while (--copy); - if (state->length == 0) state->mode = LEN; - break; -#endif - } - if (copy > state->wnext) { - copy -= state->wnext; - from = state->window + (state->wsize - copy); - } - else - from = state->window + (state->wnext - copy); - if (copy > state->length) copy = state->length; - } - else { /* copy from output */ - from = put - state->offset; - copy = state->length; - } - if (copy > left) copy = left; - left -= copy; - state->length -= copy; - do { - *put++ = *from++; - } while (--copy); - if (state->length == 0) state->mode = LEN; - break; - case LIT: - if (left == 0) goto inf_leave; - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - case CHECK: - if (state->wrap) { - NEEDBITS(32); - out -= left; - strm->total_out += out; - state->total += out; - if ((state->wrap & 4) && out) - strm->adler = state->check = - UPDATE(state->check, put - out, out); - out = left; - if ((state->wrap & 4) && ( -#ifdef GUNZIP - state->flags ? hold : -#endif - ZSWAP32(hold)) != state->check) { - strm->msg = (char *)"incorrect data check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: check matches trailer\n")); - } -#ifdef GUNZIP - state->mode = LENGTH; - case LENGTH: - if (state->wrap && state->flags) { - NEEDBITS(32); - if (hold != (state->total & 0xffffffffUL)) { - strm->msg = (char *)"incorrect length check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: length matches trailer\n")); - } -#endif - state->mode = DONE; - case DONE: - ret = Z_STREAM_END; - goto inf_leave; - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - default: - return Z_STREAM_ERROR; - } - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - inf_leave: - RESTORE(); - if (state->wsize || (out != strm->avail_out && state->mode < BAD && - (state->mode < CHECK || flush != Z_FINISH))) - if (updatewindow(strm, strm->next_out, out - strm->avail_out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - in -= strm->avail_in; - out -= strm->avail_out; - strm->total_in += in; - strm->total_out += out; - state->total += out; - if ((state->wrap & 4) && out) - strm->adler = state->check = - UPDATE(state->check, strm->next_out - out, out); - strm->data_type = (int)state->bits + (state->last ? 64 : 0) + - (state->mode == TYPE ? 128 : 0) + - (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); - if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) - ret = Z_BUF_ERROR; - return ret; -} - -int ZEXPORT inflateEnd(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - if (inflateStateCheck(strm)) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->window != Z_NULL) ZFREE(strm, state->window); - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} - -int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength) -z_streamp strm; -Bytef *dictionary; -uInt *dictLength; -{ - struct inflate_state FAR *state; - - /* check state */ - if (inflateStateCheck(strm)) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* copy dictionary */ - if (state->whave && dictionary != Z_NULL) { - zmemcpy(dictionary, state->window + state->wnext, - state->whave - state->wnext); - zmemcpy(dictionary + state->whave - state->wnext, - state->window, state->wnext); - } - if (dictLength != Z_NULL) - *dictLength = state->whave; - return Z_OK; -} - -int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) -z_streamp strm; -const Bytef *dictionary; -uInt dictLength; -{ - struct inflate_state FAR *state; - unsigned long dictid; - int ret; - - /* check state */ - if (inflateStateCheck(strm)) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->wrap != 0 && state->mode != DICT) - return Z_STREAM_ERROR; - - /* check for correct dictionary identifier */ - if (state->mode == DICT) { - dictid = adler32(0L, Z_NULL, 0); - dictid = adler32(dictid, dictionary, dictLength); - if (dictid != state->check) - return Z_DATA_ERROR; - } - - /* copy dictionary to window using updatewindow(), which will amend the - existing dictionary if appropriate */ - ret = updatewindow(strm, dictionary + dictLength, dictLength); - if (ret) { - state->mode = MEM; - return Z_MEM_ERROR; - } - state->havedict = 1; - Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} - -int ZEXPORT inflateGetHeader(strm, head) -z_streamp strm; -gz_headerp head; -{ - struct inflate_state FAR *state; - - /* check state */ - if (inflateStateCheck(strm)) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; - - /* save header structure */ - state->head = head; - head->done = 0; - return Z_OK; -} - -/* - Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found - or when out of input. When called, *have is the number of pattern bytes - found in order so far, in 0..3. On return *have is updated to the new - state. If on return *have equals four, then the pattern was found and the - return value is how many bytes were read including the last byte of the - pattern. If *have is less than four, then the pattern has not been found - yet and the return value is len. In the latter case, syncsearch() can be - called again with more data and the *have state. *have is initialized to - zero for the first call. - */ -local unsigned syncsearch(have, buf, len) -unsigned FAR *have; -const unsigned char FAR *buf; -unsigned len; -{ - unsigned got; - unsigned next; - - got = *have; - next = 0; - while (next < len && got < 4) { - if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) - got++; - else if (buf[next]) - got = 0; - else - got = 4 - got; - next++; - } - *have = got; - return next; -} - -int ZEXPORT inflateSync(strm) -z_streamp strm; -{ - unsigned len; /* number of bytes to look at or looked at */ - unsigned long in, out; /* temporary to save total_in and total_out */ - unsigned char buf[4]; /* to restore bit buffer to byte string */ - struct inflate_state FAR *state; - - /* check parameters */ - if (inflateStateCheck(strm)) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; - - /* if first time, start search in bit buffer */ - if (state->mode != SYNC) { - state->mode = SYNC; - state->hold <<= state->bits & 7; - state->bits -= state->bits & 7; - len = 0; - while (state->bits >= 8) { - buf[len++] = (unsigned char)(state->hold); - state->hold >>= 8; - state->bits -= 8; - } - state->have = 0; - syncsearch(&(state->have), buf, len); - } - - /* search available input */ - len = syncsearch(&(state->have), strm->next_in, strm->avail_in); - strm->avail_in -= len; - strm->next_in += len; - strm->total_in += len; - - /* return no joy or set up to restart inflate() on a new block */ - if (state->have != 4) return Z_DATA_ERROR; - in = strm->total_in; out = strm->total_out; - inflateReset(strm); - strm->total_in = in; strm->total_out = out; - state->mode = TYPE; - return Z_OK; -} - -/* - Returns true if inflate is currently at the end of a block generated by - Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP - implementation to provide an additional safety check. PPP uses - Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored - block. When decompressing, PPP checks that at the end of input packet, - inflate is waiting for these length bytes. - */ -int ZEXPORT inflateSyncPoint(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (inflateStateCheck(strm)) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - return state->mode == STORED && state->bits == 0; -} - -int ZEXPORT inflateCopy(dest, source) -z_streamp dest; -z_streamp source; -{ - struct inflate_state FAR *state; - struct inflate_state FAR *copy; - unsigned char FAR *window; - unsigned wsize; - - /* check input */ - if (inflateStateCheck(source) || dest == Z_NULL) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)source->state; - - /* allocate space */ - copy = (struct inflate_state FAR *) - ZALLOC(source, 1, sizeof(struct inflate_state)); - if (copy == Z_NULL) return Z_MEM_ERROR; - window = Z_NULL; - if (state->window != Z_NULL) { - window = (unsigned char FAR *) - ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); - if (window == Z_NULL) { - ZFREE(source, copy); - return Z_MEM_ERROR; - } - } - - /* copy state */ - zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); - zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state)); - copy->strm = dest; - if (state->lencode >= state->codes && - state->lencode <= state->codes + ENOUGH - 1) { - copy->lencode = copy->codes + (state->lencode - state->codes); - copy->distcode = copy->codes + (state->distcode - state->codes); - } - copy->next = copy->codes + (state->next - state->codes); - if (window != Z_NULL) { - wsize = 1U << state->wbits; - zmemcpy(window, state->window, wsize); - } - copy->window = window; - dest->state = (struct internal_state FAR *)copy; - return Z_OK; -} - -int ZEXPORT inflateUndermine(strm, subvert) -z_streamp strm; -int subvert; -{ - struct inflate_state FAR *state; - - if (inflateStateCheck(strm)) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - state->sane = !subvert; - return Z_OK; -#else - (void)subvert; - state->sane = 1; - return Z_DATA_ERROR; -#endif -} - -int ZEXPORT inflateValidate(strm, check) -z_streamp strm; -int check; -{ - struct inflate_state FAR *state; - - if (inflateStateCheck(strm)) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (check) - state->wrap |= 4; - else - state->wrap &= ~4; - return Z_OK; -} - -long ZEXPORT inflateMark(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (inflateStateCheck(strm)) - return -(1L << 16); - state = (struct inflate_state FAR *)strm->state; - return (long)(((unsigned long)((long)state->back)) << 16) + - (state->mode == COPY ? state->length : - (state->mode == MATCH ? state->was - state->length : 0)); -} - -unsigned long ZEXPORT inflateCodesUsed(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - if (inflateStateCheck(strm)) return (unsigned long)-1; - state = (struct inflate_state FAR *)strm->state; - return (unsigned long)(state->next - state->codes); -} diff --git a/compat/zlib/inflate.h b/compat/zlib/inflate.h deleted file mode 100644 index a46cce6..0000000 --- a/compat/zlib/inflate.h +++ /dev/null @@ -1,125 +0,0 @@ -/* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer decoding by inflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip decoding - should be left enabled. */ -#ifndef NO_GZIP -# define GUNZIP -#endif - -/* Possible inflate modes between inflate() calls */ -typedef enum { - HEAD = 16180, /* i: waiting for magic header */ - FLAGS, /* i: waiting for method and flags (gzip) */ - TIME, /* i: waiting for modification time (gzip) */ - OS, /* i: waiting for extra flags and operating system (gzip) */ - EXLEN, /* i: waiting for extra length (gzip) */ - EXTRA, /* i: waiting for extra bytes (gzip) */ - NAME, /* i: waiting for end of file name (gzip) */ - COMMENT, /* i: waiting for end of comment (gzip) */ - HCRC, /* i: waiting for header crc (gzip) */ - DICTID, /* i: waiting for dictionary check value */ - DICT, /* waiting for inflateSetDictionary() call */ - TYPE, /* i: waiting for type bits, including last-flag bit */ - TYPEDO, /* i: same, but skip check to exit inflate on new block */ - STORED, /* i: waiting for stored size (length and complement) */ - COPY_, /* i/o: same as COPY below, but only first time in */ - COPY, /* i/o: waiting for input or output to copy stored block */ - TABLE, /* i: waiting for dynamic block table lengths */ - LENLENS, /* i: waiting for code length code lengths */ - CODELENS, /* i: waiting for length/lit and distance code lengths */ - LEN_, /* i: same as LEN below, but only first time in */ - LEN, /* i: waiting for length/lit/eob code */ - LENEXT, /* i: waiting for length extra bits */ - DIST, /* i: waiting for distance code */ - DISTEXT, /* i: waiting for distance extra bits */ - MATCH, /* o: waiting for output space to copy string */ - LIT, /* o: waiting for output space to write literal */ - CHECK, /* i: waiting for 32-bit check value */ - LENGTH, /* i: waiting for 32-bit length (gzip) */ - DONE, /* finished check, done -- remain here until reset */ - BAD, /* got a data error -- remain here until reset */ - MEM, /* got an inflate() memory error -- remain here until reset */ - SYNC /* looking for synchronization bytes to restart inflate() */ -} inflate_mode; - -/* - State transitions between above modes - - - (most modes can go to BAD or MEM on error -- not shown for clarity) - - Process header: - HEAD -> (gzip) or (zlib) or (raw) - (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> - HCRC -> TYPE - (zlib) -> DICTID or TYPE - DICTID -> DICT -> TYPE - (raw) -> TYPEDO - Read deflate blocks: - TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK - STORED -> COPY_ -> COPY -> TYPE - TABLE -> LENLENS -> CODELENS -> LEN_ - LEN_ -> LEN - Read deflate codes in fixed or dynamic block: - LEN -> LENEXT or LIT or TYPE - LENEXT -> DIST -> DISTEXT -> MATCH -> LEN - LIT -> LEN - Process trailer: - CHECK -> LENGTH -> DONE - */ - -/* State maintained between inflate() calls -- approximately 7K bytes, not - including the allocated sliding window, which is up to 32K bytes. */ -struct inflate_state { - z_streamp strm; /* pointer back to this zlib stream */ - inflate_mode mode; /* current inflate mode */ - int last; /* true if processing last block */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip, - bit 2 true to validate check value */ - int havedict; /* true if dictionary provided */ - int flags; /* gzip header method and flags (0 if zlib) */ - unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ - unsigned long check; /* protected copy of check value */ - unsigned long total; /* protected copy of output count */ - gz_headerp head; /* where to save gzip header information */ - /* sliding window */ - unsigned wbits; /* log base 2 of requested window size */ - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned wnext; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if needed */ - /* bit accumulator */ - unsigned long hold; /* input bit accumulator */ - unsigned bits; /* number of bits in "in" */ - /* for string and stored block copying */ - unsigned length; /* literal or length of data to copy */ - unsigned offset; /* distance back to copy string from */ - /* for table and code decoding */ - unsigned extra; /* extra bits needed */ - /* fixed and dynamic code tables */ - code const FAR *lencode; /* starting table for length/literal codes */ - code const FAR *distcode; /* starting table for distance codes */ - unsigned lenbits; /* index bits for lencode */ - unsigned distbits; /* index bits for distcode */ - /* dynamic table building */ - unsigned ncode; /* number of code length code lengths */ - unsigned nlen; /* number of length code lengths */ - unsigned ndist; /* number of distance code lengths */ - unsigned have; /* number of code lengths in lens[] */ - code FAR *next; /* next available space in codes[] */ - unsigned short lens[320]; /* temporary storage for code lengths */ - unsigned short work[288]; /* work area for code table building */ - code codes[ENOUGH]; /* space for code tables */ - int sane; /* if false, allow invalid distance too far */ - int back; /* bits back of last unprocessed length/lit */ - unsigned was; /* initial length of match */ -}; diff --git a/compat/zlib/inftrees.c b/compat/zlib/inftrees.c deleted file mode 100644 index 2ea08fc..0000000 --- a/compat/zlib/inftrees.c +++ /dev/null @@ -1,304 +0,0 @@ -/* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2017 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" - -#define MAXBITS 15 - -const char inflate_copyright[] = - " inflate 1.2.11 Copyright 1995-2017 Mark Adler "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* - Build a set of tables to decode the provided canonical Huffman code. - The code lengths are lens[0..codes-1]. The result starts at *table, - whose indices are 0..2^bits-1. work is a writable array of at least - lens shorts, which is used as a work area. type is the type of code - to be generated, CODES, LENS, or DISTS. On return, zero is success, - -1 is an invalid code, and +1 means that ENOUGH isn't enough. table - on return points to the next available entry's address. bits is the - requested root table index bits, and on return it is the actual root - table index bits. It will differ if the request is greater than the - longest code or if it is less than the shortest code. - */ -int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) -codetype type; -unsigned short FAR *lens; -unsigned codes; -code FAR * FAR *table; -unsigned FAR *bits; -unsigned short FAR *work; -{ - unsigned len; /* a code's length in bits */ - unsigned sym; /* index of code symbols */ - unsigned min, max; /* minimum and maximum code lengths */ - unsigned root; /* number of index bits for root table */ - unsigned curr; /* number of index bits for current table */ - unsigned drop; /* code bits to drop for sub-table */ - int left; /* number of prefix codes available */ - unsigned used; /* code entries in table used */ - unsigned huff; /* Huffman code */ - unsigned incr; /* for incrementing code, index */ - unsigned fill; /* index for replicating entries */ - unsigned low; /* low bits for current root entry */ - unsigned mask; /* mask for low root bits */ - code here; /* table entry for duplication */ - code FAR *next; /* next available space in table */ - const unsigned short FAR *base; /* base value table to use */ - const unsigned short FAR *extra; /* extra bits table to use */ - unsigned match; /* use base and extra for symbol >= match */ - unsigned short count[MAXBITS+1]; /* number of codes of each length */ - unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ - static const unsigned short lbase[31] = { /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - static const unsigned short lext[31] = { /* Length codes 257..285 extra */ - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202}; - static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577, 0, 0}; - static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64}; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) - count[len] = 0; - for (sym = 0; sym < codes; sym++) - count[lens[sym]]++; - - /* bound code lengths, force root to be within code lengths */ - root = *bits; - for (max = MAXBITS; max >= 1; max--) - if (count[max] != 0) break; - if (root > max) root = max; - if (max == 0) { /* no symbols to code at all */ - here.op = (unsigned char)64; /* invalid code marker */ - here.bits = (unsigned char)1; - here.val = (unsigned short)0; - *(*table)++ = here; /* make a table to force an error */ - *(*table)++ = here; - *bits = 1; - return 0; /* no symbols, but wait for decoding to report error */ - } - for (min = 1; min < max; min++) - if (count[min] != 0) break; - if (root < min) root = min; - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) return -1; /* over-subscribed */ - } - if (left > 0 && (type == CODES || max != 1)) - return -1; /* incomplete set */ - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) - offs[len + 1] = offs[len] + count[len]; - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) - if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked for LENS and DIST tables against - the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in - the initial root table size constants. See the comments in inftrees.h - for more information. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - switch (type) { - case CODES: - base = extra = work; /* dummy value--not used */ - match = 20; - break; - case LENS: - base = lbase; - extra = lext; - match = 257; - break; - default: /* DISTS */ - base = dbase; - extra = dext; - match = 0; - } - - /* initialize state for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = *table; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = (unsigned)(-1); /* trigger new sub-table when len > root */ - used = 1U << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if ((type == LENS && used > ENOUGH_LENS) || - (type == DISTS && used > ENOUGH_DISTS)) - return 1; - - /* process all codes and make table entries */ - for (;;) { - /* create table entry */ - here.bits = (unsigned char)(len - drop); - if (work[sym] + 1U < match) { - here.op = (unsigned char)0; - here.val = work[sym]; - } - else if (work[sym] >= match) { - here.op = (unsigned char)(extra[work[sym] - match]); - here.val = base[work[sym] - match]; - } - else { - here.op = (unsigned char)(32 + 64); /* end of block */ - here.val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1U << (len - drop); - fill = 1U << curr; - min = fill; /* save offset to next table */ - do { - fill -= incr; - next[(huff >> drop) + fill] = here; - } while (fill != 0); - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - - /* go to next symbol, update count, len */ - sym++; - if (--(count[len]) == 0) { - if (len == max) break; - len = lens[work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) != low) { - /* if first time, transition to sub-tables */ - if (drop == 0) - drop = root; - - /* increment past last table */ - next += min; /* here min is 1 << curr */ - - /* determine length of next table */ - curr = len - drop; - left = (int)(1 << curr); - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) break; - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1U << curr; - if ((type == LENS && used > ENOUGH_LENS) || - (type == DISTS && used > ENOUGH_DISTS)) - return 1; - - /* point entry in root table to sub-table */ - low = huff & mask; - (*table)[low].op = (unsigned char)curr; - (*table)[low].bits = (unsigned char)root; - (*table)[low].val = (unsigned short)(next - *table); - } - } - - /* fill in remaining table entry if code is incomplete (guaranteed to have - at most one remaining entry, since if the code is incomplete, the - maximum code length that was allowed to get this far is one bit) */ - if (huff != 0) { - here.op = (unsigned char)64; /* invalid code marker */ - here.bits = (unsigned char)(len - drop); - here.val = (unsigned short)0; - next[huff] = here; - } - - /* set return parameters */ - *table += used; - *bits = root; - return 0; -} diff --git a/compat/zlib/inftrees.h b/compat/zlib/inftrees.h deleted file mode 100644 index baa53a0..0000000 --- a/compat/zlib/inftrees.h +++ /dev/null @@ -1,62 +0,0 @@ -/* inftrees.h -- header to use inftrees.c - * Copyright (C) 1995-2005, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* Structure for decoding tables. Each entry provides either the - information needed to do the operation requested by the code that - indexed that table entry, or it provides a pointer to another - table that indexes more bits of the code. op indicates whether - the entry is a pointer to another table, a literal, a length or - distance, an end-of-block, or an invalid code. For a table - pointer, the low four bits of op is the number of index bits of - that table. For a length or distance, the low four bits of op - is the number of extra bits to get after the code. bits is - the number of bits in this code or part of the code to drop off - of the bit buffer. val is the actual byte to output in the case - of a literal, the base length or distance, or the offset from - the current table to the next table. Each entry is four bytes. */ -typedef struct { - unsigned char op; /* operation, extra bits, table bits */ - unsigned char bits; /* bits in this part of the code */ - unsigned short val; /* offset in table or code value */ -} code; - -/* op values as set by inflate_table(): - 00000000 - literal - 0000tttt - table link, tttt != 0 is the number of table index bits - 0001eeee - length or distance, eeee is the number of extra bits - 01100000 - end of block - 01000000 - invalid code - */ - -/* Maximum size of the dynamic table. The maximum number of code structures is - 1444, which is the sum of 852 for literal/length codes and 592 for distance - codes. These values were found by exhaustive searches using the program - examples/enough.c found in the zlib distribtution. The arguments to that - program are the number of symbols, the initial root table size, and the - maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the - inflate_table() calls in inflate.c and infback.c. If the root table size is - changed, then these maximum sizes would be need to be recalculated and - updated. */ -#define ENOUGH_LENS 852 -#define ENOUGH_DISTS 592 -#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) - -/* Type of code to build for inflate_table() */ -typedef enum { - CODES, - LENS, - DISTS -} codetype; - -int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, - unsigned codes, code FAR * FAR *table, - unsigned FAR *bits, unsigned short FAR *work)); diff --git a/compat/zlib/make_vms.com b/compat/zlib/make_vms.com deleted file mode 100644 index 65e9d0c..0000000 --- a/compat/zlib/make_vms.com +++ /dev/null @@ -1,867 +0,0 @@ -$! make libz under VMS written by -$! Martin P.J. Zinser -$! -$! In case of problems with the install you might contact me at -$! zinser@zinser.no-ip.info(preferred) or -$! martin.zinser@eurexchange.com (work) -$! -$! Make procedure history for Zlib -$! -$!------------------------------------------------------------------------------ -$! Version history -$! 0.01 20060120 First version to receive a number -$! 0.02 20061008 Adapt to new Makefile.in -$! 0.03 20091224 Add support for large file check -$! 0.04 20100110 Add new gzclose, gzlib, gzread, gzwrite -$! 0.05 20100221 Exchange zlibdefs.h by zconf.h.in -$! 0.06 20120111 Fix missing amiss_err, update zconf_h.in, fix new exmples -$! subdir path, update module search in makefile.in -$! 0.07 20120115 Triggered by work done by Alexey Chupahin completly redesigned -$! shared image creation -$! 0.08 20120219 Make it work on VAX again, pre-load missing symbols to shared -$! image -$! 0.09 20120305 SMS. P1 sets builder ("MMK", "MMS", " " (built-in)). -$! "" -> automatic, preference: MMK, MMS, built-in. -$! -$ on error then goto err_exit -$! -$ true = 1 -$ false = 0 -$ tmpnam = "temp_" + f$getjpi("","pid") -$ tt = tmpnam + ".txt" -$ tc = tmpnam + ".c" -$ th = tmpnam + ".h" -$ define/nolog tconfig 'th' -$ its_decc = false -$ its_vaxc = false -$ its_gnuc = false -$ s_case = False -$! -$! Setup variables holding "config" information -$! -$ Make = "''p1'" -$ name = "Zlib" -$ version = "?.?.?" -$ v_string = "ZLIB_VERSION" -$ v_file = "zlib.h" -$ ccopt = "/include = []" -$ lopts = "" -$ dnsrl = "" -$ aconf_in_file = "zconf.h.in#zconf.h_in#zconf_h.in" -$ conf_check_string = "" -$ linkonly = false -$ optfile = name + ".opt" -$ mapfile = name + ".map" -$ libdefs = "" -$ vax = f$getsyi("HW_MODEL").lt.1024 -$ axp = f$getsyi("HW_MODEL").ge.1024 .and. f$getsyi("HW_MODEL").lt.4096 -$ ia64 = f$getsyi("HW_MODEL").ge.4096 -$! -$! 2012-03-05 SMS. -$! Why is this needed? And if it is needed, why not simply ".not. vax"? -$! -$!!! if axp .or. ia64 then set proc/parse=extended -$! -$ whoami = f$parse(f$environment("Procedure"),,,,"NO_CONCEAL") -$ mydef = F$parse(whoami,,,"DEVICE") -$ mydir = f$parse(whoami,,,"DIRECTORY") - "][" -$ myproc = f$parse(whoami,,,"Name") + f$parse(whoami,,,"type") -$! -$! Check for MMK/MMS -$! -$ if (Make .eqs. "") -$ then -$ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS" -$ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK" -$ else -$ Make = f$edit( Make, "trim") -$ endif -$! -$ gosub find_version -$! -$ open/write topt tmp.opt -$ open/write optf 'optfile' -$! -$ gosub check_opts -$! -$! Look for the compiler used -$! -$ gosub check_compiler -$ close topt -$ close optf -$! -$ if its_decc -$ then -$ ccopt = "/prefix=all" + ccopt -$ if f$trnlnm("SYS") .eqs. "" -$ then -$ if axp -$ then -$ define sys sys$library: -$ else -$ ccopt = "/decc" + ccopt -$ define sys decc$library_include: -$ endif -$ endif -$! -$! 2012-03-05 SMS. -$! Why /NAMES = AS_IS? Why not simply ".not. vax"? And why not on VAX? -$! -$ if axp .or. ia64 -$ then -$ ccopt = ccopt + "/name=as_is/opt=(inline=speed)" -$ s_case = true -$ endif -$ endif -$ if its_vaxc .or. its_gnuc -$ then -$ if f$trnlnm("SYS").eqs."" then define sys sys$library: -$ endif -$! -$! Build a fake configure input header -$! -$ open/write conf_hin config.hin -$ write conf_hin "#undef _LARGEFILE64_SOURCE" -$ close conf_hin -$! -$! -$ i = 0 -$FIND_ACONF: -$ fname = f$element(i,"#",aconf_in_file) -$ if fname .eqs. "#" then goto AMISS_ERR -$ if f$search(fname) .eqs. "" -$ then -$ i = i + 1 -$ goto find_aconf -$ endif -$ open/read/err=aconf_err aconf_in 'fname' -$ open/write aconf zconf.h -$ACONF_LOOP: -$ read/end_of_file=aconf_exit aconf_in line -$ work = f$edit(line, "compress,trim") -$ if f$extract(0,6,work) .nes. "#undef" -$ then -$ if f$extract(0,12,work) .nes. "#cmakedefine" -$ then -$ write aconf line -$ endif -$ else -$ cdef = f$element(1," ",work) -$ gosub check_config -$ endif -$ goto aconf_loop -$ACONF_EXIT: -$ write aconf "" -$ write aconf "/* VMS specifics added by make_vms.com: */" -$ write aconf "#define VMS 1" -$ write aconf "#include " -$ write aconf "#include " -$ write aconf "#ifdef _LARGEFILE" -$ write aconf "# define off64_t __off64_t" -$ write aconf "# define fopen64 fopen" -$ write aconf "# define fseeko64 fseeko" -$ write aconf "# define lseek64 lseek" -$ write aconf "# define ftello64 ftell" -$ write aconf "#endif" -$ write aconf "#if !defined( __VAX) && (__CRTL_VER >= 70312000)" -$ write aconf "# define HAVE_VSNPRINTF" -$ write aconf "#endif" -$ close aconf_in -$ close aconf -$ if f$search("''th'") .nes. "" then delete 'th';* -$! Build the thing plain or with mms -$! -$ write sys$output "Compiling Zlib sources ..." -$ if make.eqs."" -$ then -$ if (f$search( "example.obj;*") .nes. "") then delete example.obj;* -$ if (f$search( "minigzip.obj;*") .nes. "") then delete minigzip.obj;* -$ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" - - adler32.c zlib.h zconf.h -$ CALL MAKE compress.OBJ "CC ''CCOPT' compress" - - compress.c zlib.h zconf.h -$ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" - - crc32.c zlib.h zconf.h -$ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" - - deflate.c deflate.h zutil.h zlib.h zconf.h -$ CALL MAKE gzclose.OBJ "CC ''CCOPT' gzclose" - - gzclose.c zutil.h zlib.h zconf.h -$ CALL MAKE gzlib.OBJ "CC ''CCOPT' gzlib" - - gzlib.c zutil.h zlib.h zconf.h -$ CALL MAKE gzread.OBJ "CC ''CCOPT' gzread" - - gzread.c zutil.h zlib.h zconf.h -$ CALL MAKE gzwrite.OBJ "CC ''CCOPT' gzwrite" - - gzwrite.c zutil.h zlib.h zconf.h -$ CALL MAKE infback.OBJ "CC ''CCOPT' infback" - - infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h -$ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" - - inffast.c zutil.h zlib.h zconf.h inffast.h -$ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" - - inflate.c zutil.h zlib.h zconf.h infblock.h -$ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" - - inftrees.c zutil.h zlib.h zconf.h inftrees.h -$ CALL MAKE trees.OBJ "CC ''CCOPT' trees" - - trees.c deflate.h zutil.h zlib.h zconf.h -$ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" - - uncompr.c zlib.h zconf.h -$ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" - - zutil.c zutil.h zlib.h zconf.h -$ write sys$output "Building Zlib ..." -$ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ -$ write sys$output "Building example..." -$ CALL MAKE example.OBJ "CC ''CCOPT' [.test]example" - - [.test]example.c zlib.h zconf.h -$ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb -$ write sys$output "Building minigzip..." -$ CALL MAKE minigzip.OBJ "CC ''CCOPT' [.test]minigzip" - - [.test]minigzip.c zlib.h zconf.h -$ call make minigzip.exe - - "LINK minigzip,libz.olb/lib" - - minigzip.obj libz.olb -$ else -$ gosub crea_mms -$ write sys$output "Make ''name' ''version' with ''Make' " -$ 'make' -$ endif -$! -$! Create shareable image -$! -$ gosub crea_olist -$ write sys$output "Creating libzshr.exe" -$ call map_2_shopt 'mapfile' 'optfile' -$ LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,'optfile'/opt -$ write sys$output "Zlib build completed" -$ delete/nolog tmp.opt;* -$ exit -$AMISS_ERR: -$ write sys$output "No source for config.hin found." -$ write sys$output "Tried any of ''aconf_in_file'" -$ goto err_exit -$CC_ERR: -$ write sys$output "C compiler required to build ''name'" -$ goto err_exit -$ERR_EXIT: -$ set message/facil/ident/sever/text -$ close/nolog optf -$ close/nolog topt -$ close/nolog aconf_in -$ close/nolog aconf -$ close/nolog out -$ close/nolog min -$ close/nolog mod -$ close/nolog h_in -$ write sys$output "Exiting..." -$ exit 2 -$! -$! -$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES -$ V = 'F$Verify(0) -$! P1 = What we are trying to make -$! P2 = Command to make it -$! P3 - P8 What it depends on -$ -$ If F$Search(P1) .Eqs. "" Then Goto Makeit -$ Time = F$CvTime(F$File(P1,"RDT")) -$arg=3 -$Loop: -$ Argument = P'arg -$ If Argument .Eqs. "" Then Goto Exit -$ El=0 -$Loop2: -$ File = F$Element(El," ",Argument) -$ If File .Eqs. " " Then Goto Endl -$ AFile = "" -$Loop3: -$ OFile = AFile -$ AFile = F$Search(File) -$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl -$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit -$ Goto Loop3 -$NextEL: -$ El = El + 1 -$ Goto Loop2 -$EndL: -$ arg=arg+1 -$ If arg .Le. 8 Then Goto Loop -$ Goto Exit -$ -$Makeit: -$ VV=F$VERIFY(0) -$ write sys$output P2 -$ 'P2 -$ VV='F$Verify(VV) -$Exit: -$ If V Then Set Verify -$ENDSUBROUTINE -$!------------------------------------------------------------------------------ -$! -$! Check command line options and set symbols accordingly -$! -$!------------------------------------------------------------------------------ -$! Version history -$! 0.01 20041206 First version to receive a number -$! 0.02 20060126 Add new "HELP" target -$ CHECK_OPTS: -$ i = 1 -$ OPT_LOOP: -$ if i .lt. 9 -$ then -$ cparm = f$edit(p'i',"upcase") -$! -$! Check if parameter actually contains something -$! -$ if f$edit(cparm,"trim") .nes. "" -$ then -$ if cparm .eqs. "DEBUG" -$ then -$ ccopt = ccopt + "/noopt/deb" -$ lopts = lopts + "/deb" -$ endif -$ if f$locate("CCOPT=",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ ccopt = ccopt + f$extract(start,len,cparm) -$ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) - - then s_case = true -$ endif -$ if cparm .eqs. "LINK" then linkonly = true -$ if f$locate("LOPTS=",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ lopts = lopts + f$extract(start,len,cparm) -$ endif -$ if f$locate("CC=",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ cc_com = f$extract(start,len,cparm) - if (cc_com .nes. "DECC") .and. - - (cc_com .nes. "VAXC") .and. - - (cc_com .nes. "GNUC") -$ then -$ write sys$output "Unsupported compiler choice ''cc_com' ignored" -$ write sys$output "Use DECC, VAXC, or GNUC instead" -$ else -$ if cc_com .eqs. "DECC" then its_decc = true -$ if cc_com .eqs. "VAXC" then its_vaxc = true -$ if cc_com .eqs. "GNUC" then its_gnuc = true -$ endif -$ endif -$ if f$locate("MAKE=",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ mmks = f$extract(start,len,cparm) -$ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS") -$ then -$ make = mmks -$ else -$ write sys$output "Unsupported make choice ''mmks' ignored" -$ write sys$output "Use MMK or MMS instead" -$ endif -$ endif -$ if cparm .eqs. "HELP" then gosub bhelp -$ endif -$ i = i + 1 -$ goto opt_loop -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! Look for the compiler used -$! -$! Version history -$! 0.01 20040223 First version to receive a number -$! 0.02 20040229 Save/set value of decc$no_rooted_search_lists -$! 0.03 20060202 Extend handling of GNU C -$! 0.04 20090402 Compaq -> hp -$CHECK_COMPILER: -$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc)) -$ then -$ its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "") -$ its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "") -$ its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "") -$ endif -$! -$! Exit if no compiler available -$! -$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc)) -$ then goto CC_ERR -$ else -$ if its_decc -$ then -$ write sys$output "CC compiler check ... hp C" -$ if f$trnlnm("decc$no_rooted_search_lists") .nes. "" -$ then -$ dnrsl = f$trnlnm("decc$no_rooted_search_lists") -$ endif -$ define/nolog decc$no_rooted_search_lists 1 -$ else -$ if its_vaxc then write sys$output "CC compiler check ... VAX C" -$ if its_gnuc -$ then -$ write sys$output "CC compiler check ... GNU C" -$ if f$trnlnm(topt) then write topt "gnu_cc:[000000]gcclib.olb/lib" -$ if f$trnlnm(optf) then write optf "gnu_cc:[000000]gcclib.olb/lib" -$ cc = "gcc" -$ endif -$ if f$trnlnm(topt) then write topt "sys$share:vaxcrtl.exe/share" -$ if f$trnlnm(optf) then write optf "sys$share:vaxcrtl.exe/share" -$ endif -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! If MMS/MMK are available dump out the descrip.mms if required -$! -$CREA_MMS: -$ write sys$output "Creating descrip.mms..." -$ create descrip.mms -$ open/append out descrip.mms -$ copy sys$input: out -$ deck -# descrip.mms: MMS description file for building zlib on VMS -# written by Martin P.J. Zinser -# - -OBJS = adler32.obj, compress.obj, crc32.obj, gzclose.obj, gzlib.obj\ - gzread.obj, gzwrite.obj, uncompr.obj, infback.obj\ - deflate.obj, trees.obj, zutil.obj, inflate.obj, \ - inftrees.obj, inffast.obj - -$ eod -$ write out "CFLAGS=", ccopt -$ write out "LOPTS=", lopts -$ write out "all : example.exe minigzip.exe libz.olb" -$ copy sys$input: out -$ deck - @ write sys$output " Example applications available" - -libz.olb : libz.olb($(OBJS)) - @ write sys$output " libz available" - -example.exe : example.obj libz.olb - link $(LOPTS) example,libz.olb/lib - -minigzip.exe : minigzip.obj libz.olb - link $(LOPTS) minigzip,libz.olb/lib - -clean : - delete *.obj;*,libz.olb;*,*.opt;*,*.exe;* - - -# Other dependencies. -adler32.obj : adler32.c zutil.h zlib.h zconf.h -compress.obj : compress.c zlib.h zconf.h -crc32.obj : crc32.c zutil.h zlib.h zconf.h -deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h -example.obj : [.test]example.c zlib.h zconf.h -gzclose.obj : gzclose.c zutil.h zlib.h zconf.h -gzlib.obj : gzlib.c zutil.h zlib.h zconf.h -gzread.obj : gzread.c zutil.h zlib.h zconf.h -gzwrite.obj : gzwrite.c zutil.h zlib.h zconf.h -inffast.obj : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h -inflate.obj : inflate.c zutil.h zlib.h zconf.h -inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h -minigzip.obj : [.test]minigzip.c zlib.h zconf.h -trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h -uncompr.obj : uncompr.c zlib.h zconf.h -zutil.obj : zutil.c zutil.h zlib.h zconf.h -infback.obj : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h -$ eod -$ close out -$ return -$!------------------------------------------------------------------------------ -$! -$! Read list of core library sources from makefile.in and create options -$! needed to build shareable image -$! -$CREA_OLIST: -$ open/read min makefile.in -$ open/write mod modules.opt -$ src_check_list = "OBJZ =#OBJG =" -$MRLOOP: -$ read/end=mrdone min rec -$ i = 0 -$SRC_CHECK_LOOP: -$ src_check = f$element(i, "#", src_check_list) -$ i = i+1 -$ if src_check .eqs. "#" then goto mrloop -$ if (f$extract(0,6,rec) .nes. src_check) then goto src_check_loop -$ rec = rec - src_check -$ gosub extra_filnam -$ if (f$element(1,"\",rec) .eqs. "\") then goto mrloop -$MRSLOOP: -$ read/end=mrdone min rec -$ gosub extra_filnam -$ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop -$MRDONE: -$ close min -$ close mod -$ return -$!------------------------------------------------------------------------------ -$! -$! Take record extracted in crea_olist and split it into single filenames -$! -$EXTRA_FILNAM: -$ myrec = f$edit(rec - "\", "trim,compress") -$ i = 0 -$FELOOP: -$ srcfil = f$element(i," ", myrec) -$ if (srcfil .nes. " ") -$ then -$ write mod f$parse(srcfil,,,"NAME"), ".obj" -$ i = i + 1 -$ goto feloop -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! Find current Zlib version number -$! -$FIND_VERSION: -$ open/read h_in 'v_file' -$hloop: -$ read/end=hdone h_in rec -$ rec = f$edit(rec,"TRIM") -$ if (f$extract(0,1,rec) .nes. "#") then goto hloop -$ rec = f$edit(rec - "#", "TRIM") -$ if f$element(0," ",rec) .nes. "define" then goto hloop -$ if f$element(1," ",rec) .eqs. v_string -$ then -$ version = 'f$element(2," ",rec)' -$ goto hdone -$ endif -$ goto hloop -$hdone: -$ close h_in -$ return -$!------------------------------------------------------------------------------ -$! -$CHECK_CONFIG: -$! -$ in_ldef = f$locate(cdef,libdefs) -$ if (in_ldef .lt. f$length(libdefs)) -$ then -$ write aconf "#define ''cdef' 1" -$ libdefs = f$extract(0,in_ldef,libdefs) + - - f$extract(in_ldef + f$length(cdef) + 1, - - f$length(libdefs) - in_ldef - f$length(cdef) - 1, - - libdefs) -$ else -$ if (f$type('cdef') .eqs. "INTEGER") -$ then -$ write aconf "#define ''cdef' ", 'cdef' -$ else -$ if (f$type('cdef') .eqs. "STRING") -$ then -$ write aconf "#define ''cdef' ", """", '''cdef'', """" -$ else -$ gosub check_cc_def -$ endif -$ endif -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! Check if this is a define relating to the properties of the C/C++ -$! compiler -$! -$ CHECK_CC_DEF: -$ if (cdef .eqs. "_LARGEFILE64_SOURCE") -$ then -$ copy sys$input: 'tc' -$ deck -#include "tconfig" -#define _LARGEFILE -#include - -int main(){ -FILE *fp; - fp = fopen("temp.txt","r"); - fseeko(fp,1,SEEK_SET); - fclose(fp); -} - -$ eod -$ test_inv = false -$ comm_h = false -$ gosub cc_prop_check -$ return -$ endif -$ write aconf "/* ", line, " */" -$ return -$!------------------------------------------------------------------------------ -$! -$! Check for properties of C/C++ compiler -$! -$! Version history -$! 0.01 20031020 First version to receive a number -$! 0.02 20031022 Added logic for defines with value -$! 0.03 20040309 Make sure local config file gets not deleted -$! 0.04 20041230 Also write include for configure run -$! 0.05 20050103 Add processing of "comment defines" -$CC_PROP_CHECK: -$ cc_prop = true -$ is_need = false -$ is_need = (f$extract(0,4,cdef) .eqs. "NEED") .or. (test_inv .eq. true) -$ if f$search(th) .eqs. "" then create 'th' -$ set message/nofac/noident/nosever/notext -$ on error then continue -$ cc 'tmpnam' -$ if .not. ($status) then cc_prop = false -$ on error then continue -$! The headers might lie about the capabilities of the RTL -$ link 'tmpnam',tmp.opt/opt -$ if .not. ($status) then cc_prop = false -$ set message/fac/ident/sever/text -$ on error then goto err_exit -$ delete/nolog 'tmpnam'.*;*/exclude='th' -$ if (cc_prop .and. .not. is_need) .or. - - (.not. cc_prop .and. is_need) -$ then -$ write sys$output "Checking for ''cdef'... yes" -$ if f$type('cdef_val'_yes) .nes. "" -$ then -$ if f$type('cdef_val'_yes) .eqs. "INTEGER" - - then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_yes) -$ if f$type('cdef_val'_yes) .eqs. "STRING" - - then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_yes) -$ else -$ call write_config f$fao("#define !AS 1",cdef) -$ endif -$ if (cdef .eqs. "HAVE_FSEEKO") .or. (cdef .eqs. "_LARGE_FILES") .or. - - (cdef .eqs. "_LARGEFILE64_SOURCE") then - - call write_config f$string("#define _LARGEFILE 1") -$ else -$ write sys$output "Checking for ''cdef'... no" -$ if (comm_h) -$ then - call write_config f$fao("/* !AS */",line) -$ else -$ if f$type('cdef_val'_no) .nes. "" -$ then -$ if f$type('cdef_val'_no) .eqs. "INTEGER" - - then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_no) -$ if f$type('cdef_val'_no) .eqs. "STRING" - - then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_no) -$ else -$ call write_config f$fao("#undef !AS",cdef) -$ endif -$ endif -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! Check for properties of C/C++ compiler with multiple result values -$! -$! Version history -$! 0.01 20040127 First version -$! 0.02 20050103 Reconcile changes from cc_prop up to version 0.05 -$CC_MPROP_CHECK: -$ cc_prop = true -$ i = 1 -$ idel = 1 -$ MT_LOOP: -$ if f$type(result_'i') .eqs. "STRING" -$ then -$ set message/nofac/noident/nosever/notext -$ on error then continue -$ cc 'tmpnam'_'i' -$ if .not. ($status) then cc_prop = false -$ on error then continue -$! The headers might lie about the capabilities of the RTL -$ link 'tmpnam'_'i',tmp.opt/opt -$ if .not. ($status) then cc_prop = false -$ set message/fac/ident/sever/text -$ on error then goto err_exit -$ delete/nolog 'tmpnam'_'i'.*;* -$ if (cc_prop) -$ then -$ write sys$output "Checking for ''cdef'... ", mdef_'i' -$ if f$type(mdef_'i') .eqs. "INTEGER" - - then call write_config f$fao("#define !AS !UL",cdef,mdef_'i') -$ if f$type('cdef_val'_yes) .eqs. "STRING" - - then call write_config f$fao("#define !AS !AS",cdef,mdef_'i') -$ goto msym_clean -$ else -$ i = i + 1 -$ goto mt_loop -$ endif -$ endif -$ write sys$output "Checking for ''cdef'... no" -$ call write_config f$fao("#undef !AS",cdef) -$ MSYM_CLEAN: -$ if (idel .le. msym_max) -$ then -$ delete/sym mdef_'idel' -$ idel = idel + 1 -$ goto msym_clean -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! Write configuration to both permanent and temporary config file -$! -$! Version history -$! 0.01 20031029 First version to receive a number -$! -$WRITE_CONFIG: SUBROUTINE -$ write aconf 'p1' -$ open/append confh 'th' -$ write confh 'p1' -$ close confh -$ENDSUBROUTINE -$!------------------------------------------------------------------------------ -$! -$! Analyze the project map file and create the symbol vector for a shareable -$! image from it -$! -$! Version history -$! 0.01 20120128 First version -$! 0.02 20120226 Add pre-load logic -$! -$ MAP_2_SHOPT: Subroutine -$! -$ SAY := "WRITE_ SYS$OUTPUT" -$! -$ IF F$SEARCH("''P1'") .EQS. "" -$ THEN -$ SAY "MAP_2_SHOPT-E-NOSUCHFILE: Error, inputfile ''p1' not available" -$ goto exit_m2s -$ ENDIF -$ IF "''P2'" .EQS. "" -$ THEN -$ SAY "MAP_2_SHOPT: Error, no output file provided" -$ goto exit_m2s -$ ENDIF -$! -$ module1 = "deflate#deflateEnd#deflateInit_#deflateParams#deflateSetDictionary" -$ module2 = "gzclose#gzerror#gzgetc#gzgets#gzopen#gzprintf#gzputc#gzputs#gzread" -$ module3 = "gzseek#gztell#inflate#inflateEnd#inflateInit_#inflateSetDictionary" -$ module4 = "inflateSync#uncompress#zlibVersion#compress" -$ open/read map 'p1 -$ if axp .or. ia64 -$ then -$ open/write aopt a.opt -$ open/write bopt b.opt -$ write aopt " CASE_SENSITIVE=YES" -$ write bopt "SYMBOL_VECTOR= (-" -$ mod_sym_num = 1 -$ MOD_SYM_LOOP: -$ if f$type(module'mod_sym_num') .nes. "" -$ then -$ mod_in = 0 -$ MOD_SYM_IN: -$ shared_proc = f$element(mod_in, "#", module'mod_sym_num') -$ if shared_proc .nes. "#" -$ then -$ write aopt f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)",- - f$edit(shared_proc,"upcase"),shared_proc) -$ write bopt f$fao("!AS=PROCEDURE,-",shared_proc) -$ mod_in = mod_in + 1 -$ goto mod_sym_in -$ endif -$ mod_sym_num = mod_sym_num + 1 -$ goto mod_sym_loop -$ endif -$MAP_LOOP: -$ read/end=map_end map line -$ if (f$locate("{",line).lt. f$length(line)) .or. - - (f$locate("global:", line) .lt. f$length(line)) -$ then -$ proc = true -$ goto map_loop -$ endif -$ if f$locate("}",line).lt. f$length(line) then proc = false -$ if f$locate("local:", line) .lt. f$length(line) then proc = false -$ if proc -$ then -$ shared_proc = f$edit(line,"collapse") -$ chop_semi = f$locate(";", shared_proc) -$ if chop_semi .lt. f$length(shared_proc) then - - shared_proc = f$extract(0, chop_semi, shared_proc) -$ write aopt f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)",- - f$edit(shared_proc,"upcase"),shared_proc) -$ write bopt f$fao("!AS=PROCEDURE,-",shared_proc) -$ endif -$ goto map_loop -$MAP_END: -$ close/nolog aopt -$ close/nolog bopt -$ open/append libopt 'p2' -$ open/read aopt a.opt -$ open/read bopt b.opt -$ALOOP: -$ read/end=aloop_end aopt line -$ write libopt line -$ goto aloop -$ALOOP_END: -$ close/nolog aopt -$ sv = "" -$BLOOP: -$ read/end=bloop_end bopt svn -$ if (svn.nes."") -$ then -$ if (sv.nes."") then write libopt sv -$ sv = svn -$ endif -$ goto bloop -$BLOOP_END: -$ write libopt f$extract(0,f$length(sv)-2,sv), "-" -$ write libopt ")" -$ close/nolog bopt -$ delete/nolog/noconf a.opt;*,b.opt;* -$ else -$ if vax -$ then -$ open/append libopt 'p2' -$ mod_sym_num = 1 -$ VMOD_SYM_LOOP: -$ if f$type(module'mod_sym_num') .nes. "" -$ then -$ mod_in = 0 -$ VMOD_SYM_IN: -$ shared_proc = f$element(mod_in, "#", module'mod_sym_num') -$ if shared_proc .nes. "#" -$ then -$ write libopt f$fao("UNIVERSAL=!AS",- - f$edit(shared_proc,"upcase")) -$ mod_in = mod_in + 1 -$ goto vmod_sym_in -$ endif -$ mod_sym_num = mod_sym_num + 1 -$ goto vmod_sym_loop -$ endif -$VMAP_LOOP: -$ read/end=vmap_end map line -$ if (f$locate("{",line).lt. f$length(line)) .or. - - (f$locate("global:", line) .lt. f$length(line)) -$ then -$ proc = true -$ goto vmap_loop -$ endif -$ if f$locate("}",line).lt. f$length(line) then proc = false -$ if f$locate("local:", line) .lt. f$length(line) then proc = false -$ if proc -$ then -$ shared_proc = f$edit(line,"collapse") -$ chop_semi = f$locate(";", shared_proc) -$ if chop_semi .lt. f$length(shared_proc) then - - shared_proc = f$extract(0, chop_semi, shared_proc) -$ write libopt f$fao("UNIVERSAL=!AS",- - f$edit(shared_proc,"upcase")) -$ endif -$ goto vmap_loop -$VMAP_END: -$ else -$ write sys$output "Unknown Architecture (Not VAX, AXP, or IA64)" -$ write sys$output "No options file created" -$ endif -$ endif -$ EXIT_M2S: -$ close/nolog map -$ close/nolog libopt -$ endsubroutine diff --git a/compat/zlib/msdos/Makefile.bor b/compat/zlib/msdos/Makefile.bor deleted file mode 100644 index 3d12a2c..0000000 --- a/compat/zlib/msdos/Makefile.bor +++ /dev/null @@ -1,115 +0,0 @@ -# Makefile for zlib -# Borland C++ -# Last updated: 15-Mar-2003 - -# To use, do "make -fmakefile.bor" -# To compile in small model, set below: MODEL=s - -# WARNING: the small model is supported but only for small values of -# MAX_WBITS and MAX_MEM_LEVEL. For example: -# -DMAX_WBITS=11 -DDEF_WBITS=11 -DMAX_MEM_LEVEL=3 -# If you wish to reduce the memory requirements (default 256K for big -# objects plus a few K), you can add to the LOC macro below: -# -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 -# See zconf.h for details about the memory requirements. - -# ------------ Turbo C++, Borland C++ ------------ - -# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) -# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added -# to the declaration of LOC here: -LOC = $(LOCAL_ZLIB) - -# type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. -CPU_TYP = 0 - -# memory model: one of s, m, c, l (small, medium, compact, large) -MODEL=l - -# replace bcc with tcc for Turbo C++ 1.0, with bcc32 for the 32 bit version -CC=bcc -LD=bcc -AR=tlib - -# compiler flags -# replace "-O2" by "-O -G -a -d" for Turbo C++ 1.0 -CFLAGS=-O2 -Z -m$(MODEL) $(LOC) - -LDFLAGS=-m$(MODEL) -f- - - -# variables -ZLIB_LIB = zlib_$(MODEL).lib - -OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj -OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj -OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj -OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj - - -# targets -all: $(ZLIB_LIB) example.exe minigzip.exe - -.c.obj: - $(CC) -c $(CFLAGS) $*.c - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h - -gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h - -gzread.obj: gzread.c zlib.h zconf.h gzguts.h - -gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: test/example.c zlib.h zconf.h - -minigzip.obj: test/minigzip.c zlib.h zconf.h - - -# the command line is cut to fit in the MS-DOS 128 byte limit: -$(ZLIB_LIB): $(OBJ1) $(OBJ2) - -del $(ZLIB_LIB) - $(AR) $(ZLIB_LIB) $(OBJP1) - $(AR) $(ZLIB_LIB) $(OBJP2) - -example.exe: example.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) - -minigzip.exe: minigzip.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) - -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -clean: - -del *.obj - -del *.lib - -del *.exe - -del zlib_*.bak - -del foo.gz diff --git a/compat/zlib/msdos/Makefile.dj2 b/compat/zlib/msdos/Makefile.dj2 deleted file mode 100644 index 59d2037..0000000 --- a/compat/zlib/msdos/Makefile.dj2 +++ /dev/null @@ -1,104 +0,0 @@ -# Makefile for zlib. Modified for djgpp v2.0 by F. J. Donahoe, 3/15/96. -# Copyright (C) 1995-1998 Jean-loup Gailly. -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile, or to compile and test, type: -# -# make -fmakefile.dj2; make test -fmakefile.dj2 -# -# To install libz.a, zconf.h and zlib.h in the djgpp directories, type: -# -# make install -fmakefile.dj2 -# -# after first defining LIBRARY_PATH and INCLUDE_PATH in djgpp.env as -# in the sample below if the pattern of the DJGPP distribution is to -# be followed. Remember that, while 'es around <=> are ignored in -# makefiles, they are *not* in batch files or in djgpp.env. -# - - - - - -# [make] -# INCLUDE_PATH=%\>;INCLUDE_PATH%%\DJDIR%\include -# LIBRARY_PATH=%\>;LIBRARY_PATH%%\DJDIR%\lib -# BUTT=-m486 -# - - - - - -# Alternately, these variables may be defined below, overriding the values -# in djgpp.env, as -# INCLUDE_PATH=c:\usr\include -# LIBRARY_PATH=c:\usr\lib - -CC=gcc - -#CFLAGS=-MMD -O -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-MMD -g -DZLIB_DEBUG -CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ - -Wstrict-prototypes -Wmissing-prototypes - -# If cp.exe is available, replace "copy /Y" with "cp -fp" . -CP=copy /Y -# If gnu install.exe is available, replace $(CP) with ginstall. -INSTALL=$(CP) -# The default value of RM is "rm -f." If "rm.exe" is found, comment out: -RM=del -LDLIBS=-L. -lz -LD=$(CC) -s -o -LDSHARED=$(CC) - -INCL=zlib.h zconf.h -LIBS=libz.a - -AR=ar rcs - -prefix=/usr/local -exec_prefix = $(prefix) - -OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \ - uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o - -OBJA = -# to use the asm code: make OBJA=match.o - -TEST_OBJS = example.o minigzip.o - -all: example.exe minigzip.exe - -check: test -test: all - ./example - echo hello world | .\minigzip | .\minigzip -d - -%.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - -libz.a: $(OBJS) $(OBJA) - $(AR) $@ $(OBJS) $(OBJA) - -%.exe : %.o $(LIBS) - $(LD) $@ $< $(LDLIBS) - -# INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env . - -.PHONY : uninstall clean - -install: $(INCL) $(LIBS) - -@if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH) - -@if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH) - $(INSTALL) zlib.h $(INCLUDE_PATH) - $(INSTALL) zconf.h $(INCLUDE_PATH) - $(INSTALL) libz.a $(LIBRARY_PATH) - -uninstall: - $(RM) $(INCLUDE_PATH)\zlib.h - $(RM) $(INCLUDE_PATH)\zconf.h - $(RM) $(LIBRARY_PATH)\libz.a - -clean: - $(RM) *.d - $(RM) *.o - $(RM) *.exe - $(RM) libz.a - $(RM) foo.gz - -DEPS := $(wildcard *.d) -ifneq ($(DEPS),) -include $(DEPS) -endif diff --git a/compat/zlib/msdos/Makefile.emx b/compat/zlib/msdos/Makefile.emx deleted file mode 100644 index e30f67b..0000000 --- a/compat/zlib/msdos/Makefile.emx +++ /dev/null @@ -1,69 +0,0 @@ -# Makefile for zlib. Modified for emx 0.9c by Chr. Spieler, 6/17/98. -# Copyright (C) 1995-1998 Jean-loup Gailly. -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile, or to compile and test, type: -# -# make -fmakefile.emx; make test -fmakefile.emx -# - -CC=gcc - -#CFLAGS=-MMD -O -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-MMD -g -DZLIB_DEBUG -CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ - -Wstrict-prototypes -Wmissing-prototypes - -# If cp.exe is available, replace "copy /Y" with "cp -fp" . -CP=copy /Y -# If gnu install.exe is available, replace $(CP) with ginstall. -INSTALL=$(CP) -# The default value of RM is "rm -f." If "rm.exe" is found, comment out: -RM=del -LDLIBS=-L. -lzlib -LD=$(CC) -s -o -LDSHARED=$(CC) - -INCL=zlib.h zconf.h -LIBS=zlib.a - -AR=ar rcs - -prefix=/usr/local -exec_prefix = $(prefix) - -OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \ - uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o - -TEST_OBJS = example.o minigzip.o - -all: example.exe minigzip.exe - -test: all - ./example - echo hello world | .\minigzip | .\minigzip -d - -%.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - -zlib.a: $(OBJS) - $(AR) $@ $(OBJS) - -%.exe : %.o $(LIBS) - $(LD) $@ $< $(LDLIBS) - - -.PHONY : clean - -clean: - $(RM) *.d - $(RM) *.o - $(RM) *.exe - $(RM) zlib.a - $(RM) foo.gz - -DEPS := $(wildcard *.d) -ifneq ($(DEPS),) -include $(DEPS) -endif diff --git a/compat/zlib/msdos/Makefile.msc b/compat/zlib/msdos/Makefile.msc deleted file mode 100644 index ae83786..0000000 --- a/compat/zlib/msdos/Makefile.msc +++ /dev/null @@ -1,112 +0,0 @@ -# Makefile for zlib -# Microsoft C 5.1 or later -# Last updated: 19-Mar-2003 - -# To use, do "make makefile.msc" -# To compile in small model, set below: MODEL=S - -# If you wish to reduce the memory requirements (default 256K for big -# objects plus a few K), you can add to the LOC macro below: -# -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 -# See zconf.h for details about the memory requirements. - -# ------------- Microsoft C 5.1 and later ------------- - -# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) -# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added -# to the declaration of LOC here: -LOC = $(LOCAL_ZLIB) - -# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. -CPU_TYP = 0 - -# Memory model: one of S, M, C, L (small, medium, compact, large) -MODEL=L - -CC=cl -CFLAGS=-nologo -A$(MODEL) -G$(CPU_TYP) -W3 -Oait -Gs $(LOC) -#-Ox generates bad code with MSC 5.1 -LIB_CFLAGS=-Zl $(CFLAGS) - -LD=link -LDFLAGS=/noi/e/st:0x1500/noe/farcall/packcode -# "/farcall/packcode" are only useful for `large code' memory models -# but should be a "no-op" for small code models. - - -# variables -ZLIB_LIB = zlib_$(MODEL).lib - -OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj -OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj - - -# targets -all: $(ZLIB_LIB) example.exe minigzip.exe - -.c.obj: - $(CC) -c $(LIB_CFLAGS) $*.c - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h - -gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h - -gzread.obj: gzread.c zlib.h zconf.h gzguts.h - -gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: test/example.c zlib.h zconf.h - $(CC) -c $(CFLAGS) $*.c - -minigzip.obj: test/minigzip.c zlib.h zconf.h - $(CC) -c $(CFLAGS) $*.c - - -# the command line is cut to fit in the MS-DOS 128 byte limit: -$(ZLIB_LIB): $(OBJ1) $(OBJ2) - if exist $(ZLIB_LIB) del $(ZLIB_LIB) - lib $(ZLIB_LIB) $(OBJ1); - lib $(ZLIB_LIB) $(OBJ2); - -example.exe: example.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) example.obj,,,$(ZLIB_LIB); - -minigzip.exe: minigzip.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) minigzip.obj,,,$(ZLIB_LIB); - -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -clean: - -del *.obj - -del *.lib - -del *.exe - -del *.map - -del zlib_*.bak - -del foo.gz diff --git a/compat/zlib/msdos/Makefile.tc b/compat/zlib/msdos/Makefile.tc deleted file mode 100644 index 5aec82a..0000000 --- a/compat/zlib/msdos/Makefile.tc +++ /dev/null @@ -1,100 +0,0 @@ -# Makefile for zlib -# Turbo C 2.01, Turbo C++ 1.01 -# Last updated: 15-Mar-2003 - -# To use, do "make -fmakefile.tc" -# To compile in small model, set below: MODEL=s - -# WARNING: the small model is supported but only for small values of -# MAX_WBITS and MAX_MEM_LEVEL. For example: -# -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 -# If you wish to reduce the memory requirements (default 256K for big -# objects plus a few K), you can add to CFLAGS below: -# -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 -# See zconf.h for details about the memory requirements. - -# ------------ Turbo C 2.01, Turbo C++ 1.01 ------------ -MODEL=l -CC=tcc -LD=tcc -AR=tlib -# CFLAGS=-O2 -G -Z -m$(MODEL) -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 -CFLAGS=-O2 -G -Z -m$(MODEL) -LDFLAGS=-m$(MODEL) -f- - - -# variables -ZLIB_LIB = zlib_$(MODEL).lib - -OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj -OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj -OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj -OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj - - -# targets -all: $(ZLIB_LIB) example.exe minigzip.exe - -.c.obj: - $(CC) -c $(CFLAGS) $*.c - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h - -gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h - -gzread.obj: gzread.c zlib.h zconf.h gzguts.h - -gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: test/example.c zlib.h zconf.h - -minigzip.obj: test/minigzip.c zlib.h zconf.h - - -# the command line is cut to fit in the MS-DOS 128 byte limit: -$(ZLIB_LIB): $(OBJ1) $(OBJ2) - -del $(ZLIB_LIB) - $(AR) $(ZLIB_LIB) $(OBJP1) - $(AR) $(ZLIB_LIB) $(OBJP2) - -example.exe: example.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) - -minigzip.exe: minigzip.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) - -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -clean: - -del *.obj - -del *.lib - -del *.exe - -del zlib_*.bak - -del foo.gz diff --git a/compat/zlib/nintendods/Makefile b/compat/zlib/nintendods/Makefile deleted file mode 100644 index 21337d0..0000000 --- a/compat/zlib/nintendods/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -#--------------------------------------------------------------------------------- -.SUFFIXES: -#--------------------------------------------------------------------------------- - -ifeq ($(strip $(DEVKITARM)),) -$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") -endif - -include $(DEVKITARM)/ds_rules - -#--------------------------------------------------------------------------------- -# TARGET is the name of the output -# BUILD is the directory where object files & intermediate files will be placed -# SOURCES is a list of directories containing source code -# DATA is a list of directories containing data files -# INCLUDES is a list of directories containing header files -#--------------------------------------------------------------------------------- -TARGET := $(shell basename $(CURDIR)) -BUILD := build -SOURCES := ../../ -DATA := data -INCLUDES := include - -#--------------------------------------------------------------------------------- -# options for code generation -#--------------------------------------------------------------------------------- -ARCH := -mthumb -mthumb-interwork - -CFLAGS := -Wall -O2\ - -march=armv5te -mtune=arm946e-s \ - -fomit-frame-pointer -ffast-math \ - $(ARCH) - -CFLAGS += $(INCLUDE) -DARM9 -CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions - -ASFLAGS := $(ARCH) -march=armv5te -mtune=arm946e-s -LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) - -#--------------------------------------------------------------------------------- -# list of directories containing libraries, this must be the top level containing -# include and lib -#--------------------------------------------------------------------------------- -LIBDIRS := $(LIBNDS) - -#--------------------------------------------------------------------------------- -# no real need to edit anything past this point unless you need to add additional -# rules for different file extensions -#--------------------------------------------------------------------------------- -ifneq ($(BUILD),$(notdir $(CURDIR))) -#--------------------------------------------------------------------------------- - -export OUTPUT := $(CURDIR)/lib/libz.a - -export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ - $(foreach dir,$(DATA),$(CURDIR)/$(dir)) - -export DEPSDIR := $(CURDIR)/$(BUILD) - -CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) -CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) -SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) -BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) - -#--------------------------------------------------------------------------------- -# use CXX for linking C++ projects, CC for standard C -#--------------------------------------------------------------------------------- -ifeq ($(strip $(CPPFILES)),) -#--------------------------------------------------------------------------------- - export LD := $(CC) -#--------------------------------------------------------------------------------- -else -#--------------------------------------------------------------------------------- - export LD := $(CXX) -#--------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------- - -export OFILES := $(addsuffix .o,$(BINFILES)) \ - $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) - -export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) - -.PHONY: $(BUILD) clean all - -#--------------------------------------------------------------------------------- -all: $(BUILD) - @[ -d $@ ] || mkdir -p include - @cp ../../*.h include - -lib: - @[ -d $@ ] || mkdir -p $@ - -$(BUILD): lib - @[ -d $@ ] || mkdir -p $@ - @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile - -#--------------------------------------------------------------------------------- -clean: - @echo clean ... - @rm -fr $(BUILD) lib - -#--------------------------------------------------------------------------------- -else - -DEPENDS := $(OFILES:.o=.d) - -#--------------------------------------------------------------------------------- -# main targets -#--------------------------------------------------------------------------------- -$(OUTPUT) : $(OFILES) - -#--------------------------------------------------------------------------------- -%.bin.o : %.bin -#--------------------------------------------------------------------------------- - @echo $(notdir $<) - @$(bin2o) - - --include $(DEPENDS) - -#--------------------------------------------------------------------------------------- -endif -#--------------------------------------------------------------------------------------- diff --git a/compat/zlib/nintendods/README b/compat/zlib/nintendods/README deleted file mode 100644 index ba7a37d..0000000 --- a/compat/zlib/nintendods/README +++ /dev/null @@ -1,5 +0,0 @@ -This Makefile requires devkitARM (http://www.devkitpro.org/category/devkitarm/) and works inside "contrib/nds". It is based on a devkitARM template. - -Eduardo Costa -January 3, 2009 - diff --git a/compat/zlib/old/Makefile.emx b/compat/zlib/old/Makefile.emx deleted file mode 100644 index 612b037..0000000 --- a/compat/zlib/old/Makefile.emx +++ /dev/null @@ -1,69 +0,0 @@ -# Makefile for zlib. Modified for emx/rsxnt by Chr. Spieler, 6/16/98. -# Copyright (C) 1995-1998 Jean-loup Gailly. -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile, or to compile and test, type: -# -# make -fmakefile.emx; make test -fmakefile.emx -# - -CC=gcc -Zwin32 - -#CFLAGS=-MMD -O -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-MMD -g -DZLIB_DEBUG -CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ - -Wstrict-prototypes -Wmissing-prototypes - -# If cp.exe is available, replace "copy /Y" with "cp -fp" . -CP=copy /Y -# If gnu install.exe is available, replace $(CP) with ginstall. -INSTALL=$(CP) -# The default value of RM is "rm -f." If "rm.exe" is found, comment out: -RM=del -LDLIBS=-L. -lzlib -LD=$(CC) -s -o -LDSHARED=$(CC) - -INCL=zlib.h zconf.h -LIBS=zlib.a - -AR=ar rcs - -prefix=/usr/local -exec_prefix = $(prefix) - -OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \ - gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o - -TEST_OBJS = example.o minigzip.o - -all: example.exe minigzip.exe - -test: all - ./example - echo hello world | .\minigzip | .\minigzip -d - -%.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - -zlib.a: $(OBJS) - $(AR) $@ $(OBJS) - -%.exe : %.o $(LIBS) - $(LD) $@ $< $(LDLIBS) - - -.PHONY : clean - -clean: - $(RM) *.d - $(RM) *.o - $(RM) *.exe - $(RM) zlib.a - $(RM) foo.gz - -DEPS := $(wildcard *.d) -ifneq ($(DEPS),) -include $(DEPS) -endif diff --git a/compat/zlib/old/Makefile.riscos b/compat/zlib/old/Makefile.riscos deleted file mode 100644 index 57e29d3..0000000 --- a/compat/zlib/old/Makefile.riscos +++ /dev/null @@ -1,151 +0,0 @@ -# Project: zlib_1_03 -# Patched for zlib 1.1.2 rw@shadow.org.uk 19980430 -# test works out-of-the-box, installs `somewhere' on demand - -# Toolflags: -CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah -C++flags = -c -depend !Depend -IC: -throwback -Linkflags = -aif -c++ -o $@ -ObjAsmflags = -throwback -NoCache -depend !Depend -CMHGflags = -LibFileflags = -c -l -o $@ -Squeezeflags = -o $@ - -# change the line below to where _you_ want the library installed. -libdest = lib:zlib - -# Final targets: -@.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \ - @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \ - @.o.uncompr @.o.zutil - LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \ - @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \ - @.o.trees @.o.uncompr @.o.zutil -test: @.minigzip @.example @.lib - @copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV - @echo running tests: hang on. - @/@.minigzip -f -9 libc - @/@.minigzip -d libc-gz - @/@.minigzip -f -1 libc - @/@.minigzip -d libc-gz - @/@.minigzip -h -9 libc - @/@.minigzip -d libc-gz - @/@.minigzip -h -1 libc - @/@.minigzip -d libc-gz - @/@.minigzip -9 libc - @/@.minigzip -d libc-gz - @/@.minigzip -1 libc - @/@.minigzip -d libc-gz - @diff @.lib @.libc - @echo that should have reported '@.lib and @.libc identical' if you have diff. - @/@.example @.fred @.fred - @echo that will have given lots of hello!'s. - -@.minigzip: @.o.minigzip @.lib C:o.Stubs - Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs -@.example: @.o.example @.lib C:o.Stubs - Link $(Linkflags) @.o.example @.lib C:o.Stubs - -install: @.lib - cdir $(libdest) - cdir $(libdest).h - @copy @.h.zlib $(libdest).h.zlib A~C~DF~L~N~P~Q~RS~TV - @copy @.h.zconf $(libdest).h.zconf A~C~DF~L~N~P~Q~RS~TV - @copy @.lib $(libdest).lib A~C~DF~L~N~P~Q~RS~TV - @echo okay, installed zlib in $(libdest) - -clean:; remove @.minigzip - remove @.example - remove @.libc - -wipe @.o.* F~r~cV - remove @.fred - -# User-editable dependencies: -.c.o: - cc $(ccflags) -o $@ $< - -# Static dependencies: - -# Dynamic dependencies: -o.example: c.example -o.example: h.zlib -o.example: h.zconf -o.minigzip: c.minigzip -o.minigzip: h.zlib -o.minigzip: h.zconf -o.adler32: c.adler32 -o.adler32: h.zlib -o.adler32: h.zconf -o.compress: c.compress -o.compress: h.zlib -o.compress: h.zconf -o.crc32: c.crc32 -o.crc32: h.zlib -o.crc32: h.zconf -o.deflate: c.deflate -o.deflate: h.deflate -o.deflate: h.zutil -o.deflate: h.zlib -o.deflate: h.zconf -o.gzio: c.gzio -o.gzio: h.zutil -o.gzio: h.zlib -o.gzio: h.zconf -o.infblock: c.infblock -o.infblock: h.zutil -o.infblock: h.zlib -o.infblock: h.zconf -o.infblock: h.infblock -o.infblock: h.inftrees -o.infblock: h.infcodes -o.infblock: h.infutil -o.infcodes: c.infcodes -o.infcodes: h.zutil -o.infcodes: h.zlib -o.infcodes: h.zconf -o.infcodes: h.inftrees -o.infcodes: h.infblock -o.infcodes: h.infcodes -o.infcodes: h.infutil -o.infcodes: h.inffast -o.inffast: c.inffast -o.inffast: h.zutil -o.inffast: h.zlib -o.inffast: h.zconf -o.inffast: h.inftrees -o.inffast: h.infblock -o.inffast: h.infcodes -o.inffast: h.infutil -o.inffast: h.inffast -o.inflate: c.inflate -o.inflate: h.zutil -o.inflate: h.zlib -o.inflate: h.zconf -o.inflate: h.infblock -o.inftrees: c.inftrees -o.inftrees: h.zutil -o.inftrees: h.zlib -o.inftrees: h.zconf -o.inftrees: h.inftrees -o.inftrees: h.inffixed -o.infutil: c.infutil -o.infutil: h.zutil -o.infutil: h.zlib -o.infutil: h.zconf -o.infutil: h.infblock -o.infutil: h.inftrees -o.infutil: h.infcodes -o.infutil: h.infutil -o.trees: c.trees -o.trees: h.deflate -o.trees: h.zutil -o.trees: h.zlib -o.trees: h.zconf -o.trees: h.trees -o.uncompr: c.uncompr -o.uncompr: h.zlib -o.uncompr: h.zconf -o.zutil: c.zutil -o.zutil: h.zutil -o.zutil: h.zlib -o.zutil: h.zconf diff --git a/compat/zlib/old/README b/compat/zlib/old/README deleted file mode 100644 index 800bf07..0000000 --- a/compat/zlib/old/README +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains files that have not been updated for zlib 1.2.x - -(Volunteers are encouraged to help clean this up. Thanks.) diff --git a/compat/zlib/old/descrip.mms b/compat/zlib/old/descrip.mms deleted file mode 100644 index 7066da5..0000000 --- a/compat/zlib/old/descrip.mms +++ /dev/null @@ -1,48 +0,0 @@ -# descrip.mms: MMS description file for building zlib on VMS -# written by Martin P.J. Zinser - -cc_defs = -c_deb = - -.ifdef __DECC__ -pref = /prefix=all -.endif - -OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj,\ - deflate.obj, trees.obj, zutil.obj, inflate.obj, infblock.obj,\ - inftrees.obj, infcodes.obj, infutil.obj, inffast.obj - -CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF) - -all : example.exe minigzip.exe - @ write sys$output " Example applications available" -libz.olb : libz.olb($(OBJS)) - @ write sys$output " libz available" - -example.exe : example.obj libz.olb - link example,libz.olb/lib - -minigzip.exe : minigzip.obj libz.olb - link minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib - -clean : - delete *.obj;*,libz.olb;* - - -# Other dependencies. -adler32.obj : zutil.h zlib.h zconf.h -compress.obj : zlib.h zconf.h -crc32.obj : zutil.h zlib.h zconf.h -deflate.obj : deflate.h zutil.h zlib.h zconf.h -example.obj : zlib.h zconf.h -gzio.obj : zutil.h zlib.h zconf.h -infblock.obj : zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h -infcodes.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h -inffast.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h -inflate.obj : zutil.h zlib.h zconf.h infblock.h -inftrees.obj : zutil.h zlib.h zconf.h inftrees.h -infutil.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h -minigzip.obj : zlib.h zconf.h -trees.obj : deflate.h zutil.h zlib.h zconf.h -uncompr.obj : zlib.h zconf.h -zutil.obj : zutil.h zlib.h zconf.h diff --git a/compat/zlib/old/os2/Makefile.os2 b/compat/zlib/old/os2/Makefile.os2 deleted file mode 100644 index bb426c0..0000000 --- a/compat/zlib/old/os2/Makefile.os2 +++ /dev/null @@ -1,136 +0,0 @@ -# Makefile for zlib under OS/2 using GCC (PGCC) -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile and test, type: -# cp Makefile.os2 .. -# cd .. -# make -f Makefile.os2 test - -# This makefile will build a static library z.lib, a shared library -# z.dll and a import library zdll.lib. You can use either z.lib or -# zdll.lib by specifying either -lz or -lzdll on gcc's command line - -CC=gcc -Zomf -s - -CFLAGS=-O6 -Wall -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-g -DZLIB_DEBUG -#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ -# -Wstrict-prototypes -Wmissing-prototypes - -#################### BUG WARNING: ##################### -## infcodes.c hits a bug in pgcc-1.0, so you have to use either -## -O# where # <= 4 or one of (-fno-ommit-frame-pointer or -fno-force-mem) -## This bug is reportedly fixed in pgcc >1.0, but this was not tested -CFLAGS+=-fno-force-mem - -LDFLAGS=-s -L. -lzdll -Zcrtdll -LDSHARED=$(CC) -s -Zomf -Zdll -Zcrtdll - -VER=1.1.0 -ZLIB=z.lib -SHAREDLIB=z.dll -SHAREDLIBIMP=zdll.lib -LIBS=$(ZLIB) $(SHAREDLIB) $(SHAREDLIBIMP) - -AR=emxomfar cr -IMPLIB=emximp -RANLIB=echo -TAR=tar -SHELL=bash - -prefix=/usr/local -exec_prefix = $(prefix) - -OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ - zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o - -TEST_OBJS = example.o minigzip.o - -DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \ - algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ - nt/Makefile.nt nt/zlib.dnt contrib/README.contrib contrib/*.txt \ - contrib/asm386/*.asm contrib/asm386/*.c \ - contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \ - contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ - contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 - -all: example.exe minigzip.exe - -test: all - @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ - echo hello world | ./minigzip | ./minigzip -d || \ - echo ' *** minigzip test FAILED ***' ; \ - if ./example; then \ - echo ' *** zlib test OK ***'; \ - else \ - echo ' *** zlib test FAILED ***'; \ - fi - -$(ZLIB): $(OBJS) - $(AR) $@ $(OBJS) - -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 - -$(SHAREDLIB): $(OBJS) os2/z.def - $(LDSHARED) -o $@ $^ - -$(SHAREDLIBIMP): os2/z.def - $(IMPLIB) -o $@ $^ - -example.exe: example.o $(LIBS) - $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) - -minigzip.exe: minigzip.o $(LIBS) - $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) - -clean: - rm -f *.o *~ example minigzip libz.a libz.so* foo.gz - -distclean: clean - -zip: - mv Makefile Makefile~; cp -p Makefile.in Makefile - rm -f test.c ztest*.c - v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ - zip -ul9 zlib$$v $(DISTFILES) - mv Makefile~ Makefile - -dist: - mv Makefile Makefile~; cp -p Makefile.in Makefile - rm -f test.c ztest*.c - d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ - rm -f $$d.tar.gz; \ - if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \ - files=""; \ - for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \ - cd ..; \ - GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \ - if test ! -d $$d; then rm -f $$d; fi - mv Makefile~ Makefile - -tags: - etags *.[ch] - -depend: - makedepend -- $(CFLAGS) -- *.[ch] - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -adler32.o: zlib.h zconf.h -compress.o: zlib.h zconf.h -crc32.o: zlib.h zconf.h -deflate.o: deflate.h zutil.h zlib.h zconf.h -example.o: zlib.h zconf.h -gzio.o: zutil.h zlib.h zconf.h -infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h -infcodes.o: zutil.h zlib.h zconf.h -infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h -inffast.o: zutil.h zlib.h zconf.h inftrees.h -inffast.o: infblock.h infcodes.h infutil.h inffast.h -inflate.o: zutil.h zlib.h zconf.h infblock.h -inftrees.o: zutil.h zlib.h zconf.h inftrees.h -infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h -minigzip.o: zlib.h zconf.h -trees.o: deflate.h zutil.h zlib.h zconf.h trees.h -uncompr.o: zlib.h zconf.h -zutil.o: zutil.h zlib.h zconf.h diff --git a/compat/zlib/old/os2/zlib.def b/compat/zlib/old/os2/zlib.def deleted file mode 100644 index 4c753f1..0000000 --- a/compat/zlib/old/os2/zlib.def +++ /dev/null @@ -1,51 +0,0 @@ -; -; Slightly modified version of ../nt/zlib.dnt :-) -; - -LIBRARY Z -DESCRIPTION "Zlib compression library for OS/2" -CODE PRELOAD MOVEABLE DISCARDABLE -DATA PRELOAD MOVEABLE MULTIPLE - -EXPORTS - adler32 - compress - crc32 - deflate - deflateCopy - deflateEnd - deflateInit2_ - deflateInit_ - deflateParams - deflateReset - deflateSetDictionary - gzclose - gzdopen - gzerror - gzflush - gzopen - gzread - gzwrite - inflate - inflateEnd - inflateInit2_ - inflateInit_ - inflateReset - inflateSetDictionary - inflateSync - uncompress - zlibVersion - gzprintf - gzputc - gzgetc - gzseek - gzrewind - gztell - gzeof - gzsetparams - zError - inflateSyncPoint - get_crc_table - compress2 - gzputs - gzgets diff --git a/compat/zlib/old/visual-basic.txt b/compat/zlib/old/visual-basic.txt deleted file mode 100644 index 57efe58..0000000 --- a/compat/zlib/old/visual-basic.txt +++ /dev/null @@ -1,160 +0,0 @@ -See below some functions declarations for Visual Basic. - -Frequently Asked Question: - -Q: Each time I use the compress function I get the -5 error (not enough - room in the output buffer). - -A: Make sure that the length of the compressed buffer is passed by - reference ("as any"), not by value ("as long"). Also check that - before the call of compress this length is equal to the total size of - the compressed buffer and not zero. - - -From: "Jon Caruana" -Subject: Re: How to port zlib declares to vb? -Date: Mon, 28 Oct 1996 18:33:03 -0600 - -Got the answer! (I haven't had time to check this but it's what I got, and -looks correct): - -He has the following routines working: - compress - uncompress - gzopen - gzwrite - gzread - gzclose - -Declares follow: (Quoted from Carlos Rios , in Vb4 form) - -#If Win16 Then 'Use Win16 calls. -Declare Function compress Lib "ZLIB.DLL" (ByVal compr As - String, comprLen As Any, ByVal buf As String, ByVal buflen - As Long) As Integer -Declare Function uncompress Lib "ZLIB.DLL" (ByVal uncompr - As String, uncomprLen As Any, ByVal compr As String, ByVal - lcompr As Long) As Integer -Declare Function gzopen Lib "ZLIB.DLL" (ByVal filePath As - String, ByVal mode As String) As Long -Declare Function gzread Lib "ZLIB.DLL" (ByVal file As - Long, ByVal uncompr As String, ByVal uncomprLen As Integer) - As Integer -Declare Function gzwrite Lib "ZLIB.DLL" (ByVal file As - Long, ByVal uncompr As String, ByVal uncomprLen As Integer) - As Integer -Declare Function gzclose Lib "ZLIB.DLL" (ByVal file As - Long) As Integer -#Else -Declare Function compress Lib "ZLIB32.DLL" - (ByVal compr As String, comprLen As Any, ByVal buf As - String, ByVal buflen As Long) As Integer -Declare Function uncompress Lib "ZLIB32.DLL" - (ByVal uncompr As String, uncomprLen As Any, ByVal compr As - String, ByVal lcompr As Long) As Long -Declare Function gzopen Lib "ZLIB32.DLL" - (ByVal file As String, ByVal mode As String) As Long -Declare Function gzread Lib "ZLIB32.DLL" - (ByVal file As Long, ByVal uncompr As String, ByVal - uncomprLen As Long) As Long -Declare Function gzwrite Lib "ZLIB32.DLL" - (ByVal file As Long, ByVal uncompr As String, ByVal - uncomprLen As Long) As Long -Declare Function gzclose Lib "ZLIB32.DLL" - (ByVal file As Long) As Long -#End If - --Jon Caruana -jon-net@usa.net -Microsoft Sitebuilder Network Level 1 Member - HTML Writer's Guild Member - - -Here is another example from Michael that he -says conforms to the VB guidelines, and that solves the problem of not -knowing the uncompressed size by storing it at the end of the file: - -'Calling the functions: -'bracket meaning: [optional] {Range of possible values} -'Call subCompressFile( [, , [level of compression {1..9}]]) -'Call subUncompressFile() - -Option Explicit -Private lngpvtPcnSml As Long 'Stores value for 'lngPercentSmaller' -Private Const SUCCESS As Long = 0 -Private Const strFilExt As String = ".cpr" -Private Declare Function lngfncCpr Lib "zlib.dll" Alias "compress2" (ByRef -dest As Any, ByRef destLen As Any, ByRef src As Any, ByVal srcLen As Long, -ByVal level As Integer) As Long -Private Declare Function lngfncUcp Lib "zlib.dll" Alias "uncompress" (ByRef -dest As Any, ByRef destLen As Any, ByRef src As Any, ByVal srcLen As Long) -As Long - -Public Sub subCompressFile(ByVal strargOriFilPth As String, Optional ByVal -strargCprFilPth As String, Optional ByVal intLvl As Integer = 9) - Dim strCprPth As String - Dim lngOriSiz As Long - Dim lngCprSiz As Long - Dim bytaryOri() As Byte - Dim bytaryCpr() As Byte - lngOriSiz = FileLen(strargOriFilPth) - ReDim bytaryOri(lngOriSiz - 1) - Open strargOriFilPth For Binary Access Read As #1 - Get #1, , bytaryOri() - Close #1 - strCprPth = IIf(strargCprFilPth = "", strargOriFilPth, strargCprFilPth) -'Select file path and name - strCprPth = strCprPth & IIf(Right(strCprPth, Len(strFilExt)) = -strFilExt, "", strFilExt) 'Add file extension if not exists - lngCprSiz = (lngOriSiz * 1.01) + 12 'Compression needs temporary a bit -more space then original file size - ReDim bytaryCpr(lngCprSiz - 1) - If lngfncCpr(bytaryCpr(0), lngCprSiz, bytaryOri(0), lngOriSiz, intLvl) = -SUCCESS Then - lngpvtPcnSml = (1# - (lngCprSiz / lngOriSiz)) * 100 - ReDim Preserve bytaryCpr(lngCprSiz - 1) - Open strCprPth For Binary Access Write As #1 - Put #1, , bytaryCpr() - Put #1, , lngOriSiz 'Add the the original size value to the end -(last 4 bytes) - Close #1 - Else - MsgBox "Compression error" - End If - Erase bytaryCpr - Erase bytaryOri -End Sub - -Public Sub subUncompressFile(ByVal strargFilPth As String) - Dim bytaryCpr() As Byte - Dim bytaryOri() As Byte - Dim lngOriSiz As Long - Dim lngCprSiz As Long - Dim strOriPth As String - lngCprSiz = FileLen(strargFilPth) - ReDim bytaryCpr(lngCprSiz - 1) - Open strargFilPth For Binary Access Read As #1 - Get #1, , bytaryCpr() - Close #1 - 'Read the original file size value: - lngOriSiz = bytaryCpr(lngCprSiz - 1) * (2 ^ 24) _ - + bytaryCpr(lngCprSiz - 2) * (2 ^ 16) _ - + bytaryCpr(lngCprSiz - 3) * (2 ^ 8) _ - + bytaryCpr(lngCprSiz - 4) - ReDim Preserve bytaryCpr(lngCprSiz - 5) 'Cut of the original size value - ReDim bytaryOri(lngOriSiz - 1) - If lngfncUcp(bytaryOri(0), lngOriSiz, bytaryCpr(0), lngCprSiz) = SUCCESS -Then - strOriPth = Left(strargFilPth, Len(strargFilPth) - Len(strFilExt)) - Open strOriPth For Binary Access Write As #1 - Put #1, , bytaryOri() - Close #1 - Else - MsgBox "Uncompression error" - End If - Erase bytaryCpr - Erase bytaryOri -End Sub -Public Property Get lngPercentSmaller() As Long - lngPercentSmaller = lngpvtPcnSml -End Property diff --git a/compat/zlib/os400/README400 b/compat/zlib/os400/README400 deleted file mode 100644 index 4f98334..0000000 --- a/compat/zlib/os400/README400 +++ /dev/null @@ -1,48 +0,0 @@ - ZLIB version 1.2.11 for OS/400 installation instructions - -1) Download and unpack the zlib tarball to some IFS directory. - (i.e.: /path/to/the/zlib/ifs/source/directory) - - If the installed IFS command suppors gzip format, this is straightforward, -else you have to unpack first to some directory on a system supporting it, -then move the whole directory to the IFS via the network (via SMB or FTP). - -2) Edit the configuration parameters in the compilation script. - - EDTF STMF('/path/to/the/zlib/ifs/source/directory/os400/make.sh') - -Tune the parameters according to your needs if not matching the defaults. -Save the file and exit after edition. - -3) Enter qshell, then work in the zlib OS/400 specific directory. - - QSH - cd /path/to/the/zlib/ifs/source/directory/os400 - -4) Compile and install - - sh make.sh - -The script will: -- create the libraries, objects and IFS directories for the zlib environment, -- compile all modules, -- create a service program, -- create a static and a dynamic binding directory, -- install header files for C/C++ and for ILE/RPG, both for compilation in - DB2 and IFS environments. - -That's all. - - -Notes: For OS/400 ILE RPG programmers, a /copy member defining the ZLIB - API prototypes for ILE RPG can be found in ZLIB/H(ZLIB.INC). - In the ILE environment, the same definitions are available from - file zlib.inc located in the same IFS include directory as the - C/C++ header files. - Please read comments in this member for more information. - - Remember that most foreign textual data are ASCII coded: this - implementation does not handle conversion from/to ASCII, so - text data code conversions must be done explicitely. - - Mainly for the reason above, always open zipped files in binary mode. diff --git a/compat/zlib/os400/bndsrc b/compat/zlib/os400/bndsrc deleted file mode 100644 index 5e6e0a2..0000000 --- a/compat/zlib/os400/bndsrc +++ /dev/null @@ -1,119 +0,0 @@ -STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB') - -/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ -/* Version 1.1.3 entry points. */ -/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ - - EXPORT SYMBOL("adler32") - EXPORT SYMBOL("compress") - EXPORT SYMBOL("compress2") - EXPORT SYMBOL("crc32") - EXPORT SYMBOL("get_crc_table") - EXPORT SYMBOL("deflate") - EXPORT SYMBOL("deflateEnd") - EXPORT SYMBOL("deflateSetDictionary") - EXPORT SYMBOL("deflateCopy") - EXPORT SYMBOL("deflateReset") - EXPORT SYMBOL("deflateParams") - EXPORT SYMBOL("deflatePrime") - EXPORT SYMBOL("deflateInit_") - EXPORT SYMBOL("deflateInit2_") - EXPORT SYMBOL("gzopen") - EXPORT SYMBOL("gzdopen") - EXPORT SYMBOL("gzsetparams") - EXPORT SYMBOL("gzread") - EXPORT SYMBOL("gzwrite") - EXPORT SYMBOL("gzprintf") - EXPORT SYMBOL("gzputs") - EXPORT SYMBOL("gzgets") - EXPORT SYMBOL("gzputc") - EXPORT SYMBOL("gzgetc") - EXPORT SYMBOL("gzflush") - EXPORT SYMBOL("gzseek") - EXPORT SYMBOL("gzrewind") - EXPORT SYMBOL("gztell") - EXPORT SYMBOL("gzeof") - EXPORT SYMBOL("gzclose") - EXPORT SYMBOL("gzerror") - EXPORT SYMBOL("inflate") - EXPORT SYMBOL("inflateEnd") - EXPORT SYMBOL("inflateSetDictionary") - EXPORT SYMBOL("inflateSync") - EXPORT SYMBOL("inflateReset") - EXPORT SYMBOL("inflateInit_") - EXPORT SYMBOL("inflateInit2_") - EXPORT SYMBOL("inflateSyncPoint") - EXPORT SYMBOL("uncompress") - EXPORT SYMBOL("zlibVersion") - EXPORT SYMBOL("zError") - EXPORT SYMBOL("z_errmsg") - -/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ -/* Version 1.2.1 additional entry points. */ -/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ - - EXPORT SYMBOL("compressBound") - EXPORT SYMBOL("deflateBound") - EXPORT SYMBOL("deflatePending") - EXPORT SYMBOL("gzungetc") - EXPORT SYMBOL("gzclearerr") - EXPORT SYMBOL("inflateBack") - EXPORT SYMBOL("inflateBackEnd") - EXPORT SYMBOL("inflateBackInit_") - EXPORT SYMBOL("inflateCopy") - EXPORT SYMBOL("zlibCompileFlags") - -/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ -/* Version 1.2.4 additional entry points. */ -/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ - - EXPORT SYMBOL("adler32_combine") - EXPORT SYMBOL("adler32_combine64") - EXPORT SYMBOL("crc32_combine") - EXPORT SYMBOL("crc32_combine64") - EXPORT SYMBOL("deflateSetHeader") - EXPORT SYMBOL("deflateTune") - EXPORT SYMBOL("gzbuffer") - EXPORT SYMBOL("gzclose_r") - EXPORT SYMBOL("gzclose_w") - EXPORT SYMBOL("gzdirect") - EXPORT SYMBOL("gzoffset") - EXPORT SYMBOL("gzoffset64") - EXPORT SYMBOL("gzopen64") - EXPORT SYMBOL("gzseek64") - EXPORT SYMBOL("gztell64") - EXPORT SYMBOL("inflateGetHeader") - EXPORT SYMBOL("inflateMark") - EXPORT SYMBOL("inflatePrime") - EXPORT SYMBOL("inflateReset2") - EXPORT SYMBOL("inflateUndermine") - -/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ -/* Version 1.2.6 additional entry points. */ -/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ - - EXPORT SYMBOL("deflateResetKeep") - EXPORT SYMBOL("gzgetc_") - EXPORT SYMBOL("inflateResetKeep") - -/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ -/* Version 1.2.8 additional entry points. */ -/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ - - EXPORT SYMBOL("gzvprintf") - EXPORT SYMBOL("inflateGetDictionary") - -/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ -/* Version 1.2.9 additional entry points. */ -/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/ - - EXPORT SYMBOL("adler32_z") - EXPORT SYMBOL("crc32_z") - EXPORT SYMBOL("deflateGetDictionary") - EXPORT SYMBOL("gzfread") - EXPORT SYMBOL("gzfwrite") - EXPORT SYMBOL("inflateCodesUsed") - EXPORT SYMBOL("inflateValidate") - EXPORT SYMBOL("uncompress2") - -ENDPGMEXP diff --git a/compat/zlib/os400/make.sh b/compat/zlib/os400/make.sh deleted file mode 100644 index 19eec11..0000000 --- a/compat/zlib/os400/make.sh +++ /dev/null @@ -1,366 +0,0 @@ -#!/bin/sh -# -# ZLIB compilation script for the OS/400. -# -# -# This is a shell script since make is not a standard component of OS/400. - - -################################################################################ -# -# Tunable configuration parameters. -# -################################################################################ - -TARGETLIB='ZLIB' # Target OS/400 program library -STATBNDDIR='ZLIB_A' # Static binding directory. -DYNBNDDIR='ZLIB' # Dynamic binding directory. -SRVPGM="ZLIB" # Service program. -IFSDIR='/zlib' # IFS support base directory. -TGTCCSID='500' # Target CCSID of objects -DEBUG='*NONE' # Debug level -OPTIMIZE='40' # Optimisation level -OUTPUT='*NONE' # Compilation output option. -TGTRLS='V6R1M0' # Target OS release - -export TARGETLIB STATBNDDIR DYNBNDDIR SRVPGM IFSDIR -export TGTCCSID DEBUG OPTIMIZE OUTPUT TGTRLS - - -################################################################################ -# -# OS/400 specific definitions. -# -################################################################################ - -LIBIFSNAME="/QSYS.LIB/${TARGETLIB}.LIB" - - -################################################################################ -# -# Procedures. -# -################################################################################ - -# action_needed dest [src] -# -# dest is an object to build -# if specified, src is an object on which dest depends. -# -# exit 0 (succeeds) if some action has to be taken, else 1. - -action_needed() - -{ - [ ! -e "${1}" ] && return 0 - [ "${2}" ] || return 1 - [ "${1}" -ot "${2}" ] && return 0 - return 1 -} - - -# make_module module_name source_name [additional_definitions] -# -# Compile source name into module if needed. -# As side effect, append the module name to variable MODULES. -# Set LINK to "YES" if the module has been compiled. - -make_module() - -{ - MODULES="${MODULES} ${1}" - MODIFSNAME="${LIBIFSNAME}/${1}.MODULE" - CSRC="`basename \"${2}\"`" - - if action_needed "${MODIFSNAME}" "${2}" - then : - elif [ ! "`sed -e \"//,/<\\\\/source>/!d\" \ - -e '/ tmphdrfile - - # Need to translate to target CCSID. - - CMD="CPY OBJ('`pwd`/tmphdrfile') TOOBJ('${DEST}')" - CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)" - system "${CMD}" - # touch -r "${HFILE}" "${DEST}" - rm -f tmphdrfile - fi - - IFSFILE="${IFSDIR}/include/`basename \"${HFILE}\"`" - - if action_needed "${IFSFILE}" "${DEST}" - then rm -f "${IFSFILE}" - ln -s "${DEST}" "${IFSFILE}" - fi -done - - -# Install the ILE/RPG header file. - - -HFILE="${SCRIPTDIR}/zlib.inc" -DEST="${SRCPF}/ZLIB.INC.MBR" - -if action_needed "${DEST}" "${HFILE}" -then CMD="CPY OBJ('${HFILE}') TOOBJ('${DEST}')" - CMD="${CMD} TOCCSID(${TGTCCSID}) DTAFMT(*TEXT) REPLACE(*YES)" - system "${CMD}" - # touch -r "${HFILE}" "${DEST}" -fi - -IFSFILE="${IFSDIR}/include/`basename \"${HFILE}\"`" - -if action_needed "${IFSFILE}" "${DEST}" -then rm -f "${IFSFILE}" - ln -s "${DEST}" "${IFSFILE}" -fi - - -# Create and compile the identification source file. - -echo '#pragma comment(user, "ZLIB version '"${VERSION}"'")' > os400.c -echo '#pragma comment(user, __DATE__)' >> os400.c -echo '#pragma comment(user, __TIME__)' >> os400.c -echo '#pragma comment(copyright, "Copyright (C) 1995-2017 Jean-Loup Gailly, Mark Adler. OS/400 version by P. Monnerat.")' >> os400.c -make_module OS400 os400.c -LINK= # No need to rebuild service program yet. -MODULES= - - -# Get source list. - -CSOURCES=`sed -e '/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Library - - Medium - - 2.0 - - - - zlib - zlib - alain.bonnefoy@icbt.com - Public - public - www.gzip.org/zlib - - - Jean-Loup Gailly,Mark Adler - www.gzip.org/zlib - - zlib@gzip.org - - - A massively spiffy yet delicately unobtrusive compression library. - zlib is designed to be a free, general-purpose, legally unencumbered, lossless data compression library for use on virtually any computer hardware and operating system. - http://www.gzip.org/zlib - - - - - 1.2.11 - Medium - Stable - - - - - - - No License - - - - Software Development/Libraries and Extensions/C Libraries - zlib,compression - qnx6 - qnx6 - None - Developer - - - - - - - - - - - - - - Install - Post - No - Ignore - - No - Optional - - - - - - - - - - - - - InstallOver - zlib - - - - - - - - - - - - - InstallOver - zlib-dev - - - - - - - - - diff --git a/compat/zlib/test/example.c b/compat/zlib/test/example.c deleted file mode 100644 index eee17ce..0000000 --- a/compat/zlib/test/example.c +++ /dev/null @@ -1,602 +0,0 @@ -/* example.c -- usage example of the zlib compression library - * Copyright (C) 1995-2006, 2011, 2016 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zlib.h" -#include - -#ifdef STDC -# include -# include -#endif - -#if defined(VMS) || defined(RISCOS) -# define TESTFILE "foo-gz" -#else -# define TESTFILE "foo.gz" -#endif - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - fprintf(stderr, "%s error: %d\n", msg, err); \ - exit(1); \ - } \ -} - -static z_const char hello[] = "hello, hello!"; -/* "hello world" would be more standard, but the repeated "hello" - * stresses the compression code better, sorry... - */ - -static const char dictionary[] = "hello"; -static uLong dictId; /* Adler32 value of the dictionary */ - -void test_deflate OF((Byte *compr, uLong comprLen)); -void test_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_large_deflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_large_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_flush OF((Byte *compr, uLong *comprLen)); -void test_sync OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_dict_deflate OF((Byte *compr, uLong comprLen)); -void test_dict_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -int main OF((int argc, char *argv[])); - - -#ifdef Z_SOLO - -void *myalloc OF((void *, unsigned, unsigned)); -void myfree OF((void *, void *)); - -void *myalloc(q, n, m) - void *q; - unsigned n, m; -{ - (void)q; - return calloc(n, m); -} - -void myfree(void *q, void *p) -{ - (void)q; - free(p); -} - -static alloc_func zalloc = myalloc; -static free_func zfree = myfree; - -#else /* !Z_SOLO */ - -static alloc_func zalloc = (alloc_func)0; -static free_func zfree = (free_func)0; - -void test_compress OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_gzio OF((const char *fname, - Byte *uncompr, uLong uncomprLen)); - -/* =========================================================================== - * Test compress() and uncompress() - */ -void test_compress(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - uLong len = (uLong)strlen(hello)+1; - - err = compress(compr, &comprLen, (const Bytef*)hello, len); - CHECK_ERR(err, "compress"); - - strcpy((char*)uncompr, "garbage"); - - err = uncompress(uncompr, &uncomprLen, compr, comprLen); - CHECK_ERR(err, "uncompress"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad uncompress\n"); - exit(1); - } else { - printf("uncompress(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test read/write of .gz files - */ -void test_gzio(fname, uncompr, uncomprLen) - const char *fname; /* compressed file name */ - Byte *uncompr; - uLong uncomprLen; -{ -#ifdef NO_GZCOMPRESS - fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); -#else - int err; - int len = (int)strlen(hello)+1; - gzFile file; - z_off_t pos; - - file = gzopen(fname, "wb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - gzputc(file, 'h'); - if (gzputs(file, "ello") != 4) { - fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); - exit(1); - } - if (gzprintf(file, ", %s!", "hello") != 8) { - fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); - exit(1); - } - gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ - gzclose(file); - - file = gzopen(fname, "rb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - strcpy((char*)uncompr, "garbage"); - - if (gzread(file, uncompr, (unsigned)uncomprLen) != len) { - fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); - exit(1); - } else { - printf("gzread(): %s\n", (char*)uncompr); - } - - pos = gzseek(file, -8L, SEEK_CUR); - if (pos != 6 || gztell(file) != pos) { - fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", - (long)pos, (long)gztell(file)); - exit(1); - } - - if (gzgetc(file) != ' ') { - fprintf(stderr, "gzgetc error\n"); - exit(1); - } - - if (gzungetc(' ', file) != ' ') { - fprintf(stderr, "gzungetc error\n"); - exit(1); - } - - gzgets(file, (char*)uncompr, (int)uncomprLen); - if (strlen((char*)uncompr) != 7) { /* " hello!" */ - fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello + 6)) { - fprintf(stderr, "bad gzgets after gzseek\n"); - exit(1); - } else { - printf("gzgets() after gzseek: %s\n", (char*)uncompr); - } - - gzclose(file); -#endif -} - -#endif /* Z_SOLO */ - -/* =========================================================================== - * Test deflate() with small buffers - */ -void test_deflate(compr, comprLen) - Byte *compr; - uLong comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - uLong len = (uLong)strlen(hello)+1; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.next_out = compr; - - while (c_stream.total_in != len && c_stream.total_out < comprLen) { - c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - } - /* Finish the stream, still forcing small buffers: */ - for (;;) { - c_stream.avail_out = 1; - err = deflate(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - } - - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with small buffers - */ -void test_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = 0; - d_stream.next_out = uncompr; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { - d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "inflate"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate\n"); - exit(1); - } else { - printf("inflate(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test deflate() with large buffers and dynamic change of compression level - */ -void test_large_deflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_BEST_SPEED); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - /* At this point, uncompr is still mostly zeroes, so it should compress - * very well: - */ - c_stream.next_in = uncompr; - c_stream.avail_in = (uInt)uncomprLen; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - if (c_stream.avail_in != 0) { - fprintf(stderr, "deflate not greedy\n"); - exit(1); - } - - /* Feed in already compressed data and switch to no compression: */ - deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); - c_stream.next_in = compr; - c_stream.avail_in = (uInt)comprLen/2; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - /* Switch back to compressing mode: */ - deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); - c_stream.next_in = uncompr; - c_stream.avail_in = (uInt)uncomprLen; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with large buffers - */ -void test_large_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uInt)comprLen; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - for (;;) { - d_stream.next_out = uncompr; /* discard the output */ - d_stream.avail_out = (uInt)uncomprLen; - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "large inflate"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (d_stream.total_out != 2*uncomprLen + comprLen/2) { - fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); - exit(1); - } else { - printf("large_inflate(): OK\n"); - } -} - -/* =========================================================================== - * Test deflate() with full flush - */ -void test_flush(compr, comprLen) - Byte *compr; - uLong *comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - uInt len = (uInt)strlen(hello)+1; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.next_out = compr; - c_stream.avail_in = 3; - c_stream.avail_out = (uInt)*comprLen; - err = deflate(&c_stream, Z_FULL_FLUSH); - CHECK_ERR(err, "deflate"); - - compr[3]++; /* force an error in first compressed block */ - c_stream.avail_in = len - 3; - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - CHECK_ERR(err, "deflate"); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - *comprLen = c_stream.total_out; -} - -/* =========================================================================== - * Test inflateSync() - */ -void test_sync(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = 2; /* just read the zlib header */ - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (uInt)uncomprLen; - - err = inflate(&d_stream, Z_NO_FLUSH); - CHECK_ERR(err, "inflate"); - - d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */ - err = inflateSync(&d_stream); /* but skip the damaged part */ - CHECK_ERR(err, "inflateSync"); - - err = inflate(&d_stream, Z_FINISH); - if (err != Z_DATA_ERROR) { - fprintf(stderr, "inflate should report DATA_ERROR\n"); - /* Because of incorrect adler32 */ - exit(1); - } - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - printf("after inflateSync(): hel%s\n", (char *)uncompr); -} - -/* =========================================================================== - * Test deflate() with preset dictionary - */ -void test_dict_deflate(compr, comprLen) - Byte *compr; - uLong comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_BEST_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - err = deflateSetDictionary(&c_stream, - (const Bytef*)dictionary, (int)sizeof(dictionary)); - CHECK_ERR(err, "deflateSetDictionary"); - - dictId = c_stream.adler; - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.avail_in = (uInt)strlen(hello)+1; - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with a preset dictionary - */ -void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uInt)comprLen; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (uInt)uncomprLen; - - for (;;) { - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - if (err == Z_NEED_DICT) { - if (d_stream.adler != dictId) { - fprintf(stderr, "unexpected dictionary"); - exit(1); - } - err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, - (int)sizeof(dictionary)); - } - CHECK_ERR(err, "inflate with dict"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate with dict\n"); - exit(1); - } else { - printf("inflate with dictionary: %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Usage: example [output.gz [input.gz]] - */ - -int main(argc, argv) - int argc; - char *argv[]; -{ - Byte *compr, *uncompr; - uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ - uLong uncomprLen = comprLen; - static const char* myVersion = ZLIB_VERSION; - - if (zlibVersion()[0] != myVersion[0]) { - fprintf(stderr, "incompatible zlib version\n"); - exit(1); - - } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { - fprintf(stderr, "warning: different zlib version\n"); - } - - printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n", - ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags()); - - compr = (Byte*)calloc((uInt)comprLen, 1); - uncompr = (Byte*)calloc((uInt)uncomprLen, 1); - /* compr and uncompr are cleared to avoid reading uninitialized - * data and to ensure that uncompr compresses well. - */ - if (compr == Z_NULL || uncompr == Z_NULL) { - printf("out of memory\n"); - exit(1); - } - -#ifdef Z_SOLO - (void)argc; - (void)argv; -#else - test_compress(compr, comprLen, uncompr, uncomprLen); - - test_gzio((argc > 1 ? argv[1] : TESTFILE), - uncompr, uncomprLen); -#endif - - test_deflate(compr, comprLen); - test_inflate(compr, comprLen, uncompr, uncomprLen); - - test_large_deflate(compr, comprLen, uncompr, uncomprLen); - test_large_inflate(compr, comprLen, uncompr, uncomprLen); - - test_flush(compr, &comprLen); - test_sync(compr, comprLen, uncompr, uncomprLen); - comprLen = uncomprLen; - - test_dict_deflate(compr, comprLen); - test_dict_inflate(compr, comprLen, uncompr, uncomprLen); - - free(compr); - free(uncompr); - - return 0; -} diff --git a/compat/zlib/test/infcover.c b/compat/zlib/test/infcover.c deleted file mode 100644 index 2be0164..0000000 --- a/compat/zlib/test/infcover.c +++ /dev/null @@ -1,671 +0,0 @@ -/* infcover.c -- test zlib's inflate routines with full code coverage - * Copyright (C) 2011, 2016 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* to use, do: ./configure --cover && make cover */ - -#include -#include -#include -#include -#include "zlib.h" - -/* get definition of internal structure so we can mess with it (see pull()), - and so we can call inflate_trees() (see cover5()) */ -#define ZLIB_INTERNAL -#include "inftrees.h" -#include "inflate.h" - -#define local static - -/* -- memory tracking routines -- */ - -/* - These memory tracking routines are provided to zlib and track all of zlib's - allocations and deallocations, check for LIFO operations, keep a current - and high water mark of total bytes requested, optionally set a limit on the - total memory that can be allocated, and when done check for memory leaks. - - They are used as follows: - - z_stream strm; - mem_setup(&strm) initializes the memory tracking and sets the - zalloc, zfree, and opaque members of strm to use - memory tracking for all zlib operations on strm - mem_limit(&strm, limit) sets a limit on the total bytes requested -- a - request that exceeds this limit will result in an - allocation failure (returns NULL) -- setting the - limit to zero means no limit, which is the default - after mem_setup() - mem_used(&strm, "msg") prints to stderr "msg" and the total bytes used - mem_high(&strm, "msg") prints to stderr "msg" and the high water mark - mem_done(&strm, "msg") ends memory tracking, releases all allocations - for the tracking as well as leaked zlib blocks, if - any. If there was anything unusual, such as leaked - blocks, non-FIFO frees, or frees of addresses not - allocated, then "msg" and information about the - problem is printed to stderr. If everything is - normal, nothing is printed. mem_done resets the - strm members to Z_NULL to use the default memory - allocation routines on the next zlib initialization - using strm. - */ - -/* these items are strung together in a linked list, one for each allocation */ -struct mem_item { - void *ptr; /* pointer to allocated memory */ - size_t size; /* requested size of allocation */ - struct mem_item *next; /* pointer to next item in list, or NULL */ -}; - -/* this structure is at the root of the linked list, and tracks statistics */ -struct mem_zone { - struct mem_item *first; /* pointer to first item in list, or NULL */ - size_t total, highwater; /* total allocations, and largest total */ - size_t limit; /* memory allocation limit, or 0 if no limit */ - int notlifo, rogue; /* counts of non-LIFO frees and rogue frees */ -}; - -/* memory allocation routine to pass to zlib */ -local void *mem_alloc(void *mem, unsigned count, unsigned size) -{ - void *ptr; - struct mem_item *item; - struct mem_zone *zone = mem; - size_t len = count * (size_t)size; - - /* induced allocation failure */ - if (zone == NULL || (zone->limit && zone->total + len > zone->limit)) - return NULL; - - /* perform allocation using the standard library, fill memory with a - non-zero value to make sure that the code isn't depending on zeros */ - ptr = malloc(len); - if (ptr == NULL) - return NULL; - memset(ptr, 0xa5, len); - - /* create a new item for the list */ - item = malloc(sizeof(struct mem_item)); - if (item == NULL) { - free(ptr); - return NULL; - } - item->ptr = ptr; - item->size = len; - - /* insert item at the beginning of the list */ - item->next = zone->first; - zone->first = item; - - /* update the statistics */ - zone->total += item->size; - if (zone->total > zone->highwater) - zone->highwater = zone->total; - - /* return the allocated memory */ - return ptr; -} - -/* memory free routine to pass to zlib */ -local void mem_free(void *mem, void *ptr) -{ - struct mem_item *item, *next; - struct mem_zone *zone = mem; - - /* if no zone, just do a free */ - if (zone == NULL) { - free(ptr); - return; - } - - /* point next to the item that matches ptr, or NULL if not found -- remove - the item from the linked list if found */ - next = zone->first; - if (next) { - if (next->ptr == ptr) - zone->first = next->next; /* first one is it, remove from list */ - else { - do { /* search the linked list */ - item = next; - next = item->next; - } while (next != NULL && next->ptr != ptr); - if (next) { /* if found, remove from linked list */ - item->next = next->next; - zone->notlifo++; /* not a LIFO free */ - } - - } - } - - /* if found, update the statistics and free the item */ - if (next) { - zone->total -= next->size; - free(next); - } - - /* if not found, update the rogue count */ - else - zone->rogue++; - - /* in any case, do the requested free with the standard library function */ - free(ptr); -} - -/* set up a controlled memory allocation space for monitoring, set the stream - parameters to the controlled routines, with opaque pointing to the space */ -local void mem_setup(z_stream *strm) -{ - struct mem_zone *zone; - - zone = malloc(sizeof(struct mem_zone)); - assert(zone != NULL); - zone->first = NULL; - zone->total = 0; - zone->highwater = 0; - zone->limit = 0; - zone->notlifo = 0; - zone->rogue = 0; - strm->opaque = zone; - strm->zalloc = mem_alloc; - strm->zfree = mem_free; -} - -/* set a limit on the total memory allocation, or 0 to remove the limit */ -local void mem_limit(z_stream *strm, size_t limit) -{ - struct mem_zone *zone = strm->opaque; - - zone->limit = limit; -} - -/* show the current total requested allocations in bytes */ -local void mem_used(z_stream *strm, char *prefix) -{ - struct mem_zone *zone = strm->opaque; - - fprintf(stderr, "%s: %lu allocated\n", prefix, zone->total); -} - -/* show the high water allocation in bytes */ -local void mem_high(z_stream *strm, char *prefix) -{ - struct mem_zone *zone = strm->opaque; - - fprintf(stderr, "%s: %lu high water mark\n", prefix, zone->highwater); -} - -/* release the memory allocation zone -- if there are any surprises, notify */ -local void mem_done(z_stream *strm, char *prefix) -{ - int count = 0; - struct mem_item *item, *next; - struct mem_zone *zone = strm->opaque; - - /* show high water mark */ - mem_high(strm, prefix); - - /* free leftover allocations and item structures, if any */ - item = zone->first; - while (item != NULL) { - free(item->ptr); - next = item->next; - free(item); - item = next; - count++; - } - - /* issue alerts about anything unexpected */ - if (count || zone->total) - fprintf(stderr, "** %s: %lu bytes in %d blocks not freed\n", - prefix, zone->total, count); - if (zone->notlifo) - fprintf(stderr, "** %s: %d frees not LIFO\n", prefix, zone->notlifo); - if (zone->rogue) - fprintf(stderr, "** %s: %d frees not recognized\n", - prefix, zone->rogue); - - /* free the zone and delete from the stream */ - free(zone); - strm->opaque = Z_NULL; - strm->zalloc = Z_NULL; - strm->zfree = Z_NULL; -} - -/* -- inflate test routines -- */ - -/* Decode a hexadecimal string, set *len to length, in[] to the bytes. This - decodes liberally, in that hex digits can be adjacent, in which case two in - a row writes a byte. Or they can be delimited by any non-hex character, - where the delimiters are ignored except when a single hex digit is followed - by a delimiter, where that single digit writes a byte. The returned data is - allocated and must eventually be freed. NULL is returned if out of memory. - If the length is not needed, then len can be NULL. */ -local unsigned char *h2b(const char *hex, unsigned *len) -{ - unsigned char *in, *re; - unsigned next, val; - - in = malloc((strlen(hex) + 1) >> 1); - if (in == NULL) - return NULL; - next = 0; - val = 1; - do { - if (*hex >= '0' && *hex <= '9') - val = (val << 4) + *hex - '0'; - else if (*hex >= 'A' && *hex <= 'F') - val = (val << 4) + *hex - 'A' + 10; - else if (*hex >= 'a' && *hex <= 'f') - val = (val << 4) + *hex - 'a' + 10; - else if (val != 1 && val < 32) /* one digit followed by delimiter */ - val += 240; /* make it look like two digits */ - if (val > 255) { /* have two digits */ - in[next++] = val & 0xff; /* save the decoded byte */ - val = 1; /* start over */ - } - } while (*hex++); /* go through the loop with the terminating null */ - if (len != NULL) - *len = next; - re = realloc(in, next); - return re == NULL ? in : re; -} - -/* generic inflate() run, where hex is the hexadecimal input data, what is the - text to include in an error message, step is how much input data to feed - inflate() on each call, or zero to feed it all, win is the window bits - parameter to inflateInit2(), len is the size of the output buffer, and err - is the error code expected from the first inflate() call (the second - inflate() call is expected to return Z_STREAM_END). If win is 47, then - header information is collected with inflateGetHeader(). If a zlib stream - is looking for a dictionary, then an empty dictionary is provided. - inflate() is run until all of the input data is consumed. */ -local void inf(char *hex, char *what, unsigned step, int win, unsigned len, - int err) -{ - int ret; - unsigned have; - unsigned char *in, *out; - z_stream strm, copy; - gz_header head; - - mem_setup(&strm); - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit2(&strm, win); - if (ret != Z_OK) { - mem_done(&strm, what); - return; - } - out = malloc(len); assert(out != NULL); - if (win == 47) { - head.extra = out; - head.extra_max = len; - head.name = out; - head.name_max = len; - head.comment = out; - head.comm_max = len; - ret = inflateGetHeader(&strm, &head); assert(ret == Z_OK); - } - in = h2b(hex, &have); assert(in != NULL); - if (step == 0 || step > have) - step = have; - strm.avail_in = step; - have -= step; - strm.next_in = in; - do { - strm.avail_out = len; - strm.next_out = out; - ret = inflate(&strm, Z_NO_FLUSH); assert(err == 9 || ret == err); - if (ret != Z_OK && ret != Z_BUF_ERROR && ret != Z_NEED_DICT) - break; - if (ret == Z_NEED_DICT) { - ret = inflateSetDictionary(&strm, in, 1); - assert(ret == Z_DATA_ERROR); - mem_limit(&strm, 1); - ret = inflateSetDictionary(&strm, out, 0); - assert(ret == Z_MEM_ERROR); - mem_limit(&strm, 0); - ((struct inflate_state *)strm.state)->mode = DICT; - ret = inflateSetDictionary(&strm, out, 0); - assert(ret == Z_OK); - ret = inflate(&strm, Z_NO_FLUSH); assert(ret == Z_BUF_ERROR); - } - ret = inflateCopy(©, &strm); assert(ret == Z_OK); - ret = inflateEnd(©); assert(ret == Z_OK); - err = 9; /* don't care next time around */ - have += strm.avail_in; - strm.avail_in = step > have ? have : step; - have -= strm.avail_in; - } while (strm.avail_in); - free(in); - free(out); - ret = inflateReset2(&strm, -8); assert(ret == Z_OK); - ret = inflateEnd(&strm); assert(ret == Z_OK); - mem_done(&strm, what); -} - -/* cover all of the lines in inflate.c up to inflate() */ -local void cover_support(void) -{ - int ret; - z_stream strm; - - mem_setup(&strm); - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit(&strm); assert(ret == Z_OK); - mem_used(&strm, "inflate init"); - ret = inflatePrime(&strm, 5, 31); assert(ret == Z_OK); - ret = inflatePrime(&strm, -1, 0); assert(ret == Z_OK); - ret = inflateSetDictionary(&strm, Z_NULL, 0); - assert(ret == Z_STREAM_ERROR); - ret = inflateEnd(&strm); assert(ret == Z_OK); - mem_done(&strm, "prime"); - - inf("63 0", "force window allocation", 0, -15, 1, Z_OK); - inf("63 18 5", "force window replacement", 0, -8, 259, Z_OK); - inf("63 18 68 30 d0 0 0", "force split window update", 4, -8, 259, Z_OK); - inf("3 0", "use fixed blocks", 0, -15, 1, Z_STREAM_END); - inf("", "bad window size", 0, 1, 0, Z_STREAM_ERROR); - - mem_setup(&strm); - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit_(&strm, ZLIB_VERSION - 1, (int)sizeof(z_stream)); - assert(ret == Z_VERSION_ERROR); - mem_done(&strm, "wrong version"); - - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit(&strm); assert(ret == Z_OK); - ret = inflateEnd(&strm); assert(ret == Z_OK); - fputs("inflate built-in memory routines\n", stderr); -} - -/* cover all inflate() header and trailer cases and code after inflate() */ -local void cover_wrap(void) -{ - int ret; - z_stream strm, copy; - unsigned char dict[257]; - - ret = inflate(Z_NULL, 0); assert(ret == Z_STREAM_ERROR); - ret = inflateEnd(Z_NULL); assert(ret == Z_STREAM_ERROR); - ret = inflateCopy(Z_NULL, Z_NULL); assert(ret == Z_STREAM_ERROR); - fputs("inflate bad parameters\n", stderr); - - inf("1f 8b 0 0", "bad gzip method", 0, 31, 0, Z_DATA_ERROR); - inf("1f 8b 8 80", "bad gzip flags", 0, 31, 0, Z_DATA_ERROR); - inf("77 85", "bad zlib method", 0, 15, 0, Z_DATA_ERROR); - inf("8 99", "set window size from header", 0, 0, 0, Z_OK); - inf("78 9c", "bad zlib window size", 0, 8, 0, Z_DATA_ERROR); - inf("78 9c 63 0 0 0 1 0 1", "check adler32", 0, 15, 1, Z_STREAM_END); - inf("1f 8b 8 1e 0 0 0 0 0 0 1 0 0 0 0 0 0", "bad header crc", 0, 47, 1, - Z_DATA_ERROR); - inf("1f 8b 8 2 0 0 0 0 0 0 1d 26 3 0 0 0 0 0 0 0 0 0", "check gzip length", - 0, 47, 0, Z_STREAM_END); - inf("78 90", "bad zlib header check", 0, 47, 0, Z_DATA_ERROR); - inf("8 b8 0 0 0 1", "need dictionary", 0, 8, 0, Z_NEED_DICT); - inf("78 9c 63 0", "compute adler32", 0, 15, 1, Z_OK); - - mem_setup(&strm); - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit2(&strm, -8); - strm.avail_in = 2; - strm.next_in = (void *)"\x63"; - strm.avail_out = 1; - strm.next_out = (void *)&ret; - mem_limit(&strm, 1); - ret = inflate(&strm, Z_NO_FLUSH); assert(ret == Z_MEM_ERROR); - ret = inflate(&strm, Z_NO_FLUSH); assert(ret == Z_MEM_ERROR); - mem_limit(&strm, 0); - memset(dict, 0, 257); - ret = inflateSetDictionary(&strm, dict, 257); - assert(ret == Z_OK); - mem_limit(&strm, (sizeof(struct inflate_state) << 1) + 256); - ret = inflatePrime(&strm, 16, 0); assert(ret == Z_OK); - strm.avail_in = 2; - strm.next_in = (void *)"\x80"; - ret = inflateSync(&strm); assert(ret == Z_DATA_ERROR); - ret = inflate(&strm, Z_NO_FLUSH); assert(ret == Z_STREAM_ERROR); - strm.avail_in = 4; - strm.next_in = (void *)"\0\0\xff\xff"; - ret = inflateSync(&strm); assert(ret == Z_OK); - (void)inflateSyncPoint(&strm); - ret = inflateCopy(©, &strm); assert(ret == Z_MEM_ERROR); - mem_limit(&strm, 0); - ret = inflateUndermine(&strm, 1); assert(ret == Z_DATA_ERROR); - (void)inflateMark(&strm); - ret = inflateEnd(&strm); assert(ret == Z_OK); - mem_done(&strm, "miscellaneous, force memory errors"); -} - -/* input and output functions for inflateBack() */ -local unsigned pull(void *desc, unsigned char **buf) -{ - static unsigned int next = 0; - static unsigned char dat[] = {0x63, 0, 2, 0}; - struct inflate_state *state; - - if (desc == Z_NULL) { - next = 0; - return 0; /* no input (already provided at next_in) */ - } - state = (void *)((z_stream *)desc)->state; - if (state != Z_NULL) - state->mode = SYNC; /* force an otherwise impossible situation */ - return next < sizeof(dat) ? (*buf = dat + next++, 1) : 0; -} - -local int push(void *desc, unsigned char *buf, unsigned len) -{ - buf += len; - return desc != Z_NULL; /* force error if desc not null */ -} - -/* cover inflateBack() up to common deflate data cases and after those */ -local void cover_back(void) -{ - int ret; - z_stream strm; - unsigned char win[32768]; - - ret = inflateBackInit_(Z_NULL, 0, win, 0, 0); - assert(ret == Z_VERSION_ERROR); - ret = inflateBackInit(Z_NULL, 0, win); assert(ret == Z_STREAM_ERROR); - ret = inflateBack(Z_NULL, Z_NULL, Z_NULL, Z_NULL, Z_NULL); - assert(ret == Z_STREAM_ERROR); - ret = inflateBackEnd(Z_NULL); assert(ret == Z_STREAM_ERROR); - fputs("inflateBack bad parameters\n", stderr); - - mem_setup(&strm); - ret = inflateBackInit(&strm, 15, win); assert(ret == Z_OK); - strm.avail_in = 2; - strm.next_in = (void *)"\x03"; - ret = inflateBack(&strm, pull, Z_NULL, push, Z_NULL); - assert(ret == Z_STREAM_END); - /* force output error */ - strm.avail_in = 3; - strm.next_in = (void *)"\x63\x00"; - ret = inflateBack(&strm, pull, Z_NULL, push, &strm); - assert(ret == Z_BUF_ERROR); - /* force mode error by mucking with state */ - ret = inflateBack(&strm, pull, &strm, push, Z_NULL); - assert(ret == Z_STREAM_ERROR); - ret = inflateBackEnd(&strm); assert(ret == Z_OK); - mem_done(&strm, "inflateBack bad state"); - - ret = inflateBackInit(&strm, 15, win); assert(ret == Z_OK); - ret = inflateBackEnd(&strm); assert(ret == Z_OK); - fputs("inflateBack built-in memory routines\n", stderr); -} - -/* do a raw inflate of data in hexadecimal with both inflate and inflateBack */ -local int try(char *hex, char *id, int err) -{ - int ret; - unsigned len, size; - unsigned char *in, *out, *win; - char *prefix; - z_stream strm; - - /* convert to hex */ - in = h2b(hex, &len); - assert(in != NULL); - - /* allocate work areas */ - size = len << 3; - out = malloc(size); - assert(out != NULL); - win = malloc(32768); - assert(win != NULL); - prefix = malloc(strlen(id) + 6); - assert(prefix != NULL); - - /* first with inflate */ - strcpy(prefix, id); - strcat(prefix, "-late"); - mem_setup(&strm); - strm.avail_in = 0; - strm.next_in = Z_NULL; - ret = inflateInit2(&strm, err < 0 ? 47 : -15); - assert(ret == Z_OK); - strm.avail_in = len; - strm.next_in = in; - do { - strm.avail_out = size; - strm.next_out = out; - ret = inflate(&strm, Z_TREES); - assert(ret != Z_STREAM_ERROR && ret != Z_MEM_ERROR); - if (ret == Z_DATA_ERROR || ret == Z_NEED_DICT) - break; - } while (strm.avail_in || strm.avail_out == 0); - if (err) { - assert(ret == Z_DATA_ERROR); - assert(strcmp(id, strm.msg) == 0); - } - inflateEnd(&strm); - mem_done(&strm, prefix); - - /* then with inflateBack */ - if (err >= 0) { - strcpy(prefix, id); - strcat(prefix, "-back"); - mem_setup(&strm); - ret = inflateBackInit(&strm, 15, win); - assert(ret == Z_OK); - strm.avail_in = len; - strm.next_in = in; - ret = inflateBack(&strm, pull, Z_NULL, push, Z_NULL); - assert(ret != Z_STREAM_ERROR); - if (err) { - assert(ret == Z_DATA_ERROR); - assert(strcmp(id, strm.msg) == 0); - } - inflateBackEnd(&strm); - mem_done(&strm, prefix); - } - - /* clean up */ - free(prefix); - free(win); - free(out); - free(in); - return ret; -} - -/* cover deflate data cases in both inflate() and inflateBack() */ -local void cover_inflate(void) -{ - try("0 0 0 0 0", "invalid stored block lengths", 1); - try("3 0", "fixed", 0); - try("6", "invalid block type", 1); - try("1 1 0 fe ff 0", "stored", 0); - try("fc 0 0", "too many length or distance symbols", 1); - try("4 0 fe ff", "invalid code lengths set", 1); - try("4 0 24 49 0", "invalid bit length repeat", 1); - try("4 0 24 e9 ff ff", "invalid bit length repeat", 1); - try("4 0 24 e9 ff 6d", "invalid code -- missing end-of-block", 1); - try("4 80 49 92 24 49 92 24 71 ff ff 93 11 0", - "invalid literal/lengths set", 1); - try("4 80 49 92 24 49 92 24 f b4 ff ff c3 84", "invalid distances set", 1); - try("4 c0 81 8 0 0 0 0 20 7f eb b 0 0", "invalid literal/length code", 1); - try("2 7e ff ff", "invalid distance code", 1); - try("c c0 81 0 0 0 0 0 90 ff 6b 4 0", "invalid distance too far back", 1); - - /* also trailer mismatch just in inflate() */ - try("1f 8b 8 0 0 0 0 0 0 0 3 0 0 0 0 1", "incorrect data check", -1); - try("1f 8b 8 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 1", - "incorrect length check", -1); - try("5 c0 21 d 0 0 0 80 b0 fe 6d 2f 91 6c", "pull 17", 0); - try("5 e0 81 91 24 cb b2 2c 49 e2 f 2e 8b 9a 47 56 9f fb fe ec d2 ff 1f", - "long code", 0); - try("ed c0 1 1 0 0 0 40 20 ff 57 1b 42 2c 4f", "length extra", 0); - try("ed cf c1 b1 2c 47 10 c4 30 fa 6f 35 1d 1 82 59 3d fb be 2e 2a fc f c", - "long distance and extra", 0); - try("ed c0 81 0 0 0 0 80 a0 fd a9 17 a9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 " - "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6", "window end", 0); - inf("2 8 20 80 0 3 0", "inflate_fast TYPE return", 0, -15, 258, - Z_STREAM_END); - inf("63 18 5 40 c 0", "window wrap", 3, -8, 300, Z_OK); -} - -/* cover remaining lines in inftrees.c */ -local void cover_trees(void) -{ - int ret; - unsigned bits; - unsigned short lens[16], work[16]; - code *next, table[ENOUGH_DISTS]; - - /* we need to call inflate_table() directly in order to manifest not- - enough errors, since zlib insures that enough is always enough */ - for (bits = 0; bits < 15; bits++) - lens[bits] = (unsigned short)(bits + 1); - lens[15] = 15; - next = table; - bits = 15; - ret = inflate_table(DISTS, lens, 16, &next, &bits, work); - assert(ret == 1); - next = table; - bits = 1; - ret = inflate_table(DISTS, lens, 16, &next, &bits, work); - assert(ret == 1); - fputs("inflate_table not enough errors\n", stderr); -} - -/* cover remaining inffast.c decoding and window copying */ -local void cover_fast(void) -{ - inf("e5 e0 81 ad 6d cb b2 2c c9 01 1e 59 63 ae 7d ee fb 4d fd b5 35 41 68" - " ff 7f 0f 0 0 0", "fast length extra bits", 0, -8, 258, Z_DATA_ERROR); - inf("25 fd 81 b5 6d 59 b6 6a 49 ea af 35 6 34 eb 8c b9 f6 b9 1e ef 67 49" - " 50 fe ff ff 3f 0 0", "fast distance extra bits", 0, -8, 258, - Z_DATA_ERROR); - inf("3 7e 0 0 0 0 0", "fast invalid distance code", 0, -8, 258, - Z_DATA_ERROR); - inf("1b 7 0 0 0 0 0", "fast invalid literal/length code", 0, -8, 258, - Z_DATA_ERROR); - inf("d c7 1 ae eb 38 c 4 41 a0 87 72 de df fb 1f b8 36 b1 38 5d ff ff 0", - "fast 2nd level codes and too far back", 0, -8, 258, Z_DATA_ERROR); - inf("63 18 5 8c 10 8 0 0 0 0", "very common case", 0, -8, 259, Z_OK); - inf("63 60 60 18 c9 0 8 18 18 18 26 c0 28 0 29 0 0 0", - "contiguous and wrap around window", 6, -8, 259, Z_OK); - inf("63 0 3 0 0 0 0 0", "copy direct from output", 0, -8, 259, - Z_STREAM_END); -} - -int main(void) -{ - fprintf(stderr, "%s\n", zlibVersion()); - cover_support(); - cover_wrap(); - cover_back(); - cover_inflate(); - cover_trees(); - cover_fast(); - return 0; -} diff --git a/compat/zlib/test/minigzip.c b/compat/zlib/test/minigzip.c deleted file mode 100644 index e22fb08..0000000 --- a/compat/zlib/test/minigzip.c +++ /dev/null @@ -1,651 +0,0 @@ -/* minigzip.c -- simulate gzip using the zlib compression library - * Copyright (C) 1995-2006, 2010, 2011, 2016 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * minigzip is a minimal implementation of the gzip utility. This is - * only an example of using zlib and isn't meant to replace the - * full-featured gzip. No attempt is made to deal with file systems - * limiting names to 14 or 8+3 characters, etc... Error checking is - * very limited. So use minigzip only for testing; use gzip for the - * real thing. On MSDOS, use only on file names without extension - * or in pipe mode. - */ - -/* @(#) $Id$ */ - -#include "zlib.h" -#include - -#ifdef STDC -# include -# include -#endif - -#ifdef USE_MMAP -# include -# include -# include -#endif - -#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) -# include -# include -# ifdef UNDER_CE -# include -# endif -# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif - -#if defined(_MSC_VER) && _MSC_VER < 1900 -# define snprintf _snprintf -#endif - -#ifdef VMS -# define unlink delete -# define GZ_SUFFIX "-gz" -#endif -#ifdef RISCOS -# define unlink remove -# define GZ_SUFFIX "-gz" -# define fileno(file) file->__file -#endif -#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fileno */ -#endif - -#if !defined(Z_HAVE_UNISTD_H) && !defined(_LARGEFILE64_SOURCE) -#ifndef WIN32 /* unlink already in stdio.h for WIN32 */ - extern int unlink OF((const char *)); -#endif -#endif - -#if defined(UNDER_CE) -# include -# define perror(s) pwinerror(s) - -/* Map the Windows error number in ERROR to a locale-dependent error - message string and return a pointer to it. Typically, the values - for ERROR come from GetLastError. - - The string pointed to shall not be modified by the application, - but may be overwritten by a subsequent call to strwinerror - - The strwinerror function does not change the current setting - of GetLastError. */ - -static char *strwinerror (error) - DWORD error; -{ - static char buf[1024]; - - wchar_t *msgbuf; - DWORD lasterr = GetLastError(); - DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, - error, - 0, /* Default language */ - (LPVOID)&msgbuf, - 0, - NULL); - if (chars != 0) { - /* If there is an \r\n appended, zap it. */ - if (chars >= 2 - && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { - chars -= 2; - msgbuf[chars] = 0; - } - - if (chars > sizeof (buf) - 1) { - chars = sizeof (buf) - 1; - msgbuf[chars] = 0; - } - - wcstombs(buf, msgbuf, chars + 1); - LocalFree(msgbuf); - } - else { - sprintf(buf, "unknown win32 error (%ld)", error); - } - - SetLastError(lasterr); - return buf; -} - -static void pwinerror (s) - const char *s; -{ - if (s && *s) - fprintf(stderr, "%s: %s\n", s, strwinerror(GetLastError ())); - else - fprintf(stderr, "%s\n", strwinerror(GetLastError ())); -} - -#endif /* UNDER_CE */ - -#ifndef GZ_SUFFIX -# define GZ_SUFFIX ".gz" -#endif -#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) - -#define BUFLEN 16384 -#define MAX_NAME_LEN 1024 - -#ifdef MAXSEG_64K -# define local static - /* Needed for systems with limitation on stack size. */ -#else -# define local -#endif - -#ifdef Z_SOLO -/* for Z_SOLO, create simplified gz* functions using deflate and inflate */ - -#if defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE) -# include /* for unlink() */ -#endif - -void *myalloc OF((void *, unsigned, unsigned)); -void myfree OF((void *, void *)); - -void *myalloc(q, n, m) - void *q; - unsigned n, m; -{ - (void)q; - return calloc(n, m); -} - -void myfree(q, p) - void *q, *p; -{ - (void)q; - free(p); -} - -typedef struct gzFile_s { - FILE *file; - int write; - int err; - char *msg; - z_stream strm; -} *gzFile; - -gzFile gzopen OF((const char *, const char *)); -gzFile gzdopen OF((int, const char *)); -gzFile gz_open OF((const char *, int, const char *)); - -gzFile gzopen(path, mode) -const char *path; -const char *mode; -{ - return gz_open(path, -1, mode); -} - -gzFile gzdopen(fd, mode) -int fd; -const char *mode; -{ - return gz_open(NULL, fd, mode); -} - -gzFile gz_open(path, fd, mode) - const char *path; - int fd; - const char *mode; -{ - gzFile gz; - int ret; - - gz = malloc(sizeof(struct gzFile_s)); - if (gz == NULL) - return NULL; - gz->write = strchr(mode, 'w') != NULL; - gz->strm.zalloc = myalloc; - gz->strm.zfree = myfree; - gz->strm.opaque = Z_NULL; - if (gz->write) - ret = deflateInit2(&(gz->strm), -1, 8, 15 + 16, 8, 0); - else { - gz->strm.next_in = 0; - gz->strm.avail_in = Z_NULL; - ret = inflateInit2(&(gz->strm), 15 + 16); - } - if (ret != Z_OK) { - free(gz); - return NULL; - } - gz->file = path == NULL ? fdopen(fd, gz->write ? "wb" : "rb") : - fopen(path, gz->write ? "wb" : "rb"); - if (gz->file == NULL) { - gz->write ? deflateEnd(&(gz->strm)) : inflateEnd(&(gz->strm)); - free(gz); - return NULL; - } - gz->err = 0; - gz->msg = ""; - return gz; -} - -int gzwrite OF((gzFile, const void *, unsigned)); - -int gzwrite(gz, buf, len) - gzFile gz; - const void *buf; - unsigned len; -{ - z_stream *strm; - unsigned char out[BUFLEN]; - - if (gz == NULL || !gz->write) - return 0; - strm = &(gz->strm); - strm->next_in = (void *)buf; - strm->avail_in = len; - do { - strm->next_out = out; - strm->avail_out = BUFLEN; - (void)deflate(strm, Z_NO_FLUSH); - fwrite(out, 1, BUFLEN - strm->avail_out, gz->file); - } while (strm->avail_out == 0); - return len; -} - -int gzread OF((gzFile, void *, unsigned)); - -int gzread(gz, buf, len) - gzFile gz; - void *buf; - unsigned len; -{ - int ret; - unsigned got; - unsigned char in[1]; - z_stream *strm; - - if (gz == NULL || gz->write) - return 0; - if (gz->err) - return 0; - strm = &(gz->strm); - strm->next_out = (void *)buf; - strm->avail_out = len; - do { - got = fread(in, 1, 1, gz->file); - if (got == 0) - break; - strm->next_in = in; - strm->avail_in = 1; - ret = inflate(strm, Z_NO_FLUSH); - if (ret == Z_DATA_ERROR) { - gz->err = Z_DATA_ERROR; - gz->msg = strm->msg; - return 0; - } - if (ret == Z_STREAM_END) - inflateReset(strm); - } while (strm->avail_out); - return len - strm->avail_out; -} - -int gzclose OF((gzFile)); - -int gzclose(gz) - gzFile gz; -{ - z_stream *strm; - unsigned char out[BUFLEN]; - - if (gz == NULL) - return Z_STREAM_ERROR; - strm = &(gz->strm); - if (gz->write) { - strm->next_in = Z_NULL; - strm->avail_in = 0; - do { - strm->next_out = out; - strm->avail_out = BUFLEN; - (void)deflate(strm, Z_FINISH); - fwrite(out, 1, BUFLEN - strm->avail_out, gz->file); - } while (strm->avail_out == 0); - deflateEnd(strm); - } - else - inflateEnd(strm); - fclose(gz->file); - free(gz); - return Z_OK; -} - -const char *gzerror OF((gzFile, int *)); - -const char *gzerror(gz, err) - gzFile gz; - int *err; -{ - *err = gz->err; - return gz->msg; -} - -#endif - -static char *prog; - -void error OF((const char *msg)); -void gz_compress OF((FILE *in, gzFile out)); -#ifdef USE_MMAP -int gz_compress_mmap OF((FILE *in, gzFile out)); -#endif -void gz_uncompress OF((gzFile in, FILE *out)); -void file_compress OF((char *file, char *mode)); -void file_uncompress OF((char *file)); -int main OF((int argc, char *argv[])); - -/* =========================================================================== - * Display error message and exit - */ -void error(msg) - const char *msg; -{ - fprintf(stderr, "%s: %s\n", prog, msg); - exit(1); -} - -/* =========================================================================== - * Compress input to output then close both files. - */ - -void gz_compress(in, out) - FILE *in; - gzFile out; -{ - local char buf[BUFLEN]; - int len; - int err; - -#ifdef USE_MMAP - /* Try first compressing with mmap. If mmap fails (minigzip used in a - * pipe), use the normal fread loop. - */ - if (gz_compress_mmap(in, out) == Z_OK) return; -#endif - for (;;) { - len = (int)fread(buf, 1, sizeof(buf), in); - if (ferror(in)) { - perror("fread"); - exit(1); - } - if (len == 0) break; - - if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); - } - fclose(in); - if (gzclose(out) != Z_OK) error("failed gzclose"); -} - -#ifdef USE_MMAP /* MMAP version, Miguel Albrecht */ - -/* Try compressing the input file at once using mmap. Return Z_OK if - * if success, Z_ERRNO otherwise. - */ -int gz_compress_mmap(in, out) - FILE *in; - gzFile out; -{ - int len; - int err; - int ifd = fileno(in); - caddr_t buf; /* mmap'ed buffer for the entire input file */ - off_t buf_len; /* length of the input file */ - struct stat sb; - - /* Determine the size of the file, needed for mmap: */ - if (fstat(ifd, &sb) < 0) return Z_ERRNO; - buf_len = sb.st_size; - if (buf_len <= 0) return Z_ERRNO; - - /* Now do the actual mmap: */ - buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); - if (buf == (caddr_t)(-1)) return Z_ERRNO; - - /* Compress the whole file at once: */ - len = gzwrite(out, (char *)buf, (unsigned)buf_len); - - if (len != (int)buf_len) error(gzerror(out, &err)); - - munmap(buf, buf_len); - fclose(in); - if (gzclose(out) != Z_OK) error("failed gzclose"); - return Z_OK; -} -#endif /* USE_MMAP */ - -/* =========================================================================== - * Uncompress input to output then close both files. - */ -void gz_uncompress(in, out) - gzFile in; - FILE *out; -{ - local char buf[BUFLEN]; - int len; - int err; - - for (;;) { - len = gzread(in, buf, sizeof(buf)); - if (len < 0) error (gzerror(in, &err)); - if (len == 0) break; - - if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { - error("failed fwrite"); - } - } - if (fclose(out)) error("failed fclose"); - - if (gzclose(in) != Z_OK) error("failed gzclose"); -} - - -/* =========================================================================== - * Compress the given file: create a corresponding .gz file and remove the - * original. - */ -void file_compress(file, mode) - char *file; - char *mode; -{ - local char outfile[MAX_NAME_LEN]; - FILE *in; - gzFile out; - - if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) { - fprintf(stderr, "%s: filename too long\n", prog); - exit(1); - } - -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(outfile, sizeof(outfile), "%s%s", file, GZ_SUFFIX); -#else - strcpy(outfile, file); - strcat(outfile, GZ_SUFFIX); -#endif - - in = fopen(file, "rb"); - if (in == NULL) { - perror(file); - exit(1); - } - out = gzopen(outfile, mode); - if (out == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); - exit(1); - } - gz_compress(in, out); - - unlink(file); -} - - -/* =========================================================================== - * Uncompress the given file and remove the original. - */ -void file_uncompress(file) - char *file; -{ - local char buf[MAX_NAME_LEN]; - char *infile, *outfile; - FILE *out; - gzFile in; - unsigned len = strlen(file); - - if (len + strlen(GZ_SUFFIX) >= sizeof(buf)) { - fprintf(stderr, "%s: filename too long\n", prog); - exit(1); - } - -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(buf, sizeof(buf), "%s", file); -#else - strcpy(buf, file); -#endif - - if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { - infile = file; - outfile = buf; - outfile[len-3] = '\0'; - } else { - outfile = file; - infile = buf; -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(buf + len, sizeof(buf) - len, "%s", GZ_SUFFIX); -#else - strcat(infile, GZ_SUFFIX); -#endif - } - in = gzopen(infile, "rb"); - if (in == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); - exit(1); - } - out = fopen(outfile, "wb"); - if (out == NULL) { - perror(file); - exit(1); - } - - gz_uncompress(in, out); - - unlink(infile); -} - - -/* =========================================================================== - * Usage: minigzip [-c] [-d] [-f] [-h] [-r] [-1 to -9] [files...] - * -c : write to standard output - * -d : decompress - * -f : compress with Z_FILTERED - * -h : compress with Z_HUFFMAN_ONLY - * -r : compress with Z_RLE - * -1 to -9 : compression level - */ - -int main(argc, argv) - int argc; - char *argv[]; -{ - int copyout = 0; - int uncompr = 0; - gzFile file; - char *bname, outmode[20]; - -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(outmode, sizeof(outmode), "%s", "wb6 "); -#else - strcpy(outmode, "wb6 "); -#endif - - prog = argv[0]; - bname = strrchr(argv[0], '/'); - if (bname) - bname++; - else - bname = argv[0]; - argc--, argv++; - - if (!strcmp(bname, "gunzip")) - uncompr = 1; - else if (!strcmp(bname, "zcat")) - copyout = uncompr = 1; - - while (argc > 0) { - if (strcmp(*argv, "-c") == 0) - copyout = 1; - else if (strcmp(*argv, "-d") == 0) - uncompr = 1; - else if (strcmp(*argv, "-f") == 0) - outmode[3] = 'f'; - else if (strcmp(*argv, "-h") == 0) - outmode[3] = 'h'; - else if (strcmp(*argv, "-r") == 0) - outmode[3] = 'R'; - else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' && - (*argv)[2] == 0) - outmode[2] = (*argv)[1]; - else - break; - argc--, argv++; - } - if (outmode[3] == ' ') - outmode[3] = 0; - if (argc == 0) { - SET_BINARY_MODE(stdin); - SET_BINARY_MODE(stdout); - if (uncompr) { - file = gzdopen(fileno(stdin), "rb"); - if (file == NULL) error("can't gzdopen stdin"); - gz_uncompress(file, stdout); - } else { - file = gzdopen(fileno(stdout), outmode); - if (file == NULL) error("can't gzdopen stdout"); - gz_compress(stdin, file); - } - } else { - if (copyout) { - SET_BINARY_MODE(stdout); - } - do { - if (uncompr) { - if (copyout) { - file = gzopen(*argv, "rb"); - if (file == NULL) - fprintf(stderr, "%s: can't gzopen %s\n", prog, *argv); - else - gz_uncompress(file, stdout); - } else { - file_uncompress(*argv); - } - } else { - if (copyout) { - FILE * in = fopen(*argv, "rb"); - - if (in == NULL) { - perror(*argv); - } else { - file = gzdopen(fileno(stdout), outmode); - if (file == NULL) error("can't gzdopen stdout"); - - gz_compress(in, file); - } - - } else { - file_compress(*argv, outmode); - } - } - } while (argv++, --argc); - } - return 0; -} diff --git a/compat/zlib/treebuild.xml b/compat/zlib/treebuild.xml deleted file mode 100644 index fd75525..0000000 --- a/compat/zlib/treebuild.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - zip compression library - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/compat/zlib/trees.c b/compat/zlib/trees.c deleted file mode 100644 index 50cf4b4..0000000 --- a/compat/zlib/trees.c +++ /dev/null @@ -1,1203 +0,0 @@ -/* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2017 Jean-loup Gailly - * detect_data_type() function provided freely by Cosmin Truta, 2006 - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process uses several Huffman trees. The more - * common source values are represented by shorter bit sequences. - * - * Each code tree is stored in a compressed form which is itself - * a Huffman encoding of the lengths of all the code strings (in - * ascending order by source values). The actual code strings are - * reconstructed from the lengths in the inflate process, as described - * in the deflate specification. - * - * REFERENCES - * - * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". - * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc - * - * Storer, James A. - * Data Compression: Methods and Theory, pp. 49-50. - * Computer Science Press, 1988. ISBN 0-7167-8156-5. - * - * Sedgewick, R. - * Algorithms, p290. - * Addison-Wesley, 1983. ISBN 0-201-06672-6. - */ - -/* @(#) $Id$ */ - -/* #define GEN_TREES_H */ - -#include "deflate.h" - -#ifdef ZLIB_DEBUG -# include -#endif - -/* =========================================================================== - * Constants - */ - -#define MAX_BL_BITS 7 -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -#define END_BLOCK 256 -/* end of block literal code */ - -#define REP_3_6 16 -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -#define REPZ_3_10 17 -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -#define REPZ_11_138 18 -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ - = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; - -local const int extra_dbits[D_CODES] /* extra bits for each distance code */ - = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; - -local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ - = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; - -local const uch bl_order[BL_CODES] - = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ - -#if defined(GEN_TREES_H) || !defined(STDC) -/* non ANSI compilers may not accept trees.h */ - -local ct_data static_ltree[L_CODES+2]; -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -local ct_data static_dtree[D_CODES]; -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -uch _dist_code[DIST_CODE_LEN]; -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -uch _length_code[MAX_MATCH-MIN_MATCH+1]; -/* length code for each normalized match length (0 == MIN_MATCH) */ - -local int base_length[LENGTH_CODES]; -/* First normalized length for each code (0 = MIN_MATCH) */ - -local int base_dist[D_CODES]; -/* First normalized distance for each code (0 = distance of 1) */ - -#else -# include "trees.h" -#endif /* GEN_TREES_H */ - -struct static_tree_desc_s { - const ct_data *static_tree; /* static tree or NULL */ - const intf *extra_bits; /* extra bits for each code or NULL */ - int extra_base; /* base index for extra_bits */ - int elems; /* max number of elements in the tree */ - int max_length; /* max bit length for the codes */ -}; - -local const static_tree_desc static_l_desc = -{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; - -local const static_tree_desc static_d_desc = -{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; - -local const static_tree_desc static_bl_desc = -{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; - -/* =========================================================================== - * Local (static) routines in this file. - */ - -local void tr_static_init OF((void)); -local void init_block OF((deflate_state *s)); -local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); -local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); -local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); -local void build_tree OF((deflate_state *s, tree_desc *desc)); -local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local int build_bl_tree OF((deflate_state *s)); -local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, - int blcodes)); -local void compress_block OF((deflate_state *s, const ct_data *ltree, - const ct_data *dtree)); -local int detect_data_type OF((deflate_state *s)); -local unsigned bi_reverse OF((unsigned value, int length)); -local void bi_windup OF((deflate_state *s)); -local void bi_flush OF((deflate_state *s)); - -#ifdef GEN_TREES_H -local void gen_trees_header OF((void)); -#endif - -#ifndef ZLIB_DEBUG -# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) - /* Send a code of the given tree. c and tree must not have side effects */ - -#else /* !ZLIB_DEBUG */ -# define send_code(s, c, tree) \ - { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ - send_bits(s, tree[c].Code, tree[c].Len); } -#endif - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -#define put_short(s, w) { \ - put_byte(s, (uch)((w) & 0xff)); \ - put_byte(s, (uch)((ush)(w) >> 8)); \ -} - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -#ifdef ZLIB_DEBUG -local void send_bits OF((deflate_state *s, int value, int length)); - -local void send_bits(s, value, length) - deflate_state *s; - int value; /* value to send */ - int length; /* number of bits */ -{ - Tracevv((stderr," l %2d v %4x ", length, value)); - Assert(length > 0 && length <= 15, "invalid length"); - s->bits_sent += (ulg)length; - - /* If not enough room in bi_buf, use (valid) bits from bi_buf and - * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) - * unused bits in value. - */ - if (s->bi_valid > (int)Buf_size - length) { - s->bi_buf |= (ush)value << s->bi_valid; - put_short(s, s->bi_buf); - s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); - s->bi_valid += length - Buf_size; - } else { - s->bi_buf |= (ush)value << s->bi_valid; - s->bi_valid += length; - } -} -#else /* !ZLIB_DEBUG */ - -#define send_bits(s, value, length) \ -{ int len = length;\ - if (s->bi_valid > (int)Buf_size - len) {\ - int val = (int)value;\ - s->bi_buf |= (ush)val << s->bi_valid;\ - put_short(s, s->bi_buf);\ - s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ - s->bi_valid += len - Buf_size;\ - } else {\ - s->bi_buf |= (ush)(value) << s->bi_valid;\ - s->bi_valid += len;\ - }\ -} -#endif /* ZLIB_DEBUG */ - - -/* the arguments must not have side effects */ - -/* =========================================================================== - * Initialize the various 'constant' tables. - */ -local void tr_static_init() -{ -#if defined(GEN_TREES_H) || !defined(STDC) - static int static_init_done = 0; - int n; /* iterates over tree elements */ - int bits; /* bit counter */ - int length; /* length value */ - int code; /* code value */ - int dist; /* distance index */ - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - if (static_init_done) return; - - /* For some embedded targets, global variables are not initialized: */ -#ifdef NO_INIT_GLOBAL_POINTERS - static_l_desc.static_tree = static_ltree; - static_l_desc.extra_bits = extra_lbits; - static_d_desc.static_tree = static_dtree; - static_d_desc.extra_bits = extra_dbits; - static_bl_desc.extra_bits = extra_blbits; -#endif - - /* Initialize the mapping length (0..255) -> length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES-1; code++) { - base_length[code] = length; - for (n = 0; n < (1< dist code (0..29) */ - dist = 0; - for (code = 0 ; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ - for ( ; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { - _dist_code[256 + dist++] = (uch)code; - } - } - Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; - n = 0; - while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; - while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; - while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; - while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n].Len = 5; - static_dtree[n].Code = bi_reverse((unsigned)n, 5); - } - static_init_done = 1; - -# ifdef GEN_TREES_H - gen_trees_header(); -# endif -#endif /* defined(GEN_TREES_H) || !defined(STDC) */ -} - -/* =========================================================================== - * Genererate the file trees.h describing the static trees. - */ -#ifdef GEN_TREES_H -# ifndef ZLIB_DEBUG -# include -# endif - -# define SEPARATOR(i, last, width) \ - ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width)-1 ? ",\n" : ", ")) - -void gen_trees_header() -{ - FILE *header = fopen("trees.h", "w"); - int i; - - Assert (header != NULL, "Can't open trees.h"); - fprintf(header, - "/* header created automatically with -DGEN_TREES_H */\n\n"); - - fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); - for (i = 0; i < L_CODES+2; i++) { - fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, - static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); - } - - fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, - static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); - } - - fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); - for (i = 0; i < DIST_CODE_LEN; i++) { - fprintf(header, "%2u%s", _dist_code[i], - SEPARATOR(i, DIST_CODE_LEN-1, 20)); - } - - fprintf(header, - "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); - for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { - fprintf(header, "%2u%s", _length_code[i], - SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); - } - - fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); - for (i = 0; i < LENGTH_CODES; i++) { - fprintf(header, "%1u%s", base_length[i], - SEPARATOR(i, LENGTH_CODES-1, 20)); - } - - fprintf(header, "local const int base_dist[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "%5u%s", base_dist[i], - SEPARATOR(i, D_CODES-1, 10)); - } - - fclose(header); -} -#endif /* GEN_TREES_H */ - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -void ZLIB_INTERNAL _tr_init(s) - deflate_state *s; -{ - tr_static_init(); - - s->l_desc.dyn_tree = s->dyn_ltree; - s->l_desc.stat_desc = &static_l_desc; - - s->d_desc.dyn_tree = s->dyn_dtree; - s->d_desc.stat_desc = &static_d_desc; - - s->bl_desc.dyn_tree = s->bl_tree; - s->bl_desc.stat_desc = &static_bl_desc; - - s->bi_buf = 0; - s->bi_valid = 0; -#ifdef ZLIB_DEBUG - s->compressed_len = 0L; - s->bits_sent = 0L; -#endif - - /* Initialize the first block of the first file: */ - init_block(s); -} - -/* =========================================================================== - * Initialize a new block. - */ -local void init_block(s) - deflate_state *s; -{ - int n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; - for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; - for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; - - s->dyn_ltree[END_BLOCK].Freq = 1; - s->opt_len = s->static_len = 0L; - s->last_lit = s->matches = 0; -} - -#define SMALLEST 1 -/* Index within the heap array of least frequent node in the Huffman tree */ - - -/* =========================================================================== - * Remove the smallest element from the heap and recreate the heap with - * one less element. Updates heap and heap_len. - */ -#define pqremove(s, tree, top) \ -{\ - top = s->heap[SMALLEST]; \ - s->heap[SMALLEST] = s->heap[s->heap_len--]; \ - pqdownheap(s, tree, SMALLEST); \ -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -#define smaller(tree, n, m, depth) \ - (tree[n].Freq < tree[m].Freq || \ - (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -local void pqdownheap(s, tree, k) - deflate_state *s; - ct_data *tree; /* the tree to restore */ - int k; /* node to move down */ -{ - int v = s->heap[k]; - int j = k << 1; /* left son of k */ - while (j <= s->heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s->heap_len && - smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s->heap[j], s->depth)) break; - - /* Exchange v with the smallest son */ - s->heap[k] = s->heap[j]; k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s->heap[k] = v; -} - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -local void gen_bitlen(s, desc) - deflate_state *s; - tree_desc *desc; /* the tree descriptor */ -{ - ct_data *tree = desc->dyn_tree; - int max_code = desc->max_code; - const ct_data *stree = desc->stat_desc->static_tree; - const intf *extra = desc->stat_desc->extra_bits; - int base = desc->stat_desc->extra_base; - int max_length = desc->stat_desc->max_length; - int h; /* heap index */ - int n, m; /* iterate over the tree elements */ - int bits; /* bit length */ - int xbits; /* extra bits */ - ush f; /* frequency */ - int overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - - for (h = s->heap_max+1; h < HEAP_SIZE; h++) { - n = s->heap[h]; - bits = tree[tree[n].Dad].Len + 1; - if (bits > max_length) bits = max_length, overflow++; - tree[n].Len = (ush)bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) continue; /* not a leaf node */ - - s->bl_count[bits]++; - xbits = 0; - if (n >= base) xbits = extra[n-base]; - f = tree[n].Freq; - s->opt_len += (ulg)f * (unsigned)(bits + xbits); - if (stree) s->static_len += (ulg)f * (unsigned)(stree[n].Len + xbits); - } - if (overflow == 0) return; - - Tracev((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length-1; - while (s->bl_count[bits] == 0) bits--; - s->bl_count[bits]--; /* move one leaf down the tree */ - s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ - s->bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits != 0; bits--) { - n = s->bl_count[bits]; - while (n != 0) { - m = s->heap[--h]; - if (m > max_code) continue; - if ((unsigned) tree[m].Len != (unsigned) bits) { - Tracev((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s->opt_len += ((ulg)bits - tree[m].Len) * tree[m].Freq; - tree[m].Len = (ush)bits; - } - n--; - } - } -} - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -local void gen_codes (tree, max_code, bl_count) - ct_data *tree; /* the tree to decorate */ - int max_code; /* largest code with non zero frequency */ - ushf *bl_count; /* number of codes at each bit length */ -{ - ush next_code[MAX_BITS+1]; /* next code value for each bit length */ - unsigned code = 0; /* running code value */ - int bits; /* bit index */ - int n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - code = (code + bl_count[bits-1]) << 1; - next_code[bits] = (ush)code; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; - const ct_data *stree = desc->stat_desc->static_tree; - int elems = desc->stat_desc->elems; - int n, m; /* iterate over heap elements */ - int max_code = -1; /* largest code with non zero frequency */ - int node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s->heap_len = 0, s->heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n].Freq != 0) { - s->heap[++(s->heap_len)] = max_code = n; - s->depth[n] = 0; - } else { - tree[n].Len = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s->heap_len < 2) { - node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); - tree[node].Freq = 1; - s->depth[node] = 0; - s->opt_len--; if (stree) s->static_len -= stree[node].Len; - /* node is 0 or 1 so it does not have extra bits */ - } - desc->max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - pqremove(s, tree, n); /* n = node of least frequency */ - m = s->heap[SMALLEST]; /* m = node of next least frequency */ - - s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ - s->heap[--(s->heap_max)] = m; - - /* Create a new node father of n and m */ - tree[node].Freq = tree[n].Freq + tree[m].Freq; - s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? - s->depth[n] : s->depth[m]) + 1); - tree[n].Dad = tree[m].Dad = (ush)node; -#ifdef DUMP_BL_TREE - if (tree == s->bl_tree) { - fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", - node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); - } -#endif - /* and insert the new node in the heap */ - s->heap[SMALLEST] = node++; - pqdownheap(s, tree, SMALLEST); - - } while (s->heap_len >= 2); - - s->heap[--(s->heap_max)] = s->heap[SMALLEST]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, (tree_desc *)desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes ((ct_data *)tree, max_code, s->bl_count); -} - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -local void scan_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - if (nextlen == 0) max_count = 138, min_count = 3; - tree[max_code+1].Len = (ush)0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - s->bl_tree[curlen].Freq += count; - } else if (curlen != 0) { - if (curlen != prevlen) s->bl_tree[curlen].Freq++; - s->bl_tree[REP_3_6].Freq++; - } else if (count <= 10) { - s->bl_tree[REPZ_3_10].Freq++; - } else { - s->bl_tree[REPZ_11_138].Freq++; - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -local void send_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen == 0) max_count = 138, min_count = 3; - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - do { send_code(s, curlen, s->bl_tree); } while (--count != 0); - - } else if (curlen != 0) { - if (curlen != prevlen) { - send_code(s, curlen, s->bl_tree); count--; - } - Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); - - } else { - send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -local int build_bl_tree(s) - deflate_state *s; -{ - int max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); - scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, (tree_desc *)(&(s->bl_desc))); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { - if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; - } - /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*((ulg)max_blindex+1) + 5+5+4; - Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - s->opt_len, s->static_len)); - - return max_blindex; -} - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -local void send_all_trees(s, lcodes, dcodes, blcodes) - deflate_state *s; - int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - int rank; /* index in bl_order */ - - Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - "too many codes"); - Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes-1, 5); - send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); - } - Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ - Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ - Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - -/* =========================================================================== - * Send a stored block - */ -void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) - deflate_state *s; - charf *buf; /* input block */ - ulg stored_len; /* length of input block */ - int last; /* one if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ - bi_windup(s); /* align on byte boundary */ - put_short(s, (ush)stored_len); - put_short(s, (ush)~stored_len); - zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len); - s->pending += stored_len; -#ifdef ZLIB_DEBUG - s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; - s->compressed_len += (stored_len + 4) << 3; - s->bits_sent += 2*16; - s->bits_sent += stored_len<<3; -#endif -} - -/* =========================================================================== - * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) - */ -void ZLIB_INTERNAL _tr_flush_bits(s) - deflate_state *s; -{ - bi_flush(s); -} - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - */ -void ZLIB_INTERNAL _tr_align(s) - deflate_state *s; -{ - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef ZLIB_DEBUG - s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ -#endif - bi_flush(s); -} - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and write out the encoded block. - */ -void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) - deflate_state *s; - charf *buf; /* input block, or NULL if too old */ - ulg stored_len; /* length of input block */ - int last; /* one if this is the last block for a file */ -{ - ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - int max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s->level > 0) { - - /* Check if the file is binary or text */ - if (s->strm->data_type == Z_UNKNOWN) - s->strm->data_type = detect_data_type(s); - - /* Construct the literal and distance trees */ - build_tree(s, (tree_desc *)(&(s->l_desc))); - Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - - build_tree(s, (tree_desc *)(&(s->d_desc))); - Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s->opt_len+3+7)>>3; - static_lenb = (s->static_len+3+7)>>3; - - Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->last_lit)); - - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; - - } else { - Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - -#ifdef FORCE_STORED - if (buf != (char*)0) { /* force stored block */ -#else - if (stored_len+4 <= opt_lenb && buf != (char*)0) { - /* 4: two words for the lengths */ -#endif - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, last); - -#ifdef FORCE_STATIC - } else if (static_lenb >= 0) { /* force static trees */ -#else - } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { -#endif - send_bits(s, (STATIC_TREES<<1)+last, 3); - compress_block(s, (const ct_data *)static_ltree, - (const ct_data *)static_dtree); -#ifdef ZLIB_DEBUG - s->compressed_len += 3 + s->static_len; -#endif - } else { - send_bits(s, (DYN_TREES<<1)+last, 3); - send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, - max_blindex+1); - compress_block(s, (const ct_data *)s->dyn_ltree, - (const ct_data *)s->dyn_dtree); -#ifdef ZLIB_DEBUG - s->compressed_len += 3 + s->opt_len; -#endif - } - Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (last) { - bi_windup(s); -#ifdef ZLIB_DEBUG - s->compressed_len += 7; /* align on byte boundary */ -#endif - } - Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - s->compressed_len-7*last)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -int ZLIB_INTERNAL _tr_tally (s, dist, lc) - deflate_state *s; - unsigned dist; /* distance of matched string */ - unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - s->d_buf[s->last_lit] = (ush)dist; - s->l_buf[s->last_lit++] = (uch)lc; - if (dist == 0) { - /* lc is the unmatched char */ - s->dyn_ltree[lc].Freq++; - } else { - s->matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - Assert((ush)dist < (ush)MAX_DIST(s) && - (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; - s->dyn_dtree[d_code(dist)].Freq++; - } - -#ifdef TRUNCATE_BLOCK - /* Try to guess if it is profitable to stop the current block here */ - if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { - /* Compute an upper bound for the compressed length */ - ulg out_length = (ulg)s->last_lit*8L; - ulg in_length = (ulg)((long)s->strstart - s->block_start); - int dcode; - for (dcode = 0; dcode < D_CODES; dcode++) { - out_length += (ulg)s->dyn_dtree[dcode].Freq * - (5L+extra_dbits[dcode]); - } - out_length >>= 3; - Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - s->last_lit, in_length, out_length, - 100L - out_length*100L/in_length)); - if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; - } -#endif - return (s->last_lit == s->lit_bufsize-1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -local void compress_block(s, ltree, dtree) - deflate_state *s; - const ct_data *ltree; /* literal tree */ - const ct_data *dtree; /* distance tree */ -{ - unsigned dist; /* distance of matched string */ - int lc; /* match length or unmatched char (if dist == 0) */ - unsigned lx = 0; /* running index in l_buf */ - unsigned code; /* the code to send */ - int extra; /* number of extra bits to send */ - - if (s->last_lit != 0) do { - dist = s->d_buf[lx]; - lc = s->l_buf[lx++]; - if (dist == 0) { - send_code(s, lc, ltree); /* send a literal byte */ - Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code+LITERALS+1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra != 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra != 0) { - dist -= (unsigned)base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - "pendingBuf overflow"); - - } while (lx < s->last_lit); - - send_code(s, END_BLOCK, ltree); -} - -/* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -local int detect_data_type(s) - deflate_state *s; -{ - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - unsigned long black_mask = 0xf3ffc07fUL; - int n; - - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>= 1) - if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) - return Z_BINARY; - - /* Check for textual ("white-listed") bytes. */ - if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 - || s->dyn_ltree[13].Freq != 0) - return Z_TEXT; - for (n = 32; n < LITERALS; n++) - if (s->dyn_ltree[n].Freq != 0) - return Z_TEXT; - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -local unsigned bi_reverse(code, len) - unsigned code; /* the value to invert */ - int len; /* its bit length */ -{ - register unsigned res = 0; - do { - res |= code & 1; - code >>= 1, res <<= 1; - } while (--len > 0); - return res >> 1; -} - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -local void bi_flush(s) - deflate_state *s; -{ - if (s->bi_valid == 16) { - put_short(s, s->bi_buf); - s->bi_buf = 0; - s->bi_valid = 0; - } else if (s->bi_valid >= 8) { - put_byte(s, (Byte)s->bi_buf); - s->bi_buf >>= 8; - s->bi_valid -= 8; - } -} - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -local void bi_windup(s) - deflate_state *s; -{ - if (s->bi_valid > 8) { - put_short(s, s->bi_buf); - } else if (s->bi_valid > 0) { - put_byte(s, (Byte)s->bi_buf); - } - s->bi_buf = 0; - s->bi_valid = 0; -#ifdef ZLIB_DEBUG - s->bits_sent = (s->bits_sent+7) & ~7; -#endif -} diff --git a/compat/zlib/trees.h b/compat/zlib/trees.h deleted file mode 100644 index d35639d..0000000 --- a/compat/zlib/trees.h +++ /dev/null @@ -1,128 +0,0 @@ -/* header created automatically with -DGEN_TREES_H */ - -local const ct_data static_ltree[L_CODES+2] = { -{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, -{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, -{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, -{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, -{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, -{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, -{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, -{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, -{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, -{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, -{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, -{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, -{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, -{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, -{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, -{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, -{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, -{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, -{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, -{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, -{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, -{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, -{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, -{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, -{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, -{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, -{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, -{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, -{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, -{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, -{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, -{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, -{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, -{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, -{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, -{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, -{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, -{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, -{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, -{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, -{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, -{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, -{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, -{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, -{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, -{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, -{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, -{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, -{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, -{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, -{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, -{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, -{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, -{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, -{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, -{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, -{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, -{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} -}; - -local const ct_data static_dtree[D_CODES] = { -{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, -{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, -{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, -{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, -{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, -{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} -}; - -const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = { - 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, -10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, -11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, -18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 -}; - -const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, -13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, -17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, -19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 -}; - -local const int base_length[LENGTH_CODES] = { -0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, -64, 80, 96, 112, 128, 160, 192, 224, 0 -}; - -local const int base_dist[D_CODES] = { - 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, - 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, - 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 -}; - diff --git a/compat/zlib/uncompr.c b/compat/zlib/uncompr.c deleted file mode 100644 index f03a1a8..0000000 --- a/compat/zlib/uncompr.c +++ /dev/null @@ -1,93 +0,0 @@ -/* uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -/* =========================================================================== - Decompresses the source buffer into the destination buffer. *sourceLen is - the byte length of the source buffer. Upon entry, *destLen is the total size - of the destination buffer, which must be large enough to hold the entire - uncompressed data. (The size of the uncompressed data must have been saved - previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) Upon exit, - *destLen is the size of the decompressed data and *sourceLen is the number - of source bytes consumed. Upon return, source + *sourceLen points to the - first unused input byte. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, or - Z_DATA_ERROR if the input data was corrupted, including if the input data is - an incomplete zlib stream. -*/ -int ZEXPORT uncompress2 (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong *sourceLen; -{ - z_stream stream; - int err; - const uInt max = (uInt)-1; - uLong len, left; - Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */ - - len = *sourceLen; - if (*destLen) { - left = *destLen; - *destLen = 0; - } - else { - left = 1; - dest = buf; - } - - stream.next_in = (z_const Bytef *)source; - stream.avail_in = 0; - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - stream.opaque = (voidpf)0; - - err = inflateInit(&stream); - if (err != Z_OK) return err; - - stream.next_out = dest; - stream.avail_out = 0; - - do { - if (stream.avail_out == 0) { - stream.avail_out = left > (uLong)max ? max : (uInt)left; - left -= stream.avail_out; - } - if (stream.avail_in == 0) { - stream.avail_in = len > (uLong)max ? max : (uInt)len; - len -= stream.avail_in; - } - err = inflate(&stream, Z_NO_FLUSH); - } while (err == Z_OK); - - *sourceLen -= len + stream.avail_in; - if (dest != buf) - *destLen = stream.total_out; - else if (stream.total_out && err == Z_BUF_ERROR) - left = 1; - - inflateEnd(&stream); - return err == Z_STREAM_END ? Z_OK : - err == Z_NEED_DICT ? Z_DATA_ERROR : - err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR : - err; -} - -int ZEXPORT uncompress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - return uncompress2(dest, destLen, source, &sourceLen); -} diff --git a/compat/zlib/watcom/watcom_f.mak b/compat/zlib/watcom/watcom_f.mak deleted file mode 100644 index 37f4d74..0000000 --- a/compat/zlib/watcom/watcom_f.mak +++ /dev/null @@ -1,43 +0,0 @@ -# Makefile for zlib -# OpenWatcom flat model -# Last updated: 28-Dec-2005 - -# To use, do "wmake -f watcom_f.mak" - -C_SOURCE = adler32.c compress.c crc32.c deflate.c & - gzclose.c gzlib.c gzread.c gzwrite.c & - infback.c inffast.c inflate.c inftrees.c & - trees.c uncompr.c zutil.c - -OBJS = adler32.obj compress.obj crc32.obj deflate.obj & - gzclose.obj gzlib.obj gzread.obj gzwrite.obj & - infback.obj inffast.obj inflate.obj inftrees.obj & - trees.obj uncompr.obj zutil.obj - -CC = wcc386 -LINKER = wcl386 -CFLAGS = -zq -mf -3r -fp3 -s -bt=dos -oilrtfm -fr=nul -wx -ZLIB_LIB = zlib_f.lib - -.C.OBJ: - $(CC) $(CFLAGS) $[@ - -all: $(ZLIB_LIB) example.exe minigzip.exe - -$(ZLIB_LIB): $(OBJS) - wlib -b -c $(ZLIB_LIB) -+adler32.obj -+compress.obj -+crc32.obj - wlib -b -c $(ZLIB_LIB) -+gzclose.obj -+gzlib.obj -+gzread.obj -+gzwrite.obj - wlib -b -c $(ZLIB_LIB) -+deflate.obj -+infback.obj - wlib -b -c $(ZLIB_LIB) -+inffast.obj -+inflate.obj -+inftrees.obj - wlib -b -c $(ZLIB_LIB) -+trees.obj -+uncompr.obj -+zutil.obj - -example.exe: $(ZLIB_LIB) example.obj - $(LINKER) -ldos32a -fe=example.exe example.obj $(ZLIB_LIB) - -minigzip.exe: $(ZLIB_LIB) minigzip.obj - $(LINKER) -ldos32a -fe=minigzip.exe minigzip.obj $(ZLIB_LIB) - -clean: .SYMBOLIC - del *.obj - del $(ZLIB_LIB) - @echo Cleaning done diff --git a/compat/zlib/watcom/watcom_l.mak b/compat/zlib/watcom/watcom_l.mak deleted file mode 100644 index 193eed7..0000000 --- a/compat/zlib/watcom/watcom_l.mak +++ /dev/null @@ -1,43 +0,0 @@ -# Makefile for zlib -# OpenWatcom large model -# Last updated: 28-Dec-2005 - -# To use, do "wmake -f watcom_l.mak" - -C_SOURCE = adler32.c compress.c crc32.c deflate.c & - gzclose.c gzlib.c gzread.c gzwrite.c & - infback.c inffast.c inflate.c inftrees.c & - trees.c uncompr.c zutil.c - -OBJS = adler32.obj compress.obj crc32.obj deflate.obj & - gzclose.obj gzlib.obj gzread.obj gzwrite.obj & - infback.obj inffast.obj inflate.obj inftrees.obj & - trees.obj uncompr.obj zutil.obj - -CC = wcc -LINKER = wcl -CFLAGS = -zq -ml -s -bt=dos -oilrtfm -fr=nul -wx -ZLIB_LIB = zlib_l.lib - -.C.OBJ: - $(CC) $(CFLAGS) $[@ - -all: $(ZLIB_LIB) example.exe minigzip.exe - -$(ZLIB_LIB): $(OBJS) - wlib -b -c $(ZLIB_LIB) -+adler32.obj -+compress.obj -+crc32.obj - wlib -b -c $(ZLIB_LIB) -+gzclose.obj -+gzlib.obj -+gzread.obj -+gzwrite.obj - wlib -b -c $(ZLIB_LIB) -+deflate.obj -+infback.obj - wlib -b -c $(ZLIB_LIB) -+inffast.obj -+inflate.obj -+inftrees.obj - wlib -b -c $(ZLIB_LIB) -+trees.obj -+uncompr.obj -+zutil.obj - -example.exe: $(ZLIB_LIB) example.obj - $(LINKER) -fe=example.exe example.obj $(ZLIB_LIB) - -minigzip.exe: $(ZLIB_LIB) minigzip.obj - $(LINKER) -fe=minigzip.exe minigzip.obj $(ZLIB_LIB) - -clean: .SYMBOLIC - del *.obj - del $(ZLIB_LIB) - @echo Cleaning done diff --git a/compat/zlib/win32/DLL_FAQ.txt b/compat/zlib/win32/DLL_FAQ.txt deleted file mode 100644 index 12c0090..0000000 --- a/compat/zlib/win32/DLL_FAQ.txt +++ /dev/null @@ -1,397 +0,0 @@ - - Frequently Asked Questions about ZLIB1.DLL - - -This document describes the design, the rationale, and the usage -of the official DLL build of zlib, named ZLIB1.DLL. If you have -general questions about zlib, you should see the file "FAQ" found -in the zlib distribution, or at the following location: - http://www.gzip.org/zlib/zlib_faq.html - - - 1. What is ZLIB1.DLL, and how can I get it? - - - ZLIB1.DLL is the official build of zlib as a DLL. - (Please remark the character '1' in the name.) - - Pointers to a precompiled ZLIB1.DLL can be found in the zlib - web site at: - http://www.zlib.net/ - - Applications that link to ZLIB1.DLL can rely on the following - specification: - - * The exported symbols are exclusively defined in the source - files "zlib.h" and "zlib.def", found in an official zlib - source distribution. - * The symbols are exported by name, not by ordinal. - * The exported names are undecorated. - * The calling convention of functions is "C" (CDECL). - * The ZLIB1.DLL binary is linked to MSVCRT.DLL. - - The archive in which ZLIB1.DLL is bundled contains compiled - test programs that must run with a valid build of ZLIB1.DLL. - It is recommended to download the prebuilt DLL from the zlib - web site, instead of building it yourself, to avoid potential - incompatibilities that could be introduced by your compiler - and build settings. If you do build the DLL yourself, please - make sure that it complies with all the above requirements, - and it runs with the precompiled test programs, bundled with - the original ZLIB1.DLL distribution. - - If, for any reason, you need to build an incompatible DLL, - please use a different file name. - - - 2. Why did you change the name of the DLL to ZLIB1.DLL? - What happened to the old ZLIB.DLL? - - - The old ZLIB.DLL, built from zlib-1.1.4 or earlier, required - compilation settings that were incompatible to those used by - a static build. The DLL settings were supposed to be enabled - by defining the macro ZLIB_DLL, before including "zlib.h". - Incorrect handling of this macro was silently accepted at - build time, resulting in two major problems: - - * ZLIB_DLL was missing from the old makefile. When building - the DLL, not all people added it to the build options. In - consequence, incompatible incarnations of ZLIB.DLL started - to circulate around the net. - - * When switching from using the static library to using the - DLL, applications had to define the ZLIB_DLL macro and - to recompile all the sources that contained calls to zlib - functions. Failure to do so resulted in creating binaries - that were unable to run with the official ZLIB.DLL build. - - The only possible solution that we could foresee was to make - a binary-incompatible change in the DLL interface, in order to - remove the dependency on the ZLIB_DLL macro, and to release - the new DLL under a different name. - - We chose the name ZLIB1.DLL, where '1' indicates the major - zlib version number. We hope that we will not have to break - the binary compatibility again, at least not as long as the - zlib-1.x series will last. - - There is still a ZLIB_DLL macro, that can trigger a more - efficient build and use of the DLL, but compatibility no - longer dependents on it. - - - 3. Can I build ZLIB.DLL from the new zlib sources, and replace - an old ZLIB.DLL, that was built from zlib-1.1.4 or earlier? - - - In principle, you can do it by assigning calling convention - keywords to the macros ZEXPORT and ZEXPORTVA. In practice, - it depends on what you mean by "an old ZLIB.DLL", because the - old DLL exists in several mutually-incompatible versions. - You have to find out first what kind of calling convention is - being used in your particular ZLIB.DLL build, and to use the - same one in the new build. If you don't know what this is all - about, you might be better off if you would just leave the old - DLL intact. - - - 4. Can I compile my application using the new zlib interface, and - link it to an old ZLIB.DLL, that was built from zlib-1.1.4 or - earlier? - - - The official answer is "no"; the real answer depends again on - what kind of ZLIB.DLL you have. Even if you are lucky, this - course of action is unreliable. - - If you rebuild your application and you intend to use a newer - version of zlib (post- 1.1.4), it is strongly recommended to - link it to the new ZLIB1.DLL. - - - 5. Why are the zlib symbols exported by name, and not by ordinal? - - - Although exporting symbols by ordinal is a little faster, it - is risky. Any single glitch in the maintenance or use of the - DEF file that contains the ordinals can result in incompatible - builds and frustrating crashes. Simply put, the benefits of - exporting symbols by ordinal do not justify the risks. - - Technically, it should be possible to maintain ordinals in - the DEF file, and still export the symbols by name. Ordinals - exist in every DLL, and even if the dynamic linking performed - at the DLL startup is searching for names, ordinals serve as - hints, for a faster name lookup. However, if the DEF file - contains ordinals, the Microsoft linker automatically builds - an implib that will cause the executables linked to it to use - those ordinals, and not the names. It is interesting to - notice that the GNU linker for Win32 does not suffer from this - problem. - - It is possible to avoid the DEF file if the exported symbols - are accompanied by a "__declspec(dllexport)" attribute in the - source files. You can do this in zlib by predefining the - ZLIB_DLL macro. - - - 6. I see that the ZLIB1.DLL functions use the "C" (CDECL) calling - convention. Why not use the STDCALL convention? - STDCALL is the standard convention in Win32, and I need it in - my Visual Basic project! - - (For readability, we use CDECL to refer to the convention - triggered by the "__cdecl" keyword, STDCALL to refer to - the convention triggered by "__stdcall", and FASTCALL to - refer to the convention triggered by "__fastcall".) - - - Most of the native Windows API functions (without varargs) use - indeed the WINAPI convention (which translates to STDCALL in - Win32), but the standard C functions use CDECL. If a user - application is intrinsically tied to the Windows API (e.g. - it calls native Windows API functions such as CreateFile()), - sometimes it makes sense to decorate its own functions with - WINAPI. But if ANSI C or POSIX portability is a goal (e.g. - it calls standard C functions such as fopen()), it is not a - sound decision to request the inclusion of , or to - use non-ANSI constructs, for the sole purpose to make the user - functions STDCALL-able. - - The functionality offered by zlib is not in the category of - "Windows functionality", but is more like "C functionality". - - Technically, STDCALL is not bad; in fact, it is slightly - faster than CDECL, and it works with variable-argument - functions, just like CDECL. It is unfortunate that, in spite - of using STDCALL in the Windows API, it is not the default - convention used by the C compilers that run under Windows. - The roots of the problem reside deep inside the unsafety of - the K&R-style function prototypes, where the argument types - are not specified; but that is another story for another day. - - The remaining fact is that CDECL is the default convention. - Even if an explicit convention is hard-coded into the function - prototypes inside C headers, problems may appear. The - necessity to expose the convention in users' callbacks is one - of these problems. - - The calling convention issues are also important when using - zlib in other programming languages. Some of them, like Ada - (GNAT) and Fortran (GNU G77), have C bindings implemented - initially on Unix, and relying on the C calling convention. - On the other hand, the pre- .NET versions of Microsoft Visual - Basic require STDCALL, while Borland Delphi prefers, although - it does not require, FASTCALL. - - In fairness to all possible uses of zlib outside the C - programming language, we choose the default "C" convention. - Anyone interested in different bindings or conventions is - encouraged to maintain specialized projects. The "contrib/" - directory from the zlib distribution already holds a couple - of foreign bindings, such as Ada, C++, and Delphi. - - - 7. I need a DLL for my Visual Basic project. What can I do? - - - Define the ZLIB_WINAPI macro before including "zlib.h", when - building both the DLL and the user application (except that - you don't need to define anything when using the DLL in Visual - Basic). The ZLIB_WINAPI macro will switch on the WINAPI - (STDCALL) convention. The name of this DLL must be different - than the official ZLIB1.DLL. - - Gilles Vollant has contributed a build named ZLIBWAPI.DLL, - with the ZLIB_WINAPI macro turned on, and with the minizip - functionality built in. For more information, please read - the notes inside "contrib/vstudio/readme.txt", found in the - zlib distribution. - - - 8. I need to use zlib in my Microsoft .NET project. What can I - do? - - - Henrik Ravn has contributed a .NET wrapper around zlib. Look - into contrib/dotzlib/, inside the zlib distribution. - - - 9. If my application uses ZLIB1.DLL, should I link it to - MSVCRT.DLL? Why? - - - It is not required, but it is recommended to link your - application to MSVCRT.DLL, if it uses ZLIB1.DLL. - - The executables (.EXE, .DLL, etc.) that are involved in the - same process and are using the C run-time library (i.e. they - are calling standard C functions), must link to the same - library. There are several libraries in the Win32 system: - CRTDLL.DLL, MSVCRT.DLL, the static C libraries, etc. - Since ZLIB1.DLL is linked to MSVCRT.DLL, the executables that - depend on it should also be linked to MSVCRT.DLL. - - -10. Why are you saying that ZLIB1.DLL and my application should - be linked to the same C run-time (CRT) library? I linked my - application and my DLLs to different C libraries (e.g. my - application to a static library, and my DLLs to MSVCRT.DLL), - and everything works fine. - - - If a user library invokes only pure Win32 API (accessible via - and the related headers), its DLL build will work - in any context. But if this library invokes standard C API, - things get more complicated. - - There is a single Win32 library in a Win32 system. Every - function in this library resides in a single DLL module, that - is safe to call from anywhere. On the other hand, there are - multiple versions of the C library, and each of them has its - own separate internal state. Standalone executables and user - DLLs that call standard C functions must link to a C run-time - (CRT) library, be it static or shared (DLL). Intermixing - occurs when an executable (not necessarily standalone) and a - DLL are linked to different CRTs, and both are running in the - same process. - - Intermixing multiple CRTs is possible, as long as their - internal states are kept intact. The Microsoft Knowledge Base - articles KB94248 "HOWTO: Use the C Run-Time" and KB140584 - "HOWTO: Link with the Correct C Run-Time (CRT) Library" - mention the potential problems raised by intermixing. - - If intermixing works for you, it's because your application - and DLLs are avoiding the corruption of each of the CRTs' - internal states, maybe by careful design, or maybe by fortune. - - Also note that linking ZLIB1.DLL to non-Microsoft CRTs, such - as those provided by Borland, raises similar problems. - - -11. Why are you linking ZLIB1.DLL to MSVCRT.DLL? - - - MSVCRT.DLL exists on every Windows 95 with a new service pack - installed, or with Microsoft Internet Explorer 4 or later, and - on all other Windows 4.x or later (Windows 98, Windows NT 4, - or later). It is freely distributable; if not present in the - system, it can be downloaded from Microsoft or from other - software provider for free. - - The fact that MSVCRT.DLL does not exist on a virgin Windows 95 - is not so problematic. Windows 95 is scarcely found nowadays, - Microsoft ended its support a long time ago, and many recent - applications from various vendors, including Microsoft, do not - even run on it. Furthermore, no serious user should run - Windows 95 without a proper update installed. - - -12. Why are you not linking ZLIB1.DLL to - <> ? - - - We considered and abandoned the following alternatives: - - * Linking ZLIB1.DLL to a static C library (LIBC.LIB, or - LIBCMT.LIB) is not a good option. People are using the DLL - mainly to save disk space. If you are linking your program - to a static C library, you may as well consider linking zlib - in statically, too. - - * Linking ZLIB1.DLL to CRTDLL.DLL looks appealing, because - CRTDLL.DLL is present on every Win32 installation. - Unfortunately, it has a series of problems: it does not - work properly with Microsoft's C++ libraries, it does not - provide support for 64-bit file offsets, (and so on...), - and Microsoft discontinued its support a long time ago. - - * Linking ZLIB1.DLL to MSVCR70.DLL or MSVCR71.DLL, supplied - with the Microsoft .NET platform, and Visual C++ 7.0/7.1, - raises problems related to the status of ZLIB1.DLL as a - system component. According to the Microsoft Knowledge Base - article KB326922 "INFO: Redistribution of the Shared C - Runtime Component in Visual C++ .NET", MSVCR70.DLL and - MSVCR71.DLL are not supposed to function as system DLLs, - because they may clash with MSVCRT.DLL. Instead, the - application's installer is supposed to put these DLLs - (if needed) in the application's private directory. - If ZLIB1.DLL depends on a non-system runtime, it cannot - function as a redistributable system component. - - * Linking ZLIB1.DLL to non-Microsoft runtimes, such as - Borland's, or Cygwin's, raises problems related to the - reliable presence of these runtimes on Win32 systems. - It's easier to let the DLL build of zlib up to the people - who distribute these runtimes, and who may proceed as - explained in the answer to Question 14. - - -13. If ZLIB1.DLL cannot be linked to MSVCR70.DLL or MSVCR71.DLL, - how can I build/use ZLIB1.DLL in Microsoft Visual C++ 7.0 - (Visual Studio .NET) or newer? - - - Due to the problems explained in the Microsoft Knowledge Base - article KB326922 (see the previous answer), the C runtime that - comes with the VC7 environment is no longer considered a - system component. That is, it should not be assumed that this - runtime exists, or may be installed in a system directory. - Since ZLIB1.DLL is supposed to be a system component, it may - not depend on a non-system component. - - In order to link ZLIB1.DLL and your application to MSVCRT.DLL - in VC7, you need the library of Visual C++ 6.0 or older. If - you don't have this library at hand, it's probably best not to - use ZLIB1.DLL. - - We are hoping that, in the future, Microsoft will provide a - way to build applications linked to a proper system runtime, - from the Visual C++ environment. Until then, you have a - couple of alternatives, such as linking zlib in statically. - If your application requires dynamic linking, you may proceed - as explained in the answer to Question 14. - - -14. I need to link my own DLL build to a CRT different than - MSVCRT.DLL. What can I do? - - - Feel free to rebuild the DLL from the zlib sources, and link - it the way you want. You should, however, clearly state that - your build is unofficial. You should give it a different file - name, and/or install it in a private directory that can be - accessed by your application only, and is not visible to the - others (i.e. it's neither in the PATH, nor in the SYSTEM or - SYSTEM32 directories). Otherwise, your build may clash with - applications that link to the official build. - - For example, in Cygwin, zlib is linked to the Cygwin runtime - CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL. - - -15. May I include additional pieces of code that I find useful, - link them in ZLIB1.DLL, and export them? - - - No. A legitimate build of ZLIB1.DLL must not include code - that does not originate from the official zlib source code. - But you can make your own private DLL build, under a different - file name, as suggested in the previous answer. - - For example, zlib is a part of the VCL library, distributed - with Borland Delphi and C++ Builder. The DLL build of VCL - is a redistributable file, named VCLxx.DLL. - - -16. May I remove some functionality out of ZLIB1.DLL, by enabling - macros like NO_GZCOMPRESS or NO_GZIP at compile time? - - - No. A legitimate build of ZLIB1.DLL must provide the complete - zlib functionality, as implemented in the official zlib source - code. But you can make your own private DLL build, under a - different file name, as suggested in the previous answer. - - -17. I made my own ZLIB1.DLL build. Can I test it for compliance? - - - We prefer that you download the official DLL from the zlib - web site. If you need something peculiar from this DLL, you - can send your suggestion to the zlib mailing list. - - However, in case you do rebuild the DLL yourself, you can run - it with the test programs found in the DLL distribution. - Running these test programs is not a guarantee of compliance, - but a failure can imply a detected problem. - -** - -This document is written and maintained by -Cosmin Truta diff --git a/compat/zlib/win32/Makefile.bor b/compat/zlib/win32/Makefile.bor deleted file mode 100644 index d152bbb..0000000 --- a/compat/zlib/win32/Makefile.bor +++ /dev/null @@ -1,110 +0,0 @@ -# Makefile for zlib -# Borland C++ for Win32 -# -# Usage: -# make -f win32/Makefile.bor -# make -f win32/Makefile.bor LOCAL_ZLIB=-DASMV OBJA=match.obj OBJPA=+match.obj - -# ------------ Borland C++ ------------ - -# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) -# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or -# added to the declaration of LOC here: -LOC = $(LOCAL_ZLIB) - -CC = bcc32 -AS = bcc32 -LD = bcc32 -AR = tlib -CFLAGS = -a -d -k- -O2 $(LOC) -ASFLAGS = $(LOC) -LDFLAGS = $(LOC) - - -# variables -ZLIB_LIB = zlib.lib - -OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj -OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj -#OBJA = -OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj -OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj -#OBJPA= - - -# targets -all: $(ZLIB_LIB) example.exe minigzip.exe - -.c.obj: - $(CC) -c $(CFLAGS) $< - -.asm.obj: - $(AS) -c $(ASFLAGS) $< - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h - -gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h - -gzread.obj: gzread.c zlib.h zconf.h gzguts.h - -gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: test/example.c zlib.h zconf.h - -minigzip.obj: test/minigzip.c zlib.h zconf.h - - -# For the sake of the old Borland make, -# the command line is cut to fit in the MS-DOS 128 byte limit: -$(ZLIB_LIB): $(OBJ1) $(OBJ2) $(OBJA) - -del $(ZLIB_LIB) - $(AR) $(ZLIB_LIB) $(OBJP1) - $(AR) $(ZLIB_LIB) $(OBJP2) - $(AR) $(ZLIB_LIB) $(OBJPA) - - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -example.exe: example.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) - -minigzip.exe: minigzip.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) - - -# cleanup -clean: - -del $(ZLIB_LIB) - -del *.obj - -del *.exe - -del *.tds - -del zlib.bak - -del foo.gz diff --git a/compat/zlib/win32/Makefile.gcc b/compat/zlib/win32/Makefile.gcc deleted file mode 100644 index 305be50..0000000 --- a/compat/zlib/win32/Makefile.gcc +++ /dev/null @@ -1,182 +0,0 @@ -# Makefile for zlib, derived from Makefile.dj2. -# Modified for mingw32 by C. Spieler, 6/16/98. -# Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003. -# Last updated: Mar 2012. -# Tested under Cygwin and MinGW. - -# Copyright (C) 1995-2003 Jean-loup Gailly. -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile, or to compile and test, type from the top level zlib directory: -# -# make -fwin32/Makefile.gcc; make test testdll -fwin32/Makefile.gcc -# -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o -fwin32/Makefile.gcc -# -# To install libz.a, zconf.h and zlib.h in the system directories, type: -# -# make install -fwin32/Makefile.gcc -# -# BINARY_PATH, INCLUDE_PATH and LIBRARY_PATH must be set. -# -# To install the shared lib, append SHARED_MODE=1 to the make command : -# -# make install -fwin32/Makefile.gcc SHARED_MODE=1 - -# Note: -# If the platform is *not* MinGW (e.g. it is Cygwin or UWIN), -# the DLL name should be changed from "zlib1.dll". - -STATICLIB = libz.a -SHAREDLIB = zlib1.dll -IMPLIB = libz.dll.a - -# -# Set to 1 if shared object needs to be installed -# -SHARED_MODE=0 - -#LOC = -DASMV -#LOC = -DZLIB_DEBUG -g - -PREFIX = -CC = $(PREFIX)gcc -CFLAGS = $(LOC) -O3 -Wall - -AS = $(CC) -ASFLAGS = $(LOC) -Wall - -LD = $(CC) -LDFLAGS = $(LOC) - -AR = $(PREFIX)ar -ARFLAGS = rcs - -RC = $(PREFIX)windres -RCFLAGS = --define GCC_WINDRES - -STRIP = $(PREFIX)strip - -CP = cp -fp -# If GNU install is available, replace $(CP) with install. -INSTALL = $(CP) -RM = rm -f - -prefix ?= /usr/local -exec_prefix = $(prefix) - -OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \ - gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o -OBJA = - -all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe - -test: example.exe minigzip.exe - ./example - echo hello world | ./minigzip | ./minigzip -d - -testdll: example_d.exe minigzip_d.exe - ./example_d - echo hello world | ./minigzip_d | ./minigzip_d -d - -.c.o: - $(CC) $(CFLAGS) -c -o $@ $< - -.S.o: - $(AS) $(ASFLAGS) -c -o $@ $< - -$(STATICLIB): $(OBJS) $(OBJA) - $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA) - -$(IMPLIB): $(SHAREDLIB) - -$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o - $(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \ - -o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o - $(STRIP) $@ - -example.exe: example.o $(STATICLIB) - $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB) - $(STRIP) $@ - -minigzip.exe: minigzip.o $(STATICLIB) - $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB) - $(STRIP) $@ - -example_d.exe: example.o $(IMPLIB) - $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB) - $(STRIP) $@ - -minigzip_d.exe: minigzip.o $(IMPLIB) - $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB) - $(STRIP) $@ - -example.o: test/example.c zlib.h zconf.h - $(CC) $(CFLAGS) -I. -c -o $@ test/example.c - -minigzip.o: test/minigzip.c zlib.h zconf.h - $(CC) $(CFLAGS) -I. -c -o $@ test/minigzip.c - -zlibrc.o: win32/zlib1.rc - $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc - -.PHONY: install uninstall clean - -install: zlib.h zconf.h $(STATICLIB) $(IMPLIB) - @if test -z "$(DESTDIR)$(INCLUDE_PATH)" -o -z "$(DESTDIR)$(LIBRARY_PATH)" -o -z "$(DESTDIR)$(BINARY_PATH)"; then \ - echo INCLUDE_PATH, LIBRARY_PATH, and BINARY_PATH must be specified; \ - exit 1; \ - fi - -@mkdir -p '$(DESTDIR)$(INCLUDE_PATH)' - -@mkdir -p '$(DESTDIR)$(LIBRARY_PATH)' '$(DESTDIR)$(LIBRARY_PATH)'/pkgconfig - -if [ "$(SHARED_MODE)" = "1" ]; then \ - mkdir -p '$(DESTDIR)$(BINARY_PATH)'; \ - $(INSTALL) $(SHAREDLIB) '$(DESTDIR)$(BINARY_PATH)'; \ - $(INSTALL) $(IMPLIB) '$(DESTDIR)$(LIBRARY_PATH)'; \ - fi - -$(INSTALL) zlib.h '$(DESTDIR)$(INCLUDE_PATH)' - -$(INSTALL) zconf.h '$(DESTDIR)$(INCLUDE_PATH)' - -$(INSTALL) $(STATICLIB) '$(DESTDIR)$(LIBRARY_PATH)' - sed \ - -e 's|@prefix@|${prefix}|g' \ - -e 's|@exec_prefix@|${exec_prefix}|g' \ - -e 's|@libdir@|$(LIBRARY_PATH)|g' \ - -e 's|@sharedlibdir@|$(LIBRARY_PATH)|g' \ - -e 's|@includedir@|$(INCLUDE_PATH)|g' \ - -e 's|@VERSION@|'`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' zlib.h`'|g' \ - zlib.pc.in > '$(DESTDIR)$(LIBRARY_PATH)'/pkgconfig/zlib.pc - -uninstall: - -if [ "$(SHARED_MODE)" = "1" ]; then \ - $(RM) '$(DESTDIR)$(BINARY_PATH)'/$(SHAREDLIB); \ - $(RM) '$(DESTDIR)$(LIBRARY_PATH)'/$(IMPLIB); \ - fi - -$(RM) '$(DESTDIR)$(INCLUDE_PATH)'/zlib.h - -$(RM) '$(DESTDIR)$(INCLUDE_PATH)'/zconf.h - -$(RM) '$(DESTDIR)$(LIBRARY_PATH)'/$(STATICLIB) - -clean: - -$(RM) $(STATICLIB) - -$(RM) $(SHAREDLIB) - -$(RM) $(IMPLIB) - -$(RM) *.o - -$(RM) *.exe - -$(RM) foo.gz - -adler32.o: zlib.h zconf.h -compress.o: zlib.h zconf.h -crc32.o: crc32.h zlib.h zconf.h -deflate.o: deflate.h zutil.h zlib.h zconf.h -gzclose.o: zlib.h zconf.h gzguts.h -gzlib.o: zlib.h zconf.h gzguts.h -gzread.o: zlib.h zconf.h gzguts.h -gzwrite.o: zlib.h zconf.h gzguts.h -inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inftrees.o: zutil.h zlib.h zconf.h inftrees.h -trees.o: deflate.h zutil.h zlib.h zconf.h trees.h -uncompr.o: zlib.h zconf.h -zutil.o: zutil.h zlib.h zconf.h diff --git a/compat/zlib/win32/Makefile.msc b/compat/zlib/win32/Makefile.msc deleted file mode 100644 index 6831882..0000000 --- a/compat/zlib/win32/Makefile.msc +++ /dev/null @@ -1,163 +0,0 @@ -# Makefile for zlib using Microsoft (Visual) C -# zlib is copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler -# -# Usage: -# nmake -f win32/Makefile.msc (standard build) -# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build) -# nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" \ -# OBJA="inffas32.obj match686.obj" (use ASM code, x86) -# nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -I." \ -# OBJA="inffasx64.obj gvmat64.obj inffas8664.obj" (use ASM code, x64) - -# The toplevel directory of the source tree. -# -TOP = . - -# optional build flags -LOC = - -# variables -STATICLIB = zlib.lib -SHAREDLIB = zlib1.dll -IMPLIB = zdll.lib - -CC = cl -AS = ml -LD = link -AR = lib -RC = rc -CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) -WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -ASFLAGS = -coff -Zi $(LOC) -LDFLAGS = -nologo -debug -incremental:no -opt:ref -ARFLAGS = -nologo -RCFLAGS = /dWIN32 /r - -OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj \ - gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj -OBJA = - - -# targets -all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \ - example.exe minigzip.exe example_d.exe minigzip_d.exe - -$(STATICLIB): $(OBJS) $(OBJA) - $(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA) - -$(IMPLIB): $(SHAREDLIB) - -$(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) $(OBJA) zlib1.res - $(LD) $(LDFLAGS) -def:$(TOP)/win32/zlib.def -dll -implib:$(IMPLIB) \ - -out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;2 - -example.exe: example.obj $(STATICLIB) - $(LD) $(LDFLAGS) example.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip.exe: minigzip.obj $(STATICLIB) - $(LD) $(LDFLAGS) minigzip.obj $(STATICLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -example_d.exe: example.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ example.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -minigzip_d.exe: minigzip.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB) - if exist $@.manifest \ - mt -nologo -manifest $@.manifest -outputresource:$@;1 - -{$(TOP)}.c.obj: - $(CC) -c $(WFLAGS) $(CFLAGS) $< - -{$(TOP)/test}.c.obj: - $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< - -{$(TOP)/contrib/masmx64}.c.obj: - $(CC) -c $(WFLAGS) $(CFLAGS) $< - -{$(TOP)/contrib/masmx64}.asm.obj: - $(AS) -c $(ASFLAGS) $< - -{$(TOP)/contrib/masmx86}.asm.obj: - $(AS) -c $(ASFLAGS) $< - -adler32.obj: $(TOP)/adler32.c $(TOP)/zlib.h $(TOP)/zconf.h - -compress.obj: $(TOP)/compress.c $(TOP)/zlib.h $(TOP)/zconf.h - -crc32.obj: $(TOP)/crc32.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/crc32.h - -deflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h - -gzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h - -gzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h - -gzread.obj: $(TOP)/gzread.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h - -gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h - -infback.obj: $(TOP)/infback.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ - $(TOP)/inffast.h $(TOP)/inffixed.h - -inffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ - $(TOP)/inffast.h - -inflate.obj: $(TOP)/inflate.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ - $(TOP)/inffast.h $(TOP)/inffixed.h - -inftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h - -trees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/deflate.h $(TOP)/trees.h - -uncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib.h $(TOP)/zconf.h - -zutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h - -gvmat64.obj: $(TOP)/contrib\masmx64\gvmat64.asm - -inffasx64.obj: $(TOP)/contrib\masmx64\inffasx64.asm - -inffas8664.obj: $(TOP)/contrib\masmx64\inffas8664.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h \ - $(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inffast.h - -inffas32.obj: $(TOP)/contrib\masmx86\inffas32.asm - -match686.obj: $(TOP)/contrib\masmx86\match686.asm - -example.obj: $(TOP)/test/example.c $(TOP)/zlib.h $(TOP)/zconf.h - -minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib.h $(TOP)/zconf.h - -zlib1.res: $(TOP)/win32/zlib1.rc - $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/zlib1.rc - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -testdll: example_d.exe minigzip_d.exe - example_d - echo hello world | minigzip_d | minigzip_d -d - - -# cleanup -clean: - -del $(STATICLIB) - -del $(SHAREDLIB) - -del $(IMPLIB) - -del *.obj - -del *.res - -del *.exp - -del *.exe - -del *.pdb - -del *.manifest - -del foo.gz diff --git a/compat/zlib/win32/README-WIN32.txt b/compat/zlib/win32/README-WIN32.txt deleted file mode 100644 index df7ab7f..0000000 --- a/compat/zlib/win32/README-WIN32.txt +++ /dev/null @@ -1,103 +0,0 @@ -ZLIB DATA COMPRESSION LIBRARY - -zlib 1.2.11 is a general purpose data compression library. All the code is -thread safe. The data format used by the zlib library is described by RFCs -(Request for Comments) 1950 to 1952 in the files -http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) -and rfc1952.txt (gzip format). - -All functions of the compression library are documented in the file zlib.h -(volunteer to write man pages welcome, contact zlib@gzip.org). Two compiled -examples are distributed in this package, example and minigzip. The example_d -and minigzip_d flavors validate that the zlib1.dll file is working correctly. - -Questions about zlib should be sent to . The zlib home page -is http://zlib.net/ . Before reporting a problem, please check this site to -verify that you have the latest version of zlib; otherwise get the latest -version and check whether the problem still exists or not. - -PLEASE read DLL_FAQ.txt, and the the zlib FAQ http://zlib.net/zlib_faq.html -before asking for help. - - -Manifest: - -The package zlib-1.2.11-win32-x86.zip will contain the following files: - - README-WIN32.txt This document - ChangeLog Changes since previous zlib packages - DLL_FAQ.txt Frequently asked questions about zlib1.dll - zlib.3.pdf Documentation of this library in Adobe Acrobat format - - example.exe A statically-bound example (using zlib.lib, not the dll) - example.pdb Symbolic information for debugging example.exe - - example_d.exe A zlib1.dll bound example (using zdll.lib) - example_d.pdb Symbolic information for debugging example_d.exe - - minigzip.exe A statically-bound test program (using zlib.lib, not the dll) - minigzip.pdb Symbolic information for debugging minigzip.exe - - minigzip_d.exe A zlib1.dll bound test program (using zdll.lib) - minigzip_d.pdb Symbolic information for debugging minigzip_d.exe - - zlib.h Install these files into the compilers' INCLUDE path to - zconf.h compile programs which use zlib.lib or zdll.lib - - zdll.lib Install these files into the compilers' LIB path if linking - zdll.exp a compiled program to the zlib1.dll binary - - zlib.lib Install these files into the compilers' LIB path to link zlib - zlib.pdb into compiled programs, without zlib1.dll runtime dependency - (zlib.pdb provides debugging info to the compile time linker) - - zlib1.dll Install this binary shared library into the system PATH, or - the program's runtime directory (where the .exe resides) - zlib1.pdb Install in the same directory as zlib1.dll, in order to debug - an application crash using WinDbg or similar tools. - -All .pdb files above are entirely optional, but are very useful to a developer -attempting to diagnose program misbehavior or a crash. Many additional -important files for developers can be found in the zlib127.zip source package -available from http://zlib.net/ - review that package's README file for details. - - -Acknowledgments: - -The deflate format used by zlib was defined by Phil Katz. The deflate and -zlib specifications were written by L. Peter Deutsch. Thanks to all the -people who reported problems and suggested various improvements in zlib; they -are too numerous to cite here. - - -Copyright notice: - - (C) 1995-2017 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* receiving -lengthy legal documents to sign. The sources are provided for free but without -warranty of any kind. The library has been entirely written by Jean-loup -Gailly and Mark Adler; it does not include third-party code. - -If you redistribute modified sources, we would appreciate that you include in -the file ChangeLog history information documenting your changes. Please read -the FAQ for more information on the distribution of modified source versions. diff --git a/compat/zlib/win32/README.txt b/compat/zlib/win32/README.txt deleted file mode 100644 index bd3d18d..0000000 --- a/compat/zlib/win32/README.txt +++ /dev/null @@ -1,60 +0,0 @@ - -What's here -=========== - The official ZLIB1.DLL - - -Source -====== - zlib version 1.2.11 - available at http://www.gzip.org/zlib/ - - -Specification and rationale -=========================== - See the accompanying DLL_FAQ.txt - - -Usage -===== - See the accompanying USAGE.txt - - -Build info -========== - Contributed by Jan Nijtmans. - - Compiler: - i686-w64-mingw32-gcc (GCC) 5.4.0 - Library: - mingw64-i686-runtime/headers: 5.0.0 - Build commands: - i686-w64-mingw32-gcc -c -DASMV contrib/asm686/match.S - i686-w64-mingw32-gcc -c -DASMINF -I. -O3 contrib/inflate86/inffas86.c - make -f win32/Makefile.gcc PREFIX=i686-w64-mingw32- LOC="-mms-bitfields -DASMV -DASMINF" OBJA="inffas86.o match.o" - Finally, from VS commandline (VS2005 or higher): - lib -machine:X86 -name:zlib1.dll -def:zlib.def -out:zdll.lib - -Copyright notice -================ - Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - diff --git a/compat/zlib/win32/USAGE.txt b/compat/zlib/win32/USAGE.txt deleted file mode 100644 index 22829eb..0000000 --- a/compat/zlib/win32/USAGE.txt +++ /dev/null @@ -1,97 +0,0 @@ - -Installing ZLIB1.DLL -==================== - Copy ZLIB1.DLL to the SYSTEM or the SYSTEM32 directory. - - If you want to install the 32-bit dll on a 64-bit - machine, use the SysWOW64 directory instead. - - -Using ZLIB1.DLL with Microsoft Visual C++ -========================================= - 1. Install the supplied header files "zlib.h" and "zconf.h" - into a directory found in the INCLUDE path list. - - 2. Install the supplied library file "zdll.lib" into a - directory found in the LIB path list. - - 3. Add "zdll.lib" to your project. - - -Using ZLIB1.DLL with gcc/MinGW -============================== - 1. Install the supplied header files "zlib.h" and "zconf.h" - into the INCLUDE directory. - - 2. (32-bit): Copy the supplied library file "zdll.lib" to "libzdll.a": - cp lib/zdll.lib lib/libzdll.a - - OR - - 2'. (64-bit): Copy the supplied library file "libz.dll.a" to "libzdll.a": - cp lib/libz.dll.a lib/libzdll.a - - OR - - 2'' Build the import library from the supplied "zlib.def": - dlltool -D zlib1.dll -d lib/zlib.def -l lib/libzdll.a - - 3. Install "libzdll.a" into the LIB directory. - - 4. Add "libzdll.a" to your project, or use the -lzdll option. - - -Using ZLIB1.DLL with gcc/Cygwin -=============================== - ZLIB1.DLL is not designed to work with Cygwin. The Cygwin - system has its own DLL build of zlib, named CYGZ.DLL. - - -Using ZLIB1.DLL with Borland C++ -================================ - 1. Install the supplied header files "zlib.h" and "zconf.h" - into a directory found in the INCLUDE path list. - - 2. Build the import library using the IMPLIB tool: - implib -a -c -f lib\zdllbor.lib zlib1.dll - - OR - - 2' Convert the supplied library file "zdll.lib" to OMF format, - using the COFF2OMF tool: - coff2omf lib\zdll.lib lib\zdllbor.lib - - 3. Install "zdllbor.lib" into a directory found in the LIB path - list. - - 4. Add "zdllbor.lib" to your project. - - Notes: - - The modules that are linked with "zdllbor.lib" must be compiled - using a 4-byte alignment (option -a): - bcc32 -a -c myprog.c - bcc32 myprog.obj zdllbor.lib - - If you wish, you may use "zlib1.lib" instead of "zdllbor.lib". - - -Rebuilding ZLIB1.DLL -==================== - Depending on your build environment, use the appropriate - makefile from the win32/ directory, found in the zlib source - distribution. - - Your custom build has to comply with the requirements stated - in DLL_FAQ.txt, including (but not limited to) the following: - - It must be built from an unaltered zlib source distribution. - - It must be linked to MSVCRT.DLL. - - The macros that compile out certain portions of the zlib - code (such as NO_GZCOMPRESS, NO_GZIP) must not be enabled. - - The ZLIB_WINAPI macro must not be enabled. - - Furthermore, it has to run successfully with the test suite - found in this package. - - It is recommended, however, to use the supplied ZLIB1.DLL, - instead of rebuilding it yourself. You should rebuild it - only if you have a special reason. - diff --git a/compat/zlib/win32/VisualC.txt b/compat/zlib/win32/VisualC.txt deleted file mode 100644 index 1005b21..0000000 --- a/compat/zlib/win32/VisualC.txt +++ /dev/null @@ -1,3 +0,0 @@ - -To build zlib using the Microsoft Visual C++ environment, -use the appropriate project from the contrib/vstudio/ directory. diff --git a/compat/zlib/win32/zdll.lib b/compat/zlib/win32/zdll.lib deleted file mode 100755 index a3e9a39..0000000 Binary files a/compat/zlib/win32/zdll.lib and /dev/null differ diff --git a/compat/zlib/win32/zlib.def b/compat/zlib/win32/zlib.def deleted file mode 100644 index 784b138..0000000 --- a/compat/zlib/win32/zlib.def +++ /dev/null @@ -1,94 +0,0 @@ -; zlib data compression library -EXPORTS -; basic functions - zlibVersion - deflate - deflateEnd - inflate - inflateEnd -; advanced functions - deflateSetDictionary - deflateGetDictionary - deflateCopy - deflateReset - deflateParams - deflateTune - deflateBound - deflatePending - deflatePrime - deflateSetHeader - inflateSetDictionary - inflateGetDictionary - inflateSync - inflateCopy - inflateReset - inflateReset2 - inflatePrime - inflateMark - inflateGetHeader - inflateBack - inflateBackEnd - zlibCompileFlags -; utility functions - compress - compress2 - compressBound - uncompress - uncompress2 - gzopen - gzdopen - gzbuffer - gzsetparams - gzread - gzfread - gzwrite - gzfwrite - gzprintf - gzvprintf - gzputs - gzgets - gzputc - gzgetc - gzungetc - gzflush - gzseek - gzrewind - gztell - gzoffset - gzeof - gzdirect - gzclose - gzclose_r - gzclose_w - gzerror - gzclearerr -; large file functions - gzopen64 - gzseek64 - gztell64 - gzoffset64 - adler32_combine64 - crc32_combine64 -; checksum functions - adler32 - adler32_z - crc32 - crc32_z - adler32_combine - crc32_combine -; various hacks, don't look :) - deflateInit_ - deflateInit2_ - inflateInit_ - inflateInit2_ - inflateBackInit_ - gzgetc_ - zError - inflateSyncPoint - get_crc_table - inflateUndermine - inflateValidate - inflateCodesUsed - inflateResetKeep - deflateResetKeep - gzopen_w diff --git a/compat/zlib/win32/zlib1.dll b/compat/zlib/win32/zlib1.dll deleted file mode 100755 index 3196f4a..0000000 Binary files a/compat/zlib/win32/zlib1.dll and /dev/null differ diff --git a/compat/zlib/win32/zlib1.rc b/compat/zlib/win32/zlib1.rc deleted file mode 100644 index 234e641..0000000 --- a/compat/zlib/win32/zlib1.rc +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include "../zlib.h" - -#ifdef GCC_WINDRES -VS_VERSION_INFO VERSIONINFO -#else -VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE -#endif - FILEVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 - PRODUCTVERSION ZLIB_VER_MAJOR,ZLIB_VER_MINOR,ZLIB_VER_REVISION,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS 1 -#else - FILEFLAGS 0 -#endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0 // not used -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - //language ID = U.S. English, char set = Windows, Multilingual - BEGIN - VALUE "FileDescription", "zlib data compression library\0" - VALUE "FileVersion", ZLIB_VERSION "\0" - VALUE "InternalName", "zlib1.dll\0" - VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" - VALUE "OriginalFilename", "zlib1.dll\0" - VALUE "ProductName", "zlib\0" - VALUE "ProductVersion", ZLIB_VERSION "\0" - VALUE "Comments", "For more information visit http://www.zlib.net/\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/compat/zlib/win64/libz.dll.a b/compat/zlib/win64/libz.dll.a deleted file mode 100644 index 93be06e..0000000 Binary files a/compat/zlib/win64/libz.dll.a and /dev/null differ diff --git a/compat/zlib/win64/zdll.lib b/compat/zlib/win64/zdll.lib deleted file mode 100644 index c1be098..0000000 Binary files a/compat/zlib/win64/zdll.lib and /dev/null differ diff --git a/compat/zlib/win64/zlib1.dll b/compat/zlib/win64/zlib1.dll deleted file mode 100755 index 81195c3..0000000 Binary files a/compat/zlib/win64/zlib1.dll and /dev/null differ diff --git a/compat/zlib/zconf.h b/compat/zlib/zconf.h deleted file mode 100644 index 5e1d68a..0000000 --- a/compat/zlib/zconf.h +++ /dev/null @@ -1,534 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - * Even better than compiling with -DZ_PREFIX would be to use configure to set - * this permanently in zconf.h using "./configure --zprefix". - */ -#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ -# define Z_PREFIX_SET - -/* all linked symbols and init macros */ -# define _dist_code z__dist_code -# define _length_code z__length_code -# define _tr_align z__tr_align -# define _tr_flush_bits z__tr_flush_bits -# define _tr_flush_block z__tr_flush_block -# define _tr_init z__tr_init -# define _tr_stored_block z__tr_stored_block -# define _tr_tally z__tr_tally -# define adler32 z_adler32 -# define adler32_combine z_adler32_combine -# define adler32_combine64 z_adler32_combine64 -# define adler32_z z_adler32_z -# ifndef Z_SOLO -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# endif -# define crc32 z_crc32 -# define crc32_combine z_crc32_combine -# define crc32_combine64 z_crc32_combine64 -# define crc32_z z_crc32_z -# define deflate z_deflate -# define deflateBound z_deflateBound -# define deflateCopy z_deflateCopy -# define deflateEnd z_deflateEnd -# define deflateGetDictionary z_deflateGetDictionary -# define deflateInit z_deflateInit -# define deflateInit2 z_deflateInit2 -# define deflateInit2_ z_deflateInit2_ -# define deflateInit_ z_deflateInit_ -# define deflateParams z_deflateParams -# define deflatePending z_deflatePending -# define deflatePrime z_deflatePrime -# define deflateReset z_deflateReset -# define deflateResetKeep z_deflateResetKeep -# define deflateSetDictionary z_deflateSetDictionary -# define deflateSetHeader z_deflateSetHeader -# define deflateTune z_deflateTune -# define deflate_copyright z_deflate_copyright -# define get_crc_table z_get_crc_table -# ifndef Z_SOLO -# define gz_error z_gz_error -# define gz_intmax z_gz_intmax -# define gz_strwinerror z_gz_strwinerror -# define gzbuffer z_gzbuffer -# define gzclearerr z_gzclearerr -# define gzclose z_gzclose -# define gzclose_r z_gzclose_r -# define gzclose_w z_gzclose_w -# define gzdirect z_gzdirect -# define gzdopen z_gzdopen -# define gzeof z_gzeof -# define gzerror z_gzerror -# define gzflush z_gzflush -# define gzfread z_gzfread -# define gzfwrite z_gzfwrite -# define gzgetc z_gzgetc -# define gzgetc_ z_gzgetc_ -# define gzgets z_gzgets -# define gzoffset z_gzoffset -# define gzoffset64 z_gzoffset64 -# define gzopen z_gzopen -# define gzopen64 z_gzopen64 -# ifdef _WIN32 -# define gzopen_w z_gzopen_w -# endif -# define gzprintf z_gzprintf -# define gzputc z_gzputc -# define gzputs z_gzputs -# define gzread z_gzread -# define gzrewind z_gzrewind -# define gzseek z_gzseek -# define gzseek64 z_gzseek64 -# define gzsetparams z_gzsetparams -# define gztell z_gztell -# define gztell64 z_gztell64 -# define gzungetc z_gzungetc -# define gzvprintf z_gzvprintf -# define gzwrite z_gzwrite -# endif -# define inflate z_inflate -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define inflateBackInit z_inflateBackInit -# define inflateBackInit_ z_inflateBackInit_ -# define inflateCodesUsed z_inflateCodesUsed -# define inflateCopy z_inflateCopy -# define inflateEnd z_inflateEnd -# define inflateGetDictionary z_inflateGetDictionary -# define inflateGetHeader z_inflateGetHeader -# define inflateInit z_inflateInit -# define inflateInit2 z_inflateInit2 -# define inflateInit2_ z_inflateInit2_ -# define inflateInit_ z_inflateInit_ -# define inflateMark z_inflateMark -# define inflatePrime z_inflatePrime -# define inflateReset z_inflateReset -# define inflateReset2 z_inflateReset2 -# define inflateResetKeep z_inflateResetKeep -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateUndermine z_inflateUndermine -# define inflateValidate z_inflateValidate -# define inflate_copyright z_inflate_copyright -# define inflate_fast z_inflate_fast -# define inflate_table z_inflate_table -# ifndef Z_SOLO -# define uncompress z_uncompress -# define uncompress2 z_uncompress2 -# endif -# define zError z_zError -# ifndef Z_SOLO -# define zcalloc z_zcalloc -# define zcfree z_zcfree -# endif -# define zlibCompileFlags z_zlibCompileFlags -# define zlibVersion z_zlibVersion - -/* all zlib typedefs in zlib.h and zconf.h */ -# define Byte z_Byte -# define Bytef z_Bytef -# define alloc_func z_alloc_func -# define charf z_charf -# define free_func z_free_func -# ifndef Z_SOLO -# define gzFile z_gzFile -# endif -# define gz_header z_gz_header -# define gz_headerp z_gz_headerp -# define in_func z_in_func -# define intf z_intf -# define out_func z_out_func -# define uInt z_uInt -# define uIntf z_uIntf -# define uLong z_uLong -# define uLongf z_uLongf -# define voidp z_voidp -# define voidpc z_voidpc -# define voidpf z_voidpf - -/* all zlib structs in zlib.h and zconf.h */ -# define gz_header_s z_gz_header_s -# define internal_state z_internal_state - -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -#if defined(ZLIB_CONST) && !defined(z_const) -# define z_const const -#else -# define z_const -#endif - -#ifdef Z_SOLO - typedef unsigned long z_size_t; -#else -# define z_longlong long long -# if defined(NO_SIZE_T) - typedef unsigned NO_SIZE_T z_size_t; -# elif defined(STDC) -# include - typedef size_t z_size_t; -# else - typedef unsigned long z_size_t; -# endif -# undef z_longlong -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus about 7 kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) -# include -# if (UINT_MAX == 0xffffffffUL) -# define Z_U4 unsigned -# elif (ULONG_MAX == 0xffffffffUL) -# define Z_U4 unsigned long -# elif (USHRT_MAX == 0xffffffffUL) -# define Z_U4 unsigned short -# endif -#endif - -#ifdef Z_U4 - typedef Z_U4 z_crc_t; -#else - typedef unsigned long z_crc_t; -#endif - -#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ -# define Z_HAVE_UNISTD_H -#endif - -#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ -# define Z_HAVE_STDARG_H -#endif - -#ifdef STDC -# ifndef Z_SOLO -# include /* for off_t */ -# endif -#endif - -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifndef Z_SOLO -# include /* for va_list */ -# endif -#endif - -#ifdef _WIN32 -# ifndef Z_SOLO -# include /* for wchar_t */ -# endif -#endif - -/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and - * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even - * though the former does not conform to the LFS document), but considering - * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as - * equivalently requesting no 64-bit operations - */ -#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 -# undef _LARGEFILE64_SOURCE -#endif - -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H -#endif -#ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ -# ifdef VMS -# include /* for off_t */ -# endif -# ifndef z_off_t -# define z_off_t off_t -# endif -# endif -#endif - -#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 -# define Z_LFS64 -#endif - -#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) -# define Z_LARGE64 -#endif - -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) -# define Z_WANT64 -#endif - -#if !defined(SEEK_SET) && !defined(Z_SOLO) -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif - -#ifndef z_off_t -# define z_off_t long -#endif - -#if !defined(_WIN32) && defined(Z_LARGE64) -# define z_off64_t off64_t -#else -# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) -# define z_off64_t __int64 -# else -# define z_off64_t z_off_t -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) - #pragma map(deflateInit_,"DEIN") - #pragma map(deflateInit2_,"DEIN2") - #pragma map(deflateEnd,"DEEND") - #pragma map(deflateBound,"DEBND") - #pragma map(inflateInit_,"ININ") - #pragma map(inflateInit2_,"ININ2") - #pragma map(inflateEnd,"INEND") - #pragma map(inflateSync,"INSY") - #pragma map(inflateSetDictionary,"INSEDI") - #pragma map(compressBound,"CMBND") - #pragma map(inflate_table,"INTABL") - #pragma map(inflate_fast,"INFA") - #pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ diff --git a/compat/zlib/zconf.h.cmakein b/compat/zlib/zconf.h.cmakein deleted file mode 100644 index a7f24cc..0000000 --- a/compat/zlib/zconf.h.cmakein +++ /dev/null @@ -1,536 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H -#cmakedefine Z_PREFIX -#cmakedefine Z_HAVE_UNISTD_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - * Even better than compiling with -DZ_PREFIX would be to use configure to set - * this permanently in zconf.h using "./configure --zprefix". - */ -#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ -# define Z_PREFIX_SET - -/* all linked symbols and init macros */ -# define _dist_code z__dist_code -# define _length_code z__length_code -# define _tr_align z__tr_align -# define _tr_flush_bits z__tr_flush_bits -# define _tr_flush_block z__tr_flush_block -# define _tr_init z__tr_init -# define _tr_stored_block z__tr_stored_block -# define _tr_tally z__tr_tally -# define adler32 z_adler32 -# define adler32_combine z_adler32_combine -# define adler32_combine64 z_adler32_combine64 -# define adler32_z z_adler32_z -# ifndef Z_SOLO -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# endif -# define crc32 z_crc32 -# define crc32_combine z_crc32_combine -# define crc32_combine64 z_crc32_combine64 -# define crc32_z z_crc32_z -# define deflate z_deflate -# define deflateBound z_deflateBound -# define deflateCopy z_deflateCopy -# define deflateEnd z_deflateEnd -# define deflateGetDictionary z_deflateGetDictionary -# define deflateInit z_deflateInit -# define deflateInit2 z_deflateInit2 -# define deflateInit2_ z_deflateInit2_ -# define deflateInit_ z_deflateInit_ -# define deflateParams z_deflateParams -# define deflatePending z_deflatePending -# define deflatePrime z_deflatePrime -# define deflateReset z_deflateReset -# define deflateResetKeep z_deflateResetKeep -# define deflateSetDictionary z_deflateSetDictionary -# define deflateSetHeader z_deflateSetHeader -# define deflateTune z_deflateTune -# define deflate_copyright z_deflate_copyright -# define get_crc_table z_get_crc_table -# ifndef Z_SOLO -# define gz_error z_gz_error -# define gz_intmax z_gz_intmax -# define gz_strwinerror z_gz_strwinerror -# define gzbuffer z_gzbuffer -# define gzclearerr z_gzclearerr -# define gzclose z_gzclose -# define gzclose_r z_gzclose_r -# define gzclose_w z_gzclose_w -# define gzdirect z_gzdirect -# define gzdopen z_gzdopen -# define gzeof z_gzeof -# define gzerror z_gzerror -# define gzflush z_gzflush -# define gzfread z_gzfread -# define gzfwrite z_gzfwrite -# define gzgetc z_gzgetc -# define gzgetc_ z_gzgetc_ -# define gzgets z_gzgets -# define gzoffset z_gzoffset -# define gzoffset64 z_gzoffset64 -# define gzopen z_gzopen -# define gzopen64 z_gzopen64 -# ifdef _WIN32 -# define gzopen_w z_gzopen_w -# endif -# define gzprintf z_gzprintf -# define gzputc z_gzputc -# define gzputs z_gzputs -# define gzread z_gzread -# define gzrewind z_gzrewind -# define gzseek z_gzseek -# define gzseek64 z_gzseek64 -# define gzsetparams z_gzsetparams -# define gztell z_gztell -# define gztell64 z_gztell64 -# define gzungetc z_gzungetc -# define gzvprintf z_gzvprintf -# define gzwrite z_gzwrite -# endif -# define inflate z_inflate -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define inflateBackInit z_inflateBackInit -# define inflateBackInit_ z_inflateBackInit_ -# define inflateCodesUsed z_inflateCodesUsed -# define inflateCopy z_inflateCopy -# define inflateEnd z_inflateEnd -# define inflateGetDictionary z_inflateGetDictionary -# define inflateGetHeader z_inflateGetHeader -# define inflateInit z_inflateInit -# define inflateInit2 z_inflateInit2 -# define inflateInit2_ z_inflateInit2_ -# define inflateInit_ z_inflateInit_ -# define inflateMark z_inflateMark -# define inflatePrime z_inflatePrime -# define inflateReset z_inflateReset -# define inflateReset2 z_inflateReset2 -# define inflateResetKeep z_inflateResetKeep -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateUndermine z_inflateUndermine -# define inflateValidate z_inflateValidate -# define inflate_copyright z_inflate_copyright -# define inflate_fast z_inflate_fast -# define inflate_table z_inflate_table -# ifndef Z_SOLO -# define uncompress z_uncompress -# define uncompress2 z_uncompress2 -# endif -# define zError z_zError -# ifndef Z_SOLO -# define zcalloc z_zcalloc -# define zcfree z_zcfree -# endif -# define zlibCompileFlags z_zlibCompileFlags -# define zlibVersion z_zlibVersion - -/* all zlib typedefs in zlib.h and zconf.h */ -# define Byte z_Byte -# define Bytef z_Bytef -# define alloc_func z_alloc_func -# define charf z_charf -# define free_func z_free_func -# ifndef Z_SOLO -# define gzFile z_gzFile -# endif -# define gz_header z_gz_header -# define gz_headerp z_gz_headerp -# define in_func z_in_func -# define intf z_intf -# define out_func z_out_func -# define uInt z_uInt -# define uIntf z_uIntf -# define uLong z_uLong -# define uLongf z_uLongf -# define voidp z_voidp -# define voidpc z_voidpc -# define voidpf z_voidpf - -/* all zlib structs in zlib.h and zconf.h */ -# define gz_header_s z_gz_header_s -# define internal_state z_internal_state - -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -#if defined(ZLIB_CONST) && !defined(z_const) -# define z_const const -#else -# define z_const -#endif - -#ifdef Z_SOLO - typedef unsigned long z_size_t; -#else -# define z_longlong long long -# if defined(NO_SIZE_T) - typedef unsigned NO_SIZE_T z_size_t; -# elif defined(STDC) -# include - typedef size_t z_size_t; -# else - typedef unsigned long z_size_t; -# endif -# undef z_longlong -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus about 7 kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) -# include -# if (UINT_MAX == 0xffffffffUL) -# define Z_U4 unsigned -# elif (ULONG_MAX == 0xffffffffUL) -# define Z_U4 unsigned long -# elif (USHRT_MAX == 0xffffffffUL) -# define Z_U4 unsigned short -# endif -#endif - -#ifdef Z_U4 - typedef Z_U4 z_crc_t; -#else - typedef unsigned long z_crc_t; -#endif - -#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ -# define Z_HAVE_UNISTD_H -#endif - -#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ -# define Z_HAVE_STDARG_H -#endif - -#ifdef STDC -# ifndef Z_SOLO -# include /* for off_t */ -# endif -#endif - -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifndef Z_SOLO -# include /* for va_list */ -# endif -#endif - -#ifdef _WIN32 -# ifndef Z_SOLO -# include /* for wchar_t */ -# endif -#endif - -/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and - * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even - * though the former does not conform to the LFS document), but considering - * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as - * equivalently requesting no 64-bit operations - */ -#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 -# undef _LARGEFILE64_SOURCE -#endif - -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H -#endif -#ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ -# ifdef VMS -# include /* for off_t */ -# endif -# ifndef z_off_t -# define z_off_t off_t -# endif -# endif -#endif - -#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 -# define Z_LFS64 -#endif - -#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) -# define Z_LARGE64 -#endif - -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) -# define Z_WANT64 -#endif - -#if !defined(SEEK_SET) && !defined(Z_SOLO) -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif - -#ifndef z_off_t -# define z_off_t long -#endif - -#if !defined(_WIN32) && defined(Z_LARGE64) -# define z_off64_t off64_t -#else -# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) -# define z_off64_t __int64 -# else -# define z_off64_t z_off_t -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) - #pragma map(deflateInit_,"DEIN") - #pragma map(deflateInit2_,"DEIN2") - #pragma map(deflateEnd,"DEEND") - #pragma map(deflateBound,"DEBND") - #pragma map(inflateInit_,"ININ") - #pragma map(inflateInit2_,"ININ2") - #pragma map(inflateEnd,"INEND") - #pragma map(inflateSync,"INSY") - #pragma map(inflateSetDictionary,"INSEDI") - #pragma map(compressBound,"CMBND") - #pragma map(inflate_table,"INTABL") - #pragma map(inflate_fast,"INFA") - #pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ diff --git a/compat/zlib/zconf.h.in b/compat/zlib/zconf.h.in deleted file mode 100644 index 5e1d68a..0000000 --- a/compat/zlib/zconf.h.in +++ /dev/null @@ -1,534 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - * Even better than compiling with -DZ_PREFIX would be to use configure to set - * this permanently in zconf.h using "./configure --zprefix". - */ -#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ -# define Z_PREFIX_SET - -/* all linked symbols and init macros */ -# define _dist_code z__dist_code -# define _length_code z__length_code -# define _tr_align z__tr_align -# define _tr_flush_bits z__tr_flush_bits -# define _tr_flush_block z__tr_flush_block -# define _tr_init z__tr_init -# define _tr_stored_block z__tr_stored_block -# define _tr_tally z__tr_tally -# define adler32 z_adler32 -# define adler32_combine z_adler32_combine -# define adler32_combine64 z_adler32_combine64 -# define adler32_z z_adler32_z -# ifndef Z_SOLO -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# endif -# define crc32 z_crc32 -# define crc32_combine z_crc32_combine -# define crc32_combine64 z_crc32_combine64 -# define crc32_z z_crc32_z -# define deflate z_deflate -# define deflateBound z_deflateBound -# define deflateCopy z_deflateCopy -# define deflateEnd z_deflateEnd -# define deflateGetDictionary z_deflateGetDictionary -# define deflateInit z_deflateInit -# define deflateInit2 z_deflateInit2 -# define deflateInit2_ z_deflateInit2_ -# define deflateInit_ z_deflateInit_ -# define deflateParams z_deflateParams -# define deflatePending z_deflatePending -# define deflatePrime z_deflatePrime -# define deflateReset z_deflateReset -# define deflateResetKeep z_deflateResetKeep -# define deflateSetDictionary z_deflateSetDictionary -# define deflateSetHeader z_deflateSetHeader -# define deflateTune z_deflateTune -# define deflate_copyright z_deflate_copyright -# define get_crc_table z_get_crc_table -# ifndef Z_SOLO -# define gz_error z_gz_error -# define gz_intmax z_gz_intmax -# define gz_strwinerror z_gz_strwinerror -# define gzbuffer z_gzbuffer -# define gzclearerr z_gzclearerr -# define gzclose z_gzclose -# define gzclose_r z_gzclose_r -# define gzclose_w z_gzclose_w -# define gzdirect z_gzdirect -# define gzdopen z_gzdopen -# define gzeof z_gzeof -# define gzerror z_gzerror -# define gzflush z_gzflush -# define gzfread z_gzfread -# define gzfwrite z_gzfwrite -# define gzgetc z_gzgetc -# define gzgetc_ z_gzgetc_ -# define gzgets z_gzgets -# define gzoffset z_gzoffset -# define gzoffset64 z_gzoffset64 -# define gzopen z_gzopen -# define gzopen64 z_gzopen64 -# ifdef _WIN32 -# define gzopen_w z_gzopen_w -# endif -# define gzprintf z_gzprintf -# define gzputc z_gzputc -# define gzputs z_gzputs -# define gzread z_gzread -# define gzrewind z_gzrewind -# define gzseek z_gzseek -# define gzseek64 z_gzseek64 -# define gzsetparams z_gzsetparams -# define gztell z_gztell -# define gztell64 z_gztell64 -# define gzungetc z_gzungetc -# define gzvprintf z_gzvprintf -# define gzwrite z_gzwrite -# endif -# define inflate z_inflate -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define inflateBackInit z_inflateBackInit -# define inflateBackInit_ z_inflateBackInit_ -# define inflateCodesUsed z_inflateCodesUsed -# define inflateCopy z_inflateCopy -# define inflateEnd z_inflateEnd -# define inflateGetDictionary z_inflateGetDictionary -# define inflateGetHeader z_inflateGetHeader -# define inflateInit z_inflateInit -# define inflateInit2 z_inflateInit2 -# define inflateInit2_ z_inflateInit2_ -# define inflateInit_ z_inflateInit_ -# define inflateMark z_inflateMark -# define inflatePrime z_inflatePrime -# define inflateReset z_inflateReset -# define inflateReset2 z_inflateReset2 -# define inflateResetKeep z_inflateResetKeep -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateUndermine z_inflateUndermine -# define inflateValidate z_inflateValidate -# define inflate_copyright z_inflate_copyright -# define inflate_fast z_inflate_fast -# define inflate_table z_inflate_table -# ifndef Z_SOLO -# define uncompress z_uncompress -# define uncompress2 z_uncompress2 -# endif -# define zError z_zError -# ifndef Z_SOLO -# define zcalloc z_zcalloc -# define zcfree z_zcfree -# endif -# define zlibCompileFlags z_zlibCompileFlags -# define zlibVersion z_zlibVersion - -/* all zlib typedefs in zlib.h and zconf.h */ -# define Byte z_Byte -# define Bytef z_Bytef -# define alloc_func z_alloc_func -# define charf z_charf -# define free_func z_free_func -# ifndef Z_SOLO -# define gzFile z_gzFile -# endif -# define gz_header z_gz_header -# define gz_headerp z_gz_headerp -# define in_func z_in_func -# define intf z_intf -# define out_func z_out_func -# define uInt z_uInt -# define uIntf z_uIntf -# define uLong z_uLong -# define uLongf z_uLongf -# define voidp z_voidp -# define voidpc z_voidpc -# define voidpf z_voidpf - -/* all zlib structs in zlib.h and zconf.h */ -# define gz_header_s z_gz_header_s -# define internal_state z_internal_state - -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -#if defined(ZLIB_CONST) && !defined(z_const) -# define z_const const -#else -# define z_const -#endif - -#ifdef Z_SOLO - typedef unsigned long z_size_t; -#else -# define z_longlong long long -# if defined(NO_SIZE_T) - typedef unsigned NO_SIZE_T z_size_t; -# elif defined(STDC) -# include - typedef size_t z_size_t; -# else - typedef unsigned long z_size_t; -# endif -# undef z_longlong -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus about 7 kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) -# include -# if (UINT_MAX == 0xffffffffUL) -# define Z_U4 unsigned -# elif (ULONG_MAX == 0xffffffffUL) -# define Z_U4 unsigned long -# elif (USHRT_MAX == 0xffffffffUL) -# define Z_U4 unsigned short -# endif -#endif - -#ifdef Z_U4 - typedef Z_U4 z_crc_t; -#else - typedef unsigned long z_crc_t; -#endif - -#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ -# define Z_HAVE_UNISTD_H -#endif - -#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ -# define Z_HAVE_STDARG_H -#endif - -#ifdef STDC -# ifndef Z_SOLO -# include /* for off_t */ -# endif -#endif - -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifndef Z_SOLO -# include /* for va_list */ -# endif -#endif - -#ifdef _WIN32 -# ifndef Z_SOLO -# include /* for wchar_t */ -# endif -#endif - -/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and - * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even - * though the former does not conform to the LFS document), but considering - * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as - * equivalently requesting no 64-bit operations - */ -#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 -# undef _LARGEFILE64_SOURCE -#endif - -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H -#endif -#ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ -# ifdef VMS -# include /* for off_t */ -# endif -# ifndef z_off_t -# define z_off_t off_t -# endif -# endif -#endif - -#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 -# define Z_LFS64 -#endif - -#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) -# define Z_LARGE64 -#endif - -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) -# define Z_WANT64 -#endif - -#if !defined(SEEK_SET) && !defined(Z_SOLO) -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif - -#ifndef z_off_t -# define z_off_t long -#endif - -#if !defined(_WIN32) && defined(Z_LARGE64) -# define z_off64_t off64_t -#else -# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) -# define z_off64_t __int64 -# else -# define z_off64_t z_off_t -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) - #pragma map(deflateInit_,"DEIN") - #pragma map(deflateInit2_,"DEIN2") - #pragma map(deflateEnd,"DEEND") - #pragma map(deflateBound,"DEBND") - #pragma map(inflateInit_,"ININ") - #pragma map(inflateInit2_,"ININ2") - #pragma map(inflateEnd,"INEND") - #pragma map(inflateSync,"INSY") - #pragma map(inflateSetDictionary,"INSEDI") - #pragma map(compressBound,"CMBND") - #pragma map(inflate_table,"INTABL") - #pragma map(inflate_fast,"INFA") - #pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ diff --git a/compat/zlib/zlib.3 b/compat/zlib/zlib.3 deleted file mode 100644 index bda4eb0..0000000 --- a/compat/zlib/zlib.3 +++ /dev/null @@ -1,149 +0,0 @@ -.TH ZLIB 3 "15 Jan 2017" -.SH NAME -zlib \- compression/decompression library -.SH SYNOPSIS -[see -.I zlib.h -for full description] -.SH DESCRIPTION -The -.I zlib -library is a general purpose data compression library. -The code is thread safe, assuming that the standard library functions -used are thread safe, such as memory allocation routines. -It provides in-memory compression and decompression functions, -including integrity checks of the uncompressed data. -This version of the library supports only one compression method (deflation) -but other algorithms may be added later -with the same stream interface. -.LP -Compression can be done in a single step if the buffers are large enough -or can be done by repeated calls of the compression function. -In the latter case, -the application must provide more input and/or consume the output -(providing more output space) before each call. -.LP -The library also supports reading and writing files in -.IR gzip (1) -(.gz) format -with an interface similar to that of stdio. -.LP -The library does not install any signal handler. -The decoder checks the consistency of the compressed data, -so the library should never crash even in the case of corrupted input. -.LP -All functions of the compression library are documented in the file -.IR zlib.h . -The distribution source includes examples of use of the library -in the files -.I test/example.c -and -.IR test/minigzip.c, -as well as other examples in the -.IR examples/ -directory. -.LP -Changes to this version are documented in the file -.I ChangeLog -that accompanies the source. -.LP -.I zlib -is built in to many languages and operating systems, including but not limited to -Java, Python, .NET, PHP, Perl, Ruby, Swift, and Go. -.LP -An experimental package to read and write files in the .zip format, -written on top of -.I zlib -by Gilles Vollant (info@winimage.com), -is available at: -.IP -http://www.winimage.com/zLibDll/minizip.html -and also in the -.I contrib/minizip -directory of the main -.I zlib -source distribution. -.SH "SEE ALSO" -The -.I zlib -web site can be found at: -.IP -http://zlib.net/ -.LP -The data format used by the -.I zlib -library is described by RFC -(Request for Comments) 1950 to 1952 in the files: -.IP -http://tools.ietf.org/html/rfc1950 (for the zlib header and trailer format) -.br -http://tools.ietf.org/html/rfc1951 (for the deflate compressed data format) -.br -http://tools.ietf.org/html/rfc1952 (for the gzip header and trailer format) -.LP -Mark Nelson wrote an article about -.I zlib -for the Jan. 1997 issue of Dr. Dobb's Journal; -a copy of the article is available at: -.IP -http://marknelson.us/1997/01/01/zlib-engine/ -.SH "REPORTING PROBLEMS" -Before reporting a problem, -please check the -.I zlib -web site to verify that you have the latest version of -.IR zlib ; -otherwise, -obtain the latest version and see if the problem still exists. -Please read the -.I zlib -FAQ at: -.IP -http://zlib.net/zlib_faq.html -.LP -before asking for help. -Send questions and/or comments to zlib@gzip.org, -or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). -.SH AUTHORS AND LICENSE -Version 1.2.11 -.LP -Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler -.LP -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. -.LP -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: -.LP -.nr step 1 1 -.IP \n[step]. 3 -The origin of this software must not be misrepresented; you must not -claim that you wrote the original software. If you use this software -in a product, an acknowledgment in the product documentation would be -appreciated but is not required. -.IP \n+[step]. -Altered source versions must be plainly marked as such, and must not be -misrepresented as being the original software. -.IP \n+[step]. -This notice may not be removed or altered from any source distribution. -.LP -Jean-loup Gailly Mark Adler -.br -jloup@gzip.org madler@alumni.caltech.edu -.LP -The deflate format used by -.I zlib -was defined by Phil Katz. -The deflate and -.I zlib -specifications were written by L. Peter Deutsch. -Thanks to all the people who reported problems and suggested various -improvements in -.IR zlib ; -who are too numerous to cite here. -.LP -UNIX manual page by R. P. C. Rodgers, -U.S. National Library of Medicine (rodgers@nlm.nih.gov). -.\" end of man page diff --git a/compat/zlib/zlib.3.pdf b/compat/zlib/zlib.3.pdf deleted file mode 100644 index 6fa519c..0000000 Binary files a/compat/zlib/zlib.3.pdf and /dev/null differ diff --git a/compat/zlib/zlib.h b/compat/zlib/zlib.h deleted file mode 100644 index f09cdaf..0000000 --- a/compat/zlib/zlib.h +++ /dev/null @@ -1,1912 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.11, January 15th, 2017 - - Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 - (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). -*/ - -#ifndef ZLIB_H -#define ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.2.11" -#define ZLIB_VERNUM 0x12b0 -#define ZLIB_VER_MAJOR 1 -#define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 11 -#define ZLIB_VER_SUBREVISION 0 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed data. - This version of the library supports only one compression method (deflation) - but other algorithms will be added later and will have the same stream - interface. - - Compression can be done in a single step if the buffers are large enough, - or can be done by repeated calls of the compression function. In the latter - case, the application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by default by the in-memory functions is - the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped - around a deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - This library can optionally read and write gzip and raw deflate streams in - memory as well. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never crash - even in the case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - z_const Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total number of input bytes read so far */ - - Bytef *next_out; /* next output byte will go here */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total number of bytes output so far */ - - z_const char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: binary or text - for deflate, or the decoding state for inflate */ - uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - for more details on the meanings of these fields. -*/ -typedef struct gz_header_s { - int text; /* true if compressed data believed to be text */ - uLong time; /* modification time */ - int xflags; /* extra flags (not used when writing a gzip file) */ - int os; /* operating system */ - Bytef *extra; /* pointer to extra field or Z_NULL if none */ - uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ - uInt extra_max; /* space at extra (only when reading header) */ - Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ - uInt name_max; /* space at name (only when reading header) */ - Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ - uInt comm_max; /* space at comment (only when reading header) */ - int hcrc; /* true if there was or will be a header crc */ - int done; /* true when done reading gzip header (not used - when writing a gzip file) */ -} gz_header; - -typedef gz_header FAR *gz_headerp; - -/* - The application must update next_in and avail_in when avail_in has dropped - to zero. It must update next_out and avail_out when avail_out has dropped - to zero. The application must initialize zalloc, zfree and opaque before - calling the init function. All other fields are set by the compression - library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. In that case, zlib is thread-safe. When zalloc and zfree are - Z_NULL on entry to the initialization function, they are set to internal - routines that use the standard library functions malloc() and free(). - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this if - the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers - returned by zalloc for objects of exactly 65536 bytes *must* have their - offset normalized to zero. The default allocation function provided by this - library ensures this (see zutil.c). To reduce memory requirements and avoid - any allocation of 64K objects, at the expense of compression ratio, compile - the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or progress - reports. After compression, total_in holds the total size of the - uncompressed data and may be saved for use by the decompressor (particularly - if the decompressor wants to decompress everything in a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -#define Z_TREES 6 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_FIXED 4 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_TEXT 1 -#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -#define Z_UNKNOWN 2 -/* Possible values of the data_type field for deflate() */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - - /* basic functions */ - -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is not - compatible with the zlib.h header file used by the application. This check - is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. If - zalloc and zfree are set to Z_NULL, deflateInit updates them to use default - allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at all - (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION - requests a default compromise between speed and compression (currently - equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if level is not a valid compression level, or - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). msg is set to null - if there is no error message. deflateInit does not perform any compression: - this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Generate more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary. Some output may be provided even if - flush is zero. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating avail_in or avail_out accordingly; avail_out should - never be zero before the call. The application can consume the compressed - output when it wants, for example when the output buffer is full (avail_out - == 0), or after each call of deflate(). If deflate returns Z_OK and with - zero avail_out, it must be called again after making room in the output - buffer because there might be more output pending. See deflatePending(), - which can be used if desired to determine whether or not there is more ouput - in that case. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumulate before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In - particular avail_in is zero after the call if enough output space has been - provided before the call.) Flushing may degrade compression for some - compression algorithms and so it should be used only when necessary. This - completes the current deflate block and follows it with an empty stored block - that is three bits plus filler bits to the next byte, followed by four bytes - (00 00 ff ff). - - If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the - output buffer, but the output is not aligned to a byte boundary. All of the - input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. - This completes the current deflate block and follows it with an empty fixed - codes block that is 10 bits long. This assures that enough bytes are output - in order for the decompressor to finish the block before the empty fixed - codes block. - - If flush is set to Z_BLOCK, a deflate block is completed and emitted, as - for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to - seven bits of the current block are held to be written as the next byte after - the next deflate block is completed. In this case, the decompressor may not - be provided enough bits at this point in order to complete decompression of - the data provided so far to the compressor. It may need to wait for the next - block to be emitted. This is for advanced applications that need to control - the emission of deflate blocks. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there was - enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this - function must be called again with Z_FINISH and more output space (updated - avail_out) but no more input data, until it returns with Z_STREAM_END or an - error. After deflate has returned Z_STREAM_END, the only possible operations - on the stream are deflateReset or deflateEnd. - - Z_FINISH can be used in the first deflate call after deflateInit if all the - compression is to be done in a single step. In order to complete in one - call, avail_out must be at least the value returned by deflateBound (see - below). Then deflate is guaranteed to return Z_STREAM_END. If not enough - output space is provided, deflate will not return Z_STREAM_END, and it must - be called again as described above. - - deflate() sets strm->adler to the Adler-32 checksum of all input read - so far (that is, total_in bytes). If a gzip stream is being generated, then - strm->adler will be the CRC-32 checksum of the input read so far. (See - deflateInit2 below.) - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is - considered binary. This field is only for information purposes and does not - affect the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was Z_NULL or the state was inadvertently written over - by the application), or Z_BUF_ERROR if no progress is possible (for example - avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and - deflate() can be called again with more input and more output space to - continue compressing. -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, msg - may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. In the current version of inflate, the provided input is not - read or consumed. The allocation of a sliding window will be deferred to - the first call of inflate (if the decompression does not complete on the - first call). If zalloc and zfree are set to Z_NULL, inflateInit updates - them to use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit does not perform any decompression. - Actual decompression will be done by inflate(). So next_in, and avail_in, - next_out, and avail_out are unused and unchanged. The current - implementation of inflateInit() does not process any header information -- - that is deferred until inflate() is called. -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), then next_in and avail_in are updated - accordingly, and processing will resume at this point for the next call of - inflate(). - - - Generate more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there is - no more input data or no more space in the output buffer (see below about - the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating the next_* and avail_* values accordingly. If the - caller of inflate() does not provide both available input and available - output space, it is possible that there will be no progress made. The - application can consume the uncompressed output when it wants, for example - when the output buffer is full (avail_out == 0), or after each call of - inflate(). If inflate returns Z_OK and with zero avail_out, it must be - called again after making room in the output buffer because there might be - more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, - Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() - stop if and when it gets to the next deflate block boundary. When decoding - the zlib or gzip format, this will cause inflate() to return immediately - after the header and before the first block. When doing a raw inflate, - inflate() will go ahead and process the first block, and will return when it - gets to the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - To assist in this, on return inflate() always sets strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 if - inflate() is currently decoding the last block in the deflate stream, plus - 128 if inflate() returned immediately after decoding an end-of-block code or - decoding the complete header up to just before the first byte of the deflate - stream. The end-of-block will not be indicated until all of the uncompressed - data from that block has been written to strm->next_out. The number of - unused bits may in general be greater than seven, except when bit 7 of - data_type is set, in which case the number of unused bits will be less than - eight. data_type is set as noted here every time inflate() returns for all - flush options, and so can be used to determine the amount of currently - consumed input in bits. - - The Z_TREES option behaves as Z_BLOCK does, but it also returns when the - end of each deflate block header is reached, before any actual data in that - block is decoded. This allows the caller to determine the length of the - deflate block header for later use in random access within a deflate block. - 256 is added to the value of strm->data_type when inflate() returns - immediately after reaching the end of the deflate block header. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step (a - single call of inflate), the parameter flush should be set to Z_FINISH. In - this case all pending input is processed and all pending output is flushed; - avail_out must be large enough to hold all of the uncompressed data for the - operation to complete. (The size of the uncompressed data may have been - saved by the compressor for this purpose.) The use of Z_FINISH is not - required to perform an inflation in one step. However it may be used to - inform inflate that a faster approach can be used for the single inflate() - call. Z_FINISH also informs inflate to not maintain a sliding window if the - stream completes, which reduces inflate's memory footprint. If the stream - does not complete, either because not all of the stream is provided or not - enough output space is provided, then a sliding window will be allocated and - inflate() can be called again to continue the operation as if Z_NO_FLUSH had - been used. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the effects of the flush parameter in this implementation are - on the return value of inflate() as noted below, when inflate() returns early - when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of - memory for a sliding window when Z_FINISH is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the Adler-32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the Adler-32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed Adler-32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() can decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically, if requested when - initializing with inflateInit2(). Any information contained in the gzip - header is not retained unless inflateGetHeader() is used. When processing - gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output - produced so far. The CRC-32 is checked against the gzip trailer, as is the - uncompressed length, modulo 2^32. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value, in which case strm->msg points to a string with a more specific - error), Z_STREAM_ERROR if the stream structure was inconsistent (for example - next_in or next_out was Z_NULL, or the state was inadvertently written over - by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR - if no progress was possible or if there was not enough room in the output - buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may - then call inflateSync() to look for a good compression block if a partial - recovery of the data is to be attempted. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state - was inconsistent. -*/ - - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by the - caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - For the current implementation of deflate(), a windowBits value of 8 (a - window size of 256 bytes) is not supported. As a result, a request for 8 - will result in 9 (a 512-byte window). In that case, providing 8 to - inflateInit2() will result in an error when the zlib header with 9 is - checked against the initialization of inflate(). The remedy is to not use 8 - with deflateInit2() with this initialization, or at least in that case use 9 - with inflateInit2(). - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute a check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), no - header crc, and the operating system will be set to the appropriate value, - if the operating system was determined at compile time. If a gzip stream is - being written, strm->adler is a CRC-32 instead of an Adler-32. - - For raw deflate or gzip encoding, a request for a 256-byte window is - rejected as invalid, since only the zlib header provides a means of - transmitting the window size to the decompressor. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but is - slow and reduces compression ratio; memLevel=9 uses maximum memory for - optimal speed. The default value is 8. See zconf.h for total memory usage - as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as - fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The - strategy parameter only affects the compression ratio but not the - correctness of the compressed output even if it is not set appropriately. - Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler - decoder for special applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid - method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is - incompatible with the version assumed by the caller (ZLIB_VERSION). msg is - set to null if there is no error message. deflateInit2 does not perform any - compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. When using the zlib format, this - function must be called immediately after deflateInit, deflateInit2 or - deflateReset, and before any call of deflate. When doing raw deflate, this - function must be called either before any call of deflate, or immediately - after the completion of a deflate block, i.e. after all input has been - consumed and all output has been delivered when using any of the flush - options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The - compressor and decompressor must use exactly the same dictionary (see - inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size - provided in deflateInit or deflateInit2. Thus the strings most likely to be - useful should be put at the end of the dictionary, not at the front. In - addition, the current implementation of deflate will use at most the window - size minus 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the Adler-32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The Adler-32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - Adler-32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if not at a block boundary for raw deflate). deflateSetDictionary does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm, - Bytef *dictionary, - uInt *dictLength)); -/* - Returns the sliding dictionary being maintained by deflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - to dictionary. dictionary must have enough space, where 32768 bytes is - always enough. If deflateGetDictionary() is called with dictionary equal to - Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. - - deflateGetDictionary() may return a length less than the window size, even - when more than the window size in input has been provided. It may return up - to 258 bytes less in that case, due to how zlib's implementation of deflate - manages the sliding window and lookahead for matches, where matches can be - up to 258 bytes long. If the application needs the last window-size bytes of - input, then that would need to be saved by the application outside of zlib. - - deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and can - consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being Z_NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, but - does not free and reallocate the internal compression state. The stream - will leave the compression level and any other attributes that may have been - set unchanged. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2(). This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different strategy. - If the compression approach (which is a function of the level) or the - strategy is changed, and if any input has been consumed in a previous - deflate() call, then the input available so far is compressed with the old - level and strategy using deflate(strm, Z_BLOCK). There are three approaches - for the compression levels 0, 1..3, and 4..9 respectively. The new level - and strategy will take effect at the next call of deflate(). - - If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does - not have enough output space to complete, then the parameter change will not - take effect. In this case, deflateParams() can be called again with the - same parameters and more output space to try again. - - In order to assure a change in the parameters on the first try, the - deflate stream should be flushed using deflate() with Z_BLOCK or other flush - request until strm.avail_out is not zero, before calling deflateParams(). - Then no more input data should be provided before the deflateParams() call. - If this is done, the old level and strategy will be applied to the data - compressed before deflateParams(), and the new level and strategy will be - applied to the the data compressed after deflateParams(). - - deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream - state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if - there was not enough output space to complete the compression of the - available input data before a change in the strategy or approach. Note that - in the case of a Z_BUF_ERROR, the parameters are not changed. A return - value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be - retried with more output space. -*/ - -ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, - int good_length, - int max_lazy, - int nice_length, - int max_chain)); -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. - */ - -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() or - deflateInit2(), and after deflateSetHeader(), if used. This would be used - to allocate an output buffer for deflation in a single pass, and so would be - called before deflate(). If that first deflate() call is provided the - sourceLen input bytes, an output buffer allocated to the size returned by - deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed - to return Z_STREAM_END. Note that it is possible for the compressed size to - be larger than the value returned by deflateBound() if flush options other - than Z_FINISH or Z_NO_FLUSH are used. -*/ - -ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, - unsigned *pending, - int *bits)); -/* - deflatePending() returns the number of bytes and bits of output that have - been generated, but not yet provided in the available output. The bytes not - provided would be due to the available output space having being consumed. - The number of bits of output not provided are between 0 and 7, where they - await more bits to join them in order to fill out a full byte. If pending - or bits are Z_NULL, then those values are not set. - - deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. - */ - -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the bits - leftover from a previous deflate stream when appending to it. As such, this - function can only be used for raw deflate, and must be used before the first - deflate() call after a deflateInit2() or deflateReset(). bits must be less - than or equal to 16, and that many of the least significant bits of value - will be inserted in the output. - - deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough - room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the - source stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, - gz_headerp head)); -/* - deflateSetHeader() provides gzip header information for when a gzip - stream is requested by deflateInit2(). deflateSetHeader() may be called - after deflateInit2() or deflateReset() and before the first call of - deflate(). The text, time, os, extra field, name, and comment information - in the provided gz_header structure are written to the gzip header (xflag is - ignored -- the extra flags are set according to the compression level). The - caller must assure that, if not Z_NULL, name and comment are terminated with - a zero byte, and that if extra is not Z_NULL, that extra_len bytes are - available there. If hcrc is true, a gzip header crc is included. Note that - the current versions of the command-line version of gzip (up through version - 1.3.x) do not support header crc's, and will report that it is a "multi-part - gzip file" and give up. - - If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). - - deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be zero to request that inflate use the window size in - the zlib header of the compressed stream. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an Adler-32 or a CRC-32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a - CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see - below), inflate() will not automatically decode concatenated gzip streams. - inflate() will return Z_STREAM_END at the end of the gzip stream. The state - would need to be reset to continue decoding a subsequent gzip stream. - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit2 does not perform any decompression - apart from possibly reading the zlib header if present: actual decompression - will be done by inflate(). (So next_in and avail_in may be modified, but - next_out and avail_out are unused and unchanged.) The current implementation - of inflateInit2() does not process any header information -- that is - deferred until inflate() is called. -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the Adler-32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called at any - time to set the dictionary. If the provided dictionary is smaller than the - window and there is already data in the window, then the provided dictionary - will amend what's there. The application must insure that the dictionary - that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect Adler-32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, - Bytef *dictionary, - uInt *dictLength)); -/* - Returns the sliding dictionary being maintained by inflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - to dictionary. dictionary must have enough space, where 32768 bytes is - always enough. If inflateGetDictionary() is called with dictionary equal to - Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. - - inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a possible full flush point (see above - for the description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync searches for a 00 00 FF FF pattern in the compressed data. - All full flush points have this pattern, but not all occurrences of this - pattern are full flush points. - - inflateSync returns Z_OK if a possible full flush point has been found, - Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point - has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being Z_NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate the internal decompression state. The - stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL). -*/ - -ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, - int windowBits)); -/* - This function is the same as inflateReset, but it also permits changing - the wrap and window size requests. The windowBits parameter is interpreted - the same as it is for inflateInit2. If the window size is changed, then the - memory allocated for the window is freed, and the window will be reallocated - by inflate() if needed. - - inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL), or if - the windowBits parameter is invalid. -*/ - -ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. - - If bits is negative, then the input stream bit buffer is emptied. Then - inflatePrime() can be called again to put bits in the buffer. This is used - to clear out bits leftover after feeding inflate a block description prior - to feeding inflate codes. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); -/* - This function returns two values, one in the lower 16 bits of the return - value, and the other in the remaining upper bits, obtained by shifting the - return value down 16 bits. If the upper value is -1 and the lower value is - zero, then inflate() is currently decoding information outside of a block. - If the upper value is -1 and the lower value is non-zero, then inflate is in - the middle of a stored block, with the lower value equaling the number of - bytes from the input remaining to copy. If the upper value is not -1, then - it is the number of bits back from the current bit position in the input of - the code (literal or length/distance pair) currently being processed. In - that case the lower value is the number of bytes already emitted for that - code. - - A code is being processed if inflate is waiting for more input to complete - decoding of the code, or if it has completed decoding but is waiting for - more output space to write the literal or match data. - - inflateMark() is used to mark locations in the input data for random - access, which may be at bit positions, and to note those cases where the - output of a code may span boundaries of random access blocks. The current - location in the input stream can be determined from avail_in and data_type - as noted in the description for the Z_BLOCK flush parameter for inflate. - - inflateMark returns the value noted above, or -65536 if the provided - source stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, - gz_headerp head)); -/* - inflateGetHeader() requests that gzip header information be stored in the - provided gz_header structure. inflateGetHeader() may be called after - inflateInit2() or inflateReset(), and before the first call of inflate(). - As inflate() processes the gzip stream, head->done is zero until the header - is completed, at which time head->done is set to one. If a zlib stream is - being decoded, then head->done is set to -1 to indicate that there will be - no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be - used to force inflate() to return immediately after header processing is - complete and before any actual data is decompressed. - - The text, time, xflags, and os fields are filled in with the gzip header - contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) If extra is not Z_NULL, then extra_max - contains the maximum number of bytes to write to extra. Once done is true, - extra_len contains the actual extra field length, and extra contains the - extra field, or that field truncated if extra_max is less than extra_len. - If name is not Z_NULL, then up to name_max characters are written there, - terminated with a zero unless the length is greater than name_max. If - comment is not Z_NULL, then up to comm_max characters are written there, - terminated with a zero unless the length is greater than comm_max. When any - of extra, name, or comment are not Z_NULL and the respective field is not - present in the header, then that field is set to Z_NULL to signal its - absence. This allows the use of deflateSetHeader() with the returned - structure to duplicate the header. However if those fields are set to - allocated memory, then the application will need to save those pointers - elsewhere so that they can be eventually freed. - - If inflateGetHeader is not used, then the header information is simply - discarded. The header is always checked for validity, including the header - CRC if present. inflateReset() will reset the process to discard the header - information. The application would need to call inflateGetHeader() again to - retrieve the header from the next gzip stream. - - inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, - unsigned char FAR *window)); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are Z_NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the parameters are invalid, Z_MEM_ERROR if the internal state could not be - allocated, or Z_VERSION_ERROR if the version of the library does not match - the version of the header file. -*/ - -typedef unsigned (*in_func) OF((void FAR *, - z_const unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); - -ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is potentially more efficient than - inflate() for file i/o applications, in that it avoids copying between the - output and the sliding window by simply making the window itself the output - buffer. inflate() can be faster on modern CPUs when used with large - buffers. inflateBack() trusts the application to not change the output - buffer passed by the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free the - allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects only - the raw deflate stream to decompress. This is different from the default - behavior of inflate(), which expects a zlib header and trailer around the - deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero -- buf is ignored in that - case -- and inflateBack() will return a buffer error. inflateBack() will - call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. - out() should return zero on success, or non-zero on failure. If out() - returns non-zero, inflateBack() will return with an error. Neither in() nor - out() are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format error - in the deflate stream (in which case strm->msg is set to indicate the nature - of the error), or Z_STREAM_ERROR if the stream was not properly initialized. - In the case of Z_BUF_ERROR, an input or output error can be distinguished - using strm->next_in which will be Z_NULL only if in() returned an error. If - strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning - non-zero. (in() will always be called before out(), so strm->next_in is - assured to be defined if out() returns non-zero.) Note that inflateBack() - cannot return Z_OK. -*/ - -ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of uInt - 3.2: size of uLong - 5.4: size of voidpf (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: ZLIB_DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - -#ifndef Z_SOLO - - /* utility functions */ - -/* - The following utility functions are implemented on top of the basic - stream-oriented functions. To simplify the interface, some default options - are assumed (compression level and memory usage, standard memory allocation - functions). The source code of these utility functions can be modified if - you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed data. compress() is equivalent to compress2() with a level - parameter of Z_DEFAULT_COMPRESSION. - - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed data. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before a - compress() or compress2() call to allocate the destination buffer. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be large enough to hold the entire - uncompressed data. (The size of the uncompressed data must have been saved - previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) Upon exit, destLen - is the actual size of the uncompressed data. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In - the case where there is not enough room, uncompress() will fill the output - buffer with the uncompressed data up to that point. -*/ - -ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong *sourceLen)); -/* - Same as uncompress, except that sourceLen is a pointer, where the - length of the source is *sourceLen. On return, *sourceLen is the number of - source bytes consumed. -*/ - - /* gzip file access functions */ - -/* - This library supports reading and writing files in gzip (.gz) format with - an interface similar to that of stdio, using the functions that start with - "gz". The gzip format is different from the zlib format. gzip is a gzip - wrapper, documented in RFC 1952, wrapped around a deflate stream. -*/ - -typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ - -/* -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); - - Opens a gzip (.gz) file for reading or writing. The mode parameter is as - in fopen ("rb" or "wb") but can also include a compression level ("wb9") or - a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only - compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' - for fixed code compression as in "wb9F". (See the description of - deflateInit2 for more information about the strategy parameter.) 'T' will - request transparent writing or appending with no compression and not using - the gzip format. - - "a" can be used instead of "w" to request that the gzip stream that will - be written be appended to the file. "+" will result in an error, since - reading and writing to the same gzip file is not supported. The addition of - "x" when writing will create the file exclusively, which fails if the file - already exists. On systems that support it, the addition of "e" when - reading or writing will set the flag to close the file on an execve() call. - - These functions, as well as gzip, will read and decode a sequence of gzip - streams in a file. The append function of gzopen() can be used to create - such a file. (Also see gzflush() for another way to do this.) When - appending, gzopen does not test whether the file begins with a gzip stream, - nor does it look for the end of the gzip streams to begin appending. gzopen - will simply append a gzip stream to the existing file. - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. When - reading, this will be detected automatically by looking for the magic two- - byte gzip header. - - gzopen returns NULL if the file could not be opened, if there was - insufficient memory to allocate the gzFile state, or if an invalid mode was - specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). - errno can be checked to determine if the reason gzopen failed was that the - file could not be opened. -*/ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); -/* - gzdopen associates a gzFile with the file descriptor fd. File descriptors - are obtained from calls like open, dup, creat, pipe or fileno (if the file - has been previously opened with fopen). The mode parameter is as in gzopen. - - The next call of gzclose on the returned gzFile will also close the file - descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor - fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, - mode);. The duplicated descriptor should be saved to avoid a leak, since - gzdopen does not close fd if it fails. If you are using fileno() to get the - file descriptor from a FILE *, then you will have to use dup() to avoid - double-close()ing the file descriptor. Both gzclose() and fclose() will - close the associated file descriptor, so they need to have different file - descriptors. - - gzdopen returns NULL if there was insufficient memory to allocate the - gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not - provided, or '+' was provided), or if fd is -1. The file descriptor is not - used until the next gz* read, write, seek, or close operation, so gzdopen - will not detect if fd is invalid (unless fd is -1). -*/ - -ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); -/* - Set the internal buffer size used by this library's functions. The - default buffer size is 8192 bytes. This function must be called after - gzopen() or gzdopen(), and before any other calls that read or write the - file. The buffer memory allocation is always deferred to the first read or - write. Three times that size in buffer space is allocated. A larger buffer - size of, for example, 64K or 128K bytes will noticeably increase the speed - of decompression (reading). - - The new buffer size also affects the maximum length for gzprintf(). - - gzbuffer() returns 0 on success, or -1 on failure, such as being called - too late. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. Previously provided - data is flushed before the parameter change. - - gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not - opened for writing, Z_ERRNO if there is an error writing the flushed data, - or Z_MEM_ERROR if there is a memory allocation error. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. If - the input file is not in gzip format, gzread copies the given number of - bytes into the buffer directly from the file. - - After reaching the end of a gzip stream in the input, gzread will continue - to read, looking for another gzip stream. Any number of gzip streams may be - concatenated in the input file, and will all be decompressed by gzread(). - If something other than a gzip stream is encountered after a gzip stream, - that remaining trailing garbage is ignored (and no error is returned). - - gzread can be used to read a gzip file that is being concurrently written. - Upon reaching the end of the input, gzread will return with the available - data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then - gzclearerr can be used to clear the end of file indicator in order to permit - gzread to be tried again. Z_OK indicates that a gzip stream was completed - on the last gzread. Z_BUF_ERROR indicates that the input file ended in the - middle of a gzip stream. Note that gzread does not return -1 in the event - of an incomplete gzip stream. This error is deferred until gzclose(), which - will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip - stream. Alternatively, gzerror can be used before gzclose to detect this - case. - - gzread returns the number of uncompressed bytes actually read, less than - len for end of file, or -1 for error. If len is too large to fit in an int, - then nothing is read, -1 is returned, and the error state is set to - Z_STREAM_ERROR. -*/ - -ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems, - gzFile file)); -/* - Read up to nitems items of size size from file to buf, otherwise operating - as gzread() does. This duplicates the interface of stdio's fread(), with - size_t request and return types. If the library defines size_t, then - z_size_t is identical to size_t. If not, then z_size_t is an unsigned - integer type that can contain a pointer. - - gzfread() returns the number of full items read of size size, or zero if - the end of the file was reached and a full item could not be read, or if - there was an error. gzerror() must be consulted if zero is returned in - order to determine if there was an error. If the multiplication of size and - nitems overflows, i.e. the product does not fit in a z_size_t, then nothing - is read, zero is returned, and the error state is set to Z_STREAM_ERROR. - - In the event that the end of file is reached and only a partial item is - available at the end, i.e. the remaining uncompressed data length is not a - multiple of size, then the final partial item is nevetheless read into buf - and the end-of-file flag is set. The length of the partial item read is not - provided, but could be inferred from the result of gztell(). This behavior - is the same as the behavior of fread() implementations in common libraries, - but it prevents the direct use of gzfread() to read a concurrently written - file, reseting and retrying on end-of-file, when size is not 1. -*/ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes written or 0 in case of - error. -*/ - -ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size, - z_size_t nitems, gzFile file)); -/* - gzfwrite() writes nitems items of size size from buf to file, duplicating - the interface of stdio's fwrite(), with size_t request and return types. If - the library defines size_t, then z_size_t is identical to size_t. If not, - then z_size_t is an unsigned integer type that can contain a pointer. - - gzfwrite() returns the number of full items written of size size, or zero - if there was an error. If the multiplication of size and nitems overflows, - i.e. the product does not fit in a z_size_t, then nothing is written, zero - is returned, and the error state is set to Z_STREAM_ERROR. -*/ - -ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); -/* - Converts, formats, and writes the arguments to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written, or a negative zlib error code in case - of error. The number of uncompressed bytes written is limited to 8191, or - one less than the buffer size given to gzbuffer(). The caller should assure - that this limit is not exceeded. If it is exceeded, then gzprintf() will - return an error (0) with nothing written. In this case, there may also be a - buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() - because the secure snprintf() or vsnprintf() functions were not available. - This can be determined using zlibCompileFlags(). -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or a - newline character is read and transferred to buf, or an end-of-file - condition is encountered. If any characters are read or if len == 1, the - string is terminated with a null character. If no characters are read due - to an end-of-file or len < 1, then the buffer is left untouched. - - gzgets returns buf which is a null-terminated string, or it returns NULL - for end-of-file or in case of error. If there was an error, the contents at - buf are indeterminate. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. gzputc - returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte or -1 - in case of end of file or error. This is implemented as a macro for speed. - As such, it does not do all of the checking the other functions do. I.e. - it does not check to see if file is NULL, nor whether the structure file - points to has been clobbered or not. -*/ - -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); -/* - Push one character back onto the stream to be read as the first character - on the next read. At least one character of push-back is allowed. - gzungetc() returns the character pushed, or -1 on failure. gzungetc() will - fail if c is -1, and may fail if a character has been pushed but not read - yet. If gzungetc is used immediately after gzopen or gzdopen, at least the - output buffer size of pushed characters is allowed. (See gzbuffer above.) - The pushed character will be discarded if the stream is repositioned with - gzseek() or gzrewind(). -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter flush - is as in the deflate() function. The return value is the zlib error number - (see function gzerror below). gzflush is only permitted when writing. - - If the flush parameter is Z_FINISH, the remaining data is written and the - gzip stream is completed in the output. If gzwrite() is called again, a new - gzip stream will be started in the output. gzread() is able to read such - concatenated gzip streams. - - gzflush should be called only when strictly necessary because it will - degrade compression if called too often. -*/ - -/* -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); - - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -/* -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); - - Returns the starting position for the next gzread or gzwrite on the given - compressed file. This position represents a number of bytes in the - uncompressed data stream, and is zero when starting, even if appending or - reading a gzip stream from the middle of a file using gzdopen(). - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -/* -ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); - - Returns the current offset in the file being read or written. This offset - includes the count of bytes that precede the gzip stream, for example when - appending or when using gzdopen() for reading. When reading, the offset - does not include as yet unused buffered input. This information can be used - for a progress indicator. On error, gzoffset() returns -1. -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns true (1) if the end-of-file indicator has been set while reading, - false (0) otherwise. Note that the end-of-file indicator is set only if the - read tried to go past the end of the input, but came up short. Therefore, - just like feof(), gzeof() may return false even if there is no more data to - read, in the event that the last read request was for the exact number of - bytes remaining in the input file. This will happen if the input file size - is an exact multiple of the buffer size. - - If gzeof() returns true, then the read functions will return no more data, - unless the end-of-file indicator is reset by gzclearerr() and the input file - has grown since the previous end of file was detected. -*/ - -ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); -/* - Returns true (1) if file is being copied directly while reading, or false - (0) if file is a gzip stream being decompressed. - - If the input file is empty, gzdirect() will return true, since the input - does not contain a gzip stream. - - If gzdirect() is used immediately after gzopen() or gzdopen() it will - cause buffers to be allocated to allow reading the file to determine if it - is a gzip file. Therefore if gzbuffer() is used, it should be called before - gzdirect(). - - When writing, gzdirect() returns true (1) if transparent writing was - requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: - gzdirect() is not needed when writing. Transparent writing must be - explicitly requested, so the application already knows the answer. When - linking statically, using gzdirect() will include all of the zlib code for - gzip file reading and decompression, which may not be desired.) -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file and - deallocates the (de)compression state. Note that once file is closed, you - cannot call gzerror with file, since its structures have been deallocated. - gzclose must not be called more than once on the same file, just as free - must not be called more than once on the same allocation. - - gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a - file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the - last read ended in the middle of a gzip stream, or Z_OK on success. -*/ - -ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); -ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); -/* - Same as gzclose(), but gzclose_r() is only for use when reading, and - gzclose_w() is only for use when writing or appending. The advantage to - using these instead of gzclose() is that they avoid linking in zlib - compression or decompression code that is not used when only reading or only - writing respectively. If gzclose() is used, then both compression and - decompression code will be included the application when linking to a static - zlib library. -*/ - -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the given - compressed file. errnum is set to zlib error number. If an error occurred - in the file system and not in the compression library, errnum is set to - Z_ERRNO and the application may consult errno to get the exact error code. - - The application must not modify the returned string. Future calls to - this function may invalidate the previously returned string. If file is - closed, then the string previously returned by gzerror will no longer be - available. - - gzerror() should be used to distinguish errors from end-of-file for those - functions above that do not distinguish those cases in their return values. -*/ - -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); -/* - Clears the error and end-of-file flags for file. This is analogous to the - clearerr() function in stdio. This is useful for continuing to read a gzip - file that is being written concurrently. -*/ - -#endif /* !Z_SOLO */ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the compression - library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is Z_NULL, this function returns the - required initial value for the checksum. - - An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed - much faster. - - Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf, - z_size_t len)); -/* - Same as adler32(), but with a size_t length. -*/ - -/* -ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, - z_off_t len2)); - - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note - that the z_off_t type (like off_t) is a signed integer. If len2 is - negative, the result has no meaning or utility. -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is Z_NULL, this function returns the required - initial value for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. - - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - -ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf, - z_size_t len)); -/* - Same as crc32(), but with a size_t length. -*/ - -/* -ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); - - Combine two CRC-32 check values into one. For two sequences of bytes, - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); -#ifdef Z_PREFIX_SET -# define z_deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) -# define z_inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) -# define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) -# define z_inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ - (int)sizeof(z_stream)) -# define z_inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, (int)sizeof(z_stream)) -#else -# define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) -# define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) -# define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) -# define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ - (int)sizeof(z_stream)) -# define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, (int)sizeof(z_stream)) -#endif - -#ifndef Z_SOLO - -/* gzgetc() macro and its supporting function and exposed data structure. Note - * that the real internal state is much larger than the exposed structure. - * This abbreviated structure exposes just enough for the gzgetc() macro. The - * user should not mess with these exposed elements, since their names or - * behavior could change in the future, perhaps even capriciously. They can - * only be used by the gzgetc() macro. You have been warned. - */ -struct gzFile_s { - unsigned have; - unsigned char *next; - z_off64_t pos; -}; -ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ -#ifdef Z_PREFIX_SET -# undef z_gzgetc -# define z_gzgetc(g) \ - ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) -#else -# define gzgetc(g) \ - ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g)) -#endif - -/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or - * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if - * both are true, the application gets the *64 functions, and the regular - * functions are changed to 64 bits) -- in case these are set on systems - * without large file support, _LFS64_LARGEFILE must also be true - */ -#ifdef Z_LARGE64 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); - ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); -#endif - -#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) -# ifdef Z_PREFIX_SET -# define z_gzopen z_gzopen64 -# define z_gzseek z_gzseek64 -# define z_gztell z_gztell64 -# define z_gzoffset z_gzoffset64 -# define z_adler32_combine z_adler32_combine64 -# define z_crc32_combine z_crc32_combine64 -# else -# define gzopen gzopen64 -# define gzseek gzseek64 -# define gztell gztell64 -# define gzoffset gzoffset64 -# define adler32_combine adler32_combine64 -# define crc32_combine crc32_combine64 -# endif -# ifndef Z_LARGE64 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); - ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); -# endif -#else - ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); - ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); - ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); - ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); -#endif - -#else /* Z_SOLO */ - - ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); - -#endif /* !Z_SOLO */ - -/* undocumented functions */ -ZEXTERN const char * ZEXPORT zError OF((int)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); -ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); -ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); -ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int)); -ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp)); -ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); -ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); -#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) -ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, - const char *mode)); -#endif -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifndef Z_SOLO -ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, - const char *format, - va_list va)); -# endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H */ diff --git a/compat/zlib/zlib.map b/compat/zlib/zlib.map deleted file mode 100644 index 40fa9db..0000000 --- a/compat/zlib/zlib.map +++ /dev/null @@ -1,94 +0,0 @@ -ZLIB_1.2.0 { - global: - compressBound; - deflateBound; - inflateBack; - inflateBackEnd; - inflateBackInit_; - inflateCopy; - local: - deflate_copyright; - inflate_copyright; - inflate_fast; - inflate_table; - zcalloc; - zcfree; - z_errmsg; - gz_error; - gz_intmax; - _*; -}; - -ZLIB_1.2.0.2 { - gzclearerr; - gzungetc; - zlibCompileFlags; -} ZLIB_1.2.0; - -ZLIB_1.2.0.8 { - deflatePrime; -} ZLIB_1.2.0.2; - -ZLIB_1.2.2 { - adler32_combine; - crc32_combine; - deflateSetHeader; - inflateGetHeader; -} ZLIB_1.2.0.8; - -ZLIB_1.2.2.3 { - deflateTune; - gzdirect; -} ZLIB_1.2.2; - -ZLIB_1.2.2.4 { - inflatePrime; -} ZLIB_1.2.2.3; - -ZLIB_1.2.3.3 { - adler32_combine64; - crc32_combine64; - gzopen64; - gzseek64; - gztell64; - inflateUndermine; -} ZLIB_1.2.2.4; - -ZLIB_1.2.3.4 { - inflateReset2; - inflateMark; -} ZLIB_1.2.3.3; - -ZLIB_1.2.3.5 { - gzbuffer; - gzoffset; - gzoffset64; - gzclose_r; - gzclose_w; -} ZLIB_1.2.3.4; - -ZLIB_1.2.5.1 { - deflatePending; -} ZLIB_1.2.3.5; - -ZLIB_1.2.5.2 { - deflateResetKeep; - gzgetc_; - inflateResetKeep; -} ZLIB_1.2.5.1; - -ZLIB_1.2.7.1 { - inflateGetDictionary; - gzvprintf; -} ZLIB_1.2.5.2; - -ZLIB_1.2.9 { - inflateCodesUsed; - inflateValidate; - uncompress2; - gzfread; - gzfwrite; - deflateGetDictionary; - adler32_z; - crc32_z; -} ZLIB_1.2.7.1; diff --git a/compat/zlib/zlib.pc.cmakein b/compat/zlib/zlib.pc.cmakein deleted file mode 100644 index a5e6429..0000000 --- a/compat/zlib/zlib.pc.cmakein +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=@CMAKE_INSTALL_PREFIX@ -libdir=@INSTALL_LIB_DIR@ -sharedlibdir=@INSTALL_LIB_DIR@ -includedir=@INSTALL_INC_DIR@ - -Name: zlib -Description: zlib compression library -Version: @VERSION@ - -Requires: -Libs: -L${libdir} -L${sharedlibdir} -lz -Cflags: -I${includedir} diff --git a/compat/zlib/zlib.pc.in b/compat/zlib/zlib.pc.in deleted file mode 100644 index 7e5acf9..0000000 --- a/compat/zlib/zlib.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -sharedlibdir=@sharedlibdir@ -includedir=@includedir@ - -Name: zlib -Description: zlib compression library -Version: @VERSION@ - -Requires: -Libs: -L${libdir} -L${sharedlibdir} -lz -Cflags: -I${includedir} diff --git a/compat/zlib/zlib2ansi b/compat/zlib/zlib2ansi deleted file mode 100755 index 15e3e16..0000000 --- a/compat/zlib/zlib2ansi +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/perl - -# Transform K&R C function definitions into ANSI equivalent. -# -# Author: Paul Marquess -# Version: 1.0 -# Date: 3 October 2006 - -# TODO -# -# Asumes no function pointer parameters. unless they are typedefed. -# Assumes no literal strings that look like function definitions -# Assumes functions start at the beginning of a line - -use strict; -use warnings; - -local $/; -$_ = <>; - -my $sp = qr{ \s* (?: /\* .*? \*/ )? \s* }x; # assume no nested comments - -my $d1 = qr{ $sp (?: [\w\*\s]+ $sp)* $sp \w+ $sp [\[\]\s]* $sp }x ; -my $decl = qr{ $sp (?: \w+ $sp )+ $d1 }xo ; -my $dList = qr{ $sp $decl (?: $sp , $d1 )* $sp ; $sp }xo ; - - -while (s/^ - ( # Start $1 - ( # Start $2 - .*? # Minimal eat content - ( ^ \w [\w\s\*]+ ) # $3 -- function name - \s* # optional whitespace - ) # $2 - Matched up to before parameter list - - \( \s* # Literal "(" + optional whitespace - ( [^\)]+ ) # $4 - one or more anythings except ")" - \s* \) # optional whitespace surrounding a Literal ")" - - ( (?: $dList )+ ) # $5 - - $sp ^ { # literal "{" at start of line - ) # Remember to $1 - //xsom - ) -{ - my $all = $1 ; - my $prefix = $2; - my $param_list = $4 ; - my $params = $5; - - StripComments($params); - StripComments($param_list); - $param_list =~ s/^\s+//; - $param_list =~ s/\s+$//; - - my $i = 0 ; - my %pList = map { $_ => $i++ } - split /\s*,\s*/, $param_list; - my $pMatch = '(\b' . join('|', keys %pList) . '\b)\W*$' ; - - my @params = split /\s*;\s*/, $params; - my @outParams = (); - foreach my $p (@params) - { - if ($p =~ /,/) - { - my @bits = split /\s*,\s*/, $p; - my $first = shift @bits; - $first =~ s/^\s*//; - push @outParams, $first; - $first =~ /^(\w+\s*)/; - my $type = $1 ; - push @outParams, map { $type . $_ } @bits; - } - else - { - $p =~ s/^\s+//; - push @outParams, $p; - } - } - - - my %tmp = map { /$pMatch/; $_ => $pList{$1} } - @outParams ; - - @outParams = map { " $_" } - sort { $tmp{$a} <=> $tmp{$b} } - @outParams ; - - print $prefix ; - print "(\n" . join(",\n", @outParams) . ")\n"; - print "{" ; - -} - -# Output any trailing code. -print ; -exit 0; - - -sub StripComments -{ - - no warnings; - - # Strip C & C++ coments - # From the perlfaq - $_[0] =~ - - s{ - /\* ## Start of /* ... */ comment - [^*]*\*+ ## Non-* followed by 1-or-more *'s - ( - [^/*][^*]*\*+ - )* ## 0-or-more things which don't start with / - ## but do end with '*' - / ## End of /* ... */ comment - - | ## OR C++ Comment - // ## Start of C++ comment // - [^\n]* ## followed by 0-or-more non end of line characters - - | ## OR various things which aren't comments: - - ( - " ## Start of " ... " string - ( - \\. ## Escaped char - | ## OR - [^"\\] ## Non "\ - )* - " ## End of " ... " string - - | ## OR - - ' ## Start of ' ... ' string - ( - \\. ## Escaped char - | ## OR - [^'\\] ## Non '\ - )* - ' ## End of ' ... ' string - - | ## OR - - . ## Anything other char - [^/"'\\]* ## Chars which doesn't start a comment, string or escape - ) - }{$2}gxs; - -} diff --git a/compat/zlib/zutil.c b/compat/zlib/zutil.c deleted file mode 100644 index a76c6b0..0000000 --- a/compat/zlib/zutil.c +++ /dev/null @@ -1,325 +0,0 @@ -/* zutil.c -- target dependent utility functions for the compression library - * Copyright (C) 1995-2017 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zutil.h" -#ifndef Z_SOLO -# include "gzguts.h" -#endif - -z_const char * const z_errmsg[10] = { - (z_const char *)"need dictionary", /* Z_NEED_DICT 2 */ - (z_const char *)"stream end", /* Z_STREAM_END 1 */ - (z_const char *)"", /* Z_OK 0 */ - (z_const char *)"file error", /* Z_ERRNO (-1) */ - (z_const char *)"stream error", /* Z_STREAM_ERROR (-2) */ - (z_const char *)"data error", /* Z_DATA_ERROR (-3) */ - (z_const char *)"insufficient memory", /* Z_MEM_ERROR (-4) */ - (z_const char *)"buffer error", /* Z_BUF_ERROR (-5) */ - (z_const char *)"incompatible version",/* Z_VERSION_ERROR (-6) */ - (z_const char *)"" -}; - - -const char * ZEXPORT zlibVersion() -{ - return ZLIB_VERSION; -} - -uLong ZEXPORT zlibCompileFlags() -{ - uLong flags; - - flags = 0; - switch ((int)(sizeof(uInt))) { - case 2: break; - case 4: flags += 1; break; - case 8: flags += 2; break; - default: flags += 3; - } - switch ((int)(sizeof(uLong))) { - case 2: break; - case 4: flags += 1 << 2; break; - case 8: flags += 2 << 2; break; - default: flags += 3 << 2; - } - switch ((int)(sizeof(voidpf))) { - case 2: break; - case 4: flags += 1 << 4; break; - case 8: flags += 2 << 4; break; - default: flags += 3 << 4; - } - switch ((int)(sizeof(z_off_t))) { - case 2: break; - case 4: flags += 1 << 6; break; - case 8: flags += 2 << 6; break; - default: flags += 3 << 6; - } -#ifdef ZLIB_DEBUG - flags += 1 << 8; -#endif -#if defined(ASMV) || defined(ASMINF) - flags += 1 << 9; -#endif -#ifdef ZLIB_WINAPI - flags += 1 << 10; -#endif -#ifdef BUILDFIXED - flags += 1 << 12; -#endif -#ifdef DYNAMIC_CRC_TABLE - flags += 1 << 13; -#endif -#ifdef NO_GZCOMPRESS - flags += 1L << 16; -#endif -#ifdef NO_GZIP - flags += 1L << 17; -#endif -#ifdef PKZIP_BUG_WORKAROUND - flags += 1L << 20; -#endif -#ifdef FASTEST - flags += 1L << 21; -#endif -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifdef NO_vsnprintf - flags += 1L << 25; -# ifdef HAS_vsprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_vsnprintf_void - flags += 1L << 26; -# endif -# endif -#else - flags += 1L << 24; -# ifdef NO_snprintf - flags += 1L << 25; -# ifdef HAS_sprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_snprintf_void - flags += 1L << 26; -# endif -# endif -#endif - return flags; -} - -#ifdef ZLIB_DEBUG -#include -# ifndef verbose -# define verbose 0 -# endif -int ZLIB_INTERNAL z_verbose = verbose; - -void ZLIB_INTERNAL z_error (m) - char *m; -{ - fprintf(stderr, "%s\n", m); - exit(1); -} -#endif - -/* exported to allow conversion of error code to string for compress() and - * uncompress() - */ -const char * ZEXPORT zError(err) - int err; -{ - return ERR_MSG(err); -} - -#if defined(_WIN32_WCE) - /* The Microsoft C Run-Time Library for Windows CE doesn't have - * errno. We define it as a global variable to simplify porting. - * Its value is always 0 and should not be used. - */ - int errno = 0; -#endif - -#ifndef HAVE_MEMCPY - -void ZLIB_INTERNAL zmemcpy(dest, source, len) - Bytef* dest; - const Bytef* source; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = *source++; /* ??? to be unrolled */ - } while (--len != 0); -} - -int ZLIB_INTERNAL zmemcmp(s1, s2, len) - const Bytef* s1; - const Bytef* s2; - uInt len; -{ - uInt j; - - for (j = 0; j < len; j++) { - if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; - } - return 0; -} - -void ZLIB_INTERNAL zmemzero(dest, len) - Bytef* dest; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = 0; /* ??? to be unrolled */ - } while (--len != 0); -} -#endif - -#ifndef Z_SOLO - -#ifdef SYS16BIT - -#ifdef __TURBOC__ -/* Turbo C in 16-bit mode */ - -# define MY_ZCALLOC - -/* Turbo C malloc() does not allow dynamic allocation of 64K bytes - * and farmalloc(64K) returns a pointer with an offset of 8, so we - * must fix the pointer. Warning: the pointer must be put back to its - * original form in order to free it, use zcfree(). - */ - -#define MAX_PTR 10 -/* 10*64K = 640K */ - -local int next_ptr = 0; - -typedef struct ptr_table_s { - voidpf org_ptr; - voidpf new_ptr; -} ptr_table; - -local ptr_table table[MAX_PTR]; -/* This table is used to remember the original form of pointers - * to large buffers (64K). Such pointers are normalized with a zero offset. - * Since MSDOS is not a preemptive multitasking OS, this table is not - * protected from concurrent access. This hack doesn't work anyway on - * a protected system like OS/2. Use Microsoft C instead. - */ - -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) -{ - voidpf buf; - ulg bsize = (ulg)items*size; - - (void)opaque; - - /* If we allocate less than 65520 bytes, we assume that farmalloc - * will return a usable pointer which doesn't have to be normalized. - */ - if (bsize < 65520L) { - buf = farmalloc(bsize); - if (*(ush*)&buf != 0) return buf; - } else { - buf = farmalloc(bsize + 16L); - } - if (buf == NULL || next_ptr >= MAX_PTR) return NULL; - table[next_ptr].org_ptr = buf; - - /* Normalize the pointer to seg:0 */ - *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; - *(ush*)&buf = 0; - table[next_ptr++].new_ptr = buf; - return buf; -} - -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) -{ - int n; - - (void)opaque; - - if (*(ush*)&ptr != 0) { /* object < 64K */ - farfree(ptr); - return; - } - /* Find the original pointer */ - for (n = 0; n < next_ptr; n++) { - if (ptr != table[n].new_ptr) continue; - - farfree(table[n].org_ptr); - while (++n < next_ptr) { - table[n-1] = table[n]; - } - next_ptr--; - return; - } - Assert(0, "zcfree: ptr not found"); -} - -#endif /* __TURBOC__ */ - - -#ifdef M_I86 -/* Microsoft C in 16-bit mode */ - -# define MY_ZCALLOC - -#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) -# define _halloc halloc -# define _hfree hfree -#endif - -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) -{ - (void)opaque; - return _halloc((long)items, size); -} - -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) -{ - (void)opaque; - _hfree(ptr); -} - -#endif /* M_I86 */ - -#endif /* SYS16BIT */ - - -#ifndef MY_ZCALLOC /* Any system without a special alloc function */ - -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern voidp calloc OF((uInt items, uInt size)); -extern void free OF((voidpf ptr)); -#endif - -voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) - voidpf opaque; - unsigned items; - unsigned size; -{ - (void)opaque; - return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : - (voidpf)calloc(items, size); -} - -void ZLIB_INTERNAL zcfree (opaque, ptr) - voidpf opaque; - voidpf ptr; -{ - (void)opaque; - free(ptr); -} - -#endif /* MY_ZCALLOC */ - -#endif /* !Z_SOLO */ diff --git a/compat/zlib/zutil.h b/compat/zlib/zutil.h deleted file mode 100644 index b079ea6..0000000 --- a/compat/zlib/zutil.h +++ /dev/null @@ -1,271 +0,0 @@ -/* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef ZUTIL_H -#define ZUTIL_H - -#ifdef HAVE_HIDDEN -# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) -#else -# define ZLIB_INTERNAL -#endif - -#include "zlib.h" - -#if defined(STDC) && !defined(Z_SOLO) -# if !(defined(_WIN32_WCE) && defined(_MSC_VER)) -# include -# endif -# include -# include -#endif - -#ifdef Z_SOLO - typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ -#endif - -#ifndef local -# define local static -#endif -/* since "static" is used to mean two completely different things in C, we - define "local" for the non-static meaning of "static", for readability - (compile with -Dlocal if your debugger can't find static symbols) */ - -typedef unsigned char uch; -typedef uch FAR uchf; -typedef unsigned short ush; -typedef ush FAR ushf; -typedef unsigned long ulg; - -extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] - -#define ERR_RETURN(strm,err) \ - return (strm->msg = ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - - /* common constants */ - -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - - /* target dependencies */ - -#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) -# define OS_CODE 0x00 -# ifndef Z_SOLO -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) - /* Allow compilation with ANSI keywords only enabled */ - void _Cdecl farfree( void *block ); - void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include -# endif -# else /* MSC or DJGPP */ -# include -# endif -# endif -#endif - -#ifdef AMIGA -# define OS_CODE 1 -#endif - -#if defined(VAXC) || defined(VMS) -# define OS_CODE 2 -# define F_OPEN(name, mode) \ - fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") -#endif - -#ifdef __370__ -# if __TARGET_LIB__ < 0x20000000 -# define OS_CODE 4 -# elif __TARGET_LIB__ < 0x40000000 -# define OS_CODE 11 -# else -# define OS_CODE 8 -# endif -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 5 -#endif - -#ifdef OS2 -# define OS_CODE 6 -# if defined(M_I86) && !defined(Z_SOLO) -# include -# endif -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 7 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif -#endif - -#ifdef __acorn -# define OS_CODE 13 -#endif - -#if defined(WIN32) && !defined(__CYGWIN__) -# define OS_CODE 10 -#endif - -#ifdef _BEOS_ -# define OS_CODE 16 -#endif - -#ifdef __TOS_OS400__ -# define OS_CODE 18 -#endif - -#ifdef __APPLE__ -# define OS_CODE 19 -#endif - -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - -#if defined(__BORLANDC__) && !defined(MSDOS) - #pragma warn -8004 - #pragma warn -8008 - #pragma warn -8066 -#endif - -/* provide prototypes for these when building zlib without LFS */ -#if !defined(_WIN32) && \ - (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); -#endif - - /* common defaults */ - -#ifndef OS_CODE -# define OS_CODE 3 /* assume Unix */ -#endif - -#ifndef F_OPEN -# define F_OPEN(name, mode) fopen((name), (mode)) -#endif - - /* functions */ - -#if defined(pyr) || defined(Z_SOLO) -# define NO_MEMCPY -#endif -#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) - /* Use our own functions for small and medium model with MSC <= 5.0. - * You may have to use the same strategy for Borland C (untested). - * The __SC__ check is for Symantec. - */ -# define NO_MEMCPY -#endif -#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) -# define HAVE_MEMCPY -#endif -#ifdef HAVE_MEMCPY -# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ -# define zmemcpy _fmemcpy -# define zmemcmp _fmemcmp -# define zmemzero(dest, len) _fmemset(dest, 0, len) -# else -# define zmemcpy memcpy -# define zmemcmp memcmp -# define zmemzero(dest, len) memset(dest, 0, len) -# endif -#else - void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); - int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); - void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); -#endif - -/* Diagnostic functions */ -#ifdef ZLIB_DEBUG -# include - extern int ZLIB_INTERNAL z_verbose; - extern void ZLIB_INTERNAL z_error OF((char *m)); -# define Assert(cond,msg) {if(!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose>=0) fprintf x ;} -# define Tracev(x) {if (z_verbose>0) fprintf x ;} -# define Tracevv(x) {if (z_verbose>1) fprintf x ;} -# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} -# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - -#ifndef Z_SOLO - voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, - unsigned size)); - void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); -#endif - -#define ZALLOC(strm, items, size) \ - (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -/* Reverse the bytes in a 32-bit value */ -#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) - -#endif /* ZUTIL_H */ diff --git a/doc/Access.3 b/doc/Access.3 deleted file mode 100644 index 699d7ed..0000000 --- a/doc/Access.3 +++ /dev/null @@ -1,71 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_Access 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_Access, Tcl_Stat \- check file permissions and other attributes -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_Access\fR(\fIpath\fR, \fImode\fR) -.sp -int -\fBTcl_Stat\fR(\fIpath\fR, \fIstatPtr\fR) -.SH ARGUMENTS -.AS "struct stat" *statPtr out -.AP char *path in -Native name of the file to check the attributes of. -.AP int mode in -Mask consisting of one or more of \fBR_OK\fR, \fBW_OK\fR, \fBX_OK\fR and -\fBF_OK\fR. \fBR_OK\fR, \fBW_OK\fR and \fBX_OK\fR request checking whether the -file exists and has read, write and execute permissions, respectively. -\fBF_OK\fR just requests a check for the existence of the file. -.AP "struct stat" *statPtr out -The structure that contains the result. -.BE -.SH DESCRIPTION -.PP -As of Tcl 8.4, the object-based APIs \fBTcl_FSAccess\fR and \fBTcl_FSStat\fR -should be used in preference to \fBTcl_Access\fR and \fBTcl_Stat\fR, wherever -possible. Those functions also support Tcl's virtual filesystem layer, which -these do not. -.SS "OBSOLETE FUNCTIONS" -.PP -There are two reasons for calling \fBTcl_Access\fR and \fBTcl_Stat\fR rather -than calling system level functions \fBaccess\fR and \fBstat\fR directly. -First, the Windows implementation of both functions fixes some bugs in the -system level calls. Second, both \fBTcl_Access\fR and \fBTcl_Stat\fR (as well -as \fBTcl_OpenFileChannelProc\fR) hook into a linked list of functions. This -allows the possibility to reroute file access to alternative media or access -methods. -.PP -\fBTcl_Access\fR checks whether the process would be allowed to read, write or -test for existence of the file (or other file system object) whose name is -\fIpath\fR. If \fIpath\fR is a symbolic link on Unix, then permissions of the -file referred by this symbolic link are tested. -.PP -On success (all requested permissions granted), zero is returned. On error (at -least one bit in mode asked for a permission that is denied, or some other -error occurred), -1 is returned. -.PP -\fBTcl_Stat\fR fills the stat structure \fIstatPtr\fR with information about -the specified file. You do not need any access rights to the file to get this -information but you need search rights to all directories named in the path -leading to the file. The stat structure includes info regarding device, inode -(always 0 on Windows), privilege mode, nlink (always 1 on Windows), user id -(always 0 on Windows), group id (always 0 on Windows), rdev (same as device on -Windows), size, last access time, last modification time, and creation time. -.PP -If \fIpath\fR exists, \fBTcl_Stat\fR returns 0 and the stat structure is -filled with data. Otherwise, -1 is returned, and no stat info is given. -.SH KEYWORDS -stat, access -.SH "SEE ALSO" -Tcl_FSAccess(3), Tcl_FSStat(3) diff --git a/doc/AddErrInfo.3 b/doc/AddErrInfo.3 deleted file mode 100644 index 0b59349..0000000 --- a/doc/AddErrInfo.3 +++ /dev/null @@ -1,312 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_AddErrorInfo 3 8.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_GetReturnOptions, Tcl_SetReturnOptions, Tcl_AddErrorInfo, Tcl_AppendObjToErrorInfo, Tcl_AddObjErrorInfo, Tcl_SetObjErrorCode, Tcl_SetErrorCode, Tcl_SetErrorCodeVA, Tcl_SetErrorLine, Tcl_GetErrorLine, Tcl_PosixError, Tcl_LogCommandInfo \- retrieve or record information about errors and other return options -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Obj * -\fBTcl_GetReturnOptions\fR(\fIinterp, code\fR) -.sp -int -\fBTcl_SetReturnOptions\fR(\fIinterp, options\fR) -.sp -\fBTcl_AddErrorInfo\fR(\fIinterp, message\fR) -.sp -\fBTcl_AppendObjToErrorInfo\fR(\fIinterp, objPtr\fR) -.sp -\fBTcl_AddObjErrorInfo\fR(\fIinterp, message, length\fR) -.sp -\fBTcl_SetObjErrorCode\fR(\fIinterp, errorObjPtr\fR) -.sp -\fBTcl_SetErrorCode\fR(\fIinterp, element, element, ... \fB(char *) NULL\fR) -.sp -\fBTcl_SetErrorCodeVA\fR(\fIinterp, argList\fR) -.sp -\fBTcl_GetErrorLine\fR(\fIinterp\fR) -.sp -\fBTcl_SetErrorLine\fR(\fIinterp, lineNum\fR) -.sp -const char * -\fBTcl_PosixError\fR(\fIinterp\fR) -.sp -void -\fBTcl_LogCommandInfo\fR(\fIinterp, script, command, commandLength\fR) -.SH ARGUMENTS -.AS Tcl_Interp commandLength -.AP Tcl_Interp *interp in -Interpreter in which to record information. -.AP int code -The code returned from script evaluation. -.AP Tcl_Obj *options -A dictionary of return options. -.AP char *message in -For \fBTcl_AddErrorInfo\fR, -this is a conventional C string to append to the \fB\-errorinfo\fR return option. -For \fBTcl_AddObjErrorInfo\fR, -this points to the first byte of an array of \fIlength\fR bytes -containing a string to append to the \fB\-errorinfo\fR return option. -This byte array may contain embedded null bytes -unless \fIlength\fR is negative. -.AP Tcl_Obj *objPtr in -A message to be appended to the \fB\-errorinfo\fR return option -in the form of a Tcl_Obj value. -.AP int length in -The number of bytes to copy from \fImessage\fR when -appending to the \fB\-errorinfo\fR return option. -If negative, all bytes up to the first null byte are used. -.AP Tcl_Obj *errorObjPtr in -The \fB\-errorcode\fR return option will be set to this value. -.AP char *element in -String to record as one element of the \fB\-errorcode\fR return option. -Last \fIelement\fR argument must be NULL. -.AP va_list argList in -An argument list which must have been initialized using -\fBva_start\fR, and cleared using \fBva_end\fR. -.AP int lineNum -The line number of a script where an error occurred. -.AP "const char" *script in -Pointer to first character in script containing command (must be <= command) -.AP "const char" *command in -Pointer to first character in command that generated the error -.AP int commandLength in -Number of bytes in command; -1 means use all bytes up to first null byte -.BE -.SH DESCRIPTION -.PP -The \fBTcl_SetReturnOptions\fR and \fBTcl_GetReturnOptions\fR -routines expose the same capabilities as the \fBreturn\fR and -\fBcatch\fR commands, respectively, in the form of a C interface. -.PP -\fBTcl_GetReturnOptions\fR retrieves the dictionary of return options -from an interpreter following a script evaluation. -Routines such as \fBTcl_Eval\fR are called to evaluate a -script in an interpreter. These routines return an integer -completion code. These routines also leave in the interpreter -both a result and a dictionary of return options generated -by script evaluation. Just as \fBTcl_GetObjResult\fR retrieves -the result, \fBTcl_GetReturnOptions\fR retrieves the dictionary -of return options. The integer completion code should be -passed as the \fIcode\fR argument to \fBTcl_GetReturnOptions\fR -so that all required options will be present in the dictionary. -Specifically, a \fIcode\fR value of \fBTCL_ERROR\fR will -ensure that entries for the keys \fB\-errorinfo\fR, -\fB\-errorcode\fR, and \fB\-errorline\fR will appear in the -dictionary. Also, the entries for the keys \fB\-code\fR -and \fB\-level\fR will be adjusted if necessary to agree -with the value of \fIcode\fR. The \fB(Tcl_Obj *)\fR returned -by \fBTcl_GetReturnOptions\fR points to an unshared -\fBTcl_Obj\fR with reference count of zero. The dictionary -may be written to, either adding, removing, or overwriting -any entries in it, without the need to check for a shared value. -As with any \fBTcl_Obj\fR with reference count of zero, it is up to -the caller to arrange for its disposal with \fBTcl_DecrRefCount\fR or -to a reference to it via \fBTcl_IncrRefCount\fR (or one of the many -functions that call that, notably including \fBTcl_SetObjResult\fR and -\fBTcl_SetVar2Ex\fR). -.PP -A typical usage for \fBTcl_GetReturnOptions\fR is to -retrieve the stack trace when script evaluation returns -\fBTCL_ERROR\fR, like so: -.PP -.CS -int code = Tcl_EvalEx(interp, script, -1, 0); -if (code == TCL_ERROR) { - Tcl_Obj *options = \fBTcl_GetReturnOptions\fR(interp, code); - Tcl_Obj *key = Tcl_NewStringObj("-errorinfo", -1); - Tcl_Obj *stackTrace; - Tcl_IncrRefCount(key); - Tcl_DictObjGet(NULL, options, key, &stackTrace); - Tcl_DecrRefCount(key); - /* Do something with stackTrace */ - Tcl_DecrRefCount(options); -} -.CE -.PP -\fBTcl_SetReturnOptions\fR sets the return options -of \fIinterp\fR to be \fIoptions\fR. If \fIoptions\fR -contains any invalid value for any key, TCL_ERROR will -be returned, and the interp result will be set to an -appropriate error message. Otherwise, a completion code -in agreement with the \fB\-code\fR and \fB\-level\fR -keys in \fIoptions\fR will be returned. -.PP -As an example, Tcl's \fBreturn\fR command itself could -be implemented in terms of \fBTcl_SetReturnOptions\fR -like so: -.PP -.CS -if ((objc % 2) == 0) { /* explicit result argument */ - objc--; - Tcl_SetObjResult(interp, objv[objc]); -} -return \fBTcl_SetReturnOptions\fR(interp, Tcl_NewListObj(objc-1, objv+1)); -.CE -.PP -(It is not really implemented that way. Internal access -privileges allow for a more efficient alternative that meshes -better with the bytecode compiler.) -.PP -Note that a newly created \fBTcl_Obj\fR may be passed -in as the \fIoptions\fR argument without the need to tend -to any reference counting. This is analogous to -\fBTcl_SetObjResult\fR. -.PP -While \fBTcl_SetReturnOptions\fR provides a general interface -to set any collection of return options, there are a handful -of return options that are very frequently used. Most -notably the \fB\-errorinfo\fR and \fB\-errorcode\fR return -options should be set properly when the command procedure -of a command returns \fBTCL_ERROR\fR. The \fB\-errorline\fR -return option is also read by commands that evaluate scripts -and wish to supply detailed error location information in -the stack trace text they append to the \fB\-errorinfo\fR option. -Tcl provides several simpler interfaces to more directly set -these return options. -.PP -The \fB\-errorinfo\fR option holds a stack trace of the -operations that were in progress when an error occurred, -and is intended to be human-readable. -The \fB\-errorcode\fR option holds a Tcl list of items that -are intended to be machine-readable. -The first item in the \fB\-errorcode\fR value identifies the class of -error that occurred -(e.g., POSIX means an error occurred in a POSIX system call) -and additional elements hold additional pieces -of information that depend on the class. -See the manual entry on the \fBerrorCode\fR variable for details on the -various formats for the \fB\-errorcode\fR option used by Tcl's built-in -commands. -.PP -The \fB\-errorinfo\fR option value is gradually built up as an -error unwinds through the nested operations. -Each time an error code is returned to \fBTcl_Eval\fR, or -any of the routines that performs script evaluation, -the procedure \fBTcl_AddErrorInfo\fR is called to add -additional text to the \fB\-errorinfo\fR value describing the -command that was being executed when the error occurred. -By the time the error has been passed all the way back -to the application, it will contain a complete trace -of the activity in progress when the error occurred. -.PP -It is sometimes useful to add additional information to -the \fB\-errorinfo\fR value beyond what can be supplied automatically -by the script evaluation routines. -\fBTcl_AddErrorInfo\fR may be used for this purpose: -its \fImessage\fR argument is an additional -string to be appended to the \fB\-errorinfo\fR option. -For example, when an error arises during the \fBsource\fR command, -the procedure \fBTcl_AddErrorInfo\fR is called to -record the name of the file being processed and the -line number on which the error occurred. -Likewise, when an error arises during evaluation of a -Tcl procedures, the procedure name and line number -within the procedure are recorded, and so on. -The best time to call \fBTcl_AddErrorInfo\fR is just after -a script evaluation routine has returned \fBTCL_ERROR\fR. -The value of the \fB\-errorline\fR return option (retrieved -via a call to \fBTcl_GetReturnOptions\fR) often makes up -a useful part of the \fImessage\fR passed to \fBTcl_AddErrorInfo\fR. -.PP -\fBTcl_AppendObjToErrorInfo\fR is an alternative interface to the -same functionality as \fBTcl_AddErrorInfo\fR. \fBTcl_AppendObjToErrorInfo\fR -is called when the string value to be appended to the \fB\-errorinfo\fR option -is available as a \fBTcl_Obj\fR instead of as a \fBchar\fR array. -.PP -\fBTcl_AddObjErrorInfo\fR is nearly identical -to \fBTcl_AddErrorInfo\fR, except that it has an additional \fIlength\fR -argument. This allows the \fImessage\fR string to contain -embedded null bytes. This is essentially never a good idea. -If the \fImessage\fR needs to contain the null character \fBU+0000\fR, -Tcl's usual internal encoding rules should be used to avoid -the need for a null byte. If the \fBTcl_AddObjErrorInfo\fR -interface is used at all, it should be with a negative \fIlength\fR value. -.PP -The procedure \fBTcl_SetObjErrorCode\fR is used to set the -\fB\-errorcode\fR return option to the list value \fIerrorObjPtr\fR -built up by the caller. -\fBTcl_SetObjErrorCode\fR is typically invoked just -before returning an error. If an error is -returned without calling \fBTcl_SetObjErrorCode\fR or -\fBTcl_SetErrorCode\fR the Tcl interpreter automatically sets -the \fB\-errorcode\fR return option to \fBNONE\fR. -.PP -The procedure \fBTcl_SetErrorCode\fR is also used to set the -\fB\-errorcode\fR return option. However, it takes one or more strings to -record instead of a value. Otherwise, it is similar to -\fBTcl_SetObjErrorCode\fR in behavior. -.PP -\fBTcl_SetErrorCodeVA\fR is the same as \fBTcl_SetErrorCode\fR except that -instead of taking a variable number of arguments it takes an argument list. -.PP -The procedure \fBTcl_GetErrorLine\fR is used to read the integer value -of the \fB\-errorline\fR return option without the overhead of a full -call to \fBTcl_GetReturnOptions\fR. Likewise, \fBTcl_SetErrorLine\fR -sets the \fB\-errorline\fR return option value. -.PP -\fBTcl_PosixError\fR -sets the \fB\-errorcode\fR variable after an error in a POSIX kernel call. -It reads the value of the \fBerrno\fR C variable and calls -\fBTcl_SetErrorCode\fR to set the \fB\-errorcode\fR return -option in the \fBPOSIX\fR format. -The caller must previously have called \fBTcl_SetErrno\fR to set -\fBerrno\fR; this is necessary on some platforms (e.g. Windows) where Tcl -is linked into an application as a shared library, or when the error -occurs in a dynamically loaded extension. See the manual entry for -\fBTcl_SetErrno\fR for more information. -.PP -\fBTcl_PosixError\fR returns a human-readable diagnostic message -for the error -(this is the same value that will appear as the third element -in the \fB\-errorcode\fR value). -It may be convenient to include this string as part of the -error message returned to the application in -the interpreter's result. -.PP -\fBTcl_LogCommandInfo\fR is invoked after an error occurs in an -interpreter. It adds information about the command that was being -executed when the error occurred to the \fB\-errorinfo\fR value, and -the line number stored internally in the interpreter is set. -.PP -In older releases of Tcl, there was no \fBTcl_GetReturnOptions\fR -routine. In its place, the global Tcl variables \fBerrorInfo\fR -and \fBerrorCode\fR were the only place to retrieve the error -information. Much existing code written for older Tcl releases -still access this information via those global variables. -.PP -It is important to realize that while reading from those -global variables remains a supported way to access these -return option values, it is important not to assume that -writing to those global variables will properly set the -corresponding return options. It has long been emphasized -in this manual page that it is important to -call the procedures described here rather than -setting \fBerrorInfo\fR or \fBerrorCode\fR directly with -\fBTcl_ObjSetVar2\fR. -.PP -If the procedure \fBTcl_ResetResult\fR is called, -it clears all of the state of the interpreter associated with -script evaluation, including the entire return options dictionary. -In particular, the \fB\-errorinfo\fR and \fB\-errorcode\fR options -are reset. -If an error had occurred, the \fBTcl_ResetResult\fR call will -clear the error state to make it appear as if no error had -occurred after all. -The global variables \fBerrorInfo\fR and -\fBerrorCode\fR are not modified by \fBTcl_ResetResult\fR -so they continue to hold a record of information about the -most recent error seen in an interpreter. -.SH "SEE ALSO" -Tcl_DecrRefCount(3), Tcl_IncrRefCount(3), Tcl_Interp(3), Tcl_ResetResult(3), -Tcl_SetErrno(3), errorCode(n), errorInfo(n) -.SH KEYWORDS -error, value, value result, stack, trace, variable diff --git a/doc/Alloc.3 b/doc/Alloc.3 deleted file mode 100644 index 8f25c52..0000000 --- a/doc/Alloc.3 +++ /dev/null @@ -1,92 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_Alloc 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_Alloc, Tcl_Free, Tcl_Realloc, Tcl_AttemptAlloc, Tcl_AttemptRealloc, ckalloc, ckfree, ckrealloc, attemptckalloc, attemptckrealloc \- allocate or free heap memory -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -char * -\fBTcl_Alloc\fR(\fIsize\fR) -.sp -void -\fBTcl_Free\fR(\fIptr\fR) -.sp -char * -\fBTcl_Realloc\fR(\fIptr, size\fR) -.sp -char * -\fBTcl_AttemptAlloc\fR(\fIsize\fR) -.sp -char * -\fBTcl_AttemptRealloc\fR(\fIptr, size\fR) -.sp -char * -\fBckalloc\fR(\fIsize\fR) -.sp -void -\fBckfree\fR(\fIptr\fR) -.sp -char * -\fBckrealloc\fR(\fIptr, size\fR) -.sp -char * -\fBattemptckalloc\fR(\fIsize\fR) -.sp -char * -\fBattemptckrealloc\fR(\fIptr, size\fR) -.SH ARGUMENTS -.AS char *size -.AP "unsigned int" size in -Size in bytes of the memory block to allocate. -.AP char *ptr in -Pointer to memory block to free or realloc. -.BE - -.SH DESCRIPTION -.PP -These procedures provide a platform and compiler independent interface -for memory allocation. Programs that need to transfer ownership of -memory blocks between Tcl and other modules should use these routines -rather than the native \fBmalloc()\fR and \fBfree()\fR routines -provided by the C run-time library. -.PP -\fBTcl_Alloc\fR returns a pointer to a block of at least \fIsize\fR -bytes suitably aligned for any use. -.PP -\fBTcl_Free\fR makes the space referred to by \fIptr\fR available for -further allocation. -.PP -\fBTcl_Realloc\fR changes the size of the block pointed to by -\fIptr\fR to \fIsize\fR bytes and returns a pointer to the new block. -The contents will be unchanged up to the lesser of the new and old -sizes. The returned location may be different from \fIptr\fR. If -\fIptr\fR is NULL, this is equivalent to calling \fBTcl_Alloc\fR with -just the \fIsize\fR argument. -.PP -\fBTcl_AttemptAlloc\fR and \fBTcl_AttemptRealloc\fR are identical in -function to \fBTcl_Alloc\fR and \fBTcl_Realloc\fR, except that -\fBTcl_AttemptAlloc\fR and \fBTcl_AttemptRealloc\fR will not cause the Tcl -interpreter to \fBpanic\fR if the memory allocation fails. If the -allocation fails, these functions will return NULL. Note that on some -platforms, but not all, attempting to allocate a zero-sized block of -memory will also cause these functions to return NULL. -.PP -The procedures \fBckalloc\fR, \fBckfree\fR, \fBckrealloc\fR, -\fBattemptckalloc\fR, and \fBattemptckrealloc\fR are implemented -as macros. Normally, they are synonyms for the corresponding -procedures documented on this page. When Tcl and all modules -calling Tcl are compiled with \fBTCL_MEM_DEBUG\fR defined, however, -these macros are redefined to be special debugging versions -of these procedures. To support Tcl's memory debugging within a -module, use the macros rather than direct calls to \fBTcl_Alloc\fR, etc. - -.SH KEYWORDS -alloc, allocation, free, malloc, memory, realloc, TCL_MEM_DEBUG diff --git a/doc/AllowExc.3 b/doc/AllowExc.3 deleted file mode 100644 index 172bb30..0000000 --- a/doc/AllowExc.3 +++ /dev/null @@ -1,44 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_AllowExceptions 3 7.4 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_AllowExceptions \- allow all exceptions in next script evaluation -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_AllowExceptions\fR(\fIinterp\fR) -.SH ARGUMENTS -.AS Tcl_Interp *interp -.AP Tcl_Interp *interp in -Interpreter in which script will be evaluated. -.BE - -.SH DESCRIPTION -.PP -If a script is evaluated at top-level (i.e. no other scripts are -pending evaluation when the script is invoked), and if the script -terminates with a completion code other than \fBTCL_OK\fR, \fBTCL_ERROR\fR -or \fBTCL_RETURN\fR, then Tcl normally converts this into a \fBTCL_ERROR\fR -return with an appropriate message. The particular script -evaluation procedures of Tcl that act in the manner are -\fBTcl_EvalObjEx\fR, \fBTcl_EvalObjv\fR, \fBTcl_Eval\fR, \fBTcl_EvalEx\fR, -\fBTcl_GlobalEval\fR, \fBTcl_GlobalEvalObj\fR, \fBTcl_VarEval\fR and -\fBTcl_VarEvalVA\fR. -.PP -However, if \fBTcl_AllowExceptions\fR is invoked immediately before -calling one of those a procedures, then arbitrary completion -codes are permitted from the script, and they are returned without -modification. -This is useful in cases where the caller can deal with exceptions -such as \fBTCL_BREAK\fR or \fBTCL_CONTINUE\fR in a meaningful way. - -.SH KEYWORDS -continue, break, exception, interpreter diff --git a/doc/AppInit.3 b/doc/AppInit.3 deleted file mode 100644 index 44b2d6b..0000000 --- a/doc/AppInit.3 +++ /dev/null @@ -1,83 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_AppInit 3 7.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_AppInit \- perform application-specific initialization -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_AppInit\fR(\fIinterp\fR) -.SH ARGUMENTS -.AS Tcl_Interp *interp -.AP Tcl_Interp *interp in -Interpreter for the application. -.BE - -.SH DESCRIPTION -.PP -\fBTcl_AppInit\fR is a -.QW hook -procedure that is invoked by -the main programs for Tcl applications such as \fBtclsh\fR and \fBwish\fR. -Its purpose is to allow new Tcl applications to be created without -modifying the main programs provided as part of Tcl and Tk. -To create a new application you write a new version of -\fBTcl_AppInit\fR to replace the default version provided by Tcl, -then link your new \fBTcl_AppInit\fR with the Tcl library. -.PP -\fBTcl_AppInit\fR is invoked by \fBTcl_Main\fR and \fBTk_Main\fR -after their own initialization and before entering the main loop -to process commands. -Here are some examples of things that \fBTcl_AppInit\fR might do: -.IP [1] -Call initialization procedures for various packages used by -the application. -Each initialization procedure adds new commands to \fIinterp\fR -for its package and performs other package-specific initialization. -.IP [2] -Process command-line arguments, which can be accessed from the -Tcl variables \fBargv\fR and \fBargv0\fR in \fIinterp\fR. -.IP [3] -Invoke a startup script to initialize the application. -.IP [4] -Use the routines \fBTcl_SetStartupScript\fR and -\fBTcl_GetStartupScript\fR to set or query the file and encoding -that the active \fBTcl_Main\fR or \fBTk_Main\fR routine will -use as a startup script. -.LP -\fBTcl_AppInit\fR returns \fBTCL_OK\fR or \fBTCL_ERROR\fR. -If it returns \fBTCL_ERROR\fR then it must leave an error message in -for the interpreter's result; otherwise the result is ignored. -.PP -In addition to \fBTcl_AppInit\fR, your application should also contain -a procedure \fBmain\fR that calls \fBTcl_Main\fR as follows: -.PP -.CS -Tcl_Main(argc, argv, Tcl_AppInit); -.CE -.PP -The third argument to \fBTcl_Main\fR gives the address of the -application-specific initialization procedure to invoke. -This means that you do not have to use the name \fBTcl_AppInit\fR -for the procedure, but in practice the name is nearly always -\fBTcl_AppInit\fR (in versions before Tcl 7.4 the name \fBTcl_AppInit\fR -was implicit; there was no way to specify the procedure explicitly). -The best way to get started is to make a copy of the file -\fBtclAppInit.c\fR from the Tcl library or source directory. -It already contains a \fBmain\fR procedure and a template for -\fBTcl_AppInit\fR that you can modify for your application. - -.SH "SEE ALSO" -Tcl_Main(3) - -.SH KEYWORDS -application, argument, command, initialization, interpreter diff --git a/doc/AssocData.3 b/doc/AssocData.3 deleted file mode 100644 index d4fa3d7..0000000 --- a/doc/AssocData.3 +++ /dev/null @@ -1,87 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_SetAssocData 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_GetAssocData, Tcl_SetAssocData, Tcl_DeleteAssocData \- manage associations of string keys and user specified data with Tcl interpreters -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -ClientData -\fBTcl_GetAssocData\fR(\fIinterp, key, delProcPtr\fR) -.sp -\fBTcl_SetAssocData\fR(\fIinterp, key, delProc, clientData\fR) -.sp -\fBTcl_DeleteAssocData\fR(\fIinterp, key\fR) -.SH ARGUMENTS -.AS Tcl_InterpDeleteProc **delProcPtr -.AP Tcl_Interp *interp in -Interpreter in which to execute the specified command. -.AP "const char" *key in -Key for association with which to store data or from which to delete or -retrieve data. Typically the module prefix for a package. -.AP Tcl_InterpDeleteProc *delProc in -Procedure to call when \fIinterp\fR is deleted. -.AP Tcl_InterpDeleteProc **delProcPtr in -Pointer to location in which to store address of current deletion procedure -for association. Ignored if NULL. -.AP ClientData clientData in -Arbitrary one-word value associated with the given key in this -interpreter. This data is owned by the caller. -.BE - -.SH DESCRIPTION -.PP -These procedures allow extensions to associate their own data with -a Tcl interpreter. -An association consists of a string key, typically the name of -the extension, and a one-word value, which is typically a pointer -to a data structure holding data specific to the extension. -Tcl makes no interpretation of either the key or the value for -an association. -.PP -Storage management is facilitated by storing with each association a -procedure to call when the interpreter is deleted. This -procedure can dispose of the storage occupied by the client's data in any -way it sees fit. -.PP -\fBTcl_SetAssocData\fR creates an association between a string -key and a user specified datum in the given interpreter. -If there is already an association with the given \fIkey\fR, -\fBTcl_SetAssocData\fR overwrites it with the new information. -It is up to callers to organize their use of names to avoid conflicts, -for example, by using package names as the keys. -If the \fIdeleteProc\fR argument is non-NULL it specifies the address of a -procedure to invoke if the interpreter is deleted before the association -is deleted. \fIDeleteProc\fR should have arguments and result that match -the type \fBTcl_InterpDeleteProc\fR: -.PP -.CS -typedef void \fBTcl_InterpDeleteProc\fR( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR); -.CE -.PP -When \fIdeleteProc\fR is invoked the \fIclientData\fR and \fIinterp\fR -arguments will be the same as the corresponding arguments passed to -\fBTcl_SetAssocData\fR. -The deletion procedure will \fInot\fR be invoked if the association -is deleted before the interpreter is deleted. -.PP -\fBTcl_GetAssocData\fR returns the datum stored in the association with the -specified key in the given interpreter, and if the \fIdelProcPtr\fR field -is non-\fBNULL\fR, the address indicated by it gets the address of the -delete procedure stored with this association. If no association with the -specified key exists in the given interpreter \fBTcl_GetAssocData\fR -returns \fBNULL\fR. -.PP -\fBTcl_DeleteAssocData\fR deletes an association with a specified key in -the given interpreter. Then it calls the deletion procedure. -.SH KEYWORDS -association, data, deletion procedure, interpreter, key diff --git a/doc/Async.3 b/doc/Async.3 deleted file mode 100644 index 347ba3d..0000000 --- a/doc/Async.3 +++ /dev/null @@ -1,161 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_AsyncCreate 3 7.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_AsyncCreate, Tcl_AsyncMark, Tcl_AsyncInvoke, Tcl_AsyncDelete, Tcl_AsyncReady \- handle asynchronous events -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_AsyncHandler -\fBTcl_AsyncCreate\fR(\fIproc, clientData\fR) -.sp -\fBTcl_AsyncMark\fR(\fIasync\fR) -.sp -int -\fBTcl_AsyncInvoke\fR(\fIinterp, code\fR) -.sp -\fBTcl_AsyncDelete\fR(\fIasync\fR) -.sp -int -\fBTcl_AsyncReady\fR() -.SH ARGUMENTS -.AS Tcl_AsyncHandler clientData -.AP Tcl_AsyncProc *proc in -Procedure to invoke to handle an asynchronous event. -.AP ClientData clientData in -One-word value to pass to \fIproc\fR. -.AP Tcl_AsyncHandler async in -Token for asynchronous event handler. -.AP Tcl_Interp *interp in -Tcl interpreter in which command was being evaluated when handler was -invoked, or NULL if handler was invoked when there was no interpreter -active. -.AP int code in -Completion code from command that just completed in \fIinterp\fR, -or 0 if \fIinterp\fR is NULL. -.BE - -.SH DESCRIPTION -.PP -These procedures provide a safe mechanism for dealing with -asynchronous events such as signals. -If an event such as a signal occurs while a Tcl script is being -evaluated then it is not safe to take any substantive action to -process the event. -For example, it is not safe to evaluate a Tcl script since the -interpreter may already be in the middle of evaluating a script; -it may not even be safe to allocate memory, since a memory -allocation could have been in progress when the event occurred. -The only safe approach is to set a flag indicating that the event -occurred, then handle the event later when the world has returned -to a clean state, such as after the current Tcl command completes. -.PP -\fBTcl_AsyncCreate\fR, \fBTcl_AsyncDelete\fR, and \fBTcl_AsyncReady\fR -are thread sensitive. They access and/or set a thread-specific data -structure in the event of a core built with \fI\-\-enable\-threads\fR. The token -created by \fBTcl_AsyncCreate\fR contains the needed thread information it -was called from so that calling \fBTcl_AsyncMark\fR(\fItoken\fR) will only yield -the origin thread into the asynchronous handler. -.PP -\fBTcl_AsyncCreate\fR creates an asynchronous handler and returns -a token for it. -The asynchronous handler must be created before -any occurrences of the asynchronous event that it is intended -to handle (it is not safe to create a handler at the time of -an event). -When an asynchronous event occurs the code that detects the event -(such as a signal handler) should call \fBTcl_AsyncMark\fR with the -token for the handler. -\fBTcl_AsyncMark\fR will mark the handler as ready to execute, but it -will not invoke the handler immediately. -Tcl will call the \fIproc\fR associated with the handler later, when -the world is in a safe state, and \fIproc\fR can then carry out -the actions associated with the asynchronous event. -\fIProc\fR should have arguments and result that match the -type \fBTcl_AsyncProc\fR: -.PP -.CS -typedef int \fBTcl_AsyncProc\fR( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR, - int \fIcode\fR); -.CE -.PP -The \fIclientData\fR will be the same as the \fIclientData\fR -argument passed to \fBTcl_AsyncCreate\fR when the handler was -created. -If \fIproc\fR is invoked just after a command has completed -execution in an interpreter, then \fIinterp\fR will identify -the interpreter in which the command was evaluated and -\fIcode\fR will be the completion code returned by that -command. -The command's result will be present in the interpreter's result. -When \fIproc\fR returns, whatever it leaves in the interpreter's result -will be returned as the result of the command and the integer -value returned by \fIproc\fR will be used as the new completion -code for the command. -.PP -It is also possible for \fIproc\fR to be invoked when no interpreter -is active. -This can happen, for example, if an asynchronous event occurs while -the application is waiting for interactive input or an X event. -In this case \fIinterp\fR will be NULL and \fIcode\fR will be -0, and the return value from \fIproc\fR will be ignored. -.PP -The procedure \fBTcl_AsyncInvoke\fR is called to invoke all of the -handlers that are ready. -The procedure \fBTcl_AsyncReady\fR will return non-zero whenever any -asynchronous handlers are ready; it can be checked to avoid calls -to \fBTcl_AsyncInvoke\fR when there are no ready handlers. -Tcl calls \fBTcl_AsyncReady\fR after each command is evaluated -and calls \fBTcl_AsyncInvoke\fR if needed. -Applications may also call \fBTcl_AsyncInvoke\fR at interesting -times for that application. -For example, Tcl's event handler calls \fBTcl_AsyncReady\fR -after each event and calls \fBTcl_AsyncInvoke\fR if needed. -The \fIinterp\fR and \fIcode\fR arguments to \fBTcl_AsyncInvoke\fR -have the same meaning as for \fIproc\fR: they identify the active -interpreter, if any, and the completion code from the command -that just completed. -.PP -\fBTcl_AsyncDelete\fR removes an asynchronous handler so that -its \fIproc\fR will never be invoked again. -A handler can be deleted even when ready, and it will still -not be invoked. -.PP -If multiple handlers become active at the same time, the -handlers are invoked in the order they were created (oldest -handler first). -The \fIcode\fR and the interpreter's result for later handlers -reflect the values returned by earlier handlers, so that -the most recently created handler has last say about -the interpreter's result and completion code. -If new handlers become ready while handlers are executing, -\fBTcl_AsyncInvoke\fR will invoke them all; at each point it -invokes the highest-priority (oldest) ready handler, repeating -this over and over until there are no longer any ready handlers. -.SH WARNING -.PP -It is almost always a bad idea for an asynchronous event -handler to modify the interpreter's result or return a code different -from its \fIcode\fR argument. -This sort of behavior can disrupt the execution of scripts in -subtle ways and result in bugs that are extremely difficult -to track down. -If an asynchronous event handler needs to evaluate Tcl scripts -then it should first save the interpreter's state by calling -\fBTcl_SaveInterpState\fR, passing in the \fIcode\fR argument. -When the asynchronous handler is finished it should restore -the interpreter's state by calling \fBTcl_RestoreInterpState\fR, -and then returning the \fIcode\fR argument. - -.SH KEYWORDS -asynchronous event, handler, signal, Tcl_SaveInterpState, thread diff --git a/doc/BackgdErr.3 b/doc/BackgdErr.3 deleted file mode 100644 index adbe33c..0000000 --- a/doc/BackgdErr.3 +++ /dev/null @@ -1,78 +0,0 @@ -'\" -'\" Copyright (c) 1992-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. -'\" -.TH Tcl_BackgroundError 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_BackgroundException, Tcl_BackgroundError \- report Tcl exception that occurred in background processing -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_BackgroundException\fR(\fIinterp, code\fR) -.sp -\fBTcl_BackgroundError\fR(\fIinterp\fR) -.SH ARGUMENTS -.AS Tcl_Interp *interp -.AP Tcl_Interp *interp in -Interpreter in which the exception occurred. -.AP int code in -The exceptional return code to be reported. -.BE - -.SH DESCRIPTION -.PP -This procedure is typically invoked when a Tcl exception (any -return code other than TCL_OK) occurs during -.QW "background processing" -such as executing an event handler. -When such an exception occurs, the condition is reported to Tcl -or to a widget or some other C code, and there is not usually any -obvious way for that code to report the exception to the user. -In these cases the code calls \fBTcl_BackgroundException\fR with an -\fIinterp\fR argument identifying the interpreter in which the -exception occurred, and a \fIcode\fR argument holding the return -code value of the exception. The state of the interpreter, including -any error message in the interpreter result, and the values of -any entries in the return options dictionary, is captured and -saved. \fBTcl_BackgroundException\fR then arranges for the event -loop to invoke at some later time the command registered -in that interpreter to handle background errors by the -\fBinterp bgerror\fR command, passing the captured values as -arguments. -The registered handler command is meant to report the exception -in an application-specific fashion. The handler command -receives two arguments, the result of the interp, and the -return options of the interp at the time the error occurred. -If the application registers no handler command, the default -handler command will attempt to call \fBbgerror\fR to report -the error. If an error condition arises while invoking the -handler command, then \fBTcl_BackgroundException\fR reports the -error itself by printing a message on the standard error file. -.PP -\fBTcl_BackgroundException\fR does not invoke the handler command immediately -because this could potentially interfere with scripts that are in process -at the time the error occurred. -Instead, it invokes the handler command later as an idle callback. -.PP -It is possible for many background exceptions to accumulate before -the handler command is invoked. When this happens, each of the exceptions -is processed in order. However, if the handler command returns a -break exception, then all remaining error reports for the -interpreter are skipped. -.PP -The \fBTcl_BackgroundError\fR routine is an older and simpler interface -useful when the exception code reported is \fBTCL_ERROR\fR. It is -equivalent to: -.PP -.CS -Tcl_BackgroundException(interp, TCL_ERROR); -.CE - -.SH KEYWORDS -background, bgerror, error, interp diff --git a/doc/Backslash.3 b/doc/Backslash.3 deleted file mode 100644 index 0805f8e..0000000 --- a/doc/Backslash.3 +++ /dev/null @@ -1,47 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_Backslash 3 "8.1" Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_Backslash \- parse a backslash sequence -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -char -\fBTcl_Backslash\fR(\fIsrc, countPtr\fR) -.SH ARGUMENTS -.AS char *countPtr out -.AP char *src in -Pointer to a string starting with a backslash. -.AP int *countPtr out -If \fIcountPtr\fR is not 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 diff --git a/doc/BoolObj.3 b/doc/BoolObj.3 deleted file mode 100644 index 7268e1f..0000000 --- a/doc/BoolObj.3 +++ /dev/null @@ -1,95 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_BooleanObj 3 8.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_NewBooleanObj, Tcl_SetBooleanObj, Tcl_GetBooleanFromObj \- store/retrieve boolean value in a Tcl_Obj -.SH SYNOPSIS -.nf -\fB#include \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 value -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 retrieve 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 -.QW 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, value diff --git a/doc/ByteArrObj.3 b/doc/ByteArrObj.3 deleted file mode 100644 index ff0b4e1..0000000 --- a/doc/ByteArrObj.3 +++ /dev/null @@ -1,91 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_ByteArrayObj 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_NewByteArrayObj, Tcl_SetByteArrayObj, Tcl_GetByteArrayFromObj, Tcl_SetByteArrayLength \- manipulate Tcl values as a arrays of bytes -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Obj * -\fBTcl_NewByteArrayObj\fR(\fIbytes, length\fR) -.sp -void -\fBTcl_SetByteArrayObj\fR(\fIobjPtr, bytes, length\fR) -.sp -unsigned char * -\fBTcl_GetByteArrayFromObj\fR(\fIobjPtr, lengthPtr\fR) -.sp -unsigned char * -\fBTcl_SetByteArrayLength\fR(\fIobjPtr, length\fR) -.SH ARGUMENTS -.AS "const unsigned char" *lengthPtr in/out -.AP "const unsigned char" *bytes in -The array of bytes used to initialize or set a byte-array value. May be NULL -even if \fIlength\fR is non-zero. -.AP int length in -The length of the array of bytes. It must be >= 0. -.AP Tcl_Obj *objPtr in/out -For \fBTcl_SetByteArrayObj\fR, this points to the value to be converted to -byte-array type. For \fBTcl_GetByteArrayFromObj\fR and -\fBTcl_SetByteArrayLength\fR, this points to the value from which to get -the byte-array value; if \fIobjPtr\fR does not already point to a byte-array -value, it will be converted to one. -.AP int *lengthPtr out -If non-NULL, filled with the length of the array of bytes in the value. -.BE - -.SH DESCRIPTION -.PP -These procedures are used to create, modify, and read Tcl byte-array values -from C code. Byte-array values are typically used to hold the -results of binary IO operations or data structures created with the -\fBbinary\fR command. In Tcl, an array of bytes is not equivalent to a -string. Conceptually, a string is an array of Unicode characters, while a -byte-array is an array of 8-bit quantities with no implicit meaning. -Accessor functions are provided to get the string representation of a -byte-array or to convert an arbitrary value to a byte-array. Obtaining the -string representation of a byte-array value (by calling -\fBTcl_GetStringFromObj\fR) produces a properly formed UTF-8 sequence with a -one-to-one mapping between the bytes in the internal representation and the -UTF-8 characters in the string representation. -.PP -\fBTcl_NewByteArrayObj\fR and \fBTcl_SetByteArrayObj\fR will -create a new value of byte-array type or modify an existing value to have a -byte-array type. Both of these procedures set the value's type to be -byte-array and set the value's internal representation to a copy of the -array of bytes given by \fIbytes\fR. \fBTcl_NewByteArrayObj\fR returns a -pointer to a newly allocated value with a reference count of zero. -\fBTcl_SetByteArrayObj\fR invalidates any old string representation and, if -the value is not already a byte-array value, frees any old internal -representation. If \fIbytes\fR is NULL then the new byte array contains -arbitrary values. -.PP -\fBTcl_GetByteArrayFromObj\fR converts a Tcl value to byte-array type and -returns a pointer to the value's new internal representation as an array of -bytes. The length of this array is stored in \fIlengthPtr\fR if -\fIlengthPtr\fR is non-NULL. The storage for the array of bytes is owned by -the value and should not be freed. The contents of the array may be -modified by the caller only if the value is not shared and the caller -invalidates the string representation. -.PP -\fBTcl_SetByteArrayLength\fR converts the Tcl value to byte-array type -and changes the length of the value's internal representation as an -array of bytes. If \fIlength\fR is greater than the space currently -allocated for the array, the array is reallocated to the new length; the -newly allocated bytes at the end of the array have arbitrary values. If -\fIlength\fR is less than the space currently allocated for the array, -the length of array is reduced to the new length. The return value is a -pointer to the value's new array of bytes. - -.SH "SEE ALSO" -Tcl_GetStringFromObj, Tcl_NewObj, Tcl_IncrRefCount, Tcl_DecrRefCount - -.SH KEYWORDS -value, binary data, byte array, utf, unicode, internationalization diff --git a/doc/CallDel.3 b/doc/CallDel.3 deleted file mode 100644 index 33b8afc..0000000 --- a/doc/CallDel.3 +++ /dev/null @@ -1,67 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_CallWhenDeleted 3 7.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_CallWhenDeleted, Tcl_DontCallWhenDeleted \- Arrange for callback when interpreter is deleted -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_CallWhenDeleted\fR(\fIinterp\fR, \fIproc\fR, \fIclientData\fR) -.sp -\fBTcl_DontCallWhenDeleted\fR(\fIinterp\fR, \fIproc\fR, \fIclientData\fR) -.SH ARGUMENTS -.AS Tcl_InterpDeleteProc clientData -.AP Tcl_Interp *interp in -Interpreter with which to associated callback. -.AP Tcl_InterpDeleteProc *proc in -Procedure to call when \fIinterp\fR is deleted. -.AP ClientData clientData in -Arbitrary one-word value to pass to \fIproc\fR. -.BE -.SH DESCRIPTION -.PP -\fBTcl_CallWhenDeleted\fR arranges for \fIproc\fR to be called by -\fBTcl_DeleteInterp\fR if/when \fIinterp\fR is deleted at some future -time. \fIProc\fR will be invoked just before the interpreter -is deleted, but the interpreter will still be valid at the -time of the call. -\fIProc\fR should have arguments and result that match the -type \fBTcl_InterpDeleteProc\fR: -.PP -.CS -typedef void \fBTcl_InterpDeleteProc\fR( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR); -.CE -.PP -The \fIclientData\fR and \fIinterp\fR parameters are -copies of the \fIclientData\fR and \fIinterp\fR arguments given -to \fBTcl_CallWhenDeleted\fR. -Typically, \fIclientData\fR points to an application-specific -data structure that \fIproc\fR uses to perform cleanup when an -interpreter is about to go away. -\fIProc\fR does not return a value. -.PP -\fBTcl_DontCallWhenDeleted\fR cancels a previous call to -\fBTcl_CallWhenDeleted\fR with the same arguments, so that -\fIproc\fR will not be called after all when \fIinterp\fR is -deleted. -If there is no deletion callback that matches \fIinterp\fR, -\fIproc\fR, and \fIclientData\fR then the call to -\fBTcl_DontCallWhenDeleted\fR has no effect. -.PP -Note that if the callback is being used to delete a resource that \fImust\fR -be released on exit, \fBTcl_CreateExitHandler\fR should be used to ensure that -a callback is received even if the application terminates without deleting the interpreter. -.SH "SEE ALSO" -Tcl_CreateExitHandler(3), Tcl_CreateThreadExitHandler(3) -.SH KEYWORDS -callback, cleanup, delete, interpreter diff --git a/doc/Cancel.3 b/doc/Cancel.3 deleted file mode 100644 index 847707e..0000000 --- a/doc/Cancel.3 +++ /dev/null @@ -1,74 +0,0 @@ -'\" -'\" Copyright (c) 2006-2008 Joe Mistachkin. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Tcl_Cancel 3 8.6 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_CancelEval, Tcl_Canceled \- cancel Tcl scripts -.SH SYNOPSIS -.nf -\fB#include \fR -int -\fBTcl_CancelEval\fR(\fIinterp, resultObjPtr, clientData, flags\fR) -.sp -int -\fBTcl_Canceled\fR(\fIinterp, flags\fR) -.SH ARGUMENTS -.AS Tcl_Interp *interp -.AP Tcl_Interp *interp in -Interpreter in which to cancel the script. -.AP Tcl_Obj *resultObjPtr in -Error message to use in the cancellation, or NULL to use a default message. If -not NULL, this object will have its reference count decremented before -\fBTcl_CancelEval\fR returns. -.AP int flags in -ORed combination of flag bits that specify additional options. -For \fBTcl_CancelEval\fR, only \fBTCL_CANCEL_UNWIND\fR is currently -supported. For \fBTcl_Canceled\fR, only \fBTCL_LEAVE_ERR_MSG\fR and -\fBTCL_CANCEL_UNWIND\fR are currently supported. -.AP ClientData clientData in -Currently reserved for future use. -It should be set to NULL. -.BE -.SH DESCRIPTION -.PP -\fBTcl_CancelEval\fR cancels or unwinds the script in progress soon after -the next invocation of asynchronous handlers, causing \fBTCL_ERROR\fR to be -the return code for that script. This function is thread-safe and may be -called from any thread in the process. -.PP -\fBTcl_Canceled\fR checks if the script in progress has been canceled and -returns \fBTCL_ERROR\fR if it has. Otherwise, \fBTCL_OK\fR is returned. -Extensions can use this function to check to see if they should abort a long -running command. This function is thread sensitive and may only be called -from the thread the interpreter was created in. -.SS "FLAG BITS" -Any ORed combination of the following values may be used for the -\fIflags\fR argument to procedures such as \fBTcl_CancelEval\fR: -.TP 20 -\fBTCL_CANCEL_UNWIND\fR -. -This flag is used by \fBTcl_CancelEval\fR and \fBTcl_Canceled\fR. -For \fBTcl_CancelEval\fR, if this flag is set, the script in progress -is canceled and the evaluation stack for the interpreter is unwound. -For \fBTcl_Canceled\fR, if this flag is set, the script in progress -is considered to be canceled only if the evaluation stack for the -interpreter is being unwound. -.TP 20 -\fBTCL_LEAVE_ERR_MSG\fR -. -This flag is only used by \fBTcl_Canceled\fR; it is ignored by -other procedures. If an error is returned and this bit is set in -\fIflags\fR, then an error message will be left in the interpreter's -result, where it can be retrieved with \fBTcl_GetObjResult\fR or -\fBTcl_GetStringResult\fR. If this flag bit is not set then no error -message is left and the interpreter's result will not be modified. -.SH "SEE ALSO" -interp(n), Tcl_Eval(3), -TIP 285 -.SH KEYWORDS -cancel, unwind diff --git a/doc/ChnlStack.3 b/doc/ChnlStack.3 deleted file mode 100644 index b046cd2..0000000 --- a/doc/ChnlStack.3 +++ /dev/null @@ -1,97 +0,0 @@ -'\" -'\" Copyright (c) 1999-2000 Ajuba Solutions. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -.TH Tcl_StackChannel 3 8.3 Tcl "Tcl Library Procedures" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_StackChannel, Tcl_UnstackChannel, Tcl_GetStackedChannel, Tcl_GetTopChannel \- manipulate stacked I/O channels -.SH SYNOPSIS -.nf -.nf -\fB#include \fR -.sp -Tcl_Channel -\fBTcl_StackChannel\fR(\fIinterp, typePtr, clientData, mask, channel\fR) -.sp -int -\fBTcl_UnstackChannel\fR(\fIinterp, channel\fR) -.sp -Tcl_Channel -\fBTcl_GetStackedChannel\fR(\fIchannel\fR) -.sp -Tcl_Channel -\fBTcl_GetTopChannel\fR(\fIchannel\fR) -.sp -.SH ARGUMENTS -.AS Tcl_ChannelType clientData -.AP Tcl_Interp *interp in -Interpreter for error reporting. -.AP "const Tcl_ChannelType" *typePtr in -The new channel I/O procedures to use for \fIchannel\fR. -.AP ClientData clientData in -Arbitrary one-word value to pass to channel I/O procedures. -.AP int mask in -Conditions under which \fIchannel\fR will be used: OR-ed combination of -\fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR and \fBTCL_EXCEPTION\fR. -This can be a subset of the operations currently allowed on \fIchannel\fR. -.AP Tcl_Channel channel in -An existing Tcl channel such as returned by \fBTcl_CreateChannel\fR. -.BE - -.SH DESCRIPTION -.PP -These functions are for use by extensions that add processing layers to Tcl -I/O channels. Examples include compression and encryption modules. These -functions transparently stack and unstack a new channel on top of an -existing one. Any number of channels can be stacked together. -.PP -The implementation of the Tcl channel code was rewritten in 8.3.2 to -correct some problems with the previous implementation with regard to -stacked channels. Anyone using stacked channels or creating stacked -channel drivers should update to the new \fBTCL_CHANNEL_VERSION_2\fR -\fBTcl_ChannelType\fR structure. See \fBTcl_CreateChannel\fR for details. -.PP -\fBTcl_StackChannel\fR stacks a new \fIchannel\fR on an existing channel -with the same name that was registered for \fIchannel\fR by -\fBTcl_RegisterChannel\fR. -.PP -\fBTcl_StackChannel\fR works by creating a new channel structure and -placing itself on top of the channel stack. EOL translation, encoding and -buffering options are shared between all channels in the stack. The hidden -channel does no buffering, newline translations, or character set encoding. -Instead, the buffering, newline translations, and encoding functions all -remain at the top of the channel stack. A pointer to the new top channel -structure is returned. If an error occurs when stacking the channel, NULL -is returned instead. -.PP -The \fImask\fR parameter specifies the operations that are allowed on the -new channel. These can be a subset of the operations allowed on the -original channel. For example, a read-write channel may become read-only -after the \fBTcl_StackChannel\fR call. -.PP -Closing a channel closes the channels stacked below it. The close of -stacked channels is executed in a way that allows buffered data to be -properly flushed. -.PP -\fBTcl_UnstackChannel\fR reverses the process. The old channel is -associated with the channel name, and the processing module added by -\fBTcl_StackChannel\fR is destroyed. If there is no old channel, then -\fBTcl_UnstackChannel\fR is equivalent to \fBTcl_Close\fR. If an error -occurs unstacking the channel, \fBTCL_ERROR\fR is returned, otherwise -\fBTCL_OK\fR is returned. -.PP -\fBTcl_GetTopChannel\fR returns the top channel in the stack of -channels the supplied channel is part of. -.PP -\fBTcl_GetStackedChannel\fR returns the channel in the stack of -channels which is just below the supplied channel. - -.SH "SEE ALSO" -Notifier(3), Tcl_CreateChannel(3), Tcl_OpenFileChannel(3), vwait(n). - -.SH KEYWORDS -channel, compression diff --git a/doc/Class.3 b/doc/Class.3 deleted file mode 100644 index 1c3fe08..0000000 --- a/doc/Class.3 +++ /dev/null @@ -1,237 +0,0 @@ -'\" -'\" Copyright (c) 2007 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Tcl_Class 3 0.1 TclOO "TclOO Library Functions" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_ClassGetMetadata, Tcl_ClassSetMetadata, Tcl_CopyObjectInstance, Tcl_GetClassAsObject, Tcl_GetObjectAsClass, Tcl_GetObjectCommand, Tcl_GetObjectFromObj, Tcl_GetObjectName, Tcl_GetObjectNamespace, Tcl_NewObjectInstance, Tcl_ObjectDeleted, Tcl_ObjectGetMetadata, Tcl_ObjectGetMethodNameMapper, Tcl_ObjectSetMetadata, Tcl_ObjectSetMethodNameMapper \- manipulate objects and classes -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Object -\fBTcl_GetObjectFromObj\fR(\fIinterp, objPtr\fR) -.sp -Tcl_Object -\fBTcl_GetClassAsObject\fR(\fIclass\fR) -.sp -Tcl_Class -\fBTcl_GetObjectAsClass\fR(\fIobject\fR) -.sp -Tcl_Obj * -\fBTcl_GetObjectName\fR(\fIinterp, object\fR) -.sp -Tcl_Command -\fBTcl_GetObjectCommand\fR(\fIobject\fR) -.sp -Tcl_Namespace * -\fBTcl_GetObjectNamespace\fR(\fIobject\fR) -.sp -Tcl_Object -\fBTcl_NewObjectInstance\fR(\fIinterp, class, name, nsName, objc, objv, skip\fR) -.sp -Tcl_Object -\fBTcl_CopyObjectInstance\fR(\fIinterp, object, name, nsName\fR) -.sp -int -\fBTcl_ObjectDeleted\fR(\fIobject\fR) -.sp -ClientData -\fBTcl_ObjectGetMetadata\fR(\fIobject, metaTypePtr\fR) -.sp -\fBTcl_ObjectSetMetadata\fR(\fIobject, metaTypePtr, metadata\fR) -.sp -ClientData -\fBTcl_ClassGetMetadata\fR(\fIclass, metaTypePtr\fR) -.sp -\fBTcl_ClassSetMetadata\fR(\fIclass, metaTypePtr, metadata\fR) -.sp -Tcl_ObjectMapMethodNameProc -\fBTcl_ObjectGetMethodNameMapper\fR(\fIobject\fR) -.sp -\fBTcl_ObjectSetMethodNameMapper\fR(\fIobject\fR, \fImethodNameMapper\fR) -.SH ARGUMENTS -.AS ClientData metadata in/out -.AP Tcl_Interp *interp in/out -Interpreter providing the context for looking up or creating an object, and -into whose result error messages will be written on failure. -.AP Tcl_Obj *objPtr in -The name of the object to look up. -.AP Tcl_Object object in -Reference to the object to operate upon. -.AP Tcl_Class class in -Reference to the class to operate upon. -.AP "const char" *name in -The name of the object to create, or NULL if a new unused name is to be -automatically selected. -.AP "const char" *nsName in -The name of the namespace to create for the object's private use, or NULL if a -new unused name is to be automatically selected. The namespace must not -already exist. -.AP int objc in -The number of elements in the \fIobjv\fR array. -.AP "Tcl_Obj *const" *objv in -The arguments to the command to create the instance of the class. -.AP int skip in -The number of arguments at the start of the argument array, \fIobjv\fR, that -are not arguments to any constructors. -.AP Tcl_ObjectMetadataType *metaTypePtr in -The type of \fImetadata\fR being set with \fBTcl_ClassSetMetadata\fR or -retrieved with \fBTcl_ClassGetMetadata\fR. -.AP ClientData metadata in -An item of metadata to attach to the class, or NULL to remove the metadata -associated with a particular \fImetaTypePtr\fR. -.AP "Tcl_ObjectMapMethodNameProc" "methodNameMapper" in -A pointer to a function to call to adjust the mapping of objects and method -names to implementations, or NULL when no such mapping is required. -.BE -.SH DESCRIPTION -.PP -Objects are typed entities that have a set of operations ("methods") -associated with them. Classes are objects that can manufacture objects. Each -class can be viewed as an object itself; the object view can be retrieved -using \fBTcl_GetClassAsObject\fR which always returns the object when applied -to a non-destroyed class, and an object can be viewed as a class with the aid -of the \fBTcl_GetObjectAsClass\fR (which either returns the class, or NULL if -the object is not a class). An object may be looked up using the -\fBTcl_GetObjectFromObj\fR function, which either returns an object or NULL -(with an error message in the interpreter result) if the object cannot be -found. The correct way to look up a class by name is to look up the object -with that name, and then to use \fBTcl_GetObjectAsClass\fR. -.PP -Every object has its own command and namespace associated with it. The command -may be retrieved using the \fBTcl_GetObjectCommand\fR function, the name of -the object (and hence the name of the command) with \fBTcl_GetObjectName\fR, -and the namespace may be retrieved using the \fBTcl_GetObjectNamespace\fR -function. Note that the Tcl_Obj reference returned by \fBTcl_GetObjectName\fR -is a shared reference. -.PP -Instances of classes are created using \fBTcl_NewObjectInstance\fR, which -creates an object from any class (and which is internally called by both -the \fBcreate\fR and \fBnew\fR methods of the \fBoo::class\fR class). It takes -parameters that optionally give the name of the object and namespace to -create, and which describe the arguments to pass to the class's constructor -(if any). The result of the function will be either a reference to the newly -created object, or NULL if the creation failed (when an error message will be -left in the interpreter result). In addition, objects may be copied by using -\fBTcl_CopyObjectInstance\fR which creates a copy of an object without running -any constructors. -.SH "OBJECT AND CLASS METADATA" -.PP -Every object and every class may have arbitrary amounts of metadata attached -to it, which the object or class attaches no meaning to beyond what is -described in a Tcl_ObjectMetadataType structure instance. Metadata to be -attached is described by the type of the metadata (given in the -\fImetaTypePtr\fR argument) and an arbitrary pointer (the \fImetadata\fR -argument) that are given to \fBTcl_ObjectSetMetadata\fR and -\fBTcl_ClassSetMetadata\fR, and a particular piece of metadata can be -retrieved given its type using \fBTcl_ObjectGetMetadata\fR and -\fBTcl_ClassGetMetadata\fR. If the \fImetadata\fR parameter to either -\fBTcl_ObjectSetMetadata\fR or \fBTcl_ClassSetMetadata\fR is NULL, the -metadata is removed if it was attached, and the results of -\fBTcl_ObjectGetMetadata\fR and \fBTcl_ClassGetMetadata\fR are NULL if the -given type of metadata was not attached. It is not an error to request or -remove a piece of metadata that was not attached. -.SS "TCL_OBJECTMETADATATYPE STRUCTURE" -.PP -The contents of the Tcl_ObjectMetadataType structure are as follows: -.PP -.CS -typedef const struct { - int \fIversion\fR; - const char *\fIname\fR; - Tcl_ObjectMetadataDeleteProc *\fIdeleteProc\fR; - Tcl_CloneProc *\fIcloneProc\fR; -} \fBTcl_ObjectMetadataType\fR; -.CE -.PP -The \fIversion\fR field allows for future expansion of the structure, and -should always be declared equal to TCL_OO_METADATA_VERSION_CURRENT. The -\fIname\fR field provides a human-readable name for the type, and is reserved -for debugging. -.PP -The \fIdeleteProc\fR field gives a function of type -Tcl_ObjectMetadataDeleteProc that is used to delete a particular piece of -metadata, and is called when the attached metadata is replaced or removed; the -field must not be NULL. -.PP -The \fIcloneProc\fR field gives a function that is used to copy a piece of -metadata (used when a copy of an object is created using -\fBTcl_CopyObjectInstance\fR); if NULL, the metadata will be just directly -copied. -.SS "TCL_OBJECTMETADATADELETEPROC FUNCTION SIGNATURE" -.PP -Functions matching this signature are used to delete metadata associated with -a class or object. -.PP -.CS -typedef void \fBTcl_ObjectMetadataDeleteProc\fR( - ClientData \fImetadata\fR); -.CE -.PP -The \fImetadata\fR argument gives the address of the metadata to be -deleted. -.SS "TCL_CLONEPROC FUNCTION SIGNATURE" -.PP -Functions matching this signature are used to create copies of metadata -associated with a class or object. -.PP -.CS -typedef int \fBTcl_CloneProc\fR( - Tcl_Interp *\fIinterp\fR, - ClientData \fIsrcMetadata\fR, - ClientData *\fIdstMetadataPtr\fR); -.CE -.PP -The \fIinterp\fR argument gives a place to write an error message when the -attempt to clone the object is to fail, in which case the clone procedure must -also return TCL_ERROR; it should return TCL_OK otherwise. -The \fIsrcMetadata\fR argument gives the address of the metadata to be cloned, -and the cloned metadata should be written into the variable pointed to by -\fIdstMetadataPtr\fR; a NULL should be written if the metadata is to not be -cloned but the overall object copy operation is still to succeed. -.SH "OBJECT METHOD NAME MAPPING" -It is possible to control, on a per-object basis, what methods are invoked -when a particular method is invoked. Normally this is done by looking up the -method name in the object and then in the class hierarchy, but fine control of -exactly what the value used to perform the look up is afforded through the -ability to set a method name mapper callback via -\fBTcl_ObjectSetMethodNameMapper\fR (and its introspection counterpart, -\fBTcl_ObjectGetMethodNameMapper\fR, which returns the current mapper). The -current mapper (if any) is invoked immediately before looking up what chain of -method implementations is to be used. -.SS "TCL_OBJECTMAPMETHODNAMEPROC FUNCTION SIGNATURE" -The \fITcl_ObjectMapMethodNameProc\fR callback is defined as follows: -.PP -.CS -typedef int \fBTcl_ObjectMapMethodNameProc\fR( - Tcl_Interp *\fIinterp\fR, - Tcl_Object \fIobject\fR, - Tcl_Class *\fIstartClsPtr\fR, - Tcl_Obj *\fImethodNameObj\fR); -.CE -.PP -If the result is TCL_OK, the remapping is assumed to have been done. If the -result is TCL_ERROR, an error message will have been left in \fIinterp\fR and -the method call will fail. If the result is TCL_BREAK, the standard method -name lookup rules will be used; the behavior of other result codes is -currently undefined. The \fIobject\fR parameter says which object is being -processed. The \fIstartClsPtr\fR parameter points to a variable that contains -the first class to provide a definition in the method chain to process, or -NULL if the whole chain is to be processed (the argument itself is never -NULL); this variable may be updated by the callback. The \fImethodNameObj\fR -parameter gives an unshared object containing the name of the method being -invoked, as provided by the user; this object may be updated by the callback. -.SH "SEE ALSO" -Method(3), oo::class(n), oo::copy(n), oo::define(n), oo::object(n) -.SH KEYWORDS -class, constructor, object -.\" Local variables: -.\" mode: nroff -.\" fill-column: 78 -.\" End: diff --git a/doc/CmdCmplt.3 b/doc/CmdCmplt.3 deleted file mode 100644 index bb7532c..0000000 --- a/doc/CmdCmplt.3 +++ /dev/null @@ -1,34 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_CommandComplete 3 "" Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_CommandComplete \- Check for unmatched braces in a Tcl command -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_CommandComplete\fR(\fIcmd\fR) -.SH ARGUMENTS -.AS "const char" *cmd -.AP "const char" *cmd in -Command string to test for completeness. -.BE - -.SH DESCRIPTION -.PP -\fBTcl_CommandComplete\fR takes a Tcl command string -as argument and determines whether it contains one or more -complete commands (i.e. there are no unclosed quotes, braces, -brackets, or variable references). -If the command string is complete then it returns 1; otherwise it returns 0. - -.SH KEYWORDS -complete command, partial command diff --git a/doc/Concat.3 b/doc/Concat.3 deleted file mode 100644 index e853fc3..0000000 --- a/doc/Concat.3 +++ /dev/null @@ -1,51 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_Concat 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_Concat \- concatenate a collection of strings -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -const char * -\fBTcl_Concat\fR(\fIargc, argv\fR) -.SH ARGUMENTS -.AS "const char *const" argv[] -.AP int argc in -Number of strings. -.AP "const char *const" argv[] in -Array of strings to concatenate. Must have \fIargc\fR entries. -.BE - -.SH DESCRIPTION -.PP -\fBTcl_Concat\fR is a utility procedure used by several of the -Tcl commands. Given a collection of strings, it concatenates -them together into a single string, with the original strings -separated by spaces. This procedure behaves differently than -\fBTcl_Merge\fR, in that the arguments are simply concatenated: -no effort is made to ensure proper list structure. -However, in most common usage the arguments will all be proper -lists themselves; if this is true, then the result will also have -proper list structure. -.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 diff --git a/doc/CrtChannel.3 b/doc/CrtChannel.3 deleted file mode 100644 index 6ef94b5..0000000 --- a/doc/CrtChannel.3 +++ /dev/null @@ -1,928 +0,0 @@ -'\" -'\" 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. -.TH Tcl_CreateChannel 3 8.4 Tcl "Tcl Library Procedures" -.so man.macros -.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 \fR -.sp -Tcl_Channel -\fBTcl_CreateChannel\fR(\fItypePtr, channelName, instanceData, mask\fR) -.sp -ClientData -\fBTcl_GetChannelInstanceData\fR(\fIchannel\fR) -.sp -const 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 -Tcl_ChannelTypeVersion -\fBTcl_ChannelVersion\fR(\fItypePtr\fR) -.sp -Tcl_DriverBlockModeProc * -\fBTcl_ChannelBlockModeProc\fR(\fItypePtr\fR) -.sp -Tcl_DriverCloseProc * -\fBTcl_ChannelCloseProc\fR(\fItypePtr\fR) -.sp -Tcl_DriverClose2Proc * -\fBTcl_ChannelClose2Proc\fR(\fItypePtr\fR) -.sp -Tcl_DriverInputProc * -\fBTcl_ChannelInputProc\fR(\fItypePtr\fR) -.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 -Tcl_DriverTruncateProc * -\fBTcl_ChannelTruncateProc\fR(\fItypePtr\fR) -.sp -Tcl_DriverSetOptionProc * -\fBTcl_ChannelSetOptionProc\fR(\fItypePtr\fR) -.sp -Tcl_DriverGetOptionProc * -\fBTcl_ChannelGetOptionProc\fR(\fItypePtr\fR) -.sp -Tcl_DriverWatchProc * -\fBTcl_ChannelWatchProc\fR(\fItypePtr\fR) -.sp -Tcl_DriverGetHandleProc * -\fBTcl_ChannelGetHandleProc\fR(\fItypePtr\fR) -.sp -Tcl_DriverFlushProc * -\fBTcl_ChannelFlushProc\fR(\fItypePtr\fR) -.sp -Tcl_DriverHandlerProc * -\fBTcl_ChannelHandlerProc\fR(\fItypePtr\fR) -.sp -.SH ARGUMENTS -.AS "const Tcl_ChannelType" *channelName -.AP "const Tcl_ChannelType" *typePtr in -Points to a structure containing the addresses of procedures that -can be called to perform I/O and other functions on the channel. -.AP "const char" *channelName in -The name of this channel, such as \fBfile3\fR; must not be in use -by any other channel. Can be NULL, in which case the channel is -created without a name. If the created channel is assigned to one -of the standard channels (\fBstdin\fR, \fBstdout\fR or \fBstderr\fR), -the assigned channel name will be the name of the standard channel. -.AP ClientData instanceData in -Arbitrary one-word value to be associated with this channel. This -value is passed to procedures in \fItypePtr\fR when they are invoked. -.AP int mask in -OR-ed combination of \fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR to indicate -whether a channel is readable and writable. -.AP Tcl_Channel channel in -The channel to operate on. -.AP int direction in -\fBTCL_READABLE\fR means the input handle is wanted; \fBTCL_WRITABLE\fR -means the output handle is wanted. -.AP ClientData *handlePtr out -Points to the location where the desired OS-specific handle should be -stored. -.AP int size in -The size, in bytes, of buffers to allocate in this channel. -.AP int mask in -An OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR -and \fBTCL_EXCEPTION\fR that indicates events that have occurred on -this channel. -.AP Tcl_Interp *interp in -Current interpreter. (can be NULL) -.AP "const char" *optionName in -Name of the invalid option. -.AP "const char" *optionList in -Specific options list (space separated words, without -.QW \- ) -to append to the standard generic options list. -Can be NULL for generic options error message only. -.BE -.SH DESCRIPTION -.PP -Tcl uses a two-layered channel architecture. It provides a generic upper -layer to enable C and Tcl programs to perform input and output using the -same APIs for a variety of files, devices, sockets etc. The generic C APIs -are described in the manual entry for \fBTcl_OpenFileChannel\fR. -.PP -The lower layer provides type-specific channel drivers for each type -of device supported on each platform. This manual entry describes the -C APIs used to communicate between the generic layer and the -type-specific channel drivers. It also explains how new types of -channels can be added by providing new channel drivers. -.PP -Channel drivers consist of a number of components: First, each channel -driver provides a \fBTcl_ChannelType\fR structure containing pointers to -functions implementing the various operations used by the generic layer to -communicate with the channel driver. The \fBTcl_ChannelType\fR structure -and the functions referenced by it are described in the section -\fBTCL_CHANNELTYPE\fR, below. -.PP -Second, channel drivers usually provide a Tcl command to create -instances of that type of channel. For example, the Tcl \fBopen\fR -command creates channels that use the file and command channel -drivers, and the Tcl \fBsocket\fR command creates channels that use -TCP sockets for network communication. -.PP -Third, a channel driver optionally provides a C function to open -channel instances of that type. For example, \fBTcl_OpenFileChannel\fR -opens a channel that uses the file channel driver, and -\fBTcl_OpenTcpClient\fR opens a channel that uses the TCP network -protocol. These creation functions typically use -\fBTcl_CreateChannel\fR internally to open the channel. -.PP -To add a new type of channel you must implement a C API or a Tcl command -that opens a channel by invoking \fBTcl_CreateChannel\fR. -When your driver calls \fBTcl_CreateChannel\fR it passes in -a \fBTcl_ChannelType\fR structure describing the driver's I/O -procedures. -The generic layer will then invoke the functions referenced in that -structure to perform operations on the channel. -.PP -\fBTcl_CreateChannel\fR opens a new channel and associates the supplied -\fItypePtr\fR and \fIinstanceData\fR with it. The channel is opened in the -mode indicated by \fImask\fR. -For a discussion of channel drivers, their operations and the -\fBTcl_ChannelType\fR structure, see the section \fBTCL_CHANNELTYPE\fR, below. -.PP -\fBTcl_CreateChannel\fR interacts with the code managing the standard -channels. Once a standard channel was initialized either through a -call to \fBTcl_GetStdChannel\fR or a call to \fBTcl_SetStdChannel\fR -closing this standard channel will cause the next call to -\fBTcl_CreateChannel\fR to make the new channel the new standard -channel too. See \fBTcl_StandardChannels\fR for a general treatise -about standard channels and the behavior of the Tcl library with -regard to them. -.PP -\fBTcl_GetChannelInstanceData\fR returns the instance data associated with -the channel in \fIchannel\fR. This is the same as the \fIinstanceData\fR -argument in the call to \fBTcl_CreateChannel\fR that created this channel. -.PP -\fBTcl_GetChannelType\fR returns a pointer to the \fBTcl_ChannelType\fR -structure used by the channel in the \fIchannel\fR argument. This is -the same as the \fItypePtr\fR argument in the call to -\fBTcl_CreateChannel\fR that created this channel. -.PP -\fBTcl_GetChannelName\fR returns a string containing the name associated -with the channel, or NULL if the \fIchannelName\fR argument to -\fBTcl_CreateChannel\fR was NULL. -.PP -\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 -by a previous call to \fBTcl_SetChannelBufferSize\fR, described below, then -the default value of 4096 is returned. -.PP -\fBTcl_SetChannelBufferSize\fR sets the size, in bytes, of buffers that -will be allocated in subsequent operations on the channel to store input or -output. The \fIsize\fR argument should be between one and one million, -allowing buffers of one byte to one million bytes. If \fIsize\fR is -outside this range, \fBTcl_SetChannelBufferSize\fR sets the buffer size to -4096. -.PP -\fBTcl_NotifyChannel\fR is called by a channel driver to indicate to -the generic layer that the events specified by \fImask\fR have -occurred on the channel. Channel drivers are responsible for invoking -this function whenever the channel handlers need to be called for the -channel. See \fBWATCHPROC\fR below for more details. -.PP -\fBTcl_BadChannelOption\fR is called from driver specific -\fIsetOptionProc\fR or \fIgetOptionProc\fR to generate a complete -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). -.PP -\fBTcl_IsChannelExisting\fR checks whether a channel with the specified -name is registered in the (thread)-global list of all channels (result -== 1) or not (result == 0). -.PP -\fBTcl_CutChannel\fR removes the specified \fIchannel\fR from the -(thread)global list of all channels (of the current thread). -Application to a channel still registered in some interpreter -is not allowed. -Also notifies the driver if the \fBTcl_ChannelType\fR version is -\fBTCL_CHANNEL_VERSION_4\fR (or higher), and -\fBTcl_DriverThreadActionProc\fR is defined for it. -.PP -\fBTcl_SpliceChannel\fR adds the specified \fIchannel\fR to the -(thread)global list of all channels (of the current thread). -Application to a channel registered in some interpreter is not allowed. -Also notifies the driver if the \fBTcl_ChannelType\fR version is -\fBTCL_CHANNEL_VERSION_4\fR (or higher), and -\fBTcl_DriverThreadActionProc\fR is defined for it. -.PP -\fBTcl_ClearChannelHandlers\fR removes all channel handlers 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: -.PP -.CS -typedef struct Tcl_ChannelType { - const 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; - Tcl_DriverThreadActionProc *\fIthreadActionProc\fR; - Tcl_DriverTruncateProc *\fItruncateProc\fR; -} \fBTcl_ChannelType\fR; -.CE -.PP -It is not necessary to provide implementations for all channel -operations. Those which are not necessary may be set to NULL in the -struct: \fIblockModeProc\fR, \fIseekProc\fR, \fIsetOptionProc\fR, -\fIgetOptionProc\fR, \fIgetHandleProc\fR, and \fIclose2Proc\fR, in addition to -\fIflushProc\fR, \fIhandlerProc\fR, \fIthreadActionProc\fR, and -\fItruncateProc\fR. Other functions that cannot be implemented in a -meaningful way should return \fBEINVAL\fR when called, to indicate -that the operations they represent are not available. Also note that -\fIwideSeekProc\fR can be NULL if \fIseekProc\fR is. -.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, -\fBTcl_ChannelTruncateProc\fR, -\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 -since the previous code for stacked channels had problems. -.SS TYPENAME -.PP -The \fItypeName\fR field contains a null-terminated string that -identifies the type of the device implemented by this driver, e.g. -\fBfile\fR or \fBsocket\fR. -.PP -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 specify the \fIwideSeekProc\fR member. -\fBTCL_CHANNEL_VERSION_4\fR must be set to specify the \fIthreadActionProc\fR member -(includes \fIwideSeekProc\fR). -\fBTCL_CHANNEL_VERSION_5\fR must be set to specify the -\fItruncateProc\fR members (includes -\fIwideSeekProc\fR and \fIthreadActionProc\fR). -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 -\fBTCL_CHANNEL_VERSION_5\fR, -\fBTCL_CHANNEL_VERSION_4\fR, -\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 -.CS -typedef int \fBTcl_DriverBlockModeProc\fR( - ClientData \fIinstanceData\fR, - int \fImode\fR); -.CE -.PP -The \fIinstanceData\fR is the same as the value passed to -\fBTcl_CreateChannel\fR when this channel was created. The \fImode\fR -argument is either \fBTCL_MODE_BLOCKING\fR or \fBTCL_MODE_NONBLOCKING\fR to -set the device into blocking or nonblocking mode. The function should -return zero if the operation was successful, or a nonzero POSIX error code -if the operation failed. -.PP -If the operation is successful, the function can modify the supplied -\fIinstanceData\fR to record that the channel entered blocking or -nonblocking mode and to implement the blocking or nonblocking behavior. -For some device types, the blocking and nonblocking behavior can be -implemented by the underlying operating system; for other device types, the -behavior must be emulated in the channel driver. -.PP -This value can be retrieved with \fBTcl_ChannelBlockModeProc\fR, which returns -a pointer to the function. -.PP -A channel driver \fBnot\fR supplying a \fIblockModeProc\fR has to be -very, very careful. It has to tell the generic layer exactly which -blocking mode is acceptable to it, and should this also document for -the user so that the blocking mode of the channel is not changed to an -unacceptable value. Any confusion here may lead the interpreter into a -(spurious and difficult to find) deadlock. -.SS "CLOSEPROC AND CLOSE2PROC" -.PP -The \fIcloseProc\fR field contains the address of a function called by the -generic layer to clean up driver-related information when the channel is -closed. \fICloseProc\fR must match the following prototype: -.PP -.CS -typedef int \fBTcl_DriverCloseProc\fR( - ClientData \fIinstanceData\fR, - Tcl_Interp *\fIinterp\fR); -.CE -.PP -The \fIinstanceData\fR argument is the same as the value provided to -\fBTcl_CreateChannel\fR when the channel was created. The function should -release any storage maintained by the channel driver for this channel, and -close the input and output devices encapsulated by this channel. All queued -output will have been flushed to the device before this function is called, -and no further driver operations will be invoked on this instance after -calling the \fIcloseProc\fR. If the close operation is successful, the -procedure should return zero; otherwise it should return a nonzero POSIX -error code. In addition, if an error occurs and \fIinterp\fR is not NULL, -the procedure should store an error message in the interpreter's result. -.PP -Alternatively, channels that support closing the read and write sides -independently may set \fIcloseProc\fR to \fBTCL_CLOSE2PROC\fR and set -\fIclose2Proc\fR to the address of a function that matches the -following prototype: -.PP -.CS -typedef int \fBTcl_DriverClose2Proc\fR( - ClientData \fIinstanceData\fR, - Tcl_Interp *\fIinterp\fR, - int \fIflags\fR); -.CE -.PP -The \fIclose2Proc\fR will be called with \fIflags\fR set to an OR'ed -combination of \fBTCL_CLOSE_READ\fR or \fBTCL_CLOSE_WRITE\fR to -indicate that the driver should close the read and/or write side of -the channel. The channel driver may be invoked to perform -additional operations on the channel after \fIclose2Proc\fR is -called to close one or both sides of the channel. If \fIflags\fR is -\fB0\fR (zero), the driver should close the channel in the manner -described above for \fIcloseProc\fR. No further operations will be -invoked on this instance after \fIclose2Proc\fR is called with all -flags cleared. In all cases, the \fIclose2Proc\fR function should -return zero if the close operation was successful; otherwise it should -return a nonzero POSIX error code. In addition, if an error occurs and -\fIinterp\fR is not NULL, the procedure should store an error message -in the interpreter's result. -.PP -The \fIcloseProc\fR and \fIclose2Proc\fR values can be retrieved with -\fBTcl_ChannelCloseProc\fR or \fBTcl_ChannelClose2Proc\fR, which -return a pointer to the respective function. -.SS INPUTPROC -.PP -The \fIinputProc\fR field contains the address of a function called by the -generic layer to read data from the file or device and store it in an -internal buffer. \fIInputProc\fR must match the following prototype: -.PP -.CS -typedef int \fBTcl_DriverInputProc\fR( - ClientData \fIinstanceData\fR, - char *\fIbuf\fR, - int \fIbufSize\fR, - int *\fIerrorCodePtr\fR); -.CE -.PP -\fIInstanceData\fR is the same as the value passed to -\fBTcl_CreateChannel\fR when the channel was created. The \fIbuf\fR -argument points to an array of bytes in which to store input from the -device, and the \fIbufSize\fR argument indicates how many bytes are -available at \fIbuf\fR. -.PP -The \fIerrorCodePtr\fR argument points to an integer variable provided by -the generic layer. If an error occurs, the function should set the variable -to a POSIX error code that identifies the error that occurred. -.PP -The function should read data from the input device encapsulated by the -channel and store it at \fIbuf\fR. On success, the function should return -a nonnegative integer indicating how many bytes were read from the input -device and stored at \fIbuf\fR. On error, the function should return -1. If -an error occurs after some data has been read from the device, that data is -lost. -.PP -If \fIinputProc\fR can determine that the input device has some data -available but less than requested by the \fIbufSize\fR argument, the -function should only attempt to read as much data as is available and -return without blocking. If the input device has no data available -whatsoever and the channel is in nonblocking mode, the function should -return an \fBEAGAIN\fR error. If the input device has no data available -whatsoever and the channel is in blocking mode, the function should block -for the shortest possible time until at least one byte of data can be read -from the device; then, it should return as much data as it can read without -blocking. -.PP -This value can be retrieved with \fBTcl_ChannelInputProc\fR, which returns -a pointer to the function. -.SS OUTPUTPROC -.PP -The \fIoutputProc\fR field contains the address of a function called by the -generic layer to transfer data from an internal buffer to the output device. -\fIOutputProc\fR must match the following prototype: -.PP -.CS -typedef int \fBTcl_DriverOutputProc\fR( - ClientData \fIinstanceData\fR, - const char *\fIbuf\fR, - int \fItoWrite\fR, - int *\fIerrorCodePtr\fR); -.CE -.PP -\fIInstanceData\fR is the same as the value passed to -\fBTcl_CreateChannel\fR when the channel was created. The \fIbuf\fR -argument contains an array of bytes to be written to the device, and the -\fItoWrite\fR argument indicates how many bytes are to be written from the -\fIbuf\fR argument. -.PP -The \fIerrorCodePtr\fR argument points to an integer variable provided by -the generic layer. If an error occurs, the function should set this -variable to a POSIX error code that identifies the error. -.PP -The function should write the data at \fIbuf\fR to the output device -encapsulated by the channel. On success, the function should return a -nonnegative integer indicating how many bytes were written to the output -device. The return value is normally the same as \fItoWrite\fR, but may be -less in some cases such as if the output operation is interrupted by a -signal. If an error occurs the function should return -1. In case of -error, some data may have been written to the device. -.PP -If the channel is nonblocking and the output device is unable to absorb any -data whatsoever, the function should return -1 with an \fBEAGAIN\fR error -without writing any data. -.PP -This value can be retrieved with \fBTcl_ChannelOutputProc\fR, which returns -a pointer to the function. -.SS "SEEKPROC AND WIDESEEKPROC" -.PP -The \fIseekProc\fR field contains the address of a function called by the -generic layer to move the access point at which subsequent input or output -operations will be applied. \fISeekProc\fR must match the following -prototype: -.PP -.CS -typedef int \fBTcl_DriverSeekProc\fR( - ClientData \fIinstanceData\fR, - long \fIoffset\fR, - int \fIseekMode\fR, - int *\fIerrorCodePtr\fR); -.CE -.PP -The \fIinstanceData\fR argument is the same as the value given to -\fBTcl_CreateChannel\fR when this channel was created. \fIOffset\fR and -\fIseekMode\fR have the same meaning as for the \fBTcl_Seek\fR -procedure (described in the manual entry for \fBTcl_OpenFileChannel\fR). -.PP -The \fIerrorCodePtr\fR argument points to an integer variable provided by -the generic layer for returning \fBerrno\fR values from the function. The -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: -.PP -.CS -typedef Tcl_WideInt \fBTcl_DriverWideSeekProc\fR( - ClientData \fIinstanceData\fR, - Tcl_WideInt \fIoffset\fR, - int \fIseekMode\fR, - int *\fIerrorCodePtr\fR); -.CE -.PP -The arguments and return values mean the same thing as with -\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 -typedef int \fBTcl_DriverSetOptionProc\fR( - ClientData \fIinstanceData\fR, - Tcl_Interp *\fIinterp\fR, - const char *\fIoptionName\fR, - const char *\fInewValue\fR); -.CE -.PP -\fIoptionName\fR is the name of an option to set, and \fInewValue\fR is -the new value for that option, as a string. The \fIinstanceData\fR is the -same as the value given to \fBTcl_CreateChannel\fR when this channel was -created. The function should do whatever channel type specific action is -required to implement the new value of the option. -.PP -Some options are handled by the generic code and this function is never -called to set them, e.g. \fB\-blockmode\fR. Other options are specific to -each channel type and the \fIsetOptionProc\fR procedure of the channel -driver will get called to implement them. The \fIsetOptionProc\fR field can -be NULL, which indicates that this channel type supports no type specific -options. -.PP -If the option value is successfully modified to the new value, the function -returns \fBTCL_OK\fR. -It should call \fBTcl_BadChannelOption\fR which itself returns -\fBTCL_ERROR\fR if the \fIoptionName\fR is -unrecognized. -If \fInewValue\fR specifies a value for the option that -is not supported or if a system call error occurs, -the function should leave an error message in the -\fIresult\fR field of \fIinterp\fR if \fIinterp\fR is not NULL. The -function should also call \fBTcl_SetErrno\fR to store an appropriate POSIX -error code. -.PP -This value can be retrieved with \fBTcl_ChannelSetOptionProc\fR, which returns -a pointer to the function. -.SS GETOPTIONPROC -.PP -The \fIgetOptionProc\fR field contains the address of a function called by -the generic layer to get the value of a channel type specific option on a -channel. \fIgetOptionProc\fR must match the following prototype: -.PP -.CS -typedef int \fBTcl_DriverGetOptionProc\fR( - ClientData \fIinstanceData\fR, - Tcl_Interp *\fIinterp\fR, - const char *\fIoptionName\fR, - Tcl_DString *\fIoptionValue\fR); -.CE -.PP -\fIOptionName\fR is the name of an option supported by this type of -channel. If the option name is not NULL, the function stores its current -value, as a string, in the Tcl dynamic string \fIoptionValue\fR. -If \fIoptionName\fR is NULL, the function stores in \fIoptionValue\fR an -alternating list of all supported options and their current values. -On success, the function returns \fBTCL_OK\fR. -It should call \fBTcl_BadChannelOption\fR which itself returns -\fBTCL_ERROR\fR if the \fIoptionName\fR is -unrecognized. If a system call error occurs, -the function should leave an error message in the -result of \fIinterp\fR if \fIinterp\fR is not NULL. The -function should also call \fBTcl_SetErrno\fR to store an appropriate POSIX -error code. -.PP -Some options are handled by the generic code and this function is never -called to retrieve their value, e.g. \fB\-blockmode\fR. Other options are -specific to each channel type and the \fIgetOptionProc\fR procedure of the -channel driver will get called to implement them. The \fIgetOptionProc\fR -field can be NULL, which indicates that this channel type supports no type -specific options. -.PP -This value can be retrieved with \fBTcl_ChannelGetOptionProc\fR, which returns -a pointer to the function. -.SS WATCHPROC -.PP -The \fIwatchProc\fR field contains the address of a function called -by the generic layer to initialize the event notification mechanism to -notice events of interest on this channel. -\fIWatchProc\fR should match the following prototype: -.PP -.CS -typedef void \fBTcl_DriverWatchProc\fR( - ClientData \fIinstanceData\fR, - int \fImask\fR); -.CE -.PP -The \fIinstanceData\fR is the same as the value passed to -\fBTcl_CreateChannel\fR when this channel was created. The \fImask\fR -argument is an OR-ed combination of \fBTCL_READABLE\fR, \fBTCL_WRITABLE\fR -and \fBTCL_EXCEPTION\fR; it indicates events the caller is interested in -noticing on this channel. -.PP -The function should initialize device type specific mechanisms to -notice when an event of interest is present on the channel. When one -or more of the designated events occurs on the channel, the channel -driver is responsible for calling \fBTcl_NotifyChannel\fR to inform -the generic channel module. The driver should take care not to starve -other channel drivers or sources of callbacks by invoking -Tcl_NotifyChannel too frequently. Fairness can be insured by using -the Tcl event queue to allow the channel event to be scheduled in sequence -with other events. See the description of \fBTcl_QueueEvent\fR for -details on how to queue an event. -.PP -This value can be retrieved with \fBTcl_ChannelWatchProc\fR, which returns -a pointer to the function. -.SS GETHANDLEPROC -.PP -The \fIgetHandleProc\fR field contains the address of a function called by -the generic layer to retrieve a device-specific handle from the channel. -\fIGetHandleProc\fR should match the following prototype: -.PP -.CS -typedef int \fBTcl_DriverGetHandleProc\fR( - ClientData \fIinstanceData\fR, - int \fIdirection\fR, - ClientData *\fIhandlePtr\fR); -.CE -.PP -\fIInstanceData\fR is the same as the value passed to -\fBTcl_CreateChannel\fR when this channel was created. The \fIdirection\fR -argument is either \fBTCL_READABLE\fR to retrieve the handle used -for input, or \fBTCL_WRITABLE\fR to retrieve the handle used for -output. -.PP -If the channel implementation has device-specific handles, the -function should retrieve the appropriate handle associated with the -channel, according the \fIdirection\fR argument. The handle should be -stored in the location referred to by \fIhandlePtr\fR, and -\fBTCL_OK\fR should be returned. If the channel is not open for the -specified direction, or if the channel implementation does not use -device handles, the function should return \fBTCL_ERROR\fR. -.PP -This value can be retrieved with \fBTcl_ChannelGetHandleProc\fR, which returns -a pointer to the function. -.SS FLUSHPROC -.PP -The \fIflushProc\fR field is currently reserved for future use. -It should be set to NULL. -\fIFlushProc\fR should match the following prototype: -.PP -.CS -typedef int \fBTcl_DriverFlushProc\fR( - ClientData \fIinstanceData\fR); -.CE -.PP -This value can be retrieved with \fBTcl_ChannelFlushProc\fR, which returns -a pointer to the function. -.SS HANDLERPROC -.PP -The \fIhandlerProc\fR field contains the address of a function called by -the generic layer to notify the channel that an event occurred. It should -be defined for stacked channel drivers that wish to be notified of events -that occur on the underlying (stacked) channel. -\fIHandlerProc\fR should match the following prototype: -.PP -.CS -typedef int \fBTcl_DriverHandlerProc\fR( - ClientData \fIinstanceData\fR, - int \fIinterestMask\fR); -.CE -.PP -\fIInstanceData\fR is the same as the value passed to \fBTcl_CreateChannel\fR -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 \fBTcl_DriverThreadActionProc\fR( - 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 \fBTcl_DriverTruncateProc\fR( - 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 -.QW "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. -.PP -It always returns \fBTCL_ERROR\fR -.PP -An error message is generated in \fIinterp\fR's result value to -indicate that a command was invoked with a bad option. -The message has the form -.CS - bad option "blah": should be one of - <...generic options...>+<...specific options...> -.CE -so you get for instance: -.CS - bad option "-blah": should be one of -blocking, - -buffering, -buffersize, -eofchar, -translation, - -peername, or -sockname -.CE -when called with \fIoptionList\fR equal to -.QW "peername sockname" -.PP -.QW blah -is the \fIoptionName\fR argument and -.QW "" -is a space separated list of specific option words. -The function takes good care of inserting minus signs before -each option, commas after, and an -.QW or -before the last option. -.SH "OLD CHANNEL TYPES" -The original (8.3.1 and below) \fBTcl_ChannelType\fR structure contains -the following fields: -.PP -.CS -typedef struct Tcl_ChannelType { - const char *\fItypeName\fR; - Tcl_DriverBlockModeProc *\fIblockModeProc\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; -} \fBTcl_ChannelType\fR; -.CE -.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 { - const 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; -} \fBTcl_ChannelType\fR; -.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 diff --git a/doc/CrtChnlHdlr.3 b/doc/CrtChnlHdlr.3 deleted file mode 100644 index 0ecd3c9..0000000 --- a/doc/CrtChnlHdlr.3 +++ /dev/null @@ -1,89 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_CreateChannelHandler 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_CreateChannelHandler, Tcl_DeleteChannelHandler \- call a procedure when a channel becomes readable or writable -.SH SYNOPSIS -.nf -.nf -\fB#include \fR -.sp -void -\fBTcl_CreateChannelHandler\fR(\fIchannel, mask, proc, clientData\fR) -.sp -void -\fBTcl_DeleteChannelHandler\fR(\fIchannel, proc, clientData\fR) -.sp -.SH ARGUMENTS -.AS Tcl_ChannelProc clientData -.AP Tcl_Channel channel in -Tcl channel such as returned by \fBTcl_CreateChannel\fR. -.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. Specify -a zero value to temporarily disable an existing handler. -.AP Tcl_FileProc *proc in -Procedure to invoke whenever the channel indicated by \fIchannel\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_CreateChannelHandler\fR arranges for \fIproc\fR to be called in the -future whenever input or output becomes possible on the channel identified -by \fIchannel\fR, or whenever an exceptional condition exists for -\fIchannel\fR. The conditions of interest under which \fIproc\fR will be -invoked are specified by the \fImask\fR argument. -See the manual entry for \fBfileevent\fR for a precise description of -what it means for a channel to be readable or writable. -\fIProc\fR must conform to the following prototype: -.PP -.CS -typedef void \fBTcl_ChannelProc\fR( - ClientData \fIclientData\fR, - int \fImask\fR); -.CE -.PP -The \fIclientData\fR argument is the same as the value passed to -\fBTcl_CreateChannelHandler\fR when the handler was created. Typically, -\fIclientData\fR points to a data structure containing application-specific -information about the channel. \fIMask\fR is an integer mask indicating -which of the requested conditions actually exists for the channel; it will -contain a subset of the bits from the \fImask\fR argument to -\fBTcl_CreateChannelHandler\fR when the handler was created. -.PP -Each channel handler is identified by a unique combination of \fIchannel\fR, -\fIproc\fR and \fIclientData\fR. -There may be many handlers for a given channel as long as they do not -have the same \fIchannel\fR, \fIproc\fR, and \fIclientData\fR. -If \fBTcl_CreateChannelHandler\fR is invoked when there is already a handler -for \fIchannel\fR, \fIproc\fR, and \fIclientData\fR, then no new -handler is created; instead, the \fImask\fR is changed for the -existing handler. -.PP -\fBTcl_DeleteChannelHandler\fR deletes a channel handler identified by -\fIchannel\fR, \fIproc\fR and \fIclientData\fR; if no such handler exists, -the call has no effect. -.PP -Channel handlers are invoked via the Tcl event mechanism, so they -are only useful in applications that are event-driven. -Note also that the conditions specified in the \fImask\fR argument -to \fIproc\fR may no longer exist when \fIproc\fR is invoked: for -example, if there are two handlers for \fBTCL_READABLE\fR on the same -channel, the first handler could consume all of the available input -so that the channel is no longer readable when the second handler -is invoked. -For this reason it may be useful to use nonblocking I/O on channels -for which there are event handlers. -.SH "SEE ALSO" -Notifier(3), Tcl_CreateChannel(3), Tcl_OpenFileChannel(3), vwait(n). -.SH KEYWORDS -blocking, callback, channel, events, handler, nonblocking. diff --git a/doc/CrtCloseHdlr.3 b/doc/CrtCloseHdlr.3 deleted file mode 100644 index bac2431..0000000 --- a/doc/CrtCloseHdlr.3 +++ /dev/null @@ -1,55 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_CreateCloseHandler 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_CreateCloseHandler, Tcl_DeleteCloseHandler \- arrange for callbacks when channels are closed -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -void -\fBTcl_CreateCloseHandler\fR(\fIchannel, proc, clientData\fR) -.sp -void -\fBTcl_DeleteCloseHandler\fR(\fIchannel, proc, clientData\fR) -.sp -.SH ARGUMENTS -.AS Tcl_CloseProc clientData -.AP Tcl_Channel channel in -The channel for which to create or delete a close callback. -.AP Tcl_CloseProc *proc in -The procedure to call as the callback. -.AP ClientData clientData in -Arbitrary one-word value to pass to \fIproc\fR. -.BE -.SH DESCRIPTION -.PP -\fBTcl_CreateCloseHandler\fR arranges for \fIproc\fR to be called when -\fIchannel\fR is closed with \fBTcl_Close\fR or -\fBTcl_UnregisterChannel\fR, or using the Tcl \fBclose\fR command. -\fIProc\fR should match the following prototype: -.PP -.CS -typedef void \fBTcl_CloseProc\fR( - ClientData \fIclientData\fR); -.CE -.PP -The \fIclientData\fR is the same as the value provided in the call to -\fBTcl_CreateCloseHandler\fR. -.PP -\fBTcl_DeleteCloseHandler\fR removes a close callback for \fIchannel\fR. -The \fIproc\fR and \fIclientData\fR identify which close callback to -remove; \fBTcl_DeleteCloseHandler\fR does nothing if its \fIproc\fR and -\fIclientData\fR arguments do not match the \fIproc\fR and \fIclientData\fR -for a close handler for \fIchannel\fR. -.SH "SEE ALSO" -close(n), Tcl_Close(3), Tcl_UnregisterChannel(3) -.SH KEYWORDS -callback, channel closing diff --git a/doc/CrtCommand.3 b/doc/CrtCommand.3 deleted file mode 100644 index bf76d48..0000000 --- a/doc/CrtCommand.3 +++ /dev/null @@ -1,143 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_CreateCommand 3 "" Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_CreateCommand \- implement new commands in C -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Command -\fBTcl_CreateCommand\fR(\fIinterp, cmdName, proc, clientData, deleteProc\fR) -.SH ARGUMENTS -.AS Tcl_CmdDeleteProc *deleteProc -.AP Tcl_Interp *interp in -Interpreter in which to create new command. -.AP "const char" *cmdName in -Name of command. -.AP Tcl_CmdProc *proc in -Implementation of new command: \fIproc\fR will be called whenever -\fIcmdName\fR is invoked as a command. -.AP ClientData clientData in -Arbitrary one-word value to pass to \fIproc\fR and \fIdeleteProc\fR. -.AP Tcl_CmdDeleteProc *deleteProc in -Procedure to call before \fIcmdName\fR is deleted from the interpreter; -allows for command-specific cleanup. If NULL, then no procedure is -called before the command is deleted. -.BE -.SH DESCRIPTION -.PP -\fBTcl_CreateCommand\fR defines a new command in \fIinterp\fR and associates -it with procedure \fIproc\fR such that whenever \fIcmdName\fR is -invoked as a Tcl command (via a call to \fBTcl_Eval\fR) the Tcl interpreter -will call \fIproc\fR to process the command. -It differs from \fBTcl_CreateObjCommand\fR in that a new string-based -command is defined; -that is, a command procedure is defined that takes an array of -argument strings instead of values. -The value-based command procedures registered by \fBTcl_CreateObjCommand\fR -can execute significantly faster than the string-based command procedures -defined by \fBTcl_CreateCommand\fR. -This is because they take Tcl values as arguments -and those values can retain an internal representation that -can be manipulated more efficiently. -Also, Tcl's interpreter now uses values internally. -In order to invoke a string-based command procedure -registered by \fBTcl_CreateCommand\fR, -it must generate and fetch a string representation -from each argument value before the call. -New commands should be defined using \fBTcl_CreateObjCommand\fR. -We support \fBTcl_CreateCommand\fR for backwards compatibility. -.PP -The procedures \fBTcl_DeleteCommand\fR, \fBTcl_GetCommandInfo\fR, -and \fBTcl_SetCommandInfo\fR are used in conjunction with -\fBTcl_CreateCommand\fR. -.PP -\fBTcl_CreateCommand\fR will delete an existing command \fIcmdName\fR, -if one is already associated with the interpreter. -It returns a token that may be used to refer -to the command in subsequent calls to \fBTcl_GetCommandName\fR. -If \fIcmdName\fR contains any \fB::\fR namespace qualifiers, -then the command is added to the specified namespace; -otherwise the command is added to the global namespace. -If \fBTcl_CreateCommand\fR is called for an interpreter that is in -the process of being deleted, then it does not create a new command -and it returns NULL. -\fIProc\fR should have arguments and result that match the type -\fBTcl_CmdProc\fR: -.PP -.CS -typedef int \fBTcl_CmdProc\fR( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR, - int \fIargc\fR, - const char *\fIargv\fR[]); -.CE -.PP -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_CreateCommand\fR. -Typically, \fIclientData\fR points to an application-specific -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; -in the case of a \fBTCL_OK\fR return code this gives the result -of the command, and in the case of \fBTCL_ERROR\fR it gives an error message. -The \fBTcl_SetResult\fR procedure provides an easy interface for setting -the return value; for complete details on how the interpreter result -field is managed, see the \fBTcl_Interp\fR man page. -Before invoking a command procedure, -\fBTcl_Eval\fR sets the interpreter result to point to an empty string, -so simple commands can return an empty result by doing nothing at all. -.PP -The contents of the \fIargv\fR array belong to Tcl and are not -guaranteed to persist once \fIproc\fR returns: \fIproc\fR should -not modify them, nor should it set the interpreter result to point -anywhere within the \fIargv\fR values. -Call \fBTcl_SetResult\fR with status \fBTCL_VOLATILE\fR if you want -to return something from the \fIargv\fR array. -.PP -\fIDeleteProc\fR will be invoked when (if) \fIcmdName\fR is deleted. This can -occur through a call to \fBTcl_DeleteCommand\fR or \fBTcl_DeleteInterp\fR, -or by replacing \fIcmdName\fR in another call to \fBTcl_CreateCommand\fR. -\fIDeleteProc\fR is invoked before the command is deleted, and gives the -application an opportunity to release any structures associated -with the command. \fIDeleteProc\fR should have arguments and -result that match the type \fBTcl_CmdDeleteProc\fR: -.PP -.CS -typedef void \fBTcl_CmdDeleteProc\fR( - ClientData \fIclientData\fR); -.CE -.PP -The \fIclientData\fR argument will be the same as the \fIclientData\fR -argument passed to \fBTcl_CreateCommand\fR. -.SH "SEE ALSO" -Tcl_CreateObjCommand, Tcl_DeleteCommand, Tcl_GetCommandInfo, -Tcl_SetCommandInfo, Tcl_GetCommandName, Tcl_SetObjResult -.SH KEYWORDS -bind, command, create, delete, interpreter, namespace diff --git a/doc/CrtFileHdlr.3 b/doc/CrtFileHdlr.3 deleted file mode 100644 index f1b8df7..0000000 --- a/doc/CrtFileHdlr.3 +++ /dev/null @@ -1,91 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_CreateFileHandler 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_CreateFileHandler, Tcl_DeleteFileHandler \- associate procedure callbacks with files or devices (Unix only) -.SH SYNOPSIS -.nf -\fB#include \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. -.PP -\fIProc\fR should have arguments and result that match the -type \fBTcl_FileProc\fR: -.PP -.CS -typedef void \fBTcl_FileProc\fR( - ClientData \fIclientData\fR, - int \fImask\fR); -.CE -.PP -The \fIclientData\fR parameter to \fIproc\fR is a copy -of the \fIclientData\fR -argument given to \fBTcl_CreateFileHandler\fR when the callback -was created. Typically, \fIclientData\fR points to a data -structure containing application-specific information about -the file. \fIMask\fR is an integer mask indicating which -of the requested conditions actually exists for the file; it -will contain a subset of the bits in the \fImask\fR argument -to \fBTcl_CreateFileHandler\fR. -.PP -There may exist only one handler for a given file at a given time. -If \fBTcl_CreateFileHandler\fR is called when a handler already -exists for \fIfd\fR, then the new callback replaces the information -that was previously recorded. -.PP -\fBTcl_DeleteFileHandler\fR may be called to delete the -file handler for \fIfd\fR; if no handler exists for the -file given by \fIfd\fR then the procedure has no effect. -.PP -The purpose of file handlers is to enable an application to respond to -events while waiting for files to become ready for I/O. For this to work -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 will not 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 "SEE ALSO" -fileevent(n), Tcl_CreateTimerHandler(3), Tcl_DoWhenIdle(3) -.SH KEYWORDS -callback, file, handler diff --git a/doc/CrtInterp.3 b/doc/CrtInterp.3 deleted file mode 100644 index 1d49158..0000000 --- a/doc/CrtInterp.3 +++ /dev/null @@ -1,150 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_CreateInterp 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_CreateInterp, Tcl_DeleteInterp, Tcl_InterpActive, Tcl_InterpDeleted \- create and delete Tcl command interpreters -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Interp * -\fBTcl_CreateInterp\fR() -.sp -\fBTcl_DeleteInterp\fR(\fIinterp\fR) -.sp -int -\fBTcl_InterpDeleted\fR(\fIinterp\fR) -.sp -.VS 8.6 -int -\fBTcl_InterpActive\fR(\fIinterp\fR) -.VE 8.6 -.SH ARGUMENTS -.AS Tcl_Interp *interp -.AP Tcl_Interp *interp in -Token for interpreter to be destroyed or queried. -.BE -.SH DESCRIPTION -.PP -\fBTcl_CreateInterp\fR creates a new interpreter structure and returns -a token for it. The token is required in calls to most other Tcl -procedures, such as \fBTcl_CreateCommand\fR, \fBTcl_Eval\fR, and -\fBTcl_DeleteInterp\fR. The token returned by \fBTcl_CreateInterp\fR -may only be passed to Tcl routines called from the same thread as -the original \fBTcl_CreateInterp\fR call. It is not safe for multiple -threads to pass the same token to Tcl's routines. -The new interpreter is initialized with the built-in Tcl commands -and with standard variables like \fBtcl_platform\fR and \fBenv\fR. To -bind in additional commands, call \fBTcl_CreateCommand\fR, and to -create additional variables, call \fBTcl_SetVar\fR. -.PP -\fBTcl_DeleteInterp\fR marks an interpreter as deleted; the interpreter -will eventually be deleted when all calls to \fBTcl_Preserve\fR for it have -been matched by calls to \fBTcl_Release\fR. At that time, all of the -resources associated with it, including variables, procedures, and -application-specific command bindings, will be deleted. After -\fBTcl_DeleteInterp\fR returns any attempt to use \fBTcl_Eval\fR on the -interpreter will fail and return \fBTCL_ERROR\fR. After the call to -\fBTcl_DeleteInterp\fR it is safe to examine the interpreter's result, -query or set the values of variables, define, undefine or retrieve -procedures, and examine the runtime evaluation stack. See below, in the -section \fBINTERPRETERS AND MEMORY MANAGEMENT\fR for details. -.PP -\fBTcl_InterpDeleted\fR returns nonzero if \fBTcl_DeleteInterp\fR was -called with \fIinterp\fR as its argument; this indicates that the -interpreter will eventually be deleted, when the last call to -\fBTcl_Preserve\fR for it is matched by a call to \fBTcl_Release\fR. If -nonzero is returned, further calls to \fBTcl_Eval\fR in this interpreter -will return \fBTCL_ERROR\fR. -.PP -\fBTcl_InterpDeleted\fR is useful in deletion callbacks to distinguish -between when only the memory the callback is responsible for is being -deleted and when the whole interpreter is being deleted. In the former case -the callback may recreate the data being deleted, but this would lead to an -infinite loop if the interpreter were being deleted. -.PP -.VS 8.6 -\fBTcl_InterpActive\fR is useful for determining whether there is any -execution of scripts ongoing in an interpreter, which is a useful piece of -information when Tcl is embedded in a garbage-collected environment and it -becomes necessary to determine whether the interpreter is a candidate for -deletion. The function returns a true value if the interpreter has at least -one active execution running inside it, and a false value otherwise. -.VE 8.6 -.SH "INTERPRETERS AND MEMORY MANAGEMENT" -.PP -\fBTcl_DeleteInterp\fR can be called at any time on an interpreter that may -be used by nested evaluations and C code in various extensions. Tcl -implements a simple mechanism that allows callers to use interpreters -without worrying about the interpreter being deleted in a nested call, and -without requiring special code to protect the interpreter, in most cases. -This mechanism ensures that nested uses of an interpreter can safely -continue using it even after \fBTcl_DeleteInterp\fR is called. -.PP -The mechanism relies on matching up calls to \fBTcl_Preserve\fR with calls -to \fBTcl_Release\fR. If \fBTcl_DeleteInterp\fR has been called, only when -the last call to \fBTcl_Preserve\fR is matched by a call to -\fBTcl_Release\fR, will the interpreter be freed. See the manual entry for -\fBTcl_Preserve\fR for a description of these functions. -.PP -The rules for when the user of an interpreter must call \fBTcl_Preserve\fR -and \fBTcl_Release\fR are simple: -.TP -\fBInterpreters Passed As Arguments\fR -. -Functions that are passed an interpreter as an argument can safely use the -interpreter without any special protection. Thus, when you write an -extension consisting of new Tcl commands, no special code is needed to -protect interpreters received as arguments. This covers the majority of all -uses. -.TP -\fBInterpreter Creation And Deletion\fR -. -When a new interpreter is created and used in a call to \fBTcl_Eval\fR, -\fBTcl_VarEval\fR, \fBTcl_GlobalEval\fR, \fBTcl_SetVar\fR, or -\fBTcl_GetVar\fR, a pair of calls to \fBTcl_Preserve\fR and -\fBTcl_Release\fR should be wrapped around all uses of the interpreter. -Remember that it is unsafe to use the interpreter once \fBTcl_Release\fR -has been called. To ensure that the interpreter is properly deleted when -it is no longer needed, call \fBTcl_InterpDeleted\fR to test if some other -code already called \fBTcl_DeleteInterp\fR; if not, call -\fBTcl_DeleteInterp\fR before calling \fBTcl_Release\fR in your own code. -.TP -\fBRetrieving An Interpreter From A Data Structure\fR -. -When an interpreter is retrieved from a data structure (e.g. the client -data of a callback) for use in one of the evaluation functions -(\fBTcl_Eval\fR, \fBTcl_VarEval\fR, \fBTcl_GlobalEval\fR, \fBTcl_EvalObjv\fR, -etc.) or variable access functions (\fBTcl_SetVar\fR, \fBTcl_GetVar\fR, -\fBTcl_SetVar2Ex\fR, etc.), a pair of -calls to \fBTcl_Preserve\fR and \fBTcl_Release\fR should be wrapped around -all uses of the interpreter; it is unsafe to reuse the interpreter once -\fBTcl_Release\fR has been called. If an interpreter is stored inside a -callback data structure, an appropriate deletion cleanup mechanism should -be set up by the code that creates the data structure so that the -interpreter is removed from the data structure (e.g. by setting the field -to NULL) when the interpreter is deleted. Otherwise, you may be using an -interpreter that has been freed and whose memory may already have been -reused. -.PP -All uses of interpreters in Tcl and Tk have already been protected. -Extension writers should ensure that their code also properly protects any -additional interpreters used, as described above. -.PP -.VS 8.6 -Note that the protection mechanisms do not work well with conventional garbage -collection systems. When in such a managed environment, \fBTcl_InterpActive\fR -should be used to determine when an interpreter is a candidate for deletion -due to inactivity. -.VE 8.6 -.SH "SEE ALSO" -Tcl_Preserve(3), Tcl_Release(3) -.SH KEYWORDS -command, create, delete, interpreter diff --git a/doc/CrtMathFnc.3 b/doc/CrtMathFnc.3 deleted file mode 100644 index acceb5b..0000000 --- a/doc/CrtMathFnc.3 +++ /dev/null @@ -1,162 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_CreateMathFunc 3 8.4 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_CreateMathFunc, Tcl_GetMathFuncInfo, Tcl_ListMathFuncs \- Define, query and enumerate math functions for expressions -.SH "NOTICE OF EVENTUAL DEPRECATION" -.PP -The \fBTcl_CreateMathFunc\fR and \fBTcl_GetMathFuncInfo\fR functions -are rendered somewhat obsolete by the ability to create functions for -expressions by placing commands in the \fBtcl::mathfunc\fR namespace, -as described in the \fBmathfunc\fR manual page; the API described on -this page is not expected to be maintained indefinitely. -.SH SYNOPSIS -.nf -\fB#include \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 -Number of arguments to new function; also gives size of \fIargTypes\fR array. -.AP Tcl_ValueType *argTypes in -Points to an array giving the permissible types for each argument to -function. -.AP Tcl_MathProc *proc in -Procedure that implements the function. -.AP ClientData clientData in -Arbitrary one-word value to pass to \fIproc\fR when it is invoked. -.AP int *numArgsPtr out -Points to a variable that will be set to contain the number of -arguments to the function. -.AP Tcl_ValueType **argTypesPtr out -Points to a variable that will be set to contain a pointer to an array -giving the permissible types for each argument to the function which -will need to be freed up using \fITcl_Free\fR. -.AP Tcl_MathProc **procPtr out -Points to a variable that will be set to contain a pointer to the -implementation code for the function (or NULL if the function is -implemented directly in bytecode). -.AP ClientData *clientDataPtr out -Points to a variable that will be set to contain the clientData -argument passed to \fITcl_CreateMathFunc\fR when the function was -created if the function is not implemented directly in bytecode. -.AP "const char" *pattern in -Pattern to match against function names so as to filter them (by -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 does not 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: -.PP -.CS -typedef int \fBTcl_MathProc\fR( - 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: -.PP -.CS -typedef struct Tcl_Value { - Tcl_ValueType \fItype\fR; - long \fIintValue\fR; - double \fIdoubleValue\fR; - Tcl_WideInt \fIwideValue\fR; -} \fBTcl_Value\fR; -.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 value containing a list of all -the math functions defined in the interpreter whose name matches -\fIpattern\fR. The returned value has a reference count of zero. -.SH "SEE ALSO" -expr(n), info(n), Tcl_CreateObjCommand(3), Tcl_Free(3), Tcl_NewListObj(3) -.SH KEYWORDS -expression, mathematical function diff --git a/doc/CrtObjCmd.3 b/doc/CrtObjCmd.3 deleted file mode 100644 index 6714bd7..0000000 --- a/doc/CrtObjCmd.3 +++ /dev/null @@ -1,302 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_CreateObjCommand 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.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 -.nf -\fB#include \fR -.sp -Tcl_Command -\fBTcl_CreateObjCommand\fR(\fIinterp, cmdName, proc, clientData, deleteProc\fR) -.sp -int -\fBTcl_DeleteCommand\fR(\fIinterp, cmdName\fR) -.sp -int -\fBTcl_DeleteCommandFromToken\fR(\fIinterp, token\fR) -.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) -.SH ARGUMENTS -.AS Tcl_CmdDeleteProc *deleteProc in/out -.AP Tcl_Interp *interp in -Interpreter in which to create a new command or that contains a command. -.AP char *cmdName in -Name of command. -.AP Tcl_ObjCmdProc *proc in -Implementation of the new command: \fIproc\fR will be called whenever -\fIcmdName\fR is invoked as a command. -.AP ClientData clientData in -Arbitrary one-word value to pass to \fIproc\fR and \fIdeleteProc\fR. -.AP Tcl_CmdDeleteProc *deleteProc in -Procedure to call before \fIcmdName\fR is deleted from the interpreter; -allows for command-specific cleanup. If NULL, then no procedure is -called before the command is deleted. -.AP Tcl_Command token in -Token for command, returned by previous call to \fBTcl_CreateObjCommand\fR. -The command must not have been deleted. -.AP Tcl_CmdInfo *infoPtr in/out -Pointer to structure containing various information about a -Tcl command. -.AP Tcl_Obj *objPtr in -Value containing the name of a Tcl command. -.BE -.SH DESCRIPTION -.PP -\fBTcl_CreateObjCommand\fR defines a new command in \fIinterp\fR -and associates it with procedure \fIproc\fR -such that whenever \fIname\fR is -invoked as a Tcl command (e.g., via a call to \fBTcl_EvalObjEx\fR) -the Tcl interpreter will call \fIproc\fR to process the command. -.PP -\fBTcl_CreateObjCommand\fR deletes any existing command -\fIname\fR already associated with the interpreter -(however see below for an exception where the existing command -is not deleted). -It returns a token that may be used to refer -to the command in subsequent calls to \fBTcl_GetCommandName\fR. -If \fIname\fR contains any \fB::\fR namespace qualifiers, -then the command is added to the specified namespace; -otherwise the command is added to the global namespace. -If \fBTcl_CreateObjCommand\fR is called for an interpreter that is in -the process of being deleted, then it does not create a new command -and it returns NULL. -\fIproc\fR should have arguments and result that match the type -\fBTcl_ObjCmdProc\fR: -.PP -.CS -typedef int \fBTcl_ObjCmdProc\fR( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR, - int \fIobjc\fR, - Tcl_Obj *const \fIobjv\fR[]); -.CE -.PP -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 -arguments to the command, \fIobjc\fR giving the number of argument values -(including the command name) and \fIobjv\fR giving the values of the -arguments. The \fIobjv\fR array will contain \fIobjc\fR values, pointing to -the argument values. Unlike \fIargv\fR[\fIargv\fR] used in a -string-based command procedure, \fIobjv\fR[\fIobjc\fR] will not contain NULL. -.PP -Additionally, when \fIproc\fR is invoked, it must not modify the contents -of the \fIobjv\fR array by assigning new pointer values to any element of the -array (for example, \fIobjv\fR[\fB2\fR] = \fBNULL\fR) because this will -cause memory to be lost and the runtime stack to be corrupted. The -\fBconst\fR in the declaration of \fIobjv\fR will cause ANSI-compliant -compilers to report any such attempted assignment as an error. However, -it is acceptable to modify the internal representation of any individual -value argument. For instance, the user may call -\fBTcl_GetIntFromObj\fR on \fIobjv\fR[\fB2\fR] to obtain the integer -representation of that value; that call may change the type of the value -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, -it can call \fBTcl_SetObjResult\fR to set the interpreter's result. -In the case of a \fBTCL_OK\fR return code this gives the result -of the command, -and in the case of \fBTCL_ERROR\fR this gives an error message. -Before invoking a command procedure, -\fBTcl_EvalObjEx\fR sets interpreter's result to -point to a value representing an empty string, so simple -commands can return an empty result by doing nothing at all. -.PP -The contents of the \fIobjv\fR array belong to Tcl and are not -guaranteed to persist once \fIproc\fR returns: \fIproc\fR should -not modify them. -Call \fBTcl_SetObjResult\fR if you want -to return something from the \fIobjv\fR array. -.PP -Ordinarily, \fBTcl_CreateObjCommand\fR deletes any existing command -\fIname\fR already associated with the interpreter. -However, if the existing command was created by a previous call to -\fBTcl_CreateCommand\fR, -\fBTcl_CreateObjCommand\fR does not delete the command -but instead arranges for the Tcl interpreter to call the -\fBTcl_ObjCmdProc\fR \fIproc\fR in the future. -The old string-based \fBTcl_CmdProc\fR associated with the command -is retained and its address can be obtained by subsequent -\fBTcl_GetCommandInfo\fR calls. This is done for backwards compatibility. -.PP -\fIDeleteProc\fR will be invoked when (if) \fIname\fR is deleted. -This can occur through a call to \fBTcl_DeleteCommand\fR, -\fBTcl_DeleteCommandFromToken\fR, or \fBTcl_DeleteInterp\fR, -or by replacing \fIname\fR in another call to \fBTcl_CreateObjCommand\fR. -\fIDeleteProc\fR is invoked before the command is deleted, and gives the -application an opportunity to release any structures associated -with the command. \fIDeleteProc\fR should have arguments and -result that match the type \fBTcl_CmdDeleteProc\fR: -.PP -.CS -typedef void \fBTcl_CmdDeleteProc\fR( - ClientData \fIclientData\fR); -.CE -.PP -The \fIclientData\fR argument will be the same as the \fIclientData\fR -argument passed to \fBTcl_CreateObjCommand\fR. -.PP -\fBTcl_DeleteCommand\fR deletes a command from a command interpreter. -Once the call completes, attempts to invoke \fIcmdName\fR in -\fIinterp\fR will result in errors. -If \fIcmdName\fR is not bound as a command in \fIinterp\fR then -\fBTcl_DeleteCommand\fR does nothing and returns -1; otherwise -it returns 0. -There are no restrictions on \fIcmdName\fR: it may refer to -a built-in command, an application-specific command, or a Tcl procedure. -If \fIname\fR contains any \fB::\fR namespace qualifiers, -the command is deleted from the specified namespace. -.PP -Given a token returned by \fBTcl_CreateObjCommand\fR, -\fBTcl_DeleteCommandFromToken\fR deletes the command -from a command interpreter. -It will delete a command even if that command has been renamed. -Once the call completes, attempts to invoke the command in -\fIinterp\fR will result in errors. -If the command corresponding to \fItoken\fR -has already been deleted from \fIinterp\fR then -\fBTcl_DeleteCommand\fR does nothing and returns -1; -otherwise it returns 0. -.PP -\fBTcl_GetCommandInfo\fR checks to see whether its \fIcmdName\fR argument -exists as a command in \fIinterp\fR. -\fIcmdName\fR may include \fB::\fR namespace qualifiers -to identify a command in a particular namespace. -If the command is not found, then it returns 0. -Otherwise it places information about the command -in the \fBTcl_CmdInfo\fR structure -pointed to by \fIinfoPtr\fR and returns 1. -A \fBTcl_CmdInfo\fR structure has the following fields: -.PP -.CS -typedef struct Tcl_CmdInfo { - int \fIisNativeObjectProc\fR; - Tcl_ObjCmdProc *\fIobjProc\fR; - ClientData \fIobjClientData\fR; - Tcl_CmdProc *\fIproc\fR; - ClientData \fIclientData\fR; - Tcl_CmdDeleteProc *\fIdeleteProc\fR; - ClientData \fIdeleteData\fR; - Tcl_Namespace *\fInamespacePtr\fR; -} \fBTcl_CmdInfo\fR; -.CE -.PP -The \fIisNativeObjectProc\fR field has the value 1 -if \fBTcl_CreateObjCommand\fR was called to register the command; -it is 0 if only \fBTcl_CreateCommand\fR was called. -It allows a program to determine whether it is faster to -call \fIobjProc\fR or \fIproc\fR: -\fIobjProc\fR is normally faster -if \fIisNativeObjectProc\fR has the value 1. -The fields \fIobjProc\fR and \fIobjClientData\fR -have the same meaning as the \fIproc\fR and \fIclientData\fR -arguments to \fBTcl_CreateObjCommand\fR; -they hold information about the value-based command procedure -that the Tcl interpreter calls to implement the command. -The fields \fIproc\fR and \fIclientData\fR -hold information about the string-based command procedure -that implements the command. -If \fBTcl_CreateCommand\fR was called for this command, -this is the procedure passed to it; -otherwise, this is a compatibility procedure -registered by \fBTcl_CreateObjCommand\fR -that simply calls the command's -value-based procedure after converting its string arguments to Tcl values. -The field \fIdeleteData\fR is the ClientData value -to pass to \fIdeleteProc\fR; it is normally the same as -\fIclientData\fR but may be set independently using the -\fBTcl_SetCommandInfo\fR procedure. -The field \fInamespacePtr\fR holds a pointer to the -Tcl_Namespace that contains the command. -.PP -\fBTcl_GetCommandInfoFromToken\fR is identical to -\fBTcl_GetCommandInfo\fR except that it uses a command token returned -from \fBTcl_CreateObjCommand\fR in place of the command name. If the -\fItoken\fR parameter is NULL, it returns 0; otherwise, it returns 1 -and fills in the structure designated by \fIinfoPtr\fR. -.PP -\fBTcl_SetCommandInfo\fR is used to modify the procedures and -ClientData values associated with a command. -Its \fIcmdName\fR argument is the name of a command in \fIinterp\fR. -\fIcmdName\fR may include \fB::\fR namespace qualifiers -to identify a command in a particular namespace. -If this command does not exist then \fBTcl_SetCommandInfo\fR returns 0. -Otherwise, it copies the information from \fI*infoPtr\fR to -Tcl's internal structure for the command and returns 1. -.PP -\fBTcl_SetCommandInfoFromToken\fR is identical to -\fBTcl_SetCommandInfo\fR except that it takes a command token as -returned by \fBTcl_CreateObjCommand\fR instead of the command name. -If the \fItoken\fR parameter is NULL, it returns 0. Otherwise, it -copies the information from \fI*infoPtr\fR to Tcl's internal structure -for the command and returns 1. -.PP -Note that \fBTcl_SetCommandInfo\fR and -\fBTcl_SetCommandInfoFromToken\fR both allow the ClientData for a -command's deletion procedure to be given a different value than the -ClientData for its command procedure. -.PP -Note that neither \fBTcl_SetCommandInfo\fR nor -\fBTcl_SetCommandInfoFromToken\fR will change a command's namespace. -Use \fBTcl_Eval\fR to call the \fBrename\fR command to do that. -.PP -\fBTcl_GetCommandName\fR provides a mechanism for tracking commands -that have been renamed. -Given a token returned by \fBTcl_CreateObjCommand\fR -when the command was created, \fBTcl_GetCommandName\fR returns the -string name of the command. If the command has been renamed since it -was created, then \fBTcl_GetCommandName\fR returns the current name. -This name does not include any \fB::\fR namespace qualifiers. -The command corresponding to \fItoken\fR must not have been deleted. -The string returned by \fBTcl_GetCommandName\fR is in dynamic memory -owned by Tcl and is only guaranteed to retain its value as long as the -command is not deleted or renamed; callers should copy the string if -they need to keep it for a long time. -.PP -\fBTcl_GetCommandFullName\fR produces the fully qualified name -of a command from a command token. -The name, including all namespace prefixes, -is appended to the value specified by \fIobjPtr\fR. -.PP -\fBTcl_GetCommandFromObj\fR returns a token for the command -specified by the name in a \fBTcl_Obj\fR. -The command name is resolved relative to the current namespace. -Returns NULL if the command is not found. -.SH "SEE ALSO" -Tcl_CreateCommand(3), Tcl_ResetResult(3), Tcl_SetObjResult(3) -.SH KEYWORDS -bind, command, create, delete, namespace, value diff --git a/doc/CrtSlave.3 b/doc/CrtSlave.3 deleted file mode 100644 index ac681bc..0000000 --- a/doc/CrtSlave.3 +++ /dev/null @@ -1,236 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_CreateSlave 3 7.6 Tcl "Tcl Library Procedures" -.so man.macros -.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 -.nf -\fB#include \fR -.sp -int -\fBTcl_IsSafe\fR(\fIinterp\fR) -.sp -int -\fBTcl_MakeSafe\fR(\fIinterp\fR) -.sp -Tcl_Interp * -\fBTcl_CreateSlave\fR(\fIinterp, slaveName, isSafe\fR) -.sp -Tcl_Interp * -\fBTcl_GetSlave\fR(\fIinterp, slaveName\fR) -.sp -Tcl_Interp * -\fBTcl_GetMaster\fR(\fIinterp\fR) -.sp -int -\fBTcl_GetInterpPath\fR(\fIaskingInterp, slaveInterp\fR) -.sp -int -\fBTcl_CreateAlias\fR(\fIslaveInterp, slaveCmd, targetInterp, targetCmd, - argc, argv\fR) -.sp -int -\fBTcl_CreateAliasObj\fR(\fIslaveInterp, slaveCmd, targetInterp, targetCmd, - objc, objv\fR) -.sp -int -\fBTcl_GetAlias\fR(\fIinterp, slaveCmd, targetInterpPtr, targetCmdPtr, - argcPtr, argvPtr\fR) -.sp -int -\fBTcl_GetAliasObj\fR(\fIinterp, slaveCmd, targetInterpPtr, targetCmdPtr, - objcPtr, objvPtr\fR) -.sp -int -\fBTcl_ExposeCommand\fR(\fIinterp, hiddenCmdName, cmdName\fR) -.sp -int -\fBTcl_HideCommand\fR(\fIinterp, cmdName, hiddenCmdName\fR) -.SH ARGUMENTS -.AS "const char *const" **targetInterpPtr out -.AP Tcl_Interp *interp in -Interpreter in which to execute the specified command. -.AP "const char" *slaveName in -Name of slave interpreter to create or manipulate. -.AP int isSafe in -If non-zero, a -.QW safe -slave that is suitable for running untrusted code -is created, otherwise a trusted slave is created. -.AP Tcl_Interp *slaveInterp in -Interpreter to use for creating the source command for an alias (see -below). -.AP "const char" *slaveCmd in -Name of source command for alias. -.AP Tcl_Interp *targetInterp in -Interpreter that contains the target command for an alias. -.AP "const char" *targetCmd in -Name of target command for alias in \fItargetInterp\fR. -.AP int argc in -Count of additional arguments to pass to the alias command. -.AP "const char *const" *argv in -Vector of strings, the additional arguments to pass to the alias command. -This storage is owned by the caller. -.AP int objc in -Count of additional value arguments to pass to the aliased command. -.AP Tcl_Obj **objv in -Vector of Tcl_Obj structures, the additional value arguments to pass to -the aliased command. -This storage is owned by the caller. -.AP Tcl_Interp **targetInterpPtr in -Pointer to location to store the address of the interpreter where a target -command is defined for an alias. -.AP "const char" **targetCmdPtr out -Pointer to location to store the address of the name of the target command -for an alias. -.AP int *argcPtr out -Pointer to location to store count of additional arguments to be passed to -the alias. The location is in storage owned by the caller. -.AP "const char" ***argvPtr out -Pointer to location to store a vector of strings, the additional arguments -to pass to an alias. The location is in storage owned by the caller, the -vector of strings is owned by the called function. -.AP int *objcPtr out -Pointer to location to store count of additional value arguments to be -passed to the alias. The location is in storage owned by the caller. -.AP Tcl_Obj ***objvPtr out -Pointer to location to store a vector of Tcl_Obj structures, the additional -arguments to pass to an alias command. The location is in storage -owned by the caller, the vector of Tcl_Obj structures is owned by the -called function. -.AP "const char" *cmdName in -Name of an exposed command to hide or create. -.AP "const char" *hiddenCmdName in -Name under which a hidden command is stored and with which it can be -exposed or invoked. -.BE - -.SH DESCRIPTION -.PP -These procedures are intended for access to the multiple interpreter -facility from inside C programs. They enable managing multiple interpreters -in a hierarchical relationship, and the management of aliases, commands -that when invoked in one interpreter execute a command in another -interpreter. The return value for those procedures that return an \fBint\fR -is either \fBTCL_OK\fR or \fBTCL_ERROR\fR. If \fBTCL_ERROR\fR is returned -then the \fBresult\fR field of the interpreter contains an error message. -.PP -\fBTcl_CreateSlave\fR creates a new interpreter as a slave of \fIinterp\fR. -It also creates a slave command named \fIslaveName\fR in \fIinterp\fR which -allows \fIinterp\fR to manipulate the new slave. -If \fIisSafe\fR is zero, the command creates a trusted slave in which Tcl -code has access to all the Tcl commands. -If it is \fB1\fR, the command creates a -.QW safe -slave in which Tcl code has access only to set of Tcl commands defined as -.QW "Safe Tcl" ; -see the manual entry for the Tcl \fBinterp\fR command for details. -If the creation of the new slave interpreter failed, \fBNULL\fR is returned. -.PP -\fBTcl_IsSafe\fR returns \fB1\fR if \fIinterp\fR is -.QW safe -(was created with the \fBTCL_SAFE_INTERPRETER\fR flag specified), -\fB0\fR otherwise. -.PP -\fBTcl_MakeSafe\fR marks \fIinterp\fR as -.QW safe , -so that future -calls to \fBTcl_IsSafe\fR will return 1. It also removes all known -potentially-unsafe core functionality (both commands and variables) -from \fIinterp\fR. However, it cannot know what parts of an extension -or application are safe and does not make any attempt to remove those -parts, so safety is not guaranteed after calling \fBTcl_MakeSafe\fR. -Callers will want to take care with their use of \fBTcl_MakeSafe\fR -to avoid false claims of safety. For many situations, \fBTcl_CreateSlave\fR -may be a better choice, since it creates interpreters in a known-safe state. -.PP -\fBTcl_GetSlave\fR returns a pointer to a slave interpreter of -\fIinterp\fR. The slave interpreter is identified by \fIslaveName\fR. -If no such slave interpreter exists, \fBNULL\fR is returned. -.PP -\fBTcl_GetMaster\fR returns a pointer to the master interpreter of -\fIinterp\fR. If \fIinterp\fR has no master (it is a -top-level interpreter) then \fBNULL\fR is returned. -.PP -\fBTcl_GetInterpPath\fR sets the \fIresult\fR field in \fIaskingInterp\fR -to the relative path between \fIaskingInterp\fR and \fIslaveInterp\fR; -\fIslaveInterp\fR must be a slave of \fIaskingInterp\fR. If the computation -of the relative path succeeds, \fBTCL_OK\fR is returned, else -\fBTCL_ERROR\fR is returned and the \fIresult\fR field in -\fIaskingInterp\fR contains the error message. -.PP -\fBTcl_CreateAlias\fR creates a command named \fIslaveCmd\fR in -\fIslaveInterp\fR that when invoked, will cause the command \fItargetCmd\fR -to be invoked in \fItargetInterp\fR. The arguments specified by the strings -contained in \fIargv\fR are always prepended to any arguments supplied in the -invocation of \fIslaveCmd\fR and passed to \fItargetCmd\fR. -This operation returns \fBTCL_OK\fR if it succeeds, or \fBTCL_ERROR\fR if -it fails; in that case, an error message is left in the value result -of \fIslaveInterp\fR. -Note that there are no restrictions on the ancestry relationship (as -created by \fBTcl_CreateSlave\fR) between \fIslaveInterp\fR and -\fItargetInterp\fR. Any two interpreters can be used, without any -restrictions on how they are related. -.PP -\fBTcl_CreateAliasObj\fR is similar to \fBTcl_CreateAlias\fR except -that it takes a vector of values to pass as additional arguments instead -of a vector of strings. -.PP -\fBTcl_GetAlias\fR returns information about an alias \fIaliasName\fR -in \fIinterp\fR. Any of the result fields can be \fBNULL\fR, in -which case the corresponding datum is not returned. If a result field is -non\-\fBNULL\fR, the address indicated is set to the corresponding datum. -For example, if \fItargetNamePtr\fR is non\-\fBNULL\fR it is set to a -pointer to the string containing the name of the target command. -.PP -\fBTcl_GetAliasObj\fR is similar to \fBTcl_GetAlias\fR except that it -returns a pointer to a vector of Tcl_Obj structures instead of a vector of -strings. -.PP -\fBTcl_ExposeCommand\fR moves the command named \fIhiddenCmdName\fR from -the set of hidden commands to the set of exposed commands, putting -it under the name -\fIcmdName\fR. -\fIHiddenCmdName\fR must be the name of an existing hidden -command, or the operation will return \fBTCL_ERROR\fR and leave an error -message in the \fIresult\fR field in \fIinterp\fR. -If an exposed command named \fIcmdName\fR already exists, -the operation returns \fBTCL_ERROR\fR and leaves an error message in the -value result of \fIinterp\fR. -If the operation succeeds, it returns \fBTCL_OK\fR. -After executing this command, attempts to use \fIcmdName\fR in a call to -\fBTcl_Eval\fR or with the Tcl \fBeval\fR command will again succeed. -.PP -\fBTcl_HideCommand\fR moves the command named \fIcmdName\fR from the set of -exposed commands to the set of hidden commands, under the name -\fIhiddenCmdName\fR. -\fICmdName\fR must be the name of an existing exposed -command, or the operation will return \fBTCL_ERROR\fR and leave an error -message in the value result of \fIinterp\fR. -Currently both \fIcmdName\fR and \fIhiddenCmdName\fR must not contain -namespace qualifiers, or the operation will return \fBTCL_ERROR\fR and -leave an error message in the value result of \fIinterp\fR. -The \fICmdName\fR will be looked up in the global namespace, and not -relative to the current namespace, even if the current namespace is not the -global one. -If a hidden command whose name is \fIhiddenCmdName\fR already -exists, the operation also returns \fBTCL_ERROR\fR and the \fIresult\fR -field in \fIinterp\fR contains an error message. -If the operation succeeds, it returns \fBTCL_OK\fR. -After executing this command, attempts to use \fIcmdName\fR in a call to -\fBTcl_Eval\fR or with the Tcl \fBeval\fR command will fail. -.PP -For a description of the Tcl interface to multiple interpreters, see -\fIinterp(n)\fR. -.SH "SEE ALSO" -interp - -.SH KEYWORDS -alias, command, exposed commands, hidden commands, interpreter, invoke, -master, slave diff --git a/doc/CrtTimerHdlr.3 b/doc/CrtTimerHdlr.3 deleted file mode 100644 index c229a23..0000000 --- a/doc/CrtTimerHdlr.3 +++ /dev/null @@ -1,76 +0,0 @@ -'\" -'\" Copyright (c) 1990 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. -'\" -.TH Tcl_CreateTimerHandler 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_CreateTimerHandler, Tcl_DeleteTimerHandler \- call a procedure at a given time -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_TimerToken -\fBTcl_CreateTimerHandler\fR(\fImilliseconds, proc, clientData\fR) -.sp -\fBTcl_DeleteTimerHandler\fR(\fItoken\fR) -.SH ARGUMENTS -.AS Tcl_TimerToken milliseconds -.AP int milliseconds in -How many milliseconds to wait before invoking \fIproc\fR. -.AP Tcl_TimerProc *proc in -Procedure to invoke after \fImilliseconds\fR have elapsed. -.AP ClientData clientData in -Arbitrary one-word value to pass to \fIproc\fR. -.AP Tcl_TimerToken token in -Token for previously created timer handler (the return value -from some previous call to \fBTcl_CreateTimerHandler\fR). -.BE -.SH DESCRIPTION -.PP -\fBTcl_CreateTimerHandler\fR arranges for \fIproc\fR to be -invoked at a time \fImilliseconds\fR milliseconds in the -future. -The callback to \fIproc\fR will be made by \fBTcl_DoOneEvent\fR, -so \fBTcl_CreateTimerHandler\fR is only useful in programs that -dispatch events through \fBTcl_DoOneEvent\fR or through Tcl commands -such as \fBvwait\fR. -The call to \fIproc\fR may not be made at the exact time given by -\fImilliseconds\fR: it will be made at the next opportunity -after that time. For example, if \fBTcl_DoOneEvent\fR is not -called until long after the time has elapsed, or if there -are other pending events to process before the call to -\fIproc\fR, then the call to \fIproc\fR will be delayed. -.PP -\fIProc\fR should have arguments and return value that match -the type \fBTcl_TimerProc\fR: -.PP -.CS -typedef void \fBTcl_TimerProc\fR( - ClientData \fIclientData\fR); -.CE -.PP -The \fIclientData\fR parameter to \fIproc\fR is a -copy of the \fIclientData\fR argument given to -\fBTcl_CreateTimerHandler\fR when the callback -was created. Typically, \fIclientData\fR points to a data -structure containing application-specific information about -what to do in \fIproc\fR. -.PP -\fBTcl_DeleteTimerHandler\fR may be called to delete a -previously created timer handler. It deletes the handler -indicated by \fItoken\fR so that no call to \fIproc\fR -will be made; if that handler no longer exists -(e.g. because the time period has already elapsed and \fIproc\fR -has been invoked then \fBTcl_DeleteTimerHandler\fR does nothing. -The tokens returned by \fBTcl_CreateTimerHandler\fR never have -a value of NULL, so if NULL is passed to \fBTcl_DeleteTimerHandler\fR -then the procedure does nothing. -.SH "SEE ALSO" -after(n), Tcl_CreateFileHandler(3), Tcl_DoWhenIdle(3) -.SH KEYWORDS -callback, clock, handler, timer diff --git a/doc/CrtTrace.3 b/doc/CrtTrace.3 deleted file mode 100644 index d5353ac..0000000 --- a/doc/CrtTrace.3 +++ /dev/null @@ -1,191 +0,0 @@ -'\" -'\" Copyright (c) 1989-1993 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. -'\" 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. -'\" -.TH Tcl_CreateTrace 3 "" Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_CreateTrace, Tcl_CreateObjTrace, Tcl_DeleteTrace \- arrange for command execution to be traced -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Trace -\fBTcl_CreateTrace\fR(\fIinterp, level, proc, clientData\fR) -.sp -Tcl_Trace -\fBTcl_CreateObjTrace\fR(\fIinterp, level, flags, objProc, clientData, deleteProc\fR) -.sp -\fBTcl_DeleteTrace\fR(\fIinterp, trace\fR) -.SH ARGUMENTS -.AS Tcl_CmdObjTraceDeleteProc *deleteProc -.AP Tcl_Interp *interp in -Interpreter containing command to be traced or untraced. -.AP int level in -Only commands at or below this nesting level will be traced unless -0 is specified. 1 means -top-level commands only, 2 means top-level commands or those that are -invoked as immediate consequences of executing top-level commands -(procedure bodies, bracketed commands, etc.) and so on. -A value of 0 means that commands at any level are traced. -.AP int flags in -Flags governing the trace execution. See below for details. -.AP Tcl_CmdObjTraceProc *objProc in -Procedure to call for each command that is executed. See below for -details of the calling sequence. -.AP Tcl_CmdTraceProc *proc in -Procedure to call for each command that is executed. See below for -details on the calling sequence. -.AP ClientData clientData in -Arbitrary one-word value to pass to \fIobjProc\fR or \fIproc\fR. -.AP Tcl_CmdObjTraceDeleteProc *deleteProc in -Procedure to call when the trace is deleted. See below for details of -the calling sequence. A NULL pointer is permissible and results in no -callback when the trace is deleted. -.AP Tcl_Trace trace in -Token for trace to be removed (return value from previous call -to \fBTcl_CreateTrace\fR). -.BE -.SH DESCRIPTION -.PP -\fBTcl_CreateObjTrace\fR arranges for command tracing. After it is -called, \fIobjProc\fR will be invoked before the Tcl interpreter calls -any command procedure when evaluating commands in \fIinterp\fR. -The return value from \fBTcl_CreateObjTrace\fR is a token for the trace, -which may be passed to \fBTcl_DeleteTrace\fR to remove the trace. -There may be many traces in effect simultaneously for the same -interpreter. -.PP -\fIobjProc\fR should have arguments and result that match the type, -\fBTcl_CmdObjTraceProc\fR: -.PP -.CS -typedef int \fBTcl_CmdObjTraceProc\fR( - \fBClientData\fR \fIclientData\fR, - \fBTcl_Interp\fR* \fIinterp\fR, - int \fIlevel\fR, - const char *\fIcommand\fR, - \fBTcl_Command\fR \fIcommandToken\fR, - int \fIobjc\fR, - \fBTcl_Obj\fR *const \fIobjv\fR[]); -.CE -.PP -The \fIclientData\fR and \fIinterp\fR parameters are copies of the -corresponding arguments given to \fBTcl_CreateTrace\fR. -\fIClientData\fR typically points to an application-specific data -structure that describes what to do when \fIobjProc\fR is invoked. The -\fIlevel\fR parameter gives the nesting level of the command (1 for -top-level commands passed to \fBTcl_Eval\fR by the application, 2 for -the next-level commands passed to \fBTcl_Eval\fR as part of parsing or -interpreting level-1 commands, and so on). The \fIcommand\fR parameter -points to a string containing the text of the command, before any -argument substitution. The \fIcommandToken\fR parameter is a Tcl -command token that identifies the command to be invoked. The token -may be passed to \fBTcl_GetCommandName\fR, -\fBTcl_GetCommandInfoFromToken\fR, or \fBTcl_SetCommandInfoFromToken\fR to -manipulate the definition of the command. The \fIobjc\fR and \fIobjv\fR -parameters designate the final parameter count and parameter vector -that will be passed to the command, and have had all substitutions -performed. -.PP -The \fIobjProc\fR callback is expected to return a standard Tcl status -return code. If this code is \fBTCL_OK\fR (the normal case), then -the Tcl interpreter will invoke the command. Any other return code -is treated as if the command returned that status, and the command is -\fInot\fR invoked. -.PP -The \fIobjProc\fR callback must not modify \fIobjv\fR in any way. It -is, however, permissible to change the command by calling -\fBTcl_SetCommandTokenInfo\fR prior to returning. Any such change -takes effect immediately, and the command is invoked with the new -information. -.PP -Tracing will only occur for commands at nesting level less than -or equal to the \fIlevel\fR parameter (i.e. the \fIlevel\fR -parameter to \fIobjProc\fR will always be less than or equal to the -\fIlevel\fR parameter to \fBTcl_CreateTrace\fR). -.PP -Tracing has a significant effect on runtime performance because it -causes the bytecode compiler to refrain from generating in-line code -for Tcl commands such as \fBif\fR and \fBwhile\fR in order that they -may be traced. If traces for the built-in commands are not required, -the \fIflags\fR parameter may be set to the constant value -\fBTCL_ALLOW_INLINE_COMPILATION\fR. In this case, traces on built-in -commands may or may not result in trace callbacks, depending on the -state of the interpreter, but run-time performance will be improved -significantly. (This functionality is desirable, for example, when -using \fBTcl_CreateObjTrace\fR to implement an execution time -profiler.) -.PP -Calls to \fIobjProc\fR will be made by the Tcl parser immediately before -it calls the command procedure for the command (\fIcmdProc\fR). This -occurs after argument parsing and substitution, so tracing for -substituted commands occurs before tracing of the commands -containing the substitutions. If there is a syntax error in a -command, or if there is no command procedure associated with a -command name, then no tracing will occur for that command. If a -string passed to Tcl_Eval contains multiple commands (bracketed, or -on different lines) then multiple calls to \fIobjProc\fR will occur, -one for each command. -.PP -\fBTcl_DeleteTrace\fR removes a trace, so that no future calls will be -made to the procedure associated with the trace. After \fBTcl_DeleteTrace\fR -returns, the caller should never again use the \fItrace\fR token. -.PP -When \fBTcl_DeleteTrace\fR is called, the interpreter invokes the -\fIdeleteProc\fR that was passed as a parameter to -\fBTcl_CreateObjTrace\fR. The \fIdeleteProc\fR must match the type, -\fBTcl_CmdObjTraceDeleteProc\fR: -.PP -.CS -typedef void \fBTcl_CmdObjTraceDeleteProc\fR( - \fBClientData\fR \fIclientData\fR); -.CE -.PP -The \fIclientData\fR parameter will be the same as the -\fIclientData\fR parameter that was originally passed to -\fBTcl_CreateObjTrace\fR. -.PP -\fBTcl_CreateTrace\fR is an alternative interface for command tracing, -\fInot recommended for new applications\fR. It is provided for backward -compatibility with code that was developed for older versions of the -Tcl interpreter. It is similar to \fBTcl_CreateObjTrace\fR, except -that its \fIproc\fR parameter should have arguments and result that -match the type \fBTcl_CmdTraceProc\fR: -.PP -.CS -typedef void \fBTcl_CmdTraceProc\fR( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR, - int \fIlevel\fR, - char *\fIcommand\fR, - Tcl_CmdProc *\fIcmdProc\fR, - ClientData \fIcmdClientData\fR, - int \fIargc\fR, - const char *\fIargv\fR[]); -.CE -.PP -The parameters to the \fIproc\fR callback are similar to those of the -\fIobjProc\fR callback above. The \fIcommandToken\fR is -replaced with \fIcmdProc\fR, a pointer to the (string-based) command -procedure that will be invoked; and \fIcmdClientData\fR, the client -data that will be passed to the procedure. The \fIobjc\fR parameter -is replaced with an \fIargv\fR parameter, that gives the arguments to -the command as character strings. -\fIProc\fR must not modify the \fIcommand\fR or \fIargv\fR strings. -.PP -If a trace created with \fBTcl_CreateTrace\fR is in effect, inline -compilation of Tcl commands such as \fBif\fR and \fBwhile\fR is always -disabled. There is no notification when a trace created with -\fBTcl_CreateTrace\fR is deleted. -There is no way to be notified when the trace created by -\fBTcl_CreateTrace\fR is deleted. There is no way for the \fIproc\fR -associated with a call to \fBTcl_CreateTrace\fR to abort execution of -\fIcommand\fR. -.SH KEYWORDS -command, create, delete, interpreter, trace diff --git a/doc/DString.3 b/doc/DString.3 deleted file mode 100644 index 00f1b8a..0000000 --- a/doc/DString.3 +++ /dev/null @@ -1,153 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_DString 3 7.4 Tcl "Tcl Library Procedures" -.so man.macros -.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 \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) -.sp -char * -\fBTcl_DStringValue\fR(\fIdsPtr\fR) -.sp -\fBTcl_DStringSetLength\fR(\fIdsPtr, newLength\fR) -.sp -\fBTcl_DStringTrunc\fR(\fIdsPtr, newLength\fR) -.sp -\fBTcl_DStringFree\fR(\fIdsPtr\fR) -.sp -\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. -.BE - -.SH DESCRIPTION -.PP -Dynamic strings provide a mechanism for building up arbitrarily long -strings by gradually appending information. If the dynamic string is -short then there will be no memory allocation overhead; as the string -gets larger, additional space will be allocated as needed. -.PP -\fBTcl_DStringInit\fR initializes a dynamic string to zero length. -The Tcl_DString structure must have been allocated by the caller. -No assumptions are made about the current state of the structure; -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 does not 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 -.QW { , -or the last two characters of the current string are -.QW " {" ). -\fBTcl_DStringAppendElement\fR returns a pointer to the -characters of the new string. -.PP -\fBTcl_DStringStartSublist\fR and \fBTcl_DStringEndSublist\fR can be -used to create nested lists. -To append a list element that is itself a sublist, first -call \fBTcl_DStringStartSublist\fR, then call \fBTcl_DStringAppendElement\fR -for each of the elements in the sublist, then call -\fBTcl_DStringEndSublist\fR to end the sublist. -\fBTcl_DStringStartSublist\fR appends a space character if needed, -followed by an open brace; \fBTcl_DStringEndSublist\fR appends -a close brace. -Lists can be nested to any depth. -.PP -\fBTcl_DStringLength\fR is a macro that returns the current length -of a dynamic string (not including the terminating null character). -\fBTcl_DStringValue\fR is a macro that returns a pointer to the -current contents of a dynamic string. -.PP -.PP -\fBTcl_DStringSetLength\fR changes the length of a dynamic string. -If \fInewLength\fR is less than the string's current length, then -the string is truncated. -If \fInewLength\fR is greater than the string's current length, -then the string will become longer and new space will be allocated -for the string if needed. -However, \fBTcl_DStringSetLength\fR will not initialize the new -space except to provide a terminating null character; it is up to the -caller to fill in the new space. -\fBTcl_DStringSetLength\fR does not free up the string's storage space -even if the string is truncated to zero length, so \fBTcl_DStringFree\fR -will still need to be called. -.PP -\fBTcl_DStringTrunc\fR changes the length of a dynamic string. -This procedure is now deprecated. \fBTcl_DStringSetLength\fR should -be used instead. -.PP -\fBTcl_DStringFree\fR should be called when you are finished using -the string. It frees up any memory that was allocated for the string -and reinitializes the string's value to an empty string. -.PP -\fBTcl_DStringResult\fR sets the result of \fIinterp\fR to the value of -the dynamic string given by \fIdsPtr\fR. It does this by moving -a pointer from \fIdsPtr\fR to the interpreter's result. -This saves the cost of allocating new memory and copying the string. -\fBTcl_DStringResult\fR also reinitializes the dynamic string to -an empty string. -.PP -\fBTcl_DStringGetResult\fR does the opposite of \fBTcl_DStringResult\fR. -It sets the value of \fIdsPtr\fR to the result of \fIinterp\fR and -it clears \fIinterp\fR's result. -If possible it does this by moving a pointer rather than by copying -the string. - -.SH KEYWORDS -append, dynamic string, free, result diff --git a/doc/DetachPids.3 b/doc/DetachPids.3 deleted file mode 100644 index 26075c3..0000000 --- a/doc/DetachPids.3 +++ /dev/null @@ -1,75 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_DetachPids 3 "" Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_DetachPids, Tcl_ReapDetachedProcs, Tcl_WaitPid \- manage child processes in background -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_DetachPids\fR(\fInumPids, pidPtr\fR) -.sp -\fBTcl_ReapDetachedProcs\fR() -.sp -Tcl_Pid -\fBTcl_WaitPid\fR(\fIpid, statusPtr, options\fR) -.SH ARGUMENTS -.AS Tcl_Pid *statusPtr out -.AP int numPids in -Number of process ids contained in the array pointed to by \fIpidPtr\fR. -.AP int *pidPtr in -Address of array containing \fInumPids\fR process ids. -.AP Tcl_Pid pid in -The id of the process (pipe) to wait for. -.AP int *statusPtr out -The result of waiting on a process (pipe). Either 0 or ECHILD. -.AP int options in -The options controlling the wait. WNOHANG specifies not to wait when -checking the process. -.BE -.SH DESCRIPTION -.PP -\fBTcl_DetachPids\fR and \fBTcl_ReapDetachedProcs\fR provide a -mechanism for managing subprocesses that are running in background. -These procedures are needed because the parent of a process must -eventually invoke the \fBwaitpid\fR kernel call (or one of a few other -similar kernel calls) to wait for the child to exit. Until the -parent waits for the child, the child's state cannot be completely -reclaimed by the system. If a parent continually creates children -and doesn't wait on them, the system's process table will eventually -overflow, even if all the children have exited. -.PP -\fBTcl_DetachPids\fR may be called to ask Tcl to take responsibility -for one or more processes whose process ids are contained in the -\fIpidPtr\fR array passed as argument. The caller presumably -has started these processes running in background and does not -want to have to deal with them again. -.PP -\fBTcl_ReapDetachedProcs\fR invokes the \fBwaitpid\fR kernel call -on each of the background processes so that its state can be cleaned -up if it has exited. If the process has not exited yet, -\fBTcl_ReapDetachedProcs\fR does not wait for it to exit; it will check again -the next time it is invoked. -Tcl automatically calls \fBTcl_ReapDetachedProcs\fR each time the -\fBexec\fR command is executed, so in most cases it is not necessary -for any code outside of Tcl to invoke \fBTcl_ReapDetachedProcs\fR. -However, if you call \fBTcl_DetachPids\fR in situations where the -\fBexec\fR command may never get executed, you may wish to call -\fBTcl_ReapDetachedProcs\fR from time to time so that background -processes can be cleaned up. -.PP -\fBTcl_WaitPid\fR is a thin wrapper around the facilities provided by -the operating system to wait on the end of a spawned process and to -check a whether spawned process is still running. It is used by -\fBTcl_ReapDetachedProcs\fR and the channel system to portably access -the operating system. - -.SH KEYWORDS -background, child, detach, process, wait diff --git a/doc/DictObj.3 b/doc/DictObj.3 deleted file mode 100644 index 2c111c4..0000000 --- a/doc/DictObj.3 +++ /dev/null @@ -1,234 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_DictObj 3 8.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_NewDictObj, Tcl_DictObjPut, Tcl_DictObjGet, Tcl_DictObjRemove, Tcl_DictObjSize, Tcl_DictObjFirst, Tcl_DictObjNext, Tcl_DictObjDone, Tcl_DictObjPutKeyList, Tcl_DictObjRemoveKeyList \- manipulate Tcl values as dictionaries -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Obj * -\fBTcl_NewDictObj\fR() -.sp -int -\fBTcl_DictObjGet\fR(\fIinterp, dictPtr, keyPtr, valuePtrPtr\fR) -.sp -int -\fBTcl_DictObjPut\fR(\fIinterp, dictPtr, keyPtr, valuePtr\fR) -.sp -int -\fBTcl_DictObjRemove\fR(\fIinterp, dictPtr, keyPtr\fR) -.sp -int -\fBTcl_DictObjSize\fR(\fIinterp, dictPtr, sizePtr\fR) -.sp -int -\fBTcl_DictObjFirst\fR(\fIinterp, dictPtr, searchPtr, - keyPtrPtr, valuePtrPtr, donePtr\fR) -.sp -void -\fBTcl_DictObjNext\fR(\fIsearchPtr, keyPtrPtr, valuePtrPtr, donePtr\fR) -.sp -void -\fBTcl_DictObjDone\fR(\fIsearchPtr\fR) -.sp -int -\fBTcl_DictObjPutKeyList\fR(\fIinterp, dictPtr, keyc, keyv, valuePtr\fR) -.sp -int -\fBTcl_DictObjRemoveKeyList\fR(\fIinterp, dictPtr, keyc, keyv\fR) -.SH ARGUMENTS -.AS Tcl_DictSearch "**valuePtrPtr" in/out -.AP Tcl_Interp *interp in -If an error occurs while converting a value to be a dictionary value, -an error message is left in the interpreter's result value -unless \fIinterp\fR is NULL. -.AP Tcl_Obj *dictPtr in/out -Points to the dictionary value to be manipulated. -If \fIdictPtr\fR does not already point to a dictionary value, -an attempt will be made to convert it to one. -.AP Tcl_Obj *keyPtr in -Points to the key for the key/value pair being manipulated within the -dictionary value. -.AP Tcl_Obj **keyPtrPtr out -Points to a variable that will have the key from a key/value pair -placed within it. May be NULL to indicate that the caller is not -interested in the key. -.AP Tcl_Obj *valuePtr in -Points to the value for the key/value pair being manipulated within the -dictionary value (or sub-value, in the case of -\fBTcl_DictObjPutKeyList\fR.) -.AP Tcl_Obj **valuePtrPtr out -Points to a variable that will have the value from a key/value pair -placed within it. For \fBTcl_DictObjFirst\fR and -\fBTcl_DictObjNext\fR, this may be NULL to indicate that the caller is -not interested in the value. -.AP int *sizePtr out -Points to a variable that will have the number of key/value pairs -contained within the dictionary placed within it. -.AP Tcl_DictSearch *searchPtr in/out -Pointer to record to use to keep track of progress in enumerating all -key/value pairs in a dictionary. The contents of the record will be -initialized by the call to \fBTcl_DictObjFirst\fR. If the enumerating -is to be terminated before all values in the dictionary have been -returned, the search record \fImust\fR be passed to -\fBTcl_DictObjDone\fR to enable the internal locks to be released. -.AP int *donePtr out -Points to a variable that will have a non-zero value written into it -when the enumeration of the key/value pairs in a dictionary has -completed, and a zero otherwise. -.AP int keyc in -Indicates the number of keys that will be supplied in the \fIkeyv\fR -array. -.AP "Tcl_Obj *const" *keyv in -Array of \fIkeyc\fR pointers to values that -\fBTcl_DictObjPutKeyList\fR and \fBTcl_DictObjRemoveKeyList\fR will -use to locate the key/value pair to manipulate within the -sub-dictionaries of the main dictionary value passed to them. -.BE - -.SH DESCRIPTION -.PP -Tcl dictionary values have an internal representation that supports -efficient mapping from keys to values and which guarantees that the -particular ordering of keys within the dictionary remains the same -modulo any keys being deleted (which removes them from the order) or -added (which adds them to the end of the order). If reinterpreted as a -list, the values at the even-valued indices in the list will be the -keys of the dictionary, and each will be followed (in the odd-valued -index) by the value associated with that key. -.PP -The procedures described in this man page are used to -create, modify, index, and iterate over dictionary values from C code. -.PP -\fBTcl_NewDictObj\fR creates a new, empty dictionary value. The -string representation of the value will be invalid, and the reference -count of the value will be zero. -.PP -\fBTcl_DictObjGet\fR looks up the given key within the given -dictionary and writes a pointer to the value associated with that key -into the variable pointed to by \fIvaluePtrPtr\fR, or a NULL if the -key has no mapping within the dictionary. The result of this -procedure is \fBTCL_OK\fR, or \fBTCL_ERROR\fR if the \fIdictPtr\fR cannot be -converted to a dictionary. -.PP -\fBTcl_DictObjPut\fR updates the given dictionary so that the given -key maps to the given value; any key may exist at most once in any -particular dictionary. The dictionary must not be shared, but the key -and value may be. This procedure may increase the reference count of -both key and value if it proves necessary to store them. Neither key -nor value should be NULL. The result of this procedure is \fBTCL_OK\fR, or -\fBTCL_ERROR\fR if the \fIdictPtr\fR cannot be converted to a dictionary. -.PP -\fBTcl_DictObjRemove\fR updates the given dictionary so that the given -key has no mapping to any value. The dictionary must not be shared, -but the key may be. The key actually stored in the dictionary will -have its reference count decremented if it was present. It is not an -error if the key did not previously exist. The result of this -procedure is \fBTCL_OK\fR, or \fBTCL_ERROR\fR if the \fIdictPtr\fR cannot be -converted to a dictionary. -.PP -\fBTcl_DictObjSize\fR updates the given variable with the number of -key/value pairs currently in the given dictionary. The result of this -procedure is \fBTCL_OK\fR, or \fBTCL_ERROR\fR if the \fIdictPtr\fR cannot be -converted to a dictionary. -.PP -\fBTcl_DictObjFirst\fR commences an iteration across all the key/value -pairs in the given dictionary, placing the key and value in the -variables pointed to by the \fIkeyPtrPtr\fR and \fIvaluePtrPtr\fR -arguments (which may be NULL to indicate that the caller is -uninterested in they key or variable respectively.) The next -key/value pair in the dictionary may be retrieved with -\fBTcl_DictObjNext\fR. Concurrent updates of the dictionary's -internal representation will not modify the iteration processing -unless the dictionary is unshared, when this will trigger premature -termination of the iteration instead (which Tcl scripts cannot trigger -via the \fBdict\fR command.) The \fIsearchPtr\fR argument points to a -piece of context that is used to identify which particular iteration -is being performed, and is initialized by the call to -\fBTcl_DictObjFirst\fR. The \fIdonePtr\fR argument points to a -variable that is updated to be zero of there are further key/value -pairs to be iterated over, or non-zero if the iteration is complete. -The order of iteration is implementation-defined. If the -\fIdictPtr\fR argument cannot be converted to a dictionary, -\fBTcl_DictObjFirst\fR returns \fBTCL_ERROR\fR and the iteration is not -commenced, and otherwise it returns \fBTCL_OK\fR. -.PP -When \fBTcl_DictObjFirst\fR is called upon a dictionary, a lock is placed on -the dictionary to enable that dictionary to be iterated over safely without -regard for whether the dictionary is modified during the iteration. Because of -this, once the iteration over a dictionary's keys has finished (whether -because all values have been iterated over as indicated by the variable -indicated by the \fIdonePtr\fR argument being set to one, or because no -further values are required) the \fBTcl_DictObjDone\fR function must be called -with the same \fIsearchPtr\fR as was passed to \fBTcl_DictObjFirst\fR so that -the internal locks can be released. Once a particular \fIsearchPtr\fR is -passed to \fBTcl_DictObjDone\fR, passing it to \fBTcl_DictObjNext\fR (without -first initializing it with \fBTcl_DictObjFirst\fR) will result in no values -being produced and the variable pointed to by \fIdonePtr\fR being set to one. -It is safe to call \fBTcl_DictObjDone\fR multiple times on the same -\fIsearchPtr\fR for each call to \fBTcl_DictObjFirst\fR. -.PP -The procedures \fBTcl_DictObjPutKeyList\fR and -\fBTcl_DictObjRemoveKeyList\fR are the close analogues of -\fBTcl_DictObjPut\fR and \fBTcl_DictObjRemove\fR respectively, except -that instead of working with a single dictionary, they are designed to -operate on a nested tree of dictionaries, with inner dictionaries -stored as values inside outer dictionaries. The \fIkeyc\fR and -\fIkeyv\fR arguments specify a list of keys (with outermost keys -first) that acts as a path to the key/value pair to be affected. Note -that there is no corresponding operation for reading a value for a -path as this is easy to construct from repeated use of -\fBTcl_DictObjGet\fR. With \fBTcl_DictObjPutKeyList\fR, nested -dictionaries are created for non-terminal keys where they do not -already exist. With \fBTcl_DictObjRemoveKeyList\fR, all non-terminal -keys must exist and have dictionaries as their values. -.SH EXAMPLE -Using the dictionary iteration interface to search determine if there -is a key that maps to itself: -.PP -.CS -Tcl_DictSearch search; -Tcl_Obj *key, *value; -int done; - -/* - * Assume interp and objPtr are parameters. This is the - * idiomatic way to start an iteration over the dictionary; it - * sets a lock on the internal representation that ensures that - * there are no concurrent modification issues when normal - * reference count management is also used. The lock is - * released automatically when the loop is finished, but must - * be released manually when an exceptional exit from the loop - * is performed. However it is safe to try to release the lock - * even if we've finished iterating over the loop. - */ -if (\fBTcl_DictObjFirst\fR(interp, objPtr, &search, - &key, &value, &done) != TCL_OK) { - return TCL_ERROR; -} -for (; !done ; \fBTcl_DictObjNext\fR(&search, &key, &value, &done)) { - /* - * Note that strcmp() is not a good way of comparing - * values and is just used here for demonstration - * purposes. - */ - if (!strcmp(Tcl_GetString(key), Tcl_GetString(value))) { - break; - } -} -\fBTcl_DictObjDone\fR(&search); -Tcl_SetObjResult(interp, Tcl_NewBooleanObj(!done)); -return TCL_OK; -.CE -.SH "SEE ALSO" -Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_InitObjHashTable -.SH KEYWORDS -dict, dict value, dictionary, dictionary value, hash table, iteration, value diff --git a/doc/DoOneEvent.3 b/doc/DoOneEvent.3 deleted file mode 100644 index d48afd0..0000000 --- a/doc/DoOneEvent.3 +++ /dev/null @@ -1,106 +0,0 @@ -'\" -'\" Copyright (c) 1990-1992 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. -'\" -.TH Tcl_DoOneEvent 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_DoOneEvent \- wait for events and invoke event handlers -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_DoOneEvent\fR(\fIflags\fR) -.SH ARGUMENTS -.AS int flags -.AP int flags in -This parameter is normally zero. It may be an OR-ed combination -of any of the following flag bits: -\fBTCL_WINDOW_EVENTS\fR, \fBTCL_FILE_EVENTS\fR, -\fBTCL_TIMER_EVENTS\fR, \fBTCL_IDLE_EVENTS\fR, \fBTCL_ALL_EVENTS\fR, -or \fBTCL_DONT_WAIT\fR. -.BE - -.SH DESCRIPTION -.PP -This procedure is the entry point to Tcl's event loop; it is responsible for -waiting for events and dispatching event handlers created with -procedures such as \fBTk_CreateEventHandler\fR, \fBTcl_CreateFileHandler\fR, -\fBTcl_CreateTimerHandler\fR, and \fBTcl_DoWhenIdle\fR. -\fBTcl_DoOneEvent\fR checks to see if -events are already present on the Tcl event queue; if so, -it calls the handler(s) for the first (oldest) event, removes it from -the queue, and returns. -If there are no events ready to be handled, then \fBTcl_DoOneEvent\fR -checks for new events from all possible sources. -If any are found, it puts all of them on Tcl's event queue, calls -handlers for the first event on the queue, and returns. -If no events are found, \fBTcl_DoOneEvent\fR checks for \fBTcl_DoWhenIdle\fR -callbacks; if any are found, it invokes all of them and returns. -Finally, if no events or idle callbacks have been found, then -\fBTcl_DoOneEvent\fR sleeps until an event occurs; then it adds any -new events to the Tcl event queue, calls handlers for the first event, -and returns. -The normal return value is 1 to signify that some event -was processed (see below for other alternatives). -.PP -If the \fIflags\fR argument to \fBTcl_DoOneEvent\fR is non-zero, -it restricts the kinds of events that will be processed by -\fBTcl_DoOneEvent\fR. -\fIFlags\fR may be an OR-ed combination of any of the following bits: -.TP 27 -\fBTCL_WINDOW_EVENTS\fR \- -Process window system events. -.TP 27 -\fBTCL_FILE_EVENTS\fR \- -Process file events. -.TP 27 -\fBTCL_TIMER_EVENTS\fR \- -Process timer events. -.TP 27 -\fBTCL_IDLE_EVENTS\fR \- -Process idle callbacks. -.TP 27 -\fBTCL_ALL_EVENTS\fR \- -Process all kinds of events: equivalent to OR-ing together all of the -above flags or specifying none of them. -.TP 27 -\fBTCL_DONT_WAIT\fR \- -Do not sleep: process only events that are ready at the time of the -call. -.LP -If any of the flags \fBTCL_WINDOW_EVENTS\fR, \fBTCL_FILE_EVENTS\fR, -\fBTCL_TIMER_EVENTS\fR, or \fBTCL_IDLE_EVENTS\fR is set, then the only -events that will be considered are those for which flags are set. -Setting none of these flags is equivalent to the value -\fBTCL_ALL_EVENTS\fR, which causes all event types to be processed. -If an application has defined additional event sources with -\fBTcl_CreateEventSource\fR, then additional \fIflag\fR values -may also be valid, depending on those event sources. -.PP -The \fBTCL_DONT_WAIT\fR flag causes \fBTcl_DoOneEvent\fR not to put -the process to sleep: it will check for events but if none are found -then it returns immediately with a return value of 0 to indicate -that no work was done. -\fBTcl_DoOneEvent\fR will also return 0 without doing anything if -the only alternative is to block forever (this can happen, for example, -if \fIflags\fR is \fBTCL_IDLE_EVENTS\fR and there are no -\fBTcl_DoWhenIdle\fR callbacks pending, or if no event handlers or -timer handlers exist). -.PP -\fBTcl_DoOneEvent\fR may be invoked recursively. For example, -it is possible to invoke \fBTcl_DoOneEvent\fR recursively -from a handler called by \fBTcl_DoOneEvent\fR. This sort -of operation is useful in some modal situations, such -as when a -notification dialog has been popped up and an application wishes to -wait for the user to click a button in the dialog before -doing anything else. - -.SH KEYWORDS -callback, event, handler, idle, timer diff --git a/doc/DoWhenIdle.3 b/doc/DoWhenIdle.3 deleted file mode 100644 index cfdbff9..0000000 --- a/doc/DoWhenIdle.3 +++ /dev/null @@ -1,87 +0,0 @@ -'\" -'\" Copyright (c) 1990 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. -'\" -.TH Tcl_DoWhenIdle 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_DoWhenIdle, Tcl_CancelIdleCall \- invoke a procedure when there are no pending events -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_DoWhenIdle\fR(\fIproc, clientData\fR) -.sp -\fBTcl_CancelIdleCall\fR(\fIproc, clientData\fR) -.SH ARGUMENTS -.AS Tcl_IdleProc clientData -.AP Tcl_IdleProc *proc in -Procedure to invoke. -.AP ClientData clientData in -Arbitrary one-word value to pass to \fIproc\fR. -.BE -.SH DESCRIPTION -.PP -\fBTcl_DoWhenIdle\fR arranges for \fIproc\fR to be invoked -when the application becomes idle. The application is -considered to be idle when \fBTcl_DoOneEvent\fR has been -called, could not find any events to handle, and is about -to go to sleep waiting for an event to occur. At this -point all pending \fBTcl_DoWhenIdle\fR handlers are -invoked. For each call to \fBTcl_DoWhenIdle\fR there will -be a single call to \fIproc\fR; after \fIproc\fR is -invoked the handler is automatically removed. -\fBTcl_DoWhenIdle\fR is only usable in programs that -use \fBTcl_DoOneEvent\fR to dispatch events. -.PP -\fIProc\fR should have arguments and result that match the -type \fBTcl_IdleProc\fR: -.PP -.CS -typedef void \fBTcl_IdleProc\fR( - ClientData \fIclientData\fR); -.CE -.PP -The \fIclientData\fR parameter to \fIproc\fR is a copy of the \fIclientData\fR -argument given to \fBTcl_DoWhenIdle\fR. Typically, \fIclientData\fR -points to a data structure containing application-specific information about -what \fIproc\fR should do. -.PP -\fBTcl_CancelIdleCall\fR -may be used to cancel one or more previous -calls to \fBTcl_DoWhenIdle\fR: if there is a \fBTcl_DoWhenIdle\fR -handler registered for \fIproc\fR and \fIclientData\fR, then it -is removed without invoking it. If there is more than one -handler on the idle list that refers to \fIproc\fR and \fIclientData\fR, -all of the handlers are removed. If no existing handlers match -\fIproc\fR and \fIclientData\fR then nothing happens. -.PP -\fBTcl_DoWhenIdle\fR is most useful in situations where -(a) a piece of work will have to be done but (b) it is -possible that something will happen in the near future -that will change what has to be done or require something -different to be done. \fBTcl_DoWhenIdle\fR allows the -actual work to be deferred until all pending events have -been processed. At this point the exact work to be done -will presumably be known and it can be done exactly once. -.PP -For example, \fBTcl_DoWhenIdle\fR might be used by an editor -to defer display updates until all pending commands have -been processed. Without this feature, redundant redisplays -might occur in some situations, such as the processing of -a command file. -.SH BUGS -.PP -At present it is not safe for an idle callback to reschedule itself -continuously. This will interact badly with certain features of Tk -that attempt to wait for all idle callbacks to complete. If you would -like for an idle callback to reschedule itself continuously, it is -better to use a timer handler with a zero timeout period. -.SH "SEE ALSO" -after(n), Tcl_CreateFileHandler(3), Tcl_CreateTimerHandler(3) -.SH KEYWORDS -callback, defer, idle callback diff --git a/doc/DoubleObj.3 b/doc/DoubleObj.3 deleted file mode 100644 index 85e4de5..0000000 --- a/doc/DoubleObj.3 +++ /dev/null @@ -1,64 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_DoubleObj 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_NewDoubleObj, Tcl_SetDoubleObj, Tcl_GetDoubleFromObj \- manipulate Tcl values as floating-point values -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Obj * -\fBTcl_NewDoubleObj\fR(\fIdoubleValue\fR) -.sp -\fBTcl_SetDoubleObj\fR(\fIobjPtr, doubleValue\fR) -.sp -int -\fBTcl_GetDoubleFromObj\fR(\fIinterp, objPtr, doublePtr\fR) -.SH ARGUMENTS -.AS Tcl_Interp doubleValue in/out -.AP double doubleValue in -A double-precision floating-point value used to initialize or set a Tcl value. -.AP Tcl_Obj *objPtr in/out -For \fBTcl_SetDoubleObj\fR, this points to the value in which to store a -double value. -For \fBTcl_GetDoubleFromObj\fR, this refers to the value -from which to retrieve a double value. -.AP Tcl_Interp *interp in/out -When non-NULL, an error message is left here when double value retrieval fails. -.AP double *doublePtr out -Points to place to store the double value obtained from \fIobjPtr\fR. -.BE - -.SH DESCRIPTION -.PP -These procedures are used to create, modify, and read Tcl values that -hold double-precision floating-point values. -.PP -\fBTcl_NewDoubleObj\fR creates and returns a new Tcl value initialized to -the double value \fIdoubleValue\fR. The returned Tcl value is unshared. -.PP -\fBTcl_SetDoubleObj\fR sets the value of an existing Tcl value pointed to -by \fIobjPtr\fR to the double value \fIdoubleValue\fR. The \fIobjPtr\fR -argument must point to an unshared Tcl value. Any attempt to set the value -of a shared Tcl value violates Tcl's copy-on-write policy. Any existing -string representation or internal representation in the unshared Tcl value -will be freed as a consequence of setting the new value. -.PP -\fBTcl_GetDoubleFromObj\fR attempts to retrieve a double value from the -Tcl value \fIobjPtr\fR. If the attempt succeeds, then \fBTCL_OK\fR is -returned, and the double value is written to the storage pointed to by -\fIdoublePtr\fR. If the attempt fails, then \fBTCL_ERROR\fR is returned, -and if \fIinterp\fR is non-NULL, an error message is left in \fIinterp\fR. -The \fBTcl_ObjType\fR of \fIobjPtr\fR may be changed to make subsequent -calls to \fBTcl_GetDoubleFromObj\fR more efficient. -'\" TODO: add discussion of treatment of NaN value -.SH "SEE ALSO" -Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult -.SH KEYWORDS -double, double value, double type, internal representation, value, value type, string representation diff --git a/doc/DumpActiveMemory.3 b/doc/DumpActiveMemory.3 deleted file mode 100644 index 43333da..0000000 --- a/doc/DumpActiveMemory.3 +++ /dev/null @@ -1,68 +0,0 @@ -'\" -'\" Copyright (c) 1992-1999 Karl Lehenbauer and Mark Diekhans. -'\" Copyright (c) 2000 by Scriptics Corporation. -'\" All rights reserved. -'\" -.TH "Tcl_DumpActiveMemory" 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_DumpActiveMemory, Tcl_InitMemory, Tcl_ValidateAllMemory \- Validated memory allocation interface -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_DumpActiveMemory\fR(\fIfileName\fR) -.sp -void -\fBTcl_InitMemory\fR(\fIinterp\fR) -.sp -void -\fBTcl_ValidateAllMemory\fR(\fIfileName, line\fR) - -.SH ARGUMENTS -.AS Tcl_Interp *fileName -.AP Tcl_Interp *interp in -Tcl interpreter in which to add commands. -.AP "const char" *fileName in -For \fBTcl_DumpActiveMemory\fR, name of the file to which memory -information will be written. For \fBTcl_ValidateAllMemory\fR, name of -the file from which the call is being made (normally \fB__FILE__\fR). -.AP int line in -Line number at which the call to \fBTcl_ValidateAllMemory\fR is made -(normally \fB__LINE__\fR). -.BE - -.SH DESCRIPTION -These functions provide access to Tcl memory debugging information. -They are only functional when Tcl has been compiled with -\fBTCL_MEM_DEBUG\fR defined at compile-time. When \fBTCL_MEM_DEBUG\fR -is not defined, these functions are all no-ops. -.PP -\fBTcl_DumpActiveMemory\fR will output a list of all currently -allocated memory to the specified file. The information output for -each allocated block of memory is: starting and ending addresses -(excluding guard zone), size, source file where \fBckalloc\fR was -called to allocate the block and line number in that file. It is -especially useful to call \fBTcl_DumpActiveMemory\fR after the Tcl -interpreter has been deleted. -.PP -\fBTcl_InitMemory\fR adds the Tcl \fBmemory\fR command to the -interpreter given by \fIinterp\fR. \fBTcl_InitMemory\fR is called -by \fBTcl_Main\fR. -.PP -\fBTcl_ValidateAllMemory\fR forces a validation of the guard zones of -all currently allocated blocks of memory. Normally validation of a -block occurs when its freed, unless full validation is enabled, in -which case validation of all blocks occurs when \fBckalloc\fR and -\fBckfree\fR are called. This function forces the validation to occur -at any point. - -.SH "SEE ALSO" -TCL_MEM_DEBUG, memory - -.SH KEYWORDS -memory, debug - - diff --git a/doc/Encoding.3 b/doc/Encoding.3 deleted file mode 100644 index 81ef508..0000000 --- a/doc/Encoding.3 +++ /dev/null @@ -1,558 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_GetEncoding 3 "8.1" Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_GetEncoding, Tcl_FreeEncoding, Tcl_GetEncodingFromObj, Tcl_ExternalToUtfDString, Tcl_ExternalToUtf, Tcl_UtfToExternalDString, Tcl_UtfToExternal, Tcl_WinTCharToUtf, Tcl_WinUtfToTChar, Tcl_GetEncodingName, Tcl_SetSystemEncoding, Tcl_GetEncodingNameFromEnvironment, Tcl_GetEncodingNames, Tcl_CreateEncoding, Tcl_GetEncodingSearchPath, Tcl_SetEncodingSearchPath, Tcl_GetDefaultEncodingDir, Tcl_SetDefaultEncodingDir \- procedures for creating and using encodings -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Encoding -\fBTcl_GetEncoding\fR(\fIinterp, name\fR) -.sp -void -\fBTcl_FreeEncoding\fR(\fIencoding\fR) -.sp -int -\fBTcl_GetEncodingFromObj\fR(\fIinterp, objPtr, encodingPtr\fR) -.sp -char * -\fBTcl_ExternalToUtfDString\fR(\fIencoding, src, srcLen, dstPtr\fR) -.sp -char * -\fBTcl_UtfToExternalDString\fR(\fIencoding, src, srcLen, dstPtr\fR) -.sp -int -\fBTcl_ExternalToUtf\fR(\fIinterp, encoding, src, srcLen, flags, statePtr, - dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr\fR) -.sp -int -\fBTcl_UtfToExternal\fR(\fIinterp, encoding, src, srcLen, flags, statePtr, - dst, dstLen, srcReadPtr, dstWrotePtr, dstCharsPtr\fR) -.sp -char * -\fBTcl_WinTCharToUtf\fR(\fItsrc, srcLen, dstPtr\fR) -.sp -TCHAR * -\fBTcl_WinUtfToTChar\fR(\fIsrc, srcLen, dstPtr\fR) -.sp -const char * -\fBTcl_GetEncodingName\fR(\fIencoding\fR) -.sp -int -\fBTcl_SetSystemEncoding\fR(\fIinterp, name\fR) -.sp -const char * -\fBTcl_GetEncodingNameFromEnvironment\fR(\fIbufPtr\fR) -.sp -void -\fBTcl_GetEncodingNames\fR(\fIinterp\fR) -.sp -Tcl_Encoding -\fBTcl_CreateEncoding\fR(\fItypePtr\fR) -.sp -Tcl_Obj * -\fBTcl_GetEncodingSearchPath\fR() -.sp -int -\fBTcl_SetEncodingSearchPath\fR(\fIsearchPath\fR) -.sp -const char * -\fBTcl_GetDefaultEncodingDir\fR(\fIvoid\fR) -.sp -void -\fBTcl_SetDefaultEncodingDir\fR(\fIpath\fR) -.SH ARGUMENTS -.AS "const Tcl_EncodingType" *dstWrotePtr in/out -.AP Tcl_Interp *interp in -Interpreter to use for error reporting, or NULL if no error reporting is -desired. -.AP "const char" *name in -Name of encoding to load. -.AP Tcl_Encoding encoding in -The encoding to query, free, or use for converting text. If \fIencoding\fR is -NULL, the current system encoding is used. -.AP Tcl_Obj *objPtr in -Name of encoding to get token for. -.AP Tcl_Encoding *encodingPtr out -Points to storage where encoding token is to be written. -.AP "const char" *src in -For the \fBTcl_ExternalToUtf\fR functions, an array of bytes in the -specified encoding that are to be converted to UTF-8. For the -\fBTcl_UtfToExternal\fR and \fBTcl_WinUtfToTChar\fR functions, an array of -UTF-8 characters to be converted to the specified encoding. -.AP "const TCHAR" *tsrc in -An array of Windows TCHAR characters to convert to UTF-8. -.AP int srcLen in -Length of \fIsrc\fR or \fItsrc\fR in bytes. If the length is negative, the -encoding-specific length of the string is used. -.AP Tcl_DString *dstPtr out -Pointer to an uninitialized or free \fBTcl_DString\fR in which the converted -result will be stored. -.AP int flags in -Various flag bits OR-ed together. -\fBTCL_ENCODING_START\fR signifies that the -source buffer is the first block in a (potentially multi-block) input -stream, telling the conversion routine to reset to an initial state and -perform any initialization that needs to occur before the first byte is -converted. \fBTCL_ENCODING_END\fR signifies that the source buffer is the last -block in a (potentially multi-block) input stream, telling the conversion -routine to perform any finalization that needs to occur after the last -byte is converted and then to reset to an initial state. -\fBTCL_ENCODING_STOPONERROR\fR signifies that the conversion routine should -return immediately upon reading a source character that does not exist in -the target encoding; otherwise a default fallback character will -automatically be substituted. -.AP Tcl_EncodingState *statePtr in/out -Used when converting a (generally long or indefinite length) byte stream -in a piece-by-piece fashion. The conversion routine stores its current -state in \fI*statePtr\fR after \fIsrc\fR (the buffer containing the -current piece) has been converted; that state information must be passed -back when converting the next piece of the stream so the conversion -routine knows what state it was in when it left off at the end of the -last piece. May be NULL, in which case the value specified for \fIflags\fR -is ignored and the source buffer is assumed to contain the complete string to -convert. -.AP char *dst out -Buffer in which the converted result will be stored. No more than -\fIdstLen\fR bytes will be stored in \fIdst\fR. -.AP int dstLen in -The maximum length of the output buffer \fIdst\fR in bytes. -.AP int *srcReadPtr out -Filled with the number of bytes from \fIsrc\fR that were actually -converted. This may be less than the original source length if there was -a problem converting some source characters. May be NULL. -.AP int *dstWrotePtr out -Filled with the number of bytes that were actually stored in the output -buffer as a result of the conversion. May be NULL. -.AP int *dstCharsPtr out -Filled with the number of characters that correspond to the number of bytes -stored in the output buffer. May be NULL. -.AP Tcl_DString *bufPtr out -Storage for the prescribed system encoding name. -.AP "const Tcl_EncodingType" *typePtr in -Structure that defines a new type of encoding. -.AP Tcl_Obj *searchPath in -List of filesystem directories in which to search for encoding data files. -.AP "const char" *path in -A path to the location of the encoding file. -.BE -.SH INTRODUCTION -.PP -These routines convert between Tcl's internal character representation, -UTF-8, and character representations used by various operating systems or -file systems, such as Unicode, ASCII, or Shift-JIS. When operating on -strings, such as such as obtaining the names of files or displaying -characters using international fonts, the strings must be translated into -one or possibly multiple formats that the various system calls can use. For -instance, on a Japanese Unix workstation, a user might obtain a filename -represented in the EUC-JP file encoding and then translate the characters to -the jisx0208 font encoding in order to display the filename in a Tk widget. -The purpose of the encoding package is to help bridge the translation gap. -UTF-8 provides an intermediate staging ground for all the various -encodings. In the example above, text would be translated into UTF-8 from -whatever file encoding the operating system is using. Then it would be -translated from UTF-8 into whatever font encoding the display routines -require. -.PP -Some basic encodings are compiled into Tcl. Others can be defined by the -user or dynamically loaded from encoding files in a -platform-independent manner. -.SH DESCRIPTION -.PP -\fBTcl_GetEncoding\fR finds an encoding given its \fIname\fR. The name may -refer to a built-in Tcl encoding, a user-defined encoding registered by -calling \fBTcl_CreateEncoding\fR, or a dynamically-loadable encoding -file. The return value is a token that represents the encoding and can be -used in subsequent calls to procedures such as \fBTcl_GetEncodingName\fR, -\fBTcl_FreeEncoding\fR, and \fBTcl_UtfToExternal\fR. If the name did not -refer to any known or loadable encoding, NULL is returned and an error -message is returned in \fIinterp\fR. -.PP -The encoding package maintains a database of all encodings currently in use. -The first time \fIname\fR is seen, \fBTcl_GetEncoding\fR returns an -encoding with a reference count of 1. If the same \fIname\fR is requested -further times, then the reference count for that encoding is incremented -without the overhead of allocating a new encoding and all its associated -data structures. -.PP -When an \fIencoding\fR is no longer needed, \fBTcl_FreeEncoding\fR -should be called to release it. When an \fIencoding\fR is no longer in use -anywhere (i.e., it has been freed as many times as it has been gotten) -\fBTcl_FreeEncoding\fR will release all storage the encoding was using -and delete it from the database. -.PP -\fBTcl_GetEncodingFromObj\fR treats the string representation of -\fIobjPtr\fR as an encoding name, and finds an encoding with that -name, just as \fBTcl_GetEncoding\fR does. When an encoding is found, -it is cached within the \fBobjPtr\fR value for future reference, the -\fBTcl_Encoding\fR token is written to the storage pointed to by -\fIencodingPtr\fR, and the value \fBTCL_OK\fR is returned. If no such -encoding is found, the value \fBTCL_ERROR\fR is returned, and no -writing to \fB*\fR\fIencodingPtr\fR takes place. Just as with -\fBTcl_GetEncoding\fR, the caller should call \fBTcl_FreeEncoding\fR -on the resulting encoding token when that token will no longer be -used. -.PP -\fBTcl_ExternalToUtfDString\fR converts a source buffer \fIsrc\fR from the -specified \fIencoding\fR into UTF-8. The converted bytes are stored in -\fIdstPtr\fR, which is then null-terminated. The caller should eventually -call \fBTcl_DStringFree\fR to free any information stored in \fIdstPtr\fR. -When converting, if any of the characters in the source buffer cannot be -represented in the target encoding, a default fallback character will be -used. The return value is a pointer to the value stored in the DString. -.PP -\fBTcl_ExternalToUtf\fR converts a source buffer \fIsrc\fR from the specified -\fIencoding\fR into UTF-8. Up to \fIsrcLen\fR bytes are converted from the -source buffer and up to \fIdstLen\fR converted bytes are stored in \fIdst\fR. -In all cases, \fI*srcReadPtr\fR is filled with the number of bytes that were -successfully converted from \fIsrc\fR and \fI*dstWrotePtr\fR is filled with -the corresponding number of bytes that were stored in \fIdst\fR. The return -value is one of the following: -.RS -.IP \fBTCL_OK\fR 29 -All bytes of \fIsrc\fR were converted. -.IP \fBTCL_CONVERT_NOSPACE\fR 29 -The destination buffer was not large enough for all of the converted data; as -many characters as could fit were converted though. -.IP \fBTCL_CONVERT_MULTIBYTE\fR 29 -The last few bytes in the source buffer were the beginning of a multibyte -sequence, but more bytes were needed to complete this sequence. A -subsequent call to the conversion routine should pass a buffer containing -the unconverted bytes that remained in \fIsrc\fR plus some further bytes -from the source stream to properly convert the formerly split-up multibyte -sequence. -.IP \fBTCL_CONVERT_SYNTAX\fR 29 -The source buffer contained an invalid character sequence. This may occur -if the input stream has been damaged or if the input encoding method was -misidentified. -.IP \fBTCL_CONVERT_UNKNOWN\fR 29 -The source buffer contained a character that could not be represented in -the target encoding and \fBTCL_ENCODING_STOPONERROR\fR was specified. -.RE -.LP -\fBTcl_UtfToExternalDString\fR converts a source buffer \fIsrc\fR from UTF-8 -into the specified \fIencoding\fR. The converted bytes are stored in -\fIdstPtr\fR, which is then terminated with the appropriate encoding-specific -null. The caller should eventually call \fBTcl_DStringFree\fR to free any -information stored in \fIdstPtr\fR. When converting, if any of the -characters in the source buffer cannot be represented in the target -encoding, a default fallback character will be used. The return value is -a pointer to the value stored in the DString. -.PP -\fBTcl_UtfToExternal\fR converts a source buffer \fIsrc\fR from UTF-8 into -the specified \fIencoding\fR. Up to \fIsrcLen\fR bytes are converted from -the source buffer and up to \fIdstLen\fR converted bytes are stored in -\fIdst\fR. In all cases, \fI*srcReadPtr\fR is filled with the number of -bytes that were successfully converted from \fIsrc\fR and \fI*dstWrotePtr\fR -is filled with the corresponding number of bytes that were stored in -\fIdst\fR. The return values are the same as the return values for -\fBTcl_ExternalToUtf\fR. -.PP -\fBTcl_WinUtfToTChar\fR and \fBTcl_WinTCharToUtf\fR are -Windows-only convenience -functions for converting between UTF-8 and Windows strings -based on the TCHAR type which is by convention -a Unicode character on Windows NT. -These functions are essentially wrappers around -\fBTcl_UtfToExternalDString\fR and -\fBTcl_ExternalToUtfDString\fR that convert to and from the -Unicode encoding. -.PP -\fBTcl_GetEncodingName\fR is roughly the inverse of \fBTcl_GetEncoding\fR. -Given an \fIencoding\fR, the return value is the \fIname\fR argument that -was used to create the encoding. The string returned by -\fBTcl_GetEncodingName\fR is only guaranteed to persist until the -\fIencoding\fR is deleted. The caller must not modify this string. -.PP -\fBTcl_SetSystemEncoding\fR sets the default encoding that should be used -whenever the user passes a NULL value for the \fIencoding\fR argument to -any of the other encoding functions. If \fIname\fR is NULL, the system -encoding is reset to the default system encoding, \fBbinary\fR. If the -name did not refer to any known or loadable encoding, \fBTCL_ERROR\fR is -returned and an error message is left in \fIinterp\fR. Otherwise, this -procedure increments the reference count of the new system encoding, -decrements the reference count of the old system encoding, and returns -\fBTCL_OK\fR. -.PP -\fBTcl_GetEncodingNameFromEnvironment\fR provides a means for the Tcl -library to report the encoding name it believes to be the correct one -to use as the system encoding, based on system calls and examination of -the environment suitable for the platform. It accepts \fIbufPtr\fR, -a pointer to an uninitialized or freed \fBTcl_DString\fR and writes -the encoding name to it. The \fBTcl_DStringValue\fR is returned. -.PP -\fBTcl_GetEncodingNames\fR sets the \fIinterp\fR result to a list -consisting of the names of all the encodings that are currently defined -or can be dynamically loaded, searching the encoding path specified by -\fBTcl_SetDefaultEncodingDir\fR. This procedure does not ensure that the -dynamically-loadable encoding files contain valid data, but merely that they -exist. -.PP -\fBTcl_CreateEncoding\fR defines a new encoding and registers the C -procedures that are called back to convert between the encoding and -UTF-8. Encodings created by \fBTcl_CreateEncoding\fR are thereafter -visible in the database used by \fBTcl_GetEncoding\fR. Just as with the -\fBTcl_GetEncoding\fR procedure, the return value is a token that -represents the encoding and can be used in subsequent calls to other -encoding functions. \fBTcl_CreateEncoding\fR returns an encoding with a -reference count of 1. If an encoding with the specified \fIname\fR -already exists, then its entry in the database is replaced with the new -encoding; the token for the old encoding will remain valid and continue -to behave as before, but users of the new token will now call the new -encoding procedures. -.PP -The \fItypePtr\fR argument to \fBTcl_CreateEncoding\fR contains information -about the name of the encoding and the procedures that will be called to -convert between this encoding and UTF-8. It is defined as follows: -.PP -.CS -typedef struct Tcl_EncodingType { - const char *\fIencodingName\fR; - Tcl_EncodingConvertProc *\fItoUtfProc\fR; - Tcl_EncodingConvertProc *\fIfromUtfProc\fR; - Tcl_EncodingFreeProc *\fIfreeProc\fR; - ClientData \fIclientData\fR; - int \fInullSize\fR; -} \fBTcl_EncodingType\fR; -.CE -.PP -The \fIencodingName\fR provides a string name for the encoding, by -which it can be referred in other procedures such as -\fBTcl_GetEncoding\fR. The \fItoUtfProc\fR refers to a callback -procedure to invoke to convert text from this encoding into UTF-8. -The \fIfromUtfProc\fR refers to a callback procedure to invoke to -convert text from UTF-8 into this encoding. The \fIfreeProc\fR refers -to a callback procedure to invoke when this encoding is deleted. The -\fIfreeProc\fR field may be NULL. The \fIclientData\fR contains an -arbitrary one-word value passed to \fItoUtfProc\fR, \fIfromUtfProc\fR, -and \fIfreeProc\fR whenever they are called. Typically, this is a -pointer to a data structure containing encoding-specific information -that can be used by the callback procedures. For instance, two very -similar encodings such as \fBascii\fR and \fBmacRoman\fR may use the -same callback procedure, but use different values of \fIclientData\fR -to control its behavior. The \fInullSize\fR specifies the number of -zero bytes that signify end-of-string in this encoding. It must be -\fB1\fR (for single-byte or multi-byte encodings like ASCII or -Shift-JIS) or \fB2\fR (for double-byte encodings like Unicode). -Constant-sized encodings with 3 or more bytes per character (such as -CNS11643) are not accepted. -.PP -The callback procedures \fItoUtfProc\fR and \fIfromUtfProc\fR should match the -type \fBTcl_EncodingConvertProc\fR: -.PP -.CS -typedef int \fBTcl_EncodingConvertProc\fR( - ClientData \fIclientData\fR, - const char *\fIsrc\fR, - int \fIsrcLen\fR, - int \fIflags\fR, - Tcl_EncodingState *\fIstatePtr\fR, - char *\fIdst\fR, - int \fIdstLen\fR, - int *\fIsrcReadPtr\fR, - int *\fIdstWrotePtr\fR, - int *\fIdstCharsPtr\fR); -.CE -.PP -The \fItoUtfProc\fR and \fIfromUtfProc\fR procedures are called by the -\fBTcl_ExternalToUtf\fR or \fBTcl_UtfToExternal\fR family of functions to -perform the actual conversion. The \fIclientData\fR parameter to these -procedures is the same as the \fIclientData\fR field specified to -\fBTcl_CreateEncoding\fR when the encoding was created. The remaining -arguments to the callback procedures are the same as the arguments, -documented at the top, to \fBTcl_ExternalToUtf\fR or -\fBTcl_UtfToExternal\fR, with the following exceptions. If the -\fIsrcLen\fR argument to one of those high-level functions is negative, -the value passed to the callback procedure will be the appropriate -encoding-specific string length of \fIsrc\fR. If any of the \fIsrcReadPtr\fR, -\fIdstWrotePtr\fR, or \fIdstCharsPtr\fR arguments to one of the high-level -functions is NULL, the corresponding value passed to the callback -procedure will be a non-NULL location. -.PP -The callback procedure \fIfreeProc\fR, if non-NULL, should match the type -\fBTcl_EncodingFreeProc\fR: -.PP -.CS -typedef void \fBTcl_EncodingFreeProc\fR( - ClientData \fIclientData\fR); -.CE -.PP -This \fIfreeProc\fR function is called when the encoding is deleted. The -\fIclientData\fR parameter is the same as the \fIclientData\fR field -specified to \fBTcl_CreateEncoding\fR when the encoding was created. -.PP -\fBTcl_GetEncodingSearchPath\fR and \fBTcl_SetEncodingSearchPath\fR -are called to access and set the list of filesystem directories searched -for encoding data files. -.PP -The value returned by \fBTcl_GetEncodingSearchPath\fR -is the value stored by the last successful call to -\fBTcl_SetEncodingSearchPath\fR. If no calls to -\fBTcl_SetEncodingSearchPath\fR have occurred, Tcl will compute an initial -value based on the environment. There is one encoding search path for the -entire process, shared by all threads in the process. -.PP -\fBTcl_SetEncodingSearchPath\fR stores \fIsearchPath\fR and returns -\fBTCL_OK\fR, unless \fIsearchPath\fR is not a valid Tcl list, which -causes \fBTCL_ERROR\fR to be returned. The elements of \fIsearchPath\fR -are not verified as existing readable filesystem directories. When -searching for encoding data files takes place, and non-existent or -non-readable filesystem directories on the \fIsearchPath\fR are silently -ignored. -.PP -\fBTcl_GetDefaultEncodingDir\fR and \fBTcl_SetDefaultEncodingDir\fR -are obsolete interfaces best replaced with calls to -\fBTcl_GetEncodingSearchPath\fR and \fBTcl_SetEncodingSearchPath\fR. -They are called to access and set the first element of the \fIsearchPath\fR -list. Since Tcl searches \fIsearchPath\fR for encoding data files in -list order, these routines establish the -.QW default -directory in which to find encoding data files. -.SH "ENCODING FILES" -Space would prohibit precompiling into Tcl every possible encoding -algorithm, so many encodings are stored on disk as dynamically-loadable -encoding files. This behavior also allows the user to create additional -encoding files that can be loaded using the same mechanism. These -encoding files contain information about the tables and/or escape -sequences used to map between an external encoding and Unicode. The -external encoding may consist of single-byte, multi-byte, or double-byte -characters. -.PP -Each dynamically-loadable encoding is represented as a text file. The -initial line of the file, beginning with a -.QW # -symbol, is a comment -that provides a human-readable description of the file. The next line -identifies the type of encoding file. It can be one of the following -letters: -.IP "[1] \fBS\fR" -A single-byte encoding, where one character is always one byte long in the -encoding. An example is \fBiso8859-1\fR, used by many European languages. -.IP "[2] \fBD\fR" -A double-byte encoding, where one character is always two bytes long in the -encoding. An example is \fBbig5\fR, used for Chinese text. -.IP "[3] \fBM\fR" -A multi-byte encoding, where one character may be either one or two bytes long. -Certain bytes are lead bytes, indicating that another byte must follow -and that together the two bytes represent one character. Other bytes are not -lead bytes and represent themselves. An example is \fBshiftjis\fR, used by -many Japanese computers. -.IP "[4] \fBE\fR" -An escape-sequence encoding, specifying that certain sequences of bytes -do not represent characters, but commands that describe how following bytes -should be interpreted. -.PP -The rest of the lines in the file depend on the type. -.PP -Cases [1], [2], and [3] are collectively referred to as table-based encoding -files. The lines in a table-based encoding file are in the same -format as this example taken from the \fBshiftjis\fR encoding (this is not -the complete file): -.PP -.CS -# Encoding file: shiftjis, multi-byte -M -003F 0 40 -00 -0000000100020003000400050006000700080009000A000B000C000D000E000F -0010001100120013001400150016001700180019001A001B001C001D001E001F -0020002100220023002400250026002700280029002A002B002C002D002E002F -0030003100320033003400350036003700380039003A003B003C003D003E003F -0040004100420043004400450046004700480049004A004B004C004D004E004F -0050005100520053005400550056005700580059005A005B005C005D005E005F -0060006100620063006400650066006700680069006A006B006C006D006E006F -0070007100720073007400750076007700780079007A007B007C007D203E007F -0080000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000 -0000FF61FF62FF63FF64FF65FF66FF67FF68FF69FF6AFF6BFF6CFF6DFF6EFF6F -FF70FF71FF72FF73FF74FF75FF76FF77FF78FF79FF7AFF7BFF7CFF7DFF7EFF7F -FF80FF81FF82FF83FF84FF85FF86FF87FF88FF89FF8AFF8BFF8CFF8DFF8EFF8F -FF90FF91FF92FF93FF94FF95FF96FF97FF98FF99FF9AFF9BFF9CFF9DFF9EFF9F -0000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000 -81 -0000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000 -300030013002FF0CFF0E30FBFF1AFF1BFF1FFF01309B309C00B4FF4000A8FF3E -FFE3FF3F30FD30FE309D309E30034EDD30053006300730FC20152010FF0F005C -301C2016FF5C2026202520182019201C201DFF08FF0930143015FF3BFF3DFF5B -FF5D30083009300A300B300C300D300E300F30103011FF0B221200B100D70000 -00F7FF1D2260FF1CFF1E22662267221E22342642264000B0203220332103FFE5 -FF0400A200A3FF05FF03FF06FF0AFF2000A72606260525CB25CF25CE25C725C6 -25A125A025B325B225BD25BC203B301221922190219121933013000000000000 -000000000000000000000000000000002208220B2286228722822283222A2229 -000000000000000000000000000000002227222800AC21D221D4220022030000 -0000000000000000000000000000000000000000222022A52312220222072261 -2252226A226B221A223D221D2235222B222C0000000000000000000000000000 -212B2030266F266D266A2020202100B6000000000000000025EF000000000000 -.CE -.PP -The third line of the file is three numbers. The first number is the -fallback character (in base 16) to use when converting from UTF-8 to this -encoding. The second number is a \fB1\fR if this file represents the -encoding for a symbol font, or \fB0\fR otherwise. The last number (in base -10) is how many pages of data follow. -.PP -Subsequent lines in the example above are pages that describe how to map -from the encoding into 2-byte Unicode. The first line in a page identifies -the page number. Following it are 256 double-byte numbers, arranged as 16 -rows of 16 numbers. Given a character in the encoding, the high byte of -that character is used to select which page, and the low byte of that -character is used as an index to select one of the double-byte numbers in -that page \- the value obtained being the corresponding Unicode character. -By examination of the example above, one can see that the characters 0x7E -and 0x8163 in \fBshiftjis\fR map to 203E and 2026 in Unicode, respectively. -.PP -Following the first page will be all the other pages, each in the same -format as the first: one number identifying the page followed by 256 -double-byte Unicode characters. If a character in the encoding maps to the -Unicode character 0000, it means that the character does not actually exist. -If all characters on a page would map to 0000, that page can be omitted. -.PP -Case [4] is the escape-sequence encoding file. The lines in an this type of -file are in the same format as this example taken from the \fBiso2022-jp\fR -encoding: -.PP -.CS -.ta 1.5i -# Encoding file: iso2022-jp, escape-driven -E -init {} -final {} -iso8859-1 \ex1b(B -jis0201 \ex1b(J -jis0208 \ex1b$@ -jis0208 \ex1b$B -jis0212 \ex1b$(D -gb2312 \ex1b$A -ksc5601 \ex1b$(C -.CE -.PP -In the file, the first column represents an option and the second column -is the associated value. \fBinit\fR is a string to emit or expect before -the first character is converted, while \fBfinal\fR is a string to emit -or expect after the last character. All other options are names of -table-based encodings; the associated value is the escape-sequence that -marks that encoding. Tcl syntax is used for the values; in the above -example, for instance, -.QW \fB{}\fR -represents the empty string and -.QW \fB\ex1b\fR -represents character 27. -.PP -When \fBTcl_GetEncoding\fR encounters an encoding \fIname\fR that has not -been loaded, it attempts to load an encoding file called \fIname\fB.enc\fR -from the \fBencoding\fR subdirectory of each directory that Tcl searches -for its script library. If the encoding file exists, but is -malformed, an error message will be left in \fIinterp\fR. -.SH KEYWORDS -utf, encoding, convert diff --git a/doc/Ensemble.3 b/doc/Ensemble.3 deleted file mode 100644 index 30c1d3b..0000000 --- a/doc/Ensemble.3 +++ /dev/null @@ -1,219 +0,0 @@ -'\" -'\" 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. -'\" -'\" This documents the C API introduced in TIP#235 -'\" -.TH Tcl_Ensemble 3 8.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_CreateEnsemble, Tcl_FindEnsemble, Tcl_GetEnsembleFlags, Tcl_GetEnsembleMappingDict, Tcl_GetEnsembleNamespace, Tcl_GetEnsembleParameterList, Tcl_GetEnsembleUnknownHandler, Tcl_GetEnsembleSubcommandList, Tcl_IsEnsemble, Tcl_SetEnsembleFlags, Tcl_SetEnsembleMappingDict, Tcl_SetEnsembleParameterList, Tcl_SetEnsembleSubcommandList, Tcl_SetEnsembleUnknownHandler \- manipulate ensemble commands -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Command -\fBTcl_CreateEnsemble\fR(\fIinterp, name, namespacePtr, ensFlags\fR) -.sp -Tcl_Command -\fBTcl_FindEnsemble\fR(\fIinterp, cmdNameObj, flags\fR) -.sp -int -\fBTcl_IsEnsemble\fR(\fItoken\fR) -.sp -int -\fBTcl_GetEnsembleFlags\fR(\fIinterp, token, ensFlagsPtr\fR) -.sp -int -\fBTcl_SetEnsembleFlags\fR(\fIinterp, token, ensFlags\fR) -.sp -int -\fBTcl_GetEnsembleMappingDict\fR(\fIinterp, token, dictObjPtr\fR) -.sp -int -\fBTcl_SetEnsembleMappingDict\fR(\fIinterp, token, dictObj\fR) -.sp -.VS 8.6 -int -\fBTcl_GetEnsembleParameterList\fR(\fIinterp, token, listObjPtr\fR) -.sp -int -\fBTcl_SetEnsembleParameterList\fR(\fIinterp, token, listObj\fR) -.VE 8.6 -.sp -int -\fBTcl_GetEnsembleSubcommandList\fR(\fIinterp, token, listObjPtr\fR) -.sp -int -\fBTcl_SetEnsembleSubcommandList\fR(\fIinterp, token, listObj\fR) -.sp -int -\fBTcl_GetEnsembleUnknownHandler\fR(\fIinterp, token, listObjPtr\fR) -.sp -int -\fBTcl_SetEnsembleUnknownHandler\fR(\fIinterp, token, listObj\fR) -.sp -int -\fBTcl_GetEnsembleNamespace\fR(\fIinterp, token, namespacePtrPtr\fR) -.SH ARGUMENTS -.AS Tcl_Namespace **namespacePtrPtr in/out -.AP Tcl_Interp *interp in/out -The interpreter in which the ensemble is to be created or found. Also -where error result messages are written. The functions whose names -start with \fBTcl_GetEnsemble\fR may have a NULL for the \fIinterp\fR, -but all other functions must not. -.AP "const char" *name in -The name of the ensemble command to be created. -.AP Tcl_Namespace *namespacePtr in -The namespace to which the ensemble command is to be bound, or NULL -for the current namespace. -.AP int ensFlags in -An ORed set of flag bits describing the basic configuration of the -ensemble. Currently only one bit has meaning, \fBTCL_ENSEMBLE_PREFIX\fR, -which is present when the ensemble command should also match -unambiguous prefixes of subcommands. -.AP Tcl_Obj *cmdNameObj in -A value holding the name of the ensemble command to look up. -.AP int flags in -An ORed set of flag bits controlling the behavior of -\fBTcl_FindEnsemble\fR. Currently only \fBTCL_LEAVE_ERR_MSG\fR is supported. -.AP Tcl_Command token in -A normal command token that refers to an ensemble command, or which -you wish to use for testing as an ensemble command in \fBTcl_IsEnsemble\fR. -.AP int *ensFlagsPtr out -Pointer to a variable into which to write the current ensemble flag -bits; currently only the bit \fBTCL_ENSEMBLE_PREFIX\fR is defined. -.AP Tcl_Obj *dictObj in -A dictionary value to use for the subcommand to implementation command -prefix mapping dictionary in the ensemble. May be NULL if the mapping -dictionary is to be removed. -.AP Tcl_Obj **dictObjPtr out -Pointer to a variable into which to write the current ensemble mapping -dictionary. -.AP Tcl_Obj *listObj in -A list value to use for the list of formal pre-subcommand parameters, the -defined list of subcommands in the dictionary or the unknown subcommand -handler command prefix. May be NULL if the subcommand list or unknown handler -are to be removed. -.AP Tcl_Obj **listObjPtr out -Pointer to a variable into which to write the current list of formal -pre-subcommand parameters, the defined list of subcommands or the current -unknown handler prefix. -.AP Tcl_Namespace **namespacePtrPtr out -Pointer to a variable into which to write the handle of the namespace -to which the ensemble is bound. -.BE -.SH DESCRIPTION -An ensemble is a command, bound to some namespace, which consists of a -collection of subcommands implemented by other Tcl commands. The first -argument to the ensemble command is always interpreted as a selector -that states what subcommand to execute. -.PP -Ensembles are created using \fBTcl_CreateEnsemble\fR, which takes four -arguments: the interpreter to work within, the name of the ensemble to -create, the namespace within the interpreter to bind the ensemble to, -and the default set of ensemble flags. The result of the function is -the command token for the ensemble, which may be used to further -configure the ensemble using the API described below in -\fBENSEMBLE PROPERTIES\fR. -.PP -Given the name of an ensemble command, the token for that command may -be retrieved using \fBTcl_FindEnsemble\fR. If the given command name -(in \fIcmdNameObj\fR) does not refer to an ensemble command, the -result of the function is NULL and (if the \fBTCL_LEAVE_ERR_MSG\fR bit is -set in \fIflags\fR) an error message is left in the interpreter -result. -.PP -A command token may be checked to see if it refers to an ensemble -using \fBTcl_IsEnsemble\fR. This returns 1 if the token refers to an -ensemble, or 0 otherwise. -.SS "ENSEMBLE PROPERTIES" -Every ensemble has four read-write properties and a read-only -property. The properties are: -.TP -\fBflags\fR (read-write) -. -The set of flags for the ensemble, expressed as a -bit-field. Currently, the only public flag is \fBTCL_ENSEMBLE_PREFIX\fR -which is set when unambiguous prefixes of subcommands are permitted to -be resolved to implementations as well as exact matches. The flags may -be read and written using \fBTcl_GetEnsembleFlags\fR and -\fBTcl_SetEnsembleFlags\fR respectively. The result of both of those -functions is a Tcl result code (\fBTCL_OK\fR, or \fBTCL_ERROR\fR if -the token does not refer to an ensemble). -.TP -\fBmapping dictionary\fR (read-write) -. -A dictionary containing a mapping from subcommand names to lists of -words to use as a command prefix (replacing the first two words of the -command which are the ensemble command itself and the subcommand -name), or NULL if every subcommand is to be mapped to the command with -the same unqualified name in the ensemble's bound namespace. Defaults -to NULL. May be read and written using -\fBTcl_GetEnsembleMappingDict\fR and \fBTcl_SetEnsembleMappingDict\fR -respectively. The result of both of those functions is a Tcl result -code (\fBTCL_OK\fR, or \fBTCL_ERROR\fR if the token does not refer to an -ensemble) and the dictionary obtained from -\fBTcl_GetEnsembleMappingDict\fR should always be treated as immutable -even if it is unshared. -All command names in prefixes set via \fBTcl_SetEnsembleMappingDict\fR -must be fully qualified. -.TP -\fBformal pre-subcommand parameter list\fR (read-write) -.VS 8.6 -A list of formal parameter names (the names only being used when generating -error messages) that come at invocation of the ensemble between the name of -the ensemble and the subcommand argument. NULL (the default) is equivalent to -the empty list. May be read and written using -\fBTcl_GetEnsembleParameterList\fR and \fBTcl_SetEnsembleParameterList\fR -respectively. The result of both of those functions is a Tcl result code -(\fBTCL_OK\fR, or \fBTCL_ERROR\fR if the token does not refer to an -ensemble) and the -dictionary obtained from \fBTcl_GetEnsembleParameterList\fR should always be -treated as immutable even if it is unshared. -.VE 8.6 -.TP -\fBsubcommand list\fR (read-write) -. -A list of all the subcommand names for the ensemble, or NULL if this -is to be derived from either the keys of the mapping dictionary (see -above) or (if that is also NULL) from the set of commands exported by -the bound namespace. May be read and written using -\fBTcl_GetEnsembleSubcommandList\fR and -\fBTcl_SetEnsembleSubcommandList\fR respectively. The result of both -of those functions is a Tcl result code (\fBTCL_OK\fR, or -\fBTCL_ERROR\fR if the -token does not refer to an ensemble) and the list obtained from -\fBTcl_GetEnsembleSubcommandList\fR should always be treated as -immutable even if it is unshared. -.TP -\fBunknown subcommand handler command prefix\fR (read-write) -. -A list of words to prepend on the front of any subcommand when the -subcommand is unknown to the ensemble (according to the current prefix -handling rule); see the \fBnamespace ensemble\fR command for more -details. If NULL, the default behavior \- generate a suitable error -message \- will be used when an unknown subcommand is encountered. May -be read and written using \fBTcl_GetEnsembleUnknownHandler\fR and -\fBTcl_SetEnsembleUnknownHandler\fR respectively. The result of both -functions is a Tcl result code (\fBTCL_OK\fR, or \fBTCL_ERROR\fR if -the token does -not refer to an ensemble) and the list obtained from -\fBTcl_GetEnsembleUnknownHandler\fR should always be treated as -immutable even if it is unshared. -.TP -\fBbound namespace\fR (read-only) -. -The namespace to which the ensemble is bound; when the namespace is -deleted, so too will the ensemble, and this namespace is also the -namespace whose list of exported commands is used if both the mapping -dictionary and the subcommand list properties are NULL. May be read -using \fBTcl_GetEnsembleNamespace\fR which returns a Tcl result code -(\fBTCL_OK\fR, or \fBTCL_ERROR\fR if the token does not refer to an ensemble). -.SH "SEE ALSO" -namespace(n), Tcl_DeleteCommandFromToken(3) -.SH KEYWORDS -command, ensemble diff --git a/doc/Environment.3 b/doc/Environment.3 deleted file mode 100644 index 7a5e396..0000000 --- a/doc/Environment.3 +++ /dev/null @@ -1,38 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_PutEnv 3 "7.5" Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_PutEnv \- procedures to manipulate the environment -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_PutEnv\fR(\fIassignment\fR) -.SH ARGUMENTS -.AS "const char" *assignment -.AP "const char" *assignment in -Info about environment variable in the format -.QW \fINAME\fB=\fIvalue\fR . -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 -.QW \fINAME\fB=\fIvalue\fR . -This procedure is -intended to be a stand-in for the UNIX \fBputenv\fR system call. All -Tcl-based applications using \fBputenv\fR should redefine it to -\fBTcl_PutEnv\fR so that they will interface properly to the Tcl -runtime. -.SH "SEE ALSO" -env(n) -.SH KEYWORDS -environment, variable diff --git a/doc/Eval.3 b/doc/Eval.3 deleted file mode 100644 index 191bace..0000000 --- a/doc/Eval.3 +++ /dev/null @@ -1,211 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_Eval 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.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 -.nf -\fB#include \fR -.sp -int -\fBTcl_EvalObjEx\fR(\fIinterp, objPtr, flags\fR) -.sp -int -\fBTcl_EvalFile\fR(\fIinterp, fileName\fR) -.sp -int -\fBTcl_EvalObjv\fR(\fIinterp, objc, objv, flags\fR) -.sp -int -\fBTcl_Eval\fR(\fIinterp, script\fR) -.sp -int -\fBTcl_EvalEx\fR(\fIinterp, script, numBytes, flags\fR) -.sp -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 -modified to hold the result or error message from the script. -.AP Tcl_Obj *objPtr in -A Tcl value containing the script to execute. -.AP int flags in -ORed combination of flag bits that specify additional options. -\fBTCL_EVAL_GLOBAL\fR and \fBTCL_EVAL_DIRECT\fR are currently supported. -.AP "const char" *fileName in -Name of a file containing a Tcl script. -.AP int objc in -The number of values in the array pointed to by \fIobjPtr\fR; -this is also the number of words in the command. -.AP Tcl_Obj **objv in -Points to an array of pointers to values; each value holds the -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 -\fBva_start\fR, and cleared using \fBva_end\fR. -.BE - -.SH DESCRIPTION -.PP -The procedures described here are invoked to execute Tcl scripts in -various forms. -\fBTcl_EvalObjEx\fR is the core procedure and is used by many of the others. -It executes the commands in the script stored in \fIobjPtr\fR -until either an error occurs or the end of the script is reached. -If this is the first time \fIobjPtr\fR has been executed, -its commands are compiled into bytecode instructions -which are then executed. The -bytecodes are saved in \fIobjPtr\fR so that the compilation step -can be skipped if the value is evaluated again in the future. -.PP -The return value from \fBTcl_EvalObjEx\fR (and all the other procedures -described here) is a Tcl completion code with -one of the values \fBTCL_OK\fR, \fBTCL_ERROR\fR, \fBTCL_RETURN\fR, -\fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR, or possibly some other -integer value originating in an extension. -In addition, a result value or error message is left in \fIinterp\fR's -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 could not be read then a Tcl error is returned to describe -why the file could not be read. -The eofchar for files is -.QW \e32 -(^Z) for all platforms. If you require a -.QW ^Z -in code for string comparison, you can use -.QW \e032 -or -.QW \eu001a , -which will be safely substituted by the Tcl interpreter into -.QW ^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 value in -\fIobjv\fR. \fBTcl_EvalObjv\fR evaluates the command and returns -a completion code and result just like \fBTcl_EvalObjEx\fR. -The caller of \fBTcl_EvalObjv\fR has to manage the reference count of the -elements of \fIobjv\fR, insuring that the values are valid until -\fBTcl_EvalObjv\fR returns. -.PP -\fBTcl_Eval\fR is similar to \fBTcl_EvalObjEx\fR except that the script to -be executed is supplied as a string instead of a value and no compilation -occurs. The string should be a proper UTF-8 string as converted by -\fBTcl_ExternalToUtfDString\fR or \fBTcl_ExternalToUtf\fR when it is known -to possibly contain upper ASCII characters whose possible combinations -might be a UTF-8 special code. The string is parsed and executed directly -(using \fBTcl_EvalObjv\fR) instead of compiling it and executing the -bytecodes. In situations where it is known that the script will never be -executed again, \fBTcl_Eval\fR may be faster than \fBTcl_EvalObjEx\fR. - \fBTcl_Eval\fR returns a completion code and result just like -\fBTcl_EvalObjEx\fR. Note: for backward compatibility with versions before -Tcl 8.0, \fBTcl_Eval\fR copies the value result in \fIinterp\fR to -\fIinterp->result\fR (use is deprecated) where it can be accessed directly. - This makes \fBTcl_Eval\fR somewhat slower than \fBTcl_EvalEx\fR, which -does not do the copy. -.PP -\fBTcl_EvalEx\fR is an extended version of \fBTcl_Eval\fR that takes -additional arguments \fInumBytes\fR and \fIflags\fR. For the -efficiency reason given above, \fBTcl_EvalEx\fR is generally preferred -over \fBTcl_Eval\fR. -.PP -\fBTcl_GlobalEval\fR and \fBTcl_GlobalEvalObj\fR are older procedures -that are now deprecated. They are similar to \fBTcl_EvalEx\fR and -\fBTcl_EvalObjEx\fR except that the script is evaluated in the global -namespace and its variable context consists of global variables only -(it ignores any Tcl procedures that are active). These functions are -equivalent to using the \fBTCL_EVAL_GLOBAL\fR flag (see below). -.PP -\fBTcl_VarEval\fR takes any number of string arguments -of any length, concatenates them into a single string, -then calls \fBTcl_Eval\fR to execute that string as a Tcl command. -It returns the result of the command and also modifies -\fIinterp->result\fR in the same way as \fBTcl_Eval\fR. -The last argument to \fBTcl_VarEval\fR must be NULL to indicate the end -of arguments. \fBTcl_VarEval\fR is now deprecated. -.PP -\fBTcl_VarEvalVA\fR is the same as \fBTcl_VarEval\fR except that -instead of taking a variable number of arguments it takes an argument -list. Like \fBTcl_VarEval\fR, \fBTcl_VarEvalVA\fR is deprecated. - -.SH "FLAG BITS" -.PP -Any ORed combination of the following values may be used for the -\fIflags\fR argument to procedures such as \fBTcl_EvalObjEx\fR: -.TP 23 -\fBTCL_EVAL_DIRECT\fR -. -This flag is only used by \fBTcl_EvalObjEx\fR; it is ignored by -other procedures. If this flag bit is set, the script is not -compiled to bytecodes; instead it is executed directly -as is done by \fBTcl_EvalEx\fR. The -\fBTCL_EVAL_DIRECT\fR flag is useful in situations where the -contents of a value are going to change immediately, so the -bytecodes will not be reused in a future execution. In this case, -it is faster to execute the script directly. -.TP 23 -\fBTCL_EVAL_GLOBAL\fR -. -If this flag is set, the script is processed at global level. This -means that it is evaluated in the global namespace and its variable -context consists of global variables only (it ignores any Tcl -procedures that are active). - -.SH "MISCELLANEOUS DETAILS" -.PP -During the processing of a Tcl command it is legal to make nested -calls to evaluate other commands (this is how procedures and -some control structures are implemented). -If a code other than \fBTCL_OK\fR is returned -from a nested \fBTcl_EvalObjEx\fR invocation, -then the caller should normally return immediately, -passing that same return code back to its caller, -and so on until the top-level application is reached. -A few commands, like \fBfor\fR, will check for certain -return codes, like \fBTCL_BREAK\fR and \fBTCL_CONTINUE\fR, and process them -specially without returning. -.PP -\fBTcl_EvalObjEx\fR keeps track of how many nested \fBTcl_EvalObjEx\fR -invocations are in progress for \fIinterp\fR. -If a code of \fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR is -about to be returned from the topmost \fBTcl_EvalObjEx\fR -invocation for \fIinterp\fR, -it converts the return code to \fBTCL_ERROR\fR -and sets \fIinterp\fR's result to an error message indicating that -the \fBreturn\fR, \fBbreak\fR, or \fBcontinue\fR command was -invoked in an inappropriate place. -This means that top-level applications should never see a return code -from \fBTcl_EvalObjEx\fR other than \fBTCL_OK\fR or \fBTCL_ERROR\fR. - -.SH KEYWORDS -execute, file, global, result, script, value diff --git a/doc/Exit.3 b/doc/Exit.3 deleted file mode 100644 index 9a04db3..0000000 --- a/doc/Exit.3 +++ /dev/null @@ -1,140 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_Exit 3 8.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_Exit, Tcl_Finalize, Tcl_CreateExitHandler, Tcl_DeleteExitHandler, Tcl_ExitThread, Tcl_FinalizeThread, Tcl_CreateThreadExitHandler, Tcl_DeleteThreadExitHandler, Tcl_SetExitProc \- end the application or thread (and invoke exit handlers) -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_Exit\fR(\fIstatus\fR) -.sp -\fBTcl_Finalize\fR() -.sp -\fBTcl_CreateExitHandler\fR(\fIproc, clientData\fR) -.sp -\fBTcl_DeleteExitHandler\fR(\fIproc, clientData\fR) -.sp -\fBTcl_ExitThread\fR(\fIstatus\fR) -.sp -\fBTcl_FinalizeThread\fR() -.sp -\fBTcl_CreateThreadExitHandler\fR(\fIproc, clientData\fR) -.sp -\fBTcl_DeleteThreadExitHandler\fR(\fIproc, clientData\fR) -.sp -Tcl_ExitProc * -\fBTcl_SetExitProc\fR(\fIproc\fR) -.SH ARGUMENTS -.AS Tcl_ExitProc clientData -.AP int status in -Provides information about why the application or thread exited. -Exact meaning may -be platform-specific. 0 usually means a normal exit, any nonzero value -usually means that an error occurred. -.AP Tcl_ExitProc *proc in -Procedure to invoke before exiting application, or (for -\fBTcl_SetExitProc\fR) NULL to uninstall the current application exit -procedure. -.AP ClientData clientData in -Arbitrary one-word value to pass to \fIproc\fR. -.BE - -.SH DESCRIPTION -.PP -The procedures described here provide a graceful mechanism to end the -execution of a \fBTcl\fR application. Exit handlers are invoked to cleanup the -application's state before ending the execution of \fBTcl\fR code. -.PP -Invoke \fBTcl_Exit\fR to end a \fBTcl\fR application and to exit from this -process. This procedure is invoked by the \fBexit\fR command, and can be -invoked anyplace else to terminate the application. -No-one should ever invoke the \fBexit\fR system procedure directly; always -invoke \fBTcl_Exit\fR instead, so that it can invoke exit handlers. -Note that if other code invokes \fBexit\fR system procedure directly, or -otherwise causes the application to terminate without calling -\fBTcl_Exit\fR, the exit handlers will not be run. -\fBTcl_Exit\fR internally invokes the \fBexit\fR system call, thus it never -returns control to its caller. -If an application exit handler has been installed (see -\fBTcl_SetExitProc\fR), that handler is invoked with an argument -consisting of the exit status (cast to ClientData); the application -exit handler should not return control to Tcl. -.PP -\fBTcl_Finalize\fR is similar to \fBTcl_Exit\fR except that it does not -exit from the current process. -It is useful for cleaning up when a process is finished using \fBTcl\fR but -wishes to continue executing, and when \fBTcl\fR is used in a dynamically -loaded extension that is about to be unloaded. -Your code should always invoke \fBTcl_Finalize\fR when \fBTcl\fR is being -unloaded, to ensure proper cleanup. \fBTcl_Finalize\fR can be safely called -more than once. -.PP -\fBTcl_ExitThread\fR is used to terminate the current thread and invoke -per-thread exit handlers. This finalization is done by -\fBTcl_FinalizeThread\fR, which you can call if you just want to clean -up per-thread state and invoke the thread exit handlers. -\fBTcl_Finalize\fR calls \fBTcl_FinalizeThread\fR for the current -thread automatically. -.PP -\fBTcl_CreateExitHandler\fR arranges for \fIproc\fR to be invoked -by \fBTcl_Finalize\fR and \fBTcl_Exit\fR. -\fBTcl_CreateThreadExitHandler\fR arranges for \fIproc\fR to be invoked -by \fBTcl_FinalizeThread\fR and \fBTcl_ExitThread\fR. -This provides a hook for cleanup operations such as flushing buffers -and freeing global memory. -\fIProc\fR should match the type \fBTcl_ExitProc\fR: -.PP -.CS -typedef void \fBTcl_ExitProc\fR( - ClientData \fIclientData\fR); -.CE -.PP -The \fIclientData\fR parameter to \fIproc\fR is a -copy of the \fIclientData\fR argument given to -\fBTcl_CreateExitHandler\fR or \fBTcl_CreateThreadExitHandler\fR when -the callback -was created. Typically, \fIclientData\fR points to a data -structure containing application-specific information about -what to do in \fIproc\fR. -.PP -\fBTcl_DeleteExitHandler\fR and \fBTcl_DeleteThreadExitHandler\fR may be -called to delete a -previously-created exit handler. It removes the handler -indicated by \fIproc\fR and \fIclientData\fR so that no call -to \fIproc\fR will be made. If no such handler exists then -\fBTcl_DeleteExitHandler\fR or \fBTcl_DeleteThreadExitHandler\fR does nothing. -.PP -\fBTcl_Finalize\fR and \fBTcl_Exit\fR execute all registered exit handlers, -in reverse order from the order in which they were registered. -This matches the natural order in which extensions are loaded and unloaded; -if extension \fBA\fR loads extension \fBB\fR, it usually -unloads \fBB\fR before it itself is unloaded. -If extension \fBA\fR registers its exit handlers before loading extension -\fBB\fR, this ensures that any exit handlers for \fBB\fR will be executed -before the exit handlers for \fBA\fR. -.PP -\fBTcl_Finalize\fR and \fBTcl_Exit\fR call \fBTcl_FinalizeThread\fR -and the thread exit handlers \fIafter\fR -the process-wide exit handlers. This is because thread finalization shuts -down the I/O channel system, so any attempt at I/O by the global exit -handlers will vanish into the bitbucket. -.PP -\fBTcl_SetExitProc\fR installs an application exit handler, returning -the previously-installed application exit handler or NULL if no -application handler was installed. If an application exit handler is -installed, that exit handler takes over complete responsibility for -finalization of Tcl's subsystems via \fBTcl_Finalize\fR at an -appropriate time. The argument passed to \fIproc\fR when it is -invoked will be the exit status code (as passed to \fBTcl_Exit\fR) -cast to a ClientData value. -.SH "SEE ALSO" -exit(n) -.SH KEYWORDS -abort, callback, cleanup, dynamic loading, end application, exit, unloading, thread diff --git a/doc/ExprLong.3 b/doc/ExprLong.3 deleted file mode 100644 index 0d369ce..0000000 --- a/doc/ExprLong.3 +++ /dev/null @@ -1,106 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_ExprLong 3 7.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString \- evaluate an expression -.SH SYNOPSIS -.nf -\fB#include \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 -value-based procedures \fBTcl_ExprLongObj\fR, \fBTcl_ExprDoubleObj\fR, -\fBTcl_ExprBooleanObj\fR, and \fBTcl_ExprObj\fR. -Those value-based procedures evaluate an expression held in a Tcl value -instead of a string. -The value argument can retain an internal representation -that is more efficient to execute. -.PP -The \fIinterp\fR argument refers to an interpreter used to -evaluate the expression (e.g. for variables and nested Tcl -commands) and to return error information. -.PP -For all of these procedures the return value is a standard -Tcl result: \fBTCL_OK\fR means the expression was successfully -evaluated, and \fBTCL_ERROR\fR means that an error occurred while -evaluating the expression. -If \fBTCL_ERROR\fR is returned then -the interpreter's result will hold a message describing the error. -If an error occurs while executing a Tcl command embedded in -the expression then that error will be returned. -.PP -If the expression is successfully evaluated, then its value is -returned in one of four forms, depending on which procedure -is invoked. -\fBTcl_ExprLong\fR stores an integer value at \fI*longPtr\fR. -If the expression's actual value is a floating-point number, -then it is truncated to an integer. -If the expression's actual value is a non-numeric string then -an error is returned. -.PP -\fBTcl_ExprDouble\fR stores a floating-point value at \fI*doublePtr\fR. -If the expression's actual value is an integer, it is converted to -floating-point. -If the expression's actual value is a non-numeric string then -an error is returned. -.PP -\fBTcl_ExprBoolean\fR stores a 0/1 integer value at \fI*booleanPtr\fR. -If the expression's actual value is an integer or floating-point -number, then they store 0 at \fI*booleanPtr\fR if -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 -.QW yes -or -.QW 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, value, string diff --git a/doc/ExprLongObj.3 b/doc/ExprLongObj.3 deleted file mode 100644 index 837e0a8..0000000 --- a/doc/ExprLongObj.3 +++ /dev/null @@ -1,106 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_ExprLongObj 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_ExprLongObj, Tcl_ExprDoubleObj, Tcl_ExprBooleanObj, Tcl_ExprObj \- evaluate an expression -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_ExprLongObj\fR(\fIinterp, objPtr, longPtr\fR) -.sp -int -\fBTcl_ExprDoubleObj\fR(\fIinterp, objPtr, doublePtr\fR) -.sp -int -\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 a value 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 -expression. -.AP int *booleanPtr out -Pointer to location in which to store the 0/1 boolean value of the -expression. -.AP Tcl_Obj **resultPtrPtr out -Pointer to location in which to store a pointer to the value -that is the result of the expression. -.BE - -.SH DESCRIPTION -.PP -These four procedures all evaluate an expression, returning -the result in one of four different forms. -The expression is given by the \fIobjPtr\fR argument, and it -can have any of the forms accepted by the \fBexpr\fR command. -.PP -The \fIinterp\fR argument refers to an interpreter used to -evaluate the expression (e.g. for variables and nested Tcl -commands) and to return error information. -.PP -For all of these procedures the return value is a standard -Tcl result: \fBTCL_OK\fR means the expression was successfully -evaluated, and \fBTCL_ERROR\fR means that an error occurred while -evaluating the expression. -If \fBTCL_ERROR\fR is returned, -then a message describing the error -can be retrieved using \fBTcl_GetObjResult\fR. -If an error occurs while executing a Tcl command embedded in -the expression then that error will be returned. -.PP -If the expression is successfully evaluated, then its value is -returned in one of four forms, depending on which procedure -is invoked. -\fBTcl_ExprLongObj\fR stores an integer value at \fI*longPtr\fR. -If the expression's actual value is a floating-point number, -then it is truncated to an integer. -If the expression's actual value is a non-numeric string then -an error is returned. -.PP -\fBTcl_ExprDoubleObj\fR stores a floating-point value at \fI*doublePtr\fR. -If the expression's actual value is an integer, it is converted to -floating-point. -If the expression's actual value is a non-numeric string then -an error is returned. -.PP -\fBTcl_ExprBooleanObj\fR stores a 0/1 integer value at \fI*booleanPtr\fR. -If the expression's actual value is an integer or floating-point -number, then they store 0 at \fI*booleanPtr\fR if -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 -.QW yes -or -.QW no , -or else an error occurs. -.PP -If \fBTcl_ExprObj\fR successfully evaluates the expression, -it stores a pointer to the Tcl value -containing the expression's value at \fI*resultPtrPtr\fR. -In this case, the caller is responsible for calling -\fBTcl_DecrRefCount\fR to decrement the value's reference count -when it is finished with the value. - -.SH "SEE ALSO" -Tcl_ExprLong, Tcl_ExprDouble, Tcl_ExprBoolean, Tcl_ExprString, Tcl_GetObjResult - -.SH KEYWORDS -boolean, double, evaluate, expression, integer, value, string diff --git a/doc/FileSystem.3 b/doc/FileSystem.3 deleted file mode 100644 index 28ee8f0..0000000 --- a/doc/FileSystem.3 +++ /dev/null @@ -1,1644 +0,0 @@ -'\" -'\" Copyright (c) 2001 Vincent Darley -'\" Copyright (c) 2008-2010 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Filesystem 3 8.4 Tcl "Tcl Library Procedures" -.so man.macros -.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_FSEvalFileEx, Tcl_FSLoadFile, Tcl_FSUnloadFile, 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_GetAccessTimeFromStat, Tcl_GetBlockSizeFromStat, Tcl_GetBlocksFromStat, Tcl_GetChangeTimeFromStat, Tcl_GetDeviceTypeFromStat, Tcl_GetFSDeviceFromStat, Tcl_GetFSInodeFromStat, Tcl_GetGroupIdFromStat, Tcl_GetLinkCountFromStat, Tcl_GetModeFromStat, Tcl_GetModificationTimeFromStat, Tcl_GetSizeFromStat, Tcl_GetUserIdFromStat, Tcl_AllocStatBuf \- procedures to interact with any filesystem -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_FSRegister\fR(\fIclientData, fsPtr\fR) -.sp -int -\fBTcl_FSUnregister\fR(\fIfsPtr\fR) -.sp -ClientData -\fBTcl_FSData\fR(\fIfsPtr\fR) -.sp -void -\fBTcl_FSMountsChanged\fR(\fIfsPtr\fR) -.sp -const Tcl_Filesystem * -\fBTcl_FSGetFileSystemForPath\fR(\fIpathPtr\fR) -.sp -Tcl_PathType -\fBTcl_FSGetPathType\fR(\fIpathPtr\fR) -.sp -int -\fBTcl_FSCopyFile\fR(\fIsrcPathPtr, destPathPtr\fR) -.sp -int -\fBTcl_FSCopyDirectory\fR(\fIsrcPathPtr, destPathPtr, errorPtr\fR) -.sp -int -\fBTcl_FSCreateDirectory\fR(\fIpathPtr\fR) -.sp -int -\fBTcl_FSDeleteFile\fR(\fIpathPtr\fR) -.sp -int -\fBTcl_FSRemoveDirectory\fR(\fIpathPtr, int recursive, errorPtr\fR) -.sp -int -\fBTcl_FSRenameFile\fR(\fIsrcPathPtr, destPathPtr\fR) -.sp -Tcl_Obj * -\fBTcl_FSListVolumes\fR(\fIvoid\fR) -.sp -int -\fBTcl_FSEvalFileEx\fR(\fIinterp, pathPtr, encodingName\fR) -.sp -int -\fBTcl_FSEvalFile\fR(\fIinterp, pathPtr\fR) -.sp -int -\fBTcl_FSLoadFile\fR(\fIinterp, pathPtr, sym1, sym2, proc1Ptr, proc2Ptr, - loadHandlePtr, unloadProcPtr\fR) -.sp -.VS 8.6 -int -\fBTcl_FSUnloadFile\fR(\fIinterp, loadHandle\fR) -.VE 8.6 -.sp -int -\fBTcl_FSMatchInDirectory\fR(\fIinterp, resultPtr, pathPtr, pattern, types\fR) -.sp -Tcl_Obj * -\fBTcl_FSLink\fR(\fIlinkNamePtr, toPtr, linkAction\fR) -.sp -int -\fBTcl_FSLstat\fR(\fIpathPtr, statPtr\fR) -.sp -int -\fBTcl_FSUtime\fR(\fIpathPtr, tval\fR) -.sp -int -\fBTcl_FSFileAttrsGet\fR(\fIinterp, int index, pathPtr, objPtrRef\fR) -.sp -int -\fBTcl_FSFileAttrsSet\fR(\fIinterp, int index, pathPtr, Tcl_Obj *objPtr\fR) -.sp -const char *const * -\fBTcl_FSFileAttrStrings\fR(\fIpathPtr, objPtrRef\fR) -.sp -int -\fBTcl_FSStat\fR(\fIpathPtr, statPtr\fR) -.sp -int -\fBTcl_FSAccess\fR(\fIpathPtr, mode\fR) -.sp -Tcl_Channel -\fBTcl_FSOpenFileChannel\fR(\fIinterp, pathPtr, modeString, permissions\fR) -.sp -Tcl_Obj * -\fBTcl_FSGetCwd\fR(\fIinterp\fR) -.sp -int -\fBTcl_FSChdir\fR(\fIpathPtr\fR) -.sp -Tcl_Obj * -\fBTcl_FSPathSeparator\fR(\fIpathPtr\fR) -.sp -Tcl_Obj * -\fBTcl_FSJoinPath\fR(\fIlistObj, elements\fR) -.sp -Tcl_Obj * -\fBTcl_FSSplitPath\fR(\fIpathPtr, lenPtr\fR) -.sp -int -\fBTcl_FSEqualPaths\fR(\fIfirstPtr, secondPtr\fR) -.sp -Tcl_Obj * -\fBTcl_FSGetNormalizedPath\fR(\fIinterp, pathPtr\fR) -.sp -Tcl_Obj * -\fBTcl_FSJoinToPath\fR(\fIbasePtr, objc, objv\fR) -.sp -int -\fBTcl_FSConvertToPathType\fR(\fIinterp, pathPtr\fR) -.sp -ClientData -\fBTcl_FSGetInternalRep\fR(\fIpathPtr, fsPtr\fR) -.sp -Tcl_Obj * -\fBTcl_FSGetTranslatedPath\fR(\fIinterp, pathPtr\fR) -.sp -const char * -\fBTcl_FSGetTranslatedStringPath\fR(\fIinterp, pathPtr\fR) -.sp -Tcl_Obj * -\fBTcl_FSNewNativePath\fR(\fIfsPtr, clientData\fR) -.sp -const void * -\fBTcl_FSGetNativePath\fR(\fIpathPtr\fR) -.sp -Tcl_Obj * -\fBTcl_FSFileSystemInfo\fR(\fIpathPtr\fR) -.sp -Tcl_StatBuf * -\fBTcl_AllocStatBuf\fR() -.sp -.VS 8.6 -Tcl_WideInt -\fBTcl_GetAccessTimeFromStat\fR(\fIstatPtr\fR) -.sp -unsigned -\fBTcl_GetBlockSizeFromStat\fR(\fIstatPtr\fR) -.sp -Tcl_WideUInt -\fBTcl_GetBlocksFromStat\fR(\fIstatPtr\fR) -.sp -Tcl_WideInt -\fBTcl_GetChangeTimeFromStat\fR(\fIstatPtr\fR) -.sp -int -\fBTcl_GetDeviceTypeFromStat\fR(\fIstatPtr\fR) -.sp -unsigned -\fBTcl_GetFSDeviceFromStat\fR(\fIstatPtr\fR) -.sp -unsigned -\fBTcl_GetFSInodeFromStat\fR(\fIstatPtr\fR) -.sp -int -\fBTcl_GetGroupIdFromStat\fR(\fIstatPtr\fR) -.sp -int -\fBTcl_GetLinkCountFromStat\fR(\fIstatPtr\fR) -.sp -unsigned -\fBTcl_GetModeFromStat\fR(\fIstatPtr\fR) -.sp -Tcl_WideInt -\fBTcl_GetModificationTimeFromStat\fR(\fIstatPtr\fR) -.sp -Tcl_WideUInt -\fBTcl_GetSizeFromStat\fR(\fIstatPtr\fR) -.sp -int -\fBTcl_GetUserIdFromStat\fR(\fIstatPtr\fR) -.VE 8.6 -.SH ARGUMENTS -.AS Tcl_GlobTypeData **srcPathPtr out -.AP "const Tcl_Filesystem" *fsPtr in -Points to a structure containing the addresses of procedures that -can be called to perform the various filesystem operations. -.AP Tcl_Obj *pathPtr in -The path represented by this value is used for the operation in -question. If the value does not already have an internal \fBpath\fR -representation, it will be converted to have one. -.AP Tcl_Obj *srcPathPtr in -As for \fIpathPtr\fR, but used for the source file for a copy or -rename operation. -.AP Tcl_Obj *destPathPtr in -As for \fIpathPtr\fR, but used for the destination filename for a copy or -rename operation. -.AP "const char" *encodingName in -The encoding of the data stored in the -file identified by \fIpathPtr\fR and to be evaluated. -.AP "const char" *pattern in -Only files or directories matching this pattern will be returned. -.AP Tcl_GlobTypeData *types in -Only files or directories matching the type descriptions contained in -this structure will be returned. This parameter may be NULL. -.AP Tcl_Interp *interp in -Interpreter to use either for results, evaluation, or reporting error -messages. -.AP ClientData clientData in -The native description of the path value to create. -.AP Tcl_Obj *firstPtr in -The first of two path values to compare. The value may be converted -to \fBpath\fR type. -.AP Tcl_Obj *secondPtr in -The second of two path values to compare. The value may be converted -to \fBpath\fR type. -.AP Tcl_Obj *listObj in -The list of path elements to operate on with a \fBjoin\fR operation. -.AP int elements in -If non-negative, the number of elements in the \fIlistObj\fR which should -be joined together. If negative, then all elements are joined. -.AP Tcl_Obj **errorPtr out -In the case of an error, filled with a value containing the name of -the file which caused an error in the various copy/rename operations. -.AP Tcl_Obj **objPtrRef out -Filled with a value containing the result of the operation. -.AP Tcl_Obj *resultPtr out -Pre-allocated value in which to store (using -\fBTcl_ListObjAppendElement\fR) the list of -files or directories which are successfully matched. -.AP int mode in -Mask consisting of one or more of R_OK, W_OK, X_OK and F_OK. R_OK, -W_OK and X_OK request checking whether the file exists and has read, -write and execute permissions, respectively. F_OK just requests -checking for the existence of the file. -.AP Tcl_StatBuf *statPtr out -The structure that contains the result of a stat or lstat operation. -.AP "const char" *sym1 in -Name of a procedure to look up in the file's symbol table -.AP "const char" *sym2 in -Name of a procedure to look up in the file's symbol table -.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 *loadHandlePtr 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 Tcl_LoadHandle loadHandle in -Handle to the loaded library to be unloaded. -.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 -allowed for the \fImode\fR argument to the Tcl \fBopen\fR command. -.AP int permissions in -POSIX-style permission flags such as 0644. If a new file is created, these -permissions will be set on the created file. -.AP int *lenPtr out -If non-NULL, filled with the number of elements in the split path. -.AP Tcl_Obj *basePtr in -The base path on to which to join the given elements. May be NULL. -.AP int objc in -The number of elements in \fIobjv\fR. -.AP "Tcl_Obj *const" objv[] in -The elements to join to the given base path. -.AP Tcl_Obj *linkNamePtr in -The name of the link to be created or read. -.AP Tcl_Obj *toPtr in -What the link called \fIlinkNamePtr\fR should be linked to, or NULL if -the symbolic link specified by \fIlinkNamePtr\fR is to be read. -.AP int linkAction in -OR-ed combination of flags indicating what kind of link should be -created (will be ignored if \fItoPtr\fR is NULL). Valid bits to set -are \fBTCL_CREATE_SYMBOLIC_LINK\fR and \fBTCL_CREATE_HARD_LINK\fR. -When both flags are set and the underlying filesystem can do either, -symbolic links are preferred. -.BE -.SH DESCRIPTION -.PP -There are several reasons for calling the \fBTcl_FS\fR API functions -(e.g.\ \fBTcl_FSAccess\fR and \fBTcl_FSStat\fR) -rather than calling system level functions like \fBaccess\fR and -\fBstat\fR directly. First, they will work cross-platform, so an -extension which calls them should work unmodified on Unix and -Windows. Second, the Windows implementation of some of these functions -fixes some bugs in the system level calls. Third, these function calls -deal with any -.QW "Utf to platform-native" -path conversions which may be -required (and may cache the results of such conversions for greater -efficiency on subsequent calls). Fourth, and perhaps most importantly, -all of these functions are -.QW "virtual filesystem aware" . -Any virtual filesystem (VFS for short) which has been registered (through -\fBTcl_FSRegister\fR) may reroute file access to alternative -media or access methods. This means that all of these functions (and -therefore the corresponding \fBfile\fR, \fBglob\fR, \fBpwd\fR, \fBcd\fR, -\fBopen\fR, etc.\ Tcl commands) may be operate on -.QW files -which are not -native files in the native filesystem. This also means that any Tcl -extension which accesses the filesystem (FS for short) through this API is -automatically -.QW "virtual filesystem aware" . -Of course, if an extension -accesses the native filesystem directly (through platform-specific -APIs, for example), then Tcl cannot intercept such calls. -.PP -If appropriate VFSes have been registered, the -.QW files -may, to give two -examples, be remote (e.g.\ situated on a remote ftp server) or archived -(e.g.\ lying inside a .zip archive). Such registered filesystems provide -a lookup table of functions to implement all or some of the functionality -listed here. Finally, the \fBTcl_FSStat\fR and \fBTcl_FSLstat\fR calls -abstract away from what the -.QW "struct stat" -buffer is actually -declared to be, allowing the same code to be used both on systems with -and systems without support for files larger than 2GB in size. -.PP -The \fBTcl_FS\fR API is \fBTcl_Obj\fR-ified and may cache internal -representations and other path-related strings (e.g.\ the current working -directory). One side-effect of this is that one must not pass in values -with a reference count of zero to any of these functions. If such calls were -handled, they might result -in memory leaks (under some circumstances, the filesystem code may wish -to retain a reference to the passed in value, and so one must not assume -that after any of these calls return, the value still has a reference count of -zero - it may have been incremented) or in a direct segmentation fault -(or other memory access error) -due to the value being freed part way through the complex value -manipulation required to ensure that the path is fully normalized and -absolute for filesystem determination. The practical lesson to learn -from this is that -.PP -.CS -Tcl_Obj *path = Tcl_NewStringObj(...); -Tcl_FS\fIWhatever\fR(path); -Tcl_DecrRefCount(path); -.CE -.PP -is wrong, and may cause memory errors. The \fIpath\fR must have its -reference count incremented before passing it in, or -decrementing it. For this reason, values with a reference count of zero are -considered not to be valid filesystem paths and calling any Tcl_FS API -function with such a value will result in no action being taken. -.SS "FS API FUNCTIONS" -\fBTcl_FSCopyFile\fR attempts to copy the file given by \fIsrcPathPtr\fR to the -path name given by \fIdestPathPtr\fR. If the two paths given lie in the same -filesystem (according to \fBTcl_FSGetFileSystemForPath\fR) then that -filesystem's -.QW "copy file" -function is called (if it is non-NULL). -Otherwise the function returns -1 and sets the \fBerrno\fR global C -variable to the -.QW EXDEV -POSIX error code (which signifies a -.QW "cross-domain link" ). -.PP -\fBTcl_FSCopyDirectory\fR attempts to copy the directory given by \fIsrcPathPtr\fR to the -path name given by \fIdestPathPtr\fR. If the two paths given lie in the same -filesystem (according to \fBTcl_FSGetFileSystemForPath\fR) then that -filesystem's -.QW "copy file" -function is called (if it is non-NULL). -Otherwise the function returns -1 and sets the \fBerrno\fR global C -variable to the -.QW EXDEV -POSIX error code (which signifies a -.QW "cross-domain link" ). -.PP -\fBTcl_FSCreateDirectory\fR attempts to create the directory given by -\fIpathPtr\fR by calling the owning filesystem's -.QW "create directory" -function. -.PP -\fBTcl_FSDeleteFile\fR attempts to delete the file given by -\fIpathPtr\fR by calling the owning filesystem's -.QW "delete file" -function. -.PP -\fBTcl_FSRemoveDirectory\fR attempts to remove the directory given by -\fIpathPtr\fR by calling the owning filesystem's -.QW "remove directory" -function. -.PP -\fBTcl_FSRenameFile\fR attempts to rename the file or directory given by -\fIsrcPathPtr\fR to the path name given by \fIdestPathPtr\fR. If the two paths -given lie in the same filesystem (according to -\fBTcl_FSGetFileSystemForPath\fR) then that filesystem's -.QW "rename file" -function is called (if it is non-NULL). Otherwise the function returns -1 -and sets the \fBerrno\fR global C variable to the -.QW EXDEV -POSIX error code (which signifies a -.QW "cross-domain link" ). -.PP -\fBTcl_FSListVolumes\fR calls each filesystem which has a non-NULL -.QW "list volumes" -function and asks them to return their list of root volumes. It -accumulates the return values in a list which is returned to the -caller (with a reference count of 0). -.PP -\fBTcl_FSEvalFileEx\fR reads the file given by \fIpathPtr\fR using -the encoding identified by \fIencodingName\fR and evaluates -its contents as a Tcl script. It returns the same information as -\fBTcl_EvalObjEx\fR. -If \fIencodingName\fR is NULL, the system encoding is used for -reading the file contents. -If the file could not be read then a Tcl error is returned to describe -why the file could not be read. -The eofchar for files is -.QW \e32 -(^Z) for all platforms. -If you require a -.QW ^Z -in code for string comparison, you can use -.QW \e032 -or -.QW \eu001a , -which will be safely substituted by the Tcl interpreter into -.QW ^Z . -\fBTcl_FSEvalFile\fR is a simpler version of -\fBTcl_FSEvalFileEx\fR that always uses the system encoding -when reading the file. -.PP -\fBTcl_FSLoadFile\fR dynamically loads a binary code file into memory and -returns the addresses of two procedures within that file, if they are -defined. The appropriate function for the filesystem to which \fIpathPtr\fR -belongs will be called. If that filesystem does not implement this -function (most virtual filesystems will not, because of OS limitations -in dynamically loading binary code), Tcl will attempt to copy the file -to a temporary directory and load that temporary file. -.VS 8.6 -\fBTcl_FSUnloadFile\fR reverses the operation, asking for the library -indicated by the \fIloadHandle\fR to be removed from the process. Note that, -unlike with the \fBunload\fR command, this does not give the library any -opportunity to clean up. -.VE 8.6 -.PP -Both the above functions return a standard Tcl completion code. If an error -occurs, an error message is left in the \fIinterp\fR's result. -.PP -.VS 8.6 -The token provided via the variable indicated by \fIloadHandlePtr\fR may be -used with \fBTcl_FindSymbol\fR. -.VE 8.6 -.PP -\fBTcl_FSMatchInDirectory\fR is used by the globbing code to search a -directory for all files which match a given pattern. The appropriate -function for the filesystem to which \fIpathPtr\fR belongs will be called. -.PP -The return value is a standard Tcl result indicating whether an error -occurred in globbing. Error messages are placed in interp (unless -interp is NULL, which is allowed), but good results are placed in the -resultPtr given. -.PP -Note that the \fBglob\fR code implements recursive patterns internally, so -this function will only ever be passed simple patterns, which can be -matched using the logic of \fBstring match\fR. To handle recursion, Tcl -will call this function frequently asking only for directories to be -returned. A special case of being called with a NULL pattern indicates -that the path needs to be checked only for the correct type. -.PP -\fBTcl_FSLink\fR replaces the library version of \fBreadlink\fR, and -extends it to support the creation of links. The appropriate function -for the filesystem to which \fIlinkNamePtr\fR belongs will be called. -.PP -If the \fItoPtr\fR is NULL, a -.QW "read link" -action is performed. The result -is a Tcl_Obj specifying the contents of the symbolic link given by -\fIlinkNamePtr\fR, or NULL if the link could not be read. The result is owned -by the caller, which should call \fBTcl_DecrRefCount\fR when the result is no -longer needed. If the \fItoPtr\fR is not NULL, Tcl should create a link -of one of the types passed in in the \fIlinkAction\fR flag. This flag is -an ORed combination of \fBTCL_CREATE_SYMBOLIC_LINK\fR and \fBTCL_CREATE_HARD_LINK\fR. -Where a choice exists (i.e.\ more than one flag is passed in), the Tcl -convention is to prefer symbolic links. When a link is successfully -created, the return value should be \fItoPtr\fR (which is therefore -already owned by the caller). If unsuccessful, NULL is returned. -.PP -\fBTcl_FSLstat\fR fills the \fITcl_StatBuf\fR structure \fIstatPtr\fR with -information about the specified file. You do not need any access rights to the -file to get this information but you need search rights to all -directories named in the path leading to the file. The \fITcl_StatBuf\fR -structure includes info regarding device, inode (always 0 on Windows), -privilege mode, nlink (always 1 on Windows), user id (always 0 on -Windows), group id (always 0 on Windows), rdev (same as device on -Windows), size, last access time, last modification time, and -last metadata change time. -See \fBPORTABLE STAT RESULT API\fR for a description of how to write -portable code to allocate and access the \fITcl_StatBuf\fR structure. -.PP -If \fIpath\fR exists, \fBTcl_FSLstat\fR returns 0 and the stat structure -is filled with data. Otherwise, -1 is returned, and no stat info is -given. -.PP -\fBTcl_FSUtime\fR replaces the library version of utime. -.PP -This returns 0 on success and -1 on error (as per the \fButime\fR -documentation). If successful, the function -will update the -.QW atime -and -.QW mtime -values of the file given. -.PP -\fBTcl_FSFileAttrsGet\fR implements read access for the hookable \fBfile -attributes\fR subcommand. The appropriate function for the filesystem to -which \fIpathPtr\fR belongs will be called. -.PP -If the result is \fBTCL_OK\fR, then a value was placed in -\fIobjPtrRef\fR, which -will only be temporarily valid (unless \fBTcl_IncrRefCount\fR is called). -.PP -\fBTcl_FSFileAttrsSet\fR implements write access for the hookable \fBfile -attributes\fR subcommand. The appropriate function for the filesystem to -which \fIpathPtr\fR belongs will be called. -.PP -\fBTcl_FSFileAttrStrings\fR implements part of the hookable \fBfile -attributes\fR subcommand. The appropriate function for the filesystem -to which \fIpathPtr\fR belongs will be called. -.PP -The called procedure may either return an array of strings, or may -instead return NULL and place a Tcl list into the given \fIobjPtrRef\fR. Tcl -will take that list and first increment its reference count before using it. -On completion of that use, Tcl will decrement its reference count. Hence if -the list should be disposed of by Tcl when done, it should have a -reference count of zero, and if the list should not be disposed of, the -filesystem should ensure it retains a reference count to the value. -.PP -\fBTcl_FSAccess\fR checks whether the process would be allowed to read, -write or test for existence of the file (or other filesystem object) -whose name is \fIpathname\fR. If \fIpathname\fR is a symbolic link on Unix, -then permissions of the file referred by this symbolic link are -tested. -.PP -On success (all requested permissions granted), zero is returned. On -error (at least one bit in mode asked for a permission that is denied, -or some other error occurred), -1 is returned. -.PP -\fBTcl_FSStat\fR fills the \fITcl_StatBuf\fR structure \fIstatPtr\fR with -information about the specified file. You do not need any access rights to the -file to get this information but you need search rights to all -directories named in the path leading to the file. The \fITcl_StatBuf\fR -structure includes info regarding device, inode (always 0 on Windows), -privilege mode, nlink (always 1 on Windows), user id (always 0 on -Windows), group id (always 0 on Windows), rdev (same as device on -Windows), size, last access time, last modification time, and -last metadata change time. -See \fBPORTABLE STAT RESULT API\fR for a description of how to write -portable code to allocate and access the \fITcl_StatBuf\fR structure. -.PP -If \fIpath\fR exists, \fBTcl_FSStat\fR returns 0 and the stat structure -is filled with data. Otherwise, -1 is returned, and no stat info is -given. -.PP -\fBTcl_FSOpenFileChannel\fR opens a file specified by \fIpathPtr\fR and -returns a channel handle that can be used to perform input and output on -the file. This API is modeled after the \fBfopen\fR procedure of -the Unix standard I/O library. -The syntax and meaning of all arguments is similar to those -given in the Tcl \fBopen\fR command when opening a file. -If an error occurs while opening the channel, \fBTcl_FSOpenFileChannel\fR -returns NULL and records a POSIX error code that can be -retrieved with \fBTcl_GetErrno\fR. -In addition, if \fIinterp\fR is non-NULL, \fBTcl_FSOpenFileChannel\fR -leaves an error message in \fIinterp\fR's result after any error. -.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\fR, \fBstdout\fR or \fBstderr\fR was -previously closed, the act of creating the new channel also assigns it as a -replacement for the standard channel. -.PP -\fBTcl_FSGetCwd\fR replaces the library version of \fBgetcwd\fR. -.PP -It returns the Tcl library's current working directory. This may be -different to the native platform's working directory, which happens when -the current working directory is not in the native filesystem. -.PP -The result is a pointer to a Tcl_Obj specifying the current directory, -or NULL if the current directory could not be determined. If NULL is -returned, an error message is left in the \fIinterp\fR's result. -.PP -The result already has its reference count incremented for the caller. When -it is no longer needed, that reference count should be decremented. This is -needed for thread-safety purposes, to allow multiple threads to access -this and related functions, while ensuring the results are always -valid. -.PP -\fBTcl_FSChdir\fR replaces the library version of \fBchdir\fR. The path is -normalized and then passed to the filesystem which claims it. If that -filesystem does not implement this function, Tcl will fallback to a -combination of \fBstat\fR and \fBaccess\fR to check whether the directory -exists and has appropriate permissions. -.PP -For results, see \fBchdir\fR documentation. If successful, we keep a -record of the successful path in \fIcwdPathPtr\fR for subsequent calls to -\fBTcl_FSGetCwd\fR. -.PP -\fBTcl_FSPathSeparator\fR returns the separator character to be used for -most specific element of the path specified by \fIpathPtr\fR (i.e.\ the last -part of the path). -.PP -The separator is returned as a Tcl_Obj containing a string of length -1. If the path is invalid, NULL is returned. -.PP -\fBTcl_FSJoinPath\fR takes the given Tcl_Obj, which must be a valid -list (which is allowed to have a reference count of zero), and returns the path -value given by considering the first \fIelements\fR elements as valid path -segments (each path segment may be a complete path, a partial path or -just a single possible directory or file name). If any path segment is -actually an absolute path, then all prior path segments are discarded. -If \fIelements\fR is less than 0, we use the entire list. -.PP -It is possible that the returned value is actually an element -of the given list, so the caller should be careful to increment the -reference count of the result before freeing the list. -.PP -The returned value, typically with a reference count of zero (but it -could be shared -under some conditions), contains the joined path. The caller must -add a reference count to the value before using it. In particular, the -returned value could be an element of the given list, so freeing the -list might free the value prematurely if no reference count has been taken. -If the number of elements is zero, then the returned value will be -an empty-string Tcl_Obj. -.PP -\fBTcl_FSSplitPath\fR takes the given Tcl_Obj, which should be a valid path, -and returns a Tcl list value containing each segment of that path as -an element. -It returns a list value with a reference count of zero. If the -passed in \fIlenPtr\fR is non-NULL, the variable it points to will be -updated to contain the number of elements in the returned list. -.PP -\fBTcl_FSEqualPaths\fR tests whether the two paths given represent the same -filesystem object. -It returns 1 if the paths are equal, and 0 if they are different. If -either path is NULL, 0 is always returned. -.PP -\fBTcl_FSGetNormalizedPath\fR this important function attempts to extract -from the given Tcl_Obj a unique normalized path representation, whose -string value can be used as a unique identifier for the file. -.PP -It returns the normalized path value, owned by Tcl, or NULL if the path -was invalid or could otherwise not be successfully converted. -Extraction of absolute, normalized paths is very efficient (because the -filesystem operates on these representations internally), although the -result when the filesystem contains numerous symbolic links may not be -the most user-friendly version of a path. The return value is owned by -Tcl and has a lifetime equivalent to that of the \fIpathPtr\fR passed in -(unless that is a relative path, in which case the normalized path -value may be freed any time the cwd changes) - the caller can of -course increment the reference count if it wishes to maintain a copy for longer. -.PP -\fBTcl_FSJoinToPath\fR takes the given value, which should usually be a -valid path or NULL, and joins onto it the array of paths segments -given. -.PP -Returns a value, typically with reference count of zero (but it could be shared -under some conditions), containing the joined path. The caller must -add a reference count to the value before using it. If any of the values -passed into this function (\fIpathPtr\fR or \fIpath\fR elements) have -a reference count -of zero, they will be freed when this function returns. -.PP -\fBTcl_FSConvertToPathType\fR tries to convert the given Tcl_Obj to a valid -Tcl path type, taking account of the fact that the cwd may have changed -even if this value is already supposedly of the correct type. -The filename may begin with -.QW ~ -(to indicate current user's home directory) or -.QW ~ -(to indicate any user's home directory). -.PP -If the conversion succeeds (i.e.\ the value is a valid path in one of -the current filesystems), then \fBTCL_OK\fR is returned. Otherwise -\fBTCL_ERROR\fR is returned, and an error message may -be left in the interpreter. -.PP -\fBTcl_FSGetInternalRep\fR extracts the internal representation of a given -path value, in the given filesystem. If the path value belongs to a -different filesystem, we return NULL. If the internal representation is -currently NULL, we attempt to generate it, by calling the filesystem's -\fBTcl_FSCreateInternalRepProc\fR. -.PP -Returns NULL or a valid internal path representation. This internal -representation is cached, so that repeated calls to this function will -not require additional conversions. -.PP -\fBTcl_FSGetTranslatedPath\fR attempts to extract the translated path -from the given Tcl_Obj. -.PP -If the translation succeeds (i.e.\ the value is a valid path), then it is -returned. Otherwise NULL will be returned, and an error message may be -left in the interpreter. A -.QW translated -path is one which contains no -.QW ~ -or -.QW ~user -sequences (these have been expanded to their current -representation in the filesystem). The value returned is owned by the -caller, which must store it or call \fBTcl_DecrRefCount\fR to ensure memory is -freed. This function is of little practical use, and -\fBTcl_FSGetNormalizedPath\fR or \fBTcl_FSGetNativePath\fR are usually -better functions to use for most purposes. -.PP -\fBTcl_FSGetTranslatedStringPath\fR does the same as -\fBTcl_FSGetTranslatedPath\fR, but returns a character string or NULL. -The string returned is dynamically allocated and owned by the caller, -which must store it or call \fBckfree\fR to ensure it is freed. Again, -\fBTcl_FSGetNormalizedPath\fR or \fBTcl_FSGetNativePath\fR are usually -better functions to use for most purposes. -.PP -\fBTcl_FSNewNativePath\fR performs something like the reverse of the -usual obj->path->nativerep conversions. If some code retrieves a path -in native form (from, e.g.\ \fBreadlink\fR or a native dialog), and that path -is to be used at the Tcl level, then calling this function is an -efficient way of creating the appropriate path value type. -.PP -The resulting value is a pure -.QW path -value, which will only receive -a UTF-8 string representation if that is required by some Tcl code. -.PP -\fBTcl_FSGetNativePath\fR is for use by the Win/Unix native -filesystems, so that they can easily retrieve the native (char* or -TCHAR*) representation of a path. This function is a convenience -wrapper around \fBTcl_FSGetInternalRep\fR. It may be desirable in the -future to have non-string-based native representations (for example, -on MacOSX, a representation using a fileSpec of FSRef structure would -probably be more efficient). On Windows a full Unicode representation -would allow for paths of unlimited length. Currently the representation -is simply a character string which may contain either the relative path -or a complete, absolute normalized path in the native encoding (complex -conditions dictate which of these will be provided, so neither can be -relied upon, unless the path is known to be absolute). If you need a -native path which must be absolute, then you should ask for the native -version of a normalized path. If for some reason a non-absolute, -non-normalized version of the path is needed, that must be constructed -separately (e.g.\ using \fBTcl_FSGetTranslatedPath\fR). -.PP -The native representation is cached so that repeated calls to this -function will not require additional conversions. The return value is -owned by Tcl and has a lifetime equivalent to that of the \fIpathPtr\fR -passed in (unless that is a relative path, in which case the native -representation may be freed any time the cwd changes). -.PP -\fBTcl_FSFileSystemInfo\fR returns a list of two elements. The first -element is the name of the filesystem (e.g. -.QW native , -.QW vfs , -.QW zip , -or -.QW prowrap , -perhaps), and the second is the particular type of the -given path within that filesystem (which is filesystem dependent). The -second element may be empty if the filesystem does not provide a -further categorization of files. -.PP -A valid list value is returned, unless the path value is not -recognized, when NULL will be returned. -.PP -\fBTcl_FSGetFileSystemForPath\fR returns a pointer to the -\fBTcl_Filesystem\fR which accepts this path as valid. -.PP -If no filesystem will accept the path, NULL is returned. -.PP -\fBTcl_FSGetPathType\fR determines whether the given path is relative -to the current directory, relative to the current volume, or -absolute. -.PP -It returns one of \fBTCL_PATH_ABSOLUTE\fR, \fBTCL_PATH_RELATIVE\fR, or -\fBTCL_PATH_VOLUME_RELATIVE\fR -.SS "PORTABLE STAT RESULT API" -.PP -\fBTcl_AllocStatBuf\fR allocates a \fITcl_StatBuf\fR on the system heap (which -may be deallocated by being passed to \fBckfree\fR). This allows extensions to -invoke \fBTcl_FSStat\fR and \fBTcl_FSLstat\fR without being dependent on the -size of the buffer. That in turn depends on the flags used to build Tcl. -.PP -.VS 8.6 -The portable fields of a \fITcl_StatBuf\fR may be read using the following -functions, each of which returns the value of the corresponding field listed -in the table below. Note that on some platforms there may be other fields in -the \fITcl_StatBuf\fR as it is an alias for a suitable system structure, but -only the portable ones are made available here. See your system documentation -for a full description of these fields. -.DS -.ta \w'\fBTcl_GetModificationTimeFromStat\fR\0\0\0\0'u -\fIAccess Function\fR \fIField\fR - \fBTcl_GetFSDeviceFromStat\fR st_dev - \fBTcl_GetFSInodeFromStat\fR st_ino - \fBTcl_GetModeFromStat\fR st_mode - \fBTcl_GetLinkCountFromStat\fR st_nlink - \fBTcl_GetUserIdFromStat\fR st_uid - \fBTcl_GetGroupIdFromStat\fR st_gid - \fBTcl_GetDeviceTypeFromStat\fR st_rdev - \fBTcl_GetAccessTimeFromStat\fR st_atime - \fBTcl_GetModificationTimeFromStat\fR st_mtime - \fBTcl_GetChangeTimeFromStat\fR st_ctime - \fBTcl_GetSizeFromStat\fR st_size - \fBTcl_GetBlocksFromStat\fR st_blocks - \fBTcl_GetBlockSizeFromStat\fR st_blksize -.DE -.VE 8.6 -.SH "THE VIRTUAL FILESYSTEM API" -.PP -A filesystem provides a \fBTcl_Filesystem\fR structure that contains -pointers to functions that implement the various operations on a -filesystem; these operations are invoked as needed by the generic -layer, which generally occurs through the functions listed above. -.PP -The \fBTcl_Filesystem\fR structures are manipulated using the following -methods. -.PP -\fBTcl_FSRegister\fR takes a pointer to a filesystem structure and an -optional piece of data to associated with that filesystem. On calling -this function, Tcl will attach the filesystem to the list of known -filesystems, and it will become fully functional immediately. Tcl does -not check if the same filesystem is registered multiple times (and in -general that is not a good thing to do). \fBTCL_OK\fR will be returned. -.PP -\fBTcl_FSUnregister\fR removes the given filesystem structure from -the list of known filesystems, if it is known, and returns \fBTCL_OK\fR. If -the filesystem is not currently registered, \fBTCL_ERROR\fR is returned. -.PP -\fBTcl_FSData\fR will return the ClientData associated with the given -filesystem, if that filesystem is registered. Otherwise it will -return NULL. -.PP -\fBTcl_FSMountsChanged\fR is used to inform the Tcl's core that -the set of mount points for the given (already registered) filesystem -have changed, and that cached file representations may therefore no -longer be correct. -.SS "THE TCL_FILESYSTEM STRUCTURE" -.PP -The \fBTcl_Filesystem\fR structure contains the following fields: -.PP -.CS -typedef struct Tcl_Filesystem { - const char *\fItypeName\fR; - int \fIstructureLength\fR; - Tcl_FSVersion \fIversion\fR; - Tcl_FSPathInFilesystemProc *\fIpathInFilesystemProc\fR; - Tcl_FSDupInternalRepProc *\fIdupInternalRepProc\fR; - Tcl_FSFreeInternalRepProc *\fIfreeInternalRepProc\fR; - Tcl_FSInternalToNormalizedProc *\fIinternalToNormalizedProc\fR; - Tcl_FSCreateInternalRepProc *\fIcreateInternalRepProc\fR; - Tcl_FSNormalizePathProc *\fInormalizePathProc\fR; - Tcl_FSFilesystemPathTypeProc *\fIfilesystemPathTypeProc\fR; - Tcl_FSFilesystemSeparatorProc *\fIfilesystemSeparatorProc\fR; - Tcl_FSStatProc *\fIstatProc\fR; - Tcl_FSAccessProc *\fIaccessProc\fR; - Tcl_FSOpenFileChannelProc *\fIopenFileChannelProc\fR; - Tcl_FSMatchInDirectoryProc *\fImatchInDirectoryProc\fR; - Tcl_FSUtimeProc *\fIutimeProc\fR; - Tcl_FSLinkProc *\fIlinkProc\fR; - Tcl_FSListVolumesProc *\fIlistVolumesProc\fR; - Tcl_FSFileAttrStringsProc *\fIfileAttrStringsProc\fR; - Tcl_FSFileAttrsGetProc *\fIfileAttrsGetProc\fR; - Tcl_FSFileAttrsSetProc *\fIfileAttrsSetProc\fR; - Tcl_FSCreateDirectoryProc *\fIcreateDirectoryProc\fR; - Tcl_FSRemoveDirectoryProc *\fIremoveDirectoryProc\fR; - Tcl_FSDeleteFileProc *\fIdeleteFileProc\fR; - Tcl_FSCopyFileProc *\fIcopyFileProc\fR; - Tcl_FSRenameFileProc *\fIrenameFileProc\fR; - Tcl_FSCopyDirectoryProc *\fIcopyDirectoryProc\fR; - Tcl_FSLstatProc *\fIlstatProc\fR; - Tcl_FSLoadFileProc *\fIloadFileProc\fR; - Tcl_FSGetCwdProc *\fIgetCwdProc\fR; - Tcl_FSChdirProc *\fIchdirProc\fR; -} \fBTcl_Filesystem\fR; -.CE -.PP -Except for the first three fields in this structure which contain -simple data elements, all entries contain addresses of functions called -by the generic filesystem layer to perform the complete range of -filesystem related actions. -.PP -The many functions in this structure are broken down into three -categories: infrastructure functions (almost all of which must be -implemented), operational functions (which must be implemented if a -complete filesystem is provided), and efficiency functions (which need -only be implemented if they can be done so efficiently, or if they have -side-effects which are required by the filesystem; Tcl has less -efficient emulations it can fall back on). It is important to note -that, in the current version of Tcl, most of these fallbacks are only -used to handle commands initiated in Tcl, not in C. What this means is, -that if a \fBfile rename\fR command is issued in Tcl, and the relevant -filesystem(s) do not implement their \fITcl_FSRenameFileProc\fR, Tcl's -core will instead fallback on a combination of other filesystem -functions (it will use \fITcl_FSCopyFileProc\fR followed by -\fITcl_FSDeleteFileProc\fR, and if \fITcl_FSCopyFileProc\fR is not -implemented there is a further fallback). However, if a -\fITcl_FSRenameFileProc\fR command is issued at the C level, no such -fallbacks occur. This is true except for the last four entries in the -filesystem table (\fBlstat\fR, \fBload\fR, \fBgetcwd\fR and \fBchdir\fR) -for which fallbacks do in fact occur at the C level. -.PP -Any functions which take path names in Tcl_Obj form take -those names in UTF\-8 form. The filesystem infrastructure API is -designed to support efficient, cached conversion of these UTF\-8 paths -to other native representations. -.SS "EXAMPLE FILESYSTEM DEFINITION" -.PP -Here is the filesystem lookup table used by the -.QW vfs -extension which allows filesystem actions to be implemented in Tcl. -.PP -.CS -static Tcl_Filesystem vfsFilesystem = { - "tclvfs", - sizeof(Tcl_Filesystem), - TCL_FILESYSTEM_VERSION_1, - &VfsPathInFilesystem, - &VfsDupInternalRep, - &VfsFreeInternalRep, - /* No internal to normalized, since we don't create - * any pure 'internal' Tcl_Obj path representations */ - NULL, - /* No create native rep function, since we don't use - * it and don't choose to support uses of - * Tcl_FSNewNativePath */ - NULL, - /* Normalize path isn't needed - we assume paths only - * have one representation */ - NULL, - &VfsFilesystemPathType, - &VfsFilesystemSeparator, - &VfsStat, - &VfsAccess, - &VfsOpenFileChannel, - &VfsMatchInDirectory, - &VfsUtime, - /* We choose not to support symbolic links inside our - * VFS's */ - NULL, - &VfsListVolumes, - &VfsFileAttrStrings, - &VfsFileAttrsGet, - &VfsFileAttrsSet, - &VfsCreateDirectory, - &VfsRemoveDirectory, - &VfsDeleteFile, - /* No copy file; use the core fallback mechanism */ - NULL, - /* No rename file; use the core fallback mechanism */ - NULL, - /* No copy directory; use the core fallback mechanism */ - NULL, - /* Core will use stat for lstat */ - NULL, - /* No load; use the core fallback mechanism */ - NULL, - /* We don't need a getcwd or chdir; the core's own - * internal value is suitable */ - NULL, - NULL -}; -.CE -.SH "FILESYSTEM INFRASTRUCTURE" -.PP -These fields contain basic information about the filesystem structure -and addresses of functions which are used to associate -a particular filesystem with a file path, and deal with the internal -handling of path representations, for example copying and freeing such -representations. -.SS TYPENAME -.PP -The \fItypeName\fR field contains a null-terminated string that -identifies the type of the filesystem implemented, e.g. -.QW native , -.QW zip -or -.QW vfs . -.SS "STRUCTURE LENGTH" -.PP -The \fIstructureLength\fR field is generally implemented as -\fIsizeof(Tcl_Filesystem)\fR, and is there to allow easier -binary backwards compatibility if the size of the structure -changes in a future Tcl release. -.SS VERSION -.PP -The \fIversion\fR field should be set to \fBTCL_FILESYSTEM_VERSION_1\fR. -.SS PATHINFILESYSTEMPROC -.PP -The \fIpathInFilesystemProc\fR field contains the address of a function -which is called to determine whether a given path value belongs to this -filesystem or not. Tcl will only call the rest of the filesystem -functions with a path for which this function has returned \fBTCL_OK\fR. -If the path does not belong, -1 should be returned (the behavior of Tcl -for any other return value is not defined). If \fBTCL_OK\fR is returned, -then the optional \fIclientDataPtr\fR output parameter can be used to -return an internal (filesystem specific) representation of the path, -which will be cached inside the path value, and may be retrieved -efficiently by the other filesystem functions. Tcl will simultaneously -cache the fact that this path belongs to this filesystem. Such caches -are invalidated when filesystem structures are added or removed from -Tcl's internal list of known filesystems. -.PP -.CS -typedef int \fBTcl_FSPathInFilesystemProc\fR( - Tcl_Obj *\fIpathPtr\fR, - ClientData *\fIclientDataPtr\fR); -.CE -.SS DUPINTERNALREPPROC -.PP -This function makes a copy of a path's internal representation, and is -called when Tcl needs to duplicate a path value. If NULL, Tcl will -simply not copy the internal representation, which may then need to be -regenerated later. -.PP -.CS -typedef ClientData \fBTcl_FSDupInternalRepProc\fR( - ClientData \fIclientData\fR); -.CE -.SS FREEINTERNALREPPROC -Free the internal representation. This must be implemented if internal -representations need freeing (i.e.\ if some memory is allocated when an -internal representation is generated), but may otherwise be NULL. -.PP -.CS -typedef void \fBTcl_FSFreeInternalRepProc\fR( - ClientData \fIclientData\fR); -.CE -.SS INTERNALTONORMALIZEDPROC -.PP -Function to convert internal representation to a normalized path. Only -required if the filesystem creates pure path values with no string/path -representation. The return value is a Tcl value whose string -representation is the normalized path. -.PP -.CS -typedef Tcl_Obj *\fBTcl_FSInternalToNormalizedProc\fR( - ClientData \fIclientData\fR); -.CE -.SS CREATEINTERNALREPPROC -.PP -Function to take a path value, and calculate an internal -representation for it, and store that native representation in the -value. May be NULL if paths have no internal representation, or if -the \fITcl_FSPathInFilesystemProc\fR for this filesystem always -immediately creates an internal representation for paths it accepts. -.PP -.CS -typedef ClientData \fBTcl_FSCreateInternalRepProc\fR( - Tcl_Obj *\fIpathPtr\fR); -.CE -.SS NORMALIZEPATHPROC -.PP -Function to normalize a path. Should be implemented for all -filesystems which can have multiple string representations for the same -path value. In Tcl, every -.QW path -must have a single unique -.QW normalized -string representation. Depending on the filesystem, -there may be more than one unnormalized string representation which -refers to that path (e.g.\ a relative path, a path with different -character case if the filesystem is case insensitive, a path contain a -reference to a home directory such as -.QW ~ , -a path containing symbolic -links, etc). If the very last component in the path is a symbolic -link, it should not be converted into the value it points to (but -its case or other aspects should be made unique). All other path -components should be converted from symbolic links. This one -exception is required to agree with Tcl's semantics with \fBfile -delete\fR, \fBfile rename\fR, \fBfile copy\fR operating on symbolic links. -This function may be called with \fInextCheckpoint\fR either -at the beginning of the path (i.e.\ zero), at the end of the path, or -at any intermediate file separator in the path. It will never -point to any other arbitrary position in the path. In the last of -the three valid cases, the implementation can assume that the path -up to and including the file separator is known and normalized. -.PP -.CS -typedef int \fBTcl_FSNormalizePathProc\fR( - Tcl_Interp *\fIinterp\fR, - Tcl_Obj *\fIpathPtr\fR, - int \fInextCheckpoint\fR); -.CE -.SH "FILESYSTEM OPERATIONS" -.PP -The fields in this section of the structure contain addresses of -functions which are called to carry out the basic filesystem -operations. A filesystem which expects to be used with the complete -standard Tcl command set must implement all of these. If some of -them are not implemented, then certain Tcl commands may fail when -operating on paths within that filesystem. However, in some instances -this may be desirable (for example, a read-only filesystem should not -implement the last four functions, and a filesystem which does not -support symbolic links need not implement the \fBreadlink\fR function, -etc. The Tcl core expects filesystems to behave in this way). -.SS FILESYSTEMPATHTYPEPROC -.PP -Function to determine the type of a path in this filesystem. May be -NULL, in which case no type information will be available to users of -the filesystem. The -.QW type -is used only for informational purposes, -and should be returned as the string representation of the Tcl_Obj -which is returned. A typical return value might be -.QW networked , -.QW zip -or -.QW ftp . -The Tcl_Obj result is owned by the filesystem and so Tcl will -increment the reference count of that value if it wishes to retain a reference -to it. -.PP -.CS -typedef Tcl_Obj *\fBTcl_FSFilesystemPathTypeProc\fR( - Tcl_Obj *\fIpathPtr\fR); -.CE -.SS FILESYSTEMSEPARATORPROC -.PP -Function to return the separator character(s) for this filesystem. -This need only be implemented if the filesystem wishes to use a -different separator than the standard string -.QW / . -Amongst other -uses, it is returned by the \fBfile separator\fR command. The -return value should be a value with reference count of zero. -.PP -.CS -typedef Tcl_Obj *\fBTcl_FSFilesystemSeparatorProc\fR( - Tcl_Obj *\fIpathPtr\fR); -.CE -.SS STATPROC -.PP -Function to process a \fBTcl_FSStat\fR call. Must be implemented for any -reasonable filesystem, since many Tcl level commands depend crucially -upon it (e.g.\ \fBfile atime\fR, \fBfile isdirectory\fR, \fBfile size\fR, -\fBglob\fR). -.PP -.CS -typedef int \fBTcl_FSStatProc\fR( - Tcl_Obj *\fIpathPtr\fR, - Tcl_StatBuf *\fIstatPtr\fR); -.CE -.PP -The \fBTcl_FSStatProc\fR fills the stat structure \fIstatPtr\fR with -information about the specified file. You do not need any access -rights to the file to get this information but you need search rights -to all directories named in the path leading to the file. The stat -structure includes info regarding device, inode (always 0 on Windows), -privilege mode, nlink (always 1 on Windows), user id (always 0 on -Windows), group id (always 0 on Windows), rdev (same as device on -Windows), size, last access time, last modification time, and -last metadata change time. -.PP -If the file represented by \fIpathPtr\fR exists, the -\fBTcl_FSStatProc\fR returns 0 and the stat structure is filled with -data. Otherwise, -1 is returned, and no stat info is given. -.SS ACCESSPROC -.PP -Function to process a \fBTcl_FSAccess\fR call. Must be implemented for -any reasonable filesystem, since many Tcl level commands depend crucially -upon it (e.g.\ \fBfile exists\fR, \fBfile readable\fR). -.PP -.CS -typedef int \fBTcl_FSAccessProc\fR( - Tcl_Obj *\fIpathPtr\fR, - int \fImode\fR); -.CE -.PP -The \fBTcl_FSAccessProc\fR checks whether the process would be allowed -to read, write or test for existence of the file (or other filesystem -object) whose name is in \fIpathPtr\fR. If the pathname refers to a -symbolic link, then the -permissions of the file referred by this symbolic link should be tested. -.PP -On success (all requested permissions granted), zero is returned. On -error (at least one bit in mode asked for a permission that is denied, -or some other error occurred), -1 is returned. -.SS OPENFILECHANNELPROC -.PP -Function to process a \fBTcl_FSOpenFileChannel\fR call. Must be -implemented for any reasonable filesystem, since any operations -which require open or accessing a file's contents will use it -(e.g.\ \fBopen\fR, \fBencoding\fR, and many Tk commands). -.PP -.CS -typedef Tcl_Channel \fBTcl_FSOpenFileChannelProc\fR( - Tcl_Interp *\fIinterp\fR, - Tcl_Obj *\fIpathPtr\fR, - int \fImode\fR, - int \fIpermissions\fR); -.CE -.PP -The \fBTcl_FSOpenFileChannelProc\fR opens a file specified by -\fIpathPtr\fR and returns a channel handle that can be used to perform -input and output on the file. This API is modeled after the \fBfopen\fR -procedure of the Unix standard I/O library. The syntax and meaning of -all arguments is similar to those given in the Tcl \fBopen\fR command -when opening a file, where the \fImode\fR argument is a combination of -the POSIX flags O_RDONLY, O_WRONLY, etc. If an error occurs while -opening the channel, the \fBTcl_FSOpenFileChannelProc\fR returns NULL and -records a POSIX error code that can be retrieved with \fBTcl_GetErrno\fR. -In addition, if \fIinterp\fR is non-NULL, the -\fBTcl_FSOpenFileChannelProc\fR leaves an error message in \fIinterp\fR's -result after any error. -.PP -The newly created channel must not be registered in the supplied interpreter -by a \fBTcl_FSOpenFileChannelProc\fR; that task is up to the caller of -\fBTcl_FSOpenFileChannel\fR (if necessary). If one of -the standard channels, \fBstdin\fR, \fBstdout\fR or \fBstderr\fR was -previously closed, the act of creating the new channel also assigns it -as a replacement for the standard channel. -.SS MATCHINDIRECTORYPROC -.PP -Function to process a \fBTcl_FSMatchInDirectory\fR call. If not -implemented, then glob and recursive copy functionality will be lacking -in the filesystem (and this may impact commands like \fBencoding names\fR -which use glob functionality internally). -.PP -.CS -typedef int \fBTcl_FSMatchInDirectoryProc\fR( - Tcl_Interp *\fIinterp\fR, - Tcl_Obj *\fIresultPtr\fR, - Tcl_Obj *\fIpathPtr\fR, - const char *\fIpattern\fR, - Tcl_GlobTypeData *\fItypes\fR); -.CE -.PP -The function should return all files or directories (or other filesystem -objects) which match the given pattern and accord with the \fItypes\fR -specification given. There are two ways in which this function may be -called. If \fIpattern\fR is NULL, then \fIpathPtr\fR is a full path -specification of a single file or directory which should be checked for -existence and correct type. Otherwise, \fIpathPtr\fR is a directory, the -contents of which the function should search for files or directories -which have the correct type. In either case, \fIpathPtr\fR can be -assumed to be both non-NULL and non-empty. It is not currently -documented whether \fIpathPtr\fR will have a file separator at its end of -not, so code should be flexible to both possibilities. -.PP -The return value is a standard Tcl result indicating whether an error -occurred in the matching process. Error messages are placed in -\fIinterp\fR, unless \fIinterp\fR in NULL in which case no error -message need be generated; on a \fBTCL_OK\fR result, results should be -added to the \fIresultPtr\fR value given (which can be assumed to be a -valid unshared Tcl list). The matches added -to \fIresultPtr\fR should include any path prefix given in \fIpathPtr\fR -(this usually means they will be absolute path specifications). -Note that if no matches are found, that simply leads to an empty -result; errors are only signaled for actual file or filesystem -problems which may occur during the matching process. -.PP -The \fBTcl_GlobTypeData\fR structure passed in the \fItypes\fR -parameter contains the following fields: -.PP -.CS -typedef struct Tcl_GlobTypeData { - /* Corresponds to bcdpfls as in 'find -t' */ - int \fItype\fR; - /* Corresponds to file permissions */ - int \fIperm\fR; - /* Acceptable mac type */ - Tcl_Obj *\fImacType\fR; - /* Acceptable mac creator */ - Tcl_Obj *\fImacCreator\fR; -} \fBTcl_GlobTypeData\fR; -.CE -.PP -There are two specific cases which it is important to handle correctly, -both when \fItypes\fR is non-NULL. The two cases are when \fItypes->types -& TCL_GLOB_TYPE_DIR\fR or \fItypes->types & TCL_GLOB_TYPE_MOUNT\fR are -true (and in particular when the other flags are false). In the first of -these cases, the function must list the contained directories. Tcl uses -this to implement recursive globbing, so it is critical that filesystems -implement directory matching correctly. In the second of these cases, -with \fBTCL_GLOB_TYPE_MOUNT\fR, the filesystem must list the mount points -which lie within the given \fIpathPtr\fR (and in this case, \fIpathPtr\fR -need not lie within the same filesystem - different to all other cases in -which this function is called). Support for this is critical if Tcl is -to have seamless transitions between from one filesystem to another. -.SS UTIMEPROC -.PP -Function to process a \fBTcl_FSUtime\fR call. Required to allow setting -(not reading) of times with \fBfile mtime\fR, \fBfile atime\fR and the -open-r/open-w/fcopy implementation of \fBfile copy\fR. -.PP -.CS -typedef int \fBTcl_FSUtimeProc\fR( - Tcl_Obj *\fIpathPtr\fR, - struct utimbuf *\fItval\fR); -.CE -.PP -The access and modification times of the file specified by \fIpathPtr\fR -should be changed to the values given in the \fItval\fR structure. -.PP -The return value should be 0 on success and -1 on an error, as -with the system \fButime\fR. -.SS LINKPROC -.PP -Function to process a \fBTcl_FSLink\fR call. Should be implemented -only if the filesystem supports links, and may otherwise be NULL. -.PP -.CS -typedef Tcl_Obj *\fBTcl_FSLinkProc\fR( - Tcl_Obj *\fIlinkNamePtr\fR, - Tcl_Obj *\fItoPtr\fR, - int \fIlinkAction\fR); -.CE -.PP -If \fItoPtr\fR is NULL, the function is being asked to read the -contents of a link. The result is a Tcl_Obj specifying the contents of -the link given by \fIlinkNamePtr\fR, or NULL if the link could -not be read. The result is owned by the caller (and should therefore -have its ref count incremented before being returned). Any callers -should call \fBTcl_DecrRefCount\fR on this result when it is no longer needed. -If \fItoPtr\fR is not NULL, the function should attempt to create a link. -The result in this case should be \fItoPtr\fR if the link was successful -and NULL otherwise. In this case the result is not owned by the caller -(i.e.\ no reference count manipulations on either end are needed). See -the documentation for \fBTcl_FSLink\fR for the correct interpretation -of the \fIlinkAction\fR flags. -.SS LISTVOLUMESPROC -.PP -Function to list any filesystem volumes added by this filesystem. -Should be implemented only if the filesystem adds volumes at the head -of the filesystem, so that they can be returned by \fBfile volumes\fR. -.PP -.CS -typedef Tcl_Obj *\fBTcl_FSListVolumesProc\fR(void); -.CE -.PP -The result should be a list of volumes added by this filesystem, or -NULL (or an empty list) if no volumes are provided. The result value -is considered to be owned by the filesystem (not by Tcl's core), but -should be given a reference count for Tcl. Tcl will use the contents of the -list and then decrement that reference count. This allows filesystems to -choose whether they actually want to retain a -.QW "master list" -of volumes -or not (if not, they generate the list on the fly and pass it to Tcl -with a reference count of 1 and then forget about the list, if yes, then -they simply increment the reference count of their master list and pass it -to Tcl which will copy the contents and then decrement the count back -to where it was). -.PP -Therefore, Tcl considers return values from this proc to be read-only. -.SS FILEATTRSTRINGSPROC -.PP -Function to list all attribute strings which are valid for this -filesystem. If not implemented the filesystem will not support -the \fBfile attributes\fR command. This allows arbitrary additional -information to be attached to files in the filesystem. If it is -not implemented, there is no need to implement the \fBget\fR and \fBset\fR -methods. -.PP -.CS -typedef const char *const *\fBTcl_FSFileAttrStringsProc\fR( - Tcl_Obj *\fIpathPtr\fR, - Tcl_Obj **\fIobjPtrRef\fR); -.CE -.PP -The called function may either return an array of strings, or may -instead return NULL and place a Tcl list into the given \fIobjPtrRef\fR. Tcl -will take that list and first increment its reference count before using it. -On completion of that use, Tcl will decrement its reference count. Hence if -the list should be disposed of by Tcl when done, it should have a -reference count of zero, and if the list should not be disposed of, the -filesystem should ensure it returns a value with a reference count -of at least one. -.SS FILEATTRSGETPROC -.PP -Function to process a \fBTcl_FSFileAttrsGet\fR call, used by \fBfile -attributes\fR. -.PP -.CS -typedef int \fBTcl_FSFileAttrsGetProc\fR( - Tcl_Interp *\fIinterp\fR, - int \fIindex\fR, - Tcl_Obj *\fIpathPtr\fR, - Tcl_Obj **\fIobjPtrRef\fR); -.CE -.PP -Returns a standard Tcl return code. The attribute value retrieved, -which corresponds to the \fIindex\fR'th element in the list returned by -the \fBTcl_FSFileAttrStringsProc\fR, is a Tcl_Obj placed in \fIobjPtrRef\fR (if -\fBTCL_OK\fR was returned) and is likely to have a reference count of zero. Either -way we must either store it somewhere (e.g.\ the Tcl result), or -Incr/Decr its reference count to ensure it is properly freed. -.SS FILEATTRSSETPROC -.PP -Function to process a \fBTcl_FSFileAttrsSet\fR call, used by \fBfile -attributes\fR. If the filesystem is read-only, there is no need -to implement this. -.PP -.CS -typedef int \fBTcl_FSFileAttrsSetProc\fR( - Tcl_Interp *\fIinterp\fR, - int \fIindex\fR, - Tcl_Obj *\fIpathPtr\fR, - Tcl_Obj *\fIobjPtr\fR); -.CE -.PP -The attribute value of the \fIindex\fR'th element in the list returned by -the Tcl_FSFileAttrStringsProc should be set to the \fIobjPtr\fR given. -.SS CREATEDIRECTORYPROC -.PP -Function to process a \fBTcl_FSCreateDirectory\fR call. Should be -implemented unless the FS is read-only. -.PP -.CS -typedef int \fBTcl_FSCreateDirectoryProc\fR( - Tcl_Obj *\fIpathPtr\fR); -.CE -.PP -The return value is a standard Tcl result indicating whether an error -occurred in the process. If successful, a new directory should have -been added to the filesystem in the location specified by -\fIpathPtr\fR. -.SS REMOVEDIRECTORYPROC -.PP -Function to process a \fBTcl_FSRemoveDirectory\fR call. Should be -implemented unless the FS is read-only. -.PP -.CS -typedef int \fBTcl_FSRemoveDirectoryProc\fR( - Tcl_Obj *\fIpathPtr\fR, - int \fIrecursive\fR, - Tcl_Obj **\fIerrorPtr\fR); -.CE -.PP -The return value is a standard Tcl result indicating whether an error -occurred in the process. If successful, the directory specified by -\fIpathPtr\fR should have been removed from the filesystem. If the -\fIrecursive\fR flag is given, then a non-empty directory should be -deleted without error. If this flag is not given, then and the -directory is non-empty a POSIX -.QW EEXIST -error should be signaled. If an -error does occur, the name of the file or directory which caused the -error should be placed in \fIerrorPtr\fR. -.SS DELETEFILEPROC -.PP -Function to process a \fBTcl_FSDeleteFile\fR call. Should be implemented -unless the FS is read-only. -.PP -.CS -typedef int \fBTcl_FSDeleteFileProc\fR( - Tcl_Obj *\fIpathPtr\fR); -.CE -.PP -The return value is a standard Tcl result indicating whether an error -occurred in the process. If successful, the file specified by -\fIpathPtr\fR should have been removed from the filesystem. Note that, -if the filesystem supports symbolic links, Tcl will always call this -function and not Tcl_FSRemoveDirectoryProc when needed to delete them -(even if they are symbolic links to directories). -.SH "FILESYSTEM EFFICIENCY" -.PP -These functions need not be implemented for a particular filesystem -because the core has a fallback implementation available. See each -individual description for the consequences of leaving the field NULL. -.SS LSTATPROC -.PP -Function to process a \fBTcl_FSLstat\fR call. If not implemented, Tcl -will attempt to use the \fIstatProc\fR defined above instead. Therefore -it need only be implemented if a filesystem can differentiate between -\fBstat\fR and \fBlstat\fR calls. -.PP -.CS -typedef int \fBTcl_FSLstatProc\fR( - Tcl_Obj *\fIpathPtr\fR, - Tcl_StatBuf *\fIstatPtr\fR); -.CE -.PP -The behavior of this function is very similar to that of the -\fBTcl_FSStatProc\fR defined above, except that if it is applied -to a symbolic link, it returns information about the link, not -about the target file. -.SS COPYFILEPROC -.PP -Function to process a \fBTcl_FSCopyFile\fR call. If not implemented Tcl -will fall back on \fBopen\fR-r, \fBopen\fR-w and \fBfcopy\fR as a -copying mechanism. -Therefore it need only be implemented if the filesystem can perform -that action more efficiently. -.PP -.CS -typedef int \fBTcl_FSCopyFileProc\fR( - Tcl_Obj *\fIsrcPathPtr\fR, - Tcl_Obj *\fIdestPathPtr\fR); -.CE -.PP -The return value is a standard Tcl result indicating whether an error -occurred in the copying process. Note that, \fIdestPathPtr\fR is the -name of the file which should become the copy of \fIsrcPathPtr\fR. It -is never the name of a directory into which \fIsrcPathPtr\fR could be -copied (i.e.\ the function is much simpler than the Tcl level \fBfile -copy\fR subcommand). Note that, -if the filesystem supports symbolic links, Tcl will always call this -function and not \fIcopyDirectoryProc\fR when needed to copy them -(even if they are symbolic links to directories). Finally, if the -filesystem determines it cannot support the \fBfile copy\fR action, -calling \fBTcl_SetErrno(EXDEV)\fR and returning a non-\fBTCL_OK\fR -result will tell Tcl to use its standard fallback mechanisms. -.SS RENAMEFILEPROC -.PP -Function to process a \fBTcl_FSRenameFile\fR call. If not implemented, -Tcl will fall back on a copy and delete mechanism. Therefore it need -only be implemented if the filesystem can perform that action more -efficiently. -.PP -.CS -typedef int \fBTcl_FSRenameFileProc\fR( - Tcl_Obj *\fIsrcPathPtr\fR, - Tcl_Obj *\fIdestPathPtr\fR); -.CE -.PP -The return value is a standard Tcl result indicating whether an error -occurred in the renaming process. If the -filesystem determines it cannot support the \fBfile rename\fR action, -calling \fBTcl_SetErrno(EXDEV)\fR and returning a non-\fBTCL_OK\fR -result will tell Tcl to use its standard fallback mechanisms. -.SS COPYDIRECTORYPROC -.PP -Function to process a \fBTcl_FSCopyDirectory\fR call. If not -implemented, Tcl will fall back on a recursive \fBfile mkdir\fR, \fBfile copy\fR -mechanism. Therefore it need only be implemented if the filesystem can -perform that action more efficiently. -.PP -.CS -typedef int \fBTcl_FSCopyDirectoryProc\fR( - Tcl_Obj *\fIsrcPathPtr\fR, - Tcl_Obj *\fIdestPathPtr\fR, - Tcl_Obj **\fIerrorPtr\fR); -.CE -.PP -The return value is a standard Tcl result indicating whether an error -occurred in the copying process. If an error does occur, the name of -the file or directory which caused the error should be placed in -\fIerrorPtr\fR. Note that, \fIdestPathPtr\fR is the name of the -directory-name which should become the mirror-image of -\fIsrcPathPtr\fR. It is not the name of a directory into which -\fIsrcPathPtr\fR should be copied (i.e.\ the function is much simpler -than the Tcl level \fBfile copy\fR subcommand). Finally, if the -filesystem determines it cannot support the directory copy action, -calling \fBTcl_SetErrno(EXDEV)\fR and returning a non-\fBTCL_OK\fR -result will tell Tcl to use its standard fallback mechanisms. -.SS LOADFILEPROC -.PP -Function to process a \fBTcl_FSLoadFile\fR call. If not implemented, Tcl -will fall back on a copy to native-temp followed by a \fBTcl_FSLoadFile\fR on -that temporary copy. Therefore it need only be implemented if the -filesystem can load code directly, or it can be implemented simply to -return \fBTCL_ERROR\fR to disable load functionality in this filesystem -entirely. -.PP -.CS -typedef int \fBTcl_FSLoadFileProc\fR( - Tcl_Interp *\fIinterp\fR, - Tcl_Obj *\fIpathPtr\fR, - Tcl_LoadHandle *\fIhandlePtr\fR, - Tcl_FSUnloadFileProc *\fIunloadProcPtr\fR); -.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 -result will tell Tcl to use its standard fallback mechanisms. -.SS UNLOADFILEPROC -.PP -Function to unload a previously successfully loaded file. If load was -implemented, then this should also be implemented, if there is any -cleanup action required. -.PP -.CS -typedef void \fBTcl_FSUnloadFileProc\fR( - Tcl_LoadHandle \fIloadHandle\fR); -.CE -.SS GETCWDPROC -.PP -Function to process a \fBTcl_FSGetCwd\fR call. Most filesystems need not -implement this. It will usually only be called once, if \fBgetcwd\fR is -called before \fBchdir\fR. May be NULL. -.PP -.CS -typedef Tcl_Obj *\fBTcl_FSGetCwdProc\fR( - Tcl_Interp *\fIinterp\fR); -.CE -.PP -If the filesystem supports a native notion of a current working -directory (which might perhaps change independent of Tcl), this -function should return that cwd as the result, or NULL if the current -directory could not be determined (e.g.\ the user does not have -appropriate permissions on the cwd directory). If NULL is returned, an -error message is left in the \fIinterp\fR's result. -.SS CHDIRPROC -.PP -Function to process a \fBTcl_FSChdir\fR call. If filesystems do not -implement this, it will be emulated by a series of directory access -checks. Otherwise, virtual filesystems which do implement it need only -respond with a positive return result if the \fIpathPtr\fR is a valid, -accessible directory in their filesystem. They need not remember the -result, since that will be automatically remembered for use by -\fBTcl_FSGetCwd\fR. -Real filesystems should carry out the correct action (i.e.\ call the -correct system \fBchdir\fR API). -.PP -.CS -typedef int \fBTcl_FSChdirProc\fR( - Tcl_Obj *\fIpathPtr\fR); -.CE -.PP -The \fBTcl_FSChdirProc\fR changes the applications current working -directory to the value specified in \fIpathPtr\fR. The function returns --1 on error or 0 on success. -.SH "SEE ALSO" -cd(n), file(n), filename(n), load(n), open(n), pwd(n), source(n), unload(n) -.SH KEYWORDS -stat, access, filesystem, vfs, virtual filesystem diff --git a/doc/FindExec.3 b/doc/FindExec.3 deleted file mode 100644 index 1fd57db..0000000 --- a/doc/FindExec.3 +++ /dev/null @@ -1,63 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_FindExecutable 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_FindExecutable, Tcl_GetNameOfExecutable \- identify or return the name of the binary file containing the application -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -void -\fBTcl_FindExecutable\fR(\fIargv0\fR) -.sp -const char * -\fBTcl_GetNameOfExecutable\fR() -.SH ARGUMENTS -.AS char *argv0 -.AP char *argv0 in -The first command-line argument to the program, which gives the -application's name. -.BE - -.SH DESCRIPTION -.PP -The \fBTcl_FindExecutable\fR procedure computes the full path name of -the executable file from which the application was invoked and saves -it for Tcl's internal use. -The executable's path name is needed for several purposes in -Tcl. For example, it is needed on some platforms in the -implementation of the \fBload\fR command. -It is also returned by the \fBinfo nameofexecutable\fR command. -.PP -On UNIX platforms this procedure is typically invoked as the very -first thing in the application's main program; it must be passed -\fIargv[0]\fR as its argument. It is important not to change the -working directory before the invocation. -\fBTcl_FindExecutable\fR uses \fIargv0\fR -along with the \fBPATH\fR environment variable to find the -application's executable, if possible. If it fails to find -the binary, then future calls to \fBinfo nameofexecutable\fR -will return an empty string. -.PP -On Windows platforms this procedure is typically invoked as the very -first thing in the application's main program as well; Its \fIargv[0]\fR -argument is only used to indicate whether the executable has a stderr -channel (any non-null value) or not (the value null). If \fBTcl_SetPanicProc\fR -is never called and no debugger is running, this determines whether -the panic message is sent to stderr or to a standard system dialog. -.PP -\fBTcl_GetNameOfExecutable\fR simply returns a pointer to the -internal full path name of the executable file as computed by -\fBTcl_FindExecutable\fR. This procedure call is the C API -equivalent to the \fBinfo nameofexecutable\fR command. NULL -is returned if the internal full path name has not been -computed or unknown. - -.SH KEYWORDS -binary, executable file diff --git a/doc/GetCwd.3 b/doc/GetCwd.3 deleted file mode 100644 index f4f37a1..0000000 --- a/doc/GetCwd.3 +++ /dev/null @@ -1,52 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_GetCwd 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_GetCwd, Tcl_Chdir \- manipulate the current working directory -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -char * -\fBTcl_GetCwd\fR(\fIinterp\fR, \fIbufferPtr\fR) -.sp -int -\fBTcl_Chdir\fR(\fIpath\fR) -.SH ARGUMENTS -.AS Tcl_DString *bufferPtr in/out -.AP Tcl_Interp *interp in -Interpreter in which to report an error, if any. -.AP Tcl_DString *bufferPtr in/out -This dynamic string is used to store the current working directory. -At the time of the call it should be uninitialized or free. The -caller must eventually call \fBTcl_DStringFree\fR to free up -anything stored here. -.AP char *path in -File path in UTF\-8 format. -.BE - -.SH DESCRIPTION -.PP -These procedures may be used to manipulate the current working -directory for the application. They provide C\-level access to -the same functionality as the Tcl \fBpwd\fR command. -.PP -\fBTcl_GetCwd\fR returns a pointer to a string specifying the current -directory, or NULL if the current directory could not be determined. -If NULL is returned, an error message is left in the \fIinterp\fR's result. -Storage for the result string is allocated in bufferPtr; the caller -must call \fBTcl_DStringFree()\fR when the result is no longer needed. -The format of the path is UTF\-8. -.PP -\fBTcl_Chdir\fR changes the applications current working directory to -the value specified in \fIpath\fR. The format of the passed in string -must be UTF\-8. The function returns -1 on error or 0 on success. - -.SH KEYWORDS -pwd diff --git a/doc/GetHostName.3 b/doc/GetHostName.3 deleted file mode 100644 index 73432d3..0000000 --- a/doc/GetHostName.3 +++ /dev/null @@ -1,27 +0,0 @@ -'\" -'\" Copyright (c) 1998-2000 by Scriptics Corporation. -'\" All rights reserved. -'\" -.TH Tcl_GetHostName 3 8.3 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_GetHostName \- get the name of the local host -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -const char * -\fBTcl_GetHostName\fR() -.BE - -.SH DESCRIPTION -.PP -\fBTcl_GetHostName\fR is a utility procedure used by some of the -Tcl commands. It returns a pointer to a string containing the name -for the current machine, or an empty string if the name cannot be -determined. The string is statically allocated, and the caller must -not modify of free it. -.PP -.SH KEYWORDS -hostname diff --git a/doc/GetIndex.3 b/doc/GetIndex.3 deleted file mode 100644 index 17a31d4..0000000 --- a/doc/GetIndex.3 +++ /dev/null @@ -1,104 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_GetIndexFromObj 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_GetIndexFromObj, Tcl_GetIndexFromObjStruct \- lookup string in table of keywords -.SH SYNOPSIS -.nf -\fB#include \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 value is used to search through \fItablePtr\fR. -The internal representation is modified to hold the index of the matching -table entry. -.AP "const char *const" *tablePtr in -An array of null-terminated strings. The end of the array is marked -by a NULL string pointer. -Note that references to the \fItablePtr\fR may be retained in the -internal representation of \fIobjPtr\fR, so this should represent the -address of a statically-allocated array. -.AP "const void" *structTablePtr in -An array of arbitrary type, typically some \fBstruct\fR type. -The first member of the structure must be a null-terminated string. -The size of the structure is given by \fIoffset\fR. -Note that references to the \fIstructTablePtr\fR may be retained in the -internal representation of \fIobjPtr\fR, so this should represent the -address of a statically-allocated array of structures. -.AP int offset in -The offset to add to structTablePtr to get to the next entry. -The end of the array is marked by a NULL string pointer. -.AP "const char" *msg in -Null-terminated string describing what is being looked up, such as -\fBoption\fR. This string is included in error messages. -.AP int flags in -OR-ed combination of bits providing additional information for -operation. The only bit that is currently defined is \fBTCL_EXACT\fR. -.AP int *indexPtr out -The index of the string in \fItablePtr\fR that matches the value of -\fIobjPtr\fR is returned here. -.BE -.SH DESCRIPTION -.PP -These procedures provide an efficient way for looking up keywords, -switch names, option names, and similar things where the literal value of -a Tcl value must be chosen from a predefined set. -\fBTcl_GetIndexFromObj\fR compares \fIobjPtr\fR against each of -the strings in \fItablePtr\fR to find a match. A match occurs if -\fIobjPtr\fR's string value is identical to one of the strings in -\fItablePtr\fR, or if it is a non-empty unique abbreviation -for exactly one of the strings in \fItablePtr\fR and the -\fBTCL_EXACT\fR flag was not specified; in either case -the index of the matching entry is stored at \fI*indexPtr\fR -and \fBTCL_OK\fR is returned. -.PP -If there is no matching entry, -\fBTCL_ERROR\fR is returned and an error message is left in \fIinterp\fR's -result if \fIinterp\fR is not NULL. \fIMsg\fR is included in the -error message to indicate what was being looked up. For example, -if \fImsg\fR is \fBoption\fR the error message will have a form like -.QW "\fBbad option \N'34'firt\N'34': must be first, second, or third\fR" . -.PP -If \fBTcl_GetIndexFromObj\fR completes successfully it modifies the -internal representation of \fIobjPtr\fR to hold the address of -the table and the index of the matching entry. If \fBTcl_GetIndexFromObj\fR -is invoked again with the same \fIobjPtr\fR and \fItablePtr\fR -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" -prefix(n), Tcl_WrongNumArgs(3) -.SH KEYWORDS -index, option, value, table lookup diff --git a/doc/GetInt.3 b/doc/GetInt.3 deleted file mode 100644 index eba549d..0000000 --- a/doc/GetInt.3 +++ /dev/null @@ -1,104 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_GetInt 3 "" Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_GetInt, Tcl_GetDouble, Tcl_GetBoolean \- convert from string to integer, double, or boolean -.SH SYNOPSIS -.nf -\fB#include \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 does not 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 and -followed by white space. If the first two characters of \fIsrc\fR -after the optional white space and sign are -.QW \fB0x\fR -then \fIsrc\fR is expected to be in hexadecimal form; otherwise, -if the first such characters are -.QW \fB0d\fR -then \fIsrc\fR is expected to be in decimal form; otherwise, -if the first such characters are -.QW \fB0o\fR -then \fIsrc\fR is expected to be in octal form; otherwise, -if the first such characters are -.QW \fB0b\fR -then \fIsrc\fR is expected to be in binary form; otherwise, -if the first such character is -.QW \fB0\fR -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 -.QW \fB.\fR ; -a sequence of digits; the letter -.QW \fBe\fR ; -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 -.QW \fBe\fR -is present then it must be followed by the exponent number. If there -are no fields apart from the sign and initial sequence of digits -(i.e., no decimal point or exponent indicator), that -initial sequence of digits should take one of the forms that -\fBTcl_GetInt\fR supports, described above. The use of -.QW \fB,\fR -as a decimal point is not supported nor should any other sort of -inter-digit separator be present. -.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 diff --git a/doc/GetOpnFl.3 b/doc/GetOpnFl.3 deleted file mode 100644 index a450b02..0000000 --- a/doc/GetOpnFl.3 +++ /dev/null @@ -1,58 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_GetOpenFile 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_GetOpenFile \- Return a FILE* for a channel registered in the given interpreter (Unix only) -.SH SYNOPSIS -.nf -\fB#include \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 was not 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 did not -make any sense or \fIcheckUsage\fR was set and the file was not 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 diff --git a/doc/GetStdChan.3 b/doc/GetStdChan.3 deleted file mode 100644 index be0e79f..0000000 --- a/doc/GetStdChan.3 +++ /dev/null @@ -1,86 +0,0 @@ -'\" -'\" Copyright (c) 1996 by Sun Microsystems, Inc. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Tcl_GetStdChannel 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_GetStdChannel, Tcl_SetStdChannel \- procedures for retrieving and replacing the standard channels -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Channel -\fBTcl_GetStdChannel\fR(\fItype\fR) -.sp -\fBTcl_SetStdChannel\fR(\fIchannel, type\fR) -.sp -.SH ARGUMENTS -.AS Tcl_Channel channel -.AP int type in -The identifier for the standard channel to retrieve or modify. Must be one of -\fBTCL_STDIN\fR, \fBTCL_STDOUT\fR, or \fBTCL_STDERR\fR. -.AP Tcl_Channel channel in -The channel to use as the new value for the specified standard channel. -.BE - -.SH DESCRIPTION -.PP -Tcl defines three special channels that are used by various I/O related -commands if no other channels are specified. The standard input channel -has a channel name of \fBstdin\fR and is used by \fBread\fR and \fBgets\fR. -The standard output channel is named \fBstdout\fR and is used by -\fBputs\fR. The standard error channel is named \fBstderr\fR and is used for -reporting errors. In addition, the standard channels are inherited by any -child processes created using \fBexec\fR or \fBopen\fR in the absence of any -other redirections. -.PP -The standard channels are actually aliases for other normal channels. The -current channel associated with a standard channel can be retrieved by calling -\fBTcl_GetStdChannel\fR with one of -\fBTCL_STDIN\fR, \fBTCL_STDOUT\fR, or \fBTCL_STDERR\fR as the \fItype\fR. The -return value will be a valid channel, or NULL. -.PP -A new channel can be set for the standard channel specified by \fItype\fR -by calling \fBTcl_SetStdChannel\fR with a new channel or NULL in the -\fIchannel\fR argument. If the specified channel is closed by a later call to -\fBTcl_Close\fR, then the corresponding standard channel will automatically be -set to NULL. -.PP -If a non-NULL value for \fIchannel\fR is passed to \fBTcl_SetStdChannel\fR, -then that same value should be passed to \fBTcl_RegisterChannel\fR, like so: -.PP -.CS -Tcl_RegisterChannel(NULL, channel); -.CE -.PP -This is a workaround for a misfeature in \fBTcl_SetStdChannel\fR that it -fails to do some reference counting housekeeping. This misfeature cannot -be corrected without contradicting the assumptions of some existing -code that calls \fBTcl_SetStdChannel\fR. -.PP -If \fBTcl_GetStdChannel\fR is called before \fBTcl_SetStdChannel\fR, Tcl will -construct a new channel to wrap the appropriate platform-specific standard -file handle. If \fBTcl_SetStdChannel\fR is called before -\fBTcl_GetStdChannel\fR, then the default channel will not be created. -.PP -If one of the standard channels is set to NULL, either by calling -\fBTcl_SetStdChannel\fR with a NULL \fIchannel\fR argument, or by calling -\fBTcl_Close\fR on the channel, then the next call to \fBTcl_CreateChannel\fR -will automatically set the standard channel with the newly created channel. If -more than one standard channel is NULL, then the standard channels will be -assigned starting with standard input, followed by standard output, with -standard error being last. -.PP -See \fBTcl_StandardChannels\fR for a general treatise about standard -channels and the behavior of the Tcl library with regard to them. - -.SH "SEE ALSO" -Tcl_Close(3), Tcl_CreateChannel(3), Tcl_Main(3), tclsh(1) - -.SH KEYWORDS -standard channel, standard input, standard output, standard error diff --git a/doc/GetTime.3 b/doc/GetTime.3 deleted file mode 100644 index 9f96be5..0000000 --- a/doc/GetTime.3 +++ /dev/null @@ -1,109 +0,0 @@ -'\" -'\" Copyright (c) 2001 by Kevin B. Kenny . -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Tcl_GetTime 3 8.4 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_GetTime, Tcl_SetTimeProc, Tcl_QueryTimeProc \- get date and time -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_GetTime\fR(\fItimePtr\fR) -.sp -\fBTcl_SetTimeProc\fR(\fIgetProc, scaleProc, clientData\fR) -.sp -\fBTcl_QueryTimeProc\fR(\fIgetProcPtr, scaleProcPtr, clientDataPtr\fR) -.SH ARGUMENTS -.AS Tcl_GetTimeProc *getProc in -.AP Tcl_Time *timePtr out -Points to memory in which to store the date and time information. -.AP Tcl_GetTimeProc getProc in -Pointer to handler function replacing \fBTcl_GetTime\fR's access to the OS. -.AP Tcl_ScaleTimeProc scaleProc in -Pointer to handler function for the conversion of time delays in the -virtual domain to real-time. -.AP ClientData clientData in -Value passed through to the two handler functions. -.AP Tcl_GetTimeProc *getProcPtr out -Pointer to place the currently registered get handler function into. -.AP Tcl_ScaleTimeProc *scaleProcPtr out -Pointer to place the currently registered scale handler function into. -.AP ClientData *clientDataPtr out -Pointer to place the currently registered pass-through value into. -.BE -.SH DESCRIPTION -.PP -The \fBTcl_GetTime\fR function retrieves the current time as a -\fITcl_Time\fR structure in memory the caller provides. This -structure has the following definition: -.PP -.CS -typedef struct Tcl_Time { - long \fIsec\fR; - long \fIusec\fR; -} \fBTcl_Time\fR; -.CE -.PP -On return, the \fIsec\fR member of the structure is filled in with the -number of seconds that have elapsed since the \fIepoch:\fR the epoch -is the point in time of 00:00 UTC, 1 January 1970. This number does -\fInot\fR count leap seconds \- an interval of one day advances it by -86400 seconds regardless of whether a leap second has been inserted. -.PP -The \fIusec\fR member of the structure is filled in with the number of -microseconds that have elapsed since the start of the second -designated by \fIsec\fR. The Tcl library makes every effort to keep -this number as precise as possible, subject to the limitations of the -computer system. On multiprocessor variants of Windows, this number -may be limited to the 10- or 20-ms granularity of the system clock. -(On single-processor Windows systems, the \fIusec\fR field is derived -from a performance counter and is highly precise.) -.SS "VIRTUALIZED TIME" -.PP -The \fBTcl_SetTimeProc\fR function registers two related handler functions -with the core. The first handler function is a replacement for -\fBTcl_GetTime\fR, or rather the OS access made by -\fBTcl_GetTime\fR. The other handler function is used by the Tcl -notifier to convert wait/block times from the virtual domain into real -time. -.PP -The \fBTcl_QueryTimeProc\fR function returns the currently registered -handler functions. If no external handlers were set then this will -return the standard handlers accessing and processing the native time -of the OS. The arguments to the function are allowed to be NULL; and -any argument which is NULL is ignored and not set. -.PP -The signatures of the handler functions are as follows: -.PP -.CS -typedef void \fBTcl_GetTimeProc\fR( - Tcl_Time *\fItimebuf\fR, - ClientData \fIclientData\fR); -typedef void \fBTcl_ScaleTimeProc\fR( - Tcl_Time *\fItimebuf\fR, - ClientData \fIclientData\fR); -.CE -.PP -The \fItimebuf\fR fields contain the time to manipulate, and the -\fIclientData\fR fields contain a pointer supplied at the time the handler -functions were registered. -.PP -Any handler pair specified has to return data which is consistent between -them. In other words, setting one handler of the pair to something assuming a -10-times slowdown, and the other handler of the pair to something assuming a -two-times slowdown is wrong and not allowed. -.PP -The set handler functions are allowed to run the delivered time backwards, -however this should be avoided. We have to allow it as the native time can run -backwards as the user can fiddle with the system time one way or other. Note -that the insertion of the hooks will not change the behavior of the Tcl core -with regard to this situation, i.e. the existing behavior is retained. -.SH "SEE ALSO" -clock(n) -.SH KEYWORDS -date, time diff --git a/doc/GetVersion.3 b/doc/GetVersion.3 deleted file mode 100644 index 3672382..0000000 --- a/doc/GetVersion.3 +++ /dev/null @@ -1,48 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_GetVersion 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_GetVersion \- get the version of the library at runtime -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_GetVersion\fR(\fImajor, minor, patchLevel, type\fR) -.SH ARGUMENTS -.AS Tcl_ReleaseType *patchLevel out -.AP int *major out -Major version number of the Tcl library. -.AP int *minor out -Minor version number of the Tcl library. -.AP int *patchLevel out -The patch level of the Tcl library (or alpha or beta number). -.AP Tcl_ReleaseType *type out -The type of release, also indicates the type of patch level. Can be -one of \fBTCL_ALPHA_RELEASE\fR, \fBTCL_BETA_RELEASE\fR, or -\fBTCL_FINAL_RELEASE\fR. -.BE - -.SH DESCRIPTION -.PP -\fBTcl_GetVersion\fR should be used to query the version number -of the Tcl library at runtime. This is useful when using a -dynamically loaded Tcl library or when writing a stubs-aware -extension. For instance, if you write an extension that is -linked against the Tcl stubs library, it could be loaded into -a program linked to an older version of Tcl than you expected. -Use \fBTcl_GetVersion\fR to verify that fact, and possibly to -change the behavior of your extension. -.PP -\fBTcl_GetVersion\fR accepts NULL for any of the arguments. For instance if -you do not care about the \fIpatchLevel\fR of the library, pass -a NULL for the \fIpatchLevel\fR argument. - -.SH KEYWORDS -version, patchlevel, major, minor, alpha, beta, release - diff --git a/doc/Hash.3 b/doc/Hash.3 deleted file mode 100644 index aa79b86..0000000 --- a/doc/Hash.3 +++ /dev/null @@ -1,334 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_Hash 3 "" Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_InitHashTable, Tcl_InitCustomHashTable, Tcl_InitObjHashTable, Tcl_DeleteHashTable, Tcl_CreateHashEntry, Tcl_DeleteHashEntry, Tcl_FindHashEntry, Tcl_GetHashValue, Tcl_SetHashValue, Tcl_GetHashKey, Tcl_FirstHashEntry, Tcl_NextHashEntry, Tcl_HashStats \- procedures to manage hash tables -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_InitHashTable\fR(\fItablePtr, keyType\fR) -.sp -\fBTcl_InitCustomHashTable\fR(\fItablePtr, keyType, typePtr\fR) -.sp -\fBTcl_InitObjHashTable\fR(\fItablePtr\fR) -.sp -\fBTcl_DeleteHashTable\fR(\fItablePtr\fR) -.sp -Tcl_HashEntry * -\fBTcl_CreateHashEntry\fR(\fItablePtr, key, newPtr\fR) -.sp -\fBTcl_DeleteHashEntry\fR(\fIentryPtr\fR) -.sp -Tcl_HashEntry * -\fBTcl_FindHashEntry\fR(\fItablePtr, key\fR) -.sp -ClientData -\fBTcl_GetHashValue\fR(\fIentryPtr\fR) -.sp -\fBTcl_SetHashValue\fR(\fIentryPtr, value\fR) -.sp -void * -\fBTcl_GetHashKey\fR(\fItablePtr, entryPtr\fR) -.sp -Tcl_HashEntry * -\fBTcl_FirstHashEntry\fR(\fItablePtr, searchPtr\fR) -.sp -Tcl_HashEntry * -\fBTcl_NextHashEntry\fR(\fIsearchPtr\fR) -.sp -char * -\fBTcl_HashStats\fR(\fItablePtr\fR) -.SH ARGUMENTS -.AS "const Tcl_HashKeyType" *searchPtr out -.AP Tcl_HashTable *tablePtr in -Address of hash table structure (for all procedures but -\fBTcl_InitHashTable\fR, this must have been initialized by -previous call to \fBTcl_InitHashTable\fR). -.AP int keyType in -Kind of keys to use for new hash table. Must be either -\fBTCL_STRING_KEYS\fR, \fBTCL_ONE_WORD_KEYS\fR, \fBTCL_CUSTOM_TYPE_KEYS\fR, -\fBTCL_CUSTOM_PTR_KEYS\fR, or an integer value greater than 1. -.AP Tcl_HashKeyType *typePtr in -Address of structure which defines the behavior of the hash table. -.AP "const void" *key in -Key to use for probe into table. Exact form depends on -\fIkeyType\fR used to create table. -.AP int *newPtr out -The word at \fI*newPtr\fR is set to 1 if a new entry was created -and 0 if there was already an entry for \fIkey\fR. -.AP Tcl_HashEntry *entryPtr in -Pointer to hash table entry. -.AP ClientData value in -New value to assign to hash table entry. Need not have type -ClientData, but must fit in same space as ClientData. -.AP Tcl_HashSearch *searchPtr in -Pointer to record to use to keep track of progress in enumerating -all the entries in a hash table. -.BE -.SH DESCRIPTION -.PP -A hash table consists of zero or more entries, each consisting of a -key and a value. Given the key for an entry, the hashing routines can -very quickly locate the entry, and hence its value. There may be at -most one entry in a hash table with a particular key, but many entries -may have the same value. Keys can take one of four forms: strings, -one-word values, integer arrays, or custom keys defined by a -Tcl_HashKeyType structure (See section \fBTHE TCL_HASHKEYTYPE STRUCTURE\fR -below). All of the keys in a given table have the same -form, which is specified when the table is initialized. -.PP -The value of a hash table entry can be anything that fits in the same -space as a -.QW "char *" -pointer. Values for hash table entries are -managed entirely by clients, not by the hash module itself. Typically -each entry's value is a pointer to a data structure managed by client -code. -.PP -Hash tables grow gracefully as the number of entries increases, so -that there are always less than three entries per hash bucket, on -average. This allows for fast lookups regardless of the number of -entries in a table. -.PP -The core provides three functions for the initialization of hash -tables, Tcl_InitHashTable, Tcl_InitObjHashTable and -Tcl_InitCustomHashTable. -.PP -\fBTcl_InitHashTable\fR initializes a structure that describes a new -hash table. The space for the structure is provided by the caller, -not by the hash module. The value of \fIkeyType\fR indicates what -kinds of keys will be used for all entries in the table. All of the -key types described later are allowed, with the exception of -\fBTCL_CUSTOM_TYPE_KEYS\fR and \fBTCL_CUSTOM_PTR_KEYS\fR. -.PP -\fBTcl_InitObjHashTable\fR is a wrapper around -\fBTcl_InitCustomHashTable\fR and initializes a hash table whose keys -are Tcl_Obj *. -.PP -\fBTcl_InitCustomHashTable\fR initializes a structure that describes a -new hash table. The space for the structure is provided by the -caller, not by the hash module. The value of \fIkeyType\fR indicates -what kinds of keys will be used for all entries in the table. -\fIKeyType\fR must have one of the following values: -.IP \fBTCL_STRING_KEYS\fR 25 -Keys are null-terminated strings. -They are passed to hashing routines using the address of the -first character of the string. -.IP \fBTCL_ONE_WORD_KEYS\fR 25 -Keys are single-word values; they are passed to hashing routines -and stored in hash table entries as -.QW "char *" -values. -The pointer value is the key; it need not (and usually does not) -actually point to a string. -.IP \fBTCL_CUSTOM_TYPE_KEYS\fR 25 -Keys are of arbitrary type, and are stored in the entry. Hashing -and comparison is determined by \fItypePtr\fR. The Tcl_HashKeyType -structure is described in the section -\fBTHE TCL_HASHKEYTYPE STRUCTURE\fR below. -.IP \fBTCL_CUSTOM_PTR_KEYS\fR 25 -Keys are pointers to an arbitrary type, and are stored in the entry. Hashing -and comparison is determined by \fItypePtr\fR. The Tcl_HashKeyType -structure is described in the section -\fBTHE TCL_HASHKEYTYPE STRUCTURE\fR below. -.IP \fIother\fR 25 -If \fIkeyType\fR is not one of the above, -then it must be an integer value greater than 1. -In this case the keys will be arrays of -.QW int -values, where -\fIkeyType\fR gives the number of ints in each key. -This allows structures to be used as keys. -All keys must have the same size. -Array keys are passed into hashing functions using the address -of the first int in the array. -.PP -\fBTcl_DeleteHashTable\fR deletes all of the entries in a hash -table and frees up the memory associated with the table's -bucket array and entries. -It does not free the actual table structure (pointed to -by \fItablePtr\fR), since that memory is assumed to be managed -by the client. -\fBTcl_DeleteHashTable\fR also does not free or otherwise -manipulate the values of the hash table entries. -If the entry values point to dynamically-allocated memory, then -it is the client's responsibility to free these structures -before deleting the table. -.PP -\fBTcl_CreateHashEntry\fR locates the entry corresponding to a -particular key, creating a new entry in the table if there -was not already one with the given key. -If an entry already existed with the given key then \fI*newPtr\fR -is set to zero. -If a new entry was created, then \fI*newPtr\fR is set to a non-zero -value and the value of the new entry will be set to zero. -The return value from \fBTcl_CreateHashEntry\fR is a pointer to -the entry, which may be used to retrieve and modify the entry's -value or to delete the entry from the table. -.PP -\fBTcl_DeleteHashEntry\fR will remove an existing entry from a -table. -The memory associated with the entry itself will be freed, but -the client is responsible for any cleanup associated with the -entry's value, such as freeing a structure that it points to. -.PP -\fBTcl_FindHashEntry\fR is similar to \fBTcl_CreateHashEntry\fR -except that it does not create a new entry if the key doesn't exist; -instead, it returns NULL as result. -.PP -\fBTcl_GetHashValue\fR and \fBTcl_SetHashValue\fR are used to -read and write an entry's value, respectively. -Values are stored and retrieved as type -.QW ClientData , -which is -large enough to hold a pointer value. On almost all machines this is -large enough to hold an integer value too. -.PP -\fBTcl_GetHashKey\fR returns the key for a given hash table entry, -either as a pointer to a string, a one-word -.PQ "char *" -key, or -as a pointer to the first word of an array of integers, depending -on the \fIkeyType\fR used to create a hash table. -In all cases \fBTcl_GetHashKey\fR returns a result with type -.QW "char *" . -When the key is a string or array, the result of \fBTcl_GetHashKey\fR -points to information in the table entry; this information will -remain valid until the entry is deleted or its table is deleted. -.PP -\fBTcl_FirstHashEntry\fR and \fBTcl_NextHashEntry\fR may be used -to scan all of the entries in a hash table. -A structure of type -.QW Tcl_HashSearch , -provided by the client, -is used to keep track of progress through the table. -\fBTcl_FirstHashEntry\fR initializes the search record and -returns the first entry in the table (or NULL if the table is -empty). -Each subsequent call to \fBTcl_NextHashEntry\fR returns the -next entry in the table or -NULL if the end of the table has been reached. -A call to \fBTcl_FirstHashEntry\fR followed by calls to -\fBTcl_NextHashEntry\fR will return each of the entries in -the table exactly once, in an arbitrary order. -It is inadvisable to modify the structure of the table, e.g. -by creating or deleting entries, while the search is in progress, -with the exception of deleting the entry returned by -\fBTcl_FirstHashEntry\fR or \fBTcl_NextHashEntry\fR. -.PP -\fBTcl_HashStats\fR returns a dynamically-allocated string with -overall information about a hash table, such as the number of -entries it contains, the number of buckets in its hash array, -and the utilization of the buckets. -It is the caller's responsibility to free the result string -by passing it to \fBckfree\fR. -.PP -The header file \fBtcl.h\fR defines the actual data structures -used to implement hash tables. -This is necessary so that clients can allocate Tcl_HashTable -structures and so that macros can be used to read and write -the values of entries. -However, users of the hashing routines should never refer directly -to any of the fields of any of the hash-related data structures; -use the procedures and macros defined here. -.SH "THE TCL_HASHKEYTYPE STRUCTURE" -.PP -Extension writers can define new hash key types by defining four procedures, -initializing a \fBTcl_HashKeyType\fR structure to describe the type, and -calling \fBTcl_InitCustomHashTable\fR. The \fBTcl_HashKeyType\fR structure is -defined as follows: -.PP -.CS -typedef struct Tcl_HashKeyType { - int \fIversion\fR; - int \fIflags\fR; - Tcl_HashKeyProc *\fIhashKeyProc\fR; - Tcl_CompareHashKeysProc *\fIcompareKeysProc\fR; - Tcl_AllocHashEntryProc *\fIallocEntryProc\fR; - Tcl_FreeHashEntryProc *\fIfreeEntryProc\fR; -} \fBTcl_HashKeyType\fR; -.CE -.PP -The \fIversion\fR member is the version of the table. If this structure is -extended in future then the version can be used to distinguish between -different structures. It should be set to \fBTCL_HASH_KEY_TYPE_VERSION\fR. -.PP -The \fIflags\fR member is 0 or one or more of the following values OR'ed -together: -.IP \fBTCL_HASH_KEY_RANDOMIZE_HASH\fR 25 -There are some things, pointers for example which do not hash well because -they do not use the lower bits. If this flag is set then the hash table will -attempt to rectify this by randomizing the bits and then using the upper N -bits as the index into the table. -.IP \fBTCL_HASH_KEY_SYSTEM_HASH\fR 25 -This flag forces Tcl to use the memory allocation procedures provided by the -operating system when allocating and freeing memory used to store the hash -table data structures, and not any of Tcl's own customized memory allocation -routines. This is important if the hash table is to be used in the -implementation of a custom set of allocation routines, or something that a -custom set of allocation routines might depend on, in order to avoid any -circular dependency. -.PP -The \fIhashKeyProc\fR member contains the address of a function called to -calculate a hash value for the key. -.PP -.CS -typedef TCL_HASH_TYPE \fBTcl_HashKeyProc\fR( - Tcl_HashTable *\fItablePtr\fR, - void *\fIkeyPtr\fR); -.CE -.PP -If this is NULL then \fIkeyPtr\fR is used and -\fBTCL_HASH_KEY_RANDOMIZE_HASH\fR is assumed. -.PP -The \fIcompareKeysProc\fR member contains the address of a function called to -compare two keys. -.PP -.CS -typedef int \fBTcl_CompareHashKeysProc\fR( - void *\fIkeyPtr\fR, - Tcl_HashEntry *\fIhPtr\fR); -.CE -.PP -If this is NULL then the \fIkeyPtr\fR pointers are compared. If the keys do -not match then the function returns 0, otherwise it returns 1. -.PP -The \fIallocEntryProc\fR member contains the address of a function called to -allocate space for an entry and initialize the key and clientData. -.PP -.CS -typedef Tcl_HashEntry *\fBTcl_AllocHashEntryProc\fR( - Tcl_HashTable *\fItablePtr\fR, - void *\fIkeyPtr\fR); -.CE -.PP -If this is NULL then \fBTcl_Alloc\fR is used to allocate enough space for a -Tcl_HashEntry, the key pointer is assigned to key.oneWordValue and the -clientData is set to NULL. String keys and array keys use this function to -allocate enough space for the entry and the key in one block, rather than -doing it in two blocks. This saves space for a pointer to the key from the -entry and another memory allocation. Tcl_Obj* keys use this function to -allocate enough space for an entry and increment the reference count on the -value. -.PP -The \fIfreeEntryProc\fR member contains the address of a function called to -free space for an entry. -.PP -.CS -typedef void \fBTcl_FreeHashEntryProc\fR( - Tcl_HashEntry *\fIhPtr\fR); -.CE -.PP -If this is NULL then \fBTcl_Free\fR is used to free the space for the entry. -Tcl_Obj* keys use this function to decrement the reference count on the -value. -.SH KEYWORDS -hash table, key, lookup, search, value diff --git a/doc/Init.3 b/doc/Init.3 deleted file mode 100644 index 0a6635e..0000000 --- a/doc/Init.3 +++ /dev/null @@ -1,34 +0,0 @@ -'\" -'\" Copyright (c) 1998-2000 by Scriptics Corporation. -'\" All rights reserved. -'\" -.TH Tcl_Init 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_Init \- find and source initialization script -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_Init\fR(\fIinterp\fR) -.SH ARGUMENTS -.AS Tcl_Interp *interp -.AP Tcl_Interp *interp in -Interpreter to initialize. -.BE - -.SH DESCRIPTION -.PP -\fBTcl_Init\fR is a helper procedure that finds and \fBsource\fRs the -\fBinit.tcl\fR script, which should exist somewhere on the Tcl library -path. -.PP -\fBTcl_Init\fR is typically called from \fBTcl_AppInit\fR procedures. - -.SH "SEE ALSO" -Tcl_AppInit, Tcl_Main - -.SH KEYWORDS -application, initialization, interpreter diff --git a/doc/InitStubs.3 b/doc/InitStubs.3 deleted file mode 100644 index 4423666..0000000 --- a/doc/InitStubs.3 +++ /dev/null @@ -1,89 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_InitStubs 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_InitStubs \- initialize the Tcl stubs mechanism -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -const char * -\fBTcl_InitStubs\fR(\fIinterp, version, exact\fR) -.SH ARGUMENTS -.AS Tcl_Interp *interp -.AP Tcl_Interp *interp in -Tcl interpreter handle. -.AP "const char" *version in -A version string consisting of one or more decimal numbers -separated by dots. -.AP int exact in -1 means that only the particular version specified by -\fIversion\fR is acceptable. -0 means that versions newer than \fIversion\fR are also -acceptable as long as they have the same major version number -as \fIversion\fR. Other bits have no effect. -.BE -.SH INTRODUCTION -.PP -The Tcl stubs mechanism defines a way to dynamically bind -extensions to a particular Tcl implementation at run time. -This provides two significant benefits to Tcl users: -.IP 1) 5 -Extensions that use the stubs mechanism can be loaded into -multiple versions of Tcl without being recompiled or -relinked. -.IP 2) 5 -Extensions that use the stubs mechanism can be dynamically -loaded into statically-linked Tcl applications. -.PP -The stubs mechanism accomplishes this by exporting function tables -that define an interface to the Tcl API. The extension then accesses -the Tcl API through offsets into the function table, so there are no -direct references to any of the Tcl library's symbols. This -redirection is transparent to the extension, so an extension writer -can continue to use all public Tcl functions as documented. -.PP -The stubs mechanism requires no changes to applications incorporating -Tcl interpreters. Only developers creating C-based Tcl extensions -need to take steps to use the stubs mechanism with their extensions. -.PP -Enabling the stubs mechanism for an extension requires the following -steps: -.IP 1) 5 -Call \fBTcl_InitStubs\fR in the extension before calling any other -Tcl functions. -.IP 2) 5 -Define the \fBUSE_TCL_STUBS\fR symbol. Typically, you would include the -\fB\-DUSE_TCL_STUBS\fR flag when compiling the extension. -.IP 3) 5 -Link the extension with the Tcl stubs library instead of the standard -Tcl library. For example, to use the Tcl 8.6 ABI on Unix platforms, -the library name is \fIlibtclstub8.6.a\fR; on Windows platforms, the -library name is \fItclstub86.lib\fR. -.PP -If the extension also requires the Tk API, it must also call -\fBTk_InitStubs\fR to initialize the Tk stubs interface and link -with the Tk stubs libraries. See the \fBTk_InitStubs\fR page for -more information. -.SH DESCRIPTION -\fBTcl_InitStubs\fR attempts to initialize the stub table pointers -and ensure that the correct version of Tcl is loaded. In addition -to an interpreter handle, it accepts as arguments a version number -and a Boolean flag indicating whether the extension requires -an exact version match or not. If \fIexact\fR is 0, then the -extension is indicating that newer versions of Tcl are acceptable -as long as they have the same major version number as \fIversion\fR; -non-zero means that only the specified \fIversion\fR is acceptable. -\fBTcl_InitStubs\fR returns a string containing the actual version -of Tcl satisfying the request, or NULL if the Tcl version is not -acceptable, does not support stubs, or any other error condition occurred. -.SH "SEE ALSO" -Tk_InitStubs -.SH KEYWORDS -stubs diff --git a/doc/IntObj.3 b/doc/IntObj.3 deleted file mode 100644 index 2acb446..0000000 --- a/doc/IntObj.3 +++ /dev/null @@ -1,152 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_IntObj 3 8.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_NewIntObj, Tcl_NewLongObj, Tcl_NewWideIntObj, Tcl_SetIntObj, Tcl_SetLongObj, Tcl_SetWideIntObj, Tcl_GetIntFromObj, Tcl_GetLongFromObj, Tcl_GetWideIntFromObj, Tcl_NewBignumObj, Tcl_SetBignumObj, Tcl_GetBignumFromObj, Tcl_TakeBignumFromObj \- manipulate Tcl values as integers -.SH SYNOPSIS -.nf -\fB#include \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) -.sp -.sp -\fB#include \fR -.sp -Tcl_Obj * -\fBTcl_NewBignumObj\fR(\fIbigValue\fR) -.sp -\fBTcl_SetBignumObj\fR(\fIobjPtr, bigValue\fR) -.sp -int -\fBTcl_GetBignumFromObj\fR(\fIinterp, objPtr, bigValue\fR) -.sp -int -\fBTcl_TakeBignumFromObj\fR(\fIinterp, objPtr, bigValue\fR) -.sp -int -\fBTcl_InitBignumFromDouble\fR(\fIinterp, doubleValue, bigValue\fR) -.SH ARGUMENTS -.AS Tcl_WideInt doubleValue in/out -.AP int intValue in -Integer value used to initialize or set a Tcl value. -.AP long longValue in -Long integer value used to initialize or set a Tcl value. -.AP Tcl_WideInt wideValue in -Wide integer value used to initialize or set a Tcl value. -.AP Tcl_Obj *objPtr in/out -For \fBTcl_SetIntObj\fR, \fBTcl_SetLongObj\fR, \fBTcl_SetWideIntObj\fR, -and \fBTcl_SetBignumObj\fR, this points to the value in which to store an -integral value. For \fBTcl_GetIntFromObj\fR, \fBTcl_GetLongFromObj\fR, -\fBTcl_GetWideIntFromObj\fR, \fBTcl_GetBignumFromObj\fR, and -\fBTcl_TakeBignumFromObj\fR, this refers to the value from which -to retrieve an integral value. -.AP Tcl_Interp *interp in/out -When non-NULL, an error message is left here when integral value -retrieval fails. -.AP int *intPtr out -Points to place to store the integer value retrieved from \fIobjPtr\fR. -.AP long *longPtr out -Points to place to store the long integer value retrieved from \fIobjPtr\fR. -.AP Tcl_WideInt *widePtr out -Points to place to store the wide integer value retrieved from \fIobjPtr\fR. -.AP mp_int *bigValue in/out -Points to a multi-precision integer structure declared by the LibTomMath -library. -.AP double doubleValue in -Double value from which the integer part is determined and -used to initialize a multi-precision integer value. -.BE -.SH DESCRIPTION -.PP -These procedures are used to create, modify, and read Tcl values -that hold integral values. -.PP -The different routines exist to accommodate different integral types in C -with which values might be exchanged. The C integral types for which Tcl -provides value exchange routines are \fBint\fR, \fBlong int\fR, -\fBTcl_WideInt\fR, and \fBmp_int\fR. The \fBint\fR and \fBlong int\fR types -are provided by the C language standard. The \fBTcl_WideInt\fR type is a -typedef defined to be whatever signed integral type covers at least the -64-bit integer range (-9223372036854775808 to 9223372036854775807). Depending -on the platform and the C compiler, the actual type might be -\fBlong int\fR, \fBlong long int\fR, \fB__int64\fR, or something else. -The \fBmp_int\fR type is a multiple-precision integer type defined -by the LibTomMath multiple-precision integer library. -.PP -The \fBTcl_NewIntObj\fR, \fBTcl_NewLongObj\fR, \fBTcl_NewWideIntObj\fR, -and \fBTcl_NewBignumObj\fR routines each create and return a new -Tcl value initialized to the integral value of the argument. The -returned Tcl value is unshared. -.PP -The \fBTcl_SetIntObj\fR, \fBTcl_SetLongObj\fR, \fBTcl_SetWideIntObj\fR, -and \fBTcl_SetBignumObj\fR routines each set the value of an existing -Tcl value pointed to by \fIobjPtr\fR to the integral value provided -by the other argument. The \fIobjPtr\fR argument must point to an -unshared Tcl value. Any attempt to set the value of a shared Tcl value -violates Tcl's copy-on-write policy. Any existing string representation -or internal representation in the unshared Tcl value will be freed -as a consequence of setting the new value. -.PP -The \fBTcl_GetIntFromObj\fR, \fBTcl_GetLongFromObj\fR, -\fBTcl_GetWideIntFromObj\fR, \fBTcl_GetBignumFromObj\fR, and -\fBTcl_TakeBignumFromObj\fR routines attempt to retrieve an integral -value of the appropriate type from the Tcl value \fIobjPtr\fR. If the -attempt succeeds, then \fBTCL_OK\fR is returned, and the value is -written to the storage provided by the caller. The attempt might -fail if \fIobjPtr\fR does not hold an integral value, or if the -value exceeds the range of the target type. If the attempt fails, -then \fBTCL_ERROR\fR is returned, and if \fIinterp\fR is non-NULL, -an error message is left in \fIinterp\fR. The \fBTcl_ObjType\fR -of \fIobjPtr\fR may be changed to make subsequent calls to the -same routine more efficient. Unlike the other functions, -\fBTcl_TakeBignumFromObj\fR may set the content of the Tcl value -\fIobjPtr\fR to an empty string in the process of retrieving the -multiple-precision integer value. -.PP -The choice between \fBTcl_GetBignumFromObj\fR and -\fBTcl_TakeBignumFromObj\fR is governed by how the caller will -continue to use \fIobjPtr\fR. If after the \fBmp_int\fR value -is retrieved from \fIobjPtr\fR, the caller will make no more -use of \fIobjPtr\fR, then using \fBTcl_TakeBignumFromObj\fR -permits Tcl to detect when an unshared \fIobjPtr\fR permits the -value to be moved instead of copied, which should be more efficient. -If anything later in the caller requires -\fIobjPtr\fR to continue to hold the same value, then -\fBTcl_GetBignumFromObj\fR must be chosen. -.PP -The \fBTcl_InitBignumFromDouble\fR routine is a utility procedure -that extracts the integer part of \fIdoubleValue\fR and stores that -integer value in the \fBmp_int\fR value \fIbigValue\fR. -.SH "SEE ALSO" -Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult -.SH KEYWORDS -integer, integer value, integer type, internal representation, value, -value type, string representation diff --git a/doc/Interp.3 b/doc/Interp.3 deleted file mode 100644 index 731007b..0000000 --- a/doc/Interp.3 +++ /dev/null @@ -1,134 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_Interp 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_Interp \- client-visible fields of interpreter structures -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -typedef struct { - char *\fIresult\fR; - Tcl_FreeProc *\fIfreeProc\fR; - int \fIerrorLine\fR; -} \fBTcl_Interp\fR; - -typedef void \fBTcl_FreeProc\fR( - char *\fIblockPtr\fR); -.BE -.SH DESCRIPTION -.PP -The \fBTcl_CreateInterp\fR procedure returns a pointer to a Tcl_Interp -structure. Callers of \fBTcl_CreateInterp\fR should use this pointer -as an opaque token, suitable for nothing other than passing back to -other routines in the Tcl interface. Accessing fields directly through -the pointer as described below is no longer supported. The supported -public routines \fBTcl_SetResult\fR, \fBTcl_GetResult\fR, -\fBTcl_SetErrorLine\fR, \fBTcl_GetErrorLine\fR must be used instead. -.PP -For legacy programs and extensions no longer being maintained, compiles -against the Tcl 8.6 header files are only possible with the compiler -directives -.CS -#define USE_INTERP_RESULT -.CE -and/or -.CS -#define USE_INTERP_ERRORLINE -.CE -depending on which fields of the \fBTcl_Interp\fR struct are accessed. -These directives may be embedded in code or supplied via compiler options. -.PP -The \fIresult\fR and \fIfreeProc\fR fields are used to return -results or error messages from commands. -This information is returned by command procedures back to \fBTcl_Eval\fR, -and by \fBTcl_Eval\fR back to its callers. -The \fIresult\fR field points to the string that represents the -result or error message, and the \fIfreeProc\fR field tells how -to dispose of the storage for the string when it is not needed anymore. -The easiest way for command procedures to manipulate these -fields is to call procedures like \fBTcl_SetResult\fR -or \fBTcl_AppendResult\fR; they -will hide all the details of managing the fields. -The description below is for those procedures that manipulate the -fields directly. -.PP -Whenever a command procedure returns, it must ensure -that the \fIresult\fR field of its interpreter points to the string -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 -the command. The \fIfreeProc\fR field will be initialized to zero, -and \fIinterp->result\fR will point to an empty string. Commands that -do not return any value can simply leave the fields alone. -Furthermore, the empty string pointed to by \fIresult\fR is actually -part of an array of \fBTCL_RESULT_SIZE\fR characters (approximately 200). -If a command wishes to return a short string, it can simply copy -it to the area pointed to by \fIinterp->result\fR. Or, it can use -the sprintf procedure to generate a short result string at the location -pointed to by \fIinterp->result\fR. -.PP -It is a general convention in Tcl-based applications that the result -of an interpreter is normally in the initialized state described -in the previous paragraph. -Procedures that manipulate an interpreter's result (e.g. by -returning an error) will generally assume that the result -has been initialized when the procedure is called. -If such a procedure is to be called after the result has been -changed, then \fBTcl_ResetResult\fR should be called first to -reset the result to its initialized state. The direct use of -\fIinterp->result\fR is strongly deprecated (see \fBTcl_SetResult\fR). -.PP -The \fIerrorLine\fR -field is valid only after \fBTcl_Eval\fR returns -a \fBTCL_ERROR\fR return code. In this situation the \fIerrorLine\fR -field identifies the line number of the command being executed when -the error occurred. The line numbers are relative to the command -being executed: 1 means the first line of the command passed to -\fBTcl_Eval\fR, 2 means the second line, and so on. -The \fIerrorLine\fR field is typically used in conjunction with -\fBTcl_AddErrorInfo\fR to report information about where an error -occurred. -\fIErrorLine\fR should not normally be modified except by \fBTcl_Eval\fR. - -.SH KEYWORDS -free, initialized, interpreter, malloc, result diff --git a/doc/Limit.3 b/doc/Limit.3 deleted file mode 100644 index 5939a80..0000000 --- a/doc/Limit.3 +++ /dev/null @@ -1,192 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_LimitCheck 3 8.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_LimitAddHandler, Tcl_LimitCheck, Tcl_LimitExceeded, Tcl_LimitGetCommands, Tcl_LimitGetGranularity, Tcl_LimitGetTime, Tcl_LimitReady, Tcl_LimitRemoveHandler, Tcl_LimitSetCommands, Tcl_LimitSetGranularity, Tcl_LimitSetTime, Tcl_LimitTypeEnabled, Tcl_LimitTypeExceeded, Tcl_LimitTypeReset, Tcl_LimitTypeSet \- manage and check resource limits on interpreters -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_LimitCheck\fR(\fIinterp\fR) -.sp -int -\fBTcl_LimitReady\fR(\fIinterp\fR) -.sp -int -\fBTcl_LimitExceeded\fR(\fIinterp\fR) -.sp -int -\fBTcl_LimitTypeExceeded\fR(\fIinterp, type\fR) -.sp -int -\fBTcl_LimitTypeEnabled\fR(\fIinterp, type\fR) -.sp -void -\fBTcl_LimitTypeSet\fR(\fIinterp, type\fR) -.sp -void -\fBTcl_LimitTypeReset\fR(\fIinterp, type\fR) -.sp -int -\fBTcl_LimitGetCommands\fR(\fIinterp\fR) -.sp -void -\fBTcl_LimitSetCommands\fR(\fIinterp, commandLimit\fR) -.sp -void -\fBTcl_LimitGetTime\fR(\fIinterp, timeLimitPtr\fR) -.sp -void -\fBTcl_LimitSetTime\fR(\fIinterp, timeLimitPtr\fR) -.sp -int -\fBTcl_LimitGetGranularity\fR(\fIinterp, type\fR) -.sp -void -\fBTcl_LimitSetGranularity\fR(\fIinterp, type, granularity\fR) -.sp -void -\fBTcl_LimitAddHandler\fR(\fIinterp, type, handlerProc, clientData, deleteProc\fR) -.sp -void -\fBTcl_LimitRemoveHandler\fR(\fIinterp, type, handlerProc, clientData\fR) -.SH ARGUMENTS -.AS Tcl_LimitHandlerDeleteProc commandLimit in/out -.AP Tcl_Interp *interp in -Interpreter that the limit being managed applies to or that will have -its limits checked. -.AP int type in -The type of limit that the operation refers to. This must be either -\fBTCL_LIMIT_COMMANDS\fR or \fBTCL_LIMIT_TIME\fR. -.AP int commandLimit in -The maximum number of commands (as reported by \fBinfo cmdcount\fR) -that may be executed in the interpreter. -.AP Tcl_Time *timeLimitPtr in/out -A pointer to a structure that will either have the new time limit read -from (\fBTcl_LimitSetTime\fR) or the current time limit written to -(\fBTcl_LimitGetTime\fR). -.AP int granularity in -Divisor that indicates how often a particular limit should really be -checked. Must be at least 1. -.AP Tcl_LimitHandlerProc *handlerProc in -Function to call when a particular limit is exceeded. If the -\fIhandlerProc\fR removes or raises the limit during its processing, -the limited interpreter will be permitted to continue to process after -the handler returns. Many handlers may be attached to the same -interpreter limit; their order of execution is not defined, and they -must be identified by \fIhandlerProc\fR and \fIclientData\fR when they -are deleted. -.AP ClientData clientData in -Arbitrary pointer-sized word used to pass some context to the -\fIhandlerProc\fR function. -.AP Tcl_LimitHandlerDeleteProc *deleteProc in -Function to call whenever a handler is deleted. May be NULL if the -\fIclientData\fR requires no deletion. -.BE -.SH DESCRIPTION -.PP -Tcl's interpreter resource limit subsystem allows for close control -over how much computation time a script may use, and is useful for -cases where a program is divided into multiple pieces where some parts -are more trusted than others (e.g. web application servers). -.PP -Every interpreter may have a limit on the wall-time for execution, and -a limit on the number of commands that the interpreter may execute. -Since checking of these limits is potentially expensive (especially -the time limit), each limit also has a checking granularity, which is -a divisor for an internal count of the number of points in the core -where a check may be performed (which is immediately before executing -a command and at an unspecified frequency between running commands, -which can happen in empty-bodied \fBwhile\fR loops). -.PP -The final component of the limit engine is a callback scheme which -allows for notifications of when a limit has been exceeded. These -callbacks can just provide logging, or may allocate more resources to -the interpreter to permit it to continue processing longer. -.PP -When a limit is exceeded (and the callbacks have run; the order of -execution of the callbacks is unspecified) execution in the limited -interpreter is stopped by raising an error and setting a flag that -prevents the \fBcatch\fR command in that interpreter from trapping -that error. It is up to the context that started execution in that -interpreter (typically a master interpreter) to handle the error. -.SH "LIMIT CHECKING API" -.PP -To check the resource limits for an interpreter, call -\fBTcl_LimitCheck\fR, which returns \fBTCL_OK\fR if the limit was not -exceeded (after processing callbacks) and \fBTCL_ERROR\fR if the limit was -exceeded (in which case an error message is also placed in the -interpreter result). That function should only be called when -\fBTcl_LimitReady\fR returns non-zero so that granularity policy is -enforced. This API is designed to be similar in usage to -\fBTcl_AsyncReady\fR and \fBTcl_AsyncInvoke\fR. -.PP -When writing code that may behave like \fBcatch\fR in respect of -errors, you should only trap an error if \fBTcl_LimitExceeded\fR -returns zero. If it returns non-zero, the interpreter is in a -limit-exceeded state and errors should be allowed to propagate to the -calling context. You can also check whether a particular type of -limit has been exceeded using \fBTcl_LimitTypeExceeded\fR. -.SH "LIMIT CONFIGURATION" -.PP -To check whether a limit has been set (but not whether it has actually -been exceeded) on an interpreter, call \fBTcl_LimitTypeEnabled\fR with -the type of limit you want to check. To enable a particular limit -call \fBTcl_LimitTypeSet\fR, and to disable a limit call -\fBTcl_LimitTypeReset\fR. -.PP -The level of a command limit may be set using -\fBTcl_LimitSetCommands\fR, and retrieved using -\fBTcl_LimitGetCommands\fR. Similarly for a time limit with -\fBTcl_LimitSetTime\fR and \fBTcl_LimitGetTime\fR respectively, but -with that API the time limit is copied from and to the Tcl_Time -structure that the \fItimeLimitPtr\fR argument points to. -.PP -The checking granularity for a particular limit may be set using -\fBTcl_LimitSetGranularity\fR and retrieved using -\fBTcl_LimitGetGranularity\fR. Note that granularities must always be -positive. -.SS "LIMIT CALLBACKS" -.PP -To add a handler callback to be invoked when a limit is exceeded, call -\fBTcl_LimitAddHandler\fR. The \fIhandlerProc\fR argument describes -the function that will actually be called; it should have the -following prototype: -.PP -.CS -typedef void \fBTcl_LimitHandlerProc\fR( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR); -.CE -.PP -The \fIclientData\fR argument to the handler will be whatever is -passed to the \fIclientData\fR argument to \fBTcl_LimitAddHandler\fR, -and the \fIinterp\fR is the interpreter that had its limit exceeded. -.PP -The \fIdeleteProc\fR argument to \fBTcl_LimitAddHandler\fR is a -function to call to delete the \fIclientData\fR value. It may be -\fBTCL_STATIC\fR or NULL if no deletion action is necessary, or -\fBTCL_DYNAMIC\fR if all that is necessary is to free the structure with -\fBTcl_Free\fR. Otherwise, it should refer to a function with the -following prototype: -.PP -.CS -typedef void \fBTcl_LimitHandlerDeleteProc\fR( - ClientData \fIclientData\fR); -.CE -.PP -A limit handler may be deleted using \fBTcl_LimitRemoveHandler\fR; the -handler removed will be the first one found (out of the handlers added -with \fBTcl_LimitAddHandler\fR) with exactly matching \fItype\fR, -\fIhandlerProc\fR and \fIclientData\fR arguments. This function -always invokes the \fIdeleteProc\fR on the \fIclientData\fR (unless -the \fIdeleteProc\fR was NULL or \fBTCL_STATIC\fR). -.SH KEYWORDS -interpreter, resource, limit, commands, time, callback diff --git a/doc/LinkVar.3 b/doc/LinkVar.3 deleted file mode 100644 index c80d30d..0000000 --- a/doc/LinkVar.3 +++ /dev/null @@ -1,231 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_LinkVar 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_LinkVar, Tcl_UnlinkVar, Tcl_UpdateLinkedVar \- link Tcl variable to C variable -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_LinkVar\fR(\fIinterp, varName, addr, type\fR) -.sp -\fBTcl_UnlinkVar\fR(\fIinterp, varName\fR) -.sp -\fBTcl_UpdateLinkedVar\fR(\fIinterp, varName\fR) -.SH ARGUMENTS -.AS Tcl_Interp writable -.AP Tcl_Interp *interp in -Interpreter that contains \fIvarName\fR. -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_UINT\fR, \fBTCL_LINK_CHAR\fR, \fBTCL_LINK_UCHAR\fR, -\fBTCL_LINK_SHORT\fR, \fBTCL_LINK_USHORT\fR, \fBTCL_LINK_LONG\fR, -\fBTCL_LINK_ULONG\fR, \fBTCL_LINK_WIDE_INT\fR, -\fBTCL_LINK_WIDE_UINT\fR, \fBTCL_LINK_FLOAT\fR, -\fBTCL_LINK_DOUBLE\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 -named by \fIvarName\fR in sync with the C variable at the address -given by \fIaddr\fR. -Whenever the Tcl variable is read the value of the C variable will -be returned, and whenever the Tcl variable is written the C -variable will be updated to have the same value. -\fBTcl_LinkVar\fR normally returns \fBTCL_OK\fR; if an error occurs -while setting up the link (e.g. because \fIvarName\fR is the -name of array) then \fBTCL_ERROR\fR is returned and the interpreter's result -contains an error message. -.PP -The \fItype\fR argument specifies the type of the C variable, -and must have one of the following values, optionally OR'ed with -\fBTCL_LINK_READ_ONLY\fR: -.TP -\fBTCL_LINK_INT\fR -The C variable is of type \fBint\fR. -Any value written into the Tcl variable must have a proper integer -form acceptable to \fBTcl_GetIntFromObj\fR; attempts to write -non-integer values into \fIvarName\fR will be rejected with -Tcl errors. Incomplete integer representations (like the empty -string, '+', '-' or the hex/octal/binary prefix) are accepted -as if they are valid too. -.TP -\fBTCL_LINK_UINT\fR -The C variable is of type \fBunsigned int\fR. -Any value written into the Tcl variable must have a proper unsigned -integer form acceptable to \fBTcl_GetWideIntFromObj\fR and in the -platform's defined range for the \fBunsigned int\fR type; attempts to -write non-integer values (or values outside the range) into -\fIvarName\fR will be rejected with Tcl errors. Incomplete integer -representations (like the empty string, '+', '-' or the hex/octal/binary -prefix) are accepted as if they are valid too. -.TP -\fBTCL_LINK_CHAR\fR -The C variable is of type \fBchar\fR. -Any value written into the Tcl variable must have a proper integer -form acceptable to \fBTcl_GetIntFromObj\fR and be in the range of the -\fBchar\fR datatype; attempts to write non-integer or out-of-range -values into \fIvarName\fR will be rejected with Tcl errors. Incomplete -integer representations (like the empty string, '+', '-' or the -hex/octal/binary prefix) are accepted as if they are valid too. -.TP -\fBTCL_LINK_UCHAR\fR -The C variable is of type \fBunsigned char\fR. -Any value written into the Tcl variable must have a proper unsigned -integer form acceptable to \fBTcl_GetIntFromObj\fR and in the -platform's defined range for the \fBunsigned char\fR type; attempts to -write non-integer values (or values outside the range) into -\fIvarName\fR will be rejected with Tcl errors. Incomplete integer -representations (like the empty string, '+', '-' or the hex/octal/binary -prefix) are accepted as if they are valid too. -.TP -\fBTCL_LINK_SHORT\fR -The C variable is of type \fBshort\fR. -Any value written into the Tcl variable must have a proper integer -form acceptable to \fBTcl_GetIntFromObj\fR and be in the range of the -\fBshort\fR datatype; attempts to write non-integer or out-of-range -values into \fIvarName\fR will be rejected with Tcl errors. Incomplete -integer representations (like the empty string, '+', '-' or the -hex/octal/binary prefix) are accepted as if they are valid too. -.TP -\fBTCL_LINK_USHORT\fR -The C variable is of type \fBunsigned short\fR. -Any value written into the Tcl variable must have a proper unsigned -integer form acceptable to \fBTcl_GetIntFromObj\fR and in the -platform's defined range for the \fBunsigned short\fR type; attempts to -write non-integer values (or values outside the range) into -\fIvarName\fR will be rejected with Tcl errors. Incomplete integer -representations (like the empty string, '+', '-' or the hex/octal/binary -prefix) are accepted as if they are valid too. -.TP -\fBTCL_LINK_LONG\fR -The C variable is of type \fBlong\fR. -Any value written into the Tcl variable must have a proper integer -form acceptable to \fBTcl_GetLongFromObj\fR; attempts to write -non-integer or out-of-range -values into \fIvarName\fR will be rejected with Tcl errors. Incomplete -integer representations (like the empty string, '+', '-' or the -hex/octal/binary prefix) are accepted as if they are valid too. -.TP -\fBTCL_LINK_ULONG\fR -The C variable is of type \fBunsigned long\fR. -Any value written into the Tcl variable must have a proper unsigned -integer form acceptable to \fBTcl_GetWideIntFromObj\fR and in the -platform's defined range for the \fBunsigned long\fR type; attempts to -write non-integer values (or values outside the range) into -\fIvarName\fR will be rejected with Tcl errors. Incomplete integer -representations (like the empty string, '+', '-' or the hex/octal/binary -prefix) are accepted as if they are valid too. -.TP -\fBTCL_LINK_DOUBLE\fR -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. Incomplete integer or real representations (like the -empty string, '.', '+', '-' or the hex/octal/binary prefix) are -accepted as if they are valid too. -.TP -\fBTCL_LINK_FLOAT\fR -The C variable is of type \fBfloat\fR. -Any value written into the Tcl variable must have a proper real -form acceptable to \fBTcl_GetDoubleFromObj\fR and must be within the -range acceptable for a \fBfloat\fR; attempts to -write non-real values (or values outside the range) into -\fIvarName\fR will be rejected with Tcl errors. Incomplete integer -or real representations (like the empty string, '.', '+', '-' or -the hex/octal/binary prefix) are accepted as if they are valid too. -.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. Incomplete integer representations (like the empty -string, '+', '-' or the hex/octal/binary prefix) are accepted -as if they are valid too. -.TP -\fBTCL_LINK_WIDE_UINT\fR -The C variable is of type \fBTcl_WideUInt\fR (which is an unsigned -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 unsigned -integer form acceptable to \fBTcl_GetWideIntFromObj\fR (it will be -cast to unsigned); -.\" FIXME! Use bignums instead. -attempts to write non-integer values into \fIvarName\fR will be -rejected with Tcl errors. Incomplete integer representations (like -the empty string, '+', '-' or the hex/octal/binary prefix) are accepted -as if they are valid too. -.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 -.QW 0 ; -otherwise it will read from Tcl as -.QW 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 -.QW NULL . -.PP -If the \fBTCL_LINK_READ_ONLY\fR flag is present in \fItype\fR then the -variable will be read-only from Tcl, so that its value can only be -changed by modifying the C variable. -Attempts to write the variable from Tcl will be rejected with errors. -.PP -\fBTcl_UnlinkVar\fR removes the link previously set up for the -variable given by \fIvarName\fR. If there does not exist a link -for \fIvarName\fR then the procedure has no effect. -.PP -\fBTcl_UpdateLinkedVar\fR may be invoked after the C variable has -changed to force the Tcl variable to be updated immediately. -In many cases this procedure is not needed, since any attempt to -read the Tcl variable will return the latest value of the C variable. -However, if a trace has been set on the Tcl variable (such as a -Tk widget that wishes to display the value of the variable), the -trace will not trigger when the C variable has changed. -\fBTcl_UpdateLinkedVar\fR ensures that any traces on the Tcl -variable are invoked. -.PP -Note that, as with any call to a Tcl interpreter, \fBTcl_UpdateLinkedVar\fR -must be called from the same thread that created the interpreter. The safest -mechanism is to ensure that the C variable is only ever updated from the same -thread that created the interpreter (possibly in response to an event posted -with \fBTcl_ThreadQueueEvent\fR), but when it is necessary to update the -variable in a separate thread, it is advised that \fBTcl_AsyncMark\fR be used -to indicate to the thread hosting the interpreter that it is ready to run -\fBTcl_UpdateLinkedVar\fR. -.SH "SEE ALSO" -Tcl_TraceVar(3) -.SH KEYWORDS -boolean, integer, link, read-only, real, string, trace, variable diff --git a/doc/ListObj.3 b/doc/ListObj.3 deleted file mode 100644 index dc1ba53..0000000 --- a/doc/ListObj.3 +++ /dev/null @@ -1,251 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_ListObj 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_ListObjAppendList, Tcl_ListObjAppendElement, Tcl_NewListObj, Tcl_SetListObj, Tcl_ListObjGetElements, Tcl_ListObjLength, Tcl_ListObjIndex, Tcl_ListObjReplace \- manipulate Tcl values as lists -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_ListObjAppendList\fR(\fIinterp, listPtr, elemListPtr\fR) -.sp -int -\fBTcl_ListObjAppendElement\fR(\fIinterp, listPtr, objPtr\fR) -.sp -Tcl_Obj * -\fBTcl_NewListObj\fR(\fIobjc, objv\fR) -.sp -\fBTcl_SetListObj\fR(\fIobjPtr, objc, objv\fR) -.sp -int -\fBTcl_ListObjGetElements\fR(\fIinterp, listPtr, objcPtr, objvPtr\fR) -.sp -int -\fBTcl_ListObjLength\fR(\fIinterp, listPtr, intPtr\fR) -.sp -int -\fBTcl_ListObjIndex\fR(\fIinterp, listPtr, index, objPtrPtr\fR) -.sp -int -\fBTcl_ListObjReplace\fR(\fIinterp, listPtr, first, count, objc, objv\fR) -.SH ARGUMENTS -.AS "Tcl_Obj *const" *elemListPtr in/out -.AP Tcl_Interp *interp in -If an error occurs while converting a value to be a list value, -an error message is left in the interpreter's result value -unless \fIinterp\fR is NULL. -.AP Tcl_Obj *listPtr in/out -Points to the list value to be manipulated. -If \fIlistPtr\fR does not already point to a list value, -an attempt will be made to convert it to one. -.AP Tcl_Obj *elemListPtr in/out -For \fBTcl_ListObjAppendList\fR, this points to a list value -containing elements to be appended onto \fIlistPtr\fR. -Each element of *\fIelemListPtr\fR will -become a new element of \fIlistPtr\fR. -If *\fIelemListPtr\fR is not NULL and -does not already point to a list value, -an attempt will be made to convert it to one. -.AP Tcl_Obj *objPtr in -For \fBTcl_ListObjAppendElement\fR, -points to the Tcl value that will be appended to \fIlistPtr\fR. -For \fBTcl_SetListObj\fR, -this points to the Tcl value that will be converted to a list value -containing the \fIobjc\fR elements of the array referenced by \fIobjv\fR. -.AP int *objcPtr in -Points to location where \fBTcl_ListObjGetElements\fR -stores the number of element values in \fIlistPtr\fR. -.AP Tcl_Obj ***objvPtr out -A location where \fBTcl_ListObjGetElements\fR stores a pointer to an array -of pointers to the element values of \fIlistPtr\fR. -.AP int objc in -The number of Tcl values that \fBTcl_NewListObj\fR -will insert into a new list value, -and \fBTcl_ListObjReplace\fR will insert into \fIlistPtr\fR. -For \fBTcl_SetListObj\fR, -the number of Tcl values to insert into \fIobjPtr\fR. -.AP "Tcl_Obj *const" objv[] in -An array of pointers to values. -\fBTcl_NewListObj\fR will insert these values into a new list value -and \fBTcl_ListObjReplace\fR will insert them into an existing \fIlistPtr\fR. -Each value will become a separate list element. -.AP int *intPtr out -Points to location where \fBTcl_ListObjLength\fR -stores the length of the list. -.AP int index in -Index of the list element that \fBTcl_ListObjIndex\fR -is to return. -The first element has index 0. -.AP Tcl_Obj **objPtrPtr out -Points to place where \fBTcl_ListObjIndex\fR is to store -a pointer to the resulting list element value. -.AP int first in -Index of the starting list element that \fBTcl_ListObjReplace\fR -is to replace. -The list's first element has index 0. -.AP int count in -The number of elements that \fBTcl_ListObjReplace\fR -is to replace. -.BE - -.SH DESCRIPTION -.PP -Tcl list values have an internal representation that supports -the efficient indexing and appending. -The procedures described in this man page are used to -create, modify, index, and append to Tcl list values from C code. -.PP -\fBTcl_ListObjAppendList\fR and \fBTcl_ListObjAppendElement\fR -both add one or more values -to the end of the list value referenced by \fIlistPtr\fR. -\fBTcl_ListObjAppendList\fR appends each element of the list value -referenced by \fIelemListPtr\fR while -\fBTcl_ListObjAppendElement\fR appends the single value -referenced by \fIobjPtr\fR. -Both procedures will convert the value referenced by \fIlistPtr\fR -to a list value if necessary. -If an error occurs during conversion, -both procedures return \fBTCL_ERROR\fR and leave an error message -in the interpreter's result value if \fIinterp\fR is not NULL. -Similarly, if \fIelemListPtr\fR does not already refer to a list value, -\fBTcl_ListObjAppendList\fR will attempt to convert it to one -and if an error occurs during conversion, -will return \fBTCL_ERROR\fR -and leave an error message in the interpreter's result value -if interp is not NULL. -Both procedures invalidate any old string representation of \fIlistPtr\fR -and, if it was converted to a list value, -free any old internal representation. -Similarly, \fBTcl_ListObjAppendList\fR frees any old internal representation -of \fIelemListPtr\fR if it converts it to a list value. -After appending each element in \fIelemListPtr\fR, -\fBTcl_ListObjAppendList\fR increments the element's reference count -since \fIlistPtr\fR now also refers to it. -For the same reason, \fBTcl_ListObjAppendElement\fR -increments \fIobjPtr\fR's reference count. -If no error occurs, -the two procedures return \fBTCL_OK\fR after appending the values. -.PP -\fBTcl_NewListObj\fR and \fBTcl_SetListObj\fR -create a new value or modify an existing value to hold -the \fIobjc\fR elements of the array referenced by \fIobjv\fR -where each element is a pointer to a Tcl value. -If \fIobjc\fR is less than or equal to zero, -they return an empty value. -The new value's string representation is left invalid. -The two procedures increment the reference counts -of the elements in \fIobjc\fR since the list value now refers to them. -The new list value 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 value. 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 value, \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 -value 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 value -referenced by \fIlistPtr\fR. -It returns this count by storing an integer in the address \fIintPtr\fR. -If the value is not already a list value, -\fBTcl_ListObjLength\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 value -if \fIinterp\fR is not NULL. -Otherwise it returns \fBTCL_OK\fR after storing the list's length. -.PP -The procedure \fBTcl_ListObjIndex\fR returns a pointer to the value -at element \fIindex\fR in the list referenced by \fIlistPtr\fR. -It returns this value by storing a pointer to it -in the address \fIobjPtrPtr\fR. -If \fIlistPtr\fR does not already refer to a list value, -\fBTcl_ListObjIndex\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 value -if \fIinterp\fR is not NULL. -If the index is out of range, -that is, \fIindex\fR is negative or -greater than or equal to the number of elements in the list, -\fBTcl_ListObjIndex\fR stores a NULL in \fIobjPtrPtr\fR -and returns \fBTCL_OK\fR. -Otherwise it returns \fBTCL_OK\fR after storing the element's -value pointer. -The reference count for the list element is not incremented; -the caller must do that if it needs to retain a pointer to the element. -.PP -\fBTcl_ListObjReplace\fR replaces zero or more elements -of the list referenced by \fIlistPtr\fR -with the \fIobjc\fR values in the array referenced by \fIobjv\fR. -If \fIlistPtr\fR does not point to a list value, -\fBTcl_ListObjReplace\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 value -if \fIinterp\fR is not NULL. -Otherwise, it returns \fBTCL_OK\fR after replacing the values. -If \fIobjv\fR is NULL, no new elements are added. -If the argument \fIfirst\fR is zero or negative, -it refers to the first element. -If \fIfirst\fR is greater than or equal to the -number of elements in the list, then no elements are deleted; -the new elements are appended to the list. -\fIcount\fR gives the number of elements to replace. -If \fIcount\fR is zero or negative then no elements are deleted; -the new elements are simply inserted before the one -designated by \fIfirst\fR. -\fBTcl_ListObjReplace\fR invalidates \fIlistPtr\fR's -old string representation. -The reference counts of any elements inserted from \fIobjv\fR -are incremented since the resulting list now refers to them. -Similarly, the reference counts for any replaced values are decremented. -.PP -Because \fBTcl_ListObjReplace\fR combines -both element insertion and deletion, -it can be used to implement a number of list operations. -For example, the following code inserts the \fIobjc\fR values -referenced by the array of value pointers \fIobjv\fR -just before the element \fIindex\fR of the list referenced by \fIlistPtr\fR: -.PP -.CS -result = \fBTcl_ListObjReplace\fR(interp, listPtr, index, 0, - objc, objv); -.CE -.PP -Similarly, the following code appends the \fIobjc\fR values -referenced by the array \fIobjv\fR -to the end of the list \fIlistPtr\fR: -.PP -.CS -result = \fBTcl_ListObjLength\fR(interp, listPtr, &length); -if (result == TCL_OK) { - result = \fBTcl_ListObjReplace\fR(interp, listPtr, length, 0, - objc, objv); -} -.CE -.PP -The \fIcount\fR list elements starting at \fIfirst\fR can be deleted -by simply calling \fBTcl_ListObjReplace\fR -with a NULL \fIobjvPtr\fR: -.PP -.CS -result = \fBTcl_ListObjReplace\fR(interp, listPtr, first, count, - 0, NULL); -.CE -.SH "SEE ALSO" -Tcl_NewObj(3), Tcl_DecrRefCount(3), Tcl_IncrRefCount(3), Tcl_GetObjResult(3) -.SH KEYWORDS -append, index, insert, internal representation, length, list, list value, -list type, value, value type, replace, string representation diff --git a/doc/Load.3 b/doc/Load.3 deleted file mode 100644 index 1d0d738..0000000 --- a/doc/Load.3 +++ /dev/null @@ -1,70 +0,0 @@ -'\" -'\" Copyright (c) 2009-2010 Kevin B. Kenny -'\" Copyright (c) 2010 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Load 3 8.6 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_LoadFile, Tcl_FindSymbol \- platform-independent dynamic library loading -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_LoadFile\fR(\fIinterp, pathPtr, symbols, flags, procPtrs, loadHandlePtr\fR) -.sp -void * -\fBTcl_FindSymbol\fR(\fIinterp, loadHandle, symbol\fR) -.SH ARGUMENTS -.AS Tcl_LoadHandle loadHandle in -.AP Tcl_Interp *interp in -Interpreter to use for reporting error messages. -.AP Tcl_Obj *pathPtr in -The name of the file to load. If it is a single name, the library search path -of the current environment will be used to resolve it. -.AP "const char *const" symbols[] in -Array of names of symbols to be resolved during the load of the library, or -NULL if no symbols are to be resolved. If an array is given, the last entry in -the array must be NULL. -.AP int flags in -The value should normally be 0, but \fITCL_LOAD_GLOBAL\fR or \fITCL_LOAD_LAZY\fR -or a combination of those two is allowed as well. -.AP void *procPtrs out -Points to an array that will hold the addresses of the functions described in -the \fIsymbols\fR argument. Should be NULL if no symbols are to be resolved. -.AP Tcl_LoadHandle *loadHandlePtr out -Points to a variable that will hold the handle to the abstract token -describing the library that has been loaded. -.AP Tcl_LoadHandle loadHandle in -Abstract token describing the library to look up a symbol in. -.AP "const char" *symbol in -The name of the symbol to look up. -.BE -.SH DESCRIPTION -.PP -\fBTcl_LoadFile\fR loads a file from the filesystem (including potentially any -virtual filesystem that has been installed) and provides a handle to it that -may be used in further operations. The \fIsymbols\fR array, if non-NULL, -supplies a set of names of symbols (typically functions) that must be resolved -from the library and which will be stored in the array indicated by -\fIprocPtrs\fR. If any of the symbols is not resolved, the loading of the file -will fail with an error message left in the interpreter (if that is non-NULL). -The result of \fBTcl_LoadFile\fR is a standard Tcl error code. The library may -be unloaded with \fBTcl_FSUnloadFile\fR. -.PP -\fBTcl_FindSymbol\fR locates a symbol in a loaded library and returns it. If -the symbol cannot be found, it returns NULL and sets an error message in the -given \fIinterp\fR (if that is non-NULL). Note that it is unsafe to use this -operation on a handle that has been passed to \fBTcl_FSUnloadFile\fR. -.SH "SEE ALSO" -Tcl_FSLoadFile(3), Tcl_FSUnloadFile(3), load(n), unload(n) -.SH KEYWORDS -binary code, loading, shared library -'\" Local Variables: -'\" mode: nroff -'\" fill-column: 78 -'\" End: diff --git a/doc/Method.3 b/doc/Method.3 deleted file mode 100644 index 225da00..0000000 --- a/doc/Method.3 +++ /dev/null @@ -1,251 +0,0 @@ -'\" -'\" Copyright (c) 2007 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Tcl_Method 3 0.1 TclOO "TclOO Library Functions" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_ClassSetConstructor, Tcl_ClassSetDestructor, Tcl_MethodDeclarerClass, Tcl_MethodDeclarerObject, Tcl_MethodIsPublic, Tcl_MethodIsType, Tcl_MethodName, Tcl_NewInstanceMethod, Tcl_NewMethod, Tcl_ObjectContextInvokeNext, Tcl_ObjectContextIsFiltering, Tcl_ObjectContextMethod, Tcl_ObjectContextObject, Tcl_ObjectContextSkippedArgs \- manipulate methods and method-call contexts -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Method -\fBTcl_NewMethod\fR(\fIinterp, class, nameObj, isPublic, - methodTypePtr, clientData\fR) -.sp -Tcl_Method -\fBTcl_NewInstanceMethod\fR(\fIinterp, object, nameObj, isPublic, - methodTypePtr, clientData\fR) -.sp -\fBTcl_ClassSetConstructor\fR(\fIinterp, class, method\fR) -.sp -\fBTcl_ClassSetDestructor\fR(\fIinterp, class, method\fR) -.sp -Tcl_Class -\fBTcl_MethodDeclarerClass\fR(\fImethod\fR) -.sp -Tcl_Object -\fBTcl_MethodDeclarerObject\fR(\fImethod\fR) -.sp -Tcl_Obj * -\fBTcl_MethodName\fR(\fImethod\fR) -.sp -int -\fBTcl_MethodIsPublic\fR(\fImethod\fR) -.sp -int -\fBTcl_MethodIsType\fR(\fImethod, methodTypePtr, clientDataPtr\fR) -.sp -int -\fBTcl_ObjectContextInvokeNext\fR(\fIinterp, context, objc, objv, skip\fR) -.sp -int -\fBTcl_ObjectContextIsFiltering\fR(\fIcontext\fR) -.sp -Tcl_Method -\fBTcl_ObjectContextMethod\fR(\fIcontext\fR) -.sp -Tcl_Object -\fBTcl_ObjectContextObject\fR(\fIcontext\fR) -.sp -int -\fBTcl_ObjectContextSkippedArgs\fR(\fIcontext\fR) -.SH ARGUMENTS -.AS ClientData clientData in -.AP Tcl_Interp *interp in/out -The interpreter holding the object or class to create or update a method in. -.AP Tcl_Object object in -The object to create the method in. -.AP Tcl_Class class in -The class to create the method in. -.AP Tcl_Obj *nameObj in -The name of the method to create. Should not be NULL unless creating -constructors or destructors. -.AP int isPublic in -A flag saying what the visibility of the method is. The only supported public -values of this flag are 0 for a non-exported method, and 1 for an exported -method. -.AP Tcl_MethodType *methodTypePtr in -A description of the type of the method to create, or the type of method to -compare against. -.AP ClientData clientData in -A piece of data that is passed to the implementation of the method without -interpretation. -.AP ClientData *clientDataPtr out -A pointer to a variable in which to write the \fIclientData\fR value supplied -when the method was created. If NULL, the \fIclientData\fR value will not be -retrieved. -.AP Tcl_Method method in -A reference to a method to query. -.AP Tcl_ObjectContext context in -A reference to a method-call context. Note that client code \fImust not\fR -retain a reference to a context. -.AP int objc in -The number of arguments to pass to the method implementation. -.AP "Tcl_Obj *const" *objv in -An array of arguments to pass to the method implementation. -.AP int skip in -The number of arguments passed to the method implementation that do not -represent "real" arguments. -.BE -.SH DESCRIPTION -.PP -A method is an operation carried out on an object that is associated with the -object. Every method must be attached to either an object or a class; methods -attached to a class are associated with all instances (direct and indirect) of -that class. -.PP -Given a method, the entity that declared it can be found using -\fBTcl_MethodDeclarerClass\fR which returns the class that the method is -attached to (or NULL if the method is not attached to any class) and -\fBTcl_MethodDeclarerObject\fR which returns the object that the method is -attached to (or NULL if the method is not attached to an object). The name of -the method can be retrieved with \fBTcl_MethodName\fR and whether the method -is exported is retrieved with \fBTcl_MethodIsPublic\fR. The type of the method -can also be introspected upon to a limited degree; the function -\fBTcl_MethodIsType\fR returns whether a method is of a particular type, -assigning the per-method \fIclientData\fR to the variable pointed to by -\fIclientDataPtr\fR if (that is non-NULL) if the type is matched. -.SS "METHOD CREATION" -.PP -Methods are created by \fBTcl_NewMethod\fR and \fBTcl_NewInstanceMethod\fR, -which -create a method attached to a class or an object respectively. In both cases, -the \fInameObj\fR argument gives the name of the method to create, the -\fIisPublic\fR argument states whether the method should be exported -initially, the \fImethodTypePtr\fR argument describes the implementation of -the method (see the \fBMETHOD TYPES\fR section below) and the \fIclientData\fR -argument gives some implementation-specific data that is passed on to the -implementation of the method when it is called. -.PP -When the \fInameObj\fR argument to \fBTcl_NewMethod\fR is NULL, an -unnamed method is created, which is used for constructors and destructors. -Constructors should be installed into their class using the -\fBTcl_ClassSetConstructor\fR function, and destructors (which must not -require any arguments) should be installed into their class using the -\fBTcl_ClassSetDestructor\fR function. Unnamed methods should not be used for -any other purpose, and named methods should not be used as either constructors -or destructors. Also note that a NULL \fImethodTypePtr\fR is used to provide -internal signaling, and should not be used in client code. -.SS "METHOD CALL CONTEXTS" -.PP -When a method is called, a method-call context reference is passed in as one -of the arguments to the implementation function. This context can be inspected -to provide information about the caller, but should not be retained beyond the -moment when the method call terminates. -.PP -The method that is being called can be retrieved from the context by using -\fBTcl_ObjectContextMethod\fR, and the object that caused the method to be -invoked can be retrieved with \fBTcl_ObjectContextObject\fR. The number of -arguments that are to be skipped (e.g. the object name and method name in a -normal method call) is read with \fBTcl_ObjectContextSkippedArgs\fR, and the -context can also report whether it is working as a filter for another method -through \fBTcl_ObjectContextIsFiltering\fR. -.PP -During the execution of a method, the method implementation may choose to -invoke the stages of the method call chain that come after the current method -implementation. This (the core of the \fBnext\fR command) is done using -\fBTcl_ObjectContextInvokeNext\fR. Note that this function does not manipulate -the call-frame stack, unlike the \fBnext\fR command; if the method -implementation has pushed one or more extra frames on the stack as part of its -implementation, it is also responsible for temporarily popping those frames -from the stack while the \fBTcl_ObjectContextInvokeNext\fR function is -executing. Note also that the method-call context is \fInever\fR deleted -during the execution of this function. -.SH "METHOD TYPES" -.PP -The types of methods are described by a pointer to a Tcl_MethodType structure, -which is defined as: -.PP -.CS -typedef struct { - int \fIversion\fR; - const char *\fIname\fR; - Tcl_MethodCallProc *\fIcallProc\fR; - Tcl_MethodDeleteProc *\fIdeleteProc\fR; - Tcl_CloneProc *\fIcloneProc\fR; -} \fBTcl_MethodType\fR; -.CE -.PP -The \fIversion\fR field allows for future expansion of the structure, and -should always be declared equal to TCL_OO_METHOD_VERSION_CURRENT. The -\fIname\fR field provides a human-readable name for the type, and is the value -that is exposed via the \fBinfo class methodtype\fR and -\fBinfo object methodtype\fR Tcl commands. -.PP -The \fIcallProc\fR field gives a function that is called when the method is -invoked; it must never be NULL. -.PP -The \fIdeleteProc\fR field gives a function that is used to delete a -particular method, and is called when the method is replaced or removed; if -the field is NULL, it is assumed that the method's \fIclientData\fR needs no -special action to delete. -.PP -The \fIcloneProc\fR field is either a function that is used to copy a method's -\fIclientData\fR (as part of \fBTcl_CopyObjectInstance\fR) or NULL to indicate -that the \fIclientData\fR can just be copied directly. -.SS "TCL_METHODCALLPROC FUNCTION SIGNATURE" -.PP -Functions matching this signature are called when the method is invoked. -.PP -.CS -typedef int \fBTcl_MethodCallProc\fR( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR, - Tcl_ObjectContext \fIobjectContext\fR, - int \fIobjc\fR, - Tcl_Obj *const *\fIobjv\fR); -.CE -.PP -The \fIclientData\fR argument to a Tcl_MethodCallProc is the value that was -given when the method was created, the \fIinterp\fR is a place in which to -execute scripts and access variables as well as being where to put the result -of the method, and the \fIobjc\fR and \fIobjv\fR fields give the parameter -objects to the method. The calling context of the method can be discovered -through the \fIobjectContext\fR argument, and the return value from a -Tcl_MethodCallProc is any Tcl return code (e.g. TCL_OK, TCL_ERROR). -.SS "TCL_METHODDELETEPROC FUNCTION SIGNATURE" -.PP -Functions matching this signature are used when a method is deleted, whether -through a new method being created or because the object or class is deleted. -.PP -.CS -typedef void \fBTcl_MethodDeleteProc\fR( - ClientData \fIclientData\fR); -.CE -.PP -The \fIclientData\fR argument to a Tcl_MethodDeleteProc will be the same as -the value passed to the \fIclientData\fR argument to \fBTcl_NewMethod\fR or -\fBTcl_NewInstanceMethod\fR when the method was created. -.SS "TCL_CLONEPROC FUNCTION SIGNATURE" -.PP -Functions matching this signature are used to copy a method when the object or -class is copied using \fBTcl_CopyObjectInstance\fR (or \fBoo::copy\fR). -.PP -.CS -typedef int \fBTcl_CloneProc\fR( - Tcl_Interp *\fIinterp\fR, - ClientData \fIoldClientData\fR, - ClientData *\fInewClientDataPtr\fR); -.CE -.PP -The \fIinterp\fR argument gives a place to write an error message when the -attempt to clone the object is to fail, in which case the clone procedure must -also return TCL_ERROR; it should return TCL_OK otherwise. -The \fIoldClientData\fR field to a Tcl_CloneProc gives the value from the -method being copied from, and the \fInewClientDataPtr\fR field will point to -a variable in which to write the value for the method being copied to. -.SH "SEE ALSO" -Class(3), oo::class(n), oo::define(n), oo::object(n) -.SH KEYWORDS -constructor, method, object - -.\" Local variables: -.\" mode: nroff -.\" fill-column: 78 -.\" End: diff --git a/doc/NRE.3 b/doc/NRE.3 deleted file mode 100644 index ff0d108..0000000 --- a/doc/NRE.3 +++ /dev/null @@ -1,328 +0,0 @@ -.\" -.\" Copyright (c) 2008 by Kevin B. Kenny. -.\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH NRE 3 8.6 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_NRCreateCommand, Tcl_NRCallObjProc, Tcl_NREvalObj, Tcl_NREvalObjv, Tcl_NRCmdSwap, Tcl_NRExprObj, Tcl_NRAddCallback \- Non-Recursive (stackless) evaluation of Tcl scripts. -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Command -\fBTcl_NRCreateCommand\fR(\fIinterp, cmdName, proc, nreProc, clientData, - deleteProc\fR) -.sp -int -\fBTcl_NRCallObjProc\fR(\fIinterp, nreProc, clientData, objc, objv\fR) -.sp -int -\fBTcl_NREvalObj\fR(\fIinterp, objPtr, flags\fR) -.sp -int -\fBTcl_NREvalObjv\fR(\fIinterp, objc, objv, flags\fR) -.sp -int -\fBTcl_NRCmdSwap\fR(\fIinterp, cmd, objc, objv, flags\fR) -.sp -int -\fBTcl_NRExprObj\fR(\fIinterp, objPtr, resultPtr\fR) -.sp -void -\fBTcl_NRAddCallback\fR(\fIinterp, postProcPtr, data0, data1, data2, data3\fR) -.fi -.SH ARGUMENTS -.AS Tcl_CmdDeleteProc *interp in -.AP Tcl_Interp *interp in -Interpreter in which to create or evaluate a command. -.AP char *cmdName in -Name of a new command to create. -.AP Tcl_ObjCmdProc *proc in -Implementation of a command that will be called whenever \fIcmdName\fR -is invoked as a command in the unoptimized way. -.AP Tcl_ObjCmdProc *nreProc in -Implementation of a command that will be called whenever \fIcmdName\fR -is invoked and requested to conserve the C stack. -.AP ClientData clientData in -Arbitrary one-word value that will be passed to \fIproc\fR, \fInreProc\fR, -\fIdeleteProc\fR and \fIobjProc\fR. -.AP Tcl_CmdDeleteProc *deleteProc in/out -Procedure to call before \fIcmdName\fR is deleted from the interpreter. -This procedure allows for command-specific cleanup. If \fIdeleteProc\fR -is \fBNULL\fR, then no procedure is called before the command is deleted. -.AP int objc in -Count of parameters provided to the implementation of a command. -.AP Tcl_Obj **objv in -Pointer to an array of Tcl values. Each value holds the value of a -single word in the command to execute. -.AP Tcl_Obj *objPtr in -Pointer to a Tcl_Obj whose value is a script or expression to execute. -.AP int flags in -ORed combination of flag bits that specify additional options. -\fBTCL_EVAL_GLOBAL\fR is the only flag that is currently supported. -.\" TODO: This is a lie. But kbk didn't grasp TCL_EVAL_INVOKE and -.\" TCL_EVAL_NOERR well enough to document them. -.AP Tcl_Command cmd in -Token for a command that is to be used instead of the currently -executing command. -.AP Tcl_Obj *resultPtr out -Pointer to an unshared Tcl_Obj where the result of expression -evaluation is written. -.AP Tcl_NRPostProc *postProcPtr in -Pointer to a function that will be invoked when the command currently -executing in the interpreter designated by \fIinterp\fR completes. -.AP ClientData data0 in -.AP ClientData data1 in -.AP ClientData data2 in -.AP ClientData data3 in -\fIdata0\fR through \fIdata3\fR are four one-word values that will be passed -to the function designated by \fIpostProcPtr\fR when it is invoked. -.BE -.SH DESCRIPTION -.PP -This series of C functions provides an interface whereby commands that -are implemented in C can be evaluated, and invoke Tcl commands scripts -and scripts, without consuming space on the C stack. The non-recursive -evaluation is done by installing a \fItrampoline\fR, a small piece of -code that invokes a command or script, and then executes a series of -callbacks when the command or script returns. -.PP -The \fBTcl_NRCreateCommand\fR function creates a Tcl command in the -interpreter designated by \fIinterp\fR that is prepared to handle -nonrecursive evaluation with a trampoline. The \fIcmdName\fR argument -gives the name of the new command. If \fIcmdName\fR contains any -namespace qualifiers, then the new command is added to the specified -namespace; otherwise, it is added to the global namespace. \fIproc\fR -gives the procedure that will be called when the interpreter wishes to -evaluate the command in an unoptimized manner, and \fInreProc\fR is -the procedure that will be called when the interpreter wishes to -evaluate the command using a trampoline. \fIdeleteProc\fR is a -function that will be called before the command is deleted from the -interpreter. When any of the three functions is invoked, it is passed -the \fIclientData\fR parameter. -.PP -\fBTcl_NRCreateCommand\fR deletes any existing command -\fIname\fR already associated with the interpreter -(however see below for an exception where the existing command -is not deleted). -It returns a token that may be used to refer -to the command in subsequent calls to \fBTcl_GetCommandName\fR. -If \fBTcl_NRCreateCommand\fR is called for an interpreter that is in -the process of being deleted, then it does not create a new command, -does not delete any existing command of the same name, and returns NULL. -.PP -The \fIproc\fR and \fInreProc\fR function are expected to conform to -all the rules set forth for the \fIproc\fR argument to -\fBTcl_CreateObjCommand\fR(3) (\fIq.v.\fR). -.PP -When a command that is written to cope with evaluation via trampoline -is invoked without a trampoline on the stack, it will usually respond -to the invocation by creating a trampoline and calling the -trampoline-enabled implementation of the same command. This call is done by -means of \fBTcl_NRCallObjProc\fR. In the call to -\fBTcl_NRCallObjProc\fR, the \fIinterp\fR, \fIclientData\fR, -\fIobjc\fR and \fIobjv\fR parameters should be the same ones that were -passed to \fIproc\fR. The \fInreProc\fR parameter should designate the -trampoline-enabled implementation of the command. -.PP -\fBTcl_NREvalObj\fR arranges for the script contained in \fIobjPtr\fR -to be evaluated in the interpreter designated by \fIinterp\fR after -the current command (which must be trampoline-enabled) returns. It is -the method by which a command may invoke a script without consuming -space on the C stack. Similarly, \fBTcl_NREvalObjv\fR arranges to -invoke a single Tcl command whose words have already been separated -and substituted. The \fIobjc\fR and \fIobjv\fR parameters give the -words of the command to be evaluated when execution reaches the -trampoline. -.PP -\fBTcl_NRCmdSwap\fR allows for trampoline evaluation of a command whose -resolution is already known. The \fIcmd\fR parameter gives a -\fBTcl_Command\fR token (returned from \fBTcl_CreateObjCommand\fR or -\fBTcl_GetCommandFromObj\fR) identifying the command to be invoked in -the trampoline; this command must match the word in \fIobjv[0]\fR. -The remaining arguments are as for \fBTcl_NREvalObjv\fR. -.PP -\fBTcl_NREvalObj\fR, \fBTcl_NREvalObjv\fR and \fBTcl_NRCmdSwap\fR -all accept a \fIflags\fR parameter, which is an OR-ed-together set of -bits to control evaluation. At the present time, the only supported flag -available to callers is \fBTCL_EVAL_GLOBAL\fR. -.\" TODO: Again, this is a lie. Do we want to explain TCL_EVAL_INVOKE -.\" and TCL_EVAL_NOERR? -If the \fBTCL_EVAL_GLOBAL\fR flag is set, the script or command is -evaluated in the global namespace. If it is not set, it is evaluated -in the current namespace. -.PP -\fBTcl_NRExprObj\fR arranges for the expression contained in \fIobjPtr\fR -to be evaluated in the interpreter designated by \fIinterp\fR after -the current command (which must be trampoline-enabled) returns. It is -the method by which a command may evaluate a Tcl expression without consuming -space on the C stack. The argument \fIresultPtr\fR is a pointer to an -unshared Tcl_Obj where the result of expression evaluation is to be written. -If expression evaluation returns any code other than TCL_OK, the -\fIresultPtr\fR value is left untouched. -.PP -All of the routines return \fBTCL_OK\fR if command or expression invocation -has been scheduled successfully. If for any reason the scheduling cannot -be completed (for example, if the interpreter is unable to find -the requested command), they return \fBTCL_ERROR\fR with an -appropriate message left in the interpreter's result. -.PP -\fBTcl_NRAddCallback\fR arranges to have a C function called when the -current trampoline-enabled command in the Tcl interpreter designated -by \fIinterp\fR returns. The \fIpostProcPtr\fR argument is a pointer -to the callback function, which must have arguments and return value -consistent with the \fBTcl_NRPostProc\fR data type: -.PP -.CS -typedef int -\fBTcl_NRPostProc\fR( - \fBClientData\fR \fIdata\fR[], - \fBTcl_Interp\fR *\fIinterp\fR, - int \fIresult\fR); -.CE -.PP -When the trampoline invokes the callback function, the \fIdata\fR -parameter will point to an array containing the four one-word -quantities that were passed to \fBTcl_NRAddCallback\fR in the -\fIdata0\fR through \fIdata3\fR parameters. The Tcl interpreter will -be designated by the \fIinterp\fR parameter, and the \fIresult\fR -parameter will contain the result (\fBTCL_OK\fR, \fBTCL_ERROR\fR, -\fBTCL_RETURN\fR, \fBTCL_BREAK\fR or \fBTCL_CONTINUE\fR) that was -returned by the command evaluation. The callback function is expected, -in turn, either to return a \fIresult\fR to control further evaluation. -.PP -Multiple \fBTcl_NRAddCallback\fR invocations may request multiple -callbacks, which may be to the same or different callback -functions. If multiple callbacks are requested, they are executed in -last-in, first-out order, that is, the most recently requested -callback is executed first. -.SH EXAMPLE -.PP -The usual pattern for Tcl commands that invoke other Tcl commands -is something like: -.PP -.CS -int -\fITheCmdOldObjProc\fR( - ClientData clientData, - Tcl_Interp *interp, - int objc, - Tcl_Obj *const objv[]) -{ - int result; - Tcl_Obj *objPtr; - - \fI... preparation ...\fR - - result = \fBTcl_EvalObjEx\fR(interp, objPtr, 0); - - \fI... postprocessing ...\fR - - return result; -} -\fBTcl_CreateObjCommand\fR(interp, "theCommand", - \fITheCmdOldObjProc\fR, clientData, TheCmdDeleteProc); -.CE -.PP -To enable a command like this one for trampoline-based evaluation, -it must be split into three pieces: -.IP \(bu -A non-trampoline implementation, \fITheCmdNewObjProc\fR, -which will simply create a trampoline -and invoke the trampoline-based implementation. -.IP \(bu -A trampoline-enabled implementation, \fITheCmdNRObjProc\fR. This -function will perform the initialization, request that the trampoline -call the postprocessing routine after command evaluation, and finally, -request that the trampoline call the inner command. -.IP \(bu -A postprocessing routine, \fITheCmdPostProc\fR. This function will -perform the postprocessing formerly done after the return from the -inner command in \fITheCmdObjProc\fR. -.PP -The non-trampoline implementation is simple and stylized, containing -a single statement: -.PP -.CS -int -\fITheCmdNewObjProc\fR( - ClientData clientData, - Tcl_Interp *interp, - int objc, - Tcl_Obj *const objv[]) -{ - return \fBTcl_NRCallObjProc\fR(interp, \fITheCmdNRObjProc\fR, - clientData, objc, objv); -} -.CE -.PP -The trampoline-enabled implementation requests postprocessing, -and returns to the trampoline requesting command evaluation. -.PP -.CS -int -\fITheCmdNRObjProc\fR - ClientData clientData, - Tcl_Interp *interp, - int objc, - Tcl_Obj *const objv[]) -{ - Tcl_Obj *objPtr; - - \fI... preparation ...\fR - - \fBTcl_NRAddCallback\fR(interp, \fITheCmdPostProc\fR, - data0, data1, data2, data3); - /* \fIdata0 .. data3\fR are up to four one-word items to - * pass to the postprocessing procedure */ - - return \fBTcl_NREvalObj\fR(interp, objPtr, 0); -} -.CE -.PP -The postprocessing procedure does whatever the original command did -upon return from the inner evaluation. -.PP -.CS -int -\fITheCmdNRPostProc\fR( - ClientData data[], - Tcl_Interp *interp, - int result) -{ - /* \fIdata[0] .. data[3]\fR are the four words of data - * passed to \fBTcl_NRAddCallback\fR */ - - \fI... postprocessing ...\fR - - return result; -} -.CE -.PP -If \fItheCommand\fR is a command that results in multiple commands or -scripts being evaluated, its postprocessing routine may schedule -additional postprocessing and then request another command evaluation -by means of \fBTcl_NREvalObj\fR or one of the other evaluation -routines. Looping and sequencing constructs may be implemented in this way. -.PP -Finally, to install a trampoline-enabled command in the interpreter, -\fBTcl_NRCreateCommand\fR is used in place of -\fBTcl_CreateObjCommand\fR. It accepts two command procedures instead -of one. The first is for use when no trampoline is yet on the stack, -and the second is for use when there is already a trampoline in place. -.PP -.CS -\fBTcl_NRCreateCommand\fR(interp, "theCommand", - \fITheCmdNewObjProc\fR, \fITheCmdNRObjProc\fR, clientData, - TheCmdDeleteProc); -.CE -.SH "SEE ALSO" -Tcl_CreateCommand(3), Tcl_CreateObjCommand(3), Tcl_EvalObjEx(3), Tcl_GetCommandFromObj(3), Tcl_ExprObj(3) -.SH KEYWORDS -stackless, nonrecursive, execute, command, global, value, result, script -.SH COPYRIGHT -Copyright (c) 2008 by Kevin B. Kenny diff --git a/doc/Namespace.3 b/doc/Namespace.3 deleted file mode 100644 index a037442..0000000 --- a/doc/Namespace.3 +++ /dev/null @@ -1,165 +0,0 @@ -'\" -'\" 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. -'\" -'\" Note that some of these functions do not seem to belong, but they -'\" were all introduced with the same TIP (#139) -'\" -.TH Tcl_Namespace 3 8.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_AppendExportList, Tcl_CreateNamespace, Tcl_DeleteNamespace, Tcl_Export, Tcl_FindCommand, Tcl_FindNamespace, Tcl_ForgetImport, Tcl_GetCurrentNamespace, Tcl_GetGlobalNamespace, Tcl_GetNamespaceUnknownHandler, Tcl_Import, Tcl_SetNamespaceUnknownHandler \- manipulate namespaces -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Namespace * -\fBTcl_CreateNamespace\fR(\fIinterp, name, clientData, deleteProc\fR) -.sp -\fBTcl_DeleteNamespace\fR(\fInsPtr\fR) -.sp -int -\fBTcl_AppendExportList\fR(\fIinterp, nsPtr, objPtr\fR) -.sp -int -\fBTcl_Export\fR(\fIinterp, nsPtr, pattern, resetListFirst\fR) -.sp -int -\fBTcl_Import\fR(\fIinterp, nsPtr, pattern, allowOverwrite\fR) -.sp -int -\fBTcl_ForgetImport\fR(\fIinterp, nsPtr, pattern\fR) -.sp -Tcl_Namespace * -\fBTcl_GetCurrentNamespace\fR(\fIinterp\fR) -.sp -Tcl_Namespace * -\fBTcl_GetGlobalNamespace\fR(\fIinterp\fR) -.sp -Tcl_Namespace * -\fBTcl_FindNamespace\fR(\fIinterp, name, contextNsPtr, flags\fR) -.sp -Tcl_Command -\fBTcl_FindCommand\fR(\fIinterp, name, contextNsPtr, flags\fR) -.sp -Tcl_Obj * -\fBTcl_GetNamespaceUnknownHandler(\fIinterp, nsPtr\fR) -.sp -int -\fBTcl_SetNamespaceUnknownHandler(\fIinterp, nsPtr, handlerPtr\fR) -.SH ARGUMENTS -.AS Tcl_NamespaceDeleteProc allowOverwrite in/out -.AP Tcl_Interp *interp in/out -The interpreter in which the namespace exists and where name lookups -are performed. Also where error result messages are written. -.AP "const char" *name in -The name of the namespace or command to be created or accessed. -.AP ClientData clientData in -A context pointer by the creator of the namespace. Not interpreted by -Tcl at all. -.AP Tcl_NamespaceDeleteProc *deleteProc in -A pointer to function to call when the namespace is deleted, or NULL -if no such callback is to be performed. -.AP Tcl_Namespace *nsPtr in -The namespace to be manipulated, or NULL (for other than -\fBTcl_DeleteNamespace\fR) to manipulate the current namespace. -.AP Tcl_Obj *objPtr out -A reference to an unshared value to which the function output will be -written. -.AP "const char" *pattern in -The glob-style pattern (see \fBTcl_StringMatch\fR) that describes the -commands to be imported or exported. -.AP int resetListFirst in -Whether the list of export patterns should be reset before adding the -current pattern to it. -.AP int allowOverwrite in -Whether new commands created by this import action can overwrite -existing commands. -.AP Tcl_Namespace *contextNsPtr in -The location in the namespace hierarchy where the search for a -namespace or command should be conducted relative to when the search -term is not rooted at the global namespace. NULL indicates the -current namespace. -.AP int flags in -OR-ed combination of bits controlling how the search is to be -performed. The following flags are supported: \fBTCL_GLOBAL_ONLY\fR -(indicates that the search is always to be conducted relative to the -global namespace), \fBTCL_NAMESPACE_ONLY\fR (just for \fBTcl_FindCommand\fR; -indicates that the search is always to be conducted relative to the -context namespace), and \fBTCL_LEAVE_ERR_MSG\fR (indicates that an error -message should be left in the interpreter if the search fails.) -.AP Tcl_Obj *handlerPtr in -A script fragment to be installed as the unknown command handler for the -namespace, or NULL to reset the handler to its default. -.BE -.SH DESCRIPTION -.PP -Namespaces are hierarchic naming contexts that can contain commands -and variables. They also maintain a list of patterns that describes -what commands are exported, and can import commands that have been -exported by other namespaces. Namespaces can also be manipulated -through the Tcl command \fBnamespace\fR. -.PP -The \fITcl_Namespace\fR structure encapsulates a namespace, and is -guaranteed to have the following fields in it: \fIname\fR (the local -name of the namespace, with no namespace separator characters in it, -with empty denoting the global namespace), \fIfullName\fR (the fully -specified name of the namespace), \fIclientData\fR, \fIdeleteProc\fR -(the values specified in the call to \fBTcl_CreateNamespace\fR), and -\fIparentPtr\fR (a pointer to the containing namespace, or NULL for -the global namespace.) -.PP -\fBTcl_CreateNamespace\fR creates a new namespace. The -\fIdeleteProc\fR will have the following type signature: -.PP -.CS -typedef void \fBTcl_NamespaceDeleteProc\fR( - ClientData \fIclientData\fR); -.CE -.PP -\fBTcl_DeleteNamespace\fR deletes a namespace, calling the -\fIdeleteProc\fR defined for the namespace (if any). -.PP -\fBTcl_AppendExportList\fR retrieves the export patterns for a -namespace given namespace and appends them (as list items) to -\fIobjPtr\fR. -.PP -\fBTcl_Export\fR sets and appends to the export patterns for a -namespace. Patterns are appended unless the \fIresetListFirst\fR flag -is true. -.PP -\fBTcl_Import\fR imports commands matching a pattern into a -namespace. Note that the pattern must include the name of the -namespace to import from. This function returns an error if -an attempt to import a command over an existing command is made, -unless the \fIallowOverwrite\fR flag has been set. -.PP -\fBTcl_ForgetImport\fR removes imports matching a pattern. -.PP -\fBTcl_GetCurrentNamespace\fR returns the current namespace for an -interpreter. -.PP -\fBTcl_GetGlobalNamespace\fR returns the global namespace for an -interpreter. -.PP -\fBTcl_FindNamespace\fR searches for a namespace named \fIname\fR -within the context of the namespace \fIcontextNsPtr\fR. If the -namespace cannot be found, NULL is returned. -.PP -\fBTcl_FindCommand\fR searches for a command named \fIname\fR within -the context of the namespace \fIcontextNsPtr\fR. If the command -cannot be found, NULL is returned. -.PP -\fBTcl_GetNamespaceUnknownHandler\fR returns the unknown command handler -for the namespace, or NULL if none is set. -.PP -\fBTcl_SetNamespaceUnknownHandler\fR sets the unknown command handler for -the namespace. If \fIhandlerPtr\fR is NULL, then the handler is reset to -its default. -.SH "SEE ALSO" -Tcl_CreateCommand(3), Tcl_ListObjAppendList(3), Tcl_SetVar(3) -.SH KEYWORDS -namespace, command diff --git a/doc/Notifier.3 b/doc/Notifier.3 deleted file mode 100644 index 16f9f8d..0000000 --- a/doc/Notifier.3 +++ /dev/null @@ -1,635 +0,0 @@ -'\" -'\" 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. -'\" -.TH Notifier 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.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, Tcl_ServiceModeHook, Tcl_SetNotifier \- the event queue and notifier interfaces -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -void -\fBTcl_CreateEventSource\fR(\fIsetupProc, checkProc, clientData\fR) -.sp -void -\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 -Tcl_ThreadId -\fBTcl_GetCurrentThread\fR() -.sp -void -\fBTcl_DeleteEvents\fR(\fIdeleteProc, clientData\fR) -.sp -ClientData -\fBTcl_InitNotifier\fR() -.sp -void -\fBTcl_FinalizeNotifier\fR(\fIclientData\fR) -.sp -int -\fBTcl_WaitForEvent\fR(\fItimePtr\fR) -.sp -void -\fBTcl_AlertNotifier\fR(\fIclientData\fR) -.sp -void -\fBTcl_SetTimer\fR(\fItimePtr\fR) -.sp -int -\fBTcl_ServiceAll\fR() -.sp -int -\fBTcl_ServiceEvent\fR(\fIflags\fR) -.sp -int -\fBTcl_GetServiceMode\fR() -.sp -int -\fBTcl_SetServiceMode\fR(\fImode\fR) -.sp -void -\fBTcl_ServiceModeHook\fR(\fImode\fR) -.sp -void -\fBTcl_SetNotifier\fR(\fInotifierProcPtr\fR) -.SH ARGUMENTS -.AS Tcl_EventDeleteProc *notifierProcPtr -.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 -events. Checks to see if any events have occurred and, if so, -queues them. -.AP ClientData clientData in -Arbitrary one-word value to pass to \fIsetupProc\fR, \fIcheckProc\fR, or -\fIdeleteProc\fR. -.AP "const Tcl_Time" *timePtr in -Indicates the maximum amount of time to wait for an event. This -is specified as an interval (how long to wait), not an absolute -time (when to wakeup). If the pointer passed to \fBTcl_WaitForEvent\fR -is NULL, it means there is no maximum wait time: wait forever if -necessary. -.AP Tcl_Event *evPtr in -An event to add to the event queue. The storage for the event must -have been allocated by the caller using \fBTcl_Alloc\fR or \fBckalloc\fR. -.AP Tcl_QueuePosition position in -Where to add the new event in the queue: \fBTCL_QUEUE_TAIL\fR, -\fBTCL_QUEUE_HEAD\fR, or \fBTCL_QUEUE_MARK\fR. -.AP Tcl_ThreadId threadId in -A unique identifier for a thread. -.AP Tcl_EventDeleteProc *deleteProc in -Procedure to invoke for each queued event in \fBTcl_DeleteEvents\fR. -.AP int flags in -What types of events to service. These flags are the same as those -passed to \fBTcl_DoOneEvent\fR. -.AP int mode in -Indicates whether events should be serviced by \fBTcl_ServiceAll\fR. -Must be one of \fBTCL_SERVICE_NONE\fR or \fBTCL_SERVICE_ALL\fR. -.AP Tcl_NotifierProcs* notifierProcPtr in -Structure of function pointers describing notifier procedures that are -to replace the ones installed in the executable. See -\fBREPLACING THE NOTIFIER\fR for details. -.BE -.SH INTRODUCTION -.PP -The interfaces described here are used to customize the Tcl event -loop. The two most common customizations are to add new sources of -events and to merge Tcl's event loop with some other event loop, such -as one provided by an application in which Tcl is embedded. Each of -these tasks is described in a separate section below. -.PP -The procedures in this manual entry are the building blocks out of which -the Tcl event notifier is constructed. The event notifier is the lowest -layer in the Tcl event mechanism. It consists of three things: -.IP [1] -Event sources: these represent the ways in which events can be -generated. For example, there is a timer event source that implements -the \fBTcl_CreateTimerHandler\fR procedure and the \fBafter\fR -command, and there is a file event source that implements the -\fBTcl_CreateFileHandler\fR procedure on Unix systems. An event -source must work with the notifier to detect events at the right -times, record them on the event queue, and eventually notify -higher-level software that they have occurred. The procedures -\fBTcl_CreateEventSource\fR, \fBTcl_DeleteEventSource\fR, -and \fBTcl_SetMaxBlockTime\fR, \fBTcl_QueueEvent\fR, and -\fBTcl_DeleteEvents\fR are used primarily by event sources. -.IP [2] -The event queue: for non-threaded applications, -there is a single queue for the whole application, -containing events that have been detected but not yet serviced. Event -sources place events onto the queue so that they may be processed in -order at appropriate times during the event loop. The event queue -guarantees a fair discipline of event handling, so that no event -source can starve the others. It also allows events to be saved for -servicing at a future time. Threaded applications work in a -similar manner, except that there is a separate event queue for -each thread containing a Tcl interpreter. -\fBTcl_QueueEvent\fR is used (primarily -by event sources) to add events to the event queue and -\fBTcl_DeleteEvents\fR is used to remove events from the queue without -processing them. In a threaded application, \fBTcl_QueueEvent\fR adds -an event to the current thread's queue, and \fBTcl_ThreadQueueEvent\fR -adds an event to a queue in a specific thread. -.IP [3] -The event loop: in order to detect and process events, the application -enters a loop that waits for events to occur, places them on the event -queue, and then processes them. Most applications will do this by -calling the procedure \fBTcl_DoOneEvent\fR, which is described in a -separate manual entry. -.PP -Most Tcl applications need not worry about any of the internals of -the Tcl notifier. However, the notifier now has enough flexibility -to be retargeted either for a new platform or to use an external event -loop (such as the Motif event loop, when Tcl is embedded in a Motif -application). The procedures \fBTcl_WaitForEvent\fR and -\fBTcl_SetTimer\fR are normally implemented by Tcl, but may be -replaced with new versions to retarget the notifier (the -\fBTcl_InitNotifier\fR, \fBTcl_AlertNotifier\fR, -\fBTcl_FinalizeNotifier\fR, \fBTcl_Sleep\fR, -\fBTcl_CreateFileHandler\fR, and \fBTcl_DeleteFileHandler\fR must -also be replaced; see CREATING A NEW NOTIFIER below for details). -The procedures \fBTcl_ServiceAll\fR, \fBTcl_ServiceEvent\fR, -\fBTcl_GetServiceMode\fR, and \fBTcl_SetServiceMode\fR are provided -to help connect Tcl's event loop to an external event loop such as -Motif's. -.SH "NOTIFIER BASICS" -.PP -The easiest way to understand how the notifier works is to consider -what happens when \fBTcl_DoOneEvent\fR is called. -\fBTcl_DoOneEvent\fR is passed a \fIflags\fR argument that indicates -what sort of events it is OK to process and also whether or not to -block if no events are ready. \fBTcl_DoOneEvent\fR does the following -things: -.IP [1] -Check the event queue to see if it contains any events that can -be serviced. If so, service the first possible event, remove it -from the queue, and return. It does this by calling -\fBTcl_ServiceEvent\fR and passing in the \fIflags\fR argument. -.IP [2] -Prepare to block for an event. To do this, \fBTcl_DoOneEvent\fR -invokes a \fIsetup procedure\fR in each event source. -The event source will perform event-source specific initialization and -possibly call \fBTcl_SetMaxBlockTime\fR to limit how long -\fBTcl_WaitForEvent\fR will block if no new events occur. -.IP [3] -Call \fBTcl_WaitForEvent\fR. This procedure is implemented differently -on different platforms; it waits for an event to occur, based on the -information provided by the event sources. -It may cause the application to block if \fItimePtr\fR specifies -an interval other than 0. -\fBTcl_WaitForEvent\fR returns when something has happened, -such as a file becoming readable or the interval given by \fItimePtr\fR -expiring. If there are no events for \fBTcl_WaitForEvent\fR to -wait for, so that it would block forever, then it returns immediately -and \fBTcl_DoOneEvent\fR returns 0. -.IP [4] -Call a \fIcheck procedure\fR in each event source. The check -procedure determines whether any events of interest to this source -occurred. If so, the events are added to the event queue. -.IP [5] -Check the event queue to see if it contains any events that can -be serviced. If so, service the first possible event, remove it -from the queue, and return. -.IP [6] -See if there are idle callbacks pending. If so, invoke all of them and -return. -.IP [7] -Either return 0 to indicate that no events were ready, or go back to -step [2] if blocking was requested by the caller. -.SH "CREATING A NEW EVENT SOURCE" -.PP -An event source consists of three procedures invoked by the notifier, -plus additional C procedures that are invoked by higher-level code -to arrange for event-driven callbacks. The three procedures called -by the notifier consist of the setup and check procedures described -above, plus an additional procedure that is invoked when an event -is removed from the event queue for servicing. -.PP -The procedure \fBTcl_CreateEventSource\fR creates a new event source. -Its arguments specify the setup procedure and check procedure for -the event source. -\fISetupProc\fR should match the following prototype: -.PP -.CS -typedef void \fBTcl_EventSetupProc\fR( - ClientData \fIclientData\fR, - int \fIflags\fR); -.CE -.PP -The \fIclientData\fR argument will be the same as the \fIclientData\fR -argument to \fBTcl_CreateEventSource\fR; it is typically used to -point to private information managed by the event source. -The \fIflags\fR argument will be the same as the \fIflags\fR -argument passed to \fBTcl_DoOneEvent\fR except that it will never -be 0 (\fBTcl_DoOneEvent\fR replaces 0 with \fBTCL_ALL_EVENTS\fR). -\fIFlags\fR indicates what kinds of events should be considered; -if the bit corresponding to this event source is not set, the event -source should return immediately without doing anything. For -example, the file event source checks for the \fBTCL_FILE_EVENTS\fR -bit. -.PP -\fISetupProc\fR's job is to make sure that the application wakes up -when events of the desired type occur. This is typically done in a -platform-dependent fashion. For example, under Unix an event source -might call \fBTcl_CreateFileHandler\fR; under Windows it might -request notification with a Windows event. For timer-driven event -sources such as timer events or any polled event, the event source -can call \fBTcl_SetMaxBlockTime\fR to force the application to wake -up after a specified time even if no events have occurred. -If no event source calls \fBTcl_SetMaxBlockTime\fR -then \fBTcl_WaitForEvent\fR will wait as long as necessary for an -event to occur; otherwise, it will only wait as long as the shortest -interval passed to \fBTcl_SetMaxBlockTime\fR by one of the event -sources. If an event source knows that it already has events ready to -report, it can request a zero maximum block time. For example, the -setup procedure for the X event source looks to see if there are -events already queued. If there are, it calls -\fBTcl_SetMaxBlockTime\fR with a 0 block time so that -\fBTcl_WaitForEvent\fR does not block if there is no new data on the X -connection. -The \fItimePtr\fR argument to \fBTcl_WaitForEvent\fR points to -a structure that describes a time interval in seconds and -microseconds: -.PP -.CS -typedef struct Tcl_Time { - long \fIsec\fR; - long \fIusec\fR; -} \fBTcl_Time\fR; -.CE -.PP -The \fIusec\fR field should be less than 1000000. -.PP -Information provided to \fBTcl_SetMaxBlockTime\fR -is only used for the next call to \fBTcl_WaitForEvent\fR; it is -discarded after \fBTcl_WaitForEvent\fR returns. -The next time an event wait is done each of the event sources' -setup procedures will be called again, and they can specify new -information for that event wait. -.PP -If the application uses an external event loop rather than -\fBTcl_DoOneEvent\fR, the event sources may need to call -\fBTcl_SetMaxBlockTime\fR at other times. For example, if a new event -handler is registered that needs to poll for events, the event source -may call \fBTcl_SetMaxBlockTime\fR to set the block time to zero to -force the external event loop to call Tcl. In this case, -\fBTcl_SetMaxBlockTime\fR invokes \fBTcl_SetTimer\fR with the shortest -interval seen since the last call to \fBTcl_DoOneEvent\fR or -\fBTcl_ServiceAll\fR. -.PP -In addition to the generic procedure \fBTcl_SetMaxBlockTime\fR, other -platform-specific procedures may also be available for -\fIsetupProc\fR, if there is additional information needed by -\fBTcl_WaitForEvent\fR on that platform. For example, on Unix systems -the \fBTcl_CreateFileHandler\fR interface can be used to wait for file events. -.PP -The second procedure provided by each event source is its check -procedure, indicated by the \fIcheckProc\fR argument to -\fBTcl_CreateEventSource\fR. \fICheckProc\fR must match the -following prototype: -.PP -.CS -typedef void \fBTcl_EventCheckProc\fR( - ClientData \fIclientData\fR, - int \fIflags\fR); -.CE -.PP -The arguments to this procedure are the same as those for \fIsetupProc\fR. -\fBCheckProc\fR is invoked by \fBTcl_DoOneEvent\fR after it has waited -for events. Presumably at least one event source is now prepared to -queue an event. \fBTcl_DoOneEvent\fR calls each of the event sources -in turn, so they all have a chance to queue any events that are ready. -The check procedure does two things. First, it must see if any events -have triggered. Different event sources do this in different ways. -.PP -If an event source's check procedure detects an interesting event, it -must add the event to Tcl's event queue. To do this, the event source -calls \fBTcl_QueueEvent\fR. The \fIevPtr\fR argument is a pointer to -a dynamically allocated structure containing the event (see below for -more information on memory management issues). Each event source can -define its own event structure with whatever information is relevant -to that event source. However, the first element of the structure -must be a structure of type \fBTcl_Event\fR, and the address of this -structure is used when communicating between the event source and the -rest of the notifier. A \fBTcl_Event\fR has the following definition: -.PP -.CS -typedef struct { - Tcl_EventProc *\fIproc\fR; - struct Tcl_Event *\fInextPtr\fR; -} \fBTcl_Event\fR; -.CE -.PP -The event source must fill in the \fIproc\fR field of -the event before calling \fBTcl_QueueEvent\fR. -The \fInextPtr\fR is used to link together the events in the queue -and should not be modified by the event source. -.PP -An event may be added to the queue at any of three positions, depending -on the \fIposition\fR argument to \fBTcl_QueueEvent\fR: -.IP \fBTCL_QUEUE_TAIL\fR 24 -Add the event at the back of the queue, so that all other pending -events will be serviced first. This is almost always the right -place for new events. -.IP \fBTCL_QUEUE_HEAD\fR 24 -Add the event at the front of the queue, so that it will be serviced -before all other queued events. -.IP \fBTCL_QUEUE_MARK\fR 24 -Add the event at the front of the queue, unless there are other -events at the front whose position is \fBTCL_QUEUE_MARK\fR; if so, -add the new event just after all other \fBTCL_QUEUE_MARK\fR events. -This value of \fIposition\fR is used to insert an ordered sequence of -events at the front of the queue, such as a series of -Enter and Leave events synthesized during a grab or ungrab operation -in Tk. -.PP -When it is time to handle an event from the queue (steps 1 and 4 -above) \fBTcl_ServiceEvent\fR will invoke the \fIproc\fR specified -in the first queued \fBTcl_Event\fR structure. -\fIProc\fR must match the following prototype: -.PP -.CS -typedef int \fBTcl_EventProc\fR( - Tcl_Event *\fIevPtr\fR, - int \fIflags\fR); -.CE -.PP -The first argument to \fIproc\fR is a pointer to the event, which will -be the same as the first argument to the \fBTcl_QueueEvent\fR call that -added the event to the queue. -The second argument to \fIproc\fR is the \fIflags\fR argument for the -current call to \fBTcl_ServiceEvent\fR; this is used by the event source -to return immediately if its events are not relevant. -.PP -It is up to \fIproc\fR to handle the event, typically by invoking -one or more Tcl commands or C-level callbacks. -Once the event source has finished handling the event it returns 1 -to indicate that the event can be removed from the queue. -If for some reason the event source decides that the event cannot -be handled at this time, it may return 0 to indicate that the event -should be deferred for processing later; in this case \fBTcl_ServiceEvent\fR -will go on to the next event in the queue and attempt to service it. -There are several reasons why an event source might defer an event. -One possibility is that events of this type are excluded by the -\fIflags\fR argument. -For example, the file event source will always return 0 if the -\fBTCL_FILE_EVENTS\fR bit is not set in \fIflags\fR. -Another example of deferring events happens in Tk if -\fBTk_RestrictEvents\fR has been invoked to defer certain kinds -of window events. -.PP -When \fIproc\fR returns 1, \fBTcl_ServiceEvent\fR will remove the -event from the event queue and free its storage. -Note that the storage for an event must be allocated by -the event source (using \fBTcl_Alloc\fR or the Tcl macro \fBckalloc\fR) -before calling \fBTcl_QueueEvent\fR, but it -will be freed by \fBTcl_ServiceEvent\fR, not by the event source. -.PP -Threaded applications work in a -similar manner, except that there is a separate event queue for -each thread containing a Tcl interpreter. -Calling \fBTcl_QueueEvent\fR in a multithreaded application adds -an event to the current thread's queue. -To add an event to another thread's queue, use \fBTcl_ThreadQueueEvent\fR. -\fBTcl_ThreadQueueEvent\fR accepts as an argument a Tcl_ThreadId argument, -which uniquely identifies a thread in a Tcl application. To obtain the -Tcl_ThreadId for the current thread, use the \fBTcl_GetCurrentThread\fR -procedure. (A thread would then need to pass this identifier to other -threads for those threads to be able to add events to its queue.) -After adding an event to another thread's queue, you then typically -need to call \fBTcl_ThreadAlert\fR to -.QW "wake up" -that thread's notifier to alert it to the new event. -.PP -\fBTcl_DeleteEvents\fR can be used to explicitly remove one or more -events from the event queue. \fBTcl_DeleteEvents\fR calls \fIproc\fR -for each event in the queue, deleting those for with the procedure -returns 1. Events for which the procedure returns 0 are left in the -queue. \fIProc\fR should match the following prototype: -.PP -.CS -typedef int \fBTcl_EventDeleteProc\fR( - Tcl_Event *\fIevPtr\fR, - ClientData \fIclientData\fR); -.CE -.PP -The \fIclientData\fR argument will be the same as the \fIclientData\fR -argument to \fBTcl_DeleteEvents\fR; it is typically used to point to -private information managed by the event source. The \fIevPtr\fR will -point to the next event in the queue. -.PP -\fBTcl_DeleteEventSource\fR deletes an event source. The \fIsetupProc\fR, -\fIcheckProc\fR, and \fIclientData\fR arguments must exactly match those -provided to the \fBTcl_CreateEventSource\fR for the event source to be deleted. -If no such source exists, \fBTcl_DeleteEventSource\fR has no effect. -.SH "CREATING A NEW NOTIFIER" -.PP -The notifier consists of all the procedures described in this manual -entry, plus \fBTcl_DoOneEvent\fR and \fBTcl_Sleep\fR, which are -available on all platforms, and \fBTcl_CreateFileHandler\fR and -\fBTcl_DeleteFileHandler\fR, which are Unix-specific. Most of these -procedures are generic, in that they are the same for all notifiers. -However, none of the procedures are notifier-dependent: -\fBTcl_InitNotifier\fR, \fBTcl_AlertNotifier\fR, -\fBTcl_FinalizeNotifier\fR, \fBTcl_SetTimer\fR, \fBTcl_Sleep\fR, -\fBTcl_WaitForEvent\fR, \fBTcl_CreateFileHandler\fR, -\fBTcl_DeleteFileHandler\fR and \fBTcl_ServiceModeHook\fR. To support a -new platform or to integrate Tcl with an application-specific event loop, -you must write new versions of these procedures. -.PP -\fBTcl_InitNotifier\fR initializes the notifier state and returns -a handle to the notifier state. Tcl calls this -procedure when initializing a Tcl interpreter. Similarly, -\fBTcl_FinalizeNotifier\fR shuts down the notifier, and is -called by \fBTcl_Finalize\fR when shutting down a Tcl interpreter. -.PP -\fBTcl_WaitForEvent\fR is the lowest-level procedure in the notifier; -it is responsible for waiting for an -.QW interesting -event to occur or -for a given time to elapse. Before \fBTcl_WaitForEvent\fR is invoked, -each of the event sources' setup procedure will have been invoked. -The \fItimePtr\fR argument to -\fBTcl_WaitForEvent\fR gives the maximum time to block for an event, -based on calls to \fBTcl_SetMaxBlockTime\fR made by setup procedures -and on other information (such as the \fBTCL_DONT_WAIT\fR bit in -\fIflags\fR). -.PP -Ideally, \fBTcl_WaitForEvent\fR should only wait for an event -to occur; it should not actually process the event in any way. -Later on, the -event sources will process the raw events and create Tcl_Events on -the event queue in their \fIcheckProc\fR procedures. -However, on some platforms (such as Windows) this is not possible; -events may be processed in \fBTcl_WaitForEvent\fR, including queuing -Tcl_Events and more (for example, callbacks for native widgets may be -invoked). The return value from \fBTcl_WaitForEvent\fR must be either -0, 1, or \-1. On platforms such as Windows where events get processed in -\fBTcl_WaitForEvent\fR, a return value of 1 means that there may be more -events still pending that have not been processed. This is a sign to the -caller that it must call \fBTcl_WaitForEvent\fR again if it wants all -pending events to be processed. A 0 return value means that calling -\fBTcl_WaitForEvent\fR again will not have any effect: either this is a -platform where \fBTcl_WaitForEvent\fR only waits without doing any event -processing, or \fBTcl_WaitForEvent\fR knows for sure that there are no -additional events to process (e.g. it returned because the time -elapsed). Finally, a return value of \-1 means that the event loop is -no longer operational and the application should probably unwind and -terminate. Under Windows this happens when a WM_QUIT message is received; -under Unix it happens when \fBTcl_WaitForEvent\fR would have waited -forever because there were no active event sources and the timeout was -infinite. -.PP -\fBTcl_AlertNotifier\fR is used in multithreaded applications to allow -any thread to -.QW "wake up" -the notifier to alert it to new events on its -queue. \fBTcl_AlertNotifier\fR requires as an argument the notifier -handle returned by \fBTcl_InitNotifier\fR. -.PP -If the notifier will be used with an external event loop, then it must -also support the \fBTcl_SetTimer\fR interface. \fBTcl_SetTimer\fR is -invoked by \fBTcl_SetMaxBlockTime\fR whenever the maximum blocking -time has been reduced. \fBTcl_SetTimer\fR should arrange for the -external event loop to invoke \fBTcl_ServiceAll\fR after the specified -interval even if no events have occurred. This interface is needed -because \fBTcl_WaitForEvent\fR is not invoked when there is an external -event loop. If the -notifier will only be used from \fBTcl_DoOneEvent\fR, then -\fBTcl_SetTimer\fR need not do anything. -.PP -\fBTcl_ServiceModeHook\fR is called by the platform-independent portion -of the notifier when client code makes a call to -\fBTcl_SetServiceMode\fR. This hook is provided to support operating -systems that require special event handling when the application is in -a modal loop (the Windows notifier, for instance, uses this hook to -create a communication window). -.PP -On Unix systems, the file event source also needs support from the -notifier. The file event source consists of the -\fBTcl_CreateFileHandler\fR and \fBTcl_DeleteFileHandler\fR -procedures, which are described in the \fBTcl_CreateFileHandler\fR -manual page. -.PP -The \fBTcl_Sleep\fR and \fBTcl_DoOneEvent\fR interfaces are described -in their respective manual pages. -.PP -The easiest way to create a new notifier is to look at the code -for an existing notifier, such as the files \fBunix/tclUnixNotfy.c\fR -or \fBwin/tclWinNotify.c\fR in the Tcl source distribution. -.SH "REPLACING THE NOTIFIER" -.PP -A notifier that has been written according to the conventions above -can also be installed in a running process in place of the standard -notifier. This mechanism is used so that a single executable can be -used (with the standard notifier) as a stand-alone program and reused -(with a replacement notifier in a loadable extension) as an extension -to another program, such as a Web browser plugin. -.PP -To do this, the extension makes a call to \fBTcl_SetNotifier\fR -passing a pointer to a \fBTcl_NotifierProcs\fR data structure. The -structure has the following layout: -.PP -.CS -typedef struct Tcl_NotifierProcs { - Tcl_SetTimerProc *\fIsetTimerProc\fR; - Tcl_WaitForEventProc *\fIwaitForEventProc\fR; - Tcl_CreateFileHandlerProc *\fIcreateFileHandlerProc\fR; - Tcl_DeleteFileHandlerProc *\fIdeleteFileHandlerProc\fR; - Tcl_InitNotifierProc *\fIinitNotifierProc\fR; - Tcl_FinalizeNotifierProc *\fIfinalizeNotifierProc\fR; - Tcl_AlertNotifierProc *\fIalertNotifierProc\fR; - Tcl_ServiceModeHookProc *\fIserviceModeHookProc\fR; -} \fBTcl_NotifierProcs\fR; -.CE -.PP -Following the call to \fBTcl_SetNotifier\fR, the pointers given in -the \fBTcl_NotifierProcs\fR structure replace whatever notifier had -been installed in the process. -.PP -It is extraordinarily unwise to replace a running notifier. Normally, -\fBTcl_SetNotifier\fR should be called at process initialization time -before the first call to \fBTcl_InitNotifier\fR. -.SH "EXTERNAL EVENT LOOPS" -.PP -The notifier interfaces are designed so that Tcl can be embedded into -applications that have their own private event loops. In this case, -the application does not call \fBTcl_DoOneEvent\fR except in the case -of recursive event loops such as calls to the Tcl commands \fBupdate\fR -or \fBvwait\fR. Most of the time is spent in the external event loop -of the application. In this case the notifier must arrange for the -external event loop to call back into Tcl when something -happens on the various Tcl event sources. These callbacks should -arrange for appropriate Tcl events to be placed on the Tcl event queue. -.PP -Because the external event loop is not calling \fBTcl_DoOneEvent\fR on -a regular basis, it is up to the notifier to arrange for -\fBTcl_ServiceEvent\fR to be called whenever events are pending on the -Tcl event queue. The easiest way to do this is to invoke -\fBTcl_ServiceAll\fR at the end of each callback from the external -event loop. This will ensure that all of the event sources are -polled, any queued events are serviced, and any pending idle handlers -are processed before returning control to the application. In -addition, event sources that need to poll for events can call -\fBTcl_SetMaxBlockTime\fR to force the external event loop to call -Tcl even if no events are available on the system event queue. -.PP -As a side effect of processing events detected in the main external -event loop, Tcl may invoke \fBTcl_DoOneEvent\fR to start a recursive event -loop in commands like \fBvwait\fR. \fBTcl_DoOneEvent\fR will invoke -the external event loop, which will result in callbacks as described -in the preceding paragraph, which will result in calls to -\fBTcl_ServiceAll\fR. However, in these cases it is undesirable to -service events in \fBTcl_ServiceAll\fR. Servicing events there is -unnecessary because control will immediately return to the -external event loop and hence to \fBTcl_DoOneEvent\fR, which can -service the events itself. Furthermore, \fBTcl_DoOneEvent\fR is -supposed to service only a single event, whereas \fBTcl_ServiceAll\fR -normally services all pending events. To handle this situation, -\fBTcl_DoOneEvent\fR sets a flag for \fBTcl_ServiceAll\fR -that causes it to return without servicing any events. -This flag is called the \fIservice mode\fR; -\fBTcl_DoOneEvent\fR restores it to its previous value before it returns. -.PP -In some cases, however, it may be necessary for \fBTcl_ServiceAll\fR -to service events -even when it has been invoked from \fBTcl_DoOneEvent\fR. This happens -when there is yet another recursive event loop invoked via an -event handler called by \fBTcl_DoOneEvent\fR (such as one that is -part of a native widget). In this case, \fBTcl_DoOneEvent\fR may not -have a chance to service events so \fBTcl_ServiceAll\fR must service -them all. Any recursive event loop that calls an external event -loop rather than \fBTcl_DoOneEvent\fR must reset the service mode so -that all events get processed in \fBTcl_ServiceAll\fR. This is done -by invoking the \fBTcl_SetServiceMode\fR procedure. If -\fBTcl_SetServiceMode\fR is passed \fBTCL_SERVICE_NONE\fR, then calls -to \fBTcl_ServiceAll\fR will return immediately without processing any -events. If \fBTcl_SetServiceMode\fR is passed \fBTCL_SERVICE_ALL\fR, -then calls to \fBTcl_ServiceAll\fR will behave normally. -\fBTcl_SetServiceMode\fR returns the previous value of the service -mode, which should be restored when the recursive loop exits. -\fBTcl_GetServiceMode\fR returns the current value of the service -mode. -.SH "SEE ALSO" -Tcl_CreateFileHandler(3), Tcl_DeleteFileHandler(3), Tcl_Sleep(3), -Tcl_DoOneEvent(3), Thread(3) -.SH KEYWORDS -event, notifier, event queue, event sources, file events, timer, idle, service mode, threads diff --git a/doc/OOInitStubs.3 b/doc/OOInitStubs.3 deleted file mode 100644 index bc42453..0000000 --- a/doc/OOInitStubs.3 +++ /dev/null @@ -1,54 +0,0 @@ -'\" -'\" Copyright (c) 2012 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Tcl_OOInitStubs 3 1.0 TclOO "TclOO Library Functions" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_OOInitStubs \- initialize library access to TclOO functionality -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -const char * -\fBTcl_OOInitStubs\fR(\fIinterp\fR) -.fi -.SH ARGUMENTS -.AS Tcl_Interp *interp in -.AP Tcl_Interp *interp in -The Tcl interpreter that the TclOO API is integrated with and whose C -interface is going to be used. -.BE -.SH DESCRIPTION -.PP -When an extension library is going to use the C interface exposed by TclOO, it -should use \fBTcl_OOInitStubs\fR to initialize its access to that interface -from within its \fI*\fB_Init\fR (or \fI*\fB_SafeInit\fR) function, passing in -the \fIinterp\fR that was passed into that routine as context. If the result -of calling \fBTcl_OOInitStubs\fR is NULL, the initialization failed and an -error message will have been left in the interpreter's result. Otherwise, the -initialization succeeded and the TclOO API may thereafter be used; the -version of the TclOO API is returned. -.PP -When using this function, either the C #define symbol \fBUSE_TCLOO_STUBS\fR -should be defined and your library code linked against the Tcl stub library, -or that #define symbol should \fInot\fR be defined and your library code -linked against the Tcl main library directly. -.SH "BACKWARD COMPATIBILITY NOTE" -.PP -If you are linking against the Tcl 8.5 forward compatibility package for -TclOO, \fIonly\fR the stub-enabled configuration is supported and you should -also link against the TclOO independent stub library; that library is an -integrated part of the main Tcl stub library in Tcl 8.6. -.SH KEYWORDS -stubs -.SH "SEE ALSO" -Tcl_InitStubs(3) -.\" Local variables: -.\" mode: nroff -.\" fill-column: 78 -.\" End: diff --git a/doc/Object.3 b/doc/Object.3 deleted file mode 100644 index eadd041..0000000 --- a/doc/Object.3 +++ /dev/null @@ -1,352 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_Obj 3 8.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_NewObj, Tcl_DuplicateObj, Tcl_IncrRefCount, Tcl_DecrRefCount, Tcl_IsShared, Tcl_InvalidateStringRep \- manipulate Tcl values -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Obj * -\fBTcl_NewObj\fR() -.sp -Tcl_Obj * -\fBTcl_DuplicateObj\fR(\fIobjPtr\fR) -.sp -\fBTcl_IncrRefCount\fR(\fIobjPtr\fR) -.sp -\fBTcl_DecrRefCount\fR(\fIobjPtr\fR) -.sp -int -\fBTcl_IsShared\fR(\fIobjPtr\fR) -.sp -\fBTcl_InvalidateStringRep\fR(\fIobjPtr\fR) -.SH ARGUMENTS -.AS Tcl_Obj *objPtr -.AP Tcl_Obj *objPtr in -Points to a value; -must have been the result of a previous call to \fBTcl_NewObj\fR. -.BE -.SH INTRODUCTION -.PP -This man page presents an overview of Tcl values (called \fBTcl_Obj\fRs for -historical reasons) and how they are used. -It also describes generic procedures for managing Tcl values. -These procedures are used to create and copy values, -and increment and decrement the count of references (pointers) to values. -The procedures are used in conjunction with ones -that operate on specific types of values such as -\fBTcl_GetIntFromObj\fR and \fBTcl_ListObjAppendElement\fR. -The individual procedures are described along with the data structures -they manipulate. -.PP -Tcl's \fIdual-ported\fR values provide a general-purpose mechanism -for storing and exchanging Tcl values. -They largely replace the use of strings in Tcl. -For example, they are used to store variable values, -command arguments, command results, and scripts. -Tcl values behave like strings but also hold an internal representation -that can be manipulated more efficiently. -For example, a Tcl list is now represented as a value -that holds the list's string representation -as well as an array of pointers to the values for each list element. -Dual-ported values avoid most runtime type conversions. -They also improve the speed of many operations -since an appropriate representation is immediately available. -The compiler itself uses Tcl values to -cache the instruction bytecodes resulting from compiling scripts. -.PP -The two representations are a cache of each other and are computed lazily. -That is, each representation is only computed when necessary, -it is computed from the other representation, -and, once computed, it is saved. -In addition, a change in one representation invalidates the other one. -As an example, a Tcl program doing integer calculations can -operate directly on a variable's internal machine integer -representation without having to constantly convert -between integers and strings. -Only when it needs a string representing the variable's value, -say to print it, -will the program regenerate the string representation from the integer. -Although values contain an internal representation, -their semantics are defined in terms of strings: -an up-to-date string can always be obtained, -and any change to the value will be reflected in that string -when the value's string representation is fetched. -Because of this representation invalidation and regeneration, -it is dangerous for extension writers to access -\fBTcl_Obj\fR fields directly. -It is better to access Tcl_Obj information using -procedures like \fBTcl_GetStringFromObj\fR and \fBTcl_GetString\fR. -.PP -Values are allocated on the heap -and are referenced using a pointer to their \fBTcl_Obj\fR structure. -Values are shared as much as possible. -This significantly reduces storage requirements -because some values such as long lists are very large. -Also, most Tcl values are only read and never modified. -This is especially true for procedure arguments, -which can be shared between the caller and the called procedure. -Assignment and argument binding is done by -simply assigning a pointer to the value. -Reference counting is used to determine when it is safe to -reclaim a value's storage. -.PP -Tcl values are typed. -A value's internal representation is controlled by its type. -Several types are predefined in the Tcl core -including integer, double, list, and bytecode. -Extension writers can extend the set of types -by defining their own \fBTcl_ObjType\fR structs. -.SH "THE TCL_OBJ STRUCTURE" -.PP -Each Tcl value is represented by a \fBTcl_Obj\fR structure -which is defined as follows. -.PP -.CS -typedef struct Tcl_Obj { - int \fIrefCount\fR; - char *\fIbytes\fR; - int \fIlength\fR; - const Tcl_ObjType *\fItypePtr\fR; - union { - long \fIlongValue\fR; - double \fIdoubleValue\fR; - void *\fIotherValuePtr\fR; - Tcl_WideInt \fIwideValue\fR; - struct { - void *\fIptr1\fR; - void *\fIptr2\fR; - } \fItwoPtrValue\fR; - struct { - void *\fIptr\fR; - unsigned long \fIvalue\fR; - } \fIptrAndLongRep\fR; - } \fIinternalRep\fR; -} \fBTcl_Obj\fR; -.CE -.PP -The \fIbytes\fR and the \fIlength\fR members together hold -a value'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 -a value's string representation. -If \fIbytes\fR is NULL, -the string representation is invalid. -.PP -A value's type manages its internal representation. -The member \fItypePtr\fR points to the Tcl_ObjType structure -that describes the type. -If \fItypePtr\fR is NULL, -the internal representation is invalid. -.PP -The \fIinternalRep\fR union member holds -a value's internal representation. -This is either a (long) integer, a double-precision floating-point number, -a pointer to a value containing additional information -needed by the value's type to represent the value, a Tcl_WideInt -integer, two arbitrary pointers, or a pair made up of an unsigned long -integer and a pointer. -.PP -The \fIrefCount\fR member is used to tell when it is safe to free -a value's storage. -It holds the count of active references to the value. -Maintaining the correct reference count is a key responsibility -of extension writers. -Reference counting is discussed below -in the section \fBSTORAGE MANAGEMENT OF VALUES\fR. -.PP -Although extension writers can directly access -the members of a Tcl_Obj structure, -it is much better to use the appropriate procedures and macros. -For example, extension writers should never -read or update \fIrefCount\fR directly; -they should use macros such as -\fBTcl_IncrRefCount\fR and \fBTcl_IsShared\fR instead. -.PP -A key property of Tcl values is that they hold two representations. -A value typically starts out containing only a string representation: -it is untyped and has a NULL \fItypePtr\fR. -A value containing an empty string or a copy of a specified string -is created using \fBTcl_NewObj\fR or \fBTcl_NewStringObj\fR respectively. -A value's string value is gotten with -\fBTcl_GetStringFromObj\fR or \fBTcl_GetString\fR -and changed with \fBTcl_SetStringObj\fR. -If the value is later passed to a procedure like \fBTcl_GetIntFromObj\fR -that requires a specific internal representation, -the procedure will create one and set the value's \fItypePtr\fR. -The internal representation is computed from the string representation. -A value's two representations are duals of each other: -changes made to one are reflected in the other. -For example, \fBTcl_ListObjReplace\fR will modify a value's -internal representation and the next call to \fBTcl_GetStringFromObj\fR -or \fBTcl_GetString\fR will reflect that change. -.PP -Representations are recomputed lazily for efficiency. -A change to one representation made by a procedure -such as \fBTcl_ListObjReplace\fR is not reflected immediately -in the other representation. -Instead, the other representation is marked invalid -so that it is only regenerated if it is needed later. -Most C programmers never have to be concerned with how this is done -and simply use procedures such as \fBTcl_GetBooleanFromObj\fR or -\fBTcl_ListObjIndex\fR. -Programmers that implement their own value types -must check for invalid representations -and mark representations invalid when necessary. -The procedure \fBTcl_InvalidateStringRep\fR is used -to mark a value's string representation invalid and to -free any storage associated with the old string representation. -.PP -Values usually remain one type over their life, -but occasionally a value must be converted from one type to another. -For example, a C program might build up a string in a value -with repeated calls to \fBTcl_AppendToObj\fR, -and then call \fBTcl_ListObjIndex\fR to extract a list element from -the value. -The same value holding the same string value -can have several different internal representations -at different times. -Extension writers can also force a value to be converted from one type -to another using the \fBTcl_ConvertToType\fR procedure. -Only programmers that create new value types need to be concerned -about how this is done. -A procedure defined as part of the value type's implementation -creates a new internal representation for a value -and changes its \fItypePtr\fR. -See the man page for \fBTcl_RegisterObjType\fR -to see how to create a new value type. -.SH "EXAMPLE OF THE LIFETIME OF A VALUE" -.PP -As an example of the lifetime of a value, -consider the following sequence of commands: -.PP -.CS -\fBset x 123\fR -.CE -.PP -This assigns to \fIx\fR an untyped value whose -\fIbytes\fR member points to \fB123\fR and \fIlength\fR member contains 3. -The value's \fItypePtr\fR member is NULL. -.PP -.CS -\fBputs "x is $x"\fR -.CE -.PP -\fIx\fR's string representation is valid (since \fIbytes\fR is non-NULL) -and is fetched for the command. -.PP -.CS -\fBincr x\fR -.CE -.PP -The \fBincr\fR command first gets an integer from \fIx\fR's value -by calling \fBTcl_GetIntFromObj\fR. -This procedure checks whether the value is already an integer value. -Since it is not, it converts the value -by setting the value's internal representation -to the integer \fB123\fR -and setting the value's \fItypePtr\fR -to point to the integer Tcl_ObjType structure. -Both representations are now valid. -\fBincr\fR increments the value's integer internal representation -then invalidates its string representation -(by calling \fBTcl_InvalidateStringRep\fR) -since the string representation -no longer corresponds to the internal representation. -.PP -.CS -\fBputs "x is now $x"\fR -.CE -.PP -The string representation of \fIx\fR's value is needed -and is recomputed. -The string representation is now \fB124\fR -and both representations are again valid. -.SH "STORAGE MANAGEMENT OF VALUES" -.PP -Tcl values are allocated on the heap and are shared as much as possible -to reduce storage requirements. -Reference counting is used to determine when a value is -no longer needed and can safely be freed. -A value just created by \fBTcl_NewObj\fR or \fBTcl_NewStringObj\fR -has \fIrefCount\fR 0. -The macro \fBTcl_IncrRefCount\fR increments the reference count -when a new reference to the value is created. -The macro \fBTcl_DecrRefCount\fR decrements the count -when a reference is no longer needed and, -if the value's reference count drops to zero, frees its storage. -A value shared by different code or data structures has -\fIrefCount\fR greater than 1. -Incrementing a value's reference count ensures that -it will not be freed too early or have its value change accidentally. -.PP -As an example, the bytecode interpreter shares argument values -between calling and called Tcl procedures to avoid having to copy values. -It assigns the call's argument values to the procedure's -formal parameter variables. -In doing so, it calls \fBTcl_IncrRefCount\fR to increment -the reference count of each argument since there is now a new -reference to it from the formal parameter. -When the called procedure returns, -the interpreter calls \fBTcl_DecrRefCount\fR to decrement -each argument's reference count. -When a value's reference count drops less than or equal to zero, -\fBTcl_DecrRefCount\fR reclaims its storage. -Most command procedures do not have to be concerned about -reference counting since they use a value's value immediately -and do not retain a pointer to the value after they return. -However, if they do retain a pointer to a value in a data structure, -they must be careful to increment its reference count -since the retained pointer is a new reference. -.PP -Command procedures that directly modify values -such as those for \fBlappend\fR and \fBlinsert\fR must be careful to -copy a shared value before changing it. -They must first check whether the value is shared -by calling \fBTcl_IsShared\fR. -If the value is shared they must copy the value -by using \fBTcl_DuplicateObj\fR; -this returns a new duplicate of the original value -that has \fIrefCount\fR 0. -If the value is not shared, -the command procedure -.QW "owns" -the value and can safely modify it directly. -For example, the following code appears in the command procedure -that implements \fBlinsert\fR. -This procedure modifies the list value passed to it in \fIobjv[1]\fR -by inserting \fIobjc-3\fR new elements before \fIindex\fR. -.PP -.CS -listPtr = objv[1]; -if (\fBTcl_IsShared\fR(listPtr)) { - listPtr = \fBTcl_DuplicateObj\fR(listPtr); -} -result = Tcl_ListObjReplace(interp, listPtr, index, 0, - (objc-3), &(objv[3])); -.CE -.PP -As another example, \fBincr\fR's command procedure -must check whether the variable's value is shared before -incrementing the integer in its internal representation. -If it is shared, it needs to duplicate the value -in order to avoid accidentally changing values in other data structures. -.SH "SEE ALSO" -Tcl_ConvertToType(3), Tcl_GetIntFromObj(3), Tcl_ListObjAppendElement(3), Tcl_ListObjIndex(3), Tcl_ListObjReplace(3), Tcl_RegisterObjType(3) -.SH KEYWORDS -internal representation, value, value creation, value type, -reference counting, string representation, type conversion diff --git a/doc/ObjectType.3 b/doc/ObjectType.3 deleted file mode 100644 index bf414ac..0000000 --- a/doc/ObjectType.3 +++ /dev/null @@ -1,256 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_ObjType 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_RegisterObjType, Tcl_GetObjType, Tcl_AppendAllObjTypes, Tcl_ConvertToType \- manipulate Tcl value types -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_RegisterObjType\fR(\fItypePtr\fR) -.sp -const Tcl_ObjType * -\fBTcl_GetObjType\fR(\fItypeName\fR) -.sp -int -\fBTcl_AppendAllObjTypes\fR(\fIinterp, objPtr\fR) -.sp -int -\fBTcl_ConvertToType\fR(\fIinterp, objPtr, typePtr\fR) -.SH ARGUMENTS -.AS "const char" *typeName -.AP "const Tcl_ObjType" *typePtr in -Points to the structure containing information about the Tcl value type. -This storage must live forever, -typically by being statically allocated. -.AP "const char" *typeName in -The name of a Tcl value type that \fBTcl_GetObjType\fR should look up. -.AP Tcl_Interp *interp in -Interpreter to use for error reporting. -.AP Tcl_Obj *objPtr in -For \fBTcl_AppendAllObjTypes\fR, this points to the value onto which -it appends the name of each value type as a list element. -For \fBTcl_ConvertToType\fR, this points to a value that -must have been the result of a previous call to \fBTcl_NewObj\fR. -.BE - -.SH DESCRIPTION -.PP -The procedures in this man page manage Tcl value types (sometimes -referred to as object types or \fBTcl_ObjType\fRs for historical reasons). -They are used to register new value types, look up types, -and force conversions from one type to another. -.PP -\fBTcl_RegisterObjType\fR registers a new Tcl value type -in the table of all value types that \fBTcl_GetObjType\fR -can look up by name. There are other value types supported by Tcl -as well, which Tcl chooses not to register. Extensions can likewise -choose to register the value types they create or not. -The argument \fItypePtr\fR points to a Tcl_ObjType structure that -describes the new type by giving its name -and by supplying pointers to four procedures -that implement the type. -If the type table already contains a type -with the same name as in \fItypePtr\fR, -it is replaced with the new type. -The Tcl_ObjType structure is described -in the section \fBTHE TCL_OBJTYPE STRUCTURE\fR below. -.PP -\fBTcl_GetObjType\fR returns a pointer to the registered Tcl_ObjType -with name \fItypeName\fR. -It returns NULL if no type with that name is registered. -.PP -\fBTcl_AppendAllObjTypes\fR appends the name of each registered value type -as a list element onto the Tcl value referenced by \fIobjPtr\fR. -The return value is \fBTCL_OK\fR unless there was an error -converting \fIobjPtr\fR to a list value; -in that case \fBTCL_ERROR\fR is returned. -.PP -\fBTcl_ConvertToType\fR converts a value from one type to another -if possible. -It creates a new internal representation for \fIobjPtr\fR -appropriate for the target type \fItypePtr\fR -and sets its \fItypePtr\fR member as determined by calling the -\fItypePtr->setFromAnyProc\fR routine. -Any internal representation for \fIobjPtr\fR's old type is freed. -If an error occurs during conversion, it returns \fBTCL_ERROR\fR -and leaves an error message in the result value for \fIinterp\fR -unless \fIinterp\fR is NULL. -Otherwise, it returns \fBTCL_OK\fR. -Passing a NULL \fIinterp\fR allows this procedure to be used -as a test whether the conversion can be done (and in fact was done). -.VS 8.5 -.PP -In many cases, the \fItypePtr->setFromAnyProc\fR routine will -set \fIobjPtr->typePtr\fR to the argument value \fItypePtr\fR, -but that is no longer guaranteed. The \fIsetFromAnyProc\fR is -free to set the internal representation for \fIobjPtr\fR to make -use of another related Tcl_ObjType, if it sees fit. -.VE 8.5 -.SH "THE TCL_OBJTYPE STRUCTURE" -.PP -Extension writers can define new value types by defining four -procedures and -initializing a Tcl_ObjType structure to describe the type. -Extension writers may also pass a pointer to their Tcl_ObjType -structure to \fBTcl_RegisterObjType\fR if they wish to permit -other extensions to look up their Tcl_ObjType by name with -the \fBTcl_GetObjType\fR routine. -The \fBTcl_ObjType\fR structure is defined as follows: -.PP -.CS -typedef struct Tcl_ObjType { - const char *\fIname\fR; - Tcl_FreeInternalRepProc *\fIfreeIntRepProc\fR; - Tcl_DupInternalRepProc *\fIdupIntRepProc\fR; - Tcl_UpdateStringProc *\fIupdateStringProc\fR; - Tcl_SetFromAnyProc *\fIsetFromAnyProc\fR; -} \fBTcl_ObjType\fR; -.CE -.SS "THE NAME FIELD" -.PP -The \fIname\fR member describes the name of the type, e.g. \fBint\fR. -When a type is registered, this is the name used by callers -of \fBTcl_GetObjType\fR to lookup the type. For unregistered -types, the \fIname\fR field is primarily of value for debugging. -The remaining four members are pointers to procedures -called by the generic Tcl value code: -.SS "THE SETFROMANYPROC FIELD" -.PP -The \fIsetFromAnyProc\fR member contains the address of a function -called to create a valid internal representation -from a value's string representation. -.PP -.CS -typedef int \fBTcl_SetFromAnyProc\fR( - Tcl_Interp *\fIinterp\fR, - Tcl_Obj *\fIobjPtr\fR); -.CE -.PP -If an internal representation cannot be created from the string, -it returns \fBTCL_ERROR\fR and puts a message -describing the error in the result value for \fIinterp\fR -unless \fIinterp\fR is NULL. -If \fIsetFromAnyProc\fR is successful, -it stores the new internal representation, -sets \fIobjPtr\fR's \fItypePtr\fR member to point to -the \fBTcl_ObjType\fR struct corresponding to the new -internal representation, and returns \fBTCL_OK\fR. -Before setting the new internal representation, -the \fIsetFromAnyProc\fR must free any internal representation -of \fIobjPtr\fR's old type; -it does this by calling the old type's \fIfreeIntRepProc\fR -if it is not NULL. -.PP -As an example, the \fIsetFromAnyProc\fR for the built-in Tcl list type -gets an up-to-date string representation for \fIobjPtr\fR -by calling \fBTcl_GetStringFromObj\fR. -It parses the string to verify it is in a valid list format and -to obtain each element value in the list, and, if this succeeds, -stores the list elements in \fIobjPtr\fR's internal representation -and sets \fIobjPtr\fR's \fItypePtr\fR member to point to the list type's -Tcl_ObjType structure. -.PP -Do not release \fIobjPtr\fR's old internal representation unless you -replace it with a new one or reset the \fItypePtr\fR member to NULL. -.PP -The \fIsetFromAnyProc\fR member may be set to NULL, if the routines -making use of the internal representation have no need to derive that -internal representation from an arbitrary string value. However, in -this case, passing a pointer to the type to \fBTcl_ConvertToType\fR will -lead to a panic, so to avoid this possibility, the type -should \fInot\fR be registered. -.SS "THE UPDATESTRINGPROC FIELD" -.PP -The \fIupdateStringProc\fR member contains the address of a function -called to create a valid string representation -from a value's internal representation. -.PP -.CS -typedef void \fBTcl_UpdateStringProc\fR( - Tcl_Obj *\fIobjPtr\fR); -.CE -.PP -\fIobjPtr\fR's \fIbytes\fR member is always NULL when it is called. -It must always set \fIbytes\fR non-NULL before returning. -We require the string representation's byte array -to have a null after the last byte, at offset \fIlength\fR, -and to have no null bytes before that; this allows string representations -to be treated as conventional null character-terminated C strings. -These restrictions are easily met by using Tcl's internal UTF encoding -for the string representation, same as one would do for other -Tcl routines accepting string values as arguments. -Storage for the byte array must be allocated in the heap by \fBTcl_Alloc\fR -or \fBckalloc\fR. Note that \fIupdateStringProc\fRs must allocate -enough storage for the string's bytes and the terminating null byte. -.PP -The \fIupdateStringProc\fR for Tcl's built-in double type, for example, -calls Tcl_PrintDouble to write to a buffer of size TCL_DOUBLE_SPACE, -then allocates and copies the string representation to just enough -space to hold it. A pointer to the allocated space is stored in -the \fIbytes\fR member. -.PP -The \fIupdateStringProc\fR member may be set to NULL, if the routines -making use of the internal representation are written so that the -string representation is never invalidated. Failure to meet this -obligation will lead to panics or crashes when \fBTcl_GetStringFromObj\fR -or other similar routines ask for the string representation. -.SS "THE DUPINTREPPROC FIELD" -.PP -The \fIdupIntRepProc\fR member contains the address of a function -called to copy an internal representation from one value to another. -.PP -.CS -typedef void \fBTcl_DupInternalRepProc\fR( - Tcl_Obj *\fIsrcPtr\fR, - Tcl_Obj *\fIdupPtr\fR); -.CE -.PP -\fIdupPtr\fR's internal representation is made a copy of \fIsrcPtr\fR's -internal representation. -Before the call, -\fIsrcPtr\fR's internal representation is valid and \fIdupPtr\fR's is not. -\fIsrcPtr\fR's value type determines what -copying its internal representation means. -.PP -For example, the \fIdupIntRepProc\fR for the Tcl integer type -simply copies an integer. -The built-in list type's \fIdupIntRepProc\fR uses a far more -sophisticated scheme to continue sharing storage as much as it -reasonably can. -.SS "THE FREEINTREPPROC FIELD" -.PP -The \fIfreeIntRepProc\fR member contains the address of a function -that is called when a value is freed. -.PP -.CS -typedef void \fBTcl_FreeInternalRepProc\fR( - Tcl_Obj *\fIobjPtr\fR); -.CE -.PP -The \fIfreeIntRepProc\fR function can deallocate the storage -for the value's internal representation -and do other type-specific processing necessary when a value is freed. -.PP -For example, the list type's \fIfreeIntRepProc\fR respects -the storage sharing scheme established by the \fIdupIntRepProc\fR -so that it only frees storage when the last value sharing it -is being freed. -.PP -The \fIfreeIntRepProc\fR member can be set to NULL -to indicate that the internal representation does not require freeing. -The \fIfreeIntRepProc\fR implementation must not access the -\fIbytes\fR member of the value, since Tcl makes its own internal -uses of that field during value deletion. The defined tasks for -the \fIfreeIntRepProc\fR have no need to consult the \fIbytes\fR -member. -.SH "SEE ALSO" -Tcl_NewObj(3), Tcl_DecrRefCount(3), Tcl_IncrRefCount(3) -.SH KEYWORDS -internal representation, value, value type, string representation, type conversion diff --git a/doc/OpenFileChnl.3 b/doc/OpenFileChnl.3 deleted file mode 100644 index 582ff4b..0000000 --- a/doc/OpenFileChnl.3 +++ /dev/null @@ -1,648 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_OpenFileChannel 3 8.3 Tcl "Tcl Library Procedures" -.so man.macros -.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 \fR -.sp -Tcl_Channel -\fBTcl_OpenFileChannel\fR(\fIinterp, fileName, mode, permissions\fR) -.sp -Tcl_Channel -\fBTcl_OpenCommandChannel\fR(\fIinterp, argc, argv, flags\fR) -.sp -Tcl_Channel -\fBTcl_MakeFileChannel\fR(\fIhandle, readOrWrite\fR) -.sp -Tcl_Channel -\fBTcl_GetChannel\fR(\fIinterp, channelName, modePtr\fR) -.sp -int -\fBTcl_GetChannelNames\fR(\fIinterp\fR) -.sp -int -\fBTcl_GetChannelNamesEx\fR(\fIinterp, pattern\fR) -.sp -void -\fBTcl_RegisterChannel\fR(\fIinterp, channel\fR) -.sp -int -\fBTcl_UnregisterChannel\fR(\fIinterp, channel\fR) -.sp -int -\fBTcl_DetachChannel\fR(\fIinterp, channel\fR) -.sp -int -\fBTcl_IsStandardChannel\fR(\fIchannel\fR) -.sp -int -\fBTcl_Close\fR(\fIinterp, channel\fR) -.sp -int -\fBTcl_ReadChars\fR(\fIchannel, readObjPtr, charsToRead, appendFlag\fR) -.sp -int -\fBTcl_Read\fR(\fIchannel, readBuf, bytesToRead\fR) -.sp -int -\fBTcl_GetsObj\fR(\fIchannel, lineObjPtr\fR) -.sp -int -\fBTcl_Gets\fR(\fIchannel, lineRead\fR) -.sp -int -\fBTcl_Ungets\fR(\fIchannel, input, inputLen, addAtEnd\fR) -.sp -int -\fBTcl_WriteObj\fR(\fIchannel, writeObjPtr\fR) -.sp -int -\fBTcl_WriteChars\fR(\fIchannel, charBuf, bytesToWrite\fR) -.sp -int -\fBTcl_Write\fR(\fIchannel, byteBuf, bytesToWrite\fR) -.sp -int -\fBTcl_ReadRaw\fR(\fIchannel, readBuf, bytesToRead\fR) -.sp -int -\fBTcl_WriteRaw\fR(\fIchannel, byteBuf, bytesToWrite\fR) -.sp -int -\fBTcl_Eof\fR(\fIchannel\fR) -.sp -int -\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 -int -\fBTcl_TruncateChannel\fR(\fIchannel, length\fR) -.sp -int -\fBTcl_GetChannelOption\fR(\fIinterp, channel, optionName, optionValue\fR) -.sp -int -\fBTcl_SetChannelOption\fR(\fIinterp, channel, optionName, newValue\fR) -.sp -.SH ARGUMENTS -.AS Tcl_DString *channelName in/out -.AP Tcl_Interp *interp in -Used for error reporting and to look up a channel registered in it. -.AP "const char" *fileName in -The name of a local or network file. -.AP "const char" *mode in -Specifies how the file is to be accessed. May have any of the values -allowed for the \fImode\fR argument to the Tcl \fBopen\fR command. -.AP int permissions in -POSIX-style permission flags such as 0644. If a new file is created, these -permissions will be set on the created file. -.AP int argc in -The number of elements in \fIargv\fR. -.AP "const char" **argv in -Arguments for constructing a command pipeline. These values have the same -meaning as the non-switch arguments to the Tcl \fBexec\fR command. -.AP int flags in -Specifies the disposition of the stdio handles in pipeline: OR-ed -combination of \fBTCL_STDIN\fR, \fBTCL_STDOUT\fR, \fBTCL_STDERR\fR, and -\fBTCL_ENFORCE_MODE\fR. If \fBTCL_STDIN\fR is set, stdin for the first child -in the pipe is the pipe channel, otherwise it is the same as the standard -input of the invoking process; likewise for \fBTCL_STDOUT\fR and -\fBTCL_STDERR\fR. If \fBTCL_ENFORCE_MODE\fR is not set, then the pipe can -redirect stdio handles to override the stdio handles for which -\fBTCL_STDIN\fR, \fBTCL_STDOUT\fR and \fBTCL_STDERR\fR have been set. If it -is set, then such redirections cause an error. -.AP ClientData handle in -Operating system specific handle for I/O to a file. For Unix this is a -file descriptor, for Windows it is a HANDLE. -.AP int readOrWrite in -OR-ed combination of \fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR to indicate -what operations are valid on \fIhandle\fR. -.AP "const char" *channelName in -The name of the channel. -.AP int *modePtr out -Points at an integer variable that will receive an OR-ed combination of -\fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR denoting whether the channel is -open for reading and writing. -.AP "const char" *pattern in -The pattern to match on, passed to Tcl_StringMatch, or NULL. -.AP Tcl_Channel channel in -A Tcl channel for input or output. Must have been the return value -from a procedure such as \fBTcl_OpenFileChannel\fR. -.AP Tcl_Obj *readObjPtr in/out -A pointer to a Tcl value in which to store the characters read from the -channel. -.AP int charsToRead in -The number of characters to read from the channel. If the channel's encoding -is \fBbinary\fR, this is equivalent to the number of bytes to read from the -channel. -.AP int appendFlag in -If non-zero, data read from the channel will be appended to the value. -Otherwise, the data will replace the existing contents of the value. -.AP char *readBuf out -A buffer in which to store the bytes read from the channel. -.AP int bytesToRead in -The number of bytes to read from the channel. The buffer \fIreadBuf\fR must -be large enough to hold this many bytes. -.AP Tcl_Obj *lineObjPtr in/out -A pointer to a Tcl value in which to store the line read from the -channel. The line read will be appended to the current value of the -value. -.AP Tcl_DString *lineRead in/out -A pointer to a Tcl dynamic string in which to store the line read from the -channel. Must have been initialized by the caller. The line read will be -appended to any data already in the dynamic string. -.AP "const char" *input in -The input to add to a channel buffer. -.AP int inputLen in -Length of the input -.AP int addAtEnd in -Flag indicating whether the input should be added to the end or -beginning of the channel buffer. -.AP Tcl_Obj *writeObjPtr in -A pointer to a Tcl value whose contents will be output to the channel. -.AP "const char" *charBuf in -A buffer containing the characters to output to the channel. -.AP "const char" *byteBuf in -A buffer containing the bytes to output to the channel. -.AP int bytesToWrite in -The number of bytes to consume from \fIcharBuf\fR or \fIbyteBuf\fR and -output to the channel. -.AP Tcl_WideInt offset in -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 -New value for the option given by \fIoptionName\fR. -.BE -.SH DESCRIPTION -.PP -The Tcl channel mechanism provides a device-independent and -platform-independent mechanism for performing buffered input -and output operations on a variety of file, socket, and device -types. -The channel mechanism is extensible to new channel types, by -providing a low-level channel driver for the new type; the channel driver -interface is described in the manual entry for \fBTcl_CreateChannel\fR. The -channel mechanism provides a buffering scheme modeled after -Unix's standard I/O, and it also allows for nonblocking I/O on -channels. -.PP -The procedures described in this manual entry comprise the C APIs of the -generic layer of the channel architecture. For a description of the channel -driver architecture and how to implement channel drivers for new types of -channels, see the manual entry for \fBTcl_CreateChannel\fR. -.SH TCL_OPENFILECHANNEL -.PP -\fBTcl_OpenFileChannel\fR opens a file specified by \fIfileName\fR and -returns a channel handle that can be used to perform input and output on -the file. This API is modeled after the \fBfopen\fR procedure of -the Unix standard I/O library. -The syntax and meaning of all arguments is similar to those -given in the Tcl \fBopen\fR command when opening a file. -If an error occurs while opening the channel, \fBTcl_OpenFileChannel\fR -returns NULL and records a POSIX error code that can be -retrieved with \fBTcl_GetErrno\fR. -In addition, if \fIinterp\fR is non-NULL, \fBTcl_OpenFileChannel\fR -leaves an error message in \fIinterp\fR's result after any error. -As of Tcl 8.4, the value-based API \fBTcl_FSOpenFileChannel\fR should -be used in preference to \fBTcl_OpenFileChannel\fR wherever possible. -.PP -The newly created channel is not registered in the supplied interpreter; to -register it, use \fBTcl_RegisterChannel\fR, described below. -If one of the standard channels, \fBstdin\fR, \fBstdout\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 TCL_OPENCOMMANDCHANNEL -.PP -\fBTcl_OpenCommandChannel\fR provides a C-level interface to the -functions of the \fBexec\fR and \fBopen\fR commands. -It creates a sequence of subprocesses specified -by the \fIargv\fR and \fIargc\fR arguments and returns a channel that can -be used to communicate with these subprocesses. -The \fIflags\fR argument indicates what sort of communication will -exist with the command pipeline. -.PP -If the \fBTCL_STDIN\fR flag is set then the standard input for the -first subprocess will be tied to the channel: writing to the channel -will provide input to the subprocess. If \fBTCL_STDIN\fR is not set, -then standard input for the first subprocess will be the same as this -application's standard input. If \fBTCL_STDOUT\fR is set then -standard output from the last subprocess can be read from the channel; -otherwise it goes to this application's standard output. If -\fBTCL_STDERR\fR is set, standard error output for all subprocesses is -returned to the channel and results in an error when the channel is -closed; otherwise it goes to this application's standard error. If -\fBTCL_ENFORCE_MODE\fR is not set, then \fIargc\fR and \fIargv\fR can -redirect the stdio handles to override \fBTCL_STDIN\fR, -\fBTCL_STDOUT\fR, and \fBTCL_STDERR\fR; if it is set, then it is an -error for argc and argv to override stdio channels for which -\fBTCL_STDIN\fR, \fBTCL_STDOUT\fR, and \fBTCL_STDERR\fR have been set. -.PP -If an error occurs while opening the channel, \fBTcl_OpenCommandChannel\fR -returns NULL and records a POSIX error code that can be retrieved with -\fBTcl_GetErrno\fR. -In addition, \fBTcl_OpenCommandChannel\fR leaves an error message in -the interpreter's result if \fIinterp\fR is not NULL. -.PP -The newly created channel is not registered in the supplied interpreter; to -register it, use \fBTcl_RegisterChannel\fR, described below. -If one of the standard channels, \fBstdin\fR, \fBstdout\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 TCL_MAKEFILECHANNEL -.PP -\fBTcl_MakeFileChannel\fR makes a \fBTcl_Channel\fR from an existing, -platform-specific, file handle. -The newly created channel is not registered in the supplied interpreter; to -register it, use \fBTcl_RegisterChannel\fR, described below. -If one of the standard channels, \fBstdin\fR, \fBstdout\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 TCL_GETCHANNEL -.PP -\fBTcl_GetChannel\fR returns a channel given the \fIchannelName\fR used to -create it with \fBTcl_CreateChannel\fR and a pointer to a Tcl interpreter in -\fIinterp\fR. If a channel by that name is not registered in that interpreter, -the procedure returns NULL. If the \fImodePtr\fR argument is not NULL, it -points at an integer variable that will receive an OR-ed combination of -\fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR describing whether the channel is -open for reading and writing. -.PP -\fBTcl_GetChannelNames\fR and \fBTcl_GetChannelNamesEx\fR write the -names of the registered channels to the interpreter's result as a -list value. \fBTcl_GetChannelNamesEx\fR will filter these names -according to the \fIpattern\fR. If \fIpattern\fR is NULL, then it -will not do any filtering. The return value is \fBTCL_OK\fR if no -errors occurred writing to the result, otherwise it is \fBTCL_ERROR\fR, -and the error message is left in the interpreter's result. -.SH TCL_REGISTERCHANNEL -.PP -\fBTcl_RegisterChannel\fR adds a channel to the set of channels accessible -in \fIinterp\fR. After this call, Tcl programs executing in that -interpreter can refer to the channel in input or output operations using -the name given in the call to \fBTcl_CreateChannel\fR. After this call, -the channel becomes the property of the interpreter, and the caller should -not call \fBTcl_Close\fR for the channel; the channel will be closed -automatically when it is unregistered from the interpreter. -.PP -Code executing outside of any Tcl interpreter can call -\fBTcl_RegisterChannel\fR with \fIinterp\fR as NULL, to indicate that it -wishes to hold a reference to this channel. Subsequently, the channel can -be registered in a Tcl interpreter and it will only be closed when the -matching number of calls to \fBTcl_UnregisterChannel\fR have been made. -This allows code executing outside of any interpreter to safely hold a -reference to a channel that is also registered in a Tcl interpreter. -.PP -This procedure interacts with the code managing the standard -channels. If no standard channels were initialized before the first -call to \fBTcl_RegisterChannel\fR, they will get initialized by that -call. See \fBTcl_StandardChannels\fR for a general treatise about -standard channels and the behavior of the Tcl library with regard to -them. -.SH TCL_UNREGISTERCHANNEL -.PP -\fBTcl_UnregisterChannel\fR removes a channel from the set of channels -accessible in \fIinterp\fR. After this call, Tcl programs will no longer be -able to use the channel's name to refer to the channel in that interpreter. -If this operation removed the last registration of the channel in any -interpreter, the channel is also closed and destroyed. -.PP -Code not associated with a Tcl interpreter can call -\fBTcl_UnregisterChannel\fR with \fIinterp\fR as NULL, to indicate to Tcl -that it no longer holds a reference to that channel. If this is the last -reference to the channel, it will now be closed. \fBTcl_UnregisterChannel\fR -is very similar to \fBTcl_DetachChannel\fR except that it will also -close the channel if no further references to it exist. -.SH TCL_DETACHCHANNEL -.PP -\fBTcl_DetachChannel\fR removes a channel from the set of channels -accessible in \fIinterp\fR. After this call, Tcl programs will no longer be -able to use the channel's name to refer to the channel in that interpreter. -Beyond that, this command has no further effect. It cannot be used on -the standard channels (\fBstdout\fR, \fBstderr\fR, \fBstdin\fR), and will return -\fBTCL_ERROR\fR if passed one of those channels. -.PP -Code not associated with a Tcl interpreter can call -\fBTcl_DetachChannel\fR with \fIinterp\fR as NULL, to indicate to Tcl -that it no longer holds a reference to that channel. If this is the last -reference to the channel, unlike \fBTcl_UnregisterChannel\fR, -it will not be closed. -.SH TCL_ISSTANDARDCHANNEL -.PP -\fBTcl_IsStandardChannel\fR tests whether a channel is one of the -three standard channels, \fBstdin\fR, \fBstdout\fR or \fBstderr\fR. -If so, it returns 1, otherwise 0. -.PP -No attempt is made to check whether the given channel or the standard -channels are initialized or otherwise valid. -.SH TCL_CLOSE -.PP -\fBTcl_Close\fR destroys the channel \fIchannel\fR, which must denote a -currently open channel. The channel should not be registered in any -interpreter when \fBTcl_Close\fR is called. Buffered output is flushed to -the channel's output device prior to destroying the channel, and any -buffered input is discarded. If this is a blocking channel, the call does -not return until all buffered data is successfully sent to the channel's -output device. If this is a nonblocking channel and there is buffered -output that cannot be written without blocking, the call returns -immediately; output is flushed in the background and the channel will be -closed once all of the buffered data has been output. In this case errors -during flushing are not reported. -.PP -If the channel was closed successfully, \fBTcl_Close\fR returns \fBTCL_OK\fR. -If an error occurs, \fBTcl_Close\fR returns \fBTCL_ERROR\fR and records a -POSIX error code that can be retrieved with \fBTcl_GetErrno\fR. -If the channel is being closed synchronously and an error occurs during -closing of the channel and \fIinterp\fR is not NULL, an error message is -left in the interpreter's result. -.PP -Note: it is not safe to call \fBTcl_Close\fR on a channel that has been -registered using \fBTcl_RegisterChannel\fR; see the documentation for -\fBTcl_RegisterChannel\fR, above, for details. If the channel has ever -been given as the \fBchan\fR argument in a call to -\fBTcl_RegisterChannel\fR, you should instead use -\fBTcl_UnregisterChannel\fR, which will internally call \fBTcl_Close\fR -when all calls to \fBTcl_RegisterChannel\fR have been matched by -corresponding calls to \fBTcl_UnregisterChannel\fR. -.SH "TCL_READCHARS AND TCL_READ" -.PP -\fBTcl_ReadChars\fR consumes bytes from \fIchannel\fR, converting the bytes -to UTF-8 based on the channel's encoding and storing the produced data in -\fIreadObjPtr\fR's string representation. The return value of -\fBTcl_ReadChars\fR is the number of characters, up to \fIcharsToRead\fR, -that were stored in \fIreadObjPtr\fR. If an error occurs while reading, the -return value is \-1 and \fBTcl_ReadChars\fR records a POSIX error code that -can be retrieved with \fBTcl_GetErrno\fR. -.PP -Setting \fIcharsToRead\fR to \fB\-1\fR will cause the command to read -all characters currently available (non-blocking) or everything until -eof (blocking mode). -.PP -The return value may be smaller than the value to read, indicating that less -data than requested was available. This is called a \fIshort read\fR. In -blocking mode, this can only happen on an end-of-file. In nonblocking mode, -a short read can also occur if there is not enough input currently -available: \fBTcl_ReadChars\fR returns a short count rather than waiting -for more data. -.PP -If the channel is in blocking mode, a return value of zero indicates an -end-of-file condition. If the channel is in nonblocking mode, a return -value of zero indicates either that no input is currently available or an -end-of-file condition. Use \fBTcl_Eof\fR and \fBTcl_InputBlocked\fR to tell -which of these conditions actually occurred. -.PP -\fBTcl_ReadChars\fR translates the various end-of-line representations into -the canonical \fB\en\fR internal representation according to the current -end-of-line recognition mode. End-of-line recognition and the various -platform-specific modes are described in the manual entry for the Tcl -\fBfconfigure\fR command. -.PP -As a performance optimization, when reading from a channel with the encoding -\fBbinary\fR, the bytes are not converted to UTF-8 as they are read. -Instead, they are stored in \fIreadObjPtr\fR's internal representation as a -byte-array value. The string representation of this value will only be -constructed if it is needed (e.g., because of a call to -\fBTcl_GetStringFromObj\fR). In this way, byte-oriented data can be read -from a channel, manipulated by calling \fBTcl_GetByteArrayFromObj\fR and -related functions, and then written to a channel without the expense of ever -converting to or from UTF-8. -.PP -\fBTcl_Read\fR is similar to \fBTcl_ReadChars\fR, except that it does not do -encoding conversions, regardless of the channel's encoding. It is deprecated -and exists for backwards compatibility with non-internationalized Tcl -extensions. It consumes bytes from \fIchannel\fR and stores them in -\fIreadBuf\fR, performing end-of-line translations on the way. The return value -of \fBTcl_Read\fR is the number of bytes, up to \fIbytesToRead\fR, written in -\fIreadBuf\fR. The buffer produced by \fBTcl_Read\fR is not null-terminated. -Its contents are valid from the zeroth position up to and excluding the -position indicated by the return value. -.PP -\fBTcl_ReadRaw\fR is the same as \fBTcl_Read\fR but does not -compensate for stacking. While \fBTcl_Read\fR (and the other functions -in the API) always get their data from the topmost channel in the -stack the supplied channel is part of, \fBTcl_ReadRaw\fR does -not. Thus this function is \fBonly\fR usable for transformational -channel drivers, i.e. drivers used in the middle of a stack of -channels, to move data from the channel below into the transformation. -.SH "TCL_GETSOBJ AND TCL_GETS" -.PP -\fBTcl_GetsObj\fR consumes bytes from \fIchannel\fR, converting the bytes to -UTF-8 based on the channel's encoding, until a full line of input has been -seen. If the channel's encoding is \fBbinary\fR, each byte read from the -channel is treated as an individual Unicode character. All of the -characters of the line except for the terminating end-of-line character(s) -are appended to \fIlineObjPtr\fR's string representation. The end-of-line -character(s) are read and discarded. -.PP -If a line was successfully read, the return value is greater than or equal -to zero and indicates the number of bytes stored in \fIlineObjPtr\fR. If an -error occurs, \fBTcl_GetsObj\fR returns \-1 and records a POSIX error code -that can be retrieved with \fBTcl_GetErrno\fR. \fBTcl_GetsObj\fR also -returns \-1 if the end of the file is reached; the \fBTcl_Eof\fR procedure -can be used to distinguish an error from an end-of-file condition. -.PP -If the channel is in nonblocking mode, the return value can also be \-1 if -no data was available or the data that was available did not contain an -end-of-line character. When \-1 is returned, the \fBTcl_InputBlocked\fR -procedure may be invoked to determine if the channel is blocked because -of input unavailability. -.PP -\fBTcl_Gets\fR is the same as \fBTcl_GetsObj\fR except the resulting -characters are appended to the dynamic string given by -\fIlineRead\fR rather than a Tcl value. -.SH "TCL_UNGETS" -.PP -\fBTcl_Ungets\fR is used to add data to the input queue of a channel, -at either the head or tail of the queue. The pointer \fIinput\fR points -to the data that is to be added. The length of the input to add is given -by \fIinputLen\fR. A non-zero value of \fIaddAtEnd\fR indicates that the -data is to be added at the end of queue; otherwise it will be added at the -head of the queue. If \fIchannel\fR has a -.QW sticky -EOF set, no data will be -added to the input queue. \fBTcl_Ungets\fR returns \fIinputLen\fR or -\-1 if an error occurs. -.SH "TCL_WRITECHARS, TCL_WRITEOBJ, AND TCL_WRITE" -.PP -\fBTcl_WriteChars\fR accepts \fIbytesToWrite\fR bytes of character data at -\fIcharBuf\fR. The UTF-8 characters in the buffer are converted to the -channel's encoding and queued for output to \fIchannel\fR. If -\fIbytesToWrite\fR is negative, \fBTcl_WriteChars\fR expects \fIcharBuf\fR -to be null-terminated and it outputs everything up to the null. -.PP -Data queued for output may not appear on the output device immediately, due -to internal buffering. If the data should appear immediately, call -\fBTcl_Flush\fR after the call to \fBTcl_WriteChars\fR, or set the -\fB\-buffering\fR option on the channel to \fBnone\fR. If you wish the data -to appear as soon as a complete line is accepted for output, set the -\fB\-buffering\fR option on the channel to \fBline\fR mode. -.PP -The return value of \fBTcl_WriteChars\fR is a count of how many bytes were -accepted for output to the channel. This is either greater than zero to -indicate success or \-1 to indicate that an error occurred. If an error -occurs, \fBTcl_WriteChars\fR records a POSIX error code that may be -retrieved with \fBTcl_GetErrno\fR. -.PP -Newline characters in the output data are translated to platform-specific -end-of-line sequences according to the \fB\-translation\fR option for the -channel. This is done even if the channel has no encoding. -.PP -\fBTcl_WriteObj\fR is similar to \fBTcl_WriteChars\fR except it -accepts a Tcl value whose contents will be output to the channel. The -UTF-8 characters in \fIwriteObjPtr\fR's string representation are converted -to the channel's encoding and queued for output to \fIchannel\fR. -As a performance optimization, when writing to a channel with the encoding -\fBbinary\fR, UTF-8 characters are not converted as they are written. -Instead, the bytes in \fIwriteObjPtr\fR's internal representation as a -byte-array value are written to the channel. The byte-array representation -of the value will be constructed if it is needed. In this way, -byte-oriented data can be read from a channel, manipulated by calling -\fBTcl_GetByteArrayFromObj\fR and related functions, and then written to a -channel without the expense of ever converting to or from UTF-8. -.PP -\fBTcl_Write\fR is similar to \fBTcl_WriteChars\fR except that it does not do -encoding conversions, regardless of the channel's encoding. It is -deprecated and exists for backwards compatibility with non-internationalized -Tcl extensions. It accepts \fIbytesToWrite\fR bytes of data at -\fIbyteBuf\fR and queues them for output to \fIchannel\fR. If -\fIbytesToWrite\fR is negative, \fBTcl_Write\fR expects \fIbyteBuf\fR to be -null-terminated and it outputs everything up to the null. -.PP -\fBTcl_WriteRaw\fR is the same as \fBTcl_Write\fR but does not -compensate for stacking. While \fBTcl_Write\fR (and the other -functions in the API) always feed their input to the topmost channel -in the stack the supplied channel is part of, \fBTcl_WriteRaw\fR does -not. Thus this function is \fBonly\fR usable for transformational -channel drivers, i.e. drivers used in the middle of a stack of -channels, to move data from the transformation into the channel below -it. -.SH TCL_FLUSH -.PP -\fBTcl_Flush\fR causes all of the buffered output data for \fIchannel\fR -to be written to its underlying file or device as soon as possible. -If the channel is in blocking mode, the call does not return until -all the buffered data has been sent to the channel or some error occurred. -The call returns immediately if the channel is nonblocking; it starts -a background flush that will write the buffered data to the channel -eventually, as fast as the channel is able to absorb it. -.PP -The return value is normally \fBTCL_OK\fR. -If an error occurs, \fBTcl_Flush\fR returns \fBTCL_ERROR\fR and -records a POSIX error code that can be retrieved with \fBTcl_GetErrno\fR. -.SH TCL_SEEK -.PP -\fBTcl_Seek\fR moves the access point in \fIchannel\fR where subsequent -data will be read or written. Buffered output is flushed to the channel and -buffered input is discarded, prior to the seek operation. -.PP -\fBTcl_Seek\fR normally returns the new access point. -If an error occurs, \fBTcl_Seek\fR returns \-1 and records a POSIX error -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 -\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. -.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. -If \fIoptionName\fR is not NULL, it is the name of the -option to query; the option's value is copied to the Tcl dynamic string -denoted by \fIoptionValue\fR. If -\fIoptionName\fR is NULL, the function stores an alternating list of option -names and their values in \fIoptionValue\fR, using a series of calls to -\fBTcl_DStringAppendElement\fR. The various preexisting options and -their possible values are described in the manual entry for the Tcl -\fBfconfigure\fR command. Other options can be added by each channel type. -These channel type specific options are described in the manual entry for -the Tcl command that creates a channel of that type; for example, the -additional options for TCP based channels are described in the manual entry -for the Tcl \fBsocket\fR command. -The procedure normally returns \fBTCL_OK\fR. If an error occurs, it returns -\fBTCL_ERROR\fR and calls \fBTcl_SetErrno\fR to store an appropriate POSIX -error code. -.SH TCL_SETCHANNELOPTION -.PP -\fBTcl_SetChannelOption\fR sets a new value \fInewValue\fR -for an option \fIoptionName\fR on \fIchannel\fR. -The procedure normally returns \fBTCL_OK\fR. If an error occurs, -it returns \fBTCL_ERROR\fR; in addition, if \fIinterp\fR is non-NULL, -\fBTcl_SetChannelOption\fR leaves an error message in the interpreter's result. -.SH TCL_EOF -.PP -\fBTcl_Eof\fR returns a nonzero value if \fIchannel\fR encountered -an end of file during the last input operation. -.SH TCL_INPUTBLOCKED -.PP -\fBTcl_InputBlocked\fR returns a nonzero value if \fIchannel\fR is in -nonblocking mode and the last input operation returned less data than -requested because there was insufficient data available. -The call always returns zero if the channel is in blocking mode. -.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 -.PP -\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 -the channel was created with \fBTcl_OpenFileChannel\fR, -\fBTcl_OpenCommandChannel\fR, or \fBTcl_MakeFileChannel\fR. Other -channel types may return a different type of handle on Windows -platforms. -.SH "SEE ALSO" -DString(3), fconfigure(n), filename(n), fopen(3), Tcl_CreateChannel(3) -.SH KEYWORDS -access point, blocking, buffered I/O, channel, channel driver, end of file, -flush, input, nonblocking, output, read, seek, write diff --git a/doc/OpenTcp.3 b/doc/OpenTcp.3 deleted file mode 100644 index 5b941dc..0000000 --- a/doc/OpenTcp.3 +++ /dev/null @@ -1,183 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_OpenTcpClient 3 8.7 Tcl "Tcl Library Procedures" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_OpenTcpClient, Tcl_MakeTcpClientChannel, Tcl_OpenTcpServer, Tcl_OpenTcpServerEx \- procedures to open channels using TCP sockets -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Channel -\fBTcl_OpenTcpClient\fR(\fIinterp, port, host, myaddr, myport, async\fR) -.sp -Tcl_Channel -\fBTcl_MakeTcpClientChannel\fR(\fIsock\fR) -.sp -Tcl_Channel -\fBTcl_OpenTcpServer\fR(\fIinterp, port, myaddr, proc, clientData\fR) -.sp -Tcl_Channel -\fBTcl_OpenTcpServerEx\fR(\fIinterp, service, myaddr, flags, proc, clientData\fR) -.sp -.SH ARGUMENTS -.AS Tcl_TcpAcceptProc clientData -.AP Tcl_Interp *interp in -Tcl interpreter to use for error reporting. If non-NULL and an -error occurs, an error message is left in the interpreter's result. -.AP int port in -A port number to connect to as a client or to listen on as a server. -.AP "const char" *service in -A string specifying the port number to connect to as a client or to listen on as - a server. -.AP "const char" *host in -A string specifying a host name or address for the remote end of the connection. -.AP int myport in -A port number for the client's end of the socket. If 0, a port number -is allocated at random. -.AP "const char" *myaddr in -A string specifying the host name or address for network interface to use -for the local end of the connection. If NULL, a default interface is -chosen. -.AP int async in -If nonzero, the client socket is connected asynchronously to the server. -.AP "unsigned int" flags in -ORed combination of \fBTCL_TCPSERVER\fR flags that specify additional -informations about the socket being created. -.AP ClientData sock in -Platform-specific handle for client TCP socket. -.AP Tcl_TcpAcceptProc *proc in -Pointer to a procedure to invoke each time a new connection is -accepted via the socket. -.AP ClientData clientData in -Arbitrary one-word value to pass to \fIproc\fR. -.BE -.SH DESCRIPTION -.PP -These functions are convenience procedures for creating -channels that communicate over TCP sockets. -The operations on a channel -are described in the manual entry for \fBTcl_OpenFileChannel\fR. -.SS TCL_OPENTCPCLIENT -.PP -\fBTcl_OpenTcpClient\fR opens a client TCP socket connected to a \fIport\fR -on a specific \fIhost\fR, and returns a channel that can be used to -communicate with the server. The host to connect to can be specified either -as a domain name style name (e.g. \fBwww.sunlabs.com\fR), or as a string -containing the alphanumeric representation of its four-byte address (e.g. -\fB127.0.0.1\fR). Use the string \fBlocalhost\fR to connect to a TCP socket on -the host on which the function is invoked. -.PP -The \fImyaddr\fR and \fImyport\fR arguments allow a client to specify an -address for the local end of the connection. If \fImyaddr\fR is NULL, then -an interface is chosen automatically by the operating system. -If \fImyport\fR is 0, then a port number is chosen at random by -the operating system. -.PP -If \fIasync\fR is zero, the call to \fBTcl_OpenTcpClient\fR returns only -after the client socket has either successfully connected to the server, or -the attempted connection has failed. -If \fIasync\fR is nonzero the socket is connected asynchronously and the -returned channel may not yet be connected to the server when the call to -\fBTcl_OpenTcpClient\fR returns. If the channel is in blocking mode and an -input or output operation is done on the channel before the connection is -completed or fails, that operation will wait until the connection either -completes successfully or fails. If the channel is in nonblocking mode, the -input or output operation will return immediately and a subsequent call to -\fBTcl_InputBlocked\fR on the channel will return nonzero. -.PP -The returned channel is opened for reading and writing. -If an error occurs in opening the socket, \fBTcl_OpenTcpClient\fR returns -NULL and records a POSIX error code that can be retrieved -with \fBTcl_GetErrno\fR. -In addition, if \fIinterp\fR is non-NULL, an error message -is left in the interpreter's result. -.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\fR, \fBstdout\fR or \fBstderr\fR was -previously closed, the act of creating the new channel also assigns it as a -replacement for the standard channel. -.SS TCL_MAKETCPCLIENTCHANNEL -.PP -\fBTcl_MakeTcpClientChannel\fR creates a \fBTcl_Channel\fR around an -existing, platform specific, handle for a client TCP socket. -.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\fR, \fBstdout\fR or \fBstderr\fR was -previously closed, the act of creating the new channel also assigns it as a -replacement for the standard channel. -.SS TCL_OPENTCPSERVER -.PP -\fBTcl_OpenTcpServer\fR opens a TCP socket on the local host on a specified -\fIport\fR and uses the Tcl event mechanism to accept requests from clients -to connect to it. The \fImyaddr\fR argument specifies the network interface. -If \fImyaddr\fR is NULL the special address INADDR_ANY should be used to -allow connections from any network interface. -Each time a client connects to this socket, Tcl creates a channel -for the new connection and invokes \fIproc\fR with information about -the channel. \fIProc\fR must match the following prototype: -.PP -.CS -typedef void \fBTcl_TcpAcceptProc\fR( - ClientData \fIclientData\fR, - Tcl_Channel \fIchannel\fR, - char *\fIhostName\fR, - int \fIport\fR); -.CE -.PP -The \fIclientData\fR argument will be the same as the \fIclientData\fR -argument to \fBTcl_OpenTcpServer\fR, \fIchannel\fR will be the handle -for the new channel, \fIhostName\fR points to a string containing -the name of the client host making the connection, and \fIport\fR -will contain the client's port number. -The new channel -is opened for both input and output. -If \fIproc\fR raises an error, the connection is closed automatically. -\fIProc\fR has no return value, but if it wishes to reject the -connection it can close \fIchannel\fR. -.PP -\fBTcl_OpenTcpServer\fR normally returns a pointer to a channel -representing the server socket. -If an error occurs, \fBTcl_OpenTcpServer\fR returns NULL and -records a POSIX error code that can be retrieved with \fBTcl_GetErrno\fR. -In addition, if the interpreter is non-NULL, an error message -is left in the interpreter's result. -.PP -The channel returned by \fBTcl_OpenTcpServer\fR cannot be used for -either input or output. -It is simply a handle for the socket used to accept connections. -The caller can close the channel to shut down the server and disallow -further connections from new clients. -.PP -TCP server channels operate correctly only in applications that dispatch -events through \fBTcl_DoOneEvent\fR or through Tcl commands such as -\fBvwait\fR; otherwise Tcl will never notice that a connection request from -a remote client is pending. -.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\fR, \fBstdout\fR or \fBstderr\fR was -previously closed, the act of creating the new channel also assigns it as a -replacement for the standard channel. -.SS TCL_OPENTCPSERVEREX -.PP -\fBTcl_OpenTcpServerEx\fR behaviour is identical to \fBTcl_OpenTcpServer\fR but -gives more flexibility to the user by providing a mean to further customize some -aspects of the socket via the \fIflags\fR parameter. -.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 -channel, client, server, socket, TCP diff --git a/doc/Panic.3 b/doc/Panic.3 deleted file mode 100644 index af86665..0000000 --- a/doc/Panic.3 +++ /dev/null @@ -1,89 +0,0 @@ -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Tcl_Panic 3 8.4 Tcl "Tcl Library Procedures" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_Panic, Tcl_PanicVA, Tcl_SetPanicProc \- report fatal error and abort -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -void -\fBTcl_Panic\fR(\fIformat\fR, \fIarg\fR, \fIarg\fR, \fI...\fR) -.sp -void -\fBTcl_PanicVA\fR(\fIformat\fR, \fIargList\fR) -.sp -void -\fBTcl_SetPanicProc\fR(\fIpanicProc\fR) -.sp -.SH ARGUMENTS -.AS Tcl_PanicProc *panicProc -.AP "const char*" format in -A printf-style format string. -.AP "" arg in -Arguments matching the format string. -.AP va_list argList in -An argument list of arguments matching the format string. -Must have been initialized using \fBva_start\fR, -and cleared using \fBva_end\fR. -.AP Tcl_PanicProc *panicProc in -Procedure to report fatal error message and abort. -.BE -.SH DESCRIPTION -.PP -When the Tcl library detects that its internal data structures are in an -inconsistent state, or that its C procedures have been called in a -manner inconsistent with their documentation, it calls \fBTcl_Panic\fR -to display a message describing the error and abort the process. The -\fIformat\fR argument is a format string describing how to format the -remaining arguments \fIarg\fR into an error message, according to the -same formatting rules used by the \fBprintf\fR family of functions. The -same formatting rules are also used by the built-in Tcl command -\fBformat\fR. -.PP -In a freshly loaded Tcl library, \fBTcl_Panic\fR prints the formatted -error message to the standard error file of the process, and then -calls \fBabort\fR to terminate the process. \fBTcl_Panic\fR does not -return. On Windows, when a debugger is running, the formatted error -message is sent to the debugger in stead. If the windows executable -does not have a stderr channel (e.g. \fBwish.exe\fR), then a -system dialog box is used to display the panic message. -.PP -\fBTcl_SetPanicProc\fR may be used to modify the behavior of -\fBTcl_Panic\fR. The \fIpanicProc\fR argument should match the -type \fBTcl_PanicProc\fR: -.PP -.CS -typedef void \fBTcl_PanicProc\fR( - const char *\fBformat\fR, - \fBarg\fR, \fBarg\fR,...); -.CE -.PP -After \fBTcl_SetPanicProc\fR returns, any future calls to -\fBTcl_Panic\fR will call \fIpanicProc\fR, passing along the -\fIformat\fR and \fIarg\fR arguments. \fIpanicProc\fR should avoid -making calls into the Tcl library, or into other libraries that may -call the Tcl library, since the original call to \fBTcl_Panic\fR -indicates the Tcl library is not in a state of reliable operation. -.PP -The typical use of \fBTcl_SetPanicProc\fR arranges for the error message -to be displayed or reported in a manner more suitable for the -application or the platform. -.PP -Although the primary callers of \fBTcl_Panic\fR are the procedures of -the Tcl library, \fBTcl_Panic\fR is a public function and may be called -by any extension or application that wishes to abort the process and -have a panic message displayed the same way that panic messages from Tcl -will be displayed. -.PP -\fBTcl_PanicVA\fR is the same as \fBTcl_Panic\fR except that instead of -taking a variable number of arguments it takes an argument list. -.SH "SEE ALSO" -abort(3), printf(3), exec(n), format(n) -.SH KEYWORDS -abort, fatal, error diff --git a/doc/ParseArgs.3 b/doc/ParseArgs.3 deleted file mode 100644 index f278ee9..0000000 --- a/doc/ParseArgs.3 +++ /dev/null @@ -1,198 +0,0 @@ -'\" -'\" Copyright (c) 2008 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Tcl_ParseArgsObjv 3 8.6 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_ParseArgsObjv \- parse arguments according to a tabular description -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_ParseArgsObjv\fR(\fIinterp, argTable, objcPtr, objv, remObjv\fR) -.SH ARGUMENTS -.AS "const Tcl_ArgvInfo" ***remObjv in/out -.AP Tcl_Interp *interp out -Where to store error messages. -.AP "const Tcl_ArgvInfo" *argTable in -Pointer to array of option descriptors. -.AP int *objcPtr in/out -A pointer to variable holding number of arguments in \fIobjv\fR. Will be -modified to hold number of arguments left in the unprocessed argument list -stored in \fIremObjv\fR. -.AP "Tcl_Obj *const" *objv in -The array of arguments to be parsed. -.AP Tcl_Obj ***remObjv out -Pointer to a variable that will hold the array of unprocessed arguments. -Should be NULL if no return of unprocessed arguments is required. If -\fIobjcPtr\fR is updated to a non-zero value, the array returned through this -must be deallocated using \fBckfree\fR. -.BE -.SH DESCRIPTION -.PP -The \fBTcl_ParseArgsObjv\fR function provides a system for parsing argument -lists of the form -.QW "\fB\-someName \fIsomeValue\fR ..." . -Such argument lists are commonly found both in the arguments to a program and -in the arguments to an individual Tcl command. This parser assumes that the -order of the arguments does not matter, other than in so far as later copies -of a duplicated option overriding earlier ones. -.PP -The argument array is described by the \fIobjcPtr\fR and \fIobjv\fR -parameters, and an array of unprocessed arguments is returned through the -\fIobjcPtr\fR and \fIremObjv\fR parameters; if no return of unprocessed -arguments is desired, the \fIremObjv\fR parameter should be NULL. If any -problems happen, including if the -.QW "generate help" -option is selected, an error message is left in the interpreter result and -TCL_ERROR is returned. Otherwise, the interpreter result is left unchanged and -TCL_OK is returned. -.PP -The collection of arguments to be parsed is described by the \fIargTable\fR -parameter. This points to a table of descriptor structures that is terminated -by an entry with the \fItype\fR field set to TCL_ARGV_END. As convenience, the -following prototypical entries are provided: -.TP -\fBTCL_ARGV_AUTO_HELP\fR -. -Enables the argument processor to provide help when passed the argument -.QW \fB\-help\fR . -.TP -\fBTCL_ARGV_AUTO_REST\fR -. -Instructs the argument processor that arguments after -.QW \fB\-\-\fR -are to be unprocessed. -.TP -\fBTCL_ARGV_TABLE_END\fR -. -Marks the end of the table of argument descriptors. -.SS "ARGUMENT DESCRIPTOR ENTRIES" -.PP -Each entry of the argument descriptor table must be a structure of type -\fBTcl_ArgvInfo\fR. The structure is defined as this: -.PP -.CS -typedef struct { - int \fItype\fR; - const char *\fIkeyStr\fR; - void *\fIsrcPtr\fR; - void *\fIdstPtr\fR; - const char *\fIhelpStr\fR; - ClientData \fIclientData\fR; -} \fBTcl_ArgvInfo\fR; -.CE -.PP -The \fIkeyStr\fR field contains the name of the option; by convention, this -will normally begin with a -.QW \fB\-\fR -character. The \fItype\fR, \fIsrcPtr\fR, \fIdstPtr\fR and \fIclientData\fR -fields describe the interpretation of the value of the argument, as described -below. The \fIhelpStr\fR field gives some text that is used to provide help to -users when they request it. -.PP -As noted above, the \fItype\fR field is used to describe the interpretation of -the argument's value. The following values are acceptable values for -\fItype\fR: -.TP -\fBTCL_ARGV_CONSTANT\fR -. -The argument does not take any following value argument. If this argument is -present, the int pointed to by the \fIsrcPtr\fR field is copied to the -\fIdstPtr\fR field. The \fIclientData\fR field is ignored. -.TP -\fBTCL_ARGV_END\fR -. -This value marks the end of all option descriptors in the table. All other -fields are ignored. -.TP -\fBTCL_ARGV_FLOAT\fR -. -This argument takes a following floating point value argument. The value (once -parsed by \fBTcl_GetDoubleFromObj\fR) will be stored as a double-precision -value in the variable pointed to by the \fIdstPtr\fR field. The \fIsrcPtr\fR -and \fIclientData\fR fields are ignored. -.TP -\fBTCL_ARGV_FUNC\fR -. -This argument optionally takes a following value argument; it is up to the -handler callback function passed in \fIsrcPtr\fR to decide. That function will -have the following signature: -.RS -.PP -.CS -typedef int (\fBTcl_ArgvFuncProc\fR)( - ClientData \fIclientData\fR, - Tcl_Obj *\fIobjPtr\fR, - void *\fIdstPtr\fR); -.CE -.PP -The result is a boolean value indicating whether to consume the following -argument. The \fIclientData\fR is the value from the table entry, the -\fIobjPtr\fR is the value that represents the following argument or NULL if -there are no following arguments at all, and the \fIdstPtr\fR argument to the -\fBTcl_ArgvFuncProc\fR is the location to write the parsed value to. -.RE -.TP -\fBTCL_ARGV_GENFUNC\fR -. -This argument takes zero or more following arguments; the handler callback -function passed in \fIsrcPtr\fR returns how many (or a negative number to -signal an error, in which case it should also set the interpreter result). The -function will have the following signature: -.RS -.PP -.CS -typedef int (\fBTcl_ArgvGenFuncProc\fR)( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR, - int \fIobjc\fR, - Tcl_Obj *const *\fIobjv\fR, - void *\fIdstPtr\fR); -.CE -.PP -The \fIclientData\fR is the value from the table entry, the \fIinterp\fR is -where to store any error messages, the \fIkeyStr\fR is the name of the -argument, \fIobjc\fR and \fIobjv\fR describe an array of all the remaining -arguments, and \fIdstPtr\fR argument to the \fBTcl_ArgvGenFuncProc\fR is the -location to write the parsed value (or values) to. -.RE -.TP -\fBTCL_ARGV_HELP\fR -. -This special argument does not take any following value argument, but instead -causes \fBTcl_ParseArgsObjv\fR to generate an error message describing the -arguments supported. All other fields except the \fIhelpStr\fR field are -ignored. -.TP -\fBTCL_ARGV_INT\fR -. -This argument takes a following integer value argument. The value (once parsed -by \fBTcl_GetIntFromObj\fR) will be stored as an int in the variable pointed -to by the \fIdstPtr\fR field. The \fIsrcPtr\fR field is ignored. -.TP -\fBTCL_ARGV_REST\fR -. -This special argument does not take any following value argument, but instead -marks all following arguments to be left unprocessed. The \fIsrcPtr\fR, -\fIdstPtr\fR and \fIclientData\fR fields are ignored. -.TP -\fBTCL_ARGV_STRING\fR -. -This argument takes a following string value argument. A pointer to the string -will be stored at \fIdstPtr\fR; the string inside will have a lifetime linked -to the lifetime of the string representation of the argument value that it -came from, and so should be copied if it needs to be retained. The -\fIsrcPtr\fR and \fIclientData\fR fields are ignored. -.SH "SEE ALSO" -Tcl_GetIndexFromObj(3), Tcl_Main(3), Tcl_CreateObjCommand(3) -.SH KEYWORDS -argument, parse -'\" Local Variables: -'\" fill-column: 78 -'\" End: diff --git a/doc/ParseCmd.3 b/doc/ParseCmd.3 deleted file mode 100644 index 667d697..0000000 --- a/doc/ParseCmd.3 +++ /dev/null @@ -1,467 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_ParseCommand 3 8.3 Tcl "Tcl Library Procedures" -.so man.macros -.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 \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 -\fI*parsePtr\fR is uninitialized; any information in it is ignored. -This argument is normally 0. -.AP Tcl_Parse *parsePtr out -Points to structure to fill in with information about the parsed -command, expression, variable name, etc. -Any previous information in this structure -is ignored, unless \fIappend\fR is non-zero in a call to -\fBTcl_ParseBraces\fR, \fBTcl_ParseQuotedString\fR, -or \fBTcl_ParseVarName\fR. -.AP "const char" **termPtr out -If not NULL, points to a location where -\fBTcl_ParseBraces\fR, \fBTcl_ParseQuotedString\fR, and -\fBTcl_ParseVar\fR will store a pointer to the character -just after the terminating character (the close-brace, the last -character of the variable name, or the close-quote (respectively)) -if the parse was successful. -.AP Tcl_Parse *usedParsePtr in -Points to structure that was filled in by a previous call to -\fBTcl_ParseCommand\fR, \fBTcl_ParseExpr\fR, \fBTcl_ParseVarName\fR, etc. -.BE -.SH DESCRIPTION -.PP -These procedures parse Tcl commands or portions of Tcl commands such as -expressions or references to variables. -Each procedure takes a pointer to a script (or portion thereof) -and fills in the structure pointed to by \fIparsePtr\fR -with a collection of tokens describing the information that was parsed. -The procedures normally return \fBTCL_OK\fR. -However, if an error occurs then they return \fBTCL_ERROR\fR, -leave an error message in \fIinterp\fR's result -(if \fIinterp\fR is not NULL), -and leave nothing in \fIparsePtr\fR. -.PP -\fBTcl_ParseCommand\fR is a procedure that parses Tcl -scripts. Given a pointer to a script, it -parses the first command from the script. If the command was parsed -successfully, \fBTcl_ParseCommand\fR returns \fBTCL_OK\fR and fills in the -structure pointed to by \fIparsePtr\fR with information about the -structure of the command (see below for details). -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_ParseExpr\fR parses Tcl expressions. -Given a pointer to a script containing an expression, -\fBTcl_ParseExpr\fR parses the expression. -If the expression was parsed successfully, -\fBTcl_ParseExpr\fR returns \fBTCL_OK\fR and fills in the -structure pointed to by \fIparsePtr\fR with information about the -structure of the expression (see below for details). -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 \et with \et 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\N'34'\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\N'34'\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 is not -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, -\fBTcl_ParseQuotedString\fR, and \fBTcl_ParseVarName\fR -may include dynamically allocated memory. -If these five parsing procedures return \fBTCL_OK\fR -then the caller must invoke \fBTcl_FreeParse\fR to release -the storage at \fI*parsePtr\fR. -These procedures ignore any existing information in -\fI*parsePtr\fR (unless \fIappend\fR is non-zero), -so if repeated calls are being made to any of them -then \fBTcl_FreeParse\fR must be invoked once after each call. -.PP -\fBTcl_EvalTokensStandard\fR evaluates a sequence of parse tokens from -a Tcl_Parse structure. The tokens typically consist -of all the tokens in a word or all the tokens that make up the index for -a reference to an array variable. \fBTcl_EvalTokensStandard\fR performs the -substitutions requested by the tokens and concatenates the -resulting values. -The return value from \fBTcl_EvalTokensStandard\fR is a Tcl completion -code with one of the values \fBTCL_OK\fR, \fBTCL_ERROR\fR, -\fBTCL_RETURN\fR, \fBTCL_BREAK\fR, or \fBTCL_CONTINUE\fR, or possibly -some other integer value originating in an extension. -In addition, a result value or error message is left in \fIinterp\fR's -result; it can be retrieved using \fBTcl_GetObjResult\fR. -.PP -\fBTcl_EvalTokens\fR differs from \fBTcl_EvalTokensStandard\fR only in -the return convention used: it returns the result in a new Tcl_Obj. -The reference count of the value returned as result has been -incremented, so the caller must -invoke \fBTcl_DecrRefCount\fR when it is finished with the value. -If an error or other exception occurs while evaluating the tokens -(such as a reference to a non-existent variable) then the return value -is NULL and an error message is left in \fIinterp\fR's result. The use -of \fBTcl_EvalTokens\fR is deprecated. -.SH "TCL_PARSE STRUCTURE" -.PP -\fBTcl_ParseCommand\fR, \fBTcl_ParseExpr\fR, \fBTcl_ParseBraces\fR, -\fBTcl_ParseQuotedString\fR, and \fBTcl_ParseVarName\fR -return parse information in two data structures, Tcl_Parse and Tcl_Token: -.PP -.CS -typedef struct Tcl_Parse { - const char *\fIcommentStart\fR; - int \fIcommentSize\fR; - const char *\fIcommandStart\fR; - int \fIcommandSize\fR; - int \fInumWords\fR; - Tcl_Token *\fItokenPtr\fR; - int \fInumTokens\fR; - ... -} \fBTcl_Parse\fR; - -typedef struct Tcl_Token { - int \fItype\fR; - const char *\fIstart\fR; - int \fIsize\fR; - int \fInumComponents\fR; -} \fBTcl_Token\fR; -.CE -.PP -The first five fields of a Tcl_Parse structure -are filled in only by \fBTcl_ParseCommand\fR. -These fields are not used by the other parsing procedures. -.PP -\fBTcl_ParseCommand\fR fills in a Tcl_Parse structure -with information that describes one Tcl command and any comments that -precede the command. -If there are comments, -the \fIcommentStart\fR field points to the \fB#\fR character that begins -the first comment and \fIcommentSize\fR indicates the number of bytes -in all of the comments preceding the command, including the newline -character that terminates the last comment. -If the command is not preceded by any comments, \fIcommentSize\fR is 0. -\fBTcl_ParseCommand\fR also sets the \fIcommandStart\fR field -to point to the first character of the first -word in the command (skipping any comments and leading space) and -\fIcommandSize\fR gives the total number of bytes in the command, -including the character pointed to by \fIcommandStart\fR up to and -including the newline, close bracket, or semicolon character that -terminates the command. The \fInumWords\fR field gives the -total number of words in the command. -.PP -All parsing procedures set the remaining fields, -\fItokenPtr\fR and \fInumTokens\fR. -The \fItokenPtr\fR field points to the first in an array of Tcl_Token -structures that describe the components of the entity being parsed. -The \fInumTokens\fR field gives the total number of tokens -present in the array. -Each token contains four fields. -The \fItype\fR field selects one of several token types -that are described below. The \fIstart\fR field -points to the first character in the token and the \fIsize\fR field -gives the total number of characters in the token. Some token types, -such as \fBTCL_TOKEN_WORD\fR and \fBTCL_TOKEN_VARIABLE\fR, consist of -several component tokens, which immediately follow the parent token; -the \fInumComponents\fR field describes how many of these there are. -The \fItype\fR field has one of the following values: -.TP 20 -\fBTCL_TOKEN_WORD\fR -. -This token ordinarily describes one word of a command -but it may also describe a quoted or braced string in an expression. -The token describes a component of the script that is -the result of concatenating together a sequence of subcomponents, -each described by a separate subtoken. -The token starts with the first non-blank -character of the component (which may be a double-quote or open brace) -and includes all characters in the component up to but not including the -space, semicolon, close bracket, close quote, or close brace that -terminates the component. The \fInumComponents\fR field counts the total -number of sub-tokens that make up the word, including sub-tokens -of \fBTCL_TOKEN_VARIABLE\fR and \fBTCL_TOKEN_BS\fR tokens. -.TP -\fBTCL_TOKEN_SIMPLE_WORD\fR -. -This token has the same meaning as \fBTCL_TOKEN_WORD\fR, except that -the word is guaranteed to consist of a single \fBTCL_TOKEN_TEXT\fR -sub-token. The \fInumComponents\fR field is always 1. -.TP -\fBTCL_TOKEN_EXPAND_WORD\fR -. -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{*}\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. -.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. -The \fInumComponents\fR field is always 0. -.TP -\fBTCL_TOKEN_COMMAND\fR -. -The token describes a command whose result must be substituted into -the word. The token includes the square brackets that surround the -command. The \fInumComponents\fR field is always 0 (the nested command -is not parsed; call \fBTcl_ParseCommand\fR recursively if you want to -see its tokens). -.TP -\fBTCL_TOKEN_VARIABLE\fR -. -The token describes a variable substitution, including the -\fB$\fR, variable name, and array index (if there is one) up through the -close parenthesis that terminates the index. This token is followed -by one or more additional tokens that describe the variable name and -array index. If \fInumComponents\fR is 1 then the variable is a -scalar and the next token is a \fBTCL_TOKEN_TEXT\fR token that gives the -variable name. If \fInumComponents\fR is greater than 1 then the -variable is an array: the first sub-token is a \fBTCL_TOKEN_TEXT\fR -token giving the array name and the remaining sub-tokens are -\fBTCL_TOKEN_TEXT\fR, \fBTCL_TOKEN_BS\fR, \fBTCL_TOKEN_COMMAND\fR, and -\fBTCL_TOKEN_VARIABLE\fR tokens that must be concatenated to produce the -array index. The \fInumComponents\fR field includes nested sub-tokens -that are part of \fBTCL_TOKEN_VARIABLE\fR tokens in the array index. -.TP -\fBTCL_TOKEN_SUB_EXPR\fR -. -The token describes one subexpression of an expression -(or an entire expression). -A subexpression may consist of a value -such as an integer literal, variable substitution, -or parenthesized subexpression; -it may also consist of an operator and its operands. -The token starts with the first non-blank character of the subexpression -up to but not including the space, brace, close-paren, or bracket -that terminates the subexpression. -This token is followed by one or more additional tokens -that describe the subexpression. -If the first sub-token after the \fBTCL_TOKEN_SUB_EXPR\fR token -is a \fBTCL_TOKEN_OPERATOR\fR token, -the subexpression consists of an operator and its token operands. -If the operator has no operands, the subexpression consists of -just the \fBTCL_TOKEN_OPERATOR\fR token. -Each operand is described by a \fBTCL_TOKEN_SUB_EXPR\fR token. -Otherwise, the subexpression is a value described by -one of the token types \fBTCL_TOKEN_WORD\fR, \fBTCL_TOKEN_TEXT\fR, -\fBTCL_TOKEN_BS\fR, \fBTCL_TOKEN_COMMAND\fR, -\fBTCL_TOKEN_VARIABLE\fR, and \fBTCL_TOKEN_SUB_EXPR\fR. -The \fInumComponents\fR field -counts the total number of sub-tokens that make up the subexpression; -this includes the sub-tokens for any nested \fBTCL_TOKEN_SUB_EXPR\fR tokens. -.TP -\fBTCL_TOKEN_OPERATOR\fR -. -The token describes one operator of an expression -such as \fB&&\fR or \fBhypot\fR. -A \fBTCL_TOKEN_OPERATOR\fR token is always preceded by a -\fBTCL_TOKEN_SUB_EXPR\fR token -that describes the operator and its operands; -the \fBTCL_TOKEN_SUB_EXPR\fR token's \fInumComponents\fR field -can be used to determine the number of operands. -A binary operator such as \fB*\fR -is followed by two \fBTCL_TOKEN_SUB_EXPR\fR tokens -that describe its operands. -A unary operator like \fB\-\fR -is followed by a single \fBTCL_TOKEN_SUB_EXPR\fR token -for its operand. -If the operator is a math function such as \fBlog10\fR, -the \fBTCL_TOKEN_OPERATOR\fR token will give its name and -the following \fBTCL_TOKEN_SUB_EXPR\fR tokens will describe -its operands; -if there are no operands (as with \fBrand\fR), -no \fBTCL_TOKEN_SUB_EXPR\fR tokens follow. -There is one trinary operator, \fB?\fR, -that appears in if-then-else subexpressions -such as \fIx\fB?\fIy\fB:\fIz\fR; -in this case, the \fB?\fR \fBTCL_TOKEN_OPERATOR\fR token -is followed by three \fBTCL_TOKEN_SUB_EXPR\fR tokens for the operands -\fIx\fR, \fIy\fR, and \fIz\fR. -The \fInumComponents\fR field for a \fBTCL_TOKEN_OPERATOR\fR token -is always 0. -.PP -After \fBTcl_ParseCommand\fR returns, the first token pointed to by -the \fItokenPtr\fR field of the -Tcl_Parse structure always has type \fBTCL_TOKEN_WORD\fR or -\fBTCL_TOKEN_SIMPLE_WORD\fR or \fBTCL_TOKEN_EXPAND_WORD\fR. -It is followed by the sub-tokens -that must be concatenated to produce the value of that word. -The next token is the \fBTCL_TOKEN_WORD\fR or \fBTCL_TOKEN_SIMPLE_WORD\fR -of \fBTCL_TOKEN_EXPAND_WORD\fR token for the second word, -followed by sub-tokens for that -word, and so on until all \fInumWords\fR have been accounted -for. -.PP -After \fBTcl_ParseExpr\fR returns, the first token pointed to by -the \fItokenPtr\fR field of the -Tcl_Parse structure always has type \fBTCL_TOKEN_SUB_EXPR\fR. -It is followed by the sub-tokens that must be evaluated -to produce the value of the expression. -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 -by \fBTcl_ParseExpr\fR. -.PP -After \fBTcl_ParseBraces\fR returns, -the array of tokens pointed to by the \fItokenPtr\fR field of the -Tcl_Parse structure will contain a single \fBTCL_TOKEN_TEXT\fR token -if the braced string does not contain any backslash-newlines. -If the string does contain backslash-newlines, -the array of tokens will contain one or more -\fBTCL_TOKEN_TEXT\fR or \fBTCL_TOKEN_BS\fR sub-tokens -that must be concatenated to produce the value of the string. -If the braced string was just \fB{}\fR -(that is, the string was empty), -the single \fBTCL_TOKEN_TEXT\fR token will have a \fIsize\fR field -containing zero; -this ensures that at least one token appears -to describe the braced string. -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 -by \fBTcl_ParseBraces\fR. -.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 diff --git a/doc/PkgRequire.3 b/doc/PkgRequire.3 deleted file mode 100644 index 71f3acf..0000000 --- a/doc/PkgRequire.3 +++ /dev/null @@ -1,97 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_PkgRequire 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_PkgRequire, Tcl_PkgRequireEx, Tcl_PkgRequireProc, Tcl_PkgPresent, Tcl_PkgPresentEx, Tcl_PkgProvide, Tcl_PkgProvideEx \- package version control -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -const char * -\fBTcl_PkgRequire\fR(\fIinterp, name, version, exact\fR) -.sp -const char * -\fBTcl_PkgRequireEx\fR(\fIinterp, name, version, exact, clientDataPtr\fR) -.sp -int -\fBTcl_PkgRequireProc\fR(\fIinterp, name, objc, objv, clientDataPtr\fR) -.sp -const char * -\fBTcl_PkgPresent\fR(\fIinterp, name, version, exact\fR) -.sp -const char * -\fBTcl_PkgPresentEx\fR(\fIinterp, name, version, exact, clientDataPtr\fR) -.sp -int -\fBTcl_PkgProvide\fR(\fIinterp, name, version\fR) -.sp -int -\fBTcl_PkgProvideEx\fR(\fIinterp, name, version, clientData\fR) -.SH ARGUMENTS -.AS void *clientDataPtr out -.AP Tcl_Interp *interp in -Interpreter where package is needed or available. -.AP "const char" *name in -Name of package. -.AP "const char" *version in -A version string consisting of one or more decimal numbers -separated by dots. -.AP int exact in -Non-zero means that only the particular version specified by -\fIversion\fR is acceptable. -Zero means that newer versions than \fIversion\fR are also -acceptable as long as they have the same major version number -as \fIversion\fR. -.AP "const void" *clientData in -Arbitrary value to be associated with the package. -.AP void *clientDataPtr out -Pointer to place to store the value associated with the matching -package. It is only changed if the pointer is not NULL and the -function completed successfully. The storage can be any pointer -type with the same size as a void pointer. -.AP int objc in -Number of requirements. -.AP Tcl_Obj* objv[] in -Array of requirements. -.BE -.SH DESCRIPTION -.PP -These procedures provide C-level interfaces to Tcl's package and -version management facilities. -.PP -\fBTcl_PkgRequire\fR is equivalent to the \fBpackage require\fR -command, \fBTcl_PkgPresent\fR is equivalent to the \fBpackage present\fR -command, and \fBTcl_PkgProvide\fR is equivalent to the -\fBpackage provide\fR command. -.PP -See the documentation for the Tcl commands for details on what these -procedures do. -.PP -If \fBTcl_PkgPresent\fR or \fBTcl_PkgRequire\fR complete successfully -they return a pointer to the version string for the version of the package -that is provided in the interpreter (which may be different than -\fIversion\fR); if an error occurs they return NULL and leave an error -message in the interpreter's result. -.PP -\fBTcl_PkgProvide\fR returns \fBTCL_OK\fR if it completes successfully; -if an error occurs it returns \fBTCL_ERROR\fR and leaves an error message -in the interpreter's result. -.PP -\fBTcl_PkgProvideEx\fR, \fBTcl_PkgPresentEx\fR and \fBTcl_PkgRequireEx\fR -allow the setting and retrieving of the client data associated with -the package. In all other respects they are equivalent to the matching -functions. -.PP -\fBTcl_PkgRequireProc\fR is the form of \fBpackage require\fR handling -multiple requirements. The other forms are present for backward -compatibility and translate their invocations to this form. -.SH KEYWORDS -package, present, provide, require, version -.SH "SEE ALSO" -package(n), Tcl_StaticPackage(3) diff --git a/doc/Preserve.3 b/doc/Preserve.3 deleted file mode 100644 index c8f34a2..0000000 --- a/doc/Preserve.3 +++ /dev/null @@ -1,110 +0,0 @@ -'\" -'\" Copyright (c) 1990 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. -'\" -.TH Tcl_Preserve 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_Preserve, Tcl_Release, Tcl_EventuallyFree \- avoid freeing storage while it is being used -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_Preserve\fR(\fIclientData\fR) -.sp -\fBTcl_Release\fR(\fIclientData\fR) -.sp -\fBTcl_EventuallyFree\fR(\fIclientData, freeProc\fR) -.SH ARGUMENTS -.AS Tcl_FreeProc clientData -.AP ClientData clientData in -Token describing structure to be freed or reallocated. Usually a pointer -to memory for structure. -.AP Tcl_FreeProc *freeProc in -Procedure to invoke to free \fIclientData\fR. -.BE -.SH DESCRIPTION -.PP -These three procedures help implement a simple reference count mechanism -for managing storage. They are designed to solve a problem -having to do with widget deletion, but are also useful in many other -situations. When a widget is deleted, its -widget record (the structure holding information specific to the -widget) must be returned to the storage allocator. -However, it is possible that the widget record is in active use -by one of the procedures on the stack at the time of the deletion. -This can happen, for example, if the command associated with a button -widget causes the button to be destroyed: an X event causes an -event-handling C procedure in the button to be invoked, which in -turn causes the button's associated Tcl command to be executed, -which in turn causes the button to be deleted, which in turn causes -the button's widget record to be de-allocated. -Unfortunately, when the Tcl command returns, the button's -event-handling procedure will need to reference the -button's widget record. -Because of this, the widget record must not be freed as part of the -deletion, but must be retained until the event-handling procedure has -finished with it. -In other situations where the widget is deleted, it may be possible -to free the widget record immediately. -.PP -\fBTcl_Preserve\fR and \fBTcl_Release\fR -implement short-term reference counts for their \fIclientData\fR -argument. -The \fIclientData\fR argument identifies an object and usually -consists of the address of a structure. -The reference counts guarantee that an object will not be freed -until each call to \fBTcl_Preserve\fR for the object has been -matched by calls to \fBTcl_Release\fR. -There may be any number of unmatched \fBTcl_Preserve\fR calls -in effect at once. -.PP -\fBTcl_EventuallyFree\fR is invoked to free up its \fIclientData\fR -argument. -It checks to see if there are unmatched \fBTcl_Preserve\fR calls -for the object. -If not, then \fBTcl_EventuallyFree\fR calls \fIfreeProc\fR immediately. -Otherwise \fBTcl_EventuallyFree\fR records the fact that \fIclientData\fR -needs eventually to be freed. -When all calls to \fBTcl_Preserve\fR have been matched with -calls to \fBTcl_Release\fR then \fIfreeProc\fR will be called by -\fBTcl_Release\fR to do the cleanup. -.PP -All the work of freeing the object is carried out by \fIfreeProc\fR. -\fIFreeProc\fR must have arguments and result that match the -type \fBTcl_FreeProc\fR: -.PP -.CS -typedef void \fBTcl_FreeProc\fR( - char *\fIblockPtr\fR); -.CE -.PP -The \fIblockPtr\fR argument to \fIfreeProc\fR will be the -same as the \fIclientData\fR argument to \fBTcl_EventuallyFree\fR. -The type of \fIblockPtr\fR (\fBchar *\fR) is different than the type of the -\fIclientData\fR argument to \fBTcl_EventuallyFree\fR for historical -reasons, but the value is the same. -.PP -When the \fIclientData\fR argument to \fBTcl_EventuallyFree\fR -refers to storage allocated and returned by a prior call to -\fBTcl_Alloc\fR, \fBckalloc\fR, or another function of the Tcl library, -then the \fIfreeProc\fR argument should be given the special value of -\fBTCL_DYNAMIC\fR. -.PP -This mechanism can be used to solve the problem described above -by placing \fBTcl_Preserve\fR and \fBTcl_Release\fR calls around -actions that may cause undesired storage re-allocation. The -mechanism is intended only for short-term use (i.e. while procedures -are pending on the stack); it will not work efficiently as a -mechanism for long-term reference counts. -The implementation does not depend in any way on the internal -structure of the objects being freed; it keeps the reference -counts in a separate structure. -.SH "SEE ALSO" -Tcl_Interp, Tcl_Alloc -.SH KEYWORDS -free, reference count, storage diff --git a/doc/PrintDbl.3 b/doc/PrintDbl.3 deleted file mode 100644 index 896b6eb..0000000 --- a/doc/PrintDbl.3 +++ /dev/null @@ -1,51 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_PrintDouble 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_PrintDouble \- Convert floating value to string -.SH SYNOPSIS -.nf -\fB#include \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 -.QW . -or an -.QW e -so that it does not look like an integer. Where \fB%g\fR would -generate an integer with no decimal point, \fBTcl_PrintDouble\fR adds -.QW .0 . -.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. -.SH KEYWORDS -conversion, double-precision, floating-point, string diff --git a/doc/RecEvalObj.3 b/doc/RecEvalObj.3 deleted file mode 100644 index f9550a2..0000000 --- a/doc/RecEvalObj.3 +++ /dev/null @@ -1,51 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_RecordAndEvalObj 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_RecordAndEvalObj \- save command on history list before evaluating -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_RecordAndEvalObj\fR(\fIinterp, cmdPtr, flags\fR) -.SH ARGUMENTS -.AS Tcl_Interp *interp -.AP Tcl_Interp *interp in -Tcl interpreter in which to evaluate command. -.AP Tcl_Obj *cmdPtr in -Points to a Tcl value containing a command (or sequence of commands) -to execute. -.AP int flags in -An OR'ed combination of flag bits. \fBTCL_NO_EVAL\fR means record the -command but do not evaluate it. \fBTCL_EVAL_GLOBAL\fR means evaluate -the command at global level instead of the current stack level. -.BE - -.SH DESCRIPTION -.PP -\fBTcl_RecordAndEvalObj\fR is invoked to record a command as an event -on the history list and then execute it using \fBTcl_EvalObjEx\fR -It returns a completion code such as \fBTCL_OK\fR just like \fBTcl_EvalObjEx\fR, -as well as a result value containing additional information -(a result value or error message) -that can be retrieved using \fBTcl_GetObjResult\fR. -If you do not want the command recorded on the history list then -you should invoke \fBTcl_EvalObjEx\fR instead of \fBTcl_RecordAndEvalObj\fR. -Normally \fBTcl_RecordAndEvalObj\fR is only called with top-level -commands typed by the user, since the purpose of history is to -allow the user to re-issue recently invoked commands. -If the \fIflags\fR argument contains the \fBTCL_NO_EVAL\fR bit then -the command is recorded without being evaluated. - -.SH "SEE ALSO" -Tcl_EvalObjEx, Tcl_GetObjResult - -.SH KEYWORDS -command, event, execute, history, interpreter, value, record diff --git a/doc/RecordEval.3 b/doc/RecordEval.3 deleted file mode 100644 index 36ef6b9..0000000 --- a/doc/RecordEval.3 +++ /dev/null @@ -1,55 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_RecordAndEval 3 7.4 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_RecordAndEval \- save command on history list before evaluating -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_RecordAndEval\fR(\fIinterp, cmd, flags\fR) -.SH ARGUMENTS -.AS Tcl_Interp *interp -.AP Tcl_Interp *interp in -Tcl interpreter in which to evaluate command. -.AP "const char" *cmd in -Command (or sequence of commands) to execute. -.AP int flags in -An OR'ed combination of flag bits. \fBTCL_NO_EVAL\fR means record the -command but do not evaluate it. \fBTCL_EVAL_GLOBAL\fR means evaluate -the command at global level instead of the current stack level. -.BE - -.SH DESCRIPTION -.PP -\fBTcl_RecordAndEval\fR is invoked to record a command as an event -on the history list and then execute it using \fBTcl_Eval\fR -(or \fBTcl_GlobalEval\fR if the \fBTCL_EVAL_GLOBAL\fR bit is set in \fIflags\fR). -It returns a completion code such as \fBTCL_OK\fR just like \fBTcl_Eval\fR -and it leaves information in the interpreter's result. -If you do not want the command recorded on the history list then -you should invoke \fBTcl_Eval\fR instead of \fBTcl_RecordAndEval\fR. -Normally \fBTcl_RecordAndEval\fR is only called with top-level -commands typed by the user, since the purpose of history is to -allow the user to re-issue recently-invoked commands. -If the \fIflags\fR argument contains the \fBTCL_NO_EVAL\fR bit then -the command is recorded without being evaluated. -.PP -Note that \fBTcl_RecordAndEval\fR has been largely replaced by the -value-based procedure \fBTcl_RecordAndEvalObj\fR. -That value-based procedure records and optionally executes -a command held in a Tcl value instead of a string. - -.SH "SEE ALSO" -Tcl_RecordAndEvalObj - -.SH KEYWORDS -command, event, execute, history, interpreter, record diff --git a/doc/RegConfig.3 b/doc/RegConfig.3 deleted file mode 100644 index d73e3d7..0000000 --- a/doc/RegConfig.3 +++ /dev/null @@ -1,111 +0,0 @@ -'\" -'\" Copyright (c) 2002 Andreas Kupries -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Tcl_RegisterConfig 3 8.4 Tcl "Tcl Library Procedures" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_RegisterConfig \- procedures to register embedded configuration information -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -void -\fBTcl_RegisterConfig\fR(\fIinterp, pkgName, configuration, valEncoding\fR) -.sp -.SH ARGUMENTS -.AS Tcl_Interp *configuration -.AP Tcl_Interp *interp in -Refers to the interpreter the embedded configuration information is -registered for. Must not be NULL. -.AP "const char" *pkgName in -Contains the name of the package registering the embedded -configuration as ASCII string. This means that this information is in -UTF-8 too. Must not be NULL. -.AP "const Tcl_Config" *configuration in -Refers to an array of Tcl_Config entries containing the information -embedded in the binary library. Must not be NULL. The end of the array -is signaled by either a key identical to NULL, or a key referring to -the empty string. -.AP "const char" *valEncoding in -Contains the name of the encoding used to store the configuration -values as ASCII string. This means that this information is in UTF-8 -too. Must not be NULL. -.BE -.SH DESCRIPTION -.PP -The function described here has its base in TIP 59 and provides -extensions with support for the embedding of configuration -information into their binary library and the generation of a -Tcl-level interface for querying this information. -.PP -To embed configuration information into their binary library an -extension has to define a non-volatile array of Tcl_Config entries in -one if its source files and then call \fBTcl_RegisterConfig\fR to -register that information. -.PP -\fBTcl_RegisterConfig\fR takes four arguments; first, a reference to -the interpreter we are registering the information with, second, the -name of the package registering its configuration information, third, -a pointer to an array of structures, and fourth a string declaring the -encoding used by the configuration values. -.PP -The string \fIvalEncoding\fR contains the name of an encoding known to -Tcl. All these names are use only characters in the ASCII subset of -UTF-8 and are thus implicitly in the UTF-8 encoding. It is expected -that keys are legible English text and therefore using the ASCII -subset of UTF-8. In other words, they are expected to be in UTF-8 -too. The values associated with the keys can be any string -however. For these the contents of \fIvalEncoding\fR define which -encoding was used to represent the characters of the strings. -.PP -Each element of the \fIconfiguration\fR array refers to two strings -containing the key and the value associated with that key. The end of -the array is signaled by either an empty key or a key identical to -NULL. The function makes \fBno\fR copy of the \fIconfiguration\fR -array. This means that the caller has to make sure that the memory -holding this array is never released. This is the meaning behind the -word \fBnon-volatile\fR used earlier. The easiest way to accomplish -this is to define a global static array of Tcl_Config entries. See the file -.QW generic/tclPkgConfig.c -in the sources of the Tcl core for an example. -.PP -When called \fBTcl_RegisterConfig\fR will -.IP (1) -create a namespace having the provided \fIpkgName\fR, if not yet -existing. -.IP (2) -create the command \fBpkgconfig\fR in that namespace and link it to -the provided information so that the keys from \fIconfiguration\fR and -their associated values can be retrieved through calls to -\fBpkgconfig\fR. -.PP -The command \fBpkgconfig\fR will provide two subcommands, \fBlist\fR -and \fBget\fR: -.RS -.TP -::\fIpkgName\fR::\fBpkgconfig\fR list -Returns a list containing the names of all defined keys. -.TP -::\fIpkgName\fR::\fBpkgconfig\fR get \fIkey\fR -Returns the configuration value associated with the specified -\fIkey\fR. -.RE -.SH TCL_CONFIG -.PP -The \fBTcl_Config\fR structure contains the following fields: -.PP -.CS -typedef struct Tcl_Config { - const char *\fIkey\fR; - const char *\fIvalue\fR; -} \fBTcl_Config\fR; -.CE -.\" No cross references yet. -.\" .SH "SEE ALSO" -.SH KEYWORDS -embedding, configuration, binary library diff --git a/doc/RegExp.3 b/doc/RegExp.3 deleted file mode 100644 index aa757bc..0000000 --- a/doc/RegExp.3 +++ /dev/null @@ -1,383 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_RegExpMatch 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.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 \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) -.fi -.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 value from which to get the text to search. The -internal representation of the value may be converted to a form that -can be efficiently searched. -.AP Tcl_Obj *patObj in/out -Refers to the value from which to get a regular expression. The -compiled regular expression is cached in the value. -.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 is not the same as \fItext\fR, then no -.QW \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 the compilation flags \fBTCL_REG_ADVANCED\fR, -\fBTCL_REG_EXTENDED\fR, \fBTCL_REG_BASIC\fR, \fBTCL_REG_EXPANDED\fR, -\fBTCL_REG_QUOTE\fR, \fBTCL_REG_NOCASE\fR, \fBTCL_REG_NEWLINE\fR, -\fBTCL_REG_NLSTOP\fR, \fBTCL_REG_NLANCH\fR, \fBTCL_REG_NOSUB\fR, and -\fBTCL_REG_CANMATCH\fR. 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 -value will be taken as the maximum number of subexpressions to -remember. -.AP int eflags in -OR-ed combination of the execution flags \fBTCL_REG_NOTBOL\fR and -\fBTCL_REG_NOTEOL\fR. See below for more information. -.AP Tcl_RegExpInfo *infoPtr out -The address of the location where information about a previous match -should be stored by \fBTcl_RegExpGetInfo\fR. -.BE -.SH DESCRIPTION -.PP -\fBTcl_RegExpMatch\fR determines whether its \fIpattern\fR argument -matches \fIregexp\fR, where \fIregexp\fR is interpreted -as a regular expression using the rules in the \fBre_syntax\fR -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 values \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 does not allow -.QW \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. -\fIIndex\fR indicates which of several ranges is desired: -if \fIindex\fR is 0, information is returned about the overall range -of characters that matched the entire pattern; otherwise, -information is returned about the range of characters that matched the -\fIindex\fR'th parenthesized subexpression within the pattern. -If there is no range corresponding to \fIindex\fR then NULL -is stored in \fI*startPtr\fR and \fI*endPtr\fR. -.PP -\fBTcl_GetRegExpFromObj\fR, \fBTcl_RegExpExecObj\fR, and -\fBTcl_RegExpGetInfo\fR are value interfaces that provide the most -direct control of Henry Spencer's regular expression library. For -users that need to modify compilation and execution options directly, -it is recommended that you use these interfaces instead of calling the -internal regexp functions. These interfaces handle the details of UTF -to Unicode translations as well as providing improved performance -through caching in the pattern and string values. -.PP -\fBTcl_GetRegExpFromObj\fR attempts to return a compiled regular -expression from the \fIpatObj\fR. If the value does not already -contain a compiled regular expression it will attempt to create one -from the string in the value and assign it to the internal -representation of the \fIpatObj\fR. The return value of this function -is of type \fBTcl_RegExp\fR. The return value is a token for this -compiled form, which can be used in subsequent calls to -\fBTcl_RegExpExecObj\fR or \fBTcl_RegExpGetInfo\fR. If an error -occurs while compiling the regular expression then -\fBTcl_GetRegExpFromObj\fR returns NULL and leaves an error message in -the interpreter result. The regular expression token can be used as -long as the internal representation of \fIpatObj\fR refers to the -compiled form. The \fIcflags\fR argument is a bit-wise OR of -zero or more of the following flags that control the compilation of -\fIpatObj\fR: -.RS 2 -.TP -\fBTCL_REG_ADVANCED\fR -Compile advanced regular expressions -.PQ ARE s . -This mode corresponds to -the normal regular expression syntax accepted by the Tcl \fBregexp\fR and -\fBregsub\fR commands. -.TP -\fBTCL_REG_EXTENDED\fR -Compile extended regular expressions -.PQ ERE s . -This mode corresponds -to the regular expression syntax recognized by Tcl 8.0 and earlier -versions. -.TP -\fBTCL_REG_BASIC\fR -Compile basic regular expressions -.PQ BRE s . -This mode corresponds -to the regular expression syntax recognized by common Unix utilities -like \fBsed\fR and \fBgrep\fR. This is the default if no flags are -specified. -.TP -\fBTCL_REG_EXPANDED\fR -Compile the regular expression (basic, extended, or advanced) using an -expanded syntax that allows comments and whitespace. This mode causes -non-backslashed non-bracket-expression white -space and #-to-end-of-line comments to be ignored. -.TP -\fBTCL_REG_QUOTE\fR -Compile a literal string, with all characters treated as ordinary characters. -.TP -\fBTCL_REG_NOCASE\fR -Compile for matching that ignores upper/lower case distinctions. -.TP -\fBTCL_REG_NEWLINE\fR -Compile for newline-sensitive matching. By default, newline is a -completely ordinary character with no special meaning in either -regular expressions or strings. With this flag, -.QW [^ -bracket expressions and -.QW . -never match newline, -.QW ^ -matches an empty string -after any newline in addition to its normal function, and -.QW $ -matches -an empty string before any newline in addition to its normal function. -\fBREG_NEWLINE\fR is the bit-wise OR of \fBREG_NLSTOP\fR and -\fBREG_NLANCH\fR. -.TP -\fBTCL_REG_NLSTOP\fR -Compile for partial newline-sensitive matching, -with the behavior of -.QW [^ -bracket expressions and -.QW . -affected, but not the behavior of -.QW ^ -and -.QW $ . -In this mode, -.QW [^ -bracket expressions and -.QW . -never match newline. -.TP -\fBTCL_REG_NLANCH\fR -Compile for inverse partial newline-sensitive matching, -with the behavior of -.QW ^ -and -.QW $ -(the -.QW anchors ) -affected, but not the behavior of -.QW [^ -bracket expressions and -.QW . . -In this mode -.QW ^ -matches an empty string -after any newline in addition to its normal function, and -.QW $ -matches -an empty string before any newline in addition to its normal function. -.TP -\fBTCL_REG_NOSUB\fR -Compile for matching that reports only success or failure, -not what was matched. This reduces compile overhead and may improve -performance. Subsequent calls to \fBTcl_RegExpGetInfo\fR or -\fBTcl_RegExpRange\fR will not report any match information. -.TP -\fBTCL_REG_CANMATCH\fR -Compile for matching that reports the potential to complete a partial -match given more text (see below). -.RE -.PP -Only one of -\fBTCL_REG_EXTENDED\fR, -\fBTCL_REG_ADVANCED\fR, -\fBTCL_REG_BASIC\fR, and -\fBTCL_REG_QUOTE\fR may be specified. -.PP -\fBTcl_RegExpExecObj\fR executes the regular expression pattern -matcher. It returns 1 if \fIobjPtr\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_RegExpExecObj\fR leaves an -error message in the interpreter result. The \fInmatches\fR value -indicates to the matcher how many subexpressions are of interest. If -\fInmatches\fR is 0, then no subexpression match information is -recorded, which may allow the matcher to make various optimizations. -If the value is \-1, then all of the subexpressions in the pattern are -remembered. If the value is a positive integer, then only that number -of subexpressions will be remembered. Matching begins at the -specified Unicode character index given by \fIoffset\fR. Unlike -\fBTcl_RegExpExec\fR, the behavior of anchors is not affected by the -offset value. Instead the behavior of the anchors is explicitly -controlled by the \fIeflags\fR argument, which is a bit-wise OR of -zero or more of the following flags: -.RS 2 -.TP -\fBTCL_REG_NOTBOL\fR -The starting character will not be treated as the beginning of a -line or the beginning of the string, so -.QW ^ -will not match there. -Note that this flag has no effect on how -.QW \fB\eA\fR -matches. -.TP -\fBTCL_REG_NOTEOL\fR -The last character in the string will not be treated as the end of a -line or the end of the string, so -.QW $ -will not match there. -Note that this flag has no effect on how -.QW \fB\eZ\fR -matches. -.RE -.PP -\fBTcl_RegExpGetInfo\fR retrieves information about the last match -performed with a given regular expression \fIregexp\fR. The -\fIinfoPtr\fR argument contains a pointer to a structure that is -defined as follows: -.PP -.CS -typedef struct Tcl_RegExpInfo { - int \fInsubs\fR; - Tcl_RegExpIndices *\fImatches\fR; - long \fIextendStart\fR; -} \fBTcl_RegExpInfo\fR; -.CE -.PP -The \fInsubs\fR field contains a count of the number of parenthesized -subexpressions within the regular expression. If the \fBTCL_REG_NOSUB\fR -was used, then this value will be zero. The \fImatches\fR field -points to an array of \fInsubs\fR+1 values that indicate the bounds of each -subexpression matched. The first element in the array refers to the -range matched by the entire regular expression, and subsequent elements -refer to the parenthesized subexpressions in the order that they -appear in the pattern. Each element is a structure that is defined as -follows: -.PP -.CS -typedef struct Tcl_RegExpIndices { - long \fIstart\fR; - long \fIend\fR; -} \fBTcl_RegExpIndices\fR; -.CE -.PP -The \fIstart\fR and \fIend\fR values are Unicode character indices -relative to the offset location within \fIobjPtr\fR where matching began. -The \fIstart\fR index identifies the first character of the matched -subexpression. The \fIend\fR index identifies the first character -after the matched subexpression. If the subexpression matched the -empty string, then \fIstart\fR and \fIend\fR will be equal. If the -subexpression did not participate in the match, then \fIstart\fR and -\fIend\fR will be set to \-1. -.PP -The \fIextendStart\fR field in \fBTcl_RegExpInfo\fR is only set if the -\fBTCL_REG_CANMATCH\fR flag was used. It indicates the first -character in the string where a match could occur. If a match was -found, this will be the same as the beginning of the current match. -If no match was found, then it indicates the earliest point at which a -match might occur if additional text is appended to the string. If it -is no match is possible even with further text, this field will be set -to \-1. -.SH "SEE ALSO" -re_syntax(n) -.SH KEYWORDS -match, pattern, regular expression, string, subexpression, Tcl_RegExpIndices, Tcl_RegExpInfo diff --git a/doc/SaveResult.3 b/doc/SaveResult.3 deleted file mode 100644 index 6dd6cb6..0000000 --- a/doc/SaveResult.3 +++ /dev/null @@ -1,120 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_SaveResult 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_SaveInterpState, Tcl_RestoreInterpState, Tcl_DiscardInterpState, Tcl_SaveResult, Tcl_RestoreResult, Tcl_DiscardResult \- save and restore an interpreter's state -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_InterpState -\fBTcl_SaveInterpState\fR(\fIinterp, status\fR) -.sp -int -\fBTcl_RestoreInterpState\fR(\fIinterp, state\fR) -.sp -\fBTcl_DiscardInterpState\fR(\fIstate\fR) -.sp -\fBTcl_SaveResult\fR(\fIinterp, savedPtr\fR) -.sp -\fBTcl_RestoreResult\fR(\fIinterp, savedPtr\fR) -.sp -\fBTcl_DiscardResult\fR(\fIsavedPtr\fR) -.SH ARGUMENTS -.AS Tcl_InterpState savedPtr -.AP Tcl_Interp *interp in -Interpreter for which state should be saved. -.AP int status in -Return code value to save as part of interpreter state. -.AP Tcl_InterpState state in -Saved state token to be restored or discarded. -.AP Tcl_SavedResult *savedPtr in -Pointer to location where interpreter result should be saved or restored. -.BE -.SH DESCRIPTION -.PP -These routines allows a C procedure to take a snapshot of the current -state of an interpreter so that it can be restored after a call -to \fBTcl_Eval\fR or some other routine that modifies the interpreter -state. There are two triplets of routines meant to work together. -.PP -The first triplet stores the snapshot of interpreter state in -an opaque token returned by \fBTcl_SaveInterpState\fR. That token -value may then be passed back to one of \fBTcl_RestoreInterpState\fR -or \fBTcl_DiscardInterpState\fR, depending on whether the interp -state is to be restored. So long as one of the latter two routines -is called, Tcl will take care of memory management. -.PP -The second triplet stores the snapshot of only the interpreter -result (not its complete state) in memory allocated by the caller. -These routines are passed a pointer to \fBTcl_SavedResult\fR -that is used to store enough information to restore the interpreter result. -\fBTcl_SavedResult\fR can be allocated on the stack of the calling -procedure. These routines do not save the state of any error -information in the interpreter (e.g. the \fB\-errorcode\fR or -\fB\-errorinfo\fR return options, when an error is in progress). -.PP -Because the routines \fBTcl_SaveInterpState\fR, -\fBTcl_RestoreInterpState\fR, and \fBTcl_DiscardInterpState\fR perform -a superset of the functions provided by the other routines, -any new code should only make use of the more powerful routines. -The older, weaker routines \fBTcl_SaveResult\fR, \fBTcl_RestoreResult\fR, -and \fBTcl_DiscardResult\fR continue to exist only for the sake -of existing programs that may already be using them. -.PP -\fBTcl_SaveInterpState\fR takes a snapshot of those portions of -interpreter state that make up the full result of script evaluation. -This include the interpreter result, the return code (passed in -as the \fIstatus\fR argument, and any return options, including -\fB\-errorinfo\fR and \fB\-errorcode\fR when an error is in progress. -This snapshot is returned as an opaque token of type \fBTcl_InterpState\fR. -The call to \fBTcl_SaveInterpState\fR does not itself change the -state of the interpreter. Unlike \fBTcl_SaveResult\fR, it does -not reset the interpreter. -.PP -\fBTcl_RestoreInterpState\fR accepts a \fBTcl_InterpState\fR token -previously returned by \fBTcl_SaveInterpState\fR and restores the -state of the interp to the state held in that snapshot. The return -value of \fBTcl_RestoreInterpState\fR is the status value originally -passed to \fBTcl_SaveInterpState\fR when the snapshot token was -created. -.PP -\fBTcl_DiscardInterpState\fR is called to release a \fBTcl_InterpState\fR -token previously returned by \fBTcl_SaveInterpState\fR when that -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. -.PP -\fBTcl_SaveResult\fR moves the string and value 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 value results from -\fIstatePtr\fR back into \fIinterp\fR. Any result or error that was -already in the interpreter will be cleared. The \fIstatePtr\fR is left -in an uninitialized state and cannot be used until another call to -\fBTcl_SaveResult\fR. -.PP -\fBTcl_DiscardResult\fR releases the saved interpreter state -stored at \fBstatePtr\fR. The state structure is left in an -uninitialized state and cannot be used until another call to -\fBTcl_SaveResult\fR. -.PP -Once \fBTcl_SaveResult\fR is called to save the interpreter -result, either \fBTcl_RestoreResult\fR or -\fBTcl_DiscardResult\fR must be called to properly clean up the -memory associated with the saved state. -.SH KEYWORDS -result, state, interp diff --git a/doc/SetChanErr.3 b/doc/SetChanErr.3 deleted file mode 100644 index 5bb86be..0000000 --- a/doc/SetChanErr.3 +++ /dev/null @@ -1,140 +0,0 @@ -'\" -'\" Copyright (c) 2005 Andreas Kupries -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Tcl_SetChannelError 3 8.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_SetChannelError, Tcl_SetChannelErrorInterp, Tcl_GetChannelError, Tcl_GetChannelErrorInterp \- functions to create/intercept Tcl errors by channel drivers. -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -void -\fBTcl_SetChannelError\fR(\fIchan, msg\fR) -.sp -void -\fBTcl_SetChannelErrorInterp\fR(\fIinterp, msg\fR) -.sp -void -\fBTcl_GetChannelError\fR(\fIchan, msgPtr\fR) -.sp -void -\fBTcl_GetChannelErrorInterp\fR(\fIinterp, msgPtr\fR) -.sp -.SH ARGUMENTS -.AS Tcl_Channel chan -.AP Tcl_Channel chan in -Refers to the Tcl channel whose bypass area is accessed. -.AP Tcl_Interp* interp in -Refers to the Tcl interpreter whose bypass area is accessed. -.AP Tcl_Obj* msg in -Error message put into a bypass area. A list of return options and values, -followed by a string message. Both message and the option/value information -are optional. -.AP Tcl_Obj** msgPtr out -Reference to a place where the message stored in the accessed bypass area can -be stored in. -.BE -.SH DESCRIPTION -.PP -The current definition of a Tcl channel driver does not permit the direct -return of arbitrary error messages, except for the setting and retrieval of -channel options. All other functions are restricted to POSIX error codes. -.PP -The functions described here overcome this limitation. Channel drivers are -allowed to use \fBTcl_SetChannelError\fR and \fBTcl_SetChannelErrorInterp\fR -to place arbitrary error messages in \fBbypass areas\fR defined for channels -and interpreters. And the generic I/O layer uses \fBTcl_GetChannelError\fR and -\fBTcl_GetChannelErrorInterp\fR to look for messages in the bypass areas and -arrange for their return as errors. The POSIX error codes set by a driver are -used now if and only if no messages are present. -.PP -\fBTcl_SetChannelError\fR stores error information in the bypass area of the -specified channel. The number of references to the \fBmsg\fR value goes up by -one. Previously stored information will be discarded, by releasing the -reference held by the channel. The channel reference must not be NULL. -.PP -\fBTcl_SetChannelErrorInterp\fR stores error information in the bypass area of -the specified interpreter. The number of references to the \fBmsg\fR value -goes up by one. Previously stored information will be discarded, by releasing -the reference held by the interpreter. The interpreter reference must not be -NULL. -.PP -\fBTcl_GetChannelError\fR places either the error message held in the bypass -area of the specified channel into \fImsgPtr\fR, or NULL; and resets the -bypass, that is, after an invocation all following invocations will return -NULL, until an intervening invocation of \fBTcl_SetChannelError\fR with a -non-NULL message. The \fImsgPtr\fR must not be NULL. The reference count of -the message is not touched. The reference previously held by the channel is -now held by the caller of the function and it is its responsibility to release -that reference when it is done with the value. -.PP -\fBTcl_GetChannelErrorInterp\fR places either the error message held in the -bypass area of the specified interpreter into \fImsgPtr\fR, or NULL; and -resets the bypass, that is, after an invocation all following invocations will -return NULL, until an intervening invocation of -\fBTcl_SetChannelErrorInterp\fR with a non-NULL message. The \fImsgPtr\fR must -not be NULL. The reference count of the message is not touched. The reference -previously held by the interpreter is now held by the caller of the function -and it is its responsibility to release that reference when it is done with -the value. -.PP -Which functions of a channel driver are allowed to use which bypass function -is listed below, as is which functions of the public channel API may leave a -messages in the bypass areas. -.IP \fBTcl_DriverCloseProc\fR -May use \fBTcl_SetChannelErrorInterp\fR, and only this function. -.IP \fBTcl_DriverInputProc\fR -May use \fBTcl_SetChannelError\fR, and only this function. -.IP \fBTcl_DriverOutputProc\fR -May use \fBTcl_SetChannelError\fR, and only this function. -.IP \fBTcl_DriverSeekProc\fR -May use \fBTcl_SetChannelError\fR, and only this function. -.IP \fBTcl_DriverWideSeekProc\fR -May use \fBTcl_SetChannelError\fR, and only this function. -.IP \fBTcl_DriverSetOptionProc\fR -Has already the ability to pass arbitrary error messages. Must \fInot\fR use -any of the new functions. -.IP \fBTcl_DriverGetOptionProc\fR -Has already the ability to pass arbitrary error messages. Must -\fInot\fR use any of the new functions. -.IP \fBTcl_DriverWatchProc\fR -Must \fInot\fR use any of the new functions. Is internally called and has no -ability to return any type of error whatsoever. -.IP \fBTcl_DriverBlockModeProc\fR -May use \fBTcl_SetChannelError\fR, and only this function. -.IP \fBTcl_DriverGetHandleProc\fR -Must \fInot\fR use any of the new functions. It is only a low-level function, -and not used by Tcl commands. -.IP \fBTcl_DriverHandlerProc\fR -Must \fInot\fR use any of the new functions. Is internally called and has no -ability to return any type of error whatsoever. -.PP -Given the information above the following public functions of the Tcl C API -are affected by these changes; when these functions are called, the channel -may now contain a stored arbitrary error message requiring processing by the -caller. -.DS -.ta 1.9i 4i -\fBTcl_Flush\fR \fBTcl_GetsObj\fR \fBTcl_Gets\fR -\fBTcl_ReadChars\fR \fBTcl_ReadRaw\fR \fBTcl_Read\fR -\fBTcl_Seek\fR \fBTcl_StackChannel\fR \fBTcl_Tell\fR -\fBTcl_WriteChars\fR \fBTcl_WriteObj\fR \fBTcl_WriteRaw\fR -\fBTcl_Write\fR -.DE -.PP -All other API functions are unchanged. In particular, the functions below -leave all their error information in the interpreter result. -.DS -.ta 1.9i 4i -\fBTcl_Close\fR \fBTcl_UnstackChannel\fR \fBTcl_UnregisterChannel\fR -.DE -.SH "SEE ALSO" -Tcl_Close(3), Tcl_OpenFileChannel(3), Tcl_SetErrno(3) -.SH KEYWORDS -channel driver, error messages, channel type diff --git a/doc/SetErrno.3 b/doc/SetErrno.3 deleted file mode 100644 index c202e2e..0000000 --- a/doc/SetErrno.3 +++ /dev/null @@ -1,66 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_SetErrno 3 8.3 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_SetErrno, Tcl_GetErrno, Tcl_ErrnoId, Tcl_ErrnoMsg \- manipulate errno to store and retrieve error codes -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -void -\fBTcl_SetErrno\fR(\fIerrorCode\fR) -.sp -int -\fBTcl_GetErrno\fR() -.sp -const char * -\fBTcl_ErrnoId\fR() -.sp -const char * -\fBTcl_ErrnoMsg\fR(\fIerrorCode\fR) -.sp -.SH ARGUMENTS -.AS int errorCode -.AP int errorCode in -A POSIX error code such as \fBENOENT\fR. -.BE - -.SH DESCRIPTION -.PP -\fBTcl_SetErrno\fR and \fBTcl_GetErrno\fR provide portable access -to the \fBerrno\fR variable, which is used to record a POSIX error -code after system calls and other operations such as \fBTcl_Gets\fR. -These procedures are necessary because global variable accesses cannot -be made across module boundaries on some platforms. -.PP -\fBTcl_SetErrno\fR sets the \fBerrno\fR variable to the value of the -\fIerrorCode\fR argument -C procedures that wish to return error information to their callers -via \fBerrno\fR should call \fBTcl_SetErrno\fR rather than setting -\fBerrno\fR directly. -.PP -\fBTcl_GetErrno\fR returns the current value of \fBerrno\fR. -Procedures wishing to access \fBerrno\fR should call this procedure -instead of accessing \fBerrno\fR directly. -.PP -\fBTcl_ErrnoId\fR and \fBTcl_ErrnoMsg\fR return string -representations of \fBerrno\fR values. \fBTcl_ErrnoId\fR -returns a machine-readable textual identifier such as -.QW EACCES -that corresponds to the current value of \fBerrno\fR. -\fBTcl_ErrnoMsg\fR returns a human-readable string such as -.QW "permission denied" -that corresponds to the value of its -\fIerrorCode\fR argument. The \fIerrorCode\fR argument is -typically the value returned by \fBTcl_GetErrno\fR. -The strings returned by these functions are -statically allocated and the caller must not free or modify them. - -.SH KEYWORDS -errno, error code, global variables diff --git a/doc/SetRecLmt.3 b/doc/SetRecLmt.3 deleted file mode 100644 index ec55794..0000000 --- a/doc/SetRecLmt.3 +++ /dev/null @@ -1,53 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_SetRecursionLimit 3 7.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_SetRecursionLimit \- set maximum allowable nesting depth in interpreter -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_SetRecursionLimit\fR(\fIinterp, depth\fR) -.SH ARGUMENTS -.AS Tcl_Interp *interp -.AP Tcl_Interp *interp in -Interpreter whose recursion limit is to be set. -Must be greater than zero. -.AP int depth in -New limit for nested calls to \fBTcl_Eval\fR for \fIinterp\fR. -.BE - -.SH DESCRIPTION -.PP -At any given time Tcl enforces a limit on the number of recursive -calls that may be active for \fBTcl_Eval\fR and related procedures -such as \fBTcl_GlobalEval\fR. -Any call to \fBTcl_Eval\fR that exceeds this depth is aborted with -an error. -By default the recursion limit is 1000. -.PP -\fBTcl_SetRecursionLimit\fR may be used to change the maximum -allowable nesting depth for an interpreter. -The \fIdepth\fR argument specifies a new limit for \fIinterp\fR, -and \fBTcl_SetRecursionLimit\fR returns the old limit. -To read out the old limit without modifying it, invoke -\fBTcl_SetRecursionLimit\fR with \fIdepth\fR equal to 0. -.PP -The \fBTcl_SetRecursionLimit\fR only sets the size of the Tcl -call stack: it cannot by itself prevent stack overflows on the -C stack being used by the application. If your machine has a -limit on the size of the C stack, you may get stack overflows -before reaching the limit set by \fBTcl_SetRecursionLimit\fR. -If this happens, see if there is a mechanism in your system for -increasing the maximum size of the C stack. - -.SH KEYWORDS -nesting depth, recursion diff --git a/doc/SetResult.3 b/doc/SetResult.3 deleted file mode 100644 index e5b81d7..0000000 --- a/doc/SetResult.3 +++ /dev/null @@ -1,255 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_SetResult 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_SetObjResult, Tcl_GetObjResult, Tcl_SetResult, Tcl_GetStringResult, Tcl_AppendResult, Tcl_AppendResultVA, Tcl_AppendElement, Tcl_ResetResult, Tcl_TransferResult, Tcl_FreeResult \- manipulate Tcl result -.SH SYNOPSIS -.nf -\fB#include \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_ResetResult\fR(\fIinterp\fR) -.sp -.VS 8.6 -\fBTcl_TransferResult\fR(\fIsourceInterp, result, targetInterp\fR) -.VE 8.6 -.sp -\fBTcl_AppendElement\fR(\fIinterp, element\fR) -.sp -\fBTcl_FreeResult\fR(\fIinterp\fR) -.SH ARGUMENTS -.AS Tcl_FreeProc sourceInterp out -.AP Tcl_Interp *interp out -Interpreter whose result is to be modified or read. -.AP Tcl_Obj *objPtr in -Tcl 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 "const 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 -\fBva_start\fR, and cleared using \fBva_end\fR. -.AP Tcl_Interp *sourceInterp in -.VS 8.6 -Interpreter that the result and error information should be copied from. -.VE 8.6 -.AP Tcl_Interp *targetInterp in -.VS 8.6 -Interpreter that the result and error information should be copied to. -.VE 8.6 -.AP int result in -.VS 8.6 -If \fBTCL_OK\fR, only copy the result. If \fBTCL_ERROR\fR, copy the error -information as well. -.VE 8.6 -.BE -.SH DESCRIPTION -.PP -The procedures described here are utilities for manipulating the -result value in a Tcl interpreter. -The interpreter result may be either a Tcl value or a string. -For example, \fBTcl_SetObjResult\fR and \fBTcl_SetResult\fR -set the interpreter result to, respectively, a value and a string. -Similarly, \fBTcl_GetObjResult\fR and \fBTcl_GetStringResult\fR -return the interpreter result as a value and as a string. -The procedures always keep the string and value forms -of the interpreter result consistent. -For example, if \fBTcl_SetObjResult\fR is called to set -the result to a value, -then \fBTcl_GetStringResult\fR is called, -it will return the value's string representation. -.PP -\fBTcl_SetObjResult\fR -arranges for \fIobjPtr\fR to be the result for \fIinterp\fR, -replacing any existing result. -The result is left pointing to the value -referenced by \fIobjPtr\fR. -\fIobjPtr\fR's reference count is incremented -since there is now a new reference to it from \fIinterp\fR. -The reference count for any old result value -is decremented and the old result value is freed if no -references to it remain. -.PP -\fBTcl_GetObjResult\fR returns the result for \fIinterp\fR as a value. -The value's reference count is not incremented; -if the caller needs to retain a long-term pointer to the value -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 a value by a \fBTcl_SetObjResult\fR call, -the value form will be converted to a string and returned. -If the value'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 value 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 a value, -its reference count is decremented and the result is left -pointing to an unshared value 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-compatibility 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. -.PP -.VS 8.6 -\fBTcl_TransferResult\fR moves a result from one interpreter to another, -optionally (dependent on the \fIresult\fR parameter) including the error -information dictionary as well. The interpreters must be in the same thread. -The source interpreter will have its result reset by this operation. -.VE 8.6 -.SH "DEPRECATED INTERFACES" -.SS "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 a value -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 -.QW { , -or ends in the characters -.QW " {" ) -then no space is added. -.PP -\fBTcl_FreeResult\fR performs part of the work -of \fBTcl_ResetResult\fR. -It frees up the memory associated with \fIinterp\fR's result. -It also sets \fIinterp->freeProc\fR to zero, but does not -change \fIinterp->result\fR or clear error state. -\fBTcl_FreeResult\fR is most commonly used when a procedure -is about to replace one result value with another. -.SS "DIRECT ACCESS TO INTERP->RESULT" -.PP -It used to be legal for programs to -directly read and write \fIinterp->result\fR -to manipulate the interpreter result. The Tcl headers no longer -permit this access by default, and C code still doing this must -be updated to use supported routines \fBTcl_GetObjResult\fR, -\fBTcl_GetStringResult\fR, \fBTcl_SetObjResult\fR, and \fBTcl_SetResult\fR. -As a migration aid, access can be restored with the compiler directive -.CS -#define USE_INTERP_RESULT -.CE -but this is meant only to offer life support to otherwise dead code. -.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 is not 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: -.PP -.CS -typedef void \fBTcl_FreeProc\fR( - char *\fIblockPtr\fR); -.CE -.PP -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, value, result, return value, interpreter diff --git a/doc/SetVar.3 b/doc/SetVar.3 deleted file mode 100644 index 4aa671a..0000000 --- a/doc/SetVar.3 +++ /dev/null @@ -1,249 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_SetVar 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_SetVar2Ex, Tcl_SetVar, Tcl_SetVar2, Tcl_ObjSetVar2, Tcl_GetVar2Ex, Tcl_GetVar, Tcl_GetVar2, Tcl_ObjGetVar2, Tcl_UnsetVar, Tcl_UnsetVar2 \- manipulate Tcl variables -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Obj * -\fBTcl_SetVar2Ex\fR(\fIinterp, name1, name2, newValuePtr, flags\fR) -.sp -const char * -\fBTcl_SetVar\fR(\fIinterp, varName, newValue, flags\fR) -.sp -const char * -\fBTcl_SetVar2\fR(\fIinterp, name1, name2, newValue, flags\fR) -.sp -Tcl_Obj * -\fBTcl_ObjSetVar2\fR(\fIinterp, part1Ptr, part2Ptr, newValuePtr, flags\fR) -.sp -Tcl_Obj * -\fBTcl_GetVar2Ex\fR(\fIinterp, name1, name2, flags\fR) -.sp -const char * -\fBTcl_GetVar\fR(\fIinterp, varName, flags\fR) -.sp -const char * -\fBTcl_GetVar2\fR(\fIinterp, name1, name2, flags\fR) -.sp -Tcl_Obj * -\fBTcl_ObjGetVar2\fR(\fIinterp, part1Ptr, part2Ptr, flags\fR) -.sp -int -\fBTcl_UnsetVar\fR(\fIinterp, varName, flags\fR) -.sp -int -\fBTcl_UnsetVar2\fR(\fIinterp, name1, name2, flags\fR) -.SH ARGUMENTS -.AS Tcl_Interp *newValuePtr -.AP Tcl_Interp *interp in -Interpreter containing variable. -.AP "const char" *name1 in -Contains the name of an array variable (if \fIname2\fR is non-NULL) -or (if \fIname2\fR is NULL) either the name of a scalar variable -or a complete name including both variable name and index. -May include \fB::\fR namespace qualifiers -to specify a variable in a particular namespace. -.AP "const char" *name2 in -If non-NULL, gives name of element within array; in this -case \fIname1\fR must refer to an array variable. -.AP Tcl_Obj *newValuePtr in -Points to a Tcl value containing the new value for the variable. -.AP int flags in -OR-ed combination of bits providing additional information. See below -for valid values. -.AP "const char" *varName in -Name of variable. -May include \fB::\fR namespace qualifiers -to specify a variable in a particular namespace. -May refer to a scalar variable or an element of -an array. -.AP "const char" *newValue in -New value for variable, specified as a null-terminated string. -A copy of this value is stored in the variable. -.AP Tcl_Obj *part1Ptr in -Points to a Tcl value containing the variable's name. -The name may include a series of \fB::\fR namespace qualifiers -to specify a variable in a particular namespace. -May refer to a scalar variable or an element of an array variable. -.AP Tcl_Obj *part2Ptr in -If non-NULL, points to a value containing the name of an element -within an array and \fIpart1Ptr\fR must refer to an array variable. -.BE - -.SH DESCRIPTION -.PP -These procedures are used to create, modify, read, and delete -Tcl variables from C code. -.PP -\fBTcl_SetVar2Ex\fR, \fBTcl_SetVar\fR, \fBTcl_SetVar2\fR, and -\fBTcl_ObjSetVar2\fR -will create a new variable or modify an existing one. -These procedures set the given variable to the value -given by \fInewValuePtr\fR or \fInewValue\fR and return a -pointer to the variable's new value, which is stored in Tcl's -variable structure. -\fBTcl_SetVar2Ex\fR and \fBTcl_ObjSetVar2\fR take the new value as a -Tcl_Obj and return -a pointer to a Tcl_Obj. \fBTcl_SetVar\fR and \fBTcl_SetVar2\fR -take the new value as a string and return a string; they are -usually less efficient than \fBTcl_ObjSetVar2\fR. Note that the -return value may be different than the \fInewValuePtr\fR or -\fInewValue\fR argument, due to modifications made by write traces. -If an error occurs in setting the variable (e.g. an array -variable is referenced without giving an index into the array) -NULL is returned and an error message is left in \fIinterp\fR's -result if the \fBTCL_LEAVE_ERR_MSG\fR \fIflag\fR bit is set. -.PP -\fBTcl_GetVar2Ex\fR, \fBTcl_GetVar\fR, \fBTcl_GetVar2\fR, and -\fBTcl_ObjGetVar2\fR -return the current value of a variable. -The arguments to these procedures are treated in the same way -as the arguments to the procedures described above. -Under normal circumstances, the return value is a pointer -to the variable's value. For \fBTcl_GetVar2Ex\fR and -\fBTcl_ObjGetVar2\fR the value is -returned as a pointer to a Tcl_Obj. For \fBTcl_GetVar\fR and -\fBTcl_GetVar2\fR the value is returned as a string; this is -usually less efficient, so \fBTcl_GetVar2Ex\fR or \fBTcl_ObjGetVar2\fR -are preferred. -If an error occurs while reading the variable (e.g. the variable -does not exist or an array element is specified for a scalar -variable), then NULL is returned and an error message is left -in \fIinterp\fR's result if the \fBTCL_LEAVE_ERR_MSG\fR \fIflag\fR -bit is set. -.PP -\fBTcl_UnsetVar\fR and \fBTcl_UnsetVar2\fR may be used to remove -a variable, so that future attempts to read the variable will return -an error. -The arguments to these procedures are treated in the same way -as the arguments to the procedures above. -If the variable is successfully removed then \fBTCL_OK\fR is returned. -If the variable cannot be removed because it does not exist then -\fBTCL_ERROR\fR is returned and an error message is left -in \fIinterp\fR's result if the \fBTCL_LEAVE_ERR_MSG\fR \fIflag\fR -bit is set. -If an array element is specified, the given element is removed -but the array remains. -If an array name is specified without an index, then the entire -array is removed. -.PP -The name of a variable may be specified to these procedures in -four ways: -.IP [1] -If \fBTcl_SetVar\fR, \fBTcl_GetVar\fR, or \fBTcl_UnsetVar\fR -is invoked, the variable name is given as -a single string, \fIvarName\fR. -If \fIvarName\fR contains an open parenthesis and ends with a -close parenthesis, then the value between the parentheses is -treated as an index (which can have any string value) and -the characters before the first open -parenthesis are treated as the name of an array variable. -If \fIvarName\fR does not have parentheses as described above, then -the entire string is treated as the name of a scalar variable. -.IP [2] -If the \fIname1\fR and \fIname2\fR arguments are provided and -\fIname2\fR is non-NULL, then an array element is specified and -the array name and index have -already been separated by the caller: \fIname1\fR contains the -name and \fIname2\fR contains the index. An error is generated -if \fIname1\fR contains an open parenthesis and ends with a -close parenthesis (array element) and \fIname2\fR is non-NULL. -.IP [3] -If \fIname2\fR is NULL, \fIname1\fR is treated just like -\fIvarName\fR in case [1] above (it can be either a scalar or an array -element variable name). -.PP -The \fIflags\fR argument may be used to specify any of several -options to the procedures. -It consists of an OR-ed combination of the following bits. -.TP -\fBTCL_GLOBAL_ONLY\fR -Under normal circumstances the procedures look up variables as follows. -If a procedure call is active in \fIinterp\fR, -the variable is looked up at the current level of procedure call. -Otherwise, the variable is looked up first in the current namespace, -then in the global namespace. -However, if this bit is set in \fIflags\fR then the variable -is looked up only in the global namespace -even if there is a procedure call active. -If both \fBTCL_GLOBAL_ONLY\fR and \fBTCL_NAMESPACE_ONLY\fR are given, -\fBTCL_GLOBAL_ONLY\fR is ignored. -.TP -\fBTCL_NAMESPACE_ONLY\fR -If this bit is set in \fIflags\fR then the variable -is looked up only in the current namespace; if a procedure is active -its variables are ignored, and the global namespace is also ignored unless -it is the current namespace. -.TP -\fBTCL_LEAVE_ERR_MSG\fR -If an error is returned and this bit is set in \fIflags\fR, then -an error message will be left in the interpreter's result, -where it can be retrieved with \fBTcl_GetObjResult\fR -or \fBTcl_GetStringResult\fR. -If this flag bit is not set then no error message is left -and the interpreter's result will not be modified. -.TP -\fBTCL_APPEND_VALUE\fR -If this bit is set then \fInewValuePtr\fR or \fInewValue\fR is -appended to the current value instead of replacing it. -If the variable is currently undefined, then the bit is ignored. -This bit is only used by the \fBTcl_Set*\fR procedures. -.TP -\fBTCL_LIST_ELEMENT\fR -If this bit is set, then \fInewValue\fR is converted to a valid -Tcl list element before setting (or appending to) the variable. -A separator space is appended before the new list element unless -the list element is going to be the first element in a list or -sublist (i.e. the variable's current value is empty, or contains -the single character -.QW { , -or ends in -.QW " }" ). -When appending, the original value of the variable must also be -a valid list, so that the operation is the appending of a new -list element onto a list. -.PP -\fBTcl_GetVar\fR and \fBTcl_GetVar2\fR -return the current value of a variable. -The arguments to these procedures are treated in the same way -as the arguments to \fBTcl_SetVar\fR and \fBTcl_SetVar2\fR. -Under normal circumstances, the return value is a pointer -to the variable's value (which is stored in Tcl's variable -structure and will not change before the next call to \fBTcl_SetVar\fR -or \fBTcl_SetVar2\fR). -\fBTcl_GetVar\fR and \fBTcl_GetVar2\fR use the flag bits \fBTCL_GLOBAL_ONLY\fR -and \fBTCL_LEAVE_ERR_MSG\fR, both of -which have -the same meaning as for \fBTcl_SetVar\fR. -If an error occurs in reading the variable (e.g. the variable -does not exist or an array element is specified for a scalar -variable), then NULL is returned. -.PP -\fBTcl_UnsetVar\fR and \fBTcl_UnsetVar2\fR may be used to remove -a variable, so that future calls to \fBTcl_GetVar\fR or \fBTcl_GetVar2\fR -for the variable will return an error. -The arguments to these procedures are treated in the same way -as the arguments to \fBTcl_GetVar\fR and \fBTcl_GetVar2\fR. -If the variable is successfully removed then \fBTCL_OK\fR is returned. -If the variable cannot be removed because it does not exist then -\fBTCL_ERROR\fR is returned. -If an array element is specified, the given element is removed -but the array remains. -If an array name is specified without an index, then the entire -array is removed. - -.SH "SEE ALSO" -Tcl_GetObjResult, Tcl_GetStringResult, Tcl_TraceVar - -.SH KEYWORDS -array, get variable, interpreter, scalar, set, unset, value, variable diff --git a/doc/Signal.3 b/doc/Signal.3 deleted file mode 100644 index 0a280f9..0000000 --- a/doc/Signal.3 +++ /dev/null @@ -1,41 +0,0 @@ -'\" -'\" Copyright (c) 2001 ActiveState Tool Corp. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Tcl_SignalId 3 8.3 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_SignalId, Tcl_SignalMsg \- Convert signal codes -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -const char * -\fBTcl_SignalId\fR(\fIsig\fR) -.sp -const char * -\fBTcl_SignalMsg\fR(\fIsig\fR) -.sp -.SH ARGUMENTS -.AS int sig -.AP int sig in -A POSIX signal number such as \fBSIGPIPE\fR. -.BE - -.SH DESCRIPTION -.PP -\fBTcl_SignalId\fR and \fBTcl_SignalMsg\fR return a string -representation of the provided signal number (\fIsig\fR). -\fBTcl_SignalId\fR returns a machine-readable textual identifier such -as -.QW SIGPIPE . -\fBTcl_SignalMsg\fR returns a human-readable string such as -.QW "bus error" . -The strings returned by these functions are -statically allocated and the caller must not free or modify them. - -.SH KEYWORDS -signals, signal numbers diff --git a/doc/Sleep.3 b/doc/Sleep.3 deleted file mode 100644 index 656d72a..0000000 --- a/doc/Sleep.3 +++ /dev/null @@ -1,34 +0,0 @@ -'\" -'\" Copyright (c) 1990 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. -'\" -.TH Tcl_Sleep 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_Sleep \- delay execution for a given number of milliseconds -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_Sleep\fR(\fIms\fR) -.SH ARGUMENTS -.AS int ms -.AP int ms in -Number of milliseconds to sleep. -.BE -.SH DESCRIPTION -.PP -This procedure delays the calling process by the number of -milliseconds given by the \fIms\fR parameter and returns -after that time has elapsed. It is typically used for things -like flashing a button, where the delay is short and the -application need not do anything while it waits. For longer -delays where the application needs to respond to other events -during the delay, the procedure \fBTcl_CreateTimerHandler\fR -should be used instead of \fBTcl_Sleep\fR. -.SH KEYWORDS -sleep, time, wait diff --git a/doc/SourceRCFile.3 b/doc/SourceRCFile.3 deleted file mode 100644 index 0afb66b..0000000 --- a/doc/SourceRCFile.3 +++ /dev/null @@ -1,32 +0,0 @@ -'\" -'\" Copyright (c) 1998-2000 by Scriptics Corporation. -'\" All rights reserved. -'\" -.TH Tcl_SourceRCFile 3 8.3 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_SourceRCFile \- source the Tcl rc file -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -void -\fBTcl_SourceRCFile\fR(\fIinterp\fR) -.SH ARGUMENTS -.AS Tcl_Interp *interp -.AP Tcl_Interp *interp in -Tcl interpreter to source rc file into. -.BE - -.SH DESCRIPTION -.PP -\fBTcl_SourceRCFile\fR is used to source the Tcl rc file at startup. -It is typically invoked by Tcl_Main or Tk_Main. The name of the file -sourced is obtained from the global variable \fBtcl_rcFileName\fR in -the interpreter given by \fIinterp\fR. If this variable is not -defined, or if the file it indicates cannot be found, no action is -taken. - -.SH KEYWORDS -application-specific initialization, main program, rc file diff --git a/doc/SplitList.3 b/doc/SplitList.3 deleted file mode 100644 index d19ca14..0000000 --- a/doc/SplitList.3 +++ /dev/null @@ -1,188 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_SplitList 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_SplitList, Tcl_Merge, Tcl_ScanElement, Tcl_ConvertElement, Tcl_ScanCountedElement, Tcl_ConvertCountedElement \- manipulate Tcl lists -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_SplitList\fR(\fIinterp, list, argcPtr, argvPtr\fR) -.sp -char * -\fBTcl_Merge\fR(\fIargc, argv\fR) -.sp -int -\fBTcl_ScanElement\fR(\fIsrc, flagsPtr\fR) -.sp -int -\fBTcl_ScanCountedElement\fR(\fIsrc, length, flagsPtr\fR) -.sp -int -\fBTcl_ConvertElement\fR(\fIsrc, dst, flags\fR) -.sp -int -\fBTcl_ConvertCountedElement\fR(\fIsrc, length, dst, flags\fR) -.SH ARGUMENTS -.AS "const char *const" ***argvPtr out -.AP Tcl_Interp *interp out -Interpreter to use for error reporting. If NULL, then no error message -is left. -.AP char *list in -Pointer to a string with proper list structure. -.AP int *argcPtr out -Filled in with number of elements in \fIlist\fR. -.AP "const char" ***argvPtr out -\fI*argvPtr\fR will be filled in with the address of an array of -pointers to the strings that are the extracted elements of \fIlist\fR. -There will be \fI*argcPtr\fR valid entries in the array, followed by -a NULL entry. -.AP int argc in -Number of elements in \fIargv\fR. -.AP "const char *const" *argv in -Array of strings to merge together into a single list. -Each string will become a separate element of the list. -.AP "const char" *src in -String that is to become an element of a list. -.AP int *flagsPtr in -Pointer to word to fill in with information about \fIsrc\fR. -The value of *\fIflagsPtr\fR must be passed to \fBTcl_ConvertElement\fR. -.AP int length in -Number of bytes in string \fIsrc\fR. -.AP char *dst in -Place to copy converted list element. Must contain enough characters -to hold converted string. -.AP int flags in -Information about \fIsrc\fR. Must be value returned by previous -call to \fBTcl_ScanElement\fR, possibly OR-ed -with \fBTCL_DONT_USE_BRACES\fR. -.BE -.SH DESCRIPTION -.PP -These procedures may be used to disassemble and reassemble Tcl lists. -\fBTcl_SplitList\fR breaks a list up into its constituent elements, -returning an array of pointers to the elements using -\fIargcPtr\fR and \fIargvPtr\fR. -While extracting the arguments, \fBTcl_SplitList\fR obeys the usual -rules for backslash substitutions and braces. The area of -memory pointed to by \fI*argvPtr\fR is dynamically allocated; in -addition to the array of pointers, it -also holds copies of all the list elements. It is the caller's -responsibility to free up all of this storage. -For example, suppose that you have called \fBTcl_SplitList\fR with -the following code: -.PP -.CS -int argc, code; -char *string; -char **argv; -\&... -code = \fBTcl_SplitList\fR(interp, string, &argc, &argv); -.CE -.PP -Then you should eventually free the storage with a call like the -following: -.PP -.CS -Tcl_Free((char *) argv); -.CE -.PP -\fBTcl_SplitList\fR normally returns \fBTCL_OK\fR, which means the list was -successfully parsed. -If there was a syntax error in \fIlist\fR, then \fBTCL_ERROR\fR is returned -and the interpreter's result will point to an error message describing the -problem (if \fIinterp\fR was not NULL). -If \fBTCL_ERROR\fR is returned then no memory is allocated and \fI*argvPtr\fR -is not modified. -.PP -\fBTcl_Merge\fR is the inverse of \fBTcl_SplitList\fR: it -takes a collection of strings given by \fIargc\fR -and \fIargv\fR and generates a result string -that has proper list structure. -This means that commands like \fBindex\fR may be used to -extract the original elements again. -In addition, if the result of \fBTcl_Merge\fR is passed to \fBTcl_Eval\fR, -it will be parsed into \fIargc\fR words whose values will -be the same as the \fIargv\fR strings passed to \fBTcl_Merge\fR. -\fBTcl_Merge\fR will modify the list elements with braces and/or -backslashes in order to produce proper Tcl list structure. -The result string is dynamically allocated -using \fBTcl_Alloc\fR; the caller must eventually release the space -using \fBTcl_Free\fR. -.PP -If the result of \fBTcl_Merge\fR is passed to \fBTcl_SplitList\fR, -the elements returned by \fBTcl_SplitList\fR will be identical to -those passed into \fBTcl_Merge\fR. -However, the converse is not true: if \fBTcl_SplitList\fR -is passed a given string, and the resulting \fIargc\fR and -\fIargv\fR are passed to \fBTcl_Merge\fR, the resulting string -may not be the same as the original string passed to \fBTcl_SplitList\fR. -This is because \fBTcl_Merge\fR may use backslashes and braces -differently than the original string. -.PP -\fBTcl_ScanElement\fR and \fBTcl_ConvertElement\fR are the -procedures that do all of the real work of \fBTcl_Merge\fR. -\fBTcl_ScanElement\fR scans its \fIsrc\fR argument -and determines how to use backslashes and braces -when converting it to a list element. -It returns an overestimate of the number of characters -required to represent \fIsrc\fR as a list element, and -it stores information in \fI*flagsPtr\fR that is needed -by \fBTcl_ConvertElement\fR. -.PP -\fBTcl_ConvertElement\fR is a companion procedure to \fBTcl_ScanElement\fR. -It does the actual work of converting a string to a list element. -Its \fIflags\fR argument must be the same as the value returned -by \fBTcl_ScanElement\fR. -\fBTcl_ConvertElement\fR writes a proper list element to memory -starting at *\fIdst\fR and returns a count of the total number -of characters written, which will be no more than the result -returned by \fBTcl_ScanElement\fR. -\fBTcl_ConvertElement\fR writes out only the actual list element -without any leading or trailing spaces: it is up to the caller to -include spaces between adjacent list elements. -.PP -\fBTcl_ConvertElement\fR uses one of two different approaches to -handle the special characters in \fIsrc\fR. Wherever possible, it -handles special characters by surrounding the string with braces. -This produces clean-looking output, but cannot be used in some situations, -such as when \fIsrc\fR contains unmatched braces. -In these situations, \fBTcl_ConvertElement\fR handles special -characters by generating backslash sequences for them. -The caller may insist on the second approach by OR-ing the -flag value returned by \fBTcl_ScanElement\fR with -\fBTCL_DONT_USE_BRACES\fR. -Although this will produce an uglier result, it is useful in some -special situations, such as when \fBTcl_ConvertElement\fR is being -used to generate a portion of an argument for a Tcl command. -In this case, surrounding \fIsrc\fR with curly braces would cause -the command not to be parsed correctly. -.PP -By default, \fBTcl_ConvertElement\fR will use quoting in its output -to be sure the first character of an element is not the hash -character -.PQ # . -This is to be sure the first element of any list -passed to \fBeval\fR is not mis-parsed as the beginning of a comment. -When a list element is not the first element of a list, this quoting -is not necessary. When the caller can be sure that the element is -not the first element of a list, it can disable quoting of the leading -hash character by OR-ing the flag value returned by \fBTcl_ScanElement\fR -with \fBTCL_DONT_QUOTE_HASH\fR. -.PP -\fBTcl_ScanCountedElement\fR and \fBTcl_ConvertCountedElement\fR are -the same as \fBTcl_ScanElement\fR and \fBTcl_ConvertElement\fR, except -the length of string \fIsrc\fR is specified by the \fIlength\fR -argument, and the string may contain embedded nulls. -.SH "SEE ALSO" -Tcl_ListObjGetElements(3) -.SH KEYWORDS -backslash, convert, element, list, merge, split, strings diff --git a/doc/SplitPath.3 b/doc/SplitPath.3 deleted file mode 100644 index c011194..0000000 --- a/doc/SplitPath.3 +++ /dev/null @@ -1,97 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_SplitPath 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_SplitPath, Tcl_JoinPath, Tcl_GetPathType \- manipulate platform-dependent file paths -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_SplitPath\fR(\fIpath, argcPtr, argvPtr\fR) -.sp -char * -\fBTcl_JoinPath\fR(\fIargc, argv, resultPtr\fR) -.sp -Tcl_PathType -\fBTcl_GetPathType\fR(\fIpath\fR) -.SH ARGUMENTS -.AS "const char *const" ***argvPtr in/out -.AP "const char" *path in -File path in a form appropriate for the current platform (see the -\fBfilename\fR manual entry for acceptable forms for path names). -.AP int *argcPtr out -Filled in with number of path elements in \fIpath\fR. -.AP "const char" ***argvPtr out -\fI*argvPtr\fR will be filled in with the address of an array of -pointers to the strings that are the extracted elements of \fIpath\fR. -There will be \fI*argcPtr\fR valid entries in the array, followed by -a NULL entry. -.AP int argc in -Number of elements in \fIargv\fR. -.AP "const char *const" *argv in -Array of path elements to merge together into a single path. -.AP Tcl_DString *resultPtr in/out -A pointer to an initialized \fBTcl_DString\fR to which the result of -\fBTcl_JoinPath\fR will be appended. -.BE - -.SH DESCRIPTION -.PP -These procedures have been superseded by the Tcl-value-aware procedures in -the \fBFileSystem\fR man page, which are more efficient. -.PP -These procedures may be used to disassemble and reassemble file -paths in a platform independent manner: they provide C-level access to -the same functionality as the \fBfile split\fR, \fBfile join\fR, and -\fBfile pathtype\fR commands. -.PP -\fBTcl_SplitPath\fR breaks a path into its constituent elements, -returning an array of pointers to the elements using \fIargcPtr\fR and -\fIargvPtr\fR. The area of memory pointed to by \fI*argvPtr\fR is -dynamically allocated; in addition to the array of pointers, it also -holds copies of all the path elements. It is the caller's -responsibility to free all of this storage. -For example, suppose that you have called \fBTcl_SplitPath\fR with the -following code: -.PP -.CS -int argc; -char *path; -char **argv; -\&... -Tcl_SplitPath(string, &argc, &argv); -.CE -.PP -Then you should eventually free the storage with a call like the -following: -.PP -.CS -Tcl_Free((char *) argv); -.CE -.PP -\fBTcl_JoinPath\fR is the inverse of \fBTcl_SplitPath\fR: it takes a -collection of path elements given by \fIargc\fR and \fIargv\fR and -generates a result string that is a properly constructed path. The -result string is appended to \fIresultPtr\fR. \fIResultPtr\fR must -refer to an initialized \fBTcl_DString\fR. -.PP -If the result of \fBTcl_SplitPath\fR is passed to \fBTcl_JoinPath\fR, -the result will refer to the same location, but may not be in the same -form. This is because \fBTcl_SplitPath\fR and \fBTcl_JoinPath\fR -eliminate duplicate path separators and return a normalized form for -each platform. -.PP -\fBTcl_GetPathType\fR returns the type of the specified \fIpath\fR, -where \fBTcl_PathType\fR is one of \fBTCL_PATH_ABSOLUTE\fR, -\fBTCL_PATH_RELATIVE\fR, or \fBTCL_PATH_VOLUME_RELATIVE\fR. See the -\fBfilename\fR manual entry for a description of the path types for -each platform. - -.SH KEYWORDS -file, filename, join, path, split, type diff --git a/doc/StaticPkg.3 b/doc/StaticPkg.3 deleted file mode 100644 index 41e2d65..0000000 --- a/doc/StaticPkg.3 +++ /dev/null @@ -1,70 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_StaticPackage 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_StaticPackage \- make a statically linked package available via the 'load' command -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_StaticPackage\fR(\fIinterp, pkgName, initProc, safeInitProc\fR) -.SH ARGUMENTS -.AS Tcl_PackageInitProc *safeInitProc -.AP Tcl_Interp *interp in -If not NULL, points to an interpreter into which the package has -already been loaded (i.e., the caller has already invoked the -appropriate initialization procedure). NULL means the package -has not yet been incorporated into any interpreter. -.AP "const char" *pkgName in -Name of the package; should be properly capitalized (first letter -upper-case, all others lower-case). -.AP Tcl_PackageInitProc *initProc in -Procedure to invoke to incorporate this package into a trusted -interpreter. -.AP Tcl_PackageInitProc *safeInitProc in -Procedure to call to incorporate this package into a safe interpreter -(one that will execute untrusted scripts). NULL means the package -cannot be used in safe interpreters. -.BE -.SH DESCRIPTION -.PP -This procedure may be invoked to announce that a package has been -linked statically with a Tcl application and, optionally, that it -has already been loaded into an interpreter. -Once \fBTcl_StaticPackage\fR has been invoked for a package, it -may be loaded into interpreters using the \fBload\fR command. -\fBTcl_StaticPackage\fR is normally invoked only by the \fBTcl_AppInit\fR -procedure for the application, not by packages for themselves -(\fBTcl_StaticPackage\fR should only be invoked for statically -loaded packages, and code in the package itself should not need -to know whether the package is dynamically or statically loaded). -.PP -When the \fBload\fR command is used later to load the package into -an interpreter, one of \fIinitProc\fR and \fIsafeInitProc\fR will -be invoked, depending on whether the target interpreter is safe -or not. -\fIinitProc\fR and \fIsafeInitProc\fR must both match the -following prototype: -.PP -.CS -typedef int \fBTcl_PackageInitProc\fR( - Tcl_Interp *\fIinterp\fR); -.CE -.PP -The \fIinterp\fR argument identifies the interpreter in which the package -is to be loaded. The initialization procedure must return \fBTCL_OK\fR or -\fBTCL_ERROR\fR to indicate whether or not it completed successfully; in -the event of an error it should set the interpreter's result to point to an -error message. The result or error from the initialization procedure will -be returned as the result of the \fBload\fR command that caused the -initialization procedure to be invoked. -.SH KEYWORDS -initialization procedure, package, static linking -.SH "SEE ALSO" -load(n), package(n), Tcl_PkgRequire(3) diff --git a/doc/StdChannels.3 b/doc/StdChannels.3 deleted file mode 100644 index 7cb75a0..0000000 --- a/doc/StdChannels.3 +++ /dev/null @@ -1,120 +0,0 @@ -'\" -'\" 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. -'\" -.TH "Standard Channels" 3 7.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_StandardChannels \- How the Tcl library deals with the standard channels -.BE - -.SH DESCRIPTION -.PP -This page explains the initialization and use of standard channels in -the Tcl library. -.PP -The term \fIstandard channels\fR comes out of the Unix world and -refers to the three channels automatically opened by the OS for -each new application. They are \fBstdin\fR, \fBstdout\fR and -\fBstderr\fR. The first is the standard input an application can read -from, the other two refer to writable channels, one for regular -output and the other for error messages. -.PP -Tcl generalizes this concept in a cross-platform way and -exposes standard channels to the script level. -.SS "APPLICATION PROGRAMMING INTERFACES" -.PP -The public API procedures dealing directly with standard channels are -\fBTcl_GetStdChannel\fR and \fBTcl_SetStdChannel\fR. Additional public -APIs to consider are \fBTcl_RegisterChannel\fR, -\fBTcl_CreateChannel\fR and \fBTcl_GetChannel\fR. -.SH "INITIALIZATION OF TCL STANDARD CHANNELS" -.PP -Standard channels are initialized by the Tcl library in three cases: -when explicitly requested, when implicitly required before returning -channel information, or when implicitly required during registration -of a new channel. -.PP -These cases differ in how they handle unavailable platform- specific -standard channels. (A channel is not -.QW available -if it could not be -successfully opened; for example, in a Tcl application run as a -Windows NT service.) -.TP -1) -A single standard channel is initialized when it is explicitly -specified in a call to \fBTcl_SetStdChannel\fR. The states of the -other standard channels are unaffected. -.RS -.PP -Missing platform-specific standard channels do not matter here. This -approach is not available at the script level. -.RE -.TP -2) -All uninitialized standard channels are initialized to -platform-specific default values: -.RS -.TP -(a) -when open channels are listed with \fBTcl_GetChannelNames\fR (or the -\fBfile channels\fR script command), or -.TP -(b) -when information about any standard channel is requested with a call -to \fBTcl_GetStdChannel\fR, or with a call to \fBTcl_GetChannel\fR -which specifies one of the standard names (\fBstdin\fR, \fBstdout\fR -and \fBstderr\fR). -.PP -In case of missing platform-specific standard channels, the Tcl -standard channels are considered as initialized and then immediately -closed. This means that the first three Tcl channels then opened by -the application are designated as the Tcl standard channels. -.RE -.TP -3) -All uninitialized standard channels are initialized to -platform-specific default values when a user-requested channel is -registered with \fBTcl_RegisterChannel\fR. -.PP -In case of unavailable platform-specific standard channels the channel -whose creation caused the initialization of the Tcl standard channels -is made a normal channel. The next three Tcl channels opened by the -application are designated as the Tcl standard channels. In other -words, of the first four Tcl channels opened by the application the -second to fourth are designated as the Tcl standard channels. -.SH "RE-INITIALIZATION OF TCL STANDARD CHANNELS" -.PP -Once a Tcl standard channel is initialized through one of the methods -above, closing this Tcl standard channel will cause the next call to -\fBTcl_CreateChannel\fR to make the new channel the new standard -channel, too. If more than one Tcl standard channel was closed -\fBTcl_CreateChannel\fR will fill the empty slots in the order -\fBstdin\fR, \fBstdout\fR and \fBstderr\fR. -.PP -\fBTcl_CreateChannel\fR will not try to reinitialize an empty slot if -that slot was not initialized before. It is this behavior which -enables an application to employ method 1 of initialization, i.e. to -create and designate their own Tcl standard channels. -.SH "SHELL-SPECIFIC DETAILS" -.SS tclsh -.PP -The Tcl shell (or rather the function \fBTcl_Main\fR, which forms the -core of the shell's implementation) uses method 2 to initialize -the standard channels. -.SS wish -.PP -The windowing shell (or rather the function \fBTk_MainEx\fR, which -forms the core of the shell's implementation) uses method 1 to -initialize the standard channels (See \fBTk_InitConsoleChannels\fR) -on non-Unix platforms. On Unix platforms, \fBTk_MainEx\fR implicitly -uses method 2 to initialize the standard channels. -.SH "SEE ALSO" -Tcl_CreateChannel(3), Tcl_RegisterChannel(3), Tcl_GetChannel(3), Tcl_GetStdChannel(3), Tcl_SetStdChannel(3), Tk_InitConsoleChannels(3), tclsh(1), wish(1), Tcl_Main(3), Tk_MainEx(3) -.SH KEYWORDS -standard channels diff --git a/doc/StrMatch.3 b/doc/StrMatch.3 deleted file mode 100644 index d664067..0000000 --- a/doc/StrMatch.3 +++ /dev/null @@ -1,49 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_StringMatch 3 8.5 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_StringMatch, Tcl_StringCaseMatch \- test whether a string matches a pattern -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_StringMatch\fR(\fIstr\fR, \fIpattern\fR) -.sp -int -\fBTcl_StringCaseMatch\fR(\fIstr\fR, \fIpattern\fR, \fIflags\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 flags in -OR-ed combination of match flags, currently only \fBTCL_MATCH_NOCASE\fR. -0 specifies a case-sensitive search. -.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 \fBstring match\fR -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 \fBTCL_MATCH_NOCASE\fR), then the string and -pattern are essentially matched in the lower case. - -.SH KEYWORDS -match, pattern, string diff --git a/doc/StringObj.3 b/doc/StringObj.3 deleted file mode 100644 index 7042cc8..0000000 --- a/doc/StringObj.3 +++ /dev/null @@ -1,387 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_StringObj 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.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_AppendObjToObj, Tcl_AppendStringsToObj, Tcl_AppendStringsToObjVA, Tcl_AppendLimitedToObj, Tcl_Format, Tcl_AppendFormatToObj, Tcl_ObjPrintf, Tcl_AppendPrintfToObj, Tcl_SetObjLength, Tcl_AttemptSetObjLength, Tcl_ConcatObj \- manipulate Tcl values as strings -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Obj * -\fBTcl_NewStringObj\fR(\fIbytes, length\fR) -.sp -Tcl_Obj * -\fBTcl_NewUnicodeObj\fR(\fIunicode, numChars\fR) -.sp -void -\fBTcl_SetStringObj\fR(\fIobjPtr, bytes, length\fR) -.sp -void -\fBTcl_SetUnicodeObj\fR(\fIobjPtr, unicode, numChars\fR) -.sp -char * -\fBTcl_GetStringFromObj\fR(\fIobjPtr, lengthPtr\fR) -.sp -char * -\fBTcl_GetString\fR(\fIobjPtr\fR) -.sp -Tcl_UniChar * -\fBTcl_GetUnicodeFromObj\fR(\fIobjPtr, lengthPtr\fR) -.sp -Tcl_UniChar * -\fBTcl_GetUnicode\fR(\fIobjPtr\fR) -.sp -Tcl_UniChar -\fBTcl_GetUniChar\fR(\fIobjPtr, index\fR) -.sp -int -\fBTcl_GetCharLength\fR(\fIobjPtr\fR) -.sp -Tcl_Obj * -\fBTcl_GetRange\fR(\fIobjPtr, first, last\fR) -.sp -void -\fBTcl_AppendToObj\fR(\fIobjPtr, bytes, length\fR) -.sp -void -\fBTcl_AppendUnicodeToObj\fR(\fIobjPtr, unicode, numChars\fR) -.sp -void -\fBTcl_AppendObjToObj\fR(\fIobjPtr, appendObjPtr\fR) -.sp -void -\fBTcl_AppendStringsToObj\fR(\fIobjPtr, string, string, ... \fB(char *) NULL\fR) -.sp -void -\fBTcl_AppendStringsToObjVA\fR(\fIobjPtr, argList\fR) -.sp -void -\fBTcl_AppendLimitedToObj\fR(\fIobjPtr, bytes, length, limit, ellipsis\fR) -.sp -Tcl_Obj * -\fBTcl_Format\fR(\fIinterp, format, objc, objv\fR) -.sp -int -\fBTcl_AppendFormatToObj\fR(\fIinterp, objPtr, format, objc, objv\fR) -.sp -Tcl_Obj * -\fBTcl_ObjPrintf\fR(\fIformat, ...\fR) -.sp -void -\fBTcl_AppendPrintfToObj\fR(\fIobjPtr, format, ...\fR) -.sp -void -\fBTcl_SetObjLength\fR(\fIobjPtr, newLength\fR) -.sp -int -\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 value. -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\e700\e600\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 value. -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 value. -This byte array may contain embedded null characters -unless \fInumChars\fR is negative. -.AP int numChars in -The number of Unicode characters to copy from \fIunicode\fR when -initializing, setting, or appending to a string value. -If negative, all characters up to the first null character are used. -.AP int index in -The index of the Unicode character to return. -.AP int first in -The index of the first Unicode character in the Unicode range to be -returned as a new value. -.AP int last in -The index of the last Unicode character in the Unicode range to be -returned as a new value. -.AP Tcl_Obj *objPtr in/out -Points to a value to manipulate. -.AP Tcl_Obj *appendObjPtr in -The value to append to \fIobjPtr\fR in \fBTcl_AppendObjToObj\fR. -.AP int *lengthPtr out -If non-NULL, the location where \fBTcl_GetStringFromObj\fR will store -the length of a value's string representation. -.AP "const char" *string in -Null-terminated string value to append to \fIobjPtr\fR. -.AP va_list argList in -An argument list which must have been initialized using -\fBva_start\fR, and cleared using \fBva_end\fR. -.AP int limit in -Maximum number of bytes to be appended. -.AP "const char" *ellipsis in -Suffix to append when the limit leads to string truncation. -If NULL is passed then the suffix -.QW "..." -is used. -.AP "const char" *format in -Format control string including % conversion specifiers. -.AP int objc in -The number of elements to format or concatenate. -.AP Tcl_Obj *objv[] in -The array of values to format or concatenate. -.AP int newLength in -New length for the string value of \fIobjPtr\fR, not including the -final null character. -.BE -.SH DESCRIPTION -.PP -The procedures described in this manual entry allow Tcl values to -be manipulated as string values. They use the internal representation -of the value to store additional information to make the string -manipulations more efficient. In particular, they make a series of -append operations efficient by allocating extra storage space for the -string so that it does not have to be copied for each append. -Also, indexing and length computations are optimized because the -Unicode string representation is calculated and cached as needed. -When using the \fBTcl_Append*\fR family of functions where the -interpreter's result is the value being appended to, it is important -to call Tcl_ResetResult first to ensure you are not unintentionally -appending to existing data in the result value. -.PP -\fBTcl_NewStringObj\fR and \fBTcl_SetStringObj\fR create a new value -or modify an existing value to hold a copy of the string given by -\fIbytes\fR and \fIlength\fR. \fBTcl_NewUnicodeObj\fR and -\fBTcl_SetUnicodeObj\fR create a new value or modify an existing -value to hold a copy of the Unicode string given by \fIunicode\fR and -\fInumChars\fR. \fBTcl_NewStringObj\fR and \fBTcl_NewUnicodeObj\fR -return a pointer to a newly created value with reference count zero. -All four procedures set the value to hold a copy of the specified -string. \fBTcl_SetStringObj\fR and \fBTcl_SetUnicodeObj\fR free any -old string representation as well as any old internal representation -of the value. -.PP -\fBTcl_GetStringFromObj\fR and \fBTcl_GetString\fR return a value's -string representation. This is given by the returned byte pointer and -(for \fBTcl_GetStringFromObj\fR) length, which is stored in -\fIlengthPtr\fR if it is non-NULL. If the value's UTF string -representation is invalid (its byte pointer is NULL), the string -representation is regenerated from the value's internal -representation. The storage referenced by the returned byte pointer -is owned by the value manager. It is passed back as a writable -pointer so that extension author creating their own \fBTcl_ObjType\fR -will be able to modify the string representation within the -\fBTcl_UpdateStringProc\fR of their \fBTcl_ObjType\fR. Except for that -limited purpose, the pointer returned by \fBTcl_GetStringFromObj\fR -or \fBTcl_GetString\fR should be treated as read-only. It is -recommended that this pointer be assigned to a (const char *) variable. -Even in the limited situations where writing to this pointer is -acceptable, one should take care to respect the copy-on-write -semantics required by \fBTcl_Obj\fR's, with appropriate calls -to \fBTcl_IsShared\fR and \fBTcl_DuplicateObj\fR prior to any -in-place modification of the string representation. -The procedure \fBTcl_GetString\fR is used in the common case -where the caller does not need the length of the string -representation. -.PP -\fBTcl_GetUnicodeFromObj\fR and \fBTcl_GetUnicode\fR return a value's -value as a Unicode string. This is given by the returned pointer and -(for \fBTcl_GetUnicodeFromObj\fR) length, which is stored in -\fIlengthPtr\fR if it is non-NULL. The storage referenced by the returned -byte pointer is owned by the value manager and should not be modified by -the caller. The procedure \fBTcl_GetUnicode\fR is used in the common case -where the caller does not need the length of the unicode string -representation. -.PP -\fBTcl_GetUniChar\fR returns the \fIindex\fR'th character in the -value's Unicode representation. -.PP -\fBTcl_GetRange\fR returns a newly created value comprised of the -characters between \fIfirst\fR and \fIlast\fR (inclusive) in the -value's Unicode representation. If the value's Unicode -representation is invalid, the Unicode representation is regenerated -from the value's string representation. -.PP -\fBTcl_GetCharLength\fR returns the number of characters (as opposed -to bytes) in the string value. -.PP -\fBTcl_AppendToObj\fR appends the data given by \fIbytes\fR and -\fIlength\fR to the string representation of the value specified by -\fIobjPtr\fR. If the value has an invalid string representation, -then an attempt is made to convert \fIbytes\fR is to the Unicode -format. If the conversion is successful, then the converted form of -\fIbytes\fR is appended to the value's Unicode representation. -Otherwise, the value's Unicode representation is invalidated and -converted to the UTF format, and \fIbytes\fR is appended to the -value's new string representation. -.PP -\fBTcl_AppendUnicodeToObj\fR appends the Unicode string given by -\fIunicode\fR and \fInumChars\fR to the value specified by -\fIobjPtr\fR. If the value has an invalid Unicode representation, -then \fIunicode\fR is converted to the UTF format and appended to the -value's string representation. Appends are optimized to handle -repeated appends relatively efficiently (it over-allocates the string -or Unicode space to avoid repeated reallocations and copies of -value's string value). -.PP -\fBTcl_AppendObjToObj\fR is similar to \fBTcl_AppendToObj\fR, but it -appends the string or Unicode value (whichever exists and is best -suited to be appended to \fIobjPtr\fR) of \fIappendObjPtr\fR to -\fIobjPtr\fR. -.PP -\fBTcl_AppendStringsToObj\fR is similar to \fBTcl_AppendToObj\fR -except that it can be passed more than one value to append and -each value must be a null-terminated string (i.e. none of the -values may contain internal null characters). Any number of -\fIstring\fR arguments may be provided, but the last argument -must be a NULL pointer to indicate the end of the list. -.PP -\fBTcl_AppendStringsToObjVA\fR is the same as \fBTcl_AppendStringsToObj\fR -except that instead of taking a variable number of arguments it takes an -argument list. -.PP -\fBTcl_AppendLimitedToObj\fR is similar to \fBTcl_AppendToObj\fR -except that it imposes a limit on how many bytes are appended. -This can be handy when the string to be appended might be -very large, but the value being constructed should not be allowed to grow -without bound. A common usage is when constructing an error message, where the -end result should be kept short enough to be read. -Bytes from \fIbytes\fR are appended to \fIobjPtr\fR, but no more -than \fIlimit\fR bytes total are to be appended. If the limit prevents -all \fIlength\fR bytes that are available from being appended, then the -appending is done so that the last bytes appended are from the -string \fIellipsis\fR. This allows for an indication of the truncation -to be left in the string. -When \fIlength\fR is \fB-1\fR, all bytes up to the first zero byte are appended, -subject to the limit. When \fIellipsis\fR is NULL, the default -string \fB...\fR is used. When \fIellipsis\fR is non-NULL, it must point -to a zero-byte-terminated string in Tcl's internal UTF encoding. -The number of bytes appended can be less than the lesser -of \fIlength\fR and \fIlimit\fR when appending fewer -bytes is necessary to append only whole multi-byte characters. -.PP -\fBTcl_Format\fR is the C-level interface to the engine of the \fBformat\fR -command. The actual command procedure for \fBformat\fR is little more -than -.PP -.CS -\fBTcl_Format\fR(interp, \fBTcl_GetString\fR(objv[1]), objc-2, objv+2); -.CE -.PP -The \fIobjc\fR Tcl_Obj values in \fIobjv\fR are formatted into a string -according to the conversion specification in \fIformat\fR argument, following -the documentation for the \fBformat\fR command. The resulting formatted -string is converted to a new Tcl_Obj with refcount of zero and returned. -If some error happens during production of the formatted string, NULL is -returned, and an error message is recorded in \fIinterp\fR, if \fIinterp\fR -is non-NULL. -.PP -\fBTcl_AppendFormatToObj\fR is an appending alternative form -of \fBTcl_Format\fR with functionality equivalent to: -.PP -.CS -Tcl_Obj *newPtr = \fBTcl_Format\fR(interp, format, objc, objv); -if (newPtr == NULL) return TCL_ERROR; -\fBTcl_AppendObjToObj\fR(objPtr, newPtr); -\fBTcl_DecrRefCount\fR(newPtr); -return TCL_OK; -.CE -.PP -but with greater convenience and efficiency when the appending -functionality is needed. -.PP -\fBTcl_ObjPrintf\fR serves as a replacement for the common sequence -.PP -.CS -char buf[SOME_SUITABLE_LENGTH]; -sprintf(buf, format, ...); -\fBTcl_NewStringObj\fR(buf, -1); -.CE -.PP -but with greater convenience and no need to -determine \fBSOME_SUITABLE_LENGTH\fR. The formatting is done with the same -core formatting engine used by \fBTcl_Format\fR. This means the set of -supported conversion specifiers is that of the \fBformat\fR command and -not that of the \fBsprintf\fR routine where the two sets differ. When a -conversion specifier passed to \fBTcl_ObjPrintf\fR includes a precision, -the value is taken as a number of bytes, as \fBsprintf\fR does, and not -as a number of characters, as \fBformat\fR does. This is done on the -assumption that C code is more likely to know how many bytes it is -passing around than the number of encoded characters those bytes happen -to represent. The variable number of arguments passed in should be of -the types that would be suitable for passing to \fBsprintf\fR. Note in -this example usage, \fIx\fR is of type \fBint\fR. -.PP -.CS -int x = 5; -Tcl_Obj *objPtr = \fBTcl_ObjPrintf\fR("Value is %d", x); -.CE -.PP -If the value of \fIformat\fR contains internal inconsistencies or invalid -specifier formats, the formatted string result produced by -\fBTcl_ObjPrintf\fR will be an error message describing the error. -It is impossible however to provide runtime protection against -mismatches between the format and any subsequent arguments. -Compile-time protection may be provided by some compilers. -.PP -\fBTcl_AppendPrintfToObj\fR is an appending alternative form -of \fBTcl_ObjPrintf\fR with functionality equivalent to -.PP -.CS -Tcl_Obj *newPtr = \fBTcl_ObjPrintf\fR(format, ...); -\fBTcl_AppendObjToObj\fR(objPtr, newPtr); -\fBTcl_DecrRefCount\fR(newPtr); -.CE -.PP -but with greater convenience and efficiency when the appending -functionality is needed. -.PP -The \fBTcl_SetObjLength\fR procedure changes the length of the -string value of its \fIobjPtr\fR argument. If the \fInewLength\fR -argument is greater than the space allocated for the value's -string, then the string space is reallocated and the old value -is copied to the new space; the bytes between the old length of -the string and the new length may have arbitrary values. -If the \fInewLength\fR argument is less than the current length -of the value's string, with \fIobjPtr->length\fR is reduced without -reallocating the string space; the original allocated size for the -string is recorded in the value, so that the string length can be -enlarged in a subsequent call to \fBTcl_SetObjLength\fR without -reallocating storage. In all cases \fBTcl_SetObjLength\fR leaves -a null character at \fIobjPtr->bytes[newLength]\fR. -.PP -\fBTcl_AttemptSetObjLength\fR is identical in function to -\fBTcl_SetObjLength\fR except that if sufficient memory to satisfy the -request cannot be allocated, it does not cause the Tcl interpreter to -\fBpanic\fR. Thus, if \fInewLength\fR is greater than the space -allocated for the value's string, and there is not enough memory -available to satisfy the request, \fBTcl_AttemptSetObjLength\fR will take -no action and return 0 to indicate failure. If there is enough memory -to satisfy the request, \fBTcl_AttemptSetObjLength\fR behaves just like -\fBTcl_SetObjLength\fR and returns 1 to indicate success. -.PP -The \fBTcl_ConcatObj\fR function returns a new string value whose -value is the space-separated concatenation of the string -representations of all of the values in the \fIobjv\fR -array. \fBTcl_ConcatObj\fR eliminates leading and trailing white space -as it copies the string representations of the \fIobjv\fR array to the -result. If an element of the \fIobjv\fR array consists of nothing but -white space, then that value is ignored entirely. This white-space -removal was added to make the output of the \fBconcat\fR command -cleaner-looking. \fBTcl_ConcatObj\fR returns a pointer to a -newly-created value whose ref count is zero. -.SH "SEE ALSO" -Tcl_NewObj(3), Tcl_IncrRefCount(3), Tcl_DecrRefCount(3), format(n), sprintf(3) -.SH KEYWORDS -append, internal representation, value, value type, string value, -string type, string representation, concat, concatenate, unicode diff --git a/doc/SubstObj.3 b/doc/SubstObj.3 deleted file mode 100644 index a2b6214..0000000 --- a/doc/SubstObj.3 +++ /dev/null @@ -1,68 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_SubstObj 3 8.4 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_SubstObj \- perform substitutions on Tcl values -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -Tcl_Obj * -\fBTcl_SubstObj\fR(\fIinterp, objPtr, flags\fR) -.SH ARGUMENTS -.AS Tcl_Interp **termPtr -.AP Tcl_Interp *interp in -Interpreter in which to execute Tcl scripts and lookup variables. If -an error occurs, the interpreter's result is modified to hold an error -message. -.AP Tcl_Obj *objPtr in -A Tcl value containing the string to perform substitutions on. -.AP int flags in -ORed combination of flag bits that specify which substitutions to -perform. The flags \fBTCL_SUBST_COMMANDS\fR, -\fBTCL_SUBST_VARIABLES\fR and \fBTCL_SUBST_BACKSLASHES\fR are -currently supported, and \fBTCL_SUBST_ALL\fR is provided as a -convenience for the common case where all substitutions are desired. -.BE -.SH DESCRIPTION -.PP -The \fBTcl_SubstObj\fR function is used to perform substitutions on -strings in the fashion of the \fBsubst\fR command. It gets the value -of the string contained in \fIobjPtr\fR and scans it, copying -characters and performing the chosen substitutions as it goes to an -output value which is returned as the result of the function. In the -event of an error occurring during the execution of a command or -variable substitution, the function returns NULL and an error message -is left in \fIinterp\fR's result. -.PP -Three kinds of substitutions are supported. When the -\fBTCL_SUBST_BACKSLASHES\fR bit is set in \fIflags\fR, sequences that -look like backslash substitutions for Tcl commands are replaced by -their corresponding character. -.PP -When the \fBTCL_SUBST_VARIABLES\fR bit is set in \fIflags\fR, -sequences that look like variable substitutions for Tcl commands are -replaced by the contents of the named variable. -.PP -When the \fBTCL_SUBST_COMMANDS\fR bit is set in \fIflags\fR, sequences -that look like command substitutions for Tcl commands are replaced by -the result of evaluating that script. Where an uncaught -.QW "continue exception" -occurs during the evaluation of a command substitution, an -empty string is substituted for the command. Where an uncaught -.QW "break exception" -occurs during the evaluation of a command substitution, the -result of the whole substitution on \fIobjPtr\fR will be truncated at -the point immediately before the start of the command substitution, -and no characters will be added to the result or substitutions -performed after that point. -.SH "SEE ALSO" -subst(n) -.SH KEYWORDS -backslash substitution, command substitution, variable substitution diff --git a/doc/TCL_MEM_DEBUG.3 b/doc/TCL_MEM_DEBUG.3 deleted file mode 100644 index 3a014d4..0000000 --- a/doc/TCL_MEM_DEBUG.3 +++ /dev/null @@ -1,80 +0,0 @@ -'\" -'\" Copyright (c) 1992-1999 Karl Lehenbauer and Mark Diekhans. -'\" Copyright (c) 2000 by Scriptics Corporation. -'\" All rights reserved. -'\" -.TH TCL_MEM_DEBUG 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -TCL_MEM_DEBUG \- Compile-time flag to enable Tcl memory debugging -.BE -.SH DESCRIPTION -When Tcl is compiled with \fBTCL_MEM_DEBUG\fR defined, a powerful set -of memory debugging aids is included in the compiled binary. This -includes C and Tcl functions which can aid with debugging -memory leaks, memory allocation overruns, and other memory related -errors. -.SH "ENABLING MEMORY DEBUGGING" -.PP -To enable memory debugging, Tcl should be recompiled from scratch with -\fBTCL_MEM_DEBUG\fR defined (e.g. by passing the -\fI\-\-enable\-symbols=mem\fR flag to the \fIconfigure\fR script when -building). This will also compile in a non-stub -version of \fBTcl_InitMemory\fR to add the \fBmemory\fR command to Tcl. -.PP -\fBTCL_MEM_DEBUG\fR must be either left defined for all modules or undefined -for all modules that are going to be linked together. If they are not, link -errors will occur, with either \fBTcl_DbCkfree\fR and \fBTcl_DbCkalloc\fR or -\fBTcl_Alloc\fR and \fBTcl_Free\fR being undefined. -.PP -Once memory debugging support has been compiled into Tcl, the C -functions \fBTcl_ValidateAllMemory\fR, and \fBTcl_DumpActiveMemory\fR, -and the Tcl \fBmemory\fR command can be used to validate and examine -memory usage. -.SH "GUARD ZONES" -.PP -When memory debugging is enabled, whenever a call to \fBckalloc\fR is -made, slightly more memory than requested is allocated so the memory -debugging code can keep track of the allocated memory, and eight-byte -.QW "guard zones" -are placed in front of and behind the space that will be -returned to the caller. (The sizes of the guard zones are defined by the -C #define \fBLOW_GUARD_SIZE\fR and #define \fBHIGH_GUARD_SIZE\fR -in the file \fIgeneric/tclCkalloc.c\fR \(em it can -be extended if you suspect large overwrite problems, at some cost in -performance.) A known pattern is written into the guard zones and, on -a call to \fBckfree\fR, the guard zones of the space being freed are -checked to see if either zone has been modified in any way. If one -has been, the guard bytes and their new contents are identified, and a -.QW "low guard failed" -or -.QW "high guard failed" -message is issued. The -.QW "guard failed" -message includes the address of the memory packet and -the file name and line number of the code that called \fBckfree\fR. -This allows you to detect the common sorts of one-off problems, where -not enough space was allocated to contain the data written, for -example. -.SH "DEBUGGING DIFFICULT MEMORY CORRUPTION PROBLEMS" -.PP -Normally, Tcl compiled with memory debugging enabled will make it easy -to isolate a corruption problem. Turning on memory validation with -the memory command can help isolate difficult problems. If you -suspect (or know) that corruption is occurring before the Tcl -interpreter comes up far enough for you to issue commands, you can set -\fBMEM_VALIDATE\fR define, recompile tclCkalloc.c and rebuild Tcl. -This will enable memory validation from the first call to -\fBckalloc\fR, again, at a large performance impact. -.PP -If you are desperate and validating memory on every call to -\fBckalloc\fR and \fBckfree\fR is not enough, you can explicitly call -\fBTcl_ValidateAllMemory\fR directly at any point. It takes a \fIchar -*\fR and an \fIint\fR which are normally the filename and line number -of the caller, but they can actually be anything you want. Remember -to remove the calls after you find the problem. -.SH "SEE ALSO" -ckalloc, memory, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory -.SH KEYWORDS -memory, debug diff --git a/doc/Tcl.n b/doc/Tcl.n deleted file mode 100644 index fc3b477..0000000 --- a/doc/Tcl.n +++ /dev/null @@ -1,275 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl n "8.6" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -.SH NAME -Tcl \- Tool Command Language -.SH SYNOPSIS -Summary of Tcl language syntax. -.BE -.SH DESCRIPTION -.PP -The following rules define the syntax and semantics of the Tcl language: -.IP "[1] \fBCommands.\fR" -A Tcl script is a string containing one or more commands. -Semi-colons and newlines are command separators unless quoted as -described below. -Close brackets are command terminators during command substitution -(see below) unless quoted. -.IP "[2] \fBEvaluation.\fR" -A command is evaluated in two steps. -First, the Tcl interpreter breaks the command into \fIwords\fR -and performs substitutions as described below. -These substitutions are performed in the same way for all -commands. -Secondly, the first word is used to locate a command procedure to -carry out the command, then all of the words of the command are -passed to the command procedure. -The command procedure is free to interpret each of its words -in any way it likes, such as an integer, variable name, list, -or Tcl script. -Different commands interpret their words differently. -.IP "[3] \fBWords.\fR" -Words of a command are separated by white space (except for -newlines, which are command separators). -.IP "[4] \fBDouble quotes.\fR" -If the first character of a word is double-quote -.PQ \N'34' -then the word is terminated by the next double-quote character. -If semi-colons, close brackets, or white space characters -(including newlines) appear between the quotes then they are treated -as ordinary characters and included in the word. -Command substitution, variable substitution, and backslash substitution -are performed on the characters between the quotes as described below. -The double-quotes are not retained as part of the word. -.IP "[5] \fBArgument expansion.\fR" -If a word starts with the string -.QW {*} -followed by a non-whitespace character, then the leading -.QW {*} -is removed and the rest of the word is parsed and substituted as any other -word. After substitution, the word is parsed as a list (without command or -variable substitutions; backslash substitutions are performed as is normal for -a list and individual internal words may be surrounded by either braces or -double-quote characters), and its words are added to the command being -substituted. For instance, -.QW "cmd a {*}{b [c]} d {*}{$e f {g h}}" -is equivalent to -.QW "cmd a b {[c]} d {$e} f {g h}" . -.IP "[6] \fBBraces.\fR" -If the first character of a word is an open brace -.PQ { -and rule [5] does not apply, then -the word is terminated by the matching close brace -.PQ } "" . -Braces nest within the word: for each additional open -brace there must be an additional close brace (however, -if an open brace or close brace within the word is -quoted with a backslash then it is not counted in locating the -matching close brace). -No substitutions are performed on the characters between the -braces except for backslash-newline substitutions described -below, nor do semi-colons, newlines, close brackets, -or white space receive any special interpretation. -The word will consist of exactly the characters between the -outer braces, not including the braces themselves. -.IP "[7] \fBCommand substitution.\fR" -If a word contains an open bracket -.PQ [ -then Tcl performs \fIcommand substitution\fR. -To do this it invokes the Tcl interpreter recursively to process -the characters following the open bracket as a Tcl script. -The script may contain any number of commands and must be terminated -by a close bracket -.PQ ] "" . -The result of the script (i.e. the result of its last command) is -substituted into the word in place of the brackets and all of the -characters between them. -There may be any number of command substitutions in a single word. -Command substitution is not performed on words enclosed in braces. -.IP "[8] \fBVariable substitution.\fR" -If a word contains a dollar-sign -.PQ $ -followed by one of the forms -described below, then Tcl performs \fIvariable -substitution\fR: the dollar-sign and the following characters are -replaced in the word by the value of a variable. -Variable substitution may take any of the following forms: -.RS -.TP 15 -\fB$\fIname\fR -. -\fIName\fR is the name of a scalar variable; the name is a sequence -of one or more characters that are a letter, digit, underscore, -or namespace separators (two or more colons). -Letters and digits are \fIonly\fR the standard ASCII ones (\fB0\fR\(en\fB9\fR, -\fBA\fR\(en\fBZ\fR and \fBa\fR\(en\fBz\fR). -.TP 15 -\fB$\fIname\fB(\fIindex\fB)\fR -. -\fIName\fR gives the name of an array variable and \fIindex\fR gives -the name of an element within that array. -\fIName\fR must contain only letters, digits, underscores, and -namespace separators, and may be an empty string. -Letters and digits are \fIonly\fR the standard ASCII ones (\fB0\fR\(en\fB9\fR, -\fBA\fR\(en\fBZ\fR and \fBa\fR\(en\fBz\fR). -Command substitutions, variable substitutions, and backslash -substitutions are performed on the characters of \fIindex\fR. -.TP 15 -\fB${\fIname\fB}\fR -. -\fIName\fR is the name of a scalar variable or array element. It may contain -any characters whatsoever except for close braces. It indicates an array -element if \fIname\fR is in the form -.QW \fIarrayName\fB(\fIindex\fB)\fR -where \fIarrayName\fR does not contain any open parenthesis characters, -.QW \fB(\fR , -or close brace characters, -.QW \fB}\fR , -and \fIindex\fR can be any sequence of characters except for close brace -characters. No further -substitutions are performed during the parsing of \fIname\fR. -.PP -There may be any number of variable substitutions in a single word. -Variable substitution is not performed on words enclosed in braces. -.PP -Note that variables may contain character sequences other than those listed -above, but in that case other mechanisms must be used to access them (e.g., -via the \fBset\fR command's single-argument form). -.RE -.IP "[9] \fBBackslash substitution.\fR" -If a backslash -.PQ \e -appears within a word then \fIbackslash substitution\fR occurs. -In all cases but those described below the backslash is dropped and -the following character is treated as an ordinary -character and included in the word. -This allows characters such as double quotes, close brackets, -and dollar signs to be included in words without triggering -special processing. -The following table lists the backslash sequences that are -handled specially, along with the value that replaces each sequence. -.RS -.TP 7 -\e\fBa\fR -Audible alert (bell) (Unicode U+000007). -.TP 7 -\e\fBb\fR -Backspace (Unicode U+000008). -.TP 7 -\e\fBf\fR -Form feed (Unicode U+00000C). -.TP 7 -\e\fBn\fR -Newline (Unicode U+00000A). -.TP 7 -\e\fBr\fR -Carriage-return (Unicode U+00000D). -.TP 7 -\e\fBt\fR -Tab (Unicode U+000009). -.TP 7 -\e\fBv\fR -Vertical tab (Unicode U+00000B). -.TP 7 -\e\fB\fIwhiteSpace\fR -. -A single space character replaces the backslash, newline, and all spaces -and tabs after the newline. This backslash sequence is unique in that it -is replaced in a separate pre-pass before the command is actually parsed. -This means that it will be replaced even when it occurs between braces, -and the resulting space will be treated as a word separator if it is not -in braces or quotes. -.TP 7 -\e\e -Backslash -.PQ \e "" . -.TP 7 -\e\fIooo\fR -. -The digits \fIooo\fR (one, two, or three of them) give a eight-bit octal -value for the Unicode character that will be inserted, in the range -\fI000\fR\(en\fI377\fR (i.e., the range U+000000\(enU+0000FF). -The parser will stop just before this range overflows, or when -the maximum of three digits is reached. The upper bits of the Unicode -character will be 0. -.TP 7 -\e\fBx\fIhh\fR -. -The hexadecimal digits \fIhh\fR (one or two of them) give an eight-bit -hexadecimal value for the Unicode character that will be inserted. The upper -bits of the Unicode character will be 0 (i.e., the character will be in the -range U+000000\(enU+0000FF). -.TP 7 -\e\fBu\fIhhhh\fR -. -The hexadecimal digits \fIhhhh\fR (one, two, three, or four of them) give a -sixteen-bit hexadecimal value for the Unicode character that will be -inserted. The upper bits of the Unicode character will be 0 (i.e., the -character will be in the range U+000000\(enU+00FFFF). -.TP 7 -\e\fBU\fIhhhhhhhh\fR -. -The hexadecimal digits \fIhhhhhhhh\fR (one up to eight of them) give a -twenty-one-bit hexadecimal value for the Unicode character that will be -inserted, in the range U+000000\(enU+10FFFF. The parser will stop just -before this range overflows, or when the maximum of eight digits -is reached. The upper bits of the Unicode character will be 0. -.RS -.PP -The range U+010000\(enU+10FFFD is reserved for the future. -.RE -.PP -Backslash substitution is not performed on words enclosed in braces, -except for backslash-newline as described above. -.RE -.IP "[10] \fBComments.\fR" -If a hash character -.PQ # -appears at a point where Tcl is -expecting the first character of the first word of a command, -then the hash character and the characters that follow it, up -through the next newline, are treated as a comment and ignored. -The comment character only has significance when it appears -at the beginning of a command. -.IP "[11] \fBOrder of substitution.\fR" -Each character is processed exactly once by the Tcl interpreter -as part of creating the words of a command. -For example, if variable substitution occurs then no further -substitutions are performed on the value of the variable; the -value is inserted into the word verbatim. -If command substitution occurs then the nested command is -processed entirely by the recursive call to the Tcl interpreter; -no substitutions are performed before making the recursive -call and no additional substitutions are performed on the result -of the nested script. -.RS -.PP -Substitutions take place from left to right, and each substitution is -evaluated completely before attempting to evaluate the next. Thus, a -sequence like -.PP -.CS -set y [set x 0][incr x][incr x] -.CE -.PP -will always set the variable \fIy\fR to the value, \fI012\fR. -.RE -.IP "[12] \fBSubstitution and word boundaries.\fR" -Substitutions do not affect the word boundaries of a command, -except for argument expansion as specified in rule [5]. -For example, during variable substitution the entire value of -the variable becomes part of a single word, even if the variable's -value contains spaces. -.SH KEYWORDS -backslash, command, comment, script, substitution, variable -'\" Local Variables: -'\" mode: nroff -'\" fill-column: 78 -'\" End: diff --git a/doc/TclZlib.3 b/doc/TclZlib.3 deleted file mode 100644 index 4a5df89..0000000 --- a/doc/TclZlib.3 +++ /dev/null @@ -1,276 +0,0 @@ -'\" -'\" Copyright (c) 2008 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH TclZlib 3 8.6 Tcl "Tcl Library Procedures" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -Tcl_ZlibAdler32, Tcl_ZlibCRC32, Tcl_ZlibDeflate, Tcl_ZlibInflate, Tcl_ZlibStreamChecksum, Tcl_ZlibStreamClose, Tcl_ZlibStreamEof, Tcl_ZlibStreamGet, Tcl_ZlibStreamGetCommandName, Tcl_ZlibStreamInit, Tcl_ZlibStreamPut \- compression and decompression functions -.SH SYNOPSIS -.nf -#include -.sp -int -\fBTcl_ZlibDeflate\fR(\fIinterp, format, dataObj, level, dictObj\fR) -.sp -int -\fBTcl_ZlibInflate\fR(\fIinterp, format, dataObj, dictObj\fR) -.sp -unsigned int -\fBTcl_ZlibCRC32\fR(\fIinitValue, bytes, length\fR) -.sp -unsigned int -\fBTcl_ZlibAdler32\fR(\fIinitValue, bytes, length\fR) -.sp -int -\fBTcl_ZlibStreamInit\fR(\fIinterp, mode, format, level, dictObj, zshandlePtr\fR) -.sp -Tcl_Obj * -\fBTcl_ZlibStreamGetCommandName\fR(\fIzshandle\fR) -.sp -int -\fBTcl_ZlibStreamEof\fR(\fIzshandle\fR) -.sp -int -\fBTcl_ZlibStreamClose\fR(\fIzshandle\fR) -.sp -int -\fBTcl_ZlibStreamReset\fR(\fIzshandle\fR) -.sp -int -\fBTcl_ZlibStreamChecksum\fR(\fIzshandle\fR) -.sp -int -\fBTcl_ZlibStreamPut\fR(\fIzshandle, dataObj, flush\fR) -.sp -int -\fBTcl_ZlibStreamGet\fR(\fIzshandle, dataObj, count\fR) -.sp -\fBTcl_ZlibStreamSetCompressionDictionary\fR(\fIzshandle, compDict\fR) -.fi -.SH ARGUMENTS -.AS Tcl_ZlibStream zshandle in -.AP Tcl_Interp *interp in -The interpreter to store resulting compressed or uncompressed data in. Also -where any error messages are written. For \fBTcl_ZlibStreamInit\fR, this can -be NULL to create a stream that is not bound to a command. -.AP int format in -What format of compressed data to work with. Must be one of -\fBTCL_ZLIB_FORMAT_ZLIB\fR for zlib-format data, \fBTCL_ZLIB_FORMAT_GZIP\fR -for gzip-format data, or \fBTCL_ZLIB_FORMAT_RAW\fR for raw compressed data. In -addition, for decompression only, \fBTCL_ZLIB_FORMAT_AUTO\fR may also be -chosen which can automatically detect whether the compressed data was in zlib -or gzip format. -.AP Tcl_Obj *dataObj in/out -A byte-array value containing the data to be compressed or decompressed, or -to which the data extracted from the stream is appended when passed to -\fBTcl_ZlibStreamGet\fR. -.AP int level in -What level of compression to use. Should be a number from 0 to 9 or one of the -following: \fBTCL_ZLIB_COMPRESS_NONE\fR for no compression, -\fBTCL_ZLIB_COMPRESS_FAST\fR for fast but inefficient compression, -\fBTCL_ZLIB_COMPRESS_BEST\fR for slow but maximal compression, or -\fBTCL_ZLIB_COMPRESS_DEFAULT\fR for the level recommended by the zlib library. -.AP Tcl_Obj *dictObj in/out -A dictionary that contains, or which will be updated to contain, a description -of the gzip header associated with the compressed data. Only useful when the -\fIformat\fR is \fBTCL_ZLIB_FORMAT_GZIP\fR or \fBTCL_ZLIB_FORMAT_AUTO\fR. If -a NULL is passed, a default header will be used on compression and the header -will be ignored (apart from integrity checks) on decompression. See the -section \fBGZIP OPTIONS DICTIONARY\fR for details about the contents of this -dictionary. -.AP "unsigned int" initValue in -The initial value for the checksum algorithm. -.AP "unsigned char" *bytes in -An array of bytes to run the checksum algorithm over, or NULL to get the -recommended initial value for the checksum algorithm. -.AP int length in -The number of bytes in the array. -.AP int mode in -What mode to operate the stream in. Should be either -\fBTCL_ZLIB_STREAM_DEFLATE\fR for a compressing stream or -\fBTCL_ZLIB_STREAM_INFLATE\fR for a decompressing stream. -.AP Tcl_ZlibStream *zshandlePtr out -A pointer to a variable in which to write the abstract token for the stream -upon successful creation. -.AP Tcl_ZlibStream zshandle in -The abstract token for the stream to operate on. -.AP int flush in -Whether and how to flush the stream after writing the data to it. Must be one -of: \fBTCL_ZLIB_NO_FLUSH\fR if no flushing is to be done, \fBTCL_ZLIB_FLUSH\fR -if the currently compressed data must be made available for access using -\fBTcl_ZlibStreamGet\fR, \fBTCL_ZLIB_FULLFLUSH\fR if the stream must be put -into a state where the decompressor can recover from on corruption, or -\fBTCL_ZLIB_FINALIZE\fR to ensure that the stream is finished and that any -trailer demanded by the format is written. -.AP int count in -The maximum number of bytes to get from the stream, or -1 to get all remaining -bytes from the stream's buffers. -.AP Tcl_Obj *compDict in -A byte array value that is the compression dictionary to use with the stream. -Note that this is \fInot a Tcl dictionary\fR, and it is recommended that this -only ever be used with streams that were created with their \fIformat\fR set -to \fBTCL_ZLIB_FORMAT_ZLIB\fR because the other formats have no mechanism to -indicate whether a compression dictionary was present other than to fail on -decompression. -.BE -.SH DESCRIPTION -These functions form the interface from the Tcl library to the Zlib -library by Jean-loup Gailly and Mark Adler. -.PP -\fBTcl_ZlibDeflate\fR and \fBTcl_ZlibInflate\fR respectively compress and -decompress the data contained in the \fIdataObj\fR argument, according to the -\fIformat\fR and, for compression, \fIlevel\fR arguments. The dictionary in -the \fIdictObj\fR parameter is used to convey additional header information -about the compressed data when the compression format supports it; currently, -the dictionary is only used when the \fIformat\fR parameter is -\fBTCL_ZLIB_FORMAT_GZIP\fR or \fBTCL_ZLIB_FORMAT_AUTO\fR. For details of the -contents of the dictionary, see the \fBGZIP OPTIONS DICTIONARY\fR section -below. Upon success, both functions leave the resulting compressed or -decompressed data in a byte-array value that is the Tcl interpreter's result; -the returned value is a standard Tcl result code. -.PP -\fBTcl_ZlibAdler32\fR and \fBTcl_ZlibCRC32\fR compute checksums on arrays of -bytes, returning the computed checksum. Checksums are computed incrementally, -allowing data to be processed one block at a time, but this requires the -caller to maintain the current checksum and pass it in as the \fIinitValue\fR -parameter; the initial value to use for this can be obtained by using NULL for -the \fIbytes\fR parameter instead of a pointer to the array of bytes to -compute the checksum over. Thus, typical usage in the single data block case -is like this: -.PP -.CS -checksum = \fBTcl_ZlibCRC32\fR(\fBTcl_ZlibCRC32\fR(0,NULL,0), data, length); -.CE -.PP -Note that the Adler-32 algorithm is not a real checksum, but instead is a -related type of hash that works best on longer data. -.SS "ZLIB STREAMS" -.PP -\fBTcl_ZlibStreamInit\fR creates a compressing or decompressing stream that is -linked to a Tcl command, according to its arguments, and provides an abstract -token for the stream and returns a normal Tcl result code; -\fBTcl_ZlibStreamGetCommandName\fR returns the name of that command given the -stream token, or NULL if the stream has no command. Streams are not designed -to be thread-safe; each stream should only ever be used from the thread that -created it. When working with gzip streams, a dictionary (fields as given in -the \fBGZIP OPTIONS DICTIONARY\fR section below) can be given via the -\fIdictObj\fR parameter that on compression allows control over the generated -headers, and on decompression allows discovery of the existing headers. Note -that the dictionary will be written to on decompression once sufficient data -has been read to have a complete header. This means that the dictionary must -be an unshared value in that case; a blank value created with -\fBTcl_NewObj\fR is suggested. -.PP -Once a stream has been constructed, \fBTcl_ZlibStreamPut\fR is used to add -data to the stream and \fBTcl_ZlibStreamGet\fR is used to retrieve data from -the stream after processing. Both return normal Tcl result codes and leave an -error message in the result of the interpreter that the stream is registered -with in the error case (if such a registration has been performed). With -\fBTcl_ZlibStreamPut\fR, the data buffer value passed to it should not be -modified afterwards. With \fBTcl_ZlibStreamGet\fR, the data buffer value -passed to it will have the data bytes appended to it. Internally to the -stream, data is kept compressed so as to minimize the cost of buffer space. -.PP -\fBTcl_ZlibStreamChecksum\fR returns the checksum computed over the -uncompressed data according to the format, and \fBTcl_ZlibStreamEof\fR returns -a boolean value indicating whether the end of the uncompressed data has been -reached. -.PP -\fBTcl_ZlibStreamSetCompressionDictionary\fR is used to control the -compression dictionary used with the stream, a compression dictionary being an -array of bytes (such as might be created with \fBTcl_NewByteArrayObj\fR) that -is used to initialize the compression engine rather than leaving it to create -it on the fly from the data being compressed. Setting a compression dictionary -allows for more efficient compression in the case where the start of the data -is highly regular, but it does require both the compressor and the -decompressor to agreee on the value to use. Compression dictionaries are only -fully supported for zlib-format data; on compression, they must be set before -any data is sent in with \fBTcl_ZlibStreamPut\fR, and on decompression they -should be set when \fBTcl_ZlibStreamGet\fR produces an \fBerror\fR with its -\fB\-errorcode\fR set to -.QW "\fBZLIB NEED_DICT\fI code\fR" ; -the \fIcode\fR will be the Adler-32 checksum (see \fBTcl_ZlibAdler32\fR) of -the compression dictionary sought. (Note that this is only true for -zlib-format streams; gzip streams ignore compression dictionaries as the -format specification doesn't permit them, and raw streams just produce a data -error if the compression dictionary is missing or incorrect.) -.PP -If you wish to clear a stream and reuse it for a new compression or -decompression action, \fBTcl_ZlibStreamReset\fR will do this and return a -normal Tcl result code to indicate whether it was successful; if the stream is -registered with an interpreter, an error message will be left in the -interpreter result when this function returns TCL_ERROR. -Finally, \fBTcl_ZlibStreamClose\fR will clean up the stream and delete the -associated command: using \fBTcl_DeleteCommand\fR on the stream's command is -equivalent (when such a command exists). -.SH "GZIP OPTIONS DICTIONARY" -.PP -The \fIdictObj\fR parameter to \fBTcl_ZlibDeflate\fR, \fBTcl_ZlibInflate\fR -and \fBTcl_ZlibStreamInit\fR is used to pass a dictionary of options about -that is used to describe the gzip header in the compressed data. When creating -compressed data, the dictionary is read and when unpacking compressed data the -dictionary is written (in which case the \fIdictObj\fR parameter must refer to -an unshared dictionary value). -.PP -The following fields in the dictionary value are understood. All other fields -are ignored. No field is required when creating a gzip-format stream. -.TP -\fBcomment\fR -. -This holds the comment field of the header, if present. If absent, no comment -was supplied (on decompression) or will be created (on compression). -.TP -\fBcrc\fR -. -A boolean value describing whether a CRC of the header is computed. Note that -the \fBgzip\fR program does \fInot\fR use or allow a CRC on the header. -.TP -\fBfilename\fR -. -The name of the file that held the uncompressed data. This should not contain -any directory separators, and should be sanitized before use on decompression -with \fBfile tail\fR. -.TP -\fBos\fR -. -The operating system type code field from the header (if not the -.QW unknown -value). See RFC 1952 for the meaning of these codes. On compression, if this -is absent then the field will be set to the -.QW unknown -value. -.TP -\fBsize\fR -. -The size of the uncompressed data. This is ignored on compression; the size -of the data compressed depends on how much data is supplied to the -compression engine. -.TP -\fBtime\fR -. -The time field from the header if non-zero, expected to be the time that the -file named by the \fBfilename\fR field was modified. Suitable for use with -\fBclock format\fR. On creation, the right value to use is that from -\fBclock seconds\fR or \fBfile mtime\fR. -.TP -\fBtype\fR -. -The type of the uncompressed data (either \fBbinary\fR or \fBtext\fR) if -known. -.SH "PORTABILITY NOTES" -These functions will fail gracefully if Tcl is not linked with the zlib -library. -.SH "SEE ALSO" -Tcl_NewByteArrayObj(3), zlib(n) -'\"Tcl_StackChannel(3) -.SH "KEYWORDS" -compress, decompress, deflate, gzip, inflate -'\" Local Variables: -'\" mode: nroff -'\" fill-column: 78 -'\" End: diff --git a/doc/Tcl_Main.3 b/doc/Tcl_Main.3 deleted file mode 100644 index 3ec33d1..0000000 --- a/doc/Tcl_Main.3 +++ /dev/null @@ -1,196 +0,0 @@ -'\" -'\" Copyright (c) 1994 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. -'\" -.TH Tcl_Main 3 8.4 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_Main, Tcl_SetStartupScript, Tcl_GetStartupScript, Tcl_SetMainLoop \- main program, startup script, and event loop definition for Tcl-based applications -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_Main\fR(\fIargc, argv, appInitProc\fR) -.sp -\fBTcl_SetStartupScript\fR(\fIpath, encoding\fR) -.sp -Tcl_Obj * -\fBTcl_GetStartupScript\fR(\fIencodingPtr\fR) -.sp -\fBTcl_SetMainLoop\fR(\fImainLoopProc\fR) -.SH ARGUMENTS -.AS Tcl_MainLoopProc *mainLoopProc -.AP int argc in -Number of elements in \fIargv\fR. -.AP char *argv[] in -Array of strings containing command-line arguments. On Windows, when -using -DUNICODE, the parameter type changes to wchar_t *. -.AP Tcl_AppInitProc *appInitProc in -Address of an application-specific initialization procedure. -The value for this argument is usually \fBTcl_AppInit\fR. -.AP Tcl_Obj *path in -Name of file to use as startup script, or NULL. -.AP "const char" *encoding in -Encoding of file to use as startup script, or NULL. -.AP "const char" **encodingPtr out -If non-NULL, location to write a copy of the (const char *) -pointing to the encoding name. -.AP Tcl_MainLoopProc *mainLoopProc in -Address of an application-specific event loop procedure. -.BE -.SH DESCRIPTION -.PP -\fBTcl_Main\fR can serve as the main program for Tcl-based shell -applications. A -.QW "shell application" -is a program -like tclsh or wish that supports both interactive interpretation -of Tcl and evaluation of a script contained in a file given as -a command line argument. \fBTcl_Main\fR is offered as a convenience -to developers of shell applications, so they do not have to -reproduce all of the code for proper initialization of the Tcl -library and interactive shell operation. Other styles of embedding -Tcl in an application are not supported by \fBTcl_Main\fR. Those -must be achieved by calling lower level functions in the Tcl library -directly. -.PP -The \fBTcl_Main\fR function has been offered by the Tcl library -since release Tcl 7.4. In older releases of Tcl, the Tcl library -itself defined a function \fBmain\fR, but that lacks flexibility -of embedding style and having a function \fBmain\fR in a library -(particularly a shared library) causes problems on many systems. -Having \fBmain\fR in the Tcl library would also make it hard to use -Tcl in C++ programs, since C++ programs must have special C++ -\fBmain\fR functions. -.PP -Normally each shell application contains a small \fBmain\fR function -that does nothing but invoke \fBTcl_Main\fR. -\fBTcl_Main\fR then does all the work of creating and running a -\fBtclsh\fR-like application. -.PP -\fBTcl_Main\fR is not provided by the public interface of Tcl's -stub library. Programs that call \fBTcl_Main\fR must be linked -against the standard Tcl library. Extensions (stub-enabled or -not) are not intended to call \fBTcl_Main\fR. -.PP -\fBTcl_Main\fR is not thread-safe. It should only be called by -a single master thread of a multi-threaded application. This -restriction is not a problem with normal use described above. -.PP -\fBTcl_Main\fR and therefore all applications based upon it, like -\fBtclsh\fR, use \fBTcl_GetStdChannel\fR to initialize the standard -channels to their default values. See \fBTcl_StandardChannels\fR for -more information. -.PP -\fBTcl_Main\fR supports two modes of operation, depending on -whether the filename and encoding of a startup script has been -established. The routines \fBTcl_SetStartupScript\fR and -\fBTcl_GetStartupScript\fR are the tools for controlling this -configuration of \fBTcl_Main\fR. -.PP -\fBTcl_SetStartupScript\fR registers the value \fIpath\fR -as the name of the file for \fBTcl_Main\fR to evaluate as -its startup script. The value \fIencoding\fR is Tcl's name -for the encoding used to store the text in that file. A -value of \fBNULL\fR for \fIencoding\fR is a signal to use -the system encoding. A value of \fBNULL\fR for \fIpath\fR -erases any existing registration so that \fBTcl_Main\fR -will not evaluate any startup script. -.PP -\fBTcl_GetStartupScript\fR queries the registered file name -and encoding set by the most recent \fBTcl_SetStartupScript\fR -call in the same thread. The stored file name is returned, -and the stored encoding name is written to space pointed to -by \fIencodingPtr\fR, when that is not NULL. -.PP -The file name and encoding values managed by the routines -\fBTcl_SetStartupScript\fR and \fBTcl_GetStartupScript\fR -are stored per-thread. Although the storage and retrieval -functions of these routines work in any thread, only those -calls in the same master thread as \fBTcl_Main\fR can have -any influence on it. -.PP -The caller of \fBTcl_Main\fR may call \fBTcl_SetStartupScript\fR -first to establish its desired startup script. If \fBTcl_Main\fR -finds that no such startup script has been established, it consults -the first few arguments in \fIargv\fR. If they match -?\fB\-encoding \fIname\fR? \fIfileName\fR, -where \fIfileName\fR does not begin with the character \fI\-\fR, -then \fIfileName\fR is taken to be the name of a file containing -a \fIstartup script\fR, and \fIname\fR is taken to be the name -of the encoding of the contents of that file. \fBTcl_Main\fR -then calls \fBTcl_SetStartupScript\fR with these values. -.PP -\fBTcl_Main\fR then defines in its master interpreter -the Tcl variables \fIargc\fR, \fIargv\fR, \fIargv0\fR, and -\fItcl_interactive\fR, as described in the documentation for \fBtclsh\fR. -.PP -When it has finished its own initialization, but before it processes -commands, \fBTcl_Main\fR calls the procedure given by the -\fIappInitProc\fR argument. This procedure provides a -.QW hook -for the application to perform its own initialization of the interpreter -created by \fBTcl_Main\fR, such as defining application-specific -commands. The application initialization routine might also -call \fBTcl_SetStartupScript\fR to (re-)set the file and encoding -to be used as a startup script. The procedure must have an interface -that matches the type \fBTcl_AppInitProc\fR: -.PP -.CS -typedef int \fBTcl_AppInitProc\fR( - Tcl_Interp *\fIinterp\fR); -.CE -.PP -\fIAppInitProc\fR is almost always a pointer to \fBTcl_AppInit\fR; for more -details on this procedure, see the documentation for \fBTcl_AppInit\fR. -.PP -When the \fIappInitProc\fR is finished, \fBTcl_Main\fR calls -\fBTcl_GetStartupScript\fR to determine what startup script has -been requested, if any. If a startup script has been provided, -\fBTcl_Main\fR attempts to evaluate it. Otherwise, interactive -mode begins with examination of the variable \fItcl_rcFileName\fR -in the master interpreter. If that variable exists and holds the -name of a readable file, the contents of that file are evaluated -in the master interpreter. Then interactive operations begin, -with prompts and command evaluation results written to the standard -output channel, and commands read from the standard input channel -and then evaluated. The prompts written to the standard output -channel may be customized by defining the Tcl variables \fItcl_prompt1\fR -and \fItcl_prompt2\fR as described in the documentation for \fBtclsh\fR. -The prompts and command evaluation results are written to the standard -output channel only if the Tcl variable \fItcl_interactive\fR in the -master interpreter holds a non-zero integer value. -.PP -\fBTcl_SetMainLoop\fR allows setting an event loop procedure to be run. -This allows, for example, Tk to be dynamically loaded and set its event -loop. The event loop will run following the startup script. If you -are in interactive mode, setting the main loop procedure will cause the -prompt to become fileevent based and then the loop procedure is called. -When the loop procedure returns in interactive mode, interactive operation -will continue. -The main loop procedure must have an interface that matches the type -\fBTcl_MainLoopProc\fR: -.PP -.CS -typedef void \fBTcl_MainLoopProc\fR(void); -.CE -.PP -\fBTcl_Main\fR does not return. Normally a program based on -\fBTcl_Main\fR will terminate when the \fBexit\fR command is -evaluated. In interactive mode, if an EOF or channel error -is encountered on the standard input channel, then \fBTcl_Main\fR -itself will evaluate the \fBexit\fR command after the main loop -procedure (if any) returns. In non-interactive mode, after -\fBTcl_Main\fR evaluates the startup script, and the main loop -procedure (if any) returns, \fBTcl_Main\fR will also evaluate -the \fBexit\fR command. -.SH "SEE ALSO" -tclsh(1), Tcl_GetStdChannel(3), Tcl_StandardChannels(3), Tcl_AppInit(3), -exit(n), encoding(n) -.SH KEYWORDS -application-specific initialization, command-line arguments, main program diff --git a/doc/Thread.3 b/doc/Thread.3 deleted file mode 100644 index 5966a71..0000000 --- a/doc/Thread.3 +++ /dev/null @@ -1,242 +0,0 @@ -'\" -'\" 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. -'\" -.TH Threads 3 "8.1" Tcl "Tcl Library Procedures" -.so man.macros -.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 -.nf -\fB#include \fR -.sp -void -\fBTcl_ConditionNotify\fR(\fIcondPtr\fR) -.sp -void -\fBTcl_ConditionWait\fR(\fIcondPtr, mutexPtr, timePtr\fR) -.sp -void -\fBTcl_ConditionFinalize\fR(\fIcondPtr\fR) -.sp -Void * -\fBTcl_GetThreadData\fR(\fIkeyPtr, size\fR) -.sp -void -\fBTcl_MutexLock\fR(\fImutexPtr\fR) -.sp -void -\fBTcl_MutexUnlock\fR(\fImutexPtr\fR) -.sp -void -\fBTcl_MutexFinalize\fR(\fImutexPtr\fR) -.sp -int -\fBTcl_CreateThread\fR(\fIidPtr, proc, clientData, stackSize, flags\fR) -.sp -int -\fBTcl_JoinThread\fR(\fIid, result\fR) -.SH ARGUMENTS -.AS Tcl_CreateThreadProc proc out -.AP Tcl_Condition *condPtr in -A condition variable, which must be associated with a mutex lock. -.AP Tcl_Mutex *mutexPtr in -A mutex lock. -.AP "const Tcl_Time" *timePtr in -A time limit on the condition wait. NULL to wait forever. -Note that a polling value of 0 seconds does not make much sense. -.AP Tcl_ThreadDataKey *keyPtr in -This identifies a block of thread local storage. The key should be -static and process-wide, yet each thread will end up associating -a different block of storage with this key. -.AP int *size in -The size of the thread local storage block. This amount of data -is allocated and initialized to zero the first time each thread -calls \fBTcl_GetThreadData\fR. -.AP Tcl_ThreadId *idPtr out -The referred storage will contain the id of the newly created thread as -returned by the operating system. -.AP Tcl_ThreadId id in -Id of the thread waited upon. -.AP Tcl_ThreadCreateProc *proc in -This procedure will act as the \fBmain()\fR of the newly created -thread. The specified \fIclientData\fR will be its sole argument. -.AP ClientData clientData in -Arbitrary information. Passed as sole argument to the \fIproc\fR. -.AP int stackSize in -The size of the stack given to the new thread. -.AP int flags in -Bitmask containing flags allowing the caller to modify behavior of -the new thread. -.AP int *result out -The referred storage is used to place the exit code of the thread -waited upon into it. -.BE -.SH INTRODUCTION -Beginning with the 8.1 release, the Tcl core is thread safe, which -allows you to incorporate Tcl into multithreaded applications without -customizing the Tcl core. Starting with the 8.6 release, Tcl -multithreading support is on by default. To disable Tcl multithreading -support, you must include the \fB\-\|\-disable-threads\fR option to -\fBconfigure\fR when you configure and compile your Tcl core. -.PP -An important constraint of the Tcl threads implementation is that -\fIonly the thread that created a Tcl interpreter can use that -interpreter\fR. In other words, multiple threads can not access -the same Tcl interpreter. (However, a single thread can safely create -and use multiple interpreters.) -.SH DESCRIPTION -Tcl provides \fBTcl_CreateThread\fR for creating threads. The -caller can determine the size of the stack given to the new thread and -modify the behavior through the supplied \fIflags\fR. The value -\fBTCL_THREAD_STACK_DEFAULT\fR for the \fIstackSize\fR indicates that -the default size as specified by the operating system is to be used -for the new thread. As for the flags, currently only the values -\fBTCL_THREAD_NOFLAGS\fR and \fBTCL_THREAD_JOINABLE\fR are defined. The -first of them invokes the default behavior with no special settings. -Using the second value marks the new thread as \fIjoinable\fR. This -means that another thread can wait for the such marked thread to exit -and join it. -.PP -Restrictions: On some UNIX systems the pthread-library does not -contain the functionality to specify the stack size of a thread. The -specified value for the stack size is ignored on these systems. -Windows currently does not support joinable threads. This -flag value is therefore ignored on this platform. -.PP -Tcl provides the \fBTcl_ExitThread\fR and \fBTcl_FinalizeThread\fR functions -for terminating threads and invoking optional per-thread exit -handlers. See the \fBTcl_Exit\fR page for more information on these -procedures. -.PP -The \fBTcl_JoinThread\fR function is provided to allow threads to wait -upon the exit of another thread, which must have been marked as -joinable through usage of the \fBTCL_THREAD_JOINABLE\fR-flag during -its creation via \fBTcl_CreateThread\fR. -.PP -Trying to wait for the exit of a non-joinable thread or a thread which -is already waited upon will result in an error. Waiting for a joinable -thread which already exited is possible, the system will retain the -necessary information until after the call to \fBTcl_JoinThread\fR. -This means that not calling \fBTcl_JoinThread\fR for a joinable thread -will cause a memory leak. -.PP -The \fBTcl_GetThreadData\fR call returns a pointer to a block of -thread-private data. Its argument is a key that is shared by all threads -and a size for the block of storage. The storage is automatically -allocated and initialized to all zeros the first time each thread asks for it. -The storage is automatically deallocated by \fBTcl_FinalizeThread\fR. -.SS "SYNCHRONIZATION AND COMMUNICATION" -Tcl provides \fBTcl_ThreadQueueEvent\fR and \fBTcl_ThreadAlert\fR -for handling event queuing in multithreaded applications. See -the \fBNotifier\fR manual page for more information on these procedures. -.PP -A mutex is a lock that is used to serialize all threads through a piece -of code by calling \fBTcl_MutexLock\fR and \fBTcl_MutexUnlock\fR. -If one thread holds a mutex, any other thread calling \fBTcl_MutexLock\fR will -block until \fBTcl_MutexUnlock\fR is called. -A mutex can be destroyed after its use by calling \fBTcl_MutexFinalize\fR. -The result of locking a mutex twice from the same thread is undefined. -On some platforms it will result in a deadlock. -The \fBTcl_MutexLock\fR, \fBTcl_MutexUnlock\fR and \fBTcl_MutexFinalize\fR -procedures are defined as empty macros if not compiling with threads enabled. -For declaration of mutexes the \fBTCL_DECLARE_MUTEX\fR macro should be used. -This macro assures correct mutex handling even when the core is compiled -without threads enabled. -.PP -A condition variable is used as a signaling mechanism: -a thread can lock a mutex and then wait on a condition variable -with \fBTcl_ConditionWait\fR. This atomically releases the mutex lock -and blocks the waiting thread until another thread calls -\fBTcl_ConditionNotify\fR. The caller of \fBTcl_ConditionNotify\fR should -have the associated mutex held by previously calling \fBTcl_MutexLock\fR, -but this is not enforced. Notifying the -condition variable unblocks all threads waiting on the condition variable, -but they do not proceed until the mutex is released with \fBTcl_MutexUnlock\fR. -The implementation of \fBTcl_ConditionWait\fR automatically locks -the mutex before returning. -.PP -The caller of \fBTcl_ConditionWait\fR should be prepared for spurious -notifications by calling \fBTcl_ConditionWait\fR within a while loop -that tests some invariant. -.PP -A condition variable can be destroyed after its use by calling -\fBTcl_ConditionFinalize\fR. -.PP -The \fBTcl_ConditionNotify\fR, \fBTcl_ConditionWait\fR and -\fBTcl_ConditionFinalize\fR procedures are defined as empty macros if -not compiling with threads enabled. -.SS INITIALIZATION -.PP -All of these synchronization objects are self-initializing. -They are implemented as opaque pointers that should be NULL -upon first use. -The mutexes and condition variables are -either cleaned up by process exit handlers (if living that long) or -explicitly by calls to \fBTcl_MutexFinalize\fR or -\fBTcl_ConditionFinalize\fR. -Thread local storage is reclaimed during \fBTcl_FinalizeThread\fR. -.SH "SCRIPT-LEVEL ACCESS TO THREADS" -.PP -Tcl provides no built-in commands for scripts to use to create, -manage, or join threads, nor any script-level access to mutex or -condition variables. It provides such facilities only via C -interfaces, and leaves it up to packages to expose these matters to -the script level. One such package is the \fBThread\fR package. -.SH EXAMPLE -.PP -To create a thread with portable code, its implementation function should be -declared as follows: -.PP -.CS -static \fBTcl_ThreadCreateProc\fR MyThreadImplFunc; -.CE -.PP -It should then be defined like this example, which just counts up to a given -value and then finishes. -.PP -.CS -static \fBTcl_ThreadCreateType\fR -MyThreadImplFunc( - ClientData clientData) -{ - int i, limit = (int) clientData; - for (i=0 ; i\fR -.sp -Tcl_UniChar -\fBTcl_UniCharToUpper\fR(\fIch\fR) -.sp -Tcl_UniChar -\fBTcl_UniCharToLower\fR(\fIch\fR) -.sp -Tcl_UniChar -\fBTcl_UniCharToTitle\fR(\fIch\fR) -.sp -int -\fBTcl_UtfToUpper\fR(\fIstr\fR) -.sp -int -\fBTcl_UtfToLower\fR(\fIstr\fR) -.sp -int -\fBTcl_UtfToTitle\fR(\fIstr\fR) -.SH ARGUMENTS -.AS char *str in/out -.AP int ch in -The Tcl_UniChar to be converted. -.AP char *str in/out -Pointer to UTF-8 string to be converted in place. -.BE - -.SH DESCRIPTION -.PP -The first three routines convert the case of individual Unicode characters: -.PP -If \fIch\fR represents a lower-case character, -\fBTcl_UniCharToUpper\fR returns the corresponding upper-case -character. If no upper-case character is defined, it returns the -character unchanged. -.PP -If \fIch\fR represents an upper-case character, -\fBTcl_UniCharToLower\fR returns the corresponding lower-case -character. If no lower-case character is defined, it returns the -character unchanged. -.PP -If \fIch\fR represents a lower-case character, -\fBTcl_UniCharToTitle\fR returns the corresponding title-case -character. If no title-case character is defined, it returns the -corresponding upper-case character. If no upper-case character is -defined, it returns the character unchanged. Title-case is defined -for a small number of characters that have a different appearance when -they are at the beginning of a capitalized word. -.PP -The next three routines convert the case of UTF-8 strings in place in -memory: -.PP -\fBTcl_UtfToUpper\fR changes every UTF-8 character in \fIstr\fR to -upper-case. Because changing the case of a character may change its -size, the byte offset of each character in the resulting string may -differ from its original location. \fBTcl_UtfToUpper\fR writes a null -byte at the end of the converted string. \fBTcl_UtfToUpper\fR returns -the new length of the string in bytes. This new length is guaranteed -to be no longer than the original string length. -.PP -\fBTcl_UtfToLower\fR is the same as \fBTcl_UtfToUpper\fR except it -turns each character in the string into its lower-case equivalent. -.PP -\fBTcl_UtfToTitle\fR is the same as \fBTcl_UtfToUpper\fR except it -turns the first character in the string into its title-case equivalent -and all following characters into their lower-case equivalents. - -.SH BUGS -.PP -At this time, the case conversions are only defined for the ISO8859-1 -characters. Unicode characters above 0x00ff are not modified by these -routines. - -.SH KEYWORDS -utf, unicode, toupper, tolower, totitle, case diff --git a/doc/TraceCmd.3 b/doc/TraceCmd.3 deleted file mode 100644 index 99914a6..0000000 --- a/doc/TraceCmd.3 +++ /dev/null @@ -1,150 +0,0 @@ -'\" -'\" Copyright (c) 2002 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH Tcl_TraceCommand 3 7.4 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_CommandTraceInfo, Tcl_TraceCommand, Tcl_UntraceCommand \- monitor renames and deletes of a command -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -ClientData -\fBTcl_CommandTraceInfo(\fIinterp, cmdName, flags, proc, prevClientData\fB)\fR -.sp -int -\fBTcl_TraceCommand(\fIinterp, cmdName, flags, proc, clientData\fB)\fR -.sp -void -\fBTcl_UntraceCommand(\fIinterp, cmdName, flags, proc, clientData\fB)\fR -.SH ARGUMENTS -.AS Tcl_CommandTraceProc prevClientData -.AP Tcl_Interp *interp in -Interpreter containing the command. -.AP "const char" *cmdName in -Name of command. -.AP int flags in -OR'ed collection of the values \fBTCL_TRACE_RENAME\fR and -\fBTCL_TRACE_DELETE\fR. -.AP Tcl_CommandTraceProc *proc in -Procedure to call when specified operations occur to \fIcmdName\fR. -.AP ClientData clientData in -Arbitrary argument to pass to \fIproc\fR. -.AP ClientData prevClientData in -If non-NULL, gives last value returned by \fBTcl_CommandTraceInfo\fR, -so this call will return information about next trace. If NULL, this -call will return information about first trace. -.BE -.SH DESCRIPTION -.PP -\fBTcl_TraceCommand\fR allows a C procedure to monitor operations -performed on a Tcl command, so that the C procedure is invoked -whenever the command is renamed or deleted. If the trace is created -successfully then \fBTcl_TraceCommand\fR returns \fBTCL_OK\fR. If an error -occurred (e.g. \fIcmdName\fR specifies a non-existent command) then -\fBTCL_ERROR\fR is returned and an error message is left in the -interpreter's result. -.PP -The \fIflags\fR argument to \fBTcl_TraceCommand\fR indicates when the -trace procedure is to be invoked. It consists of an OR'ed combination -of any of the following values: -.TP -\fBTCL_TRACE_RENAME\fR -Invoke \fIproc\fR whenever the command is renamed. -.TP -\fBTCL_TRACE_DELETE\fR -Invoke \fIproc\fR when the command is deleted. -.PP -Whenever one of the specified operations occurs to the command, -\fIproc\fR will be invoked. It should have arguments and result that -match the type \fBTcl_CommandTraceProc\fR: -.PP -.CS -typedef void \fBTcl_CommandTraceProc\fR( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR, - const char *\fIoldName\fR, - const char *\fInewName\fR, - int \fIflags\fR); -.CE -.PP -The \fIclientData\fR and \fIinterp\fR parameters will have the same -values as those passed to \fBTcl_TraceCommand\fR when the trace was -created. \fIClientData\fR typically points to an application-specific -data structure that describes what to do when \fIproc\fR is invoked. -\fIOldName\fR gives the name of the command being renamed, and -\fInewName\fR gives the name that the command is being renamed to (or -NULL when the command is being deleted.) -\fIFlags\fR is an OR'ed combination of bits potentially providing -several pieces of information. One of the bits \fBTCL_TRACE_RENAME\fR and -\fBTCL_TRACE_DELETE\fR will be set in \fIflags\fR to indicate which -operation is being performed on the command. The bit -\fBTCL_TRACE_DESTROYED\fR will be set in \fIflags\fR if the trace is about -to be destroyed; this information may be useful to \fIproc\fR so that -it can clean up its own internal data structures (see the section -\fBTCL_TRACE_DESTROYED\fR below for more details). Because the -deletion of commands can take place as part of the deletion of the interp -that contains them, \fIproc\fR must be careful about checking what -the passed in \fIinterp\fR value can be called upon to do. -The routine \fBTcl_InterpDeleted\fR is an important tool for this. -When \fBTcl_InterpDeleted\fR returns 1, \fIproc\fR will not be able -to invoke any scripts in \fIinterp\fR. The function of \fIproc\fR -in that circumstance is limited to the cleanup of its own data structures. -.PP -\fBTcl_UntraceCommand\fR may be used to remove a trace. If the -command specified by \fIinterp\fR, \fIcmdName\fR, and \fIflags\fR has -a trace set with \fIflags\fR, \fIproc\fR, and \fIclientData\fR, then -the corresponding trace is removed. If no such trace exists, then the -call to \fBTcl_UntraceCommand\fR has no effect. The same bits are -valid for \fIflags\fR as for calls to \fBTcl_TraceCommand\fR. -.PP -\fBTcl_CommandTraceInfo\fR may be used to retrieve information about -traces set on a given command. -The return value from \fBTcl_CommandTraceInfo\fR is the \fIclientData\fR -associated with a particular trace. -The trace must be on the command specified by the \fIinterp\fR, -\fIcmdName\fR, and \fIflags\fR arguments (note that currently the -flags are ignored; \fIflags\fR should be set to 0 for future -compatibility) and its trace procedure must the same as the \fIproc\fR -argument. -If the \fIprevClientData\fR argument is NULL then the return -value corresponds to the first (most recently created) matching -trace, or NULL if there are no matching traces. -If the \fIprevClientData\fR argument is not NULL, then it should -be the return value from a previous call to \fBTcl_CommandTraceInfo\fR. -In this case, the new return value will correspond to the next -matching trace after the one whose \fIclientData\fR matches -\fIprevClientData\fR, or NULL if no trace matches \fIprevClientData\fR -or if there are no more matching traces after it. -This mechanism makes it possible to step through all of the -traces for a given command that have the same \fIproc\fR. -.SH "CALLING COMMANDS DURING TRACES" -.PP -During rename traces, the command being renamed is visible with both -names simultaneously, and the command still exists during delete -traces, unless the interp that contains it is being deleted. -However, there is no -mechanism for signaling that an error occurred in a trace procedure, -so great care should be taken that errors do not get silently lost. -.SH "MULTIPLE TRACES" -.PP -It is possible for multiple traces to exist on the same command. -When this happens, all of the trace procedures will be invoked on each -access, in order from most-recently-created to least-recently-created. -Attempts to delete the command during a delete trace will fail -silently, since the command is already scheduled for deletion anyway. -If the command being renamed is renamed by one of its rename traces, -that renaming takes precedence over the one that triggered the trace -and the collection of traces will not be reexecuted; if several traces -rename the command, the last renaming takes precedence. -.SH "TCL_TRACE_DESTROYED FLAG" -.PP -In a delete callback to \fIproc\fR, the \fBTCL_TRACE_DESTROYED\fR bit -is set in \fIflags\fR. -.\" Perhaps need some more comments here? - DKF -.SH KEYWORDS -clientData, trace, command diff --git a/doc/TraceVar.3 b/doc/TraceVar.3 deleted file mode 100644 index 19cb467..0000000 --- a/doc/TraceVar.3 +++ /dev/null @@ -1,380 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_TraceVar 3 7.4 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_TraceVar, Tcl_TraceVar2, Tcl_UntraceVar, Tcl_UntraceVar2, Tcl_VarTraceInfo, Tcl_VarTraceInfo2 \- monitor accesses to a variable -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_TraceVar(\fIinterp, varName, flags, proc, clientData\fB)\fR -.sp -int -\fBTcl_TraceVar2(\fIinterp, name1, name2, flags, proc, clientData\fB)\fR -.sp -\fBTcl_UntraceVar(\fIinterp, varName, flags, proc, clientData\fB)\fR -.sp -\fBTcl_UntraceVar2(\fIinterp, name1, name2, flags, proc, clientData\fB)\fR -.sp -ClientData -\fBTcl_VarTraceInfo(\fIinterp, varName, flags, proc, prevClientData\fB)\fR -.sp -ClientData -\fBTcl_VarTraceInfo2(\fIinterp, name1, name2, flags, proc, prevClientData\fB)\fR -.SH ARGUMENTS -.AS Tcl_VarTraceProc prevClientData -.AP Tcl_Interp *interp in -Interpreter containing variable. -.AP "const char" *varName in -Name of variable. May refer to a scalar variable, to -an array variable with no index, or to an array variable -with a parenthesized index. -.AP int flags in -OR-ed combination of the values \fBTCL_TRACE_READS\fR, -\fBTCL_TRACE_WRITES\fR, \fBTCL_TRACE_UNSETS\fR, \fBTCL_TRACE_ARRAY\fR, -\fBTCL_GLOBAL_ONLY\fR, \fBTCL_NAMESPACE_ONLY\fR, -\fBTCL_TRACE_RESULT_DYNAMIC\fR and \fBTCL_TRACE_RESULT_OBJECT\fR. -Not all flags are used by all -procedures. See below for more information. -.AP Tcl_VarTraceProc *proc in -Procedure to invoke whenever one of the traced operations occurs. -.AP ClientData clientData in -Arbitrary one-word value to pass to \fIproc\fR. -.AP "const char" *name1 in -Name of scalar or array variable (without array index). -.AP "const char" *name2 in -For a trace on an element of an array, gives the index of the -element. For traces on scalar variables or on whole arrays, -is NULL. -.AP ClientData prevClientData in -If non-NULL, gives last value returned by \fBTcl_VarTraceInfo\fR or -\fBTcl_VarTraceInfo2\fR, so this call will return information about -next trace. If NULL, this call will return information about first -trace. -.BE -.SH DESCRIPTION -.PP -\fBTcl_TraceVar\fR allows a C procedure to monitor and control -access to a Tcl variable, so that the C procedure is invoked -whenever the variable is read or written or unset. -If the trace is created successfully then \fBTcl_TraceVar\fR returns -\fBTCL_OK\fR. If an error occurred (e.g. \fIvarName\fR specifies an element -of an array, but the actual variable is not an array) then \fBTCL_ERROR\fR -is returned and an error message is left in the interpreter's result. -.PP -The \fIflags\fR argument to \fBTcl_TraceVar\fR indicates when the -trace procedure is to be invoked and provides information -for setting up the trace. It consists of an OR-ed combination -of any of the following values: -.TP -\fBTCL_GLOBAL_ONLY\fR -Normally, the variable will be looked up at the current level of -procedure call; if this bit is set then the variable will be looked -up at global level, ignoring any active procedures. -.TP -\fBTCL_NAMESPACE_ONLY\fR -Normally, the variable will be looked up at the current level of -procedure call; if this bit is set then the variable will be looked -up in the current namespace, ignoring any active procedures. -.TP -\fBTCL_TRACE_READS\fR -Invoke \fIproc\fR whenever an attempt is made to read the variable. -.TP -\fBTCL_TRACE_WRITES\fR -Invoke \fIproc\fR whenever an attempt is made to modify the variable. -.TP -\fBTCL_TRACE_UNSETS\fR -Invoke \fIproc\fR whenever the variable is unset. -A variable may be unset either explicitly by an \fBunset\fR command, -or implicitly when a procedure returns (its local variables are -automatically unset) or when the interpreter is deleted (all -variables are automatically unset). -.TP -\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: -.PP -.CS -typedef char *\fBTcl_VarTraceProc\fR( - ClientData \fIclientData\fR, - Tcl_Interp *\fIinterp\fR, - char *\fIname1\fR, - char *\fIname2\fR, - int \fIflags\fR); -.CE -.PP -The \fIclientData\fR and \fIinterp\fR parameters will -have the same values as those passed to \fBTcl_TraceVar\fR when the -trace was created. -\fIClientData\fR typically points to an application-specific -data structure that describes what to do when \fIproc\fR -is invoked. -\fIName1\fR and \fIname2\fR give the name of the traced variable -in the normal two-part form (see the description of \fBTcl_TraceVar2\fR -below for details). -\fIFlags\fR is an OR-ed combination of bits providing several -pieces of information. -One of the bits \fBTCL_TRACE_READS\fR, \fBTCL_TRACE_WRITES\fR, -\fBTCL_TRACE_ARRAY\fR, or \fBTCL_TRACE_UNSETS\fR -will be set in \fIflags\fR to indicate which operation is being performed -on the variable. -The bit \fBTCL_GLOBAL_ONLY\fR will be set whenever the variable being -accessed is a global one not accessible from the current level of -procedure call: the trace procedure will need to pass this flag -back to variable-related procedures like \fBTcl_GetVar\fR if it -attempts to access the variable. -The bit \fBTCL_NAMESPACE_ONLY\fR will be set whenever the variable being -accessed is a namespace one not accessible from the current level of -procedure call: the trace procedure will need to pass this flag -back to variable-related procedures like \fBTcl_GetVar\fR if it -attempts to access the variable. -The bit \fBTCL_TRACE_DESTROYED\fR will be set in \fIflags\fR if the trace is -about to be destroyed; this information may be useful to \fIproc\fR -so that it can clean up its own internal data structures (see -the section \fBTCL_TRACE_DESTROYED\fR below for more details). -Lastly, the bit \fBTCL_INTERP_DESTROYED\fR will be set if the entire -interpreter is being destroyed. -When this bit is set, \fIproc\fR must be especially careful in -the things it does (see the section \fBTCL_INTERP_DESTROYED\fR below). -The trace procedure's return value should normally be NULL; see -\fBERROR RETURNS\fR below for information on other possibilities. -.PP -\fBTcl_UntraceVar\fR may be used to remove a trace. -If the variable specified by \fIinterp\fR, \fIvarName\fR, and \fIflags\fR -has a trace set with \fIflags\fR, \fIproc\fR, and -\fIclientData\fR, then the corresponding trace is removed. -If no such trace exists, then the call to \fBTcl_UntraceVar\fR -has no effect. -The same bits are valid for \fIflags\fR as for calls to \fBTcl_TraceVar\fR. -.PP -\fBTcl_VarTraceInfo\fR may be used to retrieve information about -traces set on a given variable. -The return value from \fBTcl_VarTraceInfo\fR is the \fIclientData\fR -associated with a particular trace. -The trace must be on the variable specified by the \fIinterp\fR, -\fIvarName\fR, and \fIflags\fR arguments (only the \fBTCL_GLOBAL_ONLY\fR and -\fBTCL_NAMESPACE_ONLY\fR bits from \fIflags\fR is used; other bits are -ignored) and its trace procedure must the same as the \fIproc\fR -argument. -If the \fIprevClientData\fR argument is NULL then the return -value corresponds to the first (most recently created) matching -trace, or NULL if there are no matching traces. -If the \fIprevClientData\fR argument is not NULL, then it should -be the return value from a previous call to \fBTcl_VarTraceInfo\fR. -In this case, the new return value will correspond to the next -matching trace after the one whose \fIclientData\fR matches -\fIprevClientData\fR, or NULL if no trace matches \fIprevClientData\fR -or if there are no more matching traces after it. -This mechanism makes it possible to step through all of the -traces for a given variable that have the same \fIproc\fR. -.SH "TWO-PART NAMES" -.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" -.PP -During read, write, and array traces, the -trace procedure can read, write, or unset the traced -variable using \fBTcl_GetVar2\fR, \fBTcl_SetVar2\fR, and -other procedures. -While \fIproc\fR is executing, traces are temporarily disabled -for the variable, so that calls to \fBTcl_GetVar2\fR and -\fBTcl_SetVar2\fR will not cause \fIproc\fR or other trace procedures -to be invoked again. -Disabling only occurs for the variable whose trace procedure -is active; accesses to other variables will still be traced. -However, if a variable is unset during a read or write trace then unset -traces will be invoked. -.PP -During unset traces the variable has already been completely -expunged. -It is possible for the trace procedure to read or write the -variable, but this will be a new version of the variable. -Traces are not disabled during unset traces as they are for -read and write traces, but existing traces have been removed -from the variable before any trace procedures are invoked. -If new traces are set by unset trace procedures, these traces -will be invoked on accesses to the variable by the trace -procedures. -.SH "CALLBACK TIMING" -.PP -When read tracing has been specified for a variable, the trace -procedure will be invoked whenever the variable's value is -read. This includes \fBset\fR Tcl commands, \fB$\fR-notation -in Tcl commands, and invocations of the \fBTcl_GetVar\fR -and \fBTcl_GetVar2\fR procedures. -\fIProc\fR is invoked just before the variable's value is -returned. -It may modify the value of the variable to affect what -is returned by the traced access. -If it unsets the variable then the access will return an error -just as if the variable never existed. -.PP -When write tracing has been specified for a variable, the -trace procedure will be invoked whenever the variable's value -is modified. This includes \fBset\fR commands, -commands that modify variables as side effects (such as -\fBcatch\fR and \fBscan\fR), and calls to the \fBTcl_SetVar\fR -and \fBTcl_SetVar2\fR procedures). -\fIProc\fR will be invoked after the variable's value has been -modified, but before the new value of the variable has been -returned. -It may modify the value of the variable to override the change -and to determine the value actually returned by the traced -access. -If it deletes the variable then the traced access will return -an empty string. -.PP -When array tracing has been specified, the trace procedure -will be invoked at the beginning of the array command implementation, -before any of the operations like get, set, or names have been invoked. -The trace procedure can modify the array elements with \fBTcl_SetVar\fR -and \fBTcl_SetVar2\fR. -.PP -When unset tracing has been specified, the trace procedure -will be invoked whenever the variable is destroyed. -The traces will be called after the variable has been -completely unset. -.SH "WHOLE-ARRAY TRACES" -.PP -If a call to \fBTcl_TraceVar\fR or \fBTcl_TraceVar2\fR specifies -the name of an array variable without an index into the array, -then the trace will be set on the array as a whole. -This means that \fIproc\fR will be invoked whenever any -element of the array is accessed in the ways specified by -\fIflags\fR. -When an array is unset, a whole-array trace will be invoked -just once, with \fIname1\fR equal to the name of the array -and \fIname2\fR NULL; it will not be invoked once for each -element. -.SH "MULTIPLE TRACES" -.PP -It is possible for multiple traces to exist on the same variable. -When this happens, all of the trace procedures will be invoked on each -access, in order from most-recently-created to least-recently-created. -When there exist whole-array traces for an array as well as -traces on individual elements, the whole-array traces are invoked -before the individual-element traces. -If a read or write trace unsets the variable then all of the unset -traces will be invoked but the remainder of the read and write traces -will be skipped. -.SH "ERROR RETURNS" -.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 -value). -.PP -The return value from \fIproc\fR is only used during read and -write tracing. -During unset traces, the return value is ignored and all relevant -trace procedures will always be invoked. -.SH "RESTRICTIONS" -.PP -A trace procedure can be called at any time, even when there -is a partially formed result in the interpreter's result area. If -the trace procedure does anything that could damage this result (such -as calling \fBTcl_Eval\fR) then it must save the original values of -the interpreter's \fBresult\fR and \fBfreeProc\fR fields and restore -them before it returns. -.SH "UNDEFINED VARIABLES" -.PP -It is legal to set a trace on an undefined variable. -The variable will still appear to be undefined until the -first time its value is set. -If an undefined variable is traced and then unset, the unset will fail -with an error -.PQ "no such variable" "" , -but the trace procedure will still be invoked. -.SH "TCL_TRACE_DESTROYED FLAG" -.PP -In an unset callback to \fIproc\fR, the \fBTCL_TRACE_DESTROYED\fR bit -is set in \fIflags\fR if the trace is being removed as part -of the deletion. -Traces on a variable are always removed whenever the variable -is deleted; the only time \fBTCL_TRACE_DESTROYED\fR is not set is for -a whole-array trace invoked when only a single element of an -array is unset. -.SH "TCL_INTERP_DESTROYED" -.PP -When an interpreter is destroyed, unset traces are called for -all of its variables. -The \fBTCL_INTERP_DESTROYED\fR bit will be set in the \fIflags\fR -argument passed to the trace procedures. -Trace procedures must be extremely careful in what they do if -the \fBTCL_INTERP_DESTROYED\fR bit is set. -It is not safe for the procedures to invoke any Tcl procedures -on the interpreter, since its state is partially deleted. -All that trace procedures should do under these circumstances is -to clean up and free their own internal data structures. -.SH BUGS -.PP -Tcl does not do any error checking to prevent trace procedures -from misusing the interpreter during traces with \fBTCL_INTERP_DESTROYED\fR -set. -.PP -Array traces are not yet integrated with the Tcl \fBinfo exists\fR command, -nor is there Tcl-level access to array traces. -.SH "SEE ALSO" -trace(n) -.SH KEYWORDS -clientData, trace, variable diff --git a/doc/Translate.3 b/doc/Translate.3 deleted file mode 100644 index 38831d3..0000000 --- a/doc/Translate.3 +++ /dev/null @@ -1,71 +0,0 @@ -'\" -'\" Copyright (c) 1989-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. -'\" -.TH Tcl_TranslateFileName 3 8.1 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_TranslateFileName \- convert file name to native form and replace tilde with home directory -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -char * -\fBTcl_TranslateFileName\fR(\fIinterp\fR, \fIname\fR, \fIbufferPtr\fR) -.SH ARGUMENTS -.AS Tcl_DString *bufferPtr in/out -.AP Tcl_Interp *interp in -Interpreter in which to report an error, if any. -.AP "const char" *name in -File name, which may start with a -.QW ~ . -.AP Tcl_DString *bufferPtr in/out -If needed, this dynamic string is used to store the new file name. -At the time of the call it should be uninitialized or free. The -caller must eventually call \fBTcl_DStringFree\fR to free up -anything stored here. -.BE -.SH DESCRIPTION -.PP -This utility procedure translates a file name to a platform-specific form -which, after being converted to the appropriate encoding, is suitable for -passing to the local operating system. In particular, it converts -network names into native form and does tilde substitution. -.PP -However, with the advent of the newer \fBTcl_FSGetNormalizedPath\fR and -\fBTcl_FSGetNativePath\fR, there is no longer any need to use this -procedure. In particular, \fBTcl_FSGetNativePath\fR performs all the -necessary translation and encoding conversion, is virtual-filesystem -aware, and caches the native result for faster repeated calls. -Finally \fBTcl_FSGetNativePath\fR does not require you to free anything -afterwards. -.PP -If -\fBTcl_TranslateFileName\fR has to do tilde substitution or translate -the name then it uses -the dynamic string at \fI*bufferPtr\fR to hold the new string it -generates. -After \fBTcl_TranslateFileName\fR returns a non-NULL result, the caller must -eventually invoke \fBTcl_DStringFree\fR to free any information -placed in \fI*bufferPtr\fR. The caller need not know whether or -not \fBTcl_TranslateFileName\fR actually used the string; \fBTcl_TranslateFileName\fR -initializes \fI*bufferPtr\fR even if it does not use it, so the call to -\fBTcl_DStringFree\fR will be safe in either case. -.PP -If an error occurs (e.g. because there was no user by the given -name) then NULL is returned and an error message will be left -in the interpreter's result. -When an error occurs, \fBTcl_TranslateFileName\fR -frees the dynamic string itself so that the caller need not call -\fBTcl_DStringFree\fR. -.PP -The caller is responsible for making sure that the interpreter's result -has its default empty value when \fBTcl_TranslateFileName\fR is invoked. -.SH "SEE ALSO" -filename(n) -.SH KEYWORDS -file name, home directory, tilde, translate, user diff --git a/doc/UniCharIsAlpha.3 b/doc/UniCharIsAlpha.3 deleted file mode 100644 index 2336c34..0000000 --- a/doc/UniCharIsAlpha.3 +++ /dev/null @@ -1,91 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_UniCharIsAlpha 3 "8.1" Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_UniCharIsAlnum, Tcl_UniCharIsAlpha, Tcl_UniCharIsControl, Tcl_UniCharIsDigit, Tcl_UniCharIsGraph, Tcl_UniCharIsLower, Tcl_UniCharIsPrint, Tcl_UniCharIsPunct, Tcl_UniCharIsSpace, Tcl_UniCharIsUpper, Tcl_UniCharIsWordChar \- routines for classification of Tcl_UniChar characters -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_UniCharIsAlnum\fR(\fIch\fR) -.sp -int -\fBTcl_UniCharIsAlpha\fR(\fIch\fR) -.sp -int -\fBTcl_UniCharIsControl\fR(\fIch\fR) -.sp -int -\fBTcl_UniCharIsDigit\fR(\fIch\fR) -.sp -int -\fBTcl_UniCharIsGraph\fR(\fIch\fR) -.sp -int -\fBTcl_UniCharIsLower\fR(\fIch\fR) -.sp -int -\fBTcl_UniCharIsPrint\fR(\fIch\fR) -.sp -int -\fBTcl_UniCharIsPunct\fR(\fIch\fR) -.sp -int -\fBTcl_UniCharIsSpace\fR(\fIch\fR) -.sp -int -\fBTcl_UniCharIsUpper\fR(\fIch\fR) -.sp -int -\fBTcl_UniCharIsWordChar\fR(\fIch\fR) -.SH ARGUMENTS -.AS int ch -.AP int ch in -The Tcl_UniChar to be examined. -.BE - -.SH DESCRIPTION -.PP -All of the routines described examine Tcl_UniChars and return a -boolean value. A non-zero return value means that the character does -belong to the character class associated with the called routine. The -rest of this document just describes the character classes associated -with the various routines. -.PP -Note: A Tcl_UniChar is a Unicode character represented as an unsigned, -fixed-size quantity. - -.SH "CHARACTER CLASSES" -.PP -\fBTcl_UniCharIsAlnum\fR tests if the character is an alphanumeric Unicode character. -.PP -\fBTcl_UniCharIsAlpha\fR tests if the character is an alphabetic Unicode character. -.PP -\fBTcl_UniCharIsControl\fR tests if the character is a Unicode control character. -.PP -\fBTcl_UniCharIsDigit\fR tests if the character is a numeric Unicode character. -.PP -\fBTcl_UniCharIsGraph\fR tests if the character is any Unicode print character except space. -.PP -\fBTcl_UniCharIsLower\fR tests if the character is a lowercase Unicode character. -.PP -\fBTcl_UniCharIsPrint\fR tests if the character is a Unicode print character. -.PP -\fBTcl_UniCharIsPunct\fR tests if the character is a Unicode punctuation character. -.PP -\fBTcl_UniCharIsSpace\fR tests if the character is a whitespace Unicode character. -.PP -\fBTcl_UniCharIsUpper\fR tests if the character is an uppercase Unicode character. -.PP -\fBTcl_UniCharIsWordChar\fR tests if the character is alphanumeric or -a connector punctuation mark. - -.SH KEYWORDS -unicode, classification diff --git a/doc/UpVar.3 b/doc/UpVar.3 deleted file mode 100644 index 9e17ed5..0000000 --- a/doc/UpVar.3 +++ /dev/null @@ -1,74 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_UpVar 3 7.4 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_UpVar, Tcl_UpVar2 \- link one variable to another -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -int -\fBTcl_UpVar(\fIinterp, frameName, sourceName, destName, flags\fB)\fR -.sp -int -\fBTcl_UpVar2(\fIinterp, frameName, name1, name2, destName, flags\fB)\fR -.SH ARGUMENTS -.AS "const char" *sourceName -.AP Tcl_Interp *interp in -Interpreter containing variables; also used for error reporting. -.AP "const char" *frameName in -Identifies the stack frame containing source variable. -May have any of the forms accepted by -the \fBupvar\fR command, such as \fB#0\fR or \fB1\fR. -.AP "const char" *sourceName in -Name of source variable, in the frame given by \fIframeName\fR. -May refer to a scalar variable or to an array variable with a -parenthesized index. -.AP "const char" *destName in -Name of destination variable, which is to be linked to source -variable so that references to \fIdestName\fR -refer to the other variable. Must not currently exist except as -an upvar-ed variable. -.AP int flags in -One of \fBTCL_GLOBAL_ONLY\fR, \fBTCL_NAMESPACE_ONLY\fR or 0; if non-zero, -then \fIdestName\fR is a global or namespace variable; otherwise it is -local to the current procedure (or current namespace if no procedure is -active). -.AP "const char" *name1 in -First part of source variable's name (scalar name, or name of array -without array index). -.AP "const char" *name2 in -If source variable is an element of an array, gives the index of the element. -For scalar source variables, is NULL. -.BE - -.SH DESCRIPTION -.PP -\fBTcl_UpVar\fR and \fBTcl_UpVar2\fR provide the same functionality -as the \fBupvar\fR command: they make a link from a source variable -to a destination variable, so that references to the destination are -passed transparently through to the source. -The name of the source variable may be specified either as a single -string such as \fBxyx\fR or \fBa(24)\fR (by calling \fBTcl_UpVar\fR) -or in two parts where the array name has been separated from the -element name (by calling \fBTcl_UpVar2\fR). -The destination variable name is specified in a single string; it -may not be an array element. -.PP -Both procedures return either \fBTCL_OK\fR or \fBTCL_ERROR\fR, and they -leave an error message in the interpreter's result if an error occurs. -.PP -As with the \fBupvar\fR command, the source variable need not exist; -if it does exist, unsetting it later does not destroy the link. The -destination variable may exist at the time of the call, but if so -it must exist as a linked variable. - -.SH KEYWORDS -linked variable, upvar, variable diff --git a/doc/Utf.3 b/doc/Utf.3 deleted file mode 100644 index 378c806..0000000 --- a/doc/Utf.3 +++ /dev/null @@ -1,259 +0,0 @@ -'\" -'\" 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. -'\" -.TH Utf 3 "8.1" Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_UniChar, Tcl_UniCharToUtf, Tcl_UtfToUniChar, Tcl_UniCharToUtfDString, Tcl_UtfToUniCharDString, Tcl_UniCharLen, Tcl_UniCharNcmp, Tcl_UniCharNcasecmp, Tcl_UniCharCaseMatch, Tcl_UtfNcmp, Tcl_UtfNcasecmp, 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 \fR -.sp -typedef ... \fBTcl_UniChar\fR; -.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 -a varying-length sequence of up to \fBTCL_UTF_MAX\fR bytes. A multibyte UTF-8 -sequence consists of a lead byte followed by some number of trail bytes. -.PP -\fBTCL_UTF_MAX\fR is the maximum number of bytes that it takes to -represent one Unicode character in the UTF-8 representation. -.PP -\fBTcl_UniCharToUtf\fR stores the Tcl_UniChar \fIch\fR as a UTF-8 string -in starting at \fIbuf\fR. The return value is the number of bytes stored -in \fIbuf\fR. -.PP -\fBTcl_UtfToUniChar\fR reads one UTF-8 character starting at \fIsrc\fR -and stores it as a Tcl_UniChar in \fI*chPtr\fR. The return value is the -number of bytes read from \fIsrc\fR. The caller must ensure that the -source buffer is long enough such that this routine does not run off the -end and dereference non-existent or random memory; if the source buffer -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 -.QW \-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 -\fBTcl_UtfFindLast\fR corresponds to \fBstrrchr\fR for UTF-8 strings. It -returns a pointer to the last 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 -Given \fIsrc\fR, a pointer to some location in a UTF-8 string, -\fBTcl_UtfNext\fR returns a pointer to the next UTF-8 character in the -string. The caller must not ask for the next character after the last -character in the string if the string is not terminated by a null -character. -.PP -Given \fIsrc\fR, a pointer to some location in a UTF-8 string (or to a -null byte immediately following such a string), \fBTcl_UtfPrev\fR -returns a pointer to the closest preceding byte that starts a UTF-8 -character. -This function will not back up to a position before \fIstart\fR, -the start of the UTF-8 string. If \fIsrc\fR was already at \fIstart\fR, the -return value will be \fIstart\fR. -.PP -\fBTcl_UniCharAtIndex\fR corresponds to a C string array dereference or the -Pascal Ord() function. It returns the Tcl_UniChar represented at the -specified character (not byte) \fIindex\fR in the UTF-8 string -\fIsrc\fR. The source string must contain at least \fIindex\fR -characters. Behavior is undefined if a negative \fIindex\fR is given. -.PP -\fBTcl_UtfAtIndex\fR returns a pointer to the specified character (not -byte) \fIindex\fR in the UTF-8 string \fIsrc\fR. The source string must -contain at least \fIindex\fR characters. This is equivalent to calling -\fBTcl_UtfNext\fR \fIindex\fR times. If a negative \fIindex\fR is given, -the return pointer points to the first character in the source string. -.PP -\fBTcl_UtfBackslash\fR is a utility procedure used by several of the Tcl -commands. It parses a backslash sequence and stores the properly formed -UTF-8 character represented by the backslash sequence in the output -buffer \fIdst\fR. At most \fBTCL_UTF_MAX\fR bytes are stored in the buffer. -\fBTcl_UtfBackslash\fR modifies \fI*readPtr\fR to contain the number -of bytes in the backslash sequence, including the backslash character. -The return value is the number of bytes stored in the output buffer. -.PP -See the \fBTcl\fR manual entry for information on the valid backslash -sequences. All of the sequences described in the Tcl manual entry are -supported by \fBTcl_UtfBackslash\fR. - -.SH KEYWORDS -utf, unicode, backslash diff --git a/doc/WrongNumArgs.3 b/doc/WrongNumArgs.3 deleted file mode 100644 index 93e2ebb..0000000 --- a/doc/WrongNumArgs.3 +++ /dev/null @@ -1,79 +0,0 @@ -'\" -'\" 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. -'\" -.TH Tcl_WrongNumArgs 3 8.0 Tcl "Tcl Library Procedures" -.so man.macros -.BS -.SH NAME -Tcl_WrongNumArgs \- generate standard error message for wrong number of arguments -.SH SYNOPSIS -.nf -\fB#include \fR -.sp -\fBTcl_WrongNumArgs\fR(\fIinterp, objc, objv, message\fR) -.SH ARGUMENTS -.AS "Tcl_Obj *const" *message -.AP Tcl_Interp interp in -Interpreter in which error will be reported: error message gets stored -in its result value. -.AP int objc in -Number of leading arguments from \fIobjv\fR to include in error -message. -.AP "Tcl_Obj *const" objv[] in -Arguments to command that had the wrong number of arguments. -.AP "const char" *message in -Additional error information to print after leading arguments -from \fIobjv\fR. This typically gives the acceptable syntax -of the command. This argument may be NULL. -.BE -.SH DESCRIPTION -.PP -\fBTcl_WrongNumArgs\fR is a utility procedure that is invoked by -command procedures when they discover that they have received the -wrong number of arguments. \fBTcl_WrongNumArgs\fR generates a -standard error message and stores it in the result value of -\fIinterp\fR. The message includes the \fIobjc\fR initial -elements of \fIobjv\fR plus \fImessage\fR. For example, if -\fIobjv\fR consists of the values \fBfoo\fR and \fBbar\fR, -\fIobjc\fR is 1, and \fImessage\fR is -.QW "\fBfileName count\fR" -then \fIinterp\fR's result value will be set to the following -string: -.PP -.CS -wrong # args: should be "foo fileName count" -.CE -.PP -If \fIobjc\fR is 2, the result will be set to the following string: -.PP -.CS -wrong # args: should be "foo bar fileName count" -.CE -.PP -\fIObjc\fR is usually 1, but may be 2 or more for commands like -\fBstring\fR and the Tk widget commands, which use the first argument -as a subcommand. -.PP -Some of the values in the \fIobjv\fR array may be abbreviations for -a subcommand. The command -\fBTcl_GetIndexFromObj\fR will convert the abbreviated string value -into an \fIindexObject\fR. If an error occurs in the parsing of the -subcommand we would like to use the full subcommand name rather than -the abbreviation. If the \fBTcl_WrongNumArgs\fR command finds any -\fIindexObjects\fR in the \fIobjv\fR array it will use the full subcommand -name in the error message instead of the abbreviated name that was -originally passed in. Using the above example, let us assume that -\fIbar\fR is actually an abbreviation for \fIbarfly\fR and the value -is now an \fIindexObject\fR because it was passed to -\fBTcl_GetIndexFromObj\fR. In this case the error message would be: -.PP -.CS -wrong # args: should be "foo barfly fileName count" -.CE -.SH "SEE ALSO" -Tcl_GetIndexFromObj(3) -.SH KEYWORDS -command, error message, wrong number of arguments diff --git a/doc/after.n b/doc/after.n deleted file mode 100644 index 3d0d2c4..0000000 --- a/doc/after.n +++ /dev/null @@ -1,151 +0,0 @@ -'\" -'\" Copyright (c) 1990-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. -'\" -.TH after n 7.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -after \- Execute a command after a time delay -.SH SYNOPSIS -\fBafter \fIms\fR -.sp -\fBafter \fIms \fR?\fIscript script script ...\fR? -.sp -\fBafter cancel \fIid\fR -.sp -\fBafter cancel \fIscript script script ...\fR -.sp -\fBafter idle \fR?\fIscript script script ...\fR? -.sp -\fBafter info \fR?\fIid\fR? -.BE -.SH DESCRIPTION -.PP -This command is used to delay execution of the program or to execute -a command in background sometime in the future. It has several forms, -depending on the first argument to the command: -.TP -\fBafter \fIms\fR -. -\fIMs\fR must be an integer giving a time in milliseconds. -The command sleeps for \fIms\fR milliseconds and then returns. -While the command is sleeping the application does not respond to -events. -.TP -\fBafter \fIms \fR?\fIscript script script ...\fR? -. -In this form the command returns immediately, but it arranges -for a Tcl command to be executed \fIms\fR milliseconds later as an -event handler. -The command will be executed exactly once, at the given time. -The delayed command is formed by concatenating all the \fIscript\fR -arguments in the same fashion as the \fBconcat\fR command. -The command will be executed at global level (outside the context -of any Tcl procedure). -If an error occurs while executing the delayed command then -the background error will be reported by the command -registered with \fBinterp bgerror\fR. -The \fBafter\fR command returns an identifier that can be used -to cancel the delayed command using \fBafter cancel\fR. -.TP -\fBafter cancel \fIid\fR -. -Cancels the execution of a delayed command that -was previously scheduled. -\fIId\fR indicates which command should be canceled; it must have -been the return value from a previous \fBafter\fR command. -If the command given by \fIid\fR has already been executed then -the \fBafter cancel\fR command has no effect. -.TP -\fBafter cancel \fIscript script ...\fR -. -This command also cancels the execution of a delayed command. -The \fIscript\fR arguments are concatenated together with space -separators (just as in the \fBconcat\fR command). -If there is a pending command that matches the string, it is -canceled and will never be executed; if no such command is -currently pending then the \fBafter cancel\fR command has no effect. -.TP -\fBafter idle \fIscript \fR?\fIscript script ...\fR? -. -Concatenates the \fIscript\fR arguments together with space -separators (just as in the \fBconcat\fR command), and arranges -for the resulting script to be evaluated later as an idle callback. -The script will be run exactly once, the next time the event -loop is entered and there are no events to process. -The command returns an identifier that can be used -to cancel the delayed command using \fBafter cancel\fR. -If an error occurs while executing the script then the -background error will be reported by the command -registered with \fBinterp bgerror\fR. -.TP -\fBafter info \fR?\fIid\fR? -. -This command returns information about existing event handlers. -If no \fIid\fR argument is supplied, the command returns -a list of the identifiers for all existing -event handlers created by the \fBafter\fR command for this -interpreter. -If \fIid\fR is supplied, it specifies an existing handler; -\fIid\fR must have been the return value from some previous call -to \fBafter\fR and it must not have triggered yet or been canceled. -In this case the command returns a list with two elements. -The first element of the list is the script associated -with \fIid\fR, and the second element is either -\fBidle\fR or \fBtimer\fR to indicate what kind of event -handler it is. -.LP -The \fBafter \fIms\fR and \fBafter idle\fR forms of the command -assume that the application is event driven: the delayed commands -will not be executed unless the application enters the event loop. -In applications that are not normally event-driven, such as -\fBtclsh\fR, the event loop can be entered with the \fBvwait\fR -and \fBupdate\fR commands. -.SH "EXAMPLES" -This defines a command to make Tcl do nothing at all for \fIN\fR -seconds: -.PP -.CS -proc sleep {N} { - \fBafter\fR [expr {int($N * 1000)}] -} -.CE -.PP -This arranges for the command \fIwake_up\fR to be run in eight hours -(providing the event loop is active at that time): -.PP -.CS -\fBafter\fR [expr {1000 * 60 * 60 * 8}] wake_up -.CE -.PP -The following command can be used to do long-running calculations (as -represented here by \fI::my_calc::one_step\fR, which is assumed to -return a boolean indicating whether another step should be performed) -in a step-by-step fashion, though the calculation itself needs to be -arranged so it can work step-wise. This technique is extra careful to -ensure that the event loop is not starved by the rescheduling of -processing steps (arranging for the next step to be done using an -already-triggered timer event only when the event queue has been -drained) and is useful when you want to ensure that a Tk GUI remains -responsive during a slow task. -.PP -.CS -proc doOneStep {} { - if {[::my_calc::one_step]} { - \fBafter idle\fR [list \fBafter\fR 0 doOneStep] - } -} -doOneStep -.CE -.SH "SEE ALSO" -concat(n), interp(n), update(n), vwait(n) -.SH KEYWORDS -cancel, delay, idle callback, sleep, time -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/append.n b/doc/append.n deleted file mode 100644 index e3bf224..0000000 --- a/doc/append.n +++ /dev/null @@ -1,49 +0,0 @@ -'\" -'\" 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. -'\" -.TH append n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -append \- Append to variable -.SH SYNOPSIS -\fBappend \fIvarName \fR?\fIvalue value value ...\fR? -.BE -.SH DESCRIPTION -.PP -Append all of the \fIvalue\fR arguments to the current value -of variable \fIvarName\fR. If \fIvarName\fR does not exist, -it is given a value equal to the concatenation of all the -\fIvalue\fR arguments. -The result of this command is the new value stored in variable -\fIvarName\fR. -This command provides an efficient way to build up long -variables incrementally. -For example, -.QW "\fBappend a $b\fR" -is much more efficient than -.QW "\fBset a $a$b\fR" -if \fB$a\fR is long. -.SH EXAMPLE -Building a string of comma-separated numbers piecemeal using a loop. -.PP -.CS -set var 0 -for {set i 1} {$i<=10} {incr i} { - \fBappend\fR var "," $i -} -puts $var -# Prints 0,1,2,3,4,5,6,7,8,9,10 -.CE -.SH "SEE ALSO" -concat(n), lappend(n) -.SH KEYWORDS -append, variable -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/apply.n b/doc/apply.n deleted file mode 100644 index aeb2227..0000000 --- a/doc/apply.n +++ /dev/null @@ -1,102 +0,0 @@ -'\" -'\" Copyright (c) 2006 Miguel Sofer -'\" Copyright (c) 2006 Donal K. Fellows -'\" -.TH apply n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -apply \- Apply an anonymous function -.SH SYNOPSIS -\fBapply \fIfunc\fR ?\fIarg1 arg2 ...\fR? -.BE -.SH DESCRIPTION -.PP -The command \fBapply\fR applies the function \fIfunc\fR to the arguments -\fIarg1 arg2 ...\fR and returns the result. -.PP -The function \fIfunc\fR is a two element list \fI{args body}\fR or a three -element list \fI{args body namespace}\fR (as if the -\fBlist\fR command had been used). -The first element \fIargs\fR specifies the formal arguments to -\fIfunc\fR. The specification of the formal arguments \fIargs\fR -is shared with the \fBproc\fR command, and is described in detail in the -corresponding manual page. -.PP -The contents of \fIbody\fR are executed by the Tcl interpreter -after the local variables corresponding to the formal arguments are given -the values of the actual parameters \fIarg1 arg2 ...\fR. -When \fIbody\fR is being executed, variable names normally refer to -local variables, which are created automatically when referenced and -deleted when \fBapply\fR returns. One local variable is automatically -created for each of the function's arguments. -Global variables can only be accessed by invoking -the \fBglobal\fR command or the \fBupvar\fR command. -Namespace variables can only be accessed by invoking -the \fBvariable\fR command or the \fBupvar\fR command. -.PP -The invocation of \fBapply\fR adds a call frame to Tcl's evaluation stack -(the stack of frames accessed via \fBuplevel\fR). The execution of \fIbody\fR -proceeds in this call frame, in the namespace given by \fInamespace\fR or -in the global namespace if none was specified. If given, \fInamespace\fR is -interpreted relative to the global namespace even if its name does not start -with -.QW :: . -.PP -The semantics of \fBapply\fR can also be described by: -.PP -.CS -proc apply {fun args} { - set len [llength $fun] - if {($len < 2) || ($len > 3)} { - error "can't interpret \e"$fun\e" as anonymous function" - } - lassign $fun argList body ns - set name ::$ns::[getGloballyUniqueName] - set body0 { - rename [lindex [info level 0] 0] {} - } - proc $name $argList ${body0}$body - set code [catch {uplevel 1 $name $args} res opt] - return -options $opt $res -} -.CE -.SH EXAMPLES -.PP -This shows how to make a simple general command that applies a transformation -to each element of a list. -.PP -.CS -proc map {lambda list} { - set result {} - foreach item $list { - lappend result [\fBapply\fR $lambda $item] - } - return $result -} -map {x {return [string length $x]:$x}} {a bb ccc dddd} - \fI\(-> 1:a 2:bb 3:ccc 4:dddd\fR -map {x {expr {$x**2 + 3*$x - 2}}} {-4 -3 -2 -1 0 1 2 3 4} - \fI\(-> 2 -2 -4 -4 -2 2 8 16 26\fR -.CE -.PP -The \fBapply\fR command is also useful for defining callbacks for use in the -\fBtrace\fR command: -.PP -.CS -set vbl "123abc" -trace add variable vbl write {\fBapply\fR {{v1 v2 op} { - upvar 1 $v1 v - puts "updated variable to \e"$v\e"" -}}} -set vbl 123 -set vbl abc -.CE -.SH "SEE ALSO" -proc(n), uplevel(n) -.SH KEYWORDS -anonymous function, argument, lambda, procedure, -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/array.n b/doc/array.n deleted file mode 100644 index 25ad0c6..0000000 --- a/doc/array.n +++ /dev/null @@ -1,187 +0,0 @@ -'\" -'\" 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. -'\" -.TH array n 8.3 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -array \- Manipulate array variables -.SH SYNOPSIS -\fBarray \fIoption arrayName\fR ?\fIarg arg ...\fR? -.BE -.SH DESCRIPTION -.PP -This command performs one of several operations on the -variable given by \fIarrayName\fR. -Unless otherwise specified for individual commands below, -\fIarrayName\fR must be the name of an existing array variable. -The \fIoption\fR argument determines what action is carried -out by the command. -The legal \fIoptions\fR (which may be abbreviated) are: -.TP -\fBarray anymore \fIarrayName searchId\fR -Returns 1 if there are any more elements left to be processed -in an array search, 0 if all elements have already been -returned. -\fISearchId\fR indicates which search on \fIarrayName\fR to -check, and must have been the return value from a previous -invocation of \fBarray startsearch\fR. -This option is particularly useful if an array has an element -with an empty name, since the return value from -\fBarray nextelement\fR will not indicate whether the search -has been completed. -.TP -\fBarray donesearch \fIarrayName searchId\fR -This command terminates an array search and destroys all the -state associated with that search. \fISearchId\fR indicates -which search on \fIarrayName\fR to destroy, and must have -been the return value from a previous invocation of -\fBarray startsearch\fR. Returns an empty string. -.TP -\fBarray exists \fIarrayName\fR -Returns 1 if \fIarrayName\fR is an array variable, 0 if there -is no variable by that name or if it is a scalar variable. -.TP -\fBarray get \fIarrayName\fR ?\fIpattern\fR? -Returns a list containing pairs of elements. The first -element in each pair is the name of an element in \fIarrayName\fR -and the second element of each pair is the value of the -array element. The order of the pairs is undefined. -If \fIpattern\fR is not specified, then all of the elements of the -array are included in the result. -If \fIpattern\fR is specified, then only those elements whose names -match \fIpattern\fR (using the matching rules of -\fBstring match\fR) are included. -If \fIarrayName\fR is not the name of an array variable, or if -the array contains no elements, then an empty list is returned. -If traces on the array modify the list of elements, the elements -returned are those that exist both before and after the call to -\fBarray get\fR. -.TP -\fBarray names \fIarrayName\fR ?\fImode\fR? ?\fIpattern\fR? -Returns a list containing the names of all of the elements in -the array that match \fIpattern\fR. \fIMode\fR may be one of -\fB\-exact\fR, \fB\-glob\fR, or \fB\-regexp\fR. If specified, \fImode\fR -designates which matching rules to use to match \fIpattern\fR against -the names of the elements in the array. If not specified, \fImode\fR -defaults to \fB\-glob\fR. See the documentation for \fBstring match\fR -for information on glob style matching, and the documentation for -\fBregexp\fR for information on regexp matching. -If \fIpattern\fR is omitted then the command returns all of -the element names in the array. If there are no (matching) elements -in the array, or if \fIarrayName\fR is not the name of an array -variable, then an empty string is returned. -.TP -\fBarray nextelement \fIarrayName searchId\fR -Returns the name of the next element in \fIarrayName\fR, or -an empty string if all elements of \fIarrayName\fR have -already been returned in this search. The \fIsearchId\fR -argument identifies the search, and must have -been the return value of an \fBarray startsearch\fR command. -Warning: if elements are added to or deleted from the array, -then all searches are automatically terminated just as if -\fBarray donesearch\fR had been invoked; this will cause -\fBarray nextelement\fR operations to fail for those searches. -.TP -\fBarray set \fIarrayName list\fR -Sets the values of one or more elements in \fIarrayName\fR. -\fIlist\fR must have a form like that returned by \fBarray get\fR, -consisting of an even number of elements. -Each odd-numbered element in \fIlist\fR is treated as an element -name within \fIarrayName\fR, and the following element in \fIlist\fR -is used as a new value for that array element. -If the variable \fIarrayName\fR does not already exist -and \fIlist\fR is empty, -\fIarrayName\fR is created with an empty array value. -.TP -\fBarray size \fIarrayName\fR -Returns a decimal string giving the number of elements in the -array. -If \fIarrayName\fR is not the name of an array then 0 is returned. -.TP -\fBarray startsearch \fIarrayName\fR -This command initializes an element-by-element search through the -array given by \fIarrayName\fR, such that invocations of the -\fBarray nextelement\fR command will return the names of the -individual elements in the array. -When the search has been completed, the \fBarray donesearch\fR -command should be invoked. -The return value is a -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 is not 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 -} - -foreach {color count} [\fBarray get\fR colorcount] { - puts "Color: $color Count: $count" -} - \fB\(->\fR Color: blue Count: 4 - Color: white Count: 9 - Color: green Count: 5 - Color: red Count: 1 - -foreach color [\fBarray names\fR colorcount] { - puts "Color: $color Count: $colorcount($color)" -} - \fB\(->\fR Color: blue Count: 4 - Color: white Count: 9 - Color: green Count: 5 - Color: red Count: 1 - -foreach color [lsort [\fBarray names\fR colorcount]] { - puts "Color: $color Count: $colorcount($color)" -} - \fB\(->\fR Color: blue Count: 4 - Color: green Count: 5 - Color: red Count: 1 - Color: white Count: 9 - -\fBarray statistics\fR colorcount - \fB\(->\fR 4 entries in table, 4 buckets - number of buckets with 0 entries: 1 - number of buckets with 1 entries: 2 - number of buckets with 2 entries: 1 - number of buckets with 3 entries: 0 - number of buckets with 4 entries: 0 - number of buckets with 5 entries: 0 - number of buckets with 6 entries: 0 - number of buckets with 7 entries: 0 - number of buckets with 8 entries: 0 - number of buckets with 9 entries: 0 - number of buckets with 10 or more entries: 0 - average search distance for entry: 1.2 -.CE -.SH "SEE ALSO" -list(n), string(n), variable(n), trace(n), foreach(n) -.SH KEYWORDS -array, element names, search diff --git a/doc/bgerror.n b/doc/bgerror.n deleted file mode 100644 index 3644b3d..0000000 --- a/doc/bgerror.n +++ /dev/null @@ -1,93 +0,0 @@ -'\" -'\" Copyright (c) 1990-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. -'\" -.TH bgerror n 7.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -bgerror \- Command invoked to process background errors -.SH SYNOPSIS -\fBbgerror \fImessage\fR -.BE -.SH DESCRIPTION -.PP -Release 8.5 of Tcl supports the \fBinterp bgerror\fR command, -which allows applications to register in an interpreter the command -that will handle background errors in that interpreter. In older -releases of Tcl, this level of control was not available, and applications -could control the handling of background errors only by creating -a command with the particular command name \fBbgerror\fR in the -global namespace of an interpreter. The following documentation -describes the interface requirements of the \fBbgerror\fR command -an application might define to retain compatibility with pre-8.5 -releases of Tcl. Applications intending to support only -Tcl releases 8.5 and later should simply make use of \fBinterp bgerror\fR. -.PP -The \fBbgerror\fR command does not exist as built-in part of Tcl. Instead, -individual applications or users can define a \fBbgerror\fR -command (e.g. as a Tcl procedure) if they wish to handle background -errors. -.PP -A background error is one that occurs in an event handler or some -other command that did not originate with the application. -For example, if an error occurs while executing a command specified -with the \fBafter\fR command, then it is a background error. -For a non-background error, the error can simply be returned up -through nested Tcl command evaluations until it reaches the top-level -code in the application; then the application can report the error -in whatever way it wishes. When a background error occurs, the -unwinding ends in the Tcl library and there is no obvious way for Tcl -to report the error. -.PP -When Tcl detects a background error, it saves information about the -error and invokes a handler command registered by \fBinterp bgerror\fR -later as an idle event handler. The default handler command in turn -calls the \fBbgerror\fR command . -Before invoking \fBbgerror\fR, Tcl restores the -\fBerrorInfo\fR and \fBerrorCode\fR variables to their values at the -time the error occurred, then it invokes \fBbgerror\fR with the error -message as its only argument. Tcl assumes that the application has -implemented the \fBbgerror\fR command, and that the command will -report the error in a way that makes sense for the application. Tcl -will ignore any result returned by the \fBbgerror\fR command as long -as no error is generated. -.PP -If another Tcl error occurs within the \fBbgerror\fR command (for -example, because no \fBbgerror\fR command has been defined) then Tcl -reports the error itself by writing a message to stderr. -.PP -If several background errors accumulate before \fBbgerror\fR is -invoked to process them, \fBbgerror\fR will be invoked once for each -error, in the order they occurred. However, if \fBbgerror\fR returns -with a break exception, then any remaining errors are skipped without -calling \fBbgerror\fR. -.PP -If you are writing code that will be used by others as part of a -package or other kind of library, consider avoiding \fBbgerror\fR. -The reason for this is that the application programmer may also want -to define a \fBbgerror\fR, or use other code that does and thus will -have trouble integrating your code. -.SH "EXAMPLE" -.PP -This \fBbgerror\fR procedure appends errors to a file, with a timestamp. -.PP -.CS -proc bgerror {message} { - set timestamp [clock format [clock seconds]] - set fl [open mylog.txt {WRONLY CREAT APPEND}] - puts $fl "$timestamp: bgerror in $::argv '$message'" - close $fl -} -.CE -.SH "SEE ALSO" -after(n), errorCode(n), errorInfo(n), interp(n) -.SH KEYWORDS -background error, reporting -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/binary.n b/doc/binary.n deleted file mode 100644 index 5f25d65..0000000 --- a/doc/binary.n +++ /dev/null @@ -1,908 +0,0 @@ -'\" -'\" Copyright (c) 1997 by Sun Microsystems, Inc. -'\" Copyright (c) 2008 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. -'\" -.TH binary n 8.0 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -binary \- Insert and extract fields from binary strings -.SH SYNOPSIS -.VS 8.6 -\fBbinary decode \fIformat\fR ?\fI\-option value ...\fR? \fIdata\fR -.br -\fBbinary encode \fIformat\fR ?\fI\-option value ...\fR? \fIdata\fR -.br -.VE 8.6 -\fBbinary format \fIformatString \fR?\fIarg arg ...\fR? -.br -\fBbinary scan \fIstring formatString \fR?\fIvarName varName ...\fR? -.BE -.SH DESCRIPTION -.PP -This command provides facilities for manipulating binary data. The -subcommand \fBbinary format\fR creates a binary string from normal -Tcl values. For example, given the values 16 and 22, on a 32-bit -architecture, it might produce an 8-byte binary string consisting of -two 4-byte integers, one for each of the numbers. The subcommand -\fBbinary scan\fR, does the opposite: it extracts data -from a binary string and returns it as ordinary Tcl string values. -.VS 8.6 -The \fBbinary encode\fR and \fBbinary decode\fR subcommands convert -binary data to or from string encodings such as base64 (used in MIME -messages for example). -.VE 8.6 -.PP -Note that other operations on binary data, such as taking a subsequence of it, -getting its length, or reinterpreting it as a string in some encoding, are -done by other Tcl commands (respectively \fBstring range\fR, -\fBstring length\fR and \fBencoding convertfrom\fR in the example cases). A -binary string in Tcl is merely one where all the characters it contains are in -the range \eu0000\-\eu00FF. -.SH "BINARY ENCODE AND DECODE" -.VS 8.6 -.PP -When encoding binary data as a readable string, the starting binary data is -passed to the \fBbinary encode\fR command, together with the name of the -encoding to use and any encoding-specific options desired. Data which has been -encoded can be converted back to binary form using \fBbinary decode\fR. The -following formats and options are supported. -.TP -\fBbase64\fR -. -The \fBbase64\fR binary encoding is commonly used in mail messages and XML -documents, and uses mostly upper and lower case letters and digits. It has the -distinction of being able to be rewrapped arbitrarily without losing -information. -.RS -.PP -During encoding, the following options are supported: -.TP -\fB\-maxlen \fIlength\fR -. -Indicates that the output should be split into lines of no more than -\fIlength\fR characters. By default, lines are not split. -.TP -\fB\-wrapchar \fIcharacter\fR -. -Indicates that, when lines are split because of the \fB\-maxlen\fR option, -\fIcharacter\fR should be used to separate lines. By default, this is a -newline character, -.QW \en . -.PP -During decoding, the following options are supported: -.TP -\fB\-strict\fR -. -Instructs the decoder to throw an error if it encounters whitespace characters. Otherwise it ignores them. -.RE -.TP -\fBhex\fR -. -The \fBhex\fR binary encoding converts each byte to a pair of hexadecimal -digits in big-endian form. -.RS -.PP -No options are supported during encoding. During decoding, the following -options are supported: -.TP -\fB\-strict\fR -. -Instructs the decoder to throw an error if it encounters whitespace characters. Otherwise it ignores them. -.RE -.TP -\fBuuencode\fR -. -The \fBuuencode\fR binary encoding used to be common for transfer of data -between Unix systems and on USENET, but is less common these days, having been -largely superseded by the \fBbase64\fR binary encoding. -.RS -.PP -During encoding, the following options are supported (though changing them may -produce files that other implementations of decoders cannot process): -.TP -\fB\-maxlen \fIlength\fR -. -Indicates that the output should be split into lines of no more than -\fIlength\fR characters. By default, lines are split every 61 characters, and -this must be in the range 3 to 85 due to limitations in the encoding. -.TP -\fB\-wrapchar \fIcharacter\fR -. -Indicates that, when lines are split because of the \fB\-maxlen\fR option, -\fIcharacter\fR should be used to separate lines. By default, this is a -newline character, -.QW \en . -.PP -During decoding, the following options are supported: -.TP -\fB\-strict\fR -. -Instructs the decoder to throw an error if it encounters unexpected whitespace -characters. Otherwise it ignores them. -.PP -Note that neither the encoder nor the decoder handle the header and footer of -the uuencode format. -.RE -.VE 8.6 -.SH "BINARY FORMAT" -.PP -The \fBbinary format\fR command generates a binary string whose layout -is specified by the \fIformatString\fR and whose contents come from -the additional arguments. The resulting binary value is returned. -.PP -The \fIformatString\fR consists of a sequence of zero or more field -specifiers separated by zero or more spaces. Each field specifier is -a single type character followed by an optional flag character followed -by an optional numeric \fIcount\fR. -Most field specifiers consume one argument to obtain the value to be -formatted. The type character specifies how the value is to be -formatted. The \fIcount\fR typically indicates how many items of the -specified type are taken from the value. If present, the \fIcount\fR -is a non-negative decimal integer or \fB*\fR, which normally indicates -that all of the items in the value are to be used. If the number of -arguments does not match the number of fields in the format string -that consume arguments, then an error is generated. The flag character -is ignored for \fBbinary format\fR. -.PP -Here is a small example to clarify the relation between the field -specifiers and the arguments: -.CS -\fBbinary format\fR d3d {1.0 2.0 3.0 4.0} 0.1 -.CE -.PP -The first argument is a list of four numbers, but because of the count -of 3 for the associated field specifier, only the first three will be -used. The second argument is associated with the second field -specifier. The resulting binary string contains the four numbers 1.0, -2.0, 3.0 and 0.1. -.PP -Each type-count pair moves an imaginary cursor through the binary -data, storing bytes at the current position and advancing the cursor -to just after the last byte stored. The cursor is initially at -position 0 at the beginning of the data. The type may be any one of -the following characters: -.IP \fBa\fR 5 -Stores a byte string of length \fIcount\fR in the output string. -Every character is taken as modulo 256 (i.e. the low byte of every -character is used, and the high byte discarded) so when storing -character strings not wholly expressible using the characters \eu0000-\eu00ff, -the \fBencoding convertto\fR command should be used first to change -the string into an external representation -if this truncation is not desired (i.e. if the characters are -not part of the ISO 8859\-1 character set.) -If \fIarg\fR has fewer than \fIcount\fR bytes, then additional zero -bytes are used to pad out the field. If \fIarg\fR is longer than the -specified length, the extra characters will be ignored. If -\fIcount\fR is \fB*\fR, then all of the bytes in \fIarg\fR will be -formatted. If \fIcount\fR is omitted, then one character will be -formatted. For example, -.RS -.CS -\fBbinary format\fR a7a*a alpha bravo charlie -.CE -will return a string equivalent to \fBalpha\e000\e000bravoc\fR, -.CS -\fBbinary format\fR a* [encoding convertto utf-8 \eu20ac] -.CE -will return a string equivalent to \fB\e342\e202\e254\fR (which is the -UTF-8 byte sequence for a Euro-currency character) and -.CS -\fBbinary format\fR a* [encoding convertto iso8859-15 \eu20ac] -.CE -will return a string equivalent to \fB\e244\fR (which is the ISO -8859\-15 byte sequence for a Euro-currency character). Contrast these -last two with: -.CS -\fBbinary format\fR a* \eu20ac -.CE -which returns a string equivalent to \fB\e254\fR (i.e. \fB\exac\fR) by -truncating the high-bits of the character, and which is probably not -what is desired. -.RE -.IP \fBA\fR 5 -This form is the same as \fBa\fR except that spaces are used for -padding instead of nulls. For example, -.RS -.CS -\fBbinary format\fR A6A*A alpha bravo charlie -.CE -will return \fBalpha bravoc\fR. -.RE -.IP \fBb\fR 5 -Stores a string of \fIcount\fR binary digits in low-to-high order -within each byte in the output string. \fIArg\fR must contain a -sequence of \fB1\fR and \fB0\fR characters. The resulting bytes are -emitted in first to last order with the bits being formatted in -low-to-high order within each byte. If \fIarg\fR has fewer than -\fIcount\fR digits, then zeros will be used for the remaining bits. -If \fIarg\fR has more than the specified number of digits, the extra -digits will be ignored. If \fIcount\fR is \fB*\fR, then all of the -digits in \fIarg\fR will be formatted. If \fIcount\fR is omitted, -then one digit will be formatted. If the number of bits formatted -does not end at a byte boundary, the remaining bits of the last byte -will be zeros. For example, -.RS -.CS -\fBbinary format\fR b5b* 11100 111000011010 -.CE -will return a string equivalent to \fB\ex07\ex87\ex05\fR. -.RE -.IP \fBB\fR 5 -This form is the same as \fBb\fR except that the bits are stored in -high-to-low order within each byte. For example, -.RS -.CS -\fBbinary format\fR B5B* 11100 111000011010 -.CE -will return a string equivalent to \fB\exe0\exe1\exa0\fR. -.RE -.IP \fBH\fR 5 -Stores a string of \fIcount\fR hexadecimal digits in high-to-low -within each byte in the output string. \fIArg\fR must contain a -sequence of characters in the set -.QW 0123456789abcdefABCDEF . -The resulting bytes are emitted in first to last order with the hex digits -being formatted in high-to-low order within each byte. If \fIarg\fR -has fewer than \fIcount\fR digits, then zeros will be used for the -remaining digits. If \fIarg\fR has more than the specified number of -digits, the extra digits will be ignored. If \fIcount\fR is -\fB*\fR, then all of the digits in \fIarg\fR will be formatted. If -\fIcount\fR is omitted, then one digit will be formatted. If the -number of digits formatted does not end at a byte boundary, the -remaining bits of the last byte will be zeros. For example, -.RS -.CS -\fBbinary format\fR H3H*H2 ab DEF 987 -.CE -will return a string equivalent to \fB\exab\ex00\exde\exf0\ex98\fR. -.RE -.IP \fBh\fR 5 -This form is the same as \fBH\fR except that the digits are stored in -low-to-high order within each byte. This is seldom required. For example, -.RS -.CS -\fBbinary format\fR h3h*h2 AB def 987 -.CE -will return a string equivalent to \fB\exba\ex00\exed\ex0f\ex89\fR. -.RE -.IP \fBc\fR 5 -Stores one or more 8-bit integer values in the output string. If no -\fIcount\fR is specified, then \fIarg\fR must consist of an integer -value. If \fIcount\fR is specified, \fIarg\fR must consist of a list -containing at least that many integers. The low-order 8 bits of each integer -are stored as a one-byte value at the cursor position. If \fIcount\fR -is \fB*\fR, then all of the integers in the list are formatted. If the -number of elements in the list is greater -than \fIcount\fR, then the extra elements are ignored. For example, -.RS -.CS -\fBbinary format\fR c3cc* {3 -3 128 1} 260 {2 5} -.CE -will return a string equivalent to -\fB\ex03\exfd\ex80\ex04\ex02\ex05\fR, whereas -.CS -\fBbinary format\fR c {2 5} -.CE -will generate an error. -.RE -.IP \fBs\fR 5 -This form is the same as \fBc\fR except that it stores one or more -16-bit integers in little-endian byte order in the output string. The -low-order 16-bits of each integer are stored as a two-byte value at -the cursor position with the least significant byte stored first. For -example, -.RS -.CS -\fBbinary format\fR s3 {3 -3 258 1} -.CE -will return a string equivalent to -\fB\ex03\ex00\exfd\exff\ex02\ex01\fR. -.RE -.IP \fBS\fR 5 -This form is the same as \fBs\fR except that it stores one or more -16-bit integers in big-endian byte order in the output string. For -example, -.RS -.CS -\fBbinary format\fR S3 {3 -3 258 1} -.CE -will return a string equivalent to -\fB\ex00\ex03\exff\exfd\ex01\ex02\fR. -.RE -.IP \fBt\fR 5 -This form (mnemonically \fItiny\fR) is the same as \fBs\fR and \fBS\fR -except that it stores the 16-bit integers in the output string in the -native byte order of the machine where the Tcl script is running. -To determine what the native byte order of the machine is, refer to -the \fBbyteOrder\fR element of the \fBtcl_platform\fR array. -.IP \fBi\fR 5 -This form is the same as \fBc\fR except that it stores one or more -32-bit integers in little-endian byte order in the output string. The -low-order 32-bits of each integer are stored as a four-byte value at -the cursor position with the least significant byte stored first. For -example, -.RS -.CS -\fBbinary format\fR i3 {3 -3 65536 1} -.CE -will return a string equivalent to -\fB\ex03\ex00\ex00\ex00\exfd\exff\exff\exff\ex00\ex00\ex01\ex00\fR -.RE -.IP \fBI\fR 5 -This form is the same as \fBi\fR except that it stores one or more one -or more 32-bit integers in big-endian byte order in the output string. -For example, -.RS -.CS -\fBbinary format\fR I3 {3 -3 65536 1} -.CE -will return a string equivalent to -\fB\ex00\ex00\ex00\ex03\exff\exff\exff\exfd\ex00\ex01\ex00\ex00\fR -.RE -.IP \fBn\fR 5 -This form (mnemonically \fInumber\fR or \fInormal\fR) is the same as -\fBi\fR and \fBI\fR except that it stores the 32-bit integers in the -output string in the native byte order of the machine where the Tcl -script is running. -To determine what the native byte order of the machine is, refer to -the \fBbyteOrder\fR element of the \fBtcl_platform\fR array. -.IP \fBw\fR 5 -This form is the same as \fBc\fR except that it stores one or more -64-bit integers in little-endian byte order in the output string. The -low-order 64-bits of each integer are stored as an eight-byte value at -the cursor position with the least significant byte stored first. For -example, -.RS -.CS -\fBbinary format\fR w 7810179016327718216 -.CE -will return the string \fBHelloTcl\fR -.RE -.IP \fBW\fR 5 -This form is the same as \fBw\fR except that it stores one or more one -or more 64-bit integers in big-endian byte order in the output string. -For example, -.RS -.CS -\fBbinary format\fR Wc 4785469626960341345 110 -.CE -will return the string \fBBigEndian\fR -.RE -.IP \fBm\fR 5 -This form (mnemonically the mirror of \fBw\fR) is the same as \fBw\fR -and \fBW\fR except that it stores the 64-bit integers in the output -string in the native byte order of the machine where the Tcl script is -running. -To determine what the native byte order of the machine is, refer to -the \fBbyteOrder\fR element of the \fBtcl_platform\fR array. -.IP \fBf\fR 5 -This form is the same as \fBc\fR except that it stores one or more one -or more single-precision floating point numbers in the machine's native -representation in the output string. This representation is not -portable across architectures, so it should not be used to communicate -floating point numbers across the network. The size of a floating -point number may vary across architectures, so the number of bytes -that are generated may vary. If the value overflows the -machine's native representation, then the value of FLT_MAX -as defined by the system will be used instead. Because Tcl uses -double-precision floating point numbers internally, there may be some -loss of precision in the conversion to single-precision. For example, -on a Windows system running on an Intel Pentium processor, -.RS -.CS -\fBbinary format\fR f2 {1.6 3.4} -.CE -will return a string equivalent to -\fB\excd\excc\excc\ex3f\ex9a\ex99\ex59\ex40\fR. -.RE -.IP \fBr\fR 5 -This form (mnemonically \fIreal\fR) is the same as \fBf\fR except that -it stores the single-precision floating point numbers in little-endian -order. This conversion only produces meaningful output when used on -machines which use the IEEE floating point representation (very -common, but not universal.) -.IP \fBR\fR 5 -This form is the same as \fBr\fR except that it stores the -single-precision floating point numbers in big-endian order. -.IP \fBd\fR 5 -This form is the same as \fBf\fR except that it stores one or more one -or more double-precision floating point numbers in the machine's native -representation in the output string. For example, on a -Windows system running on an Intel Pentium processor, -.RS -.CS -\fBbinary format\fR d1 {1.6} -.CE -will return a string equivalent to -\fB\ex9a\ex99\ex99\ex99\ex99\ex99\exf9\ex3f\fR. -.RE -.IP \fBq\fR 5 -This form (mnemonically the mirror of \fBd\fR) is the same as \fBd\fR -except that it stores the double-precision floating point numbers in -little-endian order. This conversion only produces meaningful output -when used on machines which use the IEEE floating point representation -(very common, but not universal.) -.IP \fBQ\fR 5 -This form is the same as \fBq\fR except that it stores the -double-precision floating point numbers in big-endian order. -.IP \fBx\fR 5 -Stores \fIcount\fR null bytes in the output string. If \fIcount\fR is -not specified, stores one null byte. If \fIcount\fR is \fB*\fR, -generates an error. This type does not consume an argument. For -example, -.RS -.CS -\fBbinary format\fR a3xa3x2a3 abc def ghi -.CE -will return a string equivalent to \fBabc\e000def\e000\e000ghi\fR. -.RE -.IP \fBX\fR 5 -Moves the cursor back \fIcount\fR bytes in the output string. If -\fIcount\fR is \fB*\fR or is larger than the current cursor position, -then the cursor is positioned at location 0 so that the next byte -stored will be the first byte in the result string. If \fIcount\fR is -omitted then the cursor is moved back one byte. This type does not -consume an argument. For example, -.RS -.CS -\fBbinary format\fR a3X*a3X2a3 abc def ghi -.CE -will return \fBdghi\fR. -.RE -.IP \fB@\fR 5 -Moves the cursor to the absolute location in the output string -specified by \fIcount\fR. Position 0 refers to the first byte in the -output string. If \fIcount\fR refers to a position beyond the last -byte stored so far, then null bytes will be placed in the uninitialized -locations and the cursor will be placed at the specified location. If -\fIcount\fR is \fB*\fR, then the cursor is moved to the current end of -the output string. If \fIcount\fR is omitted, then an error will be -generated. This type does not consume an argument. For example, -.RS -.CS -\fBbinary format\fR a5@2a1@*a3@10a1 abcde f ghi j -.CE -will return \fBabfdeghi\e000\e000j\fR. -.RE -.SH "BINARY SCAN" -.PP -The \fBbinary scan\fR command parses fields from a binary string, -returning the number of conversions performed. \fIString\fR gives the -input bytes to be parsed (one byte per character, and characters not -representable as a byte have their high bits chopped) -and \fIformatString\fR indicates how to parse it. -Each \fIvarName\fR gives the name of a variable; when a field is -scanned from \fIstring\fR the result is assigned to the corresponding -variable. -.PP -As with \fBbinary format\fR, the \fIformatString\fR consists of a -sequence of zero or more field specifiers separated by zero or more -spaces. Each field specifier is a single type character followed by -an optional flag character followed by an optional numeric \fIcount\fR. -Most field specifiers consume one -argument to obtain the variable into which the scanned values should -be placed. The type character specifies how the binary data is to be -interpreted. The \fIcount\fR typically indicates how many items of -the specified type are taken from the data. If present, the -\fIcount\fR is a non-negative decimal integer or \fB*\fR, which -normally indicates that all of the remaining items in the data are to -be used. If there are not enough bytes left after the current cursor -position to satisfy the current field specifier, then the -corresponding variable is left untouched and \fBbinary scan\fR returns -immediately with the number of variables that were set. If there are -not enough arguments for all of the fields in the format string that -consume arguments, then an error is generated. The flag character -.QW u -may be given to cause some types to be read as unsigned values. The flag -is accepted for all field types but is ignored for non-integer fields. -.PP -A similar example as with \fBbinary format\fR should explain the -relation between field specifiers and arguments in case of the binary -scan subcommand: -.CS -\fBbinary scan\fR $bytes s3s first second -.CE -.PP -This command (provided the binary string in the variable \fIbytes\fR -is long enough) assigns a list of three integers to the variable -\fIfirst\fR and assigns a single value to the variable \fIsecond\fR. -If \fIbytes\fR contains fewer than 8 bytes (i.e. four 2-byte -integers), no assignment to \fIsecond\fR will be made, and if -\fIbytes\fR contains fewer than 6 bytes (i.e. three 2-byte integers), -no assignment to \fIfirst\fR will be made. Hence: -.CS -puts [\fBbinary scan\fR abcdefg s3s first second] -puts $first -puts $second -.CE -will print (assuming neither variable is set previously): -.CS -1 -25185 25699 26213 -can't read "second": no such variable -.CE -.PP -It is \fIimportant\fR to note that the \fBc\fR, \fBs\fR, and \fBS\fR -(and \fBi\fR and \fBI\fR on 64bit systems) will be scanned into -long data size values. In doing this, values that have their high -bit set (0x80 for chars, 0x8000 for shorts, 0x80000000 for ints), -will be sign extended. Thus the following will occur: -.CS -set signShort [\fBbinary format\fR s1 0x8000] -\fBbinary scan\fR $signShort s1 val; \fI# val == 0xFFFF8000\fR -.CE -If you require unsigned values you can include the -.QW u -flag character following -the field type. For example, to read an unsigned short value: -.CS -set signShort [\fBbinary format\fR s1 0x8000] -\fBbinary scan\fR $signShort su1 val; \fI# val == 0x00008000\fR -.CE -.PP -Each type-count pair moves an imaginary cursor through the binary data, -reading bytes from the current position. The cursor is initially -at position 0 at the beginning of the data. The type may be any one of -the following characters: -.IP \fBa\fR 5 -The data is a byte string of length \fIcount\fR. If \fIcount\fR -is \fB*\fR, then all of the remaining bytes in \fIstring\fR will be -scanned into the variable. If \fIcount\fR is omitted, then one -byte will be scanned. -All bytes scanned will be interpreted as being characters in the -range \eu0000-\eu00ff so the \fBencoding convertfrom\fR command will be -needed if the string is not a binary string or a string encoded in ISO -8859\-1. -For example, -.RS -.CS -\fBbinary scan\fR abcde\e000fghi a6a10 var1 var2 -.CE -will return \fB1\fR with the string equivalent to \fBabcde\e000\fR -stored in \fIvar1\fR and \fIvar2\fR left unmodified, and -.CS -\fBbinary scan\fR \e342\e202\e254 a* var1 -set var2 [encoding convertfrom utf-8 $var1] -.CE -will store a Euro-currency character in \fIvar2\fR. -.RE -.IP \fBA\fR 5 -This form is the same as \fBa\fR, except trailing blanks and nulls are stripped from -the scanned value before it is stored in the variable. For example, -.RS -.CS -\fBbinary scan\fR "abc efghi \e000" A* var1 -.CE -will return \fB1\fR with \fBabc efghi\fR stored in \fIvar1\fR. -.RE -.IP \fBb\fR 5 -The data is turned into a string of \fIcount\fR binary digits in -low-to-high order represented as a sequence of -.QW 1 -and -.QW 0 -characters. The data bytes are scanned in first to last order with -the bits being taken in low-to-high order within each byte. Any extra -bits in the last byte are ignored. If \fIcount\fR is \fB*\fR, then -all of the remaining bits in \fIstring\fR will be scanned. If -\fIcount\fR is omitted, then one bit will be scanned. For example, -.RS -.CS -\fBbinary scan\fR \ex07\ex87\ex05 b5b* var1 var2 -.CE -will return \fB2\fR with \fB11100\fR stored in \fIvar1\fR and -\fB1110000110100000\fR stored in \fIvar2\fR. -.RE -.IP \fBB\fR 5 -This form is the same as \fBb\fR, except the bits are taken in -high-to-low order within each byte. For example, -.RS -.CS -\fBbinary scan\fR \ex70\ex87\ex05 B5B* var1 var2 -.CE -will return \fB2\fR with \fB01110\fR stored in \fIvar1\fR and -\fB1000011100000101\fR stored in \fIvar2\fR. -.RE -.IP \fBH\fR 5 -The data is turned into a string of \fIcount\fR hexadecimal digits in -high-to-low order represented as a sequence of characters in the set -.QW 0123456789abcdef . -The data bytes are scanned in first to last -order with the hex digits being taken in high-to-low order within each -byte. Any extra bits in the last byte are ignored. If \fIcount\fR is -\fB*\fR, then all of the remaining hex digits in \fIstring\fR will be -scanned. If \fIcount\fR is omitted, then one hex digit will be -scanned. For example, -.RS -.CS -\fBbinary scan\fR \ex07\exC6\ex05\ex1f\ex34 H3H* var1 var2 -.CE -will return \fB2\fR with \fB07c\fR stored in \fIvar1\fR and -\fB051f34\fR stored in \fIvar2\fR. -.RE -.IP \fBh\fR 5 -This form is the same as \fBH\fR, except the digits are taken in -reverse (low-to-high) order within each byte. For example, -.RS -.CS -\fBbinary scan\fR \ex07\ex86\ex05\ex12\ex34 h3h* var1 var2 -.CE -will return \fB2\fR with \fB706\fR stored in \fIvar1\fR and -\fB502143\fR stored in \fIvar2\fR. -.PP -Note that most code that wishes to parse the hexadecimal digits from -multiple bytes in order should use the \fBH\fR format. -.RE -.IP \fBc\fR 5 -The data is turned into \fIcount\fR 8-bit signed integers and stored -in the corresponding variable as a list. If \fIcount\fR is \fB*\fR, -then all of the remaining bytes in \fIstring\fR will be scanned. If -\fIcount\fR is omitted, then one 8-bit integer will be scanned. For -example, -.RS -.CS -\fBbinary scan\fR \ex07\ex86\ex05 c2c* var1 var2 -.CE -will return \fB2\fR with \fB7 -122\fR stored in \fIvar1\fR and \fB5\fR -stored in \fIvar2\fR. Note that the integers returned are signed, but -they can be converted to unsigned 8-bit quantities using an expression -like: -.CS -set num [expr { $num & 0xff }] -.CE -.RE -.IP \fBs\fR 5 -The data is interpreted as \fIcount\fR 16-bit signed integers -represented in little-endian byte order. The integers are stored in -the corresponding variable as a list. If \fIcount\fR is \fB*\fR, then -all of the remaining bytes in \fIstring\fR will be scanned. If -\fIcount\fR is omitted, then one 16-bit integer will be scanned. For -example, -.RS -.CS -\fBbinary scan\fR \ex05\ex00\ex07\ex00\exf0\exff s2s* var1 var2 -.CE -will return \fB2\fR with \fB5 7\fR stored in \fIvar1\fR and \fB\-16\fR -stored in \fIvar2\fR. Note that the integers returned are signed, but -they can be converted to unsigned 16-bit quantities using an expression -like: -.CS -set num [expr { $num & 0xffff }] -.CE -.RE -.IP \fBS\fR 5 -This form is the same as \fBs\fR except that the data is interpreted -as \fIcount\fR 16-bit signed integers represented in big-endian byte -order. For example, -.RS -.CS -\fBbinary scan\fR \ex00\ex05\ex00\ex07\exff\exf0 S2S* var1 var2 -.CE -will return \fB2\fR with \fB5 7\fR stored in \fIvar1\fR and \fB\-16\fR -stored in \fIvar2\fR. -.RE -.IP \fBt\fR 5 -The data is interpreted as \fIcount\fR 16-bit signed integers -represented in the native byte order of the machine running the Tcl -script. It is otherwise identical to \fBs\fR and \fBS\fR. -To determine what the native byte order of the machine is, refer to -the \fBbyteOrder\fR element of the \fBtcl_platform\fR array. -.IP \fBi\fR 5 -The data is interpreted as \fIcount\fR 32-bit signed integers -represented in little-endian byte order. The integers are stored in -the corresponding variable as a list. If \fIcount\fR is \fB*\fR, then -all of the remaining bytes in \fIstring\fR will be scanned. If -\fIcount\fR is omitted, then one 32-bit integer will be scanned. For -example, -.RS -.CS -set str \ex05\ex00\ex00\ex00\ex07\ex00\ex00\ex00\exf0\exff\exff\exff -\fBbinary scan\fR $str i2i* var1 var2 -.CE -will return \fB2\fR with \fB5 7\fR stored in \fIvar1\fR and \fB\-16\fR -stored in \fIvar2\fR. Note that the integers returned are signed, but -they can be converted to unsigned 32-bit quantities using an expression -like: -.CS -set num [expr { $num & 0xffffffff }] -.CE -.RE -.IP \fBI\fR 5 -This form is the same as \fBI\fR except that the data is interpreted -as \fIcount\fR 32-bit signed integers represented in big-endian byte -order. For example, -.RS -.CS -set str \ex00\ex00\ex00\ex05\ex00\ex00\ex00\ex07\exff\exff\exff\exf0 -\fBbinary scan\fR $str I2I* var1 var2 -.CE -will return \fB2\fR with \fB5 7\fR stored in \fIvar1\fR and \fB\-16\fR -stored in \fIvar2\fR. -.RE -.IP \fBn\fR 5 -The data is interpreted as \fIcount\fR 32-bit signed integers -represented in the native byte order of the machine running the Tcl -script. It is otherwise identical to \fBi\fR and \fBI\fR. -To determine what the native byte order of the machine is, refer to -the \fBbyteOrder\fR element of the \fBtcl_platform\fR array. -.IP \fBw\fR 5 -The data is interpreted as \fIcount\fR 64-bit signed integers -represented in little-endian byte order. The integers are stored in -the corresponding variable as a list. If \fIcount\fR is \fB*\fR, then -all of the remaining bytes in \fIstring\fR will be scanned. If -\fIcount\fR is omitted, then one 64-bit integer will be scanned. For -example, -.RS -.CS -set str \ex05\ex00\ex00\ex00\ex07\ex00\ex00\ex00\exf0\exff\exff\exff -\fBbinary scan\fR $str wi* var1 var2 -.CE -will return \fB2\fR with \fB30064771077\fR stored in \fIvar1\fR and -\fB\-16\fR stored in \fIvar2\fR. Note that the integers returned are -signed and cannot be represented by Tcl as unsigned values. -.RE -.IP \fBW\fR 5 -This form is the same as \fBw\fR except that the data is interpreted -as \fIcount\fR 64-bit signed integers represented in big-endian byte -order. For example, -.RS -.CS -set str \ex00\ex00\ex00\ex05\ex00\ex00\ex00\ex07\exff\exff\exff\exf0 -\fBbinary scan\fR $str WI* var1 var2 -.CE -will return \fB2\fR with \fB21474836487\fR stored in \fIvar1\fR and \fB\-16\fR -stored in \fIvar2\fR. -.RE -.IP \fBm\fR 5 -The data is interpreted as \fIcount\fR 64-bit signed integers -represented in the native byte order of the machine running the Tcl -script. It is otherwise identical to \fBw\fR and \fBW\fR. -To determine what the native byte order of the machine is, refer to -the \fBbyteOrder\fR element of the \fBtcl_platform\fR array. -.IP \fBf\fR 5 -The data is interpreted as \fIcount\fR single-precision floating point -numbers in the machine's native representation. The floating point -numbers are stored in the corresponding variable as a list. If -\fIcount\fR is \fB*\fR, then all of the remaining bytes in -\fIstring\fR will be scanned. If \fIcount\fR is omitted, then one -single-precision floating point number will be scanned. The size of a -floating point number may vary across architectures, so the number of -bytes that are scanned may vary. If the data does not represent a -valid floating point number, the resulting value is undefined and -compiler dependent. For example, on a Windows system running on an -Intel Pentium processor, -.RS -.CS -\fBbinary scan\fR \ex3f\excc\excc\excd f var1 -.CE -will return \fB1\fR with \fB1.6000000238418579\fR stored in -\fIvar1\fR. -.RE -.IP \fBr\fR 5 -This form is the same as \fBf\fR except that the data is interpreted -as \fIcount\fR single-precision floating point number in little-endian -order. This conversion is not portable to the minority of systems not -using IEEE floating point representations. -.IP \fBR\fR 5 -This form is the same as \fBf\fR except that the data is interpreted -as \fIcount\fR single-precision floating point number in big-endian -order. This conversion is not portable to the minority of systems not -using IEEE floating point representations. -.IP \fBd\fR 5 -This form is the same as \fBf\fR except that the data is interpreted -as \fIcount\fR double-precision floating point numbers in the -machine's native representation. For example, on a Windows system -running on an Intel Pentium processor, -.RS -.CS -\fBbinary scan\fR \ex9a\ex99\ex99\ex99\ex99\ex99\exf9\ex3f d var1 -.CE -will return \fB1\fR with \fB1.6000000000000001\fR -stored in \fIvar1\fR. -.RE -.IP \fBq\fR 5 -This form is the same as \fBd\fR except that the data is interpreted -as \fIcount\fR double-precision floating point number in little-endian -order. This conversion is not portable to the minority of systems not -using IEEE floating point representations. -.IP \fBQ\fR 5 -This form is the same as \fBd\fR except that the data is interpreted -as \fIcount\fR double-precision floating point number in big-endian -order. This conversion is not portable to the minority of systems not -using IEEE floating point representations. -.IP \fBx\fR 5 -Moves the cursor forward \fIcount\fR bytes in \fIstring\fR. If -\fIcount\fR is \fB*\fR or is larger than the number of bytes after the -current cursor position, then the cursor is positioned after -the last byte in \fIstring\fR. If \fIcount\fR is omitted, then the -cursor is moved forward one byte. Note that this type does not -consume an argument. For example, -.RS -.CS -\fBbinary scan\fR \ex01\ex02\ex03\ex04 x2H* var1 -.CE -will return \fB1\fR with \fB0304\fR stored in \fIvar1\fR. -.RE -.IP \fBX\fR 5 -Moves the cursor back \fIcount\fR bytes in \fIstring\fR. If -\fIcount\fR is \fB*\fR or is larger than the current cursor position, -then the cursor is positioned at location 0 so that the next byte -scanned will be the first byte in \fIstring\fR. If \fIcount\fR -is omitted then the cursor is moved back one byte. Note that this -type does not consume an argument. For example, -.RS -.CS -\fBbinary scan\fR \ex01\ex02\ex03\ex04 c2XH* var1 var2 -.CE -will return \fB2\fR with \fB1 2\fR stored in \fIvar1\fR and \fB020304\fR -stored in \fIvar2\fR. -.RE -.IP \fB@\fR 5 -Moves the cursor to the absolute location in the data string specified -by \fIcount\fR. Note that position 0 refers to the first byte in -\fIstring\fR. If \fIcount\fR refers to a position beyond the end of -\fIstring\fR, then the cursor is positioned after the last byte. If -\fIcount\fR is omitted, then an error will be generated. For example, -.RS -.CS -\fBbinary scan\fR \ex01\ex02\ex03\ex04 c2@1H* var1 var2 -.CE -will return \fB2\fR with \fB1 2\fR stored in \fIvar1\fR and \fB020304\fR -stored in \fIvar2\fR. -.RE -.SH "PORTABILITY ISSUES" -.PP -The \fBr\fR, \fBR\fR, \fBq\fR and \fBQ\fR conversions will only work -reliably for transferring data between computers which are all using -IEEE floating point representations. This is very common, but not -universal. To transfer floating-point numbers portably between all -architectures, use their textual representation (as produced by -\fBformat\fR) instead. -.SH EXAMPLES -.PP -This is a procedure to write a Tcl string to a binary-encoded channel as -UTF-8 data preceded by a length word: -.PP -.CS -proc \fIwriteString\fR {channel string} { - set data [encoding convertto utf-8 $string] - puts -nonewline [\fBbinary format\fR Ia* \e - [string length $data] $data] -} -.CE -.PP -This procedure reads a string from a channel that was written by the -previously presented \fIwriteString\fR procedure: -.PP -.CS -proc \fIreadString\fR {channel} { - if {![\fBbinary scan\fR [read $channel 4] I length]} { - error "missing length" - } - set data [read $channel $length] - return [encoding convertfrom utf-8 $data] -} -.CE -.PP -This converts the contents of a file (named in the variable \fIfilename\fR) to -base64 and prints them: -.PP -.CS -set f [open $filename rb] -set data [read $f] -close $f -puts [\fBbinary encode\fR base64 \-maxlen 64 $data] -.CE -.SH "SEE ALSO" -encoding(n), format(n), scan(n), string(n), tcl_platform(n) -.SH KEYWORDS -binary, format, scan -'\" Local Variables: -'\" mode: nroff -'\" fill-column: 78 -'\" End: diff --git a/doc/break.n b/doc/break.n deleted file mode 100644 index 78fd005..0000000 --- a/doc/break.n +++ /dev/null @@ -1,47 +0,0 @@ -'\" -'\" 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. -'\" -.TH break n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -break \- Abort looping command -.SH SYNOPSIS -\fBbreak\fR -.BE -.SH DESCRIPTION -.PP -This command is typically invoked inside the body of a looping command -such as \fBfor\fR or \fBforeach\fR or \fBwhile\fR. -It returns a 3 (\fBTCL_BREAK\fR) result code, which causes a break exception -to occur. -The exception causes the current script to be aborted -out to the innermost containing loop command, which then -aborts its execution and returns normally. -Break exceptions are also handled in a few other situations, such -as the \fBcatch\fR command, Tk event bindings, and the outermost -scripts of procedure bodies. -.SH EXAMPLE -.PP -Print a line for each of the integers from 0 to 5: -.PP -.CS -for {set x 0} {$x<10} {incr x} { - if {$x > 5} { - \fBbreak\fR - } - puts "x is $x" -} -.CE -.SH "SEE ALSO" -catch(n), continue(n), for(n), foreach(n), return(n), while(n) -.SH KEYWORDS -abort, break, loop -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/case.n b/doc/case.n deleted file mode 100644 index c48d634..0000000 --- a/doc/case.n +++ /dev/null @@ -1,60 +0,0 @@ -'\" -'\" 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. -'\" -.TH case n 7.0 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -case \- Evaluate one of several scripts, depending on a given value -.SH SYNOPSIS -\fBcase\fI string \fR?\fBin\fR? \fIpatList body \fR?\fIpatList body \fR...? -.sp -\fBcase\fI string \fR?\fBin\fR? {\fIpatList body \fR?\fIpatList body \fR...?} -.BE - -.SH DESCRIPTION -.PP -\fINote: the \fBcase\fI command is obsolete and is supported only -for backward compatibility. At some point in the future it may be -removed entirely. You should use the \fBswitch\fI command instead.\fR -.PP -The \fBcase\fR command matches \fIstring\fR against each of -the \fIpatList\fR arguments in order. -Each \fIpatList\fR argument is a list of one or -more patterns. If any of these patterns matches \fIstring\fR then -\fBcase\fR evaluates the following \fIbody\fR argument -by passing it recursively to the Tcl interpreter and returns the result -of that evaluation. -Each \fIpatList\fR argument consists of a single -pattern or list of patterns. Each pattern may contain any of the wild-cards -described under \fBstring match\fR. If a \fIpatList\fR -argument is \fBdefault\fR, the corresponding body will be evaluated -if no \fIpatList\fR matches \fIstring\fR. If no \fIpatList\fR argument -matches \fIstring\fR and no default is given, then the \fBcase\fR -command returns an empty string. -.PP -Two syntaxes are provided for the \fIpatList\fR and \fIbody\fR arguments. -The first uses a separate argument for each of the patterns and commands; -this form is convenient if substitutions are desired on some of the -patterns or commands. -The second form places all of the patterns and commands together into -a single argument; the argument must have proper list structure, with -the elements of the list being the patterns and commands. -The second form makes it easy to construct multi-line case commands, -since the braces around the whole list make it unnecessary to include a -backslash at the end of each line. -Since the \fIpatList\fR arguments are in braces in the second form, -no command or variable substitutions are performed on them; this makes -the behavior of the second form different than the first form in some -cases. - -.SH "SEE ALSO" -switch(n) - -.SH KEYWORDS -case, match, regular expression diff --git a/doc/catch.n b/doc/catch.n deleted file mode 100644 index d43a7ec..0000000 --- a/doc/catch.n +++ /dev/null @@ -1,125 +0,0 @@ -'\" -'\" Copyright (c) 1993-1994 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. -'\" Contributions from Don Porter, NIST, 2003. (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. -'\" -.TH catch n "8.5" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -catch \- Evaluate script and trap exceptional returns -.SH SYNOPSIS -\fBcatch\fI script \fR?\fIresultVarName\fR? ?\fIoptionsVarName\fR? -.BE -.SH DESCRIPTION -.PP -The \fBcatch\fR command may be used to prevent errors from aborting command -interpretation. The \fBcatch\fR command calls the Tcl interpreter recursively -to execute \fIscript\fR, and always returns without raising an error, -regardless of any errors that might occur while executing \fIscript\fR. -.PP -If \fIscript\fR raises an error, \fBcatch\fR will return a non-zero integer -value corresponding to the exceptional return code returned by evaluation -of \fIscript\fR. Tcl defines the normal return code from script -evaluation to be zero (0), or \fBTCL_OK\fR. Tcl also defines four exceptional -return codes: 1 (\fBTCL_ERROR\fR), 2 (\fBTCL_RETURN\fR), 3 (\fBTCL_BREAK\fR), -and 4 (\fBTCL_CONTINUE\fR). Errors during evaluation of a script are indicated -by a return code of \fBTCL_ERROR\fR. The other exceptional return codes are -returned by the \fBreturn\fR, \fBbreak\fR, and \fBcontinue\fR commands -and in other special situations as documented. Tcl packages can define -new commands that return other integer values as return codes as well, -and scripts that make use of the \fBreturn \-code\fR command can also -have return codes other than the five defined by Tcl. -.PP -If the \fIresultVarName\fR argument is given, then the variable it names is -set to the result of the script evaluation. When the return code from the -script is 1 (\fBTCL_ERROR\fR), the value stored in \fIresultVarName\fR is an -error message. When the return code from the script is 0 (\fBTCL_OK\fR), the -value stored in \fIresultVarName\fR is the value returned from \fIscript\fR. -.PP -If the \fIoptionsVarName\fR argument is given, then the variable it -names is set to a dictionary of return options returned by evaluation -of \fIscript\fR. Tcl specifies two entries that are always -defined in the dictionary: \fB\-code\fR and \fB\-level\fR. When -the return code from evaluation of \fIscript\fR is not \fBTCL_RETURN\fR, -the value of the \fB\-level\fR entry will be 0, and the value -of the \fB\-code\fR entry will be the same as the return code. -Only when the return code is \fBTCL_RETURN\fR will the values of -the \fB\-level\fR and \fB\-code\fR entries be something else, as -further described in the documentation for the \fBreturn\fR command. -.PP -When the return code from evaluation of \fIscript\fR is -\fBTCL_ERROR\fR, four additional entries are defined in the dictionary -of return options stored in \fIoptionsVarName\fR: \fB\-errorinfo\fR, -\fB\-errorcode\fR, \fB\-errorline\fR, and -.VS 8.6 -\fB\-errorstack\fR. -.VE 8.6 -The value of the \fB\-errorinfo\fR entry is a formatted stack trace containing -more information about the context in which the error happened. The formatted -stack trace is meant to be read by a person. The value of the -\fB\-errorcode\fR entry is additional information about the error stored as a -list. The \fB\-errorcode\fR value is meant to be further processed by -programs, and may not be particularly readable by people. The value of the -\fB\-errorline\fR entry is an integer indicating which line of \fIscript\fR -was being evaluated when the error occurred. -.VS 8.6 -The value of the \fB\-errorstack\fR entry is an -even-sized list made of token-parameter pairs accumulated while -unwinding the stack. The token may be -.QW \fBCALL\fR , -in which case the parameter is a list made of the proc name and arguments at -the corresponding level; or it may be -.QW \fBUP\fR , -in which case the parameter is -the relative level (as in \fBuplevel\fR) of the previous \fBCALL\fR. The -salient differences with respect to \fB\-errorinfo\fR are that: -.IP [1] -it is a machine-readable form that is amenable to processing with -[\fBforeach\fR {tok prm} ...], -.IP [2] -it contains the true (substituted) values passed to the functions, instead of -the static text of the calling sites, and -.IP [3] -it is coarser-grained, with only one element per stack frame (like procs; no -separate elements for \fBforeach\fR constructs for example). -.VE 8.6 -.PP -The values of the \fB\-errorinfo\fR and \fB\-errorcode\fR entries of -the most recent error are also available as values of the global -variables \fB::errorInfo\fR and \fB::errorCode\fR respectively. -.VS 8.6 -The value of the \fB\-errorstack\fR entry surfaces as \fBinfo errorstack\fR. -.VE 8.6 -.PP -Tcl packages may provide commands that set other entries in the -dictionary of return options, and the \fBreturn\fR command may be -used by scripts to set return options in addition to those defined -above. -.SH EXAMPLES -.PP -The \fBcatch\fR command may be used in an \fBif\fR to branch based on -the success of a script. -.PP -.CS -if { [\fBcatch\fR {open $someFile w} fid] } { - puts stderr "Could not open $someFile for writing\en$fid" - exit 1 -} -.CE -.PP -There are more complex examples of \fBcatch\fR usage in the -documentation for the \fBreturn\fR command. -.SH "SEE ALSO" -break(n), continue(n), dict(n), error(n), errorCode(n), errorInfo(n), info(n), -return(n) -.SH KEYWORDS -catch, error, exception -'\" Local Variables: -'\" mode: nroff -'\" fill-column: 78 -'\" End: diff --git a/doc/cd.n b/doc/cd.n deleted file mode 100644 index dceb075..0000000 --- a/doc/cd.n +++ /dev/null @@ -1,43 +0,0 @@ -'\" -'\" 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. -'\" -.TH cd n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -cd \- Change working directory -.SH SYNOPSIS -\fBcd \fR?\fIdirName\fR? -.BE -.SH DESCRIPTION -.PP -Change the current working directory to \fIdirName\fR, or to the -home directory (as specified in the HOME environment variable) if -\fIdirName\fR is not given. -Returns an empty string. -Note that the current working directory is a per-process resource; the -\fBcd\fR command changes the working directory for all interpreters -and (in a threaded environment) all threads. -.SH EXAMPLES -.PP -Change to the home directory of the user \fBfred\fR: -.PP -.CS -\fBcd\fR ~fred -.CE -.PP -Change to the directory \fBlib\fR that is a sibling directory of the -current one: -.PP -.CS -\fBcd\fR ../lib -.CE -.SH "SEE ALSO" -filename(n), glob(n), pwd(n) -.SH KEYWORDS -working directory diff --git a/doc/chan.n b/doc/chan.n deleted file mode 100644 index 81aa9f4..0000000 --- a/doc/chan.n +++ /dev/null @@ -1,850 +0,0 @@ -'\" -'\" Copyright (c) 2005-2006 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -.TH chan n 8.5 Tcl "Tcl Built-In Commands" -.so man.macros -.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 ?\fIdirection\fR? -. -Close and destroy the channel called \fIchannelId\fR. Note that this -deletes all existing file-events registered on the channel. -.VS 8.6 -If the \fIdirection\fR argument (which must be \fBread\fR or \fBwrite\fR or -any unique abbreviation of them) is present, the channel will only be -half-closed, so that it can go from being read-write to write-only or -read-only respectively. If a read-only channel is closed for reading, it is -the same as if the channel is fully closed, and respectively similar for -write-only channels. Without the \fIdirection\fR argument, the channel is -closed for both reading and writing (but only if those directions are -currently open). It is an error to close a read-only channel for writing, or a -write-only channel for reading. -.VE 8.6 -.RS -.PP -As part of closing the channel, all buffered output is flushed to the -channel's output device (only if the channel is ceasing to be writable), any -buffered input is discarded (only if the channel is ceasing to be readable), -the underlying operating system resource is closed and \fIchannelId\fR becomes -unavailable for future use (both only if the channel is being completely -closed). -.PP -If the channel is blocking and the channel is ceasing to be writable, the -command does not return until all output is flushed. If the channel is -non-blocking 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. With half-closing, the half-close of the channel only -applies to the current interpreter's view of the channel until all channels -have closed it in that direction (or completely). -See the \fBinterp\fR command for a description of channel sharing. -.PP -Channels are automatically fully 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.) -.PP -.VS 8.6 -Note that half-closes of sockets and command pipelines can have important side -effects because they result in a shutdown() or close() of the underlying -system resource, which can change how other processes or systems respond to -the Tcl program. -.VE 8.6 -.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 channel -for the options supported by that specific type of channel. For -example, see the manual entry for the \fBsocket\fR command for additional -options for sockets, and the \fBopen\fR command for additional options for -serial devices. -.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 non-blocking 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 non-blocking 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. -The acceptable range for \fB\-eofchar\fR values is \ex01 - \ex7f; -attempting to set \fB\-eofchar\fR to a value outside of this range will -generate an error. -.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\fR and \fBchan read\fR) the Tcl I/O system -automatically translates the external end-of-line representation into -newline characters. Upon output (i.e., with \fBchan puts\fR), the I/O -system translates newlines to the external end-of-line representation. -The default translation mode, \fBauto\fR, 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\fR), carriage return (\fBcr\fR), or carriage return followed by -a newline (\fBcrlf\fR) 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\fR mode, except that in addition \fBbinary\fR 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\fR mode converts carriage returns to newline characters. As the -output translation mode, \fBcr\fR 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\fR mode converts -carriage-return-linefeed sequences to newline characters. As the -output translation mode, \fBcrlf\fR 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\fR command transfers data from \fIinputChan\fR until -end of file or \fIsize\fR bytes or characters have been transferred; -\fIsize\fR is in bytes if the two channels are using the same encoding, -and is in characters otherwise. If no \fB\-size\fR 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\fR option, \fBchan copy\fR blocks until the copy is -complete and returns the number of bytes or characters (using the same -rules as for the \fB\-size\fR option) written to \fIoutputChan\fR. -.PP -The \fB\-command\fR argument makes \fBchan copy\fR work in the -background. In this case it returns immediately and the -\fIcallback\fR is invoked later when the copy completes. The -\fIcallback\fR 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\fR command takes care of that -automatically. However, it is necessary to enter the event loop by -using the \fBvwait\fR 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\fR 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\fR 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\fR handler will get a -.QW "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\fR or as the argument -to the callback for an asynchronous \fBchan copy\fR. -.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 create \fImode cmdPrefix\fR -. -This subcommand creates a new script level channel using the command -prefix \fIcmdPrefix\fR as its handler. Any such channel is called a -\fBreflected\fR channel. The specified command prefix, \fBcmdPrefix\fR, -must be a non-empty list, and should provide the API described in the -\fBrefchan\fR manual page. The handle of the new channel is -returned as the result of the \fBchan create\fR command, and the -channel is open. Use either \fBclose\fR or \fBchan close\fR to remove -the channel. -.RS -.PP -The argument \fImode\fR specifies if the new channel is opened for -reading, writing, or both. It has to be a list containing any of the -strings -.QW \fBread\fR -or -.QW \fBwrite\fR . -The list must have at least one -element, as a channel you can neither write to nor read from makes no -sense. The handler command for the new channel must support the chosen -mode, or an error is thrown. -.PP -The command prefix is executed in the global namespace, at the top of -call stack, following the appending of arguments as described in the -\fBrefchan\fR manual page. Command resolution happens at the -time of the call. Renaming the command, or destroying it means that -the next call of a handler method may fail, causing the channel -command invoking the handler to fail as well. Depending on the -subcommand being invoked, the error message may not be able to explain -the reason for that failure. -.PP -Every channel created with this subcommand knows which interpreter it -was created in, and only ever executes its handler command in that -interpreter, even if the channel was shared with and/or was moved into -a different interpreter. Each reflected channel also knows the thread -it was created in, and executes its handler command only in that -thread, even if the channel was moved into a different thread. To this -end all invocations of the handler are forwarded to the original -thread by posting special events to it. This means that the original -thread (i.e. the thread that executed the \fBchan create\fR command) -must have an active event loop, i.e. it must be able to process such -events. Otherwise the thread sending them will \fIblock -indefinitely\fR. Deadlock may occur. -.PP -Note that this permits the creation of a channel whose two endpoints -live in two different threads, providing a stream-oriented bridge -between these threads. In other words, we can provide a way for -regular stream communication between threads instead of having to send -commands. -.PP -When a thread or interpreter is deleted, all channels created with -this subcommand and using this thread/interpreter as their computing -base are deleted as well, in all interpreters they have been shared -with or moved into, and in whatever thread they have been transferred -to. While this pulls the rug out under the other thread(s) and/or -interpreter(s), this cannot be avoided. Trying to use such a channel -will cause the generation of a regular error about unknown channel -handles. -.PP -This subcommand is \fBsafe\fR and made accessible to safe -interpreters. While it arranges for the execution of arbitrary Tcl -code the system also makes sure that the code is always executed -within the safe interpreter. -.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-of-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 -.QW "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 will not 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 non-blocking 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 -non-blocking 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 non-blocking 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 non-blocking 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-non-blocking 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 pending \fImode channelId\fR -. -Depending on whether \fImode\fR is \fBinput\fR or \fBoutput\fR, -returns the number of -bytes of input or output (respectively) currently buffered -internally for \fIchannelId\fR (especially useful in a readable event -callback to impose application-specific limits on input line lengths to avoid -a potential denial-of-service attack where a hostile user crafts -an extremely long line that exceeds the available memory to buffer it). -Returns -1 if the channel was not opened for the mode in question. -.TP -\fBchan pipe\fR -.VS 8.6 -Creates a standalone pipe whose read- and write-side channels are -returned as a 2-element list, the first element being the read side and -the second the write side. Can be useful e.g. to redirect -separately \fBstderr\fR and \fBstdout\fR from a subprocess. To do -this, spawn with "2>@" or -">@" redirection operators onto the write side of a pipe, and then -immediately close it in the parent. This is necessary to get an EOF on -the read side once the child has exited or otherwise closed its output. -.RS -.PP -Note that the pipe buffering semantics can vary at the operating system level -substantially; it is not safe to assume that a write performed on the output -side of the pipe will appear instantly to the input side. This is a -fundamental difference and Tcl cannot conceal it. The overall stream semantics -\fIare\fR compatible, so blocking reads and writes will not see most of the -differences, but the details of what exactly gets written when are not. This -is most likely to show up when using pipelines for testing; care should be -taken to ensure that deadlocks do not occur and that potential short reads are -allowed for. -.RE -.VE 8.6 -.TP -\fBchan pop \fIchannelId\fR -.VS 8.6 -Removes the topmost transformation from the channel \fIchannelId\fR, if there -is any. If there are no transformations added to \fIchannelId\fR, this is -equivalent to \fBchan close\fR of that channel. The result is normally the -empty string, but can be an error in some situations (i.e. where the -underlying system stream is closed and that results in an error). -.VE 8.6 -.TP -\fBchan postevent \fIchannelId eventSpec\fR -. -This subcommand is used by command handlers specified with \fBchan -create\fR. It notifies the channel represented by the handle -\fIchannelId\fR that the event(s) listed in the \fIeventSpec\fR have -occurred. The argument has to be a list containing any of the strings -\fBread\fR and \fBwrite\fR. The list must contain at least one -element as it does not make sense to invoke the command if there are -no events to post. -.RS -.PP -Note that this subcommand can only be used with channel handles that -were created/opened by \fBchan create\fR. All other channels will -cause this subcommand to report an error. -.PP -As only the Tcl level of a channel, i.e. its command handler, should -post events to it we also restrict the usage of this command to the -interpreter that created the channel. In other words, posting events -to a reflected channel from an interpreter that does not contain it's -implementation is not allowed. Attempting to post an event from any -other interpreter will cause this subcommand to report an error. -.PP -Another restriction is that it is not possible to post events that the -I/O core has not registered an interest in. Trying to do so will cause -the method to throw an error. See the command handler method -\fBwatch\fR described in \fBrefchan\fR, the document specifying -the API of command handlers for reflected channels. -.PP -This command is \fBsafe\fR and made accessible to safe interpreters. -It can trigger the execution of \fBchan event\fR handlers, whether in the -current interpreter or in other interpreters or other threads, even -where the event is posted from a safe interpreter and listened for by -a trusted interpreter. \fBChan event\fR handlers are \fIalways\fR -executed in the interpreter that set them up. -.RE -.TP -\fBchan push \fIchannelId cmdPrefix\fR -.VS 8.6 -Adds a new transformation on top of the channel \fIchannelId\fR. The -\fIcmdPrefix\fR argument describes a list of one or more words which represent -a handler that will be used to implement the transformation. The command -prefix must provide the API described in the \fBtranschan\fR manual page. -The result of this subcommand is a handle to the transformation. Note that it -is important to make sure that the transformation is capable of supporting the -channel mode that it is used with or this can make the channel neither -readable nor writable. -.VE 8.6 -.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 non-blocking -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 non-blocking 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 non-blocking mode, which could consume a large amount of -memory. To avoid wasting memory, non-blocking I/O should normally be -used in an event-driven fashion with the \fBchan event\fR command -(do not 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 non-blocking 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 non-blocking, like this: -.PP -.CS -\fBchan configure \fIchannelId \fB\-blocking \fI0\fR. -.CE -.PP -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 non-blocking 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 EXAMPLES -.PP -This opens a file using a known encoding (CP1252, a very common encoding -on Windows), searches for a string, rewrites that part, and truncates the -file after a further two lines. -.PP -.CS -set f [open somefile.txt r+] -\fBchan configure\fR $f -encoding cp1252 -set offset 0 - -\fI# Search for string "FOOBAR" in the file\fR -while {[\fBchan gets\fR $f line] >= 0} { - set idx [string first FOOBAR $line] - if {$idx > -1} { - \fI# Found it; rewrite line\fR - - \fBchan seek\fR $f [expr {$offset + $idx}] - \fBchan puts\fR -nonewline $f BARFOO - - \fI# Skip to end of following line, and truncate\fR - \fBchan gets\fR $f - \fBchan gets\fR $f - \fBchan truncate\fR $f - - \fI# Stop searching the file now\fR - break - } - - \fI# Save offset of start of next line for later\fR - set offset [\fBchan tell\fR $f] -} -\fBchan close\fR $f -.CE -.PP -A network server that does echoing of its input line-by-line without -preventing servicing of other connections at the same time. -.PP -.CS -# This is a very simple logger... -proc log {message} { - \fBchan puts\fR stdout $message -} - -# This is called whenever a new client connects to the server -proc connect {chan host port} { - set clientName [format <%s:%d> $host $port] - log "connection from $clientName" - \fBchan configure\fR $chan -blocking 0 -buffering line - \fBchan event\fR $chan readable [list echoLine $chan $clientName] -} - -# This is called whenever either at least one byte of input -# data is available, or the channel was closed by the client. -proc echoLine {chan clientName} { - \fBchan gets\fR $chan line - if {[\fBchan eof\fR $chan]} { - log "finishing connection from $clientName" - \fBchan close\fR $chan - } elseif {![\fBchan blocked\fR $chan]} { - # Didn't block waiting for end-of-line - log "$clientName - $line" - \fBchan puts\fR $chan $line - } -} - -# Create the server socket and enter the event-loop to wait -# for incoming connections... -socket -server connect 12345 -vwait forever -.CE -.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), refchan(n), transchan(n) -.SH KEYWORDS -channel, input, output, events, offset -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/class.n b/doc/class.n deleted file mode 100644 index 198ae41..0000000 --- a/doc/class.n +++ /dev/null @@ -1,136 +0,0 @@ -'\" -'\" Copyright (c) 2007 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH class n 0.1 TclOO "TclOO Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -oo::class \- class of all classes -.SH SYNOPSIS -.nf -package require TclOO - -\fBoo::class\fI method \fR?\fIarg ...\fR? -.fi -.SH "CLASS HIERARCHY" -.nf -\fBoo::object\fR - \(-> \fBoo::class\fR -.fi -.BE -.SH DESCRIPTION -.PP -Classes are objects that can manufacture other objects according to a pattern -stored in the factory object (the class). An instance of the class is created -by calling one of the class's factory methods, typically either \fBcreate\fR -if an explicit name is being given, or \fBnew\fR if an arbitrary unique name -is to be automatically selected. -.PP -The \fBoo::class\fR class is the class of all classes; every class is an -instance of this class, which is consequently an instance of itself. This -class is a subclass of \fBoo::object\fR, so every class is also an object. -Additional metaclasses (i.e., classes of classes) can be defined if necessary -by subclassing \fBoo::class\fR. Note that the \fBoo::class\fR object hides the -\fBnew\fR method on itself, so new classes should always be made using the -\fBcreate\fR method. -.SS CONSTRUCTOR -.PP -The constructor of the \fBoo::class\fR class takes an optional argument which, -if present, is sent to the \fBoo::define\fR command (along with the name of -the newly-created class) to allow the class to be conveniently configured at -creation time. -.SS DESTRUCTOR -The \fBoo::class\fR class does not define an explicit destructor. However, -when a class is destroyed, all its subclasses and instances are also -destroyed, along with all objects that it has been mixed into. -.SS "EXPORTED METHODS" -.TP -\fIcls \fBcreate \fIname \fR?\fIarg ...\fR? -. -This creates a new instance of the class \fIcls\fR called \fIname\fR (which is -resolved within the calling context's namespace if not fully qualified), -passing the arguments, \fIarg ...\fR, to the constructor, and (if that returns -a successful result) returning the fully qualified name of the created object -(the result of the constructor is ignored). If the constructor fails (i.e. -returns a non-OK result) then the object is destroyed and the error message is -the result of this method call. -.TP -\fIcls \fBnew \fR?\fIarg ...\fR? -. -This creates a new instance of the class \fIcls\fR with a new unique name, -passing the arguments, \fIarg ...\fR, to the constructor, and (if that returns -a successful result) returning the fully qualified name of the created object -(the result of the constructor is ignored). If the constructor fails (i.e., -returns a non-OK result) then the object is destroyed and the error message is -the result of this method call. -.RS -.PP -Note that this method is not exported by the \fBoo::class\fR object itself, so -classes should not be created using this method. -.RE -.SS "NON-EXPORTED METHODS" -.PP -The \fBoo::class\fR class supports the following non-exported methods: -.TP -\fIcls \fBcreateWithNamespace\fI name nsName\fR ?\fIarg ...\fR? -. -This creates a new instance of the class \fIcls\fR called \fIname\fR (which is -resolved within the calling context's namespace if not fully qualified), -passing the arguments, \fIarg ...\fR, to the constructor, and (if that returns -a successful result) returning the fully qualified name of the created object -(the result of the constructor is ignored). The name of the instance's -internal namespace will be \fInsName\fR unless that namespace already exists -(when an arbitrary name will be chosen instead). If the constructor fails -(i.e., returns a non-OK result) then the object is destroyed and the error -message is the result of this method call. -.SH EXAMPLES -.PP -This example defines a simple class hierarchy and creates a new instance of -it. It then invokes a method of the object before destroying the hierarchy and -showing that the destruction is transitive. -.PP -.CS -\fBoo::class create\fR fruit { - method eat {} { - puts "yummy!" - } -} -\fBoo::class create\fR banana { - superclass fruit - constructor {} { - my variable peeled - set peeled 0 - } - method peel {} { - my variable peeled - set peeled 1 - puts "skin now off" - } - method edible? {} { - my variable peeled - return $peeled - } - method eat {} { - if {![my edible?]} { - my peel - } - next - } -} -set b [banana \fBnew\fR] -$b eat \fI\(-> prints "skin now off" and "yummy!"\fR -fruit destroy -$b eat \fI\(-> error "unknown command"\fR -.CE -.SH "SEE ALSO" -oo::define(n), oo::object(n) -.SH KEYWORDS -class, metaclass, object -.\" Local variables: -.\" mode: nroff -.\" fill-column: 78 -.\" End: diff --git a/doc/clock.n b/doc/clock.n deleted file mode 100644 index ac50e36..0000000 --- a/doc/clock.n +++ /dev/null @@ -1,937 +0,0 @@ -'\" -'\" Generated from file './doc/clock.dt' by tcllib/doctools with format 'nroff' -'\" Copyright (c) 2004 Kevin B. Kenny . All rights reserved. -'\" -.TH "clock" n 8.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -.SH NAME -clock \- Obtain and manipulate dates and times -.SH "SYNOPSIS" -package require \fBTcl 8.5\fR -.sp -\fBclock add\fR \fItimeVal\fR ?\fIcount unit...\fR? ?\fI\-option value\fR? -.sp -\fBclock clicks\fR ?\fI\-option\fR? -.sp -\fBclock format\fR \fItimeVal\fR ?\fI\-option value\fR...? -.sp -\fBclock microseconds\fR -.sp -\fBclock milliseconds\fR -.sp -\fBclock scan\fR \fIinputString\fR ?\fI\-option value\fR...? -.sp -\fBclock seconds\fR -.sp -.BE -.SH "DESCRIPTION" -.PP -The \fBclock\fR command performs several operations that obtain and -manipulate values that represent times. The command supports several -subcommands that determine what action is carried out by the command. -.TP -\fBclock add\fR \fItimeVal\fR ?\fIcount unit...\fR? ?\fI\-option value\fR? -Adds a (possibly negative) offset to a time that is expressed as an -integer number of seconds. See \fBCLOCK ARITHMETIC\fR for a full description. -.TP -\fBclock clicks\fR ?\fI\-option\fR? -If no \fI\-option\fR argument is supplied, returns a high-resolution -time value as a system-dependent integer value. The unit of the value -is system-dependent but should be the highest resolution clock available -on the system such as a CPU cycle counter. See \fBHIGH RESOLUTION TIMERS\fR for a full description. -.RS -.PP -If the \fI\-option\fR argument is \fB\-milliseconds\fR, then the command -is synonymous with \fBclock milliseconds\fR (see below). This -usage is obsolete, and \fBclock milliseconds\fR is to be -considered the preferred way of obtaining a count of milliseconds. -.PP -If the \fI\-option\fR argument is \fB\-microseconds\fR, then the command -is synonymous with \fBclock microseconds\fR (see below). This -usage is obsolete, and \fBclock microseconds\fR is to be -considered the preferred way of obtaining a count of microseconds. -.RE -.TP -\fBclock format\fR \fItimeVal\fR ?\fI\-option value\fR...? -Formats a time that is expressed as an integer number of seconds into a format -intended for consumption by users or external programs. -See \fBFORMATTING TIMES\fR for a full description. -.TP -\fBclock microseconds\fR -Returns the current time as an integer number of microseconds. See \fBHIGH RESOLUTION TIMERS\fR for a full description. -.TP -\fBclock milliseconds\fR -Returns the current time as an integer number of milliseconds. See \fBHIGH RESOLUTION TIMERS\fR for a full description. -.TP -\fBclock scan\fR \fIinputString\fR ?\fI\-option value\fR...? -Scans a time that is expressed as a character string and produces an -integer number of seconds. -See \fBSCANNING TIMES\fR for a full description. -.TP -\fBclock seconds\fR -Returns the current time as an integer number of seconds. -.SS "PARAMETERS" -.TP -\fIcount\fR -An integer representing a count of some unit of time. See -\fBCLOCK ARITHMETIC\fR for the details. -.TP -\fItimeVal\fR -An integer value passed to the \fBclock\fR command that represents an -absolute time as a number of seconds from the \fIepoch time\fR of -1 January 1970, 00:00 UTC. Note that the count of seconds does not -include any leap seconds; seconds are counted as if each UTC day has -exactly 86400 seconds. Tcl responds to leap seconds by speeding or -slowing its clock by a tiny fraction for some minutes until it is -back in sync with UTC; its data model does not represent minutes that -have 59 or 61 seconds. -.TP -\fIunit\fR -One of the words, \fBseconds\fR, \fBminutes\fR, \fBhours\fR, -\fBdays\fR, \fBweekdays\fR, \fBweeks\fR, \fBmonths\fR, or \fByears\fR. -Used in conjunction with \fIcount\fR to identify an interval of time, -for example, \fI3 seconds\fR or \fI1 year\fR. -.SS "OPTIONS" -.TP -\fB\-base\fR time -Specifies that any relative times present in a \fBclock scan\fR command -are to be given relative to \fItime\fR. \fItime\fR must be expressed as -a count of nominal seconds from the epoch time of 1 January 1970, 00:00 UTC. -.TP -\fB\-format\fR format -Specifies the desired output format for \fBclock format\fR or the -expected input format for \fBclock scan\fR. The \fIformat\fR string consists -of any number of characters other than the per-cent sign -.PQ \fB%\fR -interspersed with any number of \fIformat groups\fR, which are two-character -sequences beginning with the per-cent sign. The permissible format groups, -and their interpretation, are described under \fBFORMAT GROUPS\fR. -.RS -.PP -On \fBclock format\fR, the default format is -.PP -.CS -%a %b %d %H:%M:%S %Z %Y -.CE -.PP -On \fBclock scan\fR, the lack of a \fB\-format\fR option indicates that a -.QW "free format scan" -is requested; see \fBFREE FORM SCAN\fR for a description of what happens. -.RE -.TP -\fB\-gmt\fR boolean -If \fIboolean\fR is true, specifies that a time specified to \fBclock add\fR, -\fBclock format\fR or \fBclock scan\fR should be processed in -UTC. If \fIboolean\fR is false, the processing defaults to the local time -zone. This usage is obsolete; the correct current usage is to -specify the UTC time zone with -.QW "\fB\-timezone\fR \fI:UTC\fR" -or any of the equivalent ways to specify it. -.TP -\fB\-locale\fR localeName -Specifies that locale-dependent scanning and formatting (and date arithmetic -for dates preceding the adoption of the Gregorian calendar) is to be done in -the locale identified by \fIlocaleName\fR. The locale name may be any of -the locales acceptable to the \fBmsgcat\fR package, or it may be the special -name \fIsystem\fR, which represents the current locale of the process, or -the null string, which represents Tcl's default locale. -.RS -.PP -The effect of locale on scanning and formatting is discussed in the -descriptions of the individual format groups under \fBFORMAT GROUPS\fR. -The effect of locale on clock arithmetic is discussed under -\fBCLOCK ARITHMETIC\fR. -.RE -.TP -\fB\-timezone\fR zoneName -Specifies that clock arithmetic, formatting, and scanning are to be done -according to the rules for the time zone specified by \fIzoneName\fR. -The permissible values, and their interpretation, are discussed under -\fBTIME ZONES\fR. -On subcommands that expect a \fB\-timezone\fR argument, the default -is to use the \fIcurrent time zone\fR. The current time zone is -determined, in order of preference, by: -.RS -.IP [1] -the environment variable \fBTCL_TZ\fR. -.IP [2] -the environment variable \fBTZ\fR. -.IP [3] -on Windows systems, the time zone settings from the Control Panel. -.RE -.PP -If none of these is present, the C \fBlocaltime\fR and \fBmktime\fR -functions are used to attempt to convert times between local and -Greenwich. On 32-bit systems, this approach is likely to have bugs, -particularly for times that lie outside the window (approximately the -years 1902 to 2037) that can be represented in a 32-bit integer. -.SH "CLOCK ARITHMETIC" -.PP -The \fBclock add\fR command performs clock arithmetic on a value -(expressed as nominal seconds from the epoch time of 1 January 1970, 00:00 UTC) -given as its first argument. The remaining arguments (other than the -possible \fB\-timezone\fR, \fB\-locale\fR and \fB\-gmt\fR options) -are integers and keywords in alternation, where the keywords are chosen -from \fBseconds\fR, \fBminutes\fR, \fBhours\fR, -\fBdays\fR, \fBweekdays\fR, \fBweeks\fR, \fBmonths\fR, or \fByears\fR. -.PP -Addition of seconds, minutes and hours is fairly straightforward; -the given time increment (times sixty for minutes, or 3600 for hours) -is simply added to the \fItimeVal\fR given -to the \fBclock add\fR command. The result is interpreted as -a nominal number of seconds from the Epoch. -.PP -Surprising results -may be obtained when crossing a point at which a leap second is -inserted or removed; the \fBclock add\fR command simply ignores -leap seconds and therefore assumes that times come in sequence, -23:59:58, 23:59:59, 00:00:00. (This assumption is handled by -the fact that Tcl's model of time reacts to leap seconds by speeding -or slowing the clock by a minuscule amount until Tcl's time -is back in step with the world. -.PP -The fact that adding and subtracting hours is defined in terms of -absolute time means that it will add fixed amounts of time in time zones -that observe summer time (Daylight Saving Time). For example, -the following code sets the value of \fBx\fR to \fB04:00:00\fR because -the clock has changed in the interval in question. -.PP -.CS -set s [\fBclock scan\fR {2004-10-30 05:00:00} \e - -format {%Y-%m-%d %H:%M:%S} \e - -timezone :America/New_York] -set a [\fBclock add\fR $s 24 hours -timezone :America/New_York] -set x [\fBclock format\fR $a \e - -format {%H:%M:%S} -timezone :America/New_York] -.CE -.PP -Adding and subtracting days and weeks is accomplished by converting -the given time to a calendar day and time of day in the appropriate -time zone and locale. The requisite number of days (weeks are converted -to days by multiplying by seven) is added to the calendar day, and -the date and time are then converted back to a count of seconds from -the epoch time. The \fBweekdays\fR keyword is similar to \fBdays\fR, -with the only difference that weekends - Saturdays and Sundays - are skipped. -.PP -Adding and subtracting a given number of days across the point that -the time changes at the start or end of summer time (Daylight Saving Time) -results in the \fIsame local time\fR on the day in question. For -instance, the following code sets the value of \fBx\fR to \fB05:00:00\fR. -.PP -.CS -set s [\fBclock scan\fR {2004-10-30 05:00:00} \e - -format {%Y-%m-%d %H:%M:%S} \e - -timezone :America/New_York] -set a [\fBclock add\fR $s 1 day -timezone :America/New_York] -set x [\fBclock format\fR $a \e - -format {%H:%M:%S} -timezone :America/New_York] -.CE -.PP -In cases of ambiguity, where the same local time happens twice -on the same day, the earlier time is used. In cases where the conversion -yields an impossible time (for instance, 02:30 during the Spring -Daylight Saving Time change using US rules), the time is converted -as if the clock had not changed. Thus, the following code -will set the value of \fBx\fR to \fB03:30:00\fR. -.PP -.CS -set s [\fBclock scan\fR {2004-04-03 02:30:00} \e - -format {%Y-%m-%d %H:%M:%S} \e - -timezone :America/New_York] -set a [\fBclock add\fR $s 1 day -timezone :America/New_York] -set x [\fBclock format\fR $a \e - -format {%H:%M:%S} -timezone :America/New_York] -.CE -.PP -Adding a given number of days or weeks works correctly across the conversion -between the Julian and Gregorian calendars; the omitted days are skipped. -The following code sets \fBz\fR to \fB1752-09-14\fR. -.PP -.CS -set x [\fBclock scan\fR 1752-09-02 -format %Y-%m-%d -locale en_US] -set y [\fBclock add\fR $x 1 day -locale en_US] -set z [\fBclock format\fR $y -format %Y-%m-%d -locale en_US] -.CE -.PP -In the bizarre case that adding the given number of days yields a date -that does not exist because it falls within the dropped days of the -Julian-to-Gregorian conversion, the date is converted as if it was -on the Julian calendar. -.PP -Adding a number of months, or a number of years, is similar; it -converts the given time to a calendar date and time of day. It then -adds the requisite number of months or years, and reconverts the resulting -date and time of day to an absolute time. -.PP -If the resulting date is impossible because the month has too few days -(for example, when adding 1 month to 31 January), the last day of the -month is substituted. Thus, adding 1 month to 31 January will result in -28 February in a common year or 29 February in a leap year. -.PP -The rules for handling anomalies relating to summer time and to the -Gregorian calendar are the same when adding/subtracting months and -years as they are when adding/subtracting days and weeks. -.PP -If multiple \fIcount unit\fR pairs are present on the command, they -are evaluated consecutively, from left to right. -.SH "HIGH RESOLUTION TIMERS" -.PP -Most of the subcommands supported by the \fBclock\fR command deal with -times represented as a count of seconds from the epoch time, and this is the -representation that \fBclock seconds\fR returns. There are three exceptions, -which are all intended for use where higher-resolution times are required. -\fBclock milliseconds\fR returns the count of milliseconds from the -epoch time, and \fBclock microseconds\fR returns the count of microseconds -from the epoch time. In addition, there is a \fBclock clicks\fR command -that returns a platform-dependent high-resolution timer. Unlike -\fBclock seconds\fR and \fBclock milliseconds\fR, the value -of \fBclock clicks\fR is not guaranteed to be tied to any fixed -epoch; it is simply intended to be the most precise interval timer -available, and is intended only for relative timing studies such as -benchmarks. -.SH "FORMATTING TIMES" -.PP -The \fBclock format\fR command produces times for display to a user -or writing to an external medium. The command accepts times that are -expressed in seconds from the epoch time of 1 January 1970, 00:00 UTC, -as returned by \fBclock seconds\fR, \fBclock scan\fR, \fBclock add\fR, -\fBfile atime\fR or \fBfile mtime\fR. -.PP -If a \fB\-format\fR option is present, the following argument is -a string that specifies how the date and time are to be formatted. -The string consists -of any number of characters other than the per-cent sign -.PQ \fB%\fR -interspersed with any number of \fIformat groups\fR, which are two-character -sequences beginning with the per-cent sign. The permissible format groups, -and their interpretation, are described under \fBFORMAT GROUPS\fR. -.PP -If a \fB\-timezone\fR option is present, the following -argument is a string that specifies the time zone in which the date and time -are to be formatted. As an alternative to -.QW "\fB\-timezone\fR \fI:UTC\fR" , -the obsolete usage -.QW "\fB\-gmt\fR \fItrue\fR" -may be used. See -\fBTIME ZONES\fR for the permissible variants for the time zone. -.PP -If a \fB\-locale\fR option is present, the following argument is -a string that specifies the locale in which the time is to be formatted, -in the same format that is used for the \fBmsgcat\fR package. Note -that the default, if \fB\-locale\fR is not specified, is the root locale -\fB{}\fR rather than the current locale. The current locale may -be obtained by using \fB\-locale\fR \fBcurrent\fR. -In addition, some platforms support a \fBsystem\fR locale that -reflects the user's current choices. For instance, on Windows, the -format that the user has selected from dates and times in the Control -Panel can be obtained by using the \fBsystem\fR locale. On -platforms that do not define a user selection of date and time formats -separate from \fBLC_TIME\fR, \fB\-locale\fR \fBsystem\fR is -synonymous with \fB\-locale\fR \fBcurrent\fR. -.SH "SCANNING TIMES" -.PP -The \fBclock scan\fR command accepts times that are formatted as -strings and converts them to counts of seconds from the epoch time -of 1 January 1970, 00:00 UTC. It normally takes a \fB\-format\fR -option that is followed by a string describing -the expected format of the input. (See -\fBFREE FORM SCAN\fR for the effect of \fBclock scan\fR -without such an argument.) The string consists of any number of -characters other than the per-cent sign -.PQ \fB%\fR "" , -interspersed with any number of \fIformat groups\fR, which are two-character -sequences beginning with the per-cent sign. The permissible format groups, -and their interpretation, are described under \fBFORMAT GROUPS\fR. -.PP -If a \fB\-timezone\fR option is present, the following -argument is a string that specifies the time zone in which the date and time -are to be interpreted. As an alternative to \fB\-timezone\fR \fI:UTC\fR, -the obsolete usage \fB\-gmt\fR \fItrue\fR may be used. See -\fBTIME ZONES\fR for the permissible variants for the time zone. -.PP -If a \fB\-locale\fR option is present, the following argument is -a string that specifies the locale in which the time is to be interpreted, -in the same format that is used for the \fBmsgcat\fR package. Note -that the default, if \fB\-locale\fR is not specified, is the root locale -\fB{}\fR rather than the current locale. The current locale may -be obtained by using \fB\-locale\fR \fBcurrent\fR. -In addition, some platforms support a \fBsystem\fR locale that -reflects the user's current choices. For instance, on Windows, the -format that the user has selected from dates and times in the Control -Panel can be obtained by using the \fBsystem\fR locale. On -platforms that do not define a user selection of date and time formats -separate from \fBLC_TIME\fR, \fB\-locale\fR \fBsystem\fR is -synonymous with \fB\-locale\fR \fBcurrent\fR. -.PP -If a \fB\-base\fR option is present, the following argument is -a time (expressed in seconds from the epoch time) that is used as -a \fIbase time\fR for interpreting relative times. If no -\fB\-base\fR option is present, the base time is the current time. -.PP -Scanning of times in fixed format works by determining three things: -the date, the time of day, and the time zone. These three are then -combined into a point in time, which is returned as the number of seconds -from the epoch. -.PP -Before scanning begins, the format string is preprocessed -to replace \fB%c\fR, \fB%Ec\fR, \fB%x\fR, \fB%Ex\fR, -\fB%X\fR. \fB%Ex\fR, \fB%r\fR, \fB%R\fR, \fB%T\fR, -\fB%D\fR, \fB%EY\fR and \fB%+\fR format groups with counterparts -that are appropriate to the current locale and contain none of the -above groups. For instance, \fB%D\fR will (in the \fBen_US\fR locale) -be replaced with \fB%m/%d/%Y\fR. -.PP -The date is determined according to the fields that are present in the -preprocessed format string. In order of preference: -.IP [1] -If the string contains a \fB%s\fR format group, representing -seconds from the epoch, that group is used to determine the date. -.IP [2] -If the string contains a \fB%J\fR format group, representing -the Julian Day Number, that group is used to determine the date. -.IP [3] -If the string contains a complete set of format groups specifying -century, year, month, and day of month; century, year, and day of year; -or ISO8601 fiscal year, week of year, and day of week; those groups are -combined and used to determine the date. If more than one complete -set is present, the one at the rightmost position in the string is -used. -.IP [4] -If the string lacks a century but contains a set of format -groups specifying year of century, month and day of month; year of -century and day of year; or two-digit ISO8601 fiscal year, week of year, -and day of week; those groups are -combined and used to determine the date. If more than one complete -set is present, the one at the rightmost position in the string is -used. The year is presumed to lie in the range 1938 to 2037 inclusive. -.IP [5] -If the string entirely lacks any specification for the year -(or contains the year only on the locale's alternative calendar) -and contains a set of format groups specifying month and day of month, -day of year, or week of year and day of week, those groups are -combined and used to determine the date. If more than one complete -set is present, the one at the rightmost position in the string is -used. The year is determined by interpreting the base time in the given -time zone. -.IP [6] -If the string contains none of the above sets, but has a day -of the month or day of the week, the day of the month or day of the week -are used to determine the date by interpreting the base time in the -given time zone and returning the given day of the current week or month. -(The week runs from Monday to Sunday, ISO8601-fashion.) If both day -of month and day of week are present, the day of the month takes -priority. -.IP [7] -If none of the above rules results in a usable date, the date -of the base time in the given time zone is used. -.PP -The time is also determined according to the fields that are present in the -preprocessed format string. In order of preference: -.IP [1] -If the string contains a \fB%s\fR format group, representing -seconds from the epoch, that group determines the time of day. -.IP [2] -If the string contains either an hour on the 24-hour clock -or an hour on the 12-hour clock plus an AM/PM indicator, that hour determines -the hour of the day. If the string further contains a group specifying -the minute of the hour, that group combines with the hour. If the string -further contains a group specifying the second of the minute, that group -combines with the hour and minute. -.IP [3] -If the string contains neither a \fB%s\fR format group nor -a group specifying the hour of the day, then midnight (\fB00:00\fR, the start -of the given date) is used. -The time zone is determined by either the \fB\-timezone\fR or \fB\-gmt\fR -options, or by using the current time zone. -.PP -If a format string lacks a \fB%z\fR or \fB%Z\fR format group, -it is possible for the time to be ambiguous because it appears twice -in the same day, once without and once with Daylight Saving Time. -If this situation occurs, the first occurrence of the time is chosen. -(For this reason, it is wise to have the input string contain the -time zone when converting local times. This caveat does not apply to -UTC times.) -.SH "FORMAT GROUPS" -.PP -The following format groups are recognized by the \fBclock scan\fR and -\fBclock format\fR commands. -.TP -\fB%a\fR -On output, receives an abbreviation (\fIe.g.,\fR \fBMon\fR) for the day -of the week in the given locale. On input, matches the name of the day -of the week in the given locale (in either abbreviated or full form, or -any unique prefix of either form). -.TP -\fB%A\fR -On output, receives the full name (\fIe.g.,\fR \fBMonday\fR) of the day -of the week in the given locale. On input, matches the name of the day -of the week in the given locale (in either abbreviated or full form, or -any unique prefix of either form). -.TP -\fB%b\fR -On output, receives an abbreviation (\fIe.g.,\fR \fBJan\fR) for the name -of the month in the given locale. On input, matches the name of the month -in the given locale (in either abbreviated or full form, or -any unique prefix of either form). -.TP -\fB%B\fR -On output, receives the full name (\fIe.g.,\fR \fBJanuary\fR) -of the month in the given locale. On input, matches the name of the month -in the given locale (in either abbreviated or full form, or -any unique prefix of either form). -.TP -\fB%c\fR -On output, receives a localized representation of date and time of day; -the localized representation is expected to use the Gregorian calendar. -On input, matches whatever \fB%c\fR produces. -.TP -\fB%C\fR -On output, receives the number of the century in Indo-Arabic numerals. -On input, matches one or two digits, possibly with leading whitespace, -that are expected to be the number of the century. -.TP -\fB%d\fR -On output, produces the number of the day of the month, as two decimal -digits. On input, matches one or two digits, possibly with leading -whitespace, that are expected to be the number of the day of the month. -.TP -\fB%D\fR -This format group is synonymous with \fB%m/%d/%Y\fR. It should be -used only in exchanging data within the \fBen_US\fR locale, since -other locales typically do not use this order for the fields of the date. -.TP -\fB%e\fR -On output, produces the number of the day of the month, as one or -two decimal digits (with a leading blank for one-digit dates). -On input, matches one or two digits, possibly with leading -whitespace, that are expected to be the number of the day of the month. -.TP -\fB%Ec\fR -On output, produces a locale-dependent representation of the date and -time of day in the locale's alternative calendar. On input, matches -whatever \fB%Ec\fR produces. The locale's alternative calendar need not -be the Gregorian calendar. -.TP -\fB%EC\fR -On output, produces a locale-dependent name of an era in the locale's -alternative calendar. On input, matches the name of the era or any -unique prefix. -.TP -\fB%EE\fR -On output, produces the string \fBB.C.E.\fR or \fBC.E.\fR, or a -string of the same meaning in the locale, to indicate whether \fB%Y\fR refers -to years before or after Year 1 of the Common Era. On input, accepts -the string \fBB.C.E.\fR, \fBB.C.\fR, \fBC.E.\fR, \fBA.D.\fR, or the -abbreviation appropriate to the current locale, and uses it to fix -whether \fB%Y\fR refers to years before or after Year 1 of the -Common Era. -.TP -\fB%Ex\fR -On output, produces a locale-dependent representation of the date -in the locale's alternative calendar. On input, matches -whatever \fB%Ex\fR produces. The locale's alternative calendar need not -be the Gregorian calendar. -.TP -\fB%EX\fR -On output, produces a locale-dependent representation of the -time of day in the locale's alternative numerals. On input, matches -whatever \fB%EX\fR produces. -.TP -\fB%Ey\fR -On output, produces a locale-dependent number of the year of the era -in the locale's alternative calendar and numerals. On input, matches -such a number. -.TP -\fB%EY\fR -On output, produces a representation of the year in the locale's -alternative calendar and numerals. On input, matches what \fB%EY\fR -produces. Often synonymous with \fB%EC%Ey\fR. -.TP -\fB%g\fR -On output, produces a two-digit year number suitable for use with -the week-based ISO8601 calendar; that is, the year number corresponds -to the week number produced by \fB%V\fR. On input, accepts such -a two-digit year number, possibly with leading whitespace. -.TP -\fB%G\fR -On output, produces a four-digit year number suitable for use with -the week-based ISO8601 calendar; that is, the year number corresponds -to the week number produced by \fB%V\fR. On input, accepts such -a four-digit year number, possibly with leading whitespace. -.TP -\fB%h\fR -This format group is synonymous with \fB%b\fR. -.TP -\fB%H\fR -On output, produces a two-digit number giving the hour of the day -(00-23) on a 24-hour clock. On input, accepts such a number. -.TP -\fB%I\fR -On output, produces a two-digit number giving the hour of the day -(12-11) on a 12-hour clock. On input, accepts such a number. -.TP -\fB%j\fR -On output, produces a three-digit number giving the day of the year -(001-366). On input, accepts such a number. -.TP -\fB%J\fR -On output, produces a string of digits giving the Julian Day Number. -On input, accepts a string of digits and interprets it as a Julian Day Number. -The Julian Day Number is a count of the number of calendar days -that have elapsed since 1 January, 4713 BCE of the proleptic -Julian calendar. The epoch time of 1 January 1970 corresponds -to Julian Day Number 2440588. -.TP -\fB%k\fR -On output, produces a one- or two-digit number giving the hour of the day -(0-23) on a 24-hour clock. On input, accepts such a number. -.TP -\fB%l\fR -On output, produces a one- or two-digit number giving the hour of the day -(12-11) on a 12-hour clock. On input, accepts such a number. -.TP -\fB%m\fR -On output, produces the number of the month (01-12) with exactly two -digits. On input, accepts two digits and interprets them as the number -of the month. -.TP -\fB%M\fR -On output, produces the number of the minute of the hour (00-59) -with exactly two digits. On input, accepts two digits and interprets them -as the number of the minute of the hour. -.TP -\fB%N\fR -On output, produces the number of the month (1-12) with one or two digits, -and a leading blank for one-digit dates. -On input, accepts one or two digits, possibly with leading whitespace, -and interprets them as the number of the month. -.TP -\fB%Od\fR, \fB%Oe\fR, \fB%OH\fR, \fB%OI\fR, \fB%Ok\fR, \fB%Ol\fR, \fB%Om\fR, \fB%OM\fR, \fB%OS\fR, \fB%Ou\fR, \fB%Ow\fR, \fB%Oy\fR -All of these format groups are synonymous with their counterparts -without the -.QW \fBO\fR , -except that the string is produced and parsed in the -locale-dependent alternative numerals. -.TP -\fB%p\fR -On output, produces an indicator for the part of the day, \fBAM\fR -or \fBPM\fR, appropriate to the given locale. If the script of the -given locale supports multiple letterforms, lowercase is preferred. -On input, matches the representation \fBAM\fR or \fBPM\fR in -the given locale, in either case. -.TP -\fB%P\fR -On output, produces an indicator for the part of the day, \fBam\fR -or \fBpm\fR, appropriate to the given locale. If the script of the -given locale supports multiple letterforms, uppercase is preferred. -On input, matches the representation \fBAM\fR or \fBPM\fR in -the given locale, in either case. -.TP -\fB%Q\fR -This format group is reserved for internal use within the Tcl library. -.TP -\fB%r\fR -On output, produces a locale-dependent time of day representation on a -12-hour clock. On input, accepts whatever \fB%r\fR produces. -.TP -\fB%R\fR -On output, the time in 24-hour notation (%H:%M). For a version -including the seconds, see \fB%T\fR below. On input, accepts whatever -\fB%R\fR produces. -.TP -\fB%s\fR -On output, simply formats the \fItimeVal\fR argument as a decimal -integer and inserts it into the output string. On input, accepts -a decimal integer and uses is as the time value without any further -processing. Since \fB%s\fR uniquely determines a point in time, it -overrides all other input formats. -.TP -\fB%S\fR -On output, produces a two-digit number of the second of the minute -(00-59). On input, accepts two digits and uses them as the second of the -minute. -.TP -\fB%t\fR -On output, produces a TAB character. On input, matches a TAB character. -.TP -\fB%T\fR -Synonymous with \fB%H:%M:%S\fR. -.TP -\fB%u\fR -On output, produces the number of the day of the week -(\fB1\fR\(->Monday, \fB7\fR\(->Sunday). On input, accepts a single digit and -interprets it as the day of the week. Sunday may be either \fB0\fR or -\fB7\fR. -.TP -\fB%U\fR -On output, produces the ordinal number of the week of the year -(00-53). The first Sunday of the year is the first day of week 01. On -input accepts two digits which are otherwise ignored. This format -group is never used in determining an input date. This interpretation -of the week of the year was once common in US banking but is now -largely obsolete. See \fB%V\fR for the ISO8601 week number. -.TP -\fB%V\fR -On output, produces the number of the ISO8601 week as a two digit -number (01-53). Week 01 is the week containing January 4; or the first -week of the year containing at least 4 days; or the week containing -the first Thursday of the year (the three statements are -equivalent). Each week begins on a Monday. On input, accepts the -ISO8601 week number. -.TP -\fB%w\fR -On output, produces the ordinal number of the day of the week -(Sunday==0; Saturday==6). On input, accepts a single digit and -interprets it as the day of the week; Sunday may be represented as -either 0 or 7. Note that \fB%w\fR is not the ISO8601 weekday number, -which is produced and accepted by \fB%u\fR. -.TP -\fB%W\fR -On output, produces a week number (00-53) within the year; week 01 -begins on the first Monday of the year. On input, accepts two digits, -which are otherwise ignored. This format group is never used in -determining an input date. It is not the ISO8601 week number; that -week is produced and accepted by \fB%V\fR. -.TP -\fB%x\fR -On output, produces the date in a locale-dependent representation. On -input, accepts whatever \fB%x\fR produces and is used to determine -calendar date. -.TP -\fB%X\fR -On output, produces the time of day in a locale-dependent -representation. On input, accepts whatever \fB%X\fR produces and is used -to determine time of day. -.TP -\fB%y\fR -On output, produces the two-digit year of the century. On input, -accepts two digits, and is used to determine calendar date. The -date is presumed to lie between 1938 and 2037 inclusive. Note -that \fB%y\fR does not yield a year appropriate for use with the ISO8601 -week number \fB%V\fR; programs should use \fB%g\fR for that purpose. -.TP -\fB%Y\fR -On output, produces the four-digit calendar year. On input, -accepts four digits and may be used to determine calendar date. Note -that \fB%Y\fR does not yield a year appropriate for use with the ISO8601 -week number \fB%V\fR; programs should use \fB%G\fR for that purpose. -.TP -\fB%z\fR -On output, produces the current time zone, expressed in hours and -minutes east (+hhmm) or west (\-hhmm) of Greenwich. On input, accepts a -time zone specifier (see \fBTIME ZONES\fR below) that will be used to -determine the time zone. -.TP -\fB%Z\fR -On output, produces the current time zone's name, possibly -translated to the given locale. On input, accepts a time zone -specifier (see \fBTIME ZONES\fR below) that will be used to determine the -time zone. This option should, in general, be used on input only when -parsing RFC822 dates. Other uses are fraught with ambiguity; for -instance, the string \fBBST\fR may represent British Summer Time or -Brazilian Standard Time. It is recommended that date/time strings for -use by computers use numeric time zones instead. -.TP -\fB%%\fR -On output, produces a literal -.QW \fB%\fR -character. On input, matches a literal -.QW \fB%\fR -character. -.TP -\fB%+\fR -Synonymous with -.QW "\fB%a %b %e %H:%M:%S %Z %Y\fR" . -.SH "TIME ZONES" -.PP -When the \fBclock\fR command is processing a local time, it has several -possible sources for the time zone to use. In order of preference, they -are: -.IP [1] -A time zone specified inside a string being parsed and matched by a \fB%z\fR -or \fB%Z\fR format group. -.IP [2] -A time zone specified with the \fB\-timezone\fR option to the \fBclock\fR -command (or, equivalently, by \fB\-gmt\fR \fB1\fR). -.IP [3] -A time zone specified in an environment variable \fBTCL_TZ\fR. -.IP [4] -A time zone specified in an environment variable \fBTZ\fR. -.IP [5] -The local time zone from the Control Panel on Windows systems. -.IP [6] -The C library's idea of the local time zone, as defined by the -\fBmktime\fR and \fBlocaltime\fR functions. -.PP -In case [1] \fIonly,\fR the string is tested to see if it is one -of the strings: -.PP -.CS - gmt ut utc bst wet wat at - nft nst ndt ast adt est edt - cst cdt mst mdt pst pdt yst - ydt hst hdt cat ahst nt idlw - cet cest met mewt mest swt sst - eet eest bt it zp4 zp5 ist - zp6 wast wadt jt cct jst cast - cadt east eadt gst nzt nzst nzdt - idle -.CE -.PP -If it is a string in the above list, it designates a known -time zone, and is interpreted as such. -.PP -For time zones in case [1] that do not match any of the above strings, -and always for cases [2]-[6], the following rules apply. -.PP -If the time zone begins with a colon, it is one of a -standardized list of names like \fB:America/New_York\fR -that give the rules for various locales. A complete list -of the location names is too lengthy to be listed here. -On most Tcl installations, the definitions of the locations -are to be found in named files in the directory -.QW "\fI/no_backup/tools/lib/tcl8.5/clock/tzdata\fR" . -On some Unix systems, these files are omitted, and the definitions are -instead obtained from system files in -.QW "\fI/usr/share/zoneinfo\fR" , -.QW "\fI/usr/share/lib/zoneinfo\fR" -or -.QW "\fI/usr/local/etc/zoneinfo\fR" . -As a special case, the name \fB:localtime\fR refers to -the local time zone as defined by the C library. -.PP -A time zone string consisting of a plus or minus sign followed by -four or six decimal digits is interpreted as an offset in -hours, minutes, and seconds (if six digits are present) from -UTC. The plus sign denotes a sign east of Greenwich; -the minus sign one west of Greenwich. -.PP -A time zone string conforming to the Posix specification of the \fBTZ\fR -environment variable will be recognized. The specification -may be found at -\fIhttp://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html\fR. -.PP -If the Posix time zone string contains a DST (Daylight Savings Time) -part, but doesn't contain a rule stating when DST starts or ends, -then default rules are used. For Timezones with an offset between 0 -and +12, the current European/Russian rules are used, otherwise the -current US rules are used. In Europe (offset +0 to +2) the switch -to summertime is done each last Sunday in March at 1:00 GMT, and -the switch back is each last Sunday in October at 2:00 GMT. In -Russia (offset +3 to +12), the switch dates are the same, only -the switch to summertime is at 2:00 local time, and the switch -back is at 3:00 local time in all time zones. The US switch to -summertime takes place each second Sunday in March at 2:00 local -time, and the switch back is each first Sunday in November at -3:00 local time. These default rules mean that in all European, -Russian and US (or compatible) time zones, DST calculations will -be correct for dates in 2007 and later, unless in the future the -rules change again. -.PP -Any other time zone string is processed by prefixing a colon and attempting -to use it as a location name, as above. -.SH "LOCALIZATION" -.PP -Developers wishing to localize the date and time formatting and parsing -are referred to \fIhttp://tip.tcl.tk/173\fR for a -specification. -.SH "FREE FORM SCAN" -.PP -If the \fBclock scan\fR command is invoked without a \fB\-format\fR -option, then it requests a \fIfree-form scan.\fR \fI -This form of scan is deprecated.\fR The reason for the deprecation -is that there are too many ambiguities. (Does the string -.QW 2000 -represent a year, a time of day, or a quantity?) No set of rules -for interpreting free-form dates and times has been found to -give unsurprising results in all cases. -.PP -If free-form scan is used, only the \fB\-base\fR and \fB\-gmt\fR -options are accepted. The \fB\-timezone\fR and \fB\-locale\fR -options will result in an error if \fB\-format\fR is not supplied. -.PP -For the benefit of users who need to understand legacy code that -uses free-form scan, the documentation for how free-form scan -interprets a string is included here: -.PP -If only a time is -specified, the current date is assumed. If the \fIinputString\fR -does not contain a -time zone mnemonic, the local time zone is assumed, unless the \fB\-gmt\fR -argument is true, in which case the clock value is calculated assuming -that the specified time is relative to Greenwich Mean Time. -\fB\-gmt\fR, if specified, affects only the computed time value; it does not -impact the interpretation of \fB\-base\fR. -.PP -If the \fB\-base\fR flag is specified, the next argument should contain -an integer clock value. Only the date in this value is used, not the -time. This is useful for determining the time on a specific day or -doing other date-relative conversions. -.PP -The \fIinputString\fR argument consists of zero or more specifications of the -following form: -.TP -\fItime\fR -A time of day, which is of the form: \fBhh?:mm?:ss?? ?meridian? ?zone?\fR -or \fBhhmm ?meridian? ?zone?\fR -If no meridian is specified, \fBhh\fR is interpreted on -a 24-hour clock. -.TP -\fIdate\fR -A specific month and day with optional year. The -acceptable formats are -.QW "\fBmm/dd\fR?\fB/yy\fR?" , -.QW "\fBmonthname dd\fR?\fB, yy\fR?" , -.QW "\fBday, dd monthname \fR?\fByy\fR?" , -.QW "\fBdd monthname yy\fR" , -.QW "?\fBCC\fR?\fByymmdd\fR" , -and -.QW "\fBdd-monthname-\fR?\fBCC\fR?\fByy\fR" . -The default year is the current year. If the year is less -than 100, we treat the years 00-68 as 2000-2068 and the years 69-99 -as 1969-1999. Not all platforms can represent the years 38-70, so -an error may result if these years are used. -.TP -\fIISO 8601 point-in-time\fR -An ISO 8601 point-in-time specification, such as -.QW \fICCyymmdd\fBT\fIhhmmss\fR, -where \fBT\fR is the literal -.QW T , -.QW "\fICCyymmdd hhmmss\fR" , -or -.QW \fICCyymmdd\fBT\fIhh:mm:ss\fR . -Note that only these three formats are accepted. -The command does \fInot\fR accept the full range of point-in-time -specifications specified in ISO8601. Other formats can be recognized by -giving an explicit \fB\-format\fR option to the \fBclock scan\fR command. -.TP -\fIrelative time\fR -A specification relative to the current time. The format is \fBnumber -unit\fR. Acceptable units are \fByear\fR, \fBfortnight\fR, -\fBmonth\fR, \fBweek\fR, \fBday\fR, -\fBhour\fR, \fBminute\fR (or \fBmin\fR), and \fBsecond\fR (or \fBsec\fR). The -unit can be specified as a singular or plural, as in \fB3 weeks\fR. -These modifiers may also be specified: -\fBtomorrow\fR, \fByesterday\fR, \fBtoday\fR, \fBnow\fR, -\fBlast\fR, \fBthis\fR, \fBnext\fR, \fBago\fR. -.PP -The actual date is calculated according to the following steps. -.PP -First, any absolute date and/or time is processed and converted. -Using that time as the base, day-of-week specifications are added. -Next, relative specifications are used. If a date or day is -specified, and no absolute or relative time is given, midnight is -used. Finally, a correction is applied so that the correct hour of -the day is produced after allowing for daylight savings time -differences and the correct date is given when going from the end -of a long month to a short month. -.SH "SEE ALSO" -msgcat(n) -.SH KEYWORDS -clock, date, time -.SH "COPYRIGHT" -Copyright (c) 2004 Kevin B. Kenny . All rights reserved. -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/close.n b/doc/close.n deleted file mode 100644 index 5daf3e2..0000000 --- a/doc/close.n +++ /dev/null @@ -1,108 +0,0 @@ -'\" -'\" 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. -'\" -.TH close n 7.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -close \- Close an open channel -.SH SYNOPSIS -\fBclose \fIchannelId\fR ?r(ead)|w(rite)? -.BE -.SH DESCRIPTION -.PP -Closes or half-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 -The single-argument form is a simple -.QW "full-close" : -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. -.VS 8.6 -From 8.6 on (TIP#398), nonblocking channels are no longer switched to blocking mode when exiting; this guarantees a timely exit even when the peer or a communication channel is stalled. To ensure proper flushing of stalled nonblocking channels on exit, one must now either (a) actively switch them back to blocking or (b) use the environment variable TCL_FLUSH_NONBLOCKING_ON_EXIT, which when set and not equal to "0" restores the previous behavior. -.VE 8.6 -.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.) -.PP -.VS 8.6 -The two-argument form is a -.QW "half-close" : -given a bidirectional channel like a -socket or command pipeline and a (possibly abbreviated) direction, it closes -only the sub-stream going in that direction. This means a shutdown() on a -socket, and a close() of one end of a pipe for a command pipeline. Then, the -Tcl-level channel data structure is either kept or freed depending on whether -the other direction is still open. -.PP -A single-argument close on an already half-closed bidirectional channel is -defined to just -.QW "finish the job" . -A half-close on an already closed half, or on a wrong-sided unidirectional -channel, raises an error. -.PP -In the case of a command pipeline, the child-reaping duty falls upon the -shoulders of the last close or half-close, which is thus allowed to report an -abnormal exit error. -.PP -Currently only sockets and command pipelines support half-close. A future -extension will allow reflected and stacked channels to do so. -.VE 8.6 -.SH EXAMPLE -.PP -This illustrates how you can use Tcl to ensure that files get closed -even when errors happen by combining \fBcatch\fR, \fBclose\fR and -\fBreturn\fR: -.PP -.CS -proc withOpenFile {filename channelVar script} { - upvar 1 $channelVar chan - set chan [open $filename] - catch { - uplevel 1 $script - } result options - \fBclose\fR $chan - return -options $options $result -} -.CE -.SH "SEE ALSO" -file(n), open(n), socket(n), eof(n), Tcl_StandardChannels(3) -.SH KEYWORDS -blocking, channel, close, nonblocking, half-close -'\" Local Variables: -'\" mode: nroff -'\" fill-column: 78 -'\" End: diff --git a/doc/concat.n b/doc/concat.n deleted file mode 100644 index d10f092..0000000 --- a/doc/concat.n +++ /dev/null @@ -1,59 +0,0 @@ -'\" -'\" 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. -'\" -.TH concat n 8.3 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -concat \- Join lists together -.SH SYNOPSIS -\fBconcat\fI \fR?\fIarg arg ...\fR? -.BE -.SH DESCRIPTION -.PP -This command joins each of its arguments together with spaces after -trimming leading and trailing white-space from each of them. If all of the -arguments are lists, this has the same effect as concatenating them -into a single list. -Arguments that are empty (after trimming) are ignored entirely. -It permits any number of arguments; -if no \fIarg\fRs are supplied, the result is an empty string. -.SH EXAMPLES -Although \fBconcat\fR will concatenate lists, flattening them in the process -(so giving the following interactive session): -.PP -.CS -\fI%\fR \fBconcat\fR a b {c d e} {f {g h}} -\fIa b c d e f {g h}\fR -.CE -.PP -it will also concatenate things that are not lists, as can be seen from this -session: -.PP -.CS -\fI%\fR \fBconcat\fR " a b {c " d " e} f" -\fIa b {c d e} f\fR -.CE -.PP -Note also that the concatenation does not remove spaces from the middle of -values, as can be seen here: -.PP -.CS -\fI%\fR \fBconcat\fR "a b c" { d e f } -\fIa b c d e f\fR -.CE -.PP -(i.e., there are three spaces between each of the \fBa\fR, the \fBb\fR and the -\fBc\fR). -.SH "SEE ALSO" -append(n), eval(n), join(n) -.SH KEYWORDS -concatenate, join, list -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/continue.n b/doc/continue.n deleted file mode 100644 index 5eca861..0000000 --- a/doc/continue.n +++ /dev/null @@ -1,47 +0,0 @@ -'\" -'\" 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. -'\" -.TH continue n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -continue \- Skip to the next iteration of a loop -.SH SYNOPSIS -\fBcontinue\fR -.BE -.SH DESCRIPTION -.PP -This command is typically invoked inside the body of a looping command -such as \fBfor\fR or \fBforeach\fR or \fBwhile\fR. -It returns a 4 (\fBTCL_CONTINUE\fR) result code, which causes a continue -exception to occur. -The exception causes the current script to be aborted -out to the innermost containing loop command, which then -continues with the next iteration of the loop. -Continue exceptions are also handled in a few other situations, such -as the \fBcatch\fR command and the outermost scripts of procedure -bodies. -.SH EXAMPLE -.PP -Print a line for each of the integers from 0 to 10 \fIexcept\fR 5: -.PP -.CS -for {set x 0} {$x<10} {incr x} { - if {$x == 5} { - \fBcontinue\fR - } - puts "x is $x" -} -.CE -.SH "SEE ALSO" -break(n), for(n), foreach(n), return(n), while(n) -.SH KEYWORDS -continue, iteration, loop -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/copy.n b/doc/copy.n deleted file mode 100644 index 706be54..0000000 --- a/doc/copy.n +++ /dev/null @@ -1,76 +0,0 @@ -'\" -'\" Copyright (c) 2007 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH copy n 0.1 TclOO "TclOO Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -oo::copy \- create copies of objects and classes -.SH SYNOPSIS -.nf -package require TclOO - -\fBoo::copy\fI sourceObject \fR?\fItargetObject\fR? ?\fItargetNamespace\fR? -.fi -.BE -.SH DESCRIPTION -.PP -The \fBoo::copy\fR command creates a copy of an object or class. It takes the -name of the object or class to be copied, \fIsourceObject\fR, and optionally -the name of the object or class to create, \fItargetObject\fR, which will be -resolved relative to the current namespace if not an absolute qualified name -and -.VS TIP473 -\fItargetNamespace\fR which is the name of the namespace that will hold the -internal state of the object (\fBmy\fR command, etc.); it \fImust not\fR -refer to an existing namespace. -If either \fItargetObject\fR or \fItargetNamespace\fR is omitted or is given -as the empty string, a new name is chosen. Names, unless specified, are -chosen with the same algorithm used by the \fBnew\fR method of -\fBoo::class\fR. -.VE TIP473 -The copied object will be of the same class as the source object, and will have -all its per-object methods copied. If it is a class, it will also have all the -class methods in the class copied, but it will not have any of its instances -copied. -.PP -.VS -After the \fItargetObject\fR has been created and all definitions of its -configuration (e.g., methods, filters, mixins) copied, the \fB\fR -method of \fItargetObject\fR will be invoked, to allow for customization of -the created object such as installing related variable traces. The only -argument given will be \fIsourceObject\fR. The default implementation of this -method (in \fBoo::object\fR) just copies the procedures and variables in the -namespace of \fIsourceObject\fR to the namespace of \fItargetObject\fR. If -this method call does not return a result that is successful (i.e., an error -or other kind of exception) then the \fItargetObject\fR will be deleted and an -error returned. -.VE -.PP -The result of the \fBoo::copy\fR command will be the fully-qualified name of -the new object or class. -.SH EXAMPLES -.PP -This example creates an object, copies it, modifies the source object, and -then demonstrates that the copied object is indeed a copy. -.PP -.CS -oo::object create src -oo::objdefine src method msg {} {puts foo} -\fBoo::copy\fR src dst -oo::objdefine src method msg {} {puts bar} -src msg \fI\(-> prints "bar"\fR -dst msg \fI\(-> prints "foo"\fR -.CE -.SH "SEE ALSO" -oo::class(n), oo::define(n), oo::object(n) -.SH KEYWORDS -clone, copy, duplication, object -.\" Local variables: -.\" mode: nroff -.\" fill-column: 78 -.\" End: diff --git a/doc/coroutine.n b/doc/coroutine.n deleted file mode 100644 index 52775ef..0000000 --- a/doc/coroutine.n +++ /dev/null @@ -1,205 +0,0 @@ -'\" -'\" Copyright (c) 2009 Donal K. Fellows. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH coroutine n 8.6 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -coroutine, yield, yieldto \- Create and produce values from coroutines -.SH SYNOPSIS -.nf -\fBcoroutine \fIname command\fR ?\fIarg...\fR? -\fByield\fR ?\fIvalue\fR? -.VS TIP396 -\fByieldto\fR \fIcommand\fR ?\fIarg...\fR? -\fIname\fR ?\fIvalue...\fR? -.VE TIP396 -.fi -.BE -.SH DESCRIPTION -.PP -The \fBcoroutine\fR command creates a new coroutine context (with associated -command) named \fIname\fR and executes that context by calling \fIcommand\fR, -passing in the other remaining arguments without further interpretation. Once -\fIcommand\fR returns normally or with an exception (e.g., an error) the -coroutine context \fIname\fR is deleted. -.PP -Within the context, values may be generated as results by using the -\fByield\fR command; if no \fIvalue\fR is supplied, the empty string is used. -When that is called, the context will suspend execution and the -\fBcoroutine\fR command will return the argument to \fByield\fR. The execution -of the context can then be resumed by calling the context command, optionally -passing in the \fIsingle\fR value to use as the result of the \fByield\fR call -that caused -the context to be suspended. If the coroutine context never yields and instead -returns conventionally, the result of the \fBcoroutine\fR command will be the -result of the evaluation of the context. -.PP -.VS TIP396 -The coroutine may also suspend its execution by use of the \fByieldto\fR -command, which instead of returning, cedes execution to some command called -\fIcommand\fR (resolved in the context of the coroutine) and to which \fIany -number\fR of arguments may be passed. Since every coroutine has a context -command, \fByieldto\fR can be used to transfer control directly from one -coroutine to another (this is only advisable if the two coroutines are -expecting this to happen) but \fIany\fR command may be the target. If a -coroutine is suspended by this mechanism, the coroutine processing can be -resumed by calling the context command optionally passing in an arbitrary -number of arguments. The return value of the \fByieldto\fR call will be the -list of arguments passed to the context command; it is up to the caller to -decide what to do with those values. -.PP -The recommended way of writing a version of \fByield\fR that allows resumption -with multiple arguments is by using \fByieldto\fR and the \fBreturn\fR -command, like this: -.PP -.CS -proc yieldm {value} { - \fByieldto\fR return -level 0 $value -} -.CE -.VE TIP396 -.PP -The coroutine can also be deleted by destroying the command \fIname\fR, and -the name of the current coroutine can be retrieved by using -\fBinfo coroutine\fR. -If there are deletion traces on variables in the coroutine's -implementation, they will fire at the point when the coroutine is explicitly -deleted (or, naturally, if the command returns conventionally). -.PP -At the point when \fIcommand\fR is called, the current namespace will be the -global namespace and there will be no stack frames above it (in the sense of -\fBupvar\fR and \fBuplevel\fR). However, which command to call will be -determined in the namespace that the \fBcoroutine\fR command was called from. -.SH EXAMPLES -.PP -This example shows a coroutine that will produce an infinite sequence of -even values, and a loop that consumes the first ten of them. -.PP -.CS -proc allNumbers {} { - \fByield\fR - set i 0 - while 1 { - \fByield\fR $i - incr i 2 - } -} -\fBcoroutine\fR nextNumber allNumbers -for {set i 0} {$i < 10} {incr i} { - puts "received [\fInextNumber\fR]" -} -rename nextNumber {} -.CE -.PP -In this example, the coroutine acts to add up the arguments passed to it. -.PP -.CS -\fBcoroutine\fR accumulator apply {{} { - set x 0 - while 1 { - incr x [\fByield\fR $x] - } -}} -for {set i 0} {$i < 10} {incr i} { - puts "$i -> [\fIaccumulator\fR $i]" -} -.CE -.PP -This example demonstrates the use of coroutines to implement the classic Sieve -of Eratosthenes algorithm for finding prime numbers. Note the creation of -coroutines inside a coroutine. -.PP -.CS -proc filterByFactor {source n} { - \fByield\fR [info coroutine] - while 1 { - set x [\fI$source\fR] - if {$x % $n} { - \fByield\fR $x - } - } -} -\fBcoroutine\fR allNumbers apply {{} {while 1 {\fByield\fR [incr x]}}} -\fBcoroutine\fR eratosthenes apply {c { - \fByield\fR - while 1 { - set n [\fI$c\fR] - \fByield\fR $n - set c [\fBcoroutine\fR prime$n filterByFactor $c $n] - } -}} allNumbers -for {set i 1} {$i <= 20} {incr i} { - puts "prime#$i = [\fIeratosthenes\fR]" -} -.CE -.PP -.VS TIP396 -This example shows how a value can be passed around a group of three -coroutines that yield to each other: -.PP -.CS -proc juggler {name target {value ""}} { - if {$value eq ""} { - set value [\fByield\fR [info coroutine]] - } - while {$value ne ""} { - puts "$name : $value" - set value [string range $value 0 end-1] - lassign [\fByieldto\fR $target $value] value - } -} -\fBcoroutine\fR j1 juggler Larry [ - \fBcoroutine\fR j2 juggler Curly [ - \fBcoroutine\fR j3 juggler Moe j1]] "Nyuck!Nyuck!Nyuck!" -.CE -.VE TIP396 -.SS "DETAILED SEMANTICS" -.PP -This example demonstrates that coroutines start from the global namespace, and -that \fIcommand\fR resolution happens before the coroutine stack is created. -.PP -.CS -proc report {where level} { - # Where was the caller called from? - set ns [uplevel 2 {namespace current}] - \fByield\fR "made $where $level context=$ns name=[info coroutine]" -} -proc example {} { - report outer [info level] -} -namespace eval demo { - proc example {} { - report inner [info level] - } - proc makeExample {} { - puts "making from [info level]" - puts [\fBcoroutine\fR coroEg example] - } - makeExample -} -.CE -.PP -Which produces the output below. In particular, we can see that stack -manipulation has occurred (comparing the levels from the first and second -line) and that the parent level in the coroutine is the global namespace. We -can also see that coroutine names are local to the current namespace if not -qualified, and that coroutines may yield at depth (e.g., in called -procedures). -.PP -.CS -making from 2 -made inner 1 context=:: name=::demo::coroEg -.CE -.SH "SEE ALSO" -apply(n), info(n), proc(n), return(n) -.SH KEYWORDS -coroutine, generator -'\" Local Variables: -'\" mode: nroff -'\" fill-column: 78 -'\" End: diff --git a/doc/dde.n b/doc/dde.n deleted file mode 100644 index ac3d8ed..0000000 --- a/doc/dde.n +++ /dev/null @@ -1,189 +0,0 @@ -'\" -'\" Copyright (c) 1997 Sun Microsystems, Inc. -'\" Copyright (c) 2001 ActiveState Corporation. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH dde n 1.4 dde "Tcl Bundled Packages" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -dde \- Execute a Dynamic Data Exchange command -.SH SYNOPSIS -.sp -\fBpackage require dde 1.4\fR -.sp -\fBdde servername\fR ?\fB\-force\fR? ?\fB\-handler \fIproc\fR? ?\fB\-\|\-\fR? ?\fItopic\fR? -.sp -.VS 8.6 -\fBdde execute\fR ?\fB\-async\fR? ?\fB\-binary\fR? \fIservice topic data\fR -.sp -\fBdde poke\fR ?\fB\-binary\fR? \fIservice topic item data\fR -.VE 8.6 -.sp -\fBdde request\fR ?\fB\-binary\fR? \fIservice topic item\fR -.sp -\fBdde services \fIservice topic\fR -.sp -\fBdde eval\fR ?\fB\-async\fR? \fItopic cmd \fR?\fIarg arg ...\fR? -.BE - -.SH DESCRIPTION -.PP -This command allows an application to send Dynamic Data Exchange (DDE) -command when running under Microsoft Windows. Dynamic Data Exchange is -a mechanism where applications can exchange raw data. Each DDE -transaction needs a \fIservice name\fR and a \fItopic\fR. Both the -\fIservice name\fR and \fItopic\fR are application defined; Tcl uses -the service name \fBTclEval\fR, while the topic name is the name of the -interpreter given by \fBdde servername\fR. Other applications have their -own \fIservice names\fR and \fItopics\fR. For instance, Microsoft Excel -has the service name \fBExcel\fR. -.PP -.SH "DDE COMMANDS" -.PP -The following commands are a subset of the full Dynamic Data Exchange -set of commands. -.TP -\fBdde servername \fR?\fB\-force\fR? ?\fB\-handler \fIproc\fR? ?\fB\-\|\-\fR? ?\fItopic\fR? -. -\fBdde servername\fR registers the interpreter as a DDE server with -the service name \fBTclEval\fR and the topic name specified by \fItopic\fR. -If no \fItopic\fR is given, \fBdde servername\fR returns the name -of the current topic or the empty string if it is not registered as a -service. If the given \fItopic\fR name is already in use, then a -suffix of the form -.QW " #2" -or -.QW " #3" -is appended to the name to make it -unique. The command's result will be the name actually used. The -\fB\-force\fR option is used to force registration of precisely the -given \fItopic\fR name. -.RS -.PP -The \fB\-handler\fR option specifies a Tcl procedure that will be called to -process calls to the dde server. If the package has been loaded into a -safe interpreter then a \fB\-handler\fR procedure must be defined. The -procedure is called with all the arguments provided by the remote -call. -.RE -.TP -\fBdde execute\fR ?\fB\-async\fR? ?\fB\-binary\fR? \fIservice topic data\fR -. -\fBdde execute\fR takes the \fIdata\fR and sends it to the server indicated -by \fIservice\fR with the topic indicated by \fItopic\fR. Typically, -\fIservice\fR is the name of an application, and \fItopic\fR is a file to -work on. The \fIdata\fR field is given to the remote application. -Typically, the application treats the \fIdata\fR field as a script, and the -script is run in the application. The \fB\-async\fR option requests -asynchronous invocation. The command returns an error message if the -script did not run, unless the \fB\-async\fR flag was used, in which case -the command returns immediately with no error. -.VS 8.6 -Without the \fB\-binary\fR option all data will be sent in unicode. For -dde clients which don't implement the CF_UNICODE clipboard format, this -will automatically be translated to the system encoding. You can use -the \fB\-binary\fR option in combination with the result of -\fBencoding convertto\fR to send data in any other encoding. -.VE 8.6 -.TP -\fBdde poke\fR ?\fB\-binary\fR? \fIservice topic item data\fR -. -\fBdde poke\fR passes the \fIdata\fR to the server indicated by -\fIservice\fR using the \fItopic\fR and \fIitem\fR specified. Typically, -\fIservice\fR is the name of an application. \fItopic\fR is application -specific but can be a command to the server or the name of a file to work -on. The \fIitem\fR is also application specific and is often not used, but -it must always be non-null. The \fIdata\fR field is given to the remote -application. -.VS 8.6 -Without the \fB\-binary\fR option all data will be sent in unicode. For -dde clients which don't implement the CF_UNICODE clipboard format, this -will automatically be translated to the system encoding. You can use -the \fB\-binary\fR option in combination with the result of -\fBencoding convertto\fR to send data in any other encoding. -.VE 8.6 -.TP -\fBdde request\fR ?\fB\-binary\fR? \fIservice topic item\fR -. -\fBdde request\fR is typically used to get the value of something; the -value of a cell in Microsoft Excel or the text of a selection in -Microsoft Word. \fIservice\fR is typically the name of an application, -\fItopic\fR is typically the name of the file, and \fIitem\fR is -application-specific. The command returns the value of \fIitem\fR as -defined in the application. Normally this is interpreted to be a -string with terminating null. If \fB\-binary\fR is specified, the -result is returned as a byte array. -.TP -\fBdde services \fIservice topic\fR -. -\fBdde services\fR returns a list of service-topic pairs that -currently exist on the machine. If \fIservice\fR and \fItopic\fR are -both empty strings ({}), then all service-topic pairs currently -available on the system are returned. If \fIservice\fR is empty and -\fItopic\fR is not, then all services with the specified topic are -returned. If \fIservice\fR is non-empty and \fItopic\fR is, all topics -for a given service are returned. If both are non-empty, if that -service-topic pair currently exists, it is returned; otherwise, an -empty string is returned. -.TP -\fBdde eval\fR ?\fB\-async\fR? \fItopic cmd \fR?\fIarg arg ...\fR? -. -\fBdde eval\fR evaluates a command and its arguments using the interpreter -specified by \fItopic\fR. The DDE service must be the \fBTclEval\fR -service. The \fB\-async\fR option requests asynchronous invocation. The -command returns an error message if the script did not run, unless the -\fB\-async\fR flag was used, in which case the command returns immediately -with no error. This command can be used to replace send on Windows. -.SH "DDE AND TCL" -.PP -A Tcl interpreter always has a service name of \fBTclEval\fR. Each -different interpreter of all running Tcl applications must be -given a unique -name specified by \fBdde servername\fR. Each interp is available as a -DDE topic only if the \fBdde servername\fR command was used to set the -name of the topic for each interp. So a \fBdde services TclEval {}\fR -command will return a list of service-topic pairs, where each of the -currently running interps will be a topic. -.PP -When Tcl processes a \fBdde execute\fR command, the data for the -execute is run as a script in the interp named by the topic of the -\fBdde execute\fR command. -.PP -When Tcl processes a \fBdde request\fR command, it returns the value of the -variable given in the dde command in the context of the interp named by the -dde topic. Tcl reserves the variable \fB$TCLEVAL$EXECUTE$RESULT\fR for -internal use, and \fBdde request\fR commands for that variable will give -unpredictable results. -.PP -An external application which wishes to run a script in Tcl should have -that script store its result in a variable, run the \fBdde execute\fR -command, and then run \fBdde request\fR to get the value of the -variable. -.PP -When using DDE, be careful to ensure that the event queue is flushed -using either \fBupdate\fR or \fBvwait\fR. This happens by default -when using \fBwish\fR unless a blocking command is called (such as \fBexec\fR -without adding the \fB&\fR to place the process in the background). -If for any reason the event queue is not flushed, DDE commands may -hang until the event queue is flushed. This can create a deadlock -situation. -.SH EXAMPLE -.PP -This asks Internet Explorer (which must already be running) to go to a -particularly important website: -.PP -.CS -package require dde -\fBdde execute\fR -async iexplore WWW_OpenURL http://www.tcl.tk/ -.CE -.SH "SEE ALSO" -tk(n), winfo(n), send(n) -.SH KEYWORDS -application, dde, name, remote execution -'\"Local Variables: -'\"mode: nroff -'\"End: diff --git a/doc/define.n b/doc/define.n deleted file mode 100644 index 1692c94..0000000 --- a/doc/define.n +++ /dev/null @@ -1,419 +0,0 @@ -'\" -'\" Copyright (c) 2007 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH define n 0.3 TclOO "TclOO Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -oo::define, oo::objdefine \- define and configure classes and objects -.SH SYNOPSIS -.nf -package require TclOO - -\fBoo::define\fI class defScript\fR -\fBoo::define\fI class subcommand arg\fR ?\fIarg ...\fR? -\fBoo::objdefine\fI object defScript\fR -\fBoo::objdefine\fI object subcommand arg\fR ?\fIarg ...\fR? -.fi -.BE - -.SH DESCRIPTION -The \fBoo::define\fR command is used to control the configuration of classes, -and the \fBoo::objdefine\fR command is used to control the configuration of -objects (including classes as instance objects), with the configuration being -applied to the entity named in the \fIclass\fR or the \fIobject\fR argument. -Configuring a class also updates the -configuration of all subclasses of the class and all objects that are -instances of that class or which mix it in (as modified by any per-instance -configuration). The way in which the configuration is done is controlled by -either the \fIdefScript\fR argument or by the \fIsubcommand\fR and following -\fIarg\fR arguments; when the second is present, it is exactly as if all the -arguments from \fIsubcommand\fR onwards are made into a list and that list is -used as the \fIdefScript\fR argument. -.SS "CONFIGURING CLASSES" -.PP -The following commands are supported in the \fIdefScript\fR for -\fBoo::define\fR, each of which may also be used in the \fIsubcommand\fR form: -.TP -\fBconstructor\fI argList bodyScript\fR -. -This creates or updates the constructor for a class. The formal arguments to -the constructor (defined using the same format as for the Tcl \fBproc\fR -command) will be \fIargList\fR, and the body of the constructor will be -\fIbodyScript\fR. When the body of the constructor is evaluated, the current -namespace of the constructor will be a namespace that is unique to the object -being constructed. Within the constructor, the \fBnext\fR command should be -used to call the superclasses' constructors. If \fIbodyScript\fR is the empty -string, the constructor will be deleted. -.TP -\fBdeletemethod\fI name\fR ?\fIname ...\fR -. -This deletes each of the methods called \fIname\fR from a class. The methods -must have previously existed in that class. Does not affect the superclasses -of the class, nor does it affect the subclasses or instances of the class -(except when they have a call chain through the class being modified). -.TP -\fBdestructor\fI bodyScript\fR -. -This creates or updates the destructor for a class. Destructors take no -arguments, and the body of the destructor will be \fIbodyScript\fR. The -destructor is called when objects of the class are deleted, and when called -will have the object's unique namespace as the current namespace. Destructors -should use the \fBnext\fR command to call the superclasses' destructors. Note -that destructors are not called in all situations (e.g. if the interpreter is -destroyed). If \fIbodyScript\fR is the empty string, the destructor will be -deleted. -.RS -Note that errors during the evaluation of a destructor \fIare not returned\fR -to the code that causes the destruction of an object. Instead, they are passed -to the currently-defined \fBbgerror\fR handler. -.RE -.TP -\fBexport\fI name \fR?\fIname ...\fR? -. -This arranges for each of the named methods, \fIname\fR, to be exported -(i.e. usable outside an instance through the instance object's command) by the -class being defined. Note that the methods themselves may be actually defined -by a superclass; subclass exports override superclass visibility, and may in -turn be overridden by instances. -.TP -\fBfilter\fR ?\fI\-slotOperation\fR? ?\fImethodName ...\fR? -.VS -This slot (see \fBSLOTTED DEFINITIONS\fR below) -.VE -sets or updates the list of method names that are used to guard whether -method call to instances of the class may be called and what the method's -results are. Each \fImethodName\fR names a single filtering method (which may -be exposed or not exposed); it is not an error for a non-existent method to be -named since they may be defined by subclasses. -.VS -By default, this slot works by appending. -.VE -.TP -\fBforward\fI name cmdName \fR?\fIarg ...\fR? -. -This creates or updates a forwarded method called \fIname\fR. The method is -defined be forwarded to the command called \fIcmdName\fR, with additional -arguments, \fIarg\fR etc., added before those arguments specified by the -caller of the method. The \fIcmdName\fR will always be resolved using the -rules of the invoking objects' namespaces, i.e., when \fIcmdName\fR is not -fully-qualified, the command will be searched for in each object's namespace, -using the instances' namespace's path, or by looking in the global namespace. -The method will be exported if \fIname\fR starts with a lower-case letter, and -non-exported otherwise. -.TP -\fBmethod\fI name argList bodyScript\fR -. -This creates or updates a method that is implemented as a procedure-like -script. The name of the method is \fIname\fR, the formal arguments to the -method (defined using the same format as for the Tcl \fBproc\fR command) will -be \fIargList\fR, and the body of the method will be \fIbodyScript\fR. When -the body of the method is evaluated, the current namespace of the method will -be a namespace that is unique to the current object. The method will be -exported if \fIname\fR starts with a lower-case letter, and non-exported -otherwise; this behavior can be overridden via \fBexport\fR and -\fBunexport\fR. -.TP -\fBmixin\fR ?\fI\-slotOperation\fR? ?\fIclassName ...\fR? -.VS -This slot (see \fBSLOTTED DEFINITIONS\fR below) -.VE -sets or updates the list of additional classes that are to be mixed into -all the instances of the class being defined. Each \fIclassName\fR argument -names a single class that is to be mixed in. -.VS -By default, this slot works by replacement. -.VE -.TP -\fBrenamemethod\fI fromName toName\fR -. -This renames the method called \fIfromName\fR in a class to \fItoName\fR. The -method must have previously existed in the class, and \fItoName\fR must not -previously refer to a method in that class. Does not affect the superclasses -of the class, nor does it affect the subclasses or instances of the class -(except when they have a call chain through the class being modified). Does -not change the export status of the method; if it was exported before, it will -be afterwards. -.TP -\fBself\fI subcommand arg ...\fR -.TP -\fBself\fI script\fR -.TP -\fBself\fR -. -This command is equivalent to calling \fBoo::objdefine\fR on the class being -defined (see \fBCONFIGURING OBJECTS\fR below for a description of the -supported values of \fIsubcommand\fR). It follows the same general pattern of -argument handling as the \fBoo::define\fR and \fBoo::objdefine\fR commands, -and -.QW "\fBoo::define \fIcls \fBself \fIsubcommand ...\fR" -operates identically to -.QW "\fBoo::objdefine \fIcls subcommand ...\fR" . -.RS -.PP -.VS TIP470 -If no arguments at all are used, this gives the name of the class currently -being configured. -.VE TIP470 -.RE -.TP -\fBsuperclass\fR ?\fI\-slotOperation\fR? ?\fIclassName ...\fR? -.VS -This slot (see \fBSLOTTED DEFINITIONS\fR below) -.VE -allows the alteration of the superclasses of the class being defined. -Each \fIclassName\fR argument names one class that is to be a superclass of -the defined class. Note that objects must not be changed from being classes to -being non-classes or vice-versa, that an empty parent class is equivalent to -\fBoo::object\fR, and that the parent classes of \fBoo::object\fR and -\fBoo::class\fR may not be modified. -.VS -By default, this slot works by replacement. -.VE -.TP -\fBunexport\fI name \fR?\fIname ...\fR? -. -This arranges for each of the named methods, \fIname\fR, to be not exported -(i.e. not usable outside the instance through the instance object's command, -but instead just through the \fBmy\fR command visible in each object's -context) by the class being defined. Note that the methods themselves may be -actually defined by a superclass; subclass unexports override superclass -visibility, and may be overridden by instance unexports. -.TP -\fBvariable\fR ?\fI\-slotOperation\fR? ?\fIname ...\fR? -.VS -This slot (see \fBSLOTTED DEFINITIONS\fR below) arranges for each of the named -variables to be automatically made -available in the methods, constructor and destructor declared by the class -being defined. Each variable name must not have any namespace -separators and must not look like an array access. All variables will be -actually present in the instance object on which the method is executed. Note -that the variable lists declared by a superclass or subclass are completely -disjoint, as are variable lists declared by instances; the list of variable -names is just for methods (and constructors and destructors) declared by this -class. By default, this slot works by appending. -.VE -.SS "CONFIGURING OBJECTS" -.PP -The following commands are supported in the \fIdefScript\fR for -\fBoo::objdefine\fR, each of which may also be used in the \fIsubcommand\fR -form: -.TP -\fBclass\fI className\fR -. -This allows the class of an object to be changed after creation. Note that the -class's constructors are not called when this is done, and so the object may -well be in an inconsistent state unless additional configuration work is done. -.TP -\fBdeletemethod\fI name\fR ?\fIname ...\fR -. -This deletes each of the methods called \fIname\fR from an object. The methods -must have previously existed in that object. Does not affect the classes that -the object is an instance of. -.TP -\fBexport\fI name \fR?\fIname ...\fR? -. -This arranges for each of the named methods, \fIname\fR, to be exported -(i.e. usable outside the object through the object's command) by the object -being defined. Note that the methods themselves may be actually defined by a -class or superclass; object exports override class visibility. -.TP -\fBfilter\fR ?\fI\-slotOperation\fR? ?\fImethodName ...\fR? -.VS -This slot (see \fBSLOTTED DEFINITIONS\fR below) -.VE -sets or updates the list of method names that are used to guard whether a -method call to the object may be called and what the method's results are. -Each \fImethodName\fR names a single filtering method (which may be exposed or -not exposed); it is not an error for a non-existent method to be named. Note -that the actual list of filters also depends on the filters set upon any -classes that the object is an instance of. -.VS -By default, this slot works by appending. -.VE -.TP -\fBforward\fI name cmdName \fR?\fIarg ...\fR? -. -This creates or updates a forwarded object method called \fIname\fR. The -method is defined be forwarded to the command called \fIcmdName\fR, with -additional arguments, \fIarg\fR etc., added before those arguments specified -by the caller of the method. Forwarded methods should be deleted using the -\fBmethod\fR subcommand. The method will be exported if \fIname\fR starts with -a lower-case letter, and non-exported otherwise. -.TP -\fBmethod\fI name argList bodyScript\fR -. -This creates, updates or deletes an object method. The name of the method is -\fIname\fR, the formal arguments to the method (defined using the same format -as for the Tcl \fBproc\fR command) will be \fIargList\fR, and the body of the -method will be \fIbodyScript\fR. When the body of the method is evaluated, the -current namespace of the method will be a namespace that is unique to the -object. The method will be exported if \fIname\fR starts with a lower-case -letter, and non-exported otherwise. -.TP -\fBmixin\fR ?\fI\-slotOperation\fR? ?\fIclassName ...\fR? -.VS -This slot (see \fBSLOTTED DEFINITIONS\fR below) -.VE -sets or updates a per-object list of additional classes that are to be -mixed into the object. Each argument, \fIclassName\fR, names a single class -that is to be mixed in. -.VS -By default, this slot works by replacement. -.VE -.TP -\fBrenamemethod\fI fromName toName\fR -. -This renames the method called \fIfromName\fR in an object to \fItoName\fR. -The method must have previously existed in the object, and \fItoName\fR must -not previously refer to a method in that object. Does not affect the classes -that the object is an instance of. Does not change the export status of the -method; if it was exported before, it will be afterwards. -.TP -\fBself \fR -. -.VS TIP470 -This gives the name of the object currently being configured. -.VE TIP470 -.TP -\fBunexport\fI name \fR?\fIname ...\fR? -. -This arranges for each of the named methods, \fIname\fR, to be not exported -(i.e. not usable outside the object through the object's command, but instead -just through the \fBmy\fR command visible in the object's context) by the -object being defined. Note that the methods themselves may be actually defined -by a class; instance unexports override class visibility. -.TP -\fBvariable\fR ?\fI\-slotOperation\fR? ?\fIname ...\fR? -.VS -This slot (see \fBSLOTTED DEFINITIONS\fR below) arranges for each of the named -variables to be automatically made available in the methods declared by the -object being defined. Each variable name must not have any namespace -separators and must not look like an array access. All variables will be -actually present in the object on which the method is executed. Note that the -variable lists declared by the classes and mixins of which the object is an -instance are completely disjoint; the list of variable names is just for -methods declared by this object. By default, this slot works by appending. -.SH "SLOTTED DEFINITIONS" -Some of the configurable definitions of a class or object are \fIslotted -definitions\fR. This means that the configuration is implemented by a slot -object, that is an instance of the class \fBoo::Slot\fR, which manages a list -of values (class names, variable names, etc.) that comprises the contents of -the slot. The class defines three operations (as methods) that may be done on -the slot: -.VE -.TP -\fIslot\fR \fB\-append\fR ?\fImember ...\fR? -.VS -This appends the given \fImember\fR elements to the slot definition. -.VE -.TP -\fIslot\fR \fB\-clear\fR -.VS -This sets the slot definition to the empty list. -.VE -.TP -\fIslot\fR \fB\-set\fR ?\fImember ...\fR? -.VS -This replaces the slot definition with the given \fImember\fR elements. -.PP -A consequence of this is that any use of a slot's default operation where the -first member argument begins with a hyphen will be an error. One of the above -operations should be used explicitly in those circumstances. -.SS "SLOT IMPLEMENTATION" -Internally, slot objects also define a method \fB\-\-default\-operation\fR -which is forwarded to the default operation of the slot (thus, for the class -.QW \fBvariable\fR -slot, this is forwarded to -.QW "\fBmy \-append\fR" ), -and these methods which provide the implementation interface: -.VE -.TP -\fIslot\fR \fBGet\fR -.VS -Returns a list that is the current contents of the slot. This method must -always be called from a stack frame created by a call to \fBoo::define\fR or -\fBoo::objdefine\fR. -.VE -.TP -\fIslot\fR \fBSet \fIelementList\fR -.VS -Sets the contents of the slot to the list \fIelementList\fR and returns the -empty string. This method must always be called from a stack frame created by -a call to \fBoo::define\fR or \fBoo::objdefine\fR. -.PP -The implementation of these methods is slot-dependent (and responsible for -accessing the correct part of the class or object definition). Slots also have -an unknown method handler to tie all these pieces together, and they hide -their \fBdestroy\fR method so that it is not invoked inadvertently. It is -\fIrecommended\fR that any user changes to the slot mechanism be restricted to -defining new operations whose names start with a hyphen. -.VE -.SH EXAMPLES -This example demonstrates how to use both forms of the \fBoo::define\fR and -\fBoo::objdefine\fR commands (they work in the same way), as well as -illustrating four of the subcommands of them. -.PP -.CS -oo::class create c -c create o -\fBoo::define\fR c \fBmethod\fR foo {} { - puts "world" -} -\fBoo::objdefine\fR o { - \fBmethod\fR bar {} { - my Foo "hello " - my foo - } - \fBforward\fR Foo ::puts -nonewline - \fBunexport\fR foo -} -o bar \fI\(-> prints "hello world"\fR -o foo \fI\(-> error "unknown method foo"\fR -o Foo Bar \fI\(-> error "unknown method Foo"\fR -\fBoo::objdefine\fR o \fBrenamemethod\fR bar lollipop -o lollipop \fI\(-> prints "hello world"\fR -.CE -.PP -This example shows how additional classes can be mixed into an object. It also -shows how \fBmixin\fR is a slot that supports appending: -.PP -.CS -oo::object create inst -inst m1 \fI\(-> error "unknown method m1"\fR -inst m2 \fI\(-> error "unknown method m2"\fR - -oo::class create A { - \fBmethod\fR m1 {} { - puts "red brick" - } -} -\fBoo::objdefine\fR inst { - \fBmixin\fR A -} -inst m1 \fI\(-> prints "red brick"\fR -inst m2 \fI\(-> error "unknown method m2"\fR - -oo::class create B { - \fBmethod\fR m2 {} { - puts "blue brick" - } -} -\fBoo::objdefine\fR inst { - \fBmixin -append\fR B -} -inst m1 \fI\(-> prints "red brick"\fR -inst m2 \fI\(-> prints "blue brick"\fR -.CE -.SH "SEE ALSO" -next(n), oo::class(n), oo::object(n) -.SH KEYWORDS -class, definition, method, object, slot -.\" Local variables: -.\" mode: nroff -.\" fill-column: 78 -.\" End: diff --git a/doc/dict.n b/doc/dict.n deleted file mode 100644 index cd7e94c..0000000 --- a/doc/dict.n +++ /dev/null @@ -1,445 +0,0 @@ -'\" -'\" 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. -'\" -.TH dict n 8.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -dict \- Manipulate dictionaries -.SH SYNOPSIS -\fBdict \fIoption arg \fR?\fIarg ...\fR? -.BE -.SH DESCRIPTION -.PP -Performs one of several operations on dictionary values or variables -containing dictionary values (see the \fBDICTIONARY VALUES\fR section -below for a description), depending on \fIoption\fR. The legal -\fIoption\fRs (which may be abbreviated) are: -.TP -\fBdict append \fIdictionaryVariable key \fR?\fIstring ...\fR? -. -This appends the given string (or strings) to the value that the given -key maps to in the dictionary value contained in the given variable, -writing the resulting dictionary value back to that variable. -Non-existent keys are treated as if they map to an empty string. The -updated dictionary value is returned. -.TP -\fBdict create \fR?\fIkey value ...\fR? -. -Return a new dictionary that contains each of the key/value mappings -listed as arguments (keys and values alternating, with each key being -followed by its associated value.) -.TP -\fBdict exists \fIdictionaryValue key \fR?\fIkey ...\fR? -. -This returns a boolean value indicating whether the given key (or path -of keys through a set of nested dictionaries) exists in the given -dictionary value. This returns a true value exactly when \fBdict -get\fR on that path will succeed. -.TP -\fBdict filter \fIdictionaryValue filterType arg \fR?\fIarg ...\fR? -. -This takes a dictionary value and returns a new dictionary that -contains just those key/value pairs that match the specified filter -type (which may be abbreviated.) Supported filter types are: -.RS -.TP -\fBdict filter \fIdictionaryValue \fBkey\fR ?\fIglobPattern ...\fR? -.VS 8.6 -The key rule only matches those key/value pairs whose keys match any -of the given patterns (in the style of \fBstring match\fR.) -.VE 8.6 -.TP -\fBdict filter \fIdictionaryValue \fBscript {\fIkeyVariable valueVariable\fB} \fIscript\fR -. -The script rule tests for matching by assigning the key to the -\fIkeyVariable\fR and the value to the \fIvalueVariable\fR, and then evaluating -the given script which should return a boolean value (with the -key/value pair only being included in the result of the \fBdict -filter\fR when a true value is returned.) Note that the first -argument after the rule selection word is a two-element list. If the -\fIscript\fR returns with a condition of \fBTCL_BREAK\fR, no further -key/value pairs are considered for inclusion in the resulting -dictionary, and a condition of \fBTCL_CONTINUE\fR is equivalent to a false -result. The key/value pairs are tested in the order in which the keys -were inserted into the dictionary. -.TP -\fBdict filter \fIdictionaryValue \fBvalue \fR?\fIglobPattern ...\fR? -.VS 8.6 -The value rule only matches those key/value pairs whose values match any -of the given patterns (in the style of \fBstring match\fR.) -.VE 8.6 -.RE -.TP -\fBdict for {\fIkeyVariable valueVariable\fB} \fIdictionaryValue body\fR -. -This command takes three arguments, the first a two-element list of -variable names (for the key and value respectively of each mapping in -the dictionary), the second the dictionary value to iterate across, -and the third a script to be evaluated for each mapping with the key -and value variables set appropriately (in the manner of \fBforeach\fR.) -The result of the command is an empty string. If any evaluation of the -body generates a \fBTCL_BREAK\fR result, no further pairs from the -dictionary will be iterated over and the \fBdict for\fR command will -terminate successfully immediately. If any evaluation of the body -generates a \fBTCL_CONTINUE\fR result, this shall be treated exactly like a -normal \fBTCL_OK\fR result. The order of iteration is the order in -which the keys were inserted into the dictionary. -.TP -\fBdict get \fIdictionaryValue \fR?\fIkey ...\fR? -. -Given a dictionary value (first argument) and a key (second argument), -this will retrieve the value for that key. Where several keys are -supplied, the behaviour of the command shall be as if the result of -\fBdict get $dictVal $key\fR was passed as the first argument to -\fBdict get\fR with the remaining arguments as second (and possibly -subsequent) arguments. This facilitates lookups in nested -dictionaries. For example, the following two commands are equivalent: -.RS -.PP -.CS -dict get $dict foo bar spong -dict get [dict get [dict get $dict foo] bar] spong -.CE -.PP -If no keys are provided, \fBdict get\fR will return a list containing pairs of -elements in a manner similar to \fBarray get\fR. That is, the first -element of each pair would be the key and the second element would be -the value for that key. -.PP -It is an error to attempt to retrieve a value for a key that is not -present in the dictionary. -.RE -.TP -\fBdict incr \fIdictionaryVariable key \fR?\fIincrement\fR? -. -This adds the given increment value (an integer that defaults to 1 if -not specified) to the value that the given key maps to in the -dictionary value contained in the given variable, writing the -resulting dictionary value back to that variable. Non-existent keys -are treated as if they map to 0. It is an error to increment a value -for an existing key if that value is not an integer. The updated -dictionary value is returned. -.TP -\fBdict info \fIdictionaryValue\fR -. -This returns information (intended for display to people) about the -given dictionary though the format of this data is dependent on the -implementation of the dictionary. For dictionaries that are -implemented by hash tables, it is expected that this will return the -string produced by \fBTcl_HashStats\fR, similar to \fBarray statistics\fR. -.TP -\fBdict keys \fIdictionaryValue \fR?\fIglobPattern\fR? -. -Return a list of all keys in the given dictionary value. If a pattern -is supplied, only those keys that match it (according to the rules of -\fBstring match\fR) will be returned. The returned keys will be in the -order that they were inserted into the dictionary. -.TP -\fBdict lappend \fIdictionaryVariable key \fR?\fIvalue ...\fR? -. -This appends the given items to the list value that the given key maps -to in the dictionary value contained in the given variable, writing -the resulting dictionary value back to that variable. Non-existent -keys are treated as if they map to an empty list, and it is legal for -there to be no items to append to the list. It is an error for the -value that the key maps to to not be representable as a list. The -updated dictionary value is returned. -.TP -\fBdict map \fR{\fIkeyVariable valueVariable\fR} \fIdictionaryValue body\fR -. -This command applies a transformation to each element of a dictionary, -returning a new dictionary. It takes three arguments: the first is a -two-element list of variable names (for the key and value respectively of each -mapping in the dictionary), the second the dictionary value to iterate across, -and the third a script to be evaluated for each mapping with the key and value -variables set appropriately (in the manner of \fBlmap\fR). In an iteration -where the evaluated script completes normally (\fBTCL_OK\fR, as opposed to an -\fBerror\fR, etc.) the result of the script is put into an accumulator -dictionary using the key that is the current contents of the \fIkeyVariable\fR -variable at that point. The result of the \fBdict map\fR command is the -accumulator dictionary after all keys have been iterated over. -.RS -.PP -If the evaluation of the body for any particular step generates a \fBbreak\fR, -no further pairs from the dictionary will be iterated over and the \fBdict -map\fR command will terminate successfully immediately. If the evaluation of -the body for a particular step generates a \fBcontinue\fR result, the current -iteration is aborted and the accumulator dictionary is not modified. The order -of iteration is the natural order of the dictionary (typically the order in -which the keys were added to the dictionary; the order is the same as that -used in \fBdict for\fR). -.RE -.TP -\fBdict merge \fR?\fIdictionaryValue ...\fR? -. -Return a dictionary that contains the contents of each of the -\fIdictionaryValue\fR arguments. Where two (or more) dictionaries -contain a mapping for the same key, the resulting dictionary maps that -key to the value according to the last dictionary on the command line -containing a mapping for that key. -.TP -\fBdict remove \fIdictionaryValue \fR?\fIkey ...\fR? -. -Return a new dictionary that is a copy of an old one passed in as -first argument except without mappings for each of the keys listed. -It is legal for there to be no keys to remove, and it also legal for -any of the keys to be removed to not be present in the input -dictionary in the first place. -.TP -\fBdict replace \fIdictionaryValue \fR?\fIkey value ...\fR? -. -Return a new dictionary that is a copy of an old one passed in as -first argument except with some values different or some extra -key/value pairs added. It is legal for this command to be called with -no key/value pairs, but illegal for this command to be called with a -key but no value. -.TP -\fBdict set \fIdictionaryVariable key \fR?\fIkey ...\fR? \fIvalue\fR -. -This operation takes the name of a variable containing a dictionary -value and places an updated dictionary value in that variable -containing a mapping from the given key to the given value. When -multiple keys are present, this operation creates or updates a chain -of nested dictionaries. The updated dictionary value is returned. -.TP -\fBdict size \fIdictionaryValue\fR -. -Return the number of key/value mappings in the given dictionary value. -.TP -\fBdict unset \fIdictionaryVariable key \fR?\fIkey ...\fR? -. -This operation (the companion to \fBdict set\fR) takes the name of a -variable containing a dictionary value and places an updated -dictionary value in that variable that does not contain a mapping for -the given key. Where multiple keys are present, this describes a path -through nested dictionaries to the mapping to remove. At least one key -must be specified, but the last key on the key-path need not exist. -All other components on the path must exist. The updated dictionary -value is returned. -.TP -\fBdict update \fIdictionaryVariable key varName \fR?\fIkey varName ...\fR? \fIbody\fR -. -Execute the Tcl script in \fIbody\fR with the value for each \fIkey\fR -(as found by reading the dictionary value in \fIdictionaryVariable\fR) -mapped to the variable \fIvarName\fR. There may be multiple -\fIkey\fR/\fIvarName\fR pairs. If a \fIkey\fR does not have a mapping, -that corresponds to an unset \fIvarName\fR. When \fIbody\fR -terminates, any changes made to the \fIvarName\fRs is reflected back -to the dictionary within \fIdictionaryVariable\fR (unless -\fIdictionaryVariable\fR itself becomes unreadable, when all updates -are silently discarded), even if the result of \fIbody\fR is an error -or some other kind of exceptional exit. The result of \fBdict -update\fR is (unless some kind of error occurs) the result of the -evaluation of \fIbody\fR. -.RS -.PP -Each \fIvarName\fR is mapped in the scope enclosing the \fBdict update\fR; -it is recommended that this command only be used in a local scope -(\fBproc\fRedure, lambda term for \fBapply\fR, or method). Because of -this, the variables set by \fBdict update\fR will continue to -exist after the command finishes (unless explicitly \fBunset\fR). -Note that the mapping of values to variables -does not use traces; changes to the \fIdictionaryVariable\fR's -contents only happen when \fIbody\fR terminates. -.RE -.TP -\fBdict values \fIdictionaryValue \fR?\fIglobPattern\fR? -. -Return a list of all values in the given dictionary value. If a -pattern is supplied, only those values that match it (according to the -rules of \fBstring match\fR) will be returned. The returned values -will be in the order of that the keys associated with those values -were inserted into the dictionary. -.TP -\fBdict with \fIdictionaryVariable \fR?\fIkey ...\fR? \fIbody\fR -. -Execute the Tcl script in \fIbody\fR with the value for each key in -\fIdictionaryVariable\fR mapped (in a manner similarly to \fBdict -update\fR) to a variable with the same name. Where one or more -\fIkey\fRs are available, these indicate a chain of nested -dictionaries, with the innermost dictionary being the one opened out -for the execution of \fIbody\fR. As with \fBdict update\fR, making -\fIdictionaryVariable\fR unreadable will make the updates to the -dictionary be discarded, and this also happens if the contents of -\fIdictionaryVariable\fR are adjusted so that the chain of -dictionaries no longer exists. The result of \fBdict with\fR is -(unless some kind of error occurs) the result of the evaluation of -\fIbody\fR. -.RS -.PP -The variables are mapped in the scope enclosing the \fBdict with\fR; -it is recommended that this command only be used in a local scope -(\fBproc\fRedure, lambda term for \fBapply\fR, or method). Because of -this, the variables set by \fBdict with\fR will continue to -exist after the command finishes (unless explicitly \fBunset\fR). -Note that the mapping of values to variables does not use -traces; changes to the \fIdictionaryVariable\fR's contents only happen -when \fIbody\fR terminates. -.PP -If the \fIdictionaryVariable\fR contains a value that is not a dictionary at -the point when the \fIbody\fR terminates (which can easily happen if the name -is the same as any of the keys in dictionary) then an error occurs at that -point. This command is thus not recommended for use when the keys in the -dictionary are expected to clash with the \fIdictionaryVariable\fR name -itself. Where the contained key does map to a dictionary, the net effect is to -combine that inner dictionary into the outer dictionary; see the -\fBEXAMPLES\fR below for an illustration of this. -.RE -.SH "DICTIONARY VALUES" -.PP -Dictionaries are values that contain an efficient, order-preserving -mapping from arbitrary keys to arbitrary values. -Each key in the dictionary maps to a single value. -They have a textual format that is exactly that of any list with an -even number of elements, with each mapping in the dictionary being -represented as two items in the list. When a command takes a -dictionary and produces a new dictionary based on it (either returning -it or writing it back into the variable that the starting dictionary -was read from) the new dictionary will have the same order of keys, -modulo any deleted keys and with new keys added on to the end. -When a string is interpreted as a dictionary and it would otherwise -have duplicate keys, only the last value for a particular key is used; -the others are ignored, meaning that, -.QW "apple banana" -and -.QW "apple carrot apple banana" -are equivalent dictionaries (with different string representations). -.PP -Operations that derive a new dictionary from an old one (e.g., updates -like \fBdict set\fR and \fBdict unset\fR) preserve the order of keys -in the dictionary. The exceptions to this are for any new keys they -add, which are appended to the sequence, and any keys that are -removed, which are excised from the order. -.SH EXAMPLES -.PP -Basic dictionary usage: -.PP -.CS -# Make a dictionary to map extensions to descriptions -set filetypes [\fBdict create\fR .txt "Text File" .tcl "Tcl File"] - -# Add/update the dictionary -\fBdict set\fR filetypes .tcl "Tcl Script" -\fBdict set\fR filetypes .tm "Tcl Module" -\fBdict set\fR filetypes .gif "GIF Image" -\fBdict set\fR filetypes .png "PNG Image" - -# Simple read from the dictionary -set ext ".tcl" -set desc [\fBdict get\fR $filetypes $ext] -puts "$ext is for a $desc" - -# Somewhat more complex, with existence test -foreach filename [glob *] { - set ext [file extension $filename] - if {[\fBdict exists\fR $filetypes $ext]} { - puts "$filename is a [\fBdict get\fR $filetypes $ext]" - } -} -.CE -.PP -Constructing and using nested dictionaries: -.PP -.CS -# Data for one employee -\fBdict set\fR employeeInfo 12345-A forenames "Joe" -\fBdict set\fR employeeInfo 12345-A surname "Schmoe" -\fBdict set\fR employeeInfo 12345-A street "147 Short Street" -\fBdict set\fR employeeInfo 12345-A city "Springfield" -\fBdict set\fR employeeInfo 12345-A phone "555-1234" -# Data for another employee -\fBdict set\fR employeeInfo 98372-J forenames "Anne" -\fBdict set\fR employeeInfo 98372-J surname "Other" -\fBdict set\fR employeeInfo 98372-J street "32995 Oakdale Way" -\fBdict set\fR employeeInfo 98372-J city "Springfield" -\fBdict set\fR employeeInfo 98372-J phone "555-8765" -# The above data probably ought to come from a database... - -# Print out some employee info -set i 0 -puts "There are [\fBdict size\fR $employeeInfo] employees" -\fBdict for\fR {id info} $employeeInfo { - puts "Employee #[incr i]: $id" - \fBdict with\fR info { - puts " Name: $forenames $surname" - puts " Address: $street, $city" - puts " Telephone: $phone" - } -} -# Another way to iterate and pick out names... -foreach id [\fBdict keys\fR $employeeInfo] { - puts "Hello, [\fBdict get\fR $employeeInfo $id forenames]!" -} -.CE -.PP -A localizable version of \fBstring toupper\fR: -.PP -.CS -# Set up the basic C locale -set capital [\fBdict create\fR C [\fBdict create\fR]] -foreach c [split {abcdefghijklmnopqrstuvwxyz} ""] { - \fBdict set\fR capital C $c [string toupper $c] -} - -# English locales can luckily share the "C" locale -\fBdict set\fR capital en [\fBdict get\fR $capital C] -\fBdict set\fR capital en_US [\fBdict get\fR $capital C] -\fBdict set\fR capital en_GB [\fBdict get\fR $capital C] - -# ... and so on for other supported languages ... - -# Now get the mapping for the current locale and use it. -set upperCaseMap [\fBdict get\fR $capital $env(LANG)] -set upperCase [string map $upperCaseMap $string] -.CE -.PP -Showing the detail of \fBdict with\fR: -.PP -.CS -proc sumDictionary {varName} { - upvar 1 $varName vbl - foreach key [\fBdict keys\fR $vbl] { - # Manufacture an entry in the subdictionary - \fBdict set\fR vbl $key total 0 - # Add the values and remove the old - \fBdict with\fR vbl $key { - set total [expr {$x + $y + $z}] - unset x y z - } - } - puts "last total was $total, for key $key" -} - -set myDict { - a {x 1 y 2 z 3} - b {x 6 y 5 z 4} -} - -sumDictionary myDict -# prints: \fIlast total was 15, for key b\fR - -puts "dictionary is now \\"$myDict\\"" -# prints: \fIdictionary is now "a {total 6} b {total 15}"\fR -.CE -.PP -When \fBdict with\fR is used with a key that clashes with the name of the -dictionary variable: -.PP -.CS -set foo {foo {a b} bar 2 baz 3} -\fBdict with\fR foo {} -puts $foo -# prints: \fIa b foo {a b} bar 2 baz 3\fR -.CE -.SH "SEE ALSO" -append(n), array(n), foreach(n), incr(n), list(n), lappend(n), lmap(n), set(n) -.SH KEYWORDS -dictionary, create, update, lookup, iterate, filter, map -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/encoding.n b/doc/encoding.n deleted file mode 100644 index 50ad083..0000000 --- a/doc/encoding.n +++ /dev/null @@ -1,115 +0,0 @@ -'\" -'\" 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. -'\" -.TH encoding n "8.1" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -.SH NAME -encoding \- Manipulate encodings -.SH SYNOPSIS -\fBencoding \fIoption\fR ?\fIarg arg ...\fR? -.BE -.SH INTRODUCTION -.PP -Strings in Tcl are logically a sequence of 16-bit Unicode characters. -These strings are represented in memory as a sequence of bytes that -may be in one of several encodings: modified UTF\-8 (which uses 1 to 3 -bytes per character), 16-bit -.QW Unicode -(which uses 2 bytes per character, with an endianness that is -dependent on the host architecture), and binary (which uses a single -byte per character but only handles a restricted range of characters). -Tcl does not guarantee to always use the same encoding for the same -string. -.PP -Different operating system interfaces or applications may generate -strings in other encodings such as Shift\-JIS. The \fBencoding\fR -command helps to bridge the gap between Unicode and these other -formats. -.SH DESCRIPTION -.PP -Performs one of several encoding related operations, depending on -\fIoption\fR. The legal \fIoption\fRs are: -.TP -\fBencoding convertfrom\fR ?\fIencoding\fR? \fIdata\fR -. -Convert \fIdata\fR to Unicode from the specified \fIencoding\fR. The -characters in \fIdata\fR are treated as binary data where the lower -8-bits of each character is taken as a single byte. The resulting -sequence of bytes is treated as a string in the specified -\fIencoding\fR. If \fIencoding\fR is not specified, the current -system encoding is used. -.TP -\fBencoding convertto\fR ?\fIencoding\fR? \fIstring\fR -. -Convert \fIstring\fR from Unicode to the specified \fIencoding\fR. -The result is a sequence of bytes that represents the converted -string. Each byte is stored in the lower 8-bits of a Unicode -character (indeed, the resulting string is a binary string as far as -Tcl is concerned, at least initially). If \fIencoding\fR is not -specified, the current system encoding is used. -.TP -\fBencoding dirs\fR ?\fIdirectoryList\fR? -. -Tcl can load encoding data files from the file system that describe -additional encodings for it to work with. This command sets the search -path for \fB*.enc\fR encoding data files to the list of directories -\fIdirectoryList\fR. If \fIdirectoryList\fR is omitted then the -command returns the current list of directories that make up the -search path. It is an error for \fIdirectoryList\fR to not be a valid -list. If, when a search for an encoding data file is happening, an -element in \fIdirectoryList\fR does not refer to a readable, -searchable directory, that element is ignored. -.TP -\fBencoding names\fR -. -Returns a list containing the names of all of the encodings that are -currently available. -The encodings -.QW utf-8 -and -.QW iso8859-1 -are guaranteed to be present in the list. -.TP -\fBencoding system\fR ?\fIencoding\fR? -. -Set the system encoding to \fIencoding\fR. If \fIencoding\fR is -omitted then the command returns the current system encoding. The -system encoding is used whenever Tcl passes strings to system calls. -.SH EXAMPLE -.PP -It is common practice to write script files using a text editor that -produces output in the euc-jp encoding, which represents the ASCII -characters as singe bytes and Japanese characters as two bytes. This -makes it easy to embed literal strings that correspond to non-ASCII -characters by simply typing the strings in place in the script. -However, because the \fBsource\fR command always reads files using the -current system encoding, Tcl will only source such files correctly -when the encoding used to write the file is the same. This tends not -to be true in an internationalized setting. For example, if such a -file was sourced in North America (where the ISO8859\-1 is normally -used), each byte in the file would be treated as a separate character -that maps to the 00 page in Unicode. The resulting Tcl strings will -not contain the expected Japanese characters. Instead, they will -contain a sequence of Latin-1 characters that correspond to the bytes -of the original string. The \fBencoding\fR command can be used to -convert this string to the expected Japanese Unicode characters. For -example, -.PP -.CS -set s [\fBencoding convertfrom\fR euc-jp "\exA4\exCF"] -.CE -.PP -would return the Unicode string -.QW "\eu306F" , -which is the Hiragana letter HA. -.SH "SEE ALSO" -Tcl_GetEncoding(3) -.SH KEYWORDS -encoding, unicode -.\" Local Variables: -.\" mode: nroff -.\" End: diff --git a/doc/eof.n b/doc/eof.n deleted file mode 100644 index a150464..0000000 --- a/doc/eof.n +++ /dev/null @@ -1,61 +0,0 @@ -'\" -'\" 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. -'\" -.TH eof n 7.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -eof \- Check for end of file condition on channel -.SH SYNOPSIS -\fBeof \fIchannelId\fR -.BE -.SH DESCRIPTION -.PP -Returns 1 if an end of file condition occurred during the most -recent input operation on \fIchannelId\fR (such as \fBgets\fR), -0 otherwise. -.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 EXAMPLES -.PP -Read and print out the contents of a file line-by-line: -.PP -.CS -set f [open somefile.txt] -while {1} { - set line [gets $f] - if {[\fBeof\fR $f]} { - close $f - break - } - puts "Read line: $line" -} -.CE -.PP -Read and print out the contents of a file by fixed-size records: -.PP -.CS -set f [open somefile.dat] -fconfigure $f -translation binary -set recordSize 40 -while {1} { - set record [read $f $recordSize] - if {[\fBeof\fR $f]} { - close $f - break - } - puts "Read record: $record" -} -.CE -.SH "SEE ALSO" -file(n), open(n), close(n), fblocked(n), Tcl_StandardChannels(3) -.SH KEYWORDS -channel, end of file diff --git a/doc/error.n b/doc/error.n deleted file mode 100644 index c05f8b9..0000000 --- a/doc/error.n +++ /dev/null @@ -1,78 +0,0 @@ -'\" -'\" 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. -'\" -.TH error n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -error \- Generate an error -.SH SYNOPSIS -\fBerror \fImessage\fR ?\fIinfo\fR? ?\fIcode\fR? -.BE - -.SH DESCRIPTION -.PP -Returns a \fBTCL_ERROR\fR code, which causes command interpretation to be -unwound. \fIMessage\fR is a string that is returned to the application -to indicate what went wrong. -.PP -The \fB\-errorinfo\fR return option of an interpreter is used -to accumulate a stack trace of what was in progress when an -error occurred; as nested commands unwind, -the Tcl interpreter adds information to the \fB\-errorinfo\fR -return option. If the \fIinfo\fR argument is present, it is -used to initialize the \fB\-errorinfo\fR return options and -the first increment of unwind information -will not be added by the Tcl interpreter. -In other -words, the command containing the \fBerror\fR command will not appear -in the stack trace; in its place will be \fIinfo\fR. -Historically, this feature had been most useful in conjunction -with the \fBcatch\fR command: -if a caught error cannot be handled successfully, \fIinfo\fR can be used -to return a stack trace reflecting the original point of occurrence -of the error: -.PP -.CS -catch {...} errMsg -set savedInfo $::errorInfo -\&... -\fBerror\fR $errMsg $savedInfo -.CE -.PP -When working with Tcl 8.5 or later, the following code -should be used instead: -.PP -.CS -catch {...} errMsg options -\&... -return -options $options $errMsg -.CE -.PP -If the \fIcode\fR argument is present, then its value is stored -in the \fB\-errorcode\fR return option. The \fB\-errorcode\fR -return option is intended to hold a machine-readable description -of the error in cases where such information is available; see -the \fBreturn\fR manual page for information on the proper format -for this option's value. -.SH EXAMPLE -.PP -Generate an error if a basic mathematical operation fails: -.PP -.CS -if {1+2 != 3} { - \fBerror\fR "something is very wrong with addition" -} -.CE -.SH "SEE ALSO" -catch(n), return(n) -.SH KEYWORDS -error, exception -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/eval.n b/doc/eval.n deleted file mode 100644 index 9fc2ae4..0000000 --- a/doc/eval.n +++ /dev/null @@ -1,84 +0,0 @@ -'\" -'\" 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. -'\" -.TH eval n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -eval \- Evaluate a Tcl script -.SH SYNOPSIS -\fBeval \fIarg \fR?\fIarg ...\fR? -.BE -.SH DESCRIPTION -.PP -\fBEval\fR takes one or more arguments, which together comprise a Tcl -script containing one or more commands. -\fBEval\fR concatenates all its arguments in the same -fashion as the \fBconcat\fR command, passes the concatenated string to the -Tcl interpreter recursively, and returns the result of that -evaluation (or any error generated by it). -Note that the \fBlist\fR command quotes sequences of words in such a -way that they are not further expanded by the \fBeval\fR command. -.SH EXAMPLES -.PP -Often, it is useful to store a fragment of a script in a variable and -execute it later on with extra values appended. This technique is used -in a number of places throughout the Tcl core (e.g. in \fBfcopy\fR, -\fBlsort\fR and \fBtrace\fR command callbacks). This example shows how -to do this using core Tcl commands: -.PP -.CS -set script { - puts "logging now" - lappend $myCurrentLogVar -} -set myCurrentLogVar log1 -# Set up a switch of logging variable part way through! -after 20000 set myCurrentLogVar log2 - -for {set i 0} {$i<10} {incr i} { - # Introduce a random delay - after [expr {int(5000 * rand())}] - update ;# Check for the asynch log switch - \fBeval\fR $script $i [clock clicks] -} -.CE -.PP -Note that in the most common case (where the script fragment is -actually just a list of words forming a command prefix), it is better -to use \fB{*}$script\fR when doing this sort of invocation -pattern. It is less general than the \fBeval\fR command, and hence -easier to make robust in practice. -The following procedure acts in a way that is analogous to the -\fBlappend\fR command, except it inserts the argument values at the -start of the list in the variable: -.PP -.CS -proc lprepend {varName args} { - upvar 1 $varName var - # Ensure that the variable exists and contains a list - lappend var - # Now we insert all the arguments in one go - set var [\fBeval\fR [list linsert $var 0] $args] -} -.CE -.PP -However, the last line would now normally be written without -\fBeval\fR, like this: -.PP -.CS -set var [linsert $var 0 {*}$args] -.CE -.SH "SEE ALSO" -catch(n), concat(n), error(n), errorCode(n), errorInfo(n), interp(n), list(n), -namespace(n), subst(n), uplevel(n) -.SH KEYWORDS -concatenate, evaluate, script -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/exec.n b/doc/exec.n deleted file mode 100644 index 70ace32..0000000 --- a/doc/exec.n +++ /dev/null @@ -1,452 +0,0 @@ -'\" -'\" Copyright (c) 1993 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. -'\" Copyright (c) 2006 Donal K. Fellows. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH exec n 8.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -exec \- Invoke subprocesses -.SH SYNOPSIS -\fBexec \fR?\fIswitches\fR? \fIarg \fR?\fIarg ...\fR? ?\fB&\fR? -.BE -.SH DESCRIPTION -.PP -This command treats its arguments as the specification -of one or more subprocesses to execute. -The arguments take the form of a standard shell pipeline -where each \fIarg\fR becomes one word of a command, and -each distinct command becomes a subprocess. -.PP -If the initial arguments to \fBexec\fR start with \fB\-\fR then -they are treated as command-line switches and are not part -of the pipeline specification. The following switches are -currently supported: -.TP 13 -\fB\-ignorestderr\fR -. -Stops the \fBexec\fR command from treating the output of messages to the -pipeline's standard error channel as an error case. -.TP 13 -\fB\-keepnewline\fR -. -Retains a trailing newline in the pipeline's output. -Normally a trailing newline will be deleted. -.TP 13 -\fB\-\|\-\fR -. -Marks the end of switches. The argument following this one will -be treated as the first \fIarg\fR even if it starts with a \fB\-\fR. -.PP -If an \fIarg\fR (or pair of \fIarg\fRs) has one of the forms -described below then it is used by \fBexec\fR to control the -flow of input and output among the subprocess(es). -Such arguments will not be passed to the subprocess(es). In forms -such as -.QW "\fB<\fR \fIfileName\fR" , -\fIfileName\fR may either be in a separate argument from -.QW \fB<\fR -or in the same argument with no intervening space (i.e. -.QW \fB<\fIfileName\fR ). -.TP 15 -\fB|\fR -. -Separates distinct commands in the pipeline. The standard output -of the preceding command will be piped into the standard input -of the next command. -.TP 15 -\fB|&\fR -. -Separates distinct commands in the pipeline. Both standard output -and standard error of the preceding command will be piped into -the standard input of the next command. -This form of redirection overrides forms such as 2> and >&. -.TP 15 -\fB<\0\fIfileName\fR -. -The file named by \fIfileName\fR is opened and used as the standard -input for the first command in the pipeline. -.TP 15 -\fB<@\0\fIfileId\fR -. -\fIFileId\fR must be the identifier for an open file, such as the return -value from a previous call to \fBopen\fR. -It is used as the standard input for the first command in the pipeline. -\fIFileId\fR must have been opened for reading. -.TP 15 -\fB<<\0\fIvalue\fR -. -\fIValue\fR is passed to the first command as its standard input. -.TP 15 -\fB>\0\fIfileName\fR -. -Standard output from the last command is redirected to the file named -\fIfileName\fR, overwriting its previous contents. -.TP 15 -\fB2>\0\fIfileName\fR -. -Standard error from all commands in the pipeline is redirected to the -file named \fIfileName\fR, overwriting its previous contents. -.TP 15 -\fB>&\0\fIfileName\fR -. -Both standard output from the last command and standard error from all -commands are redirected to the file named \fIfileName\fR, overwriting -its previous contents. -.TP 15 -\fB>>\0\fIfileName\fR -. -Standard output from the last command is -redirected to the file named \fIfileName\fR, appending to it rather -than overwriting it. -.TP 15 -\fB2>>\0\fIfileName\fR -. -Standard error from all commands in the pipeline is -redirected to the file named \fIfileName\fR, appending to it rather -than overwriting it. -.TP 15 -\fB>>&\0\fIfileName\fR -. -Both standard output from the last command and standard error from -all commands are redirected to the file named \fIfileName\fR, -appending to it rather than overwriting it. -.TP 15 -\fB>@\0\fIfileId\fR -. -\fIFileId\fR must be the identifier for an open file, such as the return -value from a previous call to \fBopen\fR. -Standard output from the last command is redirected to \fIfileId\fR's -file, which must have been opened for writing. -.TP 15 -\fB2>@\0\fIfileId\fR -. -\fIFileId\fR must be the identifier for an open file, such as the return -value from a previous call to \fBopen\fR. -Standard error from all commands in the pipeline is -redirected to \fIfileId\fR's file. -The file must have been opened for writing. -.TP 15 -\fB2>@1\0\fR -. -Standard error from all commands in the pipeline is redirected to the -command result. This operator is only valid at the end of the command -pipeline. -.TP 15 -\fB>&@\0\fIfileId\fR -. -\fIFileId\fR must be the identifier for an open file, such as the return -value from a previous call to \fBopen\fR. -Both standard output from the last command and standard error from -all commands are redirected to \fIfileId\fR's file. -The file must have been opened for writing. -.PP -If standard output has not been redirected then the \fBexec\fR -command returns the standard output from the last command -in the pipeline, unless -.QW 2>@1 -was specified, in which case standard error is included as well. -If any of the commands in the pipeline exit abnormally or -are killed or suspended, then \fBexec\fR will return an error -and the error message will include the pipeline's output followed by -error messages describing the abnormal terminations; the -\fB\-errorcode\fR return option will contain additional information -about the last abnormal termination encountered. -If any of the commands writes to its standard error file and that -standard error is not redirected -and \fB\-ignorestderr\fR is not specified, -then \fBexec\fR will return an error; the error message -will include the pipeline's standard output, followed by messages -about abnormal terminations (if any), followed by the standard error -output. -.PP -If the last character of the result or error message -is a newline then that character is normally deleted -from the result or error message. -This is consistent with other Tcl return values, which do not -normally end with newlines. -However, if \fB\-keepnewline\fR is specified then the trailing -newline is retained. -.PP -If standard input is not redirected with -.QW < , -.QW << -or -.QW <@ -then the standard input for the first command in the -pipeline is taken from the application's current standard input. -.PP -If the last \fIarg\fR is -.QW & -then the pipeline will be executed in background. -In this case the \fBexec\fR command will return a list whose -elements are the process identifiers for all of the subprocesses -in the pipeline. -The standard output from the last command in the pipeline will -go to the application's standard output if it has not been -redirected, and error output from all of -the commands in the pipeline will go to the application's -standard error file unless redirected. -.PP -The first word in each command is taken as the command name; -tilde-substitution is performed on it, and if the result contains -no slashes then the directories -in the PATH environment variable are searched for -an executable by the given name. -If the name contains a slash then it must refer to an executable -reachable from the current directory. -No -.QW glob -expansion or other shell-like substitutions -are performed on the arguments to commands. -.SH "PORTABILITY ISSUES" -.TP -\fBWindows\fR (all versions) -. -Reading from or writing to a socket, using the -.QW \fB@\0\fIfileId\fR -notation, does not work. When reading from a socket, a 16-bit DOS -application will hang and a 32-bit application will return immediately with -end-of-file. When either type of application writes to a socket, the -information is instead sent to the console, if one is present, or is -discarded. -.RS -.PP -The Tk console text widget does not provide real standard IO capabilities. -Under Tk, when redirecting from standard input, all applications will see an -immediate end-of-file; information redirected to standard output or standard -error will be discarded. -.PP -Either forward or backward slashes are accepted as path separators for -arguments to Tcl commands. When executing an application, the path name -specified for the application may also contain forward or backward slashes -as path separators. Bear in mind, however, that most Windows applications -accept arguments with forward slashes only as option delimiters and -backslashes only in paths. Any arguments to an application that specify a -path name with forward slashes will not automatically be converted to use -the backslash character. If an argument contains forward slashes as the -path separator, it may or may not be recognized as a path name, depending on -the program. -.PP -Additionally, when calling a 16-bit DOS or Windows 3.X application, all path -names must use the short, cryptic, path format (e.g., using -.QW applba~1.def -instead of -.QW applbakery.default ), -which can be obtained with the -.QW "\fBfile attributes\fI fileName \fB\-shortname\fR" -command. -.PP -Two or more forward or backward slashes in a row in a path refer to a -network path. For example, a simple concatenation of the root directory -\fBc:/\fR with a subdirectory \fB/windows/system\fR will yield -\fBc://windows/system\fR (two slashes together), which refers to the mount -point called \fBsystem\fR on the machine called \fBwindows\fR (and the -\fBc:/\fR is ignored), and is not equivalent to \fBc:/windows/system\fR, -which describes a directory on the current computer. The \fBfile join\fR -command should be used to concatenate path components. -.PP -Note that there are two general types of Win32 console applications: -.RS -.IP [1] -CLI \(em CommandLine Interface, simple stdio exchange. \fBnetstat.exe\fR for -example. -.IP [2] -TUI \(em Textmode User Interface, any application that accesses the console -API for doing such things as cursor movement, setting text color, detecting -key presses and mouse movement, etc. An example would be \fBtelnet.exe\fR -from Windows 2000. These types of applications are not common in a windows -environment, but do exist. -.RE -.PP -\fBexec\fR will not work well with TUI applications when a console is not -present, as is done when launching applications under wish. It is desirable -to have console applications hidden and detached. This is a designed-in -limitation as \fBexec\fR wants to communicate over pipes. The Expect -extension addresses this issue when communicating with a TUI application. -.PP -When attempting to execute an application, \fBexec\fR first searches for -the name as it was specified. Then, in order, -\fB.com\fR, \fB.exe\fR, \fB.bat\fR and \fB.cmd\fR -are appended to the end of the specified name and it searches -for the longer name. If a directory name was not specified as part of the -application name, the following directories are automatically searched in -order when attempting to locate the application: -.IP \(bu 3 -The directory from which the Tcl executable was loaded. -.IP \(bu 3 -The current directory. -.IP \(bu 3 -The Windows NT 32-bit system directory. -.IP \(bu 3 -The Windows NT 16-bit system directory. -.IP \(bu 3 -The Windows NT home directory. -.IP \(bu 3 -The directories listed in the path. -.PP -In order to execute shell built-in commands like \fBdir\fR and \fBcopy\fR, -the caller must prepend the desired command with -.QW "\fBcmd.exe /c\0\fR" -because built-in commands are not implemented using executables. -.RE -.TP -\fBUnix\fR (including Mac OS X) -. -The \fBexec\fR command is fully functional and works as described. -.SH "UNIX EXAMPLES" -.PP -Here are some examples of the use of the \fBexec\fR command on Unix. -To execute a simple program and get its result: -.PP -.CS -\fBexec\fR uname -a -.CE -.SS "WORKING WITH NON-ZERO RESULTS" -.PP -To execute a program that can return a non-zero result, you should -wrap the call to \fBexec\fR in \fBcatch\fR and check the contents -of the \fB\-errorcode\fR return option if you have an error: -.PP -.CS -set status 0 -if {[catch {\fBexec\fR grep foo bar.txt} results options]} { - set details [dict get $options -errorcode] - if {[lindex $details 0] eq "CHILDSTATUS"} { - set status [lindex $details 2] - } else { - # Some other error; regenerate it to let caller handle - return -options $options -level 0 $results - } -} -.CE -.VS 8.6 -.PP -This is more easily written using the \fBtry\fR command, as that makes -it simpler to trap specific types of errors. This is -done using code like this: -.PP -.CS -try { - set results [\fBexec\fR grep foo bar.txt] - set status 0 -} trap CHILDSTATUS {results options} { - set status [lindex [dict get $options -errorcode] 2] -} -.CE -.VE 8.6 -.SS "WORKING WITH QUOTED ARGUMENTS" -.PP -When translating a command from a Unix shell invocation, care should -be taken over the fact that single quote characters have no special -significance to Tcl. Thus: -.PP -.CS -awk '{sum += $1} END {print sum}' numbers.list -.CE -.PP -would be translated into something like: -.PP -.CS -\fBexec\fR awk {{sum += $1} END {print sum}} numbers.list -.CE -.SS "WORKING WITH GLOBBING" -.PP -If you are converting invocations involving shell globbing, you should -remember that Tcl does not handle globbing or expand things into -multiple arguments by default. Instead you should write things like -this: -.PP -.CS -\fBexec\fR ls -l {*}[glob *.tcl] -.CE -.SS "WORKING WITH USER-SUPPLIED SHELL SCRIPT FRAGMENTS" -.PP -One useful technique can be to expose to users of a script the ability -to specify a fragment of shell script to execute that will have some -data passed in on standard input that was produced by the Tcl program. -This is a common technique for using the \fIlpr\fR program for -printing. By far the simplest way of doing this is to pass the user's -script to the user's shell for processing, as this avoids a lot of -complexity with parsing other languages. -.PP -.CS -set lprScript [\fIget from user...\fR] -set postscriptData [\fIgenerate somehow...\fR] - -\fBexec\fR $env(SHELL) -c $lprScript << $postscriptData -.CE -.SH "WINDOWS EXAMPLES" -.PP -Here are some examples of the use of the \fBexec\fR command on Windows. -To start an instance of \fInotepad\fR editing a file without waiting -for the user to finish editing the file: -.PP -.CS -\fBexec\fR notepad myfile.txt & -.CE -.PP -To print a text file using \fInotepad\fR: -.PP -.CS -\fBexec\fR notepad /p myfile.txt -.CE -.SS "WORKING WITH CONSOLE PROGRAMS" -.PP -If a program calls other programs, such as is common with compilers, -then you may need to resort to batch files to hide the console windows -that sometimes pop up: -.PP -.CS -\fBexec\fR cmp.bat somefile.c -o somefile -.CE -.PP -With the file \fIcmp.bat\fR looking something like: -.PP -.CS -@gcc %1 %2 %3 %4 %5 %6 %7 %8 %9 -.CE -.SS "WORKING WITH COMMAND BUILT-INS" -.PP -Sometimes you need to be careful, as different programs may have the -same name and be in the path. It can then happen that typing a command -at the DOS prompt finds \fIa different program\fR than the same -command run via \fBexec\fR. This is because of the (documented) -differences in behaviour between \fBexec\fR and DOS batch files. -.PP -When in doubt, use the command \fBauto_execok\fR: it will return the -complete path to the program as seen by the \fBexec\fR command. This -applies especially when you want to run -.QW internal -commands like -\fIdir\fR from a Tcl script (if you just want to list filenames, use -the \fBglob\fR command.) To do that, use this: -.PP -.CS -\fBexec\fR {*}[auto_execok dir] *.tcl -.CE -.SS "WORKING WITH NATIVE FILENAMES" -.PP -Many programs on Windows require filename arguments to be passed in with -backslashes as pathname separators. This is done with the help of the -\fBfile nativename\fR command. For example, to make a directory (on NTFS) -encrypted so that only the current user can access it requires use of -the \fICIPHER\fR command, like this: -.PP -.CS -set secureDir "~/Desktop/Secure Directory" -file mkdir $secureDir -\fBexec\fR CIPHER /e /s:[file nativename $secureDir] -.CE -.SH "SEE ALSO" -error(n), file(n), open(n) -.SH KEYWORDS -execute, pipeline, redirection, subprocess -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/exit.n b/doc/exit.n deleted file mode 100644 index a005c08..0000000 --- a/doc/exit.n +++ /dev/null @@ -1,51 +0,0 @@ -'\" -'\" 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. -'\" -.TH exit n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -exit \- End the application -.SH SYNOPSIS -\fBexit \fR?\fIreturnCode\fR? -.BE - -.SH DESCRIPTION -.PP -Terminate the process, returning \fIreturnCode\fR to the -system as the exit status. -If \fIreturnCode\fR is not specified then it defaults -to 0. -.SH EXAMPLE -.PP -Since non-zero exit codes are usually interpreted as error cases by -the calling process, the \fBexit\fR command is an important part of -signaling that something fatal has gone wrong. This code fragment is -useful in scripts to act as a general problem trap: -.PP -.CS -proc main {} { - # ... put the real main code in here ... -} - -if {[catch {main} msg options]} { - puts stderr "unexpected script error: $msg" - if {[info exists env(DEBUG)]} { - puts stderr "---- BEGIN TRACE ----" - puts stderr [dict get $options -errorinfo] - puts stderr "---- END TRACE ----" - } - - # Reserve code 1 for "expected" error exits... - \fBexit\fR 2 -} -.CE -.SH "SEE ALSO" -exec(n) -.SH KEYWORDS -abort, exit, process diff --git a/doc/expr.n b/doc/expr.n deleted file mode 100644 index d33623c..0000000 --- a/doc/expr.n +++ /dev/null @@ -1,433 +0,0 @@ -'\" -'\" Copyright (c) 1993 The Regents of the University of California. -'\" Copyright (c) 1994-2000 Sun Microsystems, Inc. -'\" 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. -'\" -.TH expr n 8.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -expr \- Evaluate an expression -.SH SYNOPSIS -\fBexpr \fIarg \fR?\fIarg arg ...\fR? -.BE -.SH DESCRIPTION -.PP -Concatenates \fIarg\fRs, separated by a space, into an expression, and evaluates -that expression, returning its value. -The operators permitted in an expression include a subset of -the operators permitted in C expressions. For those operators -common to both Tcl and C, Tcl applies the same meaning and precedence -as the corresponding C operators. -The value of an expression is often a numeric result, either an integer or a -floating-point value, but may also be a non-numeric value. -For example, the expression -.PP -.CS -\fBexpr\fR 8.2 + 6 -.CE -.PP -evaluates to 14.2. -Expressions differ from C expressions in the way that -operands are specified. Expressions also support -non-numeric operands, string comparisons, and some -additional operators not found in C. -.PP -When an expression evaluates to an integer, the value is the decimal form of -the integer, and when an expression evaluates to a floating-point number, the -value is the form produced by the \fB%g\fR format specifier of Tcl's -\fBformat\fR command. -.SS OPERANDS -.PP -An expression consists of a combination of operands, operators, parentheses and -commas, possibly with whitespace between any of these elements, which is -ignored. -An integer operand may be specified in decimal (the normal case, the optional -first two characters are \fB0d\fR), binary -(the first two characters are \fB0b\fR), octal -(the first two characters are \fB0o\fR), or hexadecimal -(the first two characters are \fB0x\fR) form. For -compatibility with older Tcl releases, an operand that begins with \fB0\fR is -interpreted as an octal integer even if the second character is not \fBo\fR. -A floating-point number may be specified in any of several -common decimal formats, and may use the decimal point \fB.\fR, -\fBe\fR or \fBE\fR for scientific notation, and -the sign characters \fB+\fR and \fB\-\fR. The -following are all valid floating-point numbers: 2.1, 3., 6e4, 7.91e+16. -The strings \fBInf\fR -and \fBNaN\fR, in any combination of case, are also recognized as floating point -values. An operand that doesn't have a numeric interpretation must be quoted -with either braces or with double quotes. -.PP -An operand may be specified in any of the following ways: -.IP [1] -As a numeric value, either integer or floating-point. -.IP [2] -As a boolean value, using any form understood by \fBstring is\fR -\fBboolean\fR. -.IP [3] -As a variable, using standard \fB$\fR notation. -The value of the variable is then the value of the operand. -.IP [4] -As a string enclosed in double-quotes. -Backslash, variable, and command substitution are performed as described in -\fBTcl\fR. -.IP [5] -As a string enclosed in braces. -The operand is treated as a braced value as described in \fBTcl\fR. -.IP [6] -As a Tcl command enclosed in brackets. -Command substitution is performed as described in \fBTcl\fR. -.IP [7] -As a mathematical function such as \fBsin($x)\fR, whose arguments have any of the above -forms for operands. See \fBMATH FUNCTIONS\fR below for -a discussion of how mathematical functions are handled. -.PP -Because \fBexpr\fR parses and performs substitutions on values that have -already been parsed and substituted by \fBTcl\fR, it is usually best to enclose -expressions in braces to avoid the first round of substitutions by -\fBTcl\fR. -.PP -Below are some examples of simple expressions where the value of \fBa\fR is 3 -and the value of \fBb\fR is 6. The command on the left side of each line -produces the value on the right side. -.PP -.CS -.ta 6c -\fBexpr\fR 3.1 + $a \fI6.1\fR -\fBexpr\fR 2 + "$a.$b" \fI5.6\fR -\fBexpr\fR 4*[llength "6 2"] \fI8\fR -\fBexpr\fR {{word one} < "word $a"} \fI0\fR -.CE -.SS OPERATORS -.PP -For operators having both a numeric mode and a string mode, the numeric mode is -chosen when all operands have a numeric interpretation. The integer -interpretation of an operand is preferred over the floating-point -interpretation. To ensure string operations on arbitrary values it is generally a -good idea to use \fBeq\fR, \fBne\fR, or the \fBstring\fR command instead of -more versatile operators such as \fB==\fR. -.PP -Unless otherwise specified, operators accept non-numeric operands. The value -of a boolean operation is 1 if true, 0 otherwise. See also \fBstring is\fR -\fBboolean\fR. The valid operators, most of which are also available as -commands in the \fBtcl::mathop\fR namespace (see \fBmathop\fR(n)), are listed -below, grouped in decreasing order of precedence: -.TP 20 -\fB\-\0\0+\0\0~\0\0!\fR -. -Unary minus, unary plus, bit-wise NOT, logical NOT. These operators -may only be applied to numeric operands, and bit-wise NOT may only be -applied to integers. -.TP 20 -\fB**\fR -. -Exponentiation. Valid for numeric operands. -.TP 20 -\fB*\0\0/\0\0%\fR -. -Multiply and divide, which are valid for numeric operands, and remainder, which -is valid for integers. The remainder, an absolute value smaller than the -absolute value of the divisor, has the same sign as the divisor. -.RS -.PP -When applied to integers, division and remainder can be -considered to partition the number line into a sequence of -adjacent non-overlapping pieces, where each piece is the size of the divisor; -the quotient identifies which piece the dividend lies within, and the -remainder identifies where within that piece the dividend lies. A -consequence of this is that the result of -.QW "-57 \fB/\fR 10" -is always -6, and the result of -.QW "-57 \fB%\fR 10" -is always 3. -.RE -.TP 20 -\fB+\0\0\-\fR -. -Add and subtract. Valid for numeric operands. -.TP 20 -\fB<<\0\0>>\fR -. -Left and right shift. Valid for integers. -A right shift always propagates the sign bit. -.TP 20 -\fB<\0\0>\0\0<=\0\0>=\fR -. -Boolean less than, greater than, less than or equal, and greater than or equal. -.TP 20 -\fB==\0\0!=\fR -. -Boolean equal and not equal. -.TP 20 -\fBeq\0\0ne\fR -. -Boolean string equal and string not equal. -.TP 20 -\fBin\0\0ni\fR -. -List containment and negated list containment. The first argument is -interpreted as a string, the second as a list. \fBin\fR tests for membership -in the list, and \fBni\fR is the inverse. -.TP 20 -\fB&\fR -. -Bit-wise AND. Valid for integer operands. -.TP 20 -\fB^\fR -. -Bit-wise exclusive OR. Valid for integer operands. -.TP 20 -\fB|\fR -. -Bit-wise OR. Valid for integer operands. -.TP 20 -\fB&&\fR -. -Logical AND. If both operands are true, the result is 1, or 0 otherwise. - -.TP 20 -\fB||\fR -. -Logical OR. If both operands are false, the result is 0, or 1 otherwise. -.TP 20 -\fIx\fB?\fIy\fB:\fIz\fR -. -If-then-else, as in C. If \fIx\fR is false , the result is the value of -\fIy\fR. Otherwise the result is the value of \fIz\fR. -.PP -The exponentiation operator promotes types in the same way that the multiply -and divide operators do, and the result is is the same as the result of -\fBpow\fR. -Exponentiation groups right-to-left within a precedence level. Other binary -operators group left-to-right. For example, the value of -.PP -.CS -\fBexpr\fR {4*2 < 7} -.CE -.PP -is 0, while the value of -.PP -.CS -\fBexpr\fR {2**3**2} -.CE -.PP -is 512. -.PP -As in C, \fB&&\fR, \fB||\fR, and \fB?:\fR feature -.QW "lazy evaluation" , -which means that operands are not evaluated if they are -not needed to determine the outcome. For example, in -.PP -.CS -\fBexpr\fR {$v ? [a] : [b]} -.CE -.PP -only one of \fB[a]\fR or \fB[b]\fR is evaluated, -depending on the value of \fB$v\fR. This is not true of the normal Tcl parser, -so it is normally recommended to enclose the arguments to \fBexpr\fR in braces. -Without braces, as in -\fBexpr\fR $v ? [a] : [b] -both \fB[a]\fR and \fB[b]\fR are evaluated before \fBexpr\fR is even called. -.PP -For more details on the results -produced by each operator, see the documentation for C. -.SS "MATH FUNCTIONS" -.PP -A mathematical function such as \fBsin($x)\fR is replaced with a call to an ordinary -Tcl command in the \fBtcl::mathfunc\fR namespace. The evaluation -of an expression such as -.PP -.CS -\fBexpr\fR {sin($x+$y)} -.CE -.PP -is the same in every way as the evaluation of -.PP -.CS -\fBexpr\fR {[tcl::mathfunc::sin [\fBexpr\fR {$x+$y}]]} -.CE -.PP -which in turn is the same as the evaluation of -.PP -.CS -tcl::mathfunc::sin [\fBexpr\fR {$x+$y}] -.CE -.PP -\fBtcl::mathfunc::sin\fR is resolved as described in -\fBNAMESPACE RESOLUTION\fR in the \fBnamespace\fR(n) documentation. Given the -default value of \fBnamespace path\fR, \fB[namespace -current]::tcl::mathfunc::sin\fR or \fB::tcl::mathfunc::sin\fR are the typical -resolutions. -.PP -As in C, a mathematical function may accept multiple arguments separated by commas. Thus, -.PP -.CS -\fBexpr\fR {hypot($x,$y)} -.CE -.PP -becomes -.PP -.CS -tcl::mathfunc::hypot $x $y -.CE -.PP -See the \fBmathfunc\fR(n) documentation for the math functions that are -available by default. -.SS "TYPES, OVERFLOW, AND PRECISION" -.PP -When needed to guarantee exact performance, internal computations involving -integers use the LibTomMath multiple precision integer library. In Tcl releases -prior to 8.5, integer calculations were performed using one of the C types -\fIlong int\fR or \fITcl_WideInt\fR, causing implicit range truncation -in those calculations where values overflowed the range of those types. -Any code that relied on these implicit truncations should instead call -\fBint()\fR or \fBwide()\fR, which do truncate. -.PP -Internal floating-point computations are -performed using the \fIdouble\fR C type. -When converting a string to floating-point value, exponent overflow is -detected and results in the \fIdouble\fR value of \fBInf\fR or -\fB\-Inf\fR as appropriate. Floating-point overflow and underflow -are detected to the degree supported by the hardware, which is generally -fairly reliable. -.PP -Conversion among internal representations for integer, floating-point, and -string operands is done automatically as needed. For arithmetic computations, -integers are used until some floating-point number is introduced, after which -floating-point values are used. For example, -.PP -.CS -\fBexpr\fR {5 / 4} -.CE -.PP -returns 1, while -.PP -.CS -\fBexpr\fR {5 / 4.0} -\fBexpr\fR {5 / ( [string length "abcd"] + 0.0 )} -.CE -.PP -both return 1.25. -A floating-point result can be distinguished from an integer result by the -presence of either -.QW \fB.\fR -or -.QW \fBe\fR -.PP -. For example, -.PP -.CS -\fBexpr\fR {20.0/5.0} -.CE -.PP -returns \fB4.0\fR, not \fB4\fR. -.SH "PERFORMANCE CONSIDERATIONS" -.PP -Where an expression contains syntax that Tcl would otherwise perform -substitutions on, enclosing an expression in braces or otherwise quoting it -so that it's a static value allows the Tcl compiler to generate bytecode for -the expression, resulting in better speed and smaller storage requirements. -This also avoids issues that can arise if Tcl is allowed to perform -substitution on the value before \fBexpr\fR is called. -.PP -In the following example, the value of the expression is 11 because the Tcl parser first -substitutes \fB$b\fR and \fBexpr\fR then substitutes \fB$a\fR. Enclosing the -expression in braces would result in a syntax error. -.CS -set a 3 -set b {$a + 2} -\fBexpr\fR $b*4 -.CE -.PP - -When an expression is generated at runtime, like the one above is, the bytcode -compiler must ensure that new code is generated each time the expression -is evaluated. This is the most costly kind of expression from a performance -perspective. In such cases, consider directly using the commands described in -the \fBmathfunc\fR(n) or \fBmathop\fR(n) documentation instead of \fBexpr\fR. - -Most expressions are not formed at runtime, but are literal strings or contain -substitutions that don't introduce other substitutions. To allow the bytecode -compiler to work with an expression as a string literal at compilation time, -ensure that it contains no substitutions or that it is enclosed in braces or -otherwise quoted to prevent Tcl from performing substitutions, allowing -\fBexpr\fR to perform them instead. -.SH EXAMPLES -.PP -A numeric comparison whose result is 1: -.CS -\fBexpr\fR {"0x03" > "2"} -.CE -.PP -A string comparison whose result is 1: -.CS -\fBexpr\fR {"0y" > "0x12"} -.CE -.PP -Define a procedure that computes an -.QW interesting -mathematical function: -.PP -.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: -.PP -.CS -# convert from ($radius,$angle) -set x [\fBexpr\fR { $radius * cos($angle) }] -set y [\fBexpr\fR { $radius * sin($angle) }] -.CE -.PP -Convert cartesian coordinates into polar coordinates: -.PP -.CS -# convert from ($x,$y) -set radius [\fBexpr\fR { hypot($y, $x) }] -set angle [\fBexpr\fR { atan2($y, $x) }] -.CE -.PP -Print a message describing the relationship of two string values to -each other: -.PP -.CS -puts "a and b are [\fBexpr\fR {$a eq $b ? {equal} : {different}}]" -.CE -.PP -Set a variable indicating whether an environment variable is defined and has -value of true: -.PP -.CS -set isTrue [\fBexpr\fR { - [info exists ::env(SOME_ENV_VAR)] && - [string is true -strict $::env(SOME_ENV_VAR)] -}] -.CE -.PP -Generate a random integer in the range 0..99 inclusive: -.PP -.CS -set randNum [\fBexpr\fR { int(100 * rand()) }] -.CE -.SH "SEE ALSO" -array(n), for(n), if(n), mathfunc(n), mathop(n), namespace(n), proc(n), -string(n), Tcl(n), while(n) -.SH KEYWORDS -arithmetic, boolean, compare, expression, fuzzy comparison -.SH COPYRIGHT -.nf -Copyright (c) 1993 The Regents of the University of California. -Copyright (c) 1994-2000 Sun Microsystems Incorporated. -Copyright (c) 2005 by Kevin B. Kenny . All rights reserved. -.fi -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/fblocked.n b/doc/fblocked.n deleted file mode 100644 index 93cfe87..0000000 --- a/doc/fblocked.n +++ /dev/null @@ -1,67 +0,0 @@ -'\" -'\" 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. -'\" -.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 -# This is called whenever a new client connects to the server -proc connect {chan host port} { - set clientName [format <%s:%d> $host $port] - puts "connection from $clientName" - fconfigure $chan -blocking 0 -buffering line - fileevent $chan readable [list echoLine $chan $clientName] -} - -# This is called whenever either at least one byte of input -# data is available, or the channel was closed by the client. -proc echoLine {chan clientName} { - gets $chan line - if {[eof $chan]} { - puts "finishing connection from $clientName" - close $chan - } elseif {![\fBfblocked\fR $chan]} { - # Didn't block waiting for end-of-line - puts "$clientName - $line" - puts $chan $line - } -} - -# Create the server socket and enter the event-loop to wait -# for incoming connections... -socket -server connect 12345 -vwait forever -.CE -.SH "SEE ALSO" -gets(n), open(n), read(n), socket(n), Tcl_StandardChannels(3) -.SH KEYWORDS -blocking, nonblocking diff --git a/doc/fconfigure.n b/doc/fconfigure.n deleted file mode 100644 index 8da76c6..0000000 --- a/doc/fconfigure.n +++ /dev/null @@ -1,289 +0,0 @@ -'\" -'\" 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. -'\" -.TH fconfigure n 8.3 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -fconfigure \- Set and get options on a channel -.SH SYNOPSIS -.nf -\fBfconfigure \fIchannelId\fR -\fBfconfigure \fIchannelId\fR \fIname\fR -\fBfconfigure \fIchannelId\fR \fIname value \fR?\fIname value ...\fR? -.fi -.BE -.SH DESCRIPTION -.PP -The \fBfconfigure\fR command sets and retrieves options for channels. -.PP -\fIChannelId\fR identifies the channel for which to set or query an -option and must refer 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 no \fIname\fR or \fIvalue\fR arguments are supplied, the command -returns a list containing alternating option names and values for the channel. -If \fIname\fR is supplied but no \fIvalue\fR then the command returns -the current value of the given option. -If one or more pairs of \fIname\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 additional options for sockets, and -the \fBopen\fR command for additional options for serial devices. -.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 \fBgets\fR, -\fBread\fR, \fBputs\fR, \fBflush\fR, and \fBclose\fR commands by -allowing them to operate asynchronously; -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 \fBflush\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 between one and one million, allowing -buffers of one to one million bytes in size. -.TP -\fB\-encoding\fR \fIname\fR -. -This option is used to specify the encoding of the channel, 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. -The acceptable range for \fB\-eofchar\fR values is \ex01 - \ex7f; -attempting to set \fB\-eofchar\fR to a value outside of this range will -generate an error. -.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 \fBgets\fR -and \fBread\fR) the Tcl I/O system automatically translates the external -end-of-line representation into newline characters. Upon output (i.e., -with \fBputs\fR), the I/O system translates newlines to the external -end-of-line representation. The default translation mode, \fBauto\fR, -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\fR), carriage return (\fBcr\fR), or carriage return followed by a -newline (\fBcrlf\fR) 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\fR mode, except that in addition \fBbinary\fR 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. -.RS -.PP -Internally, i.e. when it comes to the actual behaviour of the -translator this value \fBis\fR identical to \fBlf\fR and is therefore -reported as such when queried. Even if \fBbinary\fR was used to set -the translation. -.RE -.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\fR mode converts carriage returns to newline characters. As the -output translation mode, \fBcr\fR 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\fR mode converts carriage-return-linefeed -sequences to newline characters. As the output translation mode, -\fBcrlf\fR 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 -.PP -.SH "STANDARD CHANNELS" -.PP -The Tcl standard channels (\fBstdin\fR, \fBstdout\fR, and \fBstderr\fR) -can be configured through this command like every other channel opened -by the Tcl library. Beyond the standard options described above they -will also support any special option according to their current type. -If, for example, a Tcl application is started by the \fBinet\fR -super-server common on Unix system its Tcl standard channels will be -sockets and thus support the socket options. -.SH EXAMPLES -.PP -Instruct Tcl to always send output to \fBstdout\fR immediately, -whether or not it is to a terminal: -.PP -.CS -\fBfconfigure\fR stdout -buffering none -.CE -.PP -Open a socket and read lines from it without ever blocking the -processing of other events: -.PP -.CS -set s [socket some.where.com 12345] -\fBfconfigure\fR $s -blocking 0 -fileevent $s readable "readMe $s" -proc readMe chan { - if {[gets $chan line] < 0} { - if {[eof $chan]} { - close $chan - return - } - # Could not read a complete line this time; Tcl's - # internal buffering will hold the partial line for us - # until some more data is available over the socket. - } else { - puts stdout $line - } -} -.CE -.PP -Read a PPM-format image from a file: -.PP -.CS -# Open the file and put it into Unix ASCII mode -set f [open teapot.ppm] -\fBfconfigure\fR $f \-encoding ascii \-translation lf - -# Get the header -if {[gets $f] ne "P6"} { - error "not a raw\-bits PPM" -} - -# Read lines until we have got non-comment lines -# that supply us with three decimal values. -set words {} -while {[llength $words] < 3} { - gets $f line - if {[string match "#*" $line]} continue - lappend words {*}[join [scan $line %d%d%d]] -} - -# Those words supply the size of the image and its -# overall depth per channel. Assign to variables. -lassign $words xSize ySize depth - -# Now switch to binary mode to pull in the data, -# one byte per channel (red,green,blue) per pixel. -\fBfconfigure\fR $f \-translation binary -set numDataBytes [expr {3 * $xSize * $ySize}] -set data [read $f $numDataBytes] - -close $f -.CE -.SH "SEE ALSO" -close(n), flush(n), gets(n), open(n), puts(n), read(n), socket(n), -Tcl_StandardChannels(3) -.SH KEYWORDS -blocking, buffering, carriage return, end of line, flushing, linemode, -newline, nonblocking, platform, translation, encoding, filter, byte array, -binary -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/fcopy.n b/doc/fcopy.n deleted file mode 100644 index d39c803..0000000 --- a/doc/fcopy.n +++ /dev/null @@ -1,182 +0,0 @@ -'\" -'\" 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. -'\" -.TH fcopy n 8.0 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -fcopy \- Copy data from one channel to another -.SH SYNOPSIS -\fBfcopy \fIinchan\fR \fIoutchan\fR ?\fB\-size \fIsize\fR? ?\fB\-command \fIcallback\fR? -.BE - -.SH DESCRIPTION -.PP -The \fBfcopy\fR command copies data from one I/O channel, \fIinchan\fR to another I/O channel, \fIoutchan\fR. -The \fBfcopy\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. -.PP -The \fBfcopy\fR -command transfers data from \fIinchan\fR until end of file -or \fIsize\fR bytes or characters have been -transferred; \fIsize\fR is in bytes if the two channels are using the -same encoding, and is in characters otherwise. -If no \fB\-size\fR argument is given, -then the copy goes until end of file. -All the data read from \fIinchan\fR is copied to \fIoutchan\fR. -Without the \fB\-command\fR option, \fBfcopy\fR blocks until the copy is complete -and returns the number of bytes or characters (using the same rules as -for the \fB\-size\fR option) written to \fIoutchan\fR. -.PP -The \fB\-command\fR argument makes \fBfcopy\fR work in the background. -In this case it returns immediately and the \fIcallback\fR is invoked -later when the copy completes. -The \fIcallback\fR is called with -one or two additional -arguments that indicates how many bytes were written to \fIoutchan\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 \fIinchan\fR or \fIoutchan\fR into -non-blocking mode; the \fBfcopy\fR command takes care of that automatically. -However, it is necessary to enter the event loop by using -the \fBvwait\fR command or by using Tk. -.PP -You are not allowed to do other input operations with \fIinchan\fR, or -output operations with \fIoutchan\fR, during a background -\fBfcopy\fR. The converse is entirely legitimate, as exhibited by the -bidirectional fcopy example below. -.PP -If either \fIinchan\fR or \fIoutchan\fR get closed -while the copy is in progress, the current copy is stopped -and the command callback is \fInot\fR made. -If \fIinchan\fR is closed, -then all data already queued for \fIoutchan\fR is written out. -.PP -Note that \fIinchan\fR can become readable during a background copy. -You should turn off any \fBfileevent\fR handlers during a background -copy so those handlers do not interfere with the copy. -Any wrong-sided I/O attempted (by a \fBfileevent\fR handler or otherwise) will get a -.QW "channel busy" -error. -.PP -\fBFcopy\fR translates end-of-line sequences in \fIinchan\fR and \fIoutchan\fR -according to the \fB\-translation\fR option -for these channels. -See the manual entry for \fBfconfigure\fR for details on the -\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\fR or -as the argument to the callback for an asynchronous \fBfcopy\fR. -.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 -.QW binary -and have matching translations. If only the output channel is set to encoding -.QW binary -the system will write the internal UTF-8 representation of the incoming -characters. If only the input channel is set to encoding -.QW 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. -.PP -.CS -fconfigure $in -translation binary -fconfigure $out -translation binary -\fBfcopy\fR $in $out -.CE -.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. -.PP -.CS -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 -.CE -.PP -The third example copies in chunks and tests for end of file -in the command callback. -.PP -.CS -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 -size $chunk \e - -command [list CopyMore $in $out $chunk] - } -} -set in [open $file1] -set out [socket $server $port] -set chunk 1024 -set total 0 -\fBfcopy\fR $in $out -size $chunk \e - -command [list CopyMore $in $out $chunk] -vwait done -.CE -.PP -The fourth example starts an asynchronous, bidirectional fcopy between -two sockets. Those could also be pipes from two [open "|hal 9000" r+] -(though their conversation would remain secret to the script, since -all four fileevent slots are busy). -.PP -.CS -set flows 2 -proc Done {dir args} { - global flows done - puts "$dir is over." - incr flows -1 - if {$flows<=0} {set done 1} -} -\fBfcopy\fR $sok1 $sok2 -command [list Done UP] -\fBfcopy\fR $sok2 $sok1 -command [list Done DOWN] -vwait done -.CE -.SH "SEE ALSO" -eof(n), fblocked(n), fconfigure(n), file(n) -.SH KEYWORDS -blocking, channel, end of line, end of file, nonblocking, read, translation -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/file.n b/doc/file.n deleted file mode 100644 index ad35dd5..0000000 --- a/doc/file.n +++ /dev/null @@ -1,549 +0,0 @@ -'\" -'\" 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. -'\" -.TH file n 8.3 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -file \- Manipulate file names and attributes -.SH SYNOPSIS -\fBfile \fIoption\fR \fIname\fR ?\fIarg arg ...\fR? -.BE -.SH DESCRIPTION -.PP -This command provides several operations on a file's name or attributes. -\fIName\fR is the name of a file; if it starts with a tilde, then tilde -substitution is done before executing the command (see the manual entry for -\fBfilename\fR for details). \fIOption\fR indicates what to do with the -file name. Any unique abbreviation for \fIoption\fR is acceptable. The -valid options are: -.TP -\fBfile atime \fIname\fR ?\fItime\fR? -. -Returns a decimal string giving the time at which file \fIname\fR was last -accessed. If \fItime\fR is specified, it is an access time to set -for the file. The time is measured in the standard POSIX fashion as -seconds from a fixed starting time (often January 1, 1970). If the file -does not exist or its access time cannot be queried or set then an error is -generated. On Windows, FAT file systems do not support access time. -.TP -\fBfile attributes \fIname\fR -.TP -\fBfile attributes \fIname\fR ?\fIoption\fR? -.TP -\fBfile attributes \fIname\fR ?\fIoption value option value...\fR? -. -This subcommand returns or sets platform specific values associated -with a file. The first form returns a list of the platform specific -flags and their values. The second form returns the value for the -specific option. The third form sets one or more of the values. The -values are as follows: -.RS -.PP -On Unix, \fB\-group\fR gets or sets the group name for the file. A group id -can be given to the command, but it returns a group name. \fB\-owner\fR gets -or sets the user name of the owner of the file. The command returns the -owner name, but the numerical id can be passed when setting the -owner. \fB\-permissions\fR sets or retrieves the octal code that chmod(1) -uses. This command does also has limited support for setting using the -symbolic attributes for chmod(1), of the form [ugo]?[[+\-=][rwxst],[...]], -where multiple symbolic attributes can be separated by commas (example: -\fBu+s,go\-rw\fR add sticky bit for user, remove read and write -permissions for group and other). A simplified \fBls\fR style string, -of the form rwxrwxrwx (must be 9 characters), is also supported -(example: \fBrwxr\-xr\-t\fR is equivalent to 01755). -On versions of Unix supporting file flags, \fB\-readonly\fR gives the -value or sets or clears the readonly attribute of the file, -i.e. the user immutable flag \fBuchg\fR to chflags(1). -.PP -On Windows, \fB\-archive\fR gives the value or sets or clears the -archive attribute of the file. \fB\-hidden\fR gives the value or sets -or clears the hidden attribute of the file. \fB\-longname\fR will -expand each path element to its long version. This attribute cannot be -set. \fB\-readonly\fR gives the value or sets or clears the readonly -attribute of the file. \fB\-shortname\fR gives a string where every -path element is replaced with its short (8.3) version of the -name. This attribute cannot be set. \fB\-system\fR gives or sets or -clears the value of the system attribute of the file. -.PP -On Mac OS X and Darwin, \fB\-creator\fR gives or sets the -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\fR ?\fIpattern\fR? -. -If \fIpattern\fR is not 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 -. -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, -then the second form is used. The second form makes a copy inside -\fItargetDir\fR of each \fIsource\fR file listed. If a directory is -specified as a \fIsource\fR, then the contents of the directory will be -recursively copied into \fItargetDir\fR. Existing files will not be -overwritten unless the \fB\-force\fR option is specified (when Tcl will -also attempt to adjust permissions on the destination file or directory -if that is necessary to allow the copy to proceed). When copying -within a single filesystem, \fIfile copy\fR will copy soft links (i.e. -the links themselves are copied, not the things they point to). Trying -to overwrite a non-empty directory, overwrite a directory with a file, -or overwrite a file with a directory will all result in errors even if -\fB\-force\fR was specified. Arguments are processed in the order -specified, halting at the first error, if any. A \fB\-\|\-\fR marks -the end of switches; the argument following the \fB\-\|\-\fR will be -treated as a \fIsource\fR even if it starts with a \fB\-\fR. -.TP -\fBfile delete \fR?\fB\-force\fR? ?\fB\-\|\-\fR? ?\fIpathname\fR ... ? -. -Removes the file or directory specified by each \fIpathname\fR -argument. Non-empty directories will be removed only if the -\fB\-force\fR option is specified. When operating on symbolic links, -the links themselves will be deleted, not the objects they point to. -Trying to delete a non-existent file is not considered an error. -Trying to delete a read-only file will cause the file to be deleted, -even if the \fB\-force\fR flags is not specified. If the \fB\-force\fR -option is specified on a directory, Tcl will attempt both to change -permissions and move the current directory -.QW pwd -out of the given path if that is necessary to allow the deletion to -proceed. Arguments are processed in the order specified, halting at -the first error, if any. -A \fB\-\|\-\fR marks the end of switches; the argument following the -\fB\-\|\-\fR will be treated as a \fIpathname\fR even if it starts with -a \fB\-\fR. -.TP -\fBfile dirname \fIname\fR -Returns a name comprised of all of the path components in \fIname\fR -excluding the last element. If \fIname\fR is a relative file name and -only contains one path element, then returns -.QW \fB.\fR . -If \fIname\fR refers to a root directory, then the root directory is -returned. For example, -.RS -.PP -.CS -\fBfile dirname\fR c:/ -.CE -.PP -returns \fBc:/\fR. -.PP -Note that tilde substitution will only be -performed if it is necessary to complete the command. For example, -.PP -.CS -\fBfile dirname\fR ~/src/foo.c -.CE -.PP -returns \fB~/src\fR, whereas -.PP -.CS -\fBfile dirname\fR ~ -.CE -.PP -returns \fB/home\fR (or something similar). -.RE -.TP -\fBfile executable \fIname\fR -. -Returns \fB1\fR if file \fIname\fR is executable by the current user, -\fB0\fR otherwise. On Windows, which does not have an executable attribute, -the command treats all directories and any files with extensions -\fBexe\fR, \fBcom\fR, \fBcmd\fR or \fBbat\fR as executable. -.TP -\fBfile exists \fIname\fR -. -Returns \fB1\fR if file \fIname\fR exists and the current user has -search privileges for the directories leading to it, \fB0\fR otherwise. -.TP -\fBfile extension \fIname\fR -. -Returns all of the characters in \fIname\fR after and including the last -dot in the last element of \fIname\fR. If there is no dot in the last -element of \fIname\fR then returns the empty string. -.TP -\fBfile isdirectory \fIname\fR -. -Returns \fB1\fR if file \fIname\fR is a directory, \fB0\fR otherwise. -.TP -\fBfile isfile \fIname\fR -. -Returns \fB1\fR if file \fIname\fR is a regular file, \fB0\fR otherwise. -.TP -\fBfile join \fIname\fR ?\fIname ...\fR? -. -Takes one or more file names and combines them, using the correct path -separator for the current platform. If a particular \fIname\fR is -relative, then it will be joined to the previous file name argument. -Otherwise, any earlier arguments will be discarded, and joining will -proceed from the current argument. For example, -.RS -.PP -.CS -\fBfile join\fR a b /foo bar -.CE -.PP -returns \fB/foo/bar\fR. -.PP -Note that any of the names can contain separators, and that the result -is always canonical for the current platform: \fB/\fR for Unix and -Windows. -.RE -.TP -\fBfile link\fR ?\fI\-linktype\fR? \fIlinkName\fR ?\fItarget\fR? -. -If only one argument is given, that argument is assumed to be -\fIlinkName\fR, and this command returns the value of the link given by -\fIlinkName\fR (i.e. the name of the file it points to). If -\fIlinkName\fR is not a link or its value cannot be read (as, for example, -seems to be the case with hard links, which look just like ordinary -files), then an error is returned. -.RS -.PP -If 2 arguments are given, then these are assumed to be \fIlinkName\fR -and \fItarget\fR. If \fIlinkName\fR already exists, or if \fItarget\fR -does not exist, an error will be returned. Otherwise, Tcl creates a new -link called \fIlinkName\fR which points to the existing filesystem -object at \fItarget\fR (which is also the returned value), where the -type of the link is platform-specific (on Unix a symbolic link will be -the default). This is useful for the case where the user wishes to -create a link in a cross-platform way, and does not care what type of -link is created. -.PP -If the user wishes to make a link of a specific type only, (and signal an -error if for some reason that is not possible), then the optional -\fI\-linktype\fR argument should be given. Accepted values for -\fI\-linktype\fR are -.QW \fB\-symbolic\fR -and -.QW \fB\-hard\fR . -.PP -On Unix, symbolic links can be made to relative paths, and those paths -must be relative to the actual \fIlinkName\fR's location (not to the -cwd), but on all other platforms where relative links are not supported, -target paths will always be converted to absolute, normalized form -before the link is created (and therefore relative paths are interpreted -as relative to the cwd). Furthermore, -.QW ~user -paths are always expanded -to absolute form. When creating links on filesystems that either do not -support any links, or do not support the specific type requested, an -error message will be returned. Most Unix platforms support both -symbolic and hard links (the latter for files only). Windows -supports symbolic directory links and hard file links on NTFS drives. -.RE -.TP -\fBfile lstat \fIname varName\fR -. -Same as \fBstat\fR option (see below) except uses the \fIlstat\fR -kernel call instead of \fIstat\fR. This means that if \fIname\fR -refers to a symbolic link the information returned in \fIvarName\fR -is for the link rather than the file it refers to. On systems that -do not support symbolic links this option behaves exactly the same -as the \fBstat\fR option. -.TP -\fBfile mkdir\fR ?\fIdir\fR ...? -. -Creates each directory specified. For each pathname \fIdir\fR specified, -this command will create all non-existing parent directories as -well as \fIdir\fR itself. If an existing directory is specified, then -no action is taken and no error is returned. Trying to overwrite an existing -file with a directory will result in an error. Arguments are processed in -the order specified, halting at the first error, if any. -.TP -\fBfile mtime \fIname\fR ?\fItime\fR? -. -Returns a decimal string giving the time at which file \fIname\fR was last -modified. If \fItime\fR is specified, it is a modification time to set for -the file (equivalent to Unix \fBtouch\fR). The time is measured in the -standard POSIX fashion as seconds from a fixed starting time (often January -1, 1970). If the file does not exist or its modified time cannot be queried -or set then an error is generated. -.TP -\fBfile nativename \fIname\fR -. -Returns the platform-specific name of the file. This is useful if the -filename is needed to pass to a platform-specific call, such as to a -subprocess via \fBexec\fR under Windows (see \fBEXAMPLES\fR below). -.TP -\fBfile normalize \fIname\fR -. -Returns a unique normalized path representation for the file-system -object (file, directory, link, etc), whose string value can be used as a -unique identifier for it. A normalized path is an absolute path which has -all -.QW ../ -and -.QW ./ -removed. Also it is one which is in the -.QW standard -format for the native platform. On Unix, this means the segments -leading up to the path must be free of symbolic links/aliases (but the -very last path component may be a symbolic link), and on Windows it also -means we want the long form with that form's case-dependence (which -gives us a unique, case-dependent path). The one exception concerning the -last link in the path is necessary, because Tcl or the user may wish to -operate on the actual symbolic link itself (for example \fBfile delete\fR, -\fBfile rename\fR, \fBfile copy\fR are defined to operate on symbolic -links, not on the things that they point to). -.TP -\fBfile owned \fIname\fR -. -Returns \fB1\fR if file \fIname\fR is owned by the current user, \fB0\fR -otherwise. -.TP -\fBfile pathtype \fIname\fR -. -Returns one of \fBabsolute\fR, \fBrelative\fR, \fBvolumerelative\fR. If -\fIname\fR refers to a specific file on a specific volume, the path type will -be \fBabsolute\fR. If \fIname\fR refers to a file relative to the current -working directory, then the path type will be \fBrelative\fR. If \fIname\fR -refers to a file relative to the current working directory on a specified -volume, or to a specific file on the current working volume, then the path -type is \fBvolumerelative\fR. -.TP -\fBfile readable \fIname\fR -. -Returns \fB1\fR if file \fIname\fR is readable by the current user, -\fB0\fR otherwise. -.TP -\fBfile readlink \fIname\fR -. -Returns the value of the symbolic link given by \fIname\fR (i.e. the name -of the file it points to). If \fIname\fR is not a symbolic link or its -value cannot be read, then an error is returned. On systems that do not -support symbolic links this option is undefined. -.TP -\fBfile rename \fR?\fB\-force\fR? ?\fB\-\|\-\fR? \fIsource\fR \fItarget\fR -.TP -\fBfile rename \fR?\fB\-force\fR? ?\fB\-\|\-\fR? \fIsource\fR ?\fIsource\fR ...? \fItargetDir\fR -. -The first form takes the file or directory specified by pathname -\fIsource\fR and renames it to \fItarget\fR, moving the file if the -pathname \fItarget\fR specifies a name in a different directory. If -\fItarget\fR is an existing directory, then the second form is used. -The second form moves each \fIsource\fR file or directory into the -directory \fItargetDir\fR. Existing files will not be overwritten -unless the \fB\-force\fR option is specified. When operating inside a -single filesystem, Tcl will rename symbolic links rather than the -things that they point to. Trying to overwrite a non-empty directory, -overwrite a directory with a file, or a file with a directory will all -result in errors. Arguments are processed in the order specified, -halting at the first error, if any. A \fB\-\|\-\fR marks the end of -switches; the argument following the \fB\-\|\-\fR will be treated as a -\fIsource\fR even if it starts with a \fB\-\fR. -.TP -\fBfile rootname \fIname\fR -. -Returns all of the characters in \fIname\fR up to but not including the -last -.QW . -character in the last component of name. If the last -component of \fIname\fR does not contain a dot, then returns \fIname\fR. -.TP -\fBfile separator\fR ?\fIname\fR? -. -If no argument is given, returns the character which is used to separate -path segments for native files on this platform. If a path is given, -the filesystem responsible for that path is asked to return its -separator character. If no file system accepts \fIname\fR, an error -is generated. -.TP -\fBfile size \fIname\fR -. -Returns a decimal string giving the size of file \fIname\fR in bytes. If -the file does not exist or its size cannot be queried then an error is -generated. -.TP -\fBfile split \fIname\fR -. -Returns a list whose elements are the path components in \fIname\fR. The -first element of the list will have the same path type as \fIname\fR. -All other elements will be relative. Path separators will be discarded -unless they are needed to ensure that an element is unambiguously relative. -For example, under Unix -.RS -.PP -.CS -\fBfile split\fR /foo/~bar/baz -.CE -.PP -returns -.QW \fB/\0\0foo\0\0./~bar\0\0baz\fR -to ensure that later commands -that use the third component do not attempt to perform tilde -substitution. -.RE -.TP -\fBfile stat \fIname varName\fR -. -Invokes the \fBstat\fR kernel call on \fIname\fR, and uses the variable -given by \fIvarName\fR to hold information returned from the kernel call. -\fIVarName\fR is treated as an array variable, and the following elements -of that variable are set: \fBatime\fR, \fBctime\fR, \fBdev\fR, \fBgid\fR, -\fBino\fR, \fBmode\fR, \fBmtime\fR, \fBnlink\fR, \fBsize\fR, \fBtype\fR, -\fBuid\fR. Each element except \fBtype\fR is a decimal string with the -value of the corresponding field from the \fBstat\fR return structure; -see the manual entry for \fBstat\fR for details on the meanings of the -values. The \fBtype\fR element gives the type of the file in the same -form returned by the command \fBfile type\fR. This command returns an -empty string. -.TP -\fBfile system \fIname\fR -. -Returns a list of one or two elements, the first of which is the name of -the filesystem to use for the file, and the second, if given, an -arbitrary string representing the filesystem-specific nature or type of -the location within that filesystem. If a filesystem only supports one -type of file, the second element may not be supplied. For example the -native files have a first element -.QW native , -and a second element which when given is a platform-specific type name -for the file's system (e.g. -.QW NTFS , -.QW FAT , -on Windows). A generic virtual file system might return -the list -.QW "vfs ftp" -to represent a file on a remote ftp site mounted as a -virtual filesystem through an extension called -.QW vfs . -If the file does not belong to any filesystem, an error is generated. -.TP -\fBfile tail \fIname\fR -. -Returns all of the characters in the last filesystem component of -\fIname\fR. Any trailing directory separator in \fIname\fR is ignored. -If \fIname\fR contains no separators then returns \fIname\fR. So, -\fBfile tail a/b\fR, \fBfile tail a/b/\fR and \fBfile tail b\fR all -return \fBb\fR. -.TP -\fBfile tempfile\fR ?\fInameVar\fR? ?\fItemplate\fR? -'\" TIP #210 -.VS 8.6 -Creates a temporary file and returns a read-write channel opened on that file. -If the \fInameVar\fR is given, it specifies a variable that the name of the -temporary file will be written into; if absent, Tcl will attempt to arrange -for the temporary file to be deleted once it is no longer required. If the -\fItemplate\fR is present, it specifies parts of the template of the filename -to use when creating it (such as the directory, base-name or extension) though -some platforms may ignore some or all of these parts and use a built-in -default instead. -.RS -.PP -Note that temporary files are \fIonly\fR ever created on the native -filesystem. As such, they can be relied upon to be used with operating-system -native APIs and external programs that require a filename. -.RE -.VE 8.6 -.TP -\fBfile type \fIname\fR -. -Returns a string giving the type of file \fIname\fR, which will be one of -\fBfile\fR, \fBdirectory\fR, \fBcharacterSpecial\fR, \fBblockSpecial\fR, -\fBfifo\fR, \fBlink\fR, or \fBsocket\fR. -.TP -\fBfile volumes\fR -. -Returns the absolute paths to the volumes mounted on the system, as a -proper Tcl list. Without any virtual filesystems mounted as root -volumes, on UNIX, the command will always return -.QW / , -since all filesystems are locally mounted. -On Windows, it will return a list of the available local drives -(e.g. -.QW "a:/ c:/" ). -If any virtual filesystem has mounted additional -volumes, they will be in the returned list. -.TP -\fBfile writable \fIname\fR -. -Returns \fB1\fR if file \fIname\fR is writable by the current user, -\fB0\fR otherwise. -.SH "PORTABILITY ISSUES" -.TP -\fBUnix\fR\0\0\0\0\0\0\0 -. -These commands always operate using the real user and group identifiers, -not the effective ones. -.TP -\fBWindows\fR\0\0\0\0 -. -The \fBfile owned\fR subcommand uses the user identifier (SID) of -the process token, not the thread token which may be impersonating -some other user. -.SH EXAMPLES -.PP -This procedure shows how to search for C files in a given directory -that have a correspondingly-named object file in the current -directory: -.PP -.CS -proc findMatchingCFiles {dir} { - set files {} - switch $::tcl_platform(platform) { - windows { - set ext .obj - } - unix { - set ext .o - } - } - foreach file [glob \-nocomplain \-directory $dir *.c] { - set objectFile [\fBfile tail\fR [\fBfile rootname\fR $file]]$ext - if {[\fBfile exists\fR $objectFile]} { - lappend files $file - } - } - return $files -} -.CE -.PP -Rename a file and leave a symbolic link pointing from the old location -to the new place: -.PP -.CS -set oldName foobar.txt -set newName foo/bar.txt -# Make sure that where we're going to move to exists... -if {![\fBfile isdirectory\fR [\fBfile dirname\fR $newName]]} { - \fBfile mkdir\fR [\fBfile dirname\fR $newName] -} -\fBfile rename\fR $oldName $newName -\fBfile link\fR \-symbolic $oldName $newName -.CE -.PP -On Windows, a file can be -.QW started -easily enough (equivalent to double-clicking on it in the Explorer -interface) but the name passed to the operating system must be in -native format: -.PP -.CS -exec {*}[auto_execok start] {} [\fBfile nativename\fR ~/example.txt] -.CE -.SH "SEE ALSO" -filename(n), open(n), close(n), eof(n), gets(n), tell(n), seek(n), -fblocked(n), flush(n) -.SH KEYWORDS -attributes, copy files, delete files, directory, file, move files, name, -rename files, stat, user -'\" Local Variables: -'\" mode: nroff -'\" fill-column: 78 -'\" End: diff --git a/doc/fileevent.n b/doc/fileevent.n deleted file mode 100644 index 2751040..0000000 --- a/doc/fileevent.n +++ /dev/null @@ -1,156 +0,0 @@ -'\" -'\" Copyright (c) 1994 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. -'\" Copyright (c) 2008 Pat Thoyts -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH fileevent n 7.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -fileevent \- Execute a script when a channel becomes readable or writable -.SH SYNOPSIS -\fBfileevent \fIchannelId \fBreadable \fR?\fIscript\fR? -.sp -\fBfileevent \fIchannelId \fBwritable \fR?\fIscript\fR? -.BE - -.SH DESCRIPTION -.PP -This command is used to create \fIfile event handlers\fR. 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 while waiting for the data to arrive. If an -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 -.QW "freeze up" . -With \fBfileevent\fR, the process can -tell when data is present and only invoke \fBgets\fR or \fBread\fR when -they will not 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 -are independent, and may be created and deleted separately. -However, there may be at most one \fBreadable\fR and one \fBwritable\fR -handler for a file at a given time in a given interpreter. -If \fBfileevent\fR is called when the specified handler already -exists in the invoking interpreter, the new script replaces the old one. -.PP -If the \fIscript\fR argument is not specified, \fBfileevent\fR -returns the current script for \fIchannelId\fR, or an empty string -if there is none. -If the \fIscript\fR argument is specified as an empty string -then the event handler is deleted, so that no script will be invoked. -A file event handler is also deleted automatically whenever -its channel is closed or its interpreter is deleted. -.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 \fBgets\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. -.PP -Event-driven I/O works best for channels that have been placed into -nonblocking mode with the \fBfconfigure\fR command. In blocking mode, -a \fBputs\fR command may block if you give it more data than the -underlying file or device can accept, and a \fBgets\fR or \fBread\fR -command will block if you attempt to read more data than is ready; a -readable underlying file or device may not even guarantee that a -blocking [read 1] will succeed (counter-examples being multi-byte -encodings, compression or encryption transforms ). In all such cases, -no events will be processed while the commands block. -.PP -In nonblocking mode \fBputs\fR, \fBread\fR, and \fBgets\fR never block. -See the documentation for the individual commands for information -on how they handle blocking and nonblocking channels. -.PP -Testing for the end of file condition should be done after any attempts -read the channel data. The eof flag is set once an attempt to read the -end of data has occurred and testing before this read will require an -additional event to be fired. -.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 -\fBfileevent\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. -.SH EXAMPLE -.PP -In this setup \fBGetData\fR will be called with the channel as an -argument whenever $chan becomes readable. The \fBread\fR call will -read whatever binary data is currently available without blocking. -Here the channel has the fileevent removed when an end of file -occurs to avoid being continually called (see above). Alternatively -the channel may be closed on this condition. -.PP -.CS -proc GetData {chan} { - set data [read $chan] - puts "[string length $data] $data" - if {[eof $chan]} { - fileevent $chan readable {} - } -} - -fconfigure $chan -blocking 0 -encoding binary -\fBfileevent\fR $chan readable [list GetData $chan] -.CE -.PP -The next example demonstrates use of \fBgets\fR to read line-oriented -data. -.PP -.CS -proc GetData {chan} { - if {[gets $chan line] >= 0} { - puts $line - } - if {[eof $chan]} { - close $chan - } -} - -fconfigure $chan -blocking 0 -buffering line -translation crlf -\fBfileevent\fR $chan readable [list GetData $chan] -.CE -.SH CREDITS -.PP -\fBfileevent\fR is based on the \fBaddinput\fR command created -by Mark Diekhans. -.SH "SEE ALSO" -fconfigure(n), gets(n), interp(n), puts(n), read(n), Tcl_StandardChannels(3) -.SH KEYWORDS -asynchronous I/O, blocking, channel, event handler, nonblocking, readable, -script, writable. diff --git a/doc/filename.n b/doc/filename.n deleted file mode 100644 index 87ba467..0000000 --- a/doc/filename.n +++ /dev/null @@ -1,178 +0,0 @@ -'\" -'\" 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. -'\" -.TH filename n 7.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -filename \- File name conventions supported by Tcl commands -.BE -.SH INTRODUCTION -.PP -All Tcl commands and C procedures that take file names as arguments -expect the file names to be in one of three forms, depending on the -current platform. On each platform, Tcl supports file names in the -standard forms(s) for that platform. In addition, on all platforms, -Tcl supports a Unix-like syntax intended to provide a convenient way -of constructing simple file names. However, scripts that are intended -to be portable should not assume a particular form for file names. -Instead, portable scripts must use the \fBfile split\fR and \fBfile -join\fR commands to manipulate file names (see the \fBfile\fR manual -entry for more details). -.SH "PATH TYPES" -.PP -File names are grouped into three general types based on the starting point -for the path used to specify the file: absolute, relative, and -volume-relative. Absolute names are completely qualified, giving a path to -the file relative to a particular volume and the root directory on that -volume. Relative names are unqualified, giving a path to the file relative -to the current working directory. Volume-relative names are partially -qualified, either giving the path relative to the root directory on the -current volume, or relative to the current directory of the specified -volume. The \fBfile pathtype\fR command can be used to determine the -type of a given path. -.SH "PATH SYNTAX" -.PP -The rules for native names depend on the value reported in the Tcl -\fBplatform\fR element of the \fBtcl_platform\fR array: -.TP 10 -\fBUnix\fR -On Unix and Apple MacOS X platforms, Tcl uses path names where the -components are separated by slashes. Path names may be relative or -absolute, and file names may contain any character other than slash. -The file names \fB\&.\fR and \fB\&..\fR are special and refer to the -current directory and the parent of the current directory respectively. -Multiple adjacent slash characters are interpreted as a single -separator. Any number of trailing slash characters at the end of a -path are simply ignored, so the paths \fBfoo\fR, \fBfoo/\fR and -\fBfoo//\fR are all identical, and in particular \fBfoo/\fR does not -necessarily mean a directory is being referred. -.RS -.PP -The following examples illustrate various forms of path -names: -.TP 15 -\fB/\fR -Absolute path to the root directory. -.TP 15 -\fB/etc/passwd\fR -Absolute path to the file named \fBpasswd\fR in the directory -\fBetc\fR in the root directory. -.TP 15 -\fB\&.\fR -Relative path to the current directory. -.TP 15 -\fBfoo\fR -Relative path to the file \fBfoo\fR in the current directory. -.TP 15 -\fBfoo/bar\fR -Relative path to the file \fBbar\fR in the directory \fBfoo\fR in the -current directory. -.TP 15 -\fB\&../foo\fR -Relative path to the file \fBfoo\fR in the directory above the current -directory. -.RE -.TP -\fBWindows\fR -On Microsoft Windows platforms, Tcl supports both drive-relative and UNC -style names. Both \fB/\fR and \fB\e\fR may be used as directory separators -in either type of name. Drive-relative names consist of an optional drive -specifier followed by an absolute or relative path. UNC paths follow the -general form \fB\e\eservername\esharename\epath\efile\fR, but must at -the very least contain the server and share components, i.e. -\fB\e\eservername\esharename\fR. In both forms, -the file names \fB.\fR and \fB..\fR are special and refer to the current -directory and the parent of the current directory respectively. The -following examples illustrate various forms of path names: -.RS -.TP 15 -\fB\&\e\eHost\eshare/file\fR -Absolute UNC path to a file called \fBfile\fR in the root directory of -the export point \fBshare\fR on the host \fBHost\fR. Note that -repeated use of \fBfile dirname\fR on this path will give -\fB//Host/share\fR, and will never give just \fB//Host\fR. -.TP 15 -\fBc:foo\fR -Volume-relative path to a file \fBfoo\fR in the current directory on drive -\fBc\fR. -.TP 15 -\fBc:/foo\fR -Absolute path to a file \fBfoo\fR in the root directory of drive -\fBc\fR. -.TP 15 -\fBfoo\ebar\fR -Relative path to a file \fBbar\fR in the \fBfoo\fR directory in the current -directory on the current volume. -.TP 15 -\fB\&\efoo\fR -Volume-relative path to a file \fBfoo\fR in the root directory of the current -volume. -.TP 15 -\fB\&\e\efoo\fR -Volume-relative path to a file \fBfoo\fR in the root directory of the current -volume. This is not a valid UNC path, so the assumption is that the -extra backslashes are superfluous. -.RE -.SH "TILDE SUBSTITUTION" -.PP -In addition to the file name rules described above, Tcl also supports -\fIcsh\fR-style tilde substitution. If a file name starts with a tilde, -then the file name will be interpreted as if the first element is -replaced with the location of the home directory for the given user. If -the tilde is followed immediately by a separator, then the \fB$HOME\fR -environment variable is substituted. Otherwise the characters between -the tilde and the next separator are taken as a user name, which is used -to retrieve the user's home directory for substitution. This works on -Unix, MacOS X and Windows (except very old releases). -.PP -Old Windows platforms do not support tilde substitution when a user name -follows the tilde. On these platforms, attempts to use a tilde followed -by a user name will generate an error that the user does not exist when -Tcl attempts to interpret that part of the path or otherwise access the -file. The behaviour of these paths when not trying to interpret them is -the same as on Unix. File names that have a tilde without a user name -will be correctly substituted using the \fB$HOME\fR environment -variable, just like for Unix. -.SH "PORTABILITY ISSUES" -.PP -Not all file systems are case sensitive, so scripts should avoid code -that depends on the case of characters in a file name. In addition, -the character sets allowed on different devices may differ, so scripts -should choose file names that do not contain special characters like: -\fB<>:?"/\e|\fR. -'\""\" reset emacs highlighting -The safest approach is to use names consisting of -alphanumeric characters only. Care should be taken with filenames -which contain spaces (common on Windows systems) and -filenames where the backslash is the directory separator (Windows -native path names). Also Windows 3.1 only supports file -names with a root of no more than 8 characters and an extension of no -more than 3 characters. -.PP -On Windows platforms there are file and path length restrictions. -Complete paths or filenames longer than about 260 characters will lead -to errors in most file operations. -.PP -Another Windows peculiarity is that any number of trailing dots -.QW . -in filenames are totally ignored, so, for example, attempts to create a -file or directory with a name -.QW foo. -will result in the creation of a file/directory with name -.QW foo . -This fact is reflected in the results of \fBfile normalize\fR. -Furthermore, a file name consisting only of dots -.QW ......... -or dots with trailing characters -.QW .....abc -is illegal. -.SH "SEE ALSO" -file(n), glob(n) -.SH KEYWORDS -current directory, absolute file name, relative file name, -volume-relative file name, portability diff --git a/doc/flush.n b/doc/flush.n deleted file mode 100644 index 6b98ab7..0000000 --- a/doc/flush.n +++ /dev/null @@ -1,45 +0,0 @@ -'\" -'\" 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. -'\" -.TH flush n 7.5 Tcl "Tcl Built-In Commands" -.so man.macros -.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 -.PP -Prompt for the user to type some information in on the console: -.PP -.CS -puts -nonewline "Please type your name: " -\fBflush\fR stdout -gets stdin name -puts "Hello there, $name!" -.CE -.SH "SEE ALSO" -file(n), open(n), socket(n), Tcl_StandardChannels(3) -.SH KEYWORDS -blocking, buffer, channel, flush, nonblocking, output diff --git a/doc/for.n b/doc/for.n deleted file mode 100644 index 9a3235f..0000000 --- a/doc/for.n +++ /dev/null @@ -1,87 +0,0 @@ -'\" -'\" 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. -'\" -.TH for n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -for \- 'For' loop -.SH SYNOPSIS -\fBfor \fIstart test next body\fR -.BE - -.SH DESCRIPTION -.PP -\fBFor\fR is a looping command, similar in structure to the C -\fBfor\fR statement. The \fIstart\fR, \fInext\fR, and -\fIbody\fR arguments must be Tcl command strings, and \fItest\fR -is an expression string. -The \fBfor\fR command first invokes the Tcl interpreter to -execute \fIstart\fR. Then it repeatedly evaluates \fItest\fR as -an expression; if the result is non-zero it invokes the Tcl -interpreter on \fIbody\fR, then invokes the Tcl interpreter on \fInext\fR, -then repeats the loop. The command terminates when \fItest\fR evaluates -to 0. If a \fBcontinue\fR command is invoked within \fIbody\fR then -any remaining commands in the current execution of \fIbody\fR are skipped; -processing continues by invoking the Tcl interpreter on \fInext\fR, then -evaluating \fItest\fR, and so on. If a \fBbreak\fR command is invoked -within \fIbody\fR -or \fInext\fR, -then the \fBfor\fR command will -return immediately. -The operation of \fBbreak\fR and \fBcontinue\fR are similar to the -corresponding statements in C. -\fBFor\fR returns an empty string. -.PP -Note: \fItest\fR should almost always be enclosed in braces. If not, -variable substitutions will be made before the \fBfor\fR -command starts executing, which means that variable changes -made by the loop body will not be considered in the expression. -This is likely to result in an infinite loop. If \fItest\fR is -enclosed in braces, variable substitutions are delayed until the -expression is evaluated (before -each loop iteration), so changes in the variables will be visible. -See below for an example: -.SH EXAMPLES -.PP -Print a line for each of the integers from 0 to 9: -.PP -.CS -\fBfor\fR {set x 0} {$x<10} {incr x} { - puts "x is $x" -} -.CE -.PP -Either loop infinitely or not at all because the expression being -evaluated is actually the constant, or even generate an error! The -actual behaviour will depend on whether the variable \fIx\fR exists -before the \fBfor\fR command is run and whether its value is a value -that is less than or greater than/equal to ten, and this is because -the expression will be substituted before the \fBfor\fR command is -executed. -.PP -.CS -\fBfor\fR {set x 0} $x<10 {incr x} { - puts "x is $x" -} -.CE -.PP -Print out the powers of two from 1 to 1024: -.PP -.CS -\fBfor\fR {set x 1} {$x<=1024} {set x [expr {$x * 2}]} { - puts "x is $x" -} -.CE -.SH "SEE ALSO" -break(n), continue(n), foreach(n), while(n) -.SH KEYWORDS -boolean, for, iteration, loop -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/foreach.n b/doc/foreach.n deleted file mode 100644 index 925ec1f..0000000 --- a/doc/foreach.n +++ /dev/null @@ -1,104 +0,0 @@ -'\" -'\" 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. -'\" -.TH foreach n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -foreach \- Iterate over all elements in one or more lists -.SH SYNOPSIS -\fBforeach \fIvarname list body\fR -.br -\fBforeach \fIvarlist1 list1\fR ?\fIvarlist2 list2 ...\fR? \fIbody\fR -.BE - -.SH DESCRIPTION -.PP -The \fBforeach\fR command implements a loop where the loop -variable(s) take on values from one or more lists. -In the simplest case there is one loop variable, \fIvarname\fR, -and one list, \fIlist\fR, that is a list of values to assign to \fIvarname\fR. -The \fIbody\fR argument is a Tcl script. -For each element of \fIlist\fR (in order -from first to last), \fBforeach\fR assigns the contents of the -element to \fIvarname\fR as if the \fBlindex\fR command had been used -to extract the element, then calls the Tcl interpreter to execute -\fIbody\fR. -.PP -In the general case there can be more than one value list -(e.g., \fIlist1\fR and \fIlist2\fR), -and each value list can be associated with a list of loop variables -(e.g., \fIvarlist1\fR and \fIvarlist2\fR). -During each iteration of the loop -the variables of each \fIvarlist\fR are assigned -consecutive values from the corresponding \fIlist\fR. -Values in each \fIlist\fR are used in order from first to last, -and each value is used exactly once. -The total number of loop iterations is large enough to use -up all the values from all the value lists. -If a value list does not contain enough -elements for each of its loop variables in each iteration, -empty values are used for the missing elements. -.PP -The \fBbreak\fR and \fBcontinue\fR statements may be -invoked inside \fIbody\fR, with the same effect as in the \fBfor\fR -command. \fBForeach\fR returns an empty string. -.SH EXAMPLES -.PP -This loop prints every value in a list together with the square and -cube of the value: -.PP -.CS -'\" Maintainers: notice the tab hacking below! -.ta 3i -set values {1 3 5 7 2 4 6 8} ;# Odd numbers first, for fun! -puts "Value\etSquare\etCube" ;# Neat-looking header -\fBforeach\fR x $values { ;# Now loop and print... - puts " $x\et [expr {$x**2}]\et [expr {$x**3}]" -} -.CE -.PP -The following loop uses i and j as loop variables to iterate over -pairs of elements of a single list. -.PP -.CS -set x {} -\fBforeach\fR {i j} {a b c d e f} { - lappend x $j $i -} -# The value of x is "b a d c f e" -# There are 3 iterations of the loop. -.CE -.PP -The next loop uses i and j to iterate over two lists in parallel. -.PP -.CS -set x {} -\fBforeach\fR i {a b c} j {d e f g} { - lappend x $i $j -} -# The value of x is "a d b e c f {} g" -# There are 4 iterations of the loop. -.CE -.PP -The two forms are combined in the following example. -.PP -.CS -set x {} -\fBforeach\fR i {a b c} {j k} {d e f g} { - lappend x $i $j $k -} -# The value of x is "a d e b f g c {} {}" -# There are 3 iterations of the loop. -.CE - -.SH "SEE ALSO" -for(n), while(n), break(n), continue(n) - -.SH KEYWORDS -foreach, iteration, list, loop diff --git a/doc/format.n b/doc/format.n deleted file mode 100644 index 4eb566d..0000000 --- a/doc/format.n +++ /dev/null @@ -1,287 +0,0 @@ -'\" -'\" 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. -'\" -.TH format n 8.1 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -format \- Format a string in the style of sprintf -.SH SYNOPSIS -\fBformat \fIformatString \fR?\fIarg arg ...\fR? -.BE - -.SH INTRODUCTION -.PP -This command generates a formatted string in a fashion similar to the -ANSI C \fBsprintf\fR procedure. -\fIFormatString\fR indicates how to format the result, using -\fB%\fR conversion specifiers as in \fBsprintf\fR, and the additional -arguments, if any, provide values to be substituted into the result. -The return value from \fBformat\fR is the formatted string. -.SH "DETAILS ON FORMATTING" -.PP -The command operates by scanning \fIformatString\fR from left to right. -Each character from the format string is appended to the result -string unless it is a percent sign. -If the character is a \fB%\fR then it is not copied to the result string. -Instead, the characters following the \fB%\fR character are treated as -a conversion specifier. -The conversion specifier controls the conversion of the next successive -\fIarg\fR to a particular format and the result is appended to -the result string in place of the conversion specifier. -If there are multiple conversion specifiers in the format string, -then each one controls the conversion of one additional \fIarg\fR. -The \fBformat\fR command must be given enough \fIarg\fRs to meet the needs -of all of the conversion specifiers in \fIformatString\fR. -.PP -Each conversion specifier may contain up to six different parts: -an XPG3 position specifier, -a set of flags, a minimum field width, a precision, a size modifier, -and a conversion character. -Any of these fields may be omitted except for the conversion character. -The fields that are present must appear in the order given above. -The paragraphs below discuss each of these fields in turn. -.SS "OPTIONAL POSITIONAL SPECIFIER" -.PP -If the \fB%\fR is followed by a decimal number and a \fB$\fR, as in -.QW \fB%2$d\fR , -then the value to convert is not taken from the next sequential argument. -Instead, it is taken from the argument indicated by the number, -where 1 corresponds to the first \fIarg\fR. -If the conversion specifier requires multiple arguments because -of \fB*\fR characters in the specifier then -successive arguments are used, starting with the argument -given by the number. -This follows the XPG3 conventions for positional specifiers. -If there are any positional specifiers in \fIformatString\fR -then all of the specifiers must be positional. -.SS "OPTIONAL FLAGS" -.PP -The second portion of a conversion specifier may contain any of the -following flag characters, in any order: -.TP 10 -\fB\-\fR -Specifies that the converted argument should be left-justified -in its field (numbers are normally right-justified with leading -spaces if needed). -.TP 10 -\fB+\fR -Specifies that a number should always be printed with a sign, -even if positive. -.TP 10 -\fIspace\fR -Specifies that a space should be added to the beginning of the -number if the first character is not a sign. -.TP 10 -\fB0\fR -Specifies that the number should be padded on the left with -zeroes instead of spaces. -.TP 10 -\fB#\fR -Requests an alternate output form. For \fBo\fR and \fBO\fR -conversions it guarantees that the first digit is always \fB0\fR. -For \fBx\fR or \fBX\fR conversions, \fB0x\fR or \fB0X\fR (respectively) -will be added to the beginning of the result unless it is zero. -For \fBb\fR conversions, \fB0b\fR -will be added to the beginning of the result unless it is zero. -For \fBd\fR conversions, \fB0d\fR will be added to the beginning -of the result unless it is zero. -For all floating-point conversions (\fBe\fR, \fBE\fR, \fBf\fR, -\fBg\fR, and \fBG\fR) it guarantees that the result always -has a decimal point. -For \fBg\fR and \fBG\fR conversions it specifies that -trailing zeroes should not be removed. -.SS "OPTIONAL FIELD WIDTH" -.PP -The third portion of a conversion specifier is a decimal number giving a -minimum field width for this conversion. -It is typically used to make columns line up in tabular printouts. -If the converted argument contains fewer characters than the -minimum field width then it will be padded so that it is as wide -as the minimum field width. -Padding normally occurs by adding extra spaces on the left of the -converted argument, but the \fB0\fR and \fB\-\fR flags -may be used to specify padding with zeroes on the left or with -spaces on the right, respectively. -If the minimum field width is specified as \fB*\fR rather than -a number, then the next argument to the \fBformat\fR command -determines the minimum field width; it must be an integer value. -.SS "OPTIONAL PRECISION/BOUND" -.PP -The fourth portion of a conversion specifier is a precision, -which consists of a period followed by a number. -The number is used in different ways for different conversions. -For \fBe\fR, \fBE\fR, and \fBf\fR conversions it specifies the number -of digits to appear to the right of the decimal point. -For \fBg\fR and \fBG\fR conversions it specifies the total number -of digits to appear, including those on both sides of the decimal -point (however, trailing zeroes after the decimal point will still -be omitted unless the \fB#\fR flag has been specified). -For integer conversions, it specifies a minimum number of digits -to print (leading zeroes will be added if necessary). -For \fBs\fR conversions it specifies the maximum number of characters to be -printed; if the string is longer than this then the trailing characters will be dropped. -If the precision is specified with \fB*\fR rather than a number -then the next argument to the \fBformat\fR command determines the precision; -it must be a numeric string. -.SS "OPTIONAL SIZE MODIFIER" -.PP -The fifth part of a conversion specifier is a size modifier, -which must be \fBll\fR, \fBh\fR, or \fBl\fR. -If it is \fBll\fR it specifies that an integer value is taken -without truncation for conversion to a formatted substring. -If it is \fBh\fR it specifies that an integer value is -truncated to a 16-bit range before converting. This option is rarely useful. -If it is \fBl\fR it specifies that the integer value is -truncated to the same range as that produced by the \fBwide()\fR -function of the \fBexpr\fR command (at least a 64-bit range). -If neither \fBh\fR nor \fBl\fR are present, the integer value is -truncated to the same range as that produced by the \fBint()\fR -function of the \fBexpr\fR command (at least a 32-bit range, but -determined by the value of the \fBwordSize\fR element of the -\fBtcl_platform\fR array). -.SS "MANDATORY CONVERSION TYPE" -.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. -.TP 10 -\fBu\fR -Convert integer to unsigned decimal string. -.TP 10 -\fBi\fR -Convert integer to signed decimal string (equivalent to \fBd\fR). -.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 -.QW 0123456789abcdef -for \fBx\fR and -.QW 0123456789ABCDEF -for \fBX\fR). -.TP 10 -\fBb\fR -Convert integer to binary string, using digits 0 and 1. -.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 number to signed decimal string of -the form \fIxx.yyy\fR, where the number of \fIy\fR's is determined by -the precision (default: 6). -If the precision is 0 then no decimal point is output. -.TP 10 -\fBe\fR or \fBE\fR -Convert number to scientific notation in the -form \fIx.yyy\fBe\(+-\fIzz\fR, where the number of \fIy\fR's is determined -by the precision (default: 6). -If the precision is 0 then no decimal point is output. -If the \fBE\fR form is used then \fBE\fR is -printed instead of \fBe\fR. -.TP 10 -\fBg\fR or \fBG\fR -If the exponent is less than \-4 or greater than or equal to the -precision, then convert number as for \fB%e\fR or -\fB%E\fR. -Otherwise convert as for \fB%f\fR. -Trailing zeroes and a trailing decimal point are omitted. -.TP 10 -\fB%\fR -No conversion: just insert \fB%\fR. -.SH "DIFFERENCES FROM ANSI SPRINTF" -.PP -The behavior of the format command is the same as the -ANSI C \fBsprintf\fR procedure except for the following -differences: -.IP [1] -Tcl guarantees that it will be working with UNICODE characters. -.IP [2] -\fB%p\fR and \fB%n\fR specifiers are not supported. -.IP [3] -For \fB%c\fR conversions the argument must be an integer value, -which will then be converted to the corresponding character value. -.IP [4] -The size modifiers are ignored when formatting floating-point values. -The \fBll\fR modifier has no \fBsprintf\fR counterpart. -The \fBb\fR specifier has no \fBsprintf\fR counterpart. -.SH EXAMPLES -.PP -Convert the numeric value of a UNICODE character to the character -itself: -.PP -.CS -set value 120 -set char [\fBformat\fR %c $value] -.CE -.PP -Convert the output of \fBtime\fR into seconds to an accuracy of -hundredths of a second: -.PP -.CS -set us [lindex [time $someTclCode] 0] -puts [\fBformat\fR "%.2f seconds to execute" [expr {$us / 1e6}]] -.CE -.PP -Create a packed X11 literal color specification: -.PP -.CS -# Each color-component should be in range (0..255) -set color [\fBformat\fR "#%02x%02x%02x" $r $g $b] -.CE -.PP -Use XPG3 format codes to allow reordering of fields (a technique that -is often used in localized message catalogs; see \fBmsgcat\fR) without -reordering the data values passed to \fBformat\fR: -.PP -.CS -set fmt1 "Today, %d shares in %s were bought at $%.2f each" -puts [\fBformat\fR $fmt1 123 "Global BigCorp" 19.37] - -set fmt2 "Bought %2\e$s equity ($%3$.2f x %1\e$d) today" -puts [\fBformat\fR $fmt2 123 "Global BigCorp" 19.37] -.CE -.PP -Print a small table of powers of three: -.PP -.CS -# Set up the column widths -set w1 5 -set w2 10 - -# Make a nice header (with separator) for the table first -set sep +-[string repeat - $w1]-+-[string repeat - $w2]-+ -puts $sep -puts [\fBformat\fR "| %-*s | %-*s |" $w1 "Index" $w2 "Power"] -puts $sep - -# Print the contents of the table -set p 1 -for {set i 0} {$i<=20} {incr i} { - puts [\fBformat\fR "| %*d | %*ld |" $w1 $i $w2 $p] - set p [expr {wide($p) * 3}] -} - -# Finish off by printing the separator again -puts $sep -.CE -.SH "SEE ALSO" -scan(n), sprintf(3), string(n) -.SH KEYWORDS -conversion specifier, format, sprintf, string, substitution -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/gets.n b/doc/gets.n deleted file mode 100644 index 57532c0..0000000 --- a/doc/gets.n +++ /dev/null @@ -1,71 +0,0 @@ -'\" -'\" 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. -'\" -.TH gets n 7.5 Tcl "Tcl Built-In Commands" -.so man.macros -.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 -If end of file occurs while scanning for an end of -line, the command returns whatever input is available up to the end of file. -If \fIchannelId\fR is in non-blocking mode and there is not a full -line of input available, the command returns an empty string and -does not consume any input. -If \fIvarName\fR is specified and an empty string is returned in -\fIvarName\fR because of end-of-file or because of insufficient -data in non-blocking mode, then the return count is -1. -Note that if \fIvarName\fR is not specified then the end-of-file -and no-full-line-available cases can -produce the same results as if there were an input line consisting -only of the end-of-line character(s). -The \fBeof\fR and \fBfblocked\fR commands can be used to distinguish -these three cases. -.SH "EXAMPLE" -This example reads a file one line at a time and prints it out with -the current line number attached to the start of each line. -.PP -.CS -set chan [open "some.file.txt"] -set lineNumber 0 -while {[\fBgets\fR $chan line] >= 0} { - puts "[incr lineNumber]: $line" -} -close $chan -.CE - -.SH "SEE ALSO" -file(n), eof(n), fblocked(n), Tcl_StandardChannels(3) - -.SH KEYWORDS -blocking, channel, end of file, end of line, line, non-blocking, read -'\" Local Variables: -'\" mode: nroff -'\" fill-column: 78 -'\" End: diff --git a/doc/glob.n b/doc/glob.n deleted file mode 100644 index a2cbce2..0000000 --- a/doc/glob.n +++ /dev/null @@ -1,267 +0,0 @@ -'\" -'\" 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. -.TH glob n 8.3 Tcl "Tcl Built-In Commands" -.so man.macros -.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? -.BE -.SH DESCRIPTION -.PP -This command performs file name -.QW globbing -in a fashion similar to -the csh shell or bash 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. -.SS OPTIONS -.PP -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 -\fIdirectory\fR. This allows searching of directories whose name -contains glob-sensitive characters without the need to quote such -characters explicitly. This option may not be used in conjunction with -\fB\-path\fR, which is used to allow searching for complete file paths -whose names may contain glob-sensitive characters. -.TP -\fB\-join\fR -. -The remaining pattern arguments, after option processing, are treated -as a single pattern obtained by joining the arguments with directory -separators. -.TP -\fB\-nocomplain\fR -. -Allows an empty list to be returned without error; without this -switch an error is returned if the result list would be empty. -.TP -\fB\-path\fR \fIpathPrefix\fR -. -Search for files with the given \fIpathPrefix\fR where the rest of the name -matches the given patterns. This allows searching for files with names -similar to a given file (as opposed to a directory) even when the names -contain glob-sensitive -characters. This option may not be used in conjunction with -\fB\-directory\fR. For example, to find all files with the same root name -as $path, but differing extensions, you should use -.QW "\fBglob \-path [file rootname $path] .*\fR" -which will work even if \fB$path\fR contains -numerous glob-sensitive characters. -.TP -\fB\-tails\fR -. -Only return the part of each file found which follows the last directory -named in any \fB\-directory\fR or \fB\-path\fR path specification. -Thus -.QW "\fBglob \-tails \-directory $dir *\fR" -is equivalent to -.QW "\fBset pwd [pwd]; cd $dir; glob *; cd $pwd\fR" . -For \fB\-path\fR specifications, the returned names will include the last -path segment, so -.QW "\fBglob \-tails \-path [file rootname ~/foo.tex] .*\fR" -will return paths like \fBfoo.aux foo.bib foo.tex\fR etc. -.TP -\fB\-types\fR \fItypeList\fR -. -Only list files or directories which match \fItypeList\fR, where the items -in the list have two forms. The first form is like the \-type option of -the Unix find command: -\fIb\fR (block special file), -\fIc\fR (character special file), -\fId\fR (directory), -\fIf\fR (plain file), -\fIl\fR (symbolic link), -\fIp\fR (named pipe), -or \fIs\fR (socket), where multiple types may be specified in the list. -\fBGlob\fR will return all files which match at least one of the types given. -Note that symbolic links will be returned both if \fB\-types l\fR is given, -or if the target of a link matches the requested type. So, a link to -a directory will be returned if \fB\-types d\fR was specified. -.RS -.PP -The second form specifies types where all the types given must match. -These are \fIr\fR, \fIw\fR, \fIx\fR as file permissions, and -\fIreadonly\fR, \fIhidden\fR as special permission cases. On the -Macintosh, MacOS types and creators are also supported, where any item -which is four characters long is assumed to be a MacOS type -(e.g. \fBTEXT\fR). Items which are of the form \fI{macintosh type XXXX}\fR -or \fI{macintosh creator XXXX}\fR will match types or creators -respectively. Unrecognized types, or specifications of multiple MacOS -types/creators will signal an error. -.PP -The two forms may be mixed, so \fB\-types {d f r w}\fR will find all -regular files OR directories that have both read AND write permissions. -The following are equivalent: -.PP -.CS -\fBglob \-type d *\fR -\fBglob */\fR -.CE -.PP -except that the first case doesn't return the trailing -.QW / -and is more platform independent. -.RE -.TP -\fB\-\|\-\fR -. -Marks the end of switches. The argument following this one will -be treated as a \fIpattern\fR even if it starts with a \fB\-\fR. -.SS "GLOBBING PATTERNS" -.PP -The \fIpattern\fR arguments may contain any of the following -special characters, which are a superset of those supported by -\fBstring match\fR: -.TP 10 -\fB?\fR -. -Matches any single character. -.TP 10 -\fB*\fR -. -Matches any sequence of zero or more characters. -.TP 10 -\fB[\fIchars\fB]\fR -. -Matches any single character in \fIchars\fR. If \fIchars\fR -contains a sequence of the form \fIa\fB\-\fIb\fR then any -character between \fIa\fR and \fIb\fR (inclusive) will match. -.TP 10 -\fB\e\fIx\fR -. -Matches the character \fIx\fR. -.TP 10 -\fB{\fIa\fB,\fIb\fB,\fI...\fR} -. -Matches any of the sub-patterns \fIa\fR, \fIb\fR, etc. -.PP -On Unix, as with csh, a -.QW . \| -at the beginning of a file's name or just after a -.QW / -must be matched explicitly or with a {} construct, unless the -\fB\-types hidden\fR flag is given (since -.QW . \| -at the beginning of a file's name indicates that it is hidden). On -other platforms, files beginning with a -.QW . \| -are handled no differently to any others, except the special directories -.QW . \| -and -.QW .. \| -which must be matched explicitly (this is to avoid a recursive pattern like -.QW "glob \-join * * * *" -from recursing up the directory hierarchy as well as down). In addition, all -.QW / -characters must be matched explicitly. -.LP -If the first character in a \fIpattern\fR is -.QW ~ -then it refers to the home directory for the user whose name follows the -.QW ~ . -If the -.QW ~ -is followed immediately by -.QW / -then the value of the HOME environment variable is used. -.PP -The \fBglob\fR command differs from csh globbing in two ways. -First, it does not sort its result list (use the \fBlsort\fR -command if you want the list sorted). -Second, \fBglob\fR only returns the names of files that actually -exist; in csh no check for existence is made unless a pattern -contains a ?, *, or [] construct. -.LP -When the \fBglob\fR command returns relative paths whose filenames -start with a tilde -.QW ~ -(for example through \fBglob *\fR or \fBglob \-tails\fR, the returned -list will not quote the tilde with -.QW ./ . -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 "WINDOWS PORTABILITY ISSUES" -.PP -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 -.QW \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 -the local computer. -.PP -Since the backslash character has a special meaning to the glob -command, glob patterns containing Windows style path separators need -special care. The pattern -.QW \fIC:\e\efoo\e\e*\fR -is interpreted as -.QW \fIC:\efoo\e*\fR -where -.QW \fI\ef\fR -will match the single character -.QW \fIf\fR -and -.QW \fI\e*\fR -will match the single character -.QW \fI*\fR -and will not be -interpreted as a wildcard character. One solution to this problem is -to use the Unix style forward slash as a path separator. Windows style -paths can be converted to Unix style paths with the command -.QW "\fBfile join\fR \fB$path\fR" -or -.QW "\fBfile normalize\fR \fB$path\fR" . -.SH EXAMPLES -.PP -Find all the Tcl files in the current directory: -.PP -.CS -\fBglob\fR *.tcl -.CE -.PP -Find all the Tcl files in the user's home directory, irrespective of -what the current directory is: -.PP -.CS -\fBglob\fR \-directory ~ *.tcl -.CE -.PP -Find all subdirectories of the current directory: -.PP -.CS -\fBglob\fR \-type d * -.CE -.PP -Find all files whose name contains an -.QW a , -a -.QW b -or the sequence -.QW cde : -.PP -.CS -\fBglob\fR \-type f *{a,b,cde}* -.CE -.SH "SEE ALSO" -file(n) -.SH KEYWORDS -exist, file, glob, pattern -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/global.n b/doc/global.n deleted file mode 100644 index 9848817..0000000 --- a/doc/global.n +++ /dev/null @@ -1,58 +0,0 @@ -'\" -'\" 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. -'\" -.TH global n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -global \- Access global variables -.SH SYNOPSIS -\fBglobal \fR?\fIvarname ...\fR? -.BE -.SH DESCRIPTION -.PP -This command has no effect unless executed in the context of a proc body. -If the \fBglobal\fR command is executed in the context of a proc body, it -creates local variables linked to the corresponding global variables (though -these linked variables, like those created by \fBupvar\fR, are not included -in the list returned by \fBinfo locals\fR). -.PP -If \fIvarname\fR contains namespace qualifiers, the local variable's name is -the unqualified name of the global variable, as determined by the -\fBnamespace tail\fR command. -.PP -\fIvarname\fR is always treated as the name of a variable, not an -array element. An error is returned if the name looks like an array element, -such as \fBa(b)\fR. -.SH EXAMPLES -.PP -This procedure sets the namespace variable \fI::a::x\fR -.PP -.CS -proc reset {} { - \fBglobal\fR a::x - set x 0 -} -.CE -.PP -This procedure accumulates the strings passed to it in a global -buffer, separated by newlines. It is useful for situations when you -want to build a message piece-by-piece (as if with \fBputs\fR) but -send that full message in a single piece (e.g. over a connection -opened with \fBsocket\fR or as part of a counted HTTP response). -.PP -.CS -proc accum {string} { - \fBglobal\fR accumulator - append accumulator $string \en -} -.CE -.SH "SEE ALSO" -namespace(n), upvar(n), variable(n) -.SH KEYWORDS -global, namespace, procedure, variable diff --git a/doc/history.n b/doc/history.n deleted file mode 100644 index 0391948..0000000 --- a/doc/history.n +++ /dev/null @@ -1,102 +0,0 @@ -'\" -'\" 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. -'\" -.TH history n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -history \- Manipulate the history list -.SH SYNOPSIS -\fBhistory \fR?\fIoption\fR? ?\fIarg arg ...\fR? -.BE -.SH DESCRIPTION -.PP -The \fBhistory\fR command performs one of several operations related to -recently-executed commands recorded in a history list. Each of -these recorded commands is referred to as an -.QW event . -When specifying an event to the \fBhistory\fR command, the following -forms may be used: -.IP [1] -A number: if positive, it refers to the event with -that number (all events are numbered starting at 1). If the number -is negative, it selects an event relative to the current event -(\fB\-1\fR refers to the previous event, \fB\-2\fR to the one before that, and -so on). Event \fB0\fR refers to the current event. -.IP [2] -A string: selects the most recent event that matches the string. -An event is considered to match the string either if the string is -the same as the first characters of the event, or if the string -matches the event in the sense of the \fBstring match\fR command. -.PP -The \fBhistory\fR command can take any of the following forms: -.TP -\fBhistory\fR -Same -as \fBhistory info\fR, described below. -.TP -\fBhistory add\fI command \fR?\fBexec\fR? -Adds the \fIcommand\fR argument to the history list as a new event. If -\fBexec\fR is specified (or abbreviated) then the command is also -executed and its result is returned. If \fBexec\fR is not specified -then an empty string is returned as result. -.TP -\fBhistory change\fI newValue\fR ?\fIevent\fR? -Replaces the value recorded for an event with \fInewValue\fR. \fIEvent\fR -specifies the event to replace, and -defaults to the \fIcurrent\fR event (not event \fB\-1\fR). This command -is intended for use in commands that implement new forms of history -substitution and wish to replace the current event (which invokes the -substitution) with the command created through substitution. The return -value is an empty string. -.TP -\fBhistory clear\fR -Erase the history list. The current keep limit is retained. -The history event numbers are reset. -.TP -\fBhistory event\fR ?\fIevent\fR? -Returns the value of the event given by \fIevent\fR. \fIEvent\fR -defaults to \fB\-1\fR. -.TP -\fBhistory info \fR?\fIcount\fR? -Returns a formatted string (intended for humans to read) giving -the event number and contents for each of the events in the history -list except the current event. If \fIcount\fR is specified -then only the most recent \fIcount\fR events are returned. -.TP -\fBhistory keep \fR?\fIcount\fR? -This command may be used to change the size of the history list to -\fIcount\fR events. Initially, 20 events are retained in the history -list. If \fIcount\fR is not specified, the current keep limit is returned. -.TP -\fBhistory nextid\fR -Returns the number of the next event to be recorded -in the history list. It is useful for things like printing the -event number in command-line prompts. -.TP -\fBhistory redo \fR?\fIevent\fR? -Re-executes the command indicated by \fIevent\fR and returns its result. -\fIEvent\fR defaults to \fB\-1\fR. This command results in history -revision: see below for details. -.SH "HISTORY REVISION" -.PP -Pre-8.0 Tcl had a complex history revision mechanism. -The current mechanism is more limited, and the old -history operations \fBsubstitute\fR and \fBwords\fR have been removed. -(As a consolation, the \fBclear\fR operation was added.) -.PP -The history option \fBredo\fR results in much simpler -.QW "history revision" . -When this option is invoked then the most recent event -is modified to eliminate the history command and replace it with -the result of the history command. -If you want to redo an event without modifying history, then use -the \fBevent\fR operation to retrieve some event, -and the \fBadd\fR operation to add it to history and execute it. -.SH KEYWORDS -event, history, record diff --git a/doc/http.n b/doc/http.n deleted file mode 100644 index 40ced23..0000000 --- a/doc/http.n +++ /dev/null @@ -1,650 +0,0 @@ -'\" -'\" Copyright (c) 1995-1997 Sun Microsystems, Inc. -'\" Copyright (c) 1998-2000 by Ajuba Solutions. -'\" Copyright (c) 2004 ActiveState Corporation. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH "http" n 2.7 http "Tcl Bundled Packages" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -http \- Client-side implementation of the HTTP/1.1 protocol -.SH SYNOPSIS -\fBpackage require http ?2.7?\fR -.\" See Also -useragent option documentation in body! -.sp -\fB::http::config ?\fI\-option value\fR ...? -.sp -\fB::http::geturl \fIurl\fR ?\fI\-option value\fR ...? -.sp -\fB::http::formatQuery\fR \fIkey value\fR ?\fIkey value\fR ...? -.sp -\fB::http::reset\fR \fItoken\fR ?\fIwhy\fR? -.sp -\fB::http::wait \fItoken\fR -.sp -\fB::http::status \fItoken\fR -.sp -\fB::http::size \fItoken\fR -.sp -\fB::http::code \fItoken\fR -.sp -\fB::http::ncode \fItoken\fR -.sp -\fB::http::meta \fItoken\fR -.sp -\fB::http::data \fItoken\fR -.sp -\fB::http::error \fItoken\fR -.sp -\fB::http::cleanup \fItoken\fR -.sp -\fB::http::register \fIproto port command\fR -.sp -\fB::http::unregister \fIproto\fR -.BE -.SH DESCRIPTION -.PP -The \fBhttp\fR package provides the client side of the HTTP/1.1 -protocol, as defined in RFC 2616. -The package implements the GET, POST, and HEAD operations -of HTTP/1.1. It allows configuration of a proxy host to get through -firewalls. The package is compatible with the \fBSafesock\fR security -policy, so it can be used by untrusted applets to do URL fetching from -a restricted set of hosts. This package can be extended to support -additional HTTP transport protocols, such as HTTPS, by providing -a custom \fBsocket\fR command, via \fB::http::register\fR. -.PP -The \fB::http::geturl\fR procedure does a HTTP transaction. -Its \fIoptions \fR determine whether a GET, POST, or HEAD transaction -is performed. -The return value of \fB::http::geturl\fR is a token for the transaction. -The value is also the name of an array in the ::http namespace -that contains state information about the transaction. The elements -of this array are described in the \fBSTATE ARRAY\fR section. -.PP -If the \fB\-command\fR option is specified, then -the HTTP operation is done in the background. -\fB::http::geturl\fR returns immediately after generating the -HTTP request and the callback is invoked -when the transaction completes. For this to work, the Tcl event loop -must be active. In Tk applications this is always true. For pure-Tcl -applications, the caller can use \fB::http::wait\fR after calling -\fB::http::geturl\fR to start the event loop. -.SH COMMANDS -.TP -\fB::http::config\fR ?\fIoptions\fR? -. -The \fB::http::config\fR command is used to set and query the name of the -proxy server and port, and the User-Agent name used in the HTTP -requests. If no options are specified, then the current configuration -is returned. If a single argument is specified, then it should be one -of the flags described below. In this case the current value of -that setting is returned. Otherwise, the options should be a set of -flags and values that define the configuration: -.RS -.TP -\fB\-accept\fR \fImimetypes\fR -. -The Accept header of the request. The default is */*, which means that -all types of documents are accepted. Otherwise you can supply a -comma-separated list of mime type patterns that you are -willing to receive. For example, -.QW "image/gif, image/jpeg, text/*" . -.TP -\fB\-proxyhost\fR \fIhostname\fR -. -The name of the proxy host, if any. If this value is the -empty string, the URL host is contacted directly. -.TP -\fB\-proxyport\fR \fInumber\fR -. -The proxy port number. -.TP -\fB\-proxyfilter\fR \fIcommand\fR -. -The command is a callback that is made during -\fB::http::geturl\fR -to determine if a proxy is required for a given host. One argument, a -host name, is added to \fIcommand\fR when it is invoked. If a proxy -is required, the callback should return a two-element list containing -the proxy server and proxy port. Otherwise the filter should return -an empty list. The default filter returns the values of the -\fB\-proxyhost\fR and \fB\-proxyport\fR settings if they are -non-empty. -.TP -\fB\-urlencoding\fR \fIencoding\fR -. -The \fIencoding\fR used for creating the x-url-encoded URLs with -\fB::http::formatQuery\fR. The default is \fButf-8\fR, as specified by RFC -2718. Prior to http 2.5 this was unspecified, and that behavior can be -returned by specifying the empty string (\fB{}\fR), although -\fIiso8859-1\fR is recommended to restore similar behavior but without the -\fB::http::formatQuery\fR throwing an error processing non-latin-1 -characters. -.TP -\fB\-useragent\fR \fIstring\fR -. -The value of the User-Agent header in the HTTP request. The default is -.QW "\fBTcl http client package 2.7\fR" . -.RE -.TP -\fB::http::geturl\fR \fIurl\fR ?\fIoptions\fR? -. -The \fB::http::geturl\fR command is the main procedure in the package. -The \fB\-query\fR option causes a POST operation and -the \fB\-validate\fR option causes a HEAD operation; -otherwise, a GET operation is performed. The \fB::http::geturl\fR command -returns a \fItoken\fR value that can be used to get -information about the transaction. See the \fBSTATE ARRAY\fR and -\fBERRORS\fR section for -details. The \fB::http::geturl\fR command blocks until the operation -completes, unless the \fB\-command\fR option specifies a callback -that is invoked when the HTTP transaction completes. -\fB::http::geturl\fR takes several options: -.RS -.TP -\fB\-binary\fR \fIboolean\fR -. -Specifies whether to force interpreting the URL data as binary. Normally -this is auto-detected (anything not beginning with a \fBtext\fR content -type or whose content encoding is \fBgzip\fR or \fBcompress\fR is -considered binary data). -.TP -\fB\-blocksize\fR \fIsize\fR -. -The block size used when reading the URL. -At most \fIsize\fR bytes are read at once. After each block, a call to the -\fB\-progress\fR callback is made (if that option is specified). -.TP -\fB\-channel\fR \fIname\fR -. -Copy the URL contents to channel \fIname\fR instead of saving it in -\fBstate(body)\fR. -.TP -\fB\-command\fR \fIcallback\fR -. -Invoke \fIcallback\fR after the HTTP transaction completes. -This option causes \fB::http::geturl\fR to return immediately. -The \fIcallback\fR gets an additional argument that is the \fItoken\fR returned -from \fB::http::geturl\fR. This token is the name of an array that is -described in the \fBSTATE ARRAY\fR section. Here is a template for the -callback: -.RS -.PP -.CS -proc httpCallback {token} { - upvar #0 $token state - # Access state as a Tcl array -} -.CE -.RE -.TP -\fB\-handler\fR \fIcallback\fR -. -Invoke \fIcallback\fR whenever HTTP data is available; if present, nothing -else will be done with the HTTP data. This procedure gets two additional -arguments: the socket for the HTTP data and the \fItoken\fR returned from -\fB::http::geturl\fR. The token is the name of a global array that is -described in the \fBSTATE ARRAY\fR section. The procedure is expected -to return the number of bytes read from the socket. Here is a -template for the callback: -.RS -.PP -.CS -proc httpHandlerCallback {socket token} { - upvar #0 $token state - # Access socket, and state as a Tcl array - # For example... - ... - set data [read $socket 1000] - set nbytes [string length $data] - ... - return $nbytes -} -.CE -.RE -.TP -\fB\-headers\fR \fIkeyvaluelist\fR -. -This option is used to add headers not already specified -by \fB::http::config\fR to the HTTP request. The -\fIkeyvaluelist\fR argument must be a list with an even number of -elements that alternate between keys and values. The keys become -header field names. Newlines are stripped from the values so the -header cannot be corrupted. For example, if \fIkeyvaluelist\fR is -\fBPragma no-cache\fR then the following header is included in the -HTTP request: -.RS -.PP -.CS -Pragma: no-cache -.CE -.RE -.TP -\fB\-keepalive\fR \fIboolean\fR -. -If true, attempt to keep the connection open for servicing -multiple requests. Default is 0. -.TP -\fB\-method\fR \fItype\fR -. -Force the HTTP request method to \fItype\fR. \fB::http::geturl\fR will -auto-select GET, POST or HEAD based on other options, but this option -enables choices like PUT and DELETE for webdav support. -.TP -\fB\-myaddr\fR \fIaddress\fR -. -Pass an specific local address to the underlying \fBsocket\fR call in case -multiple interfaces are available. -.TP -\fB\-progress\fR \fIcallback\fR -. -The \fIcallback\fR is made after each transfer of data from the URL. -The callback gets three additional arguments: the \fItoken\fR from -\fB::http::geturl\fR, the expected total size of the contents from the -\fBContent-Length\fR meta-data, and the current number of bytes -transferred so far. The expected total size may be unknown, in which -case zero is passed to the callback. Here is a template for the -progress callback: -.RS -.PP -.CS -proc httpProgress {token total current} { - upvar #0 $token state -} -.CE -.RE -.TP -\fB\-protocol\fR \fIversion\fR -. -Select the HTTP protocol version to use. This should be 1.0 or 1.1 (the -default). Should only be necessary for servers that do not understand or -otherwise complain about HTTP/1.1. -.TP -\fB\-query\fR \fIquery\fR -. -This flag causes \fB::http::geturl\fR to do a POST request that passes the -\fIquery\fR to the server. The \fIquery\fR must be an x-url-encoding -formatted query. The \fB::http::formatQuery\fR procedure can be used to -do the formatting. -.TP -\fB\-queryblocksize\fR \fIsize\fR -. -The block size used when posting query data to the URL. -At most -\fIsize\fR -bytes are written at once. After each block, a call to the -\fB\-queryprogress\fR -callback is made (if that option is specified). -.TP -\fB\-querychannel\fR \fIchannelID\fR -. -This flag causes \fB::http::geturl\fR to do a POST request that passes the -data contained in \fIchannelID\fR to the server. The data contained in -\fIchannelID\fR must be an x-url-encoding -formatted query unless the \fB\-type\fR option below is used. -If a Content-Length header is not specified via the \fB\-headers\fR options, -\fB::http::geturl\fR attempts to determine the size of the post data -in order to create that header. If it is -unable to determine the size, it returns an error. -.TP -\fB\-queryprogress\fR \fIcallback\fR -. -The \fIcallback\fR is made after each transfer of data to the URL -(i.e. POST) and acts exactly like the \fB\-progress\fR option (the -callback format is the same). -.TP -\fB\-strict\fR \fIboolean\fR -. -Whether to enforce RFC 3986 URL validation on the request. Default is 1. -.TP -\fB\-timeout\fR \fImilliseconds\fR -. -If \fImilliseconds\fR is non-zero, then \fB::http::geturl\fR sets up a timeout -to occur after the specified number of milliseconds. -A timeout results in a call to \fB::http::reset\fR and to -the \fB\-command\fR callback, if specified. -The return value of \fB::http::status\fR is \fBtimeout\fR -after a timeout has occurred. -.TP -\fB\-type\fR \fImime-type\fR -. -Use \fImime-type\fR as the \fBContent-Type\fR value, instead of the -default value (\fBapplication/x-www-form-urlencoded\fR) during a -POST operation. -.TP -\fB\-validate\fR \fIboolean\fR -. -If \fIboolean\fR is non-zero, then \fB::http::geturl\fR does an HTTP HEAD -request. This request returns meta information about the URL, but the -contents are not returned. The meta information is available in the -\fBstate(meta) \fR variable after the transaction. See the -\fBSTATE ARRAY\fR section for details. -.RE -.TP -\fB::http::formatQuery\fR \fIkey value\fR ?\fIkey value\fR ...? -. -This procedure does x-url-encoding of query data. It takes an even -number of arguments that are the keys and values of the query. It -encodes the keys and values, and generates one string that has the -proper & and = separators. The result is suitable for the -\fB\-query\fR value passed to \fB::http::geturl\fR. -.TP -\fB::http::reset\fR \fItoken\fR ?\fIwhy\fR? -. -This command resets the HTTP transaction identified by \fItoken\fR, if any. -This sets the \fBstate(status)\fR value to \fIwhy\fR, which defaults to -\fBreset\fR, and then calls the registered \fB\-command\fR callback. -.TP -\fB::http::wait\fR \fItoken\fR -. -This is a convenience procedure that blocks and waits for the -transaction to complete. This only works in trusted code because it -uses \fBvwait\fR. Also, it is not useful for the case where -\fB::http::geturl\fR is called \fIwithout\fR the \fB\-command\fR option -because in this case the \fB::http::geturl\fR call does not return -until the HTTP transaction is complete, and thus there is nothing to -wait for. -.TP -\fB::http::data\fR \fItoken\fR -. -This is a convenience procedure that returns the \fBbody\fR element -(i.e., the URL data) of the state array. -.TP -\fB::http::error\fR \fItoken\fR -. -This is a convenience procedure that returns the \fBerror\fR element -of the state array. -.TP -\fB::http::status\fR \fItoken\fR -. -This is a convenience procedure that returns the \fBstatus\fR element of -the state array. -.TP -\fB::http::code\fR \fItoken\fR -. -This is a convenience procedure that returns the \fBhttp\fR element of the -state array. -.TP -\fB::http::ncode\fR \fItoken\fR -. -This is a convenience procedure that returns just the numeric return -code (200, 404, etc.) from the \fBhttp\fR element of the state array. -.TP -\fB::http::size\fR \fItoken\fR -. -This is a convenience procedure that returns the \fBcurrentsize\fR -element of the state array, which represents the number of bytes -received from the URL in the \fB::http::geturl\fR call. -.TP -\fB::http::meta\fR \fItoken\fR -. -This is a convenience procedure that returns the \fBmeta\fR -element of the state array which contains the HTTP response -headers. See below for an explanation of this element. -.TP -\fB::http::cleanup\fR \fItoken\fR -. -This procedure cleans up the state associated with the connection -identified by \fItoken\fR. After this call, the procedures -like \fB::http::data\fR cannot be used to get information -about the operation. It is \fIstrongly\fR recommended that you call -this function after you are done with a given HTTP request. Not doing -so will result in memory not being freed, and if your app calls -\fB::http::geturl\fR enough times, the memory leak could cause a -performance hit...or worse. -.TP -\fB::http::register\fR \fIproto port command\fR -. -This procedure allows one to provide custom HTTP transport types -such as HTTPS, by registering a prefix, the default port, and the -command to execute to create the Tcl \fBchannel\fR. E.g.: -.RS -.PP -.CS -package require http -package require tls - -::http::register https 443 ::tls::socket - -set token [::http::geturl https://my.secure.site/] -.CE -.RE -.TP -\fB::http::unregister\fR \fIproto\fR -. -This procedure unregisters a protocol handler that was previously -registered via \fB::http::register\fR, returning a two-item list of -the default port and handler command that was previously installed -(via \fB::http::register\fR) if there was such a handler, and an error if -there was no such handler. -.SH ERRORS -The \fB::http::geturl\fR procedure will raise errors in the following cases: -invalid command line options, -an invalid URL, -a URL on a non-existent host, -or a URL at a bad port on an existing host. -These errors mean that it -cannot even start the network transaction. -It will also raise an error if it gets an I/O error while -writing out the HTTP request header. -For synchronous \fB::http::geturl\fR calls (where \fB\-command\fR is -not specified), it will raise an error if it gets an I/O error while -reading the HTTP reply headers or data. Because \fB::http::geturl\fR -does not return a token in these cases, it does all the required -cleanup and there is no issue of your app having to call -\fB::http::cleanup\fR. -.PP -For asynchronous \fB::http::geturl\fR calls, all of the above error -situations apply, except that if there is any error while reading the -HTTP reply headers or data, no exception is thrown. This is because -after writing the HTTP headers, \fB::http::geturl\fR returns, and the -rest of the HTTP transaction occurs in the background. The command -callback can check if any error occurred during the read by calling -\fB::http::status\fR to check the status and if its \fIerror\fR, -calling \fB::http::error\fR to get the error message. -.PP -Alternatively, if the main program flow reaches a point where it needs -to know the result of the asynchronous HTTP request, it can call -\fB::http::wait\fR and then check status and error, just as the -callback does. -.PP -In any case, you must still call -\fB::http::cleanup\fR to delete the state array when you are done. -.PP -There are other possible results of the HTTP transaction -determined by examining the status from \fB::http::status\fR. -These are described below. -.TP -\fBok\fR -. -If the HTTP transaction completes entirely, then status will be \fBok\fR. -However, you should still check the \fB::http::code\fR value to get -the HTTP status. The \fB::http::ncode\fR procedure provides just -the numeric error (e.g., 200, 404 or 500) while the \fB::http::code\fR -procedure returns a value like -.QW "HTTP 404 File not found" . -.TP -\fBeof\fR -. -If the server closes the socket without replying, then no error -is raised, but the status of the transaction will be \fBeof\fR. -.TP -\fBerror\fR -. -The error message will also be stored in the \fBerror\fR status -array element, accessible via \fB::http::error\fR. -.PP -Another error possibility is that \fB::http::geturl\fR is unable to -write all the post query data to the server before the server -responds and closes the socket. -The error message is saved in the \fBposterror\fR status array -element and then \fB::http::geturl\fR attempts to complete the -transaction. -If it can read the server's response -it will end up with an \fBok\fR status, otherwise it will have -an \fBeof\fR status. -.SH "STATE ARRAY" -The \fB::http::geturl\fR procedure returns a \fItoken\fR that can be used to -get to the state of the HTTP transaction in the form of a Tcl array. -Use this construct to create an easy-to-use array variable: -.PP -.CS -upvar #0 $token state -.CE -.PP -Once the data associated with the URL is no longer needed, the state -array should be unset to free up storage. -The \fB::http::cleanup\fR procedure is provided for that purpose. -The following elements of -the array are supported: -.RS -.TP -\fBbody\fR -. -The contents of the URL. This will be empty if the \fB\-channel\fR -option has been specified. This value is returned by the \fB::http::data\fR command. -.TP -\fBcharset\fR -. -The value of the charset attribute from the \fBContent-Type\fR meta-data -value. If none was specified, this defaults to the RFC standard -\fBiso8859-1\fR, or the value of \fB$::http::defaultCharset\fR. Incoming -text data will be automatically converted from this charset to utf-8. -.TP -\fBcoding\fR -. -A copy of the \fBContent-Encoding\fR meta-data value. -.TP -\fBcurrentsize\fR -. -The current number of bytes fetched from the URL. -This value is returned by the \fB::http::size\fR command. -.TP -\fBerror\fR -. -If defined, this is the error string seen when the HTTP transaction -was aborted. -.TP -\fBhttp\fR -. -The HTTP status reply from the server. This value -is returned by the \fB::http::code\fR command. The format of this value is: -.RS -.PP -.CS -\fIHTTP/1.1 code string\fR -.CE -.PP -The \fIcode\fR is a three-digit number defined in the HTTP standard. -A code of 200 is OK. Codes beginning with 4 or 5 indicate errors. -Codes beginning with 3 are redirection errors. In this case the -\fBLocation\fR meta-data specifies a new URL that contains the -requested information. -.RE -.TP -\fBmeta\fR -. -The HTTP protocol returns meta-data that describes the URL contents. -The \fBmeta\fR element of the state array is a list of the keys and -values of the meta-data. This is in a format useful for initializing -an array that just contains the meta-data: -.RS -.PP -.CS -array set meta $state(meta) -.CE -.PP -Some of the meta-data keys are listed below, but the HTTP standard defines -more, and servers are free to add their own. -.TP -\fBContent-Type\fR -. -The type of the URL contents. Examples include \fBtext/html\fR, -\fBimage/gif,\fR \fBapplication/postscript\fR and -\fBapplication/x-tcl\fR. -.TP -\fBContent-Length\fR -. -The advertised size of the contents. The actual size obtained by -\fB::http::geturl\fR is available as \fBstate(currentsize)\fR. -.TP -\fBLocation\fR -. -An alternate URL that contains the requested data. -.RE -.TP -\fBposterror\fR -. -The error, if any, that occurred while writing -the post query data to the server. -.TP -\fBstatus\fR -. -Either \fBok\fR, for successful completion, \fBreset\fR for -user-reset, \fBtimeout\fR if a timeout occurred before the transaction -could complete, or \fBerror\fR for an error condition. During the -transaction this value is the empty string. -.TP -\fBtotalsize\fR -. -A copy of the \fBContent-Length\fR meta-data value. -.TP -\fBtype\fR -. -A copy of the \fBContent-Type\fR meta-data value. -.TP -\fBurl\fR -. -The requested URL. -.RE -.SH EXAMPLE -.PP -This example creates a procedure to copy a URL to a file while printing a -progress meter, and prints the meta-data associated with the URL. -.PP -.CS -proc httpcopy { url file {chunk 4096} } { - set out [open $file w] - set token [\fB::http::geturl\fR $url -channel $out \e - -progress httpCopyProgress -blocksize $chunk] - close $out - - # This ends the line started by httpCopyProgress - puts stderr "" - - upvar #0 $token state - set max 0 - foreach {name value} $state(meta) { - if {[string length $name] > $max} { - set max [string length $name] - } - if {[regexp -nocase ^location$ $name]} { - # Handle URL redirects - puts stderr "Location:$value" - return [httpcopy [string trim $value] $file $chunk] - } - } - incr max - foreach {name value} $state(meta) { - puts [format "%-*s %s" $max $name: $value] - } - - return $token -} -proc httpCopyProgress {args} { - puts -nonewline stderr . - flush stderr -} -.CE -.SH "SEE ALSO" -safe(n), socket(n), safesock(n) -.SH KEYWORDS -internet, security policy, socket, www -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/if.n b/doc/if.n deleted file mode 100644 index ff2518d..0000000 --- a/doc/if.n +++ /dev/null @@ -1,88 +0,0 @@ -'\" -'\" 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. -'\" -.TH if n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -if \- Execute scripts conditionally -.SH SYNOPSIS -\fBif \fIexpr1 \fR?\fBthen\fR? \fIbody1 \fBelseif \fIexpr2 \fR?\fBthen\fR? \fIbody2\fR \fBelseif\fR ... ?\fBelse\fR? ?\fIbodyN\fR? -.BE - -.SH DESCRIPTION -.PP -The \fIif\fR command evaluates \fIexpr1\fR as an expression (in the -same way that \fBexpr\fR evaluates its argument). The value of the -expression must be a boolean -(a numeric value, where 0 is false and -anything is true, or a string value such as \fBtrue\fR or \fByes\fR -for true and \fBfalse\fR or \fBno\fR for false); -if it is true then \fIbody1\fR is executed by passing it to the -Tcl interpreter. -Otherwise \fIexpr2\fR is evaluated as an expression and if it is true -then \fBbody2\fR is executed, and so on. -If none of the expressions evaluates to true then \fIbodyN\fR is -executed. -The \fBthen\fR and \fBelse\fR arguments are optional -.QW "noise words" -to make the command easier to read. -There may be any number of \fBelseif\fR clauses, including zero. -\fIBodyN\fR may also be omitted as long as \fBelse\fR is omitted too. -The return value from the command is the result of the body script -that was executed, or an empty string -if none of the expressions was non-zero and there was no \fIbodyN\fR. -.SH EXAMPLES -.PP -A simple conditional: -.PP -.CS -\fBif\fR {$vbl == 1} { puts "vbl is one" } -.CE -.PP -With an \fBelse\fR-clause: -.PP -.CS -\fBif\fR {$vbl == 1} { - puts "vbl is one" -} \fBelse\fR { - puts "vbl is not one" -} -.CE -.PP -With an \fBelseif\fR-clause too: -.PP -.CS -\fBif\fR {$vbl == 1} { - puts "vbl is one" -} \fBelseif\fR {$vbl == 2} { - puts "vbl is two" -} \fBelse\fR { - puts "vbl is not one or two" -} -.CE -.PP -Remember, expressions can be multi-line, but in that case it can be a -good idea to use the optional \fBthen\fR keyword for clarity: -.PP -.CS -\fBif\fR { - $vbl == 1 - || $vbl == 2 - || $vbl == 3 -} \fBthen\fR { - puts "vbl is one, two or three" -} -.CE -.SH "SEE ALSO" -expr(n), for(n), foreach(n) -.SH KEYWORDS -boolean, conditional, else, false, if, true -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/incr.n b/doc/incr.n deleted file mode 100644 index b4be95c..0000000 --- a/doc/incr.n +++ /dev/null @@ -1,61 +0,0 @@ -'\" -'\" 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. -'\" -.TH incr n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -incr \- Increment the value of a variable -.SH SYNOPSIS -\fBincr \fIvarName \fR?\fIincrement\fR? -.BE -.SH DESCRIPTION -.PP -Increments the value stored in the variable whose name is \fIvarName\fR. -The value of the variable must be an integer. -If \fIincrement\fR is supplied then its value (which must be an -integer) is added to the value of variable \fIvarName\fR; otherwise -1 is added to \fIvarName\fR. -The new value is stored as a decimal string in variable \fIvarName\fR -and also returned as result. -.PP -Starting with the Tcl 8.5 release, the variable \fIvarName\fR passed -to \fBincr\fR may be unset, and in that case, it will be set to -the value \fIincrement\fR or to the default increment value of \fB1\fR. -.SH EXAMPLES -.PP -Add one to the contents of the variable \fIx\fR: -.PP -.CS -\fBincr\fR x -.CE -.PP -Add 42 to the contents of the variable \fIx\fR: -.PP -.CS -\fBincr\fR x 42 -.CE -.PP -Add the contents of the variable \fIy\fR to the contents of the -variable \fIx\fR: -.PP -.CS -\fBincr\fR x $y -.CE -.PP -Add nothing at all to the variable \fIx\fR (often useful for checking -whether an argument to a procedure is actually integral and generating -an error if it is not): -.PP -.CS -\fBincr\fR x 0 -.CE -.SH "SEE ALSO" -expr(n), set(n) -.SH KEYWORDS -add, increment, variable, value diff --git a/doc/info.n b/doc/info.n deleted file mode 100644 index c3a62c9..0000000 --- a/doc/info.n +++ /dev/null @@ -1,778 +0,0 @@ -'\" -'\" 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 -'\" Copyright (c) 2007-2012 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH info n 8.4 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -info \- Return information about the state of the Tcl interpreter -.SH SYNOPSIS -\fBinfo \fIoption \fR?\fIarg arg ...\fR? -.BE -.SH DESCRIPTION -.PP -This command provides information about various internals of the Tcl -interpreter. -The legal \fIoption\fRs (which may be abbreviated) are: -.TP -\fBinfo args \fIprocname\fR -. -Returns a list containing the names of the arguments to procedure -\fIprocname\fR, in order. \fIProcname\fR must be the name of a -Tcl command procedure. -.TP -\fBinfo body \fIprocname\fR -. -Returns the body of procedure \fIprocname\fR. \fIProcname\fR must be -the name of a Tcl command procedure. -.TP -\fBinfo class\fI subcommand class\fR ?\fIarg ...\fR -.VS 8.6 -Returns information about the class, \fIclass\fR. The \fIsubcommand\fRs are -described in \fBCLASS INTROSPECTION\fR below. -.VE 8.6 -.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 is not specified, -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. -.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 does not 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 -command is not complete, the script can delay evaluating it until additional -lines have been typed to complete the command. -.TP -\fBinfo coroutine\fR -.VS 8.6 -Returns the name of the currently executing \fBcoroutine\fR, or the empty -string if either no coroutine is currently executing, or the current coroutine -has been deleted (but has not yet returned or yielded since deletion). -.VE 8.6 -.TP -\fBinfo default \fIprocname arg varname\fR -. -\fIProcname\fR must be the name of a Tcl command procedure and \fIarg\fR -must be the name of an argument to that procedure. If \fIarg\fR -does not have a default value then the command returns \fB0\fR. -Otherwise it returns \fB1\fR and places the default value of \fIarg\fR -into variable \fIvarname\fR. -.TP -\fBinfo errorstack \fR?\fIinterp\fR? -.VS 8.6 -Returns, in a form that is programmatically easy to parse, the function names -and arguments at each level from the call stack of the last error in the given -\fIinterp\fR, or in the current one if not specified. -.RS -.PP -This form is an even-sized list alternating tokens and parameters. Tokens are -currently either \fBCALL\fR, \fBUP\fR, or \fBINNER\fR, but other values may be -introduced in the future. \fBCALL\fR indicates a procedure call, and its -parameter is the corresponding \fBinfo level\fR \fB0\fR. \fBUP\fR indicates a -shift in variable frames generated by \fBuplevel\fR or similar, and applies to -the previous \fBCALL\fR item. Its parameter is the level offset. \fBINNER\fR -identifies the -.QW "inner context" , -which is the innermost atomic command or bytecode instruction that raised the -error, along with its arguments when available. While \fBCALL\fR and \fBUP\fR -allow to follow complex call paths, \fBINNER\fR homes in on the offending -operation in the innermost procedure call, even going to sub-expression -granularity. -.PP -This information is also present in the \fB\-errorstack\fR entry of the -options dictionary returned by 3-argument \fBcatch\fR; \fBinfo errorstack\fR -is a convenient way of retrieving it for uncaught errors at top-level in an -interactive \fBtclsh\fR. -.RE -.VE 8.6 -.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 frame\fR ?\fInumber\fR? -. -This command provides access to all frames on the stack, even those -hidden from \fBinfo level\fR. If \fInumber\fR is not specified, this -command returns a number giving the frame level of the command. This -is 1 if the command is invoked at top-level. If \fInumber\fR is -specified, then the result is a dictionary containing the location -information for the command at the \fInumber\fRed level on the stack. -.RS -.PP -If \fInumber\fR is positive (> 0) then it selects a particular stack -level (1 refers to the outer-most active command, 2 to the command it -called, and so on, up to the current frame level which refers to -\fBinfo frame\fR itself); otherwise it gives a level relative to the -current command (0 refers to the current command, i.e., \fBinfo -frame\fR itself, -1 to its caller, and so on). -.PP -This is similar to how \fBinfo level\fR works, except that this -subcommand reports all frames, like \fBsource\fRd scripts, -\fBeval\fRs, \fBuplevel\fRs, etc. -.PP -Note that for nested commands, like -.QW "foo [bar [x]]" , -only -.QW x -will be seen by an \fBinfo frame\fR invoked within -.QW x . -This is the same as for \fBinfo level\fR and error stack traces. -.PP -The result dictionary may contain the keys listed below, with the -specified meanings for their values: -.TP -\fBtype\fR -. -This entry is always present and describes the nature of the location -for the command. The recognized values are \fBsource\fR, \fBproc\fR, -\fBeval\fR, and \fBprecompiled\fR. -.RS -.TP -\fBsource\fR\0\0\0\0\0\0\0\0 -. -means that the command is found in a script loaded by the \fBsource\fR -command. -.TP -\fBproc\fR\0\0\0\0\0\0\0\0 -. -means that the command is found in dynamically created procedure body. -.TP -\fBeval\fR\0\0\0\0\0\0\0\0 -. -means that the command is executed by \fBeval\fR or \fBuplevel\fR. -.TP -\fBprecompiled\fR\0\0\0\0\0\0\0\0 -. -means that the command is found in a pre-compiled script (loadable by -the package \fBtbcload\fR), and no further information will be -available. -.RE -.TP -\fBline\fR -. -This entry provides the number of the line the command is at inside of -the script it is a part of. This information is not present for type -\fBprecompiled\fR. For type \fBsource\fR this information is counted -relative to the beginning of the file, whereas for the last two types -the line is counted relative to the start of the script. -.TP -\fBfile\fR -. -This entry is present only for type \fBsource\fR. It provides the -normalized path of the file the command is in. -.TP -\fBcmd\fR -. -This entry provides the string representation of the command. This is -usually the unsubstituted form, however for commands which are a -canonically-constructed list (e.g., as produced by the \fBlist\fR command) -executed by \fBeval\fR it is the substituted form as they have no other -string representation. Care is taken that the canonicality property of -the latter is not spoiled. -.TP -\fBproc\fR -. -This entry is present only if the command is found in the body of a -regular Tcl procedure. It then provides the name of that procedure. -.TP -\fBlambda\fR -. -This entry is present only if the command is found in the body of an -anonymous Tcl procedure, i.e. a lambda. It then provides the entire -definition of the lambda in question. -.TP -\fBlevel\fR -. -This entry is present only if the queried frame has a corresponding -frame returned by \fBinfo level\fR. It provides the index of this -frame, relative to the current level (0 and negative numbers). -.PP -A thing of note is that for procedures statically defined in files the -locations of commands in their bodies will be reported with type -\fBsource\fR and absolute line numbers, and not as type -\fBproc\fR. The same is true for procedures nested in statically -defined procedures, and literal eval scripts in files or statically -defined procedures. -.PP -In contrast, procedure definitions and \fBeval\fR within a dynamically -\fBeval\fRuated environment count line numbers relative to the start of -their script, even if they would be able to count relative to the -start of the outer dynamic script. That type of number usually makes -more sense. -.PP -A different way of describing this behaviour is that file based -locations are tracked as deeply as possible, and where this is not -possible the lines are counted based on the smallest possible -\fBeval\fR or procedure body, as that scope is usually easier to find -than any dynamic outer scope. -.PP -The syntactic form \fB{*}\fR is handled like \fBeval\fR. I.e. if it -is given a literal list argument the system tracks the line number -within the list words as well, and otherwise all line numbers are -counted relative to the start of each word (smallest scope) -.RE -.TP -\fBinfo functions \fR?\fIpattern\fR? -. -If \fIpattern\fR is not 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 is not 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 -is positive then it selects a particular stack level (1 refers -to the top-most active procedure, 2 to the procedure it called, and -so on); otherwise it gives a level relative to the current level -(0 refers to the current procedure, -1 to its caller, and so on). -See the \fBuplevel\fR command for more information on what stack -levels mean. -.TP -\fBinfo library\fR -. -Returns the name of the library directory in which standard Tcl -scripts are stored. -This is actually the value of the \fBtcl_library\fR -variable and may be changed by setting \fBtcl_library\fR. -.TP -\fBinfo loaded \fR?\fIinterp\fR? ?\fIpackage\fR? -. -Returns the filename loaded as part of \fIpackage\fR. If \fIpackage\fR -is not specified, returns a list describing all of the packages -that have been loaded into \fIinterp\fR with the \fBload\fR command. -Each list element is a sub-list with two elements consisting of the -name of the file from which the package was loaded and the name of -the package. -For statically-loaded packages the file name will be an empty string. -If \fIinterp\fR is omitted then information is returned for all packages -loaded in any interpreter in the process. -To get a list of just the packages in the current interpreter, specify -an empty string for the \fIinterp\fR argument. -.TP -\fBinfo locals \fR?\fIpattern\fR? -. -If \fIpattern\fR is not specified, returns a list of all the names -of currently-defined local variables, including arguments to the -current procedure, if any. -Variables defined with the \fBglobal\fR, \fBupvar\fR and -\fBvariable\fR commands will not be returned. -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 nameofexecutable\fR -. -Returns the full path name of the binary file from which the application -was invoked. If Tcl was unable to identify the file, then an empty -string is returned. -.TP -\fBinfo object\fI subcommand object\fR ?\fIarg ...\fR -.VS 8.6 -Returns information about the object, \fIobject\fR. The \fIsubcommand\fRs are -described in \fBOBJECT INTROSPECTION\fR below. -.VE 8.6 -.TP -\fBinfo patchlevel\fR -. -Returns the value of the global variable \fBtcl_patchLevel\fR, which holds -the exact version of the Tcl library by default. -.TP -\fBinfo procs \fR?\fIpattern\fR? -. -If \fIpattern\fR is not specified, returns a list of all the -names of Tcl command procedures in the current namespace. -If \fIpattern\fR is specified, -only those procedure names in the current namespace -matching \fIpattern\fR are returned. -Matching is determined using the same rules as for -\fBstring match\fR. -If \fIpattern\fR contains any namespace separators, they are used to -select a namespace relative to the current namespace (or relative to -the global namespace if \fIpattern\fR starts with \fB::\fR) to match -within; the matching pattern is taken to be the part after the last -namespace separator. -.TP -\fBinfo script\fR ?\fIfilename\fR? -. -If a Tcl script file is currently being evaluated (i.e. there is a -call to \fBTcl_EvalFile\fR active or there is an active invocation -of the \fBsource\fR command), then this command returns the name -of the innermost file being processed. If \fIfilename\fR is specified, -then the return value of this command will be modified for the -duration of the active invocation to return that name. This is -useful in virtual file system applications. -Otherwise the command returns an empty string. -.TP -\fBinfo sharedlibextension\fR -. -Returns the extension used on this platform for the names of files -containing shared libraries (for example, \fB.so\fR under Solaris). -If shared libraries are not supported on this platform then an empty -string is returned. -.TP -\fBinfo tclversion\fR -. -Returns the value of the global variable \fBtcl_version\fR, which holds the -major and minor version of the Tcl library by default. -.TP -\fBinfo vars\fR ?\fIpattern\fR? -. -If \fIpattern\fR is not specified, -returns a list of all the names of currently-visible variables. -This includes locals and currently-visible globals. -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::option*\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 variables in that namespace. -If \fIpattern\fR is a qualified name, -the resulting list of variable names -has each matching namespace variable qualified with the name -of its namespace. -Note that a currently-visible variable may not yet -.QW exist -if it has not -been set (e.g. a variable declared but not set by \fBvariable\fR). -.SS "CLASS INTROSPECTION" -.VS 8.6 -.PP -The following \fIsubcommand\fR values are supported by \fBinfo class\fR: -.VE 8.6 -.TP -\fBinfo class call\fI class method\fR -.VS -Returns a description of the method implementations that are used to provide a -stereotypical instance of \fIclass\fR's implementation of \fImethod\fR -(stereotypical instances being objects instantiated by a class without having -any object-specific definitions added). This consists of a list of lists of -four elements, where each sublist consists of a word that describes the -general type of method implementation (being one of \fBmethod\fR for an -ordinary method, \fBfilter\fR for an applied filter, and \fBunknown\fR for a -method that is invoked as part of unknown method handling), a word giving the -name of the particular method invoked (which is always the same as -\fImethod\fR for the \fBmethod\fR type, and -.QW \fBunknown\fR -for the \fBunknown\fR type), a word giving the fully qualified name of the -class that defined the method, and a word describing the type of method -implementation (see \fBinfo class methodtype\fR). -.RS -.PP -Note that there is no inspection of whether the method implementations -actually use \fBnext\fR to transfer control along the call chain. -.RE -.VE 8.6 -.TP -\fBinfo class constructor\fI class\fR -.VS 8.6 -This subcommand returns a description of the definition of the constructor of -class \fIclass\fR. The definition is described as a two element list; the first -element is the list of arguments to the constructor in a form suitable for -passing to another call to \fBproc\fR or a method definition, and the second -element is the body of the constructor. If no constructor is present, this -returns the empty list. -.VE 8.6 -.TP -\fBinfo class definition\fI class method\fR -.VS 8.6 -This subcommand returns a description of the definition of the method named -\fImethod\fR of class \fIclass\fR. The definition is described as a two element -list; the first element is the list of arguments to the method in a form -suitable for passing to another call to \fBproc\fR or a method definition, and -the second element is the body of the method. -.VE 8.6 -.TP -\fBinfo class destructor\fI class\fR -.VS 8.6 -This subcommand returns the body of the destructor of class \fIclass\fR. If no -destructor is present, this returns the empty string. -.VE 8.6 -.TP -\fBinfo class filters\fI class\fR -.VS 8.6 -This subcommand returns the list of filter methods set on the class. -.VE 8.6 -.TP -\fBinfo class forward\fI class method\fR -.VS 8.6 -This subcommand returns the argument list for the method forwarding called -\fImethod\fR that is set on the class called \fIclass\fR. -.VE 8.6 -.TP -\fBinfo class instances\fI class\fR ?\fIpattern\fR? -.VS 8.6 -This subcommand returns a list of instances of class \fIclass\fR. If the -optional \fIpattern\fR argument is present, it constrains the list of returned -instances to those that match it according to the rules of \fBstring match\fR. -.VE 8.6 -.TP -\fBinfo class methods\fI class\fR ?\fIoptions...\fR? -.VS 8.6 -This subcommand returns a list of all public (i.e. exported) methods of the -class called \fIclass\fR. Any of the following \fIoption\fRs may be -specified, controlling exactly which method names are returned: -.RS -.VE 8.6 -.TP -\fB\-all\fR -.VS 8.6 -If the \fB\-all\fR flag is given, the list of methods will include those -methods defined not just by the class, but also by the class's superclasses -and mixins. -.VE 8.6 -.TP -\fB\-private\fR -.VS 8.6 -If the \fB\-private\fR flag is given, the list of methods will also include -the private (i.e. non-exported) methods of the class (and superclasses and -mixins, if \fB\-all\fR is also given). -.RE -.VE 8.6 -.TP -\fBinfo class methodtype\fI class method\fR -.VS 8.6 -This subcommand returns a description of the type of implementation used for -the method named \fImethod\fR of class \fIclass\fR. When the result is -\fBmethod\fR, further information can be discovered with \fBinfo class -definition\fR, and when the result is \fBforward\fR, further information can -be discovered with \fBinfo class forward\fR. -.VE 8.6 -.TP -\fBinfo class mixins\fI class\fR -.VS 8.6 -This subcommand returns a list of all classes that have been mixed into the -class named \fIclass\fR. -.VE 8.6 -.TP -\fBinfo class subclasses\fI class\fR ?\fIpattern\fR? -.VS 8.6 -This subcommand returns a list of direct subclasses of class \fIclass\fR. If -the optional \fIpattern\fR argument is present, it constrains the list of -returned classes to those that match it according to the rules of -\fBstring match\fR. -.VE 8.6 -.TP -\fBinfo class superclasses\fI class\fR -.VS 8.6 -This subcommand returns a list of direct superclasses of class \fIclass\fR in -inheritance precedence order. -.VE 8.6 -.TP -\fBinfo class variables\fI class\fR -.VS 8.6 -This subcommand returns a list of all variables that have been declared for -the class named \fIclass\fR (i.e. that are automatically present in the -class's methods, constructor and destructor). -.SS "OBJECT INTROSPECTION" -.PP -The following \fIsubcommand\fR values are supported by \fBinfo object\fR: -.VE 8.6 -.TP -\fBinfo object call\fI object method\fR -.VS 8.6 -Returns a description of the method implementations that are used to provide -\fIobject\fR's implementation of \fImethod\fR. This consists of a list of -lists of four elements, where each sublist consists of a word that describes -the general type of method implementation (being one of \fBmethod\fR for an -ordinary method, \fBfilter\fR for an applied filter, and \fBunknown\fR for a -method that is invoked as part of unknown method handling), a word giving the -name of the particular method invoked (which is always the same as -\fImethod\fR for the \fBmethod\fR type, and -.QW \fBunknown\fR -for the \fBunknown\fR type), a word giving what defined the method (the fully -qualified name of the class, or the literal string \fBobject\fR if the method -implementation is on an instance), and a word describing the type of method -implementation (see \fBinfo object methodtype\fR). -.RS -.PP -Note that there is no inspection of whether the method implementations -actually use \fBnext\fR to transfer control along the call chain. -.RE -.VE 8.6 -.TP -\fBinfo object class\fI object\fR ?\fIclassName\fR? -.VS 8.6 -If \fIclassName\fR is unspecified, this subcommand returns class of the -\fIobject\fR object. If \fIclassName\fR is present, this subcommand returns a -boolean value indicating whether the \fIobject\fR is of that class. -.VE 8.6 -.TP -\fBinfo object definition\fI object method\fR -.VS 8.6 -This subcommand returns a description of the definition of the method named -\fImethod\fR of object \fIobject\fR. The definition is described as a two -element list; the first element is the list of arguments to the method in a -form suitable for passing to another call to \fBproc\fR or a method definition, -and the second element is the body of the method. -.VE 8.6 -.TP -\fBinfo object filters\fI object\fR -.VS 8.6 -This subcommand returns the list of filter methods set on the object. -.VE 8.6 -.TP -\fBinfo object forward\fI object method\fR -.VS 8.6 -This subcommand returns the argument list for the method forwarding called -\fImethod\fR that is set on the object called \fIobject\fR. -.VE 8.6 -.TP -\fBinfo object isa\fI category object\fR ?\fIarg\fR? -.VS 8.6 -This subcommand tests whether an object belongs to a particular category, -returning a boolean value that indicates whether the \fIobject\fR argument -meets the criteria for the category. The supported categories are: -.VE 8.6 -.RS -.TP -\fBinfo object isa class\fI object\fR -.VS 8.6 -This returns whether \fIobject\fR is a class (i.e. an instance of -\fBoo::class\fR or one of its subclasses). -.VE 8.6 -.TP -\fBinfo object isa metaclass\fI object\fR -.VS 8.6 -This returns whether \fIobject\fR is a class that can manufacture classes -(i.e. is \fBoo::class\fR or a subclass of it). -.VE 8.6 -.TP -\fBinfo object isa mixin\fI object class\fR -.VS 8.6 -This returns whether \fIclass\fR is directly mixed into \fIobject\fR. -.VE 8.6 -.TP -\fBinfo object isa object\fI object\fR -.VS 8.6 -This returns whether \fIobject\fR really is an object. -.VE 8.6 -.TP -\fBinfo object isa typeof\fI object class\fR -.VS 8.6 -This returns whether \fIclass\fR is the type of \fIobject\fR (i.e. whether -\fIobject\fR is an instance of \fIclass\fR or one of its subclasses, whether -direct or indirect). -.RE -.VE 8.6 -.TP -\fBinfo object methods\fI object\fR ?\fIoption...\fR? -.VS 8.6 -This subcommand returns a list of all public (i.e. exported) methods of the -object called \fIobject\fR. Any of the following \fIoption\fRs may be -specified, controlling exactly which method names are returned: -.RS -.VE 8.6 -.TP -\fB\-all\fR -.VS 8.6 -If the \fB\-all\fR flag is given, the list of methods will include those -methods defined not just by the object, but also by the object's class and -mixins, plus the superclasses of those classes. -.VE 8.6 -.TP -\fB\-private\fR -.VS 8.6 -If the \fB\-private\fR flag is given, the list of methods will also include -the private (i.e. non-exported) methods of the object (and classes, if -\fB\-all\fR is also given). -.RE -.VE 8.6 -.TP -\fBinfo object methodtype\fI object method\fR -.VS 8.6 -This subcommand returns a description of the type of implementation used for -the method named \fImethod\fR of object \fIobject\fR. When the result is -\fBmethod\fR, further information can be discovered with \fBinfo object -definition\fR, and when the result is \fBforward\fR, further information can -be discovered with \fBinfo object forward\fR. -.VE 8.6 -.TP -\fBinfo object mixins\fI object\fR -.VS 8.6 -This subcommand returns a list of all classes that have been mixed into the -object named \fIobject\fR. -.VE 8.6 -.TP -\fBinfo object namespace\fI object\fR -.VS 8.6 -This subcommand returns the name of the internal namespace of the object named -\fIobject\fR. -.VE 8.6 -.TP -\fBinfo object variables\fI object\fR -.VS 8.6 -This subcommand returns a list of all variables that have been declared for -the object named \fIobject\fR (i.e. that are automatically present in the -object's methods). -.VE 8.6 -.TP -\fBinfo object vars\fI object\fR ?\fIpattern\fR? -.VS 8.6 -This subcommand returns a list of all variables in the private namespace of -the object named \fIobject\fR. If the optional \fIpattern\fR argument is -given, it is a filter (in the syntax of a \fBstring match\fR glob pattern) -that constrains the list of variables returned. Note that this is different -from the list returned by \fBinfo object variables\fR; that can include -variables that are currently unset, whereas this can include variables that -are not automatically included by any of \fIobject\fR's methods (or those of -its class, superclasses or mixins). -.VE 8.6 -.SH EXAMPLES -.PP -This command prints out a procedure suitable for saving in a Tcl -script: -.PP -.CS -proc printProc {procName} { - set result [list proc $procName] - set formals {} - foreach var [\fBinfo args\fR $procName] { - if {[\fBinfo default\fR $procName $var def]} { - lappend formals [list $var $def] - } else { - # Still need the list-quoting because variable - # names may properly contain spaces. - lappend formals [list $var] - } - } - puts [lappend result $formals [\fBinfo body\fR $procName]] -} -.CE -.SS "EXAMPLES WITH OBJECTS" -.VS 8.6 -.PP -Every object necessarily knows what its class is; this information is -trivially extractable through introspection: -.PP -.CS -oo::class create c -c create o -puts [\fBinfo object class\fR o] - \fI\(-> prints "::c"\fR -puts [\fBinfo object class\fR c] - \fI\(-> prints "::oo::class"\fR -.CE -.PP -The introspection capabilities can be used to discover what class implements a -method and get how it is defined. This procedure illustrates how: -.PP -.CS -proc getDef {obj method} { - foreach inf [\fBinfo object call\fR $obj $method] { - lassign $inf calltype name locus methodtype - # Assume no forwards or filters, and hence no $calltype - # or $methodtype checks... - if {$locus eq "object"} { - return [\fBinfo object definition\fR $obj $name] - } else { - return [\fBinfo class definition\fR $locus $name] - } - } - error "no definition for $method" -} -.CE -.PP -This is an alternate way of looking up the definition; it is implemented by -manually scanning the list of methods up the inheritance tree. This code -assumes that only single inheritance is in use, and that there is no complex -use of mixed-in classes (in such cases, using \fBinfo object call\fR as above -is the simplest way of doing this by far): -.PP -.CS -proc getDef {obj method} { - if {$method in [\fBinfo object methods\fR $obj]} { - # Assume no forwards - return [\fBinfo object definition\fR $obj $method] - } - set cls [\fBinfo object class\fR $obj] - while {$method ni [\fBinfo class methods\fR $cls]} { - # Assume the simple case - set cls [lindex [\fBinfo class superclass\fR $cls] 0] - if {$cls eq ""} { - error "no definition for $method" - } - } - # Assume no forwards - return [\fBinfo class definition\fR $cls $method] -} -.CE -.VE 8.6 -.SH "SEE ALSO" -.VS 8.6 -global(n), oo::class(n), oo::define(n), oo::object(n), proc(n), self(n), -.VE 8.6 -tcl_library(n), tcl_patchLevel(n), tcl_version(n) -.SH KEYWORDS -command, information, interpreter, introspection, level, namespace, -.VS 8.6 -object, -.VE 8.6 -procedure, variable -'\" Local Variables: -'\" mode: nroff -'\" fill-column: 78 -'\" End: diff --git a/doc/interp.n b/doc/interp.n deleted file mode 100644 index ac07fb7..0000000 --- a/doc/interp.n +++ /dev/null @@ -1,910 +0,0 @@ -'\" -'\" Copyright (c) 1995-1996 Sun Microsystems, Inc. -'\" Copyright (c) 2004 Donal K. Fellows -'\" Copyright (c) 2006-2008 Joe Mistachkin. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH interp n 8.6 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -interp \- Create and manipulate Tcl interpreters -.SH SYNOPSIS -\fBinterp \fIsubcommand \fR?\fIarg arg ...\fR? -.BE -.SH DESCRIPTION -.PP -This command makes it possible to create one or more new Tcl -interpreters that co-exist with the creating interpreter in the -same application. The creating interpreter is called the \fImaster\fR -and the new interpreter is called a \fIslave\fR. -A master can create any number of slaves, and each slave can -itself create additional slaves for which it is master, resulting -in a hierarchy of interpreters. -.PP -Each interpreter is independent from the others: it has its own name -space for commands, procedures, and global variables. -A master interpreter may create connections between its slaves and -itself using a mechanism called an \fIalias\fR. An \fIalias\fR is -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, -and by resource limit exceeded callbacks. 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 -interpreters. A safe interpreter is a slave whose functions have -been greatly restricted, so that it is safe to execute untrusted -scripts without fear of them damaging other interpreters or the -application's environment. For example, all IO channel creation -commands and subprocess creation commands are made inaccessible to safe -interpreters. -See \fBSAFE INTERPRETERS\fR below for more information on -what features are present in a safe interpreter. -The dangerous functionality is not removed from the safe interpreter; -instead, it is \fIhidden\fR, so that only trusted interpreters can obtain -access to it. For a detailed explanation of hidden commands, see -\fBHIDDEN COMMANDS\fR, below. -The alias mechanism can be used for protected communication (analogous to a -kernel call) between a slave interpreter and its master. -See \fBALIAS INVOCATION\fR, below, for more details -on how the alias mechanism works. -.PP -A qualified interpreter name is a proper Tcl lists containing a subset of its -ancestors in the interpreter hierarchy, terminated by the string naming the -interpreter in its immediate master. Interpreter names are relative to the -interpreter in which they are used. For example, if -.QW \fBa\fR -is a slave of the current interpreter and it has a slave -.QW \fBa1\fR , -which in turn has a slave -.QW \fBa11\fR , -the qualified name of -.QW \fBa11\fR -in -.QW \fBa\fR -is the list -.QW "\fBa1 a11\fR" . -.PP -The \fBinterp\fR command, described below, accepts qualified interpreter -names as arguments; the interpreter in which the command is being evaluated -can always be referred to as \fB{}\fR (the empty list or string). Note that -it is impossible to refer to a master (ancestor) interpreter by name in a -slave interpreter except through aliases. Also, there is no global name by -which one can refer to the first interpreter created in an application. -Both restrictions are motivated by safety concerns. -.SH "THE INTERP COMMAND" -.PP -The \fBinterp\fR command is used to create, delete, and manipulate -slave interpreters, and to share or transfer -channels between interpreters. It can have any of several forms, depending -on the \fIsubcommand\fR argument: -.TP -\fBinterp\fR \fBalias\fR \fIsrcPath\fR \fIsrcToken\fR -. -Returns a Tcl list whose elements are the \fItargetCmd\fR and -\fIarg\fRs associated with the alias represented by \fIsrcToken\fR -(this is the value returned when the alias was -created; it is possible that the name of the source command in the -slave is different from \fIsrcToken\fR). -.TP -\fBinterp\fR \fBalias\fR \fIsrcPath\fR \fIsrcToken\fR \fB{}\fR -. -Deletes the alias for \fIsrcToken\fR in the slave interpreter identified by -\fIsrcPath\fR. -\fIsrcToken\fR refers to the value returned when the alias -was created; if the source command has been renamed, the renamed -command will be deleted. -.TP -\fBinterp\fR \fBalias\fR \fIsrcPath\fR \fIsrcCmd\fR \fItargetPath\fR \fItargetCmd \fR?\fIarg arg ...\fR? -. -This command creates an alias between one slave and another (see the -\fBalias\fR slave command below for creating aliases between a slave -and its master). In this command, either of the slave interpreters -may be anywhere in the hierarchy of interpreters under the interpreter -invoking the command. -\fISrcPath\fR and \fIsrcCmd\fR identify the source of the alias. -\fISrcPath\fR is a Tcl list whose elements select a particular -interpreter. For example, -.QW "\fBa b\fR" -identifies an interpreter -.QW \fBb\fR , -which is a slave of interpreter -.QW \fBa\fR , -which is a slave of the invoking interpreter. An empty list specifies -the interpreter invoking the command. \fIsrcCmd\fR gives the name of -a new command, which will be created in the source interpreter. -\fITargetPath\fR and \fItargetCmd\fR specify a target interpreter -and command, and the \fIarg\fR arguments, if any, specify additional -arguments to \fItargetCmd\fR which are prepended to any arguments specified -in the invocation of \fIsrcCmd\fR. -\fITargetCmd\fR may be undefined at the time of this call, or it may -already exist; it is not created by this command. -The alias arranges for the given target command to be invoked -in the target interpreter whenever the given source command is -invoked in the source interpreter. See \fBALIAS INVOCATION\fR below for -more details. -The command returns a token that uniquely identifies the command created -\fIsrcCmd\fR, even if the command is renamed afterwards. The token may but -does not have to be equal to \fIsrcCmd\fR. -.TP -\fBinterp\fR \fBaliases \fR?\fIpath\fR? -. -This command returns a Tcl list of the tokens of all the source commands for -aliases defined in the interpreter identified by \fIpath\fR. The tokens -correspond to the values returned when -the aliases were created (which may not be the same -as the current names of the commands). -.TP -\fBinterp bgerror \fIpath\fR ?\fIcmdPrefix\fR? -. -This command either gets or sets the current background exception handler -for the interpreter identified by \fIpath\fR. If \fIcmdPrefix\fR is -absent, the current background exception handler is returned, and if it is -present, it is a list of words (of minimum length one) that describes -what to set the interpreter's background exception handler to. See the -\fBBACKGROUND EXCEPTION HANDLING\fR section for more details. -.TP -\fBinterp\fR \fBcancel \fR?\fB\-unwind\fR? ?\fB\-\|\-\fR? ?\fIpath\fR? ?\fIresult\fR? -.VS 8.6 -Cancels the script being evaluated in the interpreter identified by -\fIpath\fR. Without the \fB\-unwind\fR switch the evaluation stack for -the interpreter is unwound until an enclosing catch command is found or -there are no further invocations of the interpreter left on the call -stack. With the \fB\-unwind\fR switch the evaluation stack for the -interpreter is unwound without regard to any intervening catch command -until there are no further invocations of the interpreter left on the -call stack. The \fB\-\|\-\fR switch can be used to mark the end of -switches; it may be needed if \fIpath\fR is an unusual value such -as \fB\-safe\fR. If \fIresult\fR is present, it will be used as the -error message string; otherwise, a default error message string will be -used. -.VE 8.6 -.TP -\fBinterp\fR \fBcreate \fR?\fB\-safe\fR? ?\fB\-\|\-\fR? ?\fIpath\fR? -. -Creates a slave interpreter identified by \fIpath\fR and a new command, -called a \fIslave command\fR. The name of the slave command is the last -component of \fIpath\fR. The new slave interpreter and the slave command -are created in the interpreter identified by the path obtained by removing -the last component from \fIpath\fR. For example, if \fIpath\fR is \fBa b -c\fR then a new slave interpreter and slave command named \fBc\fR are -created in the interpreter identified by the path \fBa b\fR. -The slave command may be used to manipulate the new interpreter as -described below. If \fIpath\fR is omitted, Tcl creates a unique name of the -form \fBinterp\fIx\fR, where \fIx\fR is an integer, and uses it for the -interpreter and the slave command. If the \fB\-safe\fR switch is specified -(or if the master interpreter is a safe interpreter), the new slave -interpreter will be created as a safe interpreter with limited -functionality; otherwise the slave will include the full set of Tcl -built-in commands and variables. The \fB\-\|\-\fR switch can be used to -mark the end of switches; it may be needed if \fIpath\fR is an unusual -value such as \fB\-safe\fR. The result of the command is the name of the -new interpreter. The name of a slave interpreter must be unique among all -the slaves for its master; an error occurs if a slave interpreter by the -given name already exists in this master. -The initial recursion limit of the slave interpreter is set to the -current recursion limit of its parent interpreter. -.TP -\fBinterp\fR \fBdebug \fIpath\fR ?\fB\-frame\fR ?\fIbool\fR?? -. -Controls whether frame-level stack information is captured in the -slave interpreter identified by \fIpath\fR. If no arguments are -given, option and current setting are returned. If \fB\-frame\fR -is given, the debug setting is set to the given boolean if provided -and the current setting is returned. -This only effects the output of \fBinfo frame\fR, in that exact -frame-level information for command invocation at the bytecode level -is only captured with this setting on. -.RS -.PP -For example, with code like -.PP -.CS -\fBproc\fR mycontrol {... script} { - ... - \fBuplevel\fR 1 $script - ... -} - -\fBproc\fR dosomething {...} { - ... - mycontrol { - somecode - } -} -.CE -.PP -the standard setting will provide a relative line number for the -command \fBsomecode\fR and the relevant frame will be of type -\fBeval\fR. With frame-debug active on the other hand the tracking -extends so far that the system will be able to determine the file and -absolute line number of this command, and return a frame of type -\fBsource\fR. This more exact information is paid for with slower -execution of all commands. -.PP -Note that once it is on, this flag cannot be switched back off: such -attempts are silently ignored. This is needed to maintain the -consistency of the underlying interpreter's state. -.RE -.TP -\fBinterp\fR \fBdelete \fR?\fIpath ...?\fR -. -Deletes zero or more interpreters given by the optional \fIpath\fR -arguments, and for each interpreter, it also deletes its slaves. The -command also deletes the slave command for each interpreter deleted. -For each \fIpath\fR argument, if no interpreter by that name -exists, the command raises an error. -.TP -\fBinterp\fR \fBeval\fR \fIpath arg \fR?\fIarg ...\fR? -. -This command concatenates all of the \fIarg\fR arguments in the same -fashion as the \fBconcat\fR command, then evaluates the resulting string as -a Tcl script in the slave interpreter identified by \fIpath\fR. The result -of this evaluation (including all \fBreturn\fR options, -such as \fB\-errorinfo\fR and \fB\-errorcode\fR information, if an -error occurs) is returned to the invoking interpreter. -Note that the script will be executed in the current context stack frame of the -\fIpath\fR interpreter; this is so that the implementations (in a master -interpreter) of aliases in a slave interpreter can execute scripts in -the slave that find out information about the slave's current state -and stack frame. -.TP -\fBinterp exists \fIpath\fR -. -Returns \fB1\fR if a slave interpreter by the specified \fIpath\fR -exists in this master, \fB0\fR otherwise. If \fIpath\fR is omitted, the -invoking interpreter is used. -.TP -\fBinterp expose \fIpath\fR \fIhiddenName\fR ?\fIexposedCmdName\fR? -. -Makes the hidden command \fIhiddenName\fR exposed, eventually bringing -it back under a new \fIexposedCmdName\fR name (this name is currently -accepted only if it is a valid global name space name without any ::), -in the interpreter -denoted by \fIpath\fR. -If an exposed command with the targeted name already exists, this command -fails. -Hidden commands are explained in more detail in \fBHIDDEN COMMANDS\fR, below. -.TP -\fBinterp\fR \fBhide\fR \fIpath\fR \fIexposedCmdName\fR ?\fIhiddenCmdName\fR? -. -Makes the exposed command \fIexposedCmdName\fR hidden, renaming -it to the hidden command \fIhiddenCmdName\fR, or keeping the same name if -\fIhiddenCmdName\fR is not given, in the interpreter denoted -by \fIpath\fR. -If a hidden command with the targeted name already exists, this command -fails. -Currently both \fIexposedCmdName\fR and \fIhiddenCmdName\fR can -not contain namespace qualifiers, or an error is raised. -Commands to be hidden by \fBinterp hide\fR are looked up in the global -namespace even if the current namespace is not the global one. This -prevents slaves from fooling a master interpreter into hiding the wrong -command, by making the current namespace be different from the global one. -Hidden commands are explained in more detail in \fBHIDDEN COMMANDS\fR, below. -.TP -\fBinterp\fR \fBhidden\fR \fIpath\fR -. -Returns a list of the names of all hidden commands in the interpreter -identified by \fIpath\fR. -.TP -\fBinterp\fR \fBinvokehidden\fR \fIpath\fR ?\fI\-option ...\fR? \fIhiddenCmdName\fR ?\fIarg ...\fR? -. -Invokes the hidden command \fIhiddenCmdName\fR with the arguments supplied -in the interpreter denoted by \fIpath\fR. No substitutions or evaluation -are applied to the arguments. Three \fI\-option\fRs are supported, all -of which start with \fB\-\fR: \fB\-namespace\fR (which takes a single -argument afterwards, \fInsName\fR), \fB\-global\fR, and \fB\-\|\-\fR. -If the \fB\-namespace\fR flag is present, the hidden command is invoked in -the namespace called \fInsName\fR in the target interpreter. -If the \fB\-global\fR flag is present, the hidden command is invoked at the -global level in the target interpreter; otherwise it is invoked at the -current call frame and can access local variables in that and outer call -frames. -The \fB\-\|\-\fR flag allows the \fIhiddenCmdName\fR argument to start with a -.QW \- -character, and is otherwise unnecessary. -If both the \fB\-namespace\fR and \fB\-global\fR flags are present, the -\fB\-namespace\fR flag is ignored. -Note that the hidden command will be executed (by default) in the -current context stack frame of the \fIpath\fR interpreter. -Hidden commands are explained in more detail in \fBHIDDEN COMMANDS\fR, below. -.TP -\fBinterp issafe\fR ?\fIpath\fR? -. -Returns \fB1\fR if the interpreter identified by the specified \fIpath\fR -is safe, \fB0\fR otherwise. -.TP -\fBinterp\fR \fBlimit\fR \fIpath\fR \fIlimitType\fR ?\fI\-option\fR? ?\fIvalue\fR \fI...\fR? -. -Sets up, manipulates and queries the configuration of the resource -limit \fIlimitType\fR for the interpreter denoted by \fIpath\fR. If -no \fI\-option\fR is specified, return the current configuration of the -limit. If \fI\-option\fR is the sole argument, return the value of that -option. Otherwise, a list of \fI\-option\fR/\fIvalue\fR argument pairs -must supplied. See \fBRESOURCE LIMITS\fR below for a more detailed -explanation of what limits and options are supported. -.TP -\fBinterp marktrusted\fR \fIpath\fR -. -Marks the interpreter identified by \fIpath\fR as trusted. Does -not expose the hidden commands. This command can only be invoked from a -trusted interpreter. -The command has no effect if the interpreter identified by \fIpath\fR is -already trusted. -.TP -\fBinterp\fR \fBrecursionlimit\fR \fIpath\fR ?\fInewlimit\fR? -. -Returns the maximum allowable nesting depth for the interpreter -specified by \fIpath\fR. If \fInewlimit\fR is specified, -the interpreter recursion limit will be set so that nesting -of more than \fInewlimit\fR calls to \fBTcl_Eval\fR -and related procedures in that interpreter will return an error. -The \fInewlimit\fR value is also returned. -The \fInewlimit\fR value must be a positive integer between 1 and the -maximum value of a non-long integer on the platform. -.RS -.PP -The command sets the maximum size of the Tcl call stack only. It cannot -by itself prevent stack overflows on the C stack being used by the -application. If your machine has a limit on the size of the C stack, you -may get stack overflows before reaching the limit set by the command. If -this happens, see if there is a mechanism in your system for increasing -the maximum size of the C stack. -.RE -.TP -\fBinterp\fR \fBshare\fR \fIsrcPath channelId destPath\fR -. -Causes the IO channel identified by \fIchannelId\fR to become shared -between the interpreter identified by \fIsrcPath\fR and the interpreter -identified by \fIdestPath\fR. Both interpreters have the same permissions -on the IO channel. -Both interpreters must close it to close the underlying IO channel; IO -channels accessible in an interpreter are automatically closed when an -interpreter is destroyed. -.TP -\fBinterp\fR \fBslaves\fR ?\fIpath\fR? -. -Returns a Tcl list of the names of all the slave interpreters associated -with the interpreter identified by \fIpath\fR. If \fIpath\fR is omitted, -the invoking interpreter is used. -.TP -\fBinterp\fR \fBtarget\fR \fIpath alias\fR -. -Returns a Tcl list describing the target interpreter for an alias. The -alias is specified with an interpreter path and source command name, just -as in \fBinterp alias\fR above. The name of the target interpreter is -returned as an interpreter path, relative to the invoking interpreter. -If the target interpreter for the alias is the invoking interpreter then an -empty list is returned. If the target interpreter for the alias is not the -invoking interpreter or one of its descendants then an error is generated. -The target command does not have to be defined at the time of this invocation. -.TP -\fBinterp\fR \fBtransfer\fR \fIsrcPath channelId destPath\fR -. -Causes the IO channel identified by \fIchannelId\fR to become available in -the interpreter identified by \fIdestPath\fR and unavailable in the -interpreter identified by \fIsrcPath\fR. -.SH "SLAVE COMMAND" -.PP -For each slave interpreter created with the \fBinterp\fR command, a -new Tcl command is created in the master interpreter with the same -name as the new interpreter. This command may be used to invoke -various operations on the interpreter. It has the following -general form: -.PP -.CS -\fIslave command \fR?\fIarg arg ...\fR? -.CE -.PP -\fISlave\fR is the name of the interpreter, and \fIcommand\fR -and the \fIarg\fRs determine the exact behavior of the command. -The valid forms of this command are: -.TP -\fIslave \fBaliases\fR -. -Returns a Tcl list whose elements are the tokens of all the -aliases in \fIslave\fR. The tokens correspond to the values returned when -the aliases were created (which may not be the same -as the current names of the commands). -.TP -\fIslave \fBalias \fIsrcToken\fR -. -Returns a Tcl list whose elements are the \fItargetCmd\fR and -\fIarg\fRs associated with the alias represented by \fIsrcToken\fR -(this is the value returned when the alias was -created; it is possible that the actual source command in the -slave is different from \fIsrcToken\fR). -.TP -\fIslave \fBalias \fIsrcToken \fB{}\fR -. -Deletes the alias for \fIsrcToken\fR in the slave interpreter. -\fIsrcToken\fR refers to the value returned when the alias -was created; if the source command has been renamed, the renamed -command will be deleted. -.TP -\fIslave \fBalias \fIsrcCmd targetCmd \fR?\fIarg ..\fR? -. -Creates an alias such that whenever \fIsrcCmd\fR is invoked -in \fIslave\fR, \fItargetCmd\fR is invoked in the master. -The \fIarg\fR arguments will be passed to \fItargetCmd\fR as additional -arguments, prepended before any arguments passed in the invocation of -\fIsrcCmd\fR. -See \fBALIAS INVOCATION\fR below for details. -The command returns a token that uniquely identifies the command created -\fIsrcCmd\fR, even if the command is renamed afterwards. The token may but -does not have to be equal to \fIsrcCmd\fR. -.TP -\fIslave \fBbgerror\fR ?\fIcmdPrefix\fR? -. -This command either gets or sets the current background exception handler -for the \fIslave\fR interpreter. If \fIcmdPrefix\fR is -absent, the current background exception handler is returned, and if it is -present, it is a list of words (of minimum length one) that describes -what to set the interpreter's background exception handler to. See the -\fBBACKGROUND EXCEPTION HANDLING\fR section for more details. -.TP -\fIslave \fBeval \fIarg \fR?\fIarg ..\fR? -. -This command concatenates all of the \fIarg\fR arguments in -the same fashion as the \fBconcat\fR command, then evaluates -the resulting string as a Tcl script in \fIslave\fR. -The result of this evaluation (including all \fBreturn\fR options, -such as \fB\-errorinfo\fR and \fB\-errorcode\fR information, if an -error occurs) is returned to the invoking interpreter. -Note that the script will be executed in the current context stack frame -of \fIslave\fR; this is so that the implementations (in a master -interpreter) of aliases in a slave interpreter can execute scripts in -the slave that find out information about the slave's current state -and stack frame. -.TP -\fIslave \fBexpose \fIhiddenName \fR?\fIexposedCmdName\fR? -. -This command exposes the hidden command \fIhiddenName\fR, eventually bringing -it back under a new \fIexposedCmdName\fR name (this name is currently -accepted only if it is a valid global name space name without any ::), -in \fIslave\fR. -If an exposed command with the targeted name already exists, this command -fails. -For more details on hidden commands, see \fBHIDDEN COMMANDS\fR, below. -.TP -\fIslave \fBhide \fIexposedCmdName\fR ?\fIhiddenCmdName\fR? -. -This command hides the exposed command \fIexposedCmdName\fR, renaming it to -the hidden command \fIhiddenCmdName\fR, or keeping the same name if the -argument is not given, in the \fIslave\fR interpreter. -If a hidden command with the targeted name already exists, this command -fails. -Currently both \fIexposedCmdName\fR and \fIhiddenCmdName\fR can -not contain namespace qualifiers, or an error is raised. -Commands to be hidden are looked up in the global -namespace even if the current namespace is not the global one. This -prevents slaves from fooling a master interpreter into hiding the wrong -command, by making the current namespace be different from the global one. -For more details on hidden commands, see \fBHIDDEN COMMANDS\fR, below. -.TP -\fIslave \fBhidden\fR -. -Returns a list of the names of all hidden commands in \fIslave\fR. -.TP -\fIslave \fBinvokehidden\fR ?\fI\-option ...\fR? \fIhiddenName \fR?\fIarg ..\fR? -. -This command invokes the hidden command \fIhiddenName\fR with the -supplied arguments, in \fIslave\fR. No substitutions or evaluations are -applied to the arguments. Three \fI\-option\fRs are supported, all -of which start with \fB\-\fR: \fB\-namespace\fR (which takes a single -argument afterwards, \fInsName\fR), \fB\-global\fR, and \fB\-\|\-\fR. -If the \fB\-namespace\fR flag is given, the hidden command is invoked in -the specified namespace in the slave. -If the \fB\-global\fR flag is given, the command is invoked at the global -level in the slave; otherwise it is invoked at the current call frame and -can access local variables in that or outer call frames. -The \fB\-\|\-\fR flag allows the \fIhiddenCmdName\fR argument to start with a -.QW \- -character, and is otherwise unnecessary. -If both the \fB\-namespace\fR and \fB\-global\fR flags are given, the -\fB\-namespace\fR flag is ignored. -Note that the hidden command will be executed (by default) in the -current context stack frame of \fIslave\fR. -For more details on hidden commands, -see \fBHIDDEN COMMANDS\fR, below. -.TP -\fIslave \fBissafe\fR -. -Returns \fB1\fR if the slave interpreter is safe, \fB0\fR otherwise. -.TP -\fIslave \fBlimit\fR \fIlimitType\fR ?\fI\-option\fR? ?\fIvalue\fR \fI...\fR? -. -Sets up, manipulates and queries the configuration of the resource -limit \fIlimitType\fR for the slave interpreter. If no \fI\-option\fR -is specified, return the current configuration of the limit. If -\fI\-option\fR is the sole argument, return the value of that option. -Otherwise, a list of \fI\-option\fR/\fIvalue\fR argument pairs must -supplied. See \fBRESOURCE LIMITS\fR below for a more detailed explanation of -what limits and options are supported. -.TP -\fIslave \fBmarktrusted\fR -. -Marks the slave interpreter as trusted. Can only be invoked by a -trusted interpreter. This command does not expose any hidden -commands in the slave interpreter. The command has no effect if the slave -is already trusted. -.TP -\fIslave\fR \fBrecursionlimit\fR ?\fInewlimit\fR? -. -Returns the maximum allowable nesting depth for the \fIslave\fR interpreter. -If \fInewlimit\fR is specified, the recursion limit in \fIslave\fR will be -set so that nesting of more than \fInewlimit\fR calls to \fBTcl_Eval()\fR -and related procedures in \fIslave\fR will return an error. -The \fInewlimit\fR value is also returned. -The \fInewlimit\fR value must be a positive integer between 1 and the -maximum value of a non-long integer on the platform. -.RS -.PP -The command sets the maximum size of the Tcl call stack only. It cannot -by itself prevent stack overflows on the C stack being used by the -application. If your machine has a limit on the size of the C stack, you -may get stack overflows before reaching the limit set by the command. If -this happens, see if there is a mechanism in your system for increasing -the maximum size of the C stack. -.RE -.SH "SAFE INTERPRETERS" -.PP -A safe interpreter is one with restricted functionality, so that -is safe to execute an arbitrary script from your worst enemy without -fear of that script damaging the enclosing application or the rest -of your computing environment. In order to make an interpreter -safe, certain commands and variables are removed from the interpreter. -For example, commands to create files on disk are removed, and the -\fBexec\fR command is removed, since it could be used to cause damage -through subprocesses. -Limited access to these facilities can be provided, by creating -aliases to the master interpreter which check their arguments carefully -and provide restricted access to a safe subset of facilities. -For example, file creation might be allowed in a particular subdirectory -and subprocess invocation might be allowed for a carefully selected and -fixed set of programs. -.PP -A safe interpreter is created by specifying the \fB\-safe\fR switch -to the \fBinterp create\fR command. Furthermore, any slave created -by a safe interpreter will also be safe. -.PP -A safe interpreter is created with exactly the following set of -built-in commands: -.DS -.ta 1.2i 2.4i 3.6i -\fBafter\fR \fBappend\fR \fBapply\fR \fBarray\fR -\fBbinary\fR \fBbreak\fR \fBcatch\fR \fBchan\fR -\fBclock\fR \fBclose\fR \fBconcat\fR \fBcontinue\fR -\fBdict\fR \fBeof\fR \fBerror\fR \fBeval\fR -\fBexpr\fR \fBfblocked\fR \fBfcopy\fR \fBfileevent\fR -\fBflush\fR \fBfor\fR \fBforeach\fR \fBformat\fR -\fBgets\fR \fBglobal\fR \fBif\fR \fBincr\fR -\fBinfo\fR \fBinterp\fR \fBjoin\fR \fBlappend\fR -\fBlassign\fR \fBlindex\fR \fBlinsert\fR \fBlist\fR -\fBllength\fR \fBlrange\fR \fBlrepeat\fR \fBlreplace\fR -\fBlsearch\fR \fBlset\fR \fBlsort\fR \fBnamespace\fR -\fBpackage\fR \fBpid\fR \fBproc\fR \fBputs\fR -\fBread\fR \fBregexp\fR \fBregsub\fR \fBrename\fR -\fBreturn\fR \fBscan\fR \fBseek\fR \fBset\fR -\fBsplit\fR \fBstring\fR \fBsubst\fR \fBswitch\fR -\fBtell\fR \fBtime\fR \fBtrace\fR \fBunset\fR -\fBupdate\fR \fBuplevel\fR \fBupvar\fR \fBvariable\fR -\fBvwait\fR \fBwhile\fR -.DE -The following commands are hidden by \fBinterp create\fR when it -creates a safe interpreter: -.DS -.ta 1.2i 2.4i 3.6i -\fBcd\fR \fBencoding\fR \fBexec\fR \fBexit\fR -\fBfconfigure\fR \fBfile\fR \fBglob\fR \fBload\fR -\fBopen\fR \fBpwd\fR \fBsocket\fR \fBsource\fR -\fBunload\fR -.DE -These commands can be recreated later as Tcl procedures or aliases, or -re-exposed by \fBinterp expose\fR. -.PP -The following commands from Tcl's library of support procedures are -not present in a safe interpreter: -.DS -.ta 1.6i 3.2i -\fBauto_exec_ok\fR \fBauto_import\fR \fBauto_load\fR -\fBauto_load_index\fR \fBauto_qualify\fR \fBunknown\fR -.DE -Note in particular that safe interpreters have no default \fBunknown\fR -command, so Tcl's default autoloading facilities are not available. -Autoload access to Tcl's commands that are normally autoloaded: -.DS -.ta 2.1i -\fBauto_mkindex\fR \fBauto_mkindex_old\fR -\fBauto_reset\fR \fBhistory\fR -\fBparray\fR \fBpkg_mkIndex\fR -\fB::pkg::create\fR \fB::safe::interpAddToAccessPath\fR -\fB::safe::interpCreate\fR \fB::safe::interpConfigure\fR -\fB::safe::interpDelete\fR \fB::safe::interpFindInAccessPath\fR -\fB::safe::interpInit\fR \fB::safe::setLogCmd\fR -\fBtcl_endOfWord\fR \fBtcl_findLibrary\fR -\fBtcl_startOfNextWord\fR \fBtcl_startOfPreviousWord\fR -\fBtcl_wordBreakAfter\fR \fBtcl_wordBreakBefore\fR -.DE -can only be provided by explicit definition of an \fBunknown\fR command -in the safe interpreter. This will involve exposing the \fBsource\fR -command. This is most easily accomplished by creating the safe interpreter -with Tcl's \fBSafe\-Tcl\fR mechanism. \fBSafe\-Tcl\fR provides safe -versions of \fBsource\fR, \fBload\fR, and other Tcl commands needed -to support autoloading of commands and the loading of packages. -.PP -In addition, the \fBenv\fR variable is not present in a safe interpreter, -so it cannot share environment variables with other interpreters. The -\fBenv\fR variable poses a security risk, because users can store -sensitive information in an environment variable. For example, the PGP -manual recommends storing the PGP private key protection password in -the environment variable \fIPGPPASS\fR. Making this variable available -to untrusted code executing in a safe interpreter would incur a -security risk. -.PP -If extensions are loaded into a safe interpreter, they may also restrict -their own functionality to eliminate unsafe commands. For a discussion of -management of extensions for safety see the manual entries for -\fBSafe\-Tcl\fR and the \fBload\fR Tcl command. -.PP -A safe interpreter may not alter the recursion limit of any interpreter, -including itself. -.SH "ALIAS INVOCATION" -.PP -The alias mechanism has been carefully designed so that it can -be used safely when an untrusted script is executing -in a safe slave and the target of the alias is a trusted -master. The most important thing in guaranteeing safety is to -ensure that information passed from the slave to the master is -never evaluated or substituted in the master; if this were to -occur, it would enable an evil script in the slave to invoke -arbitrary functions in the master, which would compromise security. -.PP -When the source for an alias is invoked in the slave interpreter, the -usual Tcl substitutions are performed when parsing that command. -These substitutions are carried out in the source interpreter just -as they would be for any other command invoked in that interpreter. -The command procedure for the source command takes its arguments -and merges them with the \fItargetCmd\fR and \fIarg\fRs for the -alias to create a new array of arguments. If the words -of \fIsrcCmd\fR were -.QW "\fIsrcCmd arg1 arg2 ... argN\fR" , -the new set of words will be -.QW "\fItargetCmd arg arg ... arg arg1 arg2 ... argN\fR" , -where \fItargetCmd\fR and \fIarg\fRs are the values supplied when the -alias was created. \fITargetCmd\fR is then used to locate a command -procedure in the target interpreter, and that command procedure -is invoked with the new set of arguments. An error occurs if -there is no command named \fItargetCmd\fR in the target interpreter. -No additional substitutions are performed on the words: the -target command procedure is invoked directly, without -going through the normal Tcl evaluation mechanism. -Substitutions are thus performed on each word exactly once: -\fItargetCmd\fR and \fIargs\fR were substituted when parsing the command -that created the alias, and \fIarg1 - argN\fR are substituted when -the alias's source command is parsed in the source interpreter. -.PP -When writing the \fItargetCmd\fRs for aliases in safe interpreters, -it is very important that the arguments to that command never be -evaluated or substituted, since this would provide an escape -mechanism whereby the slave interpreter could execute arbitrary -code in the master. This in turn would compromise the security -of the system. -.SH "HIDDEN COMMANDS" -.PP -Safe interpreters greatly restrict the functionality available to Tcl -programs executing within them. -Allowing the untrusted Tcl program to have direct access to this -functionality is unsafe, because it can be used for a variety of -attacks on the environment. -However, there are times when there is a legitimate need to use the -dangerous functionality in the context of the safe interpreter. For -example, sometimes a program must be \fBsource\fRd into the interpreter. -Another example is Tk, where windows are bound to the hierarchy of windows -for a specific interpreter; some potentially dangerous functions, e.g. -window management, must be performed on these windows within the -interpreter context. -.PP -The \fBinterp\fR command provides a solution to this problem in the form of -\fIhidden commands\fR. Instead of removing the dangerous commands entirely -from a safe interpreter, these commands are hidden so they become -unavailable to Tcl scripts executing in the interpreter. However, such -hidden commands can be invoked by any trusted ancestor of the safe -interpreter, in the context of the safe interpreter, using \fBinterp -invoke\fR. Hidden commands and exposed commands reside in separate name -spaces. It is possible to define a hidden command and an exposed command by -the same name within one interpreter. -.PP -Hidden commands in a slave interpreter can be invoked in the body of -procedures called in the master during alias invocation. For example, an -alias for \fBsource\fR could be created in a slave interpreter. When it is -invoked in the slave interpreter, a procedure is called in the master -interpreter to check that the operation is allowable (e.g. it asks to -source a file that the slave interpreter is allowed to access). The -procedure then it invokes the hidden \fBsource\fR command in the slave -interpreter to actually source in the contents of the file. Note that two -commands named \fBsource\fR exist in the slave interpreter: the alias, and -the hidden command. -.PP -Because a master interpreter may invoke a hidden command as part of -handling an alias invocation, great care must be taken to avoid evaluating -any arguments passed in through the alias invocation. -Otherwise, malicious slave interpreters could cause a trusted master -interpreter to execute dangerous commands on their behalf. See the section -on \fBALIAS INVOCATION\fR for a more complete discussion of this topic. -To help avoid this problem, no substitutions or evaluations are -applied to arguments of \fBinterp invokehidden\fR. -.PP -Safe interpreters are not allowed to invoke hidden commands in themselves -or in their descendants. This prevents safe slaves from gaining access to -hidden functionality in themselves or their descendants. -.PP -The set of hidden commands in an interpreter can be manipulated by a trusted -interpreter using \fBinterp expose\fR and \fBinterp hide\fR. The \fBinterp -expose\fR command moves a hidden command to the -set of exposed commands in the interpreter identified by \fIpath\fR, -potentially renaming the command in the process. If an exposed command by -the targeted name already exists, the operation fails. Similarly, -\fBinterp hide\fR moves an exposed command to the set of hidden commands in -that interpreter. Safe interpreters are not allowed to move commands -between the set of hidden and exposed commands, in either themselves or -their descendants. -.PP -Currently, the names of hidden commands cannot contain namespace -qualifiers, and you must first rename a command in a namespace to the -global namespace before you can hide it. -Commands to be hidden by \fBinterp hide\fR are looked up in the global -namespace even if the current namespace is not the global one. This -prevents slaves from fooling a master interpreter into hiding the wrong -command, by making the current namespace be different from the global one. -.SH "RESOURCE LIMITS" -.PP -Every interpreter has two kinds of resource limits that may be imposed by any -master interpreter upon its slaves. Command limits (of type \fBcommand\fR) -restrict the total number of Tcl commands that may be executed by an -interpreter (as can be inspected via the \fBinfo cmdcount\fR command), and -time limits (of type \fBtime\fR) place a limit by which execution within the -interpreter must complete. Note that time limits are expressed as -\fIabsolute\fR times (as in \fBclock seconds\fR) and not relative times (as in -\fBafter\fR) because they may be modified after creation. -.PP -When a limit is exceeded for an interpreter, first any handler callbacks -defined by master interpreters are called. If those callbacks increase or -remove the limit, execution within the (previously) limited interpreter -continues. If the limit is still in force, an error is generated at that point -and normal processing of errors within the interpreter (by the \fBcatch\fR -command) is disabled, so the error propagates outwards (building a stack-trace -as it goes) to the point where the limited interpreter was invoked (e.g. by -\fBinterp eval\fR) where it becomes the responsibility of the calling code to -catch and handle. -.SS "LIMIT OPTIONS" -.PP -Every limit has a number of options associated with it, some of which are -common across all kinds of limits, and others of which are particular to the -kind of limit. -.TP -\fB\-command\fR -. -This option (common for all limit types) specifies (if non-empty) a Tcl script -to be executed in the global namespace of the interpreter reading and writing -the option when the particular limit in the limited interpreter is exceeded. -The callback may modify the limit on the interpreter if it wishes the limited -interpreter to continue executing. If the callback generates an exception, it -is reported through the background exception mechanism (see -\fBBACKGROUND EXCEPTION HANDLING\fR). -Note that the callbacks defined by one interpreter are -completely isolated from the callbacks defined by another, and that the order -in which those callbacks are called is undefined. -.TP -\fB\-granularity\fR -. -This option (common for all limit types) specifies how frequently (out of the -points when the Tcl interpreter is in a consistent state where limit checking -is possible) that the limit is actually checked. This allows the tuning of how -frequently a limit is checked, and hence how often the limit-checking overhead -(which may be substantial in the case of time limits) is incurred. -.TP -\fB\-milliseconds\fR -. -This option specifies the number of milliseconds after the moment defined in -the \fB\-seconds\fR option that the time limit will fire. It should only ever -be specified in conjunction with the \fB\-seconds\fR option (whether it was -set previously or is being set this invocation.) -.TP -\fB\-seconds\fR -. -This option specifies the number of seconds after the epoch (see \fBclock -seconds\fR) that the time limit for the interpreter will be triggered. The -limit will be triggered at the start of the second unless specified at a -sub-second level using the \fB\-milliseconds\fR option. This option may be the -empty string, which indicates that a time limit is not set for the -interpreter. -.TP -\fB\-value\fR -. -This option specifies the number of commands that the interpreter may execute -before triggering the command limit. This option may be the empty string, -which indicates that a command limit is not set for the interpreter. -.PP -Where an interpreter with a resource limit set on it creates a slave -interpreter, that slave interpreter will have resource limits imposed on it -that are at least as restrictive as the limits on the creating master -interpreter. If the master interpreter of the limited master wishes to relax -these conditions, it should hide the \fBinterp\fR command in the child and -then use aliases and the \fBinterp invokehidden\fR subcommand to provide such -access as it chooses to the \fBinterp\fR command to the limited master as -necessary. -.SH "BACKGROUND EXCEPTION HANDLING" -.PP -When an exception happens in a situation where it cannot be reported directly up -the stack (e.g. when processing events in an \fBupdate\fR or \fBvwait\fR call) -the exception is instead reported through the background exception handling mechanism. -Every interpreter has a background exception handler registered; the default exception -handler arranges for the \fBbgerror\fR command in the interpreter's global -namespace to be called, but other exception handlers may be installed and process -background exceptions in substantially different ways. -.PP -A background exception handler consists of a non-empty list of words to which will -be appended two further words at invocation time. The first word will be the -interpreter result at time of the exception, typically an error message, -and the second will be the dictionary of return options at the time of -the exception. These are the same values that \fBcatch\fR can capture -when it controls script evaluation in a non-background situation. -The resulting list will then be executed -in the interpreter's global namespace without further substitutions being -performed. -.SH CREDITS -The safe interpreter mechanism is based on the Safe-Tcl prototype implemented -by Nathaniel Borenstein and Marshall Rose. -.SH EXAMPLES -.PP -Creating and using an alias for a command in the current interpreter: -.PP -.CS -\fBinterp alias\fR {} getIndex {} lsearch {alpha beta gamma delta} -set idx [getIndex delta] -.CE -.PP -Executing an arbitrary command in a safe interpreter where every -invocation of \fBlappend\fR is logged: -.PP -.CS -set i [\fBinterp create\fR -safe] -\fBinterp hide\fR $i lappend -\fBinterp alias\fR $i lappend {} loggedLappend $i -proc loggedLappend {i args} { - puts "logged invocation of lappend $args" - \fBinterp invokehidden\fR $i lappend {*}$args -} -\fBinterp eval\fR $i $someUntrustedScript -.CE -.PP -Setting a resource limit on an interpreter so that an infinite loop -terminates. -.PP -.CS -set i [\fBinterp create\fR] -\fBinterp limit\fR $i command -value 1000 -\fBinterp eval\fR $i { - set x 0 - while {1} { - puts "Counting up... [incr x]" - } -} -.CE -.SH "SEE ALSO" -bgerror(n), load(n), safe(n), Tcl_CreateSlave(3), Tcl_Eval(3), Tcl_BackgroundException(3) -.SH KEYWORDS -alias, master interpreter, safe interpreter, slave interpreter -'\"Local Variables: -'\"mode: nroff -'\"End: diff --git a/doc/join.n b/doc/join.n deleted file mode 100644 index 23a7697..0000000 --- a/doc/join.n +++ /dev/null @@ -1,44 +0,0 @@ -'\" -'\" 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. -'\" -.TH join n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -join \- Create a string by joining together list elements -.SH SYNOPSIS -\fBjoin \fIlist \fR?\fIjoinString\fR? -.BE -.SH DESCRIPTION -.PP -The \fIlist\fR argument must be a valid Tcl list. -This command returns the string -formed by joining all of the elements of \fIlist\fR together with -\fIjoinString\fR separating each adjacent pair of elements. -The \fIjoinString\fR argument defaults to a space character. -.SH EXAMPLES -.PP -Making a comma-separated list: -.PP -.CS -set data {1 2 3 4 5} -\fBjoin\fR $data ", " - \fB\(-> 1, 2, 3, 4, 5\fR -.CE -.PP -Using \fBjoin\fR to flatten a list by a single level: -.PP -.CS -set data {1 {2 3} 4 {5 {6 7} 8}} -\fBjoin\fR $data - \fB\(-> 1 2 3 4 5 {6 7} 8\fR -.CE -.SH "SEE ALSO" -list(n), lappend(n), split(n) -.SH KEYWORDS -element, join, list, separator diff --git a/doc/lappend.n b/doc/lappend.n deleted file mode 100644 index 80d075a..0000000 --- a/doc/lappend.n +++ /dev/null @@ -1,49 +0,0 @@ -'\" -'\" 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. -'\" -.TH lappend n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -lappend \- Append list elements onto a variable -.SH SYNOPSIS -\fBlappend \fIvarName \fR?\fIvalue value value ...\fR? -.BE -.SH DESCRIPTION -.PP -This command treats the variable given by \fIvarName\fR as a list -and appends each of the \fIvalue\fR arguments to that list as a separate -element, with spaces between elements. -If \fIvarName\fR does not exist, it is created as a list with elements -given by the \fIvalue\fR arguments. -\fBLappend\fR is similar to \fBappend\fR except that the \fIvalue\fRs -are appended as list elements rather than raw text. -This command provides a relatively efficient way to build up -large lists. For example, -.QW "\fBlappend a $b\fR" -is much more efficient than -.QW "\fBset a [concat $a [list $b]]\fR" -when \fB$a\fR is long. -.SH EXAMPLE -.PP -Using \fBlappend\fR to build up a list of numbers. -.PP -.CS -% set var 1 -1 -% \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 diff --git a/doc/lassign.n b/doc/lassign.n deleted file mode 100644 index 5620de6..0000000 --- a/doc/lassign.n +++ /dev/null @@ -1,60 +0,0 @@ -'\" -'\" Copyright (c) 1992-1999 Karl Lehenbauer & Mark Diekhans -'\" 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. -'\" -.TH lassign n 8.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -lassign \- Assign list elements to variables -.SH SYNOPSIS -\fBlassign \fIlist \fR?\fIvarName ...\fR? -.BE -.SH DESCRIPTION -.PP -This command treats the value \fIlist\fR as a list and assigns -successive elements from that list to the variables given by the -\fIvarName\fR arguments in order. If there are more variable names -than list elements, the remaining variables are set to the empty -string. If there are more list elements than variables, a list of -unassigned elements is returned. -.SH EXAMPLES -.PP -An illustration of how multiple assignment works, and what happens -when there are either too few or too many elements. -.PP -.CS -\fBlassign\fR {a b c} x y z ;# Empty return -puts $x ;# Prints "a" -puts $y ;# Prints "b" -puts $z ;# Prints "c" - -\fBlassign\fR {d e} x y z ;# Empty return -puts $x ;# Prints "d" -puts $y ;# Prints "e" -puts $z ;# Prints "" - -\fBlassign\fR {f g h i} x y ;# Returns "h i" -puts $x ;# Prints "f" -puts $y ;# Prints "g" -.CE -.PP -The \fBlassign\fR command has other uses. It can be used to create -the analogue of the -.QW shift -command in many shell languages like this: -.PP -.CS -set ::argv [\fBlassign\fR $::argv argumentToReadOff] -.CE -.SH "SEE ALSO" -lindex(n), list(n), lrange(n), lset(n), set(n) -.SH KEYWORDS -assign, element, list, multiple, set, variable -'\"Local Variables: -'\"mode: nroff -'\"End: diff --git a/doc/library.n b/doc/library.n deleted file mode 100644 index 6f8f265..0000000 --- a/doc/library.n +++ /dev/null @@ -1,320 +0,0 @@ -'\" -'\" 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. -'\" -.TH library n "8.0" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -.SH NAME -auto_execok, auto_import, auto_load, auto_mkindex, auto_qualify, auto_reset, tcl_findLibrary, parray, tcl_endOfWord, tcl_startOfNextWord, tcl_startOfPreviousWord, tcl_wordBreakAfter, tcl_wordBreakBefore \- standard library of Tcl procedures -.SH SYNOPSIS -.nf -\fBauto_execok \fIcmd\fR -\fBauto_import \fIpattern\fR -\fBauto_load \fIcmd\fR -\fBauto_mkindex \fIdir pattern pattern ...\fR -\fBauto_qualify \fIcommand namespace\fR -\fBauto_reset\fR -\fBtcl_findLibrary \fIbasename version patch initScript enVarName varName\fR -\fBparray \fIarrayName\fR ?\fIpattern\fR? -\fBtcl_endOfWord \fIstr start\fR -\fBtcl_startOfNextWord \fIstr start\fR -\fBtcl_startOfPreviousWord \fIstr start\fR -\fBtcl_wordBreakAfter \fIstr start\fR -\fBtcl_wordBreakBefore \fIstr start\fR -.BE -.SH INTRODUCTION -.PP -Tcl includes a library of Tcl procedures for commonly-needed functions. -The procedures defined in the Tcl library are generic ones suitable -for use by many different applications. -The location of the Tcl library is returned by the \fBinfo library\fR -command. -In addition to the Tcl library, each application will normally have -its own library of support procedures as well; the location of this -library is normally given by the value of the \fB$\fIapp\fB_library\fR -global variable, where \fIapp\fR is the name of the application. -For example, the location of the Tk library is kept in the variable -\fBtk_library\fR. -.PP -To access the procedures in the Tcl library, an application should -source the file \fBinit.tcl\fR in the library, for example with -the Tcl command -.PP -.CS -\fBsource [file join [info library] init.tcl]\fR -.CE -.PP -If the library procedure \fBTcl_Init\fR is invoked from an application's -\fBTcl_AppInit\fR procedure, this happens automatically. -The code in \fBinit.tcl\fR will define the \fBunknown\fR procedure -and arrange for the other procedures to be loaded on-demand using -the auto-load mechanism defined below. -.SH "COMMAND PROCEDURES" -.PP -The following procedures are provided in the Tcl library: -.TP -\fBauto_execok \fIcmd\fR -Determines whether there is an executable file or shell builtin -by the name \fIcmd\fR. If so, it returns a list of arguments to be -passed to \fBexec\fR to execute the executable file or shell builtin -named by \fIcmd\fR. If not, it returns an empty string. This command -examines the directories in the current search path (given by the PATH -environment variable) in its search for an executable file named -\fIcmd\fR. On Windows platforms, the search is expanded with the same -directories and file extensions as used by \fBexec\fR. \fBAuto_execok\fR -remembers information about previous searches in an array named -\fBauto_execs\fR; this avoids the path search in future calls for the -same \fIcmd\fR. The command \fBauto_reset\fR may be used to force -\fBauto_execok\fR to forget its cached information. -.TP -\fBauto_import \fIpattern\fR -\fBAuto_import\fR is invoked during \fBnamespace import\fR to see if -the imported commands specified by \fIpattern\fR reside in an -autoloaded library. If so, the commands are loaded so that they will -be available to the interpreter for creating the import links. If the -commands do not reside in an autoloaded library, \fBauto_import\fR -does nothing. The pattern matching is performed according to the -matching rules of \fBnamespace import\fR. -.TP -\fBauto_load \fIcmd\fR -This command attempts to load the definition for a Tcl command named -\fIcmd\fR. To do this, it searches an \fIauto-load path\fR, which is -a list of one or more directories. The auto-load path is given by the -global variable \fBauto_path\fR if it exists. If there is no -\fBauto_path\fR variable, then the TCLLIBPATH environment variable is -used, if it exists. Otherwise the auto-load path consists of just the -Tcl library directory. Within each directory in the auto-load path -there must be a file \fBtclIndex\fR that describes one or more -commands defined in that directory and a script to evaluate to load -each of the commands. The \fBtclIndex\fR file should be generated -with the \fBauto_mkindex\fR command. If \fIcmd\fR is found in an -index file, then the appropriate script is evaluated to create the -command. The \fBauto_load\fR command returns 1 if \fIcmd\fR was -successfully created. The command returns 0 if there was no index -entry for \fIcmd\fR or if the script did not actually define \fIcmd\fR -(e.g. because index information is out of date). If an error occurs -while processing the script, then that error is returned. -\fBAuto_load\fR only reads the index information once and saves it in -the array \fBauto_index\fR; future calls to \fBauto_load\fR check for -\fIcmd\fR in the array rather than re-reading the index files. The -cached index information may be deleted with the command -\fBauto_reset\fR. This will force the next \fBauto_load\fR command to -reload the index database from disk. -.TP -\fBauto_mkindex \fIdir pattern pattern ...\fR -. -Generates an index suitable for use by \fBauto_load\fR. The command -searches \fIdir\fR for all files whose names match any of the -\fIpattern\fR arguments (matching is done with the \fBglob\fR -command), generates an index of all the Tcl command procedures defined -in all the matching files, and stores the index information in a file -named \fBtclIndex\fR in \fIdir\fR. If no pattern is given a pattern of -\fB*.tcl\fR will be assumed. For example, the command -.RS -.PP -.CS -\fBauto_mkindex foo *.tcl\fR -.CE -.PP -will read all the \fB.tcl\fR files in subdirectory \fBfoo\fR and -generate a new index file \fBfoo/tclIndex\fR. -.PP -\fBAuto_mkindex\fR parses the Tcl scripts by sourcing them into a -slave interpreter and monitoring the proc and namespace commands that -are executed. Extensions can use the (undocumented) -auto_mkindex_parser package to register other commands that can -contribute to the auto_load index. You will have to read through -auto.tcl to see how this works. -.PP -\fBAuto_mkindex_old\fR -(which has the same syntax as \fBauto_mkindex\fR) -parses the Tcl scripts in a relatively -unsophisticated way: if any line contains the word -.QW \fBproc\fR -as its first characters then it is assumed to be a procedure -definition and the next word of the line is taken as the -procedure's name. -Procedure definitions that do not appear in this way (e.g.\ they -have spaces before the \fBproc\fR) will not be indexed. If your -script contains -.QW dangerous -code, such as global initialization -code or procedure names with special characters like \fB$\fR, -\fB*\fR, \fB[\fR or \fB]\fR, you are safer using \fBauto_mkindex_old\fR. -.RE -.TP -\fBauto_reset\fR -. -Destroys all the information cached by \fBauto_execok\fR and -\fBauto_load\fR. This information will be re-read from disk the next -time it is needed. \fBAuto_reset\fR also deletes any procedures -listed in the auto-load index, so that fresh copies of them will be -loaded the next time that they are used. -.TP -\fBauto_qualify \fIcommand namespace\fR -Computes a list of fully qualified names for \fIcommand\fR. This list -mirrors the path a standard Tcl interpreter follows for command -lookups: first it looks for the command in the current namespace, and -then in the global namespace. Accordingly, if \fIcommand\fR is -relative and \fInamespace\fR is not \fB::\fR, the list returned has -two elements: \fIcommand\fR scoped by \fInamespace\fR, as if it were -a command in the \fInamespace\fR namespace; and \fIcommand\fR as if it -were a command in the global namespace. Otherwise, if either -\fIcommand\fR is absolute (it begins with \fB::\fR), or -\fInamespace\fR is \fB::\fR, the list contains only \fIcommand\fR as -if it were a command in the global namespace. -.RS -.PP -\fBAuto_qualify\fR is used by the auto-loading facilities in Tcl, both -for producing auto-loading indexes such as \fIpkgIndex.tcl\fR, and for -performing the actual auto-loading of functions at runtime. -.RE -.TP -\fBtcl_findLibrary \fIbasename version patch initScript enVarName varName\fR -This is a standard search procedure for use by extensions during -their initialization. They call this procedure to look for their -script library in several standard directories. -The last component of the name of the library directory is -normally \fIbasenameversion\fR -(e.g., tk8.0), but it might be -.QW library -when in the build hierarchies. -The \fIinitScript\fR file will be sourced into the interpreter -once it is found. The directory in which this file is found is -stored into the global variable \fIvarName\fR. -If this variable is already defined (e.g., by C code during -application initialization) then no searching is done. -Otherwise the search looks in these directories: -the directory named by the environment variable \fIenVarName\fR; -relative to the Tcl library directory; -relative to the executable file in the standard installation -bin or bin/\fIarch\fR directory; -relative to the executable file in the current build tree; -relative to the executable file in a parallel build tree. -.TP -\fBparray \fIarrayName\fR ?\fIpattern\fR? -Prints on standard output the names and values of all the elements in the -array \fIarrayName\fR, or just the names that match \fIpattern\fR (using the -matching rules of \fBstring match\fR) and their values if \fIpattern\fR is -given. -\fIArrayName\fR must be an array accessible to the caller of \fBparray\fR. -It may be either local or global. -.TP -\fBtcl_endOfWord \fIstr start\fR -Returns the index of the first end-of-word location that occurs after -a starting index \fIstart\fR in the string \fIstr\fR. An end-of-word -location is defined to be the first non-word character following the -first word character after the starting point. Returns -1 if there -are no more end-of-word locations after the starting point. See the -description of \fBtcl_wordchars\fR and \fBtcl_nonwordchars\fR below -for more details on how Tcl determines which characters are word -characters. -.TP -\fBtcl_startOfNextWord \fIstr start\fR -Returns the index of the first start-of-word location that occurs -after a starting index \fIstart\fR in the string \fIstr\fR. A -start-of-word location is defined to be the first word character -following a non-word character. Returns \-1 if there are no more -start-of-word locations after the starting point. -.TP -\fBtcl_startOfPreviousWord \fIstr start\fR -Returns the index of the first start-of-word location that occurs -before a starting index \fIstart\fR in the string \fIstr\fR. Returns -\-1 if there are no more start-of-word locations before the starting -point. -.TP -\fBtcl_wordBreakAfter \fIstr start\fR -Returns the index of the first word boundary after the starting index -\fIstart\fR in the string \fIstr\fR. Returns \-1 if there are no more -boundaries after the starting point in the given string. The index -returned refers to the second character of the pair that comprises a -boundary. -.TP -\fBtcl_wordBreakBefore \fIstr start\fR -Returns the index of the first word boundary before the starting index -\fIstart\fR in the string \fIstr\fR. Returns \-1 if there are no more -boundaries before the starting point in the given string. The index -returned refers to the second character of the pair that comprises a -boundary. -.SH "VARIABLES" -.PP -The following global variables are defined or used by the procedures in -the Tcl library. They fall into two broad classes, handling unknown -commands and packages, and determining what are words. -.SS "AUTOLOADING AND PACKAGE MANAGEMENT VARIABLES" -.TP -\fBauto_execs\fR -Used by \fBauto_execok\fR to record information about whether -particular commands exist as executable files. -.TP -\fBauto_index\fR -Used by \fBauto_load\fR to save the index information read from -disk. -.TP -\fBauto_noexec\fR -If set to any value, then \fBunknown\fR will not attempt to auto-exec -any commands. -.TP -\fBauto_noload\fR -If set to any value, then \fBunknown\fR will not attempt to auto-load -any commands. -.TP -\fBauto_path\fR -. -If set, then it must contain a valid Tcl list giving directories to -search during auto-load operations (including for package index -files when using the default \fBpackage unknown\fR handler). -This variable is initialized during startup to contain, in order: -the directories listed in the \fBTCLLIBPATH\fR environment variable, -the directory named by the \fBtcl_library\fR global variable, -the parent directory of \fBtcl_library\fR, -the directories listed in the \fBtcl_pkgPath\fR variable. -Additional locations to look for files and package indices should -normally be added to this variable using \fBlappend\fR. -.TP -\fBenv(TCL_LIBRARY)\fR -If set, then it specifies the location of the directory containing -library scripts (the value of this variable will be -assigned to the \fBtcl_library\fR variable and therefore returned by -the command \fBinfo library\fR). If this variable is not set then -a default value is used. -.TP -\fBenv(TCLLIBPATH)\fR -If set, then it must contain a valid Tcl list giving directories to -search during auto-load operations. Directories must be specified in -Tcl format, using -.QW / -as the path separator, regardless of platform. -This variable is only used when initializing the \fBauto_path\fR variable. -.SS "WORD BOUNDARY DETERMINATION VARIABLES" -These variables are only used in the \fBtcl_endOfWord\fR, -\fBtcl_startOfNextWord\fR, \fBtcl_startOfPreviousWord\fR, -\fBtcl_wordBreakAfter\fR, and \fBtcl_wordBreakBefore\fR commands. -.TP -\fBtcl_nonwordchars\fR -This variable contains a regular expression that is used by routines -like \fBtcl_endOfWord\fR to identify whether a character is part of a -word or not. If the pattern matches a character, the character is -considered to be a non-word character. On Windows platforms, spaces, -tabs, and newlines are considered non-word characters. Under Unix, -everything but numbers, letters and underscores are considered -non-word characters. -.TP -\fBtcl_wordchars\fR -This variable contains a regular expression that is used by routines -like \fBtcl_endOfWord\fR to identify whether a character is part of a -word or not. If the pattern matches a character, the character is -considered to be a word character. On Windows platforms, words are -comprised of any character that is not a space, tab, or newline. Under -Unix, words are comprised of numbers, letters or underscores. -.SH "SEE ALSO" -env(n), info(n), re_syntax(n) -.SH KEYWORDS -auto-exec, auto-load, library, unknown, word, whitespace -'\"Local Variables: -'\"mode: nroff -'\"End: diff --git a/doc/lindex.n b/doc/lindex.n deleted file mode 100644 index d5605bc..0000000 --- a/doc/lindex.n +++ /dev/null @@ -1,125 +0,0 @@ -'\" -'\" 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. -'\" -.TH lindex n 8.4 Tcl "Tcl Built-In Commands" -.so man.macros -.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\fR command accepts a parameter, \fIlist\fR, which -it treats as a Tcl list. It also accepts zero or more \fIindices\fR 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: -.PP -.CS -\fBlindex \fIlist\fR -.CE -.PP -or -.PP -.CS -\fBlindex \fIlist\fR {} -.CE -.PP -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. -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. -.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, -.PP -.CS -\fBlindex\fR $a 1 2 3 -.CE -.PP -or -.PP -.CS -\fBlindex\fR $a {1 2 3} -.CE -.PP -is synonymous with -.PP -.CS -\fBlindex\fR [\fBlindex\fR [\fBlindex\fR $a 1] 2] 3 -.CE -.SH EXAMPLES -.PP -Lists can be indexed into from either end: -.PP -.CS -\fBlindex\fR {a b c} 0 - \fI\(-> a\fR -\fBlindex\fR {a b c} 2 - \fI\(-> c\fR -\fBlindex\fR {a b c} end - \fI\(-> c\fR -\fBlindex\fR {a b c} end-1 - \fI\(-> b\fR -.CE -.PP -Lists or sequences of indices allow selection into lists of lists: -.PP -.CS -\fBlindex\fR {a b c} - \fI\(-> a b c\fR -\fBlindex\fR {a b c} {} - \fI\(-> a b c\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 -.PP -List indices may also perform limited computation, adding or subtracting fixed -amounts from other indices: -.PP -.CS -set idx 1 -\fBlindex\fR {a b c d e f} $idx+2 - \fI\(-> d\fR -set idx 3 -\fBlindex\fR {a b c d e f} $idx+2 - \fI\(-> f\fR -.CE -.SH "SEE ALSO" -list(n), lappend(n), linsert(n), llength(n), lsearch(n), -lset(n), lsort(n), lrange(n), lreplace(n), -string(n) -.SH KEYWORDS -element, index, list -'\"Local Variables: -'\"mode: nroff -'\"End: diff --git a/doc/linsert.n b/doc/linsert.n deleted file mode 100644 index 91db726..0000000 --- a/doc/linsert.n +++ /dev/null @@ -1,55 +0,0 @@ -'\" -'\" 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. -'\" -.TH linsert n 8.2 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -linsert \- Insert elements into a list -.SH SYNOPSIS -\fBlinsert \fIlist index \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, and if \fIindex\fR is -greater or equal to the length of \fIlist\fR, it is as if it was \fBend\fR. -As with \fBstring index\fR, the \fIindex\fR value supports both simple index -arithmetic and end-relative indexing. -.PP -Subject to the restrictions that indices must refer to locations inside the -list and that the \fIelement\fRs will always be inserted in order, insertions -are done so that when \fIindex\fR is start-relative, the first \fIelement\fR -will be at that index in the resulting list, and when \fIindex\fR is -end-relative, the last \fIelement\fR will be at that index in the resulting -list. -.SH EXAMPLE -.PP -Putting some values into a list, first indexing from the start and -then indexing from the end, and then chaining them together: -.PP -.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), -string(n) -.SH KEYWORDS -element, insert, list -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/list.n b/doc/list.n deleted file mode 100644 index a182fc8..0000000 --- a/doc/list.n +++ /dev/null @@ -1,56 +0,0 @@ -'\" -'\" 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. -'\" -.TH list n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -list \- Create a list -.SH SYNOPSIS -\fBlist \fR?\fIarg arg ...\fR? -.BE -.SH DESCRIPTION -.PP -This command returns a list comprised of all the \fIarg\fRs, -or an empty string if no \fIarg\fRs are specified. -Braces and backslashes get added as necessary, so that the \fBlindex\fR command -may be used on the result to re-extract the original arguments, and also -so that \fBeval\fR may be used to execute the resulting list, with -\fIarg1\fR comprising the command's name and the other \fIarg\fRs comprising -its arguments. \fBList\fR produces slightly different results than -\fBconcat\fR: \fBconcat\fR removes one level of grouping before forming -the list, while \fBlist\fR works directly from the original arguments. -.SH EXAMPLE -.PP -The command -.PP -.CS -\fBlist\fR a b "c d e " " f {g h}" -.CE -.PP -will return -.PP -.CS -\fBa b {c d e } { f {g h}}\fR -.CE -.PP -while \fBconcat\fR with the same arguments will return -.PP -.CS -\fBa b c d e f {g h}\fR -.CE -.SH "SEE ALSO" -lappend(n), lindex(n), linsert(n), llength(n), lrange(n), -lrepeat(n), -lreplace(n), lsearch(n), lset(n), lsort(n) -.SH KEYWORDS -element, list, quoting -'\"Local Variables: -'\"mode: nroff -'\"End: diff --git a/doc/llength.n b/doc/llength.n deleted file mode 100644 index 79f93c0..0000000 --- a/doc/llength.n +++ /dev/null @@ -1,55 +0,0 @@ -'\" -'\" 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. -'\" -.TH llength n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -llength \- Count the number of elements in a list -.SH SYNOPSIS -\fBllength \fIlist\fR -.BE -.SH DESCRIPTION -.PP -Treats \fIlist\fR as a list and returns a decimal string giving -the number of elements in it. -.SH EXAMPLES -.PP -The result is the number of elements: -.PP -.CS -% \fBllength\fR {a b c d e} -5 -% \fBllength\fR {a b c} -3 -% \fBllength\fR {} -0 -.CE -.PP -Elements are not guaranteed to be exactly words in a dictionary sense -of course, especially when quoting is used: -.PP -.CS -% \fBllength\fR {a b {c d} e} -4 -% \fBllength\fR {a b { } c d e} -6 -.CE -.PP -An empty list is not necessarily an empty string: -.PP -.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 diff --git a/doc/lmap.n b/doc/lmap.n deleted file mode 100644 index 1a7858d..0000000 --- a/doc/lmap.n +++ /dev/null @@ -1,85 +0,0 @@ -'\" -'\" Copyright (c) 2012 Trevor Davel -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH lmap n "" Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -lmap \- Iterate over all elements in one or more lists and collect results -.SH SYNOPSIS -\fBlmap \fIvarname list body\fR -.br -\fBlmap \fIvarlist1 list1\fR ?\fIvarlist2 list2 ...\fR? \fIbody\fR -.BE -.SH DESCRIPTION -.PP -The \fBlmap\fR command implements a loop where the loop variable(s) take on -values from one or more lists, and the loop returns a list of results -collected from each iteration. -.PP -In the simplest case there is one loop variable, \fIvarname\fR, and one list, -\fIlist\fR, that is a list of values to assign to \fIvarname\fR. The -\fIbody\fR argument is a Tcl script. For each element of \fIlist\fR (in order -from first to last), \fBlmap\fR assigns the contents of the element to -\fIvarname\fR as if the \fBlindex\fR command had been used to extract the -element, then calls the Tcl interpreter to execute \fIbody\fR. If execution of -the body completes normally then the result of the body is appended to an -accumulator list. \fBlmap\fR returns the accumulator list. -.PP -In the general case there can be more than one value list (e.g., \fIlist1\fR -and \fIlist2\fR), and each value list can be associated with a list of loop -variables (e.g., \fIvarlist1\fR and \fIvarlist2\fR). During each iteration of -the loop the variables of each \fIvarlist\fR are assigned consecutive values -from the corresponding \fIlist\fR. Values in each \fIlist\fR are used in order -from first to last, and each value is used exactly once. The total number of -loop iterations is large enough to use up all the values from all the value -lists. If a value list does not contain enough elements for each of its loop -variables in each iteration, empty values are used for the missing elements. -.PP -The \fBbreak\fR and \fBcontinue\fR statements may be invoked inside -\fIbody\fR, with the same effect as in the \fBfor\fR and \fBforeach\fR -commands. In these cases the body does not complete normally and the result is -not appended to the accumulator list. -.SH EXAMPLES -.PP -Zip lists together: -.PP -.CS -set list1 {a b c d} -set list2 {1 2 3 4} -set zipped [\fBlmap\fR a $list1 b $list2 {list $a $b}] -# The value of zipped is "{a 1} {b 2} {c 3} {d 4}" -.CE -.PP -Filter a list to remove odd values: -.PP -.CS -set values {1 2 3 4 5 6 7 8} -proc isEven {n} {expr {($n % 2) == 0}} -set goodOnes [\fBlmap\fR x $values {expr { - [isEven $x] ? $x : [continue] -}}] -# The value of goodOnes is "2 4 6 8" -.CE -.PP -Take a prefix from a list based on the contents of the list: -.PP -.CS -set values {8 7 6 5 4 3 2 1} -proc isGood {counter} {expr {$n > 3}} -set prefix [\fBlmap\fR x $values {expr { - [isGood $x] ? $x : [break] -}}] -# The value of prefix is "8 7 6 5 4" -.CE -.SH "SEE ALSO" -break(n), continue(n), for(n), foreach(n), while(n) -.SH KEYWORDS -foreach, iteration, list, loop, map -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/load.n b/doc/load.n deleted file mode 100644 index b592bb3..0000000 --- a/doc/load.n +++ /dev/null @@ -1,196 +0,0 @@ -'\" -'\" 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. -'\" -.TH load n 7.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -load \- Load machine code and initialize new commands -.SH SYNOPSIS -\fBload\fR ?\fB\-global\fR? ?\fB\-lazy\fR? ?\fB\-\-\fR? \fIfileName\fR -.br -\fBload\fR ?\fB\-global\fR? ?\fB\-lazy\fR? ?\fB\-\-\fR? \fIfileName packageName\fR -.br -\fBload\fR ?\fB\-global\fR? ?\fB\-lazy\fR? ?\fB\-\-\fR? \fIfileName packageName interp\fR -.BE -.SH DESCRIPTION -.PP -This command loads binary code from a file into the -application's address space and calls an initialization procedure -in the package to incorporate it into an interpreter. \fIfileName\fR -is the name of the file containing the code; its exact form varies -from system to system but on most systems it is a shared library, -such as a \fB.so\fR file under Solaris or a DLL under Windows. -\fIpackageName\fR is the name of the package, and is used to -compute the name of an initialization procedure. -\fIinterp\fR is the path name of the interpreter into which to load -the package (see the \fBinterp\fR manual entry for details); -if \fIinterp\fR is omitted, it defaults to the -interpreter in which the \fBload\fR command was invoked. -.PP -Once the file has been loaded into the application's address space, -one of two initialization procedures will be invoked in the new code. -Typically the initialization procedure will add new commands to a -Tcl interpreter. -The name of the initialization procedure is determined by -\fIpackageName\fR and whether or not the target interpreter -is a safe one. For normal interpreters the name of the initialization -procedure will have the form \fIpkg\fB_Init\fR, where \fIpkg\fR -is the same as \fIpackageName\fR except that the first letter is -converted to upper case and all other letters -are converted to lower case. For example, if \fIpackageName\fR is -\fBfoo\fR or \fBFOo\fR, the initialization procedure's name will -be \fBFoo_Init\fR. -.PP -If the target interpreter is a safe interpreter, then the name -of the initialization procedure will be \fIpkg\fB_SafeInit\fR -instead of \fIpkg\fB_Init\fR. -The \fIpkg\fB_SafeInit\fR function should be written carefully, so that it -initializes the safe interpreter only with partial functionality provided -by the package that is safe for use by untrusted code. For more information -on Safe\-Tcl, see the \fBsafe\fR manual entry. -.PP -The initialization procedure must match the following prototype: -.PP -.CS -typedef int \fBTcl_PackageInitProc\fR( - Tcl_Interp *\fIinterp\fR); -.CE -.PP -The \fIinterp\fR argument identifies the interpreter in which the -package is to be loaded. The initialization procedure must return -\fBTCL_OK\fR or \fBTCL_ERROR\fR to indicate whether or not it completed -successfully; in the event of an error it should set the interpreter's result -to point to an error message. The result of the \fBload\fR command -will be the result returned by the initialization procedure. -.PP -The actual loading of a file will only be done once for each \fIfileName\fR -in an application. If a given \fIfileName\fR is loaded into multiple -interpreters, then the first \fBload\fR will load the code and -call the initialization procedure; subsequent \fBload\fRs will -call the initialization procedure without loading the code again. -For Tcl versions lower than 8.5, it is not possible to unload or reload a -package. From version 8.5 however, the \fBunload\fR command allows the unloading -of libraries loaded with \fBload\fR, for libraries that are aware of the -Tcl's unloading mechanism. -.PP -The \fBload\fR command also supports packages that are statically -linked with the application, if those packages have been registered -by calling the \fBTcl_StaticPackage\fR procedure. -If \fIfileName\fR is an empty string, then \fIpackageName\fR must -be specified. -.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. -.PP -If \fB\-global\fR is specified preceding the filename, all symbols -found in the shared library are exported for global use by other -libraries. The option \fB\-lazy\fR delays the actual loading of -symbols until their first actual use. The options may be abbreviated. -The option \fB\-\-\fR indicates the end of the options, and should -be used if you wish to use a filename which starts with \fB\-\fR -and you provide a packageName to the \fBload\fR command. -.PP -On platforms which do not support the \fB\-global\fR or \fB\-lazy\fR -options, the options still exist but have no effect. Note that use -of the \fB\-global\fR or \fB\-lazy\fR option may lead to crashes -in your application later (in case of symbol conflicts resp. missing -symbols), which cannot be detected during the \fBload\fR. So, only -use this when you know what you are doing, you will not get a nice -error message when something is wrong with the loaded library. -.SH "PORTABILITY ISSUES" -.TP -\fBWindows\fR\0\0\0\0\0 -. -When a load fails with -.QW "library not found" -error, it is also possible -that a dependent library was not found. To see the dependent libraries, -type -.QW "dumpbin -imports " -in a DOS console to see what the library must import. -When loading a DLL in the current directory, Windows will ignore -.QW ./ -as a path specifier and use a search heuristic to find the DLL instead. -To avoid this, load the DLL with: -.RS -.PP -.CS -\fBload\fR [file join [pwd] mylib.DLL] -.CE -.RE -.SH BUGS -.PP -If the same file is \fBload\fRed by different \fIfileName\fRs, it will -be loaded into the process's address space multiple times. The -behavior of this varies from system to system (some systems may -detect the redundant loads, others may not). -.SH EXAMPLE -.PP -The following is a minimal extension: -.PP -.CS -#include -#include -static int fooCmd(ClientData clientData, - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - printf("called with %d arguments\en", objc); - return TCL_OK; -} -int Foo_Init(Tcl_Interp *interp) { - if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { - return TCL_ERROR; - } - printf("creating foo command"); - Tcl_CreateObjCommand(interp, "foo", fooCmd, NULL, NULL); - return TCL_OK; -} -.CE -.PP -When built into a shared/dynamic library with a suitable name -(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 [file join [pwd] libfoo[info sharedlibextension]] - } -} - -# Now execute the command defined by the extension -foo -.CE -.SH "SEE ALSO" -info sharedlibextension, package(n), Tcl_StaticPackage(3), safe(n) -.SH KEYWORDS -binary code, dynamic library, load, safe interpreter, shared library -'\"Local Variables: -'\"mode: nroff -'\"End: diff --git a/doc/lrange.n b/doc/lrange.n deleted file mode 100644 index ffa6dba..0000000 --- a/doc/lrange.n +++ /dev/null @@ -1,78 +0,0 @@ -'\" -'\" 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. -'\" -.TH lrange n 7.4 Tcl "Tcl Built-In Commands" -.so man.macros -.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. -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. -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: -.QW "\fBlrange \fIlist first first\fR" -does not always produce the same result as -.QW "\fBlindex \fIlist first\fR" -(although it often does for simple fields that are not enclosed in -braces); it does, however, produce exactly the same results as -.QW "\fBlist [lindex \fIlist first\fB]\fR" -.SH EXAMPLES -.PP -Selecting the first two elements: -.PP -.CS -% \fBlrange\fR {a b c d e} 0 1 -a b -.CE -.PP -Selecting the last three elements: -.PP -.CS -% \fBlrange\fR {a b c d e} end-2 end -c d e -.CE -.PP -Selecting everything except the first and last element: -.PP -.CS -% \fBlrange\fR {a b c d e} 1 end-1 -b c d -.CE -.PP -Selecting a single element with \fBlrange\fR is not the same as doing -so with \fBlindex\fR: -.PP -.CS -% set var {some {elements to} select} -some {elements to} select -% 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), -string(n) -.SH KEYWORDS -element, list, range, sublist diff --git a/doc/lrepeat.n b/doc/lrepeat.n deleted file mode 100644 index f92792e..0000000 --- a/doc/lrepeat.n +++ /dev/null @@ -1,38 +0,0 @@ -'\" -'\" Copyright (c) 2003 by Simon Geard. All rights reserved. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH lrepeat n 8.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -lrepeat \- Build a list by repeating elements -.SH SYNOPSIS -\fBlrepeat \fIcount \fR?\fIelement ...\fR? -.BE -.SH DESCRIPTION -.PP -The \fBlrepeat\fR command creates a list of size \fIcount * number of -elements\fR by repeating \fIcount\fR times the sequence of elements -\fIelement ...\fR. \fIcount\fR must be a non-negative integer, -\fIelement\fR can be any Tcl value. Note that \fBlrepeat 1 element ...\fR -is identical to \fBlist element ...\fR. -.SH EXAMPLES -.CS -\fBlrepeat\fR 3 a - \fI\(-> a a a\fR -\fBlrepeat\fR 3 [\fBlrepeat\fR 3 0] - \fI\(-> {0 0 0} {0 0 0} {0 0 0}\fR -\fBlrepeat\fR 3 a b c - \fI\(-> a b c a b c a b c\fR -\fBlrepeat\fR 3 [\fBlrepeat\fR 2 a] b c - \fI\(-> {a a} b c {a a} b c {a a} b c\fR -.CE -.SH "SEE ALSO" -list(n), lappend(n), linsert(n), llength(n), lset(n) - -.SH KEYWORDS -element, index, list diff --git a/doc/lreplace.n b/doc/lreplace.n deleted file mode 100644 index d19f0cd..0000000 --- a/doc/lreplace.n +++ /dev/null @@ -1,86 +0,0 @@ -'\" -'\" 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. -'\" -.TH lreplace n 7.4 Tcl "Tcl Built-In Commands" -.so man.macros -.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. -\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. -.PP -If \fIfirst\fR is less than zero, it is considered to refer to before the -first element of the list. For non-empty lists, the element indicated -by \fIfirst\fR must exist or \fIfirst\fR must indicate before the -start of the list. -.PP -If \fIlast\fR is less than \fIfirst\fR, then any specified elements -will be inserted into the list before the point specified by \fIfirst\fR -with no elements being deleted. -.PP -The \fIelement\fR arguments specify zero or more new arguments to -be added to the list in place of those that were deleted. -Each \fIelement\fR argument will become a separate element of -the list. If no \fIelement\fR arguments are specified, then the elements -between \fIfirst\fR and \fIlast\fR are simply deleted. If \fIlist\fR -is empty, any \fIelement\fR arguments are added to the end of the list. -.SH EXAMPLES -.PP -Replacing an element of a list with another: -.PP -.CS -% \fBlreplace\fR {a b c d e} 1 1 foo -a foo c d e -.CE -.PP -Replacing two elements of a list with three: -.PP -.CS -% \fBlreplace\fR {a b c d e} 1 2 three more elements -a three more elements d e -.CE -.PP -Deleting the last element from a list in a variable: -.PP -.CS -% set var {a b c d e} -a b c d e -% set var [\fBlreplace\fR $var end end] -a b c d -.CE -.PP -A procedure to delete a given element from a list: -.PP -.CS -proc lremove {listVariable value} { - upvar 1 $listVariable var - set idx [lsearch -exact $var $value] - set var [\fBlreplace\fR $var $idx $idx] -} -.CE -.SH "SEE ALSO" -list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n), -lset(n), lrange(n), lsort(n), -string(n) -.SH KEYWORDS -element, list, replace diff --git a/doc/lreverse.n b/doc/lreverse.n deleted file mode 100644 index 4c2f762..0000000 --- a/doc/lreverse.n +++ /dev/null @@ -1,34 +0,0 @@ -'\" -'\" Copyright (c) 2006 by Donal K. Fellows. All rights reserved. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH lreverse n 8.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -lreverse \- Reverse the order of a list -.SH SYNOPSIS -\fBlreverse \fIlist\fR -.BE -.SH DESCRIPTION -.PP -The \fBlreverse\fR command returns a list that has the same elements as its -input list, \fIlist\fR, except with the elements in the reverse order. -.SH EXAMPLES -.CS -\fBlreverse\fR {a a b c} - \fI\(-> c b a a\fR -\fBlreverse\fR {a b {c d} e f} - \fI\(-> f e {c d} b a\fR -.CE -.SH "SEE ALSO" -list(n), lsearch(n), lsort(n) - -.SH KEYWORDS -element, list, reverse -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/lsearch.n b/doc/lsearch.n deleted file mode 100644 index c2644b8..0000000 --- a/doc/lsearch.n +++ /dev/null @@ -1,220 +0,0 @@ -'\" -'\" 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. -'\" -.TH lsearch n 8.6 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -lsearch \- See if a list contains a particular element -.SH SYNOPSIS -\fBlsearch \fR?\fIoptions\fR? \fIlist pattern\fR -.BE -.SH DESCRIPTION -.PP -This command searches the elements of \fIlist\fR to see if one -of them matches \fIpattern\fR. If so, the command returns the index -of the first matching element -(unless the options \fB\-all\fR or \fB\-inline\fR are specified.) -If not, the command returns \fB\-1\fR. The \fIoption\fR arguments -indicates how the elements of the list are to be matched against -\fIpattern\fR and must have one of the values below: -.SS "MATCHING STYLE OPTIONS" -.PP -If all matching style options are omitted, the default matching style -is \fB\-glob\fR. If more than one matching style is specified, the -last matching style given takes precedence. -.TP -\fB\-exact\fR -. -\fIPattern\fR is a literal string that is compared for exact equality -against each list element. -.TP -\fB\-glob\fR -. -\fIPattern\fR is a glob-style pattern which is matched against each list -element using the same rules as the \fBstring match\fR command. -.TP -\fB\-regexp\fR -. -\fIPattern\fR is treated as a regular expression and matched against -each list element using the rules described in the \fBre_syntax\fR -reference page. -.TP -\fB\-sorted\fR -. -The list elements are in sorted order. If this option is specified, -\fBlsearch\fR will use a more efficient searching algorithm to search -\fIlist\fR. If no other options are specified, \fIlist\fR is assumed -to be sorted in increasing order, and to contain ASCII strings. This -option is mutually exclusive with \fB\-glob\fR and \fB\-regexp\fR, and -is treated exactly like \fB\-exact\fR when either \fB\-all\fR or -\fB\-not\fR are specified. -.SS "GENERAL MODIFIER OPTIONS" -.PP -These options may be given with all matching styles. -.TP -\fB\-all\fR -. -Changes the result to be the list of all matching indices (or all matching -values if \fB\-inline\fR is specified as well.) If indices are returned, the -indices will be in numeric order. If values are returned, the order of the -values will be the order of those values within the input \fIlist\fR. -.TP -\fB\-inline\fR -. -The matching value is returned instead of its index (or an empty -string if no value matches.) If \fB\-all\fR is also specified, then -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. -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. -.SS "CONTENTS DESCRIPTION OPTIONS" -.PP -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. -.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. -.TP -\fB\-real\fR -. -The list elements are to be compared as floating-point values. -.SS "SORTED LIST OPTIONS" -.PP -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. -.TP -\fB\-decreasing\fR -. -The list elements are sorted in decreasing order. This option is only -meaningful when used with \fB\-sorted\fR. -.TP -\fB\-increasing\fR -. -The list elements are sorted in increasing order. This option is only -meaningful when used with \fB\-sorted\fR. -.TP -\fB\-bisect\fR -.VS 8.6 -Inexact search when the list elements are in sorted order. For an increasing -list the last index where the element is less than or equal to the pattern -is returned. For a decreasing list the last index where the element is greater -than or equal to the pattern is returned. If the pattern is before the first -element or the list is empty, -1 is returned. -This option implies \fB\-sorted\fR and cannot be used with either \fB\-all\fR -or \fB\-not\fR. -.VE 8.6 -.SS "NESTED LIST OPTIONS" -.PP -These options are used to search lists of lists. They may be used -with any other options. -.TP -\fB\-index\fR\0\fIindexList\fR -. -This option is designed for use when searching within nested lists. -The \fIindexList\fR argument gives a path of indices (much as might be -used with the \fBlindex\fR or \fBlset\fR commands) within each element -to allow the location of the term being matched against. -.TP -\fB\-subindices\fR -. -If this option is given, the index result from this command (or every -index result when \fB\-all\fR is also specified) will be a complete -path (suitable for use with \fBlindex\fR or \fBlset\fR) within the -overall list to the term found. This option has no effect unless the -\fB\-index\fR is also specified, and is just a convenience short-cut. -.SH EXAMPLES -.PP -Basic searching: -.PP -.CS -\fBlsearch\fR {a b c d e} c - \fI\(-> 2\fR -\fBlsearch\fR -all {a b c a b c} c - \fI\(-> 2 5\fR -.CE -.PP -Using \fBlsearch\fR to filter lists: -.PP -.CS -\fBlsearch\fR -inline {a20 b35 c47} b* - \fI\(-> b35\fR -\fBlsearch\fR -inline -not {a20 b35 c47} b* - \fI\(-> a20\fR -\fBlsearch\fR -all -inline -not {a20 b35 c47} b* - \fI\(-> a20 c47\fR -\fBlsearch\fR -all -not {a20 b35 c47} b* - \fI\(-> 0 2\fR -.CE -.PP -This can even do a -.QW set-like -removal operation: -.PP -.CS -\fBlsearch\fR -all -inline -not -exact {a b c a d e a f g a} a - \fI\(-> b c d e f g\fR -.CE -.PP -Searching may start part-way through the list: -.PP -.CS -\fBlsearch\fR -start 3 {a b c a b c} c - \fI\(-> 5\fR -.CE -.PP -It is also possible to search inside elements: -.PP -.CS -\fBlsearch\fR -index 1 -all -inline {{a abc} {b bcd} {c cde}} *bc* - \fI\(-> {a abc} {b bcd}\fR -.CE -.SH "SEE ALSO" -foreach(n), list(n), lappend(n), lindex(n), linsert(n), llength(n), -lset(n), lsort(n), lrange(n), lreplace(n), -string(n) -.SH KEYWORDS -binary search, linear search, -list, match, pattern, regular expression, search, string -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/lset.n b/doc/lset.n deleted file mode 100644 index e425274..0000000 --- a/doc/lset.n +++ /dev/null @@ -1,146 +0,0 @@ -'\" -'\" 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. -'\" -.TH lset n 8.4 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -lset \- Change an element in a list -.SH SYNOPSIS -\fBlset \fIvarName ?index ...? newValue\fR -.BE -.SH DESCRIPTION -.PP -The \fBlset\fR command accepts a parameter, \fIvarName\fR, which -it interprets as the name of a variable containing a Tcl list. -It also accepts zero or more \fIindices\fR 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. -Finally, it accepts a new value for an element of \fIvarName\fR. -.PP -If no indices are presented, the command takes the form: -.PP -.CS -\fBlset\fR varName newValue -.CE -.PP -or -.PP -.CS -\fBlset\fR varName {} newValue -.CE -.PP -In this case, \fInewValue\fR replaces the old value of the variable -\fIvarName\fR. -.PP -When presented with a single index, the \fBlset\fR command -treats the content of the \fIvarName\fR variable as a Tcl list. -It addresses the \fIindex\fR'th element in it -(0 refers to the first element of the list). -When interpreting the list, \fBlset\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. -The command constructs a new list in which the designated element is -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 the number -of elements in \fI$varName\fR, then an error occurs. -.PP -If \fIindex\fR is equal to the number of elements in \fI$varName\fR, -then the given element is appended to the list. -.PP -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. -.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 (or append elements -to sublists). The command, -.PP -.CS -\fBlset\fR a 1 2 newValue -.CE -.PP -or -.PP -.CS -\fBlset\fR a {1 2} newValue -.CE -.PP -replaces element 2 of sublist 1 with \fInewValue\fR. -.PP -The integer appearing in each \fIindex\fR argument must be greater -than or equal to zero. The integer appearing in each \fIindex\fR -argument must be less than or equal to the length of the corresponding -list. In other words, the \fBlset\fR command can change the size -of a list only by appending an element (setting the one after the current -end). If an index is outside the permitted range, an error is reported. -.SH EXAMPLES -.PP -In each of these examples, the initial value of \fIx\fR is: -.PP -.CS -set x [list [list a b c] [list d e f] [list g h i]] - \fI\(-> {a b c} {d e f} {g h i}\fR -.CE -.PP -The indicated return value also becomes the new value of \fIx\fR -(except in the last case, which is an error which leaves the value of -\fIx\fR unchanged.) -.PP -.CS -\fBlset\fR x {j k l} - \fI\(-> j k l\fR -\fBlset\fR x {} {j k l} - \fI\(-> j k l\fR -\fBlset\fR x 0 j - \fI\(-> j {d e f} {g h i}\fR -\fBlset\fR x 2 j - \fI\(-> {a b c} {d e f} j\fR -\fBlset\fR x end j - \fI\(-> {a b c} {d e f} j\fR -\fBlset\fR x end-1 j - \fI\(-> {a b c} j {g h i}\fR -\fBlset\fR x 2 1 j - \fI\(-> {a b c} {d e f} {g j i}\fR -\fBlset\fR x {2 1} j - \fI\(-> {a b c} {d e f} {g j i}\fR -\fBlset\fR x {2 3} j - \fI\(-> list index out of range\fR -.CE -.PP -In the following examples, the initial value of \fIx\fR is: -.PP -.CS -set x [list [list [list a b] [list c d]] \e - [list [list e f] [list g h]]] - \fI\(-> {{a b} {c d}} {{e f} {g h}}\fR -.CE -.PP -The indicated return value also becomes the new value of \fIx\fR. -.PP -.CS -\fBlset\fR x 1 1 0 j - \fI\(-> {{a b} {c d}} {{e f} {j h}}\fR -\fBlset\fR x {1 1 0} j - \fI\(-> {{a b} {c d}} {{e f} {j h}}\fR -.CE -.SH "SEE ALSO" -list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n), -lsort(n), lrange(n), lreplace(n), -string(n) -.SH KEYWORDS -element, index, list, replace, set -'\"Local Variables: -'\"mode: nroff -'\"End: diff --git a/doc/lsort.n b/doc/lsort.n deleted file mode 100644 index c3245b2..0000000 --- a/doc/lsort.n +++ /dev/null @@ -1,275 +0,0 @@ -'\" -'\" 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. -'\" -.TH lsort n 8.5 Tcl "Tcl Built-In Commands" -.so man.macros -.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 -.SH DESCRIPTION -.PP -This command sorts the elements of \fIlist\fR, returning a new -list in sorted order. The implementation of the \fBlsort\fR command -uses the merge\-sort algorithm which is a stable sort that has O(n log -n) performance characteristics. -.PP -By default ASCII sorting is used with the result returned in -increasing order. However, any of the following options may be -specified before \fIlist\fR to control the sorting process (unique -abbreviations are accepted): -.TP -\fB\-ascii\fR -. -Use string comparison with Unicode code-point collation order (the -name is for backward-compatibility reasons.) This is the default. -.TP -\fB\-dictionary\fR -. -Use dictionary-style comparison. This is the same as \fB\-ascii\fR -except (a) case is ignored except as a tie-breaker and (b) if two -strings contain embedded numbers, the numbers compare as integers, -not characters. For example, in \fB\-dictionary\fR mode, \fBbigBoy\fR -sorts between \fBbigbang\fR and \fBbigboy\fR, and \fBx10y\fR -sorts between \fBx9y\fR and \fBx11y\fR. Overrides the \fB\-nocase\fR -option. -.TP -\fB\-integer\fR -. -Convert list elements to integers and use integer comparison. -.TP -\fB\-real\fR -. -Convert list elements to floating-point values and use floating comparison. -.TP -\fB\-command\0\fIcommand\fR -. -Use \fIcommand\fR as a comparison command. -To compare two elements, evaluate a Tcl script consisting of -\fIcommand\fR with the two elements appended as additional -arguments. The script should return an integer less than, -equal to, or greater than zero if the first element is to -be considered less than, equal to, or greater than the second, -respectively. -.TP -\fB\-increasing\fR -. -Sort the list in increasing order -.PQ smallest "items first" . -This is the default. -.TP -\fB\-decreasing\fR -. -Sort the list in decreasing order -.PQ largest "items first" . -.TP -\fB\-indices\fR -. -Return a list of indices into \fIlist\fR in sorted order instead of -the values themselves. -.TP -\fB\-index\0\fIindexList\fR -. -If this option is specified, each of the elements of \fIlist\fR must -itself be a proper Tcl sublist (unless \fB\-stride\fR is used). -Instead of sorting based on whole sublists, \fBlsort\fR will extract -the \fIindexList\fR'th element from each sublist (as if the overall -element and the \fIindexList\fR were passed to \fBlindex\fR) and sort -based on the given element. -For example, -.RS -.PP -.CS -\fBlsort\fR -integer -index 1 \e - {{First 24} {Second 18} {Third 30}} -.CE -.PP -returns \fB{Second 18} {First 24} {Third 30}\fR, -.PP -'\" -'\" This example is from the test suite! -'\" -.CS -\fBlsort\fR -index end-1 \e - {{a 1 e i} {b 2 3 f g} {c 4 5 6 d h}} -.CE -.PP -returns \fB{c 4 5 6 d h} {a 1 e i} {b 2 3 f g}\fR, -and -.PP -.CS -\fBlsort\fR -index {0 1} { - {{b i g} 12345} - {{d e m o} 34512} - {{c o d e} 54321} -} -.CE -.PP -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.) -This option is much more efficient than using \fB\-command\fR -to achieve the same effect. -.RE -.TP -\fB\-stride\0\fIstrideLength\fR -. -If this option is specified, the list is treated as consisting of -groups of \fIstrideLength\fR elements and the groups are sorted by -either their first element or, if the \fB\-index\fR option is used, -by the element within each group given by the first index passed to -\fB\-index\fR (which is then ignored by \fB\-index\fR). Elements -always remain in the same position within their group. -.RS -.PP -The list length must be an integer multiple of \fIstrideLength\fR, which -in turn must be at least 2. -.PP -For example, -.PP -.CS -\fBlsort\fR \-stride 2 {carrot 10 apple 50 banana 25} -.CE -.PP -returns -.QW "apple 50 banana 25 carrot 10" , -and -.PP -.CS -\fBlsort\fR \-stride 2 \-index 1 \-integer {carrot 10 apple 50 banana 25} -.CE -.PP -returns -.QW "carrot 10 banana 25 apple 50" . -.RE -.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. -.TP -\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 -\fB\-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 -be retained. -.SH "NOTES" -.PP -The options to \fBlsort\fR only control what sort of comparison is -used, and do not necessarily constrain what the values themselves -actually are. This distinction is only noticeable when the list to be -sorted has fewer than two elements. -.PP -The \fBlsort\fR command is reentrant, meaning it is safe to use as -part of the implementation of a command used in the \fB\-command\fR -option. -.SH "EXAMPLES" -.PP -Sorting a list using ASCII sorting: -.PP -.CS -\fI%\fR \fBlsort\fR {a10 B2 b1 a1 a2} -B2 a1 a10 a2 b1 -.CE -.PP -Sorting a list using Dictionary sorting: -.PP -.CS -\fI%\fR \fBlsort\fR -dictionary {a10 B2 b1 a1 a2} -a1 a2 a10 b1 B2 -.CE -.PP -Sorting lists of integers: -.PP -.CS -\fI%\fR \fBlsort\fR -integer {5 3 1 2 11 4} -1 2 3 4 5 11 -\fI%\fR \fBlsort\fR -integer {1 2 0x5 7 0 4 -1} --1 0 1 2 4 0x5 7 -.CE -.PP -Sorting lists of floating-point numbers: -.PP -.CS -\fI%\fR \fBlsort\fR -real {5 3 1 2 11 4} -1 2 3 4 5 11 -\fI%\fR \fBlsort\fR -real {.5 0.07e1 0.4 6e-1} -0.4 .5 6e-1 0.07e1 -.CE -.PP -Sorting using indices: -.PP -.CS -\fI%\fR # Note the space character before the c -\fI%\fR \fBlsort\fR {{a 5} { c 3} {b 4} {e 1} {d 2}} -{ c 3} {a 5} {b 4} {d 2} {e 1} -\fI%\fR \fBlsort\fR -index 0 {{a 5} { c 3} {b 4} {e 1} {d 2}} -{a 5} {b 4} { c 3} {d 2} {e 1} -\fI%\fR \fBlsort\fR -index 1 {{a 5} { c 3} {b 4} {e 1} {d 2}} -{e 1} {d 2} { c 3} {b 4} {a 5} -.CE -.PP -.VS 8.6 -Sorting a dictionary: -.PP -.CS -\fI%\fR set d [dict create c d a b h i f g c e] -c e a b h i f g -\fI%\fR \fBlsort\fR -stride 2 $d -a b c e f g h i -.CE -.PP -Sorting using striding and multiple indices: -.PP -.CS -\fI%\fR # Note the first index value is relative to the group -\fI%\fR \fBlsort\fR \-stride 3 \-index {0 1} \e - {{Bob Smith} 25 Audi {Jane Doe} 40 Ford} -{{Jane Doe} 40 Ford {Bob Smith} 25 Audi} -.CE -.VE 8.6 -.PP -Stripping duplicate values using sorting: -.PP -.CS -\fI%\fR \fBlsort\fR -unique {a b c a b c a b c} -a b c -.CE -.PP -More complex sorting using a comparison function: -.PP -.CS -\fI%\fR proc compare {a b} { - set a0 [lindex $a 0] - set b0 [lindex $b 0] - if {$a0 < $b0} { - return -1 - } elseif {$a0 > $b0} { - return 1 - } - return [string compare [lindex $a 1] [lindex $b 1]] -} -\fI%\fR \fBlsort\fR -command compare \e - {{3 apple} {0x2 carrot} {1 dingo} {2 banana}} -{1 dingo} {2 banana} {0x2 carrot} {3 apple} -.CE -.SH "SEE ALSO" -list(n), lappend(n), lindex(n), linsert(n), llength(n), lsearch(n), -lset(n), lrange(n), lreplace(n) -.SH KEYWORDS -element, list, order, sort -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/man.macros b/doc/man.macros deleted file mode 100644 index ddd073d..0000000 --- a/doc/man.macros +++ /dev/null @@ -1,267 +0,0 @@ -.\" The -*- nroff -*- definitions below are for supplemental macros used -.\" in Tcl/Tk manual entries. -.\" -.\" .AP type name in/out ?indent? -.\" Start paragraph describing an argument to a library procedure. -.\" type is type of argument (int, etc.), in/out is either "in", "out", -.\" or "in/out" to describe whether procedure reads or modifies arg, -.\" and indent is equivalent to second arg of .IP (shouldn't ever be -.\" needed; use .AS below instead) -.\" -.\" .AS ?type? ?name? -.\" Give maximum sizes of arguments for setting tab stops. Type and -.\" name are examples of largest possible arguments that will be passed -.\" to .AP later. If args are omitted, default tab stops are used. -.\" -.\" .BS -.\" Start box enclosure. From here until next .BE, everything will be -.\" enclosed in one large box. -.\" -.\" .BE -.\" End of box enclosure. -.\" -.\" .CS -.\" Begin code excerpt. -.\" -.\" .CE -.\" End code excerpt. -.\" -.\" .VS ?version? ?br? -.\" Begin vertical sidebar, for use in marking newly-changed parts -.\" of man pages. The first argument is ignored and used for recording -.\" the version when the .VS was added, so that the sidebars can be -.\" found and removed when they reach a certain age. If another argument -.\" is present, then a line break is forced before starting the sidebar. -.\" -.\" .VE -.\" End of vertical sidebar. -.\" -.\" .DS -.\" Begin an indented unfilled display. -.\" -.\" .DE -.\" End of indented unfilled display. -.\" -.\" .SO ?manpage? -.\" Start of list of standard options for a Tk widget. The manpage -.\" argument defines where to look up the standard options; if -.\" omitted, defaults to "options". The options follow on successive -.\" lines, in three columns separated by tabs. -.\" -.\" .SE -.\" End of list of standard options for a Tk widget. -.\" -.\" .OP cmdName dbName dbClass -.\" Start of description of a specific option. cmdName gives the -.\" option's name as specified in the class command, dbName gives -.\" the option's name in the option database, and dbClass gives -.\" the option's class in the option database. -.\" -.\" .UL arg1 arg2 -.\" Print arg1 underlined, then print arg2 normally. -.\" -.\" .QW arg1 ?arg2? -.\" Print arg1 in quotes, then arg2 normally (for trailing punctuation). -.\" -.\" .PQ arg1 ?arg2? -.\" Print an open parenthesis, arg1 in quotes, then arg2 normally -.\" (for trailing punctuation) and then a closing parenthesis. -.\" -.\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. -.if t .wh -1.3i ^B -.nr ^l \n(.l -.ad b -.\" # Start an argument description -.de AP -.ie !"\\$4"" .TP \\$4 -.el \{\ -. ie !"\\$2"" .TP \\n()Cu -. el .TP 15 -.\} -.ta \\n()Au \\n()Bu -.ie !"\\$3"" \{\ -\&\\$1 \\fI\\$2\\fP (\\$3) -.\".b -.\} -.el \{\ -.br -.ie !"\\$2"" \{\ -\&\\$1 \\fI\\$2\\fP -.\} -.el \{\ -\&\\fI\\$1\\fP -.\} -.\} -.. -.\" # define tabbing values for .AP -.de AS -.nr )A 10n -.if !"\\$1"" .nr )A \\w'\\$1'u+3n -.nr )B \\n()Au+15n -.\" -.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n -.nr )C \\n()Bu+\\w'(in/out)'u+2n -.. -.AS Tcl_Interp Tcl_CreateInterp in/out -.\" # BS - start boxed text -.\" # ^y = starting y location -.\" # ^b = 1 -.de BS -.br -.mk ^y -.nr ^b 1u -.if n .nf -.if n .ti 0 -.if n \l'\\n(.lu\(ul' -.if n .fi -.. -.\" # BE - end boxed text (draw box now) -.de BE -.nf -.ti 0 -.mk ^t -.ie n \l'\\n(^lu\(ul' -.el \{\ -.\" Draw four-sided box normally, but don't draw top of -.\" box if the box started on an earlier page. -.ie !\\n(^b-1 \{\ -\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' -.\} -.el \}\ -\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' -.\} -.\} -.fi -.br -.nr ^b 0 -.. -.\" # VS - start vertical sidebar -.\" # ^Y = starting y location -.\" # ^v = 1 (for troff; for nroff this doesn't matter) -.de VS -.if !"\\$2"" .br -.mk ^Y -.ie n 'mc \s12\(br\s0 -.el .nr ^v 1u -.. -.\" # VE - end of vertical sidebar -.de VE -.ie n 'mc -.el \{\ -.ev 2 -.nf -.ti 0 -.mk ^t -\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' -.sp -1 -.fi -.ev -.\} -.nr ^v 0 -.. -.\" # Special macro to handle page bottom: finish off current -.\" # box/sidebar if in box/sidebar mode, then invoked standard -.\" # page bottom macro. -.de ^B -.ev 2 -'ti 0 -'nf -.mk ^t -.if \\n(^b \{\ -.\" Draw three-sided box if this is the box's first page, -.\" draw two sides but no top otherwise. -.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c -.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c -.\} -.if \\n(^v \{\ -.nr ^x \\n(^tu+1v-\\n(^Yu -\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c -.\} -.bp -'fi -.ev -.if \\n(^b \{\ -.mk ^y -.nr ^b 2 -.\} -.if \\n(^v \{\ -.mk ^Y -.\} -.. -.\" # DS - begin display -.de DS -.RS -.nf -.sp -.. -.\" # DE - end display -.de DE -.fi -.RE -.sp -.. -.\" # SO - start of list of standard options -.de SO -'ie '\\$1'' .ds So \\fBoptions\\fR -'el .ds So \\fB\\$1\\fR -.SH "STANDARD OPTIONS" -.LP -.nf -.ta 5.5c 11c -.ft B -.. -.\" # SE - end of list of standard options -.de SE -.fi -.ft R -.LP -See the \\*(So manual entry for details on the standard options. -.. -.\" # OP - start of full description for a single option -.de OP -.LP -.nf -.ta 4c -Command-Line Name: \\fB\\$1\\fR -Database Name: \\fB\\$2\\fR -Database Class: \\fB\\$3\\fR -.fi -.IP -.. -.\" # CS - begin code excerpt -.de CS -.RS -.nf -.ta .25i .5i .75i 1i -.. -.\" # CE - end code excerpt -.de CE -.fi -.RE -.. -.\" # UL - underline word -.de UL -\\$1\l'|0\(ul'\\$2 -.. -.\" # QW - apply quotation marks to word -.de QW -.ie '\\*(lq'"' ``\\$1''\\$2 -.\"" fix emacs highlighting -.el \\*(lq\\$1\\*(rq\\$2 -.. -.\" # PQ - apply parens and quotation marks to word -.de PQ -.ie '\\*(lq'"' (``\\$1''\\$2)\\$3 -.\"" fix emacs highlighting -.el (\\*(lq\\$1\\*(rq\\$2)\\$3 -.. -.\" # QR - quoted range -.de QR -.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3 -.\"" fix emacs highlighting -.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3 -.. -.\" # MT - "empty" string -.de MT -.QW "" -.. diff --git a/doc/mathfunc.n b/doc/mathfunc.n deleted file mode 100644 index 7233d46..0000000 --- a/doc/mathfunc.n +++ /dev/null @@ -1,305 +0,0 @@ -'\" -'\" Copyright (c) 1993 The Regents of the University of California. -'\" Copyright (c) 1994-2000 Sun Microsystems, Inc. -'\" 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. -'\" -.TH mathfunc n 8.5 Tcl "Tcl Mathematical Functions" -.so man.macros -.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::entier\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::isqrt\fR \fIarg\fR -.br -\fB::tcl::mathfunc::log\fR \fIarg\fR -.br -\fB::tcl::mathfunc::log10\fR \fIarg\fR -.br -\fB::tcl::mathfunc::max\fR \fIarg\fR ?\fIarg\fR ...? -.br -\fB::tcl::mathfunc::min\fR \fIarg\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::mathfunc::sin [expr {$x}]]\fR or -\fB[tcl::mathfunc::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 \fBacos\fR \fBasin\fR \fBatan\fR -\fBatan2\fR \fBbool\fR \fBceil\fR \fBcos\fR -\fBcosh\fR \fBdouble\fR \fBentier\fR \fBexp\fR -\fBfloor\fR \fBfmod\fR \fBhypot\fR \fBint\fR -\fBisqrt\fR \fBlog\fR \fBlog10\fR \fBmax\fR -\fBmin\fR \fBpow\fR \fBrand\fR \fBround\fR -\fBsin\fR \fBsinh\fR \fBsqrt\fR \fBsrand\fR -\fBtan\fR \fBtanh\fR \fBwide\fR -.DE -.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. -.SS "DETAILED DEFINITIONS" -.TP -\fBabs \fIarg\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\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\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\fR -. -Returns the arc tangent of \fIarg\fR, in the range [\fI\-pi/2\fR,\fIpi/2\fR] -radians. -.TP -\fBatan2 \fIy x\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 -.QW "\fBatan \fR[\fBexpr\fR {\fIy\fB/\fIx\fR}]" . -.TP -\fBbool \fIarg\fR -. -Accepts any numeric 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\fR -. -Returns the smallest integral floating-point value (i.e. with a zero -fractional part) not less than \fIarg\fR. The argument may be any -numeric value. -.TP -\fBcos \fIarg\fR -. -Returns the cosine of \fIarg\fR, measured in radians. -.TP -\fBcosh \fIarg\fR -. -Returns the hyperbolic cosine of \fIarg\fR. If the result would cause -an overflow, an error is returned. -.TP -\fBdouble \fIarg\fR -. -The argument may be any numeric value, -If \fIarg\fR is a floating-point value, returns \fIarg\fR, otherwise converts -\fIarg\fR to floating-point and returns the converted value. May return -\fBInf\fR or \fB\-Inf\fR when the argument is a numeric value that exceeds -the floating-point range. -.TP -\fBentier \fIarg\fR -. -The argument may be any numeric value. The integer part of \fIarg\fR -is determined and returned. The integer range returned by this function -is unlimited, unlike \fBint\fR and \fBwide\fR which -truncate their range to fit in particular storage widths. -.TP -\fBexp \fIarg\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\fR -. -Returns the largest integral floating-point value (i.e. with a zero -fractional part) not greater than \fIarg\fR. The argument may be -any numeric value. -.TP -\fBfmod \fIx y\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\fR -. -Computes the length of the hypotenuse of a right-angled triangle, -approximately -.QW "\fBsqrt\fR [\fBexpr\fR {\fIx\fB*\fIx\fB+\fIy\fB*\fIy\fR}]" -except for being more numerically stable when the two arguments have -substantially different magnitudes. -.TP -\fBint \fIarg\fR -. -The argument may be any numeric value. The integer part of \fIarg\fR -is determined, and then the low order bits of that integer value up -to the machine word size are returned as an integer value. For reference, -the number of bytes in the machine word are stored in the \fBwordSize\fR -element of the \fBtcl_platform\fR array. -.TP -\fBisqrt \fIarg\fR -. -Computes the integer part of the square root of \fIarg\fR. \fIArg\fR must be -a positive value, either an integer or a floating point number. -Unlike \fBsqrt\fR, which is limited to the precision of a floating point -number, \fIisqrt\fR will return a result of arbitrary precision. -.TP -\fBlog \fIarg\fR -. -Returns the natural logarithm of \fIarg\fR. \fIArg\fR must be a -positive value. -.TP -\fBlog10 \fIarg\fR -. -Returns the base 10 logarithm of \fIarg\fR. \fIArg\fR must be a -positive value. -.TP -\fBmax \fIarg\fB \fI...\fR -. -Accepts one or more numeric arguments. Returns the one argument -with the greatest value. -.TP -\fBmin \fIarg\fB \fI...\fR -. -Accepts one or more numeric arguments. Returns the one argument -with the least value. -.TP -\fBpow \fIx y\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\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\fR -. -Returns the sine of \fIarg\fR, measured in radians. -.TP -\fBsinh \fIarg\fR -. -Returns the hyperbolic sine of \fIarg\fR. If the result would cause -an overflow, an error is returned. -.TP -\fBsqrt \fIarg\fR -. -The argument may be any non-negative numeric value. Returns a floating-point -value that is the square root of \fIarg\fR. May return \fBInf\fR when the -argument is a numeric value that exceeds the square of the maximum value of -the floating-point range. -.TP -\fBsrand \fIarg\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\fR -. -Returns the tangent of \fIarg\fR, measured in radians. -.TP -\fBtanh \fIarg\fR -. -Returns the hyperbolic tangent of \fIarg\fR. -.TP -\fBwide \fIarg\fR -. -The argument may be any numeric value. The integer part of \fIarg\fR -is determined, and then the low order 64 bits of that integer value -are returned as an integer value. -.SH "SEE ALSO" -expr(n), mathop(n), namespace(n) -.SH "COPYRIGHT" -.nf -Copyright (c) 1993 The Regents of the University of California. -Copyright (c) 1994-2000 Sun Microsystems Incorporated. -Copyright (c) 2005, 2006 by Kevin B. Kenny . -.fi -'\" Local Variables: -'\" mode: nroff -'\" fill-column: 78 -'\" End: diff --git a/doc/mathop.n b/doc/mathop.n deleted file mode 100644 index 4c16d76..0000000 --- a/doc/mathop.n +++ /dev/null @@ -1,310 +0,0 @@ -.\" -.\" Copyright (c) 2006-2007 Donal K. Fellows. -.\" -.\" See the file "license.terms" for information on usage and redistribution -.\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -.\" -.TH mathop n 8.5 Tcl "Tcl Mathematical Operator Commands" -.so man.macros -.BS -.\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -mathop \- Mathematical operators as Tcl commands -.SH SYNOPSIS -package require \fBTcl 8.5\fR -.sp -\fB::tcl::mathop::!\fR \fInumber\fR -.br -\fB::tcl::mathop::~\fR \fInumber\fR -.br -\fB::tcl::mathop::+\fR ?\fInumber\fR ...? -.br -\fB::tcl::mathop::\-\fR \fInumber\fR ?\fInumber\fR ...? -.br -\fB::tcl::mathop::*\fR ?\fInumber\fR ...? -.br -\fB::tcl::mathop::/\fR \fInumber\fR ?\fInumber\fR ...? -.br -\fB::tcl::mathop::%\fR \fInumber number\fR -.br -\fB::tcl::mathop::**\fR ?\fInumber\fR ...? -.br -\fB::tcl::mathop::&\fR ?\fInumber\fR ...? -.br -\fB::tcl::mathop::|\fR ?\fInumber\fR ...? -.br -\fB::tcl::mathop::^\fR ?\fInumber\fR ...? -.br -\fB::tcl::mathop::<<\fR \fInumber number\fR -.br -\fB::tcl::mathop::>>\fR \fInumber number\fR -.br -\fB::tcl::mathop::==\fR ?\fIarg\fR ...? -.br -\fB::tcl::mathop::!=\fR \fIarg arg\fR -.br -\fB::tcl::mathop::<\fR ?\fIarg\fR ...? -.br -\fB::tcl::mathop::<=\fR ?\fIarg\fR ...? -.br -\fB::tcl::mathop::>=\fR ?\fIarg\fR ...? -.br -\fB::tcl::mathop::>\fR ?\fIarg\fR ...? -.br -\fB::tcl::mathop::eq\fR ?\fIarg\fR ...? -.br -\fB::tcl::mathop::ne\fR \fIarg arg\fR -.br -\fB::tcl::mathop::in\fR \fIarg list\fR -.br -\fB::tcl::mathop::ni\fR \fIarg list\fR -.sp -.BE -.SH DESCRIPTION -.PP -The commands in the \fB::tcl::mathop\fR namespace implement the same set of -operations as supported by the \fBexpr\fR command. All are exported from the -namespace, but are not imported into any other namespace by default. Note that -renaming, reimplementing or deleting any of the commands in the namespace does -\fInot\fR alter the way that the \fBexpr\fR command behaves, and nor does -defining any new commands in the \fB::tcl::mathop\fR namespace. -.PP -The following operator commands are supported: -.DS -.ta 2c 4c 6c 8c -\fB~\fR \fB!\fR \fB+\fR \fB\-\fR \fB*\fR -\fB/\fR \fB%\fR \fB**\fR \fB&\fR \fB|\fR -\fB^\fR \fB>>\fR \fB<<\fR \fB==\fR \fBeq\fR -\fB!=\fR \fBne\fR \fB<\fR \fB<=\fR \fB>\fR -\fB>=\fR \fBin\fR \fBni\fR -.DE -.SS "MATHEMATICAL OPERATORS" -.PP -The behaviors of the mathematical operator commands are as follows: -.TP -\fB!\fR \fIboolean\fR -. -Returns the boolean negation of \fIboolean\fR, where \fIboolean\fR may be any -numeric value or any other form of boolean value (i.e. it returns truth if the -argument is falsity or zero, and falsity if the argument is truth or -non-zero). -.TP -\fB+\fR ?\fInumber\fR ...? -. -Returns the sum of arbitrarily many arguments. Each \fInumber\fR argument may -be any numeric value. If no arguments are given, the result will be zero (the -summation identity). -.TP -\fB\-\fR \fInumber\fR ?\fInumber\fR ...? -. -If only a single \fInumber\fR argument is given, returns the negation of that -numeric value. Otherwise returns the number that results when all subsequent -numeric values are subtracted from the first one. All \fInumber\fR arguments -must be numeric values. At least one argument must be given. -.TP -\fB*\fR ?\fInumber\fR ...? -. -Returns the product of arbitrarily many arguments. Each \fInumber\fR may be -any numeric value. If no arguments are given, the result will be one (the -multiplicative identity). -.TP -\fB/\fR \fInumber\fR ?\fInumber\fR ...? -. -If only a single \fInumber\fR argument is given, returns the reciprocal of that -numeric value (i.e. the value obtained by dividing 1.0 by that value). -Otherwise returns the number that results when the first numeric argument is -divided by all subsequent numeric arguments. All \fInumber\fR arguments must -be numeric values. At least one argument must be given. -.RS -.PP -Note that when the leading values in the list of arguments are integers, -integer division will be used for those initial steps (i.e. the intermediate -results will be as if the functions \fIfloor\fR and \fIint\fR are applied to -them, in that order). If all values in the operation are integers, the result -will be an integer. -.RE -.TP -\fB%\fR \fInumber number\fR -. -Returns the integral modulus (i.e., remainder) of the first argument -with respect to the second. -Each \fInumber\fR must have an integral value. -Also, the sign of the result will be the same as the sign of the second -\fInumber\fR, which must not be zero. -.RS -.PP -Note that Tcl defines this operation exactly even for negative numbers, so -that the following command returns a true value (omitting the namespace for -clarity): -.PP -.CS -\fB==\fR [\fB*\fR [\fB/\fI x y\fR] \fIy\fR] [\fB\-\fI x\fR [\fB%\fI x y\fR]] -.CE -.RE -.TP -\fB**\fR ?\fInumber\fR ...? -. -Returns the result of raising each value to the power of the result of -recursively operating on the result of processing the following arguments, so -.QW "\fB** 2 3 4\fR" -is the same as -.QW "\fB** 2 [** 3 4]\fR" . -Each \fInumber\fR may be -any numeric value, though the second number must not be fractional if the -first is negative. If no arguments are given, the result will be one, and if -only one argument is given, the result will be that argument. The -result will have an integral value only when all arguments are -integral values. -.SS "COMPARISON OPERATORS" -.PP -The behaviors of the comparison operator commands (most of which operate -preferentially on numeric arguments) are as follows: -.TP -\fB==\fR ?\fIarg\fR ...? -. -Returns whether each argument is equal to the arguments on each side of it in -the sense of the \fBexpr\fR == operator (\fIi.e.\fR, numeric comparison if -possible, exact string comparison otherwise). If fewer than two arguments -are given, this operation always returns a true value. -.TP -\fBeq\fR ?\fIarg\fR ...? -. -Returns whether each argument is equal to the arguments on each side of it -using exact string comparison. If fewer than two arguments are given, this -operation always returns a true value. -.TP -\fB!=\fR \fIarg arg\fR -. -Returns whether the two arguments are not equal to each other, in the sense of -the \fBexpr\fR != operator (\fIi.e.\fR, numeric comparison if possible, exact -string comparison otherwise). -.TP -\fBne\fR \fIarg arg\fR -. -Returns whether the two arguments are not equal to each other using exact -string comparison. -.TP -\fB<\fR ?\fIarg\fR ...? -. -Returns whether the arbitrarily-many arguments are ordered, with each argument -after the first having to be strictly more than the one preceding it. -Comparisons are performed preferentially on the numeric values, and are -otherwise performed using UNICODE string comparison. If fewer than two -arguments are present, this operation always returns a true value. When the -arguments are numeric but should be compared as strings, the \fBstring -compare\fR command should be used instead. -.TP -\fB<=\fR ?\fIarg\fR ...? -. -Returns whether the arbitrarily-many arguments are ordered, with each argument -after the first having to be equal to or more than the one preceding it. -Comparisons are performed preferentially on the numeric values, and are -otherwise performed using UNICODE string comparison. If fewer than two -arguments are present, this operation always returns a true value. When the -arguments are numeric but should be compared as strings, the \fBstring -compare\fR command should be used instead. -.TP -\fB>\fR ?\fIarg\fR ...? -. -Returns whether the arbitrarily-many arguments are ordered, with each argument -after the first having to be strictly less than the one preceding it. -Comparisons are performed preferentially on the numeric values, and are -otherwise performed using UNICODE string comparison. If fewer than two -arguments are present, this operation always returns a true value. When the -arguments are numeric but should be compared as strings, the \fBstring -compare\fR command should be used instead. -.TP -\fB>=\fR ?\fIarg\fR ...? -. -Returns whether the arbitrarily-many arguments are ordered, with each argument -after the first having to be equal to or less than the one preceding it. -Comparisons are performed preferentially on the numeric values, and are -otherwise performed using UNICODE string comparison. If fewer than two -arguments are present, this operation always returns a true value. When the -arguments are numeric but should be compared as strings, the \fBstring -compare\fR command should be used instead. -.SS "BIT-WISE OPERATORS" -.PP -The behaviors of the bit-wise operator commands (all of which only operate on -integral arguments) are as follows: -.TP -\fB~\fR \fInumber\fR -. -Returns the bit-wise negation of \fInumber\fR. \fINumber\fR may be an integer -of any size. Note that the result of this operation will always have the -opposite sign to the input \fInumber\fR. -.TP -\fB&\fR ?\fInumber\fR ...? -. -Returns the bit-wise AND of each of the arbitrarily many arguments. Each -\fInumber\fR must have an integral value. If no arguments are given, the -result will be minus one. -.TP -\fB|\fR ?\fInumber\fR ...? -. -Returns the bit-wise OR of each of the arbitrarily many arguments. Each -\fInumber\fR must have an integral value. If no arguments are given, the -result will be zero. -.TP -\fB^\fR ?\fInumber\fR ...? -. -Returns the bit-wise XOR of each of the arbitrarily many arguments. Each -\fInumber\fR must have an integral value. If no arguments are given, the -result will be zero. -.TP -\fB<<\fR \fInumber number\fR -. -Returns the result of bit-wise shifting the first argument left by the -number of bits specified in the second argument. Each \fInumber\fR -must have an integral value. -.TP -\fB>>\fR \fInumber number\fR -. -Returns the result of bit-wise shifting the first argument right by -the number of bits specified in the second argument. Each \fInumber\fR -must have an integral value. -.SS "LIST OPERATORS" -.PP -The behaviors of the list-oriented operator commands are as follows: -.TP -\fBin\fR \fIarg list\fR -. -Returns whether the value \fIarg\fR is present in the list \fIlist\fR -(according to exact string comparison of elements). -.TP -\fBni\fR \fIarg list\fR -. -Returns whether the value \fIarg\fR is not present in the list \fIlist\fR -(according to exact string comparison of elements). -.SH EXAMPLES -.PP -The simplest way to use the operators is often by using \fBnamespace path\fR -to make the commands available. This has the advantage of not affecting the -set of commands defined by the current namespace. -.PP -.CS -namespace path {\fB::tcl::mathop\fR ::tcl::mathfunc} - -\fI# Compute the sum of some numbers\fR -set sum [\fB+\fR 1 2 3] - -\fI# Compute the average of a list\fR -set list {1 2 3 4 5 6} -set mean [\fB/\fR [\fB+\fR {*}$list] [double [llength $list]]] - -\fI# Test for list membership\fR -set gotIt [\fBin\fR 3 $list] - -\fI# Test to see if a value is within some defined range\fR -set inRange [\fB<=\fR 1 $x 5] - -\fI# Test to see if a list is sorted\fR -set sorted [\fB<=\fR {*}$list] -.CE -.SH "SEE ALSO" -expr(n), mathfunc(n), namespace(n) -.SH KEYWORDS -command, expression, operator -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/memory.n b/doc/memory.n deleted file mode 100644 index c8cdb21..0000000 --- a/doc/memory.n +++ /dev/null @@ -1,115 +0,0 @@ -'\" -'\" Copyright (c) 1992-1999 by Karl Lehenbauer and Mark Diekhans -'\" Copyright (c) 2000 by Scriptics Corporation. -'\" All rights reserved. -'\" -.TH memory n 8.1 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -.SH NAME -memory \- Control Tcl memory debugging capabilities -.SH SYNOPSIS -\fBmemory \fIoption \fR?\fIarg arg ...\fR? -.BE -.SH DESCRIPTION -.PP -The \fBmemory\fR command gives the Tcl developer control of Tcl's memory -debugging capabilities. The memory command has several suboptions, which are -described below. It is only available when Tcl has been compiled with -memory debugging enabled (when \fBTCL_MEM_DEBUG\fR is defined at -compile time), and after \fBTcl_InitMemory\fR has been called. -.TP -\fBmemory active\fR \fIfile\fR -. -Write a list of all currently allocated memory to the specified \fIfile\fR. -.TP -\fBmemory break_on_malloc\fR \fIcount\fR -. -After the \fIcount\fR allocations have been performed, \fBckalloc\fR -outputs a message to this effect and that it is now attempting to enter -the C debugger. Tcl will then issue a \fISIGINT\fR signal against itself. -If you are running Tcl under a C debugger, it should then enter the debugger -command mode. -.TP -\fBmemory info\fR -. -Returns a report containing the total allocations and frees since -Tcl began, the current packets allocated (the current -number of calls to \fBckalloc\fR not met by a corresponding call -to \fBckfree\fR), the current bytes allocated, and the maximum number -of packets and bytes allocated. -.TP -\fBmemory init \fR[\fBon\fR|\fBoff\fR] -. -Turn on or off the pre-initialization of all allocated memory -with bogus bytes. Useful for detecting the use of uninitialized -values. -.TP -\fBmemory objs \fIfile\fR -. -Causes a list of all allocated Tcl_Obj values to be written to the specified -\fIfile\fR immediately, together with where they were allocated. Useful for -checking for leaks of values. -.TP -\fBmemory onexit\fR \fIfile\fR -. -Causes a list of all allocated memory to be written to the specified \fIfile\fR -during the finalization of Tcl's memory subsystem. Useful for checking -that memory is properly cleaned up during process exit. -.TP -\fBmemory tag\fR \fIstring\fR -. -Each packet of memory allocated by \fBckalloc\fR can have associated -with it a string-valued tag. In the lists of allocated memory generated -by \fBmemory active\fR and \fBmemory onexit\fR, the tag for each packet -is printed along with other information about the packet. The -\fBmemory tag\fR command sets the tag value for subsequent calls -to \fBckalloc\fR to be \fIstring\fR. -.TP -\fBmemory trace \fR[\fBon\fR|\fBoff\fR] -. -Turns memory tracing on or off. When memory tracing is on, every call -to \fBckalloc\fR causes a line of trace information to be written to -\fIstderr\fR, consisting of the word \fIckalloc\fR, followed by the -address returned, the amount of memory allocated, and the C filename -and line number of the code performing the allocation. For example: -.RS -.PP -.CS -ckalloc 40e478 98 tclProc.c 1406 -.CE -.PP -Calls to \fBckfree\fR are traced in the same manner. -.RE -.TP -\fBmemory trace_on_at_malloc\fR \fIcount\fR -. -Enable memory tracing after \fIcount\fR \fBckalloc\fRs have been performed. -For example, if you enter \fBmemory trace_on_at_malloc 100\fR, -after the 100th call to \fBckalloc\fR, memory trace information will begin -being displayed for all allocations and frees. Since there can be a lot -of memory activity before a problem occurs, judicious use of this option -can reduce the slowdown caused by tracing (and the amount of trace information -produced), if you can identify a number of allocations that occur before -the problem sets in. The current number of memory allocations that have -occurred since Tcl started is printed on a guard zone failure. -.TP -\fBmemory validate \fR[\fBon\fR|\fBoff\fR] -. -Turns memory validation on or off. When memory validation is enabled, -on every call to \fBckalloc\fR or \fBckfree\fR, the guard zones are -checked for every piece of memory currently in existence that was -allocated by \fBckalloc\fR. This has a large performance impact and -should only be used when overwrite problems are strongly suspected. -The advantage of enabling memory validation is that a guard zone -overwrite can be detected on the first call to \fBckalloc\fR or -\fBckfree\fR after the overwrite occurred, rather than when the -specific memory with the overwritten guard zone(s) is freed, which may -occur long after the overwrite occurred. -.SH "SEE ALSO" -ckalloc, ckfree, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory, TCL_MEM_DEBUG -.SH KEYWORDS -memory, debug -'\"Local Variables: -'\"mode: nroff -'\"End: diff --git a/doc/msgcat.n b/doc/msgcat.n deleted file mode 100644 index 2fc1eee..0000000 --- a/doc/msgcat.n +++ /dev/null @@ -1,651 +0,0 @@ -'\" -'\" Copyright (c) 1998 Mark Harrison. -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH "msgcat" n 1.5 msgcat "Tcl Bundled Packages" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -msgcat \- Tcl message catalog -.SH SYNOPSIS -\fBpackage require Tcl 8.5\fR -.sp -\fBpackage require msgcat 1.6\fR -.sp -\fB::msgcat::mc \fIsrc-string\fR ?\fIarg arg ...\fR? -.sp -\fB::msgcat::mcmax ?\fIsrc-string src-string ...\fR? -.sp -.VS "TIP 412" -\fB::msgcat::mcexists\fR ?\fB-exactnamespace\fR? ?\fB-exactlocale\fR? \fIsrc-string\fR -.VE "TIP 412" -.sp -\fB::msgcat::mclocale \fR?\fInewLocale\fR? -.sp -\fB::msgcat::mcpreferences\fR -.sp -.VS "TIP 412" -\fB::msgcat::mcloadedlocales subcommand\fR ?\fIlocale\fR? -.VE "TIP 412" -.sp -\fB::msgcat::mcload \fIdirname\fR -.sp -\fB::msgcat::mcset \fIlocale src-string \fR?\fItranslate-string\fR? -.sp -\fB::msgcat::mcmset \fIlocale src-trans-list\fR -.sp -\fB::msgcat::mcflset \fIsrc-string \fR?\fItranslate-string\fR? -.sp -\fB::msgcat::mcflmset \fIsrc-trans-list\fR -.sp -\fB::msgcat::mcunknown \fIlocale src-string\fR ?\fIarg arg ...\fR? -.sp -.VS "TIP 412" -\fB::msgcat::mcpackagelocale subcommand\fR ?\fIlocale\fR? -.sp -\fB::msgcat::mcpackageconfig subcommand\fR \fIoption\fR ?\fIvalue\fR? -.sp -\fB::msgcat::mcforgetpackage\fR -.VE "TIP 412" -.BE -.SH DESCRIPTION -.PP -The \fBmsgcat\fR package provides a set of functions -that can be used to manage multi-lingual user interfaces. -Text strings are defined in a -.QW "message catalog" -which is independent from the application, and -which can be edited or localized without modifying -the application source code. New languages -or locales may be provided by adding a new file to -the message catalog. -.PP -\fBmsgcat\fR distinguises packages by its namespace. -Each package has its own message catalog and configuration settings in \fBmsgcat\fR. -.PP -A \fIlocale\fR is a specification string describing a user language like \fBde_ch\fR for Swiss German. -In \fBmsgcat\fR, there is a global locale initialized by the system locale of the current system. -Each package may decide to use the global locale or to use a package specific locale. -.PP -The global locale may be changed on demand, for example by a user initiated language change or within a multi user application like a web server. -.SH COMMANDS -.TP -\fB::msgcat::mc \fIsrc-string\fR ?\fIarg arg ...\fR? -. -Returns a translation of \fIsrc-string\fR according to the -current locale. If additional arguments past \fIsrc-string\fR -are given, the \fBformat\fR command is used to substitute the -additional arguments in the translation of \fIsrc-string\fR. -.RS -.PP -\fB::msgcat::mc\fR will search the messages defined -in the current namespace for a translation of \fIsrc-string\fR; if -none is found, it will search in the parent of the current namespace, -and so on until it reaches the global namespace. If no translation -string exists, \fB::msgcat::mcunknown\fR is called and the string -returned from \fB::msgcat::mcunknown\fR is returned. -.PP -\fB::msgcat::mc\fR is the main function used to localize an -application. Instead of using an English string directly, an -application can pass the English string through \fB::msgcat::mc\fR and -use the result. If an application is written for a single language in -this fashion, then it is easy to add support for additional languages -later simply by defining new message catalog entries. -.RE -.TP -\fB::msgcat::mcmax ?\fIsrc-string src-string ...\fR? -. -Given several source strings, \fB::msgcat::mcmax\fR returns the length -of the longest translated string. This is useful when designing -localized GUIs, which may require that all buttons, for example, be a -fixed width (which will be the width of the widest button). -.TP -\fB::msgcat::mcexists\fR ?\fB-exactnamespace\fR? ?\fB-exactlocale\fR? \fIsrc-string\fR -. -.VS "TIP 412" -Return true, if there is a translation for the given \fIsrc-string\fR. -.PP -.RS -The search may be limited by the option \fB\-exactnamespace\fR to only check the current namespace and not any parent namespaces. -.PP -It may also be limited by the option \fB\-exactlocale\fR to only check the first prefered locale (e.g. first element returned by \fB::msgcat::mcpreferences\fR if global locale is used). -.RE -.VE "TIP 412" -.TP -\fB::msgcat::mclocale \fR?\fInewLocale\fR? -. -This function sets the locale to \fInewLocale\fR. If \fInewLocale\fR -is omitted, the current locale is returned, otherwise the current locale -is set to \fInewLocale\fR. msgcat stores and compares the locale in a -case-insensitive manner, and returns locales in lowercase. -The initial locale is determined by the locale specified in -the user's environment. See \fBLOCALE SPECIFICATION\fR -below for a description of the locale string format. -.RS -.PP -.VS "TIP 412" -If the locale is set, the preference list of locales is evaluated. -Locales in this list are loaded now, if not jet loaded. -.VE "TIP 412" -.RE -.TP -\fB::msgcat::mcpreferences\fR -. -Returns an ordered list of the locales preferred by -the user, based on the user's language specification. -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 -returns \fB{en_us_funky en_us en {}}\fR. -.TP -\fB::msgcat:mcloadedlocales subcommand\fR ?\fIlocale\fR? -. -This group of commands manage the list of loaded locales for packages not setting a package locale. -.PP -.RS -The subcommand \fBget\fR returns the list of currently loaded locales. -.PP -The subcommand \fBpresent\fR requires the argument \fIlocale\fR and returns true, if this locale is loaded. -.PP -The subcommand \fBclear\fR removes all locales and their data, which are not in the current preference list. -.RE -.TP -\fB::msgcat::mcload \fIdirname\fR -. -.VS "TIP 412" -Searches the specified directory for files that match -the language specifications returned by \fB::msgcat::mcloadedlocales get\fR -(or \fBmsgcat::mcpackagelocale preferences\fR if a package locale is set) (note that these are all lowercase), extended by the file extension -.QW .msg . -Each matching file is -read in order, assuming a UTF-8 encoding. The file contents are -then evaluated as a Tcl script. This means that Unicode characters -may be present in the message file either directly in their UTF-8 -encoded form, or by use of the backslash-u quoting recognized by Tcl -evaluation. The number of message files which matched the specification -and were loaded is returned. -.RS -.PP -In addition, the given folder is stored in the \fBmsgcat\fR package configuration option \fImcfolder\fR to eventually load message catalog files required by a locale change. -.VE "TIP 412" -.RE -.TP -\fB::msgcat::mcset \fIlocale src-string \fR?\fItranslate-string\fR? -. -Sets the translation for \fIsrc-string\fR to \fItranslate-string\fR -in the specified \fIlocale\fR and the current namespace. If -\fItranslate-string\fR is not specified, \fIsrc-string\fR is used -for both. The function returns \fItranslate-string\fR. -.TP -\fB::msgcat::mcmset \fIlocale src-trans-list\fR -. -Sets the translation for multiple source strings in -\fIsrc-trans-list\fR in the specified \fIlocale\fR and the current -namespace. -\fIsrc-trans-list\fR must have an even number of elements and is in -the form {\fIsrc-string translate-string\fR ?\fIsrc-string -translate-string ...\fR?} \fB::msgcat::mcmset\fR can be significantly -faster than multiple invocations of \fB::msgcat::mcset\fR. The function -returns the number of translations set. -.TP -\fB::msgcat::mcflset \fIsrc-string \fR?\fItranslate-string\fR? -Sets the translation for \fIsrc-string\fR to \fItranslate-string\fR in the -current namespace for the locale implied by the name of the message catalog -being loaded via \fB::msgcat::mcload\fR. If \fItranslate-string\fR is not -specified, \fIsrc-string\fR is used for both. The function returns -\fItranslate-string\fR. -.TP -\fB::msgcat::mcflmset \fIsrc-trans-list\fR -Sets the translation for multiple source strings in \fIsrc-trans-list\fR in -the current namespace for the locale implied by the name of the message -catalog being loaded via \fB::msgcat::mcload\fR. \fIsrc-trans-list\fR must -have an even number of elements and is in the form {\fIsrc-string -translate-string\fR ?\fIsrc-string translate-string ...\fR?} -\fB::msgcat::mcflmset\fR can be significantly faster than multiple invocations -of \fB::msgcat::mcflset\fR. The function returns the number of translations set. -.TP -\fB::msgcat::mcunknown \fIlocale src-string\fR ?\fIarg arg ...\fR? -. -This routine is called by \fB::msgcat::mc\fR in the case when -a translation for \fIsrc-string\fR is not defined in the -current locale. The default action is to return -\fIsrc-string\fR passed by format if there are any arguments. This -procedure can be redefined by the -application, for example to log error messages for each unknown -string. The \fB::msgcat::mcunknown\fR procedure is invoked at the -same stack context as the call to \fB::msgcat::mc\fR. The return value -of \fB::msgcat::mcunknown\fR is used as the return value for the call -to \fB::msgcat::mc\fR. -.VS "TIP 412" -.RS -.PP -Note that this routine is only called if the concerned package did not set a package locale unknown command name. -.RE -.TP -\fB::msgcat::mcforgetpackage\fR -. -The calling package clears all its state within the \fBmsgcat\fR package including all settings and translations. -.VE "TIP 412" -.PP -.SH "LOCALE SPECIFICATION" -.PP -The locale is specified to \fBmsgcat\fR by a locale string -passed to \fB::msgcat::mclocale\fR. -The locale string consists of -a language code, an optional country code, and an optional -system-specific code, each separated by -.QW _ . -The country and language -codes are specified in standards ISO-639 and ISO-3166. -For example, the locale -.QW en -specifies English and -.QW en_US -specifies U.S. English. -.PP -When the msgcat package is first loaded, the locale is initialized -according to the user's environment. The variables \fBenv(LC_ALL)\fR, -\fBenv(LC_MESSAGES)\fR, and \fBenv(LANG)\fR are examined in order. -The first of them to have a non-empty value is used to determine the -initial locale. The value is parsed according to the XPG4 pattern -.PP -.CS -language[_country][.codeset][@modifier] -.CE -.PP -to extract its parts. The initial locale is then set by calling -\fB::msgcat::mclocale\fR with the argument -.PP -.CS -language[_country][_modifier] -.CE -.PP -On Windows and Cygwin, if none of those environment variables is set, -msgcat will attempt to extract locale information from the registry. -From Windows Vista on, the RFC4747 locale name "lang-script-country-options" -is transformed to the locale as "lang_country_script" (Example: -sr-Latn-CS -> sr_cs_latin). For Windows XP, the language id is -transformed analoguously (Example: 0c1a -> sr_yu_cyrillic). -If all these attempts to discover an initial locale from the user's -environment fail, msgcat defaults to an initial locale of -.QW C . -.PP -When a locale is specified by the user, a -.QW "best match" -search is performed during string translation. For example, if a user -specifies -en_GB_Funky, the locales -.QW en_gb_funky , -.QW en_gb , -.QW en -and -.MT -(the empty string) -are searched in order until a matching translation -string is found. If no translation string is available, then -the unknown handler 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 -multiple packages to use the same strings without fear -of collisions with other packages. It also allows the -source string to be shorter and less prone to typographical -error. -.PP -For example, executing the code -.PP -.CS -\fB::msgcat::mcset\fR en hello "hello from ::" -namespace eval foo { - \fB::msgcat::mcset\fR en hello "hello from ::foo" -} -puts [\fB::msgcat::mc\fR hello] -namespace eval foo {puts [\fB::msgcat::mc\fR hello]} -.CE -.PP -will print -.PP -.CS -hello from :: -hello from ::foo -.CE -.PP -When searching for a translation of a message, the -message catalog will search first the current namespace, -then the parent of the current namespace, and so on until -the global namespace is reached. This allows child namespaces to -.QW inherit -messages from their parent namespace. -.PP -For example, executing (in the -.QW en -locale) the code -.PP -.CS -\fB::msgcat::mcset\fR en m1 ":: message1" -\fB::msgcat::mcset\fR en m2 ":: message2" -\fB::msgcat::mcset\fR en m3 ":: message3" -namespace eval ::foo { - \fB::msgcat::mcset\fR en m2 "::foo message2" - \fB::msgcat::mcset\fR en m3 "::foo message3" -} -namespace eval ::foo::bar { - \fB::msgcat::mcset\fR en m3 "::foo::bar message3" -} -namespace import \fB::msgcat::mc\fR -puts "[\fBmc\fR m1]; [\fBmc\fR m2]; [\fBmc\fR m3]" -namespace eval ::foo {puts "[\fBmc\fR m1]; [\fBmc\fR m2]; [\fBmc\fR m3]"} -namespace eval ::foo::bar {puts "[\fBmc\fR m1]; [\fBmc\fR m2]; [\fBmc\fR m3]"} -.CE -.PP -will print -.PP -.CS -:: message1; :: message2; :: message3 -:: message1; ::foo message2; ::foo message3 -:: message1; ::foo message2; ::foo::bar message3 -.CE -.SH "LOCATION AND FORMAT OF MESSAGE FILES" -.PP -Message files can be located in any directory, subject -to the following conditions: -.IP [1] -All message files for a package are in the same directory. -.IP [2] -The message file name is a msgcat locale specifier (all lowercase) followed by -.QW .msg . -For example: -.PP -.CS -es.msg \(em spanish -en_gb.msg \(em United Kingdom English -.CE -.PP -\fIException:\fR The message file for the root locale -.MT -is called -.QW \fBROOT.msg\fR . -This exception is made so as not to -cause peculiar behavior, such as marking the message file as -.QW hidden -on Unix file systems. -.IP [3] -The file contains a series of calls to \fBmcflset\fR and -\fBmcflmset\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: -.PP -.CS -namespace eval ::mypackage { - \fB::msgcat::mcflset\fR "Free Beer" "Cerveza Gratis" -} -.CE -.SH "RECOMMENDED MESSAGE SETUP FOR PACKAGES" -.PP -If a package is installed into a subdirectory of the -\fBtcl_pkgPath\fR and loaded via \fBpackage require\fR, the -following procedure is recommended. -.IP [1] -During package installation, create a subdirectory -\fBmsgs\fR under your package directory. -.IP [2] -Copy your *.msg files into that directory. -.IP [3] -Add the following command to your package initialization script: -.PP -.CS -# load language files, stored in msgs subdirectory -\fB::msgcat::mcload\fR [file join [file dirname [info script]] msgs] -.CE -.SH "POSITIONAL CODES FOR FORMAT AND SCAN COMMANDS" -.PP -It is possible that a message string used as an argument -to \fBformat\fR might have positionally dependent parameters that -might need to be repositioned. For example, it might be -syntactically desirable to rearrange the sentence structure -while translating. -.PP -.CS -format "We produced %d units in location %s" $num $city -format "In location %s we produced %d units" $city $num -.CE -.PP -This can be handled by using the positional -parameters: -.PP -.CS -format "We produced %1\e$d units in location %2\e$s" $num $city -format "In location %2\e$s we produced %1\e$d units" $num $city -.CE -.PP -Similarly, positional parameters can be used with \fBscan\fR to -extract values from internationalized strings. Note that it is not -necessary to pass the output of \fB::msgcat::mc\fR to \fBformat\fR -directly; by passing the values to substitute in as arguments, the -formatting substitution is done directly. -.PP -.CS -\fBmsgcat::mc\fR {Produced %1$d at %2$s} $num $city -# ... where that key is mapped to one of the -# human-oriented versions by \fBmsgcat::mcset\fR -.CE -.VS "TIP 412" -.SH Package private locale -.PP -A package using \fBmsgcat\fR may choose to use its own package private -locale and its own set of loaded locales, independent to the global -locale set by \fB::msgcat::mclocale\fR. -.PP -This allows a package to change its locale without causing any locales load or removal in other packages and not to invoke the global locale change callback (see below). -.PP -This action is controled by the following ensemble: -.TP -\fB::msgcat::mcpackagelocale set\fR ?\fIlocale\fR? -. -Set or change a package private locale. -The package private locale is set to the given \fIlocale\fR if the \fIlocale\fR is given. -If the option \fIlocale\fR is not given, the package is set to package private locale mode, but no locale is changed (e.g. if the global locale was valid for the package before, it is copied to the package private locale). -.PP -.RS -This command may cause the load of locales. -.RE -.TP -\fB::msgcat::mcpackagelocale get\fR -. -Return the package private locale or the global locale, if no package private locale is set. -.TP -\fB::msgcat::mcpackagelocale preferences\fR -. -Return the package private preferences or the global preferences, -if no package private locale is set. -.TP -\fB::msgcat::mcpackagelocale loaded\fR -. -Return the list of locales loaded for this package. -.TP -\fB::msgcat::mcpackagelocale isset\fR -. -Returns true, if a package private locale is set. -.TP -\fB::msgcat::mcpackagelocale unset\fR -. -Unset the package private locale and use the globale locale. -Load and remove locales to adjust the list of loaded locales for the -package to the global loaded locales list. -.TP -\fB::msgcat::mcpackagelocale present\fR \fIlocale\fR -. -Returns true, if the given locale is loaded for the package. -.TP -\fB::msgcat::mcpackagelocale clear\fR -. -Clear any loaded locales of the package not present in the package preferences. -.PP -.SH Changing package options -.PP -Each package using msgcat has a set of options within \fBmsgcat\fR. -The package options are described in the next sectionPackage options. -Each package option may be set or unset individually using the following ensemble: -.TP -\fB::msgcat::mcpackageconfig get\fR \fIoption\fR -. -Return the current value of the given \fIoption\fR. -This call returns an error if the option is not set for the package. -.TP -\fB::msgcat::mcpackageconfig isset\fR \fIoption\fR -. -Returns 1, if the given \fIoption\fR is set for the package, 0 otherwise. -.TP -\fB::msgcat::mcpackageconfig set\fR \fIoption\fR \fIvalue\fR -. -Set the given \fIoption\fR to the given \fIvalue\fR. -This may invoke additional actions in dependency of the \fIoption\fR. -The return value is 0 or the number of loaded packages for the option \fBmcfolder\fR. -.TP -\fB::msgcat::mcpackageconfig unset\fR \fIoption\fR -. -Unsets the given \fIoption\fR for the package. -No action is taken if the \fIoption\fR is not set for the package. -The empty string is returned. -.SS Package options -.PP -The following package options are available for each package: -.TP -\fBmcfolder\fR -. -This is the message folder of the package. This option is set by mcload and by the subcommand set. Both are identical and both return the number of loaded message catalog files. -.RS -.PP -Setting or changing this value will load all locales contained in the preferences valid for the package. This implies also to invoke any set loadcmd (see below). -.PP -Unsetting this value will disable message file load for the package. -.RE -.TP -\fBloadcmd\fR -. -This callback is invoked before a set of message catalog files are loaded for the package which has this property set. -.PP -.RS -This callback may be used to do any preparation work for message file load or to get the message data from another source like a data base. In this case, no message files are used (mcfolder is unset). -.PP -See section \fBcallback invocation\fR below. -The parameter list appended to this callback is the list of locales to load. -.PP -If this callback is changed, it is called with the preferences valid for the package. -.RE -.TP -\fBchangecmd\fR -. -This callback is invoked when a default local change was performed. Its purpose is to allow a package to update any dependency on the default locale like showing the GUI in another language. -.PP -.RS -See the callback invocation section below. -The parameter list appended to this callback is \fBmcpreferences\fR. -The registered callbacks are invoked in no particular order. -.RE -.TP -\fBunknowncmd\fR -. -Use a package locale mcunknown procedure instead of the standard version supplied by the msgcat package (msgcat::mcunknown). -.PP -.RS -The called procedure must return the formatted message which will finally be returned by msgcat::mc. -.PP -A generic unknown handler is used if set to the empty string. This consists in returning the key if no arguments are given. With given arguments, format is used to process the arguments. -.PP -See section \fBcallback invocation\fR below. -The appended arguments are identical to \fB::msgcat::mcunknown\fR. -.RE -.SS Callback invocation -A package may decide to register one or multiple callbacks, as described above. -.PP -Callbacks are invoked, if: -.PP -1. the callback command is set, -.PP -2. the command is not the empty string, -.PP -3. the registering namespace exists. -.PP -If a called routine fails with an error, the \fBbgerror\fR routine for the interpreter is invoked after command completion. -Only exception is the callback \fBunknowncmd\fR, where an error causes the invoking \fBmc\fR-command to fail with that error. -.PP -.SS Examples -Packages which display a GUI may update their widgets when the global locale changes. -To register to a callback, use: -.CS -namespace eval gui { - msgcat::mcpackageconfig changecmd updateGUI - - proc updateGui args { - puts "New locale is '[lindex $args 0]'." - } -} -% msgcat::mclocale fr -fr -% New locale is 'fr'. -.CE -.PP -If locales (or additional locales) are contained in another source like a data base, a package may use the load callback and not mcload: -.CS -namespace eval db { - msgcat::mcpackageconfig loadcmd loadMessages - - proc loadMessages args { - foreach locale $args { - if {[LocaleInDB $locale]} { - msgcat::mcmset $locale [GetLocaleList $locale] - } - } - } -} -.CE -.PP -The \fBclock\fR command implementation uses \fBmsgcat\fR with a package locale to implement the command line parameter \fB-locale\fR. -Here are some sketches of the implementation: -.PP -First, a package locale is initialized and the generic unknown function is desactivated: -.CS -msgcat::mcpackagelocale set -msgcat::mcpackageconfig unknowncmd "" -.CE -As an example, the user requires the week day in a certain locale as follows: -.CS -clock format clock seconds -format %A -locale fr -.CE -\fBclock\fR sets the package locale to \fBfr\fR and looks for the day name as follows: -.CS -msgcat::mcpackagelocale set $locale -return [lindex [msgcat::mc DAYS_OF_WEEK_FULL] $day] -### Returns "mercredi" -.CE -Within \fBclock\fR, some message-catalog items are heavy in computation and thus are dynamically cached using: -.CS -proc ::tcl::clock::LocalizeFormat { locale format } { - set key FORMAT_$format - if { [::msgcat::mcexists -exactlocale -exactnamespace $key] } { - return [mc $key] - } - #...expensive computation of format clipped... - mcset $locale $key $format - return $format -} -.CE -.VE "TIP 412" -.SH CREDITS -.PP -The message catalog code was developed by Mark Harrison. -.SH "SEE ALSO" -format(n), scan(n), namespace(n), package(n) -.SH KEYWORDS -internationalization, i18n, localization, l10n, message, text, translation -.\" Local Variables: -.\" mode: nroff -.\" End: diff --git a/doc/my.n b/doc/my.n deleted file mode 100644 index 2a9769b..0000000 --- a/doc/my.n +++ /dev/null @@ -1,56 +0,0 @@ -'\" -'\" Copyright (c) 2007 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH my n 0.1 TclOO "TclOO Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -my \- invoke any method of current object -.SH SYNOPSIS -.nf -package require TclOO - -\fBmy\fI methodName\fR ?\fIarg ...\fR? -.fi -.BE -.SH DESCRIPTION -.PP -The \fBmy\fR command is used to allow methods of objects to invoke any method -of the object (or its class). In particular, the set of valid values for -\fImethodName\fR is the set of all methods supported by an object and its -superclasses, including those that are not exported. The object upon which the -method is invoked is always the one that is the current context of the method -(i.e. the object that is returned by \fBself object\fR) from which the -\fBmy\fR command is invoked. -.PP -Each object has its own \fBmy\fR command, contained in its instance namespace. -.SH EXAMPLES -.PP -This example shows basic use of \fBmy\fR to use the \fBvariables\fR method of -the \fBoo::object\fR class, which is not publicly visible by default: -.PP -.CS -oo::class create c { - method count {} { - \fBmy\fR variable counter - puts [incr counter] - } -} -c create o -o count \fI\(-> prints "1"\fR -o count \fI\(-> prints "2"\fR -o count \fI\(-> prints "3"\fR -.CE -.SH "SEE ALSO" -next(n), oo::object(n), self(n) -.SH KEYWORDS -method, method visibility, object, private method, public method - -.\" Local variables: -.\" mode: nroff -.\" fill-column: 78 -.\" End: diff --git a/doc/namespace.n b/doc/namespace.n deleted file mode 100644 index b0b6e25..0000000 --- a/doc/namespace.n +++ /dev/null @@ -1,969 +0,0 @@ -'\" -'\" 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. -'\" -.TH namespace n 8.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -namespace \- create and manipulate contexts for commands and variables -.SH SYNOPSIS -\fBnamespace \fR?\fIsubcommand\fR? ?\fIarg ...\fR? -.BE -.SH DESCRIPTION -.PP -The \fBnamespace\fR command lets you create, access, and destroy -separate contexts for commands and variables. -See the section \fBWHAT IS A NAMESPACE?\fR below -for a brief overview of namespaces. -The legal values of \fIsubcommand\fR are listed below. -Note that you can abbreviate the \fIsubcommand\fRs. -.TP -\fBnamespace children \fR?\fInamespace\fR? ?\fIpattern\fR? -. -Returns a list of all child namespaces that belong to the -namespace \fInamespace\fR. -If \fInamespace\fR is not specified, -then the children are returned for the current namespace. -This command returns fully-qualified names, -which start with a double colon (\fB::\fR). -If the optional \fIpattern\fR is given, -then this command returns only the names that match the glob-style pattern. -The actual pattern used is determined as follows: -a pattern that starts with double colon (\fB::\fR) is used directly, -otherwise the namespace \fInamespace\fR -(or the fully-qualified name of the current namespace) -is prepended onto the pattern. -.TP -\fBnamespace code \fIscript\fR -. -Captures the current namespace context for later execution -of the script \fIscript\fR. -It returns a new script in which \fIscript\fR has been wrapped -in a \fBnamespace inscope\fR command. -The new script has two important properties. -First, it can be evaluated in any namespace and will cause -\fIscript\fR to be evaluated in the current namespace -(the one where the \fBnamespace code\fR command was invoked). -Second, additional arguments can be appended to the resulting script -and they will be passed to \fIscript\fR as additional arguments. -For example, suppose the command -\fBset script [namespace code {foo bar}]\fR -is invoked in namespace \fB::a::b\fR. -Then \fBeval $script [list x y]\fR -can be executed in any namespace (assuming the value of -\fBscript\fR has been passed in properly) -and will have the same effect as the command -\fB::namespace eval ::a::b {foo bar x y}\fR. -This command is needed because -extensions like Tk normally execute callback scripts -in the global namespace. -A scoped command captures a command together with its namespace context -in a way that allows it to be executed properly later. -See the section \fBSCOPED SCRIPTS\fR for some examples -of how this is used to create callback scripts. -.TP -\fBnamespace current\fR -. -Returns the fully-qualified name for the current namespace. -The actual name of the global namespace is -.MT -(i.e., an empty string), -but this command returns \fB::\fR for the global namespace -as a convenience to programmers. -.TP -\fBnamespace delete \fR?\fInamespace namespace ...\fR? -. -Each namespace \fInamespace\fR is deleted -and all variables, procedures, and child namespaces -contained in the namespace are deleted. -If a procedure is currently executing inside the namespace, -the namespace will be kept alive until the procedure returns; -however, the namespace is marked to prevent other code from -looking it up by name. -If a namespace does not exist, this command returns an error. -If no namespace names are given, this command does nothing. -.TP -\fBnamespace ensemble\fR \fIsubcommand\fR ?\fIarg ...\fR? -. -Creates and manipulates a command that is formed out of an ensemble of -subcommands. See the section \fBENSEMBLES\fR below for further -details. -.TP -\fBnamespace eval\fR \fInamespace arg\fR ?\fIarg ...\fR? -. -Activates a namespace called \fInamespace\fR and evaluates some code -in that context. -If the namespace does not already exist, it is created. -If more than one \fIarg\fR argument is specified, -the arguments are concatenated together with a space between each one -in the same fashion as the \fBeval\fR command, -and the result is evaluated. -.RS -.PP -If \fInamespace\fR has leading namespace qualifiers -and any leading namespaces do not exist, -they are automatically created. -.RE -.TP -\fBnamespace exists\fR \fInamespace\fR -. -Returns \fB1\fR if \fInamespace\fR is a valid namespace in the current -context, returns \fB0\fR otherwise. -.TP -\fBnamespace export \fR?\fB\-clear\fR? ?\fIpattern pattern ...\fR? -. -Specifies which commands are exported from a namespace. -The exported commands are those that can be later imported -into another namespace using a \fBnamespace import\fR command. -Both commands defined in a namespace and -commands the namespace has previously imported -can be exported by a namespace. -The commands do not have to be defined -at the time the \fBnamespace export\fR command is executed. -Each \fIpattern\fR may contain glob-style special characters, -but it may not include any namespace qualifiers. -That is, the pattern can only specify commands -in the current (exporting) namespace. -Each \fIpattern\fR is appended onto the namespace's list of export patterns. -If the \fB\-clear\fR flag is given, -the namespace's export pattern list is reset to empty before any -\fIpattern\fR arguments are appended. -If no \fIpattern\fRs are given and the \fB\-clear\fR flag is not given, -this command returns the namespace's current export list. -.TP -\fBnamespace forget \fR?\fIpattern pattern ...\fR? -. -Removes previously imported commands from a namespace. -Each \fIpattern\fR is a simple or qualified name such as -\fBx\fR, \fBfoo::x\fR or \fBa::b::p*\fR. -Qualified names contain double colons (\fB::\fR) and qualify a name -with the name of one or more namespaces. -Each -.QW "qualified pattern" -is qualified with the name of an exporting namespace -and may have glob-style special characters in the command name -at the end of the qualified name. -Glob characters may not appear in a namespace name. -For each -.QW "simple pattern" -this command deletes the matching commands of the -current namespace that were imported from a different namespace. -For -.QW "qualified patterns" , -this command first finds the matching exported commands. -It then checks whether any of those commands -were previously imported by the current namespace. -If so, this command deletes the corresponding imported commands. -In effect, this un-does the action of a \fBnamespace import\fR command. -.TP -\fBnamespace import \fR?\fB\-force\fR? ?\fIpattern\fR \fIpattern ...\fR? -. -Imports commands into a namespace, or queries the set of imported -commands in a namespace. When no arguments are present, -\fBnamespace import\fR returns the list of commands in -the current namespace that have been imported from other -namespaces. The commands in the returned list are in -the format of simple names, with no namespace qualifiers at all. -This format is suitable for composition with \fBnamespace forget\fR -(see \fBEXAMPLES\fR below). -.RS -.PP -When \fIpattern\fR arguments are present, -each \fIpattern\fR is a qualified name like -\fBfoo::x\fR or \fBa::p*\fR. -That is, it includes the name of an exporting namespace -and may have glob-style special characters in the command name -at the end of the qualified name. -Glob characters may not appear in a namespace name. -When the namespace name is not fully qualified (i.e., does not start -with a namespace separator) it is resolved as a namespace name in the -way described in the \fBNAME RESOLUTION\fR section; it is an error if -no namespace with that name can be found. -.PP -All the commands that match a \fIpattern\fR string -and which are currently exported from their namespace -are added to the current namespace. -This is done by creating a new command in the current namespace -that points to the exported command in its original namespace; -when the new imported command is called, it invokes the exported command. -This command normally returns an error -if an imported command conflicts with an existing command. -However, if the \fB\-force\fR option is given, -imported commands will silently replace existing commands. -The \fBnamespace import\fR command has snapshot semantics: -that is, only requested commands that are currently defined -in the exporting namespace are imported. -In other words, you can import only the commands that are in a namespace -at the time when the \fBnamespace import\fR command is executed. -If another command is defined and exported in this namespace later on, -it will not be imported. -.RE -.TP -\fBnamespace inscope\fR \fInamespace\fR \fIscript\fR ?\fIarg ...\fR? -. -Executes a script in the context of the specified \fInamespace\fR. -This command is not expected to be used directly by programmers; -calls to it are generated implicitly when applications -use \fBnamespace code\fR commands to create callback scripts -that the applications then register with, e.g., Tk widgets. -The \fBnamespace inscope\fR command is much like the \fBnamespace eval\fR -command except that the \fInamespace\fR must already exist, -and \fBnamespace inscope\fR appends additional \fIarg\fRs -as proper list elements. -.RS -.PP -.CS -\fBnamespace inscope ::foo $script $x $y $z\fR -.CE -.PP -is equivalent to -.PP -.CS -\fBnamespace eval ::foo [concat $script [list $x $y $z]]\fR -.CE -.PP -thus additional arguments will not undergo a second round of substitution, -as is the case with \fBnamespace eval\fR. -.RE -.TP -\fBnamespace origin \fIcommand\fR -. -Returns the fully-qualified name of the original command -to which the imported command \fIcommand\fR refers. -When a command is imported into a namespace, -a new command is created in that namespace -that points to the actual command in the exporting namespace. -If a command is imported into a sequence of namespaces -\fIa, b,...,n\fR where each successive namespace -just imports the command from the previous namespace, -this command returns the fully-qualified name of the original command -in the first namespace, \fIa\fR. -If \fIcommand\fR does not refer to an imported command, -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? -. -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. -.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. -This command is the complement of the \fBnamespace tail\fR command. -Note that it does not check whether the -namespace names are, in fact, -the names of currently defined namespaces. -.TP -\fBnamespace tail\fR \fIstring\fR -. -Returns the simple name at the end of a qualified string. -Qualifiers are namespace names separated by double colons (\fB::\fR). -For the \fIstring\fR \fB::foo::bar::x\fR, -this command returns \fBx\fR, -and for \fB::\fR it returns an empty string. -This command is the complement of the \fBnamespace qualifiers\fR command. -It does not check whether the namespace names are, in fact, -the names of currently defined namespaces. -.TP -\fBnamespace upvar\fR \fInamespace\fR ?\fIotherVar myVar \fR...? -. -This command arranges for zero or more local variables in the current -procedure to refer to variables in \fInamespace\fR. The namespace name is -resolved as described in section \fBNAME RESOLUTION\fR. -The command -\fBnamespace upvar $ns a b\fR has the same behaviour as -\fBupvar 0 ${ns}::a b\fR, with the sole exception of the resolution rules -used for qualified namespace or variable names. -\fBnamespace upvar\fR returns an empty string. -.TP -\fBnamespace unknown\fR ?\fIscript\fR? -. -Sets or returns the unknown command handler for the current namespace. -The handler is invoked when a command called from within the namespace -cannot be found in the current namespace, the namespace's path nor in -the global namespace. -The \fIscript\fR argument, if given, should be a well -formed list representing a command name and optional arguments. When -the handler is invoked, the full invocation line will be appended to the -script and the result evaluated in the context of the namespace. The -default handler for all namespaces is \fB::unknown\fR. If no argument -is given, it returns the handler for the current namespace. -.TP -\fBnamespace which\fR ?\fB\-command\fR? ?\fB\-variable\fR? \fIname\fR -. -Looks up \fIname\fR as either a command or variable -and returns its fully-qualified name. -For example, if \fIname\fR does not exist in the current namespace -but does exist in the global namespace, -this command returns a fully-qualified name in the global namespace. -If the command or variable does not exist, -this command returns an empty string. If the variable has been -created but not defined, such as with the \fBvariable\fR command -or through a \fBtrace\fR on the variable, this command will return the -fully-qualified name of the variable. -If no flag is given, \fIname\fR is treated as a command name. -See the section \fBNAME RESOLUTION\fR below for an explanation of -the rules regarding name resolution. -.SH "WHAT IS A NAMESPACE?" -.PP -A namespace is a collection of commands and variables. -It encapsulates the commands and variables to ensure that they -will not interfere with the commands and variables of other namespaces. -Tcl has always had one such collection, -which we refer to as the \fIglobal namespace\fR. -The global namespace holds all global variables and commands. -The \fBnamespace eval\fR command lets you create new namespaces. -For example, -.PP -.CS -\fBnamespace eval\fR Counter { - \fBnamespace export\fR bump - variable num 0 - - proc bump {} { - variable num - incr num - } -} -.CE -.PP -creates a new namespace containing the variable \fBnum\fR and -the procedure \fBbump\fR. -The commands and variables in this namespace are separate from -other commands and variables in the same program. -If there is a command named \fBbump\fR in the global namespace, -for example, it will be different from the command \fBbump\fR -in the \fBCounter\fR namespace. -.PP -Namespace variables resemble global variables in Tcl. -They exist outside of the procedures in a namespace -but can be accessed in a procedure via the \fBvariable\fR command, -as shown in the example above. -.PP -Namespaces are dynamic. -You can add and delete commands and variables at any time, -so you can build up the contents of a -namespace over time using a series of \fBnamespace eval\fR commands. -For example, the following series of commands has the same effect -as the namespace definition shown above: -.PP -.CS -\fBnamespace eval\fR Counter { - variable num 0 - proc bump {} { - variable num - return [incr num] - } -} -\fBnamespace eval\fR Counter { - proc test {args} { - return $args - } -} -\fBnamespace eval\fR Counter { - rename test "" -} -.CE -.PP -Note that the \fBtest\fR procedure is added to the \fBCounter\fR namespace, -and later removed via the \fBrename\fR command. -.PP -Namespaces can have other namespaces within them, -so they nest hierarchically. -A nested namespace is encapsulated inside its parent namespace -and can not interfere with other namespaces. -.SH "QUALIFIED NAMES" -.PP -Each namespace has a textual name such as -\fBhistory\fR or \fB::safe::interp\fR. -Since namespaces may nest, -qualified names are used to refer to -commands, variables, and child namespaces contained inside namespaces. -Qualified names are similar to the hierarchical path names for -Unix files or Tk widgets, -except that \fB::\fR is used as the separator -instead of \fB/\fR or \fB.\fR. -The topmost or global namespace has the name -.MT -(i.e., an empty string), although \fB::\fR is a synonym. -As an example, the name \fB::safe::interp::create\fR -refers to the command \fBcreate\fR in the namespace \fBinterp\fR -that is a child of namespace \fB::safe\fR, -which in turn is a child of the global namespace, \fB::\fR. -.PP -If you want to access commands and variables from another namespace, -you must use some extra syntax. -Names must be qualified by the namespace that contains them. -From the global namespace, -we might access the \fBCounter\fR procedures like this: -.PP -.CS -Counter::bump 5 -Counter::Reset -.CE -.PP -We could access the current count like this: -.PP -.CS -puts "count = $Counter::num" -.CE -.PP -When one namespace contains another, you may need more than one -qualifier to reach its elements. -If we had a namespace \fBFoo\fR that contained the namespace \fBCounter\fR, -you could invoke its \fBbump\fR procedure -from the global namespace like this: -.PP -.CS -Foo::Counter::bump 3 -.CE -.PP -You can also use qualified names when you create and rename commands. -For example, you could add a procedure to the \fBFoo\fR -namespace like this: -.PP -.CS -proc Foo::Test {args} {return $args} -.CE -.PP -And you could move the same procedure to another namespace like this: -.PP -.CS -rename Foo::Test Bar::Test -.CE -.PP -There are a few remaining points about qualified names -that we should cover. -Namespaces have nonempty names except for the global namespace. -\fB::\fR is disallowed in simple command, variable, and namespace names -except as a namespace separator. -Extra colons in any separator part of a qualified name are ignored; -i.e. two or more colons are treated as a namespace separator. -A trailing \fB::\fR in a qualified variable or command name -refers to the variable or command named {}. -However, a trailing \fB::\fR in a qualified namespace name is ignored. -.SH "NAME RESOLUTION" -.PP -In general, all Tcl commands that take variable and command names -support qualified names. -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: -.IP \(bu -\fBVariable names\fR are always resolved by looking first in the current -namespace, and then in the global namespace. -.IP \(bu -\fBCommand names\fR are 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 appropriate \fBnamespace unknown\fR handler.) -.IP \(bu -\fBNamespace names\fR are always resolved by looking in only the current -namespace. -.PP -In the following example, -.PP -.CS -set traceLevel 0 -\fBnamespace eval\fR Debug { - printTrace $traceLevel -} -.CE -.PP -Tcl looks for \fBtraceLevel\fR in the namespace \fBDebug\fR -and then in the global namespace. -It looks up the command \fBprintTrace\fR in the same way. -If a variable or command name is not found in either context, -the name is undefined. -To make this point absolutely clear, consider the following example: -.PP -.CS -set traceLevel 0 -\fBnamespace eval\fR Foo { - variable traceLevel 3 - - \fBnamespace eval\fR Debug { - printTrace $traceLevel - } -} -.CE -.PP -Here Tcl looks for \fBtraceLevel\fR first in the namespace \fBFoo::Debug\fR. -Since it is not found there, Tcl then looks for it -in the global namespace. -The variable \fBFoo::traceLevel\fR is completely ignored -during the name resolution process. -.PP -You can use the \fBnamespace which\fR command to clear up any question -about name resolution. -For example, the command: -.PP -.CS -\fBnamespace eval\fR Foo::Debug {\fBnamespace which\fR \-variable traceLevel} -.CE -.PP -returns \fB::traceLevel\fR. -On the other hand, the command, -.PP -.CS -\fBnamespace eval\fR Foo {\fBnamespace which\fR \-variable traceLevel} -.CE -.PP -returns \fB::Foo::traceLevel\fR. -.PP -As mentioned above, -namespace names are looked up differently -than the names of variables and commands. -Namespace names are always resolved in the current namespace. -This means, for example, -that a \fBnamespace eval\fR command that creates a new namespace -always creates a child of the current namespace -unless the new namespace name begins with \fB::\fR. -.PP -Tcl has no access control to limit what variables, commands, -or namespaces you can reference. -If you provide a qualified name that resolves to an element -by the name resolution rule above, -you can access the element. -.PP -You can access a namespace variable -from a procedure in the same namespace -by using the \fBvariable\fR command. -Much like the \fBglobal\fR command, -this creates a local link to the namespace variable. -If necessary, it also creates the variable in the current namespace -and initializes it. -Note that the \fBglobal\fR command only creates links -to variables in the global namespace. -It is not necessary to use a \fBvariable\fR command -if you always refer to the namespace variable using an -appropriate qualified name. -.SH "IMPORTING COMMANDS" -.PP -Namespaces are often used to represent libraries. -Some library commands are used so frequently -that it is a nuisance to type their qualified names. -For example, suppose that all of the commands in a package -like BLT are contained in a namespace called \fBBlt\fR. -Then you might access these commands like this: -.PP -.CS -Blt::graph .g \-background red -Blt::table . .g 0,0 -.CE -.PP -If you use the \fBgraph\fR and \fBtable\fR commands frequently, -you may want to access them without the \fBBlt::\fR prefix. -You can do this by importing the commands into the current namespace, -like this: -.PP -.CS -\fBnamespace import\fR Blt::* -.CE -.PP -This adds all exported commands from the \fBBlt\fR namespace -into the current namespace context, so you can write code like this: -.PP -.CS -graph .g \-background red -table . .g 0,0 -.CE -.PP -The \fBnamespace import\fR command only imports commands -from a namespace that that namespace exported -with a \fBnamespace export\fR command. -.PP -Importing \fIevery\fR command from a namespace is generally -a bad idea since you do not know what you will get. -It is better to import just the specific commands you need. -For example, the command -.PP -.CS -\fBnamespace import\fR Blt::graph Blt::table -.CE -.PP -imports only the \fBgraph\fR and \fBtable\fR commands into the -current context. -.PP -If you try to import a command that already exists, you will get an -error. This prevents you from importing the same command from two -different packages. But from time to time (perhaps when debugging), -you may want to get around this restriction. You may want to -reissue the \fBnamespace import\fR command to pick up new commands -that have appeared in a namespace. In that case, you can use the -\fB\-force\fR option, and existing commands will be silently overwritten: -.PP -.CS -\fBnamespace import\fR \-force Blt::graph Blt::table -.CE -.PP -If for some reason, you want to stop using the imported commands, -you can remove them with a \fBnamespace forget\fR command, like this: -.PP -.CS -\fBnamespace forget\fR Blt::* -.CE -.PP -This searches the current namespace for any commands imported from \fBBlt\fR. -If it finds any, it removes them. Otherwise, it does nothing. -After this, the \fBBlt\fR commands must be accessed with the \fBBlt::\fR -prefix. -.PP -When you delete a command from the exporting namespace like this: -.PP -.CS -rename Blt::graph "" -.CE -.PP -the command is automatically removed from all namespaces that import it. -.SH "EXPORTING COMMANDS" -You can export commands from a namespace like this: -.PP -.CS -\fBnamespace eval\fR Counter { - \fBnamespace export\fR bump reset - variable Num 0 - variable Max 100 - - proc bump {{by 1}} { - variable Num - incr Num $by - Check - return $Num - } - proc reset {} { - variable Num - set Num 0 - } - proc Check {} { - variable Num - variable Max - if {$Num > $Max} { - error "too high!" - } - } -} -.CE -.PP -The procedures \fBbump\fR and \fBreset\fR are exported, -so they are included when you import from the \fBCounter\fR namespace, -like this: -.PP -.CS -\fBnamespace import\fR Counter::* -.CE -.PP -However, the \fBCheck\fR procedure is not exported, -so it is ignored by the import operation. -.PP -The \fBnamespace import\fR command only imports commands -that were declared as exported by their namespace. -The \fBnamespace export\fR command specifies what commands -may be imported by other namespaces. -If a \fBnamespace import\fR command specifies a command -that is not exported, the command is not imported. -.SH "SCOPED SCRIPTS" -.PP -The \fBnamespace code\fR command is the means by which a script may be -packaged for evaluation in a namespace other than the one in which it -was created. It is used most often to create event handlers, Tk bindings, -and traces for evaluation in the global context. For instance, the following -code indicates how to direct a variable \fBtrace\fR callback into the current -namespace: -.PP -.CS -\fBnamespace eval\fR a { - variable b - proc theTraceCallback { n1 n2 op } { - upvar 1 $n1 var - puts "the value of $n1 has changed to $var" - return - } - trace add variable b write [\fBnamespace code\fR theTraceCallback] -} -set a::b c -.CE -.PP -When executed, it prints the message: -.PP -.CS -the value of a::b has changed to c -.CE -.SH ENSEMBLES -.PP -The \fBnamespace ensemble\fR is used to create and manipulate ensemble -commands, which are commands formed by grouping subcommands together. -The commands typically come from the current namespace when the -ensemble was created, though this is configurable. Note that there -may be any number of ensembles associated with any namespace -(including none, which is true of all namespaces by default), though -all the ensembles associated with a namespace are deleted when that -namespace is deleted. The link between an ensemble command and its -namespace is maintained however the ensemble is renamed. -.PP -Three subcommands of the \fBnamespace ensemble\fR command are defined: -.TP -\fBnamespace ensemble create\fR ?\fIoption value ...\fR? -. -Creates a new ensemble command linked to the current namespace, -returning the fully qualified name of the command created. The -arguments to \fBnamespace ensemble create\fR allow the configuration -of the command as if with the \fBnamespace ensemble configure\fR -command. If not overridden with the \fB\-command\fR option, this -command creates an ensemble with exactly the same name as the linked -namespace. See the section \fBENSEMBLE OPTIONS\fR below for a full -list of options supported and their effects. -.TP -\fBnamespace ensemble configure \fIcommand\fR ?\fIoption\fR? ?\fIvalue ...\fR? -. -Retrieves the value of an option associated with the ensemble command -named \fIcommand\fR, or updates some options associated with that -ensemble command. See the section \fBENSEMBLE OPTIONS\fR below for a -full list of options supported and their effects. -.TP -\fBnamespace ensemble exists\fR \fIcommand\fR -. -Returns a boolean value that describes whether the command -\fIcommand\fR exists and is an ensemble command. This command only -ever returns an error if the number of arguments to the command is -wrong. -.PP -When called, an ensemble command takes its first argument and looks it -up (according to the rules described below) to discover a list of -words to replace the ensemble command and subcommand with. The -resulting list of words is then evaluated (with no further -substitutions) as if that was what was typed originally (i.e. by -passing the list of words through \fBTcl_EvalObjv\fR) and returning -the result of the command. Note that it is legal to make the target -of an ensemble rewrite be another (or even the same) ensemble -command. The ensemble command will not be visible through the use of -the \fBuplevel\fR or \fBinfo level\fR commands. -.SS "ENSEMBLE OPTIONS" -.PP -The following options, supported by the \fBnamespace ensemble -create\fR and \fBnamespace ensemble configure\fR commands, control how -an ensemble command behaves: -.TP -\fB\-map\fR -. -When non-empty, this option supplies a dictionary that provides a -mapping from subcommand names to a list of prefix words to substitute -in place of the ensemble command and subcommand words (in a manner -similar to an alias created with \fBinterp alias\fR; the words are not -reparsed after substitution); if the first word of any target is not -fully qualified when set, it is assumed to be relative to the -\fIcurrent\fR namespace and changed to be exactly that (that is, it is -always fully qualified when read). When this option is empty, the mapping -will be from the local name of the subcommand to its fully-qualified -name. Note that when this option is non-empty and the -\fB\-subcommands\fR option is empty, the ensemble subcommand names -will be exactly those words that have mappings in the dictionary. -.TP -\fB\-parameters\fR -.VS 8.6 -This option gives a list of named arguments (the names being used during -generation of error messages) that are passed by the caller of the ensemble -between the name of the ensemble and the subcommand argument. By default, it -is the empty list. -.VE 8.6 -.TP -\fB\-prefixes\fR -. -This option (which is enabled by default) controls whether the -ensemble command recognizes unambiguous prefixes of its subcommands. -When turned off, the ensemble command requires exact matching of -subcommand names. -.TP -\fB\-subcommands\fR -. -When non-empty, this option lists exactly what subcommands are in the -ensemble. The mapping for each of those commands will be either whatever -is defined in the \fB\-map\fR option, or to the command with the same -name in the namespace linked to the ensemble. If this option is -empty, the subcommands of the namespace will either be the keys of the -dictionary listed in the \fB\-map\fR option or the exported commands -of the linked namespace at the time of the invocation of the ensemble -command. -.TP -\fB\-unknown\fR -. -When non-empty, this option provides a partial command (to which all -the words that are arguments to the ensemble command, including the -fully-qualified name of the ensemble, are appended) to handle the case -where an ensemble subcommand is not recognized and would otherwise -generate an error. When empty (the default) an error (in the style of -\fBTcl_GetIndexFromObj\fR) is generated whenever the ensemble is -unable to determine how to implement a particular subcommand. See -\fBUNKNOWN HANDLER BEHAVIOUR\fR for more details. -.PP -The following extra option is allowed by \fBnamespace ensemble -create\fR: -.TP -\fB\-command\fR -. -This write-only option allows the name of the ensemble created by -\fBnamespace ensemble create\fR to be anything in any existing -namespace. The default value for this option is the fully-qualified -name of the namespace in which the \fBnamespace ensemble create\fR -command is invoked. -.PP -The following extra option is allowed by \fBnamespace ensemble -configure\fR: -.TP -\fB\-namespace\fR -. -This read-only option allows the retrieval of the fully-qualified name -of the namespace which the ensemble was created within. -.SS "UNKNOWN HANDLER BEHAVIOUR" -.PP -If an unknown handler is specified for an ensemble, that handler is -called when the ensemble command would otherwise return an error due -to it being unable to decide which subcommand to invoke. The exact -conditions under which that occurs are controlled by the -\fB\-subcommands\fR, \fB\-map\fR and \fB\-prefixes\fR options as -described above. -.PP -To execute the unknown handler, the ensemble mechanism takes the -specified \fB\-unknown\fR option and appends each argument of the -attempted ensemble command invocation (including the ensemble command -itself, expressed as a fully qualified name). It invokes the resulting -command in the scope of the attempted call. If the execution of the -unknown handler terminates normally, the ensemble engine reparses the -subcommand (as described below) and tries to dispatch it again, which -is ideal for when the ensemble's configuration has been updated by the -unknown subcommand handler. Any other kind of termination of the -unknown handler is treated as an error. -.PP -The result of the unknown handler is expected to be a list (it is an -error if it is not). If the list is an empty list, the ensemble -command attempts to look up the original subcommand again and, if it -is not found this time, an error will be generated just as if the -\fB\-unknown\fR handler was not there (i.e. for any particular -invocation of an ensemble, its unknown handler will be called at most -once.) This makes it easy for the unknown handler to update the -ensemble or its backing namespace so as to provide an implementation -of the desired subcommand and reparse. -.PP -When the result is a non-empty list, the words of that list are used -to replace the ensemble command and subcommand, just as if they had -been looked up in the \fB\-map\fR. It is up to the unknown handler to -supply all namespace qualifiers if the implementing subcommand is not -in the namespace of the caller of the ensemble command. Also note that -when ensemble commands are chained (e.g. if you make one of the -commands that implement an ensemble subcommand into an ensemble, in a -manner similar to the \fBtext\fR widget's tag and mark subcommands) then the -rewrite happens in the context of the caller of the outermost -ensemble. That is to say that ensembles do not in themselves place any -namespace contexts on the Tcl call stack. -.PP -Where an empty \fB\-unknown\fR handler is given (the default), the -ensemble command will generate an error message based on the list of -commands that the ensemble has defined (formatted similarly to the -error message from \fBTcl_GetIndexFromObj\fR). This is the error that -will be thrown when the subcommand is still not recognized during -reparsing. It is also an error for an \fB\-unknown\fR handler to -delete its namespace. -.SH EXAMPLES -Create a namespace containing a variable and an exported command: -.PP -.CS -\fBnamespace eval\fR foo { - variable bar 0 - proc grill {} { - variable bar - puts "called [incr bar] times" - } - \fBnamespace export\fR grill -} -.CE -.PP -Call the command defined in the previous example in various ways. -.PP -.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: -.PP -.CS -puts "grill came from [\fBnamespace origin\fR grill]" -.CE -.PP -Remove all imported commands from the current namespace: -.PP -.CS -namespace forget {*}[namespace import] -.CE -.PP -.VS 8.6 -Create an ensemble for simple working with numbers, using the -\fB\-parameters\fR option to allow the operator to be put between the first -and second arguments. -.PP -.CS -\fBnamespace eval\fR do { - \fBnamespace export\fR * - \fBnamespace ensemble\fR create -parameters x - proc plus {x y} {expr { $x + $y }} - proc minus {x y} {expr { $x - $y }} -} - -# In use, the ensemble works like this: -puts [do 1 plus [do 9 minus 7]] -.CE -.VE 8.6 -.SH "SEE ALSO" -interp(n), upvar(n), variable(n) -.SH KEYWORDS -command, ensemble, exported, internal, variable -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/next.n b/doc/next.n deleted file mode 100644 index db846be..0000000 --- a/doc/next.n +++ /dev/null @@ -1,208 +0,0 @@ -'\" -'\" Copyright (c) 2007 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH next n 0.1 TclOO "TclOO Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -next, nextto \- invoke superclass method implementations -.SH SYNOPSIS -.nf -package require TclOO - -\fBnext\fR ?\fIarg ...\fR? -\fBnextto\fI class\fR ?\fIarg ...\fR? -.fi -.BE - -.SH DESCRIPTION -.PP -The \fBnext\fR command is used to call implementations of a method by a class, -superclass or mixin that are overridden by the current method. It can only be -used from within a method. It is also used within filters to indicate the -point where a filter calls the actual implementation (the filter may decide to -not go along the chain, and may process the results of going along the chain -of methods as it chooses). The result of the \fBnext\fR command is the result -of the next method in the method chain; if there are no further methods in the -method chain, the result of \fBnext\fR will be an error. The arguments, -\fIarg\fR, to \fBnext\fR are the arguments to pass to the next method in the -chain. -.PP -The \fBnextto\fR command is the same as the \fBnext\fR command, except that it -takes an additional \fIclass\fR argument that identifies a class whose -implementation of the current method chain (see \fBinfo object\fR \fBcall\fR) should -be used; the method implementation selected will be the one provided by the -given class, and it must refer to an existing non-filter invocation that lies -further along the chain than the current implementation. -.SH "THE METHOD CHAIN" -.PP -When a method of an object is invoked, things happen in several stages: -.IP [1] -The structure of the object, its class, superclasses, filters, and mixins, are -examined to build a \fImethod chain\fR, which contains a list of method -implementations to invoke. -.IP [2] -The first method implementation on the chain is invoked. -.IP [3] -If that method implementation invokes the \fBnext\fR command, the next method -implementation is invoked (with its arguments being those that were passed to -\fBnext\fR). -.IP [4] -The result from the overall method call is the result from the outermost -method implementation; inner method implementations return their results -through \fBnext\fR. -.IP [5] -The method chain is cached for future use. -.SS "METHOD SEARCH ORDER" -.PP -When constructing the method chain, method implementations are searched for in -the following order: -.IP [1] -In the classes mixed into the object, in class traversal order. The list of -mixins is checked in natural order. -.IP [2] -In the classes mixed into the classes of the object, with sources of mixing in -being searched in class traversal order. Within each class, the list of mixins -is processed in natural order. -.IP [3] -In the object itself. -.IP [4] -In the object's class. -.IP [5] -In the superclasses of the class, following each superclass in a depth-first -fashion in the natural order of the superclass list. -.PP -Any particular method implementation always comes as \fIlate\fR in the -resulting list of implementations as possible; this means that if some class, -A, is both mixed into a class, B, and is also a superclass of B, the instances -of B will always treat A as a superclass from the perspective of inheritance. -This is true even when the multiple inheritance is processed indirectly. -.SS FILTERS -.PP -When an object has a list of filter names set upon it, or is an instance of a -class (or has mixed in a class) that has a list of filter names set upon it, -before every invocation of any method the filters are processed. Filter -implementations are found in class traversal order, as are the lists of filter -names (each of which is traversed in natural list order). Explicitly invoking -a method used as a filter will cause that method to be invoked twice, once as -a filter and once as a normal method. -.PP -Each filter should decide for itself whether to permit the execution to go -forward to the proper implementation of the method (which it does by invoking -the \fBnext\fR command as filters are inserted into the front of the method -call chain) and is responsible for returning the result of \fBnext\fR. -.PP -Filters are invoked when processing an invokation of the \fBunknown\fR -method because of a failure to locate a method implementation, but \fInot\fR -when invoking either constructors or destructors. (Note however that the -\fBdestroy\fR method is a conventional method, and filters are invoked as -normal when it is called.) -.SH EXAMPLES -.PP -This example demonstrates how to use the \fBnext\fR command to call the -(super)class's implementation of a method. The script: -.PP -.CS -oo::class create theSuperclass { - method example {args} { - puts "in the superclass, args = $args" - } -} -oo::class create theSubclass { - superclass theSuperclass - method example {args} { - puts "before chaining from subclass, args = $args" - \fBnext\fR a {*}$args b - \fBnext\fR pureSynthesis - puts "after chaining from subclass" - } -} -theSubclass create obj -oo::objdefine obj method example args { - puts "per-object method, args = $args" - \fBnext\fR x {*}$args y - \fBnext\fR -} -obj example 1 2 3 -.CE -.PP -prints the following: -.PP -.CS -per-object method, args = 1 2 3 -before chaining from subclass, args = x 1 2 3 y -in the superclass, args = a x 1 2 3 y b -in the superclass, args = pureSynthesis -after chaining from subclass -before chaining from subclass, args = -in the superclass, args = a b -in the superclass, args = pureSynthesis -after chaining from subclass -.CE -.PP -This example demonstrates how to build a simple cache class that applies -memoization to all the method calls of the objects it is mixed into, and shows -how it can make a difference to computation times: -.PP -.CS -oo::class create cache { - filter Memoize - method Memoize args { - \fI# Do not filter the core method implementations\fR - if {[lindex [self target] 0] eq "::oo::object"} { - return [\fBnext\fR {*}$args] - } - - \fI# Check if the value is already in the cache\fR - my variable ValueCache - set key [self target],$args - if {[info exist ValueCache($key)]} { - return $ValueCache($key) - } - - \fI# Compute value, insert into cache, and return it\fR - return [set ValueCache($key) [\fBnext\fR {*}$args]] - } - method flushCache {} { - my variable ValueCache - unset ValueCache - \fI# Skip the caching\fR - return -level 2 "" - } -} - -oo::object create demo -oo::objdefine demo { - mixin cache - method compute {a b c} { - after 3000 \fI;# Simulate deep thought\fR - return [expr {$a + $b * $c}] - } - method compute2 {a b c} { - after 3000 \fI;# Simulate deep thought\fR - return [expr {$a * $b + $c}] - } -} - -puts [demo compute 1 2 3] \fI\(-> prints "7" after delay\fR -puts [demo compute2 4 5 6] \fI\(-> prints "26" after delay\fR -puts [demo compute 1 2 3] \fI\(-> prints "7" instantly\fR -puts [demo compute2 4 5 6] \fI\(-> prints "26" instantly\fR -puts [demo compute 4 5 6] \fI\(-> prints "34" after delay\fR -puts [demo compute 4 5 6] \fI\(-> prints "34" instantly\fR -puts [demo compute 1 2 3] \fI\(-> prints "7" instantly\fR -demo flushCache -puts [demo compute 1 2 3] \fI\(-> prints "7" after delay\fR -.CE -.SH "SEE ALSO" -oo::class(n), oo::define(n), oo::object(n), self(n) -.SH KEYWORDS -call, method, method chain -.\" Local variables: -.\" mode: nroff -.\" fill-column: 78 -.\" End: diff --git a/doc/object.n b/doc/object.n deleted file mode 100644 index df657a9..0000000 --- a/doc/object.n +++ /dev/null @@ -1,128 +0,0 @@ -'\" -'\" Copyright (c) 2007-2008 Donal K. Fellows -'\" -'\" See the file "license.terms" for information on usage and redistribution -'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. -'\" -.TH object n 0.1 TclOO "TclOO Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -oo::object \- root class of the class hierarchy -.SH SYNOPSIS -.nf -package require TclOO - -\fBoo::object\fI method \fR?\fIarg ...\fR? -.fi -.SH "CLASS HIERARCHY" -.nf -\fBoo::object\fR -.fi -.BE -.SH DESCRIPTION -.PP -The \fBoo::object\fR class is the root class of the object hierarchy; every -object is an instance of this class. Since classes are themselves objects, -they are instances of this class too. Objects are always referred to by their -name, and may be \fBrename\fRd while maintaining their identity. -.PP -Instances of objects may be made with either the \fBcreate\fR or \fBnew\fR -methods of the \fBoo::object\fR object itself, or by invoking those methods on -any of the subclass objects; see \fBoo::class\fR for more details. The -configuration of individual objects (i.e., instance-specific methods, mixed-in -classes, etc.) may be controlled with the \fBoo::objdefine\fR command. -.PP -Each object has a unique namespace associated with it, the instance namespace. -This namespace holds all the instance variables of the object, and will be the -current namespace whenever a method of the object is invoked (including a -method of the class of the object). When the object is destroyed, its instance -namespace is deleted. The instance namespace contains the object's \fBmy\fR -command, which may be used to invoke non-exported methods of the object or to -create a reference to the object for the purpose of invocation which persists -across renamings of the object. -.SS CONSTRUCTOR -The \fBoo::object\fR class does not define an explicit constructor. -.SS DESTRUCTOR -The \fBoo::object\fR class does not define an explicit destructor. -.SS "EXPORTED METHODS" -The \fBoo::object\fR class supports the following exported methods: -.TP -\fIobj \fBdestroy\fR -. -This method destroys the object, \fIobj\fR, that it is invoked upon, invoking -any destructors on the object's class in the process. It is equivalent to -using \fBrename\fR to delete the object command. The result of this method is -always the empty string. -.SS "NON-EXPORTED METHODS" -.PP -The \fBoo::object\fR class supports the following non-exported methods: -.TP -\fIobj \fBeval\fR ?\fIarg ...\fR? -. -This method concatenates the arguments, \fIarg\fR, as if with \fBconcat\fR, -and then evaluates the resulting script in the namespace that is uniquely -associated with \fIobj\fR, returning the result of the evaluation. -.TP -\fIobj \fBunknown ?\fImethodName\fR? ?\fIarg ...\fR? -. -This method is called when an attempt to invoke the method \fImethodName\fR on -object \fIobj\fR fails. The arguments that the user supplied to the method are -given as \fIarg\fR arguments. -.VS -If \fImethodName\fR is absent, the object was invoked with no method name at -all (or any other arguments). -.VE -The default implementation (i.e., the one defined by the \fBoo::object\fR -class) generates a suitable error, detailing what methods the object supports -given whether the object was invoked by its public name or through the -\fBmy\fR command. -.TP -\fIobj \fBvariable \fR?\fIvarName ...\fR? -. -This method arranges for each variable called \fIvarName\fR to be linked from -the object \fIobj\fR's unique namespace into the caller's context. Thus, if it -is invoked from inside a procedure then the namespace variable in the object -is linked to the local variable in the procedure. Each \fIvarName\fR argument -must not have any namespace separators in it. The result is the empty string. -.TP -\fIobj \fBvarname \fIvarName\fR -. -This method returns the globally qualified name of the variable \fIvarName\fR -in the unique namespace for the object \fIobj\fR. -.TP -\fIobj \fB \fIsourceObjectName\fR -.VS -This method is used by the \fBoo::object\fR command to copy the state of one -object to another. It is responsible for copying the procedures and variables -of the namespace of the source object (\fIsourceObjectName\fR) to the current -object. It does not copy any other types of commands or any traces on the -variables; that can be added if desired by overriding this method in a -subclass. -.VE -.SH EXAMPLES -.PP -This example demonstrates basic use of an object. -.PP -.CS -set obj [\fBoo::object\fR new] -$obj foo \fI\(-> error "unknown method foo"\fR -oo::objdefine $obj method foo {} { - my \fBvariable\fR count - puts "bar[incr count]" -} -$obj foo \fI\(-> prints "bar1"\fR -$obj foo \fI\(-> prints "bar2"\fR -$obj variable count \fI\(-> error "unknown method variable"\fR -$obj \fBdestroy\fR -$obj foo \fI\(-> error "unknown command obj"\fR -.CE -.SH "SEE ALSO" -my(n), oo::class(n) -.SH KEYWORDS -base class, class, object, root class -.\" Local variables: -.\" mode: nroff -.\" fill-column: 78 -.\" End: diff --git a/doc/open.n b/doc/open.n deleted file mode 100644 index 1cccc0a..0000000 --- a/doc/open.n +++ /dev/null @@ -1,430 +0,0 @@ -'\" -'\" 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. -'\" -.TH open n 8.3 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -open \- Open a file-based or command pipeline channel -.SH SYNOPSIS -.sp -\fBopen \fIfileName\fR -.br -\fBopen \fIfileName access\fR -.br -\fBopen \fIfileName access permissions\fR -.BE -.SH DESCRIPTION -.PP -This command opens a file, serial port, or command pipeline and returns a -channel identifier that may be used in future invocations of commands like -\fBread\fR, \fBputs\fR, and \fBclose\fR. -If the first character of \fIfileName\fR is not \fB|\fR then -the command opens a file: -\fIfileName\fR gives the name of the file to open, and it must conform to the -conventions described in the \fBfilename\fR manual entry. -.PP -The \fIaccess\fR argument, if present, indicates the way in which the file -(or command pipeline) is to be accessed. -In the first form \fIaccess\fR may have any of the following values: -.TP 15 -\fBr\fR -. -Open the file for reading only; the file must already exist. This is the -default value if \fIaccess\fR is not specified. -.TP 15 -\fBr+\fR -. -Open the file for both reading and writing; the file must -already exist. -.TP 15 -\fBw\fR -. -Open the file for writing only. Truncate it if it exists. If it does not -exist, create a new file. -.TP 15 -\fBw+\fR -. -Open the file for reading and writing. Truncate it if it exists. -If it does not exist, create a new file. -.TP 15 -\fBa\fR -. -Open the file for writing only. If the file does not exist, -create a new empty file. -Set the file pointer to the end of the file prior to each write. -.TP 15 -\fBa+\fR -. -Open the file for reading and writing. If the file does not exist, -create a new empty file. -Set the initial access position to the end of the file. -.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 as if with the -\fBfconfigure\fR \fB\-translation binary\fR option, making the channel suitable for -reading or writing of binary data. -.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 -\fBBINARY\fR -. -Configure the opened channel with the \fB\-translation binary\fR option. -.TP 15 -\fBCREAT\fR -. -Create the file if it does not 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 -file already exists. -.TP 15 -\fBNOCTTY\fR -. -If the file is a terminal device, this flag prevents the file from -becoming the controlling terminal of the process. -.TP 15 -\fBNONBLOCK\fR -. -Prevents the process from blocking while opening the file, and -possibly in subsequent I/O operations. The exact behavior of -this flag is system- and device-dependent; its use is discouraged -(it is better to use the \fBfconfigure\fR command to put a file -in nonblocking mode). -For details refer to your system documentation on the \fBopen\fR system -call's \fBO_NONBLOCK\fR flag. -.TP 15 -\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 -.QW \fB|\fR -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. -In this case, the channel identifier returned by \fBopen\fR may be used -to write to the command's input pipe or read from its output pipe, -depending on the value of \fIaccess\fR. -If write-only access is used (e.g. \fIaccess\fR is -.QW \fBw\fR ), -then standard output for the pipeline is directed to the current standard -output unless overridden by the command. -If read-only access is used (e.g. \fIaccess\fR is -.QW \fBr\fR ), -standard input for the pipeline is taken from the current standard -input unless overridden by the command. -The id of the spawned process is accessible through the \fBpid\fR -command, using the channel id returned by \fBopen\fR as argument. -.PP -If the command (or one of the commands) executed in the command -pipeline returns an error (according to the definition in \fBexec\fR), -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 -The \fBfconfigure\fR command can be used to query and set additional -configuration options specific to serial ports (where supported): -.TP -\fB\-mode\fR \fIbaud\fB,\fIparity\fB,\fIdata\fB,\fIstop\fR -. -This option is a set of 4 comma-separated values: the baud rate, parity, -number of data bits, and number of stop bits for this serial port. The -\fIbaud\fR rate is a simple integer that specifies the connection speed. -\fIParity\fR is one of the following letters: \fBn\fR, \fBo\fR, \fBe\fR, -\fBm\fR, \fBs\fR; respectively signifying the parity options of -.QW none , -.QW odd , -.QW even , -.QW mark , -or -.QW space . -\fIData\fR is the number of -data bits and should be an integer from 5 to 8, while \fIstop\fR is the -number of stop bits and should be the integer 1 or 2. -.TP -\fB\-handshake\fR \fItype\fR -. -(Windows and Unix). This option is used to setup automatic handshake -control. Note that not all handshake types maybe supported by your operating -system. The \fItype\fR parameter is case-independent. -.RS -.PP -If \fItype\fR is \fBnone\fR then any handshake is switched off. -\fBrtscts\fR activates hardware handshake. Hardware handshake signals -are described below. -For software handshake \fBxonxoff\fR the handshake characters can be redefined -with \fB\-xchar\fR. -An additional hardware handshake \fBdtrdsr\fR is available only under Windows. -There is no default handshake configuration, the initial value depends -on your operating system settings. -The \fB\-handshake\fR option cannot be queried. -.RE -.TP -\fB\-queue\fR -. -(Windows and Unix). The \fB\-queue\fR option can only be queried. -It returns a list of two integers representing the current number -of bytes in the input and output queue respectively. -.TP -\fB\-timeout\fR \fImsec\fR -. -(Windows and Unix). This option is used to set the timeout for blocking -read operations. It specifies the maximum interval between the -reception of two bytes in milliseconds. -For Unix systems the granularity is 100 milliseconds. -The \fB\-timeout\fR option does not affect write operations or -nonblocking reads. -This option cannot be queried. -.TP -\fB\-ttycontrol\fR \fI{signal boolean signal boolean ...}\fR -. -(Windows and Unix). This option is used to setup the handshake -output lines (see below) permanently or to send a BREAK over the serial line. -The \fIsignal\fR names are case-independent. -\fB{RTS 1 DTR 0}\fR sets the RTS output to high and the DTR output to low. -The BREAK condition (see below) is enabled and disabled with \fB{BREAK 1}\fR and -\fB{BREAK 0}\fR respectively. -It is not a good idea to change the \fBRTS\fR (or \fBDTR\fR) signal -with active hardware handshake \fBrtscts\fR (or \fBdtrdsr\fR). -The result is unpredictable. -The \fB\-ttycontrol\fR option cannot be queried. -.TP -\fB\-ttystatus\fR -. -(Windows and Unix). The \fB\-ttystatus\fR option can only be -queried. It returns the current modem status and handshake input signals -(see below). -The result is a list of signal,value pairs with a fixed order, -e.g. \fB{CTS 1 DSR 0 RING 1 DCD 0}\fR. -The \fIsignal\fR names are returned upper case. -.TP -\fB\-xchar\fR \fI{xonChar xoffChar}\fR -. -(Windows and Unix). This option is used to query or change the software -handshake characters. Normally the operating system default should be -DC1 (0x11) and DC3 (0x13) representing the ASCII standard -XON and XOFF characters. -.TP -\fB\-pollinterval\fR \fImsec\fR -. -(Windows only). This option is used to set the maximum time between -polling for fileevents. -This affects the time interval between checking for events throughout the Tcl -interpreter (the smallest value always wins). Use this option only if -you want to poll the serial port more or less often than 10 msec -(the default). -.TP -\fB\-sysbuffer\fR \fIinSize\fR -.TP -\fB\-sysbuffer\fR \fI{inSize outSize}\fR -. -(Windows only). This option is used to change the size of Windows -system buffers for a serial channel. Especially at higher communication -rates the default input buffer size of 4096 bytes can overrun -for latent systems. The first form specifies the input buffer size, -in the second form both input and output buffers are defined. -.TP -\fB\-lasterror\fR -. -(Windows only). This option is query only. -In case of a serial communication error, \fBread\fR or \fBputs\fR -returns a general Tcl file I/O error. -\fBfconfigure\fR \fB\-lasterror\fR can be called to get a list of error details. -See below for an explanation of the various error codes. -.SH "SERIAL PORT SIGNALS" -.PP -RS-232 is the most commonly used standard electrical interface for serial -communications. A negative voltage (-3V..-12V) define a mark (on=1) bit and -a positive voltage (+3..+12V) define a space (off=0) bit (RS-232C). The -following signals are specified for incoming and outgoing data, status -lines and handshaking. Here we are using the terms \fIworkstation\fR for -your computer and \fImodem\fR for the external device, because some signal -names (DCD, RI) come from modems. Of course your external device may use -these signal lines for other purposes. -.IP \fBTXD\fR(output) -\fBTransmitted Data:\fR Outgoing serial data. -.IP \fBRXD\fR(input) -\fBReceived Data:\fRIncoming serial data. -.IP \fBRTS\fR(output) -\fBRequest To Send:\fR This hardware handshake line informs the modem that -your workstation is ready to receive data. Your workstation may -automatically reset this signal to indicate that the input buffer is full. -.IP \fBCTS\fR(input) -\fBClear To Send:\fR The complement to RTS. Indicates that the modem is -ready to receive data. -.IP \fBDTR\fR(output) -\fBData Terminal Ready:\fR This signal tells the modem that the workstation -is ready to establish a link. DTR is often enabled automatically whenever a -serial port is opened. -.IP \fBDSR\fR(input) -\fBData Set Ready:\fR The complement to DTR. Tells the workstation that the -modem is ready to establish a link. -.IP \fBDCD\fR(input) -\fBData Carrier Detect:\fR This line becomes active when a modem detects a -.QW Carrier -signal. -.IP \fBRI\fR(input) -\fBRing Indicator:\fR Goes active when the modem detects an incoming call. -.IP \fBBREAK\fR -A BREAK condition is not a hardware signal line, but a logical zero on the -TXD or RXD lines for a long period of time, usually 250 to 500 -milliseconds. Normally a receive or transmit data signal stays at the mark -(on=1) voltage until the next character is transferred. A BREAK is sometimes -used to reset the communications line or change the operating mode of -communications hardware. -.SH "ERROR CODES (Windows only)" -.PP -A lot of different errors may occur during serial read operations or during -event polling in background. The external device may have been switched -off, the data lines may be noisy, system buffers may overrun or your mode -settings may be wrong. That is why a reliable software should always -\fBcatch\fR serial read operations. In cases of an error Tcl returns a -general file I/O error. Then \fBfconfigure\fR \fB\-lasterror\fR may help to -locate the problem. The following error codes may be returned. -.TP 10 -\fBRXOVER\fR -. -Windows input buffer overrun. The data comes faster than your scripts reads -it or your system is overloaded. Use \fBfconfigure\fR \fB\-sysbuffer\fR to avoid a -temporary bottleneck and/or make your script faster. -.TP 10 -\fBTXFULL\fR -. -Windows output buffer overrun. Complement to RXOVER. This error should -practically not happen, because Tcl cares about the output buffer status. -.TP 10 -\fBOVERRUN\fR -. -UART buffer overrun (hardware) with data lost. -The data comes faster than the system driver receives it. -Check your advanced serial port settings to enable the FIFO (16550) buffer -and/or setup a lower(1) interrupt threshold value. -.TP 10 -\fBRXPARITY\fR -. -A parity error has been detected by your UART. -Wrong parity settings with \fBfconfigure\fR \fB\-mode\fR or a noisy data line (RXD) -may cause this error. -.TP 10 -\fBFRAME\fR -. -A stop-bit error has been detected by your UART. -Wrong mode settings with \fBfconfigure\fR \fB\-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 -. -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 9. -A legacy form accepted as well is \fBcom\fIX\fB:\fR. This notation only -works for serial ports from 1 to 9. An attempt to open a serial port that -does not exist or has a number greater than 9 will fail. An alternate -form of opening serial ports is to use the filename \fB//./comX\fR, -where X is any number that corresponds to a serial port. -.PP -.RS -When running Tcl interactively, there may be some strange interactions -between the real console, if one is present, and a command pipeline that uses -standard input or output. 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. If a command pipeline is opened for -writing, keystrokes entered into the console are not visible until the -pipe is closed. These problems only occur because both Tcl and the child -application are competing for the console at the same time. If the command -pipeline is started from a script, so that Tcl is not accessing the console, -or if the command pipeline does not use standard input or output, but is -redirected from or to a file, then the above problems do not occur. -.RE -.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. -.RS -.PP -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 -same time. If the command pipeline is started from a script, so that Tcl is -not accessing the console, or if the command pipeline does not use standard -input, but is redirected from a file, then the above problem does not occur. -.RE -.PP -See the \fBPORTABILITY ISSUES\fR section of the \fBexec\fR command for -additional information not specific to command pipelines about executing -applications on the various platforms -.SH "EXAMPLE" -.PP -Open a command pipeline and catch any errors: -.PP -.CS -set fl [\fBopen\fR "| ls this_file_does_not_exist"] -set data [read $fl] -if {[catch {close $fl} err]} { - puts "ls command failed: $err" -} -.CE -.SH "SEE ALSO" -file(n), close(n), filename(n), fconfigure(n), gets(n), read(n), -puts(n), exec(n), pid(n), fopen(3) -.SH KEYWORDS -access mode, append, create, file, non-blocking, open, permissions, -pipeline, process, serial -'\"Local Variables: -'\"mode: nroff -'\"End: diff --git a/doc/package.n b/doc/package.n deleted file mode 100644 index 5687480..0000000 --- a/doc/package.n +++ /dev/null @@ -1,378 +0,0 @@ -'\" -'\" 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. -'\" -.TH package n 7.5 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -package \- Facilities for package loading and version control -.SH SYNOPSIS -.nf -\fBpackage files\fR \fIpackage\fR -\fBpackage forget\fR ?\fIpackage package ...\fR? -\fBpackage ifneeded \fIpackage version\fR ?\fIscript\fR? -\fBpackage names\fR -\fBpackage present \fIpackage \fR?\fIrequirement...\fR? -\fBpackage present \-exact \fIpackage version\fR -\fBpackage provide \fIpackage \fR?\fIversion\fR? -\fBpackage require \fIpackage \fR?\fIrequirement...\fR? -\fBpackage require \-exact \fIpackage version\fR -\fBpackage unknown \fR?\fIcommand\fR? -\fBpackage vcompare \fIversion1 version2\fR -\fBpackage versions \fIpackage\fR -\fBpackage vsatisfies \fIversion requirement...\fR -\fBpackage prefer \fR?\fBlatest\fR|\fBstable\fR? -.fi -.BE -.SH DESCRIPTION -.PP -This command keeps a simple database of the packages available for -use by the current interpreter and how to load them into the -interpreter. -It supports multiple versions of each package and arranges -for the correct version of a package to be loaded based on what -is needed by the application. -This command also detects and reports version clashes. -Typically, only the \fBpackage require\fR and \fBpackage provide\fR -commands are invoked in normal Tcl scripts; the other commands are used -primarily by system scripts that maintain the package database. -.PP -The behavior of the \fBpackage\fR command is determined by its first argument. -The following forms are permitted: -.TP -\fBpackage files\fR \fIpackage\fR -. -Lists all files forming part of \fIpackage\fR. Auto-loaded files are not -included in this list, only files which were directly sourced during package -initialization. The list order corresponds with the order in which the -files were sourced. -.TP -\fBpackage forget\fR ?\fIpackage package ...\fR? -. -Removes all information about each specified package from this interpreter, -including information provided by both \fBpackage ifneeded\fR and -\fBpackage provide\fR. -.TP -\fBpackage ifneeded \fIpackage version\fR ?\fIscript\fR? -. -This command typically appears only in system configuration -scripts to set up the package database. -It indicates that a particular version of -a particular package is available if needed, and that the package -can be added to the interpreter by executing \fIscript\fR. -The script is saved in a database for use by subsequent -\fBpackage require\fR commands; typically, \fIscript\fR -sets up auto-loading for the commands in the package (or calls -\fBload\fR and/or \fBsource\fR directly), then invokes -\fBpackage provide\fR to indicate that the package is present. -There may be information in the database for several different -versions of a single package. -If the database already contains information for \fIpackage\fR -and \fIversion\fR, the new \fIscript\fR replaces the existing -one. -If the \fIscript\fR argument is omitted, the current script for -version \fIversion\fR of package \fIpackage\fR is returned, -or an empty string if no \fBpackage ifneeded\fR command has -been invoked for this \fIpackage\fR and \fIversion\fR. -.TP -\fBpackage names\fR -. -Returns a list of the names of all packages in the -interpreter for which a version has been provided (via -\fBpackage provide\fR) or for which a \fBpackage ifneeded\fR -script is available. -The order of elements in the list is arbitrary. -.TP -\fBpackage present\fR ?\fB\-exact\fR? \fIpackage\fR ?\fIrequirement...\fR? -. -This command is equivalent to \fBpackage require\fR except that it -does not try and load the package if it is not already loaded. -.TP -\fBpackage provide \fIpackage \fR?\fIversion\fR? -. -This command is invoked to indicate that version \fIversion\fR -of package \fIpackage\fR is now present in the interpreter. -It is typically invoked once as part of an \fBifneeded\fR script, -and again by the package itself when it is finally loaded. -An error occurs if a different version of \fIpackage\fR has been -provided by a previous \fBpackage provide\fR command. -If the \fIversion\fR argument is omitted, then the command -returns the version number that is currently provided, or an -empty string if no \fBpackage provide\fR command has been -invoked for \fIpackage\fR in this interpreter. -.TP -\fBpackage require \fR\fIpackage \fR?\fIrequirement...\fR? -. -This command is typically invoked by Tcl code that wishes to use -a particular version of a particular package. The arguments -indicate which package is wanted, and the command ensures that -a suitable version of the package is loaded into the interpreter. -If the command succeeds, it returns the version number that is -loaded; otherwise it generates an error. -.RS -.PP -A suitable version of the package is any version which satisfies at -least one of the requirements, per the rules of \fBpackage -vsatisfies\fR. If multiple versions are suitable the implementation -with the highest version is chosen. This last part is additionally -influenced by the selection mode set with \fBpackage prefer\fR. -.PP -In the -.QW stable -selection mode the command will select the highest -stable version satisfying the requirements, if any. If no stable -version satisfies the requirements, the highest unstable version -satisfying the requirements will be selected. In the -.QW latest -selection mode the command will accept the highest version satisfying -all the requirements, regardless of its stableness. -.PP -If a version of \fIpackage\fR has already been provided (by invoking -the \fBpackage provide\fR command), then its version number must -satisfy the \fIrequirement\fRs and the command returns immediately. -Otherwise, the command searches the database of information provided by -previous \fBpackage ifneeded\fR commands to see if an acceptable -version of the package is available. -If so, the script for the highest acceptable version number is evaluated -in the global namespace; -it must do whatever is necessary to load the package, -including calling \fBpackage provide\fR for the package. -If the \fBpackage ifneeded\fR database does not contain an acceptable -version of the package and a \fBpackage unknown\fR command has been -specified for the interpreter then that command is evaluated in the -global namespace; when -it completes, Tcl checks again to see if the package is now provided -or if there is a \fBpackage ifneeded\fR script for it. -If all of these steps fail to provide an acceptable version of the -package, then the command returns an error. -.RE -.TP -\fBpackage require \-exact \fIpackage version\fR -. -This form of the command is used when only the given \fIversion\fR -of \fIpackage\fR is acceptable to the caller. This command is -equivalent to \fBpackage require \fIpackage version\fR-\fIversion\fR. -.TP -\fBpackage unknown \fR?\fIcommand\fR? -. -This command supplies a -.QW "last resort" -command to invoke during -\fBpackage require\fR if no suitable version of a package can be found -in the \fBpackage ifneeded\fR database. -If the \fIcommand\fR argument is supplied, it contains the first part -of a command; when the command is invoked during a \fBpackage require\fR -command, Tcl appends one or more additional arguments giving the desired -package name and requirements. -For example, if \fIcommand\fR is \fBfoo bar\fR and later the command -\fBpackage require test 2.4\fR is invoked, then Tcl will execute -the command \fBfoo bar test 2.4\fR to load the package. -If no requirements are supplied to the \fBpackage require\fR command, -then only the name will be added to invoked command. -If the \fBpackage unknown\fR command is invoked without a \fIcommand\fR -argument, then the current \fBpackage unknown\fR script is returned, -or an empty string if there is none. -If \fIcommand\fR is specified as an empty string, then the current -\fBpackage unknown\fR script is removed, if there is one. -.TP -\fBpackage vcompare \fIversion1 version2\fR -. -Compares the two version numbers given by \fIversion1\fR and \fIversion2\fR. -Returns -1 if \fIversion1\fR is an earlier version than \fIversion2\fR, -0 if they are equal, and 1 if \fIversion1\fR is later than \fIversion2\fR. -.TP -\fBpackage versions \fIpackage\fR -. -Returns a list of all the version numbers of \fIpackage\fR -for which information has been provided by \fBpackage ifneeded\fR -commands. -.TP -\fBpackage vsatisfies \fIversion requirement...\fR -. -Returns 1 if the \fIversion\fR satisfies at least one of the given -requirements, and 0 otherwise. Each \fIrequirement\fR is allowed to -have any of the forms: -.RS -.TP -min -. -This form is called -.QW min-bounded . -.TP -min- -. -This form is called -.QW min-unbound . -.TP -min-max -. -This form is called -.QW bounded . -.RE -.RS -.PP -where -.QW min -and -.QW max -are valid version numbers. The legacy syntax is -a special case of the extended syntax, keeping backward -compatibility. Regarding satisfaction the rules are: -.RE -.RS -.IP [1] -The \fIversion\fR has to pass at least one of the listed -\fIrequirement\fRs to be satisfactory. -.IP [2] -A version satisfies a -.QW bounded -requirement when -.RS -.IP [a] -For \fImin\fR equal to the \fImax\fR if, and only if the \fIversion\fR -is equal to the \fImin\fR. -.IP [b] -Otherwise if, and only if the \fIversion\fR is greater than or equal -to the \fImin\fR, and less than the \fImax\fR, where both \fImin\fR -and \fImax\fR have been padded internally with -.QW a0 . -Note that while the comparison to \fImin\fR is inclusive, the -comparison to \fImax\fR is exclusive. -.RE -.IP [3] -A -.QW min-bounded -requirement is a -.QW bounded -requirement in disguise, -with the \fImax\fR part implicitly specified as the next higher major -version number of the \fImin\fR part. A version satisfies it per the -rules above. -.IP [4] -A \fIversion\fR satisfies a -.QW min-unbound -requirement if, and only if it is greater than or equal to the -\fImin\fR, where the \fImin\fR has been padded internally with -.QW a0 . -There is no constraint to a maximum. -.RE -.TP -\fBpackage prefer \fR?\fBlatest\fR|\fBstable\fR? -With no arguments, the commands returns either -.QW latest -or -.QW stable , -whichever describes the current mode of selection logic used by -\fBpackage require\fR. -.RS -.PP -When passed the argument -.QW latest , -it sets the selection logic mode to -.QW latest . -.PP -When passed the argument -.QW stable , -if the mode is already -.QW stable , -that value is kept. If the mode is already -.QW latest , -then the attempt to set it back to -.QW stable -is ineffective and the mode value remains -.QW latest . -.PP -When passed any other value as an argument, raise an invalid argument -error. -.PP -When an interpreter is created, its initial selection mode value is set to -.QW stable -unless the environment variable \fBTCL_PKG_PREFER_LATEST\fR is set -(to any value) or the Tcl package itself is unstable. Otherwise -the initial (and permanent) selection mode value is set to -.QW latest . -.RE -.SH "VERSION NUMBERS" -.PP -Version numbers consist of one or more decimal numbers separated -by dots, such as 2 or 1.162 or 3.1.13.1. -The first number is called the major version number. -Larger numbers correspond to later versions of a package, with -leftmost numbers having greater significance. -For example, version 2.1 is later than 1.3 and version -3.4.6 is later than 3.3.5. -Missing fields are equivalent to zeroes: version 1.3 is the -same as version 1.3.0 and 1.3.0.0, so it is earlier than 1.3.1 or 1.3.0.2. -In addition, the letters -.QW a -(alpha) and/or -.QW b -(beta) may appear -exactly once to replace a dot for separation. These letters -semantically add a negative specifier into the version, where -.QW a -is \-2, and -.QW b -is \-1. Each may be specified only once, and -.QW a -or -.QW b -are mutually exclusive in a specifier. Thus 1.3a1 becomes (semantically) -1.3.\-2.1, 1.3b1 is 1.3.\-1.1. Negative numbers are not directly allowed -in version specifiers. -A version number not containing the letters -.QW a -or -.QW b -as specified -above is called a \fBstable\fR version, whereas presence of the letters -causes the version to be called is \fBunstable\fR. -A later version number is assumed to be upwards compatible with -an earlier version number as long as both versions have the same -major version number. -For example, Tcl scripts written for version 2.3 of a package should -work unchanged under versions 2.3.2, 2.4, and 2.5.1. -Changes in the major version number signify incompatible changes: -if code is written to use version 2.1 of a package, it is not guaranteed -to work unmodified with either version 1.7.3 or version 3.1. -.SH "PACKAGE INDICES" -.PP -The recommended way to use packages in Tcl is to invoke \fBpackage require\fR -and \fBpackage provide\fR commands in scripts, and use the procedure -\fBpkg_mkIndex\fR to create package index files. -Once you have done this, packages will be loaded automatically -in response to \fBpackage require\fR commands. -See the documentation for \fBpkg_mkIndex\fR for details. -.SH EXAMPLES -.PP -To state that a Tcl script requires the Tk and http packages, put this -at the top of the script: -.PP -.CS -\fBpackage require\fR Tk -\fBpackage require\fR http -.CE -.PP -To test to see if the Snack package is available and load if it is -(often useful for optional enhancements to programs where the loss of -the functionality is not critical) do this: -.PP -.CS -if {[catch {\fBpackage require\fR Snack}]} { - # Error thrown - package not found. - # Set up a dummy interface to work around the absence -} else { - # We have the package, configure the app to use it -} -.CE -.SH "SEE ALSO" -msgcat(n), packagens(n), pkgMkIndex(n) -.SH KEYWORDS -package, version -'\" Local Variables: -'\" mode: nroff -'\" End: diff --git a/doc/packagens.n b/doc/packagens.n deleted file mode 100644 index 5bd2e67..0000000 --- a/doc/packagens.n +++ /dev/null @@ -1,50 +0,0 @@ -'\" -'\" Copyright (c) 1998-2000 by Scriptics Corporation. -'\" All rights reserved. -'\" -.TH pkg::create n 8.3 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -pkg::create \- Construct an appropriate 'package ifneeded' command for a given package specification -.SH SYNOPSIS -\fB::pkg::create\fR \fB\-name \fIpackageName \fB\-version \fIpackageVersion\fR ?\fB\-load \fIfilespec\fR? ... ?\fB\-source \fIfilespec\fR? ... -.BE - -.SH DESCRIPTION -.PP -\fB::pkg::create\fR is a utility procedure that is part of the standard Tcl -library. It is used to create an appropriate \fBpackage ifneeded\fR -command for a given package specification. It can be used to construct a -\fBpkgIndex.tcl\fR file for use with the \fBpackage\fR mechanism. - -.SH OPTIONS -The parameters supported are: -.TP -\fB\-name \fIpackageName\fR -This parameter specifies the name of the package. It is required. -.TP -\fB\-version \fIpackageVersion\fR -This parameter specifies the version of the package. It is required. -.TP -\fB\-load \fIfilespec\fR -This parameter specifies a binary library that must be loaded with the -\fBload\fR command. \fIfilespec\fR is a list with two elements. The -first element is the name of the file to load. The second, optional -element is a list of commands supplied by loading that file. If the -list of procedures is empty or omitted, \fB::pkg::create\fR will -set up the library for direct loading (see \fBpkg_mkIndex\fR). Any -number of \fB\-load\fR parameters may be specified. -.TP -\fB\-source \fIfilespec\fR -This parameter is similar to the \fB\-load\fR parameter, except that it -specifies a Tcl library that must be loaded with the -\fBsource\fR command. Any number of \fB\-source\fR parameters may be -specified. -.PP -At least one \fB\-load\fR or \fB\-source\fR parameter must be given. -.SH "SEE ALSO" -package(n) -.SH KEYWORDS -auto-load, index, package, version diff --git a/doc/pid.n b/doc/pid.n deleted file mode 100644 index 6f8c399..0000000 --- a/doc/pid.n +++ /dev/null @@ -1,48 +0,0 @@ -'\" -'\" 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. -'\" -.TH pid n 7.0 Tcl "Tcl Built-In Commands" -.so man.macros -.BS -'\" Note: do not modify the .SH NAME line immediately below! -.SH NAME -pid \- Retrieve process identifiers -.SH SYNOPSIS -\fBpid \fR?\fIfileId\fR? -.BE - -.SH DESCRIPTION -.PP -If the \fIfileId\fR argument is given then it should normally -refer to a process pipeline created with the \fBopen\fR command. -In this case the \fBpid\fR command will return a list whose elements -are the process identifiers of all the processes in the pipeline, -in order. -The list will be empty if \fIfileId\fR refers to an open file -that is not a process pipeline. -If no \fIfileId\fR argument is given then \fBpid\fR returns the process -identifier of the current process. -All process identifiers are returned as decimal strings. -.SH EXAMPLE -Print process information about the processes in a pipeline using the -SysV \fBps\fR program before reading the output of that pipeline: -.PP -.CS -set pipeline [open "| zcat somefile.gz | grep foobar | sort -u"] -# Print process information -exec ps -fp [\fBpid\fR $pipeline] >@stdout -# Print a separator and then the output of the pipeline -puts [string repeat - 70] -puts [read $pipeline] -close $pipeline -.CE - -.SH "SEE ALSO" -exec(n), open(n) - -.SH KEYWORDS -file, pipeline, process identifier diff --git a/doc/pkgMkIndex.n b/doc/pkgMkIndex.n deleted file mode 100644 index ec39be9..0000000 --- a/doc/pkgMkIndex.n +++ /dev/null @@ -1,233 +0,0 @@ -'\" -'\" 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. -'\" -.TH pkg_mkIndex n 8.3 Tcl "Tcl Built-In Commands" -.so man.macros -.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\fR ?\fIoptions...\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. -It is used to create index files that allow packages to be loaded -automatically when \fBpackage require\fR commands are executed. -To use \fBpkg_mkIndex\fR, follow these steps: -.IP [1] -Create the package(s). -Each package may consist of one or more Tcl script files or binary files. -Binary files must be suitable for loading with the \fBload\fR command -with a single argument; for example, if the file is \fBtest.so\fR it must -be possible to load this file with the command \fBload test.so\fR. -Each script file must contain a \fBpackage provide\fR command to declare -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. -.RS -.PP -\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 -\fBpackage provide\fR commands or \fBTcl_PkgProvide\fR calls -in the files, as described above). -If you have a package split among scripts and binary files, -or if you have dependencies among files, -you may have to use the \fB\-load\fR option -or adjust the order in which \fBpkg_mkIndex\fR processes -the files. See \fBCOMPLEX CASES\fR below. -.RE -.IP [3] -Install the package as a subdirectory of one of the directories given by -the \fBtcl_pkgPath\fR variable. If \fB$tcl_pkgPath\fR contains more -than one directory, machine-dependent packages (e.g., those that -contain binary shared libraries) should normally be installed -under the first directory and machine-independent packages (e.g., -those that contain only Tcl scripts) should be installed under the -second directory. -The subdirectory should include -the package's script and/or binary files as well as the \fBpkgIndex.tcl\fR -file. As long as the package is installed as a subdirectory of a -directory in \fB$tcl_pkgPath\fR it will automatically be found during -\fBpackage require\fR commands. -.RS -.PP -If you install the package anywhere else, then you must ensure that -the directory containing the package is in the \fBauto_path\fR global variable -or an immediate subdirectory of one of the directories in \fBauto_path\fR. -\fBAuto_path\fR contains a list of directories that are searched -by both the auto-loader and the package loader; by default it -includes \fB$tcl_pkgPath\fR. -The package loader also checks all of the subdirectories of the -directories in \fBauto_path\fR. -You can add a directory to \fBauto_path\fR explicitly in your -application, or you can add the directory to your \fBTCLLIBPATH\fR -environment variable: if this environment variable is present, -Tcl initializes \fBauto_path\fR from it during application startup. -.RE -.IP [4] -Once the above steps have been taken, all you need to do to use a -package is to invoke \fBpackage require\fR. -For example, if versions 2.1, 2.3, and 3.1 of package \fBTest\fR -have been indexed by \fBpkg_mkIndex\fR, the command -\fBpackage require Test\fR will make version 3.1 available -and the command \fBpackage require \-exact Test 2.1\fR will -make version 2.1 available. -There may be many versions of a package in the various index files -in \fBauto_path\fR, but only one will actually be loaded in a given -interpreter, based on the first call to \fBpackage require\fR. -Different versions of a package may be loaded in different -interpreters. -.SH OPTIONS -The optional switches are: -.TP 15 -\fB\-direct\fR -The generated index will implement direct loading of the package -upon \fBpackage require\fR. This is the default. -.TP 15 -\fB\-lazy\fR -The generated index will manage to delay loading the package until the -use of one of the commands provided by the package, instead of loading -it immediately upon \fBpackage require\fR. This is not compatible with -the use of \fIauto_reset\fR, and therefore its use is discouraged. -.TP 15 -\fB\-load \fIpkgPat\fR -The index process will pre-load any packages that exist in the -current interpreter and match \fIpkgPat\fR into the slave interpreter used to -generate the index. The pattern match uses string match rules, but without -making case distinctions. -See \fBCOMPLEX CASES\fR below. -.TP 15 -\fB\-verbose\fR -Generate output during the indexing process. Output is via -the \fBtclLog\fR procedure, which by default prints to stderr. -.TP 15 -\fB\-\-\fR -End of the flags, in case \fIdir\fR begins with a dash. -.SH "PACKAGES AND THE AUTO-LOADER" -.PP -The package management facilities overlap somewhat with the auto-loader, -in that both arrange for files to be loaded on-demand. -However, package management is a higher-level mechanism that uses -the auto-loader for the last step in the loading process. -It is generally better to index a package with \fBpkg_mkIndex\fR -rather than \fBauto_mkindex\fR because the package mechanism provides -version control: several versions of a package can be made available -in the index files, with different applications using different -versions based on \fBpackage require\fR commands. -In contrast, \fBauto_mkindex\fR does not understand versions so -it can only handle a single version of each package. -It is probably not a good idea to index a given package with both -\fBpkg_mkIndex\fR and \fBauto_mkindex\fR. -If you use \fBpkg_mkIndex\fR to index a package, its commands cannot -be invoked until \fBpackage require\fR has been used to select a -version; in contrast, packages indexed with \fBauto_mkindex\fR -can be used immediately since there is no version control. -.SH "HOW IT WORKS" -.PP -\fBPkg_mkIndex\fR depends on the \fBpackage unknown\fR command, -the \fBpackage ifneeded\fR command, and the auto-loader. -The first time a \fBpackage require\fR command is invoked, -the \fBpackage unknown\fR script is invoked. -This is set by Tcl initialization to a script that -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